From: Andrea Bianco Date: Sun, 21 Mar 2021 17:55:41 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.22 X-Git-Tag: 2.5.22 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22https:/fonts.googleapis.com/%22my-avatar.png//%22%7B%7Blicense.mail?a=commitdiff_plain;h=de6f27d8824ffb29cbf937050a12378469af9a53;p=motion2.git Built motion from commit (unavailable).|2.5.22 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a414013..93f7b9b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-21T17:33:13.630Z", + "time": "2021-03-21T17:48:22.442Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 864ae80..2d4d559 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-21T17:33:13.630Z", + "time": "2021-03-21T17:48:22.442Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 19a77db..d87e4d7 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 _0x5795=['exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize'];(function(_0x117473,_0x485375){var _0x38711a=function(_0x33e119){while(--_0x33e119){_0x117473['push'](_0x117473['shift']());}};_0x38711a(++_0x485375);}(_0x5795,0xcf));var _0x5579=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x5795[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x5579('0x0'));module[_0x5579('0x1')]={'name':{'type':Sequelize[_0x5579('0x2')],'get':function(_0xaf5d4c){return this[_0x5579('0x3')](_0x5579('0x4'));}},'action':{'type':Sequelize[_0x5579('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5579('0x6'),_0x5579('0x7'),_0x5579('0x8'),'jscripty',_0x5579('0x9'),_0x5579('0xa'),_0x5579('0xb'),'script']],'msg':_0x5579('0xc')}},'comment':_0x5579('0xc')},'data1':{'type':Sequelize[_0x5579('0x5')](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[_0x5579('0x5')](0x1000),'comment':_0x5579('0xd')},'data3':{'type':Sequelize[_0x5579('0x5')](0x1000),'comment':_0x5579('0xe')},'data4':{'type':Sequelize[_0x5579('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x5579('0x5')]},'data7':{'type':Sequelize[_0x5579('0xf')]}}; \ No newline at end of file +var _0x7b5d=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','TEXT','sequelize','exports','action','contactManager','urlForward','bot','script'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x7b5d,0x1c7));var _0xd7b5=function(_0xecdcb9,_0x14de0a){_0xecdcb9=_0xecdcb9-0x0;var _0x5759eb=_0x7b5d[_0xecdcb9];return _0x5759eb;};'use strict';var Sequelize=require(_0xd7b5('0x0'));module[_0xd7b5('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e0485){return this['getDataValue'](_0xd7b5('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xd7b5('0x3'),'integration','motionbar','jscripty',_0xd7b5('0x4'),'browser',_0xd7b5('0x5'),_0xd7b5('0x6')]],'msg':_0xd7b5('0x7')}},'comment':_0xd7b5('0x7')},'data1':{'type':Sequelize[_0xd7b5('0x8')](0x1000),'comment':_0xd7b5('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xd7b5('0x8')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xd7b5('0x8')]},'data7':{'type':Sequelize[_0xd7b5('0xa')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 83400f4..d2d04f0 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 _0xe08b=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','body','Action','params','find','catch','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe08b,0x10e));var _0xbe08=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xe08b[_0x4bc65f];return _0x44f85f;};'use strict';var pdf=require(_0xbe08('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbe08('0x1'));var zipdir=require(_0xbe08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe08('0x3'));var moment=require(_0xbe08('0x4'));var BPromise=require(_0xbe08('0x5'));var Mustache=require(_0xbe08('0x6'));var util=require(_0xbe08('0x7'));var path=require(_0xbe08('0x8'));var sox=require(_0xbe08('0x9'));var csv=require(_0xbe08('0xa'));var ejs=require(_0xbe08('0xb'));var fs=require('fs');var _=require(_0xbe08('0xc'));var squel=require(_0xbe08('0xd'));var crypto=require(_0xbe08('0xe'));var jsforce=require(_0xbe08('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbe08('0xa'));var querystring=require(_0xbe08('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe08('0x11'));var authService=require(_0xbe08('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe08('0x13'));var hardwareService=require(_0xbe08('0x14'));var logger=require('../../config/logger')(_0xbe08('0x15'));var utils=require(_0xbe08('0x16'));var config=require(_0xbe08('0x17'));var licenseUtil=require(_0xbe08('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ab71,_0x49410b){_0x49410b=_0x49410b||0xcc;return function(_0x18ee13){if(_0x18ee13){return _0x42ab71[_0xbe08('0x19')](_0x49410b);}return _0x42ab71[_0xbe08('0x1a')](_0x49410b)[_0xbe08('0x1b')]();};}function respondWithResult(_0xe1dafa,_0x3050f1){_0x3050f1=_0x3050f1||0xc8;return function(_0x434646){if(_0x434646){return _0xe1dafa[_0xbe08('0x1a')](_0x3050f1)[_0xbe08('0x1c')](_0x434646);}};}function respondWithFilteredResult(_0x191f51,_0x457129){return function(_0x2b0901){if(_0x2b0901){var _0x122f44=_0x2b0901[_0xbe08('0x1d')],_0x1f4269=_0x457129[_0xbe08('0x1e')],_0x337787=_0x457129['offset']+_0x457129[_0xbe08('0x1f')],_0x40b190;if(_0x337787>=_0x122f44){_0x337787=_0x122f44;_0x40b190=0xc8;}else{_0x40b190=0xce;}_0x191f51[_0xbe08('0x1a')](_0x40b190);return _0x191f51[_0xbe08('0x20')](_0xbe08('0x21'),_0x1f4269+'-'+_0x337787+'/'+_0x122f44)[_0xbe08('0x1c')](_0x2b0901);}return null;};}function patchUpdates(_0x1393ac){return function(_0x1f9808){try{jsonpatch['apply'](_0x1f9808,_0x1393ac,!![]);}catch(_0x16e8b4){return BPromise[_0xbe08('0x22')](_0x16e8b4);}return _0x1f9808['save']();};}function saveUpdates(_0x5ab5f5,_0x439a78){return function(_0xbbd202){if(_0xbbd202){return _0xbbd202[_0xbe08('0x23')](_0x5ab5f5)['then'](function(_0x31a075){return _0x31a075;});}return null;};}function removeEntity(_0x25ce24,_0x42143c){return function(_0x45697b){if(_0x45697b){return _0x45697b[_0xbe08('0x24')]()[_0xbe08('0x25')](function(){_0x25ce24[_0xbe08('0x1a')](0xcc)[_0xbe08('0x1b')]();});}};}function handleEntityNotFound(_0x2d6493,_0x493d13){return function(_0x34421d){if(!_0x34421d){_0x2d6493[_0xbe08('0x19')](0x194);}return _0x34421d;};}function handleError(_0x1fcbe5,_0x1a348e){_0x1a348e=_0x1a348e||0x1f4;return function(_0x3310be){logger[_0xbe08('0x26')](_0x3310be[_0xbe08('0x27')]);if(_0x3310be[_0xbe08('0x28')]){delete _0x3310be[_0xbe08('0x28')];}_0x1fcbe5[_0xbe08('0x1a')](_0x1a348e)['send'](_0x3310be);};}exports[_0xbe08('0x23')]=function(_0x23100b,_0x27ed43){if(_0x23100b[_0xbe08('0x29')]['id']){delete _0x23100b[_0xbe08('0x29')]['id'];}return db[_0xbe08('0x2a')]['find']({'where':{'id':_0x23100b[_0xbe08('0x2b')]['id']}})[_0xbe08('0x25')](handleEntityNotFound(_0x27ed43,null))[_0xbe08('0x25')](saveUpdates(_0x23100b[_0xbe08('0x29')],null))[_0xbe08('0x25')](respondWithResult(_0x27ed43,null))['catch'](handleError(_0x27ed43,null));};exports[_0xbe08('0x24')]=function(_0x35346a,_0x43a7fc){return db['Action'][_0xbe08('0x2c')]({'where':{'id':_0x35346a[_0xbe08('0x2b')]['id']}})['then'](handleEntityNotFound(_0x43a7fc,null))[_0xbe08('0x25')](removeEntity(_0x43a7fc,null))[_0xbe08('0x2d')](handleError(_0x43a7fc,null));}; \ No newline at end of file +var _0x44fe=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','reject','save','then','stack','name','update','body','find','params','destroy','Action','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x2dd381,_0x56a055){var _0x1800c4=function(_0x46bb18){while(--_0x46bb18){_0x2dd381['push'](_0x2dd381['shift']());}};_0x1800c4(++_0x56a055);}(_0x44fe,0x16f));var _0xe44f=function(_0x3dd267,_0x2d552b){_0x3dd267=_0x3dd267-0x0;var _0x7f89b8=_0x44fe[_0x3dd267];return _0x7f89b8;};'use strict';var pdf=require(_0xe44f('0x0'));var emlformat=require(_0xe44f('0x1'));var rimraf=require(_0xe44f('0x2'));var zipdir=require(_0xe44f('0x3'));var jsonpatch=require(_0xe44f('0x4'));var rp=require(_0xe44f('0x5'));var moment=require(_0xe44f('0x6'));var BPromise=require(_0xe44f('0x7'));var Mustache=require(_0xe44f('0x8'));var util=require(_0xe44f('0x9'));var path=require(_0xe44f('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe44f('0xb'));var fs=require('fs');var _=require(_0xe44f('0xc'));var squel=require('squel');var crypto=require(_0xe44f('0xd'));var jsforce=require(_0xe44f('0xe'));var deskjs=require(_0xe44f('0xf'));var toCsv=require(_0xe44f('0x10'));var querystring=require(_0xe44f('0x11'));var Papa=require('papaparse');var Redis=require(_0xe44f('0x12'));var authService=require(_0xe44f('0x13'));var qs=require(_0xe44f('0x14'));var as=require(_0xe44f('0x15'));var hardwareService=require(_0xe44f('0x16'));var logger=require(_0xe44f('0x17'))(_0xe44f('0x18'));var utils=require(_0xe44f('0x19'));var config=require(_0xe44f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe44f('0x1b'))['db'];function respondWithStatusCode(_0x1cecdf,_0x54ac3e){_0x54ac3e=_0x54ac3e||0xcc;return function(_0x3883b0){if(_0x3883b0){return _0x1cecdf[_0xe44f('0x1c')](_0x54ac3e);}return _0x1cecdf[_0xe44f('0x1d')](_0x54ac3e)[_0xe44f('0x1e')]();};}function respondWithResult(_0x3c78e1,_0x2e2942){_0x2e2942=_0x2e2942||0xc8;return function(_0x3ec218){if(_0x3ec218){return _0x3c78e1[_0xe44f('0x1d')](_0x2e2942)['json'](_0x3ec218);}};}function respondWithFilteredResult(_0x230344,_0x1fa09f){return function(_0x9ccdfd){if(_0x9ccdfd){var _0x190fec=_0x9ccdfd[_0xe44f('0x1f')],_0x31175b=_0x1fa09f[_0xe44f('0x20')],_0x3d334f=_0x1fa09f[_0xe44f('0x20')]+_0x1fa09f[_0xe44f('0x21')],_0x3ee3f9;if(_0x3d334f>=_0x190fec){_0x3d334f=_0x190fec;_0x3ee3f9=0xc8;}else{_0x3ee3f9=0xce;}_0x230344[_0xe44f('0x1d')](_0x3ee3f9);return _0x230344['set']('Content-Range',_0x31175b+'-'+_0x3d334f+'/'+_0x190fec)[_0xe44f('0x22')](_0x9ccdfd);}return null;};}function patchUpdates(_0x309a28){return function(_0x2767ef){try{jsonpatch[_0xe44f('0x23')](_0x2767ef,_0x309a28,!![]);}catch(_0x467cda){return BPromise[_0xe44f('0x24')](_0x467cda);}return _0x2767ef[_0xe44f('0x25')]();};}function saveUpdates(_0x239ef5,_0xecbcfe){return function(_0x58b835){if(_0x58b835){return _0x58b835['update'](_0x239ef5)[_0xe44f('0x26')](function(_0x3fe450){return _0x3fe450;});}return null;};}function removeEntity(_0x298b90,_0x3f7ef8){return function(_0xf3c259){if(_0xf3c259){return _0xf3c259['destroy']()['then'](function(){_0x298b90[_0xe44f('0x1d')](0xcc)[_0xe44f('0x1e')]();});}};}function handleEntityNotFound(_0x1cc44e,_0x20c7aa){return function(_0x55b679){if(!_0x55b679){_0x1cc44e[_0xe44f('0x1c')](0x194);}return _0x55b679;};}function handleError(_0xb84f2d,_0x384c82){_0x384c82=_0x384c82||0x1f4;return function(_0x90d216){logger['error'](_0x90d216[_0xe44f('0x27')]);if(_0x90d216[_0xe44f('0x28')]){delete _0x90d216[_0xe44f('0x28')];}_0xb84f2d['status'](_0x384c82)['send'](_0x90d216);};}exports[_0xe44f('0x29')]=function(_0x42f994,_0x466e26){if(_0x42f994['body']['id']){delete _0x42f994[_0xe44f('0x2a')]['id'];}return db['Action'][_0xe44f('0x2b')]({'where':{'id':_0x42f994[_0xe44f('0x2c')]['id']}})[_0xe44f('0x26')](handleEntityNotFound(_0x466e26,null))['then'](saveUpdates(_0x42f994['body'],null))['then'](respondWithResult(_0x466e26,null))['catch'](handleError(_0x466e26,null));};exports[_0xe44f('0x2d')]=function(_0x30ef3b,_0x4aea1a){return db[_0xe44f('0x2e')][_0xe44f('0x2b')]({'where':{'id':_0x30ef3b[_0xe44f('0x2c')]['id']}})[_0xe44f('0x26')](handleEntityNotFound(_0x4aea1a,null))[_0xe44f('0x26')](removeEntity(_0x4aea1a,null))[_0xe44f('0x2f')](handleError(_0x4aea1a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 0b85bc6..880bbdd 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 _0x385f=['tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','Action'];(function(_0x3df29d,_0x40d9aa){var _0x43c34f=function(_0x2a717b){while(--_0x2a717b){_0x3df29d['push'](_0x3df29d['shift']());}};_0x43c34f(++_0x40d9aa);}(_0x385f,0xd9));var _0xf385=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0x385f[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0xf385('0x0'));var util=require(_0xf385('0x1'));var logger=require(_0xf385('0x2'))(_0xf385('0x3'));var moment=require(_0xf385('0x4'));var BPromise=require('bluebird');var rp=require(_0xf385('0x5'));var fs=require('fs');var path=require(_0xf385('0x6'));var rimraf=require(_0xf385('0x7'));var config=require(_0xf385('0x8'));var attributes=require(_0xf385('0x9'));module['exports']=function(_0x30ad8d,_0x5c9310){return _0x30ad8d['define'](_0xf385('0xa'),attributes,{'tableName':_0xf385('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aff=['util','../../config/logger','bluebird','request-promise','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash'];(function(_0x552f7d,_0x12b922){var _0x3bd40d=function(_0x248150){while(--_0x248150){_0x552f7d['push'](_0x552f7d['shift']());}};_0x3bd40d(++_0x12b922);}(_0x2aff,0x1d8));var _0xf2af=function(_0x4886bc,_0x478169){_0x4886bc=_0x4886bc-0x0;var _0x56486d=_0x2aff[_0x4886bc];return _0x56486d;};'use strict';var _=require(_0xf2af('0x0'));var util=require(_0xf2af('0x1'));var logger=require(_0xf2af('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2af('0x3'));var rp=require(_0xf2af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2af('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2af('0x6'));module[_0xf2af('0x7')]=function(_0xddceed,_0x52d02c){return _0xddceed[_0xf2af('0x8')](_0xf2af('0x9'),attributes,{'tableName':_0xf2af('0xa'),'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 ac41f92..c020096 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(_0x13d0d1,_0xb14f27){var _0x68fb33=function(_0x318497){while(--_0x318497){_0x13d0d1['push'](_0x13d0d1['shift']());}};_0x68fb33(++_0xb14f27);}(_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(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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 639371a..0823eca 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 _0x2341=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','delete','destroy'];(function(_0x412ff5,_0x47a49f){var _0x280aeb=function(_0x1c07f7){while(--_0x1c07f7){_0x412ff5['push'](_0x412ff5['shift']());}};_0x280aeb(++_0x47a49f);}(_0x2341,0x9b));var _0x1234=function(_0x318773,_0x5ac872){_0x318773=_0x318773-0x0;var _0x1131b9=_0x2341[_0x318773];return _0x1131b9;};'use strict';var multer=require(_0x1234('0x0'));var util=require(_0x1234('0x1'));var path=require(_0x1234('0x2'));var timeout=require(_0x1234('0x3'));var express=require(_0x1234('0x4'));var router=express['Router']();var auth=require(_0x1234('0x5'));var interaction=require(_0x1234('0x6'));var config=require(_0x1234('0x7'));var controller=require(_0x1234('0x8'));router['put'](_0x1234('0x9'),auth[_0x1234('0xa')](),controller['update']);router[_0x1234('0xb')](_0x1234('0x9'),auth[_0x1234('0xa')](),controller[_0x1234('0xc')]);module[_0x1234('0xd')]=router; \ No newline at end of file +var _0x0604=['put','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./action.controller'];(function(_0x5e5b55,_0x4b5987){var _0x217659=function(_0x52cf91){while(--_0x52cf91){_0x5e5b55['push'](_0x5e5b55['shift']());}};_0x217659(++_0x4b5987);}(_0x0604,0xd1));var _0x4060=function(_0x1c4e3e,_0x478d6f){_0x1c4e3e=_0x1c4e3e-0x0;var _0x1ccd97=_0x0604[_0x1c4e3e];return _0x1ccd97;};'use strict';var multer=require(_0x4060('0x0'));var util=require(_0x4060('0x1'));var path=require(_0x4060('0x2'));var timeout=require(_0x4060('0x3'));var express=require(_0x4060('0x4'));var router=express['Router']();var auth=require(_0x4060('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4060('0x6'));router[_0x4060('0x7')]('/:id',auth[_0x4060('0x8')](),controller['update']);router[_0x4060('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4060('0xa')]);module[_0x4060('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0f67ae1..39663b4 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 _0xb5a6=['exports','STRING','TEXT'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xb5a6,0x108));var _0x6b5a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb5a6[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module[_0x6b5a('0x0')]={'name':{'type':Sequelize[_0x6b5a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6b5a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6b5a('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x6b5a('0x2')]}}; \ No newline at end of file +var _0x789f=['sequelize','exports','STRING','TEXT'];(function(_0x27c7b7,_0x3ac29c){var _0x22e7d5=function(_0x1a5494){while(--_0x1a5494){_0x27c7b7['push'](_0x27c7b7['shift']());}};_0x22e7d5(++_0x3ac29c);}(_0x789f,0xf4));var _0xf789=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x789f[_0xbf8ebe];return _0x1e25e8;};'use strict';var Sequelize=require(_0xf789('0x0'));module[_0xf789('0x1')]={'name':{'type':Sequelize[_0xf789('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf789('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xf789('0x3')]},'joins':{'type':Sequelize[_0xf789('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index aeb540f..22f854a 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 _0xb749=['child_process','fork','../../components/export/','../../files/reports','savename','run','runReport','IS\x20NOT\x20EMPTY','Limited\x20Query:','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','update','destroy','get','CustomReports','UserProfileResource','then','stack','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','name','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Reports','UserProfileSection','autoAssociation','error','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','alias','parse','joins','includes','parentKey','foreignTable','foreignKey','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','HOUR(%s)','ROUND(%s)','getFields','ValidationErrorItem','groupBy','DESC','%s.%s\x20=\x20%s.%s','fullPath','%s-%s.%s','generate','output','csv','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0xb749,0xac));var _0x9b74=function(_0x40c760,_0x156f78){_0x40c760=_0x40c760-0x0;var _0x3fa39a=_0xb749[_0x40c760];return _0x3fa39a;};'use strict';var pdf=require(_0x9b74('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9b74('0x1'));var zipdir=require(_0x9b74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b74('0x3'));var moment=require('moment');var BPromise=require(_0x9b74('0x4'));var Mustache=require(_0x9b74('0x5'));var util=require(_0x9b74('0x6'));var path=require(_0x9b74('0x7'));var sox=require(_0x9b74('0x8'));var csv=require(_0x9b74('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9b74('0xa'));var squel=require('squel');var crypto=require(_0x9b74('0xb'));var jsforce=require(_0x9b74('0xc'));var deskjs=require(_0x9b74('0xd'));var toCsv=require(_0x9b74('0x9'));var querystring=require(_0x9b74('0xe'));var Papa=require('papaparse');var Redis=require(_0x9b74('0xf'));var authService=require(_0x9b74('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9b74('0x11'));var hardwareService=require(_0x9b74('0x12'));var logger=require(_0x9b74('0x13'))('api');var utils=require(_0x9b74('0x14'));var config=require(_0x9b74('0x15'));var licenseUtil=require(_0x9b74('0x16'));var db=require(_0x9b74('0x17'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xc104c0,_0x203fda){_0x203fda=_0x203fda||0xcc;return function(_0x1027da){if(_0x1027da){return _0xc104c0[_0x9b74('0x18')](_0x203fda);}return _0xc104c0['status'](_0x203fda)[_0x9b74('0x19')]();};}function respondWithResult(_0x440027,_0x260532){_0x260532=_0x260532||0xc8;return function(_0x31c30d){if(_0x31c30d){return _0x440027[_0x9b74('0x1a')](_0x260532)[_0x9b74('0x1b')](_0x31c30d);}};}function respondWithFilteredResult(_0x5270d8,_0x4d5105){return function(_0x6d921a){if(_0x6d921a){var _0x29a86d=_0x6d921a['count'],_0x307a85=_0x4d5105[_0x9b74('0x1c')],_0x193be3=_0x4d5105[_0x9b74('0x1c')]+_0x4d5105['limit'],_0x4cb6d7;if(_0x193be3>=_0x29a86d){_0x193be3=_0x29a86d;_0x4cb6d7=0xc8;}else{_0x4cb6d7=0xce;}_0x5270d8[_0x9b74('0x1a')](_0x4cb6d7);return _0x5270d8[_0x9b74('0x1d')](_0x9b74('0x1e'),_0x307a85+'-'+_0x193be3+'/'+_0x29a86d)['json'](_0x6d921a);}return null;};}function patchUpdates(_0x18901d){return function(_0x2a3498){try{jsonpatch[_0x9b74('0x1f')](_0x2a3498,_0x18901d,!![]);}catch(_0x2f2464){return BPromise['reject'](_0x2f2464);}return _0x2a3498['save']();};}function saveUpdates(_0x49afcd,_0x1a743f){return function(_0x523ba6){if(_0x523ba6){return _0x523ba6[_0x9b74('0x20')](_0x49afcd)['then'](function(_0x3c0777){return _0x3c0777;});}return null;};}function removeEntity(_0x1ff224,_0x3897a2){return function(_0xddac13){if(_0xddac13){return _0xddac13[_0x9b74('0x21')]()['then'](function(){var _0xbc2be4=_0xddac13[_0x9b74('0x22')]({'plain':!![]});var _0x548655=_0x9b74('0x23');return db[_0x9b74('0x24')]['destroy']({'where':{'type':_0x548655,'resourceId':_0xbc2be4['id']}})['then'](function(){return _0xddac13;});})[_0x9b74('0x25')](function(){_0x1ff224[_0x9b74('0x1a')](0xcc)[_0x9b74('0x19')]();});}};}function handleEntityNotFound(_0x464ceb,_0x13f392){return function(_0x4f9cd7){if(!_0x4f9cd7){_0x464ceb[_0x9b74('0x18')](0x194);}return _0x4f9cd7;};}function handleError(_0x35d202,_0x49da20){_0x49da20=_0x49da20||0x1f4;return function(_0x2fca21){logger['error'](_0x2fca21[_0x9b74('0x26')]);if(_0x2fca21['name']){delete _0x2fca21['name'];}_0x35d202[_0x9b74('0x1a')](_0x49da20)[_0x9b74('0x27')](_0x2fca21);};}exports[_0x9b74('0x28')]=function(_0x5a0319,_0x5c5b0e){var _0x19ccf0={},_0xe5e961={},_0x25960a={'count':0x0,'rows':[]};var _0x49a9ed=_[_0x9b74('0x29')](db[_0x9b74('0x2a')][_0x9b74('0x2b')],function(_0x97e30a){return{'name':_0x97e30a[_0x9b74('0x2c')],'type':_0x97e30a[_0x9b74('0x2d')][_0x9b74('0x2e')]};});_0xe5e961[_0x9b74('0x2f')]=_[_0x9b74('0x29')](_0x49a9ed,_0x9b74('0x30'));_0xe5e961['query']=_['keys'](_0x5a0319['query']);_0xe5e961['filters']=_[_0x9b74('0x31')](_0xe5e961[_0x9b74('0x2f')],_0xe5e961[_0x9b74('0x32')]);_0x19ccf0['attributes']=_[_0x9b74('0x31')](_0xe5e961[_0x9b74('0x2f')],qs['fields'](_0x5a0319['query'][_0x9b74('0x33')]));_0x19ccf0[_0x9b74('0x34')]=_0x19ccf0[_0x9b74('0x34')][_0x9b74('0x35')]?_0x19ccf0[_0x9b74('0x34')]:_0xe5e961['model'];if(!_0x5a0319[_0x9b74('0x32')][_0x9b74('0x36')](_0x9b74('0x37'))){_0x19ccf0[_0x9b74('0x38')]=qs['limit'](_0x5a0319[_0x9b74('0x32')][_0x9b74('0x38')]);_0x19ccf0[_0x9b74('0x1c')]=qs[_0x9b74('0x1c')](_0x5a0319[_0x9b74('0x32')][_0x9b74('0x1c')]);}_0x19ccf0[_0x9b74('0x39')]=qs[_0x9b74('0x3a')](_0x5a0319[_0x9b74('0x32')][_0x9b74('0x3a')]);_0x19ccf0[_0x9b74('0x3b')]=qs[_0x9b74('0x3c')](_[_0x9b74('0x3d')](_0x5a0319[_0x9b74('0x32')],_0xe5e961[_0x9b74('0x3c')]),_0x49a9ed);if(_0x5a0319[_0x9b74('0x32')][_0x9b74('0x3e')]){_0x19ccf0[_0x9b74('0x3b')]=_[_0x9b74('0x3f')](_0x19ccf0['where'],{'$or':_[_0x9b74('0x29')](_0x49a9ed,function(_0x4b11c4){if(_0x4b11c4[_0x9b74('0x2d')]!==_0x9b74('0x40')){var _0x88c44a={};_0x88c44a[_0x4b11c4[_0x9b74('0x30')]]={'$like':'%'+_0x5a0319[_0x9b74('0x32')][_0x9b74('0x3e')]+'%'};return _0x88c44a;}})});}_0x19ccf0=_[_0x9b74('0x3f')]({},_0x19ccf0,_0x5a0319[_0x9b74('0x41')]);var _0x4d97ac={'where':_0x19ccf0[_0x9b74('0x3b')]};return db['AnalyticCustomReport']['count'](_0x4d97ac)[_0x9b74('0x25')](function(_0x35ad26){_0x25960a[_0x9b74('0x42')]=_0x35ad26;if(_0x5a0319[_0x9b74('0x32')][_0x9b74('0x43')]){_0x19ccf0[_0x9b74('0x44')]=[{'all':!![]}];}return db[_0x9b74('0x2a')][_0x9b74('0x45')](_0x19ccf0);})[_0x9b74('0x25')](function(_0x3f0322){_0x25960a[_0x9b74('0x46')]=_0x3f0322;return _0x25960a;})['then'](respondWithFilteredResult(_0x5c5b0e,_0x19ccf0))['catch'](handleError(_0x5c5b0e,null));};exports[_0x9b74('0x47')]=function(_0x4aec47,_0xc4694){var _0x57a3e0={'raw':![],'where':{'id':_0x4aec47[_0x9b74('0x48')]['id']}},_0x24a5d7={};_0x24a5d7[_0x9b74('0x2f')]=_[_0x9b74('0x49')](db[_0x9b74('0x2a')][_0x9b74('0x2b')]);_0x24a5d7[_0x9b74('0x32')]=_[_0x9b74('0x49')](_0x4aec47[_0x9b74('0x32')]);_0x24a5d7[_0x9b74('0x3c')]=_[_0x9b74('0x31')](_0x24a5d7[_0x9b74('0x2f')],_0x24a5d7[_0x9b74('0x32')]);_0x57a3e0['attributes']=_[_0x9b74('0x31')](_0x24a5d7[_0x9b74('0x2f')],qs[_0x9b74('0x33')](_0x4aec47[_0x9b74('0x32')][_0x9b74('0x33')]));_0x57a3e0['attributes']=_0x57a3e0[_0x9b74('0x34')][_0x9b74('0x35')]?_0x57a3e0['attributes']:_0x24a5d7[_0x9b74('0x2f')];if(_0x4aec47[_0x9b74('0x32')]['includeAll']){_0x57a3e0[_0x9b74('0x44')]=[{'all':!![]}];}_0x57a3e0=_['merge']({},_0x57a3e0,_0x4aec47[_0x9b74('0x41')]);return db[_0x9b74('0x2a')][_0x9b74('0x4a')](_0x57a3e0)[_0x9b74('0x25')](handleEntityNotFound(_0xc4694,null))['then'](respondWithResult(_0xc4694,null))[_0x9b74('0x4b')](handleError(_0xc4694,null));};exports[_0x9b74('0x4c')]=function(_0x686ca5,_0xb806ec){return db[_0x9b74('0x2a')][_0x9b74('0x4c')](_0x686ca5[_0x9b74('0x4d')],{})[_0x9b74('0x25')](function(_0x3c4c28){var _0x3727d8=_0x686ca5[_0x9b74('0x4e')]['get']({'plain':!![]});if(!_0x3727d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3727d8['role']===_0x9b74('0x4e')){var _0x597382=_0x3c4c28[_0x9b74('0x22')]({'plain':!![]});var _0x39c017=_0x9b74('0x4f');return db[_0x9b74('0x50')][_0x9b74('0x4a')]({'where':{'name':_0x39c017,'userProfileId':_0x3727d8['userProfileId']},'raw':!![]})['then'](function(_0x1e9c9a){if(_0x1e9c9a&&_0x1e9c9a[_0x9b74('0x51')]===0x0){return db[_0x9b74('0x24')][_0x9b74('0x4c')]({'name':_0x597382['name'],'resourceId':_0x597382['id'],'type':_0x9b74('0x23'),'sectionId':_0x1e9c9a['id']},{})[_0x9b74('0x25')](function(){return _0x3c4c28;});}else{return _0x3c4c28;}})['catch'](function(_0x7bf8be){logger[_0x9b74('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7bf8be);throw _0x7bf8be;});}return _0x3c4c28;})[_0x9b74('0x25')](respondWithResult(_0xb806ec,0xc9))[_0x9b74('0x4b')](handleError(_0xb806ec,null));};exports['update']=function(_0x2483ec,_0x1c543c){if(_0x2483ec[_0x9b74('0x4d')]['id']){delete _0x2483ec[_0x9b74('0x4d')]['id'];}return db['AnalyticCustomReport'][_0x9b74('0x4a')]({'where':{'id':_0x2483ec[_0x9b74('0x48')]['id']}})[_0x9b74('0x25')](handleEntityNotFound(_0x1c543c,null))['then'](saveUpdates(_0x2483ec[_0x9b74('0x4d')],null))[_0x9b74('0x25')](respondWithResult(_0x1c543c,null))[_0x9b74('0x4b')](handleError(_0x1c543c,null));};exports['destroy']=function(_0x1a0754,_0xec0887){return db[_0x9b74('0x2a')][_0x9b74('0x4a')]({'where':{'id':_0x1a0754[_0x9b74('0x48')]['id']}})[_0x9b74('0x25')](handleEntityNotFound(_0xec0887,null))[_0x9b74('0x25')](removeEntity(_0xec0887,null))[_0x9b74('0x4b')](handleError(_0xec0887,null));};exports[_0x9b74('0x53')]=function(_0x4392f6,_0x3da0b6){var _0xd4d6=0xa;var _0x5b8ec1=[_0x9b74('0x54'),_0x9b74('0x55'),_0x9b74('0x56'),_0x9b74('0x57')];var _0x1f1938={'SUM':_0x9b74('0x58'),'COUNT':_0x9b74('0x59'),'COUNT DISTINCT':_0x9b74('0x5a'),'MAX':_0x9b74('0x5b'),'MIN':_0x9b74('0x5c'),'AVG':_0x9b74('0x5d'),'GROUP_CONCAT':_0x9b74('0x5e'),'GROUP_CONCAT ASC':_0x9b74('0x5f'),'GROUP_CONCAT DESC':_0x9b74('0x60')};var _0x1d64df={'SEC_TO_TIME':_0x9b74('0x61'),'DATE':_0x9b74('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9b74('0x63')};var _0x5a1ee1=function(_0x473dc3){return!_['includes']([_0x9b74('0x64'),_0x9b74('0x65'),_0x9b74('0x66'),'IS\x20NOT\x20EMPTY'],_0x473dc3);};var _0x4fe8bc=function(_0x43cfbd){if(!_0x43cfbd||!_0x43cfbd[_0x9b74('0x67')][_0x9b74('0x35')]){return'';}for(var _0x531d66='(',_0x1b4297=0x0;_0x1b4297<_0x43cfbd[_0x9b74('0x67')]['length'];_0x1b4297+=0x1){_0x1b4297>0x0&&(_0x531d66+='\x20'+_0x43cfbd[_0x9b74('0x68')]+'\x20');_0x531d66+=_0x43cfbd['rules'][_0x1b4297][_0x9b74('0x69')]?_0x4fe8bc(_0x43cfbd['rules'][_0x1b4297][_0x9b74('0x69')]):_0x43cfbd[_0x9b74('0x67')][_0x1b4297][_0x9b74('0x6a')]+'\x20'+_0x43cfbd[_0x9b74('0x67')][_0x1b4297][_0x9b74('0x6b')]+(_0x5a1ee1(_0x43cfbd[_0x9b74('0x67')][_0x1b4297]['condition'])?'\x20'+_0x43cfbd['rules'][_0x1b4297][_0x9b74('0x6c')]:'');}return _0x531d66+')';};var _0x47cd93={'where':{'id':_0x4392f6['params']['id']}},_0x538217,_0x6ef798,_0x535496,_0x585aba,_0x35aabe;_0x47cd93=_[_0x9b74('0x3f')]({},_0x47cd93,_0x4392f6['options']);return db['AnalyticCustomReport'][_0x9b74('0x4a')](_0x47cd93)[_0x9b74('0x25')](function(_0x331648){if(_0x331648){_0x538217=_0x331648;return _0x331648['getFields']();}return null;})[_0x9b74('0x25')](function(_0x444a78){if(_0x444a78){if(!_0x444a78['length']){throw new db[(_0x9b74('0x6d'))]['ValidationErrorItem'](_0x9b74('0x6e'),0x193);}_0x6ef798=_0x444a78;return db[_0x9b74('0x6f')][_0x9b74('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3a8d39){if(_0x3a8d39){_0x535496=_[_0x9b74('0x70')](_0x3a8d39,'id');var _0x365584;var _0x5ad84e=squel[_0x9b74('0x71')]();_0x5ad84e[_0x9b74('0x72')](_0x538217[_0x9b74('0x73')]);for(var _0x5e4781=0x0;_0x5e4781<_0x6ef798[_0x9b74('0x35')];_0x5e4781+=0x1){_0x365584=_0x6ef798[_0x5e4781][_0x9b74('0x74')]?_0x535496[_0x6ef798[_0x5e4781][_0x9b74('0x74')]][_0x9b74('0x75')]:_0x6ef798[_0x5e4781][_0x9b74('0x6a')];_0x365584=_0x6ef798[_0x5e4781][_0x9b74('0x76')]?_[_0x9b74('0x77')](_0x1f1938[_0x6ef798[_0x5e4781]['function']],'%s',_0x365584):_0x365584;_0x365584=_0x6ef798[_0x5e4781][_0x9b74('0x78')]?_['replace'](_0x1d64df[_0x6ef798[_0x5e4781]['format']],'%s',_0x365584):_0x365584;if(_0x6ef798[_0x5e4781]['groupBy']){_0x5ad84e[_0x9b74('0x69')](_0x365584);}_0x6ef798[_0x5e4781][_0x9b74('0x79')]&&_0x5ad84e[_0x9b74('0x39')](_0x365584,_0x6ef798[_0x5e4781][_0x9b74('0x79')]==='DESC'?![]:!![]);_0x5ad84e[_0x9b74('0x6a')](_0x365584,_0x6ef798[_0x5e4781][_0x9b74('0x7a')]||_0x365584);}if(_0x538217['joins']){_0x538217['joins']=JSON[_0x9b74('0x7b')](_0x538217[_0x9b74('0x7c')]);for(var _0x388726=0x0;_0x388726<_0x538217[_0x9b74('0x7c')][_0x9b74('0x35')];_0x388726+=0x1){if(_0x538217[_0x9b74('0x7c')][_0x388726][_0x9b74('0x2d')]&&_[_0x9b74('0x7d')](_0x5b8ec1,_0x538217['joins'][_0x388726][_0x9b74('0x2d')])&&_0x538217[_0x9b74('0x7c')][_0x388726][_0x9b74('0x7e')]&&_0x538217[_0x9b74('0x7c')][_0x388726][_0x9b74('0x7f')]&&_0x538217[_0x9b74('0x7c')][_0x388726][_0x9b74('0x80')]){_0x5ad84e[_0x538217[_0x9b74('0x7c')][_0x388726]['type']](_0x538217[_0x9b74('0x7c')][_0x388726]['foreignTable'],null,util[_0x9b74('0x78')]('%s.%s\x20=\x20%s.%s',_0x538217[_0x9b74('0x73')],_0x538217[_0x9b74('0x7c')][_0x388726]['parentKey'],_0x538217[_0x9b74('0x7c')][_0x388726][_0x9b74('0x7f')],_0x538217[_0x9b74('0x7c')][_0x388726][_0x9b74('0x80')]));}}}if(_0x538217[_0x9b74('0x81')]){_0x538217[_0x9b74('0x81')]=JSON[_0x9b74('0x7b')](_0x538217['conditions']);_0x5ad84e['where'](_0x4fe8bc(_0x538217['conditions'][_0x9b74('0x69')]));}_0x35aabe=_0x5ad84e[_0x9b74('0x82')]();_0x5ad84e[_0x9b74('0x38')](_0xd4d6);_0x5ad84e[_0x9b74('0x1c')](0x0);logger[_0x9b74('0x83')]('Limited\x20Query:',_0x5ad84e['toString']());return dbH[_0x9b74('0x84')][_0x9b74('0x32')](_0x5ad84e[_0x9b74('0x85')](),{'type':dbH[_0x9b74('0x84')][_0x9b74('0x86')][_0x9b74('0x87')]});}})[_0x9b74('0x25')](respondWithResult(_0x3da0b6,null))['catch'](handleError(_0x3da0b6,null));};function runReport(_0x6550b1,_0x4917e3,_0x3e581f){var _0x19fe47=_0x4917e3[_0x9b74('0x30')];var _0x3f118f=0xa;var _0x372510=[_0x9b74('0x54'),_0x9b74('0x55'),_0x9b74('0x56'),_0x9b74('0x57')];var _0x4cbba4={'SUM':_0x9b74('0x58'),'COUNT':_0x9b74('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9b74('0x5b'),'MIN':_0x9b74('0x5c'),'AVG':_0x9b74('0x5d'),'GROUP_CONCAT':_0x9b74('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9b74('0x60')};var _0x2f98fe={'SEC_TO_TIME':_0x9b74('0x61'),'DATE':_0x9b74('0x62'),'HOUR':_0x9b74('0x88'),'ROUND':_0x9b74('0x89'),'UNIX_TIMESTAMP':_0x9b74('0x63')};var _0x48a8bc=function(_0x451063){return!_[_0x9b74('0x7d')]([_0x9b74('0x64'),_0x9b74('0x65'),_0x9b74('0x66'),'IS\x20NOT\x20EMPTY'],_0x451063);};var _0x187321=function(_0x2ef4da){if(!_0x2ef4da||!_0x2ef4da[_0x9b74('0x67')][_0x9b74('0x35')]){return'';}for(var _0x402dd4='(',_0x5c24dc=0x0;_0x5c24dc<_0x2ef4da[_0x9b74('0x67')][_0x9b74('0x35')];_0x5c24dc+=0x1){_0x5c24dc>0x0&&(_0x402dd4+='\x20'+_0x2ef4da[_0x9b74('0x68')]+'\x20');_0x402dd4+=_0x2ef4da[_0x9b74('0x67')][_0x5c24dc][_0x9b74('0x69')]?_0x187321(_0x2ef4da['rules'][_0x5c24dc]['group']):_0x2ef4da[_0x9b74('0x67')][_0x5c24dc]['field']+'\x20'+_0x2ef4da[_0x9b74('0x67')][_0x5c24dc][_0x9b74('0x6b')]+(_0x48a8bc(_0x2ef4da[_0x9b74('0x67')][_0x5c24dc][_0x9b74('0x6b')])?'\x20'+_0x2ef4da[_0x9b74('0x67')][_0x5c24dc][_0x9b74('0x6c')]:'');}return _0x402dd4+')';};var _0x73f66f={'where':{'id':_0x6550b1['id']}},_0x7b3c75,_0x5330e0,_0x3c1c3e,_0x51743b,_0x4b8d05;_0x73f66f=_['merge']({},_0x73f66f,_0x3e581f);return db['AnalyticCustomReport'][_0x9b74('0x4a')](_0x73f66f)['then'](function(_0x341c5b){if(_0x341c5b){_0x7b3c75=_0x341c5b;return _0x341c5b[_0x9b74('0x8a')]();}return null;})[_0x9b74('0x25')](function(_0x25f6ad){if(_0x25f6ad){if(!_0x25f6ad[_0x9b74('0x35')]){throw new db[(_0x9b74('0x6d'))][(_0x9b74('0x8b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5330e0=_0x25f6ad;return db[_0x9b74('0x6f')][_0x9b74('0x45')]({'raw':!![]});}return null;})[_0x9b74('0x25')](function(_0x10e9eb){if(_0x10e9eb){_0x3c1c3e=_['keyBy'](_0x10e9eb,'id');var _0x91861b;var _0x48a6ca=squel[_0x9b74('0x71')]();_0x48a6ca['from'](_0x7b3c75['table']);for(var _0x33cdd3=0x0;_0x33cdd3<_0x5330e0[_0x9b74('0x35')];_0x33cdd3+=0x1){_0x91861b=_0x5330e0[_0x33cdd3][_0x9b74('0x74')]?_0x3c1c3e[_0x5330e0[_0x33cdd3][_0x9b74('0x74')]][_0x9b74('0x75')]:_0x5330e0[_0x33cdd3]['field'];_0x91861b=_0x5330e0[_0x33cdd3]['function']?_[_0x9b74('0x77')](_0x4cbba4[_0x5330e0[_0x33cdd3][_0x9b74('0x76')]],'%s',_0x91861b):_0x91861b;_0x91861b=_0x5330e0[_0x33cdd3]['format']?_['replace'](_0x2f98fe[_0x5330e0[_0x33cdd3][_0x9b74('0x78')]],'%s',_0x91861b):_0x91861b;if(_0x5330e0[_0x33cdd3][_0x9b74('0x8c')]){_0x48a6ca[_0x9b74('0x69')](_0x91861b);}_0x5330e0[_0x33cdd3][_0x9b74('0x79')]&&_0x48a6ca['order'](_0x91861b,_0x5330e0[_0x33cdd3]['orderBy']===_0x9b74('0x8d')?![]:!![]);_0x48a6ca['field'](_0x91861b,_0x5330e0[_0x33cdd3]['alias']||_0x91861b);}if(_0x7b3c75['joins']){_0x7b3c75['joins']=JSON[_0x9b74('0x7b')](_0x7b3c75[_0x9b74('0x7c')]);for(var _0x257c4a=0x0;_0x257c4a<_0x7b3c75['joins'][_0x9b74('0x35')];_0x257c4a+=0x1){if(_0x7b3c75[_0x9b74('0x7c')][_0x257c4a][_0x9b74('0x2d')]&&_['includes'](_0x372510,_0x7b3c75['joins'][_0x257c4a]['type'])&&_0x7b3c75[_0x9b74('0x7c')][_0x257c4a][_0x9b74('0x7e')]&&_0x7b3c75['joins'][_0x257c4a][_0x9b74('0x7f')]&&_0x7b3c75[_0x9b74('0x7c')][_0x257c4a][_0x9b74('0x80')]){_0x48a6ca[_0x7b3c75[_0x9b74('0x7c')][_0x257c4a]['type']](_0x7b3c75[_0x9b74('0x7c')][_0x257c4a][_0x9b74('0x7f')],null,util[_0x9b74('0x78')](_0x9b74('0x8e'),_0x7b3c75[_0x9b74('0x73')],_0x7b3c75['joins'][_0x257c4a]['parentKey'],_0x7b3c75[_0x9b74('0x7c')][_0x257c4a][_0x9b74('0x7f')],_0x7b3c75['joins'][_0x257c4a][_0x9b74('0x80')]));}}}if(_0x7b3c75[_0x9b74('0x81')]){_0x7b3c75[_0x9b74('0x81')]=JSON[_0x9b74('0x7b')](_0x7b3c75['conditions']);_0x48a6ca[_0x9b74('0x3b')](_0x187321(_0x7b3c75['conditions']['group']));}_0x4b8d05=_0x48a6ca[_0x9b74('0x82')]();_0x48a6ca[_0x9b74('0x38')](_0x3f118f);_0x48a6ca['offset'](0x0);return;}})[_0x9b74('0x25')](function(){if(_0x4917e3['output']==='web'){return null;}var _0x3cf838=_['merge'](_0x4917e3,{'name':_0x4917e3[_0x9b74('0x8f')]||_0x4917e3[_0x9b74('0x30')]||_0x7b3c75[_0x9b74('0x30')],'basename':_0x19fe47,'savename':util[_0x9b74('0x78')](_0x9b74('0x90'),_0x4917e3['name']||_0x7b3c75[_0x9b74('0x30')],require('randomstring')[_0x9b74('0x91')](0x4),_0x4917e3[_0x9b74('0x92')]||_0x9b74('0x93')),'reportId':_0x7b3c75['id'],'reportType':_0x9b74('0x94')});return db[_0x9b74('0x95')][_0x9b74('0x4c')](_0x3cf838,{'raw':!![]});})[_0x9b74('0x25')](function(_0x150b60){if(_0x7b3c75[_0x9b74('0x73')]===_0x9b74('0x96')){_0x4b8d05[_0x9b74('0x3b')](_0x7b3c75[_0x9b74('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4917e3['startDate'],_0x4917e3[_0x9b74('0x97')]);}else{_0x4b8d05[_0x9b74('0x3b')](_0x7b3c75[_0x9b74('0x73')]+_0x9b74('0x98'),_0x4917e3['startDate'],_0x4917e3[_0x9b74('0x97')]);}if(_0x150b60){logger['info'](_0x9b74('0x99'),_0x4b8d05[_0x9b74('0x85')]());require(_0x9b74('0x9a'))[_0x9b74('0x9b')](path[_0x9b74('0x54')](__dirname,_0x9b74('0x9c'),_0x150b60[_0x9b74('0x92')]),[_0x150b60['id'],_0x4b8d05[_0x9b74('0x85')](),path[_0x9b74('0x54')](__dirname,_0x9b74('0x9d'),_0x150b60[_0x9b74('0x9e')]),_0x19fe47]);return _0x150b60;}else{var _0x4a8262=squel[_0x9b74('0x71')]();_0x4a8262[_0x9b74('0x72')]('('+_0x4b8d05[_0x9b74('0x85')]()+')','countTable');_0x4a8262['field']('COUNT(*)',_0x9b74('0x42'));_0x4b8d05[_0x9b74('0x38')](_0x4917e3[_0x9b74('0x38')]||_0x3f118f);_0x4b8d05[_0x9b74('0x1c')](_0x4917e3[_0x9b74('0x1c')]||0x0);return dbH[_0x9b74('0x84')][_0x9b74('0x32')](_0x4a8262[_0x9b74('0x85')](),{'type':dbH[_0x9b74('0x84')][_0x9b74('0x86')][_0x9b74('0x87')]})['then'](function(_0x33c4d9){if(!_0x33c4d9[_0x9b74('0x35')]){_0x51743b=0x0;}else{_0x51743b=_0x33c4d9[0x0][_0x9b74('0x42')]||0x0;}return dbH['sequelize'][_0x9b74('0x32')](_0x4b8d05[_0x9b74('0x85')](),{'type':dbH[_0x9b74('0x84')][_0x9b74('0x86')][_0x9b74('0x87')]});})[_0x9b74('0x25')](function(_0x42fbc7){return{'rows':_0x42fbc7||[],'count':_0x51743b};});}});}exports[_0x9b74('0x9f')]=function(_0x39e39d,_0xd2860f){return runReport(_0x39e39d[_0x9b74('0x48')],_0x39e39d[_0x9b74('0x32')],_0x39e39d[_0x9b74('0x41')])[_0x9b74('0x25')](respondWithResult(_0xd2860f,null))[_0x9b74('0x4b')](handleError(_0xd2860f,null));};exports[_0x9b74('0xa0')]=runReport;exports[_0x9b74('0x32')]=function(_0x110e9e,_0x335230){var _0x64dca=0xa;var _0x5d71f8=[_0x9b74('0x54'),_0x9b74('0x55'),_0x9b74('0x56'),_0x9b74('0x57')];var _0x6247fa={'SUM':_0x9b74('0x58'),'COUNT':_0x9b74('0x59'),'COUNT DISTINCT':_0x9b74('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x9b74('0x5d'),'GROUP_CONCAT':_0x9b74('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9b74('0x60')};var _0x51fe77={'SEC_TO_TIME':_0x9b74('0x61'),'DATE':_0x9b74('0x62'),'HOUR':_0x9b74('0x88'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9b74('0x63')};var _0xb5a7c=function(_0x2e9fed){return!_[_0x9b74('0x7d')]([_0x9b74('0x64'),_0x9b74('0x65'),_0x9b74('0x66'),_0x9b74('0xa1')],_0x2e9fed);};var _0x134418=function(_0x540ff3){if(!_0x540ff3||!_0x540ff3[_0x9b74('0x67')][_0x9b74('0x35')]){return'';}for(var _0x13ea9a='(',_0x17bf80=0x0;_0x17bf80<_0x540ff3[_0x9b74('0x67')]['length'];_0x17bf80+=0x1){_0x17bf80>0x0&&(_0x13ea9a+='\x20'+_0x540ff3[_0x9b74('0x68')]+'\x20');_0x13ea9a+=_0x540ff3[_0x9b74('0x67')][_0x17bf80][_0x9b74('0x69')]?_0x134418(_0x540ff3[_0x9b74('0x67')][_0x17bf80][_0x9b74('0x69')]):_0x540ff3[_0x9b74('0x67')][_0x17bf80][_0x9b74('0x6a')]+'\x20'+_0x540ff3[_0x9b74('0x67')][_0x17bf80][_0x9b74('0x6b')]+(_0xb5a7c(_0x540ff3[_0x9b74('0x67')][_0x17bf80][_0x9b74('0x6b')])?'\x20'+_0x540ff3[_0x9b74('0x67')][_0x17bf80][_0x9b74('0x6c')]:'');}return _0x13ea9a+')';};var _0xbca6b8={'where':{'id':_0x110e9e['params']['id']}},_0x35c693,_0x248c28,_0x4b559b,_0x55789a,_0x26be27;_0xbca6b8=_['merge']({},_0xbca6b8,_0x110e9e[_0x9b74('0x41')]);return db[_0x9b74('0x2a')][_0x9b74('0x4a')](_0xbca6b8)['then'](function(_0x5f502d){if(_0x5f502d){_0x35c693=_0x5f502d;return _0x5f502d[_0x9b74('0x8a')]();}return null;})['then'](function(_0x217067){if(_0x217067){if(!_0x217067[_0x9b74('0x35')]){throw new db[(_0x9b74('0x6d'))][(_0x9b74('0x8b'))](_0x9b74('0x6e'),0x193);}_0x248c28=_0x217067;return db[_0x9b74('0x6f')][_0x9b74('0x45')]({'raw':!![]});}return null;})[_0x9b74('0x25')](function(_0xbc73ec){if(_0xbc73ec){_0x4b559b=_[_0x9b74('0x70')](_0xbc73ec,'id');var _0x490f04;var _0x4e30cd=squel[_0x9b74('0x71')]();_0x4e30cd['from'](_0x35c693['table']);for(var _0x49ffc=0x0;_0x49ffc<_0x248c28[_0x9b74('0x35')];_0x49ffc+=0x1){_0x490f04=_0x248c28[_0x49ffc][_0x9b74('0x74')]?_0x4b559b[_0x248c28[_0x49ffc][_0x9b74('0x74')]][_0x9b74('0x75')]:_0x248c28[_0x49ffc][_0x9b74('0x6a')];_0x490f04=_0x248c28[_0x49ffc][_0x9b74('0x76')]?_[_0x9b74('0x77')](_0x6247fa[_0x248c28[_0x49ffc][_0x9b74('0x76')]],'%s',_0x490f04):_0x490f04;_0x490f04=_0x248c28[_0x49ffc][_0x9b74('0x78')]?_['replace'](_0x51fe77[_0x248c28[_0x49ffc][_0x9b74('0x78')]],'%s',_0x490f04):_0x490f04;if(_0x248c28[_0x49ffc][_0x9b74('0x8c')]){_0x4e30cd[_0x9b74('0x69')](_0x490f04);}_0x248c28[_0x49ffc]['orderBy']&&_0x4e30cd[_0x9b74('0x39')](_0x490f04,_0x248c28[_0x49ffc]['orderBy']===_0x9b74('0x8d')?![]:!![]);_0x4e30cd[_0x9b74('0x6a')](_0x490f04,_0x248c28[_0x49ffc]['alias']||_0x490f04);}if(_0x35c693[_0x9b74('0x7c')]){_0x35c693[_0x9b74('0x7c')]=JSON[_0x9b74('0x7b')](_0x35c693[_0x9b74('0x7c')]);for(var _0x5436a9=0x0;_0x5436a9<_0x35c693[_0x9b74('0x7c')][_0x9b74('0x35')];_0x5436a9+=0x1){if(_0x35c693[_0x9b74('0x7c')][_0x5436a9][_0x9b74('0x2d')]&&_[_0x9b74('0x7d')](_0x5d71f8,_0x35c693[_0x9b74('0x7c')][_0x5436a9][_0x9b74('0x2d')])&&_0x35c693[_0x9b74('0x7c')][_0x5436a9][_0x9b74('0x7e')]&&_0x35c693[_0x9b74('0x7c')][_0x5436a9]['foreignTable']&&_0x35c693['joins'][_0x5436a9][_0x9b74('0x80')]){_0x4e30cd[_0x35c693[_0x9b74('0x7c')][_0x5436a9][_0x9b74('0x2d')]](_0x35c693[_0x9b74('0x7c')][_0x5436a9]['foreignTable'],null,util[_0x9b74('0x78')](_0x9b74('0x8e'),_0x35c693['table'],_0x35c693[_0x9b74('0x7c')][_0x5436a9][_0x9b74('0x7e')],_0x35c693[_0x9b74('0x7c')][_0x5436a9]['foreignTable'],_0x35c693[_0x9b74('0x7c')][_0x5436a9][_0x9b74('0x80')]));}}}if(_0x35c693[_0x9b74('0x81')]){_0x35c693[_0x9b74('0x81')]=JSON['parse'](_0x35c693[_0x9b74('0x81')]);_0x4e30cd[_0x9b74('0x3b')](_0x134418(_0x35c693[_0x9b74('0x81')]['group']));}_0x26be27=_0x4e30cd[_0x9b74('0x82')]();_0x4e30cd[_0x9b74('0x38')](_0x64dca);_0x4e30cd['offset'](0x0);logger[_0x9b74('0x83')](_0x9b74('0xa2'),_0x4e30cd['toString']());return dbH[_0x9b74('0x84')]['query'](_0x4e30cd['toString'](),{'type':dbH[_0x9b74('0x84')][_0x9b74('0x86')][_0x9b74('0x87')]});}})[_0x9b74('0x25')](function(){return{'sql':_0x26be27[_0x9b74('0x85')]()};})[_0x9b74('0x25')](respondWithResult(_0x335230,null))[_0x9b74('0x4b')](handleError(_0x335230,null));}; \ No newline at end of file +var _0x79b5=['stack','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','rows','catch','params','filters','includeAll','options','find','create','user','role','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','toString','sequelize','QueryTypes','join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','select','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','countTable','COUNT(*)','SELECT','run','ValidationErrorItem','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','count','offset','limit','set','json','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','end'];(function(_0x16446a,_0x5e9140){var _0x2c7051=function(_0x2e6a25){while(--_0x2e6a25){_0x16446a['push'](_0x16446a['shift']());}};_0x2c7051(++_0x5e9140);}(_0x79b5,0x1bd));var _0x579b=function(_0xbdb8e4,_0x1d14ba){_0xbdb8e4=_0xbdb8e4-0x0;var _0x4183c5=_0x79b5[_0xbdb8e4];return _0x4183c5;};'use strict';var pdf=require(_0x579b('0x0'));var emlformat=require(_0x579b('0x1'));var rimraf=require(_0x579b('0x2'));var zipdir=require(_0x579b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x579b('0x4'));var moment=require(_0x579b('0x5'));var BPromise=require(_0x579b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x579b('0x7'));var sox=require(_0x579b('0x8'));var csv=require(_0x579b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x579b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x579b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x579b('0xc'));var Papa=require(_0x579b('0xd'));var Redis=require(_0x579b('0xe'));var authService=require(_0x579b('0xf'));var qs=require(_0x579b('0x10'));var as=require(_0x579b('0x11'));var hardwareService=require(_0x579b('0x12'));var logger=require(_0x579b('0x13'))('api');var utils=require(_0x579b('0x14'));var config=require(_0x579b('0x15'));var licenseUtil=require(_0x579b('0x16'));var db=require(_0x579b('0x17'))['db'];var dbH=require(_0x579b('0x17'))[_0x579b('0x18')];function respondWithStatusCode(_0x152fd7,_0x5c09aa){_0x5c09aa=_0x5c09aa||0xcc;return function(_0x56eb29){if(_0x56eb29){return _0x152fd7[_0x579b('0x19')](_0x5c09aa);}return _0x152fd7[_0x579b('0x1a')](_0x5c09aa)['end']();};}function respondWithResult(_0x3b8614,_0x4ff063){_0x4ff063=_0x4ff063||0xc8;return function(_0x35fecc){if(_0x35fecc){return _0x3b8614['status'](_0x4ff063)['json'](_0x35fecc);}};}function respondWithFilteredResult(_0x322060,_0x2a8cc0){return function(_0x25d163){if(_0x25d163){var _0x5a0bfc=_0x25d163[_0x579b('0x1b')],_0x1ab1d0=_0x2a8cc0[_0x579b('0x1c')],_0x5932ea=_0x2a8cc0[_0x579b('0x1c')]+_0x2a8cc0[_0x579b('0x1d')],_0x5003a3;if(_0x5932ea>=_0x5a0bfc){_0x5932ea=_0x5a0bfc;_0x5003a3=0xc8;}else{_0x5003a3=0xce;}_0x322060['status'](_0x5003a3);return _0x322060[_0x579b('0x1e')]('Content-Range',_0x1ab1d0+'-'+_0x5932ea+'/'+_0x5a0bfc)[_0x579b('0x1f')](_0x25d163);}return null;};}function patchUpdates(_0x2b2fa7){return function(_0x580dd3){try{jsonpatch[_0x579b('0x20')](_0x580dd3,_0x2b2fa7,!![]);}catch(_0x19cabe){return BPromise[_0x579b('0x21')](_0x19cabe);}return _0x580dd3['save']();};}function saveUpdates(_0x572bb0,_0x6d2d04){return function(_0x2de030){if(_0x2de030){return _0x2de030[_0x579b('0x22')](_0x572bb0)[_0x579b('0x23')](function(_0x2a1ad5){return _0x2a1ad5;});}return null;};}function removeEntity(_0x37b08c,_0x3a436a){return function(_0x4d1abb){if(_0x4d1abb){return _0x4d1abb[_0x579b('0x24')]()[_0x579b('0x23')](function(){var _0x562291=_0x4d1abb[_0x579b('0x25')]({'plain':!![]});var _0x897f5f=_0x579b('0x26');return db[_0x579b('0x27')][_0x579b('0x24')]({'where':{'type':_0x897f5f,'resourceId':_0x562291['id']}})[_0x579b('0x23')](function(){return _0x4d1abb;});})['then'](function(){_0x37b08c['status'](0xcc)[_0x579b('0x28')]();});}};}function handleEntityNotFound(_0x5aa965,_0x130fc7){return function(_0x450a9b){if(!_0x450a9b){_0x5aa965[_0x579b('0x19')](0x194);}return _0x450a9b;};}function handleError(_0x27f41a,_0x549e01){_0x549e01=_0x549e01||0x1f4;return function(_0x253c1d){logger['error'](_0x253c1d[_0x579b('0x29')]);if(_0x253c1d['name']){delete _0x253c1d['name'];}_0x27f41a[_0x579b('0x1a')](_0x549e01)['send'](_0x253c1d);};}exports[_0x579b('0x2a')]=function(_0x31e14c,_0x2f47ea){var _0x2737da={},_0x50840e={},_0x19be45={'count':0x0,'rows':[]};var _0x54c7fd=_[_0x579b('0x2b')](db[_0x579b('0x2c')][_0x579b('0x2d')],function(_0x36693d){return{'name':_0x36693d[_0x579b('0x2e')],'type':_0x36693d[_0x579b('0x2f')]['key']};});_0x50840e[_0x579b('0x30')]=_['map'](_0x54c7fd,_0x579b('0x31'));_0x50840e['query']=_[_0x579b('0x32')](_0x31e14c[_0x579b('0x33')]);_0x50840e['filters']=_[_0x579b('0x34')](_0x50840e[_0x579b('0x30')],_0x50840e[_0x579b('0x33')]);_0x2737da[_0x579b('0x35')]=_[_0x579b('0x34')](_0x50840e[_0x579b('0x30')],qs[_0x579b('0x36')](_0x31e14c[_0x579b('0x33')]['fields']));_0x2737da[_0x579b('0x35')]=_0x2737da['attributes'][_0x579b('0x37')]?_0x2737da[_0x579b('0x35')]:_0x50840e['model'];if(!_0x31e14c[_0x579b('0x33')][_0x579b('0x38')](_0x579b('0x39'))){_0x2737da[_0x579b('0x1d')]=qs[_0x579b('0x1d')](_0x31e14c[_0x579b('0x33')][_0x579b('0x1d')]);_0x2737da[_0x579b('0x1c')]=qs[_0x579b('0x1c')](_0x31e14c[_0x579b('0x33')][_0x579b('0x1c')]);}_0x2737da[_0x579b('0x3a')]=qs[_0x579b('0x3b')](_0x31e14c[_0x579b('0x33')]['sort']);_0x2737da['where']=qs['filters'](_['pick'](_0x31e14c[_0x579b('0x33')],_0x50840e['filters']),_0x54c7fd);if(_0x31e14c[_0x579b('0x33')][_0x579b('0x3c')]){_0x2737da[_0x579b('0x3d')]=_[_0x579b('0x3e')](_0x2737da[_0x579b('0x3d')],{'$or':_[_0x579b('0x2b')](_0x54c7fd,function(_0x48bac3){if(_0x48bac3[_0x579b('0x2f')]!==_0x579b('0x3f')){var _0x1454ca={};_0x1454ca[_0x48bac3[_0x579b('0x31')]]={'$like':'%'+_0x31e14c['query']['filter']+'%'};return _0x1454ca;}})});}_0x2737da=_['merge']({},_0x2737da,_0x31e14c['options']);var _0x348d98={'where':_0x2737da['where']};return db[_0x579b('0x2c')][_0x579b('0x1b')](_0x348d98)[_0x579b('0x23')](function(_0x36d91a){_0x19be45[_0x579b('0x1b')]=_0x36d91a;if(_0x31e14c[_0x579b('0x33')]['includeAll']){_0x2737da[_0x579b('0x40')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x2737da);})[_0x579b('0x23')](function(_0x6d4983){_0x19be45[_0x579b('0x41')]=_0x6d4983;return _0x19be45;})[_0x579b('0x23')](respondWithFilteredResult(_0x2f47ea,_0x2737da))[_0x579b('0x42')](handleError(_0x2f47ea,null));};exports['show']=function(_0x59a52f,_0x5686f3){var _0x4dfb91={'raw':![],'where':{'id':_0x59a52f[_0x579b('0x43')]['id']}},_0x6b612b={};_0x6b612b[_0x579b('0x30')]=_['keys'](db[_0x579b('0x2c')][_0x579b('0x2d')]);_0x6b612b['query']=_['keys'](_0x59a52f[_0x579b('0x33')]);_0x6b612b[_0x579b('0x44')]=_[_0x579b('0x34')](_0x6b612b[_0x579b('0x30')],_0x6b612b[_0x579b('0x33')]);_0x4dfb91['attributes']=_[_0x579b('0x34')](_0x6b612b[_0x579b('0x30')],qs['fields'](_0x59a52f['query'][_0x579b('0x36')]));_0x4dfb91[_0x579b('0x35')]=_0x4dfb91['attributes'][_0x579b('0x37')]?_0x4dfb91[_0x579b('0x35')]:_0x6b612b[_0x579b('0x30')];if(_0x59a52f['query'][_0x579b('0x45')]){_0x4dfb91[_0x579b('0x40')]=[{'all':!![]}];}_0x4dfb91=_['merge']({},_0x4dfb91,_0x59a52f[_0x579b('0x46')]);return db[_0x579b('0x2c')][_0x579b('0x47')](_0x4dfb91)[_0x579b('0x23')](handleEntityNotFound(_0x5686f3,null))[_0x579b('0x23')](respondWithResult(_0x5686f3,null))['catch'](handleError(_0x5686f3,null));};exports['create']=function(_0x33ade4,_0x6ab516){return db[_0x579b('0x2c')][_0x579b('0x48')](_0x33ade4['body'],{})[_0x579b('0x23')](function(_0x4842f1){var _0x49c727=_0x33ade4[_0x579b('0x49')][_0x579b('0x25')]({'plain':!![]});if(!_0x49c727)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49c727[_0x579b('0x4a')]===_0x579b('0x49')){var _0x3db7ad=_0x4842f1[_0x579b('0x25')]({'plain':!![]});var _0x3ed7e1=_0x579b('0x4b');return db[_0x579b('0x4c')]['find']({'where':{'name':_0x3ed7e1,'userProfileId':_0x49c727['userProfileId']},'raw':!![]})[_0x579b('0x23')](function(_0x1344ae){if(_0x1344ae&&_0x1344ae[_0x579b('0x4d')]===0x0){return db[_0x579b('0x27')][_0x579b('0x48')]({'name':_0x3db7ad[_0x579b('0x31')],'resourceId':_0x3db7ad['id'],'type':'CustomReports','sectionId':_0x1344ae['id']},{})[_0x579b('0x23')](function(){return _0x4842f1;});}else{return _0x4842f1;}})[_0x579b('0x42')](function(_0x19035f){logger['error'](_0x579b('0x4e'),_0x19035f);throw _0x19035f;});}return _0x4842f1;})[_0x579b('0x23')](respondWithResult(_0x6ab516,0xc9))['catch'](handleError(_0x6ab516,null));};exports[_0x579b('0x22')]=function(_0x405075,_0x561a3d){if(_0x405075['body']['id']){delete _0x405075[_0x579b('0x4f')]['id'];}return db[_0x579b('0x2c')][_0x579b('0x47')]({'where':{'id':_0x405075[_0x579b('0x43')]['id']}})['then'](handleEntityNotFound(_0x561a3d,null))[_0x579b('0x23')](saveUpdates(_0x405075[_0x579b('0x4f')],null))['then'](respondWithResult(_0x561a3d,null))[_0x579b('0x42')](handleError(_0x561a3d,null));};exports[_0x579b('0x24')]=function(_0x44ee5a,_0xa36a8f){return db[_0x579b('0x2c')][_0x579b('0x47')]({'where':{'id':_0x44ee5a[_0x579b('0x43')]['id']}})[_0x579b('0x23')](handleEntityNotFound(_0xa36a8f,null))[_0x579b('0x23')](removeEntity(_0xa36a8f,null))[_0x579b('0x42')](handleError(_0xa36a8f,null));};exports[_0x579b('0x50')]=function(_0x4b9218,_0x1bc058){var _0x5a07ce=0xa;var _0x24eb9c=['join',_0x579b('0x51'),_0x579b('0x52'),_0x579b('0x53')];var _0x3c2cd5={'SUM':_0x579b('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x579b('0x55'),'MAX':_0x579b('0x56'),'MIN':'MIN(%s)','AVG':_0x579b('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x579b('0x58'),'GROUP_CONCAT DESC':_0x579b('0x59')};var _0x36914e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x579b('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x579b('0x5b')};var _0x5e1380=function(_0x32f705){return!_[_0x579b('0x5c')]([_0x579b('0x5d'),_0x579b('0x5e'),_0x579b('0x5f'),_0x579b('0x60')],_0x32f705);};var _0x37cf67=function(_0x8ac586){if(!_0x8ac586||!_0x8ac586[_0x579b('0x61')][_0x579b('0x37')]){return'';}for(var _0x253bf6='(',_0x1a505c=0x0;_0x1a505c<_0x8ac586['rules'][_0x579b('0x37')];_0x1a505c+=0x1){_0x1a505c>0x0&&(_0x253bf6+='\x20'+_0x8ac586[_0x579b('0x62')]+'\x20');_0x253bf6+=_0x8ac586[_0x579b('0x61')][_0x1a505c][_0x579b('0x63')]?_0x37cf67(_0x8ac586[_0x579b('0x61')][_0x1a505c]['group']):_0x8ac586[_0x579b('0x61')][_0x1a505c]['field']+'\x20'+_0x8ac586['rules'][_0x1a505c][_0x579b('0x64')]+(_0x5e1380(_0x8ac586[_0x579b('0x61')][_0x1a505c][_0x579b('0x64')])?'\x20'+_0x8ac586[_0x579b('0x61')][_0x1a505c][_0x579b('0x65')]:'');}return _0x253bf6+')';};var _0xe66da4={'where':{'id':_0x4b9218[_0x579b('0x43')]['id']}},_0x45bd78,_0x4e2fb3,_0x2efe89,_0x1beb1d,_0x3ff72d;_0xe66da4=_[_0x579b('0x3e')]({},_0xe66da4,_0x4b9218['options']);return db['AnalyticCustomReport'][_0x579b('0x47')](_0xe66da4)[_0x579b('0x23')](function(_0xf11085){if(_0xf11085){_0x45bd78=_0xf11085;return _0xf11085[_0x579b('0x66')]();}return null;})[_0x579b('0x23')](function(_0x458c22){if(_0x458c22){if(!_0x458c22['length']){throw new db[(_0x579b('0x67'))]['ValidationErrorItem'](_0x579b('0x68'),0x193);}_0x4e2fb3=_0x458c22;return db[_0x579b('0x69')][_0x579b('0x6a')]({'raw':!![]});}return null;})[_0x579b('0x23')](function(_0x1f029f){if(_0x1f029f){_0x2efe89=_[_0x579b('0x6b')](_0x1f029f,'id');var _0x4db2cf;var _0x44636a=squel['select']();_0x44636a[_0x579b('0x6c')](_0x45bd78[_0x579b('0x6d')]);for(var _0x60563=0x0;_0x60563<_0x4e2fb3[_0x579b('0x37')];_0x60563+=0x1){_0x4db2cf=_0x4e2fb3[_0x60563][_0x579b('0x6e')]?_0x2efe89[_0x4e2fb3[_0x60563][_0x579b('0x6e')]][_0x579b('0x6f')]:_0x4e2fb3[_0x60563][_0x579b('0x70')];_0x4db2cf=_0x4e2fb3[_0x60563][_0x579b('0x71')]?_[_0x579b('0x72')](_0x3c2cd5[_0x4e2fb3[_0x60563]['function']],'%s',_0x4db2cf):_0x4db2cf;_0x4db2cf=_0x4e2fb3[_0x60563][_0x579b('0x73')]?_[_0x579b('0x72')](_0x36914e[_0x4e2fb3[_0x60563]['format']],'%s',_0x4db2cf):_0x4db2cf;if(_0x4e2fb3[_0x60563][_0x579b('0x74')]){_0x44636a['group'](_0x4db2cf);}_0x4e2fb3[_0x60563][_0x579b('0x75')]&&_0x44636a[_0x579b('0x3a')](_0x4db2cf,_0x4e2fb3[_0x60563][_0x579b('0x75')]===_0x579b('0x76')?![]:!![]);_0x44636a[_0x579b('0x70')](_0x4db2cf,_0x4e2fb3[_0x60563][_0x579b('0x77')]||_0x4db2cf);}if(_0x45bd78[_0x579b('0x78')]){_0x45bd78[_0x579b('0x78')]=JSON['parse'](_0x45bd78[_0x579b('0x78')]);for(var _0x2218f0=0x0;_0x2218f0<_0x45bd78[_0x579b('0x78')][_0x579b('0x37')];_0x2218f0+=0x1){if(_0x45bd78['joins'][_0x2218f0][_0x579b('0x2f')]&&_[_0x579b('0x5c')](_0x24eb9c,_0x45bd78[_0x579b('0x78')][_0x2218f0][_0x579b('0x2f')])&&_0x45bd78['joins'][_0x2218f0][_0x579b('0x79')]&&_0x45bd78[_0x579b('0x78')][_0x2218f0][_0x579b('0x7a')]&&_0x45bd78[_0x579b('0x78')][_0x2218f0]['foreignKey']){_0x44636a[_0x45bd78[_0x579b('0x78')][_0x2218f0][_0x579b('0x2f')]](_0x45bd78[_0x579b('0x78')][_0x2218f0]['foreignTable'],null,util[_0x579b('0x73')](_0x579b('0x7b'),_0x45bd78[_0x579b('0x6d')],_0x45bd78[_0x579b('0x78')][_0x2218f0][_0x579b('0x79')],_0x45bd78[_0x579b('0x78')][_0x2218f0][_0x579b('0x7a')],_0x45bd78[_0x579b('0x78')][_0x2218f0][_0x579b('0x7c')]));}}}if(_0x45bd78['conditions']){_0x45bd78[_0x579b('0x7d')]=JSON[_0x579b('0x7e')](_0x45bd78[_0x579b('0x7d')]);_0x44636a[_0x579b('0x3d')](_0x37cf67(_0x45bd78[_0x579b('0x7d')][_0x579b('0x63')]));}_0x3ff72d=_0x44636a[_0x579b('0x7f')]();_0x44636a[_0x579b('0x1d')](_0x5a07ce);_0x44636a[_0x579b('0x1c')](0x0);logger[_0x579b('0x80')]('Limited\x20Query:',_0x44636a[_0x579b('0x81')]());return dbH[_0x579b('0x82')][_0x579b('0x33')](_0x44636a[_0x579b('0x81')](),{'type':dbH[_0x579b('0x82')][_0x579b('0x83')]['SELECT']});}})[_0x579b('0x23')](respondWithResult(_0x1bc058,null))[_0x579b('0x42')](handleError(_0x1bc058,null));};function runReport(_0x45f94d,_0x4a67f1,_0x3ed363){var _0x1767f9=_0x4a67f1[_0x579b('0x31')];var _0x168a7e=0xa;var _0x2f95f0=[_0x579b('0x84'),_0x579b('0x51'),_0x579b('0x52'),_0x579b('0x53')];var _0x57eb10={'SUM':_0x579b('0x54'),'COUNT':_0x579b('0x85'),'COUNT DISTINCT':_0x579b('0x55'),'MAX':_0x579b('0x56'),'MIN':_0x579b('0x86'),'AVG':_0x579b('0x57'),'GROUP_CONCAT':_0x579b('0x87'),'GROUP_CONCAT ASC':_0x579b('0x58'),'GROUP_CONCAT DESC':_0x579b('0x59')};var _0x1c3bb4={'SEC_TO_TIME':_0x579b('0x88'),'DATE':_0x579b('0x5a'),'HOUR':_0x579b('0x89'),'ROUND':_0x579b('0x8a'),'UNIX_TIMESTAMP':_0x579b('0x5b')};var _0x566094=function(_0x48cb0d){return!_[_0x579b('0x5c')]([_0x579b('0x5d'),_0x579b('0x5e'),_0x579b('0x5f'),'IS\x20NOT\x20EMPTY'],_0x48cb0d);};var _0x45f177=function(_0x562293){if(!_0x562293||!_0x562293['rules'][_0x579b('0x37')]){return'';}for(var _0x76cc18='(',_0x41c1aa=0x0;_0x41c1aa<_0x562293[_0x579b('0x61')][_0x579b('0x37')];_0x41c1aa+=0x1){_0x41c1aa>0x0&&(_0x76cc18+='\x20'+_0x562293['operator']+'\x20');_0x76cc18+=_0x562293[_0x579b('0x61')][_0x41c1aa][_0x579b('0x63')]?_0x45f177(_0x562293[_0x579b('0x61')][_0x41c1aa][_0x579b('0x63')]):_0x562293[_0x579b('0x61')][_0x41c1aa][_0x579b('0x70')]+'\x20'+_0x562293[_0x579b('0x61')][_0x41c1aa][_0x579b('0x64')]+(_0x566094(_0x562293[_0x579b('0x61')][_0x41c1aa]['condition'])?'\x20'+_0x562293[_0x579b('0x61')][_0x41c1aa]['value']:'');}return _0x76cc18+')';};var _0x146748={'where':{'id':_0x45f94d['id']}},_0x2304fb,_0xf61eff,_0x47e57a,_0x5c4c9c,_0x321601;_0x146748=_[_0x579b('0x3e')]({},_0x146748,_0x3ed363);return db[_0x579b('0x2c')][_0x579b('0x47')](_0x146748)[_0x579b('0x23')](function(_0x11e85e){if(_0x11e85e){_0x2304fb=_0x11e85e;return _0x11e85e[_0x579b('0x66')]();}return null;})[_0x579b('0x23')](function(_0x27a284){if(_0x27a284){if(!_0x27a284['length']){throw new db[(_0x579b('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xf61eff=_0x27a284;return db['AnalyticMetric'][_0x579b('0x6a')]({'raw':!![]});}return null;})[_0x579b('0x23')](function(_0x4cf0ed){if(_0x4cf0ed){_0x47e57a=_[_0x579b('0x6b')](_0x4cf0ed,'id');var _0x2e3195;var _0x570ecf=squel[_0x579b('0x8b')]();_0x570ecf[_0x579b('0x6c')](_0x2304fb['table']);for(var _0x146f16=0x0;_0x146f16<_0xf61eff['length'];_0x146f16+=0x1){_0x2e3195=_0xf61eff[_0x146f16][_0x579b('0x6e')]?_0x47e57a[_0xf61eff[_0x146f16][_0x579b('0x6e')]][_0x579b('0x6f')]:_0xf61eff[_0x146f16][_0x579b('0x70')];_0x2e3195=_0xf61eff[_0x146f16]['function']?_[_0x579b('0x72')](_0x57eb10[_0xf61eff[_0x146f16][_0x579b('0x71')]],'%s',_0x2e3195):_0x2e3195;_0x2e3195=_0xf61eff[_0x146f16]['format']?_[_0x579b('0x72')](_0x1c3bb4[_0xf61eff[_0x146f16][_0x579b('0x73')]],'%s',_0x2e3195):_0x2e3195;if(_0xf61eff[_0x146f16]['groupBy']){_0x570ecf['group'](_0x2e3195);}_0xf61eff[_0x146f16][_0x579b('0x75')]&&_0x570ecf[_0x579b('0x3a')](_0x2e3195,_0xf61eff[_0x146f16][_0x579b('0x75')]===_0x579b('0x76')?![]:!![]);_0x570ecf[_0x579b('0x70')](_0x2e3195,_0xf61eff[_0x146f16][_0x579b('0x77')]||_0x2e3195);}if(_0x2304fb['joins']){_0x2304fb[_0x579b('0x78')]=JSON[_0x579b('0x7e')](_0x2304fb['joins']);for(var _0x4cf564=0x0;_0x4cf564<_0x2304fb[_0x579b('0x78')][_0x579b('0x37')];_0x4cf564+=0x1){if(_0x2304fb[_0x579b('0x78')][_0x4cf564]['type']&&_[_0x579b('0x5c')](_0x2f95f0,_0x2304fb['joins'][_0x4cf564][_0x579b('0x2f')])&&_0x2304fb[_0x579b('0x78')][_0x4cf564][_0x579b('0x79')]&&_0x2304fb[_0x579b('0x78')][_0x4cf564]['foreignTable']&&_0x2304fb[_0x579b('0x78')][_0x4cf564][_0x579b('0x7c')]){_0x570ecf[_0x2304fb[_0x579b('0x78')][_0x4cf564][_0x579b('0x2f')]](_0x2304fb[_0x579b('0x78')][_0x4cf564]['foreignTable'],null,util[_0x579b('0x73')](_0x579b('0x7b'),_0x2304fb[_0x579b('0x6d')],_0x2304fb[_0x579b('0x78')][_0x4cf564]['parentKey'],_0x2304fb[_0x579b('0x78')][_0x4cf564][_0x579b('0x7a')],_0x2304fb['joins'][_0x4cf564]['foreignKey']));}}}if(_0x2304fb['conditions']){_0x2304fb['conditions']=JSON[_0x579b('0x7e')](_0x2304fb['conditions']);_0x570ecf[_0x579b('0x3d')](_0x45f177(_0x2304fb[_0x579b('0x7d')][_0x579b('0x63')]));}_0x321601=_0x570ecf[_0x579b('0x7f')]();_0x570ecf[_0x579b('0x1d')](_0x168a7e);_0x570ecf['offset'](0x0);return;}})['then'](function(){if(_0x4a67f1['output']===_0x579b('0x8c')){return null;}var _0x1feb9e=_[_0x579b('0x3e')](_0x4a67f1,{'name':_0x4a67f1[_0x579b('0x8d')]||_0x4a67f1[_0x579b('0x31')]||_0x2304fb[_0x579b('0x31')],'basename':_0x1767f9,'savename':util['format'](_0x579b('0x8e'),_0x4a67f1[_0x579b('0x31')]||_0x2304fb['name'],require(_0x579b('0x8f'))[_0x579b('0x90')](0x4),_0x4a67f1[_0x579b('0x91')]||_0x579b('0x92')),'reportId':_0x2304fb['id'],'reportType':_0x579b('0x93')});return db[_0x579b('0x94')][_0x579b('0x48')](_0x1feb9e,{'raw':!![]});})['then'](function(_0x27ce60){if(_0x2304fb[_0x579b('0x6d')]===_0x579b('0x95')){_0x321601['where'](_0x2304fb[_0x579b('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4a67f1['startDate'],_0x4a67f1[_0x579b('0x96')]);}else{_0x321601[_0x579b('0x3d')](_0x2304fb[_0x579b('0x6d')]+_0x579b('0x97'),_0x4a67f1[_0x579b('0x98')],_0x4a67f1[_0x579b('0x96')]);}if(_0x27ce60){logger[_0x579b('0x99')](_0x579b('0x9a'),_0x321601[_0x579b('0x81')]());require(_0x579b('0x9b'))[_0x579b('0x9c')](path[_0x579b('0x84')](__dirname,'../../components/export/',_0x27ce60[_0x579b('0x91')]),[_0x27ce60['id'],_0x321601[_0x579b('0x81')](),path[_0x579b('0x84')](__dirname,'../../files/reports',_0x27ce60['savename']),_0x1767f9]);return _0x27ce60;}else{var _0x5ba832=squel[_0x579b('0x8b')]();_0x5ba832[_0x579b('0x6c')]('('+_0x321601[_0x579b('0x81')]()+')',_0x579b('0x9d'));_0x5ba832[_0x579b('0x70')](_0x579b('0x9e'),_0x579b('0x1b'));_0x321601[_0x579b('0x1d')](_0x4a67f1[_0x579b('0x1d')]||_0x168a7e);_0x321601[_0x579b('0x1c')](_0x4a67f1[_0x579b('0x1c')]||0x0);return dbH[_0x579b('0x82')][_0x579b('0x33')](_0x5ba832[_0x579b('0x81')](),{'type':dbH[_0x579b('0x82')]['QueryTypes'][_0x579b('0x9f')]})[_0x579b('0x23')](function(_0x32dc5d){if(!_0x32dc5d['length']){_0x5c4c9c=0x0;}else{_0x5c4c9c=_0x32dc5d[0x0][_0x579b('0x1b')]||0x0;}return dbH[_0x579b('0x82')][_0x579b('0x33')](_0x321601['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x579b('0x23')](function(_0x523796){return{'rows':_0x523796||[],'count':_0x5c4c9c};});}});}exports[_0x579b('0xa0')]=function(_0x1793e2,_0x5eb8f0){return runReport(_0x1793e2[_0x579b('0x43')],_0x1793e2[_0x579b('0x33')],_0x1793e2[_0x579b('0x46')])[_0x579b('0x23')](respondWithResult(_0x5eb8f0,null))[_0x579b('0x42')](handleError(_0x5eb8f0,null));};exports['runReport']=runReport;exports[_0x579b('0x33')]=function(_0x10be3c,_0x2067c8){var _0x22b35f=0xa;var _0x478bb4=[_0x579b('0x84'),_0x579b('0x51'),_0x579b('0x52'),_0x579b('0x53')];var _0x961d61={'SUM':_0x579b('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x579b('0x56'),'MIN':_0x579b('0x86'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x579b('0x58'),'GROUP_CONCAT DESC':_0x579b('0x59')};var _0x478fdd={'SEC_TO_TIME':_0x579b('0x88'),'DATE':_0x579b('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x579b('0x5b')};var _0x192b85=function(_0x1388c5){return!_['includes']([_0x579b('0x5d'),'IS\x20NOT\x20NULL',_0x579b('0x5f'),_0x579b('0x60')],_0x1388c5);};var _0x36de18=function(_0xb84035){if(!_0xb84035||!_0xb84035[_0x579b('0x61')][_0x579b('0x37')]){return'';}for(var _0x2d9216='(',_0x308972=0x0;_0x308972<_0xb84035['rules'][_0x579b('0x37')];_0x308972+=0x1){_0x308972>0x0&&(_0x2d9216+='\x20'+_0xb84035[_0x579b('0x62')]+'\x20');_0x2d9216+=_0xb84035[_0x579b('0x61')][_0x308972][_0x579b('0x63')]?_0x36de18(_0xb84035[_0x579b('0x61')][_0x308972][_0x579b('0x63')]):_0xb84035[_0x579b('0x61')][_0x308972][_0x579b('0x70')]+'\x20'+_0xb84035['rules'][_0x308972][_0x579b('0x64')]+(_0x192b85(_0xb84035[_0x579b('0x61')][_0x308972]['condition'])?'\x20'+_0xb84035[_0x579b('0x61')][_0x308972]['value']:'');}return _0x2d9216+')';};var _0x3a1bfb={'where':{'id':_0x10be3c[_0x579b('0x43')]['id']}},_0x2a5548,_0x37750e,_0x1043c0,_0x7b0a66,_0x1a08b9;_0x3a1bfb=_[_0x579b('0x3e')]({},_0x3a1bfb,_0x10be3c[_0x579b('0x46')]);return db[_0x579b('0x2c')][_0x579b('0x47')](_0x3a1bfb)[_0x579b('0x23')](function(_0x3d8374){if(_0x3d8374){_0x2a5548=_0x3d8374;return _0x3d8374['getFields']();}return null;})[_0x579b('0x23')](function(_0x582ec8){if(_0x582ec8){if(!_0x582ec8[_0x579b('0x37')]){throw new db[(_0x579b('0x67'))][(_0x579b('0xa1'))](_0x579b('0x68'),0x193);}_0x37750e=_0x582ec8;return db['AnalyticMetric'][_0x579b('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x8d60b4){if(_0x8d60b4){_0x1043c0=_[_0x579b('0x6b')](_0x8d60b4,'id');var _0x3f44bd;var _0xd862=squel[_0x579b('0x8b')]();_0xd862[_0x579b('0x6c')](_0x2a5548[_0x579b('0x6d')]);for(var _0x5f2395=0x0;_0x5f2395<_0x37750e['length'];_0x5f2395+=0x1){_0x3f44bd=_0x37750e[_0x5f2395][_0x579b('0x6e')]?_0x1043c0[_0x37750e[_0x5f2395]['MetricId']][_0x579b('0x6f')]:_0x37750e[_0x5f2395]['field'];_0x3f44bd=_0x37750e[_0x5f2395][_0x579b('0x71')]?_[_0x579b('0x72')](_0x961d61[_0x37750e[_0x5f2395][_0x579b('0x71')]],'%s',_0x3f44bd):_0x3f44bd;_0x3f44bd=_0x37750e[_0x5f2395][_0x579b('0x73')]?_[_0x579b('0x72')](_0x478fdd[_0x37750e[_0x5f2395][_0x579b('0x73')]],'%s',_0x3f44bd):_0x3f44bd;if(_0x37750e[_0x5f2395][_0x579b('0x74')]){_0xd862[_0x579b('0x63')](_0x3f44bd);}_0x37750e[_0x5f2395]['orderBy']&&_0xd862[_0x579b('0x3a')](_0x3f44bd,_0x37750e[_0x5f2395]['orderBy']===_0x579b('0x76')?![]:!![]);_0xd862[_0x579b('0x70')](_0x3f44bd,_0x37750e[_0x5f2395]['alias']||_0x3f44bd);}if(_0x2a5548[_0x579b('0x78')]){_0x2a5548[_0x579b('0x78')]=JSON[_0x579b('0x7e')](_0x2a5548[_0x579b('0x78')]);for(var _0x17a3af=0x0;_0x17a3af<_0x2a5548[_0x579b('0x78')]['length'];_0x17a3af+=0x1){if(_0x2a5548[_0x579b('0x78')][_0x17a3af][_0x579b('0x2f')]&&_[_0x579b('0x5c')](_0x478bb4,_0x2a5548[_0x579b('0x78')][_0x17a3af][_0x579b('0x2f')])&&_0x2a5548[_0x579b('0x78')][_0x17a3af]['parentKey']&&_0x2a5548[_0x579b('0x78')][_0x17a3af][_0x579b('0x7a')]&&_0x2a5548[_0x579b('0x78')][_0x17a3af][_0x579b('0x7c')]){_0xd862[_0x2a5548['joins'][_0x17a3af][_0x579b('0x2f')]](_0x2a5548[_0x579b('0x78')][_0x17a3af][_0x579b('0x7a')],null,util[_0x579b('0x73')]('%s.%s\x20=\x20%s.%s',_0x2a5548[_0x579b('0x6d')],_0x2a5548[_0x579b('0x78')][_0x17a3af][_0x579b('0x79')],_0x2a5548['joins'][_0x17a3af][_0x579b('0x7a')],_0x2a5548[_0x579b('0x78')][_0x17a3af]['foreignKey']));}}}if(_0x2a5548[_0x579b('0x7d')]){_0x2a5548['conditions']=JSON[_0x579b('0x7e')](_0x2a5548[_0x579b('0x7d')]);_0xd862[_0x579b('0x3d')](_0x36de18(_0x2a5548[_0x579b('0x7d')][_0x579b('0x63')]));}_0x1a08b9=_0xd862['clone']();_0xd862[_0x579b('0x1d')](_0x22b35f);_0xd862[_0x579b('0x1c')](0x0);logger[_0x579b('0x80')]('Limited\x20Query:',_0xd862[_0x579b('0x81')]());return dbH[_0x579b('0x82')][_0x579b('0x33')](_0xd862['toString'](),{'type':dbH[_0x579b('0x82')][_0x579b('0x83')][_0x579b('0x9f')]});}})['then'](function(){return{'sql':_0x1a08b9[_0x579b('0x81')]()};})[_0x579b('0x23')](respondWithResult(_0x2067c8,null))[_0x579b('0x42')](handleError(_0x2067c8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 33540d2..e5b449d 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 _0xdf89=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x384efd,_0x178668){var _0x1f41c4=function(_0x28fef2){while(--_0x28fef2){_0x384efd['push'](_0x384efd['shift']());}};_0x1f41c4(++_0x178668);}(_0xdf89,0x16e));var _0x9df8=function(_0x11b546,_0x4f5146){_0x11b546=_0x11b546-0x0;var _0x12082f=_0xdf89[_0x11b546];return _0x12082f;};'use strict';var _=require(_0x9df8('0x0'));var util=require('util');var logger=require(_0x9df8('0x1'))(_0x9df8('0x2'));var moment=require(_0x9df8('0x3'));var BPromise=require(_0x9df8('0x4'));var rp=require(_0x9df8('0x5'));var fs=require('fs');var path=require(_0x9df8('0x6'));var rimraf=require(_0x9df8('0x7'));var config=require(_0x9df8('0x8'));var attributes=require(_0x9df8('0x9'));module['exports']=function(_0x1ad4d3,_0x1be418){return _0x1ad4d3[_0x9df8('0xa')](_0x9df8('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedf5=['util','api','request-promise','path','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x3959b9,_0x225f42){var _0x16ef21=function(_0x139dec){while(--_0x139dec){_0x3959b9['push'](_0x3959b9['shift']());}};_0x16ef21(++_0x225f42);}(_0xedf5,0x10e));var _0x5edf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xedf5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5edf('0x0'));var logger=require('../../config/logger')(_0x5edf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5edf('0x2'));var fs=require('fs');var path=require(_0x5edf('0x3'));var rimraf=require('rimraf');var config=require(_0x5edf('0x4'));var attributes=require('./analyticCustomReport.attributes');module[_0x5edf('0x5')]=function(_0x409f7f,_0x4e6382){return _0x409f7f[_0x5edf('0x6')](_0x5edf('0x7'),attributes,{'tableName':_0x5edf('0x8'),'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 8e0b851..adde01d 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 _0x18d5=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x41c166,_0x41bda0){var _0x29c06c=function(_0x112228){while(--_0x112228){_0x41c166['push'](_0x41c166['shift']());}};_0x29c06c(++_0x41bda0);}(_0x18d5,0x9c));var _0x518d=function(_0x1b30bb,_0x283d23){_0x1b30bb=_0x1b30bb-0x0;var _0x4da755=_0x18d5[_0x1b30bb];return _0x4da755;};'use strict';var _=require('lodash');var util=require(_0x518d('0x0'));var moment=require(_0x518d('0x1'));var BPromise=require(_0x518d('0x2'));var rs=require(_0x518d('0x3'));var fs=require('fs');var Redis=require(_0x518d('0x4'));var db=require(_0x518d('0x5'))['db'];var utils=require(_0x518d('0x6'));var logger=require('../../config/logger')(_0x518d('0x7'));var config=require(_0x518d('0x8'));var jayson=require(_0x518d('0x9'));var client=jayson[_0x518d('0xa')][_0x518d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e2937,_0x4d0d45,_0x5bf96e){return new BPromise(function(_0x58fd70,_0x4e17ae){return client[_0x518d('0xc')](_0x3e2937,_0x5bf96e)['then'](function(_0x448d1f){logger[_0x518d('0xd')](_0x518d('0xe'),_0x4d0d45,_0x518d('0xf'));logger['debug'](_0x518d('0x10'),_0x4d0d45,_0x518d('0xf'),JSON[_0x518d('0x11')](_0x448d1f));if(_0x448d1f['error']){if(_0x448d1f[_0x518d('0x12')][_0x518d('0x13')]===0x1f4){logger['error'](_0x518d('0xe'),_0x4d0d45,_0x448d1f[_0x518d('0x12')]['message']);return _0x4e17ae(_0x448d1f[_0x518d('0x12')][_0x518d('0x14')]);}logger[_0x518d('0x12')](_0x518d('0xe'),_0x4d0d45,_0x448d1f[_0x518d('0x12')][_0x518d('0x14')]);return _0x58fd70(_0x448d1f[_0x518d('0x12')]['message']);}else{logger[_0x518d('0xd')](_0x518d('0xe'),_0x4d0d45,_0x518d('0xf'));_0x58fd70(_0x448d1f[_0x518d('0x15')][_0x518d('0x14')]);}})[_0x518d('0x16')](function(_0x37225a){logger[_0x518d('0x12')](_0x518d('0xe'),_0x4d0d45,_0x37225a);_0x4e17ae(_0x37225a);});});} \ No newline at end of file +var _0x2aa7=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x1a30c5,_0x477753){var _0xff44c2=function(_0x1325cc){while(--_0x1325cc){_0x1a30c5['push'](_0x1a30c5['shift']());}};_0xff44c2(++_0x477753);}(_0x2aa7,0xa8));var _0x72aa=function(_0x29875e,_0x1ff5a6){_0x29875e=_0x29875e-0x0;var _0x3a9b4c=_0x2aa7[_0x29875e];return _0x3a9b4c;};'use strict';var _=require('lodash');var util=require(_0x72aa('0x0'));var moment=require(_0x72aa('0x1'));var BPromise=require('bluebird');var rs=require(_0x72aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x72aa('0x3'));var logger=require(_0x72aa('0x4'))(_0x72aa('0x5'));var config=require(_0x72aa('0x6'));var jayson=require(_0x72aa('0x7'));var client=jayson[_0x72aa('0x8')][_0x72aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x464ed8,_0x46c449,_0x7ff3e6){return new BPromise(function(_0x59a69d,_0x26d6ff){return client[_0x72aa('0xa')](_0x464ed8,_0x7ff3e6)['then'](function(_0x53a71d){logger[_0x72aa('0xb')](_0x72aa('0xc'),_0x46c449,_0x72aa('0xd'));logger[_0x72aa('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x46c449,'request\x20sent',JSON[_0x72aa('0xf')](_0x53a71d));if(_0x53a71d[_0x72aa('0x10')]){if(_0x53a71d[_0x72aa('0x10')][_0x72aa('0x11')]===0x1f4){logger[_0x72aa('0x10')](_0x72aa('0xc'),_0x46c449,_0x53a71d[_0x72aa('0x10')]['message']);return _0x26d6ff(_0x53a71d[_0x72aa('0x10')][_0x72aa('0x12')]);}logger['error'](_0x72aa('0xc'),_0x46c449,_0x53a71d['error'][_0x72aa('0x12')]);return _0x59a69d(_0x53a71d[_0x72aa('0x10')][_0x72aa('0x12')]);}else{logger[_0x72aa('0xb')](_0x72aa('0xc'),_0x46c449,_0x72aa('0xd'));_0x59a69d(_0x53a71d[_0x72aa('0x13')][_0x72aa('0x12')]);}})[_0x72aa('0x14')](function(_0x23bb19){logger[_0x72aa('0x10')](_0x72aa('0xc'),_0x46c449,_0x23bb19);_0x26d6ff(_0x23bb19);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index caf0510..afa4560 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 _0x02ff=['put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create'];(function(_0x49c8a2,_0x58dcff){var _0xe46e67=function(_0x547e69){while(--_0x547e69){_0x49c8a2['push'](_0x49c8a2['shift']());}};_0xe46e67(++_0x58dcff);}(_0x02ff,0x1ad));var _0xf02f=function(_0x12d0e3,_0x49be30){_0x12d0e3=_0x12d0e3-0x0;var _0x186871=_0x02ff[_0x12d0e3];return _0x186871;};'use strict';var multer=require(_0xf02f('0x0'));var util=require(_0xf02f('0x1'));var path=require(_0xf02f('0x2'));var timeout=require(_0xf02f('0x3'));var express=require(_0xf02f('0x4'));var router=express['Router']();var auth=require(_0xf02f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf02f('0x6'));var controller=require(_0xf02f('0x7'));router[_0xf02f('0x8')]('/',auth[_0xf02f('0x9')](),controller[_0xf02f('0xa')]);router[_0xf02f('0x8')](_0xf02f('0xb'),auth[_0xf02f('0x9')](),controller[_0xf02f('0xc')]);router[_0xf02f('0x8')](_0xf02f('0xd'),auth['isAuthenticated'](),controller[_0xf02f('0xe')]);router[_0xf02f('0x8')](_0xf02f('0xf'),auth['isAuthenticated'](),controller[_0xf02f('0x10')]);router[_0xf02f('0x8')](_0xf02f('0x11'),auth[_0xf02f('0x9')](),controller[_0xf02f('0x12')]);router[_0xf02f('0x13')]('/',auth[_0xf02f('0x9')](),controller[_0xf02f('0x14')]);router[_0xf02f('0x15')]('/:id',auth[_0xf02f('0x9')](),controller[_0xf02f('0x16')]);router[_0xf02f('0x17')](_0xf02f('0xb'),auth[_0xf02f('0x9')](),controller['destroy']);module[_0xf02f('0x18')]=router; \ No newline at end of file +var _0x16e7=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16e7,0xfe));var _0x716e=function(_0x5d3547,_0x363d67){_0x5d3547=_0x5d3547-0x0;var _0x5074e7=_0x16e7[_0x5d3547];return _0x5074e7;};'use strict';var multer=require(_0x716e('0x0'));var util=require(_0x716e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x716e('0x2'));var router=express[_0x716e('0x3')]();var auth=require(_0x716e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x716e('0x5'));var controller=require(_0x716e('0x6'));router[_0x716e('0x7')]('/',auth[_0x716e('0x8')](),controller[_0x716e('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x716e('0xa')]);router['get'](_0x716e('0xb'),auth[_0x716e('0x8')](),controller[_0x716e('0xc')]);router[_0x716e('0x7')](_0x716e('0xd'),auth['isAuthenticated'](),controller[_0x716e('0xe')]);router[_0x716e('0x7')](_0x716e('0xf'),auth[_0x716e('0x8')](),controller[_0x716e('0x10')]);router[_0x716e('0x11')]('/',auth[_0x716e('0x8')](),controller[_0x716e('0x12')]);router[_0x716e('0x13')](_0x716e('0x14'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x716e('0x14'),auth[_0x716e('0x8')](),controller[_0x716e('0x15')]);module[_0x716e('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7779989..1aba4b4 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 _0xd026=['exports','STRING','TEXT'];(function(_0x2c1eba,_0x17a869){var _0x5bd2cf=function(_0x3e9ecb){while(--_0x3e9ecb){_0x2c1eba['push'](_0x2c1eba['shift']());}};_0x5bd2cf(++_0x17a869);}(_0xd026,0x7e));var _0x6d02=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xd026[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require('sequelize');module[_0x6d02('0x0')]={'name':{'type':Sequelize[_0x6d02('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6d02('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6d02('0x1')]},'conditions':{'type':Sequelize[_0x6d02('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3b09=['STRING','TEXT','sequelize','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3b09,0x1b2));var _0x93b0=function(_0x2b825a,_0x2f007e){_0x2b825a=_0x2b825a-0x0;var _0x9bd7b1=_0x3b09[_0x2b825a];return _0x9bd7b1;};'use strict';var Sequelize=require(_0x93b0('0x0'));module[_0x93b0('0x1')]={'name':{'type':Sequelize[_0x93b0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x93b0('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x93b0('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x93b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c7c6d6c..525fcdb 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 _0x21c9=['apply','reject','save','then','destroy','get','DefaultReports','status','end','stack','name','map','AnalyticDefaultReport','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','left_join','cross_join','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','orderBy','order','DESC','alias','joins','parse','includes','foreignTable','foreignKey','format','parentKey','conditions','clone','debug','sequelize','QueryTypes','join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','operator','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','%s.%s\x20=\x20%s.%s','output','web','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','toString','child_process','../../components/export/','savename','select','from','countTable','run','runReport','COUNT(%s)','ValidationErrorItem','groupBy','SELECT','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','json','count','offset','limit','set','Content-Range'];(function(_0x211ac1,_0x4c97ea){var _0x5a76fe=function(_0x31122){while(--_0x31122){_0x211ac1['push'](_0x211ac1['shift']());}};_0x5a76fe(++_0x4c97ea);}(_0x21c9,0x1b4));var _0x921c=function(_0x1c03ea,_0x43915d){_0x1c03ea=_0x1c03ea-0x0;var _0x48c181=_0x21c9[_0x1c03ea];return _0x48c181;};'use strict';var pdf=require(_0x921c('0x0'));var emlformat=require(_0x921c('0x1'));var rimraf=require(_0x921c('0x2'));var zipdir=require(_0x921c('0x3'));var jsonpatch=require(_0x921c('0x4'));var rp=require(_0x921c('0x5'));var moment=require(_0x921c('0x6'));var BPromise=require(_0x921c('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x921c('0x8'));var sox=require('sox');var csv=require(_0x921c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x921c('0xa'));var crypto=require(_0x921c('0xb'));var jsforce=require(_0x921c('0xc'));var deskjs=require(_0x921c('0xd'));var toCsv=require(_0x921c('0x9'));var querystring=require('querystring');var Papa=require(_0x921c('0xe'));var Redis=require(_0x921c('0xf'));var authService=require(_0x921c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x921c('0x11'));var hardwareService=require(_0x921c('0x12'));var logger=require(_0x921c('0x13'))(_0x921c('0x14'));var utils=require(_0x921c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x921c('0x16'));var db=require(_0x921c('0x17'))['db'];var dbH=require(_0x921c('0x17'))[_0x921c('0x18')];function respondWithStatusCode(_0x1a4429,_0x27e09c){_0x27e09c=_0x27e09c||0xcc;return function(_0x31d4fe){if(_0x31d4fe){return _0x1a4429[_0x921c('0x19')](_0x27e09c);}return _0x1a4429['status'](_0x27e09c)['end']();};}function respondWithResult(_0x3ef763,_0x10b5c7){_0x10b5c7=_0x10b5c7||0xc8;return function(_0x35cf21){if(_0x35cf21){return _0x3ef763['status'](_0x10b5c7)[_0x921c('0x1a')](_0x35cf21);}};}function respondWithFilteredResult(_0x1fce5e,_0xb04976){return function(_0xffb1c5){if(_0xffb1c5){var _0xbeb2ba=_0xffb1c5[_0x921c('0x1b')],_0x44f707=_0xb04976[_0x921c('0x1c')],_0x1efa0e=_0xb04976[_0x921c('0x1c')]+_0xb04976[_0x921c('0x1d')],_0x485fd5;if(_0x1efa0e>=_0xbeb2ba){_0x1efa0e=_0xbeb2ba;_0x485fd5=0xc8;}else{_0x485fd5=0xce;}_0x1fce5e['status'](_0x485fd5);return _0x1fce5e[_0x921c('0x1e')](_0x921c('0x1f'),_0x44f707+'-'+_0x1efa0e+'/'+_0xbeb2ba)['json'](_0xffb1c5);}return null;};}function patchUpdates(_0x1b10d2){return function(_0x577e9f){try{jsonpatch[_0x921c('0x20')](_0x577e9f,_0x1b10d2,!![]);}catch(_0x468873){return BPromise[_0x921c('0x21')](_0x468873);}return _0x577e9f[_0x921c('0x22')]();};}function saveUpdates(_0x4b7c2f,_0x26eb4c){return function(_0x2e9528){if(_0x2e9528){return _0x2e9528['update'](_0x4b7c2f)[_0x921c('0x23')](function(_0x3f3c93){return _0x3f3c93;});}return null;};}function removeEntity(_0x524bc3,_0xc1cbf8){return function(_0x3a8ae8){if(_0x3a8ae8){return _0x3a8ae8[_0x921c('0x24')]()[_0x921c('0x23')](function(){var _0x467145=_0x3a8ae8[_0x921c('0x25')]({'plain':!![]});var _0x1f861c=_0x921c('0x26');return db['UserProfileResource'][_0x921c('0x24')]({'where':{'type':_0x1f861c,'resourceId':_0x467145['id']}})['then'](function(){return _0x3a8ae8;});})[_0x921c('0x23')](function(){_0x524bc3[_0x921c('0x27')](0xcc)[_0x921c('0x28')]();});}};}function handleEntityNotFound(_0x4a150c,_0x4f11e5){return function(_0x4f7ce1){if(!_0x4f7ce1){_0x4a150c[_0x921c('0x19')](0x194);}return _0x4f7ce1;};}function handleError(_0x4d2258,_0x3db016){_0x3db016=_0x3db016||0x1f4;return function(_0x531da8){logger['error'](_0x531da8[_0x921c('0x29')]);if(_0x531da8[_0x921c('0x2a')]){delete _0x531da8[_0x921c('0x2a')];}_0x4d2258[_0x921c('0x27')](_0x3db016)['send'](_0x531da8);};}exports['index']=function(_0x226c28,_0x5b12a6){var _0x47af19={},_0x2397b9={},_0x3b9a22={'count':0x0,'rows':[]};var _0x3ecfa8=_[_0x921c('0x2b')](db[_0x921c('0x2c')]['rawAttributes'],function(_0x24610c){return{'name':_0x24610c['fieldName'],'type':_0x24610c[_0x921c('0x2d')][_0x921c('0x2e')]};});_0x2397b9[_0x921c('0x2f')]=_[_0x921c('0x2b')](_0x3ecfa8,_0x921c('0x2a'));_0x2397b9[_0x921c('0x30')]=_['keys'](_0x226c28['query']);_0x2397b9[_0x921c('0x31')]=_[_0x921c('0x32')](_0x2397b9[_0x921c('0x2f')],_0x2397b9[_0x921c('0x30')]);_0x47af19['attributes']=_['intersection'](_0x2397b9[_0x921c('0x2f')],qs[_0x921c('0x33')](_0x226c28[_0x921c('0x30')][_0x921c('0x33')]));_0x47af19[_0x921c('0x34')]=_0x47af19[_0x921c('0x34')][_0x921c('0x35')]?_0x47af19[_0x921c('0x34')]:_0x2397b9[_0x921c('0x2f')];if(!_0x226c28[_0x921c('0x30')]['hasOwnProperty'](_0x921c('0x36'))){_0x47af19['limit']=qs[_0x921c('0x1d')](_0x226c28['query'][_0x921c('0x1d')]);_0x47af19['offset']=qs[_0x921c('0x1c')](_0x226c28['query']['offset']);}_0x47af19['order']=qs[_0x921c('0x37')](_0x226c28['query'][_0x921c('0x37')]);_0x47af19[_0x921c('0x38')]=qs[_0x921c('0x31')](_['pick'](_0x226c28[_0x921c('0x30')],_0x2397b9['filters']),_0x3ecfa8);if(_0x226c28['query'][_0x921c('0x39')]){_0x47af19[_0x921c('0x38')]=_[_0x921c('0x3a')](_0x47af19[_0x921c('0x38')],{'$or':_[_0x921c('0x2b')](_0x3ecfa8,function(_0xb27690){if(_0xb27690['type']!==_0x921c('0x3b')){var _0x55da18={};_0x55da18[_0xb27690['name']]={'$like':'%'+_0x226c28[_0x921c('0x30')][_0x921c('0x39')]+'%'};return _0x55da18;}})});}_0x47af19=_[_0x921c('0x3a')]({},_0x47af19,_0x226c28[_0x921c('0x3c')]);var _0x464f0e={'where':_0x47af19[_0x921c('0x38')]};return db['AnalyticDefaultReport']['count'](_0x464f0e)[_0x921c('0x23')](function(_0x28de46){_0x3b9a22[_0x921c('0x1b')]=_0x28de46;if(_0x226c28[_0x921c('0x30')][_0x921c('0x3d')]){_0x47af19[_0x921c('0x3e')]=[{'all':!![]}];}return db[_0x921c('0x2c')][_0x921c('0x3f')](_0x47af19);})[_0x921c('0x23')](function(_0x44c064){_0x3b9a22['rows']=_0x44c064;return _0x3b9a22;})[_0x921c('0x23')](respondWithFilteredResult(_0x5b12a6,_0x47af19))[_0x921c('0x40')](handleError(_0x5b12a6,null));};exports['show']=function(_0x2f2553,_0x48ffad){var _0x52a103={'raw':!![],'where':{'id':_0x2f2553[_0x921c('0x41')]['id']}},_0x28f8a6={};_0x28f8a6['model']=_[_0x921c('0x42')](db[_0x921c('0x2c')][_0x921c('0x43')]);_0x28f8a6[_0x921c('0x30')]=_['keys'](_0x2f2553[_0x921c('0x30')]);_0x28f8a6[_0x921c('0x31')]=_[_0x921c('0x32')](_0x28f8a6[_0x921c('0x2f')],_0x28f8a6['query']);_0x52a103['attributes']=_[_0x921c('0x32')](_0x28f8a6[_0x921c('0x2f')],qs[_0x921c('0x33')](_0x2f2553[_0x921c('0x30')][_0x921c('0x33')]));_0x52a103['attributes']=_0x52a103[_0x921c('0x34')][_0x921c('0x35')]?_0x52a103[_0x921c('0x34')]:_0x28f8a6['model'];if(_0x2f2553[_0x921c('0x30')][_0x921c('0x3d')]){_0x52a103[_0x921c('0x3e')]=[{'all':!![]}];}_0x52a103=_[_0x921c('0x3a')]({},_0x52a103,_0x2f2553[_0x921c('0x3c')]);return db[_0x921c('0x2c')]['find'](_0x52a103)[_0x921c('0x23')](handleEntityNotFound(_0x48ffad,null))[_0x921c('0x23')](respondWithResult(_0x48ffad,null))[_0x921c('0x40')](handleError(_0x48ffad,null));};exports[_0x921c('0x44')]=function(_0x482908,_0x59572e){return db['AnalyticDefaultReport'][_0x921c('0x44')](_0x482908['body'],{})['then'](function(_0x5afe27){var _0x6623f4=_0x482908[_0x921c('0x45')][_0x921c('0x25')]({'plain':!![]});if(!_0x6623f4)throw new Error(_0x921c('0x46'));if(_0x6623f4[_0x921c('0x47')]===_0x921c('0x45')){var _0x2ea718=_0x5afe27[_0x921c('0x25')]({'plain':!![]});var _0x4a9b83=_0x921c('0x48');return db[_0x921c('0x49')][_0x921c('0x4a')]({'where':{'name':_0x4a9b83,'userProfileId':_0x6623f4[_0x921c('0x4b')]},'raw':!![]})[_0x921c('0x23')](function(_0x40e76d){if(_0x40e76d&&_0x40e76d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2ea718[_0x921c('0x2a')],'resourceId':_0x2ea718['id'],'type':'DefaultReports','sectionId':_0x40e76d['id']},{})[_0x921c('0x23')](function(){return _0x5afe27;});}else{return _0x5afe27;}})[_0x921c('0x40')](function(_0x8b024f){logger[_0x921c('0x4c')](_0x921c('0x4d'),_0x8b024f);throw _0x8b024f;});}return _0x5afe27;})[_0x921c('0x23')](respondWithResult(_0x59572e,0xc9))[_0x921c('0x40')](handleError(_0x59572e,null));};exports['update']=function(_0x53bf6b,_0x154f29){if(_0x53bf6b['body']['id']){delete _0x53bf6b['body']['id'];}return db[_0x921c('0x2c')][_0x921c('0x4a')]({'where':{'id':_0x53bf6b['params']['id']}})[_0x921c('0x23')](handleEntityNotFound(_0x154f29,null))[_0x921c('0x23')](saveUpdates(_0x53bf6b[_0x921c('0x4e')],null))[_0x921c('0x23')](respondWithResult(_0x154f29,null))[_0x921c('0x40')](handleError(_0x154f29,null));};exports[_0x921c('0x24')]=function(_0x50cf34,_0x51bfc0){return db[_0x921c('0x2c')][_0x921c('0x4a')]({'where':{'id':_0x50cf34[_0x921c('0x41')]['id']}})[_0x921c('0x23')](handleEntityNotFound(_0x51bfc0,null))['then'](removeEntity(_0x51bfc0,null))[_0x921c('0x40')](handleError(_0x51bfc0,null));};exports['preview']=function(_0x3d1765,_0x76258d){var _0x2ebdab=0xa;var _0x5e953e=['join',_0x921c('0x4f'),'right_join',_0x921c('0x50')];var _0x3236e3={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x921c('0x51'),'GROUP_CONCAT':_0x921c('0x52'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4c9e58={'SEC_TO_TIME':_0x921c('0x53'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x921c('0x54')};var _0x2993f0=function(_0x4ccce2){return!_['includes']([_0x921c('0x55'),_0x921c('0x56'),_0x921c('0x57'),_0x921c('0x58')],_0x4ccce2);};var _0x403b45=function(_0x1e13c5){if(!_0x1e13c5||!_0x1e13c5[_0x921c('0x59')][_0x921c('0x35')]){return'';}for(var _0xf0448='(',_0x21cd00=0x0;_0x21cd00<_0x1e13c5['rules'][_0x921c('0x35')];_0x21cd00+=0x1){_0x21cd00>0x0&&(_0xf0448+='\x20'+_0x1e13c5['operator']+'\x20');_0xf0448+=_0x1e13c5['rules'][_0x21cd00][_0x921c('0x5a')]?_0x403b45(_0x1e13c5['rules'][_0x21cd00][_0x921c('0x5a')]):_0x1e13c5[_0x921c('0x59')][_0x21cd00][_0x921c('0x5b')]+'\x20'+_0x1e13c5[_0x921c('0x59')][_0x21cd00][_0x921c('0x5c')]+(_0x2993f0(_0x1e13c5['rules'][_0x21cd00][_0x921c('0x5c')])?'\x20'+_0x1e13c5[_0x921c('0x59')][_0x21cd00][_0x921c('0x5d')]:'');}return _0xf0448+')';};var _0x38dfd1={'where':{'id':_0x3d1765[_0x921c('0x41')]['id']}},_0x1e42b9,_0x27d2be,_0xa5ff7b,_0x301872,_0x4521d6;_0x38dfd1=_[_0x921c('0x3a')]({},_0x38dfd1,_0x3d1765[_0x921c('0x3c')]);return db[_0x921c('0x2c')][_0x921c('0x4a')](_0x38dfd1)['then'](function(_0x3113b1){if(_0x3113b1){_0x1e42b9=_0x3113b1;return _0x3113b1[_0x921c('0x5e')]();}return null;})[_0x921c('0x23')](function(_0x2b50e9){if(_0x2b50e9){if(!_0x2b50e9[_0x921c('0x35')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x27d2be=_0x2b50e9;return db[_0x921c('0x5f')]['findAll']({'raw':!![]});}return null;})[_0x921c('0x23')](function(_0x5dce6b){if(_0x5dce6b){_0xa5ff7b=_[_0x921c('0x60')](_0x5dce6b,'id');var _0x4a7116;var _0xf8c0fd=squel['select']();_0xf8c0fd['from'](_0x1e42b9[_0x921c('0x61')]);for(var _0x127144=0x0;_0x127144<_0x27d2be[_0x921c('0x35')];_0x127144+=0x1){_0x4a7116=_0x27d2be[_0x127144][_0x921c('0x62')]?_0xa5ff7b[_0x27d2be[_0x127144][_0x921c('0x62')]][_0x921c('0x63')]:_0x27d2be[_0x127144]['field'];_0x4a7116=_0x27d2be[_0x127144][_0x921c('0x64')]?_[_0x921c('0x65')](_0x3236e3[_0x27d2be[_0x127144][_0x921c('0x64')]],'%s',_0x4a7116):_0x4a7116;_0x4a7116=_0x27d2be[_0x127144]['format']?_[_0x921c('0x65')](_0x4c9e58[_0x27d2be[_0x127144]['format']],'%s',_0x4a7116):_0x4a7116;if(_0x27d2be[_0x127144]['groupBy']){_0xf8c0fd['group'](_0x4a7116);}_0x27d2be[_0x127144][_0x921c('0x66')]&&_0xf8c0fd[_0x921c('0x67')](_0x4a7116,_0x27d2be[_0x127144][_0x921c('0x66')]===_0x921c('0x68')?![]:!![]);_0xf8c0fd[_0x921c('0x5b')](_0x4a7116,_0x27d2be[_0x127144][_0x921c('0x69')]||_0x4a7116);}if(_0x1e42b9[_0x921c('0x6a')]){_0x1e42b9['joins']=JSON[_0x921c('0x6b')](_0x1e42b9[_0x921c('0x6a')]);for(var _0x1d9914=0x0;_0x1d9914<_0x1e42b9[_0x921c('0x6a')]['length'];_0x1d9914+=0x1){if(_0x1e42b9['joins'][_0x1d9914][_0x921c('0x2d')]&&_[_0x921c('0x6c')](_0x5e953e,_0x1e42b9[_0x921c('0x6a')][_0x1d9914][_0x921c('0x2d')])&&_0x1e42b9[_0x921c('0x6a')][_0x1d9914]['parentKey']&&_0x1e42b9[_0x921c('0x6a')][_0x1d9914][_0x921c('0x6d')]&&_0x1e42b9[_0x921c('0x6a')][_0x1d9914][_0x921c('0x6e')]){_0xf8c0fd[_0x1e42b9[_0x921c('0x6a')][_0x1d9914][_0x921c('0x2d')]](_0x1e42b9[_0x921c('0x6a')][_0x1d9914][_0x921c('0x6d')],null,util[_0x921c('0x6f')]('%s.%s\x20=\x20%s.%s',_0x1e42b9[_0x921c('0x61')],_0x1e42b9[_0x921c('0x6a')][_0x1d9914][_0x921c('0x70')],_0x1e42b9[_0x921c('0x6a')][_0x1d9914]['foreignTable'],_0x1e42b9[_0x921c('0x6a')][_0x1d9914][_0x921c('0x6e')]));}}}if(_0x1e42b9[_0x921c('0x71')]){_0x1e42b9['conditions']=JSON[_0x921c('0x6b')](_0x1e42b9[_0x921c('0x71')]);_0xf8c0fd['where'](_0x403b45(_0x1e42b9['conditions'][_0x921c('0x5a')]));}_0x4521d6=_0xf8c0fd[_0x921c('0x72')]();_0xf8c0fd[_0x921c('0x1d')](_0x2ebdab);_0xf8c0fd['offset'](0x0);logger[_0x921c('0x73')]('Limited\x20Query:',_0xf8c0fd['toString']());return dbH[_0x921c('0x74')]['query'](_0xf8c0fd['toString'](),{'type':dbH['sequelize'][_0x921c('0x75')]['SELECT']});}})[_0x921c('0x23')](respondWithResult(_0x76258d,null))[_0x921c('0x40')](handleError(_0x76258d,null));};function runReport(_0x58087a,_0x333908,_0x29b4dc){var _0x383994=_0x333908['name'];var _0x299295=0xa;var _0x25b484=[_0x921c('0x76'),'left_join',_0x921c('0x77'),_0x921c('0x50')];var _0x1a58ea={'SUM':_0x921c('0x78'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x921c('0x79'),'MAX':_0x921c('0x7a'),'MIN':_0x921c('0x7b'),'AVG':_0x921c('0x51'),'GROUP_CONCAT':_0x921c('0x52'),'GROUP_CONCAT ASC':_0x921c('0x7c'),'GROUP_CONCAT DESC':_0x921c('0x7d')};var _0x11e3b6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x921c('0x7e'),'HOUR':'HOUR(%s)','ROUND':_0x921c('0x7f'),'UNIX_TIMESTAMP':_0x921c('0x54')};var _0x22ec19=function(_0x10882c){return!_[_0x921c('0x6c')]([_0x921c('0x55'),_0x921c('0x56'),_0x921c('0x57'),_0x921c('0x58')],_0x10882c);};var _0x56d977=function(_0x1939c8){if(!_0x1939c8||!_0x1939c8['rules'][_0x921c('0x35')]){return'';}for(var _0x2e2c58='(',_0x3a8d58=0x0;_0x3a8d58<_0x1939c8['rules']['length'];_0x3a8d58+=0x1){_0x3a8d58>0x0&&(_0x2e2c58+='\x20'+_0x1939c8[_0x921c('0x80')]+'\x20');_0x2e2c58+=_0x1939c8[_0x921c('0x59')][_0x3a8d58]['group']?_0x56d977(_0x1939c8[_0x921c('0x59')][_0x3a8d58][_0x921c('0x5a')]):_0x1939c8['rules'][_0x3a8d58][_0x921c('0x5b')]+'\x20'+_0x1939c8['rules'][_0x3a8d58][_0x921c('0x5c')]+(_0x22ec19(_0x1939c8[_0x921c('0x59')][_0x3a8d58][_0x921c('0x5c')])?'\x20'+_0x1939c8[_0x921c('0x59')][_0x3a8d58][_0x921c('0x5d')]:'');}return _0x2e2c58+')';};var _0x468d8b={'where':{'id':_0x58087a['id']}},_0x478767,_0xa5839b,_0x501d51,_0x1eb65d,_0x30a05c;_0x468d8b=_['merge']({},_0x468d8b,_0x29b4dc);return db[_0x921c('0x2c')][_0x921c('0x4a')](_0x468d8b)[_0x921c('0x23')](function(_0x58bfb5){if(_0x58bfb5){_0x478767=_0x58bfb5;return _0x58bfb5[_0x921c('0x5e')]();}return null;})[_0x921c('0x23')](function(_0x3df4e6){if(_0x3df4e6){if(!_0x3df4e6[_0x921c('0x35')]){throw new db[(_0x921c('0x81'))]['ValidationErrorItem'](_0x921c('0x82'),0x193);}_0xa5839b=_0x3df4e6;return db[_0x921c('0x5f')][_0x921c('0x3f')]({'raw':!![]});}return null;})[_0x921c('0x23')](function(_0x962b89){if(_0x962b89){_0x501d51=_[_0x921c('0x60')](_0x962b89,'id');var _0x300842;var _0x256272=squel['select']();_0x256272['from'](_0x478767[_0x921c('0x61')]);for(var _0x4bd85d=0x0;_0x4bd85d<_0xa5839b[_0x921c('0x35')];_0x4bd85d+=0x1){_0x300842=_0xa5839b[_0x4bd85d][_0x921c('0x62')]?_0x501d51[_0xa5839b[_0x4bd85d][_0x921c('0x62')]][_0x921c('0x63')]:_0xa5839b[_0x4bd85d][_0x921c('0x5b')];_0x300842=_0xa5839b[_0x4bd85d][_0x921c('0x64')]?_[_0x921c('0x65')](_0x1a58ea[_0xa5839b[_0x4bd85d]['function']],'%s',_0x300842):_0x300842;_0x300842=_0xa5839b[_0x4bd85d][_0x921c('0x6f')]?_[_0x921c('0x65')](_0x11e3b6[_0xa5839b[_0x4bd85d][_0x921c('0x6f')]],'%s',_0x300842):_0x300842;if(_0xa5839b[_0x4bd85d]['groupBy']){_0x256272[_0x921c('0x5a')](_0x300842);}_0xa5839b[_0x4bd85d][_0x921c('0x66')]&&_0x256272[_0x921c('0x67')](_0x300842,_0xa5839b[_0x4bd85d][_0x921c('0x66')]===_0x921c('0x68')?![]:!![]);_0x256272[_0x921c('0x5b')](_0x300842,_0xa5839b[_0x4bd85d][_0x921c('0x69')]||_0x300842);}if(_0x478767[_0x921c('0x6a')]){_0x478767[_0x921c('0x6a')]=JSON['parse'](_0x478767['joins']);for(var _0x18920f=0x0;_0x18920f<_0x478767[_0x921c('0x6a')]['length'];_0x18920f+=0x1){if(_0x478767[_0x921c('0x6a')][_0x18920f][_0x921c('0x2d')]&&_[_0x921c('0x6c')](_0x25b484,_0x478767[_0x921c('0x6a')][_0x18920f][_0x921c('0x2d')])&&_0x478767[_0x921c('0x6a')][_0x18920f][_0x921c('0x70')]&&_0x478767[_0x921c('0x6a')][_0x18920f][_0x921c('0x6d')]&&_0x478767[_0x921c('0x6a')][_0x18920f]['foreignKey']){_0x256272[_0x478767[_0x921c('0x6a')][_0x18920f]['type']](_0x478767[_0x921c('0x6a')][_0x18920f][_0x921c('0x6d')],null,util[_0x921c('0x6f')](_0x921c('0x83'),_0x478767[_0x921c('0x61')],_0x478767[_0x921c('0x6a')][_0x18920f][_0x921c('0x70')],_0x478767[_0x921c('0x6a')][_0x18920f]['foreignTable'],_0x478767[_0x921c('0x6a')][_0x18920f][_0x921c('0x6e')]));}}}if(_0x478767[_0x921c('0x71')]){_0x478767[_0x921c('0x71')]=JSON[_0x921c('0x6b')](_0x478767[_0x921c('0x71')]);_0x256272[_0x921c('0x38')](_0x56d977(_0x478767[_0x921c('0x71')][_0x921c('0x5a')]));}_0x30a05c=_0x256272['clone']();_0x256272[_0x921c('0x1d')](_0x299295);_0x256272['offset'](0x0);return;}})[_0x921c('0x23')](function(){if(_0x333908[_0x921c('0x84')]===_0x921c('0x85')){return null;}var _0x4f5d55=_['merge'](_0x333908,{'name':_0x333908['fullPath']||_0x333908[_0x921c('0x2a')]||_0x478767['name'],'basename':_0x383994,'savename':util[_0x921c('0x6f')](_0x921c('0x86'),_0x333908['name']||_0x478767['name'],require(_0x921c('0x87'))[_0x921c('0x88')](0x4),_0x333908[_0x921c('0x84')]||'csv'),'reportId':_0x478767['id'],'reportType':_0x921c('0x89')});return db['AnalyticExtractedReport']['create'](_0x4f5d55,{'raw':!![]});})[_0x921c('0x23')](function(_0x3b646f){if(_0x478767[_0x921c('0x61')]===_0x921c('0x8a')){_0x30a05c[_0x921c('0x38')](_0x478767[_0x921c('0x61')]+_0x921c('0x8b'),_0x333908[_0x921c('0x8c')],_0x333908[_0x921c('0x8d')]);}else{_0x30a05c['where'](_0x478767[_0x921c('0x61')]+_0x921c('0x8e'),_0x333908['startDate'],_0x333908[_0x921c('0x8d')]);}if(_0x3b646f){logger['info']('Run\x20Query:',_0x30a05c[_0x921c('0x8f')]());require(_0x921c('0x90'))['fork'](path[_0x921c('0x76')](__dirname,_0x921c('0x91'),_0x3b646f[_0x921c('0x84')]),[_0x3b646f['id'],_0x30a05c['toString'](),path[_0x921c('0x76')](__dirname,'../../files/reports',_0x3b646f[_0x921c('0x92')]),_0x383994]);return _0x3b646f;}else{var _0xb08f=squel[_0x921c('0x93')]();_0xb08f[_0x921c('0x94')]('('+_0x30a05c[_0x921c('0x8f')]()+')',_0x921c('0x95'));_0xb08f[_0x921c('0x5b')]('COUNT(*)',_0x921c('0x1b'));_0x30a05c['limit'](_0x333908[_0x921c('0x1d')]||_0x299295);_0x30a05c[_0x921c('0x1c')](_0x333908['offset']||0x0);return dbH[_0x921c('0x74')]['query'](_0xb08f[_0x921c('0x8f')](),{'type':dbH[_0x921c('0x74')]['QueryTypes']['SELECT']})[_0x921c('0x23')](function(_0x307e84){if(!_0x307e84['length']){_0x1eb65d=0x0;}else{_0x1eb65d=_0x307e84[0x0][_0x921c('0x1b')]||0x0;}return dbH[_0x921c('0x74')][_0x921c('0x30')](_0x30a05c[_0x921c('0x8f')](),{'type':dbH[_0x921c('0x74')][_0x921c('0x75')]['SELECT']});})[_0x921c('0x23')](function(_0x51a84f){return{'rows':_0x51a84f||[],'count':_0x1eb65d};});}});}exports[_0x921c('0x96')]=function(_0x25cab8,_0x1a676c){return runReport(_0x25cab8['params'],_0x25cab8[_0x921c('0x30')],_0x25cab8['options'])[_0x921c('0x23')](respondWithResult(_0x1a676c,null))[_0x921c('0x40')](handleError(_0x1a676c,null));};exports[_0x921c('0x97')]=runReport;exports[_0x921c('0x30')]=function(_0x2301b6,_0x1ef4a7){var _0x20a90a=0xa;var _0x1c9f12=['join',_0x921c('0x4f'),_0x921c('0x77'),_0x921c('0x50')];var _0x19ae39={'SUM':'SUM(%s)','COUNT':_0x921c('0x98'),'COUNT DISTINCT':_0x921c('0x79'),'MAX':_0x921c('0x7a'),'MIN':_0x921c('0x7b'),'AVG':_0x921c('0x51'),'GROUP_CONCAT':_0x921c('0x52'),'GROUP_CONCAT ASC':_0x921c('0x7c'),'GROUP_CONCAT DESC':_0x921c('0x7d')};var _0x1a0d2d={'SEC_TO_TIME':_0x921c('0x53'),'DATE':_0x921c('0x7e'),'HOUR':'HOUR(%s)','ROUND':_0x921c('0x7f'),'UNIX_TIMESTAMP':_0x921c('0x54')};var _0x1d0524=function(_0xe7f44a){return!_[_0x921c('0x6c')]([_0x921c('0x55'),_0x921c('0x56'),_0x921c('0x57'),_0x921c('0x58')],_0xe7f44a);};var _0x599572=function(_0x5a08f4){if(!_0x5a08f4||!_0x5a08f4[_0x921c('0x59')][_0x921c('0x35')]){return'';}for(var _0x15c2d1='(',_0x4955fa=0x0;_0x4955fa<_0x5a08f4['rules'][_0x921c('0x35')];_0x4955fa+=0x1){_0x4955fa>0x0&&(_0x15c2d1+='\x20'+_0x5a08f4['operator']+'\x20');_0x15c2d1+=_0x5a08f4[_0x921c('0x59')][_0x4955fa][_0x921c('0x5a')]?_0x599572(_0x5a08f4[_0x921c('0x59')][_0x4955fa][_0x921c('0x5a')]):_0x5a08f4['rules'][_0x4955fa][_0x921c('0x5b')]+'\x20'+_0x5a08f4[_0x921c('0x59')][_0x4955fa][_0x921c('0x5c')]+(_0x1d0524(_0x5a08f4['rules'][_0x4955fa][_0x921c('0x5c')])?'\x20'+_0x5a08f4[_0x921c('0x59')][_0x4955fa]['value']:'');}return _0x15c2d1+')';};var _0x317570={'where':{'id':_0x2301b6['params']['id']}},_0x4f8ffd,_0x166cb0,_0x436fee,_0x13be6e,_0x7bf312;_0x317570=_[_0x921c('0x3a')]({},_0x317570,_0x2301b6[_0x921c('0x3c')]);return db[_0x921c('0x2c')]['find'](_0x317570)['then'](function(_0x1b3c0e){if(_0x1b3c0e){_0x4f8ffd=_0x1b3c0e;return _0x1b3c0e['getFields']();}return null;})[_0x921c('0x23')](function(_0x6961fb){if(_0x6961fb){if(!_0x6961fb[_0x921c('0x35')]){throw new db['Sequelize'][(_0x921c('0x99'))](_0x921c('0x82'),0x193);}_0x166cb0=_0x6961fb;return db[_0x921c('0x5f')][_0x921c('0x3f')]({'raw':!![]});}return null;})[_0x921c('0x23')](function(_0x35de0e){if(_0x35de0e){_0x436fee=_[_0x921c('0x60')](_0x35de0e,'id');var _0x428cb7;var _0x33b455=squel[_0x921c('0x93')]();_0x33b455[_0x921c('0x94')](_0x4f8ffd['table']);for(var _0x41b98f=0x0;_0x41b98f<_0x166cb0['length'];_0x41b98f+=0x1){_0x428cb7=_0x166cb0[_0x41b98f][_0x921c('0x62')]?_0x436fee[_0x166cb0[_0x41b98f][_0x921c('0x62')]][_0x921c('0x63')]:_0x166cb0[_0x41b98f][_0x921c('0x5b')];_0x428cb7=_0x166cb0[_0x41b98f]['function']?_['replace'](_0x19ae39[_0x166cb0[_0x41b98f][_0x921c('0x64')]],'%s',_0x428cb7):_0x428cb7;_0x428cb7=_0x166cb0[_0x41b98f]['format']?_[_0x921c('0x65')](_0x1a0d2d[_0x166cb0[_0x41b98f][_0x921c('0x6f')]],'%s',_0x428cb7):_0x428cb7;if(_0x166cb0[_0x41b98f][_0x921c('0x9a')]){_0x33b455[_0x921c('0x5a')](_0x428cb7);}_0x166cb0[_0x41b98f][_0x921c('0x66')]&&_0x33b455['order'](_0x428cb7,_0x166cb0[_0x41b98f][_0x921c('0x66')]==='DESC'?![]:!![]);_0x33b455[_0x921c('0x5b')](_0x428cb7,_0x166cb0[_0x41b98f][_0x921c('0x69')]||_0x428cb7);}if(_0x4f8ffd['joins']){_0x4f8ffd['joins']=JSON[_0x921c('0x6b')](_0x4f8ffd[_0x921c('0x6a')]);for(var _0x102a47=0x0;_0x102a47<_0x4f8ffd[_0x921c('0x6a')][_0x921c('0x35')];_0x102a47+=0x1){if(_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x2d')]&&_[_0x921c('0x6c')](_0x1c9f12,_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x2d')])&&_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x70')]&&_0x4f8ffd['joins'][_0x102a47]['foreignTable']&&_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x6e')]){_0x33b455[_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x2d')]](_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x6d')],null,util[_0x921c('0x6f')](_0x921c('0x83'),_0x4f8ffd['table'],_0x4f8ffd['joins'][_0x102a47]['parentKey'],_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x6d')],_0x4f8ffd[_0x921c('0x6a')][_0x102a47][_0x921c('0x6e')]));}}}if(_0x4f8ffd[_0x921c('0x71')]){_0x4f8ffd[_0x921c('0x71')]=JSON[_0x921c('0x6b')](_0x4f8ffd['conditions']);_0x33b455[_0x921c('0x38')](_0x599572(_0x4f8ffd['conditions'][_0x921c('0x5a')]));}_0x7bf312=_0x33b455[_0x921c('0x72')]();_0x33b455[_0x921c('0x1d')](_0x20a90a);_0x33b455[_0x921c('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x33b455['toString']());return dbH[_0x921c('0x74')][_0x921c('0x30')](_0x33b455[_0x921c('0x8f')](),{'type':dbH['sequelize']['QueryTypes'][_0x921c('0x9b')]});}})[_0x921c('0x23')](function(){return{'sql':_0x7bf312[_0x921c('0x8f')]()};})[_0x921c('0x23')](respondWithResult(_0x1ef4a7,null))[_0x921c('0x40')](handleError(_0x1ef4a7,null));}; \ No newline at end of file +var _0x3a31=['csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','SELECT','QueryTypes','right_join','IS\x20EMPTY','debug','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','DefaultReports','UserProfileResource','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','findAll','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','Limited\x20Query:','sequelize','toString','SUM(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','DESC','output','web','%s-%s.%s','generate'];(function(_0x45d57c,_0x3416cb){var _0x431bdc=function(_0x44fb81){while(--_0x44fb81){_0x45d57c['push'](_0x45d57c['shift']());}};_0x431bdc(++_0x3416cb);}(_0x3a31,0xb9));var _0x13a3=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3a31[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x13a3('0x0'));var emlformat=require(_0x13a3('0x1'));var rimraf=require(_0x13a3('0x2'));var zipdir=require(_0x13a3('0x3'));var jsonpatch=require(_0x13a3('0x4'));var rp=require(_0x13a3('0x5'));var moment=require(_0x13a3('0x6'));var BPromise=require(_0x13a3('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x13a3('0x8'));var sox=require(_0x13a3('0x9'));var csv=require(_0x13a3('0xa'));var ejs=require(_0x13a3('0xb'));var fs=require('fs');var _=require(_0x13a3('0xc'));var squel=require(_0x13a3('0xd'));var crypto=require('crypto');var jsforce=require(_0x13a3('0xe'));var deskjs=require(_0x13a3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x13a3('0x10'));var Papa=require(_0x13a3('0x11'));var Redis=require(_0x13a3('0x12'));var authService=require(_0x13a3('0x13'));var qs=require(_0x13a3('0x14'));var as=require(_0x13a3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13a3('0x16'))('api');var utils=require(_0x13a3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x13a3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x13a3('0x19'))[_0x13a3('0x1a')];function respondWithStatusCode(_0x222e74,_0x154c74){_0x154c74=_0x154c74||0xcc;return function(_0x336862){if(_0x336862){return _0x222e74[_0x13a3('0x1b')](_0x154c74);}return _0x222e74[_0x13a3('0x1c')](_0x154c74)[_0x13a3('0x1d')]();};}function respondWithResult(_0x116461,_0x44dcf4){_0x44dcf4=_0x44dcf4||0xc8;return function(_0xfdaafc){if(_0xfdaafc){return _0x116461[_0x13a3('0x1c')](_0x44dcf4)['json'](_0xfdaafc);}};}function respondWithFilteredResult(_0x138ded,_0x54af64){return function(_0x3d699a){if(_0x3d699a){var _0x2fc126=_0x3d699a[_0x13a3('0x1e')],_0x51be17=_0x54af64[_0x13a3('0x1f')],_0x8faa8b=_0x54af64[_0x13a3('0x1f')]+_0x54af64['limit'],_0xf1cdc0;if(_0x8faa8b>=_0x2fc126){_0x8faa8b=_0x2fc126;_0xf1cdc0=0xc8;}else{_0xf1cdc0=0xce;}_0x138ded['status'](_0xf1cdc0);return _0x138ded[_0x13a3('0x20')](_0x13a3('0x21'),_0x51be17+'-'+_0x8faa8b+'/'+_0x2fc126)['json'](_0x3d699a);}return null;};}function patchUpdates(_0x3ce3bb){return function(_0x1ea253){try{jsonpatch[_0x13a3('0x22')](_0x1ea253,_0x3ce3bb,!![]);}catch(_0x2d63c9){return BPromise[_0x13a3('0x23')](_0x2d63c9);}return _0x1ea253[_0x13a3('0x24')]();};}function saveUpdates(_0x1b60d1,_0x3a8431){return function(_0x28c89b){if(_0x28c89b){return _0x28c89b[_0x13a3('0x25')](_0x1b60d1)['then'](function(_0x424523){return _0x424523;});}return null;};}function removeEntity(_0x2aedc7,_0xfca6f7){return function(_0xdc9258){if(_0xdc9258){return _0xdc9258[_0x13a3('0x26')]()[_0x13a3('0x27')](function(){var _0x577101=_0xdc9258['get']({'plain':!![]});var _0x8a6183=_0x13a3('0x28');return db[_0x13a3('0x29')]['destroy']({'where':{'type':_0x8a6183,'resourceId':_0x577101['id']}})[_0x13a3('0x27')](function(){return _0xdc9258;});})['then'](function(){_0x2aedc7[_0x13a3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe1b026,_0xda55c1){return function(_0x49c591){if(!_0x49c591){_0xe1b026[_0x13a3('0x1b')](0x194);}return _0x49c591;};}function handleError(_0xeb4992,_0x4aaac5){_0x4aaac5=_0x4aaac5||0x1f4;return function(_0x2064e7){logger['error'](_0x2064e7[_0x13a3('0x2a')]);if(_0x2064e7[_0x13a3('0x2b')]){delete _0x2064e7[_0x13a3('0x2b')];}_0xeb4992['status'](_0x4aaac5)[_0x13a3('0x2c')](_0x2064e7);};}exports[_0x13a3('0x2d')]=function(_0x104e58,_0x34af53){var _0x19964b={},_0x5abace={},_0x38ae56={'count':0x0,'rows':[]};var _0x3f73cf=_[_0x13a3('0x2e')](db[_0x13a3('0x2f')][_0x13a3('0x30')],function(_0x3735f9){return{'name':_0x3735f9[_0x13a3('0x31')],'type':_0x3735f9[_0x13a3('0x32')][_0x13a3('0x33')]};});_0x5abace[_0x13a3('0x34')]=_[_0x13a3('0x2e')](_0x3f73cf,'name');_0x5abace[_0x13a3('0x35')]=_[_0x13a3('0x36')](_0x104e58[_0x13a3('0x35')]);_0x5abace[_0x13a3('0x37')]=_[_0x13a3('0x38')](_0x5abace[_0x13a3('0x34')],_0x5abace[_0x13a3('0x35')]);_0x19964b[_0x13a3('0x39')]=_['intersection'](_0x5abace[_0x13a3('0x34')],qs[_0x13a3('0x3a')](_0x104e58[_0x13a3('0x35')][_0x13a3('0x3a')]));_0x19964b[_0x13a3('0x39')]=_0x19964b[_0x13a3('0x39')][_0x13a3('0x3b')]?_0x19964b[_0x13a3('0x39')]:_0x5abace[_0x13a3('0x34')];if(!_0x104e58['query'][_0x13a3('0x3c')](_0x13a3('0x3d'))){_0x19964b[_0x13a3('0x3e')]=qs[_0x13a3('0x3e')](_0x104e58[_0x13a3('0x35')][_0x13a3('0x3e')]);_0x19964b[_0x13a3('0x1f')]=qs[_0x13a3('0x1f')](_0x104e58[_0x13a3('0x35')][_0x13a3('0x1f')]);}_0x19964b[_0x13a3('0x3f')]=qs[_0x13a3('0x40')](_0x104e58[_0x13a3('0x35')][_0x13a3('0x40')]);_0x19964b[_0x13a3('0x41')]=qs['filters'](_[_0x13a3('0x42')](_0x104e58[_0x13a3('0x35')],_0x5abace['filters']),_0x3f73cf);if(_0x104e58[_0x13a3('0x35')][_0x13a3('0x43')]){_0x19964b[_0x13a3('0x41')]=_[_0x13a3('0x44')](_0x19964b['where'],{'$or':_[_0x13a3('0x2e')](_0x3f73cf,function(_0x5c4528){if(_0x5c4528[_0x13a3('0x32')]!=='VIRTUAL'){var _0x493bb9={};_0x493bb9[_0x5c4528[_0x13a3('0x2b')]]={'$like':'%'+_0x104e58['query'][_0x13a3('0x43')]+'%'};return _0x493bb9;}})});}_0x19964b=_[_0x13a3('0x44')]({},_0x19964b,_0x104e58['options']);var _0x37468d={'where':_0x19964b[_0x13a3('0x41')]};return db['AnalyticDefaultReport']['count'](_0x37468d)[_0x13a3('0x27')](function(_0x10b451){_0x38ae56[_0x13a3('0x1e')]=_0x10b451;if(_0x104e58[_0x13a3('0x35')][_0x13a3('0x45')]){_0x19964b[_0x13a3('0x46')]=[{'all':!![]}];}return db[_0x13a3('0x2f')]['findAll'](_0x19964b);})[_0x13a3('0x27')](function(_0x18b7e4){_0x38ae56[_0x13a3('0x47')]=_0x18b7e4;return _0x38ae56;})[_0x13a3('0x27')](respondWithFilteredResult(_0x34af53,_0x19964b))[_0x13a3('0x48')](handleError(_0x34af53,null));};exports['show']=function(_0x245a45,_0x406053){var _0x19ca1b={'raw':!![],'where':{'id':_0x245a45['params']['id']}},_0x38b6bc={};_0x38b6bc[_0x13a3('0x34')]=_[_0x13a3('0x36')](db[_0x13a3('0x2f')]['rawAttributes']);_0x38b6bc[_0x13a3('0x35')]=_['keys'](_0x245a45[_0x13a3('0x35')]);_0x38b6bc[_0x13a3('0x37')]=_[_0x13a3('0x38')](_0x38b6bc['model'],_0x38b6bc[_0x13a3('0x35')]);_0x19ca1b[_0x13a3('0x39')]=_[_0x13a3('0x38')](_0x38b6bc['model'],qs[_0x13a3('0x3a')](_0x245a45[_0x13a3('0x35')]['fields']));_0x19ca1b['attributes']=_0x19ca1b[_0x13a3('0x39')][_0x13a3('0x3b')]?_0x19ca1b[_0x13a3('0x39')]:_0x38b6bc[_0x13a3('0x34')];if(_0x245a45[_0x13a3('0x35')][_0x13a3('0x45')]){_0x19ca1b[_0x13a3('0x46')]=[{'all':!![]}];}_0x19ca1b=_['merge']({},_0x19ca1b,_0x245a45[_0x13a3('0x49')]);return db[_0x13a3('0x2f')][_0x13a3('0x4a')](_0x19ca1b)['then'](handleEntityNotFound(_0x406053,null))[_0x13a3('0x27')](respondWithResult(_0x406053,null))[_0x13a3('0x48')](handleError(_0x406053,null));};exports[_0x13a3('0x4b')]=function(_0x59f503,_0x274b4b){return db[_0x13a3('0x2f')]['create'](_0x59f503[_0x13a3('0x4c')],{})[_0x13a3('0x27')](function(_0x244b51){var _0x37188c=_0x59f503[_0x13a3('0x4d')][_0x13a3('0x4e')]({'plain':!![]});if(!_0x37188c)throw new Error(_0x13a3('0x4f'));if(_0x37188c[_0x13a3('0x50')]==='user'){var _0x5b19f3=_0x244b51[_0x13a3('0x4e')]({'plain':!![]});var _0x2463a6='Reports';return db[_0x13a3('0x51')][_0x13a3('0x4a')]({'where':{'name':_0x2463a6,'userProfileId':_0x37188c[_0x13a3('0x52')]},'raw':!![]})[_0x13a3('0x27')](function(_0x5a9e7f){if(_0x5a9e7f&&_0x5a9e7f[_0x13a3('0x53')]===0x0){return db[_0x13a3('0x29')]['create']({'name':_0x5b19f3[_0x13a3('0x2b')],'resourceId':_0x5b19f3['id'],'type':_0x13a3('0x28'),'sectionId':_0x5a9e7f['id']},{})[_0x13a3('0x27')](function(){return _0x244b51;});}else{return _0x244b51;}})[_0x13a3('0x48')](function(_0x50fb82){logger['error'](_0x13a3('0x54'),_0x50fb82);throw _0x50fb82;});}return _0x244b51;})[_0x13a3('0x27')](respondWithResult(_0x274b4b,0xc9))['catch'](handleError(_0x274b4b,null));};exports[_0x13a3('0x25')]=function(_0xc8d156,_0x54d834){if(_0xc8d156[_0x13a3('0x4c')]['id']){delete _0xc8d156[_0x13a3('0x4c')]['id'];}return db[_0x13a3('0x2f')][_0x13a3('0x4a')]({'where':{'id':_0xc8d156[_0x13a3('0x55')]['id']}})[_0x13a3('0x27')](handleEntityNotFound(_0x54d834,null))[_0x13a3('0x27')](saveUpdates(_0xc8d156[_0x13a3('0x4c')],null))[_0x13a3('0x27')](respondWithResult(_0x54d834,null))['catch'](handleError(_0x54d834,null));};exports[_0x13a3('0x26')]=function(_0x331f92,_0x400f1d){return db[_0x13a3('0x2f')][_0x13a3('0x4a')]({'where':{'id':_0x331f92[_0x13a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x400f1d,null))['then'](removeEntity(_0x400f1d,null))[_0x13a3('0x48')](handleError(_0x400f1d,null));};exports['preview']=function(_0x491e14,_0x2a97ae){var _0x97db43=0xa;var _0x3122e7=[_0x13a3('0x56'),_0x13a3('0x57'),'right_join',_0x13a3('0x58')];var _0x5e40a1={'SUM':'SUM(%s)','COUNT':_0x13a3('0x59'),'COUNT DISTINCT':_0x13a3('0x5a'),'MAX':'MAX(%s)','MIN':_0x13a3('0x5b'),'AVG':_0x13a3('0x5c'),'GROUP_CONCAT':_0x13a3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x13a3('0x5e')};var _0x143187={'SEC_TO_TIME':_0x13a3('0x5f'),'DATE':_0x13a3('0x60'),'HOUR':_0x13a3('0x61'),'ROUND':_0x13a3('0x62'),'UNIX_TIMESTAMP':_0x13a3('0x63')};var _0x10797b=function(_0x556a85){return!_[_0x13a3('0x64')](['IS\x20NULL',_0x13a3('0x65'),'IS\x20EMPTY',_0x13a3('0x66')],_0x556a85);};var _0x108760=function(_0x3bcabd){if(!_0x3bcabd||!_0x3bcabd[_0x13a3('0x67')][_0x13a3('0x3b')]){return'';}for(var _0x3e9aa2='(',_0x573bfb=0x0;_0x573bfb<_0x3bcabd[_0x13a3('0x67')][_0x13a3('0x3b')];_0x573bfb+=0x1){_0x573bfb>0x0&&(_0x3e9aa2+='\x20'+_0x3bcabd[_0x13a3('0x68')]+'\x20');_0x3e9aa2+=_0x3bcabd[_0x13a3('0x67')][_0x573bfb][_0x13a3('0x69')]?_0x108760(_0x3bcabd[_0x13a3('0x67')][_0x573bfb][_0x13a3('0x69')]):_0x3bcabd['rules'][_0x573bfb][_0x13a3('0x6a')]+'\x20'+_0x3bcabd[_0x13a3('0x67')][_0x573bfb][_0x13a3('0x6b')]+(_0x10797b(_0x3bcabd[_0x13a3('0x67')][_0x573bfb][_0x13a3('0x6b')])?'\x20'+_0x3bcabd[_0x13a3('0x67')][_0x573bfb][_0x13a3('0x6c')]:'');}return _0x3e9aa2+')';};var _0x132276={'where':{'id':_0x491e14[_0x13a3('0x55')]['id']}},_0x558183,_0x427d7a,_0x1b27f3,_0x8eaac,_0x526529;_0x132276=_[_0x13a3('0x44')]({},_0x132276,_0x491e14[_0x13a3('0x49')]);return db[_0x13a3('0x2f')][_0x13a3('0x4a')](_0x132276)[_0x13a3('0x27')](function(_0x19b57c){if(_0x19b57c){_0x558183=_0x19b57c;return _0x19b57c[_0x13a3('0x6d')]();}return null;})[_0x13a3('0x27')](function(_0x2fb8a4){if(_0x2fb8a4){if(!_0x2fb8a4[_0x13a3('0x3b')]){throw new db[(_0x13a3('0x6e'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x427d7a=_0x2fb8a4;return db['AnalyticMetric'][_0x13a3('0x6f')]({'raw':!![]});}return null;})[_0x13a3('0x27')](function(_0xb25d6b){if(_0xb25d6b){_0x1b27f3=_['keyBy'](_0xb25d6b,'id');var _0x2f5483;var _0x28077d=squel[_0x13a3('0x70')]();_0x28077d[_0x13a3('0x71')](_0x558183['table']);for(var _0x33864c=0x0;_0x33864c<_0x427d7a[_0x13a3('0x3b')];_0x33864c+=0x1){_0x2f5483=_0x427d7a[_0x33864c][_0x13a3('0x72')]?_0x1b27f3[_0x427d7a[_0x33864c][_0x13a3('0x72')]][_0x13a3('0x73')]:_0x427d7a[_0x33864c]['field'];_0x2f5483=_0x427d7a[_0x33864c][_0x13a3('0x74')]?_[_0x13a3('0x75')](_0x5e40a1[_0x427d7a[_0x33864c][_0x13a3('0x74')]],'%s',_0x2f5483):_0x2f5483;_0x2f5483=_0x427d7a[_0x33864c][_0x13a3('0x76')]?_[_0x13a3('0x75')](_0x143187[_0x427d7a[_0x33864c][_0x13a3('0x76')]],'%s',_0x2f5483):_0x2f5483;if(_0x427d7a[_0x33864c][_0x13a3('0x77')]){_0x28077d[_0x13a3('0x69')](_0x2f5483);}_0x427d7a[_0x33864c][_0x13a3('0x78')]&&_0x28077d[_0x13a3('0x3f')](_0x2f5483,_0x427d7a[_0x33864c][_0x13a3('0x78')]==='DESC'?![]:!![]);_0x28077d[_0x13a3('0x6a')](_0x2f5483,_0x427d7a[_0x33864c][_0x13a3('0x79')]||_0x2f5483);}if(_0x558183[_0x13a3('0x7a')]){_0x558183[_0x13a3('0x7a')]=JSON['parse'](_0x558183[_0x13a3('0x7a')]);for(var _0x14d445=0x0;_0x14d445<_0x558183[_0x13a3('0x7a')]['length'];_0x14d445+=0x1){if(_0x558183[_0x13a3('0x7a')][_0x14d445]['type']&&_['includes'](_0x3122e7,_0x558183[_0x13a3('0x7a')][_0x14d445][_0x13a3('0x32')])&&_0x558183[_0x13a3('0x7a')][_0x14d445][_0x13a3('0x7b')]&&_0x558183['joins'][_0x14d445][_0x13a3('0x7c')]&&_0x558183['joins'][_0x14d445][_0x13a3('0x7d')]){_0x28077d[_0x558183[_0x13a3('0x7a')][_0x14d445][_0x13a3('0x32')]](_0x558183['joins'][_0x14d445][_0x13a3('0x7c')],null,util['format'](_0x13a3('0x7e'),_0x558183[_0x13a3('0x7f')],_0x558183[_0x13a3('0x7a')][_0x14d445][_0x13a3('0x7b')],_0x558183[_0x13a3('0x7a')][_0x14d445]['foreignTable'],_0x558183[_0x13a3('0x7a')][_0x14d445]['foreignKey']));}}}if(_0x558183['conditions']){_0x558183[_0x13a3('0x80')]=JSON[_0x13a3('0x81')](_0x558183[_0x13a3('0x80')]);_0x28077d['where'](_0x108760(_0x558183['conditions'][_0x13a3('0x69')]));}_0x526529=_0x28077d[_0x13a3('0x82')]();_0x28077d[_0x13a3('0x3e')](_0x97db43);_0x28077d[_0x13a3('0x1f')](0x0);logger['debug'](_0x13a3('0x83'),_0x28077d['toString']());return dbH[_0x13a3('0x84')][_0x13a3('0x35')](_0x28077d[_0x13a3('0x85')](),{'type':dbH[_0x13a3('0x84')]['QueryTypes']['SELECT']});}})[_0x13a3('0x27')](respondWithResult(_0x2a97ae,null))[_0x13a3('0x48')](handleError(_0x2a97ae,null));};function runReport(_0x1a5524,_0x2fda5f,_0x6c12d4){var _0x4f47e0=_0x2fda5f[_0x13a3('0x2b')];var _0x44ceca=0xa;var _0xcd8e1d=['join','left_join','right_join',_0x13a3('0x58')];var _0x29e94c={'SUM':_0x13a3('0x86'),'COUNT':_0x13a3('0x59'),'COUNT DISTINCT':_0x13a3('0x5a'),'MAX':_0x13a3('0x87'),'MIN':_0x13a3('0x5b'),'AVG':_0x13a3('0x5c'),'GROUP_CONCAT':_0x13a3('0x5d'),'GROUP_CONCAT ASC':_0x13a3('0x88'),'GROUP_CONCAT DESC':_0x13a3('0x5e')};var _0x55e5e1={'SEC_TO_TIME':_0x13a3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x13a3('0x61'),'ROUND':_0x13a3('0x62'),'UNIX_TIMESTAMP':_0x13a3('0x63')};var _0x511a66=function(_0x59d694){return!_[_0x13a3('0x64')]([_0x13a3('0x89'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x13a3('0x66')],_0x59d694);};var _0x174c13=function(_0x529e69){if(!_0x529e69||!_0x529e69[_0x13a3('0x67')]['length']){return'';}for(var _0x2f485e='(',_0x1acfa6=0x0;_0x1acfa6<_0x529e69[_0x13a3('0x67')][_0x13a3('0x3b')];_0x1acfa6+=0x1){_0x1acfa6>0x0&&(_0x2f485e+='\x20'+_0x529e69[_0x13a3('0x68')]+'\x20');_0x2f485e+=_0x529e69[_0x13a3('0x67')][_0x1acfa6]['group']?_0x174c13(_0x529e69[_0x13a3('0x67')][_0x1acfa6][_0x13a3('0x69')]):_0x529e69['rules'][_0x1acfa6][_0x13a3('0x6a')]+'\x20'+_0x529e69[_0x13a3('0x67')][_0x1acfa6]['condition']+(_0x511a66(_0x529e69['rules'][_0x1acfa6]['condition'])?'\x20'+_0x529e69[_0x13a3('0x67')][_0x1acfa6]['value']:'');}return _0x2f485e+')';};var _0x19f95a={'where':{'id':_0x1a5524['id']}},_0x3d4f72,_0x1ab7da,_0x4d129b,_0x222512,_0x23171e;_0x19f95a=_[_0x13a3('0x44')]({},_0x19f95a,_0x6c12d4);return db[_0x13a3('0x2f')][_0x13a3('0x4a')](_0x19f95a)[_0x13a3('0x27')](function(_0x1f0c2d){if(_0x1f0c2d){_0x3d4f72=_0x1f0c2d;return _0x1f0c2d[_0x13a3('0x6d')]();}return null;})['then'](function(_0x466690){if(_0x466690){if(!_0x466690[_0x13a3('0x3b')]){throw new db[(_0x13a3('0x6e'))][(_0x13a3('0x8a'))](_0x13a3('0x8b'),0x193);}_0x1ab7da=_0x466690;return db[_0x13a3('0x8c')][_0x13a3('0x6f')]({'raw':!![]});}return null;})[_0x13a3('0x27')](function(_0x2074b3){if(_0x2074b3){_0x4d129b=_[_0x13a3('0x8d')](_0x2074b3,'id');var _0xfcaa22;var _0x47c452=squel[_0x13a3('0x70')]();_0x47c452['from'](_0x3d4f72[_0x13a3('0x7f')]);for(var _0x462157=0x0;_0x462157<_0x1ab7da['length'];_0x462157+=0x1){_0xfcaa22=_0x1ab7da[_0x462157][_0x13a3('0x72')]?_0x4d129b[_0x1ab7da[_0x462157]['MetricId']][_0x13a3('0x73')]:_0x1ab7da[_0x462157][_0x13a3('0x6a')];_0xfcaa22=_0x1ab7da[_0x462157][_0x13a3('0x74')]?_[_0x13a3('0x75')](_0x29e94c[_0x1ab7da[_0x462157][_0x13a3('0x74')]],'%s',_0xfcaa22):_0xfcaa22;_0xfcaa22=_0x1ab7da[_0x462157][_0x13a3('0x76')]?_[_0x13a3('0x75')](_0x55e5e1[_0x1ab7da[_0x462157][_0x13a3('0x76')]],'%s',_0xfcaa22):_0xfcaa22;if(_0x1ab7da[_0x462157]['groupBy']){_0x47c452[_0x13a3('0x69')](_0xfcaa22);}_0x1ab7da[_0x462157]['orderBy']&&_0x47c452[_0x13a3('0x3f')](_0xfcaa22,_0x1ab7da[_0x462157][_0x13a3('0x78')]===_0x13a3('0x8e')?![]:!![]);_0x47c452['field'](_0xfcaa22,_0x1ab7da[_0x462157][_0x13a3('0x79')]||_0xfcaa22);}if(_0x3d4f72[_0x13a3('0x7a')]){_0x3d4f72[_0x13a3('0x7a')]=JSON[_0x13a3('0x81')](_0x3d4f72['joins']);for(var _0x2b9bb4=0x0;_0x2b9bb4<_0x3d4f72[_0x13a3('0x7a')][_0x13a3('0x3b')];_0x2b9bb4+=0x1){if(_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4][_0x13a3('0x32')]&&_['includes'](_0xcd8e1d,_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4][_0x13a3('0x32')])&&_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4][_0x13a3('0x7b')]&&_0x3d4f72['joins'][_0x2b9bb4][_0x13a3('0x7c')]&&_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4]['foreignKey']){_0x47c452[_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4]['type']](_0x3d4f72['joins'][_0x2b9bb4][_0x13a3('0x7c')],null,util[_0x13a3('0x76')](_0x13a3('0x7e'),_0x3d4f72['table'],_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4][_0x13a3('0x7b')],_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4]['foreignTable'],_0x3d4f72[_0x13a3('0x7a')][_0x2b9bb4][_0x13a3('0x7d')]));}}}if(_0x3d4f72[_0x13a3('0x80')]){_0x3d4f72[_0x13a3('0x80')]=JSON[_0x13a3('0x81')](_0x3d4f72[_0x13a3('0x80')]);_0x47c452[_0x13a3('0x41')](_0x174c13(_0x3d4f72[_0x13a3('0x80')]['group']));}_0x23171e=_0x47c452[_0x13a3('0x82')]();_0x47c452['limit'](_0x44ceca);_0x47c452['offset'](0x0);return;}})[_0x13a3('0x27')](function(){if(_0x2fda5f[_0x13a3('0x8f')]===_0x13a3('0x90')){return null;}var _0x48669a=_[_0x13a3('0x44')](_0x2fda5f,{'name':_0x2fda5f['fullPath']||_0x2fda5f['name']||_0x3d4f72[_0x13a3('0x2b')],'basename':_0x4f47e0,'savename':util[_0x13a3('0x76')](_0x13a3('0x91'),_0x2fda5f[_0x13a3('0x2b')]||_0x3d4f72[_0x13a3('0x2b')],require('randomstring')[_0x13a3('0x92')](0x4),_0x2fda5f[_0x13a3('0x8f')]||_0x13a3('0x93')),'reportId':_0x3d4f72['id'],'reportType':'default'});return db[_0x13a3('0x94')][_0x13a3('0x4b')](_0x48669a,{'raw':!![]});})[_0x13a3('0x27')](function(_0x221d44){if(_0x3d4f72[_0x13a3('0x7f')]===_0x13a3('0x95')){_0x23171e[_0x13a3('0x41')](_0x3d4f72[_0x13a3('0x7f')]+_0x13a3('0x96'),_0x2fda5f['startDate'],_0x2fda5f['endDate']);}else{_0x23171e[_0x13a3('0x41')](_0x3d4f72[_0x13a3('0x7f')]+_0x13a3('0x97'),_0x2fda5f[_0x13a3('0x98')],_0x2fda5f[_0x13a3('0x99')]);}if(_0x221d44){logger[_0x13a3('0x9a')](_0x13a3('0x9b'),_0x23171e[_0x13a3('0x85')]());require(_0x13a3('0x9c'))['fork'](path[_0x13a3('0x56')](__dirname,_0x13a3('0x9d'),_0x221d44[_0x13a3('0x8f')]),[_0x221d44['id'],_0x23171e[_0x13a3('0x85')](),path[_0x13a3('0x56')](__dirname,'../../files/reports',_0x221d44[_0x13a3('0x9e')]),_0x4f47e0]);return _0x221d44;}else{var _0x4192b3=squel[_0x13a3('0x70')]();_0x4192b3[_0x13a3('0x71')]('('+_0x23171e[_0x13a3('0x85')]()+')',_0x13a3('0x9f'));_0x4192b3[_0x13a3('0x6a')](_0x13a3('0xa0'),_0x13a3('0x1e'));_0x23171e[_0x13a3('0x3e')](_0x2fda5f[_0x13a3('0x3e')]||_0x44ceca);_0x23171e[_0x13a3('0x1f')](_0x2fda5f[_0x13a3('0x1f')]||0x0);return dbH['sequelize']['query'](_0x4192b3['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x13a3('0xa1')]})[_0x13a3('0x27')](function(_0x5df407){if(!_0x5df407[_0x13a3('0x3b')]){_0x222512=0x0;}else{_0x222512=_0x5df407[0x0]['count']||0x0;}return dbH[_0x13a3('0x84')][_0x13a3('0x35')](_0x23171e[_0x13a3('0x85')](),{'type':dbH[_0x13a3('0x84')][_0x13a3('0xa2')]['SELECT']});})[_0x13a3('0x27')](function(_0x47a4da){return{'rows':_0x47a4da||[],'count':_0x222512};});}});}exports['run']=function(_0x486140,_0xa6c4b3){return runReport(_0x486140[_0x13a3('0x55')],_0x486140[_0x13a3('0x35')],_0x486140['options'])['then'](respondWithResult(_0xa6c4b3,null))['catch'](handleError(_0xa6c4b3,null));};exports['runReport']=runReport;exports[_0x13a3('0x35')]=function(_0x22c79a,_0x441dfc){var _0xc558ad=0xa;var _0x4ba215=[_0x13a3('0x56'),_0x13a3('0x57'),_0x13a3('0xa3'),_0x13a3('0x58')];var _0x47d3c1={'SUM':_0x13a3('0x86'),'COUNT':_0x13a3('0x59'),'COUNT DISTINCT':_0x13a3('0x5a'),'MAX':_0x13a3('0x87'),'MIN':_0x13a3('0x5b'),'AVG':_0x13a3('0x5c'),'GROUP_CONCAT':_0x13a3('0x5d'),'GROUP_CONCAT ASC':_0x13a3('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x393ab2={'SEC_TO_TIME':_0x13a3('0x5f'),'DATE':_0x13a3('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x13a3('0x62'),'UNIX_TIMESTAMP':_0x13a3('0x63')};var _0x4eb690=function(_0x3a8526){return!_[_0x13a3('0x64')](['IS\x20NULL',_0x13a3('0x65'),_0x13a3('0xa4'),'IS\x20NOT\x20EMPTY'],_0x3a8526);};var _0x53a6da=function(_0x374c43){if(!_0x374c43||!_0x374c43[_0x13a3('0x67')][_0x13a3('0x3b')]){return'';}for(var _0x3dc1e9='(',_0x48b1d7=0x0;_0x48b1d7<_0x374c43['rules'][_0x13a3('0x3b')];_0x48b1d7+=0x1){_0x48b1d7>0x0&&(_0x3dc1e9+='\x20'+_0x374c43['operator']+'\x20');_0x3dc1e9+=_0x374c43[_0x13a3('0x67')][_0x48b1d7]['group']?_0x53a6da(_0x374c43[_0x13a3('0x67')][_0x48b1d7][_0x13a3('0x69')]):_0x374c43['rules'][_0x48b1d7]['field']+'\x20'+_0x374c43['rules'][_0x48b1d7]['condition']+(_0x4eb690(_0x374c43[_0x13a3('0x67')][_0x48b1d7][_0x13a3('0x6b')])?'\x20'+_0x374c43[_0x13a3('0x67')][_0x48b1d7]['value']:'');}return _0x3dc1e9+')';};var _0x1f0f58={'where':{'id':_0x22c79a[_0x13a3('0x55')]['id']}},_0x30a373,_0x3e6a42,_0x3ab7df,_0x3575da,_0x44f3e9;_0x1f0f58=_['merge']({},_0x1f0f58,_0x22c79a[_0x13a3('0x49')]);return db[_0x13a3('0x2f')][_0x13a3('0x4a')](_0x1f0f58)[_0x13a3('0x27')](function(_0x33f292){if(_0x33f292){_0x30a373=_0x33f292;return _0x33f292['getFields']();}return null;})[_0x13a3('0x27')](function(_0x1b01d7){if(_0x1b01d7){if(!_0x1b01d7[_0x13a3('0x3b')]){throw new db[(_0x13a3('0x6e'))][(_0x13a3('0x8a'))](_0x13a3('0x8b'),0x193);}_0x3e6a42=_0x1b01d7;return db[_0x13a3('0x8c')][_0x13a3('0x6f')]({'raw':!![]});}return null;})[_0x13a3('0x27')](function(_0x4b4b09){if(_0x4b4b09){_0x3ab7df=_[_0x13a3('0x8d')](_0x4b4b09,'id');var _0x16b588;var _0x991811=squel[_0x13a3('0x70')]();_0x991811['from'](_0x30a373[_0x13a3('0x7f')]);for(var _0x417877=0x0;_0x417877<_0x3e6a42[_0x13a3('0x3b')];_0x417877+=0x1){_0x16b588=_0x3e6a42[_0x417877][_0x13a3('0x72')]?_0x3ab7df[_0x3e6a42[_0x417877][_0x13a3('0x72')]][_0x13a3('0x73')]:_0x3e6a42[_0x417877][_0x13a3('0x6a')];_0x16b588=_0x3e6a42[_0x417877]['function']?_[_0x13a3('0x75')](_0x47d3c1[_0x3e6a42[_0x417877][_0x13a3('0x74')]],'%s',_0x16b588):_0x16b588;_0x16b588=_0x3e6a42[_0x417877][_0x13a3('0x76')]?_[_0x13a3('0x75')](_0x393ab2[_0x3e6a42[_0x417877]['format']],'%s',_0x16b588):_0x16b588;if(_0x3e6a42[_0x417877][_0x13a3('0x77')]){_0x991811[_0x13a3('0x69')](_0x16b588);}_0x3e6a42[_0x417877][_0x13a3('0x78')]&&_0x991811[_0x13a3('0x3f')](_0x16b588,_0x3e6a42[_0x417877]['orderBy']===_0x13a3('0x8e')?![]:!![]);_0x991811['field'](_0x16b588,_0x3e6a42[_0x417877][_0x13a3('0x79')]||_0x16b588);}if(_0x30a373[_0x13a3('0x7a')]){_0x30a373[_0x13a3('0x7a')]=JSON[_0x13a3('0x81')](_0x30a373['joins']);for(var _0x4eca0f=0x0;_0x4eca0f<_0x30a373[_0x13a3('0x7a')][_0x13a3('0x3b')];_0x4eca0f+=0x1){if(_0x30a373[_0x13a3('0x7a')][_0x4eca0f]['type']&&_['includes'](_0x4ba215,_0x30a373[_0x13a3('0x7a')][_0x4eca0f][_0x13a3('0x32')])&&_0x30a373[_0x13a3('0x7a')][_0x4eca0f][_0x13a3('0x7b')]&&_0x30a373['joins'][_0x4eca0f]['foreignTable']&&_0x30a373[_0x13a3('0x7a')][_0x4eca0f]['foreignKey']){_0x991811[_0x30a373[_0x13a3('0x7a')][_0x4eca0f]['type']](_0x30a373[_0x13a3('0x7a')][_0x4eca0f][_0x13a3('0x7c')],null,util['format'](_0x13a3('0x7e'),_0x30a373[_0x13a3('0x7f')],_0x30a373['joins'][_0x4eca0f][_0x13a3('0x7b')],_0x30a373[_0x13a3('0x7a')][_0x4eca0f][_0x13a3('0x7c')],_0x30a373[_0x13a3('0x7a')][_0x4eca0f][_0x13a3('0x7d')]));}}}if(_0x30a373['conditions']){_0x30a373[_0x13a3('0x80')]=JSON[_0x13a3('0x81')](_0x30a373[_0x13a3('0x80')]);_0x991811[_0x13a3('0x41')](_0x53a6da(_0x30a373[_0x13a3('0x80')][_0x13a3('0x69')]));}_0x44f3e9=_0x991811[_0x13a3('0x82')]();_0x991811[_0x13a3('0x3e')](_0xc558ad);_0x991811[_0x13a3('0x1f')](0x0);logger[_0x13a3('0xa5')]('Limited\x20Query:',_0x991811[_0x13a3('0x85')]());return dbH[_0x13a3('0x84')][_0x13a3('0x35')](_0x991811[_0x13a3('0x85')](),{'type':dbH['sequelize'][_0x13a3('0xa2')][_0x13a3('0xa1')]});}})[_0x13a3('0x27')](function(){return{'sql':_0x44f3e9['toString']()};})[_0x13a3('0x27')](respondWithResult(_0x441dfc,null))[_0x13a3('0x48')](handleError(_0x441dfc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 097b1d6..15ca23e 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 _0xc626=['request-promise','path','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird'];(function(_0x25a553,_0x57d9e7){var _0x1aff24=function(_0x5496e1){while(--_0x5496e1){_0x25a553['push'](_0x25a553['shift']());}};_0x1aff24(++_0x57d9e7);}(_0xc626,0x145));var _0x6c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc626[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c62('0x0'));var util=require(_0x6c62('0x1'));var logger=require(_0x6c62('0x2'))(_0x6c62('0x3'));var moment=require('moment');var BPromise=require(_0x6c62('0x4'));var rp=require(_0x6c62('0x5'));var fs=require('fs');var path=require(_0x6c62('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c62('0x7'));module[_0x6c62('0x8')]=function(_0x59898f,_0x2c2c56){return _0x59898f['define'](_0x6c62('0x9'),attributes,{'tableName':_0x6c62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6108=['../../config/logger','api','moment','path','rimraf','exports','define','analytics_default_reports','lodash'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x6108,0xbc));var _0x8610=function(_0x63b2d7,_0x52761a){_0x63b2d7=_0x63b2d7-0x0;var _0x3ffe46=_0x6108[_0x63b2d7];return _0x3ffe46;};'use strict';var _=require(_0x8610('0x0'));var util=require('util');var logger=require(_0x8610('0x1'))(_0x8610('0x2'));var moment=require(_0x8610('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8610('0x4'));var rimraf=require(_0x8610('0x5'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x8610('0x6')]=function(_0x1ca62b,_0x28a680){return _0x1ca62b[_0x8610('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0x8610('0x8'),'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 1690c86..f1ecb30 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 _0xc7a7=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x52684d,_0x2ff075){var _0x5aa7bd=function(_0x3c0582){while(--_0x3c0582){_0x52684d['push'](_0x52684d['shift']());}};_0x5aa7bd(++_0x2ff075);}(_0xc7a7,0x171));var _0x7c7a=function(_0x2491d0,_0x30bbad){_0x2491d0=_0x2491d0-0x0;var _0x343f27=_0xc7a7[_0x2491d0];return _0x343f27;};'use strict';var _=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var moment=require(_0x7c7a('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c7a('0x3'));var fs=require('fs');var Redis=require(_0x7c7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c7a('0x5'));var logger=require(_0x7c7a('0x6'))(_0x7c7a('0x7'));var config=require(_0x7c7a('0x8'));var jayson=require(_0x7c7a('0x9'));var client=jayson[_0x7c7a('0xa')][_0x7c7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19467e,_0x5992cf,_0x361567){return new BPromise(function(_0x43e2af,_0x33637d){return client['request'](_0x19467e,_0x361567)[_0x7c7a('0xc')](function(_0x19070c){logger[_0x7c7a('0xd')](_0x7c7a('0xe'),_0x5992cf,_0x7c7a('0xf'));logger[_0x7c7a('0x10')](_0x7c7a('0x11'),_0x5992cf,_0x7c7a('0xf'),JSON['stringify'](_0x19070c));if(_0x19070c[_0x7c7a('0x12')]){if(_0x19070c[_0x7c7a('0x12')][_0x7c7a('0x13')]===0x1f4){logger[_0x7c7a('0x12')](_0x7c7a('0xe'),_0x5992cf,_0x19070c[_0x7c7a('0x12')][_0x7c7a('0x14')]);return _0x33637d(_0x19070c['error'][_0x7c7a('0x14')]);}logger[_0x7c7a('0x12')](_0x7c7a('0xe'),_0x5992cf,_0x19070c[_0x7c7a('0x12')][_0x7c7a('0x14')]);return _0x43e2af(_0x19070c['error'][_0x7c7a('0x14')]);}else{logger['info'](_0x7c7a('0xe'),_0x5992cf,_0x7c7a('0xf'));_0x43e2af(_0x19070c[_0x7c7a('0x15')][_0x7c7a('0x14')]);}})[_0x7c7a('0x16')](function(_0x4687f2){logger[_0x7c7a('0x12')](_0x7c7a('0xe'),_0x5992cf,_0x4687f2);_0x33637d(_0x4687f2);});});} \ No newline at end of file +var _0x6d2d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3a143c,_0x17b240){var _0x118f99=function(_0x206d29){while(--_0x206d29){_0x3a143c['push'](_0x3a143c['shift']());}};_0x118f99(++_0x17b240);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x231983,_0x207292){_0x231983=_0x231983-0x0;var _0x440da0=_0x6d2d[_0x231983];return _0x440da0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6d2('0x0'));var BPromise=require(_0xd6d2('0x1'));var rs=require(_0xd6d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6d2('0x3'))['db'];var utils=require(_0xd6d2('0x4'));var logger=require(_0xd6d2('0x5'))(_0xd6d2('0x6'));var config=require(_0xd6d2('0x7'));var jayson=require(_0xd6d2('0x8'));var client=jayson[_0xd6d2('0x9')][_0xd6d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e981a,_0xd7f991,_0x736bc2){return new BPromise(function(_0x326cad,_0x539292){return client[_0xd6d2('0xb')](_0x5e981a,_0x736bc2)[_0xd6d2('0xc')](function(_0x390aaf){logger[_0xd6d2('0xd')](_0xd6d2('0xe'),_0xd7f991,_0xd6d2('0xf'));logger[_0xd6d2('0x10')](_0xd6d2('0x11'),_0xd7f991,'request\x20sent',JSON[_0xd6d2('0x12')](_0x390aaf));if(_0x390aaf[_0xd6d2('0x13')]){if(_0x390aaf[_0xd6d2('0x13')][_0xd6d2('0x14')]===0x1f4){logger[_0xd6d2('0x13')](_0xd6d2('0xe'),_0xd7f991,_0x390aaf[_0xd6d2('0x13')]['message']);return _0x539292(_0x390aaf[_0xd6d2('0x13')][_0xd6d2('0x15')]);}logger[_0xd6d2('0x13')](_0xd6d2('0xe'),_0xd7f991,_0x390aaf[_0xd6d2('0x13')]['message']);return _0x326cad(_0x390aaf[_0xd6d2('0x13')][_0xd6d2('0x15')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0xd7f991,_0xd6d2('0xf'));_0x326cad(_0x390aaf[_0xd6d2('0x16')]['message']);}})[_0xd6d2('0x17')](function(_0x39c029){logger['error'](_0xd6d2('0xe'),_0xd7f991,_0x39c029);_0x539292(_0x39c029);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 10239b9..bf58d35 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 _0xa84a=['/:id/run','/:id/query','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview'];(function(_0x433149,_0x3172e3){var _0x273bbe=function(_0x10ad38){while(--_0x10ad38){_0x433149['push'](_0x433149['shift']());}};_0x273bbe(++_0x3172e3);}(_0xa84a,0x80));var _0xaa84=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa84a[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xaa84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa84('0x1'));var express=require(_0xaa84('0x2'));var router=express[_0xaa84('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xaa84('0x4'));var config=require('../../config/environment');var controller=require(_0xaa84('0x5'));router[_0xaa84('0x6')]('/',auth[_0xaa84('0x7')](),controller['index']);router['get'](_0xaa84('0x8'),auth['isAuthenticated'](),controller[_0xaa84('0x9')]);router[_0xaa84('0x6')](_0xaa84('0xa'),auth[_0xaa84('0x7')](),controller[_0xaa84('0xb')]);router[_0xaa84('0x6')](_0xaa84('0xc'),auth['isAuthenticated'](),controller['run']);router['get'](_0xaa84('0xd'),auth[_0xaa84('0x7')](),controller['query']);router['post']('/',auth[_0xaa84('0x7')](),controller[_0xaa84('0xe')]);router[_0xaa84('0xf')](_0xaa84('0x8'),auth[_0xaa84('0x7')](),controller[_0xaa84('0x10')]);router[_0xaa84('0x11')](_0xaa84('0x8'),auth[_0xaa84('0x7')](),controller[_0xaa84('0x12')]);module[_0xaa84('0x13')]=router; \ No newline at end of file +var _0xc36d=['express','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','preview','/:id/run','/:id/query','query','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x27619d,_0x349553){var _0xdac21f=function(_0x137aa7){while(--_0x137aa7){_0x27619d['push'](_0x27619d['shift']());}};_0xdac21f(++_0x349553);}(_0xc36d,0xb9));var _0xdc36=function(_0x52ca59,_0x279dda){_0x52ca59=_0x52ca59-0x0;var _0x1ab7e5=_0xc36d[_0x52ca59];return _0x1ab7e5;};'use strict';var multer=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var path=require(_0xdc36('0x2'));var timeout=require(_0xdc36('0x3'));var express=require(_0xdc36('0x4'));var router=express['Router']();var auth=require(_0xdc36('0x5'));var interaction=require(_0xdc36('0x6'));var config=require('../../config/environment');var controller=require(_0xdc36('0x7'));router['get']('/',auth[_0xdc36('0x8')](),controller['index']);router[_0xdc36('0x9')](_0xdc36('0xa'),auth[_0xdc36('0x8')](),controller[_0xdc36('0xb')]);router['get']('/:id/preview',auth[_0xdc36('0x8')](),controller[_0xdc36('0xc')]);router[_0xdc36('0x9')](_0xdc36('0xd'),auth[_0xdc36('0x8')](),controller['run']);router[_0xdc36('0x9')](_0xdc36('0xe'),auth['isAuthenticated'](),controller[_0xdc36('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdc36('0x10')]);router[_0xdc36('0x11')](_0xdc36('0xa'),auth[_0xdc36('0x8')](),controller['update']);router[_0xdc36('0x12')](_0xdc36('0xa'),auth[_0xdc36('0x8')](),controller[_0xdc36('0x13')]);module[_0xdc36('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f3b80a0..95705a5 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 _0x29c7=['manual','INTEGER','exports','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','scheduled'];(function(_0x2b7b29,_0x59b527){var _0x179776=function(_0x414f34){while(--_0x414f34){_0x2b7b29['push'](_0x2b7b29['shift']());}};_0x179776(++_0x59b527);}(_0x29c7,0xc8));var _0x729c=function(_0x34e856,_0x27ec15){_0x34e856=_0x34e856-0x0;var _0x3ecfe4=_0x29c7[_0x34e856];return _0x3ecfe4;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x729c('0x0')]={'name':{'type':Sequelize[_0x729c('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x729c('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x729c('0x2'),_0x729c('0x3'),_0x729c('0x4')),'allowNull':![],'defaultValue':_0x729c('0x2')},'savename':{'type':Sequelize[_0x729c('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x729c('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x729c('0x1')],'defaultValue':_0x729c('0x6')},'type':{'type':Sequelize[_0x729c('0x7')]('manual',_0x729c('0x8')),'allowNull':![],'defaultValue':_0x729c('0x9')},'reportId':{'type':Sequelize[_0x729c('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02f9=['pdf','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x02f9,0xf8));var _0x902f=function(_0x4bcc46,_0x4fd024){_0x4bcc46=_0x4bcc46-0x0;var _0x2d2082=_0x02f9[_0x4bcc46];return _0x2d2082;};'use strict';var Sequelize=require(_0x902f('0x0'));var moment=require('moment');module[_0x902f('0x1')]={'name':{'type':Sequelize[_0x902f('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x902f('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x902f('0x3')](_0x902f('0x4'),_0x902f('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x902f('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x902f('0x6')]},'endDate':{'type':Sequelize[_0x902f('0x6')]},'status':{'type':Sequelize[_0x902f('0x2')],'defaultValue':_0x902f('0x7')},'type':{'type':Sequelize[_0x902f('0x3')](_0x902f('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x902f('0x9')](0xb)[_0x902f('0xa')]},'reportType':{'type':Sequelize[_0x902f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0e23b3e..216838d 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 _0x1ef9=['jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','basename','toLowerCase','html-pdf','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0xe8a8df,_0x231533){var _0x1169d1=function(_0x5abf05){while(--_0x5abf05){_0xe8a8df['push'](_0xe8a8df['shift']());}};_0x1169d1(++_0x231533);}(_0x1ef9,0x1c6));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x91ef('0x0'));var emlformat=require(_0x91ef('0x1'));var rimraf=require(_0x91ef('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x91ef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x91ef('0x4'));var util=require(_0x91ef('0x5'));var path=require(_0x91ef('0x6'));var sox=require(_0x91ef('0x7'));var csv=require(_0x91ef('0x8'));var ejs=require(_0x91ef('0x9'));var fs=require('fs');var _=require(_0x91ef('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91ef('0xb'));var deskjs=require(_0x91ef('0xc'));var toCsv=require(_0x91ef('0x8'));var querystring=require('querystring');var Papa=require(_0x91ef('0xd'));var Redis=require('ioredis');var authService=require(_0x91ef('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x91ef('0xf'))(_0x91ef('0x10'));var utils=require('../../config/utils');var config=require(_0x91ef('0x11'));var licenseUtil=require(_0x91ef('0x12'));var db=require(_0x91ef('0x13'))['db'];function respondWithStatusCode(_0x26c88c,_0x4f492a){_0x4f492a=_0x4f492a||0xcc;return function(_0x5a699e){if(_0x5a699e){return _0x26c88c[_0x91ef('0x14')](_0x4f492a);}return _0x26c88c[_0x91ef('0x15')](_0x4f492a)[_0x91ef('0x16')]();};}function respondWithResult(_0x49387c,_0x2d7c03){_0x2d7c03=_0x2d7c03||0xc8;return function(_0x335efc){if(_0x335efc){return _0x49387c[_0x91ef('0x15')](_0x2d7c03)[_0x91ef('0x17')](_0x335efc);}};}function respondWithFilteredResult(_0x562eea,_0x430199){return function(_0x1e5175){if(_0x1e5175){var _0x1b3e86=_0x1e5175[_0x91ef('0x18')],_0x4b9bd9=_0x430199[_0x91ef('0x19')],_0xd7bf4d=_0x430199['offset']+_0x430199[_0x91ef('0x1a')],_0x5b870d;if(_0xd7bf4d>=_0x1b3e86){_0xd7bf4d=_0x1b3e86;_0x5b870d=0xc8;}else{_0x5b870d=0xce;}_0x562eea[_0x91ef('0x15')](_0x5b870d);return _0x562eea[_0x91ef('0x1b')](_0x91ef('0x1c'),_0x4b9bd9+'-'+_0xd7bf4d+'/'+_0x1b3e86)[_0x91ef('0x17')](_0x1e5175);}return null;};}function patchUpdates(_0x14fb3f){return function(_0x37ee1f){try{jsonpatch['apply'](_0x37ee1f,_0x14fb3f,!![]);}catch(_0x3a6dc5){return BPromise[_0x91ef('0x1d')](_0x3a6dc5);}return _0x37ee1f[_0x91ef('0x1e')]();};}function saveUpdates(_0x146068,_0x56702a){return function(_0x37ab7e){if(_0x37ab7e){return _0x37ab7e[_0x91ef('0x1f')](_0x146068)['then'](function(_0x20c461){return _0x20c461;});}return null;};}function removeEntity(_0x2905da,_0x45c51c){return function(_0x36c642){if(_0x36c642){return _0x36c642[_0x91ef('0x20')]()[_0x91ef('0x21')](function(){var _0x3eae73=_0x36c642[_0x91ef('0x22')]({'plain':!![]});var _0x3010cb='ExtractedReports';return db[_0x91ef('0x23')][_0x91ef('0x20')]({'where':{'type':_0x3010cb,'resourceId':_0x3eae73['id']}})[_0x91ef('0x21')](function(){return _0x36c642;});})['then'](function(){_0x2905da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f307b,_0x1ca321){return function(_0x12bfec){if(!_0x12bfec){_0x1f307b[_0x91ef('0x14')](0x194);}return _0x12bfec;};}function handleError(_0x522a3,_0x4787c8){_0x4787c8=_0x4787c8||0x1f4;return function(_0x10c379){logger[_0x91ef('0x24')](_0x10c379[_0x91ef('0x25')]);if(_0x10c379['name']){delete _0x10c379[_0x91ef('0x26')];}_0x522a3[_0x91ef('0x15')](_0x4787c8)[_0x91ef('0x27')](_0x10c379);};}exports[_0x91ef('0x28')]=function(_0x22472d,_0x45620c){var _0x1aec7e={},_0x351557={},_0x3c986b={'count':0x0,'rows':[]};var _0x26d759=_[_0x91ef('0x29')](db[_0x91ef('0x2a')]['rawAttributes'],function(_0x5a1a7b){return{'name':_0x5a1a7b[_0x91ef('0x2b')],'type':_0x5a1a7b[_0x91ef('0x2c')][_0x91ef('0x2d')]};});_0x351557['model']=_[_0x91ef('0x29')](_0x26d759,_0x91ef('0x26'));_0x351557[_0x91ef('0x2e')]=_[_0x91ef('0x2f')](_0x22472d[_0x91ef('0x2e')]);_0x351557[_0x91ef('0x30')]=_['intersection'](_0x351557[_0x91ef('0x31')],_0x351557[_0x91ef('0x2e')]);_0x1aec7e[_0x91ef('0x32')]=_[_0x91ef('0x33')](_0x351557['model'],qs['fields'](_0x22472d['query'][_0x91ef('0x34')]));_0x1aec7e[_0x91ef('0x32')]=_0x1aec7e[_0x91ef('0x32')]['length']?_0x1aec7e[_0x91ef('0x32')]:_0x351557['model'];if(!_0x22472d['query'][_0x91ef('0x35')](_0x91ef('0x36'))){_0x1aec7e[_0x91ef('0x1a')]=qs['limit'](_0x22472d[_0x91ef('0x2e')][_0x91ef('0x1a')]);_0x1aec7e['offset']=qs[_0x91ef('0x19')](_0x22472d[_0x91ef('0x2e')]['offset']);}_0x1aec7e[_0x91ef('0x37')]=qs['sort'](_0x22472d[_0x91ef('0x2e')][_0x91ef('0x38')]);_0x1aec7e[_0x91ef('0x39')]=qs['filters'](_[_0x91ef('0x3a')](_0x22472d['query'],_0x351557[_0x91ef('0x30')]),_0x26d759);if(_0x22472d[_0x91ef('0x2e')]['filter']){_0x1aec7e[_0x91ef('0x39')]=_[_0x91ef('0x3b')](_0x1aec7e[_0x91ef('0x39')],{'$or':_[_0x91ef('0x29')](_0x26d759,function(_0x7b8e54){if(_0x7b8e54['type']!==_0x91ef('0x3c')){var _0x336e8a={};_0x336e8a[_0x7b8e54[_0x91ef('0x26')]]={'$like':'%'+_0x22472d[_0x91ef('0x2e')]['filter']+'%'};return _0x336e8a;}})});}_0x1aec7e=_['merge']({},_0x1aec7e,_0x22472d[_0x91ef('0x3d')]);var _0x279d4f={'where':_0x1aec7e[_0x91ef('0x39')]};return db[_0x91ef('0x2a')]['count'](_0x279d4f)['then'](function(_0x7f9c9a){_0x3c986b['count']=_0x7f9c9a;if(_0x22472d[_0x91ef('0x2e')][_0x91ef('0x3e')]){_0x1aec7e[_0x91ef('0x3f')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x91ef('0x40')](_0x1aec7e);})[_0x91ef('0x21')](function(_0x5542ff){_0x3c986b[_0x91ef('0x41')]=_0x5542ff;return _0x3c986b;})[_0x91ef('0x21')](respondWithFilteredResult(_0x45620c,_0x1aec7e))[_0x91ef('0x42')](handleError(_0x45620c,null));};exports['show']=function(_0x134e6f,_0x1901ce){var _0x4151ed={'raw':!![],'where':{'id':_0x134e6f[_0x91ef('0x43')]['id']}},_0x374a27={};_0x374a27[_0x91ef('0x31')]=_[_0x91ef('0x2f')](db[_0x91ef('0x2a')][_0x91ef('0x44')]);_0x374a27[_0x91ef('0x2e')]=_[_0x91ef('0x2f')](_0x134e6f['query']);_0x374a27[_0x91ef('0x30')]=_[_0x91ef('0x33')](_0x374a27['model'],_0x374a27[_0x91ef('0x2e')]);_0x4151ed[_0x91ef('0x32')]=_[_0x91ef('0x33')](_0x374a27[_0x91ef('0x31')],qs[_0x91ef('0x34')](_0x134e6f[_0x91ef('0x2e')]['fields']));_0x4151ed['attributes']=_0x4151ed['attributes']['length']?_0x4151ed['attributes']:_0x374a27[_0x91ef('0x31')];if(_0x134e6f['query'][_0x91ef('0x3e')]){_0x4151ed[_0x91ef('0x3f')]=[{'all':!![]}];}_0x4151ed=_['merge']({},_0x4151ed,_0x134e6f[_0x91ef('0x3d')]);return db[_0x91ef('0x2a')][_0x91ef('0x45')](_0x4151ed)[_0x91ef('0x21')](handleEntityNotFound(_0x1901ce,null))[_0x91ef('0x21')](respondWithResult(_0x1901ce,null))['catch'](handleError(_0x1901ce,null));};exports[_0x91ef('0x46')]=function(_0x258f1e,_0x31ed42){return db[_0x91ef('0x2a')][_0x91ef('0x46')](_0x258f1e[_0x91ef('0x47')],{})['then'](function(_0x3eb291){var _0x5d8dd7=_0x258f1e['user'][_0x91ef('0x22')]({'plain':!![]});if(!_0x5d8dd7)throw new Error(_0x91ef('0x48'));if(_0x5d8dd7[_0x91ef('0x49')]===_0x91ef('0x4a')){var _0x217f0d=_0x3eb291[_0x91ef('0x22')]({'plain':!![]});var _0x313210=_0x91ef('0x4b');return db['UserProfileSection'][_0x91ef('0x45')]({'where':{'name':_0x313210,'userProfileId':_0x5d8dd7[_0x91ef('0x4c')]},'raw':!![]})[_0x91ef('0x21')](function(_0x55f5e1){if(_0x55f5e1&&_0x55f5e1[_0x91ef('0x4d')]===0x0){return db[_0x91ef('0x23')][_0x91ef('0x46')]({'name':_0x217f0d['name'],'resourceId':_0x217f0d['id'],'type':_0x55f5e1[_0x91ef('0x26')],'sectionId':_0x55f5e1['id']},{})['then'](function(){return _0x3eb291;});}else{return _0x3eb291;}})[_0x91ef('0x42')](function(_0x2e9967){logger['error'](_0x91ef('0x4e'),_0x2e9967);throw _0x2e9967;});}return _0x3eb291;})['then'](respondWithResult(_0x31ed42,0xc9))[_0x91ef('0x42')](handleError(_0x31ed42,null));};exports[_0x91ef('0x1f')]=function(_0x364ad6,_0x36a528){if(_0x364ad6['body']['id']){delete _0x364ad6[_0x91ef('0x47')]['id'];}return db[_0x91ef('0x2a')][_0x91ef('0x45')]({'where':{'id':_0x364ad6[_0x91ef('0x43')]['id']}})[_0x91ef('0x21')](handleEntityNotFound(_0x36a528,null))[_0x91ef('0x21')](saveUpdates(_0x364ad6[_0x91ef('0x47')],null))['then'](respondWithResult(_0x36a528,null))[_0x91ef('0x42')](handleError(_0x36a528,null));};exports[_0x91ef('0x20')]=function(_0x5060c5,_0x41f71f){return db['AnalyticExtractedReport'][_0x91ef('0x45')]({'where':{'id':_0x5060c5['params']['id']}})[_0x91ef('0x21')](handleEntityNotFound(_0x41f71f,null))[_0x91ef('0x21')](removeEntity(_0x41f71f,null))[_0x91ef('0x42')](handleError(_0x41f71f,null));};exports['download']=function(_0x12cad7,_0x4ecbf4,_0x43ca45){return db[_0x91ef('0x2a')]['find']({'where':{'id':_0x12cad7[_0x91ef('0x43')]['id']},'attributes':['name','basename',_0x91ef('0x4f'),_0x91ef('0x50')],'raw':!![]})[_0x91ef('0x21')](handleEntityNotFound(_0x4ecbf4,null))['then'](function(_0x48fbf8){if(_0x48fbf8){if(!fs[_0x91ef('0x51')](path[_0x91ef('0x52')](config[_0x91ef('0x53')],_0x91ef('0x54'),_0x48fbf8[_0x91ef('0x4f')]))){throw new db[(_0x91ef('0x55'))][(_0x91ef('0x56'))](_0x91ef('0x57'));}if(_0x12cad7[_0x91ef('0x2e')][_0x91ef('0x58')]){return _0x4ecbf4[_0x91ef('0x14')](0xc8);}return _0x4ecbf4[_0x91ef('0x59')](path['join'](config[_0x91ef('0x53')],_0x91ef('0x54'),_0x48fbf8[_0x91ef('0x4f')]),util[_0x91ef('0x5a')]('%s.%s',_0x48fbf8[_0x91ef('0x5b')]||_0x48fbf8[_0x91ef('0x26')],_0x48fbf8[_0x91ef('0x50')][_0x91ef('0x5c')]()));}})['catch'](handleError(_0x4ecbf4,null));}; \ No newline at end of file +var _0xd8d3=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','AnalyticExtractedReport','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','root','format','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x1fc9f6,_0x487b57){var _0x4afd0b=function(_0x3dc2cf){while(--_0x3dc2cf){_0x1fc9f6['push'](_0x1fc9f6['shift']());}};_0x4afd0b(++_0x487b57);}(_0xd8d3,0x1a0));var _0x3d8d=function(_0x5373b3,_0x4d6d32){_0x5373b3=_0x5373b3-0x0;var _0x574895=_0xd8d3[_0x5373b3];return _0x574895;};'use strict';var pdf=require(_0x3d8d('0x0'));var emlformat=require(_0x3d8d('0x1'));var rimraf=require(_0x3d8d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d8d('0x3'));var rp=require(_0x3d8d('0x4'));var moment=require('moment');var BPromise=require(_0x3d8d('0x5'));var Mustache=require(_0x3d8d('0x6'));var util=require(_0x3d8d('0x7'));var path=require(_0x3d8d('0x8'));var sox=require(_0x3d8d('0x9'));var csv=require(_0x3d8d('0xa'));var ejs=require(_0x3d8d('0xb'));var fs=require('fs');var _=require(_0x3d8d('0xc'));var squel=require('squel');var crypto=require(_0x3d8d('0xd'));var jsforce=require(_0x3d8d('0xe'));var deskjs=require(_0x3d8d('0xf'));var toCsv=require(_0x3d8d('0xa'));var querystring=require(_0x3d8d('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d8d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3d8d('0x12'));var as=require(_0x3d8d('0x13'));var hardwareService=require(_0x3d8d('0x14'));var logger=require(_0x3d8d('0x15'))(_0x3d8d('0x16'));var utils=require(_0x3d8d('0x17'));var config=require(_0x3d8d('0x18'));var licenseUtil=require(_0x3d8d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x279ad3,_0x42bee6){_0x42bee6=_0x42bee6||0xcc;return function(_0x3162af){if(_0x3162af){return _0x279ad3['sendStatus'](_0x42bee6);}return _0x279ad3[_0x3d8d('0x1a')](_0x42bee6)[_0x3d8d('0x1b')]();};}function respondWithResult(_0x59f6ae,_0x30de70){_0x30de70=_0x30de70||0xc8;return function(_0x408aad){if(_0x408aad){return _0x59f6ae[_0x3d8d('0x1a')](_0x30de70)['json'](_0x408aad);}};}function respondWithFilteredResult(_0x3cb59b,_0xb83623){return function(_0x46808a){if(_0x46808a){var _0x4ddcbc=_0x46808a['count'],_0x3590fa=_0xb83623[_0x3d8d('0x1c')],_0x19d3c0=_0xb83623['offset']+_0xb83623['limit'],_0x5b616a;if(_0x19d3c0>=_0x4ddcbc){_0x19d3c0=_0x4ddcbc;_0x5b616a=0xc8;}else{_0x5b616a=0xce;}_0x3cb59b[_0x3d8d('0x1a')](_0x5b616a);return _0x3cb59b[_0x3d8d('0x1d')](_0x3d8d('0x1e'),_0x3590fa+'-'+_0x19d3c0+'/'+_0x4ddcbc)[_0x3d8d('0x1f')](_0x46808a);}return null;};}function patchUpdates(_0x5b786e){return function(_0xda8bc){try{jsonpatch[_0x3d8d('0x20')](_0xda8bc,_0x5b786e,!![]);}catch(_0x4586a5){return BPromise[_0x3d8d('0x21')](_0x4586a5);}return _0xda8bc[_0x3d8d('0x22')]();};}function saveUpdates(_0x55ca48,_0x458cbb){return function(_0x2580c6){if(_0x2580c6){return _0x2580c6[_0x3d8d('0x23')](_0x55ca48)[_0x3d8d('0x24')](function(_0x570702){return _0x570702;});}return null;};}function removeEntity(_0x1d2d56,_0x321b6e){return function(_0x132dfe){if(_0x132dfe){return _0x132dfe[_0x3d8d('0x25')]()['then'](function(){var _0x889cd1=_0x132dfe[_0x3d8d('0x26')]({'plain':!![]});var _0x4b3eac='ExtractedReports';return db[_0x3d8d('0x27')][_0x3d8d('0x25')]({'where':{'type':_0x4b3eac,'resourceId':_0x889cd1['id']}})[_0x3d8d('0x24')](function(){return _0x132dfe;});})[_0x3d8d('0x24')](function(){_0x1d2d56['status'](0xcc)[_0x3d8d('0x1b')]();});}};}function handleEntityNotFound(_0x43a25c,_0x191aa5){return function(_0x453b81){if(!_0x453b81){_0x43a25c['sendStatus'](0x194);}return _0x453b81;};}function handleError(_0x3020ec,_0x53841a){_0x53841a=_0x53841a||0x1f4;return function(_0x421077){logger[_0x3d8d('0x28')](_0x421077[_0x3d8d('0x29')]);if(_0x421077[_0x3d8d('0x2a')]){delete _0x421077[_0x3d8d('0x2a')];}_0x3020ec['status'](_0x53841a)['send'](_0x421077);};}exports[_0x3d8d('0x2b')]=function(_0x1cf8c3,_0x6b303c){var _0x39fd84={},_0x9e394b={},_0xc2bd08={'count':0x0,'rows':[]};var _0x52fd77=_[_0x3d8d('0x2c')](db['AnalyticExtractedReport'][_0x3d8d('0x2d')],function(_0x542e95){return{'name':_0x542e95[_0x3d8d('0x2e')],'type':_0x542e95[_0x3d8d('0x2f')][_0x3d8d('0x30')]};});_0x9e394b[_0x3d8d('0x31')]=_[_0x3d8d('0x2c')](_0x52fd77,_0x3d8d('0x2a'));_0x9e394b[_0x3d8d('0x32')]=_['keys'](_0x1cf8c3[_0x3d8d('0x32')]);_0x9e394b[_0x3d8d('0x33')]=_[_0x3d8d('0x34')](_0x9e394b[_0x3d8d('0x31')],_0x9e394b[_0x3d8d('0x32')]);_0x39fd84[_0x3d8d('0x35')]=_[_0x3d8d('0x34')](_0x9e394b['model'],qs[_0x3d8d('0x36')](_0x1cf8c3[_0x3d8d('0x32')]['fields']));_0x39fd84[_0x3d8d('0x35')]=_0x39fd84[_0x3d8d('0x35')][_0x3d8d('0x37')]?_0x39fd84[_0x3d8d('0x35')]:_0x9e394b[_0x3d8d('0x31')];if(!_0x1cf8c3[_0x3d8d('0x32')][_0x3d8d('0x38')](_0x3d8d('0x39'))){_0x39fd84[_0x3d8d('0x3a')]=qs['limit'](_0x1cf8c3['query'][_0x3d8d('0x3a')]);_0x39fd84[_0x3d8d('0x1c')]=qs['offset'](_0x1cf8c3[_0x3d8d('0x32')][_0x3d8d('0x1c')]);}_0x39fd84[_0x3d8d('0x3b')]=qs[_0x3d8d('0x3c')](_0x1cf8c3[_0x3d8d('0x32')]['sort']);_0x39fd84[_0x3d8d('0x3d')]=qs[_0x3d8d('0x33')](_['pick'](_0x1cf8c3['query'],_0x9e394b[_0x3d8d('0x33')]),_0x52fd77);if(_0x1cf8c3['query'][_0x3d8d('0x3e')]){_0x39fd84['where']=_['merge'](_0x39fd84[_0x3d8d('0x3d')],{'$or':_['map'](_0x52fd77,function(_0x1b473c){if(_0x1b473c[_0x3d8d('0x2f')]!==_0x3d8d('0x3f')){var _0x3ddb95={};_0x3ddb95[_0x1b473c[_0x3d8d('0x2a')]]={'$like':'%'+_0x1cf8c3[_0x3d8d('0x32')]['filter']+'%'};return _0x3ddb95;}})});}_0x39fd84=_[_0x3d8d('0x40')]({},_0x39fd84,_0x1cf8c3[_0x3d8d('0x41')]);var _0x5e68d0={'where':_0x39fd84['where']};return db[_0x3d8d('0x42')]['count'](_0x5e68d0)[_0x3d8d('0x24')](function(_0x269c9c){_0xc2bd08[_0x3d8d('0x43')]=_0x269c9c;if(_0x1cf8c3[_0x3d8d('0x32')][_0x3d8d('0x44')]){_0x39fd84[_0x3d8d('0x45')]=[{'all':!![]}];}return db[_0x3d8d('0x42')][_0x3d8d('0x46')](_0x39fd84);})[_0x3d8d('0x24')](function(_0x2955bb){_0xc2bd08[_0x3d8d('0x47')]=_0x2955bb;return _0xc2bd08;})[_0x3d8d('0x24')](respondWithFilteredResult(_0x6b303c,_0x39fd84))[_0x3d8d('0x48')](handleError(_0x6b303c,null));};exports[_0x3d8d('0x49')]=function(_0x4b210e,_0x10128e){var _0x88655a={'raw':!![],'where':{'id':_0x4b210e[_0x3d8d('0x4a')]['id']}},_0x477f31={};_0x477f31[_0x3d8d('0x31')]=_[_0x3d8d('0x4b')](db[_0x3d8d('0x42')][_0x3d8d('0x2d')]);_0x477f31[_0x3d8d('0x32')]=_[_0x3d8d('0x4b')](_0x4b210e[_0x3d8d('0x32')]);_0x477f31[_0x3d8d('0x33')]=_[_0x3d8d('0x34')](_0x477f31[_0x3d8d('0x31')],_0x477f31[_0x3d8d('0x32')]);_0x88655a[_0x3d8d('0x35')]=_[_0x3d8d('0x34')](_0x477f31['model'],qs['fields'](_0x4b210e[_0x3d8d('0x32')][_0x3d8d('0x36')]));_0x88655a['attributes']=_0x88655a[_0x3d8d('0x35')]['length']?_0x88655a[_0x3d8d('0x35')]:_0x477f31[_0x3d8d('0x31')];if(_0x4b210e[_0x3d8d('0x32')][_0x3d8d('0x44')]){_0x88655a[_0x3d8d('0x45')]=[{'all':!![]}];}_0x88655a=_[_0x3d8d('0x40')]({},_0x88655a,_0x4b210e[_0x3d8d('0x41')]);return db['AnalyticExtractedReport'][_0x3d8d('0x4c')](_0x88655a)[_0x3d8d('0x24')](handleEntityNotFound(_0x10128e,null))[_0x3d8d('0x24')](respondWithResult(_0x10128e,null))['catch'](handleError(_0x10128e,null));};exports[_0x3d8d('0x4d')]=function(_0x1887b5,_0x939f4f){return db['AnalyticExtractedReport'][_0x3d8d('0x4d')](_0x1887b5[_0x3d8d('0x4e')],{})[_0x3d8d('0x24')](function(_0x37678a){var _0x14a57c=_0x1887b5[_0x3d8d('0x4f')][_0x3d8d('0x26')]({'plain':!![]});if(!_0x14a57c)throw new Error(_0x3d8d('0x50'));if(_0x14a57c['role']===_0x3d8d('0x4f')){var _0x10f3ed=_0x37678a[_0x3d8d('0x26')]({'plain':!![]});var _0x51a799='ExtractedReports';return db[_0x3d8d('0x51')]['find']({'where':{'name':_0x51a799,'userProfileId':_0x14a57c['userProfileId']},'raw':!![]})[_0x3d8d('0x24')](function(_0x590ded){if(_0x590ded&&_0x590ded[_0x3d8d('0x52')]===0x0){return db[_0x3d8d('0x27')]['create']({'name':_0x10f3ed['name'],'resourceId':_0x10f3ed['id'],'type':_0x590ded[_0x3d8d('0x2a')],'sectionId':_0x590ded['id']},{})[_0x3d8d('0x24')](function(){return _0x37678a;});}else{return _0x37678a;}})['catch'](function(_0x15f301){logger['error'](_0x3d8d('0x53'),_0x15f301);throw _0x15f301;});}return _0x37678a;})[_0x3d8d('0x24')](respondWithResult(_0x939f4f,0xc9))[_0x3d8d('0x48')](handleError(_0x939f4f,null));};exports[_0x3d8d('0x23')]=function(_0x1dbb61,_0x1b3f37){if(_0x1dbb61[_0x3d8d('0x4e')]['id']){delete _0x1dbb61[_0x3d8d('0x4e')]['id'];}return db[_0x3d8d('0x42')]['find']({'where':{'id':_0x1dbb61[_0x3d8d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b3f37,null))['then'](saveUpdates(_0x1dbb61[_0x3d8d('0x4e')],null))[_0x3d8d('0x24')](respondWithResult(_0x1b3f37,null))[_0x3d8d('0x48')](handleError(_0x1b3f37,null));};exports[_0x3d8d('0x25')]=function(_0x3b2666,_0xcb0147){return db[_0x3d8d('0x42')][_0x3d8d('0x4c')]({'where':{'id':_0x3b2666['params']['id']}})[_0x3d8d('0x24')](handleEntityNotFound(_0xcb0147,null))[_0x3d8d('0x24')](removeEntity(_0xcb0147,null))[_0x3d8d('0x48')](handleError(_0xcb0147,null));};exports['download']=function(_0x501252,_0x2a3d09,_0x59b295){return db[_0x3d8d('0x42')][_0x3d8d('0x4c')]({'where':{'id':_0x501252[_0x3d8d('0x4a')]['id']},'attributes':[_0x3d8d('0x2a'),_0x3d8d('0x54'),_0x3d8d('0x55'),'output'],'raw':!![]})[_0x3d8d('0x24')](handleEntityNotFound(_0x2a3d09,null))[_0x3d8d('0x24')](function(_0x549c3c){if(_0x549c3c){if(!fs[_0x3d8d('0x56')](path['join'](config['root'],_0x3d8d('0x57'),_0x549c3c[_0x3d8d('0x55')]))){throw new db[(_0x3d8d('0x58'))][(_0x3d8d('0x59'))](_0x3d8d('0x5a'));}if(_0x501252[_0x3d8d('0x32')]['exists']){return _0x2a3d09['sendStatus'](0xc8);}return _0x2a3d09['download'](path[_0x3d8d('0x5b')](config[_0x3d8d('0x5c')],_0x3d8d('0x57'),_0x549c3c[_0x3d8d('0x55')]),util[_0x3d8d('0x5d')]('%s.%s',_0x549c3c[_0x3d8d('0x54')]||_0x549c3c[_0x3d8d('0x2a')],_0x549c3c['output']['toLowerCase']()));}})[_0x3d8d('0x48')](handleError(_0x2a3d09,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5318f9a..ad268d2 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 _0x2564=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','moment','bluebird','request-promise','path'];(function(_0x19facb,_0x127eb9){var _0x5dfaff=function(_0x4c2cfd){while(--_0x4c2cfd){_0x19facb['push'](_0x19facb['shift']());}};_0x5dfaff(++_0x127eb9);}(_0x2564,0x126));var _0x4256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2564[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4256('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4256('0x1'));var moment=require(_0x4256('0x2'));var BPromise=require(_0x4256('0x3'));var rp=require(_0x4256('0x4'));var fs=require('fs');var path=require(_0x4256('0x5'));var rimraf=require('rimraf');var config=require(_0x4256('0x6'));var attributes=require(_0x4256('0x7'));module[_0x4256('0x8')]=function(_0x49f2ae,_0x2598b3){return _0x49f2ae[_0x4256('0x9')](_0x4256('0xa'),attributes,{'tableName':_0x4256('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x783c=['bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment'];(function(_0x4ddb9a,_0x2f072b){var _0xddb9a1=function(_0x3ee3f5){while(--_0x3ee3f5){_0x4ddb9a['push'](_0x4ddb9a['shift']());}};_0xddb9a1(++_0x2f072b);}(_0x783c,0xcd));var _0xc783=function(_0x5bc928,_0x53bf6c){_0x5bc928=_0x5bc928-0x0;var _0x35e2b9=_0x783c[_0x5bc928];return _0x35e2b9;};'use strict';var _=require(_0xc783('0x0'));var util=require('util');var logger=require(_0xc783('0x1'))(_0xc783('0x2'));var moment=require(_0xc783('0x3'));var BPromise=require(_0xc783('0x4'));var rp=require(_0xc783('0x5'));var fs=require('fs');var path=require(_0xc783('0x6'));var rimraf=require('rimraf');var config=require(_0xc783('0x7'));var attributes=require(_0xc783('0x8'));module['exports']=function(_0x162bc7,_0x3bde5a){return _0x162bc7['define'](_0xc783('0x9'),attributes,{'tableName':_0xc783('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 0072b42..7e34850 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 _0x655d=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e5877,_0x4ffbf5){var _0x1f2a36=function(_0x68eb7e){while(--_0x68eb7e){_0x3e5877['push'](_0x3e5877['shift']());}};_0x1f2a36(++_0x4ffbf5);}(_0x655d,0x186));var _0xd655=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x655d[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xd655('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd655('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd655('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd655('0x3'));var logger=require(_0xd655('0x4'))(_0xd655('0x5'));var config=require(_0xd655('0x6'));var jayson=require(_0xd655('0x7'));var client=jayson[_0xd655('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51db60,_0x3a9ab2,_0x2b775f){return new BPromise(function(_0xc3228b,_0x26b9fa){return client[_0xd655('0x9')](_0x51db60,_0x2b775f)[_0xd655('0xa')](function(_0x394fd0){logger[_0xd655('0xb')](_0xd655('0xc'),_0x3a9ab2,'request\x20sent');logger[_0xd655('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3a9ab2,_0xd655('0xe'),JSON[_0xd655('0xf')](_0x394fd0));if(_0x394fd0[_0xd655('0x10')]){if(_0x394fd0['error'][_0xd655('0x11')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3a9ab2,_0x394fd0[_0xd655('0x10')][_0xd655('0x12')]);return _0x26b9fa(_0x394fd0[_0xd655('0x10')][_0xd655('0x12')]);}logger[_0xd655('0x10')](_0xd655('0xc'),_0x3a9ab2,_0x394fd0[_0xd655('0x10')][_0xd655('0x12')]);return _0xc3228b(_0x394fd0[_0xd655('0x10')][_0xd655('0x12')]);}else{logger[_0xd655('0xb')](_0xd655('0xc'),_0x3a9ab2,_0xd655('0xe'));_0xc3228b(_0x394fd0[_0xd655('0x13')][_0xd655('0x12')]);}})[_0xd655('0x14')](function(_0x2c33ec){logger['error'](_0xd655('0xc'),_0x3a9ab2,_0x2c33ec);_0x26b9fa(_0x2c33ec);});});} \ No newline at end of file +var _0x33e0=['AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x392f82,_0x4dc713){var _0x3ad0b8=function(_0x29da4b){while(--_0x29da4b){_0x392f82['push'](_0x392f82['shift']());}};_0x3ad0b8(++_0x4dc713);}(_0x33e0,0x88));var _0x033e=function(_0x4c7697,_0x3794af){_0x4c7697=_0x4c7697-0x0;var _0x427891=_0x33e0[_0x4c7697];return _0x427891;};'use strict';var _=require(_0x033e('0x0'));var util=require(_0x033e('0x1'));var moment=require(_0x033e('0x2'));var BPromise=require(_0x033e('0x3'));var rs=require(_0x033e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x033e('0x5'))['db'];var utils=require(_0x033e('0x6'));var logger=require(_0x033e('0x7'))(_0x033e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x033e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x261963,_0x1d3590,_0x5784bd){return new BPromise(function(_0x4040f5,_0x24a489){return client[_0x033e('0xa')](_0x261963,_0x5784bd)[_0x033e('0xb')](function(_0x2b0162){logger[_0x033e('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d3590,_0x033e('0xd'));logger[_0x033e('0xe')](_0x033e('0xf'),_0x1d3590,_0x033e('0xd'),JSON['stringify'](_0x2b0162));if(_0x2b0162[_0x033e('0x10')]){if(_0x2b0162[_0x033e('0x10')][_0x033e('0x11')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d3590,_0x2b0162[_0x033e('0x10')]['message']);return _0x24a489(_0x2b0162['error']['message']);}logger[_0x033e('0x10')](_0x033e('0x12'),_0x1d3590,_0x2b0162[_0x033e('0x10')][_0x033e('0x13')]);return _0x4040f5(_0x2b0162['error'][_0x033e('0x13')]);}else{logger[_0x033e('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d3590,_0x033e('0xd'));_0x4040f5(_0x2b0162[_0x033e('0x14')]['message']);}})[_0x033e('0x15')](function(_0x11e524){logger[_0x033e('0x10')](_0x033e('0x12'),_0x1d3590,_0x11e524);_0x24a489(_0x11e524);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index f1fb167..ed8ffed 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 _0x7a57=['/:id','delete','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put'];(function(_0x17327e,_0x1fac1b){var _0x35b009=function(_0x2e881e){while(--_0x2e881e){_0x17327e['push'](_0x17327e['shift']());}};_0x35b009(++_0x1fac1b);}(_0x7a57,0x89));var _0x77a5=function(_0x18617b,_0x458e97){_0x18617b=_0x18617b-0x0;var _0x25a9c5=_0x7a57[_0x18617b];return _0x25a9c5;};'use strict';var multer=require(_0x77a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x77a5('0x1'));var express=require(_0x77a5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x77a5('0x3'));var config=require(_0x77a5('0x4'));var controller=require(_0x77a5('0x5'));router[_0x77a5('0x6')]('/',auth[_0x77a5('0x7')](),controller[_0x77a5('0x8')]);router[_0x77a5('0x6')]('/:id',auth[_0x77a5('0x7')](),controller[_0x77a5('0x9')]);router[_0x77a5('0x6')](_0x77a5('0xa'),auth[_0x77a5('0x7')](),controller[_0x77a5('0xb')]);router[_0x77a5('0xc')]('/',auth[_0x77a5('0x7')](),controller[_0x77a5('0xd')]);router[_0x77a5('0xe')](_0x77a5('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x77a5('0x10')](_0x77a5('0xf'),auth['isAuthenticated'](),controller[_0x77a5('0x11')]);module[_0x77a5('0x12')]=router; \ No newline at end of file +var _0x4889=['show','/:id/download','download','post','create','update','delete','exports','multer','path','connect-timeout','Router','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id'];(function(_0x5b8cf2,_0x244949){var _0x1cb461=function(_0x4ed542){while(--_0x4ed542){_0x5b8cf2['push'](_0x5b8cf2['shift']());}};_0x1cb461(++_0x244949);}(_0x4889,0x194));var _0x9488=function(_0x47b409,_0x4fb731){_0x47b409=_0x47b409-0x0;var _0x2fdefb=_0x4889[_0x47b409];return _0x2fdefb;};'use strict';var multer=require(_0x9488('0x0'));var util=require('util');var path=require(_0x9488('0x1'));var timeout=require(_0x9488('0x2'));var express=require('express');var router=express[_0x9488('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9488('0x4'));var controller=require(_0x9488('0x5'));router[_0x9488('0x6')]('/',auth[_0x9488('0x7')](),controller[_0x9488('0x8')]);router[_0x9488('0x6')](_0x9488('0x9'),auth[_0x9488('0x7')](),controller[_0x9488('0xa')]);router[_0x9488('0x6')](_0x9488('0xb'),auth[_0x9488('0x7')](),controller[_0x9488('0xc')]);router[_0x9488('0xd')]('/',auth[_0x9488('0x7')](),controller[_0x9488('0xe')]);router['put'](_0x9488('0x9'),auth[_0x9488('0x7')](),controller[_0x9488('0xf')]);router[_0x9488('0x10')](_0x9488('0x9'),auth[_0x9488('0x7')](),controller['destroy']);module[_0x9488('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a2c435c..fc754cb 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4d3cd8,_0x197a8a){var _0xcda034=function(_0x44c178){while(--_0x44c178){_0x4d3cd8['push'](_0x4d3cd8['shift']());}};_0xcda034(++_0x197a8a);}(_0x1261,0x144));var _0x1126=function(_0x4a9801,_0x548afb){_0x4a9801=_0x4a9801-0x0;var _0x2b089a=_0x1261[_0x4a9801];return _0x2b089a;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING'];(function(_0x3dd3f5,_0x478793){var _0x5097d6=function(_0x365bbf){while(--_0x365bbf){_0x3dd3f5['push'](_0x3dd3f5['shift']());}};_0x5097d6(++_0x478793);}(_0xe14b,0x93));var _0xbe14=function(_0x599fa4,_0x36a365){_0x599fa4=_0x599fa4-0x0;var _0x342fd3=_0xe14b[_0x599fa4];return _0x342fd3;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 800f443..06db48a 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 _0x2034=['sendStatus','status','end','json','count','offset','set','reject','save','update','then','error','stack','name','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','find','catch','create','bulkCreate','body','destroy','bulkDestroy','addFields','findOne','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x512891,_0x46005a){var _0x1c190c=function(_0x42b95b){while(--_0x42b95b){_0x512891['push'](_0x512891['shift']());}};_0x1c190c(++_0x46005a);}(_0x2034,0x123));var _0x4203=function(_0x50d39b,_0x4223c0){_0x50d39b=_0x50d39b-0x0;var _0x1116ff=_0x2034[_0x50d39b];return _0x1116ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4203('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4203('0x1'));var jsonpatch=require(_0x4203('0x2'));var rp=require(_0x4203('0x3'));var moment=require(_0x4203('0x4'));var BPromise=require(_0x4203('0x5'));var Mustache=require(_0x4203('0x6'));var util=require(_0x4203('0x7'));var path=require(_0x4203('0x8'));var sox=require('sox');var csv=require(_0x4203('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4203('0xa'));var squel=require('squel');var crypto=require(_0x4203('0xb'));var jsforce=require(_0x4203('0xc'));var deskjs=require(_0x4203('0xd'));var toCsv=require(_0x4203('0x9'));var querystring=require(_0x4203('0xe'));var Papa=require(_0x4203('0xf'));var Redis=require(_0x4203('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4203('0x11'));var as=require(_0x4203('0x12'));var hardwareService=require(_0x4203('0x13'));var logger=require(_0x4203('0x14'))(_0x4203('0x15'));var utils=require(_0x4203('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4203('0x17'));var db=require(_0x4203('0x18'))['db'];function respondWithStatusCode(_0x148e7a,_0x3e0c31){_0x3e0c31=_0x3e0c31||0xcc;return function(_0x59757b){if(_0x59757b){return _0x148e7a[_0x4203('0x19')](_0x3e0c31);}return _0x148e7a[_0x4203('0x1a')](_0x3e0c31)[_0x4203('0x1b')]();};}function respondWithResult(_0x26870f,_0x27e800){_0x27e800=_0x27e800||0xc8;return function(_0x27e6f9){if(_0x27e6f9){return _0x26870f[_0x4203('0x1a')](_0x27e800)[_0x4203('0x1c')](_0x27e6f9);}};}function respondWithFilteredResult(_0x35bcb0,_0x554fb3){return function(_0x12bf85){if(_0x12bf85){var _0x5522c8=_0x12bf85[_0x4203('0x1d')],_0x32ce70=_0x554fb3['offset'],_0xd4a021=_0x554fb3[_0x4203('0x1e')]+_0x554fb3['limit'],_0x546af3;if(_0xd4a021>=_0x5522c8){_0xd4a021=_0x5522c8;_0x546af3=0xc8;}else{_0x546af3=0xce;}_0x35bcb0[_0x4203('0x1a')](_0x546af3);return _0x35bcb0[_0x4203('0x1f')]('Content-Range',_0x32ce70+'-'+_0xd4a021+'/'+_0x5522c8)['json'](_0x12bf85);}return null;};}function patchUpdates(_0xcc8449){return function(_0x1ad624){try{jsonpatch['apply'](_0x1ad624,_0xcc8449,!![]);}catch(_0x48b444){return BPromise[_0x4203('0x20')](_0x48b444);}return _0x1ad624[_0x4203('0x21')]();};}function saveUpdates(_0x5c07df,_0x22a54e){return function(_0x1c1859){if(_0x1c1859){return _0x1c1859[_0x4203('0x22')](_0x5c07df)[_0x4203('0x23')](function(_0x12913b){return _0x12913b;});}return null;};}function removeEntity(_0x379768,_0x2e0395){return function(_0x24ce4d){if(_0x24ce4d){return _0x24ce4d['destroy']()['then'](function(){_0x379768[_0x4203('0x1a')](0xcc)[_0x4203('0x1b')]();});}};}function handleEntityNotFound(_0x2695ca,_0x4de138){return function(_0x27983d){if(!_0x27983d){_0x2695ca[_0x4203('0x19')](0x194);}return _0x27983d;};}function handleError(_0x58081f,_0x5db3de){_0x5db3de=_0x5db3de||0x1f4;return function(_0x52a016){logger[_0x4203('0x24')](_0x52a016[_0x4203('0x25')]);if(_0x52a016[_0x4203('0x26')]){delete _0x52a016[_0x4203('0x26')];}_0x58081f['status'](_0x5db3de)['send'](_0x52a016);};}exports['index']=function(_0x191425,_0x2d08f5){var _0x5422c4={},_0x2f72ed={},_0x34a276={'count':0x0,'rows':[]};var _0x1c2881=_['map'](db[_0x4203('0x27')][_0x4203('0x28')],function(_0x4cf68d){return{'name':_0x4cf68d[_0x4203('0x29')],'type':_0x4cf68d[_0x4203('0x2a')][_0x4203('0x2b')]};});_0x2f72ed[_0x4203('0x2c')]=_[_0x4203('0x2d')](_0x1c2881,_0x4203('0x26'));_0x2f72ed[_0x4203('0x2e')]=_[_0x4203('0x2f')](_0x191425[_0x4203('0x2e')]);_0x2f72ed[_0x4203('0x30')]=_['intersection'](_0x2f72ed[_0x4203('0x2c')],_0x2f72ed['query']);_0x5422c4[_0x4203('0x31')]=_[_0x4203('0x32')](_0x2f72ed['model'],qs[_0x4203('0x33')](_0x191425[_0x4203('0x2e')]['fields']));_0x5422c4[_0x4203('0x31')]=_0x5422c4[_0x4203('0x31')][_0x4203('0x34')]?_0x5422c4[_0x4203('0x31')]:_0x2f72ed[_0x4203('0x2c')];if(!_0x191425[_0x4203('0x2e')][_0x4203('0x35')](_0x4203('0x36'))){_0x5422c4[_0x4203('0x37')]=qs[_0x4203('0x37')](_0x191425[_0x4203('0x2e')][_0x4203('0x37')]);_0x5422c4['offset']=qs[_0x4203('0x1e')](_0x191425[_0x4203('0x2e')][_0x4203('0x1e')]);}_0x5422c4[_0x4203('0x38')]=qs[_0x4203('0x39')](_0x191425[_0x4203('0x2e')][_0x4203('0x39')]);_0x5422c4['where']=qs[_0x4203('0x30')](_[_0x4203('0x3a')](_0x191425['query'],_0x2f72ed[_0x4203('0x30')]),_0x1c2881);if(_0x191425[_0x4203('0x2e')][_0x4203('0x3b')]){_0x5422c4[_0x4203('0x3c')]=_[_0x4203('0x3d')](_0x5422c4['where'],{'$or':_[_0x4203('0x2d')](_0x1c2881,function(_0x3810b1){if(_0x3810b1[_0x4203('0x2a')]!==_0x4203('0x3e')){var _0x4e7d7c={};_0x4e7d7c[_0x3810b1[_0x4203('0x26')]]={'$like':'%'+_0x191425[_0x4203('0x2e')][_0x4203('0x3b')]+'%'};return _0x4e7d7c;}})});}_0x5422c4=_[_0x4203('0x3d')]({},_0x5422c4,_0x191425['options']);var _0x2db186={'where':_0x5422c4[_0x4203('0x3c')]};return db[_0x4203('0x27')][_0x4203('0x1d')](_0x2db186)[_0x4203('0x23')](function(_0x272c8f){_0x34a276[_0x4203('0x1d')]=_0x272c8f;if(_0x191425[_0x4203('0x2e')][_0x4203('0x3f')]){_0x5422c4[_0x4203('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4203('0x41')](_0x5422c4);})[_0x4203('0x23')](function(_0x4878ee){_0x34a276['rows']=_0x4878ee;return _0x34a276;})['then'](respondWithFilteredResult(_0x2d08f5,_0x5422c4))['catch'](handleError(_0x2d08f5,null));};exports[_0x4203('0x42')]=function(_0x147fdf,_0x2a6d9d){var _0x546073={'raw':![],'where':{'id':_0x147fdf[_0x4203('0x43')]['id']}},_0xc22245={};_0xc22245[_0x4203('0x2c')]=_['keys'](db[_0x4203('0x27')][_0x4203('0x28')]);_0xc22245['query']=_[_0x4203('0x2f')](_0x147fdf[_0x4203('0x2e')]);_0xc22245['filters']=_['intersection'](_0xc22245[_0x4203('0x2c')],_0xc22245[_0x4203('0x2e')]);_0x546073[_0x4203('0x31')]=_[_0x4203('0x32')](_0xc22245[_0x4203('0x2c')],qs['fields'](_0x147fdf['query']['fields']));_0x546073[_0x4203('0x31')]=_0x546073[_0x4203('0x31')]['length']?_0x546073[_0x4203('0x31')]:_0xc22245[_0x4203('0x2c')];if(_0x147fdf[_0x4203('0x2e')][_0x4203('0x3f')]){_0x546073['include']=[{'all':!![]}];}_0x546073=_[_0x4203('0x3d')]({},_0x546073,_0x147fdf['options']);return db['AnalyticFieldReport'][_0x4203('0x44')](_0x546073)[_0x4203('0x23')](handleEntityNotFound(_0x2a6d9d,null))[_0x4203('0x23')](respondWithResult(_0x2a6d9d,null))[_0x4203('0x45')](handleError(_0x2a6d9d,null));};exports[_0x4203('0x46')]=function(_0x289417,_0x53297f){return db[_0x4203('0x27')]['create'](_0x289417['body'],{})['then'](respondWithResult(_0x53297f,0xc9))[_0x4203('0x45')](handleError(_0x53297f,null));};exports[_0x4203('0x47')]=function(_0x3f1510,_0x2ea274){return db[_0x4203('0x27')][_0x4203('0x47')](_0x3f1510[_0x4203('0x48')],{'raw':![],'individualHooks':!![]})[_0x4203('0x23')](respondWithResult(_0x2ea274,0xc9))[_0x4203('0x45')](handleError(_0x2ea274,null));};exports[_0x4203('0x22')]=function(_0x12c300,_0x45125f){if(_0x12c300[_0x4203('0x48')]['id']){delete _0x12c300[_0x4203('0x48')]['id'];}return db['AnalyticFieldReport'][_0x4203('0x44')]({'where':{'id':_0x12c300[_0x4203('0x43')]['id']}})['then'](handleEntityNotFound(_0x45125f,null))[_0x4203('0x23')](saveUpdates(_0x12c300[_0x4203('0x48')],null))[_0x4203('0x23')](respondWithResult(_0x45125f,null))[_0x4203('0x45')](handleError(_0x45125f,null));};exports[_0x4203('0x49')]=function(_0x336a5c,_0x16fd34){return db[_0x4203('0x27')][_0x4203('0x44')]({'where':{'id':_0x336a5c[_0x4203('0x43')]['id']}})[_0x4203('0x23')](handleEntityNotFound(_0x16fd34,null))['then'](removeEntity(_0x16fd34,null))[_0x4203('0x45')](handleError(_0x16fd34,null));};exports[_0x4203('0x4a')]=function(_0x24bf34,_0x1e16a0){return db[_0x4203('0x27')]['destroy']({'where':{'id':_0x24bf34[_0x4203('0x2e')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x4203('0x23')](respondWithResult(_0x1e16a0,0xcc))[_0x4203('0x45')](handleError(_0x1e16a0,null));};exports[_0x4203('0x4b')]=function(_0x33571e,_0x7a5e1e,_0x23fe8c){return db['AnalyticCustomReport'][_0x4203('0x4c')]({'where':{'id':_0x33571e[_0x4203('0x43')]['id']}})[_0x4203('0x23')](handleEntityNotFound(_0x7a5e1e,null))[_0x4203('0x23')](function(_0x369234){if(_0x369234){return db[_0x4203('0x4d')]['transaction'](function(_0x487627){return db[_0x4203('0x27')][_0x4203('0x49')]({'where':{'CustomReportId':_0x33571e[_0x4203('0x43')]['id']},'transaction':_0x487627})[_0x4203('0x23')](function(_0x466f93){var _0x60d9c5=_['map'](_0x33571e[_0x4203('0x48')],function(_0x4a2b26){delete _0x4a2b26['id'];_0x4a2b26[_0x4203('0x4e')]=_0x33571e['params']['id'];return _0x4a2b26;});return db['AnalyticFieldReport']['bulkCreate'](_0x60d9c5,{'transaction':_0x487627});});})['then'](function(){return db[_0x4203('0x27')][_0x4203('0x41')]({'where':{'CustomReportId':_0x33571e[_0x4203('0x43')]['id']}});});}})[_0x4203('0x23')](respondWithResult(_0x7a5e1e,null))['catch'](handleError(_0x7a5e1e,null));}; \ No newline at end of file +var _0x4223=['hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','bulkCreate','update','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x4223,0x71));var _0x3422=function(_0x5c9bed,_0x17fdd8){_0x5c9bed=_0x5c9bed-0x0;var _0x1c9971=_0x4223[_0x5c9bed];return _0x1c9971;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3422('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3422('0x1'));var jsonpatch=require(_0x3422('0x2'));var rp=require(_0x3422('0x3'));var moment=require('moment');var BPromise=require(_0x3422('0x4'));var Mustache=require(_0x3422('0x5'));var util=require(_0x3422('0x6'));var path=require('path');var sox=require(_0x3422('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3422('0x8'));var squel=require(_0x3422('0x9'));var crypto=require(_0x3422('0xa'));var jsforce=require(_0x3422('0xb'));var deskjs=require(_0x3422('0xc'));var toCsv=require(_0x3422('0xd'));var querystring=require(_0x3422('0xe'));var Papa=require(_0x3422('0xf'));var Redis=require(_0x3422('0x10'));var authService=require(_0x3422('0x11'));var qs=require(_0x3422('0x12'));var as=require(_0x3422('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3422('0x14'))(_0x3422('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3422('0x16'));var db=require(_0x3422('0x17'))['db'];function respondWithStatusCode(_0x25ee03,_0x291268){_0x291268=_0x291268||0xcc;return function(_0x514928){if(_0x514928){return _0x25ee03[_0x3422('0x18')](_0x291268);}return _0x25ee03[_0x3422('0x19')](_0x291268)[_0x3422('0x1a')]();};}function respondWithResult(_0xcd2498,_0x46f6bd){_0x46f6bd=_0x46f6bd||0xc8;return function(_0x36bf36){if(_0x36bf36){return _0xcd2498[_0x3422('0x19')](_0x46f6bd)[_0x3422('0x1b')](_0x36bf36);}};}function respondWithFilteredResult(_0x1f8fe1,_0xe57b1f){return function(_0x3c1bc8){if(_0x3c1bc8){var _0x4b9239=_0x3c1bc8[_0x3422('0x1c')],_0x47cf9c=_0xe57b1f[_0x3422('0x1d')],_0xf6d2d5=_0xe57b1f['offset']+_0xe57b1f['limit'],_0x3c92d9;if(_0xf6d2d5>=_0x4b9239){_0xf6d2d5=_0x4b9239;_0x3c92d9=0xc8;}else{_0x3c92d9=0xce;}_0x1f8fe1['status'](_0x3c92d9);return _0x1f8fe1['set'](_0x3422('0x1e'),_0x47cf9c+'-'+_0xf6d2d5+'/'+_0x4b9239)[_0x3422('0x1b')](_0x3c1bc8);}return null;};}function patchUpdates(_0x55bf2f){return function(_0x47e006){try{jsonpatch[_0x3422('0x1f')](_0x47e006,_0x55bf2f,!![]);}catch(_0x462248){return BPromise[_0x3422('0x20')](_0x462248);}return _0x47e006[_0x3422('0x21')]();};}function saveUpdates(_0x6b5ad,_0xbf8768){return function(_0x1bb6fa){if(_0x1bb6fa){return _0x1bb6fa['update'](_0x6b5ad)[_0x3422('0x22')](function(_0x183f7d){return _0x183f7d;});}return null;};}function removeEntity(_0x3d5edd,_0x12af8c){return function(_0xe21ed3){if(_0xe21ed3){return _0xe21ed3[_0x3422('0x23')]()[_0x3422('0x22')](function(){_0x3d5edd[_0x3422('0x19')](0xcc)[_0x3422('0x1a')]();});}};}function handleEntityNotFound(_0xdbe028,_0x93f563){return function(_0x4bc71c){if(!_0x4bc71c){_0xdbe028[_0x3422('0x18')](0x194);}return _0x4bc71c;};}function handleError(_0x327b2e,_0x3aaaf8){_0x3aaaf8=_0x3aaaf8||0x1f4;return function(_0x580b10){logger[_0x3422('0x24')](_0x580b10['stack']);if(_0x580b10[_0x3422('0x25')]){delete _0x580b10['name'];}_0x327b2e[_0x3422('0x19')](_0x3aaaf8)[_0x3422('0x26')](_0x580b10);};}exports[_0x3422('0x27')]=function(_0x5cb716,_0x1e5701){var _0x2bc72d={},_0x2391ba={},_0x4738f8={'count':0x0,'rows':[]};var _0xbc8ded=_[_0x3422('0x28')](db[_0x3422('0x29')]['rawAttributes'],function(_0x189520){return{'name':_0x189520[_0x3422('0x2a')],'type':_0x189520[_0x3422('0x2b')][_0x3422('0x2c')]};});_0x2391ba[_0x3422('0x2d')]=_[_0x3422('0x28')](_0xbc8ded,_0x3422('0x25'));_0x2391ba[_0x3422('0x2e')]=_[_0x3422('0x2f')](_0x5cb716['query']);_0x2391ba[_0x3422('0x30')]=_[_0x3422('0x31')](_0x2391ba[_0x3422('0x2d')],_0x2391ba[_0x3422('0x2e')]);_0x2bc72d[_0x3422('0x32')]=_['intersection'](_0x2391ba[_0x3422('0x2d')],qs['fields'](_0x5cb716[_0x3422('0x2e')][_0x3422('0x33')]));_0x2bc72d[_0x3422('0x32')]=_0x2bc72d['attributes'][_0x3422('0x34')]?_0x2bc72d[_0x3422('0x32')]:_0x2391ba[_0x3422('0x2d')];if(!_0x5cb716['query'][_0x3422('0x35')](_0x3422('0x36'))){_0x2bc72d[_0x3422('0x37')]=qs[_0x3422('0x37')](_0x5cb716[_0x3422('0x2e')]['limit']);_0x2bc72d['offset']=qs[_0x3422('0x1d')](_0x5cb716['query'][_0x3422('0x1d')]);}_0x2bc72d['order']=qs[_0x3422('0x38')](_0x5cb716[_0x3422('0x2e')]['sort']);_0x2bc72d['where']=qs[_0x3422('0x30')](_[_0x3422('0x39')](_0x5cb716[_0x3422('0x2e')],_0x2391ba[_0x3422('0x30')]),_0xbc8ded);if(_0x5cb716[_0x3422('0x2e')][_0x3422('0x3a')]){_0x2bc72d[_0x3422('0x3b')]=_[_0x3422('0x3c')](_0x2bc72d['where'],{'$or':_[_0x3422('0x28')](_0xbc8ded,function(_0xd3eeb1){if(_0xd3eeb1[_0x3422('0x2b')]!==_0x3422('0x3d')){var _0x1811a7={};_0x1811a7[_0xd3eeb1['name']]={'$like':'%'+_0x5cb716['query']['filter']+'%'};return _0x1811a7;}})});}_0x2bc72d=_[_0x3422('0x3c')]({},_0x2bc72d,_0x5cb716[_0x3422('0x3e')]);var _0x489b5b={'where':_0x2bc72d[_0x3422('0x3b')]};return db[_0x3422('0x29')][_0x3422('0x1c')](_0x489b5b)[_0x3422('0x22')](function(_0x504c66){_0x4738f8[_0x3422('0x1c')]=_0x504c66;if(_0x5cb716[_0x3422('0x2e')][_0x3422('0x3f')]){_0x2bc72d[_0x3422('0x40')]=[{'all':!![]}];}return db[_0x3422('0x29')]['findAll'](_0x2bc72d);})[_0x3422('0x22')](function(_0x5431ea){_0x4738f8[_0x3422('0x41')]=_0x5431ea;return _0x4738f8;})[_0x3422('0x22')](respondWithFilteredResult(_0x1e5701,_0x2bc72d))[_0x3422('0x42')](handleError(_0x1e5701,null));};exports[_0x3422('0x43')]=function(_0x2c08d7,_0xf76b4d){var _0xa1c782={'raw':![],'where':{'id':_0x2c08d7[_0x3422('0x44')]['id']}},_0x23d6b8={};_0x23d6b8['model']=_['keys'](db[_0x3422('0x29')][_0x3422('0x45')]);_0x23d6b8[_0x3422('0x2e')]=_['keys'](_0x2c08d7[_0x3422('0x2e')]);_0x23d6b8[_0x3422('0x30')]=_[_0x3422('0x31')](_0x23d6b8['model'],_0x23d6b8[_0x3422('0x2e')]);_0xa1c782[_0x3422('0x32')]=_[_0x3422('0x31')](_0x23d6b8[_0x3422('0x2d')],qs[_0x3422('0x33')](_0x2c08d7[_0x3422('0x2e')][_0x3422('0x33')]));_0xa1c782[_0x3422('0x32')]=_0xa1c782[_0x3422('0x32')][_0x3422('0x34')]?_0xa1c782[_0x3422('0x32')]:_0x23d6b8['model'];if(_0x2c08d7['query']['includeAll']){_0xa1c782['include']=[{'all':!![]}];}_0xa1c782=_[_0x3422('0x3c')]({},_0xa1c782,_0x2c08d7[_0x3422('0x3e')]);return db['AnalyticFieldReport'][_0x3422('0x46')](_0xa1c782)[_0x3422('0x22')](handleEntityNotFound(_0xf76b4d,null))[_0x3422('0x22')](respondWithResult(_0xf76b4d,null))[_0x3422('0x42')](handleError(_0xf76b4d,null));};exports[_0x3422('0x47')]=function(_0x41dfd5,_0x3491cb){return db['AnalyticFieldReport'][_0x3422('0x47')](_0x41dfd5[_0x3422('0x48')],{})['then'](respondWithResult(_0x3491cb,0xc9))[_0x3422('0x42')](handleError(_0x3491cb,null));};exports['bulkCreate']=function(_0xefba4a,_0x48922a){return db[_0x3422('0x29')][_0x3422('0x49')](_0xefba4a[_0x3422('0x48')],{'raw':![],'individualHooks':!![]})[_0x3422('0x22')](respondWithResult(_0x48922a,0xc9))[_0x3422('0x42')](handleError(_0x48922a,null));};exports[_0x3422('0x4a')]=function(_0x4ef3f3,_0x5592cf){if(_0x4ef3f3[_0x3422('0x48')]['id']){delete _0x4ef3f3[_0x3422('0x48')]['id'];}return db[_0x3422('0x29')][_0x3422('0x46')]({'where':{'id':_0x4ef3f3[_0x3422('0x44')]['id']}})[_0x3422('0x22')](handleEntityNotFound(_0x5592cf,null))[_0x3422('0x22')](saveUpdates(_0x4ef3f3[_0x3422('0x48')],null))[_0x3422('0x22')](respondWithResult(_0x5592cf,null))[_0x3422('0x42')](handleError(_0x5592cf,null));};exports['destroy']=function(_0x565603,_0x31b96e){return db[_0x3422('0x29')][_0x3422('0x46')]({'where':{'id':_0x565603[_0x3422('0x44')]['id']}})['then'](handleEntityNotFound(_0x31b96e,null))[_0x3422('0x22')](removeEntity(_0x31b96e,null))[_0x3422('0x42')](handleError(_0x31b96e,null));};exports['bulkDestroy']=function(_0x38dc97,_0x16307b){return db[_0x3422('0x29')]['destroy']({'where':{'id':_0x38dc97['query'][_0x3422('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x3422('0x22')](respondWithResult(_0x16307b,0xcc))[_0x3422('0x42')](handleError(_0x16307b,null));};exports[_0x3422('0x4c')]=function(_0x5673a0,_0xb90e29,_0x364524){return db[_0x3422('0x4d')][_0x3422('0x4e')]({'where':{'id':_0x5673a0[_0x3422('0x44')]['id']}})[_0x3422('0x22')](handleEntityNotFound(_0xb90e29,null))[_0x3422('0x22')](function(_0x171633){if(_0x171633){return db[_0x3422('0x4f')][_0x3422('0x50')](function(_0x2e0476){return db[_0x3422('0x29')][_0x3422('0x23')]({'where':{'CustomReportId':_0x5673a0[_0x3422('0x44')]['id']},'transaction':_0x2e0476})[_0x3422('0x22')](function(_0x769f86){var _0x9183c4=_['map'](_0x5673a0['body'],function(_0x421729){delete _0x421729['id'];_0x421729[_0x3422('0x51')]=_0x5673a0[_0x3422('0x44')]['id'];return _0x421729;});return db[_0x3422('0x29')][_0x3422('0x49')](_0x9183c4,{'transaction':_0x2e0476});});})['then'](function(){return db[_0x3422('0x29')][_0x3422('0x52')]({'where':{'CustomReportId':_0x5673a0[_0x3422('0x44')]['id']}});});}})[_0x3422('0x22')](respondWithResult(_0xb90e29,null))[_0x3422('0x42')](handleError(_0xb90e29,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f93bfb3..afb9bf8 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 _0x623f=['exports','define','AnalyticFieldReport','lodash','util','api','moment','request-promise','path','../../config/environment','./analyticFieldReport.attributes'];(function(_0x247d4a,_0xa354f2){var _0xeb2a92=function(_0x25d776){while(--_0x25d776){_0x247d4a['push'](_0x247d4a['shift']());}};_0xeb2a92(++_0xa354f2);}(_0x623f,0x1d1));var _0xf623=function(_0x2304fb,_0x126873){_0x2304fb=_0x2304fb-0x0;var _0x22ed8b=_0x623f[_0x2304fb];return _0x22ed8b;};'use strict';var _=require(_0xf623('0x0'));var util=require(_0xf623('0x1'));var logger=require('../../config/logger')(_0xf623('0x2'));var moment=require(_0xf623('0x3'));var BPromise=require('bluebird');var rp=require(_0xf623('0x4'));var fs=require('fs');var path=require(_0xf623('0x5'));var rimraf=require('rimraf');var config=require(_0xf623('0x6'));var attributes=require(_0xf623('0x7'));module[_0xf623('0x8')]=function(_0x5e49cc,_0x56deb7){return _0x5e49cc[_0xf623('0x9')](_0xf623('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe97d=['request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x493ac3,_0x477ec7){var _0x1d852a=function(_0x2816fe){while(--_0x2816fe){_0x493ac3['push'](_0x493ac3['shift']());}};_0x1d852a(++_0x477ec7);}(_0xe97d,0xd9));var _0xde97=function(_0x7a65c9,_0x310caf){_0x7a65c9=_0x7a65c9-0x0;var _0x35bc4b=_0xe97d[_0x7a65c9];return _0x35bc4b;};'use strict';var _=require(_0xde97('0x0'));var util=require(_0xde97('0x1'));var logger=require(_0xde97('0x2'))(_0xde97('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde97('0x4'));var fs=require('fs');var path=require(_0xde97('0x5'));var rimraf=require(_0xde97('0x6'));var config=require(_0xde97('0x7'));var attributes=require(_0xde97('0x8'));module[_0xde97('0x9')]=function(_0xc96695,_0x86d483){return _0xc96695[_0xde97('0xa')](_0xde97('0xb'),attributes,{'tableName':_0xde97('0xc'),'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 a936c26..8b948cb 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 _0x086e=['error','code','message','result','catch','lodash','moment','randomstring','rpc','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x086e,0x137));var _0xe086=function(_0x2be1ab,_0x2fe1fc){_0x2be1ab=_0x2be1ab-0x0;var _0x4c616d=_0x086e[_0x2be1ab];return _0x4c616d;};'use strict';var _=require(_0xe086('0x0'));var util=require('util');var moment=require(_0xe086('0x1'));var BPromise=require('bluebird');var rs=require(_0xe086('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe086('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe086('0x4')][_0xe086('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3debf1,_0x18211e,_0x2c3eee){return new BPromise(function(_0x1b9929,_0x4a5aef){return client[_0xe086('0x6')](_0x3debf1,_0x2c3eee)[_0xe086('0x7')](function(_0x423b2a){logger[_0xe086('0x8')](_0xe086('0x9'),_0x18211e,_0xe086('0xa'));logger['debug'](_0xe086('0xb'),_0x18211e,_0xe086('0xa'),JSON[_0xe086('0xc')](_0x423b2a));if(_0x423b2a[_0xe086('0xd')]){if(_0x423b2a[_0xe086('0xd')][_0xe086('0xe')]===0x1f4){logger[_0xe086('0xd')](_0xe086('0x9'),_0x18211e,_0x423b2a[_0xe086('0xd')][_0xe086('0xf')]);return _0x4a5aef(_0x423b2a[_0xe086('0xd')][_0xe086('0xf')]);}logger[_0xe086('0xd')](_0xe086('0x9'),_0x18211e,_0x423b2a[_0xe086('0xd')][_0xe086('0xf')]);return _0x1b9929(_0x423b2a[_0xe086('0xd')]['message']);}else{logger[_0xe086('0x8')](_0xe086('0x9'),_0x18211e,'request\x20sent');_0x1b9929(_0x423b2a[_0xe086('0x10')][_0xe086('0xf')]);}})[_0xe086('0x11')](function(_0x1ad982){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x18211e,_0x1ad982);_0x4a5aef(_0x1ad982);});});} \ No newline at end of file +var _0x20d3=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa09079,_0x19c780){var _0xd13b26=function(_0x1f8304){while(--_0x1f8304){_0xa09079['push'](_0xa09079['shift']());}};_0xd13b26(++_0x19c780);}(_0x20d3,0x15f));var _0x320d=function(_0x375d77,_0x393984){_0x375d77=_0x375d77-0x0;var _0x25d072=_0x20d3[_0x375d77];return _0x25d072;};'use strict';var _=require(_0x320d('0x0'));var util=require(_0x320d('0x1'));var moment=require(_0x320d('0x2'));var BPromise=require(_0x320d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x320d('0x4'));var db=require(_0x320d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x320d('0x6'))(_0x320d('0x7'));var config=require(_0x320d('0x8'));var jayson=require(_0x320d('0x9'));var client=jayson['client'][_0x320d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13e946,_0xc40a17,_0x57cc74){return new BPromise(function(_0x561f7d,_0x2fee5e){return client[_0x320d('0xb')](_0x13e946,_0x57cc74)[_0x320d('0xc')](function(_0x13edee){logger[_0x320d('0xd')](_0x320d('0xe'),_0xc40a17,_0x320d('0xf'));logger[_0x320d('0x10')](_0x320d('0x11'),_0xc40a17,'request\x20sent',JSON[_0x320d('0x12')](_0x13edee));if(_0x13edee[_0x320d('0x13')]){if(_0x13edee[_0x320d('0x13')][_0x320d('0x14')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xc40a17,_0x13edee[_0x320d('0x13')][_0x320d('0x15')]);return _0x2fee5e(_0x13edee[_0x320d('0x13')][_0x320d('0x15')]);}logger['error'](_0x320d('0xe'),_0xc40a17,_0x13edee['error'][_0x320d('0x15')]);return _0x561f7d(_0x13edee['error'][_0x320d('0x15')]);}else{logger[_0x320d('0xd')](_0x320d('0xe'),_0xc40a17,'request\x20sent');_0x561f7d(_0x13edee[_0x320d('0x16')][_0x320d('0x15')]);}})['catch'](function(_0x2902ae){logger[_0x320d('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0xc40a17,_0x2902ae);_0x2fee5e(_0x2902ae);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c1b3c30..56f68da 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x326f,0xd1));var _0xf326=function(_0x33184a,_0x2de630){_0x33184a=_0x33184a-0x0;var _0x5e1ec5=_0x326f[_0x33184a];return _0x5e1ec5;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 233afa3..7fc9046 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 _0x9153=['TEXT','sequelize','exports','STRING','name'];(function(_0x4932ae,_0x2769c6){var _0x5f9e5d=function(_0x577324){while(--_0x577324){_0x4932ae['push'](_0x4932ae['shift']());}};_0x5f9e5d(++_0x2769c6);}(_0x9153,0xd8));var _0x3915=function(_0x17db5e,_0x584bd7){_0x17db5e=_0x17db5e-0x0;var _0x4abb15=_0x9153[_0x17db5e];return _0x4abb15;};'use strict';var Sequelize=require(_0x3915('0x0'));module[_0x3915('0x1')]={'name':{'type':Sequelize[_0x3915('0x2')],'allowNull':![],'unique':_0x3915('0x3')},'table':{'type':Sequelize[_0x3915('0x2')]},'metric':{'type':Sequelize[_0x3915('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x138d=['STRING','TEXT','sequelize','exports','name'];(function(_0x2cf683,_0x3213de){var _0x5cddff=function(_0x454eed){while(--_0x454eed){_0x2cf683['push'](_0x2cf683['shift']());}};_0x5cddff(++_0x3213de);}(_0x138d,0x1ab));var _0xd138=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x138d[_0x26bcec];return _0x1049dc;};'use strict';var Sequelize=require(_0xd138('0x0'));module[_0xd138('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd138('0x2')},'table':{'type':Sequelize[_0xd138('0x3')]},'metric':{'type':Sequelize[_0xd138('0x4')]},'description':{'type':Sequelize[_0xd138('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7eb7d3c..40323c2 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 _0xd350=['destroy','html-pdf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','get','UserProfileResource','end','stack','name','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0xeef94c,_0x1db3f7){var _0x447522=function(_0x16d3d5){while(--_0x16d3d5){_0xeef94c['push'](_0xeef94c['shift']());}};_0x447522(++_0x1db3f7);}(_0xd350,0xf4));var _0x0d35=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0xd350[_0x239b31];return _0x41c8be;};'use strict';var pdf=require(_0x0d35('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d35('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d35('0x2'));var moment=require(_0x0d35('0x3'));var BPromise=require(_0x0d35('0x4'));var Mustache=require('mustache');var util=require(_0x0d35('0x5'));var path=require(_0x0d35('0x6'));var sox=require(_0x0d35('0x7'));var csv=require(_0x0d35('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0d35('0x9'));var crypto=require(_0x0d35('0xa'));var jsforce=require(_0x0d35('0xb'));var deskjs=require(_0x0d35('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0d35('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d35('0xe'));var qs=require(_0x0d35('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d35('0x10'));var logger=require(_0x0d35('0x11'))(_0x0d35('0x12'));var utils=require(_0x0d35('0x13'));var config=require(_0x0d35('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d35('0x15'))['db'];function respondWithStatusCode(_0x36a157,_0x2cfe16){_0x2cfe16=_0x2cfe16||0xcc;return function(_0x2e4b09){if(_0x2e4b09){return _0x36a157[_0x0d35('0x16')](_0x2cfe16);}return _0x36a157[_0x0d35('0x17')](_0x2cfe16)['end']();};}function respondWithResult(_0x204d5f,_0x5685ef){_0x5685ef=_0x5685ef||0xc8;return function(_0x1eceac){if(_0x1eceac){return _0x204d5f['status'](_0x5685ef)['json'](_0x1eceac);}};}function respondWithFilteredResult(_0x4d6f04,_0x183554){return function(_0x4c2314){if(_0x4c2314){var _0x42db40=_0x4c2314[_0x0d35('0x18')],_0x573afd=_0x183554['offset'],_0xed2a14=_0x183554[_0x0d35('0x19')]+_0x183554[_0x0d35('0x1a')],_0x38969b;if(_0xed2a14>=_0x42db40){_0xed2a14=_0x42db40;_0x38969b=0xc8;}else{_0x38969b=0xce;}_0x4d6f04['status'](_0x38969b);return _0x4d6f04[_0x0d35('0x1b')](_0x0d35('0x1c'),_0x573afd+'-'+_0xed2a14+'/'+_0x42db40)[_0x0d35('0x1d')](_0x4c2314);}return null;};}function patchUpdates(_0x396a7d){return function(_0x4c806b){try{jsonpatch[_0x0d35('0x1e')](_0x4c806b,_0x396a7d,!![]);}catch(_0x3e19c6){return BPromise[_0x0d35('0x1f')](_0x3e19c6);}return _0x4c806b[_0x0d35('0x20')]();};}function saveUpdates(_0x20c260,_0x2bf031){return function(_0x5ad0e6){if(_0x5ad0e6){return _0x5ad0e6['update'](_0x20c260)['then'](function(_0x1a20db){return _0x1a20db;});}return null;};}function removeEntity(_0x2b1d37,_0xdc62b9){return function(_0x4d4468){if(_0x4d4468){return _0x4d4468['destroy']()[_0x0d35('0x21')](function(){var _0x583075=_0x4d4468[_0x0d35('0x22')]({'plain':!![]});var _0x2fd404='Metrics';return db[_0x0d35('0x23')]['destroy']({'where':{'type':_0x2fd404,'resourceId':_0x583075['id']}})['then'](function(){return _0x4d4468;});})['then'](function(){_0x2b1d37[_0x0d35('0x17')](0xcc)[_0x0d35('0x24')]();});}};}function handleEntityNotFound(_0x3b39ca,_0x2b3249){return function(_0x3a7e00){if(!_0x3a7e00){_0x3b39ca[_0x0d35('0x16')](0x194);}return _0x3a7e00;};}function handleError(_0x1180b1,_0x566e30){_0x566e30=_0x566e30||0x1f4;return function(_0x11dd5c){logger['error'](_0x11dd5c[_0x0d35('0x25')]);if(_0x11dd5c[_0x0d35('0x26')]){delete _0x11dd5c[_0x0d35('0x26')];}_0x1180b1[_0x0d35('0x17')](_0x566e30)['send'](_0x11dd5c);};}exports[_0x0d35('0x27')]=function(_0x398ba8,_0x37dc7d){var _0x1e0d06={},_0x3e2ee8={},_0x12899f={'count':0x0,'rows':[]};var _0x54582c=_[_0x0d35('0x28')](db[_0x0d35('0x29')]['rawAttributes'],function(_0x3fec86){return{'name':_0x3fec86[_0x0d35('0x2a')],'type':_0x3fec86[_0x0d35('0x2b')][_0x0d35('0x2c')]};});_0x3e2ee8[_0x0d35('0x2d')]=_['map'](_0x54582c,_0x0d35('0x26'));_0x3e2ee8[_0x0d35('0x2e')]=_[_0x0d35('0x2f')](_0x398ba8['query']);_0x3e2ee8[_0x0d35('0x30')]=_[_0x0d35('0x31')](_0x3e2ee8[_0x0d35('0x2d')],_0x3e2ee8[_0x0d35('0x2e')]);_0x1e0d06[_0x0d35('0x32')]=_['intersection'](_0x3e2ee8[_0x0d35('0x2d')],qs['fields'](_0x398ba8[_0x0d35('0x2e')]['fields']));_0x1e0d06[_0x0d35('0x32')]=_0x1e0d06['attributes'][_0x0d35('0x33')]?_0x1e0d06['attributes']:_0x3e2ee8['model'];if(!_0x398ba8[_0x0d35('0x2e')]['hasOwnProperty']('nolimit')){_0x1e0d06[_0x0d35('0x1a')]=qs['limit'](_0x398ba8['query'][_0x0d35('0x1a')]);_0x1e0d06['offset']=qs[_0x0d35('0x19')](_0x398ba8['query']['offset']);}_0x1e0d06[_0x0d35('0x34')]=qs[_0x0d35('0x35')](_0x398ba8[_0x0d35('0x2e')][_0x0d35('0x35')]);_0x1e0d06[_0x0d35('0x36')]=qs[_0x0d35('0x30')](_[_0x0d35('0x37')](_0x398ba8[_0x0d35('0x2e')],_0x3e2ee8[_0x0d35('0x30')]),_0x54582c);if(_0x398ba8[_0x0d35('0x2e')][_0x0d35('0x38')]){_0x1e0d06[_0x0d35('0x36')]=_[_0x0d35('0x39')](_0x1e0d06[_0x0d35('0x36')],{'$or':_[_0x0d35('0x28')](_0x54582c,function(_0x1f2a5d){if(_0x1f2a5d['type']!==_0x0d35('0x3a')){var _0x2548a4={};_0x2548a4[_0x1f2a5d[_0x0d35('0x26')]]={'$like':'%'+_0x398ba8[_0x0d35('0x2e')][_0x0d35('0x38')]+'%'};return _0x2548a4;}})});}_0x1e0d06=_['merge']({},_0x1e0d06,_0x398ba8[_0x0d35('0x3b')]);var _0x2f3dc8={'where':_0x1e0d06[_0x0d35('0x36')]};return db['AnalyticMetric'][_0x0d35('0x18')](_0x2f3dc8)[_0x0d35('0x21')](function(_0x2dcb7c){_0x12899f[_0x0d35('0x18')]=_0x2dcb7c;if(_0x398ba8[_0x0d35('0x2e')]['includeAll']){_0x1e0d06[_0x0d35('0x3c')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x0d35('0x3d')](_0x1e0d06);})[_0x0d35('0x21')](function(_0x43beed){_0x12899f[_0x0d35('0x3e')]=_0x43beed;return _0x12899f;})[_0x0d35('0x21')](respondWithFilteredResult(_0x37dc7d,_0x1e0d06))[_0x0d35('0x3f')](handleError(_0x37dc7d,null));};exports['show']=function(_0x406175,_0x1fc1cd){var _0x9b9a36={'raw':!![],'where':{'id':_0x406175[_0x0d35('0x40')]['id']}},_0x369793={};_0x369793[_0x0d35('0x2d')]=_[_0x0d35('0x2f')](db[_0x0d35('0x29')][_0x0d35('0x41')]);_0x369793[_0x0d35('0x2e')]=_[_0x0d35('0x2f')](_0x406175['query']);_0x369793[_0x0d35('0x30')]=_['intersection'](_0x369793[_0x0d35('0x2d')],_0x369793[_0x0d35('0x2e')]);_0x9b9a36[_0x0d35('0x32')]=_['intersection'](_0x369793[_0x0d35('0x2d')],qs['fields'](_0x406175[_0x0d35('0x2e')][_0x0d35('0x42')]));_0x9b9a36['attributes']=_0x9b9a36[_0x0d35('0x32')][_0x0d35('0x33')]?_0x9b9a36['attributes']:_0x369793[_0x0d35('0x2d')];if(_0x406175[_0x0d35('0x2e')][_0x0d35('0x43')]){_0x9b9a36['include']=[{'all':!![]}];}_0x9b9a36=_[_0x0d35('0x39')]({},_0x9b9a36,_0x406175[_0x0d35('0x3b')]);return db[_0x0d35('0x29')][_0x0d35('0x44')](_0x9b9a36)[_0x0d35('0x21')](handleEntityNotFound(_0x1fc1cd,null))['then'](respondWithResult(_0x1fc1cd,null))[_0x0d35('0x3f')](handleError(_0x1fc1cd,null));};exports[_0x0d35('0x45')]=function(_0x350be3,_0x91cd5a){return db[_0x0d35('0x29')][_0x0d35('0x45')](_0x350be3[_0x0d35('0x46')],{})[_0x0d35('0x21')](function(_0x19c252){var _0x25ef2b=_0x350be3[_0x0d35('0x47')]['get']({'plain':!![]});if(!_0x25ef2b)throw new Error(_0x0d35('0x48'));if(_0x25ef2b[_0x0d35('0x49')]===_0x0d35('0x47')){var _0x39a336=_0x19c252[_0x0d35('0x22')]({'plain':!![]});var _0x1accdb=_0x0d35('0x4a');return db[_0x0d35('0x4b')][_0x0d35('0x44')]({'where':{'name':_0x1accdb,'userProfileId':_0x25ef2b[_0x0d35('0x4c')]},'raw':!![]})['then'](function(_0x275d2e){if(_0x275d2e&&_0x275d2e[_0x0d35('0x4d')]===0x0){return db[_0x0d35('0x23')][_0x0d35('0x45')]({'name':_0x39a336[_0x0d35('0x26')],'resourceId':_0x39a336['id'],'type':_0x275d2e[_0x0d35('0x26')],'sectionId':_0x275d2e['id']},{})[_0x0d35('0x21')](function(){return _0x19c252;});}else{return _0x19c252;}})[_0x0d35('0x3f')](function(_0x54f295){logger['error'](_0x0d35('0x4e'),_0x54f295);throw _0x54f295;});}return _0x19c252;})[_0x0d35('0x21')](respondWithResult(_0x91cd5a,0xc9))[_0x0d35('0x3f')](handleError(_0x91cd5a,null));};exports[_0x0d35('0x4f')]=function(_0x174d49,_0x51eb18){if(_0x174d49['body']['id']){delete _0x174d49[_0x0d35('0x46')]['id'];}return db['AnalyticMetric'][_0x0d35('0x44')]({'where':{'id':_0x174d49[_0x0d35('0x40')]['id']}})[_0x0d35('0x21')](handleEntityNotFound(_0x51eb18,null))[_0x0d35('0x21')](saveUpdates(_0x174d49[_0x0d35('0x46')],null))['then'](respondWithResult(_0x51eb18,null))['catch'](handleError(_0x51eb18,null));};exports[_0x0d35('0x50')]=function(_0x9c6c68,_0x51af04){return db[_0x0d35('0x29')][_0x0d35('0x44')]({'where':{'id':_0x9c6c68[_0x0d35('0x40')]['id']}})['then'](handleEntityNotFound(_0x51af04,null))[_0x0d35('0x21')](removeEntity(_0x51af04,null))[_0x0d35('0x3f')](handleError(_0x51af04,null));}; \ No newline at end of file +var _0xf587=['options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','where','merge','VIRTUAL'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xf587,0xb1));var _0x7f58=function(_0x3b938e,_0x330cf6){_0x3b938e=_0x3b938e-0x0;var _0x4fdbff=_0xf587[_0x3b938e];return _0x4fdbff;};'use strict';var pdf=require(_0x7f58('0x0'));var emlformat=require(_0x7f58('0x1'));var rimraf=require(_0x7f58('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f58('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f58('0x4'));var Mustache=require(_0x7f58('0x5'));var util=require(_0x7f58('0x6'));var path=require(_0x7f58('0x7'));var sox=require(_0x7f58('0x8'));var csv=require(_0x7f58('0x9'));var ejs=require(_0x7f58('0xa'));var fs=require('fs');var _=require(_0x7f58('0xb'));var squel=require(_0x7f58('0xc'));var crypto=require(_0x7f58('0xd'));var jsforce=require(_0x7f58('0xe'));var deskjs=require(_0x7f58('0xf'));var toCsv=require(_0x7f58('0x9'));var querystring=require('querystring');var Papa=require(_0x7f58('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f58('0x11'));var as=require(_0x7f58('0x12'));var hardwareService=require(_0x7f58('0x13'));var logger=require('../../config/logger')(_0x7f58('0x14'));var utils=require(_0x7f58('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7f58('0x16'));var db=require(_0x7f58('0x17'))['db'];function respondWithStatusCode(_0x41db56,_0x114913){_0x114913=_0x114913||0xcc;return function(_0x56e747){if(_0x56e747){return _0x41db56[_0x7f58('0x18')](_0x114913);}return _0x41db56[_0x7f58('0x19')](_0x114913)[_0x7f58('0x1a')]();};}function respondWithResult(_0x4e9c70,_0x954d7c){_0x954d7c=_0x954d7c||0xc8;return function(_0x4f3c71){if(_0x4f3c71){return _0x4e9c70[_0x7f58('0x19')](_0x954d7c)['json'](_0x4f3c71);}};}function respondWithFilteredResult(_0x56b57b,_0x48b46f){return function(_0x2931c6){if(_0x2931c6){var _0xd00e1f=_0x2931c6[_0x7f58('0x1b')],_0x1d711b=_0x48b46f[_0x7f58('0x1c')],_0x4ab2ab=_0x48b46f[_0x7f58('0x1c')]+_0x48b46f[_0x7f58('0x1d')],_0x3d3a5e;if(_0x4ab2ab>=_0xd00e1f){_0x4ab2ab=_0xd00e1f;_0x3d3a5e=0xc8;}else{_0x3d3a5e=0xce;}_0x56b57b['status'](_0x3d3a5e);return _0x56b57b[_0x7f58('0x1e')](_0x7f58('0x1f'),_0x1d711b+'-'+_0x4ab2ab+'/'+_0xd00e1f)[_0x7f58('0x20')](_0x2931c6);}return null;};}function patchUpdates(_0x5e6ff9){return function(_0x2fe71b){try{jsonpatch[_0x7f58('0x21')](_0x2fe71b,_0x5e6ff9,!![]);}catch(_0x475a20){return BPromise['reject'](_0x475a20);}return _0x2fe71b[_0x7f58('0x22')]();};}function saveUpdates(_0xf10483,_0x1dfbef){return function(_0x283fb5){if(_0x283fb5){return _0x283fb5[_0x7f58('0x23')](_0xf10483)[_0x7f58('0x24')](function(_0x331a8d){return _0x331a8d;});}return null;};}function removeEntity(_0x48dc42,_0x55eab3){return function(_0x593265){if(_0x593265){return _0x593265[_0x7f58('0x25')]()['then'](function(){var _0x529d60=_0x593265[_0x7f58('0x26')]({'plain':!![]});var _0x4e4ce=_0x7f58('0x27');return db[_0x7f58('0x28')][_0x7f58('0x25')]({'where':{'type':_0x4e4ce,'resourceId':_0x529d60['id']}})[_0x7f58('0x24')](function(){return _0x593265;});})[_0x7f58('0x24')](function(){_0x48dc42[_0x7f58('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ddfd,_0x3fcaf5){return function(_0x1cb83f){if(!_0x1cb83f){_0x18ddfd[_0x7f58('0x18')](0x194);}return _0x1cb83f;};}function handleError(_0x176acd,_0x2e37d7){_0x2e37d7=_0x2e37d7||0x1f4;return function(_0x935cb2){logger[_0x7f58('0x29')](_0x935cb2[_0x7f58('0x2a')]);if(_0x935cb2[_0x7f58('0x2b')]){delete _0x935cb2['name'];}_0x176acd[_0x7f58('0x19')](_0x2e37d7)[_0x7f58('0x2c')](_0x935cb2);};}exports[_0x7f58('0x2d')]=function(_0x527de7,_0x23521b){var _0x1a64c9={},_0x648c1c={},_0x3744b9={'count':0x0,'rows':[]};var _0x56d231=_[_0x7f58('0x2e')](db[_0x7f58('0x2f')][_0x7f58('0x30')],function(_0x1d0f48){return{'name':_0x1d0f48[_0x7f58('0x31')],'type':_0x1d0f48[_0x7f58('0x32')][_0x7f58('0x33')]};});_0x648c1c[_0x7f58('0x34')]=_[_0x7f58('0x2e')](_0x56d231,_0x7f58('0x2b'));_0x648c1c[_0x7f58('0x35')]=_[_0x7f58('0x36')](_0x527de7[_0x7f58('0x35')]);_0x648c1c[_0x7f58('0x37')]=_[_0x7f58('0x38')](_0x648c1c['model'],_0x648c1c[_0x7f58('0x35')]);_0x1a64c9['attributes']=_[_0x7f58('0x38')](_0x648c1c[_0x7f58('0x34')],qs['fields'](_0x527de7[_0x7f58('0x35')][_0x7f58('0x39')]));_0x1a64c9['attributes']=_0x1a64c9[_0x7f58('0x3a')]['length']?_0x1a64c9['attributes']:_0x648c1c[_0x7f58('0x34')];if(!_0x527de7[_0x7f58('0x35')]['hasOwnProperty'](_0x7f58('0x3b'))){_0x1a64c9[_0x7f58('0x1d')]=qs[_0x7f58('0x1d')](_0x527de7[_0x7f58('0x35')][_0x7f58('0x1d')]);_0x1a64c9[_0x7f58('0x1c')]=qs[_0x7f58('0x1c')](_0x527de7['query'][_0x7f58('0x1c')]);}_0x1a64c9[_0x7f58('0x3c')]=qs[_0x7f58('0x3d')](_0x527de7['query'][_0x7f58('0x3d')]);_0x1a64c9['where']=qs['filters'](_[_0x7f58('0x3e')](_0x527de7[_0x7f58('0x35')],_0x648c1c[_0x7f58('0x37')]),_0x56d231);if(_0x527de7[_0x7f58('0x35')]['filter']){_0x1a64c9[_0x7f58('0x3f')]=_[_0x7f58('0x40')](_0x1a64c9['where'],{'$or':_['map'](_0x56d231,function(_0x115d3c){if(_0x115d3c[_0x7f58('0x32')]!==_0x7f58('0x41')){var _0x32c75d={};_0x32c75d[_0x115d3c[_0x7f58('0x2b')]]={'$like':'%'+_0x527de7[_0x7f58('0x35')]['filter']+'%'};return _0x32c75d;}})});}_0x1a64c9=_[_0x7f58('0x40')]({},_0x1a64c9,_0x527de7[_0x7f58('0x42')]);var _0x27dcea={'where':_0x1a64c9[_0x7f58('0x3f')]};return db[_0x7f58('0x2f')][_0x7f58('0x1b')](_0x27dcea)[_0x7f58('0x24')](function(_0x52fb83){_0x3744b9['count']=_0x52fb83;if(_0x527de7[_0x7f58('0x35')]['includeAll']){_0x1a64c9['include']=[{'all':!![]}];}return db[_0x7f58('0x2f')][_0x7f58('0x43')](_0x1a64c9);})[_0x7f58('0x24')](function(_0x2e83a3){_0x3744b9[_0x7f58('0x44')]=_0x2e83a3;return _0x3744b9;})[_0x7f58('0x24')](respondWithFilteredResult(_0x23521b,_0x1a64c9))[_0x7f58('0x45')](handleError(_0x23521b,null));};exports[_0x7f58('0x46')]=function(_0x598bf7,_0x55a2fd){var _0x55b461={'raw':!![],'where':{'id':_0x598bf7[_0x7f58('0x47')]['id']}},_0x520bb2={};_0x520bb2[_0x7f58('0x34')]=_[_0x7f58('0x36')](db[_0x7f58('0x2f')][_0x7f58('0x30')]);_0x520bb2['query']=_['keys'](_0x598bf7[_0x7f58('0x35')]);_0x520bb2[_0x7f58('0x37')]=_[_0x7f58('0x38')](_0x520bb2[_0x7f58('0x34')],_0x520bb2[_0x7f58('0x35')]);_0x55b461[_0x7f58('0x3a')]=_[_0x7f58('0x38')](_0x520bb2[_0x7f58('0x34')],qs[_0x7f58('0x39')](_0x598bf7[_0x7f58('0x35')][_0x7f58('0x39')]));_0x55b461[_0x7f58('0x3a')]=_0x55b461[_0x7f58('0x3a')]['length']?_0x55b461[_0x7f58('0x3a')]:_0x520bb2['model'];if(_0x598bf7[_0x7f58('0x35')][_0x7f58('0x48')]){_0x55b461[_0x7f58('0x49')]=[{'all':!![]}];}_0x55b461=_[_0x7f58('0x40')]({},_0x55b461,_0x598bf7[_0x7f58('0x42')]);return db[_0x7f58('0x2f')][_0x7f58('0x4a')](_0x55b461)[_0x7f58('0x24')](handleEntityNotFound(_0x55a2fd,null))[_0x7f58('0x24')](respondWithResult(_0x55a2fd,null))['catch'](handleError(_0x55a2fd,null));};exports[_0x7f58('0x4b')]=function(_0x311863,_0x5bc3a9){return db[_0x7f58('0x2f')][_0x7f58('0x4b')](_0x311863[_0x7f58('0x4c')],{})['then'](function(_0x20b07b){var _0x9f8f4=_0x311863[_0x7f58('0x4d')][_0x7f58('0x26')]({'plain':!![]});if(!_0x9f8f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9f8f4[_0x7f58('0x4e')]===_0x7f58('0x4d')){var _0x391782=_0x20b07b[_0x7f58('0x26')]({'plain':!![]});var _0x3e7b6d=_0x7f58('0x27');return db['UserProfileSection'][_0x7f58('0x4a')]({'where':{'name':_0x3e7b6d,'userProfileId':_0x9f8f4[_0x7f58('0x4f')]},'raw':!![]})[_0x7f58('0x24')](function(_0x291d07){if(_0x291d07&&_0x291d07['autoAssociation']===0x0){return db[_0x7f58('0x28')][_0x7f58('0x4b')]({'name':_0x391782[_0x7f58('0x2b')],'resourceId':_0x391782['id'],'type':_0x291d07['name'],'sectionId':_0x291d07['id']},{})['then'](function(){return _0x20b07b;});}else{return _0x20b07b;}})[_0x7f58('0x45')](function(_0x34a427){logger[_0x7f58('0x29')](_0x7f58('0x50'),_0x34a427);throw _0x34a427;});}return _0x20b07b;})['then'](respondWithResult(_0x5bc3a9,0xc9))['catch'](handleError(_0x5bc3a9,null));};exports[_0x7f58('0x23')]=function(_0x36f1de,_0x47f538){if(_0x36f1de[_0x7f58('0x4c')]['id']){delete _0x36f1de[_0x7f58('0x4c')]['id'];}return db['AnalyticMetric'][_0x7f58('0x4a')]({'where':{'id':_0x36f1de['params']['id']}})[_0x7f58('0x24')](handleEntityNotFound(_0x47f538,null))[_0x7f58('0x24')](saveUpdates(_0x36f1de[_0x7f58('0x4c')],null))[_0x7f58('0x24')](respondWithResult(_0x47f538,null))[_0x7f58('0x45')](handleError(_0x47f538,null));};exports[_0x7f58('0x25')]=function(_0x6366ab,_0x351b2a){return db[_0x7f58('0x2f')][_0x7f58('0x4a')]({'where':{'id':_0x6366ab[_0x7f58('0x47')]['id']}})['then'](handleEntityNotFound(_0x351b2a,null))[_0x7f58('0x24')](removeEntity(_0x351b2a,null))['catch'](handleError(_0x351b2a,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b120c70..b849bdc 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 _0x7e5f=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','../../config/logger','api','moment','path','rimraf'];(function(_0x2ae752,_0x460f89){var _0x3fc13a=function(_0xc8b81f){while(--_0xc8b81f){_0x2ae752['push'](_0x2ae752['shift']());}};_0x3fc13a(++_0x460f89);}(_0x7e5f,0x1b3));var _0xf7e5=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x7e5f[_0x4f1da5];return _0xe972a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf7e5('0x0'))(_0xf7e5('0x1'));var moment=require(_0xf7e5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7e5('0x3'));var rimraf=require(_0xf7e5('0x4'));var config=require('../../config/environment');var attributes=require(_0xf7e5('0x5'));module[_0xf7e5('0x6')]=function(_0x4d5c56,_0x4d7aac){return _0x4d5c56[_0xf7e5('0x7')](_0xf7e5('0x8'),attributes,{'tableName':_0xf7e5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0b=['exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3af392,_0xe5e91f){var _0x33be9f=function(_0x3e3a59){while(--_0x3e3a59){_0x3af392['push'](_0x3af392['shift']());}};_0x33be9f(++_0xe5e91f);}(_0x8d0b,0x9f));var _0xb8d0=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x8d0b[_0x38eb23];return _0x48506a;};'use strict';var _=require(_0xb8d0('0x0'));var util=require(_0xb8d0('0x1'));var logger=require(_0xb8d0('0x2'))(_0xb8d0('0x3'));var moment=require('moment');var BPromise=require(_0xb8d0('0x4'));var rp=require(_0xb8d0('0x5'));var fs=require('fs');var path=require(_0xb8d0('0x6'));var rimraf=require(_0xb8d0('0x7'));var config=require(_0xb8d0('0x8'));var attributes=require('./analyticMetric.attributes');module[_0xb8d0('0x9')]=function(_0x386a59,_0x5de4e4){return _0x386a59['define'](_0xb8d0('0xa'),attributes,{'tableName':_0xb8d0('0xb'),'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 06c6437..cde03c0 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 _0x7811=['debug','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x5a17e7,_0x528c7e){var _0xb8e1f1=function(_0x2fd92c){while(--_0x2fd92c){_0x5a17e7['push'](_0x5a17e7['shift']());}};_0xb8e1f1(++_0x528c7e);}(_0x7811,0x1bb));var _0x1781=function(_0x454cbd,_0x436d19){_0x454cbd=_0x454cbd-0x0;var _0x45b4bf=_0x7811[_0x454cbd];return _0x45b4bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1781('0x0'));var BPromise=require(_0x1781('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1781('0x2'));var db=require(_0x1781('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1781('0x4'))(_0x1781('0x5'));var config=require('../../config/environment');var jayson=require(_0x1781('0x6'));var client=jayson[_0x1781('0x7')][_0x1781('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x583d7d,_0x57d709,_0x358998){return new BPromise(function(_0x8cbed5,_0x4c365f){return client['request'](_0x583d7d,_0x358998)[_0x1781('0x9')](function(_0x4ce52d){logger[_0x1781('0xa')](_0x1781('0xb'),_0x57d709,_0x1781('0xc'));logger[_0x1781('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x57d709,_0x1781('0xc'),JSON['stringify'](_0x4ce52d));if(_0x4ce52d[_0x1781('0xe')]){if(_0x4ce52d[_0x1781('0xe')][_0x1781('0xf')]===0x1f4){logger[_0x1781('0xe')](_0x1781('0xb'),_0x57d709,_0x4ce52d[_0x1781('0xe')]['message']);return _0x4c365f(_0x4ce52d[_0x1781('0xe')][_0x1781('0x10')]);}logger[_0x1781('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x57d709,_0x4ce52d[_0x1781('0xe')][_0x1781('0x10')]);return _0x8cbed5(_0x4ce52d[_0x1781('0xe')][_0x1781('0x10')]);}else{logger[_0x1781('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x57d709,_0x1781('0xc'));_0x8cbed5(_0x4ce52d[_0x1781('0x11')][_0x1781('0x10')]);}})[_0x1781('0x12')](function(_0x113a4c){logger[_0x1781('0xe')](_0x1781('0xb'),_0x57d709,_0x113a4c);_0x4c365f(_0x113a4c);});});} \ No newline at end of file +var _0x63e9=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1787d3,_0x3a3305){var _0x42bf5e=function(_0x286adc){while(--_0x286adc){_0x1787d3['push'](_0x1787d3['shift']());}};_0x42bf5e(++_0x3a3305);}(_0x63e9,0xe5));var _0x963e=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x63e9[_0x5eca50];return _0x41fb84;};'use strict';var _=require(_0x963e('0x0'));var util=require(_0x963e('0x1'));var moment=require(_0x963e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x963e('0x3'));var db=require(_0x963e('0x4'))['db'];var utils=require(_0x963e('0x5'));var logger=require(_0x963e('0x6'))('rpc');var config=require(_0x963e('0x7'));var jayson=require(_0x963e('0x8'));var client=jayson[_0x963e('0x9')][_0x963e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x72ee69,_0x545a17,_0x58831a){return new BPromise(function(_0x3aac89,_0x34bab6){return client['request'](_0x72ee69,_0x58831a)[_0x963e('0xb')](function(_0x536dfd){logger[_0x963e('0xc')](_0x963e('0xd'),_0x545a17,_0x963e('0xe'));logger[_0x963e('0xf')](_0x963e('0x10'),_0x545a17,_0x963e('0xe'),JSON[_0x963e('0x11')](_0x536dfd));if(_0x536dfd[_0x963e('0x12')]){if(_0x536dfd['error'][_0x963e('0x13')]===0x1f4){logger[_0x963e('0x12')](_0x963e('0xd'),_0x545a17,_0x536dfd[_0x963e('0x12')]['message']);return _0x34bab6(_0x536dfd[_0x963e('0x12')][_0x963e('0x14')]);}logger[_0x963e('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x545a17,_0x536dfd[_0x963e('0x12')]['message']);return _0x3aac89(_0x536dfd['error'][_0x963e('0x14')]);}else{logger[_0x963e('0xc')](_0x963e('0xd'),_0x545a17,'request\x20sent');_0x3aac89(_0x536dfd[_0x963e('0x15')][_0x963e('0x14')]);}})[_0x963e('0x16')](function(_0x155271){logger[_0x963e('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x545a17,_0x155271);_0x34bab6(_0x155271);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9d740ed..20856e1 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 _0x2ef3=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x282bc2,_0x24039b){var _0x321a85=function(_0x32d790){while(--_0x32d790){_0x282bc2['push'](_0x282bc2['shift']());}};_0x321a85(++_0x24039b);}(_0x2ef3,0xba));var _0x32ef=function(_0xfcce68,_0xb7b928){_0xfcce68=_0xfcce68-0x0;var _0x3f02cc=_0x2ef3[_0xfcce68];return _0x3f02cc;};'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 auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./analyticMetric.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0xc')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0xe')](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xf')]);router['delete']('/:id',auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0x5fab=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x2443a7,_0x558f17){var _0x3181c8=function(_0x4dc071){while(--_0x4dc071){_0x2443a7['push'](_0x2443a7['shift']());}};_0x3181c8(++_0x558f17);}(_0x5fab,0x177));var _0xb5fa=function(_0xe38764,_0x28ce79){_0xe38764=_0xe38764-0x0;var _0x5979cf=_0x5fab[_0xe38764];return _0x5979cf;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')]('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xb')]);router['get']('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')](_0xb5fa('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb5fa('0x11')](_0xb5fa('0x10'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x12')]);module[_0xb5fa('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 5c7d4f9..ba0b883 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 _0xcbf6=['TEXT','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbf6,0x172));var _0x6cbf=function(_0x167a99,_0x1bbb59){_0x167a99=_0x167a99-0x0;var _0x442d62=_0xcbf6[_0x167a99];return _0x442d62;};'use strict';var Sequelize=require(_0x6cbf('0x0'));module[_0x6cbf('0x1')]={'tree':{'type':Sequelize[_0x6cbf('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8780=['sequelize','TEXT'];(function(_0x4bfe57,_0x438f2f){var _0x73bed3=function(_0x2431eb){while(--_0x2431eb){_0x4bfe57['push'](_0x4bfe57['shift']());}};_0x73bed3(++_0x438f2f);}(_0x8780,0x156));var _0x0878=function(_0x58fc2b,_0x368286){_0x58fc2b=_0x58fc2b-0x0;var _0x3937ce=_0x8780[_0x58fc2b];return _0x3937ce;};'use strict';var Sequelize=require(_0x0878('0x0'));module['exports']={'tree':{'type':Sequelize[_0x0878('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index ee1e4a4..bf265e1 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 _0xaf25=['eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','set','json','apply','reject','update','destroy','then','end','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','type','VIRTUAL','includeAll','include','findAll','catch','show','params','merge','options','find','create','body','html-pdf'];(function(_0x262e92,_0x274937){var _0x6d3982=function(_0xbeb53b){while(--_0xbeb53b){_0x262e92['push'](_0x262e92['shift']());}};_0x6d3982(++_0x274937);}(_0xaf25,0x117));var _0x5af2=function(_0x1dc0a4,_0x4e805b){_0x1dc0a4=_0x1dc0a4-0x0;var _0x2eb2f5=_0xaf25[_0x1dc0a4];return _0x2eb2f5;};'use strict';var pdf=require(_0x5af2('0x0'));var emlformat=require(_0x5af2('0x1'));var rimraf=require(_0x5af2('0x2'));var zipdir=require(_0x5af2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5af2('0x4'));var moment=require('moment');var BPromise=require(_0x5af2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5af2('0x6'));var sox=require(_0x5af2('0x7'));var csv=require(_0x5af2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5af2('0x9'));var squel=require(_0x5af2('0xa'));var crypto=require('crypto');var jsforce=require(_0x5af2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5af2('0x8'));var querystring=require(_0x5af2('0xc'));var Papa=require(_0x5af2('0xd'));var Redis=require('ioredis');var authService=require(_0x5af2('0xe'));var qs=require(_0x5af2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5af2('0x10'))('api');var utils=require(_0x5af2('0x11'));var config=require(_0x5af2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5af2('0x13'))['db'];function respondWithStatusCode(_0x2d508d,_0x349fab){_0x349fab=_0x349fab||0xcc;return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2d508d[_0x5af2('0x14')](_0x349fab);}return _0x2d508d[_0x5af2('0x15')](_0x349fab)['end']();};}function respondWithResult(_0x24df02,_0x3b1e0c){_0x3b1e0c=_0x3b1e0c||0xc8;return function(_0x5c6798){if(_0x5c6798){return _0x24df02['status'](_0x3b1e0c)['json'](_0x5c6798);}};}function respondWithFilteredResult(_0x52fb07,_0x3ddf37){return function(_0x37619a){if(_0x37619a){var _0x3237ec=_0x37619a[_0x5af2('0x16')],_0x442c0f=_0x3ddf37['offset'],_0x5657cc=_0x3ddf37['offset']+_0x3ddf37['limit'],_0x3898ce;if(_0x5657cc>=_0x3237ec){_0x5657cc=_0x3237ec;_0x3898ce=0xc8;}else{_0x3898ce=0xce;}_0x52fb07[_0x5af2('0x15')](_0x3898ce);return _0x52fb07[_0x5af2('0x17')]('Content-Range',_0x442c0f+'-'+_0x5657cc+'/'+_0x3237ec)[_0x5af2('0x18')](_0x37619a);}return null;};}function patchUpdates(_0x4a17d1){return function(_0x41dbcc){try{jsonpatch[_0x5af2('0x19')](_0x41dbcc,_0x4a17d1,!![]);}catch(_0xe45eeb){return BPromise[_0x5af2('0x1a')](_0xe45eeb);}return _0x41dbcc['save']();};}function saveUpdates(_0x17b08c,_0x360716){return function(_0x5975c8){if(_0x5975c8){return _0x5975c8[_0x5af2('0x1b')](_0x17b08c)['then'](function(_0x1f8b7a){return _0x1f8b7a;});}return null;};}function removeEntity(_0x28189e,_0x5b74a6){return function(_0x162a6a){if(_0x162a6a){return _0x162a6a[_0x5af2('0x1c')]()[_0x5af2('0x1d')](function(){_0x28189e[_0x5af2('0x15')](0xcc)[_0x5af2('0x1e')]();});}};}function handleEntityNotFound(_0x3919cc,_0x39165e){return function(_0x2552c3){if(!_0x2552c3){_0x3919cc[_0x5af2('0x14')](0x194);}return _0x2552c3;};}function handleError(_0x2b02ef,_0x460251){_0x460251=_0x460251||0x1f4;return function(_0x4e8191){logger[_0x5af2('0x1f')](_0x4e8191[_0x5af2('0x20')]);if(_0x4e8191[_0x5af2('0x21')]){delete _0x4e8191[_0x5af2('0x21')];}_0x2b02ef[_0x5af2('0x15')](_0x460251)[_0x5af2('0x22')](_0x4e8191);};}exports['index']=function(_0x404e81,_0x355c76){var _0x2e8080={},_0x635ba8={},_0x21f68d={'count':0x0,'rows':[]};var _0x3ca159=_[_0x5af2('0x23')](db[_0x5af2('0x24')][_0x5af2('0x25')],function(_0x1c50bd){return{'name':_0x1c50bd[_0x5af2('0x26')],'type':_0x1c50bd['type'][_0x5af2('0x27')]};});_0x635ba8[_0x5af2('0x28')]=_[_0x5af2('0x23')](_0x3ca159,_0x5af2('0x21'));_0x635ba8[_0x5af2('0x29')]=_[_0x5af2('0x2a')](_0x404e81[_0x5af2('0x29')]);_0x635ba8[_0x5af2('0x2b')]=_[_0x5af2('0x2c')](_0x635ba8[_0x5af2('0x28')],_0x635ba8[_0x5af2('0x29')]);_0x2e8080[_0x5af2('0x2d')]=_[_0x5af2('0x2c')](_0x635ba8['model'],qs[_0x5af2('0x2e')](_0x404e81['query'][_0x5af2('0x2e')]));_0x2e8080['attributes']=_0x2e8080['attributes'][_0x5af2('0x2f')]?_0x2e8080['attributes']:_0x635ba8[_0x5af2('0x28')];if(!_0x404e81[_0x5af2('0x29')][_0x5af2('0x30')](_0x5af2('0x31'))){_0x2e8080[_0x5af2('0x32')]=qs[_0x5af2('0x32')](_0x404e81[_0x5af2('0x29')][_0x5af2('0x32')]);_0x2e8080[_0x5af2('0x33')]=qs['offset'](_0x404e81[_0x5af2('0x29')]['offset']);}_0x2e8080[_0x5af2('0x34')]=qs[_0x5af2('0x35')](_0x404e81['query'][_0x5af2('0x35')]);_0x2e8080['where']=qs[_0x5af2('0x2b')](_[_0x5af2('0x36')](_0x404e81[_0x5af2('0x29')],_0x635ba8['filters']),_0x3ca159);if(_0x404e81['query'][_0x5af2('0x37')]){_0x2e8080[_0x5af2('0x38')]=_['merge'](_0x2e8080[_0x5af2('0x38')],{'$or':_[_0x5af2('0x23')](_0x3ca159,function(_0x4d380c){if(_0x4d380c[_0x5af2('0x39')]!==_0x5af2('0x3a')){var _0x35a118={};_0x35a118[_0x4d380c['name']]={'$like':'%'+_0x404e81[_0x5af2('0x29')]['filter']+'%'};return _0x35a118;}})});}_0x2e8080=_['merge']({},_0x2e8080,_0x404e81['options']);var _0x11653e={'where':_0x2e8080['where']};return db[_0x5af2('0x24')][_0x5af2('0x16')](_0x11653e)[_0x5af2('0x1d')](function(_0x2f0977){_0x21f68d[_0x5af2('0x16')]=_0x2f0977;if(_0x404e81[_0x5af2('0x29')][_0x5af2('0x3b')]){_0x2e8080[_0x5af2('0x3c')]=[{'all':!![]}];}return db[_0x5af2('0x24')][_0x5af2('0x3d')](_0x2e8080);})[_0x5af2('0x1d')](function(_0x50713c){_0x21f68d['rows']=_0x50713c;return _0x21f68d;})[_0x5af2('0x1d')](respondWithFilteredResult(_0x355c76,_0x2e8080))[_0x5af2('0x3e')](handleError(_0x355c76,null));};exports[_0x5af2('0x3f')]=function(_0x274c8a,_0x44bbfb){var _0x1c1ad3={'raw':!![],'where':{'id':_0x274c8a[_0x5af2('0x40')]['id']}},_0x54f4e5={};_0x54f4e5[_0x5af2('0x28')]=_[_0x5af2('0x2a')](db[_0x5af2('0x24')][_0x5af2('0x25')]);_0x54f4e5['query']=_[_0x5af2('0x2a')](_0x274c8a[_0x5af2('0x29')]);_0x54f4e5[_0x5af2('0x2b')]=_[_0x5af2('0x2c')](_0x54f4e5[_0x5af2('0x28')],_0x54f4e5[_0x5af2('0x29')]);_0x1c1ad3[_0x5af2('0x2d')]=_[_0x5af2('0x2c')](_0x54f4e5[_0x5af2('0x28')],qs[_0x5af2('0x2e')](_0x274c8a['query'][_0x5af2('0x2e')]));_0x1c1ad3['attributes']=_0x1c1ad3[_0x5af2('0x2d')][_0x5af2('0x2f')]?_0x1c1ad3[_0x5af2('0x2d')]:_0x54f4e5[_0x5af2('0x28')];if(_0x274c8a[_0x5af2('0x29')][_0x5af2('0x3b')]){_0x1c1ad3[_0x5af2('0x3c')]=[{'all':!![]}];}_0x1c1ad3=_[_0x5af2('0x41')]({},_0x1c1ad3,_0x274c8a[_0x5af2('0x42')]);return db['AnalyticTreeReport'][_0x5af2('0x43')](_0x1c1ad3)[_0x5af2('0x1d')](handleEntityNotFound(_0x44bbfb,null))[_0x5af2('0x1d')](respondWithResult(_0x44bbfb,null))[_0x5af2('0x3e')](handleError(_0x44bbfb,null));};exports[_0x5af2('0x44')]=function(_0x127ec1,_0x2fcab7){return db['AnalyticTreeReport'][_0x5af2('0x44')](_0x127ec1['body'],{})['then'](respondWithResult(_0x2fcab7,0xc9))[_0x5af2('0x3e')](handleError(_0x2fcab7,null));};exports[_0x5af2('0x1b')]=function(_0x3c4108,_0x3b5df5){if(_0x3c4108['body']['id']){delete _0x3c4108[_0x5af2('0x45')]['id'];}return db[_0x5af2('0x24')]['find']({'where':{'id':_0x3c4108[_0x5af2('0x40')]['id']}})[_0x5af2('0x1d')](handleEntityNotFound(_0x3b5df5,null))[_0x5af2('0x1d')](saveUpdates(_0x3c4108[_0x5af2('0x45')],null))[_0x5af2('0x1d')](respondWithResult(_0x3b5df5,null))[_0x5af2('0x3e')](handleError(_0x3b5df5,null));};exports[_0x5af2('0x1c')]=function(_0x31a72d,_0x233528){return db[_0x5af2('0x24')][_0x5af2('0x43')]({'where':{'id':_0x31a72d[_0x5af2('0x40')]['id']}})[_0x5af2('0x1d')](handleEntityNotFound(_0x233528,null))[_0x5af2('0x1d')](removeEntity(_0x233528,null))['catch'](handleError(_0x233528,null));}; \ No newline at end of file +var _0xd6aa=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','filter','options','count','then','findAll','rows','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x40e58f,_0x285f61){var _0xd51ff5=function(_0x128a5a){while(--_0x128a5a){_0x40e58f['push'](_0x40e58f['shift']());}};_0xd51ff5(++_0x285f61);}(_0xd6aa,0x1ac));var _0xad6a=function(_0x57dd90,_0x58ddc4){_0x57dd90=_0x57dd90-0x0;var _0x34abca=_0xd6aa[_0x57dd90];return _0x34abca;};'use strict';var pdf=require(_0xad6a('0x0'));var emlformat=require(_0xad6a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xad6a('0x2'));var jsonpatch=require(_0xad6a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad6a('0x4'));var Mustache=require('mustache');var util=require(_0xad6a('0x5'));var path=require(_0xad6a('0x6'));var sox=require(_0xad6a('0x7'));var csv=require(_0xad6a('0x8'));var ejs=require(_0xad6a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xad6a('0xa'));var deskjs=require(_0xad6a('0xb'));var toCsv=require(_0xad6a('0x8'));var querystring=require('querystring');var Papa=require(_0xad6a('0xc'));var Redis=require(_0xad6a('0xd'));var authService=require(_0xad6a('0xe'));var qs=require(_0xad6a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad6a('0x10'));var logger=require(_0xad6a('0x11'))(_0xad6a('0x12'));var utils=require(_0xad6a('0x13'));var config=require(_0xad6a('0x14'));var licenseUtil=require(_0xad6a('0x15'));var db=require(_0xad6a('0x16'))['db'];function respondWithStatusCode(_0x4a9c95,_0x5a8515){_0x5a8515=_0x5a8515||0xcc;return function(_0x4fa4d0){if(_0x4fa4d0){return _0x4a9c95[_0xad6a('0x17')](_0x5a8515);}return _0x4a9c95[_0xad6a('0x18')](_0x5a8515)[_0xad6a('0x19')]();};}function respondWithResult(_0x43bad4,_0x20b105){_0x20b105=_0x20b105||0xc8;return function(_0x3b7251){if(_0x3b7251){return _0x43bad4['status'](_0x20b105)['json'](_0x3b7251);}};}function respondWithFilteredResult(_0x5d12b8,_0x296f86){return function(_0x21d997){if(_0x21d997){var _0x5003ac=_0x21d997['count'],_0x3d8101=_0x296f86[_0xad6a('0x1a')],_0x42d172=_0x296f86['offset']+_0x296f86['limit'],_0x39e47e;if(_0x42d172>=_0x5003ac){_0x42d172=_0x5003ac;_0x39e47e=0xc8;}else{_0x39e47e=0xce;}_0x5d12b8['status'](_0x39e47e);return _0x5d12b8[_0xad6a('0x1b')](_0xad6a('0x1c'),_0x3d8101+'-'+_0x42d172+'/'+_0x5003ac)[_0xad6a('0x1d')](_0x21d997);}return null;};}function patchUpdates(_0xc2e1fe){return function(_0x37c60e){try{jsonpatch[_0xad6a('0x1e')](_0x37c60e,_0xc2e1fe,!![]);}catch(_0x476abc){return BPromise[_0xad6a('0x1f')](_0x476abc);}return _0x37c60e[_0xad6a('0x20')]();};}function saveUpdates(_0x5df382,_0x54c2f9){return function(_0x37752e){if(_0x37752e){return _0x37752e['update'](_0x5df382)['then'](function(_0x4be763){return _0x4be763;});}return null;};}function removeEntity(_0x2259a0,_0x5e4139){return function(_0x581ba9){if(_0x581ba9){return _0x581ba9[_0xad6a('0x21')]()['then'](function(){_0x2259a0[_0xad6a('0x18')](0xcc)[_0xad6a('0x19')]();});}};}function handleEntityNotFound(_0x12e241,_0xfeca23){return function(_0x4ffcee){if(!_0x4ffcee){_0x12e241[_0xad6a('0x17')](0x194);}return _0x4ffcee;};}function handleError(_0x481ef0,_0x4696eb){_0x4696eb=_0x4696eb||0x1f4;return function(_0x19ae1c){logger[_0xad6a('0x22')](_0x19ae1c[_0xad6a('0x23')]);if(_0x19ae1c[_0xad6a('0x24')]){delete _0x19ae1c[_0xad6a('0x24')];}_0x481ef0[_0xad6a('0x18')](_0x4696eb)[_0xad6a('0x25')](_0x19ae1c);};}exports[_0xad6a('0x26')]=function(_0xb3840b,_0x27c676){var _0x4630bb={},_0x249220={},_0x1b5267={'count':0x0,'rows':[]};var _0x128b23=_[_0xad6a('0x27')](db[_0xad6a('0x28')][_0xad6a('0x29')],function(_0x235f38){return{'name':_0x235f38[_0xad6a('0x2a')],'type':_0x235f38[_0xad6a('0x2b')][_0xad6a('0x2c')]};});_0x249220[_0xad6a('0x2d')]=_['map'](_0x128b23,_0xad6a('0x24'));_0x249220[_0xad6a('0x2e')]=_[_0xad6a('0x2f')](_0xb3840b[_0xad6a('0x2e')]);_0x249220[_0xad6a('0x30')]=_[_0xad6a('0x31')](_0x249220[_0xad6a('0x2d')],_0x249220[_0xad6a('0x2e')]);_0x4630bb['attributes']=_['intersection'](_0x249220['model'],qs[_0xad6a('0x32')](_0xb3840b[_0xad6a('0x2e')]['fields']));_0x4630bb[_0xad6a('0x33')]=_0x4630bb['attributes'][_0xad6a('0x34')]?_0x4630bb[_0xad6a('0x33')]:_0x249220[_0xad6a('0x2d')];if(!_0xb3840b[_0xad6a('0x2e')][_0xad6a('0x35')](_0xad6a('0x36'))){_0x4630bb[_0xad6a('0x37')]=qs[_0xad6a('0x37')](_0xb3840b[_0xad6a('0x2e')][_0xad6a('0x37')]);_0x4630bb[_0xad6a('0x1a')]=qs[_0xad6a('0x1a')](_0xb3840b[_0xad6a('0x2e')][_0xad6a('0x1a')]);}_0x4630bb['order']=qs[_0xad6a('0x38')](_0xb3840b[_0xad6a('0x2e')][_0xad6a('0x38')]);_0x4630bb[_0xad6a('0x39')]=qs['filters'](_[_0xad6a('0x3a')](_0xb3840b[_0xad6a('0x2e')],_0x249220['filters']),_0x128b23);if(_0xb3840b['query']['filter']){_0x4630bb[_0xad6a('0x39')]=_[_0xad6a('0x3b')](_0x4630bb[_0xad6a('0x39')],{'$or':_[_0xad6a('0x27')](_0x128b23,function(_0x3f7c69){if(_0x3f7c69['type']!=='VIRTUAL'){var _0x3644b7={};_0x3644b7[_0x3f7c69[_0xad6a('0x24')]]={'$like':'%'+_0xb3840b[_0xad6a('0x2e')][_0xad6a('0x3c')]+'%'};return _0x3644b7;}})});}_0x4630bb=_['merge']({},_0x4630bb,_0xb3840b[_0xad6a('0x3d')]);var _0x230de2={'where':_0x4630bb[_0xad6a('0x39')]};return db[_0xad6a('0x28')][_0xad6a('0x3e')](_0x230de2)[_0xad6a('0x3f')](function(_0x90c003){_0x1b5267[_0xad6a('0x3e')]=_0x90c003;if(_0xb3840b[_0xad6a('0x2e')]['includeAll']){_0x4630bb['include']=[{'all':!![]}];}return db[_0xad6a('0x28')][_0xad6a('0x40')](_0x4630bb);})['then'](function(_0x453d35){_0x1b5267[_0xad6a('0x41')]=_0x453d35;return _0x1b5267;})[_0xad6a('0x3f')](respondWithFilteredResult(_0x27c676,_0x4630bb))[_0xad6a('0x42')](handleError(_0x27c676,null));};exports[_0xad6a('0x43')]=function(_0x404404,_0x45e9f9){var _0xfd4b63={'raw':!![],'where':{'id':_0x404404[_0xad6a('0x44')]['id']}},_0x3c29bb={};_0x3c29bb[_0xad6a('0x2d')]=_[_0xad6a('0x2f')](db['AnalyticTreeReport']['rawAttributes']);_0x3c29bb[_0xad6a('0x2e')]=_['keys'](_0x404404[_0xad6a('0x2e')]);_0x3c29bb[_0xad6a('0x30')]=_['intersection'](_0x3c29bb[_0xad6a('0x2d')],_0x3c29bb['query']);_0xfd4b63[_0xad6a('0x33')]=_[_0xad6a('0x31')](_0x3c29bb[_0xad6a('0x2d')],qs[_0xad6a('0x32')](_0x404404[_0xad6a('0x2e')][_0xad6a('0x32')]));_0xfd4b63['attributes']=_0xfd4b63[_0xad6a('0x33')][_0xad6a('0x34')]?_0xfd4b63[_0xad6a('0x33')]:_0x3c29bb[_0xad6a('0x2d')];if(_0x404404[_0xad6a('0x2e')][_0xad6a('0x45')]){_0xfd4b63['include']=[{'all':!![]}];}_0xfd4b63=_[_0xad6a('0x3b')]({},_0xfd4b63,_0x404404['options']);return db[_0xad6a('0x28')][_0xad6a('0x46')](_0xfd4b63)[_0xad6a('0x3f')](handleEntityNotFound(_0x45e9f9,null))[_0xad6a('0x3f')](respondWithResult(_0x45e9f9,null))[_0xad6a('0x42')](handleError(_0x45e9f9,null));};exports['create']=function(_0x185452,_0x2f221d){return db[_0xad6a('0x28')][_0xad6a('0x47')](_0x185452[_0xad6a('0x48')],{})[_0xad6a('0x3f')](respondWithResult(_0x2f221d,0xc9))[_0xad6a('0x42')](handleError(_0x2f221d,null));};exports[_0xad6a('0x49')]=function(_0x4d50cc,_0x5ba093){if(_0x4d50cc['body']['id']){delete _0x4d50cc[_0xad6a('0x48')]['id'];}return db[_0xad6a('0x28')][_0xad6a('0x46')]({'where':{'id':_0x4d50cc['params']['id']}})[_0xad6a('0x3f')](handleEntityNotFound(_0x5ba093,null))[_0xad6a('0x3f')](saveUpdates(_0x4d50cc['body'],null))[_0xad6a('0x3f')](respondWithResult(_0x5ba093,null))[_0xad6a('0x42')](handleError(_0x5ba093,null));};exports[_0xad6a('0x21')]=function(_0x21230b,_0x74523e){return db[_0xad6a('0x28')][_0xad6a('0x46')]({'where':{'id':_0x21230b[_0xad6a('0x44')]['id']}})['then'](handleEntityNotFound(_0x74523e,null))[_0xad6a('0x3f')](removeEntity(_0x74523e,null))[_0xad6a('0x42')](handleError(_0x74523e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 2342f6a..a9d17d8 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(_0x1b3f36,_0x471326){var _0x32ea95=function(_0x490de5){while(--_0x490de5){_0x1b3f36['push'](_0x1b3f36['shift']());}};_0x32ea95(++_0x471326);}(_0xf562,0x100));var _0x2f56=function(_0x35b72c,_0x5b354c){_0x35b72c=_0x35b72c-0x0;var _0x5e2215=_0xf562[_0x35b72c];return _0x5e2215;};'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 _0x649f=['bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x649f,0x93));var _0xf649=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x649f[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var logger=require(_0xf649('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf649('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf649('0x4'));var rimraf=require(_0xf649('0x5'));var config=require(_0xf649('0x6'));var attributes=require(_0xf649('0x7'));module[_0xf649('0x8')]=function(_0x3e2e46,_0x580748){return _0x3e2e46[_0xf649('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 1247693..62fa2e1 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 _0x3101=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x1e0bf9,_0x581ecc){var _0x18a1ce=function(_0x2c302a){while(--_0x2c302a){_0x1e0bf9['push'](_0x1e0bf9['shift']());}};_0x18a1ce(++_0x581ecc);}(_0x3101,0xed));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1310('0x0'));var util=require(_0x1310('0x1'));var moment=require('moment');var BPromise=require(_0x1310('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1310('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1310('0x4'));var logger=require(_0x1310('0x5'))(_0x1310('0x6'));var config=require(_0x1310('0x7'));var jayson=require(_0x1310('0x8'));var client=jayson[_0x1310('0x9')][_0x1310('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b15ae,_0x48d428,_0x29214a){return new BPromise(function(_0x4f35f2,_0x24eb87){return client[_0x1310('0xb')](_0x3b15ae,_0x29214a)[_0x1310('0xc')](function(_0x2c3d0c){logger[_0x1310('0xd')](_0x1310('0xe'),_0x48d428,_0x1310('0xf'));logger[_0x1310('0x10')](_0x1310('0x11'),_0x48d428,_0x1310('0xf'),JSON[_0x1310('0x12')](_0x2c3d0c));if(_0x2c3d0c['error']){if(_0x2c3d0c[_0x1310('0x13')][_0x1310('0x14')]===0x1f4){logger[_0x1310('0x13')](_0x1310('0xe'),_0x48d428,_0x2c3d0c['error'][_0x1310('0x15')]);return _0x24eb87(_0x2c3d0c[_0x1310('0x13')][_0x1310('0x15')]);}logger[_0x1310('0x13')](_0x1310('0xe'),_0x48d428,_0x2c3d0c[_0x1310('0x13')][_0x1310('0x15')]);return _0x4f35f2(_0x2c3d0c[_0x1310('0x13')][_0x1310('0x15')]);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x48d428,_0x1310('0xf'));_0x4f35f2(_0x2c3d0c[_0x1310('0x16')][_0x1310('0x15')]);}})[_0x1310('0x17')](function(_0x4b2e38){logger[_0x1310('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x48d428,_0x4b2e38);_0x24eb87(_0x4b2e38);});});} \ No newline at end of file +var _0x4e10=['AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x3e27bf,_0x1351fa){var _0x3ddb4f=function(_0x4b67d7){while(--_0x4b67d7){_0x3e27bf['push'](_0x3e27bf['shift']());}};_0x3ddb4f(++_0x1351fa);}(_0x4e10,0x158));var _0x04e1=function(_0x20c0e5,_0x3b294f){_0x20c0e5=_0x20c0e5-0x0;var _0x1c6312=_0x4e10[_0x20c0e5];return _0x1c6312;};'use strict';var _=require(_0x04e1('0x0'));var util=require('util');var moment=require(_0x04e1('0x1'));var BPromise=require(_0x04e1('0x2'));var rs=require(_0x04e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x04e1('0x5'))(_0x04e1('0x6'));var config=require(_0x04e1('0x7'));var jayson=require(_0x04e1('0x8'));var client=jayson[_0x04e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4825c6,_0x57f226,_0x52a757){return new BPromise(function(_0x2a628d,_0x5a38a7){return client[_0x04e1('0xa')](_0x4825c6,_0x52a757)[_0x04e1('0xb')](function(_0x2de953){logger[_0x04e1('0xc')](_0x04e1('0xd'),_0x57f226,_0x04e1('0xe'));logger[_0x04e1('0xf')](_0x04e1('0x10'),_0x57f226,_0x04e1('0xe'),JSON[_0x04e1('0x11')](_0x2de953));if(_0x2de953[_0x04e1('0x12')]){if(_0x2de953['error']['code']===0x1f4){logger[_0x04e1('0x12')](_0x04e1('0xd'),_0x57f226,_0x2de953[_0x04e1('0x12')]['message']);return _0x5a38a7(_0x2de953[_0x04e1('0x12')]['message']);}logger[_0x04e1('0x12')](_0x04e1('0xd'),_0x57f226,_0x2de953[_0x04e1('0x12')][_0x04e1('0x13')]);return _0x2a628d(_0x2de953['error'][_0x04e1('0x13')]);}else{logger[_0x04e1('0xc')](_0x04e1('0xd'),_0x57f226,_0x04e1('0xe'));_0x2a628d(_0x2de953[_0x04e1('0x14')]['message']);}})['catch'](function(_0x2b9502){logger[_0x04e1('0x12')](_0x04e1('0xd'),_0x57f226,_0x2b9502);_0x5a38a7(_0x2b9502);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index cb26189..491bb1b 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 _0xfb4d=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','put','update','delete','multer','util'];(function(_0x455888,_0x96949f){var _0x1a30a6=function(_0x11488c){while(--_0x11488c){_0x455888['push'](_0x455888['shift']());}};_0x1a30a6(++_0x96949f);}(_0xfb4d,0x8e));var _0xdfb4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfb4d[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xdfb4('0x0'));var util=require(_0xdfb4('0x1'));var path=require('path');var timeout=require(_0xdfb4('0x2'));var express=require(_0xdfb4('0x3'));var router=express[_0xdfb4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdfb4('0x5'));var config=require(_0xdfb4('0x6'));var controller=require(_0xdfb4('0x7'));router[_0xdfb4('0x8')]('/',auth['isAuthenticated'](),controller[_0xdfb4('0x9')]);router[_0xdfb4('0x8')](_0xdfb4('0xa'),auth[_0xdfb4('0xb')](),controller[_0xdfb4('0xc')]);router['post']('/',auth[_0xdfb4('0xb')](),controller['create']);router[_0xdfb4('0xd')](_0xdfb4('0xa'),auth[_0xdfb4('0xb')](),controller[_0xdfb4('0xe')]);router[_0xdfb4('0xf')](_0xdfb4('0xa'),auth[_0xdfb4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6a18=['create','put','/:id','update','delete','connect-timeout','express','../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','show','post'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6a18,0x1f3));var _0x86a1=function(_0xfafd3f,_0x32cae3){_0xfafd3f=_0xfafd3f-0x0;var _0x52e0f4=_0x6a18[_0xfafd3f];return _0x52e0f4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x86a1('0x0'));var express=require(_0x86a1('0x1'));var router=express['Router']();var auth=require(_0x86a1('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x86a1('0x3'));router[_0x86a1('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x86a1('0x4')]('/:id',auth[_0x86a1('0x5')](),controller[_0x86a1('0x6')]);router[_0x86a1('0x7')]('/',auth[_0x86a1('0x5')](),controller[_0x86a1('0x8')]);router[_0x86a1('0x9')](_0x86a1('0xa'),auth[_0x86a1('0x5')](),controller[_0x86a1('0xb')]);router[_0x86a1('0xc')](_0x86a1('0xa'),auth[_0x86a1('0x5')](),controller['destroy']);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 e771224..202896f 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 _0x4da7=['sequelize','exports','STRING'];(function(_0x5dd9c2,_0xf60b15){var _0x28551f=function(_0x3b173b){while(--_0x3b173b){_0x5dd9c2['push'](_0x5dd9c2['shift']());}};_0x28551f(++_0xf60b15);}(_0x4da7,0x13e));var _0x74da=function(_0x1f847a,_0x555f7c){_0x1f847a=_0x1f847a-0x0;var _0xd1dc13=_0x4da7[_0x1f847a];return _0xd1dc13;};'use strict';var Sequelize=require(_0x74da('0x0'));module[_0x74da('0x1')]={'name':{'type':Sequelize[_0x74da('0x2')]},'basename':{'type':Sequelize[_0x74da('0x2')]},'type':{'type':Sequelize[_0x74da('0x2')]}}; \ No newline at end of file +var _0x90e6=['STRING','sequelize','exports'];(function(_0x3ef8d8,_0x19e777){var _0x37b602=function(_0x2b8e86){while(--_0x2b8e86){_0x3ef8d8['push'](_0x3ef8d8['shift']());}};_0x37b602(++_0x19e777);}(_0x90e6,0x136));var _0x690e=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x90e6[_0x26d6d9];return _0x1b4875;};'use strict';var Sequelize=require(_0x690e('0x0'));module[_0x690e('0x1')]={'name':{'type':Sequelize[_0x690e('0x2')]},'basename':{'type':Sequelize[_0x690e('0x2')]},'type':{'type':Sequelize[_0x690e('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 30c2471..4160156 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 _0x2f24=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','Attachment','rawAttributes','length','merge','find','omit','updatedAt','body','createdAt','create','file','originalname','basename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x3fb5e6,_0x4781e1){var _0x2d36fa=function(_0x37d72e){while(--_0x37d72e){_0x3fb5e6['push'](_0x3fb5e6['shift']());}};_0x2d36fa(++_0x4781e1);}(_0x2f24,0x1f1));var _0x42f2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2f24[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x42f2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42f2('0x1'));var zipdir=require(_0x42f2('0x2'));var jsonpatch=require(_0x42f2('0x3'));var rp=require(_0x42f2('0x4'));var moment=require(_0x42f2('0x5'));var BPromise=require(_0x42f2('0x6'));var Mustache=require(_0x42f2('0x7'));var util=require(_0x42f2('0x8'));var path=require(_0x42f2('0x9'));var sox=require('sox');var csv=require(_0x42f2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x42f2('0xb'));var squel=require(_0x42f2('0xc'));var crypto=require(_0x42f2('0xd'));var jsforce=require(_0x42f2('0xe'));var deskjs=require(_0x42f2('0xf'));var toCsv=require(_0x42f2('0xa'));var querystring=require(_0x42f2('0x10'));var Papa=require(_0x42f2('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x42f2('0x12'));var as=require(_0x42f2('0x13'));var hardwareService=require(_0x42f2('0x14'));var logger=require(_0x42f2('0x15'))(_0x42f2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x42f2('0x17'))['db'];function respondWithStatusCode(_0x140f84,_0x27ebb7){_0x27ebb7=_0x27ebb7||0xcc;return function(_0xc7e421){if(_0xc7e421){return _0x140f84[_0x42f2('0x18')](_0x27ebb7);}return _0x140f84['status'](_0x27ebb7)[_0x42f2('0x19')]();};}function respondWithResult(_0x3758ef,_0x333512){_0x333512=_0x333512||0xc8;return function(_0x37bab3){if(_0x37bab3){return _0x3758ef[_0x42f2('0x1a')](_0x333512)[_0x42f2('0x1b')](_0x37bab3);}};}function respondWithFilteredResult(_0x3489a1,_0x514bae){return function(_0x455830){if(_0x455830){var _0x53ef3b=_0x455830[_0x42f2('0x1c')],_0x1b3755=_0x514bae[_0x42f2('0x1d')],_0x1e2e13=_0x514bae[_0x42f2('0x1d')]+_0x514bae['limit'],_0x9f5bfc;if(_0x1e2e13>=_0x53ef3b){_0x1e2e13=_0x53ef3b;_0x9f5bfc=0xc8;}else{_0x9f5bfc=0xce;}_0x3489a1[_0x42f2('0x1a')](_0x9f5bfc);return _0x3489a1[_0x42f2('0x1e')](_0x42f2('0x1f'),_0x1b3755+'-'+_0x1e2e13+'/'+_0x53ef3b)[_0x42f2('0x1b')](_0x455830);}return null;};}function patchUpdates(_0x17f460){return function(_0x297705){try{jsonpatch[_0x42f2('0x20')](_0x297705,_0x17f460,!![]);}catch(_0x442170){return BPromise[_0x42f2('0x21')](_0x442170);}return _0x297705[_0x42f2('0x22')]();};}function saveUpdates(_0x3151af,_0x4f9427){return function(_0x162fdf){if(_0x162fdf){return _0x162fdf[_0x42f2('0x23')](_0x3151af)[_0x42f2('0x24')](function(_0x154022){return _0x154022;});}return null;};}function removeEntity(_0x1c0bf9,_0x3421f1){return function(_0x154850){if(_0x154850){return _0x154850[_0x42f2('0x25')]()[_0x42f2('0x24')](function(){_0x1c0bf9[_0x42f2('0x1a')](0xcc)[_0x42f2('0x19')]();});}};}function handleEntityNotFound(_0x1fbd0d,_0x17856c){return function(_0x2bcb08){if(!_0x2bcb08){_0x1fbd0d[_0x42f2('0x18')](0x194);}return _0x2bcb08;};}function handleError(_0x10fcfe,_0x5d71d2){_0x5d71d2=_0x5d71d2||0x1f4;return function(_0x1b4129){logger[_0x42f2('0x26')](_0x1b4129['stack']);if(_0x1b4129['name']){delete _0x1b4129[_0x42f2('0x27')];}_0x10fcfe[_0x42f2('0x1a')](_0x5d71d2)[_0x42f2('0x28')](_0x1b4129);};}exports['index']=function(_0x4f4832,_0x5e33a4){var _0x4895b9={},_0x4ab7e3={},_0x243302={'count':0x0,'rows':[]};var _0x5047b0=_['map'](db['Attachment']['rawAttributes'],function(_0x166350){return{'name':_0x166350[_0x42f2('0x29')],'type':_0x166350['type'][_0x42f2('0x2a')]};});_0x4ab7e3['model']=_['map'](_0x5047b0,'name');_0x4ab7e3[_0x42f2('0x2b')]=_[_0x42f2('0x2c')](_0x4f4832['query']);_0x4ab7e3[_0x42f2('0x2d')]=_[_0x42f2('0x2e')](_0x4ab7e3[_0x42f2('0x2f')],_0x4ab7e3[_0x42f2('0x2b')]);_0x4895b9[_0x42f2('0x30')]=_[_0x42f2('0x2e')](_0x4ab7e3[_0x42f2('0x2f')],qs[_0x42f2('0x31')](_0x4f4832[_0x42f2('0x2b')]['fields']));_0x4895b9[_0x42f2('0x30')]=_0x4895b9[_0x42f2('0x30')]['length']?_0x4895b9['attributes']:_0x4ab7e3[_0x42f2('0x2f')];if(!_0x4f4832[_0x42f2('0x2b')]['hasOwnProperty'](_0x42f2('0x32'))){_0x4895b9[_0x42f2('0x33')]=qs[_0x42f2('0x33')](_0x4f4832['query']['limit']);_0x4895b9[_0x42f2('0x1d')]=qs[_0x42f2('0x1d')](_0x4f4832[_0x42f2('0x2b')][_0x42f2('0x1d')]);}_0x4895b9['order']=qs[_0x42f2('0x34')](_0x4f4832['query'][_0x42f2('0x34')]);_0x4895b9[_0x42f2('0x35')]=qs[_0x42f2('0x2d')](_[_0x42f2('0x36')](_0x4f4832[_0x42f2('0x2b')],_0x4ab7e3[_0x42f2('0x2d')]),_0x5047b0);if(_0x4f4832[_0x42f2('0x2b')][_0x42f2('0x37')]){_0x4895b9[_0x42f2('0x35')]=_['merge'](_0x4895b9[_0x42f2('0x35')],{'$or':_[_0x42f2('0x38')](_0x5047b0,function(_0x3ad73a){if(_0x3ad73a[_0x42f2('0x39')]!==_0x42f2('0x3a')){var _0x77446e={};_0x77446e[_0x3ad73a[_0x42f2('0x27')]]={'$like':'%'+_0x4f4832['query'][_0x42f2('0x37')]+'%'};return _0x77446e;}})});}_0x4895b9=_['merge']({},_0x4895b9,_0x4f4832[_0x42f2('0x3b')]);var _0x4c8bfc={'where':_0x4895b9[_0x42f2('0x35')]};return db['Attachment'][_0x42f2('0x1c')](_0x4c8bfc)[_0x42f2('0x24')](function(_0x5d6b31){_0x243302[_0x42f2('0x1c')]=_0x5d6b31;if(_0x4f4832['query'][_0x42f2('0x3c')]){_0x4895b9[_0x42f2('0x3d')]=[{'all':!![]}];}return db['Attachment'][_0x42f2('0x3e')](_0x4895b9);})[_0x42f2('0x24')](function(_0x3622ea){_0x243302[_0x42f2('0x3f')]=_0x3622ea;return _0x243302;})['then'](respondWithFilteredResult(_0x5e33a4,_0x4895b9))[_0x42f2('0x40')](handleError(_0x5e33a4,null));};exports[_0x42f2('0x41')]=function(_0x3a8183,_0x16978b){var _0x22309c={'raw':!![],'where':{'id':_0x3a8183[_0x42f2('0x42')]['id']}},_0x4e7f86={};_0x4e7f86[_0x42f2('0x2f')]=_[_0x42f2('0x2c')](db[_0x42f2('0x43')][_0x42f2('0x44')]);_0x4e7f86[_0x42f2('0x2b')]=_[_0x42f2('0x2c')](_0x3a8183[_0x42f2('0x2b')]);_0x4e7f86['filters']=_[_0x42f2('0x2e')](_0x4e7f86['model'],_0x4e7f86[_0x42f2('0x2b')]);_0x22309c[_0x42f2('0x30')]=_[_0x42f2('0x2e')](_0x4e7f86['model'],qs['fields'](_0x3a8183[_0x42f2('0x2b')][_0x42f2('0x31')]));_0x22309c[_0x42f2('0x30')]=_0x22309c['attributes'][_0x42f2('0x45')]?_0x22309c[_0x42f2('0x30')]:_0x4e7f86[_0x42f2('0x2f')];if(_0x3a8183[_0x42f2('0x2b')][_0x42f2('0x3c')]){_0x22309c['include']=[{'all':!![]}];}_0x22309c=_[_0x42f2('0x46')]({},_0x22309c,_0x3a8183['options']);return db[_0x42f2('0x43')][_0x42f2('0x47')](_0x22309c)[_0x42f2('0x24')](handleEntityNotFound(_0x16978b,null))[_0x42f2('0x24')](respondWithResult(_0x16978b,null))[_0x42f2('0x40')](handleError(_0x16978b,null));};exports['clone']=function(_0x51a146,_0x15baca){var _0x5ca686={'where':{'id':_0x51a146[_0x42f2('0x42')]['id']}},_0x369492={};_0x369492[_0x42f2('0x2f')]=_[_0x42f2('0x2c')](db[_0x42f2('0x43')][_0x42f2('0x44')]);_0x5ca686[_0x42f2('0x30')]=_[_0x42f2('0x2e')](_0x369492['model'],qs[_0x42f2('0x31')](_0x51a146[_0x42f2('0x2b')][_0x42f2('0x31')]));_0x5ca686[_0x42f2('0x30')]=_0x5ca686[_0x42f2('0x30')][_0x42f2('0x45')]?_0x5ca686[_0x42f2('0x30')]:_0x369492['model'];if(_0x51a146[_0x42f2('0x2b')][_0x42f2('0x3c')]){_0x5ca686[_0x42f2('0x3d')]=[{'all':!![]}];}_0x5ca686=_['merge']({},_0x5ca686,_0x51a146[_0x42f2('0x3b')]);return db[_0x42f2('0x43')][_0x42f2('0x47')](_0x5ca686)['then'](handleEntityNotFound(_0x15baca,null))[_0x42f2('0x24')](function(_0x5b7b06){if(_0x5b7b06){var _0x4eac0b=_0x5b7b06['get']({'plain':!![]});_0x4eac0b=qs[_0x42f2('0x48')](_0x4eac0b,['id','createdAt',_0x42f2('0x49')]);_0x51a146[_0x42f2('0x4a')]=_['omit'](_0x51a146[_0x42f2('0x4a')],['id',_0x42f2('0x4b'),_0x42f2('0x49')]);return db[_0x42f2('0x43')][_0x42f2('0x4c')](_[_0x42f2('0x46')](_0x4eac0b,_0x51a146[_0x42f2('0x4a')]),{'include':_0x51a146[_0x42f2('0x2b')][_0x42f2('0x3c')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x15baca,0xc9))['catch'](handleError(_0x15baca,null));};exports['update']=function(_0x5a8ec4,_0x223e35){if(_0x5a8ec4[_0x42f2('0x4a')]['id']){delete _0x5a8ec4[_0x42f2('0x4a')]['id'];}return db[_0x42f2('0x43')]['find']({'where':{'id':_0x5a8ec4['params']['id']}})['then'](handleEntityNotFound(_0x223e35,null))[_0x42f2('0x24')](saveUpdates(_0x5a8ec4[_0x42f2('0x4a')],null))[_0x42f2('0x24')](respondWithResult(_0x223e35,null))[_0x42f2('0x40')](handleError(_0x223e35,null));};exports[_0x42f2('0x25')]=function(_0x54e1d2,_0xbefce3){return db[_0x42f2('0x43')][_0x42f2('0x47')]({'where':{'id':_0x54e1d2[_0x42f2('0x42')]['id']}})['then'](handleEntityNotFound(_0xbefce3,null))['then'](removeEntity(_0xbefce3,null))[_0x42f2('0x40')](handleError(_0xbefce3,null));};exports[_0x42f2('0x4c')]=function(_0x445b8f,_0x5da4c1,_0x48330d){_0x445b8f['body']['name']=_0x445b8f[_0x42f2('0x4d')][_0x42f2('0x4e')];_0x445b8f[_0x42f2('0x4a')][_0x42f2('0x4f')]=_0x445b8f['file']['filename'];_0x445b8f['body']['type']=_0x445b8f[_0x42f2('0x4d')][_0x42f2('0x50')];return db[_0x42f2('0x43')][_0x42f2('0x4c')](_0x445b8f[_0x42f2('0x4a')])[_0x42f2('0x24')](respondWithResult(_0x5da4c1,0xc9))[_0x42f2('0x40')](handleError(_0x5da4c1,null));};exports[_0x42f2('0x51')]=function(_0x43b620,_0x14777a,_0x55006e){return db[_0x42f2('0x43')][_0x42f2('0x52')]({'where':{'id':_0x43b620[_0x42f2('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x14777a,null))[_0x42f2('0x24')](function(_0x5dcf61){if(_0x5dcf61){return _0x14777a[_0x42f2('0x51')](path[_0x42f2('0x53')](config[_0x42f2('0x54')],_0x42f2('0x55'),_0x5dcf61[_0x42f2('0x4f')]));}})[_0x42f2('0x40')](handleError(_0x14777a,null));}; \ No newline at end of file +var _0x59ce=['type','key','model','map','keys','query','filters','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','attributes','include','find','updatedAt','body','omit','createdAt','file','originalname','basename','filename','mimetype','download','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','set','json','apply','update','then','destroy','stack','name','send','index','Attachment','rawAttributes','fieldName'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x59ce,0x7a));var _0xe59c=function(_0xb138f6,_0x2caa4a){_0xb138f6=_0xb138f6-0x0;var _0x1f931b=_0x59ce[_0xb138f6];return _0x1f931b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe59c('0x0'));var rimraf=require(_0xe59c('0x1'));var zipdir=require(_0xe59c('0x2'));var jsonpatch=require(_0xe59c('0x3'));var rp=require(_0xe59c('0x4'));var moment=require(_0xe59c('0x5'));var BPromise=require(_0xe59c('0x6'));var Mustache=require(_0xe59c('0x7'));var util=require(_0xe59c('0x8'));var path=require(_0xe59c('0x9'));var sox=require(_0xe59c('0xa'));var csv=require('to-csv');var ejs=require(_0xe59c('0xb'));var fs=require('fs');var _=require(_0xe59c('0xc'));var squel=require(_0xe59c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe59c('0xe'));var querystring=require(_0xe59c('0xf'));var Papa=require(_0xe59c('0x10'));var Redis=require(_0xe59c('0x11'));var authService=require(_0xe59c('0x12'));var qs=require(_0xe59c('0x13'));var as=require(_0xe59c('0x14'));var hardwareService=require(_0xe59c('0x15'));var logger=require('../../config/logger')(_0xe59c('0x16'));var utils=require(_0xe59c('0x17'));var config=require(_0xe59c('0x18'));var licenseUtil=require(_0xe59c('0x19'));var db=require(_0xe59c('0x1a'))['db'];function respondWithStatusCode(_0x10f973,_0x4317d3){_0x4317d3=_0x4317d3||0xcc;return function(_0x447a9d){if(_0x447a9d){return _0x10f973[_0xe59c('0x1b')](_0x4317d3);}return _0x10f973[_0xe59c('0x1c')](_0x4317d3)[_0xe59c('0x1d')]();};}function respondWithResult(_0x40d075,_0x1f4dcb){_0x1f4dcb=_0x1f4dcb||0xc8;return function(_0x55a3fc){if(_0x55a3fc){return _0x40d075[_0xe59c('0x1c')](_0x1f4dcb)['json'](_0x55a3fc);}};}function respondWithFilteredResult(_0x156324,_0x12c842){return function(_0x12dd26){if(_0x12dd26){var _0x416a7e=_0x12dd26['count'],_0x2581ab=_0x12c842['offset'],_0x692bb4=_0x12c842['offset']+_0x12c842[_0xe59c('0x1e')],_0x326cd3;if(_0x692bb4>=_0x416a7e){_0x692bb4=_0x416a7e;_0x326cd3=0xc8;}else{_0x326cd3=0xce;}_0x156324[_0xe59c('0x1c')](_0x326cd3);return _0x156324[_0xe59c('0x1f')]('Content-Range',_0x2581ab+'-'+_0x692bb4+'/'+_0x416a7e)[_0xe59c('0x20')](_0x12dd26);}return null;};}function patchUpdates(_0x384336){return function(_0x5e30a8){try{jsonpatch[_0xe59c('0x21')](_0x5e30a8,_0x384336,!![]);}catch(_0x5b995c){return BPromise['reject'](_0x5b995c);}return _0x5e30a8['save']();};}function saveUpdates(_0x169b08,_0x21be1d){return function(_0x4c8b29){if(_0x4c8b29){return _0x4c8b29[_0xe59c('0x22')](_0x169b08)[_0xe59c('0x23')](function(_0x9fbcd2){return _0x9fbcd2;});}return null;};}function removeEntity(_0x384da5,_0x505b4b){return function(_0x4c4abe){if(_0x4c4abe){return _0x4c4abe[_0xe59c('0x24')]()[_0xe59c('0x23')](function(){_0x384da5['status'](0xcc)[_0xe59c('0x1d')]();});}};}function handleEntityNotFound(_0x497411,_0x167cfb){return function(_0x44900b){if(!_0x44900b){_0x497411[_0xe59c('0x1b')](0x194);}return _0x44900b;};}function handleError(_0x54170f,_0x233dc6){_0x233dc6=_0x233dc6||0x1f4;return function(_0x39ebed){logger['error'](_0x39ebed[_0xe59c('0x25')]);if(_0x39ebed[_0xe59c('0x26')]){delete _0x39ebed[_0xe59c('0x26')];}_0x54170f['status'](_0x233dc6)[_0xe59c('0x27')](_0x39ebed);};}exports[_0xe59c('0x28')]=function(_0x17e0bd,_0x3970ce){var _0x49c051={},_0xba5bc6={},_0x74657d={'count':0x0,'rows':[]};var _0x23a781=_['map'](db[_0xe59c('0x29')][_0xe59c('0x2a')],function(_0x1156ca){return{'name':_0x1156ca[_0xe59c('0x2b')],'type':_0x1156ca[_0xe59c('0x2c')][_0xe59c('0x2d')]};});_0xba5bc6[_0xe59c('0x2e')]=_[_0xe59c('0x2f')](_0x23a781,_0xe59c('0x26'));_0xba5bc6['query']=_[_0xe59c('0x30')](_0x17e0bd[_0xe59c('0x31')]);_0xba5bc6[_0xe59c('0x32')]=_[_0xe59c('0x33')](_0xba5bc6[_0xe59c('0x2e')],_0xba5bc6[_0xe59c('0x31')]);_0x49c051['attributes']=_[_0xe59c('0x33')](_0xba5bc6['model'],qs[_0xe59c('0x34')](_0x17e0bd['query'][_0xe59c('0x34')]));_0x49c051['attributes']=_0x49c051['attributes'][_0xe59c('0x35')]?_0x49c051['attributes']:_0xba5bc6[_0xe59c('0x2e')];if(!_0x17e0bd['query'][_0xe59c('0x36')]('nolimit')){_0x49c051['limit']=qs['limit'](_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x1e')]);_0x49c051['offset']=qs[_0xe59c('0x37')](_0x17e0bd[_0xe59c('0x31')]['offset']);}_0x49c051[_0xe59c('0x38')]=qs[_0xe59c('0x39')](_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x39')]);_0x49c051[_0xe59c('0x3a')]=qs[_0xe59c('0x32')](_['pick'](_0x17e0bd[_0xe59c('0x31')],_0xba5bc6[_0xe59c('0x32')]),_0x23a781);if(_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x3b')]){_0x49c051[_0xe59c('0x3a')]=_[_0xe59c('0x3c')](_0x49c051[_0xe59c('0x3a')],{'$or':_[_0xe59c('0x2f')](_0x23a781,function(_0x1eaa3f){if(_0x1eaa3f[_0xe59c('0x2c')]!=='VIRTUAL'){var _0x204560={};_0x204560[_0x1eaa3f['name']]={'$like':'%'+_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x3b')]+'%'};return _0x204560;}})});}_0x49c051=_['merge']({},_0x49c051,_0x17e0bd[_0xe59c('0x3d')]);var _0x34156f={'where':_0x49c051[_0xe59c('0x3a')]};return db[_0xe59c('0x29')]['count'](_0x34156f)[_0xe59c('0x23')](function(_0x126b15){_0x74657d['count']=_0x126b15;if(_0x17e0bd[_0xe59c('0x31')][_0xe59c('0x3e')]){_0x49c051['include']=[{'all':!![]}];}return db[_0xe59c('0x29')][_0xe59c('0x3f')](_0x49c051);})[_0xe59c('0x23')](function(_0x33dda7){_0x74657d[_0xe59c('0x40')]=_0x33dda7;return _0x74657d;})[_0xe59c('0x23')](respondWithFilteredResult(_0x3970ce,_0x49c051))[_0xe59c('0x41')](handleError(_0x3970ce,null));};exports[_0xe59c('0x42')]=function(_0x46e57c,_0x16608a){var _0x3cb494={'raw':!![],'where':{'id':_0x46e57c[_0xe59c('0x43')]['id']}},_0x5cb328={};_0x5cb328[_0xe59c('0x2e')]=_['keys'](db[_0xe59c('0x29')][_0xe59c('0x2a')]);_0x5cb328[_0xe59c('0x31')]=_[_0xe59c('0x30')](_0x46e57c[_0xe59c('0x31')]);_0x5cb328[_0xe59c('0x32')]=_[_0xe59c('0x33')](_0x5cb328['model'],_0x5cb328['query']);_0x3cb494[_0xe59c('0x44')]=_[_0xe59c('0x33')](_0x5cb328[_0xe59c('0x2e')],qs[_0xe59c('0x34')](_0x46e57c[_0xe59c('0x31')]['fields']));_0x3cb494[_0xe59c('0x44')]=_0x3cb494['attributes'][_0xe59c('0x35')]?_0x3cb494[_0xe59c('0x44')]:_0x5cb328[_0xe59c('0x2e')];if(_0x46e57c[_0xe59c('0x31')][_0xe59c('0x3e')]){_0x3cb494[_0xe59c('0x45')]=[{'all':!![]}];}_0x3cb494=_[_0xe59c('0x3c')]({},_0x3cb494,_0x46e57c[_0xe59c('0x3d')]);return db['Attachment'][_0xe59c('0x46')](_0x3cb494)[_0xe59c('0x23')](handleEntityNotFound(_0x16608a,null))[_0xe59c('0x23')](respondWithResult(_0x16608a,null))[_0xe59c('0x41')](handleError(_0x16608a,null));};exports['clone']=function(_0x108562,_0x175e57){var _0x215036={'where':{'id':_0x108562[_0xe59c('0x43')]['id']}},_0x457f03={};_0x457f03[_0xe59c('0x2e')]=_[_0xe59c('0x30')](db['Attachment'][_0xe59c('0x2a')]);_0x215036[_0xe59c('0x44')]=_['intersection'](_0x457f03[_0xe59c('0x2e')],qs[_0xe59c('0x34')](_0x108562['query'][_0xe59c('0x34')]));_0x215036['attributes']=_0x215036['attributes']['length']?_0x215036[_0xe59c('0x44')]:_0x457f03['model'];if(_0x108562[_0xe59c('0x31')][_0xe59c('0x3e')]){_0x215036['include']=[{'all':!![]}];}_0x215036=_[_0xe59c('0x3c')]({},_0x215036,_0x108562[_0xe59c('0x3d')]);return db['Attachment'][_0xe59c('0x46')](_0x215036)['then'](handleEntityNotFound(_0x175e57,null))['then'](function(_0x3289c4){if(_0x3289c4){var _0xac118a=_0x3289c4['get']({'plain':!![]});_0xac118a=qs['omit'](_0xac118a,['id','createdAt',_0xe59c('0x47')]);_0x108562[_0xe59c('0x48')]=_[_0xe59c('0x49')](_0x108562[_0xe59c('0x48')],['id',_0xe59c('0x4a'),_0xe59c('0x47')]);return db[_0xe59c('0x29')]['create'](_[_0xe59c('0x3c')](_0xac118a,_0x108562[_0xe59c('0x48')]),{'include':_0x108562[_0xe59c('0x31')][_0xe59c('0x3e')]?[{'all':!![]}]:undefined});}})[_0xe59c('0x23')](respondWithResult(_0x175e57,0xc9))[_0xe59c('0x41')](handleError(_0x175e57,null));};exports[_0xe59c('0x22')]=function(_0xa4de49,_0x3adeed){if(_0xa4de49['body']['id']){delete _0xa4de49[_0xe59c('0x48')]['id'];}return db[_0xe59c('0x29')][_0xe59c('0x46')]({'where':{'id':_0xa4de49[_0xe59c('0x43')]['id']}})['then'](handleEntityNotFound(_0x3adeed,null))['then'](saveUpdates(_0xa4de49['body'],null))[_0xe59c('0x23')](respondWithResult(_0x3adeed,null))['catch'](handleError(_0x3adeed,null));};exports['destroy']=function(_0x39f953,_0x446228){return db['Attachment'][_0xe59c('0x46')]({'where':{'id':_0x39f953['params']['id']}})[_0xe59c('0x23')](handleEntityNotFound(_0x446228,null))[_0xe59c('0x23')](removeEntity(_0x446228,null))[_0xe59c('0x41')](handleError(_0x446228,null));};exports['create']=function(_0x146aac,_0x425f8f,_0x1d0996){_0x146aac['body']['name']=_0x146aac[_0xe59c('0x4b')][_0xe59c('0x4c')];_0x146aac[_0xe59c('0x48')][_0xe59c('0x4d')]=_0x146aac[_0xe59c('0x4b')][_0xe59c('0x4e')];_0x146aac[_0xe59c('0x48')][_0xe59c('0x2c')]=_0x146aac[_0xe59c('0x4b')][_0xe59c('0x4f')];return db[_0xe59c('0x29')]['create'](_0x146aac['body'])[_0xe59c('0x23')](respondWithResult(_0x425f8f,0xc9))['catch'](handleError(_0x425f8f,null));};exports[_0xe59c('0x50')]=function(_0x26ac56,_0xf25c39,_0x516034){return db['Attachment']['findOne']({'where':{'id':_0x26ac56[_0xe59c('0x43')]['id']},'raw':!![]})[_0xe59c('0x23')](handleEntityNotFound(_0xf25c39,null))[_0xe59c('0x23')](function(_0x5a8250){if(_0x5a8250){return _0xf25c39[_0xe59c('0x50')](path['join'](config[_0xe59c('0x51')],_0xe59c('0x52'),_0x5a8250[_0xe59c('0x4d')]));}})[_0xe59c('0x41')](handleError(_0xf25c39,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 55c1546..e97035b 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 _0xffc0=['request-promise','path','rimraf','../../config/environment','exports','attachments','util','api','moment','bluebird'];(function(_0x11505c,_0x3be5b7){var _0x389e04=function(_0x3e4d3a){while(--_0x3e4d3a){_0x11505c['push'](_0x11505c['shift']());}};_0x389e04(++_0x3be5b7);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x5c60d8,_0x2cf3cd){_0x5c60d8=_0x5c60d8-0x0;var _0x98199=_0xffc0[_0x5c60d8];return _0x98199;};'use strict';var _=require('lodash');var util=require(_0x0ffc('0x0'));var logger=require('../../config/logger')(_0x0ffc('0x1'));var moment=require(_0x0ffc('0x2'));var BPromise=require(_0x0ffc('0x3'));var rp=require(_0x0ffc('0x4'));var fs=require('fs');var path=require(_0x0ffc('0x5'));var rimraf=require(_0x0ffc('0x6'));var config=require(_0x0ffc('0x7'));var attributes=require('./attachment.attributes');module[_0x0ffc('0x8')]=function(_0x23d3e0,_0x426ce2){return _0x23d3e0['define']('Attachment',attributes,{'tableName':_0x0ffc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf08c=['attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./attachment.attributes','exports','define','Attachment'];(function(_0x5b0723,_0x2bca54){var _0x1b8615=function(_0x679378){while(--_0x679378){_0x5b0723['push'](_0x5b0723['shift']());}};_0x1b8615(++_0x2bca54);}(_0xf08c,0xb5));var _0xcf08=function(_0x387dfe,_0x3d2a25){_0x387dfe=_0x387dfe-0x0;var _0x1aa84c=_0xf08c[_0x387dfe];return _0x1aa84c;};'use strict';var _=require(_0xcf08('0x0'));var util=require(_0xcf08('0x1'));var logger=require(_0xcf08('0x2'))('api');var moment=require(_0xcf08('0x3'));var BPromise=require(_0xcf08('0x4'));var rp=require(_0xcf08('0x5'));var fs=require('fs');var path=require(_0xcf08('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf08('0x7'));module[_0xcf08('0x8')]=function(_0x5f1020,_0x346b93){return _0x5f1020[_0xcf08('0x9')](_0xcf08('0xa'),attributes,{'tableName':_0xcf08('0xb'),'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 21b65f0..5e60ffc 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 _0x7eda=['raw','CreateAttachment','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','error','code','Attachment,\x20%s,\x20%s','message','catch','Attachment','create','body','options'];(function(_0x45567d,_0x1392cf){var _0x2b20cd=function(_0x371e9a){while(--_0x371e9a){_0x45567d['push'](_0x45567d['shift']());}};_0x2b20cd(++_0x1392cf);}(_0x7eda,0x199));var _0xa7ed=function(_0x174466,_0x284f77){_0x174466=_0x174466-0x0;var _0x17d1c5=_0x7eda[_0x174466];return _0x17d1c5;};'use strict';var _=require(_0xa7ed('0x0'));var util=require(_0xa7ed('0x1'));var moment=require(_0xa7ed('0x2'));var BPromise=require(_0xa7ed('0x3'));var rs=require(_0xa7ed('0x4'));var fs=require('fs');var Redis=require(_0xa7ed('0x5'));var db=require(_0xa7ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7ed('0x7'))('rpc');var config=require(_0xa7ed('0x8'));var jayson=require(_0xa7ed('0x9'));var client=jayson['client'][_0xa7ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b1f86,_0x357512,_0x9a30ca){return new BPromise(function(_0x11d1d4,_0x1ed262){return client[_0xa7ed('0xb')](_0x1b1f86,_0x9a30ca)['then'](function(_0xfab1f4){logger[_0xa7ed('0xc')]('Attachment,\x20%s,\x20%s',_0x357512,_0xa7ed('0xd'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x357512,_0xa7ed('0xd'),JSON['stringify'](_0xfab1f4));if(_0xfab1f4[_0xa7ed('0xe')]){if(_0xfab1f4['error'][_0xa7ed('0xf')]===0x1f4){logger[_0xa7ed('0xe')](_0xa7ed('0x10'),_0x357512,_0xfab1f4[_0xa7ed('0xe')]['message']);return _0x1ed262(_0xfab1f4[_0xa7ed('0xe')]['message']);}logger[_0xa7ed('0xe')]('Attachment,\x20%s,\x20%s',_0x357512,_0xfab1f4[_0xa7ed('0xe')][_0xa7ed('0x11')]);return _0x11d1d4(_0xfab1f4[_0xa7ed('0xe')][_0xa7ed('0x11')]);}else{logger[_0xa7ed('0xc')]('Attachment,\x20%s,\x20%s',_0x357512,_0xa7ed('0xd'));_0x11d1d4(_0xfab1f4['result']['message']);}})[_0xa7ed('0x12')](function(_0x5f2508){logger[_0xa7ed('0xe')](_0xa7ed('0x10'),_0x357512,_0x5f2508);_0x1ed262(_0x5f2508);});});}exports['CreateAttachment']=function(_0x1b480c){var _0x946a45=this;return new Promise(function(_0x16387e,_0x36a50e){return db[_0xa7ed('0x13')][_0xa7ed('0x14')](_0x1b480c[_0xa7ed('0x15')],{'raw':_0x1b480c[_0xa7ed('0x16')]?_0x1b480c[_0xa7ed('0x16')][_0xa7ed('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x9e3f3c){logger[_0xa7ed('0xc')](_0xa7ed('0x18'),_0x1b480c);logger[_0xa7ed('0x19')]('CreateAttachment',_0x1b480c,JSON[_0xa7ed('0x1a')](_0x9e3f3c));_0x16387e(_0x9e3f3c);})[_0xa7ed('0x12')](function(_0xa3b00d){logger[_0xa7ed('0xe')](_0xa7ed('0x18'),_0xa3b00d[_0xa7ed('0x11')],_0x1b480c);_0x36a50e(_0x946a45[_0xa7ed('0xe')](0x1f4,_0xa3b00d['message']));});});}; \ No newline at end of file +var _0xc700=['../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4b9cdd,_0x4537fe){var _0x1ac2f4=function(_0x24008b){while(--_0x24008b){_0x4b9cdd['push'](_0x4b9cdd['shift']());}};_0x1ac2f4(++_0x4537fe);}(_0xc700,0x111));var _0x0c70=function(_0x429805,_0xd2f324){_0x429805=_0x429805-0x0;var _0x4d3606=_0xc700[_0x429805];return _0x4d3606;};'use strict';var _=require('lodash');var util=require(_0x0c70('0x0'));var moment=require(_0x0c70('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c70('0x2'));var fs=require('fs');var Redis=require(_0x0c70('0x3'));var db=require(_0x0c70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c70('0x5'))(_0x0c70('0x6'));var config=require(_0x0c70('0x7'));var jayson=require(_0x0c70('0x8'));var client=jayson[_0x0c70('0x9')][_0x0c70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4198f9,_0x1978ae,_0x4bb04e){return new BPromise(function(_0x4a17c7,_0x13e87c){return client[_0x0c70('0xb')](_0x4198f9,_0x4bb04e)[_0x0c70('0xc')](function(_0x55c7ff){logger[_0x0c70('0xd')](_0x0c70('0xe'),_0x1978ae,_0x0c70('0xf'));logger[_0x0c70('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1978ae,_0x0c70('0xf'),JSON[_0x0c70('0x11')](_0x55c7ff));if(_0x55c7ff[_0x0c70('0x12')]){if(_0x55c7ff[_0x0c70('0x12')][_0x0c70('0x13')]===0x1f4){logger[_0x0c70('0x12')](_0x0c70('0xe'),_0x1978ae,_0x55c7ff['error']['message']);return _0x13e87c(_0x55c7ff[_0x0c70('0x12')][_0x0c70('0x14')]);}logger[_0x0c70('0x12')](_0x0c70('0xe'),_0x1978ae,_0x55c7ff[_0x0c70('0x12')][_0x0c70('0x14')]);return _0x4a17c7(_0x55c7ff[_0x0c70('0x12')]['message']);}else{logger[_0x0c70('0xd')]('Attachment,\x20%s,\x20%s',_0x1978ae,_0x0c70('0xf'));_0x4a17c7(_0x55c7ff[_0x0c70('0x15')]['message']);}})[_0x0c70('0x16')](function(_0x4d8045){logger[_0x0c70('0x12')](_0x0c70('0xe'),_0x1978ae,_0x4d8045);_0x13e87c(_0x4d8045);});});}exports[_0x0c70('0x17')]=function(_0x1d99ac){var _0x3eddb4=this;return new Promise(function(_0x126701,_0x16bba6){return db[_0x0c70('0x18')][_0x0c70('0x19')](_0x1d99ac['body'],{'raw':_0x1d99ac['options']?_0x1d99ac[_0x0c70('0x1a')][_0x0c70('0x1b')]===undefined?!![]:![]:!![]})[_0x0c70('0xc')](function(_0x3ddb27){logger[_0x0c70('0xd')](_0x0c70('0x17'),_0x1d99ac);logger['debug'](_0x0c70('0x17'),_0x1d99ac,JSON[_0x0c70('0x11')](_0x3ddb27));_0x126701(_0x3ddb27);})[_0x0c70('0x16')](function(_0x2307dc){logger['error'](_0x0c70('0x17'),_0x2307dc[_0x0c70('0x14')],_0x1d99ac);_0x16bba6(_0x3eddb4[_0x0c70('0x12')](0x1f4,_0x2307dc[_0x0c70('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5439db8..ff6d488 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 _0x97e6=['single','file','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./attachment.controller','isAuthenticated','index','get','/:id','show','download','post','clone','diskStorage','join','%s-%s','now'];(function(_0x3391fe,_0x5c24d9){var _0x1ae383=function(_0x5e71a4){while(--_0x5e71a4){_0x3391fe['push'](_0x3391fe['shift']());}};_0x1ae383(++_0x5c24d9);}(_0x97e6,0x159));var _0x697e=function(_0x2f4e7a,_0x4c3f4e){_0x2f4e7a=_0x2f4e7a-0x0;var _0x3299a0=_0x97e6[_0x2f4e7a];return _0x3299a0;};'use strict';var multer=require(_0x697e('0x0'));var util=require('util');var path=require(_0x697e('0x1'));var timeout=require(_0x697e('0x2'));var express=require(_0x697e('0x3'));var router=express['Router']();var auth=require(_0x697e('0x4'));var interaction=require(_0x697e('0x5'));var config=require('../../config/environment');var controller=require(_0x697e('0x6'));router['get']('/',auth[_0x697e('0x7')](),controller[_0x697e('0x8')]);router[_0x697e('0x9')](_0x697e('0xa'),auth[_0x697e('0x7')](),controller[_0x697e('0xb')]);router['get']('/:id/download',auth[_0x697e('0x7')](),controller[_0x697e('0xc')]);router[_0x697e('0xd')]('/:id/clone',auth[_0x697e('0x7')](),controller[_0x697e('0xe')]);var upload=multer({'storage':multer[_0x697e('0xf')]({'destination':function(_0x1c7aa7,_0x3c528a,_0x4d0570){_0x4d0570(null,path[_0x697e('0x10')](config['root'],'server/files/attachments/'));},'filename':function(_0x11d502,_0x381c9d,_0x1aa4bb){_0x1aa4bb(null,util['format'](_0x697e('0x11'),Date[_0x697e('0x12')](),_0x381c9d['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x697e('0xd')]('/',upload[_0x697e('0x13')](_0x697e('0x14')),controller[_0x697e('0x15')]);router[_0x697e('0x16')](_0x697e('0xa'),auth[_0x697e('0x7')](),controller[_0x697e('0x17')]);router[_0x697e('0x18')]('/:id',auth[_0x697e('0x7')](),controller[_0x697e('0x19')]);module['exports']=router; \ No newline at end of file +var _0x4342=['create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','replace','single','file'];(function(_0x4b1a5f,_0x268325){var _0x67eb29=function(_0x436455){while(--_0x436455){_0x4b1a5f['push'](_0x4b1a5f['shift']());}};_0x67eb29(++_0x268325);}(_0x4342,0xe5));var _0x2434=function(_0xd70515,_0x50cfb3){_0xd70515=_0xd70515-0x0;var _0x1e9a3a=_0x4342[_0xd70515];return _0x1e9a3a;};'use strict';var multer=require(_0x2434('0x0'));var util=require(_0x2434('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2434('0x2'));var router=express[_0x2434('0x3')]();var auth=require(_0x2434('0x4'));var interaction=require(_0x2434('0x5'));var config=require(_0x2434('0x6'));var controller=require(_0x2434('0x7'));router[_0x2434('0x8')]('/',auth[_0x2434('0x9')](),controller[_0x2434('0xa')]);router[_0x2434('0x8')](_0x2434('0xb'),auth[_0x2434('0x9')](),controller[_0x2434('0xc')]);router['get'](_0x2434('0xd'),auth[_0x2434('0x9')](),controller['download']);router['post'](_0x2434('0xe'),auth[_0x2434('0x9')](),controller[_0x2434('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5923f4,_0xb1a731,_0x395666){_0x395666(null,path[_0x2434('0x10')](config[_0x2434('0x11')],_0x2434('0x12')));},'filename':function(_0x39e9ce,_0x50fb5d,_0x36c3ab){_0x36c3ab(null,util['format'](_0x2434('0x13'),Date['now'](),_0x50fb5d['originalname'][_0x2434('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x2434('0x15')](_0x2434('0x16')),controller[_0x2434('0x17')]);router[_0x2434('0x18')](_0x2434('0xb'),auth[_0x2434('0x9')](),controller[_0x2434('0x19')]);router[_0x2434('0x1a')](_0x2434('0xb'),auth[_0x2434('0x9')](),controller['destroy']);module[_0x2434('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 12bc5ed..3c9935d 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 _0xa698=['minutes','getLicense','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','signToken','../../config/utils','authenticate','google','profile','email','use','clientSecret','secret','Setting','findOne','blockDuration','then','User','find','map','emails','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa698,0x176));var _0x8a69=function(_0x362dbb,_0x110bc3){_0x362dbb=_0x362dbb-0x0;var _0x493434=_0xa698[_0x362dbb];return _0x493434;};'use strict';var _=require(_0x8a69('0x0'));var passport=require(_0x8a69('0x1'));var GoogleStrategy=require(_0x8a69('0x2'))[_0x8a69('0x3')];var moment=require(_0x8a69('0x4'));var db=require(_0x8a69('0x5'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x8a69('0x6')];var utils=require(_0x8a69('0x7'));exports['login']=passport[_0x8a69('0x8')](_0x8a69('0x9'),{'failureRedirect':'/login','scope':[_0x8a69('0xa'),_0x8a69('0xb')],'session':![]});exports['callback']=passport['authenticate'](_0x8a69('0x9'),{'failureRedirect':'/login','session':![]});passport[_0x8a69('0xc')](new GoogleStrategy({'clientID':config[_0x8a69('0x9')]?config['google']['clientID']:'id','clientSecret':config[_0x8a69('0x9')]?config[_0x8a69('0x9')][_0x8a69('0xd')]:_0x8a69('0xe'),'callbackURL':config['google']?config[_0x8a69('0x9')]['callbackURL']:''},function(_0x11f1b8,_0x49eb25,_0x1602cf,_0x4f1d89){var _0x10a114,_0x570474;return db[_0x8a69('0xf')][_0x8a69('0x10')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8a69('0x11')],'raw':!![]})[_0x8a69('0x12')](function(_0x3b5a78){_0x10a114=_0x3b5a78;return db[_0x8a69('0x13')][_0x8a69('0x14')]({'where':{'email':_[_0x8a69('0x15')](_0x1602cf[_0x8a69('0x16')],'value'),'role':{'$or':[_0x8a69('0x17'),'user',_0x8a69('0x18')]}}});})[_0x8a69('0x12')](function(_0xbff83e){_0x570474=_0xbff83e;if(_0x570474){if(_0x570474[_0x8a69('0x19')]){return _0x4f1d89(_0x8a69('0x1a'));}else if(_0x10a114[_0x8a69('0x11')]>0x0){if(_0x570474['blocked']){if(moment(_0x570474[_0x8a69('0x1b')])[_0x8a69('0x1c')](_0x10a114[_0x8a69('0x11')],_0x8a69('0x1d'))>moment()){return _0x4f1d89(_0x8a69('0x1a'));}else{return utils['clearBlockUser'](_0x570474,0x0,![],null)[_0x8a69('0x12')](function(){return utils[_0x8a69('0x1e')](_0x570474);})['then'](function(){return _0x4f1d89(null,_0x570474);});}}else{return utils['getLicense'](_0x570474)[_0x8a69('0x12')](function(){return _0x4f1d89(null,_0x570474);});}}else{return utils[_0x8a69('0x1e')](_0x570474)[_0x8a69('0x12')](function(){return _0x4f1d89(null,_0x570474);});}}return _0x4f1d89(_0x8a69('0x1a'));})['catch'](function(_0xc0c16c){_0x4f1d89(_0xc0c16c);});})); \ No newline at end of file +var _0x8ad3=['signToken','../../config/utils','login','authenticate','profile','callback','/login','use','google','clientID','clientSecret','secret','Setting','findOne','blockDuration','User','map','emails','value','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service'];(function(_0x123935,_0x1670ba){var _0x1a8ebf=function(_0xa6933e){while(--_0xa6933e){_0x123935['push'](_0x123935['shift']());}};_0x1a8ebf(++_0x1670ba);}(_0x8ad3,0xa9));var _0x38ad=function(_0x36e774,_0x1594cb){_0x36e774=_0x36e774-0x0;var _0x38c3bf=_0x8ad3[_0x36e774];return _0x38c3bf;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x38ad('0x0'))[_0x38ad('0x1')];var moment=require(_0x38ad('0x2'));var db=require(_0x38ad('0x3'))['db'];var config=require(_0x38ad('0x4'));var signToken=require(_0x38ad('0x5'))[_0x38ad('0x6')];var utils=require(_0x38ad('0x7'));exports[_0x38ad('0x8')]=passport[_0x38ad('0x9')]('google',{'failureRedirect':'/login','scope':[_0x38ad('0xa'),'email'],'session':![]});exports[_0x38ad('0xb')]=passport[_0x38ad('0x9')]('google',{'failureRedirect':_0x38ad('0xc'),'session':![]});passport[_0x38ad('0xd')](new GoogleStrategy({'clientID':config[_0x38ad('0xe')]?config[_0x38ad('0xe')][_0x38ad('0xf')]:'id','clientSecret':config['google']?config[_0x38ad('0xe')][_0x38ad('0x10')]:_0x38ad('0x11'),'callbackURL':config[_0x38ad('0xe')]?config[_0x38ad('0xe')]['callbackURL']:''},function(_0x2b7050,_0x99a7be,_0x1ee63e,_0x418a95){var _0x12680e,_0x272a31;return db[_0x38ad('0x12')][_0x38ad('0x13')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x38ad('0x14')],'raw':!![]})['then'](function(_0x3ad5fa){_0x12680e=_0x3ad5fa;return db[_0x38ad('0x15')]['find']({'where':{'email':_[_0x38ad('0x16')](_0x1ee63e[_0x38ad('0x17')],_0x38ad('0x18')),'role':{'$or':['admin','user',_0x38ad('0x19')]}}});})[_0x38ad('0x1a')](function(_0x115d8e){_0x272a31=_0x115d8e;if(_0x272a31){if(_0x272a31[_0x38ad('0x1b')]){return _0x418a95(_0x38ad('0x1c'));}else if(_0x12680e[_0x38ad('0x14')]>0x0){if(_0x272a31['blocked']){if(moment(_0x272a31[_0x38ad('0x1d')])[_0x38ad('0x1e')](_0x12680e[_0x38ad('0x14')],_0x38ad('0x1f'))>moment()){return _0x418a95(_0x38ad('0x1c'));}else{return utils[_0x38ad('0x20')](_0x272a31,0x0,![],null)[_0x38ad('0x1a')](function(){return utils[_0x38ad('0x21')](_0x272a31);})['then'](function(){return _0x418a95(null,_0x272a31);});}}else{return utils['getLicense'](_0x272a31)['then'](function(){return _0x418a95(null,_0x272a31);});}}else{return utils[_0x38ad('0x21')](_0x272a31)[_0x38ad('0x1a')](function(){return _0x418a95(null,_0x272a31);});}}return _0x418a95(_0x38ad('0x1c'));})[_0x38ad('0x22')](function(_0xa8f142){_0x418a95(_0xa8f142);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 253fd5a..e9a64a4 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 _0xc39c=['passport','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','exports'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0xc39c,0xd2));var _0xcc39=function(_0x94d4c,_0x42df71){_0x94d4c=_0x94d4c-0x0;var _0x56dc9a=_0xc39c[_0x94d4c];return _0x56dc9a;};'use strict';var express=require('express');var passport=require(_0xcc39('0x0'));var router=express[_0xcc39('0x1')]();var controller=require(_0xcc39('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xcc39('0x3'));router[_0xcc39('0x4')]('/',controller[_0xcc39('0x5')]);router['get'](_0xcc39('0x6'),controller[_0xcc39('0x7')],authService[_0xcc39('0x8')],userController[_0xcc39('0x5')],authService['setTokenCookie']);module[_0xcc39('0x9')]=router; \ No newline at end of file +var _0x0d4e=['../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0d4e[_0x1cc8fe];return _0x230054;};'use strict';var express=require(_0xe0d4('0x0'));var passport=require(_0xe0d4('0x1'));var router=express[_0xe0d4('0x2')]();var controller=require(_0xe0d4('0x3'));var userController=require(_0xe0d4('0x4'));var authService=require(_0xe0d4('0x5'));router[_0xe0d4('0x6')]('/',controller[_0xe0d4('0x7')]);router[_0xe0d4('0x6')]('/callback',controller[_0xe0d4('0x8')],authService[_0xe0d4('0x9')],userController[_0xe0d4('0x7')],authService[_0xe0d4('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a8a4a31..6d024a5 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 _0x7c09=['findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','find','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x337c87,_0x1094fb){var _0x3234a9=function(_0x5caeab){while(--_0x5caeab){_0x337c87['push'](_0x337c87['shift']());}};_0x3234a9(++_0x1094fb);}(_0x7c09,0x102));var _0x97c0=function(_0x5850a0,_0x44148c){_0x5850a0=_0x5850a0-0x0;var _0x5b1888=_0x7c09[_0x5850a0];return _0x5b1888;};'use strict';var util=require('util');var passport=require(_0x97c0('0x0'));var LocalStrategy=require(_0x97c0('0x1'))['Strategy'];var jayson=require(_0x97c0('0x2'));var _=require(_0x97c0('0x3'));var rs=require(_0x97c0('0x4'));var moment=require(_0x97c0('0x5'));var db=require(_0x97c0('0x6'))['db'];var authService=require(_0x97c0('0x7'));var utils=require(_0x97c0('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x590368,_0x46fdd9,_0x42c6c7,_0x2c19fa){var _0x109bc8,_0x293785;return db['Setting'][_0x97c0('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x97c0('0xa')],'raw':!![]})[_0x97c0('0xb')](function(_0x52bce2){_0x109bc8=_0x52bce2;return _0x590368['findOne']({'attributes':['id',_0x97c0('0xc'),_0x97c0('0xd'),_0x97c0('0xe'),_0x97c0('0xf'),_0x97c0('0x10'),_0x97c0('0x11'),_0x97c0('0x12'),_0x97c0('0x13')],'where':{'name':_0x46fdd9,'role':{'$or':[_0x97c0('0x14'),_0x97c0('0x15'),_0x97c0('0x16')]}}});})[_0x97c0('0xb')](function(_0x20acfa){if(!_0x20acfa||_0x20acfa&&_0x20acfa['name']!==_0x46fdd9){throw new Error(_0x97c0('0x17'));}else{_0x293785=_0x20acfa;return _0x293785;}})[_0x97c0('0xb')](function(){_0x293785[_0x97c0('0x18')](_0x42c6c7,function(_0x496017,_0x42027d){var _0x9ca6a8=_0x293785[_0x97c0('0x13')]+0x1;if(_0x496017){return _0x2c19fa(_0x496017);}else if(!_0x42027d){if(_0x293785[_0x97c0('0x10')]){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else if(_0x109bc8[_0x97c0('0x19')]>0x0){if(_0x293785['blocked']){if(_0x109bc8[_0x97c0('0xa')]>0x0){if(moment(_0x293785[_0x97c0('0x12')])['add'](_0x109bc8[_0x97c0('0xa')],_0x97c0('0x1a'))>moment()){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else{return utils[_0x97c0('0x1b')](_0x293785,_0x9ca6a8,![],null)[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});});}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{if(_0x9ca6a8>=_0x109bc8[_0x97c0('0x19')]){return utils[_0x97c0('0x1b')](_0x293785,0x0,!![],moment())[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x293785,_0x9ca6a8,![],null)[_0x97c0('0xb')](function(){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});});}}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{if(_0x293785['disabled']){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else if(_0x109bc8[_0x97c0('0x19')]>0x0){if(_0x293785[_0x97c0('0x11')]){if(_0x109bc8[_0x97c0('0xa')]>0x0){if(moment(_0x293785[_0x97c0('0x12')])[_0x97c0('0x1c')](_0x109bc8[_0x97c0('0xa')],'minutes')>moment()){return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}else{return utils[_0x97c0('0x1b')](_0x293785,0x0,![],null)[_0x97c0('0xb')](function(){return utils[_0x97c0('0x1d')](_0x293785);})['then'](function(){return _0x2c19fa(null,_0x293785);});}}else{return _0x2c19fa(null,![],{'message':_0x97c0('0x17')});}}else{return utils[_0x97c0('0x1b')](_0x293785,0x0,![],null)['then'](function(){return utils[_0x97c0('0x1d')](_0x293785);})[_0x97c0('0xb')](function(){return _0x2c19fa(null,_0x293785);})[_0x97c0('0x1e')](function(_0x4af5a5){return _0x2c19fa(null,![],_0x4af5a5);});}}else{if(_0x293785['blocked']){return _0x2c19fa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x97c0('0x1d')](_0x293785)[_0x97c0('0xb')](function(){return _0x2c19fa(null,_0x293785);});}}}});})[_0x97c0('0x1e')](function(_0x225e43){return _0x2c19fa(null,![],_0x225e43);});}function sendServiceMail(_0x26939e){return db[_0x97c0('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x97c0('0xc'),_0x97c0('0x20')],'include':[{'model':db[_0x97c0('0x21')],'as':'Smtp'}]})[_0x97c0('0xb')](function(_0x148e95){if(!_0x148e95){throw new Error(_0x97c0('0x22'));}var _0x23d2af={'tls':{'rejectUnauthorized':![]}};if(_0x148e95[_0x97c0('0x23')]['service']){_0x23d2af['service']=_0x148e95[_0x97c0('0x23')][_0x97c0('0x24')];}else{_0x23d2af[_0x97c0('0x25')]=_0x148e95['Smtp'][_0x97c0('0x25')];_0x23d2af[_0x97c0('0x26')]=_0x148e95['Smtp'][_0x97c0('0x26')];_0x23d2af[_0x97c0('0x27')]=_0x148e95[_0x97c0('0x23')][_0x97c0('0x27')];}if(_0x148e95[_0x97c0('0x23')][_0x97c0('0x28')]){_0x23d2af[_0x97c0('0x29')]={'user':_0x148e95[_0x97c0('0x23')][_0x97c0('0x15')],'pass':_0x148e95[_0x97c0('0x23')][_0x97c0('0x2a')]};}var _0x356b73={'account':_0x23d2af,'message':_[_0x97c0('0x2b')]({'from':util[_0x97c0('0x2c')](_0x97c0('0x2d'),_0x148e95['name'],_0x148e95[_0x97c0('0x20')]||_0x148e95[_0x97c0('0x23')][_0x97c0('0x15')])},_0x26939e)};return client[_0x97c0('0x2e')](_0x97c0('0x2f'),_0x356b73);})[_0x97c0('0xb')](function(_0x40a780){if(_0x40a780[_0x97c0('0x30')]){throw new Error(util['format'](_0x97c0('0x31'),_0x40a780['error'][_0x97c0('0x32')]||JSON[_0x97c0('0x33')](_0x40a780[_0x97c0('0x30')])));}return!![];});}function handleError(_0x3988d3,_0x41e360,_0x2a613a){return _0x3988d3[_0x97c0('0x34')](_0x41e360||0x1f4)[_0x97c0('0x35')]({'message':_0x2a613a?_0x2a613a[_0x97c0('0x32')]||_0x2a613a:''});}exports[_0x97c0('0x36')]=function(_0x3f202d,_0x4a1dad,_0x3368d0){passport[_0x97c0('0x18')]('local',function(_0x137ee1,_0x477aae,_0x2aeffc){var _0x44dbe6=_0x137ee1||_0x2aeffc;if(_0x44dbe6){return handleError(_0x4a1dad,0x191,_0x44dbe6);}if(!_0x477aae){return handleError(_0x4a1dad,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x860e0c={'payload':{'id':_0x477aae['id'],'role':_0x477aae['role']},'options':{'expiresIn':0x15180}};return authService[_0x97c0('0x37')](_0x860e0c)[_0x97c0('0xb')](function(_0x5660b3){_0x4a1dad[_0x97c0('0x38')]({'id':_0x477aae['id'],'token':_0x5660b3,'statusCall':'','isAlreadyLogged':_0x477aae[_0x97c0('0x39')]});});}})(_0x3f202d,_0x4a1dad,_0x3368d0);};exports[_0x97c0('0x3a')]=function(_0xb13649,_0x33b034,_0x2121e8){if(!_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]){return handleError(_0x33b034,0x1f4,{'message':_0x97c0('0x3c')});}var _0x2d4c25=rs[_0x97c0('0x3d')]();_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]=_0xb13649['body'][_0x97c0('0x20')][_0x97c0('0x3e')]()[_0x97c0('0x3f')]();var _0x142421;return db[_0x97c0('0x40')][_0x97c0('0x9')]({'where':{'id':0x1},'attributes':[_0x97c0('0x19'),'blockDuration'],'raw':!![]})['then'](function(_0x10ee7b){_0x142421=_0x10ee7b;return db[_0x97c0('0x41')][_0x97c0('0x42')]({'where':{'email':_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')]}});})['then'](function(_0x5bcdc9){if(!_0x5bcdc9){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x5bcdc9[_0x97c0('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5bcdc9['blocked']){if(moment(_0x5bcdc9[_0x97c0('0x12')])[_0x97c0('0x1c')](_0x142421[_0x97c0('0xa')],_0x97c0('0x1a'))>moment()){throw new Error(_0x97c0('0x43'));}else{_0x5bcdc9['blocked']=![];_0x5bcdc9[_0x97c0('0x12')]=null;}}_0x5bcdc9[_0x97c0('0x44')]=_0x2d4c25;_0x5bcdc9[_0x97c0('0x45')]=Date[_0x97c0('0x46')]()+0x36ee80;return _0x5bcdc9[_0x97c0('0x47')]();})[_0x97c0('0xb')](function(){return sendServiceMail({'to':_0xb13649[_0x97c0('0x3b')][_0x97c0('0x20')],'subject':_0x97c0('0x48'),'text':_0x97c0('0x49')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x97c0('0x4a')+_0xb13649[_0x97c0('0x4b')][_0x97c0('0x25')]+_0x97c0('0x4c')+_0x2d4c25+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x33b034[_0x97c0('0x34')](0xc8)[_0x97c0('0x35')]({'message':_0x97c0('0x4d')});})['catch'](function(_0x3e09d5){return handleError(_0x33b034,0x1f4,_0x3e09d5);});};exports[_0x97c0('0x4e')]=function(_0x240f68,_0x2fc02f,_0x122524){return db['User'][_0x97c0('0x42')]({'where':{'resetPasswordToken':_0x240f68[_0x97c0('0x4f')][_0x97c0('0x50')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x94ce89){if(!_0x94ce89){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x97c0('0x9')]({'attributes':['id',_0x97c0('0x51'),_0x97c0('0x52'),'passwordHistoryLimit']})['then'](function(_0x5190b0){if(_0x5190b0[_0x97c0('0x51')])authService[_0x97c0('0x53')](_0x240f68[_0x97c0('0x3b')][_0x97c0('0xd')]);if(!_0x5190b0[_0x97c0('0x52')]||!_0x94ce89[_0x97c0('0x54')])return _0x94ce89;authService[_0x97c0('0x55')](_0x240f68['body'][_0x97c0('0xd')],_0x94ce89[_0x97c0('0x54')],_0x5190b0[_0x97c0('0x56')]);return _0x94ce89;})[_0x97c0('0xb')](function(){_0x94ce89[_0x97c0('0xd')]=_0x240f68[_0x97c0('0x3b')]['password'];_0x94ce89[_0x97c0('0x44')]=null;_0x94ce89[_0x97c0('0x45')]=null;return _0x94ce89['save']();});})[_0x97c0('0xb')](function(){_0x2fc02f[_0x97c0('0x34')](0xc8)[_0x97c0('0x35')]({'message':_0x97c0('0x57')});})[_0x97c0('0x1e')](function(_0x18992d){return handleError(_0x2fc02f,0x1f4,_0x18992d);});};passport[_0x97c0('0x58')](new LocalStrategy({'usernameField':'name','passwordField':_0x97c0('0xd')},function(_0x14e93c,_0x3cb4c7,_0x1919f5){return localAuthenticate(db[_0x97c0('0x41')],_0x14e93c,_0x3cb4c7,_0x1919f5);})); \ No newline at end of file +var _0xafc4=['headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','send','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','disabled','getLicense','catch','find','MailServerOut','Smtp','service','host','port','secure','authentication','pass','merge','format','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://'];(function(_0x2f1f08,_0x158f35){var _0x32f365=function(_0x2cc60e){while(--_0x2cc60e){_0x2f1f08['push'](_0x2f1f08['shift']());}};_0x32f365(++_0x158f35);}(_0xafc4,0x69));var _0x4afc=function(_0x178625,_0x26aaf8){_0x178625=_0x178625-0x0;var _0x6320de=_0xafc4[_0x178625];return _0x6320de;};'use strict';var util=require(_0x4afc('0x0'));var passport=require('passport');var LocalStrategy=require(_0x4afc('0x1'))['Strategy'];var jayson=require(_0x4afc('0x2'));var _=require(_0x4afc('0x3'));var rs=require(_0x4afc('0x4'));var moment=require(_0x4afc('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0x4afc('0x6')][_0x4afc('0x7')]({'port':0x232b});function localAuthenticate(_0x16953b,_0x1bb281,_0xc828d9,_0xaf053d){var _0x5e1e29,_0x31e165;return db[_0x4afc('0x8')][_0x4afc('0x9')]({'where':{'id':0x1},'attributes':[_0x4afc('0xa'),_0x4afc('0xb')],'raw':!![]})[_0x4afc('0xc')](function(_0x5542ec){_0x5e1e29=_0x5542ec;return _0x16953b['findOne']({'attributes':['id',_0x4afc('0xd'),'password',_0x4afc('0xe'),_0x4afc('0xf'),'disabled',_0x4afc('0x10'),_0x4afc('0x11'),_0x4afc('0x12')],'where':{'name':_0x1bb281,'role':{'$or':[_0x4afc('0x13'),_0x4afc('0x14'),_0x4afc('0x15')]}}});})[_0x4afc('0xc')](function(_0x23b03e){if(!_0x23b03e||_0x23b03e&&_0x23b03e['name']!==_0x1bb281){throw new Error(_0x4afc('0x16'));}else{_0x31e165=_0x23b03e;return _0x31e165;}})[_0x4afc('0xc')](function(){_0x31e165[_0x4afc('0x17')](_0xc828d9,function(_0x1e2c31,_0x5f2dc9){var _0x4e32e8=_0x31e165[_0x4afc('0x12')]+0x1;if(_0x1e2c31){return _0xaf053d(_0x1e2c31);}else if(!_0x5f2dc9){if(_0x31e165['disabled']){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else if(_0x5e1e29[_0x4afc('0xa')]>0x0){if(_0x31e165[_0x4afc('0x10')]){if(_0x5e1e29[_0x4afc('0xb')]>0x0){if(moment(_0x31e165[_0x4afc('0x11')])[_0x4afc('0x18')](_0x5e1e29[_0x4afc('0xb')],_0x4afc('0x19'))>moment()){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else{return utils[_0x4afc('0x1a')](_0x31e165,_0x4e32e8,![],null)[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{if(_0x4e32e8>=_0x5e1e29[_0x4afc('0xa')]){return utils[_0x4afc('0x1a')](_0x31e165,0x0,!![],moment())[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x4afc('0x1a')](_0x31e165,_0x4e32e8,![],null)[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});});}}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{if(_0x31e165[_0x4afc('0x1b')]){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else if(_0x5e1e29[_0x4afc('0xa')]>0x0){if(_0x31e165['blocked']){if(_0x5e1e29[_0x4afc('0xb')]>0x0){if(moment(_0x31e165[_0x4afc('0x11')])['add'](_0x5e1e29[_0x4afc('0xb')],'minutes')>moment()){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else{return utils[_0x4afc('0x1a')](_0x31e165,0x0,![],null)[_0x4afc('0xc')](function(){return utils[_0x4afc('0x1c')](_0x31e165);})[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);});}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{return utils[_0x4afc('0x1a')](_0x31e165,0x0,![],null)[_0x4afc('0xc')](function(){return utils[_0x4afc('0x1c')](_0x31e165);})[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);})[_0x4afc('0x1d')](function(_0x359c07){return _0xaf053d(null,![],_0x359c07);});}}else{if(_0x31e165[_0x4afc('0x10')]){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4afc('0x1c')](_0x31e165)[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);});}}}});})[_0x4afc('0x1d')](function(_0x4e254d){return _0xaf053d(null,![],_0x4e254d);});}function sendServiceMail(_0x52212d){return db['MailAccount'][_0x4afc('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x4afc('0xd'),'email'],'include':[{'model':db[_0x4afc('0x1f')],'as':_0x4afc('0x20')}]})['then'](function(_0x514278){if(!_0x514278){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3bae1a={'tls':{'rejectUnauthorized':![]}};if(_0x514278[_0x4afc('0x20')][_0x4afc('0x21')]){_0x3bae1a[_0x4afc('0x21')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x21')];}else{_0x3bae1a['host']=_0x514278[_0x4afc('0x20')][_0x4afc('0x22')];_0x3bae1a[_0x4afc('0x23')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x23')];_0x3bae1a[_0x4afc('0x24')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x24')];}if(_0x514278['Smtp'][_0x4afc('0x25')]){_0x3bae1a['auth']={'user':_0x514278['Smtp'][_0x4afc('0x14')],'pass':_0x514278[_0x4afc('0x20')][_0x4afc('0x26')]};}var _0x3d4ab5={'account':_0x3bae1a,'message':_[_0x4afc('0x27')]({'from':util[_0x4afc('0x28')]('\x22%s\x22\x20<%s>',_0x514278[_0x4afc('0xd')],_0x514278[_0x4afc('0x29')]||_0x514278[_0x4afc('0x20')][_0x4afc('0x14')])},_0x52212d)};return client[_0x4afc('0x2a')](_0x4afc('0x2b'),_0x3d4ab5);})['then'](function(_0x22eea2){if(_0x22eea2[_0x4afc('0x2c')]){throw new Error(util[_0x4afc('0x28')](_0x4afc('0x2d'),_0x22eea2['error']['message']||JSON[_0x4afc('0x2e')](_0x22eea2[_0x4afc('0x2c')])));}return!![];});}function handleError(_0x17ea03,_0x5edfe1,_0x5790a2){return _0x17ea03[_0x4afc('0x2f')](_0x5edfe1||0x1f4)['send']({'message':_0x5790a2?_0x5790a2['message']||_0x5790a2:''});}exports[_0x4afc('0x30')]=function(_0x1dc853,_0x2be40e,_0x3e41f5){passport[_0x4afc('0x17')](_0x4afc('0x31'),function(_0x453e12,_0x29c0df,_0x3ccc5a){var _0x38f762=_0x453e12||_0x3ccc5a;if(_0x38f762){return handleError(_0x2be40e,0x191,_0x38f762);}if(!_0x29c0df){return handleError(_0x2be40e,0x194,{'message':_0x4afc('0x32')});}else{var _0x3ef2aa={'payload':{'id':_0x29c0df['id'],'role':_0x29c0df[_0x4afc('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x4afc('0x33')](_0x3ef2aa)[_0x4afc('0xc')](function(_0x5589be){_0x2be40e[_0x4afc('0x34')]({'id':_0x29c0df['id'],'token':_0x5589be,'statusCall':'','isAlreadyLogged':_0x29c0df[_0x4afc('0x35')]});});}})(_0x1dc853,_0x2be40e,_0x3e41f5);};exports[_0x4afc('0x36')]=function(_0xe6db12,_0x12db1d,_0x260b06){if(!_0xe6db12[_0x4afc('0x37')]['email']){return handleError(_0x12db1d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5ee5d7=rs[_0x4afc('0x38')]();_0xe6db12[_0x4afc('0x37')]['email']=_0xe6db12[_0x4afc('0x37')][_0x4afc('0x29')][_0x4afc('0x39')]()[_0x4afc('0x3a')]();var _0x545109;return db[_0x4afc('0x8')][_0x4afc('0x9')]({'where':{'id':0x1},'attributes':[_0x4afc('0xa'),_0x4afc('0xb')],'raw':!![]})[_0x4afc('0xc')](function(_0x2404fc){_0x545109=_0x2404fc;return db['User'][_0x4afc('0x1e')]({'where':{'email':_0xe6db12['body'][_0x4afc('0x29')]}});})[_0x4afc('0xc')](function(_0x212441){if(!_0x212441){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x212441['disabled']){throw new Error(_0x4afc('0x3b'));}if(_0x212441[_0x4afc('0x10')]){if(moment(_0x212441[_0x4afc('0x11')])[_0x4afc('0x18')](_0x545109[_0x4afc('0xb')],_0x4afc('0x19'))>moment()){throw new Error(_0x4afc('0x3c'));}else{_0x212441[_0x4afc('0x10')]=![];_0x212441['blockedAt']=null;}}_0x212441[_0x4afc('0x3d')]=_0x5ee5d7;_0x212441[_0x4afc('0x3e')]=Date['now']()+0x36ee80;return _0x212441[_0x4afc('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0xe6db12[_0x4afc('0x37')][_0x4afc('0x29')],'subject':_0x4afc('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x4afc('0x41')+_0x4afc('0x42')+_0xe6db12[_0x4afc('0x43')][_0x4afc('0x22')]+_0x4afc('0x44')+_0x5ee5d7+'\x0a\x0a'+_0x4afc('0x45')});})['then'](function(){_0x12db1d['status'](0xc8)['send']({'message':_0x4afc('0x46')});})[_0x4afc('0x1d')](function(_0x42e274){return handleError(_0x12db1d,0x1f4,_0x42e274);});};exports[_0x4afc('0x47')]=function(_0xb5cca9,_0x122cbc,_0x22e8b0){return db[_0x4afc('0x48')][_0x4afc('0x1e')]({'where':{'resetPasswordToken':_0xb5cca9[_0x4afc('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0x4afc('0x4a')]()}}})['then'](function(_0x4861a5){if(!_0x4861a5){throw new Error(_0x4afc('0x4b'));}return db['Setting'][_0x4afc('0x9')]({'attributes':['id',_0x4afc('0x4c'),_0x4afc('0x4d'),_0x4afc('0x4e')]})['then'](function(_0x46461f){if(_0x46461f['securePassword'])authService[_0x4afc('0x4f')](_0xb5cca9[_0x4afc('0x37')][_0x4afc('0x50')]);if(!_0x46461f[_0x4afc('0x4d')]||!_0x4861a5[_0x4afc('0x51')])return _0x4861a5;authService[_0x4afc('0x52')](_0xb5cca9[_0x4afc('0x37')][_0x4afc('0x50')],_0x4861a5[_0x4afc('0x51')],_0x46461f[_0x4afc('0x4e')]);return _0x4861a5;})[_0x4afc('0xc')](function(){_0x4861a5[_0x4afc('0x50')]=_0xb5cca9['body'][_0x4afc('0x50')];_0x4861a5[_0x4afc('0x3d')]=null;_0x4861a5[_0x4afc('0x3e')]=null;return _0x4861a5[_0x4afc('0x3f')]();});})[_0x4afc('0xc')](function(){_0x122cbc[_0x4afc('0x2f')](0xc8)[_0x4afc('0x53')]({'message':_0x4afc('0x54')});})[_0x4afc('0x1d')](function(_0x3df333){return handleError(_0x122cbc,0x1f4,_0x3df333);});};passport[_0x4afc('0x55')](new LocalStrategy({'usernameField':_0x4afc('0xd'),'passwordField':_0x4afc('0x50')},function(_0x5c1421,_0x2abf25,_0x549ee4){return localAuthenticate(db[_0x4afc('0x48')],_0x5c1421,_0x2abf25,_0x549ee4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 68214b2..0210b0d 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 _0x8fab=['Router','./authLocal.controller','post','login','/forgot','forgot','reset'];(function(_0x23b2f1,_0xc08420){var _0x5215b6=function(_0x3683ab){while(--_0x3683ab){_0x23b2f1['push'](_0x23b2f1['shift']());}};_0x5215b6(++_0xc08420);}(_0x8fab,0x10a));var _0xb8fa=function(_0xa5c67,_0x2a705a){_0xa5c67=_0xa5c67-0x0;var _0x51130a=_0x8fab[_0xa5c67];return _0x51130a;};'use strict';var express=require('express');var router=express[_0xb8fa('0x0')]();var controller=require(_0xb8fa('0x1'));router[_0xb8fa('0x2')]('/',controller[_0xb8fa('0x3')]);router[_0xb8fa('0x2')](_0xb8fa('0x4'),controller[_0xb8fa('0x5')]);router[_0xb8fa('0x2')]('/reset/:token',controller[_0xb8fa('0x6')]);module['exports']=router; \ No newline at end of file +var _0x6265=['post','forgot','reset','exports','./authLocal.controller','login'];(function(_0x4b8117,_0x1582a8){var _0x53b488=function(_0x3cd063){while(--_0x3cd063){_0x4b8117['push'](_0x4b8117['shift']());}};_0x53b488(++_0x1582a8);}(_0x6265,0xa0));var _0x5626=function(_0x24e8db,_0x89fc47){_0x24e8db=_0x24e8db-0x0;var _0x576cc1=_0x6265[_0x24e8db];return _0x576cc1;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x5626('0x0'));router['post']('/',controller[_0x5626('0x1')]);router[_0x5626('0x2')]('/forgot',controller[_0x5626('0x3')]);router['post']('/reset/:token',controller[_0x5626('0x4')]);module[_0x5626('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4652be8..f7b5ced 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 _0x4ee6=['BOOLEAN','exports','STRING'];(function(_0x4bac4f,_0x33db86){var _0x150b3c=function(_0x4e2375){while(--_0x4e2375){_0x4bac4f['push'](_0x4bac4f['shift']());}};_0x150b3c(++_0x33db86);}(_0x4ee6,0xca));var _0x64ee=function(_0x3aef13,_0x305704){_0x3aef13=_0x3aef13-0x0;var _0x205a39=_0x4ee6[_0x3aef13];return _0x205a39;};'use strict';var Sequelize=require('sequelize');module[_0x64ee('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x64ee('0x1')]},'status':{'type':Sequelize[_0x64ee('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x9f86=['sequelize','exports','STRING','INTEGER'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9f86,0x100));var _0x69f8=function(_0x4c9730,_0x412b10){_0x4c9730=_0x4c9730-0x0;var _0x16a1ef=_0x9f86[_0x4c9730];return _0x16a1ef;};'use strict';var Sequelize=require(_0x69f8('0x0'));module[_0x69f8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x69f8('0x2')]},'description':{'type':Sequelize[_0x69f8('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x69f8('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index e9854f9..63cf95c 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x1709e1,_0x36187a){var _0x31f086=function(_0x250033){while(--_0x250033){_0x1709e1['push'](_0x1709e1['shift']());}};_0x31f086(++_0x36187a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x37acc5,_0x4d7989){var _0x3e6dba=function(_0x44f689){while(--_0x44f689){_0x37acc5['push'](_0x37acc5['shift']());}};_0x3e6dba(++_0x4d7989);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index b64b8b3..f62f0f9 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 _0x6330=['request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x282a23,_0x2a1e09){var _0x534a53=function(_0x2f20fe){while(--_0x2f20fe){_0x282a23['push'](_0x282a23['shift']());}};_0x534a53(++_0x2a1e09);}(_0x6330,0xcc));var _0x0633=function(_0x5289ca,_0x429aac){_0x5289ca=_0x5289ca-0x0;var _0x2270e4=_0x6330[_0x5289ca];return _0x2270e4;};'use strict';var _=require(_0x0633('0x0'));var util=require(_0x0633('0x1'));var logger=require(_0x0633('0x2'))(_0x0633('0x3'));var moment=require(_0x0633('0x4'));var BPromise=require(_0x0633('0x5'));var rp=require(_0x0633('0x6'));var fs=require('fs');var path=require(_0x0633('0x7'));var rimraf=require(_0x0633('0x8'));var config=require(_0x0633('0x9'));var attributes=require(_0x0633('0xa'));module[_0x0633('0xb')]=function(_0x5803b9,_0x475d02){return _0x5803b9[_0x0633('0xc')](_0x0633('0xd'),attributes,{'tableName':_0x0633('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd876=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','lodash','util','api'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xd876,0xed));var _0x6d87=function(_0x49fff0,_0x5979de){_0x49fff0=_0x49fff0-0x0;var _0x1ac976=_0xd876[_0x49fff0];return _0x1ac976;};'use strict';var _=require(_0x6d87('0x0'));var util=require(_0x6d87('0x1'));var logger=require('../../config/logger')(_0x6d87('0x2'));var moment=require(_0x6d87('0x3'));var BPromise=require(_0x6d87('0x4'));var rp=require(_0x6d87('0x5'));var fs=require('fs');var path=require(_0x6d87('0x6'));var rimraf=require(_0x6d87('0x7'));var config=require(_0x6d87('0x8'));var attributes=require(_0x6d87('0x9'));module[_0x6d87('0xa')]=function(_0x3b1fa3,_0x500178){return _0x3b1fa3['define'](_0x6d87('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 9436ad8..61d0355 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 _0x1332=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util'];(function(_0x41eff1,_0x197391){var _0x27d6ff=function(_0x48af8a){while(--_0x48af8a){_0x41eff1['push'](_0x41eff1['shift']());}};_0x27d6ff(++_0x197391);}(_0x1332,0x157));var _0x2133=function(_0x2198b2,_0x49a5a0){_0x2198b2=_0x2198b2-0x0;var _0xdb6c11=_0x1332[_0x2198b2];return _0xdb6c11;};'use strict';var _=require(_0x2133('0x0'));var util=require(_0x2133('0x1'));var moment=require(_0x2133('0x2'));var BPromise=require('bluebird');var rs=require(_0x2133('0x3'));var fs=require('fs');var Redis=require(_0x2133('0x4'));var db=require(_0x2133('0x5'))['db'];var utils=require(_0x2133('0x6'));var logger=require(_0x2133('0x7'))(_0x2133('0x8'));var config=require('../../config/environment');var jayson=require(_0x2133('0x9'));var client=jayson[_0x2133('0xa')][_0x2133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x73a4dd,_0x2d6743,_0xad86b9){return new BPromise(function(_0x26cc25,_0x520fe2){return client[_0x2133('0xc')](_0x73a4dd,_0xad86b9)[_0x2133('0xd')](function(_0x4d3645){logger[_0x2133('0xe')]('Automation,\x20%s,\x20%s',_0x2d6743,'request\x20sent');logger['debug'](_0x2133('0xf'),_0x2d6743,'request\x20sent',JSON[_0x2133('0x10')](_0x4d3645));if(_0x4d3645[_0x2133('0x11')]){if(_0x4d3645[_0x2133('0x11')]['code']===0x1f4){logger['error'](_0x2133('0x12'),_0x2d6743,_0x4d3645['error'][_0x2133('0x13')]);return _0x520fe2(_0x4d3645[_0x2133('0x11')][_0x2133('0x13')]);}logger[_0x2133('0x11')](_0x2133('0x12'),_0x2d6743,_0x4d3645[_0x2133('0x11')]['message']);return _0x26cc25(_0x4d3645[_0x2133('0x11')][_0x2133('0x13')]);}else{logger['info'](_0x2133('0x12'),_0x2d6743,_0x2133('0x14'));_0x26cc25(_0x4d3645[_0x2133('0x15')][_0x2133('0x13')]);}})[_0x2133('0x16')](function(_0x1efdf9){logger['error']('Automation,\x20%s,\x20%s',_0x2d6743,_0x1efdf9);_0x520fe2(_0x1efdf9);});});} \ No newline at end of file +var _0xb692=['../../config/logger','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x2df387,_0x1d3ea1){var _0x3b1708=function(_0x49c05b){while(--_0x49c05b){_0x2df387['push'](_0x2df387['shift']());}};_0x3b1708(++_0x1d3ea1);}(_0xb692,0x163));var _0x2b69=function(_0xe4d35a,_0x4bd94d){_0xe4d35a=_0xe4d35a-0x0;var _0x249363=_0xb692[_0xe4d35a];return _0x249363;};'use strict';var _=require(_0x2b69('0x0'));var util=require(_0x2b69('0x1'));var moment=require(_0x2b69('0x2'));var BPromise=require('bluebird');var rs=require(_0x2b69('0x3'));var fs=require('fs');var Redis=require(_0x2b69('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b69('0x5'));var logger=require(_0x2b69('0x6'))('rpc');var config=require(_0x2b69('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2b69('0x8')][_0x2b69('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bd228,_0x56295e,_0x4169a2){return new BPromise(function(_0x43f45a,_0x31e087){return client[_0x2b69('0xa')](_0x5bd228,_0x4169a2)[_0x2b69('0xb')](function(_0x178fa2){logger[_0x2b69('0xc')](_0x2b69('0xd'),_0x56295e,_0x2b69('0xe'));logger[_0x2b69('0xf')](_0x2b69('0x10'),_0x56295e,_0x2b69('0xe'),JSON['stringify'](_0x178fa2));if(_0x178fa2[_0x2b69('0x11')]){if(_0x178fa2[_0x2b69('0x11')]['code']===0x1f4){logger[_0x2b69('0x11')](_0x2b69('0xd'),_0x56295e,_0x178fa2[_0x2b69('0x11')][_0x2b69('0x12')]);return _0x31e087(_0x178fa2['error'][_0x2b69('0x12')]);}logger[_0x2b69('0x11')]('Automation,\x20%s,\x20%s',_0x56295e,_0x178fa2[_0x2b69('0x11')][_0x2b69('0x12')]);return _0x43f45a(_0x178fa2[_0x2b69('0x11')][_0x2b69('0x12')]);}else{logger['info'](_0x2b69('0xd'),_0x56295e,_0x2b69('0xe'));_0x43f45a(_0x178fa2['result'][_0x2b69('0x12')]);}})['catch'](function(_0xfa7fd9){logger['error']('Automation,\x20%s,\x20%s',_0x56295e,_0xfa7fd9);_0x31e087(_0xfa7fd9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ca5d941..2220857 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 _0xfc7c=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','update','util','connect-timeout','express'];(function(_0x105d67,_0x2c68cf){var _0x2cb749=function(_0x20b735){while(--_0x20b735){_0x105d67['push'](_0x105d67['shift']());}};_0x2cb749(++_0x2c68cf);}(_0xfc7c,0x18d));var _0xcfc7=function(_0xa48e4f,_0x442ba4){_0xa48e4f=_0xa48e4f-0x0;var _0x483abf=_0xfc7c[_0xa48e4f];return _0x483abf;};'use strict';var multer=require('multer');var util=require(_0xcfc7('0x0'));var path=require('path');var timeout=require(_0xcfc7('0x1'));var express=require(_0xcfc7('0x2'));var router=express[_0xcfc7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcfc7('0x4'));var config=require(_0xcfc7('0x5'));var controller=require('./automation.controller');router['get']('/',auth[_0xcfc7('0x6')](),controller[_0xcfc7('0x7')]);router[_0xcfc7('0x8')](_0xcfc7('0x9'),auth[_0xcfc7('0x6')](),controller[_0xcfc7('0xa')]);router[_0xcfc7('0x8')](_0xcfc7('0xb'),auth[_0xcfc7('0x6')](),controller[_0xcfc7('0xc')]);router[_0xcfc7('0x8')](_0xcfc7('0xd'),auth[_0xcfc7('0x6')](),controller[_0xcfc7('0xe')]);router[_0xcfc7('0xf')]('/',auth[_0xcfc7('0x6')](),controller[_0xcfc7('0x10')]);router['post'](_0xcfc7('0xb'),auth['isAuthenticated'](),controller[_0xcfc7('0x11')]);router[_0xcfc7('0xf')](_0xcfc7('0xd'),auth[_0xcfc7('0x6')](),controller[_0xcfc7('0x12')]);router['put'](_0xcfc7('0x9'),auth[_0xcfc7('0x6')](),controller[_0xcfc7('0x13')]);router['delete'](_0xcfc7('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe823=['../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post','addActions','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x166146,_0x1f34c6){var _0x9c7390=function(_0x1e368c){while(--_0x1e368c){_0x166146['push'](_0x166146['shift']());}};_0x9c7390(++_0x1f34c6);}(_0xe823,0x1de));var _0x3e82=function(_0x397435,_0x10a914){_0x397435=_0x397435-0x0;var _0x776617=_0xe823[_0x397435];return _0x776617;};'use strict';var multer=require(_0x3e82('0x0'));var util=require(_0x3e82('0x1'));var path=require('path');var timeout=require(_0x3e82('0x2'));var express=require(_0x3e82('0x3'));var router=express['Router']();var auth=require(_0x3e82('0x4'));var interaction=require(_0x3e82('0x5'));var config=require(_0x3e82('0x6'));var controller=require(_0x3e82('0x7'));router[_0x3e82('0x8')]('/',auth[_0x3e82('0x9')](),controller[_0x3e82('0xa')]);router['get'](_0x3e82('0xb'),auth['isAuthenticated'](),controller[_0x3e82('0xc')]);router[_0x3e82('0x8')](_0x3e82('0xd'),auth[_0x3e82('0x9')](),controller[_0x3e82('0xe')]);router[_0x3e82('0x8')](_0x3e82('0xf'),auth[_0x3e82('0x9')](),controller['getActions']);router[_0x3e82('0x10')]('/',auth[_0x3e82('0x9')](),controller['create']);router[_0x3e82('0x10')](_0x3e82('0xd'),auth['isAuthenticated'](),controller['addConditions']);router[_0x3e82('0x10')](_0x3e82('0xf'),auth[_0x3e82('0x9')](),controller[_0x3e82('0x11')]);router[_0x3e82('0x12')](_0x3e82('0xb'),auth[_0x3e82('0x9')](),controller[_0x3e82('0x13')]);router[_0x3e82('0x14')](_0x3e82('0xb'),auth[_0x3e82('0x9')](),controller['destroy']);module[_0x3e82('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index db7b172..dae8b66 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 _0xb945=['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\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always'];(function(_0x3845ae,_0x16637d){var _0x4ce5b4=function(_0x349706){while(--_0x349706){_0x3845ae['push'](_0x3845ae['shift']());}};_0x4ce5b4(++_0x16637d);}(_0xb945,0x117));var _0x5b94=function(_0x3e3dd4,_0x513af){_0x3e3dd4=_0x3e3dd4-0x0;var _0x19e439=_0xb945[_0x3e3dd4];return _0x19e439;};'use strict';var Sequelize=require(_0x5b94('0x0'));module[_0x5b94('0x1')]={'name':{'type':Sequelize[_0x5b94('0x2')],'unique':_0x5b94('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5b94('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x5b94('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5b94('0x6')],'defaultValue':0x0,'comment':_0x5b94('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5b94('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x5b94('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5b94('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5b94('0x9')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b94('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5b94('0x9')](0x3)[_0x5b94('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b94('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5b94('0x9')](0x5)[_0x5b94('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5b94('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b94('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b94('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5b94('0x9')](0x3)[_0x5b94('0x8')],'defaultValue':0x3,'comment':_0x5b94('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5b94('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5b94('0x11')},'dialTimezone':{'type':Sequelize[_0x5b94('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5b94('0x2')],'defaultValue':_0x5b94('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x5b94('0x4')]('always',_0x5b94('0x13'),_0x5b94('0x14')),'defaultValue':_0x5b94('0x15')},'dialAMDActive':{'type':Sequelize[_0x5b94('0x6')],'defaultValue':0x0,'comment':_0x5b94('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0x5b94('0x9')](0x9)[_0x5b94('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5b94('0x17')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5b94('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5b94('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5b94('0x19')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5b94('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5b94('0x1a')},'dialAMDMinWordLength':{'type':Sequelize[_0x5b94('0x9')](0x9)[_0x5b94('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5b94('0x1b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5b94('0x9')](0x9)[_0x5b94('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5b94('0x1c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x5b94('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5b94('0x1d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5b94('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5b94('0x9')](0x9)[_0x5b94('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5b94('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5b94('0x4')](_0x5b94('0x1f'),_0x5b94('0x20')),'defaultValue':_0x5b94('0x1f')},'dialPrefix':{'type':Sequelize[_0x5b94('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5b94('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5b94('0x21')},'dialCutDigit':{'type':Sequelize[_0x5b94('0x9')](0x3)[_0x5b94('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5b94('0x22')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5b94('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b94('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x5b94('0x9')](0x3)[_0x5b94('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b94('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0x5b94('0x9')](0x5)[_0x5b94('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5b94('0x9')](0x3)[_0x5b94('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5b94('0x9')](0x5)[_0x5b94('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x5b94('0x9')](0x3)[_0x5b94('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b94('0x27')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5b94('0x9')](0x5)[_0x5b94('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5b94('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b94('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b94('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b94('0x2a')}}; \ No newline at end of file +var _0xa7f3=['name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING'];(function(_0x4f435a,_0x32972a){var _0x4f2316=function(_0x52d62f){while(--_0x52d62f){_0x4f435a['push'](_0x4f435a['shift']());}};_0x4f2316(++_0x32972a);}(_0xa7f3,0x101));var _0x3a7f=function(_0x5b22e5,_0x50a727){_0x5b22e5=_0x5b22e5-0x0;var _0x50aa89=_0xa7f3[_0x5b22e5];return _0x50aa89;};'use strict';var Sequelize=require('sequelize');module[_0x3a7f('0x0')]={'name':{'type':Sequelize[_0x3a7f('0x1')],'unique':_0x3a7f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3a7f('0x3')](_0x3a7f('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x3a7f('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3a7f('0x5')},'limitCalls':{'type':Sequelize[_0x3a7f('0x6')](0x4)[_0x3a7f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3a7f('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3a7f('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3a7f('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a7f('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3a7f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a7f('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3a7f('0x6')](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a7f('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a7f('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3a7f('0x6')](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a7f('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3a7f('0x6')](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a7f('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3a7f('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3a7f('0x1')],'defaultValue':_0x3a7f('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x3a7f('0x3')](_0x3a7f('0x11'),_0x3a7f('0x12'),_0x3a7f('0x13')),'defaultValue':_0x3a7f('0x11')},'dialAMDActive':{'type':Sequelize[_0x3a7f('0x14')],'defaultValue':0x0,'comment':_0x3a7f('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3a7f('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3a7f('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x3a7f('0x6')](0x9)[_0x3a7f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3a7f('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3a7f('0x6')](0x9)[_0x3a7f('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3a7f('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3a7f('0x6')](0x9)[_0x3a7f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3a7f('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x3a7f('0x6')](0x9)[_0x3a7f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3a7f('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3a7f('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3a7f('0x6')](0x9)['UNSIGNED'],'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':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3a7f('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3a7f('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3a7f('0x3')](_0x3a7f('0x1c'),_0x3a7f('0x1d')),'defaultValue':_0x3a7f('0x1c')},'dialPrefix':{'type':Sequelize[_0x3a7f('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3a7f('0x1e')},'dialCutDigit':{'type':Sequelize[_0x3a7f('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3a7f('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a7f('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a7f('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a7f('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x3a7f('0x6')](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3a7f('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3a7f('0x6')](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3a7f('0x6')](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3a7f('0x6')](0x3)[_0x3a7f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3a7f('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3a7f('0x6')](0x5)[_0x3a7f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 16e6a58..57f50ba 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 _0xce21=['NOW()','field','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','push','removeLists','ids','getBlackLists','addBlackLists','sequelize','all','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','index','map','Campaign','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','role','UserProfileSection','error','getHoppers','findOne','pick','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','insert','into','fromQuery','scheduledAt','ContactId','ListId','select','phone'];(function(_0x50d933,_0x1ec00c){var _0x437b9d=function(_0x314731){while(--_0x314731){_0x50d933['push'](_0x50d933['shift']());}};_0x437b9d(++_0x1ec00c);}(_0xce21,0x9f));var _0x1ce2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xce21[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0x1ce2('0x0'));var emlformat=require(_0x1ce2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1ce2('0x2'));var jsonpatch=require(_0x1ce2('0x3'));var rp=require(_0x1ce2('0x4'));var moment=require(_0x1ce2('0x5'));var BPromise=require(_0x1ce2('0x6'));var Mustache=require(_0x1ce2('0x7'));var util=require('util');var path=require(_0x1ce2('0x8'));var sox=require('sox');var csv=require(_0x1ce2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ce2('0xa'));var squel=require(_0x1ce2('0xb'));var crypto=require(_0x1ce2('0xc'));var jsforce=require(_0x1ce2('0xd'));var deskjs=require(_0x1ce2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ce2('0xf'));var Papa=require(_0x1ce2('0x10'));var Redis=require(_0x1ce2('0x11'));var authService=require(_0x1ce2('0x12'));var qs=require(_0x1ce2('0x13'));var as=require(_0x1ce2('0x14'));var hardwareService=require(_0x1ce2('0x15'));var logger=require(_0x1ce2('0x16'))(_0x1ce2('0x17'));var utils=require(_0x1ce2('0x18'));var config=require(_0x1ce2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28d67d,_0x117362){_0x117362=_0x117362||0xcc;return function(_0x2065cd){if(_0x2065cd){return _0x28d67d[_0x1ce2('0x1a')](_0x117362);}return _0x28d67d[_0x1ce2('0x1b')](_0x117362)[_0x1ce2('0x1c')]();};}function respondWithResult(_0x11b814,_0x2f0650){_0x2f0650=_0x2f0650||0xc8;return function(_0x3a578a){if(_0x3a578a){return _0x11b814[_0x1ce2('0x1b')](_0x2f0650)['json'](_0x3a578a);}};}function respondWithFilteredResult(_0x48c8ea,_0x12222b){return function(_0x538530){if(_0x538530){var _0x5db4ab=_0x538530[_0x1ce2('0x1d')],_0xf5bfaf=_0x12222b[_0x1ce2('0x1e')],_0x42322b=_0x12222b[_0x1ce2('0x1e')]+_0x12222b[_0x1ce2('0x1f')],_0x4730ec;if(_0x42322b>=_0x5db4ab){_0x42322b=_0x5db4ab;_0x4730ec=0xc8;}else{_0x4730ec=0xce;}_0x48c8ea[_0x1ce2('0x1b')](_0x4730ec);return _0x48c8ea['set'](_0x1ce2('0x20'),_0xf5bfaf+'-'+_0x42322b+'/'+_0x5db4ab)[_0x1ce2('0x21')](_0x538530);}return null;};}function patchUpdates(_0x490b6f){return function(_0x5f1d09){try{jsonpatch[_0x1ce2('0x22')](_0x5f1d09,_0x490b6f,!![]);}catch(_0x387ccb){return BPromise[_0x1ce2('0x23')](_0x387ccb);}return _0x5f1d09[_0x1ce2('0x24')]();};}function saveUpdates(_0x4b64cd,_0x120442){return function(_0x563dc2){if(_0x563dc2){return _0x563dc2[_0x1ce2('0x25')](_0x4b64cd)[_0x1ce2('0x26')](function(_0xed9e19){return _0xed9e19;});}return null;};}function removeEntity(_0x2874dc,_0x380d24){return function(_0x24eaa4){if(_0x24eaa4){return _0x24eaa4[_0x1ce2('0x27')]()[_0x1ce2('0x26')](function(){var _0x31e85d=_0x24eaa4[_0x1ce2('0x28')]({'plain':!![]});var _0x8c6ff1=_0x1ce2('0x29');return db[_0x1ce2('0x2a')][_0x1ce2('0x27')]({'where':{'type':_0x8c6ff1,'resourceId':_0x31e85d['id']}})[_0x1ce2('0x26')](function(){return _0x24eaa4;});})[_0x1ce2('0x26')](function(){_0x2874dc[_0x1ce2('0x1b')](0xcc)[_0x1ce2('0x1c')]();});}};}function handleEntityNotFound(_0x517d90,_0x117ebc){return function(_0x2589f7){if(!_0x2589f7){_0x517d90[_0x1ce2('0x1a')](0x194);}return _0x2589f7;};}function handleError(_0x331e9a,_0x24ec71){_0x24ec71=_0x24ec71||0x1f4;return function(_0x21e57a){logger['error'](_0x21e57a[_0x1ce2('0x2b')]);if(_0x21e57a[_0x1ce2('0x2c')]){delete _0x21e57a[_0x1ce2('0x2c')];}_0x331e9a[_0x1ce2('0x1b')](_0x24ec71)['send'](_0x21e57a);};}exports[_0x1ce2('0x2d')]=function(_0x36ae06,_0x4dfba1){var _0x5b4cbf={},_0x69e7a8={},_0xa19cd2={'count':0x0,'rows':[]};var _0xc1634c=_[_0x1ce2('0x2e')](db[_0x1ce2('0x2f')]['rawAttributes'],function(_0x2c1ee2){return{'name':_0x2c1ee2[_0x1ce2('0x30')],'type':_0x2c1ee2[_0x1ce2('0x31')][_0x1ce2('0x32')]};});_0x69e7a8[_0x1ce2('0x33')]=_[_0x1ce2('0x2e')](_0xc1634c,_0x1ce2('0x2c'));_0x69e7a8[_0x1ce2('0x34')]=_[_0x1ce2('0x35')](_0x36ae06['query']);_0x69e7a8[_0x1ce2('0x36')]=_[_0x1ce2('0x37')](_0x69e7a8[_0x1ce2('0x33')],_0x69e7a8['query']);_0x5b4cbf[_0x1ce2('0x38')]=_[_0x1ce2('0x37')](_0x69e7a8[_0x1ce2('0x33')],qs[_0x1ce2('0x39')](_0x36ae06[_0x1ce2('0x34')]['fields']));_0x5b4cbf[_0x1ce2('0x38')]=_0x5b4cbf[_0x1ce2('0x38')][_0x1ce2('0x3a')]?_0x5b4cbf[_0x1ce2('0x38')]:_0x69e7a8[_0x1ce2('0x33')];if(!_0x36ae06[_0x1ce2('0x34')][_0x1ce2('0x3b')](_0x1ce2('0x3c'))){_0x5b4cbf[_0x1ce2('0x1f')]=qs[_0x1ce2('0x1f')](_0x36ae06[_0x1ce2('0x34')]['limit']);_0x5b4cbf[_0x1ce2('0x1e')]=qs[_0x1ce2('0x1e')](_0x36ae06[_0x1ce2('0x34')][_0x1ce2('0x1e')]);}_0x5b4cbf[_0x1ce2('0x3d')]=qs[_0x1ce2('0x3e')](_0x36ae06[_0x1ce2('0x34')][_0x1ce2('0x3e')]);_0x5b4cbf['where']=qs[_0x1ce2('0x36')](_['pick'](_0x36ae06[_0x1ce2('0x34')],_0x69e7a8[_0x1ce2('0x36')]),_0xc1634c);if(_0x36ae06[_0x1ce2('0x34')][_0x1ce2('0x3f')]){_0x5b4cbf[_0x1ce2('0x40')]=_[_0x1ce2('0x41')](_0x5b4cbf[_0x1ce2('0x40')],{'$or':_[_0x1ce2('0x2e')](_0xc1634c,function(_0x306840){if(_0x306840[_0x1ce2('0x31')]!=='VIRTUAL'){var _0x54a7ce={};_0x54a7ce[_0x306840[_0x1ce2('0x2c')]]={'$like':'%'+_0x36ae06[_0x1ce2('0x34')][_0x1ce2('0x3f')]+'%'};return _0x54a7ce;}})});}_0x5b4cbf=_[_0x1ce2('0x41')]({},_0x5b4cbf,_0x36ae06[_0x1ce2('0x42')]);var _0x4c497d={'where':_0x5b4cbf[_0x1ce2('0x40')]};return db[_0x1ce2('0x2f')]['count'](_0x4c497d)[_0x1ce2('0x26')](function(_0x94a24f){_0xa19cd2['count']=_0x94a24f;if(_0x36ae06[_0x1ce2('0x34')][_0x1ce2('0x43')]){_0x5b4cbf[_0x1ce2('0x44')]=[{'all':!![]}];}return db[_0x1ce2('0x2f')][_0x1ce2('0x45')](_0x5b4cbf);})[_0x1ce2('0x26')](function(_0x45deb9){_0xa19cd2[_0x1ce2('0x46')]=_0x45deb9;return _0xa19cd2;})[_0x1ce2('0x26')](respondWithFilteredResult(_0x4dfba1,_0x5b4cbf))['catch'](handleError(_0x4dfba1,null));};exports[_0x1ce2('0x47')]=function(_0x33ecec,_0x59d03b){var _0x3bb0c6={'raw':![],'where':{'id':_0x33ecec[_0x1ce2('0x48')]['id']}},_0x405485={};_0x405485[_0x1ce2('0x33')]=_['keys'](db[_0x1ce2('0x2f')][_0x1ce2('0x49')]);_0x405485[_0x1ce2('0x34')]=_[_0x1ce2('0x35')](_0x33ecec['query']);_0x405485['filters']=_[_0x1ce2('0x37')](_0x405485[_0x1ce2('0x33')],_0x405485[_0x1ce2('0x34')]);_0x3bb0c6[_0x1ce2('0x38')]=_['intersection'](_0x405485[_0x1ce2('0x33')],qs['fields'](_0x33ecec[_0x1ce2('0x34')][_0x1ce2('0x39')]));_0x3bb0c6[_0x1ce2('0x38')]=_0x3bb0c6[_0x1ce2('0x38')][_0x1ce2('0x3a')]?_0x3bb0c6[_0x1ce2('0x38')]:_0x405485[_0x1ce2('0x33')];if(_0x33ecec[_0x1ce2('0x34')][_0x1ce2('0x43')]){_0x3bb0c6[_0x1ce2('0x44')]=[{'all':!![]}];}_0x3bb0c6=_[_0x1ce2('0x41')]({},_0x3bb0c6,_0x33ecec['options']);return db[_0x1ce2('0x2f')][_0x1ce2('0x4a')](_0x3bb0c6)[_0x1ce2('0x26')](handleEntityNotFound(_0x59d03b,null))[_0x1ce2('0x26')](respondWithResult(_0x59d03b,null))[_0x1ce2('0x4b')](handleError(_0x59d03b,null));};exports[_0x1ce2('0x4c')]=function(_0x1ef70e,_0x2f2587){return db[_0x1ce2('0x2f')][_0x1ce2('0x4c')](_0x1ef70e[_0x1ce2('0x4d')],{})[_0x1ce2('0x26')](function(_0x6cf676){var _0x1b41b1=_0x1ef70e['user'][_0x1ce2('0x28')]({'plain':!![]});if(!_0x1b41b1)throw new Error(_0x1ce2('0x4e'));if(_0x1b41b1['role']==='user'){var _0x426499=_0x6cf676[_0x1ce2('0x28')]({'plain':!![]});var _0x4b9117=_0x1ce2('0x29');return db['UserProfileSection'][_0x1ce2('0x4a')]({'where':{'name':_0x4b9117,'userProfileId':_0x1b41b1[_0x1ce2('0x4f')]},'raw':!![]})[_0x1ce2('0x26')](function(_0x576fb5){if(_0x576fb5&&_0x576fb5[_0x1ce2('0x50')]===0x0){return db[_0x1ce2('0x2a')]['create']({'name':_0x426499[_0x1ce2('0x2c')],'resourceId':_0x426499['id'],'type':_0x576fb5[_0x1ce2('0x2c')],'sectionId':_0x576fb5['id']},{})[_0x1ce2('0x26')](function(){return _0x6cf676;});}else{return _0x6cf676;}})[_0x1ce2('0x4b')](function(_0x287b30){logger['error'](_0x1ce2('0x51'),_0x287b30);throw _0x287b30;});}return _0x6cf676;})[_0x1ce2('0x26')](respondWithResult(_0x2f2587,0xc9))[_0x1ce2('0x4b')](handleError(_0x2f2587,null));};exports[_0x1ce2('0x52')]=function(_0x443120,_0x3b2422){var _0x1476f0={'where':{'id':_0x443120[_0x1ce2('0x48')]['id']}},_0x34b45c={};_0x34b45c['model']=_[_0x1ce2('0x35')](db[_0x1ce2('0x2f')]['rawAttributes']);_0x1476f0[_0x1ce2('0x38')]=_['intersection'](_0x34b45c[_0x1ce2('0x33')],qs[_0x1ce2('0x39')](_0x443120[_0x1ce2('0x34')]['fields']));_0x1476f0[_0x1ce2('0x38')]=_0x1476f0['attributes'][_0x1ce2('0x3a')]?_0x1476f0[_0x1ce2('0x38')]:_0x34b45c[_0x1ce2('0x33')];if(_0x443120[_0x1ce2('0x34')][_0x1ce2('0x43')]){_0x1476f0[_0x1ce2('0x44')]=[{'all':!![]}];}_0x1476f0=_[_0x1ce2('0x41')]({},_0x1476f0,_0x443120[_0x1ce2('0x42')]);return db['Campaign'][_0x1ce2('0x4a')](_0x1476f0)[_0x1ce2('0x26')](handleEntityNotFound(_0x3b2422,null))['then'](function(_0xe0d11a){if(_0xe0d11a){var _0x5c3ee2=_0xe0d11a['get']({'plain':!![]});_0x5c3ee2=qs[_0x1ce2('0x53')](_0x5c3ee2,['id',_0x1ce2('0x54'),'updatedAt']);_0x443120[_0x1ce2('0x4d')]=_[_0x1ce2('0x53')](_0x443120[_0x1ce2('0x4d')],['id',_0x1ce2('0x54'),_0x1ce2('0x55')]);return db[_0x1ce2('0x2f')]['create'](_['merge'](_0x5c3ee2,_0x443120[_0x1ce2('0x4d')]),{'include':_0x443120[_0x1ce2('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0x1ce2('0x26')](function(_0x1f1852){var _0x4f28f4=_0x443120[_0x1ce2('0x56')]['get']({'plain':!![]});if(!_0x4f28f4)throw new Error(_0x1ce2('0x4e'));if(_0x4f28f4[_0x1ce2('0x57')]==='user'){var _0x3f03f9=_0x1f1852[_0x1ce2('0x28')]({'plain':!![]});var _0x14edc6=_0x1ce2('0x29');return db[_0x1ce2('0x58')][_0x1ce2('0x4a')]({'where':{'name':_0x14edc6,'userProfileId':_0x4f28f4[_0x1ce2('0x4f')]},'raw':!![]})[_0x1ce2('0x26')](function(_0x296781){if(_0x296781&&_0x296781[_0x1ce2('0x50')]===0x0){return db[_0x1ce2('0x2a')][_0x1ce2('0x4c')]({'name':_0x3f03f9[_0x1ce2('0x2c')],'resourceId':_0x3f03f9['id'],'type':_0x296781[_0x1ce2('0x2c')],'sectionId':_0x296781['id']},{})['then'](function(){return _0x1f1852;});}else{return _0x1f1852;}})[_0x1ce2('0x4b')](function(_0x429172){logger[_0x1ce2('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x429172);throw _0x429172;});}return _0x1f1852;});}})['then'](respondWithResult(_0x3b2422,0xc9))[_0x1ce2('0x4b')](handleError(_0x3b2422,null));};exports[_0x1ce2('0x25')]=function(_0x266d81,_0x31d0b4){if(_0x266d81[_0x1ce2('0x4d')]['id']){delete _0x266d81['body']['id'];}return db[_0x1ce2('0x2f')]['find']({'where':{'id':_0x266d81[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x31d0b4,null))['then'](saveUpdates(_0x266d81[_0x1ce2('0x4d')],null))[_0x1ce2('0x26')](respondWithResult(_0x31d0b4,null))[_0x1ce2('0x4b')](handleError(_0x31d0b4,null));};exports[_0x1ce2('0x27')]=function(_0x37ccd7,_0x2db3e3){return db[_0x1ce2('0x2f')]['find']({'where':{'id':_0x37ccd7['params']['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x2db3e3,null))[_0x1ce2('0x26')](removeEntity(_0x2db3e3,null))[_0x1ce2('0x4b')](handleError(_0x2db3e3,null));};exports[_0x1ce2('0x5a')]=function(_0x17ea52,_0x193e8e,_0x36f85e){var _0x1e62ec={'raw':!![],'where':{}};var _0x51170d={};var _0x40bf06={'count':0x0,'rows':[]};return db['Campaign'][_0x1ce2('0x5b')]({'where':{'id':_0x17ea52['params']['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x193e8e,null))['then'](function(_0x540236){if(_0x540236){_0x51170d['model']=_[_0x1ce2('0x35')](db['CmHopper']['rawAttributes']);_0x51170d[_0x1ce2('0x34')]=_['keys'](_0x17ea52[_0x1ce2('0x34')]);_0x51170d[_0x1ce2('0x36')]=_[_0x1ce2('0x37')](_0x51170d['model'],_0x51170d['query']);_0x1e62ec[_0x1ce2('0x38')]=_[_0x1ce2('0x37')](_0x51170d[_0x1ce2('0x33')],qs[_0x1ce2('0x39')](_0x17ea52[_0x1ce2('0x34')][_0x1ce2('0x39')]));_0x1e62ec[_0x1ce2('0x38')]=_0x1e62ec[_0x1ce2('0x38')][_0x1ce2('0x3a')]?_0x1e62ec[_0x1ce2('0x38')]:_0x51170d['model'];if(!_0x17ea52[_0x1ce2('0x34')][_0x1ce2('0x3b')](_0x1ce2('0x3c'))){_0x1e62ec[_0x1ce2('0x1f')]=qs[_0x1ce2('0x1f')](_0x17ea52[_0x1ce2('0x34')][_0x1ce2('0x1f')]);_0x1e62ec['offset']=qs[_0x1ce2('0x1e')](_0x17ea52[_0x1ce2('0x34')]['offset']);}_0x1e62ec[_0x1ce2('0x3d')]=qs[_0x1ce2('0x3e')](_0x17ea52['query']['sort']);_0x1e62ec[_0x1ce2('0x40')]=qs[_0x1ce2('0x36')](_[_0x1ce2('0x5c')](_0x17ea52[_0x1ce2('0x34')],_0x51170d['filters']));_0x1e62ec[_0x1ce2('0x40')][_0x1ce2('0x5d')]=_0x540236['id'];if(_0x17ea52[_0x1ce2('0x34')]['filter']){_0x1e62ec['where']=_['merge'](_0x1e62ec[_0x1ce2('0x40')],{'$or':_[_0x1ce2('0x2e')](_0x1e62ec[_0x1ce2('0x38')],function(_0x13ced4){var _0x497454={};_0x497454[_0x13ced4]={'$like':'%'+_0x17ea52['query'][_0x1ce2('0x3f')]+'%'};return _0x497454;})});}_0x1e62ec=_[_0x1ce2('0x41')]({},_0x1e62ec,_0x17ea52['options']);return db['CmHopper'][_0x1ce2('0x1d')]({'where':_0x1e62ec[_0x1ce2('0x40')]})['then'](function(_0x15f285){_0x40bf06[_0x1ce2('0x1d')]=_0x15f285;if(_0x17ea52[_0x1ce2('0x34')][_0x1ce2('0x43')]){_0x1e62ec[_0x1ce2('0x44')]=[{'all':!![]}];}return db[_0x1ce2('0x5e')]['findAll'](_0x1e62ec);})[_0x1ce2('0x26')](function(_0x50a318){_0x40bf06[_0x1ce2('0x46')]=_0x50a318;return _0x40bf06;});}})[_0x1ce2('0x26')](respondWithFilteredResult(_0x193e8e,_0x1e62ec))[_0x1ce2('0x4b')](handleError(_0x193e8e,null));};exports[_0x1ce2('0x5f')]=function(_0x1514af,_0x59a033,_0x29c5df){var _0x303187={'raw':!![],'where':{}};var _0x3cc56b={};var _0x4885bd={'count':0x0,'rows':[]};return db[_0x1ce2('0x2f')][_0x1ce2('0x5b')]({'where':{'id':_0x1514af[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x59a033,null))[_0x1ce2('0x26')](function(_0x264282){if(_0x264282){_0x3cc56b[_0x1ce2('0x33')]=_[_0x1ce2('0x35')](db[_0x1ce2('0x60')][_0x1ce2('0x49')]);_0x3cc56b[_0x1ce2('0x34')]=_[_0x1ce2('0x35')](_0x1514af[_0x1ce2('0x34')]);_0x3cc56b[_0x1ce2('0x36')]=_['intersection'](_0x3cc56b[_0x1ce2('0x33')],_0x3cc56b[_0x1ce2('0x34')]);_0x303187['attributes']=_[_0x1ce2('0x37')](_0x3cc56b[_0x1ce2('0x33')],qs['fields'](_0x1514af[_0x1ce2('0x34')]['fields']));_0x303187[_0x1ce2('0x38')]=_0x303187[_0x1ce2('0x38')][_0x1ce2('0x3a')]?_0x303187[_0x1ce2('0x38')]:_0x3cc56b[_0x1ce2('0x33')];if(!_0x1514af['query']['hasOwnProperty']('nolimit')){_0x303187[_0x1ce2('0x1f')]=qs[_0x1ce2('0x1f')](_0x1514af[_0x1ce2('0x34')]['limit']);_0x303187['offset']=qs[_0x1ce2('0x1e')](_0x1514af['query']['offset']);}_0x303187[_0x1ce2('0x3d')]=qs['sort'](_0x1514af[_0x1ce2('0x34')][_0x1ce2('0x3e')]);_0x303187[_0x1ce2('0x40')]=qs['filters'](_['pick'](_0x1514af[_0x1ce2('0x34')],_0x3cc56b['filters']));_0x303187[_0x1ce2('0x40')][_0x1ce2('0x5d')]=_0x264282['id'];if(_0x1514af[_0x1ce2('0x34')][_0x1ce2('0x3f')]){_0x303187[_0x1ce2('0x40')]=_[_0x1ce2('0x41')](_0x303187['where'],{'$or':_[_0x1ce2('0x2e')](_0x303187[_0x1ce2('0x38')],function(_0x36e80d){var _0x570f8b={};_0x570f8b[_0x36e80d]={'$like':'%'+_0x1514af[_0x1ce2('0x34')][_0x1ce2('0x3f')]+'%'};return _0x570f8b;})});}_0x303187=_[_0x1ce2('0x41')]({},_0x303187,_0x1514af[_0x1ce2('0x42')]);return db['CmHopperHistory']['count']({'where':_0x303187['where']})[_0x1ce2('0x26')](function(_0xf82acf){_0x4885bd[_0x1ce2('0x1d')]=_0xf82acf;if(_0x1514af[_0x1ce2('0x34')]['includeAll']){_0x303187['include']=[{'all':!![]}];}return db[_0x1ce2('0x60')]['findAll'](_0x303187);})[_0x1ce2('0x26')](function(_0x3c1fdb){_0x4885bd['rows']=_0x3c1fdb;return _0x4885bd;});}})[_0x1ce2('0x26')](respondWithFilteredResult(_0x59a033,_0x303187))[_0x1ce2('0x4b')](handleError(_0x59a033,null));};exports['getHopperFinals']=function(_0x204de4,_0x598474,_0x12a756){var _0x1fcc56={'raw':!![],'where':{}};var _0x106588={};var _0x1941b1={'count':0x0,'rows':[]};return db[_0x1ce2('0x2f')][_0x1ce2('0x5b')]({'where':{'id':_0x204de4[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x598474,null))['then'](function(_0x5bdaff){if(_0x5bdaff){_0x106588[_0x1ce2('0x33')]=_[_0x1ce2('0x35')](db[_0x1ce2('0x61')][_0x1ce2('0x49')]);_0x106588['query']=_['keys'](_0x204de4[_0x1ce2('0x34')]);_0x106588['filters']=_['intersection'](_0x106588['model'],_0x106588[_0x1ce2('0x34')]);_0x1fcc56[_0x1ce2('0x38')]=_[_0x1ce2('0x37')](_0x106588[_0x1ce2('0x33')],qs[_0x1ce2('0x39')](_0x204de4[_0x1ce2('0x34')][_0x1ce2('0x39')]));_0x1fcc56['attributes']=_0x1fcc56['attributes'][_0x1ce2('0x3a')]?_0x1fcc56['attributes']:_0x106588[_0x1ce2('0x33')];if(!_0x204de4['query'][_0x1ce2('0x3b')](_0x1ce2('0x3c'))){_0x1fcc56['limit']=qs[_0x1ce2('0x1f')](_0x204de4[_0x1ce2('0x34')][_0x1ce2('0x1f')]);_0x1fcc56[_0x1ce2('0x1e')]=qs[_0x1ce2('0x1e')](_0x204de4[_0x1ce2('0x34')]['offset']);}_0x1fcc56['order']=qs[_0x1ce2('0x3e')](_0x204de4['query'][_0x1ce2('0x3e')]);_0x1fcc56[_0x1ce2('0x40')]=qs['filters'](_[_0x1ce2('0x5c')](_0x204de4[_0x1ce2('0x34')],_0x106588[_0x1ce2('0x36')]));_0x1fcc56['where'][_0x1ce2('0x5d')]=_0x5bdaff['id'];if(_0x204de4[_0x1ce2('0x34')][_0x1ce2('0x3f')]){_0x1fcc56[_0x1ce2('0x40')]=_[_0x1ce2('0x41')](_0x1fcc56['where'],{'$or':_[_0x1ce2('0x2e')](_0x1fcc56[_0x1ce2('0x38')],function(_0x1d9e88){var _0xb7d63c={};_0xb7d63c[_0x1d9e88]={'$like':'%'+_0x204de4[_0x1ce2('0x34')][_0x1ce2('0x3f')]+'%'};return _0xb7d63c;})});}_0x1fcc56=_[_0x1ce2('0x41')]({},_0x1fcc56,_0x204de4[_0x1ce2('0x42')]);return db[_0x1ce2('0x61')][_0x1ce2('0x1d')]({'where':_0x1fcc56[_0x1ce2('0x40')]})[_0x1ce2('0x26')](function(_0x4d18be){_0x1941b1[_0x1ce2('0x1d')]=_0x4d18be;if(_0x204de4[_0x1ce2('0x34')][_0x1ce2('0x43')]){_0x1fcc56[_0x1ce2('0x44')]=[{'all':!![]}];}return db[_0x1ce2('0x61')]['findAll'](_0x1fcc56);})['then'](function(_0x3e82dd){_0x1941b1[_0x1ce2('0x46')]=_0x3e82dd;return _0x1941b1;});}})['then'](respondWithFilteredResult(_0x598474,_0x1fcc56))[_0x1ce2('0x4b')](handleError(_0x598474,null));};exports[_0x1ce2('0x62')]=function(_0x82886b,_0x46cbee,_0x2bb98d){var _0x216949={'raw':!![],'where':{}};var _0x14b347={};var _0xd12593={'count':0x0,'rows':[]};return db[_0x1ce2('0x2f')][_0x1ce2('0x5b')]({'where':{'id':_0x82886b['params']['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x46cbee,null))[_0x1ce2('0x26')](function(_0x2ce29e){if(_0x2ce29e){_0x14b347['model']=_[_0x1ce2('0x35')](db[_0x1ce2('0x63')][_0x1ce2('0x49')]);_0x14b347[_0x1ce2('0x34')]=_[_0x1ce2('0x35')](_0x82886b[_0x1ce2('0x34')]);_0x14b347['filters']=_[_0x1ce2('0x37')](_0x14b347['model'],_0x14b347[_0x1ce2('0x34')]);_0x216949[_0x1ce2('0x38')]=_[_0x1ce2('0x37')](_0x14b347[_0x1ce2('0x33')],qs[_0x1ce2('0x39')](_0x82886b[_0x1ce2('0x34')]['fields']));_0x216949[_0x1ce2('0x38')]=_0x216949[_0x1ce2('0x38')][_0x1ce2('0x3a')]?_0x216949[_0x1ce2('0x38')]:_0x14b347['model'];if(!_0x82886b[_0x1ce2('0x34')][_0x1ce2('0x3b')](_0x1ce2('0x3c'))){_0x216949[_0x1ce2('0x1f')]=qs[_0x1ce2('0x1f')](_0x82886b[_0x1ce2('0x34')][_0x1ce2('0x1f')]);_0x216949[_0x1ce2('0x1e')]=qs[_0x1ce2('0x1e')](_0x82886b[_0x1ce2('0x34')][_0x1ce2('0x1e')]);}_0x216949[_0x1ce2('0x3d')]=qs['sort'](_0x82886b['query'][_0x1ce2('0x3e')]);_0x216949[_0x1ce2('0x40')]=qs[_0x1ce2('0x36')](_[_0x1ce2('0x5c')](_0x82886b['query'],_0x14b347['filters']));_0x216949['where'][_0x1ce2('0x5d')]=_0x2ce29e['id'];if(_0x82886b[_0x1ce2('0x34')][_0x1ce2('0x3f')]){_0x216949[_0x1ce2('0x40')]=_[_0x1ce2('0x41')](_0x216949[_0x1ce2('0x40')],{'$or':_[_0x1ce2('0x2e')](_0x216949[_0x1ce2('0x38')],function(_0x542059){var _0x3a4905={};_0x3a4905[_0x542059]={'$like':'%'+_0x82886b[_0x1ce2('0x34')]['filter']+'%'};return _0x3a4905;})});}_0x216949=_[_0x1ce2('0x41')]({},_0x216949,_0x82886b[_0x1ce2('0x42')]);return db['CmHopperBlack'][_0x1ce2('0x1d')]({'where':_0x216949[_0x1ce2('0x40')]})[_0x1ce2('0x26')](function(_0x36addf){_0xd12593[_0x1ce2('0x1d')]=_0x36addf;if(_0x82886b[_0x1ce2('0x34')][_0x1ce2('0x43')]){_0x216949[_0x1ce2('0x44')]=[{'all':!![]}];}return db[_0x1ce2('0x63')][_0x1ce2('0x45')](_0x216949);})[_0x1ce2('0x26')](function(_0x15b81b){_0xd12593[_0x1ce2('0x46')]=_0x15b81b;return _0xd12593;});}})[_0x1ce2('0x26')](respondWithFilteredResult(_0x46cbee,_0x216949))[_0x1ce2('0x4b')](handleError(_0x46cbee,null));};exports[_0x1ce2('0x64')]=function(_0x150361,_0x96dd3c,_0x499af8){var _0x2c0cf2={};var _0x7f000b={};var _0x5ca3ec;var _0x49ea0f;return db[_0x1ce2('0x2f')][_0x1ce2('0x5b')]({'where':{'id':_0x150361[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x96dd3c,null))[_0x1ce2('0x26')](function(_0x5d9750){if(_0x5d9750){_0x5ca3ec=_0x5d9750;_0x7f000b[_0x1ce2('0x33')]=_['keys'](db[_0x1ce2('0x65')][_0x1ce2('0x49')]);_0x7f000b['query']=_[_0x1ce2('0x35')](_0x150361['query']);_0x7f000b[_0x1ce2('0x36')]=_[_0x1ce2('0x37')](_0x7f000b[_0x1ce2('0x33')],_0x7f000b[_0x1ce2('0x34')]);_0x2c0cf2[_0x1ce2('0x38')]=_['intersection'](_0x7f000b['model'],qs[_0x1ce2('0x39')](_0x150361[_0x1ce2('0x34')][_0x1ce2('0x39')]));_0x2c0cf2[_0x1ce2('0x38')]=_0x2c0cf2[_0x1ce2('0x38')]['length']?_0x2c0cf2['attributes']:_0x7f000b[_0x1ce2('0x33')];_0x2c0cf2['order']=qs[_0x1ce2('0x3e')](_0x150361[_0x1ce2('0x34')][_0x1ce2('0x3e')]);_0x2c0cf2[_0x1ce2('0x40')]=qs[_0x1ce2('0x36')](_[_0x1ce2('0x5c')](_0x150361['query'],_0x7f000b[_0x1ce2('0x36')]));if(_0x150361[_0x1ce2('0x34')]['filter']){_0x2c0cf2['where']=_[_0x1ce2('0x41')](_0x2c0cf2[_0x1ce2('0x40')],{'$or':_['map'](_0x2c0cf2[_0x1ce2('0x38')],function(_0x264a2f){var _0x4bee1d={};_0x4bee1d[_0x264a2f]={'$like':'%'+_0x150361[_0x1ce2('0x34')][_0x1ce2('0x3f')]+'%'};return _0x4bee1d;})});}_0x2c0cf2=_[_0x1ce2('0x41')]({},_0x2c0cf2,_0x150361[_0x1ce2('0x42')]);return _0x5ca3ec[_0x1ce2('0x64')](_0x2c0cf2);}})[_0x1ce2('0x26')](function(_0x144d62){if(_0x144d62){_0x49ea0f=_0x144d62[_0x1ce2('0x3a')];if(!_0x150361[_0x1ce2('0x34')]['hasOwnProperty'](_0x1ce2('0x3c'))){_0x2c0cf2[_0x1ce2('0x1f')]=qs[_0x1ce2('0x1f')](_0x150361[_0x1ce2('0x34')][_0x1ce2('0x1f')]);_0x2c0cf2[_0x1ce2('0x1e')]=qs[_0x1ce2('0x1e')](_0x150361[_0x1ce2('0x34')][_0x1ce2('0x1e')]);}return _0x5ca3ec[_0x1ce2('0x64')](_0x2c0cf2);}})[_0x1ce2('0x26')](function(_0x469b95){if(_0x469b95){return _0x469b95?{'count':_0x49ea0f,'rows':_0x469b95}:null;}})['then'](respondWithResult(_0x96dd3c,null))['catch'](handleError(_0x96dd3c,null));};exports[_0x1ce2('0x66')]=function(_0xd0b21e,_0x500053,_0x4e1f05){var _0x1c1a26,_0x3eaaba;return db[_0x1ce2('0x2f')][_0x1ce2('0x4a')]({'where':{'id':_0xd0b21e[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x500053,null))['then'](function(_0x2601d9){if(_0x2601d9){_0x3eaaba=_0x2601d9;return _0x2601d9[_0x1ce2('0x66')](_0xd0b21e[_0x1ce2('0x4d')]['ids'],_[_0x1ce2('0x53')](_0xd0b21e[_0x1ce2('0x4d')],['ids','id'])||{});}return null;})[_0x1ce2('0x67')](function(_0x56dd72){var _0x191f62;_0x1c1a26=_0x56dd72||[];var _0x551fdf=[];if(_0x56dd72){for(var _0xc6affd=0x0;_0xc6affd<_0x56dd72[_0x1ce2('0x3a')];_0xc6affd+=0x1){var _0x2ef9b5=_0x56dd72[_0xc6affd][_0x1ce2('0x28')]({'plain':!![]});_0x3eaaba['dialCheckDuplicateType']=_0xd0b21e['body'][_0x1ce2('0x68')]?_0xd0b21e['body']['dialCheckDuplicateType']:_0x3eaaba[_0x1ce2('0x68')];switch(_0x3eaaba['dialCheckDuplicateType']){case'always':_0x191f62=squel[_0x1ce2('0x69')]()[_0x1ce2('0x6a')]('cm_hopper')[_0x1ce2('0x6b')](['phone',_0x1ce2('0x6c'),_0x1ce2('0x6d'),_0x1ce2('0x6e'),'CampaignId',_0x1ce2('0x54'),_0x1ce2('0x55')],squel[_0x1ce2('0x6f')]()['field'](_0x1ce2('0x70'),_0x1ce2('0x70'))['field'](_0x1ce2('0x71'),'scheduledAt')[_0x1ce2('0x72')]('id',_0x1ce2('0x6d'))['field'](_0x2ef9b5[_0x1ce2('0x73')][_0x1ce2('0x74')](),'ListId')['field'](_0xd0b21e[_0x1ce2('0x48')]['id']['toString'](),_0x1ce2('0x5d'))['field'](_0x1ce2('0x71'),'createdAt')['field'](_0x1ce2('0x71'),_0x1ce2('0x55'))['from'](_0x1ce2('0x75'))[_0x1ce2('0x40')](_0x1ce2('0x76'))[_0x1ce2('0x40')](_0x1ce2('0x77'),_0x2ef9b5[_0x1ce2('0x73')]['toString']())[_0x1ce2('0x40')](_0x1ce2('0x78'))[_0x1ce2('0x40')](_0x1ce2('0x79'),squel[_0x1ce2('0x6f')]()[_0x1ce2('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x1ce2('0x7a')](_0x1ce2('0x7b'))[_0x1ce2('0x40')]('CampaignId\x20=\x20?',_0xd0b21e['params']['id'][_0x1ce2('0x74')]()))[_0x1ce2('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1ce2('0x6f')]()[_0x1ce2('0x72')](_0x1ce2('0x7c'))[_0x1ce2('0x7a')](_0x1ce2('0x7d'))['where'](_0x1ce2('0x7e'),_0xd0b21e[_0x1ce2('0x48')]['id']['toString']())))[_0x1ce2('0x74')]();break;case _0x1ce2('0x7f'):_0x191f62=squel[_0x1ce2('0x69')]()['into'](_0x1ce2('0x7d'))['fromQuery']([_0x1ce2('0x70'),_0x1ce2('0x6c'),_0x1ce2('0x6d'),_0x1ce2('0x6e'),_0x1ce2('0x5d'),_0x1ce2('0x54'),_0x1ce2('0x55')],squel[_0x1ce2('0x6f')]()[_0x1ce2('0x72')]('phone',_0x1ce2('0x70'))['field']('NOW()',_0x1ce2('0x6c'))[_0x1ce2('0x72')]('id',_0x1ce2('0x6d'))[_0x1ce2('0x72')](_0x2ef9b5[_0x1ce2('0x73')][_0x1ce2('0x74')](),_0x1ce2('0x6e'))[_0x1ce2('0x72')](_0xd0b21e[_0x1ce2('0x48')]['id'][_0x1ce2('0x74')](),_0x1ce2('0x5d'))[_0x1ce2('0x72')](_0x1ce2('0x71'),_0x1ce2('0x54'))[_0x1ce2('0x72')](_0x1ce2('0x71'),_0x1ce2('0x55'))[_0x1ce2('0x7a')](_0x1ce2('0x75'))['where'](_0x1ce2('0x76'))['where'](_0x1ce2('0x77'),_0x2ef9b5[_0x1ce2('0x73')][_0x1ce2('0x74')]())[_0x1ce2('0x40')](_0x1ce2('0x78'))[_0x1ce2('0x40')](_0x1ce2('0x79'),squel['select']()[_0x1ce2('0x72')]('COALESCE(phone,\x27\x27)')[_0x1ce2('0x7a')]('cm_hopper')[_0x1ce2('0x40')](_0x1ce2('0x7e'),_0xd0b21e[_0x1ce2('0x48')]['id'][_0x1ce2('0x74')]())))[_0x1ce2('0x74')]();break;default:_0x191f62=squel[_0x1ce2('0x69')]()[_0x1ce2('0x6a')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x1ce2('0x6d'),_0x1ce2('0x6e'),_0x1ce2('0x5d'),_0x1ce2('0x54'),_0x1ce2('0x55')],squel[_0x1ce2('0x6f')]()['field'](_0x1ce2('0x70'),_0x1ce2('0x70'))[_0x1ce2('0x72')](_0x1ce2('0x71'),_0x1ce2('0x6c'))[_0x1ce2('0x72')]('id',_0x1ce2('0x6d'))['field'](_0x2ef9b5[_0x1ce2('0x73')][_0x1ce2('0x74')](),_0x1ce2('0x6e'))[_0x1ce2('0x72')](_0xd0b21e['params']['id'][_0x1ce2('0x74')](),_0x1ce2('0x5d'))[_0x1ce2('0x72')]('NOW()','createdAt')[_0x1ce2('0x72')](_0x1ce2('0x71'),_0x1ce2('0x55'))['from']('cm_contacts')[_0x1ce2('0x40')](_0x1ce2('0x76'))['where'](_0x1ce2('0x77'),_0x2ef9b5[_0x1ce2('0x73')][_0x1ce2('0x74')]())[_0x1ce2('0x40')](_0x1ce2('0x78')))[_0x1ce2('0x74')]();}_0x551fdf[_0x1ce2('0x80')](db['sequelize']['query'](_0x191f62));}return BPromise['all'](_0x551fdf);}})[_0x1ce2('0x26')](function(){return _0x1c1a26;})[_0x1ce2('0x26')](respondWithResult(_0x500053,null))['catch'](handleError(_0x500053,null));};exports[_0x1ce2('0x81')]=function(_0x156227,_0x4922e8,_0x2f6ab0){return db[_0x1ce2('0x2f')][_0x1ce2('0x4a')]({'where':{'id':_0x156227[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x4922e8,null))[_0x1ce2('0x26')](function(_0x922da5){if(_0x922da5){return _0x922da5[_0x1ce2('0x81')](_0x156227[_0x1ce2('0x34')][_0x1ce2('0x82')]);}})[_0x1ce2('0x26')](function(_0x406334){if(_0x406334){return db['CmHopper'][_0x1ce2('0x27')]({'where':{'ListId':_0x156227['query'][_0x1ce2('0x82')],'CampaignId':_0x156227['params']['id']}})[_0x1ce2('0x26')](function(){return _0x406334;});}})['then'](respondWithStatusCode(_0x4922e8,null))['catch'](handleError(_0x4922e8,null));};exports[_0x1ce2('0x83')]=function(_0x50ba12,_0x4f4d38,_0x34cc89){var _0x4433c8={};var _0x2f5111={};var _0x57d57f;var _0x58f25d;return db[_0x1ce2('0x2f')][_0x1ce2('0x5b')]({'where':{'id':_0x50ba12[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x4f4d38,null))[_0x1ce2('0x26')](function(_0x2a5753){if(_0x2a5753){_0x57d57f=_0x2a5753;_0x2f5111[_0x1ce2('0x33')]=_[_0x1ce2('0x35')](db[_0x1ce2('0x65')][_0x1ce2('0x49')]);_0x2f5111[_0x1ce2('0x34')]=_[_0x1ce2('0x35')](_0x50ba12[_0x1ce2('0x34')]);_0x2f5111['filters']=_[_0x1ce2('0x37')](_0x2f5111[_0x1ce2('0x33')],_0x2f5111[_0x1ce2('0x34')]);_0x4433c8['attributes']=_[_0x1ce2('0x37')](_0x2f5111['model'],qs['fields'](_0x50ba12[_0x1ce2('0x34')][_0x1ce2('0x39')]));_0x4433c8[_0x1ce2('0x38')]=_0x4433c8[_0x1ce2('0x38')][_0x1ce2('0x3a')]?_0x4433c8[_0x1ce2('0x38')]:_0x2f5111['model'];_0x4433c8['order']=qs[_0x1ce2('0x3e')](_0x50ba12[_0x1ce2('0x34')][_0x1ce2('0x3e')]);_0x4433c8[_0x1ce2('0x40')]=qs[_0x1ce2('0x36')](_['pick'](_0x50ba12[_0x1ce2('0x34')],_0x2f5111['filters']));if(_0x50ba12[_0x1ce2('0x34')][_0x1ce2('0x3f')]){_0x4433c8['where']=_[_0x1ce2('0x41')](_0x4433c8[_0x1ce2('0x40')],{'$or':_[_0x1ce2('0x2e')](_0x4433c8[_0x1ce2('0x38')],function(_0xab7430){var _0x5dd691={};_0x5dd691[_0xab7430]={'$like':'%'+_0x50ba12['query'][_0x1ce2('0x3f')]+'%'};return _0x5dd691;})});}_0x4433c8=_[_0x1ce2('0x41')]({},_0x4433c8,_0x50ba12[_0x1ce2('0x42')]);return _0x57d57f[_0x1ce2('0x83')](_0x4433c8);}})[_0x1ce2('0x26')](function(_0x58718a){if(_0x58718a){_0x58f25d=_0x58718a[_0x1ce2('0x3a')];if(!_0x50ba12[_0x1ce2('0x34')]['hasOwnProperty']('nolimit')){_0x4433c8[_0x1ce2('0x1f')]=qs[_0x1ce2('0x1f')](_0x50ba12['query']['limit']);_0x4433c8[_0x1ce2('0x1e')]=qs[_0x1ce2('0x1e')](_0x50ba12[_0x1ce2('0x34')][_0x1ce2('0x1e')]);}return _0x57d57f[_0x1ce2('0x83')](_0x4433c8);}})['then'](function(_0x2adfa9){if(_0x2adfa9){return _0x2adfa9?{'count':_0x58f25d,'rows':_0x2adfa9}:null;}})[_0x1ce2('0x26')](respondWithResult(_0x4f4d38,null))[_0x1ce2('0x4b')](handleError(_0x4f4d38,null));};exports[_0x1ce2('0x84')]=function(_0x3e9f3a,_0x3c28f7,_0x7e429a){var _0x2c8a0e,_0x52db52;return db[_0x1ce2('0x2f')][_0x1ce2('0x4a')]({'where':{'id':_0x3e9f3a[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x3c28f7,null))[_0x1ce2('0x26')](function(_0x2c71f9){if(_0x2c71f9){_0x52db52=_0x2c71f9;return _0x2c71f9[_0x1ce2('0x84')](_0x3e9f3a[_0x1ce2('0x4d')]['ids'],_[_0x1ce2('0x53')](_0x3e9f3a[_0x1ce2('0x4d')],[_0x1ce2('0x82'),'id'])||{});}return null;})[_0x1ce2('0x67')](function(_0xc00360){var _0x36688c;_0x2c8a0e=_0xc00360||[];var _0xd69699=[];if(_0xc00360){for(var _0x9e3469=0x0;_0x9e3469<_0xc00360[_0x1ce2('0x3a')];_0x9e3469+=0x1){var _0x5e735e=_0xc00360[_0x9e3469][_0x1ce2('0x28')]({'plain':!![]});_0x36688c=squel[_0x1ce2('0x69')]()['into']('cm_hopper_black')[_0x1ce2('0x6b')]([_0x1ce2('0x70'),_0x1ce2('0x6d'),_0x1ce2('0x6e'),'CampaignId',_0x1ce2('0x54'),_0x1ce2('0x55')],squel['select']()[_0x1ce2('0x72')](_0x1ce2('0x70'),_0x1ce2('0x70'))[_0x1ce2('0x72')]('id','ContactId')[_0x1ce2('0x72')](_0x5e735e[_0x1ce2('0x73')]['toString'](),_0x1ce2('0x6e'))[_0x1ce2('0x72')](_0x3e9f3a[_0x1ce2('0x48')]['id'][_0x1ce2('0x74')](),'CampaignId')[_0x1ce2('0x72')](_0x1ce2('0x71'),_0x1ce2('0x54'))['field'](_0x1ce2('0x71'),_0x1ce2('0x55'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x1ce2('0x40')](_0x1ce2('0x77'),_0x5e735e[_0x1ce2('0x73')]['toString']())['where'](_0x1ce2('0x78')))['toString']();_0xd69699[_0x1ce2('0x80')](db[_0x1ce2('0x85')]['query'](_0x36688c));}return BPromise[_0x1ce2('0x86')](_0xd69699);}})[_0x1ce2('0x26')](function(){return _0x2c8a0e;})[_0x1ce2('0x26')](respondWithResult(_0x3c28f7,null))['catch'](handleError(_0x3c28f7,null));};exports[_0x1ce2('0x87')]=function(_0x46c727,_0x4d3625,_0x869a0c){return db[_0x1ce2('0x2f')][_0x1ce2('0x4a')]({'where':{'id':_0x46c727['params']['id']}})[_0x1ce2('0x26')](handleEntityNotFound(_0x4d3625,null))[_0x1ce2('0x26')](function(_0xda2c5b){if(_0xda2c5b){return _0xda2c5b[_0x1ce2('0x87')](_0x46c727[_0x1ce2('0x34')][_0x1ce2('0x82')]);}})[_0x1ce2('0x26')](function(_0x20ed7e){if(_0x20ed7e){return db[_0x1ce2('0x63')][_0x1ce2('0x27')]({'where':{'ListId':_0x46c727['query']['ids'],'CampaignId':_0x46c727[_0x1ce2('0x48')]['id']}})[_0x1ce2('0x26')](function(){return _0x20ed7e;});}})['then'](respondWithStatusCode(_0x4d3625,null))[_0x1ce2('0x4b')](handleError(_0x4d3625,null));}; \ No newline at end of file +var _0xa2a6=['findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','end','count','offset','limit','status','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','type','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','getHoppers'];(function(_0x413405,_0x1af2f5){var _0x531746=function(_0x310cb8){while(--_0x310cb8){_0x413405['push'](_0x413405['shift']());}};_0x531746(++_0x1af2f5);}(_0xa2a6,0x1b2));var _0x6a2a=function(_0x3885b8,_0x56d044){_0x3885b8=_0x3885b8-0x0;var _0x580c26=_0xa2a6[_0x3885b8];return _0x580c26;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a2a('0x0'));var rimraf=require(_0x6a2a('0x1'));var zipdir=require(_0x6a2a('0x2'));var jsonpatch=require(_0x6a2a('0x3'));var rp=require(_0x6a2a('0x4'));var moment=require(_0x6a2a('0x5'));var BPromise=require(_0x6a2a('0x6'));var Mustache=require(_0x6a2a('0x7'));var util=require(_0x6a2a('0x8'));var path=require('path');var sox=require(_0x6a2a('0x9'));var csv=require(_0x6a2a('0xa'));var ejs=require(_0x6a2a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a2a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6a2a('0xd'));var toCsv=require(_0x6a2a('0xa'));var querystring=require('querystring');var Papa=require(_0x6a2a('0xe'));var Redis=require('ioredis');var authService=require(_0x6a2a('0xf'));var qs=require(_0x6a2a('0x10'));var as=require(_0x6a2a('0x11'));var hardwareService=require(_0x6a2a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6a2a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39d7e9,_0x18171e){_0x18171e=_0x18171e||0xcc;return function(_0x2fbd1a){if(_0x2fbd1a){return _0x39d7e9[_0x6a2a('0x14')](_0x18171e);}return _0x39d7e9['status'](_0x18171e)[_0x6a2a('0x15')]();};}function respondWithResult(_0x27a546,_0x35d107){_0x35d107=_0x35d107||0xc8;return function(_0x4a94a3){if(_0x4a94a3){return _0x27a546['status'](_0x35d107)['json'](_0x4a94a3);}};}function respondWithFilteredResult(_0x5f405c,_0x5d1aca){return function(_0x1d3106){if(_0x1d3106){var _0x1e2e06=_0x1d3106[_0x6a2a('0x16')],_0x3a7a0f=_0x5d1aca[_0x6a2a('0x17')],_0x1b4edd=_0x5d1aca[_0x6a2a('0x17')]+_0x5d1aca[_0x6a2a('0x18')],_0x337cc5;if(_0x1b4edd>=_0x1e2e06){_0x1b4edd=_0x1e2e06;_0x337cc5=0xc8;}else{_0x337cc5=0xce;}_0x5f405c[_0x6a2a('0x19')](_0x337cc5);return _0x5f405c['set'](_0x6a2a('0x1a'),_0x3a7a0f+'-'+_0x1b4edd+'/'+_0x1e2e06)['json'](_0x1d3106);}return null;};}function patchUpdates(_0x72dc5){return function(_0x595a9d){try{jsonpatch['apply'](_0x595a9d,_0x72dc5,!![]);}catch(_0x2dff1a){return BPromise['reject'](_0x2dff1a);}return _0x595a9d[_0x6a2a('0x1b')]();};}function saveUpdates(_0x1b3d52,_0xe48b7d){return function(_0x883e5b){if(_0x883e5b){return _0x883e5b[_0x6a2a('0x1c')](_0x1b3d52)[_0x6a2a('0x1d')](function(_0x4743aa){return _0x4743aa;});}return null;};}function removeEntity(_0x5ddd04,_0x2fa1cf){return function(_0x558f1a){if(_0x558f1a){return _0x558f1a[_0x6a2a('0x1e')]()[_0x6a2a('0x1d')](function(){var _0x30ad83=_0x558f1a[_0x6a2a('0x1f')]({'plain':!![]});var _0x32ddb4='IvrCampaigns';return db[_0x6a2a('0x20')][_0x6a2a('0x1e')]({'where':{'type':_0x32ddb4,'resourceId':_0x30ad83['id']}})[_0x6a2a('0x1d')](function(){return _0x558f1a;});})['then'](function(){_0x5ddd04[_0x6a2a('0x19')](0xcc)[_0x6a2a('0x15')]();});}};}function handleEntityNotFound(_0x825075,_0x353be8){return function(_0x25ea63){if(!_0x25ea63){_0x825075[_0x6a2a('0x14')](0x194);}return _0x25ea63;};}function handleError(_0x1176c3,_0x38126){_0x38126=_0x38126||0x1f4;return function(_0x2b12eb){logger[_0x6a2a('0x21')](_0x2b12eb[_0x6a2a('0x22')]);if(_0x2b12eb[_0x6a2a('0x23')]){delete _0x2b12eb[_0x6a2a('0x23')];}_0x1176c3['status'](_0x38126)[_0x6a2a('0x24')](_0x2b12eb);};}exports['index']=function(_0x5b6b43,_0x26239f){var _0x480e72={},_0x368565={},_0x2bdb0c={'count':0x0,'rows':[]};var _0x365544=_[_0x6a2a('0x25')](db[_0x6a2a('0x26')][_0x6a2a('0x27')],function(_0x36bc65){return{'name':_0x36bc65['fieldName'],'type':_0x36bc65[_0x6a2a('0x28')][_0x6a2a('0x29')]};});_0x368565['model']=_[_0x6a2a('0x25')](_0x365544,_0x6a2a('0x23'));_0x368565['query']=_[_0x6a2a('0x2a')](_0x5b6b43['query']);_0x368565[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0x368565[_0x6a2a('0x2d')],_0x368565[_0x6a2a('0x2e')]);_0x480e72['attributes']=_[_0x6a2a('0x2c')](_0x368565[_0x6a2a('0x2d')],qs['fields'](_0x5b6b43[_0x6a2a('0x2e')][_0x6a2a('0x2f')]));_0x480e72[_0x6a2a('0x30')]=_0x480e72[_0x6a2a('0x30')][_0x6a2a('0x31')]?_0x480e72['attributes']:_0x368565[_0x6a2a('0x2d')];if(!_0x5b6b43[_0x6a2a('0x2e')][_0x6a2a('0x32')](_0x6a2a('0x33'))){_0x480e72['limit']=qs[_0x6a2a('0x18')](_0x5b6b43[_0x6a2a('0x2e')][_0x6a2a('0x18')]);_0x480e72[_0x6a2a('0x17')]=qs[_0x6a2a('0x17')](_0x5b6b43['query'][_0x6a2a('0x17')]);}_0x480e72[_0x6a2a('0x34')]=qs[_0x6a2a('0x35')](_0x5b6b43[_0x6a2a('0x2e')][_0x6a2a('0x35')]);_0x480e72['where']=qs[_0x6a2a('0x2b')](_[_0x6a2a('0x36')](_0x5b6b43[_0x6a2a('0x2e')],_0x368565['filters']),_0x365544);if(_0x5b6b43[_0x6a2a('0x2e')][_0x6a2a('0x37')]){_0x480e72[_0x6a2a('0x38')]=_[_0x6a2a('0x39')](_0x480e72[_0x6a2a('0x38')],{'$or':_[_0x6a2a('0x25')](_0x365544,function(_0x5a855f){if(_0x5a855f[_0x6a2a('0x28')]!==_0x6a2a('0x3a')){var _0x5cf3be={};_0x5cf3be[_0x5a855f[_0x6a2a('0x23')]]={'$like':'%'+_0x5b6b43['query'][_0x6a2a('0x37')]+'%'};return _0x5cf3be;}})});}_0x480e72=_[_0x6a2a('0x39')]({},_0x480e72,_0x5b6b43[_0x6a2a('0x3b')]);var _0x515432={'where':_0x480e72[_0x6a2a('0x38')]};return db['Campaign'][_0x6a2a('0x16')](_0x515432)[_0x6a2a('0x1d')](function(_0x787381){_0x2bdb0c[_0x6a2a('0x16')]=_0x787381;if(_0x5b6b43[_0x6a2a('0x2e')][_0x6a2a('0x3c')]){_0x480e72['include']=[{'all':!![]}];}return db[_0x6a2a('0x26')][_0x6a2a('0x3d')](_0x480e72);})['then'](function(_0x4ae44f){_0x2bdb0c['rows']=_0x4ae44f;return _0x2bdb0c;})['then'](respondWithFilteredResult(_0x26239f,_0x480e72))[_0x6a2a('0x3e')](handleError(_0x26239f,null));};exports[_0x6a2a('0x3f')]=function(_0x5dccda,_0x1144a9){var _0x3b0996={'raw':![],'where':{'id':_0x5dccda[_0x6a2a('0x40')]['id']}},_0xf47fac={};_0xf47fac[_0x6a2a('0x2d')]=_[_0x6a2a('0x2a')](db[_0x6a2a('0x26')][_0x6a2a('0x27')]);_0xf47fac['query']=_['keys'](_0x5dccda[_0x6a2a('0x2e')]);_0xf47fac[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0xf47fac[_0x6a2a('0x2d')],_0xf47fac[_0x6a2a('0x2e')]);_0x3b0996[_0x6a2a('0x30')]=_[_0x6a2a('0x2c')](_0xf47fac[_0x6a2a('0x2d')],qs['fields'](_0x5dccda['query'][_0x6a2a('0x2f')]));_0x3b0996['attributes']=_0x3b0996['attributes']['length']?_0x3b0996[_0x6a2a('0x30')]:_0xf47fac[_0x6a2a('0x2d')];if(_0x5dccda[_0x6a2a('0x2e')][_0x6a2a('0x3c')]){_0x3b0996[_0x6a2a('0x41')]=[{'all':!![]}];}_0x3b0996=_[_0x6a2a('0x39')]({},_0x3b0996,_0x5dccda[_0x6a2a('0x3b')]);return db['Campaign'][_0x6a2a('0x42')](_0x3b0996)[_0x6a2a('0x1d')](handleEntityNotFound(_0x1144a9,null))[_0x6a2a('0x1d')](respondWithResult(_0x1144a9,null))['catch'](handleError(_0x1144a9,null));};exports['create']=function(_0x8eb703,_0x59cf0e){return db['Campaign'][_0x6a2a('0x43')](_0x8eb703[_0x6a2a('0x44')],{})['then'](function(_0x36bb9a){var _0x237353=_0x8eb703[_0x6a2a('0x45')][_0x6a2a('0x1f')]({'plain':!![]});if(!_0x237353)throw new Error(_0x6a2a('0x46'));if(_0x237353[_0x6a2a('0x47')]===_0x6a2a('0x45')){var _0x420c4d=_0x36bb9a[_0x6a2a('0x1f')]({'plain':!![]});var _0x14651a=_0x6a2a('0x48');return db[_0x6a2a('0x49')]['find']({'where':{'name':_0x14651a,'userProfileId':_0x237353[_0x6a2a('0x4a')]},'raw':!![]})['then'](function(_0x2f9f64){if(_0x2f9f64&&_0x2f9f64['autoAssociation']===0x0){return db['UserProfileResource'][_0x6a2a('0x43')]({'name':_0x420c4d[_0x6a2a('0x23')],'resourceId':_0x420c4d['id'],'type':_0x2f9f64[_0x6a2a('0x23')],'sectionId':_0x2f9f64['id']},{})[_0x6a2a('0x1d')](function(){return _0x36bb9a;});}else{return _0x36bb9a;}})['catch'](function(_0x214b16){logger[_0x6a2a('0x21')](_0x6a2a('0x4b'),_0x214b16);throw _0x214b16;});}return _0x36bb9a;})[_0x6a2a('0x1d')](respondWithResult(_0x59cf0e,0xc9))[_0x6a2a('0x3e')](handleError(_0x59cf0e,null));};exports[_0x6a2a('0x4c')]=function(_0x55f856,_0x41b266){var _0x2576ed={'where':{'id':_0x55f856[_0x6a2a('0x40')]['id']}},_0x5b87d5={};_0x5b87d5['model']=_[_0x6a2a('0x2a')](db[_0x6a2a('0x26')][_0x6a2a('0x27')]);_0x2576ed[_0x6a2a('0x30')]=_['intersection'](_0x5b87d5[_0x6a2a('0x2d')],qs['fields'](_0x55f856[_0x6a2a('0x2e')]['fields']));_0x2576ed[_0x6a2a('0x30')]=_0x2576ed[_0x6a2a('0x30')]['length']?_0x2576ed[_0x6a2a('0x30')]:_0x5b87d5[_0x6a2a('0x2d')];if(_0x55f856['query']['includeAll']){_0x2576ed[_0x6a2a('0x41')]=[{'all':!![]}];}_0x2576ed=_[_0x6a2a('0x39')]({},_0x2576ed,_0x55f856[_0x6a2a('0x3b')]);return db[_0x6a2a('0x26')][_0x6a2a('0x42')](_0x2576ed)[_0x6a2a('0x1d')](handleEntityNotFound(_0x41b266,null))['then'](function(_0x472fc7){if(_0x472fc7){var _0x74019b=_0x472fc7[_0x6a2a('0x1f')]({'plain':!![]});_0x74019b=qs[_0x6a2a('0x4d')](_0x74019b,['id','createdAt',_0x6a2a('0x4e')]);_0x55f856[_0x6a2a('0x44')]=_[_0x6a2a('0x4d')](_0x55f856['body'],['id',_0x6a2a('0x4f'),_0x6a2a('0x4e')]);return db['Campaign'][_0x6a2a('0x43')](_['merge'](_0x74019b,_0x55f856[_0x6a2a('0x44')]),{'include':_0x55f856['query'][_0x6a2a('0x3c')]?[{'all':!![]}]:undefined})[_0x6a2a('0x1d')](function(_0xf78d20){var _0x5315c8=_0x55f856['user'][_0x6a2a('0x1f')]({'plain':!![]});if(!_0x5315c8)throw new Error(_0x6a2a('0x46'));if(_0x5315c8[_0x6a2a('0x47')]===_0x6a2a('0x45')){var _0x3a60a5=_0xf78d20[_0x6a2a('0x1f')]({'plain':!![]});var _0x482d6d=_0x6a2a('0x48');return db[_0x6a2a('0x49')][_0x6a2a('0x42')]({'where':{'name':_0x482d6d,'userProfileId':_0x5315c8[_0x6a2a('0x4a')]},'raw':!![]})[_0x6a2a('0x1d')](function(_0x428d01){if(_0x428d01&&_0x428d01[_0x6a2a('0x50')]===0x0){return db['UserProfileResource'][_0x6a2a('0x43')]({'name':_0x3a60a5[_0x6a2a('0x23')],'resourceId':_0x3a60a5['id'],'type':_0x428d01['name'],'sectionId':_0x428d01['id']},{})[_0x6a2a('0x1d')](function(){return _0xf78d20;});}else{return _0xf78d20;}})['catch'](function(_0x292a40){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x292a40);throw _0x292a40;});}return _0xf78d20;});}})[_0x6a2a('0x1d')](respondWithResult(_0x41b266,0xc9))[_0x6a2a('0x3e')](handleError(_0x41b266,null));};exports[_0x6a2a('0x1c')]=function(_0x1cfc26,_0x575e56){if(_0x1cfc26[_0x6a2a('0x44')]['id']){delete _0x1cfc26[_0x6a2a('0x44')]['id'];}return db['Campaign'][_0x6a2a('0x42')]({'where':{'id':_0x1cfc26[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x575e56,null))[_0x6a2a('0x1d')](saveUpdates(_0x1cfc26[_0x6a2a('0x44')],null))[_0x6a2a('0x1d')](respondWithResult(_0x575e56,null))['catch'](handleError(_0x575e56,null));};exports['destroy']=function(_0x3732d2,_0x2e1d94){return db['Campaign']['find']({'where':{'id':_0x3732d2['params']['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x2e1d94,null))['then'](removeEntity(_0x2e1d94,null))[_0x6a2a('0x3e')](handleError(_0x2e1d94,null));};exports[_0x6a2a('0x51')]=function(_0x44b9cb,_0x586653,_0x26ed58){var _0x1c4401={'raw':!![],'where':{}};var _0x813083={};var _0x491873={'count':0x0,'rows':[]};return db[_0x6a2a('0x26')][_0x6a2a('0x52')]({'where':{'id':_0x44b9cb[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x586653,null))[_0x6a2a('0x1d')](function(_0x473218){if(_0x473218){_0x813083[_0x6a2a('0x2d')]=_[_0x6a2a('0x2a')](db[_0x6a2a('0x53')][_0x6a2a('0x27')]);_0x813083[_0x6a2a('0x2e')]=_['keys'](_0x44b9cb[_0x6a2a('0x2e')]);_0x813083[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0x813083[_0x6a2a('0x2d')],_0x813083[_0x6a2a('0x2e')]);_0x1c4401[_0x6a2a('0x30')]=_[_0x6a2a('0x2c')](_0x813083[_0x6a2a('0x2d')],qs[_0x6a2a('0x2f')](_0x44b9cb[_0x6a2a('0x2e')][_0x6a2a('0x2f')]));_0x1c4401[_0x6a2a('0x30')]=_0x1c4401[_0x6a2a('0x30')][_0x6a2a('0x31')]?_0x1c4401['attributes']:_0x813083[_0x6a2a('0x2d')];if(!_0x44b9cb[_0x6a2a('0x2e')]['hasOwnProperty'](_0x6a2a('0x33'))){_0x1c4401['limit']=qs['limit'](_0x44b9cb[_0x6a2a('0x2e')]['limit']);_0x1c4401[_0x6a2a('0x17')]=qs[_0x6a2a('0x17')](_0x44b9cb[_0x6a2a('0x2e')][_0x6a2a('0x17')]);}_0x1c4401[_0x6a2a('0x34')]=qs[_0x6a2a('0x35')](_0x44b9cb[_0x6a2a('0x2e')][_0x6a2a('0x35')]);_0x1c4401[_0x6a2a('0x38')]=qs[_0x6a2a('0x2b')](_[_0x6a2a('0x36')](_0x44b9cb[_0x6a2a('0x2e')],_0x813083['filters']));_0x1c4401[_0x6a2a('0x38')][_0x6a2a('0x54')]=_0x473218['id'];if(_0x44b9cb['query'][_0x6a2a('0x37')]){_0x1c4401[_0x6a2a('0x38')]=_['merge'](_0x1c4401['where'],{'$or':_[_0x6a2a('0x25')](_0x1c4401[_0x6a2a('0x30')],function(_0x285e37){var _0x13d25f={};_0x13d25f[_0x285e37]={'$like':'%'+_0x44b9cb['query'][_0x6a2a('0x37')]+'%'};return _0x13d25f;})});}_0x1c4401=_['merge']({},_0x1c4401,_0x44b9cb[_0x6a2a('0x3b')]);return db[_0x6a2a('0x53')][_0x6a2a('0x16')]({'where':_0x1c4401[_0x6a2a('0x38')]})[_0x6a2a('0x1d')](function(_0x25facb){_0x491873['count']=_0x25facb;if(_0x44b9cb['query'][_0x6a2a('0x3c')]){_0x1c4401['include']=[{'all':!![]}];}return db[_0x6a2a('0x53')][_0x6a2a('0x3d')](_0x1c4401);})[_0x6a2a('0x1d')](function(_0x41bfd8){_0x491873['rows']=_0x41bfd8;return _0x491873;});}})['then'](respondWithFilteredResult(_0x586653,_0x1c4401))['catch'](handleError(_0x586653,null));};exports[_0x6a2a('0x55')]=function(_0x61f08b,_0x2881e0,_0x4b95ee){var _0x3c431c={'raw':!![],'where':{}};var _0x59a2f3={};var _0x2908fb={'count':0x0,'rows':[]};return db[_0x6a2a('0x26')]['findOne']({'where':{'id':_0x61f08b[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x2881e0,null))[_0x6a2a('0x1d')](function(_0x78db32){if(_0x78db32){_0x59a2f3['model']=_[_0x6a2a('0x2a')](db[_0x6a2a('0x56')]['rawAttributes']);_0x59a2f3[_0x6a2a('0x2e')]=_[_0x6a2a('0x2a')](_0x61f08b['query']);_0x59a2f3[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0x59a2f3[_0x6a2a('0x2d')],_0x59a2f3[_0x6a2a('0x2e')]);_0x3c431c['attributes']=_[_0x6a2a('0x2c')](_0x59a2f3[_0x6a2a('0x2d')],qs[_0x6a2a('0x2f')](_0x61f08b[_0x6a2a('0x2e')][_0x6a2a('0x2f')]));_0x3c431c[_0x6a2a('0x30')]=_0x3c431c[_0x6a2a('0x30')][_0x6a2a('0x31')]?_0x3c431c[_0x6a2a('0x30')]:_0x59a2f3[_0x6a2a('0x2d')];if(!_0x61f08b[_0x6a2a('0x2e')]['hasOwnProperty'](_0x6a2a('0x33'))){_0x3c431c[_0x6a2a('0x18')]=qs[_0x6a2a('0x18')](_0x61f08b[_0x6a2a('0x2e')][_0x6a2a('0x18')]);_0x3c431c[_0x6a2a('0x17')]=qs[_0x6a2a('0x17')](_0x61f08b[_0x6a2a('0x2e')]['offset']);}_0x3c431c[_0x6a2a('0x34')]=qs[_0x6a2a('0x35')](_0x61f08b['query'][_0x6a2a('0x35')]);_0x3c431c[_0x6a2a('0x38')]=qs[_0x6a2a('0x2b')](_[_0x6a2a('0x36')](_0x61f08b[_0x6a2a('0x2e')],_0x59a2f3[_0x6a2a('0x2b')]));_0x3c431c['where'][_0x6a2a('0x54')]=_0x78db32['id'];if(_0x61f08b[_0x6a2a('0x2e')][_0x6a2a('0x37')]){_0x3c431c[_0x6a2a('0x38')]=_[_0x6a2a('0x39')](_0x3c431c[_0x6a2a('0x38')],{'$or':_[_0x6a2a('0x25')](_0x3c431c[_0x6a2a('0x30')],function(_0x388c53){var _0x238698={};_0x238698[_0x388c53]={'$like':'%'+_0x61f08b['query'][_0x6a2a('0x37')]+'%'};return _0x238698;})});}_0x3c431c=_[_0x6a2a('0x39')]({},_0x3c431c,_0x61f08b['options']);return db[_0x6a2a('0x56')][_0x6a2a('0x16')]({'where':_0x3c431c[_0x6a2a('0x38')]})[_0x6a2a('0x1d')](function(_0x437360){_0x2908fb[_0x6a2a('0x16')]=_0x437360;if(_0x61f08b['query']['includeAll']){_0x3c431c[_0x6a2a('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6a2a('0x3d')](_0x3c431c);})[_0x6a2a('0x1d')](function(_0x208d42){_0x2908fb[_0x6a2a('0x57')]=_0x208d42;return _0x2908fb;});}})[_0x6a2a('0x1d')](respondWithFilteredResult(_0x2881e0,_0x3c431c))[_0x6a2a('0x3e')](handleError(_0x2881e0,null));};exports[_0x6a2a('0x58')]=function(_0x23def5,_0x4c950e,_0x5f4364){var _0x2aeb70={'raw':!![],'where':{}};var _0x4d638f={};var _0x1f9ce8={'count':0x0,'rows':[]};return db[_0x6a2a('0x26')][_0x6a2a('0x52')]({'where':{'id':_0x23def5[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x4c950e,null))[_0x6a2a('0x1d')](function(_0x2987f6){if(_0x2987f6){_0x4d638f['model']=_[_0x6a2a('0x2a')](db['CmHopperFinal'][_0x6a2a('0x27')]);_0x4d638f[_0x6a2a('0x2e')]=_[_0x6a2a('0x2a')](_0x23def5['query']);_0x4d638f[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0x4d638f['model'],_0x4d638f[_0x6a2a('0x2e')]);_0x2aeb70[_0x6a2a('0x30')]=_['intersection'](_0x4d638f[_0x6a2a('0x2d')],qs['fields'](_0x23def5['query']['fields']));_0x2aeb70[_0x6a2a('0x30')]=_0x2aeb70['attributes'][_0x6a2a('0x31')]?_0x2aeb70[_0x6a2a('0x30')]:_0x4d638f[_0x6a2a('0x2d')];if(!_0x23def5[_0x6a2a('0x2e')][_0x6a2a('0x32')](_0x6a2a('0x33'))){_0x2aeb70[_0x6a2a('0x18')]=qs[_0x6a2a('0x18')](_0x23def5['query'][_0x6a2a('0x18')]);_0x2aeb70[_0x6a2a('0x17')]=qs[_0x6a2a('0x17')](_0x23def5['query'][_0x6a2a('0x17')]);}_0x2aeb70['order']=qs[_0x6a2a('0x35')](_0x23def5[_0x6a2a('0x2e')]['sort']);_0x2aeb70['where']=qs[_0x6a2a('0x2b')](_['pick'](_0x23def5['query'],_0x4d638f['filters']));_0x2aeb70[_0x6a2a('0x38')][_0x6a2a('0x54')]=_0x2987f6['id'];if(_0x23def5[_0x6a2a('0x2e')][_0x6a2a('0x37')]){_0x2aeb70[_0x6a2a('0x38')]=_['merge'](_0x2aeb70[_0x6a2a('0x38')],{'$or':_[_0x6a2a('0x25')](_0x2aeb70[_0x6a2a('0x30')],function(_0xa7f3ab){var _0x5e72e8={};_0x5e72e8[_0xa7f3ab]={'$like':'%'+_0x23def5[_0x6a2a('0x2e')][_0x6a2a('0x37')]+'%'};return _0x5e72e8;})});}_0x2aeb70=_['merge']({},_0x2aeb70,_0x23def5[_0x6a2a('0x3b')]);return db[_0x6a2a('0x59')][_0x6a2a('0x16')]({'where':_0x2aeb70[_0x6a2a('0x38')]})['then'](function(_0x192352){_0x1f9ce8[_0x6a2a('0x16')]=_0x192352;if(_0x23def5['query'][_0x6a2a('0x3c')]){_0x2aeb70[_0x6a2a('0x41')]=[{'all':!![]}];}return db[_0x6a2a('0x59')][_0x6a2a('0x3d')](_0x2aeb70);})['then'](function(_0x4fd19d){_0x1f9ce8[_0x6a2a('0x57')]=_0x4fd19d;return _0x1f9ce8;});}})['then'](respondWithFilteredResult(_0x4c950e,_0x2aeb70))['catch'](handleError(_0x4c950e,null));};exports[_0x6a2a('0x5a')]=function(_0x5dd56c,_0x47093e,_0x55b4b8){var _0x4c2e58={'raw':!![],'where':{}};var _0x3f40b0={};var _0xef07c3={'count':0x0,'rows':[]};return db[_0x6a2a('0x26')][_0x6a2a('0x52')]({'where':{'id':_0x5dd56c[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x47093e,null))[_0x6a2a('0x1d')](function(_0x310c16){if(_0x310c16){_0x3f40b0[_0x6a2a('0x2d')]=_[_0x6a2a('0x2a')](db[_0x6a2a('0x5b')]['rawAttributes']);_0x3f40b0[_0x6a2a('0x2e')]=_[_0x6a2a('0x2a')](_0x5dd56c[_0x6a2a('0x2e')]);_0x3f40b0[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0x3f40b0[_0x6a2a('0x2d')],_0x3f40b0[_0x6a2a('0x2e')]);_0x4c2e58['attributes']=_[_0x6a2a('0x2c')](_0x3f40b0[_0x6a2a('0x2d')],qs[_0x6a2a('0x2f')](_0x5dd56c[_0x6a2a('0x2e')][_0x6a2a('0x2f')]));_0x4c2e58['attributes']=_0x4c2e58[_0x6a2a('0x30')][_0x6a2a('0x31')]?_0x4c2e58[_0x6a2a('0x30')]:_0x3f40b0[_0x6a2a('0x2d')];if(!_0x5dd56c[_0x6a2a('0x2e')][_0x6a2a('0x32')](_0x6a2a('0x33'))){_0x4c2e58[_0x6a2a('0x18')]=qs[_0x6a2a('0x18')](_0x5dd56c['query']['limit']);_0x4c2e58['offset']=qs[_0x6a2a('0x17')](_0x5dd56c[_0x6a2a('0x2e')]['offset']);}_0x4c2e58['order']=qs[_0x6a2a('0x35')](_0x5dd56c[_0x6a2a('0x2e')][_0x6a2a('0x35')]);_0x4c2e58[_0x6a2a('0x38')]=qs[_0x6a2a('0x2b')](_[_0x6a2a('0x36')](_0x5dd56c['query'],_0x3f40b0[_0x6a2a('0x2b')]));_0x4c2e58[_0x6a2a('0x38')][_0x6a2a('0x54')]=_0x310c16['id'];if(_0x5dd56c[_0x6a2a('0x2e')]['filter']){_0x4c2e58[_0x6a2a('0x38')]=_[_0x6a2a('0x39')](_0x4c2e58[_0x6a2a('0x38')],{'$or':_['map'](_0x4c2e58[_0x6a2a('0x30')],function(_0x524c93){var _0x36665f={};_0x36665f[_0x524c93]={'$like':'%'+_0x5dd56c['query']['filter']+'%'};return _0x36665f;})});}_0x4c2e58=_[_0x6a2a('0x39')]({},_0x4c2e58,_0x5dd56c['options']);return db[_0x6a2a('0x5b')][_0x6a2a('0x16')]({'where':_0x4c2e58['where']})['then'](function(_0x933409){_0xef07c3[_0x6a2a('0x16')]=_0x933409;if(_0x5dd56c[_0x6a2a('0x2e')][_0x6a2a('0x3c')]){_0x4c2e58[_0x6a2a('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6a2a('0x3d')](_0x4c2e58);})['then'](function(_0x14b1b6){_0xef07c3[_0x6a2a('0x57')]=_0x14b1b6;return _0xef07c3;});}})[_0x6a2a('0x1d')](respondWithFilteredResult(_0x47093e,_0x4c2e58))['catch'](handleError(_0x47093e,null));};exports[_0x6a2a('0x5c')]=function(_0x15f60f,_0x172db7,_0xe7d983){var _0x20f18e={};var _0x381156={};var _0x1c9433;var _0x51047e;return db[_0x6a2a('0x26')][_0x6a2a('0x52')]({'where':{'id':_0x15f60f['params']['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x172db7,null))['then'](function(_0x1054cd){if(_0x1054cd){_0x1c9433=_0x1054cd;_0x381156['model']=_['keys'](db[_0x6a2a('0x5d')][_0x6a2a('0x27')]);_0x381156[_0x6a2a('0x2e')]=_['keys'](_0x15f60f[_0x6a2a('0x2e')]);_0x381156[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0x381156[_0x6a2a('0x2d')],_0x381156[_0x6a2a('0x2e')]);_0x20f18e['attributes']=_[_0x6a2a('0x2c')](_0x381156[_0x6a2a('0x2d')],qs[_0x6a2a('0x2f')](_0x15f60f[_0x6a2a('0x2e')]['fields']));_0x20f18e[_0x6a2a('0x30')]=_0x20f18e['attributes']['length']?_0x20f18e[_0x6a2a('0x30')]:_0x381156['model'];_0x20f18e[_0x6a2a('0x34')]=qs[_0x6a2a('0x35')](_0x15f60f[_0x6a2a('0x2e')]['sort']);_0x20f18e[_0x6a2a('0x38')]=qs['filters'](_[_0x6a2a('0x36')](_0x15f60f[_0x6a2a('0x2e')],_0x381156['filters']));if(_0x15f60f['query'][_0x6a2a('0x37')]){_0x20f18e[_0x6a2a('0x38')]=_[_0x6a2a('0x39')](_0x20f18e[_0x6a2a('0x38')],{'$or':_[_0x6a2a('0x25')](_0x20f18e[_0x6a2a('0x30')],function(_0x2a8439){var _0x1c5d01={};_0x1c5d01[_0x2a8439]={'$like':'%'+_0x15f60f[_0x6a2a('0x2e')][_0x6a2a('0x37')]+'%'};return _0x1c5d01;})});}_0x20f18e=_[_0x6a2a('0x39')]({},_0x20f18e,_0x15f60f[_0x6a2a('0x3b')]);return _0x1c9433[_0x6a2a('0x5c')](_0x20f18e);}})[_0x6a2a('0x1d')](function(_0x49673e){if(_0x49673e){_0x51047e=_0x49673e[_0x6a2a('0x31')];if(!_0x15f60f[_0x6a2a('0x2e')][_0x6a2a('0x32')](_0x6a2a('0x33'))){_0x20f18e[_0x6a2a('0x18')]=qs[_0x6a2a('0x18')](_0x15f60f[_0x6a2a('0x2e')][_0x6a2a('0x18')]);_0x20f18e['offset']=qs[_0x6a2a('0x17')](_0x15f60f[_0x6a2a('0x2e')][_0x6a2a('0x17')]);}return _0x1c9433[_0x6a2a('0x5c')](_0x20f18e);}})[_0x6a2a('0x1d')](function(_0x1e3a9d){if(_0x1e3a9d){return _0x1e3a9d?{'count':_0x51047e,'rows':_0x1e3a9d}:null;}})[_0x6a2a('0x1d')](respondWithResult(_0x172db7,null))['catch'](handleError(_0x172db7,null));};exports[_0x6a2a('0x5e')]=function(_0x47e203,_0x573837,_0x4b7edc){var _0x17bc14,_0x323c00;return db[_0x6a2a('0x26')][_0x6a2a('0x42')]({'where':{'id':_0x47e203[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x573837,null))['then'](function(_0xdf634d){if(_0xdf634d){_0x323c00=_0xdf634d;return _0xdf634d[_0x6a2a('0x5e')](_0x47e203['body'][_0x6a2a('0x5f')],_['omit'](_0x47e203['body'],['ids','id'])||{});}return null;})[_0x6a2a('0x60')](function(_0x12c900){var _0x229355;_0x17bc14=_0x12c900||[];var _0x265117=[];if(_0x12c900){for(var _0x455623=0x0;_0x455623<_0x12c900['length'];_0x455623+=0x1){var _0x54ac33=_0x12c900[_0x455623]['get']({'plain':!![]});_0x323c00['dialCheckDuplicateType']=_0x47e203['body'][_0x6a2a('0x61')]?_0x47e203[_0x6a2a('0x44')][_0x6a2a('0x61')]:_0x323c00[_0x6a2a('0x61')];switch(_0x323c00[_0x6a2a('0x61')]){case _0x6a2a('0x62'):_0x229355=squel['insert']()[_0x6a2a('0x63')](_0x6a2a('0x64'))[_0x6a2a('0x65')]([_0x6a2a('0x66'),_0x6a2a('0x67'),_0x6a2a('0x68'),_0x6a2a('0x69'),'CampaignId',_0x6a2a('0x4f'),_0x6a2a('0x4e')],squel[_0x6a2a('0x6a')]()['field'](_0x6a2a('0x66'),_0x6a2a('0x66'))[_0x6a2a('0x6b')](_0x6a2a('0x6c'),_0x6a2a('0x67'))['field']('id',_0x6a2a('0x68'))['field'](_0x54ac33[_0x6a2a('0x6d')][_0x6a2a('0x6e')](),_0x6a2a('0x69'))[_0x6a2a('0x6b')](_0x47e203[_0x6a2a('0x40')]['id'][_0x6a2a('0x6e')](),'CampaignId')[_0x6a2a('0x6b')]('NOW()',_0x6a2a('0x4f'))['field'](_0x6a2a('0x6c'),_0x6a2a('0x4e'))['from'](_0x6a2a('0x6f'))['where'](_0x6a2a('0x70'))[_0x6a2a('0x38')](_0x6a2a('0x71'),_0x54ac33[_0x6a2a('0x6d')]['toString']())['where'](_0x6a2a('0x72'))[_0x6a2a('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6a2a('0x6a')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x6a2a('0x73')]('cm_hopper_final')[_0x6a2a('0x38')](_0x6a2a('0x74'),_0x47e203[_0x6a2a('0x40')]['id'][_0x6a2a('0x6e')]()))['where'](_0x6a2a('0x75'),squel[_0x6a2a('0x6a')]()[_0x6a2a('0x6b')](_0x6a2a('0x76'))[_0x6a2a('0x73')](_0x6a2a('0x64'))[_0x6a2a('0x38')](_0x6a2a('0x74'),_0x47e203[_0x6a2a('0x40')]['id'][_0x6a2a('0x6e')]())))[_0x6a2a('0x6e')]();break;case _0x6a2a('0x77'):_0x229355=squel[_0x6a2a('0x78')]()[_0x6a2a('0x63')](_0x6a2a('0x64'))[_0x6a2a('0x65')]([_0x6a2a('0x66'),'scheduledAt',_0x6a2a('0x68'),_0x6a2a('0x69'),_0x6a2a('0x54'),'createdAt',_0x6a2a('0x4e')],squel['select']()[_0x6a2a('0x6b')](_0x6a2a('0x66'),_0x6a2a('0x66'))[_0x6a2a('0x6b')](_0x6a2a('0x6c'),_0x6a2a('0x67'))['field']('id',_0x6a2a('0x68'))[_0x6a2a('0x6b')](_0x54ac33[_0x6a2a('0x6d')][_0x6a2a('0x6e')](),'ListId')[_0x6a2a('0x6b')](_0x47e203[_0x6a2a('0x40')]['id'][_0x6a2a('0x6e')](),_0x6a2a('0x54'))[_0x6a2a('0x6b')](_0x6a2a('0x6c'),_0x6a2a('0x4f'))[_0x6a2a('0x6b')]('NOW()',_0x6a2a('0x4e'))[_0x6a2a('0x73')](_0x6a2a('0x6f'))[_0x6a2a('0x38')](_0x6a2a('0x70'))[_0x6a2a('0x38')](_0x6a2a('0x71'),_0x54ac33[_0x6a2a('0x6d')][_0x6a2a('0x6e')]())['where'](_0x6a2a('0x72'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x6a2a('0x76'))[_0x6a2a('0x73')](_0x6a2a('0x64'))['where'](_0x6a2a('0x74'),_0x47e203[_0x6a2a('0x40')]['id'][_0x6a2a('0x6e')]())))['toString']();break;default:_0x229355=squel['insert']()[_0x6a2a('0x63')]('cm_hopper')[_0x6a2a('0x65')]([_0x6a2a('0x66'),'scheduledAt',_0x6a2a('0x68'),_0x6a2a('0x69'),_0x6a2a('0x54'),_0x6a2a('0x4f'),_0x6a2a('0x4e')],squel['select']()[_0x6a2a('0x6b')]('phone',_0x6a2a('0x66'))[_0x6a2a('0x6b')](_0x6a2a('0x6c'),_0x6a2a('0x67'))['field']('id',_0x6a2a('0x68'))['field'](_0x54ac33['CmListId'][_0x6a2a('0x6e')](),_0x6a2a('0x69'))['field'](_0x47e203[_0x6a2a('0x40')]['id'][_0x6a2a('0x6e')](),_0x6a2a('0x54'))[_0x6a2a('0x6b')](_0x6a2a('0x6c'),_0x6a2a('0x4f'))[_0x6a2a('0x6b')]('NOW()','updatedAt')[_0x6a2a('0x73')](_0x6a2a('0x6f'))[_0x6a2a('0x38')](_0x6a2a('0x70'))[_0x6a2a('0x38')](_0x6a2a('0x71'),_0x54ac33[_0x6a2a('0x6d')]['toString']())[_0x6a2a('0x38')](_0x6a2a('0x72')))['toString']();}_0x265117[_0x6a2a('0x79')](db[_0x6a2a('0x7a')][_0x6a2a('0x2e')](_0x229355));}return BPromise[_0x6a2a('0x7b')](_0x265117);}})[_0x6a2a('0x1d')](function(){return _0x17bc14;})[_0x6a2a('0x1d')](respondWithResult(_0x573837,null))[_0x6a2a('0x3e')](handleError(_0x573837,null));};exports[_0x6a2a('0x7c')]=function(_0x544677,_0x12aab3,_0x438a05){return db['Campaign'][_0x6a2a('0x42')]({'where':{'id':_0x544677[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x12aab3,null))[_0x6a2a('0x1d')](function(_0x23b8a3){if(_0x23b8a3){return _0x23b8a3[_0x6a2a('0x7c')](_0x544677[_0x6a2a('0x2e')][_0x6a2a('0x5f')]);}})['then'](function(_0x1c5e46){if(_0x1c5e46){return db[_0x6a2a('0x53')][_0x6a2a('0x1e')]({'where':{'ListId':_0x544677[_0x6a2a('0x2e')][_0x6a2a('0x5f')],'CampaignId':_0x544677[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](function(){return _0x1c5e46;});}})[_0x6a2a('0x1d')](respondWithStatusCode(_0x12aab3,null))['catch'](handleError(_0x12aab3,null));};exports[_0x6a2a('0x7d')]=function(_0x2b329b,_0x1e3b73,_0x302ec1){var _0x624b4d={};var _0x1c2bdd={};var _0x4d5a11;var _0x3df600;return db[_0x6a2a('0x26')][_0x6a2a('0x52')]({'where':{'id':_0x2b329b['params']['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x1e3b73,null))[_0x6a2a('0x1d')](function(_0x5f4fce){if(_0x5f4fce){_0x4d5a11=_0x5f4fce;_0x1c2bdd[_0x6a2a('0x2d')]=_[_0x6a2a('0x2a')](db[_0x6a2a('0x5d')][_0x6a2a('0x27')]);_0x1c2bdd[_0x6a2a('0x2e')]=_['keys'](_0x2b329b[_0x6a2a('0x2e')]);_0x1c2bdd[_0x6a2a('0x2b')]=_['intersection'](_0x1c2bdd['model'],_0x1c2bdd['query']);_0x624b4d[_0x6a2a('0x30')]=_[_0x6a2a('0x2c')](_0x1c2bdd[_0x6a2a('0x2d')],qs[_0x6a2a('0x2f')](_0x2b329b[_0x6a2a('0x2e')][_0x6a2a('0x2f')]));_0x624b4d[_0x6a2a('0x30')]=_0x624b4d['attributes'][_0x6a2a('0x31')]?_0x624b4d[_0x6a2a('0x30')]:_0x1c2bdd[_0x6a2a('0x2d')];_0x624b4d[_0x6a2a('0x34')]=qs[_0x6a2a('0x35')](_0x2b329b[_0x6a2a('0x2e')][_0x6a2a('0x35')]);_0x624b4d[_0x6a2a('0x38')]=qs['filters'](_[_0x6a2a('0x36')](_0x2b329b[_0x6a2a('0x2e')],_0x1c2bdd[_0x6a2a('0x2b')]));if(_0x2b329b[_0x6a2a('0x2e')][_0x6a2a('0x37')]){_0x624b4d[_0x6a2a('0x38')]=_[_0x6a2a('0x39')](_0x624b4d[_0x6a2a('0x38')],{'$or':_[_0x6a2a('0x25')](_0x624b4d[_0x6a2a('0x30')],function(_0x1b2df2){var _0x2ac9c4={};_0x2ac9c4[_0x1b2df2]={'$like':'%'+_0x2b329b[_0x6a2a('0x2e')][_0x6a2a('0x37')]+'%'};return _0x2ac9c4;})});}_0x624b4d=_[_0x6a2a('0x39')]({},_0x624b4d,_0x2b329b[_0x6a2a('0x3b')]);return _0x4d5a11[_0x6a2a('0x7d')](_0x624b4d);}})['then'](function(_0x3cb8fb){if(_0x3cb8fb){_0x3df600=_0x3cb8fb[_0x6a2a('0x31')];if(!_0x2b329b[_0x6a2a('0x2e')][_0x6a2a('0x32')](_0x6a2a('0x33'))){_0x624b4d[_0x6a2a('0x18')]=qs['limit'](_0x2b329b[_0x6a2a('0x2e')][_0x6a2a('0x18')]);_0x624b4d['offset']=qs['offset'](_0x2b329b[_0x6a2a('0x2e')][_0x6a2a('0x17')]);}return _0x4d5a11[_0x6a2a('0x7d')](_0x624b4d);}})[_0x6a2a('0x1d')](function(_0x342237){if(_0x342237){return _0x342237?{'count':_0x3df600,'rows':_0x342237}:null;}})[_0x6a2a('0x1d')](respondWithResult(_0x1e3b73,null))[_0x6a2a('0x3e')](handleError(_0x1e3b73,null));};exports['addBlackLists']=function(_0x3e50e5,_0x3e08f1,_0x101c6b){var _0x27b8a6,_0x1c916c;return db[_0x6a2a('0x26')][_0x6a2a('0x42')]({'where':{'id':_0x3e50e5['params']['id']}})[_0x6a2a('0x1d')](handleEntityNotFound(_0x3e08f1,null))[_0x6a2a('0x1d')](function(_0x29f5ec){if(_0x29f5ec){_0x1c916c=_0x29f5ec;return _0x29f5ec[_0x6a2a('0x7e')](_0x3e50e5[_0x6a2a('0x44')][_0x6a2a('0x5f')],_[_0x6a2a('0x4d')](_0x3e50e5['body'],[_0x6a2a('0x5f'),'id'])||{});}return null;})['spread'](function(_0x41e54d){var _0x268e12;_0x27b8a6=_0x41e54d||[];var _0x262e5f=[];if(_0x41e54d){for(var _0x327749=0x0;_0x327749<_0x41e54d[_0x6a2a('0x31')];_0x327749+=0x1){var _0x3cc926=_0x41e54d[_0x327749][_0x6a2a('0x1f')]({'plain':!![]});_0x268e12=squel[_0x6a2a('0x78')]()['into'](_0x6a2a('0x7f'))[_0x6a2a('0x65')]([_0x6a2a('0x66'),_0x6a2a('0x68'),_0x6a2a('0x69'),_0x6a2a('0x54'),'createdAt','updatedAt'],squel[_0x6a2a('0x6a')]()['field'](_0x6a2a('0x66'),_0x6a2a('0x66'))[_0x6a2a('0x6b')]('id','ContactId')[_0x6a2a('0x6b')](_0x3cc926[_0x6a2a('0x6d')]['toString'](),'ListId')[_0x6a2a('0x6b')](_0x3e50e5['params']['id'][_0x6a2a('0x6e')](),_0x6a2a('0x54'))[_0x6a2a('0x6b')]('NOW()',_0x6a2a('0x4f'))[_0x6a2a('0x6b')]('NOW()',_0x6a2a('0x4e'))['from'](_0x6a2a('0x6f'))[_0x6a2a('0x38')]('deletedAt\x20IS\x20NULL')[_0x6a2a('0x38')](_0x6a2a('0x71'),_0x3cc926['CmListId']['toString']())[_0x6a2a('0x38')](_0x6a2a('0x72')))[_0x6a2a('0x6e')]();_0x262e5f['push'](db[_0x6a2a('0x7a')]['query'](_0x268e12));}return BPromise[_0x6a2a('0x7b')](_0x262e5f);}})[_0x6a2a('0x1d')](function(){return _0x27b8a6;})[_0x6a2a('0x1d')](respondWithResult(_0x3e08f1,null))[_0x6a2a('0x3e')](handleError(_0x3e08f1,null));};exports[_0x6a2a('0x80')]=function(_0x2e9d1c,_0x120fca,_0x100909){return db[_0x6a2a('0x26')][_0x6a2a('0x42')]({'where':{'id':_0x2e9d1c[_0x6a2a('0x40')]['id']}})['then'](handleEntityNotFound(_0x120fca,null))[_0x6a2a('0x1d')](function(_0x2dc9ec){if(_0x2dc9ec){return _0x2dc9ec[_0x6a2a('0x80')](_0x2e9d1c['query'][_0x6a2a('0x5f')]);}})['then'](function(_0x5a2c8a){if(_0x5a2c8a){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x2e9d1c['query'][_0x6a2a('0x5f')],'CampaignId':_0x2e9d1c[_0x6a2a('0x40')]['id']}})[_0x6a2a('0x1d')](function(){return _0x5a2c8a;});}})[_0x6a2a('0x1d')](respondWithStatusCode(_0x120fca,null))['catch'](handleError(_0x120fca,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1286174..53a28ea 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 _0x24a3=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns'];(function(_0x31058a,_0x5b6dc6){var _0x47af6c=function(_0x3f4d54){while(--_0x3f4d54){_0x31058a['push'](_0x31058a['shift']());}};_0x47af6c(++_0x5b6dc6);}(_0x24a3,0x18c));var _0x324a=function(_0x17652d,_0x169dcf){_0x17652d=_0x17652d-0x0;var _0x5aacdc=_0x24a3[_0x17652d];return _0x5aacdc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x324a('0x0'))(_0x324a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x324a('0x2'));var fs=require('fs');var path=require(_0x324a('0x3'));var rimraf=require(_0x324a('0x4'));var config=require(_0x324a('0x5'));var attributes=require(_0x324a('0x6'));module[_0x324a('0x7')]=function(_0x439d9e,_0x4976d1){return _0x439d9e[_0x324a('0x8')](_0x324a('0x9'),attributes,{'tableName':_0x324a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe761=['campaigns','lodash','util','api','request-promise','../../config/environment','exports','define','Campaign'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe761,0x88));var _0x1e76=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xe761[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x1e76('0x0'));var util=require(_0x1e76('0x1'));var logger=require('../../config/logger')(_0x1e76('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e76('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e76('0x4'));var attributes=require('./campaign.attributes');module[_0x1e76('0x5')]=function(_0x108178,_0x539b7d){return _0x108178[_0x1e76('0x6')](_0x1e76('0x7'),attributes,{'tableName':_0x1e76('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 022ebd1..c36202d 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(_0xcd32e1,_0x20fbed){var _0x5821d8=function(_0x1cbd6c){while(--_0x1cbd6c){_0xcd32e1['push'](_0xcd32e1['shift']());}};_0x5821d8(++_0x20fbed);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});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(_0x488140,_0x55ed27){var _0x477bad=function(_0x5b2244){while(--_0x5b2244){_0x488140['push'](_0x488140['shift']());}};_0x477bad(++_0x55ed27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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 4a247e7..d88848a 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 _0x6cfe=['multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeLists','exports'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x6cfe,0x1ce));var _0xe6cf=function(_0x3398a8,_0x1612d6){_0x3398a8=_0x3398a8-0x0;var _0x3e01d2=_0x6cfe[_0x3398a8];return _0x3e01d2;};'use strict';var multer=require(_0xe6cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe6cf('0x1'));var express=require('express');var router=express[_0xe6cf('0x2')]();var auth=require(_0xe6cf('0x3'));var interaction=require(_0xe6cf('0x4'));var config=require(_0xe6cf('0x5'));var controller=require(_0xe6cf('0x6'));router[_0xe6cf('0x7')]('/',auth[_0xe6cf('0x8')](),controller['index']);router['get'](_0xe6cf('0x9'),auth[_0xe6cf('0x8')](),controller[_0xe6cf('0xa')]);router['get'](_0xe6cf('0xb'),auth[_0xe6cf('0x8')](),controller[_0xe6cf('0xc')]);router['get'](_0xe6cf('0xd'),auth['isAuthenticated'](),controller[_0xe6cf('0xe')]);router[_0xe6cf('0x7')](_0xe6cf('0xf'),auth[_0xe6cf('0x8')](),controller[_0xe6cf('0x10')]);router[_0xe6cf('0x7')](_0xe6cf('0x11'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xe6cf('0x7')]('/:id/lists',auth[_0xe6cf('0x8')](),controller[_0xe6cf('0x12')]);router[_0xe6cf('0x7')](_0xe6cf('0x13'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xe6cf('0x14')]('/',auth[_0xe6cf('0x8')](),controller[_0xe6cf('0x15')]);router[_0xe6cf('0x14')](_0xe6cf('0x16'),auth[_0xe6cf('0x8')](),controller[_0xe6cf('0x17')]);router[_0xe6cf('0x14')](_0xe6cf('0x18'),auth['isAuthenticated'](),controller[_0xe6cf('0x19')]);router[_0xe6cf('0x14')]('/:id/blacklists',auth[_0xe6cf('0x8')](),controller[_0xe6cf('0x1a')]);router[_0xe6cf('0x1b')](_0xe6cf('0x9'),auth['isAuthenticated'](),controller[_0xe6cf('0x1c')]);router[_0xe6cf('0x1d')](_0xe6cf('0x9'),auth[_0xe6cf('0x8')](),controller[_0xe6cf('0x1e')]);router[_0xe6cf('0x1d')](_0xe6cf('0x18'),auth[_0xe6cf('0x8')](),controller[_0xe6cf('0x1f')]);router['delete'](_0xe6cf('0x13'),auth[_0xe6cf('0x8')](),controller['removeBlackLists']);module[_0xe6cf('0x20')]=router; \ No newline at end of file +var _0x0fc6=['/:id/blacklists','addBlackLists','put','update','delete','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists'];(function(_0x440572,_0x2357e5){var _0x6a18c=function(_0x44cb94){while(--_0x44cb94){_0x440572['push'](_0x440572['shift']());}};_0x6a18c(++_0x2357e5);}(_0x0fc6,0x117));var _0x60fc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0fc6[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x60fc('0x0'));var path=require(_0x60fc('0x1'));var timeout=require(_0x60fc('0x2'));var express=require(_0x60fc('0x3'));var router=express[_0x60fc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x60fc('0x5'));var config=require(_0x60fc('0x6'));var controller=require(_0x60fc('0x7'));router[_0x60fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x60fc('0x9')]);router[_0x60fc('0x8')](_0x60fc('0xa'),auth[_0x60fc('0xb')](),controller[_0x60fc('0xc')]);router[_0x60fc('0x8')](_0x60fc('0xd'),auth[_0x60fc('0xb')](),controller[_0x60fc('0xe')]);router[_0x60fc('0x8')](_0x60fc('0xf'),auth[_0x60fc('0xb')](),controller[_0x60fc('0x10')]);router['get'](_0x60fc('0x11'),auth[_0x60fc('0xb')](),controller['getHopperFinals']);router[_0x60fc('0x8')](_0x60fc('0x12'),auth[_0x60fc('0xb')](),controller[_0x60fc('0x13')]);router[_0x60fc('0x8')](_0x60fc('0x14'),auth[_0x60fc('0xb')](),controller['getLists']);router[_0x60fc('0x8')]('/:id/blacklists',auth[_0x60fc('0xb')](),controller[_0x60fc('0x15')]);router[_0x60fc('0x16')]('/',auth['isAuthenticated'](),controller[_0x60fc('0x17')]);router['post'](_0x60fc('0x18'),auth[_0x60fc('0xb')](),controller[_0x60fc('0x19')]);router[_0x60fc('0x16')](_0x60fc('0x14'),auth[_0x60fc('0xb')](),controller[_0x60fc('0x1a')]);router[_0x60fc('0x16')](_0x60fc('0x1b'),auth[_0x60fc('0xb')](),controller[_0x60fc('0x1c')]);router[_0x60fc('0x1d')](_0x60fc('0xa'),auth[_0x60fc('0xb')](),controller[_0x60fc('0x1e')]);router[_0x60fc('0x1f')](_0x60fc('0xa'),auth[_0x60fc('0xb')](),controller['destroy']);router['delete'](_0x60fc('0x14'),auth[_0x60fc('0xb')](),controller['removeLists']);router[_0x60fc('0x1f')](_0x60fc('0x1b'),auth[_0x60fc('0xb')](),controller[_0x60fc('0x20')]);module[_0x60fc('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 123b42d..0dab501 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 _0xcc62=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x245926,_0x5967f8){var _0x10e24d=function(_0xe84896){while(--_0xe84896){_0x245926['push'](_0x245926['shift']());}};_0x10e24d(++_0x5967f8);}(_0xcc62,0x7b));var _0x2cc6=function(_0x4feca0,_0x186afe){_0x4feca0=_0x4feca0-0x0;var _0x22f463=_0xcc62[_0x4feca0];return _0x22f463;};'use strict';var Sequelize=require(_0x2cc6('0x0'));module[_0x2cc6('0x1')]={'key':{'type':Sequelize[_0x2cc6('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2cc6('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2cc6('0x4')],'get':function(){return this[_0x2cc6('0x5')](_0x2cc6('0x6'));}}}; \ No newline at end of file +var _0xf2a0=['getDataValue','exports','STRING','TEXT','VIRTUAL'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf2a0,0x10f));var _0x0f2a=function(_0x284885,_0x34b143){_0x284885=_0x284885-0x0;var _0x3a9710=_0xf2a0[_0x284885];return _0x3a9710;};'use strict';var Sequelize=require('sequelize');module[_0x0f2a('0x0')]={'key':{'type':Sequelize[_0x0f2a('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x0f2a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0f2a('0x1')]},'name':{'type':Sequelize[_0x0f2a('0x3')],'get':function(){return this[_0x0f2a('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 651d457..d04cb23 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 26920d2..4cb68df 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 _0xc212=['bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x5242c6,_0x3d3cc0){var _0x5d5f3f=function(_0xe762ae){while(--_0xe762ae){_0x5242c6['push'](_0x5242c6['shift']());}};_0x5d5f3f(++_0x3d3cc0);}(_0xc212,0x1af));var _0x2c21=function(_0x1f9b14,_0x53d40f){_0x1f9b14=_0x1f9b14-0x0;var _0x534313=_0xc212[_0x1f9b14];return _0x534313;};'use strict';var _=require('lodash');var util=require(_0x2c21('0x0'));var logger=require(_0x2c21('0x1'))(_0x2c21('0x2'));var moment=require(_0x2c21('0x3'));var BPromise=require(_0x2c21('0x4'));var rp=require(_0x2c21('0x5'));var fs=require('fs');var path=require(_0x2c21('0x6'));var rimraf=require(_0x2c21('0x7'));var config=require(_0x2c21('0x8'));var attributes=require(_0x2c21('0x9'));module[_0x2c21('0xa')]=function(_0x3267c4,_0x2220e2){return _0x3267c4[_0x2c21('0xb')]('CannedAnswer',attributes,{'tableName':_0x2c21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c21('0xd'),'collate':_0x2c21('0xe')});}; \ No newline at end of file +var _0x9205=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','CannedAnswer'];(function(_0x17b8a9,_0x3bbf58){var _0x4add80=function(_0x683126){while(--_0x683126){_0x17b8a9['push'](_0x17b8a9['shift']());}};_0x4add80(++_0x3bbf58);}(_0x9205,0x14d));var _0x5920=function(_0x577bb7,_0x3fb0f2){_0x577bb7=_0x577bb7-0x0;var _0x479f36=_0x9205[_0x577bb7];return _0x479f36;};'use strict';var _=require(_0x5920('0x0'));var util=require(_0x5920('0x1'));var logger=require(_0x5920('0x2'))(_0x5920('0x3'));var moment=require(_0x5920('0x4'));var BPromise=require(_0x5920('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x4a372a,_0x904123){return _0x4a372a['define'](_0x5920('0x6'),attributes,{'tableName':_0x5920('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5920('0x8'),'collate':_0x5920('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 88855bf..ff04577 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 _0xa206=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','CannedAnswer,\x20%s,\x20%s','message','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa206,0x18c));var _0x6a20=function(_0x4d07d9,_0x152e11){_0x4d07d9=_0x4d07d9-0x0;var _0xcc917e=_0xa206[_0x4d07d9];return _0xcc917e;};'use strict';var _=require('lodash');var util=require(_0x6a20('0x0'));var moment=require(_0x6a20('0x1'));var BPromise=require(_0x6a20('0x2'));var rs=require(_0x6a20('0x3'));var fs=require('fs');var Redis=require(_0x6a20('0x4'));var db=require(_0x6a20('0x5'))['db'];var utils=require(_0x6a20('0x6'));var logger=require(_0x6a20('0x7'))(_0x6a20('0x8'));var config=require(_0x6a20('0x9'));var jayson=require(_0x6a20('0xa'));var client=jayson[_0x6a20('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b55aa,_0x19d259,_0x29d330){return new BPromise(function(_0x3c858d,_0x302de8){return client[_0x6a20('0xc')](_0x4b55aa,_0x29d330)[_0x6a20('0xd')](function(_0x292ec4){logger[_0x6a20('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x19d259,_0x6a20('0xf'));logger['debug'](_0x6a20('0x10'),_0x19d259,_0x6a20('0xf'),JSON['stringify'](_0x292ec4));if(_0x292ec4[_0x6a20('0x11')]){if(_0x292ec4[_0x6a20('0x11')][_0x6a20('0x12')]===0x1f4){logger[_0x6a20('0x11')](_0x6a20('0x13'),_0x19d259,_0x292ec4[_0x6a20('0x11')]['message']);return _0x302de8(_0x292ec4[_0x6a20('0x11')][_0x6a20('0x14')]);}logger[_0x6a20('0x11')](_0x6a20('0x13'),_0x19d259,_0x292ec4[_0x6a20('0x11')][_0x6a20('0x14')]);return _0x3c858d(_0x292ec4['error']['message']);}else{logger['info'](_0x6a20('0x13'),_0x19d259,_0x6a20('0xf'));_0x3c858d(_0x292ec4['result'][_0x6a20('0x14')]);}})['catch'](function(_0x49b2c8){logger[_0x6a20('0x11')](_0x6a20('0x13'),_0x19d259,_0x49b2c8);_0x302de8(_0x49b2c8);});});} \ No newline at end of file +var _0xba99=['info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x16125c,_0x569146){var _0x39267f=function(_0x41c4d8){while(--_0x41c4d8){_0x16125c['push'](_0x16125c['shift']());}};_0x39267f(++_0x569146);}(_0xba99,0x7d));var _0x9ba9=function(_0x381c2f,_0x2dde11){_0x381c2f=_0x381c2f-0x0;var _0x43bda5=_0xba99[_0x381c2f];return _0x43bda5;};'use strict';var _=require(_0x9ba9('0x0'));var util=require(_0x9ba9('0x1'));var moment=require(_0x9ba9('0x2'));var BPromise=require(_0x9ba9('0x3'));var rs=require(_0x9ba9('0x4'));var fs=require('fs');var Redis=require(_0x9ba9('0x5'));var db=require(_0x9ba9('0x6'))['db'];var utils=require(_0x9ba9('0x7'));var logger=require(_0x9ba9('0x8'))('rpc');var config=require(_0x9ba9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9ba9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8a94,_0x413a41,_0x591a50){return new BPromise(function(_0x3b0408,_0x2bcc18){return client[_0x9ba9('0xb')](_0x3a8a94,_0x591a50)[_0x9ba9('0xc')](function(_0x52f254){logger[_0x9ba9('0xd')](_0x9ba9('0xe'),_0x413a41,'request\x20sent');logger[_0x9ba9('0xf')](_0x9ba9('0x10'),_0x413a41,_0x9ba9('0x11'),JSON[_0x9ba9('0x12')](_0x52f254));if(_0x52f254[_0x9ba9('0x13')]){if(_0x52f254[_0x9ba9('0x13')][_0x9ba9('0x14')]===0x1f4){logger[_0x9ba9('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x413a41,_0x52f254[_0x9ba9('0x13')][_0x9ba9('0x15')]);return _0x2bcc18(_0x52f254['error'][_0x9ba9('0x15')]);}logger['error'](_0x9ba9('0xe'),_0x413a41,_0x52f254[_0x9ba9('0x13')][_0x9ba9('0x15')]);return _0x3b0408(_0x52f254[_0x9ba9('0x13')]['message']);}else{logger[_0x9ba9('0xd')](_0x9ba9('0xe'),_0x413a41,_0x9ba9('0x11'));_0x3b0408(_0x52f254[_0x9ba9('0x16')]['message']);}})['catch'](function(_0x334e00){logger[_0x9ba9('0x13')](_0x9ba9('0xe'),_0x413a41,_0x334e00);_0x2bcc18(_0x334e00);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 9753c93..b68be49 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 _0x4663=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','create','put','delete','/:id','destroy','exports','multer','util'];(function(_0x4fab09,_0x2e343b){var _0xf457df=function(_0x72447b){while(--_0x72447b){_0x4fab09['push'](_0x4fab09['shift']());}};_0xf457df(++_0x2e343b);}(_0x4663,0x19c));var _0x3466=function(_0x540970,_0x331765){_0x540970=_0x540970-0x0;var _0x414a90=_0x4663[_0x540970];return _0x414a90;};'use strict';var multer=require(_0x3466('0x0'));var util=require(_0x3466('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3466('0x2'));var router=express[_0x3466('0x3')]();var auth=require(_0x3466('0x4'));var interaction=require(_0x3466('0x5'));var config=require(_0x3466('0x6'));var controller=require(_0x3466('0x7'));router[_0x3466('0x8')]('/',auth[_0x3466('0x9')](),controller[_0x3466('0xa')]);router[_0x3466('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3466('0xb')]);router['post']('/',auth[_0x3466('0x9')](),controller[_0x3466('0xc')]);router[_0x3466('0xd')]('/:id',auth[_0x3466('0x9')](),controller['update']);router[_0x3466('0xe')](_0x3466('0xf'),auth[_0x3466('0x9')](),controller[_0x3466('0x10')]);module[_0x3466('0x11')]=router; \ No newline at end of file +var _0x0b3d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x0b3d,0x118));var _0xd0b3=function(_0x2a036a,_0x2cbbdf){_0x2a036a=_0x2a036a-0x0;var _0xee0b06=_0x0b3d[_0x2a036a];return _0xee0b06;};'use strict';var multer=require(_0xd0b3('0x0'));var util=require(_0xd0b3('0x1'));var path=require('path');var timeout=require(_0xd0b3('0x2'));var express=require(_0xd0b3('0x3'));var router=express[_0xd0b3('0x4')]();var auth=require(_0xd0b3('0x5'));var interaction=require(_0xd0b3('0x6'));var config=require(_0xd0b3('0x7'));var controller=require(_0xd0b3('0x8'));router[_0xd0b3('0x9')]('/',auth[_0xd0b3('0xa')](),controller[_0xd0b3('0xb')]);router[_0xd0b3('0x9')](_0xd0b3('0xc'),auth[_0xd0b3('0xa')](),controller[_0xd0b3('0xd')]);router[_0xd0b3('0xe')]('/',auth[_0xd0b3('0xa')](),controller[_0xd0b3('0xf')]);router[_0xd0b3('0x10')](_0xd0b3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd0b3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd0b3('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 c830f6a..6dc0630 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 _0x4187=['INTEGER','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x2ca4f7,_0x4fdcd0){var _0x5f5527=function(_0x234dc0){while(--_0x234dc0){_0x2ca4f7['push'](_0x2ca4f7['shift']());}};_0x5f5527(++_0x4fdcd0);}(_0x4187,0xce));var _0x7418=function(_0x373f60,_0x59e161){_0x373f60=_0x373f60-0x0;var _0x577f95=_0x4187[_0x373f60];return _0x577f95;};'use strict';var Sequelize=require('sequelize');module[_0x7418('0x0')]={'calldate':{'type':Sequelize[_0x7418('0x1')],'allowNull':![],'defaultValue':_0x7418('0x2')},'clid':{'type':Sequelize[_0x7418('0x3')]},'src':{'type':Sequelize[_0x7418('0x3')]},'dst':{'type':Sequelize[_0x7418('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7418('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x7418('0x3')]},'lastdata':{'type':Sequelize[_0x7418('0x3')]},'duration':{'type':Sequelize[_0x7418('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7418('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7418('0x3')]},'amaflags':{'type':Sequelize[_0x7418('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7418('0x3')]},'userfield':{'type':Sequelize[_0x7418('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x7418('0x3')]},'peeraccount':{'type':Sequelize[_0x7418('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x7418('0x3')]}}; \ No newline at end of file +var _0x949c=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x949c,0x122));var _0xc949=function(_0x323471,_0x23510c){_0x323471=_0x323471-0x0;var _0x5ec00c=_0x949c[_0x323471];return _0x5ec00c;};'use strict';var Sequelize=require(_0xc949('0x0'));module[_0xc949('0x1')]={'calldate':{'type':Sequelize[_0xc949('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xc949('0x3')]},'src':{'type':Sequelize[_0xc949('0x3')]},'dst':{'type':Sequelize[_0xc949('0x3')]},'dcontext':{'type':Sequelize[_0xc949('0x3')]},'channel':{'type':Sequelize[_0xc949('0x3')]},'dstchannel':{'type':Sequelize[_0xc949('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc949('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc949('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc949('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc949('0x3')]},'userfield':{'type':Sequelize[_0xc949('0x3')]},'uniqueid':{'type':Sequelize[_0xc949('0x3')]},'linkedid':{'type':Sequelize[_0xc949('0x3')]},'sequence':{'type':Sequelize[_0xc949('0x3')]},'peeraccount':{'type':Sequelize[_0xc949('0x3')]},'type':{'type':Sequelize[_0xc949('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 029c26e..3a1be41 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 _0x971c=['to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x971c,0x1ae));var _0xc971=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x971c[_0x411add];return _0x238242;};'use strict';var pdf=require(_0xc971('0x0'));var emlformat=require(_0xc971('0x1'));var rimraf=require(_0xc971('0x2'));var zipdir=require(_0xc971('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc971('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc971('0x5'));var util=require(_0xc971('0x6'));var path=require(_0xc971('0x7'));var sox=require('sox');var csv=require(_0xc971('0x8'));var ejs=require(_0xc971('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc971('0xa'));var toCsv=require(_0xc971('0x8'));var querystring=require(_0xc971('0xb'));var Papa=require(_0xc971('0xc'));var Redis=require(_0xc971('0xd'));var authService=require(_0xc971('0xe'));var qs=require(_0xc971('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc971('0x10'))('api');var utils=require(_0xc971('0x11'));var config=require(_0xc971('0x12'));var licenseUtil=require(_0xc971('0x13'));var db=require(_0xc971('0x14'))['db'];function respondWithStatusCode(_0x379e54,_0x34cf2e){_0x34cf2e=_0x34cf2e||0xcc;return function(_0x586e0c){if(_0x586e0c){return _0x379e54[_0xc971('0x15')](_0x34cf2e);}return _0x379e54[_0xc971('0x16')](_0x34cf2e)[_0xc971('0x17')]();};}function respondWithResult(_0x492db4,_0xee9cdf){_0xee9cdf=_0xee9cdf||0xc8;return function(_0x10b4fd){if(_0x10b4fd){return _0x492db4[_0xc971('0x16')](_0xee9cdf)[_0xc971('0x18')](_0x10b4fd);}};}function respondWithFilteredResult(_0x3abe4f,_0x4df744){return function(_0x4eab06){if(_0x4eab06){var _0x64c59=_0x4eab06['count'],_0x5ea593=_0x4df744['offset'],_0xd1a16a=_0x4df744['offset']+_0x4df744['limit'],_0x4ff3b3;if(_0xd1a16a>=_0x64c59){_0xd1a16a=_0x64c59;_0x4ff3b3=0xc8;}else{_0x4ff3b3=0xce;}_0x3abe4f[_0xc971('0x16')](_0x4ff3b3);return _0x3abe4f[_0xc971('0x19')](_0xc971('0x1a'),_0x5ea593+'-'+_0xd1a16a+'/'+_0x64c59)[_0xc971('0x18')](_0x4eab06);}return null;};}function patchUpdates(_0x5ee024){return function(_0x41171f){try{jsonpatch[_0xc971('0x1b')](_0x41171f,_0x5ee024,!![]);}catch(_0x524b4a){return BPromise['reject'](_0x524b4a);}return _0x41171f[_0xc971('0x1c')]();};}function saveUpdates(_0x648e2c,_0x479da8){return function(_0x47b2c7){if(_0x47b2c7){return _0x47b2c7[_0xc971('0x1d')](_0x648e2c)[_0xc971('0x1e')](function(_0x5b4aae){return _0x5b4aae;});}return null;};}function removeEntity(_0x32063b,_0x1a552f){return function(_0x290ce8){if(_0x290ce8){return _0x290ce8[_0xc971('0x1f')]()[_0xc971('0x1e')](function(){_0x32063b[_0xc971('0x16')](0xcc)[_0xc971('0x17')]();});}};}function handleEntityNotFound(_0x6543f0,_0x5eb0fc){return function(_0x1d753d){if(!_0x1d753d){_0x6543f0['sendStatus'](0x194);}return _0x1d753d;};}function handleError(_0x3359d6,_0x39401e){_0x39401e=_0x39401e||0x1f4;return function(_0x2161f3){logger[_0xc971('0x20')](_0x2161f3[_0xc971('0x21')]);if(_0x2161f3[_0xc971('0x22')]){delete _0x2161f3[_0xc971('0x22')];}_0x3359d6[_0xc971('0x16')](_0x39401e)[_0xc971('0x23')](_0x2161f3);};}exports[_0xc971('0x24')]=function(_0x59d52c,_0x4f4714){var _0x382e0a={},_0x4165d5={},_0x4f392c={'count':0x0,'rows':[]};var _0x293fbe=_[_0xc971('0x25')](db[_0xc971('0x26')][_0xc971('0x27')],function(_0x2a22c4){return{'name':_0x2a22c4[_0xc971('0x28')],'type':_0x2a22c4[_0xc971('0x29')][_0xc971('0x2a')]};});_0x4165d5[_0xc971('0x2b')]=_['map'](_0x293fbe,_0xc971('0x22'));_0x4165d5[_0xc971('0x2c')]=_[_0xc971('0x2d')](_0x59d52c[_0xc971('0x2c')]);_0x4165d5['filters']=_[_0xc971('0x2e')](_0x4165d5['model'],_0x4165d5[_0xc971('0x2c')]);_0x382e0a[_0xc971('0x2f')]=_[_0xc971('0x2e')](_0x4165d5[_0xc971('0x2b')],qs[_0xc971('0x30')](_0x59d52c['query'][_0xc971('0x30')]));_0x382e0a[_0xc971('0x2f')]=_0x382e0a[_0xc971('0x2f')][_0xc971('0x31')]?_0x382e0a['attributes']:_0x4165d5[_0xc971('0x2b')];if(!_0x59d52c[_0xc971('0x2c')][_0xc971('0x32')](_0xc971('0x33'))){_0x382e0a[_0xc971('0x34')]=qs[_0xc971('0x34')](_0x59d52c[_0xc971('0x2c')][_0xc971('0x34')]);_0x382e0a[_0xc971('0x35')]=qs['offset'](_0x59d52c[_0xc971('0x2c')][_0xc971('0x35')]);}_0x382e0a[_0xc971('0x36')]=qs[_0xc971('0x37')](_0x59d52c[_0xc971('0x2c')][_0xc971('0x37')]);_0x382e0a[_0xc971('0x38')]=qs[_0xc971('0x39')](_[_0xc971('0x3a')](_0x59d52c['query'],_0x4165d5['filters']),_0x293fbe);if(_0x59d52c[_0xc971('0x2c')][_0xc971('0x3b')]){_0x382e0a[_0xc971('0x38')]=_[_0xc971('0x3c')](_0x382e0a[_0xc971('0x38')],{'$or':_['map'](_0x293fbe,function(_0x4f29f7){if(_0x4f29f7['type']!==_0xc971('0x3d')){var _0x5b210e={};_0x5b210e[_0x4f29f7[_0xc971('0x22')]]={'$like':'%'+_0x59d52c['query'][_0xc971('0x3b')]+'%'};return _0x5b210e;}})});}_0x382e0a=_[_0xc971('0x3c')]({},_0x382e0a,_0x59d52c[_0xc971('0x3e')]);var _0x8a35b3={'where':_0x382e0a[_0xc971('0x38')]};return db[_0xc971('0x26')][_0xc971('0x3f')](_0x8a35b3)['then'](function(_0x39ba81){_0x4f392c[_0xc971('0x3f')]=_0x39ba81;if(_0x59d52c[_0xc971('0x2c')][_0xc971('0x40')]){_0x382e0a[_0xc971('0x41')]=[{'all':!![]}];}return db[_0xc971('0x26')]['findAll'](_0x382e0a);})[_0xc971('0x1e')](function(_0x228ea6){_0x4f392c['rows']=_0x228ea6;return _0x4f392c;})['then'](respondWithFilteredResult(_0x4f4714,_0x382e0a))[_0xc971('0x42')](handleError(_0x4f4714,null));};exports[_0xc971('0x43')]=function(_0x1e7b0c,_0x5c6bba){var _0x1ee4ef={'raw':!![],'where':{'id':_0x1e7b0c['params']['id']}},_0x7aca6c={};_0x7aca6c[_0xc971('0x2b')]=_['keys'](db[_0xc971('0x26')][_0xc971('0x27')]);_0x7aca6c['query']=_[_0xc971('0x2d')](_0x1e7b0c[_0xc971('0x2c')]);_0x7aca6c[_0xc971('0x39')]=_['intersection'](_0x7aca6c[_0xc971('0x2b')],_0x7aca6c['query']);_0x1ee4ef[_0xc971('0x2f')]=_[_0xc971('0x2e')](_0x7aca6c['model'],qs[_0xc971('0x30')](_0x1e7b0c[_0xc971('0x2c')][_0xc971('0x30')]));_0x1ee4ef[_0xc971('0x2f')]=_0x1ee4ef[_0xc971('0x2f')]['length']?_0x1ee4ef[_0xc971('0x2f')]:_0x7aca6c[_0xc971('0x2b')];if(_0x1e7b0c[_0xc971('0x2c')][_0xc971('0x40')]){_0x1ee4ef[_0xc971('0x41')]=[{'all':!![]}];}_0x1ee4ef=_['merge']({},_0x1ee4ef,_0x1e7b0c[_0xc971('0x3e')]);return db[_0xc971('0x26')]['find'](_0x1ee4ef)[_0xc971('0x1e')](handleEntityNotFound(_0x5c6bba,null))[_0xc971('0x1e')](respondWithResult(_0x5c6bba,null))[_0xc971('0x42')](handleError(_0x5c6bba,null));};exports[_0xc971('0x44')]=function(_0x4f1905,_0x521c07){return db[_0xc971('0x26')][_0xc971('0x44')](_0x4f1905[_0xc971('0x45')],{})[_0xc971('0x1e')](respondWithResult(_0x521c07,0xc9))['catch'](handleError(_0x521c07,null));};exports[_0xc971('0x1d')]=function(_0x2adaf8,_0x4a22e9){if(_0x2adaf8['body']['id']){delete _0x2adaf8[_0xc971('0x45')]['id'];}return db[_0xc971('0x26')][_0xc971('0x46')]({'where':{'id':_0x2adaf8['params']['id']}})['then'](handleEntityNotFound(_0x4a22e9,null))['then'](saveUpdates(_0x2adaf8[_0xc971('0x45')],null))['then'](respondWithResult(_0x4a22e9,null))['catch'](handleError(_0x4a22e9,null));};exports[_0xc971('0x1f')]=function(_0x37253e,_0x1388e3){return db[_0xc971('0x26')][_0xc971('0x46')]({'where':{'id':_0x37253e[_0xc971('0x47')]['id']}})['then'](handleEntityNotFound(_0x1388e3,null))['then'](removeEntity(_0x1388e3,null))[_0xc971('0x42')](handleError(_0x1388e3,null));};exports[_0xc971('0x48')]=function(_0x4b8291,_0x3f40de){return db[_0xc971('0x26')]['describe']()[_0xc971('0x1e')](respondWithResult(_0x3f40de,null))[_0xc971('0x42')](handleError(_0x3f40de,null));}; \ No newline at end of file +var _0x4145=['VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','Content-Range','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','Cdr','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map'];(function(_0x1fbf2d,_0x12a6d1){var _0x3dff60=function(_0x118a82){while(--_0x118a82){_0x1fbf2d['push'](_0x1fbf2d['shift']());}};_0x3dff60(++_0x12a6d1);}(_0x4145,0xf3));var _0x5414=function(_0x30f115,_0x4114b8){_0x30f115=_0x30f115-0x0;var _0x40ee32=_0x4145[_0x30f115];return _0x40ee32;};'use strict';var pdf=require(_0x5414('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5414('0x1'));var zipdir=require(_0x5414('0x2'));var jsonpatch=require(_0x5414('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5414('0x4'));var Mustache=require(_0x5414('0x5'));var util=require(_0x5414('0x6'));var path=require(_0x5414('0x7'));var sox=require(_0x5414('0x8'));var csv=require(_0x5414('0x9'));var ejs=require(_0x5414('0xa'));var fs=require('fs');var _=require(_0x5414('0xb'));var squel=require(_0x5414('0xc'));var crypto=require(_0x5414('0xd'));var jsforce=require(_0x5414('0xe'));var deskjs=require(_0x5414('0xf'));var toCsv=require(_0x5414('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5414('0x10'));var authService=require(_0x5414('0x11'));var qs=require(_0x5414('0x12'));var as=require(_0x5414('0x13'));var hardwareService=require(_0x5414('0x14'));var logger=require(_0x5414('0x15'))(_0x5414('0x16'));var utils=require(_0x5414('0x17'));var config=require(_0x5414('0x18'));var licenseUtil=require(_0x5414('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20984f,_0x1c3a76){_0x1c3a76=_0x1c3a76||0xcc;return function(_0x56966b){if(_0x56966b){return _0x20984f['sendStatus'](_0x1c3a76);}return _0x20984f[_0x5414('0x1a')](_0x1c3a76)['end']();};}function respondWithResult(_0x33503c,_0x1af5b6){_0x1af5b6=_0x1af5b6||0xc8;return function(_0x2786f2){if(_0x2786f2){return _0x33503c['status'](_0x1af5b6)[_0x5414('0x1b')](_0x2786f2);}};}function respondWithFilteredResult(_0x4ea244,_0x2a38d5){return function(_0xa09e3e){if(_0xa09e3e){var _0x197e0a=_0xa09e3e['count'],_0xa5b769=_0x2a38d5[_0x5414('0x1c')],_0x48147d=_0x2a38d5[_0x5414('0x1c')]+_0x2a38d5[_0x5414('0x1d')],_0x4b9def;if(_0x48147d>=_0x197e0a){_0x48147d=_0x197e0a;_0x4b9def=0xc8;}else{_0x4b9def=0xce;}_0x4ea244['status'](_0x4b9def);return _0x4ea244['set'](_0x5414('0x1e'),_0xa5b769+'-'+_0x48147d+'/'+_0x197e0a)[_0x5414('0x1b')](_0xa09e3e);}return null;};}function patchUpdates(_0x5dc7b3){return function(_0x2f46e9){try{jsonpatch[_0x5414('0x1f')](_0x2f46e9,_0x5dc7b3,!![]);}catch(_0x57f637){return BPromise[_0x5414('0x20')](_0x57f637);}return _0x2f46e9['save']();};}function saveUpdates(_0x47ae7b,_0x56fdda){return function(_0x28a1df){if(_0x28a1df){return _0x28a1df[_0x5414('0x21')](_0x47ae7b)['then'](function(_0x1ae9d0){return _0x1ae9d0;});}return null;};}function removeEntity(_0x10289c,_0x1d28d5){return function(_0x2f4409){if(_0x2f4409){return _0x2f4409[_0x5414('0x22')]()[_0x5414('0x23')](function(){_0x10289c['status'](0xcc)[_0x5414('0x24')]();});}};}function handleEntityNotFound(_0x3eba52,_0x1c629c){return function(_0x508940){if(!_0x508940){_0x3eba52[_0x5414('0x25')](0x194);}return _0x508940;};}function handleError(_0x334b3e,_0x2d226b){_0x2d226b=_0x2d226b||0x1f4;return function(_0x26d846){logger[_0x5414('0x26')](_0x26d846[_0x5414('0x27')]);if(_0x26d846[_0x5414('0x28')]){delete _0x26d846[_0x5414('0x28')];}_0x334b3e['status'](_0x2d226b)[_0x5414('0x29')](_0x26d846);};}exports[_0x5414('0x2a')]=function(_0x310061,_0x3fa84d){var _0x1a4f5b={},_0x2a3ffa={},_0x522738={'count':0x0,'rows':[]};var _0x3c8b7c=_['map'](db[_0x5414('0x2b')][_0x5414('0x2c')],function(_0xa7eb14){return{'name':_0xa7eb14['fieldName'],'type':_0xa7eb14[_0x5414('0x2d')][_0x5414('0x2e')]};});_0x2a3ffa[_0x5414('0x2f')]=_['map'](_0x3c8b7c,'name');_0x2a3ffa[_0x5414('0x30')]=_['keys'](_0x310061['query']);_0x2a3ffa[_0x5414('0x31')]=_[_0x5414('0x32')](_0x2a3ffa[_0x5414('0x2f')],_0x2a3ffa['query']);_0x1a4f5b[_0x5414('0x33')]=_['intersection'](_0x2a3ffa[_0x5414('0x2f')],qs[_0x5414('0x34')](_0x310061['query']['fields']));_0x1a4f5b[_0x5414('0x33')]=_0x1a4f5b[_0x5414('0x33')]['length']?_0x1a4f5b['attributes']:_0x2a3ffa['model'];if(!_0x310061[_0x5414('0x30')]['hasOwnProperty'](_0x5414('0x35'))){_0x1a4f5b[_0x5414('0x1d')]=qs['limit'](_0x310061[_0x5414('0x30')][_0x5414('0x1d')]);_0x1a4f5b[_0x5414('0x1c')]=qs[_0x5414('0x1c')](_0x310061[_0x5414('0x30')]['offset']);}_0x1a4f5b[_0x5414('0x36')]=qs[_0x5414('0x37')](_0x310061[_0x5414('0x30')]['sort']);_0x1a4f5b[_0x5414('0x38')]=qs[_0x5414('0x31')](_[_0x5414('0x39')](_0x310061['query'],_0x2a3ffa[_0x5414('0x31')]),_0x3c8b7c);if(_0x310061['query'][_0x5414('0x3a')]){_0x1a4f5b[_0x5414('0x38')]=_[_0x5414('0x3b')](_0x1a4f5b[_0x5414('0x38')],{'$or':_[_0x5414('0x3c')](_0x3c8b7c,function(_0x2f5c53){if(_0x2f5c53[_0x5414('0x2d')]!==_0x5414('0x3d')){var _0x20b4c4={};_0x20b4c4[_0x2f5c53[_0x5414('0x28')]]={'$like':'%'+_0x310061['query'][_0x5414('0x3a')]+'%'};return _0x20b4c4;}})});}_0x1a4f5b=_[_0x5414('0x3b')]({},_0x1a4f5b,_0x310061[_0x5414('0x3e')]);var _0x88a481={'where':_0x1a4f5b[_0x5414('0x38')]};return db[_0x5414('0x2b')][_0x5414('0x3f')](_0x88a481)[_0x5414('0x23')](function(_0x1fdd29){_0x522738[_0x5414('0x3f')]=_0x1fdd29;if(_0x310061['query'][_0x5414('0x40')]){_0x1a4f5b[_0x5414('0x41')]=[{'all':!![]}];}return db[_0x5414('0x2b')][_0x5414('0x42')](_0x1a4f5b);})[_0x5414('0x23')](function(_0xb85e71){_0x522738[_0x5414('0x43')]=_0xb85e71;return _0x522738;})[_0x5414('0x23')](respondWithFilteredResult(_0x3fa84d,_0x1a4f5b))[_0x5414('0x44')](handleError(_0x3fa84d,null));};exports[_0x5414('0x45')]=function(_0x11ec7f,_0x4658ba){var _0x1f098b={'raw':!![],'where':{'id':_0x11ec7f[_0x5414('0x46')]['id']}},_0x2cc08b={};_0x2cc08b[_0x5414('0x2f')]=_[_0x5414('0x47')](db[_0x5414('0x2b')][_0x5414('0x2c')]);_0x2cc08b[_0x5414('0x30')]=_['keys'](_0x11ec7f[_0x5414('0x30')]);_0x2cc08b[_0x5414('0x31')]=_[_0x5414('0x32')](_0x2cc08b[_0x5414('0x2f')],_0x2cc08b[_0x5414('0x30')]);_0x1f098b[_0x5414('0x33')]=_[_0x5414('0x32')](_0x2cc08b[_0x5414('0x2f')],qs['fields'](_0x11ec7f[_0x5414('0x30')]['fields']));_0x1f098b['attributes']=_0x1f098b['attributes']['length']?_0x1f098b[_0x5414('0x33')]:_0x2cc08b[_0x5414('0x2f')];if(_0x11ec7f[_0x5414('0x30')][_0x5414('0x40')]){_0x1f098b['include']=[{'all':!![]}];}_0x1f098b=_[_0x5414('0x3b')]({},_0x1f098b,_0x11ec7f[_0x5414('0x3e')]);return db[_0x5414('0x2b')][_0x5414('0x48')](_0x1f098b)[_0x5414('0x23')](handleEntityNotFound(_0x4658ba,null))['then'](respondWithResult(_0x4658ba,null))[_0x5414('0x44')](handleError(_0x4658ba,null));};exports[_0x5414('0x49')]=function(_0x5acb39,_0x25e474){return db[_0x5414('0x2b')][_0x5414('0x49')](_0x5acb39[_0x5414('0x4a')],{})[_0x5414('0x23')](respondWithResult(_0x25e474,0xc9))['catch'](handleError(_0x25e474,null));};exports['update']=function(_0x4fcf51,_0x3c6d05){if(_0x4fcf51[_0x5414('0x4a')]['id']){delete _0x4fcf51['body']['id'];}return db[_0x5414('0x2b')][_0x5414('0x48')]({'where':{'id':_0x4fcf51['params']['id']}})[_0x5414('0x23')](handleEntityNotFound(_0x3c6d05,null))['then'](saveUpdates(_0x4fcf51[_0x5414('0x4a')],null))[_0x5414('0x23')](respondWithResult(_0x3c6d05,null))[_0x5414('0x44')](handleError(_0x3c6d05,null));};exports[_0x5414('0x22')]=function(_0x9f0eb1,_0x1e3a0b){return db[_0x5414('0x2b')][_0x5414('0x48')]({'where':{'id':_0x9f0eb1[_0x5414('0x46')]['id']}})[_0x5414('0x23')](handleEntityNotFound(_0x1e3a0b,null))[_0x5414('0x23')](removeEntity(_0x1e3a0b,null))['catch'](handleError(_0x1e3a0b,null));};exports[_0x5414('0x4b')]=function(_0x4a8296,_0x39ab35){return db[_0x5414('0x2b')][_0x5414('0x4b')]()[_0x5414('0x23')](respondWithResult(_0x39ab35,null))[_0x5414('0x44')](handleError(_0x39ab35,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3367494..d0b59fc 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash'];(function(_0x323d43,_0x31645b){var _0x4d3ea5=function(_0x4eaa5d){while(--_0x4eaa5d){_0x323d43['push'](_0x323d43['shift']());}};_0x4d3ea5(++_0x31645b);}(_0x5496,0x175));var _0x6549=function(_0x53fad2,_0x3e6665){_0x53fad2=_0x53fad2-0x0;var _0x75ee73=_0x5496[_0x53fad2];return _0x75ee73;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('Cdr',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'calldate','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]},{'name':_0x6549('0xe'),'fields':[_0x6549('0xe')]},{'name':_0x6549('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x6549('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x90b1=['path','rimraf','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x19a632,_0x554a31){var _0x41aa02=function(_0x581222){while(--_0x581222){_0x19a632['push'](_0x19a632['shift']());}};_0x41aa02(++_0x554a31);}(_0x90b1,0x1bb));var _0x190b=function(_0x104857,_0x34844c){_0x104857=_0x104857-0x0;var _0x5c7d6d=_0x90b1[_0x104857];return _0x5c7d6d;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['calldate']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]},{'name':_0x190b('0xd'),'fields':[_0x190b('0xd')]},{'name':_0x190b('0xe'),'fields':[_0x190b('0xe')]},{'name':_0x190b('0xf'),'fields':[_0x190b('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ee2d7ec..22975e7 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 _0x5adc=['code','Cdr,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4576f2,_0x242283){var _0x323dc2=function(_0x514b3a){while(--_0x514b3a){_0x4576f2['push'](_0x4576f2['shift']());}};_0x323dc2(++_0x242283);}(_0x5adc,0xf6));var _0xc5ad=function(_0x26ddb6,_0x5d5923){_0x26ddb6=_0x26ddb6-0x0;var _0x56b3af=_0x5adc[_0x26ddb6];return _0x56b3af;};'use strict';var _=require(_0xc5ad('0x0'));var util=require('util');var moment=require(_0xc5ad('0x1'));var BPromise=require(_0xc5ad('0x2'));var rs=require(_0xc5ad('0x3'));var fs=require('fs');var Redis=require(_0xc5ad('0x4'));var db=require(_0xc5ad('0x5'))['db'];var utils=require(_0xc5ad('0x6'));var logger=require('../../config/logger')(_0xc5ad('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5ad('0x8'));var client=jayson[_0xc5ad('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x166cbf,_0x464770,_0x5d1e5f){return new BPromise(function(_0x412f02,_0x39b123){return client[_0xc5ad('0xa')](_0x166cbf,_0x5d1e5f)[_0xc5ad('0xb')](function(_0x5ef0ec){logger[_0xc5ad('0xc')]('Cdr,\x20%s,\x20%s',_0x464770,_0xc5ad('0xd'));logger[_0xc5ad('0xe')](_0xc5ad('0xf'),_0x464770,_0xc5ad('0xd'),JSON[_0xc5ad('0x10')](_0x5ef0ec));if(_0x5ef0ec[_0xc5ad('0x11')]){if(_0x5ef0ec[_0xc5ad('0x11')][_0xc5ad('0x12')]===0x1f4){logger['error'](_0xc5ad('0x13'),_0x464770,_0x5ef0ec[_0xc5ad('0x11')][_0xc5ad('0x14')]);return _0x39b123(_0x5ef0ec['error'][_0xc5ad('0x14')]);}logger[_0xc5ad('0x11')](_0xc5ad('0x13'),_0x464770,_0x5ef0ec['error'][_0xc5ad('0x14')]);return _0x412f02(_0x5ef0ec['error']['message']);}else{logger[_0xc5ad('0xc')]('Cdr,\x20%s,\x20%s',_0x464770,_0xc5ad('0xd'));_0x412f02(_0x5ef0ec['result'][_0xc5ad('0x14')]);}})[_0xc5ad('0x15')](function(_0x1ae2f7){logger['error'](_0xc5ad('0x13'),_0x464770,_0x1ae2f7);_0x39b123(_0x1ae2f7);});});} \ No newline at end of file +var _0x5e27=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x192e10,_0x84b84a){var _0x3996c9=function(_0x50249d){while(--_0x50249d){_0x192e10['push'](_0x192e10['shift']());}};_0x3996c9(++_0x84b84a);}(_0x5e27,0x18c));var _0x75e2=function(_0x2deac6,_0x3e3943){_0x2deac6=_0x2deac6-0x0;var _0x2e3768=_0x5e27[_0x2deac6];return _0x2e3768;};'use strict';var _=require(_0x75e2('0x0'));var util=require('util');var moment=require(_0x75e2('0x1'));var BPromise=require(_0x75e2('0x2'));var rs=require(_0x75e2('0x3'));var fs=require('fs');var Redis=require(_0x75e2('0x4'));var db=require(_0x75e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x75e2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x75e2('0x7'));var client=jayson[_0x75e2('0x8')][_0x75e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x204460,_0x9dccf0,_0x754b84){return new BPromise(function(_0x450a0d,_0x3a3fdf){return client['request'](_0x204460,_0x754b84)[_0x75e2('0xa')](function(_0x1025ab){logger[_0x75e2('0xb')](_0x75e2('0xc'),_0x9dccf0,_0x75e2('0xd'));logger[_0x75e2('0xe')](_0x75e2('0xf'),_0x9dccf0,_0x75e2('0xd'),JSON[_0x75e2('0x10')](_0x1025ab));if(_0x1025ab[_0x75e2('0x11')]){if(_0x1025ab[_0x75e2('0x11')][_0x75e2('0x12')]===0x1f4){logger[_0x75e2('0x11')]('Cdr,\x20%s,\x20%s',_0x9dccf0,_0x1025ab[_0x75e2('0x11')]['message']);return _0x3a3fdf(_0x1025ab['error'][_0x75e2('0x13')]);}logger[_0x75e2('0x11')](_0x75e2('0xc'),_0x9dccf0,_0x1025ab['error'][_0x75e2('0x13')]);return _0x450a0d(_0x1025ab['error'][_0x75e2('0x13')]);}else{logger[_0x75e2('0xb')](_0x75e2('0xc'),_0x9dccf0,_0x75e2('0xd'));_0x450a0d(_0x1025ab[_0x75e2('0x14')][_0x75e2('0x13')]);}})[_0x75e2('0x15')](function(_0xad15ff){logger['error'](_0x75e2('0xc'),_0x9dccf0,_0xad15ff);_0x3a3fdf(_0xad15ff);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 962e012..0bef82f 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 _0xb524=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','/describe','describe','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xb524,0x1a0));var _0x4b52=function(_0x1a44e6,_0x54cb97){_0x1a44e6=_0x1a44e6-0x0;var _0x171132=_0xb524[_0x1a44e6];return _0x171132;};'use strict';var multer=require(_0x4b52('0x0'));var util=require(_0x4b52('0x1'));var path=require('path');var timeout=require(_0x4b52('0x2'));var express=require('express');var router=express[_0x4b52('0x3')]();var auth=require(_0x4b52('0x4'));var interaction=require(_0x4b52('0x5'));var config=require('../../config/environment');var controller=require(_0x4b52('0x6'));router[_0x4b52('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4b52('0x8'),auth['isAuthenticated'](),controller[_0x4b52('0x9')]);router['get'](_0x4b52('0xa'),auth['isAuthenticated'](),controller[_0x4b52('0xb')]);router['post']('/',auth[_0x4b52('0xc')](),controller[_0x4b52('0xd')]);router[_0x4b52('0xe')](_0x4b52('0xa'),auth[_0x4b52('0xc')](),controller[_0x4b52('0xf')]);router[_0x4b52('0x10')](_0x4b52('0xa'),auth[_0x4b52('0xc')](),controller[_0x4b52('0x11')]);module[_0x4b52('0x12')]=router; \ No newline at end of file +var _0xe230=['/describe','describe','/:id','create','put','update','exports','multer','util','path','express','../../components/auth/service','./cdr.controller','get','isAuthenticated'];(function(_0x52f205,_0x535aed){var _0x4c9858=function(_0x4872b5){while(--_0x4872b5){_0x52f205['push'](_0x52f205['shift']());}};_0x4c9858(++_0x535aed);}(_0xe230,0xe8));var _0x0e23=function(_0x5018d1,_0x27d1c5){_0x5018d1=_0x5018d1-0x0;var _0x51df17=_0xe230[_0x5018d1];return _0x51df17;};'use strict';var multer=require(_0x0e23('0x0'));var util=require(_0x0e23('0x1'));var path=require(_0x0e23('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e23('0x3'));var router=express['Router']();var auth=require(_0x0e23('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0e23('0x5'));router[_0x0e23('0x6')]('/',auth[_0x0e23('0x7')](),controller['index']);router[_0x0e23('0x6')](_0x0e23('0x8'),auth[_0x0e23('0x7')](),controller[_0x0e23('0x9')]);router[_0x0e23('0x6')](_0x0e23('0xa'),auth[_0x0e23('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0e23('0xb')]);router[_0x0e23('0xc')]('/:id',auth[_0x0e23('0x7')](),controller[_0x0e23('0xd')]);router['delete'](_0x0e23('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x0e23('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 652f9f3..2a3c954 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 _0x18c2=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x10825e,_0x16d509){var _0x60a79d=function(_0x149eb4){while(--_0x149eb4){_0x10825e['push'](_0x10825e['shift']());}};_0x60a79d(++_0x16d509);}(_0x18c2,0x1cd));var _0x218c=function(_0x88e69f,_0x231f9d){_0x88e69f=_0x88e69f-0x0;var _0x3840cd=_0x18c2[_0x88e69f];return _0x3840cd;};'use strict';var Sequelize=require(_0x218c('0x0'));module[_0x218c('0x1')]={'priority':{'type':Sequelize[_0x218c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x218c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x218c('0x4')]()},'description':{'type':Sequelize[_0x218c('0x3')]},'interval':{'type':Sequelize[_0x218c('0x3')],'defaultValue':_0x218c('0x5')}}; \ No newline at end of file +var _0xc78f=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x1f70e6,_0x3de5b1){var _0xe43b01=function(_0x462771){while(--_0x462771){_0x1f70e6['push'](_0x1f70e6['shift']());}};_0xe43b01(++_0x3de5b1);}(_0xc78f,0x100));var _0xfc78=function(_0x3d6450,_0x3ae278){_0x3d6450=_0x3d6450-0x0;var _0x53fc75=_0xc78f[_0x3d6450];return _0x53fc75;};'use strict';var Sequelize=require(_0xfc78('0x0'));module[_0xfc78('0x1')]={'priority':{'type':Sequelize[_0xfc78('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfc78('0x3')],'allowNull':![],'defaultValue':_0xfc78('0x4')},'appdata':{'type':Sequelize[_0xfc78('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfc78('0x3')],'defaultValue':_0xfc78('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ac476fb..312bd60 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 _0x241c=['save','update','then','destroy','status','error','name','send','show','params','model','rawAttributes','intersection','attributes','query','fields','length','includeAll','include','merge','options','ChatApplication','catch','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range'];(function(_0x36d05c,_0x1cb82f){var _0x35773c=function(_0x56f0bb){while(--_0x56f0bb){_0x36d05c['push'](_0x36d05c['shift']());}};_0x35773c(++_0x1cb82f);}(_0x241c,0x145));var _0xc241=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x241c[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xc241('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc241('0x1'));var zipdir=require(_0xc241('0x2'));var jsonpatch=require(_0xc241('0x3'));var rp=require(_0xc241('0x4'));var moment=require(_0xc241('0x5'));var BPromise=require(_0xc241('0x6'));var Mustache=require('mustache');var util=require(_0xc241('0x7'));var path=require(_0xc241('0x8'));var sox=require('sox');var csv=require(_0xc241('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc241('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc241('0xb'));var deskjs=require(_0xc241('0xc'));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(_0xc241('0xd'));var as=require(_0xc241('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc241('0xf'))(_0xc241('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc241('0x11'))['db'];function respondWithStatusCode(_0x50f5f8,_0x3ecedf){_0x3ecedf=_0x3ecedf||0xcc;return function(_0x5e7dad){if(_0x5e7dad){return _0x50f5f8[_0xc241('0x12')](_0x3ecedf);}return _0x50f5f8['status'](_0x3ecedf)[_0xc241('0x13')]();};}function respondWithResult(_0x250140,_0x440d91){_0x440d91=_0x440d91||0xc8;return function(_0x4bedb8){if(_0x4bedb8){return _0x250140['status'](_0x440d91)[_0xc241('0x14')](_0x4bedb8);}};}function respondWithFilteredResult(_0x29a6c9,_0x2e115c){return function(_0x4e2663){if(_0x4e2663){var _0x527148=_0x4e2663['count'],_0xb18735=_0x2e115c[_0xc241('0x15')],_0x4db473=_0x2e115c[_0xc241('0x15')]+_0x2e115c[_0xc241('0x16')],_0x171c1f;if(_0x4db473>=_0x527148){_0x4db473=_0x527148;_0x171c1f=0xc8;}else{_0x171c1f=0xce;}_0x29a6c9['status'](_0x171c1f);return _0x29a6c9[_0xc241('0x17')](_0xc241('0x18'),_0xb18735+'-'+_0x4db473+'/'+_0x527148)[_0xc241('0x14')](_0x4e2663);}return null;};}function patchUpdates(_0x14fea5){return function(_0x222d99){try{jsonpatch['apply'](_0x222d99,_0x14fea5,!![]);}catch(_0xf7ea7b){return BPromise['reject'](_0xf7ea7b);}return _0x222d99[_0xc241('0x19')]();};}function saveUpdates(_0x15ad2b,_0x40a977){return function(_0x37fd23){if(_0x37fd23){return _0x37fd23[_0xc241('0x1a')](_0x15ad2b)[_0xc241('0x1b')](function(_0x262b9f){return _0x262b9f;});}return null;};}function removeEntity(_0x4c0e92,_0x3b133f){return function(_0x1d40b8){if(_0x1d40b8){return _0x1d40b8[_0xc241('0x1c')]()[_0xc241('0x1b')](function(){_0x4c0e92[_0xc241('0x1d')](0xcc)[_0xc241('0x13')]();});}};}function handleEntityNotFound(_0x161056,_0x4064e5){return function(_0x4a58f2){if(!_0x4a58f2){_0x161056[_0xc241('0x12')](0x194);}return _0x4a58f2;};}function handleError(_0x4eabbb,_0xefdba9){_0xefdba9=_0xefdba9||0x1f4;return function(_0x2de85b){logger[_0xc241('0x1e')](_0x2de85b['stack']);if(_0x2de85b[_0xc241('0x1f')]){delete _0x2de85b[_0xc241('0x1f')];}_0x4eabbb[_0xc241('0x1d')](_0xefdba9)[_0xc241('0x20')](_0x2de85b);};}exports[_0xc241('0x21')]=function(_0x48a896,_0x2e73a3){var _0x311100={'raw':!![],'where':{'id':_0x48a896[_0xc241('0x22')]['id']}},_0x17617c={};_0x17617c[_0xc241('0x23')]=_['keys'](db['ChatApplication'][_0xc241('0x24')]);_0x17617c['query']=_['keys'](_0x48a896['query']);_0x17617c['filters']=_[_0xc241('0x25')](_0x17617c[_0xc241('0x23')],_0x17617c['query']);_0x311100[_0xc241('0x26')]=_[_0xc241('0x25')](_0x17617c[_0xc241('0x23')],qs['fields'](_0x48a896[_0xc241('0x27')][_0xc241('0x28')]));_0x311100[_0xc241('0x26')]=_0x311100[_0xc241('0x26')][_0xc241('0x29')]?_0x311100['attributes']:_0x17617c[_0xc241('0x23')];if(_0x48a896[_0xc241('0x27')][_0xc241('0x2a')]){_0x311100[_0xc241('0x2b')]=[{'all':!![]}];}_0x311100=_[_0xc241('0x2c')]({},_0x311100,_0x48a896[_0xc241('0x2d')]);return db[_0xc241('0x2e')]['find'](_0x311100)['then'](handleEntityNotFound(_0x2e73a3,null))[_0xc241('0x1b')](respondWithResult(_0x2e73a3,null))[_0xc241('0x2f')](handleError(_0x2e73a3,null));};exports[_0xc241('0x1a')]=function(_0x1054ac,_0x37028b){if(_0x1054ac['body']['id']){delete _0x1054ac[_0xc241('0x30')]['id'];}return db[_0xc241('0x2e')][_0xc241('0x31')]({'where':{'id':_0x1054ac[_0xc241('0x22')]['id']}})[_0xc241('0x1b')](handleEntityNotFound(_0x37028b,null))[_0xc241('0x1b')](saveUpdates(_0x1054ac[_0xc241('0x30')],null))[_0xc241('0x1b')](respondWithResult(_0x37028b,null))[_0xc241('0x2f')](handleError(_0x37028b,null));};exports[_0xc241('0x1c')]=function(_0xcaf5d7,_0x5ab22f){return db['ChatApplication'][_0xc241('0x31')]({'where':{'id':_0xcaf5d7[_0xc241('0x22')]['id']}})[_0xc241('0x1b')](handleEntityNotFound(_0x5ab22f,null))[_0xc241('0x1b')](removeEntity(_0x5ab22f,null))[_0xc241('0x2f')](handleError(_0x5ab22f,null));}; \ No newline at end of file +var _0xefd7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','update','destroy','end','error','stack','name','send','show','params','model','ChatApplication','keys','query','filters','intersection','attributes','fields','include','merge','options','find','then','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x1a783e,_0x22c1f2){var _0x56376d=function(_0x27c23f){while(--_0x27c23f){_0x1a783e['push'](_0x1a783e['shift']());}};_0x56376d(++_0x22c1f2);}(_0xefd7,0x99));var _0x7efd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefd7[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7efd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7efd('0x1'));var zipdir=require(_0x7efd('0x2'));var jsonpatch=require(_0x7efd('0x3'));var rp=require('request-promise');var moment=require(_0x7efd('0x4'));var BPromise=require(_0x7efd('0x5'));var Mustache=require(_0x7efd('0x6'));var util=require(_0x7efd('0x7'));var path=require('path');var sox=require(_0x7efd('0x8'));var csv=require(_0x7efd('0x9'));var ejs=require(_0x7efd('0xa'));var fs=require('fs');var _=require(_0x7efd('0xb'));var squel=require(_0x7efd('0xc'));var crypto=require(_0x7efd('0xd'));var jsforce=require(_0x7efd('0xe'));var deskjs=require(_0x7efd('0xf'));var toCsv=require(_0x7efd('0x9'));var querystring=require('querystring');var Papa=require(_0x7efd('0x10'));var Redis=require(_0x7efd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7efd('0x12'));var as=require(_0x7efd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7efd('0x14'))(_0x7efd('0x15'));var utils=require('../../config/utils');var config=require(_0x7efd('0x16'));var licenseUtil=require(_0x7efd('0x17'));var db=require(_0x7efd('0x18'))['db'];function respondWithStatusCode(_0x57269e,_0x5e017c){_0x5e017c=_0x5e017c||0xcc;return function(_0x424da9){if(_0x424da9){return _0x57269e[_0x7efd('0x19')](_0x5e017c);}return _0x57269e[_0x7efd('0x1a')](_0x5e017c)['end']();};}function respondWithResult(_0x17c1f4,_0x37e9f2){_0x37e9f2=_0x37e9f2||0xc8;return function(_0x237323){if(_0x237323){return _0x17c1f4['status'](_0x37e9f2)[_0x7efd('0x1b')](_0x237323);}};}function respondWithFilteredResult(_0x143cb2,_0x5280a2){return function(_0x196674){if(_0x196674){var _0x5affe3=_0x196674['count'],_0x34d13f=_0x5280a2[_0x7efd('0x1c')],_0x112555=_0x5280a2[_0x7efd('0x1c')]+_0x5280a2[_0x7efd('0x1d')],_0x1e6344;if(_0x112555>=_0x5affe3){_0x112555=_0x5affe3;_0x1e6344=0xc8;}else{_0x1e6344=0xce;}_0x143cb2[_0x7efd('0x1a')](_0x1e6344);return _0x143cb2['set']('Content-Range',_0x34d13f+'-'+_0x112555+'/'+_0x5affe3)[_0x7efd('0x1b')](_0x196674);}return null;};}function patchUpdates(_0x59ecda){return function(_0x58c994){try{jsonpatch[_0x7efd('0x1e')](_0x58c994,_0x59ecda,!![]);}catch(_0x176600){return BPromise[_0x7efd('0x1f')](_0x176600);}return _0x58c994[_0x7efd('0x20')]();};}function saveUpdates(_0x5db31e,_0x4330dc){return function(_0x298374){if(_0x298374){return _0x298374[_0x7efd('0x21')](_0x5db31e)['then'](function(_0xaa80d5){return _0xaa80d5;});}return null;};}function removeEntity(_0x45cc61,_0xbdd9f8){return function(_0x230714){if(_0x230714){return _0x230714[_0x7efd('0x22')]()['then'](function(){_0x45cc61[_0x7efd('0x1a')](0xcc)[_0x7efd('0x23')]();});}};}function handleEntityNotFound(_0x127c86,_0x35bdb6){return function(_0xf40c96){if(!_0xf40c96){_0x127c86[_0x7efd('0x19')](0x194);}return _0xf40c96;};}function handleError(_0x3e3b74,_0x2a8088){_0x2a8088=_0x2a8088||0x1f4;return function(_0x4e604a){logger[_0x7efd('0x24')](_0x4e604a[_0x7efd('0x25')]);if(_0x4e604a[_0x7efd('0x26')]){delete _0x4e604a['name'];}_0x3e3b74[_0x7efd('0x1a')](_0x2a8088)[_0x7efd('0x27')](_0x4e604a);};}exports[_0x7efd('0x28')]=function(_0x500b6e,_0x433588){var _0x563b1f={'raw':!![],'where':{'id':_0x500b6e[_0x7efd('0x29')]['id']}},_0x3a07b6={};_0x3a07b6[_0x7efd('0x2a')]=_['keys'](db[_0x7efd('0x2b')]['rawAttributes']);_0x3a07b6['query']=_[_0x7efd('0x2c')](_0x500b6e[_0x7efd('0x2d')]);_0x3a07b6[_0x7efd('0x2e')]=_[_0x7efd('0x2f')](_0x3a07b6[_0x7efd('0x2a')],_0x3a07b6[_0x7efd('0x2d')]);_0x563b1f[_0x7efd('0x30')]=_[_0x7efd('0x2f')](_0x3a07b6[_0x7efd('0x2a')],qs[_0x7efd('0x31')](_0x500b6e['query'][_0x7efd('0x31')]));_0x563b1f[_0x7efd('0x30')]=_0x563b1f[_0x7efd('0x30')]['length']?_0x563b1f['attributes']:_0x3a07b6['model'];if(_0x500b6e[_0x7efd('0x2d')]['includeAll']){_0x563b1f[_0x7efd('0x32')]=[{'all':!![]}];}_0x563b1f=_[_0x7efd('0x33')]({},_0x563b1f,_0x500b6e[_0x7efd('0x34')]);return db[_0x7efd('0x2b')][_0x7efd('0x35')](_0x563b1f)[_0x7efd('0x36')](handleEntityNotFound(_0x433588,null))['then'](respondWithResult(_0x433588,null))[_0x7efd('0x37')](handleError(_0x433588,null));};exports['update']=function(_0x440a24,_0x2ecc77){if(_0x440a24['body']['id']){delete _0x440a24['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x440a24[_0x7efd('0x29')]['id']}})['then'](handleEntityNotFound(_0x2ecc77,null))['then'](saveUpdates(_0x440a24[_0x7efd('0x38')],null))[_0x7efd('0x36')](respondWithResult(_0x2ecc77,null))[_0x7efd('0x37')](handleError(_0x2ecc77,null));};exports['destroy']=function(_0x24f5ff,_0x1d1c9a){return db[_0x7efd('0x2b')][_0x7efd('0x35')]({'where':{'id':_0x24f5ff[_0x7efd('0x29')]['id']}})[_0x7efd('0x36')](handleEntityNotFound(_0x1d1c9a,null))[_0x7efd('0x36')](removeEntity(_0x1d1c9a,null))[_0x7efd('0x37')](handleError(_0x1d1c9a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 12d19f3..f47b264 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 8ed0451..dbff76d 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 _0x9040=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1b2d4d,_0x595487){var _0xd8aeab=function(_0x19f2df){while(--_0x19f2df){_0x1b2d4d['push'](_0x1b2d4d['shift']());}};_0xd8aeab(++_0x595487);}(_0x9040,0xe2));var _0x0904=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9040[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x0904('0x0'));var util=require(_0x0904('0x1'));var moment=require('moment');var BPromise=require(_0x0904('0x2'));var rs=require(_0x0904('0x3'));var fs=require('fs');var Redis=require(_0x0904('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0904('0x5'));var logger=require('../../config/logger')(_0x0904('0x6'));var config=require(_0x0904('0x7'));var jayson=require(_0x0904('0x8'));var client=jayson[_0x0904('0x9')][_0x0904('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x170b5e,_0x42656e,_0x5f45fe){return new BPromise(function(_0x2569ec,_0x544332){return client[_0x0904('0xb')](_0x170b5e,_0x5f45fe)['then'](function(_0x2c4ffc){logger[_0x0904('0xc')](_0x0904('0xd'),_0x42656e,_0x0904('0xe'));logger['debug'](_0x0904('0xf'),_0x42656e,_0x0904('0xe'),JSON[_0x0904('0x10')](_0x2c4ffc));if(_0x2c4ffc[_0x0904('0x11')]){if(_0x2c4ffc[_0x0904('0x11')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x42656e,_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);return _0x544332(_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);}logger[_0x0904('0x11')](_0x0904('0xd'),_0x42656e,_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);return _0x2569ec(_0x2c4ffc[_0x0904('0x11')][_0x0904('0x12')]);}else{logger['info'](_0x0904('0xd'),_0x42656e,_0x0904('0xe'));_0x2569ec(_0x2c4ffc[_0x0904('0x13')][_0x0904('0x12')]);}})[_0x0904('0x14')](function(_0x39bcf4){logger['error'](_0x0904('0xd'),_0x42656e,_0x39bcf4);_0x544332(_0x39bcf4);});});} \ No newline at end of file +var _0x6a02=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x280a2e,_0x244c6f){var _0x286f67=function(_0xe4620b){while(--_0xe4620b){_0x280a2e['push'](_0x280a2e['shift']());}};_0x286f67(++_0x244c6f);}(_0x6a02,0x6e));var _0x26a0=function(_0x4a602b,_0x27c754){_0x4a602b=_0x4a602b-0x0;var _0x499b98=_0x6a02[_0x4a602b];return _0x499b98;};'use strict';var _=require(_0x26a0('0x0'));var util=require(_0x26a0('0x1'));var moment=require(_0x26a0('0x2'));var BPromise=require(_0x26a0('0x3'));var rs=require(_0x26a0('0x4'));var fs=require('fs');var Redis=require(_0x26a0('0x5'));var db=require(_0x26a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x26a0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x26a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb194f2,_0xc3f075,_0x568bc4){return new BPromise(function(_0x442d1c,_0x250a34){return client[_0x26a0('0x9')](_0xb194f2,_0x568bc4)[_0x26a0('0xa')](function(_0x522554){logger[_0x26a0('0xb')](_0x26a0('0xc'),_0xc3f075,_0x26a0('0xd'));logger[_0x26a0('0xe')](_0x26a0('0xf'),_0xc3f075,_0x26a0('0xd'),JSON[_0x26a0('0x10')](_0x522554));if(_0x522554[_0x26a0('0x11')]){if(_0x522554[_0x26a0('0x11')][_0x26a0('0x12')]===0x1f4){logger['error'](_0x26a0('0xc'),_0xc3f075,_0x522554[_0x26a0('0x11')][_0x26a0('0x13')]);return _0x250a34(_0x522554[_0x26a0('0x11')][_0x26a0('0x13')]);}logger[_0x26a0('0x11')]('ChatApplication,\x20%s,\x20%s',_0xc3f075,_0x522554['error'][_0x26a0('0x13')]);return _0x442d1c(_0x522554['error']['message']);}else{logger[_0x26a0('0xb')](_0x26a0('0xc'),_0xc3f075,_0x26a0('0xd'));_0x442d1c(_0x522554[_0x26a0('0x14')][_0x26a0('0x13')]);}})[_0x26a0('0x15')](function(_0x5fa976){logger[_0x26a0('0x11')](_0x26a0('0xc'),_0xc3f075,_0x5fa976);_0x250a34(_0x5fa976);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8fad71f..2da8dc5 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 _0xec35=['express','Router','../../components/auth/service','./chatApplication.controller','/:id','isAuthenticated','show','put','delete','destroy','exports','connect-timeout'];(function(_0x117d11,_0x4077f5){var _0x167b1c=function(_0x4b2181){while(--_0x4b2181){_0x117d11['push'](_0x117d11['shift']());}};_0x167b1c(++_0x4077f5);}(_0xec35,0x9b));var _0x5ec3=function(_0x439065,_0x204510){_0x439065=_0x439065-0x0;var _0x303515=_0xec35[_0x439065];return _0x303515;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5ec3('0x0'));var express=require(_0x5ec3('0x1'));var router=express[_0x5ec3('0x2')]();var auth=require(_0x5ec3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ec3('0x4'));router['get'](_0x5ec3('0x5'),auth[_0x5ec3('0x6')](),controller[_0x5ec3('0x7')]);router[_0x5ec3('0x8')]('/:id',auth[_0x5ec3('0x6')](),controller['update']);router[_0x5ec3('0x9')](_0x5ec3('0x5'),auth['isAuthenticated'](),controller[_0x5ec3('0xa')]);module[_0x5ec3('0xb')]=router; \ No newline at end of file +var _0xd0be=['express','Router','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0xc3fa48,_0x251d0e){var _0x556eb2=function(_0x3e1358){while(--_0x3e1358){_0xc3fa48['push'](_0xc3fa48['shift']());}};_0x556eb2(++_0x251d0e);}(_0xd0be,0x1a0));var _0xed0b=function(_0x188a1d,_0x2249fc){_0x188a1d=_0x188a1d-0x0;var _0x43d0db=_0xd0be[_0x188a1d];return _0x43d0db;};'use strict';var multer=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var path=require(_0xed0b('0x2'));var timeout=require(_0xed0b('0x3'));var express=require(_0xed0b('0x4'));var router=express[_0xed0b('0x5')]();var auth=require(_0xed0b('0x6'));var interaction=require(_0xed0b('0x7'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0xed0b('0x8'),auth[_0xed0b('0x9')](),controller[_0xed0b('0xa')]);router[_0xed0b('0xb')](_0xed0b('0x8'),auth[_0xed0b('0x9')](),controller[_0xed0b('0xc')]);router[_0xed0b('0xd')]('/:id',auth[_0xed0b('0x9')](),controller['destroy']);module[_0xed0b('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 499e8c2..74ff133 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 _0x767c=['STRING','BOOLEAN'];(function(_0xbb013f,_0x3865c6){var _0x581f60=function(_0x4abf24){while(--_0x4abf24){_0xbb013f['push'](_0xbb013f['shift']());}};_0x581f60(++_0x3865c6);}(_0x767c,0x14e));var _0xc767=function(_0x50bd21,_0xc7da51){_0x50bd21=_0x50bd21-0x0;var _0x3f4fc9=_0x767c[_0x50bd21];return _0x3f4fc9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc767('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xc767('0x0')]},'write':{'type':Sequelize[_0xc767('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x30b5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x30b5,0x17c));var _0x530b=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x30b5[_0x20b29c];return _0x20d81b;};'use strict';var Sequelize=require(_0x530b('0x0'));module[_0x530b('0x1')]={'name':{'type':Sequelize[_0x530b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x530b('0x2')]},'write':{'type':Sequelize[_0x530b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4175c93..dd1432b 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 _0xc7da=['options','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','status','end','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','filter','map','VIRTUAL','merge','ChatGroup','count','includeAll','include','findAll','show','params'];(function(_0xb13d17,_0x1cd499){var _0x23c99e=function(_0x309af3){while(--_0x309af3){_0xb13d17['push'](_0xb13d17['shift']());}};_0x23c99e(++_0x1cd499);}(_0xc7da,0xf2));var _0xac7d=function(_0x4593f4,_0x5e34c8){_0x4593f4=_0x4593f4-0x0;var _0x3c0948=_0xc7da[_0x4593f4];return _0x3c0948;};'use strict';var pdf=require(_0xac7d('0x0'));var emlformat=require(_0xac7d('0x1'));var rimraf=require(_0xac7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac7d('0x3'));var rp=require(_0xac7d('0x4'));var moment=require('moment');var BPromise=require(_0xac7d('0x5'));var Mustache=require(_0xac7d('0x6'));var util=require('util');var path=require(_0xac7d('0x7'));var sox=require(_0xac7d('0x8'));var csv=require(_0xac7d('0x9'));var ejs=require(_0xac7d('0xa'));var fs=require('fs');var _=require(_0xac7d('0xb'));var squel=require(_0xac7d('0xc'));var crypto=require('crypto');var jsforce=require(_0xac7d('0xd'));var deskjs=require(_0xac7d('0xe'));var toCsv=require(_0xac7d('0x9'));var querystring=require(_0xac7d('0xf'));var Papa=require(_0xac7d('0x10'));var Redis=require(_0xac7d('0x11'));var authService=require(_0xac7d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac7d('0x13'));var hardwareService=require(_0xac7d('0x14'));var logger=require(_0xac7d('0x15'))('api');var utils=require(_0xac7d('0x16'));var config=require(_0xac7d('0x17'));var licenseUtil=require(_0xac7d('0x18'));var db=require(_0xac7d('0x19'))['db'];config['redis']=_[_0xac7d('0x1a')](config[_0xac7d('0x1b')],{'host':_0xac7d('0x1c'),'port':0x18eb});var socket=require(_0xac7d('0x1d'))(new Redis(config[_0xac7d('0x1b')]));require('./chatGroup.socket')[_0xac7d('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xac7d('0x1f')][_0xac7d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x34980f,_0x355209,_0x533bac,_0x19e7ba){return new BPromise(function(_0x4283dd,_0x27ed38){var _0x12813a=_0x19e7ba||client;return _0x12813a[_0xac7d('0x21')](_0x34980f,_0x533bac)['then'](function(_0x7df8e0){logger[_0xac7d('0x22')]('ChatGroup,\x20%s,\x20%s',_0x355209,_0xac7d('0x23'));logger[_0xac7d('0x24')](_0xac7d('0x25'),_0x355209,_0xac7d('0x23'),JSON['stringify'](_0x7df8e0));if(_0x7df8e0[_0xac7d('0x26')]){if(_0x7df8e0[_0xac7d('0x26')][_0xac7d('0x27')]===0x1f4){logger['error'](_0xac7d('0x28'),_0x355209,_0x7df8e0['error'][_0xac7d('0x29')]);return _0x27ed38(_0x7df8e0[_0xac7d('0x26')][_0xac7d('0x29')]);}logger[_0xac7d('0x26')](_0xac7d('0x28'),_0x355209,_0x7df8e0[_0xac7d('0x26')]['message']);return _0x4283dd(_0x7df8e0['error'][_0xac7d('0x29')]);}else{logger[_0xac7d('0x22')]('ChatGroup,\x20%s,\x20%s',_0x355209,_0xac7d('0x23'));_0x4283dd(_0x7df8e0[_0xac7d('0x2a')][_0xac7d('0x29')]);}})[_0xac7d('0x2b')](function(_0x43aa8e){logger[_0xac7d('0x26')](_0xac7d('0x28'),_0x355209,_0x43aa8e);_0x27ed38(_0x43aa8e);});});}function respondWithStatusCode(_0x3bb7dd,_0x42e313){_0x42e313=_0x42e313||0xcc;return function(_0x26a8c4){if(_0x26a8c4){return _0x3bb7dd['sendStatus'](_0x42e313);}return _0x3bb7dd[_0xac7d('0x2c')](_0x42e313)[_0xac7d('0x2d')]();};}function respondWithResult(_0x31e220,_0x1bcfd5){_0x1bcfd5=_0x1bcfd5||0xc8;return function(_0x4cc590){if(_0x4cc590){return _0x31e220['status'](_0x1bcfd5)['json'](_0x4cc590);}};}function respondWithFilteredResult(_0xc30df3,_0x32b12c){return function(_0xac3f87){if(_0xac3f87){var _0x5bd39b=_0xac3f87['count'],_0x51df23=_0x32b12c['offset'],_0x506b88=_0x32b12c['offset']+_0x32b12c[_0xac7d('0x2e')],_0x4e2456;if(_0x506b88>=_0x5bd39b){_0x506b88=_0x5bd39b;_0x4e2456=0xc8;}else{_0x4e2456=0xce;}_0xc30df3[_0xac7d('0x2c')](_0x4e2456);return _0xc30df3[_0xac7d('0x2f')](_0xac7d('0x30'),_0x51df23+'-'+_0x506b88+'/'+_0x5bd39b)[_0xac7d('0x31')](_0xac3f87);}return null;};}function patchUpdates(_0x5c3c15){return function(_0x4ce2ed){try{jsonpatch[_0xac7d('0x32')](_0x4ce2ed,_0x5c3c15,!![]);}catch(_0xfbfbf7){return BPromise[_0xac7d('0x33')](_0xfbfbf7);}return _0x4ce2ed[_0xac7d('0x34')]();};}function saveUpdates(_0x39dc77,_0x500161){return function(_0x3ba58d){if(_0x3ba58d){return _0x3ba58d[_0xac7d('0x35')](_0x39dc77)[_0xac7d('0x36')](function(_0x96e66b){return _0x96e66b;});}return null;};}function removeEntity(_0x41c60a,_0x2e10f7){return function(_0x29163c){if(_0x29163c){return _0x29163c[_0xac7d('0x37')]()[_0xac7d('0x36')](function(){_0x41c60a[_0xac7d('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2237be,_0x1835d2){return function(_0x64724b){if(!_0x64724b){_0x2237be[_0xac7d('0x38')](0x194);}return _0x64724b;};}function handleError(_0x204717,_0x5690e4){_0x5690e4=_0x5690e4||0x1f4;return function(_0x2bfc9e){logger['error'](_0x2bfc9e['stack']);if(_0x2bfc9e[_0xac7d('0x39')]){delete _0x2bfc9e[_0xac7d('0x39')];}_0x204717[_0xac7d('0x2c')](_0x5690e4)[_0xac7d('0x3a')](_0x2bfc9e);};}exports[_0xac7d('0x3b')]=function(_0x24cdfb,_0x330fb0){var _0x1e48df={},_0x105bac={},_0x3a0bc2={'count':0x0,'rows':[]};var _0x1c5df3=_['map'](db['ChatGroup'][_0xac7d('0x3c')],function(_0x586b63){return{'name':_0x586b63[_0xac7d('0x3d')],'type':_0x586b63[_0xac7d('0x3e')][_0xac7d('0x3f')]};});_0x105bac[_0xac7d('0x40')]=_['map'](_0x1c5df3,'name');_0x105bac[_0xac7d('0x41')]=_[_0xac7d('0x42')](_0x24cdfb[_0xac7d('0x41')]);_0x105bac[_0xac7d('0x43')]=_[_0xac7d('0x44')](_0x105bac['model'],_0x105bac['query']);_0x1e48df[_0xac7d('0x45')]=_['intersection'](_0x105bac[_0xac7d('0x40')],qs[_0xac7d('0x46')](_0x24cdfb[_0xac7d('0x41')]['fields']));_0x1e48df[_0xac7d('0x45')]=_0x1e48df[_0xac7d('0x45')][_0xac7d('0x47')]?_0x1e48df[_0xac7d('0x45')]:_0x105bac[_0xac7d('0x40')];if(!_0x24cdfb[_0xac7d('0x41')]['hasOwnProperty']('nolimit')){_0x1e48df[_0xac7d('0x2e')]=qs[_0xac7d('0x2e')](_0x24cdfb['query'][_0xac7d('0x2e')]);_0x1e48df[_0xac7d('0x48')]=qs[_0xac7d('0x48')](_0x24cdfb['query']['offset']);}_0x1e48df[_0xac7d('0x49')]=qs['sort'](_0x24cdfb[_0xac7d('0x41')][_0xac7d('0x4a')]);_0x1e48df[_0xac7d('0x4b')]=qs[_0xac7d('0x43')](_[_0xac7d('0x4c')](_0x24cdfb[_0xac7d('0x41')],_0x105bac[_0xac7d('0x43')]),_0x1c5df3);if(_0x24cdfb[_0xac7d('0x41')][_0xac7d('0x4d')]){_0x1e48df[_0xac7d('0x4b')]=_['merge'](_0x1e48df[_0xac7d('0x4b')],{'$or':_[_0xac7d('0x4e')](_0x1c5df3,function(_0x37dca1){if(_0x37dca1[_0xac7d('0x3e')]!==_0xac7d('0x4f')){var _0x4092d1={};_0x4092d1[_0x37dca1[_0xac7d('0x39')]]={'$like':'%'+_0x24cdfb['query'][_0xac7d('0x4d')]+'%'};return _0x4092d1;}})});}_0x1e48df=_[_0xac7d('0x50')]({},_0x1e48df,_0x24cdfb['options']);var _0x1905c5={'where':_0x1e48df[_0xac7d('0x4b')]};return db[_0xac7d('0x51')][_0xac7d('0x52')](_0x1905c5)[_0xac7d('0x36')](function(_0x40abbb){_0x3a0bc2[_0xac7d('0x52')]=_0x40abbb;if(_0x24cdfb['query'][_0xac7d('0x53')]){_0x1e48df[_0xac7d('0x54')]=[{'all':!![]}];}return db['ChatGroup'][_0xac7d('0x55')](_0x1e48df);})[_0xac7d('0x36')](function(_0x3f3e3d){_0x3a0bc2['rows']=_0x3f3e3d;return _0x3a0bc2;})[_0xac7d('0x36')](respondWithFilteredResult(_0x330fb0,_0x1e48df))[_0xac7d('0x2b')](handleError(_0x330fb0,null));};exports[_0xac7d('0x56')]=function(_0x302794,_0x57e0c2){var _0x2cf14d={'raw':!![],'where':{'id':_0x302794[_0xac7d('0x57')]['id']}},_0x14901d={};_0x14901d[_0xac7d('0x40')]=_[_0xac7d('0x42')](db['ChatGroup']['rawAttributes']);_0x14901d[_0xac7d('0x41')]=_[_0xac7d('0x42')](_0x302794[_0xac7d('0x41')]);_0x14901d['filters']=_[_0xac7d('0x44')](_0x14901d['model'],_0x14901d[_0xac7d('0x41')]);_0x2cf14d[_0xac7d('0x45')]=_[_0xac7d('0x44')](_0x14901d[_0xac7d('0x40')],qs[_0xac7d('0x46')](_0x302794[_0xac7d('0x41')]['fields']));_0x2cf14d[_0xac7d('0x45')]=_0x2cf14d[_0xac7d('0x45')][_0xac7d('0x47')]?_0x2cf14d[_0xac7d('0x45')]:_0x14901d[_0xac7d('0x40')];if(_0x302794[_0xac7d('0x41')][_0xac7d('0x53')]){_0x2cf14d[_0xac7d('0x54')]=[{'all':!![]}];}_0x2cf14d=_[_0xac7d('0x50')]({},_0x2cf14d,_0x302794[_0xac7d('0x58')]);return db[_0xac7d('0x51')][_0xac7d('0x59')](_0x2cf14d)[_0xac7d('0x36')](handleEntityNotFound(_0x57e0c2,null))[_0xac7d('0x36')](respondWithResult(_0x57e0c2,null))[_0xac7d('0x2b')](handleError(_0x57e0c2,null));};exports[_0xac7d('0x5a')]=function(_0xda0b68,_0x4c5e10){return db[_0xac7d('0x51')][_0xac7d('0x5a')](_0xda0b68[_0xac7d('0x5b')],{})[_0xac7d('0x36')](respondWithResult(_0x4c5e10,0xc9))[_0xac7d('0x2b')](handleError(_0x4c5e10,null));};exports[_0xac7d('0x35')]=function(_0x5e9fa4,_0x5625f9){if(_0x5e9fa4[_0xac7d('0x5b')]['id']){delete _0x5e9fa4[_0xac7d('0x5b')]['id'];}return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x5e9fa4['params']['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x5625f9,null))[_0xac7d('0x36')](saveUpdates(_0x5e9fa4[_0xac7d('0x5b')],null))[_0xac7d('0x36')](respondWithResult(_0x5625f9,null))[_0xac7d('0x2b')](handleError(_0x5625f9,null));};exports['destroy']=function(_0x28329b,_0x36d8bd){return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x28329b['params']['id']}})['then'](handleEntityNotFound(_0x36d8bd,null))[_0xac7d('0x36')](removeEntity(_0x36d8bd,null))[_0xac7d('0x2b')](handleError(_0x36d8bd,null));};exports[_0xac7d('0x5c')]=function(_0x29fc2c,_0x430260){return db[_0xac7d('0x51')][_0xac7d('0x5c')]()[_0xac7d('0x36')](respondWithResult(_0x430260,null))[_0xac7d('0x2b')](handleError(_0x430260,null));};exports['getUnread']=function(_0x3fedfc,_0x26617a,_0x7a9823){return db[_0xac7d('0x5d')]['count']({'where':{'ChatGroupId':_0x3fedfc[_0xac7d('0x57')]['id'],'ToId':_0x3fedfc[_0xac7d('0x5e')]['id'],'read':![]}})[_0xac7d('0x36')](function(_0x45097a){return{'id':_[_0xac7d('0x5f')](_0x3fedfc['params']['id']),'count':_0x45097a};})[_0xac7d('0x36')](respondWithResult(_0x26617a,null))[_0xac7d('0x2b')](handleError(_0x26617a,null));};exports[_0xac7d('0x60')]=function(_0x13dc6b,_0x336cb2,_0x1b2c24){return db[_0xac7d('0x51')]['find']({'where':{'id':_0x13dc6b[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x336cb2,null))[_0xac7d('0x36')](function(_0x3b670d){if(_0x3b670d){return _0x3b670d[_0xac7d('0x60')](_0x13dc6b[_0xac7d('0x5b')][_0xac7d('0x61')],_[_0xac7d('0x62')](_0x13dc6b[_0xac7d('0x5b')],[_0xac7d('0x61'),'id'])||{});}})[_0xac7d('0x36')](respondWithResult(_0x336cb2,null))[_0xac7d('0x2b')](handleError(_0x336cb2,null));};exports[_0xac7d('0x63')]=function(_0x5b8458,_0x2a6904,_0x388a95){var _0x7b4c80={};var _0x5823fa={};var _0xb0118a;var _0x4d8265;return db['ChatGroup'][_0xac7d('0x64')]({'where':{'id':_0x5b8458[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x2a6904,null))[_0xac7d('0x36')](function(_0x2c7f9d){if(_0x2c7f9d){_0xb0118a=_0x2c7f9d;_0x5823fa['model']=_[_0xac7d('0x42')](db['User'][_0xac7d('0x3c')]);_0x5823fa['query']=_[_0xac7d('0x42')](_0x5b8458[_0xac7d('0x41')]);_0x5823fa[_0xac7d('0x43')]=_['intersection'](_0x5823fa[_0xac7d('0x40')],_0x5823fa[_0xac7d('0x41')]);_0x7b4c80[_0xac7d('0x45')]=_[_0xac7d('0x44')](_0x5823fa['model'],qs[_0xac7d('0x46')](_0x5b8458[_0xac7d('0x41')][_0xac7d('0x46')]));_0x7b4c80['attributes']=_0x7b4c80['attributes'][_0xac7d('0x47')]?_0x7b4c80[_0xac7d('0x45')]:_0x5823fa['model'];_0x7b4c80['order']=qs[_0xac7d('0x4a')](_0x5b8458['query'][_0xac7d('0x4a')]);_0x7b4c80[_0xac7d('0x4b')]=qs[_0xac7d('0x43')](_[_0xac7d('0x4c')](_0x5b8458[_0xac7d('0x41')],_0x5823fa['filters']));if(_0x5b8458[_0xac7d('0x41')][_0xac7d('0x4d')]){_0x7b4c80['where']=_[_0xac7d('0x50')](_0x7b4c80[_0xac7d('0x4b')],{'$or':_[_0xac7d('0x4e')](_0x7b4c80['attributes'],function(_0x28e419){var _0xca2186={};_0xca2186[_0x28e419]={'$like':'%'+_0x5b8458[_0xac7d('0x41')][_0xac7d('0x4d')]+'%'};return _0xca2186;})});}_0x7b4c80=_[_0xac7d('0x50')]({},_0x7b4c80,_0x5b8458[_0xac7d('0x58')]);return _0xb0118a['getMembers'](_0x7b4c80);}})['then'](function(_0x45d0fd){if(_0x45d0fd){_0x4d8265=_0x45d0fd[_0xac7d('0x47')];if(!_0x5b8458[_0xac7d('0x41')]['hasOwnProperty'](_0xac7d('0x65'))){_0x7b4c80[_0xac7d('0x2e')]=qs[_0xac7d('0x2e')](_0x5b8458[_0xac7d('0x41')][_0xac7d('0x2e')]);_0x7b4c80[_0xac7d('0x48')]=qs[_0xac7d('0x48')](_0x5b8458[_0xac7d('0x41')][_0xac7d('0x48')]);}return _0xb0118a['getMembers'](_0x7b4c80);}})['then'](function(_0x5c61d1){if(_0x5c61d1){return _0x5c61d1?{'count':_0x4d8265,'rows':_0x5c61d1}:null;}})[_0xac7d('0x36')](respondWithResult(_0x2a6904,null))['catch'](handleError(_0x2a6904,null));};exports[_0xac7d('0x66')]=function(_0x3a660e,_0x979958,_0xc5ba36){return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x3a660e[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x979958,null))['then'](function(_0x2e5a61){if(_0x2e5a61){return _0x2e5a61[_0xac7d('0x66')](_0x3a660e['query'][_0xac7d('0x61')]);}})['then'](respondWithStatusCode(_0x979958,null))[_0xac7d('0x2b')](handleError(_0x979958,null));};exports[_0xac7d('0x67')]=function(_0x413871,_0x23555d,_0x2d766d){if(_0x413871[_0xac7d('0x5b')]['id']){delete _0x413871['body']['id'];}return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x413871[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x23555d,null))['then'](function(_0x54fa30){if(_0x54fa30){_0x413871['body'][_0xac7d('0x68')]=_0x54fa30['id'];return db['ChatInternalMessage'][_0xac7d('0x5a')](_0x413871[_0xac7d('0x5b')]);}})['then'](respondWithResult(_0x23555d,null))[_0xac7d('0x2b')](handleError(_0x23555d,null));};exports[_0xac7d('0x69')]=function(_0x834710,_0x22a3ab,_0x2bc2c8){var _0xe4c0b={};var _0x1a2b21={};var _0x17dbc1;var _0x22e406;return db[_0xac7d('0x51')][_0xac7d('0x64')]({'where':{'id':_0x834710[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x22a3ab,null))[_0xac7d('0x36')](function(_0x2cde10){if(_0x2cde10){_0x17dbc1=_0x2cde10;_0x1a2b21[_0xac7d('0x40')]=_[_0xac7d('0x42')](db[_0xac7d('0x5d')][_0xac7d('0x3c')]);_0x1a2b21['query']=_['keys'](_0x834710[_0xac7d('0x41')]);_0x1a2b21[_0xac7d('0x43')]=_[_0xac7d('0x44')](_0x1a2b21[_0xac7d('0x40')],_0x1a2b21['query']);_0xe4c0b[_0xac7d('0x45')]=_[_0xac7d('0x44')](_0x1a2b21[_0xac7d('0x40')],qs['fields'](_0x834710[_0xac7d('0x41')][_0xac7d('0x46')]));_0xe4c0b[_0xac7d('0x45')]=_0xe4c0b[_0xac7d('0x45')]['length']?_0xe4c0b[_0xac7d('0x45')]:_0x1a2b21[_0xac7d('0x40')];_0xe4c0b[_0xac7d('0x49')]=qs['sort'](_0x834710[_0xac7d('0x41')]['sort']);_0xe4c0b[_0xac7d('0x4b')]=qs[_0xac7d('0x43')](_[_0xac7d('0x4c')](_0x834710[_0xac7d('0x41')],_0x1a2b21['filters']));if(_0x834710[_0xac7d('0x41')][_0xac7d('0x4d')]){_0xe4c0b['where']=_[_0xac7d('0x50')](_0xe4c0b[_0xac7d('0x4b')],{'$or':_['map'](_0xe4c0b[_0xac7d('0x45')],function(_0x2be9ff){var _0x4efd06={};_0x4efd06[_0x2be9ff]={'$like':'%'+_0x834710['query'][_0xac7d('0x4d')]+'%'};return _0x4efd06;})});}if(_0x834710[_0xac7d('0x41')]['$gte']){var _0x3ca960=_0x834710[_0xac7d('0x41')][_0xac7d('0x6a')][_0xac7d('0x6b')](',');var _0x4d3bb9={};_0x4d3bb9[_0x3ca960[0x0]]={'$gte':moment(_0x3ca960[0x1])[_0xac7d('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};_0xe4c0b['where']=_[_0xac7d('0x50')](_0xe4c0b[_0xac7d('0x4b')],_0x4d3bb9);}_0xe4c0b=_['merge']({},_0xe4c0b,_0x834710[_0xac7d('0x58')]);return _0x17dbc1[_0xac7d('0x69')](_0xe4c0b);}})[_0xac7d('0x36')](function(_0x441022){if(_0x441022){_0x22e406=_0x441022[_0xac7d('0x47')];if(!_0x834710[_0xac7d('0x41')][_0xac7d('0x6d')](_0xac7d('0x65'))){_0xe4c0b[_0xac7d('0x2e')]=qs[_0xac7d('0x2e')](_0x834710[_0xac7d('0x41')][_0xac7d('0x2e')]);_0xe4c0b[_0xac7d('0x48')]=qs[_0xac7d('0x48')](_0x834710[_0xac7d('0x41')][_0xac7d('0x48')]);}return _0x17dbc1[_0xac7d('0x69')](_0xe4c0b);}})[_0xac7d('0x36')](function(_0x39b19d){if(_0x39b19d){return _0x39b19d?{'count':_0x22e406,'rows':_0x39b19d}:null;}})['then'](respondWithResult(_0x22a3ab,null))[_0xac7d('0x2b')](handleError(_0x22a3ab,null));}; \ No newline at end of file +var _0x81b7=['redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','stack','name','send','index','ChatGroup','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','length','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','show','params','rawAttributes','find','create','body','describe','toInteger','addMembers','ids','omit','getMembers','findOne','User','fields','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','order','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults'];(function(_0x1ff966,_0x41fbff){var _0x40cea2=function(_0xce21c4){while(--_0xce21c4){_0x1ff966['push'](_0x1ff966['shift']());}};_0x40cea2(++_0x41fbff);}(_0x81b7,0x1f2));var _0x781b=function(_0x735c57,_0x80abae){_0x735c57=_0x735c57-0x0;var _0x1203b2=_0x81b7[_0x735c57];return _0x1203b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x781b('0x0'));var rimraf=require(_0x781b('0x1'));var zipdir=require(_0x781b('0x2'));var jsonpatch=require(_0x781b('0x3'));var rp=require('request-promise');var moment=require(_0x781b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x781b('0x5'));var util=require(_0x781b('0x6'));var path=require(_0x781b('0x7'));var sox=require(_0x781b('0x8'));var csv=require('to-csv');var ejs=require(_0x781b('0x9'));var fs=require('fs');var _=require(_0x781b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x781b('0xb'));var deskjs=require(_0x781b('0xc'));var toCsv=require(_0x781b('0xd'));var querystring=require(_0x781b('0xe'));var Papa=require('papaparse');var Redis=require(_0x781b('0xf'));var authService=require(_0x781b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x781b('0x11'));var logger=require('../../config/logger')(_0x781b('0x12'));var utils=require('../../config/utils');var config=require(_0x781b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x781b('0x14'))['db'];config['redis']=_[_0x781b('0x15')](config[_0x781b('0x16')],{'host':_0x781b('0x17'),'port':0x18eb});var socket=require(_0x781b('0x18'))(new Redis(config[_0x781b('0x16')]));require('./chatGroup.socket')[_0x781b('0x19')](socket);var jayson=require(_0x781b('0x1a'));var client=jayson[_0x781b('0x1b')][_0x781b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x587d56,_0x35503a,_0x533377,_0x176e91){return new BPromise(function(_0x40a6ea,_0x1d0282){var _0x4ac48a=_0x176e91||client;return _0x4ac48a[_0x781b('0x1d')](_0x587d56,_0x533377)['then'](function(_0x544675){logger[_0x781b('0x1e')](_0x781b('0x1f'),_0x35503a,_0x781b('0x20'));logger[_0x781b('0x21')](_0x781b('0x22'),_0x35503a,'request\x20sent',JSON['stringify'](_0x544675));if(_0x544675['error']){if(_0x544675[_0x781b('0x23')][_0x781b('0x24')]===0x1f4){logger[_0x781b('0x23')](_0x781b('0x1f'),_0x35503a,_0x544675[_0x781b('0x23')][_0x781b('0x25')]);return _0x1d0282(_0x544675['error'][_0x781b('0x25')]);}logger[_0x781b('0x23')](_0x781b('0x1f'),_0x35503a,_0x544675['error'][_0x781b('0x25')]);return _0x40a6ea(_0x544675[_0x781b('0x23')][_0x781b('0x25')]);}else{logger[_0x781b('0x1e')]('ChatGroup,\x20%s,\x20%s',_0x35503a,_0x781b('0x20'));_0x40a6ea(_0x544675[_0x781b('0x26')][_0x781b('0x25')]);}})[_0x781b('0x27')](function(_0x3aba86){logger['error'](_0x781b('0x1f'),_0x35503a,_0x3aba86);_0x1d0282(_0x3aba86);});});}function respondWithStatusCode(_0x3ecd1c,_0x31795d){_0x31795d=_0x31795d||0xcc;return function(_0x22cdc0){if(_0x22cdc0){return _0x3ecd1c[_0x781b('0x28')](_0x31795d);}return _0x3ecd1c[_0x781b('0x29')](_0x31795d)['end']();};}function respondWithResult(_0x4e7037,_0x33d73d){_0x33d73d=_0x33d73d||0xc8;return function(_0x2f27a9){if(_0x2f27a9){return _0x4e7037['status'](_0x33d73d)[_0x781b('0x2a')](_0x2f27a9);}};}function respondWithFilteredResult(_0xcd8a6e,_0x1d94df){return function(_0x33561e){if(_0x33561e){var _0xbde04f=_0x33561e[_0x781b('0x2b')],_0x3d3d4c=_0x1d94df[_0x781b('0x2c')],_0x1957c4=_0x1d94df[_0x781b('0x2c')]+_0x1d94df['limit'],_0x1cd983;if(_0x1957c4>=_0xbde04f){_0x1957c4=_0xbde04f;_0x1cd983=0xc8;}else{_0x1cd983=0xce;}_0xcd8a6e[_0x781b('0x29')](_0x1cd983);return _0xcd8a6e[_0x781b('0x2d')]('Content-Range',_0x3d3d4c+'-'+_0x1957c4+'/'+_0xbde04f)['json'](_0x33561e);}return null;};}function patchUpdates(_0xdfe3d4){return function(_0x3e1bda){try{jsonpatch[_0x781b('0x2e')](_0x3e1bda,_0xdfe3d4,!![]);}catch(_0x32f325){return BPromise[_0x781b('0x2f')](_0x32f325);}return _0x3e1bda[_0x781b('0x30')]();};}function saveUpdates(_0x25d546,_0x2a1494){return function(_0x5a7c47){if(_0x5a7c47){return _0x5a7c47[_0x781b('0x31')](_0x25d546)['then'](function(_0x2e043b){return _0x2e043b;});}return null;};}function removeEntity(_0x557d7e,_0xa7dd98){return function(_0x468b8c){if(_0x468b8c){return _0x468b8c['destroy']()[_0x781b('0x32')](function(){_0x557d7e[_0x781b('0x29')](0xcc)[_0x781b('0x33')]();});}};}function handleEntityNotFound(_0x2cae64,_0x1ff492){return function(_0xb48785){if(!_0xb48785){_0x2cae64['sendStatus'](0x194);}return _0xb48785;};}function handleError(_0x436985,_0x4b62b3){_0x4b62b3=_0x4b62b3||0x1f4;return function(_0x3fd5f7){logger[_0x781b('0x23')](_0x3fd5f7[_0x781b('0x34')]);if(_0x3fd5f7[_0x781b('0x35')]){delete _0x3fd5f7[_0x781b('0x35')];}_0x436985[_0x781b('0x29')](_0x4b62b3)[_0x781b('0x36')](_0x3fd5f7);};}exports[_0x781b('0x37')]=function(_0x3a25a4,_0x23dad5){var _0x54da70={},_0xb56ca0={},_0x43b0d9={'count':0x0,'rows':[]};var _0x353918=_['map'](db[_0x781b('0x38')]['rawAttributes'],function(_0x58455d){return{'name':_0x58455d[_0x781b('0x39')],'type':_0x58455d[_0x781b('0x3a')][_0x781b('0x3b')]};});_0xb56ca0['model']=_[_0x781b('0x3c')](_0x353918,'name');_0xb56ca0[_0x781b('0x3d')]=_[_0x781b('0x3e')](_0x3a25a4[_0x781b('0x3d')]);_0xb56ca0[_0x781b('0x3f')]=_[_0x781b('0x40')](_0xb56ca0['model'],_0xb56ca0['query']);_0x54da70[_0x781b('0x41')]=_['intersection'](_0xb56ca0[_0x781b('0x42')],qs['fields'](_0x3a25a4[_0x781b('0x3d')]['fields']));_0x54da70[_0x781b('0x41')]=_0x54da70[_0x781b('0x41')][_0x781b('0x43')]?_0x54da70[_0x781b('0x41')]:_0xb56ca0[_0x781b('0x42')];if(!_0x3a25a4[_0x781b('0x3d')]['hasOwnProperty'](_0x781b('0x44'))){_0x54da70[_0x781b('0x45')]=qs[_0x781b('0x45')](_0x3a25a4['query'][_0x781b('0x45')]);_0x54da70[_0x781b('0x2c')]=qs['offset'](_0x3a25a4['query'][_0x781b('0x2c')]);}_0x54da70['order']=qs[_0x781b('0x46')](_0x3a25a4['query'][_0x781b('0x46')]);_0x54da70[_0x781b('0x47')]=qs[_0x781b('0x3f')](_[_0x781b('0x48')](_0x3a25a4[_0x781b('0x3d')],_0xb56ca0[_0x781b('0x3f')]),_0x353918);if(_0x3a25a4[_0x781b('0x3d')]['filter']){_0x54da70[_0x781b('0x47')]=_['merge'](_0x54da70[_0x781b('0x47')],{'$or':_['map'](_0x353918,function(_0x1198c2){if(_0x1198c2['type']!==_0x781b('0x49')){var _0x340f80={};_0x340f80[_0x1198c2[_0x781b('0x35')]]={'$like':'%'+_0x3a25a4[_0x781b('0x3d')][_0x781b('0x4a')]+'%'};return _0x340f80;}})});}_0x54da70=_[_0x781b('0x4b')]({},_0x54da70,_0x3a25a4[_0x781b('0x4c')]);var _0x2cb49c={'where':_0x54da70[_0x781b('0x47')]};return db[_0x781b('0x38')][_0x781b('0x2b')](_0x2cb49c)['then'](function(_0x443e88){_0x43b0d9[_0x781b('0x2b')]=_0x443e88;if(_0x3a25a4[_0x781b('0x3d')][_0x781b('0x4d')]){_0x54da70[_0x781b('0x4e')]=[{'all':!![]}];}return db[_0x781b('0x38')]['findAll'](_0x54da70);})['then'](function(_0x5ddb43){_0x43b0d9['rows']=_0x5ddb43;return _0x43b0d9;})[_0x781b('0x32')](respondWithFilteredResult(_0x23dad5,_0x54da70))[_0x781b('0x27')](handleError(_0x23dad5,null));};exports[_0x781b('0x4f')]=function(_0x1caa51,_0x53522b){var _0x3844c5={'raw':!![],'where':{'id':_0x1caa51[_0x781b('0x50')]['id']}},_0x369939={};_0x369939['model']=_[_0x781b('0x3e')](db['ChatGroup'][_0x781b('0x51')]);_0x369939[_0x781b('0x3d')]=_[_0x781b('0x3e')](_0x1caa51[_0x781b('0x3d')]);_0x369939[_0x781b('0x3f')]=_[_0x781b('0x40')](_0x369939[_0x781b('0x42')],_0x369939[_0x781b('0x3d')]);_0x3844c5[_0x781b('0x41')]=_[_0x781b('0x40')](_0x369939[_0x781b('0x42')],qs['fields'](_0x1caa51['query']['fields']));_0x3844c5[_0x781b('0x41')]=_0x3844c5['attributes'][_0x781b('0x43')]?_0x3844c5[_0x781b('0x41')]:_0x369939[_0x781b('0x42')];if(_0x1caa51['query']['includeAll']){_0x3844c5[_0x781b('0x4e')]=[{'all':!![]}];}_0x3844c5=_[_0x781b('0x4b')]({},_0x3844c5,_0x1caa51[_0x781b('0x4c')]);return db[_0x781b('0x38')][_0x781b('0x52')](_0x3844c5)['then'](handleEntityNotFound(_0x53522b,null))[_0x781b('0x32')](respondWithResult(_0x53522b,null))[_0x781b('0x27')](handleError(_0x53522b,null));};exports[_0x781b('0x53')]=function(_0x51af19,_0x3cff8d){return db[_0x781b('0x38')][_0x781b('0x53')](_0x51af19[_0x781b('0x54')],{})['then'](respondWithResult(_0x3cff8d,0xc9))['catch'](handleError(_0x3cff8d,null));};exports[_0x781b('0x31')]=function(_0x417a40,_0x4d1824){if(_0x417a40[_0x781b('0x54')]['id']){delete _0x417a40[_0x781b('0x54')]['id'];}return db[_0x781b('0x38')][_0x781b('0x52')]({'where':{'id':_0x417a40[_0x781b('0x50')]['id']}})[_0x781b('0x32')](handleEntityNotFound(_0x4d1824,null))[_0x781b('0x32')](saveUpdates(_0x417a40[_0x781b('0x54')],null))[_0x781b('0x32')](respondWithResult(_0x4d1824,null))[_0x781b('0x27')](handleError(_0x4d1824,null));};exports['destroy']=function(_0xc82a63,_0x4278eb){return db['ChatGroup'][_0x781b('0x52')]({'where':{'id':_0xc82a63['params']['id']}})[_0x781b('0x32')](handleEntityNotFound(_0x4278eb,null))[_0x781b('0x32')](removeEntity(_0x4278eb,null))['catch'](handleError(_0x4278eb,null));};exports['describe']=function(_0x42198b,_0xd6d9b5){return db[_0x781b('0x38')][_0x781b('0x55')]()['then'](respondWithResult(_0xd6d9b5,null))['catch'](handleError(_0xd6d9b5,null));};exports['getUnread']=function(_0x58e498,_0xb822e6,_0x3e092f){return db['ChatInternalMessage'][_0x781b('0x2b')]({'where':{'ChatGroupId':_0x58e498[_0x781b('0x50')]['id'],'ToId':_0x58e498['user']['id'],'read':![]}})[_0x781b('0x32')](function(_0x236045){return{'id':_[_0x781b('0x56')](_0x58e498[_0x781b('0x50')]['id']),'count':_0x236045};})['then'](respondWithResult(_0xb822e6,null))[_0x781b('0x27')](handleError(_0xb822e6,null));};exports['addMembers']=function(_0x5a2545,_0x95820,_0x1e63c4){return db['ChatGroup'][_0x781b('0x52')]({'where':{'id':_0x5a2545['params']['id']}})[_0x781b('0x32')](handleEntityNotFound(_0x95820,null))[_0x781b('0x32')](function(_0x554d50){if(_0x554d50){return _0x554d50[_0x781b('0x57')](_0x5a2545[_0x781b('0x54')][_0x781b('0x58')],_[_0x781b('0x59')](_0x5a2545['body'],[_0x781b('0x58'),'id'])||{});}})['then'](respondWithResult(_0x95820,null))[_0x781b('0x27')](handleError(_0x95820,null));};exports[_0x781b('0x5a')]=function(_0x3745a3,_0x2bd571,_0x3baf07){var _0x54912c={};var _0xaaf93c={};var _0x1d1f81;var _0x3aa2a9;return db[_0x781b('0x38')][_0x781b('0x5b')]({'where':{'id':_0x3745a3[_0x781b('0x50')]['id']}})['then'](handleEntityNotFound(_0x2bd571,null))[_0x781b('0x32')](function(_0x1db182){if(_0x1db182){_0x1d1f81=_0x1db182;_0xaaf93c[_0x781b('0x42')]=_[_0x781b('0x3e')](db[_0x781b('0x5c')][_0x781b('0x51')]);_0xaaf93c[_0x781b('0x3d')]=_[_0x781b('0x3e')](_0x3745a3[_0x781b('0x3d')]);_0xaaf93c[_0x781b('0x3f')]=_['intersection'](_0xaaf93c[_0x781b('0x42')],_0xaaf93c[_0x781b('0x3d')]);_0x54912c[_0x781b('0x41')]=_[_0x781b('0x40')](_0xaaf93c[_0x781b('0x42')],qs['fields'](_0x3745a3[_0x781b('0x3d')][_0x781b('0x5d')]));_0x54912c['attributes']=_0x54912c['attributes'][_0x781b('0x43')]?_0x54912c[_0x781b('0x41')]:_0xaaf93c[_0x781b('0x42')];_0x54912c['order']=qs[_0x781b('0x46')](_0x3745a3['query']['sort']);_0x54912c[_0x781b('0x47')]=qs[_0x781b('0x3f')](_['pick'](_0x3745a3[_0x781b('0x3d')],_0xaaf93c[_0x781b('0x3f')]));if(_0x3745a3[_0x781b('0x3d')]['filter']){_0x54912c[_0x781b('0x47')]=_[_0x781b('0x4b')](_0x54912c['where'],{'$or':_[_0x781b('0x3c')](_0x54912c[_0x781b('0x41')],function(_0x44f8cb){var _0x39a7a7={};_0x39a7a7[_0x44f8cb]={'$like':'%'+_0x3745a3[_0x781b('0x3d')][_0x781b('0x4a')]+'%'};return _0x39a7a7;})});}_0x54912c=_[_0x781b('0x4b')]({},_0x54912c,_0x3745a3['options']);return _0x1d1f81['getMembers'](_0x54912c);}})[_0x781b('0x32')](function(_0x2531c9){if(_0x2531c9){_0x3aa2a9=_0x2531c9['length'];if(!_0x3745a3[_0x781b('0x3d')][_0x781b('0x5e')](_0x781b('0x44'))){_0x54912c['limit']=qs[_0x781b('0x45')](_0x3745a3['query'][_0x781b('0x45')]);_0x54912c[_0x781b('0x2c')]=qs['offset'](_0x3745a3[_0x781b('0x3d')][_0x781b('0x2c')]);}return _0x1d1f81[_0x781b('0x5a')](_0x54912c);}})[_0x781b('0x32')](function(_0x3e51da){if(_0x3e51da){return _0x3e51da?{'count':_0x3aa2a9,'rows':_0x3e51da}:null;}})['then'](respondWithResult(_0x2bd571,null))['catch'](handleError(_0x2bd571,null));};exports[_0x781b('0x5f')]=function(_0x188aa9,_0x16bb5e,_0x26873c){return db[_0x781b('0x38')][_0x781b('0x52')]({'where':{'id':_0x188aa9[_0x781b('0x50')]['id']}})[_0x781b('0x32')](handleEntityNotFound(_0x16bb5e,null))[_0x781b('0x32')](function(_0x185695){if(_0x185695){return _0x185695[_0x781b('0x5f')](_0x188aa9[_0x781b('0x3d')][_0x781b('0x58')]);}})[_0x781b('0x32')](respondWithStatusCode(_0x16bb5e,null))['catch'](handleError(_0x16bb5e,null));};exports[_0x781b('0x60')]=function(_0x49ba3e,_0x2ad1d3,_0x58436a){if(_0x49ba3e[_0x781b('0x54')]['id']){delete _0x49ba3e[_0x781b('0x54')]['id'];}return db[_0x781b('0x38')][_0x781b('0x52')]({'where':{'id':_0x49ba3e[_0x781b('0x50')]['id']}})[_0x781b('0x32')](handleEntityNotFound(_0x2ad1d3,null))[_0x781b('0x32')](function(_0x4910e4){if(_0x4910e4){_0x49ba3e[_0x781b('0x54')][_0x781b('0x61')]=_0x4910e4['id'];return db[_0x781b('0x62')][_0x781b('0x53')](_0x49ba3e['body']);}})[_0x781b('0x32')](respondWithResult(_0x2ad1d3,null))[_0x781b('0x27')](handleError(_0x2ad1d3,null));};exports['getMessages']=function(_0x377e3c,_0x38ef40,_0x1cd061){var _0x210724={};var _0x53a891={};var _0x318279;var _0x447e03;return db[_0x781b('0x38')][_0x781b('0x5b')]({'where':{'id':_0x377e3c[_0x781b('0x50')]['id']}})[_0x781b('0x32')](handleEntityNotFound(_0x38ef40,null))[_0x781b('0x32')](function(_0x1ab34c){if(_0x1ab34c){_0x318279=_0x1ab34c;_0x53a891[_0x781b('0x42')]=_[_0x781b('0x3e')](db[_0x781b('0x62')]['rawAttributes']);_0x53a891['query']=_[_0x781b('0x3e')](_0x377e3c[_0x781b('0x3d')]);_0x53a891[_0x781b('0x3f')]=_[_0x781b('0x40')](_0x53a891['model'],_0x53a891[_0x781b('0x3d')]);_0x210724[_0x781b('0x41')]=_[_0x781b('0x40')](_0x53a891[_0x781b('0x42')],qs[_0x781b('0x5d')](_0x377e3c[_0x781b('0x3d')][_0x781b('0x5d')]));_0x210724[_0x781b('0x41')]=_0x210724[_0x781b('0x41')][_0x781b('0x43')]?_0x210724[_0x781b('0x41')]:_0x53a891[_0x781b('0x42')];_0x210724[_0x781b('0x63')]=qs['sort'](_0x377e3c['query'][_0x781b('0x46')]);_0x210724['where']=qs[_0x781b('0x3f')](_['pick'](_0x377e3c[_0x781b('0x3d')],_0x53a891['filters']));if(_0x377e3c[_0x781b('0x3d')][_0x781b('0x4a')]){_0x210724[_0x781b('0x47')]=_[_0x781b('0x4b')](_0x210724[_0x781b('0x47')],{'$or':_['map'](_0x210724[_0x781b('0x41')],function(_0x535436){var _0x2d3547={};_0x2d3547[_0x535436]={'$like':'%'+_0x377e3c['query']['filter']+'%'};return _0x2d3547;})});}if(_0x377e3c[_0x781b('0x3d')][_0x781b('0x64')]){var _0x1ed9e2=_0x377e3c['query'][_0x781b('0x64')][_0x781b('0x65')](',');var _0x363f3b={};_0x363f3b[_0x1ed9e2[0x0]]={'$gte':moment(_0x1ed9e2[0x1])['format'](_0x781b('0x66'))};_0x210724[_0x781b('0x47')]=_[_0x781b('0x4b')](_0x210724[_0x781b('0x47')],_0x363f3b);}_0x210724=_[_0x781b('0x4b')]({},_0x210724,_0x377e3c[_0x781b('0x4c')]);return _0x318279[_0x781b('0x67')](_0x210724);}})[_0x781b('0x32')](function(_0x5ebdaf){if(_0x5ebdaf){_0x447e03=_0x5ebdaf[_0x781b('0x43')];if(!_0x377e3c['query'][_0x781b('0x5e')](_0x781b('0x44'))){_0x210724['limit']=qs[_0x781b('0x45')](_0x377e3c[_0x781b('0x3d')][_0x781b('0x45')]);_0x210724[_0x781b('0x2c')]=qs[_0x781b('0x2c')](_0x377e3c['query'][_0x781b('0x2c')]);}return _0x318279['getMessages'](_0x210724);}})[_0x781b('0x32')](function(_0x45ed42){if(_0x45ed42){return _0x45ed42?{'count':_0x447e03,'rows':_0x45ed42}:null;}})[_0x781b('0x32')](respondWithResult(_0x38ef40,null))[_0x781b('0x27')](handleError(_0x38ef40,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ff7f1b0..441a980 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(_0x51c210,_0x4a8ce8){var _0x25d932=function(_0x555d15){while(--_0x555d15){_0x51c210['push'](_0x51c210['shift']());}};_0x25d932(++_0x4a8ce8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x549e6b,_0x1b6aa9){_0x549e6b=_0x549e6b-0x0;var _0x213ca0=_0x5f2f[_0x549e6b];return _0x213ca0;};'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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2032,0xd9));var _0x2203=function(_0x4e3073,_0x420f09){_0x4e3073=_0x4e3073-0x0;var _0x11a0d3=_0x2032[_0x4e3073];return _0x11a0d3;};'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 d2488be..4a15a44 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0x7fbe[_0x2d2498];return _0x447a5b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cf=['./chatGroup.attributes','ChatGroup','chat_groups','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x322b75,_0x59fc8b){var _0x1a4681=function(_0x1d0fd7){while(--_0x1d0fd7){_0x322b75['push'](_0x322b75['shift']());}};_0x1a4681(++_0x59fc8b);}(_0xf2cf,0xf5));var _0xff2c=function(_0x520874,_0x5939c4){_0x520874=_0x520874-0x0;var _0x50c8ce=_0xf2cf[_0x520874];return _0x50c8ce;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index a64df5f..9592250 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 _0x1d93=['code','message','result','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','localhost','redis','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1999e6,_0x5a31c2){var _0x3ecae5=function(_0x5cf8ae){while(--_0x5cf8ae){_0x1999e6['push'](_0x1999e6['shift']());}};_0x3ecae5(++_0x5a31c2);}(_0x1d93,0x1bc));var _0x31d9=function(_0x19a4ae,_0x21054a){_0x19a4ae=_0x19a4ae-0x0;var _0x13b6c3=_0x1d93[_0x19a4ae];return _0x13b6c3;};'use strict';var _=require('lodash');var util=require(_0x31d9('0x0'));var moment=require(_0x31d9('0x1'));var BPromise=require(_0x31d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x31d9('0x4'))(_0x31d9('0x5'));var config=require('../../config/environment');var jayson=require(_0x31d9('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x31d9('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x31d9('0x8')]));require(_0x31d9('0x9'))[_0x31d9('0xa')](socket);function respondWithRpcPromise(_0x159078,_0x374a7c,_0x15d57c){return new BPromise(function(_0x42cb2c,_0x23a75f){return client['request'](_0x159078,_0x15d57c)['then'](function(_0x89f559){logger[_0x31d9('0xb')](_0x31d9('0xc'),_0x374a7c,_0x31d9('0xd'));logger[_0x31d9('0xe')](_0x31d9('0xf'),_0x374a7c,_0x31d9('0xd'),JSON[_0x31d9('0x10')](_0x89f559));if(_0x89f559[_0x31d9('0x11')]){if(_0x89f559[_0x31d9('0x11')][_0x31d9('0x12')]===0x1f4){logger[_0x31d9('0x11')](_0x31d9('0xc'),_0x374a7c,_0x89f559['error'][_0x31d9('0x13')]);return _0x23a75f(_0x89f559[_0x31d9('0x11')][_0x31d9('0x13')]);}logger['error'](_0x31d9('0xc'),_0x374a7c,_0x89f559[_0x31d9('0x11')]['message']);return _0x42cb2c(_0x89f559[_0x31d9('0x11')]['message']);}else{logger[_0x31d9('0xb')](_0x31d9('0xc'),_0x374a7c,_0x31d9('0xd'));_0x42cb2c(_0x89f559[_0x31d9('0x14')][_0x31d9('0x13')]);}})['catch'](function(_0x45272a){logger[_0x31d9('0x11')](_0x31d9('0xc'),_0x374a7c,_0x45272a);_0x23a75f(_0x45272a);});});} \ No newline at end of file +var _0xa0b6=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0xa0b6,0xe1));var _0x6a0b=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xa0b6[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0x6a0b('0x0'));var util=require(_0x6a0b('0x1'));var moment=require(_0x6a0b('0x2'));var BPromise=require(_0x6a0b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a0b('0x4'))['db'];var utils=require(_0x6a0b('0x5'));var logger=require(_0x6a0b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a0b('0x7')][_0x6a0b('0x8')]({'port':0x232a});config['redis']=_[_0x6a0b('0x9')](config[_0x6a0b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6a0b('0xb'))(new Redis(config[_0x6a0b('0xa')]));require(_0x6a0b('0xc'))[_0x6a0b('0xd')](socket);function respondWithRpcPromise(_0x447a4a,_0x2931f6,_0x21ac86){return new BPromise(function(_0x480e7d,_0x13adac){return client['request'](_0x447a4a,_0x21ac86)[_0x6a0b('0xe')](function(_0x2339bc){logger[_0x6a0b('0xf')](_0x6a0b('0x10'),_0x2931f6,'request\x20sent');logger[_0x6a0b('0x11')](_0x6a0b('0x12'),_0x2931f6,_0x6a0b('0x13'),JSON[_0x6a0b('0x14')](_0x2339bc));if(_0x2339bc[_0x6a0b('0x15')]){if(_0x2339bc[_0x6a0b('0x15')][_0x6a0b('0x16')]===0x1f4){logger[_0x6a0b('0x15')]('ChatGroup,\x20%s,\x20%s',_0x2931f6,_0x2339bc['error']['message']);return _0x13adac(_0x2339bc['error'][_0x6a0b('0x17')]);}logger[_0x6a0b('0x15')]('ChatGroup,\x20%s,\x20%s',_0x2931f6,_0x2339bc[_0x6a0b('0x15')]['message']);return _0x480e7d(_0x2339bc['error'][_0x6a0b('0x17')]);}else{logger[_0x6a0b('0xf')]('ChatGroup,\x20%s,\x20%s',_0x2931f6,_0x6a0b('0x13'));_0x480e7d(_0x2339bc['result'][_0x6a0b('0x17')]);}})[_0x6a0b('0x18')](function(_0x2a73d2){logger[_0x6a0b('0x15')](_0x6a0b('0x10'),_0x2931f6,_0x2a73d2);_0x13adac(_0x2a73d2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 9700768..486134a 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 _0x22ff=['remove','update','emit','removeListener','length','chatGroup:','./chatGroup.events','save'];(function(_0x3c9917,_0x304014){var _0x5bec23=function(_0x3cfce5){while(--_0x3cfce5){_0x3c9917['push'](_0x3c9917['shift']());}};_0x5bec23(++_0x304014);}(_0x22ff,0x6e));var _0xf22f=function(_0x43028e,_0x33a648){_0x43028e=_0x43028e-0x0;var _0x2fed6d=_0x22ff[_0x43028e];return _0x2fed6d;};'use strict';var ChatGroupEvents=require(_0xf22f('0x0'));var events=[_0xf22f('0x1'),_0xf22f('0x2'),_0xf22f('0x3')];function createListener(_0x3b9cb1,_0x5b17b2){return function(_0x4f7e0d){_0x5b17b2[_0xf22f('0x4')](_0x3b9cb1,_0x4f7e0d);};}function removeListener(_0x101fab,_0x344277){return function(){ChatGroupEvents[_0xf22f('0x5')](_0x101fab,_0x344277);};}exports['register']=function(_0x1b547d){for(var _0x5edf13=0x0,_0x1eb0d3=events[_0xf22f('0x6')];_0x5edf13<_0x1eb0d3;_0x5edf13++){var _0x6970da=events[_0x5edf13];var _0x4ab50e=createListener(_0xf22f('0x7')+_0x6970da,_0x1b547d);ChatGroupEvents['on'](_0x6970da,_0x4ab50e);}}; \ No newline at end of file +var _0xaf17=['removeListener','register','length','chatGroup:','save','remove','update','emit'];(function(_0x13d46e,_0xb71980){var _0x30e59b=function(_0x239cfc){while(--_0x239cfc){_0x13d46e['push'](_0x13d46e['shift']());}};_0x30e59b(++_0xb71980);}(_0xaf17,0x18c));var _0x7af1=function(_0x2ff760,_0x350065){_0x2ff760=_0x2ff760-0x0;var _0x3df8af=_0xaf17[_0x2ff760];return _0x3df8af;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x7af1('0x0'),_0x7af1('0x1'),_0x7af1('0x2')];function createListener(_0x31a2a3,_0x7b94ce){return function(_0x3aca3f){_0x7b94ce[_0x7af1('0x3')](_0x31a2a3,_0x3aca3f);};}function removeListener(_0x16a701,_0x535e73){return function(){ChatGroupEvents[_0x7af1('0x4')](_0x16a701,_0x535e73);};}exports[_0x7af1('0x5')]=function(_0x3dfd88){for(var _0x11e9db=0x0,_0x1714f8=events[_0x7af1('0x6')];_0x11e9db<_0x1714f8;_0x11e9db++){var _0x3f9519=events[_0x11e9db];var _0x40fe93=createListener(_0x7af1('0x7')+_0x3f9519,_0x3dfd88);ChatGroupEvents['on'](_0x3f9519,_0x40fe93);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ce4eae1..65627d0 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 _0x98dc=['addMembers','addMessage','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x98dc,0x1b8));var _0xc98d=function(_0x391c3d,_0x5a900f){_0x391c3d=_0x391c3d-0x0;var _0x2452f8=_0x98dc[_0x391c3d];return _0x2452f8;};'use strict';var multer=require(_0xc98d('0x0'));var util=require(_0xc98d('0x1'));var path=require(_0xc98d('0x2'));var timeout=require(_0xc98d('0x3'));var express=require(_0xc98d('0x4'));var router=express[_0xc98d('0x5')]();var auth=require(_0xc98d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc98d('0x7'));var controller=require('./chatGroup.controller');router[_0xc98d('0x8')]('/',auth[_0xc98d('0x9')](),controller['index']);router[_0xc98d('0x8')]('/describe',auth[_0xc98d('0x9')](),controller[_0xc98d('0xa')]);router['get']('/:id',auth[_0xc98d('0x9')](),controller['show']);router['get'](_0xc98d('0xb'),auth[_0xc98d('0x9')](),controller[_0xc98d('0xc')]);router[_0xc98d('0x8')](_0xc98d('0xd'),auth[_0xc98d('0x9')](),controller[_0xc98d('0xe')]);router['get'](_0xc98d('0xf'),auth[_0xc98d('0x9')](),controller[_0xc98d('0x10')]);router[_0xc98d('0x11')]('/',auth['isAuthenticated'](),controller[_0xc98d('0x12')]);router[_0xc98d('0x11')](_0xc98d('0xd'),auth['isAuthenticated'](),controller[_0xc98d('0x13')]);router[_0xc98d('0x11')]('/:id/messages',auth[_0xc98d('0x9')](),controller[_0xc98d('0x14')]);router[_0xc98d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc98d('0x16')]);router[_0xc98d('0x17')](_0xc98d('0x18'),auth['isAuthenticated'](),controller[_0xc98d('0x19')]);router['delete'](_0xc98d('0xd'),auth[_0xc98d('0x9')](),controller['removeMembers']);module[_0xc98d('0x1a')]=router; \ No newline at end of file +var _0xc438=['util','connect-timeout','express','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','addMembers','addMessage','/:id','update','delete','destroy'];(function(_0x517ed2,_0x4f17bb){var _0x1ab5b9=function(_0x39a18c){while(--_0x39a18c){_0x517ed2['push'](_0x517ed2['shift']());}};_0x1ab5b9(++_0x4f17bb);}(_0xc438,0x1c8));var _0x8c43=function(_0x894798,_0x1e1e12){_0x894798=_0x894798-0x0;var _0x4f561e=_0xc438[_0x894798];return _0x4f561e;};'use strict';var multer=require('multer');var util=require(_0x8c43('0x0'));var path=require('path');var timeout=require(_0x8c43('0x1'));var express=require(_0x8c43('0x2'));var router=express['Router']();var auth=require(_0x8c43('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8c43('0x4'));var controller=require(_0x8c43('0x5'));router[_0x8c43('0x6')]('/',auth[_0x8c43('0x7')](),controller['index']);router['get'](_0x8c43('0x8'),auth[_0x8c43('0x7')](),controller[_0x8c43('0x9')]);router[_0x8c43('0x6')]('/:id',auth[_0x8c43('0x7')](),controller[_0x8c43('0xa')]);router[_0x8c43('0x6')](_0x8c43('0xb'),auth[_0x8c43('0x7')](),controller[_0x8c43('0xc')]);router[_0x8c43('0x6')]('/:id/members',auth[_0x8c43('0x7')](),controller[_0x8c43('0xd')]);router[_0x8c43('0x6')](_0x8c43('0xe'),auth['isAuthenticated'](),controller[_0x8c43('0xf')]);router[_0x8c43('0x10')]('/',auth[_0x8c43('0x7')](),controller['create']);router[_0x8c43('0x10')](_0x8c43('0x11'),auth[_0x8c43('0x7')](),controller[_0x8c43('0x12')]);router[_0x8c43('0x10')](_0x8c43('0xe'),auth['isAuthenticated'](),controller[_0x8c43('0x13')]);router['put'](_0x8c43('0x14'),auth[_0x8c43('0x7')](),controller[_0x8c43('0x15')]);router[_0x8c43('0x16')](_0x8c43('0x14'),auth[_0x8c43('0x7')](),controller[_0x8c43('0x17')]);router['delete']('/:id/members',auth[_0x8c43('0x7')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6666bd8..18d613d 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 _0xa4c8=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0xa4c8,0x137));var _0x8a4c=function(_0x1cef29,_0x50f59c){_0x1cef29=_0x1cef29-0x0;var _0x37352c=_0xa4c8[_0x1cef29];return _0x37352c;};'use strict';var Sequelize=require(_0x8a4c('0x0'));module[_0x8a4c('0x1')]={'closed':{'type':Sequelize[_0x8a4c('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8a4c('0x3')]},'ratingType':{'type':Sequelize[_0x8a4c('0x4')](_0x8a4c('0x5'),_0x8a4c('0x6')),'defaultValue':_0x8a4c('0x5')},'ratingMessage':{'type':Sequelize[_0x8a4c('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x8a4c('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8a4c('0x9')]},'disposition':{'type':Sequelize[_0x8a4c('0x8')]},'secondDisposition':{'type':Sequelize[_0x8a4c('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8a4c('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x8a4c('0x8')]},'osName':{'type':Sequelize[_0x8a4c('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8a4c('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x8a4c('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x8a4c('0xa'))},'read1stAt':{'type':Sequelize[_0x8a4c('0x9')]},'lastMsgAt':{'type':Sequelize[_0x8a4c('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8a4c('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8a4c('0x8')]},'customerPort':{'type':Sequelize[_0x8a4c('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x8a4c('0x7')]}}; \ No newline at end of file +var _0xf7a4=['TEXT','STRING','DATE','out','sequelize','exports','INTEGER','ENUM','thumb','star'];(function(_0x3ac882,_0x370ae4){var _0x505c4c=function(_0x2abd9c){while(--_0x2abd9c){_0x3ac882['push'](_0x3ac882['shift']());}};_0x505c4c(++_0x370ae4);}(_0xf7a4,0x72));var _0x4f7a=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xf7a4[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0x4f7a('0x0'));module[_0x4f7a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4f7a('0x2')]},'ratingType':{'type':Sequelize[_0x4f7a('0x3')]('star',_0x4f7a('0x4')),'defaultValue':_0x4f7a('0x5')},'ratingMessage':{'type':Sequelize[_0x4f7a('0x6')]},'pathTranscript':{'type':Sequelize[_0x4f7a('0x6')]},'mailTranscript':{'type':Sequelize[_0x4f7a('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4f7a('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4f7a('0x7')]},'note':{'type':Sequelize[_0x4f7a('0x7')]},'browserName':{'type':Sequelize[_0x4f7a('0x7')]},'browserVersion':{'type':Sequelize[_0x4f7a('0x7')]},'osName':{'type':Sequelize[_0x4f7a('0x7')]},'osVersion':{'type':Sequelize[_0x4f7a('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x4f7a('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x4f7a('0x7')]},'formData':{'type':Sequelize[_0x4f7a('0x6')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x4f7a('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x4f7a('0x3')]('in',_0x4f7a('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4f7a('0x7')]},'customerPort':{'type':Sequelize[_0x4f7a('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x4f7a('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 91f0d5b..d2f2aca 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 _0xa28d=['Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','create','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','originalname','basename','Attachment','attachmentDownload','closed','attachId','download','join','root','server/files/attachments/','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','fullname','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','$gte','findAll','getMyMessages','alias','addTags','setTags','spread','chatInteractionTags:save','removeTags','unix','server','tmp','files','transcript-%d-%s.zip','firstName','lastName','attachments','direction','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','osName','referer','customerIp','existsSync','createReadStream','createWriteStream','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatInteraction.socket','client','http','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','Users','TagIds','Tags','split','push','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','text','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','ChatInteraction','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'];(function(_0x1dc2b4,_0x573a04){var _0x18af92=function(_0x46820a){while(--_0x46820a){_0x1dc2b4['push'](_0x1dc2b4['shift']());}};_0x18af92(++_0x573a04);}(_0xa28d,0x1bd));var _0xda28=function(_0x52223b,_0x1a4080){_0x52223b=_0x52223b-0x0;var _0x586e16=_0xa28d[_0x52223b];return _0x586e16;};'use strict';var pdf=require(_0xda28('0x0'));var emlformat=require(_0xda28('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xda28('0x2'));var jsonpatch=require(_0xda28('0x3'));var rp=require(_0xda28('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xda28('0x5'));var util=require(_0xda28('0x6'));var path=require(_0xda28('0x7'));var sox=require(_0xda28('0x8'));var csv=require('to-csv');var ejs=require(_0xda28('0x9'));var fs=require('fs');var _=require(_0xda28('0xa'));var squel=require(_0xda28('0xb'));var crypto=require(_0xda28('0xc'));var jsforce=require(_0xda28('0xd'));var deskjs=require(_0xda28('0xe'));var toCsv=require(_0xda28('0xf'));var querystring=require(_0xda28('0x10'));var Papa=require(_0xda28('0x11'));var Redis=require(_0xda28('0x12'));var authService=require(_0xda28('0x13'));var qs=require(_0xda28('0x14'));var as=require(_0xda28('0x15'));var hardwareService=require(_0xda28('0x16'));var logger=require('../../config/logger')(_0xda28('0x17'));var utils=require(_0xda28('0x18'));var config=require(_0xda28('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xda28('0x1a')]=_[_0xda28('0x1b')](config['redis'],{'host':_0xda28('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda28('0x1a')]));require(_0xda28('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xda28('0x1e')]['http']({'port':0x232b});var client9004=jayson[_0xda28('0x1e')][_0xda28('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1a119b,_0x5f2cd6,_0xd867d8,_0x1a830f){return new BPromise(function(_0x269e22,_0x171b4b){var _0x1b3636=_0x1a830f||client;return _0x1b3636['request'](_0x1a119b,_0xd867d8)[_0xda28('0x20')](function(_0x58b86a){logger[_0xda28('0x21')](_0xda28('0x22'),_0x5f2cd6,'request\x20sent');logger[_0xda28('0x23')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5f2cd6,_0xda28('0x24'),JSON[_0xda28('0x25')](_0x58b86a));if(_0x58b86a[_0xda28('0x26')]){if(_0x58b86a[_0xda28('0x26')][_0xda28('0x27')]===0x1f4){logger['error'](_0xda28('0x22'),_0x5f2cd6,_0x58b86a['error'][_0xda28('0x28')]);return _0x171b4b(_0x58b86a[_0xda28('0x26')][_0xda28('0x28')]);}logger[_0xda28('0x26')](_0xda28('0x22'),_0x5f2cd6,_0x58b86a['error'][_0xda28('0x28')]);return _0x269e22(_0x58b86a[_0xda28('0x26')][_0xda28('0x28')]);}else{logger[_0xda28('0x21')](_0xda28('0x22'),_0x5f2cd6,_0xda28('0x24'));_0x269e22(_0x58b86a[_0xda28('0x29')][_0xda28('0x28')]);}})[_0xda28('0x2a')](function(_0x4ef38e){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5f2cd6,_0x4ef38e);_0x171b4b(_0x4ef38e);});});}function respondWithStatusCode(_0x53bfbf,_0xc2f20e){_0xc2f20e=_0xc2f20e||0xcc;return function(_0x190178){if(_0x190178){return _0x53bfbf[_0xda28('0x2b')](_0xc2f20e);}return _0x53bfbf[_0xda28('0x2c')](_0xc2f20e)[_0xda28('0x2d')]();};}function respondWithResult(_0x178bd3,_0x1f584c){_0x1f584c=_0x1f584c||0xc8;return function(_0x5d9fd1){if(_0x5d9fd1){return _0x178bd3[_0xda28('0x2c')](_0x1f584c)[_0xda28('0x2e')](_0x5d9fd1);}};}function respondWithFilteredResult(_0x1597e8,_0x32522e){return function(_0x52f34a){if(_0x52f34a){var _0x14ced5=_0x52f34a[_0xda28('0x2f')],_0xea225f=_0x32522e['offset'],_0x57e24b=_0x32522e['offset']+_0x32522e[_0xda28('0x30')],_0x345ce0;if(_0x57e24b>=_0x14ced5){_0x57e24b=_0x14ced5;_0x345ce0=0xc8;}else{_0x345ce0=0xce;}_0x1597e8['status'](_0x345ce0);return _0x1597e8['set'](_0xda28('0x31'),_0xea225f+'-'+_0x57e24b+'/'+_0x14ced5)['json'](_0x52f34a);}return null;};}function patchUpdates(_0x5f02ce){return function(_0x190e4c){try{jsonpatch[_0xda28('0x32')](_0x190e4c,_0x5f02ce,!![]);}catch(_0x35c887){return BPromise[_0xda28('0x33')](_0x35c887);}return _0x190e4c[_0xda28('0x34')]();};}function saveUpdates(_0x1fee25,_0xb79476){return function(_0xf13fb4){if(_0xf13fb4){return _0xf13fb4[_0xda28('0x35')](_0x1fee25)['then'](function(_0x5597cb){return _0x5597cb;});}return null;};}function removeEntity(_0x186bf1,_0x2f95e9){return function(_0x505463){if(_0x505463){return _0x505463[_0xda28('0x36')]()[_0xda28('0x20')](function(){_0x186bf1[_0xda28('0x2c')](0xcc)[_0xda28('0x2d')]();});}};}function handleEntityNotFound(_0x3a1201,_0x22443a){return function(_0x425736){if(!_0x425736){_0x3a1201[_0xda28('0x2b')](0x194);}return _0x425736;};}function handleError(_0x103890,_0x2d040c){_0x2d040c=_0x2d040c||0x1f4;return function(_0x408705){logger[_0xda28('0x26')](_0x408705[_0xda28('0x37')]);if(_0x408705[_0xda28('0x38')]){delete _0x408705[_0xda28('0x38')];}_0x103890['status'](_0x2d040c)[_0xda28('0x39')](_0x408705);};}function getInteractionUsers(_0x5ef3f2,_0x4b79a3){return new BPromise(function(_0x2e746f,_0x592538){try{if(_0x4b79a3[_0x5ef3f2['id']]){_0x5ef3f2[_0xda28('0x3a')]=_['map'](_0x4b79a3[_0x5ef3f2['id']],function(_0x4d7a69){return{'id':_0x4d7a69['id'],'fullname':_0x4d7a69['fullname']};});}}catch(_0x29cb27){_0x592538(_0x29cb27);}_0x2e746f(_0x5ef3f2);});}function getInteractionTags(_0x2b4539,_0x34d179){return new BPromise(function(_0x26332f,_0x430823){try{if(_0x2b4539[_0xda28('0x3b')]){_0x2b4539[_0xda28('0x3c')]=[];_0x2b4539[_0xda28('0x3b')][_0xda28('0x3d')](',')['forEach'](function(_0xab53){_0x2b4539[_0xda28('0x3c')][_0xda28('0x3e')](_0x34d179[_0xab53]);});}delete _0x2b4539[_0xda28('0x3b')];}catch(_0x3e3ed6){_0x430823(_0x3e3ed6);}_0x26332f(_0x2b4539);});}function updateChatInteraction(_0x5956d9,_0x4119cc,_0x18662f){return new BPromise(function(_0xf9b73,_0x51a914){return getInteractionUsers(_0x5956d9,_0x18662f)['then'](function(_0x2dc4aa){return getInteractionTags(_0x2dc4aa,_0x4119cc);})['then'](function(_0x532204){_0xf9b73(_0x532204);})[_0xda28('0x2a')](function(_0x37d5f1){_0x51a914(_0x37d5f1);});});}exports[_0xda28('0x3f')]=function(_0x341743,_0x144132){var _0x276a34={},_0x3bfd71={},_0x3c8271={'count':0x0,'rows':[]};var _0x572580=_[_0xda28('0x40')](db['ChatInteraction'][_0xda28('0x41')],function(_0x558df9){return{'name':_0x558df9[_0xda28('0x42')],'type':_0x558df9[_0xda28('0x43')][_0xda28('0x44')]};});_0x3bfd71[_0xda28('0x45')]=_[_0xda28('0x40')](_0x572580,'name');_0x3bfd71[_0xda28('0x46')]=_[_0xda28('0x47')](_0x341743[_0xda28('0x46')]);_0x3bfd71[_0xda28('0x48')]=_['intersection'](_0x3bfd71[_0xda28('0x45')],_0x3bfd71[_0xda28('0x46')]);_0x276a34[_0xda28('0x49')]=_[_0xda28('0x4a')](_0x3bfd71[_0xda28('0x45')],qs[_0xda28('0x4b')](_0x341743[_0xda28('0x46')][_0xda28('0x4b')]));_0x276a34[_0xda28('0x49')]=_0x276a34[_0xda28('0x49')][_0xda28('0x4c')]?_0x276a34[_0xda28('0x49')]:_0x3bfd71[_0xda28('0x45')];if(!_0x341743[_0xda28('0x46')][_0xda28('0x4d')](_0xda28('0x4e'))){_0x276a34[_0xda28('0x30')]=qs[_0xda28('0x30')](_0x341743[_0xda28('0x46')][_0xda28('0x30')]);_0x276a34['offset']=qs[_0xda28('0x4f')](_0x341743[_0xda28('0x46')][_0xda28('0x4f')]);}_0x276a34[_0xda28('0x50')]=qs[_0xda28('0x51')](_0x341743[_0xda28('0x46')][_0xda28('0x51')]);_0x276a34[_0xda28('0x52')]=qs['filters'](_[_0xda28('0x53')](_0x341743['query'],_0x3bfd71[_0xda28('0x48')]),_0x572580);var _0x328d5a=[];var _0x453ba3=squel[_0xda28('0x54')]()[_0xda28('0x55')]('id')[_0xda28('0x55')](_0xda28('0x38'))[_0xda28('0x55')](_0xda28('0x56'))['from'](_0xda28('0x57'));var _0x48f542=squel[_0xda28('0x54')]()[_0xda28('0x55')]('u.id')[_0xda28('0x55')](_0xda28('0x58'))['field'](_0xda28('0x59'))[_0xda28('0x5a')](_0xda28('0x5b'),'ui')[_0xda28('0x5c')](_0xda28('0x5d'),'u',_0xda28('0x5e'));var _0x3a0a94=squel[_0xda28('0x54')]()['from'](_0xda28('0x5f'),'i')[_0xda28('0x5c')](_0xda28('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xda28('0x61'))['left_join']('chat_websites','a',_0xda28('0x62'))[_0xda28('0x5c')](_0xda28('0x63'),'me',_0xda28('0x64'))['left_join']('chat_interaction_has_tags','it',_0xda28('0x65'))[_0xda28('0x5c')](_0xda28('0x57'),'t',_0xda28('0x66'));var _0x53c379=squel[_0xda28('0x67')]();var _0x181ae0=[];var _0x55555d=squel[_0xda28('0x67')]();var _0x3a37e5;if(_0x341743[_0xda28('0x46')][_0xda28('0x68')]){_0x3a37e5=as[_0xda28('0x69')](_0x341743[_0xda28('0x46')][_0xda28('0x68')]);var _0x37f15d=_0x3a37e5[_0xda28('0x6a')];for(var _0x314188=0x0;_0x314188<_0x3a37e5[_0xda28('0x6b')][_0xda28('0x4c')];_0x314188++){var _0x5f4335=_0x3a37e5[_0xda28('0x6b')][_0x314188];var _0x53d6c7='i';var _0x1eb875=_[_0xda28('0x6c')](_0x572580,[_0xda28('0x38'),_0x5f4335['field']]);if(!_0x1eb875){switch(_0x5f4335[_0xda28('0x55')]){case _0xda28('0x6d'):if(_0x5f4335[_0xda28('0x6e')]==0x1){_0x3a0a94[_0xda28('0x6f')]('`'+_0x5f4335[_0xda28('0x55')]+_0xda28('0x70'));}else{_0x3a0a94[_0xda28('0x6f')]('`'+_0x5f4335[_0xda28('0x55')]+'`\x20>\x200');}break;case _0xda28('0x71'):if(_0x5f4335['operator']==='$substring'){if(_0x5f4335[_0xda28('0x6e')][_0xda28('0x3d')]('\x20')['length']>0x1){_0x53c379[_0x37f15d](_0xda28('0x72'),qs[_0xda28('0x73')](_0x5f4335[_0xda28('0x6e')]),null);}else{var _0x426d89='%'+_0x5f4335['value']+'%';_0x53c379[_0x37f15d](_0xda28('0x74'),_0x426d89,_0x426d89,_0x426d89);}}else{_0x1eb875=_[_0xda28('0x6c')](_0x572580,[_0xda28('0x38'),_0xda28('0x75')]);_0x5f4335['field']='ContactId';_0xdbcba3=as['buildExpression'](_0x53d6c7,_0x1eb875['type'],_0x5f4335);_0x53c379[_0x37f15d](_0xdbcba3['text'],_0xdbcba3[_0xda28('0x6e')][_0xda28('0x76')],_0xdbcba3[_0xda28('0x6e')][_0xda28('0x2d')]);}break;case _0xda28('0x77'):var _0x37880b=_0x5f4335[_0xda28('0x6e')][_0xda28('0x3d')](',')[_0xda28('0x40')](function(_0x2a7875){return Number(_0x2a7875);});_0x37880b['forEach'](function(_0x330f52){_0x55555d['or'](_0xda28('0x78'),'%,'+_0x330f52+',%');});_0x181ae0=_['union'](_0x181ae0,_0x37880b);break;case _0xda28('0x79'):if(_0x5f4335[_0xda28('0x7a')]===_0xda28('0x7b')){_0x53c379[_0x37f15d](_0xda28('0x7c'),'%'+_0x5f4335[_0xda28('0x6e')]+'%',null);}else{_0x1eb875=_[_0xda28('0x6c')](_0x572580,[_0xda28('0x38'),_0xda28('0x7d')]);_0x5f4335[_0xda28('0x55')]=_0xda28('0x7d');_0xdbcba3=as['buildExpression'](_0x53d6c7,_0x1eb875[_0xda28('0x43')],_0x5f4335);_0x53c379[_0x37f15d](_0xdbcba3['text'],_0xdbcba3['value'][_0xda28('0x76')],_0xdbcba3['value'][_0xda28('0x2d')]);}break;case _0xda28('0x7e'):_0xdbcba3=as['buildExpression']('me',null,_0x5f4335);_0x53c379[_0x37f15d](_0xdbcba3['text'],_0xdbcba3[_0xda28('0x6e')]['start'],_0xdbcba3[_0xda28('0x6e')][_0xda28('0x2d')]);break;}}else{var _0xdbcba3=as[_0xda28('0x7f')](_0x53d6c7,_0x1eb875[_0xda28('0x43')],_0x5f4335);_0x53c379[_0x37f15d](_0xdbcba3[_0xda28('0x80')],_0xdbcba3[_0xda28('0x6e')][_0xda28('0x76')],_0xdbcba3[_0xda28('0x6e')][_0xda28('0x2d')]);}}}else{var _0x4b0a52=_(_0x341743[_0xda28('0x46')])[_0xda28('0x47')]()['map'](function(_0x2d4552){return _[_0xda28('0x81')](_0x572580,[_0xda28('0x38'),_0x2d4552])?_0x2d4552:undefined;})[_0xda28('0x82')]()[_0xda28('0x6e')]();if(!_[_0xda28('0x83')](_0x4b0a52)){_0x4b0a52['forEach'](function(_0x2379ac){if(_0x2379ac===_0xda28('0x84')){_0x3a0a94[_0xda28('0x52')](_0xda28('0x85'),[][_0xda28('0x86')](_0x341743[_0xda28('0x46')][_0x2379ac]));}else if(_0x2379ac==='createdAt'){var _0x3ebd6b=JSON[_0xda28('0x87')](_0x341743['query'][_0x2379ac])['$gte'];var _0x3bb00a=JSON[_0xda28('0x87')](_0x341743[_0xda28('0x46')][_0x2379ac])[_0xda28('0x88')];_0x3a0a94[_0xda28('0x52')](_0xda28('0x89'),_0x3ebd6b,_0x3bb00a);}else{if(_0x341743[_0xda28('0x46')][_0x2379ac]===_0xda28('0x8a')){_0x3a0a94[_0xda28('0x52')]('i.'+_0x2379ac+_0xda28('0x8b'));}else{_0x3a0a94[_0xda28('0x52')]('i.'+_0x2379ac+_0xda28('0x8c'),_0x341743[_0xda28('0x46')][_0x2379ac]);}}});}if(_0x341743['query']['read']){if(_0x341743[_0xda28('0x46')][_0xda28('0x8d')]==0x1){_0x3a0a94[_0xda28('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x3a0a94[_0xda28('0x6f')](_0xda28('0x8e'));}}if(_0x341743[_0xda28('0x46')]['tag']){_0x181ae0=_[_0xda28('0x8f')](_0x341743[_0xda28('0x46')]['tag'])?_0x341743['query'][_0xda28('0x90')]:new Array(_0x341743[_0xda28('0x46')][_0xda28('0x90')]);_0x181ae0['forEach'](function(_0xdb6c3d){_0x55555d['or'](_0xda28('0x78'),'%,'+_0xdb6c3d+',%');});}if(_0x341743[_0xda28('0x46')][_0xda28('0x91')]){var _0x2c00b6=_0x341743['query'][_0xda28('0x91')][_0xda28('0x92')]('\x5c','\x5c\x5c')[_0xda28('0x92')](/'/g,'\x27\x27');if(qs[_0xda28('0x93')](_0x2c00b6)){_0x53c379['or']('i.id\x20LIKE\x20?',_0x2c00b6+'%');}else{_0x53c379['or'](_0xda28('0x94'),qs[_0xda28('0x73')](_0x2c00b6))['or'](_0xda28('0x95'),_0x2c00b6+'%');}}}_0x3a0a94[_0xda28('0x52')](_0x53c379);_0x3a0a94[_0xda28('0x96')]('i.id');var _0x1c3727={'type':db[_0xda28('0x97')][_0xda28('0x98')][_0xda28('0x99')],'raw':!![]};var _0x2759cc=_0x3a0a94['clone']();_0x2759cc[_0xda28('0x55')](_0xda28('0x9a'));_0x2759cc[_0xda28('0x55')](_0xda28('0x9b'),_0xda28('0x6d'));if(_0x276a34['order']){_0x276a34['order'][_0xda28('0x9c')](function(_0xd863f5){var _0x2e3aa8=_0xd863f5[0x0]===_0xda28('0x9d')?_0xd863f5[0x0]:'i.'+_0xd863f5[0x0];_0x3a0a94[_0xda28('0x50')](_0x2e3aa8,_0xd863f5[0x1]==='DESC'?![]:!![]);});}if(!_[_0xda28('0x83')](_0x181ae0)){_0x3a0a94[_0xda28('0x6f')](_0x55555d);_0x2759cc[_0xda28('0x52')](_0xda28('0x9e'),_0x181ae0);}BPromise[_0xda28('0x9f')]()[_0xda28('0x20')](function(){if(!_0x3a37e5){if(_0x341743[_0xda28('0x46')][_0xda28('0x84')])return;_0x2759cc[_0xda28('0x52')](_0xda28('0xa0'));_0x3a0a94[_0xda28('0x52')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x341743['user'][_0xda28('0xa1')]!==_0xda28('0xa2'))return;return _0x341743[_0xda28('0xa3')][_0xda28('0xa4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x29edae){if(_['isEmpty'](_0x29edae)){_0x2759cc[_0xda28('0x52')](_0xda28('0xa5'));_0x3a0a94['where'](_0xda28('0xa5'));}else{_0x2759cc[_0xda28('0x52')](_0xda28('0x85'),_[_0xda28('0x40')](_0x29edae,'id'));_0x3a0a94['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xda28('0x40')](_0x29edae,'id'));}});})[_0xda28('0x20')](function(){if(_0x341743[_0xda28('0xa3')][_0xda28('0xa1')]===_0xda28('0xa2')&&!_0x3a37e5&&!_0x341743[_0xda28('0x46')][_0xda28('0x84')])return[];return db[_0xda28('0xa6')][_0xda28('0x46')](_0x2759cc[_0xda28('0xa7')](),_0x1c3727);})[_0xda28('0x20')](function(_0x418fb6){_0x3c8271[_0xda28('0x2f')]=_0x418fb6[_0xda28('0x4c')];if(_0x3c8271[_0xda28('0x2f')]===0x0)return[];return db['sequelize'][_0xda28('0x46')](_0x453ba3[_0xda28('0xa7')](),_0x1c3727)[_0xda28('0x20')](function(_0x36f1f2){_0x328d5a=_[_0xda28('0xa8')](_0x36f1f2,'id');_0x1c3727=_[_0xda28('0xa9')](_0x1c3727,{'model':db[_0xda28('0xaa')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x341743['query'][_0xda28('0x4b')]){_0x276a34['attributes'][_0xda28('0x9c')](function(_0x386314){_0x3a0a94['field']('i.'+_0x386314);});}else{_0x3a0a94['field'](_0xda28('0x9b'),'unreadMessages');_0x3a0a94[_0xda28('0x55')]('a.key',_0xda28('0xab'));_0x3a0a94[_0xda28('0x55')]('a.mandatoryDisposition',_0xda28('0xac'));_0x3a0a94[_0xda28('0x55')](_0xda28('0xad'),_0xda28('0x9d'));_0x3a0a94[_0xda28('0x55')]('i.*');_0x3a0a94[_0xda28('0x55')](_0xda28('0xae'),_0xda28('0xaf'));_0x3a0a94['field'](_0xda28('0xb0'),_0xda28('0xb1'));_0x3a0a94[_0xda28('0x55')](_0xda28('0xb2'),'Contact.email');_0x3a0a94[_0xda28('0x55')](_0xda28('0xb3'),_0xda28('0xb4'));_0x3a0a94[_0xda28('0x55')](_0xda28('0xb5'),_0xda28('0xb6'));_0x3a0a94[_0xda28('0x55')](_0xda28('0xb7'),'Contact.fax');_0x3a0a94[_0xda28('0x55')]('o.fullname',_0xda28('0xb8'));_0x3a0a94['field']('o.internal',_0xda28('0xb9'));_0x3a0a94[_0xda28('0x55')](_0xda28('0xba'),_0xda28('0x3b'));}if(_0x276a34[_0xda28('0x30')])_0x3a0a94[_0xda28('0x30')](_0x276a34[_0xda28('0x30')]);if(_0x276a34[_0xda28('0x4f')])_0x3a0a94[_0xda28('0x4f')](_0x276a34[_0xda28('0x4f')]);return db[_0xda28('0xa6')][_0xda28('0x46')](_0x3a0a94[_0xda28('0xa7')](),_0x1c3727);})[_0xda28('0x20')](function(_0x58108e){_0x48f542[_0xda28('0x52')](_0xda28('0xbb'),_['map'](_0x58108e,'id'));return db[_0xda28('0xa6')][_0xda28('0x46')](_0x48f542[_0xda28('0xa7')](),_0x1c3727)[_0xda28('0x20')](function(_0x50edb2){var _0x3a67cd=_[_0xda28('0xbc')](_0x50edb2,'ChatInteractionId');var _0x5373fd=[];_0x58108e[_0xda28('0x9c')](function(_0x2953a0){_0x5373fd[_0xda28('0x3e')](updateChatInteraction(_0x2953a0,_0x328d5a,_0x3a67cd));});return BPromise[_0xda28('0xbd')](_0x5373fd);});});})['then'](function(_0x347f4d){_0x3c8271[_0xda28('0xbe')]=_0x347f4d;return _0x3c8271;})[_0xda28('0x20')](respondWithFilteredResult(_0x144132,_0x276a34))[_0xda28('0x2a')](handleError(_0x144132,null));};exports[_0xda28('0xbf')]=function(_0x2a8e4a,_0x5a4cfb){var _0x495a88={'raw':![],'where':{'id':_0x2a8e4a['params']['id']}},_0x208855={};_0x208855[_0xda28('0x45')]=_[_0xda28('0x47')](db[_0xda28('0xaa')]['rawAttributes']);_0x208855[_0xda28('0x46')]=_[_0xda28('0x47')](_0x2a8e4a[_0xda28('0x46')]);_0x208855[_0xda28('0x48')]=_[_0xda28('0x4a')](_0x208855['model'],_0x208855[_0xda28('0x46')]);_0x495a88[_0xda28('0x49')]=_[_0xda28('0x4a')](_0x208855['model'],qs[_0xda28('0x4b')](_0x2a8e4a['query']['fields']));_0x495a88[_0xda28('0x49')]=_0x495a88[_0xda28('0x49')][_0xda28('0x4c')]?_0x495a88[_0xda28('0x49')]:_0x208855[_0xda28('0x45')];if(_0x2a8e4a['query'][_0xda28('0xc0')]){_0x495a88[_0xda28('0xc1')]=[{'all':!![]}];}_0x495a88=_[_0xda28('0xa9')]({},_0x495a88,_0x2a8e4a['options']);return db['ChatInteraction'][_0xda28('0x6c')](_0x495a88)[_0xda28('0x20')](handleEntityNotFound(_0x5a4cfb,null))[_0xda28('0x20')](respondWithResult(_0x5a4cfb,null))['catch'](handleError(_0x5a4cfb,null));};exports[_0xda28('0xc2')]=function(_0x4cc0bc,_0x2ea6f5){return db[_0xda28('0xaa')][_0xda28('0xc2')](_0x4cc0bc[_0xda28('0x7e')],{})['then'](respondWithResult(_0x2ea6f5,0xc9))[_0xda28('0x2a')](handleError(_0x2ea6f5,null));};exports[_0xda28('0x35')]=function(_0xd40a51,_0x37f4f9){if(_0xd40a51[_0xda28('0x7e')]['id']){delete _0xd40a51['body']['id'];}return db[_0xda28('0xaa')][_0xda28('0x6c')]({'where':{'id':_0xd40a51[_0xda28('0xc3')]['id']}})[_0xda28('0x20')](handleEntityNotFound(_0x37f4f9,null))[_0xda28('0x20')](saveUpdates(_0xd40a51['body'],null))[_0xda28('0x20')](respondWithResult(_0x37f4f9,null))['catch'](handleError(_0x37f4f9,null));};exports[_0xda28('0x36')]=function(_0x43d50c,_0x16f15d){return db['ChatInteraction'][_0xda28('0x6c')]({'where':{'id':_0x43d50c[_0xda28('0xc3')]['id']}})[_0xda28('0x20')](handleEntityNotFound(_0x16f15d,null))[_0xda28('0x20')](removeEntity(_0x16f15d,null))[_0xda28('0x2a')](handleError(_0x16f15d,null));};exports[_0xda28('0xc4')]=function(_0x1e3905,_0x577b66){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x577b66,null))['catch'](handleError(_0x577b66,null));};exports['createVidaooSession']=function(_0x4d6045,_0x115241){var _0x1b91f5=_0x4d6045[_0xda28('0xc3')]['id'];var _0x2d6722;var _0x3005c2;var _0x1aa4e6;return db[_0xda28('0xaa')]['findOne']({'where':{'id':_0x1b91f5}})[_0xda28('0x20')](function(_0x551cbb){_0x2d6722=_0x551cbb;return db[_0xda28('0xc5')][_0xda28('0xc6')]({'where':{'id':_0x551cbb[_0xda28('0x84')]},'attributes':['id',_0xda28('0xc7'),_0xda28('0xc8')],'raw':!![]});})[_0xda28('0x20')](function(_0x158d52){if(_0x158d52&&_0x158d52[_0xda28('0xc7')]&&_0x158d52['vidaooEscalation']){_0x3005c2=_0x158d52;var _0x2cd591={'rejectUnauthorized':![],'method':_0xda28('0xc9'),'uri':_0xda28('0xca'),'headers':{'X-APIKEY':_0x158d52[_0xda28('0xc7')]},'body':{'name':'MotionCWB:'+_0x1b91f5},'redirect':'follow','json':!![]};return rp(_0x2cd591);}else{throw new db[(_0xda28('0x97'))][(_0xda28('0xcb'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xda28('0x20')](function(_0x5dc143){_0x1aa4e6=_0x5dc143;if(_0x1aa4e6['id']){var _0x2ec049={'body':_0x1aa4e6[_0xda28('0xcc')],'ChatWebsiteId':_0x3005c2['id'],'ChatInteractionId':_0x2d6722['id'],'direction':_0xda28('0xcd'),'UserId':_0x4d6045[_0xda28('0xa3')]['id']};return db[_0xda28('0xce')]['create'](_0x2ec049,{});}else{throw new db[(_0xda28('0x97'))][(_0xda28('0xcb'))](_0xda28('0xcf'));}})[_0xda28('0x20')](function(){return _0x2d6722['updateAttributes']({'vidaooSessionId':_0x1aa4e6['id']});})[_0xda28('0x20')](respondWithResult(_0x115241,null))[_0xda28('0x2a')](handleError(_0x115241,null));};exports[_0xda28('0xd0')]=function(_0x896674,_0x2b9855){if(_0x896674['body']['id']){delete _0x896674[_0xda28('0x7e')]['id'];}return db[_0xda28('0xaa')][_0xda28('0x6c')]({'where':{'id':_0x896674['params']['id']},'include':[{'model':db[_0xda28('0xd1')],'as':_0xda28('0x71')}]})[_0xda28('0x20')](handleEntityNotFound(_0x2b9855,null))[_0xda28('0x20')](saveUpdates(_0x896674[_0xda28('0x7e')],null))[_0xda28('0x20')](respondWithResult(_0x2b9855,null))['catch'](handleError(_0x2b9855,null));};exports['abandon']=function(_0x2e0031,_0x5e5947,_0x369d2c){if(_0x2e0031[_0xda28('0x7e')]['id']){delete _0x2e0031[_0xda28('0x7e')]['id'];}return db[_0xda28('0xaa')]['find']({'where':{'id':_0x2e0031['params']['id']}})['then'](function(_0x1c1ac8){if(!_0x1c1ac8){logger[_0xda28('0x26')](_0xda28('0xd2'),_0xda28('0xd3'),0x194,_0xda28('0xd4'));_0x5e5947[_0xda28('0x2b')](0x194);}else{if(_0x1c1ac8[_0xda28('0x7d')]){throw new db[(_0xda28('0x97'))][(_0xda28('0xcb'))](_0xda28('0xd5'));}}return _0x1c1ac8;})[_0xda28('0x20')](function(_0x29fd39){if(_0x29fd39){return _0x29fd39[_0xda28('0x35')]({'closed':_0x2e0031['body']['closed'],'disposition':_0x2e0031['body'][_0xda28('0xd6')]})['then'](function(_0xf334b7){return _0xf334b7;});}})[_0xda28('0x20')](function(_0x313a2b){return respondWithRpcPromise('AbandonInteraction',_0xda28('0xd3'),_0x2e0031[_0xda28('0x7e')],client9004);})[_0xda28('0x20')](respondWithResult(_0x5e5947,null))['catch'](handleError(_0x5e5947,null));};exports[_0xda28('0xd7')]=function(_0x86c9e,_0x30a65f,_0x21a5b3){_0x86c9e[_0xda28('0x7e')][_0xda28('0x38')]=_0x86c9e[_0xda28('0xd8')][_0xda28('0xd9')];_0x86c9e[_0xda28('0x7e')][_0xda28('0xda')]=_0x86c9e[_0xda28('0xd8')]['filename'];_0x86c9e[_0xda28('0x7e')][_0xda28('0x43')]=_0x86c9e[_0xda28('0xd8')]['mimetype'];return db[_0xda28('0xdb')][_0xda28('0xc2')](_0x86c9e[_0xda28('0x7e')])[_0xda28('0x20')](respondWithResult(_0x30a65f,0xc9))[_0xda28('0x2a')](handleError(_0x30a65f,null));};exports[_0xda28('0xdc')]=function(_0x316f5f,_0x17ccef,_0x52725b){return db[_0xda28('0xaa')]['findOne']({'where':{'id':_0x316f5f[_0xda28('0xc3')]['id']},'raw':!![]})[_0xda28('0x20')](handleEntityNotFound(_0x17ccef,null))['then'](function(_0x1cdfec){if(_0x1cdfec){if(_0x1cdfec[_0xda28('0xdd')]){return _0x17ccef['status'](0x193)[_0xda28('0x2e')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0xda28('0xc6')]({'where':{'id':_0x316f5f[_0xda28('0x46')][_0xda28('0xde')]},'raw':!![]})[_0xda28('0x20')](handleEntityNotFound(_0x17ccef,null));}})[_0xda28('0x20')](function(_0xa33309){if(_0xa33309){return _0x17ccef[_0xda28('0xdf')](path[_0xda28('0xe0')](config[_0xda28('0xe1')],_0xda28('0xe2'),_0xa33309[_0xda28('0xda')]));}})[_0xda28('0x2a')](handleError(_0x17ccef,null));};exports[_0xda28('0xe3')]=function(_0x3af8c6,_0x19df04){var _0x5c93b8=null;var _0x3c8a49=null;var _0x54d259=null;var _0x283ba0=null;if(_0x3af8c6[_0xda28('0x7e')]['id']){delete _0x3af8c6[_0xda28('0x7e')]['id'];}if(_0x3af8c6[_0xda28('0x7e')]['mailTranscript']){_0x283ba0=path[_0xda28('0xe0')](config[_0xda28('0xe1')],_0xda28('0xe4'),util[_0xda28('0xe5')](_0xda28('0xe6'),Date['now']()));_0x3af8c6[_0xda28('0x7e')][_0xda28('0xe7')]=_0x283ba0;}return db[_0xda28('0xaa')]['find']({'where':{'id':_0x3af8c6[_0xda28('0xc3')]['id']},'include':[{'model':db[_0xda28('0xce')],'as':_0xda28('0xe8'),'include':[{'model':db[_0xda28('0x79')],'as':_0xda28('0x79')}]}]})[_0xda28('0x20')](handleEntityNotFound(_0x19df04,null))[_0xda28('0x20')](saveUpdates(_0x3af8c6['body'],null))[_0xda28('0x20')](function(_0x346969){if(_0x346969){_0x5c93b8=_0x346969;return db[_0xda28('0xc5')][_0xda28('0x6c')]({'where':{'id':_0x5c93b8[_0xda28('0x84')]}});}})[_0xda28('0x20')](function(_0x4cda73){if(_0x4cda73){_0x54d259=_0x4cda73;return db['CmContact'][_0xda28('0x6c')]({'where':{'id':_0x5c93b8[_0xda28('0x75')]}});}})['then'](function(_0x2b5f10){if(_0x2b5f10){_0x3c8a49=_0x2b5f10;if(_0x283ba0){var _0xa40d6f=null;for(var _0x416d52=0x1;_0x416d52<_0x5c93b8[_0xda28('0xe8')][_0xda28('0x4c')];++_0x416d52){_0xa40d6f=_0x5c93b8[_0xda28('0xe8')][_0x416d52];var _0x1bc23d=_0xa40d6f[_0xda28('0x7d')]?util['format'](_0xda28('0xe9'),_0x54d259[_0xda28('0xea')],_0xa40d6f[_0xda28('0x7d')]):_0xda28('0xeb');var _0xfb5409=_0x3af8c6[_0xda28('0x7e')][_0xda28('0xec')]||util[_0xda28('0xe5')](_0xda28('0xe9'),_0xda28('0xed'),_0xa40d6f[_0xda28('0x75')]);switch(_0x54d259[_0xda28('0xee')]){case _0xda28('0xef'):_0x1bc23d=_0xa40d6f['UserId']?util[_0xda28('0xe5')](_0xda28('0xe9'),_0x54d259[_0xda28('0xea')],_0xa40d6f[_0xda28('0x7d')]):_0xda28('0xeb');break;case _0xda28('0xf0'):_0x1bc23d=_0xa40d6f[_0xda28('0x7d')]?_0xa40d6f[_0xda28('0x79')]['alias']||_0xa40d6f[_0xda28('0x79')][_0xda28('0xf1')]:'System';break;case _0xda28('0xf2'):_0x1bc23d=_0xa40d6f[_0xda28('0x7d')]?_0xa40d6f['User'][_0xda28('0xf1')]:_0xda28('0xeb');break;default:_0x1bc23d=_0xa40d6f[_0xda28('0x7d')]?util['format'](_0xda28('0xe9'),_0x54d259[_0xda28('0xea')],_0xa40d6f['UserId']):_0xda28('0xeb');}var _0x882b96=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xa40d6f[_0xda28('0xf3')])[_0xda28('0xe5')](_0xda28('0xf4')),_0xa40d6f['direction']==='in'?_0xfb5409:_0x1bc23d,_0xa40d6f[_0xda28('0x7e')]);if(!_0xa40d6f[_0xda28('0xf5')]){fs['appendFileSync'](_0x283ba0,_0x882b96);}}return db['MailAccount'][_0xda28('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0xda28('0xf6')],'as':_0xda28('0xf7'),'raw':!![]}]});}}})[_0xda28('0x20')](function(_0x258218){if(_0x258218&&_0x258218[_0xda28('0xf7')]&&_0x3af8c6['body']){var _0x4e17ea={'tls':{'rejectUnauthorized':![]}};if(_0x258218['Smtp'][_0xda28('0xf8')]){_0x4e17ea[_0xda28('0xf8')]=_0x258218[_0xda28('0xf7')][_0xda28('0xf8')];}else{_0x4e17ea[_0xda28('0xf9')]=_0x258218[_0xda28('0xf7')]['host'];_0x4e17ea['port']=_0x258218[_0xda28('0xf7')][_0xda28('0xfa')];_0x4e17ea['secure']=_0x258218[_0xda28('0xf7')][_0xda28('0xfb')];}if(_0x258218[_0xda28('0xf7')][_0xda28('0xfc')]){_0x4e17ea[_0xda28('0xfd')]={'user':_0x258218[_0xda28('0xf7')][_0xda28('0xa3')],'pass':_0x258218[_0xda28('0xf7')][_0xda28('0xfe')]};}return respondWithRpcPromise(_0xda28('0xff'),_0xda28('0x100'),{'account':_0x4e17ea,'message':{'from':util[_0xda28('0xe5')]('\x22%s\x22\x20<%s>',_0x258218[_0xda28('0x38')],_0x258218[_0xda28('0x101')]||_0x258218[_0xda28('0xf7')][_0xda28('0xa3')]),'to':_0x3af8c6[_0xda28('0x7e')][_0xda28('0x102')],'subject':_0xda28('0x103'),'text':util[_0xda28('0xe5')](_0xda28('0x104'),_0x3af8c6[_0xda28('0x7e')]['mailTranscript']),'attachments':[{'path':_0x283ba0}]}})['then'](function(){return _0x5c93b8;})['catch'](function(_0x5ecc18){console[_0xda28('0x26')](_0x5ecc18);});}else{return _0x5c93b8;}})[_0xda28('0x20')](respondWithStatusCode(_0x19df04,0xc8))[_0xda28('0x2a')](handleError(_0x19df04,null));};exports[_0xda28('0x105')]=function(_0x1b1fa3,_0x357160,_0x4a61a6){return db[_0xda28('0xce')][_0xda28('0x6c')]({'where':{'id':_0x1b1fa3[_0xda28('0xc3')]['id']}})[_0xda28('0x20')](handleEntityNotFound(_0x357160,null))['then'](function(_0x3fef46){if(_0x3fef46){return _0x3fef46['addMessage'](_0x1b1fa3['body'][_0xda28('0x106')],_[_0xda28('0x107')](_0x1b1fa3[_0xda28('0x7e')],['ids','id'])||{});}})['then'](respondWithResult(_0x357160,null))[_0xda28('0x2a')](handleError(_0x357160,null));};exports[_0xda28('0x108')]=function(_0x380fd8,_0x5dec47,_0x456815){var _0x4579a9={'raw':![],'where':{}};var _0x1907ee={};var _0x223262={'count':0x0,'rows':[]};return db[_0xda28('0xaa')][_0xda28('0xc6')]({'where':{'id':_0x380fd8[_0xda28('0xc3')]['id']}})[_0xda28('0x20')](handleEntityNotFound(_0x5dec47,null))['then'](function(_0x289760){if(_0x289760){_0x1907ee[_0xda28('0x45')]=_[_0xda28('0x47')](db[_0xda28('0xce')][_0xda28('0x41')]);_0x1907ee['query']=_[_0xda28('0x47')](_0x380fd8['query']);_0x1907ee[_0xda28('0x48')]=_[_0xda28('0x4a')](_0x1907ee['model'],_0x1907ee[_0xda28('0x46')]);_0x4579a9[_0xda28('0x49')]=_[_0xda28('0x4a')](_0x1907ee[_0xda28('0x45')],qs[_0xda28('0x4b')](_0x380fd8[_0xda28('0x46')]['fields']));_0x4579a9['attributes']=_0x4579a9[_0xda28('0x49')][_0xda28('0x4c')]?_0x4579a9[_0xda28('0x49')]:_0x1907ee[_0xda28('0x45')];if(!_0x380fd8[_0xda28('0x46')][_0xda28('0x4d')]('nolimit')){_0x4579a9['limit']=qs[_0xda28('0x30')](_0x380fd8['query']['limit']);_0x4579a9[_0xda28('0x4f')]=qs[_0xda28('0x4f')](_0x380fd8['query'][_0xda28('0x4f')]);}_0x4579a9[_0xda28('0x50')]=qs[_0xda28('0x51')](_0x380fd8[_0xda28('0x46')][_0xda28('0x51')]);_0x4579a9[_0xda28('0x52')]=qs[_0xda28('0x48')](_[_0xda28('0x53')](_0x380fd8[_0xda28('0x46')],_0x1907ee[_0xda28('0x48')]));_0x4579a9['where'][_0xda28('0x109')]=_0x289760['id'];if(_0x380fd8['query'][_0xda28('0x91')]){_0x4579a9[_0xda28('0x52')]=_['merge'](_0x4579a9[_0xda28('0x52')],{'$or':_[_0xda28('0x40')](_0x4579a9[_0xda28('0x49')],function(_0x2d480d){var _0x1fe039={};_0x1fe039[_0x2d480d]={'$like':'%'+_0x380fd8[_0xda28('0x46')][_0xda28('0x91')]+'%'};return _0x1fe039;})});}if(_0x380fd8[_0xda28('0x46')][_0xda28('0x10a')]){var _0x2afa07=_0x380fd8['query'][_0xda28('0x10a')][_0xda28('0x3d')](',');var _0xcbf556={};_0xcbf556[_0x2afa07[0x0]]={'$gte':moment(_0x2afa07[0x1])[_0xda28('0xe5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4579a9[_0xda28('0x52')]=_[_0xda28('0xa9')](_0x4579a9['where'],_0xcbf556);}_0x4579a9=_['merge']({},_0x4579a9,_0x380fd8['options']);return db[_0xda28('0xce')][_0xda28('0x2f')]({'where':_0x4579a9['where']})[_0xda28('0x20')](function(_0xfec1f6){_0x223262['count']=_0xfec1f6;if(_0x380fd8[_0xda28('0x46')][_0xda28('0xc0')]){_0x4579a9['include']=[{'all':!![]}];}return db[_0xda28('0xce')][_0xda28('0x10b')](_0x4579a9);})[_0xda28('0x20')](function(_0xa7756){_0x223262[_0xda28('0xbe')]=_0xa7756;return _0x223262;});}})[_0xda28('0x20')](respondWithFilteredResult(_0x5dec47,_0x4579a9))[_0xda28('0x2a')](handleError(_0x5dec47,null));};exports[_0xda28('0x10c')]=function(_0x2f90b3,_0x58cc47,_0x2053bf){var _0x31be4d={'where':{}},_0x3e1ecf={},_0x11003c={'count':0x0,'rows':[]};return db[_0xda28('0xaa')][_0xda28('0xc6')]({'where':{'id':_0x2f90b3[_0xda28('0xc3')]['id']}})[_0xda28('0x20')](handleEntityNotFound(_0x58cc47,null))[_0xda28('0x20')](function(_0x56b8d5){if(_0x56b8d5){_0x3e1ecf['model']=_['keys'](db[_0xda28('0xce')]['rawAttributes']);_0x3e1ecf[_0xda28('0x46')]=_[_0xda28('0x47')](_0x2f90b3[_0xda28('0x46')]);_0x3e1ecf[_0xda28('0x48')]=_[_0xda28('0x4a')](_0x3e1ecf['model'],_0x3e1ecf[_0xda28('0x46')]);_0x31be4d[_0xda28('0x49')]=_[_0xda28('0x4a')](_0x3e1ecf[_0xda28('0x45')],qs[_0xda28('0x4b')](_0x2f90b3[_0xda28('0x46')][_0xda28('0x4b')]));_0x31be4d[_0xda28('0x49')]=_0x31be4d[_0xda28('0x49')][_0xda28('0x4c')]?_0x31be4d[_0xda28('0x49')]:_0x3e1ecf[_0xda28('0x45')];if(!_0x2f90b3[_0xda28('0x46')][_0xda28('0x4d')](_0xda28('0x4e'))){_0x31be4d['limit']=qs[_0xda28('0x30')](_0x2f90b3[_0xda28('0x46')][_0xda28('0x30')]);_0x31be4d['offset']=qs['offset'](_0x2f90b3[_0xda28('0x46')][_0xda28('0x4f')]);}_0x31be4d['order']=qs[_0xda28('0x51')](_0x2f90b3['query'][_0xda28('0x51')]);_0x31be4d['where']=qs[_0xda28('0x48')](_['pick'](_0x2f90b3[_0xda28('0x46')],_0x3e1ecf[_0xda28('0x48')]));_0x31be4d[_0xda28('0x52')]['ChatInteractionId']=_0x56b8d5['id'];if(_0x2f90b3[_0xda28('0x46')][_0xda28('0x91')]){_0x31be4d[_0xda28('0x52')]=_[_0xda28('0xa9')](_0x31be4d[_0xda28('0x52')],{'$or':_[_0xda28('0x40')](_0x31be4d[_0xda28('0x49')],function(_0x2aff10){var _0x3b6404={};_0x3b6404[_0x2aff10]={'$like':'%'+_0x2f90b3[_0xda28('0x46')][_0xda28('0x91')]+'%'};return _0x3b6404;})});}_0x31be4d[_0xda28('0x52')][_0xda28('0xf5')]=![];if(_0x2f90b3[_0xda28('0x46')]['id']){_0x31be4d['where']['id']={'$gt':_0x2f90b3[_0xda28('0x46')]['id']};}_0x31be4d=_['merge']({},_0x31be4d,_0x2f90b3['options']);return db[_0xda28('0xce')][_0xda28('0x2f')]({'where':_0x31be4d[_0xda28('0x52')]})['then'](function(_0x45aee6){_0x11003c['count']=_0x45aee6;_0x31be4d['include']=[];if(_0x2f90b3['query']['includeAgent']){_0x31be4d[_0xda28('0xc1')][_0xda28('0x3e')]({'model':db[_0xda28('0x79')],'as':_0xda28('0x79'),'attributes':['id',_0xda28('0xf1'),_0xda28('0x10d')]});}if(_0x2f90b3[_0xda28('0x46')][_0xda28('0xc0')]){_0x31be4d['include']=[{'all':!![]}];}return db[_0xda28('0xce')][_0xda28('0x10b')](_0x31be4d);})[_0xda28('0x20')](function(_0x409121){_0x11003c[_0xda28('0xbe')]=_0x409121;return _0x11003c;});}})[_0xda28('0x20')](respondWithFilteredResult(_0x58cc47,_0x31be4d))[_0xda28('0x2a')](handleError(_0x58cc47,null));};exports[_0xda28('0x10e')]=function(_0x31aa22,_0x1940ec,_0xc420dc){return db[_0xda28('0xaa')][_0xda28('0x6c')]({'where':{'id':_0x31aa22[_0xda28('0xc3')]['id']}})[_0xda28('0x20')](handleEntityNotFound(_0x1940ec,null))['then'](function(_0x28d9ca){if(_0x28d9ca){return _0x28d9ca[_0xda28('0x10f')](_0x31aa22[_0xda28('0x7e')][_0xda28('0x106')],_[_0xda28('0x107')](_0x31aa22[_0xda28('0x7e')],[_0xda28('0x106'),'id'])||{})[_0xda28('0x110')](function(){return db[_0xda28('0x77')][_0xda28('0x10b')]({'attributes':['id','name',_0xda28('0x56')],'where':{'id':_0x31aa22[_0xda28('0x7e')][_0xda28('0x106')]}});})[_0xda28('0x20')](function(_0xac201c){socket['emit'](_0xda28('0x111'),{'id':Number(_0x31aa22[_0xda28('0xc3')]['id']),'tags':_0xac201c||[]});return{'id':Number(_0x31aa22['params']['id']),'tags':_0xac201c||[]};});}})[_0xda28('0x20')](respondWithResult(_0x1940ec,null))['catch'](handleError(_0x1940ec,null));};exports[_0xda28('0x112')]=function(_0xa8b6df,_0x5eb2c5,_0x514cff){return db[_0xda28('0xaa')]['find']({'where':{'id':_0xa8b6df[_0xda28('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5eb2c5,null))['then'](function(_0x379275){if(_0x379275){return _0x379275[_0xda28('0x112')](_0xa8b6df[_0xda28('0x46')][_0xda28('0x106')]);}})[_0xda28('0x20')](respondWithStatusCode(_0x5eb2c5,null))['catch'](handleError(_0x5eb2c5,null));};exports[_0xda28('0xdf')]=function(_0x24c2f5,_0x8a4f73){var _0x3bee79=moment()[_0xda28('0x113')]()[_0xda28('0xa7')]();var _0x23e95f=path[_0xda28('0xe0')](config['root'],_0xda28('0x114'),'files',_0xda28('0x115'));var _0x36168e=path[_0xda28('0xe0')](config[_0xda28('0xe1')],_0xda28('0x114'),_0xda28('0x116'),'attachments');var _0x108580=path['join'](_0x23e95f,_0x3bee79);var _0x11d4c4=util[_0xda28('0xe5')](_0xda28('0x117'),_0x24c2f5[_0xda28('0xc3')]['id'],_0x3bee79);var _0x4a5090=path[_0xda28('0xe0')](_0x23e95f,_0x11d4c4);var _0x4fe983=[];_0x4fe983[_0xda28('0x3e')]({'model':db[_0xda28('0x79')],'as':'User','attributes':['id',_0xda28('0xf1')],'raw':!![]});_0x4fe983['push']({'model':db[_0xda28('0xd1')],'as':_0xda28('0x71'),'attributes':['id',_0xda28('0x118'),_0xda28('0x119')],'raw':!![]});if(_0x24c2f5[_0xda28('0x46')][_0xda28('0x11a')]){_0x4fe983[_0xda28('0x3e')]({'model':db[_0xda28('0xdb')],'as':_0xda28('0xdb'),'raw':!![]});}var _0x36a16b=[{'model':db[_0xda28('0xce')],'as':'Messages','attributes':['id','body',_0xda28('0xf3'),_0xda28('0x11b'),_0xda28('0xf5'),_0xda28('0x8d')],'include':_0x4fe983}];_0x36a16b['push']({'model':db[_0xda28('0xc5')],'as':_0xda28('0x11c'),'attributes':['id',_0xda28('0x38')]});_0x36a16b[_0xda28('0x3e')]({'model':db[_0xda28('0x79')],'as':_0xda28('0x11d'),'attributes':['id',_0xda28('0xf1')]});return db['ChatInteraction'][_0xda28('0x6c')]({'where':{'id':_0x24c2f5[_0xda28('0xc3')]['id']},'include':_0x36a16b})[_0xda28('0x20')](handleEntityNotFound(_0x8a4f73,null))[_0xda28('0x20')](function(_0x5c3752){if(_0x5c3752){var _0x4f62d2=_0x5c3752[_0xda28('0x11e')]({'plain':!![]});fs[_0xda28('0x11f')](_0x108580);var _0x4cf05e={'format':'A4','border':_0xda28('0x120'),'header':{'height':_0xda28('0x121'),'contents':{'first':_0xda28('0x122')}},'footer':{'height':_0xda28('0x123'),'contents':{'default':util[_0xda28('0xe5')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xda28('0xe5')](_0xda28('0x124'),_0xda28('0x125'),_0x4f62d2['id']),moment()['format'](_0xda28('0x126'))[_0xda28('0xa7')]())}}};var _0xf7ac94={'channel':_0xda28('0x125'),'account':_0x4f62d2[_0xda28('0x11c')]['name'],'agent':_0x4f62d2[_0xda28('0x11d')]?_0x4f62d2[_0xda28('0x11d')][_0xda28('0xf1')]:_0xda28('0x127'),'createdAt':moment(_0x4f62d2[_0xda28('0xf3')])['format'](_0xda28('0x128'))[_0xda28('0xa7')](),'closedAt':_0x4f62d2[_0xda28('0xdd')]?moment(_0x4f62d2[_0xda28('0x129')])[_0xda28('0xe5')](_0xda28('0x128'))[_0xda28('0xa7')]():'','disposition':_0x4f62d2[_0xda28('0xd6')],'chatInfo':{'browser':_0x4f62d2['browserName'],'os':_0x4f62d2[_0xda28('0x12a')],'referer':_0x4f62d2[_0xda28('0x12b')],'customerIp':_0x4f62d2[_0xda28('0x12c')],'customerPort':_0x4f62d2['customerPort']?_0x4f62d2['customerPort']:_0xda28('0x127')},'messages':_(_0x4f62d2[_0xda28('0xe8')])['tail']()[_0xda28('0x91')]({'secret':![]})[_0xda28('0x40')](function(_0x43f917){if(_0x43f917[_0xda28('0xdb')]){var _0x2f2e72=path[_0xda28('0xe0')](_0x36168e,_0x43f917[_0xda28('0xdb')][_0xda28('0xda')]);if(fs[_0xda28('0x12d')](_0x2f2e72)){fs[_0xda28('0x12e')](_0x2f2e72)['pipe'](fs[_0xda28('0x12f')](path[_0xda28('0xe0')](_0x108580,_0x43f917['Attachment'][_0xda28('0xda')])));}}return{'date':moment(_0x43f917[_0xda28('0xf3')])[_0xda28('0xe5')](_0xda28('0x128'))[_0xda28('0xa7')](),'sender':_0x43f917[_0xda28('0x11b')]==='out'?_0x43f917[_0xda28('0x79')]?_0x43f917[_0xda28('0x79')][_0xda28('0xf1')]:'System':_0x43f917['Contact'][_0xda28('0x118')]+(_0x43f917[_0xda28('0x71')]['lastName']?'\x20'+_0x43f917[_0xda28('0x71')]['lastName']:''),'body':_0x43f917[_0xda28('0xdb')]?_0x43f917[_0xda28('0xdb')][_0xda28('0xda')]:_0x43f917[_0xda28('0x7e')],'direction':_0x43f917['direction']===_0xda28('0xcd')?'A':'C','secret':_0x43f917[_0xda28('0xf5')],'read':_0x43f917[_0xda28('0x8d')],'attachment':_0x43f917[_0xda28('0xdb')]};})[_0xda28('0x6e')]()};return ejs['renderFile'](path[_0xda28('0xe0')](config[_0xda28('0xe1')],_0xda28('0x114'),'views',_0xda28('0x130')),{'interaction':_0xf7ac94})[_0xda28('0x20')](function(_0x1a01ff){return new BPromise(function(_0x1c60e4,_0x352f7b){pdf[_0xda28('0xc2')](_0x1a01ff,_0x4cf05e)[_0xda28('0x131')](path[_0xda28('0xe0')](_0x108580,_0xda28('0x132')+_0x4f62d2['id']+'-'+_0x3bee79+_0xda28('0x133')),function(_0x2baa05,_0x500e6e){if(_0x2baa05)return _0x352f7b(_0x2baa05);_0x1c60e4(_0x500e6e);});});})[_0xda28('0x20')](function(){return new BPromise(function(_0x51753b,_0x4b42ec){zipdir(_0x108580,{'saveTo':_0x4a5090},function(_0x3fb61a,_0x134696){if(_0x3fb61a)return _0x4b42ec(_0x3fb61a);return _0x51753b(_0x134696);});})['then'](function(){return new BPromise(function(_0x119d77,_0x306cb7){rimraf(_0x108580,function(_0x5eec3e){if(_0x5eec3e)_0x306cb7(_0x5eec3e);return _0x119d77();});});})[_0xda28('0x20')](function(){return _0x8a4f73[_0xda28('0xdf')](_0x4a5090,_0x11d4c4,function(_0x500b8c){if(_0x500b8c){console['log'](_0xda28('0x134'),_0x500b8c);}else{fs[_0xda28('0x135')](_0x4a5090);}});});});}else{return _0x8a4f73[_0xda28('0x2b')](0xc8);}})['catch'](handleError(_0x8a4f73,null));}; \ No newline at end of file +var _0xb1d8=['attributes','hasOwnProperty','nolimit','order','sort','field','color','from','tools_tags','select','u.id','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','Tag','forEach','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','start','buildExpression','some','isEmpty','ChatWebsiteId','where','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','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)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','updateAttributes','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','update','disposition','AbandonInteraction','file','originalname','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','download','join','server/files/attachments/','basename','close','mailTranscript','format','transcript-%s.txt','pathTranscript','Messages','%s%d','System','customer','agentIdentifier','website_alias','agent_alias','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','SendMail','sendMail','email','Mail\x20Transcript','addMessage','ids','omit','getMessages','pick','options','findAll','getMyMessages','secret','includeAgent','fullname','alias','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','lastName','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','root','downloadInteraction.html','toFile','.pdf','log','err','html-pdf','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./chatInteraction.socket','register','jayson/promise','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','stack','send','map','TagIds','Tags','split','push','index','ChatInteraction','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xb1d8,0xe9));var _0x8b1d=function(_0x5364e2,_0x499ac9){_0x5364e2=_0x5364e2-0x0;var _0x3947bd=_0xb1d8[_0x5364e2];return _0x3947bd;};'use strict';var pdf=require(_0x8b1d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b1d('0x2'));var moment=require(_0x8b1d('0x3'));var BPromise=require(_0x8b1d('0x4'));var Mustache=require(_0x8b1d('0x5'));var util=require(_0x8b1d('0x6'));var path=require(_0x8b1d('0x7'));var sox=require('sox');var csv=require(_0x8b1d('0x8'));var ejs=require(_0x8b1d('0x9'));var fs=require('fs');var _=require(_0x8b1d('0xa'));var squel=require(_0x8b1d('0xb'));var crypto=require(_0x8b1d('0xc'));var jsforce=require(_0x8b1d('0xd'));var deskjs=require(_0x8b1d('0xe'));var toCsv=require(_0x8b1d('0x8'));var querystring=require(_0x8b1d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b1d('0x10'));var qs=require(_0x8b1d('0x11'));var as=require(_0x8b1d('0x12'));var hardwareService=require(_0x8b1d('0x13'));var logger=require(_0x8b1d('0x14'))(_0x8b1d('0x15'));var utils=require(_0x8b1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8b1d('0x17'));var db=require(_0x8b1d('0x18'))['db'];config[_0x8b1d('0x19')]=_['defaults'](config[_0x8b1d('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b1d('0x19')]));require(_0x8b1d('0x1a'))[_0x8b1d('0x1b')](socket);var jayson=require(_0x8b1d('0x1c'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x8b1d('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x6d032f,_0x41ba01,_0x3b33dd,_0x483ee6){return new BPromise(function(_0x20f95d,_0x1b8681){var _0x9a8139=_0x483ee6||client;return _0x9a8139[_0x8b1d('0x1e')](_0x6d032f,_0x3b33dd)['then'](function(_0x443f24){logger[_0x8b1d('0x1f')](_0x8b1d('0x20'),_0x41ba01,_0x8b1d('0x21'));logger[_0x8b1d('0x22')](_0x8b1d('0x23'),_0x41ba01,_0x8b1d('0x21'),JSON['stringify'](_0x443f24));if(_0x443f24[_0x8b1d('0x24')]){if(_0x443f24[_0x8b1d('0x24')][_0x8b1d('0x25')]===0x1f4){logger['error'](_0x8b1d('0x20'),_0x41ba01,_0x443f24[_0x8b1d('0x24')][_0x8b1d('0x26')]);return _0x1b8681(_0x443f24[_0x8b1d('0x24')][_0x8b1d('0x26')]);}logger['error'](_0x8b1d('0x20'),_0x41ba01,_0x443f24[_0x8b1d('0x24')][_0x8b1d('0x26')]);return _0x20f95d(_0x443f24[_0x8b1d('0x24')][_0x8b1d('0x26')]);}else{logger[_0x8b1d('0x1f')](_0x8b1d('0x20'),_0x41ba01,_0x8b1d('0x21'));_0x20f95d(_0x443f24[_0x8b1d('0x27')][_0x8b1d('0x26')]);}})[_0x8b1d('0x28')](function(_0x3a29c0){logger[_0x8b1d('0x24')](_0x8b1d('0x20'),_0x41ba01,_0x3a29c0);_0x1b8681(_0x3a29c0);});});}function respondWithStatusCode(_0x11c633,_0x32d03d){_0x32d03d=_0x32d03d||0xcc;return function(_0x495330){if(_0x495330){return _0x11c633[_0x8b1d('0x29')](_0x32d03d);}return _0x11c633[_0x8b1d('0x2a')](_0x32d03d)[_0x8b1d('0x2b')]();};}function respondWithResult(_0x317788,_0x22c433){_0x22c433=_0x22c433||0xc8;return function(_0x50ce9e){if(_0x50ce9e){return _0x317788[_0x8b1d('0x2a')](_0x22c433)[_0x8b1d('0x2c')](_0x50ce9e);}};}function respondWithFilteredResult(_0x1ac06f,_0x1acc51){return function(_0x253a1d){if(_0x253a1d){var _0x4d0721=_0x253a1d[_0x8b1d('0x2d')],_0x17ecb6=_0x1acc51[_0x8b1d('0x2e')],_0x9a2533=_0x1acc51[_0x8b1d('0x2e')]+_0x1acc51[_0x8b1d('0x2f')],_0x4769a3;if(_0x9a2533>=_0x4d0721){_0x9a2533=_0x4d0721;_0x4769a3=0xc8;}else{_0x4769a3=0xce;}_0x1ac06f[_0x8b1d('0x2a')](_0x4769a3);return _0x1ac06f['set'](_0x8b1d('0x30'),_0x17ecb6+'-'+_0x9a2533+'/'+_0x4d0721)['json'](_0x253a1d);}return null;};}function patchUpdates(_0x434b4b){return function(_0xf018e2){try{jsonpatch[_0x8b1d('0x31')](_0xf018e2,_0x434b4b,!![]);}catch(_0x5a1ca6){return BPromise[_0x8b1d('0x32')](_0x5a1ca6);}return _0xf018e2[_0x8b1d('0x33')]();};}function saveUpdates(_0x2af0d7,_0x284c54){return function(_0x4eed8f){if(_0x4eed8f){return _0x4eed8f['update'](_0x2af0d7)['then'](function(_0x4537a3){return _0x4537a3;});}return null;};}function removeEntity(_0x27a235,_0x5f426e){return function(_0x3232c9){if(_0x3232c9){return _0x3232c9[_0x8b1d('0x34')]()[_0x8b1d('0x35')](function(){_0x27a235[_0x8b1d('0x2a')](0xcc)[_0x8b1d('0x2b')]();});}};}function handleEntityNotFound(_0x110d21,_0x1d6045){return function(_0x55ea97){if(!_0x55ea97){_0x110d21['sendStatus'](0x194);}return _0x55ea97;};}function handleError(_0x131887,_0x12c1fa){_0x12c1fa=_0x12c1fa||0x1f4;return function(_0x2cca18){logger[_0x8b1d('0x24')](_0x2cca18[_0x8b1d('0x36')]);if(_0x2cca18['name']){delete _0x2cca18['name'];}_0x131887[_0x8b1d('0x2a')](_0x12c1fa)[_0x8b1d('0x37')](_0x2cca18);};}function getInteractionUsers(_0x2680f6,_0x33dc59){return new BPromise(function(_0x246b91,_0x14fb5a){try{if(_0x33dc59[_0x2680f6['id']]){_0x2680f6['Users']=_[_0x8b1d('0x38')](_0x33dc59[_0x2680f6['id']],function(_0x2b7555){return{'id':_0x2b7555['id'],'fullname':_0x2b7555['fullname']};});}}catch(_0x252a9e){_0x14fb5a(_0x252a9e);}_0x246b91(_0x2680f6);});}function getInteractionTags(_0x571af8,_0x522feb){return new BPromise(function(_0x4dbf4e,_0x2aa102){try{if(_0x571af8[_0x8b1d('0x39')]){_0x571af8[_0x8b1d('0x3a')]=[];_0x571af8['TagIds'][_0x8b1d('0x3b')](',')['forEach'](function(_0x2c2595){_0x571af8[_0x8b1d('0x3a')][_0x8b1d('0x3c')](_0x522feb[_0x2c2595]);});}delete _0x571af8['TagIds'];}catch(_0x8daffc){_0x2aa102(_0x8daffc);}_0x4dbf4e(_0x571af8);});}function updateChatInteraction(_0x99b36e,_0x3f7f24,_0x293d12){return new BPromise(function(_0x387660,_0x25c4ac){return getInteractionUsers(_0x99b36e,_0x293d12)[_0x8b1d('0x35')](function(_0x14409e){return getInteractionTags(_0x14409e,_0x3f7f24);})[_0x8b1d('0x35')](function(_0x5d08fe){_0x387660(_0x5d08fe);})[_0x8b1d('0x28')](function(_0x210cb3){_0x25c4ac(_0x210cb3);});});}exports[_0x8b1d('0x3d')]=function(_0x2fb916,_0x3684a0){var _0x1a226b={},_0x16795b={},_0x4ca139={'count':0x0,'rows':[]};var _0x41d66e=_[_0x8b1d('0x38')](db[_0x8b1d('0x3e')][_0x8b1d('0x3f')],function(_0x1f1ff2){return{'name':_0x1f1ff2[_0x8b1d('0x40')],'type':_0x1f1ff2[_0x8b1d('0x41')][_0x8b1d('0x42')]};});_0x16795b['model']=_[_0x8b1d('0x38')](_0x41d66e,_0x8b1d('0x43'));_0x16795b[_0x8b1d('0x44')]=_[_0x8b1d('0x45')](_0x2fb916[_0x8b1d('0x44')]);_0x16795b[_0x8b1d('0x46')]=_[_0x8b1d('0x47')](_0x16795b[_0x8b1d('0x48')],_0x16795b['query']);_0x1a226b['attributes']=_[_0x8b1d('0x47')](_0x16795b['model'],qs['fields'](_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x49')]));_0x1a226b[_0x8b1d('0x4a')]=_0x1a226b[_0x8b1d('0x4a')]['length']?_0x1a226b['attributes']:_0x16795b[_0x8b1d('0x48')];if(!_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x4b')](_0x8b1d('0x4c'))){_0x1a226b['limit']=qs[_0x8b1d('0x2f')](_0x2fb916['query']['limit']);_0x1a226b[_0x8b1d('0x2e')]=qs[_0x8b1d('0x2e')](_0x2fb916['query'][_0x8b1d('0x2e')]);}_0x1a226b[_0x8b1d('0x4d')]=qs[_0x8b1d('0x4e')](_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x4e')]);_0x1a226b['where']=qs['filters'](_['pick'](_0x2fb916[_0x8b1d('0x44')],_0x16795b[_0x8b1d('0x46')]),_0x41d66e);var _0x2dc480=[];var _0x4258f8=squel['select']()[_0x8b1d('0x4f')]('id')['field'](_0x8b1d('0x43'))[_0x8b1d('0x4f')](_0x8b1d('0x50'))[_0x8b1d('0x51')](_0x8b1d('0x52'));var _0x1ced99=squel[_0x8b1d('0x53')]()[_0x8b1d('0x4f')](_0x8b1d('0x54'))[_0x8b1d('0x4f')]('u.fullname')[_0x8b1d('0x4f')](_0x8b1d('0x55'))['from']('user_has_chat_interactions','ui')[_0x8b1d('0x56')](_0x8b1d('0x57'),'u',_0x8b1d('0x58'));var _0x45cfea=squel[_0x8b1d('0x53')]()[_0x8b1d('0x51')]('chat_interactions','i')['left_join']('cm_contacts','c',_0x8b1d('0x59'))[_0x8b1d('0x56')](_0x8b1d('0x57'),'o',_0x8b1d('0x5a'))[_0x8b1d('0x56')](_0x8b1d('0x5b'),'a',_0x8b1d('0x5c'))['left_join'](_0x8b1d('0x5d'),'me',_0x8b1d('0x5e'))[_0x8b1d('0x56')](_0x8b1d('0x5f'),'it',_0x8b1d('0x60'))[_0x8b1d('0x56')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x33bcfc=squel[_0x8b1d('0x61')]();var _0x1bae32=[];var _0x5e0515=squel[_0x8b1d('0x61')]();var _0x1bbbf1;if(_0x2fb916['query']['search']){_0x1bbbf1=as[_0x8b1d('0x62')](_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x63')]);var _0x251664=_0x1bbbf1[_0x8b1d('0x64')];for(var _0x42f0c7=0x0;_0x42f0c7<_0x1bbbf1[_0x8b1d('0x65')][_0x8b1d('0x66')];_0x42f0c7++){var _0x46ed9b=_0x1bbbf1[_0x8b1d('0x65')][_0x42f0c7];var _0x175260='i';var _0x53d31e=_['find'](_0x41d66e,['name',_0x46ed9b[_0x8b1d('0x4f')]]);if(!_0x53d31e){switch(_0x46ed9b[_0x8b1d('0x4f')]){case _0x8b1d('0x67'):if(_0x46ed9b[_0x8b1d('0x68')]==0x1){_0x45cfea[_0x8b1d('0x69')]('`'+_0x46ed9b[_0x8b1d('0x4f')]+_0x8b1d('0x6a'));}else{_0x45cfea[_0x8b1d('0x69')]('`'+_0x46ed9b[_0x8b1d('0x4f')]+_0x8b1d('0x6b'));}break;case _0x8b1d('0x6c'):if(_0x46ed9b[_0x8b1d('0x6d')]==='$substring'){if(_0x46ed9b[_0x8b1d('0x68')]['split']('\x20')[_0x8b1d('0x66')]>0x1){_0x33bcfc[_0x251664]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x46ed9b[_0x8b1d('0x68')]),null);}else{var _0x36aed3='%'+_0x46ed9b['value']+'%';_0x33bcfc[_0x251664](_0x8b1d('0x6e'),_0x36aed3,_0x36aed3,_0x36aed3);}}else{_0x53d31e=_[_0x8b1d('0x6f')](_0x41d66e,[_0x8b1d('0x43'),_0x8b1d('0x70')]);_0x46ed9b[_0x8b1d('0x4f')]=_0x8b1d('0x70');_0x485707=as['buildExpression'](_0x175260,_0x53d31e[_0x8b1d('0x41')],_0x46ed9b);_0x33bcfc[_0x251664](_0x485707['text'],_0x485707[_0x8b1d('0x68')]['start'],_0x485707[_0x8b1d('0x68')][_0x8b1d('0x2b')]);}break;case _0x8b1d('0x71'):var _0x9944f=_0x46ed9b['value'][_0x8b1d('0x3b')](',')[_0x8b1d('0x38')](function(_0x1767cc){return Number(_0x1767cc);});_0x9944f[_0x8b1d('0x72')](function(_0x5e4e93){_0x5e0515['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5e4e93+',%');});_0x1bae32=_['union'](_0x1bae32,_0x9944f);break;case _0x8b1d('0x73'):if(_0x46ed9b[_0x8b1d('0x6d')]===_0x8b1d('0x74')){_0x33bcfc[_0x251664](_0x8b1d('0x75'),'%'+_0x46ed9b['value']+'%',null);}else{_0x53d31e=_[_0x8b1d('0x6f')](_0x41d66e,[_0x8b1d('0x43'),_0x8b1d('0x76')]);_0x46ed9b[_0x8b1d('0x4f')]='UserId';_0x485707=as['buildExpression'](_0x175260,_0x53d31e[_0x8b1d('0x41')],_0x46ed9b);_0x33bcfc[_0x251664](_0x485707[_0x8b1d('0x77')],_0x485707[_0x8b1d('0x68')]['start'],_0x485707['value'][_0x8b1d('0x2b')]);}break;case _0x8b1d('0x78'):_0x485707=as['buildExpression']('me',null,_0x46ed9b);_0x33bcfc[_0x251664](_0x485707[_0x8b1d('0x77')],_0x485707[_0x8b1d('0x68')][_0x8b1d('0x79')],_0x485707['value'][_0x8b1d('0x2b')]);break;}}else{var _0x485707=as[_0x8b1d('0x7a')](_0x175260,_0x53d31e[_0x8b1d('0x41')],_0x46ed9b);_0x33bcfc[_0x251664](_0x485707[_0x8b1d('0x77')],_0x485707['value'][_0x8b1d('0x79')],_0x485707[_0x8b1d('0x68')][_0x8b1d('0x2b')]);}}}else{var _0x4fdead=_(_0x2fb916['query'])[_0x8b1d('0x45')]()[_0x8b1d('0x38')](function(_0x1d2f5f){return _[_0x8b1d('0x7b')](_0x41d66e,[_0x8b1d('0x43'),_0x1d2f5f])?_0x1d2f5f:undefined;})['compact']()[_0x8b1d('0x68')]();if(!_[_0x8b1d('0x7c')](_0x4fdead)){_0x4fdead['forEach'](function(_0x5c7241){if(_0x5c7241===_0x8b1d('0x7d')){_0x45cfea[_0x8b1d('0x7e')]('i.ChatWebsiteId\x20IN\x20?',[][_0x8b1d('0x7f')](_0x2fb916[_0x8b1d('0x44')][_0x5c7241]));}else if(_0x5c7241==='createdAt'){var _0x13e506=JSON[_0x8b1d('0x80')](_0x2fb916['query'][_0x5c7241])[_0x8b1d('0x81')];var _0x5cb14f=JSON[_0x8b1d('0x80')](_0x2fb916[_0x8b1d('0x44')][_0x5c7241])[_0x8b1d('0x82')];_0x45cfea['where'](_0x8b1d('0x83'),_0x13e506,_0x5cb14f);}else{if(_0x2fb916[_0x8b1d('0x44')][_0x5c7241]==='null'){_0x45cfea[_0x8b1d('0x7e')]('i.'+_0x5c7241+_0x8b1d('0x84'));}else{_0x45cfea[_0x8b1d('0x7e')]('i.'+_0x5c7241+_0x8b1d('0x85'),_0x2fb916[_0x8b1d('0x44')][_0x5c7241]);}}});}if(_0x2fb916['query'][_0x8b1d('0x86')]){if(_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x86')]==0x1){_0x45cfea['having'](_0x8b1d('0x87'));}else{_0x45cfea['having'](_0x8b1d('0x88'));}}if(_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x89')]){_0x1bae32=_[_0x8b1d('0x8a')](_0x2fb916[_0x8b1d('0x44')]['tag'])?_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x89')]:new Array(_0x2fb916['query'][_0x8b1d('0x89')]);_0x1bae32['forEach'](function(_0x3a6423){_0x5e0515['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3a6423+',%');});}if(_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x8b')]){var _0x2776fa=_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x8b')][_0x8b1d('0x8c')]('\x5c','\x5c\x5c')[_0x8b1d('0x8c')](/'/g,'\x27\x27');if(qs[_0x8b1d('0x8d')](_0x2776fa)){_0x33bcfc['or'](_0x8b1d('0x8e'),_0x2776fa+'%');}else{_0x33bcfc['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8b1d('0x8f')](_0x2776fa))['or'](_0x8b1d('0x90'),_0x2776fa+'%');}}}_0x45cfea['where'](_0x33bcfc);_0x45cfea[_0x8b1d('0x91')](_0x8b1d('0x92'));var _0x569933={'type':db['Sequelize'][_0x8b1d('0x93')]['SELECT'],'raw':!![]};var _0x397f14=_0x45cfea['clone']();_0x397f14[_0x8b1d('0x4f')]('i.id');_0x397f14[_0x8b1d('0x4f')](_0x8b1d('0x94'),_0x8b1d('0x67'));if(_0x1a226b[_0x8b1d('0x4d')]){_0x1a226b[_0x8b1d('0x4d')][_0x8b1d('0x72')](function(_0x4462a7){var _0x11db23=_0x4462a7[0x0]==='contactName'?_0x4462a7[0x0]:'i.'+_0x4462a7[0x0];_0x45cfea[_0x8b1d('0x4d')](_0x11db23,_0x4462a7[0x1]===_0x8b1d('0x95')?![]:!![]);});}if(!_[_0x8b1d('0x7c')](_0x1bae32)){_0x45cfea[_0x8b1d('0x69')](_0x5e0515);_0x397f14[_0x8b1d('0x7e')](_0x8b1d('0x96'),_0x1bae32);}BPromise[_0x8b1d('0x97')]()['then'](function(){if(!_0x1bbbf1){if(_0x2fb916['query'][_0x8b1d('0x7d')])return;_0x397f14[_0x8b1d('0x7e')](_0x8b1d('0x98'));_0x45cfea['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2fb916['user']['role']!==_0x8b1d('0x99'))return;return _0x2fb916[_0x8b1d('0x9a')][_0x8b1d('0x9b')]({'attributes':['id'],'raw':!![]})[_0x8b1d('0x35')](function(_0x55875f){if(_[_0x8b1d('0x7c')](_0x55875f)){_0x397f14['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x45cfea[_0x8b1d('0x7e')](_0x8b1d('0x9c'));}else{_0x397f14['where'](_0x8b1d('0x9d'),_['map'](_0x55875f,'id'));_0x45cfea[_0x8b1d('0x7e')]('i.ChatWebsiteId\x20IN\x20?',_[_0x8b1d('0x38')](_0x55875f,'id'));}});})[_0x8b1d('0x35')](function(){if(_0x2fb916[_0x8b1d('0x9a')][_0x8b1d('0x9e')]===_0x8b1d('0x99')&&!_0x1bbbf1&&!_0x2fb916[_0x8b1d('0x44')][_0x8b1d('0x7d')])return[];return db[_0x8b1d('0x9f')]['query'](_0x397f14[_0x8b1d('0xa0')](),_0x569933);})['then'](function(_0x377f28){_0x4ca139[_0x8b1d('0x2d')]=_0x377f28['length'];if(_0x4ca139[_0x8b1d('0x2d')]===0x0)return[];return db[_0x8b1d('0x9f')][_0x8b1d('0x44')](_0x4258f8['toString'](),_0x569933)[_0x8b1d('0x35')](function(_0x10d905){_0x2dc480=_['keyBy'](_0x10d905,'id');_0x569933=_[_0x8b1d('0xa1')](_0x569933,{'model':db[_0x8b1d('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fb916['query'][_0x8b1d('0x49')]){_0x1a226b[_0x8b1d('0x4a')][_0x8b1d('0x72')](function(_0x15ade0){_0x45cfea[_0x8b1d('0x4f')]('i.'+_0x15ade0);});}else{_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0x94'),_0x8b1d('0x67'));_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0xa2'),_0x8b1d('0xa3'));_0x45cfea['field'](_0x8b1d('0xa4'),_0x8b1d('0xa5'));_0x45cfea[_0x8b1d('0x4f')]('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');_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0xa6'));_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0xa7'),_0x8b1d('0xa8'));_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0xa9'),'Contact.lastName');_0x45cfea['field']('c.email',_0x8b1d('0xaa'));_0x45cfea[_0x8b1d('0x4f')]('c.phone',_0x8b1d('0xab'));_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0xac'),_0x8b1d('0xad'));_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0xae'),_0x8b1d('0xaf'));_0x45cfea[_0x8b1d('0x4f')](_0x8b1d('0xb0'),_0x8b1d('0xb1'));_0x45cfea[_0x8b1d('0x4f')]('o.internal',_0x8b1d('0xb2'));_0x45cfea['field'](_0x8b1d('0xb3'),_0x8b1d('0x39'));}if(_0x1a226b[_0x8b1d('0x2f')])_0x45cfea[_0x8b1d('0x2f')](_0x1a226b[_0x8b1d('0x2f')]);if(_0x1a226b[_0x8b1d('0x2e')])_0x45cfea[_0x8b1d('0x2e')](_0x1a226b[_0x8b1d('0x2e')]);return db[_0x8b1d('0x9f')]['query'](_0x45cfea[_0x8b1d('0xa0')](),_0x569933);})[_0x8b1d('0x35')](function(_0x5d3b65){_0x1ced99[_0x8b1d('0x7e')]('ui.ChatInteractionId\x20IN\x20?',_[_0x8b1d('0x38')](_0x5d3b65,'id'));return db[_0x8b1d('0x9f')][_0x8b1d('0x44')](_0x1ced99[_0x8b1d('0xa0')](),_0x569933)[_0x8b1d('0x35')](function(_0x9f5dcd){var _0x2ebbbd=_[_0x8b1d('0xb4')](_0x9f5dcd,_0x8b1d('0xb5'));var _0x533f65=[];_0x5d3b65[_0x8b1d('0x72')](function(_0x2fe9a0){_0x533f65[_0x8b1d('0x3c')](updateChatInteraction(_0x2fe9a0,_0x2dc480,_0x2ebbbd));});return BPromise[_0x8b1d('0xb6')](_0x533f65);});});})[_0x8b1d('0x35')](function(_0x48fca6){_0x4ca139[_0x8b1d('0xb7')]=_0x48fca6;return _0x4ca139;})[_0x8b1d('0x35')](respondWithFilteredResult(_0x3684a0,_0x1a226b))[_0x8b1d('0x28')](handleError(_0x3684a0,null));};exports[_0x8b1d('0xb8')]=function(_0x5019d1,_0x736849){var _0x2d06b6={'raw':![],'where':{'id':_0x5019d1[_0x8b1d('0xb9')]['id']}},_0x250b5d={};_0x250b5d['model']=_['keys'](db[_0x8b1d('0x3e')]['rawAttributes']);_0x250b5d['query']=_[_0x8b1d('0x45')](_0x5019d1[_0x8b1d('0x44')]);_0x250b5d[_0x8b1d('0x46')]=_[_0x8b1d('0x47')](_0x250b5d[_0x8b1d('0x48')],_0x250b5d[_0x8b1d('0x44')]);_0x2d06b6[_0x8b1d('0x4a')]=_[_0x8b1d('0x47')](_0x250b5d[_0x8b1d('0x48')],qs[_0x8b1d('0x49')](_0x5019d1[_0x8b1d('0x44')][_0x8b1d('0x49')]));_0x2d06b6[_0x8b1d('0x4a')]=_0x2d06b6[_0x8b1d('0x4a')][_0x8b1d('0x66')]?_0x2d06b6[_0x8b1d('0x4a')]:_0x250b5d[_0x8b1d('0x48')];if(_0x5019d1[_0x8b1d('0x44')][_0x8b1d('0xba')]){_0x2d06b6[_0x8b1d('0xbb')]=[{'all':!![]}];}_0x2d06b6=_['merge']({},_0x2d06b6,_0x5019d1['options']);return db[_0x8b1d('0x3e')][_0x8b1d('0x6f')](_0x2d06b6)[_0x8b1d('0x35')](handleEntityNotFound(_0x736849,null))['then'](respondWithResult(_0x736849,null))['catch'](handleError(_0x736849,null));};exports[_0x8b1d('0xbc')]=function(_0x52672f,_0x5ec3ec){return db[_0x8b1d('0x3e')][_0x8b1d('0xbc')](_0x52672f['body'],{})[_0x8b1d('0x35')](respondWithResult(_0x5ec3ec,0xc9))['catch'](handleError(_0x5ec3ec,null));};exports['update']=function(_0x462914,_0x2ccc4a){if(_0x462914[_0x8b1d('0x78')]['id']){delete _0x462914['body']['id'];}return db['ChatInteraction'][_0x8b1d('0x6f')]({'where':{'id':_0x462914[_0x8b1d('0xb9')]['id']}})[_0x8b1d('0x35')](handleEntityNotFound(_0x2ccc4a,null))['then'](saveUpdates(_0x462914[_0x8b1d('0x78')],null))[_0x8b1d('0x35')](respondWithResult(_0x2ccc4a,null))[_0x8b1d('0x28')](handleError(_0x2ccc4a,null));};exports[_0x8b1d('0x34')]=function(_0x48bd14,_0x560e9c){return db[_0x8b1d('0x3e')][_0x8b1d('0x6f')]({'where':{'id':_0x48bd14[_0x8b1d('0xb9')]['id']}})[_0x8b1d('0x35')](handleEntityNotFound(_0x560e9c,null))[_0x8b1d('0x35')](removeEntity(_0x560e9c,null))[_0x8b1d('0x28')](handleError(_0x560e9c,null));};exports[_0x8b1d('0xbd')]=function(_0xe1b0ef,_0x5def09){return db['ChatInteraction'][_0x8b1d('0xbd')]()[_0x8b1d('0x35')](respondWithResult(_0x5def09,null))[_0x8b1d('0x28')](handleError(_0x5def09,null));};exports[_0x8b1d('0xbe')]=function(_0x8bbd39,_0x100ce8){var _0x10b42e=_0x8bbd39[_0x8b1d('0xb9')]['id'];var _0x1f5254;var _0x19dee6;var _0x2c15e6;return db[_0x8b1d('0x3e')][_0x8b1d('0xbf')]({'where':{'id':_0x10b42e}})[_0x8b1d('0x35')](function(_0x1b6d85){_0x1f5254=_0x1b6d85;return db[_0x8b1d('0xc0')]['findOne']({'where':{'id':_0x1b6d85['ChatWebsiteId']},'attributes':['id',_0x8b1d('0xc1'),_0x8b1d('0xc2')],'raw':!![]});})[_0x8b1d('0x35')](function(_0x2732d0){if(_0x2732d0&&_0x2732d0[_0x8b1d('0xc1')]&&_0x2732d0['vidaooEscalation']){_0x19dee6=_0x2732d0;var _0x2f86ec={'rejectUnauthorized':![],'method':_0x8b1d('0xc3'),'uri':_0x8b1d('0xc4'),'headers':{'X-APIKEY':_0x2732d0[_0x8b1d('0xc1')]},'body':{'name':'MotionCWB:'+_0x10b42e},'redirect':_0x8b1d('0xc5'),'json':!![]};return rp(_0x2f86ec);}else{throw new db[(_0x8b1d('0xc6'))][(_0x8b1d('0xc7'))](_0x8b1d('0xc8'));}})[_0x8b1d('0x35')](function(_0x30bd8d){_0x2c15e6=_0x30bd8d;if(_0x2c15e6['id']){var _0x33cf13={'body':_0x2c15e6['join_url'],'ChatWebsiteId':_0x19dee6['id'],'ChatInteractionId':_0x1f5254['id'],'direction':_0x8b1d('0xc9'),'UserId':_0x8bbd39[_0x8b1d('0x9a')]['id']};return db[_0x8b1d('0xca')][_0x8b1d('0xbc')](_0x33cf13,{});}else{throw new db[(_0x8b1d('0xc6'))][(_0x8b1d('0xc7'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x1f5254[_0x8b1d('0xcb')]({'vidaooSessionId':_0x2c15e6['id']});})['then'](respondWithResult(_0x100ce8,null))[_0x8b1d('0x28')](handleError(_0x100ce8,null));};exports['customUpdate']=function(_0x514640,_0x1bf87a){if(_0x514640['body']['id']){delete _0x514640[_0x8b1d('0x78')]['id'];}return db[_0x8b1d('0x3e')]['find']({'where':{'id':_0x514640[_0x8b1d('0xb9')]['id']},'include':[{'model':db[_0x8b1d('0xcc')],'as':_0x8b1d('0x6c')}]})[_0x8b1d('0x35')](handleEntityNotFound(_0x1bf87a,null))[_0x8b1d('0x35')](saveUpdates(_0x514640[_0x8b1d('0x78')],null))[_0x8b1d('0x35')](respondWithResult(_0x1bf87a,null))[_0x8b1d('0x28')](handleError(_0x1bf87a,null));};exports['abandon']=function(_0x477ec3,_0x55adcd,_0x190fcf){if(_0x477ec3['body']['id']){delete _0x477ec3[_0x8b1d('0x78')]['id'];}return db[_0x8b1d('0x3e')][_0x8b1d('0x6f')]({'where':{'id':_0x477ec3[_0x8b1d('0xb9')]['id']}})['then'](function(_0x537926){if(!_0x537926){logger[_0x8b1d('0x24')](_0x8b1d('0xcd'),_0x8b1d('0xce'),0x194,_0x8b1d('0xcf'));_0x55adcd['sendStatus'](0x194);}else{if(_0x537926['UserId']){throw new db[(_0x8b1d('0xc6'))]['ValidationError'](_0x8b1d('0xd0'));}}return _0x537926;})['then'](function(_0x235e12){if(_0x235e12){return _0x235e12[_0x8b1d('0xd1')]({'closed':_0x477ec3[_0x8b1d('0x78')]['closed'],'disposition':_0x477ec3['body'][_0x8b1d('0xd2')]})[_0x8b1d('0x35')](function(_0x488915){return _0x488915;});}})[_0x8b1d('0x35')](function(_0x3f9953){return respondWithRpcPromise(_0x8b1d('0xd3'),_0x8b1d('0xce'),_0x477ec3['body'],client9004);})[_0x8b1d('0x35')](respondWithResult(_0x55adcd,null))[_0x8b1d('0x28')](handleError(_0x55adcd,null));};exports['attachmentUpload']=function(_0x46fe38,_0x3625e8,_0x5508f1){_0x46fe38[_0x8b1d('0x78')][_0x8b1d('0x43')]=_0x46fe38[_0x8b1d('0xd4')][_0x8b1d('0xd5')];_0x46fe38['body']['basename']=_0x46fe38['file'][_0x8b1d('0xd6')];_0x46fe38[_0x8b1d('0x78')][_0x8b1d('0x41')]=_0x46fe38[_0x8b1d('0xd4')][_0x8b1d('0xd7')];return db[_0x8b1d('0xd8')][_0x8b1d('0xbc')](_0x46fe38['body'])[_0x8b1d('0x35')](respondWithResult(_0x3625e8,0xc9))[_0x8b1d('0x28')](handleError(_0x3625e8,null));};exports[_0x8b1d('0xd9')]=function(_0x5b59be,_0x3eac75,_0x37e726){return db['ChatInteraction']['findOne']({'where':{'id':_0x5b59be[_0x8b1d('0xb9')]['id']},'raw':!![]})[_0x8b1d('0x35')](handleEntityNotFound(_0x3eac75,null))['then'](function(_0xd3b7f0){if(_0xd3b7f0){if(_0xd3b7f0[_0x8b1d('0xda')]){return _0x3eac75[_0x8b1d('0x2a')](0x193)['json']({'status':0x193,'message':_0x8b1d('0xdb')});}return db[_0x8b1d('0xd8')][_0x8b1d('0xbf')]({'where':{'id':_0x5b59be[_0x8b1d('0x44')][_0x8b1d('0xdc')]},'raw':!![]})[_0x8b1d('0x35')](handleEntityNotFound(_0x3eac75,null));}})['then'](function(_0x5de97b){if(_0x5de97b){return _0x3eac75[_0x8b1d('0xdd')](path[_0x8b1d('0xde')](config['root'],_0x8b1d('0xdf'),_0x5de97b[_0x8b1d('0xe0')]));}})[_0x8b1d('0x28')](handleError(_0x3eac75,null));};exports[_0x8b1d('0xe1')]=function(_0x237d02,_0x32d455){var _0x50f6d0=null;var _0x2de70e=null;var _0x46d192=null;var _0x491367=null;if(_0x237d02[_0x8b1d('0x78')]['id']){delete _0x237d02['body']['id'];}if(_0x237d02[_0x8b1d('0x78')][_0x8b1d('0xe2')]){_0x491367=path[_0x8b1d('0xde')](config['root'],'server/files/chat/upload/',util[_0x8b1d('0xe3')](_0x8b1d('0xe4'),Date['now']()));_0x237d02[_0x8b1d('0x78')][_0x8b1d('0xe5')]=_0x491367;}return db[_0x8b1d('0x3e')][_0x8b1d('0x6f')]({'where':{'id':_0x237d02[_0x8b1d('0xb9')]['id']},'include':[{'model':db[_0x8b1d('0xca')],'as':'Messages','include':[{'model':db[_0x8b1d('0x73')],'as':_0x8b1d('0x73')}]}]})[_0x8b1d('0x35')](handleEntityNotFound(_0x32d455,null))['then'](saveUpdates(_0x237d02[_0x8b1d('0x78')],null))[_0x8b1d('0x35')](function(_0x5955c1){if(_0x5955c1){_0x50f6d0=_0x5955c1;return db[_0x8b1d('0xc0')][_0x8b1d('0x6f')]({'where':{'id':_0x50f6d0[_0x8b1d('0x7d')]}});}})[_0x8b1d('0x35')](function(_0xe338ab){if(_0xe338ab){_0x46d192=_0xe338ab;return db[_0x8b1d('0xcc')][_0x8b1d('0x6f')]({'where':{'id':_0x50f6d0['ContactId']}});}})[_0x8b1d('0x35')](function(_0x13c964){if(_0x13c964){_0x2de70e=_0x13c964;if(_0x491367){var _0x5b2ea3=null;for(var _0x306ccc=0x1;_0x306ccc<_0x50f6d0[_0x8b1d('0xe6')][_0x8b1d('0x66')];++_0x306ccc){_0x5b2ea3=_0x50f6d0[_0x8b1d('0xe6')][_0x306ccc];var _0xfd58f4=_0x5b2ea3[_0x8b1d('0x76')]?util['format'](_0x8b1d('0xe7'),_0x46d192['agentAlias'],_0x5b2ea3['UserId']):_0x8b1d('0xe8');var _0x5d0587=_0x237d02[_0x8b1d('0x78')][_0x8b1d('0xe9')]||util[_0x8b1d('0xe3')]('%s%d','Visitor',_0x5b2ea3['ContactId']);switch(_0x46d192[_0x8b1d('0xea')]){case _0x8b1d('0xeb'):_0xfd58f4=_0x5b2ea3[_0x8b1d('0x76')]?util[_0x8b1d('0xe3')]('%s%d',_0x46d192['agentAlias'],_0x5b2ea3[_0x8b1d('0x76')]):_0x8b1d('0xe8');break;case _0x8b1d('0xec'):_0xfd58f4=_0x5b2ea3[_0x8b1d('0x76')]?_0x5b2ea3['User']['alias']||_0x5b2ea3[_0x8b1d('0x73')]['fullname']:'System';break;case _0x8b1d('0xed'):_0xfd58f4=_0x5b2ea3['UserId']?_0x5b2ea3[_0x8b1d('0x73')]['fullname']:_0x8b1d('0xe8');break;default:_0xfd58f4=_0x5b2ea3[_0x8b1d('0x76')]?util[_0x8b1d('0xe3')]('%s%d',_0x46d192[_0x8b1d('0xee')],_0x5b2ea3[_0x8b1d('0x76')]):_0x8b1d('0xe8');}var _0x2ee0e6=util[_0x8b1d('0xe3')](_0x8b1d('0xef'),moment(_0x5b2ea3[_0x8b1d('0xf0')])[_0x8b1d('0xe3')](_0x8b1d('0xf1')),_0x5b2ea3[_0x8b1d('0xf2')]==='in'?_0x5d0587:_0xfd58f4,_0x5b2ea3[_0x8b1d('0x78')]);if(!_0x5b2ea3['secret']){fs['appendFileSync'](_0x491367,_0x2ee0e6);}}return db[_0x8b1d('0xf3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8b1d('0xf4')],'as':_0x8b1d('0xf5'),'raw':!![]}]});}}})['then'](function(_0x1fbe9f){if(_0x1fbe9f&&_0x1fbe9f['Smtp']&&_0x237d02['body']){var _0x1e7ca5={'tls':{'rejectUnauthorized':![]}};if(_0x1fbe9f[_0x8b1d('0xf5')]['service']){_0x1e7ca5[_0x8b1d('0xf6')]=_0x1fbe9f['Smtp'][_0x8b1d('0xf6')];}else{_0x1e7ca5[_0x8b1d('0xf7')]=_0x1fbe9f['Smtp']['host'];_0x1e7ca5[_0x8b1d('0xf8')]=_0x1fbe9f['Smtp']['port'];_0x1e7ca5[_0x8b1d('0xf9')]=_0x1fbe9f[_0x8b1d('0xf5')][_0x8b1d('0xf9')];}if(_0x1fbe9f['Smtp'][_0x8b1d('0xfa')]){_0x1e7ca5['auth']={'user':_0x1fbe9f['Smtp'][_0x8b1d('0x9a')],'pass':_0x1fbe9f['Smtp']['pass']};}return respondWithRpcPromise(_0x8b1d('0xfb'),_0x8b1d('0xfc'),{'account':_0x1e7ca5,'message':{'from':util[_0x8b1d('0xe3')]('\x22%s\x22\x20<%s>',_0x1fbe9f['name'],_0x1fbe9f[_0x8b1d('0xfd')]||_0x1fbe9f[_0x8b1d('0xf5')]['user']),'to':_0x237d02['body']['mailTranscript'],'subject':_0x8b1d('0xfe'),'text':util[_0x8b1d('0xe3')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x237d02[_0x8b1d('0x78')][_0x8b1d('0xe2')]),'attachments':[{'path':_0x491367}]}})[_0x8b1d('0x35')](function(){return _0x50f6d0;})['catch'](function(_0x45e5b3){console[_0x8b1d('0x24')](_0x45e5b3);});}else{return _0x50f6d0;}})['then'](respondWithStatusCode(_0x32d455,0xc8))['catch'](handleError(_0x32d455,null));};exports[_0x8b1d('0xff')]=function(_0x3ae116,_0x4980a3,_0x22243a){return db[_0x8b1d('0xca')]['find']({'where':{'id':_0x3ae116[_0x8b1d('0xb9')]['id']}})[_0x8b1d('0x35')](handleEntityNotFound(_0x4980a3,null))[_0x8b1d('0x35')](function(_0x4a92a6){if(_0x4a92a6){return _0x4a92a6[_0x8b1d('0xff')](_0x3ae116[_0x8b1d('0x78')][_0x8b1d('0x100')],_[_0x8b1d('0x101')](_0x3ae116['body'],['ids','id'])||{});}})[_0x8b1d('0x35')](respondWithResult(_0x4980a3,null))[_0x8b1d('0x28')](handleError(_0x4980a3,null));};exports[_0x8b1d('0x102')]=function(_0x3d130e,_0x5785b8,_0x113f5c){var _0x52591b={'raw':![],'where':{}};var _0x2a7c7c={};var _0x1fac91={'count':0x0,'rows':[]};return db[_0x8b1d('0x3e')][_0x8b1d('0xbf')]({'where':{'id':_0x3d130e[_0x8b1d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5785b8,null))['then'](function(_0x386330){if(_0x386330){_0x2a7c7c[_0x8b1d('0x48')]=_['keys'](db[_0x8b1d('0xca')][_0x8b1d('0x3f')]);_0x2a7c7c[_0x8b1d('0x44')]=_['keys'](_0x3d130e[_0x8b1d('0x44')]);_0x2a7c7c[_0x8b1d('0x46')]=_[_0x8b1d('0x47')](_0x2a7c7c[_0x8b1d('0x48')],_0x2a7c7c[_0x8b1d('0x44')]);_0x52591b[_0x8b1d('0x4a')]=_['intersection'](_0x2a7c7c[_0x8b1d('0x48')],qs[_0x8b1d('0x49')](_0x3d130e['query'][_0x8b1d('0x49')]));_0x52591b['attributes']=_0x52591b[_0x8b1d('0x4a')][_0x8b1d('0x66')]?_0x52591b[_0x8b1d('0x4a')]:_0x2a7c7c[_0x8b1d('0x48')];if(!_0x3d130e['query']['hasOwnProperty'](_0x8b1d('0x4c'))){_0x52591b[_0x8b1d('0x2f')]=qs['limit'](_0x3d130e[_0x8b1d('0x44')][_0x8b1d('0x2f')]);_0x52591b[_0x8b1d('0x2e')]=qs[_0x8b1d('0x2e')](_0x3d130e[_0x8b1d('0x44')][_0x8b1d('0x2e')]);}_0x52591b[_0x8b1d('0x4d')]=qs[_0x8b1d('0x4e')](_0x3d130e[_0x8b1d('0x44')][_0x8b1d('0x4e')]);_0x52591b[_0x8b1d('0x7e')]=qs[_0x8b1d('0x46')](_[_0x8b1d('0x103')](_0x3d130e[_0x8b1d('0x44')],_0x2a7c7c[_0x8b1d('0x46')]));_0x52591b[_0x8b1d('0x7e')][_0x8b1d('0xb5')]=_0x386330['id'];if(_0x3d130e['query'][_0x8b1d('0x8b')]){_0x52591b[_0x8b1d('0x7e')]=_[_0x8b1d('0xa1')](_0x52591b['where'],{'$or':_[_0x8b1d('0x38')](_0x52591b['attributes'],function(_0x20ecb8){var _0x2251d9={};_0x2251d9[_0x20ecb8]={'$like':'%'+_0x3d130e[_0x8b1d('0x44')][_0x8b1d('0x8b')]+'%'};return _0x2251d9;})});}if(_0x3d130e['query'][_0x8b1d('0x81')]){var _0x592972=_0x3d130e[_0x8b1d('0x44')][_0x8b1d('0x81')][_0x8b1d('0x3b')](',');var _0x24bd0e={};_0x24bd0e[_0x592972[0x0]]={'$gte':moment(_0x592972[0x1])[_0x8b1d('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x52591b[_0x8b1d('0x7e')]=_[_0x8b1d('0xa1')](_0x52591b[_0x8b1d('0x7e')],_0x24bd0e);}_0x52591b=_[_0x8b1d('0xa1')]({},_0x52591b,_0x3d130e[_0x8b1d('0x104')]);return db['ChatMessage'][_0x8b1d('0x2d')]({'where':_0x52591b[_0x8b1d('0x7e')]})[_0x8b1d('0x35')](function(_0x3f6420){_0x1fac91[_0x8b1d('0x2d')]=_0x3f6420;if(_0x3d130e[_0x8b1d('0x44')][_0x8b1d('0xba')]){_0x52591b[_0x8b1d('0xbb')]=[{'all':!![]}];}return db[_0x8b1d('0xca')][_0x8b1d('0x105')](_0x52591b);})[_0x8b1d('0x35')](function(_0x32ca0f){_0x1fac91[_0x8b1d('0xb7')]=_0x32ca0f;return _0x1fac91;});}})[_0x8b1d('0x35')](respondWithFilteredResult(_0x5785b8,_0x52591b))[_0x8b1d('0x28')](handleError(_0x5785b8,null));};exports[_0x8b1d('0x106')]=function(_0xe35d58,_0x1211ff,_0x749299){var _0xd3271c={'where':{}},_0x400edb={},_0x148af6={'count':0x0,'rows':[]};return db[_0x8b1d('0x3e')][_0x8b1d('0xbf')]({'where':{'id':_0xe35d58[_0x8b1d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1211ff,null))[_0x8b1d('0x35')](function(_0x245aba){if(_0x245aba){_0x400edb[_0x8b1d('0x48')]=_[_0x8b1d('0x45')](db[_0x8b1d('0xca')][_0x8b1d('0x3f')]);_0x400edb[_0x8b1d('0x44')]=_[_0x8b1d('0x45')](_0xe35d58['query']);_0x400edb[_0x8b1d('0x46')]=_[_0x8b1d('0x47')](_0x400edb['model'],_0x400edb[_0x8b1d('0x44')]);_0xd3271c[_0x8b1d('0x4a')]=_[_0x8b1d('0x47')](_0x400edb['model'],qs['fields'](_0xe35d58['query'][_0x8b1d('0x49')]));_0xd3271c[_0x8b1d('0x4a')]=_0xd3271c[_0x8b1d('0x4a')][_0x8b1d('0x66')]?_0xd3271c[_0x8b1d('0x4a')]:_0x400edb[_0x8b1d('0x48')];if(!_0xe35d58['query'][_0x8b1d('0x4b')]('nolimit')){_0xd3271c[_0x8b1d('0x2f')]=qs['limit'](_0xe35d58[_0x8b1d('0x44')]['limit']);_0xd3271c[_0x8b1d('0x2e')]=qs[_0x8b1d('0x2e')](_0xe35d58[_0x8b1d('0x44')]['offset']);}_0xd3271c['order']=qs[_0x8b1d('0x4e')](_0xe35d58[_0x8b1d('0x44')]['sort']);_0xd3271c[_0x8b1d('0x7e')]=qs[_0x8b1d('0x46')](_[_0x8b1d('0x103')](_0xe35d58[_0x8b1d('0x44')],_0x400edb[_0x8b1d('0x46')]));_0xd3271c['where'][_0x8b1d('0xb5')]=_0x245aba['id'];if(_0xe35d58[_0x8b1d('0x44')][_0x8b1d('0x8b')]){_0xd3271c[_0x8b1d('0x7e')]=_[_0x8b1d('0xa1')](_0xd3271c[_0x8b1d('0x7e')],{'$or':_[_0x8b1d('0x38')](_0xd3271c[_0x8b1d('0x4a')],function(_0x1407cb){var _0x1d627b={};_0x1d627b[_0x1407cb]={'$like':'%'+_0xe35d58['query'][_0x8b1d('0x8b')]+'%'};return _0x1d627b;})});}_0xd3271c[_0x8b1d('0x7e')][_0x8b1d('0x107')]=![];if(_0xe35d58['query']['id']){_0xd3271c['where']['id']={'$gt':_0xe35d58[_0x8b1d('0x44')]['id']};}_0xd3271c=_['merge']({},_0xd3271c,_0xe35d58['options']);return db['ChatMessage'][_0x8b1d('0x2d')]({'where':_0xd3271c[_0x8b1d('0x7e')]})['then'](function(_0x3e8f78){_0x148af6[_0x8b1d('0x2d')]=_0x3e8f78;_0xd3271c['include']=[];if(_0xe35d58[_0x8b1d('0x44')][_0x8b1d('0x108')]){_0xd3271c[_0x8b1d('0xbb')][_0x8b1d('0x3c')]({'model':db[_0x8b1d('0x73')],'as':'User','attributes':['id',_0x8b1d('0x109'),_0x8b1d('0x10a')]});}if(_0xe35d58['query']['includeAll']){_0xd3271c[_0x8b1d('0xbb')]=[{'all':!![]}];}return db['ChatMessage'][_0x8b1d('0x105')](_0xd3271c);})['then'](function(_0x59e6c4){_0x148af6[_0x8b1d('0xb7')]=_0x59e6c4;return _0x148af6;});}})[_0x8b1d('0x35')](respondWithFilteredResult(_0x1211ff,_0xd3271c))[_0x8b1d('0x28')](handleError(_0x1211ff,null));};exports[_0x8b1d('0x10b')]=function(_0x34fbb4,_0x15871b,_0x19ac5b){return db['ChatInteraction'][_0x8b1d('0x6f')]({'where':{'id':_0x34fbb4['params']['id']}})[_0x8b1d('0x35')](handleEntityNotFound(_0x15871b,null))[_0x8b1d('0x35')](function(_0x17afe2){if(_0x17afe2){return _0x17afe2[_0x8b1d('0x10c')](_0x34fbb4[_0x8b1d('0x78')][_0x8b1d('0x100')],_[_0x8b1d('0x101')](_0x34fbb4[_0x8b1d('0x78')],[_0x8b1d('0x100'),'id'])||{})[_0x8b1d('0x10d')](function(){return db[_0x8b1d('0x71')]['findAll']({'attributes':['id',_0x8b1d('0x43'),_0x8b1d('0x50')],'where':{'id':_0x34fbb4[_0x8b1d('0x78')][_0x8b1d('0x100')]}});})[_0x8b1d('0x35')](function(_0x5fd8b){socket[_0x8b1d('0x10e')](_0x8b1d('0x10f'),{'id':Number(_0x34fbb4['params']['id']),'tags':_0x5fd8b||[]});return{'id':Number(_0x34fbb4[_0x8b1d('0xb9')]['id']),'tags':_0x5fd8b||[]};});}})['then'](respondWithResult(_0x15871b,null))[_0x8b1d('0x28')](handleError(_0x15871b,null));};exports[_0x8b1d('0x110')]=function(_0x11b84f,_0x52ebed,_0x5e1195){return db[_0x8b1d('0x3e')][_0x8b1d('0x6f')]({'where':{'id':_0x11b84f[_0x8b1d('0xb9')]['id']}})[_0x8b1d('0x35')](handleEntityNotFound(_0x52ebed,null))[_0x8b1d('0x35')](function(_0x2d188d){if(_0x2d188d){return _0x2d188d[_0x8b1d('0x110')](_0x11b84f['query'][_0x8b1d('0x100')]);}})['then'](respondWithStatusCode(_0x52ebed,null))['catch'](handleError(_0x52ebed,null));};exports[_0x8b1d('0xdd')]=function(_0x10ee97,_0x43c615){var _0x5d92e7=moment()[_0x8b1d('0x111')]()[_0x8b1d('0xa0')]();var _0x22e410=path[_0x8b1d('0xde')](config['root'],_0x8b1d('0x112'),'files','tmp');var _0x4ce20c=path[_0x8b1d('0xde')](config['root'],_0x8b1d('0x112'),_0x8b1d('0x113'),_0x8b1d('0x114'));var _0x4ce4d9=path[_0x8b1d('0xde')](_0x22e410,_0x5d92e7);var _0x50dec4=util['format'](_0x8b1d('0x115'),_0x10ee97[_0x8b1d('0xb9')]['id'],_0x5d92e7);var _0x5133a2=path[_0x8b1d('0xde')](_0x22e410,_0x50dec4);var _0x2d7f75=[];_0x2d7f75[_0x8b1d('0x3c')]({'model':db[_0x8b1d('0x73')],'as':_0x8b1d('0x73'),'attributes':['id',_0x8b1d('0x109')],'raw':!![]});_0x2d7f75[_0x8b1d('0x3c')]({'model':db[_0x8b1d('0xcc')],'as':_0x8b1d('0x6c'),'attributes':['id','firstName',_0x8b1d('0x116')],'raw':!![]});if(_0x10ee97[_0x8b1d('0x44')][_0x8b1d('0x114')]){_0x2d7f75[_0x8b1d('0x3c')]({'model':db[_0x8b1d('0xd8')],'as':'Attachment','raw':!![]});}var _0x2a7e4b=[{'model':db['ChatMessage'],'as':_0x8b1d('0xe6'),'attributes':['id','body',_0x8b1d('0xf0'),'direction',_0x8b1d('0x107'),_0x8b1d('0x86')],'include':_0x2d7f75}];_0x2a7e4b['push']({'model':db[_0x8b1d('0xc0')],'as':_0x8b1d('0x117'),'attributes':['id',_0x8b1d('0x43')]});_0x2a7e4b[_0x8b1d('0x3c')]({'model':db[_0x8b1d('0x73')],'as':_0x8b1d('0x118'),'attributes':['id',_0x8b1d('0x109')]});return db[_0x8b1d('0x3e')]['find']({'where':{'id':_0x10ee97[_0x8b1d('0xb9')]['id']},'include':_0x2a7e4b})['then'](handleEntityNotFound(_0x43c615,null))['then'](function(_0x3f3258){if(_0x3f3258){var _0x264525=_0x3f3258[_0x8b1d('0x119')]({'plain':!![]});fs[_0x8b1d('0x11a')](_0x4ce4d9);var _0x1f616b={'format':'A4','border':_0x8b1d('0x11b'),'header':{'height':_0x8b1d('0x11c'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util[_0x8b1d('0xe3')](_0x8b1d('0x11d'),util[_0x8b1d('0xe3')](_0x8b1d('0x11e'),_0x8b1d('0x11f'),_0x264525['id']),moment()[_0x8b1d('0xe3')]('YYYY-MM-DD')[_0x8b1d('0xa0')]())}}};var _0x36c481={'channel':_0x8b1d('0x11f'),'account':_0x264525[_0x8b1d('0x117')][_0x8b1d('0x43')],'agent':_0x264525['Owner']?_0x264525[_0x8b1d('0x118')][_0x8b1d('0x109')]:_0x8b1d('0x120'),'createdAt':moment(_0x264525[_0x8b1d('0xf0')])[_0x8b1d('0xe3')](_0x8b1d('0x121'))[_0x8b1d('0xa0')](),'closedAt':_0x264525[_0x8b1d('0xda')]?moment(_0x264525[_0x8b1d('0x122')])[_0x8b1d('0xe3')](_0x8b1d('0x121'))[_0x8b1d('0xa0')]():'','disposition':_0x264525[_0x8b1d('0xd2')],'chatInfo':{'browser':_0x264525[_0x8b1d('0x123')],'os':_0x264525['osName'],'referer':_0x264525[_0x8b1d('0x124')],'customerIp':_0x264525[_0x8b1d('0x125')],'customerPort':_0x264525[_0x8b1d('0x126')]?_0x264525[_0x8b1d('0x126')]:_0x8b1d('0x120')},'messages':_(_0x264525['Messages'])[_0x8b1d('0x127')]()[_0x8b1d('0x8b')]({'secret':![]})[_0x8b1d('0x38')](function(_0x504e04){if(_0x504e04['Attachment']){var _0x27664e=path[_0x8b1d('0xde')](_0x4ce20c,_0x504e04[_0x8b1d('0xd8')][_0x8b1d('0xe0')]);if(fs[_0x8b1d('0x128')](_0x27664e)){fs[_0x8b1d('0x129')](_0x27664e)[_0x8b1d('0x12a')](fs[_0x8b1d('0x12b')](path[_0x8b1d('0xde')](_0x4ce4d9,_0x504e04['Attachment'][_0x8b1d('0xe0')])));}}return{'date':moment(_0x504e04[_0x8b1d('0xf0')])[_0x8b1d('0xe3')](_0x8b1d('0x121'))[_0x8b1d('0xa0')](),'sender':_0x504e04[_0x8b1d('0xf2')]===_0x8b1d('0xc9')?_0x504e04[_0x8b1d('0x73')]?_0x504e04[_0x8b1d('0x73')][_0x8b1d('0x109')]:_0x8b1d('0xe8'):_0x504e04[_0x8b1d('0x6c')][_0x8b1d('0x12c')]+(_0x504e04[_0x8b1d('0x6c')][_0x8b1d('0x116')]?'\x20'+_0x504e04[_0x8b1d('0x6c')][_0x8b1d('0x116')]:''),'body':_0x504e04[_0x8b1d('0xd8')]?_0x504e04[_0x8b1d('0xd8')][_0x8b1d('0xe0')]:_0x504e04[_0x8b1d('0x78')],'direction':_0x504e04['direction']===_0x8b1d('0xc9')?'A':'C','secret':_0x504e04['secret'],'read':_0x504e04[_0x8b1d('0x86')],'attachment':_0x504e04[_0x8b1d('0xd8')]};})[_0x8b1d('0x68')]()};return ejs['renderFile'](path[_0x8b1d('0xde')](config[_0x8b1d('0x12d')],_0x8b1d('0x112'),'views',_0x8b1d('0x12e')),{'interaction':_0x36c481})[_0x8b1d('0x35')](function(_0x52c007){return new BPromise(function(_0x226a34,_0x4310bf){pdf[_0x8b1d('0xbc')](_0x52c007,_0x1f616b)[_0x8b1d('0x12f')](path['join'](_0x4ce4d9,'transcript-'+_0x264525['id']+'-'+_0x5d92e7+_0x8b1d('0x130')),function(_0x18fb0f,_0x4440a8){if(_0x18fb0f)return _0x4310bf(_0x18fb0f);_0x226a34(_0x4440a8);});});})[_0x8b1d('0x35')](function(){return new BPromise(function(_0x212212,_0x5339af){zipdir(_0x4ce4d9,{'saveTo':_0x5133a2},function(_0x1d3088,_0x5b34aa){if(_0x1d3088)return _0x5339af(_0x1d3088);return _0x212212(_0x5b34aa);});})['then'](function(){return new BPromise(function(_0x906b20,_0x2b0ed3){rimraf(_0x4ce4d9,function(_0x23cd90){if(_0x23cd90)_0x2b0ed3(_0x23cd90);return _0x906b20();});});})['then'](function(){return _0x43c615[_0x8b1d('0xdd')](_0x5133a2,_0x50dec4,function(_0x25da5c){if(_0x25da5c){console[_0x8b1d('0x131')](_0x8b1d('0x132'),_0x25da5c);}else{fs['unlinkSync'](_0x5133a2);}});});});}else{return _0x43c615[_0x8b1d('0x29')](0xc8);}})['catch'](handleError(_0x43c615,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index da5c018..d8e5a5c 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 _0xeab8=['hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','setMaxListeners','save','update','remove','setDataValue','Users','map','then','unreadMessages','length','emit','catch'];(function(_0x74bb80,_0x92b0d4){var _0x6d0da9=function(_0x74ef70){while(--_0x74ef70){_0x74bb80['push'](_0x74bb80['shift']());}};_0x6d0da9(++_0x92b0d4);}(_0xeab8,0x147));var _0x8eab=function(_0x5a1a1c,_0x2202ce){_0x5a1a1c=_0x5a1a1c-0x0;var _0x5e8a0e=_0xeab8[_0x5a1a1c];return _0x5e8a0e;};'use strict';var EventEmitter=require(_0x8eab('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x8eab('0x1')];var ChatMessage=require(_0x8eab('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8eab('0x3')](0x0);var events={'afterCreate':_0x8eab('0x4'),'afterUpdate':_0x8eab('0x5'),'afterDestroy':_0x8eab('0x6')};function emitEvent(_0x3eb2ea){return function(_0x38988c,_0x1e1140,_0x19efb6){_0x38988c['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x349776){_0x38988c[_0x8eab('0x7')](_0x8eab('0x8'),_0x349776[_0x8eab('0x9')](function(_0xf2a5ec){return{'id':_0xf2a5ec['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x38988c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8eab('0xa')](function(_0x5947df){_0x38988c[_0x8eab('0x7')](_0x8eab('0xb'),_0x5947df[_0x8eab('0xc')]);ChatInteractionEvents[_0x8eab('0xd')](_0x3eb2ea+':'+_0x38988c['id'],_0x38988c);ChatInteractionEvents[_0x8eab('0xd')](_0x3eb2ea,_0x38988c);_0x19efb6(null);})[_0x8eab('0xe')](_0x19efb6(null));};}for(var e in events){if(events[_0x8eab('0xf')](e)){var event=events[e];ChatInteraction[_0x8eab('0x10')](e,emitEvent(event));}}module[_0x8eab('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x2431=['save','update','remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x2431,0xc9));var _0x1243=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2431[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x1243('0x0'));var ChatInteraction=require(_0x1243('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x1243('0x1'))['db'][_0x1243('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1243('0x3'),'afterUpdate':_0x1243('0x4'),'afterDestroy':_0x1243('0x5')};function emitEvent(_0x1ce471){return function(_0x4007fd,_0x378af7,_0x1a2686){_0x4007fd[_0x1243('0x6')]({'attributes':['id'],'raw':!![]})[_0x1243('0x7')](function(_0x406bad){_0x4007fd[_0x1243('0x8')](_0x1243('0x9'),_0x406bad[_0x1243('0xa')](function(_0x3e42d1){return{'id':_0x3e42d1['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4007fd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1243('0x7')](function(_0x35095d){_0x4007fd[_0x1243('0x8')]('unreadMessages',_0x35095d[_0x1243('0xb')]);ChatInteractionEvents[_0x1243('0xc')](_0x1ce471+':'+_0x4007fd['id'],_0x4007fd);ChatInteractionEvents[_0x1243('0xc')](_0x1ce471,_0x4007fd);_0x1a2686(null);})[_0x1243('0xd')](_0x1a2686(null));};}for(var e in events){if(events[_0x1243('0xe')](e)){var event=events[e];ChatInteraction[_0x1243('0xf')](e,emitEvent(event));}}module[_0x1243('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 7185eec..72031cb 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 _0xa157=['rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0xa157,0x1c6));var _0x7a15=function(_0xf0403,_0xf15e47){_0xf0403=_0xf0403-0x0;var _0x30eae8=_0xa157[_0xf0403];return _0x30eae8;};'use strict';var _=require('lodash');var util=require(_0x7a15('0x0'));var logger=require(_0x7a15('0x1'))(_0x7a15('0x2'));var moment=require(_0x7a15('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a15('0x4'));var rimraf=require(_0x7a15('0x5'));var config=require(_0x7a15('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x7a15('0x7')]=function(_0x53f369,_0x50bc03){return _0x53f369[_0x7a15('0x8')](_0x7a15('0x9'),attributes,{'tableName':_0x7a15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48a72e,_0x422771,_0x23e478){if(_0x48a72e[_0x7a15('0xb')](_0x7a15('0xc'))){_0x48a72e[_0x7a15('0xd')]=moment()[_0x7a15('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x23e478(null,_0x48a72e);}},'charset':_0x7a15('0xf'),'collate':_0x7a15('0x10')});}; \ No newline at end of file +var _0x6d44=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','closed'];(function(_0x5678c2,_0xd8cb89){var _0x263105=function(_0x4bb4e9){while(--_0x4bb4e9){_0x5678c2['push'](_0x5678c2['shift']());}};_0x263105(++_0xd8cb89);}(_0x6d44,0x1c3));var _0x46d4=function(_0x21fded,_0x203183){_0x21fded=_0x21fded-0x0;var _0x5927de=_0x6d44[_0x21fded];return _0x5927de;};'use strict';var _=require(_0x46d4('0x0'));var util=require('util');var logger=require(_0x46d4('0x1'))(_0x46d4('0x2'));var moment=require('moment');var BPromise=require(_0x46d4('0x3'));var rp=require(_0x46d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46d4('0x5'));var config=require('../../config/environment');var attributes=require(_0x46d4('0x6'));module[_0x46d4('0x7')]=function(_0xad8987,_0x493f80){return _0xad8987[_0x46d4('0x8')]('ChatInteraction',attributes,{'tableName':_0x46d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x234078,_0x1107a2,_0x28e594){if(_0x234078['changed'](_0x46d4('0xa'))){_0x234078['closedAt']=moment()['format'](_0x46d4('0xb'));}_0x28e594(null,_0x234078);}},'charset':_0x46d4('0xc'),'collate':_0x46d4('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 308706a..873b202 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 _0x62c5=['catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','then','debug','AddTagsToChatInteraction','find','ids','body','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request\x20sent','stringify','error','code','message','info','ChatInteraction,\x20%s,\x20%s','result'];(function(_0x214583,_0x50ecf8){var _0x418e3a=function(_0xd6473f){while(--_0xd6473f){_0x214583['push'](_0x214583['shift']());}};_0x418e3a(++_0x50ecf8);}(_0x62c5,0x130));var _0x562c=function(_0x1938f4,_0x5c0c98){_0x1938f4=_0x1938f4-0x0;var _0x37f4db=_0x62c5[_0x1938f4];return _0x37f4db;};'use strict';var _=require(_0x562c('0x0'));var util=require('util');var moment=require(_0x562c('0x1'));var BPromise=require(_0x562c('0x2'));var rs=require(_0x562c('0x3'));var fs=require('fs');var Redis=require(_0x562c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x562c('0x5'));var logger=require(_0x562c('0x6'))(_0x562c('0x7'));var config=require('../../config/environment');var jayson=require(_0x562c('0x8'));var client=jayson[_0x562c('0x9')]['http']({'port':0x232a});config[_0x562c('0xa')]=_[_0x562c('0xb')](config[_0x562c('0xa')],{'host':_0x562c('0xc'),'port':0x18eb});var socket=require(_0x562c('0xd'))(new Redis(config[_0x562c('0xa')]));require(_0x562c('0xe'))[_0x562c('0xf')](socket);function respondWithRpcPromise(_0x3cb335,_0x5ebdfc,_0xeacfab){return new BPromise(function(_0x273a85,_0x1613c6){return client['request'](_0x3cb335,_0xeacfab)['then'](function(_0xfe2e24){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5ebdfc,_0x562c('0x10'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5ebdfc,_0x562c('0x10'),JSON[_0x562c('0x11')](_0xfe2e24));if(_0xfe2e24[_0x562c('0x12')]){if(_0xfe2e24['error'][_0x562c('0x13')]===0x1f4){logger[_0x562c('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x5ebdfc,_0xfe2e24[_0x562c('0x12')][_0x562c('0x14')]);return _0x1613c6(_0xfe2e24[_0x562c('0x12')][_0x562c('0x14')]);}logger[_0x562c('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x5ebdfc,_0xfe2e24[_0x562c('0x12')][_0x562c('0x14')]);return _0x273a85(_0xfe2e24[_0x562c('0x12')][_0x562c('0x14')]);}else{logger[_0x562c('0x15')](_0x562c('0x16'),_0x5ebdfc,_0x562c('0x10'));_0x273a85(_0xfe2e24[_0x562c('0x17')]['message']);}})[_0x562c('0x18')](function(_0x3a5d70){logger[_0x562c('0x12')](_0x562c('0x16'),_0x5ebdfc,_0x3a5d70);_0x1613c6(_0x3a5d70);});});}exports[_0x562c('0x19')]=function(_0x146e2f){var _0x4ce388=this;return new Promise(function(_0x2fb394,_0x4597ed){return db[_0x562c('0x1a')][_0x562c('0x1b')](_0x146e2f['body'],{'raw':_0x146e2f[_0x562c('0x1c')]?_0x146e2f['options'][_0x562c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146e2f[_0x562c('0x1c')]?_0x146e2f[_0x562c('0x1c')][_0x562c('0x1e')]||null:null,'attributes':_0x146e2f[_0x562c('0x1c')]?_0x146e2f[_0x562c('0x1c')][_0x562c('0x1f')]||null:null,'limit':_0x146e2f['options']?_0x146e2f['options'][_0x562c('0x20')]||null:null})[_0x562c('0x21')](function(_0x277017){logger['info'](_0x562c('0x19'),_0x146e2f);logger[_0x562c('0x22')](_0x562c('0x19'),_0x146e2f,JSON[_0x562c('0x11')](_0x277017));_0x2fb394(_0x277017);})[_0x562c('0x18')](function(_0x205c61){logger[_0x562c('0x12')](_0x562c('0x19'),_0x205c61[_0x562c('0x14')],_0x146e2f);_0x4597ed(_0x4ce388['error'](0x1f4,_0x205c61[_0x562c('0x14')]));});});};exports[_0x562c('0x23')]=function(_0x37a74f){return new Promise(function(_0x22690c,_0x48a49a){return db['ChatInteraction'][_0x562c('0x24')]({'where':_0x37a74f[_0x562c('0x1c')]?_0x37a74f['options']['where']||null:null})['then'](function(_0x440bce){if(_0x440bce){return _0x440bce['addTags'](_0x37a74f['body'][_0x562c('0x25')],_['omit'](_0x37a74f[_0x562c('0x26')],[_0x562c('0x25'),'id'])||{});}})[_0x562c('0x27')](function(_0x15745b){logger[_0x562c('0x15')](_0x562c('0x28'),_0x37a74f);logger['debug']('AddTags',_0x37a74f,JSON[_0x562c('0x11')](_0x15745b));_0x22690c(_0x15745b);})['catch'](function(_0x3ead0d){logger['error'](_0x562c('0x28'),_0x3ead0d[_0x562c('0x14')],_0x37a74f);_0x48a49a(_this['error'](0x1f4,_0x3ead0d[_0x562c('0x14')]));});});}; \ No newline at end of file +var _0x1a85=['error','ChatInteraction,\x20%s,\x20%s','message','info','result','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','catch','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1a85,0xfc));var _0x51a8=function(_0x3fbeea,_0x59b594){_0x3fbeea=_0x3fbeea-0x0;var _0x479753=_0x1a85[_0x3fbeea];return _0x479753;};'use strict';var _=require(_0x51a8('0x0'));var util=require(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require(_0x51a8('0x3'));var rs=require(_0x51a8('0x4'));var fs=require('fs');var Redis=require(_0x51a8('0x5'));var db=require(_0x51a8('0x6'))['db'];var utils=require(_0x51a8('0x7'));var logger=require(_0x51a8('0x8'))(_0x51a8('0x9'));var config=require(_0x51a8('0xa'));var jayson=require(_0x51a8('0xb'));var client=jayson[_0x51a8('0xc')][_0x51a8('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x51a8('0xe')],{'host':_0x51a8('0xf'),'port':0x18eb});var socket=require(_0x51a8('0x10'))(new Redis(config[_0x51a8('0xe')]));require(_0x51a8('0x11'))[_0x51a8('0x12')](socket);function respondWithRpcPromise(_0x847bfc,_0x5d09aa,_0x5256ba){return new BPromise(function(_0x5c644d,_0x4218f9){return client[_0x51a8('0x13')](_0x847bfc,_0x5256ba)[_0x51a8('0x14')](function(_0x5709e1){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5d09aa,'request\x20sent');logger[_0x51a8('0x15')](_0x51a8('0x16'),_0x5d09aa,_0x51a8('0x17'),JSON['stringify'](_0x5709e1));if(_0x5709e1[_0x51a8('0x18')]){if(_0x5709e1[_0x51a8('0x18')]['code']===0x1f4){logger[_0x51a8('0x18')](_0x51a8('0x19'),_0x5d09aa,_0x5709e1[_0x51a8('0x18')][_0x51a8('0x1a')]);return _0x4218f9(_0x5709e1[_0x51a8('0x18')][_0x51a8('0x1a')]);}logger['error'](_0x51a8('0x19'),_0x5d09aa,_0x5709e1['error']['message']);return _0x5c644d(_0x5709e1[_0x51a8('0x18')][_0x51a8('0x1a')]);}else{logger[_0x51a8('0x1b')](_0x51a8('0x19'),_0x5d09aa,'request\x20sent');_0x5c644d(_0x5709e1[_0x51a8('0x1c')][_0x51a8('0x1a')]);}})['catch'](function(_0x23e798){logger['error'](_0x51a8('0x19'),_0x5d09aa,_0x23e798);_0x4218f9(_0x23e798);});});}exports['UpdateChatInteraction']=function(_0x50d8a9){var _0x5575e5=this;return new Promise(function(_0x1a82a2,_0xf8026d){return db[_0x51a8('0x1d')][_0x51a8('0x1e')](_0x50d8a9[_0x51a8('0x1f')],{'raw':_0x50d8a9[_0x51a8('0x20')]?_0x50d8a9['options'][_0x51a8('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d8a9[_0x51a8('0x20')]?_0x50d8a9['options'][_0x51a8('0x22')]||null:null,'attributes':_0x50d8a9[_0x51a8('0x20')]?_0x50d8a9['options'][_0x51a8('0x23')]||null:null,'limit':_0x50d8a9[_0x51a8('0x20')]?_0x50d8a9[_0x51a8('0x20')][_0x51a8('0x24')]||null:null})[_0x51a8('0x14')](function(_0x3eb126){logger[_0x51a8('0x1b')](_0x51a8('0x25'),_0x50d8a9);logger[_0x51a8('0x15')]('UpdateChatInteraction',_0x50d8a9,JSON[_0x51a8('0x26')](_0x3eb126));_0x1a82a2(_0x3eb126);})[_0x51a8('0x27')](function(_0xe4a62b){logger[_0x51a8('0x18')](_0x51a8('0x25'),_0xe4a62b[_0x51a8('0x1a')],_0x50d8a9);_0xf8026d(_0x5575e5[_0x51a8('0x18')](0x1f4,_0xe4a62b[_0x51a8('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x5dc56e){return new Promise(function(_0x10c56f,_0x9423a3){return db[_0x51a8('0x1d')][_0x51a8('0x28')]({'where':_0x5dc56e['options']?_0x5dc56e[_0x51a8('0x20')][_0x51a8('0x22')]||null:null})['then'](function(_0x405a26){if(_0x405a26){return _0x405a26[_0x51a8('0x29')](_0x5dc56e[_0x51a8('0x1f')][_0x51a8('0x2a')],_[_0x51a8('0x2b')](_0x5dc56e[_0x51a8('0x1f')],[_0x51a8('0x2a'),'id'])||{});}})[_0x51a8('0x2c')](function(_0x1f357d){logger[_0x51a8('0x1b')](_0x51a8('0x2d'),_0x5dc56e);logger[_0x51a8('0x15')](_0x51a8('0x2d'),_0x5dc56e,JSON[_0x51a8('0x26')](_0x1f357d));_0x10c56f(_0x1f357d);})[_0x51a8('0x27')](function(_0x3837fc){logger['error'](_0x51a8('0x2d'),_0x3837fc['message'],_0x5dc56e);_0x9423a3(_this[_0x51a8('0x18')](0x1f4,_0x3837fc[_0x51a8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 83cb1da..8acf4ed 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 _0x1a31=['./chatInteraction.events','emit','removeListener','length','chatInteraction:'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x1a31,0x6e));var _0x11a3=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x1a31[_0x36ed48];return _0x51c63a;};'use strict';var ChatInteractionEvents=require(_0x11a3('0x0'));var events=['save','remove','update'];function createListener(_0x45021f,_0x2f364a){return function(_0x525e1e){_0x2f364a[_0x11a3('0x1')](_0x45021f,_0x525e1e);};}function removeListener(_0x4d6068,_0x6b233e){return function(){ChatInteractionEvents[_0x11a3('0x2')](_0x4d6068,_0x6b233e);};}exports['register']=function(_0xf9a56e){for(var _0x1ba8c6=0x0,_0x192c65=events[_0x11a3('0x3')];_0x1ba8c6<_0x192c65;_0x1ba8c6++){var _0x1e37a3=events[_0x1ba8c6];var _0x438fc7=createListener(_0x11a3('0x4')+_0x1e37a3,_0xf9a56e);ChatInteractionEvents['on'](_0x1e37a3,_0x438fc7);}}; \ No newline at end of file +var _0xe087=['length','chatInteraction:','./chatInteraction.events','save','remove','update','removeListener'];(function(_0x5ab11f,_0x5d37df){var _0x19f216=function(_0x5245ae){while(--_0x5245ae){_0x5ab11f['push'](_0x5ab11f['shift']());}};_0x19f216(++_0x5d37df);}(_0xe087,0x16e));var _0x7e08=function(_0x80325c,_0x533fcf){_0x80325c=_0x80325c-0x0;var _0x45c539=_0xe087[_0x80325c];return _0x45c539;};'use strict';var ChatInteractionEvents=require(_0x7e08('0x0'));var events=[_0x7e08('0x1'),_0x7e08('0x2'),_0x7e08('0x3')];function createListener(_0x2bcd21,_0x3a7428){return function(_0x372b4c){_0x3a7428['emit'](_0x2bcd21,_0x372b4c);};}function removeListener(_0x189bf5,_0x14c72c){return function(){ChatInteractionEvents[_0x7e08('0x4')](_0x189bf5,_0x14c72c);};}exports['register']=function(_0xe47260){for(var _0x4e4757=0x0,_0x337171=events[_0x7e08('0x5')];_0x4e4757<_0x337171;_0x4e4757++){var _0x24f5ae=events[_0x4e4757];var _0x5f1e5f=createListener(_0x7e08('0x6')+_0x24f5ae,_0xe47260);ChatInteractionEvents['on'](_0x24f5ae,_0x5f1e5f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c1b00e2..914c156 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 _0xae7d=['index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','join','root','format','originalname','replace','single','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chat','destroy','removeTags','exports','multer','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xae7d,0x83));var _0xdae7=function(_0x298f02,_0x7602bd){_0x298f02=_0x298f02-0x0;var _0x47ec5d=_0xae7d[_0x298f02];return _0x47ec5d;};'use strict';var multer=require(_0xdae7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdae7('0x1'));var express=require(_0xdae7('0x2'));var router=express[_0xdae7('0x3')]();var auth=require(_0xdae7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0xdae7('0x5')]('/',auth[_0xdae7('0x6')](),controller[_0xdae7('0x7')]);router['get'](_0xdae7('0x8'),auth['isAuthenticated'](),controller[_0xdae7('0x9')]);router[_0xdae7('0x5')](_0xdae7('0xa'),auth[_0xdae7('0xb')](),controller[_0xdae7('0xc')]);router[_0xdae7('0x5')](_0xdae7('0xd'),auth[_0xdae7('0xb')](),controller[_0xdae7('0xe')]);router['get']('/:id/messages',auth[_0xdae7('0x6')](),controller[_0xdae7('0xf')]);router[_0xdae7('0x5')](_0xdae7('0x10'),auth[_0xdae7('0xb')](),controller[_0xdae7('0x11')]);router['get'](_0xdae7('0x12'),auth['isAuthenticated'](),controller['download']);router[_0xdae7('0x13')]('/',auth['isAuthenticated'](),controller[_0xdae7('0x14')]);router[_0xdae7('0x13')](_0xdae7('0x15'),auth[_0xdae7('0x6')](),controller[_0xdae7('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb53ef,_0x32a694,_0x290383){_0x290383(null,path[_0xdae7('0x17')](config[_0xdae7('0x18')],'server/files/attachments/'));},'filename':function(_0x31f088,_0x5498e0,_0x21e6e1){_0x21e6e1(null,util[_0xdae7('0x19')]('%s-%s',Date['now'](),_0x5498e0[_0xdae7('0x1a')][_0xdae7('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdae7('0x13')]('/:id/attachment_upload',upload[_0xdae7('0x1c')]('file'),controller['attachmentUpload']);router[_0xdae7('0x13')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xdae7('0x1d')]);router['post'](_0xdae7('0x1e'),auth[_0xdae7('0x6')](),interaction[_0xdae7('0x1f')]('chat',_0xdae7('0x20')),controller[_0xdae7('0x21')]);router[_0xdae7('0x22')](_0xdae7('0xa'),auth[_0xdae7('0x6')](),interaction[_0xdae7('0x1f')]('chat',_0xdae7('0x23')),controller[_0xdae7('0x24')]);router[_0xdae7('0x22')]('/:id/custom_update',controller[_0xdae7('0x25')]);router['put'](_0xdae7('0x26'),auth[_0xdae7('0xb')](),controller[_0xdae7('0x27')]);router[_0xdae7('0x22')](_0xdae7('0x28'),controller['close']);router[_0xdae7('0x29')](_0xdae7('0xa'),auth['isAuthenticated'](),interaction[_0xdae7('0x1f')](_0xdae7('0x2a'),'chatinteraction:destroy'),controller[_0xdae7('0x2b')]);router[_0xdae7('0x29')](_0xdae7('0x1e'),auth['isAuthenticated'](),controller[_0xdae7('0x2c')]);module[_0xdae7('0x2d')]=router; \ No newline at end of file +var _0xd5f7=['connect-timeout','express','Router','./chatInteraction.controller','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','post','create','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','put','chatinteraction:update','/:id/custom_update','customUpdate','abandon','/:id/close','close','destroy','delete','removeTags','exports','multer','path'];(function(_0x12e6f0,_0x392524){var _0x2010c5=function(_0x153e0e){while(--_0x153e0e){_0x12e6f0['push'](_0x12e6f0['shift']());}};_0x2010c5(++_0x392524);}(_0xd5f7,0x15e));var _0x7d5f=function(_0x17e241,_0xd2886e){_0x17e241=_0x17e241-0x0;var _0x1dd2ac=_0xd5f7[_0x17e241];return _0x1dd2ac;};'use strict';var multer=require(_0x7d5f('0x0'));var util=require('util');var path=require(_0x7d5f('0x1'));var timeout=require(_0x7d5f('0x2'));var express=require(_0x7d5f('0x3'));var router=express[_0x7d5f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7d5f('0x5'));router[_0x7d5f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7d5f('0x6')](_0x7d5f('0x7'),auth[_0x7d5f('0x8')](),controller[_0x7d5f('0x9')]);router['get'](_0x7d5f('0xa'),auth[_0x7d5f('0xb')](),controller['show']);router['get'](_0x7d5f('0xc'),auth[_0x7d5f('0xb')](),controller['attachmentDownload']);router[_0x7d5f('0x6')](_0x7d5f('0xd'),auth[_0x7d5f('0x8')](),controller[_0x7d5f('0xe')]);router[_0x7d5f('0x6')](_0x7d5f('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x7d5f('0x10')]);router[_0x7d5f('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x7d5f('0x11')]('/',auth[_0x7d5f('0x8')](),controller[_0x7d5f('0x12')]);router[_0x7d5f('0x11')]('/:id/vidaoo',auth[_0x7d5f('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d8228,_0x4ad808,_0x14fa87){_0x14fa87(null,path[_0x7d5f('0x13')](config[_0x7d5f('0x14')],_0x7d5f('0x15')));},'filename':function(_0x8d00f4,_0x24821c,_0x6d79b7){_0x6d79b7(null,util[_0x7d5f('0x16')](_0x7d5f('0x17'),Date[_0x7d5f('0x18')](),_0x24821c['originalname'][_0x7d5f('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7d5f('0x11')](_0x7d5f('0x1a'),upload[_0x7d5f('0x1b')](_0x7d5f('0x1c')),controller[_0x7d5f('0x1d')]);router['post'](_0x7d5f('0xd'),auth[_0x7d5f('0xb')](),controller['addMessage']);router[_0x7d5f('0x11')](_0x7d5f('0x1e'),auth[_0x7d5f('0x8')](),interaction[_0x7d5f('0x1f')](_0x7d5f('0x20'),'chatinteraction:addtags'),controller['addTags']);router[_0x7d5f('0x21')](_0x7d5f('0xa'),auth[_0x7d5f('0x8')](),interaction[_0x7d5f('0x1f')](_0x7d5f('0x20'),_0x7d5f('0x22')),controller['update']);router['put'](_0x7d5f('0x23'),controller[_0x7d5f('0x24')]);router[_0x7d5f('0x21')]('/:id/abandon',auth[_0x7d5f('0xb')](),controller[_0x7d5f('0x25')]);router[_0x7d5f('0x21')](_0x7d5f('0x26'),controller[_0x7d5f('0x27')]);router['delete']('/:id',auth[_0x7d5f('0x8')](),interaction[_0x7d5f('0x1f')]('chat','chatinteraction:destroy'),controller[_0x7d5f('0x28')]);router[_0x7d5f('0x29')](_0x7d5f('0x1e'),auth[_0x7d5f('0x8')](),controller[_0x7d5f('0x2a')]);module[_0x7d5f('0x2b')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index adb9f67..84fb90c 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 _0x14a0=['BOOLEAN','INTEGER','exports','TEXT','medium'];(function(_0x31c51f,_0x47959f){var _0x1de062=function(_0x5e9529){while(--_0x5e9529){_0x31c51f['push'](_0x31c51f['shift']());}};_0x1de062(++_0x47959f);}(_0x14a0,0x8e));var _0x014a=function(_0x26837f,_0x43553a){_0x26837f=_0x26837f-0x0;var _0x306d6f=_0x14a0[_0x26837f];return _0x306d6f;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'body':{'type':Sequelize[_0x014a('0x1')](_0x014a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x014a('0x4')]}}; \ No newline at end of file +var _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x1a85,0x178));var _0x51a8=function(_0x5d07e1,_0x418799){_0x5d07e1=_0x5d07e1-0x0;var _0x21617f=_0x1a85[_0x5d07e1];return _0x21617f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 44472b1..e54dff1 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 _0x7c35=['showWebBar','-online','VoiceQueues','role','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','filter','agent','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','user','fullname','userpic','online','lastLoginAt','allowmessenger'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7c35,0x168));var _0x57c3=function(_0x1abeef,_0x165c8c){_0x1abeef=_0x1abeef-0x0;var _0x568c78=_0x7c35[_0x1abeef];return _0x568c78;};'use strict';var pdf=require(_0x57c3('0x0'));var emlformat=require(_0x57c3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x57c3('0x2'));var rp=require(_0x57c3('0x3'));var moment=require(_0x57c3('0x4'));var BPromise=require(_0x57c3('0x5'));var Mustache=require(_0x57c3('0x6'));var util=require(_0x57c3('0x7'));var path=require(_0x57c3('0x8'));var sox=require(_0x57c3('0x9'));var csv=require(_0x57c3('0xa'));var ejs=require(_0x57c3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57c3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x57c3('0xe'));var Papa=require(_0x57c3('0xf'));var Redis=require(_0x57c3('0x10'));var authService=require(_0x57c3('0x11'));var qs=require(_0x57c3('0x12'));var as=require(_0x57c3('0x13'));var hardwareService=require(_0x57c3('0x14'));var logger=require(_0x57c3('0x15'))(_0x57c3('0x16'));var utils=require(_0x57c3('0x17'));var config=require(_0x57c3('0x18'));var licenseUtil=require(_0x57c3('0x19'));var db=require(_0x57c3('0x1a'))['db'];config[_0x57c3('0x1b')]=_[_0x57c3('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x57c3('0x1d'))(new Redis(config[_0x57c3('0x1b')]));require(_0x57c3('0x1e'))[_0x57c3('0x1f')](socket);function respondWithStatusCode(_0x1bb785,_0x121a14){_0x121a14=_0x121a14||0xcc;return function(_0x46688f){if(_0x46688f){return _0x1bb785[_0x57c3('0x20')](_0x121a14);}return _0x1bb785['status'](_0x121a14)[_0x57c3('0x21')]();};}function respondWithResult(_0x20a13a,_0x164499){_0x164499=_0x164499||0xc8;return function(_0xdda21f){if(_0xdda21f){return _0x20a13a[_0x57c3('0x22')](_0x164499)[_0x57c3('0x23')](_0xdda21f);}};}function respondWithFilteredResult(_0x4ca7af,_0x434718){return function(_0x1a79ee){if(_0x1a79ee){var _0x4567b3=_0x1a79ee[_0x57c3('0x24')],_0xc92615=_0x434718[_0x57c3('0x25')],_0x3b81a6=_0x434718[_0x57c3('0x25')]+_0x434718[_0x57c3('0x26')],_0x2a3ee5;if(_0x3b81a6>=_0x4567b3){_0x3b81a6=_0x4567b3;_0x2a3ee5=0xc8;}else{_0x2a3ee5=0xce;}_0x4ca7af[_0x57c3('0x22')](_0x2a3ee5);return _0x4ca7af['set'](_0x57c3('0x27'),_0xc92615+'-'+_0x3b81a6+'/'+_0x4567b3)[_0x57c3('0x23')](_0x1a79ee);}return null;};}function patchUpdates(_0x1a5aa2){return function(_0x18c508){try{jsonpatch[_0x57c3('0x28')](_0x18c508,_0x1a5aa2,!![]);}catch(_0x4d232b){return BPromise[_0x57c3('0x29')](_0x4d232b);}return _0x18c508[_0x57c3('0x2a')]();};}function saveUpdates(_0x25be34,_0x496a43){return function(_0x2c9067){if(_0x2c9067){return _0x2c9067[_0x57c3('0x2b')](_0x25be34)[_0x57c3('0x2c')](function(_0x226bce){return _0x226bce;});}return null;};}function removeEntity(_0x2d1259,_0x111c23){return function(_0x546ad7){if(_0x546ad7){return _0x546ad7[_0x57c3('0x2d')]()[_0x57c3('0x2c')](function(){_0x2d1259[_0x57c3('0x22')](0xcc)[_0x57c3('0x21')]();});}};}function handleEntityNotFound(_0x4f7a5b,_0x5128b6){return function(_0x35abf0){if(!_0x35abf0){_0x4f7a5b[_0x57c3('0x20')](0x194);}return _0x35abf0;};}function handleError(_0x1a3429,_0x5cd838){_0x5cd838=_0x5cd838||0x1f4;return function(_0x266212){logger[_0x57c3('0x2e')](_0x266212[_0x57c3('0x2f')]);if(_0x266212[_0x57c3('0x30')]){delete _0x266212[_0x57c3('0x30')];}_0x1a3429['status'](_0x5cd838)[_0x57c3('0x31')](_0x266212);};}exports['index']=function(_0x7e2e32,_0xf96a26){var _0x52c6f0={},_0x532cff={},_0x256e6e={'count':0x0,'rows':[]};var _0x41bf8b=_[_0x57c3('0x32')](db[_0x57c3('0x33')][_0x57c3('0x34')],function(_0x1fdf1f){return{'name':_0x1fdf1f[_0x57c3('0x35')],'type':_0x1fdf1f['type']['key']};});_0x532cff[_0x57c3('0x36')]=_[_0x57c3('0x32')](_0x41bf8b,_0x57c3('0x30'));_0x532cff[_0x57c3('0x37')]=_['keys'](_0x7e2e32['query']);_0x532cff['filters']=_['intersection'](_0x532cff[_0x57c3('0x36')],_0x532cff[_0x57c3('0x37')]);_0x52c6f0[_0x57c3('0x38')]=_[_0x57c3('0x39')](_0x532cff[_0x57c3('0x36')],qs[_0x57c3('0x3a')](_0x7e2e32[_0x57c3('0x37')][_0x57c3('0x3a')]));_0x52c6f0['attributes']=_0x52c6f0[_0x57c3('0x38')][_0x57c3('0x3b')]?_0x52c6f0[_0x57c3('0x38')]:_0x532cff[_0x57c3('0x36')];if(!_0x7e2e32[_0x57c3('0x37')][_0x57c3('0x3c')](_0x57c3('0x3d'))){_0x52c6f0[_0x57c3('0x26')]=qs['limit'](_0x7e2e32[_0x57c3('0x37')][_0x57c3('0x26')]);_0x52c6f0[_0x57c3('0x25')]=qs['offset'](_0x7e2e32[_0x57c3('0x37')][_0x57c3('0x25')]);}_0x52c6f0['order']=qs[_0x57c3('0x3e')](_0x7e2e32[_0x57c3('0x37')]['sort']);_0x52c6f0[_0x57c3('0x3f')]=qs[_0x57c3('0x40')](_[_0x57c3('0x41')](_0x7e2e32[_0x57c3('0x37')],_0x532cff[_0x57c3('0x40')]),_0x41bf8b);if(_0x7e2e32[_0x57c3('0x37')]['filter']){_0x52c6f0[_0x57c3('0x3f')]=_['merge'](_0x52c6f0[_0x57c3('0x3f')],{'$or':_['map'](_0x41bf8b,function(_0x5900e2){if(_0x5900e2[_0x57c3('0x42')]!==_0x57c3('0x43')){var _0x15019a={};_0x15019a[_0x5900e2['name']]={'$like':'%'+_0x7e2e32[_0x57c3('0x37')]['filter']+'%'};return _0x15019a;}})});}_0x52c6f0=_[_0x57c3('0x44')]({},_0x52c6f0,_0x7e2e32[_0x57c3('0x45')]);var _0x38be38={'where':_0x52c6f0[_0x57c3('0x3f')]};return db['ChatInternalMessage'][_0x57c3('0x24')](_0x38be38)['then'](function(_0x445871){_0x256e6e[_0x57c3('0x24')]=_0x445871;if(_0x7e2e32[_0x57c3('0x37')][_0x57c3('0x46')]){_0x52c6f0[_0x57c3('0x47')]=[{'all':!![]}];}return db[_0x57c3('0x33')]['findAll'](_0x52c6f0);})['then'](function(_0x12a00b){_0x256e6e[_0x57c3('0x48')]=_0x12a00b;return _0x256e6e;})[_0x57c3('0x2c')](respondWithFilteredResult(_0xf96a26,_0x52c6f0))[_0x57c3('0x49')](handleError(_0xf96a26,null));};exports['show']=function(_0x47f86a,_0x5e1e25){var _0xfe352b={'raw':!![],'where':{'id':_0x47f86a[_0x57c3('0x4a')]['id']}},_0x5e8001={};_0x5e8001[_0x57c3('0x36')]=_[_0x57c3('0x4b')](db['ChatInternalMessage']['rawAttributes']);_0x5e8001[_0x57c3('0x37')]=_['keys'](_0x47f86a[_0x57c3('0x37')]);_0x5e8001[_0x57c3('0x40')]=_[_0x57c3('0x39')](_0x5e8001[_0x57c3('0x36')],_0x5e8001[_0x57c3('0x37')]);_0xfe352b['attributes']=_['intersection'](_0x5e8001['model'],qs[_0x57c3('0x3a')](_0x47f86a[_0x57c3('0x37')]['fields']));_0xfe352b[_0x57c3('0x38')]=_0xfe352b[_0x57c3('0x38')][_0x57c3('0x3b')]?_0xfe352b[_0x57c3('0x38')]:_0x5e8001[_0x57c3('0x36')];if(_0x47f86a[_0x57c3('0x37')][_0x57c3('0x46')]){_0xfe352b['include']=[{'all':!![]}];}_0xfe352b=_[_0x57c3('0x44')]({},_0xfe352b,_0x47f86a[_0x57c3('0x45')]);return db[_0x57c3('0x33')][_0x57c3('0x4c')](_0xfe352b)['then'](handleEntityNotFound(_0x5e1e25,null))['then'](respondWithResult(_0x5e1e25,null))[_0x57c3('0x49')](handleError(_0x5e1e25,null));};exports['create']=function(_0x16fb20,_0x479447){return db[_0x57c3('0x33')][_0x57c3('0x4d')](_0x16fb20['body'],{})[_0x57c3('0x2c')](respondWithResult(_0x479447,0xc9))[_0x57c3('0x49')](handleError(_0x479447,null));};exports[_0x57c3('0x2b')]=function(_0x440e31,_0x12b3a6){if(_0x440e31[_0x57c3('0x4e')]['id']){delete _0x440e31[_0x57c3('0x4e')]['id'];}return db[_0x57c3('0x33')]['find']({'where':{'id':_0x440e31[_0x57c3('0x4a')]['id']}})[_0x57c3('0x2c')](handleEntityNotFound(_0x12b3a6,null))[_0x57c3('0x2c')](saveUpdates(_0x440e31[_0x57c3('0x4e')],null))[_0x57c3('0x2c')](respondWithResult(_0x12b3a6,null))[_0x57c3('0x49')](handleError(_0x12b3a6,null));};exports[_0x57c3('0x2d')]=function(_0x1e162f,_0x1883b1){return db['ChatInternalMessage']['find']({'where':{'id':_0x1e162f[_0x57c3('0x4a')]['id']}})[_0x57c3('0x2c')](handleEntityNotFound(_0x1883b1,null))[_0x57c3('0x2c')](removeEntity(_0x1883b1,null))[_0x57c3('0x49')](handleError(_0x1883b1,null));};exports[_0x57c3('0x4f')]=function(_0x586a2f,_0x36398){return db['ChatInternalMessage'][_0x57c3('0x4f')]()['then'](respondWithResult(_0x36398,null))[_0x57c3('0x49')](handleError(_0x36398,null));};function wrapUser(_0x63a9ae){return function(_0x4be559){var _0xe94efe=_0x63a9ae[_0x57c3('0x50')]({'plain':!![]});_0xe94efe[_0x57c3('0x51')]=[];if(_0x4be559){_0xe94efe[_0x57c3('0x52')]=_0x4be559[_0x57c3('0x53')];_0xe94efe[_0x57c3('0x54')]=_0x4be559;}else{_0xe94efe[_0x57c3('0x52')]=moment(0x0)[_0x57c3('0x55')](_0x57c3('0x56'));_0xe94efe[_0x57c3('0x54')]={};}return _0xe94efe;};}exports[_0x57c3('0x57')]=function(_0x33529f,_0x96c3c0,_0x5d1a6f){var _0x2d731e=[];return db[_0x57c3('0x58')][_0x57c3('0x59')]({'where':{'role':['agent','admin',_0x57c3('0x5a')]},'attributes':['id',_0x57c3('0x5b'),_0x57c3('0x30'),'role',_0x57c3('0x5c'),'internal',_0x57c3('0x5d'),_0x57c3('0x5e'),_0x57c3('0x5f'),_0x57c3('0x60')],'order':qs[_0x57c3('0x3e')](_0x57c3('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0x57c3('0x62'),'attributes':['id',_0x57c3('0x30'),_0x57c3('0x42')],'through':{'attributes':[]}}]})[_0x57c3('0x2c')](function(_0x49dc2c){if(_0x49dc2c){var _0x177c66=_0x33529f[_0x57c3('0x5a')][_0x57c3('0x50')]({'plain':!![]});if(!_0x177c66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x177c66[_0x57c3('0x63')]===_0x57c3('0x5a')){return db[_0x57c3('0x64')][_0x57c3('0x4c')]({'where':{'name':_0x57c3('0x65'),'userProfileId':_0x177c66[_0x57c3('0x66')]},'raw':!![]})[_0x57c3('0x2c')](function(_0x58ec8b){if(_0x58ec8b){if(_0x58ec8b[_0x57c3('0x67')]===0x0){return db['UserProfileResource'][_0x57c3('0x59')]({'where':{'sectionId':_0x58ec8b['id']},'raw':!![]})[_0x57c3('0x2c')](function(_0x2ea021){var _0x482b56=[];if(_[_0x57c3('0x68')](_0x2ea021)){_0x482b56=_[_0x57c3('0x69')](_0x49dc2c,function(_0x369498){if(_0x369498[_0x57c3('0x63')]!==_0x57c3('0x6a')){return _0x369498;}});return _0x482b56;}else{for(var _0x449d1a=0x0;_0x449d1a<_0x49dc2c[_0x57c3('0x3b')];_0x449d1a++){var _0x27ed19=_0x49dc2c[_0x449d1a];if(_0x27ed19[_0x57c3('0x63')]==='agent'){var _0x7fe3b2=_[_0x57c3('0x4c')](_0x2ea021,function(_0x328089){return _0x328089[_0x57c3('0x6b')]===_0x27ed19['id'];});if(_0x7fe3b2)_0x482b56[_0x57c3('0x6c')](_0x27ed19);}else{_0x482b56[_0x57c3('0x6c')](_0x27ed19);}}return _0x482b56;}});}else{return _0x49dc2c;}}else{var _0x474c96=_[_0x57c3('0x69')](_0x49dc2c,function(_0xca28ec){if(_0xca28ec['role']!==_0x57c3('0x6a')){return _0xca28ec;}});return _0x474c96;}});}else{return _0x49dc2c;}}})['then'](function(_0x55c021){var _0x490058=[];if(_0x55c021){_0x2d731e=_0x55c021;for(var _0x1dd5a2=0x0;_0x1dd5a2<_0x55c021[_0x57c3('0x3b')];_0x1dd5a2+=0x1){_0x2d731e[_0x1dd5a2][_0x57c3('0x51')]=[];_0x490058[_0x57c3('0x6c')](db['ChatInternalMessage'][_0x57c3('0x4c')]({'where':{'FromId':[_0x33529f[_0x57c3('0x5a')]['id'],_0x55c021[_0x1dd5a2]['id']],'ToId':[_0x33529f[_0x57c3('0x5a')]['id'],_0x55c021[_0x1dd5a2]['id']],'ChatGroupId':null},'attributes':['id',_0x57c3('0x53'),_0x57c3('0x6d'),_0x57c3('0x6e'),_0x57c3('0x6f'),_0x57c3('0x4e')],'order':qs[_0x57c3('0x3e')](_0x57c3('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x57c3('0x2c')](wrapUser(_0x55c021[_0x1dd5a2])));}return BPromise[_0x57c3('0x71')](_0x490058);}return[];})[_0x57c3('0x2c')](function(_0x2ec077){return{'rows':_0x2ec077,'count':_0x2ec077['length']};})[_0x57c3('0x2c')](respondWithResult(_0x96c3c0,null))[_0x57c3('0x49')](handleError(_0x96c3c0,null));}; \ No newline at end of file +var _0x4ca3=['rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','describe','get','createdAt','lastMessage','User','agent','user','fullname','userpic','internal','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','UserProfileResource','resourceId','push','FromId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','save','destroy','then','end','error','stack','name','send','index','map','ChatInternalMessage'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x4ca3,0x9f));var _0x34ca=function(_0x1849bf,_0x91a62b){_0x1849bf=_0x1849bf-0x0;var _0x94fbe0=_0x4ca3[_0x1849bf];return _0x94fbe0;};'use strict';var pdf=require(_0x34ca('0x0'));var emlformat=require(_0x34ca('0x1'));var rimraf=require(_0x34ca('0x2'));var zipdir=require(_0x34ca('0x3'));var jsonpatch=require(_0x34ca('0x4'));var rp=require(_0x34ca('0x5'));var moment=require(_0x34ca('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x34ca('0x7'));var util=require('util');var path=require(_0x34ca('0x8'));var sox=require('sox');var csv=require(_0x34ca('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x34ca('0xa'));var squel=require('squel');var crypto=require(_0x34ca('0xb'));var jsforce=require(_0x34ca('0xc'));var deskjs=require(_0x34ca('0xd'));var toCsv=require(_0x34ca('0x9'));var querystring=require(_0x34ca('0xe'));var Papa=require(_0x34ca('0xf'));var Redis=require(_0x34ca('0x10'));var authService=require(_0x34ca('0x11'));var qs=require(_0x34ca('0x12'));var as=require(_0x34ca('0x13'));var hardwareService=require(_0x34ca('0x14'));var logger=require(_0x34ca('0x15'))(_0x34ca('0x16'));var utils=require('../../config/utils');var config=require(_0x34ca('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x34ca('0x18'))['db'];config[_0x34ca('0x19')]=_[_0x34ca('0x1a')](config[_0x34ca('0x19')],{'host':_0x34ca('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34ca('0x19')]));require(_0x34ca('0x1c'))[_0x34ca('0x1d')](socket);function respondWithStatusCode(_0x612acd,_0x3ded0f){_0x3ded0f=_0x3ded0f||0xcc;return function(_0x2c8238){if(_0x2c8238){return _0x612acd[_0x34ca('0x1e')](_0x3ded0f);}return _0x612acd['status'](_0x3ded0f)['end']();};}function respondWithResult(_0x527a1c,_0xe18555){_0xe18555=_0xe18555||0xc8;return function(_0x552ad9){if(_0x552ad9){return _0x527a1c[_0x34ca('0x1f')](_0xe18555)[_0x34ca('0x20')](_0x552ad9);}};}function respondWithFilteredResult(_0x4d94eb,_0x31d9b0){return function(_0x3da5a0){if(_0x3da5a0){var _0x5df665=_0x3da5a0[_0x34ca('0x21')],_0x3fba14=_0x31d9b0[_0x34ca('0x22')],_0x280664=_0x31d9b0[_0x34ca('0x22')]+_0x31d9b0[_0x34ca('0x23')],_0x45f747;if(_0x280664>=_0x5df665){_0x280664=_0x5df665;_0x45f747=0xc8;}else{_0x45f747=0xce;}_0x4d94eb[_0x34ca('0x1f')](_0x45f747);return _0x4d94eb['set']('Content-Range',_0x3fba14+'-'+_0x280664+'/'+_0x5df665)[_0x34ca('0x20')](_0x3da5a0);}return null;};}function patchUpdates(_0x3d2920){return function(_0x50e991){try{jsonpatch['apply'](_0x50e991,_0x3d2920,!![]);}catch(_0x127b3d){return BPromise['reject'](_0x127b3d);}return _0x50e991[_0x34ca('0x24')]();};}function saveUpdates(_0x531001,_0x3e6c0f){return function(_0x4028d8){if(_0x4028d8){return _0x4028d8['update'](_0x531001)['then'](function(_0x200ab7){return _0x200ab7;});}return null;};}function removeEntity(_0x15c32e,_0x458cec){return function(_0xcede8a){if(_0xcede8a){return _0xcede8a[_0x34ca('0x25')]()[_0x34ca('0x26')](function(){_0x15c32e[_0x34ca('0x1f')](0xcc)[_0x34ca('0x27')]();});}};}function handleEntityNotFound(_0x239983,_0x2f61f6){return function(_0x89bc2f){if(!_0x89bc2f){_0x239983['sendStatus'](0x194);}return _0x89bc2f;};}function handleError(_0x76d9f0,_0x537c01){_0x537c01=_0x537c01||0x1f4;return function(_0x59e321){logger[_0x34ca('0x28')](_0x59e321[_0x34ca('0x29')]);if(_0x59e321[_0x34ca('0x2a')]){delete _0x59e321['name'];}_0x76d9f0['status'](_0x537c01)[_0x34ca('0x2b')](_0x59e321);};}exports[_0x34ca('0x2c')]=function(_0x152bd9,_0x446748){var _0x45eef8={},_0x3bd449={},_0x2102d0={'count':0x0,'rows':[]};var _0x50f887=_[_0x34ca('0x2d')](db[_0x34ca('0x2e')][_0x34ca('0x2f')],function(_0x1b2f72){return{'name':_0x1b2f72['fieldName'],'type':_0x1b2f72[_0x34ca('0x30')]['key']};});_0x3bd449['model']=_[_0x34ca('0x2d')](_0x50f887,'name');_0x3bd449[_0x34ca('0x31')]=_[_0x34ca('0x32')](_0x152bd9['query']);_0x3bd449['filters']=_[_0x34ca('0x33')](_0x3bd449[_0x34ca('0x34')],_0x3bd449[_0x34ca('0x31')]);_0x45eef8[_0x34ca('0x35')]=_[_0x34ca('0x33')](_0x3bd449['model'],qs[_0x34ca('0x36')](_0x152bd9[_0x34ca('0x31')]['fields']));_0x45eef8[_0x34ca('0x35')]=_0x45eef8[_0x34ca('0x35')][_0x34ca('0x37')]?_0x45eef8[_0x34ca('0x35')]:_0x3bd449[_0x34ca('0x34')];if(!_0x152bd9[_0x34ca('0x31')][_0x34ca('0x38')](_0x34ca('0x39'))){_0x45eef8[_0x34ca('0x23')]=qs[_0x34ca('0x23')](_0x152bd9['query'][_0x34ca('0x23')]);_0x45eef8[_0x34ca('0x22')]=qs[_0x34ca('0x22')](_0x152bd9[_0x34ca('0x31')]['offset']);}_0x45eef8[_0x34ca('0x3a')]=qs[_0x34ca('0x3b')](_0x152bd9[_0x34ca('0x31')][_0x34ca('0x3b')]);_0x45eef8[_0x34ca('0x3c')]=qs['filters'](_[_0x34ca('0x3d')](_0x152bd9[_0x34ca('0x31')],_0x3bd449['filters']),_0x50f887);if(_0x152bd9[_0x34ca('0x31')][_0x34ca('0x3e')]){_0x45eef8[_0x34ca('0x3c')]=_[_0x34ca('0x3f')](_0x45eef8[_0x34ca('0x3c')],{'$or':_[_0x34ca('0x2d')](_0x50f887,function(_0x112e50){if(_0x112e50[_0x34ca('0x30')]!==_0x34ca('0x40')){var _0x13bf3a={};_0x13bf3a[_0x112e50['name']]={'$like':'%'+_0x152bd9[_0x34ca('0x31')][_0x34ca('0x3e')]+'%'};return _0x13bf3a;}})});}_0x45eef8=_[_0x34ca('0x3f')]({},_0x45eef8,_0x152bd9[_0x34ca('0x41')]);var _0x19874f={'where':_0x45eef8[_0x34ca('0x3c')]};return db[_0x34ca('0x2e')]['count'](_0x19874f)[_0x34ca('0x26')](function(_0x4548f9){_0x2102d0['count']=_0x4548f9;if(_0x152bd9[_0x34ca('0x31')][_0x34ca('0x42')]){_0x45eef8[_0x34ca('0x43')]=[{'all':!![]}];}return db[_0x34ca('0x2e')][_0x34ca('0x44')](_0x45eef8);})[_0x34ca('0x26')](function(_0x381fb8){_0x2102d0[_0x34ca('0x45')]=_0x381fb8;return _0x2102d0;})[_0x34ca('0x26')](respondWithFilteredResult(_0x446748,_0x45eef8))[_0x34ca('0x46')](handleError(_0x446748,null));};exports[_0x34ca('0x47')]=function(_0x4ecddd,_0x310d35){var _0x3596c0={'raw':!![],'where':{'id':_0x4ecddd[_0x34ca('0x48')]['id']}},_0x2b5981={};_0x2b5981['model']=_[_0x34ca('0x32')](db[_0x34ca('0x2e')][_0x34ca('0x2f')]);_0x2b5981['query']=_[_0x34ca('0x32')](_0x4ecddd[_0x34ca('0x31')]);_0x2b5981[_0x34ca('0x49')]=_[_0x34ca('0x33')](_0x2b5981[_0x34ca('0x34')],_0x2b5981[_0x34ca('0x31')]);_0x3596c0[_0x34ca('0x35')]=_[_0x34ca('0x33')](_0x2b5981[_0x34ca('0x34')],qs[_0x34ca('0x36')](_0x4ecddd[_0x34ca('0x31')][_0x34ca('0x36')]));_0x3596c0[_0x34ca('0x35')]=_0x3596c0[_0x34ca('0x35')]['length']?_0x3596c0[_0x34ca('0x35')]:_0x2b5981['model'];if(_0x4ecddd['query'][_0x34ca('0x42')]){_0x3596c0[_0x34ca('0x43')]=[{'all':!![]}];}_0x3596c0=_[_0x34ca('0x3f')]({},_0x3596c0,_0x4ecddd[_0x34ca('0x41')]);return db[_0x34ca('0x2e')][_0x34ca('0x4a')](_0x3596c0)[_0x34ca('0x26')](handleEntityNotFound(_0x310d35,null))[_0x34ca('0x26')](respondWithResult(_0x310d35,null))['catch'](handleError(_0x310d35,null));};exports[_0x34ca('0x4b')]=function(_0x4287f9,_0xc831f5){return db[_0x34ca('0x2e')][_0x34ca('0x4b')](_0x4287f9['body'],{})[_0x34ca('0x26')](respondWithResult(_0xc831f5,0xc9))['catch'](handleError(_0xc831f5,null));};exports['update']=function(_0x433883,_0x5d73f2){if(_0x433883[_0x34ca('0x4c')]['id']){delete _0x433883[_0x34ca('0x4c')]['id'];}return db[_0x34ca('0x2e')][_0x34ca('0x4a')]({'where':{'id':_0x433883[_0x34ca('0x48')]['id']}})[_0x34ca('0x26')](handleEntityNotFound(_0x5d73f2,null))[_0x34ca('0x26')](saveUpdates(_0x433883['body'],null))['then'](respondWithResult(_0x5d73f2,null))['catch'](handleError(_0x5d73f2,null));};exports['destroy']=function(_0x1cba49,_0x1550f0){return db['ChatInternalMessage'][_0x34ca('0x4a')]({'where':{'id':_0x1cba49[_0x34ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1550f0,null))[_0x34ca('0x26')](removeEntity(_0x1550f0,null))[_0x34ca('0x46')](handleError(_0x1550f0,null));};exports[_0x34ca('0x4d')]=function(_0x3505bb,_0x49ed0){return db[_0x34ca('0x2e')][_0x34ca('0x4d')]()[_0x34ca('0x26')](respondWithResult(_0x49ed0,null))[_0x34ca('0x46')](handleError(_0x49ed0,null));};function wrapUser(_0x360272){return function(_0x32c0d5){var _0x164d56=_0x360272[_0x34ca('0x4e')]({'plain':!![]});_0x164d56['messages']=[];if(_0x32c0d5){_0x164d56['lastMessageAt']=_0x32c0d5[_0x34ca('0x4f')];_0x164d56[_0x34ca('0x50')]=_0x32c0d5;}else{_0x164d56['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x164d56[_0x34ca('0x50')]={};}return _0x164d56;};}exports['getUsers']=function(_0x403add,_0x4da05f,_0x1003c5){var _0x47075a=[];return db[_0x34ca('0x51')]['findAll']({'where':{'role':[_0x34ca('0x52'),'admin',_0x34ca('0x53')]},'attributes':['id',_0x34ca('0x54'),_0x34ca('0x2a'),'role',_0x34ca('0x55'),_0x34ca('0x56'),'online','lastLoginAt',_0x34ca('0x57'),_0x34ca('0x58')],'order':qs['sort']('-online'),'include':[{'model':db[_0x34ca('0x59')],'as':_0x34ca('0x5a'),'attributes':['id','name',_0x34ca('0x30')],'through':{'attributes':[]}}]})['then'](function(_0x5e4455){if(_0x5e4455){var _0x395815=_0x403add['user'][_0x34ca('0x4e')]({'plain':!![]});if(!_0x395815)throw new Error(_0x34ca('0x5b'));if(_0x395815[_0x34ca('0x5c')]===_0x34ca('0x53')){return db[_0x34ca('0x5d')]['find']({'where':{'name':_0x34ca('0x5e'),'userProfileId':_0x395815[_0x34ca('0x5f')]},'raw':!![]})[_0x34ca('0x26')](function(_0x2a829c){if(_0x2a829c){if(_0x2a829c['autoAssociation']===0x0){return db[_0x34ca('0x60')][_0x34ca('0x44')]({'where':{'sectionId':_0x2a829c['id']},'raw':!![]})[_0x34ca('0x26')](function(_0x37af71){var _0x381297=[];if(_['isEmpty'](_0x37af71)){_0x381297=_[_0x34ca('0x3e')](_0x5e4455,function(_0x51f01b){if(_0x51f01b[_0x34ca('0x5c')]!=='agent'){return _0x51f01b;}});return _0x381297;}else{for(var _0x1906cf=0x0;_0x1906cf<_0x5e4455['length'];_0x1906cf++){var _0x1f437d=_0x5e4455[_0x1906cf];if(_0x1f437d['role']===_0x34ca('0x52')){var _0x470b1c=_[_0x34ca('0x4a')](_0x37af71,function(_0x55b7ad){return _0x55b7ad[_0x34ca('0x61')]===_0x1f437d['id'];});if(_0x470b1c)_0x381297[_0x34ca('0x62')](_0x1f437d);}else{_0x381297['push'](_0x1f437d);}}return _0x381297;}});}else{return _0x5e4455;}}else{var _0x51dfb4=_[_0x34ca('0x3e')](_0x5e4455,function(_0x4b6607){if(_0x4b6607[_0x34ca('0x5c')]!==_0x34ca('0x52')){return _0x4b6607;}});return _0x51dfb4;}});}else{return _0x5e4455;}}})['then'](function(_0x476322){var _0x2d1c92=[];if(_0x476322){_0x47075a=_0x476322;for(var _0x36d49d=0x0;_0x36d49d<_0x476322[_0x34ca('0x37')];_0x36d49d+=0x1){_0x47075a[_0x36d49d]['messages']=[];_0x2d1c92[_0x34ca('0x62')](db[_0x34ca('0x2e')][_0x34ca('0x4a')]({'where':{'FromId':[_0x403add['user']['id'],_0x476322[_0x36d49d]['id']],'ToId':[_0x403add[_0x34ca('0x53')]['id'],_0x476322[_0x36d49d]['id']],'ChatGroupId':null},'attributes':['id',_0x34ca('0x4f'),_0x34ca('0x63'),'ToId',_0x34ca('0x64'),'body'],'order':qs['sort'](_0x34ca('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x34ca('0x26')](wrapUser(_0x476322[_0x36d49d])));}return BPromise[_0x34ca('0x66')](_0x2d1c92);}return[];})[_0x34ca('0x26')](function(_0x4f44a1){return{'rows':_0x4f44a1,'count':_0x4f44a1[_0x34ca('0x37')]};})[_0x34ca('0x26')](respondWithResult(_0x4da05f,null))[_0x34ca('0x46')](handleError(_0x4da05f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 46972af..1a1b00a 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 _0xd34e=['hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0xd34e,0x1d6));var _0xed34=function(_0x10e957,_0x2fb59d){_0x10e957=_0x10e957-0x0;var _0x45f990=_0xd34e[_0x10e957];return _0x45f990;};'use strict';var EventEmitter=require(_0xed34('0x0'));var ChatInternalMessage=require(_0xed34('0x1'))['db'][_0xed34('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xed34('0x3')](0x0);var events={'afterCreate':_0xed34('0x4'),'afterUpdate':_0xed34('0x5'),'afterDestroy':'remove'};function emitEvent(_0x172df5){return function(_0x26a1c5,_0x54b1bc,_0xf02b9e){ChatInternalMessageEvents[_0xed34('0x6')](_0x172df5+':'+_0x26a1c5['id'],_0x26a1c5);ChatInternalMessageEvents[_0xed34('0x6')](_0x172df5,_0x26a1c5);_0xf02b9e(null);};}for(var e in events){if(events[_0xed34('0x7')](e)){var event=events[e];ChatInternalMessage[_0xed34('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x0d4e=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0d4e[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xe0d4('0x0'));var ChatInternalMessage=require(_0xe0d4('0x1'))['db'][_0xe0d4('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe0d4('0x3')](0x0);var events={'afterCreate':_0xe0d4('0x4'),'afterUpdate':_0xe0d4('0x5'),'afterDestroy':_0xe0d4('0x6')};function emitEvent(_0x154d6d){return function(_0x251804,_0x56b43f,_0xdfee37){ChatInternalMessageEvents[_0xe0d4('0x7')](_0x154d6d+':'+_0x251804['id'],_0x251804);ChatInternalMessageEvents[_0xe0d4('0x7')](_0x154d6d,_0x251804);_0xdfee37(null);};}for(var e in events){if(events[_0xe0d4('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 28cd0a3..c9fb54c 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 _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x779496,_0x9b0b0b){_0x779496=_0x779496-0x0;var _0x472493=_0xbdb7[_0x779496];return _0x472493;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdb('0xb'),'collate':_0x7bdb('0xc')});}; \ No newline at end of file +var _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8f475be..f071187 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 _0x251c=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0xd628bf,_0x4e948d){var _0x339adb=function(_0x5d64fc){while(--_0x5d64fc){_0xd628bf['push'](_0xd628bf['shift']());}};_0x339adb(++_0x4e948d);}(_0x251c,0x15f));var _0xc251=function(_0x520891,_0x23c657){_0x520891=_0x520891-0x0;var _0x426d4f=_0x251c[_0x520891];return _0x426d4f;};'use strict';var _=require(_0xc251('0x0'));var util=require(_0xc251('0x1'));var moment=require('moment');var BPromise=require(_0xc251('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc251('0x3'));var db=require(_0xc251('0x4'))['db'];var utils=require(_0xc251('0x5'));var logger=require('../../config/logger')(_0xc251('0x6'));var config=require(_0xc251('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc251('0x8')][_0xc251('0x9')]({'port':0x232a});config[_0xc251('0xa')]=_['defaults'](config[_0xc251('0xa')],{'host':_0xc251('0xb'),'port':0x18eb});var socket=require(_0xc251('0xc'))(new Redis(config[_0xc251('0xa')]));require(_0xc251('0xd'))['register'](socket);function respondWithRpcPromise(_0x208197,_0x3fc770,_0x8397d7){return new BPromise(function(_0x1c1062,_0x1dc298){return client[_0xc251('0xe')](_0x208197,_0x8397d7)[_0xc251('0xf')](function(_0x15be24){logger[_0xc251('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x3fc770,'request\x20sent');logger[_0xc251('0x11')](_0xc251('0x12'),_0x3fc770,'request\x20sent',JSON[_0xc251('0x13')](_0x15be24));if(_0x15be24[_0xc251('0x14')]){if(_0x15be24[_0xc251('0x14')][_0xc251('0x15')]===0x1f4){logger[_0xc251('0x14')](_0xc251('0x16'),_0x3fc770,_0x15be24[_0xc251('0x14')]['message']);return _0x1dc298(_0x15be24[_0xc251('0x14')][_0xc251('0x17')]);}logger[_0xc251('0x14')](_0xc251('0x16'),_0x3fc770,_0x15be24[_0xc251('0x14')]['message']);return _0x1c1062(_0x15be24['error'][_0xc251('0x17')]);}else{logger[_0xc251('0x10')](_0xc251('0x16'),_0x3fc770,_0xc251('0x18'));_0x1c1062(_0x15be24[_0xc251('0x19')][_0xc251('0x17')]);}})[_0xc251('0x1a')](function(_0x31de68){logger[_0xc251('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3fc770,_0x31de68);_0x1dc298(_0x31de68);});});} \ No newline at end of file +var _0x8de4=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8de4,0x64));var _0x48de=function(_0x470b55,_0x4a39ba){_0x470b55=_0x470b55-0x0;var _0x35a830=_0x8de4[_0x470b55];return _0x35a830;};'use strict';var _=require(_0x48de('0x0'));var util=require(_0x48de('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x48de('0x2'));var fs=require('fs');var Redis=require(_0x48de('0x3'));var db=require(_0x48de('0x4'))['db'];var utils=require(_0x48de('0x5'));var logger=require(_0x48de('0x6'))(_0x48de('0x7'));var config=require('../../config/environment');var jayson=require(_0x48de('0x8'));var client=jayson[_0x48de('0x9')][_0x48de('0xa')]({'port':0x232a});config[_0x48de('0xb')]=_[_0x48de('0xc')](config[_0x48de('0xb')],{'host':_0x48de('0xd'),'port':0x18eb});var socket=require(_0x48de('0xe'))(new Redis(config[_0x48de('0xb')]));require('./chatInternalMessage.socket')[_0x48de('0xf')](socket);function respondWithRpcPromise(_0x526345,_0x35dbc1,_0x56d9af){return new BPromise(function(_0x2cff13,_0x134458){return client[_0x48de('0x10')](_0x526345,_0x56d9af)[_0x48de('0x11')](function(_0x5763e8){logger[_0x48de('0x12')](_0x48de('0x13'),_0x35dbc1,_0x48de('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x35dbc1,_0x48de('0x14'),JSON['stringify'](_0x5763e8));if(_0x5763e8[_0x48de('0x15')]){if(_0x5763e8['error'][_0x48de('0x16')]===0x1f4){logger[_0x48de('0x15')](_0x48de('0x13'),_0x35dbc1,_0x5763e8[_0x48de('0x15')][_0x48de('0x17')]);return _0x134458(_0x5763e8[_0x48de('0x15')][_0x48de('0x17')]);}logger[_0x48de('0x15')](_0x48de('0x13'),_0x35dbc1,_0x5763e8[_0x48de('0x15')][_0x48de('0x17')]);return _0x2cff13(_0x5763e8[_0x48de('0x15')]['message']);}else{logger['info'](_0x48de('0x13'),_0x35dbc1,_0x48de('0x14'));_0x2cff13(_0x5763e8[_0x48de('0x18')][_0x48de('0x17')]);}})[_0x48de('0x19')](function(_0x33b404){logger[_0x48de('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x35dbc1,_0x33b404);_0x134458(_0x33b404);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b9a3bcc..2bd7fa6 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 _0x4f17=['update','emit','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f17,0x9e));var _0x74f1=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x4f17[_0x13524d];return _0x9918b4;};'use strict';var ChatInternalMessageEvents=require(_0x74f1('0x0'));var events=['save',_0x74f1('0x1'),_0x74f1('0x2')];function createListener(_0x589695,_0x3c2d69){return function(_0x4694a1){_0x3c2d69[_0x74f1('0x3')](_0x589695,_0x4694a1);};}function removeListener(_0x62251d,_0x2d1ff2){return function(){ChatInternalMessageEvents['removeListener'](_0x62251d,_0x2d1ff2);};}exports['register']=function(_0x3f65bb){for(var _0x4b894a=0x0,_0xe54c30=events['length'];_0x4b894a<_0xe54c30;_0x4b894a++){var _0x34ec03=events[_0x4b894a];var _0x339d55=createListener(_0x74f1('0x4')+_0x34ec03,_0x3f65bb);ChatInternalMessageEvents['on'](_0x34ec03,_0x339d55);}}; \ No newline at end of file +var _0xc999=['remove','update','removeListener','chatInternalMessage:','save'];(function(_0x325de2,_0x3b8b2c){var _0x5553d0=function(_0x4bab56){while(--_0x4bab56){_0x325de2['push'](_0x325de2['shift']());}};_0x5553d0(++_0x3b8b2c);}(_0xc999,0x176));var _0x9c99=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xc999[_0x5e6ea3];return _0x4048b5;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9c99('0x0'),_0x9c99('0x1'),_0x9c99('0x2')];function createListener(_0x4cf49d,_0x590362){return function(_0x5473fe){_0x590362['emit'](_0x4cf49d,_0x5473fe);};}function removeListener(_0x3cecf2,_0x47e037){return function(){ChatInternalMessageEvents[_0x9c99('0x3')](_0x3cecf2,_0x47e037);};}exports['register']=function(_0x35f5f4){for(var _0x1ce762=0x0,_0xe80252=events['length'];_0x1ce762<_0xe80252;_0x1ce762++){var _0xfa25e1=events[_0x1ce762];var _0x323317=createListener(_0x9c99('0x4')+_0xfa25e1,_0x35f5f4);ChatInternalMessageEvents['on'](_0xfa25e1,_0x323317);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a2714db..8ddc936 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 _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x1a5258,_0x201b47){var _0x3078d3=function(_0x4ddc37){while(--_0x4ddc37){_0x1a5258['push'](_0x1a5258['shift']());}};_0x3078d3(++_0x201b47);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x5d70de,_0x54d21a){var _0xaafa77=function(_0x163758){while(--_0x163758){_0x5d70de['push'](_0x5d70de['shift']());}};_0xaafa77(++_0x54d21a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 228a47d..c5b5528 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 _0x799d=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x799d,0x12a));var _0xd799=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x799d[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0xd799('0x0'));module[_0xd799('0x1')]={'body':{'type':Sequelize[_0xd799('0x2')](_0xd799('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd799('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd799('0x5')]('in',_0xd799('0x6')),'defaultValue':_0xd799('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd799('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd799('0x2')]}}; \ No newline at end of file +var _0xa980=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x1aef24,_0x3f29d4){var _0x28324b=function(_0x312321){while(--_0x312321){_0x1aef24['push'](_0x1aef24['shift']());}};_0x28324b(++_0x3f29d4);}(_0xa980,0x76));var _0x0a98=function(_0xa6d221,_0x14e827){_0xa6d221=_0xa6d221-0x0;var _0x48cbce=_0xa980[_0xa6d221];return _0x48cbce;};'use strict';var Sequelize=require(_0x0a98('0x0'));module[_0x0a98('0x1')]={'body':{'type':Sequelize[_0x0a98('0x2')](_0x0a98('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0a98('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0a98('0x5')]('in',_0x0a98('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0a98('0x7')]},'providerName':{'type':Sequelize[_0x0a98('0x8')]},'providerResponse':{'type':Sequelize[_0x0a98('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 62dbf2b..e9ea841 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 _0x638f=['sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','update','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','CmContact','get','ChatInteractionId','UserId','read1stAt','interaction','stringify','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x389cda,_0x31155c){var _0x5889bc=function(_0x32f473){while(--_0x32f473){_0x389cda['push'](_0x389cda['shift']());}};_0x5889bc(++_0x31155c);}(_0x638f,0xe5));var _0xf638=function(_0xabca41,_0xbfdf4a){_0xabca41=_0xabca41-0x0;var _0x404ccb=_0x638f[_0xabca41];return _0x404ccb;};'use strict';var pdf=require(_0xf638('0x0'));var emlformat=require(_0xf638('0x1'));var rimraf=require(_0xf638('0x2'));var zipdir=require(_0xf638('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf638('0x4'));var moment=require(_0xf638('0x5'));var BPromise=require(_0xf638('0x6'));var Mustache=require(_0xf638('0x7'));var util=require(_0xf638('0x8'));var path=require('path');var sox=require(_0xf638('0x9'));var csv=require(_0xf638('0xa'));var ejs=require(_0xf638('0xb'));var fs=require('fs');var _=require(_0xf638('0xc'));var squel=require('squel');var crypto=require(_0xf638('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf638('0xe'));var toCsv=require(_0xf638('0xa'));var querystring=require(_0xf638('0xf'));var Papa=require(_0xf638('0x10'));var Redis=require('ioredis');var authService=require(_0xf638('0x11'));var qs=require(_0xf638('0x12'));var as=require(_0xf638('0x13'));var hardwareService=require(_0xf638('0x14'));var logger=require(_0xf638('0x15'))(_0xf638('0x16'));var utils=require(_0xf638('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf638('0x18'))['db'];config[_0xf638('0x19')]=_['defaults'](config['redis'],{'host':_0xf638('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf638('0x19')]));require(_0xf638('0x1b'))[_0xf638('0x1c')](socket);var jayson=require(_0xf638('0x1d'));var client=jayson[_0xf638('0x1e')][_0xf638('0x1f')]({'port':0x232c});var client9002=jayson[_0xf638('0x1e')][_0xf638('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5d79f1,_0x1d7740,_0x5741f2,_0x57956a){return new BPromise(function(_0x127d60,_0x88fd3){var _0x17dd2f=_0x57956a||client;return _0x17dd2f['request'](_0x5d79f1,_0x5741f2)['then'](function(_0x481f0d){logger['info'](_0xf638('0x20'),_0x1d7740,_0xf638('0x21'));logger[_0xf638('0x22')](_0xf638('0x23'),_0x1d7740,_0xf638('0x21'),JSON['stringify'](_0x481f0d));if(_0x481f0d['error']){if(_0x481f0d[_0xf638('0x24')][_0xf638('0x25')]===0x1f4){logger['error'](_0xf638('0x20'),_0x1d7740,_0x481f0d[_0xf638('0x24')][_0xf638('0x26')]);return _0x88fd3(_0x481f0d[_0xf638('0x24')][_0xf638('0x26')]);}logger[_0xf638('0x24')](_0xf638('0x20'),_0x1d7740,_0x481f0d[_0xf638('0x24')]['message']);return _0x127d60(_0x481f0d[_0xf638('0x24')][_0xf638('0x26')]);}else{logger[_0xf638('0x27')]('ChatMessage,\x20%s,\x20%s',_0x1d7740,_0xf638('0x21'));_0x127d60(_0x481f0d[_0xf638('0x28')]['message']);}})[_0xf638('0x29')](function(_0x395d5b){logger[_0xf638('0x24')](_0xf638('0x20'),_0x1d7740,_0x395d5b);_0x88fd3(_0x395d5b);});});}function respondWithStatusCode(_0x2fbd7a,_0x57431f){_0x57431f=_0x57431f||0xcc;return function(_0x3cb9eb){if(_0x3cb9eb){return _0x2fbd7a[_0xf638('0x2a')](_0x57431f);}return _0x2fbd7a['status'](_0x57431f)[_0xf638('0x2b')]();};}function respondWithResult(_0x23a969,_0xcf68a1){_0xcf68a1=_0xcf68a1||0xc8;return function(_0x2c2e42){if(_0x2c2e42){return _0x23a969[_0xf638('0x2c')](_0xcf68a1)['json'](_0x2c2e42);}};}function respondWithFilteredResult(_0x49fd8b,_0x248e1b){return function(_0x14cbda){if(_0x14cbda){var _0x2a2d6d=_0x14cbda[_0xf638('0x2d')],_0x11f04b=_0x248e1b[_0xf638('0x2e')],_0x5f4200=_0x248e1b['offset']+_0x248e1b[_0xf638('0x2f')],_0x50cd79;if(_0x5f4200>=_0x2a2d6d){_0x5f4200=_0x2a2d6d;_0x50cd79=0xc8;}else{_0x50cd79=0xce;}_0x49fd8b['status'](_0x50cd79);return _0x49fd8b['set'](_0xf638('0x30'),_0x11f04b+'-'+_0x5f4200+'/'+_0x2a2d6d)['json'](_0x14cbda);}return null;};}function patchUpdates(_0xdbf6aa){return function(_0x16a9ef){try{jsonpatch[_0xf638('0x31')](_0x16a9ef,_0xdbf6aa,!![]);}catch(_0x3ad03b){return BPromise[_0xf638('0x32')](_0x3ad03b);}return _0x16a9ef[_0xf638('0x33')]();};}function saveUpdates(_0x55c0c4,_0x80c264){return function(_0x5a1e37){if(_0x5a1e37){return _0x5a1e37['update'](_0x55c0c4)['then'](function(_0x1444f4){return _0x1444f4;});}return null;};}function removeEntity(_0x3e7849,_0x3485d0){return function(_0x56b90e){if(_0x56b90e){return _0x56b90e[_0xf638('0x34')]()[_0xf638('0x35')](function(){_0x3e7849[_0xf638('0x2c')](0xcc)[_0xf638('0x2b')]();});}};}function handleEntityNotFound(_0x2696a2,_0xa495fd){return function(_0x2288f2){if(!_0x2288f2){_0x2696a2[_0xf638('0x2a')](0x194);}return _0x2288f2;};}function handleError(_0xf0ee96,_0x55c468){_0x55c468=_0x55c468||0x1f4;return function(_0x4e7cf8){logger['error'](_0x4e7cf8[_0xf638('0x36')]);if(_0x4e7cf8[_0xf638('0x37')]){delete _0x4e7cf8[_0xf638('0x37')];}_0xf0ee96['status'](_0x55c468)[_0xf638('0x38')](_0x4e7cf8);};}exports[_0xf638('0x39')]=function(_0x14b022,_0x1371e2){var _0x13c57e={},_0x78fe25={},_0x13ea6c={'count':0x0,'rows':[]};var _0x452f74=_['map'](db[_0xf638('0x3a')][_0xf638('0x3b')],function(_0x5d4b2f){return{'name':_0x5d4b2f[_0xf638('0x3c')],'type':_0x5d4b2f[_0xf638('0x3d')][_0xf638('0x3e')]};});_0x78fe25[_0xf638('0x3f')]=_[_0xf638('0x40')](_0x452f74,'name');_0x78fe25[_0xf638('0x41')]=_[_0xf638('0x42')](_0x14b022['query']);_0x78fe25[_0xf638('0x43')]=_[_0xf638('0x44')](_0x78fe25[_0xf638('0x3f')],_0x78fe25['query']);_0x13c57e[_0xf638('0x45')]=_['intersection'](_0x78fe25[_0xf638('0x3f')],qs[_0xf638('0x46')](_0x14b022[_0xf638('0x41')][_0xf638('0x46')]));_0x13c57e[_0xf638('0x45')]=_0x13c57e[_0xf638('0x45')][_0xf638('0x47')]?_0x13c57e[_0xf638('0x45')]:_0x78fe25[_0xf638('0x3f')];if(!_0x14b022[_0xf638('0x41')][_0xf638('0x48')]('nolimit')){_0x13c57e[_0xf638('0x2f')]=qs[_0xf638('0x2f')](_0x14b022[_0xf638('0x41')]['limit']);_0x13c57e[_0xf638('0x2e')]=qs[_0xf638('0x2e')](_0x14b022[_0xf638('0x41')]['offset']);}_0x13c57e[_0xf638('0x49')]=qs[_0xf638('0x4a')](_0x14b022[_0xf638('0x41')][_0xf638('0x4a')]);_0x13c57e['where']=qs[_0xf638('0x43')](_[_0xf638('0x4b')](_0x14b022['query'],_0x78fe25[_0xf638('0x43')]),_0x452f74);if(_0x14b022['query']['filter']){_0x13c57e[_0xf638('0x4c')]=_[_0xf638('0x4d')](_0x13c57e[_0xf638('0x4c')],{'$or':_['map'](_0x452f74,function(_0x584381){if(_0x584381[_0xf638('0x3d')]!==_0xf638('0x4e')){var _0x4c5783={};_0x4c5783[_0x584381[_0xf638('0x37')]]={'$like':'%'+_0x14b022['query'][_0xf638('0x4f')]+'%'};return _0x4c5783;}})});}_0x13c57e=_['merge']({},_0x13c57e,_0x14b022[_0xf638('0x50')]);var _0x5b9c13={'where':_0x13c57e[_0xf638('0x4c')]};return db[_0xf638('0x3a')][_0xf638('0x2d')](_0x5b9c13)['then'](function(_0x7b4b34){_0x13ea6c['count']=_0x7b4b34;if(_0x14b022[_0xf638('0x41')][_0xf638('0x51')]){_0x13c57e[_0xf638('0x52')]=[{'all':!![]}];}return db[_0xf638('0x3a')][_0xf638('0x53')](_0x13c57e);})[_0xf638('0x35')](function(_0xabb7c6){_0x13ea6c[_0xf638('0x54')]=_0xabb7c6;return _0x13ea6c;})[_0xf638('0x35')](respondWithFilteredResult(_0x1371e2,_0x13c57e))[_0xf638('0x29')](handleError(_0x1371e2,null));};exports['show']=function(_0x518306,_0x89025d){var _0xf62d7d={'raw':!![],'where':{'id':_0x518306[_0xf638('0x55')]['id']}},_0x22416b={};_0x22416b[_0xf638('0x3f')]=_[_0xf638('0x42')](db['ChatMessage'][_0xf638('0x3b')]);_0x22416b[_0xf638('0x41')]=_[_0xf638('0x42')](_0x518306['query']);_0x22416b['filters']=_[_0xf638('0x44')](_0x22416b[_0xf638('0x3f')],_0x22416b[_0xf638('0x41')]);_0xf62d7d[_0xf638('0x45')]=_[_0xf638('0x44')](_0x22416b[_0xf638('0x3f')],qs[_0xf638('0x46')](_0x518306[_0xf638('0x41')][_0xf638('0x46')]));_0xf62d7d['attributes']=_0xf62d7d[_0xf638('0x45')][_0xf638('0x47')]?_0xf62d7d[_0xf638('0x45')]:_0x22416b['model'];if(_0x518306[_0xf638('0x41')][_0xf638('0x51')]){_0xf62d7d['include']=[{'all':!![]}];}_0xf62d7d=_[_0xf638('0x4d')]({},_0xf62d7d,_0x518306['options']);return db[_0xf638('0x3a')][_0xf638('0x56')](_0xf62d7d)['then'](handleEntityNotFound(_0x89025d,null))[_0xf638('0x35')](respondWithResult(_0x89025d,null))[_0xf638('0x29')](handleError(_0x89025d,null));};exports[_0xf638('0x57')]=function(_0x2917ed,_0x4cf69e){return db[_0xf638('0x3a')]['create'](_0x2917ed[_0xf638('0x58')],{})[_0xf638('0x35')](respondWithResult(_0x4cf69e,0xc9))[_0xf638('0x29')](handleError(_0x4cf69e,null));};exports[_0xf638('0x59')]=function(_0x379cfa,_0x5b8f89){if(_0x379cfa[_0xf638('0x58')]['id']){delete _0x379cfa[_0xf638('0x58')]['id'];}return db[_0xf638('0x3a')][_0xf638('0x56')]({'where':{'id':_0x379cfa[_0xf638('0x55')]['id']}})[_0xf638('0x35')](handleEntityNotFound(_0x5b8f89,null))['then'](saveUpdates(_0x379cfa['body'],null))[_0xf638('0x35')](respondWithResult(_0x5b8f89,null))[_0xf638('0x29')](handleError(_0x5b8f89,null));};exports['destroy']=function(_0x1bca61,_0x553680){return db['ChatMessage'][_0xf638('0x56')]({'where':{'id':_0x1bca61[_0xf638('0x55')]['id']}})['then'](handleEntityNotFound(_0x553680,null))[_0xf638('0x35')](removeEntity(_0x553680,null))['catch'](handleError(_0x553680,null));};exports[_0xf638('0x5a')]=function(_0x19027e,_0x421640){return db[_0xf638('0x3a')][_0xf638('0x5a')]()['then'](respondWithResult(_0x421640,null))['catch'](handleError(_0x421640,null));};var interaction_log=require(_0xf638('0x15'))('chat-interactions');exports[_0xf638('0x5b')]=function(_0x19d956,_0x5d282f,_0x5a7dda){var _0x52b79c={'agent':{},'channel':'chat'};if(_0x19d956[_0xf638('0x58')]['id']){delete _0x19d956[_0xf638('0x58')]['id'];}_0x19d956[_0xf638('0x58')][_0xf638('0x5c')]=!![];_0x19d956['body'][_0xf638('0x5d')]=moment()[_0xf638('0x5e')](_0xf638('0x5f'));_0x19d956[_0xf638('0x58')]['UserId']=_0x19d956[_0xf638('0x58')]['UserId']||_0x19d956[_0xf638('0x60')]['id'];_0x52b79c[_0xf638('0x61')]['id']=_0x19d956[_0xf638('0x58')]['UserId'];return db[_0xf638('0x3a')][_0xf638('0x56')]({'where':{'id':_0x19d956[_0xf638('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xf638('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x5d282f,null))[_0xf638('0x35')](saveUpdates(_0x19d956[_0xf638('0x58')],null))[_0xf638('0x35')](function(_0x305e92){if(_0x305e92){_0x52b79c[_0xf638('0x26')]=_0x305e92[_0xf638('0x63')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x305e92[_0xf638('0x64')]}});}return null;})[_0xf638('0x35')](handleEntityNotFound(_0x5d282f,null))[_0xf638('0x35')](function(_0x1934de){if(_0x1934de){return _0x1934de[_0xf638('0x59')]({'UserId':_0x19d956[_0xf638('0x58')][_0xf638('0x65')],'read1stAt':_['isNil'](_0x1934de[_0xf638('0x66')])?moment()[_0xf638('0x5e')](_0xf638('0x5f')):undefined});}return null;})[_0xf638('0x35')](function(_0x1da7eb){if(_0x1da7eb){_0x52b79c[_0xf638('0x67')]=_0x1da7eb[_0xf638('0x63')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x19d956['user']['id'],_0x19d956[_0xf638('0x60')]['name'],_0x19d956[_0xf638('0x60')]['role'],_0x52b79c['interaction']['id'],_0x19d956[_0xf638('0x58')]?JSON[_0xf638('0x68')](_0x19d956[_0xf638('0x58')]):_0xf638('0x69'));return respondWithRpcPromise('AcceptMessage',_0xf638('0x6a'),_0x52b79c);}return null;})[_0xf638('0x35')](function(_0x320e7b){if(_0x320e7b){if(_0x19d956['body'][_0xf638('0x6b')]){_0x52b79c[_0xf638('0x26')][_0xf638('0x6c')]=util['format'](_0xf638('0x6d'),_0x19d956[_0xf638('0x60')][_0xf638('0x37')]);_0x52b79c[_0xf638('0x26')][_0xf638('0x6e')]=_0x52b79c[_0xf638('0x6e')];_0x52b79c[_0xf638('0x26')][_0xf638('0x6f')]='accept';return respondWithRpcPromise(_0xf638('0x70'),'EventManager',{'event':_0xf638('0x71'),'message':_['merge'](_0x52b79c['message'],JSON[_0xf638('0x72')](_0x52b79c[_0xf638('0x67')][_0xf638('0x73')]))},client9002)[_0xf638('0x35')](function(){return _0x52b79c;});}return _0x52b79c;}return null;})[_0xf638('0x35')](respondWithResult(_0x5d282f,null))['catch'](handleError(_0x5d282f,null));};var interaction_log=require(_0xf638('0x15'))(_0xf638('0x74'));exports[_0xf638('0x32')]=function(_0xc413a3,_0x2d681a,_0x2bcd54){var _0x5c4402={'agent':{},'channel':_0xf638('0x75')};if(_0xc413a3[_0xf638('0x58')]['id']){delete _0xc413a3[_0xf638('0x58')]['id'];}_0xc413a3[_0xf638('0x58')][_0xf638('0x65')]=_0xc413a3[_0xf638('0x58')][_0xf638('0x65')]||_0xc413a3[_0xf638('0x60')]['id'];_0x5c4402[_0xf638('0x61')]['id']=_0xc413a3[_0xf638('0x58')][_0xf638('0x65')];return db[_0xf638('0x3a')]['find']({'where':{'id':_0xc413a3['params']['id'],'UserId':null}})[_0xf638('0x35')](handleEntityNotFound(_0x2d681a,null))[_0xf638('0x35')](function(_0x3d759a){if(_0x3d759a){_0x5c4402[_0xf638('0x26')]=_0x3d759a[_0xf638('0x63')]({'plain':!![]});return db[_0xf638('0x76')][_0xf638('0x56')]({'where':{'id':_0x3d759a['ChatInteractionId']}});}return null;})[_0xf638('0x35')](handleEntityNotFound(_0x2d681a,null))[_0xf638('0x35')](function(_0x11981a){if(_0x11981a){_0x5c4402[_0xf638('0x67')]=_0x11981a[_0xf638('0x63')]({'plain':!![]});interaction_log[_0xf638('0x27')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc413a3['user']['id'],_0xc413a3[_0xf638('0x60')][_0xf638('0x37')],_0xc413a3['user']['role'],_0x5c4402[_0xf638('0x67')]['id'],_0xc413a3[_0xf638('0x58')]?JSON['stringify'](_0xc413a3['body']):_0xf638('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5c4402);}return null;})[_0xf638('0x35')](function(_0x3ebe35){if(_0x3ebe35){_0x3ebe35[_0xf638('0x26')][_0xf638('0x6c')]=util[_0xf638('0x5e')]('SIP/%s',_0xc413a3[_0xf638('0x60')][_0xf638('0x37')]);_0x3ebe35[_0xf638('0x26')]['channel']=_0x5c4402[_0xf638('0x6e')];_0x3ebe35[_0xf638('0x26')]['event']=_0xf638('0x32');respondWithRpcPromise(_0xf638('0x70'),'EventManager',{'event':'rejectmessage','message':_0x3ebe35[_0xf638('0x26')]},client9002);return _0x5c4402;}return null;})['then'](respondWithResult(_0x2d681a,null))[_0xf638('0x29')](handleError(_0x2d681a,null));}; \ No newline at end of file +var _0xde2c=['offset','set','Content-Range','update','destroy','send','rawAttributes','fieldName','type','key','model','map','name','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ChatMessage','findAll','rows','find','body','params','describe','chat-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','interface','accept','EventManager','acceptmessage','parse','formData','reject','chat','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count'];(function(_0x3afb9d,_0x2e8c2e){var _0x4981fc=function(_0x18bc2e){while(--_0x18bc2e){_0x3afb9d['push'](_0x3afb9d['shift']());}};_0x4981fc(++_0x2e8c2e);}(_0xde2c,0x1ad));var _0xcde2=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xde2c[_0x3dea7d];return _0x53919a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcde2('0x2'));var rp=require(_0xcde2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcde2('0x4'));var util=require(_0xcde2('0x5'));var path=require(_0xcde2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcde2('0x7'));var fs=require('fs');var _=require(_0xcde2('0x8'));var squel=require('squel');var crypto=require(_0xcde2('0x9'));var jsforce=require(_0xcde2('0xa'));var deskjs=require(_0xcde2('0xb'));var toCsv=require(_0xcde2('0xc'));var querystring=require(_0xcde2('0xd'));var Papa=require(_0xcde2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcde2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcde2('0x10'));var logger=require(_0xcde2('0x11'))('api');var utils=require(_0xcde2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcde2('0x13'));var db=require(_0xcde2('0x14'))['db'];config[_0xcde2('0x15')]=_[_0xcde2('0x16')](config[_0xcde2('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xcde2('0x17'))(new Redis(config['redis']));require(_0xcde2('0x18'))[_0xcde2('0x19')](socket);var jayson=require(_0xcde2('0x1a'));var client=jayson[_0xcde2('0x1b')][_0xcde2('0x1c')]({'port':0x232c});var client9002=jayson[_0xcde2('0x1b')][_0xcde2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x456d3d,_0x3ebe04,_0x3b246a,_0x4b9107){return new BPromise(function(_0x3ce9e9,_0x22dcc6){var _0x8ad0c4=_0x4b9107||client;return _0x8ad0c4[_0xcde2('0x1d')](_0x456d3d,_0x3b246a)[_0xcde2('0x1e')](function(_0x2c333f){logger[_0xcde2('0x1f')](_0xcde2('0x20'),_0x3ebe04,_0xcde2('0x21'));logger[_0xcde2('0x22')](_0xcde2('0x23'),_0x3ebe04,_0xcde2('0x21'),JSON[_0xcde2('0x24')](_0x2c333f));if(_0x2c333f[_0xcde2('0x25')]){if(_0x2c333f[_0xcde2('0x25')][_0xcde2('0x26')]===0x1f4){logger[_0xcde2('0x25')](_0xcde2('0x20'),_0x3ebe04,_0x2c333f[_0xcde2('0x25')][_0xcde2('0x27')]);return _0x22dcc6(_0x2c333f[_0xcde2('0x25')]['message']);}logger['error'](_0xcde2('0x20'),_0x3ebe04,_0x2c333f[_0xcde2('0x25')][_0xcde2('0x27')]);return _0x3ce9e9(_0x2c333f[_0xcde2('0x25')]['message']);}else{logger[_0xcde2('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x3ebe04,_0xcde2('0x21'));_0x3ce9e9(_0x2c333f[_0xcde2('0x28')][_0xcde2('0x27')]);}})[_0xcde2('0x29')](function(_0x437986){logger[_0xcde2('0x25')]('ChatMessage,\x20%s,\x20%s',_0x3ebe04,_0x437986);_0x22dcc6(_0x437986);});});}function respondWithStatusCode(_0x2101aa,_0x2a4eae){_0x2a4eae=_0x2a4eae||0xcc;return function(_0x3f64ed){if(_0x3f64ed){return _0x2101aa[_0xcde2('0x2a')](_0x2a4eae);}return _0x2101aa['status'](_0x2a4eae)[_0xcde2('0x2b')]();};}function respondWithResult(_0x46059c,_0x18835b){_0x18835b=_0x18835b||0xc8;return function(_0x176856){if(_0x176856){return _0x46059c[_0xcde2('0x2c')](_0x18835b)[_0xcde2('0x2d')](_0x176856);}};}function respondWithFilteredResult(_0x421098,_0x5da333){return function(_0x1c491b){if(_0x1c491b){var _0x3b355c=_0x1c491b[_0xcde2('0x2e')],_0xc5b538=_0x5da333[_0xcde2('0x2f')],_0xeb6974=_0x5da333[_0xcde2('0x2f')]+_0x5da333['limit'],_0x3e5d59;if(_0xeb6974>=_0x3b355c){_0xeb6974=_0x3b355c;_0x3e5d59=0xc8;}else{_0x3e5d59=0xce;}_0x421098[_0xcde2('0x2c')](_0x3e5d59);return _0x421098[_0xcde2('0x30')](_0xcde2('0x31'),_0xc5b538+'-'+_0xeb6974+'/'+_0x3b355c)[_0xcde2('0x2d')](_0x1c491b);}return null;};}function patchUpdates(_0x31e904){return function(_0x475707){try{jsonpatch['apply'](_0x475707,_0x31e904,!![]);}catch(_0xbf6588){return BPromise['reject'](_0xbf6588);}return _0x475707['save']();};}function saveUpdates(_0x3efbdd,_0xcf1270){return function(_0x3acf9e){if(_0x3acf9e){return _0x3acf9e[_0xcde2('0x32')](_0x3efbdd)[_0xcde2('0x1e')](function(_0x7de169){return _0x7de169;});}return null;};}function removeEntity(_0xb85342,_0x4f0dd9){return function(_0x5a7320){if(_0x5a7320){return _0x5a7320[_0xcde2('0x33')]()[_0xcde2('0x1e')](function(){_0xb85342[_0xcde2('0x2c')](0xcc)[_0xcde2('0x2b')]();});}};}function handleEntityNotFound(_0x592499,_0x2b51f7){return function(_0xa246fc){if(!_0xa246fc){_0x592499[_0xcde2('0x2a')](0x194);}return _0xa246fc;};}function handleError(_0x4a348b,_0x1500af){_0x1500af=_0x1500af||0x1f4;return function(_0x129c99){logger['error'](_0x129c99['stack']);if(_0x129c99['name']){delete _0x129c99['name'];}_0x4a348b[_0xcde2('0x2c')](_0x1500af)[_0xcde2('0x34')](_0x129c99);};}exports['index']=function(_0x10151f,_0x379e63){var _0x10b5d8={},_0x379231={},_0x3e4bbf={'count':0x0,'rows':[]};var _0x3b2d65=_['map'](db['ChatMessage'][_0xcde2('0x35')],function(_0x278be2){return{'name':_0x278be2[_0xcde2('0x36')],'type':_0x278be2[_0xcde2('0x37')][_0xcde2('0x38')]};});_0x379231[_0xcde2('0x39')]=_[_0xcde2('0x3a')](_0x3b2d65,_0xcde2('0x3b'));_0x379231['query']=_[_0xcde2('0x3c')](_0x10151f['query']);_0x379231[_0xcde2('0x3d')]=_[_0xcde2('0x3e')](_0x379231[_0xcde2('0x39')],_0x379231[_0xcde2('0x3f')]);_0x10b5d8['attributes']=_[_0xcde2('0x3e')](_0x379231[_0xcde2('0x39')],qs['fields'](_0x10151f[_0xcde2('0x3f')][_0xcde2('0x40')]));_0x10b5d8['attributes']=_0x10b5d8[_0xcde2('0x41')][_0xcde2('0x42')]?_0x10b5d8[_0xcde2('0x41')]:_0x379231[_0xcde2('0x39')];if(!_0x10151f['query'][_0xcde2('0x43')](_0xcde2('0x44'))){_0x10b5d8[_0xcde2('0x45')]=qs[_0xcde2('0x45')](_0x10151f['query'][_0xcde2('0x45')]);_0x10b5d8[_0xcde2('0x2f')]=qs['offset'](_0x10151f['query'][_0xcde2('0x2f')]);}_0x10b5d8[_0xcde2('0x46')]=qs[_0xcde2('0x47')](_0x10151f[_0xcde2('0x3f')][_0xcde2('0x47')]);_0x10b5d8[_0xcde2('0x48')]=qs[_0xcde2('0x3d')](_[_0xcde2('0x49')](_0x10151f[_0xcde2('0x3f')],_0x379231[_0xcde2('0x3d')]),_0x3b2d65);if(_0x10151f[_0xcde2('0x3f')][_0xcde2('0x4a')]){_0x10b5d8['where']=_[_0xcde2('0x4b')](_0x10b5d8[_0xcde2('0x48')],{'$or':_[_0xcde2('0x3a')](_0x3b2d65,function(_0x14d564){if(_0x14d564[_0xcde2('0x37')]!==_0xcde2('0x4c')){var _0x56e1bf={};_0x56e1bf[_0x14d564[_0xcde2('0x3b')]]={'$like':'%'+_0x10151f['query'][_0xcde2('0x4a')]+'%'};return _0x56e1bf;}})});}_0x10b5d8=_['merge']({},_0x10b5d8,_0x10151f['options']);var _0x6ae87={'where':_0x10b5d8[_0xcde2('0x48')]};return db['ChatMessage'][_0xcde2('0x2e')](_0x6ae87)[_0xcde2('0x1e')](function(_0x3a0c81){_0x3e4bbf[_0xcde2('0x2e')]=_0x3a0c81;if(_0x10151f[_0xcde2('0x3f')][_0xcde2('0x4d')]){_0x10b5d8[_0xcde2('0x4e')]=[{'all':!![]}];}return db[_0xcde2('0x4f')][_0xcde2('0x50')](_0x10b5d8);})[_0xcde2('0x1e')](function(_0x1af7c6){_0x3e4bbf[_0xcde2('0x51')]=_0x1af7c6;return _0x3e4bbf;})[_0xcde2('0x1e')](respondWithFilteredResult(_0x379e63,_0x10b5d8))[_0xcde2('0x29')](handleError(_0x379e63,null));};exports['show']=function(_0x35366f,_0x2f233a){var _0x4f4e4a={'raw':!![],'where':{'id':_0x35366f['params']['id']}},_0xd40d3a={};_0xd40d3a[_0xcde2('0x39')]=_[_0xcde2('0x3c')](db[_0xcde2('0x4f')]['rawAttributes']);_0xd40d3a[_0xcde2('0x3f')]=_[_0xcde2('0x3c')](_0x35366f[_0xcde2('0x3f')]);_0xd40d3a['filters']=_[_0xcde2('0x3e')](_0xd40d3a[_0xcde2('0x39')],_0xd40d3a[_0xcde2('0x3f')]);_0x4f4e4a[_0xcde2('0x41')]=_['intersection'](_0xd40d3a[_0xcde2('0x39')],qs['fields'](_0x35366f['query'][_0xcde2('0x40')]));_0x4f4e4a[_0xcde2('0x41')]=_0x4f4e4a[_0xcde2('0x41')][_0xcde2('0x42')]?_0x4f4e4a[_0xcde2('0x41')]:_0xd40d3a['model'];if(_0x35366f[_0xcde2('0x3f')][_0xcde2('0x4d')]){_0x4f4e4a[_0xcde2('0x4e')]=[{'all':!![]}];}_0x4f4e4a=_[_0xcde2('0x4b')]({},_0x4f4e4a,_0x35366f['options']);return db['ChatMessage'][_0xcde2('0x52')](_0x4f4e4a)[_0xcde2('0x1e')](handleEntityNotFound(_0x2f233a,null))[_0xcde2('0x1e')](respondWithResult(_0x2f233a,null))[_0xcde2('0x29')](handleError(_0x2f233a,null));};exports['create']=function(_0x4e87e0,_0x3b4166){return db[_0xcde2('0x4f')]['create'](_0x4e87e0[_0xcde2('0x53')],{})[_0xcde2('0x1e')](respondWithResult(_0x3b4166,0xc9))[_0xcde2('0x29')](handleError(_0x3b4166,null));};exports['update']=function(_0x33fed4,_0x3aeae6){if(_0x33fed4[_0xcde2('0x53')]['id']){delete _0x33fed4[_0xcde2('0x53')]['id'];}return db[_0xcde2('0x4f')][_0xcde2('0x52')]({'where':{'id':_0x33fed4[_0xcde2('0x54')]['id']}})[_0xcde2('0x1e')](handleEntityNotFound(_0x3aeae6,null))[_0xcde2('0x1e')](saveUpdates(_0x33fed4[_0xcde2('0x53')],null))[_0xcde2('0x1e')](respondWithResult(_0x3aeae6,null))[_0xcde2('0x29')](handleError(_0x3aeae6,null));};exports[_0xcde2('0x33')]=function(_0x494236,_0x35f1af){return db[_0xcde2('0x4f')]['find']({'where':{'id':_0x494236[_0xcde2('0x54')]['id']}})[_0xcde2('0x1e')](handleEntityNotFound(_0x35f1af,null))['then'](removeEntity(_0x35f1af,null))[_0xcde2('0x29')](handleError(_0x35f1af,null));};exports[_0xcde2('0x55')]=function(_0x1ddc2f,_0x5b1e61){return db['ChatMessage'][_0xcde2('0x55')]()[_0xcde2('0x1e')](respondWithResult(_0x5b1e61,null))[_0xcde2('0x29')](handleError(_0x5b1e61,null));};var interaction_log=require('../../config/logger')(_0xcde2('0x56'));exports['accept']=function(_0x394738,_0x391b02,_0x3f624c){var _0x3cd16f={'agent':{},'channel':'chat'};if(_0x394738[_0xcde2('0x53')]['id']){delete _0x394738['body']['id'];}_0x394738[_0xcde2('0x53')][_0xcde2('0x57')]=!![];_0x394738['body'][_0xcde2('0x58')]=moment()[_0xcde2('0x59')](_0xcde2('0x5a'));_0x394738['body']['UserId']=_0x394738[_0xcde2('0x53')][_0xcde2('0x5b')]||_0x394738['user']['id'];_0x3cd16f['agent']['id']=_0x394738['body']['UserId'];return db[_0xcde2('0x4f')]['find']({'where':{'id':_0x394738[_0xcde2('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xcde2('0x5c')}]})[_0xcde2('0x1e')](handleEntityNotFound(_0x391b02,null))['then'](saveUpdates(_0x394738[_0xcde2('0x53')],null))['then'](function(_0x3ccd4a){if(_0x3ccd4a){_0x3cd16f['message']=_0x3ccd4a[_0xcde2('0x5d')]({'plain':!![]});return db[_0xcde2('0x5e')]['find']({'where':{'id':_0x3ccd4a['ChatInteractionId']}});}return null;})[_0xcde2('0x1e')](handleEntityNotFound(_0x391b02,null))[_0xcde2('0x1e')](function(_0xbc3054){if(_0xbc3054){return _0xbc3054[_0xcde2('0x32')]({'UserId':_0x394738[_0xcde2('0x53')]['UserId'],'read1stAt':_[_0xcde2('0x5f')](_0xbc3054[_0xcde2('0x60')])?moment()[_0xcde2('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x9e6db5){if(_0x9e6db5){_0x3cd16f[_0xcde2('0x61')]=_0x9e6db5[_0xcde2('0x5d')]({'plain':!![]});interaction_log['info'](_0xcde2('0x62'),_0x394738['user']['id'],_0x394738[_0xcde2('0x63')]['name'],_0x394738[_0xcde2('0x63')][_0xcde2('0x64')],_0x3cd16f[_0xcde2('0x61')]['id'],_0x394738[_0xcde2('0x53')]?JSON[_0xcde2('0x24')](_0x394738[_0xcde2('0x53')]):_0xcde2('0x65'));return respondWithRpcPromise(_0xcde2('0x66'),_0xcde2('0x67'),_0x3cd16f);}return null;})[_0xcde2('0x1e')](function(_0x991d9c){if(_0x991d9c){if(_0x394738['body']['manual']){_0x3cd16f[_0xcde2('0x27')][_0xcde2('0x68')]=util[_0xcde2('0x59')]('SIP/%s',_0x394738['user'][_0xcde2('0x3b')]);_0x3cd16f[_0xcde2('0x27')]['channel']=_0x3cd16f['channel'];_0x3cd16f[_0xcde2('0x27')]['event']=_0xcde2('0x69');return respondWithRpcPromise('EventManager',_0xcde2('0x6a'),{'event':_0xcde2('0x6b'),'message':_[_0xcde2('0x4b')](_0x3cd16f[_0xcde2('0x27')],JSON[_0xcde2('0x6c')](_0x3cd16f['interaction'][_0xcde2('0x6d')]))},client9002)[_0xcde2('0x1e')](function(){return _0x3cd16f;});}return _0x3cd16f;}return null;})[_0xcde2('0x1e')](respondWithResult(_0x391b02,null))[_0xcde2('0x29')](handleError(_0x391b02,null));};var interaction_log=require(_0xcde2('0x11'))(_0xcde2('0x56'));exports[_0xcde2('0x6e')]=function(_0x4ce278,_0x19043d,_0x28e64c){var _0x59c1fe={'agent':{},'channel':_0xcde2('0x6f')};if(_0x4ce278[_0xcde2('0x53')]['id']){delete _0x4ce278[_0xcde2('0x53')]['id'];}_0x4ce278[_0xcde2('0x53')][_0xcde2('0x5b')]=_0x4ce278[_0xcde2('0x53')][_0xcde2('0x5b')]||_0x4ce278[_0xcde2('0x63')]['id'];_0x59c1fe['agent']['id']=_0x4ce278['body'][_0xcde2('0x5b')];return db[_0xcde2('0x4f')][_0xcde2('0x52')]({'where':{'id':_0x4ce278[_0xcde2('0x54')]['id'],'UserId':null}})[_0xcde2('0x1e')](handleEntityNotFound(_0x19043d,null))['then'](function(_0x596274){if(_0x596274){_0x59c1fe[_0xcde2('0x27')]=_0x596274['get']({'plain':!![]});return db[_0xcde2('0x5e')][_0xcde2('0x52')]({'where':{'id':_0x596274[_0xcde2('0x70')]}});}return null;})[_0xcde2('0x1e')](handleEntityNotFound(_0x19043d,null))['then'](function(_0x1c0074){if(_0x1c0074){_0x59c1fe[_0xcde2('0x61')]=_0x1c0074['get']({'plain':!![]});interaction_log['info'](_0xcde2('0x71'),_0x4ce278[_0xcde2('0x63')]['id'],_0x4ce278[_0xcde2('0x63')][_0xcde2('0x3b')],_0x4ce278[_0xcde2('0x63')][_0xcde2('0x64')],_0x59c1fe[_0xcde2('0x61')]['id'],_0x4ce278['body']?JSON[_0xcde2('0x24')](_0x4ce278[_0xcde2('0x53')]):'null');return respondWithRpcPromise(_0xcde2('0x72'),_0xcde2('0x73'),_0x59c1fe);}return null;})[_0xcde2('0x1e')](function(_0x3cca24){if(_0x3cca24){_0x3cca24[_0xcde2('0x27')][_0xcde2('0x68')]=util[_0xcde2('0x59')]('SIP/%s',_0x4ce278['user']['name']);_0x3cca24[_0xcde2('0x27')][_0xcde2('0x74')]=_0x59c1fe['channel'];_0x3cca24[_0xcde2('0x27')][_0xcde2('0x75')]=_0xcde2('0x6e');respondWithRpcPromise('EventManager',_0xcde2('0x6a'),{'event':_0xcde2('0x76'),'message':_0x3cca24[_0xcde2('0x27')]},client9002);return _0x59c1fe;}return null;})['then'](respondWithResult(_0x19043d,null))[_0xcde2('0x29')](handleError(_0x19043d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 6f6a2dd..84b387e 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 _0xaa7c=['hasOwnProperty','hook','exports','ChatMessage','setMaxListeners','emit'];(function(_0x4769c2,_0x2ff21d){var _0x25c55f=function(_0xf8900a){while(--_0xf8900a){_0x4769c2['push'](_0x4769c2['shift']());}};_0x25c55f(++_0x2ff21d);}(_0xaa7c,0x69));var _0xcaa7=function(_0x379e4a,_0x31ca02){_0x379e4a=_0x379e4a-0x0;var _0x3a9d4c=_0xaa7c[_0x379e4a];return _0x3a9d4c;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xcaa7('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcaa7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a14ff){return function(_0x290543,_0x2b8211,_0x3a96c4){ChatMessageEvents['emit'](_0x4a14ff+':'+_0x290543['id'],_0x290543);ChatMessageEvents[_0xcaa7('0x2')](_0x4a14ff,_0x290543);_0x3a96c4(null);};}for(var e in events){if(events[_0xcaa7('0x3')](e)){var event=events[e];ChatMessage[_0xcaa7('0x4')](e,emitEvent(event));}}module[_0xcaa7('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x8efa=['update','remove','emit','hasOwnProperty','exports','ChatMessage','setMaxListeners','save'];(function(_0x55588e,_0x4e99f2){var _0x5bbf7b=function(_0x23ca73){while(--_0x23ca73){_0x55588e['push'](_0x55588e['shift']());}};_0x5bbf7b(++_0x4e99f2);}(_0x8efa,0x75));var _0xa8ef=function(_0x35cc9e,_0x5519e8){_0x35cc9e=_0x35cc9e-0x0;var _0x2fa540=_0x8efa[_0x35cc9e];return _0x2fa540;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xa8ef('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa8ef('0x1')](0x0);var events={'afterCreate':_0xa8ef('0x2'),'afterUpdate':_0xa8ef('0x3'),'afterDestroy':_0xa8ef('0x4')};function emitEvent(_0x5bba29){return function(_0x4ba75a,_0x46e1d5,_0x3f98cd){ChatMessageEvents[_0xa8ef('0x5')](_0x5bba29+':'+_0x4ba75a['id'],_0x4ba75a);ChatMessageEvents[_0xa8ef('0x5')](_0x5bba29,_0x4ba75a);_0x3f98cd(null);};}for(var e in events){if(events[_0xa8ef('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xa8ef('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 87bb02b..1905591 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 _0xe634=['body','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','chat_messages'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe634,0x7d));var _0x4e63=function(_0x41de7b,_0x36e026){_0x41de7b=_0x41de7b-0x0;var _0xe9a0b8=_0xe634[_0x41de7b];return _0xe9a0b8;};'use strict';var _=require(_0x4e63('0x0'));var util=require('util');var logger=require(_0x4e63('0x1'))('api');var moment=require(_0x4e63('0x2'));var BPromise=require('bluebird');var rp=require(_0x4e63('0x3'));var fs=require('fs');var path=require(_0x4e63('0x4'));var rimraf=require(_0x4e63('0x5'));var config=require(_0x4e63('0x6'));var attributes=require('./chatMessage.attributes');module[_0x4e63('0x7')]=function(_0x260b27,_0x35bc15){return _0x260b27[_0x4e63('0x8')]('ChatMessage',attributes,{'tableName':_0x4e63('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x4e63('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x654481,_0xe777be,_0x1c4245){var _0x1a9324=_0x260b27[_0x4e63('0xb')];var _0x199260=_0x654481[_0x4e63('0xc')]({'plain':!![]});if(_0x199260[_0x4e63('0xd')][_0x4e63('0xe')]()==='in'||_0x199260['direction'][_0x4e63('0xe')]()===_0x4e63('0xf')&&!_0x199260[_0x4e63('0x10')]&&!_['isNil'](_0x199260[_0x4e63('0x11')])){_0x1a9324[_0x4e63('0x12')][_0x4e63('0x13')]({'where':{'id':_0x199260[_0x4e63('0x14')]}})[_0x4e63('0x15')](function(_0x5f47ce){if(_0x5f47ce){_0x5f47ce[_0x4e63('0x16')]({'lastMsgAt':_0x199260['createdAt'],'lastMsgDirection':_0x199260[_0x4e63('0xd')]['toLowerCase']()});}})[_0x4e63('0x17')](function(_0x261792){console[_0x4e63('0x18')](_0x261792);});}_0x1c4245();}},'charset':_0x4e63('0x19'),'collate':_0x4e63('0x1a')});}; \ No newline at end of file +var _0xf164=['isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x4650fd,_0x453fd1){var _0x392588=function(_0xc153c1){while(--_0xc153c1){_0x4650fd['push'](_0x4650fd['shift']());}};_0x392588(++_0x453fd1);}(_0xf164,0x6f));var _0x4f16=function(_0x8fb7a4,_0x607700){_0x8fb7a4=_0x8fb7a4-0x0;var _0x1fdca2=_0xf164[_0x8fb7a4];return _0x1fdca2;};'use strict';var _=require(_0x4f16('0x0'));var util=require(_0x4f16('0x1'));var logger=require(_0x4f16('0x2'))('api');var moment=require(_0x4f16('0x3'));var BPromise=require(_0x4f16('0x4'));var rp=require(_0x4f16('0x5'));var fs=require('fs');var path=require(_0x4f16('0x6'));var rimraf=require(_0x4f16('0x7'));var config=require(_0x4f16('0x8'));var attributes=require(_0x4f16('0x9'));module[_0x4f16('0xa')]=function(_0x552a58,_0x3339dc){return _0x552a58[_0x4f16('0xb')](_0x4f16('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x4f16('0xd')],'type':_0x4f16('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e6c94,_0x1a1c2d,_0x2e8c67){var _0x3940e8=_0x552a58[_0x4f16('0xf')];var _0x462072=_0x4e6c94[_0x4f16('0x10')]({'plain':!![]});if(_0x462072[_0x4f16('0x11')][_0x4f16('0x12')]()==='in'||_0x462072[_0x4f16('0x11')][_0x4f16('0x12')]()===_0x4f16('0x13')&&!_0x462072[_0x4f16('0x14')]&&!_[_0x4f16('0x15')](_0x462072[_0x4f16('0x16')])){_0x3940e8[_0x4f16('0x17')][_0x4f16('0x18')]({'where':{'id':_0x462072[_0x4f16('0x19')]}})[_0x4f16('0x1a')](function(_0x5736d3){if(_0x5736d3){_0x5736d3[_0x4f16('0x1b')]({'lastMsgAt':_0x462072[_0x4f16('0x1c')],'lastMsgDirection':_0x462072[_0x4f16('0x11')][_0x4f16('0x12')]()});}})[_0x4f16('0x1d')](function(_0x2bcc02){console[_0x4f16('0x1e')](_0x2bcc02);});}_0x2e8c67();}},'charset':_0x4f16('0x1f'),'collate':_0x4f16('0x20')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e191dc2..5166420 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 _0x45c3=['../../config/logger','../../config/environment','jayson/promise','client','redis','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x20f3bc,_0x34c2fd){var _0x2e0502=function(_0x14dd1a){while(--_0x14dd1a){_0x20f3bc['push'](_0x20f3bc['shift']());}};_0x2e0502(++_0x34c2fd);}(_0x45c3,0x11c));var _0x345c=function(_0x13eddd,_0x2bb439){_0x13eddd=_0x13eddd-0x0;var _0x3125b5=_0x45c3[_0x13eddd];return _0x3125b5;};'use strict';var _=require(_0x345c('0x0'));var util=require(_0x345c('0x1'));var moment=require(_0x345c('0x2'));var BPromise=require(_0x345c('0x3'));var rs=require(_0x345c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x345c('0x5'));var logger=require(_0x345c('0x6'))('rpc');var config=require(_0x345c('0x7'));var jayson=require(_0x345c('0x8'));var client=jayson[_0x345c('0x9')]['http']({'port':0x232a});config[_0x345c('0xa')]=_['defaults'](config[_0x345c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x345c('0xa')]));require(_0x345c('0xb'))[_0x345c('0xc')](socket);function respondWithRpcPromise(_0x5d1363,_0x44f65b,_0x2750b6){return new BPromise(function(_0xbf4243,_0x51bd5d){return client[_0x345c('0xd')](_0x5d1363,_0x2750b6)[_0x345c('0xe')](function(_0x5ce957){logger[_0x345c('0xf')](_0x345c('0x10'),_0x44f65b,_0x345c('0x11'));logger[_0x345c('0x12')](_0x345c('0x13'),_0x44f65b,_0x345c('0x11'),JSON[_0x345c('0x14')](_0x5ce957));if(_0x5ce957['error']){if(_0x5ce957[_0x345c('0x15')][_0x345c('0x16')]===0x1f4){logger[_0x345c('0x15')](_0x345c('0x10'),_0x44f65b,_0x5ce957[_0x345c('0x15')][_0x345c('0x17')]);return _0x51bd5d(_0x5ce957['error']['message']);}logger['error'](_0x345c('0x10'),_0x44f65b,_0x5ce957[_0x345c('0x15')][_0x345c('0x17')]);return _0xbf4243(_0x5ce957['error'][_0x345c('0x17')]);}else{logger[_0x345c('0xf')]('ChatMessage,\x20%s,\x20%s',_0x44f65b,_0x345c('0x11'));_0xbf4243(_0x5ce957['result'][_0x345c('0x17')]);}})[_0x345c('0x18')](function(_0x5800c2){logger[_0x345c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x44f65b,_0x5800c2);_0x51bd5d(_0x5800c2);});});}exports['CreateChatMessage']=function(_0x24c215){var _0x1b7708=this;return new Promise(function(_0x283dca,_0x291d71){return db['ChatMessage'][_0x345c('0x19')](_0x24c215[_0x345c('0x1a')],{'raw':_0x24c215['options']?_0x24c215[_0x345c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x345c('0xe')](function(_0x3936d3){logger[_0x345c('0xf')]('CreateChatMessage',_0x24c215);logger[_0x345c('0x12')](_0x345c('0x1c'),_0x24c215,JSON['stringify'](_0x3936d3));_0x283dca(_0x3936d3);})[_0x345c('0x18')](function(_0x20fb12){logger[_0x345c('0x15')](_0x345c('0x1c'),_0x20fb12[_0x345c('0x17')],_0x24c215);_0x291d71(_0x1b7708['error'](0x1f4,_0x20fb12[_0x345c('0x17')]));});});}; \ No newline at end of file +var _0x3437=['ChatMessage,\x20%s,\x20%s','result','CreateChatMessage','ChatMessage','body','options','raw','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x3437,0xe2));var _0x7343=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3437[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7343('0x0'));var util=require('util');var moment=require(_0x7343('0x1'));var BPromise=require(_0x7343('0x2'));var rs=require(_0x7343('0x3'));var fs=require('fs');var Redis=require(_0x7343('0x4'));var db=require(_0x7343('0x5'))['db'];var utils=require(_0x7343('0x6'));var logger=require(_0x7343('0x7'))(_0x7343('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7343('0x9')][_0x7343('0xa')]({'port':0x232a});config[_0x7343('0xb')]=_[_0x7343('0xc')](config[_0x7343('0xb')],{'host':_0x7343('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7343('0xb')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3d2e7c,_0x4b7ab1,_0x18a646){return new BPromise(function(_0x11184b,_0x1db148){return client['request'](_0x3d2e7c,_0x18a646)['then'](function(_0x3dcecc){logger[_0x7343('0xe')]('ChatMessage,\x20%s,\x20%s',_0x4b7ab1,_0x7343('0xf'));logger[_0x7343('0x10')](_0x7343('0x11'),_0x4b7ab1,'request\x20sent',JSON[_0x7343('0x12')](_0x3dcecc));if(_0x3dcecc[_0x7343('0x13')]){if(_0x3dcecc['error'][_0x7343('0x14')]===0x1f4){logger[_0x7343('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4b7ab1,_0x3dcecc[_0x7343('0x13')][_0x7343('0x15')]);return _0x1db148(_0x3dcecc[_0x7343('0x13')]['message']);}logger[_0x7343('0x13')](_0x7343('0x16'),_0x4b7ab1,_0x3dcecc['error']['message']);return _0x11184b(_0x3dcecc['error'][_0x7343('0x15')]);}else{logger[_0x7343('0xe')](_0x7343('0x16'),_0x4b7ab1,_0x7343('0xf'));_0x11184b(_0x3dcecc[_0x7343('0x17')][_0x7343('0x15')]);}})['catch'](function(_0x3c823b){logger[_0x7343('0x13')](_0x7343('0x16'),_0x4b7ab1,_0x3c823b);_0x1db148(_0x3c823b);});});}exports[_0x7343('0x18')]=function(_0x3606dc){var _0x2a58b4=this;return new Promise(function(_0x541431,_0x350271){return db[_0x7343('0x19')]['create'](_0x3606dc[_0x7343('0x1a')],{'raw':_0x3606dc['options']?_0x3606dc[_0x7343('0x1b')][_0x7343('0x1c')]===undefined?!![]:![]:!![]})[_0x7343('0x1d')](function(_0x4e60c0){logger[_0x7343('0xe')]('CreateChatMessage',_0x3606dc);logger[_0x7343('0x10')]('CreateChatMessage',_0x3606dc,JSON[_0x7343('0x12')](_0x4e60c0));_0x541431(_0x4e60c0);})[_0x7343('0x1e')](function(_0x3cb42c){logger[_0x7343('0x13')](_0x7343('0x18'),_0x3cb42c[_0x7343('0x15')],_0x3606dc);_0x350271(_0x2a58b4[_0x7343('0x13')](0x1f4,_0x3cb42c[_0x7343('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e7bc921..694472f 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 _0x5fab=['emit','removeListener','register','length','./chatMessage.events','save','update'];(function(_0xeabb77,_0x529cc1){var _0x287225=function(_0x30d921){while(--_0x30d921){_0xeabb77['push'](_0xeabb77['shift']());}};_0x287225(++_0x529cc1);}(_0x5fab,0x177));var _0xb5fa=function(_0x23c9a6,_0x5b2afa){_0x23c9a6=_0x23c9a6-0x0;var _0x5cfbb3=_0x5fab[_0x23c9a6];return _0x5cfbb3;};'use strict';var ChatMessageEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){ChatMessageEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('chatMessage:'+_0x1aec3e,_0x44df89);ChatMessageEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0xacf4=['removeListener','register','length','remove','update','emit'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xacf4,0xe7));var _0x4acf=function(_0x9efa59,_0x2acbdb){_0x9efa59=_0x9efa59-0x0;var _0xe74a94=_0xacf4[_0x9efa59];return _0xe74a94;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4acf('0x0'),_0x4acf('0x1')];function createListener(_0x1e2413,_0x21fb75){return function(_0x25709c){_0x21fb75[_0x4acf('0x2')](_0x1e2413,_0x25709c);};}function removeListener(_0x145264,_0x5cf22d){return function(){ChatMessageEvents[_0x4acf('0x3')](_0x145264,_0x5cf22d);};}exports[_0x4acf('0x4')]=function(_0x4e0c43){for(var _0x24bf24=0x0,_0x2ba08a=events[_0x4acf('0x5')];_0x24bf24<_0x2ba08a;_0x24bf24++){var _0x45a5a4=events[_0x24bf24];var _0x25d345=createListener('chatMessage:'+_0x45a5a4,_0x4e0c43);ChatMessageEvents['on'](_0x45a5a4,_0x25d345);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c8b9579..7d7027e 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 _0x7484=['tracked','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0x2976bb,_0x5c5add){var _0x26c340=function(_0x2a3d59){while(--_0x2a3d59){_0x2976bb['push'](_0x2976bb['shift']());}};_0x26c340(++_0x5c5add);}(_0x7484,0xf5));var _0x4748=function(_0xbc9146,_0x4421df){_0xbc9146=_0xbc9146-0x0;var _0x7867b1=_0x7484[_0xbc9146];return _0x7867b1;};'use strict';var multer=require(_0x4748('0x0'));var util=require(_0x4748('0x1'));var path=require(_0x4748('0x2'));var timeout=require(_0x4748('0x3'));var express=require(_0x4748('0x4'));var router=express[_0x4748('0x5')]();var auth=require(_0x4748('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4748('0x7'));var controller=require(_0x4748('0x8'));router[_0x4748('0x9')]('/',auth[_0x4748('0xa')](),controller[_0x4748('0xb')]);router[_0x4748('0x9')](_0x4748('0xc'),auth[_0x4748('0xa')](),controller['describe']);router[_0x4748('0x9')](_0x4748('0xd'),auth[_0x4748('0xa')](),controller['show']);router[_0x4748('0xe')]('/',auth['isAuthenticated'](),interaction[_0x4748('0xf')](_0x4748('0x10'),_0x4748('0x11')),controller[_0x4748('0x12')]);router[_0x4748('0x13')](_0x4748('0xd'),controller['update']);router[_0x4748('0x13')](_0x4748('0x14'),auth['isAuthenticated'](),controller[_0x4748('0x15')]);router[_0x4748('0x13')](_0x4748('0x16'),auth[_0x4748('0xa')](),controller['reject']);router[_0x4748('0x17')](_0x4748('0xd'),auth[_0x4748('0xa')](),controller[_0x4748('0x18')]);module[_0x4748('0x19')]=router; \ No newline at end of file +var _0x6c08=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','path','express','Router','../../components/auth/service'];(function(_0x3cdb00,_0x6f2d19){var _0x6543ac=function(_0x26448d){while(--_0x26448d){_0x3cdb00['push'](_0x3cdb00['shift']());}};_0x6543ac(++_0x6f2d19);}(_0x6c08,0x104));var _0x86c0=function(_0x3cb9e1,_0x31c6b7){_0x3cb9e1=_0x3cb9e1-0x0;var _0x673a7=_0x6c08[_0x3cb9e1];return _0x673a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x86c0('0x0'));var timeout=require('connect-timeout');var express=require(_0x86c0('0x1'));var router=express[_0x86c0('0x2')]();var auth=require(_0x86c0('0x3'));var interaction=require(_0x86c0('0x4'));var config=require(_0x86c0('0x5'));var controller=require('./chatMessage.controller');router[_0x86c0('0x6')]('/',auth[_0x86c0('0x7')](),controller['index']);router['get']('/describe',auth[_0x86c0('0x7')](),controller['describe']);router[_0x86c0('0x6')](_0x86c0('0x8'),auth[_0x86c0('0x7')](),controller[_0x86c0('0x9')]);router[_0x86c0('0xa')]('/',auth[_0x86c0('0x7')](),interaction[_0x86c0('0xb')](_0x86c0('0xc'),_0x86c0('0xd')),controller[_0x86c0('0xe')]);router[_0x86c0('0xf')](_0x86c0('0x8'),controller[_0x86c0('0x10')]);router[_0x86c0('0xf')](_0x86c0('0x11'),auth[_0x86c0('0x7')](),controller['accept']);router[_0x86c0('0xf')]('/:id/reject',auth[_0x86c0('0x7')](),controller[_0x86c0('0x12')]);router[_0x86c0('0x13')](_0x86c0('0x8'),auth[_0x86c0('0x7')](),controller[_0x86c0('0x14')]);module[_0x86c0('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index db3df69..5b05fb8 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 _0xd27e=['TEXT','sequelize'];(function(_0x50c5ed,_0x416dab){var _0x24fc8a=function(_0x11430e){while(--_0x11430e){_0x50c5ed['push'](_0x50c5ed['shift']());}};_0x24fc8a(++_0x416dab);}(_0xd27e,0xb9));var _0xed27=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd27e[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0xed27('0x0'));module['exports']={'body':{'type':Sequelize[_0xed27('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xa214=['medium','sequelize','exports','TEXT'];(function(_0x42cc11,_0x3208e9){var _0xd7c0b3=function(_0x1b2cc2){while(--_0x1b2cc2){_0x42cc11['push'](_0x42cc11['shift']());}};_0xd7c0b3(++_0x3208e9);}(_0xa214,0x1cd));var _0x4a21=function(_0x22b95b,_0x2c695e){_0x22b95b=_0x22b95b-0x0;var _0x32728b=_0xa214[_0x22b95b];return _0x32728b;};'use strict';var Sequelize=require(_0x4a21('0x0'));module[_0x4a21('0x1')]={'body':{'type':Sequelize[_0x4a21('0x2')](_0x4a21('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 725162e..873e8e5 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 _0x4d84=['options','includeAll','findAll','rows','catch','show','params','length','create','body','find','describe','html-pdf','rimraf','zip-dir','moment','mustache','util','path','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','error','name','send','index','ChatOfflineMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x35f091,_0x34fc6f){var _0x411982=function(_0x1168c9){while(--_0x1168c9){_0x35f091['push'](_0x35f091['shift']());}};_0x411982(++_0x34fc6f);}(_0x4d84,0x1c5));var _0x44d8=function(_0x353e55,_0x384e65){_0x353e55=_0x353e55-0x0;var _0xe1646a=_0x4d84[_0x353e55];return _0xe1646a;};'use strict';var pdf=require(_0x44d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44d8('0x1'));var zipdir=require(_0x44d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x44d8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x44d8('0x4'));var util=require(_0x44d8('0x5'));var path=require(_0x44d8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x44d8('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x44d8('0x8'));var toCsv=require(_0x44d8('0x9'));var querystring=require(_0x44d8('0xa'));var Papa=require(_0x44d8('0xb'));var Redis=require('ioredis');var authService=require(_0x44d8('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44d8('0xd'));var logger=require(_0x44d8('0xe'))(_0x44d8('0xf'));var utils=require('../../config/utils');var config=require(_0x44d8('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x44d8('0x11'))['db'];function respondWithStatusCode(_0x4af206,_0x5f1dab){_0x5f1dab=_0x5f1dab||0xcc;return function(_0x12aaeb){if(_0x12aaeb){return _0x4af206[_0x44d8('0x12')](_0x5f1dab);}return _0x4af206[_0x44d8('0x13')](_0x5f1dab)[_0x44d8('0x14')]();};}function respondWithResult(_0x3ff90a,_0x2cc82d){_0x2cc82d=_0x2cc82d||0xc8;return function(_0x2067b2){if(_0x2067b2){return _0x3ff90a[_0x44d8('0x13')](_0x2cc82d)[_0x44d8('0x15')](_0x2067b2);}};}function respondWithFilteredResult(_0x5a1b32,_0x4ad79b){return function(_0x20b764){if(_0x20b764){var _0x64b67d=_0x20b764[_0x44d8('0x16')],_0x39270c=_0x4ad79b[_0x44d8('0x17')],_0x1d9c4d=_0x4ad79b[_0x44d8('0x17')]+_0x4ad79b[_0x44d8('0x18')],_0x1d8c6b;if(_0x1d9c4d>=_0x64b67d){_0x1d9c4d=_0x64b67d;_0x1d8c6b=0xc8;}else{_0x1d8c6b=0xce;}_0x5a1b32[_0x44d8('0x13')](_0x1d8c6b);return _0x5a1b32['set'](_0x44d8('0x19'),_0x39270c+'-'+_0x1d9c4d+'/'+_0x64b67d)['json'](_0x20b764);}return null;};}function patchUpdates(_0x35f73c){return function(_0x479844){try{jsonpatch['apply'](_0x479844,_0x35f73c,!![]);}catch(_0x51ba7b){return BPromise[_0x44d8('0x1a')](_0x51ba7b);}return _0x479844[_0x44d8('0x1b')]();};}function saveUpdates(_0x3ff2ea,_0x94f971){return function(_0x4cae04){if(_0x4cae04){return _0x4cae04[_0x44d8('0x1c')](_0x3ff2ea)[_0x44d8('0x1d')](function(_0x2f90b8){return _0x2f90b8;});}return null;};}function removeEntity(_0x1cc556,_0x1fbc5a){return function(_0x3fb1a7){if(_0x3fb1a7){return _0x3fb1a7['destroy']()[_0x44d8('0x1d')](function(){_0x1cc556[_0x44d8('0x13')](0xcc)[_0x44d8('0x14')]();});}};}function handleEntityNotFound(_0x3fc772,_0x5df844){return function(_0x2b2394){if(!_0x2b2394){_0x3fc772[_0x44d8('0x12')](0x194);}return _0x2b2394;};}function handleError(_0x3d84c2,_0x59cff4){_0x59cff4=_0x59cff4||0x1f4;return function(_0x2294bb){logger[_0x44d8('0x1e')](_0x2294bb['stack']);if(_0x2294bb[_0x44d8('0x1f')]){delete _0x2294bb['name'];}_0x3d84c2[_0x44d8('0x13')](_0x59cff4)[_0x44d8('0x20')](_0x2294bb);};}exports[_0x44d8('0x21')]=function(_0x2f0450,_0x279867){var _0x38e260={},_0x4932d3={},_0x16ed70={'count':0x0,'rows':[]};var _0x10bb70=_['map'](db[_0x44d8('0x22')][_0x44d8('0x23')],function(_0x34954b){return{'name':_0x34954b['fieldName'],'type':_0x34954b[_0x44d8('0x24')][_0x44d8('0x25')]};});_0x4932d3[_0x44d8('0x26')]=_['map'](_0x10bb70,_0x44d8('0x1f'));_0x4932d3[_0x44d8('0x27')]=_[_0x44d8('0x28')](_0x2f0450[_0x44d8('0x27')]);_0x4932d3[_0x44d8('0x29')]=_[_0x44d8('0x2a')](_0x4932d3['model'],_0x4932d3['query']);_0x38e260[_0x44d8('0x2b')]=_[_0x44d8('0x2a')](_0x4932d3['model'],qs[_0x44d8('0x2c')](_0x2f0450[_0x44d8('0x27')][_0x44d8('0x2c')]));_0x38e260[_0x44d8('0x2b')]=_0x38e260['attributes']['length']?_0x38e260['attributes']:_0x4932d3['model'];if(!_0x2f0450[_0x44d8('0x27')]['hasOwnProperty']('nolimit')){_0x38e260['limit']=qs[_0x44d8('0x18')](_0x2f0450['query'][_0x44d8('0x18')]);_0x38e260['offset']=qs['offset'](_0x2f0450[_0x44d8('0x27')][_0x44d8('0x17')]);}_0x38e260['order']=qs[_0x44d8('0x2d')](_0x2f0450['query'][_0x44d8('0x2d')]);_0x38e260[_0x44d8('0x2e')]=qs[_0x44d8('0x29')](_[_0x44d8('0x2f')](_0x2f0450[_0x44d8('0x27')],_0x4932d3[_0x44d8('0x29')]),_0x10bb70);if(_0x2f0450['query'][_0x44d8('0x30')]){_0x38e260[_0x44d8('0x2e')]=_['merge'](_0x38e260[_0x44d8('0x2e')],{'$or':_['map'](_0x10bb70,function(_0x265335){if(_0x265335[_0x44d8('0x24')]!==_0x44d8('0x31')){var _0x4f1276={};_0x4f1276[_0x265335[_0x44d8('0x1f')]]={'$like':'%'+_0x2f0450['query']['filter']+'%'};return _0x4f1276;}})});}_0x38e260=_[_0x44d8('0x32')]({},_0x38e260,_0x2f0450[_0x44d8('0x33')]);var _0x4d3524={'where':_0x38e260[_0x44d8('0x2e')]};return db[_0x44d8('0x22')][_0x44d8('0x16')](_0x4d3524)[_0x44d8('0x1d')](function(_0xd922f3){_0x16ed70[_0x44d8('0x16')]=_0xd922f3;if(_0x2f0450[_0x44d8('0x27')][_0x44d8('0x34')]){_0x38e260['include']=[{'all':!![]}];}return db[_0x44d8('0x22')][_0x44d8('0x35')](_0x38e260);})[_0x44d8('0x1d')](function(_0x2063a7){_0x16ed70[_0x44d8('0x36')]=_0x2063a7;return _0x16ed70;})[_0x44d8('0x1d')](respondWithFilteredResult(_0x279867,_0x38e260))[_0x44d8('0x37')](handleError(_0x279867,null));};exports[_0x44d8('0x38')]=function(_0x4a016c,_0x25b5da){var _0x26d5b2={'raw':!![],'where':{'id':_0x4a016c[_0x44d8('0x39')]['id']}},_0x9a54b5={};_0x9a54b5[_0x44d8('0x26')]=_[_0x44d8('0x28')](db[_0x44d8('0x22')][_0x44d8('0x23')]);_0x9a54b5['query']=_['keys'](_0x4a016c['query']);_0x9a54b5[_0x44d8('0x29')]=_['intersection'](_0x9a54b5[_0x44d8('0x26')],_0x9a54b5[_0x44d8('0x27')]);_0x26d5b2['attributes']=_[_0x44d8('0x2a')](_0x9a54b5[_0x44d8('0x26')],qs[_0x44d8('0x2c')](_0x4a016c[_0x44d8('0x27')][_0x44d8('0x2c')]));_0x26d5b2[_0x44d8('0x2b')]=_0x26d5b2[_0x44d8('0x2b')][_0x44d8('0x3a')]?_0x26d5b2[_0x44d8('0x2b')]:_0x9a54b5['model'];if(_0x4a016c[_0x44d8('0x27')][_0x44d8('0x34')]){_0x26d5b2['include']=[{'all':!![]}];}_0x26d5b2=_[_0x44d8('0x32')]({},_0x26d5b2,_0x4a016c['options']);return db['ChatOfflineMessage']['find'](_0x26d5b2)[_0x44d8('0x1d')](handleEntityNotFound(_0x25b5da,null))[_0x44d8('0x1d')](respondWithResult(_0x25b5da,null))['catch'](handleError(_0x25b5da,null));};exports[_0x44d8('0x3b')]=function(_0x330558,_0x425b54){return db[_0x44d8('0x22')][_0x44d8('0x3b')](_0x330558[_0x44d8('0x3c')],{})['then'](respondWithResult(_0x425b54,0xc9))[_0x44d8('0x37')](handleError(_0x425b54,null));};exports[_0x44d8('0x1c')]=function(_0x256d54,_0x1953c7){if(_0x256d54['body']['id']){delete _0x256d54[_0x44d8('0x3c')]['id'];}return db['ChatOfflineMessage']['find']({'where':{'id':_0x256d54[_0x44d8('0x39')]['id']}})[_0x44d8('0x1d')](handleEntityNotFound(_0x1953c7,null))[_0x44d8('0x1d')](saveUpdates(_0x256d54[_0x44d8('0x3c')],null))['then'](respondWithResult(_0x1953c7,null))[_0x44d8('0x37')](handleError(_0x1953c7,null));};exports['destroy']=function(_0x29368d,_0xf09010){return db[_0x44d8('0x22')][_0x44d8('0x3d')]({'where':{'id':_0x29368d[_0x44d8('0x39')]['id']}})[_0x44d8('0x1d')](handleEntityNotFound(_0xf09010,null))[_0x44d8('0x1d')](removeEntity(_0xf09010,null))[_0x44d8('0x37')](handleError(_0xf09010,null));};exports['describe']=function(_0x23b695,_0x4e7dd7){return db[_0x44d8('0x22')][_0x44d8('0x3e')]()['then'](respondWithResult(_0x4e7dd7,null))['catch'](handleError(_0x4e7dd7,null));}; \ No newline at end of file +var _0x9ef8=['end','json','count','offset','limit','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','ChatOfflineMessage','include','findAll','catch','show','filters','includeAll','options','find','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x9ef8,0x78));var _0x89ef=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x9ef8[_0x2a558d];return _0xa7bc9c;};'use strict';var pdf=require(_0x89ef('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x89ef('0x1'));var rp=require(_0x89ef('0x2'));var moment=require(_0x89ef('0x3'));var BPromise=require(_0x89ef('0x4'));var Mustache=require(_0x89ef('0x5'));var util=require(_0x89ef('0x6'));var path=require(_0x89ef('0x7'));var sox=require(_0x89ef('0x8'));var csv=require('to-csv');var ejs=require(_0x89ef('0x9'));var fs=require('fs');var _=require(_0x89ef('0xa'));var squel=require(_0x89ef('0xb'));var crypto=require('crypto');var jsforce=require(_0x89ef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x89ef('0xd'));var querystring=require(_0x89ef('0xe'));var Papa=require('papaparse');var Redis=require(_0x89ef('0xf'));var authService=require(_0x89ef('0x10'));var qs=require(_0x89ef('0x11'));var as=require(_0x89ef('0x12'));var hardwareService=require(_0x89ef('0x13'));var logger=require(_0x89ef('0x14'))(_0x89ef('0x15'));var utils=require(_0x89ef('0x16'));var config=require(_0x89ef('0x17'));var licenseUtil=require(_0x89ef('0x18'));var db=require(_0x89ef('0x19'))['db'];function respondWithStatusCode(_0x48154a,_0xc3b411){_0xc3b411=_0xc3b411||0xcc;return function(_0x3e911d){if(_0x3e911d){return _0x48154a[_0x89ef('0x1a')](_0xc3b411);}return _0x48154a[_0x89ef('0x1b')](_0xc3b411)[_0x89ef('0x1c')]();};}function respondWithResult(_0x44aebe,_0x29afe3){_0x29afe3=_0x29afe3||0xc8;return function(_0x430e2e){if(_0x430e2e){return _0x44aebe[_0x89ef('0x1b')](_0x29afe3)[_0x89ef('0x1d')](_0x430e2e);}};}function respondWithFilteredResult(_0x173bd2,_0x4cf244){return function(_0x2139e8){if(_0x2139e8){var _0x539eac=_0x2139e8[_0x89ef('0x1e')],_0x2a0493=_0x4cf244[_0x89ef('0x1f')],_0x1fb8f3=_0x4cf244[_0x89ef('0x1f')]+_0x4cf244[_0x89ef('0x20')],_0x1d4e87;if(_0x1fb8f3>=_0x539eac){_0x1fb8f3=_0x539eac;_0x1d4e87=0xc8;}else{_0x1d4e87=0xce;}_0x173bd2[_0x89ef('0x1b')](_0x1d4e87);return _0x173bd2['set']('Content-Range',_0x2a0493+'-'+_0x1fb8f3+'/'+_0x539eac)[_0x89ef('0x1d')](_0x2139e8);}return null;};}function patchUpdates(_0x389654){return function(_0x515d06){try{jsonpatch[_0x89ef('0x21')](_0x515d06,_0x389654,!![]);}catch(_0x3ce43b){return BPromise['reject'](_0x3ce43b);}return _0x515d06['save']();};}function saveUpdates(_0x2d7b79,_0x497424){return function(_0x56179a){if(_0x56179a){return _0x56179a[_0x89ef('0x22')](_0x2d7b79)[_0x89ef('0x23')](function(_0x3f71a8){return _0x3f71a8;});}return null;};}function removeEntity(_0x49e654,_0xe15598){return function(_0xcaf78d){if(_0xcaf78d){return _0xcaf78d[_0x89ef('0x24')]()[_0x89ef('0x23')](function(){_0x49e654[_0x89ef('0x1b')](0xcc)[_0x89ef('0x1c')]();});}};}function handleEntityNotFound(_0x2b8a9b,_0x506ea2){return function(_0x54b935){if(!_0x54b935){_0x2b8a9b[_0x89ef('0x1a')](0x194);}return _0x54b935;};}function handleError(_0x279bc8,_0x59cb87){_0x59cb87=_0x59cb87||0x1f4;return function(_0x5147f8){logger[_0x89ef('0x25')](_0x5147f8[_0x89ef('0x26')]);if(_0x5147f8['name']){delete _0x5147f8[_0x89ef('0x27')];}_0x279bc8['status'](_0x59cb87)[_0x89ef('0x28')](_0x5147f8);};}exports[_0x89ef('0x29')]=function(_0x2eb3c7,_0x6ffdee){var _0xa8c397={},_0x408de4={},_0x4cb22d={'count':0x0,'rows':[]};var _0x2f76c1=_[_0x89ef('0x2a')](db['ChatOfflineMessage'][_0x89ef('0x2b')],function(_0x563ff5){return{'name':_0x563ff5[_0x89ef('0x2c')],'type':_0x563ff5[_0x89ef('0x2d')][_0x89ef('0x2e')]};});_0x408de4[_0x89ef('0x2f')]=_[_0x89ef('0x2a')](_0x2f76c1,_0x89ef('0x27'));_0x408de4[_0x89ef('0x30')]=_[_0x89ef('0x31')](_0x2eb3c7['query']);_0x408de4['filters']=_['intersection'](_0x408de4[_0x89ef('0x2f')],_0x408de4[_0x89ef('0x30')]);_0xa8c397[_0x89ef('0x32')]=_[_0x89ef('0x33')](_0x408de4['model'],qs[_0x89ef('0x34')](_0x2eb3c7[_0x89ef('0x30')][_0x89ef('0x34')]));_0xa8c397['attributes']=_0xa8c397[_0x89ef('0x32')][_0x89ef('0x35')]?_0xa8c397[_0x89ef('0x32')]:_0x408de4[_0x89ef('0x2f')];if(!_0x2eb3c7[_0x89ef('0x30')][_0x89ef('0x36')](_0x89ef('0x37'))){_0xa8c397[_0x89ef('0x20')]=qs[_0x89ef('0x20')](_0x2eb3c7[_0x89ef('0x30')][_0x89ef('0x20')]);_0xa8c397['offset']=qs[_0x89ef('0x1f')](_0x2eb3c7[_0x89ef('0x30')][_0x89ef('0x1f')]);}_0xa8c397['order']=qs[_0x89ef('0x38')](_0x2eb3c7[_0x89ef('0x30')][_0x89ef('0x38')]);_0xa8c397[_0x89ef('0x39')]=qs['filters'](_[_0x89ef('0x3a')](_0x2eb3c7[_0x89ef('0x30')],_0x408de4['filters']),_0x2f76c1);if(_0x2eb3c7[_0x89ef('0x30')]['filter']){_0xa8c397[_0x89ef('0x39')]=_[_0x89ef('0x3b')](_0xa8c397['where'],{'$or':_[_0x89ef('0x2a')](_0x2f76c1,function(_0x62e382){if(_0x62e382[_0x89ef('0x2d')]!==_0x89ef('0x3c')){var _0x5814af={};_0x5814af[_0x62e382[_0x89ef('0x27')]]={'$like':'%'+_0x2eb3c7['query'][_0x89ef('0x3d')]+'%'};return _0x5814af;}})});}_0xa8c397=_[_0x89ef('0x3b')]({},_0xa8c397,_0x2eb3c7['options']);var _0x28181d={'where':_0xa8c397[_0x89ef('0x39')]};return db[_0x89ef('0x3e')][_0x89ef('0x1e')](_0x28181d)[_0x89ef('0x23')](function(_0x31a20c){_0x4cb22d[_0x89ef('0x1e')]=_0x31a20c;if(_0x2eb3c7['query']['includeAll']){_0xa8c397[_0x89ef('0x3f')]=[{'all':!![]}];}return db[_0x89ef('0x3e')][_0x89ef('0x40')](_0xa8c397);})['then'](function(_0xcc56ad){_0x4cb22d['rows']=_0xcc56ad;return _0x4cb22d;})[_0x89ef('0x23')](respondWithFilteredResult(_0x6ffdee,_0xa8c397))[_0x89ef('0x41')](handleError(_0x6ffdee,null));};exports[_0x89ef('0x42')]=function(_0x1b6900,_0x719425){var _0x2c953a={'raw':!![],'where':{'id':_0x1b6900['params']['id']}},_0x2bb2db={};_0x2bb2db['model']=_[_0x89ef('0x31')](db[_0x89ef('0x3e')][_0x89ef('0x2b')]);_0x2bb2db[_0x89ef('0x30')]=_[_0x89ef('0x31')](_0x1b6900['query']);_0x2bb2db[_0x89ef('0x43')]=_[_0x89ef('0x33')](_0x2bb2db['model'],_0x2bb2db['query']);_0x2c953a[_0x89ef('0x32')]=_[_0x89ef('0x33')](_0x2bb2db[_0x89ef('0x2f')],qs[_0x89ef('0x34')](_0x1b6900[_0x89ef('0x30')][_0x89ef('0x34')]));_0x2c953a[_0x89ef('0x32')]=_0x2c953a[_0x89ef('0x32')][_0x89ef('0x35')]?_0x2c953a[_0x89ef('0x32')]:_0x2bb2db[_0x89ef('0x2f')];if(_0x1b6900['query'][_0x89ef('0x44')]){_0x2c953a[_0x89ef('0x3f')]=[{'all':!![]}];}_0x2c953a=_[_0x89ef('0x3b')]({},_0x2c953a,_0x1b6900[_0x89ef('0x45')]);return db[_0x89ef('0x3e')][_0x89ef('0x46')](_0x2c953a)[_0x89ef('0x23')](handleEntityNotFound(_0x719425,null))[_0x89ef('0x23')](respondWithResult(_0x719425,null))[_0x89ef('0x41')](handleError(_0x719425,null));};exports[_0x89ef('0x47')]=function(_0x25dd3b,_0x32588f){return db[_0x89ef('0x3e')][_0x89ef('0x47')](_0x25dd3b[_0x89ef('0x48')],{})[_0x89ef('0x23')](respondWithResult(_0x32588f,0xc9))[_0x89ef('0x41')](handleError(_0x32588f,null));};exports['update']=function(_0x375a44,_0x56fa6e){if(_0x375a44[_0x89ef('0x48')]['id']){delete _0x375a44[_0x89ef('0x48')]['id'];}return db[_0x89ef('0x3e')][_0x89ef('0x46')]({'where':{'id':_0x375a44['params']['id']}})['then'](handleEntityNotFound(_0x56fa6e,null))[_0x89ef('0x23')](saveUpdates(_0x375a44[_0x89ef('0x48')],null))[_0x89ef('0x23')](respondWithResult(_0x56fa6e,null))[_0x89ef('0x41')](handleError(_0x56fa6e,null));};exports[_0x89ef('0x24')]=function(_0x47ef44,_0x54319a){return db['ChatOfflineMessage'][_0x89ef('0x46')]({'where':{'id':_0x47ef44['params']['id']}})['then'](handleEntityNotFound(_0x54319a,null))[_0x89ef('0x23')](removeEntity(_0x54319a,null))[_0x89ef('0x41')](handleError(_0x54319a,null));};exports[_0x89ef('0x49')]=function(_0xc7f81f,_0xeff6b3){return db[_0x89ef('0x3e')][_0x89ef('0x49')]()[_0x89ef('0x23')](respondWithResult(_0xeff6b3,null))[_0x89ef('0x41')](handleError(_0xeff6b3,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 30de44a..39c9923 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 _0xcea2=['rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0xcea2,0x15a));var _0x2cea=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xcea2[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cea('0xb'),'collate':_0x2cea('0xc')});}; \ No newline at end of file +var _0xd2ea=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x423d28,_0x299699){var _0x3d414b=function(_0xac97e8){while(--_0xac97e8){_0x423d28['push'](_0x423d28['shift']());}};_0x3d414b(++_0x299699);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3f1229,_0x212bdb){_0x3f1229=_0x3f1229-0x0;var _0x1c7758=_0xd2ea[_0x3f1229];return _0x1c7758;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xad2e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6a87860..26379cb 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 _0xee4c=['request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee4c,0x1c3));var _0xcee4=function(_0x3bfccc,_0x26cad6){_0x3bfccc=_0x3bfccc-0x0;var _0xd68d0a=_0xee4c[_0x3bfccc];return _0xd68d0a;};'use strict';var _=require(_0xcee4('0x0'));var util=require(_0xcee4('0x1'));var moment=require(_0xcee4('0x2'));var BPromise=require('bluebird');var rs=require(_0xcee4('0x3'));var fs=require('fs');var Redis=require(_0xcee4('0x4'));var db=require(_0xcee4('0x5'))['db'];var utils=require(_0xcee4('0x6'));var logger=require(_0xcee4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcee4('0x8'));var client=jayson[_0xcee4('0x9')][_0xcee4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54093e,_0x5da600,_0x48e608){return new BPromise(function(_0x3580c8,_0xda7822){return client[_0xcee4('0xb')](_0x54093e,_0x48e608)[_0xcee4('0xc')](function(_0x32a010){logger[_0xcee4('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5da600,_0xcee4('0xe'));logger[_0xcee4('0xf')](_0xcee4('0x10'),_0x5da600,_0xcee4('0xe'),JSON['stringify'](_0x32a010));if(_0x32a010[_0xcee4('0x11')]){if(_0x32a010[_0xcee4('0x11')]['code']===0x1f4){logger[_0xcee4('0x11')](_0xcee4('0x12'),_0x5da600,_0x32a010[_0xcee4('0x11')][_0xcee4('0x13')]);return _0xda7822(_0x32a010[_0xcee4('0x11')]['message']);}logger[_0xcee4('0x11')](_0xcee4('0x12'),_0x5da600,_0x32a010['error'][_0xcee4('0x13')]);return _0x3580c8(_0x32a010[_0xcee4('0x11')][_0xcee4('0x13')]);}else{logger[_0xcee4('0xd')](_0xcee4('0x12'),_0x5da600,_0xcee4('0xe'));_0x3580c8(_0x32a010['result'][_0xcee4('0x13')]);}})[_0xcee4('0x14')](function(_0x474b56){logger[_0xcee4('0x11')](_0xcee4('0x12'),_0x5da600,_0x474b56);_0xda7822(_0x474b56);});});} \ No newline at end of file +var _0x6acf=['request\x20sent','debug','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6acf,0x6f));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf6ac('0x1'));var rs=require(_0xf6ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6ac('0x3'))['db'];var utils=require(_0xf6ac('0x4'));var logger=require(_0xf6ac('0x5'))(_0xf6ac('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6ac('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a8592,_0x172ff4,_0x54e9e0){return new BPromise(function(_0x29dd73,_0x326b8a){return client['request'](_0x1a8592,_0x54e9e0)[_0xf6ac('0x8')](function(_0x2cd18d){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x172ff4,_0xf6ac('0x9'));logger[_0xf6ac('0xa')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x172ff4,_0xf6ac('0x9'),JSON['stringify'](_0x2cd18d));if(_0x2cd18d[_0xf6ac('0xb')]){if(_0x2cd18d[_0xf6ac('0xb')][_0xf6ac('0xc')]===0x1f4){logger[_0xf6ac('0xb')](_0xf6ac('0xd'),_0x172ff4,_0x2cd18d['error'][_0xf6ac('0xe')]);return _0x326b8a(_0x2cd18d[_0xf6ac('0xb')][_0xf6ac('0xe')]);}logger[_0xf6ac('0xb')](_0xf6ac('0xd'),_0x172ff4,_0x2cd18d[_0xf6ac('0xb')][_0xf6ac('0xe')]);return _0x29dd73(_0x2cd18d['error'][_0xf6ac('0xe')]);}else{logger['info'](_0xf6ac('0xd'),_0x172ff4,'request\x20sent');_0x29dd73(_0x2cd18d['result']['message']);}})['catch'](function(_0xd93424){logger['error'](_0xf6ac('0xd'),_0x172ff4,_0xd93424);_0x326b8a(_0xd93424);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 897d8b8..f8d59c0 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 _0x6978=['/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0x1bad88,_0x1f87b4){var _0x36f638=function(_0x4e787a){while(--_0x4e787a){_0x1bad88['push'](_0x1bad88['shift']());}};_0x36f638(++_0x1f87b4);}(_0x6978,0x15c));var _0x8697=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x6978[_0x99ff94];return _0x1b5bc0;};'use strict';var multer=require(_0x8697('0x0'));var util=require(_0x8697('0x1'));var path=require(_0x8697('0x2'));var timeout=require(_0x8697('0x3'));var express=require(_0x8697('0x4'));var router=express['Router']();var auth=require(_0x8697('0x5'));var interaction=require(_0x8697('0x6'));var config=require(_0x8697('0x7'));var controller=require(_0x8697('0x8'));router[_0x8697('0x9')]('/',auth[_0x8697('0xa')](),controller['index']);router[_0x8697('0x9')](_0x8697('0xb'),auth[_0x8697('0xa')](),controller[_0x8697('0xc')]);router[_0x8697('0x9')](_0x8697('0xd'),auth[_0x8697('0xa')](),controller[_0x8697('0xe')]);router[_0x8697('0xf')]('/',auth[_0x8697('0xa')](),controller['create']);router[_0x8697('0x10')](_0x8697('0xd'),auth[_0x8697('0xa')](),controller['update']);router[_0x8697('0x11')](_0x8697('0xd'),auth[_0x8697('0xa')](),controller[_0x8697('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0e4b=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','exports','multer'];(function(_0xf3a798,_0x558458){var _0x4ba6fe=function(_0x2c143c){while(--_0x2c143c){_0xf3a798['push'](_0xf3a798['shift']());}};_0x4ba6fe(++_0x558458);}(_0x0e4b,0xb3));var _0xb0e4=function(_0x120155,_0x7dcfe8){_0x120155=_0x120155-0x0;var _0x4894a2=_0x0e4b[_0x120155];return _0x4894a2;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require('path');var timeout=require(_0xb0e4('0x2'));var express=require(_0xb0e4('0x3'));var router=express[_0xb0e4('0x4')]();var auth=require(_0xb0e4('0x5'));var interaction=require(_0xb0e4('0x6'));var config=require(_0xb0e4('0x7'));var controller=require(_0xb0e4('0x8'));router[_0xb0e4('0x9')]('/',auth[_0xb0e4('0xa')](),controller[_0xb0e4('0xb')]);router['get'](_0xb0e4('0xc'),auth[_0xb0e4('0xa')](),controller['describe']);router['get'](_0xb0e4('0xd'),auth['isAuthenticated'](),controller[_0xb0e4('0xe')]);router[_0xb0e4('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb0e4('0x10')](_0xb0e4('0xd'),auth[_0xb0e4('0xa')](),controller[_0xb0e4('0x11')]);router[_0xb0e4('0x12')](_0xb0e4('0xd'),auth[_0xb0e4('0xa')](),controller['destroy']);module[_0xb0e4('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 68bd82a..29929fb 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 _0xf01b=['sequelize','STRING','mouseOver','timeout','INTEGER'];(function(_0x54eaaf,_0x17cb38){var _0x4918a0=function(_0xa9fbe0){while(--_0xa9fbe0){_0x54eaaf['push'](_0x54eaaf['shift']());}};_0x4918a0(++_0x17cb38);}(_0xf01b,0x1db));var _0xbf01=function(_0x24e203,_0x519e3a){_0x24e203=_0x24e203-0x0;var _0xcaf852=_0xf01b[_0x24e203];return _0xcaf852;};'use strict';var Sequelize=require(_0xbf01('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf01('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf01('0x2'),_0xbf01('0x3')),'defaultValue':_0xbf01('0x2')},'selector':{'type':Sequelize[_0xbf01('0x1')]},'timeout':{'type':Sequelize[_0xbf01('0x4')]}}; \ No newline at end of file +var _0xaf66=['STRING','ENUM','mouseOver','INTEGER','exports'];(function(_0x45940b,_0x392fab){var _0x49946a=function(_0x5aa855){while(--_0x5aa855){_0x45940b['push'](_0x45940b['shift']());}};_0x49946a(++_0x392fab);}(_0xaf66,0x117));var _0x6af6=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xaf66[_0x999b85];return _0x1d7124;};'use strict';var Sequelize=require('sequelize');module[_0x6af6('0x0')]={'name':{'type':Sequelize[_0x6af6('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6af6('0x2')](_0x6af6('0x3'),'timeout'),'defaultValue':_0x6af6('0x3')},'selector':{'type':Sequelize[_0x6af6('0x1')]},'timeout':{'type':Sequelize[_0x6af6('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b903679..c65cb69 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 _0x4c0e=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','destroy','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','create','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5b01b8,_0x312ec2){var _0x2b032d=function(_0x59eb7d){while(--_0x59eb7d){_0x5b01b8['push'](_0x5b01b8['shift']());}};_0x2b032d(++_0x312ec2);}(_0x4c0e,0x10e));var _0xe4c0=function(_0xe47217,_0x3a35db){_0xe47217=_0xe47217-0x0;var _0x3dc84c=_0x4c0e[_0xe47217];return _0x3dc84c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4c0('0x0'));var rimraf=require(_0xe4c0('0x1'));var zipdir=require(_0xe4c0('0x2'));var jsonpatch=require(_0xe4c0('0x3'));var rp=require('request-promise');var moment=require(_0xe4c0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe4c0('0x5'));var sox=require(_0xe4c0('0x6'));var csv=require(_0xe4c0('0x7'));var ejs=require(_0xe4c0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe4c0('0x9'));var crypto=require(_0xe4c0('0xa'));var jsforce=require(_0xe4c0('0xb'));var deskjs=require(_0xe4c0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe4c0('0xd'));var Papa=require(_0xe4c0('0xe'));var Redis=require('ioredis');var authService=require(_0xe4c0('0xf'));var qs=require(_0xe4c0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4c0('0x11'))(_0xe4c0('0x12'));var utils=require(_0xe4c0('0x13'));var config=require(_0xe4c0('0x14'));var licenseUtil=require(_0xe4c0('0x15'));var db=require(_0xe4c0('0x16'))['db'];function respondWithStatusCode(_0x5efa52,_0x43d9b5){_0x43d9b5=_0x43d9b5||0xcc;return function(_0xe2db20){if(_0xe2db20){return _0x5efa52[_0xe4c0('0x17')](_0x43d9b5);}return _0x5efa52[_0xe4c0('0x18')](_0x43d9b5)[_0xe4c0('0x19')]();};}function respondWithResult(_0x221006,_0x38926b){_0x38926b=_0x38926b||0xc8;return function(_0x2f00a7){if(_0x2f00a7){return _0x221006[_0xe4c0('0x18')](_0x38926b)[_0xe4c0('0x1a')](_0x2f00a7);}};}function respondWithFilteredResult(_0x348ce0,_0x52886f){return function(_0x19017b){if(_0x19017b){var _0x223e17=_0x19017b['count'],_0x3a4424=_0x52886f[_0xe4c0('0x1b')],_0x5c0bae=_0x52886f[_0xe4c0('0x1b')]+_0x52886f[_0xe4c0('0x1c')],_0x55bf92;if(_0x5c0bae>=_0x223e17){_0x5c0bae=_0x223e17;_0x55bf92=0xc8;}else{_0x55bf92=0xce;}_0x348ce0['status'](_0x55bf92);return _0x348ce0[_0xe4c0('0x1d')]('Content-Range',_0x3a4424+'-'+_0x5c0bae+'/'+_0x223e17)[_0xe4c0('0x1a')](_0x19017b);}return null;};}function patchUpdates(_0x358d36){return function(_0x18df5e){try{jsonpatch[_0xe4c0('0x1e')](_0x18df5e,_0x358d36,!![]);}catch(_0x3b3608){return BPromise['reject'](_0x3b3608);}return _0x18df5e[_0xe4c0('0x1f')]();};}function saveUpdates(_0x4bc463,_0xaaab97){return function(_0x376be3){if(_0x376be3){return _0x376be3['update'](_0x4bc463)['then'](function(_0x25d4f0){return _0x25d4f0;});}return null;};}function removeEntity(_0x38be38,_0x2cf315){return function(_0x4fb2a4){if(_0x4fb2a4){return _0x4fb2a4[_0xe4c0('0x20')]()[_0xe4c0('0x21')](function(){_0x38be38[_0xe4c0('0x18')](0xcc)[_0xe4c0('0x19')]();});}};}function handleEntityNotFound(_0x4cc70d,_0x1c0864){return function(_0x4e9c4d){if(!_0x4e9c4d){_0x4cc70d[_0xe4c0('0x17')](0x194);}return _0x4e9c4d;};}function handleError(_0x40224c,_0x2c53ca){_0x2c53ca=_0x2c53ca||0x1f4;return function(_0x1c6e75){logger[_0xe4c0('0x22')](_0x1c6e75[_0xe4c0('0x23')]);if(_0x1c6e75[_0xe4c0('0x24')]){delete _0x1c6e75['name'];}_0x40224c[_0xe4c0('0x18')](_0x2c53ca)[_0xe4c0('0x25')](_0x1c6e75);};}exports['show']=function(_0x313feb,_0x2f1521){var _0x32b6f2={'raw':!![],'where':{'id':_0x313feb[_0xe4c0('0x26')]['id']}},_0x8f546e={};_0x8f546e[_0xe4c0('0x27')]=_[_0xe4c0('0x28')](db[_0xe4c0('0x29')][_0xe4c0('0x2a')]);_0x8f546e[_0xe4c0('0x2b')]=_[_0xe4c0('0x28')](_0x313feb[_0xe4c0('0x2b')]);_0x8f546e[_0xe4c0('0x2c')]=_[_0xe4c0('0x2d')](_0x8f546e[_0xe4c0('0x27')],_0x8f546e[_0xe4c0('0x2b')]);_0x32b6f2[_0xe4c0('0x2e')]=_[_0xe4c0('0x2d')](_0x8f546e[_0xe4c0('0x27')],qs['fields'](_0x313feb[_0xe4c0('0x2b')][_0xe4c0('0x2f')]));_0x32b6f2['attributes']=_0x32b6f2['attributes'][_0xe4c0('0x30')]?_0x32b6f2['attributes']:_0x8f546e[_0xe4c0('0x27')];if(_0x313feb[_0xe4c0('0x2b')][_0xe4c0('0x31')]){_0x32b6f2[_0xe4c0('0x32')]=[{'all':!![]}];}_0x32b6f2=_['merge']({},_0x32b6f2,_0x313feb[_0xe4c0('0x33')]);return db['ChatProactiveAction']['find'](_0x32b6f2)[_0xe4c0('0x21')](handleEntityNotFound(_0x2f1521,null))['then'](respondWithResult(_0x2f1521,null))['catch'](handleError(_0x2f1521,null));};exports['create']=function(_0x302802,_0x40baa1){return db['ChatProactiveAction'][_0xe4c0('0x34')](_0x302802['body'],{})[_0xe4c0('0x21')](respondWithResult(_0x40baa1,0xc9))[_0xe4c0('0x35')](handleError(_0x40baa1,null));};exports[_0xe4c0('0x36')]=function(_0x160f6a,_0xb73017){if(_0x160f6a['body']['id']){delete _0x160f6a[_0xe4c0('0x37')]['id'];}return db['ChatProactiveAction'][_0xe4c0('0x38')]({'where':{'id':_0x160f6a[_0xe4c0('0x26')]['id']}})[_0xe4c0('0x21')](handleEntityNotFound(_0xb73017,null))[_0xe4c0('0x21')](saveUpdates(_0x160f6a['body'],null))['then'](respondWithResult(_0xb73017,null))[_0xe4c0('0x35')](handleError(_0xb73017,null));};exports[_0xe4c0('0x20')]=function(_0x13a75c,_0x357212){return db[_0xe4c0('0x29')]['find']({'where':{'id':_0x13a75c[_0xe4c0('0x26')]['id']}})['then'](handleEntityNotFound(_0x357212,null))[_0xe4c0('0x21')](removeEntity(_0x357212,null))[_0xe4c0('0x35')](handleError(_0x357212,null));}; \ No newline at end of file +var _0x8ad1=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','destroy','name','send','show','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','then','catch','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x573cec,_0x3873a4){var _0x1fad97=function(_0x422477){while(--_0x422477){_0x573cec['push'](_0x573cec['shift']());}};_0x1fad97(++_0x3873a4);}(_0x8ad1,0xd9));var _0x18ad=function(_0x4bdd1c,_0x129a13){_0x4bdd1c=_0x4bdd1c-0x0;var _0x3a572f=_0x8ad1[_0x4bdd1c];return _0x3a572f;};'use strict';var pdf=require(_0x18ad('0x0'));var emlformat=require(_0x18ad('0x1'));var rimraf=require(_0x18ad('0x2'));var zipdir=require(_0x18ad('0x3'));var jsonpatch=require(_0x18ad('0x4'));var rp=require(_0x18ad('0x5'));var moment=require(_0x18ad('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x18ad('0x7'));var util=require(_0x18ad('0x8'));var path=require(_0x18ad('0x9'));var sox=require(_0x18ad('0xa'));var csv=require(_0x18ad('0xb'));var ejs=require(_0x18ad('0xc'));var fs=require('fs');var _=require(_0x18ad('0xd'));var squel=require(_0x18ad('0xe'));var crypto=require(_0x18ad('0xf'));var jsforce=require(_0x18ad('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x18ad('0xb'));var querystring=require('querystring');var Papa=require(_0x18ad('0x11'));var Redis=require(_0x18ad('0x12'));var authService=require(_0x18ad('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18ad('0x14'));var logger=require(_0x18ad('0x15'))(_0x18ad('0x16'));var utils=require(_0x18ad('0x17'));var config=require(_0x18ad('0x18'));var licenseUtil=require(_0x18ad('0x19'));var db=require(_0x18ad('0x1a'))['db'];function respondWithStatusCode(_0x5cf29b,_0x2f7dc4){_0x2f7dc4=_0x2f7dc4||0xcc;return function(_0x10a835){if(_0x10a835){return _0x5cf29b[_0x18ad('0x1b')](_0x2f7dc4);}return _0x5cf29b['status'](_0x2f7dc4)[_0x18ad('0x1c')]();};}function respondWithResult(_0x309c86,_0x2e1b0d){_0x2e1b0d=_0x2e1b0d||0xc8;return function(_0x1557ec){if(_0x1557ec){return _0x309c86[_0x18ad('0x1d')](_0x2e1b0d)[_0x18ad('0x1e')](_0x1557ec);}};}function respondWithFilteredResult(_0x2943ea,_0x50b4b9){return function(_0x4e7730){if(_0x4e7730){var _0x596be8=_0x4e7730[_0x18ad('0x1f')],_0x1c4daa=_0x50b4b9[_0x18ad('0x20')],_0x2fc452=_0x50b4b9['offset']+_0x50b4b9['limit'],_0x503127;if(_0x2fc452>=_0x596be8){_0x2fc452=_0x596be8;_0x503127=0xc8;}else{_0x503127=0xce;}_0x2943ea[_0x18ad('0x1d')](_0x503127);return _0x2943ea[_0x18ad('0x21')](_0x18ad('0x22'),_0x1c4daa+'-'+_0x2fc452+'/'+_0x596be8)[_0x18ad('0x1e')](_0x4e7730);}return null;};}function patchUpdates(_0x2aff59){return function(_0x3010c4){try{jsonpatch[_0x18ad('0x23')](_0x3010c4,_0x2aff59,!![]);}catch(_0x5849a7){return BPromise['reject'](_0x5849a7);}return _0x3010c4['save']();};}function saveUpdates(_0x1b11f8,_0x4e3c0f){return function(_0x53135c){if(_0x53135c){return _0x53135c['update'](_0x1b11f8)['then'](function(_0x31f6b0){return _0x31f6b0;});}return null;};}function removeEntity(_0x33e681,_0x3a02fb){return function(_0x5730c4){if(_0x5730c4){return _0x5730c4[_0x18ad('0x24')]()['then'](function(){_0x33e681[_0x18ad('0x1d')](0xcc)[_0x18ad('0x1c')]();});}};}function handleEntityNotFound(_0xd3e2dd,_0x1da919){return function(_0x430ded){if(!_0x430ded){_0xd3e2dd['sendStatus'](0x194);}return _0x430ded;};}function handleError(_0x33bf5a,_0x554923){_0x554923=_0x554923||0x1f4;return function(_0x167d92){logger['error'](_0x167d92['stack']);if(_0x167d92[_0x18ad('0x25')]){delete _0x167d92[_0x18ad('0x25')];}_0x33bf5a[_0x18ad('0x1d')](_0x554923)[_0x18ad('0x26')](_0x167d92);};}exports[_0x18ad('0x27')]=function(_0x2d5e4c,_0x3646b0){var _0x3c8d47={'raw':!![],'where':{'id':_0x2d5e4c['params']['id']}},_0x438c9e={};_0x438c9e['model']=_[_0x18ad('0x28')](db[_0x18ad('0x29')][_0x18ad('0x2a')]);_0x438c9e[_0x18ad('0x2b')]=_['keys'](_0x2d5e4c[_0x18ad('0x2b')]);_0x438c9e[_0x18ad('0x2c')]=_[_0x18ad('0x2d')](_0x438c9e['model'],_0x438c9e[_0x18ad('0x2b')]);_0x3c8d47['attributes']=_[_0x18ad('0x2d')](_0x438c9e[_0x18ad('0x2e')],qs[_0x18ad('0x2f')](_0x2d5e4c[_0x18ad('0x2b')][_0x18ad('0x2f')]));_0x3c8d47[_0x18ad('0x30')]=_0x3c8d47[_0x18ad('0x30')]['length']?_0x3c8d47[_0x18ad('0x30')]:_0x438c9e['model'];if(_0x2d5e4c[_0x18ad('0x2b')][_0x18ad('0x31')]){_0x3c8d47['include']=[{'all':!![]}];}_0x3c8d47=_['merge']({},_0x3c8d47,_0x2d5e4c['options']);return db['ChatProactiveAction']['find'](_0x3c8d47)['then'](handleEntityNotFound(_0x3646b0,null))[_0x18ad('0x32')](respondWithResult(_0x3646b0,null))[_0x18ad('0x33')](handleError(_0x3646b0,null));};exports[_0x18ad('0x34')]=function(_0x35a037,_0x24e61f){return db[_0x18ad('0x29')][_0x18ad('0x34')](_0x35a037[_0x18ad('0x35')],{})[_0x18ad('0x32')](respondWithResult(_0x24e61f,0xc9))[_0x18ad('0x33')](handleError(_0x24e61f,null));};exports['update']=function(_0x334ca1,_0x4a4fd8){if(_0x334ca1[_0x18ad('0x35')]['id']){delete _0x334ca1['body']['id'];}return db[_0x18ad('0x29')][_0x18ad('0x36')]({'where':{'id':_0x334ca1['params']['id']}})['then'](handleEntityNotFound(_0x4a4fd8,null))[_0x18ad('0x32')](saveUpdates(_0x334ca1['body'],null))[_0x18ad('0x32')](respondWithResult(_0x4a4fd8,null))[_0x18ad('0x33')](handleError(_0x4a4fd8,null));};exports[_0x18ad('0x24')]=function(_0x14ab09,_0xe369d5){return db[_0x18ad('0x29')]['find']({'where':{'id':_0x14ab09[_0x18ad('0x37')]['id']}})[_0x18ad('0x32')](handleEntityNotFound(_0xe369d5,null))[_0x18ad('0x32')](removeEntity(_0xe369d5,null))[_0x18ad('0x33')](handleError(_0xe369d5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8d16a73..d6aa4dd 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 _0x1b17=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x2095d0,_0x7f3f86){var _0x4c8775=function(_0x47b5bc){while(--_0x47b5bc){_0x2095d0['push'](_0x2095d0['shift']());}};_0x4c8775(++_0x7f3f86);}(_0x1b17,0x167));var _0x71b1=function(_0x4aa285,_0x1fe00d){_0x4aa285=_0x4aa285-0x0;var _0x2777ee=_0x1b17[_0x4aa285];return _0x2777ee;};'use strict';var _=require(_0x71b1('0x0'));var util=require('util');var logger=require(_0x71b1('0x1'))(_0x71b1('0x2'));var moment=require(_0x71b1('0x3'));var BPromise=require(_0x71b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71b1('0x5'));var rimraf=require(_0x71b1('0x6'));var config=require(_0x71b1('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x71b1('0x8')]=function(_0x436ea2,_0x3f2a99){return _0x436ea2[_0x71b1('0x9')](_0x71b1('0xa'),attributes,{'tableName':_0x71b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2470=['ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x5bb361,_0x1e8d11){var _0x5d3bf4=function(_0x17ddba){while(--_0x17ddba){_0x5bb361['push'](_0x5bb361['shift']());}};_0x5d3bf4(++_0x1e8d11);}(_0x2470,0x1be));var _0x0247=function(_0x44d1a0,_0x4cd6a5){_0x44d1a0=_0x44d1a0-0x0;var _0x42cf68=_0x2470[_0x44d1a0];return _0x42cf68;};'use strict';var _=require(_0x0247('0x0'));var util=require(_0x0247('0x1'));var logger=require('../../config/logger')(_0x0247('0x2'));var moment=require(_0x0247('0x3'));var BPromise=require(_0x0247('0x4'));var rp=require(_0x0247('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0247('0x6'));var attributes=require(_0x0247('0x7'));module[_0x0247('0x8')]=function(_0x3dc574,_0x4b3c09){return _0x3dc574[_0x0247('0x9')](_0x0247('0xa'),attributes,{'tableName':_0x0247('0xb'),'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 1fd6f50..70436e1 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 _0x8910=['stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2fb6cf,_0x2a3ed1){var _0x487e2b=function(_0x10265e){while(--_0x10265e){_0x2fb6cf['push'](_0x2fb6cf['shift']());}};_0x487e2b(++_0x2a3ed1);}(_0x8910,0x13a));var _0x0891=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x8910[_0x246227];return _0x37bd4a;};'use strict';var _=require(_0x0891('0x0'));var util=require(_0x0891('0x1'));var moment=require(_0x0891('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0891('0x3'));var db=require(_0x0891('0x4'))['db'];var utils=require(_0x0891('0x5'));var logger=require('../../config/logger')(_0x0891('0x6'));var config=require(_0x0891('0x7'));var jayson=require(_0x0891('0x8'));var client=jayson[_0x0891('0x9')][_0x0891('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41aeba,_0x3b2a4d,_0x717093){return new BPromise(function(_0x8235dc,_0x2ceee4){return client[_0x0891('0xb')](_0x41aeba,_0x717093)[_0x0891('0xc')](function(_0x196622){logger['info'](_0x0891('0xd'),_0x3b2a4d,_0x0891('0xe'));logger[_0x0891('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3b2a4d,_0x0891('0xe'),JSON[_0x0891('0x10')](_0x196622));if(_0x196622[_0x0891('0x11')]){if(_0x196622[_0x0891('0x11')][_0x0891('0x12')]===0x1f4){logger[_0x0891('0x11')](_0x0891('0xd'),_0x3b2a4d,_0x196622[_0x0891('0x11')][_0x0891('0x13')]);return _0x2ceee4(_0x196622[_0x0891('0x11')][_0x0891('0x13')]);}logger[_0x0891('0x11')](_0x0891('0xd'),_0x3b2a4d,_0x196622['error'][_0x0891('0x13')]);return _0x8235dc(_0x196622[_0x0891('0x11')][_0x0891('0x13')]);}else{logger[_0x0891('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b2a4d,_0x0891('0xe'));_0x8235dc(_0x196622[_0x0891('0x15')][_0x0891('0x13')]);}})['catch'](function(_0x1ddcd9){logger['error'](_0x0891('0xd'),_0x3b2a4d,_0x1ddcd9);_0x2ceee4(_0x1ddcd9);});});} \ No newline at end of file +var _0x066f=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x066f,0x1bd));var _0xf066=function(_0x3a6c68,_0x2b3d5d){_0x3a6c68=_0x3a6c68-0x0;var _0x242806=_0x066f[_0x3a6c68];return _0x242806;};'use strict';var _=require('lodash');var util=require(_0xf066('0x0'));var moment=require(_0xf066('0x1'));var BPromise=require(_0xf066('0x2'));var rs=require(_0xf066('0x3'));var fs=require('fs');var Redis=require(_0xf066('0x4'));var db=require(_0xf066('0x5'))['db'];var utils=require(_0xf066('0x6'));var logger=require(_0xf066('0x7'))(_0xf066('0x8'));var config=require('../../config/environment');var jayson=require(_0xf066('0x9'));var client=jayson[_0xf066('0xa')][_0xf066('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa987,_0x28bd38,_0x4989e9){return new BPromise(function(_0x4a9cac,_0x11b242){return client[_0xf066('0xc')](_0x2fa987,_0x4989e9)[_0xf066('0xd')](function(_0x2c7a6b){logger[_0xf066('0xe')](_0xf066('0xf'),_0x28bd38,_0xf066('0x10'));logger[_0xf066('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x28bd38,_0xf066('0x10'),JSON['stringify'](_0x2c7a6b));if(_0x2c7a6b[_0xf066('0x12')]){if(_0x2c7a6b[_0xf066('0x12')][_0xf066('0x13')]===0x1f4){logger[_0xf066('0x12')](_0xf066('0xf'),_0x28bd38,_0x2c7a6b['error'][_0xf066('0x14')]);return _0x11b242(_0x2c7a6b['error'][_0xf066('0x14')]);}logger[_0xf066('0x12')](_0xf066('0xf'),_0x28bd38,_0x2c7a6b[_0xf066('0x12')]['message']);return _0x4a9cac(_0x2c7a6b[_0xf066('0x12')][_0xf066('0x14')]);}else{logger['info'](_0xf066('0xf'),_0x28bd38,_0xf066('0x10'));_0x4a9cac(_0x2c7a6b[_0xf066('0x15')]['message']);}})[_0xf066('0x16')](function(_0x454641){logger[_0xf066('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x28bd38,_0x454641);_0x11b242(_0x454641);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 6ddb23e..017743c 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 _0x1641=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','path'];(function(_0x10ef0e,_0x5e2c2c){var _0x1a3b12=function(_0x3ac980){while(--_0x3ac980){_0x10ef0e['push'](_0x10ef0e['shift']());}};_0x1a3b12(++_0x5e2c2c);}(_0x1641,0x153));var _0x1164=function(_0xbd00e6,_0x1ea704){_0xbd00e6=_0xbd00e6-0x0;var _0x12a994=_0x1641[_0xbd00e6];return _0x12a994;};'use strict';var multer=require(_0x1164('0x0'));var util=require(_0x1164('0x1'));var path=require(_0x1164('0x2'));var timeout=require('connect-timeout');var express=require(_0x1164('0x3'));var router=express[_0x1164('0x4')]();var auth=require(_0x1164('0x5'));var interaction=require(_0x1164('0x6'));var config=require(_0x1164('0x7'));var controller=require(_0x1164('0x8'));router[_0x1164('0x9')](_0x1164('0xa'),auth[_0x1164('0xb')](),controller[_0x1164('0xc')]);router[_0x1164('0xd')]('/',auth[_0x1164('0xb')](),controller[_0x1164('0xe')]);router[_0x1164('0xf')](_0x1164('0xa'),auth[_0x1164('0xb')](),controller[_0x1164('0x10')]);router['delete'](_0x1164('0xa'),auth[_0x1164('0xb')](),controller[_0x1164('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe9a6=['./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xe9a6,0x64));var _0x6e9a=function(_0xa26904,_0x1a7097){_0xa26904=_0xa26904-0x0;var _0x591a6a=_0xe9a6[_0xa26904];return _0x591a6a;};'use strict';var multer=require(_0x6e9a('0x0'));var util=require('util');var path=require(_0x6e9a('0x1'));var timeout=require(_0x6e9a('0x2'));var express=require(_0x6e9a('0x3'));var router=express[_0x6e9a('0x4')]();var auth=require(_0x6e9a('0x5'));var interaction=require(_0x6e9a('0x6'));var config=require(_0x6e9a('0x7'));var controller=require(_0x6e9a('0x8'));router['get']('/:id',auth[_0x6e9a('0x9')](),controller[_0x6e9a('0xa')]);router[_0x6e9a('0xb')]('/',auth['isAuthenticated'](),controller[_0x6e9a('0xc')]);router[_0x6e9a('0xd')](_0x6e9a('0xe'),auth[_0x6e9a('0x9')](),controller[_0x6e9a('0xf')]);router['delete']('/:id',auth[_0x6e9a('0x9')](),controller[_0x6e9a('0x10')]);module[_0x6e9a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index bf61109..441ff66 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 _0x644a=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x55c1bf,_0x52e7cd){var _0x19b162=function(_0x37a5a8){while(--_0x37a5a8){_0x55c1bf['push'](_0x55c1bf['shift']());}};_0x19b162(++_0x52e7cd);}(_0x644a,0xd8));var _0xa644=function(_0x51af96,_0x42104c){_0x51af96=_0x51af96-0x0;var _0x2bb16b=_0x644a[_0x51af96];return _0x2bb16b;};'use strict';var Sequelize=require(_0xa644('0x0'));module['exports']={'name':{'type':Sequelize[_0xa644('0x1')],'unique':_0xa644('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa644('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa644('0x4')](_0xa644('0x5'),_0xa644('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x09fc=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x45d8eb,_0x3e0482){var _0x553a30=function(_0x14733c){while(--_0x14733c){_0x45d8eb['push'](_0x45d8eb['shift']());}};_0x553a30(++_0x3e0482);}(_0x09fc,0x1d1));var _0xc09f=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x09fc[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0xc09f('0x0'));module[_0xc09f('0x1')]={'name':{'type':Sequelize[_0xc09f('0x2')],'unique':_0xc09f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc09f('0x2')]},'timeout':{'type':Sequelize[_0xc09f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc09f('0x5')](_0xc09f('0x6'),_0xc09f('0x7'),_0xc09f('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 259e2ed..c3d16cb 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 _0xbf7e=['team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','ChatQueues','name','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','pick','ChatQueueId','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','interface','flatMap','Agents','sequelize','addTeams','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from'];(function(_0x15f852,_0x530d85){var _0x387460=function(_0x4aa3df){while(--_0x4aa3df){_0x15f852['push'](_0x15f852['shift']());}};_0x387460(++_0x530d85);}(_0xbf7e,0xb0));var _0xebf7=function(_0x2de30b,_0x450092){_0x2de30b=_0x2de30b-0x0;var _0x1c3e78=_0xbf7e[_0x2de30b];return _0x1c3e78;};'use strict';var pdf=require(_0xebf7('0x0'));var emlformat=require(_0xebf7('0x1'));var rimraf=require(_0xebf7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebf7('0x3'));var rp=require(_0xebf7('0x4'));var moment=require('moment');var BPromise=require(_0xebf7('0x5'));var Mustache=require(_0xebf7('0x6'));var util=require(_0xebf7('0x7'));var path=require(_0xebf7('0x8'));var sox=require(_0xebf7('0x9'));var csv=require(_0xebf7('0xa'));var ejs=require(_0xebf7('0xb'));var fs=require('fs');var _=require(_0xebf7('0xc'));var squel=require(_0xebf7('0xd'));var crypto=require(_0xebf7('0xe'));var jsforce=require(_0xebf7('0xf'));var deskjs=require(_0xebf7('0x10'));var toCsv=require(_0xebf7('0xa'));var querystring=require(_0xebf7('0x11'));var Papa=require('papaparse');var Redis=require(_0xebf7('0x12'));var authService=require(_0xebf7('0x13'));var qs=require(_0xebf7('0x14'));var as=require(_0xebf7('0x15'));var hardwareService=require(_0xebf7('0x16'));var logger=require('../../config/logger')(_0xebf7('0x17'));var utils=require(_0xebf7('0x18'));var config=require(_0xebf7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf7('0x1a'))['db'];config[_0xebf7('0x1b')]=_[_0xebf7('0x1c')](config[_0xebf7('0x1b')],{'host':_0xebf7('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xebf7('0x1e'))[_0xebf7('0x1f')](socket);var jayson=require(_0xebf7('0x20'));var client=jayson[_0xebf7('0x21')][_0xebf7('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x244bcf,_0x2ffdcf,_0x2deaba,_0x5af253){return new BPromise(function(_0x4ee11e,_0x288597){var _0x24690b=_0x5af253||client;return _0x24690b[_0xebf7('0x23')](_0x244bcf,_0x2deaba)[_0xebf7('0x24')](function(_0x14d192){logger[_0xebf7('0x25')](_0xebf7('0x26'),_0x2ffdcf,_0xebf7('0x27'));logger[_0xebf7('0x28')](_0xebf7('0x29'),_0x2ffdcf,_0xebf7('0x27'),JSON['stringify'](_0x14d192));if(_0x14d192[_0xebf7('0x2a')]){if(_0x14d192[_0xebf7('0x2a')]['code']===0x1f4){logger[_0xebf7('0x2a')](_0xebf7('0x26'),_0x2ffdcf,_0x14d192[_0xebf7('0x2a')][_0xebf7('0x2b')]);return _0x288597(_0x14d192['error'][_0xebf7('0x2b')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2ffdcf,_0x14d192[_0xebf7('0x2a')][_0xebf7('0x2b')]);return _0x4ee11e(_0x14d192['error']['message']);}else{logger[_0xebf7('0x25')](_0xebf7('0x26'),_0x2ffdcf,_0xebf7('0x27'));_0x4ee11e(_0x14d192[_0xebf7('0x2c')][_0xebf7('0x2b')]);}})[_0xebf7('0x2d')](function(_0x50eb19){logger[_0xebf7('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x2ffdcf,_0x50eb19);_0x288597(_0x50eb19);});});}function respondWithStatusCode(_0x22cbf0,_0x226ebc){_0x226ebc=_0x226ebc||0xcc;return function(_0x532665){if(_0x532665){return _0x22cbf0['sendStatus'](_0x226ebc);}return _0x22cbf0[_0xebf7('0x2e')](_0x226ebc)[_0xebf7('0x2f')]();};}function respondWithResult(_0x1fd59a,_0x1c495a){_0x1c495a=_0x1c495a||0xc8;return function(_0x223fe3){if(_0x223fe3){return _0x1fd59a[_0xebf7('0x2e')](_0x1c495a)[_0xebf7('0x30')](_0x223fe3);}};}function respondWithFilteredResult(_0x2fbdde,_0xb06026){return function(_0x51a4ce){if(_0x51a4ce){var _0x3f7283=_0x51a4ce[_0xebf7('0x31')],_0x1afd51=_0xb06026[_0xebf7('0x32')],_0x3dc2aa=_0xb06026[_0xebf7('0x32')]+_0xb06026[_0xebf7('0x33')],_0x1718b5;if(_0x3dc2aa>=_0x3f7283){_0x3dc2aa=_0x3f7283;_0x1718b5=0xc8;}else{_0x1718b5=0xce;}_0x2fbdde[_0xebf7('0x2e')](_0x1718b5);return _0x2fbdde[_0xebf7('0x34')](_0xebf7('0x35'),_0x1afd51+'-'+_0x3dc2aa+'/'+_0x3f7283)[_0xebf7('0x30')](_0x51a4ce);}return null;};}function patchUpdates(_0x5b335c){return function(_0x479ec6){try{jsonpatch[_0xebf7('0x36')](_0x479ec6,_0x5b335c,!![]);}catch(_0x5b205f){return BPromise[_0xebf7('0x37')](_0x5b205f);}return _0x479ec6['save']();};}function saveUpdates(_0x4f04be,_0x41648d){return function(_0xc246bb){if(_0xc246bb){return _0xc246bb[_0xebf7('0x38')](_0x4f04be)[_0xebf7('0x24')](function(_0x1c94b1){return _0x1c94b1;});}return null;};}function removeEntity(_0x19f277,_0x34f7a8){return function(_0x40e176){if(_0x40e176){return _0x40e176[_0xebf7('0x39')]()['then'](function(){var _0x5ca514=_0x40e176[_0xebf7('0x3a')]({'plain':!![]});var _0x5567d5=_0xebf7('0x3b');return db['UserProfileResource']['destroy']({'where':{'type':_0x5567d5,'resourceId':_0x5ca514['id']}})[_0xebf7('0x24')](function(){return _0x40e176;});})[_0xebf7('0x24')](function(){_0x19f277['status'](0xcc)[_0xebf7('0x2f')]();});}};}function handleEntityNotFound(_0x387ed7,_0x1878ac){return function(_0x59b24c){if(!_0x59b24c){_0x387ed7['sendStatus'](0x194);}return _0x59b24c;};}function handleError(_0x38fc7a,_0xd3b1ea){_0xd3b1ea=_0xd3b1ea||0x1f4;return function(_0x12343a){logger[_0xebf7('0x2a')](_0x12343a['stack']);if(_0x12343a[_0xebf7('0x3c')]){delete _0x12343a['name'];}_0x38fc7a['status'](_0xd3b1ea)['send'](_0x12343a);};}exports[_0xebf7('0x3d')]=function(_0x51951c,_0x1bd6fb){var _0x4fbd5d={},_0x1feaa0={},_0x2c3a4c={'count':0x0,'rows':[]};var _0x4cfce0=_[_0xebf7('0x3e')](db[_0xebf7('0x3f')][_0xebf7('0x40')],function(_0x219deb){return{'name':_0x219deb[_0xebf7('0x41')],'type':_0x219deb['type'][_0xebf7('0x42')]};});_0x1feaa0[_0xebf7('0x43')]=_[_0xebf7('0x3e')](_0x4cfce0,_0xebf7('0x3c'));_0x1feaa0[_0xebf7('0x44')]=_['keys'](_0x51951c[_0xebf7('0x44')]);_0x1feaa0[_0xebf7('0x45')]=_[_0xebf7('0x46')](_0x1feaa0[_0xebf7('0x43')],_0x1feaa0[_0xebf7('0x44')]);_0x4fbd5d['attributes']=_[_0xebf7('0x46')](_0x1feaa0['model'],qs[_0xebf7('0x47')](_0x51951c['query']['fields']));_0x4fbd5d[_0xebf7('0x48')]=_0x4fbd5d[_0xebf7('0x48')][_0xebf7('0x49')]?_0x4fbd5d[_0xebf7('0x48')]:_0x1feaa0['model'];if(!_0x51951c[_0xebf7('0x44')]['hasOwnProperty']('nolimit')){_0x4fbd5d['limit']=qs[_0xebf7('0x33')](_0x51951c[_0xebf7('0x44')][_0xebf7('0x33')]);_0x4fbd5d['offset']=qs['offset'](_0x51951c['query'][_0xebf7('0x32')]);}_0x4fbd5d[_0xebf7('0x4a')]=qs[_0xebf7('0x4b')](_0x51951c[_0xebf7('0x44')][_0xebf7('0x4b')]);_0x4fbd5d[_0xebf7('0x4c')]=qs[_0xebf7('0x45')](_['pick'](_0x51951c[_0xebf7('0x44')],_0x1feaa0[_0xebf7('0x45')]),_0x4cfce0);if(_0x51951c['query'][_0xebf7('0x4d')]){_0x4fbd5d[_0xebf7('0x4c')]=_[_0xebf7('0x4e')](_0x4fbd5d[_0xebf7('0x4c')],{'$or':_[_0xebf7('0x3e')](_0x4cfce0,function(_0x22c21c){if(_0x22c21c['type']!==_0xebf7('0x4f')){var _0x5d3e77={};_0x5d3e77[_0x22c21c[_0xebf7('0x3c')]]={'$like':'%'+_0x51951c['query'][_0xebf7('0x4d')]+'%'};return _0x5d3e77;}})});}_0x4fbd5d=_[_0xebf7('0x4e')]({},_0x4fbd5d,_0x51951c[_0xebf7('0x50')]);var _0x555a5d={'where':_0x4fbd5d[_0xebf7('0x4c')]};return db['ChatQueue'][_0xebf7('0x31')](_0x555a5d)[_0xebf7('0x24')](function(_0xf35ed5){_0x2c3a4c[_0xebf7('0x31')]=_0xf35ed5;if(_0x51951c[_0xebf7('0x44')][_0xebf7('0x51')]){_0x4fbd5d['include']=[{'all':!![]}];}return db[_0xebf7('0x3f')][_0xebf7('0x52')](_0x4fbd5d);})['then'](function(_0x2ce3d0){_0x2c3a4c[_0xebf7('0x53')]=_0x2ce3d0;return _0x2c3a4c;})['then'](respondWithFilteredResult(_0x1bd6fb,_0x4fbd5d))[_0xebf7('0x2d')](handleError(_0x1bd6fb,null));};exports[_0xebf7('0x54')]=function(_0x25108a,_0x58318b){var _0x5f21e2={'raw':!![],'where':{'id':_0x25108a[_0xebf7('0x55')]['id']}},_0x9fc058={};_0x9fc058[_0xebf7('0x43')]=_[_0xebf7('0x56')](db[_0xebf7('0x3f')][_0xebf7('0x40')]);_0x9fc058[_0xebf7('0x44')]=_['keys'](_0x25108a[_0xebf7('0x44')]);_0x9fc058['filters']=_[_0xebf7('0x46')](_0x9fc058[_0xebf7('0x43')],_0x9fc058['query']);_0x5f21e2[_0xebf7('0x48')]=_[_0xebf7('0x46')](_0x9fc058['model'],qs['fields'](_0x25108a['query'][_0xebf7('0x47')]));_0x5f21e2[_0xebf7('0x48')]=_0x5f21e2[_0xebf7('0x48')][_0xebf7('0x49')]?_0x5f21e2['attributes']:_0x9fc058[_0xebf7('0x43')];if(_0x25108a[_0xebf7('0x44')][_0xebf7('0x51')]){_0x5f21e2[_0xebf7('0x57')]=[{'all':!![]}];}_0x5f21e2=_['merge']({},_0x5f21e2,_0x25108a[_0xebf7('0x50')]);return db[_0xebf7('0x3f')][_0xebf7('0x58')](_0x5f21e2)[_0xebf7('0x24')](handleEntityNotFound(_0x58318b,null))[_0xebf7('0x24')](respondWithResult(_0x58318b,null))[_0xebf7('0x2d')](handleError(_0x58318b,null));};exports[_0xebf7('0x59')]=function(_0xe810d8,_0x3099c1){return db[_0xebf7('0x3f')][_0xebf7('0x59')](_0xe810d8[_0xebf7('0x5a')],{})[_0xebf7('0x24')](function(_0x19170a){var _0x5ee7a7=_0xe810d8[_0xebf7('0x5b')]['get']({'plain':!![]});if(!_0x5ee7a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ee7a7[_0xebf7('0x5c')]==='user'){var _0x40d50e=_0x19170a[_0xebf7('0x3a')]({'plain':!![]});var _0x2579c7=_0xebf7('0x3b');return db[_0xebf7('0x5d')][_0xebf7('0x58')]({'where':{'name':_0x2579c7,'userProfileId':_0x5ee7a7[_0xebf7('0x5e')]},'raw':!![]})['then'](function(_0x158196){if(_0x158196&&_0x158196[_0xebf7('0x5f')]===0x0){return db[_0xebf7('0x60')][_0xebf7('0x59')]({'name':_0x40d50e[_0xebf7('0x3c')],'resourceId':_0x40d50e['id'],'type':_0x158196[_0xebf7('0x3c')],'sectionId':_0x158196['id']},{})[_0xebf7('0x24')](function(){return _0x19170a;});}else{return _0x19170a;}})[_0xebf7('0x2d')](function(_0x56ff9d){logger['error'](_0xebf7('0x61'),_0x56ff9d);throw _0x56ff9d;});}return _0x19170a;})[_0xebf7('0x24')](respondWithResult(_0x3099c1,0xc9))['catch'](handleError(_0x3099c1,null));};exports[_0xebf7('0x38')]=function(_0x12ff4b,_0x18b070){if(_0x12ff4b['body']['id']){delete _0x12ff4b[_0xebf7('0x5a')]['id'];}return db['ChatQueue'][_0xebf7('0x58')]({'where':{'id':_0x12ff4b[_0xebf7('0x55')]['id']}})[_0xebf7('0x24')](handleEntityNotFound(_0x18b070,null))[_0xebf7('0x24')](saveUpdates(_0x12ff4b['body'],null))[_0xebf7('0x24')](respondWithResult(_0x18b070,null))[_0xebf7('0x2d')](handleError(_0x18b070,null));};exports[_0xebf7('0x39')]=function(_0x59fe82,_0x1bfa5e){return db[_0xebf7('0x3f')][_0xebf7('0x58')]({'where':{'id':_0x59fe82[_0xebf7('0x55')]['id']}})['then'](handleEntityNotFound(_0x1bfa5e,null))[_0xebf7('0x24')](removeEntity(_0x1bfa5e,null))[_0xebf7('0x2d')](handleError(_0x1bfa5e,null));};exports['describe']=function(_0x2e93d6,_0x358f83){return db[_0xebf7('0x3f')]['describe']()[_0xebf7('0x24')](respondWithResult(_0x358f83,null))[_0xebf7('0x2d')](handleError(_0x358f83,null));};exports[_0xebf7('0x62')]=function(_0x28254d,_0x480d61,_0x1877ee){var _0x382380={'raw':!![],'where':{}},_0x15d548={},_0x313fe1;return db[_0xebf7('0x3f')][_0xebf7('0x63')]({'where':{'id':_0x28254d[_0xebf7('0x55')]['id']}})['then'](handleEntityNotFound(_0x480d61,null))[_0xebf7('0x24')](function(_0x558ea7){if(_0x558ea7){_0x313fe1=_0x558ea7['get']({'plain':!![]});_0x15d548['model']=_['keys'](db[_0xebf7('0x64')][_0xebf7('0x40')]);_0x15d548[_0xebf7('0x44')]=_[_0xebf7('0x56')](_0x28254d[_0xebf7('0x44')]);_0x15d548[_0xebf7('0x45')]=_['intersection'](_0x15d548['model'],_0x15d548['query']);_0x382380[_0xebf7('0x48')]=_[_0xebf7('0x46')](_0x15d548[_0xebf7('0x43')],qs[_0xebf7('0x47')](_0x28254d[_0xebf7('0x44')][_0xebf7('0x47')]));_0x382380[_0xebf7('0x48')]=_0x382380[_0xebf7('0x48')][_0xebf7('0x49')]?_0x382380['attributes']:_0x15d548['model'];if(!_0x28254d[_0xebf7('0x44')][_0xebf7('0x65')](_0xebf7('0x66'))){_0x382380['limit']=qs[_0xebf7('0x33')](_0x28254d[_0xebf7('0x44')][_0xebf7('0x33')]);_0x382380[_0xebf7('0x32')]=qs[_0xebf7('0x32')](_0x28254d[_0xebf7('0x44')]['offset']);}_0x382380['order']=qs[_0xebf7('0x4b')](_0x28254d['query']['sort']);_0x382380[_0xebf7('0x4c')]=qs['filters'](_[_0xebf7('0x67')](_0x28254d[_0xebf7('0x44')],_0x15d548[_0xebf7('0x45')]));_0x382380[_0xebf7('0x4c')][_0xebf7('0x68')]=_0x558ea7['id'];if(_0x28254d[_0xebf7('0x44')][_0xebf7('0x4d')]){_0x382380[_0xebf7('0x4c')]=_[_0xebf7('0x4e')](_0x382380[_0xebf7('0x4c')],{'$or':_[_0xebf7('0x3e')](_0x382380[_0xebf7('0x48')],function(_0x3da04a){var _0x224b20={};_0x224b20[_0x3da04a]={'$like':'%'+_0x28254d[_0xebf7('0x44')][_0xebf7('0x4d')]+'%'};return _0x224b20;})});}_0x382380=_[_0xebf7('0x4e')]({},_0x382380,_0x28254d[_0xebf7('0x50')]);return db['UserChatQueue'][_0xebf7('0x52')](_0x382380);}})['then'](function(_0x42f171){if(_0x42f171){return db[_0xebf7('0x69')]['findAndCountAll']({'where':{'id':_[_0xebf7('0x3e')](_0x42f171,_0xebf7('0x6a')),'role':_0xebf7('0x6b')},'attributes':['id',_0xebf7('0x3c'),_0xebf7('0x6c'),_0xebf7('0x6d'),_0xebf7('0x6e')]});}})['then'](function(_0x4955e8){if(_0x4955e8){return{'count':_0x4955e8[_0xebf7('0x31')],'rows':_[_0xebf7('0x3e')](_0x4955e8[_0xebf7('0x53')],function(_0x295eb8){return{'membername':_0x295eb8['name'],'UserId':_0x295eb8['id'],'queue_name':_0x313fe1[_0xebf7('0x3c')],'ChatQueueId':_0x313fe1['id'],'interface':util[_0xebf7('0x6f')](_0xebf7('0x70'),_0xebf7('0x71'),_0x295eb8[_0xebf7('0x3c')]),'penalty':0x0,'paused':_0x295eb8['chatPause'],'createdAt':_0x295eb8[_0xebf7('0x6e')],'updatedAt':_0x295eb8[_0xebf7('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x480d61,_0x382380))[_0xebf7('0x2d')](handleError(_0x480d61,null));};exports[_0xebf7('0x72')]=function(_0x50d58b,_0xf32601,_0x4ee52d){var _0xda96ae={};var _0x4610f3={};var _0x1ee2da;var _0x164a13;return db['ChatQueue']['findOne']({'where':{'id':_0x50d58b[_0xebf7('0x55')]['id']}})[_0xebf7('0x24')](handleEntityNotFound(_0xf32601,null))[_0xebf7('0x24')](function(_0x24180a){if(_0x24180a){_0x1ee2da=_0x24180a;_0x4610f3['model']=_[_0xebf7('0x56')](db[_0xebf7('0x73')][_0xebf7('0x40')]);_0x4610f3[_0xebf7('0x44')]=_[_0xebf7('0x56')](_0x50d58b[_0xebf7('0x44')]);_0x4610f3['filters']=_[_0xebf7('0x46')](_0x4610f3['model'],_0x4610f3['query']);_0xda96ae['attributes']=_[_0xebf7('0x46')](_0x4610f3['model'],qs[_0xebf7('0x47')](_0x50d58b['query'][_0xebf7('0x47')]));_0xda96ae['attributes']=_0xda96ae['attributes'][_0xebf7('0x49')]?_0xda96ae[_0xebf7('0x48')]:_0x4610f3[_0xebf7('0x43')];_0xda96ae['order']=qs['sort'](_0x50d58b[_0xebf7('0x44')][_0xebf7('0x4b')]);_0xda96ae[_0xebf7('0x4c')]=qs[_0xebf7('0x45')](_[_0xebf7('0x67')](_0x50d58b[_0xebf7('0x44')],_0x4610f3['filters']));if(_0x50d58b['query'][_0xebf7('0x4d')]){_0xda96ae[_0xebf7('0x4c')]=_[_0xebf7('0x4e')](_0xda96ae[_0xebf7('0x4c')],{'$or':_[_0xebf7('0x3e')](_0xda96ae[_0xebf7('0x48')],function(_0x16ed25){var _0x1d0572={};_0x1d0572[_0x16ed25]={'$like':'%'+_0x50d58b[_0xebf7('0x44')][_0xebf7('0x4d')]+'%'};return _0x1d0572;})});}_0xda96ae=_[_0xebf7('0x4e')]({},_0xda96ae,_0x50d58b['options']);return _0x1ee2da[_0xebf7('0x72')](_0xda96ae);}})['then'](function(_0x10e793){if(_0x10e793){_0x164a13=_0x10e793[_0xebf7('0x49')];if(!_0x50d58b[_0xebf7('0x44')][_0xebf7('0x65')](_0xebf7('0x66'))){_0xda96ae[_0xebf7('0x33')]=qs[_0xebf7('0x33')](_0x50d58b['query']['limit']);_0xda96ae[_0xebf7('0x32')]=qs[_0xebf7('0x32')](_0x50d58b[_0xebf7('0x44')][_0xebf7('0x32')]);}return _0x1ee2da['getTeams'](_0xda96ae);}})[_0xebf7('0x24')](function(_0x4c8d44){if(_0x4c8d44){return _0x4c8d44?{'count':_0x164a13,'rows':_0x4c8d44}:null;}})[_0xebf7('0x24')](respondWithResult(_0xf32601,null))[_0xebf7('0x2d')](handleError(_0xf32601,null));};exports['addTeams']=function(_0x21c346,_0x43d930,_0x2cd661){var _0x1a31de=_0x21c346[_0xebf7('0x5a')][_0xebf7('0x74')];return db['Team'][_0xebf7('0x52')]({'where':{'id':_0x1a31de},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xebf7('0x3c'),'online','voicePause',_0xebf7('0x75')],'raw':!![]}]})[_0xebf7('0x24')](function(_0x4a888d){if(_0x4a888d){var _0x31e01c=_[_0xebf7('0x76')](_0x4a888d,function(_0x95d6a1){var _0x121079=_0x95d6a1[_0xebf7('0x3a')]({'plain':!![]});return _0x121079[_0xebf7('0x77')];});return db[_0xebf7('0x3f')][_0xebf7('0x58')]({'where':{'id':_0x21c346[_0xebf7('0x55')]['id']}})[_0xebf7('0x24')](function(_0x3db872){return db[_0xebf7('0x78')]['transaction'](function(_0x503e25){return _0x3db872[_0xebf7('0x79')](_0x1a31de,{'transaction':_0x503e25})[_0xebf7('0x24')](function(){return BPromise['each'](_0x31e01c,function(_0x1b327a){return db['UserChatQueue'][_0xebf7('0x7a')]({'where':{'UserId':_0x1b327a['id'],'ChatQueueId':_0x21c346['params']['id']},'transaction':_0x503e25});});})['then'](function(){_0x31e01c[_0xebf7('0x7b')](function(_0x3f0e2b){socket[_0xebf7('0x7c')](_0xebf7('0x7d'),{'UserId':_0x3f0e2b['id'],'ChatQueueId':_0x3db872['id']});});});});});}})[_0xebf7('0x24')](respondWithStatusCode(_0x43d930,null))[_0xebf7('0x2d')](handleError(_0x43d930,null));};exports[_0xebf7('0x7e')]=function(_0x32afb7,_0x1829fd,_0x440b4d){return db[_0xebf7('0x73')][_0xebf7('0x52')]({'where':{'id':_0x32afb7['query'][_0xebf7('0x74')]},'attributes':['id'],'include':[{'model':db[_0xebf7('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xebf7('0x24')](handleEntityNotFound(_0x1829fd,null))[_0xebf7('0x24')](function(_0x220033){var _0x108dce=_['map'](_0x220033,'id');var _0x462b32=[];var _0x1841b4=[];var _0xc33411=squel['select']();_0xc33411[_0xebf7('0x7f')](_0xebf7('0x80'))[_0xebf7('0x81')](_0xebf7('0x82'),'tq')[_0xebf7('0x83')](_0xebf7('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xebf7('0x4c')]('ChatQueueId\x20=\x20?',_0x32afb7[_0xebf7('0x55')]['id']);for(var _0x1ce259=0x0;_0x1ce259<_0x220033[_0xebf7('0x49')];_0x1ce259+=0x1){let _0x2f6167=_0x220033[_0x1ce259];for(var _0x3f2263=0x0;_0x3f2263<_0x2f6167['Agents']['length'];_0x3f2263+=0x1){let _0x62214f=_0x2f6167[_0xebf7('0x77')][_0x3f2263];var _0x5d205e=_0xc33411[_0xebf7('0x85')]();_0x5d205e[_0xebf7('0x4c')](_0xebf7('0x86'),_0x62214f['id']);_0x1841b4[_0xebf7('0x87')](db[_0xebf7('0x78')][_0xebf7('0x44')](_0x5d205e['toString'](),{'type':db[_0xebf7('0x78')]['QueryTypes'][_0xebf7('0x88')]})['then'](function(_0x1b9fba){if(_0x1b9fba[_0xebf7('0x49')]===0x1){return _0x62214f['id'];}else{var _0x210b3d=_[_0xebf7('0x89')](_[_0xebf7('0x3e')](_0x1b9fba,_0xebf7('0x8a')),function(_0x1201e0){return _[_0xebf7('0x8b')](_0x108dce,_0x1201e0);});if(_0x210b3d){return _0x62214f['id'];}}}));}}return BPromise[_0xebf7('0x8c')](_0x1841b4)[_0xebf7('0x24')](function(_0x2e9551){_0x462b32=_(_0x462b32)[_0xebf7('0x8d')](_0x2e9551)[_0xebf7('0x8e')]()[_0xebf7('0x8f')]();return db[_0xebf7('0x3f')][_0xebf7('0x58')]({'where':{'id':_0x32afb7[_0xebf7('0x55')]['id']}})[_0xebf7('0x24')](function(_0x2b3d8a){return db[_0xebf7('0x78')][_0xebf7('0x90')](function(_0x824998){return _0x2b3d8a[_0xebf7('0x7e')](_0x32afb7[_0xebf7('0x44')][_0xebf7('0x74')],{'transaction':_0x824998})[_0xebf7('0x24')](function(){if(!_[_0xebf7('0x91')](_0x462b32)){return _0x2b3d8a['removeAgents'](_0x462b32,{'transaction':_0x824998});}})['then'](function(){_0x462b32[_0xebf7('0x7b')](function(_0x3b9788){socket['emit']('userChatQueue:remove',{'UserId':_0x3b9788,'ChatQueueId':_0x2b3d8a['id']});});});});});});})[_0xebf7('0x24')](respondWithStatusCode(_0x1829fd,null))[_0xebf7('0x2d')](handleError(_0x1829fd,null));};exports[_0xebf7('0x92')]=function(_0x2a4bf3,_0x27d829,_0x5c5c84){return db[_0xebf7('0x3f')][_0xebf7('0x58')]({'where':{'id':_0x2a4bf3[_0xebf7('0x55')]['id']}})[_0xebf7('0x24')](handleEntityNotFound(_0x27d829,null))['then'](function(_0x1f4d84){if(_0x1f4d84){return _0x1f4d84['addAgents'](_0x2a4bf3[_0xebf7('0x5a')][_0xebf7('0x74')],_[_0xebf7('0x93')](_0x2a4bf3[_0xebf7('0x5a')],[_0xebf7('0x74'),'id'])||{})[_0xebf7('0x94')](function(_0x15d71e){for(var _0x56dbb9=0x0;_0x56dbb9<_0x2a4bf3[_0xebf7('0x5a')][_0xebf7('0x74')][_0xebf7('0x49')];_0x56dbb9+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x2a4bf3[_0xebf7('0x5a')]['ids'][_0x56dbb9],'ChatQueueId':_0x2a4bf3['params']['id']});}return _0x15d71e;});}})['then'](respondWithResult(_0x27d829,null))['catch'](handleError(_0x27d829,null));};exports[_0xebf7('0x95')]=function(_0x36385f,_0x415937,_0x366b5b){return db[_0xebf7('0x3f')][_0xebf7('0x58')]({'where':{'id':_0x36385f[_0xebf7('0x55')]['id']}})[_0xebf7('0x24')](handleEntityNotFound(_0x415937,null))[_0xebf7('0x24')](function(_0x39b6f1){if(_0x39b6f1){return _0x39b6f1[_0xebf7('0x95')](_0x36385f[_0xebf7('0x44')][_0xebf7('0x74')])[_0xebf7('0x24')](function(){if(_[_0xebf7('0x96')](_0x36385f[_0xebf7('0x44')][_0xebf7('0x74')])){for(var _0x14e2e6=0x0;_0x14e2e6<_0x36385f['query'][_0xebf7('0x74')]['length'];_0x14e2e6+=0x1){socket[_0xebf7('0x7c')](_0xebf7('0x97'),{'UserId':Number(_0x36385f['query']['ids'][_0x14e2e6]),'ChatQueueId':Number(_0x36385f[_0xebf7('0x55')]['id'])});}}else{socket[_0xebf7('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x36385f[_0xebf7('0x44')]['ids']),'ChatQueueId':Number(_0x36385f['params']['id'])});}});}})[_0xebf7('0x24')](respondWithStatusCode(_0x415937,null))[_0xebf7('0x2d')](handleError(_0x415937,null));};exports[_0xebf7('0x98')]=function(_0x37b7d7,_0x2c6c2e,_0x529a26){var _0xa434af={};var _0x2caa82={};var _0xaf6244;var _0x2e987f;return db[_0xebf7('0x3f')]['findOne']({'where':{'id':_0x37b7d7[_0xebf7('0x55')]['id']}})[_0xebf7('0x24')](handleEntityNotFound(_0x2c6c2e,null))[_0xebf7('0x24')](function(_0x5b4554){if(_0x5b4554){_0xaf6244=_0x5b4554;_0x2caa82[_0xebf7('0x43')]=_['keys'](db[_0xebf7('0x69')][_0xebf7('0x40')]);_0x2caa82['query']=_[_0xebf7('0x56')](_0x37b7d7['query']);_0x2caa82[_0xebf7('0x45')]=_['intersection'](_0x2caa82[_0xebf7('0x43')],_0x2caa82[_0xebf7('0x44')]);_0xa434af['attributes']=_[_0xebf7('0x46')](_0x2caa82['model'],qs[_0xebf7('0x47')](_0x37b7d7[_0xebf7('0x44')][_0xebf7('0x47')]));_0xa434af[_0xebf7('0x48')]=_0xa434af['attributes']['length']?_0xa434af[_0xebf7('0x48')]:_0x2caa82[_0xebf7('0x43')];_0xa434af[_0xebf7('0x4a')]=qs[_0xebf7('0x4b')](_0x37b7d7[_0xebf7('0x44')][_0xebf7('0x4b')]);_0xa434af['where']=qs[_0xebf7('0x45')](_['pick'](_0x37b7d7[_0xebf7('0x44')],_0x2caa82[_0xebf7('0x45')]));if(_0x37b7d7[_0xebf7('0x44')][_0xebf7('0x4d')]){_0xa434af['where']=_[_0xebf7('0x4e')](_0xa434af['where'],{'$or':_[_0xebf7('0x3e')](_0xa434af[_0xebf7('0x48')],function(_0x5740f3){var _0x4452ba={};_0x4452ba[_0x5740f3]={'$like':'%'+_0x37b7d7[_0xebf7('0x44')][_0xebf7('0x4d')]+'%'};return _0x4452ba;})});}_0xa434af=_[_0xebf7('0x4e')]({},_0xa434af,_0x37b7d7['options']);return _0xaf6244[_0xebf7('0x98')](_0xa434af);}})[_0xebf7('0x24')](function(_0x2e0cc0){if(_0x2e0cc0){_0x2e987f=_0x2e0cc0[_0xebf7('0x49')];if(!_0x37b7d7['query'][_0xebf7('0x65')](_0xebf7('0x66'))){_0xa434af[_0xebf7('0x33')]=qs['limit'](_0x37b7d7[_0xebf7('0x44')]['limit']);_0xa434af['offset']=qs[_0xebf7('0x32')](_0x37b7d7[_0xebf7('0x44')]['offset']);}return _0xaf6244[_0xebf7('0x98')](_0xa434af);}})[_0xebf7('0x24')](function(_0xc76f19){if(_0xc76f19){return _0xc76f19?{'count':_0x2e987f,'rows':_0xc76f19}:null;}})[_0xebf7('0x24')](respondWithResult(_0x2c6c2e,null))[_0xebf7('0x2d')](handleError(_0x2c6c2e,null));}; \ No newline at end of file +var _0x7e80=['query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','ChatQueueId','agent','chatPause','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','UserChatQueue','findOrCreate','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','ChatQueue','fieldName','type','key','model','filters','intersection'];(function(_0x248be3,_0x203e1f){var _0x255f8f=function(_0x5449f5){while(--_0x5449f5){_0x248be3['push'](_0x248be3['shift']());}};_0x255f8f(++_0x203e1f);}(_0x7e80,0x183));var _0x07e8=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0x7e80[_0x58de4a];return _0x178820;};'use strict';var pdf=require(_0x07e8('0x0'));var emlformat=require(_0x07e8('0x1'));var rimraf=require(_0x07e8('0x2'));var zipdir=require(_0x07e8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x07e8('0x4'));var BPromise=require(_0x07e8('0x5'));var Mustache=require(_0x07e8('0x6'));var util=require(_0x07e8('0x7'));var path=require(_0x07e8('0x8'));var sox=require(_0x07e8('0x9'));var csv=require(_0x07e8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07e8('0xb'));var squel=require(_0x07e8('0xc'));var crypto=require(_0x07e8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x07e8('0xe'));var toCsv=require(_0x07e8('0xa'));var querystring=require('querystring');var Papa=require(_0x07e8('0xf'));var Redis=require(_0x07e8('0x10'));var authService=require(_0x07e8('0x11'));var qs=require(_0x07e8('0x12'));var as=require('../../components/parsers/advancedSearch');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'];config[_0x07e8('0x1a')]=_[_0x07e8('0x1b')](config[_0x07e8('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07e8('0x1a')]));require(_0x07e8('0x1c'))[_0x07e8('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d06ec,_0x227667,_0x1a9ef6,_0x16a24b){return new BPromise(function(_0x550922,_0x3b3392){var _0x5f2ebf=_0x16a24b||client;return _0x5f2ebf[_0x07e8('0x1e')](_0x2d06ec,_0x1a9ef6)[_0x07e8('0x1f')](function(_0x56f1ba){logger['info'](_0x07e8('0x20'),_0x227667,_0x07e8('0x21'));logger['debug'](_0x07e8('0x22'),_0x227667,_0x07e8('0x21'),JSON[_0x07e8('0x23')](_0x56f1ba));if(_0x56f1ba['error']){if(_0x56f1ba[_0x07e8('0x24')][_0x07e8('0x25')]===0x1f4){logger['error'](_0x07e8('0x20'),_0x227667,_0x56f1ba[_0x07e8('0x24')][_0x07e8('0x26')]);return _0x3b3392(_0x56f1ba[_0x07e8('0x24')][_0x07e8('0x26')]);}logger['error'](_0x07e8('0x20'),_0x227667,_0x56f1ba[_0x07e8('0x24')]['message']);return _0x550922(_0x56f1ba[_0x07e8('0x24')]['message']);}else{logger[_0x07e8('0x27')](_0x07e8('0x20'),_0x227667,_0x07e8('0x21'));_0x550922(_0x56f1ba[_0x07e8('0x28')]['message']);}})[_0x07e8('0x29')](function(_0x5bc0db){logger['error'](_0x07e8('0x20'),_0x227667,_0x5bc0db);_0x3b3392(_0x5bc0db);});});}function respondWithStatusCode(_0x43e609,_0x46d8ff){_0x46d8ff=_0x46d8ff||0xcc;return function(_0xe25a50){if(_0xe25a50){return _0x43e609[_0x07e8('0x2a')](_0x46d8ff);}return _0x43e609[_0x07e8('0x2b')](_0x46d8ff)[_0x07e8('0x2c')]();};}function respondWithResult(_0x427a38,_0x3e2738){_0x3e2738=_0x3e2738||0xc8;return function(_0x1a8198){if(_0x1a8198){return _0x427a38[_0x07e8('0x2b')](_0x3e2738)[_0x07e8('0x2d')](_0x1a8198);}};}function respondWithFilteredResult(_0x4a9110,_0x297902){return function(_0x4405f4){if(_0x4405f4){var _0x4f0f59=_0x4405f4['count'],_0x3b3f29=_0x297902['offset'],_0x2cb0f0=_0x297902[_0x07e8('0x2e')]+_0x297902[_0x07e8('0x2f')],_0x54a938;if(_0x2cb0f0>=_0x4f0f59){_0x2cb0f0=_0x4f0f59;_0x54a938=0xc8;}else{_0x54a938=0xce;}_0x4a9110['status'](_0x54a938);return _0x4a9110[_0x07e8('0x30')]('Content-Range',_0x3b3f29+'-'+_0x2cb0f0+'/'+_0x4f0f59)[_0x07e8('0x2d')](_0x4405f4);}return null;};}function patchUpdates(_0x49de00){return function(_0x21586a){try{jsonpatch[_0x07e8('0x31')](_0x21586a,_0x49de00,!![]);}catch(_0x145dff){return BPromise[_0x07e8('0x32')](_0x145dff);}return _0x21586a[_0x07e8('0x33')]();};}function saveUpdates(_0x553fb2,_0x472679){return function(_0x1ccdfa){if(_0x1ccdfa){return _0x1ccdfa[_0x07e8('0x34')](_0x553fb2)[_0x07e8('0x1f')](function(_0x4bbc3f){return _0x4bbc3f;});}return null;};}function removeEntity(_0x252eae,_0x149cce){return function(_0x5ee421){if(_0x5ee421){return _0x5ee421[_0x07e8('0x35')]()[_0x07e8('0x1f')](function(){var _0x54cfac=_0x5ee421['get']({'plain':!![]});var _0x552a69='ChatQueues';return db['UserProfileResource'][_0x07e8('0x35')]({'where':{'type':_0x552a69,'resourceId':_0x54cfac['id']}})[_0x07e8('0x1f')](function(){return _0x5ee421;});})[_0x07e8('0x1f')](function(){_0x252eae[_0x07e8('0x2b')](0xcc)[_0x07e8('0x2c')]();});}};}function handleEntityNotFound(_0x1ae5d8,_0x5ae103){return function(_0x590640){if(!_0x590640){_0x1ae5d8[_0x07e8('0x2a')](0x194);}return _0x590640;};}function handleError(_0x58a76a,_0x22060a){_0x22060a=_0x22060a||0x1f4;return function(_0x427cd3){logger['error'](_0x427cd3[_0x07e8('0x36')]);if(_0x427cd3[_0x07e8('0x37')]){delete _0x427cd3[_0x07e8('0x37')];}_0x58a76a[_0x07e8('0x2b')](_0x22060a)[_0x07e8('0x38')](_0x427cd3);};}exports[_0x07e8('0x39')]=function(_0x393a64,_0x23cc5e){var _0x438015={},_0x2ac4dc={},_0x8e71f={'count':0x0,'rows':[]};var _0x111c26=_[_0x07e8('0x3a')](db[_0x07e8('0x3b')]['rawAttributes'],function(_0xf43ece){return{'name':_0xf43ece[_0x07e8('0x3c')],'type':_0xf43ece[_0x07e8('0x3d')][_0x07e8('0x3e')]};});_0x2ac4dc[_0x07e8('0x3f')]=_['map'](_0x111c26,'name');_0x2ac4dc['query']=_['keys'](_0x393a64['query']);_0x2ac4dc[_0x07e8('0x40')]=_[_0x07e8('0x41')](_0x2ac4dc[_0x07e8('0x3f')],_0x2ac4dc[_0x07e8('0x42')]);_0x438015[_0x07e8('0x43')]=_[_0x07e8('0x41')](_0x2ac4dc[_0x07e8('0x3f')],qs[_0x07e8('0x44')](_0x393a64[_0x07e8('0x42')]['fields']));_0x438015[_0x07e8('0x43')]=_0x438015['attributes']['length']?_0x438015[_0x07e8('0x43')]:_0x2ac4dc['model'];if(!_0x393a64['query'][_0x07e8('0x45')](_0x07e8('0x46'))){_0x438015[_0x07e8('0x2f')]=qs[_0x07e8('0x2f')](_0x393a64[_0x07e8('0x42')][_0x07e8('0x2f')]);_0x438015[_0x07e8('0x2e')]=qs['offset'](_0x393a64[_0x07e8('0x42')]['offset']);}_0x438015[_0x07e8('0x47')]=qs[_0x07e8('0x48')](_0x393a64[_0x07e8('0x42')][_0x07e8('0x48')]);_0x438015[_0x07e8('0x49')]=qs['filters'](_[_0x07e8('0x4a')](_0x393a64[_0x07e8('0x42')],_0x2ac4dc[_0x07e8('0x40')]),_0x111c26);if(_0x393a64[_0x07e8('0x42')][_0x07e8('0x4b')]){_0x438015[_0x07e8('0x49')]=_['merge'](_0x438015['where'],{'$or':_[_0x07e8('0x3a')](_0x111c26,function(_0xd25db8){if(_0xd25db8[_0x07e8('0x3d')]!==_0x07e8('0x4c')){var _0x4018ac={};_0x4018ac[_0xd25db8['name']]={'$like':'%'+_0x393a64['query'][_0x07e8('0x4b')]+'%'};return _0x4018ac;}})});}_0x438015=_[_0x07e8('0x4d')]({},_0x438015,_0x393a64[_0x07e8('0x4e')]);var _0x616d42={'where':_0x438015[_0x07e8('0x49')]};return db[_0x07e8('0x3b')][_0x07e8('0x4f')](_0x616d42)[_0x07e8('0x1f')](function(_0x4cb355){_0x8e71f[_0x07e8('0x4f')]=_0x4cb355;if(_0x393a64[_0x07e8('0x42')][_0x07e8('0x50')]){_0x438015[_0x07e8('0x51')]=[{'all':!![]}];}return db[_0x07e8('0x3b')][_0x07e8('0x52')](_0x438015);})[_0x07e8('0x1f')](function(_0x5caaac){_0x8e71f[_0x07e8('0x53')]=_0x5caaac;return _0x8e71f;})[_0x07e8('0x1f')](respondWithFilteredResult(_0x23cc5e,_0x438015))['catch'](handleError(_0x23cc5e,null));};exports[_0x07e8('0x54')]=function(_0x52894d,_0x3ba16f){var _0x5a53eb={'raw':!![],'where':{'id':_0x52894d[_0x07e8('0x55')]['id']}},_0x477d0b={};_0x477d0b[_0x07e8('0x3f')]=_[_0x07e8('0x56')](db[_0x07e8('0x3b')][_0x07e8('0x57')]);_0x477d0b['query']=_['keys'](_0x52894d[_0x07e8('0x42')]);_0x477d0b[_0x07e8('0x40')]=_[_0x07e8('0x41')](_0x477d0b[_0x07e8('0x3f')],_0x477d0b[_0x07e8('0x42')]);_0x5a53eb[_0x07e8('0x43')]=_[_0x07e8('0x41')](_0x477d0b['model'],qs[_0x07e8('0x44')](_0x52894d['query'][_0x07e8('0x44')]));_0x5a53eb['attributes']=_0x5a53eb[_0x07e8('0x43')][_0x07e8('0x58')]?_0x5a53eb[_0x07e8('0x43')]:_0x477d0b[_0x07e8('0x3f')];if(_0x52894d[_0x07e8('0x42')][_0x07e8('0x50')]){_0x5a53eb[_0x07e8('0x51')]=[{'all':!![]}];}_0x5a53eb=_[_0x07e8('0x4d')]({},_0x5a53eb,_0x52894d[_0x07e8('0x4e')]);return db[_0x07e8('0x3b')][_0x07e8('0x59')](_0x5a53eb)['then'](handleEntityNotFound(_0x3ba16f,null))['then'](respondWithResult(_0x3ba16f,null))['catch'](handleError(_0x3ba16f,null));};exports['create']=function(_0x503ca3,_0x12f470){return db[_0x07e8('0x3b')][_0x07e8('0x5a')](_0x503ca3[_0x07e8('0x5b')],{})['then'](function(_0x99106){var _0x30ebf5=_0x503ca3[_0x07e8('0x5c')][_0x07e8('0x5d')]({'plain':!![]});if(!_0x30ebf5)throw new Error(_0x07e8('0x5e'));if(_0x30ebf5[_0x07e8('0x5f')]===_0x07e8('0x5c')){var _0x9aa086=_0x99106[_0x07e8('0x5d')]({'plain':!![]});var _0x34c1cc='ChatQueues';return db[_0x07e8('0x60')]['find']({'where':{'name':_0x34c1cc,'userProfileId':_0x30ebf5[_0x07e8('0x61')]},'raw':!![]})['then'](function(_0x558a8a){if(_0x558a8a&&_0x558a8a[_0x07e8('0x62')]===0x0){return db[_0x07e8('0x63')][_0x07e8('0x5a')]({'name':_0x9aa086[_0x07e8('0x37')],'resourceId':_0x9aa086['id'],'type':_0x558a8a[_0x07e8('0x37')],'sectionId':_0x558a8a['id']},{})[_0x07e8('0x1f')](function(){return _0x99106;});}else{return _0x99106;}})['catch'](function(_0x2b51a3){logger[_0x07e8('0x24')](_0x07e8('0x64'),_0x2b51a3);throw _0x2b51a3;});}return _0x99106;})[_0x07e8('0x1f')](respondWithResult(_0x12f470,0xc9))['catch'](handleError(_0x12f470,null));};exports[_0x07e8('0x34')]=function(_0x19a5d6,_0x1244ac){if(_0x19a5d6[_0x07e8('0x5b')]['id']){delete _0x19a5d6[_0x07e8('0x5b')]['id'];}return db['ChatQueue'][_0x07e8('0x59')]({'where':{'id':_0x19a5d6[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](handleEntityNotFound(_0x1244ac,null))['then'](saveUpdates(_0x19a5d6[_0x07e8('0x5b')],null))[_0x07e8('0x1f')](respondWithResult(_0x1244ac,null))[_0x07e8('0x29')](handleError(_0x1244ac,null));};exports[_0x07e8('0x35')]=function(_0x4461fc,_0x17d52b){return db[_0x07e8('0x3b')][_0x07e8('0x59')]({'where':{'id':_0x4461fc[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](handleEntityNotFound(_0x17d52b,null))[_0x07e8('0x1f')](removeEntity(_0x17d52b,null))[_0x07e8('0x29')](handleError(_0x17d52b,null));};exports['describe']=function(_0x30b946,_0x20915b){return db[_0x07e8('0x3b')][_0x07e8('0x65')]()[_0x07e8('0x1f')](respondWithResult(_0x20915b,null))[_0x07e8('0x29')](handleError(_0x20915b,null));};exports[_0x07e8('0x66')]=function(_0x5079b1,_0x26731c,_0x458edd){var _0xda889d={'raw':!![],'where':{}},_0x280546={},_0x26eda9;return db[_0x07e8('0x3b')][_0x07e8('0x67')]({'where':{'id':_0x5079b1[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](handleEntityNotFound(_0x26731c,null))[_0x07e8('0x1f')](function(_0x568392){if(_0x568392){_0x26eda9=_0x568392[_0x07e8('0x5d')]({'plain':!![]});_0x280546[_0x07e8('0x3f')]=_[_0x07e8('0x56')](db['UserChatQueue'][_0x07e8('0x57')]);_0x280546[_0x07e8('0x42')]=_[_0x07e8('0x56')](_0x5079b1[_0x07e8('0x42')]);_0x280546[_0x07e8('0x40')]=_[_0x07e8('0x41')](_0x280546['model'],_0x280546[_0x07e8('0x42')]);_0xda889d[_0x07e8('0x43')]=_[_0x07e8('0x41')](_0x280546[_0x07e8('0x3f')],qs[_0x07e8('0x44')](_0x5079b1[_0x07e8('0x42')]['fields']));_0xda889d[_0x07e8('0x43')]=_0xda889d[_0x07e8('0x43')]['length']?_0xda889d[_0x07e8('0x43')]:_0x280546[_0x07e8('0x3f')];if(!_0x5079b1['query'][_0x07e8('0x45')](_0x07e8('0x46'))){_0xda889d[_0x07e8('0x2f')]=qs['limit'](_0x5079b1[_0x07e8('0x42')][_0x07e8('0x2f')]);_0xda889d[_0x07e8('0x2e')]=qs['offset'](_0x5079b1[_0x07e8('0x42')][_0x07e8('0x2e')]);}_0xda889d['order']=qs[_0x07e8('0x48')](_0x5079b1[_0x07e8('0x42')][_0x07e8('0x48')]);_0xda889d['where']=qs[_0x07e8('0x40')](_[_0x07e8('0x4a')](_0x5079b1[_0x07e8('0x42')],_0x280546['filters']));_0xda889d[_0x07e8('0x49')][_0x07e8('0x68')]=_0x568392['id'];if(_0x5079b1[_0x07e8('0x42')]['filter']){_0xda889d['where']=_['merge'](_0xda889d['where'],{'$or':_['map'](_0xda889d['attributes'],function(_0x43b155){var _0x1f8108={};_0x1f8108[_0x43b155]={'$like':'%'+_0x5079b1['query'][_0x07e8('0x4b')]+'%'};return _0x1f8108;})});}_0xda889d=_[_0x07e8('0x4d')]({},_0xda889d,_0x5079b1[_0x07e8('0x4e')]);return db['UserChatQueue'][_0x07e8('0x52')](_0xda889d);}})['then'](function(_0xef6a3e){if(_0xef6a3e){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0xef6a3e,'UserId'),'role':_0x07e8('0x69')},'attributes':['id',_0x07e8('0x37'),_0x07e8('0x6a'),'updatedAt',_0x07e8('0x6b')]});}})[_0x07e8('0x1f')](function(_0x378381){if(_0x378381){return{'count':_0x378381[_0x07e8('0x4f')],'rows':_[_0x07e8('0x3a')](_0x378381[_0x07e8('0x53')],function(_0x36bfcd){return{'membername':_0x36bfcd[_0x07e8('0x37')],'UserId':_0x36bfcd['id'],'queue_name':_0x26eda9[_0x07e8('0x37')],'ChatQueueId':_0x26eda9['id'],'interface':util[_0x07e8('0x6c')](_0x07e8('0x6d'),'SIP',_0x36bfcd[_0x07e8('0x37')]),'penalty':0x0,'paused':_0x36bfcd[_0x07e8('0x6a')],'createdAt':_0x36bfcd[_0x07e8('0x6b')],'updatedAt':_0x36bfcd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x26731c,_0xda889d))[_0x07e8('0x29')](handleError(_0x26731c,null));};exports[_0x07e8('0x6e')]=function(_0x310b1b,_0x1fa845,_0x3fe3dd){var _0x1e95b1={};var _0x14f7c1={};var _0x30f888;var _0x13b310;return db['ChatQueue'][_0x07e8('0x67')]({'where':{'id':_0x310b1b['params']['id']}})[_0x07e8('0x1f')](handleEntityNotFound(_0x1fa845,null))['then'](function(_0x512632){if(_0x512632){_0x30f888=_0x512632;_0x14f7c1[_0x07e8('0x3f')]=_[_0x07e8('0x56')](db[_0x07e8('0x6f')][_0x07e8('0x57')]);_0x14f7c1['query']=_[_0x07e8('0x56')](_0x310b1b[_0x07e8('0x42')]);_0x14f7c1['filters']=_['intersection'](_0x14f7c1[_0x07e8('0x3f')],_0x14f7c1[_0x07e8('0x42')]);_0x1e95b1[_0x07e8('0x43')]=_[_0x07e8('0x41')](_0x14f7c1[_0x07e8('0x3f')],qs[_0x07e8('0x44')](_0x310b1b[_0x07e8('0x42')]['fields']));_0x1e95b1[_0x07e8('0x43')]=_0x1e95b1[_0x07e8('0x43')][_0x07e8('0x58')]?_0x1e95b1[_0x07e8('0x43')]:_0x14f7c1['model'];_0x1e95b1[_0x07e8('0x47')]=qs[_0x07e8('0x48')](_0x310b1b[_0x07e8('0x42')][_0x07e8('0x48')]);_0x1e95b1['where']=qs[_0x07e8('0x40')](_[_0x07e8('0x4a')](_0x310b1b['query'],_0x14f7c1[_0x07e8('0x40')]));if(_0x310b1b['query'][_0x07e8('0x4b')]){_0x1e95b1[_0x07e8('0x49')]=_[_0x07e8('0x4d')](_0x1e95b1[_0x07e8('0x49')],{'$or':_['map'](_0x1e95b1['attributes'],function(_0x5864e8){var _0x5f050e={};_0x5f050e[_0x5864e8]={'$like':'%'+_0x310b1b[_0x07e8('0x42')][_0x07e8('0x4b')]+'%'};return _0x5f050e;})});}_0x1e95b1=_[_0x07e8('0x4d')]({},_0x1e95b1,_0x310b1b['options']);return _0x30f888[_0x07e8('0x6e')](_0x1e95b1);}})[_0x07e8('0x1f')](function(_0x2e8edb){if(_0x2e8edb){_0x13b310=_0x2e8edb[_0x07e8('0x58')];if(!_0x310b1b['query'][_0x07e8('0x45')](_0x07e8('0x46'))){_0x1e95b1[_0x07e8('0x2f')]=qs[_0x07e8('0x2f')](_0x310b1b['query'][_0x07e8('0x2f')]);_0x1e95b1[_0x07e8('0x2e')]=qs[_0x07e8('0x2e')](_0x310b1b[_0x07e8('0x42')]['offset']);}return _0x30f888[_0x07e8('0x6e')](_0x1e95b1);}})['then'](function(_0x40a095){if(_0x40a095){return _0x40a095?{'count':_0x13b310,'rows':_0x40a095}:null;}})[_0x07e8('0x1f')](respondWithResult(_0x1fa845,null))[_0x07e8('0x29')](handleError(_0x1fa845,null));};exports[_0x07e8('0x70')]=function(_0x5cf61e,_0x1d61be,_0xed40ce){var _0x3ea304=_0x5cf61e[_0x07e8('0x5b')][_0x07e8('0x71')];return db[_0x07e8('0x6f')][_0x07e8('0x52')]({'where':{'id':_0x3ea304},'attributes':['id'],'include':[{'model':db[_0x07e8('0x72')],'as':_0x07e8('0x73'),'attributes':['id',_0x07e8('0x37'),_0x07e8('0x74'),_0x07e8('0x75'),_0x07e8('0x76')],'raw':!![]}]})[_0x07e8('0x1f')](function(_0x53093c){if(_0x53093c){var _0x33c7c8=_['flatMap'](_0x53093c,function(_0x1e470b){var _0x286d25=_0x1e470b[_0x07e8('0x5d')]({'plain':!![]});return _0x286d25['Agents'];});return db['ChatQueue'][_0x07e8('0x59')]({'where':{'id':_0x5cf61e[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](function(_0x3a6c4b){return db[_0x07e8('0x77')][_0x07e8('0x78')](function(_0xcdcda0){return _0x3a6c4b[_0x07e8('0x70')](_0x3ea304,{'transaction':_0xcdcda0})['then'](function(){return BPromise[_0x07e8('0x79')](_0x33c7c8,function(_0x2c2737){return db[_0x07e8('0x7a')][_0x07e8('0x7b')]({'where':{'UserId':_0x2c2737['id'],'ChatQueueId':_0x5cf61e[_0x07e8('0x55')]['id']},'transaction':_0xcdcda0});});})[_0x07e8('0x1f')](function(){_0x33c7c8['forEach'](function(_0x67a3e6){socket[_0x07e8('0x7c')](_0x07e8('0x7d'),{'UserId':_0x67a3e6['id'],'ChatQueueId':_0x3a6c4b['id']});});});});});}})[_0x07e8('0x1f')](respondWithStatusCode(_0x1d61be,null))[_0x07e8('0x29')](handleError(_0x1d61be,null));};exports[_0x07e8('0x7e')]=function(_0xc65281,_0x22f9c2,_0x100088){return db['Team'][_0x07e8('0x52')]({'where':{'id':_0xc65281[_0x07e8('0x42')][_0x07e8('0x71')]},'attributes':['id'],'include':[{'model':db[_0x07e8('0x72')],'as':_0x07e8('0x73'),'attributes':['id'],'raw':!![]}]})[_0x07e8('0x1f')](handleEntityNotFound(_0x22f9c2,null))[_0x07e8('0x1f')](function(_0x5905f9){var _0x1156e7=_[_0x07e8('0x3a')](_0x5905f9,'id');var _0x41a181=[];var _0xe0fe79=[];var _0x39a45d=squel['select']();_0x39a45d[_0x07e8('0x7f')](_0x07e8('0x80'))[_0x07e8('0x81')]('team_has_chat_queues','tq')[_0x07e8('0x82')](_0x07e8('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x07e8('0x49')](_0x07e8('0x84'),_0xc65281[_0x07e8('0x55')]['id']);for(var _0x370463=0x0;_0x370463<_0x5905f9['length'];_0x370463+=0x1){let _0x47274c=_0x5905f9[_0x370463];for(var _0xba8cea=0x0;_0xba8cea<_0x47274c[_0x07e8('0x73')]['length'];_0xba8cea+=0x1){let _0x2b2106=_0x47274c['Agents'][_0xba8cea];var _0x56f1ed=_0x39a45d['clone']();_0x56f1ed['where'](_0x07e8('0x85'),_0x2b2106['id']);_0xe0fe79[_0x07e8('0x86')](db['sequelize'][_0x07e8('0x42')](_0x56f1ed[_0x07e8('0x87')](),{'type':db[_0x07e8('0x77')][_0x07e8('0x88')][_0x07e8('0x89')]})[_0x07e8('0x1f')](function(_0x30769a){if(_0x30769a[_0x07e8('0x58')]===0x1){return _0x2b2106['id'];}else{var _0x5e8e75=_[_0x07e8('0x8a')](_[_0x07e8('0x3a')](_0x30769a,'TeamId'),function(_0x43f24a){return _[_0x07e8('0x8b')](_0x1156e7,_0x43f24a);});if(_0x5e8e75){return _0x2b2106['id'];}}}));}}return BPromise[_0x07e8('0x8c')](_0xe0fe79)[_0x07e8('0x1f')](function(_0x2ec90d){_0x41a181=_(_0x41a181)[_0x07e8('0x8d')](_0x2ec90d)[_0x07e8('0x8e')]()[_0x07e8('0x8f')]();return db[_0x07e8('0x3b')]['find']({'where':{'id':_0xc65281[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](function(_0x3b907b){return db[_0x07e8('0x77')][_0x07e8('0x78')](function(_0x2c0e84){return _0x3b907b[_0x07e8('0x7e')](_0xc65281[_0x07e8('0x42')]['ids'],{'transaction':_0x2c0e84})[_0x07e8('0x1f')](function(){if(!_[_0x07e8('0x90')](_0x41a181)){return _0x3b907b[_0x07e8('0x91')](_0x41a181,{'transaction':_0x2c0e84});}})['then'](function(){_0x41a181['forEach'](function(_0x307f55){socket[_0x07e8('0x7c')](_0x07e8('0x92'),{'UserId':_0x307f55,'ChatQueueId':_0x3b907b['id']});});});});});});})[_0x07e8('0x1f')](respondWithStatusCode(_0x22f9c2,null))[_0x07e8('0x29')](handleError(_0x22f9c2,null));};exports[_0x07e8('0x93')]=function(_0x48186f,_0x3b57b5,_0x569581){return db[_0x07e8('0x3b')]['find']({'where':{'id':_0x48186f[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](handleEntityNotFound(_0x3b57b5,null))[_0x07e8('0x1f')](function(_0x467d3c){if(_0x467d3c){return _0x467d3c[_0x07e8('0x93')](_0x48186f[_0x07e8('0x5b')]['ids'],_[_0x07e8('0x94')](_0x48186f['body'],[_0x07e8('0x71'),'id'])||{})['spread'](function(_0x51d9a9){for(var _0x2e7498=0x0;_0x2e7498<_0x48186f['body'][_0x07e8('0x71')][_0x07e8('0x58')];_0x2e7498+=0x1){socket[_0x07e8('0x7c')](_0x07e8('0x7d'),{'UserId':_0x48186f[_0x07e8('0x5b')][_0x07e8('0x71')][_0x2e7498],'ChatQueueId':_0x48186f[_0x07e8('0x55')]['id']});}return _0x51d9a9;});}})[_0x07e8('0x1f')](respondWithResult(_0x3b57b5,null))[_0x07e8('0x29')](handleError(_0x3b57b5,null));};exports[_0x07e8('0x91')]=function(_0x262473,_0x1ec343,_0x38c3b8){return db[_0x07e8('0x3b')][_0x07e8('0x59')]({'where':{'id':_0x262473[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](handleEntityNotFound(_0x1ec343,null))['then'](function(_0xda13ac){if(_0xda13ac){return _0xda13ac[_0x07e8('0x91')](_0x262473[_0x07e8('0x42')][_0x07e8('0x71')])[_0x07e8('0x1f')](function(){if(_[_0x07e8('0x95')](_0x262473[_0x07e8('0x42')]['ids'])){for(var _0x52db77=0x0;_0x52db77<_0x262473[_0x07e8('0x42')][_0x07e8('0x71')]['length'];_0x52db77+=0x1){socket[_0x07e8('0x7c')](_0x07e8('0x92'),{'UserId':Number(_0x262473[_0x07e8('0x42')]['ids'][_0x52db77]),'ChatQueueId':Number(_0x262473[_0x07e8('0x55')]['id'])});}}else{socket[_0x07e8('0x7c')](_0x07e8('0x92'),{'UserId':Number(_0x262473[_0x07e8('0x42')]['ids']),'ChatQueueId':Number(_0x262473[_0x07e8('0x55')]['id'])});}});}})[_0x07e8('0x1f')](respondWithStatusCode(_0x1ec343,null))[_0x07e8('0x29')](handleError(_0x1ec343,null));};exports[_0x07e8('0x96')]=function(_0x20cf5f,_0x4424ea,_0x3f5098){var _0x32b041={};var _0x44b2c1={};var _0xcf6a0e;var _0x55339b;return db[_0x07e8('0x3b')][_0x07e8('0x67')]({'where':{'id':_0x20cf5f[_0x07e8('0x55')]['id']}})[_0x07e8('0x1f')](handleEntityNotFound(_0x4424ea,null))[_0x07e8('0x1f')](function(_0x547c3b){if(_0x547c3b){_0xcf6a0e=_0x547c3b;_0x44b2c1['model']=_[_0x07e8('0x56')](db['User'][_0x07e8('0x57')]);_0x44b2c1['query']=_[_0x07e8('0x56')](_0x20cf5f['query']);_0x44b2c1[_0x07e8('0x40')]=_[_0x07e8('0x41')](_0x44b2c1[_0x07e8('0x3f')],_0x44b2c1[_0x07e8('0x42')]);_0x32b041[_0x07e8('0x43')]=_[_0x07e8('0x41')](_0x44b2c1[_0x07e8('0x3f')],qs[_0x07e8('0x44')](_0x20cf5f[_0x07e8('0x42')][_0x07e8('0x44')]));_0x32b041['attributes']=_0x32b041[_0x07e8('0x43')][_0x07e8('0x58')]?_0x32b041[_0x07e8('0x43')]:_0x44b2c1['model'];_0x32b041[_0x07e8('0x47')]=qs[_0x07e8('0x48')](_0x20cf5f['query'][_0x07e8('0x48')]);_0x32b041[_0x07e8('0x49')]=qs[_0x07e8('0x40')](_[_0x07e8('0x4a')](_0x20cf5f[_0x07e8('0x42')],_0x44b2c1['filters']));if(_0x20cf5f[_0x07e8('0x42')][_0x07e8('0x4b')]){_0x32b041[_0x07e8('0x49')]=_[_0x07e8('0x4d')](_0x32b041['where'],{'$or':_[_0x07e8('0x3a')](_0x32b041['attributes'],function(_0x1a791c){var _0x41ca29={};_0x41ca29[_0x1a791c]={'$like':'%'+_0x20cf5f['query']['filter']+'%'};return _0x41ca29;})});}_0x32b041=_['merge']({},_0x32b041,_0x20cf5f['options']);return _0xcf6a0e[_0x07e8('0x96')](_0x32b041);}})[_0x07e8('0x1f')](function(_0x1b1cea){if(_0x1b1cea){_0x55339b=_0x1b1cea[_0x07e8('0x58')];if(!_0x20cf5f['query'][_0x07e8('0x45')]('nolimit')){_0x32b041[_0x07e8('0x2f')]=qs[_0x07e8('0x2f')](_0x20cf5f[_0x07e8('0x42')][_0x07e8('0x2f')]);_0x32b041['offset']=qs[_0x07e8('0x2e')](_0x20cf5f[_0x07e8('0x42')][_0x07e8('0x2e')]);}return _0xcf6a0e[_0x07e8('0x96')](_0x32b041);}})[_0x07e8('0x1f')](function(_0xf59dca){if(_0xf59dca){return _0xf59dca?{'count':_0x55339b,'rows':_0xf59dca}:null;}})[_0x07e8('0x1f')](respondWithResult(_0x4424ea,null))[_0x07e8('0x29')](handleError(_0x4424ea,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index dd04f34..513c2ca 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(_0x45c005,_0x56faea){var _0x2cfaaf=function(_0x3a38f1){while(--_0x3a38f1){_0x45c005['push'](_0x45c005['shift']());}};_0x2cfaaf(++_0x56faea);}(_0xb10b,0x12a));var _0xbb10=function(_0xaf2427,_0x504859){_0xaf2427=_0xaf2427-0x0;var _0x67addb=_0xb10b[_0xaf2427];return _0x67addb;};'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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x4566b3,_0x4eff90){var _0x544b89=function(_0x3bc80a){while(--_0x3bc80a){_0x4566b3['push'](_0x4566b3['shift']());}};_0x544b89(++_0x4eff90);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35d862,_0x49931e){_0x35d862=_0x35d862-0x0;var _0x1b8c4b=_0x5f2f[_0x35d862];return _0x1b8c4b;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index cf493d6..41fd5d9 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 _0xcfbd=['rimraf','../../config/environment','./chatQueue.attributes','define','chat_queues','lodash','util','api','request-promise','path'];(function(_0x5bec6f,_0x26e692){var _0x35b36d=function(_0xedfdcb){while(--_0xedfdcb){_0x5bec6f['push'](_0x5bec6f['shift']());}};_0x35b36d(++_0x26e692);}(_0xcfbd,0x109));var _0xdcfb=function(_0x198d8e,_0x4d8061){_0x198d8e=_0x198d8e-0x0;var _0x4eb3de=_0xcfbd[_0x198d8e];return _0x4eb3de;};'use strict';var _=require(_0xdcfb('0x0'));var util=require(_0xdcfb('0x1'));var logger=require('../../config/logger')(_0xdcfb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdcfb('0x3'));var fs=require('fs');var path=require(_0xdcfb('0x4'));var rimraf=require(_0xdcfb('0x5'));var config=require(_0xdcfb('0x6'));var attributes=require(_0xdcfb('0x7'));module['exports']=function(_0x33d431,_0x2c9411){return _0x33d431[_0xdcfb('0x8')]('ChatQueue',attributes,{'tableName':_0xdcfb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78c3=['bluebird','path','./chatQueue.attributes','exports','chat_queues','util','../../config/logger','api'];(function(_0x38b6df,_0x1e676d){var _0x14c740=function(_0x2544e5){while(--_0x2544e5){_0x38b6df['push'](_0x38b6df['shift']());}};_0x14c740(++_0x1e676d);}(_0x78c3,0x145));var _0x378c=function(_0x1d5ba4,_0x91111){_0x1d5ba4=_0x1d5ba4-0x0;var _0x3d3d34=_0x78c3[_0x1d5ba4];return _0x3d3d34;};'use strict';var _=require('lodash');var util=require(_0x378c('0x0'));var logger=require(_0x378c('0x1'))(_0x378c('0x2'));var moment=require('moment');var BPromise=require(_0x378c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x378c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x378c('0x5'));module[_0x378c('0x6')]=function(_0x33e120,_0x13d24a){return _0x33e120['define']('ChatQueue',attributes,{'tableName':_0x378c('0x7'),'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 44ff8f3..5579678 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 _0x11d3=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','attributes','limit','include','map','model','find','raw','where','ShowChatQueue','lodash','util'];(function(_0x3ea360,_0x4a3b9e){var _0x330457=function(_0x3c221a){while(--_0x3c221a){_0x3ea360['push'](_0x3ea360['shift']());}};_0x330457(++_0x4a3b9e);}(_0x11d3,0x1ac));var _0x311d=function(_0x4212c9,_0x26c526){_0x4212c9=_0x4212c9-0x0;var _0x6b7476=_0x11d3[_0x4212c9];return _0x6b7476;};'use strict';var _=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var moment=require(_0x311d('0x2'));var BPromise=require(_0x311d('0x3'));var rs=require(_0x311d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x311d('0x5'));var logger=require(_0x311d('0x6'))(_0x311d('0x7'));var config=require(_0x311d('0x8'));var jayson=require(_0x311d('0x9'));var client=jayson[_0x311d('0xa')][_0x311d('0xb')]({'port':0x232a});config[_0x311d('0xc')]=_[_0x311d('0xd')](config['redis'],{'host':_0x311d('0xe'),'port':0x18eb});var socket=require(_0x311d('0xf'))(new Redis(config[_0x311d('0xc')]));require(_0x311d('0x10'))['register'](socket);function respondWithRpcPromise(_0x28f9bc,_0x2269da,_0x24bbed){return new BPromise(function(_0x4232dd,_0x5bb5ce){return client[_0x311d('0x11')](_0x28f9bc,_0x24bbed)[_0x311d('0x12')](function(_0x1cb3c9){logger[_0x311d('0x13')](_0x311d('0x14'),_0x2269da,_0x311d('0x15'));logger[_0x311d('0x16')](_0x311d('0x17'),_0x2269da,_0x311d('0x15'),JSON[_0x311d('0x18')](_0x1cb3c9));if(_0x1cb3c9[_0x311d('0x19')]){if(_0x1cb3c9[_0x311d('0x19')][_0x311d('0x1a')]===0x1f4){logger[_0x311d('0x19')]('ChatQueue,\x20%s,\x20%s',_0x2269da,_0x1cb3c9[_0x311d('0x19')][_0x311d('0x1b')]);return _0x5bb5ce(_0x1cb3c9['error'][_0x311d('0x1b')]);}logger[_0x311d('0x19')]('ChatQueue,\x20%s,\x20%s',_0x2269da,_0x1cb3c9[_0x311d('0x19')]['message']);return _0x4232dd(_0x1cb3c9[_0x311d('0x19')][_0x311d('0x1b')]);}else{logger['info'](_0x311d('0x14'),_0x2269da,_0x311d('0x15'));_0x4232dd(_0x1cb3c9[_0x311d('0x1c')][_0x311d('0x1b')]);}})[_0x311d('0x1d')](function(_0x75882e){logger[_0x311d('0x19')](_0x311d('0x14'),_0x2269da,_0x75882e);_0x5bb5ce(_0x75882e);});});}exports[_0x311d('0x1e')]=function(_0x2934c4){var _0x1b4175=this;return new Promise(function(_0x397700,_0x5021cb){return db[_0x311d('0x1f')][_0x311d('0x20')]({'raw':_0x2934c4[_0x311d('0x21')]?_0x2934c4[_0x311d('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x2934c4['options']?_0x2934c4['options']['where']||null:null,'attributes':_0x2934c4[_0x311d('0x21')]?_0x2934c4[_0x311d('0x21')][_0x311d('0x22')]||null:null,'limit':_0x2934c4[_0x311d('0x21')]?_0x2934c4[_0x311d('0x21')][_0x311d('0x23')]||null:null,'include':_0x2934c4[_0x311d('0x21')]?_0x2934c4[_0x311d('0x21')][_0x311d('0x24')]?_[_0x311d('0x25')](_0x2934c4['options'][_0x311d('0x24')],function(_0x4e52d2){return{'model':db[_0x4e52d2[_0x311d('0x26')]],'as':_0x4e52d2['as'],'attributes':_0x4e52d2[_0x311d('0x22')],'include':_0x4e52d2['include']?_[_0x311d('0x25')](_0x4e52d2['include'],function(_0x75c288){return{'model':db[_0x75c288[_0x311d('0x26')]],'as':_0x75c288['as'],'attributes':_0x75c288[_0x311d('0x22')],'include':_0x75c288[_0x311d('0x24')]?_[_0x311d('0x25')](_0x75c288[_0x311d('0x24')],function(_0x4d632f){return{'model':db[_0x4d632f[_0x311d('0x26')]],'as':_0x4d632f['as'],'attributes':_0x4d632f[_0x311d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bfc25){logger['info'](_0x311d('0x1e'),_0x2934c4);logger[_0x311d('0x16')]('GetChatQueue',_0x2934c4,JSON[_0x311d('0x18')](_0x2bfc25));_0x397700(_0x2bfc25);})['catch'](function(_0x56a14a){logger[_0x311d('0x19')]('GetChatQueue',_0x56a14a[_0x311d('0x1b')],_0x2934c4);_0x5021cb(_0x1b4175[_0x311d('0x19')](0x1f4,_0x56a14a[_0x311d('0x1b')]));});});};exports['ShowChatQueue']=function(_0xeeb681){var _0x52e291=this;return new Promise(function(_0x113eaf,_0x1c2ec5){return db[_0x311d('0x1f')][_0x311d('0x27')]({'raw':_0xeeb681['options']?_0xeeb681[_0x311d('0x21')][_0x311d('0x28')]===undefined?!![]:![]:!![],'where':_0xeeb681[_0x311d('0x21')]?_0xeeb681['options'][_0x311d('0x29')]||null:null,'attributes':_0xeeb681[_0x311d('0x21')]?_0xeeb681[_0x311d('0x21')][_0x311d('0x22')]||null:null,'include':_0xeeb681[_0x311d('0x21')]?_0xeeb681[_0x311d('0x21')][_0x311d('0x24')]?_[_0x311d('0x25')](_0xeeb681[_0x311d('0x21')][_0x311d('0x24')],function(_0x3ff783){return{'model':db[_0x3ff783[_0x311d('0x26')]],'as':_0x3ff783['as'],'attributes':_0x3ff783[_0x311d('0x22')],'include':_0x3ff783['include']?_[_0x311d('0x25')](_0x3ff783[_0x311d('0x24')],function(_0x5b946d){return{'model':db[_0x5b946d[_0x311d('0x26')]],'as':_0x5b946d['as'],'attributes':_0x5b946d[_0x311d('0x22')],'include':_0x5b946d[_0x311d('0x24')]?_[_0x311d('0x25')](_0x5b946d[_0x311d('0x24')],function(_0x28d6da){return{'model':db[_0x28d6da['model']],'as':_0x28d6da['as'],'attributes':_0x28d6da['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b278b){logger[_0x311d('0x13')](_0x311d('0x2a'),_0xeeb681);logger[_0x311d('0x16')]('ShowChatQueue',_0xeeb681,JSON[_0x311d('0x18')](_0x2b278b));_0x113eaf(_0x2b278b);})[_0x311d('0x1d')](function(_0x4c7a5d){logger[_0x311d('0x19')](_0x311d('0x2a'),_0x4c7a5d[_0x311d('0x1b')],_0xeeb681);_0x1c2ec5(_0x52e291['error'](0x1f4,_0x4c7a5d['message']));});});}; \ No newline at end of file +var _0xcdd2=['options','attributes','limit','include','map','model','debug','catch','ShowChatQueue','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetChatQueue','ChatQueue','findAll','raw','where'];(function(_0xdc70a5,_0x3e9363){var _0xa9b9e6=function(_0x2d1d05){while(--_0x2d1d05){_0xdc70a5['push'](_0xdc70a5['shift']());}};_0xa9b9e6(++_0x3e9363);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});config[_0x2cdd('0xb')]=_[_0x2cdd('0xc')](config[_0x2cdd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2cdd('0xd'))['register'](socket);function respondWithRpcPromise(_0x12cdca,_0x3e3cf0,_0x370b33){return new BPromise(function(_0x555ba7,_0x3feff9){return client[_0x2cdd('0xe')](_0x12cdca,_0x370b33)[_0x2cdd('0xf')](function(_0x20ab30){logger[_0x2cdd('0x10')](_0x2cdd('0x11'),_0x3e3cf0,'request\x20sent');logger['debug'](_0x2cdd('0x12'),_0x3e3cf0,_0x2cdd('0x13'),JSON['stringify'](_0x20ab30));if(_0x20ab30[_0x2cdd('0x14')]){if(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x15')]===0x1f4){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30['error'][_0x2cdd('0x16')]);return _0x3feff9(_0x20ab30[_0x2cdd('0x14')]['message']);}logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);return _0x555ba7(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);}else{logger['info'](_0x2cdd('0x11'),_0x3e3cf0,_0x2cdd('0x13'));_0x555ba7(_0x20ab30[_0x2cdd('0x17')][_0x2cdd('0x16')]);}})['catch'](function(_0x23f7a6){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x23f7a6);_0x3feff9(_0x23f7a6);});});}exports[_0x2cdd('0x18')]=function(_0x3056e7){var _0x871fd2=this;return new Promise(function(_0x2b0691,_0x442c18){return db[_0x2cdd('0x19')][_0x2cdd('0x1a')]({'raw':_0x3056e7['options']?_0x3056e7['options'][_0x2cdd('0x1b')]===undefined?!![]:![]:!![],'where':_0x3056e7['options']?_0x3056e7['options'][_0x2cdd('0x1c')]||null:null,'attributes':_0x3056e7[_0x2cdd('0x1d')]?_0x3056e7[_0x2cdd('0x1d')][_0x2cdd('0x1e')]||null:null,'limit':_0x3056e7['options']?_0x3056e7['options'][_0x2cdd('0x1f')]||null:null,'include':_0x3056e7[_0x2cdd('0x1d')]?_0x3056e7[_0x2cdd('0x1d')][_0x2cdd('0x20')]?_[_0x2cdd('0x21')](_0x3056e7[_0x2cdd('0x1d')][_0x2cdd('0x20')],function(_0x50ab71){return{'model':db[_0x50ab71[_0x2cdd('0x22')]],'as':_0x50ab71['as'],'attributes':_0x50ab71[_0x2cdd('0x1e')],'include':_0x50ab71[_0x2cdd('0x20')]?_['map'](_0x50ab71['include'],function(_0x5ef69f){return{'model':db[_0x5ef69f[_0x2cdd('0x22')]],'as':_0x5ef69f['as'],'attributes':_0x5ef69f[_0x2cdd('0x1e')],'include':_0x5ef69f['include']?_[_0x2cdd('0x21')](_0x5ef69f[_0x2cdd('0x20')],function(_0x235e71){return{'model':db[_0x235e71[_0x2cdd('0x22')]],'as':_0x235e71['as'],'attributes':_0x235e71[_0x2cdd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2cdd('0xf')](function(_0x5d8b6f){logger[_0x2cdd('0x10')](_0x2cdd('0x18'),_0x3056e7);logger[_0x2cdd('0x23')](_0x2cdd('0x18'),_0x3056e7,JSON['stringify'](_0x5d8b6f));_0x2b0691(_0x5d8b6f);})[_0x2cdd('0x24')](function(_0x1ab62e){logger['error'](_0x2cdd('0x18'),_0x1ab62e[_0x2cdd('0x16')],_0x3056e7);_0x442c18(_0x871fd2[_0x2cdd('0x14')](0x1f4,_0x1ab62e[_0x2cdd('0x16')]));});});};exports[_0x2cdd('0x25')]=function(_0x41f1fd){var _0x46b08e=this;return new Promise(function(_0x1a7552,_0x255b3e){return db['ChatQueue'][_0x2cdd('0x26')]({'raw':_0x41f1fd[_0x2cdd('0x1d')]?_0x41f1fd[_0x2cdd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x41f1fd['options']?_0x41f1fd['options'][_0x2cdd('0x1c')]||null:null,'attributes':_0x41f1fd[_0x2cdd('0x1d')]?_0x41f1fd['options'][_0x2cdd('0x1e')]||null:null,'include':_0x41f1fd[_0x2cdd('0x1d')]?_0x41f1fd[_0x2cdd('0x1d')][_0x2cdd('0x20')]?_[_0x2cdd('0x21')](_0x41f1fd['options']['include'],function(_0x474c90){return{'model':db[_0x474c90[_0x2cdd('0x22')]],'as':_0x474c90['as'],'attributes':_0x474c90[_0x2cdd('0x1e')],'include':_0x474c90[_0x2cdd('0x20')]?_[_0x2cdd('0x21')](_0x474c90['include'],function(_0x1db75a){return{'model':db[_0x1db75a[_0x2cdd('0x22')]],'as':_0x1db75a['as'],'attributes':_0x1db75a[_0x2cdd('0x1e')],'include':_0x1db75a[_0x2cdd('0x20')]?_[_0x2cdd('0x21')](_0x1db75a[_0x2cdd('0x20')],function(_0xfa0de9){return{'model':db[_0xfa0de9['model']],'as':_0xfa0de9['as'],'attributes':_0xfa0de9[_0x2cdd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2cdd('0xf')](function(_0x2f8e8c){logger[_0x2cdd('0x10')](_0x2cdd('0x25'),_0x41f1fd);logger[_0x2cdd('0x23')](_0x2cdd('0x25'),_0x41f1fd,JSON[_0x2cdd('0x27')](_0x2f8e8c));_0x1a7552(_0x2f8e8c);})[_0x2cdd('0x24')](function(_0x49b727){logger['error'](_0x2cdd('0x25'),_0x49b727[_0x2cdd('0x16')],_0x41f1fd);_0x255b3e(_0x46b08e[_0x2cdd('0x14')](0x1f4,_0x49b727['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 18976e0..4aa7be1 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xb10b,0x12a));var _0xbb10=function(_0x17f85f,_0x5c6ff9){_0x17f85f=_0x17f85f-0x0;var _0x38100a=_0xb10b[_0x17f85f];return _0x38100a;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x264b79,_0xc62859){var _0x548c85=function(_0x3ca7f0){while(--_0x3ca7f0){_0x264b79['push'](_0x264b79['shift']());}};_0x548c85(++_0xc62859);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11ec33,_0x46205c){_0x11ec33=_0x11ec33-0x0;var _0x4f0e63=_0x5f2f[_0x11ec33];return _0x4f0e63;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c1115f6..5d64038 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 _0x1145=['getAgents','post','create','addTeams','addAgents','put','delete','removeTeams','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x460750,_0x1cd7a7){var _0x40ddf8=function(_0x37af1e){while(--_0x37af1e){_0x460750['push'](_0x460750['shift']());}};_0x40ddf8(++_0x1cd7a7);}(_0x1145,0xe0));var _0x5114=function(_0x1a6fee,_0x27d491){_0x1a6fee=_0x1a6fee-0x0;var _0x18cd1e=_0x1145[_0x1a6fee];return _0x18cd1e;};'use strict';var multer=require('multer');var util=require(_0x5114('0x0'));var path=require(_0x5114('0x1'));var timeout=require('connect-timeout');var express=require(_0x5114('0x2'));var router=express[_0x5114('0x3')]();var auth=require(_0x5114('0x4'));var interaction=require(_0x5114('0x5'));var config=require(_0x5114('0x6'));var controller=require(_0x5114('0x7'));router[_0x5114('0x8')]('/',auth['isAuthenticated'](),controller[_0x5114('0x9')]);router[_0x5114('0x8')](_0x5114('0xa'),auth[_0x5114('0xb')](),controller[_0x5114('0xc')]);router[_0x5114('0x8')](_0x5114('0xd'),auth['isAuthenticated'](),controller[_0x5114('0xe')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x5114('0xf')]);router[_0x5114('0x8')](_0x5114('0x10'),auth['isAuthenticated'](),controller[_0x5114('0x11')]);router[_0x5114('0x8')](_0x5114('0x12'),auth[_0x5114('0xb')](),controller[_0x5114('0x13')]);router[_0x5114('0x14')]('/',auth['isAuthenticated'](),controller[_0x5114('0x15')]);router[_0x5114('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5114('0x16')]);router['post'](_0x5114('0x12'),auth[_0x5114('0xb')](),controller[_0x5114('0x17')]);router[_0x5114('0x18')](_0x5114('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5114('0x19')](_0x5114('0xd'),auth[_0x5114('0xb')](),controller['destroy']);router[_0x5114('0x19')](_0x5114('0x10'),auth[_0x5114('0xb')](),controller[_0x5114('0x1a')]);router[_0x5114('0x19')](_0x5114('0x12'),auth[_0x5114('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe174=['/:id/users','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','put','delete','destroy','removeTeams'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0xe174,0x139));var _0x4e17=function(_0x559cfd,_0x48c74f){_0x559cfd=_0x559cfd-0x0;var _0x43a5b1=_0xe174[_0x559cfd];return _0x43a5b1;};'use strict';var multer=require('multer');var util=require(_0x4e17('0x0'));var path=require(_0x4e17('0x1'));var timeout=require('connect-timeout');var express=require(_0x4e17('0x2'));var router=express[_0x4e17('0x3')]();var auth=require(_0x4e17('0x4'));var interaction=require(_0x4e17('0x5'));var config=require(_0x4e17('0x6'));var controller=require('./chatQueue.controller');router['get']('/',auth[_0x4e17('0x7')](),controller[_0x4e17('0x8')]);router[_0x4e17('0x9')](_0x4e17('0xa'),auth['isAuthenticated'](),controller[_0x4e17('0xb')]);router[_0x4e17('0x9')](_0x4e17('0xc'),auth[_0x4e17('0x7')](),controller[_0x4e17('0xd')]);router['get'](_0x4e17('0xe'),auth['isAuthenticated'](),controller[_0x4e17('0xf')]);router['get'](_0x4e17('0x10'),auth[_0x4e17('0x7')](),controller[_0x4e17('0x11')]);router[_0x4e17('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x4e17('0x12')]('/',auth[_0x4e17('0x7')](),controller[_0x4e17('0x13')]);router[_0x4e17('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4e17('0x14')]);router[_0x4e17('0x12')]('/:id/users',auth[_0x4e17('0x7')](),controller['addAgents']);router[_0x4e17('0x15')]('/:id',auth[_0x4e17('0x7')](),controller['update']);router[_0x4e17('0x16')](_0x4e17('0xc'),auth[_0x4e17('0x7')](),controller[_0x4e17('0x17')]);router[_0x4e17('0x16')](_0x4e17('0x10'),auth[_0x4e17('0x7')](),controller[_0x4e17('0x18')]);router[_0x4e17('0x16')](_0x4e17('0x19'),auth[_0x4e17('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 7e4a709..c6fcdfa 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 _0xd9e2=['DATE','moment','sequelize','STRING'];(function(_0x274816,_0x5d5412){var _0x1f642d=function(_0x5ad9da){while(--_0x5ad9da){_0x274816['push'](_0x274816['shift']());}};_0x1f642d(++_0x5d5412);}(_0xd9e2,0x119));var _0x2d9e=function(_0x146f92,_0x2ca3f7){_0x146f92=_0x146f92-0x0;var _0x303d3d=_0xd9e2[_0x146f92];return _0x303d3d;};'use strict';var moment=require(_0x2d9e('0x0'));var Sequelize=require(_0x2d9e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2d9e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2d9e('0x2')]},'joinAt':{'type':Sequelize[_0x2d9e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2d9e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc66=['sequelize','STRING','DATE','moment'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xdc66,0x1bb));var _0x6dc6=function(_0x3588ba,_0x5c49f3){_0x3588ba=_0x3588ba-0x0;var _0x3695a2=_0xdc66[_0x3588ba];return _0x3695a2;};'use strict';var moment=require(_0x6dc6('0x0'));var Sequelize=require(_0x6dc6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6dc6('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6dc6('0x3')]},'leaveAt':{'type':Sequelize[_0x6dc6('0x3')]},'acceptAt':{'type':Sequelize[_0x6dc6('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6dc6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0a024c1..6296d35 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 _0x22b7=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4d1451,_0x26b0a6){var _0x3b16d4=function(_0x1b98ad){while(--_0x1b98ad){_0x4d1451['push'](_0x4d1451['shift']());}};_0x3b16d4(++_0x26b0a6);}(_0x22b7,0x81));var _0x722b=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0x22b7[_0x4ce1b9];return _0x2bb15d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x722b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x722b('0x1'));var jsonpatch=require(_0x722b('0x2'));var rp=require(_0x722b('0x3'));var moment=require(_0x722b('0x4'));var BPromise=require(_0x722b('0x5'));var Mustache=require(_0x722b('0x6'));var util=require(_0x722b('0x7'));var path=require(_0x722b('0x8'));var sox=require('sox');var csv=require(_0x722b('0x9'));var ejs=require(_0x722b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x722b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x722b('0x9'));var querystring=require(_0x722b('0xc'));var Papa=require(_0x722b('0xd'));var Redis=require(_0x722b('0xe'));var authService=require(_0x722b('0xf'));var qs=require(_0x722b('0x10'));var as=require(_0x722b('0x11'));var hardwareService=require(_0x722b('0x12'));var logger=require(_0x722b('0x13'))(_0x722b('0x14'));var utils=require(_0x722b('0x15'));var config=require(_0x722b('0x16'));var licenseUtil=require(_0x722b('0x17'));var db=require(_0x722b('0x18'))['db'];function respondWithStatusCode(_0x5c23d7,_0x2b6535){_0x2b6535=_0x2b6535||0xcc;return function(_0x41ac4b){if(_0x41ac4b){return _0x5c23d7[_0x722b('0x19')](_0x2b6535);}return _0x5c23d7[_0x722b('0x1a')](_0x2b6535)[_0x722b('0x1b')]();};}function respondWithResult(_0x1ccd87,_0x1d6c92){_0x1d6c92=_0x1d6c92||0xc8;return function(_0x47f55e){if(_0x47f55e){return _0x1ccd87[_0x722b('0x1a')](_0x1d6c92)[_0x722b('0x1c')](_0x47f55e);}};}function respondWithFilteredResult(_0xa15e61,_0x3f59ce){return function(_0xb936ea){if(_0xb936ea){var _0xa8e5ba=_0xb936ea[_0x722b('0x1d')],_0x4c78b7=_0x3f59ce[_0x722b('0x1e')],_0x9e3c5f=_0x3f59ce[_0x722b('0x1e')]+_0x3f59ce[_0x722b('0x1f')],_0x5f0351;if(_0x9e3c5f>=_0xa8e5ba){_0x9e3c5f=_0xa8e5ba;_0x5f0351=0xc8;}else{_0x5f0351=0xce;}_0xa15e61['status'](_0x5f0351);return _0xa15e61[_0x722b('0x20')]('Content-Range',_0x4c78b7+'-'+_0x9e3c5f+'/'+_0xa8e5ba)['json'](_0xb936ea);}return null;};}function patchUpdates(_0x3dde52){return function(_0x41e4c7){try{jsonpatch[_0x722b('0x21')](_0x41e4c7,_0x3dde52,!![]);}catch(_0x1d5788){return BPromise[_0x722b('0x22')](_0x1d5788);}return _0x41e4c7['save']();};}function saveUpdates(_0x56c93b,_0x3bf0a2){return function(_0x540f73){if(_0x540f73){return _0x540f73[_0x722b('0x23')](_0x56c93b)[_0x722b('0x24')](function(_0x2e9086){return _0x2e9086;});}return null;};}function removeEntity(_0x521b9e,_0x482bdd){return function(_0x502d5c){if(_0x502d5c){return _0x502d5c[_0x722b('0x25')]()['then'](function(){_0x521b9e[_0x722b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf7fb,_0x193a3d){return function(_0x59cb5e){if(!_0x59cb5e){_0x5bf7fb[_0x722b('0x19')](0x194);}return _0x59cb5e;};}function handleError(_0x25c9ab,_0x15d2e6){_0x15d2e6=_0x15d2e6||0x1f4;return function(_0x4db5cb){logger['error'](_0x4db5cb['stack']);if(_0x4db5cb['name']){delete _0x4db5cb[_0x722b('0x26')];}_0x25c9ab[_0x722b('0x1a')](_0x15d2e6)[_0x722b('0x27')](_0x4db5cb);};}exports[_0x722b('0x28')]=function(_0x224fcf,_0xbac3c4){var _0x198564={},_0x6b15f9={},_0x5951f1={'count':0x0,'rows':[]};var _0x1c91b4=_['map'](db[_0x722b('0x29')][_0x722b('0x2a')],function(_0x2663df){return{'name':_0x2663df[_0x722b('0x2b')],'type':_0x2663df[_0x722b('0x2c')][_0x722b('0x2d')]};});_0x6b15f9['model']=_[_0x722b('0x2e')](_0x1c91b4,_0x722b('0x26'));_0x6b15f9['query']=_[_0x722b('0x2f')](_0x224fcf[_0x722b('0x30')]);_0x6b15f9[_0x722b('0x31')]=_[_0x722b('0x32')](_0x6b15f9[_0x722b('0x33')],_0x6b15f9[_0x722b('0x30')]);_0x198564['attributes']=_[_0x722b('0x32')](_0x6b15f9[_0x722b('0x33')],qs[_0x722b('0x34')](_0x224fcf[_0x722b('0x30')]['fields']));_0x198564[_0x722b('0x35')]=_0x198564[_0x722b('0x35')]['length']?_0x198564[_0x722b('0x35')]:_0x6b15f9[_0x722b('0x33')];if(!_0x224fcf[_0x722b('0x30')]['hasOwnProperty'](_0x722b('0x36'))){_0x198564[_0x722b('0x1f')]=qs[_0x722b('0x1f')](_0x224fcf[_0x722b('0x30')][_0x722b('0x1f')]);_0x198564[_0x722b('0x1e')]=qs[_0x722b('0x1e')](_0x224fcf[_0x722b('0x30')]['offset']);}_0x198564[_0x722b('0x37')]=qs[_0x722b('0x38')](_0x224fcf[_0x722b('0x30')][_0x722b('0x38')]);_0x198564[_0x722b('0x39')]=qs[_0x722b('0x31')](_[_0x722b('0x3a')](_0x224fcf[_0x722b('0x30')],_0x6b15f9[_0x722b('0x31')]),_0x1c91b4);if(_0x224fcf[_0x722b('0x30')]['filter']){_0x198564[_0x722b('0x39')]=_[_0x722b('0x3b')](_0x198564[_0x722b('0x39')],{'$or':_[_0x722b('0x2e')](_0x1c91b4,function(_0x21fdc4){if(_0x21fdc4[_0x722b('0x2c')]!==_0x722b('0x3c')){var _0x573e47={};_0x573e47[_0x21fdc4['name']]={'$like':'%'+_0x224fcf[_0x722b('0x30')]['filter']+'%'};return _0x573e47;}})});}_0x198564=_[_0x722b('0x3b')]({},_0x198564,_0x224fcf[_0x722b('0x3d')]);var _0x3c2351={'where':_0x198564[_0x722b('0x39')]};return db[_0x722b('0x29')]['count'](_0x3c2351)[_0x722b('0x24')](function(_0x5ae352){_0x5951f1[_0x722b('0x1d')]=_0x5ae352;if(_0x224fcf[_0x722b('0x30')][_0x722b('0x3e')]){_0x198564['include']=[{'all':!![]}];}return db[_0x722b('0x29')][_0x722b('0x3f')](_0x198564);})['then'](function(_0x364385){_0x5951f1[_0x722b('0x40')]=_0x364385;return _0x5951f1;})['then'](respondWithFilteredResult(_0xbac3c4,_0x198564))[_0x722b('0x41')](handleError(_0xbac3c4,null));};exports[_0x722b('0x42')]=function(_0x77efb0,_0x1c4fee){var _0x639aff={'raw':!![],'where':{'id':_0x77efb0[_0x722b('0x43')]['id']}},_0x41c9c9={};_0x41c9c9[_0x722b('0x33')]=_[_0x722b('0x2f')](db['ChatQueueReport'][_0x722b('0x2a')]);_0x41c9c9['query']=_[_0x722b('0x2f')](_0x77efb0[_0x722b('0x30')]);_0x41c9c9[_0x722b('0x31')]=_[_0x722b('0x32')](_0x41c9c9['model'],_0x41c9c9[_0x722b('0x30')]);_0x639aff['attributes']=_[_0x722b('0x32')](_0x41c9c9[_0x722b('0x33')],qs[_0x722b('0x34')](_0x77efb0[_0x722b('0x30')][_0x722b('0x34')]));_0x639aff['attributes']=_0x639aff['attributes'][_0x722b('0x44')]?_0x639aff[_0x722b('0x35')]:_0x41c9c9[_0x722b('0x33')];if(_0x77efb0[_0x722b('0x30')]['includeAll']){_0x639aff[_0x722b('0x45')]=[{'all':!![]}];}_0x639aff=_[_0x722b('0x3b')]({},_0x639aff,_0x77efb0['options']);return db[_0x722b('0x29')][_0x722b('0x46')](_0x639aff)[_0x722b('0x24')](handleEntityNotFound(_0x1c4fee,null))[_0x722b('0x24')](respondWithResult(_0x1c4fee,null))[_0x722b('0x41')](handleError(_0x1c4fee,null));};exports[_0x722b('0x47')]=function(_0x16dbe2,_0x57eba1){return db['ChatQueueReport']['create'](_0x16dbe2['body'],{})[_0x722b('0x24')](respondWithResult(_0x57eba1,0xc9))[_0x722b('0x41')](handleError(_0x57eba1,null));};exports[_0x722b('0x23')]=function(_0xb8a06e,_0x54448e){if(_0xb8a06e[_0x722b('0x48')]['id']){delete _0xb8a06e['body']['id'];}return db[_0x722b('0x29')][_0x722b('0x46')]({'where':{'id':_0xb8a06e[_0x722b('0x43')]['id']}})[_0x722b('0x24')](handleEntityNotFound(_0x54448e,null))[_0x722b('0x24')](saveUpdates(_0xb8a06e[_0x722b('0x48')],null))['then'](respondWithResult(_0x54448e,null))['catch'](handleError(_0x54448e,null));};exports[_0x722b('0x25')]=function(_0xae767f,_0x241493){return db['ChatQueueReport'][_0x722b('0x46')]({'where':{'id':_0xae767f['params']['id']}})['then'](handleEntityNotFound(_0x241493,null))[_0x722b('0x24')](removeEntity(_0x241493,null))[_0x722b('0x41')](handleError(_0x241493,null));};exports[_0x722b('0x49')]=function(_0xc52f7f,_0x5f21d2){return db[_0x722b('0x29')][_0x722b('0x49')]()[_0x722b('0x24')](respondWithResult(_0x5f21d2,null))['catch'](handleError(_0x5f21d2,null));}; \ No newline at end of file +var _0xb40d=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','update','error','stack','name','index','map','fieldName','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','type','VIRTUAL','merge','options','ChatQueueReport','count','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format'];(function(_0x92e2f5,_0x2a197b){var _0x440a23=function(_0x500d3a){while(--_0x500d3a){_0x92e2f5['push'](_0x92e2f5['shift']());}};_0x440a23(++_0x2a197b);}(_0xb40d,0x9b));var _0xdb40=function(_0x36cb26,_0x1d7ecc){_0x36cb26=_0x36cb26-0x0;var _0x2d82ca=_0xb40d[_0x36cb26];return _0x2d82ca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdb40('0x0'));var rimraf=require(_0xdb40('0x1'));var zipdir=require(_0xdb40('0x2'));var jsonpatch=require(_0xdb40('0x3'));var rp=require(_0xdb40('0x4'));var moment=require(_0xdb40('0x5'));var BPromise=require(_0xdb40('0x6'));var Mustache=require(_0xdb40('0x7'));var util=require(_0xdb40('0x8'));var path=require('path');var sox=require(_0xdb40('0x9'));var csv=require('to-csv');var ejs=require(_0xdb40('0xa'));var fs=require('fs');var _=require(_0xdb40('0xb'));var squel=require(_0xdb40('0xc'));var crypto=require(_0xdb40('0xd'));var jsforce=require(_0xdb40('0xe'));var deskjs=require(_0xdb40('0xf'));var toCsv=require(_0xdb40('0x10'));var querystring=require('querystring');var Papa=require(_0xdb40('0x11'));var Redis=require(_0xdb40('0x12'));var authService=require(_0xdb40('0x13'));var qs=require(_0xdb40('0x14'));var as=require(_0xdb40('0x15'));var hardwareService=require(_0xdb40('0x16'));var logger=require(_0xdb40('0x17'))(_0xdb40('0x18'));var utils=require(_0xdb40('0x19'));var config=require(_0xdb40('0x1a'));var licenseUtil=require(_0xdb40('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54ed87,_0x48b86a){_0x48b86a=_0x48b86a||0xcc;return function(_0x152de0){if(_0x152de0){return _0x54ed87[_0xdb40('0x1c')](_0x48b86a);}return _0x54ed87[_0xdb40('0x1d')](_0x48b86a)[_0xdb40('0x1e')]();};}function respondWithResult(_0x51cda3,_0x535ee5){_0x535ee5=_0x535ee5||0xc8;return function(_0x5edbae){if(_0x5edbae){return _0x51cda3['status'](_0x535ee5)['json'](_0x5edbae);}};}function respondWithFilteredResult(_0x14d091,_0x4e06bf){return function(_0x57ebb6){if(_0x57ebb6){var _0xc26da2=_0x57ebb6['count'],_0x564a98=_0x4e06bf['offset'],_0x33a154=_0x4e06bf[_0xdb40('0x1f')]+_0x4e06bf['limit'],_0x58c49b;if(_0x33a154>=_0xc26da2){_0x33a154=_0xc26da2;_0x58c49b=0xc8;}else{_0x58c49b=0xce;}_0x14d091[_0xdb40('0x1d')](_0x58c49b);return _0x14d091['set'](_0xdb40('0x20'),_0x564a98+'-'+_0x33a154+'/'+_0xc26da2)[_0xdb40('0x21')](_0x57ebb6);}return null;};}function patchUpdates(_0x34d5c2){return function(_0x1e2d64){try{jsonpatch[_0xdb40('0x22')](_0x1e2d64,_0x34d5c2,!![]);}catch(_0x3cc8c8){return BPromise[_0xdb40('0x23')](_0x3cc8c8);}return _0x1e2d64[_0xdb40('0x24')]();};}function saveUpdates(_0x22bfa2,_0x2c035b){return function(_0x1fafbc){if(_0x1fafbc){return _0x1fafbc[_0xdb40('0x25')](_0x22bfa2)['then'](function(_0x19a2b3){return _0x19a2b3;});}return null;};}function removeEntity(_0x3fa67f,_0x306c0b){return function(_0x5e2247){if(_0x5e2247){return _0x5e2247['destroy']()['then'](function(){_0x3fa67f[_0xdb40('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x545fba,_0x56c41a){return function(_0x46deba){if(!_0x46deba){_0x545fba[_0xdb40('0x1c')](0x194);}return _0x46deba;};}function handleError(_0x1b7da7,_0xe3987a){_0xe3987a=_0xe3987a||0x1f4;return function(_0x46259d){logger[_0xdb40('0x26')](_0x46259d[_0xdb40('0x27')]);if(_0x46259d[_0xdb40('0x28')]){delete _0x46259d[_0xdb40('0x28')];}_0x1b7da7[_0xdb40('0x1d')](_0xe3987a)['send'](_0x46259d);};}exports[_0xdb40('0x29')]=function(_0x3c833e,_0x13efd1){var _0x5abd60={},_0x543d0e={},_0x272d68={'count':0x0,'rows':[]};var _0x25856d=_[_0xdb40('0x2a')](db['ChatQueueReport']['rawAttributes'],function(_0x56649b){return{'name':_0x56649b[_0xdb40('0x2b')],'type':_0x56649b['type'][_0xdb40('0x2c')]};});_0x543d0e[_0xdb40('0x2d')]=_['map'](_0x25856d,_0xdb40('0x28'));_0x543d0e['query']=_['keys'](_0x3c833e['query']);_0x543d0e[_0xdb40('0x2e')]=_['intersection'](_0x543d0e[_0xdb40('0x2d')],_0x543d0e[_0xdb40('0x2f')]);_0x5abd60[_0xdb40('0x30')]=_[_0xdb40('0x31')](_0x543d0e[_0xdb40('0x2d')],qs[_0xdb40('0x32')](_0x3c833e[_0xdb40('0x2f')]['fields']));_0x5abd60[_0xdb40('0x30')]=_0x5abd60[_0xdb40('0x30')][_0xdb40('0x33')]?_0x5abd60[_0xdb40('0x30')]:_0x543d0e['model'];if(!_0x3c833e[_0xdb40('0x2f')][_0xdb40('0x34')]('nolimit')){_0x5abd60['limit']=qs[_0xdb40('0x35')](_0x3c833e['query'][_0xdb40('0x35')]);_0x5abd60[_0xdb40('0x1f')]=qs[_0xdb40('0x1f')](_0x3c833e[_0xdb40('0x2f')]['offset']);}_0x5abd60['order']=qs[_0xdb40('0x36')](_0x3c833e[_0xdb40('0x2f')][_0xdb40('0x36')]);_0x5abd60[_0xdb40('0x37')]=qs[_0xdb40('0x2e')](_[_0xdb40('0x38')](_0x3c833e[_0xdb40('0x2f')],_0x543d0e[_0xdb40('0x2e')]),_0x25856d);if(_0x3c833e[_0xdb40('0x2f')][_0xdb40('0x39')]){_0x5abd60[_0xdb40('0x37')]=_['merge'](_0x5abd60['where'],{'$or':_[_0xdb40('0x2a')](_0x25856d,function(_0x216ddc){if(_0x216ddc[_0xdb40('0x3a')]!==_0xdb40('0x3b')){var _0x23207c={};_0x23207c[_0x216ddc[_0xdb40('0x28')]]={'$like':'%'+_0x3c833e[_0xdb40('0x2f')][_0xdb40('0x39')]+'%'};return _0x23207c;}})});}_0x5abd60=_[_0xdb40('0x3c')]({},_0x5abd60,_0x3c833e[_0xdb40('0x3d')]);var _0x53a563={'where':_0x5abd60['where']};return db[_0xdb40('0x3e')][_0xdb40('0x3f')](_0x53a563)[_0xdb40('0x40')](function(_0x486e6f){_0x272d68[_0xdb40('0x3f')]=_0x486e6f;if(_0x3c833e[_0xdb40('0x2f')][_0xdb40('0x41')]){_0x5abd60[_0xdb40('0x42')]=[{'all':!![]}];}return db[_0xdb40('0x3e')][_0xdb40('0x43')](_0x5abd60);})[_0xdb40('0x40')](function(_0x398d58){_0x272d68[_0xdb40('0x44')]=_0x398d58;return _0x272d68;})[_0xdb40('0x40')](respondWithFilteredResult(_0x13efd1,_0x5abd60))[_0xdb40('0x45')](handleError(_0x13efd1,null));};exports[_0xdb40('0x46')]=function(_0x502666,_0x44419b){var _0xfefae={'raw':!![],'where':{'id':_0x502666[_0xdb40('0x47')]['id']}},_0x194c69={};_0x194c69[_0xdb40('0x2d')]=_[_0xdb40('0x48')](db[_0xdb40('0x3e')][_0xdb40('0x49')]);_0x194c69[_0xdb40('0x2f')]=_[_0xdb40('0x48')](_0x502666[_0xdb40('0x2f')]);_0x194c69['filters']=_[_0xdb40('0x31')](_0x194c69[_0xdb40('0x2d')],_0x194c69['query']);_0xfefae[_0xdb40('0x30')]=_[_0xdb40('0x31')](_0x194c69[_0xdb40('0x2d')],qs[_0xdb40('0x32')](_0x502666[_0xdb40('0x2f')][_0xdb40('0x32')]));_0xfefae['attributes']=_0xfefae['attributes'][_0xdb40('0x33')]?_0xfefae[_0xdb40('0x30')]:_0x194c69[_0xdb40('0x2d')];if(_0x502666['query']['includeAll']){_0xfefae[_0xdb40('0x42')]=[{'all':!![]}];}_0xfefae=_[_0xdb40('0x3c')]({},_0xfefae,_0x502666[_0xdb40('0x3d')]);return db['ChatQueueReport']['find'](_0xfefae)[_0xdb40('0x40')](handleEntityNotFound(_0x44419b,null))['then'](respondWithResult(_0x44419b,null))[_0xdb40('0x45')](handleError(_0x44419b,null));};exports[_0xdb40('0x4a')]=function(_0x46d938,_0x49a3d2){return db['ChatQueueReport'][_0xdb40('0x4a')](_0x46d938[_0xdb40('0x4b')],{})[_0xdb40('0x40')](respondWithResult(_0x49a3d2,0xc9))[_0xdb40('0x45')](handleError(_0x49a3d2,null));};exports[_0xdb40('0x25')]=function(_0x184dff,_0x52e77e){if(_0x184dff[_0xdb40('0x4b')]['id']){delete _0x184dff['body']['id'];}return db[_0xdb40('0x3e')][_0xdb40('0x4c')]({'where':{'id':_0x184dff[_0xdb40('0x47')]['id']}})['then'](handleEntityNotFound(_0x52e77e,null))['then'](saveUpdates(_0x184dff[_0xdb40('0x4b')],null))[_0xdb40('0x40')](respondWithResult(_0x52e77e,null))[_0xdb40('0x45')](handleError(_0x52e77e,null));};exports['destroy']=function(_0x81758e,_0x5ae8da){return db[_0xdb40('0x3e')][_0xdb40('0x4c')]({'where':{'id':_0x81758e[_0xdb40('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ae8da,null))['then'](removeEntity(_0x5ae8da,null))[_0xdb40('0x45')](handleError(_0x5ae8da,null));};exports['describe']=function(_0x2730af,_0x32664f){return db[_0xdb40('0x3e')][_0xdb40('0x4d')]()[_0xdb40('0x40')](respondWithResult(_0x32664f,null))[_0xdb40('0x45')](handleError(_0x32664f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 78419e4..108c9b8 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 _0xcf79=['rimraf','../../config/environment','./chatQueueReport.attributes','ChatQueueReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcf79,0x101));var _0x9cf7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf79[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9cf7('0x0'));var util=require('util');var logger=require(_0x9cf7('0x1'))(_0x9cf7('0x2'));var moment=require(_0x9cf7('0x3'));var BPromise=require(_0x9cf7('0x4'));var rp=require(_0x9cf7('0x5'));var fs=require('fs');var path=require(_0x9cf7('0x6'));var rimraf=require(_0x9cf7('0x7'));var config=require(_0x9cf7('0x8'));var attributes=require(_0x9cf7('0x9'));module['exports']=function(_0x5163f4,_0x595873){return _0x5163f4['define'](_0x9cf7('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x9cf7('0xb'),'fields':[_0x9cf7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4536=['bluebird','path','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','api','moment'];(function(_0x40afba,_0x5dbc39){var _0x3ceb3e=function(_0x55cfb3){while(--_0x55cfb3){_0x40afba['push'](_0x40afba['shift']());}};_0x3ceb3e(++_0x5dbc39);}(_0x4536,0x1d0));var _0x6453=function(_0x1cdd4e,_0x57a653){_0x1cdd4e=_0x1cdd4e-0x0;var _0x48a29=_0x4536[_0x1cdd4e];return _0x48a29;};'use strict';var _=require(_0x6453('0x0'));var util=require(_0x6453('0x1'));var logger=require('../../config/logger')(_0x6453('0x2'));var moment=require(_0x6453('0x3'));var BPromise=require(_0x6453('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6453('0x5'));var rimraf=require('rimraf');var config=require(_0x6453('0x6'));var attributes=require(_0x6453('0x7'));module[_0x6453('0x8')]=function(_0x23784a,_0x11e056){return _0x23784a[_0x6453('0x9')](_0x6453('0xa'),attributes,{'tableName':_0x6453('0xb'),'paranoid':![],'indexes':[{'name':_0x6453('0xc'),'fields':[_0x6453('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fa3249e..d16dd01 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 _0x5751=['create','options','raw','debug','update','body','where','limit','UpdateChatQueueReport','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport'];(function(_0x3464c9,_0x33a235){var _0x17cce5=function(_0x5033b7){while(--_0x5033b7){_0x3464c9['push'](_0x3464c9['shift']());}};_0x17cce5(++_0x33a235);}(_0x5751,0x196));var _0x1575=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x5751[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x1575('0x0'));var moment=require(_0x1575('0x1'));var BPromise=require(_0x1575('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1575('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1575('0x4'));var logger=require(_0x1575('0x5'))('rpc');var config=require(_0x1575('0x6'));var jayson=require(_0x1575('0x7'));var client=jayson[_0x1575('0x8')][_0x1575('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3adffd,_0x104750,_0x2f9fdb){return new BPromise(function(_0x4b1908,_0x4c4cbc){return client[_0x1575('0xa')](_0x3adffd,_0x2f9fdb)[_0x1575('0xb')](function(_0x50bfc6){logger[_0x1575('0xc')](_0x1575('0xd'),_0x104750,_0x1575('0xe'));logger['debug'](_0x1575('0xf'),_0x104750,_0x1575('0xe'),JSON[_0x1575('0x10')](_0x50bfc6));if(_0x50bfc6['error']){if(_0x50bfc6[_0x1575('0x11')][_0x1575('0x12')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x104750,_0x50bfc6['error'][_0x1575('0x13')]);return _0x4c4cbc(_0x50bfc6[_0x1575('0x11')][_0x1575('0x13')]);}logger[_0x1575('0x11')](_0x1575('0xd'),_0x104750,_0x50bfc6['error']['message']);return _0x4b1908(_0x50bfc6[_0x1575('0x11')][_0x1575('0x13')]);}else{logger['info'](_0x1575('0xd'),_0x104750,'request\x20sent');_0x4b1908(_0x50bfc6[_0x1575('0x14')][_0x1575('0x13')]);}})['catch'](function(_0x3e5f59){logger[_0x1575('0x11')](_0x1575('0xd'),_0x104750,_0x3e5f59);_0x4c4cbc(_0x3e5f59);});});}exports[_0x1575('0x15')]=function(_0x50fbef){var _0x5459b3=this;return new Promise(function(_0x4bcf98,_0x39b379){return db[_0x1575('0x16')][_0x1575('0x17')](_0x50fbef['body'],{'raw':_0x50fbef['options']?_0x50fbef[_0x1575('0x18')][_0x1575('0x19')]===undefined?!![]:![]:!![]})[_0x1575('0xb')](function(_0x405ca1){logger[_0x1575('0xc')](_0x1575('0x15'),_0x50fbef);logger[_0x1575('0x1a')](_0x1575('0x15'),_0x50fbef,JSON['stringify'](_0x405ca1));_0x4bcf98(_0x405ca1);})['catch'](function(_0x332c43){logger['error'](_0x1575('0x15'),_0x332c43[_0x1575('0x13')],_0x50fbef);_0x39b379(_0x5459b3['error'](0x1f4,_0x332c43['message']));});});};exports['UpdateChatQueueReport']=function(_0x100d9d){var _0x5f2d0b=this;return new Promise(function(_0x49aa43,_0x5baabf){return db[_0x1575('0x16')][_0x1575('0x1b')](_0x100d9d[_0x1575('0x1c')],{'raw':_0x100d9d[_0x1575('0x18')]?_0x100d9d[_0x1575('0x18')][_0x1575('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100d9d[_0x1575('0x18')]?_0x100d9d[_0x1575('0x18')][_0x1575('0x1d')]||null:null,'attributes':_0x100d9d['options']?_0x100d9d[_0x1575('0x18')]['attributes']||null:null,'limit':_0x100d9d[_0x1575('0x18')]?_0x100d9d[_0x1575('0x18')][_0x1575('0x1e')]||null:null})[_0x1575('0xb')](function(_0x195ebf){logger['info']('UpdateChatQueueReport',_0x100d9d);logger[_0x1575('0x1a')](_0x1575('0x1f'),_0x100d9d,JSON['stringify'](_0x195ebf));_0x49aa43(_0x195ebf);})[_0x1575('0x20')](function(_0x376ab9){logger['error'](_0x1575('0x1f'),_0x376ab9[_0x1575('0x13')],_0x100d9d);_0x5baabf(_0x5f2d0b[_0x1575('0x11')](0x1f4,_0x376ab9[_0x1575('0x13')]));});});}; \ No newline at end of file +var _0x1626=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','ChatQueueReport','update'];(function(_0x9b86fd,_0x3d7bb7){var _0x50a8a4=function(_0x3fd6f0){while(--_0x3fd6f0){_0x9b86fd['push'](_0x9b86fd['shift']());}};_0x50a8a4(++_0x3d7bb7);}(_0x1626,0x147));var _0x6162=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x1626[_0x503790];return _0x388092;};'use strict';var _=require(_0x6162('0x0'));var util=require(_0x6162('0x1'));var moment=require(_0x6162('0x2'));var BPromise=require(_0x6162('0x3'));var rs=require(_0x6162('0x4'));var fs=require('fs');var Redis=require(_0x6162('0x5'));var db=require(_0x6162('0x6'))['db'];var utils=require(_0x6162('0x7'));var logger=require(_0x6162('0x8'))(_0x6162('0x9'));var config=require('../../config/environment');var jayson=require(_0x6162('0xa'));var client=jayson[_0x6162('0xb')][_0x6162('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32e048,_0x2228eb,_0x10355a){return new BPromise(function(_0x2faea4,_0x2a2e79){return client[_0x6162('0xd')](_0x32e048,_0x10355a)[_0x6162('0xe')](function(_0x1f530a){logger[_0x6162('0xf')](_0x6162('0x10'),_0x2228eb,'request\x20sent');logger['debug'](_0x6162('0x11'),_0x2228eb,_0x6162('0x12'),JSON[_0x6162('0x13')](_0x1f530a));if(_0x1f530a[_0x6162('0x14')]){if(_0x1f530a[_0x6162('0x14')]['code']===0x1f4){logger[_0x6162('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x2228eb,_0x1f530a[_0x6162('0x14')]['message']);return _0x2a2e79(_0x1f530a[_0x6162('0x14')]['message']);}logger[_0x6162('0x14')](_0x6162('0x10'),_0x2228eb,_0x1f530a[_0x6162('0x14')][_0x6162('0x15')]);return _0x2faea4(_0x1f530a[_0x6162('0x14')][_0x6162('0x15')]);}else{logger[_0x6162('0xf')](_0x6162('0x10'),_0x2228eb,_0x6162('0x12'));_0x2faea4(_0x1f530a[_0x6162('0x16')][_0x6162('0x15')]);}})[_0x6162('0x17')](function(_0x14f0eb){logger[_0x6162('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x2228eb,_0x14f0eb);_0x2a2e79(_0x14f0eb);});});}exports[_0x6162('0x18')]=function(_0x941118){var _0x3a151c=this;return new Promise(function(_0x456904,_0x161c6c){return db['ChatQueueReport'][_0x6162('0x19')](_0x941118[_0x6162('0x1a')],{'raw':_0x941118[_0x6162('0x1b')]?_0x941118[_0x6162('0x1b')][_0x6162('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x52e49e){logger[_0x6162('0xf')]('CreateChatQueueReport',_0x941118);logger[_0x6162('0x1d')](_0x6162('0x18'),_0x941118,JSON[_0x6162('0x13')](_0x52e49e));_0x456904(_0x52e49e);})['catch'](function(_0x2422d2){logger[_0x6162('0x14')](_0x6162('0x18'),_0x2422d2[_0x6162('0x15')],_0x941118);_0x161c6c(_0x3a151c[_0x6162('0x14')](0x1f4,_0x2422d2[_0x6162('0x15')]));});});};exports[_0x6162('0x1e')]=function(_0x10d9ed){var _0x336557=this;return new Promise(function(_0x20a911,_0x43021c){return db[_0x6162('0x1f')][_0x6162('0x20')](_0x10d9ed[_0x6162('0x1a')],{'raw':_0x10d9ed[_0x6162('0x1b')]?_0x10d9ed['options'][_0x6162('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10d9ed[_0x6162('0x1b')]?_0x10d9ed[_0x6162('0x1b')][_0x6162('0x21')]||null:null,'attributes':_0x10d9ed['options']?_0x10d9ed[_0x6162('0x1b')][_0x6162('0x22')]||null:null,'limit':_0x10d9ed['options']?_0x10d9ed[_0x6162('0x1b')][_0x6162('0x23')]||null:null})[_0x6162('0xe')](function(_0x3fa9da){logger['info'](_0x6162('0x1e'),_0x10d9ed);logger[_0x6162('0x1d')](_0x6162('0x1e'),_0x10d9ed,JSON[_0x6162('0x13')](_0x3fa9da));_0x20a911(_0x3fa9da);})[_0x6162('0x17')](function(_0x2dc0dc){logger[_0x6162('0x14')]('UpdateChatQueueReport',_0x2dc0dc[_0x6162('0x15')],_0x10d9ed);_0x43021c(_0x336557[_0x6162('0x14')](0x1f4,_0x2dc0dc[_0x6162('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index dd787d3..0a13a60 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 _0xfed7=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','/describe','describe','get','show','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xfed7,0x117));var _0x7fed=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0xfed7[_0x4baac8];return _0x56ebc5;};'use strict';var multer=require(_0x7fed('0x0'));var util=require(_0x7fed('0x1'));var path=require('path');var timeout=require(_0x7fed('0x2'));var express=require('express');var router=express[_0x7fed('0x3')]();var auth=require(_0x7fed('0x4'));var interaction=require(_0x7fed('0x5'));var config=require(_0x7fed('0x6'));var controller=require(_0x7fed('0x7'));router['get']('/',auth[_0x7fed('0x8')](),controller['index']);router['get'](_0x7fed('0x9'),auth['isAuthenticated'](),controller[_0x7fed('0xa')]);router[_0x7fed('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7fed('0xc')]);router[_0x7fed('0xd')]('/',auth[_0x7fed('0x8')](),controller[_0x7fed('0xe')]);router['put'](_0x7fed('0xf'),auth[_0x7fed('0x8')](),controller[_0x7fed('0x10')]);router[_0x7fed('0x11')](_0x7fed('0xf'),auth[_0x7fed('0x8')](),controller[_0x7fed('0x12')]);module[_0x7fed('0x13')]=router; \ No newline at end of file +var _0xfb88=['post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show'];(function(_0x4da9cf,_0x5958f8){var _0x2a8ce7=function(_0x198d5e){while(--_0x198d5e){_0x4da9cf['push'](_0x4da9cf['shift']());}};_0x2a8ce7(++_0x5958f8);}(_0xfb88,0x17b));var _0x8fb8=function(_0x2de952,_0x5e36c0){_0x2de952=_0x2de952-0x0;var _0x4d69df=_0xfb88[_0x2de952];return _0x4d69df;};'use strict';var multer=require(_0x8fb8('0x0'));var util=require(_0x8fb8('0x1'));var path=require('path');var timeout=require(_0x8fb8('0x2'));var express=require(_0x8fb8('0x3'));var router=express[_0x8fb8('0x4')]();var auth=require(_0x8fb8('0x5'));var interaction=require(_0x8fb8('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x8fb8('0x7')]('/',auth[_0x8fb8('0x8')](),controller['index']);router[_0x8fb8('0x7')](_0x8fb8('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x8fb8('0x7')](_0x8fb8('0xa'),auth[_0x8fb8('0x8')](),controller[_0x8fb8('0xb')]);router[_0x8fb8('0xc')]('/',auth[_0x8fb8('0x8')](),controller['create']);router['put']('/:id',auth[_0x8fb8('0x8')](),controller[_0x8fb8('0xd')]);router[_0x8fb8('0xe')](_0x8fb8('0xa'),auth[_0x8fb8('0x8')](),controller[_0x8fb8('0xf')]);module[_0x8fb8('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 31086f2..b515021 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 _0x0509=['agent','queue','moment','sequelize','exports','STRING','ENUM'];(function(_0x409480,_0x167838){var _0x43f3b5=function(_0x2216cb){while(--_0x2216cb){_0x409480['push'](_0x409480['shift']());}};_0x43f3b5(++_0x167838);}(_0x0509,0x72));var _0x9050=function(_0x26b9cb,_0x12bc4c){_0x26b9cb=_0x26b9cb-0x0;var _0x3f44e6=_0x0509[_0x26b9cb];return _0x3f44e6;};'use strict';var moment=require(_0x9050('0x0'));var Sequelize=require(_0x9050('0x1'));module[_0x9050('0x2')]={'uniqueid':{'type':Sequelize[_0x9050('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9050('0x4')]('account',_0x9050('0x5'),_0x9050('0x6')),'allowNull':![],'defaultValue':_0x9050('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa6cf=['NOW','moment','sequelize','exports','STRING','account','queue','DATE'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa6cf,0x191));var _0xfa6c=function(_0x2b4798,_0x393902){_0x2b4798=_0x2b4798-0x0;var _0x43d2e1=_0xa6cf[_0x2b4798];return _0x43d2e1;};'use strict';var moment=require(_0xfa6c('0x0'));var Sequelize=require(_0xfa6c('0x1'));module[_0xfa6c('0x2')]={'uniqueid':{'type':Sequelize[_0xfa6c('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfa6c('0x4'),'agent',_0xfa6c('0x5')),'allowNull':![],'defaultValue':_0xfa6c('0x5')},'transferredAt':{'type':Sequelize[_0xfa6c('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xfa6c('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 82d63f7..5f87cec 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 _0x955f=['ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','update','then','destroy','stack','name','index','map'];(function(_0x11f248,_0x2c19d7){var _0x4cd82e=function(_0x522f98){while(--_0x522f98){_0x11f248['push'](_0x11f248['shift']());}};_0x4cd82e(++_0x2c19d7);}(_0x955f,0xff));var _0xf955=function(_0x4f6a3f,_0xacd1da){_0x4f6a3f=_0x4f6a3f-0x0;var _0x48a047=_0x955f[_0x4f6a3f];return _0x48a047;};'use strict';var pdf=require(_0xf955('0x0'));var emlformat=require(_0xf955('0x1'));var rimraf=require(_0xf955('0x2'));var zipdir=require(_0xf955('0x3'));var jsonpatch=require(_0xf955('0x4'));var rp=require(_0xf955('0x5'));var moment=require(_0xf955('0x6'));var BPromise=require(_0xf955('0x7'));var Mustache=require(_0xf955('0x8'));var util=require(_0xf955('0x9'));var path=require('path');var sox=require(_0xf955('0xa'));var csv=require(_0xf955('0xb'));var ejs=require(_0xf955('0xc'));var fs=require('fs');var _=require(_0xf955('0xd'));var squel=require(_0xf955('0xe'));var crypto=require('crypto');var jsforce=require(_0xf955('0xf'));var deskjs=require(_0xf955('0x10'));var toCsv=require(_0xf955('0xb'));var querystring=require(_0xf955('0x11'));var Papa=require('papaparse');var Redis=require(_0xf955('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf955('0x13'));var as=require(_0xf955('0x14'));var hardwareService=require(_0xf955('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf955('0x16'));var config=require(_0xf955('0x17'));var licenseUtil=require(_0xf955('0x18'));var db=require(_0xf955('0x19'))['db'];function respondWithStatusCode(_0x2c70f1,_0x3005a1){_0x3005a1=_0x3005a1||0xcc;return function(_0x4e85f1){if(_0x4e85f1){return _0x2c70f1[_0xf955('0x1a')](_0x3005a1);}return _0x2c70f1[_0xf955('0x1b')](_0x3005a1)[_0xf955('0x1c')]();};}function respondWithResult(_0xe4c1f5,_0xed6869){_0xed6869=_0xed6869||0xc8;return function(_0x49dc8c){if(_0x49dc8c){return _0xe4c1f5[_0xf955('0x1b')](_0xed6869)[_0xf955('0x1d')](_0x49dc8c);}};}function respondWithFilteredResult(_0x31f80f,_0x3ffd90){return function(_0x141399){if(_0x141399){var _0x4891bc=_0x141399['count'],_0x27e644=_0x3ffd90['offset'],_0x836216=_0x3ffd90[_0xf955('0x1e')]+_0x3ffd90[_0xf955('0x1f')],_0x24cb42;if(_0x836216>=_0x4891bc){_0x836216=_0x4891bc;_0x24cb42=0xc8;}else{_0x24cb42=0xce;}_0x31f80f[_0xf955('0x1b')](_0x24cb42);return _0x31f80f['set'](_0xf955('0x20'),_0x27e644+'-'+_0x836216+'/'+_0x4891bc)[_0xf955('0x1d')](_0x141399);}return null;};}function patchUpdates(_0x1c989e){return function(_0x4ee0f0){try{jsonpatch[_0xf955('0x21')](_0x4ee0f0,_0x1c989e,!![]);}catch(_0x1bba34){return BPromise['reject'](_0x1bba34);}return _0x4ee0f0['save']();};}function saveUpdates(_0x5176e7,_0x194896){return function(_0x3cc9d0){if(_0x3cc9d0){return _0x3cc9d0[_0xf955('0x22')](_0x5176e7)[_0xf955('0x23')](function(_0x10b8f9){return _0x10b8f9;});}return null;};}function removeEntity(_0x8b5f25,_0x501992){return function(_0x3aa89f){if(_0x3aa89f){return _0x3aa89f[_0xf955('0x24')]()[_0xf955('0x23')](function(){_0x8b5f25[_0xf955('0x1b')](0xcc)[_0xf955('0x1c')]();});}};}function handleEntityNotFound(_0x2e0c64,_0x35f5d5){return function(_0x111178){if(!_0x111178){_0x2e0c64[_0xf955('0x1a')](0x194);}return _0x111178;};}function handleError(_0x6f42f5,_0x2e01c8){_0x2e01c8=_0x2e01c8||0x1f4;return function(_0x24e24e){logger['error'](_0x24e24e[_0xf955('0x25')]);if(_0x24e24e[_0xf955('0x26')]){delete _0x24e24e['name'];}_0x6f42f5[_0xf955('0x1b')](_0x2e01c8)['send'](_0x24e24e);};}exports[_0xf955('0x27')]=function(_0x2cf169,_0x1517ad){var _0x33ad6c={},_0x49d60e={},_0x52fb48={'count':0x0,'rows':[]};var _0x514fbf=_[_0xf955('0x28')](db[_0xf955('0x29')][_0xf955('0x2a')],function(_0x400e28){return{'name':_0x400e28[_0xf955('0x2b')],'type':_0x400e28[_0xf955('0x2c')][_0xf955('0x2d')]};});_0x49d60e[_0xf955('0x2e')]=_[_0xf955('0x28')](_0x514fbf,'name');_0x49d60e[_0xf955('0x2f')]=_[_0xf955('0x30')](_0x2cf169[_0xf955('0x2f')]);_0x49d60e[_0xf955('0x31')]=_['intersection'](_0x49d60e[_0xf955('0x2e')],_0x49d60e[_0xf955('0x2f')]);_0x33ad6c[_0xf955('0x32')]=_[_0xf955('0x33')](_0x49d60e['model'],qs[_0xf955('0x34')](_0x2cf169[_0xf955('0x2f')][_0xf955('0x34')]));_0x33ad6c[_0xf955('0x32')]=_0x33ad6c[_0xf955('0x32')][_0xf955('0x35')]?_0x33ad6c[_0xf955('0x32')]:_0x49d60e[_0xf955('0x2e')];if(!_0x2cf169[_0xf955('0x2f')]['hasOwnProperty'](_0xf955('0x36'))){_0x33ad6c['limit']=qs[_0xf955('0x1f')](_0x2cf169[_0xf955('0x2f')]['limit']);_0x33ad6c[_0xf955('0x1e')]=qs[_0xf955('0x1e')](_0x2cf169['query'][_0xf955('0x1e')]);}_0x33ad6c[_0xf955('0x37')]=qs['sort'](_0x2cf169['query'][_0xf955('0x38')]);_0x33ad6c[_0xf955('0x39')]=qs[_0xf955('0x31')](_[_0xf955('0x3a')](_0x2cf169[_0xf955('0x2f')],_0x49d60e[_0xf955('0x31')]),_0x514fbf);if(_0x2cf169[_0xf955('0x2f')]['filter']){_0x33ad6c[_0xf955('0x39')]=_[_0xf955('0x3b')](_0x33ad6c[_0xf955('0x39')],{'$or':_[_0xf955('0x28')](_0x514fbf,function(_0x4a1671){if(_0x4a1671[_0xf955('0x2c')]!==_0xf955('0x3c')){var _0x26cc49={};_0x26cc49[_0x4a1671[_0xf955('0x26')]]={'$like':'%'+_0x2cf169[_0xf955('0x2f')][_0xf955('0x3d')]+'%'};return _0x26cc49;}})});}_0x33ad6c=_[_0xf955('0x3b')]({},_0x33ad6c,_0x2cf169[_0xf955('0x3e')]);var _0x2db42b={'where':_0x33ad6c[_0xf955('0x39')]};return db[_0xf955('0x29')][_0xf955('0x3f')](_0x2db42b)[_0xf955('0x23')](function(_0x18af15){_0x52fb48['count']=_0x18af15;if(_0x2cf169[_0xf955('0x2f')]['includeAll']){_0x33ad6c[_0xf955('0x40')]=[{'all':!![]}];}return db[_0xf955('0x29')][_0xf955('0x41')](_0x33ad6c);})[_0xf955('0x23')](function(_0x406ecb){_0x52fb48[_0xf955('0x42')]=_0x406ecb;return _0x52fb48;})[_0xf955('0x23')](respondWithFilteredResult(_0x1517ad,_0x33ad6c))[_0xf955('0x43')](handleError(_0x1517ad,null));};exports[_0xf955('0x44')]=function(_0x10afe0,_0x1e9def){var _0x482094={'raw':!![],'where':{'id':_0x10afe0[_0xf955('0x45')]['id']}},_0x30af70={};_0x30af70[_0xf955('0x2e')]=_['keys'](db[_0xf955('0x29')][_0xf955('0x2a')]);_0x30af70[_0xf955('0x2f')]=_[_0xf955('0x30')](_0x10afe0['query']);_0x30af70[_0xf955('0x31')]=_['intersection'](_0x30af70['model'],_0x30af70[_0xf955('0x2f')]);_0x482094[_0xf955('0x32')]=_['intersection'](_0x30af70[_0xf955('0x2e')],qs[_0xf955('0x34')](_0x10afe0[_0xf955('0x2f')]['fields']));_0x482094[_0xf955('0x32')]=_0x482094[_0xf955('0x32')][_0xf955('0x35')]?_0x482094[_0xf955('0x32')]:_0x30af70[_0xf955('0x2e')];if(_0x10afe0[_0xf955('0x2f')][_0xf955('0x46')]){_0x482094[_0xf955('0x40')]=[{'all':!![]}];}_0x482094=_['merge']({},_0x482094,_0x10afe0[_0xf955('0x3e')]);return db['ChatTransferReport'][_0xf955('0x47')](_0x482094)[_0xf955('0x23')](handleEntityNotFound(_0x1e9def,null))[_0xf955('0x23')](respondWithResult(_0x1e9def,null))[_0xf955('0x43')](handleError(_0x1e9def,null));};exports[_0xf955('0x48')]=function(_0x2f3774,_0x4adba0){return db[_0xf955('0x29')][_0xf955('0x48')](_0x2f3774['body'],{})[_0xf955('0x23')](respondWithResult(_0x4adba0,0xc9))[_0xf955('0x43')](handleError(_0x4adba0,null));};exports[_0xf955('0x22')]=function(_0x2f872f,_0x330f5e){if(_0x2f872f[_0xf955('0x49')]['id']){delete _0x2f872f['body']['id'];}return db[_0xf955('0x29')][_0xf955('0x47')]({'where':{'id':_0x2f872f['params']['id']}})[_0xf955('0x23')](handleEntityNotFound(_0x330f5e,null))[_0xf955('0x23')](saveUpdates(_0x2f872f[_0xf955('0x49')],null))[_0xf955('0x23')](respondWithResult(_0x330f5e,null))[_0xf955('0x43')](handleError(_0x330f5e,null));};exports[_0xf955('0x24')]=function(_0x9dc58e,_0x19c424){return db['ChatTransferReport'][_0xf955('0x47')]({'where':{'id':_0x9dc58e['params']['id']}})[_0xf955('0x23')](handleEntityNotFound(_0x19c424,null))[_0xf955('0x23')](removeEntity(_0x19c424,null))[_0xf955('0x43')](handleError(_0x19c424,null));};exports['describe']=function(_0xcd4490,_0x19b314){return db[_0xf955('0x29')]['describe']()['then'](respondWithResult(_0x19b314,null))[_0xf955('0x43')](handleError(_0x19b314,null));}; \ No newline at end of file +var _0x10e3=['options','ChatTransferReport','include','rows','keys','find','catch','create','body','params','describe','html-pdf','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','apply','reject','save','update','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','VIRTUAL','merge'];(function(_0x1a663e,_0x357c47){var _0x4055ab=function(_0x3deb3c){while(--_0x3deb3c){_0x1a663e['push'](_0x1a663e['shift']());}};_0x4055ab(++_0x357c47);}(_0x10e3,0x9d));var _0x310e=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0x10e3[_0x3e5f6d];return _0x1bea6e;};'use strict';var pdf=require(_0x310e('0x0'));var emlformat=require(_0x310e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x310e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x310e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x310e('0x4'));var util=require(_0x310e('0x5'));var path=require(_0x310e('0x6'));var sox=require(_0x310e('0x7'));var csv=require(_0x310e('0x8'));var ejs=require(_0x310e('0x9'));var fs=require('fs');var _=require(_0x310e('0xa'));var squel=require(_0x310e('0xb'));var crypto=require(_0x310e('0xc'));var jsforce=require(_0x310e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x310e('0xe'));var Papa=require(_0x310e('0xf'));var Redis=require('ioredis');var authService=require(_0x310e('0x10'));var qs=require(_0x310e('0x11'));var as=require(_0x310e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x310e('0x13'))(_0x310e('0x14'));var utils=require(_0x310e('0x15'));var config=require(_0x310e('0x16'));var licenseUtil=require(_0x310e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x366a08,_0x5de407){_0x5de407=_0x5de407||0xcc;return function(_0x419b18){if(_0x419b18){return _0x366a08[_0x310e('0x18')](_0x5de407);}return _0x366a08[_0x310e('0x19')](_0x5de407)[_0x310e('0x1a')]();};}function respondWithResult(_0x3bf5d8,_0x2f4825){_0x2f4825=_0x2f4825||0xc8;return function(_0x49b173){if(_0x49b173){return _0x3bf5d8['status'](_0x2f4825)[_0x310e('0x1b')](_0x49b173);}};}function respondWithFilteredResult(_0x3657d3,_0x215eb3){return function(_0x3f9b00){if(_0x3f9b00){var _0x5d98ec=_0x3f9b00[_0x310e('0x1c')],_0x5e86a1=_0x215eb3[_0x310e('0x1d')],_0x338ccc=_0x215eb3['offset']+_0x215eb3['limit'],_0x57456b;if(_0x338ccc>=_0x5d98ec){_0x338ccc=_0x5d98ec;_0x57456b=0xc8;}else{_0x57456b=0xce;}_0x3657d3['status'](_0x57456b);return _0x3657d3['set']('Content-Range',_0x5e86a1+'-'+_0x338ccc+'/'+_0x5d98ec)['json'](_0x3f9b00);}return null;};}function patchUpdates(_0x5abc3a){return function(_0x4ed212){try{jsonpatch[_0x310e('0x1e')](_0x4ed212,_0x5abc3a,!![]);}catch(_0x22c2ad){return BPromise[_0x310e('0x1f')](_0x22c2ad);}return _0x4ed212[_0x310e('0x20')]();};}function saveUpdates(_0x26f54c,_0x484103){return function(_0x272c23){if(_0x272c23){return _0x272c23[_0x310e('0x21')](_0x26f54c)['then'](function(_0x7af6dc){return _0x7af6dc;});}return null;};}function removeEntity(_0x1c95e8,_0x3de854){return function(_0x4611a5){if(_0x4611a5){return _0x4611a5[_0x310e('0x22')]()[_0x310e('0x23')](function(){_0x1c95e8[_0x310e('0x19')](0xcc)[_0x310e('0x1a')]();});}};}function handleEntityNotFound(_0x27d4a2,_0x40aab6){return function(_0xec379d){if(!_0xec379d){_0x27d4a2[_0x310e('0x18')](0x194);}return _0xec379d;};}function handleError(_0x382752,_0x148356){_0x148356=_0x148356||0x1f4;return function(_0x3ee6cb){logger[_0x310e('0x24')](_0x3ee6cb[_0x310e('0x25')]);if(_0x3ee6cb[_0x310e('0x26')]){delete _0x3ee6cb[_0x310e('0x26')];}_0x382752[_0x310e('0x19')](_0x148356)['send'](_0x3ee6cb);};}exports[_0x310e('0x27')]=function(_0x5e155d,_0x5f15bc){var _0xcc6b1e={},_0x1d5d42={},_0x592f77={'count':0x0,'rows':[]};var _0x52930c=_['map'](db['ChatTransferReport'][_0x310e('0x28')],function(_0x2e0425){return{'name':_0x2e0425[_0x310e('0x29')],'type':_0x2e0425[_0x310e('0x2a')][_0x310e('0x2b')]};});_0x1d5d42[_0x310e('0x2c')]=_['map'](_0x52930c,_0x310e('0x26'));_0x1d5d42[_0x310e('0x2d')]=_['keys'](_0x5e155d[_0x310e('0x2d')]);_0x1d5d42[_0x310e('0x2e')]=_[_0x310e('0x2f')](_0x1d5d42[_0x310e('0x2c')],_0x1d5d42[_0x310e('0x2d')]);_0xcc6b1e[_0x310e('0x30')]=_[_0x310e('0x2f')](_0x1d5d42['model'],qs['fields'](_0x5e155d[_0x310e('0x2d')][_0x310e('0x31')]));_0xcc6b1e[_0x310e('0x30')]=_0xcc6b1e[_0x310e('0x30')][_0x310e('0x32')]?_0xcc6b1e[_0x310e('0x30')]:_0x1d5d42[_0x310e('0x2c')];if(!_0x5e155d[_0x310e('0x2d')][_0x310e('0x33')](_0x310e('0x34'))){_0xcc6b1e['limit']=qs[_0x310e('0x35')](_0x5e155d[_0x310e('0x2d')][_0x310e('0x35')]);_0xcc6b1e[_0x310e('0x1d')]=qs[_0x310e('0x1d')](_0x5e155d[_0x310e('0x2d')][_0x310e('0x1d')]);}_0xcc6b1e[_0x310e('0x36')]=qs[_0x310e('0x37')](_0x5e155d[_0x310e('0x2d')][_0x310e('0x37')]);_0xcc6b1e[_0x310e('0x38')]=qs[_0x310e('0x2e')](_[_0x310e('0x39')](_0x5e155d[_0x310e('0x2d')],_0x1d5d42[_0x310e('0x2e')]),_0x52930c);if(_0x5e155d[_0x310e('0x2d')][_0x310e('0x3a')]){_0xcc6b1e[_0x310e('0x38')]=_['merge'](_0xcc6b1e[_0x310e('0x38')],{'$or':_[_0x310e('0x3b')](_0x52930c,function(_0x166bae){if(_0x166bae[_0x310e('0x2a')]!==_0x310e('0x3c')){var _0x1174c8={};_0x1174c8[_0x166bae['name']]={'$like':'%'+_0x5e155d['query'][_0x310e('0x3a')]+'%'};return _0x1174c8;}})});}_0xcc6b1e=_[_0x310e('0x3d')]({},_0xcc6b1e,_0x5e155d[_0x310e('0x3e')]);var _0x30fd79={'where':_0xcc6b1e[_0x310e('0x38')]};return db[_0x310e('0x3f')][_0x310e('0x1c')](_0x30fd79)[_0x310e('0x23')](function(_0x5a025f){_0x592f77['count']=_0x5a025f;if(_0x5e155d[_0x310e('0x2d')]['includeAll']){_0xcc6b1e[_0x310e('0x40')]=[{'all':!![]}];}return db[_0x310e('0x3f')]['findAll'](_0xcc6b1e);})[_0x310e('0x23')](function(_0x3600f6){_0x592f77[_0x310e('0x41')]=_0x3600f6;return _0x592f77;})['then'](respondWithFilteredResult(_0x5f15bc,_0xcc6b1e))['catch'](handleError(_0x5f15bc,null));};exports['show']=function(_0x5708be,_0x1c29d1){var _0x336068={'raw':!![],'where':{'id':_0x5708be['params']['id']}},_0xefc14c={};_0xefc14c[_0x310e('0x2c')]=_[_0x310e('0x42')](db['ChatTransferReport'][_0x310e('0x28')]);_0xefc14c[_0x310e('0x2d')]=_[_0x310e('0x42')](_0x5708be[_0x310e('0x2d')]);_0xefc14c['filters']=_[_0x310e('0x2f')](_0xefc14c[_0x310e('0x2c')],_0xefc14c[_0x310e('0x2d')]);_0x336068[_0x310e('0x30')]=_[_0x310e('0x2f')](_0xefc14c[_0x310e('0x2c')],qs[_0x310e('0x31')](_0x5708be[_0x310e('0x2d')][_0x310e('0x31')]));_0x336068[_0x310e('0x30')]=_0x336068[_0x310e('0x30')][_0x310e('0x32')]?_0x336068[_0x310e('0x30')]:_0xefc14c['model'];if(_0x5708be[_0x310e('0x2d')]['includeAll']){_0x336068[_0x310e('0x40')]=[{'all':!![]}];}_0x336068=_['merge']({},_0x336068,_0x5708be[_0x310e('0x3e')]);return db[_0x310e('0x3f')][_0x310e('0x43')](_0x336068)[_0x310e('0x23')](handleEntityNotFound(_0x1c29d1,null))[_0x310e('0x23')](respondWithResult(_0x1c29d1,null))[_0x310e('0x44')](handleError(_0x1c29d1,null));};exports[_0x310e('0x45')]=function(_0x2e55ab,_0x37b060){return db[_0x310e('0x3f')][_0x310e('0x45')](_0x2e55ab[_0x310e('0x46')],{})[_0x310e('0x23')](respondWithResult(_0x37b060,0xc9))['catch'](handleError(_0x37b060,null));};exports[_0x310e('0x21')]=function(_0x2ca053,_0x48d76c){if(_0x2ca053[_0x310e('0x46')]['id']){delete _0x2ca053[_0x310e('0x46')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x2ca053[_0x310e('0x47')]['id']}})[_0x310e('0x23')](handleEntityNotFound(_0x48d76c,null))['then'](saveUpdates(_0x2ca053[_0x310e('0x46')],null))[_0x310e('0x23')](respondWithResult(_0x48d76c,null))[_0x310e('0x44')](handleError(_0x48d76c,null));};exports['destroy']=function(_0x22e850,_0x8d6065){return db[_0x310e('0x3f')][_0x310e('0x43')]({'where':{'id':_0x22e850[_0x310e('0x47')]['id']}})[_0x310e('0x23')](handleEntityNotFound(_0x8d6065,null))[_0x310e('0x23')](removeEntity(_0x8d6065,null))[_0x310e('0x44')](handleError(_0x8d6065,null));};exports[_0x310e('0x48')]=function(_0x3065a3,_0x323d3e){return db[_0x310e('0x3f')][_0x310e('0x48')]()[_0x310e('0x23')](respondWithResult(_0x323d3e,null))[_0x310e('0x44')](handleError(_0x323d3e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index eee47d2..cc4ac19 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 _0xbe3c=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0xe485c4,_0x3d0f36){var _0x24cb58=function(_0x492673){while(--_0x492673){_0xe485c4['push'](_0xe485c4['shift']());}};_0x24cb58(++_0x3d0f36);}(_0xbe3c,0x102));var _0xcbe3=function(_0x22bdf1,_0x22134e){_0x22bdf1=_0x22bdf1-0x0;var _0x273778=_0xbe3c[_0x22bdf1];return _0x273778;};'use strict';var _=require(_0xcbe3('0x0'));var util=require(_0xcbe3('0x1'));var logger=require('../../config/logger')(_0xcbe3('0x2'));var moment=require(_0xcbe3('0x3'));var BPromise=require(_0xcbe3('0x4'));var rp=require(_0xcbe3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbe3('0x6'));var config=require(_0xcbe3('0x7'));var attributes=require(_0xcbe3('0x8'));module[_0xcbe3('0x9')]=function(_0x4d7658,_0xc79ef2){return _0x4d7658['define'](_0xcbe3('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xcbe3('0xb'),'fields':[_0xcbe3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62c1=['define','ChatTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x4ee585,_0x3aa9fa){var _0x561c7a=function(_0x4e16b1){while(--_0x4e16b1){_0x4ee585['push'](_0x4ee585['shift']());}};_0x561c7a(++_0x3aa9fa);}(_0x62c1,0x13b));var _0x162c=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x62c1[_0x1e2321];return _0x1d346d;};'use strict';var _=require('lodash');var util=require(_0x162c('0x0'));var logger=require(_0x162c('0x1'))(_0x162c('0x2'));var moment=require(_0x162c('0x3'));var BPromise=require('bluebird');var rp=require(_0x162c('0x4'));var fs=require('fs');var path=require(_0x162c('0x5'));var rimraf=require(_0x162c('0x6'));var config=require(_0x162c('0x7'));var attributes=require(_0x162c('0x8'));module[_0x162c('0x9')]=function(_0x599007,_0xc4f408){return _0x599007[_0x162c('0xa')](_0x162c('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x162c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b5f90c3..28cddb8 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 _0xacd3=['client','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x32318b,_0xed0686){var _0x5592be=function(_0xfedc23){while(--_0xfedc23){_0x32318b['push'](_0x32318b['shift']());}};_0x5592be(++_0xed0686);}(_0xacd3,0x115));var _0x3acd=function(_0x574f88,_0x601376){_0x574f88=_0x574f88-0x0;var _0x14a0d0=_0xacd3[_0x574f88];return _0x14a0d0;};'use strict';var _=require(_0x3acd('0x0'));var util=require(_0x3acd('0x1'));var moment=require(_0x3acd('0x2'));var BPromise=require(_0x3acd('0x3'));var rs=require(_0x3acd('0x4'));var fs=require('fs');var Redis=require(_0x3acd('0x5'));var db=require(_0x3acd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3acd('0x7'))(_0x3acd('0x8'));var config=require(_0x3acd('0x9'));var jayson=require(_0x3acd('0xa'));var client=jayson[_0x3acd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a3be,_0x1c022c,_0x2fd742){return new BPromise(function(_0x1b7a71,_0x4c9dad){return client[_0x3acd('0xc')](_0x33a3be,_0x2fd742)[_0x3acd('0xd')](function(_0x59c0dc){logger[_0x3acd('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x1c022c,_0x3acd('0xf'));logger[_0x3acd('0x10')](_0x3acd('0x11'),_0x1c022c,_0x3acd('0xf'),JSON[_0x3acd('0x12')](_0x59c0dc));if(_0x59c0dc[_0x3acd('0x13')]){if(_0x59c0dc[_0x3acd('0x13')][_0x3acd('0x14')]===0x1f4){logger['error'](_0x3acd('0x15'),_0x1c022c,_0x59c0dc[_0x3acd('0x13')][_0x3acd('0x16')]);return _0x4c9dad(_0x59c0dc[_0x3acd('0x13')][_0x3acd('0x16')]);}logger[_0x3acd('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x1c022c,_0x59c0dc[_0x3acd('0x13')][_0x3acd('0x16')]);return _0x1b7a71(_0x59c0dc['error'][_0x3acd('0x16')]);}else{logger[_0x3acd('0xe')](_0x3acd('0x15'),_0x1c022c,'request\x20sent');_0x1b7a71(_0x59c0dc['result'][_0x3acd('0x16')]);}})[_0x3acd('0x17')](function(_0x142b88){logger[_0x3acd('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x1c022c,_0x142b88);_0x4c9dad(_0x142b88);});});} \ No newline at end of file +var _0x9b2f=['util','moment','bluebird','randomstring','../../config/logger','rpc','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch'];(function(_0x296c05,_0x167a34){var _0x26a4f0=function(_0x24e635){while(--_0x24e635){_0x296c05['push'](_0x296c05['shift']());}};_0x26a4f0(++_0x167a34);}(_0x9b2f,0x12c));var _0xf9b2=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x9b2f[_0x2a0738];return _0x159679;};'use strict';var _=require('lodash');var util=require(_0xf9b2('0x0'));var moment=require(_0xf9b2('0x1'));var BPromise=require(_0xf9b2('0x2'));var rs=require(_0xf9b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf9b2('0x4'))(_0xf9b2('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf9b2('0x6')][_0xf9b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cdc78,_0x36cf63,_0x3a0a18){return new BPromise(function(_0x443f04,_0x3b8bc6){return client[_0xf9b2('0x8')](_0x1cdc78,_0x3a0a18)[_0xf9b2('0x9')](function(_0x27f34e){logger['info'](_0xf9b2('0xa'),_0x36cf63,_0xf9b2('0xb'));logger[_0xf9b2('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x36cf63,'request\x20sent',JSON[_0xf9b2('0xd')](_0x27f34e));if(_0x27f34e['error']){if(_0x27f34e['error'][_0xf9b2('0xe')]===0x1f4){logger['error'](_0xf9b2('0xa'),_0x36cf63,_0x27f34e[_0xf9b2('0xf')][_0xf9b2('0x10')]);return _0x3b8bc6(_0x27f34e[_0xf9b2('0xf')]['message']);}logger[_0xf9b2('0xf')](_0xf9b2('0xa'),_0x36cf63,_0x27f34e[_0xf9b2('0xf')][_0xf9b2('0x10')]);return _0x443f04(_0x27f34e['error']['message']);}else{logger[_0xf9b2('0x11')](_0xf9b2('0xa'),_0x36cf63,'request\x20sent');_0x443f04(_0x27f34e[_0xf9b2('0x12')]['message']);}})[_0xf9b2('0x13')](function(_0x2155fd){logger[_0xf9b2('0xf')](_0xf9b2('0xa'),_0x36cf63,_0x2155fd);_0x3b8bc6(_0x2155fd);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c2e1525..f61e901 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 _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x35cb42,_0xdddad7){var _0x3b0ef9=function(_0xb2831d){while(--_0xb2831d){_0x35cb42['push'](_0x35cb42['shift']());}};_0x3b0ef9(++_0xdddad7);}(_0x2032,0xd9));var _0x2203=function(_0x3a5ca7,_0x17c064){_0x3a5ca7=_0x3a5ca7-0x0;var _0x37d698=_0x2032[_0x3a5ca7];return _0x37d698;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x6a04e3,_0x1f0786){var _0x3ee227=function(_0xf9fb3b){while(--_0xf9fb3b){_0x6a04e3['push'](_0x6a04e3['shift']());}};_0x3ee227(++_0x1f0786);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32b9da,_0x258dd1){_0x32b9da=_0x32b9da-0x0;var _0x3f378f=_0x5f2f[_0x32b9da];return _0x3f378f;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 8ee84dc..349b233 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 _0x4260=['textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','input','name','text','getDataValue','onlineForm','setDataValue','stringify'];(function(_0x2c85a0,_0x25d78c){var _0x4ef0f9=function(_0x21d157){while(--_0x21d157){_0x2c85a0['push'](_0x2c85a0['shift']());}};_0x4ef0f9(++_0x25d78c);}(_0x4260,0x7a));var _0x0426=function(_0x263d52,_0x2d5bc1){_0x263d52=_0x263d52-0x0;var _0x46b894=_0x4260[_0x263d52];return _0x46b894;};'use strict';var Sequelize=require(_0x0426('0x0'));var rs=require(_0x0426('0x1'));module[_0x0426('0x2')]={'name':{'type':Sequelize[_0x0426('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x0426('0x3')],'allowNull':![],'unique':_0x0426('0x4')},'description':{'type':Sequelize[_0x0426('0x3')]},'mapKey':{'type':Sequelize[_0x0426('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x0426('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0426('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0426('0x3')],'allowNull':![],'defaultValue':_0x0426('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0426('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0426('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0426('0x9')]('rounded',_0x0426('0xa')),'defaultValue':_0x0426('0xb')},'header_online':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0xc')},'start_chat_button':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0xd')},'offline_chat_button':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x0426('0xf')},'download_transcript':{'type':Sequelize[_0x0426('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0426('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0426('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x0426('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0426('0x11')]},'closingQuestion':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0426('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0426('0x13')},'noteTitle':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x14')},'placeholderMessage':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x15')},'closingMessage':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x16')},'closingMessageButton':{'type':Sequelize[_0x0426('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x17')},'conditionAgreement':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x18')},'ratingType':{'type':Sequelize[_0x0426('0x9')]('star',_0x0426('0x19')),'defaultValue':_0x0426('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x0426('0x10')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0426('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0426('0x1b'),'variable':null,'config':{'placeholder':_0x0426('0x1c'),'type':_0x0426('0x1d'),'required':!![]},'props':{'title':_0x0426('0x1c'),'helpText':''}},{'type':_0x0426('0x1b'),'props':{'title':_0x0426('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0426('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0426('0x1e')](_0x0426('0x1f'))?JSON['parse'](this[_0x0426('0x1e')](_0x0426('0x1f'))):{};},'set':function(_0x53b77b){return this[_0x0426('0x20')](_0x0426('0x1f'),JSON[_0x0426('0x21')](_0x53b77b));}},'offlineForm':{'type':Sequelize[_0x0426('0x11')],'defaultValue':function(){return JSON[_0x0426('0x21')]({'items':[{'type':_0x0426('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0426('0x5'),'type':_0x0426('0x5')},'variable':null},{'type':_0x0426('0x22'),'config':{'placeholder':_0x0426('0x23')},'props':{'title':_0x0426('0x23'),'helpText':_0x0426('0x24')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x0426('0x25'))?JSON[_0x0426('0x26')](this['getDataValue'](_0x0426('0x25'))):{};},'set':function(_0x416571){return this[_0x0426('0x20')](_0x0426('0x25'),JSON['stringify'](_0x416571));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0426('0x27')]();}},'autoclose':{'type':Sequelize[_0x0426('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0426('0x3')]},'forwardOffline':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0426('0x3')]},'waitingTitle':{'type':Sequelize[_0x0426('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x0426('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x17')},'sendUnmanaged':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0426('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0426('0x11')],'defaultValue':function(){return _0x0426('0x2b');}},'notificationSound':{'type':Sequelize[_0x0426('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0426('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0426('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x0426('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x0426('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0426('0x10')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0426('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0426('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0426('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0426('0x3')],'defaultValue':_0x0426('0x2f')},'systemAvatar':{'type':Sequelize[_0x0426('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0426('0x10')],'comment':_0x0426('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0426('0x31'),'set':function(_0x537acb){if(!_0x537acb)this[_0x0426('0x20')](_0x0426('0x32'),null);this[_0x0426('0x20')](_0x0426('0x33'),_0x537acb);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0426('0x3')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file +var _0xf375=['STRING','address','email','#ffffff','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','thumb','star','stringify','input','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0xf375,0x93));var _0x5f37=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf375[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5f37('0x0'));var rs=require(_0x5f37('0x1'));module[_0x5f37('0x2')]={'name':{'type':Sequelize[_0x5f37('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5f37('0x4')},'description':{'type':Sequelize[_0x5f37('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x5f37('0x5')},'mapKeyOffline':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x5')},'key':{'type':Sequelize[_0x5f37('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5f37('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5f37('0x3')],'allowNull':![],'defaultValue':_0x5f37('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5f37('0x7')](_0x5f37('0x8'),_0x5f37('0x9')),'defaultValue':_0x5f37('0x8')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5f37('0xa')},'start_chat_button':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0xb')},'offline_chat_button':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0xc')},'header_offline':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0xd')},'download_transcript':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5f37('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5f37('0x11')]},'closingQuestion':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x13')},'noteTitle':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x14')},'placeholderMessage':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x15')},'closingMessage':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x16')},'closingMessageButton':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0xc')},'skipMessageButton':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x17')},'conditionAgreement':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x5f37('0x7')]('star',_0x5f37('0x18')),'defaultValue':_0x5f37('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x5f37('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5f37('0x11')],'defaultValue':function(){return JSON[_0x5f37('0x1a')]({'items':[{'type':_0x5f37('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x5f37('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5f37('0x1b'),'props':{'title':_0x5f37('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5f37('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5f37('0x1d')](_0x5f37('0x1e'))?JSON['parse'](this[_0x5f37('0x1d')](_0x5f37('0x1e'))):{};},'set':function(_0x46c22c){return this[_0x5f37('0x1f')](_0x5f37('0x1e'),JSON[_0x5f37('0x1a')](_0x46c22c));}},'offlineForm':{'type':Sequelize[_0x5f37('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5f37('0x1b'),'props':{'title':_0x5f37('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5f37('0x5'),'type':_0x5f37('0x5')},'variable':null},{'type':_0x5f37('0x20'),'config':{'placeholder':_0x5f37('0x21')},'props':{'title':_0x5f37('0x21'),'helpText':_0x5f37('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x5f37('0x1d')](_0x5f37('0x23'))?JSON[_0x5f37('0x24')](this[_0x5f37('0x1d')](_0x5f37('0x23'))):{};},'set':function(_0x4721b3){return this[_0x5f37('0x1f')]('offlineForm',JSON[_0x5f37('0x1a')](_0x4721b3));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5f37('0x3')]},'forwardOffline':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5f37('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5f37('0x25')},'waitingMessage':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x26')},'offlineMessageBody':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x28')},'skipUnmanaged':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x17')},'sendUnmanaged':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5f37('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5f37('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5f37('0x11')],'defaultValue':function(){return _0x5f37('0x29');}},'notificationSound':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x2b')},'verticalAlignment':{'type':Sequelize[_0x5f37('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x2c')},'defaultTitle':{'type':Sequelize[_0x5f37('0x3')]},'customerAvatar':{'type':Sequelize[_0x5f37('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5f37('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5f37('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5f37('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5f37('0x3')],'defaultValue':_0x5f37('0x2d')},'systemAvatar':{'type':Sequelize[_0x5f37('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5f37('0xf')],'comment':_0x5f37('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![],'comment':_0x5f37('0x2f'),'set':function(_0x1562bd){if(!_0x1562bd)this[_0x5f37('0x1f')](_0x5f37('0x30'),null);this[_0x5f37('0x1f')](_0x5f37('0x31'),_0x1562bd);}},'vidaooEscalation':{'type':Sequelize[_0x5f37('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 9c550a4..138616c 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 _0x0c58=['offlineForm','onlineForm','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','name','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','rows','show','params','Pause','includeAll','create','body','user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','getDispositions','findOne','intersection','nolimit','ChatWebsiteId','findAll','removeDispositions','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','list','orderBy','applications','priority','asc','contact','customerIp','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','type','stringify','threadId','externalUrl','ContactId','interaction','ChatInteraction','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','Chat','NotifyMailAccount','notifyMail','addInteraction','ids','omit','getInteractions','Contact','fullname','internal','Tag','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','getLicense','virtual','custom','License','increment','chatLicenseExceeded','Intervals','push','all','some','server/files/chat/iframe.js','utf8','x-real-ip','connection','referer','replace','alignment','verticalAlignment','color','textColor','addApplications','transaction','getApplications','addProactiveActions','getProactiveActions','getFields','online'];(function(_0x54a6ce,_0x215937){var _0x3ccc0e=function(_0x151f69){while(--_0x151f69){_0x54a6ce['push'](_0x54a6ce['shift']());}};_0x3ccc0e(++_0x215937);}(_0x0c58,0x12f));var _0x80c5=function(_0x278dfc,_0x29429c){_0x278dfc=_0x278dfc-0x0;var _0x3ca6f8=_0x0c58[_0x278dfc];return _0x3ca6f8;};'use strict';var pdf=require(_0x80c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x80c5('0x1'));var zipdir=require(_0x80c5('0x2'));var jsonpatch=require(_0x80c5('0x3'));var rp=require(_0x80c5('0x4'));var moment=require(_0x80c5('0x5'));var BPromise=require(_0x80c5('0x6'));var Mustache=require(_0x80c5('0x7'));var util=require(_0x80c5('0x8'));var path=require('path');var sox=require(_0x80c5('0x9'));var csv=require(_0x80c5('0xa'));var ejs=require(_0x80c5('0xb'));var fs=require('fs');var _=require(_0x80c5('0xc'));var squel=require(_0x80c5('0xd'));var crypto=require(_0x80c5('0xe'));var jsforce=require(_0x80c5('0xf'));var deskjs=require(_0x80c5('0x10'));var toCsv=require(_0x80c5('0xa'));var querystring=require(_0x80c5('0x11'));var Papa=require('papaparse');var Redis=require(_0x80c5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x80c5('0x13'));var as=require(_0x80c5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80c5('0x15'))('api');var utils=require(_0x80c5('0x16'));var config=require(_0x80c5('0x17'));var licenseUtil=require(_0x80c5('0x18'));var db=require(_0x80c5('0x19'))['db'];config['redis']=_[_0x80c5('0x1a')](config[_0x80c5('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x80c5('0x1c'))(new Redis(config[_0x80c5('0x1b')]));require(_0x80c5('0x1d'))[_0x80c5('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x80c5('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x80c5('0x1f')][_0x80c5('0x20')]({'port':0x232a});var client9003=jayson[_0x80c5('0x1f')]['http']({'port':0x232b});var client9001=jayson['client'][_0x80c5('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x4070f8,_0x32e901,_0x429f2e,_0x721f76){return new BPromise(function(_0x2de4e4,_0x54e59d){var _0x80b3ab=_0x721f76||client;return _0x80b3ab['request'](_0x4070f8,_0x429f2e)['then'](function(_0x355c09){logger[_0x80c5('0x21')](_0x80c5('0x22'),_0x32e901,_0x80c5('0x23'));logger[_0x80c5('0x24')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x32e901,_0x80c5('0x23'),JSON['stringify'](_0x355c09));if(_0x355c09[_0x80c5('0x25')]){if(_0x355c09[_0x80c5('0x25')]['code']===0x1f4){logger[_0x80c5('0x25')](_0x80c5('0x22'),_0x32e901,_0x355c09[_0x80c5('0x25')][_0x80c5('0x26')]);return _0x54e59d(_0x355c09[_0x80c5('0x25')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x32e901,_0x355c09['error']['message']);return _0x2de4e4(_0x355c09[_0x80c5('0x25')][_0x80c5('0x26')]);}else{logger[_0x80c5('0x21')](_0x80c5('0x22'),_0x32e901,_0x80c5('0x23'));_0x2de4e4(_0x355c09[_0x80c5('0x27')]['message']);}})[_0x80c5('0x28')](function(_0xda05c5){logger['error'](_0x80c5('0x22'),_0x32e901,_0xda05c5);_0x54e59d(_0xda05c5);});});}function respondWithStatusCode(_0x357519,_0x14233a){_0x14233a=_0x14233a||0xcc;return function(_0x20e43e){if(_0x20e43e){return _0x357519[_0x80c5('0x29')](_0x14233a);}return _0x357519['status'](_0x14233a)['end']();};}function respondWithResult(_0x4d8ec1,_0x73de52){_0x73de52=_0x73de52||0xc8;return function(_0x463f7a){if(_0x463f7a){return _0x4d8ec1[_0x80c5('0x2a')](_0x73de52)[_0x80c5('0x2b')](_0x463f7a);}};}function respondWithFilteredResult(_0x60c8ec,_0x5cd9bd){return function(_0x234ef9){if(_0x234ef9){var _0x17fd32=_0x234ef9['count'],_0x5d5c7a=_0x5cd9bd[_0x80c5('0x2c')],_0x463094=_0x5cd9bd[_0x80c5('0x2c')]+_0x5cd9bd['limit'],_0x281a46;if(_0x463094>=_0x17fd32){_0x463094=_0x17fd32;_0x281a46=0xc8;}else{_0x281a46=0xce;}_0x60c8ec[_0x80c5('0x2a')](_0x281a46);return _0x60c8ec['set'](_0x80c5('0x2d'),_0x5d5c7a+'-'+_0x463094+'/'+_0x17fd32)[_0x80c5('0x2b')](_0x234ef9);}return null;};}function patchUpdates(_0x120e44){return function(_0x12ebf2){try{jsonpatch[_0x80c5('0x2e')](_0x12ebf2,_0x120e44,!![]);}catch(_0xdd420b){return BPromise[_0x80c5('0x2f')](_0xdd420b);}return _0x12ebf2[_0x80c5('0x30')]();};}function saveUpdates(_0x52059e,_0x3db4da){return function(_0x2fc048){if(_0x2fc048){return _0x2fc048[_0x80c5('0x31')](_0x52059e)[_0x80c5('0x32')](function(_0x4f426c){return _0x4f426c;});}return null;};}function removeEntity(_0x21ded6,_0x2634a5){return function(_0x40dee3){if(_0x40dee3){return _0x40dee3[_0x80c5('0x33')]()['then'](function(){var _0x2410b4=_0x40dee3[_0x80c5('0x34')]({'plain':!![]});var _0x40c750='ChatWebsites';return db[_0x80c5('0x35')][_0x80c5('0x33')]({'where':{'type':_0x40c750,'resourceId':_0x2410b4['id']}})['then'](function(){return _0x40dee3;});})[_0x80c5('0x32')](function(){_0x21ded6['status'](0xcc)[_0x80c5('0x36')]();});}};}function handleEntityNotFound(_0x2430cd,_0x48bb6f){return function(_0x510eda){if(!_0x510eda){_0x2430cd['sendStatus'](0x194);}return _0x510eda;};}function handleError(_0x5e9704,_0x4a3b1a){_0x4a3b1a=_0x4a3b1a||0x1f4;return function(_0x1e3c70){logger[_0x80c5('0x25')](_0x1e3c70['stack']);if(_0x1e3c70[_0x80c5('0x37')]){delete _0x1e3c70[_0x80c5('0x37')];}_0x5e9704['status'](_0x4a3b1a)['send'](_0x1e3c70);};}exports['index']=function(_0x2abe84,_0x42e085){var _0x2c75f6={'include':[{'model':db['Pause'],'as':_0x80c5('0x38')}]},_0x1981ec={},_0x106759={'count':0x0,'rows':[]};var _0xc2ba9d=_[_0x80c5('0x39')](db[_0x80c5('0x3a')][_0x80c5('0x3b')],function(_0x3ffaa1){return{'name':_0x3ffaa1['fieldName'],'type':_0x3ffaa1['type'][_0x80c5('0x3c')]};});_0x1981ec['model']=_['map'](_0xc2ba9d,'name');_0x1981ec[_0x80c5('0x3d')]=_[_0x80c5('0x3e')](_0x2abe84[_0x80c5('0x3d')]);_0x1981ec[_0x80c5('0x3f')]=_['intersection'](_0x1981ec[_0x80c5('0x40')],_0x1981ec[_0x80c5('0x3d')]);_0x2c75f6[_0x80c5('0x41')]=_['intersection'](_0x1981ec[_0x80c5('0x40')],qs['fields'](_0x2abe84[_0x80c5('0x3d')][_0x80c5('0x42')]));_0x2c75f6['attributes']=_0x2c75f6[_0x80c5('0x41')][_0x80c5('0x43')]?_0x2c75f6[_0x80c5('0x41')]:_0x1981ec[_0x80c5('0x40')];if(!_0x2abe84[_0x80c5('0x3d')][_0x80c5('0x44')]('nolimit')){_0x2c75f6[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0x2abe84[_0x80c5('0x3d')][_0x80c5('0x45')]);_0x2c75f6[_0x80c5('0x2c')]=qs[_0x80c5('0x2c')](_0x2abe84[_0x80c5('0x3d')][_0x80c5('0x2c')]);}_0x2c75f6[_0x80c5('0x46')]=qs['sort'](_0x2abe84['query'][_0x80c5('0x47')]);_0x2c75f6[_0x80c5('0x48')]=qs[_0x80c5('0x3f')](_[_0x80c5('0x49')](_0x2abe84['query'],_0x1981ec[_0x80c5('0x3f')]),_0xc2ba9d);if(_0x2abe84['query'][_0x80c5('0x4a')]){_0x2c75f6[_0x80c5('0x48')]=_['merge'](_0x2c75f6[_0x80c5('0x48')],{'$or':_[_0x80c5('0x39')](_0xc2ba9d,function(_0x56a93b){if(_0x56a93b['type']!==_0x80c5('0x4b')){var _0x1c2a7a={};_0x1c2a7a[_0x56a93b[_0x80c5('0x37')]]={'$like':'%'+_0x2abe84[_0x80c5('0x3d')]['filter']+'%'};return _0x1c2a7a;}})});}_0x2c75f6=_[_0x80c5('0x4c')]({},_0x2c75f6,_0x2abe84[_0x80c5('0x4d')]);var _0x493a99={'where':_0x2c75f6['where']};return db[_0x80c5('0x3a')][_0x80c5('0x4e')](_0x493a99)[_0x80c5('0x32')](function(_0x4fa7a2){_0x106759[_0x80c5('0x4e')]=_0x4fa7a2;if(_0x2abe84[_0x80c5('0x3d')]['includeAll']){_0x2c75f6[_0x80c5('0x4f')]=[{'all':!![]}];}return db[_0x80c5('0x3a')]['findAll'](_0x2c75f6);})[_0x80c5('0x32')](function(_0x1fcfea){_0x106759[_0x80c5('0x50')]=_0x1fcfea;return _0x106759;})[_0x80c5('0x32')](respondWithFilteredResult(_0x42e085,_0x2c75f6))[_0x80c5('0x28')](handleError(_0x42e085,null));};exports[_0x80c5('0x51')]=function(_0x4f3c73,_0xf1e3a6){var _0x8feecf={'raw':![],'where':{'id':_0x4f3c73[_0x80c5('0x52')]['id']},'include':[{'model':db[_0x80c5('0x53')],'as':_0x80c5('0x38')}]},_0x3e049f={};_0x3e049f[_0x80c5('0x40')]=_[_0x80c5('0x3e')](db[_0x80c5('0x3a')][_0x80c5('0x3b')]);_0x3e049f['query']=_[_0x80c5('0x3e')](_0x4f3c73[_0x80c5('0x3d')]);_0x3e049f['filters']=_['intersection'](_0x3e049f[_0x80c5('0x40')],_0x3e049f[_0x80c5('0x3d')]);_0x8feecf[_0x80c5('0x41')]=_['intersection'](_0x3e049f[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0x4f3c73['query']['fields']));_0x8feecf[_0x80c5('0x41')]=_0x8feecf[_0x80c5('0x41')][_0x80c5('0x43')]?_0x8feecf['attributes']:_0x3e049f[_0x80c5('0x40')];if(_0x4f3c73[_0x80c5('0x3d')][_0x80c5('0x54')]){_0x8feecf[_0x80c5('0x4f')]=[{'all':!![]}];}_0x8feecf=_['merge']({},_0x8feecf,_0x4f3c73[_0x80c5('0x4d')]);return db['ChatWebsite']['find'](_0x8feecf)['then'](handleEntityNotFound(_0xf1e3a6,null))[_0x80c5('0x32')](respondWithResult(_0xf1e3a6,null))[_0x80c5('0x28')](handleError(_0xf1e3a6,null));};exports[_0x80c5('0x55')]=function(_0x26ecec,_0x5ccdad){return db[_0x80c5('0x3a')]['create'](_0x26ecec[_0x80c5('0x56')],{})[_0x80c5('0x32')](function(_0x173937){var _0x5a88ba=_0x26ecec[_0x80c5('0x57')]['get']({'plain':!![]});if(!_0x5a88ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a88ba[_0x80c5('0x58')]==='user'){var _0x2b0c95=_0x173937[_0x80c5('0x34')]({'plain':!![]});var _0x5501fd=_0x80c5('0x59');return db[_0x80c5('0x5a')]['find']({'where':{'name':_0x5501fd,'userProfileId':_0x5a88ba[_0x80c5('0x5b')]},'raw':!![]})[_0x80c5('0x32')](function(_0x560fde){if(_0x560fde&&_0x560fde[_0x80c5('0x5c')]===0x0){return db[_0x80c5('0x35')][_0x80c5('0x55')]({'name':_0x2b0c95[_0x80c5('0x37')],'resourceId':_0x2b0c95['id'],'type':_0x560fde[_0x80c5('0x37')],'sectionId':_0x560fde['id']},{})[_0x80c5('0x32')](function(){return _0x173937;});}else{return _0x173937;}})[_0x80c5('0x28')](function(_0x187538){logger[_0x80c5('0x25')](_0x80c5('0x5d'),_0x187538);throw _0x187538;});}return _0x173937;})[_0x80c5('0x32')](respondWithResult(_0x5ccdad,0xc9))[_0x80c5('0x28')](handleError(_0x5ccdad,null));};exports[_0x80c5('0x31')]=function(_0x1ed52d,_0x3ca45a){if(_0x1ed52d['body']['id']){delete _0x1ed52d[_0x80c5('0x56')]['id'];}return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x1ed52d[_0x80c5('0x52')]['id']},'include':[{'model':db[_0x80c5('0x53')],'as':_0x80c5('0x38')}]})[_0x80c5('0x32')](handleEntityNotFound(_0x3ca45a,null))[_0x80c5('0x32')](saveUpdates(_0x1ed52d[_0x80c5('0x56')],null))['then'](respondWithResult(_0x3ca45a,null))['catch'](handleError(_0x3ca45a,null));};exports[_0x80c5('0x33')]=function(_0x17ecb4,_0x4f2760){return db[_0x80c5('0x3a')]['find']({'where':{'id':_0x17ecb4['params']['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x4f2760,null))['then'](removeEntity(_0x4f2760,null))[_0x80c5('0x28')](handleError(_0x4f2760,null));};exports[_0x80c5('0x5f')]=function(_0xeb76e3,_0x36330b){return db[_0x80c5('0x3a')][_0x80c5('0x5f')]()[_0x80c5('0x32')](respondWithResult(_0x36330b,null))[_0x80c5('0x28')](handleError(_0x36330b,null));};exports[_0x80c5('0x60')]=function(_0x1e7a0f,_0x2b3251,_0x3a6805){if(_0x1e7a0f[_0x80c5('0x56')]['id']){delete _0x1e7a0f[_0x80c5('0x56')]['id'];}return db['ChatWebsite'][_0x80c5('0x5e')]({'where':{'id':_0x1e7a0f[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x2b3251,null))[_0x80c5('0x32')](function(_0x5ab379){if(_0x5ab379){_0x1e7a0f['body']['ChatWebsiteId']=_0x5ab379['id'];return db[_0x80c5('0x61')][_0x80c5('0x55')](_0x1e7a0f['body']);}})['then'](respondWithResult(_0x2b3251,null))[_0x80c5('0x28')](handleError(_0x2b3251,null));};exports[_0x80c5('0x62')]=function(_0x29c419,_0x4bb16f,_0xcadcfa){var _0x43c743={'raw':![],'where':{}};var _0x3b38e2={};var _0x488879={'count':0x0,'rows':[]};return db[_0x80c5('0x3a')][_0x80c5('0x63')]({'where':{'id':_0x29c419[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x4bb16f,null))[_0x80c5('0x32')](function(_0x38fc1e){if(_0x38fc1e){_0x3b38e2[_0x80c5('0x40')]=_['keys'](db['Disposition'][_0x80c5('0x3b')]);_0x3b38e2[_0x80c5('0x3d')]=_[_0x80c5('0x3e')](_0x29c419['query']);_0x3b38e2[_0x80c5('0x3f')]=_[_0x80c5('0x64')](_0x3b38e2[_0x80c5('0x40')],_0x3b38e2[_0x80c5('0x3d')]);_0x43c743[_0x80c5('0x41')]=_[_0x80c5('0x64')](_0x3b38e2[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0x29c419[_0x80c5('0x3d')][_0x80c5('0x42')]));_0x43c743['attributes']=_0x43c743['attributes'][_0x80c5('0x43')]?_0x43c743[_0x80c5('0x41')]:_0x3b38e2[_0x80c5('0x40')];if(!_0x29c419[_0x80c5('0x3d')]['hasOwnProperty'](_0x80c5('0x65'))){_0x43c743[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0x29c419[_0x80c5('0x3d')][_0x80c5('0x45')]);_0x43c743[_0x80c5('0x2c')]=qs[_0x80c5('0x2c')](_0x29c419[_0x80c5('0x3d')][_0x80c5('0x2c')]);}_0x43c743['order']=qs[_0x80c5('0x47')](_0x29c419[_0x80c5('0x3d')][_0x80c5('0x47')]);_0x43c743['where']=qs[_0x80c5('0x3f')](_[_0x80c5('0x49')](_0x29c419[_0x80c5('0x3d')],_0x3b38e2['filters']));_0x43c743['where'][_0x80c5('0x66')]=_0x38fc1e['id'];if(_0x29c419[_0x80c5('0x3d')]['filter']){_0x43c743[_0x80c5('0x48')]=_[_0x80c5('0x4c')](_0x43c743[_0x80c5('0x48')],{'$or':_[_0x80c5('0x39')](_0x43c743[_0x80c5('0x41')],function(_0x5a07f6){var _0x1908da={};_0x1908da[_0x5a07f6]={'$like':'%'+_0x29c419[_0x80c5('0x3d')]['filter']+'%'};return _0x1908da;})});}_0x43c743=_[_0x80c5('0x4c')]({},_0x43c743,_0x29c419[_0x80c5('0x4d')]);return db[_0x80c5('0x61')][_0x80c5('0x4e')]({'where':_0x43c743['where']})[_0x80c5('0x32')](function(_0x3b080b){_0x488879[_0x80c5('0x4e')]=_0x3b080b;if(_0x29c419[_0x80c5('0x3d')][_0x80c5('0x54')]){_0x43c743[_0x80c5('0x4f')]=[{'all':!![]}];}return db[_0x80c5('0x61')][_0x80c5('0x67')](_0x43c743);})['then'](function(_0x3b8b34){_0x488879[_0x80c5('0x50')]=_0x3b8b34;return _0x488879;});}})['then'](respondWithFilteredResult(_0x4bb16f,_0x43c743))[_0x80c5('0x28')](handleError(_0x4bb16f,null));};exports['removeDispositions']=function(_0x10d1b1,_0x33353b,_0x3d67f7){return db[_0x80c5('0x3a')]['find']({'where':{'id':_0x10d1b1['params']['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x33353b,null))[_0x80c5('0x32')](function(_0x2e3be8){if(_0x2e3be8){return _0x2e3be8[_0x80c5('0x68')](_0x10d1b1[_0x80c5('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x33353b,null))[_0x80c5('0x28')](handleError(_0x33353b,null));};exports['addAnswer']=function(_0x14d400,_0x1a955e,_0x27c556){if(_0x14d400[_0x80c5('0x56')]['id']){delete _0x14d400['body']['id'];}return db[_0x80c5('0x3a')]['find']({'where':{'id':_0x14d400['params']['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x1a955e,null))[_0x80c5('0x32')](function(_0x4e6a24){if(_0x4e6a24){_0x14d400[_0x80c5('0x56')]['ChatWebsiteId']=_0x4e6a24['id'];return db['CannedAnswer'][_0x80c5('0x55')](_0x14d400[_0x80c5('0x56')]);}})[_0x80c5('0x32')](respondWithResult(_0x1a955e,null))[_0x80c5('0x28')](handleError(_0x1a955e,null));};exports[_0x80c5('0x69')]=function(_0x3f1e22,_0x38001c,_0x5c73e0){var _0xbebde4={'raw':![],'where':{}};var _0x2c6d05={};var _0x51c53f={'count':0x0,'rows':[]};return db[_0x80c5('0x3a')]['findOne']({'where':{'id':_0x3f1e22[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x38001c,null))[_0x80c5('0x32')](function(_0x2bd4d5){if(_0x2bd4d5){_0x2c6d05[_0x80c5('0x40')]=_[_0x80c5('0x3e')](db[_0x80c5('0x6a')]['rawAttributes']);_0x2c6d05[_0x80c5('0x3d')]=_[_0x80c5('0x3e')](_0x3f1e22[_0x80c5('0x3d')]);_0x2c6d05[_0x80c5('0x3f')]=_[_0x80c5('0x64')](_0x2c6d05[_0x80c5('0x40')],_0x2c6d05[_0x80c5('0x3d')]);_0xbebde4[_0x80c5('0x41')]=_['intersection'](_0x2c6d05[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0x3f1e22[_0x80c5('0x3d')][_0x80c5('0x42')]));_0xbebde4[_0x80c5('0x41')]=_0xbebde4['attributes']['length']?_0xbebde4['attributes']:_0x2c6d05[_0x80c5('0x40')];if(!_0x3f1e22[_0x80c5('0x3d')]['hasOwnProperty'](_0x80c5('0x65'))){_0xbebde4[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0x3f1e22[_0x80c5('0x3d')][_0x80c5('0x45')]);_0xbebde4['offset']=qs[_0x80c5('0x2c')](_0x3f1e22['query']['offset']);}_0xbebde4[_0x80c5('0x46')]=qs[_0x80c5('0x47')](_0x3f1e22[_0x80c5('0x3d')][_0x80c5('0x47')]);_0xbebde4[_0x80c5('0x48')]=qs[_0x80c5('0x3f')](_[_0x80c5('0x49')](_0x3f1e22[_0x80c5('0x3d')],_0x2c6d05[_0x80c5('0x3f')]));_0xbebde4[_0x80c5('0x48')][_0x80c5('0x66')]=_0x2bd4d5['id'];if(_0x3f1e22['query']['filter']){_0xbebde4[_0x80c5('0x48')]=_[_0x80c5('0x4c')](_0xbebde4[_0x80c5('0x48')],{'$or':_['map'](_0xbebde4[_0x80c5('0x41')],function(_0x1cf1a4){var _0x41c280={};_0x41c280[_0x1cf1a4]={'$like':'%'+_0x3f1e22[_0x80c5('0x3d')][_0x80c5('0x4a')]+'%'};return _0x41c280;})});}_0xbebde4=_[_0x80c5('0x4c')]({},_0xbebde4,_0x3f1e22[_0x80c5('0x4d')]);return db['CannedAnswer'][_0x80c5('0x4e')]({'where':_0xbebde4[_0x80c5('0x48')]})['then'](function(_0x5cf5c0){_0x51c53f[_0x80c5('0x4e')]=_0x5cf5c0;if(_0x3f1e22[_0x80c5('0x3d')][_0x80c5('0x54')]){_0xbebde4[_0x80c5('0x4f')]=[{'all':!![]}];}return db[_0x80c5('0x6a')][_0x80c5('0x67')](_0xbebde4);})[_0x80c5('0x32')](function(_0x369a37){_0x51c53f[_0x80c5('0x50')]=_0x369a37;return _0x51c53f;});}})[_0x80c5('0x32')](respondWithFilteredResult(_0x38001c,_0xbebde4))['catch'](handleError(_0x38001c,null));};exports['removeAnswers']=function(_0x37d148,_0x44aa57,_0x101f78){return db['ChatWebsite'][_0x80c5('0x5e')]({'where':{'id':_0x37d148['params']['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x44aa57,null))[_0x80c5('0x32')](function(_0x5b8753){if(_0x5b8753){return _0x5b8753[_0x80c5('0x6b')](_0x37d148[_0x80c5('0x3d')]['ids']);}})[_0x80c5('0x32')](respondWithStatusCode(_0x44aa57,null))[_0x80c5('0x28')](handleError(_0x44aa57,null));};exports[_0x80c5('0x6c')]=function(_0x343fae,_0x1864a8,_0x5c42fe){_0x343fae['body'][_0x80c5('0x6d')]=_0x343fae[_0x80c5('0x6e')][_0x80c5('0x6f')];return db[_0x80c5('0x3a')]['find']({'where':{'id':_0x343fae[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x1864a8,null))['then'](saveUpdates(_0x343fae[_0x80c5('0x56')],null))[_0x80c5('0x32')](respondWithResult(_0x1864a8,null))[_0x80c5('0x28')](handleError(_0x1864a8,null));};exports['addAvatar']=function(_0x112e5c,_0x269835,_0x24e58e){_0x112e5c[_0x80c5('0x56')][_0x80c5('0x70')]=_0x112e5c[_0x80c5('0x6e')][_0x80c5('0x6f')];return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x112e5c[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x269835,null))[_0x80c5('0x32')](saveUpdates(_0x112e5c[_0x80c5('0x56')],null))[_0x80c5('0x32')](respondWithResult(_0x269835,null))[_0x80c5('0x28')](handleError(_0x269835,null));};exports[_0x80c5('0x71')]=function(_0x21b5b3,_0x3edc66,_0x3e6284){_0x21b5b3['body'][_0x80c5('0x72')]=_0x21b5b3['file'][_0x80c5('0x6f')];return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x21b5b3['params']['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x3edc66,null))['then'](saveUpdates(_0x21b5b3[_0x80c5('0x56')],null))[_0x80c5('0x32')](respondWithResult(_0x3edc66,null))[_0x80c5('0x28')](handleError(_0x3edc66,null));};exports['addSystemAvatar']=function(_0x3c8f8e,_0x416949,_0x523dd9){_0x3c8f8e[_0x80c5('0x56')][_0x80c5('0x73')]=_0x3c8f8e['file'][_0x80c5('0x6f')];return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x3c8f8e[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x416949,null))['then'](saveUpdates(_0x3c8f8e[_0x80c5('0x56')],null))[_0x80c5('0x32')](respondWithResult(_0x416949,null))[_0x80c5('0x28')](handleError(_0x416949,null));};exports[_0x80c5('0x74')]=function(_0x170b23,_0xad6f19,_0x514081){var _0x398ed3=path[_0x80c5('0x75')](config['root'],_0x80c5('0x76'));var _0x1b9aac={'where':{'id':_0x170b23[_0x80c5('0x52')]['id']},'attributes':['id',_0x80c5('0x6d')],'raw':!![]};var _0x140bb1=![];return require(_0x80c5('0x18'))['getLicense']()[_0x80c5('0x32')](function(_0xb46cd4){if(_0xb46cd4){_0x140bb1=_0xb46cd4['custom'];}})['then'](function(){return db[_0x80c5('0x3a')]['find'](_0x1b9aac);})['then'](handleEntityNotFound(_0xad6f19,null))[_0x80c5('0x32')](function(_0x2020dd){if(_0x2020dd){if(!_['isNil'](_0x2020dd[_0x80c5('0x6d')])){if(fs[_0x80c5('0x77')](path['join'](config['root'],_0x80c5('0x78'),_0x2020dd['sitepic']))&&_0x140bb1){_0x398ed3=path[_0x80c5('0x75')](config[_0x80c5('0x79')],_0x80c5('0x78'),_0x2020dd['sitepic']);}}return _0xad6f19[_0x80c5('0x7a')](_0x398ed3);}})[_0x80c5('0x28')](handleError(_0xad6f19,null));};exports[_0x80c5('0x7b')]=function(_0x298968,_0x536b51,_0x1b8356){var _0x1de533=path[_0x80c5('0x75')](config[_0x80c5('0x79')],_0x80c5('0x7c'));var _0x1e2abc={'where':{'id':_0x298968['params']['id']},'attributes':['id',_0x80c5('0x70')],'raw':!![]};return db['ChatWebsite'][_0x80c5('0x5e')](_0x1e2abc)[_0x80c5('0x32')](handleEntityNotFound(_0x536b51,null))[_0x80c5('0x32')](function(_0x1f4168){if(_0x1f4168){if(!_['isNil'](_0x1f4168[_0x80c5('0x70')])){if(fs[_0x80c5('0x77')](path[_0x80c5('0x75')](config[_0x80c5('0x79')],'server/files/images/avatars/',_0x1f4168[_0x80c5('0x70')]))){_0x1de533=path[_0x80c5('0x75')](config[_0x80c5('0x79')],_0x80c5('0x7d'),_0x1f4168[_0x80c5('0x70')]);}}return _0x536b51[_0x80c5('0x7a')](_0x1de533);}})[_0x80c5('0x28')](handleError(_0x536b51,null));};exports[_0x80c5('0x7e')]=function(_0x48b3e6,_0x3056f5,_0x1515dd){var _0x245b4b=path[_0x80c5('0x75')](config[_0x80c5('0x79')],_0x80c5('0x7f'));var _0x51ead1={'where':{'id':_0x48b3e6[_0x80c5('0x52')]['id']},'attributes':['id',_0x80c5('0x72'),_0x80c5('0x80')],'raw':!![]};return db[_0x80c5('0x3a')][_0x80c5('0x5e')](_0x51ead1)['then'](handleEntityNotFound(_0x3056f5,null))[_0x80c5('0x32')](function(_0x4e9289){if(_0x4e9289){if(!_[_0x80c5('0x81')](_0x4e9289[_0x80c5('0x72')])){if(fs['existsSync'](path[_0x80c5('0x75')](config[_0x80c5('0x79')],_0x80c5('0x7d'),_0x4e9289[_0x80c5('0x72')]))&&_0x4e9289[_0x80c5('0x80')]){_0x245b4b=path['join'](config[_0x80c5('0x79')],_0x80c5('0x7d'),_0x4e9289[_0x80c5('0x72')]);}}return _0x3056f5['download'](_0x245b4b);}})['catch'](handleError(_0x3056f5,null));};exports['getSystemAvatar']=function(_0x5305ba,_0x7c2fb8,_0x251352){var _0x4a0ea2=path[_0x80c5('0x75')](config['root'],_0x80c5('0x82'));var _0x39c7cc={'where':{'id':_0x5305ba[_0x80c5('0x52')]['id']},'attributes':['id',_0x80c5('0x73')],'raw':!![]};return db[_0x80c5('0x3a')][_0x80c5('0x5e')](_0x39c7cc)[_0x80c5('0x32')](handleEntityNotFound(_0x7c2fb8,null))[_0x80c5('0x32')](function(_0x112838){if(_0x112838){if(!_[_0x80c5('0x81')](_0x112838[_0x80c5('0x73')])){if(fs[_0x80c5('0x77')](path[_0x80c5('0x75')](config[_0x80c5('0x79')],_0x80c5('0x7d'),_0x112838[_0x80c5('0x73')]))){_0x4a0ea2=path[_0x80c5('0x75')](config[_0x80c5('0x79')],'server/files/images/avatars/',_0x112838[_0x80c5('0x73')]);}}return _0x7c2fb8[_0x80c5('0x7a')](_0x4a0ea2);}})['catch'](handleError(_0x7c2fb8,null));};exports[_0x80c5('0x83')]=function(_0x1c2e64,_0xd95181,_0x3f2d1f){var _0x1b88b1=require(_0x80c5('0x84'));var _0x7b1936=new _0x1b88b1();var _0x41eeef=_0x7b1936[_0x80c5('0x85')](_0x1c2e64[_0x80c5('0x86')][_0x80c5('0x87')])[_0x80c5('0x88')]();var _0x210025={'body':_0x1c2e64[_0x80c5('0x56')],'channel':_0x80c5('0x89')};var _0x36a91a=[];var _0x47ba24=[];var _0x29eeea={};var _0x57d951=![];return db['CmContact'][_0x80c5('0x5f')]()[_0x80c5('0x32')](function(_0x5e3e18){if(!_0x5e3e18){throw new db[(_0x80c5('0x8a'))][(_0x80c5('0x8b'))]('no\x20available\x20attributes');}_0x36a91a=_[_0x80c5('0x8c')](_[_0x80c5('0x3e')](_0x5e3e18),[_0x80c5('0x8d'),_0x80c5('0x8e')]);_0x47ba24=_[_0x80c5('0x8c')](_[_0x80c5('0x3e')](_0x5e3e18),['createdAt',_0x80c5('0x8e'),_0x80c5('0x8f'),_0x80c5('0x90')]);if(_0x1c2e64[_0x80c5('0x56')]['id']){delete _0x1c2e64[_0x80c5('0x56')]['id'];}if(_['isNil'](_0x1c2e64[_0x80c5('0x56')]['from'])){throw new db[(_0x80c5('0x8a'))][(_0x80c5('0x8b'))](_0x80c5('0x91'));}if(_[_0x80c5('0x81')](_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x56')])||_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x56')]===''){throw new db[(_0x80c5('0x8a'))]['ValidationError'](_0x80c5('0x92'));}if(_['isNil'](_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x93')])){throw new db['Sequelize']['ValidationError'](_0x80c5('0x94')+_0x47ba24);}if(!_['includes'](_0x47ba24,_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x93')])){throw new db[(_0x80c5('0x8a'))][(_0x80c5('0x8b'))](_0x80c5('0x95')+_0x47ba24);}_0x29eeea[_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x93')]]=_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x96')];})[_0x80c5('0x32')](function(){return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x1c2e64[_0x80c5('0x52')]['id']},'include':[{'model':db[_0x80c5('0x97')],'as':_0x80c5('0x98'),'include':[{'model':db[_0x80c5('0x99')],'as':_0x80c5('0x9a'),'where':_0x29eeea,'limit':0x1,'order':[[_0x80c5('0x8e'),_0x80c5('0x9b')]]}]},{'model':db[_0x80c5('0x9c')],'as':_0x80c5('0x9d')}]});})['then'](handleEntityNotFound(_0xd95181,null))[_0x80c5('0x32')](function(_0xb3c08){if(_0xb3c08&&_0xb3c08['List']){_0x210025[_0x80c5('0x9e')]=_0xb3c08;_0x210025['applications']=_0xb3c08['Applications'];_0x210025[_0x80c5('0x9f')]=_0xb3c08[_0x80c5('0x98')];_0x210025['applications']=_[_0x80c5('0xa0')](_0x210025[_0x80c5('0xa1')],[_0x80c5('0xa2')],[_0x80c5('0xa3')]);if(_0x210025[_0x80c5('0x9e')][_0x80c5('0x9d')]){delete _0x210025[_0x80c5('0x9e')][_0x80c5('0x9d')];}if(_0x210025['account'][_0x80c5('0x98')]&&_0x210025[_0x80c5('0x9e')]['List'][_0x80c5('0x9a')][_0x80c5('0x43')]){return _0x210025['account'][_0x80c5('0x98')][_0x80c5('0x9a')][0x0];}var _0x2adfd5=_[_0x80c5('0x1a')](_0x1c2e64[_0x80c5('0x56')],{'firstName':_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x96')],'ListId':_0xb3c08[_0x80c5('0x90')]});_0x2adfd5[_0x1c2e64['body'][_0x80c5('0x93')]]=_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x96')];return db[_0x80c5('0x99')]['create'](_0x2adfd5,{'fields':_0x36a91a,'raw':!![]});}})[_0x80c5('0x32')](handleEntityNotFound(_0xd95181,null))[_0x80c5('0x32')](function(_0x46d001){_0x210025[_0x80c5('0xa4')]=_0x46d001;var _0x3c3854=_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xa5')];if(_0x1c2e64[_0x80c5('0x86')]['cf-connecting-ip']){_0x3c3854=_0x1c2e64[_0x80c5('0x86')]['cf-connecting-ip'];}else if(_0x1c2e64[_0x80c5('0x86')][_0x80c5('0xa6')]){_0x3c3854=_['first'](_0x1c2e64['headers'][_0x80c5('0xa6')][_0x80c5('0xa7')](','));}if(_0x46d001){var _0x18e61a={'ContactId':_0x46d001['id'],'ChatWebsiteId':_0x1c2e64[_0x80c5('0x52')]['id'],'from':(_0x46d001[_0x80c5('0xa8')]||'')+'\x20'+(_0x46d001[_0x80c5('0xa9')]||''),'customerIp':_0x3c3854,'customerPort':_0x1c2e64[_0x80c5('0x86')][_0x80c5('0xaa')]?_0x1c2e64[_0x80c5('0x86')][_0x80c5('0xaa')]:null,'referer':_0x1c2e64['body']['referer'],'browserName':_0x41eeef[_0x80c5('0xab')][_0x80c5('0x37')]&&_0x41eeef[_0x80c5('0xab')][_0x80c5('0xac')]?util[_0x80c5('0xad')](_0x80c5('0xae'),_0x41eeef['browser']['name'],_0x41eeef[_0x80c5('0xab')][_0x80c5('0xac')]):_0x80c5('0xaf'),'browserVersion':_0x41eeef[_0x80c5('0xab')][_0x80c5('0xac')]||_0x80c5('0xaf'),'osName':util[_0x80c5('0xad')]('%s\x20%s',_0x41eeef['os'][_0x80c5('0x37')],_0x41eeef['os'][_0x80c5('0xac')]),'osVersion':_0x41eeef['os'][_0x80c5('0xac')],'deviceModel':_0x41eeef[_0x80c5('0xb0')][_0x80c5('0x40')]&&_0x41eeef['device'][_0x80c5('0xb1')]?util[_0x80c5('0xad')]('%s\x20%s\x20%s',_0x41eeef[_0x80c5('0xb0')][_0x80c5('0x40')],_0x41eeef['device']['vendor'],_0x41eeef[_0x80c5('0xb0')]['type']):null,'deviceVendor':_0x41eeef[_0x80c5('0xb0')][_0x80c5('0xb1')],'deviceType':_0x41eeef[_0x80c5('0xb0')][_0x80c5('0xb2')],'formData':JSON[_0x80c5('0xb3')](_0x1c2e64[_0x80c5('0x56')])};var _0xb9cd63={'ChatWebsiteId':_0x1c2e64[_0x80c5('0x52')]['id'],'closed':![]};if(_0x1c2e64['body']['threadId']){_0xb9cd63[_0x80c5('0xb4')]=_0x1c2e64[_0x80c5('0x56')]['threadId'];return db['ChatInteraction'][_0x80c5('0x5e')]({'where':_0xb9cd63})[_0x80c5('0x32')](function(_0xae97a1){if(_0xae97a1){return[_0xae97a1,![]];}_0x18e61a[_0x80c5('0xb4')]=_0x1c2e64[_0x80c5('0x56')]['threadId'];_0x18e61a[_0x80c5('0xb5')]=_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xb5')];return db['ChatInteraction'][_0x80c5('0x55')](_0x18e61a)[_0x80c5('0x32')](function(_0x72c21){return[_0x72c21,!![]];});});}_0xb9cd63[_0x80c5('0xb6')]=_0x46d001['id'];if(_0x1c2e64['body'][_0x80c5('0xb7')]&&_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xb7')]['id']){_0xb9cd63['id']=_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xb7')]['id'];return db['ChatInteraction'][_0x80c5('0x5e')]({'where':_0xb9cd63})[_0x80c5('0x32')](function(_0x4ad01e){if(_0x4ad01e){return[_0x4ad01e,![]];}return db[_0x80c5('0xb8')][_0x80c5('0x55')](_0x18e61a)[_0x80c5('0x32')](function(_0x38ebc5){return[_0x38ebc5,!![]];});});}return db['ChatInteraction'][_0x80c5('0x55')](_0x18e61a)['then'](function(_0xa1dc16){return[_0xa1dc16,!![]];});}})['spread'](function(_0x123dad,_0x2c7431){if(_0x123dad){_0x57d951=_0x2c7431;if(!_0x2c7431){var _0x43f482={'from':(_0x210025[_0x80c5('0xa4')][_0x80c5('0xa8')]||'')+'\x20'+(_0x210025[_0x80c5('0xa4')][_0x80c5('0xa9')]||'')};if(_0x1c2e64[_0x80c5('0x56')]['threadId']&&_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xb9')]&&_0x1c2e64['body'][_0x80c5('0xb4')]!=_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xb9')]){_0x43f482['threadId']=_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xb9')];}return _0x123dad[_0x80c5('0x31')](_0x43f482);}else{return _0x123dad;}}})[_0x80c5('0x32')](function(_0x4411c0){_0x210025[_0x80c5('0xb7')]=_0x4411c0['get']({'plain':!![]});_0x210025[_0x80c5('0xb7')]['created']=_0x57d951;if(_0x210025['interaction'][_0x80c5('0xba')]){if(_0x210025['account']['autoclose']){_0x210025[_0x80c5('0xa1')]['push']({'id':0x0,'priority':_0x210025[_0x80c5('0xa1')]['length']+0x1,'app':_0x80c5('0xbb'),'appdata':_0x80c5('0xbc'),'interval':_0x80c5('0xbd')});}}return db[_0x80c5('0xbe')][_0x80c5('0x55')]({'body':_0x1c2e64[_0x80c5('0x56')][_0x80c5('0x56')],'ChatWebsiteId':_0x1c2e64[_0x80c5('0x52')]['id'],'ChatInteractionId':_0x4411c0['id'],'direction':'in','ContactId':_0x210025[_0x80c5('0xa4')]['id'],'AttachmentId':_0x1c2e64[_0x80c5('0x56')][_0x80c5('0xbf')]});})[_0x80c5('0x32')](function(_0x5b223c){_0x210025[_0x80c5('0x26')]=_0x5b223c;if(_0x210025[_0x80c5('0xb7')][_0x80c5('0xc0')]){return db[_0x80c5('0xc1')][_0x80c5('0x5e')]({'attributes':['id',_0x80c5('0x37')],'where':{'id':_0x210025[_0x80c5('0xb7')]['UserId']}})['then'](function(_0x113fad){if(_0x113fad){_0x210025[_0x80c5('0xa1')][_0x80c5('0xc2')]({'id':0x0,'priority':0x0,'app':_0x80c5('0xc3'),'appdata':_0x113fad[_0x80c5('0x37')]+','+(_0x210025[_0x80c5('0x9e')][_0x80c5('0xc4')]||0xa),'interval':_0x80c5('0xbd')});_0x210025[_0x80c5('0xc5')]=!![];}return respondWithRpcPromise(_0x80c5('0xc6'),'startRouting',_0x210025);});}return respondWithRpcPromise(_0x80c5('0xc6'),_0x80c5('0xc7'),_0x210025);})[_0x80c5('0x32')](function(_0x288929){respondWithRpcPromise('EventManager',_0x80c5('0xc8'),{'event':_0x80c5('0x83'),'message':_0x288929},client9002);return _0x288929;})[_0x80c5('0x32')](respondWithResult(_0xd95181,null))['catch'](handleError(_0xd95181,null));};exports[_0x80c5('0xc9')]=function(_0x34772f,_0x2cb4f1,_0x112ef9){var _0x17c4e6,_0x69f50e,_0x3d6420;var _0x21732a=[];var _0x1cd99d=[];var _0x9f5e56={};return db['CmContact']['describe']()[_0x80c5('0x32')](function(_0x3acda0){if(!_0x3acda0){throw new db[(_0x80c5('0x8a'))]['ValidationError']('no\x20available\x20attributes');}_0x1cd99d=_['difference'](_['keys'](_0x3acda0),['createdAt',_0x80c5('0x8e')]);_0x21732a=_[_0x80c5('0x8c')](_[_0x80c5('0x3e')](_0x3acda0),[_0x80c5('0x8d'),_0x80c5('0x8e'),_0x80c5('0x8f'),_0x80c5('0x90')]);if(_0x34772f[_0x80c5('0x56')]['id']){delete _0x34772f[_0x80c5('0x56')]['id'];}if(_[_0x80c5('0x81')](_0x34772f[_0x80c5('0x56')]['from'])){throw _0x2cb4f1[_0x80c5('0x2a')](0x1f4)[_0x80c5('0xca')](new db[(_0x80c5('0x8a'))][(_0x80c5('0x8b'))](_0x80c5('0x91')));}if(_[_0x80c5('0x81')](_0x34772f[_0x80c5('0x56')]['body'])||_0x34772f[_0x80c5('0x56')]['body']===''){throw _0x2cb4f1[_0x80c5('0x2a')](0x1f4)[_0x80c5('0xca')](new db[(_0x80c5('0x8a'))][(_0x80c5('0x8b'))](_0x80c5('0x92')));}if(_[_0x80c5('0x81')](_0x34772f[_0x80c5('0x56')][_0x80c5('0xcb')])){throw _0x2cb4f1[_0x80c5('0x2a')](0x1f4)[_0x80c5('0xca')](new db[(_0x80c5('0x8a'))][(_0x80c5('0x8b'))](_0x80c5('0xcc')+_0x21732a));}if(!_[_0x80c5('0xcd')](_0x21732a,_0x34772f[_0x80c5('0x56')][_0x80c5('0xcb')])){throw _0x2cb4f1[_0x80c5('0x2a')](0x1f4)[_0x80c5('0xca')](new db[(_0x80c5('0x8a'))][(_0x80c5('0x8b'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x21732a));}_0x9f5e56[_0x34772f[_0x80c5('0x56')][_0x80c5('0xcb')]]=_0x34772f['body'][_0x80c5('0x96')];})[_0x80c5('0x32')](function(){return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x34772f['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0x80c5('0xce')}]});})['then'](handleEntityNotFound(_0x2cb4f1,null))[_0x80c5('0x32')](function(_0x1bb8dc){if(_0x1bb8dc&&_0x1bb8dc['List']){_0x69f50e=_0x1bb8dc;var _0x443f81=_[_0x80c5('0x1a')](_0x34772f[_0x80c5('0x56')],{'firstName':_0x34772f[_0x80c5('0x56')][_0x80c5('0x96')],'phone':_0x34772f[_0x80c5('0x56')][_0x80c5('0x96')],'ListId':_0x1bb8dc[_0x80c5('0x90')]});_0x443f81[_0x34772f[_0x80c5('0x56')][_0x80c5('0xcb')]]=_0x34772f[_0x80c5('0x56')][_0x80c5('0x96')];return db[_0x80c5('0x99')][_0x80c5('0xcf')]({'where':_0x9f5e56,'defaults':_0x443f81});}})[_0x80c5('0xd0')](function(_0x3cd41d){if(_0x3cd41d){_0x3d6420=_0x3cd41d;var _0x22d3c3=fs[_0x80c5('0xd1')](path[_0x80c5('0x75')](config['root'],_0x80c5('0xd2')),'utf8');var _0x54d2d2=ejs[_0x80c5('0xd3')](_0x22d3c3,{'body':_[_0x80c5('0xd4')](_0x34772f['body'][_0x80c5('0x56')]),'bodyTitle':_0x69f50e[_0x80c5('0xd5')]});return db[_0x80c5('0xd6')][_0x80c5('0x55')]({'body':_0x54d2d2,'ContactId':_0x3cd41d['id'],'ChatWebsiteId':_0x69f50e['id']});}})[_0x80c5('0x32')](function(_0x41da6f){if(_0x41da6f){_0x17c4e6=_0x41da6f;return db[_0x80c5('0xce')][_0x80c5('0x63')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x80c5('0xd7'),'raw':!![]}]});}})[_0x80c5('0x32')](function(_0x2cb314){if(_0x2cb314&&_0x2cb314[_0x80c5('0xd7')]&&_0x69f50e[_0x80c5('0xd8')]&&_0x69f50e[_0x80c5('0xd9')]){var _0x19587c={'tls':{'rejectUnauthorized':![]}};if(_0x2cb314[_0x80c5('0xd7')][_0x80c5('0xda')]){_0x19587c[_0x80c5('0xda')]=_0x2cb314[_0x80c5('0xd7')]['service'];}else{_0x19587c[_0x80c5('0xdb')]=_0x2cb314[_0x80c5('0xd7')][_0x80c5('0xdb')];_0x19587c[_0x80c5('0xdc')]=_0x2cb314[_0x80c5('0xd7')]['port'];_0x19587c[_0x80c5('0xdd')]=_0x2cb314[_0x80c5('0xd7')][_0x80c5('0xdd')];}if(_0x2cb314[_0x80c5('0xd7')][_0x80c5('0xde')]){_0x19587c['auth']={'user':_0x2cb314['Smtp'][_0x80c5('0x57')],'pass':_0x2cb314['Smtp'][_0x80c5('0xdf')]};}return respondWithRpcPromise('SendMail',_0x80c5('0xe0'),{'account':_0x19587c,'message':{'from':util['format'](_0x80c5('0xe1'),_0x2cb314[_0x80c5('0x37')],_0x2cb314[_0x80c5('0xe2')]||_0x2cb314['Smtp'][_0x80c5('0x57')]),'to':_0x69f50e[_0x80c5('0xd9')],'subject':_0x69f50e[_0x80c5('0xe3')],'text':_0x17c4e6[_0x80c5('0x56')]}},client9003)[_0x80c5('0x32')](function(){return _0x17c4e6;})[_0x80c5('0x28')](function(_0x43e1fb){console[_0x80c5('0x25')](_0x43e1fb);});}})[_0x80c5('0x32')](function(){if(_0x69f50e&&_0x69f50e[_0x80c5('0xe4')]&&_0x69f50e[_0x80c5('0xe5')]){var _0x2ec7b2={'from':_0x3d6420[_0x80c5('0xe2')],'firstName':_0x3d6420[_0x80c5('0xa8')],'lastName':_0x3d6420['lastName'],'mapKey':_0x80c5('0xe2'),'message':{'from':_0x3d6420[_0x80c5('0xe2')],'to':_0x69f50e[_0x80c5('0xce')][_0x80c5('0xe2')],'cc':'','subject':_0x69f50e['offlineMessageSubject'],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0x80c5('0xe6'),'ChatWebsiteId':_0x69f50e['id'],'ChatOfflineMessageId':_0x17c4e6['id'],'originTo':_0x69f50e[_0x80c5('0xce')][_0x80c5('0xe2')]},'body':_0x17c4e6[_0x80c5('0x56')]};var _0x2b9edc={'account':{'id':_0x69f50e[_0x80c5('0xe5')]},'body':_0x2ec7b2,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x80c5('0xe7'),_0x80c5('0xe8'),_0x2b9edc,client9001)[_0x80c5('0x32')](function(){return _0x17c4e6;})['catch'](function(_0x5ef88a){console[_0x80c5('0x25')](_0x5ef88a);});}return;})[_0x80c5('0x32')](function(){if(_0x17c4e6){return _0x17c4e6;}})[_0x80c5('0x32')](respondWithResult(_0x2cb4f1,null))[_0x80c5('0x28')](handleError(_0x2cb4f1,null));};exports[_0x80c5('0xe9')]=function(_0x4c2fee,_0x538948,_0x109856){return db[_0x80c5('0xb8')][_0x80c5('0x5e')]({'where':{'id':_0x4c2fee[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x538948,null))[_0x80c5('0x32')](function(_0x5eb2e0){if(_0x5eb2e0){return _0x5eb2e0[_0x80c5('0xe9')](_0x4c2fee[_0x80c5('0x56')][_0x80c5('0xea')],_[_0x80c5('0xeb')](_0x4c2fee[_0x80c5('0x56')],[_0x80c5('0xea'),'id'])||{});}})['then'](respondWithResult(_0x538948,null))[_0x80c5('0x28')](handleError(_0x538948,null));};exports[_0x80c5('0xec')]=function(_0xa5e138,_0x2b8c33,_0x16e866){var _0xe9e87f={'raw':![],'where':{}};var _0xbfdae4={};var _0x25cbf6={'count':0x0,'rows':[]};return db[_0x80c5('0x3a')][_0x80c5('0x63')]({'where':{'id':_0xa5e138['params']['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x2b8c33,null))[_0x80c5('0x32')](function(_0x19ae48){if(_0x19ae48){_0xbfdae4['model']=_[_0x80c5('0x3e')](db[_0x80c5('0xb8')][_0x80c5('0x3b')]);_0xbfdae4['query']=_['keys'](_0xa5e138[_0x80c5('0x3d')]);_0xbfdae4[_0x80c5('0x3f')]=_[_0x80c5('0x64')](_0xbfdae4['model'],_0xbfdae4['query']);_0xe9e87f[_0x80c5('0x41')]=_['intersection'](_0xbfdae4[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0xa5e138['query']['fields']));_0xe9e87f[_0x80c5('0x41')]=_0xe9e87f[_0x80c5('0x41')][_0x80c5('0x43')]?_0xe9e87f[_0x80c5('0x41')]:_0xbfdae4[_0x80c5('0x40')];if(!_0xa5e138[_0x80c5('0x3d')][_0x80c5('0x44')](_0x80c5('0x65'))){_0xe9e87f[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0xa5e138[_0x80c5('0x3d')][_0x80c5('0x45')]);_0xe9e87f['offset']=qs['offset'](_0xa5e138[_0x80c5('0x3d')][_0x80c5('0x2c')]);}_0xe9e87f['order']=qs[_0x80c5('0x47')](_0xa5e138['query'][_0x80c5('0x47')]);_0xe9e87f[_0x80c5('0x48')]=qs[_0x80c5('0x3f')](_[_0x80c5('0x49')](_0xa5e138[_0x80c5('0x3d')],_0xbfdae4[_0x80c5('0x3f')]));_0xe9e87f[_0x80c5('0x48')][_0x80c5('0x66')]=_0x19ae48['id'];if(_0xa5e138[_0x80c5('0x3d')][_0x80c5('0x4a')]){_0xe9e87f['where']=_[_0x80c5('0x4c')](_0xe9e87f[_0x80c5('0x48')],{'$or':_[_0x80c5('0x39')](_0xe9e87f[_0x80c5('0x41')],function(_0xee985d){var _0x18189e={};_0x18189e[_0xee985d]={'$like':'%'+_0xa5e138['query'][_0x80c5('0x4a')]+'%'};return _0x18189e;})});}_0xe9e87f=_[_0x80c5('0x4c')]({},_0xe9e87f,_0xa5e138[_0x80c5('0x4d')]);return db['ChatInteraction']['count']({'where':_0xe9e87f[_0x80c5('0x48')]})[_0x80c5('0x32')](function(_0x175f8e){_0x25cbf6[_0x80c5('0x4e')]=_0x175f8e;if(_0xa5e138[_0x80c5('0x3d')][_0x80c5('0x54')]){_0xe9e87f[_0x80c5('0x4f')]=[{'model':db[_0x80c5('0x99')],'as':_0x80c5('0xed'),'required':![]},{'model':db[_0x80c5('0xc1')],'as':'Owner','attributes':['name',_0x80c5('0xee'),_0x80c5('0xef')],'required':![]},{'model':db[_0x80c5('0xf0')],'as':'Tags','attributes':['id','name','color'],'where':_0xa5e138[_0x80c5('0x3d')][_0x80c5('0xf1')]?{'id':_0xa5e138[_0x80c5('0x3d')][_0x80c5('0xf1')]}:undefined,'required':_0xa5e138[_0x80c5('0x3d')]['tag']?!![]:![]}];}return db[_0x80c5('0xb8')][_0x80c5('0x67')](_0xe9e87f);})[_0x80c5('0x32')](function(_0xda0cac){_0x25cbf6[_0x80c5('0x50')]=_0xda0cac;return _0x25cbf6;});}})['then'](respondWithFilteredResult(_0x2b8c33,_0xe9e87f))[_0x80c5('0x28')](handleError(_0x2b8c33,null));};function iftimePromise(_0x508fe0,_0x1ea9f9){return respondWithRpcPromise(_0x80c5('0xf2'),_0x80c5('0xf3'),{'command':_0x1ea9f9[_0x80c5('0xf4')]?util['format'](_0x80c5('0xf5'),_0x508fe0[_0x80c5('0xf6')],_0x1ea9f9[_0x80c5('0xf4')]):util[_0x80c5('0xad')](_0x80c5('0xf7'),_0x508fe0['interval'])},client9002)[_0x80c5('0x32')](function(_0x2a39c5){var _0x5f4378=_0x2a39c5&&_0x2a39c5[_0x80c5('0xf8')](_0x80c5('0xf9'))>=0x0?!![]:![];logger[_0x80c5('0x21')](_0x80c5('0xfa'),_0x1ea9f9['id'],_0x508fe0['id'],_0x508fe0[_0x80c5('0xf6')],_0x5f4378?_0x80c5('0xfb'):_0x80c5('0xfc'),_0x1ea9f9[_0x80c5('0xf4')]?_0x1ea9f9[_0x80c5('0xf4')]:'No\x20timezone');return _0x5f4378;})[_0x80c5('0x28')](function(_0x2091a1){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1ea9f9['id'],_0x508fe0['id'],_0x508fe0['interval'],util[_0x80c5('0xfd')](_0x2091a1,{'showHidden':![],'depth':null}),_0x1ea9f9[_0x80c5('0xf4')]?_0x1ea9f9[_0x80c5('0xf4')]:_0x80c5('0xfe'));return![];});}exports['getSnippet']=function(_0x87559c,_0x1ee553,_0x49f3a7){var _0x46f64c=0x0;var _0x1ff1c2=0x0;var _0x10ae18=![];var _0x1506fc;var _0x43d28f;return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x87559c[_0x80c5('0x52')]['id']},'include':[{'model':db[_0x80c5('0xff')],'as':_0x80c5('0xff'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x80c5('0xf6')],'raw':!![]}]}]})[_0x80c5('0x32')](handleEntityNotFound(_0x1ee553,null))[_0x80c5('0x32')](function(_0x98cc05){if(_0x98cc05){_0x1506fc=_0x98cc05;return _0x98cc05['getProactiveActions']({'raw':!![]});}})[_0x80c5('0x32')](function(_0x1d1410){if(_0x1506fc){if(_0x1d1410){_0x43d28f=_0x1d1410;}}return require(_0x80c5('0x18'))[_0x80c5('0x100')]();})['then'](function(_0x34444f){if(_0x34444f){_0x1ff1c2=_0x34444f[_0x80c5('0x101')];_0x10ae18=_0x34444f[_0x80c5('0x102')];}})[_0x80c5('0x32')](function(){return db['ChatInteraction'][_0x80c5('0x4e')]({'where':{'closed':![]}});})[_0x80c5('0x32')](function(_0x4fb3c1){_0x46f64c=_0x4fb3c1;if(_0x1ff1c2&&_0x4fb3c1>_0x1ff1c2){return db[_0x80c5('0x103')]['findOne']({'where':{'id':0x1}})['then'](function(_0x31dc6b){if(_0x31dc6b){_0x31dc6b[_0x80c5('0x104')](_0x80c5('0x105'));}});}})[_0x80c5('0x32')](function(){if(_0x1506fc[_0x80c5('0xff')]&&_0x1506fc[_0x80c5('0xff')][_0x80c5('0x106')]){var _0x59b79a=[];for(var _0x18d134=0x0;_0x18d134<_0x1506fc[_0x80c5('0xff')]['Intervals'][_0x80c5('0x43')];_0x18d134++){var _0x337a90=_0x1506fc[_0x80c5('0xff')]['Intervals'][_0x18d134]['get']({'plain':!![]});_0x59b79a[_0x80c5('0x107')](iftimePromise(_0x337a90,_0x1506fc));}return BPromise[_0x80c5('0x108')](_0x59b79a)['then'](function(_0x5ab5ac){return _[_0x80c5('0x109')](_0x5ab5ac);});}else{return!![];}})[_0x80c5('0x32')](function(_0x1b1cdf){var _0x340fcf=fs[_0x80c5('0xd1')](path[_0x80c5('0x75')](config['root'],_0x80c5('0x10a')),_0x80c5('0x10b'));var _0x53a0c0={'remote':_0x1506fc['remote'],'query':querystring[_0x80c5('0xb3')](_['merge'](_0x1506fc[_0x80c5('0x34')]({'plain':!![]}),{'customerIp':_0x87559c[_0x80c5('0x86')]['x-forwarded-for']||_0x87559c[_0x80c5('0x86')][_0x80c5('0x10c')]||_0x87559c[_0x80c5('0x10d')]['remoteAddress']||_0x87559c['ip'],'referer':_0x87559c[_0x80c5('0x86')][_0x80c5('0x10e')],'openedInteractions':_0x46f64c,'maxInteractions':_0x1ff1c2,'virtual':_0x10ae18[_0x80c5('0x101')],'online':_0x1b1cdf,'custom':_0x10ae18}))[_0x80c5('0x10f')](/'/g,'\x5c\x27')};_0x1ee553[_0x80c5('0xca')](ejs[_0x80c5('0xd3')](Mustache[_0x80c5('0xd3')](_0x340fcf,_0x53a0c0),{'proactiveActions':_0x43d28f,'alignment':_0x1506fc[_0x80c5('0x110')],'verticalAlignment':_0x1506fc[_0x80c5('0x111')],'div_color':_0x1506fc[_0x80c5('0x112')],'text_color':_0x1506fc[_0x80c5('0x113')]}));})['catch'](handleError(_0x1ee553,null));};exports[_0x80c5('0x114')]=function(_0xd9dc2e,_0x1e1f36,_0x346092){return db[_0x80c5('0x3a')]['findOne']({'where':{'id':_0xd9dc2e[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x1e1f36,null))[_0x80c5('0x32')](function(_0x1dcb32){if(_0x1dcb32){return db['sequelize'][_0x80c5('0x115')](function(_0x486ea6){return db[_0x80c5('0x9c')][_0x80c5('0x33')]({'where':{'ChatWebsiteId':_0xd9dc2e['params']['id']},'transaction':_0x486ea6})[_0x80c5('0x32')](function(_0x5c7868){var _0x3b83b5=_[_0x80c5('0x39')](_0xd9dc2e[_0x80c5('0x56')],function(_0x5990a5){_0x5990a5['ChatWebsiteId']=_0xd9dc2e[_0x80c5('0x52')]['id'];return _0x5990a5;});return db[_0x80c5('0x9c')]['bulkCreate'](_0x3b83b5,{'transaction':_0x486ea6});});})[_0x80c5('0x32')](function(){return db[_0x80c5('0x9c')]['findAndCountAll']({'where':{'ChatWebsiteId':_0xd9dc2e['params']['id']},'order':_0x80c5('0xa2')});});}})['then'](respondWithResult(_0x1e1f36,null))[_0x80c5('0x28')](handleError(_0x1e1f36,null));};exports[_0x80c5('0x116')]=function(_0x5377a7,_0x113597,_0x17b82f){var _0x4cd552={};var _0x3e361f={};var _0x1f81ee;var _0x570489;return db['ChatWebsite']['findOne']({'where':{'id':_0x5377a7['params']['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x113597,null))[_0x80c5('0x32')](function(_0x4635ef){if(_0x4635ef){_0x1f81ee=_0x4635ef;_0x3e361f[_0x80c5('0x40')]=_['keys'](db['ChatApplication'][_0x80c5('0x3b')]);_0x3e361f[_0x80c5('0x3d')]=_['keys'](_0x5377a7['query']);_0x3e361f[_0x80c5('0x3f')]=_['intersection'](_0x3e361f[_0x80c5('0x40')],_0x3e361f[_0x80c5('0x3d')]);_0x4cd552[_0x80c5('0x41')]=_[_0x80c5('0x64')](_0x3e361f[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0x5377a7[_0x80c5('0x3d')][_0x80c5('0x42')]));_0x4cd552['attributes']=_0x4cd552[_0x80c5('0x41')][_0x80c5('0x43')]?_0x4cd552[_0x80c5('0x41')]:_0x3e361f['model'];_0x4cd552[_0x80c5('0x46')]=qs[_0x80c5('0x47')](_0x5377a7[_0x80c5('0x3d')][_0x80c5('0x47')]);_0x4cd552[_0x80c5('0x48')]=qs[_0x80c5('0x3f')](_['pick'](_0x5377a7[_0x80c5('0x3d')],_0x3e361f[_0x80c5('0x3f')]));if(_0x5377a7['query'][_0x80c5('0x4a')]){_0x4cd552[_0x80c5('0x48')]=_[_0x80c5('0x4c')](_0x4cd552[_0x80c5('0x48')],{'$or':_['map'](_0x4cd552[_0x80c5('0x41')],function(_0x2a5a59){var _0x4d93f4={};_0x4d93f4[_0x2a5a59]={'$like':'%'+_0x5377a7[_0x80c5('0x3d')]['filter']+'%'};return _0x4d93f4;})});}_0x4cd552=_[_0x80c5('0x4c')]({},_0x4cd552,_0x5377a7[_0x80c5('0x4d')]);return _0x1f81ee[_0x80c5('0x116')](_0x4cd552);}})[_0x80c5('0x32')](function(_0x3822b4){if(_0x3822b4){_0x570489=_0x3822b4[_0x80c5('0x43')];if(!_0x5377a7['query'][_0x80c5('0x44')]('nolimit')){_0x4cd552[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0x5377a7[_0x80c5('0x3d')][_0x80c5('0x45')]);_0x4cd552['offset']=qs[_0x80c5('0x2c')](_0x5377a7[_0x80c5('0x3d')][_0x80c5('0x2c')]);}return _0x1f81ee['getApplications'](_0x4cd552);}})['then'](function(_0x481833){if(_0x481833){return _0x481833?{'count':_0x570489,'rows':_0x481833}:null;}})[_0x80c5('0x32')](respondWithResult(_0x113597,null))[_0x80c5('0x28')](handleError(_0x113597,null));};exports[_0x80c5('0x117')]=function(_0x4af9bc,_0x5c8e4b,_0xeb8a56){return db['chatProactiveAction'][_0x80c5('0x5e')]({'where':{'id':_0x4af9bc[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x5c8e4b,null))[_0x80c5('0x32')](function(_0x28faa6){if(_0x28faa6){return _0x28faa6[_0x80c5('0x117')](_0x4af9bc[_0x80c5('0x56')][_0x80c5('0xea')],_[_0x80c5('0xeb')](_0x4af9bc[_0x80c5('0x56')],[_0x80c5('0xea'),'id'])||{});}})[_0x80c5('0x32')](respondWithResult(_0x5c8e4b,null))['catch'](handleError(_0x5c8e4b,null));};exports[_0x80c5('0x118')]=function(_0x26ec78,_0x3c7ec8,_0x563fef){var _0x5b32b6={};var _0x4af24e={};var _0x282a61;var _0x48d51e;return db['ChatWebsite']['findOne']({'where':{'id':_0x26ec78[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x3c7ec8,null))['then'](function(_0x3fbd7e){if(_0x3fbd7e){_0x282a61=_0x3fbd7e;_0x4af24e[_0x80c5('0x40')]=_[_0x80c5('0x3e')](db['ChatProactiveAction'][_0x80c5('0x3b')]);_0x4af24e[_0x80c5('0x3d')]=_['keys'](_0x26ec78[_0x80c5('0x3d')]);_0x4af24e[_0x80c5('0x3f')]=_[_0x80c5('0x64')](_0x4af24e[_0x80c5('0x40')],_0x4af24e[_0x80c5('0x3d')]);_0x5b32b6['attributes']=_['intersection'](_0x4af24e[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0x26ec78['query'][_0x80c5('0x42')]));_0x5b32b6[_0x80c5('0x41')]=_0x5b32b6[_0x80c5('0x41')][_0x80c5('0x43')]?_0x5b32b6[_0x80c5('0x41')]:_0x4af24e[_0x80c5('0x40')];_0x5b32b6[_0x80c5('0x46')]=qs[_0x80c5('0x47')](_0x26ec78[_0x80c5('0x3d')][_0x80c5('0x47')]);_0x5b32b6[_0x80c5('0x48')]=qs[_0x80c5('0x3f')](_[_0x80c5('0x49')](_0x26ec78[_0x80c5('0x3d')],_0x4af24e['filters']));if(_0x26ec78[_0x80c5('0x3d')][_0x80c5('0x4a')]){_0x5b32b6[_0x80c5('0x48')]=_[_0x80c5('0x4c')](_0x5b32b6[_0x80c5('0x48')],{'$or':_[_0x80c5('0x39')](_0x5b32b6['attributes'],function(_0x3535f5){var _0x3b98bb={};_0x3b98bb[_0x3535f5]={'$like':'%'+_0x26ec78[_0x80c5('0x3d')]['filter']+'%'};return _0x3b98bb;})});}_0x5b32b6=_[_0x80c5('0x4c')]({},_0x5b32b6,_0x26ec78['options']);return _0x282a61[_0x80c5('0x118')](_0x5b32b6);}})[_0x80c5('0x32')](function(_0x370dc8){if(_0x370dc8){_0x48d51e=_0x370dc8[_0x80c5('0x43')];if(!_0x26ec78['query']['hasOwnProperty'](_0x80c5('0x65'))){_0x5b32b6[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0x26ec78[_0x80c5('0x3d')][_0x80c5('0x45')]);_0x5b32b6[_0x80c5('0x2c')]=qs[_0x80c5('0x2c')](_0x26ec78[_0x80c5('0x3d')][_0x80c5('0x2c')]);}return _0x282a61[_0x80c5('0x118')](_0x5b32b6);}})[_0x80c5('0x32')](function(_0xd01963){if(_0xd01963){return _0xd01963?{'count':_0x48d51e,'rows':_0xd01963}:null;}})[_0x80c5('0x32')](respondWithResult(_0x3c7ec8,null))[_0x80c5('0x28')](handleError(_0x3c7ec8,null));};exports[_0x80c5('0x119')]=function(_0x21889d,_0x524803,_0xee5cf6){var _0x3e0eda=_0x21889d[_0x80c5('0x3d')][_0x80c5('0x11a')]==='false'?_0x80c5('0x11b'):_0x80c5('0x11c');return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'attributes':['id',_0x3e0eda],'where':{'id':_0x21889d[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x524803,null))[_0x80c5('0x32')](function(_0x5384d1){if(_0x5384d1){var _0x47732c=_0x5384d1[_0x3e0eda];var _0x4a8b82=_0x47732c&&_0x47732c['items']?_0x47732c['items']:[];_0x524803[_0x80c5('0xca')]({'fromKey':_[_0x80c5('0x81')](_0x47732c[_0x80c5('0x11d')])?undefined:_0x47732c[_0x80c5('0x11d')],'count':_0x4a8b82[_0x80c5('0x43')],'rows':_0x4a8b82});}})[_0x80c5('0x28')](handleError(_0x524803,null));};exports[_0x80c5('0x11e')]=function(_0xfaaf5e,_0x56d80b,_0x59aaee){var _0x4838a8={'raw':![],'where':{}};var _0x59eff4={};var _0x5e0063={'count':0x0,'rows':[]};return db[_0x80c5('0x3a')][_0x80c5('0x63')]({'where':{'id':_0xfaaf5e[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x56d80b,null))[_0x80c5('0x32')](function(_0x3e1cf2){if(_0x3e1cf2){_0x59eff4[_0x80c5('0x40')]=_[_0x80c5('0x3e')](db[_0x80c5('0xd6')][_0x80c5('0x3b')]);_0x59eff4['query']=_['keys'](_0xfaaf5e[_0x80c5('0x3d')]);_0x59eff4[_0x80c5('0x3f')]=_[_0x80c5('0x64')](_0x59eff4[_0x80c5('0x40')],_0x59eff4['query']);_0x4838a8['attributes']=_['intersection'](_0x59eff4[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0xfaaf5e[_0x80c5('0x3d')][_0x80c5('0x42')]));_0x4838a8[_0x80c5('0x41')]=_0x4838a8['attributes']['length']?_0x4838a8[_0x80c5('0x41')]:_0x59eff4[_0x80c5('0x40')];if(!_0xfaaf5e[_0x80c5('0x3d')]['hasOwnProperty'](_0x80c5('0x65'))){_0x4838a8[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0xfaaf5e[_0x80c5('0x3d')][_0x80c5('0x45')]);_0x4838a8[_0x80c5('0x2c')]=qs[_0x80c5('0x2c')](_0xfaaf5e[_0x80c5('0x3d')][_0x80c5('0x2c')]);}_0x4838a8[_0x80c5('0x46')]=qs[_0x80c5('0x47')](_0xfaaf5e[_0x80c5('0x3d')][_0x80c5('0x47')]);_0x4838a8[_0x80c5('0x48')]=qs[_0x80c5('0x3f')](_[_0x80c5('0x49')](_0xfaaf5e[_0x80c5('0x3d')],_0x59eff4['filters']));_0x4838a8['where'][_0x80c5('0x66')]=_0x3e1cf2['id'];if(_0xfaaf5e['query']['filter']){_0x4838a8[_0x80c5('0x48')]=_[_0x80c5('0x4c')](_0x4838a8[_0x80c5('0x48')],{'$or':_[_0x80c5('0x39')](_0x4838a8[_0x80c5('0x41')],function(_0x4a4b6f){var _0x19af73={};_0x19af73[_0x4a4b6f]={'$like':'%'+_0xfaaf5e[_0x80c5('0x3d')][_0x80c5('0x4a')]+'%'};return _0x19af73;})});}_0x4838a8=_[_0x80c5('0x4c')]({},_0x4838a8,_0xfaaf5e['options']);return db[_0x80c5('0xd6')][_0x80c5('0x4e')]({'where':_0x4838a8[_0x80c5('0x48')]})[_0x80c5('0x32')](function(_0x309024){_0x5e0063[_0x80c5('0x4e')]=_0x309024;if(_0xfaaf5e[_0x80c5('0x3d')][_0x80c5('0x54')]){_0x4838a8['include']=[{'all':!![]}];}else{_0x4838a8[_0x80c5('0x4f')]=[{'model':db[_0x80c5('0x99')],'as':_0x80c5('0xed'),'required':![]}];}return db[_0x80c5('0xd6')][_0x80c5('0x67')](_0x4838a8);})[_0x80c5('0x32')](function(_0x1c3123){_0x5e0063[_0x80c5('0x50')]=_0x1c3123;return _0x5e0063;});}})[_0x80c5('0x32')](respondWithFilteredResult(_0x56d80b,_0x4838a8))['catch'](handleError(_0x56d80b,null));};exports['addAgents']=function(_0x3b024e,_0x32cf97,_0xb4e576){return db['ChatWebsite'][_0x80c5('0x5e')]({'where':{'id':_0x3b024e[_0x80c5('0x52')]['id']}})['then'](handleEntityNotFound(_0x32cf97,null))[_0x80c5('0x32')](function(_0x44c024){if(_0x44c024){return _0x44c024[_0x80c5('0x11f')](_0x3b024e[_0x80c5('0x56')][_0x80c5('0xea')],_[_0x80c5('0xeb')](_0x3b024e[_0x80c5('0x56')],['ids','id'])||{})[_0x80c5('0xd0')](function(_0x51cb1a){for(var _0x220497=0x0;_0x220497<_0x3b024e[_0x80c5('0x56')][_0x80c5('0xea')][_0x80c5('0x43')];_0x220497+=0x1){socket[_0x80c5('0x120')](_0x80c5('0x121'),{'UserId':_0x3b024e[_0x80c5('0x56')][_0x80c5('0xea')][_0x220497],'ChatWebsiteId':_0x3b024e[_0x80c5('0x52')]['id']});}return _0x51cb1a;});}})[_0x80c5('0x32')](respondWithResult(_0x32cf97,null))[_0x80c5('0x28')](handleError(_0x32cf97,null));};exports[_0x80c5('0x122')]=function(_0x549f00,_0x3179dc,_0x2b2b32){return db[_0x80c5('0x3a')][_0x80c5('0x5e')]({'where':{'id':_0x549f00[_0x80c5('0x52')]['id']}})['then'](handleEntityNotFound(_0x3179dc,null))[_0x80c5('0x32')](function(_0x4ac7ff){if(_0x4ac7ff){return _0x4ac7ff[_0x80c5('0x122')](_0x549f00[_0x80c5('0x3d')][_0x80c5('0xea')])['then'](function(){if(_['isArray'](_0x549f00['query'][_0x80c5('0xea')])){for(var _0x393300=0x0;_0x393300<_0x549f00['query'][_0x80c5('0xea')]['length'];_0x393300+=0x1){socket['emit'](_0x80c5('0x123'),{'UserId':Number(_0x549f00[_0x80c5('0x3d')][_0x80c5('0xea')][_0x393300]),'ChatWebsiteId':Number(_0x549f00['params']['id'])});}}else{socket[_0x80c5('0x120')](_0x80c5('0x123'),{'UserId':Number(_0x549f00['query'][_0x80c5('0xea')]),'ChatWebsiteId':Number(_0x549f00[_0x80c5('0x52')]['id'])});}});}})[_0x80c5('0x32')](respondWithStatusCode(_0x3179dc,null))[_0x80c5('0x28')](handleError(_0x3179dc,null));};exports['getAgents']=function(_0x2aaa38,_0x1a8554,_0x33de0a){var _0x1758a5={};var _0x7d75ab={};var _0x17ecda;var _0x31775a;return db[_0x80c5('0x3a')]['findOne']({'where':{'id':_0x2aaa38[_0x80c5('0x52')]['id']}})[_0x80c5('0x32')](handleEntityNotFound(_0x1a8554,null))[_0x80c5('0x32')](function(_0x2468a5){if(_0x2468a5){_0x17ecda=_0x2468a5;_0x7d75ab[_0x80c5('0x40')]=_[_0x80c5('0x3e')](db[_0x80c5('0xc1')][_0x80c5('0x3b')]);_0x7d75ab[_0x80c5('0x3d')]=_[_0x80c5('0x3e')](_0x2aaa38[_0x80c5('0x3d')]);_0x7d75ab['filters']=_['intersection'](_0x7d75ab['model'],_0x7d75ab[_0x80c5('0x3d')]);_0x1758a5[_0x80c5('0x41')]=_['intersection'](_0x7d75ab[_0x80c5('0x40')],qs[_0x80c5('0x42')](_0x2aaa38[_0x80c5('0x3d')]['fields']));_0x1758a5[_0x80c5('0x41')]=_0x1758a5['attributes'][_0x80c5('0x43')]?_0x1758a5[_0x80c5('0x41')]:_0x7d75ab[_0x80c5('0x40')];_0x1758a5[_0x80c5('0x46')]=qs[_0x80c5('0x47')](_0x2aaa38['query'][_0x80c5('0x47')]);_0x1758a5['where']=qs[_0x80c5('0x3f')](_[_0x80c5('0x49')](_0x2aaa38[_0x80c5('0x3d')],_0x7d75ab['filters']));if(_0x2aaa38[_0x80c5('0x3d')]['filter']){_0x1758a5['where']=_[_0x80c5('0x4c')](_0x1758a5[_0x80c5('0x48')],{'$or':_['map'](_0x1758a5[_0x80c5('0x41')],function(_0x22a373){var _0x17c5a5={};_0x17c5a5[_0x22a373]={'$like':'%'+_0x2aaa38[_0x80c5('0x3d')]['filter']+'%'};return _0x17c5a5;})});}_0x1758a5=_[_0x80c5('0x4c')]({},_0x1758a5,_0x2aaa38['options']);return _0x17ecda['getAgents'](_0x1758a5);}})['then'](function(_0x3629e7){if(_0x3629e7){_0x31775a=_0x3629e7[_0x80c5('0x43')];if(!_0x2aaa38[_0x80c5('0x3d')][_0x80c5('0x44')](_0x80c5('0x65'))){_0x1758a5[_0x80c5('0x45')]=qs[_0x80c5('0x45')](_0x2aaa38[_0x80c5('0x3d')][_0x80c5('0x45')]);_0x1758a5[_0x80c5('0x2c')]=qs[_0x80c5('0x2c')](_0x2aaa38[_0x80c5('0x3d')][_0x80c5('0x2c')]);}return _0x17ecda[_0x80c5('0x124')](_0x1758a5);}})[_0x80c5('0x32')](function(_0x54c197){if(_0x54c197){return _0x54c197?{'count':_0x31775a,'rows':_0x54c197}:null;}})[_0x80c5('0x32')](respondWithResult(_0x1a8554,null))[_0x80c5('0x28')](handleError(_0x1a8554,null));}; \ No newline at end of file +var _0x019c=['create','body','user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','findOne','pick','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','Contacts','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','difference','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOffline','service','host','port','secure','authentication','pass','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','MailAccountId','email','Chat','NotifyMailAccount','notifyMail','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','getSnippet','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','connection','replace','textColor','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find'];(function(_0x15c6e1,_0x3555a2){var _0x597590=function(_0x707f04){while(--_0x707f04){_0x15c6e1['push'](_0x15c6e1['shift']());}};_0x597590(++_0x3555a2);}(_0x019c,0xca));var _0xc019=function(_0x28fca4,_0x11e78b){_0x28fca4=_0x28fca4-0x0;var _0x42fd01=_0x019c[_0x28fca4];return _0x42fd01;};'use strict';var pdf=require(_0xc019('0x0'));var emlformat=require(_0xc019('0x1'));var rimraf=require(_0xc019('0x2'));var zipdir=require(_0xc019('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc019('0x4'));var moment=require(_0xc019('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc019('0x6'));var util=require(_0xc019('0x7'));var path=require(_0xc019('0x8'));var sox=require(_0xc019('0x9'));var csv=require(_0xc019('0xa'));var ejs=require(_0xc019('0xb'));var fs=require('fs');var _=require(_0xc019('0xc'));var squel=require(_0xc019('0xd'));var crypto=require(_0xc019('0xe'));var jsforce=require(_0xc019('0xf'));var deskjs=require(_0xc019('0x10'));var toCsv=require(_0xc019('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc019('0x11'));var authService=require(_0xc019('0x12'));var qs=require(_0xc019('0x13'));var as=require(_0xc019('0x14'));var hardwareService=require(_0xc019('0x15'));var logger=require(_0xc019('0x16'))(_0xc019('0x17'));var utils=require(_0xc019('0x18'));var config=require(_0xc019('0x19'));var licenseUtil=require(_0xc019('0x1a'));var db=require(_0xc019('0x1b'))['db'];config[_0xc019('0x1c')]=_[_0xc019('0x1d')](config[_0xc019('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc019('0x1e'))(new Redis(config[_0xc019('0x1c')]));require(_0xc019('0x1f'))[_0xc019('0x20')](socket);var jayson=require(_0xc019('0x21'));var client=jayson[_0xc019('0x22')][_0xc019('0x23')]({'port':0x232c});var client9002=jayson[_0xc019('0x22')][_0xc019('0x23')]({'port':0x232a});var client9003=jayson[_0xc019('0x22')][_0xc019('0x23')]({'port':0x232b});var client9001=jayson[_0xc019('0x22')][_0xc019('0x23')]({'port':0x2329});function respondWithRpcPromise(_0x26a46f,_0x3d9735,_0xa61d5f,_0x1a1785){return new BPromise(function(_0x4bef04,_0x1ae943){var _0x33a8eb=_0x1a1785||client;return _0x33a8eb[_0xc019('0x24')](_0x26a46f,_0xa61d5f)[_0xc019('0x25')](function(_0x4e550f){logger[_0xc019('0x26')](_0xc019('0x27'),_0x3d9735,_0xc019('0x28'));logger[_0xc019('0x29')](_0xc019('0x2a'),_0x3d9735,_0xc019('0x28'),JSON[_0xc019('0x2b')](_0x4e550f));if(_0x4e550f[_0xc019('0x2c')]){if(_0x4e550f[_0xc019('0x2c')][_0xc019('0x2d')]===0x1f4){logger[_0xc019('0x2c')](_0xc019('0x27'),_0x3d9735,_0x4e550f[_0xc019('0x2c')][_0xc019('0x2e')]);return _0x1ae943(_0x4e550f[_0xc019('0x2c')][_0xc019('0x2e')]);}logger['error'](_0xc019('0x27'),_0x3d9735,_0x4e550f[_0xc019('0x2c')]['message']);return _0x4bef04(_0x4e550f[_0xc019('0x2c')][_0xc019('0x2e')]);}else{logger[_0xc019('0x26')](_0xc019('0x27'),_0x3d9735,_0xc019('0x28'));_0x4bef04(_0x4e550f[_0xc019('0x2f')][_0xc019('0x2e')]);}})[_0xc019('0x30')](function(_0x31ea8e){logger[_0xc019('0x2c')]('ChatWebsite,\x20%s,\x20%s',_0x3d9735,_0x31ea8e);_0x1ae943(_0x31ea8e);});});}function respondWithStatusCode(_0x32e0ce,_0x1d0be5){_0x1d0be5=_0x1d0be5||0xcc;return function(_0x5bb04f){if(_0x5bb04f){return _0x32e0ce[_0xc019('0x31')](_0x1d0be5);}return _0x32e0ce[_0xc019('0x32')](_0x1d0be5)[_0xc019('0x33')]();};}function respondWithResult(_0x109538,_0x2019c6){_0x2019c6=_0x2019c6||0xc8;return function(_0x4aa159){if(_0x4aa159){return _0x109538['status'](_0x2019c6)[_0xc019('0x34')](_0x4aa159);}};}function respondWithFilteredResult(_0xc1f2f9,_0x292089){return function(_0x5c3c8f){if(_0x5c3c8f){var _0x1a93be=_0x5c3c8f[_0xc019('0x35')],_0x69e63c=_0x292089['offset'],_0x4f38f8=_0x292089[_0xc019('0x36')]+_0x292089[_0xc019('0x37')],_0x4caa29;if(_0x4f38f8>=_0x1a93be){_0x4f38f8=_0x1a93be;_0x4caa29=0xc8;}else{_0x4caa29=0xce;}_0xc1f2f9[_0xc019('0x32')](_0x4caa29);return _0xc1f2f9['set']('Content-Range',_0x69e63c+'-'+_0x4f38f8+'/'+_0x1a93be)[_0xc019('0x34')](_0x5c3c8f);}return null;};}function patchUpdates(_0x20a24a){return function(_0x1c440a){try{jsonpatch['apply'](_0x1c440a,_0x20a24a,!![]);}catch(_0x6aeca1){return BPromise[_0xc019('0x38')](_0x6aeca1);}return _0x1c440a[_0xc019('0x39')]();};}function saveUpdates(_0x1f8eb7,_0x5791dc){return function(_0x3a3ac6){if(_0x3a3ac6){return _0x3a3ac6[_0xc019('0x3a')](_0x1f8eb7)[_0xc019('0x25')](function(_0xe8f559){return _0xe8f559;});}return null;};}function removeEntity(_0x56494b,_0x27fd33){return function(_0x1f8164){if(_0x1f8164){return _0x1f8164[_0xc019('0x3b')]()[_0xc019('0x25')](function(){var _0x374fe4=_0x1f8164[_0xc019('0x3c')]({'plain':!![]});var _0x4ea239='ChatWebsites';return db[_0xc019('0x3d')][_0xc019('0x3b')]({'where':{'type':_0x4ea239,'resourceId':_0x374fe4['id']}})[_0xc019('0x25')](function(){return _0x1f8164;});})[_0xc019('0x25')](function(){_0x56494b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a36e,_0x1cae60){return function(_0xa25bbe){if(!_0xa25bbe){_0x32a36e[_0xc019('0x31')](0x194);}return _0xa25bbe;};}function handleError(_0x5aa3a0,_0x4a7daa){_0x4a7daa=_0x4a7daa||0x1f4;return function(_0x27aa5c){logger[_0xc019('0x2c')](_0x27aa5c[_0xc019('0x3e')]);if(_0x27aa5c[_0xc019('0x3f')]){delete _0x27aa5c[_0xc019('0x3f')];}_0x5aa3a0[_0xc019('0x32')](_0x4a7daa)[_0xc019('0x40')](_0x27aa5c);};}exports[_0xc019('0x41')]=function(_0x2e60a8,_0x166f5f){var _0x3c10ae={'include':[{'model':db[_0xc019('0x42')],'as':_0xc019('0x43')}]},_0x4b99a4={},_0x3f36b1={'count':0x0,'rows':[]};var _0x31c5d7=_[_0xc019('0x44')](db[_0xc019('0x45')]['rawAttributes'],function(_0x3e63ac){return{'name':_0x3e63ac['fieldName'],'type':_0x3e63ac[_0xc019('0x46')][_0xc019('0x47')]};});_0x4b99a4['model']=_['map'](_0x31c5d7,_0xc019('0x3f'));_0x4b99a4[_0xc019('0x48')]=_['keys'](_0x2e60a8[_0xc019('0x48')]);_0x4b99a4['filters']=_[_0xc019('0x49')](_0x4b99a4[_0xc019('0x4a')],_0x4b99a4[_0xc019('0x48')]);_0x3c10ae[_0xc019('0x4b')]=_[_0xc019('0x49')](_0x4b99a4[_0xc019('0x4a')],qs[_0xc019('0x4c')](_0x2e60a8[_0xc019('0x48')]['fields']));_0x3c10ae[_0xc019('0x4b')]=_0x3c10ae['attributes'][_0xc019('0x4d')]?_0x3c10ae[_0xc019('0x4b')]:_0x4b99a4[_0xc019('0x4a')];if(!_0x2e60a8[_0xc019('0x48')][_0xc019('0x4e')](_0xc019('0x4f'))){_0x3c10ae[_0xc019('0x37')]=qs[_0xc019('0x37')](_0x2e60a8[_0xc019('0x48')][_0xc019('0x37')]);_0x3c10ae['offset']=qs['offset'](_0x2e60a8['query'][_0xc019('0x36')]);}_0x3c10ae[_0xc019('0x50')]=qs['sort'](_0x2e60a8['query'][_0xc019('0x51')]);_0x3c10ae[_0xc019('0x52')]=qs[_0xc019('0x53')](_['pick'](_0x2e60a8['query'],_0x4b99a4[_0xc019('0x53')]),_0x31c5d7);if(_0x2e60a8['query'][_0xc019('0x54')]){_0x3c10ae['where']=_[_0xc019('0x55')](_0x3c10ae[_0xc019('0x52')],{'$or':_['map'](_0x31c5d7,function(_0x5a9af7){if(_0x5a9af7[_0xc019('0x46')]!=='VIRTUAL'){var _0x11c78f={};_0x11c78f[_0x5a9af7['name']]={'$like':'%'+_0x2e60a8[_0xc019('0x48')][_0xc019('0x54')]+'%'};return _0x11c78f;}})});}_0x3c10ae=_[_0xc019('0x55')]({},_0x3c10ae,_0x2e60a8[_0xc019('0x56')]);var _0x46e72c={'where':_0x3c10ae['where']};return db['ChatWebsite'][_0xc019('0x35')](_0x46e72c)[_0xc019('0x25')](function(_0x1a792a){_0x3f36b1[_0xc019('0x35')]=_0x1a792a;if(_0x2e60a8[_0xc019('0x48')][_0xc019('0x57')]){_0x3c10ae[_0xc019('0x58')]=[{'all':!![]}];}return db[_0xc019('0x45')][_0xc019('0x59')](_0x3c10ae);})[_0xc019('0x25')](function(_0x41378d){_0x3f36b1[_0xc019('0x5a')]=_0x41378d;return _0x3f36b1;})['then'](respondWithFilteredResult(_0x166f5f,_0x3c10ae))[_0xc019('0x30')](handleError(_0x166f5f,null));};exports[_0xc019('0x5b')]=function(_0x34feaf,_0x129d3a){var _0x407e6d={'raw':![],'where':{'id':_0x34feaf[_0xc019('0x5c')]['id']},'include':[{'model':db[_0xc019('0x42')],'as':_0xc019('0x43')}]},_0x55b022={};_0x55b022['model']=_[_0xc019('0x5d')](db[_0xc019('0x45')][_0xc019('0x5e')]);_0x55b022[_0xc019('0x48')]=_[_0xc019('0x5d')](_0x34feaf[_0xc019('0x48')]);_0x55b022[_0xc019('0x53')]=_[_0xc019('0x49')](_0x55b022[_0xc019('0x4a')],_0x55b022[_0xc019('0x48')]);_0x407e6d[_0xc019('0x4b')]=_['intersection'](_0x55b022[_0xc019('0x4a')],qs[_0xc019('0x4c')](_0x34feaf[_0xc019('0x48')]['fields']));_0x407e6d[_0xc019('0x4b')]=_0x407e6d['attributes'][_0xc019('0x4d')]?_0x407e6d[_0xc019('0x4b')]:_0x55b022[_0xc019('0x4a')];if(_0x34feaf[_0xc019('0x48')][_0xc019('0x57')]){_0x407e6d[_0xc019('0x58')]=[{'all':!![]}];}_0x407e6d=_[_0xc019('0x55')]({},_0x407e6d,_0x34feaf[_0xc019('0x56')]);return db[_0xc019('0x45')][_0xc019('0x5f')](_0x407e6d)[_0xc019('0x25')](handleEntityNotFound(_0x129d3a,null))[_0xc019('0x25')](respondWithResult(_0x129d3a,null))['catch'](handleError(_0x129d3a,null));};exports[_0xc019('0x60')]=function(_0x1b8381,_0x4d2f3c){return db[_0xc019('0x45')][_0xc019('0x60')](_0x1b8381[_0xc019('0x61')],{})['then'](function(_0x6a6409){var _0x1b5359=_0x1b8381[_0xc019('0x62')]['get']({'plain':!![]});if(!_0x1b5359)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b5359[_0xc019('0x63')]==='user'){var _0x139f64=_0x6a6409[_0xc019('0x3c')]({'plain':!![]});var _0x5895e4=_0xc019('0x64');return db[_0xc019('0x65')][_0xc019('0x5f')]({'where':{'name':_0x5895e4,'userProfileId':_0x1b5359[_0xc019('0x66')]},'raw':!![]})['then'](function(_0x7adb08){if(_0x7adb08&&_0x7adb08[_0xc019('0x67')]===0x0){return db[_0xc019('0x3d')]['create']({'name':_0x139f64[_0xc019('0x3f')],'resourceId':_0x139f64['id'],'type':_0x7adb08[_0xc019('0x3f')],'sectionId':_0x7adb08['id']},{})['then'](function(){return _0x6a6409;});}else{return _0x6a6409;}})[_0xc019('0x30')](function(_0x266771){logger['error'](_0xc019('0x68'),_0x266771);throw _0x266771;});}return _0x6a6409;})[_0xc019('0x25')](respondWithResult(_0x4d2f3c,0xc9))[_0xc019('0x30')](handleError(_0x4d2f3c,null));};exports[_0xc019('0x3a')]=function(_0x54ed28,_0x1e22cf){if(_0x54ed28[_0xc019('0x61')]['id']){delete _0x54ed28[_0xc019('0x61')]['id'];}return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x54ed28[_0xc019('0x5c')]['id']},'include':[{'model':db[_0xc019('0x42')],'as':_0xc019('0x43')}]})[_0xc019('0x25')](handleEntityNotFound(_0x1e22cf,null))['then'](saveUpdates(_0x54ed28[_0xc019('0x61')],null))[_0xc019('0x25')](respondWithResult(_0x1e22cf,null))[_0xc019('0x30')](handleError(_0x1e22cf,null));};exports[_0xc019('0x3b')]=function(_0x502936,_0x1996ea){return db[_0xc019('0x45')]['find']({'where':{'id':_0x502936[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x1996ea,null))[_0xc019('0x25')](removeEntity(_0x1996ea,null))[_0xc019('0x30')](handleError(_0x1996ea,null));};exports[_0xc019('0x69')]=function(_0x364f53,_0x377055){return db[_0xc019('0x45')]['describe']()[_0xc019('0x25')](respondWithResult(_0x377055,null))[_0xc019('0x30')](handleError(_0x377055,null));};exports['addDisposition']=function(_0x35e416,_0x5e303a,_0x31f661){if(_0x35e416[_0xc019('0x61')]['id']){delete _0x35e416[_0xc019('0x61')]['id'];}return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x35e416['params']['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x5e303a,null))[_0xc019('0x25')](function(_0x5d036d){if(_0x5d036d){_0x35e416[_0xc019('0x61')][_0xc019('0x6a')]=_0x5d036d['id'];return db[_0xc019('0x6b')][_0xc019('0x60')](_0x35e416[_0xc019('0x61')]);}})[_0xc019('0x25')](respondWithResult(_0x5e303a,null))[_0xc019('0x30')](handleError(_0x5e303a,null));};exports['getDispositions']=function(_0x4997e8,_0x3233d7,_0x1f160f){var _0x1916c5={'raw':![],'where':{}};var _0x2d5042={};var _0x3af8ac={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc019('0x6c')]({'where':{'id':_0x4997e8[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x3233d7,null))['then'](function(_0x21bbb1){if(_0x21bbb1){_0x2d5042['model']=_[_0xc019('0x5d')](db[_0xc019('0x6b')]['rawAttributes']);_0x2d5042['query']=_[_0xc019('0x5d')](_0x4997e8['query']);_0x2d5042[_0xc019('0x53')]=_[_0xc019('0x49')](_0x2d5042[_0xc019('0x4a')],_0x2d5042[_0xc019('0x48')]);_0x1916c5[_0xc019('0x4b')]=_['intersection'](_0x2d5042[_0xc019('0x4a')],qs[_0xc019('0x4c')](_0x4997e8['query']['fields']));_0x1916c5['attributes']=_0x1916c5[_0xc019('0x4b')][_0xc019('0x4d')]?_0x1916c5[_0xc019('0x4b')]:_0x2d5042[_0xc019('0x4a')];if(!_0x4997e8[_0xc019('0x48')][_0xc019('0x4e')](_0xc019('0x4f'))){_0x1916c5[_0xc019('0x37')]=qs[_0xc019('0x37')](_0x4997e8['query'][_0xc019('0x37')]);_0x1916c5[_0xc019('0x36')]=qs[_0xc019('0x36')](_0x4997e8['query'][_0xc019('0x36')]);}_0x1916c5[_0xc019('0x50')]=qs[_0xc019('0x51')](_0x4997e8[_0xc019('0x48')][_0xc019('0x51')]);_0x1916c5['where']=qs['filters'](_[_0xc019('0x6d')](_0x4997e8[_0xc019('0x48')],_0x2d5042[_0xc019('0x53')]));_0x1916c5[_0xc019('0x52')][_0xc019('0x6a')]=_0x21bbb1['id'];if(_0x4997e8[_0xc019('0x48')][_0xc019('0x54')]){_0x1916c5['where']=_[_0xc019('0x55')](_0x1916c5[_0xc019('0x52')],{'$or':_[_0xc019('0x44')](_0x1916c5[_0xc019('0x4b')],function(_0x5dc300){var _0x31e0d9={};_0x31e0d9[_0x5dc300]={'$like':'%'+_0x4997e8[_0xc019('0x48')][_0xc019('0x54')]+'%'};return _0x31e0d9;})});}_0x1916c5=_[_0xc019('0x55')]({},_0x1916c5,_0x4997e8['options']);return db[_0xc019('0x6b')][_0xc019('0x35')]({'where':_0x1916c5[_0xc019('0x52')]})[_0xc019('0x25')](function(_0x55a7b3){_0x3af8ac[_0xc019('0x35')]=_0x55a7b3;if(_0x4997e8[_0xc019('0x48')]['includeAll']){_0x1916c5[_0xc019('0x58')]=[{'all':!![]}];}return db[_0xc019('0x6b')]['findAll'](_0x1916c5);})[_0xc019('0x25')](function(_0x33c95a){_0x3af8ac[_0xc019('0x5a')]=_0x33c95a;return _0x3af8ac;});}})[_0xc019('0x25')](respondWithFilteredResult(_0x3233d7,_0x1916c5))[_0xc019('0x30')](handleError(_0x3233d7,null));};exports[_0xc019('0x6e')]=function(_0x43775e,_0x1c39dc,_0x36064c){return db['ChatWebsite']['find']({'where':{'id':_0x43775e[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x1c39dc,null))['then'](function(_0x3352fc){if(_0x3352fc){return _0x3352fc[_0xc019('0x6e')](_0x43775e[_0xc019('0x48')]['ids']);}})[_0xc019('0x25')](respondWithStatusCode(_0x1c39dc,null))[_0xc019('0x30')](handleError(_0x1c39dc,null));};exports['addAnswer']=function(_0x1ae226,_0x476438,_0x8e6c99){if(_0x1ae226[_0xc019('0x61')]['id']){delete _0x1ae226[_0xc019('0x61')]['id'];}return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x1ae226[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x476438,null))[_0xc019('0x25')](function(_0x4d9ab7){if(_0x4d9ab7){_0x1ae226[_0xc019('0x61')][_0xc019('0x6a')]=_0x4d9ab7['id'];return db['CannedAnswer']['create'](_0x1ae226[_0xc019('0x61')]);}})[_0xc019('0x25')](respondWithResult(_0x476438,null))[_0xc019('0x30')](handleError(_0x476438,null));};exports[_0xc019('0x6f')]=function(_0x4e82d7,_0x52112f,_0x27402f){var _0x4c1abe={'raw':![],'where':{}};var _0x22e99d={};var _0x390c7e={'count':0x0,'rows':[]};return db[_0xc019('0x45')][_0xc019('0x6c')]({'where':{'id':_0x4e82d7[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x52112f,null))[_0xc019('0x25')](function(_0x476f65){if(_0x476f65){_0x22e99d[_0xc019('0x4a')]=_['keys'](db[_0xc019('0x70')]['rawAttributes']);_0x22e99d[_0xc019('0x48')]=_[_0xc019('0x5d')](_0x4e82d7['query']);_0x22e99d[_0xc019('0x53')]=_[_0xc019('0x49')](_0x22e99d[_0xc019('0x4a')],_0x22e99d[_0xc019('0x48')]);_0x4c1abe[_0xc019('0x4b')]=_['intersection'](_0x22e99d[_0xc019('0x4a')],qs['fields'](_0x4e82d7['query'][_0xc019('0x4c')]));_0x4c1abe['attributes']=_0x4c1abe[_0xc019('0x4b')]['length']?_0x4c1abe[_0xc019('0x4b')]:_0x22e99d['model'];if(!_0x4e82d7['query'][_0xc019('0x4e')](_0xc019('0x4f'))){_0x4c1abe['limit']=qs[_0xc019('0x37')](_0x4e82d7['query'][_0xc019('0x37')]);_0x4c1abe[_0xc019('0x36')]=qs['offset'](_0x4e82d7[_0xc019('0x48')][_0xc019('0x36')]);}_0x4c1abe[_0xc019('0x50')]=qs['sort'](_0x4e82d7['query'][_0xc019('0x51')]);_0x4c1abe[_0xc019('0x52')]=qs[_0xc019('0x53')](_[_0xc019('0x6d')](_0x4e82d7[_0xc019('0x48')],_0x22e99d[_0xc019('0x53')]));_0x4c1abe[_0xc019('0x52')][_0xc019('0x6a')]=_0x476f65['id'];if(_0x4e82d7[_0xc019('0x48')][_0xc019('0x54')]){_0x4c1abe[_0xc019('0x52')]=_[_0xc019('0x55')](_0x4c1abe[_0xc019('0x52')],{'$or':_[_0xc019('0x44')](_0x4c1abe[_0xc019('0x4b')],function(_0x4f9cce){var _0x404641={};_0x404641[_0x4f9cce]={'$like':'%'+_0x4e82d7[_0xc019('0x48')][_0xc019('0x54')]+'%'};return _0x404641;})});}_0x4c1abe=_['merge']({},_0x4c1abe,_0x4e82d7[_0xc019('0x56')]);return db[_0xc019('0x70')][_0xc019('0x35')]({'where':_0x4c1abe[_0xc019('0x52')]})[_0xc019('0x25')](function(_0x263f2d){_0x390c7e[_0xc019('0x35')]=_0x263f2d;if(_0x4e82d7[_0xc019('0x48')][_0xc019('0x57')]){_0x4c1abe[_0xc019('0x58')]=[{'all':!![]}];}return db[_0xc019('0x70')]['findAll'](_0x4c1abe);})[_0xc019('0x25')](function(_0x27b6c1){_0x390c7e['rows']=_0x27b6c1;return _0x390c7e;});}})[_0xc019('0x25')](respondWithFilteredResult(_0x52112f,_0x4c1abe))[_0xc019('0x30')](handleError(_0x52112f,null));};exports[_0xc019('0x71')]=function(_0x4c5163,_0x5c364a,_0x5284aa){return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x4c5163[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x5c364a,null))[_0xc019('0x25')](function(_0x113ead){if(_0x113ead){return _0x113ead[_0xc019('0x71')](_0x4c5163[_0xc019('0x48')][_0xc019('0x72')]);}})[_0xc019('0x25')](respondWithStatusCode(_0x5c364a,null))[_0xc019('0x30')](handleError(_0x5c364a,null));};exports[_0xc019('0x73')]=function(_0x5f1616,_0x3d6323,_0x11a0a2){_0x5f1616['body'][_0xc019('0x74')]=_0x5f1616[_0xc019('0x75')][_0xc019('0x76')];return db['ChatWebsite'][_0xc019('0x5f')]({'where':{'id':_0x5f1616[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x3d6323,null))[_0xc019('0x25')](saveUpdates(_0x5f1616[_0xc019('0x61')],null))[_0xc019('0x25')](respondWithResult(_0x3d6323,null))[_0xc019('0x30')](handleError(_0x3d6323,null));};exports[_0xc019('0x77')]=function(_0x567255,_0x437a8f,_0x9449d7){_0x567255[_0xc019('0x61')][_0xc019('0x78')]=_0x567255[_0xc019('0x75')][_0xc019('0x76')];return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x567255[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x437a8f,null))['then'](saveUpdates(_0x567255[_0xc019('0x61')],null))[_0xc019('0x25')](respondWithResult(_0x437a8f,null))[_0xc019('0x30')](handleError(_0x437a8f,null));};exports['addCustomerAvatar']=function(_0x275ceb,_0x7b8aa9,_0x11ae2d){_0x275ceb['body'][_0xc019('0x79')]=_0x275ceb['file'][_0xc019('0x76')];return db[_0xc019('0x45')]['find']({'where':{'id':_0x275ceb[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x7b8aa9,null))[_0xc019('0x25')](saveUpdates(_0x275ceb[_0xc019('0x61')],null))[_0xc019('0x25')](respondWithResult(_0x7b8aa9,null))['catch'](handleError(_0x7b8aa9,null));};exports[_0xc019('0x7a')]=function(_0x1aa4be,_0x2ee9bb,_0x387fd4){_0x1aa4be[_0xc019('0x61')]['systemAvatar']=_0x1aa4be[_0xc019('0x75')][_0xc019('0x76')];return db['ChatWebsite'][_0xc019('0x5f')]({'where':{'id':_0x1aa4be[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x2ee9bb,null))['then'](saveUpdates(_0x1aa4be[_0xc019('0x61')],null))[_0xc019('0x25')](respondWithResult(_0x2ee9bb,null))['catch'](handleError(_0x2ee9bb,null));};exports[_0xc019('0x7b')]=function(_0x38f75a,_0xfd7723,_0x2e5669){var _0x5a4119=path[_0xc019('0x7c')](config[_0xc019('0x7d')],_0xc019('0x7e'));var _0x15d463={'where':{'id':_0x38f75a['params']['id']},'attributes':['id',_0xc019('0x74')],'raw':!![]};var _0x1141d4=![];return require(_0xc019('0x1a'))[_0xc019('0x7f')]()[_0xc019('0x25')](function(_0x4f3f4b){if(_0x4f3f4b){_0x1141d4=_0x4f3f4b[_0xc019('0x80')];}})[_0xc019('0x25')](function(){return db['ChatWebsite'][_0xc019('0x5f')](_0x15d463);})[_0xc019('0x25')](handleEntityNotFound(_0xfd7723,null))[_0xc019('0x25')](function(_0x4a294d){if(_0x4a294d){if(!_[_0xc019('0x81')](_0x4a294d[_0xc019('0x74')])){if(fs[_0xc019('0x82')](path['join'](config[_0xc019('0x7d')],_0xc019('0x83'),_0x4a294d[_0xc019('0x74')]))&&_0x1141d4){_0x5a4119=path[_0xc019('0x7c')](config[_0xc019('0x7d')],_0xc019('0x83'),_0x4a294d['sitepic']);}}return _0xfd7723['download'](_0x5a4119);}})[_0xc019('0x30')](handleError(_0xfd7723,null));};exports[_0xc019('0x84')]=function(_0x114f3f,_0x5a376b,_0x46ce58){var _0x5ac3ea=path[_0xc019('0x7c')](config['root'],_0xc019('0x85'));var _0x4362f3={'where':{'id':_0x114f3f[_0xc019('0x5c')]['id']},'attributes':['id',_0xc019('0x78')],'raw':!![]};return db[_0xc019('0x45')][_0xc019('0x5f')](_0x4362f3)['then'](handleEntityNotFound(_0x5a376b,null))[_0xc019('0x25')](function(_0x99085a){if(_0x99085a){if(!_[_0xc019('0x81')](_0x99085a[_0xc019('0x78')])){if(fs[_0xc019('0x82')](path['join'](config[_0xc019('0x7d')],_0xc019('0x86'),_0x99085a[_0xc019('0x78')]))){_0x5ac3ea=path[_0xc019('0x7c')](config[_0xc019('0x7d')],_0xc019('0x86'),_0x99085a[_0xc019('0x78')]);}}return _0x5a376b[_0xc019('0x87')](_0x5ac3ea);}})[_0xc019('0x30')](handleError(_0x5a376b,null));};exports['getCustomerAvatar']=function(_0x2e1efe,_0xd122a0,_0x5cc63b){var _0x1d9420=path[_0xc019('0x7c')](config['root'],_0xc019('0x88'));var _0x34690a={'where':{'id':_0x2e1efe[_0xc019('0x5c')]['id']},'attributes':['id',_0xc019('0x79'),_0xc019('0x89')],'raw':!![]};return db['ChatWebsite'][_0xc019('0x5f')](_0x34690a)[_0xc019('0x25')](handleEntityNotFound(_0xd122a0,null))[_0xc019('0x25')](function(_0x98c0d){if(_0x98c0d){if(!_[_0xc019('0x81')](_0x98c0d[_0xc019('0x79')])){if(fs[_0xc019('0x82')](path[_0xc019('0x7c')](config[_0xc019('0x7d')],'server/files/images/avatars/',_0x98c0d[_0xc019('0x79')]))&&_0x98c0d[_0xc019('0x89')]){_0x1d9420=path['join'](config['root'],_0xc019('0x86'),_0x98c0d[_0xc019('0x79')]);}}return _0xd122a0['download'](_0x1d9420);}})['catch'](handleError(_0xd122a0,null));};exports[_0xc019('0x8a')]=function(_0x1f3bce,_0x3368a0,_0x59e7f8){var _0x9dfd44=path[_0xc019('0x7c')](config[_0xc019('0x7d')],_0xc019('0x8b'));var _0x32a19e={'where':{'id':_0x1f3bce[_0xc019('0x5c')]['id']},'attributes':['id',_0xc019('0x8c')],'raw':!![]};return db['ChatWebsite'][_0xc019('0x5f')](_0x32a19e)[_0xc019('0x25')](handleEntityNotFound(_0x3368a0,null))[_0xc019('0x25')](function(_0x358452){if(_0x358452){if(!_[_0xc019('0x81')](_0x358452[_0xc019('0x8c')])){if(fs[_0xc019('0x82')](path[_0xc019('0x7c')](config[_0xc019('0x7d')],'server/files/images/avatars/',_0x358452[_0xc019('0x8c')]))){_0x9dfd44=path[_0xc019('0x7c')](config[_0xc019('0x7d')],_0xc019('0x86'),_0x358452[_0xc019('0x8c')]);}}return _0x3368a0['download'](_0x9dfd44);}})[_0xc019('0x30')](handleError(_0x3368a0,null));};exports[_0xc019('0x8d')]=function(_0xb40300,_0x3b09b2,_0xe4fdca){var _0x1ac3c8=require('user-agent-parser');var _0x2f78c6=new _0x1ac3c8();var _0x263def=_0x2f78c6[_0xc019('0x8e')](_0xb40300[_0xc019('0x8f')][_0xc019('0x90')])[_0xc019('0x91')]();var _0x1b2a0d={'body':_0xb40300['body'],'channel':_0xc019('0x92')};var _0x1940b6=[];var _0x5da332=[];var _0x90ca2={};var _0xc1c01b=![];return db[_0xc019('0x93')]['describe']()[_0xc019('0x25')](function(_0x386f80){if(!_0x386f80){throw new db[(_0xc019('0x94'))][(_0xc019('0x95'))]('no\x20available\x20attributes');}_0x1940b6=_['difference'](_['keys'](_0x386f80),[_0xc019('0x96'),_0xc019('0x97')]);_0x5da332=_['difference'](_[_0xc019('0x5d')](_0x386f80),[_0xc019('0x96'),_0xc019('0x97'),_0xc019('0x98'),_0xc019('0x99')]);if(_0xb40300[_0xc019('0x61')]['id']){delete _0xb40300[_0xc019('0x61')]['id'];}if(_['isNil'](_0xb40300[_0xc019('0x61')][_0xc019('0x9a')])){throw new db['Sequelize'][(_0xc019('0x95'))](_0xc019('0x9b'));}if(_[_0xc019('0x81')](_0xb40300[_0xc019('0x61')][_0xc019('0x61')])||_0xb40300[_0xc019('0x61')][_0xc019('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0xc019('0x9c'));}if(_[_0xc019('0x81')](_0xb40300[_0xc019('0x61')][_0xc019('0x9d')])){throw new db[(_0xc019('0x94'))][(_0xc019('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5da332);}if(!_['includes'](_0x5da332,_0xb40300[_0xc019('0x61')]['mapKey'])){throw new db[(_0xc019('0x94'))][(_0xc019('0x95'))](_0xc019('0x9e')+_0x5da332);}_0x90ca2[_0xb40300[_0xc019('0x61')][_0xc019('0x9d')]]=_0xb40300['body'][_0xc019('0x9a')];})[_0xc019('0x25')](function(){return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0xb40300[_0xc019('0x5c')]['id']},'include':[{'model':db[_0xc019('0x9f')],'as':_0xc019('0xa0'),'include':[{'model':db[_0xc019('0x93')],'as':'Contacts','where':_0x90ca2,'limit':0x1,'order':[[_0xc019('0x97'),_0xc019('0xa1')]]}]},{'model':db[_0xc019('0xa2')],'as':_0xc019('0xa3')}]});})[_0xc019('0x25')](handleEntityNotFound(_0x3b09b2,null))[_0xc019('0x25')](function(_0x51ca83){if(_0x51ca83&&_0x51ca83['List']){_0x1b2a0d[_0xc019('0xa4')]=_0x51ca83;_0x1b2a0d[_0xc019('0xa5')]=_0x51ca83[_0xc019('0xa3')];_0x1b2a0d['list']=_0x51ca83['List'];_0x1b2a0d['applications']=_[_0xc019('0xa6')](_0x1b2a0d[_0xc019('0xa5')],[_0xc019('0xa7')],[_0xc019('0xa8')]);if(_0x1b2a0d[_0xc019('0xa4')]['Applications']){delete _0x1b2a0d[_0xc019('0xa4')][_0xc019('0xa3')];}if(_0x1b2a0d[_0xc019('0xa4')][_0xc019('0xa0')]&&_0x1b2a0d[_0xc019('0xa4')][_0xc019('0xa0')][_0xc019('0xa9')][_0xc019('0x4d')]){return _0x1b2a0d[_0xc019('0xa4')]['List'][_0xc019('0xa9')][0x0];}var _0x20c267=_[_0xc019('0x1d')](_0xb40300[_0xc019('0x61')],{'firstName':_0xb40300[_0xc019('0x61')][_0xc019('0x9a')],'ListId':_0x51ca83[_0xc019('0x99')]});_0x20c267[_0xb40300[_0xc019('0x61')][_0xc019('0x9d')]]=_0xb40300[_0xc019('0x61')][_0xc019('0x9a')];return db[_0xc019('0x93')]['create'](_0x20c267,{'fields':_0x1940b6,'raw':!![]});}})['then'](handleEntityNotFound(_0x3b09b2,null))[_0xc019('0x25')](function(_0x5a68fa){_0x1b2a0d[_0xc019('0xaa')]=_0x5a68fa;var _0x479a06=_0xb40300['body'][_0xc019('0xab')];if(_0xb40300[_0xc019('0x8f')]['cf-connecting-ip']){_0x479a06=_0xb40300['headers'][_0xc019('0xac')];}else if(_0xb40300[_0xc019('0x8f')]['x-forwarded-for']){_0x479a06=_[_0xc019('0xad')](_0xb40300[_0xc019('0x8f')][_0xc019('0xae')]['split'](','));}if(_0x5a68fa){var _0x10c5ca={'ContactId':_0x5a68fa['id'],'ChatWebsiteId':_0xb40300[_0xc019('0x5c')]['id'],'from':(_0x5a68fa[_0xc019('0xaf')]||'')+'\x20'+(_0x5a68fa[_0xc019('0xb0')]||''),'customerIp':_0x479a06,'customerPort':_0xb40300['headers'][_0xc019('0xb1')]?_0xb40300[_0xc019('0x8f')][_0xc019('0xb1')]:null,'referer':_0xb40300[_0xc019('0x61')][_0xc019('0xb2')],'browserName':_0x263def[_0xc019('0xb3')]['name']&&_0x263def[_0xc019('0xb3')]['version']?util[_0xc019('0xb4')](_0xc019('0xb5'),_0x263def['browser'][_0xc019('0x3f')],_0x263def['browser'][_0xc019('0xb6')]):_0xc019('0xb7'),'browserVersion':_0x263def[_0xc019('0xb3')][_0xc019('0xb6')]||'unknown','osName':util[_0xc019('0xb4')](_0xc019('0xb5'),_0x263def['os'][_0xc019('0x3f')],_0x263def['os'][_0xc019('0xb6')]),'osVersion':_0x263def['os'][_0xc019('0xb6')],'deviceModel':_0x263def['device'][_0xc019('0x4a')]&&_0x263def[_0xc019('0xb8')][_0xc019('0xb9')]?util[_0xc019('0xb4')]('%s\x20%s\x20%s',_0x263def[_0xc019('0xb8')]['model'],_0x263def[_0xc019('0xb8')][_0xc019('0xb9')],_0x263def['device'][_0xc019('0x46')]):null,'deviceVendor':_0x263def[_0xc019('0xb8')][_0xc019('0xb9')],'deviceType':_0x263def[_0xc019('0xb8')][_0xc019('0x46')],'formData':JSON[_0xc019('0x2b')](_0xb40300[_0xc019('0x61')])};var _0x52952c={'ChatWebsiteId':_0xb40300[_0xc019('0x5c')]['id'],'closed':![]};if(_0xb40300[_0xc019('0x61')]['threadId']){_0x52952c[_0xc019('0xba')]=_0xb40300[_0xc019('0x61')][_0xc019('0xba')];return db[_0xc019('0xbb')]['find']({'where':_0x52952c})[_0xc019('0x25')](function(_0x1b352a){if(_0x1b352a){return[_0x1b352a,![]];}_0x10c5ca['threadId']=_0xb40300[_0xc019('0x61')][_0xc019('0xba')];_0x10c5ca[_0xc019('0xbc')]=_0xb40300['body'][_0xc019('0xbc')];return db['ChatInteraction'][_0xc019('0x60')](_0x10c5ca)[_0xc019('0x25')](function(_0x44d8cf){return[_0x44d8cf,!![]];});});}_0x52952c[_0xc019('0xbd')]=_0x5a68fa['id'];if(_0xb40300[_0xc019('0x61')][_0xc019('0xbe')]&&_0xb40300[_0xc019('0x61')]['interaction']['id']){_0x52952c['id']=_0xb40300[_0xc019('0x61')][_0xc019('0xbe')]['id'];return db[_0xc019('0xbb')]['find']({'where':_0x52952c})['then'](function(_0x140d2c){if(_0x140d2c){return[_0x140d2c,![]];}return db[_0xc019('0xbb')][_0xc019('0x60')](_0x10c5ca)[_0xc019('0x25')](function(_0x57421e){return[_0x57421e,!![]];});});}return db[_0xc019('0xbb')][_0xc019('0x60')](_0x10c5ca)[_0xc019('0x25')](function(_0x1fb5b3){return[_0x1fb5b3,!![]];});}})[_0xc019('0xbf')](function(_0x92b9e2,_0x256d68){if(_0x92b9e2){_0xc1c01b=_0x256d68;if(!_0x256d68){var _0x5345a1={'from':(_0x1b2a0d[_0xc019('0xaa')][_0xc019('0xaf')]||'')+'\x20'+(_0x1b2a0d[_0xc019('0xaa')][_0xc019('0xb0')]||'')};if(_0xb40300[_0xc019('0x61')]['threadId']&&_0xb40300[_0xc019('0x61')][_0xc019('0xc0')]&&_0xb40300[_0xc019('0x61')][_0xc019('0xba')]!=_0xb40300[_0xc019('0x61')]['messageId']){_0x5345a1['threadId']=_0xb40300[_0xc019('0x61')][_0xc019('0xc0')];}return _0x92b9e2['update'](_0x5345a1);}else{return _0x92b9e2;}}})['then'](function(_0x5b5d85){_0x1b2a0d['interaction']=_0x5b5d85['get']({'plain':!![]});_0x1b2a0d[_0xc019('0xbe')][_0xc019('0xc1')]=_0xc1c01b;if(_0x1b2a0d['interaction'][_0xc019('0xc1')]){if(_0x1b2a0d['account'][_0xc019('0xc2')]){_0x1b2a0d[_0xc019('0xa5')][_0xc019('0xc3')]({'id':0x0,'priority':_0x1b2a0d[_0xc019('0xa5')]['length']+0x1,'app':_0xc019('0xc4'),'appdata':_0xc019('0xc5'),'interval':_0xc019('0xc6')});}}return db[_0xc019('0xc7')][_0xc019('0x60')]({'body':_0xb40300[_0xc019('0x61')]['body'],'ChatWebsiteId':_0xb40300['params']['id'],'ChatInteractionId':_0x5b5d85['id'],'direction':'in','ContactId':_0x1b2a0d[_0xc019('0xaa')]['id'],'AttachmentId':_0xb40300['body'][_0xc019('0xc8')]});})[_0xc019('0x25')](function(_0x2fa668){_0x1b2a0d[_0xc019('0x2e')]=_0x2fa668;if(_0x1b2a0d[_0xc019('0xbe')][_0xc019('0xc9')]){return db[_0xc019('0xca')][_0xc019('0x5f')]({'attributes':['id',_0xc019('0x3f')],'where':{'id':_0x1b2a0d[_0xc019('0xbe')][_0xc019('0xc9')]}})[_0xc019('0x25')](function(_0x15d843){if(_0x15d843){_0x1b2a0d[_0xc019('0xa5')][_0xc019('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x15d843['name']+','+(_0x1b2a0d[_0xc019('0xa4')][_0xc019('0xcc')]||0xa),'interval':'*,*,*,*'});_0x1b2a0d[_0xc019('0xcd')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x1b2a0d);});}return respondWithRpcPromise(_0xc019('0xce'),_0xc019('0xcf'),_0x1b2a0d);})[_0xc019('0x25')](function(_0x2a0583){respondWithRpcPromise(_0xc019('0xd0'),_0xc019('0xd0'),{'event':_0xc019('0x8d'),'message':_0x2a0583},client9002);return _0x2a0583;})['then'](respondWithResult(_0x3b09b2,null))['catch'](handleError(_0x3b09b2,null));};exports[_0xc019('0xd1')]=function(_0x21ef7b,_0x409412,_0x196d3f){var _0xd2888f,_0xafd9b1,_0x18cfdb;var _0x57ecaa=[];var _0x2a124c=[];var _0x38ad02={};return db[_0xc019('0x93')][_0xc019('0x69')]()[_0xc019('0x25')](function(_0x149a25){if(!_0x149a25){throw new db[(_0xc019('0x94'))][(_0xc019('0x95'))](_0xc019('0xd2'));}_0x2a124c=_[_0xc019('0xd3')](_[_0xc019('0x5d')](_0x149a25),[_0xc019('0x96'),_0xc019('0x97')]);_0x57ecaa=_[_0xc019('0xd3')](_['keys'](_0x149a25),[_0xc019('0x96'),'updatedAt','CompanyId','ListId']);if(_0x21ef7b[_0xc019('0x61')]['id']){delete _0x21ef7b[_0xc019('0x61')]['id'];}if(_[_0xc019('0x81')](_0x21ef7b[_0xc019('0x61')][_0xc019('0x9a')])){throw _0x409412[_0xc019('0x32')](0x1f4)[_0xc019('0x40')](new db['Sequelize'][(_0xc019('0x95'))](_0xc019('0x9b')));}if(_[_0xc019('0x81')](_0x21ef7b[_0xc019('0x61')]['body'])||_0x21ef7b[_0xc019('0x61')]['body']===''){throw _0x409412['status'](0x1f4)[_0xc019('0x40')](new db['Sequelize'][(_0xc019('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc019('0x81')](_0x21ef7b[_0xc019('0x61')][_0xc019('0xd4')])){throw _0x409412[_0xc019('0x32')](0x1f4)['send'](new db[(_0xc019('0x94'))][(_0xc019('0x95'))](_0xc019('0xd5')+_0x57ecaa));}if(!_[_0xc019('0xd6')](_0x57ecaa,_0x21ef7b[_0xc019('0x61')]['mapKeyOffline'])){throw _0x409412['status'](0x1f4)['send'](new db['Sequelize'][(_0xc019('0x95'))](_0xc019('0xd7')+_0x57ecaa));}_0x38ad02[_0x21ef7b[_0xc019('0x61')][_0xc019('0xd4')]]=_0x21ef7b[_0xc019('0x61')][_0xc019('0x9a')];})[_0xc019('0x25')](function(){return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x21ef7b['params']['id']},'include':[{'model':db[_0xc019('0x9f')],'as':'List'},{'model':db[_0xc019('0xd8')],'as':'MailAccount'}]});})[_0xc019('0x25')](handleEntityNotFound(_0x409412,null))[_0xc019('0x25')](function(_0xff38c4){if(_0xff38c4&&_0xff38c4[_0xc019('0xa0')]){_0xafd9b1=_0xff38c4;var _0x1d198a=_['defaults'](_0x21ef7b[_0xc019('0x61')],{'firstName':_0x21ef7b[_0xc019('0x61')][_0xc019('0x9a')],'phone':_0x21ef7b['body'][_0xc019('0x9a')],'ListId':_0xff38c4[_0xc019('0x99')]});_0x1d198a[_0x21ef7b['body'][_0xc019('0xd4')]]=_0x21ef7b[_0xc019('0x61')][_0xc019('0x9a')];return db[_0xc019('0x93')][_0xc019('0xd9')]({'where':_0x38ad02,'defaults':_0x1d198a});}})[_0xc019('0xbf')](function(_0x15adb7){if(_0x15adb7){_0x18cfdb=_0x15adb7;var _0x11af8f=fs[_0xc019('0xda')](path[_0xc019('0x7c')](config[_0xc019('0x7d')],'server/files/templates/chatOfflineMessage.ejs'),_0xc019('0xdb'));var _0xcdd891=ejs[_0xc019('0xdc')](_0x11af8f,{'body':_[_0xc019('0xdd')](_0x21ef7b['body'][_0xc019('0x61')]),'bodyTitle':_0xafd9b1[_0xc019('0xde')]});return db[_0xc019('0xdf')][_0xc019('0x60')]({'body':_0xcdd891,'ContactId':_0x15adb7['id'],'ChatWebsiteId':_0xafd9b1['id']});}})[_0xc019('0x25')](function(_0x5f16d0){if(_0x5f16d0){_0xd2888f=_0x5f16d0;return db[_0xc019('0xd8')][_0xc019('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0xc019('0xe0')],'as':_0xc019('0xe1'),'raw':!![]}]});}})[_0xc019('0x25')](function(_0x3d319c){if(_0x3d319c&&_0x3d319c[_0xc019('0xe1')]&&_0xafd9b1[_0xc019('0xe2')]&&_0xafd9b1['forwardOfflineAddress']){var _0x3632dc={'tls':{'rejectUnauthorized':![]}};if(_0x3d319c[_0xc019('0xe1')]['service']){_0x3632dc[_0xc019('0xe3')]=_0x3d319c['Smtp'][_0xc019('0xe3')];}else{_0x3632dc[_0xc019('0xe4')]=_0x3d319c[_0xc019('0xe1')][_0xc019('0xe4')];_0x3632dc['port']=_0x3d319c[_0xc019('0xe1')][_0xc019('0xe5')];_0x3632dc[_0xc019('0xe6')]=_0x3d319c[_0xc019('0xe1')][_0xc019('0xe6')];}if(_0x3d319c['Smtp'][_0xc019('0xe7')]){_0x3632dc['auth']={'user':_0x3d319c[_0xc019('0xe1')][_0xc019('0x62')],'pass':_0x3d319c[_0xc019('0xe1')][_0xc019('0xe8')]};}return respondWithRpcPromise('SendMail',_0xc019('0xe9'),{'account':_0x3632dc,'message':{'from':util[_0xc019('0xb4')](_0xc019('0xea'),_0x3d319c[_0xc019('0x3f')],_0x3d319c['email']||_0x3d319c[_0xc019('0xe1')][_0xc019('0x62')]),'to':_0xafd9b1[_0xc019('0xeb')],'subject':_0xafd9b1[_0xc019('0xec')],'text':_0xd2888f[_0xc019('0x61')]}},client9003)['then'](function(){return _0xd2888f;})[_0xc019('0x30')](function(_0x4fa6de){console[_0xc019('0x2c')](_0x4fa6de);});}})['then'](function(){if(_0xafd9b1&&_0xafd9b1['openNewInteraction']&&_0xafd9b1[_0xc019('0xed')]){var _0xe27d54={'from':_0x18cfdb['email'],'firstName':_0x18cfdb['firstName'],'lastName':_0x18cfdb[_0xc019('0xb0')],'mapKey':_0xc019('0xee'),'message':{'from':_0x18cfdb[_0xc019('0xee')],'to':_0xafd9b1['MailAccount'][_0xc019('0xee')],'cc':'','subject':_0xafd9b1[_0xc019('0xec')],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0xc019('0xef'),'ChatWebsiteId':_0xafd9b1['id'],'ChatOfflineMessageId':_0xd2888f['id'],'originTo':_0xafd9b1['MailAccount'][_0xc019('0xee')]},'body':_0xd2888f[_0xc019('0x61')]};var _0x4192a4={'account':{'id':_0xafd9b1['MailAccountId']},'body':_0xe27d54,'log':_0xc019('0xf0')};return respondWithRpcPromise('NotifyMailAccount',_0xc019('0xf1'),_0x4192a4,client9001)[_0xc019('0x25')](function(){return _0xd2888f;})[_0xc019('0x30')](function(_0x392d6c){console['error'](_0x392d6c);});}return;})[_0xc019('0x25')](function(){if(_0xd2888f){return _0xd2888f;}})['then'](respondWithResult(_0x409412,null))[_0xc019('0x30')](handleError(_0x409412,null));};exports[_0xc019('0xf2')]=function(_0x500a51,_0x5cd836,_0x171fe5){return db[_0xc019('0xbb')][_0xc019('0x5f')]({'where':{'id':_0x500a51[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x5cd836,null))[_0xc019('0x25')](function(_0x4c9e32){if(_0x4c9e32){return _0x4c9e32[_0xc019('0xf2')](_0x500a51['body'][_0xc019('0x72')],_[_0xc019('0xf3')](_0x500a51[_0xc019('0x61')],[_0xc019('0x72'),'id'])||{});}})[_0xc019('0x25')](respondWithResult(_0x5cd836,null))[_0xc019('0x30')](handleError(_0x5cd836,null));};exports[_0xc019('0xf4')]=function(_0x366066,_0x4b9b84,_0x4db3f0){var _0x4545aa={'raw':![],'where':{}};var _0x28ae50={};var _0x35582c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc019('0x6c')]({'where':{'id':_0x366066[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x4b9b84,null))[_0xc019('0x25')](function(_0x525acf){if(_0x525acf){_0x28ae50[_0xc019('0x4a')]=_[_0xc019('0x5d')](db[_0xc019('0xbb')][_0xc019('0x5e')]);_0x28ae50[_0xc019('0x48')]=_[_0xc019('0x5d')](_0x366066['query']);_0x28ae50['filters']=_[_0xc019('0x49')](_0x28ae50['model'],_0x28ae50['query']);_0x4545aa['attributes']=_[_0xc019('0x49')](_0x28ae50[_0xc019('0x4a')],qs[_0xc019('0x4c')](_0x366066[_0xc019('0x48')]['fields']));_0x4545aa[_0xc019('0x4b')]=_0x4545aa[_0xc019('0x4b')][_0xc019('0x4d')]?_0x4545aa[_0xc019('0x4b')]:_0x28ae50['model'];if(!_0x366066[_0xc019('0x48')][_0xc019('0x4e')](_0xc019('0x4f'))){_0x4545aa['limit']=qs[_0xc019('0x37')](_0x366066[_0xc019('0x48')]['limit']);_0x4545aa[_0xc019('0x36')]=qs['offset'](_0x366066['query'][_0xc019('0x36')]);}_0x4545aa[_0xc019('0x50')]=qs[_0xc019('0x51')](_0x366066[_0xc019('0x48')]['sort']);_0x4545aa[_0xc019('0x52')]=qs[_0xc019('0x53')](_[_0xc019('0x6d')](_0x366066[_0xc019('0x48')],_0x28ae50[_0xc019('0x53')]));_0x4545aa[_0xc019('0x52')]['ChatWebsiteId']=_0x525acf['id'];if(_0x366066[_0xc019('0x48')][_0xc019('0x54')]){_0x4545aa['where']=_[_0xc019('0x55')](_0x4545aa[_0xc019('0x52')],{'$or':_['map'](_0x4545aa[_0xc019('0x4b')],function(_0x526880){var _0x38fe0d={};_0x38fe0d[_0x526880]={'$like':'%'+_0x366066[_0xc019('0x48')][_0xc019('0x54')]+'%'};return _0x38fe0d;})});}_0x4545aa=_[_0xc019('0x55')]({},_0x4545aa,_0x366066[_0xc019('0x56')]);return db[_0xc019('0xbb')][_0xc019('0x35')]({'where':_0x4545aa[_0xc019('0x52')]})[_0xc019('0x25')](function(_0x14bd2d){_0x35582c[_0xc019('0x35')]=_0x14bd2d;if(_0x366066[_0xc019('0x48')]['includeAll']){_0x4545aa[_0xc019('0x58')]=[{'model':db[_0xc019('0x93')],'as':_0xc019('0xf5'),'required':![]},{'model':db[_0xc019('0xca')],'as':'Owner','attributes':[_0xc019('0x3f'),_0xc019('0xf6'),_0xc019('0xf7')],'required':![]},{'model':db[_0xc019('0xf8')],'as':'Tags','attributes':['id',_0xc019('0x3f'),_0xc019('0xf9')],'where':_0x366066[_0xc019('0x48')][_0xc019('0xfa')]?{'id':_0x366066[_0xc019('0x48')][_0xc019('0xfa')]}:undefined,'required':_0x366066['query'][_0xc019('0xfa')]?!![]:![]}];}return db[_0xc019('0xbb')][_0xc019('0x59')](_0x4545aa);})[_0xc019('0x25')](function(_0x132ea4){_0x35582c['rows']=_0x132ea4;return _0x35582c;});}})[_0xc019('0x25')](respondWithFilteredResult(_0x4b9b84,_0x4545aa))[_0xc019('0x30')](handleError(_0x4b9b84,null));};function iftimePromise(_0x34cd9b,_0x3bcd09){return respondWithRpcPromise(_0xc019('0xfb'),'getSnippet',{'command':_0x3bcd09[_0xc019('0xfc')]?util['format'](_0xc019('0xfd'),_0x34cd9b[_0xc019('0xfe')],_0x3bcd09[_0xc019('0xfc')]):util[_0xc019('0xb4')](_0xc019('0xff'),_0x34cd9b[_0xc019('0xfe')])},client9002)[_0xc019('0x25')](function(_0x31f081){var _0x378eb1=_0x31f081&&_0x31f081['indexOf'](_0xc019('0x100'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3bcd09['id'],_0x34cd9b['id'],_0x34cd9b[_0xc019('0xfe')],_0x378eb1?_0xc019('0x101'):_0xc019('0x102'),_0x3bcd09[_0xc019('0xfc')]?_0x3bcd09[_0xc019('0xfc')]:'No\x20timezone');return _0x378eb1;})[_0xc019('0x30')](function(_0x5e6df0){logger['error'](_0xc019('0x103'),_0x3bcd09['id'],_0x34cd9b['id'],_0x34cd9b[_0xc019('0xfe')],util[_0xc019('0x104')](_0x5e6df0,{'showHidden':![],'depth':null}),_0x3bcd09['timezone']?_0x3bcd09[_0xc019('0xfc')]:_0xc019('0x105'));return![];});}exports[_0xc019('0x106')]=function(_0x39a12d,_0x168ddf,_0x49ccee){var _0x583b82=0x0;var _0xe8185=0x0;var _0x2cea66=![];var _0x46156e;var _0x1a9be2;return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x39a12d[_0xc019('0x5c')]['id']},'include':[{'model':db['Interval'],'as':_0xc019('0x107'),'include':[{'model':db[_0xc019('0x107')],'as':'Intervals','attributes':['id',_0xc019('0xfe')],'raw':!![]}]}]})[_0xc019('0x25')](handleEntityNotFound(_0x168ddf,null))['then'](function(_0x5ce5e5){if(_0x5ce5e5){_0x46156e=_0x5ce5e5;return _0x5ce5e5[_0xc019('0x108')]({'raw':!![]});}})[_0xc019('0x25')](function(_0x2a65d9){if(_0x46156e){if(_0x2a65d9){_0x1a9be2=_0x2a65d9;}}return require(_0xc019('0x1a'))[_0xc019('0x7f')]();})[_0xc019('0x25')](function(_0x1198a2){if(_0x1198a2){_0xe8185=_0x1198a2[_0xc019('0x109')];_0x2cea66=_0x1198a2[_0xc019('0x80')];}})[_0xc019('0x25')](function(){return db[_0xc019('0xbb')][_0xc019('0x35')]({'where':{'closed':![]}});})[_0xc019('0x25')](function(_0x348871){_0x583b82=_0x348871;if(_0xe8185&&_0x348871>_0xe8185){return db[_0xc019('0x10a')][_0xc019('0x6c')]({'where':{'id':0x1}})[_0xc019('0x25')](function(_0x27ec6f){if(_0x27ec6f){_0x27ec6f[_0xc019('0x10b')](_0xc019('0x10c'));}});}})[_0xc019('0x25')](function(){if(_0x46156e[_0xc019('0x107')]&&_0x46156e[_0xc019('0x107')][_0xc019('0x10d')]){var _0x2cec9c=[];for(var _0x28e9ae=0x0;_0x28e9ae<_0x46156e[_0xc019('0x107')][_0xc019('0x10d')][_0xc019('0x4d')];_0x28e9ae++){var _0x191e9b=_0x46156e[_0xc019('0x107')][_0xc019('0x10d')][_0x28e9ae]['get']({'plain':!![]});_0x2cec9c[_0xc019('0xc3')](iftimePromise(_0x191e9b,_0x46156e));}return BPromise[_0xc019('0x10e')](_0x2cec9c)[_0xc019('0x25')](function(_0x4d624d){return _[_0xc019('0x10f')](_0x4d624d);});}else{return!![];}})[_0xc019('0x25')](function(_0x5c85ac){var _0x28a9ee=fs[_0xc019('0xda')](path[_0xc019('0x7c')](config[_0xc019('0x7d')],_0xc019('0x110')),_0xc019('0xdb'));var _0x4c152c={'remote':_0x46156e['remote'],'query':querystring[_0xc019('0x2b')](_[_0xc019('0x55')](_0x46156e['get']({'plain':!![]}),{'customerIp':_0x39a12d[_0xc019('0x8f')]['x-forwarded-for']||_0x39a12d[_0xc019('0x8f')]['x-real-ip']||_0x39a12d[_0xc019('0x111')]['remoteAddress']||_0x39a12d['ip'],'referer':_0x39a12d[_0xc019('0x8f')]['referer'],'openedInteractions':_0x583b82,'maxInteractions':_0xe8185,'virtual':_0x2cea66[_0xc019('0x109')],'online':_0x5c85ac,'custom':_0x2cea66}))[_0xc019('0x112')](/'/g,'\x5c\x27')};_0x168ddf[_0xc019('0x40')](ejs[_0xc019('0xdc')](Mustache['render'](_0x28a9ee,_0x4c152c),{'proactiveActions':_0x1a9be2,'alignment':_0x46156e['alignment'],'verticalAlignment':_0x46156e['verticalAlignment'],'div_color':_0x46156e[_0xc019('0xf9')],'text_color':_0x46156e[_0xc019('0x113')]}));})[_0xc019('0x30')](handleError(_0x168ddf,null));};exports[_0xc019('0x114')]=function(_0x10b48e,_0x334426,_0x1d594b){return db['ChatWebsite'][_0xc019('0x6c')]({'where':{'id':_0x10b48e[_0xc019('0x5c')]['id']}})['then'](handleEntityNotFound(_0x334426,null))[_0xc019('0x25')](function(_0x5d6008){if(_0x5d6008){return db[_0xc019('0x115')]['transaction'](function(_0x52cde3){return db[_0xc019('0xa2')][_0xc019('0x3b')]({'where':{'ChatWebsiteId':_0x10b48e[_0xc019('0x5c')]['id']},'transaction':_0x52cde3})['then'](function(_0x24ce15){var _0x480c64=_[_0xc019('0x44')](_0x10b48e['body'],function(_0x33d1fb){_0x33d1fb['ChatWebsiteId']=_0x10b48e['params']['id'];return _0x33d1fb;});return db[_0xc019('0xa2')][_0xc019('0x116')](_0x480c64,{'transaction':_0x52cde3});});})['then'](function(){return db[_0xc019('0xa2')][_0xc019('0x117')]({'where':{'ChatWebsiteId':_0x10b48e[_0xc019('0x5c')]['id']},'order':_0xc019('0xa7')});});}})[_0xc019('0x25')](respondWithResult(_0x334426,null))[_0xc019('0x30')](handleError(_0x334426,null));};exports['getApplications']=function(_0xcd012c,_0x3f665f,_0x385e4a){var _0x4b4bfb={};var _0x523d9f={};var _0x38e30f;var _0x40d7b2;return db[_0xc019('0x45')][_0xc019('0x6c')]({'where':{'id':_0xcd012c['params']['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x3f665f,null))[_0xc019('0x25')](function(_0x3900f7){if(_0x3900f7){_0x38e30f=_0x3900f7;_0x523d9f[_0xc019('0x4a')]=_['keys'](db[_0xc019('0xa2')][_0xc019('0x5e')]);_0x523d9f[_0xc019('0x48')]=_[_0xc019('0x5d')](_0xcd012c[_0xc019('0x48')]);_0x523d9f[_0xc019('0x53')]=_[_0xc019('0x49')](_0x523d9f[_0xc019('0x4a')],_0x523d9f['query']);_0x4b4bfb[_0xc019('0x4b')]=_[_0xc019('0x49')](_0x523d9f[_0xc019('0x4a')],qs[_0xc019('0x4c')](_0xcd012c[_0xc019('0x48')]['fields']));_0x4b4bfb['attributes']=_0x4b4bfb['attributes'][_0xc019('0x4d')]?_0x4b4bfb[_0xc019('0x4b')]:_0x523d9f[_0xc019('0x4a')];_0x4b4bfb[_0xc019('0x50')]=qs['sort'](_0xcd012c[_0xc019('0x48')][_0xc019('0x51')]);_0x4b4bfb[_0xc019('0x52')]=qs[_0xc019('0x53')](_[_0xc019('0x6d')](_0xcd012c[_0xc019('0x48')],_0x523d9f[_0xc019('0x53')]));if(_0xcd012c[_0xc019('0x48')][_0xc019('0x54')]){_0x4b4bfb[_0xc019('0x52')]=_[_0xc019('0x55')](_0x4b4bfb[_0xc019('0x52')],{'$or':_['map'](_0x4b4bfb['attributes'],function(_0x44c9f9){var _0x17dcf1={};_0x17dcf1[_0x44c9f9]={'$like':'%'+_0xcd012c[_0xc019('0x48')][_0xc019('0x54')]+'%'};return _0x17dcf1;})});}_0x4b4bfb=_['merge']({},_0x4b4bfb,_0xcd012c[_0xc019('0x56')]);return _0x38e30f[_0xc019('0x118')](_0x4b4bfb);}})[_0xc019('0x25')](function(_0xd61e5f){if(_0xd61e5f){_0x40d7b2=_0xd61e5f[_0xc019('0x4d')];if(!_0xcd012c[_0xc019('0x48')][_0xc019('0x4e')](_0xc019('0x4f'))){_0x4b4bfb['limit']=qs['limit'](_0xcd012c['query'][_0xc019('0x37')]);_0x4b4bfb[_0xc019('0x36')]=qs[_0xc019('0x36')](_0xcd012c[_0xc019('0x48')][_0xc019('0x36')]);}return _0x38e30f[_0xc019('0x118')](_0x4b4bfb);}})[_0xc019('0x25')](function(_0x419bcc){if(_0x419bcc){return _0x419bcc?{'count':_0x40d7b2,'rows':_0x419bcc}:null;}})[_0xc019('0x25')](respondWithResult(_0x3f665f,null))[_0xc019('0x30')](handleError(_0x3f665f,null));};exports[_0xc019('0x119')]=function(_0x48dcbf,_0x3dbf46,_0x36220d){return db[_0xc019('0x11a')][_0xc019('0x5f')]({'where':{'id':_0x48dcbf[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x3dbf46,null))['then'](function(_0x25c999){if(_0x25c999){return _0x25c999[_0xc019('0x119')](_0x48dcbf[_0xc019('0x61')]['ids'],_[_0xc019('0xf3')](_0x48dcbf[_0xc019('0x61')],['ids','id'])||{});}})['then'](respondWithResult(_0x3dbf46,null))[_0xc019('0x30')](handleError(_0x3dbf46,null));};exports['getProactiveActions']=function(_0x5c237f,_0xce6152,_0x10bcac){var _0xe69d0b={};var _0x45e003={};var _0x1cd762;var _0x7b6d5c;return db['ChatWebsite'][_0xc019('0x6c')]({'where':{'id':_0x5c237f['params']['id']}})[_0xc019('0x25')](handleEntityNotFound(_0xce6152,null))['then'](function(_0xe083cf){if(_0xe083cf){_0x1cd762=_0xe083cf;_0x45e003[_0xc019('0x4a')]=_[_0xc019('0x5d')](db[_0xc019('0x11b')][_0xc019('0x5e')]);_0x45e003[_0xc019('0x48')]=_['keys'](_0x5c237f['query']);_0x45e003['filters']=_[_0xc019('0x49')](_0x45e003['model'],_0x45e003[_0xc019('0x48')]);_0xe69d0b['attributes']=_[_0xc019('0x49')](_0x45e003['model'],qs['fields'](_0x5c237f[_0xc019('0x48')]['fields']));_0xe69d0b[_0xc019('0x4b')]=_0xe69d0b[_0xc019('0x4b')][_0xc019('0x4d')]?_0xe69d0b[_0xc019('0x4b')]:_0x45e003[_0xc019('0x4a')];_0xe69d0b[_0xc019('0x50')]=qs[_0xc019('0x51')](_0x5c237f['query'][_0xc019('0x51')]);_0xe69d0b[_0xc019('0x52')]=qs[_0xc019('0x53')](_[_0xc019('0x6d')](_0x5c237f[_0xc019('0x48')],_0x45e003[_0xc019('0x53')]));if(_0x5c237f['query']['filter']){_0xe69d0b['where']=_[_0xc019('0x55')](_0xe69d0b[_0xc019('0x52')],{'$or':_['map'](_0xe69d0b[_0xc019('0x4b')],function(_0xfce466){var _0x3e9e44={};_0x3e9e44[_0xfce466]={'$like':'%'+_0x5c237f[_0xc019('0x48')][_0xc019('0x54')]+'%'};return _0x3e9e44;})});}_0xe69d0b=_[_0xc019('0x55')]({},_0xe69d0b,_0x5c237f['options']);return _0x1cd762[_0xc019('0x108')](_0xe69d0b);}})[_0xc019('0x25')](function(_0x26f5cb){if(_0x26f5cb){_0x7b6d5c=_0x26f5cb[_0xc019('0x4d')];if(!_0x5c237f['query'][_0xc019('0x4e')](_0xc019('0x4f'))){_0xe69d0b[_0xc019('0x37')]=qs[_0xc019('0x37')](_0x5c237f[_0xc019('0x48')][_0xc019('0x37')]);_0xe69d0b['offset']=qs[_0xc019('0x36')](_0x5c237f[_0xc019('0x48')][_0xc019('0x36')]);}return _0x1cd762[_0xc019('0x108')](_0xe69d0b);}})['then'](function(_0x358d03){if(_0x358d03){return _0x358d03?{'count':_0x7b6d5c,'rows':_0x358d03}:null;}})[_0xc019('0x25')](respondWithResult(_0xce6152,null))['catch'](handleError(_0xce6152,null));};exports[_0xc019('0x11c')]=function(_0x45a30a,_0x45f43f,_0x12fdd4){var _0x54d106=_0x45a30a[_0xc019('0x48')][_0xc019('0x11d')]===_0xc019('0x11e')?_0xc019('0x11f'):'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x54d106],'where':{'id':_0x45a30a['params']['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x45f43f,null))[_0xc019('0x25')](function(_0x3fca8a){if(_0x3fca8a){var _0x2ca8e6=_0x3fca8a[_0x54d106];var _0x253e60=_0x2ca8e6&&_0x2ca8e6['items']?_0x2ca8e6[_0xc019('0x120')]:[];_0x45f43f[_0xc019('0x40')]({'fromKey':_[_0xc019('0x81')](_0x2ca8e6[_0xc019('0x121')])?undefined:_0x2ca8e6[_0xc019('0x121')],'count':_0x253e60[_0xc019('0x4d')],'rows':_0x253e60});}})[_0xc019('0x30')](handleError(_0x45f43f,null));};exports[_0xc019('0x122')]=function(_0x266a80,_0x28f4e5,_0x39d10a){var _0x3e1427={'raw':![],'where':{}};var _0x36918d={};var _0x59793a={'count':0x0,'rows':[]};return db[_0xc019('0x45')][_0xc019('0x6c')]({'where':{'id':_0x266a80[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x28f4e5,null))[_0xc019('0x25')](function(_0x2bf0e6){if(_0x2bf0e6){_0x36918d['model']=_[_0xc019('0x5d')](db[_0xc019('0xdf')][_0xc019('0x5e')]);_0x36918d[_0xc019('0x48')]=_[_0xc019('0x5d')](_0x266a80[_0xc019('0x48')]);_0x36918d[_0xc019('0x53')]=_[_0xc019('0x49')](_0x36918d[_0xc019('0x4a')],_0x36918d[_0xc019('0x48')]);_0x3e1427[_0xc019('0x4b')]=_['intersection'](_0x36918d[_0xc019('0x4a')],qs[_0xc019('0x4c')](_0x266a80[_0xc019('0x48')][_0xc019('0x4c')]));_0x3e1427[_0xc019('0x4b')]=_0x3e1427[_0xc019('0x4b')][_0xc019('0x4d')]?_0x3e1427[_0xc019('0x4b')]:_0x36918d[_0xc019('0x4a')];if(!_0x266a80['query'][_0xc019('0x4e')](_0xc019('0x4f'))){_0x3e1427['limit']=qs['limit'](_0x266a80[_0xc019('0x48')][_0xc019('0x37')]);_0x3e1427[_0xc019('0x36')]=qs['offset'](_0x266a80['query']['offset']);}_0x3e1427[_0xc019('0x50')]=qs[_0xc019('0x51')](_0x266a80[_0xc019('0x48')][_0xc019('0x51')]);_0x3e1427[_0xc019('0x52')]=qs[_0xc019('0x53')](_['pick'](_0x266a80[_0xc019('0x48')],_0x36918d['filters']));_0x3e1427['where'][_0xc019('0x6a')]=_0x2bf0e6['id'];if(_0x266a80[_0xc019('0x48')][_0xc019('0x54')]){_0x3e1427[_0xc019('0x52')]=_[_0xc019('0x55')](_0x3e1427[_0xc019('0x52')],{'$or':_['map'](_0x3e1427[_0xc019('0x4b')],function(_0x4e4d21){var _0x56046b={};_0x56046b[_0x4e4d21]={'$like':'%'+_0x266a80['query'][_0xc019('0x54')]+'%'};return _0x56046b;})});}_0x3e1427=_[_0xc019('0x55')]({},_0x3e1427,_0x266a80[_0xc019('0x56')]);return db[_0xc019('0xdf')][_0xc019('0x35')]({'where':_0x3e1427['where']})[_0xc019('0x25')](function(_0x3574cb){_0x59793a['count']=_0x3574cb;if(_0x266a80[_0xc019('0x48')]['includeAll']){_0x3e1427[_0xc019('0x58')]=[{'all':!![]}];}else{_0x3e1427[_0xc019('0x58')]=[{'model':db['CmContact'],'as':_0xc019('0xf5'),'required':![]}];}return db[_0xc019('0xdf')]['findAll'](_0x3e1427);})['then'](function(_0x505408){_0x59793a[_0xc019('0x5a')]=_0x505408;return _0x59793a;});}})[_0xc019('0x25')](respondWithFilteredResult(_0x28f4e5,_0x3e1427))[_0xc019('0x30')](handleError(_0x28f4e5,null));};exports[_0xc019('0x123')]=function(_0x4a5ecf,_0x2ea695,_0x457d9d){return db[_0xc019('0x45')][_0xc019('0x5f')]({'where':{'id':_0x4a5ecf[_0xc019('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2ea695,null))[_0xc019('0x25')](function(_0x1d88db){if(_0x1d88db){return _0x1d88db[_0xc019('0x123')](_0x4a5ecf['body'][_0xc019('0x72')],_[_0xc019('0xf3')](_0x4a5ecf[_0xc019('0x61')],[_0xc019('0x72'),'id'])||{})[_0xc019('0xbf')](function(_0x5518c8){for(var _0x39af49=0x0;_0x39af49<_0x4a5ecf[_0xc019('0x61')][_0xc019('0x72')][_0xc019('0x4d')];_0x39af49+=0x1){socket[_0xc019('0x124')](_0xc019('0x125'),{'UserId':_0x4a5ecf[_0xc019('0x61')]['ids'][_0x39af49],'ChatWebsiteId':_0x4a5ecf[_0xc019('0x5c')]['id']});}return _0x5518c8;});}})[_0xc019('0x25')](respondWithResult(_0x2ea695,null))[_0xc019('0x30')](handleError(_0x2ea695,null));};exports[_0xc019('0x126')]=function(_0x29d95e,_0x303d0b,_0x3dbc73){return db['ChatWebsite'][_0xc019('0x5f')]({'where':{'id':_0x29d95e[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x303d0b,null))[_0xc019('0x25')](function(_0x409b19){if(_0x409b19){return _0x409b19[_0xc019('0x126')](_0x29d95e['query'][_0xc019('0x72')])['then'](function(){if(_[_0xc019('0x127')](_0x29d95e['query'][_0xc019('0x72')])){for(var _0x47df90=0x0;_0x47df90<_0x29d95e['query'][_0xc019('0x72')][_0xc019('0x4d')];_0x47df90+=0x1){socket[_0xc019('0x124')](_0xc019('0x128'),{'UserId':Number(_0x29d95e[_0xc019('0x48')][_0xc019('0x72')][_0x47df90]),'ChatWebsiteId':Number(_0x29d95e[_0xc019('0x5c')]['id'])});}}else{socket[_0xc019('0x124')](_0xc019('0x128'),{'UserId':Number(_0x29d95e[_0xc019('0x48')][_0xc019('0x72')]),'ChatWebsiteId':Number(_0x29d95e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x303d0b,null))['catch'](handleError(_0x303d0b,null));};exports['getAgents']=function(_0x552813,_0x3fdafb,_0x24c0e3){var _0x5c83f3={};var _0x5cbf57={};var _0x49f300;var _0x4aca19;return db[_0xc019('0x45')][_0xc019('0x6c')]({'where':{'id':_0x552813[_0xc019('0x5c')]['id']}})[_0xc019('0x25')](handleEntityNotFound(_0x3fdafb,null))[_0xc019('0x25')](function(_0x3ba073){if(_0x3ba073){_0x49f300=_0x3ba073;_0x5cbf57[_0xc019('0x4a')]=_[_0xc019('0x5d')](db[_0xc019('0xca')][_0xc019('0x5e')]);_0x5cbf57['query']=_[_0xc019('0x5d')](_0x552813['query']);_0x5cbf57[_0xc019('0x53')]=_[_0xc019('0x49')](_0x5cbf57[_0xc019('0x4a')],_0x5cbf57[_0xc019('0x48')]);_0x5c83f3[_0xc019('0x4b')]=_[_0xc019('0x49')](_0x5cbf57['model'],qs[_0xc019('0x4c')](_0x552813['query'][_0xc019('0x4c')]));_0x5c83f3[_0xc019('0x4b')]=_0x5c83f3[_0xc019('0x4b')][_0xc019('0x4d')]?_0x5c83f3[_0xc019('0x4b')]:_0x5cbf57['model'];_0x5c83f3[_0xc019('0x50')]=qs['sort'](_0x552813[_0xc019('0x48')][_0xc019('0x51')]);_0x5c83f3[_0xc019('0x52')]=qs[_0xc019('0x53')](_[_0xc019('0x6d')](_0x552813[_0xc019('0x48')],_0x5cbf57[_0xc019('0x53')]));if(_0x552813[_0xc019('0x48')][_0xc019('0x54')]){_0x5c83f3['where']=_['merge'](_0x5c83f3['where'],{'$or':_[_0xc019('0x44')](_0x5c83f3[_0xc019('0x4b')],function(_0x2c2421){var _0xe00de2={};_0xe00de2[_0x2c2421]={'$like':'%'+_0x552813[_0xc019('0x48')][_0xc019('0x54')]+'%'};return _0xe00de2;})});}_0x5c83f3=_['merge']({},_0x5c83f3,_0x552813[_0xc019('0x56')]);return _0x49f300[_0xc019('0x129')](_0x5c83f3);}})[_0xc019('0x25')](function(_0x30c8b8){if(_0x30c8b8){_0x4aca19=_0x30c8b8[_0xc019('0x4d')];if(!_0x552813[_0xc019('0x48')][_0xc019('0x4e')](_0xc019('0x4f'))){_0x5c83f3['limit']=qs[_0xc019('0x37')](_0x552813[_0xc019('0x48')][_0xc019('0x37')]);_0x5c83f3['offset']=qs[_0xc019('0x36')](_0x552813[_0xc019('0x48')]['offset']);}return _0x49f300[_0xc019('0x129')](_0x5c83f3);}})['then'](function(_0x16b02a){if(_0x16b02a){return _0x16b02a?{'count':_0x4aca19,'rows':_0x16b02a}:null;}})['then'](respondWithResult(_0x3fdafb,null))[_0xc019('0x30')](handleError(_0x3fdafb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5c8cff5..e7490c8 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 _0xa4fb=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','remove','emit'];(function(_0x3ca750,_0x24db41){var _0x7e850a=function(_0x3ab0f0){while(--_0x3ab0f0){_0x3ca750['push'](_0x3ca750['shift']());}};_0x7e850a(++_0x24db41);}(_0xa4fb,0x150));var _0xba4f=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0xa4fb[_0x58d5ac];return _0x37985c;};'use strict';var EventEmitter=require(_0xba4f('0x0'));var ChatWebsite=require(_0xba4f('0x1'))['db'][_0xba4f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xba4f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xba4f('0x4')};function emitEvent(_0x196e5b){return function(_0x27a519,_0x4ac34c,_0x413f97){ChatWebsiteEvents[_0xba4f('0x5')](_0x196e5b+':'+_0x27a519['id'],_0x27a519);ChatWebsiteEvents[_0xba4f('0x5')](_0x196e5b,_0x27a519);_0x413f97(null);};}for(var e in events){if(events[_0xba4f('0x6')](e)){var event=events[e];ChatWebsite[_0xba4f('0x7')](e,emitEvent(event));}}module[_0xba4f('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x8569=['remove','emit','hasOwnProperty','hook','exports','ChatWebsite','setMaxListeners','save'];(function(_0x8c78e7,_0x229910){var _0xa19e90=function(_0x3667a6){while(--_0x3667a6){_0x8c78e7['push'](_0x8c78e7['shift']());}};_0xa19e90(++_0x229910);}(_0x8569,0x14d));var _0x9856=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x8569[_0x3a73bc];return _0x32891b;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x9856('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9856('0x1')](0x0);var events={'afterCreate':_0x9856('0x2'),'afterUpdate':'update','afterDestroy':_0x9856('0x3')};function emitEvent(_0x2025b0){return function(_0x4ae486,_0x172fbc,_0x3a6bbf){ChatWebsiteEvents[_0x9856('0x4')](_0x2025b0+':'+_0x4ae486['id'],_0x4ae486);ChatWebsiteEvents[_0x9856('0x4')](_0x2025b0,_0x4ae486);_0x3a6bbf(null);};}for(var e in events){if(events[_0x9856('0x5')](e)){var event=events[e];ChatWebsite[_0x9856('0x6')](e,emitEvent(event));}}module[_0x9856('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 0031a95..5d6ad49 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 _0x2b65=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x4fe256,_0x26079c){var _0x172c75=function(_0x2d3a8c){while(--_0x2d3a8c){_0x4fe256['push'](_0x4fe256['shift']());}};_0x172c75(++_0x26079c);}(_0x2b65,0x131));var _0x52b6=function(_0x261df1,_0x36c808){_0x261df1=_0x261df1-0x0;var _0x47482f=_0x2b65[_0x261df1];return _0x47482f;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var logger=require(_0x52b6('0x2'))(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var BPromise=require(_0x52b6('0x5'));var rp=require(_0x52b6('0x6'));var fs=require('fs');var path=require(_0x52b6('0x7'));var rimraf=require('rimraf');var config=require(_0x52b6('0x8'));var attributes=require(_0x52b6('0x9'));module[_0x52b6('0xa')]=function(_0x2c643d,_0x25593f){return _0x2c643d[_0x52b6('0xb')](_0x52b6('0xc'),attributes,{'tableName':_0x52b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb74=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x10e185,_0x292532){var _0x153149=function(_0x389035){while(--_0x389035){_0x10e185['push'](_0x10e185['shift']());}};_0x153149(++_0x292532);}(_0xeb74,0xe3));var _0x4eb7=function(_0x55e964,_0x5cda68){_0x55e964=_0x55e964-0x0;var _0x23284d=_0xeb74[_0x55e964];return _0x23284d;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var logger=require(_0x4eb7('0x2'))(_0x4eb7('0x3'));var moment=require(_0x4eb7('0x4'));var BPromise=require(_0x4eb7('0x5'));var rp=require(_0x4eb7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var attributes=require(_0x4eb7('0x9'));module[_0x4eb7('0xa')]=function(_0xa6e086,_0x563d6e){return _0xa6e086[_0x4eb7('0xb')]('ChatWebsite',attributes,{'tableName':_0x4eb7('0xc'),'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 40dea16..81b95b2 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 _0x524e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment'];(function(_0x7b717,_0x311539){var _0x50d254=function(_0xfdf8b8){while(--_0xfdf8b8){_0x7b717['push'](_0x7b717['shift']());}};_0x50d254(++_0x311539);}(_0x524e,0x15e));var _0xe524=function(_0x4693e2,_0x22f226){_0x4693e2=_0x4693e2-0x0;var _0x51b652=_0x524e[_0x4693e2];return _0x51b652;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});config[_0xe524('0xb')]=_[_0xe524('0xc')](config['redis'],{'host':_0xe524('0xd'),'port':0x18eb});var socket=require(_0xe524('0xe'))(new Redis(config[_0xe524('0xb')]));require(_0xe524('0xf'))[_0xe524('0x10')](socket);function respondWithRpcPromise(_0x4082b1,_0x1a08e2,_0xb3eb9f){return new BPromise(function(_0x1b75bd,_0x1641ec){return client[_0xe524('0x11')](_0x4082b1,_0xb3eb9f)[_0xe524('0x12')](function(_0x1184df){logger[_0xe524('0x13')](_0xe524('0x14'),_0x1a08e2,_0xe524('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a08e2,_0xe524('0x15'),JSON[_0xe524('0x16')](_0x1184df));if(_0x1184df[_0xe524('0x17')]){if(_0x1184df[_0xe524('0x17')][_0xe524('0x18')]===0x1f4){logger['error'](_0xe524('0x14'),_0x1a08e2,_0x1184df['error'][_0xe524('0x19')]);return _0x1641ec(_0x1184df[_0xe524('0x17')]['message']);}logger[_0xe524('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0x1184df[_0xe524('0x17')]['message']);return _0x1b75bd(_0x1184df[_0xe524('0x17')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0xe524('0x15'));_0x1b75bd(_0x1184df['result'][_0xe524('0x19')]);}})[_0xe524('0x1a')](function(_0x278de9){logger[_0xe524('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0x278de9);_0x1641ec(_0x278de9);});});} \ 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7880,0x1f4));var _0x0788=function(_0x1b1dff,_0x4c2de2){_0x1b1dff=_0x1b1dff-0x0;var _0x280d9d=_0x7880[_0x1b1dff];return _0x280d9d;};'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 5f97c93..6a16387 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x4a2718,_0x2b8edb){var _0x41cddf=function(_0x2924d7){while(--_0x2924d7){_0x4a2718['push'](_0x4a2718['shift']());}};_0x41cddf(++_0x2b8edb);}(_0xb10b,0x12a));var _0xbb10=function(_0x278679,_0x1eb219){_0x278679=_0x278679-0x0;var _0x4874aa=_0xb10b[_0x278679];return _0x4874aa;};'use strict';var ChatWebsiteEvents=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(){ChatWebsiteEvents[_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);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbec3fe,_0x10e256){_0xbec3fe=_0xbec3fe-0x0;var _0x9d879a=_0x5f2f[_0xbec3fe];return _0x9d879a;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index eed4f2c..13e8f4a 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 _0x5f66=['format','%s-%s','addAvatar','file','addCustomerAvatar','addSystemAvatar','/:id/notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','describe','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','server/files/images/logos/','now','originalname','/:id/logo','single','addLogo','diskStorage','root','server/files/images/avatars/'];(function(_0x376a8d,_0x15fc7b){var _0x4362ad=function(_0x4e4494){while(--_0x4e4494){_0x376a8d['push'](_0x376a8d['shift']());}};_0x4362ad(++_0x15fc7b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['get']('/:id/dispositions',auth[_0x65f6('0x7')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xa')](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get']('/:id/logo',controller[_0x65f6('0x10')]);router['get'](_0x65f6('0x11'),controller['getAvatar']);router[_0x65f6('0xa')](_0x65f6('0x12'),controller[_0x65f6('0x13')]);router[_0x65f6('0xa')](_0x65f6('0x14'),controller[_0x65f6('0x15')]);router[_0x65f6('0xa')](_0x65f6('0x16'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x17')]);router['get'](_0x65f6('0x18'),controller['getSnippet']);router['get'](_0x65f6('0x19'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x1a')]);router[_0x65f6('0xa')](_0x65f6('0x1b'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x1c')]);router[_0x65f6('0xa')]('/:id/fields',controller['getFields']);router[_0x65f6('0xa')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x65f6('0xa')](_0x65f6('0x1d'),auth['isAuthenticated'](),controller[_0x65f6('0x1e')]);router[_0x65f6('0x1f')]('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x20')]);router[_0x65f6('0x1f')](_0x65f6('0x21'),auth['isAuthenticated'](),controller[_0x65f6('0x22')]);router['post']('/:id/canned_answers',auth[_0x65f6('0x7')](),controller[_0x65f6('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eeaaa,_0x471a33,_0x2317ce){_0x2317ce(null,path[_0x65f6('0x24')](config['root'],_0x65f6('0x25')));},'filename':function(_0x59ea32,_0x20a161,_0x5963e0){_0x5963e0(null,util['format']('%s-%s',Date[_0x65f6('0x26')](),_0x20a161[_0x65f6('0x27')]));}})});router['post'](_0x65f6('0x28'),upload[_0x65f6('0x29')]('file'),controller[_0x65f6('0x2a')]);var upload=multer({'storage':multer[_0x65f6('0x2b')]({'destination':function(_0x28d0df,_0x559330,_0x4ac04b){_0x4ac04b(null,path['join'](config[_0x65f6('0x2c')],_0x65f6('0x2d')));},'filename':function(_0x4344b3,_0x408ccc,_0x518cac){_0x518cac(null,util[_0x65f6('0x2e')](_0x65f6('0x2f'),Date['now'](),_0x408ccc['originalname']));}})});router[_0x65f6('0x1f')](_0x65f6('0x11'),upload['single']('file'),controller[_0x65f6('0x30')]);var upload=multer({'storage':multer[_0x65f6('0x2b')]({'destination':function(_0x11fe3b,_0xc53cb7,_0x1217fd){_0x1217fd(null,path[_0x65f6('0x24')](config['root'],_0x65f6('0x2d')));},'filename':function(_0x38f3c6,_0x46f03c,_0x4bc037){_0x4bc037(null,util[_0x65f6('0x2e')](_0x65f6('0x2f'),Date[_0x65f6('0x26')](),_0x46f03c[_0x65f6('0x27')]));}})});router[_0x65f6('0x1f')](_0x65f6('0x12'),upload['single'](_0x65f6('0x31')),controller[_0x65f6('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36dbf4,_0x5a740a,_0x2b403b){_0x2b403b(null,path['join'](config[_0x65f6('0x2c')],_0x65f6('0x2d')));},'filename':function(_0x5ce050,_0x12dee6,_0x13e41a){_0x13e41a(null,util[_0x65f6('0x2e')]('%s-%s',Date['now'](),_0x12dee6[_0x65f6('0x27')]));}})});router['post'](_0x65f6('0x14'),upload['single'](_0x65f6('0x31')),controller[_0x65f6('0x33')]);router['post'](_0x65f6('0x34'),controller['notify']);router['post'](_0x65f6('0x35'),controller[_0x65f6('0x36')]);router[_0x65f6('0x1f')](_0x65f6('0x16'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x37')]);router[_0x65f6('0x1f')](_0x65f6('0x19'),auth['isAuthenticated'](),controller[_0x65f6('0x38')]);router['post'](_0x65f6('0x1b'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x39')]);router[_0x65f6('0x1f')]('/:id/users',auth[_0x65f6('0x7')](),controller[_0x65f6('0x3a')]);router[_0x65f6('0x3b')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x3c')]);router[_0x65f6('0x3d')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['destroy']);router[_0x65f6('0x3d')](_0x65f6('0x21'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x3e')]);router[_0x65f6('0x3d')](_0x65f6('0xe'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x3f')]);router[_0x65f6('0x3d')](_0x65f6('0x1d'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x40')]);module[_0x65f6('0x41')]=router; \ No newline at end of file +var _0x36ee=['/:id/applications','getApplications','/:id/proactive_actions','getFields','getOfflineMessages','getAgents','post','create','addDisposition','join','root','server/files/images/logos/','format','%s-%s','now','single','addLogo','originalname','/:id/avatar','file','diskStorage','server/files/images/avatars/','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','/:id','update','delete','/:id/dispositions','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','show','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet'];(function(_0x251d48,_0x3f883b){var _0x2873a6=function(_0x453fca){while(--_0x453fca){_0x251d48['push'](_0x251d48['shift']());}};_0x2873a6(++_0x3f883b);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var auth=require(_0xe36e('0x3'));var interaction=require(_0xe36e('0x4'));var config=require(_0xe36e('0x5'));var controller=require(_0xe36e('0x6'));router[_0xe36e('0x7')]('/',auth[_0xe36e('0x8')](),controller[_0xe36e('0x9')]);router[_0xe36e('0x7')](_0xe36e('0xa'),auth[_0xe36e('0x8')](),controller['describe']);router[_0xe36e('0x7')]('/:id',auth[_0xe36e('0x8')](),controller[_0xe36e('0xb')]);router[_0xe36e('0x7')]('/:id/dispositions',auth[_0xe36e('0x8')](),controller['getDispositions']);router[_0xe36e('0x7')](_0xe36e('0xc'),auth[_0xe36e('0x8')](),controller[_0xe36e('0xd')]);router[_0xe36e('0x7')](_0xe36e('0xe'),controller[_0xe36e('0xf')]);router[_0xe36e('0x7')]('/:id/avatar',controller[_0xe36e('0x10')]);router[_0xe36e('0x7')](_0xe36e('0x11'),controller[_0xe36e('0x12')]);router['get'](_0xe36e('0x13'),controller['getSystemAvatar']);router['get'](_0xe36e('0x14'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x7')](_0xe36e('0x16'),controller[_0xe36e('0x17')]);router[_0xe36e('0x7')](_0xe36e('0x18'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x19')]);router['get'](_0xe36e('0x1a'),auth[_0xe36e('0x8')](),controller['getProactiveActions']);router[_0xe36e('0x7')]('/:id/fields',controller[_0xe36e('0x1b')]);router[_0xe36e('0x7')]('/:id/offline_messages',auth[_0xe36e('0x8')](),controller[_0xe36e('0x1c')]);router[_0xe36e('0x7')]('/:id/users',auth[_0xe36e('0x8')](),controller[_0xe36e('0x1d')]);router[_0xe36e('0x1e')]('/',auth[_0xe36e('0x8')](),controller[_0xe36e('0x1f')]);router[_0xe36e('0x1e')]('/:id/dispositions',auth[_0xe36e('0x8')](),controller[_0xe36e('0x20')]);router[_0xe36e('0x1e')](_0xe36e('0xc'),auth[_0xe36e('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4749a8,_0x10818d,_0xb0cd85){_0xb0cd85(null,path[_0xe36e('0x21')](config[_0xe36e('0x22')],_0xe36e('0x23')));},'filename':function(_0x1a045c,_0x5ac484,_0x3cafbf){_0x3cafbf(null,util[_0xe36e('0x24')](_0xe36e('0x25'),Date[_0xe36e('0x26')](),_0x5ac484['originalname']));}})});router[_0xe36e('0x1e')]('/:id/logo',upload[_0xe36e('0x27')]('file'),controller[_0xe36e('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x410504,_0x4c5d98,_0x3b1045){_0x3b1045(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x5b5d53,_0x203fa2,_0x1fc639){_0x1fc639(null,util['format']('%s-%s',Date[_0xe36e('0x26')](),_0x203fa2[_0xe36e('0x29')]));}})});router[_0xe36e('0x1e')](_0xe36e('0x2a'),upload[_0xe36e('0x27')](_0xe36e('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer[_0xe36e('0x2c')]({'destination':function(_0x11c95d,_0x57272f,_0x87e595){_0x87e595(null,path[_0xe36e('0x21')](config[_0xe36e('0x22')],_0xe36e('0x2d')));},'filename':function(_0x21623e,_0x253cdc,_0xfe4ee8){_0xfe4ee8(null,util[_0xe36e('0x24')](_0xe36e('0x25'),Date[_0xe36e('0x26')](),_0x253cdc[_0xe36e('0x29')]));}})});router['post'](_0xe36e('0x11'),upload['single']('file'),controller[_0xe36e('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b1299,_0x248f39,_0x38bdbc){_0x38bdbc(null,path[_0xe36e('0x21')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x45689d,_0x222c65,_0x19a53f){_0x19a53f(null,util[_0xe36e('0x24')]('%s-%s',Date[_0xe36e('0x26')](),_0x222c65[_0xe36e('0x29')]));}})});router[_0xe36e('0x1e')]('/:id/system_avatar',upload[_0xe36e('0x27')](_0xe36e('0x2b')),controller['addSystemAvatar']);router[_0xe36e('0x1e')](_0xe36e('0x2f'),controller[_0xe36e('0x30')]);router[_0xe36e('0x1e')](_0xe36e('0x31'),controller[_0xe36e('0x32')]);router[_0xe36e('0x1e')](_0xe36e('0x14'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x33')]);router[_0xe36e('0x1e')](_0xe36e('0x18'),auth[_0xe36e('0x8')](),controller['addApplications']);router[_0xe36e('0x1e')](_0xe36e('0x1a'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x34')]);router[_0xe36e('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0xe36e('0x35')]);router[_0xe36e('0x36')](_0xe36e('0x37'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x38')]);router[_0xe36e('0x39')](_0xe36e('0x37'),auth[_0xe36e('0x8')](),controller['destroy']);router[_0xe36e('0x39')](_0xe36e('0x3a'),auth['isAuthenticated'](),controller[_0xe36e('0x3b')]);router['delete'](_0xe36e('0xc'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x3c')]);router[_0xe36e('0x39')](_0xe36e('0x3d'),auth['isAuthenticated'](),controller[_0xe36e('0x3e')]);module[_0xe36e('0x3f')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6c6eda8..e7bfecc 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 _0xd47f=['sequelize','STRING','ENUM','AmazonAWS','Google'];(function(_0x2d41dd,_0x12171f){var _0x1ca3c8=function(_0x4d0846){while(--_0x4d0846){_0x2d41dd['push'](_0x2d41dd['shift']());}};_0x1ca3c8(++_0x12171f);}(_0xd47f,0x1bd));var _0xfd47=function(_0x5bbe7e,_0x19c08f){_0x5bbe7e=_0x5bbe7e-0x0;var _0x6ebda1=_0xd47f[_0x5bbe7e];return _0x6ebda1;};'use strict';var Sequelize=require(_0xfd47('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd47('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfd47('0x2')](_0xfd47('0x3'),_0xfd47('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xfd47('0x1')]},'data2':{'type':Sequelize[_0xfd47('0x1')]}}; \ No newline at end of file +var _0x5a43=['Google','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0x770074,_0x37a182){var _0x1bb4bb=function(_0xac7542){while(--_0xac7542){_0x770074['push'](_0x770074['shift']());}};_0x1bb4bb(++_0x37a182);}(_0x5a43,0xf1));var _0x35a4=function(_0x491708,_0x10138f){_0x491708=_0x491708-0x0;var _0x1d61a1=_0x5a43[_0x491708];return _0x1d61a1;};'use strict';var Sequelize=require(_0x35a4('0x0'));module[_0x35a4('0x1')]={'name':{'type':Sequelize[_0x35a4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x35a4('0x3')](_0x35a4('0x4'),_0x35a4('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x35a4('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index afaa645..630bf2f 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 _0xe499=['fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','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','Content-Range','reject','save','update','then','destroy','stack','name','send','map','CloudProvider'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe499,0xfb));var _0x9e49=function(_0x4f9922,_0x5182d5){_0x4f9922=_0x4f9922-0x0;var _0x3d6a25=_0xe499[_0x4f9922];return _0x3d6a25;};'use strict';var pdf=require(_0x9e49('0x0'));var emlformat=require(_0x9e49('0x1'));var rimraf=require(_0x9e49('0x2'));var zipdir=require(_0x9e49('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e49('0x4'));var BPromise=require(_0x9e49('0x5'));var Mustache=require(_0x9e49('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9e49('0x7'));var csv=require(_0x9e49('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e49('0x9'));var squel=require(_0x9e49('0xa'));var crypto=require(_0x9e49('0xb'));var jsforce=require(_0x9e49('0xc'));var deskjs=require(_0x9e49('0xd'));var toCsv=require(_0x9e49('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e49('0xe'));var authService=require(_0x9e49('0xf'));var qs=require(_0x9e49('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e49('0x11'));var logger=require(_0x9e49('0x12'))(_0x9e49('0x13'));var utils=require(_0x9e49('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9e49('0x15'));var db=require(_0x9e49('0x16'))['db'];function respondWithStatusCode(_0x38ddd4,_0x45127f){_0x45127f=_0x45127f||0xcc;return function(_0x4b73d6){if(_0x4b73d6){return _0x38ddd4[_0x9e49('0x17')](_0x45127f);}return _0x38ddd4[_0x9e49('0x18')](_0x45127f)[_0x9e49('0x19')]();};}function respondWithResult(_0x432208,_0x4ba5a2){_0x4ba5a2=_0x4ba5a2||0xc8;return function(_0x35f9fa){if(_0x35f9fa){return _0x432208[_0x9e49('0x18')](_0x4ba5a2)[_0x9e49('0x1a')](_0x35f9fa);}};}function respondWithFilteredResult(_0x357cfa,_0x2d16d5){return function(_0x31dab6){if(_0x31dab6){var _0x3e21ba=_0x31dab6[_0x9e49('0x1b')],_0x16784b=_0x2d16d5[_0x9e49('0x1c')],_0x454908=_0x2d16d5[_0x9e49('0x1c')]+_0x2d16d5[_0x9e49('0x1d')],_0x4abdbe;if(_0x454908>=_0x3e21ba){_0x454908=_0x3e21ba;_0x4abdbe=0xc8;}else{_0x4abdbe=0xce;}_0x357cfa[_0x9e49('0x18')](_0x4abdbe);return _0x357cfa['set'](_0x9e49('0x1e'),_0x16784b+'-'+_0x454908+'/'+_0x3e21ba)[_0x9e49('0x1a')](_0x31dab6);}return null;};}function patchUpdates(_0x5a2f97){return function(_0xeb4c05){try{jsonpatch['apply'](_0xeb4c05,_0x5a2f97,!![]);}catch(_0x3dcd5c){return BPromise[_0x9e49('0x1f')](_0x3dcd5c);}return _0xeb4c05[_0x9e49('0x20')]();};}function saveUpdates(_0x5eaefa,_0x2e2c71){return function(_0x4d0a0e){if(_0x4d0a0e){return _0x4d0a0e[_0x9e49('0x21')](_0x5eaefa)[_0x9e49('0x22')](function(_0x2a6ddc){return _0x2a6ddc;});}return null;};}function removeEntity(_0x51f8ac,_0xa9cd6f){return function(_0x19e63e){if(_0x19e63e){return _0x19e63e[_0x9e49('0x23')]()['then'](function(){_0x51f8ac[_0x9e49('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3211f9,_0x1f627b){return function(_0x52e534){if(!_0x52e534){_0x3211f9[_0x9e49('0x17')](0x194);}return _0x52e534;};}function handleError(_0x24980f,_0x1f1d8f){_0x1f1d8f=_0x1f1d8f||0x1f4;return function(_0x31a706){logger['error'](_0x31a706[_0x9e49('0x24')]);if(_0x31a706['name']){delete _0x31a706[_0x9e49('0x25')];}_0x24980f[_0x9e49('0x18')](_0x1f1d8f)[_0x9e49('0x26')](_0x31a706);};}exports['index']=function(_0x48b591,_0x19a9d8){var _0x3ed135={},_0x401050={},_0x3e2ae9={'count':0x0,'rows':[]};var _0x188381=_[_0x9e49('0x27')](db[_0x9e49('0x28')]['rawAttributes'],function(_0xbc9903){return{'name':_0xbc9903[_0x9e49('0x29')],'type':_0xbc9903[_0x9e49('0x2a')][_0x9e49('0x2b')]};});_0x401050['model']=_[_0x9e49('0x27')](_0x188381,_0x9e49('0x25'));_0x401050[_0x9e49('0x2c')]=_['keys'](_0x48b591[_0x9e49('0x2c')]);_0x401050[_0x9e49('0x2d')]=_[_0x9e49('0x2e')](_0x401050[_0x9e49('0x2f')],_0x401050[_0x9e49('0x2c')]);_0x3ed135[_0x9e49('0x30')]=_[_0x9e49('0x2e')](_0x401050[_0x9e49('0x2f')],qs[_0x9e49('0x31')](_0x48b591[_0x9e49('0x2c')][_0x9e49('0x31')]));_0x3ed135['attributes']=_0x3ed135[_0x9e49('0x30')][_0x9e49('0x32')]?_0x3ed135[_0x9e49('0x30')]:_0x401050[_0x9e49('0x2f')];if(!_0x48b591[_0x9e49('0x2c')][_0x9e49('0x33')](_0x9e49('0x34'))){_0x3ed135['limit']=qs[_0x9e49('0x1d')](_0x48b591['query'][_0x9e49('0x1d')]);_0x3ed135[_0x9e49('0x1c')]=qs[_0x9e49('0x1c')](_0x48b591[_0x9e49('0x2c')]['offset']);}_0x3ed135[_0x9e49('0x35')]=qs[_0x9e49('0x36')](_0x48b591[_0x9e49('0x2c')][_0x9e49('0x36')]);_0x3ed135['where']=qs[_0x9e49('0x2d')](_[_0x9e49('0x37')](_0x48b591[_0x9e49('0x2c')],_0x401050['filters']),_0x188381);if(_0x48b591['query'][_0x9e49('0x38')]){_0x3ed135[_0x9e49('0x39')]=_[_0x9e49('0x3a')](_0x3ed135[_0x9e49('0x39')],{'$or':_[_0x9e49('0x27')](_0x188381,function(_0x25f068){if(_0x25f068['type']!==_0x9e49('0x3b')){var _0x115d2b={};_0x115d2b[_0x25f068['name']]={'$like':'%'+_0x48b591['query'][_0x9e49('0x38')]+'%'};return _0x115d2b;}})});}_0x3ed135=_[_0x9e49('0x3a')]({},_0x3ed135,_0x48b591[_0x9e49('0x3c')]);var _0x39d09c={'where':_0x3ed135[_0x9e49('0x39')]};return db['CloudProvider'][_0x9e49('0x1b')](_0x39d09c)[_0x9e49('0x22')](function(_0x3d4b04){_0x3e2ae9['count']=_0x3d4b04;if(_0x48b591[_0x9e49('0x2c')][_0x9e49('0x3d')]){_0x3ed135['include']=[{'all':!![]}];}return db[_0x9e49('0x28')][_0x9e49('0x3e')](_0x3ed135);})['then'](function(_0x287c4e){_0x3e2ae9[_0x9e49('0x3f')]=_0x287c4e;return _0x3e2ae9;})[_0x9e49('0x22')](respondWithFilteredResult(_0x19a9d8,_0x3ed135))[_0x9e49('0x40')](handleError(_0x19a9d8,null));};exports[_0x9e49('0x41')]=function(_0x334b86,_0xabe71d){var _0x1e75c9={'raw':!![],'where':{'id':_0x334b86[_0x9e49('0x42')]['id']}},_0x403a5e={};_0x403a5e[_0x9e49('0x2f')]=_[_0x9e49('0x43')](db['CloudProvider'][_0x9e49('0x44')]);_0x403a5e['query']=_[_0x9e49('0x43')](_0x334b86[_0x9e49('0x2c')]);_0x403a5e[_0x9e49('0x2d')]=_[_0x9e49('0x2e')](_0x403a5e[_0x9e49('0x2f')],_0x403a5e[_0x9e49('0x2c')]);_0x1e75c9[_0x9e49('0x30')]=_[_0x9e49('0x2e')](_0x403a5e['model'],qs[_0x9e49('0x31')](_0x334b86[_0x9e49('0x2c')][_0x9e49('0x31')]));_0x1e75c9[_0x9e49('0x30')]=_0x1e75c9['attributes']['length']?_0x1e75c9[_0x9e49('0x30')]:_0x403a5e[_0x9e49('0x2f')];if(_0x334b86[_0x9e49('0x2c')][_0x9e49('0x3d')]){_0x1e75c9[_0x9e49('0x45')]=[{'all':!![]}];}_0x1e75c9=_[_0x9e49('0x3a')]({},_0x1e75c9,_0x334b86[_0x9e49('0x3c')]);return db[_0x9e49('0x28')][_0x9e49('0x46')](_0x1e75c9)[_0x9e49('0x22')](handleEntityNotFound(_0xabe71d,null))[_0x9e49('0x22')](respondWithResult(_0xabe71d,null))[_0x9e49('0x40')](handleError(_0xabe71d,null));};exports[_0x9e49('0x47')]=function(_0x5da5c9,_0x3a309b){return db[_0x9e49('0x28')]['create'](_0x5da5c9[_0x9e49('0x48')],{})['then'](respondWithResult(_0x3a309b,0xc9))['catch'](handleError(_0x3a309b,null));};exports['update']=function(_0x1299dd,_0x4c022b){if(_0x1299dd[_0x9e49('0x48')]['id']){delete _0x1299dd[_0x9e49('0x48')]['id'];}return db[_0x9e49('0x28')][_0x9e49('0x46')]({'where':{'id':_0x1299dd[_0x9e49('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c022b,null))[_0x9e49('0x22')](saveUpdates(_0x1299dd[_0x9e49('0x48')],null))[_0x9e49('0x22')](respondWithResult(_0x4c022b,null))[_0x9e49('0x40')](handleError(_0x4c022b,null));};exports[_0x9e49('0x23')]=function(_0x5d7177,_0x2c3e59){return db['CloudProvider'][_0x9e49('0x46')]({'where':{'id':_0x5d7177['params']['id']}})[_0x9e49('0x22')](handleEntityNotFound(_0x2c3e59,null))['then'](removeEntity(_0x2c3e59,null))[_0x9e49('0x40')](handleError(_0x2c3e59,null));}; \ No newline at end of file +var _0x7377=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','then','error','name','index','map','CloudProvider','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','findAll','rows','show','params','keys','options','find','catch','create','body','update'];(function(_0x141c05,_0x319076){var _0x25fa28=function(_0x56f1c0){while(--_0x56f1c0){_0x141c05['push'](_0x141c05['shift']());}};_0x25fa28(++_0x319076);}(_0x7377,0x8e));var _0x7737=function(_0x536eca,_0x18b615){_0x536eca=_0x536eca-0x0;var _0x28f35f=_0x7377[_0x536eca];return _0x28f35f;};'use strict';var pdf=require(_0x7737('0x0'));var emlformat=require(_0x7737('0x1'));var rimraf=require(_0x7737('0x2'));var zipdir=require(_0x7737('0x3'));var jsonpatch=require(_0x7737('0x4'));var rp=require(_0x7737('0x5'));var moment=require(_0x7737('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7737('0x7'));var util=require(_0x7737('0x8'));var path=require(_0x7737('0x9'));var sox=require(_0x7737('0xa'));var csv=require('to-csv');var ejs=require(_0x7737('0xb'));var fs=require('fs');var _=require(_0x7737('0xc'));var squel=require('squel');var crypto=require(_0x7737('0xd'));var jsforce=require(_0x7737('0xe'));var deskjs=require(_0x7737('0xf'));var toCsv=require(_0x7737('0x10'));var querystring=require(_0x7737('0x11'));var Papa=require(_0x7737('0x12'));var Redis=require('ioredis');var authService=require(_0x7737('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7737('0x14'));var hardwareService=require(_0x7737('0x15'));var logger=require(_0x7737('0x16'))(_0x7737('0x17'));var utils=require(_0x7737('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7737('0x19'));var db=require(_0x7737('0x1a'))['db'];function respondWithStatusCode(_0xef3e3a,_0x32fff4){_0x32fff4=_0x32fff4||0xcc;return function(_0x14b2a0){if(_0x14b2a0){return _0xef3e3a[_0x7737('0x1b')](_0x32fff4);}return _0xef3e3a[_0x7737('0x1c')](_0x32fff4)[_0x7737('0x1d')]();};}function respondWithResult(_0x295100,_0x308e69){_0x308e69=_0x308e69||0xc8;return function(_0x42481c){if(_0x42481c){return _0x295100['status'](_0x308e69)['json'](_0x42481c);}};}function respondWithFilteredResult(_0x226dcc,_0x56cec6){return function(_0xe1bf1d){if(_0xe1bf1d){var _0x2f2ae1=_0xe1bf1d[_0x7737('0x1e')],_0x1127ac=_0x56cec6[_0x7737('0x1f')],_0x400ae7=_0x56cec6['offset']+_0x56cec6[_0x7737('0x20')],_0x5c4ab4;if(_0x400ae7>=_0x2f2ae1){_0x400ae7=_0x2f2ae1;_0x5c4ab4=0xc8;}else{_0x5c4ab4=0xce;}_0x226dcc[_0x7737('0x1c')](_0x5c4ab4);return _0x226dcc[_0x7737('0x21')]('Content-Range',_0x1127ac+'-'+_0x400ae7+'/'+_0x2f2ae1)[_0x7737('0x22')](_0xe1bf1d);}return null;};}function patchUpdates(_0x343fd0){return function(_0x3d71b5){try{jsonpatch[_0x7737('0x23')](_0x3d71b5,_0x343fd0,!![]);}catch(_0x53d5de){return BPromise[_0x7737('0x24')](_0x53d5de);}return _0x3d71b5[_0x7737('0x25')]();};}function saveUpdates(_0x334f11,_0xa949a7){return function(_0x7481b0){if(_0x7481b0){return _0x7481b0['update'](_0x334f11)[_0x7737('0x26')](function(_0x5199db){return _0x5199db;});}return null;};}function removeEntity(_0x13b9b2,_0x460a33){return function(_0x174a4b){if(_0x174a4b){return _0x174a4b['destroy']()[_0x7737('0x26')](function(){_0x13b9b2[_0x7737('0x1c')](0xcc)[_0x7737('0x1d')]();});}};}function handleEntityNotFound(_0x325fd4,_0x519be8){return function(_0x1afc54){if(!_0x1afc54){_0x325fd4[_0x7737('0x1b')](0x194);}return _0x1afc54;};}function handleError(_0x2c75a9,_0x5e4200){_0x5e4200=_0x5e4200||0x1f4;return function(_0x2c3e67){logger[_0x7737('0x27')](_0x2c3e67['stack']);if(_0x2c3e67[_0x7737('0x28')]){delete _0x2c3e67['name'];}_0x2c75a9[_0x7737('0x1c')](_0x5e4200)['send'](_0x2c3e67);};}exports[_0x7737('0x29')]=function(_0x5980ff,_0x2c76c2){var _0x47575d={},_0x245aa5={},_0x87d965={'count':0x0,'rows':[]};var _0x65f7ad=_[_0x7737('0x2a')](db[_0x7737('0x2b')]['rawAttributes'],function(_0x59f703){return{'name':_0x59f703['fieldName'],'type':_0x59f703[_0x7737('0x2c')][_0x7737('0x2d')]};});_0x245aa5[_0x7737('0x2e')]=_[_0x7737('0x2a')](_0x65f7ad,_0x7737('0x28'));_0x245aa5[_0x7737('0x2f')]=_['keys'](_0x5980ff[_0x7737('0x2f')]);_0x245aa5[_0x7737('0x30')]=_[_0x7737('0x31')](_0x245aa5['model'],_0x245aa5['query']);_0x47575d[_0x7737('0x32')]=_['intersection'](_0x245aa5[_0x7737('0x2e')],qs[_0x7737('0x33')](_0x5980ff[_0x7737('0x2f')][_0x7737('0x33')]));_0x47575d['attributes']=_0x47575d[_0x7737('0x32')][_0x7737('0x34')]?_0x47575d[_0x7737('0x32')]:_0x245aa5[_0x7737('0x2e')];if(!_0x5980ff[_0x7737('0x2f')][_0x7737('0x35')](_0x7737('0x36'))){_0x47575d[_0x7737('0x20')]=qs['limit'](_0x5980ff[_0x7737('0x2f')][_0x7737('0x20')]);_0x47575d[_0x7737('0x1f')]=qs[_0x7737('0x1f')](_0x5980ff[_0x7737('0x2f')][_0x7737('0x1f')]);}_0x47575d[_0x7737('0x37')]=qs[_0x7737('0x38')](_0x5980ff['query']['sort']);_0x47575d['where']=qs[_0x7737('0x30')](_['pick'](_0x5980ff[_0x7737('0x2f')],_0x245aa5['filters']),_0x65f7ad);if(_0x5980ff[_0x7737('0x2f')][_0x7737('0x39')]){_0x47575d[_0x7737('0x3a')]=_['merge'](_0x47575d['where'],{'$or':_[_0x7737('0x2a')](_0x65f7ad,function(_0x3aa0e5){if(_0x3aa0e5[_0x7737('0x2c')]!=='VIRTUAL'){var _0x37e071={};_0x37e071[_0x3aa0e5[_0x7737('0x28')]]={'$like':'%'+_0x5980ff[_0x7737('0x2f')]['filter']+'%'};return _0x37e071;}})});}_0x47575d=_[_0x7737('0x3b')]({},_0x47575d,_0x5980ff['options']);var _0x92eaab={'where':_0x47575d['where']};return db[_0x7737('0x2b')][_0x7737('0x1e')](_0x92eaab)[_0x7737('0x26')](function(_0x37bbc7){_0x87d965['count']=_0x37bbc7;if(_0x5980ff[_0x7737('0x2f')]['includeAll']){_0x47575d['include']=[{'all':!![]}];}return db[_0x7737('0x2b')][_0x7737('0x3c')](_0x47575d);})['then'](function(_0x25d47e){_0x87d965[_0x7737('0x3d')]=_0x25d47e;return _0x87d965;})['then'](respondWithFilteredResult(_0x2c76c2,_0x47575d))['catch'](handleError(_0x2c76c2,null));};exports[_0x7737('0x3e')]=function(_0x31a92c,_0x1b536b){var _0x254aa9={'raw':!![],'where':{'id':_0x31a92c[_0x7737('0x3f')]['id']}},_0x1ab918={};_0x1ab918[_0x7737('0x2e')]=_[_0x7737('0x40')](db[_0x7737('0x2b')]['rawAttributes']);_0x1ab918[_0x7737('0x2f')]=_[_0x7737('0x40')](_0x31a92c[_0x7737('0x2f')]);_0x1ab918[_0x7737('0x30')]=_[_0x7737('0x31')](_0x1ab918[_0x7737('0x2e')],_0x1ab918['query']);_0x254aa9[_0x7737('0x32')]=_['intersection'](_0x1ab918[_0x7737('0x2e')],qs[_0x7737('0x33')](_0x31a92c[_0x7737('0x2f')][_0x7737('0x33')]));_0x254aa9['attributes']=_0x254aa9['attributes'][_0x7737('0x34')]?_0x254aa9[_0x7737('0x32')]:_0x1ab918[_0x7737('0x2e')];if(_0x31a92c[_0x7737('0x2f')]['includeAll']){_0x254aa9['include']=[{'all':!![]}];}_0x254aa9=_[_0x7737('0x3b')]({},_0x254aa9,_0x31a92c[_0x7737('0x41')]);return db[_0x7737('0x2b')][_0x7737('0x42')](_0x254aa9)[_0x7737('0x26')](handleEntityNotFound(_0x1b536b,null))['then'](respondWithResult(_0x1b536b,null))[_0x7737('0x43')](handleError(_0x1b536b,null));};exports[_0x7737('0x44')]=function(_0x27d393,_0x2273f3){return db[_0x7737('0x2b')][_0x7737('0x44')](_0x27d393[_0x7737('0x45')],{})[_0x7737('0x26')](respondWithResult(_0x2273f3,0xc9))['catch'](handleError(_0x2273f3,null));};exports[_0x7737('0x46')]=function(_0x3f86ed,_0x31d0b5){if(_0x3f86ed['body']['id']){delete _0x3f86ed['body']['id'];}return db['CloudProvider'][_0x7737('0x42')]({'where':{'id':_0x3f86ed[_0x7737('0x3f')]['id']}})['then'](handleEntityNotFound(_0x31d0b5,null))[_0x7737('0x26')](saveUpdates(_0x3f86ed['body'],null))['then'](respondWithResult(_0x31d0b5,null))['catch'](handleError(_0x31d0b5,null));};exports['destroy']=function(_0x1041d9,_0x3dc8b8){return db[_0x7737('0x2b')][_0x7737('0x42')]({'where':{'id':_0x1041d9[_0x7737('0x3f')]['id']}})[_0x7737('0x26')](handleEntityNotFound(_0x3dc8b8,null))[_0x7737('0x26')](removeEntity(_0x3dc8b8,null))['catch'](handleError(_0x3dc8b8,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 9297b3b..724ffdd 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 _0x7a30=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cloud_providers'];(function(_0xd6b03c,_0x496d8e){var _0x3f00ad=function(_0x290784){while(--_0x290784){_0xd6b03c['push'](_0xd6b03c['shift']());}};_0x3f00ad(++_0x496d8e);}(_0x7a30,0x1c3));var _0x07a3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a30[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x07a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x07a3('0x1'));var moment=require(_0x07a3('0x2'));var BPromise=require(_0x07a3('0x3'));var rp=require(_0x07a3('0x4'));var fs=require('fs');var path=require(_0x07a3('0x5'));var rimraf=require(_0x07a3('0x6'));var config=require(_0x07a3('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x07a3('0x8')]=function(_0x444f1f,_0x2e6c19){return _0x444f1f[_0x07a3('0x9')]('CloudProvider',attributes,{'tableName':_0x07a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7dd=['CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x395928,_0x51afb0){var _0x4efda4=function(_0x3a422e){while(--_0x3a422e){_0x395928['push'](_0x395928['shift']());}};_0x4efda4(++_0x51afb0);}(_0xe7dd,0x6a));var _0xde7d=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0xe7dd[_0x42ca15];return _0x1c6ded;};'use strict';var _=require(_0xde7d('0x0'));var util=require(_0xde7d('0x1'));var logger=require(_0xde7d('0x2'))(_0xde7d('0x3'));var moment=require(_0xde7d('0x4'));var BPromise=require('bluebird');var rp=require(_0xde7d('0x5'));var fs=require('fs');var path=require(_0xde7d('0x6'));var rimraf=require(_0xde7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xde7d('0x8'));module[_0xde7d('0x9')]=function(_0x373fd3,_0x38cca9){return _0x373fd3[_0xde7d('0xa')](_0xde7d('0xb'),attributes,{'tableName':_0xde7d('0xc'),'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 1460a71..acd87a4 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 _0x77c1=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','result','catch','lodash','util','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77c1,0x66));var _0x177c=function(_0x1e4206,_0x3c5392){_0x1e4206=_0x1e4206-0x0;var _0x351c22=_0x77c1[_0x1e4206];return _0x351c22;};'use strict';var _=require(_0x177c('0x0'));var util=require(_0x177c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x177c('0x2'));var fs=require('fs');var Redis=require(_0x177c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x177c('0x4'));var logger=require(_0x177c('0x5'))(_0x177c('0x6'));var config=require('../../config/environment');var jayson=require(_0x177c('0x7'));var client=jayson[_0x177c('0x8')][_0x177c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x452cda,_0x49b6c9,_0x1d0a44){return new BPromise(function(_0x836b9d,_0xdbbeb4){return client[_0x177c('0xa')](_0x452cda,_0x1d0a44)[_0x177c('0xb')](function(_0x157cde){logger[_0x177c('0xc')](_0x177c('0xd'),_0x49b6c9,_0x177c('0xe'));logger[_0x177c('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x49b6c9,_0x177c('0xe'),JSON[_0x177c('0x10')](_0x157cde));if(_0x157cde['error']){if(_0x157cde['error']['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x49b6c9,_0x157cde['error'][_0x177c('0x11')]);return _0xdbbeb4(_0x157cde[_0x177c('0x12')][_0x177c('0x11')]);}logger[_0x177c('0x12')](_0x177c('0xd'),_0x49b6c9,_0x157cde['error'][_0x177c('0x11')]);return _0x836b9d(_0x157cde[_0x177c('0x12')][_0x177c('0x11')]);}else{logger['info'](_0x177c('0xd'),_0x49b6c9,_0x177c('0xe'));_0x836b9d(_0x157cde[_0x177c('0x13')]['message']);}})[_0x177c('0x14')](function(_0x20ab52){logger[_0x177c('0x12')](_0x177c('0xd'),_0x49b6c9,_0x20ab52);_0xdbbeb4(_0x20ab52);});});} \ No newline at end of file +var _0x33b3=['jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x2757a8,_0x388e22){var _0x281cb3=function(_0x23ca59){while(--_0x23ca59){_0x2757a8['push'](_0x2757a8['shift']());}};_0x281cb3(++_0x388e22);}(_0x33b3,0xad));var _0x333b=function(_0xd5c748,_0x30deca){_0xd5c748=_0xd5c748-0x0;var _0x4d520b=_0x33b3[_0xd5c748];return _0x4d520b;};'use strict';var _=require(_0x333b('0x0'));var util=require(_0x333b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x333b('0x2'));var fs=require('fs');var Redis=require(_0x333b('0x3'));var db=require(_0x333b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x333b('0x5'));var config=require(_0x333b('0x6'));var jayson=require(_0x333b('0x7'));var client=jayson[_0x333b('0x8')][_0x333b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x222d8b,_0x2ce82d,_0x157e65){return new BPromise(function(_0xc75331,_0x428d2a){return client[_0x333b('0xa')](_0x222d8b,_0x157e65)['then'](function(_0x11ecce){logger[_0x333b('0xb')](_0x333b('0xc'),_0x2ce82d,_0x333b('0xd'));logger['debug'](_0x333b('0xe'),_0x2ce82d,_0x333b('0xd'),JSON[_0x333b('0xf')](_0x11ecce));if(_0x11ecce[_0x333b('0x10')]){if(_0x11ecce['error'][_0x333b('0x11')]===0x1f4){logger[_0x333b('0x10')](_0x333b('0xc'),_0x2ce82d,_0x11ecce[_0x333b('0x10')]['message']);return _0x428d2a(_0x11ecce[_0x333b('0x10')][_0x333b('0x12')]);}logger[_0x333b('0x10')](_0x333b('0xc'),_0x2ce82d,_0x11ecce[_0x333b('0x10')][_0x333b('0x12')]);return _0xc75331(_0x11ecce[_0x333b('0x10')][_0x333b('0x12')]);}else{logger[_0x333b('0xb')](_0x333b('0xc'),_0x2ce82d,_0x333b('0xd'));_0xc75331(_0x11ecce['result'][_0x333b('0x12')]);}})[_0x333b('0x13')](function(_0x23cb99){logger[_0x333b('0x10')]('CloudProvider,\x20%s,\x20%s',_0x2ce82d,_0x23cb99);_0x428d2a(_0x23cb99);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 0e79b73..7b8bc5c 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 _0x9ba7=['../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9ba7,0x14b));var _0x79ba=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9ba7[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0x79ba('0x0'));var util=require(_0x79ba('0x1'));var path=require('path');var timeout=require(_0x79ba('0x2'));var express=require(_0x79ba('0x3'));var router=express['Router']();var auth=require(_0x79ba('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x79ba('0x5'));var controller=require('./cloudProvider.controller');router[_0x79ba('0x6')]('/',auth[_0x79ba('0x7')](),controller[_0x79ba('0x8')]);router[_0x79ba('0x6')](_0x79ba('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x79ba('0x7')](),controller[_0x79ba('0xa')]);router[_0x79ba('0xb')](_0x79ba('0x9'),auth[_0x79ba('0x7')](),controller['update']);router[_0x79ba('0xc')](_0x79ba('0x9'),auth[_0x79ba('0x7')](),controller['destroy']);module[_0x79ba('0xd')]=router; \ No newline at end of file +var _0xea7c=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./cloudProvider.controller','isAuthenticated','get','/:id','show','post','create'];(function(_0x1ec6c8,_0x72ff6){var _0x16701c=function(_0x4fd69f){while(--_0x4fd69f){_0x1ec6c8['push'](_0x1ec6c8['shift']());}};_0x16701c(++_0x72ff6);}(_0xea7c,0x113));var _0xcea7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xea7c[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0xcea7('0x0'));var path=require(_0xcea7('0x1'));var timeout=require(_0xcea7('0x2'));var express=require(_0xcea7('0x3'));var router=express[_0xcea7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcea7('0x5'));var config=require('../../config/environment');var controller=require(_0xcea7('0x6'));router['get']('/',auth[_0xcea7('0x7')](),controller['index']);router[_0xcea7('0x8')](_0xcea7('0x9'),auth[_0xcea7('0x7')](),controller[_0xcea7('0xa')]);router[_0xcea7('0xb')]('/',auth[_0xcea7('0x7')](),controller[_0xcea7('0xc')]);router[_0xcea7('0xd')](_0xcea7('0x9'),auth[_0xcea7('0x7')](),controller[_0xcea7('0xe')]);router[_0xcea7('0xf')](_0xcea7('0x9'),auth[_0xcea7('0x7')](),controller[_0xcea7('0x10')]);module[_0xcea7('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f821acd..3eb2c2d 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 _0xca87=['sequelize','STRING','name'];(function(_0x2bc721,_0xa8d0e){var _0xc63c3=function(_0x44b0d0){while(--_0x44b0d0){_0x2bc721['push'](_0x2bc721['shift']());}};_0xc63c3(++_0xa8d0e);}(_0xca87,0xc9));var _0x7ca8=function(_0x1096be,_0x5817a9){_0x1096be=_0x1096be-0x0;var _0x5a32a7=_0xca87[_0x1096be];return _0x5a32a7;};'use strict';var Sequelize=require(_0x7ca8('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ca8('0x1')],'unique':_0x7ca8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x7ca8('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7ca8('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7ca8('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7ca8('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7ca8('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x7ca8('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7ca8('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4342=['sequelize','name','STRING'];(function(_0x511409,_0x5cfe6a){var _0x370750=function(_0x2ae6a9){while(--_0x2ae6a9){_0x511409['push'](_0x511409['shift']());}};_0x370750(++_0x5cfe6a);}(_0x4342,0x1d4));var _0x2434=function(_0x9e689c,_0x2600d8){_0x9e689c=_0x9e689c-0x0;var _0x13ee00=_0x4342[_0x9e689c];return _0x13ee00;};'use strict';var Sequelize=require(_0x2434('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2434('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2434('0x2')]},'companyId':{'type':Sequelize[_0x2434('0x2')]},'website':{'type':Sequelize[_0x2434('0x2')]},'phone':{'type':Sequelize[_0x2434('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2434('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x2434('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2434('0x2')]},'email':{'type':Sequelize[_0x2434('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2434('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x2434('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x2434('0x2')]},'description':{'type':Sequelize[_0x2434('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 6b02250..18cb4f1 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 _0x5999=['findAll','rows','catch','show','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts','CmContact','params','omit','ids','getContacts','rawAttributes','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Companies','UserProfileResource','destroy','then','error','name','send','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','map','options','CmCompany'];(function(_0x413182,_0xc04c2f){var _0x14497a=function(_0x43c194){while(--_0x43c194){_0x413182['push'](_0x413182['shift']());}};_0x14497a(++_0xc04c2f);}(_0x5999,0x10d));var _0x9599=function(_0x15c142,_0x53102c){_0x15c142=_0x15c142-0x0;var _0x8d26cd=_0x5999[_0x15c142];return _0x8d26cd;};'use strict';var pdf=require(_0x9599('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9599('0x1'));var zipdir=require(_0x9599('0x2'));var jsonpatch=require(_0x9599('0x3'));var rp=require(_0x9599('0x4'));var moment=require(_0x9599('0x5'));var BPromise=require(_0x9599('0x6'));var Mustache=require(_0x9599('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9599('0x8'));var ejs=require(_0x9599('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9599('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9599('0xb'));var toCsv=require(_0x9599('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9599('0xc'));var authService=require(_0x9599('0xd'));var qs=require(_0x9599('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9599('0xf'))(_0x9599('0x10'));var utils=require('../../config/utils');var config=require(_0x9599('0x11'));var licenseUtil=require(_0x9599('0x12'));var db=require(_0x9599('0x13'))['db'];function respondWithStatusCode(_0x44afb3,_0x5978e0){_0x5978e0=_0x5978e0||0xcc;return function(_0x15490e){if(_0x15490e){return _0x44afb3[_0x9599('0x14')](_0x5978e0);}return _0x44afb3[_0x9599('0x15')](_0x5978e0)[_0x9599('0x16')]();};}function respondWithResult(_0xb5a875,_0x39d286){_0x39d286=_0x39d286||0xc8;return function(_0x286d6f){if(_0x286d6f){return _0xb5a875[_0x9599('0x15')](_0x39d286)[_0x9599('0x17')](_0x286d6f);}};}function respondWithFilteredResult(_0x147ea1,_0x1dfc7a){return function(_0x1d1c79){if(_0x1d1c79){var _0x5ed231=_0x1d1c79[_0x9599('0x18')],_0x2cf2ab=_0x1dfc7a[_0x9599('0x19')],_0x17b427=_0x1dfc7a['offset']+_0x1dfc7a[_0x9599('0x1a')],_0x1048c1;if(_0x17b427>=_0x5ed231){_0x17b427=_0x5ed231;_0x1048c1=0xc8;}else{_0x1048c1=0xce;}_0x147ea1[_0x9599('0x15')](_0x1048c1);return _0x147ea1[_0x9599('0x1b')](_0x9599('0x1c'),_0x2cf2ab+'-'+_0x17b427+'/'+_0x5ed231)[_0x9599('0x17')](_0x1d1c79);}return null;};}function patchUpdates(_0x2affde){return function(_0x2a3a9f){try{jsonpatch[_0x9599('0x1d')](_0x2a3a9f,_0x2affde,!![]);}catch(_0x43d7af){return BPromise[_0x9599('0x1e')](_0x43d7af);}return _0x2a3a9f[_0x9599('0x1f')]();};}function saveUpdates(_0x43c167,_0x332272){return function(_0x4a1ffa){if(_0x4a1ffa){return _0x4a1ffa[_0x9599('0x20')](_0x43c167)['then'](function(_0x166281){return _0x166281;});}return null;};}function removeEntity(_0x183368,_0x21f29d){return function(_0x2113d7){if(_0x2113d7){return _0x2113d7['destroy']()['then'](function(){var _0x4306df=_0x2113d7[_0x9599('0x21')]({'plain':!![]});var _0x1e2578=_0x9599('0x22');return db[_0x9599('0x23')][_0x9599('0x24')]({'where':{'type':_0x1e2578,'resourceId':_0x4306df['id']}})[_0x9599('0x25')](function(){return _0x2113d7;});})[_0x9599('0x25')](function(){_0x183368[_0x9599('0x15')](0xcc)[_0x9599('0x16')]();});}};}function handleEntityNotFound(_0x33efb4,_0x158bab){return function(_0x9850f8){if(!_0x9850f8){_0x33efb4[_0x9599('0x14')](0x194);}return _0x9850f8;};}function handleError(_0x5bc81d,_0x55c19c){_0x55c19c=_0x55c19c||0x1f4;return function(_0x24db75){logger[_0x9599('0x26')](_0x24db75['stack']);if(_0x24db75[_0x9599('0x27')]){delete _0x24db75[_0x9599('0x27')];}_0x5bc81d[_0x9599('0x15')](_0x55c19c)[_0x9599('0x28')](_0x24db75);};}exports['index']=function(_0x43e21a,_0x383338){var _0x5ceb9b={},_0x191ccf={},_0x3f965a={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x9599('0x25')](function(_0x3c89a9){_0x191ccf['model']=_[_0x9599('0x29')](_0x3c89a9);_0x191ccf[_0x9599('0x2a')]=_['keys'](_0x43e21a['query']);_0x191ccf['filters']=_[_0x9599('0x2b')](_0x191ccf[_0x9599('0x2c')],_0x191ccf['query']);_0x5ceb9b['attributes']=_[_0x9599('0x2b')](_0x191ccf[_0x9599('0x2c')],qs[_0x9599('0x2d')](_0x43e21a['query'][_0x9599('0x2d')]));_0x5ceb9b[_0x9599('0x2e')]=_0x5ceb9b[_0x9599('0x2e')][_0x9599('0x2f')]?_0x5ceb9b[_0x9599('0x2e')]:_0x191ccf[_0x9599('0x2c')];if(!_0x43e21a['query']['hasOwnProperty'](_0x9599('0x30'))){_0x5ceb9b['limit']=qs[_0x9599('0x1a')](_0x43e21a[_0x9599('0x2a')][_0x9599('0x1a')]);_0x5ceb9b['offset']=qs[_0x9599('0x19')](_0x43e21a[_0x9599('0x2a')][_0x9599('0x19')]);}_0x5ceb9b[_0x9599('0x31')]=qs['sort'](_0x43e21a[_0x9599('0x2a')][_0x9599('0x32')]);_0x5ceb9b[_0x9599('0x33')]=qs['filters'](_[_0x9599('0x34')](_0x43e21a[_0x9599('0x2a')],_0x191ccf[_0x9599('0x35')]),_0x3c89a9);if(_0x43e21a[_0x9599('0x2a')][_0x9599('0x36')]){_0x5ceb9b[_0x9599('0x33')]=_[_0x9599('0x37')](_0x5ceb9b[_0x9599('0x33')],{'$or':_[_0x9599('0x38')](_0x5ceb9b[_0x9599('0x2e')],function(_0x613a11){var _0x3c9d8c={};_0x3c9d8c[_0x613a11]={'$like':'%'+_0x43e21a[_0x9599('0x2a')][_0x9599('0x36')]+'%'};return _0x3c9d8c;})});}_0x5ceb9b=_[_0x9599('0x37')]({},_0x5ceb9b,_0x43e21a[_0x9599('0x39')]);var _0x58bae3={'where':_0x5ceb9b[_0x9599('0x33')]};return db[_0x9599('0x3a')][_0x9599('0x18')](_0x58bae3)['then'](function(_0x1c5ffe){_0x3f965a[_0x9599('0x18')]=_0x1c5ffe;if(_0x43e21a[_0x9599('0x2a')]['includeAll']){_0x5ceb9b['include']=[{'all':!![]}];}return db[_0x9599('0x3a')][_0x9599('0x3b')](_0x5ceb9b);})['then'](function(_0x212e75){_0x3f965a[_0x9599('0x3c')]=_0x212e75;return _0x3f965a;})[_0x9599('0x25')](respondWithFilteredResult(_0x383338,_0x5ceb9b))['catch'](handleError(_0x383338,null));})[_0x9599('0x3d')](handleError(_0x383338,null));};exports[_0x9599('0x3e')]=function(_0x1e9a06,_0x29a695){var _0x4e7e02={'raw':![],'where':{'id':_0x1e9a06['params']['id']}},_0x27b64a={};_0x27b64a[_0x9599('0x2c')]=_[_0x9599('0x29')](db[_0x9599('0x3a')]['rawAttributes']);_0x27b64a['query']=_[_0x9599('0x29')](_0x1e9a06[_0x9599('0x2a')]);_0x27b64a[_0x9599('0x35')]=_[_0x9599('0x2b')](_0x27b64a[_0x9599('0x2c')],_0x27b64a[_0x9599('0x2a')]);_0x4e7e02[_0x9599('0x2e')]=_['intersection'](_0x27b64a[_0x9599('0x2c')],qs['fields'](_0x1e9a06['query']['fields']));_0x4e7e02[_0x9599('0x2e')]=_0x4e7e02['attributes'][_0x9599('0x2f')]?_0x4e7e02['attributes']:_0x27b64a['model'];if(_0x1e9a06[_0x9599('0x2a')][_0x9599('0x3f')]){_0x4e7e02[_0x9599('0x40')]=[{'all':!![]}];}_0x4e7e02=_[_0x9599('0x37')]({},_0x4e7e02,_0x1e9a06[_0x9599('0x39')]);return db[_0x9599('0x3a')][_0x9599('0x41')](_0x4e7e02)[_0x9599('0x25')](handleEntityNotFound(_0x29a695,null))[_0x9599('0x25')](respondWithResult(_0x29a695,null))[_0x9599('0x3d')](handleError(_0x29a695,null));};exports[_0x9599('0x42')]=function(_0x29ec6a,_0x3c6e31){return db[_0x9599('0x3a')][_0x9599('0x42')](_0x29ec6a['body'],{})[_0x9599('0x25')](function(_0x285d51){var _0x19ebbd=_0x29ec6a['user'][_0x9599('0x21')]({'plain':!![]});if(!_0x19ebbd)throw new Error(_0x9599('0x43'));if(_0x19ebbd[_0x9599('0x44')]==='user'){var _0x2d5b5c=_0x285d51[_0x9599('0x21')]({'plain':!![]});var _0x4c6921=_0x9599('0x22');return db[_0x9599('0x45')][_0x9599('0x41')]({'where':{'name':_0x4c6921,'userProfileId':_0x19ebbd[_0x9599('0x46')]},'raw':!![]})['then'](function(_0x54e77d){if(_0x54e77d&&_0x54e77d[_0x9599('0x47')]===0x0){return db[_0x9599('0x23')]['create']({'name':_0x2d5b5c[_0x9599('0x27')],'resourceId':_0x2d5b5c['id'],'type':_0x54e77d[_0x9599('0x27')],'sectionId':_0x54e77d['id']},{})[_0x9599('0x25')](function(){return _0x285d51;});}else{return _0x285d51;}})[_0x9599('0x3d')](function(_0xe828b1){logger[_0x9599('0x26')](_0x9599('0x48'),_0xe828b1);throw _0xe828b1;});}return _0x285d51;})[_0x9599('0x25')](respondWithResult(_0x3c6e31,0xc9))[_0x9599('0x3d')](handleError(_0x3c6e31,null));};exports[_0x9599('0x20')]=function(_0x2605b5,_0x44bd47){if(_0x2605b5['body']['id']){delete _0x2605b5['body']['id'];}return db[_0x9599('0x3a')][_0x9599('0x41')]({'where':{'id':_0x2605b5['params']['id']}})['then'](handleEntityNotFound(_0x44bd47,null))[_0x9599('0x25')](saveUpdates(_0x2605b5[_0x9599('0x49')],null))[_0x9599('0x25')](respondWithResult(_0x44bd47,null))[_0x9599('0x3d')](handleError(_0x44bd47,null));};exports[_0x9599('0x24')]=function(_0x15897f,_0x9488b5){return db[_0x9599('0x3a')][_0x9599('0x41')]({'where':{'id':_0x15897f['params']['id']}})[_0x9599('0x25')](handleEntityNotFound(_0x9488b5,null))[_0x9599('0x25')](removeEntity(_0x9488b5,null))[_0x9599('0x3d')](handleError(_0x9488b5,null));};exports['describe']=function(_0x2cfa28,_0x3cb758){return db[_0x9599('0x3a')][_0x9599('0x4a')]()[_0x9599('0x25')](respondWithResult(_0x3cb758,null))[_0x9599('0x3d')](handleError(_0x3cb758,null));};exports[_0x9599('0x4b')]=function(_0x5f744e,_0x2269a4,_0xd26f6f){return db[_0x9599('0x4c')][_0x9599('0x41')]({'where':{'id':_0x5f744e[_0x9599('0x4d')]['id']}})[_0x9599('0x25')](handleEntityNotFound(_0x2269a4,null))['then'](function(_0xa0fe01){if(_0xa0fe01){return _0xa0fe01['addContacts'](_0x5f744e[_0x9599('0x49')]['ids'],_[_0x9599('0x4e')](_0x5f744e[_0x9599('0x49')],[_0x9599('0x4f'),'id'])||{});}})[_0x9599('0x25')](respondWithResult(_0x2269a4,null))['catch'](handleError(_0x2269a4,null));};exports[_0x9599('0x50')]=function(_0x18fa4e,_0xae9990,_0x27553e){var _0x239b29={};var _0x2dfaa0={};var _0x172503;var _0x10112d;return db[_0x9599('0x3a')]['findOne']({'where':{'id':_0x18fa4e[_0x9599('0x4d')]['id']}})['then'](handleEntityNotFound(_0xae9990,null))[_0x9599('0x25')](function(_0x41ea5e){if(_0x41ea5e){_0x172503=_0x41ea5e;_0x2dfaa0[_0x9599('0x2c')]=_[_0x9599('0x29')](db[_0x9599('0x4c')][_0x9599('0x51')]);_0x2dfaa0['query']=_[_0x9599('0x29')](_0x18fa4e[_0x9599('0x2a')]);_0x2dfaa0[_0x9599('0x35')]=_['intersection'](_0x2dfaa0[_0x9599('0x2c')],_0x2dfaa0[_0x9599('0x2a')]);_0x239b29[_0x9599('0x2e')]=_[_0x9599('0x2b')](_0x2dfaa0['model'],qs[_0x9599('0x2d')](_0x18fa4e['query']['fields']));_0x239b29[_0x9599('0x2e')]=_0x239b29[_0x9599('0x2e')]['length']?_0x239b29[_0x9599('0x2e')]:_0x2dfaa0[_0x9599('0x2c')];_0x239b29[_0x9599('0x31')]=qs[_0x9599('0x32')](_0x18fa4e['query'][_0x9599('0x32')]);_0x239b29['where']=qs[_0x9599('0x35')](_[_0x9599('0x34')](_0x18fa4e[_0x9599('0x2a')],_0x2dfaa0[_0x9599('0x35')]));if(_0x18fa4e[_0x9599('0x2a')]['filter']){_0x239b29[_0x9599('0x33')]=_[_0x9599('0x37')](_0x239b29[_0x9599('0x33')],{'$or':_[_0x9599('0x38')](_0x239b29['attributes'],function(_0x145895){var _0x5bf2e4={};_0x5bf2e4[_0x145895]={'$like':'%'+_0x18fa4e['query']['filter']+'%'};return _0x5bf2e4;})});}_0x239b29=_[_0x9599('0x37')]({},_0x239b29,_0x18fa4e[_0x9599('0x39')]);return _0x172503[_0x9599('0x50')](_0x239b29);}})[_0x9599('0x25')](function(_0x44acf5){if(_0x44acf5){_0x10112d=_0x44acf5[_0x9599('0x2f')];if(!_0x18fa4e[_0x9599('0x2a')]['hasOwnProperty'](_0x9599('0x30'))){_0x239b29[_0x9599('0x1a')]=qs['limit'](_0x18fa4e[_0x9599('0x2a')][_0x9599('0x1a')]);_0x239b29[_0x9599('0x19')]=qs[_0x9599('0x19')](_0x18fa4e[_0x9599('0x2a')][_0x9599('0x19')]);}return _0x172503[_0x9599('0x50')](_0x239b29);}})[_0x9599('0x25')](function(_0x3e250c){if(_0x3e250c){return _0x3e250c?{'count':_0x10112d,'rows':_0x3e250c}:null;}})[_0x9599('0x25')](respondWithResult(_0xae9990,null))[_0x9599('0x3d')](handleError(_0xae9990,null));}; \ No newline at end of file +var _0xafc0=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','CmCompany','includeAll','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','model','keys','query'];(function(_0x3b8e52,_0x2ac683){var _0x281a8d=function(_0x1ac2bd){while(--_0x1ac2bd){_0x3b8e52['push'](_0x3b8e52['shift']());}};_0x281a8d(++_0x2ac683);}(_0xafc0,0xd7));var _0x0afc=function(_0x151cdd,_0x32462f){_0x151cdd=_0x151cdd-0x0;var _0xd7dbd3=_0xafc0[_0x151cdd];return _0xd7dbd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0afc('0x0'));var rimraf=require(_0x0afc('0x1'));var zipdir=require(_0x0afc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0afc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0afc('0x4'));var util=require(_0x0afc('0x5'));var path=require(_0x0afc('0x6'));var sox=require(_0x0afc('0x7'));var csv=require(_0x0afc('0x8'));var ejs=require(_0x0afc('0x9'));var fs=require('fs');var _=require(_0x0afc('0xa'));var squel=require(_0x0afc('0xb'));var crypto=require(_0x0afc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0afc('0xd'));var toCsv=require(_0x0afc('0x8'));var querystring=require(_0x0afc('0xe'));var Papa=require('papaparse');var Redis=require(_0x0afc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0afc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0afc('0x11'));var logger=require(_0x0afc('0x12'))(_0x0afc('0x13'));var utils=require(_0x0afc('0x14'));var config=require(_0x0afc('0x15'));var licenseUtil=require(_0x0afc('0x16'));var db=require(_0x0afc('0x17'))['db'];function respondWithStatusCode(_0x249291,_0x1fbe2a){_0x1fbe2a=_0x1fbe2a||0xcc;return function(_0x3c207b){if(_0x3c207b){return _0x249291[_0x0afc('0x18')](_0x1fbe2a);}return _0x249291[_0x0afc('0x19')](_0x1fbe2a)[_0x0afc('0x1a')]();};}function respondWithResult(_0xeab5cf,_0x4522f4){_0x4522f4=_0x4522f4||0xc8;return function(_0x413e25){if(_0x413e25){return _0xeab5cf[_0x0afc('0x19')](_0x4522f4)[_0x0afc('0x1b')](_0x413e25);}};}function respondWithFilteredResult(_0x4e8e71,_0x11723c){return function(_0x21ba79){if(_0x21ba79){var _0x45aa85=_0x21ba79[_0x0afc('0x1c')],_0x58c340=_0x11723c[_0x0afc('0x1d')],_0x4ded20=_0x11723c['offset']+_0x11723c[_0x0afc('0x1e')],_0x1ebb35;if(_0x4ded20>=_0x45aa85){_0x4ded20=_0x45aa85;_0x1ebb35=0xc8;}else{_0x1ebb35=0xce;}_0x4e8e71['status'](_0x1ebb35);return _0x4e8e71['set'](_0x0afc('0x1f'),_0x58c340+'-'+_0x4ded20+'/'+_0x45aa85)[_0x0afc('0x1b')](_0x21ba79);}return null;};}function patchUpdates(_0x29b6ec){return function(_0x396f59){try{jsonpatch[_0x0afc('0x20')](_0x396f59,_0x29b6ec,!![]);}catch(_0x485d71){return BPromise[_0x0afc('0x21')](_0x485d71);}return _0x396f59[_0x0afc('0x22')]();};}function saveUpdates(_0x21ba86,_0x7f158c){return function(_0xece5e5){if(_0xece5e5){return _0xece5e5['update'](_0x21ba86)[_0x0afc('0x23')](function(_0x52ed8f){return _0x52ed8f;});}return null;};}function removeEntity(_0x478a92,_0x9e19dd){return function(_0x1bd10d){if(_0x1bd10d){return _0x1bd10d[_0x0afc('0x24')]()[_0x0afc('0x23')](function(){var _0x61bf8a=_0x1bd10d[_0x0afc('0x25')]({'plain':!![]});var _0x5b4a4b=_0x0afc('0x26');return db[_0x0afc('0x27')][_0x0afc('0x24')]({'where':{'type':_0x5b4a4b,'resourceId':_0x61bf8a['id']}})['then'](function(){return _0x1bd10d;});})[_0x0afc('0x23')](function(){_0x478a92[_0x0afc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f1cc,_0x5daa38){return function(_0x59e3cb){if(!_0x59e3cb){_0x52f1cc[_0x0afc('0x18')](0x194);}return _0x59e3cb;};}function handleError(_0x232464,_0x42b260){_0x42b260=_0x42b260||0x1f4;return function(_0x1359bc){logger[_0x0afc('0x28')](_0x1359bc[_0x0afc('0x29')]);if(_0x1359bc[_0x0afc('0x2a')]){delete _0x1359bc['name'];}_0x232464[_0x0afc('0x19')](_0x42b260)[_0x0afc('0x2b')](_0x1359bc);};}exports[_0x0afc('0x2c')]=function(_0x73e9e7,_0x5340c8){var _0x5e2b85={},_0x34e597={},_0x4c0c2b={'count':0x0,'rows':[]};return db['CmCompany'][_0x0afc('0x2d')]()[_0x0afc('0x23')](function(_0x2dc1f1){_0x34e597[_0x0afc('0x2e')]=_[_0x0afc('0x2f')](_0x2dc1f1);_0x34e597[_0x0afc('0x30')]=_[_0x0afc('0x2f')](_0x73e9e7[_0x0afc('0x30')]);_0x34e597[_0x0afc('0x31')]=_[_0x0afc('0x32')](_0x34e597[_0x0afc('0x2e')],_0x34e597[_0x0afc('0x30')]);_0x5e2b85['attributes']=_[_0x0afc('0x32')](_0x34e597[_0x0afc('0x2e')],qs[_0x0afc('0x33')](_0x73e9e7[_0x0afc('0x30')][_0x0afc('0x33')]));_0x5e2b85[_0x0afc('0x34')]=_0x5e2b85['attributes'][_0x0afc('0x35')]?_0x5e2b85[_0x0afc('0x34')]:_0x34e597[_0x0afc('0x2e')];if(!_0x73e9e7[_0x0afc('0x30')][_0x0afc('0x36')](_0x0afc('0x37'))){_0x5e2b85[_0x0afc('0x1e')]=qs['limit'](_0x73e9e7[_0x0afc('0x30')]['limit']);_0x5e2b85[_0x0afc('0x1d')]=qs[_0x0afc('0x1d')](_0x73e9e7[_0x0afc('0x30')][_0x0afc('0x1d')]);}_0x5e2b85[_0x0afc('0x38')]=qs['sort'](_0x73e9e7[_0x0afc('0x30')][_0x0afc('0x39')]);_0x5e2b85['where']=qs[_0x0afc('0x31')](_[_0x0afc('0x3a')](_0x73e9e7['query'],_0x34e597[_0x0afc('0x31')]),_0x2dc1f1);if(_0x73e9e7[_0x0afc('0x30')][_0x0afc('0x3b')]){_0x5e2b85[_0x0afc('0x3c')]=_[_0x0afc('0x3d')](_0x5e2b85[_0x0afc('0x3c')],{'$or':_[_0x0afc('0x3e')](_0x5e2b85[_0x0afc('0x34')],function(_0xfef15b){var _0x2a701e={};_0x2a701e[_0xfef15b]={'$like':'%'+_0x73e9e7['query'][_0x0afc('0x3b')]+'%'};return _0x2a701e;})});}_0x5e2b85=_[_0x0afc('0x3d')]({},_0x5e2b85,_0x73e9e7[_0x0afc('0x3f')]);var _0x111406={'where':_0x5e2b85[_0x0afc('0x3c')]};return db[_0x0afc('0x40')][_0x0afc('0x1c')](_0x111406)[_0x0afc('0x23')](function(_0x40b343){_0x4c0c2b[_0x0afc('0x1c')]=_0x40b343;if(_0x73e9e7[_0x0afc('0x30')][_0x0afc('0x41')]){_0x5e2b85['include']=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x5e2b85);})['then'](function(_0xadf2ff){_0x4c0c2b[_0x0afc('0x42')]=_0xadf2ff;return _0x4c0c2b;})[_0x0afc('0x23')](respondWithFilteredResult(_0x5340c8,_0x5e2b85))[_0x0afc('0x43')](handleError(_0x5340c8,null));})['catch'](handleError(_0x5340c8,null));};exports[_0x0afc('0x44')]=function(_0x4128c6,_0x3cb2f3){var _0x22de3f={'raw':![],'where':{'id':_0x4128c6[_0x0afc('0x45')]['id']}},_0x29f9b1={};_0x29f9b1[_0x0afc('0x2e')]=_[_0x0afc('0x2f')](db['CmCompany'][_0x0afc('0x46')]);_0x29f9b1[_0x0afc('0x30')]=_['keys'](_0x4128c6[_0x0afc('0x30')]);_0x29f9b1['filters']=_[_0x0afc('0x32')](_0x29f9b1[_0x0afc('0x2e')],_0x29f9b1[_0x0afc('0x30')]);_0x22de3f[_0x0afc('0x34')]=_[_0x0afc('0x32')](_0x29f9b1['model'],qs[_0x0afc('0x33')](_0x4128c6['query'][_0x0afc('0x33')]));_0x22de3f['attributes']=_0x22de3f[_0x0afc('0x34')][_0x0afc('0x35')]?_0x22de3f[_0x0afc('0x34')]:_0x29f9b1[_0x0afc('0x2e')];if(_0x4128c6[_0x0afc('0x30')][_0x0afc('0x41')]){_0x22de3f[_0x0afc('0x47')]=[{'all':!![]}];}_0x22de3f=_[_0x0afc('0x3d')]({},_0x22de3f,_0x4128c6['options']);return db[_0x0afc('0x40')][_0x0afc('0x48')](_0x22de3f)[_0x0afc('0x23')](handleEntityNotFound(_0x3cb2f3,null))[_0x0afc('0x23')](respondWithResult(_0x3cb2f3,null))[_0x0afc('0x43')](handleError(_0x3cb2f3,null));};exports[_0x0afc('0x49')]=function(_0x392f6a,_0xd81e4){return db[_0x0afc('0x40')][_0x0afc('0x49')](_0x392f6a['body'],{})[_0x0afc('0x23')](function(_0x5d33ff){var _0x5cd214=_0x392f6a[_0x0afc('0x4a')][_0x0afc('0x25')]({'plain':!![]});if(!_0x5cd214)throw new Error(_0x0afc('0x4b'));if(_0x5cd214[_0x0afc('0x4c')]===_0x0afc('0x4a')){var _0x5ecba5=_0x5d33ff[_0x0afc('0x25')]({'plain':!![]});var _0x3b32a4=_0x0afc('0x26');return db[_0x0afc('0x4d')]['find']({'where':{'name':_0x3b32a4,'userProfileId':_0x5cd214[_0x0afc('0x4e')]},'raw':!![]})[_0x0afc('0x23')](function(_0x202238){if(_0x202238&&_0x202238[_0x0afc('0x4f')]===0x0){return db[_0x0afc('0x27')][_0x0afc('0x49')]({'name':_0x5ecba5[_0x0afc('0x2a')],'resourceId':_0x5ecba5['id'],'type':_0x202238[_0x0afc('0x2a')],'sectionId':_0x202238['id']},{})[_0x0afc('0x23')](function(){return _0x5d33ff;});}else{return _0x5d33ff;}})['catch'](function(_0x4d8d27){logger['error'](_0x0afc('0x50'),_0x4d8d27);throw _0x4d8d27;});}return _0x5d33ff;})[_0x0afc('0x23')](respondWithResult(_0xd81e4,0xc9))[_0x0afc('0x43')](handleError(_0xd81e4,null));};exports[_0x0afc('0x51')]=function(_0x58287f,_0x5b3eee){if(_0x58287f[_0x0afc('0x52')]['id']){delete _0x58287f[_0x0afc('0x52')]['id'];}return db[_0x0afc('0x40')][_0x0afc('0x48')]({'where':{'id':_0x58287f[_0x0afc('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b3eee,null))[_0x0afc('0x23')](saveUpdates(_0x58287f[_0x0afc('0x52')],null))[_0x0afc('0x23')](respondWithResult(_0x5b3eee,null))['catch'](handleError(_0x5b3eee,null));};exports['destroy']=function(_0x5dc196,_0x768c7a){return db[_0x0afc('0x40')]['find']({'where':{'id':_0x5dc196[_0x0afc('0x45')]['id']}})[_0x0afc('0x23')](handleEntityNotFound(_0x768c7a,null))['then'](removeEntity(_0x768c7a,null))[_0x0afc('0x43')](handleError(_0x768c7a,null));};exports[_0x0afc('0x2d')]=function(_0x55d380,_0x938ee2){return db[_0x0afc('0x40')][_0x0afc('0x2d')]()[_0x0afc('0x23')](respondWithResult(_0x938ee2,null))[_0x0afc('0x43')](handleError(_0x938ee2,null));};exports['addContacts']=function(_0x3eee11,_0xa0a52b,_0x3aaa2b){return db[_0x0afc('0x53')][_0x0afc('0x48')]({'where':{'id':_0x3eee11['params']['id']}})['then'](handleEntityNotFound(_0xa0a52b,null))[_0x0afc('0x23')](function(_0x469e5e){if(_0x469e5e){return _0x469e5e['addContacts'](_0x3eee11[_0x0afc('0x52')][_0x0afc('0x54')],_[_0x0afc('0x55')](_0x3eee11['body'],[_0x0afc('0x54'),'id'])||{});}})[_0x0afc('0x23')](respondWithResult(_0xa0a52b,null))[_0x0afc('0x43')](handleError(_0xa0a52b,null));};exports[_0x0afc('0x56')]=function(_0x29dc9d,_0x1a8d31,_0x2b7098){var _0x560c51={};var _0x23896f={};var _0x58e0c2;var _0x50e712;return db[_0x0afc('0x40')][_0x0afc('0x57')]({'where':{'id':_0x29dc9d[_0x0afc('0x45')]['id']}})[_0x0afc('0x23')](handleEntityNotFound(_0x1a8d31,null))[_0x0afc('0x23')](function(_0x240e94){if(_0x240e94){_0x58e0c2=_0x240e94;_0x23896f[_0x0afc('0x2e')]=_[_0x0afc('0x2f')](db['CmContact'][_0x0afc('0x46')]);_0x23896f[_0x0afc('0x30')]=_[_0x0afc('0x2f')](_0x29dc9d[_0x0afc('0x30')]);_0x23896f[_0x0afc('0x31')]=_[_0x0afc('0x32')](_0x23896f['model'],_0x23896f['query']);_0x560c51[_0x0afc('0x34')]=_[_0x0afc('0x32')](_0x23896f['model'],qs[_0x0afc('0x33')](_0x29dc9d[_0x0afc('0x30')][_0x0afc('0x33')]));_0x560c51['attributes']=_0x560c51['attributes'][_0x0afc('0x35')]?_0x560c51[_0x0afc('0x34')]:_0x23896f['model'];_0x560c51[_0x0afc('0x38')]=qs[_0x0afc('0x39')](_0x29dc9d[_0x0afc('0x30')][_0x0afc('0x39')]);_0x560c51[_0x0afc('0x3c')]=qs[_0x0afc('0x31')](_[_0x0afc('0x3a')](_0x29dc9d['query'],_0x23896f[_0x0afc('0x31')]));if(_0x29dc9d[_0x0afc('0x30')]['filter']){_0x560c51[_0x0afc('0x3c')]=_[_0x0afc('0x3d')](_0x560c51[_0x0afc('0x3c')],{'$or':_['map'](_0x560c51['attributes'],function(_0x1d6765){var _0x2fef0b={};_0x2fef0b[_0x1d6765]={'$like':'%'+_0x29dc9d[_0x0afc('0x30')][_0x0afc('0x3b')]+'%'};return _0x2fef0b;})});}_0x560c51=_['merge']({},_0x560c51,_0x29dc9d[_0x0afc('0x3f')]);return _0x58e0c2['getContacts'](_0x560c51);}})[_0x0afc('0x23')](function(_0x592b41){if(_0x592b41){_0x50e712=_0x592b41[_0x0afc('0x35')];if(!_0x29dc9d[_0x0afc('0x30')][_0x0afc('0x36')](_0x0afc('0x37'))){_0x560c51[_0x0afc('0x1e')]=qs[_0x0afc('0x1e')](_0x29dc9d[_0x0afc('0x30')][_0x0afc('0x1e')]);_0x560c51[_0x0afc('0x1d')]=qs[_0x0afc('0x1d')](_0x29dc9d[_0x0afc('0x30')][_0x0afc('0x1d')]);}return _0x58e0c2[_0x0afc('0x56')](_0x560c51);}})['then'](function(_0x19ee3b){if(_0x19ee3b){return _0x19ee3b?{'count':_0x50e712,'rows':_0x19ee3b}:null;}})[_0x0afc('0x23')](respondWithResult(_0x1a8d31,null))['catch'](handleError(_0x1a8d31,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d4f25d0..18a2814 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 _0x6658=['../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f4f8f,_0x4394ce){var _0x2b01a1=function(_0x4ee5e6){while(--_0x4ee5e6){_0x2f4f8f['push'](_0x2f4f8f['shift']());}};_0x2b01a1(++_0x4394ce);}(_0x6658,0x198));var _0x8665=function(_0x500888,_0x1e55b9){_0x500888=_0x500888-0x0;var _0x3a6ed8=_0x6658[_0x500888];return _0x3a6ed8;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa19=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0xcd17a2,_0x488a0e){var _0x486d30=function(_0x198a8c){while(--_0x198a8c){_0xcd17a2['push'](_0xcd17a2['shift']());}};_0x486d30(++_0x488a0e);}(_0xaa19,0x79));var _0x9aa1=function(_0x2acf03,_0x41ff9a){_0x2acf03=_0x2acf03-0x0;var _0x348f1d=_0xaa19[_0x2acf03];return _0x348f1d;};'use strict';var _=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var logger=require(_0x9aa1('0x2'))(_0x9aa1('0x3'));var moment=require('moment');var BPromise=require(_0x9aa1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aa1('0x5'));var rimraf=require('rimraf');var config=require(_0x9aa1('0x6'));var attributes=require(_0x9aa1('0x7'));module[_0x9aa1('0x8')]=function(_0x52124b,_0x1e59f8){return _0x52124b[_0x9aa1('0x9')](_0x9aa1('0xa'),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 c6cdce3..649f1fa 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 _0x962b=['code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4aba0e,_0x3cca89){var _0x240301=function(_0x376410){while(--_0x376410){_0x4aba0e['push'](_0x4aba0e['shift']());}};_0x240301(++_0x3cca89);}(_0x962b,0x130));var _0xb962=function(_0x15b1f8,_0x5a8037){_0x15b1f8=_0x15b1f8-0x0;var _0x1324bf=_0x962b[_0x15b1f8];return _0x1324bf;};'use strict';var _=require(_0xb962('0x0'));var util=require(_0xb962('0x1'));var moment=require(_0xb962('0x2'));var BPromise=require(_0xb962('0x3'));var rs=require(_0xb962('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb962('0x5'))['db'];var utils=require(_0xb962('0x6'));var logger=require(_0xb962('0x7'))('rpc');var config=require(_0xb962('0x8'));var jayson=require(_0xb962('0x9'));var client=jayson['client'][_0xb962('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e58eb,_0x29cba8,_0x387417){return new BPromise(function(_0x2b11b4,_0x448d3b){return client[_0xb962('0xb')](_0x4e58eb,_0x387417)[_0xb962('0xc')](function(_0x2f9cbf){logger[_0xb962('0xd')]('CmCompany,\x20%s,\x20%s',_0x29cba8,_0xb962('0xe'));logger['debug'](_0xb962('0xf'),_0x29cba8,_0xb962('0xe'),JSON[_0xb962('0x10')](_0x2f9cbf));if(_0x2f9cbf[_0xb962('0x11')]){if(_0x2f9cbf[_0xb962('0x11')][_0xb962('0x12')]===0x1f4){logger[_0xb962('0x11')](_0xb962('0x13'),_0x29cba8,_0x2f9cbf['error']['message']);return _0x448d3b(_0x2f9cbf[_0xb962('0x11')][_0xb962('0x14')]);}logger[_0xb962('0x11')](_0xb962('0x13'),_0x29cba8,_0x2f9cbf[_0xb962('0x11')][_0xb962('0x14')]);return _0x2b11b4(_0x2f9cbf[_0xb962('0x11')][_0xb962('0x14')]);}else{logger['info'](_0xb962('0x13'),_0x29cba8,_0xb962('0xe'));_0x2b11b4(_0x2f9cbf[_0xb962('0x15')][_0xb962('0x14')]);}})[_0xb962('0x16')](function(_0x260a56){logger[_0xb962('0x11')](_0xb962('0x13'),_0x29cba8,_0x260a56);_0x448d3b(_0x260a56);});});} \ No newline at end of file +var _0x3490=['client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5d5dcd,_0x2e7733){var _0xc3962e=function(_0x26d234){while(--_0x26d234){_0x5d5dcd['push'](_0x5d5dcd['shift']());}};_0xc3962e(++_0x2e7733);}(_0x3490,0x7f));var _0x0349=function(_0x4a24d8,_0x3c5d8e){_0x4a24d8=_0x4a24d8-0x0;var _0x15908b=_0x3490[_0x4a24d8];return _0x15908b;};'use strict';var _=require(_0x0349('0x0'));var util=require(_0x0349('0x1'));var moment=require(_0x0349('0x2'));var BPromise=require(_0x0349('0x3'));var rs=require(_0x0349('0x4'));var fs=require('fs');var Redis=require(_0x0349('0x5'));var db=require(_0x0349('0x6'))['db'];var utils=require(_0x0349('0x7'));var logger=require(_0x0349('0x8'))('rpc');var config=require(_0x0349('0x9'));var jayson=require(_0x0349('0xa'));var client=jayson[_0x0349('0xb')][_0x0349('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed1c5,_0x55c97a,_0x4bfce9){return new BPromise(function(_0xd5af6e,_0x4cf4a3){return client[_0x0349('0xd')](_0x2ed1c5,_0x4bfce9)['then'](function(_0x52d291){logger['info'](_0x0349('0xe'),_0x55c97a,_0x0349('0xf'));logger[_0x0349('0x10')](_0x0349('0x11'),_0x55c97a,_0x0349('0xf'),JSON[_0x0349('0x12')](_0x52d291));if(_0x52d291['error']){if(_0x52d291[_0x0349('0x13')][_0x0349('0x14')]===0x1f4){logger[_0x0349('0x13')]('CmCompany,\x20%s,\x20%s',_0x55c97a,_0x52d291['error']['message']);return _0x4cf4a3(_0x52d291[_0x0349('0x13')]['message']);}logger[_0x0349('0x13')](_0x0349('0xe'),_0x55c97a,_0x52d291[_0x0349('0x13')][_0x0349('0x15')]);return _0xd5af6e(_0x52d291[_0x0349('0x13')][_0x0349('0x15')]);}else{logger['info'](_0x0349('0xe'),_0x55c97a,_0x0349('0xf'));_0xd5af6e(_0x52d291['result']['message']);}})[_0x0349('0x16')](function(_0x3fdfdb){logger['error']('CmCompany,\x20%s,\x20%s',_0x55c97a,_0x3fdfdb);_0x4cf4a3(_0x3fdfdb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5c2e9cf..ba6417b 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 _0x4137=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xb61562,_0x1c8d99){var _0x4f73c0=function(_0x2445bd){while(--_0x2445bd){_0xb61562['push'](_0xb61562['shift']());}};_0x4f73c0(++_0x1c8d99);}(_0x4137,0xf8));var _0x7413=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4137[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var auth=require(_0x7413('0x6'));var interaction=require(_0x7413('0x7'));var config=require(_0x7413('0x8'));var controller=require(_0x7413('0x9'));router[_0x7413('0xa')]('/',auth[_0x7413('0xb')](),controller['index']);router[_0x7413('0xa')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0xd')]);router['get'](_0x7413('0xe'),auth[_0x7413('0xb')](),controller['show']);router[_0x7413('0xa')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth[_0x7413('0xb')](),controller[_0x7413('0x12')]);router[_0x7413('0x11')]('/:id/contacts',auth[_0x7413('0xb')](),controller[_0x7413('0x13')]);router['put'](_0x7413('0xe'),auth[_0x7413('0xb')](),controller[_0x7413('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7413('0x15')]);module[_0x7413('0x16')]=router; \ No newline at end of file +var _0x3d04=['/:id/contacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/:id','show','getContacts','create','post'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var auth=require(_0x43d0('0x6'));var interaction=require(_0x43d0('0x7'));var config=require('../../config/environment');var controller=require(_0x43d0('0x8'));router[_0x43d0('0x9')]('/',auth[_0x43d0('0xa')](),controller[_0x43d0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x43d0('0x9')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0xd')]);router[_0x43d0('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43d0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43d0('0xf')]);router[_0x43d0('0x10')](_0x43d0('0x11'),auth[_0x43d0('0xa')](),controller['addContacts']);router[_0x43d0('0x12')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x13')]);router[_0x43d0('0x14')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x15')]);module[_0x43d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index bc39866..29b5bbf 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 _0xa20f=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','NOW'];(function(_0x450c48,_0x15fd64){var _0x404a83=function(_0x3832fa){while(--_0x3832fa){_0x450c48['push'](_0x450c48['shift']());}};_0x404a83(++_0x15fd64);}(_0xa20f,0x1d0));var _0xfa20=function(_0x97ce14,_0x5635a6){_0x97ce14=_0x97ce14-0x0;var _0x30e873=_0xa20f[_0x97ce14];return _0x30e873;};'use strict';var _=require(_0xfa20('0x0'));var Sequelize=require(_0xfa20('0x1'));module[_0xfa20('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfa20('0x3')]},'postalCode':{'type':Sequelize[_0xfa20('0x3')]},'city':{'type':Sequelize[_0xfa20('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xfa20('0x3')]},'description':{'type':Sequelize[_0xfa20('0x4')]},'phone':{'type':Sequelize[_0xfa20('0x3')]},'mobile':{'type':Sequelize[_0xfa20('0x3')]},'fax':{'type':Sequelize[_0xfa20('0x3')]},'email':{'type':Sequelize[_0xfa20('0x3')]},'url':{'type':Sequelize[_0xfa20('0x3')]},'facebook':{'type':Sequelize[_0xfa20('0x3')]},'fb_data':{'type':Sequelize[_0xfa20('0x3')]},'twitter':{'type':Sequelize[_0xfa20('0x3')]},'skype':{'type':Sequelize[_0xfa20('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xfa20('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xfa20('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfa20('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xfa20('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xfa20('0x7')]}}; \ No newline at end of file +var _0xb9e4=['DATE','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x3fe548,_0x438f3){var _0x1c3135=function(_0x337f58){while(--_0x337f58){_0x3fe548['push'](_0x3fe548['shift']());}};_0x1c3135(++_0x438f3);}(_0xb9e4,0x1a9));var _0x4b9e=function(_0x619b92,_0x29910c){_0x619b92=_0x619b92-0x0;var _0x3fa1a3=_0xb9e4[_0x619b92];return _0x3fa1a3;};'use strict';var _=require(_0x4b9e('0x0'));var Sequelize=require(_0x4b9e('0x1'));module[_0x4b9e('0x2')]={'firstName':{'type':Sequelize[_0x4b9e('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4b9e('0x3')]},'street':{'type':Sequelize[_0x4b9e('0x3')]},'postalCode':{'type':Sequelize[_0x4b9e('0x3')]},'city':{'type':Sequelize[_0x4b9e('0x3')]},'country':{'type':Sequelize[_0x4b9e('0x3')]},'dateOfBirth':{'type':Sequelize[_0x4b9e('0x3')]},'description':{'type':Sequelize[_0x4b9e('0x4')]},'phone':{'type':Sequelize[_0x4b9e('0x3')]},'mobile':{'type':Sequelize[_0x4b9e('0x3')]},'fax':{'type':Sequelize[_0x4b9e('0x3')]},'email':{'type':Sequelize[_0x4b9e('0x3')]},'url':{'type':Sequelize[_0x4b9e('0x3')]},'facebook':{'type':Sequelize[_0x4b9e('0x3')]},'fb_data':{'type':Sequelize[_0x4b9e('0x3')]},'twitter':{'type':Sequelize[_0x4b9e('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x4b9e('0x3')]},'viber':{'type':Sequelize[_0x4b9e('0x3')]},'line':{'type':Sequelize[_0x4b9e('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x4b9e('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x4b9e('0x5')](0x2)[_0x4b9e('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4b9e('0x7')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 913ae15..255145b 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 _0xc36d=['ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','$and','cf_%d','pickBy','format','table','setFields','toParam','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','send','createReadStream','import','binding','No\x20phone\x20column\x20specified','socket_timestamp','../../components/import/cm/csv2','message','pid','exit','getJourney','chat','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','duration','note','userDisposition','userSecondDisposition','fullname','createdAt','findAndCountAll','startCase','Website','Account','closed','closedAt','secondDisposition','key','Owner','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','mail','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','slice','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','sendStatus','end','status','json','offset','set','Content-Range','update','then','destroy','error','stack','name','index','describe','keys','startsWith','cf_','push','CmCustomField','findOne','all','length','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','map','forEach','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','DATE','buildExpression','text','isNil','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','count','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','CmContact','params','catch','tags','columnName','displayName','findAll','alias','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create'];(function(_0x42e59e,_0x17ee8e){var _0x324759=function(_0x5bf504){while(--_0x5bf504){_0x42e59e['push'](_0x42e59e['shift']());}};_0x324759(++_0x17ee8e);}(_0xc36d,0x7d));var _0xdc36=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xc36d[_0x53cf8e];return _0x459197;};'use strict';var pdf=require(_0xdc36('0x0'));var emlformat=require(_0xdc36('0x1'));var rimraf=require(_0xdc36('0x2'));var zipdir=require(_0xdc36('0x3'));var jsonpatch=require(_0xdc36('0x4'));var rp=require(_0xdc36('0x5'));var moment=require('moment');var BPromise=require(_0xdc36('0x6'));var Mustache=require(_0xdc36('0x7'));var util=require('util');var path=require(_0xdc36('0x8'));var sox=require(_0xdc36('0x9'));var csv=require(_0xdc36('0xa'));var ejs=require(_0xdc36('0xb'));var fs=require('fs');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('0xa'));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'];config[_0xdc36('0x18')]=_[_0xdc36('0x19')](config[_0xdc36('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc36('0x1a'))(new Redis(config[_0xdc36('0x18')]));require(_0xdc36('0x1b'))[_0xdc36('0x1c')](socket);function respondWithStatusCode(_0x30803d,_0x25b900){_0x25b900=_0x25b900||0xcc;return function(_0x37ce9c){if(_0x37ce9c){return _0x30803d[_0xdc36('0x1d')](_0x25b900);}return _0x30803d['status'](_0x25b900)[_0xdc36('0x1e')]();};}function respondWithResult(_0x526ac8,_0x4baf2e){_0x4baf2e=_0x4baf2e||0xc8;return function(_0x59c88f){if(_0x59c88f){return _0x526ac8[_0xdc36('0x1f')](_0x4baf2e)[_0xdc36('0x20')](_0x59c88f);}};}function respondWithFilteredResult(_0x5a498f,_0xd38826){return function(_0x219a73){if(_0x219a73){var _0x160d70=_0x219a73['count'],_0x225878=_0xd38826[_0xdc36('0x21')],_0x183c91=_0xd38826[_0xdc36('0x21')]+_0xd38826['limit'],_0x46783d;if(_0x183c91>=_0x160d70){_0x183c91=_0x160d70;_0x46783d=0xc8;}else{_0x46783d=0xce;}_0x5a498f[_0xdc36('0x1f')](_0x46783d);return _0x5a498f[_0xdc36('0x22')](_0xdc36('0x23'),_0x225878+'-'+_0x183c91+'/'+_0x160d70)['json'](_0x219a73);}return null;};}function patchUpdates(_0x10aafb){return function(_0x235a39){try{jsonpatch['apply'](_0x235a39,_0x10aafb,!![]);}catch(_0x388b1a){return BPromise['reject'](_0x388b1a);}return _0x235a39['save']();};}function saveUpdates(_0x12f9d8,_0x2b39a2){return function(_0x42c0d7){if(_0x42c0d7){return _0x42c0d7[_0xdc36('0x24')](_0x12f9d8)[_0xdc36('0x25')](function(_0x34d261){return _0x34d261;});}return null;};}function removeEntity(_0x14b595,_0x3a8b34){return function(_0x57b9f7){if(_0x57b9f7){return _0x57b9f7[_0xdc36('0x26')]()['then'](function(){_0x14b595[_0xdc36('0x1f')](0xcc)[_0xdc36('0x1e')]();});}};}function handleEntityNotFound(_0x15e686,_0x5c785b){return function(_0xbc4322){if(!_0xbc4322){_0x15e686[_0xdc36('0x1d')](0x194);}return _0xbc4322;};}function handleError(_0x337091,_0x525935){_0x525935=_0x525935||0x1f4;return function(_0x28a005){logger[_0xdc36('0x27')](_0x28a005[_0xdc36('0x28')]);if(_0x28a005['name']){delete _0x28a005[_0xdc36('0x29')];}_0x337091[_0xdc36('0x1f')](_0x525935)['send'](_0x28a005);};}exports[_0xdc36('0x2a')]=function(_0x12fed2,_0x4ea2ad){var _0x21151b={},_0x5bba0b={},_0x49bbf2={'count':0x0,'rows':[]};return db['CmContact'][_0xdc36('0x2b')]()[_0xdc36('0x25')](function(_0x4f57aa){var _0x13bf82=[];for(var _0x983eab=0x0;_0x983eab0x1){_0x4d0acd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdc36('0x6e')](_0xb18ebf),null);}else{if(qs[_0xdc36('0x6f')](_0xb18ebf)){_0x4d0acd['or'](_0xdc36('0x70'),_0xb18ebf+'%');_0x4d0acd['or'](_0xdc36('0x71'),_0xb18ebf+'%');_0x4d0acd['or'](_0xdc36('0x72'),_0xb18ebf+'%');_0x4d0acd['or'](_0xdc36('0x73'),_0xb18ebf+'%');}else if(qs[_0xdc36('0x74')](_0xb18ebf)){_0x4d0acd['or'](_0xdc36('0x75'),_0xb18ebf+'%');}else{_0x4d0acd['or'](_0xdc36('0x76'),'%'+_0xb18ebf+'%');_0x4d0acd['or'](_0xdc36('0x77'),'%'+_0xb18ebf+'%');_0x4d0acd['or']('c.email\x20LIKE\x20?','%'+_0xb18ebf+'%');}}}}_0x3cb2ed[_0xdc36('0x4e')](_0x4d0acd);_0x3cb2ed['group'](_0xdc36('0x78'));var _0x38fc44={'type':db[_0xdc36('0x79')][_0xdc36('0x7a')][_0xdc36('0x7b')],'raw':!![]};var _0x1e70e9=_0x3cb2ed[_0xdc36('0x7c')]()[_0xdc36('0x43')](_0xdc36('0x78'));if(_0x21151b[_0xdc36('0x3f')]){_0x21151b[_0xdc36('0x3f')][_0xdc36('0x59')](function(_0x21be1c){_0x3cb2ed[_0xdc36('0x3f')]('c.'+_0x21be1c[0x0],_0x21be1c[0x1]===_0xdc36('0x7d')?![]:!![]);});}if(!_[_0xdc36('0x65')](_0x11b4ee)){_0x3cb2ed[_0xdc36('0x7e')](_0x22c8de);_0x1e70e9[_0xdc36('0x4e')](_0xdc36('0x7f'),_0x11b4ee);}BPromise[_0xdc36('0x80')]()['then'](function(){if(!_0x133a99)return;if(_0x12fed2[_0xdc36('0x81')][_0xdc36('0x82')]!==_0xdc36('0x83'))return;if(!_[_0xdc36('0x84')](_0x133a99[_0xdc36('0x53')],[_0xdc36('0x43'),'User'])){return _0x12fed2[_0xdc36('0x81')][_0xdc36('0x85')]({'attributes':['id'],'raw':!![]})['then'](function(_0x548a99){if(_[_0xdc36('0x65')](_0x548a99)){_0x1e70e9[_0xdc36('0x4e')](_0xdc36('0x86'));_0x3cb2ed['where']('c.ListId\x20IS\x20NULL');}else{_0x1e70e9[_0xdc36('0x4e')](_0xdc36('0x87'),_['map'](_0x548a99,'id'));_0x3cb2ed['where'](_0xdc36('0x87'),_[_0xdc36('0x58')](_0x548a99,'id'));}});}})[_0xdc36('0x25')](function(){if(_0x12fed2[_0xdc36('0x81')][_0xdc36('0x82')]===_0xdc36('0x83')&&!_0x133a99&&!_0x12fed2[_0xdc36('0x37')][_0xdc36('0x66')])return[];return db['sequelize'][_0xdc36('0x37')](_0x1e70e9['toString'](),_0x38fc44);})['then'](function(_0x5a3c01){_0x49bbf2[_0xdc36('0x88')]=_0x5a3c01[_0xdc36('0x33')];if(_0x49bbf2[_0xdc36('0x88')]===0x0)return[];return db[_0xdc36('0x89')]['query'](_0x2cefcf[_0xdc36('0x8a')](),_0x38fc44)[_0xdc36('0x25')](function(_0x3c8aac){_0x51a43a=_[_0xdc36('0x8b')](_0x3c8aac,'id');_0x38fc44=_[_0xdc36('0x8c')](_0x38fc44,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12fed2['query']['fields']){_0x21151b['attributes'][_0xdc36('0x59')](function(_0x398272){_0x3cb2ed[_0xdc36('0x43')]('c.'+_0x398272);});}else{_0x3cb2ed[_0xdc36('0x43')](_0xdc36('0x78'));_0x3cb2ed[_0xdc36('0x43')](_0xdc36('0x8d'));_0x3cb2ed[_0xdc36('0x43')](_0xdc36('0x8e'));_0x3cb2ed['field'](_0xdc36('0x8f'));_0x3cb2ed[_0xdc36('0x43')]('c.mobile');_0x3cb2ed['field'](_0xdc36('0x90'));_0x3cb2ed['field'](_0xdc36('0x91'));_0x3cb2ed['field'](_0xdc36('0x92'));_0x3cb2ed[_0xdc36('0x43')](_0xdc36('0x93'));_0x3cb2ed['field']('c.deletedAt');_0x3cb2ed['field'](_0xdc36('0x94'));_0x3cb2ed[_0xdc36('0x43')](_0xdc36('0x95'),_0xdc36('0x96'));}if(_0x21151b[_0xdc36('0x3e')])_0x3cb2ed['limit'](_0x21151b[_0xdc36('0x3e')]);if(_0x21151b[_0xdc36('0x21')])_0x3cb2ed[_0xdc36('0x21')](_0x21151b['offset']);return db['sequelize'][_0xdc36('0x37')](_0x3cb2ed[_0xdc36('0x8a')](),_0x38fc44);});})[_0xdc36('0x25')](function(_0x3103e5){_0x3103e5[_0xdc36('0x59')](function(_0x2f3946){if(_0x2f3946[_0xdc36('0x96')]){_0x2f3946[_0xdc36('0x97')]=[];_0x2f3946[_0xdc36('0x96')][_0xdc36('0x57')](',')['forEach'](function(_0x5cb238){_0x2f3946['Tags']['push'](_0x51a43a[_0x5cb238]);});}delete _0x2f3946[_0xdc36('0x96')];});_0x49bbf2[_0xdc36('0x98')]=_0x3103e5;return _0x49bbf2;})[_0xdc36('0x25')](respondWithFilteredResult(_0x4ea2ad,_0x21151b));})['catch'](handleError(_0x4ea2ad,null));};exports[_0xdc36('0x26')]=function(_0xd674b9,_0x26b38e){return db[_0xdc36('0x99')]['find']({'where':{'id':_0xd674b9[_0xdc36('0x9a')]['id']}})[_0xdc36('0x25')](handleEntityNotFound(_0x26b38e,null))[_0xdc36('0x25')](removeEntity(_0x26b38e,null))[_0xdc36('0x9b')](handleError(_0x26b38e,null));};exports[_0xdc36('0x2b')]=function(_0xae33f3,_0x1d9196){return db[_0xdc36('0x99')][_0xdc36('0x2b')]()[_0xdc36('0x25')](function(_0x1097e0){delete _0x1097e0[_0xdc36('0x9c')];for(var _0x4b244a=0x0;_0x4b244a=_0x2d8f2d){_0xc415e7=_0x2d8f2d;_0x11704f=0xc8;}else{_0x11704f=0xce;}_0x4521b6[_0x6401('0x19')](_0x11704f);return _0x4521b6['set'](_0x6401('0x1e'),_0x50eda7+'-'+_0xc415e7+'/'+_0x2d8f2d)[_0x6401('0x1a')](_0x55ca87);}return null;};}function patchUpdates(_0x3fc8af){return function(_0x1757ab){try{jsonpatch['apply'](_0x1757ab,_0x3fc8af,!![]);}catch(_0x27ec8a){return BPromise[_0x6401('0x1f')](_0x27ec8a);}return _0x1757ab['save']();};}function saveUpdates(_0x20b445,_0x9481fb){return function(_0x569b7d){if(_0x569b7d){return _0x569b7d[_0x6401('0x20')](_0x20b445)[_0x6401('0x21')](function(_0x39bca3){return _0x39bca3;});}return null;};}function removeEntity(_0xed5d29,_0x46ef77){return function(_0x18592b){if(_0x18592b){return _0x18592b['destroy']()['then'](function(){_0xed5d29['status'](0xcc)[_0x6401('0x18')]();});}};}function handleEntityNotFound(_0x12f19a,_0x409d11){return function(_0x4e6d9f){if(!_0x4e6d9f){_0x12f19a[_0x6401('0x17')](0x194);}return _0x4e6d9f;};}function handleError(_0x102f69,_0x2392b9){_0x2392b9=_0x2392b9||0x1f4;return function(_0x682c6f){logger['error'](_0x682c6f['stack']);if(_0x682c6f[_0x6401('0x22')]){delete _0x682c6f[_0x6401('0x22')];}_0x102f69[_0x6401('0x19')](_0x2392b9)[_0x6401('0x23')](_0x682c6f);};}exports['index']=function(_0x7f6e88,_0x43e089){var _0x13a1ea={},_0x3f4964={},_0x1d6ffb={'count':0x0,'rows':[]};return db[_0x6401('0x24')][_0x6401('0x25')]()[_0x6401('0x21')](function(_0x4eb4f1){var _0x1a2dcb=[];for(var _0x2f0de6=0x0;_0x2f0de60x1){_0x47643f['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6401('0x61')](_0x1c075c),null);}else{if(qs['isNumeric'](_0x1c075c)){_0x47643f['or']('c.id\x20LIKE\x20?',_0x1c075c+'%');_0x47643f['or'](_0x6401('0x62'),_0x1c075c+'%');_0x47643f['or'](_0x6401('0x63'),_0x1c075c+'%');_0x47643f['or'](_0x6401('0x64'),_0x1c075c+'%');}else if(qs[_0x6401('0x65')](_0x1c075c)){_0x47643f['or'](_0x6401('0x66'),_0x1c075c+'%');}else{_0x47643f['or'](_0x6401('0x67'),'%'+_0x1c075c+'%');_0x47643f['or'](_0x6401('0x68'),'%'+_0x1c075c+'%');_0x47643f['or']('c.email\x20LIKE\x20?','%'+_0x1c075c+'%');}}}}_0x531f26[_0x6401('0x34')](_0x47643f);_0x531f26[_0x6401('0x69')](_0x6401('0x6a'));var _0x51c0aa={'type':db[_0x6401('0x6b')][_0x6401('0x6c')][_0x6401('0x6d')],'raw':!![]};var _0xedeb3c=_0x531f26[_0x6401('0x6e')]()[_0x6401('0x38')]('c.id');if(_0x13a1ea['order']){_0x13a1ea[_0x6401('0x6f')][_0x6401('0x4c')](function(_0x2272ce){_0x531f26[_0x6401('0x6f')]('c.'+_0x2272ce[0x0],_0x2272ce[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6401('0x5a')](_0x169a86)){_0x531f26['having'](_0x246577);_0xedeb3c['where']('t.id\x20IN\x20?',_0x169a86);}BPromise[_0x6401('0x70')]()['then'](function(){if(!_0x270506)return;if(_0x7f6e88[_0x6401('0x71')][_0x6401('0x72')]!==_0x6401('0x73'))return;if(!_[_0x6401('0x74')](_0x270506['conditions'],[_0x6401('0x38'),'User'])){return _0x7f6e88[_0x6401('0x71')][_0x6401('0x75')]({'attributes':['id'],'raw':!![]})[_0x6401('0x21')](function(_0x39cd98){if(_['isEmpty'](_0x39cd98)){_0xedeb3c[_0x6401('0x34')](_0x6401('0x76'));_0x531f26[_0x6401('0x34')]('c.ListId\x20IS\x20NULL');}else{_0xedeb3c['where'](_0x6401('0x77'),_['map'](_0x39cd98,'id'));_0x531f26[_0x6401('0x34')](_0x6401('0x77'),_[_0x6401('0x4b')](_0x39cd98,'id'));}});}})[_0x6401('0x21')](function(){if(_0x7f6e88[_0x6401('0x71')]['role']===_0x6401('0x73')&&!_0x270506&&!_0x7f6e88['query'][_0x6401('0x78')])return[];return db[_0x6401('0x79')][_0x6401('0x2e')](_0xedeb3c['toString'](),_0x51c0aa);})[_0x6401('0x21')](function(_0x1f1c12){_0x1d6ffb[_0x6401('0x1b')]=_0x1f1c12[_0x6401('0x27')];if(_0x1d6ffb[_0x6401('0x1b')]===0x0)return[];return db[_0x6401('0x79')][_0x6401('0x2e')](_0x34f166[_0x6401('0x7a')](),_0x51c0aa)['then'](function(_0x505682){_0x25d8aa=_['keyBy'](_0x505682,'id');_0x51c0aa=_[_0x6401('0x7b')](_0x51c0aa,{'model':db[_0x6401('0x24')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7f6e88[_0x6401('0x2e')][_0x6401('0x31')]){_0x13a1ea[_0x6401('0x30')][_0x6401('0x4c')](function(_0x17131c){_0x531f26[_0x6401('0x38')]('c.'+_0x17131c);});}else{_0x531f26['field'](_0x6401('0x6a'));_0x531f26['field']('c.firstName');_0x531f26['field'](_0x6401('0x7c'));_0x531f26[_0x6401('0x38')](_0x6401('0x7d'));_0x531f26['field'](_0x6401('0x7e'));_0x531f26[_0x6401('0x38')](_0x6401('0x7f'));_0x531f26[_0x6401('0x38')](_0x6401('0x80'));_0x531f26[_0x6401('0x38')](_0x6401('0x81'));_0x531f26[_0x6401('0x38')](_0x6401('0x82'));_0x531f26[_0x6401('0x38')](_0x6401('0x83'));_0x531f26[_0x6401('0x38')]('c.CompanyId');_0x531f26[_0x6401('0x38')](_0x6401('0x84'),_0x6401('0x85'));}if(_0x13a1ea[_0x6401('0x1d')])_0x531f26['limit'](_0x13a1ea[_0x6401('0x1d')]);if(_0x13a1ea['offset'])_0x531f26[_0x6401('0x1c')](_0x13a1ea[_0x6401('0x1c')]);return db['sequelize'][_0x6401('0x2e')](_0x531f26[_0x6401('0x7a')](),_0x51c0aa);});})[_0x6401('0x21')](function(_0x5b5815){_0x5b5815['forEach'](function(_0x4f4f3d){if(_0x4f4f3d[_0x6401('0x85')]){_0x4f4f3d[_0x6401('0x86')]=[];_0x4f4f3d[_0x6401('0x85')][_0x6401('0x4a')](',')['forEach'](function(_0xa081f7){_0x4f4f3d['Tags'][_0x6401('0x59')](_0x25d8aa[_0xa081f7]);});}delete _0x4f4f3d[_0x6401('0x85')];});_0x1d6ffb[_0x6401('0x87')]=_0x5b5815;return _0x1d6ffb;})[_0x6401('0x21')](respondWithFilteredResult(_0x43e089,_0x13a1ea));})[_0x6401('0x88')](handleError(_0x43e089,null));};exports[_0x6401('0x89')]=function(_0x36468d,_0x29a4b1){return db[_0x6401('0x24')][_0x6401('0x47')]({'where':{'id':_0x36468d[_0x6401('0x8a')]['id']}})[_0x6401('0x21')](handleEntityNotFound(_0x29a4b1,null))[_0x6401('0x21')](removeEntity(_0x29a4b1,null))[_0x6401('0x88')](handleError(_0x29a4b1,null));};exports[_0x6401('0x25')]=function(_0x297258,_0xf2a821){return db[_0x6401('0x24')][_0x6401('0x25')]()[_0x6401('0x21')](function(_0x6ef616){delete _0x6ef616['tags'];for(var _0x19a775=0x0;_0x19a775{}\s\\|]/g,'-');_0x41ef72(null,util[_0x7254('0x24')](_0x7254('0x25'),path[_0x7254('0x26')](_0xc617b6[_0x7254('0x22')],path['extname'](_0xc617b6['originalname'])),Date[_0x7254('0x27')](),path[_0x7254('0x28')](_0xc617b6[_0x7254('0x22')])));}})});router[_0x7254('0x17')](_0x7254('0x29'),upload[_0x7254('0x2a')](_0x7254('0x2b')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x7254('0x1e')]({'destination':function(_0x21a579,_0x2b4f46,_0x494cdb){_0x494cdb(null,path[_0x7254('0x1f')](config['root'],_0x7254('0x21')));},'filename':function(_0x134a9e,_0x5702fe,_0x17bb46){_0x5702fe[_0x7254('0x22')]=_0x5702fe['originalname'][_0x7254('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17bb46(null,util[_0x7254('0x24')](_0x7254('0x25'),path[_0x7254('0x26')](_0x5702fe[_0x7254('0x22')],path[_0x7254('0x28')](_0x5702fe['originalname'])),Date[_0x7254('0x27')](),path[_0x7254('0x28')](_0x5702fe['originalname'])));}})});router[_0x7254('0x17')](_0x7254('0x2c'),upload[_0x7254('0x2a')]('file'),controller[_0x7254('0x2d')]);router[_0x7254('0x17')](_0x7254('0x2e'),auth[_0x7254('0x9')](),controller[_0x7254('0x2f')]);router[_0x7254('0x30')](_0x7254('0x31'),auth['isAuthenticated'](),controller[_0x7254('0x32')]);router['delete']('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0x33')]);module[_0x7254('0x34')]=router; \ No newline at end of file +var _0x4fc2=['server/files/tmp','originalname','replace','format','%s-%s%s','now','extname','/csv','single','file','uploadCsv','basename','/upload','upload','/upload/:id','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','index','isAuthenticated','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','/merge','merge','post','create','bulkCreate','setTags','diskStorage','join','root'];(function(_0x1d9f53,_0x169bc4){var _0x1877e3=function(_0xe90b4){while(--_0xe90b4){_0x1d9f53['push'](_0x1d9f53['shift']());}};_0x1877e3(++_0x169bc4);}(_0x4fc2,0x111));var _0x24fc=function(_0x41d2d4,_0x12bcf4){_0x41d2d4=_0x41d2d4-0x0;var _0x225e0f=_0x4fc2[_0x41d2d4];return _0x225e0f;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/describe',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x8')](_0x24fc('0x10'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x8')]('/:id/hopper_histories',auth[_0x24fc('0xa')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x8')](_0x24fc('0x15'),auth[_0x24fc('0xa')](),controller['getJscriptySessions']);router[_0x24fc('0x8')](_0x24fc('0x16'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);router['post'](_0x24fc('0x18'),auth['isAuthenticated'](),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x1b')]);router[_0x24fc('0x1a')]('/create_many',auth[_0x24fc('0xa')](),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1a')](_0x24fc('0xe'),auth['isAuthenticated'](),controller[_0x24fc('0x1d')]);var upload=multer({'storage':multer[_0x24fc('0x1e')]({'destination':function(_0x304881,_0x5b0516,_0x32a57d){_0x32a57d(null,path[_0x24fc('0x1f')](config[_0x24fc('0x20')],_0x24fc('0x21')));},'filename':function(_0x49a0ba,_0x323beb,_0x545939){_0x323beb[_0x24fc('0x22')]=_0x323beb['originalname'][_0x24fc('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x545939(null,util[_0x24fc('0x24')](_0x24fc('0x25'),path['basename'](_0x323beb[_0x24fc('0x22')],path['extname'](_0x323beb[_0x24fc('0x22')])),Date[_0x24fc('0x26')](),path[_0x24fc('0x27')](_0x323beb[_0x24fc('0x22')])));}})});router[_0x24fc('0x1a')](_0x24fc('0x28'),upload[_0x24fc('0x29')](_0x24fc('0x2a')),controller[_0x24fc('0x2b')]);var upload=multer({'storage':multer[_0x24fc('0x1e')]({'destination':function(_0x568441,_0x11c913,_0x16f27f){_0x16f27f(null,path[_0x24fc('0x1f')](config['root'],_0x24fc('0x21')));},'filename':function(_0x3d1ec8,_0x35f9f9,_0x290f84){_0x35f9f9[_0x24fc('0x22')]=_0x35f9f9[_0x24fc('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x290f84(null,util[_0x24fc('0x24')](_0x24fc('0x25'),path[_0x24fc('0x2c')](_0x35f9f9[_0x24fc('0x22')],path[_0x24fc('0x27')](_0x35f9f9['originalname'])),Date['now'](),path['extname'](_0x35f9f9[_0x24fc('0x22')])));}})});router['post'](_0x24fc('0x2d'),upload[_0x24fc('0x29')](_0x24fc('0x2a')),controller[_0x24fc('0x2e')]);router['post'](_0x24fc('0x2f'),auth[_0x24fc('0xa')](),controller['import']);router[_0x24fc('0x30')](_0x24fc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x24fc('0x31')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0x32')]);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 530834c..a7e807f 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 _0x919e=['select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','STRING','setDataValue','alias','getDataValue','name','long'];(function(_0x49896f,_0x17f07a){var _0x1b6002=function(_0x14979c){while(--_0x14979c){_0x49896f['push'](_0x49896f['shift']());}};_0x1b6002(++_0x17f07a);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe919('0x0'));var _=require(_0xe919('0x1'));module[_0xe919('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x115b01){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xe919('0x3')],'allowNull':![],'set':function(_0x3a1192){this[_0xe919('0x4')](_0xe919('0x5'),_0x3a1192?_0x3a1192:this[_0xe919('0x6')](_0xe919('0x7')));}},'type':{'type':Sequelize[_0xe919('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xe919('0x8')),'get':function(){if(this[_0xe919('0x6')]('type')===_0xe919('0x9')){return JSON['parse'](this[_0xe919('0x6')](_0xe919('0xa')));}else{return this[_0xe919('0x6')]('values');}},'set':function(_0x83759d){if(Array[_0xe919('0xb')](_0x83759d)){this[_0xe919('0x4')]('values',JSON[_0xe919('0xc')](_0x83759d));}else{this['setDataValue']('values',_0x83759d);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe919('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe919('0xe')](_0xe919('0xf'))}}; \ No newline at end of file +var _0x2a3a=['isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','long','type','values'];(function(_0x45e4ca,_0x592162){var _0x398076=function(_0x3247f9){while(--_0x3247f9){_0x45e4ca['push'](_0x45e4ca['shift']());}};_0x398076(++_0x592162);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x400dc8,_0x3bc804){_0x400dc8=_0x400dc8-0x0;var _0x46b45d=_0x2a3a[_0x400dc8];return _0x46b45d;};'use strict';var Sequelize=require(_0xa2a3('0x0'));var _=require(_0xa2a3('0x1'));module[_0xa2a3('0x2')]={'name':{'type':Sequelize[_0xa2a3('0x3')],'get':function(_0x45ba85){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xa2a3('0x4')],'allowNull':![],'set':function(_0x34d7f9){this[_0xa2a3('0x5')](_0xa2a3('0x6'),_0x34d7f9?_0x34d7f9:this[_0xa2a3('0x7')](_0xa2a3('0x8')));}},'type':{'type':Sequelize[_0xa2a3('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xa2a3('0x9')),'get':function(){if(this[_0xa2a3('0x7')](_0xa2a3('0xa'))==='select'){return JSON['parse'](this['getDataValue'](_0xa2a3('0xb')));}else{return this[_0xa2a3('0x7')](_0xa2a3('0xb'));}},'set':function(_0x4a8291){if(Array[_0xa2a3('0xc')](_0x4a8291)){this[_0xa2a3('0x5')](_0xa2a3('0xb'),JSON[_0xa2a3('0xd')](_0x4a8291));}else{this[_0xa2a3('0x5')]('values',_0x4a8291);}}},'required':{'type':Sequelize[_0xa2a3('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa2a3('0xf')](_0xa2a3('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 25f88d2..2b3e299 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 _0x1cf6=['rows','catch','params','rawAttributes','fields','length','includeAll','include','options','body','find','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','addColumn','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','count','offset','limit','Content-Range','json','reject','update','status','end','error','stack','name','index','CmCustomField','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','findAll'];(function(_0x115e0c,_0x1b93cf){var _0x16ef20=function(_0x1ca390){while(--_0x1ca390){_0x115e0c['push'](_0x115e0c['shift']());}};_0x16ef20(++_0x1b93cf);}(_0x1cf6,0x1ba));var _0x61cf=function(_0x2c7aa3,_0x17dd68){_0x2c7aa3=_0x2c7aa3-0x0;var _0x1992cb=_0x1cf6[_0x2c7aa3];return _0x1992cb;};'use strict';var pdf=require(_0x61cf('0x0'));var emlformat=require(_0x61cf('0x1'));var rimraf=require(_0x61cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61cf('0x3'));var rp=require(_0x61cf('0x4'));var moment=require(_0x61cf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x61cf('0x6'));var path=require(_0x61cf('0x7'));var sox=require(_0x61cf('0x8'));var csv=require('to-csv');var ejs=require(_0x61cf('0x9'));var fs=require('fs');var _=require(_0x61cf('0xa'));var squel=require(_0x61cf('0xb'));var crypto=require('crypto');var jsforce=require(_0x61cf('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x61cf('0xd'));var Papa=require(_0x61cf('0xe'));var Redis=require(_0x61cf('0xf'));var authService=require(_0x61cf('0x10'));var qs=require(_0x61cf('0x11'));var as=require(_0x61cf('0x12'));var hardwareService=require(_0x61cf('0x13'));var logger=require(_0x61cf('0x14'))(_0x61cf('0x15'));var utils=require(_0x61cf('0x16'));var config=require(_0x61cf('0x17'));var licenseUtil=require(_0x61cf('0x18'));var db=require(_0x61cf('0x19'))['db'];function respondWithStatusCode(_0x556a9b,_0x1cac2b){_0x1cac2b=_0x1cac2b||0xcc;return function(_0x125520){if(_0x125520){return _0x556a9b[_0x61cf('0x1a')](_0x1cac2b);}return _0x556a9b['status'](_0x1cac2b)['end']();};}function respondWithResult(_0x59fae4,_0x429e1b){_0x429e1b=_0x429e1b||0xc8;return function(_0x256c48){if(_0x256c48){return _0x59fae4['status'](_0x429e1b)['json'](_0x256c48);}};}function respondWithFilteredResult(_0x27c484,_0x1a8ef2){return function(_0x56c2bd){if(_0x56c2bd){var _0x52803d=_0x56c2bd[_0x61cf('0x1b')],_0x7ee510=_0x1a8ef2['offset'],_0x1ab56f=_0x1a8ef2[_0x61cf('0x1c')]+_0x1a8ef2[_0x61cf('0x1d')],_0x489716;if(_0x1ab56f>=_0x52803d){_0x1ab56f=_0x52803d;_0x489716=0xc8;}else{_0x489716=0xce;}_0x27c484['status'](_0x489716);return _0x27c484['set'](_0x61cf('0x1e'),_0x7ee510+'-'+_0x1ab56f+'/'+_0x52803d)[_0x61cf('0x1f')](_0x56c2bd);}return null;};}function patchUpdates(_0x3e1855){return function(_0x135e94){try{jsonpatch['apply'](_0x135e94,_0x3e1855,!![]);}catch(_0x33cfe5){return BPromise[_0x61cf('0x20')](_0x33cfe5);}return _0x135e94['save']();};}function saveUpdates(_0x24ce9c,_0x411bc1){return function(_0xc97c47){if(_0xc97c47){return _0xc97c47[_0x61cf('0x21')](_0x24ce9c)['then'](function(_0x147ac4){return _0x147ac4;});}return null;};}function removeEntity(_0x5ca862,_0x524bf6){return function(_0xfe3412){if(_0xfe3412){return _0xfe3412['destroy']()['then'](function(){_0x5ca862[_0x61cf('0x22')](0xcc)[_0x61cf('0x23')]();});}};}function handleEntityNotFound(_0x2a7651,_0x463f21){return function(_0x2f5228){if(!_0x2f5228){_0x2a7651[_0x61cf('0x1a')](0x194);}return _0x2f5228;};}function handleError(_0x381395,_0x42dcb6){_0x42dcb6=_0x42dcb6||0x1f4;return function(_0x461bd3){logger[_0x61cf('0x24')](_0x461bd3[_0x61cf('0x25')]);if(_0x461bd3[_0x61cf('0x26')]){delete _0x461bd3[_0x61cf('0x26')];}_0x381395[_0x61cf('0x22')](_0x42dcb6)['send'](_0x461bd3);};}exports[_0x61cf('0x27')]=function(_0xf7ae7c,_0x33f147){var _0x3a9a9d={},_0x199f1e={},_0x98219d={'count':0x0,'rows':[]};var _0x17df19=_['map'](db[_0x61cf('0x28')]['rawAttributes'],function(_0x352d0c){return{'name':_0x352d0c[_0x61cf('0x29')],'type':_0x352d0c[_0x61cf('0x2a')][_0x61cf('0x2b')]};});_0x199f1e['model']=_['differenceBy'](_[_0x61cf('0x2c')](_0x17df19,_0x61cf('0x26')),[_0x61cf('0x26')]);_0x199f1e['query']=_[_0x61cf('0x2d')](_0xf7ae7c[_0x61cf('0x2e')]);_0x199f1e[_0x61cf('0x2f')]=_[_0x61cf('0x30')](_0x199f1e['model'],_0x199f1e[_0x61cf('0x2e')]);_0x3a9a9d[_0x61cf('0x31')]=_[_0x61cf('0x30')](_0x199f1e[_0x61cf('0x32')],qs['fields'](_0xf7ae7c['query']['fields']));_0x3a9a9d[_0x61cf('0x31')]=_0x3a9a9d[_0x61cf('0x31')]['length']?_0x3a9a9d[_0x61cf('0x31')]:_0x199f1e[_0x61cf('0x32')];if(!_0xf7ae7c['query'][_0x61cf('0x33')](_0x61cf('0x34'))){_0x3a9a9d[_0x61cf('0x1d')]=qs['limit'](_0xf7ae7c[_0x61cf('0x2e')]['limit']);_0x3a9a9d[_0x61cf('0x1c')]=qs[_0x61cf('0x1c')](_0xf7ae7c[_0x61cf('0x2e')][_0x61cf('0x1c')]);}_0x3a9a9d[_0x61cf('0x35')]=qs[_0x61cf('0x36')](_0xf7ae7c[_0x61cf('0x2e')]['sort']);_0x3a9a9d[_0x61cf('0x37')]=qs[_0x61cf('0x2f')](_[_0x61cf('0x38')](_0xf7ae7c['query'],_0x199f1e[_0x61cf('0x2f')]),_0x17df19);if(_0xf7ae7c[_0x61cf('0x2e')][_0x61cf('0x39')]){_0x3a9a9d['where']=_[_0x61cf('0x3a')](_0x3a9a9d[_0x61cf('0x37')],{'$or':_['map'](_0x17df19,function(_0x1308ff){if(_0x1308ff[_0x61cf('0x2a')]!==_0x61cf('0x3b')){var _0x30c4a2={};_0x30c4a2[_0x1308ff[_0x61cf('0x26')]]={'$like':'%'+_0xf7ae7c[_0x61cf('0x2e')][_0x61cf('0x39')]+'%'};return _0x30c4a2;}})});}_0x3a9a9d=_[_0x61cf('0x3a')]({},_0x3a9a9d,_0xf7ae7c['options']);var _0x2d29d7={'where':_0x3a9a9d[_0x61cf('0x37')]};return db[_0x61cf('0x28')][_0x61cf('0x1b')](_0x2d29d7)[_0x61cf('0x3c')](function(_0x3e4a3e){_0x98219d[_0x61cf('0x1b')]=_0x3e4a3e;if(_0xf7ae7c[_0x61cf('0x2e')]['includeAll']){_0x3a9a9d['include']=[{'all':!![]}];}return db[_0x61cf('0x28')][_0x61cf('0x3d')](_0x3a9a9d);})[_0x61cf('0x3c')](function(_0x311da2){_0x98219d[_0x61cf('0x3e')]=_0x311da2;return _0x98219d;})[_0x61cf('0x3c')](respondWithFilteredResult(_0x33f147,_0x3a9a9d))[_0x61cf('0x3f')](handleError(_0x33f147,null));};exports['show']=function(_0x1362bb,_0x16d8b0){var _0x3fb5e7={'raw':!![],'where':{'id':_0x1362bb[_0x61cf('0x40')]['id']}},_0x4bd1d4={};_0x4bd1d4[_0x61cf('0x32')]=_[_0x61cf('0x2d')](db[_0x61cf('0x28')][_0x61cf('0x41')]);_0x4bd1d4['query']=_[_0x61cf('0x2d')](_0x1362bb['query']);_0x4bd1d4[_0x61cf('0x2f')]=_[_0x61cf('0x30')](_0x4bd1d4[_0x61cf('0x32')],_0x4bd1d4[_0x61cf('0x2e')]);_0x3fb5e7[_0x61cf('0x31')]=_['intersection'](_0x4bd1d4[_0x61cf('0x32')],qs['fields'](_0x1362bb[_0x61cf('0x2e')][_0x61cf('0x42')]));_0x3fb5e7['attributes']=_0x3fb5e7[_0x61cf('0x31')][_0x61cf('0x43')]?_0x3fb5e7[_0x61cf('0x31')]:_0x4bd1d4['model'];if(_0x1362bb['query'][_0x61cf('0x44')]){_0x3fb5e7[_0x61cf('0x45')]=[{'all':!![]}];}_0x3fb5e7=_[_0x61cf('0x3a')]({},_0x3fb5e7,_0x1362bb[_0x61cf('0x46')]);return db[_0x61cf('0x28')]['find'](_0x3fb5e7)[_0x61cf('0x3c')](handleEntityNotFound(_0x16d8b0,null))[_0x61cf('0x3c')](respondWithResult(_0x16d8b0,null))[_0x61cf('0x3f')](handleError(_0x16d8b0,null));};exports[_0x61cf('0x21')]=function(_0x4a002a,_0x9b2694){if(_0x4a002a[_0x61cf('0x47')]['id']){delete _0x4a002a[_0x61cf('0x47')]['id'];}return db[_0x61cf('0x28')][_0x61cf('0x48')]({'where':{'id':_0x4a002a[_0x61cf('0x40')]['id']}})['then'](handleEntityNotFound(_0x9b2694,null))[_0x61cf('0x3c')](saveUpdates(_0x4a002a['body'],null))[_0x61cf('0x3c')](respondWithResult(_0x9b2694,null))['catch'](handleError(_0x9b2694,null));};exports[_0x61cf('0x49')]=function(_0x3702df,_0x550510){return db['CmCustomField']['find']({'where':{'id':_0x3702df[_0x61cf('0x40')]['id']}})[_0x61cf('0x3c')](handleEntityNotFound(_0x550510,null))[_0x61cf('0x3c')](removeEntity(_0x550510,null))[_0x61cf('0x3f')](handleError(_0x550510,null));};exports[_0x61cf('0x4a')]=function(_0x3f7bd7,_0x2ecfe7){var _0x1d2448;return db[_0x61cf('0x4b')][_0x61cf('0x4c')](function(_0x5129f0){return db['CmCustomField'][_0x61cf('0x4a')](_0x3f7bd7[_0x61cf('0x47')],{'transaction':_0x5129f0})[_0x61cf('0x3c')](function(_0x57d17c){_0x1d2448=_0x57d17c;var _0x43039f={'type':db[_0x61cf('0x4d')][_0x61cf('0x4e')],'transaction':_0x5129f0};switch(_0x3f7bd7[_0x61cf('0x47')][_0x61cf('0x2a')]){case _0x61cf('0x4f'):_0x43039f[_0x61cf('0x2a')]=db[_0x61cf('0x4d')][_0x61cf('0x4e')];break;case _0x61cf('0x50'):_0x43039f[_0x61cf('0x2a')]=db['Sequelize']['INTEGER'];break;case'switch':_0x43039f['type']=db['Sequelize'][_0x61cf('0x51')];_0x43039f[_0x61cf('0x52')]=![];break;default:}return db['sequelize']['queryInterface'][_0x61cf('0x53')]('cm_contacts',util['format']('cf_%d',_0x1d2448['id']),_0x43039f);})['then'](function(){return _0x1d2448;});})[_0x61cf('0x3c')](respondWithResult(_0x2ecfe7,0xc9))['catch'](handleError(_0x2ecfe7,null));}; \ No newline at end of file +var _0xc459=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','include','rows','catch','show','params','keys','intersection','merge','body','find','create','sequelize','transaction','Sequelize','TEXT','INTEGER','BOOLEAN','defaultValue','queryInterface','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0xc459,0xfc));var _0x9c45=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc459[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x9c45('0x0'));var emlformat=require(_0x9c45('0x1'));var rimraf=require(_0x9c45('0x2'));var zipdir=require(_0x9c45('0x3'));var jsonpatch=require(_0x9c45('0x4'));var rp=require(_0x9c45('0x5'));var moment=require('moment');var BPromise=require(_0x9c45('0x6'));var Mustache=require(_0x9c45('0x7'));var util=require(_0x9c45('0x8'));var path=require(_0x9c45('0x9'));var sox=require(_0x9c45('0xa'));var csv=require(_0x9c45('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9c45('0xc'));var squel=require(_0x9c45('0xd'));var crypto=require(_0x9c45('0xe'));var jsforce=require(_0x9c45('0xf'));var deskjs=require(_0x9c45('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9c45('0x11'));var Papa=require(_0x9c45('0x12'));var Redis=require(_0x9c45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9c45('0x14'));var as=require(_0x9c45('0x15'));var hardwareService=require(_0x9c45('0x16'));var logger=require(_0x9c45('0x17'))(_0x9c45('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c45('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x424147,_0x3e7147){_0x3e7147=_0x3e7147||0xcc;return function(_0x112aaf){if(_0x112aaf){return _0x424147[_0x9c45('0x1a')](_0x3e7147);}return _0x424147[_0x9c45('0x1b')](_0x3e7147)['end']();};}function respondWithResult(_0x41ca29,_0x177f96){_0x177f96=_0x177f96||0xc8;return function(_0xdad7e1){if(_0xdad7e1){return _0x41ca29['status'](_0x177f96)[_0x9c45('0x1c')](_0xdad7e1);}};}function respondWithFilteredResult(_0x917102,_0x39213f){return function(_0x367ce4){if(_0x367ce4){var _0x598ef4=_0x367ce4[_0x9c45('0x1d')],_0x3be6de=_0x39213f[_0x9c45('0x1e')],_0x2981f4=_0x39213f[_0x9c45('0x1e')]+_0x39213f[_0x9c45('0x1f')],_0x4fbab7;if(_0x2981f4>=_0x598ef4){_0x2981f4=_0x598ef4;_0x4fbab7=0xc8;}else{_0x4fbab7=0xce;}_0x917102[_0x9c45('0x1b')](_0x4fbab7);return _0x917102[_0x9c45('0x20')](_0x9c45('0x21'),_0x3be6de+'-'+_0x2981f4+'/'+_0x598ef4)['json'](_0x367ce4);}return null;};}function patchUpdates(_0x258f76){return function(_0x12491a){try{jsonpatch[_0x9c45('0x22')](_0x12491a,_0x258f76,!![]);}catch(_0x5e4516){return BPromise['reject'](_0x5e4516);}return _0x12491a[_0x9c45('0x23')]();};}function saveUpdates(_0x3ca1e4,_0x5b3ab9){return function(_0x312fac){if(_0x312fac){return _0x312fac[_0x9c45('0x24')](_0x3ca1e4)[_0x9c45('0x25')](function(_0x18d3d0){return _0x18d3d0;});}return null;};}function removeEntity(_0x2563ac,_0x7c2fed){return function(_0x519d43){if(_0x519d43){return _0x519d43[_0x9c45('0x26')]()['then'](function(){_0x2563ac[_0x9c45('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x279e69,_0x5560a0){return function(_0x366b19){if(!_0x366b19){_0x279e69[_0x9c45('0x1a')](0x194);}return _0x366b19;};}function handleError(_0x59e0f5,_0x1018cd){_0x1018cd=_0x1018cd||0x1f4;return function(_0x36ce20){logger[_0x9c45('0x27')](_0x36ce20[_0x9c45('0x28')]);if(_0x36ce20[_0x9c45('0x29')]){delete _0x36ce20[_0x9c45('0x29')];}_0x59e0f5[_0x9c45('0x1b')](_0x1018cd)[_0x9c45('0x2a')](_0x36ce20);};}exports[_0x9c45('0x2b')]=function(_0x327199,_0xf948d9){var _0x2fcc8c={},_0x14a580={},_0x1f1a39={'count':0x0,'rows':[]};var _0x44b440=_[_0x9c45('0x2c')](db[_0x9c45('0x2d')][_0x9c45('0x2e')],function(_0x59325b){return{'name':_0x59325b[_0x9c45('0x2f')],'type':_0x59325b[_0x9c45('0x30')]['key']};});_0x14a580[_0x9c45('0x31')]=_[_0x9c45('0x32')](_['map'](_0x44b440,_0x9c45('0x29')),['name']);_0x14a580[_0x9c45('0x33')]=_['keys'](_0x327199['query']);_0x14a580[_0x9c45('0x34')]=_['intersection'](_0x14a580[_0x9c45('0x31')],_0x14a580[_0x9c45('0x33')]);_0x2fcc8c['attributes']=_['intersection'](_0x14a580[_0x9c45('0x31')],qs['fields'](_0x327199['query'][_0x9c45('0x35')]));_0x2fcc8c[_0x9c45('0x36')]=_0x2fcc8c[_0x9c45('0x36')][_0x9c45('0x37')]?_0x2fcc8c[_0x9c45('0x36')]:_0x14a580[_0x9c45('0x31')];if(!_0x327199[_0x9c45('0x33')][_0x9c45('0x38')](_0x9c45('0x39'))){_0x2fcc8c[_0x9c45('0x1f')]=qs['limit'](_0x327199[_0x9c45('0x33')][_0x9c45('0x1f')]);_0x2fcc8c['offset']=qs[_0x9c45('0x1e')](_0x327199[_0x9c45('0x33')]['offset']);}_0x2fcc8c[_0x9c45('0x3a')]=qs[_0x9c45('0x3b')](_0x327199[_0x9c45('0x33')]['sort']);_0x2fcc8c['where']=qs['filters'](_[_0x9c45('0x3c')](_0x327199[_0x9c45('0x33')],_0x14a580[_0x9c45('0x34')]),_0x44b440);if(_0x327199[_0x9c45('0x33')][_0x9c45('0x3d')]){_0x2fcc8c['where']=_['merge'](_0x2fcc8c['where'],{'$or':_[_0x9c45('0x2c')](_0x44b440,function(_0xa15533){if(_0xa15533[_0x9c45('0x30')]!==_0x9c45('0x3e')){var _0x3462ed={};_0x3462ed[_0xa15533[_0x9c45('0x29')]]={'$like':'%'+_0x327199[_0x9c45('0x33')][_0x9c45('0x3d')]+'%'};return _0x3462ed;}})});}_0x2fcc8c=_['merge']({},_0x2fcc8c,_0x327199[_0x9c45('0x3f')]);var _0x1648e2={'where':_0x2fcc8c[_0x9c45('0x40')]};return db[_0x9c45('0x2d')][_0x9c45('0x1d')](_0x1648e2)[_0x9c45('0x25')](function(_0x1507c9){_0x1f1a39[_0x9c45('0x1d')]=_0x1507c9;if(_0x327199['query'][_0x9c45('0x41')]){_0x2fcc8c[_0x9c45('0x42')]=[{'all':!![]}];}return db[_0x9c45('0x2d')]['findAll'](_0x2fcc8c);})[_0x9c45('0x25')](function(_0x243490){_0x1f1a39[_0x9c45('0x43')]=_0x243490;return _0x1f1a39;})[_0x9c45('0x25')](respondWithFilteredResult(_0xf948d9,_0x2fcc8c))[_0x9c45('0x44')](handleError(_0xf948d9,null));};exports[_0x9c45('0x45')]=function(_0x1eab9b,_0xb22570){var _0x45e623={'raw':!![],'where':{'id':_0x1eab9b[_0x9c45('0x46')]['id']}},_0x5abcfd={};_0x5abcfd[_0x9c45('0x31')]=_[_0x9c45('0x47')](db[_0x9c45('0x2d')][_0x9c45('0x2e')]);_0x5abcfd[_0x9c45('0x33')]=_[_0x9c45('0x47')](_0x1eab9b[_0x9c45('0x33')]);_0x5abcfd[_0x9c45('0x34')]=_[_0x9c45('0x48')](_0x5abcfd[_0x9c45('0x31')],_0x5abcfd[_0x9c45('0x33')]);_0x45e623[_0x9c45('0x36')]=_[_0x9c45('0x48')](_0x5abcfd[_0x9c45('0x31')],qs[_0x9c45('0x35')](_0x1eab9b[_0x9c45('0x33')]['fields']));_0x45e623[_0x9c45('0x36')]=_0x45e623[_0x9c45('0x36')]['length']?_0x45e623[_0x9c45('0x36')]:_0x5abcfd[_0x9c45('0x31')];if(_0x1eab9b[_0x9c45('0x33')][_0x9c45('0x41')]){_0x45e623[_0x9c45('0x42')]=[{'all':!![]}];}_0x45e623=_[_0x9c45('0x49')]({},_0x45e623,_0x1eab9b[_0x9c45('0x3f')]);return db['CmCustomField']['find'](_0x45e623)[_0x9c45('0x25')](handleEntityNotFound(_0xb22570,null))[_0x9c45('0x25')](respondWithResult(_0xb22570,null))['catch'](handleError(_0xb22570,null));};exports['update']=function(_0x5bc893,_0x1ba560){if(_0x5bc893[_0x9c45('0x4a')]['id']){delete _0x5bc893[_0x9c45('0x4a')]['id'];}return db[_0x9c45('0x2d')][_0x9c45('0x4b')]({'where':{'id':_0x5bc893[_0x9c45('0x46')]['id']}})[_0x9c45('0x25')](handleEntityNotFound(_0x1ba560,null))[_0x9c45('0x25')](saveUpdates(_0x5bc893['body'],null))[_0x9c45('0x25')](respondWithResult(_0x1ba560,null))[_0x9c45('0x44')](handleError(_0x1ba560,null));};exports[_0x9c45('0x26')]=function(_0x6f7263,_0xc32cb4){return db['CmCustomField'][_0x9c45('0x4b')]({'where':{'id':_0x6f7263[_0x9c45('0x46')]['id']}})[_0x9c45('0x25')](handleEntityNotFound(_0xc32cb4,null))[_0x9c45('0x25')](removeEntity(_0xc32cb4,null))[_0x9c45('0x44')](handleError(_0xc32cb4,null));};exports[_0x9c45('0x4c')]=function(_0x18e005,_0x2b4c25){var _0x2a9c13;return db[_0x9c45('0x4d')][_0x9c45('0x4e')](function(_0x47ee2c){return db[_0x9c45('0x2d')]['create'](_0x18e005['body'],{'transaction':_0x47ee2c})[_0x9c45('0x25')](function(_0x441ac8){_0x2a9c13=_0x441ac8;var _0x13e7e4={'type':db[_0x9c45('0x4f')][_0x9c45('0x50')],'transaction':_0x47ee2c};switch(_0x18e005[_0x9c45('0x4a')][_0x9c45('0x30')]){case'text':_0x13e7e4[_0x9c45('0x30')]=db['Sequelize'][_0x9c45('0x50')];break;case'number':_0x13e7e4[_0x9c45('0x30')]=db[_0x9c45('0x4f')][_0x9c45('0x51')];break;case'switch':_0x13e7e4['type']=db[_0x9c45('0x4f')][_0x9c45('0x52')];_0x13e7e4[_0x9c45('0x53')]=![];break;default:}return db[_0x9c45('0x4d')][_0x9c45('0x54')]['addColumn']('cm_contacts',util['format'](_0x9c45('0x55'),_0x2a9c13['id']),_0x13e7e4);})[_0x9c45('0x25')](function(){return _0x2a9c13;});})['then'](respondWithResult(_0x2b4c25,0xc9))[_0x9c45('0x44')](handleError(_0x2b4c25,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 0d0e19b..212555f 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 _0x1123=['request-promise','path','rimraf','./cmCustomField.attributes','util','moment','bluebird'];(function(_0x234459,_0x8da0cc){var _0x2a73fb=function(_0x2844fd){while(--_0x2844fd){_0x234459['push'](_0x234459['shift']());}};_0x2a73fb(++_0x8da0cc);}(_0x1123,0x1e7));var _0x3112=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1123[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x3112('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3112('0x1'));var BPromise=require(_0x3112('0x2'));var rp=require(_0x3112('0x3'));var fs=require('fs');var path=require(_0x3112('0x4'));var rimraf=require(_0x3112('0x5'));var config=require('../../config/environment');var attributes=require(_0x3112('0x6'));module['exports']=function(_0x2479a0,_0x3b72ee){return _0x2479a0['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd428=['request-promise','path','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd428,0x16f));var _0x8d42=function(_0x50f6af,_0x1726d0){_0x50f6af=_0x50f6af-0x0;var _0x434ab1=_0xd428[_0x50f6af];return _0x434ab1;};'use strict';var _=require(_0x8d42('0x0'));var util=require('util');var logger=require(_0x8d42('0x1'))(_0x8d42('0x2'));var moment=require(_0x8d42('0x3'));var BPromise=require(_0x8d42('0x4'));var rp=require(_0x8d42('0x5'));var fs=require('fs');var path=require(_0x8d42('0x6'));var rimraf=require('rimraf');var config=require(_0x8d42('0x7'));var attributes=require(_0x8d42('0x8'));module['exports']=function(_0x4dd359,_0x54cb0a){return _0x4dd359[_0x8d42('0x9')](_0x8d42('0xa'),attributes,{'tableName':_0x8d42('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 e8d59d7..48c7aa6 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 _0x5ad3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x5e1fb7,_0x32b7e8){var _0x129899=function(_0x30b015){while(--_0x30b015){_0x5e1fb7['push'](_0x5e1fb7['shift']());}};_0x129899(++_0x32b7e8);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x5ad3[_0x47e7dd];return _0x38501f;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var BPromise=require(_0x35ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31cc6a,_0x4edc59,_0x292521){return new BPromise(function(_0x3cec3e,_0x3f1f55){return client['request'](_0x31cc6a,_0x292521)[_0x35ad('0xd')](function(_0x487107){logger['info'](_0x35ad('0xe'),_0x4edc59,_0x35ad('0xf'));logger['debug'](_0x35ad('0x10'),_0x4edc59,_0x35ad('0xf'),JSON['stringify'](_0x487107));if(_0x487107['error']){if(_0x487107[_0x35ad('0x11')][_0x35ad('0x12')]===0x1f4){logger['error'](_0x35ad('0xe'),_0x4edc59,_0x487107[_0x35ad('0x11')]['message']);return _0x3f1f55(_0x487107['error'][_0x35ad('0x13')]);}logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x487107['error'][_0x35ad('0x13')]);return _0x3cec3e(_0x487107[_0x35ad('0x11')]['message']);}else{logger[_0x35ad('0x14')]('CmCustomField,\x20%s,\x20%s',_0x4edc59,'request\x20sent');_0x3cec3e(_0x487107[_0x35ad('0x15')][_0x35ad('0x13')]);}})[_0x35ad('0x16')](function(_0x56cb8e){logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x56cb8e);_0x3f1f55(_0x56cb8e);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2a7c14,_0x2c28fa){var _0x956980=function(_0x454dba){while(--_0x454dba){_0x2a7c14['push'](_0x2a7c14['shift']());}};_0x956980(++_0x2c28fa);}(_0x34e8,0x12c));var _0x834e=function(_0x3603b6,_0x25d7bc){_0x3603b6=_0x3603b6-0x0;var _0xb02e46=_0x34e8[_0x3603b6];return _0xb02e46;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('CmCustomField,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('CmCustomField,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3e087ac..cd2948b 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 _0xdd94=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','put','exports','multer','util','path','express','Router'];(function(_0x42a932,_0x1a0dcf){var _0x122955=function(_0x12de17){while(--_0x12de17){_0x42a932['push'](_0x42a932['shift']());}};_0x122955(++_0x1a0dcf);}(_0xdd94,0x18b));var _0x4dd9=function(_0x5fff96,_0x49b8c8){_0x5fff96=_0x5fff96-0x0;var _0x5532bc=_0xdd94[_0x5fff96];return _0x5532bc;};'use strict';var multer=require(_0x4dd9('0x0'));var util=require(_0x4dd9('0x1'));var path=require(_0x4dd9('0x2'));var timeout=require('connect-timeout');var express=require(_0x4dd9('0x3'));var router=express[_0x4dd9('0x4')]();var auth=require(_0x4dd9('0x5'));var interaction=require(_0x4dd9('0x6'));var config=require(_0x4dd9('0x7'));var controller=require(_0x4dd9('0x8'));router[_0x4dd9('0x9')]('/',auth[_0x4dd9('0xa')](),controller[_0x4dd9('0xb')]);router[_0x4dd9('0x9')](_0x4dd9('0xc'),auth['isAuthenticated'](),controller[_0x4dd9('0xd')]);router['post']('/',auth[_0x4dd9('0xa')](),controller['create']);router[_0x4dd9('0xe')]('/:id',auth[_0x4dd9('0xa')](),controller['update']);router['delete'](_0x4dd9('0xc'),auth[_0x4dd9('0xa')](),controller['destroy']);module[_0x4dd9('0xf')]=router; \ No newline at end of file +var _0xcb30=['delete','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','put','update'];(function(_0x3cd51e,_0x234d16){var _0x32a6e3=function(_0x17dbc2){while(--_0x17dbc2){_0x3cd51e['push'](_0x3cd51e['shift']());}};_0x32a6e3(++_0x234d16);}(_0xcb30,0x7c));var _0x0cb3=function(_0x4ac6bf,_0x5a575c){_0x4ac6bf=_0x4ac6bf-0x0;var _0x512540=_0xcb30[_0x4ac6bf];return _0x512540;};'use strict';var multer=require(_0x0cb3('0x0'));var util=require(_0x0cb3('0x1'));var path=require(_0x0cb3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cb3('0x3'));var router=express['Router']();var auth=require(_0x0cb3('0x4'));var interaction=require(_0x0cb3('0x5'));var config=require('../../config/environment');var controller=require(_0x0cb3('0x6'));router[_0x0cb3('0x7')]('/',auth[_0x0cb3('0x8')](),controller['index']);router[_0x0cb3('0x7')]('/:id',auth[_0x0cb3('0x8')](),controller['show']);router['post']('/',auth[_0x0cb3('0x8')](),controller['create']);router[_0x0cb3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0cb3('0xa')]);router[_0x0cb3('0xb')](_0x0cb3('0xc'),auth[_0x0cb3('0x8')](),controller[_0x0cb3('0xd')]);module[_0x0cb3('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 10d02a1..adecb75 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 _0xdc97=['moment','sequelize','exports','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue'];(function(_0x12e137,_0x455a3a){var _0x25649c=function(_0x2e2d43){while(--_0x2e2d43){_0x12e137['push'](_0x12e137['shift']());}};_0x25649c(++_0x455a3a);}(_0xdc97,0x13b));var _0x7dc9=function(_0x364538,_0x1d2e5d){_0x364538=_0x364538-0x0;var _0x3a12dd=_0xdc97[_0x364538];return _0x3a12dd;};'use strict';var moment=require(_0x7dc9('0x0'));var Sequelize=require(_0x7dc9('0x1'));module[_0x7dc9('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x7dc9('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7dc9('0x4')](_0x7dc9('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7dc9('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7dc9('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7dc9('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7dc9('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x7dc9('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7dc9('0x6')],'unique':_0x7dc9('0x8')},'ListId':{'type':Sequelize[_0x7dc9('0x6')],'unique':_0x7dc9('0x8')},'UserId':{'type':Sequelize[_0x7dc9('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7dc9('0x8')},'CampaignId':{'type':Sequelize[_0x7dc9('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x7dc9('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7dc9('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7dc9('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7dc9('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7dc9('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x885a=['INTEGER','DATE','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x885a,0x180));var _0xa885=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x885a[_0x138adb];return _0x1b27f2;};'use strict';var moment=require('moment');var Sequelize=require(_0xa885('0x0'));module[_0xa885('0x1')]={'phone':{'type':Sequelize[_0xa885('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa885('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xa885('0x4')](_0xa885('0x5'))},'countbusyretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa885('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa885('0x7')]},'priority':{'type':Sequelize[_0xa885('0x6')](0x2)[_0xa885('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa885('0x6')],'unique':_0xa885('0x9')},'ListId':{'type':Sequelize[_0xa885('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xa885('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xa885('0x6')],'unique':_0xa885('0x9')},'CampaignId':{'type':Sequelize[_0xa885('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index dc9dfe8..dbbaf93 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 _0x8533=['isEmpty','priority','ASC','scheduledAt','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','hopperIds','literal','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','count','offset','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','query','keys','filters','intersection','model','concat','$or','$gte','$lt','$lte','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','direction','prev'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x8533,0x141));var _0x3853=function(_0xb00a50,_0x114be5){_0xb00a50=_0xb00a50-0x0;var _0x1e35d8=_0x8533[_0xb00a50];return _0x1e35d8;};'use strict';var pdf=require(_0x3853('0x0'));var emlformat=require(_0x3853('0x1'));var rimraf=require(_0x3853('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3853('0x3'));var rp=require(_0x3853('0x4'));var moment=require('moment');var BPromise=require(_0x3853('0x5'));var Mustache=require('mustache');var util=require(_0x3853('0x6'));var path=require('path');var sox=require(_0x3853('0x7'));var csv=require(_0x3853('0x8'));var ejs=require(_0x3853('0x9'));var fs=require('fs');var _=require(_0x3853('0xa'));var squel=require('squel');var crypto=require(_0x3853('0xb'));var jsforce=require(_0x3853('0xc'));var deskjs=require(_0x3853('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3853('0xe'));var Redis=require(_0x3853('0xf'));var authService=require(_0x3853('0x10'));var qs=require(_0x3853('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3853('0x12'));var logger=require(_0x3853('0x13'))(_0x3853('0x14'));var utils=require(_0x3853('0x15'));var config=require(_0x3853('0x16'));var licenseUtil=require(_0x3853('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ddbfe,_0x1927d8){_0x1927d8=_0x1927d8||0xcc;return function(_0x330363){if(_0x330363){return _0x1ddbfe[_0x3853('0x18')](_0x1927d8);}return _0x1ddbfe['status'](_0x1927d8)[_0x3853('0x19')]();};}function respondWithResult(_0x32ffe1,_0x96cfef){_0x96cfef=_0x96cfef||0xc8;return function(_0x97c5d9){if(_0x97c5d9){return _0x32ffe1['status'](_0x96cfef)['json'](_0x97c5d9);}};}function respondWithFilteredResult(_0x510e99,_0x130b7b){return function(_0x77518){if(_0x77518){var _0x378431=_0x77518[_0x3853('0x1a')],_0x387d3c=_0x130b7b['offset'],_0x42c263=_0x130b7b[_0x3853('0x1b')]+_0x130b7b[_0x3853('0x1c')],_0x59eb33;if(_0x42c263>=_0x378431){_0x42c263=_0x378431;_0x59eb33=0xc8;}else{_0x59eb33=0xce;}_0x510e99[_0x3853('0x1d')](_0x59eb33);return _0x510e99[_0x3853('0x1e')](_0x3853('0x1f'),_0x387d3c+'-'+_0x42c263+'/'+_0x378431)[_0x3853('0x20')](_0x77518);}return null;};}function patchUpdates(_0x485591){return function(_0x5464f3){try{jsonpatch[_0x3853('0x21')](_0x5464f3,_0x485591,!![]);}catch(_0x52cbad){return BPromise[_0x3853('0x22')](_0x52cbad);}return _0x5464f3[_0x3853('0x23')]();};}function saveUpdates(_0x5b211d,_0x24223c){return function(_0x40b1c6){if(_0x40b1c6){return _0x40b1c6[_0x3853('0x24')](_0x5b211d)[_0x3853('0x25')](function(_0x20bbf3){return _0x20bbf3;});}return null;};}function removeEntity(_0x54252e,_0x1140e3){return function(_0x233c9c){if(_0x233c9c){return _0x233c9c[_0x3853('0x26')]()[_0x3853('0x25')](function(){_0x54252e[_0x3853('0x1d')](0xcc)[_0x3853('0x19')]();});}};}function handleEntityNotFound(_0x464fc2,_0x5ea629){return function(_0xb851bb){if(!_0xb851bb){_0x464fc2['sendStatus'](0x194);}return _0xb851bb;};}function handleError(_0x3cdbab,_0x51cc38){_0x51cc38=_0x51cc38||0x1f4;return function(_0x5068fa){logger[_0x3853('0x27')](_0x5068fa[_0x3853('0x28')]);if(_0x5068fa[_0x3853('0x29')]){delete _0x5068fa[_0x3853('0x29')];}_0x3cdbab[_0x3853('0x1d')](_0x51cc38)['send'](_0x5068fa);};}exports[_0x3853('0x2a')]=function(_0x2b6bab,_0x5c0e8e){var _0x23b888={},_0x540736={},_0x47dfcc={'count':0x0,'rows':[]};var _0x4ad20b=_[_0x3853('0x2b')](db[_0x3853('0x2c')][_0x3853('0x2d')],function(_0x50e181){return{'name':_0x50e181[_0x3853('0x2e')],'type':_0x50e181[_0x3853('0x2f')]['key']};});_0x540736['model']=_['map'](_0x4ad20b,_0x3853('0x29'));_0x540736[_0x3853('0x30')]=_[_0x3853('0x31')](_0x2b6bab[_0x3853('0x30')]);_0x540736[_0x3853('0x32')]=_[_0x3853('0x33')](_0x540736[_0x3853('0x34')],_0x540736[_0x3853('0x30')]);_0x540736['filters']=_[_0x3853('0x35')](_0x540736[_0x3853('0x32')],['$and',_0x3853('0x36'),'$gt',_0x3853('0x37'),_0x3853('0x38'),_0x3853('0x39'),'$ne','$eq',_0x3853('0x3a'),'$between',_0x3853('0x3b'),_0x3853('0x3c'),_0x3853('0x3d'),_0x3853('0x3e'),'$notLike',_0x3853('0x3f'),_0x3853('0x40'),_0x3853('0x3e'),_0x3853('0x41'),_0x3853('0x42'),_0x3853('0x43'),'$any']);_0x23b888[_0x3853('0x44')]=_[_0x3853('0x33')](_0x540736[_0x3853('0x34')],qs['fields'](_0x2b6bab[_0x3853('0x30')][_0x3853('0x45')]));_0x23b888['attributes']=_0x23b888[_0x3853('0x44')][_0x3853('0x46')]?_0x23b888['attributes']:_0x540736[_0x3853('0x34')];if(!_0x2b6bab[_0x3853('0x30')][_0x3853('0x47')](_0x3853('0x48'))){_0x23b888[_0x3853('0x1c')]=qs[_0x3853('0x1c')](_0x2b6bab[_0x3853('0x30')]['limit']);_0x23b888[_0x3853('0x1b')]=qs[_0x3853('0x1b')](_0x2b6bab['query'][_0x3853('0x1b')]);}_0x23b888[_0x3853('0x49')]=qs[_0x3853('0x4a')](_0x2b6bab[_0x3853('0x30')][_0x3853('0x4a')]);_0x23b888['where']=qs[_0x3853('0x32')](_[_0x3853('0x4b')](_0x2b6bab[_0x3853('0x30')],_0x540736[_0x3853('0x32')]),_0x4ad20b);if(_0x2b6bab[_0x3853('0x30')][_0x3853('0x4c')]){_0x23b888['where']=_[_0x3853('0x4d')](_0x23b888[_0x3853('0x4e')],{'$or':_[_0x3853('0x2b')](_0x4ad20b,function(_0x4d01a9){if(_0x4d01a9[_0x3853('0x2f')]!==_0x3853('0x4f')){var _0x1bf89c={};_0x1bf89c[_0x4d01a9[_0x3853('0x29')]]={'$like':'%'+_0x2b6bab[_0x3853('0x30')]['filter']+'%'};return _0x1bf89c;}})});}_0x23b888=_[_0x3853('0x4d')]({},_0x23b888,_0x2b6bab[_0x3853('0x50')]);var _0x1ba10a={'where':_0x23b888[_0x3853('0x4e')]};return db['CmHopper'][_0x3853('0x1a')](_0x1ba10a)[_0x3853('0x25')](function(_0x214764){_0x47dfcc[_0x3853('0x1a')]=_0x214764;if(_0x2b6bab[_0x3853('0x30')][_0x3853('0x51')]){_0x23b888[_0x3853('0x52')]=[{'all':!![]}];}return db[_0x3853('0x2c')][_0x3853('0x53')](_0x23b888);})[_0x3853('0x25')](function(_0x373bab){_0x47dfcc['rows']=_0x373bab;return _0x47dfcc;})[_0x3853('0x25')](respondWithFilteredResult(_0x5c0e8e,_0x23b888))[_0x3853('0x54')](handleError(_0x5c0e8e,null));};exports[_0x3853('0x55')]=function(_0x2a669b,_0x4f38a7){var _0x47f1ee={'raw':!![],'where':{'id':_0x2a669b[_0x3853('0x56')]['id']}},_0x35f921={};_0x35f921[_0x3853('0x34')]=_[_0x3853('0x31')](db['CmHopper']['rawAttributes']);_0x35f921[_0x3853('0x30')]=_[_0x3853('0x31')](_0x2a669b['query']);_0x35f921[_0x3853('0x32')]=_[_0x3853('0x33')](_0x35f921[_0x3853('0x34')],_0x35f921['query']);_0x47f1ee[_0x3853('0x44')]=_['intersection'](_0x35f921[_0x3853('0x34')],qs[_0x3853('0x45')](_0x2a669b[_0x3853('0x30')][_0x3853('0x45')]));_0x47f1ee[_0x3853('0x44')]=_0x47f1ee[_0x3853('0x44')][_0x3853('0x46')]?_0x47f1ee['attributes']:_0x35f921[_0x3853('0x34')];if(_0x2a669b[_0x3853('0x30')][_0x3853('0x51')]){_0x47f1ee[_0x3853('0x52')]=[{'all':!![]}];}_0x47f1ee=_[_0x3853('0x4d')]({},_0x47f1ee,_0x2a669b[_0x3853('0x50')]);return db[_0x3853('0x2c')]['find'](_0x47f1ee)[_0x3853('0x25')](handleEntityNotFound(_0x4f38a7,null))[_0x3853('0x25')](respondWithResult(_0x4f38a7,null))[_0x3853('0x54')](handleError(_0x4f38a7,null));};exports[_0x3853('0x57')]=function(_0x2fe692,_0x5db000){return db[_0x3853('0x2c')]['create'](_0x2fe692[_0x3853('0x58')],{})[_0x3853('0x25')](respondWithResult(_0x5db000,0xc9))[_0x3853('0x54')](handleError(_0x5db000,null));};exports[_0x3853('0x24')]=function(_0x42c196,_0x93bbee){if(_0x42c196[_0x3853('0x58')]['id']){delete _0x42c196[_0x3853('0x58')]['id'];}return db[_0x3853('0x2c')][_0x3853('0x59')]({'where':{'id':_0x42c196[_0x3853('0x56')]['id']}})[_0x3853('0x25')](handleEntityNotFound(_0x93bbee,null))[_0x3853('0x25')](saveUpdates(_0x42c196[_0x3853('0x58')],null))[_0x3853('0x25')](respondWithResult(_0x93bbee,null))['catch'](handleError(_0x93bbee,null));};exports['describe']=function(_0x1268da,_0x2d453b){return db[_0x3853('0x2c')][_0x3853('0x5a')]()[_0x3853('0x25')](respondWithResult(_0x2d453b,null))[_0x3853('0x54')](handleError(_0x2d453b,null));};exports[_0x3853('0x26')]=function(_0x3ae028,_0x2ec836){var _0x195c23;return db[_0x3853('0x2c')][_0x3853('0x59')]({'where':{'id':_0x3ae028[_0x3853('0x56')]['id']}})[_0x3853('0x25')](handleEntityNotFound(_0x2ec836,null))[_0x3853('0x25')](function(_0xea2c43){if(_0xea2c43){return _0xea2c43[_0x3853('0x26')]()[_0x3853('0x25')](function(_0x2877aa){return _0x2877aa;});}})[_0x3853('0x25')](function(_0x4331dd){_0x195c23=_0x4331dd;if(_0x4331dd){if(_0x4331dd[_0x3853('0x5b')]||_0x4331dd[_0x3853('0x5c')]){return db[_0x4331dd[_0x3853('0x5b')]?'VoiceQueue':_0x3853('0x5d')][_0x3853('0x59')]({'where':{'id':_0x4331dd[_0x3853('0x5b')]?_0x4331dd[_0x3853('0x5b')]:_0x4331dd[_0x3853('0x5c')]},'attributes':['id',_0x3853('0x29')],'raw':!![]});}}})[_0x3853('0x25')](function(_0x2740e4){var _0x416ec4={};if(_0x2740e4){_['merge'](_0x416ec4,_[_0x3853('0x5e')](_0x195c23[_0x3853('0x5f')],[_0x3853('0x60'),_0x3853('0x61'),'id']));_0x416ec4[_0x3853('0x62')]=0x15;_0x416ec4[_0x3853('0x63')]='deleted';_0x416ec4[_0x3853('0x64')]=_0x2740e4[_0x3853('0x29')];_0x416ec4[_0x3853('0x65')]=_0x3ae028[_0x3853('0x66')]['name'];_0x416ec4['UserId']=_0x3ae028[_0x3853('0x66')]['id'];_0x416ec4[_0x3853('0x67')]=!![];_0x416ec4[_0x3853('0x68')]=moment()[_0x3853('0x69')](_0x3853('0x6a'));_0x416ec4[_0x3853('0x6b')]=_0x195c23[_0x3853('0x6c')];_0x416ec4[_0x3853('0x6d')]=_0x195c23['VoiceQueueId']?'queue':_0x3853('0x6e');return db['CmContact'][_0x3853('0x59')]({'where':{'id':_0x416ec4['ContactId']},'attributes':['firstName',_0x3853('0x6f')]})[_0x3853('0x25')](function(_0x3157d4){if(!_[_0x3853('0x70')](_0x2ec836)&&!_[_0x3853('0x70')](_0x3157d4[_0x3853('0x71')])){_0x416ec4[_0x3853('0x72')]=_0x3157d4['firstName'];if(!_['isNil'](_0x3157d4[_0x3853('0x6f')])){_0x416ec4[_0x3853('0x72')]+='\x20'+_0x3157d4[_0x3853('0x6f')];}}})[_0x3853('0x73')](function(){return db[_0x3853('0x74')][_0x3853('0x57')](_0x416ec4);});}})[_0x3853('0x25')](function(){return _0x2ec836[_0x3853('0x1d')](0xcc)[_0x3853('0x19')]();})[_0x3853('0x54')](handleError(_0x2ec836,null));};exports[_0x3853('0x75')]=function(_0x49c8cb,_0x1e849d,_0xb8ee98){var _0x409ae5=[];return db[_0x3853('0x76')][_0x3853('0x5a')]()['then'](function(_0x50c2aa){_0x409ae5=_['keys'](_0x50c2aa);return _0x49c8cb['user'][_0x3853('0x77')]({'where':{'type':_0x3853('0x78'),'dialActive':!![],'dialMethod':_0x3853('0x79')},'attributes':['id',_0x3853('0x7a')],'raw':!![]});})[_0x3853('0x25')](function(_0x4a400e){if(_0x4a400e&&_0x4a400e[_0x3853('0x46')]){return db['sequelize'][_0x3853('0x7b')](function(_0x1347f5){var _0x4969bf={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3853('0x69')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x3853('0x2b')](_0x4a400e,'id')},'$or':[{'UserId':null},{'UserId':_0x49c8cb['user']['id']}]};var _0x4fc522=[];if(_0x49c8cb['body'][_0x3853('0x7c')]&&_0x49c8cb[_0x3853('0x58')]['direction']===_0x3853('0x7d')){if(!_[_0x3853('0x7e')](_0x49c8cb['body']['hopperIds'])){_0x4969bf['id']={'$in':_0x49c8cb[_0x3853('0x58')]['hopperIds']};}_0x4fc522=[[_0x3853('0x7f'),_0x3853('0x80')],[_0x3853('0x81'),_0x4a400e[0x0][_0x3853('0x7a')]==='ASC'?'DESC':_0x3853('0x80')],db[_0x3853('0x82')]['literal'](_0x3853('0x83')),['id',_0x3853('0x84')]];}else{if(!_[_0x3853('0x7e')](_0x49c8cb[_0x3853('0x58')][_0x3853('0x85')])){_0x4969bf['id']={'$notIn':_0x49c8cb['body'][_0x3853('0x85')]};}_0x4fc522=[['priority',_0x3853('0x84')],[_0x3853('0x81'),_0x4a400e[0x0][_0x3853('0x7a')]],db['sequelize'][_0x3853('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x3853('0x80')]];}return db[_0x3853('0x2c')]['findOne']({'attributes':['id',_0x3853('0x87')],'where':_0x4969bf,'order':_0x4fc522,'transaction':_0x1347f5,'lock':_0x1347f5[_0x3853('0x88')][_0x3853('0x89')],'include':[{'model':db[_0x3853('0x76')],'as':_0x3853('0x8a'),'attributes':_0x409ae5,'include':[{'model':db['CmCompany'],'as':_0x3853('0x8b'),'attributes':['id',_0x3853('0x29')]}]},{'model':db[_0x3853('0x8c')],'as':_0x3853('0x8d'),'attributes':['id',_0x3853('0x29')]},{'model':db[_0x3853('0x8e')],'as':_0x3853('0x8f'),'attributes':['id',_0x3853('0x29'),_0x3853('0x90')]}]})[_0x3853('0x25')](function(_0x180f03){if(_0x180f03){return _0x180f03[_0x3853('0x24')]({'UserId':_0x49c8cb[_0x3853('0x66')]['id']},{'transaction':_0x1347f5});}});});}})[_0x3853('0x25')](handleEntityNotFound(_0x1e849d,null))[_0x3853('0x25')](respondWithResult(_0x1e849d,null))['catch'](handleError(_0x1e849d,null));};exports[_0x3853('0x91')]=function(_0x4054d7,_0x5b9db7,_0x4aa8fb){return _0x4054d7[_0x3853('0x66')][_0x3853('0x77')]({'where':{'type':_0x3853('0x78'),'dialActive':!![],'dialMethod':_0x3853('0x79')},'attributes':['id'],'raw':!![]})[_0x3853('0x25')](function(_0x1cd6a3){if(_0x1cd6a3&&_0x1cd6a3['length']){return db[_0x3853('0x2c')][_0x3853('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3853('0x69')](_0x3853('0x6a'))},'VoiceQueueId':{'$in':_[_0x3853('0x2b')](_0x1cd6a3,'id')},'$or':[{'UserId':null},{'UserId':_0x4054d7[_0x3853('0x66')]['id']}]}});}return 0x0;})[_0x3853('0x25')](function(_0x44f03b){if(!_['isNil'](_0x44f03b)&&_[_0x3853('0x92')](_0x44f03b)){return _0x5b9db7['status'](0xc8)['json']({'contacts':_0x44f03b});}else{logger[_0x3853('0x27')](_0x3853('0x93'),_0x3853('0x91'),0x194,_0x3853('0x94'));_0x5b9db7['sendStatus'](0x194);}})[_0x3853('0x54')](handleError(_0x5b9db7,null));}; \ No newline at end of file +var _0x13f6=['sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','update','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','then','destroy','error','name','map','CmHopper','type','key','model','query','keys','intersection','filters','concat','$or','$gt','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','create','getPreview','outbound','preview','dialOrderByScheduledAt','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x13f6,0x124));var _0x613f=function(_0x1ef48f,_0x11ead1){_0x1ef48f=_0x1ef48f-0x0;var _0x551c96=_0x13f6[_0x1ef48f];return _0x551c96;};'use strict';var pdf=require(_0x613f('0x0'));var emlformat=require(_0x613f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x613f('0x2'));var rp=require(_0x613f('0x3'));var moment=require(_0x613f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613f('0x5'));var util=require(_0x613f('0x6'));var path=require(_0x613f('0x7'));var sox=require('sox');var csv=require(_0x613f('0x8'));var ejs=require(_0x613f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0x8'));var querystring=require(_0x613f('0xb'));var Papa=require(_0x613f('0xc'));var Redis=require('ioredis');var authService=require(_0x613f('0xd'));var qs=require(_0x613f('0xe'));var as=require(_0x613f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x10'))(_0x613f('0x11'));var utils=require(_0x613f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x13'));var db=require(_0x613f('0x14'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x15')](_0x4c2a85);}return _0x542230[_0x613f('0x16')](_0x4c2a85)[_0x613f('0x17')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x16')](_0x329fcf)[_0x613f('0x18')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=_0x548218[_0x613f('0x19')],_0x5d7c69=_0x1d68fd['offset'],_0x5c769c=_0x1d68fd[_0x613f('0x1a')]+_0x1d68fd['limit'],_0x1bc605;if(_0x5c769c>=_0x3c9edf){_0x5c769c=_0x3c9edf;_0x1bc605=0xc8;}else{_0x1bc605=0xce;}_0x2eee4d[_0x613f('0x16')](_0x1bc605);return _0x2eee4d[_0x613f('0x1b')](_0x613f('0x1c'),_0x5d7c69+'-'+_0x5c769c+'/'+_0x3c9edf)[_0x613f('0x18')](_0x548218);}return null;};}function patchUpdates(_0x3c0feb){return function(_0x1ba35f){try{jsonpatch['apply'](_0x1ba35f,_0x3c0feb,!![]);}catch(_0x5c3192){return BPromise[_0x613f('0x1d')](_0x5c3192);}return _0x1ba35f['save']();};}function saveUpdates(_0x48493c,_0x3c9b58){return function(_0x446562){if(_0x446562){return _0x446562['update'](_0x48493c)[_0x613f('0x1e')](function(_0x163ccb){return _0x163ccb;});}return null;};}function removeEntity(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x1f')]()[_0x613f('0x1e')](function(){_0x2aa14b[_0x613f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41104e,_0x33e0c6){return function(_0x30de90){if(!_0x30de90){_0x41104e[_0x613f('0x15')](0x194);}return _0x30de90;};}function handleError(_0x3013a1,_0x4e3d5a){_0x4e3d5a=_0x4e3d5a||0x1f4;return function(_0x30fb15){logger[_0x613f('0x20')](_0x30fb15['stack']);if(_0x30fb15[_0x613f('0x21')]){delete _0x30fb15[_0x613f('0x21')];}_0x3013a1[_0x613f('0x16')](_0x4e3d5a)['send'](_0x30fb15);};}exports['index']=function(_0x5a4a8b,_0x379920){var _0x594c28={},_0x412269={},_0x1767db={'count':0x0,'rows':[]};var _0x4ca372=_[_0x613f('0x22')](db[_0x613f('0x23')]['rawAttributes'],function(_0x4cff5d){return{'name':_0x4cff5d['fieldName'],'type':_0x4cff5d[_0x613f('0x24')][_0x613f('0x25')]};});_0x412269[_0x613f('0x26')]=_['map'](_0x4ca372,_0x613f('0x21'));_0x412269[_0x613f('0x27')]=_[_0x613f('0x28')](_0x5a4a8b[_0x613f('0x27')]);_0x412269['filters']=_[_0x613f('0x29')](_0x412269[_0x613f('0x26')],_0x412269[_0x613f('0x27')]);_0x412269[_0x613f('0x2a')]=_[_0x613f('0x2b')](_0x412269[_0x613f('0x2a')],['$and',_0x613f('0x2c'),_0x613f('0x2d'),_0x613f('0x2e'),'$lt',_0x613f('0x2f'),'$ne',_0x613f('0x30'),_0x613f('0x31'),_0x613f('0x32'),_0x613f('0x33'),_0x613f('0x34'),_0x613f('0x35'),'$like',_0x613f('0x36'),_0x613f('0x37'),_0x613f('0x38'),_0x613f('0x39'),_0x613f('0x3a'),'$contains','$contained','$any']);_0x594c28[_0x613f('0x3b')]=_[_0x613f('0x29')](_0x412269[_0x613f('0x26')],qs[_0x613f('0x3c')](_0x5a4a8b['query'][_0x613f('0x3c')]));_0x594c28[_0x613f('0x3b')]=_0x594c28['attributes'][_0x613f('0x3d')]?_0x594c28['attributes']:_0x412269[_0x613f('0x26')];if(!_0x5a4a8b['query'][_0x613f('0x3e')]('nolimit')){_0x594c28[_0x613f('0x3f')]=qs[_0x613f('0x3f')](_0x5a4a8b[_0x613f('0x27')]['limit']);_0x594c28[_0x613f('0x1a')]=qs[_0x613f('0x1a')](_0x5a4a8b[_0x613f('0x27')][_0x613f('0x1a')]);}_0x594c28[_0x613f('0x40')]=qs[_0x613f('0x41')](_0x5a4a8b[_0x613f('0x27')][_0x613f('0x41')]);_0x594c28[_0x613f('0x42')]=qs[_0x613f('0x2a')](_['pick'](_0x5a4a8b[_0x613f('0x27')],_0x412269[_0x613f('0x2a')]),_0x4ca372);if(_0x5a4a8b[_0x613f('0x27')][_0x613f('0x43')]){_0x594c28[_0x613f('0x42')]=_[_0x613f('0x44')](_0x594c28[_0x613f('0x42')],{'$or':_['map'](_0x4ca372,function(_0x43c0dc){if(_0x43c0dc[_0x613f('0x24')]!==_0x613f('0x45')){var _0x3d2d7b={};_0x3d2d7b[_0x43c0dc[_0x613f('0x21')]]={'$like':'%'+_0x5a4a8b[_0x613f('0x27')][_0x613f('0x43')]+'%'};return _0x3d2d7b;}})});}_0x594c28=_['merge']({},_0x594c28,_0x5a4a8b[_0x613f('0x46')]);var _0x18f427={'where':_0x594c28[_0x613f('0x42')]};return db[_0x613f('0x23')][_0x613f('0x19')](_0x18f427)[_0x613f('0x1e')](function(_0x2b4e9f){_0x1767db[_0x613f('0x19')]=_0x2b4e9f;if(_0x5a4a8b[_0x613f('0x27')][_0x613f('0x47')]){_0x594c28[_0x613f('0x48')]=[{'all':!![]}];}return db[_0x613f('0x23')][_0x613f('0x49')](_0x594c28);})['then'](function(_0x3472f6){_0x1767db[_0x613f('0x4a')]=_0x3472f6;return _0x1767db;})[_0x613f('0x1e')](respondWithFilteredResult(_0x379920,_0x594c28))[_0x613f('0x4b')](handleError(_0x379920,null));};exports['show']=function(_0x152a3c,_0x15b54a){var _0x38aa12={'raw':!![],'where':{'id':_0x152a3c[_0x613f('0x4c')]['id']}},_0x16b288={};_0x16b288[_0x613f('0x26')]=_[_0x613f('0x28')](db[_0x613f('0x23')][_0x613f('0x4d')]);_0x16b288[_0x613f('0x27')]=_['keys'](_0x152a3c['query']);_0x16b288[_0x613f('0x2a')]=_[_0x613f('0x29')](_0x16b288['model'],_0x16b288[_0x613f('0x27')]);_0x38aa12[_0x613f('0x3b')]=_[_0x613f('0x29')](_0x16b288[_0x613f('0x26')],qs[_0x613f('0x3c')](_0x152a3c[_0x613f('0x27')][_0x613f('0x3c')]));_0x38aa12[_0x613f('0x3b')]=_0x38aa12[_0x613f('0x3b')][_0x613f('0x3d')]?_0x38aa12[_0x613f('0x3b')]:_0x16b288[_0x613f('0x26')];if(_0x152a3c[_0x613f('0x27')][_0x613f('0x47')]){_0x38aa12[_0x613f('0x48')]=[{'all':!![]}];}_0x38aa12=_[_0x613f('0x44')]({},_0x38aa12,_0x152a3c[_0x613f('0x46')]);return db[_0x613f('0x23')]['find'](_0x38aa12)['then'](handleEntityNotFound(_0x15b54a,null))[_0x613f('0x1e')](respondWithResult(_0x15b54a,null))[_0x613f('0x4b')](handleError(_0x15b54a,null));};exports['create']=function(_0x48d29a,_0x94968f){return db['CmHopper']['create'](_0x48d29a[_0x613f('0x4e')],{})[_0x613f('0x1e')](respondWithResult(_0x94968f,0xc9))[_0x613f('0x4b')](handleError(_0x94968f,null));};exports['update']=function(_0x1e3298,_0x150b36){if(_0x1e3298['body']['id']){delete _0x1e3298['body']['id'];}return db[_0x613f('0x23')][_0x613f('0x4f')]({'where':{'id':_0x1e3298[_0x613f('0x4c')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x150b36,null))[_0x613f('0x1e')](saveUpdates(_0x1e3298[_0x613f('0x4e')],null))[_0x613f('0x1e')](respondWithResult(_0x150b36,null))['catch'](handleError(_0x150b36,null));};exports['describe']=function(_0x38d781,_0x489f42){return db['CmHopper'][_0x613f('0x50')]()[_0x613f('0x1e')](respondWithResult(_0x489f42,null))[_0x613f('0x4b')](handleError(_0x489f42,null));};exports['destroy']=function(_0x27adac,_0x3ab684){var _0x291a85;return db[_0x613f('0x23')][_0x613f('0x4f')]({'where':{'id':_0x27adac[_0x613f('0x4c')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x3ab684,null))['then'](function(_0x40d412){if(_0x40d412){return _0x40d412['destroy']()[_0x613f('0x1e')](function(_0x199afe){return _0x199afe;});}})[_0x613f('0x1e')](function(_0x3d1f1a){_0x291a85=_0x3d1f1a;if(_0x3d1f1a){if(_0x3d1f1a[_0x613f('0x51')]||_0x3d1f1a[_0x613f('0x52')]){return db[_0x3d1f1a[_0x613f('0x51')]?_0x613f('0x53'):_0x613f('0x54')][_0x613f('0x4f')]({'where':{'id':_0x3d1f1a[_0x613f('0x51')]?_0x3d1f1a[_0x613f('0x51')]:_0x3d1f1a[_0x613f('0x52')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x687e56){var _0x4b6eb3={};if(_0x687e56){_[_0x613f('0x44')](_0x4b6eb3,_[_0x613f('0x55')](_0x291a85[_0x613f('0x56')],[_0x613f('0x57'),_0x613f('0x58'),'id']));_0x4b6eb3[_0x613f('0x59')]=0x15;_0x4b6eb3[_0x613f('0x5a')]=_0x613f('0x5b');_0x4b6eb3[_0x613f('0x5c')]=_0x687e56[_0x613f('0x21')];_0x4b6eb3[_0x613f('0x5d')]=_0x27adac['user'][_0x613f('0x21')];_0x4b6eb3[_0x613f('0x5e')]=_0x27adac[_0x613f('0x5f')]['id'];_0x4b6eb3[_0x613f('0x5b')]=!![];_0x4b6eb3['deletedat']=moment()[_0x613f('0x60')](_0x613f('0x61'));_0x4b6eb3['calleridnum']=_0x291a85['phone'];_0x4b6eb3[_0x613f('0x62')]=_0x291a85['VoiceQueueId']?'queue':'ivr';return db[_0x613f('0x63')]['find']({'where':{'id':_0x4b6eb3['ContactId']},'attributes':['firstName',_0x613f('0x64')]})[_0x613f('0x1e')](function(_0x5bf4ce){if(!_[_0x613f('0x65')](_0x3ab684)&&!_[_0x613f('0x65')](_0x5bf4ce[_0x613f('0x66')])){_0x4b6eb3[_0x613f('0x67')]=_0x5bf4ce['firstName'];if(!_[_0x613f('0x65')](_0x5bf4ce[_0x613f('0x64')])){_0x4b6eb3['calleridname']+='\x20'+_0x5bf4ce[_0x613f('0x64')];}}})[_0x613f('0x68')](function(){return db[_0x613f('0x69')][_0x613f('0x6a')](_0x4b6eb3);});}})[_0x613f('0x1e')](function(){return _0x3ab684[_0x613f('0x16')](0xcc)[_0x613f('0x17')]();})[_0x613f('0x4b')](handleError(_0x3ab684,null));};exports[_0x613f('0x6b')]=function(_0x2aca4d,_0x14f418,_0x2e5c06){var _0x50d7ca=[];return db[_0x613f('0x63')][_0x613f('0x50')]()[_0x613f('0x1e')](function(_0x36c3af){_0x50d7ca=_[_0x613f('0x28')](_0x36c3af);return _0x2aca4d[_0x613f('0x5f')]['getVoiceQueues']({'where':{'type':_0x613f('0x6c'),'dialActive':!![],'dialMethod':_0x613f('0x6d')},'attributes':['id',_0x613f('0x6e')],'raw':!![]});})[_0x613f('0x1e')](function(_0x378b5e){if(_0x378b5e&&_0x378b5e[_0x613f('0x3d')]){return db['sequelize']['transaction'](function(_0x42282a){var _0x25a550={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x613f('0x60')](_0x613f('0x61'))},'VoiceQueueId':{'$in':_['map'](_0x378b5e,'id')},'$or':[{'UserId':null},{'UserId':_0x2aca4d[_0x613f('0x5f')]['id']}]};var _0x29e5c8=[];if(_0x2aca4d[_0x613f('0x4e')][_0x613f('0x6f')]&&_0x2aca4d['body'][_0x613f('0x6f')]===_0x613f('0x70')){if(!_[_0x613f('0x71')](_0x2aca4d[_0x613f('0x4e')][_0x613f('0x72')])){_0x25a550['id']={'$in':_0x2aca4d[_0x613f('0x4e')][_0x613f('0x72')]};}_0x29e5c8=[[_0x613f('0x73'),'ASC'],[_0x613f('0x74'),_0x378b5e[0x0][_0x613f('0x6e')]===_0x613f('0x75')?_0x613f('0x76'):_0x613f('0x75')],db[_0x613f('0x77')][_0x613f('0x78')](_0x613f('0x79')),['id',_0x613f('0x76')]];}else{if(!_[_0x613f('0x71')](_0x2aca4d['body'][_0x613f('0x72')])){_0x25a550['id']={'$notIn':_0x2aca4d[_0x613f('0x4e')][_0x613f('0x72')]};}_0x29e5c8=[[_0x613f('0x73'),_0x613f('0x76')],[_0x613f('0x74'),_0x378b5e[0x0][_0x613f('0x6e')]],db[_0x613f('0x77')][_0x613f('0x78')](_0x613f('0x7a')),['id',_0x613f('0x75')]];}return db['CmHopper'][_0x613f('0x7b')]({'attributes':['id',_0x613f('0x7c')],'where':_0x25a550,'order':_0x29e5c8,'transaction':_0x42282a,'lock':_0x42282a[_0x613f('0x7d')][_0x613f('0x7e')],'include':[{'model':db[_0x613f('0x63')],'as':_0x613f('0x7f'),'attributes':_0x50d7ca,'include':[{'model':db[_0x613f('0x80')],'as':_0x613f('0x81'),'attributes':['id',_0x613f('0x21')]}]},{'model':db[_0x613f('0x82')],'as':_0x613f('0x83'),'attributes':['id',_0x613f('0x21')]},{'model':db['VoiceQueue'],'as':_0x613f('0x84'),'attributes':['id',_0x613f('0x21'),'dialActive']}]})[_0x613f('0x1e')](function(_0x565fc2){if(_0x565fc2){return _0x565fc2[_0x613f('0x85')]({'UserId':_0x2aca4d['user']['id']},{'transaction':_0x42282a});}});});}})['then'](handleEntityNotFound(_0x14f418,null))[_0x613f('0x1e')](respondWithResult(_0x14f418,null))[_0x613f('0x4b')](handleError(_0x14f418,null));};exports[_0x613f('0x86')]=function(_0x397932,_0x1e3c40,_0x41abff){return _0x397932[_0x613f('0x5f')]['getVoiceQueues']({'where':{'type':_0x613f('0x6c'),'dialActive':!![],'dialMethod':_0x613f('0x6d')},'attributes':['id'],'raw':!![]})[_0x613f('0x1e')](function(_0x2bc172){if(_0x2bc172&&_0x2bc172[_0x613f('0x3d')]){return db['CmHopper'][_0x613f('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x613f('0x60')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x613f('0x22')](_0x2bc172,'id')},'$or':[{'UserId':null},{'UserId':_0x397932[_0x613f('0x5f')]['id']}]}});}return 0x0;})[_0x613f('0x1e')](function(_0x4bb82e){if(!_['isNil'](_0x4bb82e)&&_['isNumber'](_0x4bb82e)){return _0x1e3c40[_0x613f('0x16')](0xc8)[_0x613f('0x18')]({'contacts':_0x4bb82e});}else{logger['error'](_0x613f('0x87'),_0x613f('0x86'),0x194,_0x613f('0x88'));_0x1e3c40['sendStatus'](0x194);}})[_0x613f('0x4b')](handleError(_0x1e3c40,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d849f1b..04ed61d 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 _0x9947=['bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','scheduledat','phone','priority','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9947,0x100));var _0x7994=function(_0x2d98f1,_0x254499){_0x2d98f1=_0x2d98f1-0x0;var _0x5cbe38=_0x9947[_0x2d98f1];return _0x5cbe38;};'use strict';var _=require('lodash');var util=require(_0x7994('0x0'));var logger=require(_0x7994('0x1'))(_0x7994('0x2'));var moment=require(_0x7994('0x3'));var BPromise=require(_0x7994('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7994('0x5'));var rimraf=require(_0x7994('0x6'));var config=require(_0x7994('0x7'));var attributes=require(_0x7994('0x8'));module['exports']=function(_0x4dc9d5,_0x275765){return _0x4dc9d5['define'](_0x7994('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7994('0xa'),'fields':['scheduledat']},{'name':_0x7994('0xb'),'fields':[_0x7994('0xb')]},{'name':_0x7994('0xc'),'fields':[_0x7994('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb939=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','request-promise','path'];(function(_0x34ae18,_0x2f629e){var _0x9bf2ba=function(_0x3baeb3){while(--_0x3baeb3){_0x34ae18['push'](_0x34ae18['shift']());}};_0x9bf2ba(++_0x2f629e);}(_0xb939,0x1ad));var _0x9b93=function(_0x24cbed,_0x2bb38c){_0x24cbed=_0x24cbed-0x0;var _0x1537e7=_0xb939[_0x24cbed];return _0x1537e7;};'use strict';var _=require(_0x9b93('0x0'));var util=require(_0x9b93('0x1'));var logger=require('../../config/logger')(_0x9b93('0x2'));var moment=require(_0x9b93('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b93('0x4'));var fs=require('fs');var path=require(_0x9b93('0x5'));var rimraf=require(_0x9b93('0x6'));var config=require(_0x9b93('0x7'));var attributes=require(_0x9b93('0x8'));module[_0x9b93('0x9')]=function(_0x3e2299,_0x4321f8){return _0x3e2299[_0x9b93('0xa')]('CmHopper',attributes,{'tableName':_0x9b93('0xb'),'paranoid':![],'indexes':[{'name':_0x9b93('0xc'),'fields':[_0x9b93('0xc')]},{'name':_0x9b93('0xd'),'fields':[_0x9b93('0xd')]},{'name':_0x9b93('0xe'),'fields':[_0x9b93('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 238eca4..3228c4d 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 _0xed3e=['attributes','limit','map','include','model','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','catch','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','Contact','keys','User','Agent','name','voicePause','includes','UserId','push','all','CmHopperFinal','destroy','MoveContactManagedDialer','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','order','UPDATE','length','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetCmHopper','CmHopper','findAll','options','raw','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xed3e,0x156));var _0xeed3=function(_0x17a06d,_0x56ec85){_0x17a06d=_0x17a06d-0x0;var _0x5d6220=_0xed3e[_0x17a06d];return _0x5d6220;};'use strict';var _=require(_0xeed3('0x0'));var util=require(_0xeed3('0x1'));var moment=require('moment');var BPromise=require(_0xeed3('0x2'));var rs=require(_0xeed3('0x3'));var fs=require('fs');var Redis=require(_0xeed3('0x4'));var db=require(_0xeed3('0x5'))['db'];var utils=require(_0xeed3('0x6'));var logger=require(_0xeed3('0x7'))('rpc');var config=require(_0xeed3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeed3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c0969,_0x1493ad,_0x56ab14){return new BPromise(function(_0x280d31,_0x2a0408){return client[_0xeed3('0xa')](_0x1c0969,_0x56ab14)[_0xeed3('0xb')](function(_0x34092a){logger[_0xeed3('0xc')](_0xeed3('0xd'),_0x1493ad,'request\x20sent');logger[_0xeed3('0xe')](_0xeed3('0xf'),_0x1493ad,'request\x20sent',JSON[_0xeed3('0x10')](_0x34092a));if(_0x34092a[_0xeed3('0x11')]){if(_0x34092a[_0xeed3('0x11')][_0xeed3('0x12')]===0x1f4){logger[_0xeed3('0x11')](_0xeed3('0xd'),_0x1493ad,_0x34092a[_0xeed3('0x11')]['message']);return _0x2a0408(_0x34092a['error'][_0xeed3('0x13')]);}logger[_0xeed3('0x11')](_0xeed3('0xd'),_0x1493ad,_0x34092a[_0xeed3('0x11')]['message']);return _0x280d31(_0x34092a[_0xeed3('0x11')][_0xeed3('0x13')]);}else{logger[_0xeed3('0xc')](_0xeed3('0xd'),_0x1493ad,_0xeed3('0x14'));_0x280d31(_0x34092a[_0xeed3('0x15')]['message']);}})['catch'](function(_0x54c381){logger[_0xeed3('0x11')](_0xeed3('0xd'),_0x1493ad,_0x54c381);_0x2a0408(_0x54c381);});});}exports[_0xeed3('0x16')]=function(_0x5055d4){var _0x93d06=this;return new Promise(function(_0x5c7541,_0x129ff7){return db[_0xeed3('0x17')][_0xeed3('0x18')]({'raw':_0x5055d4['options']?_0x5055d4[_0xeed3('0x19')][_0xeed3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5055d4[_0xeed3('0x19')]?_0x5055d4['options'][_0xeed3('0x1b')]||null:null,'attributes':_0x5055d4[_0xeed3('0x19')]?_0x5055d4[_0xeed3('0x19')][_0xeed3('0x1c')]||null:null,'limit':_0x5055d4['options']?_0x5055d4['options'][_0xeed3('0x1d')]||null:null,'include':_0x5055d4[_0xeed3('0x19')]?_0x5055d4[_0xeed3('0x19')]['include']?_[_0xeed3('0x1e')](_0x5055d4[_0xeed3('0x19')][_0xeed3('0x1f')],function(_0x2870a0){return{'model':db[_0x2870a0[_0xeed3('0x20')]],'as':_0x2870a0['as'],'attributes':_0x2870a0['attributes'],'include':_0x2870a0[_0xeed3('0x1f')]?_['map'](_0x2870a0[_0xeed3('0x1f')],function(_0x33e98d){return{'model':db[_0x33e98d[_0xeed3('0x20')]],'as':_0x33e98d['as'],'attributes':_0x33e98d[_0xeed3('0x1c')],'include':_0x33e98d[_0xeed3('0x1f')]?_[_0xeed3('0x1e')](_0x33e98d['include'],function(_0x92c8c0){return{'model':db[_0x92c8c0[_0xeed3('0x20')]],'as':_0x92c8c0['as'],'attributes':_0x92c8c0[_0xeed3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeed3('0xb')](function(_0x4a9b76){logger[_0xeed3('0xc')]('GetCmHopper',_0x5055d4);logger[_0xeed3('0xe')](_0xeed3('0x16'),_0x5055d4,JSON[_0xeed3('0x10')](_0x4a9b76));_0x5c7541(_0x4a9b76);})['catch'](function(_0x35d5a7){logger[_0xeed3('0x11')]('GetCmHopper',_0x35d5a7[_0xeed3('0x13')],_0x5055d4);_0x129ff7(_0x93d06[_0xeed3('0x11')](0x1f4,_0x35d5a7[_0xeed3('0x13')]));});});};exports[_0xeed3('0x21')]=function(_0x3f65d1){var _0x52c4c1=this;return new Promise(function(_0x41d050,_0xa52533){return db[_0xeed3('0x17')][_0xeed3('0x22')]({'raw':_0x3f65d1['options']?_0x3f65d1['options'][_0xeed3('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f65d1[_0xeed3('0x19')]?_0x3f65d1[_0xeed3('0x19')][_0xeed3('0x1b')]||null:null,'attributes':_0x3f65d1[_0xeed3('0x19')]?_0x3f65d1['options']['attributes']||null:null,'include':_0x3f65d1[_0xeed3('0x19')]?_0x3f65d1['options']['include']?_['map'](_0x3f65d1[_0xeed3('0x19')]['include'],function(_0x48b8a0){return{'model':db[_0x48b8a0['model']],'as':_0x48b8a0['as'],'attributes':_0x48b8a0[_0xeed3('0x1c')],'include':_0x48b8a0['include']?_['map'](_0x48b8a0[_0xeed3('0x1f')],function(_0x2b9494){return{'model':db[_0x2b9494['model']],'as':_0x2b9494['as'],'attributes':_0x2b9494[_0xeed3('0x1c')],'include':_0x2b9494['include']?_['map'](_0x2b9494[_0xeed3('0x1f')],function(_0x1f150c){return{'model':db[_0x1f150c[_0xeed3('0x20')]],'as':_0x1f150c['as'],'attributes':_0x1f150c['attributes']};}):[]};}):[]};}):[]:[]})[_0xeed3('0xb')](function(_0x1e4549){logger[_0xeed3('0xc')](_0xeed3('0x21'),_0x3f65d1);logger['debug']('ShowCmHopper',_0x3f65d1,JSON[_0xeed3('0x10')](_0x1e4549));_0x41d050(_0x1e4549);})['catch'](function(_0x4889b2){logger[_0xeed3('0x11')](_0xeed3('0x21'),_0x4889b2[_0xeed3('0x13')],_0x3f65d1);_0xa52533(_0x52c4c1[_0xeed3('0x11')](0x1f4,_0x4889b2[_0xeed3('0x13')]));});});};exports['CreateCmHopper']=function(_0x3f80f7){var _0x4ba216=this;return new Promise(function(_0x2c15a3,_0x58420d){return db[_0xeed3('0x17')][_0xeed3('0x23')](_0x3f80f7[_0xeed3('0x24')],{'raw':_0x3f80f7[_0xeed3('0x19')]?_0x3f80f7[_0xeed3('0x19')][_0xeed3('0x1a')]===undefined?!![]:![]:!![]})[_0xeed3('0xb')](function(_0x146edb){logger[_0xeed3('0xc')](_0xeed3('0x25'),_0x3f80f7);logger[_0xeed3('0xe')](_0xeed3('0x25'),_0x3f80f7,JSON[_0xeed3('0x10')](_0x146edb));_0x2c15a3(_0x146edb);})['catch'](function(_0x1ac8aa){logger[_0xeed3('0x11')]('CreateCmHopper',_0x1ac8aa[_0xeed3('0x13')],_0x3f80f7);_0x58420d(_0x4ba216[_0xeed3('0x11')](0x1f4,_0x1ac8aa[_0xeed3('0x13')]));});});};exports[_0xeed3('0x26')]=function(_0x32eb0c){var _0x36309d=this;return new Promise(function(_0x461610,_0x4121a0){return db['CmHopper'][_0xeed3('0x27')](_0x32eb0c[_0xeed3('0x24')],{'raw':_0x32eb0c['options']?_0x32eb0c[_0xeed3('0x19')][_0xeed3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32eb0c[_0xeed3('0x19')]?_0x32eb0c['options'][_0xeed3('0x1b')]||null:null,'attributes':_0x32eb0c[_0xeed3('0x19')]?_0x32eb0c[_0xeed3('0x19')][_0xeed3('0x1c')]||null:null,'limit':_0x32eb0c[_0xeed3('0x19')]?_0x32eb0c['options'][_0xeed3('0x1d')]||null:null})['then'](function(_0x2e08b2){logger[_0xeed3('0xc')](_0xeed3('0x26'),_0x32eb0c);logger[_0xeed3('0xe')](_0xeed3('0x26'),_0x32eb0c,JSON[_0xeed3('0x10')](_0x2e08b2));_0x461610(_0x2e08b2);})[_0xeed3('0x28')](function(_0x2b6ba3){logger[_0xeed3('0x11')](_0xeed3('0x26'),_0x2b6ba3[_0xeed3('0x13')],_0x32eb0c);_0x4121a0(_0x36309d[_0xeed3('0x11')](0x1f4,_0x2b6ba3[_0xeed3('0x13')]));});});};exports[_0xeed3('0x29')]=function(_0x17955c){var _0x4194b0=this;return new Promise(function(_0x49cf6b,_0x4f9fe1){return db[_0xeed3('0x17')]['destroy']({'where':_0x17955c[_0xeed3('0x19')]?_0x17955c[_0xeed3('0x19')][_0xeed3('0x1b')]||null:null})[_0xeed3('0xb')](function(_0x4a2605){logger['info'](_0xeed3('0x29'),_0x17955c);logger[_0xeed3('0xe')](_0xeed3('0x29'),_0x17955c,JSON[_0xeed3('0x10')](_0x4a2605));_0x49cf6b(_0x4a2605);})['catch'](function(_0x2758a1){logger[_0xeed3('0x11')](_0xeed3('0x29'),_0x2758a1[_0xeed3('0x13')],_0x17955c);_0x4f9fe1(_0x4194b0[_0xeed3('0x11')](0x1f4,_0x2758a1['message']));});});};exports[_0xeed3('0x2a')]=function(_0x4e2f38){var _0x57d614=this;return new Promise(function(_0x4208ac,_0x44fb28){return db[_0xeed3('0x2b')][_0xeed3('0x2c')]()[_0xeed3('0xb')](function(_0x3836bd){return db[_0xeed3('0x2d')][_0xeed3('0x2e')](function(_0x580255){return db['CmHopper'][_0xeed3('0x18')]({'where':_0x4e2f38['options']?_0x4e2f38['options'][_0xeed3('0x1b')]||null:null,'attributes':_0x4e2f38[_0xeed3('0x19')]?_0x4e2f38['options'][_0xeed3('0x1c')]||null:null,'limit':_0x4e2f38[_0xeed3('0x19')]?_0x4e2f38[_0xeed3('0x19')][_0xeed3('0x1d')]||null:null,'order':_0x4e2f38['options']?_0x4e2f38['options']['order']||null:null,'transaction':_0x580255,'lock':_0x580255[_0xeed3('0x2f')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xeed3('0x30'),'attributes':_[_0xeed3('0x31')](_0x3836bd)},{'model':db[_0xeed3('0x32')],'as':_0xeed3('0x33'),'attributes':['id',_0xeed3('0x34'),_0xeed3('0x35')]}]})['then'](function(_0x3cde5b){var _0x4678cf=[];var _0x3e8450=[];for(var _0x12034c=0x0;_0x12034c<_0x3cde5b['length'];_0x12034c+=0x1){if(!_0x3e8450[_0xeed3('0x36')](_0x3cde5b[_0x12034c][_0xeed3('0x37')])){_0x3e8450[_0xeed3('0x38')](_0x3cde5b[_0x12034c][_0xeed3('0x37')]);_0x4678cf['push'](_0x3cde5b[_0x12034c]['update'](_0x4e2f38['body'],{'transaction':_0x580255}));}}return BPromise[_0xeed3('0x39')](_0x4678cf);});})[_0xeed3('0xb')](function(_0x5ea6fd){logger[_0xeed3('0xc')]('GetContactDialer',_0x4e2f38);logger[_0xeed3('0xe')]('GetContactDialer',_0x4e2f38,JSON[_0xeed3('0x10')](_0x5ea6fd));_0x4208ac(_0x5ea6fd);})[_0xeed3('0x28')](function(_0x49c204){logger[_0xeed3('0x11')](_0xeed3('0x2a'),_0x49c204['message'],_0x4e2f38);_0x44fb28(_0x57d614[_0xeed3('0x11')](0x1f4,_0x49c204[_0xeed3('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x2f1aaf){var _0x535796=this;return new Promise(function(_0x5db85e,_0x295dab){return db['sequelize']['transaction'](function(_0x41cbd7){return db[_0xeed3('0x3a')][_0xeed3('0x23')](_0x2f1aaf['body'],{'raw':_0x2f1aaf[_0xeed3('0x19')]?_0x2f1aaf[_0xeed3('0x19')][_0xeed3('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x41cbd7})[_0xeed3('0xb')](function(){return db[_0xeed3('0x17')][_0xeed3('0x3b')]({'where':_0x2f1aaf['options']?_0x2f1aaf[_0xeed3('0x19')]['where']||null:null,'transaction':_0x41cbd7});});})[_0xeed3('0xb')](function(_0x3dab80){logger[_0xeed3('0xc')](_0xeed3('0x3c'),_0x2f1aaf);logger[_0xeed3('0xe')](_0xeed3('0x3c'),_0x2f1aaf,JSON[_0xeed3('0x10')](_0x3dab80));_0x5db85e(_0x3dab80);})[_0xeed3('0x28')](function(_0x26eced){logger[_0xeed3('0x11')]('MoveContactManagedDialer',_0x26eced[_0xeed3('0x13')],_0x2f1aaf);_0x295dab(_0x535796[_0xeed3('0x11')](0x1f4,_0x26eced[_0xeed3('0x13')]));});});};exports['CountReScheduled']=function(_0x36711e){var _0x7ba370=this;return new Promise(function(_0x14e4ca,_0x5ed2a9){return db[_0xeed3('0x17')][_0xeed3('0x18')]({'raw':_0x36711e[_0xeed3('0x19')]?_0x36711e[_0xeed3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x36711e[_0xeed3('0x19')]?_0x36711e[_0xeed3('0x19')][_0xeed3('0x1b')]||null:null,'attributes':[[db[_0xeed3('0x2d')]['fn'](_0xeed3('0x3d'),db[_0xeed3('0x2d')]['fn']('IF',db[_0xeed3('0x2d')][_0xeed3('0x3e')]('`scheduledat`\x20>=\x20'+util[_0xeed3('0x3f')](_0xeed3('0x40'),moment()[_0xeed3('0x3f')](_0xeed3('0x41')))+_0xeed3('0x42')))),_0xeed3('0x43')]]})['then'](function(_0x318a7b){logger['info']('CountReScheduled',_0x36711e);logger[_0xeed3('0xe')]('CountReScheduled',_0x36711e,JSON[_0xeed3('0x10')](_0x318a7b));_0x14e4ca(_0x318a7b);})['catch'](function(_0x100af9){logger['error'](_0xeed3('0x44'),_0x100af9[_0xeed3('0x13')],_0x36711e);_0x5ed2a9(_0x7ba370[_0xeed3('0x11')](0x1f4,_0x100af9[_0xeed3('0x13')]));});});};exports[_0xeed3('0x45')]=function(_0x2246d5){var _0xcc2e8b=this;return new Promise(function(_0x522651,_0x2d477d){return db[_0xeed3('0x2b')]['describe']()[_0xeed3('0xb')](function(_0xbd31a0){return db[_0xeed3('0x2d')][_0xeed3('0x2e')](function(_0x27f6f6){return db[_0xeed3('0x17')]['findAll']({'where':_0x2246d5[_0xeed3('0x19')]?_0x2246d5[_0xeed3('0x19')]['where']||null:null,'attributes':_0x2246d5[_0xeed3('0x19')]?_0x2246d5[_0xeed3('0x19')][_0xeed3('0x1c')]||null:null,'limit':0x1,'order':_0x2246d5['options']?_0x2246d5[_0xeed3('0x19')][_0xeed3('0x46')]||null:null,'group':db[_0xeed3('0x17')]['UserId'],'transaction':_0x27f6f6,'lock':_0x27f6f6[_0xeed3('0x2f')][_0xeed3('0x47')],'include':_0x2246d5[_0xeed3('0x19')]?_0x2246d5[_0xeed3('0x19')][_0xeed3('0x1f')]?_[_0xeed3('0x1e')](_0x2246d5[_0xeed3('0x19')][_0xeed3('0x1f')],function(_0x382b77){return{'model':db[_0x382b77[_0xeed3('0x20')]],'as':_0x382b77['as'],'attributes':_0x382b77[_0xeed3('0x1c')],'include':_0x382b77['include']?_[_0xeed3('0x1e')](_0x382b77[_0xeed3('0x1f')],function(_0x16eb5c){return{'model':db[_0x16eb5c[_0xeed3('0x20')]],'as':_0x16eb5c['as'],'attributes':_0x16eb5c['attributes'],'include':_0x16eb5c[_0xeed3('0x1f')]?_[_0xeed3('0x1e')](_0x16eb5c[_0xeed3('0x1f')],function(_0x28182f){return{'model':db[_0x28182f[_0xeed3('0x20')]],'as':_0x28182f['as'],'attributes':_0x28182f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee337){var _0x56c44b=[];for(var _0x3c234e=0x0;_0x3c234e<_0x4ee337[_0xeed3('0x48')];_0x3c234e+=0x1){_0x56c44b[_0xeed3('0x38')](_0x4ee337[_0x3c234e][_0xeed3('0x27')](_0x2246d5[_0xeed3('0x24')],{'transaction':_0x27f6f6}));}return BPromise[_0xeed3('0x39')](_0x56c44b);});})[_0xeed3('0xb')](function(_0x56cfd2){logger['info']('GetContactRecallMe',_0x2246d5);logger[_0xeed3('0xe')]('GetContactRecallMe',_0x2246d5,JSON['stringify'](_0x56cfd2));_0x522651(_0x56cfd2);})[_0xeed3('0x28')](function(_0x9a43ce){logger['error'](_0xeed3('0x45'),_0x9a43ce[_0xeed3('0x13')],_0x2246d5);_0x2d477d(_0xcc2e8b[_0xeed3('0x11')](0x1f4,_0x9a43ce[_0xeed3('0x13')]));});});});};exports[_0xeed3('0x49')]=function(_0x4d5d15){var _0x5cc11f=this;return new Promise(function(_0x3532fa,_0x3dc3e8){db[_0xeed3('0x2b')][_0xeed3('0x2c')]()[_0xeed3('0xb')](function(_0x267133){return db[_0xeed3('0x17')][_0xeed3('0x18')]({'raw':_0x4d5d15['options']?_0x4d5d15['options'][_0xeed3('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d5d15[_0xeed3('0x19')]?_0x4d5d15[_0xeed3('0x19')]['where']||null:null,'attributes':_0x4d5d15['options']?_0x4d5d15[_0xeed3('0x19')][_0xeed3('0x1c')]||null:null,'limit':_0x4d5d15[_0xeed3('0x19')]?_0x4d5d15[_0xeed3('0x19')][_0xeed3('0x1d')]||null:null,'include':_0x4d5d15[_0xeed3('0x19')]?_0x4d5d15[_0xeed3('0x19')]['include']?_[_0xeed3('0x1e')](_0x4d5d15[_0xeed3('0x19')]['include'],function(_0x2cb8ad){return{'model':db[_0x2cb8ad[_0xeed3('0x20')]],'as':_0x2cb8ad['as'],'attributes':_0x2cb8ad['as']===_0xeed3('0x30')?_['keys'](_0x267133):_0x2cb8ad[_0xeed3('0x1c')],'include':_0x2cb8ad[_0xeed3('0x1f')]?_[_0xeed3('0x1e')](_0x2cb8ad['include'],function(_0x23b029){return{'model':db[_0x23b029[_0xeed3('0x20')]],'as':_0x23b029['as'],'attributes':_0x23b029[_0xeed3('0x1c')],'include':_0x23b029['include']?_[_0xeed3('0x1e')](_0x23b029[_0xeed3('0x1f')],function(_0xb31e00){return{'model':db[_0xb31e00[_0xeed3('0x20')]],'as':_0xb31e00['as'],'attributes':_0xb31e00['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11da87){logger['info'](_0xeed3('0x16'),_0x4d5d15);logger[_0xeed3('0xe')](_0xeed3('0x16'),_0x4d5d15,JSON[_0xeed3('0x10')](_0x11da87));_0x3532fa(_0x11da87);})[_0xeed3('0x28')](function(_0x4d5619){logger[_0xeed3('0x11')](_0xeed3('0x16'),_0x4d5619[_0xeed3('0x13')],_0x4d5d15);_0x3dc3e8(_0x5cc11f[_0xeed3('0x11')](0x1f4,_0x4d5619[_0xeed3('0x13')]));});});});}; \ No newline at end of file +var _0xff83=['UserId','push','MoveContactManagedDialer','CmHopperFinal','create','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','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','limit','include','map','model','attributes','ShowCmHopper','find','CreateCmHopper','body','raw','UpdateCmHopper','update','where','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','UPDATE','keys','User','Agent','name','voicePause','length','includes'];(function(_0xb7a7d2,_0x5ba4bd){var _0x4fc367=function(_0x5eeaec){while(--_0x5eeaec){_0xb7a7d2['push'](_0xb7a7d2['shift']());}};_0x4fc367(++_0x5ba4bd);}(_0xff83,0x167));var _0x3ff8=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xff83[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x3ff8('0x0'));var util=require(_0x3ff8('0x1'));var moment=require('moment');var BPromise=require(_0x3ff8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ff8('0x3'));var db=require(_0x3ff8('0x4'))['db'];var utils=require(_0x3ff8('0x5'));var logger=require('../../config/logger')(_0x3ff8('0x6'));var config=require(_0x3ff8('0x7'));var jayson=require(_0x3ff8('0x8'));var client=jayson[_0x3ff8('0x9')][_0x3ff8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f39f0,_0x83a2e8,_0x50407c){return new BPromise(function(_0x5aba9b,_0x18f6e5){return client['request'](_0x5f39f0,_0x50407c)[_0x3ff8('0xb')](function(_0x161423){logger[_0x3ff8('0xc')](_0x3ff8('0xd'),_0x83a2e8,_0x3ff8('0xe'));logger[_0x3ff8('0xf')](_0x3ff8('0x10'),_0x83a2e8,_0x3ff8('0xe'),JSON[_0x3ff8('0x11')](_0x161423));if(_0x161423[_0x3ff8('0x12')]){if(_0x161423[_0x3ff8('0x12')][_0x3ff8('0x13')]===0x1f4){logger[_0x3ff8('0x12')](_0x3ff8('0xd'),_0x83a2e8,_0x161423[_0x3ff8('0x12')]['message']);return _0x18f6e5(_0x161423[_0x3ff8('0x12')][_0x3ff8('0x14')]);}logger['error'](_0x3ff8('0xd'),_0x83a2e8,_0x161423['error'][_0x3ff8('0x14')]);return _0x5aba9b(_0x161423[_0x3ff8('0x12')]['message']);}else{logger['info'](_0x3ff8('0xd'),_0x83a2e8,_0x3ff8('0xe'));_0x5aba9b(_0x161423['result'][_0x3ff8('0x14')]);}})[_0x3ff8('0x15')](function(_0x31b77d){logger[_0x3ff8('0x12')](_0x3ff8('0xd'),_0x83a2e8,_0x31b77d);_0x18f6e5(_0x31b77d);});});}exports[_0x3ff8('0x16')]=function(_0x1fc663){var _0x19ec36=this;return new Promise(function(_0x3f8ed3,_0x3aa9b7){return db[_0x3ff8('0x17')][_0x3ff8('0x18')]({'raw':_0x1fc663[_0x3ff8('0x19')]?_0x1fc663[_0x3ff8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1fc663[_0x3ff8('0x19')]?_0x1fc663[_0x3ff8('0x19')]['where']||null:null,'attributes':_0x1fc663[_0x3ff8('0x19')]?_0x1fc663[_0x3ff8('0x19')]['attributes']||null:null,'limit':_0x1fc663[_0x3ff8('0x19')]?_0x1fc663[_0x3ff8('0x19')][_0x3ff8('0x1a')]||null:null,'include':_0x1fc663[_0x3ff8('0x19')]?_0x1fc663[_0x3ff8('0x19')][_0x3ff8('0x1b')]?_[_0x3ff8('0x1c')](_0x1fc663[_0x3ff8('0x19')]['include'],function(_0x34c8ce){return{'model':db[_0x34c8ce[_0x3ff8('0x1d')]],'as':_0x34c8ce['as'],'attributes':_0x34c8ce[_0x3ff8('0x1e')],'include':_0x34c8ce[_0x3ff8('0x1b')]?_['map'](_0x34c8ce[_0x3ff8('0x1b')],function(_0x5087bf){return{'model':db[_0x5087bf[_0x3ff8('0x1d')]],'as':_0x5087bf['as'],'attributes':_0x5087bf[_0x3ff8('0x1e')],'include':_0x5087bf[_0x3ff8('0x1b')]?_['map'](_0x5087bf[_0x3ff8('0x1b')],function(_0xbf1208){return{'model':db[_0xbf1208[_0x3ff8('0x1d')]],'as':_0xbf1208['as'],'attributes':_0xbf1208[_0x3ff8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3ff8('0xb')](function(_0x383594){logger['info']('GetCmHopper',_0x1fc663);logger[_0x3ff8('0xf')](_0x3ff8('0x16'),_0x1fc663,JSON['stringify'](_0x383594));_0x3f8ed3(_0x383594);})[_0x3ff8('0x15')](function(_0x427ec8){logger[_0x3ff8('0x12')]('GetCmHopper',_0x427ec8[_0x3ff8('0x14')],_0x1fc663);_0x3aa9b7(_0x19ec36[_0x3ff8('0x12')](0x1f4,_0x427ec8['message']));});});};exports[_0x3ff8('0x1f')]=function(_0x3ad76e){var _0x39dc62=this;return new Promise(function(_0x463ca5,_0x128229){return db[_0x3ff8('0x17')][_0x3ff8('0x20')]({'raw':_0x3ad76e[_0x3ff8('0x19')]?_0x3ad76e[_0x3ff8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3ad76e[_0x3ff8('0x19')]?_0x3ad76e[_0x3ff8('0x19')]['where']||null:null,'attributes':_0x3ad76e['options']?_0x3ad76e[_0x3ff8('0x19')][_0x3ff8('0x1e')]||null:null,'include':_0x3ad76e['options']?_0x3ad76e['options'][_0x3ff8('0x1b')]?_[_0x3ff8('0x1c')](_0x3ad76e[_0x3ff8('0x19')]['include'],function(_0x5b5fde){return{'model':db[_0x5b5fde[_0x3ff8('0x1d')]],'as':_0x5b5fde['as'],'attributes':_0x5b5fde[_0x3ff8('0x1e')],'include':_0x5b5fde['include']?_[_0x3ff8('0x1c')](_0x5b5fde['include'],function(_0x1246cd){return{'model':db[_0x1246cd['model']],'as':_0x1246cd['as'],'attributes':_0x1246cd[_0x3ff8('0x1e')],'include':_0x1246cd[_0x3ff8('0x1b')]?_['map'](_0x1246cd[_0x3ff8('0x1b')],function(_0x2c923a){return{'model':db[_0x2c923a[_0x3ff8('0x1d')]],'as':_0x2c923a['as'],'attributes':_0x2c923a[_0x3ff8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5659d9){logger['info'](_0x3ff8('0x1f'),_0x3ad76e);logger[_0x3ff8('0xf')](_0x3ff8('0x1f'),_0x3ad76e,JSON[_0x3ff8('0x11')](_0x5659d9));_0x463ca5(_0x5659d9);})[_0x3ff8('0x15')](function(_0x2f1ea0){logger[_0x3ff8('0x12')](_0x3ff8('0x1f'),_0x2f1ea0[_0x3ff8('0x14')],_0x3ad76e);_0x128229(_0x39dc62[_0x3ff8('0x12')](0x1f4,_0x2f1ea0[_0x3ff8('0x14')]));});});};exports[_0x3ff8('0x21')]=function(_0x788c85){var _0x5c1bf0=this;return new Promise(function(_0x88f898,_0x56cf37){return db[_0x3ff8('0x17')]['create'](_0x788c85[_0x3ff8('0x22')],{'raw':_0x788c85['options']?_0x788c85[_0x3ff8('0x19')][_0x3ff8('0x23')]===undefined?!![]:![]:!![]})[_0x3ff8('0xb')](function(_0x39b159){logger['info']('CreateCmHopper',_0x788c85);logger['debug']('CreateCmHopper',_0x788c85,JSON[_0x3ff8('0x11')](_0x39b159));_0x88f898(_0x39b159);})[_0x3ff8('0x15')](function(_0x5c99de){logger[_0x3ff8('0x12')](_0x3ff8('0x21'),_0x5c99de[_0x3ff8('0x14')],_0x788c85);_0x56cf37(_0x5c1bf0['error'](0x1f4,_0x5c99de[_0x3ff8('0x14')]));});});};exports[_0x3ff8('0x24')]=function(_0x4ceb6f){var _0x3684d5=this;return new Promise(function(_0x434938,_0x338099){return db[_0x3ff8('0x17')][_0x3ff8('0x25')](_0x4ceb6f[_0x3ff8('0x22')],{'raw':_0x4ceb6f[_0x3ff8('0x19')]?_0x4ceb6f[_0x3ff8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ceb6f[_0x3ff8('0x19')]?_0x4ceb6f['options'][_0x3ff8('0x26')]||null:null,'attributes':_0x4ceb6f['options']?_0x4ceb6f[_0x3ff8('0x19')][_0x3ff8('0x1e')]||null:null,'limit':_0x4ceb6f['options']?_0x4ceb6f['options'][_0x3ff8('0x1a')]||null:null})['then'](function(_0x42e323){logger[_0x3ff8('0xc')](_0x3ff8('0x24'),_0x4ceb6f);logger[_0x3ff8('0xf')](_0x3ff8('0x24'),_0x4ceb6f,JSON[_0x3ff8('0x11')](_0x42e323));_0x434938(_0x42e323);})[_0x3ff8('0x15')](function(_0x3803dd){logger[_0x3ff8('0x12')]('UpdateCmHopper',_0x3803dd['message'],_0x4ceb6f);_0x338099(_0x3684d5[_0x3ff8('0x12')](0x1f4,_0x3803dd[_0x3ff8('0x14')]));});});};exports[_0x3ff8('0x27')]=function(_0xa1aa9d){var _0x118130=this;return new Promise(function(_0x309b1a,_0x2484a2){return db[_0x3ff8('0x17')][_0x3ff8('0x28')]({'where':_0xa1aa9d[_0x3ff8('0x19')]?_0xa1aa9d[_0x3ff8('0x19')][_0x3ff8('0x26')]||null:null})[_0x3ff8('0xb')](function(_0x9bc85){logger[_0x3ff8('0xc')](_0x3ff8('0x27'),_0xa1aa9d);logger[_0x3ff8('0xf')](_0x3ff8('0x27'),_0xa1aa9d,JSON[_0x3ff8('0x11')](_0x9bc85));_0x309b1a(_0x9bc85);})[_0x3ff8('0x15')](function(_0x511cf8){logger[_0x3ff8('0x12')]('DestroyCmHopper',_0x511cf8[_0x3ff8('0x14')],_0xa1aa9d);_0x2484a2(_0x118130['error'](0x1f4,_0x511cf8[_0x3ff8('0x14')]));});});};exports[_0x3ff8('0x29')]=function(_0x45243c){var _0xb8aeff=this;return new Promise(function(_0x212221,_0x3f6a23){return db[_0x3ff8('0x2a')][_0x3ff8('0x2b')]()[_0x3ff8('0xb')](function(_0x2b9849){return db[_0x3ff8('0x2c')][_0x3ff8('0x2d')](function(_0xdc3102){return db['CmHopper'][_0x3ff8('0x18')]({'where':_0x45243c[_0x3ff8('0x19')]?_0x45243c[_0x3ff8('0x19')]['where']||null:null,'attributes':_0x45243c[_0x3ff8('0x19')]?_0x45243c[_0x3ff8('0x19')][_0x3ff8('0x1e')]||null:null,'limit':_0x45243c[_0x3ff8('0x19')]?_0x45243c[_0x3ff8('0x19')][_0x3ff8('0x1a')]||null:null,'order':_0x45243c[_0x3ff8('0x19')]?_0x45243c[_0x3ff8('0x19')][_0x3ff8('0x2e')]||null:null,'transaction':_0xdc3102,'lock':_0xdc3102['LOCK'][_0x3ff8('0x2f')],'include':[{'model':db[_0x3ff8('0x2a')],'as':'Contact','attributes':_[_0x3ff8('0x30')](_0x2b9849)},{'model':db[_0x3ff8('0x31')],'as':_0x3ff8('0x32'),'attributes':['id',_0x3ff8('0x33'),_0x3ff8('0x34')]}]})['then'](function(_0x41a527){var _0x3b36e4=[];var _0x561321=[];for(var _0x1f5a0a=0x0;_0x1f5a0a<_0x41a527[_0x3ff8('0x35')];_0x1f5a0a+=0x1){if(!_0x561321[_0x3ff8('0x36')](_0x41a527[_0x1f5a0a][_0x3ff8('0x37')])){_0x561321[_0x3ff8('0x38')](_0x41a527[_0x1f5a0a][_0x3ff8('0x37')]);_0x3b36e4['push'](_0x41a527[_0x1f5a0a][_0x3ff8('0x25')](_0x45243c[_0x3ff8('0x22')],{'transaction':_0xdc3102}));}}return BPromise['all'](_0x3b36e4);});})['then'](function(_0xd32aab){logger[_0x3ff8('0xc')]('GetContactDialer',_0x45243c);logger[_0x3ff8('0xf')]('GetContactDialer',_0x45243c,JSON[_0x3ff8('0x11')](_0xd32aab));_0x212221(_0xd32aab);})[_0x3ff8('0x15')](function(_0x3fb4c3){logger[_0x3ff8('0x12')]('GetContactDialer',_0x3fb4c3[_0x3ff8('0x14')],_0x45243c);_0x3f6a23(_0xb8aeff[_0x3ff8('0x12')](0x1f4,_0x3fb4c3['message']));});});});};exports[_0x3ff8('0x39')]=function(_0x7255af){var _0x1eaddc=this;return new Promise(function(_0x17ca4c,_0x1419e3){return db[_0x3ff8('0x2c')][_0x3ff8('0x2d')](function(_0x5871f6){return db[_0x3ff8('0x3a')][_0x3ff8('0x3b')](_0x7255af['body'],{'raw':_0x7255af[_0x3ff8('0x19')]?_0x7255af[_0x3ff8('0x19')][_0x3ff8('0x23')]===undefined?!![]:![]:!![],'transaction':_0x5871f6})[_0x3ff8('0xb')](function(){return db[_0x3ff8('0x17')]['destroy']({'where':_0x7255af[_0x3ff8('0x19')]?_0x7255af['options'][_0x3ff8('0x26')]||null:null,'transaction':_0x5871f6});});})[_0x3ff8('0xb')](function(_0x46249a){logger['info']('MoveContactManagedDialer',_0x7255af);logger[_0x3ff8('0xf')](_0x3ff8('0x39'),_0x7255af,JSON[_0x3ff8('0x11')](_0x46249a));_0x17ca4c(_0x46249a);})[_0x3ff8('0x15')](function(_0x25a98b){logger[_0x3ff8('0x12')](_0x3ff8('0x39'),_0x25a98b['message'],_0x7255af);_0x1419e3(_0x1eaddc[_0x3ff8('0x12')](0x1f4,_0x25a98b[_0x3ff8('0x14')]));});});};exports['CountReScheduled']=function(_0x5df866){var _0x6d9541=this;return new Promise(function(_0x5b1eea,_0x596b42){return db['CmHopper'][_0x3ff8('0x18')]({'raw':_0x5df866[_0x3ff8('0x19')]?_0x5df866[_0x3ff8('0x19')][_0x3ff8('0x23')]===undefined?!![]:![]:!![],'where':_0x5df866[_0x3ff8('0x19')]?_0x5df866[_0x3ff8('0x19')][_0x3ff8('0x26')]||null:null,'attributes':[[db[_0x3ff8('0x2c')]['fn'](_0x3ff8('0x3c'),db[_0x3ff8('0x2c')]['fn']('IF',db[_0x3ff8('0x2c')][_0x3ff8('0x3d')](_0x3ff8('0x3e')+util[_0x3ff8('0x3f')](_0x3ff8('0x40'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x3ff8('0x41')))),'contactsRescheduled']]})[_0x3ff8('0xb')](function(_0x597b25){logger[_0x3ff8('0xc')]('CountReScheduled',_0x5df866);logger[_0x3ff8('0xf')](_0x3ff8('0x42'),_0x5df866,JSON[_0x3ff8('0x11')](_0x597b25));_0x5b1eea(_0x597b25);})[_0x3ff8('0x15')](function(_0x3fa201){logger[_0x3ff8('0x12')](_0x3ff8('0x42'),_0x3fa201[_0x3ff8('0x14')],_0x5df866);_0x596b42(_0x6d9541[_0x3ff8('0x12')](0x1f4,_0x3fa201[_0x3ff8('0x14')]));});});};exports['GetContactRecallMe']=function(_0x55a963){var _0x50fd13=this;return new Promise(function(_0x5103ef,_0x26b58b){return db['CmContact'][_0x3ff8('0x2b')]()[_0x3ff8('0xb')](function(_0x12e793){return db[_0x3ff8('0x2c')][_0x3ff8('0x2d')](function(_0x452789){return db[_0x3ff8('0x17')]['findAll']({'where':_0x55a963[_0x3ff8('0x19')]?_0x55a963[_0x3ff8('0x19')][_0x3ff8('0x26')]||null:null,'attributes':_0x55a963['options']?_0x55a963[_0x3ff8('0x19')][_0x3ff8('0x1e')]||null:null,'limit':0x1,'order':_0x55a963[_0x3ff8('0x19')]?_0x55a963[_0x3ff8('0x19')][_0x3ff8('0x2e')]||null:null,'group':db[_0x3ff8('0x17')]['UserId'],'transaction':_0x452789,'lock':_0x452789['LOCK'][_0x3ff8('0x2f')],'include':_0x55a963[_0x3ff8('0x19')]?_0x55a963[_0x3ff8('0x19')][_0x3ff8('0x1b')]?_['map'](_0x55a963['options'][_0x3ff8('0x1b')],function(_0x3a2fad){return{'model':db[_0x3a2fad[_0x3ff8('0x1d')]],'as':_0x3a2fad['as'],'attributes':_0x3a2fad[_0x3ff8('0x1e')],'include':_0x3a2fad['include']?_[_0x3ff8('0x1c')](_0x3a2fad['include'],function(_0x4d7222){return{'model':db[_0x4d7222[_0x3ff8('0x1d')]],'as':_0x4d7222['as'],'attributes':_0x4d7222[_0x3ff8('0x1e')],'include':_0x4d7222[_0x3ff8('0x1b')]?_['map'](_0x4d7222[_0x3ff8('0x1b')],function(_0x11e868){return{'model':db[_0x11e868['model']],'as':_0x11e868['as'],'attributes':_0x11e868[_0x3ff8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3ff8('0xb')](function(_0x2b8988){var _0x33a3b0=[];for(var _0x5ababe=0x0;_0x5ababe<_0x2b8988[_0x3ff8('0x35')];_0x5ababe+=0x1){_0x33a3b0[_0x3ff8('0x38')](_0x2b8988[_0x5ababe]['update'](_0x55a963['body'],{'transaction':_0x452789}));}return BPromise['all'](_0x33a3b0);});})['then'](function(_0x1ac946){logger['info'](_0x3ff8('0x43'),_0x55a963);logger[_0x3ff8('0xf')](_0x3ff8('0x43'),_0x55a963,JSON[_0x3ff8('0x11')](_0x1ac946));_0x5103ef(_0x1ac946);})[_0x3ff8('0x15')](function(_0x2a184a){logger[_0x3ff8('0x12')]('GetContactRecallMe',_0x2a184a[_0x3ff8('0x14')],_0x55a963);_0x26b58b(_0x50fd13[_0x3ff8('0x12')](0x1f4,_0x2a184a[_0x3ff8('0x14')]));});});});};exports[_0x3ff8('0x44')]=function(_0x3b2098){var _0x1506d5=this;return new Promise(function(_0x201120,_0x2d5dd3){db[_0x3ff8('0x2a')][_0x3ff8('0x2b')]()[_0x3ff8('0xb')](function(_0x342d2f){return db[_0x3ff8('0x17')][_0x3ff8('0x18')]({'raw':_0x3b2098[_0x3ff8('0x19')]?_0x3b2098[_0x3ff8('0x19')][_0x3ff8('0x23')]===undefined?!![]:![]:!![],'where':_0x3b2098[_0x3ff8('0x19')]?_0x3b2098['options'][_0x3ff8('0x26')]||null:null,'attributes':_0x3b2098[_0x3ff8('0x19')]?_0x3b2098['options'][_0x3ff8('0x1e')]||null:null,'limit':_0x3b2098[_0x3ff8('0x19')]?_0x3b2098['options']['limit']||null:null,'include':_0x3b2098[_0x3ff8('0x19')]?_0x3b2098[_0x3ff8('0x19')]['include']?_['map'](_0x3b2098['options'][_0x3ff8('0x1b')],function(_0x2889ad){return{'model':db[_0x2889ad['model']],'as':_0x2889ad['as'],'attributes':_0x2889ad['as']==='Contact'?_[_0x3ff8('0x30')](_0x342d2f):_0x2889ad['attributes'],'include':_0x2889ad[_0x3ff8('0x1b')]?_['map'](_0x2889ad['include'],function(_0x43fd60){return{'model':db[_0x43fd60[_0x3ff8('0x1d')]],'as':_0x43fd60['as'],'attributes':_0x43fd60[_0x3ff8('0x1e')],'include':_0x43fd60[_0x3ff8('0x1b')]?_['map'](_0x43fd60['include'],function(_0x2af6b2){return{'model':db[_0x2af6b2['model']],'as':_0x2af6b2['as'],'attributes':_0x2af6b2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ff8('0xb')](function(_0x4adff9){logger[_0x3ff8('0xc')](_0x3ff8('0x16'),_0x3b2098);logger[_0x3ff8('0xf')]('GetCmHopper',_0x3b2098,JSON[_0x3ff8('0x11')](_0x4adff9));_0x201120(_0x4adff9);})['catch'](function(_0x3ba466){logger[_0x3ff8('0x12')](_0x3ff8('0x16'),_0x3ba466[_0x3ff8('0x14')],_0x3b2098);_0x2d5dd3(_0x1506d5[_0x3ff8('0x12')](0x1f4,_0x3ba466[_0x3ff8('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c24130f..47ac8bd 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 _0x9d5b=['getOpenContacts','show','create','post','/preview','getPreview','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x3f7154,_0x57def0){_0x3f7154=_0x3f7154-0x0;var _0x2baa0=_0x9d5b[_0x3f7154];return _0x2baa0;};'use strict';var multer=require('multer');var util=require(_0xb9d5('0x0'));var path=require(_0xb9d5('0x1'));var timeout=require(_0xb9d5('0x2'));var express=require(_0xb9d5('0x3'));var router=express[_0xb9d5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9d5('0x5'));var config=require('../../config/environment');var controller=require(_0xb9d5('0x6'));router[_0xb9d5('0x7')]('/',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x9')]);router[_0xb9d5('0x7')]('/describe',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xa')]);router['get'](_0xb9d5('0xb'),auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xc')]);router[_0xb9d5('0x7')]('/:id',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xd')]);router['post']('/',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0xe')]);router[_0xb9d5('0xf')](_0xb9d5('0x10'),auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x11')]);router[_0xb9d5('0x12')](_0xb9d5('0x13'),auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x14')]);router[_0xb9d5('0x15')]('/:id',auth[_0xb9d5('0x8')](),controller[_0xb9d5('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3c8e=['Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/:id','show','create','post','put','update','delete','destroy','exports','multer','util','express'];(function(_0x3cb306,_0x319bf9){var _0x172aea=function(_0x3f5eba){while(--_0x3f5eba){_0x3cb306['push'](_0x3cb306['shift']());}};_0x172aea(++_0x319bf9);}(_0x3c8e,0x89));var _0xe3c8=function(_0x167ebd,_0x41c30e){_0x167ebd=_0x167ebd-0x0;var _0x501e34=_0x3c8e[_0x167ebd];return _0x501e34;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3c8('0x2'));var router=express[_0xe3c8('0x3')]();var auth=require(_0xe3c8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe3c8('0x5'));var controller=require(_0xe3c8('0x6'));router[_0xe3c8('0x7')]('/',auth[_0xe3c8('0x8')](),controller['index']);router[_0xe3c8('0x7')](_0xe3c8('0x9'),auth[_0xe3c8('0x8')](),controller[_0xe3c8('0xa')]);router[_0xe3c8('0x7')]('/opencontacts',auth[_0xe3c8('0x8')](),controller['getOpenContacts']);router[_0xe3c8('0x7')](_0xe3c8('0xb'),auth[_0xe3c8('0x8')](),controller[_0xe3c8('0xc')]);router['post']('/',auth[_0xe3c8('0x8')](),controller[_0xe3c8('0xd')]);router[_0xe3c8('0xe')]('/preview',auth[_0xe3c8('0x8')](),controller['getPreview']);router[_0xe3c8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe3c8('0x10')]);router[_0xe3c8('0x11')](_0xe3c8('0xb'),auth['isAuthenticated'](),controller[_0xe3c8('0x12')]);module[_0xe3c8('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 7b679ac..559b2fe 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 _0x6210=['INTEGER','moment','sequelize','contactListQueue'];(function(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0x6210,0x71));var _0x0621=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x6210[_0x119d5a];return _0x15bff4;};'use strict';var moment=require(_0x0621('0x0'));var Sequelize=require(_0x0621('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x0621('0x2')},'ListId':{'type':Sequelize[_0x0621('0x3')],'unique':_0x0621('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x0621('0x2')}}; \ No newline at end of file +var _0x8d78=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x59f3e9,_0x1006b6){var _0x3b639d=function(_0x5b3d15){while(--_0x5b3d15){_0x59f3e9['push'](_0x59f3e9['shift']());}};_0x3b639d(++_0x1006b6);}(_0x8d78,0x68));var _0x88d7=function(_0xef7f3b,_0x4f689f){_0xef7f3b=_0xef7f3b-0x0;var _0x5bc9e3=_0x8d78[_0xef7f3b];return _0x5bc9e3;};'use strict';var moment=require(_0x88d7('0x0'));var Sequelize=require(_0x88d7('0x1'));module[_0x88d7('0x2')]={'phone':{'type':Sequelize[_0x88d7('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x88d7('0x4')],'unique':_0x88d7('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x88d7('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index d5ad518..6eb2dbb 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 _0xce8a=['keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','rows','catch','show','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','model','query'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xce8a,0x13b));var _0xace8=function(_0x3ebda0,_0x52ed01){_0x3ebda0=_0x3ebda0-0x0;var _0x29828b=_0xce8a[_0x3ebda0];return _0x29828b;};'use strict';var pdf=require(_0xace8('0x0'));var emlformat=require(_0xace8('0x1'));var rimraf=require(_0xace8('0x2'));var zipdir=require(_0xace8('0x3'));var jsonpatch=require(_0xace8('0x4'));var rp=require(_0xace8('0x5'));var moment=require(_0xace8('0x6'));var BPromise=require(_0xace8('0x7'));var Mustache=require('mustache');var util=require(_0xace8('0x8'));var path=require(_0xace8('0x9'));var sox=require('sox');var csv=require(_0xace8('0xa'));var ejs=require(_0xace8('0xb'));var fs=require('fs');var _=require(_0xace8('0xc'));var squel=require(_0xace8('0xd'));var crypto=require(_0xace8('0xe'));var jsforce=require(_0xace8('0xf'));var deskjs=require(_0xace8('0x10'));var toCsv=require(_0xace8('0xa'));var querystring=require(_0xace8('0x11'));var Papa=require(_0xace8('0x12'));var Redis=require('ioredis');var authService=require(_0xace8('0x13'));var qs=require(_0xace8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xace8('0x15'));var utils=require(_0xace8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xace8('0x17'));var db=require(_0xace8('0x18'))['db'];function respondWithStatusCode(_0x19d4c9,_0x3e75e4){_0x3e75e4=_0x3e75e4||0xcc;return function(_0x3f5019){if(_0x3f5019){return _0x19d4c9[_0xace8('0x19')](_0x3e75e4);}return _0x19d4c9[_0xace8('0x1a')](_0x3e75e4)[_0xace8('0x1b')]();};}function respondWithResult(_0x48731a,_0x50bea5){_0x50bea5=_0x50bea5||0xc8;return function(_0x5f271a){if(_0x5f271a){return _0x48731a[_0xace8('0x1a')](_0x50bea5)[_0xace8('0x1c')](_0x5f271a);}};}function respondWithFilteredResult(_0x3fdc7b,_0x55bc40){return function(_0x1e3b42){if(_0x1e3b42){var _0x514e45=_0x1e3b42[_0xace8('0x1d')],_0x313907=_0x55bc40[_0xace8('0x1e')],_0x12ae32=_0x55bc40[_0xace8('0x1e')]+_0x55bc40[_0xace8('0x1f')],_0x563ca2;if(_0x12ae32>=_0x514e45){_0x12ae32=_0x514e45;_0x563ca2=0xc8;}else{_0x563ca2=0xce;}_0x3fdc7b[_0xace8('0x1a')](_0x563ca2);return _0x3fdc7b[_0xace8('0x20')](_0xace8('0x21'),_0x313907+'-'+_0x12ae32+'/'+_0x514e45)[_0xace8('0x1c')](_0x1e3b42);}return null;};}function patchUpdates(_0xb4f063){return function(_0x48e54d){try{jsonpatch[_0xace8('0x22')](_0x48e54d,_0xb4f063,!![]);}catch(_0x506899){return BPromise[_0xace8('0x23')](_0x506899);}return _0x48e54d[_0xace8('0x24')]();};}function saveUpdates(_0x3d9689,_0x57a530){return function(_0x3b65c0){if(_0x3b65c0){return _0x3b65c0[_0xace8('0x25')](_0x3d9689)[_0xace8('0x26')](function(_0x5977a0){return _0x5977a0;});}return null;};}function removeEntity(_0x1a3656,_0x1d44db){return function(_0x442e13){if(_0x442e13){return _0x442e13[_0xace8('0x27')]()['then'](function(){_0x1a3656[_0xace8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb500,_0x13c12c){return function(_0x44c65a){if(!_0x44c65a){_0x2fb500[_0xace8('0x19')](0x194);}return _0x44c65a;};}function handleError(_0x25c855,_0x3ee3b7){_0x3ee3b7=_0x3ee3b7||0x1f4;return function(_0x29ed17){logger[_0xace8('0x28')](_0x29ed17[_0xace8('0x29')]);if(_0x29ed17[_0xace8('0x2a')]){delete _0x29ed17[_0xace8('0x2a')];}_0x25c855[_0xace8('0x1a')](_0x3ee3b7)['send'](_0x29ed17);};}exports[_0xace8('0x2b')]=function(_0x544c5b,_0x354d73){var _0x100d7e={},_0x28849d={},_0x280cf8={'count':0x0,'rows':[]};var _0x4a1302=_[_0xace8('0x2c')](db[_0xace8('0x2d')][_0xace8('0x2e')],function(_0x261ea7){return{'name':_0x261ea7[_0xace8('0x2f')],'type':_0x261ea7['type']['key']};});_0x28849d[_0xace8('0x30')]=_['map'](_0x4a1302,_0xace8('0x2a'));_0x28849d[_0xace8('0x31')]=_[_0xace8('0x32')](_0x544c5b[_0xace8('0x31')]);_0x28849d['filters']=_[_0xace8('0x33')](_0x28849d[_0xace8('0x30')],_0x28849d[_0xace8('0x31')]);_0x100d7e[_0xace8('0x34')]=_['intersection'](_0x28849d[_0xace8('0x30')],qs[_0xace8('0x35')](_0x544c5b[_0xace8('0x31')]['fields']));_0x100d7e[_0xace8('0x34')]=_0x100d7e[_0xace8('0x34')][_0xace8('0x36')]?_0x100d7e[_0xace8('0x34')]:_0x28849d[_0xace8('0x30')];if(!_0x544c5b[_0xace8('0x31')][_0xace8('0x37')]('nolimit')){_0x100d7e[_0xace8('0x1f')]=qs['limit'](_0x544c5b[_0xace8('0x31')]['limit']);_0x100d7e[_0xace8('0x1e')]=qs['offset'](_0x544c5b[_0xace8('0x31')][_0xace8('0x1e')]);}_0x100d7e[_0xace8('0x38')]=qs[_0xace8('0x39')](_0x544c5b[_0xace8('0x31')][_0xace8('0x39')]);_0x100d7e[_0xace8('0x3a')]=qs['filters'](_[_0xace8('0x3b')](_0x544c5b[_0xace8('0x31')],_0x28849d[_0xace8('0x3c')]),_0x4a1302);if(_0x544c5b['query'][_0xace8('0x3d')]){_0x100d7e['where']=_[_0xace8('0x3e')](_0x100d7e[_0xace8('0x3a')],{'$or':_['map'](_0x4a1302,function(_0x293d68){if(_0x293d68[_0xace8('0x3f')]!=='VIRTUAL'){var _0x14ec6b={};_0x14ec6b[_0x293d68[_0xace8('0x2a')]]={'$like':'%'+_0x544c5b[_0xace8('0x31')][_0xace8('0x3d')]+'%'};return _0x14ec6b;}})});}_0x100d7e=_['merge']({},_0x100d7e,_0x544c5b[_0xace8('0x40')]);var _0x3c4f39={'where':_0x100d7e['where']};return db['CmHopperBlack'][_0xace8('0x1d')](_0x3c4f39)[_0xace8('0x26')](function(_0x59cc25){_0x280cf8[_0xace8('0x1d')]=_0x59cc25;if(_0x544c5b[_0xace8('0x31')][_0xace8('0x41')]){_0x100d7e[_0xace8('0x42')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x100d7e);})[_0xace8('0x26')](function(_0x4a6624){_0x280cf8[_0xace8('0x43')]=_0x4a6624;return _0x280cf8;})['then'](respondWithFilteredResult(_0x354d73,_0x100d7e))[_0xace8('0x44')](handleError(_0x354d73,null));};exports[_0xace8('0x45')]=function(_0x3068d9,_0xe8a8f){var _0x32bc1d={'raw':!![],'where':{'id':_0x3068d9[_0xace8('0x46')]['id']}},_0x44fa8f={};_0x44fa8f[_0xace8('0x30')]=_[_0xace8('0x32')](db['CmHopperBlack'][_0xace8('0x2e')]);_0x44fa8f['query']=_['keys'](_0x3068d9[_0xace8('0x31')]);_0x44fa8f[_0xace8('0x3c')]=_[_0xace8('0x33')](_0x44fa8f[_0xace8('0x30')],_0x44fa8f[_0xace8('0x31')]);_0x32bc1d[_0xace8('0x34')]=_[_0xace8('0x33')](_0x44fa8f[_0xace8('0x30')],qs[_0xace8('0x35')](_0x3068d9['query'][_0xace8('0x35')]));_0x32bc1d[_0xace8('0x34')]=_0x32bc1d['attributes'][_0xace8('0x36')]?_0x32bc1d[_0xace8('0x34')]:_0x44fa8f['model'];if(_0x3068d9['query']['includeAll']){_0x32bc1d[_0xace8('0x42')]=[{'all':!![]}];}_0x32bc1d=_[_0xace8('0x3e')]({},_0x32bc1d,_0x3068d9[_0xace8('0x40')]);return db['CmHopperBlack'][_0xace8('0x47')](_0x32bc1d)[_0xace8('0x26')](handleEntityNotFound(_0xe8a8f,null))[_0xace8('0x26')](respondWithResult(_0xe8a8f,null))[_0xace8('0x44')](handleError(_0xe8a8f,null));};exports[_0xace8('0x25')]=function(_0x13d1b2,_0x38e2b5){if(_0x13d1b2['body']['id']){delete _0x13d1b2['body']['id'];}return db[_0xace8('0x2d')][_0xace8('0x47')]({'where':{'id':_0x13d1b2[_0xace8('0x46')]['id']}})[_0xace8('0x26')](handleEntityNotFound(_0x38e2b5,null))[_0xace8('0x26')](saveUpdates(_0x13d1b2['body'],null))['then'](respondWithResult(_0x38e2b5,null))[_0xace8('0x44')](handleError(_0x38e2b5,null));};exports[_0xace8('0x27')]=function(_0x175045,_0x3158a2){return db[_0xace8('0x2d')][_0xace8('0x47')]({'where':{'id':_0x175045['params']['id']}})[_0xace8('0x26')](handleEntityNotFound(_0x3158a2,null))['then'](removeEntity(_0x3158a2,null))[_0xace8('0x44')](handleError(_0x3158a2,null));};exports['describe']=function(_0x5614f7,_0x469705){return db[_0xace8('0x2d')][_0xace8('0x48')]()[_0xace8('0x26')](respondWithResult(_0x469705,null))[_0xace8('0x44')](handleError(_0x469705,null));}; \ No newline at end of file +var _0x0e01=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','rows','catch','show','params','length','options','body','find','destroy','describe','html-pdf','rimraf','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x0e01,0x167));var _0x10e0=function(_0x54b265,_0x272d36){_0x54b265=_0x54b265-0x0;var _0x1c7987=_0x0e01[_0x54b265];return _0x1c7987;};'use strict';var pdf=require(_0x10e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x10e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x10e0('0x2'));var moment=require('moment');var BPromise=require(_0x10e0('0x3'));var Mustache=require(_0x10e0('0x4'));var util=require('util');var path=require(_0x10e0('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x10e0('0x6'));var fs=require('fs');var _=require(_0x10e0('0x7'));var squel=require(_0x10e0('0x8'));var crypto=require(_0x10e0('0x9'));var jsforce=require(_0x10e0('0xa'));var deskjs=require(_0x10e0('0xb'));var toCsv=require(_0x10e0('0xc'));var querystring=require('querystring');var Papa=require(_0x10e0('0xd'));var Redis=require(_0x10e0('0xe'));var authService=require(_0x10e0('0xf'));var qs=require(_0x10e0('0x10'));var as=require(_0x10e0('0x11'));var hardwareService=require(_0x10e0('0x12'));var logger=require(_0x10e0('0x13'))(_0x10e0('0x14'));var utils=require(_0x10e0('0x15'));var config=require(_0x10e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x10e0('0x17'))['db'];function respondWithStatusCode(_0x33ac10,_0x4bf01a){_0x4bf01a=_0x4bf01a||0xcc;return function(_0x24389a){if(_0x24389a){return _0x33ac10[_0x10e0('0x18')](_0x4bf01a);}return _0x33ac10[_0x10e0('0x19')](_0x4bf01a)[_0x10e0('0x1a')]();};}function respondWithResult(_0xa4073d,_0x603f72){_0x603f72=_0x603f72||0xc8;return function(_0xcce5d3){if(_0xcce5d3){return _0xa4073d['status'](_0x603f72)[_0x10e0('0x1b')](_0xcce5d3);}};}function respondWithFilteredResult(_0x422733,_0x4e4f93){return function(_0x8fc7d4){if(_0x8fc7d4){var _0x57a504=_0x8fc7d4[_0x10e0('0x1c')],_0x315cd0=_0x4e4f93[_0x10e0('0x1d')],_0x2d7d4a=_0x4e4f93['offset']+_0x4e4f93[_0x10e0('0x1e')],_0x295ae1;if(_0x2d7d4a>=_0x57a504){_0x2d7d4a=_0x57a504;_0x295ae1=0xc8;}else{_0x295ae1=0xce;}_0x422733['status'](_0x295ae1);return _0x422733[_0x10e0('0x1f')](_0x10e0('0x20'),_0x315cd0+'-'+_0x2d7d4a+'/'+_0x57a504)[_0x10e0('0x1b')](_0x8fc7d4);}return null;};}function patchUpdates(_0x2a3819){return function(_0x22fa08){try{jsonpatch[_0x10e0('0x21')](_0x22fa08,_0x2a3819,!![]);}catch(_0xb93907){return BPromise['reject'](_0xb93907);}return _0x22fa08[_0x10e0('0x22')]();};}function saveUpdates(_0x4734a3,_0x2dd3e3){return function(_0x5705cd){if(_0x5705cd){return _0x5705cd[_0x10e0('0x23')](_0x4734a3)[_0x10e0('0x24')](function(_0x1320e4){return _0x1320e4;});}return null;};}function removeEntity(_0x7a24c3,_0x1e7e1a){return function(_0x5c3030){if(_0x5c3030){return _0x5c3030['destroy']()[_0x10e0('0x24')](function(){_0x7a24c3['status'](0xcc)[_0x10e0('0x1a')]();});}};}function handleEntityNotFound(_0x3b6a0a,_0x599651){return function(_0x5900f9){if(!_0x5900f9){_0x3b6a0a['sendStatus'](0x194);}return _0x5900f9;};}function handleError(_0x5a3300,_0x51a43f){_0x51a43f=_0x51a43f||0x1f4;return function(_0xa9c5ca){logger[_0x10e0('0x25')](_0xa9c5ca['stack']);if(_0xa9c5ca[_0x10e0('0x26')]){delete _0xa9c5ca[_0x10e0('0x26')];}_0x5a3300[_0x10e0('0x19')](_0x51a43f)[_0x10e0('0x27')](_0xa9c5ca);};}exports[_0x10e0('0x28')]=function(_0x167e43,_0x405f6c){var _0x55706e={},_0x34e22f={},_0x151cbc={'count':0x0,'rows':[]};var _0x24ed94=_[_0x10e0('0x29')](db[_0x10e0('0x2a')][_0x10e0('0x2b')],function(_0x32e8b9){return{'name':_0x32e8b9[_0x10e0('0x2c')],'type':_0x32e8b9[_0x10e0('0x2d')][_0x10e0('0x2e')]};});_0x34e22f[_0x10e0('0x2f')]=_[_0x10e0('0x29')](_0x24ed94,'name');_0x34e22f[_0x10e0('0x30')]=_[_0x10e0('0x31')](_0x167e43[_0x10e0('0x30')]);_0x34e22f[_0x10e0('0x32')]=_['intersection'](_0x34e22f[_0x10e0('0x2f')],_0x34e22f[_0x10e0('0x30')]);_0x55706e['attributes']=_[_0x10e0('0x33')](_0x34e22f[_0x10e0('0x2f')],qs[_0x10e0('0x34')](_0x167e43[_0x10e0('0x30')][_0x10e0('0x34')]));_0x55706e[_0x10e0('0x35')]=_0x55706e['attributes']['length']?_0x55706e[_0x10e0('0x35')]:_0x34e22f[_0x10e0('0x2f')];if(!_0x167e43[_0x10e0('0x30')][_0x10e0('0x36')](_0x10e0('0x37'))){_0x55706e[_0x10e0('0x1e')]=qs[_0x10e0('0x1e')](_0x167e43[_0x10e0('0x30')]['limit']);_0x55706e[_0x10e0('0x1d')]=qs['offset'](_0x167e43[_0x10e0('0x30')][_0x10e0('0x1d')]);}_0x55706e[_0x10e0('0x38')]=qs[_0x10e0('0x39')](_0x167e43[_0x10e0('0x30')][_0x10e0('0x39')]);_0x55706e[_0x10e0('0x3a')]=qs['filters'](_[_0x10e0('0x3b')](_0x167e43[_0x10e0('0x30')],_0x34e22f[_0x10e0('0x32')]),_0x24ed94);if(_0x167e43[_0x10e0('0x30')][_0x10e0('0x3c')]){_0x55706e[_0x10e0('0x3a')]=_['merge'](_0x55706e[_0x10e0('0x3a')],{'$or':_['map'](_0x24ed94,function(_0x254d7d){if(_0x254d7d[_0x10e0('0x2d')]!==_0x10e0('0x3d')){var _0x2a4457={};_0x2a4457[_0x254d7d[_0x10e0('0x26')]]={'$like':'%'+_0x167e43[_0x10e0('0x30')][_0x10e0('0x3c')]+'%'};return _0x2a4457;}})});}_0x55706e=_[_0x10e0('0x3e')]({},_0x55706e,_0x167e43['options']);var _0x1bc6b7={'where':_0x55706e[_0x10e0('0x3a')]};return db[_0x10e0('0x2a')][_0x10e0('0x1c')](_0x1bc6b7)[_0x10e0('0x24')](function(_0x143001){_0x151cbc[_0x10e0('0x1c')]=_0x143001;if(_0x167e43['query']['includeAll']){_0x55706e[_0x10e0('0x3f')]=[{'all':!![]}];}return db[_0x10e0('0x2a')]['findAll'](_0x55706e);})[_0x10e0('0x24')](function(_0x23ebca){_0x151cbc[_0x10e0('0x40')]=_0x23ebca;return _0x151cbc;})[_0x10e0('0x24')](respondWithFilteredResult(_0x405f6c,_0x55706e))[_0x10e0('0x41')](handleError(_0x405f6c,null));};exports[_0x10e0('0x42')]=function(_0x4aacb9,_0x1297e1){var _0x3cb238={'raw':!![],'where':{'id':_0x4aacb9[_0x10e0('0x43')]['id']}},_0x26b506={};_0x26b506['model']=_[_0x10e0('0x31')](db['CmHopperBlack']['rawAttributes']);_0x26b506[_0x10e0('0x30')]=_[_0x10e0('0x31')](_0x4aacb9['query']);_0x26b506[_0x10e0('0x32')]=_['intersection'](_0x26b506['model'],_0x26b506[_0x10e0('0x30')]);_0x3cb238[_0x10e0('0x35')]=_[_0x10e0('0x33')](_0x26b506[_0x10e0('0x2f')],qs[_0x10e0('0x34')](_0x4aacb9['query'][_0x10e0('0x34')]));_0x3cb238[_0x10e0('0x35')]=_0x3cb238[_0x10e0('0x35')][_0x10e0('0x44')]?_0x3cb238[_0x10e0('0x35')]:_0x26b506[_0x10e0('0x2f')];if(_0x4aacb9['query']['includeAll']){_0x3cb238[_0x10e0('0x3f')]=[{'all':!![]}];}_0x3cb238=_[_0x10e0('0x3e')]({},_0x3cb238,_0x4aacb9[_0x10e0('0x45')]);return db['CmHopperBlack']['find'](_0x3cb238)[_0x10e0('0x24')](handleEntityNotFound(_0x1297e1,null))[_0x10e0('0x24')](respondWithResult(_0x1297e1,null))[_0x10e0('0x41')](handleError(_0x1297e1,null));};exports[_0x10e0('0x23')]=function(_0x4c0ea7,_0x4d85e3){if(_0x4c0ea7[_0x10e0('0x46')]['id']){delete _0x4c0ea7[_0x10e0('0x46')]['id'];}return db[_0x10e0('0x2a')][_0x10e0('0x47')]({'where':{'id':_0x4c0ea7[_0x10e0('0x43')]['id']}})[_0x10e0('0x24')](handleEntityNotFound(_0x4d85e3,null))[_0x10e0('0x24')](saveUpdates(_0x4c0ea7[_0x10e0('0x46')],null))[_0x10e0('0x24')](respondWithResult(_0x4d85e3,null))[_0x10e0('0x41')](handleError(_0x4d85e3,null));};exports[_0x10e0('0x48')]=function(_0x12794e,_0x5ae5d7){return db[_0x10e0('0x2a')][_0x10e0('0x47')]({'where':{'id':_0x12794e[_0x10e0('0x43')]['id']}})[_0x10e0('0x24')](handleEntityNotFound(_0x5ae5d7,null))[_0x10e0('0x24')](removeEntity(_0x5ae5d7,null))[_0x10e0('0x41')](handleError(_0x5ae5d7,null));};exports[_0x10e0('0x49')]=function(_0x16d457,_0x14a664){return db['CmHopperBlack'][_0x10e0('0x49')]()['then'](respondWithResult(_0x14a664,null))[_0x10e0('0x41')](handleError(_0x14a664,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1d9c36a..b09e20d 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 _0x24d9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x38bed8,_0x4f8540){var _0x372eb4=function(_0x5d6f36){while(--_0x5d6f36){_0x38bed8['push'](_0x38bed8['shift']());}};_0x372eb4(++_0x4f8540);}(_0x24d9,0x1e0));var _0x924d=function(_0x30f08a,_0x2e112e){_0x30f08a=_0x30f08a-0x0;var _0x1416c5=_0x24d9[_0x30f08a];return _0x1416c5;};'use strict';var _=require(_0x924d('0x0'));var util=require(_0x924d('0x1'));var logger=require(_0x924d('0x2'))(_0x924d('0x3'));var moment=require(_0x924d('0x4'));var BPromise=require(_0x924d('0x5'));var rp=require(_0x924d('0x6'));var fs=require('fs');var path=require(_0x924d('0x7'));var rimraf=require(_0x924d('0x8'));var config=require('../../config/environment');var attributes=require(_0x924d('0x9'));module['exports']=function(_0x5274cf,_0x5868ec){return _0x5274cf[_0x924d('0xa')](_0x924d('0xb'),attributes,{'tableName':_0x924d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd355=['path','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3df60c,_0x573229){var _0x50202b=function(_0x17ba76){while(--_0x17ba76){_0x3df60c['push'](_0x3df60c['shift']());}};_0x50202b(++_0x573229);}(_0xd355,0xf7));var _0x5d35=function(_0x2e0938,_0x2e20f0){_0x2e0938=_0x2e0938-0x0;var _0x1691d3=_0xd355[_0x2e0938];return _0x1691d3;};'use strict';var _=require(_0x5d35('0x0'));var util=require(_0x5d35('0x1'));var logger=require(_0x5d35('0x2'))(_0x5d35('0x3'));var moment=require('moment');var BPromise=require(_0x5d35('0x4'));var rp=require(_0x5d35('0x5'));var fs=require('fs');var path=require(_0x5d35('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d35('0x7'));module[_0x5d35('0x8')]=function(_0x1fcc33,_0x43b04b){return _0x1fcc33[_0x5d35('0x9')]('CmHopperBlack',attributes,{'tableName':_0x5d35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index e1eb2ad..42f74ce 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 _0xf4fa=['then','info','GetCmHopperBlack','body','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model'];(function(_0x163c70,_0x3663f2){var _0x1429a7=function(_0x142cff){while(--_0x142cff){_0x163c70['push'](_0x163c70['shift']());}};_0x1429a7(++_0x3663f2);}(_0xf4fa,0xc5));var _0xaf4f=function(_0x425b47,_0x1e4e01){_0x425b47=_0x425b47-0x0;var _0x207e48=_0xf4fa[_0x425b47];return _0x207e48;};'use strict';var _=require(_0xaf4f('0x0'));var util=require(_0xaf4f('0x1'));var moment=require(_0xaf4f('0x2'));var BPromise=require(_0xaf4f('0x3'));var rs=require(_0xaf4f('0x4'));var fs=require('fs');var Redis=require(_0xaf4f('0x5'));var db=require(_0xaf4f('0x6'))['db'];var utils=require(_0xaf4f('0x7'));var logger=require(_0xaf4f('0x8'))(_0xaf4f('0x9'));var config=require(_0xaf4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaf4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x419f66,_0x10d345,_0xbb8127){return new BPromise(function(_0x16425f,_0x286e38){return client[_0xaf4f('0xc')](_0x419f66,_0xbb8127)['then'](function(_0x123770){logger['info'](_0xaf4f('0xd'),_0x10d345,_0xaf4f('0xe'));logger[_0xaf4f('0xf')](_0xaf4f('0x10'),_0x10d345,_0xaf4f('0xe'),JSON[_0xaf4f('0x11')](_0x123770));if(_0x123770[_0xaf4f('0x12')]){if(_0x123770[_0xaf4f('0x12')]['code']===0x1f4){logger[_0xaf4f('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x10d345,_0x123770[_0xaf4f('0x12')][_0xaf4f('0x13')]);return _0x286e38(_0x123770[_0xaf4f('0x12')][_0xaf4f('0x13')]);}logger[_0xaf4f('0x12')](_0xaf4f('0xd'),_0x10d345,_0x123770['error'][_0xaf4f('0x13')]);return _0x16425f(_0x123770[_0xaf4f('0x12')][_0xaf4f('0x13')]);}else{logger['info'](_0xaf4f('0xd'),_0x10d345,_0xaf4f('0xe'));_0x16425f(_0x123770[_0xaf4f('0x14')][_0xaf4f('0x13')]);}})[_0xaf4f('0x15')](function(_0x849b6a){logger['error'](_0xaf4f('0xd'),_0x10d345,_0x849b6a);_0x286e38(_0x849b6a);});});}exports['GetCmHopperBlack']=function(_0x5c347f){var _0x89fb6e=this;return new Promise(function(_0x520a20,_0x1598e6){return db[_0xaf4f('0x16')][_0xaf4f('0x17')]({'raw':_0x5c347f['options']?_0x5c347f[_0xaf4f('0x18')][_0xaf4f('0x19')]===undefined?!![]:![]:!![],'where':_0x5c347f[_0xaf4f('0x18')]?_0x5c347f[_0xaf4f('0x18')][_0xaf4f('0x1a')]||null:null,'attributes':_0x5c347f[_0xaf4f('0x18')]?_0x5c347f[_0xaf4f('0x18')][_0xaf4f('0x1b')]||null:null,'limit':_0x5c347f[_0xaf4f('0x18')]?_0x5c347f[_0xaf4f('0x18')]['limit']||null:null,'include':_0x5c347f[_0xaf4f('0x18')]?_0x5c347f['options'][_0xaf4f('0x1c')]?_[_0xaf4f('0x1d')](_0x5c347f[_0xaf4f('0x18')][_0xaf4f('0x1c')],function(_0x59cec4){return{'model':db[_0x59cec4[_0xaf4f('0x1e')]],'as':_0x59cec4['as'],'attributes':_0x59cec4[_0xaf4f('0x1b')],'include':_0x59cec4[_0xaf4f('0x1c')]?_[_0xaf4f('0x1d')](_0x59cec4[_0xaf4f('0x1c')],function(_0x2c2ed8){return{'model':db[_0x2c2ed8[_0xaf4f('0x1e')]],'as':_0x2c2ed8['as'],'attributes':_0x2c2ed8['attributes'],'include':_0x2c2ed8[_0xaf4f('0x1c')]?_[_0xaf4f('0x1d')](_0x2c2ed8[_0xaf4f('0x1c')],function(_0xec8575){return{'model':db[_0xec8575[_0xaf4f('0x1e')]],'as':_0xec8575['as'],'attributes':_0xec8575[_0xaf4f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaf4f('0x1f')](function(_0x34d150){logger[_0xaf4f('0x20')](_0xaf4f('0x21'),_0x5c347f);logger[_0xaf4f('0xf')](_0xaf4f('0x21'),_0x5c347f,JSON[_0xaf4f('0x11')](_0x34d150));_0x520a20(_0x34d150);})['catch'](function(_0x1bfdd5){logger[_0xaf4f('0x12')](_0xaf4f('0x21'),_0x1bfdd5[_0xaf4f('0x13')],_0x5c347f);_0x1598e6(_0x89fb6e[_0xaf4f('0x12')](0x1f4,_0x1bfdd5[_0xaf4f('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x3acd96){var _0x2f7f35=this;return new Promise(function(_0x34ed36,_0x105d61){return db['CmHopperBlack']['update'](_0x3acd96[_0xaf4f('0x22')],{'raw':_0x3acd96[_0xaf4f('0x18')]?_0x3acd96['options'][_0xaf4f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3acd96[_0xaf4f('0x18')]?_0x3acd96[_0xaf4f('0x18')]['where']||null:null,'attributes':_0x3acd96['options']?_0x3acd96[_0xaf4f('0x18')][_0xaf4f('0x1b')]||null:null,'limit':_0x3acd96[_0xaf4f('0x18')]?_0x3acd96[_0xaf4f('0x18')][_0xaf4f('0x23')]||null:null})[_0xaf4f('0x1f')](function(_0x38ccd6){logger['info']('UpdateCmHopperBlack',_0x3acd96);logger['debug'](_0xaf4f('0x24'),_0x3acd96,JSON[_0xaf4f('0x11')](_0x38ccd6));_0x34ed36(_0x38ccd6);})[_0xaf4f('0x15')](function(_0x5c445b){logger['error']('UpdateCmHopperBlack',_0x5c445b[_0xaf4f('0x13')],_0x3acd96);_0x105d61(_0x2f7f35[_0xaf4f('0x12')](0x1f4,_0x5c445b[_0xaf4f('0x13')]));});});};exports[_0xaf4f('0x25')]=function(_0x14f760){var _0x283d46=this;return new Promise(function(_0xe7c3a8,_0x11f1b4){return db[_0xaf4f('0x16')]['destroy']({'where':_0x14f760[_0xaf4f('0x18')]?_0x14f760['options'][_0xaf4f('0x1a')]||null:null})[_0xaf4f('0x1f')](function(_0x1f4007){logger['info'](_0xaf4f('0x25'),_0x14f760);logger[_0xaf4f('0xf')](_0xaf4f('0x25'),_0x14f760,JSON[_0xaf4f('0x11')](_0x1f4007));_0xe7c3a8(_0x1f4007);})[_0xaf4f('0x15')](function(_0x493501){logger[_0xaf4f('0x12')]('DestroyCmHopperBlack',_0x493501['message'],_0x14f760);_0x11f1b4(_0x283d46[_0xaf4f('0x12')](0x1f4,_0x493501['message']));});});}; \ No newline at end of file +var _0x459f=['where','attributes','include','map','model','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x302a3a,_0x242cd3){var _0x280d51=function(_0x42199c){while(--_0x42199c){_0x302a3a['push'](_0x302a3a['shift']());}};_0x280d51(++_0x242cd3);}(_0x459f,0x1ac));var _0xf459=function(_0x46c249,_0x263099){_0x46c249=_0x46c249-0x0;var _0x104e62=_0x459f[_0x46c249];return _0x104e62;};'use strict';var _=require(_0xf459('0x0'));var util=require(_0xf459('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf459('0x2'));var fs=require('fs');var Redis=require(_0xf459('0x3'));var db=require(_0xf459('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf459('0x5'))(_0xf459('0x6'));var config=require(_0xf459('0x7'));var jayson=require(_0xf459('0x8'));var client=jayson[_0xf459('0x9')][_0xf459('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd101,_0x4f6093,_0x120871){return new BPromise(function(_0x4fe720,_0x10ac39){return client[_0xf459('0xb')](_0x4cd101,_0x120871)[_0xf459('0xc')](function(_0x20738b){logger['info'](_0xf459('0xd'),_0x4f6093,_0xf459('0xe'));logger[_0xf459('0xf')](_0xf459('0x10'),_0x4f6093,'request\x20sent',JSON[_0xf459('0x11')](_0x20738b));if(_0x20738b[_0xf459('0x12')]){if(_0x20738b[_0xf459('0x12')][_0xf459('0x13')]===0x1f4){logger[_0xf459('0x12')](_0xf459('0xd'),_0x4f6093,_0x20738b[_0xf459('0x12')]['message']);return _0x10ac39(_0x20738b[_0xf459('0x12')][_0xf459('0x14')]);}logger[_0xf459('0x12')](_0xf459('0xd'),_0x4f6093,_0x20738b['error'][_0xf459('0x14')]);return _0x4fe720(_0x20738b[_0xf459('0x12')]['message']);}else{logger[_0xf459('0x15')](_0xf459('0xd'),_0x4f6093,_0xf459('0xe'));_0x4fe720(_0x20738b['result'][_0xf459('0x14')]);}})[_0xf459('0x16')](function(_0x33fa76){logger[_0xf459('0x12')](_0xf459('0xd'),_0x4f6093,_0x33fa76);_0x10ac39(_0x33fa76);});});}exports[_0xf459('0x17')]=function(_0x3fea02){var _0x4c01a3=this;return new Promise(function(_0x327fa8,_0x889de1){return db[_0xf459('0x18')][_0xf459('0x19')]({'raw':_0x3fea02[_0xf459('0x1a')]?_0x3fea02[_0xf459('0x1a')][_0xf459('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fea02[_0xf459('0x1a')]?_0x3fea02['options'][_0xf459('0x1c')]||null:null,'attributes':_0x3fea02[_0xf459('0x1a')]?_0x3fea02['options'][_0xf459('0x1d')]||null:null,'limit':_0x3fea02['options']?_0x3fea02[_0xf459('0x1a')]['limit']||null:null,'include':_0x3fea02['options']?_0x3fea02[_0xf459('0x1a')][_0xf459('0x1e')]?_[_0xf459('0x1f')](_0x3fea02[_0xf459('0x1a')]['include'],function(_0x195196){return{'model':db[_0x195196[_0xf459('0x20')]],'as':_0x195196['as'],'attributes':_0x195196[_0xf459('0x1d')],'include':_0x195196[_0xf459('0x1e')]?_[_0xf459('0x1f')](_0x195196[_0xf459('0x1e')],function(_0x3b581a){return{'model':db[_0x3b581a[_0xf459('0x20')]],'as':_0x3b581a['as'],'attributes':_0x3b581a[_0xf459('0x1d')],'include':_0x3b581a[_0xf459('0x1e')]?_[_0xf459('0x1f')](_0x3b581a[_0xf459('0x1e')],function(_0x1c4ad0){return{'model':db[_0x1c4ad0[_0xf459('0x20')]],'as':_0x1c4ad0['as'],'attributes':_0x1c4ad0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ee1ae){logger[_0xf459('0x15')](_0xf459('0x17'),_0x3fea02);logger[_0xf459('0xf')](_0xf459('0x17'),_0x3fea02,JSON['stringify'](_0x5ee1ae));_0x327fa8(_0x5ee1ae);})['catch'](function(_0x2903ea){logger[_0xf459('0x12')](_0xf459('0x17'),_0x2903ea[_0xf459('0x14')],_0x3fea02);_0x889de1(_0x4c01a3[_0xf459('0x12')](0x1f4,_0x2903ea['message']));});});};exports[_0xf459('0x21')]=function(_0x2bcc55){var _0x5277cf=this;return new Promise(function(_0x49ebc8,_0x128abe){return db[_0xf459('0x18')][_0xf459('0x22')](_0x2bcc55[_0xf459('0x23')],{'raw':_0x2bcc55[_0xf459('0x1a')]?_0x2bcc55[_0xf459('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bcc55[_0xf459('0x1a')]?_0x2bcc55[_0xf459('0x1a')]['where']||null:null,'attributes':_0x2bcc55[_0xf459('0x1a')]?_0x2bcc55[_0xf459('0x1a')][_0xf459('0x1d')]||null:null,'limit':_0x2bcc55[_0xf459('0x1a')]?_0x2bcc55['options'][_0xf459('0x24')]||null:null})['then'](function(_0x486787){logger[_0xf459('0x15')](_0xf459('0x21'),_0x2bcc55);logger[_0xf459('0xf')]('UpdateCmHopperBlack',_0x2bcc55,JSON[_0xf459('0x11')](_0x486787));_0x49ebc8(_0x486787);})[_0xf459('0x16')](function(_0x2290db){logger[_0xf459('0x12')](_0xf459('0x21'),_0x2290db[_0xf459('0x14')],_0x2bcc55);_0x128abe(_0x5277cf['error'](0x1f4,_0x2290db[_0xf459('0x14')]));});});};exports[_0xf459('0x25')]=function(_0x2ac1a6){var _0x5797ff=this;return new Promise(function(_0x438b06,_0xeb504){return db[_0xf459('0x18')]['destroy']({'where':_0x2ac1a6[_0xf459('0x1a')]?_0x2ac1a6['options'][_0xf459('0x1c')]||null:null})[_0xf459('0xc')](function(_0x28e672){logger[_0xf459('0x15')](_0xf459('0x25'),_0x2ac1a6);logger['debug']('DestroyCmHopperBlack',_0x2ac1a6,JSON[_0xf459('0x11')](_0x28e672));_0x438b06(_0x28e672);})[_0xf459('0x16')](function(_0x14af09){logger[_0xf459('0x12')](_0xf459('0x25'),_0x14af09[_0xf459('0x14')],_0x2ac1a6);_0xeb504(_0x5797ff['error'](0x1f4,_0x14af09[_0xf459('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 77e4ea7..4fe2263 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put'];(function(_0x2c9d88,_0x905f10){var _0x73383a=function(_0x33d401){while(--_0x33d401){_0x2c9d88['push'](_0x2c9d88['shift']());}};_0x73383a(++_0x905f10);}(_0x2d17,0x17e));var _0x72d1=function(_0xf323d2,_0x3e9201){_0xf323d2=_0xf323d2-0x0;var _0x53714f=_0x2d17[_0xf323d2];return _0x53714f;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0x8')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xc')]);router[_0x72d1('0xd')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xe')]);router[_0x72d1('0xf')](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x10')]);module[_0x72d1('0x11')]=router; \ No newline at end of file +var _0x00bb=['/describe','isAuthenticated','describe','/:id','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get'];(function(_0x282599,_0x26c8c2){var _0x543885=function(_0x3a44ac){while(--_0x3a44ac){_0x282599['push'](_0x282599['shift']());}};_0x543885(++_0x26c8c2);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'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 auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0x7')](_0xb00b('0xb'),auth[_0xb00b('0x9')](),controller['show']);router['put'](_0xb00b('0xb'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xc')]);router[_0xb00b('0xd')](_0xb00b('0xb'),auth['isAuthenticated'](),controller[_0xb00b('0xe')]);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 de77e11..21be8bf 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 _0x2822=['moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize'];(function(_0xa612b5,_0x30b414){var _0x640729=function(_0x30a319){while(--_0x30a319){_0xa612b5['push'](_0xa612b5['shift']());}};_0x640729(++_0x30b414);}(_0x2822,0x103));var _0x2282=function(_0x17872c,_0x1201ab){_0x17872c=_0x17872c-0x0;var _0x3edac0=_0x2822[_0x17872c];return _0x3edac0;};'use strict';var Sequelize=require(_0x2282('0x0'));var moment=require(_0x2282('0x1'));module['exports']={'state':{'type':Sequelize[_0x2282('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2282('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2282('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2282('0x3')]},'calleridnum':{'type':Sequelize[_0x2282('0x3')]},'calleridname':{'type':Sequelize[_0x2282('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2282('0x4')]},'answertime':{'type':Sequelize[_0x2282('0x4')]},'droptime':{'type':Sequelize[_0x2282('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2282('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x2282('0x3')]},'membername':{'type':Sequelize[_0x2282('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2282('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x2282('0x4')],'set':function(_0x1e463d){var _0x33fcbd=this[_0x2282('0x5')](_0x2282('0x6'));if(_0x33fcbd&&_0x1e463d){this[_0x2282('0x7')](_0x2282('0x8'),moment(_0x1e463d)[_0x2282('0x9')](moment(_0x33fcbd),_0x2282('0xa')));}return this[_0x2282('0x7')](_0x2282('0xb'),_0x1e463d);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x2282('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2282('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2282('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x2282('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2282('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2282('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2282('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2a3a=['setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x2a3a,0x119));var _0xa2a3=function(_0x3c3cf4,_0x37cd11){_0x3c3cf4=_0x3c3cf4-0x0;var _0x32e76a=_0x2a3a[_0x3c3cf4];return _0x32e76a;};'use strict';var Sequelize=require(_0xa2a3('0x0'));var moment=require(_0xa2a3('0x1'));module['exports']={'state':{'type':Sequelize[_0xa2a3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa2a3('0x3')]},'scheduledat':{'type':Sequelize[_0xa2a3('0x4')]},'countbusyretry':{'type':Sequelize[_0xa2a3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa2a3('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa2a3('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa2a3('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa2a3('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa2a3('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa2a3('0x3')]},'starttime':{'type':Sequelize[_0xa2a3('0x4')]},'responsetime':{'type':Sequelize[_0xa2a3('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa2a3('0x4')]},'endtime':{'type':Sequelize[_0xa2a3('0x4')]},'ringtime':{'type':Sequelize[_0xa2a3('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa2a3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa2a3('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa2a3('0x3')]},'membername':{'type':Sequelize[_0xa2a3('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xa2a3('0x3')]},'secondDisposition':{'type':Sequelize[_0xa2a3('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa2a3('0x3')]},'dispositionat':{'type':Sequelize[_0xa2a3('0x4')],'set':function(_0x5e7d07){var _0x4e7811=this['getDataValue']('endtime');if(_0x4e7811&&_0x5e7d07){this[_0xa2a3('0x5')](_0xa2a3('0x6'),moment(_0x5e7d07)[_0xa2a3('0x7')](moment(_0x4e7811),_0xa2a3('0x8')));}return this[_0xa2a3('0x5')](_0xa2a3('0x9'),_0x5e7d07);}},'amd':{'type':Sequelize[_0xa2a3('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa2a3('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa2a3('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa2a3('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa2a3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa2a3('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa2a3('0x4')]},'recallme':{'type':Sequelize[_0xa2a3('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa2a3('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa2a3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa2a3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index a4b2815..4585b63 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 _0xaf80=['to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','include','show','catch','describe','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','toString','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xaf80,0x1ef));var _0x0af8=function(_0x3fe83a,_0x1bfedb){_0x3fe83a=_0x3fe83a-0x0;var _0x1dcf80=_0xaf80[_0x3fe83a];return _0x1dcf80;};'use strict';var pdf=require(_0x0af8('0x0'));var emlformat=require(_0x0af8('0x1'));var rimraf=require(_0x0af8('0x2'));var zipdir=require(_0x0af8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0af8('0x4'));var Mustache=require(_0x0af8('0x5'));var util=require(_0x0af8('0x6'));var path=require(_0x0af8('0x7'));var sox=require(_0x0af8('0x8'));var csv=require(_0x0af8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x9'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=_0x1997b8['count'],_0x325b4c=_0x2a42a4[_0x0af8('0x1a')],_0x50d5ba=_0x2a42a4[_0x0af8('0x1a')]+_0x2a42a4['limit'],_0x5f4275;if(_0x50d5ba>=_0x4755cb){_0x50d5ba=_0x4755cb;_0x5f4275=0xc8;}else{_0x5f4275=0xce;}_0x216f0b[_0x0af8('0x17')](_0x5f4275);return _0x216f0b[_0x0af8('0x1b')](_0x0af8('0x1c'),_0x325b4c+'-'+_0x50d5ba+'/'+_0x4755cb)['json'](_0x1997b8);}return null;};}function patchUpdates(_0x5b5d71){return function(_0x50b8fa){try{jsonpatch[_0x0af8('0x1d')](_0x50b8fa,_0x5b5d71,!![]);}catch(_0x1eb805){return BPromise['reject'](_0x1eb805);}return _0x50b8fa[_0x0af8('0x1e')]();};}function saveUpdates(_0x4891e6,_0x5cbf28){return function(_0x40384f){if(_0x40384f){return _0x40384f[_0x0af8('0x1f')](_0x4891e6)[_0x0af8('0x20')](function(_0x5c0dd1){return _0x5c0dd1;});}return null;};}function removeEntity(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x21')]()[_0x0af8('0x20')](function(){_0x162e95[_0x0af8('0x17')](0xcc)[_0x0af8('0x18')]();});}};}function handleEntityNotFound(_0x320d0c,_0x404b25){return function(_0x1b046b){if(!_0x1b046b){_0x320d0c[_0x0af8('0x16')](0x194);}return _0x1b046b;};}function handleError(_0x57e0a9,_0x55e1ee){_0x55e1ee=_0x55e1ee||0x1f4;return function(_0x1c6306){logger[_0x0af8('0x22')](_0x1c6306[_0x0af8('0x23')]);if(_0x1c6306[_0x0af8('0x24')]){delete _0x1c6306['name'];}_0x57e0a9['status'](_0x55e1ee)[_0x0af8('0x25')](_0x1c6306);};}exports[_0x0af8('0x26')]=function(_0x23a102,_0x140104){var _0x2e8853={},_0x410216={},_0x318476={'count':0x0,'rows':[]};var _0x4c1b0b=_[_0x0af8('0x27')](db[_0x0af8('0x28')][_0x0af8('0x29')],function(_0x20eab4){return{'name':_0x20eab4[_0x0af8('0x2a')],'type':_0x20eab4[_0x0af8('0x2b')][_0x0af8('0x2c')]};});_0x410216[_0x0af8('0x2d')]=_[_0x0af8('0x27')](_0x4c1b0b,_0x0af8('0x24'));_0x410216[_0x0af8('0x2e')]=_['keys'](_0x23a102[_0x0af8('0x2e')]);_0x410216['filters']=_[_0x0af8('0x2f')](_0x410216['model'],_0x410216[_0x0af8('0x2e')]);_0x2e8853[_0x0af8('0x30')]=_['intersection'](_0x410216[_0x0af8('0x2d')],qs[_0x0af8('0x31')](_0x23a102[_0x0af8('0x2e')]['fields']));_0x2e8853[_0x0af8('0x30')]=_0x2e8853[_0x0af8('0x30')][_0x0af8('0x32')]?_0x2e8853['attributes']:_0x410216[_0x0af8('0x2d')];if(!_0x23a102[_0x0af8('0x2e')][_0x0af8('0x33')](_0x0af8('0x34'))){_0x2e8853[_0x0af8('0x35')]=qs[_0x0af8('0x35')](_0x23a102['query'][_0x0af8('0x35')]);_0x2e8853[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x23a102[_0x0af8('0x2e')][_0x0af8('0x1a')]);}_0x2e8853[_0x0af8('0x36')]=qs[_0x0af8('0x37')](_0x23a102[_0x0af8('0x2e')][_0x0af8('0x37')]);_0x2e8853[_0x0af8('0x38')]=qs[_0x0af8('0x39')](_[_0x0af8('0x3a')](_0x23a102['query'],_0x410216[_0x0af8('0x39')]),_0x4c1b0b);if(_0x23a102[_0x0af8('0x2e')][_0x0af8('0x3b')]){_0x2e8853[_0x0af8('0x38')]=_[_0x0af8('0x3c')](_0x2e8853[_0x0af8('0x38')],{'$or':_[_0x0af8('0x27')](_0x4c1b0b,function(_0x5e971f){if(_0x5e971f[_0x0af8('0x2b')]!==_0x0af8('0x3d')){var _0x268a31={};_0x268a31[_0x5e971f['name']]={'$like':'%'+_0x23a102[_0x0af8('0x2e')][_0x0af8('0x3b')]+'%'};return _0x268a31;}})});}_0x2e8853=_[_0x0af8('0x3c')]({},_0x2e8853,_0x23a102['options']);var _0x6781fe={'where':_0x2e8853[_0x0af8('0x38')]};return db[_0x0af8('0x28')][_0x0af8('0x3e')](_0x6781fe)[_0x0af8('0x20')](function(_0x2cc173){_0x318476[_0x0af8('0x3e')]=_0x2cc173;if(_0x23a102['query']['includeAll']){_0x2e8853[_0x0af8('0x3f')]=[{'all':!![]}];}return db[_0x0af8('0x28')]['findAll'](_0x2e8853);})[_0x0af8('0x20')](function(_0x4486b8){_0x318476['rows']=_0x4486b8;return _0x318476;})[_0x0af8('0x20')](respondWithFilteredResult(_0x140104,_0x2e8853))['catch'](handleError(_0x140104,null));};exports[_0x0af8('0x40')]=function(_0x92e031,_0x510bec){var _0x36c2fa={'raw':!![],'where':{'id':_0x92e031['params']['id']}},_0x3fefbc={};_0x3fefbc[_0x0af8('0x2d')]=_['keys'](db[_0x0af8('0x28')][_0x0af8('0x29')]);_0x3fefbc[_0x0af8('0x2e')]=_['keys'](_0x92e031['query']);_0x3fefbc[_0x0af8('0x39')]=_[_0x0af8('0x2f')](_0x3fefbc[_0x0af8('0x2d')],_0x3fefbc[_0x0af8('0x2e')]);_0x36c2fa['attributes']=_[_0x0af8('0x2f')](_0x3fefbc[_0x0af8('0x2d')],qs[_0x0af8('0x31')](_0x92e031['query'][_0x0af8('0x31')]));_0x36c2fa[_0x0af8('0x30')]=_0x36c2fa['attributes'][_0x0af8('0x32')]?_0x36c2fa['attributes']:_0x3fefbc[_0x0af8('0x2d')];if(_0x92e031['query']['includeAll']){_0x36c2fa['include']=[{'all':!![]}];}_0x36c2fa=_[_0x0af8('0x3c')]({},_0x36c2fa,_0x92e031['options']);return db[_0x0af8('0x28')]['find'](_0x36c2fa)[_0x0af8('0x20')](handleEntityNotFound(_0x510bec,null))[_0x0af8('0x20')](respondWithResult(_0x510bec,null))[_0x0af8('0x41')](handleError(_0x510bec,null));};exports[_0x0af8('0x42')]=function(_0x22192b,_0x562f09){return db['CmHopperFinal'][_0x0af8('0x42')]()[_0x0af8('0x20')](respondWithResult(_0x562f09,null))[_0x0af8('0x41')](handleError(_0x562f09,null));};exports[_0x0af8('0x1f')]=function(_0x3d86e2,_0x1b352e){if(_0x3d86e2[_0x0af8('0x43')]['uniqueid']){delete _0x3d86e2['body'][_0x0af8('0x44')];}return db[_0x0af8('0x28')][_0x0af8('0x45')]({'where':{'uniqueid':_0x3d86e2[_0x0af8('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b352e,null))[_0x0af8('0x20')](saveUpdates(_0x3d86e2[_0x0af8('0x43')],null))[_0x0af8('0x20')](respondWithResult(_0x1b352e,null))[_0x0af8('0x41')](handleError(_0x1b352e,null));};exports[_0x0af8('0x47')]=function(_0x4678f8,_0x4e7d6e,_0x2b7ada){return db['CmHopperFinal'][_0x0af8('0x48')]({'raw':![],'where':{'VoiceQueueId':_0x4678f8['params']['id']},'attributes':[[db[_0x0af8('0x49')]['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db['sequelize'][_0x0af8('0x4b')](_0x0af8('0x4c')))),'noSuchContacts'],[db[_0x0af8('0x49')]['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')](_0x0af8('0x4d')))),_0x0af8('0x4e')],[db['sequelize']['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db['sequelize']['literal'](_0x0af8('0x4f')))),_0x0af8('0x50')],[db['sequelize']['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db['sequelize'][_0x0af8('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x0af8('0x49')]['fn'](_0x0af8('0x4a'),db['sequelize']['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0af8('0x51')],[db['sequelize']['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db['sequelize']['literal'](_0x0af8('0x52')))),_0x0af8('0x53')],[db[_0x0af8('0x49')]['fn'](_0x0af8('0x4a'),db['sequelize']['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')](_0x0af8('0x54')))),'reCallContacts'],[db[_0x0af8('0x49')]['fn'](_0x0af8('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x0af8('0x4b')](_0x0af8('0x55')))),_0x0af8('0x56')]]})['then'](handleEntityNotFound(_0x4e7d6e,null))[_0x0af8('0x20')](respondWithResult(_0x4e7d6e,null))[_0x0af8('0x41')](handleError(_0x4e7d6e,null));};exports[_0x0af8('0x57')]=function(_0x1922a0,_0x109e4c,_0x5c3ab9){return db[_0x0af8('0x28')]['findAll']({'raw':![],'where':{'CampaignId':_0x1922a0[_0x0af8('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')](_0x0af8('0x4c')))),_0x0af8('0x58')],[db[_0x0af8('0x49')]['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db['sequelize'][_0x0af8('0x4b')](_0x0af8('0x4d')))),_0x0af8('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x0af8('0x49')]['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')](_0x0af8('0x4f')))),_0x0af8('0x50')],[db[_0x0af8('0x49')]['fn']('COUNT',db[_0x0af8('0x49')]['fn']('IF',db['sequelize'][_0x0af8('0x4b')](_0x0af8('0x59')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x0af8('0x49')]['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')](_0x0af8('0x5a')))),_0x0af8('0x51')],[db[_0x0af8('0x49')]['fn']('COUNT',db[_0x0af8('0x49')]['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0af8('0x53')],[db[_0x0af8('0x49')]['fn']('COUNT',db[_0x0af8('0x49')]['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')](_0x0af8('0x54')))),_0x0af8('0x5b')],[db['sequelize']['fn'](_0x0af8('0x4a'),db[_0x0af8('0x49')]['fn']('IF',db[_0x0af8('0x49')][_0x0af8('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x109e4c,null))['then'](respondWithResult(_0x109e4c,null))[_0x0af8('0x41')](handleError(_0x109e4c,null));};exports[_0x0af8('0x5c')]=function(_0x2c2dcb,_0x4d183f,_0x5a1cc1){return db['VoiceQueue']['find']({'where':{'id':_0x2c2dcb[_0x0af8('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d183f,null))[_0x0af8('0x20')](function(_0x2a0a73){var _0x12069a;if(_0x2a0a73){_0x12069a=squel[_0x0af8('0x5d')]()['into'](_0x0af8('0x5e'))[_0x0af8('0x5f')]([_0x0af8('0x60'),_0x0af8('0x61'),_0x0af8('0x62'),_0x0af8('0x63'),_0x0af8('0x64'),_0x0af8('0x65'),'updatedAt'],squel[_0x0af8('0x66')]()[_0x0af8('0x67')](_0x0af8('0x68'),_0x0af8('0x60'))['field'](_0x0af8('0x69'),_0x0af8('0x61'))[_0x0af8('0x67')](_0x0af8('0x6a'),'ContactId')['field'](_0x0af8('0x6b'),_0x0af8('0x63'))[_0x0af8('0x67')](_0x0af8('0x6c'),_0x0af8('0x64'))[_0x0af8('0x67')](_0x0af8('0x69'),_0x0af8('0x65'))[_0x0af8('0x67')](_0x0af8('0x69'),_0x0af8('0x6d'))[_0x0af8('0x6e')](_0x0af8('0x6f'))[_0x0af8('0x38')]('VoiceQueueId\x20=\x20?',_0x2c2dcb[_0x0af8('0x46')]['id']['toString']())['where']('state\x20=\x20?',_0x2c2dcb[_0x0af8('0x43')]['state']['toString']())['where'](_0x0af8('0x70'))[_0x0af8('0x38')](_0x0af8('0x71'),squel[_0x0af8('0x66')]()[_0x0af8('0x67')](_0x0af8('0x60'))['from'](_0x0af8('0x5e'))['where'](_0x0af8('0x72'),_0x2c2dcb[_0x0af8('0x46')]['id']['toString']()))['where'](_0x0af8('0x71'),squel[_0x0af8('0x66')]()[_0x0af8('0x67')]('calleridnum')['from']('cm_hopper_final')['where'](_0x0af8('0x72'),_0x2c2dcb[_0x0af8('0x46')]['id']['toString']())[_0x0af8('0x38')](_0x0af8('0x73')))[_0x0af8('0x74')]('ContactId'))[_0x0af8('0x75')]();return db[_0x0af8('0x49')][_0x0af8('0x2e')](_0x12069a);}return[];})[_0x0af8('0x20')](respondWithResult(_0x4d183f,null))[_0x0af8('0x41')](handleError(_0x4d183f,null));};exports[_0x0af8('0x76')]=function(_0x342dc8,_0x49e606,_0x22976b){return db['Campaign']['find']({'where':{'id':_0x342dc8[_0x0af8('0x46')]['id']}})[_0x0af8('0x20')](handleEntityNotFound(_0x49e606,null))[_0x0af8('0x20')](function(_0x32b480){var _0x29a8ed;if(_0x32b480){_0x29a8ed=squel[_0x0af8('0x5d')]()[_0x0af8('0x77')](_0x0af8('0x5e'))[_0x0af8('0x5f')]([_0x0af8('0x60'),'scheduledAt',_0x0af8('0x62'),_0x0af8('0x63'),_0x0af8('0x78'),_0x0af8('0x65'),_0x0af8('0x6d')],squel['select']()[_0x0af8('0x67')](_0x0af8('0x68'),_0x0af8('0x60'))[_0x0af8('0x67')](_0x0af8('0x69'),_0x0af8('0x61'))['field'](_0x0af8('0x6a'),_0x0af8('0x62'))[_0x0af8('0x67')](_0x0af8('0x6b'),_0x0af8('0x63'))[_0x0af8('0x67')](_0x0af8('0x79'),'CampaignId')[_0x0af8('0x67')]('NOW()',_0x0af8('0x65'))[_0x0af8('0x67')](_0x0af8('0x69'),_0x0af8('0x6d'))[_0x0af8('0x6e')](_0x0af8('0x6f'))[_0x0af8('0x38')](_0x0af8('0x7a'),_0x342dc8['params']['id']['toString']())[_0x0af8('0x38')]('state\x20=\x20?',_0x342dc8[_0x0af8('0x43')][_0x0af8('0x7b')][_0x0af8('0x75')]())[_0x0af8('0x38')](_0x0af8('0x70'))[_0x0af8('0x38')](_0x0af8('0x71'),squel['select']()[_0x0af8('0x67')](_0x0af8('0x60'))[_0x0af8('0x6e')]('cm_hopper')[_0x0af8('0x38')](_0x0af8('0x7a'),_0x342dc8[_0x0af8('0x46')]['id']['toString']()))[_0x0af8('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x0af8('0x66')]()[_0x0af8('0x67')]('calleridnum')['from'](_0x0af8('0x6f'))['where'](_0x0af8('0x7a'),_0x342dc8['params']['id']['toString']())['where'](_0x0af8('0x73')))[_0x0af8('0x74')](_0x0af8('0x62')))['toString']();return db[_0x0af8('0x49')][_0x0af8('0x2e')](_0x29a8ed);}return[];})[_0x0af8('0x20')](respondWithResult(_0x49e606,null))[_0x0af8('0x41')](handleError(_0x49e606,null));};exports['checkContactHopper']=function(_0x53182a,_0x31dee8,_0x6f90df){return db[_0x0af8('0x7c')][_0x0af8('0x7d')]({'where':{'VoiceQueueId':_0x53182a[_0x0af8('0x43')][_0x0af8('0x64')],'CampaignId':_0x53182a[_0x0af8('0x43')][_0x0af8('0x78')],'ContactId':_0x53182a[_0x0af8('0x43')][_0x0af8('0x62')]}})[_0x0af8('0x20')](handleEntityNotFound(_0x31dee8,null))[_0x0af8('0x20')](function(_0x250b7b){if(_0x250b7b){return _0x250b7b;}return null;})[_0x0af8('0x20')](respondWithResult(_0x31dee8,null))[_0x0af8('0x41')](handleError(_0x31dee8,null));}; \ No newline at end of file +var _0x702d=['merge','options','CmHopperFinal','includeAll','include','findAll','then','rows','catch','show','params','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','Campaign','createdAt','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where'];(function(_0x136de9,_0xc1a39c){var _0x31ff7b=function(_0x94c91a){while(--_0x94c91a){_0x136de9['push'](_0x136de9['shift']());}};_0x31ff7b(++_0xc1a39c);}(_0x702d,0x147));var _0xd702=function(_0x414830,_0x301e9b){_0x414830=_0x414830-0x0;var _0x294f94=_0x702d[_0x414830];return _0x294f94;};'use strict';var pdf=require(_0xd702('0x0'));var emlformat=require(_0xd702('0x1'));var rimraf=require(_0xd702('0x2'));var zipdir=require(_0xd702('0x3'));var jsonpatch=require(_0xd702('0x4'));var rp=require('request-promise');var moment=require(_0xd702('0x5'));var BPromise=require(_0xd702('0x6'));var Mustache=require(_0xd702('0x7'));var util=require(_0xd702('0x8'));var path=require('path');var sox=require(_0xd702('0x9'));var csv=require('to-csv');var ejs=require(_0xd702('0xa'));var fs=require('fs');var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0xe'));var querystring=require(_0xd702('0xf'));var Papa=require(_0xd702('0x10'));var Redis=require(_0xd702('0x11'));var authService=require(_0xd702('0x12'));var qs=require(_0xd702('0x13'));var as=require(_0xd702('0x14'));var hardwareService=require(_0xd702('0x15'));var logger=require(_0xd702('0x16'))(_0xd702('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd702('0x18'));var db=require(_0xd702('0x19'))['db'];function respondWithStatusCode(_0x273577,_0x5c0dad){_0x5c0dad=_0x5c0dad||0xcc;return function(_0x13ee5a){if(_0x13ee5a){return _0x273577[_0xd702('0x1a')](_0x5c0dad);}return _0x273577[_0xd702('0x1b')](_0x5c0dad)[_0xd702('0x1c')]();};}function respondWithResult(_0x3948f8,_0x181ff2){_0x181ff2=_0x181ff2||0xc8;return function(_0x59dd33){if(_0x59dd33){return _0x3948f8[_0xd702('0x1b')](_0x181ff2)[_0xd702('0x1d')](_0x59dd33);}};}function respondWithFilteredResult(_0x5d7978,_0x707b9){return function(_0x4922f8){if(_0x4922f8){var _0x268c66=_0x4922f8[_0xd702('0x1e')],_0x210c32=_0x707b9[_0xd702('0x1f')],_0x55b93e=_0x707b9['offset']+_0x707b9['limit'],_0x2ba791;if(_0x55b93e>=_0x268c66){_0x55b93e=_0x268c66;_0x2ba791=0xc8;}else{_0x2ba791=0xce;}_0x5d7978[_0xd702('0x1b')](_0x2ba791);return _0x5d7978['set'](_0xd702('0x20'),_0x210c32+'-'+_0x55b93e+'/'+_0x268c66)[_0xd702('0x1d')](_0x4922f8);}return null;};}function patchUpdates(_0x37267c){return function(_0x265b1b){try{jsonpatch[_0xd702('0x21')](_0x265b1b,_0x37267c,!![]);}catch(_0x120e3f){return BPromise[_0xd702('0x22')](_0x120e3f);}return _0x265b1b['save']();};}function saveUpdates(_0x4be140,_0x536ca8){return function(_0x55516e){if(_0x55516e){return _0x55516e[_0xd702('0x23')](_0x4be140)['then'](function(_0x211200){return _0x211200;});}return null;};}function removeEntity(_0x5d91fd,_0xc4c246){return function(_0x5824ec){if(_0x5824ec){return _0x5824ec['destroy']()['then'](function(){_0x5d91fd[_0xd702('0x1b')](0xcc)[_0xd702('0x1c')]();});}};}function handleEntityNotFound(_0x459184,_0x49761c){return function(_0x1f0c44){if(!_0x1f0c44){_0x459184[_0xd702('0x1a')](0x194);}return _0x1f0c44;};}function handleError(_0x10599a,_0x2eaa03){_0x2eaa03=_0x2eaa03||0x1f4;return function(_0x1200ed){logger[_0xd702('0x24')](_0x1200ed[_0xd702('0x25')]);if(_0x1200ed[_0xd702('0x26')]){delete _0x1200ed[_0xd702('0x26')];}_0x10599a['status'](_0x2eaa03)[_0xd702('0x27')](_0x1200ed);};}exports[_0xd702('0x28')]=function(_0x25e96a,_0x335202){var _0xbe4518={},_0x38505d={},_0x797156={'count':0x0,'rows':[]};var _0x22441b=_['map'](db['CmHopperFinal'][_0xd702('0x29')],function(_0x43cd38){return{'name':_0x43cd38['fieldName'],'type':_0x43cd38[_0xd702('0x2a')][_0xd702('0x2b')]};});_0x38505d[_0xd702('0x2c')]=_[_0xd702('0x2d')](_0x22441b,'name');_0x38505d[_0xd702('0x2e')]=_[_0xd702('0x2f')](_0x25e96a[_0xd702('0x2e')]);_0x38505d[_0xd702('0x30')]=_[_0xd702('0x31')](_0x38505d['model'],_0x38505d[_0xd702('0x2e')]);_0xbe4518[_0xd702('0x32')]=_[_0xd702('0x31')](_0x38505d['model'],qs[_0xd702('0x33')](_0x25e96a['query']['fields']));_0xbe4518[_0xd702('0x32')]=_0xbe4518[_0xd702('0x32')][_0xd702('0x34')]?_0xbe4518['attributes']:_0x38505d[_0xd702('0x2c')];if(!_0x25e96a[_0xd702('0x2e')]['hasOwnProperty'](_0xd702('0x35'))){_0xbe4518[_0xd702('0x36')]=qs[_0xd702('0x36')](_0x25e96a[_0xd702('0x2e')][_0xd702('0x36')]);_0xbe4518[_0xd702('0x1f')]=qs[_0xd702('0x1f')](_0x25e96a[_0xd702('0x2e')][_0xd702('0x1f')]);}_0xbe4518[_0xd702('0x37')]=qs[_0xd702('0x38')](_0x25e96a[_0xd702('0x2e')][_0xd702('0x38')]);_0xbe4518['where']=qs[_0xd702('0x30')](_[_0xd702('0x39')](_0x25e96a[_0xd702('0x2e')],_0x38505d[_0xd702('0x30')]),_0x22441b);if(_0x25e96a[_0xd702('0x2e')][_0xd702('0x3a')]){_0xbe4518[_0xd702('0x3b')]=_['merge'](_0xbe4518['where'],{'$or':_[_0xd702('0x2d')](_0x22441b,function(_0x1810ee){if(_0x1810ee['type']!=='VIRTUAL'){var _0x3fbac9={};_0x3fbac9[_0x1810ee[_0xd702('0x26')]]={'$like':'%'+_0x25e96a['query'][_0xd702('0x3a')]+'%'};return _0x3fbac9;}})});}_0xbe4518=_[_0xd702('0x3c')]({},_0xbe4518,_0x25e96a[_0xd702('0x3d')]);var _0x4822d9={'where':_0xbe4518[_0xd702('0x3b')]};return db[_0xd702('0x3e')][_0xd702('0x1e')](_0x4822d9)['then'](function(_0x45acfc){_0x797156['count']=_0x45acfc;if(_0x25e96a[_0xd702('0x2e')][_0xd702('0x3f')]){_0xbe4518[_0xd702('0x40')]=[{'all':!![]}];}return db[_0xd702('0x3e')][_0xd702('0x41')](_0xbe4518);})[_0xd702('0x42')](function(_0x45e414){_0x797156[_0xd702('0x43')]=_0x45e414;return _0x797156;})['then'](respondWithFilteredResult(_0x335202,_0xbe4518))[_0xd702('0x44')](handleError(_0x335202,null));};exports[_0xd702('0x45')]=function(_0xf7542c,_0x3d703e){var _0x11cc81={'raw':!![],'where':{'id':_0xf7542c[_0xd702('0x46')]['id']}},_0x5ecb10={};_0x5ecb10[_0xd702('0x2c')]=_[_0xd702('0x2f')](db['CmHopperFinal'][_0xd702('0x29')]);_0x5ecb10[_0xd702('0x2e')]=_[_0xd702('0x2f')](_0xf7542c[_0xd702('0x2e')]);_0x5ecb10['filters']=_[_0xd702('0x31')](_0x5ecb10[_0xd702('0x2c')],_0x5ecb10[_0xd702('0x2e')]);_0x11cc81[_0xd702('0x32')]=_[_0xd702('0x31')](_0x5ecb10['model'],qs[_0xd702('0x33')](_0xf7542c[_0xd702('0x2e')]['fields']));_0x11cc81['attributes']=_0x11cc81[_0xd702('0x32')][_0xd702('0x34')]?_0x11cc81[_0xd702('0x32')]:_0x5ecb10[_0xd702('0x2c')];if(_0xf7542c[_0xd702('0x2e')][_0xd702('0x3f')]){_0x11cc81[_0xd702('0x40')]=[{'all':!![]}];}_0x11cc81=_[_0xd702('0x3c')]({},_0x11cc81,_0xf7542c[_0xd702('0x3d')]);return db['CmHopperFinal']['find'](_0x11cc81)[_0xd702('0x42')](handleEntityNotFound(_0x3d703e,null))['then'](respondWithResult(_0x3d703e,null))[_0xd702('0x44')](handleError(_0x3d703e,null));};exports['describe']=function(_0x40ea5f,_0x58a56f){return db[_0xd702('0x3e')]['describe']()[_0xd702('0x42')](respondWithResult(_0x58a56f,null))[_0xd702('0x44')](handleError(_0x58a56f,null));};exports['update']=function(_0x160f5e,_0x2d31d2){if(_0x160f5e[_0xd702('0x47')][_0xd702('0x48')]){delete _0x160f5e[_0xd702('0x47')]['uniqueid'];}return db[_0xd702('0x3e')][_0xd702('0x49')]({'where':{'uniqueid':_0x160f5e[_0xd702('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d31d2,null))[_0xd702('0x42')](saveUpdates(_0x160f5e['body'],null))[_0xd702('0x42')](respondWithResult(_0x2d31d2,null))[_0xd702('0x44')](handleError(_0x2d31d2,null));};exports[_0xd702('0x4a')]=function(_0x55282d,_0x5a900d,_0x2e5a91){return db[_0xd702('0x3e')][_0xd702('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x55282d[_0xd702('0x46')]['id']},'attributes':[[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db[_0xd702('0x4b')]['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x4e')))),'noSuchContacts'],[db['sequelize']['fn'](_0xd702('0x4c'),db[_0xd702('0x4b')]['fn']('IF',db[_0xd702('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xd702('0x4f')],[db['sequelize']['fn'](_0xd702('0x4c'),db[_0xd702('0x4b')]['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x50')))),_0xd702('0x51')],[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db[_0xd702('0x4b')]['fn']('IF',db['sequelize'][_0xd702('0x4d')](_0xd702('0x52')))),_0xd702('0x53')],[db[_0xd702('0x4b')]['fn']('COUNT',db[_0xd702('0x4b')]['fn']('IF',db['sequelize'][_0xd702('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db[_0xd702('0x4b')]['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x54')))),'abandonedContacts'],[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db['sequelize']['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x55')))),_0xd702('0x56')],[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db['sequelize']['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x57')))),_0xd702('0x58')]]})[_0xd702('0x42')](handleEntityNotFound(_0x5a900d,null))['then'](respondWithResult(_0x5a900d,null))['catch'](handleError(_0x5a900d,null));};exports[_0xd702('0x59')]=function(_0x5d09df,_0x5e0f26,_0x2fa2c7){return db['CmHopperFinal'][_0xd702('0x41')]({'raw':![],'where':{'CampaignId':_0x5d09df[_0xd702('0x46')]['id']},'attributes':[[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db['sequelize']['fn']('IF',db[_0xd702('0x4b')]['literal'](_0xd702('0x4e')))),'noSuchContacts'],[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db[_0xd702('0x4b')]['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x5a')))),_0xd702('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xd702('0x4b')]['fn']('IF',db['sequelize'][_0xd702('0x4d')](_0xd702('0x50')))),'busyContacts'],[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db['sequelize']['fn']('IF',db[_0xd702('0x4b')]['literal'](_0xd702('0x52')))),_0xd702('0x53')],[db[_0xd702('0x4b')]['fn'](_0xd702('0x4c'),db['sequelize']['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x5b')))),_0xd702('0x5c')],[db[_0xd702('0x4b')]['fn']('COUNT',db[_0xd702('0x4b')]['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x54')))),_0xd702('0x5d')],[db[_0xd702('0x4b')]['fn']('COUNT',db[_0xd702('0x4b')]['fn']('IF',db['sequelize'][_0xd702('0x4d')](_0xd702('0x55')))),_0xd702('0x56')],[db[_0xd702('0x4b')]['fn']('COUNT',db[_0xd702('0x4b')]['fn']('IF',db[_0xd702('0x4b')][_0xd702('0x4d')](_0xd702('0x57')))),_0xd702('0x58')]]})['then'](handleEntityNotFound(_0x5e0f26,null))['then'](respondWithResult(_0x5e0f26,null))[_0xd702('0x44')](handleError(_0x5e0f26,null));};exports[_0xd702('0x5e')]=function(_0x2c3033,_0x339403,_0x3fb0b1){return db[_0xd702('0x5f')][_0xd702('0x49')]({'where':{'id':_0x2c3033[_0xd702('0x46')]['id']}})[_0xd702('0x42')](handleEntityNotFound(_0x339403,null))[_0xd702('0x42')](function(_0x123515){var _0x38fff6;if(_0x123515){_0x38fff6=squel[_0xd702('0x60')]()[_0xd702('0x61')](_0xd702('0x62'))[_0xd702('0x63')](['phone',_0xd702('0x64'),'ContactId','ListId',_0xd702('0x65'),'createdAt',_0xd702('0x66')],squel[_0xd702('0x67')]()[_0xd702('0x68')](_0xd702('0x69'),_0xd702('0x6a'))[_0xd702('0x68')](_0xd702('0x6b'),_0xd702('0x64'))[_0xd702('0x68')](_0xd702('0x6c'),_0xd702('0x6d'))[_0xd702('0x68')](_0xd702('0x6e'),_0xd702('0x6f'))[_0xd702('0x68')](_0xd702('0x70'),_0xd702('0x65'))[_0xd702('0x68')](_0xd702('0x6b'),'createdAt')[_0xd702('0x68')](_0xd702('0x6b'),_0xd702('0x66'))[_0xd702('0x71')](_0xd702('0x72'))['where'](_0xd702('0x73'),_0x2c3033[_0xd702('0x46')]['id']['toString']())[_0xd702('0x3b')](_0xd702('0x74'),_0x2c3033[_0xd702('0x47')]['state'][_0xd702('0x75')]())[_0xd702('0x3b')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xd702('0x3b')](_0xd702('0x76'),squel[_0xd702('0x67')]()[_0xd702('0x68')](_0xd702('0x6a'))[_0xd702('0x71')](_0xd702('0x62'))[_0xd702('0x3b')](_0xd702('0x73'),_0x2c3033[_0xd702('0x46')]['id'][_0xd702('0x75')]()))['where'](_0xd702('0x76'),squel[_0xd702('0x67')]()['field'](_0xd702('0x77'))[_0xd702('0x71')](_0xd702('0x72'))[_0xd702('0x3b')](_0xd702('0x73'),_0x2c3033['params']['id']['toString']())[_0xd702('0x3b')]('state\x20=\x204'))[_0xd702('0x78')](_0xd702('0x6d')))[_0xd702('0x75')]();return db[_0xd702('0x4b')][_0xd702('0x2e')](_0x38fff6);}return[];})['then'](respondWithResult(_0x339403,null))[_0xd702('0x44')](handleError(_0x339403,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x12e796,_0x45ba8b,_0x42c4c0){return db[_0xd702('0x79')][_0xd702('0x49')]({'where':{'id':_0x12e796[_0xd702('0x46')]['id']}})['then'](handleEntityNotFound(_0x45ba8b,null))['then'](function(_0x337be0){var _0x2eab19;if(_0x337be0){_0x2eab19=squel['insert']()[_0xd702('0x61')](_0xd702('0x62'))['fromQuery'](['phone',_0xd702('0x64'),_0xd702('0x6d'),_0xd702('0x6f'),'CampaignId',_0xd702('0x7a'),_0xd702('0x66')],squel[_0xd702('0x67')]()[_0xd702('0x68')](_0xd702('0x69'),_0xd702('0x6a'))[_0xd702('0x68')](_0xd702('0x6b'),_0xd702('0x64'))[_0xd702('0x68')]('ANY_VALUE(ContactId)',_0xd702('0x6d'))[_0xd702('0x68')](_0xd702('0x6e'),_0xd702('0x6f'))['field'](_0xd702('0x7b'),_0xd702('0x7c'))[_0xd702('0x68')](_0xd702('0x6b'),_0xd702('0x7a'))['field']('NOW()','updatedAt')[_0xd702('0x71')](_0xd702('0x72'))[_0xd702('0x3b')](_0xd702('0x7d'),_0x12e796[_0xd702('0x46')]['id'][_0xd702('0x75')]())[_0xd702('0x3b')]('state\x20=\x20?',_0x12e796[_0xd702('0x47')][_0xd702('0x7e')][_0xd702('0x75')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0xd702('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xd702('0x68')]('phone')['from']('cm_hopper')[_0xd702('0x3b')](_0xd702('0x7d'),_0x12e796['params']['id'][_0xd702('0x75')]()))['where'](_0xd702('0x76'),squel[_0xd702('0x67')]()[_0xd702('0x68')]('calleridnum')['from'](_0xd702('0x72'))[_0xd702('0x3b')](_0xd702('0x7d'),_0x12e796['params']['id'][_0xd702('0x75')]())[_0xd702('0x3b')]('state\x20=\x204'))['group'](_0xd702('0x6d')))[_0xd702('0x75')]();return db[_0xd702('0x4b')][_0xd702('0x2e')](_0x2eab19);}return[];})['then'](respondWithResult(_0x45ba8b,null))[_0xd702('0x44')](handleError(_0x45ba8b,null));};exports[_0xd702('0x7f')]=function(_0x585c11,_0x30fee0,_0x1a4f4c){return db[_0xd702('0x80')]['findOne']({'where':{'VoiceQueueId':_0x585c11['body'][_0xd702('0x65')],'CampaignId':_0x585c11[_0xd702('0x47')]['CampaignId'],'ContactId':_0x585c11[_0xd702('0x47')][_0xd702('0x6d')]}})[_0xd702('0x42')](handleEntityNotFound(_0x30fee0,null))[_0xd702('0x42')](function(_0x17e3a4){if(_0x17e3a4){return _0x17e3a4;}return null;})[_0xd702('0x42')](respondWithResult(_0x30fee0,null))['catch'](handleError(_0x30fee0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index a0c1e84..ee62ac2 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 _0xcccc=['api','moment','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xcccc,0x177));var _0xcccc=function(_0x3403d5,_0x3d99fc){_0x3403d5=_0x3403d5-0x0;var _0xf9df4f=_0xcccc[_0x3403d5];return _0xf9df4f;};'use strict';var _=require('lodash');var util=require(_0xcccc('0x0'));var logger=require(_0xcccc('0x1'))(_0xcccc('0x2'));var moment=require(_0xcccc('0x3'));var BPromise=require(_0xcccc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcccc('0x5'));var config=require(_0xcccc('0x6'));var attributes=require(_0xcccc('0x7'));module[_0xcccc('0x8')]=function(_0x241828,_0x202ab2){return _0x241828['define'](_0xcccc('0x9'),attributes,{'tableName':_0xcccc('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xcccc('0xb')]},{'name':_0xcccc('0xc'),'fields':[_0xcccc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5537=['calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal'];(function(_0x3576f9,_0x345e1a){var _0x256da2=function(_0x11e641){while(--_0x11e641){_0x3576f9['push'](_0x3576f9['shift']());}};_0x256da2(++_0x345e1a);}(_0x5537,0x1c9));var _0x7553=function(_0x56d8c2,_0x57f08f){_0x56d8c2=_0x56d8c2-0x0;var _0x2772e0=_0x5537[_0x56d8c2];return _0x2772e0;};'use strict';var _=require(_0x7553('0x0'));var util=require(_0x7553('0x1'));var logger=require(_0x7553('0x2'))(_0x7553('0x3'));var moment=require('moment');var BPromise=require(_0x7553('0x4'));var rp=require(_0x7553('0x5'));var fs=require('fs');var path=require(_0x7553('0x6'));var rimraf=require(_0x7553('0x7'));var config=require('../../config/environment');var attributes=require(_0x7553('0x8'));module['exports']=function(_0x1f15ec,_0x398a44){return _0x1f15ec[_0x7553('0x9')](_0x7553('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x7553('0xb'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 50cfcd5..939e8c6 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 _0x3906=['CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x77d2e9,_0x385576){var _0x4ed14b=function(_0x1d5595){while(--_0x1d5595){_0x77d2e9['push'](_0x77d2e9['shift']());}};_0x4ed14b(++_0x385576);}(_0x3906,0x11b));var _0x6390=function(_0x4b4cdb,_0x35eafb){_0x4b4cdb=_0x4b4cdb-0x0;var _0x318606=_0x3906[_0x4b4cdb];return _0x318606;};'use strict';var _=require(_0x6390('0x0'));var util=require(_0x6390('0x1'));var moment=require(_0x6390('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6390('0x3'));var db=require(_0x6390('0x4'))['db'];var utils=require(_0x6390('0x5'));var logger=require(_0x6390('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6390('0x7'));var client=jayson['client'][_0x6390('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb75825,_0x641547,_0x3e1c57){return new BPromise(function(_0x5ad012,_0x4acf14){return client[_0x6390('0x9')](_0xb75825,_0x3e1c57)[_0x6390('0xa')](function(_0x3e6414){logger['info'](_0x6390('0xb'),_0x641547,_0x6390('0xc'));logger[_0x6390('0xd')](_0x6390('0xe'),_0x641547,_0x6390('0xc'),JSON['stringify'](_0x3e6414));if(_0x3e6414[_0x6390('0xf')]){if(_0x3e6414[_0x6390('0xf')]['code']===0x1f4){logger['error'](_0x6390('0xb'),_0x641547,_0x3e6414[_0x6390('0xf')]['message']);return _0x4acf14(_0x3e6414[_0x6390('0xf')][_0x6390('0x10')]);}logger[_0x6390('0xf')](_0x6390('0xb'),_0x641547,_0x3e6414['error'][_0x6390('0x10')]);return _0x5ad012(_0x3e6414[_0x6390('0xf')][_0x6390('0x10')]);}else{logger[_0x6390('0x11')](_0x6390('0xb'),_0x641547,'request\x20sent');_0x5ad012(_0x3e6414[_0x6390('0x12')][_0x6390('0x10')]);}})[_0x6390('0x13')](function(_0x5831a3){logger[_0x6390('0xf')](_0x6390('0xb'),_0x641547,_0x5831a3);_0x4acf14(_0x5831a3);});});}exports[_0x6390('0x14')]=function(_0x2e3c49){var _0x370336=this;return new Promise(function(_0x3587f2,_0x57cb7e){return db[_0x6390('0x15')][_0x6390('0x16')](_0x2e3c49[_0x6390('0x17')],{'raw':_0x2e3c49[_0x6390('0x18')]?_0x2e3c49['options'][_0x6390('0x19')]===undefined?!![]:![]:!![]})[_0x6390('0xa')](function(_0x4af3c6){logger[_0x6390('0x11')](_0x6390('0x14'),_0x2e3c49);logger[_0x6390('0xd')](_0x6390('0x14'),_0x2e3c49,JSON[_0x6390('0x1a')](_0x4af3c6));_0x3587f2(_0x4af3c6);})[_0x6390('0x13')](function(_0x46b9a3){logger['error']('CreateCmHopperFinal',_0x46b9a3[_0x6390('0x10')],_0x2e3c49);_0x57cb7e(_0x370336['error'](0x1f4,_0x46b9a3[_0x6390('0x10')]));});});}; \ No newline at end of file +var _0xcccf=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperFinal','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcccf,0x1c8));var _0xfccc=function(_0x1bd331,_0x275220){_0x1bd331=_0x1bd331-0x0;var _0x242b07=_0xcccf[_0x1bd331];return _0x242b07;};'use strict';var _=require(_0xfccc('0x0'));var util=require(_0xfccc('0x1'));var moment=require(_0xfccc('0x2'));var BPromise=require(_0xfccc('0x3'));var rs=require(_0xfccc('0x4'));var fs=require('fs');var Redis=require(_0xfccc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfccc('0x6'));var logger=require(_0xfccc('0x7'))(_0xfccc('0x8'));var config=require(_0xfccc('0x9'));var jayson=require(_0xfccc('0xa'));var client=jayson[_0xfccc('0xb')][_0xfccc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f0c26,_0xe747e3,_0x380b6a){return new BPromise(function(_0x184c6b,_0x311a81){return client[_0xfccc('0xd')](_0x4f0c26,_0x380b6a)[_0xfccc('0xe')](function(_0xbc3555){logger[_0xfccc('0xf')](_0xfccc('0x10'),_0xe747e3,_0xfccc('0x11'));logger['debug'](_0xfccc('0x12'),_0xe747e3,_0xfccc('0x11'),JSON['stringify'](_0xbc3555));if(_0xbc3555[_0xfccc('0x13')]){if(_0xbc3555[_0xfccc('0x13')]['code']===0x1f4){logger[_0xfccc('0x13')](_0xfccc('0x10'),_0xe747e3,_0xbc3555[_0xfccc('0x13')][_0xfccc('0x14')]);return _0x311a81(_0xbc3555[_0xfccc('0x13')][_0xfccc('0x14')]);}logger[_0xfccc('0x13')](_0xfccc('0x10'),_0xe747e3,_0xbc3555[_0xfccc('0x13')][_0xfccc('0x14')]);return _0x184c6b(_0xbc3555['error'][_0xfccc('0x14')]);}else{logger[_0xfccc('0xf')](_0xfccc('0x10'),_0xe747e3,'request\x20sent');_0x184c6b(_0xbc3555[_0xfccc('0x15')][_0xfccc('0x14')]);}})[_0xfccc('0x16')](function(_0x45501e){logger['error'](_0xfccc('0x10'),_0xe747e3,_0x45501e);_0x311a81(_0x45501e);});});}exports[_0xfccc('0x17')]=function(_0x215126){var _0x4149d0=this;return new Promise(function(_0x42dd68,_0x6af93b){return db['CmHopperFinal'][_0xfccc('0x18')](_0x215126[_0xfccc('0x19')],{'raw':_0x215126[_0xfccc('0x1a')]?_0x215126[_0xfccc('0x1a')][_0xfccc('0x1b')]===undefined?!![]:![]:!![]})[_0xfccc('0xe')](function(_0x572ad2){logger[_0xfccc('0xf')]('CreateCmHopperFinal',_0x215126);logger[_0xfccc('0x1c')](_0xfccc('0x17'),_0x215126,JSON['stringify'](_0x572ad2));_0x42dd68(_0x572ad2);})[_0xfccc('0x16')](function(_0x4d3b5a){logger['error']('CreateCmHopperFinal',_0x4d3b5a[_0xfccc('0x14')],_0x215126);_0x6af93b(_0x4149d0['error'](0x1f4,_0x4d3b5a[_0xfccc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index ce533bb..229cafa 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 _0x1bb4=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2e5957,_0x578946){var _0x113f2d=function(_0x5bfa15){while(--_0x5bfa15){_0x2e5957['push'](_0x2e5957['shift']());}};_0x113f2d(++_0x578946);}(_0x1bb4,0x1bd));var _0x41bb=function(_0xcbade9,_0x29a9b1){_0xcbade9=_0xcbade9-0x0;var _0x5862af=_0x1bb4[_0xcbade9];return _0x5862af;};'use strict';var multer=require('multer');var util=require(_0x41bb('0x0'));var path=require(_0x41bb('0x1'));var timeout=require(_0x41bb('0x2'));var express=require(_0x41bb('0x3'));var router=express[_0x41bb('0x4')]();var auth=require(_0x41bb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x41bb('0x6'));router[_0x41bb('0x7')]('/',auth[_0x41bb('0x8')](),controller[_0x41bb('0x9')]);router[_0x41bb('0x7')](_0x41bb('0xa'),auth[_0x41bb('0x8')](),controller[_0x41bb('0xb')]);router[_0x41bb('0x7')](_0x41bb('0xc'),auth[_0x41bb('0x8')](),controller[_0x41bb('0xd')]);router[_0x41bb('0x7')](_0x41bb('0xe'),auth[_0x41bb('0x8')](),controller[_0x41bb('0xf')]);router[_0x41bb('0x7')](_0x41bb('0x10'),auth[_0x41bb('0x8')](),controller[_0x41bb('0x11')]);router[_0x41bb('0x12')](_0x41bb('0x13'),auth[_0x41bb('0x8')](),controller[_0x41bb('0x14')]);router[_0x41bb('0x12')](_0x41bb('0x15'),auth[_0x41bb('0x8')](),controller[_0x41bb('0x16')]);router[_0x41bb('0x12')]('/checkContactHopper',auth[_0x41bb('0x8')](),controller[_0x41bb('0x17')]);router[_0x41bb('0x18')](_0x41bb('0xc'),auth['isAuthenticated'](),controller[_0x41bb('0x19')]);module[_0x41bb('0x1a')]=router; \ No newline at end of file +var _0x668d=['/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5b5556,_0x31b326){var _0x75f96d=function(_0x441eae){while(--_0x441eae){_0x5b5556['push'](_0x5b5556['shift']());}};_0x75f96d(++_0x31b326);}(_0x668d,0xbd));var _0xd668=function(_0x185eba,_0x3b5ffb){_0x185eba=_0x185eba-0x0;var _0x5b3522=_0x668d[_0x185eba];return _0x5b3522;};'use strict';var multer=require('multer');var util=require(_0xd668('0x0'));var path=require(_0xd668('0x1'));var timeout=require(_0xd668('0x2'));var express=require(_0xd668('0x3'));var router=express[_0xd668('0x4')]();var auth=require(_0xd668('0x5'));var interaction=require(_0xd668('0x6'));var config=require(_0xd668('0x7'));var controller=require(_0xd668('0x8'));router[_0xd668('0x9')]('/',auth[_0xd668('0xa')](),controller[_0xd668('0xb')]);router[_0xd668('0x9')](_0xd668('0xc'),auth[_0xd668('0xa')](),controller[_0xd668('0xd')]);router[_0xd668('0x9')](_0xd668('0xe'),auth[_0xd668('0xa')](),controller[_0xd668('0xf')]);router[_0xd668('0x9')](_0xd668('0x10'),auth['isAuthenticated'](),controller[_0xd668('0x11')]);router[_0xd668('0x9')](_0xd668('0x12'),auth['isAuthenticated'](),controller[_0xd668('0x13')]);router[_0xd668('0x14')](_0xd668('0x15'),auth['isAuthenticated'](),controller[_0xd668('0x16')]);router[_0xd668('0x14')]('/voice/campaign/moveContacts/:id',auth[_0xd668('0xa')](),controller[_0xd668('0x17')]);router[_0xd668('0x14')](_0xd668('0x18'),auth['isAuthenticated'](),controller[_0xd668('0x19')]);router[_0xd668('0x1a')](_0xd668('0xe'),auth[_0xd668('0xa')](),controller[_0xd668('0x1b')]);module[_0xd668('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 4b59dfc..f4587ed 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 _0xe5b4=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x145175,_0x2c66d1){var _0x5adaf0=function(_0x517fe0){while(--_0x517fe0){_0x145175['push'](_0x145175['shift']());}};_0x5adaf0(++_0x2c66d1);}(_0xe5b4,0x10a));var _0x4e5b=function(_0x354c45,_0x42094b){_0x354c45=_0x354c45-0x0;var _0x352516=_0xe5b4[_0x354c45];return _0x352516;};'use strict';var Sequelize=require('sequelize');module[_0x4e5b('0x0')]={'state':{'type':Sequelize[_0x4e5b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4e5b('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4e5b('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x4e5b('0x2')]},'calleridnum':{'type':Sequelize[_0x4e5b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4e5b('0x3')]},'answertime':{'type':Sequelize[_0x4e5b('0x3')]},'droptime':{'type':Sequelize[_0x4e5b('0x3')]},'endtime':{'type':Sequelize[_0x4e5b('0x3')]},'ringtime':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x4e5b('0x2')]},'campaigntype':{'type':Sequelize[_0x4e5b('0x2')]},'membername':{'type':Sequelize[_0x4e5b('0x2')]},'reason':{'type':Sequelize[_0x4e5b('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x4e5b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4e5b('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4e5b('0x3')]},'recallme':{'type':Sequelize[_0x4e5b('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4e5b('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4e5b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1b3=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x387bb1,_0x4d6147){var _0x34506a=function(_0x4a735a){while(--_0x4a735a){_0x387bb1['push'](_0x387bb1['shift']());}};_0x34506a(++_0x4d6147);}(_0xb1b3,0x102));var _0x3b1b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb1b3[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x3b1b('0x0'));module[_0x3b1b('0x1')]={'state':{'type':Sequelize[_0x3b1b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3b1b('0x3')]},'countbusyretry':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3b1b('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x3b1b('0x4')]},'originatecalleridname':{'type':Sequelize[_0x3b1b('0x4')]},'calleridnum':{'type':Sequelize[_0x3b1b('0x4')]},'calleridname':{'type':Sequelize[_0x3b1b('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3b1b('0x3')]},'answertime':{'type':Sequelize[_0x3b1b('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3b1b('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3b1b('0x4')]},'campaign':{'type':Sequelize[_0x3b1b('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3b1b('0x4')]},'reason':{'type':Sequelize[_0x3b1b('0x4')]},'amd':{'type':Sequelize[_0x3b1b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3b1b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3b1b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3b1b('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3b1b('0x3')]},'edited':{'type':Sequelize[_0x3b1b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f155ae9..a80f58f 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 _0x2853=['limit','Content-Range','json','save','destroy','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','params','keys','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset'];(function(_0x4bed89,_0x423fef){var _0x359a70=function(_0xf4626f){while(--_0xf4626f){_0x4bed89['push'](_0x4bed89['shift']());}};_0x359a70(++_0x423fef);}(_0x2853,0x148));var _0x3285=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x2853[_0x42f009];return _0x22a1e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3285('0x0'));var rimraf=require(_0x3285('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3285('0x2'));var rp=require(_0x3285('0x3'));var moment=require(_0x3285('0x4'));var BPromise=require(_0x3285('0x5'));var Mustache=require(_0x3285('0x6'));var util=require(_0x3285('0x7'));var path=require(_0x3285('0x8'));var sox=require(_0x3285('0x9'));var csv=require('to-csv');var ejs=require(_0x3285('0xa'));var fs=require('fs');var _=require(_0x3285('0xb'));var squel=require(_0x3285('0xc'));var crypto=require(_0x3285('0xd'));var jsforce=require(_0x3285('0xe'));var deskjs=require(_0x3285('0xf'));var toCsv=require(_0x3285('0x10'));var querystring=require(_0x3285('0x11'));var Papa=require(_0x3285('0x12'));var Redis=require(_0x3285('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3285('0x14'));var as=require(_0x3285('0x15'));var hardwareService=require(_0x3285('0x16'));var logger=require(_0x3285('0x17'))(_0x3285('0x18'));var utils=require(_0x3285('0x19'));var config=require(_0x3285('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3285('0x1b'))['db'];function respondWithStatusCode(_0x4f376c,_0x4250a5){_0x4250a5=_0x4250a5||0xcc;return function(_0x185e81){if(_0x185e81){return _0x4f376c['sendStatus'](_0x4250a5);}return _0x4f376c['status'](_0x4250a5)[_0x3285('0x1c')]();};}function respondWithResult(_0x418f65,_0x422903){_0x422903=_0x422903||0xc8;return function(_0x120570){if(_0x120570){return _0x418f65[_0x3285('0x1d')](_0x422903)['json'](_0x120570);}};}function respondWithFilteredResult(_0x531137,_0x462eb5){return function(_0x450f6f){if(_0x450f6f){var _0x53ad19=_0x450f6f[_0x3285('0x1e')],_0x20f1c1=_0x462eb5[_0x3285('0x1f')],_0x12b5d5=_0x462eb5['offset']+_0x462eb5[_0x3285('0x20')],_0x4f4917;if(_0x12b5d5>=_0x53ad19){_0x12b5d5=_0x53ad19;_0x4f4917=0xc8;}else{_0x4f4917=0xce;}_0x531137['status'](_0x4f4917);return _0x531137['set'](_0x3285('0x21'),_0x20f1c1+'-'+_0x12b5d5+'/'+_0x53ad19)[_0x3285('0x22')](_0x450f6f);}return null;};}function patchUpdates(_0x1ddb7b){return function(_0x4f6855){try{jsonpatch['apply'](_0x4f6855,_0x1ddb7b,!![]);}catch(_0x23334e){return BPromise['reject'](_0x23334e);}return _0x4f6855[_0x3285('0x23')]();};}function saveUpdates(_0x206ed1,_0x6f663c){return function(_0x219381){if(_0x219381){return _0x219381['update'](_0x206ed1)['then'](function(_0x391cbd){return _0x391cbd;});}return null;};}function removeEntity(_0x1d976f,_0x4ecba5){return function(_0x3cd110){if(_0x3cd110){return _0x3cd110[_0x3285('0x24')]()['then'](function(){_0x1d976f[_0x3285('0x1d')](0xcc)[_0x3285('0x1c')]();});}};}function handleEntityNotFound(_0x12e175,_0x36d25a){return function(_0x5c4ced){if(!_0x5c4ced){_0x12e175['sendStatus'](0x194);}return _0x5c4ced;};}function handleError(_0x40b06b,_0x75557f){_0x75557f=_0x75557f||0x1f4;return function(_0x1852e1){logger['error'](_0x1852e1[_0x3285('0x25')]);if(_0x1852e1[_0x3285('0x26')]){delete _0x1852e1[_0x3285('0x26')];}_0x40b06b[_0x3285('0x1d')](_0x75557f)[_0x3285('0x27')](_0x1852e1);};}exports[_0x3285('0x28')]=function(_0x1ca802,_0x47d477){var _0x553370={},_0x32072d={},_0x1e735f={'count':0x0,'rows':[]};var _0x505044=_['map'](db[_0x3285('0x29')][_0x3285('0x2a')],function(_0x55ca81){return{'name':_0x55ca81[_0x3285('0x2b')],'type':_0x55ca81['type'][_0x3285('0x2c')]};});_0x32072d[_0x3285('0x2d')]=_['map'](_0x505044,_0x3285('0x26'));_0x32072d['query']=_['keys'](_0x1ca802[_0x3285('0x2e')]);_0x32072d['filters']=_[_0x3285('0x2f')](_0x32072d[_0x3285('0x2d')],_0x32072d['query']);_0x553370[_0x3285('0x30')]=_['intersection'](_0x32072d[_0x3285('0x2d')],qs['fields'](_0x1ca802[_0x3285('0x2e')][_0x3285('0x31')]));_0x553370[_0x3285('0x30')]=_0x553370[_0x3285('0x30')][_0x3285('0x32')]?_0x553370[_0x3285('0x30')]:_0x32072d[_0x3285('0x2d')];if(!_0x1ca802[_0x3285('0x2e')]['hasOwnProperty'](_0x3285('0x33'))){_0x553370[_0x3285('0x20')]=qs[_0x3285('0x20')](_0x1ca802[_0x3285('0x2e')][_0x3285('0x20')]);_0x553370[_0x3285('0x1f')]=qs['offset'](_0x1ca802[_0x3285('0x2e')][_0x3285('0x1f')]);}_0x553370[_0x3285('0x34')]=qs[_0x3285('0x35')](_0x1ca802['query'][_0x3285('0x35')]);_0x553370[_0x3285('0x36')]=qs[_0x3285('0x37')](_['pick'](_0x1ca802['query'],_0x32072d[_0x3285('0x37')]),_0x505044);if(_0x1ca802[_0x3285('0x2e')][_0x3285('0x38')]){_0x553370[_0x3285('0x36')]=_[_0x3285('0x39')](_0x553370[_0x3285('0x36')],{'$or':_['map'](_0x505044,function(_0x16a1d7){if(_0x16a1d7[_0x3285('0x3a')]!=='VIRTUAL'){var _0x459f81={};_0x459f81[_0x16a1d7['name']]={'$like':'%'+_0x1ca802[_0x3285('0x2e')]['filter']+'%'};return _0x459f81;}})});}_0x553370=_['merge']({},_0x553370,_0x1ca802[_0x3285('0x3b')]);var _0x19aaca={'where':_0x553370['where']};return db[_0x3285('0x29')][_0x3285('0x1e')](_0x19aaca)[_0x3285('0x3c')](function(_0xd60b1f){_0x1e735f[_0x3285('0x1e')]=_0xd60b1f;if(_0x1ca802[_0x3285('0x2e')][_0x3285('0x3d')]){_0x553370[_0x3285('0x3e')]=[{'all':!![]}];}return db[_0x3285('0x29')][_0x3285('0x3f')](_0x553370);})[_0x3285('0x3c')](function(_0x5bf72e){_0x1e735f[_0x3285('0x40')]=_0x5bf72e;return _0x1e735f;})[_0x3285('0x3c')](respondWithFilteredResult(_0x47d477,_0x553370))[_0x3285('0x41')](handleError(_0x47d477,null));};exports['show']=function(_0x4534ca,_0x43fddd){var _0x32217d={'raw':!![],'where':{'id':_0x4534ca[_0x3285('0x42')]['id']}},_0x1f316d={};_0x1f316d[_0x3285('0x2d')]=_[_0x3285('0x43')](db[_0x3285('0x29')][_0x3285('0x2a')]);_0x1f316d[_0x3285('0x2e')]=_[_0x3285('0x43')](_0x4534ca[_0x3285('0x2e')]);_0x1f316d[_0x3285('0x37')]=_['intersection'](_0x1f316d[_0x3285('0x2d')],_0x1f316d[_0x3285('0x2e')]);_0x32217d['attributes']=_[_0x3285('0x2f')](_0x1f316d[_0x3285('0x2d')],qs['fields'](_0x4534ca[_0x3285('0x2e')][_0x3285('0x31')]));_0x32217d[_0x3285('0x30')]=_0x32217d[_0x3285('0x30')]['length']?_0x32217d[_0x3285('0x30')]:_0x1f316d[_0x3285('0x2d')];if(_0x4534ca[_0x3285('0x2e')]['includeAll']){_0x32217d[_0x3285('0x3e')]=[{'all':!![]}];}_0x32217d=_['merge']({},_0x32217d,_0x4534ca[_0x3285('0x3b')]);return db[_0x3285('0x29')]['find'](_0x32217d)[_0x3285('0x3c')](handleEntityNotFound(_0x43fddd,null))[_0x3285('0x3c')](respondWithResult(_0x43fddd,null))[_0x3285('0x41')](handleError(_0x43fddd,null));};exports[_0x3285('0x44')]=function(_0x7fcd8e,_0x479d60){return db[_0x3285('0x29')][_0x3285('0x44')](_0x7fcd8e['body'],{})[_0x3285('0x3c')](respondWithResult(_0x479d60,0xc9))[_0x3285('0x41')](handleError(_0x479d60,null));};exports[_0x3285('0x45')]=function(_0x51cfba,_0x45fed6){return db['CmHopperHistory'][_0x3285('0x45')]()[_0x3285('0x3c')](respondWithResult(_0x45fed6,null))['catch'](handleError(_0x45fed6,null));};exports['update']=function(_0x1bde56,_0x4a2c11){if(_0x1bde56[_0x3285('0x46')][_0x3285('0x47')]){delete _0x1bde56[_0x3285('0x46')][_0x3285('0x47')];}return db[_0x3285('0x29')]['find']({'where':{'uniqueid':_0x1bde56[_0x3285('0x42')]['id']}})[_0x3285('0x3c')](handleEntityNotFound(_0x4a2c11,null))[_0x3285('0x3c')](saveUpdates(_0x1bde56[_0x3285('0x46')],null))['then'](respondWithResult(_0x4a2c11,null))[_0x3285('0x41')](handleError(_0x4a2c11,null));}; \ No newline at end of file +var _0xf296=['path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','filter','options','CmHopperHistory','count','includeAll','include','findAll','catch','show','params','keys','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x7bb82c,_0x3b2e09){var _0x5a29ae=function(_0x1d863d){while(--_0x1d863d){_0x7bb82c['push'](_0x7bb82c['shift']());}};_0x5a29ae(++_0x3b2e09);}(_0xf296,0x11c));var _0x6f29=function(_0x1d36e9,_0x486977){_0x1d36e9=_0x1d36e9-0x0;var _0x824c53=_0xf296[_0x1d36e9];return _0x824c53;};'use strict';var pdf=require(_0x6f29('0x0'));var emlformat=require(_0x6f29('0x1'));var rimraf=require(_0x6f29('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6f29('0x3'));var moment=require(_0x6f29('0x4'));var BPromise=require(_0x6f29('0x5'));var Mustache=require(_0x6f29('0x6'));var util=require(_0x6f29('0x7'));var path=require(_0x6f29('0x8'));var sox=require(_0x6f29('0x9'));var csv=require(_0x6f29('0xa'));var ejs=require(_0x6f29('0xb'));var fs=require('fs');var _=require(_0x6f29('0xc'));var squel=require('squel');var crypto=require(_0x6f29('0xd'));var jsforce=require(_0x6f29('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6f29('0xa'));var querystring=require('querystring');var Papa=require(_0x6f29('0xf'));var Redis=require('ioredis');var authService=require(_0x6f29('0x10'));var qs=require(_0x6f29('0x11'));var as=require(_0x6f29('0x12'));var hardwareService=require(_0x6f29('0x13'));var logger=require(_0x6f29('0x14'))(_0x6f29('0x15'));var utils=require(_0x6f29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6f29('0x17'));var db=require(_0x6f29('0x18'))['db'];function respondWithStatusCode(_0x26de9e,_0x3c1c25){_0x3c1c25=_0x3c1c25||0xcc;return function(_0x43ea0f){if(_0x43ea0f){return _0x26de9e[_0x6f29('0x19')](_0x3c1c25);}return _0x26de9e[_0x6f29('0x1a')](_0x3c1c25)[_0x6f29('0x1b')]();};}function respondWithResult(_0x207a0b,_0x32b57b){_0x32b57b=_0x32b57b||0xc8;return function(_0x637dd7){if(_0x637dd7){return _0x207a0b[_0x6f29('0x1a')](_0x32b57b)['json'](_0x637dd7);}};}function respondWithFilteredResult(_0x599e79,_0x4d40fc){return function(_0x5ebaad){if(_0x5ebaad){var _0x3d427f=_0x5ebaad['count'],_0x447ff9=_0x4d40fc[_0x6f29('0x1c')],_0x438992=_0x4d40fc[_0x6f29('0x1c')]+_0x4d40fc[_0x6f29('0x1d')],_0x5718f6;if(_0x438992>=_0x3d427f){_0x438992=_0x3d427f;_0x5718f6=0xc8;}else{_0x5718f6=0xce;}_0x599e79[_0x6f29('0x1a')](_0x5718f6);return _0x599e79[_0x6f29('0x1e')](_0x6f29('0x1f'),_0x447ff9+'-'+_0x438992+'/'+_0x3d427f)[_0x6f29('0x20')](_0x5ebaad);}return null;};}function patchUpdates(_0x37c766){return function(_0x508c30){try{jsonpatch['apply'](_0x508c30,_0x37c766,!![]);}catch(_0x632a68){return BPromise[_0x6f29('0x21')](_0x632a68);}return _0x508c30[_0x6f29('0x22')]();};}function saveUpdates(_0x2de476,_0x1e5b45){return function(_0x196402){if(_0x196402){return _0x196402[_0x6f29('0x23')](_0x2de476)[_0x6f29('0x24')](function(_0x5a5bdd){return _0x5a5bdd;});}return null;};}function removeEntity(_0x478138,_0x519758){return function(_0x12d9d4){if(_0x12d9d4){return _0x12d9d4[_0x6f29('0x25')]()[_0x6f29('0x24')](function(){_0x478138[_0x6f29('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5585,_0x4548b6){return function(_0x559481){if(!_0x559481){_0x1b5585['sendStatus'](0x194);}return _0x559481;};}function handleError(_0x5b8a61,_0x38fe65){_0x38fe65=_0x38fe65||0x1f4;return function(_0x3c4923){logger['error'](_0x3c4923[_0x6f29('0x26')]);if(_0x3c4923[_0x6f29('0x27')]){delete _0x3c4923[_0x6f29('0x27')];}_0x5b8a61[_0x6f29('0x1a')](_0x38fe65)['send'](_0x3c4923);};}exports[_0x6f29('0x28')]=function(_0x573e54,_0xf5085e){var _0x2ee4d9={},_0x5591a7={},_0x98a32={'count':0x0,'rows':[]};var _0x72934b=_[_0x6f29('0x29')](db['CmHopperHistory'][_0x6f29('0x2a')],function(_0x489522){return{'name':_0x489522[_0x6f29('0x2b')],'type':_0x489522['type'][_0x6f29('0x2c')]};});_0x5591a7[_0x6f29('0x2d')]=_[_0x6f29('0x29')](_0x72934b,_0x6f29('0x27'));_0x5591a7['query']=_['keys'](_0x573e54[_0x6f29('0x2e')]);_0x5591a7[_0x6f29('0x2f')]=_[_0x6f29('0x30')](_0x5591a7['model'],_0x5591a7['query']);_0x2ee4d9[_0x6f29('0x31')]=_[_0x6f29('0x30')](_0x5591a7[_0x6f29('0x2d')],qs[_0x6f29('0x32')](_0x573e54[_0x6f29('0x2e')][_0x6f29('0x32')]));_0x2ee4d9[_0x6f29('0x31')]=_0x2ee4d9['attributes'][_0x6f29('0x33')]?_0x2ee4d9[_0x6f29('0x31')]:_0x5591a7[_0x6f29('0x2d')];if(!_0x573e54[_0x6f29('0x2e')]['hasOwnProperty']('nolimit')){_0x2ee4d9[_0x6f29('0x1d')]=qs[_0x6f29('0x1d')](_0x573e54['query']['limit']);_0x2ee4d9[_0x6f29('0x1c')]=qs[_0x6f29('0x1c')](_0x573e54[_0x6f29('0x2e')]['offset']);}_0x2ee4d9[_0x6f29('0x34')]=qs[_0x6f29('0x35')](_0x573e54[_0x6f29('0x2e')]['sort']);_0x2ee4d9[_0x6f29('0x36')]=qs[_0x6f29('0x2f')](_[_0x6f29('0x37')](_0x573e54['query'],_0x5591a7[_0x6f29('0x2f')]),_0x72934b);if(_0x573e54['query']['filter']){_0x2ee4d9[_0x6f29('0x36')]=_[_0x6f29('0x38')](_0x2ee4d9[_0x6f29('0x36')],{'$or':_[_0x6f29('0x29')](_0x72934b,function(_0x9b9b21){if(_0x9b9b21[_0x6f29('0x39')]!=='VIRTUAL'){var _0xb6bcaf={};_0xb6bcaf[_0x9b9b21[_0x6f29('0x27')]]={'$like':'%'+_0x573e54[_0x6f29('0x2e')][_0x6f29('0x3a')]+'%'};return _0xb6bcaf;}})});}_0x2ee4d9=_[_0x6f29('0x38')]({},_0x2ee4d9,_0x573e54[_0x6f29('0x3b')]);var _0x35470a={'where':_0x2ee4d9[_0x6f29('0x36')]};return db[_0x6f29('0x3c')]['count'](_0x35470a)['then'](function(_0x51decc){_0x98a32[_0x6f29('0x3d')]=_0x51decc;if(_0x573e54[_0x6f29('0x2e')][_0x6f29('0x3e')]){_0x2ee4d9[_0x6f29('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6f29('0x40')](_0x2ee4d9);})[_0x6f29('0x24')](function(_0x2d6b6d){_0x98a32['rows']=_0x2d6b6d;return _0x98a32;})[_0x6f29('0x24')](respondWithFilteredResult(_0xf5085e,_0x2ee4d9))[_0x6f29('0x41')](handleError(_0xf5085e,null));};exports[_0x6f29('0x42')]=function(_0x3d59d9,_0x3cf688){var _0x2ab20e={'raw':!![],'where':{'id':_0x3d59d9[_0x6f29('0x43')]['id']}},_0x251a04={};_0x251a04[_0x6f29('0x2d')]=_[_0x6f29('0x44')](db[_0x6f29('0x3c')]['rawAttributes']);_0x251a04[_0x6f29('0x2e')]=_['keys'](_0x3d59d9[_0x6f29('0x2e')]);_0x251a04[_0x6f29('0x2f')]=_[_0x6f29('0x30')](_0x251a04['model'],_0x251a04[_0x6f29('0x2e')]);_0x2ab20e[_0x6f29('0x31')]=_[_0x6f29('0x30')](_0x251a04[_0x6f29('0x2d')],qs[_0x6f29('0x32')](_0x3d59d9[_0x6f29('0x2e')][_0x6f29('0x32')]));_0x2ab20e[_0x6f29('0x31')]=_0x2ab20e[_0x6f29('0x31')][_0x6f29('0x33')]?_0x2ab20e['attributes']:_0x251a04[_0x6f29('0x2d')];if(_0x3d59d9[_0x6f29('0x2e')][_0x6f29('0x3e')]){_0x2ab20e['include']=[{'all':!![]}];}_0x2ab20e=_[_0x6f29('0x38')]({},_0x2ab20e,_0x3d59d9[_0x6f29('0x3b')]);return db[_0x6f29('0x3c')]['find'](_0x2ab20e)['then'](handleEntityNotFound(_0x3cf688,null))[_0x6f29('0x24')](respondWithResult(_0x3cf688,null))[_0x6f29('0x41')](handleError(_0x3cf688,null));};exports[_0x6f29('0x45')]=function(_0xdb8b38,_0xba076d){return db[_0x6f29('0x3c')][_0x6f29('0x45')](_0xdb8b38[_0x6f29('0x46')],{})[_0x6f29('0x24')](respondWithResult(_0xba076d,0xc9))[_0x6f29('0x41')](handleError(_0xba076d,null));};exports['describe']=function(_0x4fa6a1,_0x1f5328){return db[_0x6f29('0x3c')][_0x6f29('0x47')]()['then'](respondWithResult(_0x1f5328,null))[_0x6f29('0x41')](handleError(_0x1f5328,null));};exports[_0x6f29('0x23')]=function(_0x4a4fb0,_0xab00b){if(_0x4a4fb0[_0x6f29('0x46')][_0x6f29('0x48')]){delete _0x4a4fb0[_0x6f29('0x46')][_0x6f29('0x48')];}return db[_0x6f29('0x3c')]['find']({'where':{'uniqueid':_0x4a4fb0[_0x6f29('0x43')]['id']}})[_0x6f29('0x24')](handleEntityNotFound(_0xab00b,null))['then'](saveUpdates(_0x4a4fb0[_0x6f29('0x46')],null))[_0x6f29('0x24')](respondWithResult(_0xab00b,null))[_0x6f29('0x41')](handleError(_0xab00b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5e61406..b8dcb47 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 _0xdb42=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdb42,0x12c));var _0x2db4=function(_0x251bdd,_0x11f2f0){_0x251bdd=_0x251bdd-0x0;var _0x32cbe6=_0xdb42[_0x251bdd];return _0x32cbe6;};'use strict';var _=require(_0x2db4('0x0'));var util=require(_0x2db4('0x1'));var logger=require('../../config/logger')(_0x2db4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2db4('0x3'));var fs=require('fs');var path=require(_0x2db4('0x4'));var rimraf=require(_0x2db4('0x5'));var config=require(_0x2db4('0x6'));var attributes=require(_0x2db4('0x7'));module[_0x2db4('0x8')]=function(_0x10cb40,_0x437e83){return _0x10cb40[_0x2db4('0x9')](_0x2db4('0xa'),attributes,{'tableName':_0x2db4('0xb'),'paranoid':![],'indexes':[{'name':_0x2db4('0xc'),'fields':[_0x2db4('0xc')]},{'name':'uniqueid','fields':[_0x2db4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68ec=['rimraf','../../config/environment','exports','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3bacc3,_0x34003a){var _0x452724=function(_0x27a3b4){while(--_0x27a3b4){_0x3bacc3['push'](_0x3bacc3['shift']());}};_0x452724(++_0x34003a);}(_0x68ec,0x6e));var _0xc68e=function(_0x5d99c6,_0x2447af){_0x5d99c6=_0x5d99c6-0x0;var _0x2d2c9a=_0x68ec[_0x5d99c6];return _0x2d2c9a;};'use strict';var _=require('lodash');var util=require(_0xc68e('0x0'));var logger=require(_0xc68e('0x1'))(_0xc68e('0x2'));var moment=require(_0xc68e('0x3'));var BPromise=require(_0xc68e('0x4'));var rp=require(_0xc68e('0x5'));var fs=require('fs');var path=require(_0xc68e('0x6'));var rimraf=require(_0xc68e('0x7'));var config=require(_0xc68e('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xc68e('0x9')]=function(_0x116bfc,_0x55b7ad){return _0x116bfc['define']('CmHopperHistory',attributes,{'tableName':_0xc68e('0xa'),'paranoid':![],'indexes':[{'name':_0xc68e('0xb'),'fields':[_0xc68e('0xb')]},{'name':_0xc68e('0xc'),'fields':[_0xc68e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 4883d87..d5ac369 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 _0xa5e4=['CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa5e4,0x14d));var _0x4a5e=function(_0x2a90a3,_0x2c442d){_0x2a90a3=_0x2a90a3-0x0;var _0x2e245c=_0xa5e4[_0x2a90a3];return _0x2e245c;};'use strict';var _=require(_0x4a5e('0x0'));var util=require(_0x4a5e('0x1'));var moment=require(_0x4a5e('0x2'));var BPromise=require(_0x4a5e('0x3'));var rs=require(_0x4a5e('0x4'));var fs=require('fs');var Redis=require(_0x4a5e('0x5'));var db=require(_0x4a5e('0x6'))['db'];var utils=require(_0x4a5e('0x7'));var logger=require(_0x4a5e('0x8'))(_0x4a5e('0x9'));var config=require(_0x4a5e('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x482f69,_0x7ed7c,_0x3eafb4){return new BPromise(function(_0x36a907,_0x17a93f){return client[_0x4a5e('0xb')](_0x482f69,_0x3eafb4)[_0x4a5e('0xc')](function(_0x164f62){logger[_0x4a5e('0xd')](_0x4a5e('0xe'),_0x7ed7c,_0x4a5e('0xf'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x7ed7c,_0x4a5e('0xf'),JSON[_0x4a5e('0x10')](_0x164f62));if(_0x164f62['error']){if(_0x164f62[_0x4a5e('0x11')][_0x4a5e('0x12')]===0x1f4){logger[_0x4a5e('0x11')](_0x4a5e('0xe'),_0x7ed7c,_0x164f62['error'][_0x4a5e('0x13')]);return _0x17a93f(_0x164f62[_0x4a5e('0x11')][_0x4a5e('0x13')]);}logger[_0x4a5e('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x7ed7c,_0x164f62[_0x4a5e('0x11')][_0x4a5e('0x13')]);return _0x36a907(_0x164f62[_0x4a5e('0x11')][_0x4a5e('0x13')]);}else{logger[_0x4a5e('0xd')](_0x4a5e('0xe'),_0x7ed7c,_0x4a5e('0xf'));_0x36a907(_0x164f62[_0x4a5e('0x14')]['message']);}})[_0x4a5e('0x15')](function(_0x15d9a4){logger[_0x4a5e('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x7ed7c,_0x15d9a4);_0x17a93f(_0x15d9a4);});});}exports[_0x4a5e('0x16')]=function(_0x42cd40){var _0x2c4f4b=this;return new Promise(function(_0x2e4e26,_0x377103){return db[_0x4a5e('0x17')][_0x4a5e('0x18')](_0x42cd40[_0x4a5e('0x19')],{'raw':_0x42cd40[_0x4a5e('0x1a')]?_0x42cd40[_0x4a5e('0x1a')][_0x4a5e('0x1b')]===undefined?!![]:![]:!![]})[_0x4a5e('0xc')](function(_0x4dcdc4){logger['info'](_0x4a5e('0x16'),_0x42cd40);logger[_0x4a5e('0x1c')](_0x4a5e('0x16'),_0x42cd40,JSON[_0x4a5e('0x10')](_0x4dcdc4));_0x2e4e26(_0x4dcdc4);})[_0x4a5e('0x15')](function(_0x463e6f){logger[_0x4a5e('0x11')](_0x4a5e('0x16'),_0x463e6f['message'],_0x42cd40);_0x377103(_0x2c4f4b['error'](0x1f4,_0x463e6f[_0x4a5e('0x13')]));});});};exports[_0x4a5e('0x1d')]=function(_0x52245a){var _0x3bdcd8=this;return new Promise(function(_0x52f27d,_0x2051fb){return db[_0x4a5e('0x17')][_0x4a5e('0x1e')]({'raw':_0x52245a[_0x4a5e('0x1a')]?_0x52245a[_0x4a5e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x52245a['options']?_0x52245a[_0x4a5e('0x1a')][_0x4a5e('0x1f')]||null:null,'attributes':[[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db['sequelize'][_0x4a5e('0x22')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x24')))),_0x4a5e('0x25')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x4a5e('0x20')]['fn']('COUNT',db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x27')))),_0x4a5e('0x28')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x29'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x2a')))),_0x4a5e('0x2b')],[db['sequelize']['fn'](_0x4a5e('0x29'),db[_0x4a5e('0x20')]['fn']('IF',db['sequelize'][_0x4a5e('0x23')](_0x4a5e('0x2c')))),'predictiveIntervalAvgTalktime']]})[_0x4a5e('0xc')](function(_0x21414d){logger['info'](_0x4a5e('0x1d'),_0x52245a);logger['debug']('AvgHandleTime',_0x52245a,JSON['stringify'](_0x21414d));_0x52f27d(_0x21414d);})['catch'](function(_0x3f5ed2){logger[_0x4a5e('0x11')](_0x4a5e('0x1d'),_0x3f5ed2[_0x4a5e('0x13')],_0x52245a);_0x2051fb(_0x3bdcd8['error'](0x1f4,_0x3f5ed2['message']));});});};exports[_0x4a5e('0x2d')]=function(_0x5d1304){var _0xffacae=this;return new Promise(function(_0x40ef21,_0x35c28f){return db['CmHopperHistory'][_0x4a5e('0x1e')]({'raw':_0x5d1304['options']?_0x5d1304[_0x4a5e('0x1a')][_0x4a5e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d1304[_0x4a5e('0x1a')]?_0x5d1304['options']['where']||null:null,'attributes':[[_0x4a5e('0x2e'),_0x4a5e('0x2f')],[db['sequelize']['fn'](_0x4a5e('0x21'),db['sequelize']['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x30')))),_0x4a5e('0x31')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x32')))),_0x4a5e('0x33')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x24')))),_0x4a5e('0x34')],[db[_0x4a5e('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0x4a5e('0x35')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db['sequelize'][_0x4a5e('0x23')](_0x4a5e('0x36')))),'outboundCongestionCallsDay'],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')]['literal'](_0x4a5e('0x37')))),_0x4a5e('0x38')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db['sequelize']['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x39')))),_0x4a5e('0x3a')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x3b')))),_0x4a5e('0x3c')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0x4a5e('0x3d')],[db['sequelize']['fn'](_0x4a5e('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x4a5e('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0x4a5e('0x3e')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db[_0x4a5e('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x4a5e('0x20')]['fn']('COUNT',db[_0x4a5e('0x20')]['fn']('IF',db['sequelize'][_0x4a5e('0x23')](_0x4a5e('0x3f')))),_0x4a5e('0x40')],[db['sequelize']['fn']('COUNT',db[_0x4a5e('0x20')]['fn']('IF',db[_0x4a5e('0x20')][_0x4a5e('0x23')](_0x4a5e('0x41')))),_0x4a5e('0x42')],[db[_0x4a5e('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4a5e('0x20')]['literal'](_0x4a5e('0x43')))),_0x4a5e('0x44')]],'group':[_0x4a5e('0x2e')]})['then'](function(_0x29638a){logger['info']('GetVoiceQueueHopperHistory',_0x5d1304);logger[_0x4a5e('0x1c')]('GetVoiceQueueHopperHistory',_0x5d1304,JSON[_0x4a5e('0x10')](_0x29638a));_0x40ef21(_0x29638a);})[_0x4a5e('0x15')](function(_0x31842f){logger[_0x4a5e('0x11')](_0x4a5e('0x2d'),_0x31842f[_0x4a5e('0x13')],_0x5d1304);_0x35c28f(_0xffacae[_0x4a5e('0x11')](0x1f4,_0x31842f['message']));});});};exports[_0x4a5e('0x45')]=function(_0x383096){var _0x1823a3=this;return new Promise(function(_0x337f83,_0x3489b9){return db[_0x4a5e('0x17')]['findAll']({'raw':_0x383096['options']?_0x383096[_0x4a5e('0x1a')][_0x4a5e('0x1b')]===undefined?!![]:![]:!![],'where':_0x383096[_0x4a5e('0x1a')]?_0x383096[_0x4a5e('0x1a')]['where']||null:null,'attributes':[[_0x4a5e('0x2e'),_0x4a5e('0x2f')],[db[_0x4a5e('0x20')]['fn']('COUNT',db[_0x4a5e('0x20')][_0x4a5e('0x22')]('id')),_0x4a5e('0x46')],[db[_0x4a5e('0x20')]['fn'](_0x4a5e('0x21'),db['sequelize']['fn']('IF',db[_0x4a5e('0x20')]['literal'](_0x4a5e('0x24')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x4a5e('0xc')](function(_0x7cdd5d){logger[_0x4a5e('0xd')](_0x4a5e('0x45'),_0x383096);logger[_0x4a5e('0x1c')](_0x4a5e('0x45'),_0x383096,JSON[_0x4a5e('0x10')](_0x7cdd5d));_0x337f83(_0x7cdd5d);})[_0x4a5e('0x15')](function(_0x565391){logger['error']('GetCampaignHopperHistory',_0x565391[_0x4a5e('0x13')],_0x383096);_0x3489b9(_0x1823a3[_0x4a5e('0x11')](0x1f4,_0x565391[_0x4a5e('0x13')]));});});}; \ No newline at end of file +var _0x7f00=['findAll','sequelize','COUNT','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime'];(function(_0x2a8996,_0x38959e){var _0x5f4d66=function(_0x265a36){while(--_0x265a36){_0x2a8996['push'](_0x2a8996['shift']());}};_0x5f4d66(++_0x38959e);}(_0x7f00,0x136));var _0x07f0=function(_0xd76edb,_0x1583c4){_0xd76edb=_0xd76edb-0x0;var _0x528c9b=_0x7f00[_0xd76edb];return _0x528c9b;};'use strict';var _=require(_0x07f0('0x0'));var util=require(_0x07f0('0x1'));var moment=require(_0x07f0('0x2'));var BPromise=require(_0x07f0('0x3'));var rs=require(_0x07f0('0x4'));var fs=require('fs');var Redis=require(_0x07f0('0x5'));var db=require(_0x07f0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x07f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x07f0('0x8'));var client=jayson['client'][_0x07f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3afa2,_0x166a27,_0x2ae5e2){return new BPromise(function(_0x4e3099,_0x552694){return client[_0x07f0('0xa')](_0xe3afa2,_0x2ae5e2)[_0x07f0('0xb')](function(_0x423c02){logger[_0x07f0('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x166a27,_0x07f0('0xd'));logger[_0x07f0('0xe')](_0x07f0('0xf'),_0x166a27,_0x07f0('0xd'),JSON[_0x07f0('0x10')](_0x423c02));if(_0x423c02[_0x07f0('0x11')]){if(_0x423c02[_0x07f0('0x11')][_0x07f0('0x12')]===0x1f4){logger[_0x07f0('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x166a27,_0x423c02[_0x07f0('0x11')]['message']);return _0x552694(_0x423c02[_0x07f0('0x11')][_0x07f0('0x13')]);}logger[_0x07f0('0x11')](_0x07f0('0x14'),_0x166a27,_0x423c02[_0x07f0('0x11')][_0x07f0('0x13')]);return _0x4e3099(_0x423c02[_0x07f0('0x11')][_0x07f0('0x13')]);}else{logger[_0x07f0('0xc')](_0x07f0('0x14'),_0x166a27,'request\x20sent');_0x4e3099(_0x423c02[_0x07f0('0x15')]['message']);}})[_0x07f0('0x16')](function(_0x28c560){logger[_0x07f0('0x11')](_0x07f0('0x14'),_0x166a27,_0x28c560);_0x552694(_0x28c560);});});}exports[_0x07f0('0x17')]=function(_0x1754aa){var _0x2fd03f=this;return new Promise(function(_0x15bd6b,_0x4101ad){return db[_0x07f0('0x18')][_0x07f0('0x19')](_0x1754aa[_0x07f0('0x1a')],{'raw':_0x1754aa[_0x07f0('0x1b')]?_0x1754aa[_0x07f0('0x1b')][_0x07f0('0x1c')]===undefined?!![]:![]:!![]})[_0x07f0('0xb')](function(_0x13dd3a){logger[_0x07f0('0xc')](_0x07f0('0x17'),_0x1754aa);logger['debug'](_0x07f0('0x17'),_0x1754aa,JSON[_0x07f0('0x10')](_0x13dd3a));_0x15bd6b(_0x13dd3a);})[_0x07f0('0x16')](function(_0x4917d6){logger[_0x07f0('0x11')](_0x07f0('0x17'),_0x4917d6['message'],_0x1754aa);_0x4101ad(_0x2fd03f[_0x07f0('0x11')](0x1f4,_0x4917d6[_0x07f0('0x13')]));});});};exports[_0x07f0('0x1d')]=function(_0x144f7e){var _0x107fc9=this;return new Promise(function(_0x491656,_0x368b8c){return db[_0x07f0('0x18')][_0x07f0('0x1e')]({'raw':_0x144f7e[_0x07f0('0x1b')]?_0x144f7e[_0x07f0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x144f7e[_0x07f0('0x1b')]?_0x144f7e[_0x07f0('0x1b')]['where']||null:null,'attributes':[[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')]['col']('id')),_0x07f0('0x21')],[db['sequelize']['fn'](_0x07f0('0x20'),db['sequelize']['fn']('IF',db[_0x07f0('0x1f')]['literal'](_0x07f0('0x22')))),_0x07f0('0x23')],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')]['fn']('IF',db['sequelize'][_0x07f0('0x24')](_0x07f0('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x07f0('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')](_0x07f0('0x26')))),_0x07f0('0x27')],[db['sequelize']['fn'](_0x07f0('0x28'),db[_0x07f0('0x1f')]['fn']('IF',db['sequelize'][_0x07f0('0x24')](_0x07f0('0x29')))),_0x07f0('0x2a')],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x28'),db['sequelize']['fn']('IF',db[_0x07f0('0x1f')]['literal'](_0x07f0('0x2b')))),_0x07f0('0x2c')]]})[_0x07f0('0xb')](function(_0x4814fc){logger[_0x07f0('0xc')](_0x07f0('0x1d'),_0x144f7e);logger[_0x07f0('0xe')]('AvgHandleTime',_0x144f7e,JSON[_0x07f0('0x10')](_0x4814fc));_0x491656(_0x4814fc);})['catch'](function(_0x51df2c){logger['error']('AvgHandleTime',_0x51df2c[_0x07f0('0x13')],_0x144f7e);_0x368b8c(_0x107fc9[_0x07f0('0x11')](0x1f4,_0x51df2c['message']));});});};exports[_0x07f0('0x2d')]=function(_0x2fca6e){var _0x49ba24=this;return new Promise(function(_0x399e3d,_0x3fc88a){return db[_0x07f0('0x18')][_0x07f0('0x1e')]({'raw':_0x2fca6e[_0x07f0('0x1b')]?_0x2fca6e[_0x07f0('0x1b')][_0x07f0('0x1c')]===undefined?!![]:![]:!![],'where':_0x2fca6e['options']?_0x2fca6e['options'][_0x07f0('0x2e')]||null:null,'attributes':[[_0x07f0('0x2f'),'name'],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')]['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x07f0('0x30')],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db['sequelize']['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')](_0x07f0('0x31')))),_0x07f0('0x32')],[db[_0x07f0('0x1f')]['fn']('COUNT',db[_0x07f0('0x1f')]['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')](_0x07f0('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x07f0('0x33')))),'outboundBusyCallsDay'],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')]['fn']('IF',db[_0x07f0('0x1f')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x07f0('0x34')],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x07f0('0x35')],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db['sequelize']['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x07f0('0x36')],[db['sequelize']['fn']('COUNT',db[_0x07f0('0x1f')]['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x07f0('0x1f')]['fn']('COUNT',db[_0x07f0('0x1f')]['fn']('IF',db[_0x07f0('0x1f')]['literal'](_0x07f0('0x37')))),_0x07f0('0x38')],[db[_0x07f0('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')](_0x07f0('0x39')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')]['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')](_0x07f0('0x3a')))),_0x07f0('0x3b')],[db[_0x07f0('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x07f0('0x24')](_0x07f0('0x3c')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x07f0('0x20'),db['sequelize']['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')](_0x07f0('0x3d')))),'outboundRejectCallsDay'],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db['sequelize']['fn']('IF',db[_0x07f0('0x1f')][_0x07f0('0x24')](_0x07f0('0x3e')))),_0x07f0('0x3f')]],'group':[_0x07f0('0x2f')]})[_0x07f0('0xb')](function(_0x1afabf){logger[_0x07f0('0xc')](_0x07f0('0x2d'),_0x2fca6e);logger[_0x07f0('0xe')](_0x07f0('0x2d'),_0x2fca6e,JSON[_0x07f0('0x10')](_0x1afabf));_0x399e3d(_0x1afabf);})[_0x07f0('0x16')](function(_0x2464f0){logger[_0x07f0('0x11')](_0x07f0('0x2d'),_0x2464f0[_0x07f0('0x13')],_0x2fca6e);_0x3fc88a(_0x49ba24[_0x07f0('0x11')](0x1f4,_0x2464f0[_0x07f0('0x13')]));});});};exports[_0x07f0('0x40')]=function(_0x3b6a7e){var _0x21c4cc=this;return new Promise(function(_0x42dae3,_0x593a5e){return db[_0x07f0('0x18')]['findAll']({'raw':_0x3b6a7e['options']?_0x3b6a7e['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b6a7e[_0x07f0('0x1b')]?_0x3b6a7e[_0x07f0('0x1b')][_0x07f0('0x2e')]||null:null,'attributes':[[_0x07f0('0x2f'),'name'],[db[_0x07f0('0x1f')]['fn'](_0x07f0('0x20'),db[_0x07f0('0x1f')][_0x07f0('0x41')]('id')),_0x07f0('0x42')],[db['sequelize']['fn']('COUNT',db[_0x07f0('0x1f')]['fn']('IF',db['sequelize'][_0x07f0('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x07f0('0x43')]],'group':[_0x07f0('0x2f')]})['then'](function(_0x125d4a){logger[_0x07f0('0xc')](_0x07f0('0x40'),_0x3b6a7e);logger[_0x07f0('0xe')]('GetCampaignHopperHistory',_0x3b6a7e,JSON[_0x07f0('0x10')](_0x125d4a));_0x42dae3(_0x125d4a);})[_0x07f0('0x16')](function(_0xddca5){logger[_0x07f0('0x11')](_0x07f0('0x40'),_0xddca5[_0x07f0('0x13')],_0x3b6a7e);_0x593a5e(_0x21c4cc[_0x07f0('0x11')](0x1f4,_0xddca5[_0x07f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c075d6d..44a8605 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 _0x7b27=['../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','put','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x192c57,_0x2b44e3){var _0x16a144=function(_0x2de48a){while(--_0x2de48a){_0x192c57['push'](_0x192c57['shift']());}};_0x16a144(++_0x2b44e3);}(_0x7b27,0x12a));var _0x77b2=function(_0x7dc0e0,_0x477038){_0x7dc0e0=_0x7dc0e0-0x0;var _0x2553b2=_0x7b27[_0x7dc0e0];return _0x2553b2;};'use strict';var multer=require(_0x77b2('0x0'));var util=require(_0x77b2('0x1'));var path=require(_0x77b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x77b2('0x3'));var router=express[_0x77b2('0x4')]();var auth=require(_0x77b2('0x5'));var interaction=require(_0x77b2('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x77b2('0x7')]('/',auth['isAuthenticated'](),controller[_0x77b2('0x8')]);router[_0x77b2('0x7')](_0x77b2('0x9'),auth[_0x77b2('0xa')](),controller[_0x77b2('0xb')]);router['get'](_0x77b2('0xc'),auth['isAuthenticated'](),controller[_0x77b2('0xd')]);router['post']('/',auth[_0x77b2('0xa')](),controller['create']);router[_0x77b2('0xe')](_0x77b2('0xc'),auth[_0x77b2('0xa')](),controller['update']);module[_0x77b2('0xf')]=router; \ No newline at end of file +var _0x74f7=['update','exports','path','connect-timeout','express','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x330776,_0xe40a48){var _0x1b4a07=function(_0x593689){while(--_0x593689){_0x330776['push'](_0x330776['shift']());}};_0x1b4a07(++_0xe40a48);}(_0x74f7,0xbd));var _0x774f=function(_0x12bc06,_0x2a11e2){_0x12bc06=_0x12bc06-0x0;var _0x2de4e9=_0x74f7[_0x12bc06];return _0x2de4e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x774f('0x0'));var timeout=require(_0x774f('0x1'));var express=require(_0x774f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x774f('0x3'));var controller=require(_0x774f('0x4'));router[_0x774f('0x5')]('/',auth[_0x774f('0x6')](),controller[_0x774f('0x7')]);router[_0x774f('0x5')](_0x774f('0x8'),auth['isAuthenticated'](),controller[_0x774f('0x9')]);router[_0x774f('0x5')](_0x774f('0xa'),auth[_0x774f('0x6')](),controller[_0x774f('0xb')]);router[_0x774f('0xc')]('/',auth[_0x774f('0x6')](),controller[_0x774f('0xd')]);router[_0x774f('0xe')](_0x774f('0xa'),auth[_0x774f('0x6')](),controller[_0x774f('0xf')]);module[_0x774f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4972cc4..9c56b8e 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 _0xfc77=['sequelize','STRING'];(function(_0x4a232c,_0x4db76b){var _0xb5807f=function(_0x2e1e16){while(--_0x2e1e16){_0x4a232c['push'](_0x4a232c['shift']());}};_0xb5807f(++_0x4db76b);}(_0xfc77,0x152));var _0x7fc7=function(_0x35d568,_0x4d47ae){_0x35d568=_0x35d568-0x0;var _0x5dac84=_0xfc77[_0x35d568];return _0x5dac84;};'use strict';var Sequelize=require(_0x7fc7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7fc7('0x1')]},'dialPrefix':{'type':Sequelize[_0x7fc7('0x1')]}}; \ No newline at end of file +var _0xca2e=['exports','STRING','name','sequelize'];(function(_0x588906,_0xcbb563){var _0x358f21=function(_0x3ab376){while(--_0x3ab376){_0x588906['push'](_0x588906['shift']());}};_0x358f21(++_0xcbb563);}(_0xca2e,0x12b));var _0xeca2=function(_0x4b7d20,_0x170fd4){_0x4b7d20=_0x4b7d20-0x0;var _0x570e0c=_0xca2e[_0x4b7d20];return _0x570e0c;};'use strict';var Sequelize=require(_0xeca2('0x0'));module[_0xeca2('0x1')]={'name':{'type':Sequelize[_0xeca2('0x2')],'unique':_0xeca2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeca2('0x2')]},'dialPrefix':{'type':Sequelize[_0xeca2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 08f9fa0..ce5abff 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x16f1e5,_0x2ca0e1){var _0x1a3e76=function(_0x3a9e3c){while(--_0x3a9e3c){_0x16f1e5['push'](_0x16f1e5['shift']());}};_0x1a3e76(++_0x2ca0e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x382b77,_0x33803a){var _0x78205d=function(_0x4783fa){while(--_0x4783fa){_0x382b77['push'](_0x382b77['shift']());}};_0x78205d(++_0x33803a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9efb469..483570b 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 _0x8b29=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2be39b,_0x30ad22){var _0xfacd2e=function(_0x190e8d){while(--_0x190e8d){_0x2be39b['push'](_0x2be39b['shift']());}};_0xfacd2e(++_0x30ad22);}(_0x8b29,0x116));var _0x98b2=function(_0x7393f3,_0x1e8d92){_0x7393f3=_0x7393f3-0x0;var _0x34a0cb=_0x8b29[_0x7393f3];return _0x34a0cb;};'use strict';var EventEmitter=require(_0x98b2('0x0'));var CmList=require(_0x98b2('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x98b2('0x2')](0x0);var events={'afterCreate':_0x98b2('0x3'),'afterUpdate':_0x98b2('0x4'),'afterDestroy':_0x98b2('0x5')};function emitEvent(_0x1d6a18){return function(_0x3c67f9,_0x37ff28,_0x298956){CmListEvents[_0x98b2('0x6')](_0x1d6a18+':'+_0x3c67f9['id'],_0x3c67f9);CmListEvents[_0x98b2('0x6')](_0x1d6a18,_0x3c67f9);_0x298956(null);};}for(var e in events){if(events[_0x98b2('0x7')](e)){var event=events[e];CmList[_0x98b2('0x8')](e,emitEvent(event));}}module[_0x98b2('0x9')]=CmListEvents; \ No newline at end of file +var _0x9c9f=['save','remove','emit','hook','exports','events'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x9c9f,0xb3));var _0xf9c9=function(_0x410074,_0x11835b){_0x410074=_0x410074-0x0;var _0x5eb0de=_0x9c9f[_0x410074];return _0x5eb0de;};'use strict';var EventEmitter=require(_0xf9c9('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf9c9('0x1'),'afterUpdate':'update','afterDestroy':_0xf9c9('0x2')};function emitEvent(_0x238a70){return function(_0x37b6c5,_0x4eaded,_0x400018){CmListEvents['emit'](_0x238a70+':'+_0x37b6c5['id'],_0x37b6c5);CmListEvents[_0xf9c9('0x3')](_0x238a70,_0x37b6c5);_0x400018(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf9c9('0x4')](e,emitEvent(event));}}module[_0xf9c9('0x5')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4b34d24..4ea45e9 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 _0x3e7c=['moment','bluebird','request-promise','path','../../config/environment','./cmList.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x2c117b,_0x111031){var _0x41cd3c=function(_0x490969){while(--_0x490969){_0x2c117b['push'](_0x2c117b['shift']());}};_0x41cd3c(++_0x111031);}(_0x3e7c,0x189));var _0xc3e7=function(_0x214a41,_0x6d358d){_0x214a41=_0x214a41-0x0;var _0x2ea4d7=_0x3e7c[_0x214a41];return _0x2ea4d7;};'use strict';var _=require(_0xc3e7('0x0'));var util=require(_0xc3e7('0x1'));var logger=require(_0xc3e7('0x2'))('api');var moment=require(_0xc3e7('0x3'));var BPromise=require(_0xc3e7('0x4'));var rp=require(_0xc3e7('0x5'));var fs=require('fs');var path=require(_0xc3e7('0x6'));var rimraf=require('rimraf');var config=require(_0xc3e7('0x7'));var attributes=require(_0xc3e7('0x8'));module[_0xc3e7('0x9')]=function(_0x3d857a,_0x7ca51c){return _0x3d857a[_0xc3e7('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44bd=['cm_lists','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x44bd,0x109));var _0xd44b=function(_0x1b7bd3,_0x273774){_0x1b7bd3=_0x1b7bd3-0x0;var _0x340a98=_0x44bd[_0x1b7bd3];return _0x340a98;};'use strict';var _=require(_0xd44b('0x0'));var util=require(_0xd44b('0x1'));var logger=require(_0xd44b('0x2'))('api');var moment=require(_0xd44b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd44b('0x4'));var rimraf=require(_0xd44b('0x5'));var config=require(_0xd44b('0x6'));var attributes=require(_0xd44b('0x7'));module[_0xd44b('0x8')]=function(_0x375948,_0x21ee78){return _0x375948[_0xd44b('0x9')](_0xd44b('0xa'),attributes,{'tableName':_0xd44b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 79d735b..928b4cb 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 _0x8d66=['result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x8d66,0x139));var _0x68d6=function(_0x4cf5ae,_0xa956db){_0x4cf5ae=_0x4cf5ae-0x0;var _0xe618c3=_0x8d66[_0x4cf5ae];return _0xe618c3;};'use strict';var _=require(_0x68d6('0x0'));var util=require(_0x68d6('0x1'));var moment=require('moment');var BPromise=require(_0x68d6('0x2'));var rs=require(_0x68d6('0x3'));var fs=require('fs');var Redis=require(_0x68d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x68d6('0x5'))(_0x68d6('0x6'));var config=require('../../config/environment');var jayson=require(_0x68d6('0x7'));var client=jayson[_0x68d6('0x8')][_0x68d6('0x9')]({'port':0x232a});config[_0x68d6('0xa')]=_[_0x68d6('0xb')](config['redis'],{'host':_0x68d6('0xc'),'port':0x18eb});var socket=require(_0x68d6('0xd'))(new Redis(config[_0x68d6('0xa')]));require('./cmList.socket')[_0x68d6('0xe')](socket);function respondWithRpcPromise(_0x4e501a,_0x2f6e76,_0x4d84f3){return new BPromise(function(_0x42e13f,_0xee12ee){return client[_0x68d6('0xf')](_0x4e501a,_0x4d84f3)['then'](function(_0x1afa44){logger['info'](_0x68d6('0x10'),_0x2f6e76,_0x68d6('0x11'));logger[_0x68d6('0x12')](_0x68d6('0x13'),_0x2f6e76,_0x68d6('0x11'),JSON['stringify'](_0x1afa44));if(_0x1afa44[_0x68d6('0x14')]){if(_0x1afa44[_0x68d6('0x14')][_0x68d6('0x15')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2f6e76,_0x1afa44[_0x68d6('0x14')][_0x68d6('0x16')]);return _0xee12ee(_0x1afa44['error']['message']);}logger[_0x68d6('0x14')](_0x68d6('0x10'),_0x2f6e76,_0x1afa44[_0x68d6('0x14')]['message']);return _0x42e13f(_0x1afa44[_0x68d6('0x14')][_0x68d6('0x16')]);}else{logger['info'](_0x68d6('0x10'),_0x2f6e76,_0x68d6('0x11'));_0x42e13f(_0x1afa44[_0x68d6('0x17')][_0x68d6('0x16')]);}})['catch'](function(_0x3bfa6a){logger['error'](_0x68d6('0x10'),_0x2f6e76,_0x3bfa6a);_0xee12ee(_0x3bfa6a);});});} \ No newline at end of file +var _0x3764=['../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x3764,0x124));var _0x4376=function(_0x5b0da5,_0x271a8e){_0x5b0da5=_0x5b0da5-0x0;var _0x5c7a4c=_0x3764[_0x5b0da5];return _0x5c7a4c;};'use strict';var _=require(_0x4376('0x0'));var util=require(_0x4376('0x1'));var moment=require(_0x4376('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4376('0x3'));var db=require(_0x4376('0x4'))['db'];var utils=require(_0x4376('0x5'));var logger=require(_0x4376('0x6'))(_0x4376('0x7'));var config=require(_0x4376('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4376('0x9')]['http']({'port':0x232a});config[_0x4376('0xa')]=_['defaults'](config[_0x4376('0xa')],{'host':_0x4376('0xb'),'port':0x18eb});var socket=require(_0x4376('0xc'))(new Redis(config[_0x4376('0xa')]));require(_0x4376('0xd'))[_0x4376('0xe')](socket);function respondWithRpcPromise(_0x2c2c61,_0x328479,_0x28a820){return new BPromise(function(_0x2f1b2b,_0x4e55da){return client[_0x4376('0xf')](_0x2c2c61,_0x28a820)[_0x4376('0x10')](function(_0x51a954){logger[_0x4376('0x11')](_0x4376('0x12'),_0x328479,_0x4376('0x13'));logger[_0x4376('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x328479,_0x4376('0x13'),JSON[_0x4376('0x15')](_0x51a954));if(_0x51a954[_0x4376('0x16')]){if(_0x51a954[_0x4376('0x16')][_0x4376('0x17')]===0x1f4){logger[_0x4376('0x16')](_0x4376('0x12'),_0x328479,_0x51a954['error'][_0x4376('0x18')]);return _0x4e55da(_0x51a954['error'][_0x4376('0x18')]);}logger['error']('CmList,\x20%s,\x20%s',_0x328479,_0x51a954['error'][_0x4376('0x18')]);return _0x2f1b2b(_0x51a954[_0x4376('0x16')]['message']);}else{logger[_0x4376('0x11')](_0x4376('0x12'),_0x328479,_0x4376('0x13'));_0x2f1b2b(_0x51a954[_0x4376('0x19')][_0x4376('0x18')]);}})[_0x4376('0x1a')](function(_0x185d09){logger[_0x4376('0x16')](_0x4376('0x12'),_0x328479,_0x185d09);_0x4e55da(_0x185d09);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2ce96f6..7e9331e 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 _0x9a22=['update','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0xf78aa,_0x13e0a9){var _0x59f8be=function(_0x137059){while(--_0x137059){_0xf78aa['push'](_0xf78aa['shift']());}};_0x59f8be(++_0x13e0a9);}(_0x9a22,0x75));var _0x29a2=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x9a22[_0xa6cc5c];return _0x44803d;};'use strict';var CmListEvents=require(_0x29a2('0x0'));var events=[_0x29a2('0x1'),_0x29a2('0x2'),_0x29a2('0x3')];function createListener(_0x2f7a2d,_0xc7dd1f){return function(_0x195e9e){_0xc7dd1f['emit'](_0x2f7a2d,_0x195e9e);};}function removeListener(_0x4e617e,_0x427d51){return function(){CmListEvents[_0x29a2('0x4')](_0x4e617e,_0x427d51);};}exports[_0x29a2('0x5')]=function(_0x2ea411){for(var _0x261835=0x0,_0xfb91e8=events[_0x29a2('0x6')];_0x261835<_0xfb91e8;_0x261835++){var _0x2887e1=events[_0x261835];var _0x4b55de=createListener(_0x29a2('0x7')+_0x2887e1,_0x2ea411);CmListEvents['on'](_0x2887e1,_0x4b55de);}}; \ No newline at end of file +var _0x83d0=['save','remove','update','emit','removeListener','register','cmList:','./cmList.events'];(function(_0x5acd16,_0x1eb2b4){var _0x1a5cdd=function(_0x1cca56){while(--_0x1cca56){_0x5acd16['push'](_0x5acd16['shift']());}};_0x1a5cdd(++_0x1eb2b4);}(_0x83d0,0xb7));var _0x083d=function(_0x1a7625,_0x41857c){_0x1a7625=_0x1a7625-0x0;var _0x1afc5d=_0x83d0[_0x1a7625];return _0x1afc5d;};'use strict';var CmListEvents=require(_0x083d('0x0'));var events=[_0x083d('0x1'),_0x083d('0x2'),_0x083d('0x3')];function createListener(_0x408a00,_0x2d89ab){return function(_0x564d1d){_0x2d89ab[_0x083d('0x4')](_0x408a00,_0x564d1d);};}function removeListener(_0x4ff4cb,_0x5625dc){return function(){CmListEvents[_0x083d('0x5')](_0x4ff4cb,_0x5625dc);};}exports[_0x083d('0x6')]=function(_0x3c4b8c){for(var _0x2e75e8=0x0,_0x472c6b=events['length'];_0x2e75e8<_0x472c6b;_0x2e75e8++){var _0x4ec2e7=events[_0x2e75e8];var _0xddbf58=createListener(_0x083d('0x7')+_0x4ec2e7,_0x3c4b8c);CmListEvents['on'](_0x4ec2e7,_0xddbf58);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e89df63..87d78e9 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 71973de..ec87384 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(_0x205ee2,_0x2d0cdc){var _0x5bcb80=function(_0x5da31c){while(--_0x5da31c){_0x205ee2['push'](_0x205ee2['shift']());}};_0x5bcb80(++_0x2d0cdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x1256fe,_0x53e511){var _0x26b1be=function(_0x41fca0){while(--_0x41fca0){_0x1256fe['push'](_0x1256fe['shift']());}};_0x26b1be(++_0x53e511);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'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 a19b9a2..0d3a2a0 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 _0x5270=['save','then','destroy','error','stack','name','send','update','body','Condition','find','params','catch','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x5defbf,_0x1afd15){var _0x2cd9d5=function(_0x33a3d6){while(--_0x33a3d6){_0x5defbf['push'](_0x5defbf['shift']());}};_0x2cd9d5(++_0x1afd15);}(_0x5270,0x1d9));var _0x0527=function(_0x593bf1,_0x340a00){_0x593bf1=_0x593bf1-0x0;var _0x17c19c=_0x5270[_0x593bf1];return _0x17c19c;};'use strict';var pdf=require(_0x0527('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0527('0x1'));var jsonpatch=require(_0x0527('0x2'));var rp=require(_0x0527('0x3'));var moment=require(_0x0527('0x4'));var BPromise=require(_0x0527('0x5'));var Mustache=require('mustache');var util=require(_0x0527('0x6'));var path=require(_0x0527('0x7'));var sox=require(_0x0527('0x8'));var csv=require(_0x0527('0x9'));var ejs=require(_0x0527('0xa'));var fs=require('fs');var _=require(_0x0527('0xb'));var squel=require(_0x0527('0xc'));var crypto=require('crypto');var jsforce=require(_0x0527('0xd'));var deskjs=require(_0x0527('0xe'));var toCsv=require(_0x0527('0x9'));var querystring=require('querystring');var Papa=require(_0x0527('0xf'));var Redis=require('ioredis');var authService=require(_0x0527('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0527('0x11'));var hardwareService=require(_0x0527('0x12'));var logger=require(_0x0527('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0527('0x14'));var licenseUtil=require(_0x0527('0x15'));var db=require(_0x0527('0x16'))['db'];function respondWithStatusCode(_0x74bc98,_0x501749){_0x501749=_0x501749||0xcc;return function(_0x568562){if(_0x568562){return _0x74bc98[_0x0527('0x17')](_0x501749);}return _0x74bc98[_0x0527('0x18')](_0x501749)[_0x0527('0x19')]();};}function respondWithResult(_0x14761e,_0x326ad2){_0x326ad2=_0x326ad2||0xc8;return function(_0x18d84e){if(_0x18d84e){return _0x14761e[_0x0527('0x18')](_0x326ad2)[_0x0527('0x1a')](_0x18d84e);}};}function respondWithFilteredResult(_0x2d5d2f,_0x593ec9){return function(_0x5864ea){if(_0x5864ea){var _0x1c9ffd=_0x5864ea[_0x0527('0x1b')],_0x59d485=_0x593ec9[_0x0527('0x1c')],_0x2f1a27=_0x593ec9[_0x0527('0x1c')]+_0x593ec9[_0x0527('0x1d')],_0x505a3b;if(_0x2f1a27>=_0x1c9ffd){_0x2f1a27=_0x1c9ffd;_0x505a3b=0xc8;}else{_0x505a3b=0xce;}_0x2d5d2f[_0x0527('0x18')](_0x505a3b);return _0x2d5d2f[_0x0527('0x1e')](_0x0527('0x1f'),_0x59d485+'-'+_0x2f1a27+'/'+_0x1c9ffd)[_0x0527('0x1a')](_0x5864ea);}return null;};}function patchUpdates(_0x38119d){return function(_0x317bfd){try{jsonpatch[_0x0527('0x20')](_0x317bfd,_0x38119d,!![]);}catch(_0x33463d){return BPromise['reject'](_0x33463d);}return _0x317bfd[_0x0527('0x21')]();};}function saveUpdates(_0x38feda,_0x27b234){return function(_0x4206ae){if(_0x4206ae){return _0x4206ae['update'](_0x38feda)[_0x0527('0x22')](function(_0x4b1a4c){return _0x4b1a4c;});}return null;};}function removeEntity(_0x27f170,_0x209eda){return function(_0x2af69f){if(_0x2af69f){return _0x2af69f[_0x0527('0x23')]()[_0x0527('0x22')](function(){_0x27f170['status'](0xcc)[_0x0527('0x19')]();});}};}function handleEntityNotFound(_0x361146,_0x413339){return function(_0x5006f3){if(!_0x5006f3){_0x361146[_0x0527('0x17')](0x194);}return _0x5006f3;};}function handleError(_0x4a3ee6,_0x2df7e4){_0x2df7e4=_0x2df7e4||0x1f4;return function(_0x243b45){logger[_0x0527('0x24')](_0x243b45[_0x0527('0x25')]);if(_0x243b45[_0x0527('0x26')]){delete _0x243b45[_0x0527('0x26')];}_0x4a3ee6[_0x0527('0x18')](_0x2df7e4)[_0x0527('0x27')](_0x243b45);};}exports[_0x0527('0x28')]=function(_0x3cd1f6,_0x131652){if(_0x3cd1f6[_0x0527('0x29')]['id']){delete _0x3cd1f6[_0x0527('0x29')]['id'];}return db[_0x0527('0x2a')][_0x0527('0x2b')]({'where':{'id':_0x3cd1f6[_0x0527('0x2c')]['id']}})[_0x0527('0x22')](handleEntityNotFound(_0x131652,null))[_0x0527('0x22')](saveUpdates(_0x3cd1f6['body'],null))[_0x0527('0x22')](respondWithResult(_0x131652,null))[_0x0527('0x2d')](handleError(_0x131652,null));};exports['destroy']=function(_0x1f0675,_0xf344bf){return db[_0x0527('0x2a')][_0x0527('0x2b')]({'where':{'id':_0x1f0675[_0x0527('0x2c')]['id']}})[_0x0527('0x22')](handleEntityNotFound(_0xf344bf,null))[_0x0527('0x22')](removeEntity(_0xf344bf,null))[_0x0527('0x2d')](handleError(_0xf344bf,null));}; \ No newline at end of file +var _0xbee5=['offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','Condition','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','end','status','json','count'];(function(_0x18e8ab,_0x7ee114){var _0x10a7b4=function(_0x22b228){while(--_0x22b228){_0x18e8ab['push'](_0x18e8ab['shift']());}};_0x10a7b4(++_0x7ee114);}(_0xbee5,0x1c9));var _0x5bee=function(_0x23d8c9,_0x4660b9){_0x23d8c9=_0x23d8c9-0x0;var _0xb8ccda=_0xbee5[_0x23d8c9];return _0xb8ccda;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5bee('0x0'));var rimraf=require(_0x5bee('0x1'));var zipdir=require(_0x5bee('0x2'));var jsonpatch=require(_0x5bee('0x3'));var rp=require(_0x5bee('0x4'));var moment=require(_0x5bee('0x5'));var BPromise=require(_0x5bee('0x6'));var Mustache=require('mustache');var util=require(_0x5bee('0x7'));var path=require(_0x5bee('0x8'));var sox=require(_0x5bee('0x9'));var csv=require(_0x5bee('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5bee('0xb'));var squel=require(_0x5bee('0xc'));var crypto=require('crypto');var jsforce=require(_0x5bee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5bee('0xa'));var querystring=require(_0x5bee('0xe'));var Papa=require(_0x5bee('0xf'));var Redis=require(_0x5bee('0x10'));var authService=require(_0x5bee('0x11'));var qs=require(_0x5bee('0x12'));var as=require(_0x5bee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bee('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5bee('0x15'));var db=require(_0x5bee('0x16'))['db'];function respondWithStatusCode(_0x128ea5,_0x14c753){_0x14c753=_0x14c753||0xcc;return function(_0x506298){if(_0x506298){return _0x128ea5['sendStatus'](_0x14c753);}return _0x128ea5['status'](_0x14c753)[_0x5bee('0x17')]();};}function respondWithResult(_0x22f93e,_0x5744d5){_0x5744d5=_0x5744d5||0xc8;return function(_0x598de4){if(_0x598de4){return _0x22f93e[_0x5bee('0x18')](_0x5744d5)[_0x5bee('0x19')](_0x598de4);}};}function respondWithFilteredResult(_0x3a107c,_0x54a279){return function(_0x412417){if(_0x412417){var _0x12d75b=_0x412417[_0x5bee('0x1a')],_0x5182b5=_0x54a279[_0x5bee('0x1b')],_0x48ddf9=_0x54a279[_0x5bee('0x1b')]+_0x54a279[_0x5bee('0x1c')],_0x4f8042;if(_0x48ddf9>=_0x12d75b){_0x48ddf9=_0x12d75b;_0x4f8042=0xc8;}else{_0x4f8042=0xce;}_0x3a107c['status'](_0x4f8042);return _0x3a107c['set'](_0x5bee('0x1d'),_0x5182b5+'-'+_0x48ddf9+'/'+_0x12d75b)[_0x5bee('0x19')](_0x412417);}return null;};}function patchUpdates(_0x19534b){return function(_0x6ce0ac){try{jsonpatch[_0x5bee('0x1e')](_0x6ce0ac,_0x19534b,!![]);}catch(_0x3c726c){return BPromise['reject'](_0x3c726c);}return _0x6ce0ac[_0x5bee('0x1f')]();};}function saveUpdates(_0x1bd5e2,_0x20ed5e){return function(_0x29bfec){if(_0x29bfec){return _0x29bfec[_0x5bee('0x20')](_0x1bd5e2)[_0x5bee('0x21')](function(_0x56864e){return _0x56864e;});}return null;};}function removeEntity(_0x54af23,_0x423bde){return function(_0x2f24b5){if(_0x2f24b5){return _0x2f24b5[_0x5bee('0x22')]()[_0x5bee('0x21')](function(){_0x54af23['status'](0xcc)[_0x5bee('0x17')]();});}};}function handleEntityNotFound(_0x445c2f,_0x33642e){return function(_0x83fa87){if(!_0x83fa87){_0x445c2f[_0x5bee('0x23')](0x194);}return _0x83fa87;};}function handleError(_0xd30c82,_0x474f93){_0x474f93=_0x474f93||0x1f4;return function(_0x39e26a){logger[_0x5bee('0x24')](_0x39e26a[_0x5bee('0x25')]);if(_0x39e26a[_0x5bee('0x26')]){delete _0x39e26a[_0x5bee('0x26')];}_0xd30c82[_0x5bee('0x18')](_0x474f93)[_0x5bee('0x27')](_0x39e26a);};}exports[_0x5bee('0x20')]=function(_0x1645f0,_0x1aebe8){if(_0x1645f0['body']['id']){delete _0x1645f0['body']['id'];}return db[_0x5bee('0x28')][_0x5bee('0x29')]({'where':{'id':_0x1645f0[_0x5bee('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1aebe8,null))[_0x5bee('0x21')](saveUpdates(_0x1645f0['body'],null))[_0x5bee('0x21')](respondWithResult(_0x1aebe8,null))[_0x5bee('0x2b')](handleError(_0x1aebe8,null));};exports['destroy']=function(_0x4953e8,_0x1afdbb){return db['Condition'][_0x5bee('0x29')]({'where':{'id':_0x4953e8[_0x5bee('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1afdbb,null))['then'](removeEntity(_0x1afdbb,null))[_0x5bee('0x2b')](handleError(_0x1afdbb,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index e472197..d3132d6 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 _0x0e7b=['tools_conditions','lodash','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition'];(function(_0x18f439,_0x565fdf){var _0x30be02=function(_0x5485ff){while(--_0x5485ff){_0x18f439['push'](_0x18f439['shift']());}};_0x30be02(++_0x565fdf);}(_0x0e7b,0x1da));var _0xb0e7=function(_0x256011,_0x3b14cf){_0x256011=_0x256011-0x0;var _0x40f0f8=_0x0e7b[_0x256011];return _0x40f0f8;};'use strict';var _=require(_0xb0e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb0e7('0x1'));var moment=require(_0xb0e7('0x2'));var BPromise=require('bluebird');var rp=require(_0xb0e7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0e7('0x4'));var config=require(_0xb0e7('0x5'));var attributes=require(_0xb0e7('0x6'));module[_0xb0e7('0x7')]=function(_0x434188,_0xb9ff94){return _0x434188[_0xb0e7('0x8')](_0xb0e7('0x9'),attributes,{'tableName':_0xb0e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x047a=['bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x123dd0,_0x260e94){var _0x526da9=function(_0x1e4558){while(--_0x1e4558){_0x123dd0['push'](_0x123dd0['shift']());}};_0x526da9(++_0x260e94);}(_0x047a,0x1e7));var _0xa047=function(_0x40710f,_0x3f145e){_0x40710f=_0x40710f-0x0;var _0x591385=_0x047a[_0x40710f];return _0x591385;};'use strict';var _=require(_0xa047('0x0'));var util=require('util');var logger=require(_0xa047('0x1'))(_0xa047('0x2'));var moment=require('moment');var BPromise=require(_0xa047('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa047('0x4'));var rimraf=require(_0xa047('0x5'));var config=require(_0xa047('0x6'));var attributes=require(_0xa047('0x7'));module[_0xa047('0x8')]=function(_0xd0bb7a,_0x138aae){return _0xd0bb7a[_0xa047('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index aeccbdc..66d94ef 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 _0x651b=['../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43226d,_0x51695c){var _0x1fa4dc=function(_0x57b000){while(--_0x57b000){_0x43226d['push'](_0x43226d['shift']());}};_0x1fa4dc(++_0x51695c);}(_0x651b,0x148));var _0xb651=function(_0x7d579a,_0x1580b){_0x7d579a=_0x7d579a-0x0;var _0x3b06cb=_0x651b[_0x7d579a];return _0x3b06cb;};'use strict';var _=require(_0xb651('0x0'));var util=require(_0xb651('0x1'));var moment=require('moment');var BPromise=require(_0xb651('0x2'));var rs=require(_0xb651('0x3'));var fs=require('fs');var Redis=require(_0xb651('0x4'));var db=require(_0xb651('0x5'))['db'];var utils=require(_0xb651('0x6'));var logger=require(_0xb651('0x7'))('rpc');var config=require(_0xb651('0x8'));var jayson=require(_0xb651('0x9'));var client=jayson[_0xb651('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b0a30,_0x894885,_0x3ea64f){return new BPromise(function(_0x3b091d,_0x39fd87){return client[_0xb651('0xb')](_0x1b0a30,_0x3ea64f)[_0xb651('0xc')](function(_0x5428e8){logger[_0xb651('0xd')](_0xb651('0xe'),_0x894885,_0xb651('0xf'));logger[_0xb651('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x894885,'request\x20sent',JSON[_0xb651('0x11')](_0x5428e8));if(_0x5428e8['error']){if(_0x5428e8[_0xb651('0x12')]['code']===0x1f4){logger[_0xb651('0x12')](_0xb651('0xe'),_0x894885,_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);return _0x39fd87(_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);}logger['error']('Condition,\x20%s,\x20%s',_0x894885,_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);return _0x3b091d(_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);}else{logger[_0xb651('0xd')](_0xb651('0xe'),_0x894885,_0xb651('0xf'));_0x3b091d(_0x5428e8['result']['message']);}})[_0xb651('0x14')](function(_0x367c1c){logger[_0xb651('0x12')]('Condition,\x20%s,\x20%s',_0x894885,_0x367c1c);_0x39fd87(_0x367c1c);});});} \ No newline at end of file +var _0xf44a=['../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x121ca2,_0xe03b9b){var _0x66e9de=function(_0x126b98){while(--_0x126b98){_0x121ca2['push'](_0x121ca2['shift']());}};_0x66e9de(++_0xe03b9b);}(_0xf44a,0xeb));var _0xaf44=function(_0x2f23c8,_0x3d052f){_0x2f23c8=_0x2f23c8-0x0;var _0x594705=_0xf44a[_0x2f23c8];return _0x594705;};'use strict';var _=require(_0xaf44('0x0'));var util=require(_0xaf44('0x1'));var moment=require(_0xaf44('0x2'));var BPromise=require(_0xaf44('0x3'));var rs=require(_0xaf44('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf44('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf44('0x6'))('rpc');var config=require(_0xaf44('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaf44('0x8')][_0xaf44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c4072,_0x5b3301,_0x71e30){return new BPromise(function(_0x3bcbe1,_0x2b0f1a){return client[_0xaf44('0xa')](_0x3c4072,_0x71e30)[_0xaf44('0xb')](function(_0x426432){logger[_0xaf44('0xc')](_0xaf44('0xd'),_0x5b3301,_0xaf44('0xe'));logger[_0xaf44('0xf')](_0xaf44('0x10'),_0x5b3301,_0xaf44('0xe'),JSON['stringify'](_0x426432));if(_0x426432[_0xaf44('0x11')]){if(_0x426432[_0xaf44('0x11')][_0xaf44('0x12')]===0x1f4){logger[_0xaf44('0x11')](_0xaf44('0xd'),_0x5b3301,_0x426432[_0xaf44('0x11')]['message']);return _0x2b0f1a(_0x426432['error'][_0xaf44('0x13')]);}logger[_0xaf44('0x11')](_0xaf44('0xd'),_0x5b3301,_0x426432[_0xaf44('0x11')]['message']);return _0x3bcbe1(_0x426432[_0xaf44('0x11')]['message']);}else{logger['info'](_0xaf44('0xd'),_0x5b3301,_0xaf44('0xe'));_0x3bcbe1(_0x426432[_0xaf44('0x14')][_0xaf44('0x13')]);}})[_0xaf44('0x15')](function(_0x335305){logger[_0xaf44('0x11')](_0xaf44('0xd'),_0x5b3301,_0x335305);_0x2b0f1a(_0x335305);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 04e6bae..474e2a0 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 _0x4969=['./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x4969,0x133));var _0x9496=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x4969[_0x151381];return _0x2afab6;};'use strict';var multer=require(_0x9496('0x0'));var util=require(_0x9496('0x1'));var path=require(_0x9496('0x2'));var timeout=require(_0x9496('0x3'));var express=require(_0x9496('0x4'));var router=express[_0x9496('0x5')]();var auth=require(_0x9496('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9496('0x7'));var controller=require(_0x9496('0x8'));router[_0x9496('0x9')](_0x9496('0xa'),auth[_0x9496('0xb')](),controller[_0x9496('0xc')]);router[_0x9496('0xd')](_0x9496('0xa'),auth[_0x9496('0xb')](),controller['destroy']);module[_0x9496('0xe')]=router; \ No newline at end of file +var _0xdfaf=['/:id','isAuthenticated','update','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./condition.controller','put'];(function(_0x6b472f,_0x296e80){var _0xbcb4c6=function(_0x37f633){while(--_0x37f633){_0x6b472f['push'](_0x6b472f['shift']());}};_0xbcb4c6(++_0x296e80);}(_0xdfaf,0x7c));var _0xfdfa=function(_0x457087,_0x38f169){_0x457087=_0x457087-0x0;var _0x326523=_0xdfaf[_0x457087];return _0x326523;};'use strict';var multer=require(_0xfdfa('0x0'));var util=require(_0xfdfa('0x1'));var path=require(_0xfdfa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfdfa('0x3')]();var auth=require(_0xfdfa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfdfa('0x5'));var controller=require(_0xfdfa('0x6'));router[_0xfdfa('0x7')](_0xfdfa('0x8'),auth[_0xfdfa('0x9')](),controller[_0xfdfa('0xa')]);router['delete'](_0xfdfa('0x8'),auth[_0xfdfa('0x9')](),controller[_0xfdfa('0xb')]);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 30cca29..39e2b0d 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 _0x277c=['sequelize','STRING','name'];(function(_0x15feb3,_0x5cfb10){var _0x45be22=function(_0x31e7ea){while(--_0x31e7ea){_0x15feb3['push'](_0x15feb3['shift']());}};_0x45be22(++_0x5cfb10);}(_0x277c,0x153));var _0xc277=function(_0x9fe27b,_0x298af3){_0x9fe27b=_0x9fe27b-0x0;var _0x188392=_0x277c[_0x9fe27b];return _0x188392;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'name':{'type':Sequelize[_0xc277('0x1')],'allowNull':![],'unique':_0xc277('0x2')},'description':{'type':Sequelize[_0xc277('0x1')]}}; \ No newline at end of file +var _0xc01b=['name','sequelize','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc01b,0x65));var _0xbc01=function(_0x168221,_0x19475b){_0x168221=_0x168221-0x0;var _0xaf21e5=_0xc01b[_0x168221];return _0xaf21e5;};'use strict';var Sequelize=require(_0xbc01('0x0'));module[_0xbc01('0x1')]={'name':{'type':Sequelize[_0xbc01('0x2')],'allowNull':![],'unique':_0xbc01('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c98a0f0..4967f97 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 _0x5062=['clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardItem','getItems','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','then','get','CustomDashboards','UserProfileResource','end','sendStatus','name','send','index','map','Dashboard','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','update','attrUrl','attrs','value','https://','attrPath'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x5062,0x171));var _0x2506=function(_0x3cff94,_0x71a17d){_0x3cff94=_0x3cff94-0x0;var _0xc37d4f=_0x5062[_0x3cff94];return _0xc37d4f;};'use strict';var pdf=require(_0x2506('0x0'));var emlformat=require(_0x2506('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2506('0x2'));var jsonpatch=require(_0x2506('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2506('0x4'));var Mustache=require(_0x2506('0x5'));var util=require(_0x2506('0x6'));var path=require(_0x2506('0x7'));var sox=require(_0x2506('0x8'));var csv=require('to-csv');var ejs=require(_0x2506('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2506('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2506('0xb'));var Papa=require(_0x2506('0xc'));var Redis=require(_0x2506('0xd'));var authService=require(_0x2506('0xe'));var qs=require(_0x2506('0xf'));var as=require(_0x2506('0x10'));var hardwareService=require(_0x2506('0x11'));var logger=require(_0x2506('0x12'))(_0x2506('0x13'));var utils=require(_0x2506('0x14'));var config=require(_0x2506('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2506('0x16'))['db'];config[_0x2506('0x17')]=_[_0x2506('0x18')](config[_0x2506('0x17')],{'host':_0x2506('0x19'),'port':0x18eb});var socket=require(_0x2506('0x1a'))(new Redis(config[_0x2506('0x17')]));require(_0x2506('0x1b'))[_0x2506('0x1c')](socket);function respondWithStatusCode(_0x4c67a0,_0x2aa2c5){_0x2aa2c5=_0x2aa2c5||0xcc;return function(_0x2d5af7){if(_0x2d5af7){return _0x4c67a0['sendStatus'](_0x2aa2c5);}return _0x4c67a0['status'](_0x2aa2c5)['end']();};}function respondWithResult(_0x2a1b5a,_0x5ea18d){_0x5ea18d=_0x5ea18d||0xc8;return function(_0x5e0d75){if(_0x5e0d75){return _0x2a1b5a[_0x2506('0x1d')](_0x5ea18d)[_0x2506('0x1e')](_0x5e0d75);}};}function respondWithFilteredResult(_0x5195f9,_0x2c7039){return function(_0x329967){if(_0x329967){var _0x322dc5=_0x329967[_0x2506('0x1f')],_0x112c19=_0x2c7039[_0x2506('0x20')],_0x4bcff1=_0x2c7039['offset']+_0x2c7039[_0x2506('0x21')],_0x200ab9;if(_0x4bcff1>=_0x322dc5){_0x4bcff1=_0x322dc5;_0x200ab9=0xc8;}else{_0x200ab9=0xce;}_0x5195f9[_0x2506('0x1d')](_0x200ab9);return _0x5195f9[_0x2506('0x22')](_0x2506('0x23'),_0x112c19+'-'+_0x4bcff1+'/'+_0x322dc5)['json'](_0x329967);}return null;};}function patchUpdates(_0x20b180){return function(_0x107d7d){try{jsonpatch[_0x2506('0x24')](_0x107d7d,_0x20b180,!![]);}catch(_0x5c15be){return BPromise[_0x2506('0x25')](_0x5c15be);}return _0x107d7d['save']();};}function saveUpdates(_0x5bc686,_0x40de13){return function(_0x17819f){if(_0x17819f){return _0x17819f['update'](_0x5bc686)['then'](function(_0x12df2a){return _0x12df2a;});}return null;};}function removeEntity(_0x2bb563,_0x17a968){return function(_0xfb4f83){if(_0xfb4f83){return _0xfb4f83['destroy']()[_0x2506('0x26')](function(){var _0xc76acf=_0xfb4f83[_0x2506('0x27')]({'plain':!![]});var _0x468da1=_0x2506('0x28');return db[_0x2506('0x29')]['destroy']({'where':{'type':_0x468da1,'resourceId':_0xc76acf['id']}})[_0x2506('0x26')](function(){return _0xfb4f83;});})[_0x2506('0x26')](function(){_0x2bb563['status'](0xcc)[_0x2506('0x2a')]();});}};}function handleEntityNotFound(_0x119c50,_0x4b2c95){return function(_0x2ccb4b){if(!_0x2ccb4b){_0x119c50[_0x2506('0x2b')](0x194);}return _0x2ccb4b;};}function handleError(_0x375536,_0x54c724){_0x54c724=_0x54c724||0x1f4;return function(_0x4fb74b){logger['error'](_0x4fb74b['stack']);if(_0x4fb74b['name']){delete _0x4fb74b[_0x2506('0x2c')];}_0x375536['status'](_0x54c724)[_0x2506('0x2d')](_0x4fb74b);};}exports[_0x2506('0x2e')]=function(_0x45c9eb,_0x562e24){var _0x119a75={},_0x5801eb={},_0x45ed83={'count':0x0,'rows':[]};var _0x2a51a2=_[_0x2506('0x2f')](db[_0x2506('0x30')]['rawAttributes'],function(_0x47263a){return{'name':_0x47263a[_0x2506('0x31')],'type':_0x47263a[_0x2506('0x32')][_0x2506('0x33')]};});_0x5801eb[_0x2506('0x34')]=_[_0x2506('0x2f')](_0x2a51a2,'name');_0x5801eb['query']=_[_0x2506('0x35')](_0x45c9eb['query']);_0x5801eb[_0x2506('0x36')]=_[_0x2506('0x37')](_0x5801eb['model'],_0x5801eb[_0x2506('0x38')]);_0x119a75[_0x2506('0x39')]=_['intersection'](_0x5801eb[_0x2506('0x34')],qs[_0x2506('0x3a')](_0x45c9eb['query'][_0x2506('0x3a')]));_0x119a75[_0x2506('0x39')]=_0x119a75[_0x2506('0x39')][_0x2506('0x3b')]?_0x119a75[_0x2506('0x39')]:_0x5801eb[_0x2506('0x34')];if(!_0x45c9eb[_0x2506('0x38')][_0x2506('0x3c')]('nolimit')){_0x119a75[_0x2506('0x21')]=qs[_0x2506('0x21')](_0x45c9eb[_0x2506('0x38')][_0x2506('0x21')]);_0x119a75[_0x2506('0x20')]=qs[_0x2506('0x20')](_0x45c9eb['query'][_0x2506('0x20')]);}_0x119a75['order']=qs[_0x2506('0x3d')](_0x45c9eb[_0x2506('0x38')][_0x2506('0x3d')]);_0x119a75[_0x2506('0x3e')]=qs['filters'](_[_0x2506('0x3f')](_0x45c9eb['query'],_0x5801eb[_0x2506('0x36')]),_0x2a51a2);if(_0x45c9eb[_0x2506('0x38')][_0x2506('0x40')]){_0x119a75[_0x2506('0x3e')]=_[_0x2506('0x41')](_0x119a75[_0x2506('0x3e')],{'$or':_['map'](_0x2a51a2,function(_0x230f5b){if(_0x230f5b['type']!=='VIRTUAL'){var _0x939736={};_0x939736[_0x230f5b[_0x2506('0x2c')]]={'$like':'%'+_0x45c9eb['query']['filter']+'%'};return _0x939736;}})});}_0x119a75=_['merge']({},_0x119a75,_0x45c9eb[_0x2506('0x42')]);var _0x37bf67={'where':_0x119a75['where']};return db[_0x2506('0x30')][_0x2506('0x1f')](_0x37bf67)[_0x2506('0x26')](function(_0x328101){_0x45ed83[_0x2506('0x1f')]=_0x328101;if(_0x45c9eb['query']['includeAll']){_0x119a75[_0x2506('0x43')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x119a75);})[_0x2506('0x26')](function(_0xb29c1e){_0x45ed83[_0x2506('0x44')]=_0xb29c1e;return _0x45ed83;})[_0x2506('0x26')](respondWithFilteredResult(_0x562e24,_0x119a75))[_0x2506('0x45')](handleError(_0x562e24,null));};exports[_0x2506('0x46')]=function(_0x5e0e53,_0x1cb02f){var _0x4e05fa={'raw':![],'where':{'id':_0x5e0e53[_0x2506('0x47')]['id']}},_0x4fcb09={};_0x4fcb09[_0x2506('0x34')]=_['keys'](db[_0x2506('0x30')][_0x2506('0x48')]);_0x4fcb09[_0x2506('0x38')]=_[_0x2506('0x35')](_0x5e0e53['query']);_0x4fcb09[_0x2506('0x36')]=_['intersection'](_0x4fcb09[_0x2506('0x34')],_0x4fcb09[_0x2506('0x38')]);_0x4e05fa['attributes']=_['intersection'](_0x4fcb09[_0x2506('0x34')],qs[_0x2506('0x3a')](_0x5e0e53[_0x2506('0x38')]['fields']));_0x4e05fa['attributes']=_0x4e05fa[_0x2506('0x39')]['length']?_0x4e05fa[_0x2506('0x39')]:_0x4fcb09[_0x2506('0x34')];if(_0x5e0e53[_0x2506('0x38')][_0x2506('0x49')]){_0x4e05fa[_0x2506('0x43')]=[{'all':!![]}];}_0x4e05fa=_[_0x2506('0x41')]({},_0x4e05fa,_0x5e0e53[_0x2506('0x42')]);return db[_0x2506('0x30')][_0x2506('0x4a')](_0x4e05fa)[_0x2506('0x26')](handleEntityNotFound(_0x1cb02f,null))[_0x2506('0x26')](respondWithResult(_0x1cb02f,null))['catch'](handleError(_0x1cb02f,null));};exports[_0x2506('0x4b')]=function(_0x58070d,_0x11a207){return db[_0x2506('0x30')]['create'](_0x58070d[_0x2506('0x4c')],{})[_0x2506('0x26')](function(_0x4848cd){var _0xc6b710=_0x58070d[_0x2506('0x4d')][_0x2506('0x27')]({'plain':!![]});if(!_0xc6b710)throw new Error(_0x2506('0x4e'));if(_0xc6b710['role']===_0x2506('0x4d')){var _0x30909d=_0x4848cd[_0x2506('0x27')]({'plain':!![]});var _0x44eef0=_0x2506('0x28');return db[_0x2506('0x4f')][_0x2506('0x4a')]({'where':{'name':_0x44eef0,'userProfileId':_0xc6b710[_0x2506('0x50')]},'raw':!![]})[_0x2506('0x26')](function(_0x50b897){if(_0x50b897&&_0x50b897[_0x2506('0x51')]===0x0){return db[_0x2506('0x29')][_0x2506('0x4b')]({'name':_0x30909d[_0x2506('0x2c')],'resourceId':_0x30909d['id'],'type':_0x50b897[_0x2506('0x2c')],'sectionId':_0x50b897['id']},{})[_0x2506('0x26')](function(){return _0x4848cd;});}else{return _0x4848cd;}})[_0x2506('0x45')](function(_0x45106b){logger[_0x2506('0x52')](_0x2506('0x53'),_0x45106b);throw _0x45106b;});}return _0x4848cd;})['then'](respondWithResult(_0x11a207,0xc9))[_0x2506('0x45')](handleError(_0x11a207,null));};exports[_0x2506('0x54')]=function(_0x436809,_0x455681){var _0x53965b={'where':{'id':_0x436809[_0x2506('0x47')]['id']}},_0x39b013={};_0x39b013[_0x2506('0x34')]=_[_0x2506('0x35')](db[_0x2506('0x30')][_0x2506('0x48')]);_0x53965b[_0x2506('0x39')]=_[_0x2506('0x37')](_0x39b013[_0x2506('0x34')],qs[_0x2506('0x3a')](_0x436809[_0x2506('0x38')][_0x2506('0x3a')]));_0x53965b[_0x2506('0x39')]=_0x53965b['attributes'][_0x2506('0x3b')]?_0x53965b['attributes']:_0x39b013[_0x2506('0x34')];if(_0x436809[_0x2506('0x38')][_0x2506('0x49')]){_0x53965b[_0x2506('0x43')]=[{'all':!![]}];}_0x53965b=_['merge']({},_0x53965b,_0x436809[_0x2506('0x42')]);return db[_0x2506('0x30')]['find'](_0x53965b)[_0x2506('0x26')](handleEntityNotFound(_0x455681,null))[_0x2506('0x26')](function(_0xaf61bf){if(_0xaf61bf){var _0x31b84c=_0xaf61bf[_0x2506('0x27')]({'plain':!![]});_0x31b84c=qs[_0x2506('0x55')](_0x31b84c,['id',_0x2506('0x56'),_0x2506('0x57')]);_0x436809[_0x2506('0x4c')]=_[_0x2506('0x55')](_0x436809['body'],['id',_0x2506('0x56'),_0x2506('0x57')]);return db[_0x2506('0x30')]['create'](_['merge'](_0x31b84c,_0x436809['body']),{'include':_0x436809['query'][_0x2506('0x49')]?[{'all':!![]}]:undefined})[_0x2506('0x26')](function(_0x3ffe93){var _0x7d5b56=_0x436809[_0x2506('0x4d')][_0x2506('0x27')]({'plain':!![]});if(!_0x7d5b56)throw new Error(_0x2506('0x4e'));if(_0x7d5b56[_0x2506('0x58')]==='user'){var _0x3591f6=_0x3ffe93[_0x2506('0x27')]({'plain':!![]});var _0x24b16e='CustomDashboards';return db[_0x2506('0x4f')][_0x2506('0x4a')]({'where':{'name':_0x24b16e,'userProfileId':_0x7d5b56[_0x2506('0x50')]},'raw':!![]})['then'](function(_0x113388){if(_0x113388&&_0x113388['autoAssociation']===0x0){return db[_0x2506('0x29')][_0x2506('0x4b')]({'name':_0x3591f6['name'],'resourceId':_0x3591f6['id'],'type':_0x113388[_0x2506('0x2c')],'sectionId':_0x113388['id']},{})[_0x2506('0x26')](function(){return _0x3ffe93;});}else{return _0x3ffe93;}})[_0x2506('0x45')](function(_0x775639){logger[_0x2506('0x52')](_0x2506('0x53'),_0x775639);throw _0x775639;});}return _0x3ffe93;});}})[_0x2506('0x26')](respondWithResult(_0x455681,0xc9))[_0x2506('0x45')](handleError(_0x455681,null));};exports[_0x2506('0x59')]=function(_0x206d84,_0x41508e){if(_0x206d84[_0x2506('0x4c')]['id']){delete _0x206d84['body']['id'];}return db[_0x2506('0x30')][_0x2506('0x4a')]({'where':{'id':_0x206d84[_0x2506('0x47')]['id']}})[_0x2506('0x26')](handleEntityNotFound(_0x41508e,null))[_0x2506('0x26')](saveUpdates(_0x206d84['body'],null))[_0x2506('0x26')](respondWithResult(_0x41508e,null))[_0x2506('0x45')](handleError(_0x41508e,null));};exports['destroy']=function(_0x510668,_0x225ca9){return db[_0x2506('0x30')][_0x2506('0x4a')]({'where':{'id':_0x510668['params']['id']}})['then'](handleEntityNotFound(_0x225ca9,null))['then'](removeEntity(_0x225ca9,null))['catch'](handleError(_0x225ca9,null));};function widgetAttributes(_0x346e1c){try{switch(_0x346e1c[_0x2506('0x32')]){case'iframe':return[{'name':'attrUrl','value':_0x346e1c[_0x2506('0x5a')]||(_0x346e1c['attrs']&&_0x346e1c[_0x2506('0x5b')][0x0]?_0x346e1c[_0x2506('0x5b')][0x0][_0x2506('0x5c')]:undefined)||_0x2506('0x5d')}];case'custom':return[{'name':'attrPath','value':_0x346e1c[_0x2506('0x5e')]||(_0x346e1c['attrs']&&_0x346e1c['attrs'][0x0]?_0x346e1c['attrs'][0x0][_0x2506('0x5c')]:undefined)||''}];case _0x2506('0x5f'):return[{'name':_0x2506('0x60'),'value':_0x346e1c['attrHourFormat']||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c['attrs'][0x0]?_0x346e1c['attrs'][0x0][_0x2506('0x5c')]:undefined)||_0x2506('0x61')},{'name':_0x2506('0x62'),'value':_0x346e1c['attrTimezone']||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c[_0x2506('0x5b')][0x1]?_0x346e1c[_0x2506('0x5b')][0x1][_0x2506('0x5c')]:undefined)||_0x2506('0x63')},{'name':_0x2506('0x64'),'value':_0x346e1c['attrFontSize']||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c['attrs'][0x2]?_0x346e1c[_0x2506('0x5b')][0x2][_0x2506('0x5c')]:undefined)||0xc}];case _0x2506('0x65'):return[{'name':_0x2506('0x66'),'value':_0x346e1c[_0x2506('0x66')]||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c[_0x2506('0x5b')][0x0]?_0x346e1c[_0x2506('0x5b')][0x0][_0x2506('0x5c')]:undefined)||_0x2506('0x67')},{'name':_0x2506('0x68'),'value':_0x346e1c[_0x2506('0x68')]||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c[_0x2506('0x5b')][0x1]?_0x346e1c[_0x2506('0x5b')][0x1]['value']:undefined)||[]},{'name':_0x2506('0x64'),'value':_0x346e1c[_0x2506('0x64')]||(_0x346e1c['attrs']&&_0x346e1c['attrs'][0x2]?_0x346e1c[_0x2506('0x5b')][0x2][_0x2506('0x5c')]:undefined)||0x14}];case'multibar-chart':case _0x2506('0x69'):return[{'name':'attrSerie1','value':_0x346e1c['attrSerie1']||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c[_0x2506('0x5b')][0x0]?_0x346e1c[_0x2506('0x5b')][0x0][_0x2506('0x5c')]:undefined)||_0x2506('0x67')},{'name':_0x2506('0x6a'),'value':_0x346e1c[_0x2506('0x6a')]||(_0x346e1c['attrs']&&_0x346e1c[_0x2506('0x5b')][0x1]?_0x346e1c['attrs'][0x1][_0x2506('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x346e1c[_0x2506('0x6b')]||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c[_0x2506('0x5b')][0x2]?_0x346e1c[_0x2506('0x5b')][0x2][_0x2506('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x346e1c[_0x2506('0x68')]||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c[_0x2506('0x5b')][0x3]?_0x346e1c[_0x2506('0x5b')][0x3][_0x2506('0x5c')]:undefined)||[]}];case _0x2506('0x6c'):return[{'name':_0x2506('0x6d'),'type':_0x346e1c[_0x2506('0x6e')]||(_0x346e1c['attrs']&&_0x346e1c[_0x2506('0x5b')][0x0]?_0x346e1c[_0x2506('0x5b')][0x0][_0x2506('0x32')]:undefined)||null,'value':_0x346e1c[_0x2506('0x6d')]||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c['attrs'][0x0]?_0x346e1c[_0x2506('0x5b')][0x0][_0x2506('0x5c')]:undefined)||null},{'name':_0x2506('0x6f'),'value':_0x346e1c[_0x2506('0x6f')]||(_0x346e1c[_0x2506('0x5b')]&&_0x346e1c[_0x2506('0x5b')][0x1]?_0x346e1c[_0x2506('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x13b919){logger[_0x2506('0x52')](_0x2506('0x70'),JSON['stringify'](_0x13b919));return[];}}exports['addItem']=function(_0x558a37,_0x377d68,_0x31296d){if(_0x558a37[_0x2506('0x4c')]['id']){delete _0x558a37[_0x2506('0x4c')]['id'];}return db[_0x2506('0x30')][_0x2506('0x4a')]({'where':{'id':_0x558a37[_0x2506('0x47')]['id']}})[_0x2506('0x26')](handleEntityNotFound(_0x377d68,null))[_0x2506('0x26')](function(_0x52d4e4){if(_0x52d4e4){_0x558a37[_0x2506('0x4c')]['DashboardId']=_0x52d4e4['id'];_0x558a37[_0x2506('0x4c')]['attrs']=widgetAttributes(_0x558a37[_0x2506('0x4c')]);return db[_0x2506('0x71')]['create'](_0x558a37['body']);}})['then'](respondWithResult(_0x377d68,null))[_0x2506('0x45')](handleError(_0x377d68,null));};exports[_0x2506('0x72')]=function(_0x3d39bd,_0x326f0d,_0x36f043){var _0x2378d8={};var _0x270124={};var _0x27b459;var _0x494f8f;return db[_0x2506('0x30')]['findOne']({'where':{'id':_0x3d39bd[_0x2506('0x47')]['id']}})[_0x2506('0x26')](handleEntityNotFound(_0x326f0d,null))['then'](function(_0x2a53bb){if(_0x2a53bb){_0x27b459=_0x2a53bb;_0x270124[_0x2506('0x34')]=_[_0x2506('0x35')](db['DashboardItem']['rawAttributes']);_0x270124['query']=_[_0x2506('0x35')](_0x3d39bd[_0x2506('0x38')]);_0x270124[_0x2506('0x36')]=_[_0x2506('0x37')](_0x270124[_0x2506('0x34')],_0x270124['query']);_0x2378d8[_0x2506('0x39')]=_[_0x2506('0x37')](_0x270124[_0x2506('0x34')],qs[_0x2506('0x3a')](_0x3d39bd[_0x2506('0x38')][_0x2506('0x3a')]));_0x2378d8[_0x2506('0x39')]=_0x2378d8[_0x2506('0x39')][_0x2506('0x3b')]?_0x2378d8[_0x2506('0x39')]:_0x270124[_0x2506('0x34')];_0x2378d8['order']=qs[_0x2506('0x3d')](_0x3d39bd[_0x2506('0x38')]['sort']);_0x2378d8['where']=qs[_0x2506('0x36')](_['pick'](_0x3d39bd[_0x2506('0x38')],_0x270124[_0x2506('0x36')]));if(_0x3d39bd[_0x2506('0x38')]['filter']){_0x2378d8['where']=_['merge'](_0x2378d8['where'],{'$or':_[_0x2506('0x2f')](_0x2378d8[_0x2506('0x39')],function(_0x32cbc6){var _0x2ee59b={};_0x2ee59b[_0x32cbc6]={'$like':'%'+_0x3d39bd[_0x2506('0x38')][_0x2506('0x40')]+'%'};return _0x2ee59b;})});}_0x2378d8=_[_0x2506('0x41')]({},_0x2378d8,_0x3d39bd['options']);return _0x27b459[_0x2506('0x72')](_0x2378d8);}})[_0x2506('0x26')](function(_0x3f7ec1){if(_0x3f7ec1){_0x494f8f=_0x3f7ec1[_0x2506('0x3b')];if(!_0x3d39bd['query'][_0x2506('0x3c')](_0x2506('0x73'))){_0x2378d8['limit']=qs[_0x2506('0x21')](_0x3d39bd[_0x2506('0x38')][_0x2506('0x21')]);_0x2378d8['offset']=qs[_0x2506('0x20')](_0x3d39bd[_0x2506('0x38')][_0x2506('0x20')]);}return _0x27b459[_0x2506('0x72')](_0x2378d8);}})[_0x2506('0x26')](function(_0xa50b52){if(_0xa50b52){return _0xa50b52?{'count':_0x494f8f,'rows':_0xa50b52}:null;}})[_0x2506('0x26')](respondWithResult(_0x326f0d,null))[_0x2506('0x45')](handleError(_0x326f0d,null));}; \ No newline at end of file +var _0xdc8a=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','autoAssociation','update','type','iframe','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','nolimit','getItems','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x47bba9,_0x592e4e){var _0x31cc0a=function(_0x3cbc8c){while(--_0x3cbc8c){_0x47bba9['push'](_0x47bba9['shift']());}};_0x31cc0a(++_0x592e4e);}(_0xdc8a,0xf6));var _0xadc8=function(_0x56769e,_0x1528ac){_0x56769e=_0x56769e-0x0;var _0x5cb354=_0xdc8a[_0x56769e];return _0x5cb354;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xadc8('0x0'));var rimraf=require(_0xadc8('0x1'));var zipdir=require(_0xadc8('0x2'));var jsonpatch=require(_0xadc8('0x3'));var rp=require(_0xadc8('0x4'));var moment=require(_0xadc8('0x5'));var BPromise=require(_0xadc8('0x6'));var Mustache=require(_0xadc8('0x7'));var util=require(_0xadc8('0x8'));var path=require(_0xadc8('0x9'));var sox=require(_0xadc8('0xa'));var csv=require(_0xadc8('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xadc8('0xc'));var squel=require(_0xadc8('0xd'));var crypto=require(_0xadc8('0xe'));var jsforce=require(_0xadc8('0xf'));var deskjs=require(_0xadc8('0x10'));var toCsv=require(_0xadc8('0xb'));var querystring=require(_0xadc8('0x11'));var Papa=require('papaparse');var Redis=require(_0xadc8('0x12'));var authService=require(_0xadc8('0x13'));var qs=require(_0xadc8('0x14'));var as=require(_0xadc8('0x15'));var hardwareService=require(_0xadc8('0x16'));var logger=require(_0xadc8('0x17'))(_0xadc8('0x18'));var utils=require('../../config/utils');var config=require(_0xadc8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xadc8('0x1a'))['db'];config[_0xadc8('0x1b')]=_[_0xadc8('0x1c')](config[_0xadc8('0x1b')],{'host':_0xadc8('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xadc8('0x1e'))[_0xadc8('0x1f')](socket);function respondWithStatusCode(_0x238226,_0x148dec){_0x148dec=_0x148dec||0xcc;return function(_0x58b0c4){if(_0x58b0c4){return _0x238226['sendStatus'](_0x148dec);}return _0x238226[_0xadc8('0x20')](_0x148dec)[_0xadc8('0x21')]();};}function respondWithResult(_0x4ace5a,_0x225b73){_0x225b73=_0x225b73||0xc8;return function(_0x1bc391){if(_0x1bc391){return _0x4ace5a[_0xadc8('0x20')](_0x225b73)[_0xadc8('0x22')](_0x1bc391);}};}function respondWithFilteredResult(_0x2a41b5,_0x819b9a){return function(_0x5e5d25){if(_0x5e5d25){var _0x3b703d=_0x5e5d25[_0xadc8('0x23')],_0x12a84d=_0x819b9a[_0xadc8('0x24')],_0x11c1fb=_0x819b9a[_0xadc8('0x24')]+_0x819b9a[_0xadc8('0x25')],_0x35d10a;if(_0x11c1fb>=_0x3b703d){_0x11c1fb=_0x3b703d;_0x35d10a=0xc8;}else{_0x35d10a=0xce;}_0x2a41b5[_0xadc8('0x20')](_0x35d10a);return _0x2a41b5[_0xadc8('0x26')](_0xadc8('0x27'),_0x12a84d+'-'+_0x11c1fb+'/'+_0x3b703d)[_0xadc8('0x22')](_0x5e5d25);}return null;};}function patchUpdates(_0x40fa61){return function(_0x509b74){try{jsonpatch['apply'](_0x509b74,_0x40fa61,!![]);}catch(_0x53e08a){return BPromise[_0xadc8('0x28')](_0x53e08a);}return _0x509b74[_0xadc8('0x29')]();};}function saveUpdates(_0x37ccd9,_0x40fa18){return function(_0x38e834){if(_0x38e834){return _0x38e834['update'](_0x37ccd9)['then'](function(_0x336307){return _0x336307;});}return null;};}function removeEntity(_0x5a33d3,_0x3743e2){return function(_0x30eb14){if(_0x30eb14){return _0x30eb14[_0xadc8('0x2a')]()[_0xadc8('0x2b')](function(){var _0x172acc=_0x30eb14[_0xadc8('0x2c')]({'plain':!![]});var _0x219945='CustomDashboards';return db[_0xadc8('0x2d')][_0xadc8('0x2a')]({'where':{'type':_0x219945,'resourceId':_0x172acc['id']}})[_0xadc8('0x2b')](function(){return _0x30eb14;});})[_0xadc8('0x2b')](function(){_0x5a33d3[_0xadc8('0x20')](0xcc)[_0xadc8('0x21')]();});}};}function handleEntityNotFound(_0x18b025,_0x5e1edc){return function(_0x539ebb){if(!_0x539ebb){_0x18b025[_0xadc8('0x2e')](0x194);}return _0x539ebb;};}function handleError(_0x4a91e0,_0x575704){_0x575704=_0x575704||0x1f4;return function(_0x47d687){logger[_0xadc8('0x2f')](_0x47d687[_0xadc8('0x30')]);if(_0x47d687[_0xadc8('0x31')]){delete _0x47d687[_0xadc8('0x31')];}_0x4a91e0[_0xadc8('0x20')](_0x575704)[_0xadc8('0x32')](_0x47d687);};}exports[_0xadc8('0x33')]=function(_0x2d49da,_0x4b48ce){var _0x59b062={},_0x2962bd={},_0x3b6c16={'count':0x0,'rows':[]};var _0x4eada9=_[_0xadc8('0x34')](db[_0xadc8('0x35')][_0xadc8('0x36')],function(_0x11d85d){return{'name':_0x11d85d[_0xadc8('0x37')],'type':_0x11d85d['type'][_0xadc8('0x38')]};});_0x2962bd[_0xadc8('0x39')]=_['map'](_0x4eada9,_0xadc8('0x31'));_0x2962bd['query']=_[_0xadc8('0x3a')](_0x2d49da[_0xadc8('0x3b')]);_0x2962bd[_0xadc8('0x3c')]=_[_0xadc8('0x3d')](_0x2962bd[_0xadc8('0x39')],_0x2962bd[_0xadc8('0x3b')]);_0x59b062[_0xadc8('0x3e')]=_[_0xadc8('0x3d')](_0x2962bd[_0xadc8('0x39')],qs[_0xadc8('0x3f')](_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x3f')]));_0x59b062[_0xadc8('0x3e')]=_0x59b062[_0xadc8('0x3e')][_0xadc8('0x40')]?_0x59b062['attributes']:_0x2962bd[_0xadc8('0x39')];if(!_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x41')]('nolimit')){_0x59b062[_0xadc8('0x25')]=qs[_0xadc8('0x25')](_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x25')]);_0x59b062[_0xadc8('0x24')]=qs[_0xadc8('0x24')](_0x2d49da[_0xadc8('0x3b')]['offset']);}_0x59b062[_0xadc8('0x42')]=qs[_0xadc8('0x43')](_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x43')]);_0x59b062[_0xadc8('0x44')]=qs['filters'](_[_0xadc8('0x45')](_0x2d49da[_0xadc8('0x3b')],_0x2962bd[_0xadc8('0x3c')]),_0x4eada9);if(_0x2d49da['query'][_0xadc8('0x46')]){_0x59b062[_0xadc8('0x44')]=_['merge'](_0x59b062[_0xadc8('0x44')],{'$or':_[_0xadc8('0x34')](_0x4eada9,function(_0x5afa9c){if(_0x5afa9c['type']!==_0xadc8('0x47')){var _0x2a1d0e={};_0x2a1d0e[_0x5afa9c[_0xadc8('0x31')]]={'$like':'%'+_0x2d49da[_0xadc8('0x3b')][_0xadc8('0x46')]+'%'};return _0x2a1d0e;}})});}_0x59b062=_['merge']({},_0x59b062,_0x2d49da[_0xadc8('0x48')]);var _0xfbdb57={'where':_0x59b062['where']};return db[_0xadc8('0x35')]['count'](_0xfbdb57)[_0xadc8('0x2b')](function(_0x3cd9c5){_0x3b6c16['count']=_0x3cd9c5;if(_0x2d49da[_0xadc8('0x3b')]['includeAll']){_0x59b062[_0xadc8('0x49')]=[{'all':!![]}];}return db[_0xadc8('0x35')][_0xadc8('0x4a')](_0x59b062);})[_0xadc8('0x2b')](function(_0x49ce77){_0x3b6c16[_0xadc8('0x4b')]=_0x49ce77;return _0x3b6c16;})['then'](respondWithFilteredResult(_0x4b48ce,_0x59b062))[_0xadc8('0x4c')](handleError(_0x4b48ce,null));};exports['show']=function(_0x175401,_0x3a5c23){var _0x2528c7={'raw':![],'where':{'id':_0x175401[_0xadc8('0x4d')]['id']}},_0x3c22e5={};_0x3c22e5[_0xadc8('0x39')]=_[_0xadc8('0x3a')](db[_0xadc8('0x35')][_0xadc8('0x36')]);_0x3c22e5['query']=_[_0xadc8('0x3a')](_0x175401[_0xadc8('0x3b')]);_0x3c22e5[_0xadc8('0x3c')]=_[_0xadc8('0x3d')](_0x3c22e5['model'],_0x3c22e5[_0xadc8('0x3b')]);_0x2528c7[_0xadc8('0x3e')]=_['intersection'](_0x3c22e5['model'],qs[_0xadc8('0x3f')](_0x175401[_0xadc8('0x3b')][_0xadc8('0x3f')]));_0x2528c7['attributes']=_0x2528c7[_0xadc8('0x3e')]['length']?_0x2528c7[_0xadc8('0x3e')]:_0x3c22e5[_0xadc8('0x39')];if(_0x175401[_0xadc8('0x3b')][_0xadc8('0x4e')]){_0x2528c7[_0xadc8('0x49')]=[{'all':!![]}];}_0x2528c7=_[_0xadc8('0x4f')]({},_0x2528c7,_0x175401['options']);return db[_0xadc8('0x35')]['find'](_0x2528c7)[_0xadc8('0x2b')](handleEntityNotFound(_0x3a5c23,null))[_0xadc8('0x2b')](respondWithResult(_0x3a5c23,null))['catch'](handleError(_0x3a5c23,null));};exports['create']=function(_0x5e9add,_0x57722b){return db[_0xadc8('0x35')][_0xadc8('0x50')](_0x5e9add[_0xadc8('0x51')],{})[_0xadc8('0x2b')](function(_0x3549fb){var _0x27b724=_0x5e9add[_0xadc8('0x52')][_0xadc8('0x2c')]({'plain':!![]});if(!_0x27b724)throw new Error(_0xadc8('0x53'));if(_0x27b724[_0xadc8('0x54')]===_0xadc8('0x52')){var _0x4d87cc=_0x3549fb['get']({'plain':!![]});var _0x101103=_0xadc8('0x55');return db[_0xadc8('0x56')]['find']({'where':{'name':_0x101103,'userProfileId':_0x27b724[_0xadc8('0x57')]},'raw':!![]})['then'](function(_0x2d1617){if(_0x2d1617&&_0x2d1617['autoAssociation']===0x0){return db[_0xadc8('0x2d')]['create']({'name':_0x4d87cc[_0xadc8('0x31')],'resourceId':_0x4d87cc['id'],'type':_0x2d1617['name'],'sectionId':_0x2d1617['id']},{})['then'](function(){return _0x3549fb;});}else{return _0x3549fb;}})[_0xadc8('0x4c')](function(_0x2ade76){logger[_0xadc8('0x2f')](_0xadc8('0x58'),_0x2ade76);throw _0x2ade76;});}return _0x3549fb;})[_0xadc8('0x2b')](respondWithResult(_0x57722b,0xc9))[_0xadc8('0x4c')](handleError(_0x57722b,null));};exports[_0xadc8('0x59')]=function(_0x34ff14,_0x5ee910){var _0x40ec53={'where':{'id':_0x34ff14[_0xadc8('0x4d')]['id']}},_0x3b8739={};_0x3b8739['model']=_[_0xadc8('0x3a')](db[_0xadc8('0x35')][_0xadc8('0x36')]);_0x40ec53['attributes']=_[_0xadc8('0x3d')](_0x3b8739[_0xadc8('0x39')],qs[_0xadc8('0x3f')](_0x34ff14[_0xadc8('0x3b')]['fields']));_0x40ec53[_0xadc8('0x3e')]=_0x40ec53['attributes'][_0xadc8('0x40')]?_0x40ec53[_0xadc8('0x3e')]:_0x3b8739[_0xadc8('0x39')];if(_0x34ff14[_0xadc8('0x3b')][_0xadc8('0x4e')]){_0x40ec53['include']=[{'all':!![]}];}_0x40ec53=_[_0xadc8('0x4f')]({},_0x40ec53,_0x34ff14[_0xadc8('0x48')]);return db[_0xadc8('0x35')][_0xadc8('0x5a')](_0x40ec53)['then'](handleEntityNotFound(_0x5ee910,null))[_0xadc8('0x2b')](function(_0x4df7e6){if(_0x4df7e6){var _0x73cb3f=_0x4df7e6['get']({'plain':!![]});_0x73cb3f=qs[_0xadc8('0x5b')](_0x73cb3f,['id',_0xadc8('0x5c'),_0xadc8('0x5d')]);_0x34ff14['body']=_[_0xadc8('0x5b')](_0x34ff14[_0xadc8('0x51')],['id',_0xadc8('0x5c'),_0xadc8('0x5d')]);return db[_0xadc8('0x35')]['create'](_[_0xadc8('0x4f')](_0x73cb3f,_0x34ff14[_0xadc8('0x51')]),{'include':_0x34ff14['query'][_0xadc8('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x2e3c09){var _0x180a87=_0x34ff14['user'][_0xadc8('0x2c')]({'plain':!![]});if(!_0x180a87)throw new Error(_0xadc8('0x53'));if(_0x180a87[_0xadc8('0x54')]===_0xadc8('0x52')){var _0x56e93e=_0x2e3c09[_0xadc8('0x2c')]({'plain':!![]});var _0x1180fc='CustomDashboards';return db[_0xadc8('0x56')]['find']({'where':{'name':_0x1180fc,'userProfileId':_0x180a87[_0xadc8('0x57')]},'raw':!![]})[_0xadc8('0x2b')](function(_0x3985cf){if(_0x3985cf&&_0x3985cf[_0xadc8('0x5e')]===0x0){return db[_0xadc8('0x2d')][_0xadc8('0x50')]({'name':_0x56e93e[_0xadc8('0x31')],'resourceId':_0x56e93e['id'],'type':_0x3985cf[_0xadc8('0x31')],'sectionId':_0x3985cf['id']},{})[_0xadc8('0x2b')](function(){return _0x2e3c09;});}else{return _0x2e3c09;}})['catch'](function(_0x256ac6){logger[_0xadc8('0x2f')](_0xadc8('0x58'),_0x256ac6);throw _0x256ac6;});}return _0x2e3c09;});}})[_0xadc8('0x2b')](respondWithResult(_0x5ee910,0xc9))[_0xadc8('0x4c')](handleError(_0x5ee910,null));};exports[_0xadc8('0x5f')]=function(_0x389e20,_0x53eb3a){if(_0x389e20[_0xadc8('0x51')]['id']){delete _0x389e20[_0xadc8('0x51')]['id'];}return db['Dashboard'][_0xadc8('0x5a')]({'where':{'id':_0x389e20[_0xadc8('0x4d')]['id']}})[_0xadc8('0x2b')](handleEntityNotFound(_0x53eb3a,null))['then'](saveUpdates(_0x389e20['body'],null))[_0xadc8('0x2b')](respondWithResult(_0x53eb3a,null))[_0xadc8('0x4c')](handleError(_0x53eb3a,null));};exports[_0xadc8('0x2a')]=function(_0x100162,_0x1f74a8){return db['Dashboard'][_0xadc8('0x5a')]({'where':{'id':_0x100162['params']['id']}})['then'](handleEntityNotFound(_0x1f74a8,null))['then'](removeEntity(_0x1f74a8,null))[_0xadc8('0x4c')](handleError(_0x1f74a8,null));};function widgetAttributes(_0x39800d){try{switch(_0x39800d[_0xadc8('0x60')]){case _0xadc8('0x61'):return[{'name':'attrUrl','value':_0x39800d['attrUrl']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||'https://'}];case _0xadc8('0x64'):return[{'name':'attrPath','value':_0x39800d[_0xadc8('0x65')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||''}];case _0xadc8('0x66'):return[{'name':_0xadc8('0x67'),'value':_0x39800d['attrHourFormat']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x39800d[_0xadc8('0x68')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x1]?_0x39800d[_0xadc8('0x62')][0x1][_0xadc8('0x63')]:undefined)||'0.00'},{'name':_0xadc8('0x69'),'value':_0x39800d['attrFontSize']||(_0x39800d['attrs']&&_0x39800d[_0xadc8('0x62')][0x2]?_0x39800d['attrs'][0x2][_0xadc8('0x63')]:undefined)||0xc}];case _0xadc8('0x6a'):return[{'name':_0xadc8('0x6b'),'value':_0x39800d['attrMetric']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||_0xadc8('0x6c')},{'name':'attrVoiceQueues','value':_0x39800d['attrVoiceQueues']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d['attrs'][0x1]?_0x39800d[_0xadc8('0x62')][0x1][_0xadc8('0x63')]:undefined)||[]},{'name':_0xadc8('0x69'),'value':_0x39800d[_0xadc8('0x69')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d['attrs'][0x2]?_0x39800d[_0xadc8('0x62')][0x2][_0xadc8('0x63')]:undefined)||0x14}];case _0xadc8('0x6d'):case _0xadc8('0x6e'):return[{'name':_0xadc8('0x6f'),'value':_0x39800d[_0xadc8('0x6f')]||(_0x39800d['attrs']&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d['attrs'][0x0][_0xadc8('0x63')]:undefined)||'total'},{'name':_0xadc8('0x70'),'value':_0x39800d[_0xadc8('0x70')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x1]?_0x39800d['attrs'][0x1][_0xadc8('0x63')]:undefined)||null},{'name':_0xadc8('0x71'),'value':_0x39800d[_0xadc8('0x71')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x2]?_0x39800d[_0xadc8('0x62')][0x2][_0xadc8('0x63')]:undefined)||null},{'name':_0xadc8('0x72'),'value':_0x39800d[_0xadc8('0x72')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x3]?_0x39800d[_0xadc8('0x62')][0x3][_0xadc8('0x63')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x39800d['reportType']||(_0x39800d[_0xadc8('0x62')]&&_0x39800d['attrs'][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x60')]:undefined)||null,'value':_0x39800d[_0xadc8('0x73')]||(_0x39800d[_0xadc8('0x62')]&&_0x39800d[_0xadc8('0x62')][0x0]?_0x39800d[_0xadc8('0x62')][0x0][_0xadc8('0x63')]:undefined)||null},{'name':_0xadc8('0x74'),'value':_0x39800d[_0xadc8('0x74')]||(_0x39800d['attrs']&&_0x39800d[_0xadc8('0x62')][0x1]?_0x39800d[_0xadc8('0x62')][0x1][_0xadc8('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x4ad009){logger[_0xadc8('0x2f')](_0xadc8('0x75'),JSON[_0xadc8('0x76')](_0x4ad009));return[];}}exports[_0xadc8('0x77')]=function(_0xfa73ed,_0xa0859e,_0x367f0c){if(_0xfa73ed[_0xadc8('0x51')]['id']){delete _0xfa73ed[_0xadc8('0x51')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xfa73ed[_0xadc8('0x4d')]['id']}})[_0xadc8('0x2b')](handleEntityNotFound(_0xa0859e,null))[_0xadc8('0x2b')](function(_0x58f440){if(_0x58f440){_0xfa73ed[_0xadc8('0x51')][_0xadc8('0x78')]=_0x58f440['id'];_0xfa73ed['body'][_0xadc8('0x62')]=widgetAttributes(_0xfa73ed[_0xadc8('0x51')]);return db[_0xadc8('0x79')][_0xadc8('0x50')](_0xfa73ed['body']);}})[_0xadc8('0x2b')](respondWithResult(_0xa0859e,null))[_0xadc8('0x4c')](handleError(_0xa0859e,null));};exports['getItems']=function(_0x462d6a,_0x480ac2,_0x25b89c){var _0x324a38={};var _0xcc1121={};var _0x19e0f8;var _0x4a1cf5;return db['Dashboard'][_0xadc8('0x7a')]({'where':{'id':_0x462d6a[_0xadc8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x480ac2,null))[_0xadc8('0x2b')](function(_0x206f5f){if(_0x206f5f){_0x19e0f8=_0x206f5f;_0xcc1121[_0xadc8('0x39')]=_['keys'](db[_0xadc8('0x79')][_0xadc8('0x36')]);_0xcc1121[_0xadc8('0x3b')]=_['keys'](_0x462d6a[_0xadc8('0x3b')]);_0xcc1121[_0xadc8('0x3c')]=_[_0xadc8('0x3d')](_0xcc1121[_0xadc8('0x39')],_0xcc1121['query']);_0x324a38[_0xadc8('0x3e')]=_['intersection'](_0xcc1121[_0xadc8('0x39')],qs[_0xadc8('0x3f')](_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x3f')]));_0x324a38[_0xadc8('0x3e')]=_0x324a38[_0xadc8('0x3e')][_0xadc8('0x40')]?_0x324a38[_0xadc8('0x3e')]:_0xcc1121[_0xadc8('0x39')];_0x324a38[_0xadc8('0x42')]=qs[_0xadc8('0x43')](_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x43')]);_0x324a38[_0xadc8('0x44')]=qs['filters'](_[_0xadc8('0x45')](_0x462d6a[_0xadc8('0x3b')],_0xcc1121[_0xadc8('0x3c')]));if(_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x46')]){_0x324a38[_0xadc8('0x44')]=_[_0xadc8('0x4f')](_0x324a38['where'],{'$or':_[_0xadc8('0x34')](_0x324a38[_0xadc8('0x3e')],function(_0x19b878){var _0x418e2b={};_0x418e2b[_0x19b878]={'$like':'%'+_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x46')]+'%'};return _0x418e2b;})});}_0x324a38=_[_0xadc8('0x4f')]({},_0x324a38,_0x462d6a[_0xadc8('0x48')]);return _0x19e0f8['getItems'](_0x324a38);}})[_0xadc8('0x2b')](function(_0x108d0b){if(_0x108d0b){_0x4a1cf5=_0x108d0b[_0xadc8('0x40')];if(!_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x41')](_0xadc8('0x7b'))){_0x324a38[_0xadc8('0x25')]=qs[_0xadc8('0x25')](_0x462d6a['query'][_0xadc8('0x25')]);_0x324a38[_0xadc8('0x24')]=qs['offset'](_0x462d6a[_0xadc8('0x3b')][_0xadc8('0x24')]);}return _0x19e0f8[_0xadc8('0x7c')](_0x324a38);}})[_0xadc8('0x2b')](function(_0x28a0f9){if(_0x28a0f9){return _0x28a0f9?{'count':_0x4a1cf5,'rows':_0x28a0f9}:null;}})[_0xadc8('0x2b')](respondWithResult(_0x480ac2,null))[_0xadc8('0x4c')](handleError(_0x480ac2,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c12d395..bfcc830 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 _0xdf3e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard'];(function(_0x5d6270,_0x83b57a){var _0x168f26=function(_0x258a27){while(--_0x258a27){_0x5d6270['push'](_0x5d6270['shift']());}};_0x168f26(++_0x83b57a);}(_0xdf3e,0xc6));var _0xedf3=function(_0x3cbbe7,_0x14df5e){_0x3cbbe7=_0x3cbbe7-0x0;var _0x11503d=_0xdf3e[_0x3cbbe7];return _0x11503d;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xedf3('0x0'))['db'][_0xedf3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xedf3('0x2')](0x0);var events={'afterCreate':_0xedf3('0x3'),'afterUpdate':_0xedf3('0x4'),'afterDestroy':_0xedf3('0x5')};function emitEvent(_0x2c7a53){return function(_0xe93239,_0x4de006,_0x3e0fd0){DashboardEvents[_0xedf3('0x6')](_0x2c7a53+':'+_0xe93239['id'],_0xe93239);DashboardEvents[_0xedf3('0x6')](_0x2c7a53,_0xe93239);_0x3e0fd0(null);};}for(var e in events){if(events[_0xedf3('0x7')](e)){var event=events[e];Dashboard[_0xedf3('0x8')](e,emitEvent(event));}}module[_0xedf3('0x9')]=DashboardEvents; \ No newline at end of file +var _0x1feb=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x37320c,_0x11386e){var _0x59b2de=function(_0x18cfe4){while(--_0x18cfe4){_0x37320c['push'](_0x37320c['shift']());}};_0x59b2de(++_0x11386e);}(_0x1feb,0x157));var _0xb1fe=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1feb[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0xb1fe('0x0'));var Dashboard=require(_0xb1fe('0x1'))['db'][_0xb1fe('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb1fe('0x3')](0x0);var events={'afterCreate':_0xb1fe('0x4'),'afterUpdate':_0xb1fe('0x5'),'afterDestroy':_0xb1fe('0x6')};function emitEvent(_0x1d85b4){return function(_0x398a8c,_0x2a065b,_0x4027b0){DashboardEvents[_0xb1fe('0x7')](_0x1d85b4+':'+_0x398a8c['id'],_0x398a8c);DashboardEvents[_0xb1fe('0x7')](_0x1d85b4,_0x398a8c);_0x4027b0(null);};}for(var e in events){if(events[_0xb1fe('0x8')](e)){var event=events[e];Dashboard[_0xb1fe('0x9')](e,emitEvent(event));}}module[_0xb1fe('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a26d9dc..1a65f97 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 _0x9cc4=['define','Dashboard','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x9cc4,0xde));var _0x49cc=function(_0x170ad3,_0x51fefe){_0x170ad3=_0x170ad3-0x0;var _0x512fac=_0x9cc4[_0x170ad3];return _0x512fac;};'use strict';var _=require(_0x49cc('0x0'));var util=require(_0x49cc('0x1'));var logger=require(_0x49cc('0x2'))('api');var moment=require(_0x49cc('0x3'));var BPromise=require(_0x49cc('0x4'));var rp=require(_0x49cc('0x5'));var fs=require('fs');var path=require(_0x49cc('0x6'));var rimraf=require(_0x49cc('0x7'));var config=require(_0x49cc('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x33c019,_0x90f85d){return _0x33c019[_0x49cc('0x9')](_0x49cc('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ba5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dashboard','dashboards','lodash','util'];(function(_0x1d94a9,_0x38069c){var _0x75b55e=function(_0x4c7ad7){while(--_0x4c7ad7){_0x1d94a9['push'](_0x1d94a9['shift']());}};_0x75b55e(++_0x38069c);}(_0x6ba5,0x132));var _0x56ba=function(_0x361422,_0xa27d1e){_0x361422=_0x361422-0x0;var _0x2daa43=_0x6ba5[_0x361422];return _0x2daa43;};'use strict';var _=require(_0x56ba('0x0'));var util=require(_0x56ba('0x1'));var logger=require(_0x56ba('0x2'))(_0x56ba('0x3'));var moment=require(_0x56ba('0x4'));var BPromise=require(_0x56ba('0x5'));var rp=require(_0x56ba('0x6'));var fs=require('fs');var path=require(_0x56ba('0x7'));var rimraf=require(_0x56ba('0x8'));var config=require(_0x56ba('0x9'));var attributes=require('./dashboard.attributes');module[_0x56ba('0xa')]=function(_0x2a2584,_0x1d8ab0){return _0x2a2584[_0x56ba('0xb')](_0x56ba('0xc'),attributes,{'tableName':_0x56ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 6117def..7b917c4 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 _0x5e66=['../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa614e8,_0xba1dad){var _0xf9873b=function(_0xfc27ae){while(--_0xfc27ae){_0xa614e8['push'](_0xa614e8['shift']());}};_0xf9873b(++_0xba1dad);}(_0x5e66,0x158));var _0x65e6=function(_0x22d5d7,_0x466750){_0x22d5d7=_0x22d5d7-0x0;var _0x5c6b99=_0x5e66[_0x22d5d7];return _0x5c6b99;};'use strict';var _=require(_0x65e6('0x0'));var util=require(_0x65e6('0x1'));var moment=require('moment');var BPromise=require(_0x65e6('0x2'));var rs=require(_0x65e6('0x3'));var fs=require('fs');var Redis=require(_0x65e6('0x4'));var db=require(_0x65e6('0x5'))['db'];var utils=require(_0x65e6('0x6'));var logger=require(_0x65e6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x65e6('0x8'));var client=jayson[_0x65e6('0x9')]['http']({'port':0x232a});config[_0x65e6('0xa')]=_['defaults'](config[_0x65e6('0xa')],{'host':_0x65e6('0xb'),'port':0x18eb});var socket=require(_0x65e6('0xc'))(new Redis(config['redis']));require('./dashboard.socket')[_0x65e6('0xd')](socket);function respondWithRpcPromise(_0x74cd87,_0x1d4f6c,_0x45cefc){return new BPromise(function(_0xb0fec5,_0x21a031){return client[_0x65e6('0xe')](_0x74cd87,_0x45cefc)[_0x65e6('0xf')](function(_0x56c9b7){logger['info'](_0x65e6('0x10'),_0x1d4f6c,'request\x20sent');logger[_0x65e6('0x11')](_0x65e6('0x12'),_0x1d4f6c,'request\x20sent',JSON[_0x65e6('0x13')](_0x56c9b7));if(_0x56c9b7[_0x65e6('0x14')]){if(_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x15')]===0x1f4){logger['error'](_0x65e6('0x10'),_0x1d4f6c,_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x16')]);return _0x21a031(_0x56c9b7[_0x65e6('0x14')]['message']);}logger[_0x65e6('0x14')](_0x65e6('0x10'),_0x1d4f6c,_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x16')]);return _0xb0fec5(_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x16')]);}else{logger[_0x65e6('0x17')]('Dashboard,\x20%s,\x20%s',_0x1d4f6c,_0x65e6('0x18'));_0xb0fec5(_0x56c9b7[_0x65e6('0x19')]['message']);}})[_0x65e6('0x1a')](function(_0xa05631){logger[_0x65e6('0x14')]('Dashboard,\x20%s,\x20%s',_0x1d4f6c,_0xa05631);_0x21a031(_0xa05631);});});} \ No newline at end of file +var _0xd242=['stringify','error','message','request\x20sent','result','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x5e2d50,_0x368411){var _0x450ba5=function(_0x54d90c){while(--_0x54d90c){_0x5e2d50['push'](_0x5e2d50['shift']());}};_0x450ba5(++_0x368411);}(_0xd242,0xc5));var _0x2d24=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0xd242[_0x188c88];return _0x4e4c38;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d24('0x0'));var BPromise=require(_0x2d24('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d24('0x2'))['db'];var utils=require(_0x2d24('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d24('0x4'));var jayson=require(_0x2d24('0x5'));var client=jayson[_0x2d24('0x6')][_0x2d24('0x7')]({'port':0x232a});config[_0x2d24('0x8')]=_[_0x2d24('0x9')](config[_0x2d24('0x8')],{'host':_0x2d24('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d24('0x8')]));require(_0x2d24('0xb'))[_0x2d24('0xc')](socket);function respondWithRpcPromise(_0x1f7d77,_0x4aa622,_0x1ac5e5){return new BPromise(function(_0x20d2b5,_0x174f97){return client[_0x2d24('0xd')](_0x1f7d77,_0x1ac5e5)[_0x2d24('0xe')](function(_0x361d02){logger[_0x2d24('0xf')](_0x2d24('0x10'),_0x4aa622,'request\x20sent');logger[_0x2d24('0x11')](_0x2d24('0x12'),_0x4aa622,'request\x20sent',JSON[_0x2d24('0x13')](_0x361d02));if(_0x361d02[_0x2d24('0x14')]){if(_0x361d02[_0x2d24('0x14')]['code']===0x1f4){logger[_0x2d24('0x14')](_0x2d24('0x10'),_0x4aa622,_0x361d02['error']['message']);return _0x174f97(_0x361d02['error'][_0x2d24('0x15')]);}logger['error'](_0x2d24('0x10'),_0x4aa622,_0x361d02[_0x2d24('0x14')]['message']);return _0x20d2b5(_0x361d02[_0x2d24('0x14')][_0x2d24('0x15')]);}else{logger[_0x2d24('0xf')](_0x2d24('0x10'),_0x4aa622,_0x2d24('0x16'));_0x20d2b5(_0x361d02[_0x2d24('0x17')][_0x2d24('0x15')]);}})['catch'](function(_0xd82960){logger[_0x2d24('0x14')](_0x2d24('0x10'),_0x4aa622,_0xd82960);_0x174f97(_0xd82960);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3213b17..99c98e4 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 _0x06e2=['./dashboard.events','save','update','removeListener','register','length','dashboard:'];(function(_0x46997a,_0x559efc){var _0x3c7ca0=function(_0x26547d){while(--_0x26547d){_0x46997a['push'](_0x46997a['shift']());}};_0x3c7ca0(++_0x559efc);}(_0x06e2,0x1d5));var _0x206e=function(_0x4f6ea5,_0xc00e8d){_0x4f6ea5=_0x4f6ea5-0x0;var _0x12b6b8=_0x06e2[_0x4f6ea5];return _0x12b6b8;};'use strict';var DashboardEvents=require(_0x206e('0x0'));var events=[_0x206e('0x1'),'remove',_0x206e('0x2')];function createListener(_0x5a4da2,_0x242a09){return function(_0xdff9e5){_0x242a09['emit'](_0x5a4da2,_0xdff9e5);};}function removeListener(_0x4dabe0,_0x1a22ae){return function(){DashboardEvents[_0x206e('0x3')](_0x4dabe0,_0x1a22ae);};}exports[_0x206e('0x4')]=function(_0x9846f7){for(var _0x4be579=0x0,_0x24c6e0=events[_0x206e('0x5')];_0x4be579<_0x24c6e0;_0x4be579++){var _0x2ed1fb=events[_0x4be579];var _0x26e22b=createListener(_0x206e('0x6')+_0x2ed1fb,_0x9846f7);DashboardEvents['on'](_0x2ed1fb,_0x26e22b);}}; \ No newline at end of file +var _0x77e6=['./dashboard.events','save','remove','update','removeListener','register','length','dashboard:'];(function(_0x508d86,_0x383f97){var _0x1b5bd2=function(_0x29c430){while(--_0x29c430){_0x508d86['push'](_0x508d86['shift']());}};_0x1b5bd2(++_0x383f97);}(_0x77e6,0xa8));var _0x677e=function(_0x39bd7d,_0x23dff8){_0x39bd7d=_0x39bd7d-0x0;var _0x43d57d=_0x77e6[_0x39bd7d];return _0x43d57d;};'use strict';var DashboardEvents=require(_0x677e('0x0'));var events=[_0x677e('0x1'),_0x677e('0x2'),_0x677e('0x3')];function createListener(_0x1e76bc,_0x2a69e4){return function(_0x283f6e){_0x2a69e4['emit'](_0x1e76bc,_0x283f6e);};}function removeListener(_0x213ca7,_0xb4522d){return function(){DashboardEvents[_0x677e('0x4')](_0x213ca7,_0xb4522d);};}exports[_0x677e('0x5')]=function(_0x374759){for(var _0x4b7e86=0x0,_0x5123ac=events[_0x677e('0x6')];_0x4b7e86<_0x5123ac;_0x4b7e86++){var _0x4db6ba=events[_0x4b7e86];var _0x6f308d=createListener(_0x677e('0x7')+_0x4db6ba,_0x374759);DashboardEvents['on'](_0x4db6ba,_0x6f308d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 62014f4..186e48a 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 _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x135723,_0x3820bb){var _0x5e71a3=function(_0x6737ad){while(--_0x6737ad){_0x135723['push'](_0x135723['shift']());}};_0x5e71a3(++_0x3820bb);}(_0x70e0,0x17b));var _0x070e=function(_0x5f593a,_0x56bfc8){_0x5f593a=_0x5f593a-0x0;var _0xa85621=_0x70e0[_0x5f593a];return _0xa85621;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x31f927,_0xe13a8e){var _0x2ba190=function(_0x229d94){while(--_0x229d94){_0x31f927['push'](_0x31f927['shift']());}};_0x2ba190(++_0xe13a8e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index a602dc1..0bf59ce 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 _0x6319=['STRING','#2196f3','sequelize','squel','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x3107af,_0x3e3247){var _0x2324ad=function(_0x59915e){while(--_0x59915e){_0x3107af['push'](_0x3107af['shift']());}};_0x2324ad(++_0x3e3247);}(_0x6319,0x157));var _0x9631=function(_0x500586,_0x1a54fe){_0x500586=_0x500586-0x0;var _0x2651e8=_0x6319[_0x500586];return _0x2651e8;};'use strict';var Sequelize=require(_0x9631('0x0'));var squel=require(_0x9631('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9631('0x2')](_0x9631('0x3')),'get':function(){try{return JSON['parse'](this[_0x9631('0x4')](_0x9631('0x5')));}catch(_0x163a31){return[];}},'set':function(_0x4e4e60){try{this[_0x9631('0x6')](_0x9631('0x5'),JSON[_0x9631('0x7')](_0x4e4e60));}catch(_0x4e9a3c){this['setDataValue']('attrs',JSON[_0x9631('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x9631('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9631('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9631('0x8')]},'background':{'type':Sequelize[_0x9631('0x9')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9631('0x9')],'allowNull':![],'defaultValue':_0x9631('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9631('0x9')]},'titleFontSize':{'type':Sequelize[_0x9631('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0xedb1=['attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','long','parse','getDataValue'];(function(_0x327b08,_0x53e089){var _0x4db7c0=function(_0x516bdb){while(--_0x516bdb){_0x327b08['push'](_0x327b08['shift']());}};_0x4db7c0(++_0x53e089);}(_0xedb1,0x14b));var _0x1edb=function(_0x378d58,_0x55cbcc){_0x378d58=_0x378d58-0x0;var _0x489b9e=_0xedb1[_0x378d58];return _0x489b9e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1edb('0x0'));var _=require(_0x1edb('0x1'));module[_0x1edb('0x2')]={'title':{'type':Sequelize[_0x1edb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1edb('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x1edb('0x4')),'get':function(){try{return JSON[_0x1edb('0x5')](this[_0x1edb('0x6')]('attrs'));}catch(_0x532a47){return[];}},'set':function(_0x3eccae){try{this['setDataValue'](_0x1edb('0x7'),JSON[_0x1edb('0x8')](_0x3eccae));}catch(_0x14601a){this[_0x1edb('0x9')](_0x1edb('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1edb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x1edb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1edb('0xa')]},'col':{'type':Sequelize[_0x1edb('0xa')]},'background':{'type':Sequelize[_0x1edb('0x3')],'allowNull':![],'defaultValue':_0x1edb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1edb('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x1edb('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index eb34922..5ea1f9d 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 _0x1767=['iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','error','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','DashboardItem','find','catch','type'];(function(_0x14afb7,_0x28d1b2){var _0x370205=function(_0x53c83d){while(--_0x53c83d){_0x14afb7['push'](_0x14afb7['shift']());}};_0x370205(++_0x28d1b2);}(_0x1767,0x129));var _0x7176=function(_0x5ad85a,_0x5bdc6d){_0x5ad85a=_0x5ad85a-0x0;var _0x6eeeb5=_0x1767[_0x5ad85a];return _0x6eeeb5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7176('0x0'));var rimraf=require(_0x7176('0x1'));var zipdir=require(_0x7176('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7176('0x3'));var moment=require(_0x7176('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7176('0x5'));var util=require(_0x7176('0x6'));var path=require('path');var sox=require(_0x7176('0x7'));var csv=require('to-csv');var ejs=require(_0x7176('0x8'));var fs=require('fs');var _=require(_0x7176('0x9'));var squel=require('squel');var crypto=require(_0x7176('0xa'));var jsforce=require(_0x7176('0xb'));var deskjs=require(_0x7176('0xc'));var toCsv=require(_0x7176('0xd'));var querystring=require(_0x7176('0xe'));var Papa=require(_0x7176('0xf'));var Redis=require('ioredis');var authService=require(_0x7176('0x10'));var qs=require(_0x7176('0x11'));var as=require(_0x7176('0x12'));var hardwareService=require(_0x7176('0x13'));var logger=require(_0x7176('0x14'))(_0x7176('0x15'));var utils=require('../../config/utils');var config=require(_0x7176('0x16'));var licenseUtil=require(_0x7176('0x17'));var db=require('../../mysqldb')['db'];config[_0x7176('0x18')]=_[_0x7176('0x19')](config[_0x7176('0x18')],{'host':_0x7176('0x1a'),'port':0x18eb});var socket=require(_0x7176('0x1b'))(new Redis(config[_0x7176('0x18')]));require(_0x7176('0x1c'))[_0x7176('0x1d')](socket);function respondWithStatusCode(_0x58c47a,_0x5988eb){_0x5988eb=_0x5988eb||0xcc;return function(_0x380a36){if(_0x380a36){return _0x58c47a[_0x7176('0x1e')](_0x5988eb);}return _0x58c47a[_0x7176('0x1f')](_0x5988eb)[_0x7176('0x20')]();};}function respondWithResult(_0x319329,_0x270735){_0x270735=_0x270735||0xc8;return function(_0x49c308){if(_0x49c308){return _0x319329['status'](_0x270735)['json'](_0x49c308);}};}function respondWithFilteredResult(_0x16d872,_0x3a407f){return function(_0x45d85c){if(_0x45d85c){var _0x5979bc=_0x45d85c[_0x7176('0x21')],_0x47e7b6=_0x3a407f[_0x7176('0x22')],_0x47a6c8=_0x3a407f['offset']+_0x3a407f[_0x7176('0x23')],_0x3b3fc3;if(_0x47a6c8>=_0x5979bc){_0x47a6c8=_0x5979bc;_0x3b3fc3=0xc8;}else{_0x3b3fc3=0xce;}_0x16d872[_0x7176('0x1f')](_0x3b3fc3);return _0x16d872['set'](_0x7176('0x24'),_0x47e7b6+'-'+_0x47a6c8+'/'+_0x5979bc)[_0x7176('0x25')](_0x45d85c);}return null;};}function patchUpdates(_0x59f281){return function(_0x59029b){try{jsonpatch[_0x7176('0x26')](_0x59029b,_0x59f281,!![]);}catch(_0x2edd7f){return BPromise['reject'](_0x2edd7f);}return _0x59029b[_0x7176('0x27')]();};}function saveUpdates(_0x5cc505,_0x4a5af7){return function(_0x3c73b0){if(_0x3c73b0){return _0x3c73b0[_0x7176('0x28')](_0x5cc505)['then'](function(_0x3aad44){return _0x3aad44;});}return null;};}function removeEntity(_0x3f6690,_0x2cc5b2){return function(_0x51c78e){if(_0x51c78e){return _0x51c78e[_0x7176('0x29')]()[_0x7176('0x2a')](function(){_0x3f6690[_0x7176('0x1f')](0xcc)[_0x7176('0x20')]();});}};}function handleEntityNotFound(_0x426229,_0x445d66){return function(_0x419b83){if(!_0x419b83){_0x426229[_0x7176('0x1e')](0x194);}return _0x419b83;};}function handleError(_0x206234,_0x51e60d){_0x51e60d=_0x51e60d||0x1f4;return function(_0x1ca1c8){logger[_0x7176('0x2b')](_0x1ca1c8['stack']);if(_0x1ca1c8[_0x7176('0x2c')]){delete _0x1ca1c8[_0x7176('0x2c')];}_0x206234[_0x7176('0x1f')](_0x51e60d)[_0x7176('0x2d')](_0x1ca1c8);};}exports[_0x7176('0x2e')]=function(_0x35c459,_0x45486b){var _0x2d43a3={'raw':![],'where':{'id':_0x35c459[_0x7176('0x2f')]['id']}},_0x5b6563={};_0x5b6563['model']=_[_0x7176('0x30')](db['DashboardItem'][_0x7176('0x31')]);_0x5b6563[_0x7176('0x32')]=_['keys'](_0x35c459[_0x7176('0x32')]);_0x5b6563[_0x7176('0x33')]=_[_0x7176('0x34')](_0x5b6563[_0x7176('0x35')],_0x5b6563['query']);_0x2d43a3[_0x7176('0x36')]=_[_0x7176('0x34')](_0x5b6563['model'],qs[_0x7176('0x37')](_0x35c459[_0x7176('0x32')][_0x7176('0x37')]));_0x2d43a3[_0x7176('0x36')]=_0x2d43a3[_0x7176('0x36')][_0x7176('0x38')]?_0x2d43a3[_0x7176('0x36')]:_0x5b6563['model'];if(_0x35c459['query']['includeAll']){_0x2d43a3['include']=[{'all':!![]}];}_0x2d43a3=_[_0x7176('0x39')]({},_0x2d43a3,_0x35c459[_0x7176('0x3a')]);return db[_0x7176('0x3b')][_0x7176('0x3c')](_0x2d43a3)[_0x7176('0x2a')](handleEntityNotFound(_0x45486b,null))['then'](respondWithResult(_0x45486b,null))[_0x7176('0x3d')](handleError(_0x45486b,null));};exports[_0x7176('0x29')]=function(_0x44970e,_0x5bc9b4){return db[_0x7176('0x3b')][_0x7176('0x3c')]({'where':{'id':_0x44970e['params']['id']}})['then'](handleEntityNotFound(_0x5bc9b4,null))['then'](removeEntity(_0x5bc9b4,null))[_0x7176('0x3d')](handleError(_0x5bc9b4,null));};function widgetAttributes(_0x520876){try{switch(_0x520876[_0x7176('0x3e')]){case _0x7176('0x3f'):return[{'name':_0x7176('0x40'),'value':_0x520876[_0x7176('0x40')]||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x0]?_0x520876[_0x7176('0x41')][0x0][_0x7176('0x42')]:undefined)||_0x7176('0x43')}];case _0x7176('0x44'):return[{'name':_0x7176('0x45'),'value':_0x520876[_0x7176('0x45')]||(_0x520876[_0x7176('0x41')]&&_0x520876['attrs'][0x0]?_0x520876['attrs'][0x0][_0x7176('0x42')]:undefined)||''}];case _0x7176('0x46'):return[{'name':_0x7176('0x47'),'value':_0x520876[_0x7176('0x47')]||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x0]?_0x520876[_0x7176('0x41')][0x0][_0x7176('0x42')]:undefined)||_0x7176('0x48')},{'name':_0x7176('0x49'),'value':_0x520876[_0x7176('0x49')]||(_0x520876['attrs']&&_0x520876[_0x7176('0x41')][0x1]?_0x520876[_0x7176('0x41')][0x1]['value']:undefined)||_0x7176('0x4a')},{'name':_0x7176('0x4b'),'value':_0x520876[_0x7176('0x4b')]||(_0x520876[_0x7176('0x41')]&&_0x520876['attrs'][0x2]?_0x520876['attrs'][0x2][_0x7176('0x42')]:undefined)||0xc}];case _0x7176('0x4c'):return[{'name':'attrMetric','value':_0x520876['attrMetric']||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x0]?_0x520876['attrs'][0x0][_0x7176('0x42')]:undefined)||_0x7176('0x4d')},{'name':'attrVoiceQueues','value':_0x520876['attrVoiceQueues']||(_0x520876['attrs']&&_0x520876['attrs'][0x1]?_0x520876[_0x7176('0x41')][0x1][_0x7176('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x520876[_0x7176('0x4b')]||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x2]?_0x520876[_0x7176('0x41')][0x2][_0x7176('0x42')]:undefined)||0x14}];case'multibar-chart':case _0x7176('0x4e'):return[{'name':_0x7176('0x4f'),'value':_0x520876['attrSerie1']||(_0x520876[_0x7176('0x41')]&&_0x520876['attrs'][0x0]?_0x520876[_0x7176('0x41')][0x0][_0x7176('0x42')]:undefined)||_0x7176('0x4d')},{'name':_0x7176('0x50'),'value':_0x520876[_0x7176('0x50')]||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x1]?_0x520876['attrs'][0x1][_0x7176('0x42')]:undefined)||null},{'name':_0x7176('0x51'),'value':_0x520876[_0x7176('0x51')]||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x2]?_0x520876[_0x7176('0x41')][0x2]['value']:undefined)||null},{'name':_0x7176('0x52'),'value':_0x520876[_0x7176('0x52')]||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x3]?_0x520876[_0x7176('0x41')][0x3][_0x7176('0x42')]:undefined)||[]}];case _0x7176('0x53'):return[{'name':_0x7176('0x54'),'type':_0x520876[_0x7176('0x55')]||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x0]?_0x520876[_0x7176('0x41')][0x0][_0x7176('0x3e')]:undefined)||null,'value':_0x520876['attrReport']||(_0x520876[_0x7176('0x41')]&&_0x520876[_0x7176('0x41')][0x0]?_0x520876['attrs'][0x0][_0x7176('0x42')]:undefined)||null},{'name':_0x7176('0x56'),'value':_0x520876[_0x7176('0x56')]||(_0x520876['attrs']&&_0x520876[_0x7176('0x41')][0x1]?_0x520876[_0x7176('0x41')][0x1][_0x7176('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x1fffff){logger['error'](_0x7176('0x57'),JSON['stringify'](_0x1fffff));return[];}}exports[_0x7176('0x58')]=function(_0x56b39c,_0x2f18e5){if(_0x56b39c['body']){_0x56b39c[_0x7176('0x59')][_0x7176('0x41')]=widgetAttributes(_0x56b39c['body']);}return db[_0x7176('0x3b')][_0x7176('0x58')](_0x56b39c[_0x7176('0x59')],{})[_0x7176('0x2a')](respondWithResult(_0x2f18e5,0xc9))[_0x7176('0x3d')](handleError(_0x2f18e5,null));};exports[_0x7176('0x28')]=function(_0x2e2d6f,_0x442e1d){if(_0x2e2d6f[_0x7176('0x59')]['id']){delete _0x2e2d6f[_0x7176('0x59')]['id'];}_0x2e2d6f[_0x7176('0x59')]['attrs']=widgetAttributes(_0x2e2d6f[_0x7176('0x59')]);return db[_0x7176('0x3b')]['find']({'where':{'id':_0x2e2d6f[_0x7176('0x2f')]['id']}})['then'](handleEntityNotFound(_0x442e1d,null))[_0x7176('0x2a')](saveUpdates(_0x2e2d6f[_0x7176('0x59')],null))[_0x7176('0x2a')](respondWithResult(_0x442e1d,null))['catch'](handleError(_0x442e1d,null));}; \ No newline at end of file +var _0x9fd1=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','multibar-chart','pie-chart','attrSerie1','attrSerie3','attrVoiceQueues','attrReport','type','attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','rimraf','zip-dir','request-promise','bluebird'];(function(_0x18e875,_0x54fff7){var _0x1643c6=function(_0x5f09ff){while(--_0x5f09ff){_0x18e875['push'](_0x18e875['shift']());}};_0x1643c6(++_0x54fff7);}(_0x9fd1,0x163));var _0x19fd=function(_0x53b0d0,_0x5d0350){_0x53b0d0=_0x53b0d0-0x0;var _0x5993dd=_0x9fd1[_0x53b0d0];return _0x5993dd;};'use strict';var pdf=require(_0x19fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x19fd('0x1'));var zipdir=require(_0x19fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19fd('0x3'));var moment=require('moment');var BPromise=require(_0x19fd('0x4'));var Mustache=require(_0x19fd('0x5'));var util=require(_0x19fd('0x6'));var path=require('path');var sox=require(_0x19fd('0x7'));var csv=require(_0x19fd('0x8'));var ejs=require(_0x19fd('0x9'));var fs=require('fs');var _=require(_0x19fd('0xa'));var squel=require(_0x19fd('0xb'));var crypto=require(_0x19fd('0xc'));var jsforce=require(_0x19fd('0xd'));var deskjs=require(_0x19fd('0xe'));var toCsv=require(_0x19fd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x19fd('0xf'));var authService=require(_0x19fd('0x10'));var qs=require(_0x19fd('0x11'));var as=require(_0x19fd('0x12'));var hardwareService=require(_0x19fd('0x13'));var logger=require('../../config/logger')(_0x19fd('0x14'));var utils=require(_0x19fd('0x15'));var config=require(_0x19fd('0x16'));var licenseUtil=require(_0x19fd('0x17'));var db=require(_0x19fd('0x18'))['db'];config[_0x19fd('0x19')]=_[_0x19fd('0x1a')](config[_0x19fd('0x19')],{'host':_0x19fd('0x1b'),'port':0x18eb});var socket=require(_0x19fd('0x1c'))(new Redis(config[_0x19fd('0x19')]));require(_0x19fd('0x1d'))[_0x19fd('0x1e')](socket);function respondWithStatusCode(_0x562044,_0x359db5){_0x359db5=_0x359db5||0xcc;return function(_0x172e6f){if(_0x172e6f){return _0x562044[_0x19fd('0x1f')](_0x359db5);}return _0x562044[_0x19fd('0x20')](_0x359db5)[_0x19fd('0x21')]();};}function respondWithResult(_0x2fb133,_0x72fac5){_0x72fac5=_0x72fac5||0xc8;return function(_0x2a1672){if(_0x2a1672){return _0x2fb133[_0x19fd('0x20')](_0x72fac5)[_0x19fd('0x22')](_0x2a1672);}};}function respondWithFilteredResult(_0x592eb2,_0x287dda){return function(_0x59f5){if(_0x59f5){var _0xe66d43=_0x59f5[_0x19fd('0x23')],_0x1d50fa=_0x287dda['offset'],_0x175ffd=_0x287dda[_0x19fd('0x24')]+_0x287dda['limit'],_0x1b9fdf;if(_0x175ffd>=_0xe66d43){_0x175ffd=_0xe66d43;_0x1b9fdf=0xc8;}else{_0x1b9fdf=0xce;}_0x592eb2[_0x19fd('0x20')](_0x1b9fdf);return _0x592eb2[_0x19fd('0x25')](_0x19fd('0x26'),_0x1d50fa+'-'+_0x175ffd+'/'+_0xe66d43)['json'](_0x59f5);}return null;};}function patchUpdates(_0x59b4a7){return function(_0x32c147){try{jsonpatch['apply'](_0x32c147,_0x59b4a7,!![]);}catch(_0xbfa047){return BPromise[_0x19fd('0x27')](_0xbfa047);}return _0x32c147[_0x19fd('0x28')]();};}function saveUpdates(_0x2308ae,_0x3c1cb7){return function(_0x1e5fb9){if(_0x1e5fb9){return _0x1e5fb9[_0x19fd('0x29')](_0x2308ae)[_0x19fd('0x2a')](function(_0x3bd39e){return _0x3bd39e;});}return null;};}function removeEntity(_0xe81287,_0x51745a){return function(_0x2bb48b){if(_0x2bb48b){return _0x2bb48b[_0x19fd('0x2b')]()['then'](function(){_0xe81287[_0x19fd('0x20')](0xcc)[_0x19fd('0x21')]();});}};}function handleEntityNotFound(_0x5d5dea,_0x132857){return function(_0x1da227){if(!_0x1da227){_0x5d5dea[_0x19fd('0x1f')](0x194);}return _0x1da227;};}function handleError(_0xa3b9b4,_0x2e06de){_0x2e06de=_0x2e06de||0x1f4;return function(_0x556c30){logger[_0x19fd('0x2c')](_0x556c30[_0x19fd('0x2d')]);if(_0x556c30[_0x19fd('0x2e')]){delete _0x556c30[_0x19fd('0x2e')];}_0xa3b9b4[_0x19fd('0x20')](_0x2e06de)[_0x19fd('0x2f')](_0x556c30);};}exports[_0x19fd('0x30')]=function(_0x50926f,_0x236522){var _0x2bde26={'raw':![],'where':{'id':_0x50926f[_0x19fd('0x31')]['id']}},_0x43af56={};_0x43af56[_0x19fd('0x32')]=_[_0x19fd('0x33')](db[_0x19fd('0x34')][_0x19fd('0x35')]);_0x43af56['query']=_[_0x19fd('0x33')](_0x50926f[_0x19fd('0x36')]);_0x43af56[_0x19fd('0x37')]=_[_0x19fd('0x38')](_0x43af56[_0x19fd('0x32')],_0x43af56[_0x19fd('0x36')]);_0x2bde26[_0x19fd('0x39')]=_['intersection'](_0x43af56[_0x19fd('0x32')],qs[_0x19fd('0x3a')](_0x50926f['query'][_0x19fd('0x3a')]));_0x2bde26[_0x19fd('0x39')]=_0x2bde26[_0x19fd('0x39')][_0x19fd('0x3b')]?_0x2bde26['attributes']:_0x43af56['model'];if(_0x50926f[_0x19fd('0x36')][_0x19fd('0x3c')]){_0x2bde26[_0x19fd('0x3d')]=[{'all':!![]}];}_0x2bde26=_[_0x19fd('0x3e')]({},_0x2bde26,_0x50926f['options']);return db['DashboardItem'][_0x19fd('0x3f')](_0x2bde26)[_0x19fd('0x2a')](handleEntityNotFound(_0x236522,null))['then'](respondWithResult(_0x236522,null))[_0x19fd('0x40')](handleError(_0x236522,null));};exports[_0x19fd('0x2b')]=function(_0x4640ef,_0x1091a5){return db[_0x19fd('0x34')][_0x19fd('0x3f')]({'where':{'id':_0x4640ef['params']['id']}})['then'](handleEntityNotFound(_0x1091a5,null))[_0x19fd('0x2a')](removeEntity(_0x1091a5,null))[_0x19fd('0x40')](handleError(_0x1091a5,null));};function widgetAttributes(_0x504219){try{switch(_0x504219['type']){case _0x19fd('0x41'):return[{'name':_0x19fd('0x42'),'value':_0x504219[_0x19fd('0x42')]||(_0x504219['attrs']&&_0x504219[_0x19fd('0x43')][0x0]?_0x504219[_0x19fd('0x43')][0x0]['value']:undefined)||_0x19fd('0x44')}];case _0x19fd('0x45'):return[{'name':_0x19fd('0x46'),'value':_0x504219[_0x19fd('0x46')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x0]?_0x504219[_0x19fd('0x43')][0x0][_0x19fd('0x47')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x504219[_0x19fd('0x48')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x0]?_0x504219[_0x19fd('0x43')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x19fd('0x49'),'value':_0x504219[_0x19fd('0x49')]||(_0x504219['attrs']&&_0x504219['attrs'][0x1]?_0x504219[_0x19fd('0x43')][0x1][_0x19fd('0x47')]:undefined)||_0x19fd('0x4a')},{'name':_0x19fd('0x4b'),'value':_0x504219[_0x19fd('0x4b')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x2]?_0x504219[_0x19fd('0x43')][0x2][_0x19fd('0x47')]:undefined)||0xc}];case _0x19fd('0x4c'):return[{'name':_0x19fd('0x4d'),'value':_0x504219[_0x19fd('0x4d')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x0]?_0x504219['attrs'][0x0]['value']:undefined)||_0x19fd('0x4e')},{'name':'attrVoiceQueues','value':_0x504219['attrVoiceQueues']||(_0x504219[_0x19fd('0x43')]&&_0x504219['attrs'][0x1]?_0x504219['attrs'][0x1][_0x19fd('0x47')]:undefined)||[]},{'name':_0x19fd('0x4b'),'value':_0x504219[_0x19fd('0x4b')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x2]?_0x504219[_0x19fd('0x43')][0x2][_0x19fd('0x47')]:undefined)||0x14}];case _0x19fd('0x4f'):case _0x19fd('0x50'):return[{'name':'attrSerie1','value':_0x504219[_0x19fd('0x51')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x0]?_0x504219[_0x19fd('0x43')][0x0][_0x19fd('0x47')]:undefined)||'total'},{'name':'attrSerie2','value':_0x504219['attrSerie2']||(_0x504219[_0x19fd('0x43')]&&_0x504219['attrs'][0x1]?_0x504219[_0x19fd('0x43')][0x1][_0x19fd('0x47')]:undefined)||null},{'name':'attrSerie3','value':_0x504219[_0x19fd('0x52')]||(_0x504219['attrs']&&_0x504219[_0x19fd('0x43')][0x2]?_0x504219[_0x19fd('0x43')][0x2][_0x19fd('0x47')]:undefined)||null},{'name':_0x19fd('0x53'),'value':_0x504219['attrVoiceQueues']||(_0x504219[_0x19fd('0x43')]&&_0x504219['attrs'][0x3]?_0x504219[_0x19fd('0x43')][0x3][_0x19fd('0x47')]:undefined)||[]}];case'web-report':return[{'name':_0x19fd('0x54'),'type':_0x504219['reportType']||(_0x504219[_0x19fd('0x43')]&&_0x504219['attrs'][0x0]?_0x504219[_0x19fd('0x43')][0x0][_0x19fd('0x55')]:undefined)||null,'value':_0x504219[_0x19fd('0x54')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x0]?_0x504219[_0x19fd('0x43')][0x0][_0x19fd('0x47')]:undefined)||null},{'name':_0x19fd('0x56'),'value':_0x504219[_0x19fd('0x56')]||(_0x504219[_0x19fd('0x43')]&&_0x504219[_0x19fd('0x43')][0x1]?_0x504219[_0x19fd('0x43')][0x1][_0x19fd('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x493104){logger[_0x19fd('0x2c')](_0x19fd('0x57'),JSON['stringify'](_0x493104));return[];}}exports[_0x19fd('0x58')]=function(_0x2499cd,_0x4581d4){if(_0x2499cd[_0x19fd('0x59')]){_0x2499cd[_0x19fd('0x59')][_0x19fd('0x43')]=widgetAttributes(_0x2499cd[_0x19fd('0x59')]);}return db[_0x19fd('0x34')][_0x19fd('0x58')](_0x2499cd[_0x19fd('0x59')],{})['then'](respondWithResult(_0x4581d4,0xc9))[_0x19fd('0x40')](handleError(_0x4581d4,null));};exports['update']=function(_0x2f17b1,_0x18071b){if(_0x2f17b1[_0x19fd('0x59')]['id']){delete _0x2f17b1[_0x19fd('0x59')]['id'];}_0x2f17b1['body'][_0x19fd('0x43')]=widgetAttributes(_0x2f17b1[_0x19fd('0x59')]);return db[_0x19fd('0x34')][_0x19fd('0x3f')]({'where':{'id':_0x2f17b1[_0x19fd('0x31')]['id']}})[_0x19fd('0x2a')](handleEntityNotFound(_0x18071b,null))['then'](saveUpdates(_0x2f17b1[_0x19fd('0x59')],null))[_0x19fd('0x2a')](respondWithResult(_0x18071b,null))[_0x19fd('0x40')](handleError(_0x18071b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index b644460..f215476 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 _0x1c7b=['DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1c7b,0x1d4));var _0xb1c7=function(_0x418b41,_0x55ff88){_0x418b41=_0x418b41-0x0;var _0x2fcfeb=_0x1c7b[_0x418b41];return _0x2fcfeb;};'use strict';var EventEmitter=require(_0xb1c7('0x0'));var DashboardItem=require(_0xb1c7('0x1'))['db'][_0xb1c7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb1c7('0x3')](0x0);var events={'afterCreate':_0xb1c7('0x4'),'afterUpdate':'update','afterDestroy':_0xb1c7('0x5')};function emitEvent(_0x48a90f){return function(_0x53dbc6,_0x104d2d,_0x375fb6){DashboardItemEvents[_0xb1c7('0x6')](_0x48a90f+':'+_0x53dbc6['id'],_0x53dbc6);DashboardItemEvents[_0xb1c7('0x6')](_0x48a90f,_0x53dbc6);_0x375fb6(null);};}for(var e in events){if(events[_0xb1c7('0x7')](e)){var event=events[e];DashboardItem[_0xb1c7('0x8')](e,emitEvent(event));}}module[_0xb1c7('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xf682=['../../mysqldb','DashboardItem','remove','emit','hasOwnProperty','hook'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf682,0x1a4));var _0x2f68=function(_0x133bfb,_0x2e8a05){_0x133bfb=_0x133bfb-0x0;var _0x28e81c=_0xf682[_0x133bfb];return _0x28e81c;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x2f68('0x0'))['db'][_0x2f68('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2f68('0x2')};function emitEvent(_0x349aa1){return function(_0x3973f1,_0x34adfb,_0x3c7be8){DashboardItemEvents[_0x2f68('0x3')](_0x349aa1+':'+_0x3973f1['id'],_0x3973f1);DashboardItemEvents['emit'](_0x349aa1,_0x3973f1);_0x3c7be8(null);};}for(var e in events){if(events[_0x2f68('0x4')](e)){var event=events[e];DashboardItem[_0x2f68('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 3ae316a..897d534 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 _0x43bf=['define','dashboard_items','lodash','util','../../config/logger','moment','path','./dashboardItem.attributes'];(function(_0xce244a,_0x1879b5){var _0x454ab5=function(_0x1d822d){while(--_0x1d822d){_0xce244a['push'](_0xce244a['shift']());}};_0x454ab5(++_0x1879b5);}(_0x43bf,0x1ba));var _0xf43b=function(_0x135fdd,_0x25d894){_0x135fdd=_0x135fdd-0x0;var _0x27e981=_0x43bf[_0x135fdd];return _0x27e981;};'use strict';var _=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var logger=require(_0xf43b('0x2'))('api');var moment=require(_0xf43b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf43b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf43b('0x5'));module['exports']=function(_0x485fd5,_0x330706){return _0x485fd5[_0xf43b('0x6')]('DashboardItem',attributes,{'tableName':_0xf43b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x649a=['exports','DashboardItem','dashboard_items','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./dashboardItem.attributes'];(function(_0x1a8697,_0x30e766){var _0x481ffd=function(_0x330494){while(--_0x330494){_0x1a8697['push'](_0x1a8697['shift']());}};_0x481ffd(++_0x30e766);}(_0x649a,0x1bb));var _0xa649=function(_0x3babb2,_0x4e832d){_0x3babb2=_0x3babb2-0x0;var _0x43e8fd=_0x649a[_0x3babb2];return _0x43e8fd;};'use strict';var _=require('lodash');var util=require(_0xa649('0x0'));var logger=require(_0xa649('0x1'))(_0xa649('0x2'));var moment=require(_0xa649('0x3'));var BPromise=require(_0xa649('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa649('0x5'));var rimraf=require('rimraf');var config=require(_0xa649('0x6'));var attributes=require(_0xa649('0x7'));module[_0xa649('0x8')]=function(_0x5b16e5,_0x12ffaf){return _0x5b16e5['define'](_0xa649('0x9'),attributes,{'tableName':_0xa649('0xa'),'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 7375b0b..a4f45dd 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 _0xd5d1=['localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x3fd1a3,_0x53a973){var _0x1f5256=function(_0x5ae675){while(--_0x5ae675){_0x3fd1a3['push'](_0x3fd1a3['shift']());}};_0x1f5256(++_0x53a973);}(_0xd5d1,0x12d));var _0x1d5d=function(_0x2fd0a9,_0x19f19a){_0x2fd0a9=_0x2fd0a9-0x0;var _0x5eaca1=_0xd5d1[_0x2fd0a9];return _0x5eaca1;};'use strict';var _=require(_0x1d5d('0x0'));var util=require(_0x1d5d('0x1'));var moment=require(_0x1d5d('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d5d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d5d('0x5'))(_0x1d5d('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d5d('0x7'));var client=jayson[_0x1d5d('0x8')][_0x1d5d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1d5d('0xa')],{'host':_0x1d5d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d5d('0xa')]));require(_0x1d5d('0xc'))[_0x1d5d('0xd')](socket);function respondWithRpcPromise(_0x28b98b,_0x93e957,_0x54a4a8){return new BPromise(function(_0x44f39a,_0x5d0c47){return client[_0x1d5d('0xe')](_0x28b98b,_0x54a4a8)[_0x1d5d('0xf')](function(_0x33e205){logger[_0x1d5d('0x10')](_0x1d5d('0x11'),_0x93e957,_0x1d5d('0x12'));logger[_0x1d5d('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x93e957,'request\x20sent',JSON[_0x1d5d('0x14')](_0x33e205));if(_0x33e205[_0x1d5d('0x15')]){if(_0x33e205['error']['code']===0x1f4){logger[_0x1d5d('0x15')](_0x1d5d('0x11'),_0x93e957,_0x33e205[_0x1d5d('0x15')][_0x1d5d('0x16')]);return _0x5d0c47(_0x33e205[_0x1d5d('0x15')]['message']);}logger[_0x1d5d('0x15')](_0x1d5d('0x11'),_0x93e957,_0x33e205[_0x1d5d('0x15')][_0x1d5d('0x16')]);return _0x44f39a(_0x33e205['error'][_0x1d5d('0x16')]);}else{logger[_0x1d5d('0x10')](_0x1d5d('0x11'),_0x93e957,_0x1d5d('0x12'));_0x44f39a(_0x33e205[_0x1d5d('0x17')][_0x1d5d('0x16')]);}})['catch'](function(_0x28b82a){logger[_0x1d5d('0x15')](_0x1d5d('0x11'),_0x93e957,_0x28b82a);_0x5d0c47(_0x28b82a);});});} \ No newline at end of file +var _0x75a4=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','register','request'];(function(_0x5cc7af,_0x9570d8){var _0x165552=function(_0x7b47a6){while(--_0x7b47a6){_0x5cc7af['push'](_0x5cc7af['shift']());}};_0x165552(++_0x9570d8);}(_0x75a4,0x181));var _0x475a=function(_0x244e9b,_0x3b30a2){_0x244e9b=_0x244e9b-0x0;var _0x7a2380=_0x75a4[_0x244e9b];return _0x7a2380;};'use strict';var _=require('lodash');var util=require(_0x475a('0x0'));var moment=require(_0x475a('0x1'));var BPromise=require('bluebird');var rs=require(_0x475a('0x2'));var fs=require('fs');var Redis=require(_0x475a('0x3'));var db=require(_0x475a('0x4'))['db'];var utils=require(_0x475a('0x5'));var logger=require('../../config/logger')(_0x475a('0x6'));var config=require('../../config/environment');var jayson=require(_0x475a('0x7'));var client=jayson[_0x475a('0x8')][_0x475a('0x9')]({'port':0x232a});config[_0x475a('0xa')]=_[_0x475a('0xb')](config[_0x475a('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x475a('0xc'))[_0x475a('0xd')](socket);function respondWithRpcPromise(_0x41706d,_0x393842,_0x14e062){return new BPromise(function(_0x510ce1,_0x2712f4){return client[_0x475a('0xe')](_0x41706d,_0x14e062)[_0x475a('0xf')](function(_0x5cb43d){logger[_0x475a('0x10')](_0x475a('0x11'),_0x393842,_0x475a('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x393842,_0x475a('0x12'),JSON[_0x475a('0x13')](_0x5cb43d));if(_0x5cb43d[_0x475a('0x14')]){if(_0x5cb43d[_0x475a('0x14')][_0x475a('0x15')]===0x1f4){logger[_0x475a('0x14')](_0x475a('0x11'),_0x393842,_0x5cb43d[_0x475a('0x14')]['message']);return _0x2712f4(_0x5cb43d[_0x475a('0x14')][_0x475a('0x16')]);}logger[_0x475a('0x14')]('DashboardItem,\x20%s,\x20%s',_0x393842,_0x5cb43d[_0x475a('0x14')][_0x475a('0x16')]);return _0x510ce1(_0x5cb43d[_0x475a('0x14')]['message']);}else{logger[_0x475a('0x10')](_0x475a('0x11'),_0x393842,_0x475a('0x12'));_0x510ce1(_0x5cb43d[_0x475a('0x17')][_0x475a('0x16')]);}})[_0x475a('0x18')](function(_0x2f4fca){logger[_0x475a('0x14')](_0x475a('0x11'),_0x393842,_0x2f4fca);_0x2712f4(_0x2f4fca);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c25b819..4e40cdd 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 _0x9b4a=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove','emit'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9b4a,0x16c));var _0xa9b4=function(_0x30446a,_0x90f8dd){_0x30446a=_0x30446a-0x0;var _0x5b6997=_0x9b4a[_0x30446a];return _0x5b6997;};'use strict';var DashboardItemEvents=require(_0xa9b4('0x0'));var events=[_0xa9b4('0x1'),_0xa9b4('0x2'),'update'];function createListener(_0xe2eda1,_0x28ec08){return function(_0x2bdbc9){_0x28ec08[_0xa9b4('0x3')](_0xe2eda1,_0x2bdbc9);};}function removeListener(_0xa84144,_0x1cf82d){return function(){DashboardItemEvents[_0xa9b4('0x4')](_0xa84144,_0x1cf82d);};}exports[_0xa9b4('0x5')]=function(_0x25f06f){for(var _0x277d90=0x0,_0xf6932f=events[_0xa9b4('0x6')];_0x277d90<_0xf6932f;_0x277d90++){var _0x5bade1=events[_0x277d90];var _0x4d8f0a=createListener(_0xa9b4('0x7')+_0x5bade1,_0x25f06f);DashboardItemEvents['on'](_0x5bade1,_0x4d8f0a);}}; \ No newline at end of file +var _0xcb24=['length','dashboardItem:','./dashboardItem.events','update','emit','removeListener','register'];(function(_0x58b250,_0x210a75){var _0x2ad6d6=function(_0xfbc855){while(--_0xfbc855){_0x58b250['push'](_0x58b250['shift']());}};_0x2ad6d6(++_0x210a75);}(_0xcb24,0x1d7));var _0x4cb2=function(_0x3dda87,_0x429176){_0x3dda87=_0x3dda87-0x0;var _0x3f7943=_0xcb24[_0x3dda87];return _0x3f7943;};'use strict';var DashboardItemEvents=require(_0x4cb2('0x0'));var events=['save','remove',_0x4cb2('0x1')];function createListener(_0x2f7984,_0x45305f){return function(_0x2d58d3){_0x45305f[_0x4cb2('0x2')](_0x2f7984,_0x2d58d3);};}function removeListener(_0x1c16da,_0x31f441){return function(){DashboardItemEvents[_0x4cb2('0x3')](_0x1c16da,_0x31f441);};}exports[_0x4cb2('0x4')]=function(_0x27c594){for(var _0x29e5b3=0x0,_0x2c72e7=events[_0x4cb2('0x5')];_0x29e5b3<_0x2c72e7;_0x29e5b3++){var _0x1b9ce=events[_0x29e5b3];var _0x48870f=createListener(_0x4cb2('0x6')+_0x1b9ce,_0x27c594);DashboardItemEvents['on'](_0x1b9ce,_0x48870f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 7a0927f..8cbb86d 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 _0x4819=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','create','put','/:id','delete','exports','util','path','connect-timeout'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x4819,0xcd));var _0x9481=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x4819[_0x4f431d];return _0x4f31e1;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/:id',auth[_0x9481('0xa')](),controller['show']);router['post']('/',auth[_0x9481('0xa')](),controller[_0x9481('0xb')]);router[_0x9481('0xc')](_0x9481('0xd'),auth[_0x9481('0xa')](),controller['update']);router[_0x9481('0xe')]('/:id',auth[_0x9481('0xa')](),controller['destroy']);module[_0x9481('0xf')]=router; \ No newline at end of file +var _0x3f8a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x23c991,_0x566312){_0x23c991=_0x23c991-0x0;var _0x323d32=_0x3f8a[_0x23c991];return _0x323d32;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xd')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 04ea1f8..c8f8cc2 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 _0x3f38=['second','third','STRING','exports','first'];(function(_0x5ba319,_0x2ff266){var _0x5ea103=function(_0x7e7296){while(--_0x7e7296){_0x5ba319['push'](_0x5ba319['shift']());}};_0x5ea103(++_0x2ff266);}(_0x3f38,0xd0));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x83f3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x83f3('0x1'),_0x83f3('0x2'),_0x83f3('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x83f3('0x4')]}}; \ No newline at end of file +var _0x74fa=['sequelize','exports','STRING','ENUM','first','second'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x74fa,0x144));var _0xa74f=function(_0x5a0684,_0x508cc7){_0x5a0684=_0x5a0684-0x0;var _0x137401=_0x74fa[_0x5a0684];return _0x137401;};'use strict';var Sequelize=require(_0xa74f('0x0'));module[_0xa74f('0x1')]={'name':{'type':Sequelize[_0xa74f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa74f('0x3')](_0xa74f('0x4'),_0xa74f('0x5'),'third'),'allowNull':![],'defaultValue':_0xa74f('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 76baa62..be6bd8e 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 _0x5ca3=['pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','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','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','update','destroy','then','get','Dispositions','error','name','index','map','Disposition','fieldName','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where'];(function(_0xdbaf7f,_0x2ffdf7){var _0x2b296b=function(_0x32d2e0){while(--_0x32d2e0){_0xdbaf7f['push'](_0xdbaf7f['shift']());}};_0x2b296b(++_0x2ffdf7);}(_0x5ca3,0xfd));var _0x35ca=function(_0x13a76c,_0x445e8e){_0x13a76c=_0x13a76c-0x0;var _0x4cbd9d=_0x5ca3[_0x13a76c];return _0x4cbd9d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x35ca('0x0'));var rimraf=require(_0x35ca('0x1'));var zipdir=require(_0x35ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35ca('0x3'));var moment=require(_0x35ca('0x4'));var BPromise=require(_0x35ca('0x5'));var Mustache=require(_0x35ca('0x6'));var util=require(_0x35ca('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x35ca('0x8'));var ejs=require(_0x35ca('0x9'));var fs=require('fs');var _=require(_0x35ca('0xa'));var squel=require(_0x35ca('0xb'));var crypto=require(_0x35ca('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x35ca('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x35ca('0xe'));var authService=require(_0x35ca('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ca('0x10'));var logger=require(_0x35ca('0x11'))(_0x35ca('0x12'));var utils=require(_0x35ca('0x13'));var config=require(_0x35ca('0x14'));var licenseUtil=require(_0x35ca('0x15'));var db=require(_0x35ca('0x16'))['db'];function respondWithStatusCode(_0x57431c,_0x273e03){_0x273e03=_0x273e03||0xcc;return function(_0x432ebb){if(_0x432ebb){return _0x57431c[_0x35ca('0x17')](_0x273e03);}return _0x57431c['status'](_0x273e03)[_0x35ca('0x18')]();};}function respondWithResult(_0xaf1919,_0x2ccfb0){_0x2ccfb0=_0x2ccfb0||0xc8;return function(_0x12ca6d){if(_0x12ca6d){return _0xaf1919[_0x35ca('0x19')](_0x2ccfb0)[_0x35ca('0x1a')](_0x12ca6d);}};}function respondWithFilteredResult(_0x51d31c,_0x2c7c4f){return function(_0xcc658e){if(_0xcc658e){var _0x1f54d3=_0xcc658e[_0x35ca('0x1b')],_0x75a3ad=_0x2c7c4f[_0x35ca('0x1c')],_0x2284ae=_0x2c7c4f[_0x35ca('0x1c')]+_0x2c7c4f[_0x35ca('0x1d')],_0x219f04;if(_0x2284ae>=_0x1f54d3){_0x2284ae=_0x1f54d3;_0x219f04=0xc8;}else{_0x219f04=0xce;}_0x51d31c[_0x35ca('0x19')](_0x219f04);return _0x51d31c['set']('Content-Range',_0x75a3ad+'-'+_0x2284ae+'/'+_0x1f54d3)['json'](_0xcc658e);}return null;};}function patchUpdates(_0x982552){return function(_0x13d0ff){try{jsonpatch[_0x35ca('0x1e')](_0x13d0ff,_0x982552,!![]);}catch(_0x33faec){return BPromise[_0x35ca('0x1f')](_0x33faec);}return _0x13d0ff['save']();};}function saveUpdates(_0xd230c7,_0x178072){return function(_0x1e3d62){if(_0x1e3d62){return _0x1e3d62[_0x35ca('0x20')](_0xd230c7)['then'](function(_0x3c9aca){return _0x3c9aca;});}return null;};}function removeEntity(_0x57cc79,_0x4b6843){return function(_0xb7a95a){if(_0xb7a95a){return _0xb7a95a[_0x35ca('0x21')]()[_0x35ca('0x22')](function(){var _0x1fd5d3=_0xb7a95a[_0x35ca('0x23')]({'plain':!![]});var _0x5aea9a=_0x35ca('0x24');return db['UserProfileResource'][_0x35ca('0x21')]({'where':{'type':_0x5aea9a,'resourceId':_0x1fd5d3['id']}})[_0x35ca('0x22')](function(){return _0xb7a95a;});})[_0x35ca('0x22')](function(){_0x57cc79[_0x35ca('0x19')](0xcc)[_0x35ca('0x18')]();});}};}function handleEntityNotFound(_0x27d5a1,_0x271aed){return function(_0xcfb8b4){if(!_0xcfb8b4){_0x27d5a1[_0x35ca('0x17')](0x194);}return _0xcfb8b4;};}function handleError(_0x482a8f,_0x65cb4d){_0x65cb4d=_0x65cb4d||0x1f4;return function(_0x25e192){logger[_0x35ca('0x25')](_0x25e192['stack']);if(_0x25e192[_0x35ca('0x26')]){delete _0x25e192[_0x35ca('0x26')];}_0x482a8f[_0x35ca('0x19')](_0x65cb4d)['send'](_0x25e192);};}exports[_0x35ca('0x27')]=function(_0x2f883d,_0x54aa92){var _0x1475a5={},_0x3868eb={},_0x42fa91={'count':0x0,'rows':[]};var _0x37037d=_[_0x35ca('0x28')](db[_0x35ca('0x29')]['rawAttributes'],function(_0x1cfd7b){return{'name':_0x1cfd7b[_0x35ca('0x2a')],'type':_0x1cfd7b['type'][_0x35ca('0x2b')]};});_0x3868eb[_0x35ca('0x2c')]=_[_0x35ca('0x28')](_0x37037d,_0x35ca('0x26'));_0x3868eb['query']=_[_0x35ca('0x2d')](_0x2f883d[_0x35ca('0x2e')]);_0x3868eb[_0x35ca('0x2f')]=_[_0x35ca('0x30')](_0x3868eb[_0x35ca('0x2c')],_0x3868eb[_0x35ca('0x2e')]);_0x1475a5['attributes']=_[_0x35ca('0x30')](_0x3868eb[_0x35ca('0x2c')],qs[_0x35ca('0x31')](_0x2f883d[_0x35ca('0x2e')][_0x35ca('0x31')]));_0x1475a5['attributes']=_0x1475a5['attributes']['length']?_0x1475a5[_0x35ca('0x32')]:_0x3868eb[_0x35ca('0x2c')];if(!_0x2f883d['query']['hasOwnProperty'](_0x35ca('0x33'))){_0x1475a5['limit']=qs[_0x35ca('0x1d')](_0x2f883d['query'][_0x35ca('0x1d')]);_0x1475a5[_0x35ca('0x1c')]=qs[_0x35ca('0x1c')](_0x2f883d[_0x35ca('0x2e')][_0x35ca('0x1c')]);}_0x1475a5[_0x35ca('0x34')]=qs['sort'](_0x2f883d[_0x35ca('0x2e')][_0x35ca('0x35')]);_0x1475a5[_0x35ca('0x36')]=qs[_0x35ca('0x2f')](_[_0x35ca('0x37')](_0x2f883d['query'],_0x3868eb[_0x35ca('0x2f')]),_0x37037d);if(_0x2f883d[_0x35ca('0x2e')]['filter']){_0x1475a5[_0x35ca('0x36')]=_[_0x35ca('0x38')](_0x1475a5[_0x35ca('0x36')],{'$or':_[_0x35ca('0x28')](_0x37037d,function(_0x769df){if(_0x769df[_0x35ca('0x39')]!==_0x35ca('0x3a')){var _0x65c30b={};_0x65c30b[_0x769df[_0x35ca('0x26')]]={'$like':'%'+_0x2f883d[_0x35ca('0x2e')]['filter']+'%'};return _0x65c30b;}})});}_0x1475a5=_['merge']({},_0x1475a5,_0x2f883d[_0x35ca('0x3b')]);var _0x2a1f29={'where':_0x1475a5[_0x35ca('0x36')]};return db[_0x35ca('0x29')][_0x35ca('0x1b')](_0x2a1f29)[_0x35ca('0x22')](function(_0x3f5772){_0x42fa91[_0x35ca('0x1b')]=_0x3f5772;if(_0x2f883d['query'][_0x35ca('0x3c')]){_0x1475a5[_0x35ca('0x3d')]=[{'all':!![]}];}return db[_0x35ca('0x29')]['findAll'](_0x1475a5);})[_0x35ca('0x22')](function(_0x52a5a3){_0x42fa91[_0x35ca('0x3e')]=_0x52a5a3;return _0x42fa91;})['then'](respondWithFilteredResult(_0x54aa92,_0x1475a5))[_0x35ca('0x3f')](handleError(_0x54aa92,null));};exports[_0x35ca('0x40')]=function(_0x5624e8,_0x304521){var _0x2e706b={'raw':!![],'where':{'id':_0x5624e8['params']['id']}},_0x4f9d30={};_0x4f9d30[_0x35ca('0x2c')]=_[_0x35ca('0x2d')](db['Disposition'][_0x35ca('0x41')]);_0x4f9d30['query']=_[_0x35ca('0x2d')](_0x5624e8[_0x35ca('0x2e')]);_0x4f9d30[_0x35ca('0x2f')]=_[_0x35ca('0x30')](_0x4f9d30[_0x35ca('0x2c')],_0x4f9d30[_0x35ca('0x2e')]);_0x2e706b[_0x35ca('0x32')]=_[_0x35ca('0x30')](_0x4f9d30[_0x35ca('0x2c')],qs[_0x35ca('0x31')](_0x5624e8[_0x35ca('0x2e')][_0x35ca('0x31')]));_0x2e706b[_0x35ca('0x32')]=_0x2e706b[_0x35ca('0x32')]['length']?_0x2e706b[_0x35ca('0x32')]:_0x4f9d30[_0x35ca('0x2c')];if(_0x5624e8[_0x35ca('0x2e')][_0x35ca('0x3c')]){_0x2e706b['include']=[{'all':!![]}];}_0x2e706b=_[_0x35ca('0x38')]({},_0x2e706b,_0x5624e8[_0x35ca('0x3b')]);return db[_0x35ca('0x29')][_0x35ca('0x42')](_0x2e706b)['then'](handleEntityNotFound(_0x304521,null))[_0x35ca('0x22')](respondWithResult(_0x304521,null))[_0x35ca('0x3f')](handleError(_0x304521,null));};exports[_0x35ca('0x43')]=function(_0x56443f,_0x5548b5){return db[_0x35ca('0x29')][_0x35ca('0x43')](_0x56443f['body'],{})[_0x35ca('0x22')](function(_0x237270){var _0x3e151a=_0x56443f[_0x35ca('0x44')][_0x35ca('0x23')]({'plain':!![]});if(!_0x3e151a)throw new Error(_0x35ca('0x45'));if(_0x3e151a[_0x35ca('0x46')]==='user'){var _0x4c95d7=_0x237270[_0x35ca('0x23')]({'plain':!![]});var _0x39c636='Dispositions';return db[_0x35ca('0x47')]['find']({'where':{'name':_0x39c636,'userProfileId':_0x3e151a[_0x35ca('0x48')]},'raw':!![]})[_0x35ca('0x22')](function(_0x4f9bec){if(_0x4f9bec&&_0x4f9bec[_0x35ca('0x49')]===0x0){return db['UserProfileResource'][_0x35ca('0x43')]({'name':_0x4c95d7[_0x35ca('0x26')],'resourceId':_0x4c95d7['id'],'type':_0x4f9bec[_0x35ca('0x26')],'sectionId':_0x4f9bec['id']},{})[_0x35ca('0x22')](function(){return _0x237270;});}else{return _0x237270;}})['catch'](function(_0x36c22c){logger[_0x35ca('0x25')](_0x35ca('0x4a'),_0x36c22c);throw _0x36c22c;});}return _0x237270;})[_0x35ca('0x22')](respondWithResult(_0x5548b5,0xc9))[_0x35ca('0x3f')](handleError(_0x5548b5,null));};exports['update']=function(_0x360ef5,_0xe97cd4){if(_0x360ef5[_0x35ca('0x4b')]['id']){delete _0x360ef5[_0x35ca('0x4b')]['id'];}return db[_0x35ca('0x29')][_0x35ca('0x42')]({'where':{'id':_0x360ef5[_0x35ca('0x4c')]['id']}})[_0x35ca('0x22')](handleEntityNotFound(_0xe97cd4,null))[_0x35ca('0x22')](saveUpdates(_0x360ef5[_0x35ca('0x4b')],null))['then'](respondWithResult(_0xe97cd4,null))[_0x35ca('0x3f')](handleError(_0xe97cd4,null));};exports[_0x35ca('0x21')]=function(_0xacd5f2,_0x20f70f){return db[_0x35ca('0x29')][_0x35ca('0x42')]({'where':{'id':_0xacd5f2[_0x35ca('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20f70f,null))['then'](removeEntity(_0x20f70f,null))[_0x35ca('0x3f')](handleError(_0x20f70f,null));}; \ No newline at end of file +var _0xa37b=['save','update','destroy','get','Dispositions','then','stack','name','send','index','map','Disposition','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x552ddf,_0x487904){var _0xca8380=function(_0x756195){while(--_0x756195){_0x552ddf['push'](_0x552ddf['shift']());}};_0xca8380(++_0x487904);}(_0xa37b,0x11d));var _0xba37=function(_0x94969,_0x1bd2f0){_0x94969=_0x94969-0x0;var _0x550191=_0xa37b[_0x94969];return _0x550191;};'use strict';var pdf=require(_0xba37('0x0'));var emlformat=require(_0xba37('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xba37('0x2'));var jsonpatch=require(_0xba37('0x3'));var rp=require(_0xba37('0x4'));var moment=require(_0xba37('0x5'));var BPromise=require(_0xba37('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xba37('0x7'));var csv=require(_0xba37('0x8'));var ejs=require(_0xba37('0x9'));var fs=require('fs');var _=require(_0xba37('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba37('0xb'));var deskjs=require(_0xba37('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba37('0xd'));var Redis=require(_0xba37('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xba37('0xf'));var as=require(_0xba37('0x10'));var hardwareService=require(_0xba37('0x11'));var logger=require('../../config/logger')(_0xba37('0x12'));var utils=require(_0xba37('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xba37('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x146728,_0x4f911c){_0x4f911c=_0x4f911c||0xcc;return function(_0x2b14f3){if(_0x2b14f3){return _0x146728[_0xba37('0x15')](_0x4f911c);}return _0x146728[_0xba37('0x16')](_0x4f911c)[_0xba37('0x17')]();};}function respondWithResult(_0x139a48,_0x17b061){_0x17b061=_0x17b061||0xc8;return function(_0x934d7b){if(_0x934d7b){return _0x139a48[_0xba37('0x16')](_0x17b061)[_0xba37('0x18')](_0x934d7b);}};}function respondWithFilteredResult(_0x3f7d3c,_0x27780b){return function(_0x4ce02e){if(_0x4ce02e){var _0x4b936b=_0x4ce02e[_0xba37('0x19')],_0x17d31e=_0x27780b['offset'],_0x4fcc31=_0x27780b[_0xba37('0x1a')]+_0x27780b[_0xba37('0x1b')],_0x110f57;if(_0x4fcc31>=_0x4b936b){_0x4fcc31=_0x4b936b;_0x110f57=0xc8;}else{_0x110f57=0xce;}_0x3f7d3c[_0xba37('0x16')](_0x110f57);return _0x3f7d3c['set'](_0xba37('0x1c'),_0x17d31e+'-'+_0x4fcc31+'/'+_0x4b936b)[_0xba37('0x18')](_0x4ce02e);}return null;};}function patchUpdates(_0x34bda9){return function(_0x51465d){try{jsonpatch[_0xba37('0x1d')](_0x51465d,_0x34bda9,!![]);}catch(_0x1e6585){return BPromise[_0xba37('0x1e')](_0x1e6585);}return _0x51465d[_0xba37('0x1f')]();};}function saveUpdates(_0x227b5a,_0x2155e5){return function(_0x2e3649){if(_0x2e3649){return _0x2e3649[_0xba37('0x20')](_0x227b5a)['then'](function(_0x53fb66){return _0x53fb66;});}return null;};}function removeEntity(_0xa9f1e3,_0x21aabf){return function(_0x4a4fd8){if(_0x4a4fd8){return _0x4a4fd8[_0xba37('0x21')]()['then'](function(){var _0x591d8f=_0x4a4fd8[_0xba37('0x22')]({'plain':!![]});var _0x2aa547=_0xba37('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2aa547,'resourceId':_0x591d8f['id']}})[_0xba37('0x24')](function(){return _0x4a4fd8;});})[_0xba37('0x24')](function(){_0xa9f1e3[_0xba37('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23aac6,_0x2a342c){return function(_0x5b17b9){if(!_0x5b17b9){_0x23aac6['sendStatus'](0x194);}return _0x5b17b9;};}function handleError(_0x2ea0bf,_0x492b4b){_0x492b4b=_0x492b4b||0x1f4;return function(_0x37ad52){logger['error'](_0x37ad52[_0xba37('0x25')]);if(_0x37ad52[_0xba37('0x26')]){delete _0x37ad52[_0xba37('0x26')];}_0x2ea0bf[_0xba37('0x16')](_0x492b4b)[_0xba37('0x27')](_0x37ad52);};}exports[_0xba37('0x28')]=function(_0x14b89a,_0x569a8a){var _0x385467={},_0x25626e={},_0x5970dd={'count':0x0,'rows':[]};var _0x4116bd=_[_0xba37('0x29')](db[_0xba37('0x2a')]['rawAttributes'],function(_0x1e19e3){return{'name':_0x1e19e3['fieldName'],'type':_0x1e19e3[_0xba37('0x2b')][_0xba37('0x2c')]};});_0x25626e[_0xba37('0x2d')]=_[_0xba37('0x29')](_0x4116bd,_0xba37('0x26'));_0x25626e[_0xba37('0x2e')]=_[_0xba37('0x2f')](_0x14b89a[_0xba37('0x2e')]);_0x25626e[_0xba37('0x30')]=_['intersection'](_0x25626e[_0xba37('0x2d')],_0x25626e['query']);_0x385467[_0xba37('0x31')]=_[_0xba37('0x32')](_0x25626e[_0xba37('0x2d')],qs['fields'](_0x14b89a[_0xba37('0x2e')][_0xba37('0x33')]));_0x385467[_0xba37('0x31')]=_0x385467['attributes'][_0xba37('0x34')]?_0x385467[_0xba37('0x31')]:_0x25626e[_0xba37('0x2d')];if(!_0x14b89a['query'][_0xba37('0x35')]('nolimit')){_0x385467[_0xba37('0x1b')]=qs[_0xba37('0x1b')](_0x14b89a[_0xba37('0x2e')][_0xba37('0x1b')]);_0x385467[_0xba37('0x1a')]=qs[_0xba37('0x1a')](_0x14b89a['query'][_0xba37('0x1a')]);}_0x385467[_0xba37('0x36')]=qs[_0xba37('0x37')](_0x14b89a[_0xba37('0x2e')][_0xba37('0x37')]);_0x385467[_0xba37('0x38')]=qs[_0xba37('0x30')](_[_0xba37('0x39')](_0x14b89a[_0xba37('0x2e')],_0x25626e[_0xba37('0x30')]),_0x4116bd);if(_0x14b89a['query'][_0xba37('0x3a')]){_0x385467['where']=_[_0xba37('0x3b')](_0x385467[_0xba37('0x38')],{'$or':_[_0xba37('0x29')](_0x4116bd,function(_0x2a39c3){if(_0x2a39c3[_0xba37('0x2b')]!==_0xba37('0x3c')){var _0x282ea4={};_0x282ea4[_0x2a39c3['name']]={'$like':'%'+_0x14b89a['query'][_0xba37('0x3a')]+'%'};return _0x282ea4;}})});}_0x385467=_[_0xba37('0x3b')]({},_0x385467,_0x14b89a[_0xba37('0x3d')]);var _0x38c61c={'where':_0x385467[_0xba37('0x38')]};return db[_0xba37('0x2a')][_0xba37('0x19')](_0x38c61c)[_0xba37('0x24')](function(_0x17dfe3){_0x5970dd[_0xba37('0x19')]=_0x17dfe3;if(_0x14b89a[_0xba37('0x2e')][_0xba37('0x3e')]){_0x385467[_0xba37('0x3f')]=[{'all':!![]}];}return db[_0xba37('0x2a')][_0xba37('0x40')](_0x385467);})[_0xba37('0x24')](function(_0xa210e5){_0x5970dd['rows']=_0xa210e5;return _0x5970dd;})[_0xba37('0x24')](respondWithFilteredResult(_0x569a8a,_0x385467))['catch'](handleError(_0x569a8a,null));};exports[_0xba37('0x41')]=function(_0x48e975,_0x2fa880){var _0x513214={'raw':!![],'where':{'id':_0x48e975[_0xba37('0x42')]['id']}},_0x33cd4a={};_0x33cd4a[_0xba37('0x2d')]=_[_0xba37('0x2f')](db[_0xba37('0x2a')][_0xba37('0x43')]);_0x33cd4a[_0xba37('0x2e')]=_['keys'](_0x48e975[_0xba37('0x2e')]);_0x33cd4a[_0xba37('0x30')]=_[_0xba37('0x32')](_0x33cd4a[_0xba37('0x2d')],_0x33cd4a[_0xba37('0x2e')]);_0x513214[_0xba37('0x31')]=_[_0xba37('0x32')](_0x33cd4a['model'],qs[_0xba37('0x33')](_0x48e975[_0xba37('0x2e')][_0xba37('0x33')]));_0x513214[_0xba37('0x31')]=_0x513214['attributes'][_0xba37('0x34')]?_0x513214['attributes']:_0x33cd4a[_0xba37('0x2d')];if(_0x48e975['query'][_0xba37('0x3e')]){_0x513214[_0xba37('0x3f')]=[{'all':!![]}];}_0x513214=_[_0xba37('0x3b')]({},_0x513214,_0x48e975[_0xba37('0x3d')]);return db[_0xba37('0x2a')][_0xba37('0x44')](_0x513214)['then'](handleEntityNotFound(_0x2fa880,null))[_0xba37('0x24')](respondWithResult(_0x2fa880,null))[_0xba37('0x45')](handleError(_0x2fa880,null));};exports[_0xba37('0x46')]=function(_0x3b0f0a,_0x6cae2a){return db[_0xba37('0x2a')][_0xba37('0x46')](_0x3b0f0a[_0xba37('0x47')],{})[_0xba37('0x24')](function(_0x400f99){var _0x1eb1ce=_0x3b0f0a[_0xba37('0x48')]['get']({'plain':!![]});if(!_0x1eb1ce)throw new Error(_0xba37('0x49'));if(_0x1eb1ce['role']===_0xba37('0x48')){var _0x1f01cd=_0x400f99[_0xba37('0x22')]({'plain':!![]});var _0x57584c='Dispositions';return db[_0xba37('0x4a')][_0xba37('0x44')]({'where':{'name':_0x57584c,'userProfileId':_0x1eb1ce[_0xba37('0x4b')]},'raw':!![]})[_0xba37('0x24')](function(_0x1fd9e6){if(_0x1fd9e6&&_0x1fd9e6[_0xba37('0x4c')]===0x0){return db[_0xba37('0x4d')][_0xba37('0x46')]({'name':_0x1f01cd[_0xba37('0x26')],'resourceId':_0x1f01cd['id'],'type':_0x1fd9e6[_0xba37('0x26')],'sectionId':_0x1fd9e6['id']},{})['then'](function(){return _0x400f99;});}else{return _0x400f99;}})[_0xba37('0x45')](function(_0x4f7270){logger[_0xba37('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f7270);throw _0x4f7270;});}return _0x400f99;})[_0xba37('0x24')](respondWithResult(_0x6cae2a,0xc9))[_0xba37('0x45')](handleError(_0x6cae2a,null));};exports[_0xba37('0x20')]=function(_0x19bfb7,_0x4dccd3){if(_0x19bfb7[_0xba37('0x47')]['id']){delete _0x19bfb7[_0xba37('0x47')]['id'];}return db[_0xba37('0x2a')][_0xba37('0x44')]({'where':{'id':_0x19bfb7['params']['id']}})[_0xba37('0x24')](handleEntityNotFound(_0x4dccd3,null))['then'](saveUpdates(_0x19bfb7[_0xba37('0x47')],null))[_0xba37('0x24')](respondWithResult(_0x4dccd3,null))[_0xba37('0x45')](handleError(_0x4dccd3,null));};exports[_0xba37('0x21')]=function(_0x4c258f,_0x4ddb8f){return db['Disposition']['find']({'where':{'id':_0x4c258f[_0xba37('0x42')]['id']}})[_0xba37('0x24')](handleEntityNotFound(_0x4ddb8f,null))[_0xba37('0x24')](removeEntity(_0x4ddb8f,null))[_0xba37('0x45')](handleError(_0x4ddb8f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2912a2e..4cabbf0 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 _0xa786=['moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','api'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xa786,0x1d2));var _0x6a78=function(_0x450122,_0x59d676){_0x450122=_0x450122-0x0;var _0x39ba95=_0xa786[_0x450122];return _0x39ba95;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a78('0x0'))(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require(_0x6a78('0x3'));var rp=require(_0x6a78('0x4'));var fs=require('fs');var path=require(_0x6a78('0x5'));var rimraf=require(_0x6a78('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a78('0x7'));module[_0x6a78('0x8')]=function(_0xc0be8b,_0x45470e){return _0xc0be8b[_0x6a78('0x9')](_0x6a78('0xa'),attributes,{'tableName':_0x6a78('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6a78('0xc'),'fields':[_0x6a78('0xd'),_0x6a78('0xe')]},{'unique':!![],'name':_0x6a78('0xf'),'fields':[_0x6a78('0xd'),_0x6a78('0x10')]},{'unique':!![],'name':_0x6a78('0x11'),'fields':[_0x6a78('0xd'),_0x6a78('0x12')]},{'unique':!![],'name':_0x6a78('0x13'),'fields':[_0x6a78('0xd'),_0x6a78('0x14')]},{'unique':!![],'name':'name_fax','fields':['name',_0x6a78('0x15')]},{'unique':!![],'name':_0x6a78('0x16'),'fields':['name',_0x6a78('0x17')]},{'unique':!![],'name':_0x6a78('0x18'),'fields':[_0x6a78('0xd'),_0x6a78('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xecb2=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','api','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0xecb2,0xf6));var _0x2ecb=function(_0x55b4df,_0x5b6de8){_0x55b4df=_0x55b4df-0x0;var _0x56dbcd=_0xecb2[_0x55b4df];return _0x56dbcd;};'use strict';var _=require(_0x2ecb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ecb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ecb('0x2'));var fs=require('fs');var path=require(_0x2ecb('0x3'));var rimraf=require(_0x2ecb('0x4'));var config=require(_0x2ecb('0x5'));var attributes=require(_0x2ecb('0x6'));module[_0x2ecb('0x7')]=function(_0x4c169f,_0x51b28c){return _0x4c169f['define'](_0x2ecb('0x8'),attributes,{'tableName':_0x2ecb('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2ecb('0xa'),'fields':[_0x2ecb('0xb'),_0x2ecb('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x2ecb('0xb'),_0x2ecb('0xd')]},{'unique':!![],'name':_0x2ecb('0xe'),'fields':['name',_0x2ecb('0xf')]},{'unique':!![],'name':_0x2ecb('0x10'),'fields':[_0x2ecb('0xb'),_0x2ecb('0x11')]},{'unique':!![],'name':_0x2ecb('0x12'),'fields':['name',_0x2ecb('0x13')]},{'unique':!![],'name':_0x2ecb('0x14'),'fields':[_0x2ecb('0xb'),_0x2ecb('0x15')]},{'unique':!![],'name':_0x2ecb('0x16'),'fields':[_0x2ecb('0xb'),_0x2ecb('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4af1d0f..fc756f4 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 _0x7582=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x99f7d8,_0x371819){var _0x1f028a=function(_0x21e990){while(--_0x21e990){_0x99f7d8['push'](_0x99f7d8['shift']());}};_0x1f028a(++_0x371819);}(_0x7582,0x7f));var _0x2758=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x7582[_0x60df74];return _0x5ee872;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2758('0x0'));var BPromise=require(_0x2758('0x1'));var rs=require(_0x2758('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2758('0x3'))['db'];var utils=require(_0x2758('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2758('0x5'));var jayson=require(_0x2758('0x6'));var client=jayson[_0x2758('0x7')][_0x2758('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ec82f,_0x342690,_0x23d54d){return new BPromise(function(_0x37b28f,_0x186d11){return client[_0x2758('0x9')](_0x3ec82f,_0x23d54d)[_0x2758('0xa')](function(_0x323f4f){logger[_0x2758('0xb')](_0x2758('0xc'),_0x342690,'request\x20sent');logger[_0x2758('0xd')]('Disposition,\x20%s,\x20%s,\x20%s',_0x342690,_0x2758('0xe'),JSON[_0x2758('0xf')](_0x323f4f));if(_0x323f4f[_0x2758('0x10')]){if(_0x323f4f[_0x2758('0x10')][_0x2758('0x11')]===0x1f4){logger[_0x2758('0x10')](_0x2758('0xc'),_0x342690,_0x323f4f['error'][_0x2758('0x12')]);return _0x186d11(_0x323f4f[_0x2758('0x10')]['message']);}logger[_0x2758('0x10')](_0x2758('0xc'),_0x342690,_0x323f4f[_0x2758('0x10')][_0x2758('0x12')]);return _0x37b28f(_0x323f4f[_0x2758('0x10')][_0x2758('0x12')]);}else{logger[_0x2758('0xb')](_0x2758('0xc'),_0x342690,'request\x20sent');_0x37b28f(_0x323f4f[_0x2758('0x13')]['message']);}})[_0x2758('0x14')](function(_0x48a6a3){logger[_0x2758('0x10')](_0x2758('0xc'),_0x342690,_0x48a6a3);_0x186d11(_0x48a6a3);});});} \ No newline at end of file +var _0xead2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x10702d,_0x329cf3){var _0x3587d7=function(_0x4394c8){while(--_0x4394c8){_0x10702d['push'](_0x10702d['shift']());}};_0x3587d7(++_0x329cf3);}(_0xead2,0x192));var _0x2ead=function(_0x5abb28,_0x2b3765){_0x5abb28=_0x5abb28-0x0;var _0x15b205=_0xead2[_0x5abb28];return _0x15b205;};'use strict';var _=require(_0x2ead('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ead('0x1'));var rs=require(_0x2ead('0x2'));var fs=require('fs');var Redis=require(_0x2ead('0x3'));var db=require(_0x2ead('0x4'))['db'];var utils=require(_0x2ead('0x5'));var logger=require(_0x2ead('0x6'))(_0x2ead('0x7'));var config=require(_0x2ead('0x8'));var jayson=require(_0x2ead('0x9'));var client=jayson[_0x2ead('0xa')][_0x2ead('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13e327,_0x742e67,_0x9c302a){return new BPromise(function(_0x589549,_0x146fed){return client['request'](_0x13e327,_0x9c302a)[_0x2ead('0xc')](function(_0x3f5cbb){logger[_0x2ead('0xd')](_0x2ead('0xe'),_0x742e67,_0x2ead('0xf'));logger[_0x2ead('0x10')](_0x2ead('0x11'),_0x742e67,'request\x20sent',JSON[_0x2ead('0x12')](_0x3f5cbb));if(_0x3f5cbb[_0x2ead('0x13')]){if(_0x3f5cbb[_0x2ead('0x13')][_0x2ead('0x14')]===0x1f4){logger[_0x2ead('0x13')]('Disposition,\x20%s,\x20%s',_0x742e67,_0x3f5cbb[_0x2ead('0x13')]['message']);return _0x146fed(_0x3f5cbb[_0x2ead('0x13')]['message']);}logger[_0x2ead('0x13')](_0x2ead('0xe'),_0x742e67,_0x3f5cbb['error'][_0x2ead('0x15')]);return _0x589549(_0x3f5cbb[_0x2ead('0x13')][_0x2ead('0x15')]);}else{logger[_0x2ead('0xd')](_0x2ead('0xe'),_0x742e67,_0x2ead('0xf'));_0x589549(_0x3f5cbb[_0x2ead('0x16')][_0x2ead('0x15')]);}})[_0x2ead('0x17')](function(_0x3cb6eb){logger[_0x2ead('0x13')](_0x2ead('0xe'),_0x742e67,_0x3cb6eb);_0x146fed(_0x3cb6eb);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fe0dff6..9b8250d 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 _0x58dc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5d4375,_0x5945bd){var _0x36f5d9=function(_0x58304c){while(--_0x58304c){_0x5d4375['push'](_0x5d4375['shift']());}};_0x36f5d9(++_0x5945bd);}(_0x58dc,0x6d));var _0xc58d=function(_0x495a37,_0xe2afb2){_0x495a37=_0x495a37-0x0;var _0x1d1b72=_0x58dc[_0x495a37];return _0x1d1b72;};'use strict';var multer=require(_0xc58d('0x0'));var util=require(_0xc58d('0x1'));var path=require(_0xc58d('0x2'));var timeout=require(_0xc58d('0x3'));var express=require(_0xc58d('0x4'));var router=express[_0xc58d('0x5')]();var auth=require(_0xc58d('0x6'));var interaction=require(_0xc58d('0x7'));var config=require(_0xc58d('0x8'));var controller=require(_0xc58d('0x9'));router['get']('/',auth[_0xc58d('0xa')](),controller[_0xc58d('0xb')]);router['get'](_0xc58d('0xc'),auth[_0xc58d('0xa')](),controller['show']);router[_0xc58d('0xd')]('/',auth[_0xc58d('0xa')](),controller[_0xc58d('0xe')]);router[_0xc58d('0xf')]('/:id',auth[_0xc58d('0xa')](),controller['update']);router[_0xc58d('0x10')](_0xc58d('0xc'),auth[_0xc58d('0xa')](),controller[_0xc58d('0x11')]);module[_0xc58d('0x12')]=router; \ No newline at end of file +var _0x2157=['post','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3e5595,_0xbe4275){var _0x3fd3a6=function(_0x43874c){while(--_0x43874c){_0x3e5595['push'](_0x3e5595['shift']());}};_0x3fd3a6(++_0xbe4275);}(_0x2157,0x192));var _0x7215=function(_0x29ca40,_0x8513d){_0x29ca40=_0x29ca40-0x0;var _0x12fc62=_0x2157[_0x29ca40];return _0x12fc62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7215('0x0'));var timeout=require(_0x7215('0x1'));var express=require('express');var router=express[_0x7215('0x2')]();var auth=require(_0x7215('0x3'));var interaction=require(_0x7215('0x4'));var config=require(_0x7215('0x5'));var controller=require(_0x7215('0x6'));router[_0x7215('0x7')]('/',auth[_0x7215('0x8')](),controller[_0x7215('0x9')]);router[_0x7215('0x7')](_0x7215('0xa'),auth[_0x7215('0x8')](),controller[_0x7215('0xb')]);router[_0x7215('0xc')]('/',auth[_0x7215('0x8')](),controller['create']);router[_0x7215('0xd')](_0x7215('0xa'),auth[_0x7215('0x8')](),controller[_0x7215('0xe')]);router[_0x7215('0xf')]('/:id',auth[_0x7215('0x8')](),controller[_0x7215('0x10')]);module[_0x7215('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a0af77a..dd3fb39 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 _0x1868=['yes','localstationid','ENUM','4800','7200','9600','12000','2400','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','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','mandatoryDisposition','sequelize','STRING'];(function(_0x155c6e,_0xfa3a1){var _0x2ffa93=function(_0x2cb571){while(--_0x2cb571){_0x155c6e['push'](_0x155c6e['shift']());}};_0x2ffa93(++_0xfa3a1);}(_0x1868,0x166));var _0x8186=function(_0x7441bd,_0x179387){_0x7441bd=_0x7441bd-0x0;var _0x44d283=_0x1868[_0x7441bd];return _0x44d283;};'use strict';var Sequelize=require(_0x8186('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8186('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x8186('0x2')},'headerinfo':{'type':Sequelize[_0x8186('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x8186('0x1')],'unique':_0x8186('0x3')},'minrate':{'type':Sequelize[_0x8186('0x4')]('2400',_0x8186('0x5'),_0x8186('0x6'),_0x8186('0x7'),_0x8186('0x8'),'14400'),'defaultValue':_0x8186('0x5')},'maxrate':{'type':Sequelize[_0x8186('0x4')](_0x8186('0x9'),_0x8186('0x5'),_0x8186('0x6'),_0x8186('0x7'),_0x8186('0x8'),_0x8186('0xa')),'defaultValue':_0x8186('0xa')},'modem':{'type':Sequelize[_0x8186('0x1')],'defaultValue':_0x8186('0xb')},'gateway':{'type':Sequelize[_0x8186('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8186('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8186('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x8186('0xd'),_0x8186('0xe'),_0x8186('0xf')),'defaultValue':_0x8186('0x10')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8186('0x11')],'defaultValue':function(){return _0x8186('0x12');}},'notificationSound':{'type':Sequelize[_0x8186('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8186('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8186('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8186('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8186('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8186('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8186('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x8186('0x13')],'defaultValue':![],'comment':_0x8186('0x15'),'set':function(_0xb318b1){if(!_0xb318b1)this[_0x8186('0x16')]('mandatoryDispositionPauseId',null);this[_0x8186('0x16')](_0x8186('0x17'),_0xb318b1);}}}; \ No newline at end of file +var _0x341d=['v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000'];(function(_0x3e4319,_0x1a9338){var _0x255273=function(_0x446fe9){while(--_0x446fe9){_0x3e4319['push'](_0x3e4319['shift']());}};_0x255273(++_0x1a9338);}(_0x341d,0x9c));var _0xd341=function(_0x5c2bbc,_0x11d343){_0x5c2bbc=_0x5c2bbc-0x0;var _0x1b976b=_0x341d[_0x5c2bbc];return _0x1b976b;};'use strict';var Sequelize=require(_0xd341('0x0'));module['exports']={'name':{'type':Sequelize[_0xd341('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xd341('0x2')](_0xd341('0x3'),'no'),'defaultValue':_0xd341('0x3')},'headerinfo':{'type':Sequelize[_0xd341('0x1')],'defaultValue':_0xd341('0x4')},'localstationid':{'type':Sequelize[_0xd341('0x1')],'unique':_0xd341('0x5')},'minrate':{'type':Sequelize[_0xd341('0x2')](_0xd341('0x6'),_0xd341('0x7'),_0xd341('0x8'),_0xd341('0x9'),'12000',_0xd341('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xd341('0x2')](_0xd341('0x6'),_0xd341('0x7'),_0xd341('0x8'),_0xd341('0x9'),_0xd341('0xb'),_0xd341('0xa')),'defaultValue':_0xd341('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xd341('0xc')},'gateway':{'type':Sequelize['STRING'],'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[_0xd341('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd341('0x2')](_0xd341('0xe'),_0xd341('0xf'),_0xd341('0x10'),_0xd341('0x11')),'defaultValue':_0xd341('0xe')},'key':{'type':Sequelize[_0xd341('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd341('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd341('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd341('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd341('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd341('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd341('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd341('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd341('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xd341('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xd341('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c3604){if(!_0x3c3604)this['setDataValue'](_0xd341('0x15'),null);this[_0xd341('0x16')](_0xd341('0x17'),_0x3c3604);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ba3685a..842613a 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 _0x56e6=['include','options','FaxAccount','create','body','user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','push','Answer','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','key','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','info','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','show','params','mandatoryDispositionPause','includeAll'];(function(_0x5d3fd0,_0x1454d3){var _0x4cac34=function(_0x339de6){while(--_0x339de6){_0x5d3fd0['push'](_0x5d3fd0['shift']());}};_0x4cac34(++_0x1454d3);}(_0x56e6,0x6b));var _0x656e=function(_0x43309d,_0x33d13f){_0x43309d=_0x43309d-0x0;var _0xe175da=_0x56e6[_0x43309d];return _0xe175da;};'use strict';var pdf=require(_0x656e('0x0'));var emlformat=require(_0x656e('0x1'));var rimraf=require(_0x656e('0x2'));var zipdir=require(_0x656e('0x3'));var jsonpatch=require(_0x656e('0x4'));var rp=require(_0x656e('0x5'));var moment=require('moment');var BPromise=require(_0x656e('0x6'));var Mustache=require(_0x656e('0x7'));var util=require(_0x656e('0x8'));var path=require(_0x656e('0x9'));var sox=require(_0x656e('0xa'));var csv=require(_0x656e('0xb'));var ejs=require(_0x656e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x656e('0xd'));var crypto=require(_0x656e('0xe'));var jsforce=require(_0x656e('0xf'));var deskjs=require(_0x656e('0x10'));var toCsv=require(_0x656e('0xb'));var querystring=require(_0x656e('0x11'));var Papa=require(_0x656e('0x12'));var Redis=require(_0x656e('0x13'));var authService=require(_0x656e('0x14'));var qs=require(_0x656e('0x15'));var as=require(_0x656e('0x16'));var hardwareService=require(_0x656e('0x17'));var logger=require(_0x656e('0x18'))(_0x656e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x656e('0x1a'));var db=require(_0x656e('0x1b'))['db'];config[_0x656e('0x1c')]=_[_0x656e('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x656e('0x1e'))(new Redis(config[_0x656e('0x1c')]));require('./faxAccount.socket')[_0x656e('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x656e('0x20')][_0x656e('0x21')]({'port':0x232c});var client9002=jayson[_0x656e('0x20')][_0x656e('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5a1fc3,_0x3ab51b,_0x38e2e3,_0x3e4d1e){return new BPromise(function(_0x3a6cf8,_0xe33e65){var _0x4fd12e=_0x3e4d1e||client;return _0x4fd12e['request'](_0x5a1fc3,_0x38e2e3)['then'](function(_0x4318d1){logger[_0x656e('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3ab51b,_0x656e('0x23'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3ab51b,'request\x20sent',JSON[_0x656e('0x24')](_0x4318d1));if(_0x4318d1[_0x656e('0x25')]){if(_0x4318d1[_0x656e('0x25')][_0x656e('0x26')]===0x1f4){logger['error'](_0x656e('0x27'),_0x3ab51b,_0x4318d1[_0x656e('0x25')][_0x656e('0x28')]);return _0xe33e65(_0x4318d1['error'][_0x656e('0x28')]);}logger[_0x656e('0x25')](_0x656e('0x27'),_0x3ab51b,_0x4318d1[_0x656e('0x25')][_0x656e('0x28')]);return _0x3a6cf8(_0x4318d1[_0x656e('0x25')][_0x656e('0x28')]);}else{logger['info'](_0x656e('0x27'),_0x3ab51b,_0x656e('0x23'));_0x3a6cf8(_0x4318d1['result']['message']);}})[_0x656e('0x29')](function(_0x517021){logger[_0x656e('0x25')]('FaxAccount,\x20%s,\x20%s',_0x3ab51b,_0x517021);_0xe33e65(_0x517021);});});}function respondWithStatusCode(_0x57ab26,_0xa834a5){_0xa834a5=_0xa834a5||0xcc;return function(_0x4e2a80){if(_0x4e2a80){return _0x57ab26[_0x656e('0x2a')](_0xa834a5);}return _0x57ab26[_0x656e('0x2b')](_0xa834a5)[_0x656e('0x2c')]();};}function respondWithResult(_0x514272,_0x4cb7ca){_0x4cb7ca=_0x4cb7ca||0xc8;return function(_0x382567){if(_0x382567){return _0x514272[_0x656e('0x2b')](_0x4cb7ca)[_0x656e('0x2d')](_0x382567);}};}function respondWithFilteredResult(_0x469acf,_0xc2a01){return function(_0x264e88){if(_0x264e88){var _0xfece84=_0x264e88[_0x656e('0x2e')],_0x58181e=_0xc2a01[_0x656e('0x2f')],_0x84d034=_0xc2a01['offset']+_0xc2a01[_0x656e('0x30')],_0x5a2913;if(_0x84d034>=_0xfece84){_0x84d034=_0xfece84;_0x5a2913=0xc8;}else{_0x5a2913=0xce;}_0x469acf['status'](_0x5a2913);return _0x469acf['set'](_0x656e('0x31'),_0x58181e+'-'+_0x84d034+'/'+_0xfece84)[_0x656e('0x2d')](_0x264e88);}return null;};}function patchUpdates(_0x33c853){return function(_0x5ed012){try{jsonpatch[_0x656e('0x32')](_0x5ed012,_0x33c853,!![]);}catch(_0x4d70f2){return BPromise[_0x656e('0x33')](_0x4d70f2);}return _0x5ed012[_0x656e('0x34')]();};}function saveUpdates(_0x5ee149,_0x44a114){return function(_0x52f625){if(_0x52f625){return _0x52f625['update'](_0x5ee149)[_0x656e('0x35')](function(_0x50ca1a){return _0x50ca1a;});}return null;};}function removeEntity(_0x423eb1,_0x4694d3){return function(_0x42274e){if(_0x42274e){return _0x42274e[_0x656e('0x36')]()['then'](function(){var _0x533d2c=_0x42274e[_0x656e('0x37')]({'plain':!![]});var _0x54de4d=_0x656e('0x38');return db[_0x656e('0x39')][_0x656e('0x36')]({'where':{'type':_0x54de4d,'resourceId':_0x533d2c['id']}})[_0x656e('0x35')](function(){return _0x42274e;});})[_0x656e('0x35')](function(){_0x423eb1[_0x656e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d792d,_0x4f770c){return function(_0x55d43c){if(!_0x55d43c){_0x5d792d['sendStatus'](0x194);}return _0x55d43c;};}function handleError(_0x5a44e0,_0x4796b7){_0x4796b7=_0x4796b7||0x1f4;return function(_0x502e27){logger[_0x656e('0x25')](_0x502e27[_0x656e('0x3a')]);if(_0x502e27[_0x656e('0x3b')]){delete _0x502e27[_0x656e('0x3b')];}_0x5a44e0[_0x656e('0x2b')](_0x4796b7)[_0x656e('0x3c')](_0x502e27);};}exports[_0x656e('0x3d')]=function(_0x4667f9,_0x37aa7a){var _0x24c18c={'include':[{'model':db[_0x656e('0x3e')],'as':'mandatoryDispositionPause'}]},_0x24886d={},_0x46306a={'count':0x0,'rows':[]};var _0x3c1a70=_['map'](db['FaxAccount'][_0x656e('0x3f')],function(_0x1d10eb){return{'name':_0x1d10eb[_0x656e('0x40')],'type':_0x1d10eb['type']['key']};});_0x24886d['model']=_[_0x656e('0x41')](_0x3c1a70,_0x656e('0x3b'));_0x24886d[_0x656e('0x42')]=_[_0x656e('0x43')](_0x4667f9[_0x656e('0x42')]);_0x24886d[_0x656e('0x44')]=_[_0x656e('0x45')](_0x24886d[_0x656e('0x46')],_0x24886d[_0x656e('0x42')]);_0x24c18c[_0x656e('0x47')]=_[_0x656e('0x45')](_0x24886d[_0x656e('0x46')],qs[_0x656e('0x48')](_0x4667f9['query'][_0x656e('0x48')]));_0x24c18c['attributes']=_0x24c18c[_0x656e('0x47')][_0x656e('0x49')]?_0x24c18c[_0x656e('0x47')]:_0x24886d[_0x656e('0x46')];if(!_0x4667f9[_0x656e('0x42')][_0x656e('0x4a')](_0x656e('0x4b'))){_0x24c18c[_0x656e('0x30')]=qs[_0x656e('0x30')](_0x4667f9[_0x656e('0x42')]['limit']);_0x24c18c[_0x656e('0x2f')]=qs[_0x656e('0x2f')](_0x4667f9[_0x656e('0x42')]['offset']);}_0x24c18c['order']=qs[_0x656e('0x4c')](_0x4667f9[_0x656e('0x42')][_0x656e('0x4c')]);_0x24c18c[_0x656e('0x4d')]=qs['filters'](_[_0x656e('0x4e')](_0x4667f9[_0x656e('0x42')],_0x24886d[_0x656e('0x44')]),_0x3c1a70);if(_0x4667f9[_0x656e('0x42')][_0x656e('0x4f')]){_0x24c18c['where']=_[_0x656e('0x50')](_0x24c18c[_0x656e('0x4d')],{'$or':_[_0x656e('0x41')](_0x3c1a70,function(_0x37af2a){if(_0x37af2a[_0x656e('0x51')]!==_0x656e('0x52')){var _0x4f7a4e={};_0x4f7a4e[_0x37af2a[_0x656e('0x3b')]]={'$like':'%'+_0x4667f9[_0x656e('0x42')][_0x656e('0x4f')]+'%'};return _0x4f7a4e;}})});}_0x24c18c=_[_0x656e('0x50')]({},_0x24c18c,_0x4667f9['options']);var _0x4ff9b5={'where':_0x24c18c[_0x656e('0x4d')]};return db['FaxAccount']['count'](_0x4ff9b5)['then'](function(_0x1ad138){_0x46306a[_0x656e('0x2e')]=_0x1ad138;if(_0x4667f9['query']['includeAll']){_0x24c18c['include']=[{'all':!![]}];}return db['FaxAccount'][_0x656e('0x53')](_0x24c18c);})[_0x656e('0x35')](function(_0x4a3880){_0x46306a[_0x656e('0x54')]=_0x4a3880;return _0x46306a;})[_0x656e('0x35')](respondWithFilteredResult(_0x37aa7a,_0x24c18c))[_0x656e('0x29')](handleError(_0x37aa7a,null));};exports[_0x656e('0x55')]=function(_0x3878d9,_0x3e8d90){var _0x2dac52={'raw':![],'where':{'id':_0x3878d9[_0x656e('0x56')]['id']},'include':[{'model':db[_0x656e('0x3e')],'as':_0x656e('0x57')}]},_0x2525da={};_0x2525da['model']=_['keys'](db['FaxAccount']['rawAttributes']);_0x2525da[_0x656e('0x42')]=_[_0x656e('0x43')](_0x3878d9[_0x656e('0x42')]);_0x2525da['filters']=_['intersection'](_0x2525da[_0x656e('0x46')],_0x2525da['query']);_0x2dac52[_0x656e('0x47')]=_[_0x656e('0x45')](_0x2525da[_0x656e('0x46')],qs['fields'](_0x3878d9['query'][_0x656e('0x48')]));_0x2dac52[_0x656e('0x47')]=_0x2dac52[_0x656e('0x47')][_0x656e('0x49')]?_0x2dac52[_0x656e('0x47')]:_0x2525da[_0x656e('0x46')];if(_0x3878d9[_0x656e('0x42')][_0x656e('0x58')]){_0x2dac52[_0x656e('0x59')]=[{'all':!![]}];}_0x2dac52=_['merge']({},_0x2dac52,_0x3878d9[_0x656e('0x5a')]);return db[_0x656e('0x5b')]['find'](_0x2dac52)[_0x656e('0x35')](handleEntityNotFound(_0x3e8d90,null))['then'](respondWithResult(_0x3e8d90,null))['catch'](handleError(_0x3e8d90,null));};exports[_0x656e('0x5c')]=function(_0x22c74c,_0x125e11){return db['FaxAccount'][_0x656e('0x5c')](_0x22c74c[_0x656e('0x5d')],{})['then'](function(_0x5ef5f7){var _0x5e0e0d=_0x22c74c[_0x656e('0x5e')][_0x656e('0x37')]({'plain':!![]});if(!_0x5e0e0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e0e0d[_0x656e('0x5f')]===_0x656e('0x5e')){var _0x2e2468=_0x5ef5f7[_0x656e('0x37')]({'plain':!![]});var _0x34a2df='FaxAccounts';return db[_0x656e('0x60')][_0x656e('0x61')]({'where':{'name':_0x34a2df,'userProfileId':_0x5e0e0d['userProfileId']},'raw':!![]})['then'](function(_0x3e9919){if(_0x3e9919&&_0x3e9919['autoAssociation']===0x0){return db[_0x656e('0x39')][_0x656e('0x5c')]({'name':_0x2e2468[_0x656e('0x3b')],'resourceId':_0x2e2468['id'],'type':_0x3e9919['name'],'sectionId':_0x3e9919['id']},{})[_0x656e('0x35')](function(){return _0x5ef5f7;});}else{return _0x5ef5f7;}})[_0x656e('0x29')](function(_0x66f622){logger[_0x656e('0x25')](_0x656e('0x62'),_0x66f622);throw _0x66f622;});}return _0x5ef5f7;})['then'](respondWithResult(_0x125e11,0xc9))[_0x656e('0x29')](handleError(_0x125e11,null));};exports[_0x656e('0x63')]=function(_0x5164b9,_0x1f1eaf){if(_0x5164b9[_0x656e('0x5d')]['id']){delete _0x5164b9[_0x656e('0x5d')]['id'];}return db[_0x656e('0x5b')][_0x656e('0x61')]({'where':{'id':_0x5164b9[_0x656e('0x56')]['id']},'include':[{'model':db[_0x656e('0x3e')],'as':_0x656e('0x57')}]})['then'](handleEntityNotFound(_0x1f1eaf,null))[_0x656e('0x35')](saveUpdates(_0x5164b9[_0x656e('0x5d')],null))['then'](respondWithResult(_0x1f1eaf,null))['catch'](handleError(_0x1f1eaf,null));};exports[_0x656e('0x36')]=function(_0x139212,_0x1f0906){return db[_0x656e('0x5b')][_0x656e('0x61')]({'where':{'id':_0x139212['params']['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x1f0906,null))['then'](removeEntity(_0x1f0906,null))[_0x656e('0x29')](handleError(_0x1f0906,null));};exports[_0x656e('0x64')]=function(_0x380b76,_0x574c4b){return db[_0x656e('0x5b')]['describe']()[_0x656e('0x35')](respondWithResult(_0x574c4b,null))[_0x656e('0x29')](handleError(_0x574c4b,null));};exports[_0x656e('0x65')]=function(_0x191281,_0x5e42af,_0x287a6b){if(_0x191281[_0x656e('0x5d')]['id']){delete _0x191281[_0x656e('0x5d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x191281['params']['id']}})['then'](handleEntityNotFound(_0x5e42af,null))['then'](function(_0x441f0f){if(_0x441f0f){_0x191281[_0x656e('0x5d')][_0x656e('0x66')]=_0x441f0f['id'];return db['Disposition'][_0x656e('0x5c')](_0x191281['body']);}})['then'](respondWithResult(_0x5e42af,null))[_0x656e('0x29')](handleError(_0x5e42af,null));};exports[_0x656e('0x67')]=function(_0x4eb9e8,_0x5ebc2e,_0x42a29c){var _0x1bc3ca={'raw':![],'where':{}};var _0x865fee={};var _0x249aaa={'count':0x0,'rows':[]};return db[_0x656e('0x5b')][_0x656e('0x68')]({'where':{'id':_0x4eb9e8[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x5ebc2e,null))[_0x656e('0x35')](function(_0x321bad){if(_0x321bad){_0x865fee[_0x656e('0x46')]=_[_0x656e('0x43')](db[_0x656e('0x69')][_0x656e('0x3f')]);_0x865fee[_0x656e('0x42')]=_[_0x656e('0x43')](_0x4eb9e8[_0x656e('0x42')]);_0x865fee['filters']=_[_0x656e('0x45')](_0x865fee[_0x656e('0x46')],_0x865fee[_0x656e('0x42')]);_0x1bc3ca['attributes']=_[_0x656e('0x45')](_0x865fee['model'],qs[_0x656e('0x48')](_0x4eb9e8[_0x656e('0x42')]['fields']));_0x1bc3ca[_0x656e('0x47')]=_0x1bc3ca['attributes']['length']?_0x1bc3ca[_0x656e('0x47')]:_0x865fee['model'];if(!_0x4eb9e8[_0x656e('0x42')][_0x656e('0x4a')](_0x656e('0x4b'))){_0x1bc3ca[_0x656e('0x30')]=qs[_0x656e('0x30')](_0x4eb9e8[_0x656e('0x42')][_0x656e('0x30')]);_0x1bc3ca[_0x656e('0x2f')]=qs['offset'](_0x4eb9e8[_0x656e('0x42')][_0x656e('0x2f')]);}_0x1bc3ca[_0x656e('0x6a')]=qs[_0x656e('0x4c')](_0x4eb9e8[_0x656e('0x42')][_0x656e('0x4c')]);_0x1bc3ca[_0x656e('0x4d')]=qs[_0x656e('0x44')](_[_0x656e('0x4e')](_0x4eb9e8[_0x656e('0x42')],_0x865fee[_0x656e('0x44')]));_0x1bc3ca[_0x656e('0x4d')][_0x656e('0x66')]=_0x321bad['id'];if(_0x4eb9e8[_0x656e('0x42')][_0x656e('0x4f')]){_0x1bc3ca[_0x656e('0x4d')]=_['merge'](_0x1bc3ca[_0x656e('0x4d')],{'$or':_[_0x656e('0x41')](_0x1bc3ca[_0x656e('0x47')],function(_0x4331a6){var _0x496646={};_0x496646[_0x4331a6]={'$like':'%'+_0x4eb9e8[_0x656e('0x42')][_0x656e('0x4f')]+'%'};return _0x496646;})});}_0x1bc3ca=_[_0x656e('0x50')]({},_0x1bc3ca,_0x4eb9e8[_0x656e('0x5a')]);return db['Disposition'][_0x656e('0x2e')]({'where':_0x1bc3ca[_0x656e('0x4d')]})[_0x656e('0x35')](function(_0xa77668){_0x249aaa[_0x656e('0x2e')]=_0xa77668;if(_0x4eb9e8[_0x656e('0x42')][_0x656e('0x58')]){_0x1bc3ca[_0x656e('0x59')]=[{'all':!![]}];}return db[_0x656e('0x69')][_0x656e('0x53')](_0x1bc3ca);})[_0x656e('0x35')](function(_0xbd6e0a){_0x249aaa[_0x656e('0x54')]=_0xbd6e0a;return _0x249aaa;});}})['then'](respondWithFilteredResult(_0x5ebc2e,_0x1bc3ca))['catch'](handleError(_0x5ebc2e,null));};exports[_0x656e('0x6b')]=function(_0x4049fd,_0x16f8b3,_0x4ee759){return db[_0x656e('0x5b')][_0x656e('0x61')]({'where':{'id':_0x4049fd['params']['id']}})['then'](handleEntityNotFound(_0x16f8b3,null))[_0x656e('0x35')](function(_0x342c2f){if(_0x342c2f){return _0x342c2f[_0x656e('0x6b')](_0x4049fd[_0x656e('0x42')][_0x656e('0x6c')]);}})[_0x656e('0x35')](respondWithStatusCode(_0x16f8b3,null))[_0x656e('0x29')](handleError(_0x16f8b3,null));};exports[_0x656e('0x6d')]=function(_0x1c09aa,_0x3d59aa,_0x4fa37e){if(_0x1c09aa[_0x656e('0x5d')]['id']){delete _0x1c09aa[_0x656e('0x5d')]['id'];}return db[_0x656e('0x5b')][_0x656e('0x61')]({'where':{'id':_0x1c09aa['params']['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x3d59aa,null))[_0x656e('0x35')](function(_0x43079d){if(_0x43079d){_0x1c09aa[_0x656e('0x5d')][_0x656e('0x66')]=_0x43079d['id'];return db['CannedAnswer'][_0x656e('0x5c')](_0x1c09aa['body']);}})[_0x656e('0x35')](respondWithResult(_0x3d59aa,null))[_0x656e('0x29')](handleError(_0x3d59aa,null));};exports['getAnswers']=function(_0x35dc53,_0x1b60bb,_0x2cc30e){var _0x5bf139={'raw':![],'where':{}};var _0x3c82e1={};var _0x1d5fe2={'count':0x0,'rows':[]};return db[_0x656e('0x5b')][_0x656e('0x68')]({'where':{'id':_0x35dc53[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x1b60bb,null))[_0x656e('0x35')](function(_0x1e1a15){if(_0x1e1a15){_0x3c82e1[_0x656e('0x46')]=_[_0x656e('0x43')](db[_0x656e('0x6e')][_0x656e('0x3f')]);_0x3c82e1[_0x656e('0x42')]=_[_0x656e('0x43')](_0x35dc53[_0x656e('0x42')]);_0x3c82e1[_0x656e('0x44')]=_['intersection'](_0x3c82e1[_0x656e('0x46')],_0x3c82e1[_0x656e('0x42')]);_0x5bf139['attributes']=_[_0x656e('0x45')](_0x3c82e1[_0x656e('0x46')],qs['fields'](_0x35dc53[_0x656e('0x42')][_0x656e('0x48')]));_0x5bf139['attributes']=_0x5bf139[_0x656e('0x47')]['length']?_0x5bf139['attributes']:_0x3c82e1[_0x656e('0x46')];if(!_0x35dc53['query']['hasOwnProperty']('nolimit')){_0x5bf139[_0x656e('0x30')]=qs[_0x656e('0x30')](_0x35dc53[_0x656e('0x42')][_0x656e('0x30')]);_0x5bf139[_0x656e('0x2f')]=qs['offset'](_0x35dc53[_0x656e('0x42')][_0x656e('0x2f')]);}_0x5bf139[_0x656e('0x6a')]=qs[_0x656e('0x4c')](_0x35dc53['query'][_0x656e('0x4c')]);_0x5bf139[_0x656e('0x4d')]=qs[_0x656e('0x44')](_[_0x656e('0x4e')](_0x35dc53[_0x656e('0x42')],_0x3c82e1[_0x656e('0x44')]));_0x5bf139['where'][_0x656e('0x66')]=_0x1e1a15['id'];if(_0x35dc53[_0x656e('0x42')][_0x656e('0x4f')]){_0x5bf139[_0x656e('0x4d')]=_[_0x656e('0x50')](_0x5bf139[_0x656e('0x4d')],{'$or':_[_0x656e('0x41')](_0x5bf139[_0x656e('0x47')],function(_0x394e64){var _0x375340={};_0x375340[_0x394e64]={'$like':'%'+_0x35dc53[_0x656e('0x42')][_0x656e('0x4f')]+'%'};return _0x375340;})});}_0x5bf139=_[_0x656e('0x50')]({},_0x5bf139,_0x35dc53['options']);return db[_0x656e('0x6e')][_0x656e('0x2e')]({'where':_0x5bf139[_0x656e('0x4d')]})['then'](function(_0x2fa2d2){_0x1d5fe2[_0x656e('0x2e')]=_0x2fa2d2;if(_0x35dc53[_0x656e('0x42')][_0x656e('0x58')]){_0x5bf139[_0x656e('0x59')]=[{'all':!![]}];}return db[_0x656e('0x6e')]['findAll'](_0x5bf139);})[_0x656e('0x35')](function(_0x12f30a){_0x1d5fe2[_0x656e('0x54')]=_0x12f30a;return _0x1d5fe2;});}})['then'](respondWithFilteredResult(_0x1b60bb,_0x5bf139))[_0x656e('0x29')](handleError(_0x1b60bb,null));};exports['removeAnswers']=function(_0x11ba3f,_0x1b153b,_0x4e4468){return db[_0x656e('0x5b')][_0x656e('0x61')]({'where':{'id':_0x11ba3f[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x1b153b,null))[_0x656e('0x35')](function(_0x810f0f){if(_0x810f0f){return _0x810f0f[_0x656e('0x6f')](_0x11ba3f[_0x656e('0x42')][_0x656e('0x6c')]);}})[_0x656e('0x35')](respondWithStatusCode(_0x1b153b,null))['catch'](handleError(_0x1b153b,null));};exports['addInteraction']=function(_0x2515c8,_0x114eea,_0x27473a){return db[_0x656e('0x70')][_0x656e('0x61')]({'where':{'id':_0x2515c8[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x114eea,null))[_0x656e('0x35')](function(_0x36b86f){if(_0x36b86f){return _0x36b86f[_0x656e('0x71')](_0x2515c8['body'][_0x656e('0x6c')],_[_0x656e('0x72')](_0x2515c8[_0x656e('0x5d')],['ids','id'])||{});}})[_0x656e('0x35')](respondWithResult(_0x114eea,null))[_0x656e('0x29')](handleError(_0x114eea,null));};exports[_0x656e('0x73')]=function(_0x27f0d8,_0x174e87,_0x36022b){var _0x55772c={'raw':![],'where':{}};var _0x1f3df5={};var _0x293e24={'count':0x0,'rows':[]};return db[_0x656e('0x5b')][_0x656e('0x68')]({'where':{'id':_0x27f0d8[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x174e87,null))[_0x656e('0x35')](function(_0x49489f){if(_0x49489f){_0x1f3df5[_0x656e('0x46')]=_[_0x656e('0x43')](db[_0x656e('0x70')][_0x656e('0x3f')]);_0x1f3df5[_0x656e('0x42')]=_[_0x656e('0x43')](_0x27f0d8[_0x656e('0x42')]);_0x1f3df5[_0x656e('0x44')]=_[_0x656e('0x45')](_0x1f3df5['model'],_0x1f3df5[_0x656e('0x42')]);_0x55772c[_0x656e('0x47')]=_['intersection'](_0x1f3df5[_0x656e('0x46')],qs[_0x656e('0x48')](_0x27f0d8['query'][_0x656e('0x48')]));_0x55772c[_0x656e('0x47')]=_0x55772c[_0x656e('0x47')][_0x656e('0x49')]?_0x55772c[_0x656e('0x47')]:_0x1f3df5[_0x656e('0x46')];if(!_0x27f0d8[_0x656e('0x42')]['hasOwnProperty'](_0x656e('0x4b'))){_0x55772c[_0x656e('0x30')]=qs[_0x656e('0x30')](_0x27f0d8[_0x656e('0x42')]['limit']);_0x55772c[_0x656e('0x2f')]=qs[_0x656e('0x2f')](_0x27f0d8[_0x656e('0x42')][_0x656e('0x2f')]);}_0x55772c[_0x656e('0x6a')]=qs[_0x656e('0x4c')](_0x27f0d8['query'][_0x656e('0x4c')]);_0x55772c[_0x656e('0x4d')]=qs[_0x656e('0x44')](_['pick'](_0x27f0d8['query'],_0x1f3df5[_0x656e('0x44')]));_0x55772c[_0x656e('0x4d')][_0x656e('0x66')]=_0x49489f['id'];if(_0x27f0d8[_0x656e('0x42')][_0x656e('0x4f')]){_0x55772c['where']=_[_0x656e('0x50')](_0x55772c['where'],{'$or':_[_0x656e('0x41')](_0x55772c[_0x656e('0x47')],function(_0x591436){var _0x34f951={};_0x34f951[_0x591436]={'$like':'%'+_0x27f0d8[_0x656e('0x42')][_0x656e('0x4f')]+'%'};return _0x34f951;})});}_0x55772c=_[_0x656e('0x50')]({},_0x55772c,_0x27f0d8[_0x656e('0x5a')]);return db['FaxInteraction'][_0x656e('0x2e')]({'where':_0x55772c[_0x656e('0x4d')]})[_0x656e('0x35')](function(_0xda448){_0x293e24[_0x656e('0x2e')]=_0xda448;if(_0x27f0d8[_0x656e('0x42')][_0x656e('0x58')]){_0x55772c[_0x656e('0x59')]=[{'model':db[_0x656e('0x74')],'as':_0x656e('0x75'),'required':![]},{'model':db[_0x656e('0x76')],'as':_0x656e('0x77'),'attributes':[_0x656e('0x3b'),_0x656e('0x78'),_0x656e('0x79')],'required':![]},{'model':db[_0x656e('0x7a')],'as':_0x656e('0x7b'),'attributes':['id','name',_0x656e('0x7c')],'where':_0x27f0d8['query'][_0x656e('0x7d')]?{'id':_0x27f0d8[_0x656e('0x42')]['tag']}:undefined,'required':_0x27f0d8[_0x656e('0x42')][_0x656e('0x7d')]?!![]:![]}];}return db[_0x656e('0x70')][_0x656e('0x53')](_0x55772c);})[_0x656e('0x35')](function(_0x2c44a1){_0x293e24['rows']=_0x2c44a1;return _0x293e24;});}})['then'](respondWithFilteredResult(_0x174e87,_0x55772c))[_0x656e('0x29')](handleError(_0x174e87,null));};exports[_0x656e('0x7e')]=function(_0x317bb0,_0x187263,_0x42b321){return db['FaxAccount'][_0x656e('0x68')]({'where':{'id':_0x317bb0['params']['id']}})['then'](handleEntityNotFound(_0x187263,null))[_0x656e('0x35')](function(_0x38d519){if(_0x38d519){return db[_0x656e('0x7f')]['transaction'](function(_0x2e4a8e){return db[_0x656e('0x80')][_0x656e('0x36')]({'where':{'FaxAccountId':_0x317bb0[_0x656e('0x56')]['id']},'transaction':_0x2e4a8e})['then'](function(_0x594e17){var _0x13a8a4=_[_0x656e('0x41')](_0x317bb0['body'],function(_0x4ed5b6){_0x4ed5b6['FaxAccountId']=_0x317bb0['params']['id'];return _0x4ed5b6;});return db[_0x656e('0x80')][_0x656e('0x81')](_0x13a8a4,{'transaction':_0x2e4a8e});});})[_0x656e('0x35')](function(){return db['FaxApplication'][_0x656e('0x82')]({'where':{'FaxAccountId':_0x317bb0['params']['id']},'order':_0x656e('0x83')});});}})[_0x656e('0x35')](respondWithResult(_0x187263,null))[_0x656e('0x29')](handleError(_0x187263,null));};exports[_0x656e('0x84')]=function(_0x1db418,_0x5c6871,_0x5dae70){var _0x1bf774={};var _0x44a525={};var _0x5e40b1;var _0x4f1251;return db[_0x656e('0x5b')][_0x656e('0x68')]({'where':{'id':_0x1db418[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x5c6871,null))[_0x656e('0x35')](function(_0x169761){if(_0x169761){_0x5e40b1=_0x169761;_0x44a525[_0x656e('0x46')]=_[_0x656e('0x43')](db[_0x656e('0x80')][_0x656e('0x3f')]);_0x44a525[_0x656e('0x42')]=_['keys'](_0x1db418[_0x656e('0x42')]);_0x44a525[_0x656e('0x44')]=_[_0x656e('0x45')](_0x44a525[_0x656e('0x46')],_0x44a525['query']);_0x1bf774[_0x656e('0x47')]=_[_0x656e('0x45')](_0x44a525[_0x656e('0x46')],qs['fields'](_0x1db418[_0x656e('0x42')]['fields']));_0x1bf774['attributes']=_0x1bf774[_0x656e('0x47')]['length']?_0x1bf774[_0x656e('0x47')]:_0x44a525['model'];_0x1bf774['order']=qs[_0x656e('0x4c')](_0x1db418[_0x656e('0x42')][_0x656e('0x4c')]);_0x1bf774['where']=qs[_0x656e('0x44')](_[_0x656e('0x4e')](_0x1db418[_0x656e('0x42')],_0x44a525[_0x656e('0x44')]));if(_0x1db418[_0x656e('0x42')]['filter']){_0x1bf774[_0x656e('0x4d')]=_[_0x656e('0x50')](_0x1bf774['where'],{'$or':_[_0x656e('0x41')](_0x1bf774[_0x656e('0x47')],function(_0x2cd4d5){var _0x1e8870={};_0x1e8870[_0x2cd4d5]={'$like':'%'+_0x1db418[_0x656e('0x42')][_0x656e('0x4f')]+'%'};return _0x1e8870;})});}_0x1bf774=_[_0x656e('0x50')]({},_0x1bf774,_0x1db418[_0x656e('0x5a')]);return _0x5e40b1[_0x656e('0x84')](_0x1bf774);}})[_0x656e('0x35')](function(_0x1f12cc){if(_0x1f12cc){_0x4f1251=_0x1f12cc[_0x656e('0x49')];if(!_0x1db418[_0x656e('0x42')][_0x656e('0x4a')](_0x656e('0x4b'))){_0x1bf774['limit']=qs[_0x656e('0x30')](_0x1db418[_0x656e('0x42')][_0x656e('0x30')]);_0x1bf774['offset']=qs[_0x656e('0x2f')](_0x1db418[_0x656e('0x42')][_0x656e('0x2f')]);}return _0x5e40b1['getApplications'](_0x1bf774);}})[_0x656e('0x35')](function(_0x2829dd){if(_0x2829dd){return _0x2829dd?{'count':_0x4f1251,'rows':_0x2829dd}:null;}})[_0x656e('0x35')](respondWithResult(_0x5c6871,null))['catch'](handleError(_0x5c6871,null));};function Extension(_0x48a47e,_0x1e1fdd,_0x247d24,_0x44e3a5){this['context']=_0x656e('0x85');this[_0x656e('0x86')]=_0x48a47e[_0x656e('0x87')];this['app']=_0x44e3a5;this[_0x656e('0x51')]='system';this['description']='Fax\x20Extension';this[_0x656e('0x66')]=_0x48a47e['id'];this[_0x656e('0x83')]=_0x1e1fdd;this['appdata']=_0x247d24;}function createExtensionsReciveFax(_0x507476){var _0x232a38=0x1;var _0x35c90f=[];_0x35c90f[_0x656e('0x88')](new Extension(_0x507476,_0x232a38,'',_0x656e('0x89')));_0x232a38+=0x1;_0x35c90f[_0x656e('0x88')](new Extension(_0x507476,_0x232a38,'CDR(type)=inbound-fax',_0x656e('0x8a')));_0x232a38+=0x1;for(var _0x4a994b in _0x507476){if(_0x507476['hasOwnProperty'](_0x4a994b)&&(_0x4a994b===_0x656e('0x8b')||_0x4a994b==='localstationid'||_0x4a994b===_0x656e('0x8c')||_0x4a994b==='faxdetect'||_0x4a994b===_0x656e('0x8d')||_0x4a994b===_0x656e('0x8e')||_0x4a994b===_0x656e('0x8f')||_0x4a994b===_0x656e('0x90')||_0x4a994b===_0x656e('0x91'))){_0x35c90f[_0x656e('0x88')](new Extension(_0x507476,_0x232a38,_0x656e('0x92')+_0x4a994b+')='+_0x507476[_0x4a994b],'Set'));_0x232a38+=0x1;}}_0x35c90f[_0x656e('0x88')](new Extension(_0x507476,_0x232a38,'6',_0x656e('0x93')));_0x232a38+=0x1;_0x35c90f[_0x656e('0x88')](new Extension(_0x507476,_0x232a38,_0x656e('0x94'),_0x656e('0x95')));_0x232a38=0x0;return _0x35c90f;}exports[_0x656e('0x96')]=function(_0xadf1c2,_0x1f4328,_0x56d181){var _0x5055d5;return db['sequelize'][_0x656e('0x97')](function(_0x55f611){return db[_0x656e('0x5b')][_0x656e('0x5c')](_0xadf1c2[_0x656e('0x5d')],{'transaction':_0x55f611})[_0x656e('0x35')](function(_0x43569b){_0x5055d5=_0x43569b['get']({'plain':!![]});return db[_0x656e('0x98')][_0x656e('0x81')](createExtensionsReciveFax(_0x5055d5),{'transaction':_0x55f611});});})[_0x656e('0x35')](function(){return _0x5055d5;})[_0x656e('0x35')](respondWithResult(_0x1f4328,null))['catch'](handleError(_0x1f4328,null));};exports[_0x656e('0x99')]=function(_0x3db078,_0xa3bf81,_0x450f6c){var _0x138022;return db[_0x656e('0x7f')]['transaction'](function(_0x512380){return db[_0x656e('0x5b')][_0x656e('0x63')](_0x3db078[_0x656e('0x5d')],{'where':{'id':_0x3db078[_0x656e('0x5d')]['id']},'transaction':_0x512380})[_0x656e('0x35')](function(_0x1b4b57){return db[_0x656e('0x98')]['destroy']({'where':{'FaxAccountId':_0x3db078[_0x656e('0x5d')]['id']},'transaction':_0x512380})[_0x656e('0x35')](function(_0xa3774c){return db[_0x656e('0x98')][_0x656e('0x81')](createExtensionsReciveFax(_[_0x656e('0x72')](_0x3db078[_0x656e('0x5d')],[_0x656e('0x9a'),_0x656e('0x9b'),'createdAt',_0x656e('0x9c'),_0x656e('0x9d'),_0x656e('0x9e')])),{'transaction':_0x512380});});});})[_0x656e('0x35')](function(){return db[_0x656e('0x5b')]['findById'](_0x3db078[_0x656e('0x5d')]['id']);})[_0x656e('0x35')](respondWithResult(_0xa3bf81,null))['catch'](handleError(_0xa3bf81,null));};exports['getMessages']=function(_0x11f9f7,_0x3ef223,_0x3a25b7){var _0x5ca5c7={'raw':!![],'where':{}};var _0x4edf23={};var _0x253d4f={'count':0x0,'rows':[]};return db[_0x656e('0x5b')]['findOne']({'where':{'id':_0x11f9f7[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x3ef223,null))[_0x656e('0x35')](function(_0x3e991f){if(_0x3e991f){_0x4edf23[_0x656e('0x46')]=_[_0x656e('0x43')](db[_0x656e('0x9f')][_0x656e('0x3f')]);_0x4edf23['query']=_[_0x656e('0x43')](_0x11f9f7['query']);_0x4edf23[_0x656e('0x44')]=_['intersection'](_0x4edf23[_0x656e('0x46')],_0x4edf23[_0x656e('0x42')]);_0x5ca5c7['attributes']=_[_0x656e('0x45')](_0x4edf23['model'],qs[_0x656e('0x48')](_0x11f9f7[_0x656e('0x42')][_0x656e('0x48')]));_0x5ca5c7[_0x656e('0x47')]=_0x5ca5c7[_0x656e('0x47')][_0x656e('0x49')]?_0x5ca5c7[_0x656e('0x47')]:_0x4edf23['model'];if(!_0x11f9f7[_0x656e('0x42')][_0x656e('0x4a')]('nolimit')){_0x5ca5c7[_0x656e('0x30')]=qs['limit'](_0x11f9f7[_0x656e('0x42')]['limit']);_0x5ca5c7[_0x656e('0x2f')]=qs['offset'](_0x11f9f7[_0x656e('0x42')]['offset']);}_0x5ca5c7[_0x656e('0x6a')]=qs['sort'](_0x11f9f7[_0x656e('0x42')][_0x656e('0x4c')]);_0x5ca5c7['where']=qs['filters'](_[_0x656e('0x4e')](_0x11f9f7['query'],_0x4edf23[_0x656e('0x44')]));_0x5ca5c7[_0x656e('0x4d')][_0x656e('0x66')]=_0x3e991f['id'];if(_0x11f9f7[_0x656e('0x42')][_0x656e('0x4f')]){_0x5ca5c7[_0x656e('0x4d')]=_[_0x656e('0x50')](_0x5ca5c7[_0x656e('0x4d')],{'$or':_['map'](_0x5ca5c7[_0x656e('0x47')],function(_0x430cb6){var _0x425315={};_0x425315[_0x430cb6]={'$like':'%'+_0x11f9f7[_0x656e('0x42')]['filter']+'%'};return _0x425315;})});}if(_0x11f9f7[_0x656e('0x42')][_0x656e('0xa0')]){var _0x4db422=_0x11f9f7[_0x656e('0x42')][_0x656e('0xa0')][_0x656e('0xa1')](',');var _0x290aac={};_0x290aac[_0x4db422[0x0]]={'$gte':moment(_0x4db422[0x1])[_0x656e('0xa2')](_0x656e('0xa3'))};_0x5ca5c7[_0x656e('0x4d')]=_['merge'](_0x5ca5c7[_0x656e('0x4d')],_0x290aac);}_0x5ca5c7=_[_0x656e('0x50')]({},_0x5ca5c7,_0x11f9f7['options']);return db[_0x656e('0x9f')][_0x656e('0x2e')]({'where':_0x5ca5c7[_0x656e('0x4d')]})[_0x656e('0x35')](function(_0x4b3c67){_0x253d4f[_0x656e('0x2e')]=_0x4b3c67;if(_0x11f9f7[_0x656e('0x42')][_0x656e('0x58')]){_0x5ca5c7[_0x656e('0x59')]=[{'all':!![]}];}return db[_0x656e('0x9f')][_0x656e('0x53')](_0x5ca5c7);})[_0x656e('0x35')](function(_0x4d3161){_0x253d4f[_0x656e('0x54')]=_0x4d3161;return _0x253d4f;});}})[_0x656e('0x35')](respondWithFilteredResult(_0x3ef223,_0x5ca5c7))[_0x656e('0x29')](handleError(_0x3ef223,null));};exports[_0x656e('0x3c')]=function(_0x257a47,_0x235d59,_0x2c1b5f){var _0x2b1d7f,_0xe8dd55={},_0x18b2d6;if(_0x257a47['body']['to']){_0x18b2d6=_0x257a47['body']['to'][0x0];}return db[_0x656e('0x5b')][_0x656e('0x61')]({'where':{'id':_0x257a47[_0x656e('0x56')]['id']},'include':[{'model':db[_0x656e('0xa4')],'as':_0x656e('0xa5'),'include':[{'model':db[_0x656e('0x74')],'as':'Contacts','where':{'fax':_0x18b2d6},'limit':0x1,'order':[[_0x656e('0x9c'),_0x656e('0xa6')]]}]}]})[_0x656e('0x35')](handleEntityNotFound(_0x235d59,null))[_0x656e('0x35')](function(_0x46a65d){_0x2b1d7f=_0x46a65d;if(_0x257a47['body'][_0x656e('0xa7')]&&_0x257a47[_0x656e('0x5d')]['attachments']['length']){for(var _0x46e965=0x0;_0x46e965<_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][_0x656e('0x49')];_0x46e965+=0x1){_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][_0x46e965]={'filename':_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][_0x46e965]['name'],'id':_0x257a47['body'][_0x656e('0xa7')][_0x46e965]['id'],'path':path[_0x656e('0xa8')](config[_0x656e('0xa9')],_0x656e('0xaa'),_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][_0x46e965][_0x656e('0xab')])};}}return respondWithRpcPromise(_0x656e('0xac'),_0x656e('0xac'),{'FaxAccountId':_['isNil'](_0x257a47[_0x656e('0x56')]['id'])?undefined:_0x257a47['params']['id'],'path':_['isNil'](_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0]['path'])?undefined:_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0]['path'],'fax':_[_0x656e('0xad')](_0x257a47[_0x656e('0x5d')]['to'][0x0])?undefined:_0x257a47['body']['to'][0x0]},client9002);})[_0x656e('0x35')](function(){if(_0x2b1d7f){if(_[_0x656e('0xad')](_0x257a47[_0x656e('0x5d')][_0x656e('0xae')])){_0x257a47[_0x656e('0x5d')][_0x656e('0xae')]=util['format'](_0x656e('0xaf'),_0x2b1d7f[_0x656e('0x3b')],_0x2b1d7f[_0x656e('0xb0')]);}if(_0x2b1d7f[_0x656e('0xa5')]){if(_0x2b1d7f[_0x656e('0xa5')][_0x656e('0xb1')][_0x656e('0x49')]){return _0x2b1d7f[_0x656e('0xa5')][_0x656e('0xb1')][0x0];}else{return db[_0x656e('0x74')][_0x656e('0x5c')](_[_0x656e('0x1d')](_0x257a47[_0x656e('0x5d')],{'firstName':_0x257a47[_0x656e('0x5d')]['to'][0x0],'phone':_0x257a47[_0x656e('0x5d')]['to'][0x0],'fax':_0x257a47[_0x656e('0x5d')]['to'][0x0],'ListId':_0x2b1d7f[_0x656e('0x9e')]}));}}else{throw new Error(_0x656e('0xb2'));}}else{throw new Error(_0x656e('0xb3'));}})[_0x656e('0x35')](function(_0x390d0d){if(_0x390d0d){return db[_0x656e('0x70')][_0x656e('0x61')]({'where':{'ContactId':_0x390d0d['id'],'closed':![],'FaxAccountId':_0x2b1d7f['id']}})[_0x656e('0x35')](function(_0x1faae6){if(_0x1faae6){return[_0x1faae6,![]];}return db[_0x656e('0x70')][_0x656e('0x5c')]({'UserId':_0x257a47[_0x656e('0x5e')]['id'],'ContactId':_0x390d0d['id'],'FaxAccountId':_0x2b1d7f['id'],'fax':_0x257a47[_0x656e('0x5d')]['to'][0x0],'firstMsgDirection':_0x656e('0xb4'),'Messages':[_[_0x656e('0x50')](_0x257a47[_0x656e('0x5d')],{'read':![],'body':_0x257a47['body']['attachments'][0x0][_0x656e('0xb5')],'FaxAccountId':_0x2b1d7f['id'],'UserId':_0x257a47['user']['id'],'ContactId':_0x390d0d['id'],'AttachmentId':_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x656e('0x9f')],'as':_0x656e('0xb6')}]})[_0x656e('0x35')](function(_0x2631d0){return[_0x2631d0,!![]];});});}else{throw new Error(_0x656e('0xb7'));}})['spread'](function(_0x3f2dd1,_0x41e1de){if(_0x41e1de){return _0x3f2dd1;}return db['FaxMessage'][_0x656e('0x5c')]({'direction':_0x656e('0xb4'),'read':![],'body':_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0][_0x656e('0xb5')],'FaxAccountId':_0x2b1d7f['id'],'FaxInteractionId':_0x3f2dd1['id'],'UserId':_0x257a47[_0x656e('0x5e')]['id'],'ContactId':_0x3f2dd1[_0x656e('0xb8')],'AttachmentId':_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0]['id']})[_0x656e('0x35')](function(_0x2a5b10){_0x3f2dd1[_0x656e('0xb9')][_0x656e('0xb6')]=[];_0x3f2dd1[_0x656e('0xb9')][_0x656e('0xb6')]['push'](_0x2a5b10[_0x656e('0xb9')]);return _0x3f2dd1;});})[_0x656e('0x35')](function(_0x2806ef){respondWithRpcPromise(_0x656e('0xba'),_0x656e('0xba'),{'FaxAccountId':_[_0x656e('0xad')](_0x257a47[_0x656e('0x56')]['id'])?undefined:_0x257a47[_0x656e('0x56')]['id'],'path':_[_0x656e('0xad')](_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0][_0x656e('0x9')])?undefined:_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0][_0x656e('0x9')],'fax':_[_0x656e('0xad')](_0x257a47[_0x656e('0x5d')]['to'][0x0])?undefined:_0x257a47[_0x656e('0x5d')]['to'][0x0],'AttachmentId':_0x257a47[_0x656e('0x5d')][_0x656e('0xa7')][0x0]['id']},client9002)[_0x656e('0x35')](function(_0x39b3b8){logger[_0x656e('0x22')](_0x656e('0xbb'),_0x39b3b8);})['catch'](function(_0x1d9f92){logger[_0x656e('0x22')](_0x656e('0xbb'),_0x1d9f92);});return _0x2806ef;})[_0x656e('0x35')](respondWithResult(_0x235d59,null))[_0x656e('0x29')](handleError(_0x235d59,null));};exports[_0x656e('0xbc')]=function(_0x329db2,_0x169f30,_0x394523){return db[_0x656e('0x5b')]['find']({'where':{'id':_0x329db2['params']['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x169f30,null))['then'](function(_0x2c4b6c){if(_0x2c4b6c){return _0x2c4b6c[_0x656e('0xbc')](_0x329db2[_0x656e('0x5d')][_0x656e('0x6c')],_[_0x656e('0x72')](_0x329db2[_0x656e('0x5d')],['ids','id'])||{})[_0x656e('0xbd')](function(_0x7b65fd){for(var _0x356ce1=0x0;_0x356ce1<_0x329db2['body'][_0x656e('0x6c')][_0x656e('0x49')];_0x356ce1+=0x1){socket[_0x656e('0xbe')](_0x656e('0xbf'),{'UserId':_0x329db2['body']['ids'][_0x356ce1],'FaxAccountId':_0x329db2[_0x656e('0x56')]['id']});}return _0x7b65fd;});}})[_0x656e('0x35')](respondWithResult(_0x169f30,null))[_0x656e('0x29')](handleError(_0x169f30,null));};exports['removeAgents']=function(_0x2b578a,_0x34f860,_0x38cc4a){return db[_0x656e('0x5b')][_0x656e('0x61')]({'where':{'id':_0x2b578a[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x34f860,null))[_0x656e('0x35')](function(_0x36e629){if(_0x36e629){return _0x36e629[_0x656e('0xc0')](_0x2b578a[_0x656e('0x42')]['ids'])[_0x656e('0x35')](function(){if(_[_0x656e('0xc1')](_0x2b578a[_0x656e('0x42')][_0x656e('0x6c')])){for(var _0x3299ba=0x0;_0x3299ba<_0x2b578a[_0x656e('0x42')][_0x656e('0x6c')][_0x656e('0x49')];_0x3299ba+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2b578a[_0x656e('0x42')][_0x656e('0x6c')][_0x3299ba]),'FaxAccountId':Number(_0x2b578a[_0x656e('0x56')]['id'])});}}else{socket[_0x656e('0xbe')](_0x656e('0xc2'),{'UserId':Number(_0x2b578a[_0x656e('0x42')][_0x656e('0x6c')]),'FaxAccountId':Number(_0x2b578a[_0x656e('0x56')]['id'])});}});}})[_0x656e('0x35')](respondWithStatusCode(_0x34f860,null))[_0x656e('0x29')](handleError(_0x34f860,null));};exports[_0x656e('0xc3')]=function(_0x2a1b1f,_0x2b9b95,_0x4d2e99){var _0x5ad249={};var _0x8f6ac8={};var _0xf4aebc;var _0x189870;return db['FaxAccount']['findOne']({'where':{'id':_0x2a1b1f[_0x656e('0x56')]['id']}})[_0x656e('0x35')](handleEntityNotFound(_0x2b9b95,null))[_0x656e('0x35')](function(_0x5bbc0a){if(_0x5bbc0a){_0xf4aebc=_0x5bbc0a;_0x8f6ac8['model']=_['keys'](db['User'][_0x656e('0x3f')]);_0x8f6ac8['query']=_[_0x656e('0x43')](_0x2a1b1f[_0x656e('0x42')]);_0x8f6ac8['filters']=_[_0x656e('0x45')](_0x8f6ac8[_0x656e('0x46')],_0x8f6ac8[_0x656e('0x42')]);_0x5ad249[_0x656e('0x47')]=_[_0x656e('0x45')](_0x8f6ac8[_0x656e('0x46')],qs[_0x656e('0x48')](_0x2a1b1f[_0x656e('0x42')][_0x656e('0x48')]));_0x5ad249['attributes']=_0x5ad249[_0x656e('0x47')]['length']?_0x5ad249[_0x656e('0x47')]:_0x8f6ac8[_0x656e('0x46')];_0x5ad249[_0x656e('0x6a')]=qs[_0x656e('0x4c')](_0x2a1b1f[_0x656e('0x42')][_0x656e('0x4c')]);_0x5ad249[_0x656e('0x4d')]=qs['filters'](_['pick'](_0x2a1b1f['query'],_0x8f6ac8[_0x656e('0x44')]));if(_0x2a1b1f[_0x656e('0x42')]['filter']){_0x5ad249[_0x656e('0x4d')]=_[_0x656e('0x50')](_0x5ad249[_0x656e('0x4d')],{'$or':_['map'](_0x5ad249[_0x656e('0x47')],function(_0x563d93){var _0x3ac469={};_0x3ac469[_0x563d93]={'$like':'%'+_0x2a1b1f[_0x656e('0x42')][_0x656e('0x4f')]+'%'};return _0x3ac469;})});}_0x5ad249=_[_0x656e('0x50')]({},_0x5ad249,_0x2a1b1f['options']);return _0xf4aebc[_0x656e('0xc3')](_0x5ad249);}})[_0x656e('0x35')](function(_0x10ca8d){if(_0x10ca8d){_0x189870=_0x10ca8d[_0x656e('0x49')];if(!_0x2a1b1f[_0x656e('0x42')]['hasOwnProperty'](_0x656e('0x4b'))){_0x5ad249[_0x656e('0x30')]=qs[_0x656e('0x30')](_0x2a1b1f[_0x656e('0x42')][_0x656e('0x30')]);_0x5ad249[_0x656e('0x2f')]=qs['offset'](_0x2a1b1f[_0x656e('0x42')][_0x656e('0x2f')]);}return _0xf4aebc[_0x656e('0xc3')](_0x5ad249);}})[_0x656e('0x35')](function(_0x24a148){if(_0x24a148){return _0x24a148?{'count':_0x189870,'rows':_0x24a148}:null;}})[_0x656e('0x35')](respondWithResult(_0x2b9b95,null))[_0x656e('0x29')](handleError(_0x2b9b95,null));}; \ No newline at end of file +var _0xa8a8=['Set','/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','createdAt','updatedAt','TrunkId','ListId','getMessages','$gte','format','FaxMessage','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','end','name','send','index','map','FaxAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','Pause','mandatoryDispositionPause','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','find','FaxAccountId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT('];(function(_0x5f121e,_0xf44e8e){var _0x37d2d8=function(_0x50743c){while(--_0x50743c){_0x5f121e['push'](_0x5f121e['shift']());}};_0x37d2d8(++_0xf44e8e);}(_0xa8a8,0xec));var _0x8a8a=function(_0x114acf,_0x13694f){_0x114acf=_0x114acf-0x0;var _0xde6696=_0xa8a8[_0x114acf];return _0xde6696;};'use strict';var pdf=require(_0x8a8a('0x0'));var emlformat=require(_0x8a8a('0x1'));var rimraf=require(_0x8a8a('0x2'));var zipdir=require(_0x8a8a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a8a('0x4'));var moment=require(_0x8a8a('0x5'));var BPromise=require(_0x8a8a('0x6'));var Mustache=require(_0x8a8a('0x7'));var util=require(_0x8a8a('0x8'));var path=require(_0x8a8a('0x9'));var sox=require(_0x8a8a('0xa'));var csv=require(_0x8a8a('0xb'));var ejs=require(_0x8a8a('0xc'));var fs=require('fs');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('0xb'));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});function respondWithRpcPromise(_0x1ed3be,_0x568b83,_0x1f36b6,_0x3046ae){return new BPromise(function(_0x46a4f4,_0x4291e9){var _0x42e8b6=_0x3046ae||client;return _0x42e8b6['request'](_0x1ed3be,_0x1f36b6)[_0x8a8a('0x22')](function(_0x3d165c){logger[_0x8a8a('0x23')](_0x8a8a('0x24'),_0x568b83,_0x8a8a('0x25'));logger[_0x8a8a('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x568b83,'request\x20sent',JSON['stringify'](_0x3d165c));if(_0x3d165c['error']){if(_0x3d165c['error'][_0x8a8a('0x27')]===0x1f4){logger[_0x8a8a('0x28')](_0x8a8a('0x24'),_0x568b83,_0x3d165c[_0x8a8a('0x28')][_0x8a8a('0x29')]);return _0x4291e9(_0x3d165c[_0x8a8a('0x28')][_0x8a8a('0x29')]);}logger[_0x8a8a('0x28')](_0x8a8a('0x24'),_0x568b83,_0x3d165c[_0x8a8a('0x28')][_0x8a8a('0x29')]);return _0x46a4f4(_0x3d165c[_0x8a8a('0x28')][_0x8a8a('0x29')]);}else{logger[_0x8a8a('0x23')](_0x8a8a('0x24'),_0x568b83,'request\x20sent');_0x46a4f4(_0x3d165c[_0x8a8a('0x2a')][_0x8a8a('0x29')]);}})[_0x8a8a('0x2b')](function(_0x7662e){logger[_0x8a8a('0x28')](_0x8a8a('0x24'),_0x568b83,_0x7662e);_0x4291e9(_0x7662e);});});}function respondWithStatusCode(_0x3aa46d,_0x5f4dcc){_0x5f4dcc=_0x5f4dcc||0xcc;return function(_0x31d21a){if(_0x31d21a){return _0x3aa46d[_0x8a8a('0x2c')](_0x5f4dcc);}return _0x3aa46d[_0x8a8a('0x2d')](_0x5f4dcc)['end']();};}function respondWithResult(_0x58f42b,_0x2dafcd){_0x2dafcd=_0x2dafcd||0xc8;return function(_0x129d11){if(_0x129d11){return _0x58f42b['status'](_0x2dafcd)['json'](_0x129d11);}};}function respondWithFilteredResult(_0x4b3bc5,_0x78fd48){return function(_0x5c7e58){if(_0x5c7e58){var _0x10b916=_0x5c7e58[_0x8a8a('0x2e')],_0xdd6221=_0x78fd48[_0x8a8a('0x2f')],_0x49ea81=_0x78fd48[_0x8a8a('0x2f')]+_0x78fd48[_0x8a8a('0x30')],_0x36c7f8;if(_0x49ea81>=_0x10b916){_0x49ea81=_0x10b916;_0x36c7f8=0xc8;}else{_0x36c7f8=0xce;}_0x4b3bc5[_0x8a8a('0x2d')](_0x36c7f8);return _0x4b3bc5[_0x8a8a('0x31')](_0x8a8a('0x32'),_0xdd6221+'-'+_0x49ea81+'/'+_0x10b916)['json'](_0x5c7e58);}return null;};}function patchUpdates(_0x4ca706){return function(_0x56e79e){try{jsonpatch[_0x8a8a('0x33')](_0x56e79e,_0x4ca706,!![]);}catch(_0x3bf77d){return BPromise['reject'](_0x3bf77d);}return _0x56e79e[_0x8a8a('0x34')]();};}function saveUpdates(_0x304e83,_0x481e92){return function(_0x3abab2){if(_0x3abab2){return _0x3abab2[_0x8a8a('0x35')](_0x304e83)[_0x8a8a('0x22')](function(_0x49e287){return _0x49e287;});}return null;};}function removeEntity(_0x5bee53,_0x8457a0){return function(_0x503b40){if(_0x503b40){return _0x503b40[_0x8a8a('0x36')]()[_0x8a8a('0x22')](function(){var _0x3ecbca=_0x503b40[_0x8a8a('0x37')]({'plain':!![]});var _0x3c69b4=_0x8a8a('0x38');return db[_0x8a8a('0x39')][_0x8a8a('0x36')]({'where':{'type':_0x3c69b4,'resourceId':_0x3ecbca['id']}})[_0x8a8a('0x22')](function(){return _0x503b40;});})[_0x8a8a('0x22')](function(){_0x5bee53[_0x8a8a('0x2d')](0xcc)[_0x8a8a('0x3a')]();});}};}function handleEntityNotFound(_0x17a36c,_0x37e644){return function(_0x19c21c){if(!_0x19c21c){_0x17a36c[_0x8a8a('0x2c')](0x194);}return _0x19c21c;};}function handleError(_0x8e3017,_0x29d187){_0x29d187=_0x29d187||0x1f4;return function(_0x4c8003){logger['error'](_0x4c8003['stack']);if(_0x4c8003[_0x8a8a('0x3b')]){delete _0x4c8003[_0x8a8a('0x3b')];}_0x8e3017[_0x8a8a('0x2d')](_0x29d187)[_0x8a8a('0x3c')](_0x4c8003);};}exports[_0x8a8a('0x3d')]=function(_0x508e67,_0x4ee92e){var _0x8d8481={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4fe0bd={},_0x41a4c4={'count':0x0,'rows':[]};var _0x1b33eb=_[_0x8a8a('0x3e')](db[_0x8a8a('0x3f')][_0x8a8a('0x40')],function(_0x31307c){return{'name':_0x31307c[_0x8a8a('0x41')],'type':_0x31307c[_0x8a8a('0x42')]['key']};});_0x4fe0bd[_0x8a8a('0x43')]=_[_0x8a8a('0x3e')](_0x1b33eb,_0x8a8a('0x3b'));_0x4fe0bd['query']=_[_0x8a8a('0x44')](_0x508e67[_0x8a8a('0x45')]);_0x4fe0bd[_0x8a8a('0x46')]=_['intersection'](_0x4fe0bd[_0x8a8a('0x43')],_0x4fe0bd[_0x8a8a('0x45')]);_0x8d8481[_0x8a8a('0x47')]=_[_0x8a8a('0x48')](_0x4fe0bd[_0x8a8a('0x43')],qs[_0x8a8a('0x49')](_0x508e67['query']['fields']));_0x8d8481[_0x8a8a('0x47')]=_0x8d8481['attributes'][_0x8a8a('0x4a')]?_0x8d8481[_0x8a8a('0x47')]:_0x4fe0bd['model'];if(!_0x508e67['query'][_0x8a8a('0x4b')](_0x8a8a('0x4c'))){_0x8d8481[_0x8a8a('0x30')]=qs[_0x8a8a('0x30')](_0x508e67['query'][_0x8a8a('0x30')]);_0x8d8481['offset']=qs[_0x8a8a('0x2f')](_0x508e67[_0x8a8a('0x45')]['offset']);}_0x8d8481[_0x8a8a('0x4d')]=qs[_0x8a8a('0x4e')](_0x508e67[_0x8a8a('0x45')]['sort']);_0x8d8481[_0x8a8a('0x4f')]=qs[_0x8a8a('0x46')](_[_0x8a8a('0x50')](_0x508e67['query'],_0x4fe0bd['filters']),_0x1b33eb);if(_0x508e67[_0x8a8a('0x45')][_0x8a8a('0x51')]){_0x8d8481[_0x8a8a('0x4f')]=_['merge'](_0x8d8481[_0x8a8a('0x4f')],{'$or':_[_0x8a8a('0x3e')](_0x1b33eb,function(_0x86588c){if(_0x86588c[_0x8a8a('0x42')]!==_0x8a8a('0x52')){var _0x504104={};_0x504104[_0x86588c[_0x8a8a('0x3b')]]={'$like':'%'+_0x508e67[_0x8a8a('0x45')][_0x8a8a('0x51')]+'%'};return _0x504104;}})});}_0x8d8481=_[_0x8a8a('0x53')]({},_0x8d8481,_0x508e67[_0x8a8a('0x54')]);var _0x53dd4b={'where':_0x8d8481[_0x8a8a('0x4f')]};return db[_0x8a8a('0x3f')][_0x8a8a('0x2e')](_0x53dd4b)[_0x8a8a('0x22')](function(_0x31d067){_0x41a4c4[_0x8a8a('0x2e')]=_0x31d067;if(_0x508e67['query'][_0x8a8a('0x55')]){_0x8d8481[_0x8a8a('0x56')]=[{'all':!![]}];}return db[_0x8a8a('0x3f')][_0x8a8a('0x57')](_0x8d8481);})['then'](function(_0x1faad3){_0x41a4c4[_0x8a8a('0x58')]=_0x1faad3;return _0x41a4c4;})[_0x8a8a('0x22')](respondWithFilteredResult(_0x4ee92e,_0x8d8481))['catch'](handleError(_0x4ee92e,null));};exports['show']=function(_0x467656,_0x39a8e0){var _0xf4b6ee={'raw':![],'where':{'id':_0x467656[_0x8a8a('0x59')]['id']},'include':[{'model':db[_0x8a8a('0x5a')],'as':_0x8a8a('0x5b')}]},_0x51d2e={};_0x51d2e[_0x8a8a('0x43')]=_[_0x8a8a('0x44')](db['FaxAccount']['rawAttributes']);_0x51d2e[_0x8a8a('0x45')]=_[_0x8a8a('0x44')](_0x467656['query']);_0x51d2e['filters']=_[_0x8a8a('0x48')](_0x51d2e['model'],_0x51d2e[_0x8a8a('0x45')]);_0xf4b6ee['attributes']=_[_0x8a8a('0x48')](_0x51d2e[_0x8a8a('0x43')],qs[_0x8a8a('0x49')](_0x467656[_0x8a8a('0x45')][_0x8a8a('0x49')]));_0xf4b6ee[_0x8a8a('0x47')]=_0xf4b6ee[_0x8a8a('0x47')][_0x8a8a('0x4a')]?_0xf4b6ee[_0x8a8a('0x47')]:_0x51d2e[_0x8a8a('0x43')];if(_0x467656['query'][_0x8a8a('0x55')]){_0xf4b6ee[_0x8a8a('0x56')]=[{'all':!![]}];}_0xf4b6ee=_[_0x8a8a('0x53')]({},_0xf4b6ee,_0x467656[_0x8a8a('0x54')]);return db[_0x8a8a('0x3f')]['find'](_0xf4b6ee)[_0x8a8a('0x22')](handleEntityNotFound(_0x39a8e0,null))[_0x8a8a('0x22')](respondWithResult(_0x39a8e0,null))['catch'](handleError(_0x39a8e0,null));};exports['create']=function(_0x408657,_0x3c3f3d){return db[_0x8a8a('0x3f')][_0x8a8a('0x5c')](_0x408657[_0x8a8a('0x5d')],{})[_0x8a8a('0x22')](function(_0x5ed59c){var _0x481d02=_0x408657['user'][_0x8a8a('0x37')]({'plain':!![]});if(!_0x481d02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x481d02[_0x8a8a('0x5e')]===_0x8a8a('0x5f')){var _0x4e1ca8=_0x5ed59c[_0x8a8a('0x37')]({'plain':!![]});var _0x38ba9f=_0x8a8a('0x38');return db[_0x8a8a('0x60')]['find']({'where':{'name':_0x38ba9f,'userProfileId':_0x481d02[_0x8a8a('0x61')]},'raw':!![]})['then'](function(_0x33db85){if(_0x33db85&&_0x33db85[_0x8a8a('0x62')]===0x0){return db['UserProfileResource'][_0x8a8a('0x5c')]({'name':_0x4e1ca8[_0x8a8a('0x3b')],'resourceId':_0x4e1ca8['id'],'type':_0x33db85[_0x8a8a('0x3b')],'sectionId':_0x33db85['id']},{})[_0x8a8a('0x22')](function(){return _0x5ed59c;});}else{return _0x5ed59c;}})['catch'](function(_0x2b9e36){logger[_0x8a8a('0x28')](_0x8a8a('0x63'),_0x2b9e36);throw _0x2b9e36;});}return _0x5ed59c;})['then'](respondWithResult(_0x3c3f3d,0xc9))['catch'](handleError(_0x3c3f3d,null));};exports[_0x8a8a('0x35')]=function(_0x4a18fb,_0x5a34a6){if(_0x4a18fb['body']['id']){delete _0x4a18fb[_0x8a8a('0x5d')]['id'];}return db[_0x8a8a('0x3f')]['find']({'where':{'id':_0x4a18fb[_0x8a8a('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x8a8a('0x22')](handleEntityNotFound(_0x5a34a6,null))[_0x8a8a('0x22')](saveUpdates(_0x4a18fb['body'],null))[_0x8a8a('0x22')](respondWithResult(_0x5a34a6,null))[_0x8a8a('0x2b')](handleError(_0x5a34a6,null));};exports[_0x8a8a('0x36')]=function(_0x2f0d14,_0x1ceb0c){return db[_0x8a8a('0x3f')]['find']({'where':{'id':_0x2f0d14[_0x8a8a('0x59')]['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x1ceb0c,null))['then'](removeEntity(_0x1ceb0c,null))[_0x8a8a('0x2b')](handleError(_0x1ceb0c,null));};exports[_0x8a8a('0x64')]=function(_0x1d0300,_0x190c45){return db[_0x8a8a('0x3f')][_0x8a8a('0x64')]()[_0x8a8a('0x22')](respondWithResult(_0x190c45,null))[_0x8a8a('0x2b')](handleError(_0x190c45,null));};exports[_0x8a8a('0x65')]=function(_0x176ad3,_0x5eb1f1,_0x35e4a5){if(_0x176ad3[_0x8a8a('0x5d')]['id']){delete _0x176ad3['body']['id'];}return db[_0x8a8a('0x3f')][_0x8a8a('0x66')]({'where':{'id':_0x176ad3[_0x8a8a('0x59')]['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x5eb1f1,null))[_0x8a8a('0x22')](function(_0x4d82bd){if(_0x4d82bd){_0x176ad3[_0x8a8a('0x5d')][_0x8a8a('0x67')]=_0x4d82bd['id'];return db[_0x8a8a('0x68')][_0x8a8a('0x5c')](_0x176ad3[_0x8a8a('0x5d')]);}})[_0x8a8a('0x22')](respondWithResult(_0x5eb1f1,null))[_0x8a8a('0x2b')](handleError(_0x5eb1f1,null));};exports['getDispositions']=function(_0x2a221b,_0x260a6b,_0x35ed30){var _0x50a069={'raw':![],'where':{}};var _0x2f5ef0={};var _0x54c7c1={'count':0x0,'rows':[]};return db[_0x8a8a('0x3f')][_0x8a8a('0x69')]({'where':{'id':_0x2a221b['params']['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x260a6b,null))[_0x8a8a('0x22')](function(_0x2449a9){if(_0x2449a9){_0x2f5ef0[_0x8a8a('0x43')]=_[_0x8a8a('0x44')](db[_0x8a8a('0x68')][_0x8a8a('0x40')]);_0x2f5ef0[_0x8a8a('0x45')]=_[_0x8a8a('0x44')](_0x2a221b[_0x8a8a('0x45')]);_0x2f5ef0[_0x8a8a('0x46')]=_[_0x8a8a('0x48')](_0x2f5ef0[_0x8a8a('0x43')],_0x2f5ef0[_0x8a8a('0x45')]);_0x50a069[_0x8a8a('0x47')]=_[_0x8a8a('0x48')](_0x2f5ef0[_0x8a8a('0x43')],qs[_0x8a8a('0x49')](_0x2a221b['query'][_0x8a8a('0x49')]));_0x50a069['attributes']=_0x50a069[_0x8a8a('0x47')][_0x8a8a('0x4a')]?_0x50a069[_0x8a8a('0x47')]:_0x2f5ef0['model'];if(!_0x2a221b['query'][_0x8a8a('0x4b')](_0x8a8a('0x4c'))){_0x50a069[_0x8a8a('0x30')]=qs['limit'](_0x2a221b['query'][_0x8a8a('0x30')]);_0x50a069[_0x8a8a('0x2f')]=qs[_0x8a8a('0x2f')](_0x2a221b[_0x8a8a('0x45')][_0x8a8a('0x2f')]);}_0x50a069[_0x8a8a('0x4d')]=qs[_0x8a8a('0x4e')](_0x2a221b[_0x8a8a('0x45')]['sort']);_0x50a069[_0x8a8a('0x4f')]=qs[_0x8a8a('0x46')](_['pick'](_0x2a221b[_0x8a8a('0x45')],_0x2f5ef0[_0x8a8a('0x46')]));_0x50a069[_0x8a8a('0x4f')][_0x8a8a('0x67')]=_0x2449a9['id'];if(_0x2a221b[_0x8a8a('0x45')][_0x8a8a('0x51')]){_0x50a069['where']=_[_0x8a8a('0x53')](_0x50a069[_0x8a8a('0x4f')],{'$or':_[_0x8a8a('0x3e')](_0x50a069[_0x8a8a('0x47')],function(_0x16ab6d){var _0x4e95d7={};_0x4e95d7[_0x16ab6d]={'$like':'%'+_0x2a221b[_0x8a8a('0x45')][_0x8a8a('0x51')]+'%'};return _0x4e95d7;})});}_0x50a069=_[_0x8a8a('0x53')]({},_0x50a069,_0x2a221b[_0x8a8a('0x54')]);return db[_0x8a8a('0x68')][_0x8a8a('0x2e')]({'where':_0x50a069[_0x8a8a('0x4f')]})[_0x8a8a('0x22')](function(_0x351f25){_0x54c7c1[_0x8a8a('0x2e')]=_0x351f25;if(_0x2a221b['query'][_0x8a8a('0x55')]){_0x50a069[_0x8a8a('0x56')]=[{'all':!![]}];}return db[_0x8a8a('0x68')][_0x8a8a('0x57')](_0x50a069);})[_0x8a8a('0x22')](function(_0x5ca7b1){_0x54c7c1['rows']=_0x5ca7b1;return _0x54c7c1;});}})[_0x8a8a('0x22')](respondWithFilteredResult(_0x260a6b,_0x50a069))[_0x8a8a('0x2b')](handleError(_0x260a6b,null));};exports[_0x8a8a('0x6a')]=function(_0x50b105,_0x16869b,_0x312350){return db[_0x8a8a('0x3f')][_0x8a8a('0x66')]({'where':{'id':_0x50b105['params']['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x16869b,null))[_0x8a8a('0x22')](function(_0x428558){if(_0x428558){return _0x428558['removeDispositions'](_0x50b105['query']['ids']);}})[_0x8a8a('0x22')](respondWithStatusCode(_0x16869b,null))['catch'](handleError(_0x16869b,null));};exports[_0x8a8a('0x6b')]=function(_0x5a3682,_0x509271,_0x2aec98){if(_0x5a3682['body']['id']){delete _0x5a3682['body']['id'];}return db['FaxAccount'][_0x8a8a('0x66')]({'where':{'id':_0x5a3682['params']['id']}})['then'](handleEntityNotFound(_0x509271,null))[_0x8a8a('0x22')](function(_0x482fa4){if(_0x482fa4){_0x5a3682[_0x8a8a('0x5d')]['FaxAccountId']=_0x482fa4['id'];return db[_0x8a8a('0x6c')][_0x8a8a('0x5c')](_0x5a3682[_0x8a8a('0x5d')]);}})[_0x8a8a('0x22')](respondWithResult(_0x509271,null))['catch'](handleError(_0x509271,null));};exports[_0x8a8a('0x6d')]=function(_0xa1132e,_0x485cc4,_0x395bdd){var _0xf3cf32={'raw':![],'where':{}};var _0x913e4c={};var _0x468669={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xa1132e[_0x8a8a('0x59')]['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x485cc4,null))[_0x8a8a('0x22')](function(_0x5bd333){if(_0x5bd333){_0x913e4c[_0x8a8a('0x43')]=_[_0x8a8a('0x44')](db[_0x8a8a('0x6c')]['rawAttributes']);_0x913e4c[_0x8a8a('0x45')]=_[_0x8a8a('0x44')](_0xa1132e[_0x8a8a('0x45')]);_0x913e4c[_0x8a8a('0x46')]=_[_0x8a8a('0x48')](_0x913e4c['model'],_0x913e4c[_0x8a8a('0x45')]);_0xf3cf32[_0x8a8a('0x47')]=_[_0x8a8a('0x48')](_0x913e4c[_0x8a8a('0x43')],qs[_0x8a8a('0x49')](_0xa1132e[_0x8a8a('0x45')][_0x8a8a('0x49')]));_0xf3cf32['attributes']=_0xf3cf32['attributes'][_0x8a8a('0x4a')]?_0xf3cf32[_0x8a8a('0x47')]:_0x913e4c[_0x8a8a('0x43')];if(!_0xa1132e['query'][_0x8a8a('0x4b')](_0x8a8a('0x4c'))){_0xf3cf32[_0x8a8a('0x30')]=qs[_0x8a8a('0x30')](_0xa1132e[_0x8a8a('0x45')][_0x8a8a('0x30')]);_0xf3cf32[_0x8a8a('0x2f')]=qs[_0x8a8a('0x2f')](_0xa1132e[_0x8a8a('0x45')][_0x8a8a('0x2f')]);}_0xf3cf32['order']=qs[_0x8a8a('0x4e')](_0xa1132e[_0x8a8a('0x45')][_0x8a8a('0x4e')]);_0xf3cf32['where']=qs[_0x8a8a('0x46')](_[_0x8a8a('0x50')](_0xa1132e[_0x8a8a('0x45')],_0x913e4c['filters']));_0xf3cf32['where'][_0x8a8a('0x67')]=_0x5bd333['id'];if(_0xa1132e[_0x8a8a('0x45')][_0x8a8a('0x51')]){_0xf3cf32[_0x8a8a('0x4f')]=_['merge'](_0xf3cf32[_0x8a8a('0x4f')],{'$or':_[_0x8a8a('0x3e')](_0xf3cf32[_0x8a8a('0x47')],function(_0xa23098){var _0x5df060={};_0x5df060[_0xa23098]={'$like':'%'+_0xa1132e['query'][_0x8a8a('0x51')]+'%'};return _0x5df060;})});}_0xf3cf32=_[_0x8a8a('0x53')]({},_0xf3cf32,_0xa1132e[_0x8a8a('0x54')]);return db['CannedAnswer'][_0x8a8a('0x2e')]({'where':_0xf3cf32[_0x8a8a('0x4f')]})[_0x8a8a('0x22')](function(_0x198083){_0x468669[_0x8a8a('0x2e')]=_0x198083;if(_0xa1132e['query'][_0x8a8a('0x55')]){_0xf3cf32['include']=[{'all':!![]}];}return db[_0x8a8a('0x6c')][_0x8a8a('0x57')](_0xf3cf32);})[_0x8a8a('0x22')](function(_0x60fbf2){_0x468669[_0x8a8a('0x58')]=_0x60fbf2;return _0x468669;});}})[_0x8a8a('0x22')](respondWithFilteredResult(_0x485cc4,_0xf3cf32))['catch'](handleError(_0x485cc4,null));};exports[_0x8a8a('0x6e')]=function(_0x257c5d,_0x4c2010,_0x5b4fa9){return db[_0x8a8a('0x3f')][_0x8a8a('0x66')]({'where':{'id':_0x257c5d['params']['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x4c2010,null))['then'](function(_0x4a774d){if(_0x4a774d){return _0x4a774d[_0x8a8a('0x6e')](_0x257c5d[_0x8a8a('0x45')][_0x8a8a('0x6f')]);}})['then'](respondWithStatusCode(_0x4c2010,null))[_0x8a8a('0x2b')](handleError(_0x4c2010,null));};exports[_0x8a8a('0x70')]=function(_0x86cab6,_0x311010,_0x232ab9){return db[_0x8a8a('0x71')]['find']({'where':{'id':_0x86cab6['params']['id']}})['then'](handleEntityNotFound(_0x311010,null))[_0x8a8a('0x22')](function(_0x3bd4e6){if(_0x3bd4e6){return _0x3bd4e6[_0x8a8a('0x70')](_0x86cab6[_0x8a8a('0x5d')][_0x8a8a('0x6f')],_[_0x8a8a('0x72')](_0x86cab6[_0x8a8a('0x5d')],[_0x8a8a('0x6f'),'id'])||{});}})[_0x8a8a('0x22')](respondWithResult(_0x311010,null))['catch'](handleError(_0x311010,null));};exports[_0x8a8a('0x73')]=function(_0x41180e,_0x2f3fb5,_0x6c6aae){var _0x40b73c={'raw':![],'where':{}};var _0xce1136={};var _0x514522={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x41180e[_0x8a8a('0x59')]['id']}})['then'](handleEntityNotFound(_0x2f3fb5,null))[_0x8a8a('0x22')](function(_0x5383c3){if(_0x5383c3){_0xce1136[_0x8a8a('0x43')]=_['keys'](db[_0x8a8a('0x71')][_0x8a8a('0x40')]);_0xce1136['query']=_[_0x8a8a('0x44')](_0x41180e['query']);_0xce1136['filters']=_[_0x8a8a('0x48')](_0xce1136['model'],_0xce1136[_0x8a8a('0x45')]);_0x40b73c['attributes']=_[_0x8a8a('0x48')](_0xce1136['model'],qs[_0x8a8a('0x49')](_0x41180e[_0x8a8a('0x45')][_0x8a8a('0x49')]));_0x40b73c[_0x8a8a('0x47')]=_0x40b73c['attributes'][_0x8a8a('0x4a')]?_0x40b73c[_0x8a8a('0x47')]:_0xce1136[_0x8a8a('0x43')];if(!_0x41180e[_0x8a8a('0x45')]['hasOwnProperty'](_0x8a8a('0x4c'))){_0x40b73c[_0x8a8a('0x30')]=qs[_0x8a8a('0x30')](_0x41180e['query'][_0x8a8a('0x30')]);_0x40b73c[_0x8a8a('0x2f')]=qs[_0x8a8a('0x2f')](_0x41180e[_0x8a8a('0x45')][_0x8a8a('0x2f')]);}_0x40b73c['order']=qs['sort'](_0x41180e[_0x8a8a('0x45')][_0x8a8a('0x4e')]);_0x40b73c[_0x8a8a('0x4f')]=qs['filters'](_[_0x8a8a('0x50')](_0x41180e[_0x8a8a('0x45')],_0xce1136['filters']));_0x40b73c['where'][_0x8a8a('0x67')]=_0x5383c3['id'];if(_0x41180e[_0x8a8a('0x45')][_0x8a8a('0x51')]){_0x40b73c['where']=_[_0x8a8a('0x53')](_0x40b73c[_0x8a8a('0x4f')],{'$or':_['map'](_0x40b73c[_0x8a8a('0x47')],function(_0x3120ae){var _0x5ab942={};_0x5ab942[_0x3120ae]={'$like':'%'+_0x41180e[_0x8a8a('0x45')]['filter']+'%'};return _0x5ab942;})});}_0x40b73c=_[_0x8a8a('0x53')]({},_0x40b73c,_0x41180e[_0x8a8a('0x54')]);return db['FaxInteraction'][_0x8a8a('0x2e')]({'where':_0x40b73c[_0x8a8a('0x4f')]})['then'](function(_0x6ed921){_0x514522['count']=_0x6ed921;if(_0x41180e[_0x8a8a('0x45')][_0x8a8a('0x55')]){_0x40b73c['include']=[{'model':db[_0x8a8a('0x74')],'as':_0x8a8a('0x75'),'required':![]},{'model':db[_0x8a8a('0x76')],'as':'Owner','attributes':[_0x8a8a('0x3b'),'fullname',_0x8a8a('0x77')],'required':![]},{'model':db[_0x8a8a('0x78')],'as':_0x8a8a('0x79'),'attributes':['id',_0x8a8a('0x3b'),_0x8a8a('0x7a')],'where':_0x41180e['query'][_0x8a8a('0x7b')]?{'id':_0x41180e[_0x8a8a('0x45')]['tag']}:undefined,'required':_0x41180e[_0x8a8a('0x45')][_0x8a8a('0x7b')]?!![]:![]}];}return db[_0x8a8a('0x71')]['findAll'](_0x40b73c);})['then'](function(_0x35d9e2){_0x514522[_0x8a8a('0x58')]=_0x35d9e2;return _0x514522;});}})[_0x8a8a('0x22')](respondWithFilteredResult(_0x2f3fb5,_0x40b73c))[_0x8a8a('0x2b')](handleError(_0x2f3fb5,null));};exports[_0x8a8a('0x7c')]=function(_0x1f15dd,_0x36e2e3,_0x4fb390){return db['FaxAccount']['findOne']({'where':{'id':_0x1f15dd[_0x8a8a('0x59')]['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x36e2e3,null))[_0x8a8a('0x22')](function(_0x516c1a){if(_0x516c1a){return db[_0x8a8a('0x7d')][_0x8a8a('0x7e')](function(_0x39d705){return db[_0x8a8a('0x7f')][_0x8a8a('0x36')]({'where':{'FaxAccountId':_0x1f15dd['params']['id']},'transaction':_0x39d705})[_0x8a8a('0x22')](function(_0xde7f73){var _0x229092=_['map'](_0x1f15dd[_0x8a8a('0x5d')],function(_0x42c751){_0x42c751[_0x8a8a('0x67')]=_0x1f15dd['params']['id'];return _0x42c751;});return db['FaxApplication'][_0x8a8a('0x80')](_0x229092,{'transaction':_0x39d705});});})[_0x8a8a('0x22')](function(){return db[_0x8a8a('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x1f15dd[_0x8a8a('0x59')]['id']},'order':_0x8a8a('0x81')});});}})['then'](respondWithResult(_0x36e2e3,null))[_0x8a8a('0x2b')](handleError(_0x36e2e3,null));};exports[_0x8a8a('0x82')]=function(_0x53019a,_0x217c56,_0x560002){var _0x570ad2={};var _0x2a8210={};var _0x16c1b7;var _0x5c5aa7;return db['FaxAccount']['findOne']({'where':{'id':_0x53019a[_0x8a8a('0x59')]['id']}})['then'](handleEntityNotFound(_0x217c56,null))['then'](function(_0xc0fb22){if(_0xc0fb22){_0x16c1b7=_0xc0fb22;_0x2a8210[_0x8a8a('0x43')]=_['keys'](db[_0x8a8a('0x7f')][_0x8a8a('0x40')]);_0x2a8210[_0x8a8a('0x45')]=_[_0x8a8a('0x44')](_0x53019a[_0x8a8a('0x45')]);_0x2a8210['filters']=_[_0x8a8a('0x48')](_0x2a8210['model'],_0x2a8210[_0x8a8a('0x45')]);_0x570ad2[_0x8a8a('0x47')]=_[_0x8a8a('0x48')](_0x2a8210[_0x8a8a('0x43')],qs['fields'](_0x53019a['query'][_0x8a8a('0x49')]));_0x570ad2[_0x8a8a('0x47')]=_0x570ad2['attributes'][_0x8a8a('0x4a')]?_0x570ad2[_0x8a8a('0x47')]:_0x2a8210['model'];_0x570ad2[_0x8a8a('0x4d')]=qs[_0x8a8a('0x4e')](_0x53019a[_0x8a8a('0x45')]['sort']);_0x570ad2['where']=qs[_0x8a8a('0x46')](_['pick'](_0x53019a[_0x8a8a('0x45')],_0x2a8210['filters']));if(_0x53019a[_0x8a8a('0x45')]['filter']){_0x570ad2['where']=_['merge'](_0x570ad2['where'],{'$or':_[_0x8a8a('0x3e')](_0x570ad2[_0x8a8a('0x47')],function(_0x18b14b){var _0x5d955f={};_0x5d955f[_0x18b14b]={'$like':'%'+_0x53019a[_0x8a8a('0x45')][_0x8a8a('0x51')]+'%'};return _0x5d955f;})});}_0x570ad2=_[_0x8a8a('0x53')]({},_0x570ad2,_0x53019a[_0x8a8a('0x54')]);return _0x16c1b7[_0x8a8a('0x82')](_0x570ad2);}})[_0x8a8a('0x22')](function(_0xbceabe){if(_0xbceabe){_0x5c5aa7=_0xbceabe['length'];if(!_0x53019a['query'][_0x8a8a('0x4b')](_0x8a8a('0x4c'))){_0x570ad2[_0x8a8a('0x30')]=qs['limit'](_0x53019a[_0x8a8a('0x45')][_0x8a8a('0x30')]);_0x570ad2[_0x8a8a('0x2f')]=qs[_0x8a8a('0x2f')](_0x53019a['query']['offset']);}return _0x16c1b7[_0x8a8a('0x82')](_0x570ad2);}})[_0x8a8a('0x22')](function(_0x826146){if(_0x826146){return _0x826146?{'count':_0x5c5aa7,'rows':_0x826146}:null;}})[_0x8a8a('0x22')](respondWithResult(_0x217c56,null))[_0x8a8a('0x2b')](handleError(_0x217c56,null));};function Extension(_0xa20ac9,_0x40a76d,_0x9b7709,_0x53dd6d){this[_0x8a8a('0x83')]=_0x8a8a('0x84');this['exten']=_0xa20ac9[_0x8a8a('0x85')];this[_0x8a8a('0x86')]=_0x53dd6d;this[_0x8a8a('0x42')]=_0x8a8a('0x87');this[_0x8a8a('0x88')]=_0x8a8a('0x89');this[_0x8a8a('0x67')]=_0xa20ac9['id'];this[_0x8a8a('0x81')]=_0x40a76d;this[_0x8a8a('0x8a')]=_0x9b7709;}function createExtensionsReciveFax(_0x20f562){var _0x34e9ae=0x1;var _0x526916=[];_0x526916[_0x8a8a('0x8b')](new Extension(_0x20f562,_0x34e9ae,'',_0x8a8a('0x8c')));_0x34e9ae+=0x1;_0x526916[_0x8a8a('0x8b')](new Extension(_0x20f562,_0x34e9ae,_0x8a8a('0x8d'),'Set'));_0x34e9ae+=0x1;for(var _0x44561a in _0x20f562){if(_0x20f562[_0x8a8a('0x4b')](_0x44561a)&&(_0x44561a===_0x8a8a('0x8e')||_0x44561a===_0x8a8a('0x85')||_0x44561a===_0x8a8a('0x8f')||_0x44561a===_0x8a8a('0x90')||_0x44561a==='headerinfo'||_0x44561a===_0x8a8a('0x91')||_0x44561a===_0x8a8a('0x92')||_0x44561a===_0x8a8a('0x93')||_0x44561a===_0x8a8a('0x94'))){_0x526916[_0x8a8a('0x8b')](new Extension(_0x20f562,_0x34e9ae,_0x8a8a('0x95')+_0x44561a+')='+_0x20f562[_0x44561a],_0x8a8a('0x96')));_0x34e9ae+=0x1;}}_0x526916[_0x8a8a('0x8b')](new Extension(_0x20f562,_0x34e9ae,'6','Wait'));_0x34e9ae+=0x1;_0x526916[_0x8a8a('0x8b')](new Extension(_0x20f562,_0x34e9ae,_0x8a8a('0x97'),_0x8a8a('0x98')));_0x34e9ae=0x0;return _0x526916;}exports[_0x8a8a('0x99')]=function(_0x140f63,_0xb28691,_0x1f9549){var _0xc79caa;return db[_0x8a8a('0x7d')]['transaction'](function(_0x6f8834){return db[_0x8a8a('0x3f')][_0x8a8a('0x5c')](_0x140f63[_0x8a8a('0x5d')],{'transaction':_0x6f8834})[_0x8a8a('0x22')](function(_0x5d26f4){_0xc79caa=_0x5d26f4[_0x8a8a('0x37')]({'plain':!![]});return db[_0x8a8a('0x9a')][_0x8a8a('0x80')](createExtensionsReciveFax(_0xc79caa),{'transaction':_0x6f8834});});})[_0x8a8a('0x22')](function(){return _0xc79caa;})[_0x8a8a('0x22')](respondWithResult(_0xb28691,null))['catch'](handleError(_0xb28691,null));};exports['updateAccountApplications']=function(_0x57c44c,_0x2b8cf5,_0x3074a2){var _0x24a0e0;return db[_0x8a8a('0x7d')][_0x8a8a('0x7e')](function(_0x20fb62){return db['FaxAccount'][_0x8a8a('0x35')](_0x57c44c[_0x8a8a('0x5d')],{'where':{'id':_0x57c44c[_0x8a8a('0x5d')]['id']},'transaction':_0x20fb62})['then'](function(_0x421d3a){return db[_0x8a8a('0x9a')][_0x8a8a('0x36')]({'where':{'FaxAccountId':_0x57c44c['body']['id']},'transaction':_0x20fb62})[_0x8a8a('0x22')](function(_0x43d16f){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x8a8a('0x72')](_0x57c44c['body'],['tech','key',_0x8a8a('0x9b'),_0x8a8a('0x9c'),_0x8a8a('0x9d'),_0x8a8a('0x9e')])),{'transaction':_0x20fb62});});});})['then'](function(){return db[_0x8a8a('0x3f')]['findById'](_0x57c44c[_0x8a8a('0x5d')]['id']);})[_0x8a8a('0x22')](respondWithResult(_0x2b8cf5,null))['catch'](handleError(_0x2b8cf5,null));};exports[_0x8a8a('0x9f')]=function(_0x23bb72,_0x5f2823,_0x3b3c55){var _0x14cc59={'raw':!![],'where':{}};var _0x5e9e59={};var _0x3fc794={'count':0x0,'rows':[]};return db[_0x8a8a('0x3f')][_0x8a8a('0x69')]({'where':{'id':_0x23bb72[_0x8a8a('0x59')]['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x5f2823,null))['then'](function(_0x5ab5e1){if(_0x5ab5e1){_0x5e9e59[_0x8a8a('0x43')]=_[_0x8a8a('0x44')](db['FaxMessage'][_0x8a8a('0x40')]);_0x5e9e59[_0x8a8a('0x45')]=_[_0x8a8a('0x44')](_0x23bb72[_0x8a8a('0x45')]);_0x5e9e59[_0x8a8a('0x46')]=_[_0x8a8a('0x48')](_0x5e9e59[_0x8a8a('0x43')],_0x5e9e59[_0x8a8a('0x45')]);_0x14cc59[_0x8a8a('0x47')]=_[_0x8a8a('0x48')](_0x5e9e59[_0x8a8a('0x43')],qs[_0x8a8a('0x49')](_0x23bb72[_0x8a8a('0x45')]['fields']));_0x14cc59[_0x8a8a('0x47')]=_0x14cc59[_0x8a8a('0x47')][_0x8a8a('0x4a')]?_0x14cc59['attributes']:_0x5e9e59[_0x8a8a('0x43')];if(!_0x23bb72[_0x8a8a('0x45')][_0x8a8a('0x4b')](_0x8a8a('0x4c'))){_0x14cc59[_0x8a8a('0x30')]=qs[_0x8a8a('0x30')](_0x23bb72[_0x8a8a('0x45')][_0x8a8a('0x30')]);_0x14cc59[_0x8a8a('0x2f')]=qs[_0x8a8a('0x2f')](_0x23bb72[_0x8a8a('0x45')]['offset']);}_0x14cc59[_0x8a8a('0x4d')]=qs[_0x8a8a('0x4e')](_0x23bb72[_0x8a8a('0x45')][_0x8a8a('0x4e')]);_0x14cc59[_0x8a8a('0x4f')]=qs[_0x8a8a('0x46')](_[_0x8a8a('0x50')](_0x23bb72['query'],_0x5e9e59[_0x8a8a('0x46')]));_0x14cc59[_0x8a8a('0x4f')]['FaxAccountId']=_0x5ab5e1['id'];if(_0x23bb72[_0x8a8a('0x45')]['filter']){_0x14cc59[_0x8a8a('0x4f')]=_[_0x8a8a('0x53')](_0x14cc59['where'],{'$or':_[_0x8a8a('0x3e')](_0x14cc59[_0x8a8a('0x47')],function(_0x575c6e){var _0x316a2c={};_0x316a2c[_0x575c6e]={'$like':'%'+_0x23bb72[_0x8a8a('0x45')]['filter']+'%'};return _0x316a2c;})});}if(_0x23bb72[_0x8a8a('0x45')]['$gte']){var _0x1576ae=_0x23bb72[_0x8a8a('0x45')][_0x8a8a('0xa0')]['split'](',');var _0x5723c1={};_0x5723c1[_0x1576ae[0x0]]={'$gte':moment(_0x1576ae[0x1])[_0x8a8a('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x14cc59[_0x8a8a('0x4f')]=_['merge'](_0x14cc59['where'],_0x5723c1);}_0x14cc59=_[_0x8a8a('0x53')]({},_0x14cc59,_0x23bb72['options']);return db['FaxMessage'][_0x8a8a('0x2e')]({'where':_0x14cc59[_0x8a8a('0x4f')]})[_0x8a8a('0x22')](function(_0x477825){_0x3fc794[_0x8a8a('0x2e')]=_0x477825;if(_0x23bb72['query'][_0x8a8a('0x55')]){_0x14cc59[_0x8a8a('0x56')]=[{'all':!![]}];}return db[_0x8a8a('0xa2')]['findAll'](_0x14cc59);})[_0x8a8a('0x22')](function(_0x5de5ae){_0x3fc794['rows']=_0x5de5ae;return _0x3fc794;});}})['then'](respondWithFilteredResult(_0x5f2823,_0x14cc59))[_0x8a8a('0x2b')](handleError(_0x5f2823,null));};exports['send']=function(_0x4d31f3,_0x484cc6,_0x203b2d){var _0x159c37,_0x39b6ac={},_0x1a039b;if(_0x4d31f3['body']['to']){_0x1a039b=_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0];}return db[_0x8a8a('0x3f')][_0x8a8a('0x66')]({'where':{'id':_0x4d31f3['params']['id']},'include':[{'model':db[_0x8a8a('0xa3')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8a8a('0xa4'),'where':{'fax':_0x1a039b},'limit':0x1,'order':[[_0x8a8a('0x9c'),_0x8a8a('0xa5')]]}]}]})[_0x8a8a('0x22')](handleEntityNotFound(_0x484cc6,null))[_0x8a8a('0x22')](function(_0x5b7d9c){_0x159c37=_0x5b7d9c;if(_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')]&&_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')][_0x8a8a('0x4a')]){for(var _0x410f90=0x0;_0x410f90<_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')][_0x8a8a('0x4a')];_0x410f90+=0x1){_0x4d31f3['body'][_0x8a8a('0xa6')][_0x410f90]={'filename':_0x4d31f3['body'][_0x8a8a('0xa6')][_0x410f90][_0x8a8a('0x3b')],'id':_0x4d31f3['body']['attachments'][_0x410f90]['id'],'path':path[_0x8a8a('0xa7')](config[_0x8a8a('0xa8')],_0x8a8a('0xa9'),_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')][_0x410f90][_0x8a8a('0xaa')])};}}return respondWithRpcPromise(_0x8a8a('0xab'),_0x8a8a('0xab'),{'FaxAccountId':_[_0x8a8a('0xac')](_0x4d31f3[_0x8a8a('0x59')]['id'])?undefined:_0x4d31f3[_0x8a8a('0x59')]['id'],'path':_[_0x8a8a('0xac')](_0x4d31f3[_0x8a8a('0x5d')]['attachments'][0x0][_0x8a8a('0x9')])?undefined:_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')][0x0][_0x8a8a('0x9')],'fax':_[_0x8a8a('0xac')](_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0])?undefined:_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0]},client9002);})[_0x8a8a('0x22')](function(){if(_0x159c37){if(_[_0x8a8a('0xac')](_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xad')])){_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xad')]=util[_0x8a8a('0xa1')](_0x8a8a('0xae'),_0x159c37[_0x8a8a('0x3b')],_0x159c37[_0x8a8a('0xaf')]);}if(_0x159c37[_0x8a8a('0xb0')]){if(_0x159c37[_0x8a8a('0xb0')][_0x8a8a('0xa4')][_0x8a8a('0x4a')]){return _0x159c37[_0x8a8a('0xb0')][_0x8a8a('0xa4')][0x0];}else{return db[_0x8a8a('0x74')][_0x8a8a('0x5c')](_[_0x8a8a('0x1b')](_0x4d31f3[_0x8a8a('0x5d')],{'firstName':_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0],'phone':_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0],'fax':_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0],'ListId':_0x159c37[_0x8a8a('0x9e')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x8a8a('0x22')](function(_0x55d97e){if(_0x55d97e){return db[_0x8a8a('0x71')][_0x8a8a('0x66')]({'where':{'ContactId':_0x55d97e['id'],'closed':![],'FaxAccountId':_0x159c37['id']}})[_0x8a8a('0x22')](function(_0x12e90f){if(_0x12e90f){return[_0x12e90f,![]];}return db['FaxInteraction'][_0x8a8a('0x5c')]({'UserId':_0x4d31f3[_0x8a8a('0x5f')]['id'],'ContactId':_0x55d97e['id'],'FaxAccountId':_0x159c37['id'],'fax':_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0],'firstMsgDirection':_0x8a8a('0xb1'),'Messages':[_[_0x8a8a('0x53')](_0x4d31f3[_0x8a8a('0x5d')],{'read':![],'body':_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')][0x0][_0x8a8a('0xb2')],'FaxAccountId':_0x159c37['id'],'UserId':_0x4d31f3[_0x8a8a('0x5f')]['id'],'ContactId':_0x55d97e['id'],'AttachmentId':_0x4d31f3[_0x8a8a('0x5d')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x8a8a('0xa2')],'as':_0x8a8a('0xb3')}]})[_0x8a8a('0x22')](function(_0xb2fc5b){return[_0xb2fc5b,!![]];});});}else{throw new Error(_0x8a8a('0xb4'));}})[_0x8a8a('0xb5')](function(_0x413ab7,_0x32cc2a){if(_0x32cc2a){return _0x413ab7;}return db[_0x8a8a('0xa2')][_0x8a8a('0x5c')]({'direction':_0x8a8a('0xb1'),'read':![],'body':_0x4d31f3['body'][_0x8a8a('0xa6')][0x0][_0x8a8a('0xb2')],'FaxAccountId':_0x159c37['id'],'FaxInteractionId':_0x413ab7['id'],'UserId':_0x4d31f3[_0x8a8a('0x5f')]['id'],'ContactId':_0x413ab7[_0x8a8a('0xb6')],'AttachmentId':_0x4d31f3[_0x8a8a('0x5d')]['attachments'][0x0]['id']})['then'](function(_0x18dcfb){_0x413ab7[_0x8a8a('0xb7')][_0x8a8a('0xb3')]=[];_0x413ab7[_0x8a8a('0xb7')][_0x8a8a('0xb3')]['push'](_0x18dcfb[_0x8a8a('0xb7')]);return _0x413ab7;});})[_0x8a8a('0x22')](function(_0x10ee6a){respondWithRpcPromise(_0x8a8a('0xb8'),_0x8a8a('0xb8'),{'FaxAccountId':_[_0x8a8a('0xac')](_0x4d31f3[_0x8a8a('0x59')]['id'])?undefined:_0x4d31f3['params']['id'],'path':_[_0x8a8a('0xac')](_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')][0x0][_0x8a8a('0x9')])?undefined:_0x4d31f3[_0x8a8a('0x5d')][_0x8a8a('0xa6')][0x0][_0x8a8a('0x9')],'fax':_[_0x8a8a('0xac')](_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0])?undefined:_0x4d31f3[_0x8a8a('0x5d')]['to'][0x0],'AttachmentId':_0x4d31f3[_0x8a8a('0x5d')]['attachments'][0x0]['id']},client9002)[_0x8a8a('0x22')](function(_0x1d88b0){logger[_0x8a8a('0x23')](_0x8a8a('0xb9'),_0x1d88b0);})[_0x8a8a('0x2b')](function(_0x507f37){logger['info'](_0x8a8a('0xb9'),_0x507f37);});return _0x10ee6a;})[_0x8a8a('0x22')](respondWithResult(_0x484cc6,null))['catch'](handleError(_0x484cc6,null));};exports[_0x8a8a('0xba')]=function(_0x44a39c,_0x5f3a62,_0x251d6a){return db[_0x8a8a('0x3f')][_0x8a8a('0x66')]({'where':{'id':_0x44a39c[_0x8a8a('0x59')]['id']}})['then'](handleEntityNotFound(_0x5f3a62,null))[_0x8a8a('0x22')](function(_0x37de79){if(_0x37de79){return _0x37de79[_0x8a8a('0xba')](_0x44a39c[_0x8a8a('0x5d')]['ids'],_[_0x8a8a('0x72')](_0x44a39c[_0x8a8a('0x5d')],['ids','id'])||{})[_0x8a8a('0xb5')](function(_0x411a70){for(var _0x39c289=0x0;_0x39c289<_0x44a39c[_0x8a8a('0x5d')][_0x8a8a('0x6f')][_0x8a8a('0x4a')];_0x39c289+=0x1){socket[_0x8a8a('0xbb')](_0x8a8a('0xbc'),{'UserId':_0x44a39c[_0x8a8a('0x5d')][_0x8a8a('0x6f')][_0x39c289],'FaxAccountId':_0x44a39c[_0x8a8a('0x59')]['id']});}return _0x411a70;});}})[_0x8a8a('0x22')](respondWithResult(_0x5f3a62,null))['catch'](handleError(_0x5f3a62,null));};exports[_0x8a8a('0xbd')]=function(_0x4d3ecf,_0x2f1516,_0x4b334b){return db[_0x8a8a('0x3f')][_0x8a8a('0x66')]({'where':{'id':_0x4d3ecf[_0x8a8a('0x59')]['id']}})[_0x8a8a('0x22')](handleEntityNotFound(_0x2f1516,null))['then'](function(_0x14b1fb){if(_0x14b1fb){return _0x14b1fb['removeAgents'](_0x4d3ecf[_0x8a8a('0x45')][_0x8a8a('0x6f')])[_0x8a8a('0x22')](function(){if(_[_0x8a8a('0xbe')](_0x4d3ecf[_0x8a8a('0x45')][_0x8a8a('0x6f')])){for(var _0x1edb12=0x0;_0x1edb12<_0x4d3ecf[_0x8a8a('0x45')]['ids']['length'];_0x1edb12+=0x1){socket[_0x8a8a('0xbb')](_0x8a8a('0xbf'),{'UserId':Number(_0x4d3ecf[_0x8a8a('0x45')][_0x8a8a('0x6f')][_0x1edb12]),'FaxAccountId':Number(_0x4d3ecf[_0x8a8a('0x59')]['id'])});}}else{socket[_0x8a8a('0xbb')](_0x8a8a('0xbf'),{'UserId':Number(_0x4d3ecf[_0x8a8a('0x45')][_0x8a8a('0x6f')]),'FaxAccountId':Number(_0x4d3ecf[_0x8a8a('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f1516,null))['catch'](handleError(_0x2f1516,null));};exports[_0x8a8a('0xc0')]=function(_0x410810,_0x4bffba,_0x1798fe){var _0xf1df9e={};var _0x39f4a8={};var _0x5eec17;var _0x360d1d;return db[_0x8a8a('0x3f')][_0x8a8a('0x69')]({'where':{'id':_0x410810['params']['id']}})['then'](handleEntityNotFound(_0x4bffba,null))[_0x8a8a('0x22')](function(_0x25d338){if(_0x25d338){_0x5eec17=_0x25d338;_0x39f4a8[_0x8a8a('0x43')]=_[_0x8a8a('0x44')](db[_0x8a8a('0x76')][_0x8a8a('0x40')]);_0x39f4a8[_0x8a8a('0x45')]=_['keys'](_0x410810['query']);_0x39f4a8[_0x8a8a('0x46')]=_[_0x8a8a('0x48')](_0x39f4a8['model'],_0x39f4a8[_0x8a8a('0x45')]);_0xf1df9e['attributes']=_['intersection'](_0x39f4a8['model'],qs[_0x8a8a('0x49')](_0x410810[_0x8a8a('0x45')][_0x8a8a('0x49')]));_0xf1df9e[_0x8a8a('0x47')]=_0xf1df9e[_0x8a8a('0x47')][_0x8a8a('0x4a')]?_0xf1df9e['attributes']:_0x39f4a8['model'];_0xf1df9e['order']=qs[_0x8a8a('0x4e')](_0x410810[_0x8a8a('0x45')][_0x8a8a('0x4e')]);_0xf1df9e['where']=qs['filters'](_['pick'](_0x410810[_0x8a8a('0x45')],_0x39f4a8['filters']));if(_0x410810[_0x8a8a('0x45')][_0x8a8a('0x51')]){_0xf1df9e['where']=_[_0x8a8a('0x53')](_0xf1df9e['where'],{'$or':_['map'](_0xf1df9e[_0x8a8a('0x47')],function(_0x3f3b09){var _0x220434={};_0x220434[_0x3f3b09]={'$like':'%'+_0x410810['query'][_0x8a8a('0x51')]+'%'};return _0x220434;})});}_0xf1df9e=_[_0x8a8a('0x53')]({},_0xf1df9e,_0x410810['options']);return _0x5eec17[_0x8a8a('0xc0')](_0xf1df9e);}})[_0x8a8a('0x22')](function(_0x144fb4){if(_0x144fb4){_0x360d1d=_0x144fb4[_0x8a8a('0x4a')];if(!_0x410810[_0x8a8a('0x45')][_0x8a8a('0x4b')]('nolimit')){_0xf1df9e[_0x8a8a('0x30')]=qs[_0x8a8a('0x30')](_0x410810[_0x8a8a('0x45')][_0x8a8a('0x30')]);_0xf1df9e[_0x8a8a('0x2f')]=qs['offset'](_0x410810[_0x8a8a('0x45')]['offset']);}return _0x5eec17[_0x8a8a('0xc0')](_0xf1df9e);}})[_0x8a8a('0x22')](function(_0x2c415a){if(_0x2c415a){return _0x2c415a?{'count':_0x360d1d,'rows':_0x2c415a}:null;}})[_0x8a8a('0x22')](respondWithResult(_0x4bffba,null))[_0x8a8a('0x2b')](handleError(_0x4bffba,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 506f69d..f8b8693 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 _0xe9b7=['setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb','FaxAccount'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xe9b7,0x96));var _0x7e9b=function(_0x324271,_0x59e968){_0x324271=_0x324271-0x0;var _0x31ef5a=_0xe9b7[_0x324271];return _0x31ef5a;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x7e9b('0x0'))['db'][_0x7e9b('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7e9b('0x2')](0x0);var events={'afterCreate':_0x7e9b('0x3'),'afterUpdate':_0x7e9b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d3480){return function(_0x52db82,_0xb72834,_0x8f3564){FaxAccountEvents[_0x7e9b('0x5')](_0x3d3480+':'+_0x52db82['id'],_0x52db82);FaxAccountEvents['emit'](_0x3d3480,_0x52db82);_0x8f3564(null);};}for(var e in events){if(events[_0x7e9b('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x7e9b('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x1d32=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x4a1d96,_0x5c4039){var _0x1d52eb=function(_0x470da5){while(--_0x470da5){_0x4a1d96['push'](_0x4a1d96['shift']());}};_0x1d52eb(++_0x5c4039);}(_0x1d32,0x1bf));var _0x21d3=function(_0x1c76be,_0x4b2c4f){_0x1c76be=_0x1c76be-0x0;var _0x55a252=_0x1d32[_0x1c76be];return _0x55a252;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x21d3('0x0'))['db'][_0x21d3('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x21d3('0x2')](0x0);var events={'afterCreate':_0x21d3('0x3'),'afterUpdate':_0x21d3('0x4'),'afterDestroy':_0x21d3('0x5')};function emitEvent(_0x2c909b){return function(_0x4775a9,_0x16ba75,_0x538dcd){FaxAccountEvents[_0x21d3('0x6')](_0x2c909b+':'+_0x4775a9['id'],_0x4775a9);FaxAccountEvents['emit'](_0x2c909b,_0x4775a9);_0x538dcd(null);};}for(var e in events){if(events[_0x21d3('0x7')](e)){var event=events[e];FaxAccount[_0x21d3('0x8')](e,emitEvent(event));}}module[_0x21d3('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 bb38790..f15fe47 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 _0x1076=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util'];(function(_0x5ecb26,_0xdd72bd){var _0x5c374a=function(_0x27443a){while(--_0x27443a){_0x5ecb26['push'](_0x5ecb26['shift']());}};_0x5c374a(++_0xdd72bd);}(_0x1076,0x1cc));var _0x6107=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x1076[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x6107('0x0'));var util=require(_0x6107('0x1'));var logger=require(_0x6107('0x2'))(_0x6107('0x3'));var moment=require(_0x6107('0x4'));var BPromise=require(_0x6107('0x5'));var rp=require(_0x6107('0x6'));var fs=require('fs');var path=require(_0x6107('0x7'));var rimraf=require(_0x6107('0x8'));var config=require(_0x6107('0x9'));var attributes=require(_0x6107('0xa'));module[_0x6107('0xb')]=function(_0x14525e,_0x31d5aa){return _0x14525e[_0x6107('0xc')]('FaxAccount',attributes,{'tableName':_0x6107('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd383=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','api','moment','path'];(function(_0x4fe263,_0x352aa5){var _0x3f8009=function(_0x1dfb8d){while(--_0x1dfb8d){_0x4fe263['push'](_0x4fe263['shift']());}};_0x3f8009(++_0x352aa5);}(_0xd383,0x92));var _0x3d38=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xd383[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0x3d38('0x0'));var logger=require('../../config/logger')(_0x3d38('0x1'));var moment=require(_0x3d38('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d38('0x3'));var rimraf=require('rimraf');var config=require(_0x3d38('0x4'));var attributes=require(_0x3d38('0x5'));module[_0x3d38('0x6')]=function(_0x1f04e8,_0x3a1fa0){return _0x1f04e8[_0x3d38('0x7')](_0x3d38('0x8'),attributes,{'tableName':_0x3d38('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index d5c7789..0027641 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 _0x1f63=['DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','create','contact','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','model','include','map','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','createdAt','ListId','body','isNil','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','find','account','CmList','List','updatedAt'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x1f63,0x7a));var _0x31f6=function(_0x19e9df,_0x376814){_0x19e9df=_0x19e9df-0x0;var _0x2d989e=_0x1f63[_0x19e9df];return _0x2d989e;};'use strict';var _=require(_0x31f6('0x0'));var util=require(_0x31f6('0x1'));var moment=require('moment');var BPromise=require(_0x31f6('0x2'));var rs=require(_0x31f6('0x3'));var fs=require('fs');var Redis=require(_0x31f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x31f6('0x5'));var logger=require(_0x31f6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x31f6('0x7'));var client=jayson[_0x31f6('0x8')][_0x31f6('0x9')]({'port':0x232c});config['redis']=_[_0x31f6('0xa')](config[_0x31f6('0xb')],{'host':_0x31f6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x31f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x3a7c66,_0x1a97fb,_0x5fa32b){return new BPromise(function(_0xd406d6,_0x2cc4be){return client[_0x31f6('0xe')](_0x3a7c66,_0x5fa32b)[_0x31f6('0xf')](function(_0x2b7283){logger['info'](_0x31f6('0x10'),_0x1a97fb,_0x31f6('0x11'));logger[_0x31f6('0x12')](_0x31f6('0x13'),_0x1a97fb,_0x31f6('0x11'),JSON[_0x31f6('0x14')](_0x2b7283));if(_0x2b7283[_0x31f6('0x15')]){if(_0x2b7283[_0x31f6('0x15')][_0x31f6('0x16')]===0x1f4){logger['error'](_0x31f6('0x10'),_0x1a97fb,_0x2b7283['error'][_0x31f6('0x17')]);return _0x2cc4be(_0x2b7283['error'][_0x31f6('0x17')]);}logger[_0x31f6('0x15')](_0x31f6('0x10'),_0x1a97fb,_0x2b7283[_0x31f6('0x15')][_0x31f6('0x17')]);return _0xd406d6(_0x2b7283['error'][_0x31f6('0x17')]);}else{logger[_0x31f6('0x18')]('FaxAccount,\x20%s,\x20%s',_0x1a97fb,_0x31f6('0x11'));_0xd406d6(_0x2b7283[_0x31f6('0x19')][_0x31f6('0x17')]);}})[_0x31f6('0x1a')](function(_0xe7b2d9){logger['error'](_0x31f6('0x10'),_0x1a97fb,_0xe7b2d9);_0x2cc4be(_0xe7b2d9);});});}exports[_0x31f6('0x1b')]=function(_0x8c3cd6){var _0x48996e=this;return new Promise(function(_0x457184,_0x581387){return db[_0x31f6('0x1c')][_0x31f6('0x1d')]({'raw':_0x8c3cd6[_0x31f6('0x1e')]?_0x8c3cd6[_0x31f6('0x1e')][_0x31f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x8c3cd6[_0x31f6('0x1e')]?_0x8c3cd6['options'][_0x31f6('0x20')]||null:null,'attributes':_0x8c3cd6[_0x31f6('0x1e')]?_0x8c3cd6['options'][_0x31f6('0x21')]||null:null,'limit':_0x8c3cd6[_0x31f6('0x1e')]?_0x8c3cd6['options'][_0x31f6('0x22')]||null:null,'include':_0x8c3cd6[_0x31f6('0x1e')]?_0x8c3cd6['options']['include']?_['map'](_0x8c3cd6['options']['include'],function(_0x485a29){return{'model':db[_0x485a29[_0x31f6('0x23')]],'as':_0x485a29['as'],'attributes':_0x485a29['attributes'],'include':_0x485a29[_0x31f6('0x24')]?_[_0x31f6('0x25')](_0x485a29['include'],function(_0x2940f1){return{'model':db[_0x2940f1[_0x31f6('0x23')]],'as':_0x2940f1['as'],'attributes':_0x2940f1[_0x31f6('0x21')],'include':_0x2940f1[_0x31f6('0x24')]?_[_0x31f6('0x25')](_0x2940f1[_0x31f6('0x24')],function(_0x549903){return{'model':db[_0x549903[_0x31f6('0x23')]],'as':_0x549903['as'],'attributes':_0x549903[_0x31f6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x31f6('0xf')](function(_0x2f7e9d){logger[_0x31f6('0x18')](_0x31f6('0x1b'),_0x8c3cd6);logger['debug'](_0x31f6('0x1b'),_0x8c3cd6,JSON[_0x31f6('0x14')](_0x2f7e9d));_0x457184(_0x2f7e9d);})[_0x31f6('0x1a')](function(_0x310f65){logger['error']('GetFaxAccount',_0x310f65[_0x31f6('0x17')],_0x8c3cd6);_0x581387(_0x48996e[_0x31f6('0x15')](0x1f4,_0x310f65['message']));});});};exports[_0x31f6('0x26')]=function(_0x254512,_0x5d150e,_0x11fea1){var _0x27045f=this;return new Promise(function(_0x263bdc,_0x414589){var _0x32ca04={'body':_0x254512['body'],'channel':_0x31f6('0x27')};var _0x13175f=[];var _0x163365=[];var _0x23c491={};return db[_0x31f6('0x28')][_0x31f6('0x29')]()[_0x31f6('0xf')](function(_0x8224b5){if(!_0x8224b5){throw new db[(_0x31f6('0x2a'))][(_0x31f6('0x2b'))]('no\x20available\x20attributes');}_0x13175f=_[_0x31f6('0x2c')](_['keys'](_0x8224b5),[_0x31f6('0x2d'),'updatedAt']);_0x163365=_[_0x31f6('0x2c')](_['keys'](_0x8224b5),['createdAt','updatedAt','CompanyId',_0x31f6('0x2e')]);if(_0x254512[_0x31f6('0x2f')]['id']){delete _0x254512['body']['id'];}if(_[_0x31f6('0x30')](_0x254512['body'][_0x31f6('0x31')])){throw new db[(_0x31f6('0x2a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x31f6('0x30')](_0x254512[_0x31f6('0x2f')][_0x31f6('0x2f')])||_0x254512[_0x31f6('0x2f')][_0x31f6('0x2f')]===''){throw new db[(_0x31f6('0x2a'))][(_0x31f6('0x2b'))](_0x31f6('0x32'));}if(_['isNil'](_0x254512[_0x31f6('0x2f')]['mapKey'])){throw new db[(_0x31f6('0x2a'))][(_0x31f6('0x2b'))](_0x31f6('0x33')+_0x163365);}if(!_[_0x31f6('0x34')](_0x163365,_0x254512['body'][_0x31f6('0x35')])){throw new db[(_0x31f6('0x2a'))][(_0x31f6('0x2b'))](_0x31f6('0x36')+_0x163365);}_0x23c491[_0x254512['body'][_0x31f6('0x35')]]=_0x254512[_0x31f6('0x2f')]['from'];})['then'](function(){return db[_0x31f6('0x1c')][_0x31f6('0x37')]({'where':{'id':_0x254512[_0x31f6('0x38')]['id']},'include':[{'model':db[_0x31f6('0x39')],'as':_0x31f6('0x3a'),'include':[{'model':db[_0x31f6('0x28')],'as':'Contacts','where':_0x23c491,'limit':0x1,'order':[[_0x31f6('0x3b'),_0x31f6('0x3c')]]}]},{'model':db[_0x31f6('0x3d')],'as':_0x31f6('0x3e')}]});})[_0x31f6('0xf')](function(_0x3a8bf0){if(_0x3a8bf0&&_0x3a8bf0[_0x31f6('0x3a')]){var _0x13f548=_0x3a8bf0[_0x31f6('0x3f')]({'plain':!![]});_0x32ca04[_0x31f6('0x38')]=_0x13f548;_0x32ca04[_0x31f6('0x40')]=_0x13f548['Applications'];_0x32ca04[_0x31f6('0x41')]=_0x13f548[_0x31f6('0x3a')];_0x32ca04[_0x31f6('0x40')]=_[_0x31f6('0x42')](_0x32ca04['applications'],[_0x31f6('0x43')],[_0x31f6('0x44')]);if(_0x32ca04[_0x31f6('0x38')][_0x31f6('0x3e')]){delete _0x32ca04[_0x31f6('0x38')][_0x31f6('0x3e')];}if(_0x32ca04[_0x31f6('0x38')][_0x31f6('0x3a')]&&_0x32ca04[_0x31f6('0x38')][_0x31f6('0x3a')][_0x31f6('0x45')][_0x31f6('0x46')]){return _0x32ca04[_0x31f6('0x38')][_0x31f6('0x3a')][_0x31f6('0x45')][0x0];}var _0x2dfa80=_[_0x31f6('0xa')](_0x254512[_0x31f6('0x2f')],{'firstName':_0x254512[_0x31f6('0x2f')][_0x31f6('0x31')],'ListId':_0x13f548[_0x31f6('0x2e')]});_0x2dfa80[_0x254512['body'][_0x31f6('0x35')]]=_0x254512[_0x31f6('0x2f')][_0x31f6('0x31')];return db[_0x31f6('0x28')][_0x31f6('0x47')](_0x2dfa80,{'fields':_0x13175f,'raw':!![]});}})[_0x31f6('0xf')](function(_0x10c586){_0x32ca04[_0x31f6('0x48')]=_0x10c586;if(_0x10c586){var _0x5ebcd4={'ContactId':_0x10c586['id'],'FaxAccountId':_0x254512[_0x31f6('0x38')]['id'],'fax':_0x10c586[_0x31f6('0x27')]};return db['FaxInteraction'][_0x31f6('0x37')]({'where':{'ContactId':_0x10c586['id'],'closed':![],'FaxAccountId':_0x254512['account']['id']}})[_0x31f6('0xf')](function(_0x22ff57){if(_0x22ff57){return[_0x22ff57,![]];}return db['FaxInteraction'][_0x31f6('0x47')](_0x5ebcd4)[_0x31f6('0xf')](function(_0x2d93ac){return[_0x2d93ac,!![]];});});}else{throw new Error(_0x31f6('0x49'));}})['spread'](function(_0x2d407c,_0x35b698){var _0x24cae9=_0x2d407c['get']({'plain':!![]});if(_0x35b698){if(_0x32ca04[_0x31f6('0x38')][_0x31f6('0x4a')]){_0x32ca04['applications'][_0x31f6('0x4b')]({'id':0x0,'priority':_0x32ca04[_0x31f6('0x40')][_0x31f6('0x46')]+0x1,'app':_0x31f6('0x4c'),'appdata':_0x31f6('0x4d'),'interval':_0x31f6('0x4e')});}_0x24cae9[_0x31f6('0x4f')]=!![];}else{_0x24cae9[_0x31f6('0x4f')]=![];}_0x32ca04[_0x31f6('0x50')]=_0x24cae9;return db[_0x31f6('0x51')][_0x31f6('0x47')]({'body':_0x254512[_0x31f6('0x2f')]['body'],'FaxAccountId':_0x254512['account']['id'],'FaxInteractionId':_0x2d407c['id'],'direction':'in','ContactId':_0x2d407c[_0x31f6('0x52')],'AttachmentId':_0x254512['body'][_0x31f6('0x53')]});})[_0x31f6('0xf')](function(_0x38ba9a){_0x32ca04['message']=_0x38ba9a;if(_0x32ca04['interaction'][_0x31f6('0x54')]){return db[_0x31f6('0x55')][_0x31f6('0x37')]({'attributes':['id','name'],'where':{'id':_0x32ca04[_0x31f6('0x50')]['UserId']}})[_0x31f6('0xf')](function(_0x10bf63){if(_0x10bf63){_0x32ca04[_0x31f6('0x40')][_0x31f6('0x56')]({'id':0x0,'priority':0x0,'app':_0x31f6('0x57'),'appdata':_0x10bf63['name']+','+(_0x32ca04['account'][_0x31f6('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x31f6('0x59'),_0x31f6('0x5a'),_0x32ca04);});}return respondWithRpcPromise(_0x31f6('0x59'),_0x31f6('0x5a'),_0x32ca04);})[_0x31f6('0xf')](function(_0x14e125){_0x263bdc(_0x14e125);})[_0x31f6('0x1a')](function(_0x5487f5){_0x414589(_0x27045f['error'](0x1f4,_0x5487f5[_0x31f6('0x17')]));});});}; \ No newline at end of file +var _0xe02c=['CompanyId','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','CmList','FaxApplication','Applications','List','get','account','applications','priority','asc','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFaxAccount','findAll','options','raw','attributes','limit','map','include','model','then','stringify','body','fax','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys'];(function(_0x1d36f3,_0x59ccf7){var _0xf3c3e=function(_0xfafc7b){while(--_0xfafc7b){_0x1d36f3['push'](_0x1d36f3['shift']());}};_0xf3c3e(++_0x59ccf7);}(_0xe02c,0x82));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce02('0x0'));var BPromise=require(_0xce02('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce02('0x2'));var db=require(_0xce02('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xce02('0x4'))(_0xce02('0x5'));var config=require(_0xce02('0x6'));var jayson=require(_0xce02('0x7'));var client=jayson[_0xce02('0x8')][_0xce02('0x9')]({'port':0x232c});config[_0xce02('0xa')]=_[_0xce02('0xb')](config[_0xce02('0xa')],{'host':_0xce02('0xc'),'port':0x18eb});var socket=require(_0xce02('0xd'))(new Redis(config['redis']));require(_0xce02('0xe'))[_0xce02('0xf')](socket);function respondWithRpcPromise(_0x3ffc2d,_0x198b1f,_0x35dee1){return new BPromise(function(_0x5e6eea,_0x132332){return client['request'](_0x3ffc2d,_0x35dee1)['then'](function(_0xe76c64){logger[_0xce02('0x10')](_0xce02('0x11'),_0x198b1f,_0xce02('0x12'));logger[_0xce02('0x13')](_0xce02('0x14'),_0x198b1f,_0xce02('0x12'),JSON['stringify'](_0xe76c64));if(_0xe76c64[_0xce02('0x15')]){if(_0xe76c64['error'][_0xce02('0x16')]===0x1f4){logger['error'](_0xce02('0x11'),_0x198b1f,_0xe76c64[_0xce02('0x15')][_0xce02('0x17')]);return _0x132332(_0xe76c64[_0xce02('0x15')][_0xce02('0x17')]);}logger['error'](_0xce02('0x11'),_0x198b1f,_0xe76c64[_0xce02('0x15')][_0xce02('0x17')]);return _0x5e6eea(_0xe76c64[_0xce02('0x15')][_0xce02('0x17')]);}else{logger['info'](_0xce02('0x11'),_0x198b1f,_0xce02('0x12'));_0x5e6eea(_0xe76c64[_0xce02('0x18')][_0xce02('0x17')]);}})['catch'](function(_0x632873){logger[_0xce02('0x15')]('FaxAccount,\x20%s,\x20%s',_0x198b1f,_0x632873);_0x132332(_0x632873);});});}exports[_0xce02('0x19')]=function(_0x981776){var _0x125460=this;return new Promise(function(_0x340cd7,_0x323c01){return db['FaxAccount'][_0xce02('0x1a')]({'raw':_0x981776[_0xce02('0x1b')]?_0x981776['options'][_0xce02('0x1c')]===undefined?!![]:![]:!![],'where':_0x981776[_0xce02('0x1b')]?_0x981776[_0xce02('0x1b')]['where']||null:null,'attributes':_0x981776[_0xce02('0x1b')]?_0x981776[_0xce02('0x1b')][_0xce02('0x1d')]||null:null,'limit':_0x981776[_0xce02('0x1b')]?_0x981776[_0xce02('0x1b')][_0xce02('0x1e')]||null:null,'include':_0x981776[_0xce02('0x1b')]?_0x981776[_0xce02('0x1b')]['include']?_[_0xce02('0x1f')](_0x981776[_0xce02('0x1b')][_0xce02('0x20')],function(_0x4c7bd4){return{'model':db[_0x4c7bd4['model']],'as':_0x4c7bd4['as'],'attributes':_0x4c7bd4[_0xce02('0x1d')],'include':_0x4c7bd4[_0xce02('0x20')]?_[_0xce02('0x1f')](_0x4c7bd4[_0xce02('0x20')],function(_0x577e54){return{'model':db[_0x577e54[_0xce02('0x21')]],'as':_0x577e54['as'],'attributes':_0x577e54['attributes'],'include':_0x577e54[_0xce02('0x20')]?_['map'](_0x577e54['include'],function(_0x28435c){return{'model':db[_0x28435c[_0xce02('0x21')]],'as':_0x28435c['as'],'attributes':_0x28435c['attributes']};}):[]};}):[]};}):[]:[]})[_0xce02('0x22')](function(_0x5c2d73){logger[_0xce02('0x10')](_0xce02('0x19'),_0x981776);logger[_0xce02('0x13')]('GetFaxAccount',_0x981776,JSON[_0xce02('0x23')](_0x5c2d73));_0x340cd7(_0x5c2d73);})['catch'](function(_0x565aa){logger[_0xce02('0x15')](_0xce02('0x19'),_0x565aa[_0xce02('0x17')],_0x981776);_0x323c01(_0x125460['error'](0x1f4,_0x565aa[_0xce02('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x1ad8b7,_0x4cafc9,_0x311b91){var _0x5c9a28=this;return new Promise(function(_0x4c115d,_0x4af11a){var _0x5484df={'body':_0x1ad8b7[_0xce02('0x24')],'channel':_0xce02('0x25')};var _0x269778=[];var _0x42f19e=[];var _0x3e33a3={};return db[_0xce02('0x26')]['describe']()[_0xce02('0x22')](function(_0x471014){if(!_0x471014){throw new db['Sequelize'][(_0xce02('0x27'))](_0xce02('0x28'));}_0x269778=_[_0xce02('0x29')](_['keys'](_0x471014),['createdAt',_0xce02('0x2a')]);_0x42f19e=_[_0xce02('0x29')](_[_0xce02('0x2b')](_0x471014),['createdAt',_0xce02('0x2a'),_0xce02('0x2c'),_0xce02('0x2d')]);if(_0x1ad8b7[_0xce02('0x24')]['id']){delete _0x1ad8b7[_0xce02('0x24')]['id'];}if(_['isNil'](_0x1ad8b7[_0xce02('0x24')]['from'])){throw new db[(_0xce02('0x2e'))][(_0xce02('0x27'))](_0xce02('0x2f'));}if(_['isNil'](_0x1ad8b7['body'][_0xce02('0x24')])||_0x1ad8b7[_0xce02('0x24')][_0xce02('0x24')]===''){throw new db[(_0xce02('0x2e'))]['ValidationError'](_0xce02('0x30'));}if(_['isNil'](_0x1ad8b7['body'][_0xce02('0x31')])){throw new db[(_0xce02('0x2e'))][(_0xce02('0x27'))](_0xce02('0x32')+_0x42f19e);}if(!_[_0xce02('0x33')](_0x42f19e,_0x1ad8b7[_0xce02('0x24')][_0xce02('0x31')])){throw new db['Sequelize'][(_0xce02('0x27'))](_0xce02('0x34')+_0x42f19e);}_0x3e33a3[_0x1ad8b7[_0xce02('0x24')][_0xce02('0x31')]]=_0x1ad8b7[_0xce02('0x24')][_0xce02('0x35')];})[_0xce02('0x22')](function(){return db[_0xce02('0x36')][_0xce02('0x37')]({'where':{'id':_0x1ad8b7['account']['id']},'include':[{'model':db[_0xce02('0x38')],'as':'List','include':[{'model':db[_0xce02('0x26')],'as':'Contacts','where':_0x3e33a3,'limit':0x1,'order':[[_0xce02('0x2a'),'DESC']]}]},{'model':db[_0xce02('0x39')],'as':_0xce02('0x3a')}]});})[_0xce02('0x22')](function(_0x57c8fb){if(_0x57c8fb&&_0x57c8fb[_0xce02('0x3b')]){var _0x27b99c=_0x57c8fb[_0xce02('0x3c')]({'plain':!![]});_0x5484df[_0xce02('0x3d')]=_0x27b99c;_0x5484df['applications']=_0x27b99c['Applications'];_0x5484df['list']=_0x27b99c[_0xce02('0x3b')];_0x5484df[_0xce02('0x3e')]=_['orderBy'](_0x5484df[_0xce02('0x3e')],[_0xce02('0x3f')],[_0xce02('0x40')]);if(_0x5484df[_0xce02('0x3d')]['Applications']){delete _0x5484df[_0xce02('0x3d')][_0xce02('0x3a')];}if(_0x5484df['account'][_0xce02('0x3b')]&&_0x5484df[_0xce02('0x3d')][_0xce02('0x3b')][_0xce02('0x41')][_0xce02('0x42')]){return _0x5484df[_0xce02('0x3d')][_0xce02('0x3b')][_0xce02('0x41')][0x0];}var _0x251c7c=_[_0xce02('0xb')](_0x1ad8b7['body'],{'firstName':_0x1ad8b7[_0xce02('0x24')][_0xce02('0x35')],'ListId':_0x27b99c[_0xce02('0x2d')]});_0x251c7c[_0x1ad8b7['body'][_0xce02('0x31')]]=_0x1ad8b7['body'][_0xce02('0x35')];return db[_0xce02('0x26')][_0xce02('0x43')](_0x251c7c,{'fields':_0x269778,'raw':!![]});}})[_0xce02('0x22')](function(_0x174f2d){_0x5484df[_0xce02('0x44')]=_0x174f2d;if(_0x174f2d){var _0x2f617f={'ContactId':_0x174f2d['id'],'FaxAccountId':_0x1ad8b7[_0xce02('0x3d')]['id'],'fax':_0x174f2d[_0xce02('0x25')]};return db[_0xce02('0x45')]['find']({'where':{'ContactId':_0x174f2d['id'],'closed':![],'FaxAccountId':_0x1ad8b7[_0xce02('0x3d')]['id']}})[_0xce02('0x22')](function(_0x193c54){if(_0x193c54){return[_0x193c54,![]];}return db[_0xce02('0x45')][_0xce02('0x43')](_0x2f617f)['then'](function(_0xc5904e){return[_0xc5904e,!![]];});});}else{throw new Error(_0xce02('0x46'));}})[_0xce02('0x47')](function(_0x116985,_0xeace05){var _0x3a6662=_0x116985[_0xce02('0x3c')]({'plain':!![]});if(_0xeace05){if(_0x5484df['account'][_0xce02('0x48')]){_0x5484df[_0xce02('0x3e')]['push']({'id':0x0,'priority':_0x5484df[_0xce02('0x3e')][_0xce02('0x42')]+0x1,'app':_0xce02('0x49'),'appdata':_0xce02('0x4a'),'interval':_0xce02('0x4b')});}_0x3a6662[_0xce02('0x4c')]=!![];}else{_0x3a6662['created']=![];}_0x5484df[_0xce02('0x4d')]=_0x3a6662;return db[_0xce02('0x4e')][_0xce02('0x43')]({'body':_0x1ad8b7[_0xce02('0x24')][_0xce02('0x24')],'FaxAccountId':_0x1ad8b7[_0xce02('0x3d')]['id'],'FaxInteractionId':_0x116985['id'],'direction':'in','ContactId':_0x116985['ContactId'],'AttachmentId':_0x1ad8b7[_0xce02('0x24')]['AttachmentId']});})[_0xce02('0x22')](function(_0x581e93){_0x5484df[_0xce02('0x17')]=_0x581e93;if(_0x5484df[_0xce02('0x4d')][_0xce02('0x4f')]){return db['User'][_0xce02('0x37')]({'attributes':['id',_0xce02('0x50')],'where':{'id':_0x5484df[_0xce02('0x4d')]['UserId']}})[_0xce02('0x22')](function(_0x5a8b2d){if(_0x5a8b2d){_0x5484df[_0xce02('0x3e')][_0xce02('0x51')]({'id':0x0,'priority':0x0,'app':_0xce02('0x52'),'appdata':_0x5a8b2d[_0xce02('0x50')]+','+(_0x5484df['account'][_0xce02('0x53')]||0xa),'interval':_0xce02('0x4b')});}return respondWithRpcPromise(_0xce02('0x54'),_0xce02('0x55'),_0x5484df);});}return respondWithRpcPromise(_0xce02('0x54'),_0xce02('0x55'),_0x5484df);})[_0xce02('0x22')](function(_0x561000){_0x4c115d(_0x561000);})[_0xce02('0x56')](function(_0x4fb176){_0x4af11a(_0x5c9a28[_0xce02('0x15')](0x1f4,_0x4fb176[_0xce02('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 610319a..32be790 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 _0x0a6b=['removeListener','length','./faxAccount.events','emit'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x63eeb1,_0x8098b3){_0x63eeb1=_0x63eeb1-0x0;var _0x27e078=_0x0a6b[_0x63eeb1];return _0x27e078;};'use strict';var FaxAccountEvents=require(_0xb0a6('0x0'));var events=['save','remove','update'];function createListener(_0x16a15d,_0x50d3d5){return function(_0x2245d7){_0x50d3d5[_0xb0a6('0x1')](_0x16a15d,_0x2245d7);};}function removeListener(_0x1d3b78,_0x544a64){return function(){FaxAccountEvents[_0xb0a6('0x2')](_0x1d3b78,_0x544a64);};}exports['register']=function(_0xbbdf89){for(var _0x415e9e=0x0,_0x5e2d2d=events[_0xb0a6('0x3')];_0x415e9e<_0x5e2d2d;_0x415e9e++){var _0x24515c=events[_0x415e9e];var _0x2a8516=createListener('faxAccount:'+_0x24515c,_0xbbdf89);FaxAccountEvents['on'](_0x24515c,_0x2a8516);}}; \ No newline at end of file +var _0x9536=['length','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x9536,0x179));var _0x6953=function(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0x9536[_0x35bd6c];return _0x2f421d;};'use strict';var FaxAccountEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){FaxAccountEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('faxAccount:'+_0x3e1aff,_0x494ac2);FaxAccountEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index cbc45cf..9fadefc 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 _0x7dc6=['/:id/interactions','getInteractions','/:id/applications','getMessages','/:id/users','getAgents','create','/:id/dispositions','addDisposition','post','addAnswer','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x2ce6df,_0x49aebe){var _0x315eb7=function(_0xbe6fc0){while(--_0xbe6fc0){_0x2ce6df['push'](_0x2ce6df['shift']());}};_0x315eb7(++_0x49aebe);}(_0x7dc6,0x122));var _0x67dc=function(_0x427bff,_0x576b02){_0x427bff=_0x427bff-0x0;var _0x38a479=_0x7dc6[_0x427bff];return _0x38a479;};'use strict';var multer=require(_0x67dc('0x0'));var util=require(_0x67dc('0x1'));var path=require('path');var timeout=require(_0x67dc('0x2'));var express=require(_0x67dc('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x67dc('0x4'));var config=require(_0x67dc('0x5'));var controller=require('./faxAccount.controller');router[_0x67dc('0x6')]('/',auth[_0x67dc('0x7')](),controller[_0x67dc('0x8')]);router[_0x67dc('0x6')](_0x67dc('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x67dc('0x7')](),controller[_0x67dc('0xa')]);router[_0x67dc('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x67dc('0xb')]);router[_0x67dc('0x6')](_0x67dc('0xc'),auth['isAuthenticated'](),controller[_0x67dc('0xd')]);router['get'](_0x67dc('0xe'),auth['isAuthenticated'](),controller[_0x67dc('0xf')]);router[_0x67dc('0x6')](_0x67dc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x67dc('0x6')]('/:id/messages',auth[_0x67dc('0x7')](),controller[_0x67dc('0x11')]);router['get'](_0x67dc('0x12'),auth[_0x67dc('0x7')](),controller[_0x67dc('0x13')]);router['post']('/',auth[_0x67dc('0x7')](),controller[_0x67dc('0x14')]);router['post'](_0x67dc('0x15'),auth[_0x67dc('0x7')](),controller[_0x67dc('0x16')]);router[_0x67dc('0x17')](_0x67dc('0xc'),auth[_0x67dc('0x7')](),controller[_0x67dc('0x18')]);router[_0x67dc('0x17')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0x67dc('0x17')](_0x67dc('0x10'),auth[_0x67dc('0x7')](),controller[_0x67dc('0x19')]);router[_0x67dc('0x17')](_0x67dc('0x1a'),auth[_0x67dc('0x7')](),controller['addAccountApplications']);router['post'](_0x67dc('0x1b'),auth['isAuthenticated'](),controller[_0x67dc('0x1c')]);router[_0x67dc('0x17')]('/:id/send',auth[_0x67dc('0x7')](),controller[_0x67dc('0x1d')]);router['post'](_0x67dc('0x12'),auth['isAuthenticated'](),controller[_0x67dc('0x1e')]);router[_0x67dc('0x1f')](_0x67dc('0x20'),auth[_0x67dc('0x7')](),controller['update']);router[_0x67dc('0x21')](_0x67dc('0x20'),auth[_0x67dc('0x7')](),controller[_0x67dc('0x22')]);router['delete']('/:id/dispositions',auth[_0x67dc('0x7')](),controller[_0x67dc('0x23')]);router['delete']('/:id/canned_answers',auth[_0x67dc('0x7')](),controller[_0x67dc('0x24')]);router[_0x67dc('0x21')]('/:id/users',auth[_0x67dc('0x7')](),controller[_0x67dc('0x25')]);module['exports']=router; \ No newline at end of file +var _0xdd4a=['send','addAgents','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd4a,0x1b4));var _0xadd4=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0xdd4a[_0x5b27da];return _0x3254f4;};'use strict';var multer=require(_0xadd4('0x0'));var util=require(_0xadd4('0x1'));var path=require(_0xadd4('0x2'));var timeout=require(_0xadd4('0x3'));var express=require(_0xadd4('0x4'));var router=express[_0xadd4('0x5')]();var auth=require(_0xadd4('0x6'));var interaction=require(_0xadd4('0x7'));var config=require(_0xadd4('0x8'));var controller=require(_0xadd4('0x9'));router[_0xadd4('0xa')]('/',auth['isAuthenticated'](),controller[_0xadd4('0xb')]);router['get'](_0xadd4('0xc'),auth['isAuthenticated'](),controller[_0xadd4('0xd')]);router[_0xadd4('0xa')](_0xadd4('0xe'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x10')]);router['get'](_0xadd4('0x11'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x12')]);router[_0xadd4('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xadd4('0x13')]);router[_0xadd4('0xa')](_0xadd4('0x14'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x15')]);router[_0xadd4('0xa')](_0xadd4('0x16'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x17')]);router['get'](_0xadd4('0x18'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x19')]);router['get'](_0xadd4('0x1a'),auth['isAuthenticated'](),controller[_0xadd4('0x1b')]);router[_0xadd4('0x1c')]('/',auth[_0xadd4('0xf')](),controller[_0xadd4('0x1d')]);router[_0xadd4('0x1c')]('/:id/dispositions',auth[_0xadd4('0xf')](),controller[_0xadd4('0x1e')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xadd4('0x1c')](_0xadd4('0x14'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x1f')]);router['post'](_0xadd4('0x16'),auth['isAuthenticated'](),controller[_0xadd4('0x20')]);router[_0xadd4('0x1c')](_0xadd4('0x21'),auth['isAuthenticated'](),controller[_0xadd4('0x22')]);router[_0xadd4('0x1c')]('/updateaccountapplications',auth[_0xadd4('0xf')](),controller[_0xadd4('0x23')]);router[_0xadd4('0x1c')](_0xadd4('0x24'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x25')]);router[_0xadd4('0x1c')](_0xadd4('0x1a'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x26')]);router['put'](_0xadd4('0xe'),auth[_0xadd4('0xf')](),controller['update']);router[_0xadd4('0x27')](_0xadd4('0xe'),auth[_0xadd4('0xf')](),controller['destroy']);router[_0xadd4('0x27')](_0xadd4('0x11'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x28')]);router[_0xadd4('0x27')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xadd4('0x27')](_0xadd4('0x1a'),auth[_0xadd4('0xf')](),controller[_0xadd4('0x29')]);module[_0xadd4('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 81f1ca2..918f2bb 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 _0x7097=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x7097,0x1be));var _0x7709=function(_0x8e542d,_0x3512a1){_0x8e542d=_0x8e542d-0x0;var _0x4716b2=_0x7097[_0x8e542d];return _0x4716b2;};'use strict';var Sequelize=require(_0x7709('0x0'));module[_0x7709('0x1')]={'priority':{'type':Sequelize[_0x7709('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7709('0x3')]()},'description':{'type':Sequelize[_0x7709('0x4')]},'interval':{'type':Sequelize[_0x7709('0x4')],'defaultValue':_0x7709('0x5')}}; \ No newline at end of file +var _0x556a=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5634bf,_0x412c1d){var _0x492785=function(_0x25b589){while(--_0x25b589){_0x5634bf['push'](_0x5634bf['shift']());}};_0x492785(++_0x412c1d);}(_0x556a,0x1dd));var _0xa556=function(_0xa3b5f7,_0xc66d91){_0xa3b5f7=_0xa3b5f7-0x0;var _0x3c5e58=_0x556a[_0xa3b5f7];return _0x3c5e58;};'use strict';var Sequelize=require(_0xa556('0x0'));module[_0xa556('0x1')]={'priority':{'type':Sequelize[_0xa556('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa556('0x3')],'allowNull':![],'defaultValue':_0xa556('0x4')},'appdata':{'type':Sequelize[_0xa556('0x5')]()},'description':{'type':Sequelize[_0xa556('0x3')]},'interval':{'type':Sequelize[_0xa556('0x3')],'defaultValue':_0xa556('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4117e57..3812f05 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 _0xe6ad=['length','includeAll','options','find','create','body','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','include','FaxApplication','findAll','rows','catch','show','params'];(function(_0xb84822,_0x3dae0b){var _0x167f3c=function(_0xe431df){while(--_0xe431df){_0xb84822['push'](_0xb84822['shift']());}};_0x167f3c(++_0x3dae0b);}(_0xe6ad,0x127));var _0xde6a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe6ad[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0xde6a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde6a('0x2'));var rp=require(_0xde6a('0x3'));var moment=require(_0xde6a('0x4'));var BPromise=require(_0xde6a('0x5'));var Mustache=require(_0xde6a('0x6'));var util=require(_0xde6a('0x7'));var path=require('path');var sox=require(_0xde6a('0x8'));var csv=require(_0xde6a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xde6a('0xa'));var crypto=require('crypto');var jsforce=require(_0xde6a('0xb'));var deskjs=require(_0xde6a('0xc'));var toCsv=require(_0xde6a('0x9'));var querystring=require(_0xde6a('0xd'));var Papa=require('papaparse');var Redis=require(_0xde6a('0xe'));var authService=require(_0xde6a('0xf'));var qs=require(_0xde6a('0x10'));var as=require(_0xde6a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde6a('0x12'))(_0xde6a('0x13'));var utils=require(_0xde6a('0x14'));var config=require(_0xde6a('0x15'));var licenseUtil=require(_0xde6a('0x16'));var db=require(_0xde6a('0x17'))['db'];function respondWithStatusCode(_0x3331c2,_0x3053d3){_0x3053d3=_0x3053d3||0xcc;return function(_0x3c3f5b){if(_0x3c3f5b){return _0x3331c2['sendStatus'](_0x3053d3);}return _0x3331c2[_0xde6a('0x18')](_0x3053d3)[_0xde6a('0x19')]();};}function respondWithResult(_0x204c71,_0x5785ae){_0x5785ae=_0x5785ae||0xc8;return function(_0x196079){if(_0x196079){return _0x204c71[_0xde6a('0x18')](_0x5785ae)[_0xde6a('0x1a')](_0x196079);}};}function respondWithFilteredResult(_0xb66c45,_0xf416ce){return function(_0x8f52a4){if(_0x8f52a4){var _0x7ee35a=_0x8f52a4[_0xde6a('0x1b')],_0x3466c4=_0xf416ce['offset'],_0x4dbea8=_0xf416ce[_0xde6a('0x1c')]+_0xf416ce[_0xde6a('0x1d')],_0xa7830d;if(_0x4dbea8>=_0x7ee35a){_0x4dbea8=_0x7ee35a;_0xa7830d=0xc8;}else{_0xa7830d=0xce;}_0xb66c45[_0xde6a('0x18')](_0xa7830d);return _0xb66c45['set'](_0xde6a('0x1e'),_0x3466c4+'-'+_0x4dbea8+'/'+_0x7ee35a)[_0xde6a('0x1a')](_0x8f52a4);}return null;};}function patchUpdates(_0x5e2dda){return function(_0x471274){try{jsonpatch[_0xde6a('0x1f')](_0x471274,_0x5e2dda,!![]);}catch(_0x391061){return BPromise[_0xde6a('0x20')](_0x391061);}return _0x471274[_0xde6a('0x21')]();};}function saveUpdates(_0x2e0d2b,_0x233319){return function(_0x1305da){if(_0x1305da){return _0x1305da[_0xde6a('0x22')](_0x2e0d2b)['then'](function(_0x5f0c82){return _0x5f0c82;});}return null;};}function removeEntity(_0x5355fe,_0x22137c){return function(_0xfe5738){if(_0xfe5738){return _0xfe5738['destroy']()[_0xde6a('0x23')](function(){_0x5355fe[_0xde6a('0x18')](0xcc)[_0xde6a('0x19')]();});}};}function handleEntityNotFound(_0x323257,_0x2facdf){return function(_0x1acdd5){if(!_0x1acdd5){_0x323257['sendStatus'](0x194);}return _0x1acdd5;};}function handleError(_0x2b9564,_0x49d223){_0x49d223=_0x49d223||0x1f4;return function(_0xafe047){logger['error'](_0xafe047[_0xde6a('0x24')]);if(_0xafe047[_0xde6a('0x25')]){delete _0xafe047['name'];}_0x2b9564[_0xde6a('0x18')](_0x49d223)[_0xde6a('0x26')](_0xafe047);};}exports['index']=function(_0x1f586e,_0x5002c5){var _0x2e05c5={},_0x33d301={},_0x45eb46={'count':0x0,'rows':[]};var _0x3dd68e=_[_0xde6a('0x27')](db['FaxApplication'][_0xde6a('0x28')],function(_0x586c97){return{'name':_0x586c97[_0xde6a('0x29')],'type':_0x586c97[_0xde6a('0x2a')][_0xde6a('0x2b')]};});_0x33d301[_0xde6a('0x2c')]=_[_0xde6a('0x27')](_0x3dd68e,'name');_0x33d301[_0xde6a('0x2d')]=_[_0xde6a('0x2e')](_0x1f586e['query']);_0x33d301['filters']=_[_0xde6a('0x2f')](_0x33d301[_0xde6a('0x2c')],_0x33d301[_0xde6a('0x2d')]);_0x2e05c5[_0xde6a('0x30')]=_[_0xde6a('0x2f')](_0x33d301[_0xde6a('0x2c')],qs['fields'](_0x1f586e['query'][_0xde6a('0x31')]));_0x2e05c5['attributes']=_0x2e05c5[_0xde6a('0x30')]['length']?_0x2e05c5['attributes']:_0x33d301[_0xde6a('0x2c')];if(!_0x1f586e[_0xde6a('0x2d')][_0xde6a('0x32')]('nolimit')){_0x2e05c5[_0xde6a('0x1d')]=qs['limit'](_0x1f586e[_0xde6a('0x2d')][_0xde6a('0x1d')]);_0x2e05c5[_0xde6a('0x1c')]=qs[_0xde6a('0x1c')](_0x1f586e['query'][_0xde6a('0x1c')]);}_0x2e05c5[_0xde6a('0x33')]=qs['sort'](_0x1f586e[_0xde6a('0x2d')][_0xde6a('0x34')]);_0x2e05c5[_0xde6a('0x35')]=qs[_0xde6a('0x36')](_[_0xde6a('0x37')](_0x1f586e[_0xde6a('0x2d')],_0x33d301['filters']),_0x3dd68e);if(_0x1f586e[_0xde6a('0x2d')]['filter']){_0x2e05c5[_0xde6a('0x35')]=_[_0xde6a('0x38')](_0x2e05c5[_0xde6a('0x35')],{'$or':_[_0xde6a('0x27')](_0x3dd68e,function(_0x28a1ef){if(_0x28a1ef[_0xde6a('0x2a')]!==_0xde6a('0x39')){var _0x59d7fc={};_0x59d7fc[_0x28a1ef[_0xde6a('0x25')]]={'$like':'%'+_0x1f586e[_0xde6a('0x2d')]['filter']+'%'};return _0x59d7fc;}})});}_0x2e05c5=_['merge']({},_0x2e05c5,_0x1f586e['options']);var _0x130634={'where':_0x2e05c5[_0xde6a('0x35')]};return db['FaxApplication'][_0xde6a('0x1b')](_0x130634)[_0xde6a('0x23')](function(_0x473340){_0x45eb46['count']=_0x473340;if(_0x1f586e[_0xde6a('0x2d')]['includeAll']){_0x2e05c5[_0xde6a('0x3a')]=[{'all':!![]}];}return db[_0xde6a('0x3b')][_0xde6a('0x3c')](_0x2e05c5);})[_0xde6a('0x23')](function(_0x32e396){_0x45eb46[_0xde6a('0x3d')]=_0x32e396;return _0x45eb46;})[_0xde6a('0x23')](respondWithFilteredResult(_0x5002c5,_0x2e05c5))[_0xde6a('0x3e')](handleError(_0x5002c5,null));};exports[_0xde6a('0x3f')]=function(_0x5b36d4,_0x1e3db1){var _0x277bd1={'raw':!![],'where':{'id':_0x5b36d4[_0xde6a('0x40')]['id']}},_0x424ef6={};_0x424ef6[_0xde6a('0x2c')]=_['keys'](db['FaxApplication'][_0xde6a('0x28')]);_0x424ef6[_0xde6a('0x2d')]=_[_0xde6a('0x2e')](_0x5b36d4[_0xde6a('0x2d')]);_0x424ef6[_0xde6a('0x36')]=_[_0xde6a('0x2f')](_0x424ef6[_0xde6a('0x2c')],_0x424ef6['query']);_0x277bd1[_0xde6a('0x30')]=_[_0xde6a('0x2f')](_0x424ef6[_0xde6a('0x2c')],qs[_0xde6a('0x31')](_0x5b36d4[_0xde6a('0x2d')]['fields']));_0x277bd1[_0xde6a('0x30')]=_0x277bd1[_0xde6a('0x30')][_0xde6a('0x41')]?_0x277bd1[_0xde6a('0x30')]:_0x424ef6[_0xde6a('0x2c')];if(_0x5b36d4[_0xde6a('0x2d')][_0xde6a('0x42')]){_0x277bd1[_0xde6a('0x3a')]=[{'all':!![]}];}_0x277bd1=_[_0xde6a('0x38')]({},_0x277bd1,_0x5b36d4[_0xde6a('0x43')]);return db[_0xde6a('0x3b')][_0xde6a('0x44')](_0x277bd1)['then'](handleEntityNotFound(_0x1e3db1,null))[_0xde6a('0x23')](respondWithResult(_0x1e3db1,null))[_0xde6a('0x3e')](handleError(_0x1e3db1,null));};exports[_0xde6a('0x45')]=function(_0x3b1374,_0x15e5bf){return db[_0xde6a('0x3b')][_0xde6a('0x45')](_0x3b1374[_0xde6a('0x46')],{})['then'](respondWithResult(_0x15e5bf,0xc9))['catch'](handleError(_0x15e5bf,null));};exports[_0xde6a('0x22')]=function(_0x1b2777,_0x372f29){if(_0x1b2777[_0xde6a('0x46')]['id']){delete _0x1b2777[_0xde6a('0x46')]['id'];}return db[_0xde6a('0x3b')][_0xde6a('0x44')]({'where':{'id':_0x1b2777[_0xde6a('0x40')]['id']}})[_0xde6a('0x23')](handleEntityNotFound(_0x372f29,null))['then'](saveUpdates(_0x1b2777[_0xde6a('0x46')],null))[_0xde6a('0x23')](respondWithResult(_0x372f29,null))[_0xde6a('0x3e')](handleError(_0x372f29,null));};exports[_0xde6a('0x47')]=function(_0x58d67,_0x1656b6){return db[_0xde6a('0x3b')][_0xde6a('0x44')]({'where':{'id':_0x58d67[_0xde6a('0x40')]['id']}})[_0xde6a('0x23')](handleEntityNotFound(_0x1656b6,null))[_0xde6a('0x23')](removeEntity(_0x1656b6,null))[_0xde6a('0x3e')](handleError(_0x1656b6,null));}; \ No newline at end of file +var _0xfd99=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','FaxApplication','findAll','catch','includeAll','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query'];(function(_0x2d7546,_0x4dd557){var _0x4ad2aa=function(_0x2d6d25){while(--_0x2d6d25){_0x2d7546['push'](_0x2d7546['shift']());}};_0x4ad2aa(++_0x4dd557);}(_0xfd99,0xaf));var _0x9fd9=function(_0x1a23d5,_0x314e41){_0x1a23d5=_0x1a23d5-0x0;var _0x925156=_0xfd99[_0x1a23d5];return _0x925156;};'use strict';var pdf=require(_0x9fd9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9fd9('0x1'));var zipdir=require(_0x9fd9('0x2'));var jsonpatch=require(_0x9fd9('0x3'));var rp=require('request-promise');var moment=require(_0x9fd9('0x4'));var BPromise=require(_0x9fd9('0x5'));var Mustache=require(_0x9fd9('0x6'));var util=require(_0x9fd9('0x7'));var path=require('path');var sox=require(_0x9fd9('0x8'));var csv=require(_0x9fd9('0x9'));var ejs=require(_0x9fd9('0xa'));var fs=require('fs');var _=require(_0x9fd9('0xb'));var squel=require(_0x9fd9('0xc'));var crypto=require('crypto');var jsforce=require(_0x9fd9('0xd'));var deskjs=require(_0x9fd9('0xe'));var toCsv=require(_0x9fd9('0x9'));var querystring=require(_0x9fd9('0xf'));var Papa=require(_0x9fd9('0x10'));var Redis=require(_0x9fd9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9fd9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fd9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9fd9('0x14'));var config=require(_0x9fd9('0x15'));var licenseUtil=require(_0x9fd9('0x16'));var db=require(_0x9fd9('0x17'))['db'];function respondWithStatusCode(_0x1b0495,_0xd4db8f){_0xd4db8f=_0xd4db8f||0xcc;return function(_0x3dacee){if(_0x3dacee){return _0x1b0495[_0x9fd9('0x18')](_0xd4db8f);}return _0x1b0495[_0x9fd9('0x19')](_0xd4db8f)[_0x9fd9('0x1a')]();};}function respondWithResult(_0x48bfc0,_0x53ccc9){_0x53ccc9=_0x53ccc9||0xc8;return function(_0x3f8a52){if(_0x3f8a52){return _0x48bfc0[_0x9fd9('0x19')](_0x53ccc9)['json'](_0x3f8a52);}};}function respondWithFilteredResult(_0xcb5f25,_0x3c2d73){return function(_0xfd119){if(_0xfd119){var _0x4e1f32=_0xfd119[_0x9fd9('0x1b')],_0x17a0f3=_0x3c2d73[_0x9fd9('0x1c')],_0x11411f=_0x3c2d73[_0x9fd9('0x1c')]+_0x3c2d73[_0x9fd9('0x1d')],_0x370524;if(_0x11411f>=_0x4e1f32){_0x11411f=_0x4e1f32;_0x370524=0xc8;}else{_0x370524=0xce;}_0xcb5f25[_0x9fd9('0x19')](_0x370524);return _0xcb5f25[_0x9fd9('0x1e')](_0x9fd9('0x1f'),_0x17a0f3+'-'+_0x11411f+'/'+_0x4e1f32)['json'](_0xfd119);}return null;};}function patchUpdates(_0xdf5f8a){return function(_0x20e0a5){try{jsonpatch[_0x9fd9('0x20')](_0x20e0a5,_0xdf5f8a,!![]);}catch(_0x5d62f9){return BPromise[_0x9fd9('0x21')](_0x5d62f9);}return _0x20e0a5[_0x9fd9('0x22')]();};}function saveUpdates(_0x56499a,_0x3f8797){return function(_0x39c897){if(_0x39c897){return _0x39c897[_0x9fd9('0x23')](_0x56499a)[_0x9fd9('0x24')](function(_0x56f848){return _0x56f848;});}return null;};}function removeEntity(_0xb240f4,_0x54efd0){return function(_0x75da3d){if(_0x75da3d){return _0x75da3d[_0x9fd9('0x25')]()[_0x9fd9('0x24')](function(){_0xb240f4[_0x9fd9('0x19')](0xcc)[_0x9fd9('0x1a')]();});}};}function handleEntityNotFound(_0x3d44dd,_0x136ba8){return function(_0x519989){if(!_0x519989){_0x3d44dd['sendStatus'](0x194);}return _0x519989;};}function handleError(_0x3e588b,_0x5a7132){_0x5a7132=_0x5a7132||0x1f4;return function(_0xeff99){logger[_0x9fd9('0x26')](_0xeff99[_0x9fd9('0x27')]);if(_0xeff99[_0x9fd9('0x28')]){delete _0xeff99[_0x9fd9('0x28')];}_0x3e588b['status'](_0x5a7132)[_0x9fd9('0x29')](_0xeff99);};}exports['index']=function(_0x79e826,_0x5c83bc){var _0x69e87={},_0x409070={},_0x56c5c9={'count':0x0,'rows':[]};var _0xd747f3=_[_0x9fd9('0x2a')](db['FaxApplication'][_0x9fd9('0x2b')],function(_0x2b07a9){return{'name':_0x2b07a9[_0x9fd9('0x2c')],'type':_0x2b07a9['type'][_0x9fd9('0x2d')]};});_0x409070['model']=_[_0x9fd9('0x2a')](_0xd747f3,_0x9fd9('0x28'));_0x409070[_0x9fd9('0x2e')]=_[_0x9fd9('0x2f')](_0x79e826['query']);_0x409070[_0x9fd9('0x30')]=_[_0x9fd9('0x31')](_0x409070[_0x9fd9('0x32')],_0x409070['query']);_0x69e87['attributes']=_[_0x9fd9('0x31')](_0x409070[_0x9fd9('0x32')],qs['fields'](_0x79e826['query'][_0x9fd9('0x33')]));_0x69e87['attributes']=_0x69e87[_0x9fd9('0x34')][_0x9fd9('0x35')]?_0x69e87[_0x9fd9('0x34')]:_0x409070[_0x9fd9('0x32')];if(!_0x79e826[_0x9fd9('0x2e')][_0x9fd9('0x36')](_0x9fd9('0x37'))){_0x69e87[_0x9fd9('0x1d')]=qs[_0x9fd9('0x1d')](_0x79e826['query']['limit']);_0x69e87[_0x9fd9('0x1c')]=qs[_0x9fd9('0x1c')](_0x79e826[_0x9fd9('0x2e')][_0x9fd9('0x1c')]);}_0x69e87[_0x9fd9('0x38')]=qs[_0x9fd9('0x39')](_0x79e826['query'][_0x9fd9('0x39')]);_0x69e87[_0x9fd9('0x3a')]=qs[_0x9fd9('0x30')](_[_0x9fd9('0x3b')](_0x79e826[_0x9fd9('0x2e')],_0x409070['filters']),_0xd747f3);if(_0x79e826['query'][_0x9fd9('0x3c')]){_0x69e87[_0x9fd9('0x3a')]=_['merge'](_0x69e87[_0x9fd9('0x3a')],{'$or':_[_0x9fd9('0x2a')](_0xd747f3,function(_0x230a58){if(_0x230a58[_0x9fd9('0x3d')]!==_0x9fd9('0x3e')){var _0x130adc={};_0x130adc[_0x230a58[_0x9fd9('0x28')]]={'$like':'%'+_0x79e826['query'][_0x9fd9('0x3c')]+'%'};return _0x130adc;}})});}_0x69e87=_[_0x9fd9('0x3f')]({},_0x69e87,_0x79e826[_0x9fd9('0x40')]);var _0x5c8600={'where':_0x69e87['where']};return db['FaxApplication']['count'](_0x5c8600)[_0x9fd9('0x24')](function(_0xa01924){_0x56c5c9[_0x9fd9('0x1b')]=_0xa01924;if(_0x79e826[_0x9fd9('0x2e')]['includeAll']){_0x69e87[_0x9fd9('0x41')]=[{'all':!![]}];}return db[_0x9fd9('0x42')][_0x9fd9('0x43')](_0x69e87);})[_0x9fd9('0x24')](function(_0x43e0d3){_0x56c5c9['rows']=_0x43e0d3;return _0x56c5c9;})[_0x9fd9('0x24')](respondWithFilteredResult(_0x5c83bc,_0x69e87))[_0x9fd9('0x44')](handleError(_0x5c83bc,null));};exports['show']=function(_0x294d7b,_0xd48382){var _0x3248ee={'raw':!![],'where':{'id':_0x294d7b['params']['id']}},_0x2f44c9={};_0x2f44c9[_0x9fd9('0x32')]=_['keys'](db[_0x9fd9('0x42')][_0x9fd9('0x2b')]);_0x2f44c9[_0x9fd9('0x2e')]=_[_0x9fd9('0x2f')](_0x294d7b[_0x9fd9('0x2e')]);_0x2f44c9[_0x9fd9('0x30')]=_[_0x9fd9('0x31')](_0x2f44c9[_0x9fd9('0x32')],_0x2f44c9[_0x9fd9('0x2e')]);_0x3248ee['attributes']=_[_0x9fd9('0x31')](_0x2f44c9[_0x9fd9('0x32')],qs[_0x9fd9('0x33')](_0x294d7b[_0x9fd9('0x2e')][_0x9fd9('0x33')]));_0x3248ee[_0x9fd9('0x34')]=_0x3248ee[_0x9fd9('0x34')][_0x9fd9('0x35')]?_0x3248ee[_0x9fd9('0x34')]:_0x2f44c9['model'];if(_0x294d7b[_0x9fd9('0x2e')][_0x9fd9('0x45')]){_0x3248ee[_0x9fd9('0x41')]=[{'all':!![]}];}_0x3248ee=_[_0x9fd9('0x3f')]({},_0x3248ee,_0x294d7b[_0x9fd9('0x40')]);return db[_0x9fd9('0x42')][_0x9fd9('0x46')](_0x3248ee)[_0x9fd9('0x24')](handleEntityNotFound(_0xd48382,null))[_0x9fd9('0x24')](respondWithResult(_0xd48382,null))[_0x9fd9('0x44')](handleError(_0xd48382,null));};exports['create']=function(_0x48c2f2,_0x2dfa03){return db[_0x9fd9('0x42')][_0x9fd9('0x47')](_0x48c2f2[_0x9fd9('0x48')],{})[_0x9fd9('0x24')](respondWithResult(_0x2dfa03,0xc9))[_0x9fd9('0x44')](handleError(_0x2dfa03,null));};exports[_0x9fd9('0x23')]=function(_0xd005fb,_0x9d6619){if(_0xd005fb[_0x9fd9('0x48')]['id']){delete _0xd005fb[_0x9fd9('0x48')]['id'];}return db[_0x9fd9('0x42')][_0x9fd9('0x46')]({'where':{'id':_0xd005fb[_0x9fd9('0x49')]['id']}})[_0x9fd9('0x24')](handleEntityNotFound(_0x9d6619,null))['then'](saveUpdates(_0xd005fb[_0x9fd9('0x48')],null))[_0x9fd9('0x24')](respondWithResult(_0x9d6619,null))[_0x9fd9('0x44')](handleError(_0x9d6619,null));};exports[_0x9fd9('0x25')]=function(_0x2efce4,_0xbf9d97){return db[_0x9fd9('0x42')][_0x9fd9('0x46')]({'where':{'id':_0x2efce4[_0x9fd9('0x49')]['id']}})[_0x9fd9('0x24')](handleEntityNotFound(_0xbf9d97,null))['then'](removeEntity(_0xbf9d97,null))[_0x9fd9('0x44')](handleError(_0xbf9d97,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1ab840b..c0de45a 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 _0x09d0=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x09d0,0x1db));var _0x009d=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0x09d0[_0x22d1ef];return _0x47c5a3;};'use strict';var _=require(_0x009d('0x0'));var util=require('util');var logger=require(_0x009d('0x1'))(_0x009d('0x2'));var moment=require('moment');var BPromise=require(_0x009d('0x3'));var rp=require(_0x009d('0x4'));var fs=require('fs');var path=require(_0x009d('0x5'));var rimraf=require(_0x009d('0x6'));var config=require(_0x009d('0x7'));var attributes=require(_0x009d('0x8'));module[_0x009d('0x9')]=function(_0x1e080e,_0x573de1){return _0x1e080e[_0x009d('0xa')](_0x009d('0xb'),attributes,{'tableName':_0x009d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x009d('0xd')});}; \ No newline at end of file +var _0xd4f0=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4_unicode_ci'];(function(_0x1f66dd,_0x58fe77){var _0x709451=function(_0xca642b){while(--_0xca642b){_0x1f66dd['push'](_0x1f66dd['shift']());}};_0x709451(++_0x58fe77);}(_0xd4f0,0x82));var _0x0d4f=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xd4f0[_0x5311e8];return _0x582ad8;};'use strict';var _=require(_0x0d4f('0x0'));var util=require(_0x0d4f('0x1'));var logger=require(_0x0d4f('0x2'))(_0x0d4f('0x3'));var moment=require('moment');var BPromise=require(_0x0d4f('0x4'));var rp=require(_0x0d4f('0x5'));var fs=require('fs');var path=require(_0x0d4f('0x6'));var rimraf=require('rimraf');var config=require(_0x0d4f('0x7'));var attributes=require(_0x0d4f('0x8'));module[_0x0d4f('0x9')]=function(_0x244ea2,_0x191a98){return _0x244ea2[_0x0d4f('0xa')](_0x0d4f('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0d4f('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1f0524f..c5f956c 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 _0xb225=['attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','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'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xb225,0xa3));var _0x5b22=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0xb225[_0x54fbff];return _0x5cf619;};'use strict';var _=require(_0x5b22('0x0'));var util=require(_0x5b22('0x1'));var moment=require(_0x5b22('0x2'));var BPromise=require(_0x5b22('0x3'));var rs=require(_0x5b22('0x4'));var fs=require('fs');var Redis=require(_0x5b22('0x5'));var db=require(_0x5b22('0x6'))['db'];var utils=require(_0x5b22('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5b22('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b22('0x9')][_0x5b22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b04c0,_0x5256e0,_0x10eaa8){return new BPromise(function(_0x5cb676,_0x455482){return client[_0x5b22('0xb')](_0x1b04c0,_0x10eaa8)[_0x5b22('0xc')](function(_0x1dd2db){logger[_0x5b22('0xd')](_0x5b22('0xe'),_0x5256e0,_0x5b22('0xf'));logger[_0x5b22('0x10')](_0x5b22('0x11'),_0x5256e0,_0x5b22('0xf'),JSON[_0x5b22('0x12')](_0x1dd2db));if(_0x1dd2db['error']){if(_0x1dd2db[_0x5b22('0x13')][_0x5b22('0x14')]===0x1f4){logger['error'](_0x5b22('0xe'),_0x5256e0,_0x1dd2db['error'][_0x5b22('0x15')]);return _0x455482(_0x1dd2db[_0x5b22('0x13')][_0x5b22('0x15')]);}logger[_0x5b22('0x13')](_0x5b22('0xe'),_0x5256e0,_0x1dd2db[_0x5b22('0x13')][_0x5b22('0x15')]);return _0x5cb676(_0x1dd2db[_0x5b22('0x13')]['message']);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x5256e0,_0x5b22('0xf'));_0x5cb676(_0x1dd2db[_0x5b22('0x16')][_0x5b22('0x15')]);}})['catch'](function(_0xb6c56f){logger[_0x5b22('0x13')](_0x5b22('0xe'),_0x5256e0,_0xb6c56f);_0x455482(_0xb6c56f);});});}exports[_0x5b22('0x17')]=function(_0x41d4e5){var _0x571276=this;return new Promise(function(_0x2a8a95,_0x5c0b9d){return db[_0x5b22('0x18')][_0x5b22('0x19')](_0x41d4e5['body'],{'raw':_0x41d4e5[_0x5b22('0x1a')]?_0x41d4e5[_0x5b22('0x1a')][_0x5b22('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41d4e5[_0x5b22('0x1a')]?_0x41d4e5[_0x5b22('0x1a')][_0x5b22('0x1c')]||null:null,'attributes':_0x41d4e5[_0x5b22('0x1a')]?_0x41d4e5[_0x5b22('0x1a')][_0x5b22('0x1d')]||null:null,'limit':_0x41d4e5['options']?_0x41d4e5['options'][_0x5b22('0x1e')]||null:null})[_0x5b22('0xc')](function(_0x4ea1a1){logger[_0x5b22('0xd')](_0x5b22('0x17'),_0x41d4e5);logger[_0x5b22('0x10')](_0x5b22('0x17'),_0x41d4e5,JSON['stringify'](_0x4ea1a1));_0x2a8a95(_0x4ea1a1);})[_0x5b22('0x1f')](function(_0x4c47b){logger[_0x5b22('0x13')](_0x5b22('0x17'),_0x4c47b[_0x5b22('0x15')],_0x41d4e5);_0x5c0b9d(_0x571276['error'](0x1f4,_0x4c47b[_0x5b22('0x15')]));});});}; \ No newline at end of file +var _0xdc31=['client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateFaxApplication','body','options','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x1078a7,_0x389fa8){var _0x371939=function(_0x593fb5){while(--_0x593fb5){_0x1078a7['push'](_0x1078a7['shift']());}};_0x371939(++_0x389fa8);}(_0xdc31,0x13a));var _0x1dc3=function(_0x3f1159,_0x2acc8e){_0x3f1159=_0x3f1159-0x0;var _0x4f37d7=_0xdc31[_0x3f1159];return _0x4f37d7;};'use strict';var _=require(_0x1dc3('0x0'));var util=require(_0x1dc3('0x1'));var moment=require(_0x1dc3('0x2'));var BPromise=require(_0x1dc3('0x3'));var rs=require(_0x1dc3('0x4'));var fs=require('fs');var Redis=require(_0x1dc3('0x5'));var db=require(_0x1dc3('0x6'))['db'];var utils=require(_0x1dc3('0x7'));var logger=require('../../config/logger')(_0x1dc3('0x8'));var config=require('../../config/environment');var jayson=require(_0x1dc3('0x9'));var client=jayson[_0x1dc3('0xa')][_0x1dc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x614525,_0x3478a9,_0x386c7a){return new BPromise(function(_0x3aec36,_0x437c41){return client['request'](_0x614525,_0x386c7a)[_0x1dc3('0xc')](function(_0x4a454d){logger['info'](_0x1dc3('0xd'),_0x3478a9,_0x1dc3('0xe'));logger[_0x1dc3('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3478a9,_0x1dc3('0xe'),JSON[_0x1dc3('0x10')](_0x4a454d));if(_0x4a454d[_0x1dc3('0x11')]){if(_0x4a454d[_0x1dc3('0x11')][_0x1dc3('0x12')]===0x1f4){logger['error'](_0x1dc3('0xd'),_0x3478a9,_0x4a454d[_0x1dc3('0x11')]['message']);return _0x437c41(_0x4a454d[_0x1dc3('0x11')][_0x1dc3('0x13')]);}logger[_0x1dc3('0x11')](_0x1dc3('0xd'),_0x3478a9,_0x4a454d[_0x1dc3('0x11')][_0x1dc3('0x13')]);return _0x3aec36(_0x4a454d['error'][_0x1dc3('0x13')]);}else{logger[_0x1dc3('0x14')]('FaxApplication,\x20%s,\x20%s',_0x3478a9,_0x1dc3('0xe'));_0x3aec36(_0x4a454d['result'][_0x1dc3('0x13')]);}})[_0x1dc3('0x15')](function(_0x3a2cdd){logger[_0x1dc3('0x11')](_0x1dc3('0xd'),_0x3478a9,_0x3a2cdd);_0x437c41(_0x3a2cdd);});});}exports[_0x1dc3('0x16')]=function(_0x1ca04b){var _0x3ff7d9=this;return new Promise(function(_0x2f35f6,_0x2befeb){return db['FaxApplication']['update'](_0x1ca04b[_0x1dc3('0x17')],{'raw':_0x1ca04b[_0x1dc3('0x18')]?_0x1ca04b[_0x1dc3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ca04b[_0x1dc3('0x18')]?_0x1ca04b[_0x1dc3('0x18')]['where']||null:null,'attributes':_0x1ca04b[_0x1dc3('0x18')]?_0x1ca04b['options'][_0x1dc3('0x19')]||null:null,'limit':_0x1ca04b[_0x1dc3('0x18')]?_0x1ca04b['options'][_0x1dc3('0x1a')]||null:null})['then'](function(_0xd59ece){logger[_0x1dc3('0x14')](_0x1dc3('0x16'),_0x1ca04b);logger[_0x1dc3('0xf')](_0x1dc3('0x16'),_0x1ca04b,JSON[_0x1dc3('0x10')](_0xd59ece));_0x2f35f6(_0xd59ece);})[_0x1dc3('0x15')](function(_0x282e0e){logger[_0x1dc3('0x11')](_0x1dc3('0x16'),_0x282e0e[_0x1dc3('0x13')],_0x1ca04b);_0x2befeb(_0x3ff7d9[_0x1dc3('0x11')](0x1f4,_0x282e0e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 681330c..3c52feb 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 _0x3eea=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','post','create','/:id','update','delete'];(function(_0x3bfe9f,_0x599606){var _0x1fd7bd=function(_0x3475e2){while(--_0x3475e2){_0x3bfe9f['push'](_0x3bfe9f['shift']());}};_0x1fd7bd(++_0x599606);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1521e1,_0x401b05){_0x1521e1=_0x1521e1-0x0;var _0x504e4f=_0x3eea[_0x1521e1];return _0x504e4f;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var auth=require(_0xa3ee('0x5'));var interaction=require(_0xa3ee('0x6'));var config=require(_0xa3ee('0x7'));var controller=require(_0xa3ee('0x8'));router[_0xa3ee('0x9')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xb')]);router['get']('/:id',auth[_0xa3ee('0xa')](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0x11')]);module[_0xa3ee('0x12')]=router; \ No newline at end of file +var _0x5d17=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','exports','multer','util','express','Router'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x5d17,0x114));var _0x75d1=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0x5d17[_0x25b24a];return _0x224e68;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x8')](),controller[_0x75d1('0xc')]);router['put']('/:id',auth[_0x75d1('0x8')](),controller['update']);router['delete'](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller['destroy']);module[_0x75d1('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4214581..ab41ee6 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 _0x34aa=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x3bf398,_0x4a9c47){var _0x211860=function(_0x2f47e4){while(--_0x2f47e4){_0x3bf398['push'](_0x3bf398['shift']());}};_0x211860(++_0x4a9c47);}(_0x34aa,0x171));var _0xa34a=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x34aa[_0x21cb7f];return _0x5a079a;};'use strict';var Sequelize=require(_0xa34a('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa34a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa34a('0x2')]},'disposition':{'type':Sequelize[_0xa34a('0x3')]},'secondDisposition':{'type':Sequelize[_0xa34a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa34a('0x3')]},'read1stAt':{'type':Sequelize[_0xa34a('0x2')]},'fax':{'type':Sequelize[_0xa34a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa34a('0x4')]('in',_0xa34a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa34a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa34a('0x4')]('in',_0xa34a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x61df=['out','DATE','STRING','ENUM'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x61df,0xbd));var _0xf61d=function(_0x3c5ba9,_0x50f3f4){_0x3c5ba9=_0x3c5ba9-0x0;var _0x27a1a7=_0x61df[_0x3c5ba9];return _0x27a1a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf61d('0x0')]},'disposition':{'type':Sequelize[_0xf61d('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf61d('0x1')]},'note':{'type':Sequelize[_0xf61d('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xf61d('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xf61d('0x2')]('in',_0xf61d('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf61d('0x0')]},'lastMsgDirection':{'type':Sequelize[_0xf61d('0x2')]('in',_0xf61d('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index fafcc0a..03c13cd 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 _0xf7cb=['FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','show','params','includeAll','include','options','create','body','describe','FaxMessage','omit','ids','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','TagIds','split','forEach','Tags','catch','index','FaxInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact'];(function(_0x9d22d8,_0x51c5da){var _0x52afce=function(_0x579845){while(--_0x579845){_0x9d22d8['push'](_0x9d22d8['shift']());}};_0x52afce(++_0x51c5da);}(_0xf7cb,0x67));var _0xbf7c=function(_0x29e090,_0x51b256){_0x29e090=_0x29e090-0x0;var _0x39b72a=_0xf7cb[_0x29e090];return _0x39b72a;};'use strict';var pdf=require(_0xbf7c('0x0'));var emlformat=require(_0xbf7c('0x1'));var rimraf=require(_0xbf7c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf7c('0x3'));var rp=require(_0xbf7c('0x4'));var moment=require(_0xbf7c('0x5'));var BPromise=require(_0xbf7c('0x6'));var Mustache=require(_0xbf7c('0x7'));var util=require(_0xbf7c('0x8'));var path=require(_0xbf7c('0x9'));var sox=require(_0xbf7c('0xa'));var csv=require(_0xbf7c('0xb'));var ejs=require(_0xbf7c('0xc'));var fs=require('fs');var _=require(_0xbf7c('0xd'));var squel=require(_0xbf7c('0xe'));var crypto=require(_0xbf7c('0xf'));var jsforce=require(_0xbf7c('0x10'));var deskjs=require(_0xbf7c('0x11'));var toCsv=require(_0xbf7c('0xb'));var querystring=require(_0xbf7c('0x12'));var Papa=require(_0xbf7c('0x13'));var Redis=require('ioredis');var authService=require(_0xbf7c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf7c('0x15'))(_0xbf7c('0x16'));var utils=require('../../config/utils');var config=require(_0xbf7c('0x17'));var licenseUtil=require(_0xbf7c('0x18'));var db=require(_0xbf7c('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xbf7c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf7c('0x1b')]));require(_0xbf7c('0x1c'))[_0xbf7c('0x1d')](socket);function respondWithStatusCode(_0x326101,_0x37f64a){_0x37f64a=_0x37f64a||0xcc;return function(_0xfea5dc){if(_0xfea5dc){return _0x326101[_0xbf7c('0x1e')](_0x37f64a);}return _0x326101[_0xbf7c('0x1f')](_0x37f64a)[_0xbf7c('0x20')]();};}function respondWithResult(_0x522203,_0x37d5b4){_0x37d5b4=_0x37d5b4||0xc8;return function(_0x3adc54){if(_0x3adc54){return _0x522203[_0xbf7c('0x1f')](_0x37d5b4)[_0xbf7c('0x21')](_0x3adc54);}};}function respondWithFilteredResult(_0x3b04df,_0x4c427c){return function(_0x48724a){if(_0x48724a){var _0xbf96bd=_0x48724a[_0xbf7c('0x22')],_0x21d814=_0x4c427c[_0xbf7c('0x23')],_0x35e8ac=_0x4c427c['offset']+_0x4c427c[_0xbf7c('0x24')],_0x1e7e8c;if(_0x35e8ac>=_0xbf96bd){_0x35e8ac=_0xbf96bd;_0x1e7e8c=0xc8;}else{_0x1e7e8c=0xce;}_0x3b04df[_0xbf7c('0x1f')](_0x1e7e8c);return _0x3b04df[_0xbf7c('0x25')](_0xbf7c('0x26'),_0x21d814+'-'+_0x35e8ac+'/'+_0xbf96bd)[_0xbf7c('0x21')](_0x48724a);}return null;};}function patchUpdates(_0x321962){return function(_0x530034){try{jsonpatch[_0xbf7c('0x27')](_0x530034,_0x321962,!![]);}catch(_0x141ec8){return BPromise['reject'](_0x141ec8);}return _0x530034[_0xbf7c('0x28')]();};}function saveUpdates(_0x143cfa,_0x3907d8){return function(_0x6c6594){if(_0x6c6594){return _0x6c6594[_0xbf7c('0x29')](_0x143cfa)[_0xbf7c('0x2a')](function(_0x52b7f9){return _0x52b7f9;});}return null;};}function removeEntity(_0x5e82a5,_0x24c167){return function(_0x5545fc){if(_0x5545fc){return _0x5545fc[_0xbf7c('0x2b')]()[_0xbf7c('0x2a')](function(){_0x5e82a5[_0xbf7c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5be560,_0x56fa0a){return function(_0x40c1c0){if(!_0x40c1c0){_0x5be560[_0xbf7c('0x1e')](0x194);}return _0x40c1c0;};}function handleError(_0x48874e,_0x273243){_0x273243=_0x273243||0x1f4;return function(_0x518b48){logger['error'](_0x518b48[_0xbf7c('0x2c')]);if(_0x518b48[_0xbf7c('0x2d')]){delete _0x518b48['name'];}_0x48874e[_0xbf7c('0x1f')](_0x273243)[_0xbf7c('0x2e')](_0x518b48);};}function getInteractionUsers(_0x1178ba,_0x12eaa1){return new BPromise(function(_0x90aa55,_0x5bf2f0){try{if(_0x12eaa1[_0x1178ba['id']]){_0x1178ba['Users']=_[_0xbf7c('0x2f')](_0x12eaa1[_0x1178ba['id']],function(_0x5d0f8a){return{'id':_0x5d0f8a['id'],'fullname':_0x5d0f8a['fullname']};});}}catch(_0x200e1b){_0x5bf2f0(_0x200e1b);}_0x90aa55(_0x1178ba);});}function getInteractionTags(_0x50f3d3,_0x1fb295){return new BPromise(function(_0x1d9e25,_0x24831f){try{if(_0x50f3d3['TagIds']){_0x50f3d3['Tags']=[];_0x50f3d3[_0xbf7c('0x30')][_0xbf7c('0x31')](',')[_0xbf7c('0x32')](function(_0x518677){_0x50f3d3[_0xbf7c('0x33')]['push'](_0x1fb295[_0x518677]);});}delete _0x50f3d3['TagIds'];}catch(_0x91dc85){_0x24831f(_0x91dc85);}_0x1d9e25(_0x50f3d3);});}function updateFaxInteraction(_0x50e398,_0xc38f78,_0x1550a0){return new BPromise(function(_0x535c0e,_0x2ad0f6){return getInteractionUsers(_0x50e398,_0x1550a0)['then'](function(_0x33ed5c){return getInteractionTags(_0x33ed5c,_0xc38f78);})[_0xbf7c('0x2a')](function(_0x476efe){_0x535c0e(_0x476efe);})[_0xbf7c('0x34')](function(_0xfb5be8){_0x2ad0f6(_0xfb5be8);});});}exports[_0xbf7c('0x35')]=function(_0x329829,_0x16e2d7){var _0x5175d6={},_0x48ab7e={},_0x259dce={'count':0x0,'rows':[]};var _0x9f3abe=_[_0xbf7c('0x2f')](db[_0xbf7c('0x36')][_0xbf7c('0x37')],function(_0x155881){return{'name':_0x155881[_0xbf7c('0x38')],'type':_0x155881['type'][_0xbf7c('0x39')]};});_0x48ab7e[_0xbf7c('0x3a')]=_['map'](_0x9f3abe,'name');_0x48ab7e[_0xbf7c('0x3b')]=_[_0xbf7c('0x3c')](_0x329829[_0xbf7c('0x3b')]);_0x48ab7e[_0xbf7c('0x3d')]=_[_0xbf7c('0x3e')](_0x48ab7e[_0xbf7c('0x3a')],_0x48ab7e['query']);_0x5175d6[_0xbf7c('0x3f')]=_[_0xbf7c('0x3e')](_0x48ab7e['model'],qs[_0xbf7c('0x40')](_0x329829[_0xbf7c('0x3b')]['fields']));_0x5175d6[_0xbf7c('0x3f')]=_0x5175d6['attributes']['length']?_0x5175d6[_0xbf7c('0x3f')]:_0x48ab7e[_0xbf7c('0x3a')];if(!_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x41')](_0xbf7c('0x42'))){_0x5175d6['limit']=qs['limit'](_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x24')]);_0x5175d6[_0xbf7c('0x23')]=qs['offset'](_0x329829['query'][_0xbf7c('0x23')]);}_0x5175d6[_0xbf7c('0x43')]=qs['sort'](_0x329829[_0xbf7c('0x3b')]['sort']);_0x5175d6[_0xbf7c('0x44')]=qs['filters'](_[_0xbf7c('0x45')](_0x329829[_0xbf7c('0x3b')],_0x48ab7e[_0xbf7c('0x3d')]),_0x9f3abe);var _0xffdf47=[];var _0x1a1eaf=squel[_0xbf7c('0x46')]()[_0xbf7c('0x47')]('id')[_0xbf7c('0x47')](_0xbf7c('0x2d'))[_0xbf7c('0x47')](_0xbf7c('0x48'))[_0xbf7c('0x49')]('tools_tags');var _0x17f77b=squel[_0xbf7c('0x46')]()['field'](_0xbf7c('0x4a'))[_0xbf7c('0x47')](_0xbf7c('0x4b'))[_0xbf7c('0x47')](_0xbf7c('0x4c'))[_0xbf7c('0x49')](_0xbf7c('0x4d'),'ui')[_0xbf7c('0x4e')](_0xbf7c('0x4f'),'u',_0xbf7c('0x50'));var _0x1bb1a7=squel[_0xbf7c('0x46')]()[_0xbf7c('0x49')](_0xbf7c('0x51'),'i')[_0xbf7c('0x4e')]('cm_contacts','c',_0xbf7c('0x52'))[_0xbf7c('0x4e')](_0xbf7c('0x4f'),'o',_0xbf7c('0x53'))[_0xbf7c('0x4e')](_0xbf7c('0x54'),'a','a.id\x20=\x20i.FaxAccountId')[_0xbf7c('0x4e')](_0xbf7c('0x55'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join']('fax_interaction_has_tags','it',_0xbf7c('0x56'))[_0xbf7c('0x4e')](_0xbf7c('0x57'),'t',_0xbf7c('0x58'));var _0x4d8964=squel['expr']();var _0x2c33a0=[];var _0x54433d=squel[_0xbf7c('0x59')]();var _0x2bade0;if(_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x5a')]){_0x2bade0=as[_0xbf7c('0x5b')](_0x329829[_0xbf7c('0x3b')]['search']);var _0x54a19d=_0x2bade0[_0xbf7c('0x5c')];for(var _0x37b8d4=0x0;_0x37b8d4<_0x2bade0[_0xbf7c('0x5d')][_0xbf7c('0x5e')];_0x37b8d4++){var _0x37c6b7=_0x2bade0[_0xbf7c('0x5d')][_0x37b8d4];var _0x30ffea='i';var _0x44d089=_[_0xbf7c('0x5f')](_0x9f3abe,['name',_0x37c6b7[_0xbf7c('0x47')]]);if(!_0x44d089){switch(_0x37c6b7[_0xbf7c('0x47')]){case'unreadMessages':if(_0x37c6b7[_0xbf7c('0x60')]==0x1){_0x1bb1a7[_0xbf7c('0x61')]('`'+_0x37c6b7[_0xbf7c('0x47')]+_0xbf7c('0x62'));}else{_0x1bb1a7['having']('`'+_0x37c6b7[_0xbf7c('0x47')]+_0xbf7c('0x63'));}break;case _0xbf7c('0x64'):if(_0x37c6b7['operator']===_0xbf7c('0x65')){if(_0x37c6b7[_0xbf7c('0x60')]['split']('\x20')[_0xbf7c('0x5e')]>0x1){_0x4d8964[_0x54a19d](_0xbf7c('0x66'),qs[_0xbf7c('0x67')](_0x37c6b7[_0xbf7c('0x60')]),null);}else{var _0x352642='%'+_0x37c6b7['value']+'%';_0x4d8964[_0x54a19d](_0xbf7c('0x68'),_0x352642,_0x352642,_0x352642);}}else{_0x44d089=_['find'](_0x9f3abe,[_0xbf7c('0x2d'),_0xbf7c('0x69')]);_0x37c6b7[_0xbf7c('0x47')]=_0xbf7c('0x69');_0x401f6b=as['buildExpression'](_0x30ffea,_0x44d089[_0xbf7c('0x6a')],_0x37c6b7);_0x4d8964[_0x54a19d](_0x401f6b[_0xbf7c('0x6b')],_0x401f6b[_0xbf7c('0x60')][_0xbf7c('0x6c')],_0x401f6b[_0xbf7c('0x60')]['end']);}break;case _0xbf7c('0x6d'):var _0x2554ad=_0x37c6b7[_0xbf7c('0x60')]['split'](',')[_0xbf7c('0x2f')](function(_0x5bbd62){return Number(_0x5bbd62);});_0x2554ad[_0xbf7c('0x32')](function(_0x32798a){_0x54433d['or'](_0xbf7c('0x6e'),'%,'+_0x32798a+',%');});_0x2c33a0=_[_0xbf7c('0x6f')](_0x2c33a0,_0x2554ad);break;case _0xbf7c('0x70'):if(_0x37c6b7[_0xbf7c('0x71')]===_0xbf7c('0x65')){_0x4d8964[_0x54a19d](_0xbf7c('0x72'),'%'+_0x37c6b7['value']+'%',null);}else{_0x44d089=_['find'](_0x9f3abe,[_0xbf7c('0x2d'),_0xbf7c('0x73')]);_0x37c6b7['field']=_0xbf7c('0x73');_0x401f6b=as[_0xbf7c('0x74')](_0x30ffea,_0x44d089[_0xbf7c('0x6a')],_0x37c6b7);_0x4d8964[_0x54a19d](_0x401f6b['text'],_0x401f6b[_0xbf7c('0x60')][_0xbf7c('0x6c')],_0x401f6b['value'][_0xbf7c('0x20')]);}break;case'body':_0x401f6b=as[_0xbf7c('0x74')]('me',null,_0x37c6b7);_0x4d8964[_0x54a19d](_0x401f6b['text'],_0x401f6b['value']['start'],_0x401f6b[_0xbf7c('0x60')][_0xbf7c('0x20')]);break;}}else{var _0x401f6b=as[_0xbf7c('0x74')](_0x30ffea,_0x44d089[_0xbf7c('0x6a')],_0x37c6b7);_0x4d8964[_0x54a19d](_0x401f6b['text'],_0x401f6b[_0xbf7c('0x60')][_0xbf7c('0x6c')],_0x401f6b['value']['end']);}}}else{var _0x5435d5=_(_0x329829[_0xbf7c('0x3b')])[_0xbf7c('0x3c')]()['map'](function(_0x386ecc){return _[_0xbf7c('0x75')](_0x9f3abe,[_0xbf7c('0x2d'),_0x386ecc])?_0x386ecc:undefined;})[_0xbf7c('0x76')]()['value']();if(!_['isEmpty'](_0x5435d5)){_0x5435d5[_0xbf7c('0x32')](function(_0x13ee4c){if(_0x13ee4c===_0xbf7c('0x77')){_0x1bb1a7[_0xbf7c('0x44')](_0xbf7c('0x78'),[]['concat'](_0x329829['query'][_0x13ee4c]));}else if(_0x13ee4c===_0xbf7c('0x79')){var _0xa015ef=JSON[_0xbf7c('0x7a')](_0x329829[_0xbf7c('0x3b')][_0x13ee4c])['$gte'];var _0x128c33=JSON['parse'](_0x329829['query'][_0x13ee4c])[_0xbf7c('0x7b')];_0x1bb1a7['where'](_0xbf7c('0x7c'),_0xa015ef,_0x128c33);}else{if(_0x329829[_0xbf7c('0x3b')][_0x13ee4c]===_0xbf7c('0x7d')){_0x1bb1a7[_0xbf7c('0x44')]('i.'+_0x13ee4c+'\x20IS\x20NULL');}else{_0x1bb1a7['where']('i.'+_0x13ee4c+'\x20=\x20?',_0x329829[_0xbf7c('0x3b')][_0x13ee4c]);}}});}if(_0x329829[_0xbf7c('0x3b')]['read']){if(_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x7e')]==0x1){_0x1bb1a7['having'](_0xbf7c('0x7f'));}else{_0x1bb1a7[_0xbf7c('0x61')](_0xbf7c('0x80'));}}if(_0x329829[_0xbf7c('0x3b')]['tag']){_0x2c33a0=_[_0xbf7c('0x81')](_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x82')])?_0x329829[_0xbf7c('0x3b')]['tag']:new Array(_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x82')]);_0x2c33a0[_0xbf7c('0x32')](function(_0x4113e9){_0x54433d['or'](_0xbf7c('0x6e'),'%,'+_0x4113e9+',%');});}if(_0x329829['query'][_0xbf7c('0x83')]){var _0x15f747=_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x83')][_0xbf7c('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x15f747)){_0x4d8964['or'](_0xbf7c('0x85'),_0x15f747+'%')['or'](_0xbf7c('0x86'),_0x15f747+'%');}_0x4d8964['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x15f747+'%');}}_0x1bb1a7['where'](_0x4d8964);_0x1bb1a7[_0xbf7c('0x87')]('i.id');var _0x8db3ab={'type':db[_0xbf7c('0x88')]['QueryTypes'][_0xbf7c('0x89')],'raw':!![]};var _0x5b4c45=_0x1bb1a7[_0xbf7c('0x8a')]();_0x5b4c45[_0xbf7c('0x47')](_0xbf7c('0x8b'));_0x5b4c45[_0xbf7c('0x47')](_0xbf7c('0x8c'),_0xbf7c('0x8d'));if(_0x5175d6[_0xbf7c('0x43')]){_0x5175d6['order']['forEach'](function(_0x398dd1){var _0x3d9262=_0x398dd1[0x0]===_0xbf7c('0x8e')?_0x398dd1[0x0]:'i.'+_0x398dd1[0x0];_0x1bb1a7['order'](_0x3d9262,_0x398dd1[0x1]===_0xbf7c('0x8f')?![]:!![]);});}if(!_[_0xbf7c('0x90')](_0x2c33a0)){_0x1bb1a7[_0xbf7c('0x61')](_0x54433d);_0x5b4c45[_0xbf7c('0x44')](_0xbf7c('0x91'),_0x2c33a0);}BPromise['resolve']()[_0xbf7c('0x2a')](function(){if(!_0x2bade0){if(_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x77')])return;_0x5b4c45['where'](_0xbf7c('0x92'));_0x1bb1a7[_0xbf7c('0x44')](_0xbf7c('0x92'));return;}if(_0x329829['user'][_0xbf7c('0x93')]!==_0xbf7c('0x94'))return;return _0x329829['user'][_0xbf7c('0x95')]({'attributes':['id'],'raw':!![]})[_0xbf7c('0x2a')](function(_0x549399){if(_[_0xbf7c('0x90')](_0x549399)){_0x5b4c45[_0xbf7c('0x44')](_0xbf7c('0x96'));_0x1bb1a7[_0xbf7c('0x44')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x5b4c45['where']('i.FaxAccountId\x20IN\x20?',_[_0xbf7c('0x2f')](_0x549399,'id'));_0x1bb1a7[_0xbf7c('0x44')](_0xbf7c('0x78'),_['map'](_0x549399,'id'));}});})[_0xbf7c('0x2a')](function(){if(_0x329829[_0xbf7c('0x97')][_0xbf7c('0x93')]===_0xbf7c('0x94')&&!_0x2bade0&&!_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x77')])return[];return db[_0xbf7c('0x98')][_0xbf7c('0x3b')](_0x5b4c45[_0xbf7c('0x99')](),_0x8db3ab);})[_0xbf7c('0x2a')](function(_0x556130){_0x259dce['count']=_0x556130[_0xbf7c('0x5e')];if(_0x259dce[_0xbf7c('0x22')]===0x0)return[];return db['sequelize'][_0xbf7c('0x3b')](_0x1a1eaf[_0xbf7c('0x99')](),_0x8db3ab)[_0xbf7c('0x2a')](function(_0x2e0cd9){_0xffdf47=_[_0xbf7c('0x9a')](_0x2e0cd9,'id');_0x8db3ab=_[_0xbf7c('0x9b')](_0x8db3ab,{'model':db[_0xbf7c('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x329829[_0xbf7c('0x3b')][_0xbf7c('0x40')]){_0x5175d6[_0xbf7c('0x3f')][_0xbf7c('0x32')](function(_0x3951c9){_0x1bb1a7[_0xbf7c('0x47')]('i.'+_0x3951c9);});}else{_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0x8c'),_0xbf7c('0x8d'));_0x1bb1a7['field'](_0xbf7c('0x9c'),'Account.key');_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0x9d'),_0xbf7c('0x9e'));_0x1bb1a7['field'](_0xbf7c('0x9f'),_0xbf7c('0x8e'));_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0xa0'));_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0xa1'),_0xbf7c('0xa2'));_0x1bb1a7[_0xbf7c('0x47')]('c.lastName',_0xbf7c('0xa3'));_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0xa4'),_0xbf7c('0xa5'));_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0xa6'),_0xbf7c('0xa7'));_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0xa8'),_0xbf7c('0xa9'));_0x1bb1a7[_0xbf7c('0x47')]('c.fax',_0xbf7c('0xaa'));_0x1bb1a7[_0xbf7c('0x47')]('o.fullname',_0xbf7c('0xab'));_0x1bb1a7['field'](_0xbf7c('0xac'),'Owner.internal');_0x1bb1a7[_0xbf7c('0x47')](_0xbf7c('0xad'),'TagIds');}if(_0x5175d6['limit'])_0x1bb1a7[_0xbf7c('0x24')](_0x5175d6[_0xbf7c('0x24')]);if(_0x5175d6[_0xbf7c('0x23')])_0x1bb1a7[_0xbf7c('0x23')](_0x5175d6[_0xbf7c('0x23')]);return db[_0xbf7c('0x98')]['query'](_0x1bb1a7[_0xbf7c('0x99')](),_0x8db3ab);})['then'](function(_0x1e7189){_0x17f77b[_0xbf7c('0x44')]('ui.FaxInteractionId\x20IN\x20?',_[_0xbf7c('0x2f')](_0x1e7189,'id'));return db[_0xbf7c('0x98')][_0xbf7c('0x3b')](_0x17f77b[_0xbf7c('0x99')](),_0x8db3ab)['then'](function(_0x230884){var _0x5c18d0=_[_0xbf7c('0xae')](_0x230884,_0xbf7c('0xaf'));var _0x2e6dc4=[];_0x1e7189['forEach'](function(_0x55e72c){_0x2e6dc4['push'](updateFaxInteraction(_0x55e72c,_0xffdf47,_0x5c18d0));});return BPromise[_0xbf7c('0xb0')](_0x2e6dc4);});});})[_0xbf7c('0x2a')](function(_0x15b68b){_0x259dce['rows']=_0x15b68b;return _0x259dce;})[_0xbf7c('0x2a')](respondWithFilteredResult(_0x16e2d7,_0x5175d6))['catch'](handleError(_0x16e2d7,null));};exports[_0xbf7c('0xb1')]=function(_0x215c55,_0x48a53c){var _0x286628={'raw':![],'where':{'id':_0x215c55[_0xbf7c('0xb2')]['id']}},_0x4209a9={};_0x4209a9[_0xbf7c('0x3a')]=_['keys'](db[_0xbf7c('0x36')]['rawAttributes']);_0x4209a9['query']=_[_0xbf7c('0x3c')](_0x215c55[_0xbf7c('0x3b')]);_0x4209a9[_0xbf7c('0x3d')]=_[_0xbf7c('0x3e')](_0x4209a9[_0xbf7c('0x3a')],_0x4209a9[_0xbf7c('0x3b')]);_0x286628['attributes']=_[_0xbf7c('0x3e')](_0x4209a9['model'],qs[_0xbf7c('0x40')](_0x215c55[_0xbf7c('0x3b')]['fields']));_0x286628[_0xbf7c('0x3f')]=_0x286628[_0xbf7c('0x3f')][_0xbf7c('0x5e')]?_0x286628['attributes']:_0x4209a9[_0xbf7c('0x3a')];if(_0x215c55[_0xbf7c('0x3b')][_0xbf7c('0xb3')]){_0x286628[_0xbf7c('0xb4')]=[{'all':!![]}];}_0x286628=_[_0xbf7c('0x9b')]({},_0x286628,_0x215c55[_0xbf7c('0xb5')]);return db[_0xbf7c('0x36')][_0xbf7c('0x5f')](_0x286628)[_0xbf7c('0x2a')](handleEntityNotFound(_0x48a53c,null))[_0xbf7c('0x2a')](respondWithResult(_0x48a53c,null))[_0xbf7c('0x34')](handleError(_0x48a53c,null));};exports[_0xbf7c('0xb6')]=function(_0x5f0bb2,_0x14dafa){return db[_0xbf7c('0x36')][_0xbf7c('0xb6')](_0x5f0bb2['body'],{})[_0xbf7c('0x2a')](respondWithResult(_0x14dafa,0xc9))[_0xbf7c('0x34')](handleError(_0x14dafa,null));};exports[_0xbf7c('0x29')]=function(_0x433e70,_0x2926a2){if(_0x433e70[_0xbf7c('0xb7')]['id']){delete _0x433e70[_0xbf7c('0xb7')]['id'];}return db['FaxInteraction'][_0xbf7c('0x5f')]({'where':{'id':_0x433e70[_0xbf7c('0xb2')]['id']}})[_0xbf7c('0x2a')](handleEntityNotFound(_0x2926a2,null))[_0xbf7c('0x2a')](saveUpdates(_0x433e70[_0xbf7c('0xb7')],null))[_0xbf7c('0x2a')](respondWithResult(_0x2926a2,null))['catch'](handleError(_0x2926a2,null));};exports[_0xbf7c('0x2b')]=function(_0xc124a7,_0x573500){return db[_0xbf7c('0x36')][_0xbf7c('0x5f')]({'where':{'id':_0xc124a7[_0xbf7c('0xb2')]['id']}})[_0xbf7c('0x2a')](handleEntityNotFound(_0x573500,null))['then'](removeEntity(_0x573500,null))['catch'](handleError(_0x573500,null));};exports[_0xbf7c('0xb8')]=function(_0x1ad7b4,_0x4f4acc){return db[_0xbf7c('0x36')]['describe']()[_0xbf7c('0x2a')](respondWithResult(_0x4f4acc,null))[_0xbf7c('0x34')](handleError(_0x4f4acc,null));};exports['addMessage']=function(_0x313347,_0x109c97,_0xf94478){return db[_0xbf7c('0xb9')][_0xbf7c('0x5f')]({'where':{'id':_0x313347[_0xbf7c('0xb2')]['id']}})[_0xbf7c('0x2a')](handleEntityNotFound(_0x109c97,null))[_0xbf7c('0x2a')](function(_0x5670fc){if(_0x5670fc){return _0x5670fc['addMessage'](_0x313347['body']['ids'],_[_0xbf7c('0xba')](_0x313347['body'],[_0xbf7c('0xbb'),'id'])||{});}})[_0xbf7c('0x2a')](respondWithResult(_0x109c97,null))['catch'](handleError(_0x109c97,null));};exports[_0xbf7c('0xbc')]=function(_0x49facf,_0x1e7a20,_0x476a1c){var _0x1f00b8={'raw':![],'where':{}};var _0x3e7845={};var _0x3f4118={'count':0x0,'rows':[]};return db[_0xbf7c('0x36')]['findOne']({'where':{'id':_0x49facf[_0xbf7c('0xb2')]['id']}})['then'](handleEntityNotFound(_0x1e7a20,null))[_0xbf7c('0x2a')](function(_0x45d94b){if(_0x45d94b){_0x3e7845['model']=_[_0xbf7c('0x3c')](db[_0xbf7c('0xb9')][_0xbf7c('0x37')]);_0x3e7845[_0xbf7c('0x3b')]=_[_0xbf7c('0x3c')](_0x49facf[_0xbf7c('0x3b')]);_0x3e7845[_0xbf7c('0x3d')]=_[_0xbf7c('0x3e')](_0x3e7845[_0xbf7c('0x3a')],_0x3e7845['query']);_0x1f00b8['attributes']=_[_0xbf7c('0x3e')](_0x3e7845[_0xbf7c('0x3a')],qs[_0xbf7c('0x40')](_0x49facf['query'][_0xbf7c('0x40')]));_0x1f00b8['attributes']=_0x1f00b8[_0xbf7c('0x3f')][_0xbf7c('0x5e')]?_0x1f00b8[_0xbf7c('0x3f')]:_0x3e7845[_0xbf7c('0x3a')];if(!_0x49facf[_0xbf7c('0x3b')][_0xbf7c('0x41')](_0xbf7c('0x42'))){_0x1f00b8['limit']=qs[_0xbf7c('0x24')](_0x49facf[_0xbf7c('0x3b')][_0xbf7c('0x24')]);_0x1f00b8[_0xbf7c('0x23')]=qs[_0xbf7c('0x23')](_0x49facf[_0xbf7c('0x3b')][_0xbf7c('0x23')]);}_0x1f00b8[_0xbf7c('0x43')]=qs['sort'](_0x49facf[_0xbf7c('0x3b')]['sort']);_0x1f00b8[_0xbf7c('0x44')]=qs[_0xbf7c('0x3d')](_[_0xbf7c('0x45')](_0x49facf['query'],_0x3e7845[_0xbf7c('0x3d')]));_0x1f00b8[_0xbf7c('0x44')][_0xbf7c('0xaf')]=_0x45d94b['id'];if(_0x49facf[_0xbf7c('0x3b')][_0xbf7c('0x83')]){_0x1f00b8[_0xbf7c('0x44')]=_[_0xbf7c('0x9b')](_0x1f00b8[_0xbf7c('0x44')],{'$or':_[_0xbf7c('0x2f')](_0x1f00b8[_0xbf7c('0x3f')],function(_0x114b9d){var _0x22b5fd={};_0x22b5fd[_0x114b9d]={'$like':'%'+_0x49facf['query'][_0xbf7c('0x83')]+'%'};return _0x22b5fd;})});}if(_0x49facf[_0xbf7c('0x3b')][_0xbf7c('0xbd')]){var _0x4cb1d8=_0x49facf[_0xbf7c('0x3b')][_0xbf7c('0xbd')][_0xbf7c('0x31')](',');var _0x4f222c={};_0x4f222c[_0x4cb1d8[0x0]]={'$gte':moment(_0x4cb1d8[0x1])[_0xbf7c('0xbe')](_0xbf7c('0xbf'))};_0x1f00b8['where']=_[_0xbf7c('0x9b')](_0x1f00b8['where'],_0x4f222c);}_0x1f00b8=_[_0xbf7c('0x9b')]({},_0x1f00b8,_0x49facf[_0xbf7c('0xb5')]);return db[_0xbf7c('0xb9')][_0xbf7c('0x22')]({'where':_0x1f00b8[_0xbf7c('0x44')]})['then'](function(_0x3bc20d){_0x3f4118[_0xbf7c('0x22')]=_0x3bc20d;if(_0x49facf['query']['includeAll']){_0x1f00b8[_0xbf7c('0xb4')]=[{'all':!![]}];}return db[_0xbf7c('0xb9')][_0xbf7c('0xc0')](_0x1f00b8);})[_0xbf7c('0x2a')](function(_0x5cc57f){_0x3f4118[_0xbf7c('0xc1')]=_0x5cc57f;return _0x3f4118;});}})['then'](respondWithFilteredResult(_0x1e7a20,_0x1f00b8))[_0xbf7c('0x34')](handleError(_0x1e7a20,null));};exports[_0xbf7c('0xc2')]=function(_0x407d9e,_0x78c106,_0x443034){return db[_0xbf7c('0x36')]['find']({'where':{'id':_0x407d9e['params']['id']}})[_0xbf7c('0x2a')](handleEntityNotFound(_0x78c106,null))[_0xbf7c('0x2a')](function(_0x4afd57){if(_0x4afd57){return _0x4afd57[_0xbf7c('0xc3')](_0x407d9e[_0xbf7c('0xb7')][_0xbf7c('0xbb')],_[_0xbf7c('0xba')](_0x407d9e[_0xbf7c('0xb7')],[_0xbf7c('0xbb'),'id'])||{})[_0xbf7c('0xc4')](function(){return db[_0xbf7c('0x6d')][_0xbf7c('0xc0')]({'attributes':['id',_0xbf7c('0x2d'),'color'],'where':{'id':_0x407d9e[_0xbf7c('0xb7')][_0xbf7c('0xbb')]}});})[_0xbf7c('0x2a')](function(_0x34d322){socket[_0xbf7c('0xc5')]('faxInteractionTags:save',{'id':Number(_0x407d9e[_0xbf7c('0xb2')]['id']),'tags':_0x34d322||[]});return{'id':Number(_0x407d9e[_0xbf7c('0xb2')]['id']),'tags':_0x34d322||[]};});}})[_0xbf7c('0x2a')](respondWithResult(_0x78c106,null))[_0xbf7c('0x34')](handleError(_0x78c106,null));};exports[_0xbf7c('0xc6')]=function(_0x21e5d0,_0x539bbd,_0x385276){return db[_0xbf7c('0x36')]['find']({'where':{'id':_0x21e5d0[_0xbf7c('0xb2')]['id']}})[_0xbf7c('0x2a')](handleEntityNotFound(_0x539bbd,null))[_0xbf7c('0x2a')](function(_0x21c537){if(_0x21c537){return _0x21c537['removeTags'](_0x21e5d0[_0xbf7c('0x3b')][_0xbf7c('0xbb')]);}})[_0xbf7c('0x2a')](respondWithStatusCode(_0x539bbd,null))[_0xbf7c('0x34')](handleError(_0x539bbd,null));};exports[_0xbf7c('0xc7')]=function(_0x2df596,_0x3edeb5){var _0x4e37c1=moment()[_0xbf7c('0xc8')]()['toString']();var _0x334005=path['join'](config[_0xbf7c('0xc9')],_0xbf7c('0xca'),_0xbf7c('0xcb'),_0xbf7c('0xcc'));var _0x1dc056=path[_0xbf7c('0xcd')](config['root'],'server',_0xbf7c('0xcb'),_0xbf7c('0xce'));var _0x19dfda=path['join'](_0x334005,_0x4e37c1);var _0x11820b=util['format'](_0xbf7c('0xcf'),_0x2df596[_0xbf7c('0xb2')]['id'],_0x4e37c1);var _0x364a2f=path[_0xbf7c('0xcd')](_0x334005,_0x11820b);var _0x3149a=[];_0x3149a[_0xbf7c('0xd0')]({'model':db[_0xbf7c('0xd1')],'as':_0xbf7c('0xd1'),'raw':!![]});var _0x28e73c=[{'model':db[_0xbf7c('0xb9')],'as':_0xbf7c('0xd2'),'attributes':['id',_0xbf7c('0xb7'),'createdAt'],'include':_0x3149a}];return db[_0xbf7c('0x36')][_0xbf7c('0x5f')]({'where':{'id':_0x2df596['params']['id']},'include':_0x28e73c})[_0xbf7c('0x2a')](handleEntityNotFound(_0x3edeb5,null))[_0xbf7c('0x2a')](function(_0x4d1255){if(_0x4d1255&&_0x4d1255[_0xbf7c('0xd2')]){var _0xb3ad90=_0x4d1255[_0xbf7c('0xd3')]({'plain':!![]});fs[_0xbf7c('0xd4')](_0x19dfda);for(var _0x161985=0x0;_0x161985<_0xb3ad90[_0xbf7c('0xd2')]['length'];_0x161985++){var _0x74028f=_0xb3ad90['Messages'][_0x161985][_0xbf7c('0xd1')];if(_0x74028f){var _0x2297d4=path[_0xbf7c('0xcd')](_0x1dc056,_0x74028f[_0xbf7c('0xd5')]);if(fs[_0xbf7c('0xd6')](_0x2297d4)){fs[_0xbf7c('0xd7')](_0x2297d4)[_0xbf7c('0xd8')](fs[_0xbf7c('0xd9')](path[_0xbf7c('0xcd')](_0x19dfda,_0x74028f[_0xbf7c('0xd5')])));}}}return BPromise[_0xbf7c('0xda')]()[_0xbf7c('0x2a')](function(){return new BPromise(function(_0x341734,_0x3acf76){zipdir(_0x19dfda,{'saveTo':_0x364a2f},function(_0xc6c405,_0x106483){if(_0xc6c405)return _0x3acf76(_0xc6c405);return _0x341734(_0x106483);});})[_0xbf7c('0x2a')](function(){return new BPromise(function(_0x53c7fe,_0x54bfe3){rimraf(_0x19dfda,function(_0x278459){if(_0x278459)_0x54bfe3(_0x278459);return _0x53c7fe();});});})[_0xbf7c('0x2a')](function(){return _0x3edeb5[_0xbf7c('0xc7')](_0x364a2f,_0x11820b,function(_0x35e6d4){if(_0x35e6d4){console[_0xbf7c('0xdb')](_0xbf7c('0xdc'),_0x35e6d4);}else{fs[_0xbf7c('0xdd')](_0x364a2f);}});});});}else{return _0x3edeb5['sendStatus'](0xc8);}})[_0xbf7c('0x34')](handleError(_0x3edeb5,null));}; \ No newline at end of file +var _0x1726=['Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','DESC','t.id\x20IN\x20?','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','isEmpty','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','keyBy','merge','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','contactName','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','includeAll','include','options','create','describe','addMessage','ids','getMessages','FaxMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','findAll','removeTags','download','unix','join','files','tmp','root','server','attachments','Attachment','Messages','get','mkdirSync','basename','pipe','createWriteStream','resolve','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','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','defaults','redis','localhost','./faxInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','field','color','from','select','u.id','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','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','start','end'];(function(_0x5f5666,_0x3ada8a){var _0x262b90=function(_0x24e496){while(--_0x24e496){_0x5f5666['push'](_0x5f5666['shift']());}};_0x262b90(++_0x3ada8a);}(_0x1726,0x142));var _0x6172=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x1726[_0x391c55];return _0xa434e0;};'use strict';var pdf=require(_0x6172('0x0'));var emlformat=require(_0x6172('0x1'));var rimraf=require(_0x6172('0x2'));var zipdir=require(_0x6172('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6172('0x4'));var moment=require(_0x6172('0x5'));var BPromise=require(_0x6172('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6172('0x7'));var sox=require(_0x6172('0x8'));var csv=require(_0x6172('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6172('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6172('0xb'));var deskjs=require(_0x6172('0xc'));var toCsv=require(_0x6172('0x9'));var querystring=require(_0x6172('0xd'));var Papa=require(_0x6172('0xe'));var Redis=require(_0x6172('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6172('0x10'));var as=require(_0x6172('0x11'));var hardwareService=require(_0x6172('0x12'));var logger=require(_0x6172('0x13'))(_0x6172('0x14'));var utils=require(_0x6172('0x15'));var config=require(_0x6172('0x16'));var licenseUtil=require(_0x6172('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6172('0x18')](config[_0x6172('0x19')],{'host':_0x6172('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6172('0x1b'))[_0x6172('0x1c')](socket);function respondWithStatusCode(_0x3a938e,_0x394d8f){_0x394d8f=_0x394d8f||0xcc;return function(_0x54d2a6){if(_0x54d2a6){return _0x3a938e[_0x6172('0x1d')](_0x394d8f);}return _0x3a938e[_0x6172('0x1e')](_0x394d8f)['end']();};}function respondWithResult(_0x875004,_0x5d009a){_0x5d009a=_0x5d009a||0xc8;return function(_0x49b45f){if(_0x49b45f){return _0x875004[_0x6172('0x1e')](_0x5d009a)[_0x6172('0x1f')](_0x49b45f);}};}function respondWithFilteredResult(_0x497bb9,_0xc1273b){return function(_0x2f4991){if(_0x2f4991){var _0x18ff8a=_0x2f4991[_0x6172('0x20')],_0x1b133d=_0xc1273b[_0x6172('0x21')],_0xfe1293=_0xc1273b['offset']+_0xc1273b[_0x6172('0x22')],_0x1116cf;if(_0xfe1293>=_0x18ff8a){_0xfe1293=_0x18ff8a;_0x1116cf=0xc8;}else{_0x1116cf=0xce;}_0x497bb9['status'](_0x1116cf);return _0x497bb9[_0x6172('0x23')]('Content-Range',_0x1b133d+'-'+_0xfe1293+'/'+_0x18ff8a)[_0x6172('0x1f')](_0x2f4991);}return null;};}function patchUpdates(_0x371850){return function(_0x1a6b45){try{jsonpatch['apply'](_0x1a6b45,_0x371850,!![]);}catch(_0x14ad8c){return BPromise[_0x6172('0x24')](_0x14ad8c);}return _0x1a6b45[_0x6172('0x25')]();};}function saveUpdates(_0x31a512,_0x861ce4){return function(_0x117988){if(_0x117988){return _0x117988[_0x6172('0x26')](_0x31a512)[_0x6172('0x27')](function(_0x5e7929){return _0x5e7929;});}return null;};}function removeEntity(_0x575314,_0x441e4e){return function(_0x47e27e){if(_0x47e27e){return _0x47e27e[_0x6172('0x28')]()[_0x6172('0x27')](function(){_0x575314['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2d5d,_0x3bee9c){return function(_0x4c7716){if(!_0x4c7716){_0x3f2d5d[_0x6172('0x1d')](0x194);}return _0x4c7716;};}function handleError(_0x44387c,_0x45551d){_0x45551d=_0x45551d||0x1f4;return function(_0x15ed90){logger[_0x6172('0x29')](_0x15ed90[_0x6172('0x2a')]);if(_0x15ed90[_0x6172('0x2b')]){delete _0x15ed90[_0x6172('0x2b')];}_0x44387c[_0x6172('0x1e')](_0x45551d)[_0x6172('0x2c')](_0x15ed90);};}function getInteractionUsers(_0x11d8d2,_0x234dc2){return new BPromise(function(_0x451daa,_0x30ba9b){try{if(_0x234dc2[_0x11d8d2['id']]){_0x11d8d2[_0x6172('0x2d')]=_[_0x6172('0x2e')](_0x234dc2[_0x11d8d2['id']],function(_0x4d1a51){return{'id':_0x4d1a51['id'],'fullname':_0x4d1a51['fullname']};});}}catch(_0x2080b4){_0x30ba9b(_0x2080b4);}_0x451daa(_0x11d8d2);});}function getInteractionTags(_0x168340,_0x345381){return new BPromise(function(_0x249480,_0x36eadf){try{if(_0x168340[_0x6172('0x2f')]){_0x168340[_0x6172('0x30')]=[];_0x168340[_0x6172('0x2f')][_0x6172('0x31')](',')[_0x6172('0x32')](function(_0x3082d6){_0x168340['Tags'][_0x6172('0x33')](_0x345381[_0x3082d6]);});}delete _0x168340[_0x6172('0x2f')];}catch(_0x3e8c23){_0x36eadf(_0x3e8c23);}_0x249480(_0x168340);});}function updateFaxInteraction(_0x490542,_0xcc4ac5,_0x14f9f3){return new BPromise(function(_0x1cfdee,_0x5ea520){return getInteractionUsers(_0x490542,_0x14f9f3)[_0x6172('0x27')](function(_0x1a25d8){return getInteractionTags(_0x1a25d8,_0xcc4ac5);})[_0x6172('0x27')](function(_0x50fe6a){_0x1cfdee(_0x50fe6a);})[_0x6172('0x34')](function(_0xa7bae6){_0x5ea520(_0xa7bae6);});});}exports[_0x6172('0x35')]=function(_0x35b81a,_0x348ff7){var _0x128e88={},_0x42477d={},_0x4d56c2={'count':0x0,'rows':[]};var _0xbe3439=_[_0x6172('0x2e')](db['FaxInteraction'][_0x6172('0x36')],function(_0x104273){return{'name':_0x104273[_0x6172('0x37')],'type':_0x104273[_0x6172('0x38')]['key']};});_0x42477d[_0x6172('0x39')]=_[_0x6172('0x2e')](_0xbe3439,_0x6172('0x2b'));_0x42477d[_0x6172('0x3a')]=_[_0x6172('0x3b')](_0x35b81a[_0x6172('0x3a')]);_0x42477d[_0x6172('0x3c')]=_['intersection'](_0x42477d[_0x6172('0x39')],_0x42477d[_0x6172('0x3a')]);_0x128e88[_0x6172('0x3d')]=_[_0x6172('0x3e')](_0x42477d[_0x6172('0x39')],qs['fields'](_0x35b81a['query'][_0x6172('0x3f')]));_0x128e88[_0x6172('0x3d')]=_0x128e88[_0x6172('0x3d')]['length']?_0x128e88[_0x6172('0x3d')]:_0x42477d[_0x6172('0x39')];if(!_0x35b81a[_0x6172('0x3a')][_0x6172('0x40')]('nolimit')){_0x128e88[_0x6172('0x22')]=qs[_0x6172('0x22')](_0x35b81a[_0x6172('0x3a')][_0x6172('0x22')]);_0x128e88[_0x6172('0x21')]=qs[_0x6172('0x21')](_0x35b81a[_0x6172('0x3a')][_0x6172('0x21')]);}_0x128e88[_0x6172('0x41')]=qs[_0x6172('0x42')](_0x35b81a[_0x6172('0x3a')][_0x6172('0x42')]);_0x128e88[_0x6172('0x43')]=qs[_0x6172('0x3c')](_[_0x6172('0x44')](_0x35b81a[_0x6172('0x3a')],_0x42477d[_0x6172('0x3c')]),_0xbe3439);var _0x3344fd=[];var _0x252397=squel['select']()[_0x6172('0x45')]('id')['field'](_0x6172('0x2b'))[_0x6172('0x45')](_0x6172('0x46'))[_0x6172('0x47')]('tools_tags');var _0x337a57=squel[_0x6172('0x48')]()[_0x6172('0x45')](_0x6172('0x49'))['field']('u.fullname')['field'](_0x6172('0x4a'))[_0x6172('0x47')](_0x6172('0x4b'),'ui')['left_join']('users','u',_0x6172('0x4c'));var _0xaa7c56=squel[_0x6172('0x48')]()[_0x6172('0x47')](_0x6172('0x4d'),'i')[_0x6172('0x4e')](_0x6172('0x4f'),'c',_0x6172('0x50'))[_0x6172('0x4e')](_0x6172('0x51'),'o',_0x6172('0x52'))[_0x6172('0x4e')](_0x6172('0x53'),'a','a.id\x20=\x20i.FaxAccountId')[_0x6172('0x4e')]('fax_messages','me',_0x6172('0x54'))['left_join'](_0x6172('0x55'),'it',_0x6172('0x56'))[_0x6172('0x4e')](_0x6172('0x57'),'t','t.id\x20=\x20it.TagId');var _0x34a6f8=squel['expr']();var _0x12181f=[];var _0x21b87c=squel[_0x6172('0x58')]();var _0x5bb307;if(_0x35b81a['query']['search']){_0x5bb307=as['parseSearch'](_0x35b81a['query'][_0x6172('0x59')]);var _0x1b6c49=_0x5bb307[_0x6172('0x5a')];for(var _0x2aeb01=0x0;_0x2aeb01<_0x5bb307[_0x6172('0x5b')]['length'];_0x2aeb01++){var _0x2add3d=_0x5bb307[_0x6172('0x5b')][_0x2aeb01];var _0x226717='i';var _0x1c00e4=_[_0x6172('0x5c')](_0xbe3439,[_0x6172('0x2b'),_0x2add3d[_0x6172('0x45')]]);if(!_0x1c00e4){switch(_0x2add3d[_0x6172('0x45')]){case _0x6172('0x5d'):if(_0x2add3d[_0x6172('0x5e')]==0x1){_0xaa7c56[_0x6172('0x5f')]('`'+_0x2add3d[_0x6172('0x45')]+_0x6172('0x60'));}else{_0xaa7c56[_0x6172('0x5f')]('`'+_0x2add3d['field']+'`\x20>\x200');}break;case _0x6172('0x61'):if(_0x2add3d[_0x6172('0x62')]==='$substring'){if(_0x2add3d[_0x6172('0x5e')][_0x6172('0x31')]('\x20')[_0x6172('0x63')]>0x1){_0x34a6f8[_0x1b6c49](_0x6172('0x64'),qs[_0x6172('0x65')](_0x2add3d[_0x6172('0x5e')]),null);}else{var _0x424310='%'+_0x2add3d[_0x6172('0x5e')]+'%';_0x34a6f8[_0x1b6c49](_0x6172('0x66'),_0x424310,_0x424310,_0x424310);}}else{_0x1c00e4=_['find'](_0xbe3439,[_0x6172('0x2b'),_0x6172('0x67')]);_0x2add3d['field']=_0x6172('0x67');_0x537901=as['buildExpression'](_0x226717,_0x1c00e4[_0x6172('0x38')],_0x2add3d);_0x34a6f8[_0x1b6c49](_0x537901['text'],_0x537901['value'][_0x6172('0x68')],_0x537901['value'][_0x6172('0x69')]);}break;case _0x6172('0x6a'):var _0x45ad3e=_0x2add3d[_0x6172('0x5e')][_0x6172('0x31')](',')[_0x6172('0x2e')](function(_0x271706){return Number(_0x271706);});_0x45ad3e[_0x6172('0x32')](function(_0x58312a){_0x21b87c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58312a+',%');});_0x12181f=_['union'](_0x12181f,_0x45ad3e);break;case _0x6172('0x6b'):if(_0x2add3d[_0x6172('0x62')]===_0x6172('0x6c')){_0x34a6f8[_0x1b6c49](_0x6172('0x6d'),'%'+_0x2add3d[_0x6172('0x5e')]+'%',null);}else{_0x1c00e4=_[_0x6172('0x5c')](_0xbe3439,[_0x6172('0x2b'),'UserId']);_0x2add3d['field']='UserId';_0x537901=as[_0x6172('0x6e')](_0x226717,_0x1c00e4[_0x6172('0x38')],_0x2add3d);_0x34a6f8[_0x1b6c49](_0x537901[_0x6172('0x6f')],_0x537901[_0x6172('0x5e')]['start'],_0x537901['value'][_0x6172('0x69')]);}break;case _0x6172('0x70'):_0x537901=as[_0x6172('0x6e')]('me',null,_0x2add3d);_0x34a6f8[_0x1b6c49](_0x537901[_0x6172('0x6f')],_0x537901[_0x6172('0x5e')]['start'],_0x537901['value'][_0x6172('0x69')]);break;}}else{var _0x537901=as['buildExpression'](_0x226717,_0x1c00e4[_0x6172('0x38')],_0x2add3d);_0x34a6f8[_0x1b6c49](_0x537901['text'],_0x537901[_0x6172('0x5e')][_0x6172('0x68')],_0x537901[_0x6172('0x5e')]['end']);}}}else{var _0xae1875=_(_0x35b81a['query'])[_0x6172('0x3b')]()[_0x6172('0x2e')](function(_0x219ae2){return _[_0x6172('0x71')](_0xbe3439,['name',_0x219ae2])?_0x219ae2:undefined;})[_0x6172('0x72')]()[_0x6172('0x5e')]();if(!_['isEmpty'](_0xae1875)){_0xae1875[_0x6172('0x32')](function(_0x820568){if(_0x820568==='FaxAccountId'){_0xaa7c56[_0x6172('0x43')](_0x6172('0x73'),[][_0x6172('0x74')](_0x35b81a['query'][_0x820568]));}else if(_0x820568===_0x6172('0x75')){var _0x3f9f30=JSON['parse'](_0x35b81a[_0x6172('0x3a')][_0x820568])[_0x6172('0x76')];var _0x1f7089=JSON[_0x6172('0x77')](_0x35b81a[_0x6172('0x3a')][_0x820568])[_0x6172('0x78')];_0xaa7c56['where'](_0x6172('0x79'),_0x3f9f30,_0x1f7089);}else{if(_0x35b81a[_0x6172('0x3a')][_0x820568]==='null'){_0xaa7c56[_0x6172('0x43')]('i.'+_0x820568+_0x6172('0x7a'));}else{_0xaa7c56['where']('i.'+_0x820568+_0x6172('0x7b'),_0x35b81a[_0x6172('0x3a')][_0x820568]);}}});}if(_0x35b81a[_0x6172('0x3a')][_0x6172('0x7c')]){if(_0x35b81a[_0x6172('0x3a')][_0x6172('0x7c')]==0x1){_0xaa7c56[_0x6172('0x5f')](_0x6172('0x7d'));}else{_0xaa7c56[_0x6172('0x5f')](_0x6172('0x7e'));}}if(_0x35b81a[_0x6172('0x3a')][_0x6172('0x7f')]){_0x12181f=_[_0x6172('0x80')](_0x35b81a[_0x6172('0x3a')]['tag'])?_0x35b81a['query'][_0x6172('0x7f')]:new Array(_0x35b81a['query'][_0x6172('0x7f')]);_0x12181f[_0x6172('0x32')](function(_0x120983){_0x21b87c['or'](_0x6172('0x81'),'%,'+_0x120983+',%');});}if(_0x35b81a[_0x6172('0x3a')]['filter']){var _0x377e96=_0x35b81a['query'][_0x6172('0x82')][_0x6172('0x83')]('\x5c','\x5c\x5c')[_0x6172('0x83')](/'/g,'\x27\x27');if(qs[_0x6172('0x84')](_0x377e96)){_0x34a6f8['or'](_0x6172('0x85'),_0x377e96+'%')['or'](_0x6172('0x86'),_0x377e96+'%');}_0x34a6f8['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x377e96+'%');}}_0xaa7c56[_0x6172('0x43')](_0x34a6f8);_0xaa7c56['group'](_0x6172('0x87'));var _0xaee4ce={'type':db[_0x6172('0x88')]['QueryTypes'][_0x6172('0x89')],'raw':!![]};var _0x596a84=_0xaa7c56[_0x6172('0x8a')]();_0x596a84[_0x6172('0x45')](_0x6172('0x87'));_0x596a84[_0x6172('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x128e88['order']){_0x128e88[_0x6172('0x41')]['forEach'](function(_0x3dcae4){var _0x539676=_0x3dcae4[0x0]==='contactName'?_0x3dcae4[0x0]:'i.'+_0x3dcae4[0x0];_0xaa7c56[_0x6172('0x41')](_0x539676,_0x3dcae4[0x1]===_0x6172('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x12181f)){_0xaa7c56[_0x6172('0x5f')](_0x21b87c);_0x596a84[_0x6172('0x43')](_0x6172('0x8c'),_0x12181f);}BPromise['resolve']()[_0x6172('0x27')](function(){if(!_0x5bb307){if(_0x35b81a[_0x6172('0x3a')][_0x6172('0x8d')])return;_0x596a84[_0x6172('0x43')](_0x6172('0x8e'));_0xaa7c56['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x35b81a[_0x6172('0x8f')][_0x6172('0x90')]!=='agent')return;return _0x35b81a[_0x6172('0x8f')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x6172('0x27')](function(_0x1de16c){if(_[_0x6172('0x91')](_0x1de16c)){_0x596a84[_0x6172('0x43')]('i.FaxAccountId\x20IS\x20NULL');_0xaa7c56[_0x6172('0x43')](_0x6172('0x92'));}else{_0x596a84[_0x6172('0x43')](_0x6172('0x73'),_[_0x6172('0x2e')](_0x1de16c,'id'));_0xaa7c56[_0x6172('0x43')](_0x6172('0x73'),_['map'](_0x1de16c,'id'));}});})['then'](function(){if(_0x35b81a[_0x6172('0x8f')][_0x6172('0x90')]===_0x6172('0x93')&&!_0x5bb307&&!_0x35b81a[_0x6172('0x3a')][_0x6172('0x8d')])return[];return db[_0x6172('0x94')][_0x6172('0x3a')](_0x596a84['toString'](),_0xaee4ce);})[_0x6172('0x27')](function(_0x735947){_0x4d56c2['count']=_0x735947[_0x6172('0x63')];if(_0x4d56c2[_0x6172('0x20')]===0x0)return[];return db['sequelize']['query'](_0x252397['toString'](),_0xaee4ce)['then'](function(_0x2369bb){_0x3344fd=_[_0x6172('0x95')](_0x2369bb,'id');_0xaee4ce=_[_0x6172('0x96')](_0xaee4ce,{'model':db[_0x6172('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35b81a[_0x6172('0x3a')][_0x6172('0x3f')]){_0x128e88['attributes'][_0x6172('0x32')](function(_0x23c20c){_0xaa7c56[_0x6172('0x45')]('i.'+_0x23c20c);});}else{_0xaa7c56['field'](_0x6172('0x98'),_0x6172('0x5d'));_0xaa7c56[_0x6172('0x45')]('a.key','Account.key');_0xaa7c56[_0x6172('0x45')](_0x6172('0x99'),'Account.mandatoryDisposition');_0xaa7c56[_0x6172('0x45')](_0x6172('0x9a'),_0x6172('0x9b'));_0xaa7c56[_0x6172('0x45')](_0x6172('0x9c'));_0xaa7c56[_0x6172('0x45')](_0x6172('0x9d'),'Contact.firstName');_0xaa7c56['field'](_0x6172('0x9e'),_0x6172('0x9f'));_0xaa7c56['field'](_0x6172('0xa0'),_0x6172('0xa1'));_0xaa7c56[_0x6172('0x45')](_0x6172('0xa2'),_0x6172('0xa3'));_0xaa7c56['field'](_0x6172('0xa4'),_0x6172('0xa5'));_0xaa7c56[_0x6172('0x45')]('c.fax',_0x6172('0xa6'));_0xaa7c56[_0x6172('0x45')](_0x6172('0xa7'),_0x6172('0xa8'));_0xaa7c56['field'](_0x6172('0xa9'),'Owner.internal');_0xaa7c56[_0x6172('0x45')](_0x6172('0xaa'),'TagIds');}if(_0x128e88[_0x6172('0x22')])_0xaa7c56[_0x6172('0x22')](_0x128e88[_0x6172('0x22')]);if(_0x128e88[_0x6172('0x21')])_0xaa7c56[_0x6172('0x21')](_0x128e88['offset']);return db['sequelize'][_0x6172('0x3a')](_0xaa7c56[_0x6172('0xab')](),_0xaee4ce);})[_0x6172('0x27')](function(_0x4688da){_0x337a57[_0x6172('0x43')](_0x6172('0xac'),_[_0x6172('0x2e')](_0x4688da,'id'));return db[_0x6172('0x94')][_0x6172('0x3a')](_0x337a57[_0x6172('0xab')](),_0xaee4ce)[_0x6172('0x27')](function(_0xf47ec8){var _0x219a18=_[_0x6172('0xad')](_0xf47ec8,_0x6172('0xae'));var _0x4b261b=[];_0x4688da['forEach'](function(_0x341081){_0x4b261b[_0x6172('0x33')](updateFaxInteraction(_0x341081,_0x3344fd,_0x219a18));});return BPromise[_0x6172('0xaf')](_0x4b261b);});});})[_0x6172('0x27')](function(_0x576ebe){_0x4d56c2['rows']=_0x576ebe;return _0x4d56c2;})['then'](respondWithFilteredResult(_0x348ff7,_0x128e88))[_0x6172('0x34')](handleError(_0x348ff7,null));};exports[_0x6172('0xb0')]=function(_0xfbd0fe,_0xf37339){var _0x1aee82={'raw':![],'where':{'id':_0xfbd0fe[_0x6172('0xb1')]['id']}},_0x5b8429={};_0x5b8429[_0x6172('0x39')]=_['keys'](db[_0x6172('0x97')][_0x6172('0x36')]);_0x5b8429['query']=_[_0x6172('0x3b')](_0xfbd0fe[_0x6172('0x3a')]);_0x5b8429['filters']=_[_0x6172('0x3e')](_0x5b8429[_0x6172('0x39')],_0x5b8429['query']);_0x1aee82[_0x6172('0x3d')]=_[_0x6172('0x3e')](_0x5b8429[_0x6172('0x39')],qs[_0x6172('0x3f')](_0xfbd0fe['query'][_0x6172('0x3f')]));_0x1aee82['attributes']=_0x1aee82[_0x6172('0x3d')]['length']?_0x1aee82[_0x6172('0x3d')]:_0x5b8429[_0x6172('0x39')];if(_0xfbd0fe[_0x6172('0x3a')][_0x6172('0xb2')]){_0x1aee82[_0x6172('0xb3')]=[{'all':!![]}];}_0x1aee82=_[_0x6172('0x96')]({},_0x1aee82,_0xfbd0fe[_0x6172('0xb4')]);return db[_0x6172('0x97')][_0x6172('0x5c')](_0x1aee82)[_0x6172('0x27')](handleEntityNotFound(_0xf37339,null))[_0x6172('0x27')](respondWithResult(_0xf37339,null))[_0x6172('0x34')](handleError(_0xf37339,null));};exports['create']=function(_0x15771c,_0x2331ce){return db['FaxInteraction'][_0x6172('0xb5')](_0x15771c[_0x6172('0x70')],{})[_0x6172('0x27')](respondWithResult(_0x2331ce,0xc9))[_0x6172('0x34')](handleError(_0x2331ce,null));};exports[_0x6172('0x26')]=function(_0x3440fa,_0x21264f){if(_0x3440fa[_0x6172('0x70')]['id']){delete _0x3440fa['body']['id'];}return db['FaxInteraction'][_0x6172('0x5c')]({'where':{'id':_0x3440fa[_0x6172('0xb1')]['id']}})[_0x6172('0x27')](handleEntityNotFound(_0x21264f,null))['then'](saveUpdates(_0x3440fa['body'],null))[_0x6172('0x27')](respondWithResult(_0x21264f,null))['catch'](handleError(_0x21264f,null));};exports[_0x6172('0x28')]=function(_0x4b0cca,_0x25c97e){return db['FaxInteraction'][_0x6172('0x5c')]({'where':{'id':_0x4b0cca['params']['id']}})['then'](handleEntityNotFound(_0x25c97e,null))['then'](removeEntity(_0x25c97e,null))[_0x6172('0x34')](handleError(_0x25c97e,null));};exports[_0x6172('0xb6')]=function(_0x44ff6e,_0x2674a3){return db[_0x6172('0x97')][_0x6172('0xb6')]()[_0x6172('0x27')](respondWithResult(_0x2674a3,null))[_0x6172('0x34')](handleError(_0x2674a3,null));};exports[_0x6172('0xb7')]=function(_0x4732b1,_0x41ddaf,_0x42f530){return db['FaxMessage']['find']({'where':{'id':_0x4732b1[_0x6172('0xb1')]['id']}})[_0x6172('0x27')](handleEntityNotFound(_0x41ddaf,null))['then'](function(_0x4b4e72){if(_0x4b4e72){return _0x4b4e72['addMessage'](_0x4732b1['body'][_0x6172('0xb8')],_['omit'](_0x4732b1[_0x6172('0x70')],[_0x6172('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x41ddaf,null))[_0x6172('0x34')](handleError(_0x41ddaf,null));};exports[_0x6172('0xb9')]=function(_0x29d3fa,_0x340a99,_0xab494c){var _0x5cf5be={'raw':![],'where':{}};var _0x52d94e={};var _0x5f2727={'count':0x0,'rows':[]};return db[_0x6172('0x97')]['findOne']({'where':{'id':_0x29d3fa[_0x6172('0xb1')]['id']}})[_0x6172('0x27')](handleEntityNotFound(_0x340a99,null))[_0x6172('0x27')](function(_0x179ad1){if(_0x179ad1){_0x52d94e[_0x6172('0x39')]=_[_0x6172('0x3b')](db[_0x6172('0xba')][_0x6172('0x36')]);_0x52d94e[_0x6172('0x3a')]=_[_0x6172('0x3b')](_0x29d3fa[_0x6172('0x3a')]);_0x52d94e['filters']=_[_0x6172('0x3e')](_0x52d94e['model'],_0x52d94e[_0x6172('0x3a')]);_0x5cf5be[_0x6172('0x3d')]=_[_0x6172('0x3e')](_0x52d94e[_0x6172('0x39')],qs[_0x6172('0x3f')](_0x29d3fa[_0x6172('0x3a')]['fields']));_0x5cf5be[_0x6172('0x3d')]=_0x5cf5be['attributes']['length']?_0x5cf5be[_0x6172('0x3d')]:_0x52d94e['model'];if(!_0x29d3fa['query'][_0x6172('0x40')](_0x6172('0xbb'))){_0x5cf5be[_0x6172('0x22')]=qs[_0x6172('0x22')](_0x29d3fa[_0x6172('0x3a')][_0x6172('0x22')]);_0x5cf5be[_0x6172('0x21')]=qs['offset'](_0x29d3fa[_0x6172('0x3a')][_0x6172('0x21')]);}_0x5cf5be[_0x6172('0x41')]=qs[_0x6172('0x42')](_0x29d3fa[_0x6172('0x3a')][_0x6172('0x42')]);_0x5cf5be[_0x6172('0x43')]=qs['filters'](_[_0x6172('0x44')](_0x29d3fa['query'],_0x52d94e[_0x6172('0x3c')]));_0x5cf5be[_0x6172('0x43')][_0x6172('0xae')]=_0x179ad1['id'];if(_0x29d3fa[_0x6172('0x3a')][_0x6172('0x82')]){_0x5cf5be[_0x6172('0x43')]=_[_0x6172('0x96')](_0x5cf5be[_0x6172('0x43')],{'$or':_[_0x6172('0x2e')](_0x5cf5be[_0x6172('0x3d')],function(_0x3e81e2){var _0xa75496={};_0xa75496[_0x3e81e2]={'$like':'%'+_0x29d3fa[_0x6172('0x3a')][_0x6172('0x82')]+'%'};return _0xa75496;})});}if(_0x29d3fa[_0x6172('0x3a')][_0x6172('0x76')]){var _0x11e563=_0x29d3fa[_0x6172('0x3a')]['$gte']['split'](',');var _0x47024a={};_0x47024a[_0x11e563[0x0]]={'$gte':moment(_0x11e563[0x1])[_0x6172('0xbc')](_0x6172('0xbd'))};_0x5cf5be[_0x6172('0x43')]=_[_0x6172('0x96')](_0x5cf5be['where'],_0x47024a);}_0x5cf5be=_['merge']({},_0x5cf5be,_0x29d3fa[_0x6172('0xb4')]);return db[_0x6172('0xba')]['count']({'where':_0x5cf5be['where']})[_0x6172('0x27')](function(_0x31c34c){_0x5f2727[_0x6172('0x20')]=_0x31c34c;if(_0x29d3fa[_0x6172('0x3a')]['includeAll']){_0x5cf5be[_0x6172('0xb3')]=[{'all':!![]}];}return db[_0x6172('0xba')]['findAll'](_0x5cf5be);})[_0x6172('0x27')](function(_0x5b6893){_0x5f2727[_0x6172('0xbe')]=_0x5b6893;return _0x5f2727;});}})[_0x6172('0x27')](respondWithFilteredResult(_0x340a99,_0x5cf5be))[_0x6172('0x34')](handleError(_0x340a99,null));};exports[_0x6172('0xbf')]=function(_0x207fc3,_0x2056b0,_0x580aa2){return db['FaxInteraction'][_0x6172('0x5c')]({'where':{'id':_0x207fc3['params']['id']}})[_0x6172('0x27')](handleEntityNotFound(_0x2056b0,null))['then'](function(_0x302515){if(_0x302515){return _0x302515[_0x6172('0xc0')](_0x207fc3[_0x6172('0x70')][_0x6172('0xb8')],_['omit'](_0x207fc3[_0x6172('0x70')],[_0x6172('0xb8'),'id'])||{})[_0x6172('0xc1')](function(){return db[_0x6172('0x6a')][_0x6172('0xc2')]({'attributes':['id',_0x6172('0x2b'),_0x6172('0x46')],'where':{'id':_0x207fc3[_0x6172('0x70')][_0x6172('0xb8')]}});})[_0x6172('0x27')](function(_0x3d51ee){socket['emit']('faxInteractionTags:save',{'id':Number(_0x207fc3[_0x6172('0xb1')]['id']),'tags':_0x3d51ee||[]});return{'id':Number(_0x207fc3[_0x6172('0xb1')]['id']),'tags':_0x3d51ee||[]};});}})['then'](respondWithResult(_0x2056b0,null))[_0x6172('0x34')](handleError(_0x2056b0,null));};exports['removeTags']=function(_0x22dd48,_0x19d2a6,_0x34ea3e){return db[_0x6172('0x97')][_0x6172('0x5c')]({'where':{'id':_0x22dd48[_0x6172('0xb1')]['id']}})[_0x6172('0x27')](handleEntityNotFound(_0x19d2a6,null))[_0x6172('0x27')](function(_0x5e0f11){if(_0x5e0f11){return _0x5e0f11[_0x6172('0xc3')](_0x22dd48[_0x6172('0x3a')][_0x6172('0xb8')]);}})[_0x6172('0x27')](respondWithStatusCode(_0x19d2a6,null))[_0x6172('0x34')](handleError(_0x19d2a6,null));};exports[_0x6172('0xc4')]=function(_0x30c090,_0x396fba){var _0x394cce=moment()[_0x6172('0xc5')]()[_0x6172('0xab')]();var _0x4dab7a=path[_0x6172('0xc6')](config['root'],'server',_0x6172('0xc7'),_0x6172('0xc8'));var _0x21c6a1=path['join'](config[_0x6172('0xc9')],_0x6172('0xca'),_0x6172('0xc7'),_0x6172('0xcb'));var _0x5b99f5=path['join'](_0x4dab7a,_0x394cce);var _0x2096b7=util[_0x6172('0xbc')]('transcript-%d-%s.zip',_0x30c090[_0x6172('0xb1')]['id'],_0x394cce);var _0x439d6e=path['join'](_0x4dab7a,_0x2096b7);var _0x2e1003=[];_0x2e1003[_0x6172('0x33')]({'model':db[_0x6172('0xcc')],'as':_0x6172('0xcc'),'raw':!![]});var _0x439e08=[{'model':db[_0x6172('0xba')],'as':_0x6172('0xcd'),'attributes':['id',_0x6172('0x70'),_0x6172('0x75')],'include':_0x2e1003}];return db[_0x6172('0x97')][_0x6172('0x5c')]({'where':{'id':_0x30c090[_0x6172('0xb1')]['id']},'include':_0x439e08})[_0x6172('0x27')](handleEntityNotFound(_0x396fba,null))[_0x6172('0x27')](function(_0x35b758){if(_0x35b758&&_0x35b758[_0x6172('0xcd')]){var _0x1b40d1=_0x35b758[_0x6172('0xce')]({'plain':!![]});fs[_0x6172('0xcf')](_0x5b99f5);for(var _0x497034=0x0;_0x497034<_0x1b40d1[_0x6172('0xcd')][_0x6172('0x63')];_0x497034++){var _0x345b97=_0x1b40d1[_0x6172('0xcd')][_0x497034][_0x6172('0xcc')];if(_0x345b97){var _0x3b097f=path[_0x6172('0xc6')](_0x21c6a1,_0x345b97[_0x6172('0xd0')]);if(fs['existsSync'](_0x3b097f)){fs['createReadStream'](_0x3b097f)[_0x6172('0xd1')](fs[_0x6172('0xd2')](path[_0x6172('0xc6')](_0x5b99f5,_0x345b97[_0x6172('0xd0')])));}}}return BPromise[_0x6172('0xd3')]()[_0x6172('0x27')](function(){return new BPromise(function(_0x1ea209,_0x2aff0d){zipdir(_0x5b99f5,{'saveTo':_0x439d6e},function(_0x5490ac,_0x2e7c74){if(_0x5490ac)return _0x2aff0d(_0x5490ac);return _0x1ea209(_0x2e7c74);});})['then'](function(){return new BPromise(function(_0x752f75,_0x1a0036){rimraf(_0x5b99f5,function(_0x4277d5){if(_0x4277d5)_0x1a0036(_0x4277d5);return _0x752f75();});});})[_0x6172('0x27')](function(){return _0x396fba[_0x6172('0xc4')](_0x439d6e,_0x2096b7,function(_0x589cdf){if(_0x589cdf){console[_0x6172('0xd4')]('err',_0x589cdf);}else{fs[_0x6172('0xd5')](_0x439d6e);}});});});}else{return _0x396fba[_0x6172('0x1d')](0xc8);}})[_0x6172('0x34')](handleError(_0x396fba,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 5c15418..95a9379 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 _0xdb28=['Users','map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','setDataValue'];(function(_0xc8a02c,_0x4809d3){var _0x3d89da=function(_0x5903d8){while(--_0x5903d8){_0xc8a02c['push'](_0xc8a02c['shift']());}};_0x3d89da(++_0x4809d3);}(_0xdb28,0x106));var _0x8db2=function(_0x514459,_0x43cae9){_0x514459=_0x514459-0x0;var _0x3e406e=_0xdb28[_0x514459];return _0x3e406e;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var FaxInteraction=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var FaxMessage=require(_0x8db2('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':_0x8db2('0x4'),'afterUpdate':_0x8db2('0x5'),'afterDestroy':_0x8db2('0x6')};function emitEvent(_0x11109e){return function(_0x52bf99,_0x21a03e,_0x1d2dd3){_0x52bf99['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x477f50){_0x52bf99[_0x8db2('0x7')](_0x8db2('0x8'),_0x477f50[_0x8db2('0x9')](function(_0x2f3f2f){return{'id':_0x2f3f2f['id']};}));return FaxMessage[_0x8db2('0xa')]({'where':{'FaxInteractionId':_0x52bf99['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8db2('0xb')](function(_0x4ba340){_0x52bf99[_0x8db2('0x7')](_0x8db2('0xc'),_0x4ba340[_0x8db2('0xd')]);FaxInteractionEvents['emit'](_0x11109e+':'+_0x52bf99['id'],_0x52bf99);FaxInteractionEvents[_0x8db2('0xe')](_0x11109e,_0x52bf99);_0x1d2dd3(null);})[_0x8db2('0xf')](_0x1d2dd3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x8db2('0x10')](e,emitEvent(event));}}module[_0x8db2('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x3698db,_0x219205){_0x3698db=_0x3698db-0x0;var _0x4d9ef8=_0x2ef3[_0x3698db];return _0x4d9ef8;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c4ad134..45e1b9d 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 _0x2a70=['path','../../config/environment','exports','define','FaxInteraction','fax_interactions','closed','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x41cdde,_0x4bd78c){var _0x2dec1e=function(_0xc4e978){while(--_0xc4e978){_0x41cdde['push'](_0x41cdde['shift']());}};_0x2dec1e(++_0x4bd78c);}(_0x2a70,0xad));var _0x02a7=function(_0x9b4a4e,_0x2273d1){_0x9b4a4e=_0x9b4a4e-0x0;var _0x24d76e=_0x2a70[_0x9b4a4e];return _0x24d76e;};'use strict';var _=require(_0x02a7('0x0'));var util=require(_0x02a7('0x1'));var logger=require(_0x02a7('0x2'))(_0x02a7('0x3'));var moment=require(_0x02a7('0x4'));var BPromise=require(_0x02a7('0x5'));var rp=require(_0x02a7('0x6'));var fs=require('fs');var path=require(_0x02a7('0x7'));var rimraf=require('rimraf');var config=require(_0x02a7('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x02a7('0x9')]=function(_0x227ba4,_0x25409e){return _0x227ba4[_0x02a7('0xa')](_0x02a7('0xb'),attributes,{'tableName':_0x02a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a010f,_0x537a92,_0x6494b5){if(_0x4a010f['changed'](_0x02a7('0xd'))){_0x4a010f['closedAt']=moment()[_0x02a7('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x6494b5(null,_0x4a010f);}}});}; \ No newline at end of file +var _0x0d77=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','util'];(function(_0x320cb3,_0x49c0cf){var _0x899c86=function(_0x9fc8f){while(--_0x9fc8f){_0x320cb3['push'](_0x320cb3['shift']());}};_0x899c86(++_0x49c0cf);}(_0x0d77,0x1cd));var _0x70d7=function(_0x3b59db,_0x47f8a4){_0x3b59db=_0x3b59db-0x0;var _0x858d75=_0x0d77[_0x3b59db];return _0x858d75;};'use strict';var _=require('lodash');var util=require(_0x70d7('0x0'));var logger=require(_0x70d7('0x1'))('api');var moment=require(_0x70d7('0x2'));var BPromise=require(_0x70d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70d7('0x4'));var rimraf=require(_0x70d7('0x5'));var config=require(_0x70d7('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x70d7('0x7')]=function(_0x74698,_0x1069b1){return _0x74698['define'](_0x70d7('0x8'),attributes,{'tableName':_0x70d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e55e9,_0x11d938,_0x1678c0){if(_0x5e55e9[_0x70d7('0xa')](_0x70d7('0xb'))){_0x5e55e9[_0x70d7('0xc')]=moment()[_0x70d7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1678c0(null,_0x5e55e9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index bea1242..802080b 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 _0x339b=['code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update','options','raw','where','stringify','AddTagsToFaxInteraction','then','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x339b,0x1df));var _0xb339=function(_0x10a03f,_0x590d3c){_0x10a03f=_0x10a03f-0x0;var _0x250e30=_0x339b[_0x10a03f];return _0x250e30;};'use strict';var _=require(_0xb339('0x0'));var util=require(_0xb339('0x1'));var moment=require(_0xb339('0x2'));var BPromise=require(_0xb339('0x3'));var rs=require(_0xb339('0x4'));var fs=require('fs');var Redis=require(_0xb339('0x5'));var db=require(_0xb339('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb339('0x7'))(_0xb339('0x8'));var config=require(_0xb339('0x9'));var jayson=require(_0xb339('0xa'));var client=jayson[_0xb339('0xb')][_0xb339('0xc')]({'port':0x232a});config[_0xb339('0xd')]=_[_0xb339('0xe')](config[_0xb339('0xd')],{'host':_0xb339('0xf'),'port':0x18eb});var socket=require(_0xb339('0x10'))(new Redis(config[_0xb339('0xd')]));require(_0xb339('0x11'))[_0xb339('0x12')](socket);function respondWithRpcPromise(_0x2ee747,_0x19c56f,_0x448004){return new BPromise(function(_0x57896a,_0x28864e){return client[_0xb339('0x13')](_0x2ee747,_0x448004)['then'](function(_0x8435fe){logger[_0xb339('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x19c56f,_0xb339('0x15'));logger[_0xb339('0x16')](_0xb339('0x17'),_0x19c56f,_0xb339('0x15'),JSON['stringify'](_0x8435fe));if(_0x8435fe[_0xb339('0x18')]){if(_0x8435fe[_0xb339('0x18')][_0xb339('0x19')]===0x1f4){logger[_0xb339('0x18')](_0xb339('0x1a'),_0x19c56f,_0x8435fe[_0xb339('0x18')][_0xb339('0x1b')]);return _0x28864e(_0x8435fe[_0xb339('0x18')][_0xb339('0x1b')]);}logger[_0xb339('0x18')](_0xb339('0x1a'),_0x19c56f,_0x8435fe['error'][_0xb339('0x1b')]);return _0x57896a(_0x8435fe['error'][_0xb339('0x1b')]);}else{logger['info'](_0xb339('0x1a'),_0x19c56f,_0xb339('0x15'));_0x57896a(_0x8435fe[_0xb339('0x1c')]['message']);}})[_0xb339('0x1d')](function(_0x445675){logger[_0xb339('0x18')](_0xb339('0x1a'),_0x19c56f,_0x445675);_0x28864e(_0x445675);});});}exports[_0xb339('0x1e')]=function(_0xa8f867){var _0x524bbf=this;return new Promise(function(_0x4cc8aa,_0x31d381){return db['FaxInteraction'][_0xb339('0x1f')](_0xa8f867['body'],{'raw':_0xa8f867[_0xb339('0x20')]?_0xa8f867['options'][_0xb339('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8f867[_0xb339('0x20')]?_0xa8f867[_0xb339('0x20')][_0xb339('0x22')]||null:null,'attributes':_0xa8f867[_0xb339('0x20')]?_0xa8f867[_0xb339('0x20')]['attributes']||null:null,'limit':_0xa8f867[_0xb339('0x20')]?_0xa8f867[_0xb339('0x20')]['limit']||null:null})['then'](function(_0x27af83){logger[_0xb339('0x14')](_0xb339('0x1e'),_0xa8f867);logger[_0xb339('0x16')](_0xb339('0x1e'),_0xa8f867,JSON[_0xb339('0x23')](_0x27af83));_0x4cc8aa(_0x27af83);})[_0xb339('0x1d')](function(_0x58bd8b){logger[_0xb339('0x18')](_0xb339('0x1e'),_0x58bd8b[_0xb339('0x1b')],_0xa8f867);_0x31d381(_0x524bbf[_0xb339('0x18')](0x1f4,_0x58bd8b[_0xb339('0x1b')]));});});};exports[_0xb339('0x24')]=function(_0x4367d8){return new Promise(function(_0x5a0ea8,_0x77a88){return db['FaxInteraction']['find']({'where':_0x4367d8[_0xb339('0x20')]?_0x4367d8[_0xb339('0x20')][_0xb339('0x22')]||null:null})[_0xb339('0x25')](function(_0x13c58){if(_0x13c58){return _0x13c58['addTags'](_0x4367d8[_0xb339('0x26')]['ids'],_['omit'](_0x4367d8[_0xb339('0x26')],[_0xb339('0x27'),'id'])||{});}})[_0xb339('0x28')](function(_0x1f4bd4){logger[_0xb339('0x14')](_0xb339('0x29'),_0x4367d8);logger[_0xb339('0x16')](_0xb339('0x29'),_0x4367d8,JSON[_0xb339('0x23')](_0x1f4bd4));_0x5a0ea8(_0x1f4bd4);})[_0xb339('0x1d')](function(_0x189031){logger['error']('AddTags',_0x189031['message'],_0x4367d8);_0x77a88(_this[_0xb339('0x18')](0x1f4,_0x189031[_0xb339('0x1b')]));});});}; \ No newline at end of file +var _0x389e=['then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','stringify','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','register','request'];(function(_0x2c643e,_0x52a8ea){var _0x1ae2d3=function(_0x6d459e){while(--_0x6d459e){_0x2c643e['push'](_0x2c643e['shift']());}};_0x1ae2d3(++_0x52a8ea);}(_0x389e,0x19c));var _0xe389=function(_0x173897,_0x6cf1a6){_0x173897=_0x173897-0x0;var _0x457bb7=_0x389e[_0x173897];return _0x457bb7;};'use strict';var _=require(_0xe389('0x0'));var util=require(_0xe389('0x1'));var moment=require(_0xe389('0x2'));var BPromise=require(_0xe389('0x3'));var rs=require(_0xe389('0x4'));var fs=require('fs');var Redis=require(_0xe389('0x5'));var db=require(_0xe389('0x6'))['db'];var utils=require(_0xe389('0x7'));var logger=require(_0xe389('0x8'))(_0xe389('0x9'));var config=require(_0xe389('0xa'));var jayson=require(_0xe389('0xb'));var client=jayson[_0xe389('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xe389('0xd'),'port':0x18eb});var socket=require(_0xe389('0xe'))(new Redis(config[_0xe389('0xf')]));require('./faxInteraction.socket')[_0xe389('0x10')](socket);function respondWithRpcPromise(_0x4e4778,_0x125424,_0x3c96e3){return new BPromise(function(_0x61838f,_0x351f73){return client[_0xe389('0x11')](_0x4e4778,_0x3c96e3)[_0xe389('0x12')](function(_0x27e966){logger[_0xe389('0x13')](_0xe389('0x14'),_0x125424,_0xe389('0x15'));logger[_0xe389('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x125424,_0xe389('0x15'),JSON['stringify'](_0x27e966));if(_0x27e966[_0xe389('0x17')]){if(_0x27e966['error'][_0xe389('0x18')]===0x1f4){logger[_0xe389('0x17')](_0xe389('0x14'),_0x125424,_0x27e966[_0xe389('0x17')][_0xe389('0x19')]);return _0x351f73(_0x27e966[_0xe389('0x17')]['message']);}logger[_0xe389('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x125424,_0x27e966[_0xe389('0x17')][_0xe389('0x19')]);return _0x61838f(_0x27e966[_0xe389('0x17')][_0xe389('0x19')]);}else{logger['info'](_0xe389('0x14'),_0x125424,_0xe389('0x15'));_0x61838f(_0x27e966[_0xe389('0x1a')][_0xe389('0x19')]);}})['catch'](function(_0x4d4c55){logger[_0xe389('0x17')](_0xe389('0x14'),_0x125424,_0x4d4c55);_0x351f73(_0x4d4c55);});});}exports[_0xe389('0x1b')]=function(_0x17552c){var _0x10328f=this;return new Promise(function(_0x39aaef,_0x2e1c3a){return db[_0xe389('0x1c')][_0xe389('0x1d')](_0x17552c[_0xe389('0x1e')],{'raw':_0x17552c[_0xe389('0x1f')]?_0x17552c[_0xe389('0x1f')][_0xe389('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17552c['options']?_0x17552c[_0xe389('0x1f')][_0xe389('0x21')]||null:null,'attributes':_0x17552c[_0xe389('0x1f')]?_0x17552c[_0xe389('0x1f')][_0xe389('0x22')]||null:null,'limit':_0x17552c[_0xe389('0x1f')]?_0x17552c[_0xe389('0x1f')]['limit']||null:null})[_0xe389('0x12')](function(_0x5249b2){logger[_0xe389('0x13')]('UpdateFaxInteraction',_0x17552c);logger[_0xe389('0x16')]('UpdateFaxInteraction',_0x17552c,JSON[_0xe389('0x23')](_0x5249b2));_0x39aaef(_0x5249b2);})[_0xe389('0x24')](function(_0x3c67db){logger[_0xe389('0x17')]('UpdateFaxInteraction',_0x3c67db[_0xe389('0x19')],_0x17552c);_0x2e1c3a(_0x10328f[_0xe389('0x17')](0x1f4,_0x3c67db[_0xe389('0x19')]));});});};exports[_0xe389('0x25')]=function(_0x199257){return new Promise(function(_0xbebc07,_0x5963d1){return db[_0xe389('0x1c')][_0xe389('0x26')]({'where':_0x199257['options']?_0x199257[_0xe389('0x1f')][_0xe389('0x21')]||null:null})['then'](function(_0x898a84){if(_0x898a84){return _0x898a84[_0xe389('0x27')](_0x199257[_0xe389('0x1e')][_0xe389('0x28')],_[_0xe389('0x29')](_0x199257[_0xe389('0x1e')],['ids','id'])||{});}})['spread'](function(_0x47432f){logger[_0xe389('0x13')](_0xe389('0x2a'),_0x199257);logger[_0xe389('0x16')](_0xe389('0x2a'),_0x199257,JSON['stringify'](_0x47432f));_0xbebc07(_0x47432f);})[_0xe389('0x24')](function(_0x1bd0f1){logger[_0xe389('0x17')](_0xe389('0x2a'),_0x1bd0f1[_0xe389('0x19')],_0x199257);_0x5963d1(_this[_0xe389('0x17')](0x1f4,_0x1bd0f1[_0xe389('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1df2095..c0eccac 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 _0xfefb=['length','./faxInteraction.events','save','remove','emit','register'];(function(_0x1b640f,_0x215390){var _0x560770=function(_0x5335ba){while(--_0x5335ba){_0x1b640f['push'](_0x1b640f['shift']());}};_0x560770(++_0x215390);}(_0xfefb,0x1db));var _0xbfef=function(_0x334192,_0x1ba2bc){_0x334192=_0x334192-0x0;var _0x3d0d2e=_0xfefb[_0x334192];return _0x3d0d2e;};'use strict';var FaxInteractionEvents=require(_0xbfef('0x0'));var events=[_0xbfef('0x1'),_0xbfef('0x2'),'update'];function createListener(_0x3ece33,_0x3bba52){return function(_0x1580e5){_0x3bba52[_0xbfef('0x3')](_0x3ece33,_0x1580e5);};}function removeListener(_0x719ecb,_0x5d6f52){return function(){FaxInteractionEvents['removeListener'](_0x719ecb,_0x5d6f52);};}exports[_0xbfef('0x4')]=function(_0x2e848b){for(var _0x4a63e8=0x0,_0x39341b=events[_0xbfef('0x5')];_0x4a63e8<_0x39341b;_0x4a63e8++){var _0x244e36=events[_0x4a63e8];var _0x3e8e6a=createListener('faxInteraction:'+_0x244e36,_0x2e848b);FaxInteractionEvents['on'](_0x244e36,_0x3e8e6a);}}; \ No newline at end of file +var _0x6876=['update','emit','register','./faxInteraction.events','save'];(function(_0x53daa4,_0x280976){var _0x4835c1=function(_0x4bcb64){while(--_0x4bcb64){_0x53daa4['push'](_0x53daa4['shift']());}};_0x4835c1(++_0x280976);}(_0x6876,0x193));var _0x6687=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x6876[_0x26d9b3];return _0x15c226;};'use strict';var FaxInteractionEvents=require(_0x6687('0x0'));var events=[_0x6687('0x1'),'remove',_0x6687('0x2')];function createListener(_0x20c72a,_0x54374f){return function(_0xf5288a){_0x54374f[_0x6687('0x3')](_0x20c72a,_0xf5288a);};}function removeListener(_0x24ab00,_0x497220){return function(){FaxInteractionEvents['removeListener'](_0x24ab00,_0x497220);};}exports[_0x6687('0x4')]=function(_0x7dd55c){for(var _0x45f205=0x0,_0x377a7b=events['length'];_0x45f205<_0x377a7b;_0x45f205++){var _0x583ed1=events[_0x45f205];var _0x134506=createListener('faxInteraction:'+_0x583ed1,_0x7dd55c);FaxInteractionEvents['on'](_0x583ed1,_0x134506);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c4f65a3..84b8314 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 _0xda3f=['describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','faxinteraction:addtags','addTags','tracked','fax','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','util','path','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index'];(function(_0x5a66e2,_0x217ae8){var _0x1a23b8=function(_0x32727b){while(--_0x32727b){_0x5a66e2['push'](_0x5a66e2['shift']());}};_0x1a23b8(++_0x217ae8);}(_0xda3f,0xec));var _0xfda3=function(_0x3591c2,_0x4587e4){_0x3591c2=_0x3591c2-0x0;var _0x424583=_0xda3f[_0x3591c2];return _0x424583;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfda3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfda3('0x3'));var controller=require(_0xfda3('0x4'));router['get']('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0x6')]);router['get']('/describe',auth[_0xfda3('0x5')](),controller[_0xfda3('0x7')]);router[_0xfda3('0x8')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x8')](_0xfda3('0xb'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x8')](_0xfda3('0xd'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);router[_0xfda3('0xf')]('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/messages',auth[_0xfda3('0x5')](),controller['addMessage']);router[_0xfda3('0xf')](_0xfda3('0x11'),auth['isAuthenticated'](),interaction['tracked']('fax',_0xfda3('0x12')),controller[_0xfda3('0x13')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xfda3('0x14')](_0xfda3('0x15'),_0xfda3('0x16')),controller[_0xfda3('0x17')]);router[_0xfda3('0x18')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),interaction[_0xfda3('0x14')](_0xfda3('0x15'),_0xfda3('0x19')),controller['destroy']);router[_0xfda3('0x18')](_0xfda3('0x11'),auth[_0xfda3('0x5')](),controller[_0xfda3('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xaa88=['show','/:id/messages','getMessages','/:id/download','post','/:id/tags','fax','put','tracked','faxinteraction:update','update','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id'];(function(_0x1d5f1d,_0x48aa28){var _0x52caae=function(_0x1dfa8c){while(--_0x1dfa8c){_0x1d5f1d['push'](_0x1d5f1d['shift']());}};_0x52caae(++_0x48aa28);}(_0xaa88,0x137));var _0x8aa8=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xaa88[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var auth=require(_0x8aa8('0x5'));var interaction=require(_0x8aa8('0x6'));var config=require(_0x8aa8('0x7'));var controller=require(_0x8aa8('0x8'));router[_0x8aa8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8aa8('0x9')]('/describe',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xb')]);router[_0x8aa8('0x9')](_0x8aa8('0xc'),auth['isAuthenticated'](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0x9')](_0x8aa8('0xe'),auth['isAuthenticated'](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x9')](_0x8aa8('0x10'),auth[_0x8aa8('0xa')](),controller['download']);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xa')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller['addMessage']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth[_0x8aa8('0xa')](),interaction['tracked'](_0x8aa8('0x13'),'faxinteraction:addtags'),controller['addTags']);router[_0x8aa8('0x14')](_0x8aa8('0xc'),auth[_0x8aa8('0xa')](),interaction[_0x8aa8('0x15')](_0x8aa8('0x13'),_0x8aa8('0x16')),controller[_0x8aa8('0x17')]);router[_0x8aa8('0x18')](_0x8aa8('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x8aa8('0x13'),'faxinteraction:destroy'),controller['destroy']);router[_0x8aa8('0x18')]('/:id/tags',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x19')]);module[_0x8aa8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 4d20971..1de33da 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 _0xf9b4=['exports','TEXT','medium','ENUM','out','DATE'];(function(_0x4eb068,_0x421a2c){var _0x555d1a=function(_0x5651ef){while(--_0x5651ef){_0x4eb068['push'](_0x4eb068['shift']());}};_0x555d1a(++_0x421a2c);}(_0xf9b4,0x17a));var _0x4f9b=function(_0x1627cd,_0x2a9058){_0x1627cd=_0x1627cd-0x0;var _0x3d7971=_0xf9b4[_0x1627cd];return _0x3d7971;};'use strict';var Sequelize=require('sequelize');module[_0x4f9b('0x0')]={'body':{'type':Sequelize[_0x4f9b('0x1')](_0x4f9b('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f9b('0x3')]('in',_0x4f9b('0x4')),'defaultValue':_0x4f9b('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4f9b('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4f9b('0x5')]}}; \ No newline at end of file +var _0x6658=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x1f0464,_0x74c830){var _0x3b8414=function(_0x2c4ff3){while(--_0x2c4ff3){_0x1f0464['push'](_0x1f0464['shift']());}};_0x3b8414(++_0x74c830);}(_0x6658,0xbd));var _0x8665=function(_0x6dffe8,_0x28147a){_0x6dffe8=_0x6dffe8-0x0;var _0x44ff87=_0x6658[_0x6dffe8];return _0x44ff87;};'use strict';var Sequelize=require(_0x8665('0x0'));module[_0x8665('0x1')]={'body':{'type':Sequelize[_0x8665('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8665('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8665('0x4')]('in',_0x8665('0x5')),'defaultValue':_0x8665('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x8665('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 377e24e..67e3dff 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 _0x160f=['../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','set','json','save','update','then','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','include','findAll','show','params','includeAll','find','body','destroy','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','fax-interactions','reject','RejectMessage','event','rejectmessage','create','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','files','Attachment','join','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x5c84a6,_0x321f95){var _0xb8c5f0=function(_0x106d58){while(--_0x106d58){_0x5c84a6['push'](_0x5c84a6['shift']());}};_0xb8c5f0(++_0x321f95);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf160('0x0'));var emlformat=require(_0xf160('0x1'));var rimraf=require(_0xf160('0x2'));var zipdir=require(_0xf160('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf160('0x4'));var moment=require(_0xf160('0x5'));var BPromise=require(_0xf160('0x6'));var Mustache=require(_0xf160('0x7'));var util=require(_0xf160('0x8'));var path=require(_0xf160('0x9'));var sox=require('sox');var csv=require(_0xf160('0xa'));var ejs=require(_0xf160('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];config[_0xf160('0x17')]=_[_0xf160('0x18')](config['redis'],{'host':_0xf160('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf160('0x17')]));require(_0xf160('0x1a'))[_0xf160('0x1b')](socket);var jayson=require(_0xf160('0x1c'));var client=jayson[_0xf160('0x1d')][_0xf160('0x1e')]({'port':0x232c});var client9002=jayson[_0xf160('0x1d')][_0xf160('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1396ba,_0x59ac02,_0x477e4d,_0x400bda){return new BPromise(function(_0x8699a0,_0x2e0d71){var _0x51824b=_0x400bda||client;return _0x51824b[_0xf160('0x1f')](_0x1396ba,_0x477e4d)['then'](function(_0x5388c7){logger[_0xf160('0x20')](_0xf160('0x21'),_0x59ac02,_0xf160('0x22'));logger[_0xf160('0x23')](_0xf160('0x24'),_0x59ac02,_0xf160('0x22'),JSON[_0xf160('0x25')](_0x5388c7));if(_0x5388c7[_0xf160('0x26')]){if(_0x5388c7['error'][_0xf160('0x27')]===0x1f4){logger[_0xf160('0x26')](_0xf160('0x21'),_0x59ac02,_0x5388c7['error'][_0xf160('0x28')]);return _0x2e0d71(_0x5388c7[_0xf160('0x26')][_0xf160('0x28')]);}logger[_0xf160('0x26')](_0xf160('0x21'),_0x59ac02,_0x5388c7[_0xf160('0x26')][_0xf160('0x28')]);return _0x8699a0(_0x5388c7['error'][_0xf160('0x28')]);}else{logger[_0xf160('0x20')](_0xf160('0x21'),_0x59ac02,_0xf160('0x22'));_0x8699a0(_0x5388c7['result'][_0xf160('0x28')]);}})[_0xf160('0x29')](function(_0x4a8003){logger['error'](_0xf160('0x21'),_0x59ac02,_0x4a8003);_0x2e0d71(_0x4a8003);});});}function respondWithStatusCode(_0x1cc04c,_0x39c0e3){_0x39c0e3=_0x39c0e3||0xcc;return function(_0x4c0c51){if(_0x4c0c51){return _0x1cc04c[_0xf160('0x2a')](_0x39c0e3);}return _0x1cc04c[_0xf160('0x2b')](_0x39c0e3)[_0xf160('0x2c')]();};}function respondWithResult(_0x2e2b00,_0x135e0f){_0x135e0f=_0x135e0f||0xc8;return function(_0x193e1e){if(_0x193e1e){return _0x2e2b00['status'](_0x135e0f)['json'](_0x193e1e);}};}function respondWithFilteredResult(_0x48145e,_0x26e7b9){return function(_0x16a5fa){if(_0x16a5fa){var _0xcaab39=_0x16a5fa['count'],_0x26e06b=_0x26e7b9[_0xf160('0x2d')],_0x399cce=_0x26e7b9['offset']+_0x26e7b9['limit'],_0x563103;if(_0x399cce>=_0xcaab39){_0x399cce=_0xcaab39;_0x563103=0xc8;}else{_0x563103=0xce;}_0x48145e[_0xf160('0x2b')](_0x563103);return _0x48145e[_0xf160('0x2e')]('Content-Range',_0x26e06b+'-'+_0x399cce+'/'+_0xcaab39)[_0xf160('0x2f')](_0x16a5fa);}return null;};}function patchUpdates(_0x270933){return function(_0x4ab048){try{jsonpatch['apply'](_0x4ab048,_0x270933,!![]);}catch(_0x4b3ef4){return BPromise['reject'](_0x4b3ef4);}return _0x4ab048[_0xf160('0x30')]();};}function saveUpdates(_0x2bb5c4,_0x2ef512){return function(_0x1ccaf6){if(_0x1ccaf6){return _0x1ccaf6[_0xf160('0x31')](_0x2bb5c4)[_0xf160('0x32')](function(_0x4be359){return _0x4be359;});}return null;};}function removeEntity(_0x5495b5,_0x52178d){return function(_0x222b83){if(_0x222b83){return _0x222b83['destroy']()['then'](function(){_0x5495b5[_0xf160('0x2b')](0xcc)[_0xf160('0x2c')]();});}};}function handleEntityNotFound(_0x4dbe9d,_0x1930b8){return function(_0x1653ab){if(!_0x1653ab){_0x4dbe9d[_0xf160('0x2a')](0x194);}return _0x1653ab;};}function handleError(_0x2a7a5a,_0x268dcb){_0x268dcb=_0x268dcb||0x1f4;return function(_0x590f2a){logger[_0xf160('0x26')](_0x590f2a[_0xf160('0x33')]);if(_0x590f2a[_0xf160('0x34')]){delete _0x590f2a['name'];}_0x2a7a5a[_0xf160('0x2b')](_0x268dcb)[_0xf160('0x35')](_0x590f2a);};}exports[_0xf160('0x36')]=function(_0x22d152,_0x27a9e9){var _0x32ddc3={},_0x53795c={},_0x5ba20b={'count':0x0,'rows':[]};var _0x36d21b=_[_0xf160('0x37')](db[_0xf160('0x38')][_0xf160('0x39')],function(_0x75fb8c){return{'name':_0x75fb8c[_0xf160('0x3a')],'type':_0x75fb8c[_0xf160('0x3b')][_0xf160('0x3c')]};});_0x53795c[_0xf160('0x3d')]=_[_0xf160('0x37')](_0x36d21b,_0xf160('0x34'));_0x53795c[_0xf160('0x3e')]=_[_0xf160('0x3f')](_0x22d152[_0xf160('0x3e')]);_0x53795c[_0xf160('0x40')]=_[_0xf160('0x41')](_0x53795c[_0xf160('0x3d')],_0x53795c[_0xf160('0x3e')]);_0x32ddc3[_0xf160('0x42')]=_[_0xf160('0x41')](_0x53795c[_0xf160('0x3d')],qs[_0xf160('0x43')](_0x22d152[_0xf160('0x3e')][_0xf160('0x43')]));_0x32ddc3['attributes']=_0x32ddc3[_0xf160('0x42')][_0xf160('0x44')]?_0x32ddc3[_0xf160('0x42')]:_0x53795c[_0xf160('0x3d')];if(!_0x22d152[_0xf160('0x3e')][_0xf160('0x45')](_0xf160('0x46'))){_0x32ddc3['limit']=qs[_0xf160('0x47')](_0x22d152['query'][_0xf160('0x47')]);_0x32ddc3[_0xf160('0x2d')]=qs['offset'](_0x22d152[_0xf160('0x3e')][_0xf160('0x2d')]);}_0x32ddc3[_0xf160('0x48')]=qs[_0xf160('0x49')](_0x22d152[_0xf160('0x3e')][_0xf160('0x49')]);_0x32ddc3[_0xf160('0x4a')]=qs['filters'](_[_0xf160('0x4b')](_0x22d152[_0xf160('0x3e')],_0x53795c[_0xf160('0x40')]),_0x36d21b);if(_0x22d152[_0xf160('0x3e')][_0xf160('0x4c')]){_0x32ddc3[_0xf160('0x4a')]=_[_0xf160('0x4d')](_0x32ddc3[_0xf160('0x4a')],{'$or':_[_0xf160('0x37')](_0x36d21b,function(_0x1cb75e){if(_0x1cb75e[_0xf160('0x3b')]!=='VIRTUAL'){var _0x5b8f5f={};_0x5b8f5f[_0x1cb75e[_0xf160('0x34')]]={'$like':'%'+_0x22d152[_0xf160('0x3e')][_0xf160('0x4c')]+'%'};return _0x5b8f5f;}})});}_0x32ddc3=_[_0xf160('0x4d')]({},_0x32ddc3,_0x22d152[_0xf160('0x4e')]);var _0x152cf9={'where':_0x32ddc3['where']};return db[_0xf160('0x38')]['count'](_0x152cf9)['then'](function(_0x44fd52){_0x5ba20b[_0xf160('0x4f')]=_0x44fd52;if(_0x22d152['query']['includeAll']){_0x32ddc3[_0xf160('0x50')]=[{'all':!![]}];}return db[_0xf160('0x38')][_0xf160('0x51')](_0x32ddc3);})[_0xf160('0x32')](function(_0x5c73b9){_0x5ba20b['rows']=_0x5c73b9;return _0x5ba20b;})['then'](respondWithFilteredResult(_0x27a9e9,_0x32ddc3))['catch'](handleError(_0x27a9e9,null));};exports[_0xf160('0x52')]=function(_0x57f5a9,_0x418b8a){var _0x1a440b={'raw':!![],'where':{'id':_0x57f5a9[_0xf160('0x53')]['id']}},_0x1f7e15={};_0x1f7e15['model']=_[_0xf160('0x3f')](db[_0xf160('0x38')][_0xf160('0x39')]);_0x1f7e15['query']=_[_0xf160('0x3f')](_0x57f5a9[_0xf160('0x3e')]);_0x1f7e15[_0xf160('0x40')]=_['intersection'](_0x1f7e15[_0xf160('0x3d')],_0x1f7e15[_0xf160('0x3e')]);_0x1a440b[_0xf160('0x42')]=_[_0xf160('0x41')](_0x1f7e15[_0xf160('0x3d')],qs['fields'](_0x57f5a9['query'][_0xf160('0x43')]));_0x1a440b['attributes']=_0x1a440b[_0xf160('0x42')][_0xf160('0x44')]?_0x1a440b['attributes']:_0x1f7e15['model'];if(_0x57f5a9[_0xf160('0x3e')][_0xf160('0x54')]){_0x1a440b['include']=[{'all':!![]}];}_0x1a440b=_[_0xf160('0x4d')]({},_0x1a440b,_0x57f5a9[_0xf160('0x4e')]);return db[_0xf160('0x38')][_0xf160('0x55')](_0x1a440b)['then'](handleEntityNotFound(_0x418b8a,null))[_0xf160('0x32')](respondWithResult(_0x418b8a,null))['catch'](handleError(_0x418b8a,null));};exports[_0xf160('0x31')]=function(_0x1b3ec0,_0x780f95){if(_0x1b3ec0[_0xf160('0x56')]['id']){delete _0x1b3ec0[_0xf160('0x56')]['id'];}return db['FaxMessage'][_0xf160('0x55')]({'where':{'id':_0x1b3ec0['params']['id']}})[_0xf160('0x32')](handleEntityNotFound(_0x780f95,null))[_0xf160('0x32')](saveUpdates(_0x1b3ec0[_0xf160('0x56')],null))[_0xf160('0x32')](respondWithResult(_0x780f95,null))[_0xf160('0x29')](handleError(_0x780f95,null));};exports[_0xf160('0x57')]=function(_0x11855b,_0x12c22){return db[_0xf160('0x38')][_0xf160('0x55')]({'where':{'id':_0x11855b['params']['id']}})['then'](handleEntityNotFound(_0x12c22,null))[_0xf160('0x32')](removeEntity(_0x12c22,null))[_0xf160('0x29')](handleError(_0x12c22,null));};exports['describe']=function(_0x12083d,_0x1ca751){return db[_0xf160('0x38')]['describe']()['then'](respondWithResult(_0x1ca751,null))[_0xf160('0x29')](handleError(_0x1ca751,null));};var interaction_log=require(_0xf160('0x12'))('fax-interactions');exports[_0xf160('0x58')]=function(_0x1de36a,_0x4b3224,_0x2cbe17){var _0x39eb3b={'agent':{},'channel':_0xf160('0x59')};if(_0x1de36a[_0xf160('0x56')]['id']){delete _0x1de36a[_0xf160('0x56')]['id'];}_0x1de36a[_0xf160('0x56')]['read']=!![];_0x1de36a[_0xf160('0x56')][_0xf160('0x5a')]=moment()[_0xf160('0x5b')](_0xf160('0x5c'));_0x1de36a[_0xf160('0x56')]['UserId']=_0x1de36a[_0xf160('0x56')]['UserId']||_0x1de36a[_0xf160('0x5d')]['id'];_0x39eb3b[_0xf160('0x5e')]['id']=_0x1de36a[_0xf160('0x56')][_0xf160('0x5f')];return db[_0xf160('0x38')][_0xf160('0x55')]({'where':{'id':_0x1de36a['params']['id'],'UserId':null},'include':[{'model':db[_0xf160('0x60')],'as':_0xf160('0x61')}]})[_0xf160('0x32')](handleEntityNotFound(_0x4b3224,null))[_0xf160('0x32')](saveUpdates(_0x1de36a[_0xf160('0x56')],null))['then'](function(_0x5aa022){if(_0x5aa022){_0x39eb3b[_0xf160('0x28')]=_0x5aa022[_0xf160('0x62')]({'plain':!![]});return db[_0xf160('0x63')][_0xf160('0x55')]({'where':{'id':_0x5aa022[_0xf160('0x64')]}});}return null;})[_0xf160('0x32')](handleEntityNotFound(_0x4b3224,null))['then'](function(_0x25f79e){if(_0x25f79e){return _0x25f79e[_0xf160('0x31')]({'UserId':_0x1de36a[_0xf160('0x56')][_0xf160('0x5f')],'read1stAt':_[_0xf160('0x65')](_0x25f79e[_0xf160('0x66')])?moment()[_0xf160('0x5b')](_0xf160('0x5c')):undefined});}return null;})['then'](function(_0x1818f8){if(_0x1818f8){_0x39eb3b['interaction']=_0x1818f8[_0xf160('0x62')]({'plain':!![]});interaction_log[_0xf160('0x20')](_0xf160('0x67'),_0x1de36a[_0xf160('0x5d')]['id'],_0x1de36a[_0xf160('0x5d')][_0xf160('0x34')],_0x1de36a['user'][_0xf160('0x68')],_0x39eb3b[_0xf160('0x69')]['id'],_0x1de36a[_0xf160('0x56')]?JSON['stringify'](_0x1de36a[_0xf160('0x56')]):_0xf160('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xf160('0x6b'),_0x39eb3b);}return null;})[_0xf160('0x32')](function(_0x37de7b){if(_0x37de7b){if(_0x1de36a['body'][_0xf160('0x6c')]){_0x39eb3b[_0xf160('0x28')][_0xf160('0x6d')]=util['format'](_0xf160('0x6e'),_0x1de36a[_0xf160('0x5d')][_0xf160('0x34')]);_0x39eb3b[_0xf160('0x28')][_0xf160('0x6f')]=_0x39eb3b[_0xf160('0x6f')];_0x39eb3b[_0xf160('0x28')]['event']=_0xf160('0x58');return respondWithRpcPromise(_0xf160('0x70'),_0xf160('0x70'),{'event':'acceptmessage','message':_0x39eb3b[_0xf160('0x28')]},client9002)[_0xf160('0x32')](function(){return _0x39eb3b;});}return _0x39eb3b;}return null;})[_0xf160('0x32')](respondWithResult(_0x4b3224,null))[_0xf160('0x29')](handleError(_0x4b3224,null));};var interaction_log=require(_0xf160('0x12'))(_0xf160('0x71'));exports[_0xf160('0x72')]=function(_0x59b63c,_0x4c8103,_0x3b3e14){var _0x32d85c={'agent':{},'channel':_0xf160('0x59')};if(_0x59b63c[_0xf160('0x56')]['id']){delete _0x59b63c[_0xf160('0x56')]['id'];}_0x59b63c[_0xf160('0x56')][_0xf160('0x5f')]=_0x59b63c['body'][_0xf160('0x5f')]||_0x59b63c[_0xf160('0x5d')]['id'];_0x32d85c['agent']['id']=_0x59b63c['body'][_0xf160('0x5f')];return db[_0xf160('0x38')]['find']({'where':{'id':_0x59b63c[_0xf160('0x53')]['id'],'UserId':null}})[_0xf160('0x32')](handleEntityNotFound(_0x4c8103,null))['then'](function(_0x377038){if(_0x377038){_0x32d85c['message']=_0x377038[_0xf160('0x62')]({'plain':!![]});return db[_0xf160('0x63')][_0xf160('0x55')]({'where':{'id':_0x377038[_0xf160('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x4c8103,null))[_0xf160('0x32')](function(_0x2c5d3e){if(_0x2c5d3e){_0x32d85c[_0xf160('0x69')]=_0x2c5d3e[_0xf160('0x62')]({'plain':!![]});interaction_log[_0xf160('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59b63c[_0xf160('0x5d')]['id'],_0x59b63c[_0xf160('0x5d')][_0xf160('0x34')],_0x59b63c[_0xf160('0x5d')][_0xf160('0x68')],_0x32d85c[_0xf160('0x69')]['id'],_0x59b63c[_0xf160('0x56')]?JSON[_0xf160('0x25')](_0x59b63c[_0xf160('0x56')]):_0xf160('0x6a'));return respondWithRpcPromise(_0xf160('0x73'),'rejectMessage',_0x32d85c);}return null;})[_0xf160('0x32')](function(_0x1dc546){if(_0x1dc546){_0x1dc546[_0xf160('0x28')][_0xf160('0x6d')]=util[_0xf160('0x5b')]('SIP/%s',_0x59b63c[_0xf160('0x5d')][_0xf160('0x34')]);_0x1dc546[_0xf160('0x28')][_0xf160('0x6f')]=_0x32d85c[_0xf160('0x6f')];_0x1dc546[_0xf160('0x28')][_0xf160('0x74')]=_0xf160('0x72');respondWithRpcPromise(_0xf160('0x70'),_0xf160('0x70'),{'event':_0xf160('0x75'),'message':_0x1dc546['message']},client9002);return _0x32d85c;}return null;})[_0xf160('0x32')](respondWithResult(_0x4c8103,null))['catch'](handleError(_0x4c8103,null));};exports[_0xf160('0x76')]=function(_0x11f67a,_0xd0006f){var _0xf29ffa;return db[_0xf160('0x38')]['create'](_0x11f67a[_0xf160('0x56')],{})[_0xf160('0x32')](function(_0x2a992a){_0xf29ffa=_0x2a992a;return db[_0xf160('0x60')]['findOne']({'where':{'id':_0xf29ffa['ContactId']}});})[_0xf160('0x32')](function(_0x4cd533){if(_[_0xf160('0x65')](_0x4cd533)){return;}else{_0xf29ffa['fax']=_0x4cd533[_0xf160('0x59')];return db['Attachment']['findOne']({'where':{'id':_0xf29ffa[_0xf160('0x77')]}});}})[_0xf160('0x32')](function(_0x118bc3){return respondWithRpcPromise(_0xf160('0x78'),_0xf160('0x78'),{'FaxAccountId':_[_0xf160('0x65')](_0x11f67a[_0xf160('0x56')])?undefined:_0x11f67a[_0xf160('0x56')][_0xf160('0x79')],'path':_['isNil'](_0x118bc3)?undefined:util['format'](_0xf160('0x7a'),_0x118bc3[_0xf160('0x7b')]),'fax':_[_0xf160('0x65')](_0xf29ffa[_0xf160('0x59')])?undefined:_0xf29ffa[_0xf160('0x59')],'AttachmentId':_0xf29ffa['AttachmentId']},client9002);})[_0xf160('0x32')](respondWithResult(_0xd0006f,0xc9))[_0xf160('0x29')](handleError(_0xd0006f,null));};exports[_0xf160('0x7c')]=function(_0x2d708d,_0x5981c9){var _0x5a0fee=path['join'](config[_0xf160('0x7d')],'server',_0xf160('0x7e'),'attachments');return db[_0xf160('0x38')][_0xf160('0x55')]({'where':{'id':_0x2d708d['params']['id']},'include':[{'model':db[_0xf160('0x7f')],'as':_0xf160('0x7f')}]})[_0xf160('0x32')](handleEntityNotFound(_0x5981c9,null))[_0xf160('0x32')](function(_0xafdba6){if(_0xafdba6){return _0x5981c9[_0xf160('0x7c')](path[_0xf160('0x80')](_0x5a0fee,_0xafdba6['Attachment']['basename']));}})[_0xf160('0x29')](handleError(_0x5981c9,null));}; \ No newline at end of file +var _0xe5b5=['FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','rejectmessage','create','findOne','isNil','fax','AttachmentId','SendFax','FaxAccountId','basename','download','join','Attachment','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','find','body','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact'];(function(_0xb65f4e,_0xab08a0){var _0x4c013d=function(_0x94cf6a){while(--_0x94cf6a){_0xb65f4e['push'](_0xb65f4e['shift']());}};_0x4c013d(++_0xab08a0);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xe5b5[_0x233cb1];return _0x29ee7e;};'use strict';var pdf=require(_0x5e5b('0x0'));var emlformat=require(_0x5e5b('0x1'));var rimraf=require(_0x5e5b('0x2'));var zipdir=require(_0x5e5b('0x3'));var jsonpatch=require(_0x5e5b('0x4'));var rp=require(_0x5e5b('0x5'));var moment=require(_0x5e5b('0x6'));var BPromise=require(_0x5e5b('0x7'));var Mustache=require(_0x5e5b('0x8'));var util=require(_0x5e5b('0x9'));var path=require(_0x5e5b('0xa'));var sox=require(_0x5e5b('0xb'));var csv=require(_0x5e5b('0xc'));var ejs=require(_0x5e5b('0xd'));var fs=require('fs');var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xc'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5e5b('0x1b')]=_[_0x5e5b('0x1c')](config[_0x5e5b('0x1b')],{'host':_0x5e5b('0x1d'),'port':0x18eb});var socket=require(_0x5e5b('0x1e'))(new Redis(config[_0x5e5b('0x1b')]));require(_0x5e5b('0x1f'))['register'](socket);var jayson=require(_0x5e5b('0x20'));var client=jayson[_0x5e5b('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x5e5b('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9509,_0x13a1cb,_0x444435,_0xaf9ace){return new BPromise(function(_0x5c7148,_0x38fdcc){var _0x4d490c=_0xaf9ace||client;return _0x4d490c[_0x5e5b('0x22')](_0x4e9509,_0x444435)[_0x5e5b('0x23')](function(_0x4c5f9a){logger[_0x5e5b('0x24')](_0x5e5b('0x25'),_0x13a1cb,_0x5e5b('0x26'));logger['debug'](_0x5e5b('0x27'),_0x13a1cb,_0x5e5b('0x26'),JSON['stringify'](_0x4c5f9a));if(_0x4c5f9a[_0x5e5b('0x28')]){if(_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x29')]===0x1f4){logger[_0x5e5b('0x28')](_0x5e5b('0x25'),_0x13a1cb,_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x2a')]);return _0x38fdcc(_0x4c5f9a[_0x5e5b('0x28')]['message']);}logger['error'](_0x5e5b('0x25'),_0x13a1cb,_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x2a')]);return _0x5c7148(_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x2a')]);}else{logger[_0x5e5b('0x24')](_0x5e5b('0x25'),_0x13a1cb,_0x5e5b('0x26'));_0x5c7148(_0x4c5f9a[_0x5e5b('0x2b')][_0x5e5b('0x2a')]);}})[_0x5e5b('0x2c')](function(_0x4da321){logger[_0x5e5b('0x28')](_0x5e5b('0x25'),_0x13a1cb,_0x4da321);_0x38fdcc(_0x4da321);});});}function respondWithStatusCode(_0x3527a8,_0x5a2ba8){_0x5a2ba8=_0x5a2ba8||0xcc;return function(_0x988e5d){if(_0x988e5d){return _0x3527a8[_0x5e5b('0x2d')](_0x5a2ba8);}return _0x3527a8['status'](_0x5a2ba8)[_0x5e5b('0x2e')]();};}function respondWithResult(_0x21c74b,_0x39ce16){_0x39ce16=_0x39ce16||0xc8;return function(_0x36b595){if(_0x36b595){return _0x21c74b[_0x5e5b('0x2f')](_0x39ce16)[_0x5e5b('0x30')](_0x36b595);}};}function respondWithFilteredResult(_0x2cb695,_0x2b4351){return function(_0x3f6b25){if(_0x3f6b25){var _0x42da3b=_0x3f6b25['count'],_0xcb272c=_0x2b4351[_0x5e5b('0x31')],_0x28157a=_0x2b4351[_0x5e5b('0x31')]+_0x2b4351[_0x5e5b('0x32')],_0x4ed688;if(_0x28157a>=_0x42da3b){_0x28157a=_0x42da3b;_0x4ed688=0xc8;}else{_0x4ed688=0xce;}_0x2cb695[_0x5e5b('0x2f')](_0x4ed688);return _0x2cb695[_0x5e5b('0x33')]('Content-Range',_0xcb272c+'-'+_0x28157a+'/'+_0x42da3b)[_0x5e5b('0x30')](_0x3f6b25);}return null;};}function patchUpdates(_0x56f5a9){return function(_0x3f1041){try{jsonpatch[_0x5e5b('0x34')](_0x3f1041,_0x56f5a9,!![]);}catch(_0x11fa95){return BPromise[_0x5e5b('0x35')](_0x11fa95);}return _0x3f1041['save']();};}function saveUpdates(_0x22e906,_0x1bc636){return function(_0x524f74){if(_0x524f74){return _0x524f74[_0x5e5b('0x36')](_0x22e906)[_0x5e5b('0x23')](function(_0x34debb){return _0x34debb;});}return null;};}function removeEntity(_0x356db0,_0x14845d){return function(_0x2296dd){if(_0x2296dd){return _0x2296dd[_0x5e5b('0x37')]()[_0x5e5b('0x23')](function(){_0x356db0['status'](0xcc)[_0x5e5b('0x2e')]();});}};}function handleEntityNotFound(_0x37b5be,_0x1aef4a){return function(_0x34396f){if(!_0x34396f){_0x37b5be[_0x5e5b('0x2d')](0x194);}return _0x34396f;};}function handleError(_0x46cafc,_0x4fec9e){_0x4fec9e=_0x4fec9e||0x1f4;return function(_0x5b2ba5){logger[_0x5e5b('0x28')](_0x5b2ba5[_0x5e5b('0x38')]);if(_0x5b2ba5[_0x5e5b('0x39')]){delete _0x5b2ba5['name'];}_0x46cafc[_0x5e5b('0x2f')](_0x4fec9e)[_0x5e5b('0x3a')](_0x5b2ba5);};}exports[_0x5e5b('0x3b')]=function(_0x470b45,_0x54320f){var _0x5b3e0d={},_0x44c6d2={},_0x4f5b67={'count':0x0,'rows':[]};var _0x5ad9a6=_[_0x5e5b('0x3c')](db[_0x5e5b('0x3d')][_0x5e5b('0x3e')],function(_0x550faf){return{'name':_0x550faf[_0x5e5b('0x3f')],'type':_0x550faf['type']['key']};});_0x44c6d2[_0x5e5b('0x40')]=_[_0x5e5b('0x3c')](_0x5ad9a6,_0x5e5b('0x39'));_0x44c6d2[_0x5e5b('0x41')]=_[_0x5e5b('0x42')](_0x470b45[_0x5e5b('0x41')]);_0x44c6d2[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x44c6d2[_0x5e5b('0x40')],_0x44c6d2['query']);_0x5b3e0d[_0x5e5b('0x45')]=_[_0x5e5b('0x44')](_0x44c6d2['model'],qs[_0x5e5b('0x46')](_0x470b45['query'][_0x5e5b('0x46')]));_0x5b3e0d[_0x5e5b('0x45')]=_0x5b3e0d[_0x5e5b('0x45')][_0x5e5b('0x47')]?_0x5b3e0d[_0x5e5b('0x45')]:_0x44c6d2[_0x5e5b('0x40')];if(!_0x470b45[_0x5e5b('0x41')][_0x5e5b('0x48')](_0x5e5b('0x49'))){_0x5b3e0d[_0x5e5b('0x32')]=qs[_0x5e5b('0x32')](_0x470b45['query'][_0x5e5b('0x32')]);_0x5b3e0d[_0x5e5b('0x31')]=qs[_0x5e5b('0x31')](_0x470b45['query'][_0x5e5b('0x31')]);}_0x5b3e0d[_0x5e5b('0x4a')]=qs['sort'](_0x470b45[_0x5e5b('0x41')][_0x5e5b('0x4b')]);_0x5b3e0d['where']=qs[_0x5e5b('0x43')](_['pick'](_0x470b45['query'],_0x44c6d2['filters']),_0x5ad9a6);if(_0x470b45[_0x5e5b('0x41')]['filter']){_0x5b3e0d[_0x5e5b('0x4c')]=_['merge'](_0x5b3e0d[_0x5e5b('0x4c')],{'$or':_[_0x5e5b('0x3c')](_0x5ad9a6,function(_0x2bc089){if(_0x2bc089[_0x5e5b('0x4d')]!==_0x5e5b('0x4e')){var _0x425531={};_0x425531[_0x2bc089[_0x5e5b('0x39')]]={'$like':'%'+_0x470b45['query']['filter']+'%'};return _0x425531;}})});}_0x5b3e0d=_[_0x5e5b('0x4f')]({},_0x5b3e0d,_0x470b45['options']);var _0x54729b={'where':_0x5b3e0d['where']};return db[_0x5e5b('0x3d')]['count'](_0x54729b)[_0x5e5b('0x23')](function(_0x414dbd){_0x4f5b67[_0x5e5b('0x50')]=_0x414dbd;if(_0x470b45[_0x5e5b('0x41')][_0x5e5b('0x51')]){_0x5b3e0d[_0x5e5b('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x5e5b('0x53')](_0x5b3e0d);})[_0x5e5b('0x23')](function(_0x4f110f){_0x4f5b67[_0x5e5b('0x54')]=_0x4f110f;return _0x4f5b67;})['then'](respondWithFilteredResult(_0x54320f,_0x5b3e0d))[_0x5e5b('0x2c')](handleError(_0x54320f,null));};exports[_0x5e5b('0x55')]=function(_0x42ebaf,_0x30de85){var _0x4b2ef6={'raw':!![],'where':{'id':_0x42ebaf[_0x5e5b('0x56')]['id']}},_0x1ae9e4={};_0x1ae9e4['model']=_[_0x5e5b('0x42')](db[_0x5e5b('0x3d')][_0x5e5b('0x3e')]);_0x1ae9e4[_0x5e5b('0x41')]=_[_0x5e5b('0x42')](_0x42ebaf[_0x5e5b('0x41')]);_0x1ae9e4['filters']=_[_0x5e5b('0x44')](_0x1ae9e4[_0x5e5b('0x40')],_0x1ae9e4['query']);_0x4b2ef6[_0x5e5b('0x45')]=_[_0x5e5b('0x44')](_0x1ae9e4[_0x5e5b('0x40')],qs['fields'](_0x42ebaf[_0x5e5b('0x41')][_0x5e5b('0x46')]));_0x4b2ef6[_0x5e5b('0x45')]=_0x4b2ef6['attributes'][_0x5e5b('0x47')]?_0x4b2ef6[_0x5e5b('0x45')]:_0x1ae9e4[_0x5e5b('0x40')];if(_0x42ebaf['query']['includeAll']){_0x4b2ef6[_0x5e5b('0x52')]=[{'all':!![]}];}_0x4b2ef6=_['merge']({},_0x4b2ef6,_0x42ebaf['options']);return db[_0x5e5b('0x3d')][_0x5e5b('0x57')](_0x4b2ef6)[_0x5e5b('0x23')](handleEntityNotFound(_0x30de85,null))['then'](respondWithResult(_0x30de85,null))[_0x5e5b('0x2c')](handleError(_0x30de85,null));};exports[_0x5e5b('0x36')]=function(_0x148032,_0x3c518a){if(_0x148032[_0x5e5b('0x58')]['id']){delete _0x148032[_0x5e5b('0x58')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x148032[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x23')](handleEntityNotFound(_0x3c518a,null))[_0x5e5b('0x23')](saveUpdates(_0x148032[_0x5e5b('0x58')],null))['then'](respondWithResult(_0x3c518a,null))[_0x5e5b('0x2c')](handleError(_0x3c518a,null));};exports['destroy']=function(_0x325f87,_0x2fdeb5){return db[_0x5e5b('0x3d')][_0x5e5b('0x57')]({'where':{'id':_0x325f87[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x23')](handleEntityNotFound(_0x2fdeb5,null))[_0x5e5b('0x23')](removeEntity(_0x2fdeb5,null))[_0x5e5b('0x2c')](handleError(_0x2fdeb5,null));};exports['describe']=function(_0x3963eb,_0x21b1d5){return db[_0x5e5b('0x3d')][_0x5e5b('0x59')]()[_0x5e5b('0x23')](respondWithResult(_0x21b1d5,null))['catch'](handleError(_0x21b1d5,null));};var interaction_log=require(_0x5e5b('0x18'))(_0x5e5b('0x5a'));exports[_0x5e5b('0x5b')]=function(_0x3fc9b5,_0x27d775,_0x5207e0){var _0x13fb51={'agent':{},'channel':'fax'};if(_0x3fc9b5[_0x5e5b('0x58')]['id']){delete _0x3fc9b5['body']['id'];}_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x5c')]=!![];_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x5d')]=moment()[_0x5e5b('0x5e')](_0x5e5b('0x5f'));_0x3fc9b5['body'][_0x5e5b('0x60')]=_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x60')]||_0x3fc9b5[_0x5e5b('0x61')]['id'];_0x13fb51['agent']['id']=_0x3fc9b5['body'][_0x5e5b('0x60')];return db[_0x5e5b('0x3d')]['find']({'where':{'id':_0x3fc9b5[_0x5e5b('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x5e5b('0x62')],'as':_0x5e5b('0x63')}]})[_0x5e5b('0x23')](handleEntityNotFound(_0x27d775,null))[_0x5e5b('0x23')](saveUpdates(_0x3fc9b5['body'],null))[_0x5e5b('0x23')](function(_0x61faf2){if(_0x61faf2){_0x13fb51['message']=_0x61faf2['get']({'plain':!![]});return db['FaxInteraction'][_0x5e5b('0x57')]({'where':{'id':_0x61faf2[_0x5e5b('0x64')]}});}return null;})[_0x5e5b('0x23')](handleEntityNotFound(_0x27d775,null))[_0x5e5b('0x23')](function(_0xe8327e){if(_0xe8327e){return _0xe8327e['update']({'UserId':_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x60')],'read1stAt':_['isNil'](_0xe8327e[_0x5e5b('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5e5b('0x23')](function(_0x4fa0db){if(_0x4fa0db){_0x13fb51[_0x5e5b('0x66')]=_0x4fa0db[_0x5e5b('0x67')]({'plain':!![]});interaction_log[_0x5e5b('0x24')](_0x5e5b('0x68'),_0x3fc9b5[_0x5e5b('0x61')]['id'],_0x3fc9b5['user'][_0x5e5b('0x39')],_0x3fc9b5[_0x5e5b('0x61')][_0x5e5b('0x69')],_0x13fb51[_0x5e5b('0x66')]['id'],_0x3fc9b5[_0x5e5b('0x58')]?JSON[_0x5e5b('0x6a')](_0x3fc9b5[_0x5e5b('0x58')]):_0x5e5b('0x6b'));return respondWithRpcPromise(_0x5e5b('0x6c'),_0x5e5b('0x6d'),_0x13fb51);}return null;})[_0x5e5b('0x23')](function(_0x526e25){if(_0x526e25){if(_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x6e')]){_0x13fb51[_0x5e5b('0x2a')][_0x5e5b('0x6f')]=util[_0x5e5b('0x5e')]('SIP/%s',_0x3fc9b5[_0x5e5b('0x61')][_0x5e5b('0x39')]);_0x13fb51[_0x5e5b('0x2a')][_0x5e5b('0x70')]=_0x13fb51[_0x5e5b('0x70')];_0x13fb51[_0x5e5b('0x2a')]['event']=_0x5e5b('0x5b');return respondWithRpcPromise(_0x5e5b('0x71'),_0x5e5b('0x71'),{'event':'acceptmessage','message':_0x13fb51[_0x5e5b('0x2a')]},client9002)[_0x5e5b('0x23')](function(){return _0x13fb51;});}return _0x13fb51;}return null;})[_0x5e5b('0x23')](respondWithResult(_0x27d775,null))[_0x5e5b('0x2c')](handleError(_0x27d775,null));};var interaction_log=require(_0x5e5b('0x18'))(_0x5e5b('0x5a'));exports[_0x5e5b('0x35')]=function(_0x19b457,_0x387a44,_0x4fe5fb){var _0x19035d={'agent':{},'channel':'fax'};if(_0x19b457[_0x5e5b('0x58')]['id']){delete _0x19b457[_0x5e5b('0x58')]['id'];}_0x19b457['body']['UserId']=_0x19b457[_0x5e5b('0x58')][_0x5e5b('0x60')]||_0x19b457['user']['id'];_0x19035d[_0x5e5b('0x72')]['id']=_0x19b457['body']['UserId'];return db[_0x5e5b('0x3d')]['find']({'where':{'id':_0x19b457[_0x5e5b('0x56')]['id'],'UserId':null}})[_0x5e5b('0x23')](handleEntityNotFound(_0x387a44,null))[_0x5e5b('0x23')](function(_0x4ff92a){if(_0x4ff92a){_0x19035d[_0x5e5b('0x2a')]=_0x4ff92a[_0x5e5b('0x67')]({'plain':!![]});return db[_0x5e5b('0x73')]['find']({'where':{'id':_0x4ff92a[_0x5e5b('0x64')]}});}return null;})[_0x5e5b('0x23')](handleEntityNotFound(_0x387a44,null))['then'](function(_0x388dbe){if(_0x388dbe){_0x19035d['interaction']=_0x388dbe['get']({'plain':!![]});interaction_log[_0x5e5b('0x24')](_0x5e5b('0x74'),_0x19b457[_0x5e5b('0x61')]['id'],_0x19b457[_0x5e5b('0x61')][_0x5e5b('0x39')],_0x19b457['user'][_0x5e5b('0x69')],_0x19035d[_0x5e5b('0x66')]['id'],_0x19b457['body']?JSON['stringify'](_0x19b457[_0x5e5b('0x58')]):_0x5e5b('0x6b'));return respondWithRpcPromise(_0x5e5b('0x75'),_0x5e5b('0x76'),_0x19035d);}return null;})[_0x5e5b('0x23')](function(_0x1ad8a9){if(_0x1ad8a9){_0x1ad8a9['message'][_0x5e5b('0x6f')]=util[_0x5e5b('0x5e')](_0x5e5b('0x77'),_0x19b457['user']['name']);_0x1ad8a9[_0x5e5b('0x2a')][_0x5e5b('0x70')]=_0x19035d[_0x5e5b('0x70')];_0x1ad8a9['message'][_0x5e5b('0x78')]=_0x5e5b('0x35');respondWithRpcPromise(_0x5e5b('0x71'),'EventManager',{'event':_0x5e5b('0x79'),'message':_0x1ad8a9[_0x5e5b('0x2a')]},client9002);return _0x19035d;}return null;})[_0x5e5b('0x23')](respondWithResult(_0x387a44,null))['catch'](handleError(_0x387a44,null));};exports[_0x5e5b('0x7a')]=function(_0x9574d3,_0x3052d0){var _0x1dc878;return db[_0x5e5b('0x3d')][_0x5e5b('0x7a')](_0x9574d3['body'],{})[_0x5e5b('0x23')](function(_0x2468d5){_0x1dc878=_0x2468d5;return db['CmContact'][_0x5e5b('0x7b')]({'where':{'id':_0x1dc878['ContactId']}});})[_0x5e5b('0x23')](function(_0x263c07){if(_[_0x5e5b('0x7c')](_0x263c07)){return;}else{_0x1dc878[_0x5e5b('0x7d')]=_0x263c07[_0x5e5b('0x7d')];return db['Attachment'][_0x5e5b('0x7b')]({'where':{'id':_0x1dc878[_0x5e5b('0x7e')]}});}})[_0x5e5b('0x23')](function(_0x48d14){return respondWithRpcPromise(_0x5e5b('0x7f'),_0x5e5b('0x7f'),{'FaxAccountId':_['isNil'](_0x9574d3[_0x5e5b('0x58')])?undefined:_0x9574d3['body'][_0x5e5b('0x80')],'path':_[_0x5e5b('0x7c')](_0x48d14)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x48d14[_0x5e5b('0x81')]),'fax':_[_0x5e5b('0x7c')](_0x1dc878[_0x5e5b('0x7d')])?undefined:_0x1dc878[_0x5e5b('0x7d')],'AttachmentId':_0x1dc878[_0x5e5b('0x7e')]},client9002);})[_0x5e5b('0x23')](respondWithResult(_0x3052d0,0xc9))[_0x5e5b('0x2c')](handleError(_0x3052d0,null));};exports[_0x5e5b('0x82')]=function(_0xb0bc7,_0x231eff){var _0x4cfdcc=path[_0x5e5b('0x83')](config['root'],'server','files','attachments');return db[_0x5e5b('0x3d')][_0x5e5b('0x57')]({'where':{'id':_0xb0bc7[_0x5e5b('0x56')]['id']},'include':[{'model':db[_0x5e5b('0x84')],'as':_0x5e5b('0x84')}]})['then'](handleEntityNotFound(_0x231eff,null))[_0x5e5b('0x23')](function(_0x41f47c){if(_0x41f47c){return _0x231eff['download'](path[_0x5e5b('0x83')](_0x4cfdcc,_0x41f47c[_0x5e5b('0x84')][_0x5e5b('0x81')]));}})[_0x5e5b('0x2c')](handleError(_0x231eff,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 77bca7e..668a55f 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x55ca,0x126));var _0xa55c=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x55ca[_0x4d2263];return _0x24aba0;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x147396,_0xd9f4e4){_0x147396=_0x147396-0x0;var _0x38b1b3=_0x3e74[_0x147396];return _0x38b1b3;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f4272e6..7a2d8d3 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 _0xe42d=['moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','direction','toLowerCase','out','secret','UserId','findOne','FaxInteractionId','update','createdAt','utf8mb4','utf8mb4_unicode_ci','util','api'];(function(_0x583b81,_0x37dda7){var _0x3ed902=function(_0x26b6ed){while(--_0x26b6ed){_0x583b81['push'](_0x583b81['shift']());}};_0x3ed902(++_0x37dda7);}(_0xe42d,0x112));var _0xde42=function(_0x1c9bb8,_0x407240){_0x1c9bb8=_0x1c9bb8-0x0;var _0x518423=_0xe42d[_0x1c9bb8];return _0x518423;};'use strict';var _=require('lodash');var util=require(_0xde42('0x0'));var logger=require('../../config/logger')(_0xde42('0x1'));var moment=require(_0xde42('0x2'));var BPromise=require(_0xde42('0x3'));var rp=require(_0xde42('0x4'));var fs=require('fs');var path=require(_0xde42('0x5'));var rimraf=require(_0xde42('0x6'));var config=require('../../config/environment');var attributes=require(_0xde42('0x7'));module[_0xde42('0x8')]=function(_0xbed951,_0x69edf7){return _0xbed951[_0xde42('0x9')]('FaxMessage',attributes,{'tableName':_0xde42('0xa'),'paranoid':![],'indexes':[{'name':_0xde42('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ceb9e,_0x1ceadb,_0x2985e4){var _0x11f148=_0xbed951['models'];var _0x46bb1e=_0x1ceb9e['get']({'plain':!![]});if(_0x46bb1e[_0xde42('0xc')][_0xde42('0xd')]()==='in'||_0x46bb1e['direction'][_0xde42('0xd')]()===_0xde42('0xe')&&!_0x46bb1e[_0xde42('0xf')]&&!_['isNil'](_0x46bb1e[_0xde42('0x10')])){_0x11f148['FaxInteraction'][_0xde42('0x11')]({'where':{'id':_0x46bb1e[_0xde42('0x12')]}})['then'](function(_0x55de6d){if(_0x55de6d){_0x55de6d[_0xde42('0x13')]({'lastMsgAt':_0x46bb1e[_0xde42('0x14')],'lastMsgDirection':_0x46bb1e[_0xde42('0xc')][_0xde42('0xd')]()});}})['catch'](function(_0x120e49){console['error'](_0x120e49);});}_0x2985e4();}},'charset':_0xde42('0x15'),'collate':_0xde42('0x16')});}; \ No newline at end of file +var _0xf8c0=['secret','isNil','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xf8c0,0x8f));var _0x0f8c=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xf8c0[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0x0f8c('0x0'));var util=require(_0x0f8c('0x1'));var logger=require(_0x0f8c('0x2'))(_0x0f8c('0x3'));var moment=require('moment');var BPromise=require(_0x0f8c('0x4'));var rp=require(_0x0f8c('0x5'));var fs=require('fs');var path=require(_0x0f8c('0x6'));var rimraf=require(_0x0f8c('0x7'));var config=require(_0x0f8c('0x8'));var attributes=require(_0x0f8c('0x9'));module[_0x0f8c('0xa')]=function(_0x38a2b6,_0x8c64b4){return _0x38a2b6[_0x0f8c('0xb')](_0x0f8c('0xc'),attributes,{'tableName':_0x0f8c('0xd'),'paranoid':![],'indexes':[{'name':_0x0f8c('0xe'),'fields':[_0x0f8c('0xf')],'type':_0x0f8c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59a5d5,_0x2a1421,_0x217fed){var _0x176f2e=_0x38a2b6[_0x0f8c('0x11')];var _0x60569=_0x59a5d5[_0x0f8c('0x12')]({'plain':!![]});if(_0x60569[_0x0f8c('0x13')][_0x0f8c('0x14')]()==='in'||_0x60569[_0x0f8c('0x13')]['toLowerCase']()===_0x0f8c('0x15')&&!_0x60569[_0x0f8c('0x16')]&&!_[_0x0f8c('0x17')](_0x60569['UserId'])){_0x176f2e[_0x0f8c('0x18')][_0x0f8c('0x19')]({'where':{'id':_0x60569[_0x0f8c('0x1a')]}})[_0x0f8c('0x1b')](function(_0x5bfeda){if(_0x5bfeda){_0x5bfeda['update']({'lastMsgAt':_0x60569[_0x0f8c('0x1c')],'lastMsgDirection':_0x60569[_0x0f8c('0x13')][_0x0f8c('0x14')]()});}})[_0x0f8c('0x1d')](function(_0x4694bc){console[_0x0f8c('0x1e')](_0x4694bc);});}_0x217fed();}},'charset':_0x0f8c('0x1f'),'collate':_0x0f8c('0x20')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index ff90311..03b041d 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 _0xaa79=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateFaxMessage','options','catch','FaxMessage','update','body','attributes','lodash','util'];(function(_0x446e9a,_0x32c039){var _0x36c753=function(_0xc05661){while(--_0xc05661){_0x446e9a['push'](_0x446e9a['shift']());}};_0x36c753(++_0x32c039);}(_0xaa79,0x127));var _0x9aa7=function(_0xca493b,_0x7ff2f3){_0xca493b=_0xca493b-0x0;var _0x1433a8=_0xaa79[_0xca493b];return _0x1433a8;};'use strict';var _=require(_0x9aa7('0x0'));var util=require(_0x9aa7('0x1'));var moment=require(_0x9aa7('0x2'));var BPromise=require(_0x9aa7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9aa7('0x4'));var db=require(_0x9aa7('0x5'))['db'];var utils=require(_0x9aa7('0x6'));var logger=require(_0x9aa7('0x7'))(_0x9aa7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9aa7('0x9')][_0x9aa7('0xa')]({'port':0x232a});config[_0x9aa7('0xb')]=_[_0x9aa7('0xc')](config[_0x9aa7('0xb')],{'host':_0x9aa7('0xd'),'port':0x18eb});var socket=require(_0x9aa7('0xe'))(new Redis(config[_0x9aa7('0xb')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x19cdd4,_0x38b484,_0x4ae4d0){return new BPromise(function(_0x31c680,_0x50e1d2){return client[_0x9aa7('0xf')](_0x19cdd4,_0x4ae4d0)[_0x9aa7('0x10')](function(_0xddb6d5){logger[_0x9aa7('0x11')](_0x9aa7('0x12'),_0x38b484,_0x9aa7('0x13'));logger[_0x9aa7('0x14')](_0x9aa7('0x15'),_0x38b484,_0x9aa7('0x13'),JSON[_0x9aa7('0x16')](_0xddb6d5));if(_0xddb6d5[_0x9aa7('0x17')]){if(_0xddb6d5[_0x9aa7('0x17')][_0x9aa7('0x18')]===0x1f4){logger['error'](_0x9aa7('0x12'),_0x38b484,_0xddb6d5['error'][_0x9aa7('0x19')]);return _0x50e1d2(_0xddb6d5[_0x9aa7('0x17')][_0x9aa7('0x19')]);}logger[_0x9aa7('0x17')](_0x9aa7('0x12'),_0x38b484,_0xddb6d5['error'][_0x9aa7('0x19')]);return _0x31c680(_0xddb6d5['error'][_0x9aa7('0x19')]);}else{logger[_0x9aa7('0x11')](_0x9aa7('0x12'),_0x38b484,_0x9aa7('0x13'));_0x31c680(_0xddb6d5['result']['message']);}})['catch'](function(_0xf8d35f){logger[_0x9aa7('0x17')](_0x9aa7('0x12'),_0x38b484,_0xf8d35f);_0x50e1d2(_0xf8d35f);});});}exports[_0x9aa7('0x1a')]=function(_0x2873ba){var _0x4f0e71=this;return new Promise(function(_0x59a641,_0x49f60e){return db['FaxMessage']['create'](_0x2873ba['body'],{'raw':_0x2873ba[_0x9aa7('0x1b')]?_0x2873ba[_0x9aa7('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x9aa7('0x10')](function(_0x480218){logger[_0x9aa7('0x11')](_0x9aa7('0x1a'),_0x2873ba);logger[_0x9aa7('0x14')](_0x9aa7('0x1a'),_0x2873ba,JSON[_0x9aa7('0x16')](_0x480218));_0x59a641(_0x480218);})[_0x9aa7('0x1c')](function(_0x3b2cc6){logger['error'](_0x9aa7('0x1a'),_0x3b2cc6[_0x9aa7('0x19')],_0x2873ba);_0x49f60e(_0x4f0e71[_0x9aa7('0x17')](0x1f4,_0x3b2cc6[_0x9aa7('0x19')]));});});};exports['UpdateFaxMessage']=function(_0xdc4384){var _0x4c5bfd=this;return new Promise(function(_0x1e5dc3,_0x237ca7){return db[_0x9aa7('0x1d')][_0x9aa7('0x1e')](_0xdc4384[_0x9aa7('0x1f')],{'raw':_0xdc4384['options']?_0xdc4384[_0x9aa7('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdc4384[_0x9aa7('0x1b')]?_0xdc4384['options']['where']||null:null,'attributes':_0xdc4384[_0x9aa7('0x1b')]?_0xdc4384[_0x9aa7('0x1b')][_0x9aa7('0x20')]||null:null,'limit':_0xdc4384['options']?_0xdc4384[_0x9aa7('0x1b')]['limit']||null:null})[_0x9aa7('0x10')](function(_0x3ec68e){logger['info']('UpdateFaxMessage',_0xdc4384);logger[_0x9aa7('0x14')]('UpdateFaxMessage',_0xdc4384,JSON['stringify'](_0x3ec68e));_0x1e5dc3(_0x3ec68e);})[_0x9aa7('0x1c')](function(_0x566617){logger[_0x9aa7('0x17')]('UpdateFaxMessage',_0x566617[_0x9aa7('0x19')],_0xdc4384);_0x237ca7(_0x4c5bfd[_0x9aa7('0x17')](0x1f4,_0x566617[_0x9aa7('0x19')]));});});}; \ No newline at end of file +var _0x105e=['register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','body','options','raw','CreateFaxMessage','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x293a47,_0x907a53){var _0x51687b=function(_0x5769ce){while(--_0x5769ce){_0x293a47['push'](_0x293a47['shift']());}};_0x51687b(++_0x907a53);}(_0x105e,0x1b8));var _0xe105=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x105e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe105('0x0'));var moment=require(_0xe105('0x1'));var BPromise=require(_0xe105('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe105('0x3'));var db=require(_0xe105('0x4'))['db'];var utils=require(_0xe105('0x5'));var logger=require('../../config/logger')(_0xe105('0x6'));var config=require(_0xe105('0x7'));var jayson=require(_0xe105('0x8'));var client=jayson[_0xe105('0x9')][_0xe105('0xa')]({'port':0x232a});config['redis']=_[_0xe105('0xb')](config[_0xe105('0xc')],{'host':_0xe105('0xd'),'port':0x18eb});var socket=require(_0xe105('0xe'))(new Redis(config[_0xe105('0xc')]));require(_0xe105('0xf'))[_0xe105('0x10')](socket);function respondWithRpcPromise(_0xf33ef9,_0x2e6b5e,_0x386de6){return new BPromise(function(_0x315898,_0x5dcde4){return client['request'](_0xf33ef9,_0x386de6)[_0xe105('0x11')](function(_0x54bf3a){logger[_0xe105('0x12')](_0xe105('0x13'),_0x2e6b5e,_0xe105('0x14'));logger[_0xe105('0x15')](_0xe105('0x16'),_0x2e6b5e,'request\x20sent',JSON['stringify'](_0x54bf3a));if(_0x54bf3a['error']){if(_0x54bf3a[_0xe105('0x17')]['code']===0x1f4){logger['error'](_0xe105('0x13'),_0x2e6b5e,_0x54bf3a['error'][_0xe105('0x18')]);return _0x5dcde4(_0x54bf3a[_0xe105('0x17')][_0xe105('0x18')]);}logger[_0xe105('0x17')]('FaxMessage,\x20%s,\x20%s',_0x2e6b5e,_0x54bf3a[_0xe105('0x17')]['message']);return _0x315898(_0x54bf3a[_0xe105('0x17')][_0xe105('0x18')]);}else{logger[_0xe105('0x12')](_0xe105('0x13'),_0x2e6b5e,_0xe105('0x14'));_0x315898(_0x54bf3a[_0xe105('0x19')]['message']);}})[_0xe105('0x1a')](function(_0x263c62){logger[_0xe105('0x17')]('FaxMessage,\x20%s,\x20%s',_0x2e6b5e,_0x263c62);_0x5dcde4(_0x263c62);});});}exports['CreateFaxMessage']=function(_0x1fbda1){var _0x5a1345=this;return new Promise(function(_0x36bdfd,_0x3ebd97){return db['FaxMessage']['create'](_0x1fbda1[_0xe105('0x1b')],{'raw':_0x1fbda1['options']?_0x1fbda1[_0xe105('0x1c')][_0xe105('0x1d')]===undefined?!![]:![]:!![]})[_0xe105('0x11')](function(_0x4250d0){logger[_0xe105('0x12')]('CreateFaxMessage',_0x1fbda1);logger[_0xe105('0x15')](_0xe105('0x1e'),_0x1fbda1,JSON[_0xe105('0x1f')](_0x4250d0));_0x36bdfd(_0x4250d0);})[_0xe105('0x1a')](function(_0x4d2577){logger['error']('CreateFaxMessage',_0x4d2577[_0xe105('0x18')],_0x1fbda1);_0x3ebd97(_0x5a1345['error'](0x1f4,_0x4d2577[_0xe105('0x18')]));});});};exports[_0xe105('0x20')]=function(_0x50529a){var _0x321924=this;return new Promise(function(_0x4304f6,_0x3fd680){return db[_0xe105('0x21')][_0xe105('0x22')](_0x50529a[_0xe105('0x1b')],{'raw':_0x50529a[_0xe105('0x1c')]?_0x50529a[_0xe105('0x1c')][_0xe105('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50529a['options']?_0x50529a[_0xe105('0x1c')][_0xe105('0x23')]||null:null,'attributes':_0x50529a[_0xe105('0x1c')]?_0x50529a[_0xe105('0x1c')][_0xe105('0x24')]||null:null,'limit':_0x50529a[_0xe105('0x1c')]?_0x50529a[_0xe105('0x1c')][_0xe105('0x25')]||null:null})[_0xe105('0x11')](function(_0x511b3c){logger[_0xe105('0x12')]('UpdateFaxMessage',_0x50529a);logger[_0xe105('0x15')](_0xe105('0x20'),_0x50529a,JSON['stringify'](_0x511b3c));_0x4304f6(_0x511b3c);})['catch'](function(_0x300b49){logger[_0xe105('0x17')](_0xe105('0x20'),_0x300b49[_0xe105('0x18')],_0x50529a);_0x3fd680(_0x321924[_0xe105('0x17')](0x1f4,_0x300b49[_0xe105('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 811edb5..3308896 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(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 c6af71b..9d8ad89 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 _0x9b15=['fax','faxmessage:create','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','tracked'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9b15,0x191));var _0x59b1=function(_0x3dbc13,_0x16f2f1){_0x3dbc13=_0x3dbc13-0x0;var _0x12d014=_0x9b15[_0x3dbc13];return _0x12d014;};'use strict';var multer=require(_0x59b1('0x0'));var util=require(_0x59b1('0x1'));var path=require(_0x59b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x59b1('0x3'));var router=express[_0x59b1('0x4')]();var auth=require(_0x59b1('0x5'));var interaction=require(_0x59b1('0x6'));var config=require(_0x59b1('0x7'));var controller=require('./faxMessage.controller');router[_0x59b1('0x8')]('/',auth[_0x59b1('0x9')](),controller['index']);router[_0x59b1('0x8')]('/describe',auth[_0x59b1('0x9')](),controller[_0x59b1('0xa')]);router[_0x59b1('0x8')]('/:id',auth[_0x59b1('0x9')](),controller[_0x59b1('0xb')]);router[_0x59b1('0x8')]('/:id/download',auth[_0x59b1('0x9')](),controller['download']);router['post']('/',auth[_0x59b1('0x9')](),interaction[_0x59b1('0xc')](_0x59b1('0xd'),_0x59b1('0xe')),controller['create']);router[_0x59b1('0xf')](_0x59b1('0x10'),auth[_0x59b1('0x9')](),controller['update']);router['put'](_0x59b1('0x11'),auth[_0x59b1('0x9')](),controller[_0x59b1('0x12')]);router[_0x59b1('0xf')](_0x59b1('0x13'),auth['isAuthenticated'](),controller[_0x59b1('0x14')]);router['delete']('/:id',auth[_0x59b1('0x9')](),controller[_0x59b1('0x15')]);module[_0x59b1('0x16')]=router; \ No newline at end of file +var _0x609a=['/:id/reject','reject','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept'];(function(_0x28001d,_0x4ba865){var _0x3d9230=function(_0x1c6fe0){while(--_0x1c6fe0){_0x28001d['push'](_0x28001d['shift']());}};_0x3d9230(++_0x4ba865);}(_0x609a,0x11c));var _0xa609=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x609a[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var path=require('path');var timeout=require(_0xa609('0x2'));var express=require(_0xa609('0x3'));var router=express['Router']();var auth=require(_0xa609('0x4'));var interaction=require(_0xa609('0x5'));var config=require(_0xa609('0x6'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0xa609('0x7')](),controller[_0xa609('0x8')]);router[_0xa609('0x9')](_0xa609('0xa'),auth[_0xa609('0x7')](),controller[_0xa609('0xb')]);router[_0xa609('0x9')](_0xa609('0xc'),auth['isAuthenticated'](),controller[_0xa609('0xd')]);router[_0xa609('0x9')](_0xa609('0xe'),auth[_0xa609('0x7')](),controller[_0xa609('0xf')]);router[_0xa609('0x10')]('/',auth[_0xa609('0x7')](),interaction[_0xa609('0x11')](_0xa609('0x12'),_0xa609('0x13')),controller[_0xa609('0x14')]);router[_0xa609('0x15')](_0xa609('0xc'),auth[_0xa609('0x7')](),controller[_0xa609('0x16')]);router[_0xa609('0x15')](_0xa609('0x17'),auth[_0xa609('0x7')](),controller['accept']);router[_0xa609('0x15')](_0xa609('0x18'),auth[_0xa609('0x7')](),controller[_0xa609('0x19')]);router['delete'](_0xa609('0xc'),auth[_0xa609('0x7')](),controller[_0xa609('0x1a')]);module[_0xa609('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a4ef1cd..209251f 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 _0xf0e8=['ENUM','beepall','roundrobin','sequelize','exports','name','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf0e8,0x81));var _0x8f0e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf0e8[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x8f0e('0x0'));module[_0x8f0e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f0e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8f0e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f0e('0x4')]('rrmemory',_0x8f0e('0x5'),_0x8f0e('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8f0e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb854=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x2ce566,_0x3ce369){var _0x5d5400=function(_0x3baaa3){while(--_0x3baaa3){_0x2ce566['push'](_0x2ce566['shift']());}};_0x5d5400(++_0x3ce369);}(_0xb854,0x11a));var _0x4b85=function(_0xe4d5a8,_0x5e7ae6){_0xe4d5a8=_0xe4d5a8-0x0;var _0x788e99=_0xb854[_0xe4d5a8];return _0x788e99;};'use strict';var Sequelize=require(_0x4b85('0x0'));module[_0x4b85('0x1')]={'name':{'type':Sequelize[_0x4b85('0x2')],'unique':_0x4b85('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4b85('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4b85('0x5')](_0x4b85('0x6'),_0x4b85('0x7'),_0x4b85('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4b85('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 4f35d63..ba629b5 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 _0x8cb2=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','merge','User','findAndCountAll','agent','format','%s/%s','SIP','faxPause','createdAt','Team','getTeams','Agents','voicePause','interface','sequelize','addTeams','findOrCreate','forEach','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','get','FaxQueues','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x5de592,_0x4e89f0){var _0x3e841d=function(_0x3ab95c){while(--_0x3ab95c){_0x5de592['push'](_0x5de592['shift']());}};_0x3e841d(++_0x4e89f0);}(_0x8cb2,0xcf));var _0x28cb=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8cb2[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x28cb('0x0'));var emlformat=require(_0x28cb('0x1'));var rimraf=require(_0x28cb('0x2'));var zipdir=require(_0x28cb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x28cb('0x4'));var BPromise=require(_0x28cb('0x5'));var Mustache=require('mustache');var util=require(_0x28cb('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28cb('0x7'));var fs=require('fs');var _=require(_0x28cb('0x8'));var squel=require(_0x28cb('0x9'));var crypto=require(_0x28cb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x28cb('0xb'));var toCsv=require(_0x28cb('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x28cb('0xd'));var authService=require(_0x28cb('0xe'));var qs=require(_0x28cb('0xf'));var as=require(_0x28cb('0x10'));var hardwareService=require(_0x28cb('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x28cb('0x12'));var config=require(_0x28cb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x28cb('0x14'))['db'];config[_0x28cb('0x15')]=_[_0x28cb('0x16')](config['redis'],{'host':_0x28cb('0x17'),'port':0x18eb});var socket=require(_0x28cb('0x18'))(new Redis(config[_0x28cb('0x15')]));require(_0x28cb('0x19'))[_0x28cb('0x1a')](socket);function respondWithStatusCode(_0x331acb,_0x560234){_0x560234=_0x560234||0xcc;return function(_0x535b74){if(_0x535b74){return _0x331acb[_0x28cb('0x1b')](_0x560234);}return _0x331acb[_0x28cb('0x1c')](_0x560234)[_0x28cb('0x1d')]();};}function respondWithResult(_0x1515d5,_0x5edaa2){_0x5edaa2=_0x5edaa2||0xc8;return function(_0x4e7856){if(_0x4e7856){return _0x1515d5['status'](_0x5edaa2)[_0x28cb('0x1e')](_0x4e7856);}};}function respondWithFilteredResult(_0x572c86,_0x39fbc0){return function(_0x3de005){if(_0x3de005){var _0x1db073=_0x3de005[_0x28cb('0x1f')],_0x3e8c1d=_0x39fbc0[_0x28cb('0x20')],_0x1b9d52=_0x39fbc0[_0x28cb('0x20')]+_0x39fbc0[_0x28cb('0x21')],_0x1bf00a;if(_0x1b9d52>=_0x1db073){_0x1b9d52=_0x1db073;_0x1bf00a=0xc8;}else{_0x1bf00a=0xce;}_0x572c86['status'](_0x1bf00a);return _0x572c86[_0x28cb('0x22')]('Content-Range',_0x3e8c1d+'-'+_0x1b9d52+'/'+_0x1db073)[_0x28cb('0x1e')](_0x3de005);}return null;};}function patchUpdates(_0x4249a8){return function(_0x278fa9){try{jsonpatch['apply'](_0x278fa9,_0x4249a8,!![]);}catch(_0x376dec){return BPromise['reject'](_0x376dec);}return _0x278fa9[_0x28cb('0x23')]();};}function saveUpdates(_0x39251a,_0x2dc03d){return function(_0x5a6b39){if(_0x5a6b39){return _0x5a6b39[_0x28cb('0x24')](_0x39251a)[_0x28cb('0x25')](function(_0x1089fd){return _0x1089fd;});}return null;};}function removeEntity(_0x5cf9c5,_0x567466){return function(_0x2fee6e){if(_0x2fee6e){return _0x2fee6e[_0x28cb('0x26')]()[_0x28cb('0x25')](function(){var _0x380cc0=_0x2fee6e[_0x28cb('0x27')]({'plain':!![]});var _0x1e378e=_0x28cb('0x28');return db['UserProfileResource'][_0x28cb('0x26')]({'where':{'type':_0x1e378e,'resourceId':_0x380cc0['id']}})[_0x28cb('0x25')](function(){return _0x2fee6e;});})['then'](function(){_0x5cf9c5[_0x28cb('0x1c')](0xcc)[_0x28cb('0x1d')]();});}};}function handleEntityNotFound(_0x1929c7,_0x1e4a22){return function(_0x38ebf0){if(!_0x38ebf0){_0x1929c7['sendStatus'](0x194);}return _0x38ebf0;};}function handleError(_0xea1c29,_0x297c8e){_0x297c8e=_0x297c8e||0x1f4;return function(_0x49ba91){logger[_0x28cb('0x29')](_0x49ba91[_0x28cb('0x2a')]);if(_0x49ba91[_0x28cb('0x2b')]){delete _0x49ba91[_0x28cb('0x2b')];}_0xea1c29[_0x28cb('0x1c')](_0x297c8e)[_0x28cb('0x2c')](_0x49ba91);};}exports[_0x28cb('0x2d')]=function(_0x222d99,_0x33a69e){var _0x36d1b2={},_0x2b107f={},_0x599242={'count':0x0,'rows':[]};var _0x3e87f2=_['map'](db[_0x28cb('0x2e')][_0x28cb('0x2f')],function(_0x3e9702){return{'name':_0x3e9702[_0x28cb('0x30')],'type':_0x3e9702[_0x28cb('0x31')][_0x28cb('0x32')]};});_0x2b107f[_0x28cb('0x33')]=_[_0x28cb('0x34')](_0x3e87f2,_0x28cb('0x2b'));_0x2b107f['query']=_[_0x28cb('0x35')](_0x222d99[_0x28cb('0x36')]);_0x2b107f[_0x28cb('0x37')]=_[_0x28cb('0x38')](_0x2b107f[_0x28cb('0x33')],_0x2b107f[_0x28cb('0x36')]);_0x36d1b2[_0x28cb('0x39')]=_[_0x28cb('0x38')](_0x2b107f[_0x28cb('0x33')],qs[_0x28cb('0x3a')](_0x222d99[_0x28cb('0x36')][_0x28cb('0x3a')]));_0x36d1b2[_0x28cb('0x39')]=_0x36d1b2['attributes'][_0x28cb('0x3b')]?_0x36d1b2['attributes']:_0x2b107f[_0x28cb('0x33')];if(!_0x222d99[_0x28cb('0x36')][_0x28cb('0x3c')](_0x28cb('0x3d'))){_0x36d1b2[_0x28cb('0x21')]=qs[_0x28cb('0x21')](_0x222d99[_0x28cb('0x36')][_0x28cb('0x21')]);_0x36d1b2[_0x28cb('0x20')]=qs[_0x28cb('0x20')](_0x222d99[_0x28cb('0x36')][_0x28cb('0x20')]);}_0x36d1b2[_0x28cb('0x3e')]=qs['sort'](_0x222d99[_0x28cb('0x36')][_0x28cb('0x3f')]);_0x36d1b2['where']=qs[_0x28cb('0x37')](_[_0x28cb('0x40')](_0x222d99[_0x28cb('0x36')],_0x2b107f[_0x28cb('0x37')]),_0x3e87f2);if(_0x222d99[_0x28cb('0x36')][_0x28cb('0x41')]){_0x36d1b2[_0x28cb('0x42')]=_['merge'](_0x36d1b2['where'],{'$or':_[_0x28cb('0x34')](_0x3e87f2,function(_0xe33f94){if(_0xe33f94[_0x28cb('0x31')]!==_0x28cb('0x43')){var _0x4b9abe={};_0x4b9abe[_0xe33f94[_0x28cb('0x2b')]]={'$like':'%'+_0x222d99[_0x28cb('0x36')][_0x28cb('0x41')]+'%'};return _0x4b9abe;}})});}_0x36d1b2=_['merge']({},_0x36d1b2,_0x222d99[_0x28cb('0x44')]);var _0x10fdfa={'where':_0x36d1b2[_0x28cb('0x42')]};return db[_0x28cb('0x2e')][_0x28cb('0x1f')](_0x10fdfa)[_0x28cb('0x25')](function(_0x19532a){_0x599242['count']=_0x19532a;if(_0x222d99[_0x28cb('0x36')]['includeAll']){_0x36d1b2[_0x28cb('0x45')]=[{'all':!![]}];}return db[_0x28cb('0x2e')][_0x28cb('0x46')](_0x36d1b2);})[_0x28cb('0x25')](function(_0x5b73ab){_0x599242[_0x28cb('0x47')]=_0x5b73ab;return _0x599242;})[_0x28cb('0x25')](respondWithFilteredResult(_0x33a69e,_0x36d1b2))[_0x28cb('0x48')](handleError(_0x33a69e,null));};exports['show']=function(_0x3128e3,_0xd782d8){var _0x425d85={'raw':!![],'where':{'id':_0x3128e3[_0x28cb('0x49')]['id']}},_0x2dd806={};_0x2dd806['model']=_[_0x28cb('0x35')](db[_0x28cb('0x2e')]['rawAttributes']);_0x2dd806[_0x28cb('0x36')]=_['keys'](_0x3128e3['query']);_0x2dd806['filters']=_['intersection'](_0x2dd806['model'],_0x2dd806[_0x28cb('0x36')]);_0x425d85[_0x28cb('0x39')]=_[_0x28cb('0x38')](_0x2dd806[_0x28cb('0x33')],qs[_0x28cb('0x3a')](_0x3128e3[_0x28cb('0x36')][_0x28cb('0x3a')]));_0x425d85[_0x28cb('0x39')]=_0x425d85[_0x28cb('0x39')][_0x28cb('0x3b')]?_0x425d85[_0x28cb('0x39')]:_0x2dd806['model'];if(_0x3128e3['query']['includeAll']){_0x425d85[_0x28cb('0x45')]=[{'all':!![]}];}_0x425d85=_['merge']({},_0x425d85,_0x3128e3[_0x28cb('0x44')]);return db['FaxQueue'][_0x28cb('0x4a')](_0x425d85)[_0x28cb('0x25')](handleEntityNotFound(_0xd782d8,null))[_0x28cb('0x25')](respondWithResult(_0xd782d8,null))['catch'](handleError(_0xd782d8,null));};exports[_0x28cb('0x4b')]=function(_0x403e05,_0x4c6474){return db[_0x28cb('0x2e')][_0x28cb('0x4b')](_0x403e05[_0x28cb('0x4c')],{})[_0x28cb('0x25')](function(_0x5776fe){var _0xa599e5=_0x403e05[_0x28cb('0x4d')][_0x28cb('0x27')]({'plain':!![]});if(!_0xa599e5)throw new Error(_0x28cb('0x4e'));if(_0xa599e5['role']==='user'){var _0x1d3c0d=_0x5776fe[_0x28cb('0x27')]({'plain':!![]});var _0x2f278c=_0x28cb('0x28');return db[_0x28cb('0x4f')][_0x28cb('0x4a')]({'where':{'name':_0x2f278c,'userProfileId':_0xa599e5[_0x28cb('0x50')]},'raw':!![]})['then'](function(_0x4bfef5){if(_0x4bfef5&&_0x4bfef5[_0x28cb('0x51')]===0x0){return db[_0x28cb('0x52')][_0x28cb('0x4b')]({'name':_0x1d3c0d[_0x28cb('0x2b')],'resourceId':_0x1d3c0d['id'],'type':_0x4bfef5[_0x28cb('0x2b')],'sectionId':_0x4bfef5['id']},{})[_0x28cb('0x25')](function(){return _0x5776fe;});}else{return _0x5776fe;}})[_0x28cb('0x48')](function(_0x594bf3){logger['error'](_0x28cb('0x53'),_0x594bf3);throw _0x594bf3;});}return _0x5776fe;})[_0x28cb('0x25')](respondWithResult(_0x4c6474,0xc9))[_0x28cb('0x48')](handleError(_0x4c6474,null));};exports['update']=function(_0x4c9a53,_0x4e2fba){if(_0x4c9a53[_0x28cb('0x4c')]['id']){delete _0x4c9a53[_0x28cb('0x4c')]['id'];}return db[_0x28cb('0x2e')][_0x28cb('0x4a')]({'where':{'id':_0x4c9a53['params']['id']}})[_0x28cb('0x25')](handleEntityNotFound(_0x4e2fba,null))['then'](saveUpdates(_0x4c9a53[_0x28cb('0x4c')],null))[_0x28cb('0x25')](respondWithResult(_0x4e2fba,null))[_0x28cb('0x48')](handleError(_0x4e2fba,null));};exports['destroy']=function(_0x760b56,_0x53731f){return db[_0x28cb('0x2e')][_0x28cb('0x4a')]({'where':{'id':_0x760b56[_0x28cb('0x49')]['id']}})[_0x28cb('0x25')](handleEntityNotFound(_0x53731f,null))[_0x28cb('0x25')](removeEntity(_0x53731f,null))[_0x28cb('0x48')](handleError(_0x53731f,null));};exports[_0x28cb('0x54')]=function(_0x52fe61,_0x6824b9){return db[_0x28cb('0x2e')][_0x28cb('0x54')]()[_0x28cb('0x25')](respondWithResult(_0x6824b9,null))['catch'](handleError(_0x6824b9,null));};exports['getMembers']=function(_0x33252f,_0x2655f8,_0x505475){var _0x1ec59d={'raw':!![],'where':{}},_0x157cb3={},_0x2aff0d;return db[_0x28cb('0x2e')][_0x28cb('0x55')]({'where':{'id':_0x33252f[_0x28cb('0x49')]['id']}})[_0x28cb('0x25')](handleEntityNotFound(_0x2655f8,null))[_0x28cb('0x25')](function(_0x3c0ba0){if(_0x3c0ba0){_0x2aff0d=_0x3c0ba0['get']({'plain':!![]});_0x157cb3[_0x28cb('0x33')]=_[_0x28cb('0x35')](db[_0x28cb('0x56')]['rawAttributes']);_0x157cb3[_0x28cb('0x36')]=_[_0x28cb('0x35')](_0x33252f[_0x28cb('0x36')]);_0x157cb3['filters']=_[_0x28cb('0x38')](_0x157cb3[_0x28cb('0x33')],_0x157cb3[_0x28cb('0x36')]);_0x1ec59d[_0x28cb('0x39')]=_['intersection'](_0x157cb3[_0x28cb('0x33')],qs['fields'](_0x33252f[_0x28cb('0x36')][_0x28cb('0x3a')]));_0x1ec59d[_0x28cb('0x39')]=_0x1ec59d['attributes']['length']?_0x1ec59d['attributes']:_0x157cb3[_0x28cb('0x33')];if(!_0x33252f['query']['hasOwnProperty'](_0x28cb('0x3d'))){_0x1ec59d[_0x28cb('0x21')]=qs[_0x28cb('0x21')](_0x33252f['query'][_0x28cb('0x21')]);_0x1ec59d[_0x28cb('0x20')]=qs[_0x28cb('0x20')](_0x33252f[_0x28cb('0x36')][_0x28cb('0x20')]);}_0x1ec59d[_0x28cb('0x3e')]=qs[_0x28cb('0x3f')](_0x33252f[_0x28cb('0x36')][_0x28cb('0x3f')]);_0x1ec59d[_0x28cb('0x42')]=qs[_0x28cb('0x37')](_[_0x28cb('0x40')](_0x33252f['query'],_0x157cb3[_0x28cb('0x37')]));_0x1ec59d[_0x28cb('0x42')]['FaxQueueId']=_0x3c0ba0['id'];if(_0x33252f[_0x28cb('0x36')][_0x28cb('0x41')]){_0x1ec59d[_0x28cb('0x42')]=_[_0x28cb('0x57')](_0x1ec59d[_0x28cb('0x42')],{'$or':_[_0x28cb('0x34')](_0x1ec59d[_0x28cb('0x39')],function(_0x21efa9){var _0xf5ed2f={};_0xf5ed2f[_0x21efa9]={'$like':'%'+_0x33252f[_0x28cb('0x36')][_0x28cb('0x41')]+'%'};return _0xf5ed2f;})});}_0x1ec59d=_[_0x28cb('0x57')]({},_0x1ec59d,_0x33252f[_0x28cb('0x44')]);return db[_0x28cb('0x56')][_0x28cb('0x46')](_0x1ec59d);}})['then'](function(_0x341192){if(_0x341192){return db[_0x28cb('0x58')][_0x28cb('0x59')]({'where':{'id':_[_0x28cb('0x34')](_0x341192,'UserId'),'role':_0x28cb('0x5a')},'attributes':['id',_0x28cb('0x2b'),'faxPause','updatedAt','createdAt']});}})[_0x28cb('0x25')](function(_0x4cc846){if(_0x4cc846){return{'count':_0x4cc846[_0x28cb('0x1f')],'rows':_[_0x28cb('0x34')](_0x4cc846[_0x28cb('0x47')],function(_0x528b74){return{'membername':_0x528b74[_0x28cb('0x2b')],'UserId':_0x528b74['id'],'queue_name':_0x2aff0d[_0x28cb('0x2b')],'FaxQueueId':_0x2aff0d['id'],'interface':util[_0x28cb('0x5b')](_0x28cb('0x5c'),_0x28cb('0x5d'),_0x528b74[_0x28cb('0x2b')]),'penalty':0x0,'paused':_0x528b74[_0x28cb('0x5e')],'createdAt':_0x528b74[_0x28cb('0x5f')],'updatedAt':_0x528b74['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2655f8,_0x1ec59d))['catch'](handleError(_0x2655f8,null));};exports['getTeams']=function(_0x4859f3,_0x4f108a,_0x88df20){var _0x106b6e={};var _0x2f10a4={};var _0x34f3ca;var _0x11c9e6;return db[_0x28cb('0x2e')][_0x28cb('0x55')]({'where':{'id':_0x4859f3['params']['id']}})[_0x28cb('0x25')](handleEntityNotFound(_0x4f108a,null))[_0x28cb('0x25')](function(_0x193066){if(_0x193066){_0x34f3ca=_0x193066;_0x2f10a4[_0x28cb('0x33')]=_['keys'](db[_0x28cb('0x60')][_0x28cb('0x2f')]);_0x2f10a4['query']=_[_0x28cb('0x35')](_0x4859f3[_0x28cb('0x36')]);_0x2f10a4['filters']=_['intersection'](_0x2f10a4['model'],_0x2f10a4['query']);_0x106b6e[_0x28cb('0x39')]=_[_0x28cb('0x38')](_0x2f10a4[_0x28cb('0x33')],qs[_0x28cb('0x3a')](_0x4859f3[_0x28cb('0x36')][_0x28cb('0x3a')]));_0x106b6e[_0x28cb('0x39')]=_0x106b6e[_0x28cb('0x39')][_0x28cb('0x3b')]?_0x106b6e[_0x28cb('0x39')]:_0x2f10a4[_0x28cb('0x33')];_0x106b6e[_0x28cb('0x3e')]=qs['sort'](_0x4859f3['query'][_0x28cb('0x3f')]);_0x106b6e[_0x28cb('0x42')]=qs[_0x28cb('0x37')](_[_0x28cb('0x40')](_0x4859f3[_0x28cb('0x36')],_0x2f10a4[_0x28cb('0x37')]));if(_0x4859f3[_0x28cb('0x36')]['filter']){_0x106b6e[_0x28cb('0x42')]=_[_0x28cb('0x57')](_0x106b6e[_0x28cb('0x42')],{'$or':_[_0x28cb('0x34')](_0x106b6e['attributes'],function(_0x4eb051){var _0x643f38={};_0x643f38[_0x4eb051]={'$like':'%'+_0x4859f3[_0x28cb('0x36')]['filter']+'%'};return _0x643f38;})});}_0x106b6e=_[_0x28cb('0x57')]({},_0x106b6e,_0x4859f3[_0x28cb('0x44')]);return _0x34f3ca[_0x28cb('0x61')](_0x106b6e);}})[_0x28cb('0x25')](function(_0x1147fd){if(_0x1147fd){_0x11c9e6=_0x1147fd['length'];if(!_0x4859f3[_0x28cb('0x36')][_0x28cb('0x3c')](_0x28cb('0x3d'))){_0x106b6e[_0x28cb('0x21')]=qs['limit'](_0x4859f3[_0x28cb('0x36')][_0x28cb('0x21')]);_0x106b6e['offset']=qs[_0x28cb('0x20')](_0x4859f3[_0x28cb('0x36')][_0x28cb('0x20')]);}return _0x34f3ca['getTeams'](_0x106b6e);}})['then'](function(_0x541c1b){if(_0x541c1b){return _0x541c1b?{'count':_0x11c9e6,'rows':_0x541c1b}:null;}})[_0x28cb('0x25')](respondWithResult(_0x4f108a,null))['catch'](handleError(_0x4f108a,null));};exports['addTeams']=function(_0x3699e6,_0x4b04a1,_0x43f284){var _0x215c4f=_0x3699e6[_0x28cb('0x4c')]['ids'];return db[_0x28cb('0x60')][_0x28cb('0x46')]({'where':{'id':_0x215c4f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x28cb('0x62'),'attributes':['id','name','online',_0x28cb('0x63'),_0x28cb('0x64')],'raw':!![]}]})['then'](function(_0x11398b){if(_0x11398b){var _0x976aee=_['flatMap'](_0x11398b,function(_0x4cb198){var _0x1c8f22=_0x4cb198['get']({'plain':!![]});return _0x1c8f22['Agents'];});return db[_0x28cb('0x2e')][_0x28cb('0x4a')]({'where':{'id':_0x3699e6[_0x28cb('0x49')]['id']}})[_0x28cb('0x25')](function(_0x26efbb){return db[_0x28cb('0x65')]['transaction'](function(_0x40d3fa){return _0x26efbb[_0x28cb('0x66')](_0x215c4f,{'transaction':_0x40d3fa})['then'](function(){return BPromise['each'](_0x976aee,function(_0x57a991){return db[_0x28cb('0x56')][_0x28cb('0x67')]({'where':{'UserId':_0x57a991['id'],'FaxQueueId':_0x3699e6[_0x28cb('0x49')]['id']},'transaction':_0x40d3fa});});})[_0x28cb('0x25')](function(){_0x976aee[_0x28cb('0x68')](function(_0x25eb02){socket['emit']('userFaxQueue:save',{'UserId':_0x25eb02['id'],'FaxQueueId':_0x26efbb['id']});});});});});}})[_0x28cb('0x25')](respondWithStatusCode(_0x4b04a1,null))[_0x28cb('0x48')](handleError(_0x4b04a1,null));};exports[_0x28cb('0x69')]=function(_0x4ecbfa,_0x81f277,_0x29b1c5){return db['Team'][_0x28cb('0x46')]({'where':{'id':_0x4ecbfa[_0x28cb('0x36')][_0x28cb('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x28cb('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x28cb('0x25')](handleEntityNotFound(_0x81f277,null))[_0x28cb('0x25')](function(_0xe56e9c){var _0xefab44=_[_0x28cb('0x34')](_0xe56e9c,'id');var _0x182b0a=[];var _0x297b3d=[];var _0x145798=squel[_0x28cb('0x6b')]();_0x145798[_0x28cb('0x6c')](_0x28cb('0x6d'))[_0x28cb('0x6e')](_0x28cb('0x6f'),'tq')[_0x28cb('0x70')]('user_has_teams','ut',_0x28cb('0x71'))[_0x28cb('0x42')](_0x28cb('0x72'),_0x4ecbfa[_0x28cb('0x49')]['id']);for(var _0x2936a3=0x0;_0x2936a3<_0xe56e9c[_0x28cb('0x3b')];_0x2936a3+=0x1){let _0x327594=_0xe56e9c[_0x2936a3];for(var _0x507509=0x0;_0x507509<_0x327594[_0x28cb('0x62')][_0x28cb('0x3b')];_0x507509+=0x1){let _0x188152=_0x327594[_0x28cb('0x62')][_0x507509];var _0x3f9ee2=_0x145798[_0x28cb('0x73')]();_0x3f9ee2[_0x28cb('0x42')](_0x28cb('0x74'),_0x188152['id']);_0x297b3d[_0x28cb('0x75')](db[_0x28cb('0x65')][_0x28cb('0x36')](_0x3f9ee2[_0x28cb('0x76')](),{'type':db[_0x28cb('0x65')]['QueryTypes'][_0x28cb('0x77')]})[_0x28cb('0x25')](function(_0x25e139){if(_0x25e139[_0x28cb('0x3b')]===0x1){return _0x188152['id'];}else{var _0x550ce1=_[_0x28cb('0x78')](_[_0x28cb('0x34')](_0x25e139,_0x28cb('0x79')),function(_0x472a52){return _[_0x28cb('0x7a')](_0xefab44,_0x472a52);});if(_0x550ce1){return _0x188152['id'];}}}));}}return BPromise['all'](_0x297b3d)[_0x28cb('0x25')](function(_0x8e98ca){_0x182b0a=_(_0x182b0a)[_0x28cb('0x7b')](_0x8e98ca)['compact']()['value']();return db[_0x28cb('0x2e')][_0x28cb('0x4a')]({'where':{'id':_0x4ecbfa['params']['id']}})[_0x28cb('0x25')](function(_0x226027){return db[_0x28cb('0x65')][_0x28cb('0x7c')](function(_0x2c3622){return _0x226027['removeTeams'](_0x4ecbfa[_0x28cb('0x36')][_0x28cb('0x6a')],{'transaction':_0x2c3622})[_0x28cb('0x25')](function(){if(!_[_0x28cb('0x7d')](_0x182b0a)){return _0x226027[_0x28cb('0x7e')](_0x182b0a,{'transaction':_0x2c3622});}})[_0x28cb('0x25')](function(){_0x182b0a[_0x28cb('0x68')](function(_0x3ead2f){socket['emit'](_0x28cb('0x7f'),{'UserId':_0x3ead2f,'FaxQueueId':_0x226027['id']});});});});});});})['then'](respondWithStatusCode(_0x81f277,null))[_0x28cb('0x48')](handleError(_0x81f277,null));};exports[_0x28cb('0x80')]=function(_0x586ba0,_0x22c402,_0x365e3d){return db[_0x28cb('0x2e')][_0x28cb('0x4a')]({'where':{'id':_0x586ba0[_0x28cb('0x49')]['id']}})[_0x28cb('0x25')](handleEntityNotFound(_0x22c402,null))[_0x28cb('0x25')](function(_0x16edac){if(_0x16edac){return _0x16edac[_0x28cb('0x80')](_0x586ba0[_0x28cb('0x4c')][_0x28cb('0x6a')],_[_0x28cb('0x81')](_0x586ba0[_0x28cb('0x4c')],[_0x28cb('0x6a'),'id'])||{})[_0x28cb('0x82')](function(_0x19c09e){for(var _0x518d97=0x0;_0x518d97<_0x586ba0[_0x28cb('0x4c')][_0x28cb('0x6a')]['length'];_0x518d97+=0x1){socket['emit']('userFaxQueue:save',{'UserId':_0x586ba0['body'][_0x28cb('0x6a')][_0x518d97],'FaxQueueId':_0x586ba0[_0x28cb('0x49')]['id']});}return _0x19c09e;});}})[_0x28cb('0x25')](respondWithResult(_0x22c402,null))[_0x28cb('0x48')](handleError(_0x22c402,null));};exports[_0x28cb('0x7e')]=function(_0x3d0d91,_0x42412e,_0x5103e3){return db['FaxQueue'][_0x28cb('0x4a')]({'where':{'id':_0x3d0d91[_0x28cb('0x49')]['id']}})[_0x28cb('0x25')](handleEntityNotFound(_0x42412e,null))[_0x28cb('0x25')](function(_0x1f7518){if(_0x1f7518){return _0x1f7518['removeAgents'](_0x3d0d91['query'][_0x28cb('0x6a')])[_0x28cb('0x25')](function(){if(_['isArray'](_0x3d0d91['query'][_0x28cb('0x6a')])){for(var _0xdd9f2b=0x0;_0xdd9f2b<_0x3d0d91['query']['ids'][_0x28cb('0x3b')];_0xdd9f2b+=0x1){socket['emit'](_0x28cb('0x7f'),{'UserId':Number(_0x3d0d91[_0x28cb('0x36')][_0x28cb('0x6a')][_0xdd9f2b]),'FaxQueueId':Number(_0x3d0d91[_0x28cb('0x49')]['id'])});}}else{socket[_0x28cb('0x83')](_0x28cb('0x7f'),{'UserId':Number(_0x3d0d91[_0x28cb('0x36')][_0x28cb('0x6a')]),'FaxQueueId':Number(_0x3d0d91[_0x28cb('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x42412e,null))[_0x28cb('0x48')](handleError(_0x42412e,null));};exports[_0x28cb('0x84')]=function(_0x4eb6cd,_0x2ae9d6,_0x48d992){var _0x245b52={};var _0x25671a={};var _0x1904c5;var _0x56c324;return db[_0x28cb('0x2e')][_0x28cb('0x55')]({'where':{'id':_0x4eb6cd[_0x28cb('0x49')]['id']}})[_0x28cb('0x25')](handleEntityNotFound(_0x2ae9d6,null))[_0x28cb('0x25')](function(_0x2f977b){if(_0x2f977b){_0x1904c5=_0x2f977b;_0x25671a[_0x28cb('0x33')]=_[_0x28cb('0x35')](db[_0x28cb('0x58')][_0x28cb('0x2f')]);_0x25671a[_0x28cb('0x36')]=_[_0x28cb('0x35')](_0x4eb6cd[_0x28cb('0x36')]);_0x25671a[_0x28cb('0x37')]=_[_0x28cb('0x38')](_0x25671a[_0x28cb('0x33')],_0x25671a[_0x28cb('0x36')]);_0x245b52[_0x28cb('0x39')]=_['intersection'](_0x25671a['model'],qs[_0x28cb('0x3a')](_0x4eb6cd['query']['fields']));_0x245b52[_0x28cb('0x39')]=_0x245b52['attributes'][_0x28cb('0x3b')]?_0x245b52[_0x28cb('0x39')]:_0x25671a[_0x28cb('0x33')];_0x245b52['order']=qs[_0x28cb('0x3f')](_0x4eb6cd[_0x28cb('0x36')][_0x28cb('0x3f')]);_0x245b52['where']=qs[_0x28cb('0x37')](_['pick'](_0x4eb6cd[_0x28cb('0x36')],_0x25671a[_0x28cb('0x37')]));if(_0x4eb6cd[_0x28cb('0x36')][_0x28cb('0x41')]){_0x245b52[_0x28cb('0x42')]=_[_0x28cb('0x57')](_0x245b52[_0x28cb('0x42')],{'$or':_['map'](_0x245b52[_0x28cb('0x39')],function(_0x25e474){var _0x41cd2d={};_0x41cd2d[_0x25e474]={'$like':'%'+_0x4eb6cd[_0x28cb('0x36')][_0x28cb('0x41')]+'%'};return _0x41cd2d;})});}_0x245b52=_['merge']({},_0x245b52,_0x4eb6cd[_0x28cb('0x44')]);return _0x1904c5[_0x28cb('0x84')](_0x245b52);}})[_0x28cb('0x25')](function(_0x3dc56a){if(_0x3dc56a){_0x56c324=_0x3dc56a['length'];if(!_0x4eb6cd[_0x28cb('0x36')][_0x28cb('0x3c')](_0x28cb('0x3d'))){_0x245b52[_0x28cb('0x21')]=qs['limit'](_0x4eb6cd[_0x28cb('0x36')][_0x28cb('0x21')]);_0x245b52[_0x28cb('0x20')]=qs[_0x28cb('0x20')](_0x4eb6cd['query'][_0x28cb('0x20')]);}return _0x1904c5[_0x28cb('0x84')](_0x245b52);}})['then'](function(_0x3ae7d6){if(_0x3ae7d6){return _0x3ae7d6?{'count':_0x56c324,'rows':_0x3ae7d6}:null;}})[_0x28cb('0x25')](respondWithResult(_0x2ae9d6,null))['catch'](handleError(_0x2ae9d6,null));}; \ No newline at end of file +var _0x6d37=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','FaxQueue','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','each','UserFaxQueue','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','clone','sequelize','toString','TeamId','all','union','value','transaction','ids','removeAgents','userFaxQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x26c094,_0x2b869b){var _0x3645bc=function(_0x2a889e){while(--_0x2a889e){_0x26c094['push'](_0x26c094['shift']());}};_0x3645bc(++_0x2b869b);}(_0x6d37,0x103));var _0x76d3=function(_0x3e8a26,_0x2b2008){_0x3e8a26=_0x3e8a26-0x0;var _0x5e4f4e=_0x6d37[_0x3e8a26];return _0x5e4f4e;};'use strict';var pdf=require(_0x76d3('0x0'));var emlformat=require(_0x76d3('0x1'));var rimraf=require(_0x76d3('0x2'));var zipdir=require(_0x76d3('0x3'));var jsonpatch=require(_0x76d3('0x4'));var rp=require(_0x76d3('0x5'));var moment=require('moment');var BPromise=require(_0x76d3('0x6'));var Mustache=require('mustache');var util=require(_0x76d3('0x7'));var path=require('path');var sox=require(_0x76d3('0x8'));var csv=require(_0x76d3('0x9'));var ejs=require(_0x76d3('0xa'));var fs=require('fs');var _=require(_0x76d3('0xb'));var squel=require('squel');var crypto=require(_0x76d3('0xc'));var jsforce=require(_0x76d3('0xd'));var deskjs=require(_0x76d3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x76d3('0xf'));var Papa=require(_0x76d3('0x10'));var Redis=require(_0x76d3('0x11'));var authService=require(_0x76d3('0x12'));var qs=require(_0x76d3('0x13'));var as=require(_0x76d3('0x14'));var hardwareService=require(_0x76d3('0x15'));var logger=require(_0x76d3('0x16'))(_0x76d3('0x17'));var utils=require(_0x76d3('0x18'));var config=require(_0x76d3('0x19'));var licenseUtil=require(_0x76d3('0x1a'));var db=require(_0x76d3('0x1b'))['db'];config['redis']=_[_0x76d3('0x1c')](config[_0x76d3('0x1d')],{'host':_0x76d3('0x1e'),'port':0x18eb});var socket=require(_0x76d3('0x1f'))(new Redis(config[_0x76d3('0x1d')]));require('./faxQueue.socket')[_0x76d3('0x20')](socket);function respondWithStatusCode(_0x314f74,_0x2f4cc4){_0x2f4cc4=_0x2f4cc4||0xcc;return function(_0x4b1e4a){if(_0x4b1e4a){return _0x314f74[_0x76d3('0x21')](_0x2f4cc4);}return _0x314f74[_0x76d3('0x22')](_0x2f4cc4)[_0x76d3('0x23')]();};}function respondWithResult(_0x3db691,_0x5537f2){_0x5537f2=_0x5537f2||0xc8;return function(_0x26805a){if(_0x26805a){return _0x3db691['status'](_0x5537f2)[_0x76d3('0x24')](_0x26805a);}};}function respondWithFilteredResult(_0x21d611,_0x50c638){return function(_0x1349d7){if(_0x1349d7){var _0x2b8ee5=_0x1349d7[_0x76d3('0x25')],_0x14a7e6=_0x50c638[_0x76d3('0x26')],_0x55fdec=_0x50c638[_0x76d3('0x26')]+_0x50c638[_0x76d3('0x27')],_0x562b2b;if(_0x55fdec>=_0x2b8ee5){_0x55fdec=_0x2b8ee5;_0x562b2b=0xc8;}else{_0x562b2b=0xce;}_0x21d611['status'](_0x562b2b);return _0x21d611[_0x76d3('0x28')]('Content-Range',_0x14a7e6+'-'+_0x55fdec+'/'+_0x2b8ee5)['json'](_0x1349d7);}return null;};}function patchUpdates(_0xf1705a){return function(_0x14e4bb){try{jsonpatch[_0x76d3('0x29')](_0x14e4bb,_0xf1705a,!![]);}catch(_0x1230cc){return BPromise[_0x76d3('0x2a')](_0x1230cc);}return _0x14e4bb[_0x76d3('0x2b')]();};}function saveUpdates(_0x199d53,_0x573ed0){return function(_0x17fa55){if(_0x17fa55){return _0x17fa55[_0x76d3('0x2c')](_0x199d53)[_0x76d3('0x2d')](function(_0x73b34c){return _0x73b34c;});}return null;};}function removeEntity(_0x1950df,_0x4d230c){return function(_0x4ca46e){if(_0x4ca46e){return _0x4ca46e[_0x76d3('0x2e')]()['then'](function(){var _0x23ddbf=_0x4ca46e[_0x76d3('0x2f')]({'plain':!![]});var _0x5beb0a='FaxQueues';return db[_0x76d3('0x30')]['destroy']({'where':{'type':_0x5beb0a,'resourceId':_0x23ddbf['id']}})['then'](function(){return _0x4ca46e;});})['then'](function(){_0x1950df[_0x76d3('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3884b1,_0x5dc097){return function(_0x60ce42){if(!_0x60ce42){_0x3884b1['sendStatus'](0x194);}return _0x60ce42;};}function handleError(_0x1bd335,_0x3ced65){_0x3ced65=_0x3ced65||0x1f4;return function(_0x42a1a6){logger['error'](_0x42a1a6['stack']);if(_0x42a1a6[_0x76d3('0x31')]){delete _0x42a1a6[_0x76d3('0x31')];}_0x1bd335[_0x76d3('0x22')](_0x3ced65)[_0x76d3('0x32')](_0x42a1a6);};}exports[_0x76d3('0x33')]=function(_0x6f1b9d,_0x9a9874){var _0x48acd2={},_0x145e9a={},_0x59300b={'count':0x0,'rows':[]};var _0x5310ab=_['map'](db[_0x76d3('0x34')]['rawAttributes'],function(_0x58243a){return{'name':_0x58243a['fieldName'],'type':_0x58243a[_0x76d3('0x35')][_0x76d3('0x36')]};});_0x145e9a[_0x76d3('0x37')]=_[_0x76d3('0x38')](_0x5310ab,_0x76d3('0x31'));_0x145e9a['query']=_[_0x76d3('0x39')](_0x6f1b9d[_0x76d3('0x3a')]);_0x145e9a[_0x76d3('0x3b')]=_[_0x76d3('0x3c')](_0x145e9a[_0x76d3('0x37')],_0x145e9a[_0x76d3('0x3a')]);_0x48acd2[_0x76d3('0x3d')]=_[_0x76d3('0x3c')](_0x145e9a[_0x76d3('0x37')],qs[_0x76d3('0x3e')](_0x6f1b9d['query'][_0x76d3('0x3e')]));_0x48acd2[_0x76d3('0x3d')]=_0x48acd2[_0x76d3('0x3d')]['length']?_0x48acd2[_0x76d3('0x3d')]:_0x145e9a[_0x76d3('0x37')];if(!_0x6f1b9d[_0x76d3('0x3a')][_0x76d3('0x3f')]('nolimit')){_0x48acd2[_0x76d3('0x27')]=qs[_0x76d3('0x27')](_0x6f1b9d['query']['limit']);_0x48acd2[_0x76d3('0x26')]=qs['offset'](_0x6f1b9d[_0x76d3('0x3a')][_0x76d3('0x26')]);}_0x48acd2[_0x76d3('0x40')]=qs[_0x76d3('0x41')](_0x6f1b9d[_0x76d3('0x3a')][_0x76d3('0x41')]);_0x48acd2[_0x76d3('0x42')]=qs[_0x76d3('0x3b')](_[_0x76d3('0x43')](_0x6f1b9d['query'],_0x145e9a['filters']),_0x5310ab);if(_0x6f1b9d[_0x76d3('0x3a')][_0x76d3('0x44')]){_0x48acd2[_0x76d3('0x42')]=_[_0x76d3('0x45')](_0x48acd2['where'],{'$or':_['map'](_0x5310ab,function(_0x1f5ad8){if(_0x1f5ad8[_0x76d3('0x35')]!==_0x76d3('0x46')){var _0x103b38={};_0x103b38[_0x1f5ad8[_0x76d3('0x31')]]={'$like':'%'+_0x6f1b9d[_0x76d3('0x3a')][_0x76d3('0x44')]+'%'};return _0x103b38;}})});}_0x48acd2=_[_0x76d3('0x45')]({},_0x48acd2,_0x6f1b9d[_0x76d3('0x47')]);var _0x2bf28c={'where':_0x48acd2[_0x76d3('0x42')]};return db[_0x76d3('0x34')]['count'](_0x2bf28c)[_0x76d3('0x2d')](function(_0x1bd56a){_0x59300b['count']=_0x1bd56a;if(_0x6f1b9d[_0x76d3('0x3a')][_0x76d3('0x48')]){_0x48acd2[_0x76d3('0x49')]=[{'all':!![]}];}return db['FaxQueue'][_0x76d3('0x4a')](_0x48acd2);})[_0x76d3('0x2d')](function(_0x30306e){_0x59300b[_0x76d3('0x4b')]=_0x30306e;return _0x59300b;})[_0x76d3('0x2d')](respondWithFilteredResult(_0x9a9874,_0x48acd2))['catch'](handleError(_0x9a9874,null));};exports[_0x76d3('0x4c')]=function(_0x429cb4,_0x25f1a2){var _0xa1489a={'raw':!![],'where':{'id':_0x429cb4[_0x76d3('0x4d')]['id']}},_0x49fce6={};_0x49fce6['model']=_['keys'](db[_0x76d3('0x34')][_0x76d3('0x4e')]);_0x49fce6[_0x76d3('0x3a')]=_[_0x76d3('0x39')](_0x429cb4[_0x76d3('0x3a')]);_0x49fce6['filters']=_[_0x76d3('0x3c')](_0x49fce6[_0x76d3('0x37')],_0x49fce6[_0x76d3('0x3a')]);_0xa1489a['attributes']=_['intersection'](_0x49fce6[_0x76d3('0x37')],qs['fields'](_0x429cb4['query'][_0x76d3('0x3e')]));_0xa1489a['attributes']=_0xa1489a[_0x76d3('0x3d')][_0x76d3('0x4f')]?_0xa1489a[_0x76d3('0x3d')]:_0x49fce6[_0x76d3('0x37')];if(_0x429cb4[_0x76d3('0x3a')][_0x76d3('0x48')]){_0xa1489a[_0x76d3('0x49')]=[{'all':!![]}];}_0xa1489a=_[_0x76d3('0x45')]({},_0xa1489a,_0x429cb4[_0x76d3('0x47')]);return db['FaxQueue'][_0x76d3('0x50')](_0xa1489a)[_0x76d3('0x2d')](handleEntityNotFound(_0x25f1a2,null))[_0x76d3('0x2d')](respondWithResult(_0x25f1a2,null))['catch'](handleError(_0x25f1a2,null));};exports['create']=function(_0xaaa421,_0x32e87a){return db[_0x76d3('0x34')]['create'](_0xaaa421[_0x76d3('0x51')],{})[_0x76d3('0x2d')](function(_0x2c0c14){var _0x492834=_0xaaa421[_0x76d3('0x52')]['get']({'plain':!![]});if(!_0x492834)throw new Error(_0x76d3('0x53'));if(_0x492834[_0x76d3('0x54')]===_0x76d3('0x52')){var _0x4c04a1=_0x2c0c14[_0x76d3('0x2f')]({'plain':!![]});var _0x924fa8=_0x76d3('0x55');return db[_0x76d3('0x56')]['find']({'where':{'name':_0x924fa8,'userProfileId':_0x492834[_0x76d3('0x57')]},'raw':!![]})[_0x76d3('0x2d')](function(_0x43cfc5){if(_0x43cfc5&&_0x43cfc5[_0x76d3('0x58')]===0x0){return db['UserProfileResource'][_0x76d3('0x59')]({'name':_0x4c04a1['name'],'resourceId':_0x4c04a1['id'],'type':_0x43cfc5['name'],'sectionId':_0x43cfc5['id']},{})[_0x76d3('0x2d')](function(){return _0x2c0c14;});}else{return _0x2c0c14;}})[_0x76d3('0x5a')](function(_0xf5fec1){logger[_0x76d3('0x5b')](_0x76d3('0x5c'),_0xf5fec1);throw _0xf5fec1;});}return _0x2c0c14;})[_0x76d3('0x2d')](respondWithResult(_0x32e87a,0xc9))[_0x76d3('0x5a')](handleError(_0x32e87a,null));};exports[_0x76d3('0x2c')]=function(_0x2ad6f7,_0x72ab30){if(_0x2ad6f7['body']['id']){delete _0x2ad6f7[_0x76d3('0x51')]['id'];}return db['FaxQueue'][_0x76d3('0x50')]({'where':{'id':_0x2ad6f7[_0x76d3('0x4d')]['id']}})[_0x76d3('0x2d')](handleEntityNotFound(_0x72ab30,null))[_0x76d3('0x2d')](saveUpdates(_0x2ad6f7[_0x76d3('0x51')],null))[_0x76d3('0x2d')](respondWithResult(_0x72ab30,null))[_0x76d3('0x5a')](handleError(_0x72ab30,null));};exports['destroy']=function(_0x466051,_0x5c6ac1){return db[_0x76d3('0x34')][_0x76d3('0x50')]({'where':{'id':_0x466051[_0x76d3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c6ac1,null))['then'](removeEntity(_0x5c6ac1,null))['catch'](handleError(_0x5c6ac1,null));};exports['describe']=function(_0xeb3572,_0x194cba){return db[_0x76d3('0x34')][_0x76d3('0x5d')]()[_0x76d3('0x2d')](respondWithResult(_0x194cba,null))['catch'](handleError(_0x194cba,null));};exports[_0x76d3('0x5e')]=function(_0x1cb2ee,_0x3c5629,_0x267981){var _0x11ccad={'raw':!![],'where':{}},_0x31bc35={},_0x39c0b4;return db[_0x76d3('0x34')][_0x76d3('0x5f')]({'where':{'id':_0x1cb2ee['params']['id']}})[_0x76d3('0x2d')](handleEntityNotFound(_0x3c5629,null))['then'](function(_0xcd202c){if(_0xcd202c){_0x39c0b4=_0xcd202c[_0x76d3('0x2f')]({'plain':!![]});_0x31bc35[_0x76d3('0x37')]=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x31bc35[_0x76d3('0x3a')]=_[_0x76d3('0x39')](_0x1cb2ee[_0x76d3('0x3a')]);_0x31bc35[_0x76d3('0x3b')]=_['intersection'](_0x31bc35[_0x76d3('0x37')],_0x31bc35[_0x76d3('0x3a')]);_0x11ccad[_0x76d3('0x3d')]=_['intersection'](_0x31bc35[_0x76d3('0x37')],qs[_0x76d3('0x3e')](_0x1cb2ee[_0x76d3('0x3a')]['fields']));_0x11ccad[_0x76d3('0x3d')]=_0x11ccad[_0x76d3('0x3d')][_0x76d3('0x4f')]?_0x11ccad[_0x76d3('0x3d')]:_0x31bc35[_0x76d3('0x37')];if(!_0x1cb2ee[_0x76d3('0x3a')][_0x76d3('0x3f')](_0x76d3('0x60'))){_0x11ccad['limit']=qs['limit'](_0x1cb2ee['query'][_0x76d3('0x27')]);_0x11ccad[_0x76d3('0x26')]=qs[_0x76d3('0x26')](_0x1cb2ee[_0x76d3('0x3a')][_0x76d3('0x26')]);}_0x11ccad['order']=qs[_0x76d3('0x41')](_0x1cb2ee['query'][_0x76d3('0x41')]);_0x11ccad[_0x76d3('0x42')]=qs['filters'](_[_0x76d3('0x43')](_0x1cb2ee[_0x76d3('0x3a')],_0x31bc35[_0x76d3('0x3b')]));_0x11ccad[_0x76d3('0x42')][_0x76d3('0x61')]=_0xcd202c['id'];if(_0x1cb2ee[_0x76d3('0x3a')][_0x76d3('0x44')]){_0x11ccad[_0x76d3('0x42')]=_['merge'](_0x11ccad[_0x76d3('0x42')],{'$or':_[_0x76d3('0x38')](_0x11ccad['attributes'],function(_0x30cc24){var _0x417160={};_0x417160[_0x30cc24]={'$like':'%'+_0x1cb2ee['query'][_0x76d3('0x44')]+'%'};return _0x417160;})});}_0x11ccad=_[_0x76d3('0x45')]({},_0x11ccad,_0x1cb2ee[_0x76d3('0x47')]);return db['UserFaxQueue'][_0x76d3('0x4a')](_0x11ccad);}})[_0x76d3('0x2d')](function(_0x3fdafd){if(_0x3fdafd){return db['User'][_0x76d3('0x62')]({'where':{'id':_[_0x76d3('0x38')](_0x3fdafd,_0x76d3('0x63')),'role':_0x76d3('0x64')},'attributes':['id',_0x76d3('0x31'),_0x76d3('0x65'),_0x76d3('0x66'),'createdAt']});}})['then'](function(_0x43a110){if(_0x43a110){return{'count':_0x43a110['count'],'rows':_['map'](_0x43a110[_0x76d3('0x4b')],function(_0x3a6a5e){return{'membername':_0x3a6a5e[_0x76d3('0x31')],'UserId':_0x3a6a5e['id'],'queue_name':_0x39c0b4[_0x76d3('0x31')],'FaxQueueId':_0x39c0b4['id'],'interface':util[_0x76d3('0x67')](_0x76d3('0x68'),_0x76d3('0x69'),_0x3a6a5e['name']),'penalty':0x0,'paused':_0x3a6a5e['faxPause'],'createdAt':_0x3a6a5e[_0x76d3('0x6a')],'updatedAt':_0x3a6a5e[_0x76d3('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x76d3('0x2d')](respondWithFilteredResult(_0x3c5629,_0x11ccad))[_0x76d3('0x5a')](handleError(_0x3c5629,null));};exports[_0x76d3('0x6b')]=function(_0x4516ce,_0x3295a8,_0x12b90e){var _0x41e3ec={};var _0x5f1f69={};var _0x48b077;var _0x37fb9f;return db['FaxQueue']['findOne']({'where':{'id':_0x4516ce[_0x76d3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3295a8,null))[_0x76d3('0x2d')](function(_0xad579f){if(_0xad579f){_0x48b077=_0xad579f;_0x5f1f69[_0x76d3('0x37')]=_['keys'](db['Team'][_0x76d3('0x4e')]);_0x5f1f69['query']=_['keys'](_0x4516ce[_0x76d3('0x3a')]);_0x5f1f69[_0x76d3('0x3b')]=_[_0x76d3('0x3c')](_0x5f1f69[_0x76d3('0x37')],_0x5f1f69[_0x76d3('0x3a')]);_0x41e3ec[_0x76d3('0x3d')]=_[_0x76d3('0x3c')](_0x5f1f69['model'],qs[_0x76d3('0x3e')](_0x4516ce['query']['fields']));_0x41e3ec[_0x76d3('0x3d')]=_0x41e3ec[_0x76d3('0x3d')]['length']?_0x41e3ec[_0x76d3('0x3d')]:_0x5f1f69[_0x76d3('0x37')];_0x41e3ec[_0x76d3('0x40')]=qs[_0x76d3('0x41')](_0x4516ce[_0x76d3('0x3a')][_0x76d3('0x41')]);_0x41e3ec[_0x76d3('0x42')]=qs['filters'](_[_0x76d3('0x43')](_0x4516ce[_0x76d3('0x3a')],_0x5f1f69[_0x76d3('0x3b')]));if(_0x4516ce[_0x76d3('0x3a')][_0x76d3('0x44')]){_0x41e3ec['where']=_[_0x76d3('0x45')](_0x41e3ec['where'],{'$or':_[_0x76d3('0x38')](_0x41e3ec[_0x76d3('0x3d')],function(_0x5d4549){var _0x329444={};_0x329444[_0x5d4549]={'$like':'%'+_0x4516ce[_0x76d3('0x3a')][_0x76d3('0x44')]+'%'};return _0x329444;})});}_0x41e3ec=_[_0x76d3('0x45')]({},_0x41e3ec,_0x4516ce[_0x76d3('0x47')]);return _0x48b077[_0x76d3('0x6b')](_0x41e3ec);}})['then'](function(_0x1eb218){if(_0x1eb218){_0x37fb9f=_0x1eb218[_0x76d3('0x4f')];if(!_0x4516ce[_0x76d3('0x3a')][_0x76d3('0x3f')]('nolimit')){_0x41e3ec['limit']=qs[_0x76d3('0x27')](_0x4516ce[_0x76d3('0x3a')]['limit']);_0x41e3ec[_0x76d3('0x26')]=qs[_0x76d3('0x26')](_0x4516ce[_0x76d3('0x3a')]['offset']);}return _0x48b077['getTeams'](_0x41e3ec);}})[_0x76d3('0x2d')](function(_0x40d35f){if(_0x40d35f){return _0x40d35f?{'count':_0x37fb9f,'rows':_0x40d35f}:null;}})[_0x76d3('0x2d')](respondWithResult(_0x3295a8,null))[_0x76d3('0x5a')](handleError(_0x3295a8,null));};exports[_0x76d3('0x6c')]=function(_0x217dc0,_0x4e08d9,_0x1aab5c){var _0x25ba7b=_0x217dc0[_0x76d3('0x51')]['ids'];return db[_0x76d3('0x6d')][_0x76d3('0x4a')]({'where':{'id':_0x25ba7b},'attributes':['id'],'include':[{'model':db[_0x76d3('0x6e')],'as':_0x76d3('0x6f'),'attributes':['id',_0x76d3('0x31'),_0x76d3('0x70'),_0x76d3('0x71'),_0x76d3('0x72')],'raw':!![]}]})[_0x76d3('0x2d')](function(_0x492f3d){if(_0x492f3d){var _0x2b22ab=_[_0x76d3('0x73')](_0x492f3d,function(_0x2b0d96){var _0x5c286a=_0x2b0d96[_0x76d3('0x2f')]({'plain':!![]});return _0x5c286a[_0x76d3('0x6f')];});return db[_0x76d3('0x34')]['find']({'where':{'id':_0x217dc0[_0x76d3('0x4d')]['id']}})[_0x76d3('0x2d')](function(_0x2b82ff){return db['sequelize']['transaction'](function(_0x108414){return _0x2b82ff[_0x76d3('0x6c')](_0x25ba7b,{'transaction':_0x108414})['then'](function(){return BPromise[_0x76d3('0x74')](_0x2b22ab,function(_0x4ad246){return db[_0x76d3('0x75')]['findOrCreate']({'where':{'UserId':_0x4ad246['id'],'FaxQueueId':_0x217dc0[_0x76d3('0x4d')]['id']},'transaction':_0x108414});});})[_0x76d3('0x2d')](function(){_0x2b22ab[_0x76d3('0x76')](function(_0x217521){socket[_0x76d3('0x77')](_0x76d3('0x78'),{'UserId':_0x217521['id'],'FaxQueueId':_0x2b82ff['id']});});});});});}})[_0x76d3('0x2d')](respondWithStatusCode(_0x4e08d9,null))[_0x76d3('0x5a')](handleError(_0x4e08d9,null));};exports[_0x76d3('0x79')]=function(_0x138312,_0x1328b2,_0x4d017b){return db[_0x76d3('0x6d')]['findAll']({'where':{'id':_0x138312[_0x76d3('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x76d3('0x6e')],'as':_0x76d3('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x76d3('0x2d')](handleEntityNotFound(_0x1328b2,null))[_0x76d3('0x2d')](function(_0x4433a6){var _0x416db5=_[_0x76d3('0x38')](_0x4433a6,'id');var _0x4e0434=[];var _0x33e745=[];var _0x4a2c00=squel[_0x76d3('0x7a')]();_0x4a2c00[_0x76d3('0x7b')](_0x76d3('0x7c'))[_0x76d3('0x7d')](_0x76d3('0x7e'),'tq')[_0x76d3('0x7f')](_0x76d3('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x138312[_0x76d3('0x4d')]['id']);for(var _0x46a8df=0x0;_0x46a8df<_0x4433a6['length'];_0x46a8df+=0x1){let _0x59273f=_0x4433a6[_0x46a8df];for(var _0x12df1d=0x0;_0x12df1d<_0x59273f['Agents'][_0x76d3('0x4f')];_0x12df1d+=0x1){let _0x2d747d=_0x59273f[_0x76d3('0x6f')][_0x12df1d];var _0x5190c2=_0x4a2c00[_0x76d3('0x81')]();_0x5190c2[_0x76d3('0x42')]('ut.UserId\x20=\x20?',_0x2d747d['id']);_0x33e745['push'](db[_0x76d3('0x82')][_0x76d3('0x3a')](_0x5190c2[_0x76d3('0x83')](),{'type':db[_0x76d3('0x82')]['QueryTypes']['SELECT']})[_0x76d3('0x2d')](function(_0x461b9c){if(_0x461b9c[_0x76d3('0x4f')]===0x1){return _0x2d747d['id'];}else{var _0x485ca1=_['every'](_[_0x76d3('0x38')](_0x461b9c,_0x76d3('0x84')),function(_0x3d4ed8){return _['includes'](_0x416db5,_0x3d4ed8);});if(_0x485ca1){return _0x2d747d['id'];}}}));}}return BPromise[_0x76d3('0x85')](_0x33e745)[_0x76d3('0x2d')](function(_0x167618){_0x4e0434=_(_0x4e0434)[_0x76d3('0x86')](_0x167618)['compact']()[_0x76d3('0x87')]();return db[_0x76d3('0x34')][_0x76d3('0x50')]({'where':{'id':_0x138312['params']['id']}})[_0x76d3('0x2d')](function(_0x3e716f){return db[_0x76d3('0x82')][_0x76d3('0x88')](function(_0x5b327b){return _0x3e716f['removeTeams'](_0x138312[_0x76d3('0x3a')][_0x76d3('0x89')],{'transaction':_0x5b327b})[_0x76d3('0x2d')](function(){if(!_['isEmpty'](_0x4e0434)){return _0x3e716f[_0x76d3('0x8a')](_0x4e0434,{'transaction':_0x5b327b});}})['then'](function(){_0x4e0434['forEach'](function(_0x31968c){socket[_0x76d3('0x77')](_0x76d3('0x8b'),{'UserId':_0x31968c,'FaxQueueId':_0x3e716f['id']});});});});});});})[_0x76d3('0x2d')](respondWithStatusCode(_0x1328b2,null))['catch'](handleError(_0x1328b2,null));};exports[_0x76d3('0x8c')]=function(_0x3af05f,_0x409383,_0x10eb9e){return db['FaxQueue']['find']({'where':{'id':_0x3af05f[_0x76d3('0x4d')]['id']}})[_0x76d3('0x2d')](handleEntityNotFound(_0x409383,null))[_0x76d3('0x2d')](function(_0x2bfe8e){if(_0x2bfe8e){return _0x2bfe8e[_0x76d3('0x8c')](_0x3af05f[_0x76d3('0x51')][_0x76d3('0x89')],_['omit'](_0x3af05f['body'],['ids','id'])||{})[_0x76d3('0x8d')](function(_0x5df92d){for(var _0x190615=0x0;_0x190615<_0x3af05f['body']['ids']['length'];_0x190615+=0x1){socket[_0x76d3('0x77')](_0x76d3('0x78'),{'UserId':_0x3af05f[_0x76d3('0x51')][_0x76d3('0x89')][_0x190615],'FaxQueueId':_0x3af05f['params']['id']});}return _0x5df92d;});}})[_0x76d3('0x2d')](respondWithResult(_0x409383,null))['catch'](handleError(_0x409383,null));};exports[_0x76d3('0x8a')]=function(_0x1b9ae2,_0x2e2a4b,_0x16bbd3){return db['FaxQueue']['find']({'where':{'id':_0x1b9ae2['params']['id']}})[_0x76d3('0x2d')](handleEntityNotFound(_0x2e2a4b,null))[_0x76d3('0x2d')](function(_0x36b362){if(_0x36b362){return _0x36b362[_0x76d3('0x8a')](_0x1b9ae2[_0x76d3('0x3a')][_0x76d3('0x89')])[_0x76d3('0x2d')](function(){if(_['isArray'](_0x1b9ae2[_0x76d3('0x3a')][_0x76d3('0x89')])){for(var _0xef24a6=0x0;_0xef24a6<_0x1b9ae2[_0x76d3('0x3a')][_0x76d3('0x89')]['length'];_0xef24a6+=0x1){socket[_0x76d3('0x77')](_0x76d3('0x8b'),{'UserId':Number(_0x1b9ae2[_0x76d3('0x3a')]['ids'][_0xef24a6]),'FaxQueueId':Number(_0x1b9ae2[_0x76d3('0x4d')]['id'])});}}else{socket['emit'](_0x76d3('0x8b'),{'UserId':Number(_0x1b9ae2['query'][_0x76d3('0x89')]),'FaxQueueId':Number(_0x1b9ae2[_0x76d3('0x4d')]['id'])});}});}})[_0x76d3('0x2d')](respondWithStatusCode(_0x2e2a4b,null))['catch'](handleError(_0x2e2a4b,null));};exports[_0x76d3('0x8e')]=function(_0x7da5c9,_0x1b9c46,_0x4be0a2){var _0x4094f1={};var _0x2d9f84={};var _0x4792cc;var _0x50ec7d;return db[_0x76d3('0x34')]['findOne']({'where':{'id':_0x7da5c9[_0x76d3('0x4d')]['id']}})[_0x76d3('0x2d')](handleEntityNotFound(_0x1b9c46,null))[_0x76d3('0x2d')](function(_0x2d2f9e){if(_0x2d2f9e){_0x4792cc=_0x2d2f9e;_0x2d9f84[_0x76d3('0x37')]=_['keys'](db['User'][_0x76d3('0x4e')]);_0x2d9f84[_0x76d3('0x3a')]=_[_0x76d3('0x39')](_0x7da5c9[_0x76d3('0x3a')]);_0x2d9f84[_0x76d3('0x3b')]=_[_0x76d3('0x3c')](_0x2d9f84['model'],_0x2d9f84['query']);_0x4094f1['attributes']=_['intersection'](_0x2d9f84[_0x76d3('0x37')],qs[_0x76d3('0x3e')](_0x7da5c9[_0x76d3('0x3a')][_0x76d3('0x3e')]));_0x4094f1['attributes']=_0x4094f1[_0x76d3('0x3d')][_0x76d3('0x4f')]?_0x4094f1[_0x76d3('0x3d')]:_0x2d9f84[_0x76d3('0x37')];_0x4094f1['order']=qs[_0x76d3('0x41')](_0x7da5c9[_0x76d3('0x3a')][_0x76d3('0x41')]);_0x4094f1['where']=qs[_0x76d3('0x3b')](_[_0x76d3('0x43')](_0x7da5c9[_0x76d3('0x3a')],_0x2d9f84[_0x76d3('0x3b')]));if(_0x7da5c9[_0x76d3('0x3a')]['filter']){_0x4094f1[_0x76d3('0x42')]=_[_0x76d3('0x45')](_0x4094f1[_0x76d3('0x42')],{'$or':_[_0x76d3('0x38')](_0x4094f1[_0x76d3('0x3d')],function(_0x1b4282){var _0x3c61f6={};_0x3c61f6[_0x1b4282]={'$like':'%'+_0x7da5c9[_0x76d3('0x3a')][_0x76d3('0x44')]+'%'};return _0x3c61f6;})});}_0x4094f1=_['merge']({},_0x4094f1,_0x7da5c9[_0x76d3('0x47')]);return _0x4792cc[_0x76d3('0x8e')](_0x4094f1);}})[_0x76d3('0x2d')](function(_0x2e5e44){if(_0x2e5e44){_0x50ec7d=_0x2e5e44[_0x76d3('0x4f')];if(!_0x7da5c9['query'][_0x76d3('0x3f')](_0x76d3('0x60'))){_0x4094f1[_0x76d3('0x27')]=qs[_0x76d3('0x27')](_0x7da5c9[_0x76d3('0x3a')]['limit']);_0x4094f1[_0x76d3('0x26')]=qs['offset'](_0x7da5c9['query'][_0x76d3('0x26')]);}return _0x4792cc[_0x76d3('0x8e')](_0x4094f1);}})[_0x76d3('0x2d')](function(_0x13e012){if(_0x13e012){return _0x13e012?{'count':_0x50ec7d,'rows':_0x13e012}:null;}})[_0x76d3('0x2d')](respondWithResult(_0x1b9c46,null))[_0x76d3('0x5a')](handleError(_0x1b9c46,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f37e2e8..1d77d59 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 _0xb023=['events','../../mysqldb','setMaxListeners','update','remove','emit','exports'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0xb023,0x1c0));var _0x3b02=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb023[_0x342700];return _0x53406f;};'use strict';var EventEmitter=require(_0x3b02('0x0'));var FaxQueue=require(_0x3b02('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3b02('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b02('0x3'),'afterDestroy':_0x3b02('0x4')};function emitEvent(_0x29f0eb){return function(_0x4334dd,_0x488481,_0x40644a){FaxQueueEvents[_0x3b02('0x5')](_0x29f0eb+':'+_0x4334dd['id'],_0x4334dd);FaxQueueEvents[_0x3b02('0x5')](_0x29f0eb,_0x4334dd);_0x40644a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x3b02('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x9d1a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0xcbe787,_0x401e4c){var _0x4c78fa=function(_0x392922){while(--_0x392922){_0xcbe787['push'](_0xcbe787['shift']());}};_0x4c78fa(++_0x401e4c);}(_0x9d1a,0x1bc));var _0xa9d1=function(_0x4289ed,_0x2c7b8f){_0x4289ed=_0x4289ed-0x0;var _0x2f5317=_0x9d1a[_0x4289ed];return _0x2f5317;};'use strict';var EventEmitter=require(_0xa9d1('0x0'));var FaxQueue=require(_0xa9d1('0x1'))['db'][_0xa9d1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa9d1('0x3')](0x0);var events={'afterCreate':_0xa9d1('0x4'),'afterUpdate':_0xa9d1('0x5'),'afterDestroy':_0xa9d1('0x6')};function emitEvent(_0x5ca88d){return function(_0x4578e0,_0x10273e,_0x501f49){FaxQueueEvents['emit'](_0x5ca88d+':'+_0x4578e0['id'],_0x4578e0);FaxQueueEvents[_0xa9d1('0x7')](_0x5ca88d,_0x4578e0);_0x501f49(null);};}for(var e in events){if(events[_0xa9d1('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xa9d1('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7b47228..c64045e 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 _0xfdda=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x131945,_0x30a569){var _0x2a9b41=function(_0x337419){while(--_0x337419){_0x131945['push'](_0x131945['shift']());}};_0x2a9b41(++_0x30a569);}(_0xfdda,0x18b));var _0xafdd=function(_0x2f421,_0x5144c4){_0x2f421=_0x2f421-0x0;var _0x27b4af=_0xfdda[_0x2f421];return _0x27b4af;};'use strict';var _=require(_0xafdd('0x0'));var util=require('util');var logger=require(_0xafdd('0x1'))(_0xafdd('0x2'));var moment=require(_0xafdd('0x3'));var BPromise=require(_0xafdd('0x4'));var rp=require(_0xafdd('0x5'));var fs=require('fs');var path=require(_0xafdd('0x6'));var rimraf=require(_0xafdd('0x7'));var config=require('../../config/environment');var attributes=require(_0xafdd('0x8'));module[_0xafdd('0x9')]=function(_0xe3ca84,_0x1f7113){return _0xe3ca84[_0xafdd('0xa')](_0xafdd('0xb'),attributes,{'tableName':_0xafdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee3d=['rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3c29a7,_0x339bf1){var _0x5cffd9=function(_0x4a70f0){while(--_0x4a70f0){_0x3c29a7['push'](_0x3c29a7['shift']());}};_0x5cffd9(++_0x339bf1);}(_0xee3d,0x158));var _0xdee3=function(_0x3eb2e4,_0x51c0ab){_0x3eb2e4=_0x3eb2e4-0x0;var _0x675970=_0xee3d[_0x3eb2e4];return _0x675970;};'use strict';var _=require(_0xdee3('0x0'));var util=require(_0xdee3('0x1'));var logger=require(_0xdee3('0x2'))(_0xdee3('0x3'));var moment=require(_0xdee3('0x4'));var BPromise=require(_0xdee3('0x5'));var rp=require(_0xdee3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdee3('0x7'));var config=require(_0xdee3('0x8'));var attributes=require(_0xdee3('0x9'));module['exports']=function(_0x396b07,_0x1123a6){return _0x396b07[_0xdee3('0xa')](_0xdee3('0xb'),attributes,{'tableName':_0xdee3('0xc'),'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 f7f94df..21c2999 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 _0x4d8c=['attributes','include','map','model','ShowFaxQueue','FaxQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','then','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','info','result','catch','GetFaxQueue','findAll','options','raw'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x4d8c,0x7c));var _0xc4d8=function(_0x19f9ce,_0x53750e){_0x19f9ce=_0x19f9ce-0x0;var _0x437e89=_0x4d8c[_0x19f9ce];return _0x437e89;};'use strict';var _=require('lodash');var util=require(_0xc4d8('0x0'));var moment=require(_0xc4d8('0x1'));var BPromise=require(_0xc4d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4d8('0x3'));var db=require(_0xc4d8('0x4'))['db'];var utils=require(_0xc4d8('0x5'));var logger=require(_0xc4d8('0x6'))(_0xc4d8('0x7'));var config=require(_0xc4d8('0x8'));var jayson=require(_0xc4d8('0x9'));var client=jayson[_0xc4d8('0xa')][_0xc4d8('0xb')]({'port':0x232a});config['redis']=_[_0xc4d8('0xc')](config[_0xc4d8('0xd')],{'host':_0xc4d8('0xe'),'port':0x18eb});var socket=require(_0xc4d8('0xf'))(new Redis(config[_0xc4d8('0xd')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4c2adb,_0xc15e1a,_0x30f414){return new BPromise(function(_0x23f1f2,_0x446398){return client['request'](_0x4c2adb,_0x30f414)[_0xc4d8('0x10')](function(_0x45556b){logger['info']('FaxQueue,\x20%s,\x20%s',_0xc15e1a,'request\x20sent');logger[_0xc4d8('0x11')](_0xc4d8('0x12'),_0xc15e1a,_0xc4d8('0x13'),JSON[_0xc4d8('0x14')](_0x45556b));if(_0x45556b[_0xc4d8('0x15')]){if(_0x45556b[_0xc4d8('0x15')][_0xc4d8('0x16')]===0x1f4){logger['error'](_0xc4d8('0x17'),_0xc15e1a,_0x45556b[_0xc4d8('0x15')][_0xc4d8('0x18')]);return _0x446398(_0x45556b[_0xc4d8('0x15')]['message']);}logger[_0xc4d8('0x15')]('FaxQueue,\x20%s,\x20%s',_0xc15e1a,_0x45556b[_0xc4d8('0x15')][_0xc4d8('0x18')]);return _0x23f1f2(_0x45556b['error'][_0xc4d8('0x18')]);}else{logger[_0xc4d8('0x19')](_0xc4d8('0x17'),_0xc15e1a,_0xc4d8('0x13'));_0x23f1f2(_0x45556b[_0xc4d8('0x1a')]['message']);}})[_0xc4d8('0x1b')](function(_0x845bd0){logger[_0xc4d8('0x15')]('FaxQueue,\x20%s,\x20%s',_0xc15e1a,_0x845bd0);_0x446398(_0x845bd0);});});}exports[_0xc4d8('0x1c')]=function(_0x1f1464){var _0x8b2598=this;return new Promise(function(_0x122ef8,_0x5e54f8){return db['FaxQueue'][_0xc4d8('0x1d')]({'raw':_0x1f1464['options']?_0x1f1464[_0xc4d8('0x1e')][_0xc4d8('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f1464['options']?_0x1f1464[_0xc4d8('0x1e')]['where']||null:null,'attributes':_0x1f1464['options']?_0x1f1464[_0xc4d8('0x1e')][_0xc4d8('0x20')]||null:null,'limit':_0x1f1464[_0xc4d8('0x1e')]?_0x1f1464[_0xc4d8('0x1e')]['limit']||null:null,'include':_0x1f1464[_0xc4d8('0x1e')]?_0x1f1464[_0xc4d8('0x1e')][_0xc4d8('0x21')]?_[_0xc4d8('0x22')](_0x1f1464[_0xc4d8('0x1e')][_0xc4d8('0x21')],function(_0x401172){return{'model':db[_0x401172['model']],'as':_0x401172['as'],'attributes':_0x401172[_0xc4d8('0x20')],'include':_0x401172[_0xc4d8('0x21')]?_[_0xc4d8('0x22')](_0x401172[_0xc4d8('0x21')],function(_0x21c87d){return{'model':db[_0x21c87d[_0xc4d8('0x23')]],'as':_0x21c87d['as'],'attributes':_0x21c87d[_0xc4d8('0x20')],'include':_0x21c87d[_0xc4d8('0x21')]?_[_0xc4d8('0x22')](_0x21c87d[_0xc4d8('0x21')],function(_0x59b039){return{'model':db[_0x59b039[_0xc4d8('0x23')]],'as':_0x59b039['as'],'attributes':_0x59b039[_0xc4d8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc4d8('0x10')](function(_0xe9d3f0){logger['info'](_0xc4d8('0x1c'),_0x1f1464);logger[_0xc4d8('0x11')]('GetFaxQueue',_0x1f1464,JSON[_0xc4d8('0x14')](_0xe9d3f0));_0x122ef8(_0xe9d3f0);})[_0xc4d8('0x1b')](function(_0x36fc7c){logger[_0xc4d8('0x15')](_0xc4d8('0x1c'),_0x36fc7c[_0xc4d8('0x18')],_0x1f1464);_0x5e54f8(_0x8b2598[_0xc4d8('0x15')](0x1f4,_0x36fc7c[_0xc4d8('0x18')]));});});};exports[_0xc4d8('0x24')]=function(_0x2f8cb4){var _0x19c524=this;return new Promise(function(_0x559a4e,_0x36c981){return db[_0xc4d8('0x25')][_0xc4d8('0x26')]({'raw':_0x2f8cb4[_0xc4d8('0x1e')]?_0x2f8cb4[_0xc4d8('0x1e')][_0xc4d8('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f8cb4[_0xc4d8('0x1e')]?_0x2f8cb4[_0xc4d8('0x1e')]['where']||null:null,'attributes':_0x2f8cb4[_0xc4d8('0x1e')]?_0x2f8cb4[_0xc4d8('0x1e')][_0xc4d8('0x20')]||null:null,'include':_0x2f8cb4[_0xc4d8('0x1e')]?_0x2f8cb4[_0xc4d8('0x1e')]['include']?_[_0xc4d8('0x22')](_0x2f8cb4['options'][_0xc4d8('0x21')],function(_0x46fa9c){return{'model':db[_0x46fa9c[_0xc4d8('0x23')]],'as':_0x46fa9c['as'],'attributes':_0x46fa9c[_0xc4d8('0x20')],'include':_0x46fa9c['include']?_[_0xc4d8('0x22')](_0x46fa9c[_0xc4d8('0x21')],function(_0x3f7794){return{'model':db[_0x3f7794[_0xc4d8('0x23')]],'as':_0x3f7794['as'],'attributes':_0x3f7794[_0xc4d8('0x20')],'include':_0x3f7794[_0xc4d8('0x21')]?_['map'](_0x3f7794[_0xc4d8('0x21')],function(_0x43b9e5){return{'model':db[_0x43b9e5['model']],'as':_0x43b9e5['as'],'attributes':_0x43b9e5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4d8('0x10')](function(_0x145077){logger[_0xc4d8('0x19')](_0xc4d8('0x24'),_0x2f8cb4);logger['debug'](_0xc4d8('0x24'),_0x2f8cb4,JSON[_0xc4d8('0x14')](_0x145077));_0x559a4e(_0x145077);})[_0xc4d8('0x1b')](function(_0x484bc5){logger[_0xc4d8('0x15')](_0xc4d8('0x24'),_0x484bc5[_0xc4d8('0x18')],_0x2f8cb4);_0x36c981(_0x19c524[_0xc4d8('0x15')](0x1f4,_0x484bc5[_0xc4d8('0x18')]));});});}; \ No newline at end of file +var _0x0834=['FaxQueue','find','where','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','findAll','options','raw','attributes','limit','map','include','model','then','info','ShowFaxQueue'];(function(_0x19271e,_0x333a48){var _0x3b1454=function(_0x31717d){while(--_0x31717d){_0x19271e['push'](_0x19271e['shift']());}};_0x3b1454(++_0x333a48);}(_0x0834,0x1b0));var _0x4083=function(_0x1552f8,_0x1aac52){_0x1552f8=_0x1552f8-0x0;var _0x19146b=_0x0834[_0x1552f8];return _0x19146b;};'use strict';var _=require(_0x4083('0x0'));var util=require(_0x4083('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4083('0x2'));var fs=require('fs');var Redis=require(_0x4083('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x4'));var logger=require(_0x4083('0x5'))(_0x4083('0x6'));var config=require(_0x4083('0x7'));var jayson=require(_0x4083('0x8'));var client=jayson[_0x4083('0x9')]['http']({'port':0x232a});config[_0x4083('0xa')]=_['defaults'](config[_0x4083('0xa')],{'host':_0x4083('0xb'),'port':0x18eb});var socket=require(_0x4083('0xc'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x4083('0xd')](socket);function respondWithRpcPromise(_0x50b3e8,_0x1ac8a7,_0x1a977b){return new BPromise(function(_0x3bb812,_0x2d1d3d){return client['request'](_0x50b3e8,_0x1a977b)['then'](function(_0xe7a9ae){logger['info'](_0x4083('0xe'),_0x1ac8a7,_0x4083('0xf'));logger[_0x4083('0x10')](_0x4083('0x11'),_0x1ac8a7,_0x4083('0xf'),JSON[_0x4083('0x12')](_0xe7a9ae));if(_0xe7a9ae['error']){if(_0xe7a9ae[_0x4083('0x13')][_0x4083('0x14')]===0x1f4){logger['error'](_0x4083('0xe'),_0x1ac8a7,_0xe7a9ae[_0x4083('0x13')][_0x4083('0x15')]);return _0x2d1d3d(_0xe7a9ae[_0x4083('0x13')][_0x4083('0x15')]);}logger[_0x4083('0x13')](_0x4083('0xe'),_0x1ac8a7,_0xe7a9ae[_0x4083('0x13')][_0x4083('0x15')]);return _0x3bb812(_0xe7a9ae[_0x4083('0x13')]['message']);}else{logger['info'](_0x4083('0xe'),_0x1ac8a7,'request\x20sent');_0x3bb812(_0xe7a9ae[_0x4083('0x16')][_0x4083('0x15')]);}})[_0x4083('0x17')](function(_0x5d3fde){logger['error'](_0x4083('0xe'),_0x1ac8a7,_0x5d3fde);_0x2d1d3d(_0x5d3fde);});});}exports[_0x4083('0x18')]=function(_0xa29c38){var _0x15aed8=this;return new Promise(function(_0x8bc091,_0x131fa9){return db['FaxQueue'][_0x4083('0x19')]({'raw':_0xa29c38[_0x4083('0x1a')]?_0xa29c38[_0x4083('0x1a')][_0x4083('0x1b')]===undefined?!![]:![]:!![],'where':_0xa29c38[_0x4083('0x1a')]?_0xa29c38['options']['where']||null:null,'attributes':_0xa29c38['options']?_0xa29c38[_0x4083('0x1a')][_0x4083('0x1c')]||null:null,'limit':_0xa29c38[_0x4083('0x1a')]?_0xa29c38[_0x4083('0x1a')][_0x4083('0x1d')]||null:null,'include':_0xa29c38[_0x4083('0x1a')]?_0xa29c38[_0x4083('0x1a')]['include']?_[_0x4083('0x1e')](_0xa29c38[_0x4083('0x1a')][_0x4083('0x1f')],function(_0x23dc0f){return{'model':db[_0x23dc0f[_0x4083('0x20')]],'as':_0x23dc0f['as'],'attributes':_0x23dc0f[_0x4083('0x1c')],'include':_0x23dc0f['include']?_[_0x4083('0x1e')](_0x23dc0f[_0x4083('0x1f')],function(_0x1fd3bc){return{'model':db[_0x1fd3bc[_0x4083('0x20')]],'as':_0x1fd3bc['as'],'attributes':_0x1fd3bc[_0x4083('0x1c')],'include':_0x1fd3bc[_0x4083('0x1f')]?_[_0x4083('0x1e')](_0x1fd3bc[_0x4083('0x1f')],function(_0x37e287){return{'model':db[_0x37e287[_0x4083('0x20')]],'as':_0x37e287['as'],'attributes':_0x37e287[_0x4083('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4083('0x21')](function(_0x5ac2a7){logger[_0x4083('0x22')](_0x4083('0x18'),_0xa29c38);logger[_0x4083('0x10')](_0x4083('0x18'),_0xa29c38,JSON[_0x4083('0x12')](_0x5ac2a7));_0x8bc091(_0x5ac2a7);})[_0x4083('0x17')](function(_0x289e2e){logger[_0x4083('0x13')](_0x4083('0x18'),_0x289e2e[_0x4083('0x15')],_0xa29c38);_0x131fa9(_0x15aed8['error'](0x1f4,_0x289e2e[_0x4083('0x15')]));});});};exports[_0x4083('0x23')]=function(_0x2abd53){var _0x492134=this;return new Promise(function(_0x6de7c4,_0x203014){return db[_0x4083('0x24')][_0x4083('0x25')]({'raw':_0x2abd53[_0x4083('0x1a')]?_0x2abd53['options'][_0x4083('0x1b')]===undefined?!![]:![]:!![],'where':_0x2abd53[_0x4083('0x1a')]?_0x2abd53['options'][_0x4083('0x26')]||null:null,'attributes':_0x2abd53[_0x4083('0x1a')]?_0x2abd53['options'][_0x4083('0x1c')]||null:null,'include':_0x2abd53[_0x4083('0x1a')]?_0x2abd53[_0x4083('0x1a')][_0x4083('0x1f')]?_['map'](_0x2abd53[_0x4083('0x1a')][_0x4083('0x1f')],function(_0x3481f3){return{'model':db[_0x3481f3[_0x4083('0x20')]],'as':_0x3481f3['as'],'attributes':_0x3481f3[_0x4083('0x1c')],'include':_0x3481f3[_0x4083('0x1f')]?_[_0x4083('0x1e')](_0x3481f3[_0x4083('0x1f')],function(_0x1b22fb){return{'model':db[_0x1b22fb[_0x4083('0x20')]],'as':_0x1b22fb['as'],'attributes':_0x1b22fb[_0x4083('0x1c')],'include':_0x1b22fb['include']?_[_0x4083('0x1e')](_0x1b22fb[_0x4083('0x1f')],function(_0x22d308){return{'model':db[_0x22d308[_0x4083('0x20')]],'as':_0x22d308['as'],'attributes':_0x22d308[_0x4083('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1645e4){logger[_0x4083('0x22')](_0x4083('0x23'),_0x2abd53);logger['debug']('ShowFaxQueue',_0x2abd53,JSON['stringify'](_0x1645e4));_0x6de7c4(_0x1645e4);})[_0x4083('0x17')](function(_0x26971f){logger[_0x4083('0x13')](_0x4083('0x23'),_0x26971f[_0x4083('0x15')],_0x2abd53);_0x203014(_0x492134[_0x4083('0x13')](0x1f4,_0x26971f[_0x4083('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index cd75545..2313a16 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 _0x57e1=['register','./faxQueue.events','remove','update','emit','removeListener'];(function(_0x196548,_0x5b2a5e){var _0x13ee3e=function(_0x54093a){while(--_0x54093a){_0x196548['push'](_0x196548['shift']());}};_0x13ee3e(++_0x5b2a5e);}(_0x57e1,0x121));var _0x157e=function(_0x453536,_0x46622b){_0x453536=_0x453536-0x0;var _0x252fb0=_0x57e1[_0x453536];return _0x252fb0;};'use strict';var FaxQueueEvents=require(_0x157e('0x0'));var events=['save',_0x157e('0x1'),_0x157e('0x2')];function createListener(_0x839f1b,_0x391005){return function(_0x1a13f0){_0x391005[_0x157e('0x3')](_0x839f1b,_0x1a13f0);};}function removeListener(_0x51050a,_0x5f262a){return function(){FaxQueueEvents[_0x157e('0x4')](_0x51050a,_0x5f262a);};}exports[_0x157e('0x5')]=function(_0x41bffd){for(var _0x4d2bdf=0x0,_0x4a1afa=events['length'];_0x4d2bdf<_0x4a1afa;_0x4d2bdf++){var _0x13e746=events[_0x4d2bdf];var _0x1de319=createListener('faxQueue:'+_0x13e746,_0x41bffd);FaxQueueEvents['on'](_0x13e746,_0x1de319);}}; \ No newline at end of file +var _0x99c3=['register','length','faxQueue:','update','emit','removeListener'];(function(_0x295ea9,_0x19d658){var _0x59a3fe=function(_0x35be54){while(--_0x35be54){_0x295ea9['push'](_0x295ea9['shift']());}};_0x59a3fe(++_0x19d658);}(_0x99c3,0x1dd));var _0x399c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x99c3[_0x8c43de];return _0xa6591b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0x399c('0x0')];function createListener(_0x294e3f,_0x5be890){return function(_0x3fcd88){_0x5be890[_0x399c('0x1')](_0x294e3f,_0x3fcd88);};}function removeListener(_0x207121,_0x186bee){return function(){FaxQueueEvents[_0x399c('0x2')](_0x207121,_0x186bee);};}exports[_0x399c('0x3')]=function(_0x28a90f){for(var _0x1c1ced=0x0,_0x509cd4=events[_0x399c('0x4')];_0x1c1ced<_0x509cd4;_0x1c1ced++){var _0xeb7f46=events[_0x1c1ced];var _0x4c8025=createListener(_0x399c('0x5')+_0xeb7f46,_0x28a90f);FaxQueueEvents['on'](_0xeb7f46,_0x4c8025);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1913288..56ebe1e 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x1cfda3,_0x32e81){var _0x45a82f=function(_0x19078e){while(--_0x19078e){_0x1cfda3['push'](_0x1cfda3['shift']());}};_0x45a82f(++_0x32e81);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0x0b0e,0x187));var _0xe0b0=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0x0b0e[_0x36436d];return _0x34615d;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 769387b..4a21006 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 _0xcced=['STRING','DATE','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcced,0x1e5));var _0xdcce=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0xcced[_0x3ceb54];return _0x26d8a6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xdcce('0x0')]={'uniqueid':{'type':Sequelize[_0xdcce('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xdcce('0x1')]},'joinAt':{'type':Sequelize[_0xdcce('0x2')]},'leaveAt':{'type':Sequelize[_0xdcce('0x2')]},'acceptAt':{'type':Sequelize[_0xdcce('0x2')]},'exitAt':{'type':Sequelize[_0xdcce('0x2')]},'reason':{'type':Sequelize[_0xdcce('0x1')]}}; \ No newline at end of file +var _0x40f2=['moment','sequelize','exports','STRING','DATE'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x40f2,0xff));var _0x240f=function(_0x405d75,_0x4d42ef){_0x405d75=_0x405d75-0x0;var _0x3292f0=_0x40f2[_0x405d75];return _0x3292f0;};'use strict';var moment=require(_0x240f('0x0'));var Sequelize=require(_0x240f('0x1'));module[_0x240f('0x2')]={'uniqueid':{'type':Sequelize[_0x240f('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x240f('0x4')]},'leaveAt':{'type':Sequelize[_0x240f('0x4')]},'acceptAt':{'type':Sequelize[_0x240f('0x4')]},'exitAt':{'type':Sequelize[_0x240f('0x4')]},'reason':{'type':Sequelize[_0x240f('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9f578cb..5949442 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 _0xf351=['where','VIRTUAL','filter','merge','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','FaxQueueReport','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x555e35,_0x205cc1){var _0x35b56a=function(_0x469cb4){while(--_0x469cb4){_0x555e35['push'](_0x555e35['shift']());}};_0x35b56a(++_0x205cc1);}(_0xf351,0x9c));var _0x1f35=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xf351[_0xcfd89f];return _0x59acd4;};'use strict';var pdf=require(_0x1f35('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f35('0x1'));var rp=require(_0x1f35('0x2'));var moment=require(_0x1f35('0x3'));var BPromise=require(_0x1f35('0x4'));var Mustache=require(_0x1f35('0x5'));var util=require(_0x1f35('0x6'));var path=require(_0x1f35('0x7'));var sox=require('sox');var csv=require(_0x1f35('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1f35('0x9'));var crypto=require(_0x1f35('0xa'));var jsforce=require(_0x1f35('0xb'));var deskjs=require(_0x1f35('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1f35('0xd'));var Papa=require('papaparse');var Redis=require(_0x1f35('0xe'));var authService=require(_0x1f35('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1f35('0x10'));var hardwareService=require(_0x1f35('0x11'));var logger=require(_0x1f35('0x12'))(_0x1f35('0x13'));var utils=require(_0x1f35('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1f35('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca2cb,_0x14d5dd){_0x14d5dd=_0x14d5dd||0xcc;return function(_0x472a97){if(_0x472a97){return _0x2ca2cb['sendStatus'](_0x14d5dd);}return _0x2ca2cb[_0x1f35('0x16')](_0x14d5dd)['end']();};}function respondWithResult(_0xc5e9b8,_0x57c69e){_0x57c69e=_0x57c69e||0xc8;return function(_0x1318c7){if(_0x1318c7){return _0xc5e9b8[_0x1f35('0x16')](_0x57c69e)['json'](_0x1318c7);}};}function respondWithFilteredResult(_0x12c650,_0x375d45){return function(_0x51c16c){if(_0x51c16c){var _0x51e563=_0x51c16c['count'],_0x5ac2ed=_0x375d45[_0x1f35('0x17')],_0x361488=_0x375d45[_0x1f35('0x17')]+_0x375d45[_0x1f35('0x18')],_0x412c50;if(_0x361488>=_0x51e563){_0x361488=_0x51e563;_0x412c50=0xc8;}else{_0x412c50=0xce;}_0x12c650['status'](_0x412c50);return _0x12c650[_0x1f35('0x19')](_0x1f35('0x1a'),_0x5ac2ed+'-'+_0x361488+'/'+_0x51e563)['json'](_0x51c16c);}return null;};}function patchUpdates(_0x539fe6){return function(_0x560ab1){try{jsonpatch[_0x1f35('0x1b')](_0x560ab1,_0x539fe6,!![]);}catch(_0x3cec83){return BPromise['reject'](_0x3cec83);}return _0x560ab1['save']();};}function saveUpdates(_0xd77343,_0x3ba638){return function(_0x1659ee){if(_0x1659ee){return _0x1659ee[_0x1f35('0x1c')](_0xd77343)[_0x1f35('0x1d')](function(_0x283ade){return _0x283ade;});}return null;};}function removeEntity(_0x52e1e1,_0x233246){return function(_0x4eed20){if(_0x4eed20){return _0x4eed20[_0x1f35('0x1e')]()[_0x1f35('0x1d')](function(){_0x52e1e1['status'](0xcc)[_0x1f35('0x1f')]();});}};}function handleEntityNotFound(_0x51fdac,_0x28639a){return function(_0x224f91){if(!_0x224f91){_0x51fdac['sendStatus'](0x194);}return _0x224f91;};}function handleError(_0x1741b6,_0x17d030){_0x17d030=_0x17d030||0x1f4;return function(_0x4a2e29){logger[_0x1f35('0x20')](_0x4a2e29[_0x1f35('0x21')]);if(_0x4a2e29['name']){delete _0x4a2e29[_0x1f35('0x22')];}_0x1741b6['status'](_0x17d030)[_0x1f35('0x23')](_0x4a2e29);};}exports[_0x1f35('0x24')]=function(_0x5123a8,_0x17ce5f){var _0x33c473={},_0x4fac96={},_0x4d78ab={'count':0x0,'rows':[]};var _0x4948a1=_[_0x1f35('0x25')](db[_0x1f35('0x26')]['rawAttributes'],function(_0x3006d4){return{'name':_0x3006d4['fieldName'],'type':_0x3006d4[_0x1f35('0x27')][_0x1f35('0x28')]};});_0x4fac96[_0x1f35('0x29')]=_[_0x1f35('0x25')](_0x4948a1,_0x1f35('0x22'));_0x4fac96[_0x1f35('0x2a')]=_['keys'](_0x5123a8[_0x1f35('0x2a')]);_0x4fac96[_0x1f35('0x2b')]=_[_0x1f35('0x2c')](_0x4fac96['model'],_0x4fac96[_0x1f35('0x2a')]);_0x33c473[_0x1f35('0x2d')]=_['intersection'](_0x4fac96[_0x1f35('0x29')],qs[_0x1f35('0x2e')](_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x2e')]));_0x33c473['attributes']=_0x33c473[_0x1f35('0x2d')][_0x1f35('0x2f')]?_0x33c473['attributes']:_0x4fac96[_0x1f35('0x29')];if(!_0x5123a8[_0x1f35('0x2a')]['hasOwnProperty'](_0x1f35('0x30'))){_0x33c473[_0x1f35('0x18')]=qs[_0x1f35('0x18')](_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x18')]);_0x33c473['offset']=qs[_0x1f35('0x17')](_0x5123a8[_0x1f35('0x2a')]['offset']);}_0x33c473[_0x1f35('0x31')]=qs[_0x1f35('0x32')](_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x32')]);_0x33c473[_0x1f35('0x33')]=qs[_0x1f35('0x2b')](_['pick'](_0x5123a8['query'],_0x4fac96[_0x1f35('0x2b')]),_0x4948a1);if(_0x5123a8[_0x1f35('0x2a')]['filter']){_0x33c473[_0x1f35('0x33')]=_['merge'](_0x33c473[_0x1f35('0x33')],{'$or':_[_0x1f35('0x25')](_0x4948a1,function(_0x1cc6ca){if(_0x1cc6ca[_0x1f35('0x27')]!==_0x1f35('0x34')){var _0x5e8b0a={};_0x5e8b0a[_0x1cc6ca[_0x1f35('0x22')]]={'$like':'%'+_0x5123a8['query'][_0x1f35('0x35')]+'%'};return _0x5e8b0a;}})});}_0x33c473=_[_0x1f35('0x36')]({},_0x33c473,_0x5123a8['options']);var _0x5d6576={'where':_0x33c473[_0x1f35('0x33')]};return db[_0x1f35('0x26')][_0x1f35('0x37')](_0x5d6576)['then'](function(_0x338fae){_0x4d78ab[_0x1f35('0x37')]=_0x338fae;if(_0x5123a8[_0x1f35('0x2a')][_0x1f35('0x38')]){_0x33c473[_0x1f35('0x39')]=[{'all':!![]}];}return db[_0x1f35('0x26')][_0x1f35('0x3a')](_0x33c473);})[_0x1f35('0x1d')](function(_0x45ab90){_0x4d78ab[_0x1f35('0x3b')]=_0x45ab90;return _0x4d78ab;})['then'](respondWithFilteredResult(_0x17ce5f,_0x33c473))[_0x1f35('0x3c')](handleError(_0x17ce5f,null));};exports['show']=function(_0x40c07f,_0x33e9cb){var _0x122664={'raw':!![],'where':{'id':_0x40c07f[_0x1f35('0x3d')]['id']}},_0x837b13={};_0x837b13[_0x1f35('0x29')]=_[_0x1f35('0x3e')](db[_0x1f35('0x26')][_0x1f35('0x3f')]);_0x837b13['query']=_['keys'](_0x40c07f[_0x1f35('0x2a')]);_0x837b13[_0x1f35('0x2b')]=_['intersection'](_0x837b13[_0x1f35('0x29')],_0x837b13['query']);_0x122664[_0x1f35('0x2d')]=_[_0x1f35('0x2c')](_0x837b13['model'],qs[_0x1f35('0x2e')](_0x40c07f['query'][_0x1f35('0x2e')]));_0x122664['attributes']=_0x122664[_0x1f35('0x2d')]['length']?_0x122664['attributes']:_0x837b13[_0x1f35('0x29')];if(_0x40c07f[_0x1f35('0x2a')][_0x1f35('0x38')]){_0x122664['include']=[{'all':!![]}];}_0x122664=_[_0x1f35('0x36')]({},_0x122664,_0x40c07f[_0x1f35('0x40')]);return db[_0x1f35('0x26')]['find'](_0x122664)[_0x1f35('0x1d')](handleEntityNotFound(_0x33e9cb,null))['then'](respondWithResult(_0x33e9cb,null))[_0x1f35('0x3c')](handleError(_0x33e9cb,null));};exports[_0x1f35('0x41')]=function(_0x4d06bd,_0x51aeb5){return db[_0x1f35('0x26')][_0x1f35('0x41')](_0x4d06bd['body'],{})[_0x1f35('0x1d')](respondWithResult(_0x51aeb5,0xc9))[_0x1f35('0x3c')](handleError(_0x51aeb5,null));};exports[_0x1f35('0x1c')]=function(_0x169b26,_0x1def1f){if(_0x169b26[_0x1f35('0x42')]['id']){delete _0x169b26['body']['id'];}return db[_0x1f35('0x26')][_0x1f35('0x43')]({'where':{'id':_0x169b26[_0x1f35('0x3d')]['id']}})[_0x1f35('0x1d')](handleEntityNotFound(_0x1def1f,null))[_0x1f35('0x1d')](saveUpdates(_0x169b26[_0x1f35('0x42')],null))[_0x1f35('0x1d')](respondWithResult(_0x1def1f,null))['catch'](handleError(_0x1def1f,null));};exports[_0x1f35('0x1e')]=function(_0x25a0b6,_0x2f2d31){return db[_0x1f35('0x26')][_0x1f35('0x43')]({'where':{'id':_0x25a0b6['params']['id']}})[_0x1f35('0x1d')](handleEntityNotFound(_0x2f2d31,null))[_0x1f35('0x1d')](removeEntity(_0x2f2d31,null))[_0x1f35('0x3c')](handleError(_0x2f2d31,null));};exports[_0x1f35('0x44')]=function(_0x4a988b,_0x3ca7b7){return db[_0x1f35('0x26')][_0x1f35('0x44')]()[_0x1f35('0x1d')](respondWithResult(_0x3ca7b7,null))[_0x1f35('0x3c')](handleError(_0x3ca7b7,null));}; \ No newline at end of file +var _0x04f2=['sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','status','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','FaxQueueReport','includeAll','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x04f2,0xcc));var _0x204f=function(_0x5a654d,_0x1da2db){_0x5a654d=_0x5a654d-0x0;var _0x1c5f97=_0x04f2[_0x5a654d];return _0x1c5f97;};'use strict';var pdf=require(_0x204f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x204f('0x1'));var jsonpatch=require(_0x204f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x204f('0x3'));var Mustache=require(_0x204f('0x4'));var util=require('util');var path=require(_0x204f('0x5'));var sox=require(_0x204f('0x6'));var csv=require(_0x204f('0x7'));var ejs=require(_0x204f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x204f('0x9'));var crypto=require(_0x204f('0xa'));var jsforce=require(_0x204f('0xb'));var deskjs=require(_0x204f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x204f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x204f('0xe'));var as=require(_0x204f('0xf'));var hardwareService=require(_0x204f('0x10'));var logger=require(_0x204f('0x11'))('api');var utils=require(_0x204f('0x12'));var config=require(_0x204f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e201f,_0x6cf028){_0x6cf028=_0x6cf028||0xcc;return function(_0x162beb){if(_0x162beb){return _0x4e201f[_0x204f('0x14')](_0x6cf028);}return _0x4e201f['status'](_0x6cf028)[_0x204f('0x15')]();};}function respondWithResult(_0x422927,_0x41f1b9){_0x41f1b9=_0x41f1b9||0xc8;return function(_0x5290f7){if(_0x5290f7){return _0x422927['status'](_0x41f1b9)[_0x204f('0x16')](_0x5290f7);}};}function respondWithFilteredResult(_0x563016,_0x5d1408){return function(_0x34db4b){if(_0x34db4b){var _0x4d556d=_0x34db4b[_0x204f('0x17')],_0xb7b939=_0x5d1408[_0x204f('0x18')],_0xa5a692=_0x5d1408[_0x204f('0x18')]+_0x5d1408[_0x204f('0x19')],_0x28add4;if(_0xa5a692>=_0x4d556d){_0xa5a692=_0x4d556d;_0x28add4=0xc8;}else{_0x28add4=0xce;}_0x563016['status'](_0x28add4);return _0x563016[_0x204f('0x1a')](_0x204f('0x1b'),_0xb7b939+'-'+_0xa5a692+'/'+_0x4d556d)['json'](_0x34db4b);}return null;};}function patchUpdates(_0x183791){return function(_0x51395c){try{jsonpatch[_0x204f('0x1c')](_0x51395c,_0x183791,!![]);}catch(_0x3df379){return BPromise[_0x204f('0x1d')](_0x3df379);}return _0x51395c['save']();};}function saveUpdates(_0x17b68a,_0x121f73){return function(_0x352f55){if(_0x352f55){return _0x352f55[_0x204f('0x1e')](_0x17b68a)['then'](function(_0x28b1d3){return _0x28b1d3;});}return null;};}function removeEntity(_0x4d0c4e,_0x5a5eb6){return function(_0x1ca56a){if(_0x1ca56a){return _0x1ca56a[_0x204f('0x1f')]()[_0x204f('0x20')](function(){_0x4d0c4e[_0x204f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598ce3,_0x29d226){return function(_0x39a9ea){if(!_0x39a9ea){_0x598ce3[_0x204f('0x14')](0x194);}return _0x39a9ea;};}function handleError(_0x4bc2af,_0x1c48d8){_0x1c48d8=_0x1c48d8||0x1f4;return function(_0x3623d4){logger[_0x204f('0x22')](_0x3623d4[_0x204f('0x23')]);if(_0x3623d4[_0x204f('0x24')]){delete _0x3623d4[_0x204f('0x24')];}_0x4bc2af['status'](_0x1c48d8)[_0x204f('0x25')](_0x3623d4);};}exports['index']=function(_0x59b98a,_0x18ba6c){var _0x5950d3={},_0x5b5e5b={},_0x4b2c47={'count':0x0,'rows':[]};var _0x19c281=_[_0x204f('0x26')](db['FaxQueueReport'][_0x204f('0x27')],function(_0x1701b4){return{'name':_0x1701b4[_0x204f('0x28')],'type':_0x1701b4[_0x204f('0x29')]['key']};});_0x5b5e5b[_0x204f('0x2a')]=_['map'](_0x19c281,'name');_0x5b5e5b['query']=_[_0x204f('0x2b')](_0x59b98a[_0x204f('0x2c')]);_0x5b5e5b[_0x204f('0x2d')]=_[_0x204f('0x2e')](_0x5b5e5b['model'],_0x5b5e5b[_0x204f('0x2c')]);_0x5950d3[_0x204f('0x2f')]=_[_0x204f('0x2e')](_0x5b5e5b['model'],qs[_0x204f('0x30')](_0x59b98a[_0x204f('0x2c')]['fields']));_0x5950d3[_0x204f('0x2f')]=_0x5950d3[_0x204f('0x2f')][_0x204f('0x31')]?_0x5950d3[_0x204f('0x2f')]:_0x5b5e5b[_0x204f('0x2a')];if(!_0x59b98a['query']['hasOwnProperty'](_0x204f('0x32'))){_0x5950d3[_0x204f('0x19')]=qs[_0x204f('0x19')](_0x59b98a[_0x204f('0x2c')][_0x204f('0x19')]);_0x5950d3['offset']=qs[_0x204f('0x18')](_0x59b98a['query']['offset']);}_0x5950d3[_0x204f('0x33')]=qs[_0x204f('0x34')](_0x59b98a[_0x204f('0x2c')][_0x204f('0x34')]);_0x5950d3['where']=qs[_0x204f('0x2d')](_[_0x204f('0x35')](_0x59b98a[_0x204f('0x2c')],_0x5b5e5b[_0x204f('0x2d')]),_0x19c281);if(_0x59b98a['query'][_0x204f('0x36')]){_0x5950d3[_0x204f('0x37')]=_['merge'](_0x5950d3['where'],{'$or':_[_0x204f('0x26')](_0x19c281,function(_0x5ef9c7){if(_0x5ef9c7['type']!==_0x204f('0x38')){var _0x23747a={};_0x23747a[_0x5ef9c7[_0x204f('0x24')]]={'$like':'%'+_0x59b98a[_0x204f('0x2c')][_0x204f('0x36')]+'%'};return _0x23747a;}})});}_0x5950d3=_[_0x204f('0x39')]({},_0x5950d3,_0x59b98a[_0x204f('0x3a')]);var _0x4bf544={'where':_0x5950d3[_0x204f('0x37')]};return db[_0x204f('0x3b')][_0x204f('0x17')](_0x4bf544)[_0x204f('0x20')](function(_0x2c82cb){_0x4b2c47['count']=_0x2c82cb;if(_0x59b98a['query'][_0x204f('0x3c')]){_0x5950d3['include']=[{'all':!![]}];}return db[_0x204f('0x3b')][_0x204f('0x3d')](_0x5950d3);})['then'](function(_0x12b830){_0x4b2c47[_0x204f('0x3e')]=_0x12b830;return _0x4b2c47;})[_0x204f('0x20')](respondWithFilteredResult(_0x18ba6c,_0x5950d3))[_0x204f('0x3f')](handleError(_0x18ba6c,null));};exports[_0x204f('0x40')]=function(_0x1da552,_0x5454c3){var _0x439ac2={'raw':!![],'where':{'id':_0x1da552[_0x204f('0x41')]['id']}},_0x5353ef={};_0x5353ef['model']=_[_0x204f('0x2b')](db[_0x204f('0x3b')][_0x204f('0x27')]);_0x5353ef[_0x204f('0x2c')]=_[_0x204f('0x2b')](_0x1da552['query']);_0x5353ef['filters']=_[_0x204f('0x2e')](_0x5353ef[_0x204f('0x2a')],_0x5353ef[_0x204f('0x2c')]);_0x439ac2[_0x204f('0x2f')]=_[_0x204f('0x2e')](_0x5353ef[_0x204f('0x2a')],qs['fields'](_0x1da552[_0x204f('0x2c')][_0x204f('0x30')]));_0x439ac2[_0x204f('0x2f')]=_0x439ac2[_0x204f('0x2f')][_0x204f('0x31')]?_0x439ac2['attributes']:_0x5353ef[_0x204f('0x2a')];if(_0x1da552[_0x204f('0x2c')][_0x204f('0x3c')]){_0x439ac2['include']=[{'all':!![]}];}_0x439ac2=_[_0x204f('0x39')]({},_0x439ac2,_0x1da552[_0x204f('0x3a')]);return db['FaxQueueReport'][_0x204f('0x42')](_0x439ac2)['then'](handleEntityNotFound(_0x5454c3,null))[_0x204f('0x20')](respondWithResult(_0x5454c3,null))['catch'](handleError(_0x5454c3,null));};exports[_0x204f('0x43')]=function(_0x4f4c83,_0x139c8f){return db[_0x204f('0x3b')][_0x204f('0x43')](_0x4f4c83[_0x204f('0x44')],{})[_0x204f('0x20')](respondWithResult(_0x139c8f,0xc9))['catch'](handleError(_0x139c8f,null));};exports['update']=function(_0x3e210b,_0x3f4082){if(_0x3e210b[_0x204f('0x44')]['id']){delete _0x3e210b[_0x204f('0x44')]['id'];}return db[_0x204f('0x3b')]['find']({'where':{'id':_0x3e210b[_0x204f('0x41')]['id']}})[_0x204f('0x20')](handleEntityNotFound(_0x3f4082,null))[_0x204f('0x20')](saveUpdates(_0x3e210b['body'],null))[_0x204f('0x20')](respondWithResult(_0x3f4082,null))['catch'](handleError(_0x3f4082,null));};exports['destroy']=function(_0x22d16f,_0x21b7d6){return db['FaxQueueReport'][_0x204f('0x42')]({'where':{'id':_0x22d16f[_0x204f('0x41')]['id']}})[_0x204f('0x20')](handleEntityNotFound(_0x21b7d6,null))[_0x204f('0x20')](removeEntity(_0x21b7d6,null))['catch'](handleError(_0x21b7d6,null));};exports[_0x204f('0x45')]=function(_0xc366c3,_0x336ec9){return db[_0x204f('0x3b')][_0x204f('0x45')]()[_0x204f('0x20')](respondWithResult(_0x336ec9,null))[_0x204f('0x3f')](handleError(_0x336ec9,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b543245..88a52d9 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 _0x681b=['../../config/environment','exports','define','FaxQueueReport','report_fax_queue','uniqueid','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x3e143a,_0x558381){var _0x1e0a0e=function(_0x19115d){while(--_0x19115d){_0x3e143a['push'](_0x3e143a['shift']());}};_0x1e0a0e(++_0x558381);}(_0x681b,0x16e));var _0xb681=function(_0x315f1a,_0x323780){_0x315f1a=_0x315f1a-0x0;var _0x5dc556=_0x681b[_0x315f1a];return _0x5dc556;};'use strict';var _=require('lodash');var util=require(_0xb681('0x0'));var logger=require(_0xb681('0x1'))(_0xb681('0x2'));var moment=require(_0xb681('0x3'));var BPromise=require('bluebird');var rp=require(_0xb681('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb681('0x5'));var config=require(_0xb681('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0xb681('0x7')]=function(_0x77ad82,_0x2aa21b){return _0x77ad82[_0xb681('0x8')](_0xb681('0x9'),attributes,{'tableName':_0xb681('0xa'),'paranoid':![],'indexes':[{'name':_0xb681('0xb'),'fields':[_0xb681('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56da=['FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./faxQueueReport.attributes','define'];(function(_0x48df45,_0x49d7cd){var _0x3b679d=function(_0xf23f75){while(--_0xf23f75){_0x48df45['push'](_0x48df45['shift']());}};_0x3b679d(++_0x49d7cd);}(_0x56da,0x18f));var _0xa56d=function(_0x1dd2cc,_0x36ddfe){_0x1dd2cc=_0x1dd2cc-0x0;var _0x305d8e=_0x56da[_0x1dd2cc];return _0x305d8e;};'use strict';var _=require(_0xa56d('0x0'));var util=require('util');var logger=require(_0xa56d('0x1'))(_0xa56d('0x2'));var moment=require('moment');var BPromise=require(_0xa56d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa56d('0x4'));var config=require(_0xa56d('0x5'));var attributes=require(_0xa56d('0x6'));module['exports']=function(_0xffe71f,_0x3c160d){return _0xffe71f[_0xa56d('0x7')](_0xa56d('0x8'),attributes,{'tableName':_0xa56d('0x9'),'paranoid':![],'indexes':[{'name':_0xa56d('0xa'),'fields':[_0xa56d('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 c3348bb..7ac0ab8 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 _0x89c2=['error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','create','body','options','raw','update','where','limit','UpdateFaxQueueReport','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','debug','request\x20sent','stringify'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x89c2,0x183));var _0x289c=function(_0x3f239c,_0xe0e257){_0x3f239c=_0x3f239c-0x0;var _0x39242a=_0x89c2[_0x3f239c];return _0x39242a;};'use strict';var _=require(_0x289c('0x0'));var util=require('util');var moment=require(_0x289c('0x1'));var BPromise=require(_0x289c('0x2'));var rs=require(_0x289c('0x3'));var fs=require('fs');var Redis=require(_0x289c('0x4'));var db=require(_0x289c('0x5'))['db'];var utils=require(_0x289c('0x6'));var logger=require('../../config/logger')(_0x289c('0x7'));var config=require('../../config/environment');var jayson=require(_0x289c('0x8'));var client=jayson[_0x289c('0x9')][_0x289c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24bda1,_0x31ea2d,_0x253851){return new BPromise(function(_0x166e1e,_0x18c948){return client['request'](_0x24bda1,_0x253851)[_0x289c('0xb')](function(_0x39deda){logger[_0x289c('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x31ea2d,'request\x20sent');logger[_0x289c('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x31ea2d,_0x289c('0xe'),JSON[_0x289c('0xf')](_0x39deda));if(_0x39deda[_0x289c('0x10')]){if(_0x39deda['error'][_0x289c('0x11')]===0x1f4){logger[_0x289c('0x10')](_0x289c('0x12'),_0x31ea2d,_0x39deda[_0x289c('0x10')][_0x289c('0x13')]);return _0x18c948(_0x39deda[_0x289c('0x10')][_0x289c('0x13')]);}logger['error'](_0x289c('0x12'),_0x31ea2d,_0x39deda[_0x289c('0x10')][_0x289c('0x13')]);return _0x166e1e(_0x39deda['error'][_0x289c('0x13')]);}else{logger[_0x289c('0xc')](_0x289c('0x12'),_0x31ea2d,_0x289c('0xe'));_0x166e1e(_0x39deda[_0x289c('0x14')][_0x289c('0x13')]);}})['catch'](function(_0xe76129){logger[_0x289c('0x10')](_0x289c('0x12'),_0x31ea2d,_0xe76129);_0x18c948(_0xe76129);});});}exports[_0x289c('0x15')]=function(_0x13b743){var _0x37ea88=this;return new Promise(function(_0xb146c7,_0x5d0c46){return db['FaxQueueReport'][_0x289c('0x16')](_0x13b743[_0x289c('0x17')],{'raw':_0x13b743[_0x289c('0x18')]?_0x13b743['options'][_0x289c('0x19')]===undefined?!![]:![]:!![]})[_0x289c('0xb')](function(_0x13c93b){logger[_0x289c('0xc')](_0x289c('0x15'),_0x13b743);logger[_0x289c('0xd')](_0x289c('0x15'),_0x13b743,JSON['stringify'](_0x13c93b));_0xb146c7(_0x13c93b);})['catch'](function(_0x3b56e5){logger[_0x289c('0x10')]('CreateFaxQueueReport',_0x3b56e5[_0x289c('0x13')],_0x13b743);_0x5d0c46(_0x37ea88['error'](0x1f4,_0x3b56e5[_0x289c('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x4bb891){var _0x13ff24=this;return new Promise(function(_0x4e84f4,_0x4c9a1e){return db['FaxQueueReport'][_0x289c('0x1a')](_0x4bb891['body'],{'raw':_0x4bb891['options']?_0x4bb891['options'][_0x289c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb891['options']?_0x4bb891[_0x289c('0x18')][_0x289c('0x1b')]||null:null,'attributes':_0x4bb891['options']?_0x4bb891[_0x289c('0x18')]['attributes']||null:null,'limit':_0x4bb891[_0x289c('0x18')]?_0x4bb891[_0x289c('0x18')][_0x289c('0x1c')]||null:null})[_0x289c('0xb')](function(_0x3b0dd3){logger[_0x289c('0xc')](_0x289c('0x1d'),_0x4bb891);logger['debug'](_0x289c('0x1d'),_0x4bb891,JSON[_0x289c('0xf')](_0x3b0dd3));_0x4e84f4(_0x3b0dd3);})[_0x289c('0x1e')](function(_0x438a02){logger[_0x289c('0x10')](_0x289c('0x1d'),_0x438a02[_0x289c('0x13')],_0x4bb891);_0x4c9a1e(_0x13ff24['error'](0x1f4,_0x438a02[_0x289c('0x13')]));});});}; \ No newline at end of file +var _0x8480=['create','body','options','raw','then','info','stringify','where','attributes','limit','UpdateFaxQueueReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport'];(function(_0x1852c6,_0x47ecba){var _0x4ac378=function(_0x370540){while(--_0x370540){_0x1852c6['push'](_0x1852c6['shift']());}};_0x4ac378(++_0x47ecba);}(_0x8480,0x1b8));var _0x0848=function(_0xce4045,_0x44cfea){_0xce4045=_0xce4045-0x0;var _0x1337c1=_0x8480[_0xce4045];return _0x1337c1;};'use strict';var _=require('lodash');var util=require(_0x0848('0x0'));var moment=require(_0x0848('0x1'));var BPromise=require(_0x0848('0x2'));var rs=require(_0x0848('0x3'));var fs=require('fs');var Redis=require(_0x0848('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0848('0x5'));var logger=require(_0x0848('0x6'))(_0x0848('0x7'));var config=require('../../config/environment');var jayson=require(_0x0848('0x8'));var client=jayson[_0x0848('0x9')][_0x0848('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2323d6,_0x279595,_0x16cdb1){return new BPromise(function(_0x4d6c85,_0x13fc7e){return client[_0x0848('0xb')](_0x2323d6,_0x16cdb1)['then'](function(_0x33a34d){logger['info'](_0x0848('0xc'),_0x279595,_0x0848('0xd'));logger[_0x0848('0xe')](_0x0848('0xf'),_0x279595,_0x0848('0xd'),JSON['stringify'](_0x33a34d));if(_0x33a34d[_0x0848('0x10')]){if(_0x33a34d[_0x0848('0x10')][_0x0848('0x11')]===0x1f4){logger[_0x0848('0x10')](_0x0848('0xc'),_0x279595,_0x33a34d['error'][_0x0848('0x12')]);return _0x13fc7e(_0x33a34d[_0x0848('0x10')]['message']);}logger[_0x0848('0x10')](_0x0848('0xc'),_0x279595,_0x33a34d[_0x0848('0x10')][_0x0848('0x12')]);return _0x4d6c85(_0x33a34d[_0x0848('0x10')][_0x0848('0x12')]);}else{logger['info'](_0x0848('0xc'),_0x279595,_0x0848('0xd'));_0x4d6c85(_0x33a34d[_0x0848('0x13')][_0x0848('0x12')]);}})[_0x0848('0x14')](function(_0x36820a){logger[_0x0848('0x10')](_0x0848('0xc'),_0x279595,_0x36820a);_0x13fc7e(_0x36820a);});});}exports[_0x0848('0x15')]=function(_0x48a428){var _0x232995=this;return new Promise(function(_0x2ff199,_0x5bd0fc){return db['FaxQueueReport'][_0x0848('0x16')](_0x48a428[_0x0848('0x17')],{'raw':_0x48a428[_0x0848('0x18')]?_0x48a428[_0x0848('0x18')][_0x0848('0x19')]===undefined?!![]:![]:!![]})[_0x0848('0x1a')](function(_0x2968b4){logger[_0x0848('0x1b')](_0x0848('0x15'),_0x48a428);logger[_0x0848('0xe')](_0x0848('0x15'),_0x48a428,JSON[_0x0848('0x1c')](_0x2968b4));_0x2ff199(_0x2968b4);})[_0x0848('0x14')](function(_0x2013d6){logger[_0x0848('0x10')](_0x0848('0x15'),_0x2013d6['message'],_0x48a428);_0x5bd0fc(_0x232995['error'](0x1f4,_0x2013d6[_0x0848('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x2c09f5){var _0x42411d=this;return new Promise(function(_0x150f45,_0x4cfa67){return db['FaxQueueReport']['update'](_0x2c09f5[_0x0848('0x17')],{'raw':_0x2c09f5['options']?_0x2c09f5[_0x0848('0x18')][_0x0848('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c09f5[_0x0848('0x18')]?_0x2c09f5['options'][_0x0848('0x1d')]||null:null,'attributes':_0x2c09f5[_0x0848('0x18')]?_0x2c09f5['options'][_0x0848('0x1e')]||null:null,'limit':_0x2c09f5['options']?_0x2c09f5[_0x0848('0x18')][_0x0848('0x1f')]||null:null})['then'](function(_0x58197c){logger['info'](_0x0848('0x20'),_0x2c09f5);logger['debug'](_0x0848('0x20'),_0x2c09f5,JSON['stringify'](_0x58197c));_0x150f45(_0x58197c);})['catch'](function(_0x363b1){logger[_0x0848('0x10')](_0x0848('0x20'),_0x363b1['message'],_0x2c09f5);_0x4cfa67(_0x42411d[_0x0848('0x10')](0x1f4,_0x363b1[_0x0848('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ab5af7e..12da3a0 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 _0x8610=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x1c3719,_0x1de64f){var _0x567b6d=function(_0x2931e2){while(--_0x2931e2){_0x1c3719['push'](_0x1c3719['shift']());}};_0x567b6d(++_0x1de64f);}(_0x8610,0x1d8));var _0x0861=function(_0xb3d2e2,_0x182ce2){_0xb3d2e2=_0xb3d2e2-0x0;var _0x53c851=_0x8610[_0xb3d2e2];return _0x53c851;};'use strict';var multer=require(_0x0861('0x0'));var util=require('util');var path=require(_0x0861('0x1'));var timeout=require(_0x0861('0x2'));var express=require(_0x0861('0x3'));var router=express[_0x0861('0x4')]();var auth=require(_0x0861('0x5'));var interaction=require(_0x0861('0x6'));var config=require(_0x0861('0x7'));var controller=require(_0x0861('0x8'));router[_0x0861('0x9')]('/',auth[_0x0861('0xa')](),controller['index']);router['get'](_0x0861('0xb'),auth[_0x0861('0xa')](),controller[_0x0861('0xc')]);router[_0x0861('0x9')](_0x0861('0xd'),auth['isAuthenticated'](),controller[_0x0861('0xe')]);router[_0x0861('0xf')]('/',auth['isAuthenticated'](),controller[_0x0861('0x10')]);router[_0x0861('0x11')](_0x0861('0xd'),auth['isAuthenticated'](),controller[_0x0861('0x12')]);router[_0x0861('0x13')]('/:id',auth[_0x0861('0xa')](),controller[_0x0861('0x14')]);module[_0x0861('0x15')]=router; \ No newline at end of file +var _0x2c76=['get','index','/describe','isAuthenticated','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller'];(function(_0xc03ee0,_0xd2d0aa){var _0x35b54c=function(_0x1ae266){while(--_0x1ae266){_0xc03ee0['push'](_0xc03ee0['shift']());}};_0x35b54c(++_0xd2d0aa);}(_0x2c76,0x128));var _0x62c7=function(_0x8db571,_0x35c59c){_0x8db571=_0x8db571-0x0;var _0x1747eb=_0x2c76[_0x8db571];return _0x1747eb;};'use strict';var multer=require('multer');var util=require(_0x62c7('0x0'));var path=require(_0x62c7('0x1'));var timeout=require(_0x62c7('0x2'));var express=require(_0x62c7('0x3'));var router=express[_0x62c7('0x4')]();var auth=require(_0x62c7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62c7('0x6'));var controller=require(_0x62c7('0x7'));router[_0x62c7('0x8')]('/',auth['isAuthenticated'](),controller[_0x62c7('0x9')]);router[_0x62c7('0x8')](_0x62c7('0xa'),auth[_0x62c7('0xb')](),controller['describe']);router['get'](_0x62c7('0xc'),auth[_0x62c7('0xb')](),controller[_0x62c7('0xd')]);router['post']('/',auth[_0x62c7('0xb')](),controller[_0x62c7('0xe')]);router[_0x62c7('0xf')]('/:id',auth[_0x62c7('0xb')](),controller[_0x62c7('0x10')]);router[_0x62c7('0x11')]('/:id',auth[_0x62c7('0xb')](),controller['destroy']);module[_0x62c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c2a8d72..7063a69 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 _0x2383=['agent','queue','DATE','moment','sequelize','ENUM','account'];(function(_0x825d19,_0x4fe030){var _0x2e7502=function(_0x2f23d6){while(--_0x2f23d6){_0x825d19['push'](_0x825d19['shift']());}};_0x2e7502(++_0x4fe030);}(_0x2383,0x137));var _0x3238=function(_0x58cadd,_0x378124){_0x58cadd=_0x58cadd-0x0;var _0x13bc17=_0x2383[_0x58cadd];return _0x13bc17;};'use strict';var moment=require(_0x3238('0x0'));var Sequelize=require(_0x3238('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3238('0x2')](_0x3238('0x3'),_0x3238('0x4'),'queue'),'allowNull':![],'defaultValue':_0x3238('0x5')},'transferredAt':{'type':Sequelize[_0x3238('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3482=['exports','account','agent','queue','DATE','moment','sequelize'];(function(_0x279cb9,_0x567a3e){var _0x276581=function(_0x5cbb2d){while(--_0x5cbb2d){_0x279cb9['push'](_0x279cb9['shift']());}};_0x276581(++_0x567a3e);}(_0x3482,0x178));var _0x2348=function(_0x5b04a3,_0xfda4fd){_0x5b04a3=_0x5b04a3-0x0;var _0x1adf11=_0x3482[_0x5b04a3];return _0x1adf11;};'use strict';var moment=require(_0x2348('0x0'));var Sequelize=require(_0x2348('0x1'));module[_0x2348('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2348('0x3'),_0x2348('0x4'),_0x2348('0x5')),'allowNull':![],'defaultValue':_0x2348('0x5')},'transferredAt':{'type':Sequelize[_0x2348('0x6')],'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 e96cae3..acc224c 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 _0x6bb4=['json','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','show','params','fields','include','find','create','body','catch','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','set','Content-Range'];(function(_0x51bb0a,_0x50d97b){var _0x15583a=function(_0x125ef6){while(--_0x125ef6){_0x51bb0a['push'](_0x51bb0a['shift']());}};_0x15583a(++_0x50d97b);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x271eac,_0x16b807){_0x271eac=_0x271eac-0x0;var _0x174c4b=_0x6bb4[_0x271eac];return _0x174c4b;};'use strict';var pdf=require(_0x46bb('0x0'));var emlformat=require(_0x46bb('0x1'));var rimraf=require(_0x46bb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46bb('0x3'));var rp=require(_0x46bb('0x4'));var moment=require('moment');var BPromise=require(_0x46bb('0x5'));var Mustache=require(_0x46bb('0x6'));var util=require(_0x46bb('0x7'));var path=require(_0x46bb('0x8'));var sox=require(_0x46bb('0x9'));var csv=require(_0x46bb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x46bb('0xb'));var crypto=require(_0x46bb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x46bb('0xd'));var Papa=require(_0x46bb('0xe'));var Redis=require('ioredis');var authService=require(_0x46bb('0xf'));var qs=require(_0x46bb('0x10'));var as=require(_0x46bb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46bb('0x12'))(_0x46bb('0x13'));var utils=require('../../config/utils');var config=require(_0x46bb('0x14'));var licenseUtil=require(_0x46bb('0x15'));var db=require(_0x46bb('0x16'))['db'];function respondWithStatusCode(_0x54cbac,_0x18e28a){_0x18e28a=_0x18e28a||0xcc;return function(_0x481623){if(_0x481623){return _0x54cbac['sendStatus'](_0x18e28a);}return _0x54cbac[_0x46bb('0x17')](_0x18e28a)['end']();};}function respondWithResult(_0x30b3cd,_0x1c8850){_0x1c8850=_0x1c8850||0xc8;return function(_0x50f198){if(_0x50f198){return _0x30b3cd[_0x46bb('0x17')](_0x1c8850)['json'](_0x50f198);}};}function respondWithFilteredResult(_0x6b4781,_0x4d1095){return function(_0x210745){if(_0x210745){var _0x547aff=_0x210745['count'],_0x556efa=_0x4d1095[_0x46bb('0x18')],_0x3aedc4=_0x4d1095[_0x46bb('0x18')]+_0x4d1095['limit'],_0x3965ed;if(_0x3aedc4>=_0x547aff){_0x3aedc4=_0x547aff;_0x3965ed=0xc8;}else{_0x3965ed=0xce;}_0x6b4781['status'](_0x3965ed);return _0x6b4781[_0x46bb('0x19')](_0x46bb('0x1a'),_0x556efa+'-'+_0x3aedc4+'/'+_0x547aff)[_0x46bb('0x1b')](_0x210745);}return null;};}function patchUpdates(_0x4300fe){return function(_0x20e011){try{jsonpatch[_0x46bb('0x1c')](_0x20e011,_0x4300fe,!![]);}catch(_0x2d8023){return BPromise[_0x46bb('0x1d')](_0x2d8023);}return _0x20e011['save']();};}function saveUpdates(_0x5ce203,_0x10296c){return function(_0x246f31){if(_0x246f31){return _0x246f31[_0x46bb('0x1e')](_0x5ce203)['then'](function(_0x4c971a){return _0x4c971a;});}return null;};}function removeEntity(_0x4ccd36,_0x299fc0){return function(_0x2b3443){if(_0x2b3443){return _0x2b3443[_0x46bb('0x1f')]()[_0x46bb('0x20')](function(){_0x4ccd36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c525,_0x5c2885){return function(_0x5a0659){if(!_0x5a0659){_0x59c525[_0x46bb('0x21')](0x194);}return _0x5a0659;};}function handleError(_0x5d8dd8,_0x31978a){_0x31978a=_0x31978a||0x1f4;return function(_0x3c0031){logger[_0x46bb('0x22')](_0x3c0031[_0x46bb('0x23')]);if(_0x3c0031[_0x46bb('0x24')]){delete _0x3c0031[_0x46bb('0x24')];}_0x5d8dd8[_0x46bb('0x17')](_0x31978a)[_0x46bb('0x25')](_0x3c0031);};}exports[_0x46bb('0x26')]=function(_0x4277c4,_0x48db48){var _0x104e9b={},_0x15300f={},_0x49a84d={'count':0x0,'rows':[]};var _0x34e43a=_[_0x46bb('0x27')](db[_0x46bb('0x28')][_0x46bb('0x29')],function(_0x1977af){return{'name':_0x1977af[_0x46bb('0x2a')],'type':_0x1977af[_0x46bb('0x2b')][_0x46bb('0x2c')]};});_0x15300f[_0x46bb('0x2d')]=_[_0x46bb('0x27')](_0x34e43a,_0x46bb('0x24'));_0x15300f[_0x46bb('0x2e')]=_[_0x46bb('0x2f')](_0x4277c4[_0x46bb('0x2e')]);_0x15300f[_0x46bb('0x30')]=_[_0x46bb('0x31')](_0x15300f[_0x46bb('0x2d')],_0x15300f[_0x46bb('0x2e')]);_0x104e9b[_0x46bb('0x32')]=_[_0x46bb('0x31')](_0x15300f[_0x46bb('0x2d')],qs['fields'](_0x4277c4[_0x46bb('0x2e')]['fields']));_0x104e9b[_0x46bb('0x32')]=_0x104e9b['attributes'][_0x46bb('0x33')]?_0x104e9b[_0x46bb('0x32')]:_0x15300f[_0x46bb('0x2d')];if(!_0x4277c4['query'][_0x46bb('0x34')](_0x46bb('0x35'))){_0x104e9b[_0x46bb('0x36')]=qs[_0x46bb('0x36')](_0x4277c4[_0x46bb('0x2e')]['limit']);_0x104e9b[_0x46bb('0x18')]=qs[_0x46bb('0x18')](_0x4277c4[_0x46bb('0x2e')][_0x46bb('0x18')]);}_0x104e9b[_0x46bb('0x37')]=qs[_0x46bb('0x38')](_0x4277c4[_0x46bb('0x2e')][_0x46bb('0x38')]);_0x104e9b[_0x46bb('0x39')]=qs[_0x46bb('0x30')](_[_0x46bb('0x3a')](_0x4277c4[_0x46bb('0x2e')],_0x15300f[_0x46bb('0x30')]),_0x34e43a);if(_0x4277c4[_0x46bb('0x2e')][_0x46bb('0x3b')]){_0x104e9b[_0x46bb('0x39')]=_[_0x46bb('0x3c')](_0x104e9b[_0x46bb('0x39')],{'$or':_[_0x46bb('0x27')](_0x34e43a,function(_0x41fc4d){if(_0x41fc4d[_0x46bb('0x2b')]!==_0x46bb('0x3d')){var _0x17c603={};_0x17c603[_0x41fc4d['name']]={'$like':'%'+_0x4277c4[_0x46bb('0x2e')]['filter']+'%'};return _0x17c603;}})});}_0x104e9b=_['merge']({},_0x104e9b,_0x4277c4['options']);var _0x2e8fd1={'where':_0x104e9b['where']};return db[_0x46bb('0x28')]['count'](_0x2e8fd1)['then'](function(_0x33c2dc){_0x49a84d[_0x46bb('0x3e')]=_0x33c2dc;if(_0x4277c4['query'][_0x46bb('0x3f')]){_0x104e9b['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x46bb('0x40')](_0x104e9b);})['then'](function(_0x9acd4e){_0x49a84d[_0x46bb('0x41')]=_0x9acd4e;return _0x49a84d;})[_0x46bb('0x20')](respondWithFilteredResult(_0x48db48,_0x104e9b))['catch'](handleError(_0x48db48,null));};exports[_0x46bb('0x42')]=function(_0x292d4d,_0x4e6027){var _0x4bf211={'raw':!![],'where':{'id':_0x292d4d[_0x46bb('0x43')]['id']}},_0x2ae334={};_0x2ae334[_0x46bb('0x2d')]=_[_0x46bb('0x2f')](db[_0x46bb('0x28')][_0x46bb('0x29')]);_0x2ae334['query']=_[_0x46bb('0x2f')](_0x292d4d['query']);_0x2ae334[_0x46bb('0x30')]=_['intersection'](_0x2ae334[_0x46bb('0x2d')],_0x2ae334[_0x46bb('0x2e')]);_0x4bf211[_0x46bb('0x32')]=_['intersection'](_0x2ae334[_0x46bb('0x2d')],qs[_0x46bb('0x44')](_0x292d4d[_0x46bb('0x2e')]['fields']));_0x4bf211['attributes']=_0x4bf211[_0x46bb('0x32')][_0x46bb('0x33')]?_0x4bf211[_0x46bb('0x32')]:_0x2ae334[_0x46bb('0x2d')];if(_0x292d4d[_0x46bb('0x2e')][_0x46bb('0x3f')]){_0x4bf211[_0x46bb('0x45')]=[{'all':!![]}];}_0x4bf211=_[_0x46bb('0x3c')]({},_0x4bf211,_0x292d4d['options']);return db[_0x46bb('0x28')][_0x46bb('0x46')](_0x4bf211)[_0x46bb('0x20')](handleEntityNotFound(_0x4e6027,null))[_0x46bb('0x20')](respondWithResult(_0x4e6027,null))['catch'](handleError(_0x4e6027,null));};exports[_0x46bb('0x47')]=function(_0x2e9327,_0x153822){return db[_0x46bb('0x28')][_0x46bb('0x47')](_0x2e9327[_0x46bb('0x48')],{})[_0x46bb('0x20')](respondWithResult(_0x153822,0xc9))[_0x46bb('0x49')](handleError(_0x153822,null));};exports[_0x46bb('0x1e')]=function(_0x5463f1,_0x3b8389){if(_0x5463f1[_0x46bb('0x48')]['id']){delete _0x5463f1[_0x46bb('0x48')]['id'];}return db['FaxTransferReport'][_0x46bb('0x46')]({'where':{'id':_0x5463f1['params']['id']}})[_0x46bb('0x20')](handleEntityNotFound(_0x3b8389,null))['then'](saveUpdates(_0x5463f1[_0x46bb('0x48')],null))[_0x46bb('0x20')](respondWithResult(_0x3b8389,null))['catch'](handleError(_0x3b8389,null));};exports['destroy']=function(_0x12b7ad,_0x427959){return db['FaxTransferReport'][_0x46bb('0x46')]({'where':{'id':_0x12b7ad['params']['id']}})[_0x46bb('0x20')](handleEntityNotFound(_0x427959,null))[_0x46bb('0x20')](removeEntity(_0x427959,null))[_0x46bb('0x49')](handleError(_0x427959,null));};exports['describe']=function(_0x4626c9,_0x32669b){return db[_0x46bb('0x28')][_0x46bb('0x4a')]()['then'](respondWithResult(_0x32669b,null))['catch'](handleError(_0x32669b,null));}; \ No newline at end of file +var _0x4250=['merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x3dba3f,_0x4c0925){var _0x74c474=function(_0x44babd){while(--_0x44babd){_0x3dba3f['push'](_0x3dba3f['shift']());}};_0x74c474(++_0x4c0925);}(_0x4250,0x146));var _0x0425=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x4250[_0x45e98e];return _0x374dba;};'use strict';var pdf=require(_0x0425('0x0'));var emlformat=require(_0x0425('0x1'));var rimraf=require(_0x0425('0x2'));var zipdir=require(_0x0425('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0425('0x4'));var moment=require(_0x0425('0x5'));var BPromise=require(_0x0425('0x6'));var Mustache=require('mustache');var util=require(_0x0425('0x7'));var path=require(_0x0425('0x8'));var sox=require(_0x0425('0x9'));var csv=require(_0x0425('0xa'));var ejs=require(_0x0425('0xb'));var fs=require('fs');var _=require(_0x0425('0xc'));var squel=require(_0x0425('0xd'));var crypto=require(_0x0425('0xe'));var jsforce=require(_0x0425('0xf'));var deskjs=require(_0x0425('0x10'));var toCsv=require(_0x0425('0xa'));var querystring=require(_0x0425('0x11'));var Papa=require(_0x0425('0x12'));var Redis=require(_0x0425('0x13'));var authService=require(_0x0425('0x14'));var qs=require(_0x0425('0x15'));var as=require(_0x0425('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0425('0x17'));var utils=require('../../config/utils');var config=require(_0x0425('0x18'));var licenseUtil=require(_0x0425('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107fe1,_0x24dd34){_0x24dd34=_0x24dd34||0xcc;return function(_0x1c67ec){if(_0x1c67ec){return _0x107fe1[_0x0425('0x1a')](_0x24dd34);}return _0x107fe1['status'](_0x24dd34)[_0x0425('0x1b')]();};}function respondWithResult(_0x23e4fb,_0x5be3af){_0x5be3af=_0x5be3af||0xc8;return function(_0x4c8c50){if(_0x4c8c50){return _0x23e4fb['status'](_0x5be3af)[_0x0425('0x1c')](_0x4c8c50);}};}function respondWithFilteredResult(_0x33afcb,_0x1cd255){return function(_0x4a6389){if(_0x4a6389){var _0x4e439a=_0x4a6389[_0x0425('0x1d')],_0xe39d40=_0x1cd255[_0x0425('0x1e')],_0x326425=_0x1cd255[_0x0425('0x1e')]+_0x1cd255[_0x0425('0x1f')],_0x12095a;if(_0x326425>=_0x4e439a){_0x326425=_0x4e439a;_0x12095a=0xc8;}else{_0x12095a=0xce;}_0x33afcb[_0x0425('0x20')](_0x12095a);return _0x33afcb[_0x0425('0x21')](_0x0425('0x22'),_0xe39d40+'-'+_0x326425+'/'+_0x4e439a)['json'](_0x4a6389);}return null;};}function patchUpdates(_0x33678a){return function(_0x157042){try{jsonpatch[_0x0425('0x23')](_0x157042,_0x33678a,!![]);}catch(_0x41f9c7){return BPromise[_0x0425('0x24')](_0x41f9c7);}return _0x157042[_0x0425('0x25')]();};}function saveUpdates(_0x152cf7,_0x34765d){return function(_0x17b1c4){if(_0x17b1c4){return _0x17b1c4[_0x0425('0x26')](_0x152cf7)['then'](function(_0x225906){return _0x225906;});}return null;};}function removeEntity(_0x573ba9,_0x4bcab6){return function(_0x1c4cd3){if(_0x1c4cd3){return _0x1c4cd3[_0x0425('0x27')]()[_0x0425('0x28')](function(){_0x573ba9[_0x0425('0x20')](0xcc)[_0x0425('0x1b')]();});}};}function handleEntityNotFound(_0x347c29,_0x95eceb){return function(_0x4d3c0f){if(!_0x4d3c0f){_0x347c29[_0x0425('0x1a')](0x194);}return _0x4d3c0f;};}function handleError(_0x4d3f93,_0xd7adb4){_0xd7adb4=_0xd7adb4||0x1f4;return function(_0x1d53a9){logger[_0x0425('0x29')](_0x1d53a9['stack']);if(_0x1d53a9[_0x0425('0x2a')]){delete _0x1d53a9[_0x0425('0x2a')];}_0x4d3f93[_0x0425('0x20')](_0xd7adb4)[_0x0425('0x2b')](_0x1d53a9);};}exports[_0x0425('0x2c')]=function(_0x2bbcd0,_0x36146d){var _0x43db4f={},_0x13d82a={},_0x154aa5={'count':0x0,'rows':[]};var _0x120a5b=_[_0x0425('0x2d')](db[_0x0425('0x2e')]['rawAttributes'],function(_0x1a47a4){return{'name':_0x1a47a4[_0x0425('0x2f')],'type':_0x1a47a4[_0x0425('0x30')][_0x0425('0x31')]};});_0x13d82a[_0x0425('0x32')]=_[_0x0425('0x2d')](_0x120a5b,_0x0425('0x2a'));_0x13d82a[_0x0425('0x33')]=_[_0x0425('0x34')](_0x2bbcd0[_0x0425('0x33')]);_0x13d82a[_0x0425('0x35')]=_[_0x0425('0x36')](_0x13d82a[_0x0425('0x32')],_0x13d82a[_0x0425('0x33')]);_0x43db4f[_0x0425('0x37')]=_[_0x0425('0x36')](_0x13d82a[_0x0425('0x32')],qs[_0x0425('0x38')](_0x2bbcd0[_0x0425('0x33')][_0x0425('0x38')]));_0x43db4f[_0x0425('0x37')]=_0x43db4f[_0x0425('0x37')][_0x0425('0x39')]?_0x43db4f[_0x0425('0x37')]:_0x13d82a['model'];if(!_0x2bbcd0[_0x0425('0x33')]['hasOwnProperty'](_0x0425('0x3a'))){_0x43db4f[_0x0425('0x1f')]=qs[_0x0425('0x1f')](_0x2bbcd0[_0x0425('0x33')][_0x0425('0x1f')]);_0x43db4f['offset']=qs[_0x0425('0x1e')](_0x2bbcd0['query'][_0x0425('0x1e')]);}_0x43db4f[_0x0425('0x3b')]=qs['sort'](_0x2bbcd0[_0x0425('0x33')][_0x0425('0x3c')]);_0x43db4f[_0x0425('0x3d')]=qs['filters'](_[_0x0425('0x3e')](_0x2bbcd0[_0x0425('0x33')],_0x13d82a[_0x0425('0x35')]),_0x120a5b);if(_0x2bbcd0[_0x0425('0x33')][_0x0425('0x3f')]){_0x43db4f[_0x0425('0x3d')]=_[_0x0425('0x40')](_0x43db4f['where'],{'$or':_['map'](_0x120a5b,function(_0x55de73){if(_0x55de73[_0x0425('0x30')]!=='VIRTUAL'){var _0x13aec5={};_0x13aec5[_0x55de73[_0x0425('0x2a')]]={'$like':'%'+_0x2bbcd0[_0x0425('0x33')][_0x0425('0x3f')]+'%'};return _0x13aec5;}})});}_0x43db4f=_[_0x0425('0x40')]({},_0x43db4f,_0x2bbcd0['options']);var _0x14946c={'where':_0x43db4f[_0x0425('0x3d')]};return db[_0x0425('0x2e')][_0x0425('0x1d')](_0x14946c)[_0x0425('0x28')](function(_0x208581){_0x154aa5[_0x0425('0x1d')]=_0x208581;if(_0x2bbcd0['query'][_0x0425('0x41')]){_0x43db4f[_0x0425('0x42')]=[{'all':!![]}];}return db[_0x0425('0x2e')][_0x0425('0x43')](_0x43db4f);})['then'](function(_0x3dab51){_0x154aa5[_0x0425('0x44')]=_0x3dab51;return _0x154aa5;})['then'](respondWithFilteredResult(_0x36146d,_0x43db4f))[_0x0425('0x45')](handleError(_0x36146d,null));};exports[_0x0425('0x46')]=function(_0xe322de,_0x5930f3){var _0x3786dc={'raw':!![],'where':{'id':_0xe322de[_0x0425('0x47')]['id']}},_0x6ea0f={};_0x6ea0f[_0x0425('0x32')]=_[_0x0425('0x34')](db[_0x0425('0x2e')][_0x0425('0x48')]);_0x6ea0f[_0x0425('0x33')]=_['keys'](_0xe322de[_0x0425('0x33')]);_0x6ea0f[_0x0425('0x35')]=_[_0x0425('0x36')](_0x6ea0f['model'],_0x6ea0f[_0x0425('0x33')]);_0x3786dc[_0x0425('0x37')]=_[_0x0425('0x36')](_0x6ea0f[_0x0425('0x32')],qs['fields'](_0xe322de[_0x0425('0x33')][_0x0425('0x38')]));_0x3786dc[_0x0425('0x37')]=_0x3786dc[_0x0425('0x37')][_0x0425('0x39')]?_0x3786dc[_0x0425('0x37')]:_0x6ea0f[_0x0425('0x32')];if(_0xe322de[_0x0425('0x33')][_0x0425('0x41')]){_0x3786dc[_0x0425('0x42')]=[{'all':!![]}];}_0x3786dc=_[_0x0425('0x40')]({},_0x3786dc,_0xe322de[_0x0425('0x49')]);return db[_0x0425('0x2e')][_0x0425('0x4a')](_0x3786dc)[_0x0425('0x28')](handleEntityNotFound(_0x5930f3,null))[_0x0425('0x28')](respondWithResult(_0x5930f3,null))[_0x0425('0x45')](handleError(_0x5930f3,null));};exports[_0x0425('0x4b')]=function(_0x516e6b,_0x9cbd3a){return db[_0x0425('0x2e')]['create'](_0x516e6b[_0x0425('0x4c')],{})[_0x0425('0x28')](respondWithResult(_0x9cbd3a,0xc9))[_0x0425('0x45')](handleError(_0x9cbd3a,null));};exports['update']=function(_0x554a1e,_0x2dfdec){if(_0x554a1e[_0x0425('0x4c')]['id']){delete _0x554a1e[_0x0425('0x4c')]['id'];}return db[_0x0425('0x2e')][_0x0425('0x4a')]({'where':{'id':_0x554a1e[_0x0425('0x47')]['id']}})['then'](handleEntityNotFound(_0x2dfdec,null))['then'](saveUpdates(_0x554a1e[_0x0425('0x4c')],null))[_0x0425('0x28')](respondWithResult(_0x2dfdec,null))[_0x0425('0x45')](handleError(_0x2dfdec,null));};exports[_0x0425('0x27')]=function(_0x5d717e,_0x3fc412){return db[_0x0425('0x2e')]['find']({'where':{'id':_0x5d717e['params']['id']}})[_0x0425('0x28')](handleEntityNotFound(_0x3fc412,null))[_0x0425('0x28')](removeEntity(_0x3fc412,null))['catch'](handleError(_0x3fc412,null));};exports[_0x0425('0x4d')]=function(_0x11e444,_0x154985){return db[_0x0425('0x2e')][_0x0425('0x4d')]()[_0x0425('0x28')](respondWithResult(_0x154985,null))['catch'](handleError(_0x154985,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 72c875b..22e08b5 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 _0xf6fe=['lodash','util','api','request-promise','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf6fe,0x181));var _0xef6f=function(_0x58ab94,_0x835f07){_0x58ab94=_0x58ab94-0x0;var _0x5e8fbb=_0xf6fe[_0x58ab94];return _0x5e8fbb;};'use strict';var _=require(_0xef6f('0x0'));var util=require(_0xef6f('0x1'));var logger=require('../../config/logger')(_0xef6f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xef6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef6f('0x4'));var config=require('../../config/environment');var attributes=require(_0xef6f('0x5'));module[_0xef6f('0x6')]=function(_0x3906e0,_0x51fff1){return _0x3906e0[_0xef6f('0x7')](_0xef6f('0x8'),attributes,{'tableName':_0xef6f('0x9'),'paranoid':![],'indexes':[{'name':_0xef6f('0xa'),'fields':[_0xef6f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa009=['moment','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa009,0x10a));var _0x9a00=function(_0x122ef2,_0x50ca5c){_0x122ef2=_0x122ef2-0x0;var _0x51c537=_0xa009[_0x122ef2];return _0x51c537;};'use strict';var _=require(_0x9a00('0x0'));var util=require(_0x9a00('0x1'));var logger=require(_0x9a00('0x2'))(_0x9a00('0x3'));var moment=require(_0x9a00('0x4'));var BPromise=require('bluebird');var rp=require(_0x9a00('0x5'));var fs=require('fs');var path=require(_0x9a00('0x6'));var rimraf=require(_0x9a00('0x7'));var config=require(_0x9a00('0x8'));var attributes=require(_0x9a00('0x9'));module[_0x9a00('0xa')]=function(_0x462bc3,_0x66fd9){return _0x462bc3[_0x9a00('0xb')](_0x9a00('0xc'),attributes,{'tableName':_0x9a00('0xd'),'paranoid':![],'indexes':[{'name':_0x9a00('0xe'),'fields':[_0x9a00('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 33bf644..573763b 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 _0x2fe1=['message','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5bc953,_0x531c49){var _0x2d8afc=function(_0x500e0f){while(--_0x500e0f){_0x5bc953['push'](_0x5bc953['shift']());}};_0x2d8afc(++_0x531c49);}(_0x2fe1,0x10b));var _0x12fe=function(_0x4aee35,_0x20a268){_0x4aee35=_0x4aee35-0x0;var _0x36805d=_0x2fe1[_0x4aee35];return _0x36805d;};'use strict';var _=require('lodash');var util=require(_0x12fe('0x0'));var moment=require(_0x12fe('0x1'));var BPromise=require(_0x12fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12fe('0x3'));var db=require(_0x12fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12fe('0x5'))(_0x12fe('0x6'));var config=require(_0x12fe('0x7'));var jayson=require(_0x12fe('0x8'));var client=jayson['client'][_0x12fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x117b0f,_0x5e60fb,_0x316baf){return new BPromise(function(_0x2050c7,_0x43b869){return client['request'](_0x117b0f,_0x316baf)[_0x12fe('0xa')](function(_0x115b61){logger[_0x12fe('0xb')](_0x12fe('0xc'),_0x5e60fb,_0x12fe('0xd'));logger[_0x12fe('0xe')](_0x12fe('0xf'),_0x5e60fb,_0x12fe('0xd'),JSON[_0x12fe('0x10')](_0x115b61));if(_0x115b61[_0x12fe('0x11')]){if(_0x115b61[_0x12fe('0x11')]['code']===0x1f4){logger[_0x12fe('0x11')](_0x12fe('0xc'),_0x5e60fb,_0x115b61[_0x12fe('0x11')][_0x12fe('0x12')]);return _0x43b869(_0x115b61['error'][_0x12fe('0x12')]);}logger['error'](_0x12fe('0xc'),_0x5e60fb,_0x115b61[_0x12fe('0x11')][_0x12fe('0x12')]);return _0x2050c7(_0x115b61[_0x12fe('0x11')][_0x12fe('0x12')]);}else{logger[_0x12fe('0xb')](_0x12fe('0xc'),_0x5e60fb,_0x12fe('0xd'));_0x2050c7(_0x115b61['result']['message']);}})['catch'](function(_0x2eef4c){logger[_0x12fe('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5e60fb,_0x2eef4c);_0x43b869(_0x2eef4c);});});} \ No newline at end of file +var _0x16aa=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x56a625,_0x540c26){var _0x168c39=function(_0x2080c4){while(--_0x2080c4){_0x56a625['push'](_0x56a625['shift']());}};_0x168c39(++_0x540c26);}(_0x16aa,0x1db));var _0xa16a=function(_0x199b1c,_0x3a2c59){_0x199b1c=_0x199b1c-0x0;var _0x4751c0=_0x16aa[_0x199b1c];return _0x4751c0;};'use strict';var _=require('lodash');var util=require(_0xa16a('0x0'));var moment=require(_0xa16a('0x1'));var BPromise=require(_0xa16a('0x2'));var rs=require(_0xa16a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa16a('0x4'))['db'];var utils=require(_0xa16a('0x5'));var logger=require(_0xa16a('0x6'))(_0xa16a('0x7'));var config=require(_0xa16a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa16a('0x9')][_0xa16a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5994ed,_0x38790c,_0x224bc2){return new BPromise(function(_0x2de6ca,_0x18b360){return client[_0xa16a('0xb')](_0x5994ed,_0x224bc2)[_0xa16a('0xc')](function(_0x52177a){logger[_0xa16a('0xd')](_0xa16a('0xe'),_0x38790c,'request\x20sent');logger['debug'](_0xa16a('0xf'),_0x38790c,_0xa16a('0x10'),JSON[_0xa16a('0x11')](_0x52177a));if(_0x52177a['error']){if(_0x52177a['error']['code']===0x1f4){logger[_0xa16a('0x12')](_0xa16a('0xe'),_0x38790c,_0x52177a[_0xa16a('0x12')]['message']);return _0x18b360(_0x52177a['error'][_0xa16a('0x13')]);}logger[_0xa16a('0x12')](_0xa16a('0xe'),_0x38790c,_0x52177a[_0xa16a('0x12')][_0xa16a('0x13')]);return _0x2de6ca(_0x52177a['error'][_0xa16a('0x13')]);}else{logger[_0xa16a('0xd')](_0xa16a('0xe'),_0x38790c,_0xa16a('0x10'));_0x2de6ca(_0x52177a['result'][_0xa16a('0x13')]);}})['catch'](function(_0x2e6615){logger[_0xa16a('0x12')](_0xa16a('0xe'),_0x38790c,_0x2e6615);_0x18b360(_0x2e6615);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 01b8842..fb87f64 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 _0xb6e5=['put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0x13fe8c,_0x465c26){var _0x2b1b24=function(_0x3d7c86){while(--_0x3d7c86){_0x13fe8c['push'](_0x13fe8c['shift']());}};_0x2b1b24(++_0x465c26);}(_0xb6e5,0x6f));var _0x5b6e=function(_0x16fc2e,_0x207efa){_0x16fc2e=_0x16fc2e-0x0;var _0x1026a3=_0xb6e5[_0x16fc2e];return _0x1026a3;};'use strict';var multer=require(_0x5b6e('0x0'));var util=require(_0x5b6e('0x1'));var path=require('path');var timeout=require(_0x5b6e('0x2'));var express=require(_0x5b6e('0x3'));var router=express[_0x5b6e('0x4')]();var auth=require(_0x5b6e('0x5'));var interaction=require(_0x5b6e('0x6'));var config=require(_0x5b6e('0x7'));var controller=require(_0x5b6e('0x8'));router[_0x5b6e('0x9')]('/',auth[_0x5b6e('0xa')](),controller[_0x5b6e('0xb')]);router['get'](_0x5b6e('0xc'),auth[_0x5b6e('0xa')](),controller['describe']);router[_0x5b6e('0x9')](_0x5b6e('0xd'),auth[_0x5b6e('0xa')](),controller['show']);router[_0x5b6e('0xe')]('/',auth[_0x5b6e('0xa')](),controller['create']);router[_0x5b6e('0xf')](_0x5b6e('0xd'),auth[_0x5b6e('0xa')](),controller[_0x5b6e('0x10')]);router['delete'](_0x5b6e('0xd'),auth[_0x5b6e('0xa')](),controller[_0x5b6e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xefa9=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','destroy','multer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xefa9,0x1df));var _0x9efa=function(_0x17d48d,_0x4074fb){_0x17d48d=_0x17d48d-0x0;var _0x26aee9=_0xefa9[_0x17d48d];return _0x26aee9;};'use strict';var multer=require(_0x9efa('0x0'));var util=require(_0x9efa('0x1'));var path=require(_0x9efa('0x2'));var timeout=require(_0x9efa('0x3'));var express=require('express');var router=express[_0x9efa('0x4')]();var auth=require(_0x9efa('0x5'));var interaction=require(_0x9efa('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x9efa('0x7')]('/',auth[_0x9efa('0x8')](),controller[_0x9efa('0x9')]);router[_0x9efa('0x7')]('/describe',auth[_0x9efa('0x8')](),controller['describe']);router[_0x9efa('0x7')](_0x9efa('0xa'),auth['isAuthenticated'](),controller[_0x9efa('0xb')]);router[_0x9efa('0xc')]('/',auth[_0x9efa('0x8')](),controller[_0x9efa('0xd')]);router[_0x9efa('0xe')](_0x9efa('0xa'),auth[_0x9efa('0x8')](),controller['update']);router['delete']('/:id',auth[_0x9efa('0x8')](),controller[_0x9efa('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2ad9475..16b5502 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 _0x90cd=['../../config/environment','./intDeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x90cd,0xda));var _0xd90c=function(_0x387c9c,_0x1a7c8b){_0x387c9c=_0x387c9c-0x0;var _0x3391a0=_0x90cd[_0x387c9c];return _0x3391a0;};'use strict';var multer=require(_0xd90c('0x0'));var util=require('util');var path=require(_0xd90c('0x1'));var timeout=require(_0xd90c('0x2'));var express=require(_0xd90c('0x3'));var router=express[_0xd90c('0x4')]();var auth=require(_0xd90c('0x5'));var interaction=require(_0xd90c('0x6'));var config=require(_0xd90c('0x7'));var controller=require(_0xd90c('0x8'));router[_0xd90c('0x9')]('/',auth['isAuthenticated'](),controller[_0xd90c('0xa')]);router[_0xd90c('0x9')](_0xd90c('0xb'),auth['isAuthenticated'](),controller[_0xd90c('0xc')]);router['get'](_0xd90c('0xd'),auth[_0xd90c('0xe')](),controller[_0xd90c('0xf')]);router['get'](_0xd90c('0x10'),auth[_0xd90c('0xe')](),controller[_0xd90c('0x11')]);router[_0xd90c('0x12')]('/',auth[_0xd90c('0xe')](),controller[_0xd90c('0x13')]);router['post'](_0xd90c('0xd'),auth[_0xd90c('0xe')](),controller[_0xd90c('0x14')]);router[_0xd90c('0x15')](_0xd90c('0xb'),auth['isAuthenticated'](),controller[_0xd90c('0x16')]);router['delete']('/:id',auth[_0xd90c('0xe')](),controller[_0xd90c('0x17')]);module[_0xd90c('0x18')]=router; \ No newline at end of file +var _0xa481=['create','post','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa481,0x153));var _0x1a48=function(_0x33bd6d,_0xe5376d){_0x33bd6d=_0x33bd6d-0x0;var _0x21845f=_0xa481[_0x33bd6d];return _0x21845f;};'use strict';var multer=require(_0x1a48('0x0'));var util=require('util');var path=require(_0x1a48('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1a48('0x2')]();var auth=require(_0x1a48('0x3'));var interaction=require(_0x1a48('0x4'));var config=require('../../config/environment');var controller=require(_0x1a48('0x5'));router[_0x1a48('0x6')]('/',auth['isAuthenticated'](),controller[_0x1a48('0x7')]);router['get'](_0x1a48('0x8'),auth[_0x1a48('0x9')](),controller['show']);router['get'](_0x1a48('0xa'),auth['isAuthenticated'](),controller[_0x1a48('0xb')]);router[_0x1a48('0x6')](_0x1a48('0xc'),auth[_0x1a48('0x9')](),controller['getFields']);router['post']('/',auth[_0x1a48('0x9')](),controller[_0x1a48('0xd')]);router[_0x1a48('0xe')](_0x1a48('0xa'),auth[_0x1a48('0x9')](),controller['addConfiguration']);router['put']('/:id',auth[_0x1a48('0x9')](),controller['update']);router['delete'](_0x1a48('0x8'),auth[_0x1a48('0x9')](),controller['destroy']);module[_0x1a48('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 1cc4da3..f0bbc3a 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 _0x40ac=['ENUM','basic','integrationTab','sequelize','STRING'];(function(_0x3bae9c,_0x3a233f){var _0x15822f=function(_0x5826ba){while(--_0x5826ba){_0x3bae9c['push'](_0x3bae9c['shift']());}};_0x15822f(++_0x3a233f);}(_0x40ac,0x1de));var _0xc40a=function(_0x57e5fa,_0x579542){_0x57e5fa=_0x57e5fa-0x0;var _0x4d8b97=_0x40ac[_0x57e5fa];return _0x4d8b97;};'use strict';var Sequelize=require(_0xc40a('0x0'));module['exports']={'name':{'type':Sequelize[_0xc40a('0x1')]},'description':{'type':Sequelize[_0xc40a('0x1')]},'username':{'type':Sequelize[_0xc40a('0x1')]},'remoteUri':{'type':Sequelize[_0xc40a('0x1')]},'authType':{'type':Sequelize[_0xc40a('0x2')](_0xc40a('0x3')),'defaultValue':_0xc40a('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xc40a('0x1')]},'consumerSecret':{'type':Sequelize[_0xc40a('0x1')]},'token':{'type':Sequelize[_0xc40a('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc40a('0x2')](_0xc40a('0x4'),'newTab'),'defaultValue':_0xc40a('0x4')}}; \ No newline at end of file +var _0x3ef7=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x3b5fb4,_0x2c12ee){var _0x14b2bd=function(_0x1be3c3){while(--_0x1be3c3){_0x3b5fb4['push'](_0x3b5fb4['shift']());}};_0x14b2bd(++_0x2c12ee);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x73ef('0x0'));module['exports']={'name':{'type':Sequelize[_0x73ef('0x1')]},'description':{'type':Sequelize[_0x73ef('0x1')]},'username':{'type':Sequelize[_0x73ef('0x1')]},'remoteUri':{'type':Sequelize[_0x73ef('0x1')]},'authType':{'type':Sequelize[_0x73ef('0x2')]('basic'),'defaultValue':_0x73ef('0x3')},'password':{'type':Sequelize[_0x73ef('0x1')]},'consumerKey':{'type':Sequelize[_0x73ef('0x1')]},'consumerSecret':{'type':Sequelize[_0x73ef('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x73ef('0x1')]},'serverUrl':{'type':Sequelize[_0x73ef('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x73ef('0x2')](_0x73ef('0x4'),_0x73ef('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f9cc50f..a502c37 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 _0x09ac=['Content-Range','apply','reject','save','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','addConfiguration','findOne','AccountId','channel','getDescriptions','DeskConfiguration','DeskField','Subjects','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','%s:%s','toString','concat','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x7f287d,_0xe3b36e){var _0x21514f=function(_0x2e392e){while(--_0x2e392e){_0x7f287d['push'](_0x7f287d['shift']());}};_0x21514f(++_0xe3b36e);}(_0x09ac,0x1bc));var _0xc09a=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0x09ac[_0x26d034];return _0x3015aa;};'use strict';var pdf=require(_0xc09a('0x0'));var emlformat=require(_0xc09a('0x1'));var rimraf=require(_0xc09a('0x2'));var zipdir=require(_0xc09a('0x3'));var jsonpatch=require(_0xc09a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc09a('0x5'));var Mustache=require(_0xc09a('0x6'));var util=require(_0xc09a('0x7'));var path=require(_0xc09a('0x8'));var sox=require(_0xc09a('0x9'));var csv=require(_0xc09a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc09a('0xb'));var squel=require(_0xc09a('0xc'));var crypto=require('crypto');var jsforce=require(_0xc09a('0xd'));var deskjs=require(_0xc09a('0xe'));var toCsv=require(_0xc09a('0xa'));var querystring=require(_0xc09a('0xf'));var Papa=require(_0xc09a('0x10'));var Redis=require(_0xc09a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc09a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc09a('0x13'));var utils=require(_0xc09a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc09a('0x15'));var db=require(_0xc09a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xc09a('0x17'));var client=jayson[_0xc09a('0x18')][_0xc09a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x430ddb,_0x1aa2ea,_0x25cb93,_0x4b9237){return new BPromise(function(_0x2aff0e,_0x1a89b8){var _0x13420b=_0x4b9237||client;return _0x13420b[_0xc09a('0x1a')](_0x430ddb,_0x25cb93)[_0xc09a('0x1b')](function(_0xef9bbc){logger[_0xc09a('0x1c')](_0xc09a('0x1d'),_0x1aa2ea,_0xc09a('0x1e'));logger[_0xc09a('0x1f')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1aa2ea,_0xc09a('0x1e'),JSON[_0xc09a('0x20')](_0xef9bbc));if(_0xef9bbc[_0xc09a('0x21')]){if(_0xef9bbc[_0xc09a('0x21')][_0xc09a('0x22')]===0x1f4){logger[_0xc09a('0x21')](_0xc09a('0x1d'),_0x1aa2ea,_0xef9bbc[_0xc09a('0x21')][_0xc09a('0x23')]);return _0x1a89b8(_0xef9bbc[_0xc09a('0x21')]['message']);}logger[_0xc09a('0x21')]('DeskAccount,\x20%s,\x20%s',_0x1aa2ea,_0xef9bbc[_0xc09a('0x21')][_0xc09a('0x23')]);return _0x2aff0e(_0xef9bbc[_0xc09a('0x21')][_0xc09a('0x23')]);}else{logger[_0xc09a('0x1c')](_0xc09a('0x1d'),_0x1aa2ea,_0xc09a('0x1e'));_0x2aff0e(_0xef9bbc['result']['message']);}})['catch'](function(_0x492c16){logger[_0xc09a('0x21')](_0xc09a('0x1d'),_0x1aa2ea,_0x492c16);_0x1a89b8(_0x492c16);});});}function respondWithStatusCode(_0x37805a,_0x5f2344){_0x5f2344=_0x5f2344||0xcc;return function(_0x2a1457){if(_0x2a1457){return _0x37805a[_0xc09a('0x24')](_0x5f2344);}return _0x37805a['status'](_0x5f2344)[_0xc09a('0x25')]();};}function respondWithResult(_0x225274,_0x3f61c8){_0x3f61c8=_0x3f61c8||0xc8;return function(_0x30bbc6){if(_0x30bbc6){return _0x225274[_0xc09a('0x26')](_0x3f61c8)[_0xc09a('0x27')](_0x30bbc6);}};}function respondWithFilteredResult(_0x407166,_0xa15991){return function(_0x57bab5){if(_0x57bab5){var _0x24934c=_0x57bab5[_0xc09a('0x28')],_0x401601=_0xa15991[_0xc09a('0x29')],_0x2553f1=_0xa15991[_0xc09a('0x29')]+_0xa15991[_0xc09a('0x2a')],_0x365f40;if(_0x2553f1>=_0x24934c){_0x2553f1=_0x24934c;_0x365f40=0xc8;}else{_0x365f40=0xce;}_0x407166[_0xc09a('0x26')](_0x365f40);return _0x407166[_0xc09a('0x2b')](_0xc09a('0x2c'),_0x401601+'-'+_0x2553f1+'/'+_0x24934c)[_0xc09a('0x27')](_0x57bab5);}return null;};}function patchUpdates(_0x161ba8){return function(_0x54ed46){try{jsonpatch[_0xc09a('0x2d')](_0x54ed46,_0x161ba8,!![]);}catch(_0x48fc63){return BPromise[_0xc09a('0x2e')](_0x48fc63);}return _0x54ed46[_0xc09a('0x2f')]();};}function saveUpdates(_0x18da60,_0x114d3c){return function(_0x239fb2){if(_0x239fb2){return _0x239fb2['update'](_0x18da60)[_0xc09a('0x1b')](function(_0x31d1fb){return _0x31d1fb;});}return null;};}function removeEntity(_0x1ebc04,_0x2ed489){return function(_0x31c71b){if(_0x31c71b){return _0x31c71b[_0xc09a('0x30')]()[_0xc09a('0x1b')](function(){_0x1ebc04[_0xc09a('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb75cdf,_0x2ac4f1){return function(_0x576d5b){if(!_0x576d5b){_0xb75cdf[_0xc09a('0x24')](0x194);}return _0x576d5b;};}function handleError(_0x464d3e,_0x294a68){_0x294a68=_0x294a68||0x1f4;return function(_0x125f16){logger[_0xc09a('0x21')](_0x125f16[_0xc09a('0x31')]);if(_0x125f16[_0xc09a('0x32')]){delete _0x125f16[_0xc09a('0x32')];}_0x464d3e[_0xc09a('0x26')](_0x294a68)[_0xc09a('0x33')](_0x125f16);};}exports[_0xc09a('0x34')]=function(_0x2a7a3d,_0x10fc51){var _0x15eb24={},_0x33ea11={},_0x42fcc6={'count':0x0,'rows':[]};var _0x2493ca=_[_0xc09a('0x35')](db[_0xc09a('0x36')][_0xc09a('0x37')],function(_0x2ef2ef){return{'name':_0x2ef2ef[_0xc09a('0x38')],'type':_0x2ef2ef['type'][_0xc09a('0x39')]};});_0x33ea11[_0xc09a('0x3a')]=_[_0xc09a('0x35')](_0x2493ca,_0xc09a('0x32'));_0x33ea11[_0xc09a('0x3b')]=_[_0xc09a('0x3c')](_0x2a7a3d['query']);_0x33ea11[_0xc09a('0x3d')]=_[_0xc09a('0x3e')](_0x33ea11[_0xc09a('0x3a')],_0x33ea11['query']);_0x15eb24[_0xc09a('0x3f')]=_['intersection'](_0x33ea11['model'],qs[_0xc09a('0x40')](_0x2a7a3d[_0xc09a('0x3b')][_0xc09a('0x40')]));_0x15eb24[_0xc09a('0x3f')]=_0x15eb24[_0xc09a('0x3f')][_0xc09a('0x41')]?_0x15eb24[_0xc09a('0x3f')]:_0x33ea11[_0xc09a('0x3a')];if(!_0x2a7a3d['query'][_0xc09a('0x42')](_0xc09a('0x43'))){_0x15eb24[_0xc09a('0x2a')]=qs[_0xc09a('0x2a')](_0x2a7a3d['query'][_0xc09a('0x2a')]);_0x15eb24[_0xc09a('0x29')]=qs[_0xc09a('0x29')](_0x2a7a3d[_0xc09a('0x3b')][_0xc09a('0x29')]);}_0x15eb24[_0xc09a('0x44')]=qs[_0xc09a('0x45')](_0x2a7a3d[_0xc09a('0x3b')][_0xc09a('0x45')]);_0x15eb24[_0xc09a('0x46')]=qs['filters'](_[_0xc09a('0x47')](_0x2a7a3d[_0xc09a('0x3b')],_0x33ea11[_0xc09a('0x3d')]),_0x2493ca);if(_0x2a7a3d[_0xc09a('0x3b')]['filter']){_0x15eb24['where']=_[_0xc09a('0x48')](_0x15eb24[_0xc09a('0x46')],{'$or':_[_0xc09a('0x35')](_0x2493ca,function(_0x49d5db){if(_0x49d5db[_0xc09a('0x49')]!==_0xc09a('0x4a')){var _0x4fa63a={};_0x4fa63a[_0x49d5db['name']]={'$like':'%'+_0x2a7a3d[_0xc09a('0x3b')][_0xc09a('0x4b')]+'%'};return _0x4fa63a;}})});}_0x15eb24=_[_0xc09a('0x48')]({},_0x15eb24,_0x2a7a3d[_0xc09a('0x4c')]);var _0x2c2d93={'where':_0x15eb24[_0xc09a('0x46')]};return db[_0xc09a('0x36')]['count'](_0x2c2d93)[_0xc09a('0x1b')](function(_0x509fd8){_0x42fcc6[_0xc09a('0x28')]=_0x509fd8;if(_0x2a7a3d[_0xc09a('0x3b')]['includeAll']){_0x15eb24[_0xc09a('0x4d')]=[{'all':!![]}];}return db[_0xc09a('0x36')][_0xc09a('0x4e')](_0x15eb24);})['then'](function(_0x58b59c){_0x42fcc6[_0xc09a('0x4f')]=_0x58b59c;return _0x42fcc6;})['then'](respondWithFilteredResult(_0x10fc51,_0x15eb24))[_0xc09a('0x50')](handleError(_0x10fc51,null));};exports[_0xc09a('0x51')]=function(_0x309cb9,_0x8f3a8e){var _0x3de853={'raw':![],'where':{'id':_0x309cb9[_0xc09a('0x52')]['id']}},_0x2154f3={};_0x2154f3[_0xc09a('0x3a')]=_[_0xc09a('0x3c')](db[_0xc09a('0x36')]['rawAttributes']);_0x2154f3['query']=_[_0xc09a('0x3c')](_0x309cb9['query']);_0x2154f3[_0xc09a('0x3d')]=_[_0xc09a('0x3e')](_0x2154f3[_0xc09a('0x3a')],_0x2154f3[_0xc09a('0x3b')]);_0x3de853[_0xc09a('0x3f')]=_['intersection'](_0x2154f3[_0xc09a('0x3a')],qs[_0xc09a('0x40')](_0x309cb9[_0xc09a('0x3b')]['fields']));_0x3de853['attributes']=_0x3de853[_0xc09a('0x3f')]['length']?_0x3de853[_0xc09a('0x3f')]:_0x2154f3[_0xc09a('0x3a')];if(_0x309cb9[_0xc09a('0x3b')]['includeAll']){_0x3de853[_0xc09a('0x4d')]=[{'all':!![]}];}_0x3de853=_[_0xc09a('0x48')]({},_0x3de853,_0x309cb9['options']);return db['DeskAccount'][_0xc09a('0x53')](_0x3de853)[_0xc09a('0x1b')](handleEntityNotFound(_0x8f3a8e,null))[_0xc09a('0x1b')](respondWithResult(_0x8f3a8e,null))[_0xc09a('0x50')](handleError(_0x8f3a8e,null));};exports[_0xc09a('0x54')]=function(_0x1a7524,_0x43abfb){return db[_0xc09a('0x36')][_0xc09a('0x54')](_0x1a7524[_0xc09a('0x55')],{})[_0xc09a('0x1b')](respondWithResult(_0x43abfb,0xc9))[_0xc09a('0x50')](handleError(_0x43abfb,null));};exports[_0xc09a('0x56')]=function(_0x18844a,_0x5d52ec){if(_0x18844a[_0xc09a('0x55')]['id']){delete _0x18844a['body']['id'];}return db['DeskAccount'][_0xc09a('0x53')]({'where':{'id':_0x18844a[_0xc09a('0x52')]['id']}})[_0xc09a('0x1b')](handleEntityNotFound(_0x5d52ec,null))[_0xc09a('0x1b')](saveUpdates(_0x18844a[_0xc09a('0x55')],null))[_0xc09a('0x1b')](respondWithResult(_0x5d52ec,null))[_0xc09a('0x50')](handleError(_0x5d52ec,null));};exports[_0xc09a('0x30')]=function(_0x178497,_0x309b9c){return db[_0xc09a('0x36')][_0xc09a('0x53')]({'where':{'id':_0x178497['params']['id']}})[_0xc09a('0x1b')](handleEntityNotFound(_0x309b9c,null))[_0xc09a('0x1b')](removeEntity(_0x309b9c,null))[_0xc09a('0x50')](handleError(_0x309b9c,null));};exports[_0xc09a('0x57')]=function(_0xe1e985,_0x4c956a,_0x4ff084){var _0x4437c5={};var _0x214614={};var _0x58ea1d;var _0xeb9cf0;return db['DeskAccount']['findOne']({'where':{'id':_0xe1e985[_0xc09a('0x52')]['id']}})[_0xc09a('0x1b')](handleEntityNotFound(_0x4c956a,null))[_0xc09a('0x1b')](function(_0x12317b){if(_0x12317b){_0x58ea1d=_0x12317b;_0x214614[_0xc09a('0x3a')]=_[_0xc09a('0x3c')](db['DeskConfiguration']['rawAttributes']);_0x214614['query']=_[_0xc09a('0x3c')](_0xe1e985['query']);_0x214614[_0xc09a('0x3d')]=_['intersection'](_0x214614[_0xc09a('0x3a')],_0x214614[_0xc09a('0x3b')]);_0x4437c5[_0xc09a('0x3f')]=_['intersection'](_0x214614[_0xc09a('0x3a')],qs[_0xc09a('0x40')](_0xe1e985[_0xc09a('0x3b')][_0xc09a('0x40')]));_0x4437c5[_0xc09a('0x3f')]=_0x4437c5['attributes']['length']?_0x4437c5[_0xc09a('0x3f')]:_0x214614['model'];_0x4437c5[_0xc09a('0x44')]=qs[_0xc09a('0x45')](_0xe1e985[_0xc09a('0x3b')][_0xc09a('0x45')]);_0x4437c5[_0xc09a('0x46')]=qs['filters'](_[_0xc09a('0x47')](_0xe1e985[_0xc09a('0x3b')],_0x214614[_0xc09a('0x3d')]));if(_0xe1e985[_0xc09a('0x3b')][_0xc09a('0x4b')]){_0x4437c5[_0xc09a('0x46')]=_[_0xc09a('0x48')](_0x4437c5[_0xc09a('0x46')],{'$or':_[_0xc09a('0x35')](_0x4437c5[_0xc09a('0x3f')],function(_0x35ec2d){var _0x4fcd3a={};_0x4fcd3a[_0x35ec2d]={'$like':'%'+_0xe1e985[_0xc09a('0x3b')][_0xc09a('0x4b')]+'%'};return _0x4fcd3a;})});}_0x4437c5=_[_0xc09a('0x48')]({},_0x4437c5,_0xe1e985[_0xc09a('0x4c')]);return _0x58ea1d[_0xc09a('0x57')](_0x4437c5);}})[_0xc09a('0x1b')](function(_0x2aed4c){if(_0x2aed4c){_0xeb9cf0=_0x2aed4c['length'];if(!_0xe1e985['query'][_0xc09a('0x42')](_0xc09a('0x43'))){_0x4437c5['limit']=qs['limit'](_0xe1e985['query'][_0xc09a('0x2a')]);_0x4437c5[_0xc09a('0x29')]=qs['offset'](_0xe1e985[_0xc09a('0x3b')][_0xc09a('0x29')]);}return _0x58ea1d['getConfigurations'](_0x4437c5);}})[_0xc09a('0x1b')](function(_0x42d71a){if(_0x42d71a){return _0x42d71a?{'count':_0xeb9cf0,'rows':_0x42d71a}:null;}})[_0xc09a('0x1b')](respondWithResult(_0x4c956a,null))[_0xc09a('0x50')](handleError(_0x4c956a,null));};exports[_0xc09a('0x58')]=function(_0x350c8c,_0x3782ab,_0xb3c4b2){if(_0x350c8c[_0xc09a('0x55')]['id']){delete _0x350c8c['body']['id'];}return db['DeskAccount'][_0xc09a('0x59')]({'where':{'id':_0x350c8c[_0xc09a('0x52')]['id']}})[_0xc09a('0x1b')](handleEntityNotFound(_0x3782ab,null))[_0xc09a('0x1b')](function(_0x43a927){if(_0x43a927){_0x350c8c[_0xc09a('0x55')][_0xc09a('0x5a')]=_0x43a927['id'];_0x350c8c['body']['Subjects']=integrations['getSubjects'](_0x350c8c['body'][_0xc09a('0x5b')],_0x350c8c[_0xc09a('0x55')]['type']);_0x350c8c['body']['Descriptions']=integrations[_0xc09a('0x5c')](_0x350c8c[_0xc09a('0x55')][_0xc09a('0x5b')],_0x350c8c[_0xc09a('0x55')]['type']);return db[_0xc09a('0x5d')][_0xc09a('0x54')](_0x350c8c[_0xc09a('0x55')],{'include':[{'model':db[_0xc09a('0x5e')],'as':_0xc09a('0x5f')},{'model':db['DeskField'],'as':_0xc09a('0x60')}]});}return null;})[_0xc09a('0x1b')](respondWithResult(_0x3782ab,null))[_0xc09a('0x50')](handleError(_0x3782ab,null));};exports[_0xc09a('0x61')]=function(_0x14fc9b,_0x25ca5a,_0x549455){var _0x40f9a6=[{'name':'priority','label':_0xc09a('0x62'),'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 _0x5dd73e='';return db[_0xc09a('0x36')]['findOne']({'where':{'id':_0x14fc9b[_0xc09a('0x52')]['id']},'attributes':['id',_0xc09a('0x63'),_0xc09a('0x64'),_0xc09a('0x65'),_0xc09a('0x66'),_0xc09a('0x67'),_0xc09a('0x68'),'token',_0xc09a('0x69')]})[_0xc09a('0x1b')](handleEntityNotFound(_0x25ca5a,null))[_0xc09a('0x1b')](function(_0x42fd0d){if(_0x42fd0d){_0x5dd73e=_0x42fd0d[_0xc09a('0x63')];var _0x475156=_0x5dd73e[_0xc09a('0x6a')](-0x1);if(_0x475156==='/'){_0x5dd73e=_0x5dd73e[_0xc09a('0x6b')](0x0,_0x5dd73e['lastIndexOf'](_0x475156));}var _0x274bd5={'method':_0xc09a('0x6c'),'uri':util[_0xc09a('0x6d')](_0xc09a('0x6e'),_0x5dd73e),'headers':{'Content-Type':'application/json','Accept':_0xc09a('0x6f')},'json':!![]};if(_0x42fd0d['authType']===_0xc09a('0x70')){_0x274bd5[_0xc09a('0x71')]['Authorization']=util[_0xc09a('0x6d')]('Basic\x20%s',new Buffer(util[_0xc09a('0x6d')](_0xc09a('0x72'),_0x42fd0d['username'],_0x42fd0d[_0xc09a('0x66')]))[_0xc09a('0x73')]('base64'));}return rp(_0x274bd5)['then'](function(_0x424541){return _0x40f9a6[_0xc09a('0x74')](_[_0xc09a('0x35')](_0x424541[_0xc09a('0x75')][_0xc09a('0x76')],function(_0x59c277){return{'id':_0x59c277['name'],'name':_0x59c277[_0xc09a('0x32')],'type':_0x59c277[_0xc09a('0x49')],'active':_0x59c277['active'],'label':_0x59c277['label'],'custom':!![]};}));});}})[_0xc09a('0x1b')](function(_0x13475b){return{'count':_0x13475b[_0xc09a('0x41')],'rows':_0x13475b};})[_0xc09a('0x1b')](respondWithResult(_0x25ca5a,null))[_0xc09a('0x50')](function(_0x28567b){var _0x17a447=_0x14fc9b[_0xc09a('0x3b')][_0xc09a('0x77')]?0x1f4:_0x28567b[_0xc09a('0x78')]||0x1f4;logger[_0xc09a('0x21')](_0xc09a('0x79'),_0xc09a('0x61'),_0x17a447,JSON[_0xc09a('0x20')](_0x28567b));delete _0x28567b[_0xc09a('0x32')];if(_0x17a447===0x191){_0x17a447=0x190;}_0x25ca5a[_0xc09a('0x26')](_0x17a447)[_0xc09a('0x33')](_0x14fc9b[_0xc09a('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x28567b[_0xc09a('0x78')]}:_0x28567b);});}; \ No newline at end of file +var _0xa8f3=['nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','format','application/json','basic','headers','Authorization','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xa8f3,0xb5));var _0x3a8f=function(_0x445983,_0x1b277e){_0x445983=_0x445983-0x0;var _0x48a0b3=_0xa8f3[_0x445983];return _0x48a0b3;};'use strict';var pdf=require(_0x3a8f('0x0'));var emlformat=require(_0x3a8f('0x1'));var rimraf=require(_0x3a8f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a8f('0x3'));var rp=require(_0x3a8f('0x4'));var moment=require(_0x3a8f('0x5'));var BPromise=require(_0x3a8f('0x6'));var Mustache=require(_0x3a8f('0x7'));var util=require(_0x3a8f('0x8'));var path=require(_0x3a8f('0x9'));var sox=require(_0x3a8f('0xa'));var csv=require(_0x3a8f('0xb'));var ejs=require(_0x3a8f('0xc'));var fs=require('fs');var _=require(_0x3a8f('0xd'));var squel=require(_0x3a8f('0xe'));var crypto=require(_0x3a8f('0xf'));var jsforce=require(_0x3a8f('0x10'));var deskjs=require(_0x3a8f('0x11'));var toCsv=require(_0x3a8f('0xb'));var querystring=require(_0x3a8f('0x12'));var Papa=require(_0x3a8f('0x13'));var Redis=require(_0x3a8f('0x14'));var authService=require(_0x3a8f('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a8f('0x16'));var logger=require(_0x3a8f('0x17'))(_0x3a8f('0x18'));var utils=require(_0x3a8f('0x19'));var config=require(_0x3a8f('0x1a'));var licenseUtil=require(_0x3a8f('0x1b'));var db=require(_0x3a8f('0x1c'))['db'];var integrations=require(_0x3a8f('0x1d'));var jayson=require(_0x3a8f('0x1e'));var client=jayson[_0x3a8f('0x1f')][_0x3a8f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46cf9f,_0x361f70,_0x5e861d,_0x1d1c59){return new BPromise(function(_0x3d903b,_0x39da9a){var _0x5c2f86=_0x1d1c59||client;return _0x5c2f86[_0x3a8f('0x21')](_0x46cf9f,_0x5e861d)[_0x3a8f('0x22')](function(_0x2be762){logger['info'](_0x3a8f('0x23'),_0x361f70,_0x3a8f('0x24'));logger[_0x3a8f('0x25')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x361f70,_0x3a8f('0x24'),JSON['stringify'](_0x2be762));if(_0x2be762[_0x3a8f('0x26')]){if(_0x2be762[_0x3a8f('0x26')][_0x3a8f('0x27')]===0x1f4){logger[_0x3a8f('0x26')](_0x3a8f('0x23'),_0x361f70,_0x2be762['error'][_0x3a8f('0x28')]);return _0x39da9a(_0x2be762[_0x3a8f('0x26')][_0x3a8f('0x28')]);}logger[_0x3a8f('0x26')](_0x3a8f('0x23'),_0x361f70,_0x2be762[_0x3a8f('0x26')][_0x3a8f('0x28')]);return _0x3d903b(_0x2be762[_0x3a8f('0x26')][_0x3a8f('0x28')]);}else{logger[_0x3a8f('0x29')](_0x3a8f('0x23'),_0x361f70,'request\x20sent');_0x3d903b(_0x2be762[_0x3a8f('0x2a')]['message']);}})[_0x3a8f('0x2b')](function(_0x417798){logger[_0x3a8f('0x26')](_0x3a8f('0x23'),_0x361f70,_0x417798);_0x39da9a(_0x417798);});});}function respondWithStatusCode(_0x5295b5,_0x28615d){_0x28615d=_0x28615d||0xcc;return function(_0x268291){if(_0x268291){return _0x5295b5[_0x3a8f('0x2c')](_0x28615d);}return _0x5295b5['status'](_0x28615d)[_0x3a8f('0x2d')]();};}function respondWithResult(_0x3ff2f0,_0x5824ef){_0x5824ef=_0x5824ef||0xc8;return function(_0x3727d3){if(_0x3727d3){return _0x3ff2f0[_0x3a8f('0x2e')](_0x5824ef)[_0x3a8f('0x2f')](_0x3727d3);}};}function respondWithFilteredResult(_0x34e35b,_0x1e8d80){return function(_0x32282d){if(_0x32282d){var _0x7b7fc6=_0x32282d[_0x3a8f('0x30')],_0x409ac7=_0x1e8d80['offset'],_0x446954=_0x1e8d80[_0x3a8f('0x31')]+_0x1e8d80['limit'],_0x18934c;if(_0x446954>=_0x7b7fc6){_0x446954=_0x7b7fc6;_0x18934c=0xc8;}else{_0x18934c=0xce;}_0x34e35b['status'](_0x18934c);return _0x34e35b[_0x3a8f('0x32')](_0x3a8f('0x33'),_0x409ac7+'-'+_0x446954+'/'+_0x7b7fc6)[_0x3a8f('0x2f')](_0x32282d);}return null;};}function patchUpdates(_0x4aadf){return function(_0x528c80){try{jsonpatch[_0x3a8f('0x34')](_0x528c80,_0x4aadf,!![]);}catch(_0x5cc2dd){return BPromise[_0x3a8f('0x35')](_0x5cc2dd);}return _0x528c80['save']();};}function saveUpdates(_0x29c4c5,_0x4c03b6){return function(_0x434933){if(_0x434933){return _0x434933[_0x3a8f('0x36')](_0x29c4c5)[_0x3a8f('0x22')](function(_0x3f66eb){return _0x3f66eb;});}return null;};}function removeEntity(_0x47541a,_0x1726e4){return function(_0x5588e4){if(_0x5588e4){return _0x5588e4[_0x3a8f('0x37')]()[_0x3a8f('0x22')](function(){_0x47541a[_0x3a8f('0x2e')](0xcc)[_0x3a8f('0x2d')]();});}};}function handleEntityNotFound(_0x4e5b70,_0x2c3c10){return function(_0x644a48){if(!_0x644a48){_0x4e5b70[_0x3a8f('0x2c')](0x194);}return _0x644a48;};}function handleError(_0x435608,_0x4d305f){_0x4d305f=_0x4d305f||0x1f4;return function(_0x5efbda){logger['error'](_0x5efbda['stack']);if(_0x5efbda[_0x3a8f('0x38')]){delete _0x5efbda[_0x3a8f('0x38')];}_0x435608[_0x3a8f('0x2e')](_0x4d305f)[_0x3a8f('0x39')](_0x5efbda);};}exports[_0x3a8f('0x3a')]=function(_0x563ded,_0x21fcf0){var _0x1a28a5={},_0x2bd56e={},_0x32dfa7={'count':0x0,'rows':[]};var _0x278836=_[_0x3a8f('0x3b')](db[_0x3a8f('0x3c')][_0x3a8f('0x3d')],function(_0x4f5961){return{'name':_0x4f5961[_0x3a8f('0x3e')],'type':_0x4f5961['type'][_0x3a8f('0x3f')]};});_0x2bd56e[_0x3a8f('0x40')]=_[_0x3a8f('0x3b')](_0x278836,'name');_0x2bd56e[_0x3a8f('0x41')]=_[_0x3a8f('0x42')](_0x563ded[_0x3a8f('0x41')]);_0x2bd56e[_0x3a8f('0x43')]=_[_0x3a8f('0x44')](_0x2bd56e[_0x3a8f('0x40')],_0x2bd56e[_0x3a8f('0x41')]);_0x1a28a5['attributes']=_['intersection'](_0x2bd56e['model'],qs[_0x3a8f('0x45')](_0x563ded[_0x3a8f('0x41')][_0x3a8f('0x45')]));_0x1a28a5[_0x3a8f('0x46')]=_0x1a28a5[_0x3a8f('0x46')][_0x3a8f('0x47')]?_0x1a28a5[_0x3a8f('0x46')]:_0x2bd56e['model'];if(!_0x563ded['query'][_0x3a8f('0x48')](_0x3a8f('0x49'))){_0x1a28a5[_0x3a8f('0x4a')]=qs['limit'](_0x563ded[_0x3a8f('0x41')][_0x3a8f('0x4a')]);_0x1a28a5[_0x3a8f('0x31')]=qs['offset'](_0x563ded[_0x3a8f('0x41')][_0x3a8f('0x31')]);}_0x1a28a5[_0x3a8f('0x4b')]=qs[_0x3a8f('0x4c')](_0x563ded[_0x3a8f('0x41')]['sort']);_0x1a28a5[_0x3a8f('0x4d')]=qs[_0x3a8f('0x43')](_['pick'](_0x563ded[_0x3a8f('0x41')],_0x2bd56e[_0x3a8f('0x43')]),_0x278836);if(_0x563ded['query'][_0x3a8f('0x4e')]){_0x1a28a5[_0x3a8f('0x4d')]=_[_0x3a8f('0x4f')](_0x1a28a5['where'],{'$or':_[_0x3a8f('0x3b')](_0x278836,function(_0x16d77e){if(_0x16d77e[_0x3a8f('0x50')]!==_0x3a8f('0x51')){var _0x4b4779={};_0x4b4779[_0x16d77e['name']]={'$like':'%'+_0x563ded[_0x3a8f('0x41')][_0x3a8f('0x4e')]+'%'};return _0x4b4779;}})});}_0x1a28a5=_[_0x3a8f('0x4f')]({},_0x1a28a5,_0x563ded[_0x3a8f('0x52')]);var _0x1b99c3={'where':_0x1a28a5[_0x3a8f('0x4d')]};return db[_0x3a8f('0x3c')][_0x3a8f('0x30')](_0x1b99c3)['then'](function(_0x38805a){_0x32dfa7[_0x3a8f('0x30')]=_0x38805a;if(_0x563ded['query'][_0x3a8f('0x53')]){_0x1a28a5[_0x3a8f('0x54')]=[{'all':!![]}];}return db[_0x3a8f('0x3c')]['findAll'](_0x1a28a5);})['then'](function(_0x2dae42){_0x32dfa7[_0x3a8f('0x55')]=_0x2dae42;return _0x32dfa7;})[_0x3a8f('0x22')](respondWithFilteredResult(_0x21fcf0,_0x1a28a5))[_0x3a8f('0x2b')](handleError(_0x21fcf0,null));};exports[_0x3a8f('0x56')]=function(_0xdf1537,_0x105ab3){var _0x2a9cd5={'raw':![],'where':{'id':_0xdf1537[_0x3a8f('0x57')]['id']}},_0x37c5ca={};_0x37c5ca[_0x3a8f('0x40')]=_['keys'](db[_0x3a8f('0x3c')][_0x3a8f('0x3d')]);_0x37c5ca['query']=_['keys'](_0xdf1537[_0x3a8f('0x41')]);_0x37c5ca[_0x3a8f('0x43')]=_[_0x3a8f('0x44')](_0x37c5ca[_0x3a8f('0x40')],_0x37c5ca[_0x3a8f('0x41')]);_0x2a9cd5[_0x3a8f('0x46')]=_[_0x3a8f('0x44')](_0x37c5ca[_0x3a8f('0x40')],qs[_0x3a8f('0x45')](_0xdf1537[_0x3a8f('0x41')][_0x3a8f('0x45')]));_0x2a9cd5[_0x3a8f('0x46')]=_0x2a9cd5[_0x3a8f('0x46')][_0x3a8f('0x47')]?_0x2a9cd5[_0x3a8f('0x46')]:_0x37c5ca['model'];if(_0xdf1537['query'][_0x3a8f('0x53')]){_0x2a9cd5[_0x3a8f('0x54')]=[{'all':!![]}];}_0x2a9cd5=_['merge']({},_0x2a9cd5,_0xdf1537[_0x3a8f('0x52')]);return db[_0x3a8f('0x3c')][_0x3a8f('0x58')](_0x2a9cd5)['then'](handleEntityNotFound(_0x105ab3,null))['then'](respondWithResult(_0x105ab3,null))[_0x3a8f('0x2b')](handleError(_0x105ab3,null));};exports[_0x3a8f('0x59')]=function(_0x44b73c,_0x44c2da){return db[_0x3a8f('0x3c')][_0x3a8f('0x59')](_0x44b73c[_0x3a8f('0x5a')],{})[_0x3a8f('0x22')](respondWithResult(_0x44c2da,0xc9))[_0x3a8f('0x2b')](handleError(_0x44c2da,null));};exports[_0x3a8f('0x36')]=function(_0x17990c,_0x5450d6){if(_0x17990c[_0x3a8f('0x5a')]['id']){delete _0x17990c[_0x3a8f('0x5a')]['id'];}return db[_0x3a8f('0x3c')][_0x3a8f('0x58')]({'where':{'id':_0x17990c[_0x3a8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x5450d6,null))[_0x3a8f('0x22')](saveUpdates(_0x17990c[_0x3a8f('0x5a')],null))[_0x3a8f('0x22')](respondWithResult(_0x5450d6,null))[_0x3a8f('0x2b')](handleError(_0x5450d6,null));};exports['destroy']=function(_0x5f0d04,_0x1c2cb2){return db[_0x3a8f('0x3c')][_0x3a8f('0x58')]({'where':{'id':_0x5f0d04[_0x3a8f('0x57')]['id']}})[_0x3a8f('0x22')](handleEntityNotFound(_0x1c2cb2,null))[_0x3a8f('0x22')](removeEntity(_0x1c2cb2,null))[_0x3a8f('0x2b')](handleError(_0x1c2cb2,null));};exports[_0x3a8f('0x5b')]=function(_0x1d936a,_0x42a041,_0x70c976){var _0x345bc6={};var _0x470deb={};var _0x18fdc9;var _0x529c6c;return db['DeskAccount'][_0x3a8f('0x5c')]({'where':{'id':_0x1d936a[_0x3a8f('0x57')]['id']}})[_0x3a8f('0x22')](handleEntityNotFound(_0x42a041,null))[_0x3a8f('0x22')](function(_0x11a44b){if(_0x11a44b){_0x18fdc9=_0x11a44b;_0x470deb['model']=_[_0x3a8f('0x42')](db[_0x3a8f('0x5d')]['rawAttributes']);_0x470deb[_0x3a8f('0x41')]=_[_0x3a8f('0x42')](_0x1d936a[_0x3a8f('0x41')]);_0x470deb[_0x3a8f('0x43')]=_['intersection'](_0x470deb['model'],_0x470deb['query']);_0x345bc6['attributes']=_[_0x3a8f('0x44')](_0x470deb['model'],qs['fields'](_0x1d936a[_0x3a8f('0x41')][_0x3a8f('0x45')]));_0x345bc6[_0x3a8f('0x46')]=_0x345bc6[_0x3a8f('0x46')][_0x3a8f('0x47')]?_0x345bc6[_0x3a8f('0x46')]:_0x470deb[_0x3a8f('0x40')];_0x345bc6[_0x3a8f('0x4b')]=qs[_0x3a8f('0x4c')](_0x1d936a['query'][_0x3a8f('0x4c')]);_0x345bc6[_0x3a8f('0x4d')]=qs[_0x3a8f('0x43')](_['pick'](_0x1d936a[_0x3a8f('0x41')],_0x470deb[_0x3a8f('0x43')]));if(_0x1d936a[_0x3a8f('0x41')][_0x3a8f('0x4e')]){_0x345bc6[_0x3a8f('0x4d')]=_[_0x3a8f('0x4f')](_0x345bc6[_0x3a8f('0x4d')],{'$or':_[_0x3a8f('0x3b')](_0x345bc6[_0x3a8f('0x46')],function(_0x1df48a){var _0x482a29={};_0x482a29[_0x1df48a]={'$like':'%'+_0x1d936a['query'][_0x3a8f('0x4e')]+'%'};return _0x482a29;})});}_0x345bc6=_[_0x3a8f('0x4f')]({},_0x345bc6,_0x1d936a[_0x3a8f('0x52')]);return _0x18fdc9['getConfigurations'](_0x345bc6);}})[_0x3a8f('0x22')](function(_0xab6b73){if(_0xab6b73){_0x529c6c=_0xab6b73[_0x3a8f('0x47')];if(!_0x1d936a[_0x3a8f('0x41')][_0x3a8f('0x48')](_0x3a8f('0x49'))){_0x345bc6[_0x3a8f('0x4a')]=qs[_0x3a8f('0x4a')](_0x1d936a[_0x3a8f('0x41')][_0x3a8f('0x4a')]);_0x345bc6[_0x3a8f('0x31')]=qs[_0x3a8f('0x31')](_0x1d936a['query'][_0x3a8f('0x31')]);}return _0x18fdc9['getConfigurations'](_0x345bc6);}})['then'](function(_0x35a082){if(_0x35a082){return _0x35a082?{'count':_0x529c6c,'rows':_0x35a082}:null;}})[_0x3a8f('0x22')](respondWithResult(_0x42a041,null))['catch'](handleError(_0x42a041,null));};exports[_0x3a8f('0x5e')]=function(_0xfc356c,_0x509b90,_0x1f49df){if(_0xfc356c[_0x3a8f('0x5a')]['id']){delete _0xfc356c['body']['id'];}return db[_0x3a8f('0x3c')]['findOne']({'where':{'id':_0xfc356c[_0x3a8f('0x57')]['id']}})[_0x3a8f('0x22')](handleEntityNotFound(_0x509b90,null))[_0x3a8f('0x22')](function(_0x1e3424){if(_0x1e3424){_0xfc356c[_0x3a8f('0x5a')][_0x3a8f('0x5f')]=_0x1e3424['id'];_0xfc356c['body'][_0x3a8f('0x60')]=integrations['getSubjects'](_0xfc356c[_0x3a8f('0x5a')]['channel'],_0xfc356c[_0x3a8f('0x5a')][_0x3a8f('0x50')]);_0xfc356c[_0x3a8f('0x5a')]['Descriptions']=integrations[_0x3a8f('0x61')](_0xfc356c[_0x3a8f('0x5a')]['channel'],_0xfc356c[_0x3a8f('0x5a')][_0x3a8f('0x50')]);return db[_0x3a8f('0x5d')]['create'](_0xfc356c[_0x3a8f('0x5a')],{'include':[{'model':db[_0x3a8f('0x62')],'as':_0x3a8f('0x60')},{'model':db[_0x3a8f('0x62')],'as':_0x3a8f('0x63')}]});}return null;})[_0x3a8f('0x22')](respondWithResult(_0x509b90,null))[_0x3a8f('0x2b')](handleError(_0x509b90,null));};exports[_0x3a8f('0x64')]=function(_0x118141,_0x11f096,_0x5a2058){var _0x33adb2=[{'name':'priority','label':_0x3a8f('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 _0x1231d9='';return db[_0x3a8f('0x3c')][_0x3a8f('0x5c')]({'where':{'id':_0x118141[_0x3a8f('0x57')]['id']},'attributes':['id',_0x3a8f('0x66'),_0x3a8f('0x67'),_0x3a8f('0x68'),_0x3a8f('0x69'),_0x3a8f('0x6a'),'consumerSecret',_0x3a8f('0x6b'),_0x3a8f('0x6c')]})[_0x3a8f('0x22')](handleEntityNotFound(_0x11f096,null))['then'](function(_0x3a1123){if(_0x3a1123){_0x1231d9=_0x3a1123[_0x3a8f('0x66')];var _0x40fe5f=_0x1231d9[_0x3a8f('0x6d')](-0x1);if(_0x40fe5f==='/'){_0x1231d9=_0x1231d9[_0x3a8f('0x6e')](0x0,_0x1231d9[_0x3a8f('0x6f')](_0x40fe5f));}var _0x540b05={'method':'GET','uri':util[_0x3a8f('0x70')]('%s/custom_fields',_0x1231d9),'headers':{'Content-Type':'application/json','Accept':_0x3a8f('0x71')},'json':!![]};if(_0x3a1123[_0x3a8f('0x67')]===_0x3a8f('0x72')){_0x540b05[_0x3a8f('0x73')][_0x3a8f('0x74')]=util[_0x3a8f('0x70')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x3a1123['username'],_0x3a1123[_0x3a8f('0x69')]))['toString'](_0x3a8f('0x75')));}return rp(_0x540b05)[_0x3a8f('0x22')](function(_0x59ce9b){return _0x33adb2[_0x3a8f('0x76')](_[_0x3a8f('0x3b')](_0x59ce9b[_0x3a8f('0x77')][_0x3a8f('0x78')],function(_0x4131c3){return{'id':_0x4131c3[_0x3a8f('0x38')],'name':_0x4131c3[_0x3a8f('0x38')],'type':_0x4131c3[_0x3a8f('0x50')],'active':_0x4131c3[_0x3a8f('0x79')],'label':_0x4131c3[_0x3a8f('0x7a')],'custom':!![]};}));});}})['then'](function(_0x3c391f){return{'count':_0x3c391f[_0x3a8f('0x47')],'rows':_0x3c391f};})[_0x3a8f('0x22')](respondWithResult(_0x11f096,null))[_0x3a8f('0x2b')](function(_0x3075f1){var _0x579d82=_0x118141[_0x3a8f('0x41')]['test']?0x1f4:_0x3075f1['statusCode']||0x1f4;logger[_0x3a8f('0x26')](_0x3a8f('0x7b'),'getFields',_0x579d82,JSON[_0x3a8f('0x7c')](_0x3075f1));delete _0x3075f1[_0x3a8f('0x38')];if(_0x579d82===0x191){_0x579d82=0x190;}_0x11f096[_0x3a8f('0x2e')](_0x579d82)[_0x3a8f('0x39')](_0x118141[_0x3a8f('0x41')]['test']?{'message':_0x3a8f('0x7d'),'statusCode':_0x3075f1[_0x3a8f('0x7e')]}:_0x3075f1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3f1ebda..2cb6427 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 _0x0b82=['api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x28ea95,_0x20536f){var _0x52860a=function(_0x27fdd7){while(--_0x27fdd7){_0x28ea95['push'](_0x28ea95['shift']());}};_0x52860a(++_0x20536f);}(_0x0b82,0x1ed));var _0x20b8=function(_0x3f4c41,_0x2436b8){_0x3f4c41=_0x3f4c41-0x0;var _0x347273=_0x0b82[_0x3f4c41];return _0x347273;};'use strict';var _=require(_0x20b8('0x0'));var util=require(_0x20b8('0x1'));var logger=require('../../config/logger')(_0x20b8('0x2'));var moment=require(_0x20b8('0x3'));var BPromise=require(_0x20b8('0x4'));var rp=require(_0x20b8('0x5'));var fs=require('fs');var path=require(_0x20b8('0x6'));var rimraf=require('rimraf');var config=require(_0x20b8('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x20b8('0x8'));module['exports']=function(_0x35d076,_0x2c34aa){return _0x35d076['define'](_0x20b8('0x9'),attributes,{'tableName':_0x20b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6185=['define','int_desk_accounts','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskAccount.attributes','exports'];(function(_0x3eff21,_0x5bf36c){var _0x1945bb=function(_0x319a9e){while(--_0x319a9e){_0x3eff21['push'](_0x3eff21['shift']());}};_0x1945bb(++_0x5bf36c);}(_0x6185,0x110));var _0x5618=function(_0x3cc718,_0x410186){_0x3cc718=_0x3cc718-0x0;var _0x3a607e=_0x6185[_0x3cc718];return _0x3a607e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5618('0x0'))(_0x5618('0x1'));var moment=require(_0x5618('0x2'));var BPromise=require(_0x5618('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5618('0x4'));var config=require(_0x5618('0x5'));var attributes=require(_0x5618('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x5618('0x7')]=function(_0x210c14,_0x1f756e){return _0x210c14[_0x5618('0x8')]('DeskAccount',attributes,{'tableName':_0x5618('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index e14ec4c..97207d1 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 _0xfc60=['request\x20sent','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','raw','options','where','attributes','limit','include','map','model','ShowDeskAccount','find','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x436cd7,_0x761226){var _0x2de5ba=function(_0x1ce00f){while(--_0x1ce00f){_0x436cd7['push'](_0x436cd7['shift']());}};_0x2de5ba(++_0x761226);}(_0xfc60,0x15d));var _0x0fc6=function(_0xbe41ba,_0x384563){_0xbe41ba=_0xbe41ba-0x0;var _0x2c2085=_0xfc60[_0xbe41ba];return _0x2c2085;};'use strict';var _=require(_0x0fc6('0x0'));var util=require(_0x0fc6('0x1'));var moment=require(_0x0fc6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0fc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fc6('0x4'))['db'];var utils=require(_0x0fc6('0x5'));var logger=require(_0x0fc6('0x6'))(_0x0fc6('0x7'));var config=require(_0x0fc6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0fc6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23b1e0,_0x1cfa50,_0xe5a675){return new BPromise(function(_0x457ec6,_0x3dc35b){return client[_0x0fc6('0xa')](_0x23b1e0,_0xe5a675)[_0x0fc6('0xb')](function(_0x481a1c){logger[_0x0fc6('0xc')](_0x0fc6('0xd'),_0x1cfa50,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1cfa50,_0x0fc6('0xe'),JSON[_0x0fc6('0xf')](_0x481a1c));if(_0x481a1c[_0x0fc6('0x10')]){if(_0x481a1c[_0x0fc6('0x10')]['code']===0x1f4){logger[_0x0fc6('0x10')](_0x0fc6('0xd'),_0x1cfa50,_0x481a1c[_0x0fc6('0x10')][_0x0fc6('0x11')]);return _0x3dc35b(_0x481a1c[_0x0fc6('0x10')][_0x0fc6('0x11')]);}logger[_0x0fc6('0x10')](_0x0fc6('0xd'),_0x1cfa50,_0x481a1c[_0x0fc6('0x10')][_0x0fc6('0x11')]);return _0x457ec6(_0x481a1c['error'][_0x0fc6('0x11')]);}else{logger[_0x0fc6('0xc')]('DeskAccount,\x20%s,\x20%s',_0x1cfa50,_0x0fc6('0xe'));_0x457ec6(_0x481a1c[_0x0fc6('0x12')][_0x0fc6('0x11')]);}})[_0x0fc6('0x13')](function(_0x3f1bb1){logger['error']('DeskAccount,\x20%s,\x20%s',_0x1cfa50,_0x3f1bb1);_0x3dc35b(_0x3f1bb1);});});}exports[_0x0fc6('0x14')]=function(_0x5df99c){var _0x4a82d8=this;return new Promise(function(_0x16d482,_0x581b5b){return db[_0x0fc6('0x15')]['findAll']({'raw':_0x5df99c['options']?_0x5df99c['options'][_0x0fc6('0x16')]===undefined?!![]:![]:!![],'where':_0x5df99c[_0x0fc6('0x17')]?_0x5df99c[_0x0fc6('0x17')][_0x0fc6('0x18')]||null:null,'attributes':_0x5df99c[_0x0fc6('0x17')]?_0x5df99c['options'][_0x0fc6('0x19')]||null:null,'limit':_0x5df99c[_0x0fc6('0x17')]?_0x5df99c[_0x0fc6('0x17')][_0x0fc6('0x1a')]||null:null,'include':_0x5df99c['options']?_0x5df99c[_0x0fc6('0x17')][_0x0fc6('0x1b')]?_[_0x0fc6('0x1c')](_0x5df99c['options']['include'],function(_0x140133){return{'model':db[_0x140133[_0x0fc6('0x1d')]],'as':_0x140133['as'],'attributes':_0x140133[_0x0fc6('0x19')],'include':_0x140133[_0x0fc6('0x1b')]?_[_0x0fc6('0x1c')](_0x140133[_0x0fc6('0x1b')],function(_0x375630){return{'model':db[_0x375630['model']],'as':_0x375630['as'],'attributes':_0x375630[_0x0fc6('0x19')],'include':_0x375630['include']?_['map'](_0x375630[_0x0fc6('0x1b')],function(_0x456584){return{'model':db[_0x456584['model']],'as':_0x456584['as'],'attributes':_0x456584['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22254a){logger[_0x0fc6('0xc')](_0x0fc6('0x14'),_0x5df99c);logger['debug'](_0x0fc6('0x14'),_0x5df99c,JSON[_0x0fc6('0xf')](_0x22254a));_0x16d482(_0x22254a);})[_0x0fc6('0x13')](function(_0x406d9d){logger[_0x0fc6('0x10')](_0x0fc6('0x14'),_0x406d9d['message'],_0x5df99c);_0x581b5b(_0x4a82d8['error'](0x1f4,_0x406d9d[_0x0fc6('0x11')]));});});};exports[_0x0fc6('0x1e')]=function(_0x5b838a){var _0xdb723=this;return new Promise(function(_0x18a7f2,_0x1bd9d1){return db[_0x0fc6('0x15')][_0x0fc6('0x1f')]({'raw':_0x5b838a[_0x0fc6('0x17')]?_0x5b838a[_0x0fc6('0x17')][_0x0fc6('0x16')]===undefined?!![]:![]:!![],'where':_0x5b838a['options']?_0x5b838a['options']['where']||null:null,'attributes':_0x5b838a[_0x0fc6('0x17')]?_0x5b838a['options'][_0x0fc6('0x19')]||null:null,'include':_0x5b838a[_0x0fc6('0x17')]?_0x5b838a[_0x0fc6('0x17')][_0x0fc6('0x1b')]?_['map'](_0x5b838a[_0x0fc6('0x17')]['include'],function(_0x49ed2b){return{'model':db[_0x49ed2b[_0x0fc6('0x1d')]],'as':_0x49ed2b['as'],'attributes':_0x49ed2b['attributes'],'include':_0x49ed2b[_0x0fc6('0x1b')]?_[_0x0fc6('0x1c')](_0x49ed2b[_0x0fc6('0x1b')],function(_0x222e14){return{'model':db[_0x222e14['model']],'as':_0x222e14['as'],'attributes':_0x222e14[_0x0fc6('0x19')],'include':_0x222e14[_0x0fc6('0x1b')]?_[_0x0fc6('0x1c')](_0x222e14[_0x0fc6('0x1b')],function(_0x5cd255){return{'model':db[_0x5cd255[_0x0fc6('0x1d')]],'as':_0x5cd255['as'],'attributes':_0x5cd255[_0x0fc6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0fc6('0xb')](function(_0x22ae2c){logger['info'](_0x0fc6('0x1e'),_0x5b838a);logger[_0x0fc6('0x20')](_0x0fc6('0x1e'),_0x5b838a,JSON[_0x0fc6('0xf')](_0x22ae2c));_0x18a7f2(_0x22ae2c);})[_0x0fc6('0x13')](function(_0x24abec){logger['error'](_0x0fc6('0x1e'),_0x24abec['message'],_0x5b838a);_0x1bd9d1(_0xdb723[_0x0fc6('0x10')](0x1f4,_0x24abec['message']));});});}; \ No newline at end of file +var _0xd726=['DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowDeskAccount','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x1cf714,_0xa751b9){var _0x172a26=function(_0x9bb1de){while(--_0x9bb1de){_0x1cf714['push'](_0x1cf714['shift']());}};_0x172a26(++_0xa751b9);}(_0xd726,0xc5));var _0x6d72=function(_0x582809,_0xa6949d){_0x582809=_0x582809-0x0;var _0x4c9294=_0xd726[_0x582809];return _0x4c9294;};'use strict';var _=require(_0x6d72('0x0'));var util=require(_0x6d72('0x1'));var moment=require(_0x6d72('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d72('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d72('0x4'))['db'];var utils=require(_0x6d72('0x5'));var logger=require(_0x6d72('0x6'))(_0x6d72('0x7'));var config=require('../../config/environment');var jayson=require(_0x6d72('0x8'));var client=jayson[_0x6d72('0x9')][_0x6d72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0a3c,_0x7b214,_0x450b6a){return new BPromise(function(_0x38d5a1,_0x98b16b){return client['request'](_0x2b0a3c,_0x450b6a)[_0x6d72('0xb')](function(_0x273c05){logger[_0x6d72('0xc')](_0x6d72('0xd'),_0x7b214,_0x6d72('0xe'));logger[_0x6d72('0xf')](_0x6d72('0x10'),_0x7b214,_0x6d72('0xe'),JSON['stringify'](_0x273c05));if(_0x273c05[_0x6d72('0x11')]){if(_0x273c05['error'][_0x6d72('0x12')]===0x1f4){logger[_0x6d72('0x11')](_0x6d72('0xd'),_0x7b214,_0x273c05[_0x6d72('0x11')][_0x6d72('0x13')]);return _0x98b16b(_0x273c05[_0x6d72('0x11')]['message']);}logger[_0x6d72('0x11')](_0x6d72('0xd'),_0x7b214,_0x273c05['error'][_0x6d72('0x13')]);return _0x38d5a1(_0x273c05['error'][_0x6d72('0x13')]);}else{logger[_0x6d72('0xc')]('DeskAccount,\x20%s,\x20%s',_0x7b214,_0x6d72('0xe'));_0x38d5a1(_0x273c05[_0x6d72('0x14')]['message']);}})[_0x6d72('0x15')](function(_0x4518a0){logger['error'](_0x6d72('0xd'),_0x7b214,_0x4518a0);_0x98b16b(_0x4518a0);});});}exports[_0x6d72('0x16')]=function(_0x41f5b8){var _0xf8e52b=this;return new Promise(function(_0x599e05,_0x2d1ffb){return db[_0x6d72('0x17')][_0x6d72('0x18')]({'raw':_0x41f5b8[_0x6d72('0x19')]?_0x41f5b8[_0x6d72('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x41f5b8[_0x6d72('0x19')]?_0x41f5b8[_0x6d72('0x19')][_0x6d72('0x1a')]||null:null,'attributes':_0x41f5b8[_0x6d72('0x19')]?_0x41f5b8[_0x6d72('0x19')][_0x6d72('0x1b')]||null:null,'limit':_0x41f5b8[_0x6d72('0x19')]?_0x41f5b8[_0x6d72('0x19')][_0x6d72('0x1c')]||null:null,'include':_0x41f5b8[_0x6d72('0x19')]?_0x41f5b8[_0x6d72('0x19')][_0x6d72('0x1d')]?_[_0x6d72('0x1e')](_0x41f5b8[_0x6d72('0x19')]['include'],function(_0x4c8ada){return{'model':db[_0x4c8ada[_0x6d72('0x1f')]],'as':_0x4c8ada['as'],'attributes':_0x4c8ada[_0x6d72('0x1b')],'include':_0x4c8ada[_0x6d72('0x1d')]?_[_0x6d72('0x1e')](_0x4c8ada[_0x6d72('0x1d')],function(_0x1e534f){return{'model':db[_0x1e534f[_0x6d72('0x1f')]],'as':_0x1e534f['as'],'attributes':_0x1e534f[_0x6d72('0x1b')],'include':_0x1e534f[_0x6d72('0x1d')]?_[_0x6d72('0x1e')](_0x1e534f['include'],function(_0x59b73d){return{'model':db[_0x59b73d[_0x6d72('0x1f')]],'as':_0x59b73d['as'],'attributes':_0x59b73d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d72('0xb')](function(_0x504e99){logger[_0x6d72('0xc')]('GetDeskAccount',_0x41f5b8);logger['debug']('GetDeskAccount',_0x41f5b8,JSON[_0x6d72('0x20')](_0x504e99));_0x599e05(_0x504e99);})[_0x6d72('0x15')](function(_0x502a55){logger[_0x6d72('0x11')](_0x6d72('0x16'),_0x502a55[_0x6d72('0x13')],_0x41f5b8);_0x2d1ffb(_0xf8e52b[_0x6d72('0x11')](0x1f4,_0x502a55[_0x6d72('0x13')]));});});};exports[_0x6d72('0x21')]=function(_0x2758f7){var _0xab19f7=this;return new Promise(function(_0x4aa515,_0x1bb945){return db[_0x6d72('0x17')]['find']({'raw':_0x2758f7[_0x6d72('0x19')]?_0x2758f7[_0x6d72('0x19')][_0x6d72('0x22')]===undefined?!![]:![]:!![],'where':_0x2758f7[_0x6d72('0x19')]?_0x2758f7[_0x6d72('0x19')][_0x6d72('0x1a')]||null:null,'attributes':_0x2758f7['options']?_0x2758f7[_0x6d72('0x19')][_0x6d72('0x1b')]||null:null,'include':_0x2758f7[_0x6d72('0x19')]?_0x2758f7['options'][_0x6d72('0x1d')]?_['map'](_0x2758f7['options'][_0x6d72('0x1d')],function(_0x28e1ab){return{'model':db[_0x28e1ab['model']],'as':_0x28e1ab['as'],'attributes':_0x28e1ab[_0x6d72('0x1b')],'include':_0x28e1ab[_0x6d72('0x1d')]?_['map'](_0x28e1ab[_0x6d72('0x1d')],function(_0x58d939){return{'model':db[_0x58d939[_0x6d72('0x1f')]],'as':_0x58d939['as'],'attributes':_0x58d939[_0x6d72('0x1b')],'include':_0x58d939[_0x6d72('0x1d')]?_[_0x6d72('0x1e')](_0x58d939[_0x6d72('0x1d')],function(_0x4400d2){return{'model':db[_0x4400d2['model']],'as':_0x4400d2['as'],'attributes':_0x4400d2[_0x6d72('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d72('0xb')](function(_0x294ef7){logger[_0x6d72('0xc')](_0x6d72('0x21'),_0x2758f7);logger[_0x6d72('0xf')](_0x6d72('0x21'),_0x2758f7,JSON[_0x6d72('0x20')](_0x294ef7));_0x4aa515(_0x294ef7);})['catch'](function(_0x442be7){logger[_0x6d72('0x11')]('ShowDeskAccount',_0x442be7[_0x6d72('0x13')],_0x2758f7);_0x1bb945(_0xab19f7[_0x6d72('0x11')](0x1f4,_0x442be7['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e7b8777..fa52834 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 _0x8f1a=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','/:id','destroy','exports','multer','util'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x2e9efe,_0x5e5a95){_0x2e9efe=_0x2e9efe-0x0;var _0x53b696=_0x8f1a[_0x2e9efe];return _0x53b696;};'use strict';var multer=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var path=require(_0xa8f1('0x2'));var timeout=require(_0xa8f1('0x3'));var express=require(_0xa8f1('0x4'));var router=express[_0xa8f1('0x5')]();var auth=require(_0xa8f1('0x6'));var interaction=require(_0xa8f1('0x7'));var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router[_0xa8f1('0x8')]('/',auth['isAuthenticated'](),controller[_0xa8f1('0x9')]);router[_0xa8f1('0x8')]('/:id',auth[_0xa8f1('0xa')](),controller[_0xa8f1('0xb')]);router[_0xa8f1('0x8')](_0xa8f1('0xc'),auth[_0xa8f1('0xa')](),controller[_0xa8f1('0xd')]);router[_0xa8f1('0x8')](_0xa8f1('0xe'),auth['isAuthenticated'](),controller[_0xa8f1('0xf')]);router[_0xa8f1('0x8')]('/:id/descriptions',auth[_0xa8f1('0xa')](),controller['getDescriptions']);router[_0xa8f1('0x8')](_0xa8f1('0x10'),auth[_0xa8f1('0xa')](),controller['getTags']);router[_0xa8f1('0x11')]('/',auth[_0xa8f1('0xa')](),controller[_0xa8f1('0x12')]);router[_0xa8f1('0x11')](_0xa8f1('0x10'),auth['isAuthenticated'](),controller[_0xa8f1('0x13')]);router['put'](_0xa8f1('0x14'),auth[_0xa8f1('0xa')](),controller['update']);router['delete'](_0xa8f1('0x14'),auth[_0xa8f1('0xa')](),controller[_0xa8f1('0x15')]);module[_0xa8f1('0x16')]=router; \ No newline at end of file +var _0xdc86=['index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','setTags','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xdc86,0x118));var _0x6dc8=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xdc86[_0x4c445a];return _0x2f611c;};'use strict';var multer=require('multer');var util=require(_0x6dc8('0x0'));var path=require('path');var timeout=require(_0x6dc8('0x1'));var express=require('express');var router=express[_0x6dc8('0x2')]();var auth=require(_0x6dc8('0x3'));var interaction=require(_0x6dc8('0x4'));var config=require(_0x6dc8('0x5'));var controller=require(_0x6dc8('0x6'));router['get']('/',auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x8')]);router[_0x6dc8('0x9')](_0x6dc8('0xa'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0xb')]);router[_0x6dc8('0x9')](_0x6dc8('0xc'),auth['isAuthenticated'](),controller[_0x6dc8('0xd')]);router['get'](_0x6dc8('0xe'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0xf')]);router[_0x6dc8('0x9')]('/:id/descriptions',auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x10')]);router[_0x6dc8('0x9')](_0x6dc8('0x11'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x12')]);router['post']('/',auth[_0x6dc8('0x7')](),controller['create']);router['post'](_0x6dc8('0x11'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x13')]);router['put'](_0x6dc8('0xa'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x14')]);router[_0x6dc8('0x15')](_0x6dc8('0xa'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x16')]);module[_0x6dc8('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d0758e1..ceedda8 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 _0xdc5e=['STRING','sequelize','exports'];(function(_0x420de1,_0x2e9763){var _0x4bd929=function(_0x4f07fd){while(--_0x4f07fd){_0x420de1['push'](_0x420de1['shift']());}};_0x4bd929(++_0x2e9763);}(_0xdc5e,0x10c));var _0xedc5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdc5e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xedc5('0x0'));module[_0xedc5('0x1')]={'name':{'type':Sequelize[_0xedc5('0x2')]},'description':{'type':Sequelize[_0xedc5('0x2')]}}; \ No newline at end of file +var _0xef5e=['sequelize','exports','STRING'];(function(_0x2e82c2,_0x3ca803){var _0x9af733=function(_0x3f258a){while(--_0x3f258a){_0x2e82c2['push'](_0x2e82c2['shift']());}};_0x9af733(++_0x3ca803);}(_0xef5e,0x9c));var _0xeef5=function(_0x379b40,_0x1971e6){_0x379b40=_0x379b40-0x0;var _0x30c96f=_0xef5e[_0x379b40];return _0x30c96f;};'use strict';var Sequelize=require(_0xeef5('0x0'));module[_0xeef5('0x1')]={'name':{'type':Sequelize[_0xeef5('0x2')]},'description':{'type':Sequelize[_0xeef5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4bc04b8..a7dbb0d 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 _0xec5d=['getFields','findOne','DeskField','map','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','count','limit','set','json','save','update','destroy','end','stack','name','index','DeskConfiguration','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','create','body','find'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xec5d,0x172));var _0xdec5=function(_0x380493,_0xfd6d7d){_0x380493=_0x380493-0x0;var _0x4e3481=_0xec5d[_0x380493];return _0x4e3481;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdec5('0x0'));var rimraf=require(_0xdec5('0x1'));var zipdir=require(_0xdec5('0x2'));var jsonpatch=require(_0xdec5('0x3'));var rp=require(_0xdec5('0x4'));var moment=require('moment');var BPromise=require(_0xdec5('0x5'));var Mustache=require(_0xdec5('0x6'));var util=require(_0xdec5('0x7'));var path=require(_0xdec5('0x8'));var sox=require(_0xdec5('0x9'));var csv=require(_0xdec5('0xa'));var ejs=require(_0xdec5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdec5('0xc'));var crypto=require(_0xdec5('0xd'));var jsforce=require(_0xdec5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdec5('0xa'));var querystring=require('querystring');var Papa=require(_0xdec5('0xf'));var Redis=require('ioredis');var authService=require(_0xdec5('0x10'));var qs=require(_0xdec5('0x11'));var as=require(_0xdec5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdec5('0x13'));var utils=require(_0xdec5('0x14'));var config=require(_0xdec5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdec5('0x16'))['db'];var jayson=require(_0xdec5('0x17'));var client=jayson[_0xdec5('0x18')][_0xdec5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x45dcab,_0x24504d,_0x2616f4,_0x5f20eb){return new BPromise(function(_0x166fd2,_0x497da0){var _0x6ce8f8=_0x5f20eb||client;return _0x6ce8f8[_0xdec5('0x1a')](_0x45dcab,_0x2616f4)[_0xdec5('0x1b')](function(_0x5aeba5){logger[_0xdec5('0x1c')](_0xdec5('0x1d'),_0x24504d,_0xdec5('0x1e'));logger[_0xdec5('0x1f')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x24504d,_0xdec5('0x1e'),JSON[_0xdec5('0x20')](_0x5aeba5));if(_0x5aeba5[_0xdec5('0x21')]){if(_0x5aeba5['error'][_0xdec5('0x22')]===0x1f4){logger[_0xdec5('0x21')](_0xdec5('0x1d'),_0x24504d,_0x5aeba5[_0xdec5('0x21')]['message']);return _0x497da0(_0x5aeba5[_0xdec5('0x21')][_0xdec5('0x23')]);}logger[_0xdec5('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x24504d,_0x5aeba5[_0xdec5('0x21')]['message']);return _0x166fd2(_0x5aeba5[_0xdec5('0x21')]['message']);}else{logger[_0xdec5('0x1c')]('DeskConfiguration,\x20%s,\x20%s',_0x24504d,_0xdec5('0x1e'));_0x166fd2(_0x5aeba5[_0xdec5('0x24')]['message']);}})[_0xdec5('0x25')](function(_0x15a85d){logger[_0xdec5('0x21')](_0xdec5('0x1d'),_0x24504d,_0x15a85d);_0x497da0(_0x15a85d);});});}function respondWithStatusCode(_0x591bec,_0x49403c){_0x49403c=_0x49403c||0xcc;return function(_0x221da9){if(_0x221da9){return _0x591bec[_0xdec5('0x26')](_0x49403c);}return _0x591bec[_0xdec5('0x27')](_0x49403c)['end']();};}function respondWithResult(_0x33800e,_0x30b3d8){_0x30b3d8=_0x30b3d8||0xc8;return function(_0x1924d4){if(_0x1924d4){return _0x33800e['status'](_0x30b3d8)['json'](_0x1924d4);}};}function respondWithFilteredResult(_0x46c72d,_0x599de9){return function(_0x1307ef){if(_0x1307ef){var _0x33f895=_0x1307ef[_0xdec5('0x28')],_0x44cddf=_0x599de9['offset'],_0x490b43=_0x599de9['offset']+_0x599de9[_0xdec5('0x29')],_0x19d562;if(_0x490b43>=_0x33f895){_0x490b43=_0x33f895;_0x19d562=0xc8;}else{_0x19d562=0xce;}_0x46c72d[_0xdec5('0x27')](_0x19d562);return _0x46c72d[_0xdec5('0x2a')]('Content-Range',_0x44cddf+'-'+_0x490b43+'/'+_0x33f895)[_0xdec5('0x2b')](_0x1307ef);}return null;};}function patchUpdates(_0x103d91){return function(_0x2b320b){try{jsonpatch['apply'](_0x2b320b,_0x103d91,!![]);}catch(_0x36a6ba){return BPromise['reject'](_0x36a6ba);}return _0x2b320b[_0xdec5('0x2c')]();};}function saveUpdates(_0x296569,_0x45c86b){return function(_0xdc941e){if(_0xdc941e){return _0xdc941e[_0xdec5('0x2d')](_0x296569)[_0xdec5('0x1b')](function(_0x374c60){return _0x374c60;});}return null;};}function removeEntity(_0x346738,_0x2b2b4a){return function(_0x914594){if(_0x914594){return _0x914594[_0xdec5('0x2e')]()['then'](function(){_0x346738[_0xdec5('0x27')](0xcc)[_0xdec5('0x2f')]();});}};}function handleEntityNotFound(_0x443295,_0xba2552){return function(_0x3ae808){if(!_0x3ae808){_0x443295[_0xdec5('0x26')](0x194);}return _0x3ae808;};}function handleError(_0x34ded2,_0x50b65c){_0x50b65c=_0x50b65c||0x1f4;return function(_0xcae533){logger['error'](_0xcae533[_0xdec5('0x30')]);if(_0xcae533[_0xdec5('0x31')]){delete _0xcae533[_0xdec5('0x31')];}_0x34ded2['status'](_0x50b65c)['send'](_0xcae533);};}exports[_0xdec5('0x32')]=function(_0x29cbbc,_0x5d6020){var _0x26982a={},_0x621e31={},_0x5ee27e={'count':0x0,'rows':[]};var _0x101baa=_['map'](db[_0xdec5('0x33')]['rawAttributes'],function(_0x5220b5){return{'name':_0x5220b5['fieldName'],'type':_0x5220b5['type']['key']};});_0x621e31[_0xdec5('0x34')]=_['map'](_0x101baa,_0xdec5('0x31'));_0x621e31[_0xdec5('0x35')]=_[_0xdec5('0x36')](_0x29cbbc[_0xdec5('0x35')]);_0x621e31[_0xdec5('0x37')]=_['intersection'](_0x621e31[_0xdec5('0x34')],_0x621e31[_0xdec5('0x35')]);_0x26982a[_0xdec5('0x38')]=_[_0xdec5('0x39')](_0x621e31[_0xdec5('0x34')],qs[_0xdec5('0x3a')](_0x29cbbc[_0xdec5('0x35')][_0xdec5('0x3a')]));_0x26982a['attributes']=_0x26982a[_0xdec5('0x38')]['length']?_0x26982a[_0xdec5('0x38')]:_0x621e31['model'];if(!_0x29cbbc['query'][_0xdec5('0x3b')]('nolimit')){_0x26982a[_0xdec5('0x29')]=qs[_0xdec5('0x29')](_0x29cbbc['query'][_0xdec5('0x29')]);_0x26982a['offset']=qs['offset'](_0x29cbbc[_0xdec5('0x35')][_0xdec5('0x3c')]);}_0x26982a[_0xdec5('0x3d')]=qs[_0xdec5('0x3e')](_0x29cbbc[_0xdec5('0x35')]['sort']);_0x26982a[_0xdec5('0x3f')]=qs[_0xdec5('0x37')](_[_0xdec5('0x40')](_0x29cbbc[_0xdec5('0x35')],_0x621e31[_0xdec5('0x37')]),_0x101baa);if(_0x29cbbc['query'][_0xdec5('0x41')]){_0x26982a[_0xdec5('0x3f')]=_[_0xdec5('0x42')](_0x26982a[_0xdec5('0x3f')],{'$or':_['map'](_0x101baa,function(_0x28f4ae){if(_0x28f4ae[_0xdec5('0x43')]!==_0xdec5('0x44')){var _0xa0f61e={};_0xa0f61e[_0x28f4ae[_0xdec5('0x31')]]={'$like':'%'+_0x29cbbc[_0xdec5('0x35')][_0xdec5('0x41')]+'%'};return _0xa0f61e;}})});}_0x26982a=_[_0xdec5('0x42')]({},_0x26982a,_0x29cbbc[_0xdec5('0x45')]);var _0x26da41={'where':_0x26982a[_0xdec5('0x3f')]};return db[_0xdec5('0x33')][_0xdec5('0x28')](_0x26da41)['then'](function(_0x3a71d1){_0x5ee27e['count']=_0x3a71d1;if(_0x29cbbc[_0xdec5('0x35')][_0xdec5('0x46')]){_0x26982a[_0xdec5('0x47')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xdec5('0x48')](_0x26982a);})[_0xdec5('0x1b')](function(_0x308808){_0x5ee27e[_0xdec5('0x49')]=_0x308808;return _0x5ee27e;})[_0xdec5('0x1b')](respondWithFilteredResult(_0x5d6020,_0x26982a))['catch'](handleError(_0x5d6020,null));};exports['show']=function(_0x18596d,_0x388a04){var _0x305b21={'raw':![],'where':{'id':_0x18596d[_0xdec5('0x4a')]['id']}},_0x25be8f={};_0x25be8f['model']=_[_0xdec5('0x36')](db['DeskConfiguration'][_0xdec5('0x4b')]);_0x25be8f['query']=_[_0xdec5('0x36')](_0x18596d['query']);_0x25be8f[_0xdec5('0x37')]=_[_0xdec5('0x39')](_0x25be8f[_0xdec5('0x34')],_0x25be8f['query']);_0x305b21[_0xdec5('0x38')]=_[_0xdec5('0x39')](_0x25be8f[_0xdec5('0x34')],qs[_0xdec5('0x3a')](_0x18596d['query'][_0xdec5('0x3a')]));_0x305b21['attributes']=_0x305b21[_0xdec5('0x38')][_0xdec5('0x4c')]?_0x305b21[_0xdec5('0x38')]:_0x25be8f['model'];if(_0x18596d['query'][_0xdec5('0x46')]){_0x305b21[_0xdec5('0x47')]=[{'all':!![]}];}_0x305b21=_[_0xdec5('0x42')]({},_0x305b21,_0x18596d['options']);return db[_0xdec5('0x33')]['find'](_0x305b21)[_0xdec5('0x1b')](handleEntityNotFound(_0x388a04,null))[_0xdec5('0x1b')](respondWithResult(_0x388a04,null))[_0xdec5('0x25')](handleError(_0x388a04,null));};exports[_0xdec5('0x4d')]=function(_0x535e30,_0x107f50){return db[_0xdec5('0x33')][_0xdec5('0x4d')](_0x535e30[_0xdec5('0x4e')],{})[_0xdec5('0x1b')](respondWithResult(_0x107f50,0xc9))['catch'](handleError(_0x107f50,null));};exports[_0xdec5('0x2d')]=function(_0x52bc9c,_0x4c6281){if(_0x52bc9c[_0xdec5('0x4e')]['id']){delete _0x52bc9c[_0xdec5('0x4e')]['id'];}return db[_0xdec5('0x33')]['find']({'where':{'id':_0x52bc9c[_0xdec5('0x4a')]['id']}})[_0xdec5('0x1b')](handleEntityNotFound(_0x4c6281,null))[_0xdec5('0x1b')](saveUpdates(_0x52bc9c[_0xdec5('0x4e')],null))[_0xdec5('0x1b')](respondWithResult(_0x4c6281,null))[_0xdec5('0x25')](handleError(_0x4c6281,null));};exports[_0xdec5('0x2e')]=function(_0x26aa90,_0x107ec4){return db[_0xdec5('0x33')][_0xdec5('0x4f')]({'where':{'id':_0x26aa90[_0xdec5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x107ec4,null))[_0xdec5('0x1b')](removeEntity(_0x107ec4,null))['catch'](handleError(_0x107ec4,null));};exports[_0xdec5('0x50')]=function(_0x2f1c04,_0x150f72,_0x1dc066){var _0x1b8ee3={};var _0x414c68={};var _0x514de4;var _0x11a62d;return db[_0xdec5('0x33')][_0xdec5('0x51')]({'where':{'id':_0x2f1c04[_0xdec5('0x4a')]['id']}})[_0xdec5('0x1b')](handleEntityNotFound(_0x150f72,null))[_0xdec5('0x1b')](function(_0x296b16){if(_0x296b16){_0x514de4=_0x296b16;_0x414c68[_0xdec5('0x34')]=_['keys'](db[_0xdec5('0x52')][_0xdec5('0x4b')]);_0x414c68[_0xdec5('0x35')]=_['keys'](_0x2f1c04['query']);_0x414c68['filters']=_[_0xdec5('0x39')](_0x414c68[_0xdec5('0x34')],_0x414c68[_0xdec5('0x35')]);_0x1b8ee3['attributes']=_[_0xdec5('0x39')](_0x414c68['model'],qs['fields'](_0x2f1c04[_0xdec5('0x35')][_0xdec5('0x3a')]));_0x1b8ee3['attributes']=_0x1b8ee3[_0xdec5('0x38')]['length']?_0x1b8ee3[_0xdec5('0x38')]:_0x414c68[_0xdec5('0x34')];_0x1b8ee3[_0xdec5('0x3d')]=qs[_0xdec5('0x3e')](_0x2f1c04[_0xdec5('0x35')]['sort']);_0x1b8ee3['where']=qs['filters'](_['pick'](_0x2f1c04[_0xdec5('0x35')],_0x414c68[_0xdec5('0x37')]));if(_0x2f1c04[_0xdec5('0x35')]['filter']){_0x1b8ee3[_0xdec5('0x3f')]=_[_0xdec5('0x42')](_0x1b8ee3[_0xdec5('0x3f')],{'$or':_[_0xdec5('0x53')](_0x1b8ee3[_0xdec5('0x38')],function(_0x3b514a){var _0x5e10b1={};_0x5e10b1[_0x3b514a]={'$like':'%'+_0x2f1c04['query'][_0xdec5('0x41')]+'%'};return _0x5e10b1;})});}_0x1b8ee3=_[_0xdec5('0x42')]({},_0x1b8ee3,_0x2f1c04[_0xdec5('0x45')]);return _0x514de4[_0xdec5('0x50')](_0x1b8ee3);}})[_0xdec5('0x1b')](function(_0x4f3103){if(_0x4f3103){_0x11a62d=_0x4f3103[_0xdec5('0x4c')];if(!_0x2f1c04[_0xdec5('0x35')][_0xdec5('0x3b')](_0xdec5('0x54'))){_0x1b8ee3[_0xdec5('0x29')]=qs[_0xdec5('0x29')](_0x2f1c04[_0xdec5('0x35')][_0xdec5('0x29')]);_0x1b8ee3[_0xdec5('0x3c')]=qs[_0xdec5('0x3c')](_0x2f1c04[_0xdec5('0x35')][_0xdec5('0x3c')]);}return _0x514de4[_0xdec5('0x50')](_0x1b8ee3);}})['then'](function(_0x564a1a){if(_0x564a1a){return _0x564a1a?{'count':_0x11a62d,'rows':_0x564a1a}:null;}})[_0xdec5('0x1b')](respondWithResult(_0x150f72,null))[_0xdec5('0x25')](handleError(_0x150f72,null));};exports[_0xdec5('0x55')]=function(_0x235297,_0x15493a,_0x46458a){var _0x550991={};var _0x552634={};var _0x4c71b9;var _0x351881;return db[_0xdec5('0x33')][_0xdec5('0x51')]({'where':{'id':_0x235297[_0xdec5('0x4a')]['id']}})[_0xdec5('0x1b')](handleEntityNotFound(_0x15493a,null))[_0xdec5('0x1b')](function(_0x4dcca0){if(_0x4dcca0){_0x4c71b9=_0x4dcca0;_0x552634['model']=_[_0xdec5('0x36')](db[_0xdec5('0x52')]['rawAttributes']);_0x552634['query']=_['keys'](_0x235297[_0xdec5('0x35')]);_0x552634['filters']=_[_0xdec5('0x39')](_0x552634['model'],_0x552634[_0xdec5('0x35')]);_0x550991[_0xdec5('0x38')]=_['intersection'](_0x552634[_0xdec5('0x34')],qs['fields'](_0x235297[_0xdec5('0x35')][_0xdec5('0x3a')]));_0x550991[_0xdec5('0x38')]=_0x550991[_0xdec5('0x38')][_0xdec5('0x4c')]?_0x550991[_0xdec5('0x38')]:_0x552634[_0xdec5('0x34')];_0x550991['order']=qs[_0xdec5('0x3e')](_0x235297['query']['sort']);_0x550991['where']=qs[_0xdec5('0x37')](_[_0xdec5('0x40')](_0x235297[_0xdec5('0x35')],_0x552634[_0xdec5('0x37')]));if(_0x235297[_0xdec5('0x35')][_0xdec5('0x41')]){_0x550991[_0xdec5('0x3f')]=_[_0xdec5('0x42')](_0x550991[_0xdec5('0x3f')],{'$or':_[_0xdec5('0x53')](_0x550991[_0xdec5('0x38')],function(_0x5ad8a5){var _0xc4bcfa={};_0xc4bcfa[_0x5ad8a5]={'$like':'%'+_0x235297[_0xdec5('0x35')][_0xdec5('0x41')]+'%'};return _0xc4bcfa;})});}_0x550991=_[_0xdec5('0x42')]({},_0x550991,_0x235297[_0xdec5('0x45')]);return _0x4c71b9['getSubjects'](_0x550991);}})['then'](function(_0x3d9bbe){if(_0x3d9bbe){_0x351881=_0x3d9bbe[_0xdec5('0x4c')];if(!_0x235297[_0xdec5('0x35')][_0xdec5('0x3b')](_0xdec5('0x54'))){_0x550991[_0xdec5('0x29')]=qs[_0xdec5('0x29')](_0x235297[_0xdec5('0x35')][_0xdec5('0x29')]);_0x550991['offset']=qs['offset'](_0x235297[_0xdec5('0x35')]['offset']);}return _0x4c71b9['getSubjects'](_0x550991);}})[_0xdec5('0x1b')](function(_0xfdd951){if(_0xfdd951){return _0xfdd951?{'count':_0x351881,'rows':_0xfdd951}:null;}})[_0xdec5('0x1b')](respondWithResult(_0x15493a,null))[_0xdec5('0x25')](handleError(_0x15493a,null));};exports['getDescriptions']=function(_0x7c9ca,_0x2108d4,_0x2ff160){var _0x5d9b45={};var _0x4d1320={};var _0x3ff3cf;var _0x3034ef;return db['DeskConfiguration'][_0xdec5('0x51')]({'where':{'id':_0x7c9ca[_0xdec5('0x4a')]['id']}})[_0xdec5('0x1b')](handleEntityNotFound(_0x2108d4,null))[_0xdec5('0x1b')](function(_0x375927){if(_0x375927){_0x3ff3cf=_0x375927;_0x4d1320['model']=_[_0xdec5('0x36')](db[_0xdec5('0x52')][_0xdec5('0x4b')]);_0x4d1320[_0xdec5('0x35')]=_[_0xdec5('0x36')](_0x7c9ca[_0xdec5('0x35')]);_0x4d1320[_0xdec5('0x37')]=_['intersection'](_0x4d1320[_0xdec5('0x34')],_0x4d1320[_0xdec5('0x35')]);_0x5d9b45[_0xdec5('0x38')]=_[_0xdec5('0x39')](_0x4d1320[_0xdec5('0x34')],qs['fields'](_0x7c9ca[_0xdec5('0x35')][_0xdec5('0x3a')]));_0x5d9b45[_0xdec5('0x38')]=_0x5d9b45[_0xdec5('0x38')]['length']?_0x5d9b45[_0xdec5('0x38')]:_0x4d1320[_0xdec5('0x34')];_0x5d9b45['order']=qs[_0xdec5('0x3e')](_0x7c9ca[_0xdec5('0x35')][_0xdec5('0x3e')]);_0x5d9b45['where']=qs[_0xdec5('0x37')](_[_0xdec5('0x40')](_0x7c9ca['query'],_0x4d1320[_0xdec5('0x37')]));if(_0x7c9ca[_0xdec5('0x35')][_0xdec5('0x41')]){_0x5d9b45[_0xdec5('0x3f')]=_[_0xdec5('0x42')](_0x5d9b45[_0xdec5('0x3f')],{'$or':_['map'](_0x5d9b45[_0xdec5('0x38')],function(_0x691953){var _0x5288e4={};_0x5288e4[_0x691953]={'$like':'%'+_0x7c9ca['query'][_0xdec5('0x41')]+'%'};return _0x5288e4;})});}_0x5d9b45=_[_0xdec5('0x42')]({},_0x5d9b45,_0x7c9ca[_0xdec5('0x45')]);return _0x3ff3cf['getDescriptions'](_0x5d9b45);}})['then'](function(_0x350d4d){if(_0x350d4d){_0x3034ef=_0x350d4d['length'];if(!_0x7c9ca[_0xdec5('0x35')]['hasOwnProperty'](_0xdec5('0x54'))){_0x5d9b45['limit']=qs['limit'](_0x7c9ca[_0xdec5('0x35')][_0xdec5('0x29')]);_0x5d9b45[_0xdec5('0x3c')]=qs[_0xdec5('0x3c')](_0x7c9ca[_0xdec5('0x35')][_0xdec5('0x3c')]);}return _0x3ff3cf[_0xdec5('0x56')](_0x5d9b45);}})[_0xdec5('0x1b')](function(_0x53c7f9){if(_0x53c7f9){return _0x53c7f9?{'count':_0x3034ef,'rows':_0x53c7f9}:null;}})[_0xdec5('0x1b')](respondWithResult(_0x2108d4,null))['catch'](handleError(_0x2108d4,null));};exports[_0xdec5('0x57')]=function(_0x1ae7db,_0x4b7e05,_0xcac812){var _0x270eb4={};var _0x189a46={};var _0x3eeef8;var _0x2dacde;return db[_0xdec5('0x33')]['findOne']({'where':{'id':_0x1ae7db[_0xdec5('0x4a')]['id']}})[_0xdec5('0x1b')](handleEntityNotFound(_0x4b7e05,null))[_0xdec5('0x1b')](function(_0x461dc4){if(_0x461dc4){_0x3eeef8=_0x461dc4;_0x189a46[_0xdec5('0x34')]=_[_0xdec5('0x36')](db[_0xdec5('0x58')]['rawAttributes']);_0x189a46[_0xdec5('0x35')]=_[_0xdec5('0x36')](_0x1ae7db[_0xdec5('0x35')]);_0x189a46[_0xdec5('0x37')]=_[_0xdec5('0x39')](_0x189a46['model'],_0x189a46['query']);_0x270eb4['attributes']=_[_0xdec5('0x39')](_0x189a46[_0xdec5('0x34')],qs[_0xdec5('0x3a')](_0x1ae7db[_0xdec5('0x35')][_0xdec5('0x3a')]));_0x270eb4[_0xdec5('0x38')]=_0x270eb4[_0xdec5('0x38')]['length']?_0x270eb4[_0xdec5('0x38')]:_0x189a46[_0xdec5('0x34')];_0x270eb4[_0xdec5('0x3d')]=qs[_0xdec5('0x3e')](_0x1ae7db[_0xdec5('0x35')][_0xdec5('0x3e')]);_0x270eb4[_0xdec5('0x3f')]=qs[_0xdec5('0x37')](_[_0xdec5('0x40')](_0x1ae7db[_0xdec5('0x35')],_0x189a46[_0xdec5('0x37')]));if(_0x1ae7db[_0xdec5('0x35')][_0xdec5('0x41')]){_0x270eb4['where']=_[_0xdec5('0x42')](_0x270eb4[_0xdec5('0x3f')],{'$or':_[_0xdec5('0x53')](_0x270eb4[_0xdec5('0x38')],function(_0x4497b6){var _0x369cdc={};_0x369cdc[_0x4497b6]={'$like':'%'+_0x1ae7db['query']['filter']+'%'};return _0x369cdc;})});}_0x270eb4=_[_0xdec5('0x42')]({},_0x270eb4,_0x1ae7db[_0xdec5('0x45')]);return _0x3eeef8[_0xdec5('0x57')](_0x270eb4);}})[_0xdec5('0x1b')](function(_0x12cdf5){if(_0x12cdf5){_0x2dacde=_0x12cdf5['length'];if(!_0x1ae7db[_0xdec5('0x35')]['hasOwnProperty'](_0xdec5('0x54'))){_0x270eb4[_0xdec5('0x29')]=qs[_0xdec5('0x29')](_0x1ae7db[_0xdec5('0x35')][_0xdec5('0x29')]);_0x270eb4[_0xdec5('0x3c')]=qs['offset'](_0x1ae7db[_0xdec5('0x35')][_0xdec5('0x3c')]);}return _0x3eeef8[_0xdec5('0x57')](_0x270eb4);}})[_0xdec5('0x1b')](function(_0x53419e){if(_0x53419e){return _0x53419e?{'count':_0x2dacde,'rows':_0x53419e}:null;}})[_0xdec5('0x1b')](respondWithResult(_0x4b7e05,null))[_0xdec5('0x25')](handleError(_0x4b7e05,null));};exports[_0xdec5('0x59')]=function(_0x24aa7c,_0x5d7217,_0x3dcce5){if(_0x24aa7c[_0xdec5('0x4e')]['id']){delete _0x24aa7c[_0xdec5('0x4e')]['id'];}return db[_0xdec5('0x33')][_0xdec5('0x51')]({'where':{'id':_0x24aa7c[_0xdec5('0x4a')]['id']}})[_0xdec5('0x1b')](handleEntityNotFound(_0x5d7217,null))[_0xdec5('0x1b')](function(_0x52f603){if(_0x52f603){return _0x52f603[_0xdec5('0x59')](_0x24aa7c[_0xdec5('0x4e')]['ids']||[]);}return null;})[_0xdec5('0x1b')](respondWithResult(_0x5d7217,null))[_0xdec5('0x25')](handleError(_0x5d7217,null));}; \ No newline at end of file +var _0x8e20=['length','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','DeskConfiguration','includeAll','catch','show','params','include','find','create','body','findOne','pick','getFields','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','Content-Range','reject','save','update','destroy','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','fields'];(function(_0x40b338,_0x20a13d){var _0x10fcaf=function(_0x5cb776){while(--_0x5cb776){_0x40b338['push'](_0x40b338['shift']());}};_0x10fcaf(++_0x20a13d);}(_0x8e20,0xd5));var _0x08e2=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x8e20[_0x4cd21c];return _0x5d8e5e;};'use strict';var pdf=require(_0x08e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x08e2('0x1'));var zipdir=require(_0x08e2('0x2'));var jsonpatch=require(_0x08e2('0x3'));var rp=require('request-promise');var moment=require(_0x08e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x08e2('0x5'));var util=require('util');var path=require(_0x08e2('0x6'));var sox=require(_0x08e2('0x7'));var csv=require(_0x08e2('0x8'));var ejs=require(_0x08e2('0x9'));var fs=require('fs');var _=require(_0x08e2('0xa'));var squel=require(_0x08e2('0xb'));var crypto=require(_0x08e2('0xc'));var jsforce=require(_0x08e2('0xd'));var deskjs=require(_0x08e2('0xe'));var toCsv=require(_0x08e2('0x8'));var querystring=require(_0x08e2('0xf'));var Papa=require(_0x08e2('0x10'));var Redis=require(_0x08e2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x08e2('0x12'));var as=require(_0x08e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x08e2('0x14'));var utils=require(_0x08e2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x08e2('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x08e2('0x17'));var client=jayson[_0x08e2('0x18')][_0x08e2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x37ebdd,_0xfd49e1,_0x33c7fe,_0x1fbc75){return new BPromise(function(_0x1be942,_0x4e70a0){var _0x2feab1=_0x1fbc75||client;return _0x2feab1[_0x08e2('0x1a')](_0x37ebdd,_0x33c7fe)[_0x08e2('0x1b')](function(_0x191686){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0xfd49e1,_0x08e2('0x1c'));logger[_0x08e2('0x1d')](_0x08e2('0x1e'),_0xfd49e1,_0x08e2('0x1c'),JSON[_0x08e2('0x1f')](_0x191686));if(_0x191686['error']){if(_0x191686[_0x08e2('0x20')][_0x08e2('0x21')]===0x1f4){logger[_0x08e2('0x20')](_0x08e2('0x22'),_0xfd49e1,_0x191686['error'][_0x08e2('0x23')]);return _0x4e70a0(_0x191686[_0x08e2('0x20')]['message']);}logger[_0x08e2('0x20')](_0x08e2('0x22'),_0xfd49e1,_0x191686[_0x08e2('0x20')][_0x08e2('0x23')]);return _0x1be942(_0x191686['error'][_0x08e2('0x23')]);}else{logger['info'](_0x08e2('0x22'),_0xfd49e1,'request\x20sent');_0x1be942(_0x191686[_0x08e2('0x24')][_0x08e2('0x23')]);}})['catch'](function(_0x4ce991){logger['error'](_0x08e2('0x22'),_0xfd49e1,_0x4ce991);_0x4e70a0(_0x4ce991);});});}function respondWithStatusCode(_0x2e488f,_0x57233c){_0x57233c=_0x57233c||0xcc;return function(_0x1af567){if(_0x1af567){return _0x2e488f[_0x08e2('0x25')](_0x57233c);}return _0x2e488f[_0x08e2('0x26')](_0x57233c)[_0x08e2('0x27')]();};}function respondWithResult(_0x4c9369,_0x29834d){_0x29834d=_0x29834d||0xc8;return function(_0x1ac60e){if(_0x1ac60e){return _0x4c9369[_0x08e2('0x26')](_0x29834d)['json'](_0x1ac60e);}};}function respondWithFilteredResult(_0x2a5d0a,_0x2cfdec){return function(_0x39791a){if(_0x39791a){var _0xeabf9=_0x39791a[_0x08e2('0x28')],_0x18e886=_0x2cfdec[_0x08e2('0x29')],_0x3de1f2=_0x2cfdec[_0x08e2('0x29')]+_0x2cfdec[_0x08e2('0x2a')],_0x423d2c;if(_0x3de1f2>=_0xeabf9){_0x3de1f2=_0xeabf9;_0x423d2c=0xc8;}else{_0x423d2c=0xce;}_0x2a5d0a['status'](_0x423d2c);return _0x2a5d0a['set'](_0x08e2('0x2b'),_0x18e886+'-'+_0x3de1f2+'/'+_0xeabf9)['json'](_0x39791a);}return null;};}function patchUpdates(_0x2c5d3d){return function(_0x4e6700){try{jsonpatch['apply'](_0x4e6700,_0x2c5d3d,!![]);}catch(_0x1c4a24){return BPromise[_0x08e2('0x2c')](_0x1c4a24);}return _0x4e6700[_0x08e2('0x2d')]();};}function saveUpdates(_0x928ef,_0x413a8d){return function(_0x13a903){if(_0x13a903){return _0x13a903[_0x08e2('0x2e')](_0x928ef)['then'](function(_0x4e7861){return _0x4e7861;});}return null;};}function removeEntity(_0xfc36e,_0x344217){return function(_0x340877){if(_0x340877){return _0x340877[_0x08e2('0x2f')]()[_0x08e2('0x1b')](function(){_0xfc36e[_0x08e2('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f1c03,_0x2be5b9){return function(_0x3880e6){if(!_0x3880e6){_0x2f1c03[_0x08e2('0x25')](0x194);}return _0x3880e6;};}function handleError(_0x36e0d8,_0x32e11f){_0x32e11f=_0x32e11f||0x1f4;return function(_0x11bcf8){logger[_0x08e2('0x20')](_0x11bcf8['stack']);if(_0x11bcf8['name']){delete _0x11bcf8[_0x08e2('0x30')];}_0x36e0d8[_0x08e2('0x26')](_0x32e11f)[_0x08e2('0x31')](_0x11bcf8);};}exports[_0x08e2('0x32')]=function(_0x4698a9,_0x2c27fc){var _0x5e60ea={},_0x44a7ce={},_0x526a0f={'count':0x0,'rows':[]};var _0x39dc10=_['map'](db['DeskConfiguration'][_0x08e2('0x33')],function(_0x4eebc0){return{'name':_0x4eebc0[_0x08e2('0x34')],'type':_0x4eebc0[_0x08e2('0x35')][_0x08e2('0x36')]};});_0x44a7ce['model']=_[_0x08e2('0x37')](_0x39dc10,'name');_0x44a7ce[_0x08e2('0x38')]=_[_0x08e2('0x39')](_0x4698a9[_0x08e2('0x38')]);_0x44a7ce['filters']=_[_0x08e2('0x3a')](_0x44a7ce['model'],_0x44a7ce['query']);_0x5e60ea['attributes']=_[_0x08e2('0x3a')](_0x44a7ce['model'],qs[_0x08e2('0x3b')](_0x4698a9['query'][_0x08e2('0x3b')]));_0x5e60ea['attributes']=_0x5e60ea['attributes'][_0x08e2('0x3c')]?_0x5e60ea[_0x08e2('0x3d')]:_0x44a7ce[_0x08e2('0x3e')];if(!_0x4698a9[_0x08e2('0x38')][_0x08e2('0x3f')](_0x08e2('0x40'))){_0x5e60ea['limit']=qs[_0x08e2('0x2a')](_0x4698a9[_0x08e2('0x38')][_0x08e2('0x2a')]);_0x5e60ea['offset']=qs[_0x08e2('0x29')](_0x4698a9['query']['offset']);}_0x5e60ea[_0x08e2('0x41')]=qs[_0x08e2('0x42')](_0x4698a9[_0x08e2('0x38')][_0x08e2('0x42')]);_0x5e60ea[_0x08e2('0x43')]=qs[_0x08e2('0x44')](_['pick'](_0x4698a9[_0x08e2('0x38')],_0x44a7ce[_0x08e2('0x44')]),_0x39dc10);if(_0x4698a9['query'][_0x08e2('0x45')]){_0x5e60ea[_0x08e2('0x43')]=_['merge'](_0x5e60ea['where'],{'$or':_[_0x08e2('0x37')](_0x39dc10,function(_0x108f3c){if(_0x108f3c[_0x08e2('0x35')]!==_0x08e2('0x46')){var _0x11e548={};_0x11e548[_0x108f3c[_0x08e2('0x30')]]={'$like':'%'+_0x4698a9['query'][_0x08e2('0x45')]+'%'};return _0x11e548;}})});}_0x5e60ea=_[_0x08e2('0x47')]({},_0x5e60ea,_0x4698a9[_0x08e2('0x48')]);var _0x475a07={'where':_0x5e60ea[_0x08e2('0x43')]};return db[_0x08e2('0x49')]['count'](_0x475a07)['then'](function(_0x570514){_0x526a0f[_0x08e2('0x28')]=_0x570514;if(_0x4698a9[_0x08e2('0x38')][_0x08e2('0x4a')]){_0x5e60ea['include']=[{'all':!![]}];}return db[_0x08e2('0x49')]['findAll'](_0x5e60ea);})['then'](function(_0x2da49a){_0x526a0f['rows']=_0x2da49a;return _0x526a0f;})[_0x08e2('0x1b')](respondWithFilteredResult(_0x2c27fc,_0x5e60ea))[_0x08e2('0x4b')](handleError(_0x2c27fc,null));};exports[_0x08e2('0x4c')]=function(_0x370f93,_0x5c4265){var _0x41fa46={'raw':![],'where':{'id':_0x370f93[_0x08e2('0x4d')]['id']}},_0x10a1fa={};_0x10a1fa[_0x08e2('0x3e')]=_['keys'](db[_0x08e2('0x49')][_0x08e2('0x33')]);_0x10a1fa[_0x08e2('0x38')]=_[_0x08e2('0x39')](_0x370f93[_0x08e2('0x38')]);_0x10a1fa[_0x08e2('0x44')]=_['intersection'](_0x10a1fa[_0x08e2('0x3e')],_0x10a1fa[_0x08e2('0x38')]);_0x41fa46[_0x08e2('0x3d')]=_[_0x08e2('0x3a')](_0x10a1fa['model'],qs[_0x08e2('0x3b')](_0x370f93[_0x08e2('0x38')][_0x08e2('0x3b')]));_0x41fa46[_0x08e2('0x3d')]=_0x41fa46[_0x08e2('0x3d')][_0x08e2('0x3c')]?_0x41fa46['attributes']:_0x10a1fa[_0x08e2('0x3e')];if(_0x370f93[_0x08e2('0x38')][_0x08e2('0x4a')]){_0x41fa46[_0x08e2('0x4e')]=[{'all':!![]}];}_0x41fa46=_[_0x08e2('0x47')]({},_0x41fa46,_0x370f93[_0x08e2('0x48')]);return db[_0x08e2('0x49')][_0x08e2('0x4f')](_0x41fa46)[_0x08e2('0x1b')](handleEntityNotFound(_0x5c4265,null))[_0x08e2('0x1b')](respondWithResult(_0x5c4265,null))[_0x08e2('0x4b')](handleError(_0x5c4265,null));};exports[_0x08e2('0x50')]=function(_0x10a56a,_0x495816){return db[_0x08e2('0x49')][_0x08e2('0x50')](_0x10a56a[_0x08e2('0x51')],{})['then'](respondWithResult(_0x495816,0xc9))[_0x08e2('0x4b')](handleError(_0x495816,null));};exports[_0x08e2('0x2e')]=function(_0x34f6f8,_0x34c910){if(_0x34f6f8[_0x08e2('0x51')]['id']){delete _0x34f6f8[_0x08e2('0x51')]['id'];}return db[_0x08e2('0x49')][_0x08e2('0x4f')]({'where':{'id':_0x34f6f8[_0x08e2('0x4d')]['id']}})[_0x08e2('0x1b')](handleEntityNotFound(_0x34c910,null))[_0x08e2('0x1b')](saveUpdates(_0x34f6f8['body'],null))['then'](respondWithResult(_0x34c910,null))[_0x08e2('0x4b')](handleError(_0x34c910,null));};exports[_0x08e2('0x2f')]=function(_0x4a8d3c,_0x247bfe){return db[_0x08e2('0x49')]['find']({'where':{'id':_0x4a8d3c[_0x08e2('0x4d')]['id']}})[_0x08e2('0x1b')](handleEntityNotFound(_0x247bfe,null))[_0x08e2('0x1b')](removeEntity(_0x247bfe,null))[_0x08e2('0x4b')](handleError(_0x247bfe,null));};exports['getFields']=function(_0x1acb87,_0x1ecf49,_0x47abf0){var _0x2d7345={};var _0x31a05a={};var _0x533022;var _0x43f581;return db[_0x08e2('0x49')][_0x08e2('0x52')]({'where':{'id':_0x1acb87['params']['id']}})['then'](handleEntityNotFound(_0x1ecf49,null))[_0x08e2('0x1b')](function(_0x46fa2f){if(_0x46fa2f){_0x533022=_0x46fa2f;_0x31a05a[_0x08e2('0x3e')]=_[_0x08e2('0x39')](db['DeskField'][_0x08e2('0x33')]);_0x31a05a[_0x08e2('0x38')]=_[_0x08e2('0x39')](_0x1acb87[_0x08e2('0x38')]);_0x31a05a[_0x08e2('0x44')]=_[_0x08e2('0x3a')](_0x31a05a[_0x08e2('0x3e')],_0x31a05a[_0x08e2('0x38')]);_0x2d7345['attributes']=_[_0x08e2('0x3a')](_0x31a05a['model'],qs[_0x08e2('0x3b')](_0x1acb87['query'][_0x08e2('0x3b')]));_0x2d7345[_0x08e2('0x3d')]=_0x2d7345[_0x08e2('0x3d')]['length']?_0x2d7345[_0x08e2('0x3d')]:_0x31a05a[_0x08e2('0x3e')];_0x2d7345[_0x08e2('0x41')]=qs[_0x08e2('0x42')](_0x1acb87[_0x08e2('0x38')][_0x08e2('0x42')]);_0x2d7345[_0x08e2('0x43')]=qs[_0x08e2('0x44')](_[_0x08e2('0x53')](_0x1acb87[_0x08e2('0x38')],_0x31a05a['filters']));if(_0x1acb87[_0x08e2('0x38')]['filter']){_0x2d7345[_0x08e2('0x43')]=_[_0x08e2('0x47')](_0x2d7345[_0x08e2('0x43')],{'$or':_[_0x08e2('0x37')](_0x2d7345[_0x08e2('0x3d')],function(_0x21e9af){var _0x27f089={};_0x27f089[_0x21e9af]={'$like':'%'+_0x1acb87[_0x08e2('0x38')][_0x08e2('0x45')]+'%'};return _0x27f089;})});}_0x2d7345=_[_0x08e2('0x47')]({},_0x2d7345,_0x1acb87[_0x08e2('0x48')]);return _0x533022[_0x08e2('0x54')](_0x2d7345);}})[_0x08e2('0x1b')](function(_0x57d976){if(_0x57d976){_0x43f581=_0x57d976[_0x08e2('0x3c')];if(!_0x1acb87[_0x08e2('0x38')][_0x08e2('0x3f')]('nolimit')){_0x2d7345[_0x08e2('0x2a')]=qs[_0x08e2('0x2a')](_0x1acb87[_0x08e2('0x38')][_0x08e2('0x2a')]);_0x2d7345[_0x08e2('0x29')]=qs[_0x08e2('0x29')](_0x1acb87['query']['offset']);}return _0x533022[_0x08e2('0x54')](_0x2d7345);}})['then'](function(_0x4de7b5){if(_0x4de7b5){return _0x4de7b5?{'count':_0x43f581,'rows':_0x4de7b5}:null;}})[_0x08e2('0x1b')](respondWithResult(_0x1ecf49,null))['catch'](handleError(_0x1ecf49,null));};exports[_0x08e2('0x55')]=function(_0x59d9a0,_0x191f0f,_0x40247c){var _0x184fc0={};var _0x5332f1={};var _0x373005;var _0x549a4a;return db[_0x08e2('0x49')][_0x08e2('0x52')]({'where':{'id':_0x59d9a0[_0x08e2('0x4d')]['id']}})[_0x08e2('0x1b')](handleEntityNotFound(_0x191f0f,null))['then'](function(_0x525b39){if(_0x525b39){_0x373005=_0x525b39;_0x5332f1[_0x08e2('0x3e')]=_['keys'](db[_0x08e2('0x56')][_0x08e2('0x33')]);_0x5332f1[_0x08e2('0x38')]=_[_0x08e2('0x39')](_0x59d9a0[_0x08e2('0x38')]);_0x5332f1[_0x08e2('0x44')]=_['intersection'](_0x5332f1[_0x08e2('0x3e')],_0x5332f1[_0x08e2('0x38')]);_0x184fc0['attributes']=_[_0x08e2('0x3a')](_0x5332f1['model'],qs[_0x08e2('0x3b')](_0x59d9a0[_0x08e2('0x38')][_0x08e2('0x3b')]));_0x184fc0['attributes']=_0x184fc0[_0x08e2('0x3d')][_0x08e2('0x3c')]?_0x184fc0[_0x08e2('0x3d')]:_0x5332f1['model'];_0x184fc0['order']=qs[_0x08e2('0x42')](_0x59d9a0[_0x08e2('0x38')][_0x08e2('0x42')]);_0x184fc0['where']=qs[_0x08e2('0x44')](_[_0x08e2('0x53')](_0x59d9a0[_0x08e2('0x38')],_0x5332f1['filters']));if(_0x59d9a0[_0x08e2('0x38')]['filter']){_0x184fc0[_0x08e2('0x43')]=_[_0x08e2('0x47')](_0x184fc0[_0x08e2('0x43')],{'$or':_['map'](_0x184fc0['attributes'],function(_0x14c910){var _0x12037f={};_0x12037f[_0x14c910]={'$like':'%'+_0x59d9a0[_0x08e2('0x38')][_0x08e2('0x45')]+'%'};return _0x12037f;})});}_0x184fc0=_[_0x08e2('0x47')]({},_0x184fc0,_0x59d9a0[_0x08e2('0x48')]);return _0x373005[_0x08e2('0x55')](_0x184fc0);}})[_0x08e2('0x1b')](function(_0x4f23a5){if(_0x4f23a5){_0x549a4a=_0x4f23a5['length'];if(!_0x59d9a0['query'][_0x08e2('0x3f')](_0x08e2('0x40'))){_0x184fc0['limit']=qs[_0x08e2('0x2a')](_0x59d9a0[_0x08e2('0x38')][_0x08e2('0x2a')]);_0x184fc0[_0x08e2('0x29')]=qs[_0x08e2('0x29')](_0x59d9a0['query']['offset']);}return _0x373005[_0x08e2('0x55')](_0x184fc0);}})[_0x08e2('0x1b')](function(_0x19c231){if(_0x19c231){return _0x19c231?{'count':_0x549a4a,'rows':_0x19c231}:null;}})[_0x08e2('0x1b')](respondWithResult(_0x191f0f,null))[_0x08e2('0x4b')](handleError(_0x191f0f,null));};exports[_0x08e2('0x57')]=function(_0x586d78,_0x5720fb,_0x3c3a93){var _0x5ae5d7={};var _0x547d1b={};var _0x8cc0d7;var _0x27a9d2;return db['DeskConfiguration'][_0x08e2('0x52')]({'where':{'id':_0x586d78[_0x08e2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5720fb,null))[_0x08e2('0x1b')](function(_0x28c5ff){if(_0x28c5ff){_0x8cc0d7=_0x28c5ff;_0x547d1b['model']=_['keys'](db['DeskField'][_0x08e2('0x33')]);_0x547d1b[_0x08e2('0x38')]=_[_0x08e2('0x39')](_0x586d78[_0x08e2('0x38')]);_0x547d1b[_0x08e2('0x44')]=_['intersection'](_0x547d1b['model'],_0x547d1b[_0x08e2('0x38')]);_0x5ae5d7['attributes']=_['intersection'](_0x547d1b[_0x08e2('0x3e')],qs['fields'](_0x586d78[_0x08e2('0x38')][_0x08e2('0x3b')]));_0x5ae5d7[_0x08e2('0x3d')]=_0x5ae5d7[_0x08e2('0x3d')][_0x08e2('0x3c')]?_0x5ae5d7[_0x08e2('0x3d')]:_0x547d1b[_0x08e2('0x3e')];_0x5ae5d7[_0x08e2('0x41')]=qs['sort'](_0x586d78[_0x08e2('0x38')][_0x08e2('0x42')]);_0x5ae5d7[_0x08e2('0x43')]=qs[_0x08e2('0x44')](_[_0x08e2('0x53')](_0x586d78[_0x08e2('0x38')],_0x547d1b[_0x08e2('0x44')]));if(_0x586d78['query']['filter']){_0x5ae5d7[_0x08e2('0x43')]=_[_0x08e2('0x47')](_0x5ae5d7[_0x08e2('0x43')],{'$or':_[_0x08e2('0x37')](_0x5ae5d7[_0x08e2('0x3d')],function(_0x5dd222){var _0x15080f={};_0x15080f[_0x5dd222]={'$like':'%'+_0x586d78[_0x08e2('0x38')][_0x08e2('0x45')]+'%'};return _0x15080f;})});}_0x5ae5d7=_[_0x08e2('0x47')]({},_0x5ae5d7,_0x586d78[_0x08e2('0x48')]);return _0x8cc0d7[_0x08e2('0x57')](_0x5ae5d7);}})['then'](function(_0x293395){if(_0x293395){_0x27a9d2=_0x293395['length'];if(!_0x586d78[_0x08e2('0x38')][_0x08e2('0x3f')](_0x08e2('0x40'))){_0x5ae5d7[_0x08e2('0x2a')]=qs[_0x08e2('0x2a')](_0x586d78[_0x08e2('0x38')]['limit']);_0x5ae5d7[_0x08e2('0x29')]=qs['offset'](_0x586d78[_0x08e2('0x38')][_0x08e2('0x29')]);}return _0x8cc0d7[_0x08e2('0x57')](_0x5ae5d7);}})[_0x08e2('0x1b')](function(_0xc7356c){if(_0xc7356c){return _0xc7356c?{'count':_0x27a9d2,'rows':_0xc7356c}:null;}})['then'](respondWithResult(_0x5720fb,null))[_0x08e2('0x4b')](handleError(_0x5720fb,null));};exports[_0x08e2('0x58')]=function(_0x3e21df,_0x30f0a0,_0x1ec1f4){var _0x10d06d={};var _0x428d29={};var _0x4f385b;var _0x3bce6c;return db[_0x08e2('0x49')][_0x08e2('0x52')]({'where':{'id':_0x3e21df['params']['id']}})[_0x08e2('0x1b')](handleEntityNotFound(_0x30f0a0,null))[_0x08e2('0x1b')](function(_0x33446){if(_0x33446){_0x4f385b=_0x33446;_0x428d29[_0x08e2('0x3e')]=_[_0x08e2('0x39')](db[_0x08e2('0x59')][_0x08e2('0x33')]);_0x428d29[_0x08e2('0x38')]=_[_0x08e2('0x39')](_0x3e21df[_0x08e2('0x38')]);_0x428d29[_0x08e2('0x44')]=_[_0x08e2('0x3a')](_0x428d29['model'],_0x428d29[_0x08e2('0x38')]);_0x10d06d['attributes']=_['intersection'](_0x428d29[_0x08e2('0x3e')],qs[_0x08e2('0x3b')](_0x3e21df[_0x08e2('0x38')][_0x08e2('0x3b')]));_0x10d06d[_0x08e2('0x3d')]=_0x10d06d[_0x08e2('0x3d')][_0x08e2('0x3c')]?_0x10d06d['attributes']:_0x428d29[_0x08e2('0x3e')];_0x10d06d['order']=qs[_0x08e2('0x42')](_0x3e21df[_0x08e2('0x38')][_0x08e2('0x42')]);_0x10d06d[_0x08e2('0x43')]=qs[_0x08e2('0x44')](_[_0x08e2('0x53')](_0x3e21df[_0x08e2('0x38')],_0x428d29[_0x08e2('0x44')]));if(_0x3e21df['query']['filter']){_0x10d06d[_0x08e2('0x43')]=_[_0x08e2('0x47')](_0x10d06d[_0x08e2('0x43')],{'$or':_['map'](_0x10d06d[_0x08e2('0x3d')],function(_0xabb1e3){var _0x3bd5c3={};_0x3bd5c3[_0xabb1e3]={'$like':'%'+_0x3e21df[_0x08e2('0x38')][_0x08e2('0x45')]+'%'};return _0x3bd5c3;})});}_0x10d06d=_[_0x08e2('0x47')]({},_0x10d06d,_0x3e21df[_0x08e2('0x48')]);return _0x4f385b[_0x08e2('0x58')](_0x10d06d);}})[_0x08e2('0x1b')](function(_0x488d85){if(_0x488d85){_0x3bce6c=_0x488d85[_0x08e2('0x3c')];if(!_0x3e21df[_0x08e2('0x38')][_0x08e2('0x3f')](_0x08e2('0x40'))){_0x10d06d[_0x08e2('0x2a')]=qs[_0x08e2('0x2a')](_0x3e21df['query']['limit']);_0x10d06d[_0x08e2('0x29')]=qs[_0x08e2('0x29')](_0x3e21df[_0x08e2('0x38')][_0x08e2('0x29')]);}return _0x4f385b['getTags'](_0x10d06d);}})['then'](function(_0xbcca35){if(_0xbcca35){return _0xbcca35?{'count':_0x3bce6c,'rows':_0xbcca35}:null;}})[_0x08e2('0x1b')](respondWithResult(_0x30f0a0,null))['catch'](handleError(_0x30f0a0,null));};exports[_0x08e2('0x5a')]=function(_0x54b630,_0xb022a4,_0x210378){if(_0x54b630[_0x08e2('0x51')]['id']){delete _0x54b630[_0x08e2('0x51')]['id'];}return db[_0x08e2('0x49')][_0x08e2('0x52')]({'where':{'id':_0x54b630[_0x08e2('0x4d')]['id']}})[_0x08e2('0x1b')](handleEntityNotFound(_0xb022a4,null))['then'](function(_0x57c4f0){if(_0x57c4f0){return _0x57c4f0[_0x08e2('0x5a')](_0x54b630[_0x08e2('0x51')]['ids']||[]);}return null;})[_0x08e2('0x1b')](respondWithResult(_0xb022a4,null))['catch'](handleError(_0xb022a4,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 53620d1..70405e9 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 _0x2e79=['define','DeskConfiguration','int_desk_configurations','util','api','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x2e79,0x1ed));var _0x92e7=function(_0x52773c,_0x32d3a9){_0x52773c=_0x52773c-0x0;var _0x1713cf=_0x2e79[_0x52773c];return _0x1713cf;};'use strict';var _=require('lodash');var util=require(_0x92e7('0x0'));var logger=require('../../config/logger')(_0x92e7('0x1'));var moment=require(_0x92e7('0x2'));var BPromise=require(_0x92e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92e7('0x4'));var rimraf=require(_0x92e7('0x5'));var config=require('../../config/environment');var attributes=require(_0x92e7('0x6'));module['exports']=function(_0x26944b,_0x34dbf){return _0x26944b[_0x92e7('0x7')](_0x92e7('0x8'),attributes,{'tableName':_0x92e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb279=['api','bluebird','request-promise','path','rimraf','exports','DeskConfiguration','int_desk_configurations','util','../../config/logger'];(function(_0x57872e,_0x411edf){var _0x2eb6af=function(_0x4316af){while(--_0x4316af){_0x57872e['push'](_0x57872e['shift']());}};_0x2eb6af(++_0x411edf);}(_0xb279,0x1ac));var _0x9b27=function(_0x3d7245,_0x21852a){_0x3d7245=_0x3d7245-0x0;var _0x1b00f2=_0xb279[_0x3d7245];return _0x1b00f2;};'use strict';var _=require('lodash');var util=require(_0x9b27('0x0'));var logger=require(_0x9b27('0x1'))(_0x9b27('0x2'));var moment=require('moment');var BPromise=require(_0x9b27('0x3'));var rp=require(_0x9b27('0x4'));var fs=require('fs');var path=require(_0x9b27('0x5'));var rimraf=require(_0x9b27('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x9b27('0x7')]=function(_0x3b9077,_0x4a9f6c){return _0x3b9077['define'](_0x9b27('0x8'),attributes,{'tableName':_0x9b27('0x9'),'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 19e9c81..1344cdc 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 _0xbf83=['jayson/promise','client','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x1f52c0,_0x465091){var _0x4918de=function(_0x25744c){while(--_0x25744c){_0x1f52c0['push'](_0x1f52c0['shift']());}};_0x4918de(++_0x465091);}(_0xbf83,0x11e));var _0x3bf8=function(_0x4a4bd5,_0x32f63d){_0x4a4bd5=_0x4a4bd5-0x0;var _0x58fd33=_0xbf83[_0x4a4bd5];return _0x58fd33;};'use strict';var _=require(_0x3bf8('0x0'));var util=require('util');var moment=require(_0x3bf8('0x1'));var BPromise=require(_0x3bf8('0x2'));var rs=require(_0x3bf8('0x3'));var fs=require('fs');var Redis=require(_0x3bf8('0x4'));var db=require(_0x3bf8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3bf8('0x6'));var config=require(_0x3bf8('0x7'));var jayson=require(_0x3bf8('0x8'));var client=jayson[_0x3bf8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0c12,_0x168a20,_0x2df7c9){return new BPromise(function(_0x4adc52,_0x27c23f){return client['request'](_0x5b0c12,_0x2df7c9)[_0x3bf8('0xa')](function(_0x2eca24){logger[_0x3bf8('0xb')](_0x3bf8('0xc'),_0x168a20,_0x3bf8('0xd'));logger[_0x3bf8('0xe')](_0x3bf8('0xf'),_0x168a20,'request\x20sent',JSON[_0x3bf8('0x10')](_0x2eca24));if(_0x2eca24[_0x3bf8('0x11')]){if(_0x2eca24['error'][_0x3bf8('0x12')]===0x1f4){logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x2eca24[_0x3bf8('0x11')][_0x3bf8('0x13')]);return _0x27c23f(_0x2eca24[_0x3bf8('0x11')][_0x3bf8('0x13')]);}logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x2eca24[_0x3bf8('0x11')]['message']);return _0x4adc52(_0x2eca24['error'][_0x3bf8('0x13')]);}else{logger[_0x3bf8('0xb')](_0x3bf8('0xc'),_0x168a20,_0x3bf8('0xd'));_0x4adc52(_0x2eca24['result'][_0x3bf8('0x13')]);}})[_0x3bf8('0x14')](function(_0x1a77fc){logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x1a77fc);_0x27c23f(_0x1a77fc);});});} \ No newline at end of file +var _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b5736,_0x2f082d){var _0x2abf16=function(_0x489106){while(--_0x489106){_0x2b5736['push'](_0x2b5736['shift']());}};_0x2abf16(++_0x2f082d);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0xf9f7[_0x3a441a];return _0x3128a2;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a95ea8b..84f30d3 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 _0x5716=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x1de0e1,_0x5f4946){var _0x23822e=function(_0x2e7e9c){while(--_0x2e7e9c){_0x1de0e1['push'](_0x1de0e1['shift']());}};_0x23822e(++_0x5f4946);}(_0x5716,0x1a3));var _0x6571=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x5716[_0x4a209a];return _0x4b3c20;};'use strict';var multer=require(_0x6571('0x0'));var util=require(_0x6571('0x1'));var path=require(_0x6571('0x2'));var timeout=require('connect-timeout');var express=require(_0x6571('0x3'));var router=express[_0x6571('0x4')]();var auth=require(_0x6571('0x5'));var interaction=require(_0x6571('0x6'));var config=require(_0x6571('0x7'));var controller=require(_0x6571('0x8'));router[_0x6571('0x9')]('/',auth[_0x6571('0xa')](),controller[_0x6571('0xb')]);router[_0x6571('0x9')](_0x6571('0xc'),auth[_0x6571('0xa')](),controller[_0x6571('0xd')]);router[_0x6571('0xe')]('/',auth[_0x6571('0xa')](),controller[_0x6571('0xf')]);router[_0x6571('0x10')](_0x6571('0xc'),auth['isAuthenticated'](),controller[_0x6571('0x11')]);router['delete'](_0x6571('0xc'),auth[_0x6571('0xa')](),controller[_0x6571('0x12')]);module['exports']=router; \ No newline at end of file +var _0x420e=['show','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x33fbfd,_0x547b70){var _0x520785=function(_0x43e32a){while(--_0x43e32a){_0x33fbfd['push'](_0x33fbfd['shift']());}};_0x520785(++_0x547b70);}(_0x420e,0x125));var _0xe420=function(_0x58bd17,_0x20ad5f){_0x58bd17=_0x58bd17-0x0;var _0x3663ef=_0x420e[_0x58bd17];return _0x3663ef;};'use strict';var multer=require(_0xe420('0x0'));var util=require(_0xe420('0x1'));var path=require(_0xe420('0x2'));var timeout=require('connect-timeout');var express=require(_0xe420('0x3'));var router=express[_0xe420('0x4')]();var auth=require(_0xe420('0x5'));var interaction=require(_0xe420('0x6'));var config=require(_0xe420('0x7'));var controller=require('./intDeskField.controller');router[_0xe420('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe420('0x8')](_0xe420('0x9'),auth[_0xe420('0xa')](),controller[_0xe420('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe420('0xc')](_0xe420('0x9'),auth['isAuthenticated'](),controller[_0xe420('0xd')]);router['delete']('/:id',auth[_0xe420('0xa')](),controller[_0xe420('0xe')]);module[_0xe420('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index cb59c5c..d6fd2e7 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 _0xb6df=['string','variable','customVariable','STRING','ENUM','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb6df,0x139));var _0xfb6d=function(_0xe0b4dd,_0x24c350){_0xe0b4dd=_0xe0b4dd-0x0;var _0x590267=_0xb6df[_0xe0b4dd];return _0x590267;};'use strict';var Sequelize=require(_0xfb6d('0x0'));module[_0xfb6d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfb6d('0x2'),_0xfb6d('0x3'),_0xfb6d('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xfb6d('0x5')]},'key':{'type':Sequelize[_0xfb6d('0x5')]},'keyType':{'type':Sequelize[_0xfb6d('0x6')](_0xfb6d('0x2'),_0xfb6d('0x3'),_0xfb6d('0x4'))},'keyContent':{'type':Sequelize[_0xfb6d('0x5')]},'idField':{'type':Sequelize[_0xfb6d('0x5')]},'nameField':{'type':Sequelize[_0xfb6d('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb6d('0x5')]}}; \ No newline at end of file +var _0x521a=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1ea69b,_0x239da8){var _0x5c8577=function(_0x31d49d){while(--_0x31d49d){_0x1ea69b['push'](_0x1ea69b['shift']());}};_0x5c8577(++_0x239da8);}(_0x521a,0x1ce));var _0xa521=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0x521a[_0x42c6f1];return _0x3c7398;};'use strict';var Sequelize=require(_0xa521('0x0'));module['exports']={'type':{'type':Sequelize[_0xa521('0x1')](_0xa521('0x2'),_0xa521('0x3'),_0xa521('0x4'),_0xa521('0x5')),'defaultValue':_0xa521('0x2')},'content':{'type':Sequelize[_0xa521('0x6')]},'key':{'type':Sequelize[_0xa521('0x6')]},'keyType':{'type':Sequelize[_0xa521('0x1')](_0xa521('0x2'),'variable',_0xa521('0x4'))},'keyContent':{'type':Sequelize[_0xa521('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa521('0x6')]},'customField':{'type':Sequelize[_0xa521('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa521('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 530b633..e57cd1c 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 _0x1834=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','reject','save','update','then','end','error','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','findAll','length','include','create','body','catch','find','destroy','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5963c2,_0x2c9119){var _0x2b824d=function(_0x1aada3){while(--_0x1aada3){_0x5963c2['push'](_0x5963c2['shift']());}};_0x2b824d(++_0x2c9119);}(_0x1834,0x1a5));var _0x4183=function(_0x40f31d,_0x166318){_0x40f31d=_0x40f31d-0x0;var _0x10d4e4=_0x1834[_0x40f31d];return _0x10d4e4;};'use strict';var pdf=require(_0x4183('0x0'));var emlformat=require(_0x4183('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4183('0x2'));var jsonpatch=require(_0x4183('0x3'));var rp=require(_0x4183('0x4'));var moment=require(_0x4183('0x5'));var BPromise=require(_0x4183('0x6'));var Mustache=require(_0x4183('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4183('0x8'));var csv=require(_0x4183('0x9'));var ejs=require(_0x4183('0xa'));var fs=require('fs');var _=require(_0x4183('0xb'));var squel=require(_0x4183('0xc'));var crypto=require(_0x4183('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4183('0xe'));var toCsv=require(_0x4183('0x9'));var querystring=require(_0x4183('0xf'));var Papa=require(_0x4183('0x10'));var Redis=require(_0x4183('0x11'));var authService=require(_0x4183('0x12'));var qs=require(_0x4183('0x13'));var as=require(_0x4183('0x14'));var hardwareService=require(_0x4183('0x15'));var logger=require(_0x4183('0x16'))(_0x4183('0x17'));var utils=require(_0x4183('0x18'));var config=require(_0x4183('0x19'));var licenseUtil=require(_0x4183('0x1a'));var db=require(_0x4183('0x1b'))['db'];function respondWithStatusCode(_0x212e63,_0x859b19){_0x859b19=_0x859b19||0xcc;return function(_0x15fe7b){if(_0x15fe7b){return _0x212e63[_0x4183('0x1c')](_0x859b19);}return _0x212e63[_0x4183('0x1d')](_0x859b19)['end']();};}function respondWithResult(_0x198d32,_0x2f143f){_0x2f143f=_0x2f143f||0xc8;return function(_0x3b63a9){if(_0x3b63a9){return _0x198d32[_0x4183('0x1d')](_0x2f143f)[_0x4183('0x1e')](_0x3b63a9);}};}function respondWithFilteredResult(_0x496b35,_0x772fba){return function(_0x3b3e94){if(_0x3b3e94){var _0x57088d=_0x3b3e94[_0x4183('0x1f')],_0x5e0ea7=_0x772fba[_0x4183('0x20')],_0x140c83=_0x772fba['offset']+_0x772fba['limit'],_0xb5c41b;if(_0x140c83>=_0x57088d){_0x140c83=_0x57088d;_0xb5c41b=0xc8;}else{_0xb5c41b=0xce;}_0x496b35['status'](_0xb5c41b);return _0x496b35['set'](_0x4183('0x21'),_0x5e0ea7+'-'+_0x140c83+'/'+_0x57088d)[_0x4183('0x1e')](_0x3b3e94);}return null;};}function patchUpdates(_0x1db3b3){return function(_0x23812c){try{jsonpatch['apply'](_0x23812c,_0x1db3b3,!![]);}catch(_0x4c24b7){return BPromise[_0x4183('0x22')](_0x4c24b7);}return _0x23812c[_0x4183('0x23')]();};}function saveUpdates(_0x3bbf07,_0x38f2b5){return function(_0x40a449){if(_0x40a449){return _0x40a449[_0x4183('0x24')](_0x3bbf07)[_0x4183('0x25')](function(_0x2b1097){return _0x2b1097;});}return null;};}function removeEntity(_0x37e940,_0x4ba677){return function(_0x268dd8){if(_0x268dd8){return _0x268dd8['destroy']()[_0x4183('0x25')](function(){_0x37e940[_0x4183('0x1d')](0xcc)[_0x4183('0x26')]();});}};}function handleEntityNotFound(_0x15874b,_0x2960db){return function(_0x5d8bee){if(!_0x5d8bee){_0x15874b[_0x4183('0x1c')](0x194);}return _0x5d8bee;};}function handleError(_0x2d9468,_0x45b3b7){_0x45b3b7=_0x45b3b7||0x1f4;return function(_0x137a3a){logger[_0x4183('0x27')](_0x137a3a['stack']);if(_0x137a3a[_0x4183('0x28')]){delete _0x137a3a[_0x4183('0x28')];}_0x2d9468[_0x4183('0x1d')](_0x45b3b7)['send'](_0x137a3a);};}exports[_0x4183('0x29')]=function(_0x3c94d9,_0x44adb0){var _0x3f81dc={},_0x266f02={},_0x1ad970={'count':0x0,'rows':[]};var _0x443ce4=_[_0x4183('0x2a')](db[_0x4183('0x2b')][_0x4183('0x2c')],function(_0x5f3cb){return{'name':_0x5f3cb[_0x4183('0x2d')],'type':_0x5f3cb[_0x4183('0x2e')][_0x4183('0x2f')]};});_0x266f02[_0x4183('0x30')]=_['map'](_0x443ce4,_0x4183('0x28'));_0x266f02['query']=_[_0x4183('0x31')](_0x3c94d9[_0x4183('0x32')]);_0x266f02[_0x4183('0x33')]=_['intersection'](_0x266f02[_0x4183('0x30')],_0x266f02['query']);_0x3f81dc[_0x4183('0x34')]=_[_0x4183('0x35')](_0x266f02['model'],qs['fields'](_0x3c94d9['query'][_0x4183('0x36')]));_0x3f81dc[_0x4183('0x34')]=_0x3f81dc[_0x4183('0x34')]['length']?_0x3f81dc['attributes']:_0x266f02[_0x4183('0x30')];if(!_0x3c94d9[_0x4183('0x32')][_0x4183('0x37')]('nolimit')){_0x3f81dc['limit']=qs[_0x4183('0x38')](_0x3c94d9[_0x4183('0x32')][_0x4183('0x38')]);_0x3f81dc[_0x4183('0x20')]=qs[_0x4183('0x20')](_0x3c94d9[_0x4183('0x32')][_0x4183('0x20')]);}_0x3f81dc[_0x4183('0x39')]=qs[_0x4183('0x3a')](_0x3c94d9[_0x4183('0x32')][_0x4183('0x3a')]);_0x3f81dc['where']=qs[_0x4183('0x33')](_[_0x4183('0x3b')](_0x3c94d9[_0x4183('0x32')],_0x266f02['filters']),_0x443ce4);if(_0x3c94d9[_0x4183('0x32')][_0x4183('0x3c')]){_0x3f81dc[_0x4183('0x3d')]=_[_0x4183('0x3e')](_0x3f81dc[_0x4183('0x3d')],{'$or':_[_0x4183('0x2a')](_0x443ce4,function(_0x322340){if(_0x322340[_0x4183('0x2e')]!=='VIRTUAL'){var _0x596298={};_0x596298[_0x322340['name']]={'$like':'%'+_0x3c94d9['query'][_0x4183('0x3c')]+'%'};return _0x596298;}})});}_0x3f81dc=_[_0x4183('0x3e')]({},_0x3f81dc,_0x3c94d9[_0x4183('0x3f')]);var _0x4e58a1={'where':_0x3f81dc[_0x4183('0x3d')]};return db[_0x4183('0x2b')][_0x4183('0x1f')](_0x4e58a1)[_0x4183('0x25')](function(_0x459402){_0x1ad970[_0x4183('0x1f')]=_0x459402;if(_0x3c94d9[_0x4183('0x32')][_0x4183('0x40')]){_0x3f81dc['include']=[{'all':!![]}];}return db[_0x4183('0x2b')][_0x4183('0x41')](_0x3f81dc);})[_0x4183('0x25')](function(_0xad00ba){_0x1ad970['rows']=_0xad00ba;return _0x1ad970;})[_0x4183('0x25')](respondWithFilteredResult(_0x44adb0,_0x3f81dc))['catch'](handleError(_0x44adb0,null));};exports['show']=function(_0x162211,_0x4fa084){var _0x59f31a={'raw':!![],'where':{'id':_0x162211['params']['id']}},_0x2d1ca3={};_0x2d1ca3[_0x4183('0x30')]=_[_0x4183('0x31')](db[_0x4183('0x2b')][_0x4183('0x2c')]);_0x2d1ca3['query']=_['keys'](_0x162211[_0x4183('0x32')]);_0x2d1ca3['filters']=_['intersection'](_0x2d1ca3['model'],_0x2d1ca3[_0x4183('0x32')]);_0x59f31a[_0x4183('0x34')]=_[_0x4183('0x35')](_0x2d1ca3[_0x4183('0x30')],qs[_0x4183('0x36')](_0x162211[_0x4183('0x32')]['fields']));_0x59f31a[_0x4183('0x34')]=_0x59f31a['attributes'][_0x4183('0x42')]?_0x59f31a[_0x4183('0x34')]:_0x2d1ca3[_0x4183('0x30')];if(_0x162211[_0x4183('0x32')]['includeAll']){_0x59f31a[_0x4183('0x43')]=[{'all':!![]}];}_0x59f31a=_[_0x4183('0x3e')]({},_0x59f31a,_0x162211['options']);return db['DeskField']['find'](_0x59f31a)['then'](handleEntityNotFound(_0x4fa084,null))['then'](respondWithResult(_0x4fa084,null))['catch'](handleError(_0x4fa084,null));};exports[_0x4183('0x44')]=function(_0x5e6725,_0x2cc0ed){return db['DeskField'][_0x4183('0x44')](_0x5e6725[_0x4183('0x45')],{})[_0x4183('0x25')](respondWithResult(_0x2cc0ed,0xc9))[_0x4183('0x46')](handleError(_0x2cc0ed,null));};exports[_0x4183('0x24')]=function(_0xdc5058,_0xd0b0d){if(_0xdc5058[_0x4183('0x45')]['id']){delete _0xdc5058['body']['id'];}return db['DeskField'][_0x4183('0x47')]({'where':{'id':_0xdc5058['params']['id']}})[_0x4183('0x25')](handleEntityNotFound(_0xd0b0d,null))[_0x4183('0x25')](saveUpdates(_0xdc5058[_0x4183('0x45')],null))[_0x4183('0x25')](respondWithResult(_0xd0b0d,null))['catch'](handleError(_0xd0b0d,null));};exports[_0x4183('0x48')]=function(_0x201883,_0x1d905c){return db[_0x4183('0x2b')][_0x4183('0x47')]({'where':{'id':_0x201883[_0x4183('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d905c,null))[_0x4183('0x25')](removeEntity(_0x1d905c,null))[_0x4183('0x46')](handleError(_0x1d905c,null));}; \ No newline at end of file +var _0xcb43=['order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','create','body','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x371c0c,_0x4c16ae){var _0x3daee3=function(_0x15ed33){while(--_0x15ed33){_0x371c0c['push'](_0x371c0c['shift']());}};_0x3daee3(++_0x4c16ae);}(_0xcb43,0xef));var _0x3cb4=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0xcb43[_0x393500];return _0x120d3b;};'use strict';var pdf=require(_0x3cb4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3cb4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cb4('0x2'));var rp=require(_0x3cb4('0x3'));var moment=require(_0x3cb4('0x4'));var BPromise=require(_0x3cb4('0x5'));var Mustache=require(_0x3cb4('0x6'));var util=require(_0x3cb4('0x7'));var path=require('path');var sox=require(_0x3cb4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3cb4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3cb4('0xa'));var deskjs=require(_0x3cb4('0xb'));var toCsv=require(_0x3cb4('0xc'));var querystring=require(_0x3cb4('0xd'));var Papa=require(_0x3cb4('0xe'));var Redis=require(_0x3cb4('0xf'));var authService=require(_0x3cb4('0x10'));var qs=require(_0x3cb4('0x11'));var as=require(_0x3cb4('0x12'));var hardwareService=require(_0x3cb4('0x13'));var logger=require('../../config/logger')(_0x3cb4('0x14'));var utils=require(_0x3cb4('0x15'));var config=require(_0x3cb4('0x16'));var licenseUtil=require(_0x3cb4('0x17'));var db=require(_0x3cb4('0x18'))['db'];function respondWithStatusCode(_0x3b1be3,_0x4d24e5){_0x4d24e5=_0x4d24e5||0xcc;return function(_0x378fb5){if(_0x378fb5){return _0x3b1be3[_0x3cb4('0x19')](_0x4d24e5);}return _0x3b1be3[_0x3cb4('0x1a')](_0x4d24e5)[_0x3cb4('0x1b')]();};}function respondWithResult(_0x1d32e4,_0x549d8e){_0x549d8e=_0x549d8e||0xc8;return function(_0x5eee90){if(_0x5eee90){return _0x1d32e4[_0x3cb4('0x1a')](_0x549d8e)['json'](_0x5eee90);}};}function respondWithFilteredResult(_0x2314ff,_0x51e005){return function(_0x28a544){if(_0x28a544){var _0x46025f=_0x28a544['count'],_0x17fcb3=_0x51e005['offset'],_0x5a09fd=_0x51e005[_0x3cb4('0x1c')]+_0x51e005[_0x3cb4('0x1d')],_0x215d1d;if(_0x5a09fd>=_0x46025f){_0x5a09fd=_0x46025f;_0x215d1d=0xc8;}else{_0x215d1d=0xce;}_0x2314ff[_0x3cb4('0x1a')](_0x215d1d);return _0x2314ff[_0x3cb4('0x1e')](_0x3cb4('0x1f'),_0x17fcb3+'-'+_0x5a09fd+'/'+_0x46025f)['json'](_0x28a544);}return null;};}function patchUpdates(_0x421b03){return function(_0x2b3b2f){try{jsonpatch[_0x3cb4('0x20')](_0x2b3b2f,_0x421b03,!![]);}catch(_0x477cbd){return BPromise[_0x3cb4('0x21')](_0x477cbd);}return _0x2b3b2f['save']();};}function saveUpdates(_0xfe59aa,_0x1c7e45){return function(_0x26706f){if(_0x26706f){return _0x26706f[_0x3cb4('0x22')](_0xfe59aa)[_0x3cb4('0x23')](function(_0x26beec){return _0x26beec;});}return null;};}function removeEntity(_0x1621ed,_0x84af57){return function(_0x12c5b8){if(_0x12c5b8){return _0x12c5b8[_0x3cb4('0x24')]()['then'](function(){_0x1621ed[_0x3cb4('0x1a')](0xcc)[_0x3cb4('0x1b')]();});}};}function handleEntityNotFound(_0x7acb81,_0x3e6aa1){return function(_0x38d22a){if(!_0x38d22a){_0x7acb81[_0x3cb4('0x19')](0x194);}return _0x38d22a;};}function handleError(_0x551531,_0x52126b){_0x52126b=_0x52126b||0x1f4;return function(_0xa38871){logger[_0x3cb4('0x25')](_0xa38871[_0x3cb4('0x26')]);if(_0xa38871[_0x3cb4('0x27')]){delete _0xa38871[_0x3cb4('0x27')];}_0x551531[_0x3cb4('0x1a')](_0x52126b)[_0x3cb4('0x28')](_0xa38871);};}exports[_0x3cb4('0x29')]=function(_0x9960f3,_0x2aa569){var _0x193351={},_0x352e1f={},_0x1498b0={'count':0x0,'rows':[]};var _0x39720b=_[_0x3cb4('0x2a')](db[_0x3cb4('0x2b')]['rawAttributes'],function(_0x28c0ae){return{'name':_0x28c0ae[_0x3cb4('0x2c')],'type':_0x28c0ae[_0x3cb4('0x2d')][_0x3cb4('0x2e')]};});_0x352e1f[_0x3cb4('0x2f')]=_['map'](_0x39720b,'name');_0x352e1f[_0x3cb4('0x30')]=_[_0x3cb4('0x31')](_0x9960f3['query']);_0x352e1f[_0x3cb4('0x32')]=_[_0x3cb4('0x33')](_0x352e1f[_0x3cb4('0x2f')],_0x352e1f['query']);_0x193351[_0x3cb4('0x34')]=_[_0x3cb4('0x33')](_0x352e1f['model'],qs[_0x3cb4('0x35')](_0x9960f3[_0x3cb4('0x30')][_0x3cb4('0x35')]));_0x193351[_0x3cb4('0x34')]=_0x193351[_0x3cb4('0x34')][_0x3cb4('0x36')]?_0x193351['attributes']:_0x352e1f[_0x3cb4('0x2f')];if(!_0x9960f3[_0x3cb4('0x30')][_0x3cb4('0x37')](_0x3cb4('0x38'))){_0x193351[_0x3cb4('0x1d')]=qs[_0x3cb4('0x1d')](_0x9960f3[_0x3cb4('0x30')][_0x3cb4('0x1d')]);_0x193351['offset']=qs[_0x3cb4('0x1c')](_0x9960f3[_0x3cb4('0x30')]['offset']);}_0x193351[_0x3cb4('0x39')]=qs[_0x3cb4('0x3a')](_0x9960f3['query']['sort']);_0x193351['where']=qs[_0x3cb4('0x32')](_[_0x3cb4('0x3b')](_0x9960f3[_0x3cb4('0x30')],_0x352e1f[_0x3cb4('0x32')]),_0x39720b);if(_0x9960f3[_0x3cb4('0x30')][_0x3cb4('0x3c')]){_0x193351[_0x3cb4('0x3d')]=_[_0x3cb4('0x3e')](_0x193351[_0x3cb4('0x3d')],{'$or':_[_0x3cb4('0x2a')](_0x39720b,function(_0xb9cb35){if(_0xb9cb35[_0x3cb4('0x2d')]!==_0x3cb4('0x3f')){var _0x20ef73={};_0x20ef73[_0xb9cb35[_0x3cb4('0x27')]]={'$like':'%'+_0x9960f3[_0x3cb4('0x30')][_0x3cb4('0x3c')]+'%'};return _0x20ef73;}})});}_0x193351=_['merge']({},_0x193351,_0x9960f3[_0x3cb4('0x40')]);var _0x1db3c6={'where':_0x193351['where']};return db['DeskField'][_0x3cb4('0x41')](_0x1db3c6)['then'](function(_0x4c35c3){_0x1498b0['count']=_0x4c35c3;if(_0x9960f3['query'][_0x3cb4('0x42')]){_0x193351[_0x3cb4('0x43')]=[{'all':!![]}];}return db['DeskField'][_0x3cb4('0x44')](_0x193351);})[_0x3cb4('0x23')](function(_0x1db4f0){_0x1498b0['rows']=_0x1db4f0;return _0x1498b0;})[_0x3cb4('0x23')](respondWithFilteredResult(_0x2aa569,_0x193351))[_0x3cb4('0x45')](handleError(_0x2aa569,null));};exports['show']=function(_0x28213f,_0x25c97d){var _0x591e13={'raw':!![],'where':{'id':_0x28213f[_0x3cb4('0x46')]['id']}},_0x489efa={};_0x489efa[_0x3cb4('0x2f')]=_['keys'](db['DeskField']['rawAttributes']);_0x489efa['query']=_[_0x3cb4('0x31')](_0x28213f[_0x3cb4('0x30')]);_0x489efa[_0x3cb4('0x32')]=_['intersection'](_0x489efa[_0x3cb4('0x2f')],_0x489efa[_0x3cb4('0x30')]);_0x591e13[_0x3cb4('0x34')]=_[_0x3cb4('0x33')](_0x489efa['model'],qs[_0x3cb4('0x35')](_0x28213f[_0x3cb4('0x30')][_0x3cb4('0x35')]));_0x591e13[_0x3cb4('0x34')]=_0x591e13[_0x3cb4('0x34')]['length']?_0x591e13[_0x3cb4('0x34')]:_0x489efa[_0x3cb4('0x2f')];if(_0x28213f[_0x3cb4('0x30')]['includeAll']){_0x591e13[_0x3cb4('0x43')]=[{'all':!![]}];}_0x591e13=_[_0x3cb4('0x3e')]({},_0x591e13,_0x28213f[_0x3cb4('0x40')]);return db[_0x3cb4('0x2b')]['find'](_0x591e13)['then'](handleEntityNotFound(_0x25c97d,null))[_0x3cb4('0x23')](respondWithResult(_0x25c97d,null))[_0x3cb4('0x45')](handleError(_0x25c97d,null));};exports[_0x3cb4('0x47')]=function(_0x18bb93,_0x3c2d67){return db[_0x3cb4('0x2b')][_0x3cb4('0x47')](_0x18bb93[_0x3cb4('0x48')],{})['then'](respondWithResult(_0x3c2d67,0xc9))[_0x3cb4('0x45')](handleError(_0x3c2d67,null));};exports[_0x3cb4('0x22')]=function(_0x4a07d9,_0x259ed3){if(_0x4a07d9[_0x3cb4('0x48')]['id']){delete _0x4a07d9['body']['id'];}return db[_0x3cb4('0x2b')][_0x3cb4('0x49')]({'where':{'id':_0x4a07d9[_0x3cb4('0x46')]['id']}})[_0x3cb4('0x23')](handleEntityNotFound(_0x259ed3,null))[_0x3cb4('0x23')](saveUpdates(_0x4a07d9[_0x3cb4('0x48')],null))[_0x3cb4('0x23')](respondWithResult(_0x259ed3,null))[_0x3cb4('0x45')](handleError(_0x259ed3,null));};exports[_0x3cb4('0x24')]=function(_0x35060c,_0x4a1fae){return db[_0x3cb4('0x2b')]['find']({'where':{'id':_0x35060c[_0x3cb4('0x46')]['id']}})[_0x3cb4('0x23')](handleEntityNotFound(_0x4a1fae,null))['then'](removeEntity(_0x4a1fae,null))[_0x3cb4('0x45')](handleError(_0x4a1fae,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7d04d68..27d99ff 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 _0x699e=['exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intDeskField.attributes'];(function(_0x4c3217,_0x223df1){var _0x5f17be=function(_0x21658f){while(--_0x21658f){_0x4c3217['push'](_0x4c3217['shift']());}};_0x5f17be(++_0x223df1);}(_0x699e,0x68));var _0xe699=function(_0x38c719,_0x1b266){_0x38c719=_0x38c719-0x0;var _0x3ff3cf=_0x699e[_0x38c719];return _0x3ff3cf;};'use strict';var _=require(_0xe699('0x0'));var util=require(_0xe699('0x1'));var logger=require(_0xe699('0x2'))(_0xe699('0x3'));var moment=require(_0xe699('0x4'));var BPromise=require(_0xe699('0x5'));var rp=require(_0xe699('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe699('0x7'));module[_0xe699('0x8')]=function(_0x7b2631,_0x549a89){return _0x7b2631[_0xe699('0x9')](_0xe699('0xa'),attributes,{'tableName':_0xe699('0xb'),'paranoid':![],'indexes':[{'name':_0xe699('0xc'),'fields':[_0xe699('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x10e1=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x3809a2,_0x5aadbb){var _0x527af8=function(_0x3ac111){while(--_0x3ac111){_0x3809a2['push'](_0x3809a2['shift']());}};_0x527af8(++_0x5aadbb);}(_0x10e1,0x12b));var _0x110e=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x10e1[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x110e('0x0'));var util=require(_0x110e('0x1'));var logger=require(_0x110e('0x2'))(_0x110e('0x3'));var moment=require('moment');var BPromise=require(_0x110e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x110e('0x5'));var rimraf=require(_0x110e('0x6'));var config=require(_0x110e('0x7'));var attributes=require(_0x110e('0x8'));module['exports']=function(_0x1eda8a,_0x29108b){return _0x1eda8a[_0x110e('0x9')](_0x110e('0xa'),attributes,{'tableName':_0x110e('0xb'),'paranoid':![],'indexes':[{'name':_0x110e('0xc'),'fields':[_0x110e('0xd'),_0x110e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 2f725a7..31d96af 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 _0x6d04=['moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x6d04,0x12a));var _0x46d0=function(_0x5bd072,_0x3f02d6){_0x5bd072=_0x5bd072-0x0;var _0x17c868=_0x6d04[_0x5bd072];return _0x17c868;};'use strict';var _=require(_0x46d0('0x0'));var util=require(_0x46d0('0x1'));var moment=require(_0x46d0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46d0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x46d0('0x4'));var logger=require(_0x46d0('0x5'))(_0x46d0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x46d0('0x7')][_0x46d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ddc36,_0x1289c7,_0x5c8dc4){return new BPromise(function(_0x258507,_0x5900e8){return client[_0x46d0('0x9')](_0x1ddc36,_0x5c8dc4)[_0x46d0('0xa')](function(_0x23ea0b){logger[_0x46d0('0xb')]('DeskField,\x20%s,\x20%s',_0x1289c7,'request\x20sent');logger[_0x46d0('0xc')](_0x46d0('0xd'),_0x1289c7,_0x46d0('0xe'),JSON['stringify'](_0x23ea0b));if(_0x23ea0b[_0x46d0('0xf')]){if(_0x23ea0b[_0x46d0('0xf')][_0x46d0('0x10')]===0x1f4){logger[_0x46d0('0xf')](_0x46d0('0x11'),_0x1289c7,_0x23ea0b[_0x46d0('0xf')][_0x46d0('0x12')]);return _0x5900e8(_0x23ea0b['error'][_0x46d0('0x12')]);}logger[_0x46d0('0xf')]('DeskField,\x20%s,\x20%s',_0x1289c7,_0x23ea0b['error'][_0x46d0('0x12')]);return _0x258507(_0x23ea0b[_0x46d0('0xf')][_0x46d0('0x12')]);}else{logger[_0x46d0('0xb')](_0x46d0('0x11'),_0x1289c7,_0x46d0('0xe'));_0x258507(_0x23ea0b[_0x46d0('0x13')][_0x46d0('0x12')]);}})['catch'](function(_0x2f8504){logger[_0x46d0('0xf')](_0x46d0('0x11'),_0x1289c7,_0x2f8504);_0x5900e8(_0x2f8504);});});} \ No newline at end of file +var _0x1967=['util','moment','ioredis','../../mysqldb','../../config/utils','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x1b73a5,_0x3d9d79){var _0x4c0efd=function(_0x2ba325){while(--_0x2ba325){_0x1b73a5['push'](_0x1b73a5['shift']());}};_0x4c0efd(++_0x3d9d79);}(_0x1967,0x17b));var _0x7196=function(_0x2f2718,_0x3306d2){_0x2f2718=_0x2f2718-0x0;var _0x963f86=_0x1967[_0x2f2718];return _0x963f86;};'use strict';var _=require(_0x7196('0x0'));var util=require(_0x7196('0x1'));var moment=require(_0x7196('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7196('0x3'));var db=require(_0x7196('0x4'))['db'];var utils=require(_0x7196('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7196('0x6')][_0x7196('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38dcfb,_0x2abdbf,_0x427f44){return new BPromise(function(_0x330348,_0x2e3062){return client[_0x7196('0x8')](_0x38dcfb,_0x427f44)[_0x7196('0x9')](function(_0x399c06){logger['info'](_0x7196('0xa'),_0x2abdbf,_0x7196('0xb'));logger[_0x7196('0xc')](_0x7196('0xd'),_0x2abdbf,_0x7196('0xb'),JSON['stringify'](_0x399c06));if(_0x399c06[_0x7196('0xe')]){if(_0x399c06[_0x7196('0xe')][_0x7196('0xf')]===0x1f4){logger[_0x7196('0xe')](_0x7196('0xa'),_0x2abdbf,_0x399c06['error'][_0x7196('0x10')]);return _0x2e3062(_0x399c06[_0x7196('0xe')][_0x7196('0x10')]);}logger[_0x7196('0xe')](_0x7196('0xa'),_0x2abdbf,_0x399c06[_0x7196('0xe')]['message']);return _0x330348(_0x399c06['error']['message']);}else{logger[_0x7196('0x11')](_0x7196('0xa'),_0x2abdbf,_0x7196('0xb'));_0x330348(_0x399c06[_0x7196('0x12')][_0x7196('0x10')]);}})[_0x7196('0x13')](function(_0x18eb1d){logger[_0x7196('0xe')](_0x7196('0xa'),_0x2abdbf,_0x18eb1d);_0x2e3062(_0x18eb1d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 016d091..ecbbafd 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 _0x5f66=['../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','show','get','/:id/configurations','getConfigurations','getFields','post','addConfiguration','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/:id',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['get']('/:id/fields',auth[_0x65f6('0x7')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')]('/',auth[_0x65f6('0x7')](),controller['create']);router[_0x65f6('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['put'](_0x65f6('0x10'),auth['isAuthenticated'](),controller[_0x65f6('0x11')]);router[_0x65f6('0x12')](_0x65f6('0x10'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x13')]);module[_0x65f6('0x14')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0xf246f6,_0x25cdaf){var _0x4e5397=function(_0x24e930){while(--_0x24e930){_0xf246f6['push'](_0xf246f6['shift']());}};_0x4e5397(++_0x25cdaf);}(_0xb10b,0x12a));var _0xbb10=function(_0x29eb10,_0x190cb3){_0x29eb10=_0x29eb10-0x0;var _0x5371a2=_0xb10b[_0x29eb10];return _0x5371a2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getFields']);router['post']('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router[_0xbb10('0x10')]('/:id/configurations',auth[_0xbb10('0x9')](),controller['addConfiguration']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index cd4662c..04b2bdb 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 _0x054e=['STRING','sequelize'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x054e,0xaf));var _0xe054=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x054e[_0x55d58f];return _0x1ad6e6;};'use strict';var Sequelize=require(_0xe054('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe054('0x1')]},'remoteUri':{'type':Sequelize[_0xe054('0x1')]},'tenantId':{'type':Sequelize[_0xe054('0x1')]},'clientId':{'type':Sequelize[_0xe054('0x1')]},'clientSecret':{'type':Sequelize[_0xe054('0x1')]},'serverUrl':{'type':Sequelize[_0xe054('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe054('0x1')]}}; \ No newline at end of file +var _0x77ce=['exports','STRING','sequelize'];(function(_0x39bea2,_0x5371a7){var _0x1b0c8a=function(_0x1f3bb7){while(--_0x1f3bb7){_0x39bea2['push'](_0x39bea2['shift']());}};_0x1b0c8a(++_0x5371a7);}(_0x77ce,0x86));var _0xe77c=function(_0x444606,_0x1eb292){_0x444606=_0x444606-0x0;var _0x1262d5=_0x77ce[_0x444606];return _0x1262d5;};'use strict';var Sequelize=require(_0xe77c('0x0'));module[_0xe77c('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe77c('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe77c('0x2')]},'tenantId':{'type':Sequelize[_0xe77c('0x2')]},'clientId':{'type':Sequelize[_0xe77c('0x2')]},'clientSecret':{'type':Sequelize[_0xe77c('0x2')]},'serverUrl':{'type':Sequelize[_0xe77c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe77c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index aae9dc8..e1242c3 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 _0x8958=['keys','filters','intersection','attributes','model','fields','length','nolimit','limit','pick','filter','merge','where','options','includeAll','include','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','sort','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','username','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','moment','mustache','util','path','to-csv','ejs','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','query'];(function(_0x1290be,_0x5a14d8){var _0x2108d7=function(_0x5c7907){while(--_0x5c7907){_0x1290be['push'](_0x1290be['shift']());}};_0x2108d7(++_0x5a14d8);}(_0x8958,0x93));var _0x8895=function(_0xb36843,_0x57c1f4){_0xb36843=_0xb36843-0x0;var _0x227b83=_0x8958[_0xb36843];return _0x227b83;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8895('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8895('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8895('0x2'));var util=require(_0x8895('0x3'));var path=require(_0x8895('0x4'));var sox=require('sox');var csv=require(_0x8895('0x5'));var ejs=require(_0x8895('0x6'));var fs=require('fs');var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0x5'));var querystring=require(_0x8895('0xb'));var Papa=require(_0x8895('0xc'));var Redis=require(_0x8895('0xd'));var authService=require(_0x8895('0xe'));var qs=require(_0x8895('0xf'));var as=require(_0x8895('0x10'));var hardwareService=require(_0x8895('0x11'));var logger=require(_0x8895('0x12'))('api');var utils=require(_0x8895('0x13'));var config=require(_0x8895('0x14'));var licenseUtil=require(_0x8895('0x15'));var db=require(_0x8895('0x16'))['db'];var integrations=require(_0x8895('0x17'));var jayson=require(_0x8895('0x18'));var client=jayson['client'][_0x8895('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x34e856,_0x56c18e,_0x57d40a,_0x47b9fe){return new BPromise(function(_0x9191b8,_0x4e8f53){var _0x4156f5=_0x47b9fe||client;return _0x4156f5[_0x8895('0x1a')](_0x34e856,_0x57d40a)[_0x8895('0x1b')](function(_0x3d7b59){logger[_0x8895('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x56c18e,_0x8895('0x1d'));logger[_0x8895('0x1e')](_0x8895('0x1f'),_0x56c18e,_0x8895('0x1d'),JSON[_0x8895('0x20')](_0x3d7b59));if(_0x3d7b59[_0x8895('0x21')]){if(_0x3d7b59[_0x8895('0x21')][_0x8895('0x22')]===0x1f4){logger[_0x8895('0x21')](_0x8895('0x23'),_0x56c18e,_0x3d7b59[_0x8895('0x21')][_0x8895('0x24')]);return _0x4e8f53(_0x3d7b59[_0x8895('0x21')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x56c18e,_0x3d7b59[_0x8895('0x21')][_0x8895('0x24')]);return _0x9191b8(_0x3d7b59[_0x8895('0x21')][_0x8895('0x24')]);}else{logger[_0x8895('0x1c')](_0x8895('0x23'),_0x56c18e,_0x8895('0x1d'));_0x9191b8(_0x3d7b59[_0x8895('0x25')]['message']);}})[_0x8895('0x26')](function(_0x5db3a0){logger[_0x8895('0x21')](_0x8895('0x23'),_0x56c18e,_0x5db3a0);_0x4e8f53(_0x5db3a0);});});}function respondWithStatusCode(_0x29223d,_0x4d092d){_0x4d092d=_0x4d092d||0xcc;return function(_0x5d354a){if(_0x5d354a){return _0x29223d[_0x8895('0x27')](_0x4d092d);}return _0x29223d[_0x8895('0x28')](_0x4d092d)[_0x8895('0x29')]();};}function respondWithResult(_0x24a376,_0x4fc150){_0x4fc150=_0x4fc150||0xc8;return function(_0x25da11){if(_0x25da11){return _0x24a376[_0x8895('0x28')](_0x4fc150)[_0x8895('0x2a')](_0x25da11);}};}function respondWithFilteredResult(_0x5486a6,_0x4aee03){return function(_0x78b57){if(_0x78b57){var _0x555e60=_0x78b57[_0x8895('0x2b')],_0x3d51b0=_0x4aee03[_0x8895('0x2c')],_0x3e3b48=_0x4aee03['offset']+_0x4aee03['limit'],_0x10b48f;if(_0x3e3b48>=_0x555e60){_0x3e3b48=_0x555e60;_0x10b48f=0xc8;}else{_0x10b48f=0xce;}_0x5486a6[_0x8895('0x28')](_0x10b48f);return _0x5486a6[_0x8895('0x2d')](_0x8895('0x2e'),_0x3d51b0+'-'+_0x3e3b48+'/'+_0x555e60)[_0x8895('0x2a')](_0x78b57);}return null;};}function patchUpdates(_0x19b6dd){return function(_0x560b93){try{jsonpatch['apply'](_0x560b93,_0x19b6dd,!![]);}catch(_0x46ae32){return BPromise[_0x8895('0x2f')](_0x46ae32);}return _0x560b93[_0x8895('0x30')]();};}function saveUpdates(_0x29f565,_0x1eabb6){return function(_0x52f2ac){if(_0x52f2ac){return _0x52f2ac[_0x8895('0x31')](_0x29f565)['then'](function(_0x3f055a){return _0x3f055a;});}return null;};}function removeEntity(_0x5b2b19,_0x40ba14){return function(_0x1a3fe5){if(_0x1a3fe5){return _0x1a3fe5[_0x8895('0x32')]()[_0x8895('0x1b')](function(){_0x5b2b19[_0x8895('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c54a0,_0xcba076){return function(_0x1b5359){if(!_0x1b5359){_0x2c54a0[_0x8895('0x27')](0x194);}return _0x1b5359;};}function handleError(_0x330692,_0x574f0e){_0x574f0e=_0x574f0e||0x1f4;return function(_0x2880a6){logger['error'](_0x2880a6[_0x8895('0x33')]);if(_0x2880a6['name']){delete _0x2880a6[_0x8895('0x34')];}_0x330692[_0x8895('0x28')](_0x574f0e)[_0x8895('0x35')](_0x2880a6);};}exports[_0x8895('0x36')]=function(_0xd08bf3,_0x4ee352){var _0x1cff8e={},_0x484606={},_0x57f58a={'count':0x0,'rows':[]};var _0xcc735f=_[_0x8895('0x37')](db[_0x8895('0x38')][_0x8895('0x39')],function(_0x16e110){return{'name':_0x16e110['fieldName'],'type':_0x16e110[_0x8895('0x3a')][_0x8895('0x3b')]};});_0x484606['model']=_[_0x8895('0x37')](_0xcc735f,'name');_0x484606[_0x8895('0x3c')]=_[_0x8895('0x3d')](_0xd08bf3['query']);_0x484606[_0x8895('0x3e')]=_[_0x8895('0x3f')](_0x484606['model'],_0x484606['query']);_0x1cff8e[_0x8895('0x40')]=_[_0x8895('0x3f')](_0x484606[_0x8895('0x41')],qs[_0x8895('0x42')](_0xd08bf3[_0x8895('0x3c')]['fields']));_0x1cff8e[_0x8895('0x40')]=_0x1cff8e[_0x8895('0x40')][_0x8895('0x43')]?_0x1cff8e[_0x8895('0x40')]:_0x484606[_0x8895('0x41')];if(!_0xd08bf3[_0x8895('0x3c')]['hasOwnProperty'](_0x8895('0x44'))){_0x1cff8e['limit']=qs[_0x8895('0x45')](_0xd08bf3[_0x8895('0x3c')]['limit']);_0x1cff8e[_0x8895('0x2c')]=qs['offset'](_0xd08bf3[_0x8895('0x3c')]['offset']);}_0x1cff8e['order']=qs['sort'](_0xd08bf3['query']['sort']);_0x1cff8e['where']=qs[_0x8895('0x3e')](_[_0x8895('0x46')](_0xd08bf3['query'],_0x484606['filters']),_0xcc735f);if(_0xd08bf3[_0x8895('0x3c')][_0x8895('0x47')]){_0x1cff8e['where']=_[_0x8895('0x48')](_0x1cff8e[_0x8895('0x49')],{'$or':_[_0x8895('0x37')](_0xcc735f,function(_0x3b873b){if(_0x3b873b[_0x8895('0x3a')]!=='VIRTUAL'){var _0x549080={};_0x549080[_0x3b873b['name']]={'$like':'%'+_0xd08bf3[_0x8895('0x3c')]['filter']+'%'};return _0x549080;}})});}_0x1cff8e=_[_0x8895('0x48')]({},_0x1cff8e,_0xd08bf3[_0x8895('0x4a')]);var _0x2bfd7c={'where':_0x1cff8e[_0x8895('0x49')]};return db['Dynamics365Account'][_0x8895('0x2b')](_0x2bfd7c)[_0x8895('0x1b')](function(_0x3413cd){_0x57f58a[_0x8895('0x2b')]=_0x3413cd;if(_0xd08bf3[_0x8895('0x3c')][_0x8895('0x4b')]){_0x1cff8e[_0x8895('0x4c')]=[{'all':!![]}];}return db[_0x8895('0x38')]['findAll'](_0x1cff8e);})[_0x8895('0x1b')](function(_0x3bf0e3){_0x57f58a['rows']=_0x3bf0e3;return _0x57f58a;})[_0x8895('0x1b')](respondWithFilteredResult(_0x4ee352,_0x1cff8e))['catch'](handleError(_0x4ee352,null));};exports['show']=function(_0x13546d,_0x337a9f){var _0x130018={'raw':![],'where':{'id':_0x13546d[_0x8895('0x4d')]['id']}},_0x53c4a2={};_0x53c4a2['model']=_[_0x8895('0x3d')](db[_0x8895('0x38')][_0x8895('0x39')]);_0x53c4a2[_0x8895('0x3c')]=_[_0x8895('0x3d')](_0x13546d[_0x8895('0x3c')]);_0x53c4a2[_0x8895('0x3e')]=_['intersection'](_0x53c4a2['model'],_0x53c4a2[_0x8895('0x3c')]);_0x130018[_0x8895('0x40')]=_['intersection'](_0x53c4a2[_0x8895('0x41')],qs['fields'](_0x13546d['query'][_0x8895('0x42')]));_0x130018['attributes']=_0x130018[_0x8895('0x40')][_0x8895('0x43')]?_0x130018[_0x8895('0x40')]:_0x53c4a2[_0x8895('0x41')];if(_0x13546d[_0x8895('0x3c')][_0x8895('0x4b')]){_0x130018[_0x8895('0x4c')]=[{'all':!![]}];}_0x130018=_[_0x8895('0x48')]({},_0x130018,_0x13546d['options']);return db[_0x8895('0x38')][_0x8895('0x4e')](_0x130018)[_0x8895('0x1b')](handleEntityNotFound(_0x337a9f,null))['then'](respondWithResult(_0x337a9f,null))[_0x8895('0x26')](handleError(_0x337a9f,null));};exports[_0x8895('0x4f')]=function(_0xd7ffeb,_0x14e769){return db[_0x8895('0x38')][_0x8895('0x4f')](_0xd7ffeb[_0x8895('0x50')],{})[_0x8895('0x1b')](respondWithResult(_0x14e769,0xc9))[_0x8895('0x26')](handleError(_0x14e769,null));};exports[_0x8895('0x31')]=function(_0x4fe2c4,_0x2fe39c){if(_0x4fe2c4[_0x8895('0x50')]['id']){delete _0x4fe2c4[_0x8895('0x50')]['id'];}return db[_0x8895('0x38')][_0x8895('0x4e')]({'where':{'id':_0x4fe2c4['params']['id']}})[_0x8895('0x1b')](handleEntityNotFound(_0x2fe39c,null))[_0x8895('0x1b')](saveUpdates(_0x4fe2c4[_0x8895('0x50')],null))[_0x8895('0x1b')](respondWithResult(_0x2fe39c,null))[_0x8895('0x26')](handleError(_0x2fe39c,null));};exports['destroy']=function(_0x46389f,_0x1e12de){return db[_0x8895('0x38')]['find']({'where':{'id':_0x46389f[_0x8895('0x4d')]['id']}})[_0x8895('0x1b')](handleEntityNotFound(_0x1e12de,null))[_0x8895('0x1b')](removeEntity(_0x1e12de,null))['catch'](handleError(_0x1e12de,null));};exports[_0x8895('0x51')]=function(_0x207548,_0x564284,_0x2b6ceb){var _0x26f68c={};var _0x5198f8={};var _0x2f990a;var _0x2794c1;return db[_0x8895('0x38')][_0x8895('0x52')]({'where':{'id':_0x207548['params']['id']}})['then'](handleEntityNotFound(_0x564284,null))[_0x8895('0x1b')](function(_0x32f704){if(_0x32f704){_0x2f990a=_0x32f704;_0x5198f8[_0x8895('0x41')]=_['keys'](db[_0x8895('0x53')][_0x8895('0x39')]);_0x5198f8['query']=_[_0x8895('0x3d')](_0x207548['query']);_0x5198f8[_0x8895('0x3e')]=_[_0x8895('0x3f')](_0x5198f8[_0x8895('0x41')],_0x5198f8[_0x8895('0x3c')]);_0x26f68c[_0x8895('0x40')]=_['intersection'](_0x5198f8['model'],qs[_0x8895('0x42')](_0x207548[_0x8895('0x3c')]['fields']));_0x26f68c[_0x8895('0x40')]=_0x26f68c[_0x8895('0x40')][_0x8895('0x43')]?_0x26f68c[_0x8895('0x40')]:_0x5198f8['model'];_0x26f68c[_0x8895('0x54')]=qs[_0x8895('0x55')](_0x207548[_0x8895('0x3c')][_0x8895('0x55')]);_0x26f68c[_0x8895('0x49')]=qs[_0x8895('0x3e')](_[_0x8895('0x46')](_0x207548[_0x8895('0x3c')],_0x5198f8[_0x8895('0x3e')]));if(_0x207548[_0x8895('0x3c')][_0x8895('0x47')]){_0x26f68c[_0x8895('0x49')]=_[_0x8895('0x48')](_0x26f68c[_0x8895('0x49')],{'$or':_[_0x8895('0x37')](_0x26f68c['attributes'],function(_0x5a60ee){var _0x5b96fe={};_0x5b96fe[_0x5a60ee]={'$like':'%'+_0x207548[_0x8895('0x3c')][_0x8895('0x47')]+'%'};return _0x5b96fe;})});}_0x26f68c=_[_0x8895('0x48')]({},_0x26f68c,_0x207548[_0x8895('0x4a')]);return _0x2f990a[_0x8895('0x51')](_0x26f68c);}})['then'](function(_0x816803){if(_0x816803){_0x2794c1=_0x816803[_0x8895('0x43')];if(!_0x207548['query'][_0x8895('0x56')](_0x8895('0x44'))){_0x26f68c[_0x8895('0x45')]=qs[_0x8895('0x45')](_0x207548[_0x8895('0x3c')]['limit']);_0x26f68c[_0x8895('0x2c')]=qs[_0x8895('0x2c')](_0x207548[_0x8895('0x3c')][_0x8895('0x2c')]);}return _0x2f990a[_0x8895('0x51')](_0x26f68c);}})[_0x8895('0x1b')](function(_0x22f220){if(_0x22f220){return _0x22f220?{'count':_0x2794c1,'rows':_0x22f220}:null;}})['then'](respondWithResult(_0x564284,null))[_0x8895('0x26')](handleError(_0x564284,null));};exports[_0x8895('0x57')]=function(_0x49dcab,_0x1ffefd,_0x1f404e){if(_0x49dcab[_0x8895('0x50')]['id']){delete _0x49dcab[_0x8895('0x50')]['id'];}return db[_0x8895('0x38')]['findOne']({'where':{'id':_0x49dcab[_0x8895('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ffefd,null))[_0x8895('0x1b')](function(_0x2440cb){if(_0x2440cb){_0x49dcab['body'][_0x8895('0x58')]=_0x2440cb['id'];_0x49dcab[_0x8895('0x50')][_0x8895('0x59')]=integrations[_0x8895('0x5a')](_0x49dcab['body'][_0x8895('0x5b')],_0x49dcab['body']['type']);_0x49dcab[_0x8895('0x50')][_0x8895('0x5c')]=integrations[_0x8895('0x5d')](_0x49dcab['body'][_0x8895('0x5b')],_0x49dcab['body'][_0x8895('0x3a')]);return db[_0x8895('0x53')][_0x8895('0x4f')](_0x49dcab[_0x8895('0x50')],{'include':[{'model':db[_0x8895('0x5e')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x8895('0x5c')}]});}return null;})['then'](respondWithResult(_0x1ffefd,null))[_0x8895('0x26')](handleError(_0x1ffefd,null));};exports[_0x8895('0x5f')]=function(_0x4925c4,_0xd1fd50,_0xd9637a){var _0x3ace6f=_0x4925c4[_0x8895('0x3c')][_0x8895('0x60')];var _0x4f80a3=_0x3ace6f===_0x8895('0x61')?'Incident':'PhoneCall';var _0x35b354='';var _0x5276f3='';var _0x39a9f7='';var _0x35646f='';var _0x64eca7='';var _0x39f5e5='';var _0x53591d='';var _0x4d802e='';var _0x571731=[_0x8895('0x62'),_0x8895('0x63'),_0x8895('0x64'),_0x8895('0x65'),_0x8895('0x66'),_0x8895('0x67'),'phonenumber',_0x8895('0x68'),_0x8895('0x69'),_0x8895('0x6a')];var _0x584a1f=[_0x8895('0x6b'),'accountidyominame',_0x8895('0x6c'),'billedserviceunits',_0x8895('0x6d'),_0x8895('0x6e'),'contractdetailidname',_0x8895('0x6f'),_0x8895('0x70'),'createdbyexternalpartyyominame',_0x8895('0x71'),_0x8895('0x72'),_0x8895('0x73'),_0x8895('0x74'),_0x8895('0x75'),_0x8895('0x76'),_0x8895('0x77'),'customeridyominame',_0x8895('0x78'),'entitlementidname',_0x8895('0x79'),_0x8895('0x7a'),_0x8895('0x7b'),_0x8895('0x7c'),'firstresponsebykpiidname',_0x8895('0x7d'),_0x8895('0x7e'),_0x8895('0x7f'),_0x8895('0x80'),_0x8895('0x81'),_0x8895('0x82'),_0x8895('0x83'),_0x8895('0x84'),'modifiedbyname',_0x8895('0x85'),_0x8895('0x86'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x8895('0x87'),_0x8895('0x88'),_0x8895('0x89'),_0x8895('0x8a'),'overriddencreatedon','owneridname',_0x8895('0x8b'),_0x8895('0x8c'),_0x8895('0x8d'),_0x8895('0x8e'),_0x8895('0x8f'),'prioritycodename',_0x8895('0x90'),_0x8895('0x91'),'resolveby',_0x8895('0x92'),_0x8895('0x93'),_0x8895('0x94'),_0x8895('0x95'),_0x8895('0x96'),_0x8895('0x97'),'slaname',_0x8895('0x98'),_0x8895('0x99'),'statuscode','subjectidname','ticketnumber',_0x8895('0x9a'),_0x8895('0x9b'),'traversedpath',_0x8895('0x9c'),'versionnumber'];var _0x5b6861=_0x571731['concat'](_0x584a1f);return db[_0x8895('0x38')][_0x8895('0x52')]({'where':{'id':_0x4925c4[_0x8895('0x4d')]['id']},'attributes':['id',_0x8895('0x9d'),_0x8895('0x9e'),'remoteUri',_0x8895('0x9f'),_0x8895('0xa0'),_0x8895('0xa1')]})['then'](handleEntityNotFound(_0xd1fd50,null))['then'](function(_0x484cd8){if(_0x484cd8){_0x4d802e=_0x484cd8[_0x8895('0xa2')];var _0x1d796a=_0x4d802e[_0x8895('0xa3')](-0x1);if(_0x1d796a==='/'){_0x4d802e=_0x4d802e[_0x8895('0xa4')](0x0,_0x4d802e[_0x8895('0xa5')](_0x1d796a));}_0x53591d=util[_0x8895('0xa6')](_0x8895('0xa7'),_0x4d802e);var _0x524873={'method':_0x8895('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x484cd8[_0x8895('0x9f')]+'/oauth2/token','form':{'client_id':_0x484cd8[_0x8895('0xa0')],'resource':_0x4d802e,'username':_0x484cd8[_0x8895('0x9d')],'password':_0x484cd8[_0x8895('0x9e')],'grant_type':_0x8895('0x9e'),'client_secret':_0x484cd8[_0x8895('0xa1')]},'json':!![]};return rp(_0x524873);}})[_0x8895('0x1b')](function(_0x208a36){_0x39f5e5=_0x208a36['access_token'];var _0x3edc41={'method':_0x8895('0xa9'),'uri':encodeURI(_0x53591d+_0x8895('0xaa')+_0x4f80a3+'\x27'),'headers':{'Authorization':_0x8895('0xab')+_0x39f5e5,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x3edc41);})['then'](function(_0x464d1c){var _0x554477=_0x464d1c[_0x8895('0xad')][0x0];var _0x278605=_0x554477[_0x8895('0xae')];var _0x92d99b={'method':_0x8895('0xa9'),'uri':_0x53591d+_0x8895('0xaf')+_0x278605+_0x8895('0xb0'),'headers':{'Authorization':_0x8895('0xab')+_0x39f5e5,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x92d99b);})['then'](function(_0x18d225){_0x35b354=_0x18d225;_0x5276f3=_0x35b354['Attributes'];_0x5276f3=_[_0x8895('0xb1')](_0x5276f3,function(_0xa4ecd9){return!_0x5b6861[_0x8895('0xb2')](_0xa4ecd9['LogicalName']);});var _0x13b48d=[];var _0x4b7dff=[];_0x5276f3[_0x8895('0xb3')](function(_0x3d422a){if(_0x3d422a[_0x8895('0xb4')]){var _0x3745e=_0x3d422a['@odata.type']['substring'](_0x3d422a[_0x8895('0xb4')]['lastIndexOf']('.')+0x1);if(_0x3745e==='PicklistAttributeMetadata'){_0x13b48d[_0x8895('0xb5')](getSelectList(_0x53591d,_0x3ace6f,_0x4b7dff,_0x35b354['MetadataId'],_0x3d422a[_0x8895('0xae')],_0x39f5e5));}}});return Promise[_0x8895('0xb6')](_0x13b48d);})[_0x8895('0x1b')](function(_0xcb467c){_0x39a9f7=_0xcb467c[0x0];var _0x457d37=[];var _0x1ef755=[];_0x5276f3[_0x8895('0xb3')](function(_0x11d283){if(!_[_0x8895('0xb7')](_0x11d283['@odata.type'])){var _0x33deba=_0x11d283[_0x8895('0xb4')][_0x8895('0xa4')](_0x11d283['@odata.type'][_0x8895('0xa5')]('.')+0x1);if(_0x33deba===_0x8895('0xb8')){_0x457d37[_0x8895('0xb5')](getBooleanList(_0x53591d,_0x3ace6f,_0x1ef755,_0x35b354['MetadataId'],_0x11d283[_0x8895('0xae')],_0x39f5e5));}}});return Promise[_0x8895('0xb6')](_0x457d37);})[_0x8895('0x1b')](function(_0x4f8c62){_0x35646f=_0x4f8c62[0x0];var _0x340126=[];var _0x134b9d=[];_0x5276f3[_0x8895('0xb3')](function(_0x510d69){if(_0x510d69[_0x8895('0xb4')]){var _0x2a2a52=_0x510d69[_0x8895('0xb4')][_0x8895('0xa4')](_0x510d69[_0x8895('0xb4')][_0x8895('0xa5')]('.')+0x1);if(_0x2a2a52==='StringAttributeMetadata'||_0x2a2a52===_0x8895('0xb9')||_0x2a2a52===_0x8895('0xba')||_0x2a2a52==='IntegerAttributeMetadata'||_0x2a2a52==='MemoAttributeMetadata'||_0x2a2a52===_0x8895('0xbb')||_0x2a2a52===_0x8895('0xbc')||_0x2a2a52==='EntityNameAttributeMetadata'||_0x2a2a52===_0x8895('0xbd')||_0x2a2a52===_0x8895('0xbe')){_0x340126[_0x8895('0xb5')](getInputList(_0x53591d,_0x3ace6f,_0x2a2a52,_0x134b9d,_0x35b354[_0x8895('0xae')],_0x510d69[_0x8895('0xae')],_0x39f5e5));}}});return Promise['all'](_0x340126);})[_0x8895('0x1b')](function(_0x35f345){_0x64eca7=_0x35f345[0x0];var _0x4691f2=_0x39a9f7[_0x8895('0xbf')](_0x35646f)[_0x8895('0xbf')](_0x64eca7);var _0x2317cc={'count':_0x4691f2[_0x8895('0x43')],'rows':_0x4691f2};return _0x2317cc;})[_0x8895('0x1b')](respondWithResult(_0xd1fd50,null))[_0x8895('0x26')](function(_0x208bb4){var _0x2165fe=_0x4925c4[_0x8895('0x3c')]['test']?0x1f4:_0x208bb4[_0x8895('0xc0')]||0x1f4;logger[_0x8895('0x21')](_0x208bb4[_0x8895('0x33')]);delete _0x208bb4[_0x8895('0x34')];if(_0x2165fe===0x191){_0x2165fe=0x190;}_0xd1fd50['status'](_0x2165fe)[_0x8895('0x35')](_0x4925c4[_0x8895('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x208bb4[_0x8895('0xc0')]}:_0x208bb4);});};function getSelectList(_0x4cc76f,_0x20a58c,_0x52439f,_0x4e0a0e,_0x215358,_0x4f81ef){var _0x1b9266={'method':'GET','uri':_0x4cc76f+_0x8895('0xaf')+_0x4e0a0e+_0x8895('0xc1')+_0x215358+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x8895('0xc2'),'headers':{'Authorization':_0x8895('0xab')+_0x4f81ef,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x1b9266)['then'](function(_0x47f014){var _0x380598=[];var _0x1af2b7=_0x47f014[_0x8895('0xc3')][_0x8895('0xc4')];_0x1af2b7[_0x8895('0xb3')](function(_0x252ef8){_0x380598[_0x8895('0xb5')]({'name':_0x252ef8[_0x8895('0xc5')][_0x8895('0xc6')][_0x8895('0xc5')],'value':String(_0x252ef8[_0x8895('0xc7')])});});var _0x275caf={'id':_0x20a58c+'_'+_0x47f014[_0x8895('0xc8')],'name':_0x47f014[_0x8895('0xc9')]['UserLocalizedLabel'][_0x8895('0xc5')],'custom':![],'options':_0x380598};_0x52439f[_0x8895('0xb5')](_0x275caf);return _0x52439f;});}function getBooleanList(_0x3c548d,_0x616fd,_0x54e061,_0x342a11,_0x32eb27,_0xf3b3e5){var _0x20752d={'method':_0x8895('0xa9'),'uri':_0x3c548d+_0x8895('0xaf')+_0x342a11+_0x8895('0xc1')+_0x32eb27+_0x8895('0xca'),'headers':{'Authorization':_0x8895('0xab')+_0xf3b3e5,'If-None-Match':null,'OData-Version':_0x8895('0xac')},'json':!![]};return rp(_0x20752d)[_0x8895('0x1b')](function(_0xc9bdfd){var _0x2eb831=[];_0x2eb831[_0x8895('0xb5')]({'name':_0xc9bdfd[_0x8895('0xc3')][_0x8895('0xcb')]['Label'][_0x8895('0xc6')]['Label'],'value':_0x8895('0xcc')},{'name':_0xc9bdfd[_0x8895('0xc3')][_0x8895('0xcd')]['Label'][_0x8895('0xc6')][_0x8895('0xc5')],'value':'false'});var _0x3dfcce={'id':_0x616fd+'_'+_0xc9bdfd['LogicalName'],'name':_0xc9bdfd[_0x8895('0xc9')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x2eb831};_0x54e061[_0x8895('0xb5')](_0x3dfcce);return _0x54e061;});}function getInputList(_0x19f83e,_0x2c87ff,_0x81c9e4,_0x7d07fe,_0x524c23,_0x2feadb,_0x5a88e2){var _0x4c7424={'method':_0x8895('0xa9'),'uri':_0x19f83e+_0x8895('0xaf')+_0x524c23+')/Attributes('+_0x2feadb+_0x8895('0xce')+_0x81c9e4+_0x8895('0xcf'),'headers':{'Authorization':_0x8895('0xab')+_0x5a88e2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c7424)[_0x8895('0x1b')](function(_0x431b18){var _0x114200={'id':_0x2c87ff+'_'+_0x431b18['LogicalName'],'name':_0x431b18[_0x8895('0xc9')][_0x8895('0xc6')]?_0x431b18[_0x8895('0xc9')][_0x8895('0xc6')][_0x8895('0xc5')]:_0x431b18[_0x8895('0xc8')],'custom':![],'options':[]};_0x7d07fe[_0x8895('0xb5')](_0x114200);return _0x7d07fe;});} \ No newline at end of file +var _0xbd51=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','length','include','create','body','find','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','tenantId','remoteUri','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','password','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','push','test','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','lodash','squel'];(function(_0x4c95b6,_0x3a97d2){var _0x447517=function(_0x377638){while(--_0x377638){_0x4c95b6['push'](_0x4c95b6['shift']());}};_0x447517(++_0x3a97d2);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x24cb31,_0x38d581){_0x24cb31=_0x24cb31-0x0;var _0x5e37ad=_0xbd51[_0x24cb31];return _0x5e37ad;};'use strict';var pdf=require(_0x1bd5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1bd5('0x1'));var zipdir=require(_0x1bd5('0x2'));var jsonpatch=require(_0x1bd5('0x3'));var rp=require(_0x1bd5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1bd5('0x5'));var sox=require(_0x1bd5('0x6'));var csv=require(_0x1bd5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];var integrations=require(_0x1bd5('0x17'));var jayson=require(_0x1bd5('0x18'));var client=jayson[_0x1bd5('0x19')][_0x1bd5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1527c1,_0x4942df,_0x5650b5,_0x8b2390){return new BPromise(function(_0x6d2c40,_0x33f82a){var _0x39c44b=_0x8b2390||client;return _0x39c44b['request'](_0x1527c1,_0x5650b5)['then'](function(_0xa63190){logger[_0x1bd5('0x1b')](_0x1bd5('0x1c'),_0x4942df,_0x1bd5('0x1d'));logger[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4942df,_0x1bd5('0x1d'),JSON[_0x1bd5('0x20')](_0xa63190));if(_0xa63190[_0x1bd5('0x21')]){if(_0xa63190['error']['code']===0x1f4){logger[_0x1bd5('0x21')](_0x1bd5('0x1c'),_0x4942df,_0xa63190[_0x1bd5('0x21')][_0x1bd5('0x22')]);return _0x33f82a(_0xa63190[_0x1bd5('0x21')][_0x1bd5('0x22')]);}logger[_0x1bd5('0x21')](_0x1bd5('0x1c'),_0x4942df,_0xa63190[_0x1bd5('0x21')][_0x1bd5('0x22')]);return _0x6d2c40(_0xa63190[_0x1bd5('0x21')][_0x1bd5('0x22')]);}else{logger[_0x1bd5('0x1b')](_0x1bd5('0x1c'),_0x4942df,_0x1bd5('0x1d'));_0x6d2c40(_0xa63190[_0x1bd5('0x23')][_0x1bd5('0x22')]);}})[_0x1bd5('0x24')](function(_0x5567c9){logger[_0x1bd5('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x4942df,_0x5567c9);_0x33f82a(_0x5567c9);});});}function respondWithStatusCode(_0x18fd18,_0x1e534e){_0x1e534e=_0x1e534e||0xcc;return function(_0x3b6eb8){if(_0x3b6eb8){return _0x18fd18['sendStatus'](_0x1e534e);}return _0x18fd18[_0x1bd5('0x25')](_0x1e534e)['end']();};}function respondWithResult(_0x2ed551,_0x30676d){_0x30676d=_0x30676d||0xc8;return function(_0x3dba4f){if(_0x3dba4f){return _0x2ed551[_0x1bd5('0x25')](_0x30676d)['json'](_0x3dba4f);}};}function respondWithFilteredResult(_0x202ed3,_0x69bb17){return function(_0x20245c){if(_0x20245c){var _0x3b1090=_0x20245c[_0x1bd5('0x26')],_0x4cebd0=_0x69bb17[_0x1bd5('0x27')],_0xdba332=_0x69bb17[_0x1bd5('0x27')]+_0x69bb17[_0x1bd5('0x28')],_0x24d4d9;if(_0xdba332>=_0x3b1090){_0xdba332=_0x3b1090;_0x24d4d9=0xc8;}else{_0x24d4d9=0xce;}_0x202ed3['status'](_0x24d4d9);return _0x202ed3[_0x1bd5('0x29')](_0x1bd5('0x2a'),_0x4cebd0+'-'+_0xdba332+'/'+_0x3b1090)[_0x1bd5('0x2b')](_0x20245c);}return null;};}function patchUpdates(_0x4bcc77){return function(_0x176a33){try{jsonpatch[_0x1bd5('0x2c')](_0x176a33,_0x4bcc77,!![]);}catch(_0x345181){return BPromise[_0x1bd5('0x2d')](_0x345181);}return _0x176a33[_0x1bd5('0x2e')]();};}function saveUpdates(_0x1d612b,_0x596e3c){return function(_0x49ea1e){if(_0x49ea1e){return _0x49ea1e[_0x1bd5('0x2f')](_0x1d612b)[_0x1bd5('0x30')](function(_0x5542aa){return _0x5542aa;});}return null;};}function removeEntity(_0x36649d,_0x198b88){return function(_0x1efa8c){if(_0x1efa8c){return _0x1efa8c[_0x1bd5('0x31')]()['then'](function(){_0x36649d[_0x1bd5('0x25')](0xcc)[_0x1bd5('0x32')]();});}};}function handleEntityNotFound(_0x3ec22a,_0x233743){return function(_0x209ce1){if(!_0x209ce1){_0x3ec22a[_0x1bd5('0x33')](0x194);}return _0x209ce1;};}function handleError(_0x42fb08,_0x21df80){_0x21df80=_0x21df80||0x1f4;return function(_0x592255){logger[_0x1bd5('0x21')](_0x592255[_0x1bd5('0x34')]);if(_0x592255[_0x1bd5('0x35')]){delete _0x592255[_0x1bd5('0x35')];}_0x42fb08[_0x1bd5('0x25')](_0x21df80)[_0x1bd5('0x36')](_0x592255);};}exports[_0x1bd5('0x37')]=function(_0x4de4b0,_0x448aad){var _0x46df70={},_0x44ab3a={},_0x2f5a48={'count':0x0,'rows':[]};var _0x3cf898=_[_0x1bd5('0x38')](db[_0x1bd5('0x39')]['rawAttributes'],function(_0x5e8b61){return{'name':_0x5e8b61[_0x1bd5('0x3a')],'type':_0x5e8b61[_0x1bd5('0x3b')][_0x1bd5('0x3c')]};});_0x44ab3a['model']=_[_0x1bd5('0x38')](_0x3cf898,'name');_0x44ab3a[_0x1bd5('0x3d')]=_[_0x1bd5('0x3e')](_0x4de4b0[_0x1bd5('0x3d')]);_0x44ab3a[_0x1bd5('0x3f')]=_[_0x1bd5('0x40')](_0x44ab3a[_0x1bd5('0x41')],_0x44ab3a[_0x1bd5('0x3d')]);_0x46df70[_0x1bd5('0x42')]=_['intersection'](_0x44ab3a[_0x1bd5('0x41')],qs[_0x1bd5('0x43')](_0x4de4b0['query'][_0x1bd5('0x43')]));_0x46df70[_0x1bd5('0x42')]=_0x46df70[_0x1bd5('0x42')]['length']?_0x46df70[_0x1bd5('0x42')]:_0x44ab3a[_0x1bd5('0x41')];if(!_0x4de4b0[_0x1bd5('0x3d')][_0x1bd5('0x44')]('nolimit')){_0x46df70[_0x1bd5('0x28')]=qs[_0x1bd5('0x28')](_0x4de4b0[_0x1bd5('0x3d')][_0x1bd5('0x28')]);_0x46df70['offset']=qs['offset'](_0x4de4b0[_0x1bd5('0x3d')][_0x1bd5('0x27')]);}_0x46df70[_0x1bd5('0x45')]=qs['sort'](_0x4de4b0[_0x1bd5('0x3d')][_0x1bd5('0x46')]);_0x46df70['where']=qs[_0x1bd5('0x3f')](_['pick'](_0x4de4b0[_0x1bd5('0x3d')],_0x44ab3a[_0x1bd5('0x3f')]),_0x3cf898);if(_0x4de4b0['query'][_0x1bd5('0x47')]){_0x46df70[_0x1bd5('0x48')]=_[_0x1bd5('0x49')](_0x46df70[_0x1bd5('0x48')],{'$or':_[_0x1bd5('0x38')](_0x3cf898,function(_0x25b35a){if(_0x25b35a[_0x1bd5('0x3b')]!==_0x1bd5('0x4a')){var _0x162c83={};_0x162c83[_0x25b35a[_0x1bd5('0x35')]]={'$like':'%'+_0x4de4b0[_0x1bd5('0x3d')][_0x1bd5('0x47')]+'%'};return _0x162c83;}})});}_0x46df70=_['merge']({},_0x46df70,_0x4de4b0[_0x1bd5('0x4b')]);var _0x31b64d={'where':_0x46df70[_0x1bd5('0x48')]};return db['Dynamics365Account'][_0x1bd5('0x26')](_0x31b64d)[_0x1bd5('0x30')](function(_0x5bb8a6){_0x2f5a48[_0x1bd5('0x26')]=_0x5bb8a6;if(_0x4de4b0['query'][_0x1bd5('0x4c')]){_0x46df70['include']=[{'all':!![]}];}return db[_0x1bd5('0x39')][_0x1bd5('0x4d')](_0x46df70);})['then'](function(_0xea034c){_0x2f5a48['rows']=_0xea034c;return _0x2f5a48;})[_0x1bd5('0x30')](respondWithFilteredResult(_0x448aad,_0x46df70))[_0x1bd5('0x24')](handleError(_0x448aad,null));};exports[_0x1bd5('0x4e')]=function(_0xe71454,_0x26f7d2){var _0x2dc037={'raw':![],'where':{'id':_0xe71454[_0x1bd5('0x4f')]['id']}},_0x25da00={};_0x25da00['model']=_[_0x1bd5('0x3e')](db[_0x1bd5('0x39')][_0x1bd5('0x50')]);_0x25da00[_0x1bd5('0x3d')]=_[_0x1bd5('0x3e')](_0xe71454[_0x1bd5('0x3d')]);_0x25da00['filters']=_[_0x1bd5('0x40')](_0x25da00[_0x1bd5('0x41')],_0x25da00[_0x1bd5('0x3d')]);_0x2dc037[_0x1bd5('0x42')]=_[_0x1bd5('0x40')](_0x25da00[_0x1bd5('0x41')],qs[_0x1bd5('0x43')](_0xe71454['query']['fields']));_0x2dc037[_0x1bd5('0x42')]=_0x2dc037[_0x1bd5('0x42')][_0x1bd5('0x51')]?_0x2dc037['attributes']:_0x25da00[_0x1bd5('0x41')];if(_0xe71454[_0x1bd5('0x3d')][_0x1bd5('0x4c')]){_0x2dc037[_0x1bd5('0x52')]=[{'all':!![]}];}_0x2dc037=_[_0x1bd5('0x49')]({},_0x2dc037,_0xe71454[_0x1bd5('0x4b')]);return db[_0x1bd5('0x39')]['find'](_0x2dc037)[_0x1bd5('0x30')](handleEntityNotFound(_0x26f7d2,null))[_0x1bd5('0x30')](respondWithResult(_0x26f7d2,null))['catch'](handleError(_0x26f7d2,null));};exports[_0x1bd5('0x53')]=function(_0x5cb409,_0x29f5c2){return db['Dynamics365Account'][_0x1bd5('0x53')](_0x5cb409[_0x1bd5('0x54')],{})['then'](respondWithResult(_0x29f5c2,0xc9))[_0x1bd5('0x24')](handleError(_0x29f5c2,null));};exports[_0x1bd5('0x2f')]=function(_0x1b74c2,_0x363ba8){if(_0x1b74c2[_0x1bd5('0x54')]['id']){delete _0x1b74c2[_0x1bd5('0x54')]['id'];}return db[_0x1bd5('0x39')]['find']({'where':{'id':_0x1b74c2[_0x1bd5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x363ba8,null))[_0x1bd5('0x30')](saveUpdates(_0x1b74c2[_0x1bd5('0x54')],null))[_0x1bd5('0x30')](respondWithResult(_0x363ba8,null))['catch'](handleError(_0x363ba8,null));};exports['destroy']=function(_0x172f76,_0x1a0ada){return db[_0x1bd5('0x39')][_0x1bd5('0x55')]({'where':{'id':_0x172f76[_0x1bd5('0x4f')]['id']}})[_0x1bd5('0x30')](handleEntityNotFound(_0x1a0ada,null))[_0x1bd5('0x30')](removeEntity(_0x1a0ada,null))[_0x1bd5('0x24')](handleError(_0x1a0ada,null));};exports[_0x1bd5('0x56')]=function(_0x2c3ed0,_0x560419,_0xa8980e){var _0x5ed20a={};var _0x2fe8f4={};var _0x34d93b;var _0x179d1e;return db['Dynamics365Account'][_0x1bd5('0x57')]({'where':{'id':_0x2c3ed0[_0x1bd5('0x4f')]['id']}})[_0x1bd5('0x30')](handleEntityNotFound(_0x560419,null))['then'](function(_0x3497fd){if(_0x3497fd){_0x34d93b=_0x3497fd;_0x2fe8f4[_0x1bd5('0x41')]=_[_0x1bd5('0x3e')](db[_0x1bd5('0x58')]['rawAttributes']);_0x2fe8f4['query']=_[_0x1bd5('0x3e')](_0x2c3ed0[_0x1bd5('0x3d')]);_0x2fe8f4[_0x1bd5('0x3f')]=_['intersection'](_0x2fe8f4['model'],_0x2fe8f4[_0x1bd5('0x3d')]);_0x5ed20a['attributes']=_[_0x1bd5('0x40')](_0x2fe8f4[_0x1bd5('0x41')],qs['fields'](_0x2c3ed0[_0x1bd5('0x3d')]['fields']));_0x5ed20a[_0x1bd5('0x42')]=_0x5ed20a['attributes'][_0x1bd5('0x51')]?_0x5ed20a[_0x1bd5('0x42')]:_0x2fe8f4['model'];_0x5ed20a[_0x1bd5('0x45')]=qs[_0x1bd5('0x46')](_0x2c3ed0['query']['sort']);_0x5ed20a[_0x1bd5('0x48')]=qs[_0x1bd5('0x3f')](_['pick'](_0x2c3ed0[_0x1bd5('0x3d')],_0x2fe8f4[_0x1bd5('0x3f')]));if(_0x2c3ed0['query']['filter']){_0x5ed20a[_0x1bd5('0x48')]=_[_0x1bd5('0x49')](_0x5ed20a[_0x1bd5('0x48')],{'$or':_['map'](_0x5ed20a[_0x1bd5('0x42')],function(_0x27a05e){var _0x5c1db7={};_0x5c1db7[_0x27a05e]={'$like':'%'+_0x2c3ed0['query'][_0x1bd5('0x47')]+'%'};return _0x5c1db7;})});}_0x5ed20a=_[_0x1bd5('0x49')]({},_0x5ed20a,_0x2c3ed0[_0x1bd5('0x4b')]);return _0x34d93b[_0x1bd5('0x56')](_0x5ed20a);}})[_0x1bd5('0x30')](function(_0x53c6de){if(_0x53c6de){_0x179d1e=_0x53c6de[_0x1bd5('0x51')];if(!_0x2c3ed0['query'][_0x1bd5('0x44')](_0x1bd5('0x59'))){_0x5ed20a[_0x1bd5('0x28')]=qs[_0x1bd5('0x28')](_0x2c3ed0['query']['limit']);_0x5ed20a[_0x1bd5('0x27')]=qs[_0x1bd5('0x27')](_0x2c3ed0[_0x1bd5('0x3d')][_0x1bd5('0x27')]);}return _0x34d93b[_0x1bd5('0x56')](_0x5ed20a);}})[_0x1bd5('0x30')](function(_0x12b0f2){if(_0x12b0f2){return _0x12b0f2?{'count':_0x179d1e,'rows':_0x12b0f2}:null;}})[_0x1bd5('0x30')](respondWithResult(_0x560419,null))[_0x1bd5('0x24')](handleError(_0x560419,null));};exports[_0x1bd5('0x5a')]=function(_0x2ab197,_0x32d2b9,_0x437bd5){if(_0x2ab197[_0x1bd5('0x54')]['id']){delete _0x2ab197[_0x1bd5('0x54')]['id'];}return db[_0x1bd5('0x39')][_0x1bd5('0x57')]({'where':{'id':_0x2ab197[_0x1bd5('0x4f')]['id']}})[_0x1bd5('0x30')](handleEntityNotFound(_0x32d2b9,null))[_0x1bd5('0x30')](function(_0x1f536d){if(_0x1f536d){_0x2ab197[_0x1bd5('0x54')][_0x1bd5('0x5b')]=_0x1f536d['id'];_0x2ab197[_0x1bd5('0x54')]['Subjects']=integrations[_0x1bd5('0x5c')](_0x2ab197[_0x1bd5('0x54')][_0x1bd5('0x5d')],_0x2ab197[_0x1bd5('0x54')][_0x1bd5('0x3b')]);_0x2ab197[_0x1bd5('0x54')][_0x1bd5('0x5e')]=integrations['getDescriptions'](_0x2ab197[_0x1bd5('0x54')][_0x1bd5('0x5d')],_0x2ab197[_0x1bd5('0x54')][_0x1bd5('0x3b')]);return db['Dynamics365Configuration'][_0x1bd5('0x53')](_0x2ab197[_0x1bd5('0x54')],{'include':[{'model':db[_0x1bd5('0x5f')],'as':_0x1bd5('0x60')},{'model':db[_0x1bd5('0x5f')],'as':_0x1bd5('0x5e')}]});}return null;})[_0x1bd5('0x30')](respondWithResult(_0x32d2b9,null))['catch'](handleError(_0x32d2b9,null));};exports[_0x1bd5('0x61')]=function(_0x58bbce,_0x4fe10a,_0x34f98c){var _0x596db9=_0x58bbce[_0x1bd5('0x3d')][_0x1bd5('0x62')];var _0x560f20=_0x596db9===_0x1bd5('0x63')?_0x1bd5('0x64'):_0x1bd5('0x65');var _0x284636='';var _0x27f489='';var _0x2ab643='';var _0x5c001a='';var _0x25358a='';var _0x2ce284='';var _0xdd5183='';var _0x1c9cec='';var _0x4e6258=['title',_0x1bd5('0x66'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),'subject',_0x1bd5('0x6a'),'regardingobjectid','directioncode',_0x1bd5('0x6b')];var _0x5045f9=[_0x1bd5('0x6c'),_0x1bd5('0x6d'),_0x1bd5('0x6e'),_0x1bd5('0x6f'),_0x1bd5('0x70'),_0x1bd5('0x71'),_0x1bd5('0x72'),_0x1bd5('0x73'),_0x1bd5('0x74'),'createdbyexternalpartyyominame',_0x1bd5('0x75'),'createdbyyominame','createdon','createdonbehalfbyname',_0x1bd5('0x76'),'customeridname',_0x1bd5('0x77'),_0x1bd5('0x78'),_0x1bd5('0x79'),_0x1bd5('0x7a'),_0x1bd5('0x7b'),_0x1bd5('0x7c'),_0x1bd5('0x7d'),'exchangerate',_0x1bd5('0x7e'),'followupby',_0x1bd5('0x7f'),_0x1bd5('0x80'),_0x1bd5('0x81'),'lastonholdtime','masteridname',_0x1bd5('0x82'),'modifiedbyexternalpartyyominame',_0x1bd5('0x83'),'modifiedbyyominame',_0x1bd5('0x84'),_0x1bd5('0x85'),_0x1bd5('0x86'),_0x1bd5('0x87'),_0x1bd5('0x88'),_0x1bd5('0x89'),_0x1bd5('0x8a'),_0x1bd5('0x8b'),_0x1bd5('0x8c'),_0x1bd5('0x8d'),_0x1bd5('0x8e'),_0x1bd5('0x8f'),_0x1bd5('0x90'),_0x1bd5('0x91'),'prioritycodename',_0x1bd5('0x92'),_0x1bd5('0x93'),_0x1bd5('0x94'),'resolvebykpiidname',_0x1bd5('0x95'),_0x1bd5('0x96'),'responsiblecontactidyominame',_0x1bd5('0x97'),_0x1bd5('0x98'),_0x1bd5('0x99'),'socialprofileidname',_0x1bd5('0x9a'),_0x1bd5('0x9b'),_0x1bd5('0x9c'),_0x1bd5('0x9d'),'timezoneruleversionnumber',_0x1bd5('0x9e'),_0x1bd5('0x9f'),_0x1bd5('0xa0'),'versionnumber'];var _0x1645b6=_0x4e6258[_0x1bd5('0xa1')](_0x5045f9);return db['Dynamics365Account']['findOne']({'where':{'id':_0x58bbce[_0x1bd5('0x4f')]['id']},'attributes':['id',_0x1bd5('0xa2'),'password','remoteUri',_0x1bd5('0xa3'),'clientId','clientSecret']})[_0x1bd5('0x30')](handleEntityNotFound(_0x4fe10a,null))['then'](function(_0x1457b9){if(_0x1457b9){_0x1c9cec=_0x1457b9[_0x1bd5('0xa4')];var _0x5df043=_0x1c9cec[_0x1bd5('0xa5')](-0x1);if(_0x5df043==='/'){_0x1c9cec=_0x1c9cec[_0x1bd5('0xa6')](0x0,_0x1c9cec[_0x1bd5('0xa7')](_0x5df043));}_0xdd5183=util['format'](_0x1bd5('0xa8'),_0x1c9cec);var _0x5d8c54={'method':_0x1bd5('0xa9'),'uri':_0x1bd5('0xaa')+_0x1457b9[_0x1bd5('0xa3')]+_0x1bd5('0xab'),'form':{'client_id':_0x1457b9[_0x1bd5('0xac')],'resource':_0x1c9cec,'username':_0x1457b9['username'],'password':_0x1457b9[_0x1bd5('0xad')],'grant_type':'password','client_secret':_0x1457b9[_0x1bd5('0xae')]},'json':!![]};return rp(_0x5d8c54);}})['then'](function(_0x4ac05b){_0x2ce284=_0x4ac05b[_0x1bd5('0xaf')];var _0x3fd132={'method':_0x1bd5('0xb0'),'uri':encodeURI(_0xdd5183+_0x1bd5('0xb1')+_0x560f20+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2ce284,'If-None-Match':null,'OData-Version':_0x1bd5('0xb2')},'json':!![]};return rp(_0x3fd132);})[_0x1bd5('0x30')](function(_0x2ede9d){var _0x374f89=_0x2ede9d[_0x1bd5('0xb3')][0x0];var _0x2f8b4f=_0x374f89[_0x1bd5('0xb4')];var _0x16fd7a={'method':_0x1bd5('0xb0'),'uri':_0xdd5183+_0x1bd5('0xb5')+_0x2f8b4f+_0x1bd5('0xb6'),'headers':{'Authorization':_0x1bd5('0xb7')+_0x2ce284,'If-None-Match':null,'OData-Version':_0x1bd5('0xb2')},'json':!![]};return rp(_0x16fd7a);})[_0x1bd5('0x30')](function(_0x4789ad){_0x284636=_0x4789ad;_0x27f489=_0x284636[_0x1bd5('0xb8')];_0x27f489=_[_0x1bd5('0xb9')](_0x27f489,function(_0x1391ac){return!_0x1645b6[_0x1bd5('0xba')](_0x1391ac[_0x1bd5('0xbb')]);});var _0x26f9ad=[];var _0x28f567=[];_0x27f489[_0x1bd5('0xbc')](function(_0xf61654){if(_0xf61654[_0x1bd5('0xbd')]){var _0x169fd2=_0xf61654['@odata.type'][_0x1bd5('0xa6')](_0xf61654[_0x1bd5('0xbd')][_0x1bd5('0xa7')]('.')+0x1);if(_0x169fd2===_0x1bd5('0xbe')){_0x26f9ad['push'](getSelectList(_0xdd5183,_0x596db9,_0x28f567,_0x284636[_0x1bd5('0xb4')],_0xf61654[_0x1bd5('0xb4')],_0x2ce284));}}});return Promise['all'](_0x26f9ad);})['then'](function(_0x57ca48){_0x2ab643=_0x57ca48[0x0];var _0xf19816=[];var _0x429aae=[];_0x27f489[_0x1bd5('0xbc')](function(_0x50c4ea){if(!_['isNil'](_0x50c4ea[_0x1bd5('0xbd')])){var _0x50f155=_0x50c4ea['@odata.type'][_0x1bd5('0xa6')](_0x50c4ea[_0x1bd5('0xbd')]['lastIndexOf']('.')+0x1);if(_0x50f155===_0x1bd5('0xbf')){_0xf19816['push'](getBooleanList(_0xdd5183,_0x596db9,_0x429aae,_0x284636[_0x1bd5('0xb4')],_0x50c4ea[_0x1bd5('0xb4')],_0x2ce284));}}});return Promise[_0x1bd5('0xc0')](_0xf19816);})[_0x1bd5('0x30')](function(_0x2e3168){_0x5c001a=_0x2e3168[0x0];var _0x5c12ff=[];var _0x4043b2=[];_0x27f489[_0x1bd5('0xbc')](function(_0x1caa69){if(_0x1caa69[_0x1bd5('0xbd')]){var _0x4a0548=_0x1caa69[_0x1bd5('0xbd')][_0x1bd5('0xa6')](_0x1caa69[_0x1bd5('0xbd')]['lastIndexOf']('.')+0x1);if(_0x4a0548===_0x1bd5('0xc1')||_0x4a0548===_0x1bd5('0xc2')||_0x4a0548===_0x1bd5('0xc3')||_0x4a0548===_0x1bd5('0xc4')||_0x4a0548===_0x1bd5('0xc5')||_0x4a0548==='DateTimeAttributeMetadata'||_0x4a0548===_0x1bd5('0xc6')||_0x4a0548===_0x1bd5('0xc7')||_0x4a0548==='StateAttributeMetadata'||_0x4a0548===_0x1bd5('0xc8')){_0x5c12ff[_0x1bd5('0xc9')](getInputList(_0xdd5183,_0x596db9,_0x4a0548,_0x4043b2,_0x284636['MetadataId'],_0x1caa69['MetadataId'],_0x2ce284));}}});return Promise[_0x1bd5('0xc0')](_0x5c12ff);})[_0x1bd5('0x30')](function(_0x3c3678){_0x25358a=_0x3c3678[0x0];var _0x1a59c1=_0x2ab643['concat'](_0x5c001a)[_0x1bd5('0xa1')](_0x25358a);var _0x5a844f={'count':_0x1a59c1[_0x1bd5('0x51')],'rows':_0x1a59c1};return _0x5a844f;})[_0x1bd5('0x30')](respondWithResult(_0x4fe10a,null))[_0x1bd5('0x24')](function(_0x23bafa){var _0x39b90a=_0x58bbce[_0x1bd5('0x3d')][_0x1bd5('0xca')]?0x1f4:_0x23bafa[_0x1bd5('0xcb')]||0x1f4;logger[_0x1bd5('0x21')](_0x23bafa[_0x1bd5('0x34')]);delete _0x23bafa[_0x1bd5('0x35')];if(_0x39b90a===0x191){_0x39b90a=0x190;}_0x4fe10a[_0x1bd5('0x25')](_0x39b90a)[_0x1bd5('0x36')](_0x58bbce[_0x1bd5('0x3d')][_0x1bd5('0xca')]?{'message':'Wrong\x20credentials','statusCode':_0x23bafa[_0x1bd5('0xcb')]}:_0x23bafa);});};function getSelectList(_0x7b4fe3,_0x41961a,_0x4f171b,_0x164e52,_0x37fd12,_0x118922){var _0x2edaba={'method':_0x1bd5('0xb0'),'uri':_0x7b4fe3+_0x1bd5('0xb5')+_0x164e52+_0x1bd5('0xcc')+_0x37fd12+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x1bd5('0xcd'),'headers':{'Authorization':_0x1bd5('0xb7')+_0x118922,'If-None-Match':null,'OData-Version':_0x1bd5('0xb2')},'json':!![]};return rp(_0x2edaba)[_0x1bd5('0x30')](function(_0x942483){var _0x59b95e=[];var _0x834968=_0x942483[_0x1bd5('0xce')][_0x1bd5('0xcf')];_0x834968['forEach'](function(_0x27d194){_0x59b95e[_0x1bd5('0xc9')]({'name':_0x27d194[_0x1bd5('0xd0')][_0x1bd5('0xd1')]['Label'],'value':String(_0x27d194[_0x1bd5('0xd2')])});});var _0x29ef0d={'id':_0x41961a+'_'+_0x942483['LogicalName'],'name':_0x942483['DisplayName'][_0x1bd5('0xd1')][_0x1bd5('0xd0')],'custom':![],'options':_0x59b95e};_0x4f171b[_0x1bd5('0xc9')](_0x29ef0d);return _0x4f171b;});}function getBooleanList(_0x3bbb56,_0x139c58,_0x14768d,_0x4a5e9c,_0x574515,_0xb5592a){var _0x21114b={'method':_0x1bd5('0xb0'),'uri':_0x3bbb56+_0x1bd5('0xb5')+_0x4a5e9c+_0x1bd5('0xcc')+_0x574515+_0x1bd5('0xd3'),'headers':{'Authorization':_0x1bd5('0xb7')+_0xb5592a,'If-None-Match':null,'OData-Version':_0x1bd5('0xb2')},'json':!![]};return rp(_0x21114b)[_0x1bd5('0x30')](function(_0x41e66d){var _0x1130c1=[];_0x1130c1[_0x1bd5('0xc9')]({'name':_0x41e66d[_0x1bd5('0xce')][_0x1bd5('0xd4')]['Label'][_0x1bd5('0xd1')][_0x1bd5('0xd0')],'value':_0x1bd5('0xd5')},{'name':_0x41e66d[_0x1bd5('0xce')]['FalseOption']['Label'][_0x1bd5('0xd1')][_0x1bd5('0xd0')],'value':_0x1bd5('0xd6')});var _0x5851d2={'id':_0x139c58+'_'+_0x41e66d[_0x1bd5('0xbb')],'name':_0x41e66d['DisplayName'][_0x1bd5('0xd1')][_0x1bd5('0xd0')],'custom':![],'options':_0x1130c1};_0x14768d[_0x1bd5('0xc9')](_0x5851d2);return _0x14768d;});}function getInputList(_0x59efaa,_0x529925,_0x213bc6,_0x4c0179,_0x575e58,_0x229a53,_0xf651b5){var _0x3d0114={'method':'GET','uri':_0x59efaa+_0x1bd5('0xb5')+_0x575e58+_0x1bd5('0xcc')+_0x229a53+_0x1bd5('0xd7')+_0x213bc6+_0x1bd5('0xd8'),'headers':{'Authorization':_0x1bd5('0xb7')+_0xf651b5,'If-None-Match':null,'OData-Version':_0x1bd5('0xb2')},'json':!![]};return rp(_0x3d0114)[_0x1bd5('0x30')](function(_0x114070){var _0x40ff67={'id':_0x529925+'_'+_0x114070[_0x1bd5('0xbb')],'name':_0x114070['DisplayName'][_0x1bd5('0xd1')]?_0x114070['DisplayName']['UserLocalizedLabel'][_0x1bd5('0xd0')]:_0x114070['LogicalName'],'custom':![],'options':[]};_0x4c0179[_0x1bd5('0xc9')](_0x40ff67);return _0x4c0179;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 219ef35..f048c4b 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 _0xdebb=['rimraf','../../config/environment','./intDynamics365Account.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4c9685,_0x18ff80){var _0x3b4e7b=function(_0x16798c){while(--_0x16798c){_0x4c9685['push'](_0x4c9685['shift']());}};_0x3b4e7b(++_0x18ff80);}(_0xdebb,0x68));var _0xbdeb=function(_0x5ca5d1,_0x2c27f1){_0x5ca5d1=_0x5ca5d1-0x0;var _0x89feb8=_0xdebb[_0x5ca5d1];return _0x89feb8;};'use strict';var _=require('lodash');var util=require(_0xbdeb('0x0'));var logger=require(_0xbdeb('0x1'))('api');var moment=require(_0xbdeb('0x2'));var BPromise=require(_0xbdeb('0x3'));var rp=require(_0xbdeb('0x4'));var fs=require('fs');var path=require(_0xbdeb('0x5'));var rimraf=require(_0xbdeb('0x6'));var config=require(_0xbdeb('0x7'));var attributes=require(_0xbdeb('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xbdeb('0x9')]=function(_0x2ae903,_0x12cfdf){return _0x2ae903[_0xbdeb('0xa')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21c9=['../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1c7fd2,_0x214dee){var _0x44f065=function(_0x180c6f){while(--_0x180c6f){_0x1c7fd2['push'](_0x1c7fd2['shift']());}};_0x44f065(++_0x214dee);}(_0x21c9,0x1d9));var _0x921c=function(_0x4956d8,_0x543ea9){_0x4956d8=_0x4956d8-0x0;var _0x235a54=_0x21c9[_0x4956d8];return _0x235a54;};'use strict';var _=require(_0x921c('0x0'));var util=require('util');var logger=require(_0x921c('0x1'))(_0x921c('0x2'));var moment=require(_0x921c('0x3'));var BPromise=require(_0x921c('0x4'));var rp=require(_0x921c('0x5'));var fs=require('fs');var path=require(_0x921c('0x6'));var rimraf=require('rimraf');var config=require(_0x921c('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x921c('0x8'));module[_0x921c('0x9')]=function(_0x583598,_0x55fc22){return _0x583598[_0x921c('0xa')](_0x921c('0xb'),attributes,{'tableName':_0x921c('0xc'),'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 2eab715..e678b42 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 _0x5f71=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','find','ShowDynamics365Account','lodash','moment','randomstring'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x5f71,0xc9));var _0x15f7=function(_0x18946c,_0x3a7d1d){_0x18946c=_0x18946c-0x0;var _0x470381=_0x5f71[_0x18946c];return _0x470381;};'use strict';var _=require(_0x15f7('0x0'));var util=require('util');var moment=require(_0x15f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x15f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x15f7('0x3'))(_0x15f7('0x4'));var config=require('../../config/environment');var jayson=require(_0x15f7('0x5'));var client=jayson[_0x15f7('0x6')][_0x15f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1de7b3,_0x307158,_0x30d083){return new BPromise(function(_0x1c9509,_0x3f1490){return client[_0x15f7('0x8')](_0x1de7b3,_0x30d083)[_0x15f7('0x9')](function(_0x3e2f43){logger[_0x15f7('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x307158,'request\x20sent');logger[_0x15f7('0xb')](_0x15f7('0xc'),_0x307158,'request\x20sent',JSON[_0x15f7('0xd')](_0x3e2f43));if(_0x3e2f43[_0x15f7('0xe')]){if(_0x3e2f43[_0x15f7('0xe')][_0x15f7('0xf')]===0x1f4){logger[_0x15f7('0xe')](_0x15f7('0x10'),_0x307158,_0x3e2f43[_0x15f7('0xe')]['message']);return _0x3f1490(_0x3e2f43[_0x15f7('0xe')][_0x15f7('0x11')]);}logger[_0x15f7('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x307158,_0x3e2f43[_0x15f7('0xe')][_0x15f7('0x11')]);return _0x1c9509(_0x3e2f43['error'][_0x15f7('0x11')]);}else{logger[_0x15f7('0xa')](_0x15f7('0x10'),_0x307158,_0x15f7('0x12'));_0x1c9509(_0x3e2f43[_0x15f7('0x13')][_0x15f7('0x11')]);}})[_0x15f7('0x14')](function(_0x4b0d42){logger[_0x15f7('0xe')](_0x15f7('0x10'),_0x307158,_0x4b0d42);_0x3f1490(_0x4b0d42);});});}exports['GetDynamics365Account']=function(_0x2c78ca){var _0x333ff8=this;return new Promise(function(_0x2d4bc3,_0x40b752){return db[_0x15f7('0x15')][_0x15f7('0x16')]({'raw':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca['options'][_0x15f7('0x18')]===undefined?!![]:![]:!![],'where':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca[_0x15f7('0x17')][_0x15f7('0x19')]||null:null,'attributes':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca[_0x15f7('0x17')][_0x15f7('0x1a')]||null:null,'limit':_0x2c78ca['options']?_0x2c78ca['options'][_0x15f7('0x1b')]||null:null,'include':_0x2c78ca[_0x15f7('0x17')]?_0x2c78ca[_0x15f7('0x17')][_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x2c78ca['options'][_0x15f7('0x1c')],function(_0x4fe2ca){return{'model':db[_0x4fe2ca[_0x15f7('0x1e')]],'as':_0x4fe2ca['as'],'attributes':_0x4fe2ca[_0x15f7('0x1a')],'include':_0x4fe2ca['include']?_['map'](_0x4fe2ca[_0x15f7('0x1c')],function(_0x5a1e21){return{'model':db[_0x5a1e21['model']],'as':_0x5a1e21['as'],'attributes':_0x5a1e21[_0x15f7('0x1a')],'include':_0x5a1e21['include']?_[_0x15f7('0x1d')](_0x5a1e21[_0x15f7('0x1c')],function(_0x64f9d9){return{'model':db[_0x64f9d9[_0x15f7('0x1e')]],'as':_0x64f9d9['as'],'attributes':_0x64f9d9[_0x15f7('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3adf28){logger[_0x15f7('0xa')](_0x15f7('0x1f'),_0x2c78ca);logger['debug']('GetDynamics365Account',_0x2c78ca,JSON['stringify'](_0x3adf28));_0x2d4bc3(_0x3adf28);})['catch'](function(_0x1aef2b){logger[_0x15f7('0xe')](_0x15f7('0x1f'),_0x1aef2b[_0x15f7('0x11')],_0x2c78ca);_0x40b752(_0x333ff8[_0x15f7('0xe')](0x1f4,_0x1aef2b[_0x15f7('0x11')]));});});};exports['ShowDynamics365Account']=function(_0x521934){var _0x31bf43=this;return new Promise(function(_0xd240bb,_0x350f8a){return db['Dynamics365Account'][_0x15f7('0x20')]({'raw':_0x521934['options']?_0x521934[_0x15f7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x521934[_0x15f7('0x17')]?_0x521934[_0x15f7('0x17')][_0x15f7('0x19')]||null:null,'attributes':_0x521934[_0x15f7('0x17')]?_0x521934['options']['attributes']||null:null,'include':_0x521934[_0x15f7('0x17')]?_0x521934[_0x15f7('0x17')][_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x521934[_0x15f7('0x17')][_0x15f7('0x1c')],function(_0x2954cb){return{'model':db[_0x2954cb[_0x15f7('0x1e')]],'as':_0x2954cb['as'],'attributes':_0x2954cb[_0x15f7('0x1a')],'include':_0x2954cb[_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x2954cb['include'],function(_0x1c737c){return{'model':db[_0x1c737c['model']],'as':_0x1c737c['as'],'attributes':_0x1c737c[_0x15f7('0x1a')],'include':_0x1c737c[_0x15f7('0x1c')]?_[_0x15f7('0x1d')](_0x1c737c[_0x15f7('0x1c')],function(_0x2b2525){return{'model':db[_0x2b2525[_0x15f7('0x1e')]],'as':_0x2b2525['as'],'attributes':_0x2b2525['attributes']};}):[]};}):[]};}):[]:[]})[_0x15f7('0x9')](function(_0x5a2343){logger[_0x15f7('0xa')](_0x15f7('0x21'),_0x521934);logger[_0x15f7('0xb')](_0x15f7('0x21'),_0x521934,JSON[_0x15f7('0xd')](_0x5a2343));_0xd240bb(_0x5a2343);})['catch'](function(_0x2c875e){logger['error']('ShowDynamics365Account',_0x2c875e[_0x15f7('0x11')],_0x521934);_0x350f8a(_0x31bf43['error'](0x1f4,_0x2c875e[_0x15f7('0x11')]));});});}; \ No newline at end of file +var _0xe260=['where','attributes','include','map','model','stringify','ShowDynamics365Account','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xe260,0x94));var _0x0e26=function(_0x15a476,_0x3863ff){_0x15a476=_0x15a476-0x0;var _0x3796db=_0xe260[_0x15a476];return _0x3796db;};'use strict';var _=require(_0x0e26('0x0'));var util=require('util');var moment=require(_0x0e26('0x1'));var BPromise=require(_0x0e26('0x2'));var rs=require(_0x0e26('0x3'));var fs=require('fs');var Redis=require(_0x0e26('0x4'));var db=require(_0x0e26('0x5'))['db'];var utils=require(_0x0e26('0x6'));var logger=require(_0x0e26('0x7'))(_0x0e26('0x8'));var config=require(_0x0e26('0x9'));var jayson=require(_0x0e26('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15018a,_0xea8fe0,_0x1f7ad8){return new BPromise(function(_0x2ed98e,_0x457c6e){return client[_0x0e26('0xb')](_0x15018a,_0x1f7ad8)[_0x0e26('0xc')](function(_0x5e67e2){logger[_0x0e26('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0xea8fe0,_0x0e26('0xe'));logger[_0x0e26('0xf')](_0x0e26('0x10'),_0xea8fe0,'request\x20sent',JSON['stringify'](_0x5e67e2));if(_0x5e67e2[_0x0e26('0x11')]){if(_0x5e67e2[_0x0e26('0x11')]['code']===0x1f4){logger[_0x0e26('0x11')](_0x0e26('0x12'),_0xea8fe0,_0x5e67e2[_0x0e26('0x11')]['message']);return _0x457c6e(_0x5e67e2[_0x0e26('0x11')][_0x0e26('0x13')]);}logger[_0x0e26('0x11')](_0x0e26('0x12'),_0xea8fe0,_0x5e67e2[_0x0e26('0x11')][_0x0e26('0x13')]);return _0x2ed98e(_0x5e67e2[_0x0e26('0x11')]['message']);}else{logger[_0x0e26('0xd')](_0x0e26('0x12'),_0xea8fe0,_0x0e26('0xe'));_0x2ed98e(_0x5e67e2[_0x0e26('0x14')]['message']);}})[_0x0e26('0x15')](function(_0x8571bf){logger[_0x0e26('0x11')](_0x0e26('0x12'),_0xea8fe0,_0x8571bf);_0x457c6e(_0x8571bf);});});}exports[_0x0e26('0x16')]=function(_0x5d0c24){var _0x177568=this;return new Promise(function(_0x94f8b5,_0x43dcd1){return db[_0x0e26('0x17')][_0x0e26('0x18')]({'raw':_0x5d0c24[_0x0e26('0x19')]?_0x5d0c24[_0x0e26('0x19')][_0x0e26('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d0c24[_0x0e26('0x19')]?_0x5d0c24[_0x0e26('0x19')][_0x0e26('0x1b')]||null:null,'attributes':_0x5d0c24[_0x0e26('0x19')]?_0x5d0c24[_0x0e26('0x19')][_0x0e26('0x1c')]||null:null,'limit':_0x5d0c24['options']?_0x5d0c24[_0x0e26('0x19')]['limit']||null:null,'include':_0x5d0c24[_0x0e26('0x19')]?_0x5d0c24['options'][_0x0e26('0x1d')]?_[_0x0e26('0x1e')](_0x5d0c24[_0x0e26('0x19')][_0x0e26('0x1d')],function(_0x30ceb6){return{'model':db[_0x30ceb6[_0x0e26('0x1f')]],'as':_0x30ceb6['as'],'attributes':_0x30ceb6[_0x0e26('0x1c')],'include':_0x30ceb6[_0x0e26('0x1d')]?_[_0x0e26('0x1e')](_0x30ceb6[_0x0e26('0x1d')],function(_0x9eff86){return{'model':db[_0x9eff86[_0x0e26('0x1f')]],'as':_0x9eff86['as'],'attributes':_0x9eff86['attributes'],'include':_0x9eff86['include']?_[_0x0e26('0x1e')](_0x9eff86['include'],function(_0x5f2fb8){return{'model':db[_0x5f2fb8[_0x0e26('0x1f')]],'as':_0x5f2fb8['as'],'attributes':_0x5f2fb8[_0x0e26('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0e26('0xc')](function(_0x40f464){logger['info']('GetDynamics365Account',_0x5d0c24);logger['debug'](_0x0e26('0x16'),_0x5d0c24,JSON[_0x0e26('0x20')](_0x40f464));_0x94f8b5(_0x40f464);})[_0x0e26('0x15')](function(_0x2bfc13){logger[_0x0e26('0x11')](_0x0e26('0x16'),_0x2bfc13['message'],_0x5d0c24);_0x43dcd1(_0x177568[_0x0e26('0x11')](0x1f4,_0x2bfc13[_0x0e26('0x13')]));});});};exports[_0x0e26('0x21')]=function(_0x374e9e){var _0x54f931=this;return new Promise(function(_0x361c09,_0x1f3ac1){return db[_0x0e26('0x17')][_0x0e26('0x22')]({'raw':_0x374e9e['options']?_0x374e9e['options'][_0x0e26('0x1a')]===undefined?!![]:![]:!![],'where':_0x374e9e[_0x0e26('0x19')]?_0x374e9e['options']['where']||null:null,'attributes':_0x374e9e['options']?_0x374e9e[_0x0e26('0x19')]['attributes']||null:null,'include':_0x374e9e[_0x0e26('0x19')]?_0x374e9e['options']['include']?_[_0x0e26('0x1e')](_0x374e9e[_0x0e26('0x19')][_0x0e26('0x1d')],function(_0x23f071){return{'model':db[_0x23f071[_0x0e26('0x1f')]],'as':_0x23f071['as'],'attributes':_0x23f071[_0x0e26('0x1c')],'include':_0x23f071[_0x0e26('0x1d')]?_['map'](_0x23f071[_0x0e26('0x1d')],function(_0x4553cb){return{'model':db[_0x4553cb[_0x0e26('0x1f')]],'as':_0x4553cb['as'],'attributes':_0x4553cb[_0x0e26('0x1c')],'include':_0x4553cb[_0x0e26('0x1d')]?_[_0x0e26('0x1e')](_0x4553cb[_0x0e26('0x1d')],function(_0x435904){return{'model':db[_0x435904['model']],'as':_0x435904['as'],'attributes':_0x435904['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e26('0xc')](function(_0x1b8b5f){logger[_0x0e26('0xd')]('ShowDynamics365Account',_0x374e9e);logger['debug'](_0x0e26('0x21'),_0x374e9e,JSON[_0x0e26('0x20')](_0x1b8b5f));_0x361c09(_0x1b8b5f);})[_0x0e26('0x15')](function(_0x43ca61){logger['error'](_0x0e26('0x21'),_0x43ca61[_0x0e26('0x13')],_0x374e9e);_0x1f3ac1(_0x54f931['error'](0x1f4,_0x43ca61[_0x0e26('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a56b0f7..d74c664 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 _0x94b6=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put'];(function(_0x7d1469,_0x27e617){var _0x125e08=function(_0x597023){while(--_0x597023){_0x7d1469['push'](_0x7d1469['shift']());}};_0x125e08(++_0x27e617);}(_0x94b6,0xbb));var _0x694b=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x94b6[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x694b('0x0'));var util=require('util');var path=require(_0x694b('0x1'));var timeout=require(_0x694b('0x2'));var express=require(_0x694b('0x3'));var router=express[_0x694b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x694b('0x5'));var config=require('../../config/environment');var controller=require(_0x694b('0x6'));router[_0x694b('0x7')]('/',auth[_0x694b('0x8')](),controller[_0x694b('0x9')]);router[_0x694b('0x7')](_0x694b('0xa'),auth[_0x694b('0x8')](),controller[_0x694b('0xb')]);router['get'](_0x694b('0xc'),auth['isAuthenticated'](),controller[_0x694b('0xd')]);router[_0x694b('0x7')](_0x694b('0xe'),auth[_0x694b('0x8')](),controller[_0x694b('0xf')]);router[_0x694b('0x7')]('/:id/descriptions',auth[_0x694b('0x8')](),controller[_0x694b('0x10')]);router[_0x694b('0x11')]('/',auth[_0x694b('0x8')](),controller[_0x694b('0x12')]);router[_0x694b('0x13')]('/:id',auth[_0x694b('0x8')](),controller[_0x694b('0x14')]);router[_0x694b('0x15')](_0x694b('0xa'),auth[_0x694b('0x8')](),controller['destroy']);module[_0x694b('0x16')]=router; \ No newline at end of file +var _0xfac5=['put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','/:id','show','getFields','get','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x5da54c,_0x520452){var _0x1246b0=function(_0x11e60b){while(--_0x11e60b){_0x5da54c['push'](_0x5da54c['shift']());}};_0x1246b0(++_0x520452);}(_0xfac5,0x8e));var _0x5fac=function(_0x9bed67,_0x569aa8){_0x9bed67=_0x9bed67-0x0;var _0x134947=_0xfac5[_0x9bed67];return _0x134947;};'use strict';var multer=require(_0x5fac('0x0'));var util=require(_0x5fac('0x1'));var path=require(_0x5fac('0x2'));var timeout=require(_0x5fac('0x3'));var express=require('express');var router=express[_0x5fac('0x4')]();var auth=require(_0x5fac('0x5'));var interaction=require(_0x5fac('0x6'));var config=require(_0x5fac('0x7'));var controller=require(_0x5fac('0x8'));router['get']('/',auth[_0x5fac('0x9')](),controller['index']);router['get'](_0x5fac('0xa'),auth[_0x5fac('0x9')](),controller[_0x5fac('0xb')]);router['get']('/:id/fields',auth[_0x5fac('0x9')](),controller[_0x5fac('0xc')]);router[_0x5fac('0xd')]('/:id/subjects',auth[_0x5fac('0x9')](),controller[_0x5fac('0xe')]);router['get'](_0x5fac('0xf'),auth[_0x5fac('0x9')](),controller[_0x5fac('0x10')]);router[_0x5fac('0x11')]('/',auth[_0x5fac('0x9')](),controller[_0x5fac('0x12')]);router[_0x5fac('0x13')]('/:id',auth[_0x5fac('0x9')](),controller[_0x5fac('0x14')]);router[_0x5fac('0x15')](_0x5fac('0xa'),auth[_0x5fac('0x9')](),controller['destroy']);module[_0x5fac('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 98befd6..2e3b33a 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 _0xe69d=['incident','phonecall','sequelize','STRING','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe69d,0x106));var _0xde69=function(_0x464739,_0x2fefa2){_0x464739=_0x464739-0x0;var _0x27110f=_0xe69d[_0x464739];return _0x27110f;};'use strict';var Sequelize=require(_0xde69('0x0'));module['exports']={'name':{'type':Sequelize[_0xde69('0x1')]},'description':{'type':Sequelize[_0xde69('0x1')]},'ticketType':{'type':Sequelize[_0xde69('0x2')](_0xde69('0x3'),_0xde69('0x4')),'defaultValue':_0xde69('0x3')}}; \ No newline at end of file +var _0x3f64=['phonecall','sequelize','exports','STRING','ENUM','incident'];(function(_0x2dd0d4,_0x4c3104){var _0x14ec29=function(_0x146ce5){while(--_0x146ce5){_0x2dd0d4['push'](_0x2dd0d4['shift']());}};_0x14ec29(++_0x4c3104);}(_0x3f64,0xbb));var _0x43f6=function(_0x373f63,_0xd6da72){_0x373f63=_0x373f63-0x0;var _0x51f178=_0x3f64[_0x373f63];return _0x51f178;};'use strict';var Sequelize=require(_0x43f6('0x0'));module[_0x43f6('0x1')]={'name':{'type':Sequelize[_0x43f6('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x43f6('0x3')](_0x43f6('0x4'),_0x43f6('0x5')),'defaultValue':_0x43f6('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 0d29821..9a23fbc 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 _0x80b6=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','send','index','map','Dynamics365Configuration','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','getFields','findOne','Dynamics365Field','sort','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x80b6,0x1b1));var _0x680b=function(_0x1f223c,_0x2a4f27){_0x1f223c=_0x1f223c-0x0;var _0x28268d=_0x80b6[_0x1f223c];return _0x28268d;};'use strict';var pdf=require(_0x680b('0x0'));var emlformat=require(_0x680b('0x1'));var rimraf=require(_0x680b('0x2'));var zipdir=require(_0x680b('0x3'));var jsonpatch=require(_0x680b('0x4'));var rp=require(_0x680b('0x5'));var moment=require(_0x680b('0x6'));var BPromise=require(_0x680b('0x7'));var Mustache=require(_0x680b('0x8'));var util=require(_0x680b('0x9'));var path=require(_0x680b('0xa'));var sox=require(_0x680b('0xb'));var csv=require(_0x680b('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x680b('0xd'));var squel=require(_0x680b('0xe'));var crypto=require(_0x680b('0xf'));var jsforce=require(_0x680b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x680b('0xc'));var querystring=require(_0x680b('0x11'));var Papa=require(_0x680b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x680b('0x13'));var logger=require(_0x680b('0x14'))(_0x680b('0x15'));var utils=require(_0x680b('0x16'));var config=require(_0x680b('0x17'));var licenseUtil=require(_0x680b('0x18'));var db=require(_0x680b('0x19'))['db'];var jayson=require(_0x680b('0x1a'));var client=jayson[_0x680b('0x1b')][_0x680b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3af5c2,_0x3a46f8,_0x13d35f,_0x21f3a7){return new BPromise(function(_0x57f6cd,_0x3af061){var _0x2f76d3=_0x21f3a7||client;return _0x2f76d3['request'](_0x3af5c2,_0x13d35f)[_0x680b('0x1d')](function(_0x5238cf){logger[_0x680b('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3a46f8,_0x680b('0x1f'));logger[_0x680b('0x20')](_0x680b('0x21'),_0x3a46f8,_0x680b('0x1f'),JSON[_0x680b('0x22')](_0x5238cf));if(_0x5238cf['error']){if(_0x5238cf[_0x680b('0x23')][_0x680b('0x24')]===0x1f4){logger[_0x680b('0x23')](_0x680b('0x25'),_0x3a46f8,_0x5238cf[_0x680b('0x23')]['message']);return _0x3af061(_0x5238cf[_0x680b('0x23')][_0x680b('0x26')]);}logger[_0x680b('0x23')](_0x680b('0x25'),_0x3a46f8,_0x5238cf[_0x680b('0x23')]['message']);return _0x57f6cd(_0x5238cf[_0x680b('0x23')][_0x680b('0x26')]);}else{logger['info'](_0x680b('0x25'),_0x3a46f8,_0x680b('0x1f'));_0x57f6cd(_0x5238cf[_0x680b('0x27')][_0x680b('0x26')]);}})[_0x680b('0x28')](function(_0x1e85a4){logger[_0x680b('0x23')](_0x680b('0x25'),_0x3a46f8,_0x1e85a4);_0x3af061(_0x1e85a4);});});}function respondWithStatusCode(_0x5bbc65,_0x1f894e){_0x1f894e=_0x1f894e||0xcc;return function(_0x313386){if(_0x313386){return _0x5bbc65[_0x680b('0x29')](_0x1f894e);}return _0x5bbc65[_0x680b('0x2a')](_0x1f894e)['end']();};}function respondWithResult(_0xb6d375,_0x1ce809){_0x1ce809=_0x1ce809||0xc8;return function(_0x1175db){if(_0x1175db){return _0xb6d375[_0x680b('0x2a')](_0x1ce809)[_0x680b('0x2b')](_0x1175db);}};}function respondWithFilteredResult(_0x2da4ec,_0x4cc1c8){return function(_0x54c404){if(_0x54c404){var _0xaa99b2=_0x54c404[_0x680b('0x2c')],_0x3aaa24=_0x4cc1c8['offset'],_0x575cef=_0x4cc1c8[_0x680b('0x2d')]+_0x4cc1c8[_0x680b('0x2e')],_0x529536;if(_0x575cef>=_0xaa99b2){_0x575cef=_0xaa99b2;_0x529536=0xc8;}else{_0x529536=0xce;}_0x2da4ec[_0x680b('0x2a')](_0x529536);return _0x2da4ec[_0x680b('0x2f')](_0x680b('0x30'),_0x3aaa24+'-'+_0x575cef+'/'+_0xaa99b2)[_0x680b('0x2b')](_0x54c404);}return null;};}function patchUpdates(_0x42eeb){return function(_0x56f87f){try{jsonpatch[_0x680b('0x31')](_0x56f87f,_0x42eeb,!![]);}catch(_0x4eea31){return BPromise[_0x680b('0x32')](_0x4eea31);}return _0x56f87f[_0x680b('0x33')]();};}function saveUpdates(_0xe0c21a,_0x395dd0){return function(_0x54b849){if(_0x54b849){return _0x54b849['update'](_0xe0c21a)[_0x680b('0x1d')](function(_0x115e36){return _0x115e36;});}return null;};}function removeEntity(_0x5abbbd,_0x304b54){return function(_0x382970){if(_0x382970){return _0x382970['destroy']()[_0x680b('0x1d')](function(){_0x5abbbd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a0a21,_0x39e529){return function(_0x2b168e){if(!_0x2b168e){_0x1a0a21[_0x680b('0x29')](0x194);}return _0x2b168e;};}function handleError(_0xe8b22e,_0x8be371){_0x8be371=_0x8be371||0x1f4;return function(_0x255b6c){logger[_0x680b('0x23')](_0x255b6c[_0x680b('0x34')]);if(_0x255b6c[_0x680b('0x35')]){delete _0x255b6c[_0x680b('0x35')];}_0xe8b22e[_0x680b('0x2a')](_0x8be371)[_0x680b('0x36')](_0x255b6c);};}exports[_0x680b('0x37')]=function(_0xf41e82,_0x30c61f){var _0xb1f9d7={},_0x4c52ac={},_0x4606fa={'count':0x0,'rows':[]};var _0x54e681=_[_0x680b('0x38')](db[_0x680b('0x39')]['rawAttributes'],function(_0x596de3){return{'name':_0x596de3['fieldName'],'type':_0x596de3[_0x680b('0x3a')][_0x680b('0x3b')]};});_0x4c52ac[_0x680b('0x3c')]=_[_0x680b('0x38')](_0x54e681,'name');_0x4c52ac[_0x680b('0x3d')]=_['keys'](_0xf41e82['query']);_0x4c52ac[_0x680b('0x3e')]=_[_0x680b('0x3f')](_0x4c52ac[_0x680b('0x3c')],_0x4c52ac[_0x680b('0x3d')]);_0xb1f9d7[_0x680b('0x40')]=_[_0x680b('0x3f')](_0x4c52ac['model'],qs['fields'](_0xf41e82['query'][_0x680b('0x41')]));_0xb1f9d7[_0x680b('0x40')]=_0xb1f9d7[_0x680b('0x40')][_0x680b('0x42')]?_0xb1f9d7['attributes']:_0x4c52ac[_0x680b('0x3c')];if(!_0xf41e82[_0x680b('0x3d')][_0x680b('0x43')](_0x680b('0x44'))){_0xb1f9d7[_0x680b('0x2e')]=qs[_0x680b('0x2e')](_0xf41e82[_0x680b('0x3d')]['limit']);_0xb1f9d7[_0x680b('0x2d')]=qs['offset'](_0xf41e82[_0x680b('0x3d')][_0x680b('0x2d')]);}_0xb1f9d7[_0x680b('0x45')]=qs['sort'](_0xf41e82[_0x680b('0x3d')]['sort']);_0xb1f9d7['where']=qs[_0x680b('0x3e')](_[_0x680b('0x46')](_0xf41e82[_0x680b('0x3d')],_0x4c52ac[_0x680b('0x3e')]),_0x54e681);if(_0xf41e82[_0x680b('0x3d')][_0x680b('0x47')]){_0xb1f9d7[_0x680b('0x48')]=_[_0x680b('0x49')](_0xb1f9d7[_0x680b('0x48')],{'$or':_['map'](_0x54e681,function(_0x5e3979){if(_0x5e3979[_0x680b('0x3a')]!==_0x680b('0x4a')){var _0x1161be={};_0x1161be[_0x5e3979[_0x680b('0x35')]]={'$like':'%'+_0xf41e82[_0x680b('0x3d')]['filter']+'%'};return _0x1161be;}})});}_0xb1f9d7=_['merge']({},_0xb1f9d7,_0xf41e82[_0x680b('0x4b')]);var _0x3418ca={'where':_0xb1f9d7[_0x680b('0x48')]};return db['Dynamics365Configuration']['count'](_0x3418ca)['then'](function(_0x6d1545){_0x4606fa[_0x680b('0x2c')]=_0x6d1545;if(_0xf41e82[_0x680b('0x3d')]['includeAll']){_0xb1f9d7[_0x680b('0x4c')]=[{'all':!![]}];}return db[_0x680b('0x39')][_0x680b('0x4d')](_0xb1f9d7);})[_0x680b('0x1d')](function(_0x58fd23){_0x4606fa[_0x680b('0x4e')]=_0x58fd23;return _0x4606fa;})[_0x680b('0x1d')](respondWithFilteredResult(_0x30c61f,_0xb1f9d7))[_0x680b('0x28')](handleError(_0x30c61f,null));};exports[_0x680b('0x4f')]=function(_0x58862f,_0x409fdd){var _0x22fdd9={'raw':![],'where':{'id':_0x58862f[_0x680b('0x50')]['id']}},_0x12d78c={};_0x12d78c['model']=_[_0x680b('0x51')](db[_0x680b('0x39')][_0x680b('0x52')]);_0x12d78c[_0x680b('0x3d')]=_[_0x680b('0x51')](_0x58862f['query']);_0x12d78c[_0x680b('0x3e')]=_[_0x680b('0x3f')](_0x12d78c[_0x680b('0x3c')],_0x12d78c['query']);_0x22fdd9[_0x680b('0x40')]=_[_0x680b('0x3f')](_0x12d78c[_0x680b('0x3c')],qs[_0x680b('0x41')](_0x58862f[_0x680b('0x3d')][_0x680b('0x41')]));_0x22fdd9['attributes']=_0x22fdd9[_0x680b('0x40')][_0x680b('0x42')]?_0x22fdd9[_0x680b('0x40')]:_0x12d78c[_0x680b('0x3c')];if(_0x58862f['query'][_0x680b('0x53')]){_0x22fdd9['include']=[{'all':!![]}];}_0x22fdd9=_[_0x680b('0x49')]({},_0x22fdd9,_0x58862f[_0x680b('0x4b')]);return db[_0x680b('0x39')][_0x680b('0x54')](_0x22fdd9)[_0x680b('0x1d')](handleEntityNotFound(_0x409fdd,null))[_0x680b('0x1d')](respondWithResult(_0x409fdd,null))['catch'](handleError(_0x409fdd,null));};exports[_0x680b('0x55')]=function(_0x3a948a,_0x188595){return db[_0x680b('0x39')][_0x680b('0x55')](_0x3a948a[_0x680b('0x56')],{})['then'](respondWithResult(_0x188595,0xc9))[_0x680b('0x28')](handleError(_0x188595,null));};exports['update']=function(_0x27cea8,_0xf838c6){if(_0x27cea8[_0x680b('0x56')]['id']){delete _0x27cea8[_0x680b('0x56')]['id'];}return db[_0x680b('0x39')][_0x680b('0x54')]({'where':{'id':_0x27cea8['params']['id']}})[_0x680b('0x1d')](handleEntityNotFound(_0xf838c6,null))['then'](saveUpdates(_0x27cea8['body'],null))[_0x680b('0x1d')](respondWithResult(_0xf838c6,null))[_0x680b('0x28')](handleError(_0xf838c6,null));};exports['destroy']=function(_0xa6b029,_0x9f0227){return db[_0x680b('0x39')][_0x680b('0x54')]({'where':{'id':_0xa6b029[_0x680b('0x50')]['id']}})['then'](handleEntityNotFound(_0x9f0227,null))[_0x680b('0x1d')](removeEntity(_0x9f0227,null))[_0x680b('0x28')](handleError(_0x9f0227,null));};exports[_0x680b('0x57')]=function(_0x3932f0,_0x1c4f89,_0xef568e){var _0x120c9e={};var _0x5afbbf={};var _0x49e565;var _0xf78f1;return db[_0x680b('0x39')][_0x680b('0x58')]({'where':{'id':_0x3932f0[_0x680b('0x50')]['id']}})[_0x680b('0x1d')](handleEntityNotFound(_0x1c4f89,null))[_0x680b('0x1d')](function(_0x1d08a1){if(_0x1d08a1){_0x49e565=_0x1d08a1;_0x5afbbf[_0x680b('0x3c')]=_[_0x680b('0x51')](db[_0x680b('0x59')]['rawAttributes']);_0x5afbbf['query']=_[_0x680b('0x51')](_0x3932f0[_0x680b('0x3d')]);_0x5afbbf[_0x680b('0x3e')]=_[_0x680b('0x3f')](_0x5afbbf['model'],_0x5afbbf[_0x680b('0x3d')]);_0x120c9e['attributes']=_[_0x680b('0x3f')](_0x5afbbf['model'],qs[_0x680b('0x41')](_0x3932f0[_0x680b('0x3d')]['fields']));_0x120c9e[_0x680b('0x40')]=_0x120c9e[_0x680b('0x40')][_0x680b('0x42')]?_0x120c9e[_0x680b('0x40')]:_0x5afbbf['model'];_0x120c9e[_0x680b('0x45')]=qs['sort'](_0x3932f0[_0x680b('0x3d')][_0x680b('0x5a')]);_0x120c9e[_0x680b('0x48')]=qs[_0x680b('0x3e')](_[_0x680b('0x46')](_0x3932f0['query'],_0x5afbbf[_0x680b('0x3e')]));if(_0x3932f0[_0x680b('0x3d')][_0x680b('0x47')]){_0x120c9e['where']=_['merge'](_0x120c9e['where'],{'$or':_[_0x680b('0x38')](_0x120c9e['attributes'],function(_0x4c0629){var _0x2e2e4={};_0x2e2e4[_0x4c0629]={'$like':'%'+_0x3932f0[_0x680b('0x3d')]['filter']+'%'};return _0x2e2e4;})});}_0x120c9e=_[_0x680b('0x49')]({},_0x120c9e,_0x3932f0[_0x680b('0x4b')]);return _0x49e565[_0x680b('0x57')](_0x120c9e);}})[_0x680b('0x1d')](function(_0x1eaaf4){if(_0x1eaaf4){_0xf78f1=_0x1eaaf4[_0x680b('0x42')];if(!_0x3932f0[_0x680b('0x3d')][_0x680b('0x43')](_0x680b('0x44'))){_0x120c9e['limit']=qs['limit'](_0x3932f0['query'][_0x680b('0x2e')]);_0x120c9e[_0x680b('0x2d')]=qs[_0x680b('0x2d')](_0x3932f0[_0x680b('0x3d')][_0x680b('0x2d')]);}return _0x49e565[_0x680b('0x57')](_0x120c9e);}})[_0x680b('0x1d')](function(_0x573fe6){if(_0x573fe6){return _0x573fe6?{'count':_0xf78f1,'rows':_0x573fe6}:null;}})['then'](respondWithResult(_0x1c4f89,null))[_0x680b('0x28')](handleError(_0x1c4f89,null));};exports['getSubjects']=function(_0x12d2c0,_0x2db49f,_0x37b7c7){var _0x168f8a={};var _0x350cfb={};var _0x56b675;var _0x6c7e4a;return db['Dynamics365Configuration'][_0x680b('0x58')]({'where':{'id':_0x12d2c0['params']['id']}})[_0x680b('0x1d')](handleEntityNotFound(_0x2db49f,null))[_0x680b('0x1d')](function(_0x39e437){if(_0x39e437){_0x56b675=_0x39e437;_0x350cfb[_0x680b('0x3c')]=_['keys'](db[_0x680b('0x59')]['rawAttributes']);_0x350cfb[_0x680b('0x3d')]=_[_0x680b('0x51')](_0x12d2c0[_0x680b('0x3d')]);_0x350cfb['filters']=_[_0x680b('0x3f')](_0x350cfb['model'],_0x350cfb['query']);_0x168f8a[_0x680b('0x40')]=_[_0x680b('0x3f')](_0x350cfb['model'],qs[_0x680b('0x41')](_0x12d2c0['query'][_0x680b('0x41')]));_0x168f8a['attributes']=_0x168f8a[_0x680b('0x40')][_0x680b('0x42')]?_0x168f8a[_0x680b('0x40')]:_0x350cfb[_0x680b('0x3c')];_0x168f8a['order']=qs[_0x680b('0x5a')](_0x12d2c0[_0x680b('0x3d')]['sort']);_0x168f8a[_0x680b('0x48')]=qs[_0x680b('0x3e')](_[_0x680b('0x46')](_0x12d2c0['query'],_0x350cfb['filters']));if(_0x12d2c0[_0x680b('0x3d')][_0x680b('0x47')]){_0x168f8a[_0x680b('0x48')]=_[_0x680b('0x49')](_0x168f8a[_0x680b('0x48')],{'$or':_['map'](_0x168f8a[_0x680b('0x40')],function(_0x14613c){var _0x22e5d2={};_0x22e5d2[_0x14613c]={'$like':'%'+_0x12d2c0[_0x680b('0x3d')]['filter']+'%'};return _0x22e5d2;})});}_0x168f8a=_[_0x680b('0x49')]({},_0x168f8a,_0x12d2c0[_0x680b('0x4b')]);return _0x56b675['getSubjects'](_0x168f8a);}})[_0x680b('0x1d')](function(_0x4f3f3f){if(_0x4f3f3f){_0x6c7e4a=_0x4f3f3f[_0x680b('0x42')];if(!_0x12d2c0[_0x680b('0x3d')][_0x680b('0x43')](_0x680b('0x44'))){_0x168f8a[_0x680b('0x2e')]=qs[_0x680b('0x2e')](_0x12d2c0[_0x680b('0x3d')][_0x680b('0x2e')]);_0x168f8a[_0x680b('0x2d')]=qs[_0x680b('0x2d')](_0x12d2c0[_0x680b('0x3d')][_0x680b('0x2d')]);}return _0x56b675[_0x680b('0x5b')](_0x168f8a);}})[_0x680b('0x1d')](function(_0x5ba1ff){if(_0x5ba1ff){return _0x5ba1ff?{'count':_0x6c7e4a,'rows':_0x5ba1ff}:null;}})[_0x680b('0x1d')](respondWithResult(_0x2db49f,null))[_0x680b('0x28')](handleError(_0x2db49f,null));};exports[_0x680b('0x5c')]=function(_0x1d93c3,_0x3cf417,_0xa0f423){var _0x3ad867={};var _0x202152={};var _0x33e984;var _0x180589;return db[_0x680b('0x39')]['findOne']({'where':{'id':_0x1d93c3[_0x680b('0x50')]['id']}})[_0x680b('0x1d')](handleEntityNotFound(_0x3cf417,null))[_0x680b('0x1d')](function(_0x15a52b){if(_0x15a52b){_0x33e984=_0x15a52b;_0x202152[_0x680b('0x3c')]=_[_0x680b('0x51')](db['Dynamics365Field'][_0x680b('0x52')]);_0x202152[_0x680b('0x3d')]=_[_0x680b('0x51')](_0x1d93c3[_0x680b('0x3d')]);_0x202152['filters']=_[_0x680b('0x3f')](_0x202152[_0x680b('0x3c')],_0x202152[_0x680b('0x3d')]);_0x3ad867[_0x680b('0x40')]=_['intersection'](_0x202152[_0x680b('0x3c')],qs[_0x680b('0x41')](_0x1d93c3[_0x680b('0x3d')][_0x680b('0x41')]));_0x3ad867['attributes']=_0x3ad867[_0x680b('0x40')][_0x680b('0x42')]?_0x3ad867[_0x680b('0x40')]:_0x202152[_0x680b('0x3c')];_0x3ad867[_0x680b('0x45')]=qs[_0x680b('0x5a')](_0x1d93c3[_0x680b('0x3d')][_0x680b('0x5a')]);_0x3ad867[_0x680b('0x48')]=qs['filters'](_[_0x680b('0x46')](_0x1d93c3[_0x680b('0x3d')],_0x202152[_0x680b('0x3e')]));if(_0x1d93c3[_0x680b('0x3d')][_0x680b('0x47')]){_0x3ad867[_0x680b('0x48')]=_['merge'](_0x3ad867[_0x680b('0x48')],{'$or':_['map'](_0x3ad867[_0x680b('0x40')],function(_0x2c3dd2){var _0x5d3de1={};_0x5d3de1[_0x2c3dd2]={'$like':'%'+_0x1d93c3[_0x680b('0x3d')]['filter']+'%'};return _0x5d3de1;})});}_0x3ad867=_[_0x680b('0x49')]({},_0x3ad867,_0x1d93c3[_0x680b('0x4b')]);return _0x33e984[_0x680b('0x5c')](_0x3ad867);}})['then'](function(_0x2f707e){if(_0x2f707e){_0x180589=_0x2f707e[_0x680b('0x42')];if(!_0x1d93c3['query']['hasOwnProperty'](_0x680b('0x44'))){_0x3ad867[_0x680b('0x2e')]=qs[_0x680b('0x2e')](_0x1d93c3['query'][_0x680b('0x2e')]);_0x3ad867[_0x680b('0x2d')]=qs[_0x680b('0x2d')](_0x1d93c3['query']['offset']);}return _0x33e984[_0x680b('0x5c')](_0x3ad867);}})[_0x680b('0x1d')](function(_0x5f10cf){if(_0x5f10cf){return _0x5f10cf?{'count':_0x180589,'rows':_0x5f10cf}:null;}})[_0x680b('0x1d')](respondWithResult(_0x3cf417,null))[_0x680b('0x28')](handleError(_0x3cf417,null));}; \ No newline at end of file +var _0x3145=['findAll','rows','params','create','body','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include'];(function(_0xe5dd06,_0x3cd7b4){var _0x265fbe=function(_0x4a9ec4){while(--_0x4a9ec4){_0xe5dd06['push'](_0xe5dd06['shift']());}};_0x265fbe(++_0x3cd7b4);}(_0x3145,0xc7));var _0x5314=function(_0x1a7575,_0x74fab1){_0x1a7575=_0x1a7575-0x0;var _0x7a87d6=_0x3145[_0x1a7575];return _0x7a87d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5314('0x0'));var rimraf=require(_0x5314('0x1'));var zipdir=require(_0x5314('0x2'));var jsonpatch=require(_0x5314('0x3'));var rp=require(_0x5314('0x4'));var moment=require(_0x5314('0x5'));var BPromise=require(_0x5314('0x6'));var Mustache=require(_0x5314('0x7'));var util=require('util');var path=require(_0x5314('0x8'));var sox=require('sox');var csv=require(_0x5314('0x9'));var ejs=require(_0x5314('0xa'));var fs=require('fs');var _=require(_0x5314('0xb'));var squel=require('squel');var crypto=require(_0x5314('0xc'));var jsforce=require(_0x5314('0xd'));var deskjs=require(_0x5314('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5314('0xf'));var Papa=require('papaparse');var Redis=require(_0x5314('0x10'));var authService=require(_0x5314('0x11'));var qs=require(_0x5314('0x12'));var as=require(_0x5314('0x13'));var hardwareService=require(_0x5314('0x14'));var logger=require(_0x5314('0x15'))(_0x5314('0x16'));var utils=require(_0x5314('0x17'));var config=require(_0x5314('0x18'));var licenseUtil=require(_0x5314('0x19'));var db=require(_0x5314('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5314('0x1b')][_0x5314('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x466e44,_0xe81396,_0xb16782,_0x515890){return new BPromise(function(_0x2278bc,_0x544d0a){var _0x454b91=_0x515890||client;return _0x454b91[_0x5314('0x1d')](_0x466e44,_0xb16782)[_0x5314('0x1e')](function(_0x2ba0ad){logger[_0x5314('0x1f')](_0x5314('0x20'),_0xe81396,_0x5314('0x21'));logger[_0x5314('0x22')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xe81396,_0x5314('0x21'),JSON[_0x5314('0x23')](_0x2ba0ad));if(_0x2ba0ad[_0x5314('0x24')]){if(_0x2ba0ad['error'][_0x5314('0x25')]===0x1f4){logger[_0x5314('0x24')](_0x5314('0x20'),_0xe81396,_0x2ba0ad[_0x5314('0x24')][_0x5314('0x26')]);return _0x544d0a(_0x2ba0ad[_0x5314('0x24')]['message']);}logger['error'](_0x5314('0x20'),_0xe81396,_0x2ba0ad[_0x5314('0x24')][_0x5314('0x26')]);return _0x2278bc(_0x2ba0ad[_0x5314('0x24')][_0x5314('0x26')]);}else{logger['info'](_0x5314('0x20'),_0xe81396,'request\x20sent');_0x2278bc(_0x2ba0ad[_0x5314('0x27')][_0x5314('0x26')]);}})[_0x5314('0x28')](function(_0x2d743e){logger[_0x5314('0x24')](_0x5314('0x20'),_0xe81396,_0x2d743e);_0x544d0a(_0x2d743e);});});}function respondWithStatusCode(_0x2dcefe,_0x4e974b){_0x4e974b=_0x4e974b||0xcc;return function(_0x1e4777){if(_0x1e4777){return _0x2dcefe[_0x5314('0x29')](_0x4e974b);}return _0x2dcefe['status'](_0x4e974b)[_0x5314('0x2a')]();};}function respondWithResult(_0x809d44,_0x2091a3){_0x2091a3=_0x2091a3||0xc8;return function(_0x19f9b6){if(_0x19f9b6){return _0x809d44[_0x5314('0x2b')](_0x2091a3)[_0x5314('0x2c')](_0x19f9b6);}};}function respondWithFilteredResult(_0x492f67,_0x247de3){return function(_0x54b613){if(_0x54b613){var _0x284233=_0x54b613[_0x5314('0x2d')],_0x255789=_0x247de3[_0x5314('0x2e')],_0xa5110=_0x247de3['offset']+_0x247de3[_0x5314('0x2f')],_0x559365;if(_0xa5110>=_0x284233){_0xa5110=_0x284233;_0x559365=0xc8;}else{_0x559365=0xce;}_0x492f67['status'](_0x559365);return _0x492f67[_0x5314('0x30')](_0x5314('0x31'),_0x255789+'-'+_0xa5110+'/'+_0x284233)[_0x5314('0x2c')](_0x54b613);}return null;};}function patchUpdates(_0x229146){return function(_0x3f771d){try{jsonpatch['apply'](_0x3f771d,_0x229146,!![]);}catch(_0x40a2ca){return BPromise[_0x5314('0x32')](_0x40a2ca);}return _0x3f771d[_0x5314('0x33')]();};}function saveUpdates(_0x2a4e6d,_0x53e954){return function(_0xfa73d6){if(_0xfa73d6){return _0xfa73d6['update'](_0x2a4e6d)['then'](function(_0x16c887){return _0x16c887;});}return null;};}function removeEntity(_0x55551f,_0x55367f){return function(_0x5aa9a2){if(_0x5aa9a2){return _0x5aa9a2[_0x5314('0x34')]()[_0x5314('0x1e')](function(){_0x55551f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712f8,_0x16929b){return function(_0x32d8b7){if(!_0x32d8b7){_0x3712f8[_0x5314('0x29')](0x194);}return _0x32d8b7;};}function handleError(_0x2dbeb7,_0x2ef047){_0x2ef047=_0x2ef047||0x1f4;return function(_0x232bf6){logger[_0x5314('0x24')](_0x232bf6[_0x5314('0x35')]);if(_0x232bf6[_0x5314('0x36')]){delete _0x232bf6['name'];}_0x2dbeb7[_0x5314('0x2b')](_0x2ef047)[_0x5314('0x37')](_0x232bf6);};}exports[_0x5314('0x38')]=function(_0x46bbf2,_0x2d3f01){var _0x3fca6d={},_0x1597dc={},_0x4952f2={'count':0x0,'rows':[]};var _0x1f7f20=_[_0x5314('0x39')](db['Dynamics365Configuration'][_0x5314('0x3a')],function(_0x1f8b99){return{'name':_0x1f8b99[_0x5314('0x3b')],'type':_0x1f8b99[_0x5314('0x3c')][_0x5314('0x3d')]};});_0x1597dc['model']=_['map'](_0x1f7f20,'name');_0x1597dc['query']=_[_0x5314('0x3e')](_0x46bbf2['query']);_0x1597dc[_0x5314('0x3f')]=_[_0x5314('0x40')](_0x1597dc[_0x5314('0x41')],_0x1597dc['query']);_0x3fca6d[_0x5314('0x42')]=_[_0x5314('0x40')](_0x1597dc[_0x5314('0x41')],qs[_0x5314('0x43')](_0x46bbf2[_0x5314('0x44')][_0x5314('0x43')]));_0x3fca6d[_0x5314('0x42')]=_0x3fca6d[_0x5314('0x42')][_0x5314('0x45')]?_0x3fca6d[_0x5314('0x42')]:_0x1597dc['model'];if(!_0x46bbf2[_0x5314('0x44')][_0x5314('0x46')](_0x5314('0x47'))){_0x3fca6d[_0x5314('0x2f')]=qs['limit'](_0x46bbf2[_0x5314('0x44')]['limit']);_0x3fca6d['offset']=qs[_0x5314('0x2e')](_0x46bbf2[_0x5314('0x44')][_0x5314('0x2e')]);}_0x3fca6d[_0x5314('0x48')]=qs['sort'](_0x46bbf2[_0x5314('0x44')][_0x5314('0x49')]);_0x3fca6d[_0x5314('0x4a')]=qs[_0x5314('0x3f')](_[_0x5314('0x4b')](_0x46bbf2[_0x5314('0x44')],_0x1597dc[_0x5314('0x3f')]),_0x1f7f20);if(_0x46bbf2['query'][_0x5314('0x4c')]){_0x3fca6d[_0x5314('0x4a')]=_[_0x5314('0x4d')](_0x3fca6d[_0x5314('0x4a')],{'$or':_[_0x5314('0x39')](_0x1f7f20,function(_0x226bb4){if(_0x226bb4[_0x5314('0x3c')]!==_0x5314('0x4e')){var _0xbecde6={};_0xbecde6[_0x226bb4[_0x5314('0x36')]]={'$like':'%'+_0x46bbf2[_0x5314('0x44')][_0x5314('0x4c')]+'%'};return _0xbecde6;}})});}_0x3fca6d=_[_0x5314('0x4d')]({},_0x3fca6d,_0x46bbf2[_0x5314('0x4f')]);var _0x3f5bb4={'where':_0x3fca6d[_0x5314('0x4a')]};return db[_0x5314('0x50')][_0x5314('0x2d')](_0x3f5bb4)['then'](function(_0x3119df){_0x4952f2[_0x5314('0x2d')]=_0x3119df;if(_0x46bbf2[_0x5314('0x44')][_0x5314('0x51')]){_0x3fca6d[_0x5314('0x52')]=[{'all':!![]}];}return db[_0x5314('0x50')][_0x5314('0x53')](_0x3fca6d);})['then'](function(_0x458f46){_0x4952f2[_0x5314('0x54')]=_0x458f46;return _0x4952f2;})[_0x5314('0x1e')](respondWithFilteredResult(_0x2d3f01,_0x3fca6d))[_0x5314('0x28')](handleError(_0x2d3f01,null));};exports['show']=function(_0x1e53ba,_0x469ef3){var _0x1f93b0={'raw':![],'where':{'id':_0x1e53ba[_0x5314('0x55')]['id']}},_0x276726={};_0x276726['model']=_[_0x5314('0x3e')](db[_0x5314('0x50')][_0x5314('0x3a')]);_0x276726[_0x5314('0x44')]=_['keys'](_0x1e53ba[_0x5314('0x44')]);_0x276726[_0x5314('0x3f')]=_['intersection'](_0x276726[_0x5314('0x41')],_0x276726['query']);_0x1f93b0[_0x5314('0x42')]=_[_0x5314('0x40')](_0x276726[_0x5314('0x41')],qs[_0x5314('0x43')](_0x1e53ba[_0x5314('0x44')][_0x5314('0x43')]));_0x1f93b0[_0x5314('0x42')]=_0x1f93b0[_0x5314('0x42')][_0x5314('0x45')]?_0x1f93b0[_0x5314('0x42')]:_0x276726[_0x5314('0x41')];if(_0x1e53ba[_0x5314('0x44')][_0x5314('0x51')]){_0x1f93b0[_0x5314('0x52')]=[{'all':!![]}];}_0x1f93b0=_[_0x5314('0x4d')]({},_0x1f93b0,_0x1e53ba[_0x5314('0x4f')]);return db[_0x5314('0x50')]['find'](_0x1f93b0)[_0x5314('0x1e')](handleEntityNotFound(_0x469ef3,null))[_0x5314('0x1e')](respondWithResult(_0x469ef3,null))['catch'](handleError(_0x469ef3,null));};exports[_0x5314('0x56')]=function(_0x805b18,_0x397a36){return db['Dynamics365Configuration'][_0x5314('0x56')](_0x805b18[_0x5314('0x57')],{})[_0x5314('0x1e')](respondWithResult(_0x397a36,0xc9))[_0x5314('0x28')](handleError(_0x397a36,null));};exports['update']=function(_0x1c3407,_0x46e471){if(_0x1c3407[_0x5314('0x57')]['id']){delete _0x1c3407[_0x5314('0x57')]['id'];}return db[_0x5314('0x50')][_0x5314('0x58')]({'where':{'id':_0x1c3407['params']['id']}})['then'](handleEntityNotFound(_0x46e471,null))[_0x5314('0x1e')](saveUpdates(_0x1c3407[_0x5314('0x57')],null))['then'](respondWithResult(_0x46e471,null))['catch'](handleError(_0x46e471,null));};exports[_0x5314('0x34')]=function(_0x551610,_0x173005){return db[_0x5314('0x50')]['find']({'where':{'id':_0x551610[_0x5314('0x55')]['id']}})['then'](handleEntityNotFound(_0x173005,null))['then'](removeEntity(_0x173005,null))[_0x5314('0x28')](handleError(_0x173005,null));};exports[_0x5314('0x59')]=function(_0x1fddbb,_0x32e933,_0x367512){var _0x3714a0={};var _0x46ae24={};var _0x402d97;var _0x118e39;return db['Dynamics365Configuration'][_0x5314('0x5a')]({'where':{'id':_0x1fddbb[_0x5314('0x55')]['id']}})['then'](handleEntityNotFound(_0x32e933,null))[_0x5314('0x1e')](function(_0x3e6d6f){if(_0x3e6d6f){_0x402d97=_0x3e6d6f;_0x46ae24['model']=_[_0x5314('0x3e')](db['Dynamics365Field'][_0x5314('0x3a')]);_0x46ae24[_0x5314('0x44')]=_[_0x5314('0x3e')](_0x1fddbb[_0x5314('0x44')]);_0x46ae24[_0x5314('0x3f')]=_[_0x5314('0x40')](_0x46ae24['model'],_0x46ae24[_0x5314('0x44')]);_0x3714a0[_0x5314('0x42')]=_[_0x5314('0x40')](_0x46ae24['model'],qs[_0x5314('0x43')](_0x1fddbb[_0x5314('0x44')][_0x5314('0x43')]));_0x3714a0[_0x5314('0x42')]=_0x3714a0['attributes'][_0x5314('0x45')]?_0x3714a0[_0x5314('0x42')]:_0x46ae24[_0x5314('0x41')];_0x3714a0[_0x5314('0x48')]=qs[_0x5314('0x49')](_0x1fddbb['query']['sort']);_0x3714a0[_0x5314('0x4a')]=qs[_0x5314('0x3f')](_[_0x5314('0x4b')](_0x1fddbb['query'],_0x46ae24[_0x5314('0x3f')]));if(_0x1fddbb['query']['filter']){_0x3714a0['where']=_[_0x5314('0x4d')](_0x3714a0[_0x5314('0x4a')],{'$or':_[_0x5314('0x39')](_0x3714a0[_0x5314('0x42')],function(_0x896b15){var _0x2d0398={};_0x2d0398[_0x896b15]={'$like':'%'+_0x1fddbb[_0x5314('0x44')]['filter']+'%'};return _0x2d0398;})});}_0x3714a0=_['merge']({},_0x3714a0,_0x1fddbb['options']);return _0x402d97[_0x5314('0x59')](_0x3714a0);}})['then'](function(_0x2707fd){if(_0x2707fd){_0x118e39=_0x2707fd[_0x5314('0x45')];if(!_0x1fddbb['query'][_0x5314('0x46')](_0x5314('0x47'))){_0x3714a0['limit']=qs[_0x5314('0x2f')](_0x1fddbb['query'][_0x5314('0x2f')]);_0x3714a0[_0x5314('0x2e')]=qs['offset'](_0x1fddbb['query']['offset']);}return _0x402d97[_0x5314('0x59')](_0x3714a0);}})[_0x5314('0x1e')](function(_0xb69166){if(_0xb69166){return _0xb69166?{'count':_0x118e39,'rows':_0xb69166}:null;}})[_0x5314('0x1e')](respondWithResult(_0x32e933,null))[_0x5314('0x28')](handleError(_0x32e933,null));};exports['getSubjects']=function(_0x9bba43,_0x258ff9,_0x3ed275){var _0x490d17={};var _0x837a8f={};var _0x3b3fe8;var _0x59c21b;return db['Dynamics365Configuration'][_0x5314('0x5a')]({'where':{'id':_0x9bba43[_0x5314('0x55')]['id']}})[_0x5314('0x1e')](handleEntityNotFound(_0x258ff9,null))[_0x5314('0x1e')](function(_0x27fb2c){if(_0x27fb2c){_0x3b3fe8=_0x27fb2c;_0x837a8f[_0x5314('0x41')]=_[_0x5314('0x3e')](db[_0x5314('0x5b')][_0x5314('0x3a')]);_0x837a8f[_0x5314('0x44')]=_[_0x5314('0x3e')](_0x9bba43[_0x5314('0x44')]);_0x837a8f['filters']=_['intersection'](_0x837a8f[_0x5314('0x41')],_0x837a8f[_0x5314('0x44')]);_0x490d17[_0x5314('0x42')]=_[_0x5314('0x40')](_0x837a8f[_0x5314('0x41')],qs[_0x5314('0x43')](_0x9bba43[_0x5314('0x44')][_0x5314('0x43')]));_0x490d17['attributes']=_0x490d17[_0x5314('0x42')][_0x5314('0x45')]?_0x490d17[_0x5314('0x42')]:_0x837a8f[_0x5314('0x41')];_0x490d17[_0x5314('0x48')]=qs[_0x5314('0x49')](_0x9bba43[_0x5314('0x44')]['sort']);_0x490d17['where']=qs[_0x5314('0x3f')](_[_0x5314('0x4b')](_0x9bba43[_0x5314('0x44')],_0x837a8f['filters']));if(_0x9bba43[_0x5314('0x44')][_0x5314('0x4c')]){_0x490d17[_0x5314('0x4a')]=_[_0x5314('0x4d')](_0x490d17['where'],{'$or':_['map'](_0x490d17[_0x5314('0x42')],function(_0x3df434){var _0x2c4216={};_0x2c4216[_0x3df434]={'$like':'%'+_0x9bba43['query'][_0x5314('0x4c')]+'%'};return _0x2c4216;})});}_0x490d17=_[_0x5314('0x4d')]({},_0x490d17,_0x9bba43[_0x5314('0x4f')]);return _0x3b3fe8[_0x5314('0x5c')](_0x490d17);}})[_0x5314('0x1e')](function(_0x292e42){if(_0x292e42){_0x59c21b=_0x292e42['length'];if(!_0x9bba43[_0x5314('0x44')]['hasOwnProperty'](_0x5314('0x47'))){_0x490d17[_0x5314('0x2f')]=qs['limit'](_0x9bba43[_0x5314('0x44')][_0x5314('0x2f')]);_0x490d17[_0x5314('0x2e')]=qs[_0x5314('0x2e')](_0x9bba43['query'][_0x5314('0x2e')]);}return _0x3b3fe8[_0x5314('0x5c')](_0x490d17);}})[_0x5314('0x1e')](function(_0x314f13){if(_0x314f13){return _0x314f13?{'count':_0x59c21b,'rows':_0x314f13}:null;}})[_0x5314('0x1e')](respondWithResult(_0x258ff9,null))[_0x5314('0x28')](handleError(_0x258ff9,null));};exports[_0x5314('0x5d')]=function(_0xcd262b,_0x529b06,_0x41f9b9){var _0x5de59e={};var _0x2bb0dc={};var _0x1e4ba5;var _0x458350;return db['Dynamics365Configuration'][_0x5314('0x5a')]({'where':{'id':_0xcd262b[_0x5314('0x55')]['id']}})[_0x5314('0x1e')](handleEntityNotFound(_0x529b06,null))[_0x5314('0x1e')](function(_0x169d40){if(_0x169d40){_0x1e4ba5=_0x169d40;_0x2bb0dc['model']=_[_0x5314('0x3e')](db[_0x5314('0x5b')][_0x5314('0x3a')]);_0x2bb0dc[_0x5314('0x44')]=_['keys'](_0xcd262b['query']);_0x2bb0dc[_0x5314('0x3f')]=_['intersection'](_0x2bb0dc[_0x5314('0x41')],_0x2bb0dc[_0x5314('0x44')]);_0x5de59e['attributes']=_[_0x5314('0x40')](_0x2bb0dc[_0x5314('0x41')],qs[_0x5314('0x43')](_0xcd262b[_0x5314('0x44')][_0x5314('0x43')]));_0x5de59e[_0x5314('0x42')]=_0x5de59e[_0x5314('0x42')][_0x5314('0x45')]?_0x5de59e[_0x5314('0x42')]:_0x2bb0dc[_0x5314('0x41')];_0x5de59e[_0x5314('0x48')]=qs[_0x5314('0x49')](_0xcd262b['query'][_0x5314('0x49')]);_0x5de59e[_0x5314('0x4a')]=qs[_0x5314('0x3f')](_['pick'](_0xcd262b[_0x5314('0x44')],_0x2bb0dc[_0x5314('0x3f')]));if(_0xcd262b[_0x5314('0x44')][_0x5314('0x4c')]){_0x5de59e[_0x5314('0x4a')]=_[_0x5314('0x4d')](_0x5de59e[_0x5314('0x4a')],{'$or':_[_0x5314('0x39')](_0x5de59e['attributes'],function(_0x331555){var _0x1769df={};_0x1769df[_0x331555]={'$like':'%'+_0xcd262b[_0x5314('0x44')]['filter']+'%'};return _0x1769df;})});}_0x5de59e=_['merge']({},_0x5de59e,_0xcd262b['options']);return _0x1e4ba5[_0x5314('0x5d')](_0x5de59e);}})[_0x5314('0x1e')](function(_0x12db46){if(_0x12db46){_0x458350=_0x12db46[_0x5314('0x45')];if(!_0xcd262b[_0x5314('0x44')]['hasOwnProperty'](_0x5314('0x47'))){_0x5de59e[_0x5314('0x2f')]=qs[_0x5314('0x2f')](_0xcd262b['query'][_0x5314('0x2f')]);_0x5de59e[_0x5314('0x2e')]=qs['offset'](_0xcd262b['query'][_0x5314('0x2e')]);}return _0x1e4ba5[_0x5314('0x5d')](_0x5de59e);}})[_0x5314('0x1e')](function(_0x4f188c){if(_0x4f188c){return _0x4f188c?{'count':_0x458350,'rows':_0x4f188c}:null;}})['then'](respondWithResult(_0x529b06,null))[_0x5314('0x28')](handleError(_0x529b06,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2f98e84..1aac470 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 _0xb582=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x96b455,_0x5af27d){var _0x190a87=function(_0x1bc35d){while(--_0x1bc35d){_0x96b455['push'](_0x96b455['shift']());}};_0x190a87(++_0x5af27d);}(_0xb582,0x1e7));var _0x2b58=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb582[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x2b58('0x0'));var util=require(_0x2b58('0x1'));var logger=require(_0x2b58('0x2'))(_0x2b58('0x3'));var moment=require(_0x2b58('0x4'));var BPromise=require(_0x2b58('0x5'));var rp=require(_0x2b58('0x6'));var fs=require('fs');var path=require(_0x2b58('0x7'));var rimraf=require(_0x2b58('0x8'));var config=require(_0x2b58('0x9'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x2b58('0xa')]=function(_0x3fcfd1,_0x36bd74){return _0x3fcfd1[_0x2b58('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2972=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x49b7e4,_0x270436){var _0xb78037=function(_0x4070fb){while(--_0x4070fb){_0x49b7e4['push'](_0x49b7e4['shift']());}};_0xb78037(++_0x270436);}(_0x2972,0xfc));var _0x2297=function(_0x58aec4,_0x23a99a){_0x58aec4=_0x58aec4-0x0;var _0x47f15e=_0x2972[_0x58aec4];return _0x47f15e;};'use strict';var _=require(_0x2297('0x0'));var util=require(_0x2297('0x1'));var logger=require(_0x2297('0x2'))(_0x2297('0x3'));var moment=require(_0x2297('0x4'));var BPromise=require(_0x2297('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2297('0x6'));var rimraf=require(_0x2297('0x7'));var config=require(_0x2297('0x8'));var attributes=require(_0x2297('0x9'));module[_0x2297('0xa')]=function(_0x19d485,_0x3f4bed){return _0x19d485[_0x2297('0xb')](_0x2297('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 110da82..8af48d5 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 _0xd282=['request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x59fe3f,_0x3f1edc){var _0x564be7=function(_0x57af29){while(--_0x57af29){_0x59fe3f['push'](_0x59fe3f['shift']());}};_0x564be7(++_0x3f1edc);}(_0xd282,0x183));var _0x2d28=function(_0x3781b0,_0x24928b){_0x3781b0=_0x3781b0-0x0;var _0x4113c9=_0xd282[_0x3781b0];return _0x4113c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d28('0x0'));var BPromise=require('bluebird');var rs=require(_0x2d28('0x1'));var fs=require('fs');var Redis=require(_0x2d28('0x2'));var db=require(_0x2d28('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d28('0x4'))('rpc');var config=require(_0x2d28('0x5'));var jayson=require(_0x2d28('0x6'));var client=jayson[_0x2d28('0x7')][_0x2d28('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125182,_0x21506d,_0x54750f){return new BPromise(function(_0x10b328,_0x300cc6){return client[_0x2d28('0x9')](_0x125182,_0x54750f)[_0x2d28('0xa')](function(_0x4a5d73){logger[_0x2d28('0xb')](_0x2d28('0xc'),_0x21506d,'request\x20sent');logger[_0x2d28('0xd')](_0x2d28('0xe'),_0x21506d,_0x2d28('0xf'),JSON[_0x2d28('0x10')](_0x4a5d73));if(_0x4a5d73[_0x2d28('0x11')]){if(_0x4a5d73[_0x2d28('0x11')][_0x2d28('0x12')]===0x1f4){logger[_0x2d28('0x11')](_0x2d28('0xc'),_0x21506d,_0x4a5d73[_0x2d28('0x11')][_0x2d28('0x13')]);return _0x300cc6(_0x4a5d73[_0x2d28('0x11')][_0x2d28('0x13')]);}logger[_0x2d28('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x21506d,_0x4a5d73[_0x2d28('0x11')][_0x2d28('0x13')]);return _0x10b328(_0x4a5d73[_0x2d28('0x11')][_0x2d28('0x13')]);}else{logger[_0x2d28('0xb')](_0x2d28('0xc'),_0x21506d,_0x2d28('0xf'));_0x10b328(_0x4a5d73[_0x2d28('0x14')][_0x2d28('0x13')]);}})[_0x2d28('0x15')](function(_0x577609){logger['error'](_0x2d28('0xc'),_0x21506d,_0x577609);_0x300cc6(_0x577609);});});} \ No newline at end of file +var _0x7be9=['code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xb1786,_0x40502c){var _0x4bab3c=function(_0x419d80){while(--_0x419d80){_0xb1786['push'](_0xb1786['shift']());}};_0x4bab3c(++_0x40502c);}(_0x7be9,0x1a7));var _0x97be=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x7be9[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x97be('0x0'));var util=require('util');var moment=require(_0x97be('0x1'));var BPromise=require('bluebird');var rs=require(_0x97be('0x2'));var fs=require('fs');var Redis=require(_0x97be('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x97be('0x4'));var logger=require('../../config/logger')(_0x97be('0x5'));var config=require(_0x97be('0x6'));var jayson=require(_0x97be('0x7'));var client=jayson[_0x97be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54481b,_0x4ff22e,_0xf15951){return new BPromise(function(_0x58796f,_0xf7f376){return client['request'](_0x54481b,_0xf15951)[_0x97be('0x9')](function(_0x4aedb9){logger['info'](_0x97be('0xa'),_0x4ff22e,'request\x20sent');logger['debug'](_0x97be('0xb'),_0x4ff22e,_0x97be('0xc'),JSON['stringify'](_0x4aedb9));if(_0x4aedb9[_0x97be('0xd')]){if(_0x4aedb9[_0x97be('0xd')][_0x97be('0xe')]===0x1f4){logger[_0x97be('0xd')](_0x97be('0xa'),_0x4ff22e,_0x4aedb9[_0x97be('0xd')][_0x97be('0xf')]);return _0xf7f376(_0x4aedb9[_0x97be('0xd')][_0x97be('0xf')]);}logger[_0x97be('0xd')](_0x97be('0xa'),_0x4ff22e,_0x4aedb9[_0x97be('0xd')][_0x97be('0xf')]);return _0x58796f(_0x4aedb9[_0x97be('0xd')][_0x97be('0xf')]);}else{logger[_0x97be('0x10')](_0x97be('0xa'),_0x4ff22e,_0x97be('0xc'));_0x58796f(_0x4aedb9[_0x97be('0x11')][_0x97be('0xf')]);}})[_0x97be('0x12')](function(_0x26438e){logger['error'](_0x97be('0xa'),_0x4ff22e,_0x26438e);_0xf7f376(_0x26438e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a1e6d3b..918f6c6 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 _0x6282=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x5da157,_0x2c2741){var _0x551fdf=function(_0x565efa){while(--_0x565efa){_0x5da157['push'](_0x5da157['shift']());}};_0x551fdf(++_0x2c2741);}(_0x6282,0x76));var _0x2628=function(_0x160ade,_0x1aef25){_0x160ade=_0x160ade-0x0;var _0x598eb4=_0x6282[_0x160ade];return _0x598eb4;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2628('0x4'));var interaction=require(_0x2628('0x5'));var config=require('../../config/environment');var controller=require(_0x2628('0x6'));router[_0x2628('0x7')]('/',auth[_0x2628('0x8')](),controller[_0x2628('0x9')]);router[_0x2628('0x7')]('/:id',auth[_0x2628('0x8')](),controller[_0x2628('0xa')]);router[_0x2628('0xb')]('/',auth[_0x2628('0x8')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')](_0x2628('0xe'),auth[_0x2628('0x8')](),controller[_0x2628('0xf')]);router[_0x2628('0x10')](_0x2628('0xe'),auth[_0x2628('0x8')](),controller[_0x2628('0x11')]);module[_0x2628('0x12')]=router; \ No newline at end of file +var _0x54f3=['./intDynamics365Field.controller','get','isAuthenticated','show','post','put','update','destroy','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x4024c9,_0x61f8fe){var _0x493b6b=function(_0x4a371a){while(--_0x4a371a){_0x4024c9['push'](_0x4024c9['shift']());}};_0x493b6b(++_0x61f8fe);}(_0x54f3,0x120));var _0x354f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x54f3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x354f('0x0'));var path=require(_0x354f('0x1'));var timeout=require(_0x354f('0x2'));var express=require(_0x354f('0x3'));var router=express[_0x354f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x354f('0x5'));var controller=require(_0x354f('0x6'));router[_0x354f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x354f('0x7')]('/:id',auth[_0x354f('0x8')](),controller[_0x354f('0x9')]);router[_0x354f('0xa')]('/',auth[_0x354f('0x8')](),controller['create']);router[_0x354f('0xb')]('/:id',auth[_0x354f('0x8')](),controller[_0x354f('0xc')]);router['delete']('/:id',auth[_0x354f('0x8')](),controller[_0x354f('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ebdd623..840f509 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 _0x0b14=['string','variable','customVariable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x3e9462,_0x38c4e5){var _0x4f228b=function(_0x53ac78){while(--_0x53ac78){_0x3e9462['push'](_0x3e9462['shift']());}};_0x4f228b(++_0x38c4e5);}(_0x0b14,0x117));var _0x40b1=function(_0x279d4e,_0x2631f1){_0x279d4e=_0x279d4e-0x0;var _0x23e0f7=_0x0b14[_0x279d4e];return _0x23e0f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x40b1('0x0')](_0x40b1('0x1'),_0x40b1('0x2'),_0x40b1('0x3'),_0x40b1('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x40b1('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x40b1('0x2'),_0x40b1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x40b1('0x5')]},'nameField':{'type':Sequelize[_0x40b1('0x5')]},'customField':{'type':Sequelize[_0x40b1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x40b1('0x5')]}}; \ No newline at end of file +var _0x6817=['customVariable','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x37dea2,_0x46b7c5){var _0x1aa907=function(_0x32afa9){while(--_0x32afa9){_0x37dea2['push'](_0x37dea2['shift']());}};_0x1aa907(++_0x46b7c5);}(_0x6817,0xf8));var _0x7681=function(_0x240862,_0x267fdd){_0x240862=_0x240862-0x0;var _0x579bb2=_0x6817[_0x240862];return _0x579bb2;};'use strict';var Sequelize=require('sequelize');module[_0x7681('0x0')]={'type':{'type':Sequelize[_0x7681('0x1')](_0x7681('0x2'),_0x7681('0x3'),_0x7681('0x4'),'keyValue'),'defaultValue':_0x7681('0x2')},'content':{'type':Sequelize[_0x7681('0x5')]},'key':{'type':Sequelize[_0x7681('0x5')]},'keyType':{'type':Sequelize[_0x7681('0x1')](_0x7681('0x2'),_0x7681('0x3'),_0x7681('0x4'))},'keyContent':{'type':Sequelize[_0x7681('0x5')]},'idField':{'type':Sequelize[_0x7681('0x5')]},'nameField':{'type':Sequelize[_0x7681('0x5')]},'customField':{'type':Sequelize[_0x7681('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ee5e57e..06a752e 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 _0xbae2=['status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','length','query','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','Dynamics365Field','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4b3d13,_0x1993d5){var _0xf64dd8=function(_0x2304ed){while(--_0x2304ed){_0x4b3d13['push'](_0x4b3d13['shift']());}};_0xf64dd8(++_0x1993d5);}(_0xbae2,0x1da));var _0x2bae=function(_0x18e5b7,_0x2fa391){_0x18e5b7=_0x18e5b7-0x0;var _0x28a2aa=_0xbae2[_0x18e5b7];return _0x28a2aa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2bae('0x0'));var rimraf=require(_0x2bae('0x1'));var zipdir=require(_0x2bae('0x2'));var jsonpatch=require(_0x2bae('0x3'));var rp=require('request-promise');var moment=require(_0x2bae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bae('0x5'));var util=require(_0x2bae('0x6'));var path=require(_0x2bae('0x7'));var sox=require(_0x2bae('0x8'));var csv=require(_0x2bae('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2bae('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2bae('0x9'));var querystring=require(_0x2bae('0xb'));var Papa=require('papaparse');var Redis=require(_0x2bae('0xc'));var authService=require(_0x2bae('0xd'));var qs=require(_0x2bae('0xe'));var as=require(_0x2bae('0xf'));var hardwareService=require(_0x2bae('0x10'));var logger=require(_0x2bae('0x11'))(_0x2bae('0x12'));var utils=require(_0x2bae('0x13'));var config=require(_0x2bae('0x14'));var licenseUtil=require(_0x2bae('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17b905,_0x56d3af){_0x56d3af=_0x56d3af||0xcc;return function(_0x43489f){if(_0x43489f){return _0x17b905[_0x2bae('0x16')](_0x56d3af);}return _0x17b905[_0x2bae('0x17')](_0x56d3af)['end']();};}function respondWithResult(_0x983c44,_0x53f09d){_0x53f09d=_0x53f09d||0xc8;return function(_0x283fd8){if(_0x283fd8){return _0x983c44['status'](_0x53f09d)[_0x2bae('0x18')](_0x283fd8);}};}function respondWithFilteredResult(_0x4e7a90,_0x20415c){return function(_0x5da0a7){if(_0x5da0a7){var _0x2b0ee5=_0x5da0a7[_0x2bae('0x19')],_0x8a7926=_0x20415c['offset'],_0xd5e143=_0x20415c[_0x2bae('0x1a')]+_0x20415c[_0x2bae('0x1b')],_0x49bb5c;if(_0xd5e143>=_0x2b0ee5){_0xd5e143=_0x2b0ee5;_0x49bb5c=0xc8;}else{_0x49bb5c=0xce;}_0x4e7a90[_0x2bae('0x17')](_0x49bb5c);return _0x4e7a90[_0x2bae('0x1c')](_0x2bae('0x1d'),_0x8a7926+'-'+_0xd5e143+'/'+_0x2b0ee5)[_0x2bae('0x18')](_0x5da0a7);}return null;};}function patchUpdates(_0x1128ba){return function(_0x102f3a){try{jsonpatch[_0x2bae('0x1e')](_0x102f3a,_0x1128ba,!![]);}catch(_0x1ae89c){return BPromise[_0x2bae('0x1f')](_0x1ae89c);}return _0x102f3a['save']();};}function saveUpdates(_0x264a0f,_0x213936){return function(_0xc4094d){if(_0xc4094d){return _0xc4094d[_0x2bae('0x20')](_0x264a0f)[_0x2bae('0x21')](function(_0x4e12f0){return _0x4e12f0;});}return null;};}function removeEntity(_0x25ba1e,_0x41e015){return function(_0x100bc7){if(_0x100bc7){return _0x100bc7[_0x2bae('0x22')]()['then'](function(){_0x25ba1e[_0x2bae('0x17')](0xcc)[_0x2bae('0x23')]();});}};}function handleEntityNotFound(_0x56622a,_0x875905){return function(_0xbea53d){if(!_0xbea53d){_0x56622a['sendStatus'](0x194);}return _0xbea53d;};}function handleError(_0x528bab,_0x17c77b){_0x17c77b=_0x17c77b||0x1f4;return function(_0x3adad8){logger[_0x2bae('0x24')](_0x3adad8[_0x2bae('0x25')]);if(_0x3adad8[_0x2bae('0x26')]){delete _0x3adad8['name'];}_0x528bab['status'](_0x17c77b)[_0x2bae('0x27')](_0x3adad8);};}exports[_0x2bae('0x28')]=function(_0x1f5aab,_0x3f710c){var _0x2d5551={},_0x2d9a38={},_0x5100d9={'count':0x0,'rows':[]};var _0xb07c47=_[_0x2bae('0x29')](db['Dynamics365Field'][_0x2bae('0x2a')],function(_0x2331c5){return{'name':_0x2331c5[_0x2bae('0x2b')],'type':_0x2331c5[_0x2bae('0x2c')][_0x2bae('0x2d')]};});_0x2d9a38[_0x2bae('0x2e')]=_[_0x2bae('0x29')](_0xb07c47,_0x2bae('0x26'));_0x2d9a38['query']=_[_0x2bae('0x2f')](_0x1f5aab['query']);_0x2d9a38[_0x2bae('0x30')]=_['intersection'](_0x2d9a38[_0x2bae('0x2e')],_0x2d9a38['query']);_0x2d5551[_0x2bae('0x31')]=_[_0x2bae('0x32')](_0x2d9a38[_0x2bae('0x2e')],qs[_0x2bae('0x33')](_0x1f5aab['query']['fields']));_0x2d5551[_0x2bae('0x31')]=_0x2d5551[_0x2bae('0x31')][_0x2bae('0x34')]?_0x2d5551[_0x2bae('0x31')]:_0x2d9a38[_0x2bae('0x2e')];if(!_0x1f5aab[_0x2bae('0x35')][_0x2bae('0x36')]('nolimit')){_0x2d5551[_0x2bae('0x1b')]=qs[_0x2bae('0x1b')](_0x1f5aab[_0x2bae('0x35')]['limit']);_0x2d5551[_0x2bae('0x1a')]=qs[_0x2bae('0x1a')](_0x1f5aab['query'][_0x2bae('0x1a')]);}_0x2d5551['order']=qs[_0x2bae('0x37')](_0x1f5aab[_0x2bae('0x35')][_0x2bae('0x37')]);_0x2d5551[_0x2bae('0x38')]=qs['filters'](_[_0x2bae('0x39')](_0x1f5aab[_0x2bae('0x35')],_0x2d9a38[_0x2bae('0x30')]),_0xb07c47);if(_0x1f5aab[_0x2bae('0x35')][_0x2bae('0x3a')]){_0x2d5551[_0x2bae('0x38')]=_['merge'](_0x2d5551['where'],{'$or':_[_0x2bae('0x29')](_0xb07c47,function(_0x22f320){if(_0x22f320[_0x2bae('0x2c')]!==_0x2bae('0x3b')){var _0x1f76e4={};_0x1f76e4[_0x22f320[_0x2bae('0x26')]]={'$like':'%'+_0x1f5aab['query'][_0x2bae('0x3a')]+'%'};return _0x1f76e4;}})});}_0x2d5551=_[_0x2bae('0x3c')]({},_0x2d5551,_0x1f5aab['options']);var _0x4dc078={'where':_0x2d5551[_0x2bae('0x38')]};return db['Dynamics365Field'][_0x2bae('0x19')](_0x4dc078)[_0x2bae('0x21')](function(_0x173a43){_0x5100d9['count']=_0x173a43;if(_0x1f5aab[_0x2bae('0x35')]['includeAll']){_0x2d5551[_0x2bae('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x2bae('0x3e')](_0x2d5551);})[_0x2bae('0x21')](function(_0x5cab10){_0x5100d9['rows']=_0x5cab10;return _0x5100d9;})[_0x2bae('0x21')](respondWithFilteredResult(_0x3f710c,_0x2d5551))[_0x2bae('0x3f')](handleError(_0x3f710c,null));};exports[_0x2bae('0x40')]=function(_0x59750e,_0x5ac3ca){var _0x418380={'raw':!![],'where':{'id':_0x59750e[_0x2bae('0x41')]['id']}},_0x36287f={};_0x36287f['model']=_['keys'](db[_0x2bae('0x42')][_0x2bae('0x2a')]);_0x36287f[_0x2bae('0x35')]=_[_0x2bae('0x2f')](_0x59750e['query']);_0x36287f[_0x2bae('0x30')]=_[_0x2bae('0x32')](_0x36287f['model'],_0x36287f[_0x2bae('0x35')]);_0x418380[_0x2bae('0x31')]=_[_0x2bae('0x32')](_0x36287f[_0x2bae('0x2e')],qs[_0x2bae('0x33')](_0x59750e[_0x2bae('0x35')][_0x2bae('0x33')]));_0x418380[_0x2bae('0x31')]=_0x418380[_0x2bae('0x31')][_0x2bae('0x34')]?_0x418380['attributes']:_0x36287f[_0x2bae('0x2e')];if(_0x59750e[_0x2bae('0x35')]['includeAll']){_0x418380[_0x2bae('0x3d')]=[{'all':!![]}];}_0x418380=_[_0x2bae('0x3c')]({},_0x418380,_0x59750e[_0x2bae('0x43')]);return db['Dynamics365Field'][_0x2bae('0x44')](_0x418380)[_0x2bae('0x21')](handleEntityNotFound(_0x5ac3ca,null))[_0x2bae('0x21')](respondWithResult(_0x5ac3ca,null))['catch'](handleError(_0x5ac3ca,null));};exports[_0x2bae('0x45')]=function(_0x1dbdb5,_0x2db208){return db[_0x2bae('0x42')][_0x2bae('0x45')](_0x1dbdb5[_0x2bae('0x46')],{})['then'](respondWithResult(_0x2db208,0xc9))['catch'](handleError(_0x2db208,null));};exports[_0x2bae('0x20')]=function(_0x478541,_0x526a7b){if(_0x478541[_0x2bae('0x46')]['id']){delete _0x478541[_0x2bae('0x46')]['id'];}return db['Dynamics365Field'][_0x2bae('0x44')]({'where':{'id':_0x478541[_0x2bae('0x41')]['id']}})[_0x2bae('0x21')](handleEntityNotFound(_0x526a7b,null))[_0x2bae('0x21')](saveUpdates(_0x478541[_0x2bae('0x46')],null))[_0x2bae('0x21')](respondWithResult(_0x526a7b,null))[_0x2bae('0x3f')](handleError(_0x526a7b,null));};exports['destroy']=function(_0xc897d,_0x388e8c){return db[_0x2bae('0x42')][_0x2bae('0x44')]({'where':{'id':_0xc897d[_0x2bae('0x41')]['id']}})[_0x2bae('0x21')](handleEntityNotFound(_0x388e8c,null))[_0x2bae('0x21')](removeEntity(_0x388e8c,null))['catch'](handleError(_0x388e8c,null));}; \ No newline at end of file +var _0x3b55=['end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0x3b55,0xc2));var _0x53b5=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x3b55[_0x542da8];return _0x533d7e;};'use strict';var pdf=require(_0x53b5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x53b5('0x1'));var zipdir=require(_0x53b5('0x2'));var jsonpatch=require(_0x53b5('0x3'));var rp=require('request-promise');var moment=require(_0x53b5('0x4'));var BPromise=require(_0x53b5('0x5'));var Mustache=require(_0x53b5('0x6'));var util=require('util');var path=require(_0x53b5('0x7'));var sox=require('sox');var csv=require(_0x53b5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x53b5('0x9'));var squel=require(_0x53b5('0xa'));var crypto=require(_0x53b5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x53b5('0xc'));var toCsv=require(_0x53b5('0x8'));var querystring=require(_0x53b5('0xd'));var Papa=require('papaparse');var Redis=require(_0x53b5('0xe'));var authService=require(_0x53b5('0xf'));var qs=require(_0x53b5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53b5('0x11'));var logger=require('../../config/logger')(_0x53b5('0x12'));var utils=require(_0x53b5('0x13'));var config=require(_0x53b5('0x14'));var licenseUtil=require(_0x53b5('0x15'));var db=require(_0x53b5('0x16'))['db'];function respondWithStatusCode(_0x21ecc8,_0x2f2da1){_0x2f2da1=_0x2f2da1||0xcc;return function(_0x28c48a){if(_0x28c48a){return _0x21ecc8[_0x53b5('0x17')](_0x2f2da1);}return _0x21ecc8[_0x53b5('0x18')](_0x2f2da1)[_0x53b5('0x19')]();};}function respondWithResult(_0x54197a,_0x4408f8){_0x4408f8=_0x4408f8||0xc8;return function(_0x5331a4){if(_0x5331a4){return _0x54197a[_0x53b5('0x18')](_0x4408f8)['json'](_0x5331a4);}};}function respondWithFilteredResult(_0x480469,_0x1017c0){return function(_0x14e090){if(_0x14e090){var _0x2b3f2a=_0x14e090[_0x53b5('0x1a')],_0x3b5911=_0x1017c0['offset'],_0xac3d14=_0x1017c0[_0x53b5('0x1b')]+_0x1017c0[_0x53b5('0x1c')],_0x32b474;if(_0xac3d14>=_0x2b3f2a){_0xac3d14=_0x2b3f2a;_0x32b474=0xc8;}else{_0x32b474=0xce;}_0x480469[_0x53b5('0x18')](_0x32b474);return _0x480469[_0x53b5('0x1d')](_0x53b5('0x1e'),_0x3b5911+'-'+_0xac3d14+'/'+_0x2b3f2a)[_0x53b5('0x1f')](_0x14e090);}return null;};}function patchUpdates(_0x5ba339){return function(_0x1d7fba){try{jsonpatch[_0x53b5('0x20')](_0x1d7fba,_0x5ba339,!![]);}catch(_0x4cadfe){return BPromise[_0x53b5('0x21')](_0x4cadfe);}return _0x1d7fba[_0x53b5('0x22')]();};}function saveUpdates(_0x4afe68,_0x21bbe8){return function(_0x1c21a3){if(_0x1c21a3){return _0x1c21a3[_0x53b5('0x23')](_0x4afe68)[_0x53b5('0x24')](function(_0x107bcf){return _0x107bcf;});}return null;};}function removeEntity(_0x353241,_0x6335f){return function(_0x4bc0b9){if(_0x4bc0b9){return _0x4bc0b9[_0x53b5('0x25')]()[_0x53b5('0x24')](function(){_0x353241[_0x53b5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c44ad,_0x2b4bec){return function(_0x9e4d5d){if(!_0x9e4d5d){_0x5c44ad['sendStatus'](0x194);}return _0x9e4d5d;};}function handleError(_0x5eb24e,_0x2aac35){_0x2aac35=_0x2aac35||0x1f4;return function(_0x44cd71){logger[_0x53b5('0x26')](_0x44cd71[_0x53b5('0x27')]);if(_0x44cd71[_0x53b5('0x28')]){delete _0x44cd71[_0x53b5('0x28')];}_0x5eb24e[_0x53b5('0x18')](_0x2aac35)[_0x53b5('0x29')](_0x44cd71);};}exports[_0x53b5('0x2a')]=function(_0x5f367f,_0x1b3324){var _0x235d52={},_0x3a76ce={},_0x5e9d11={'count':0x0,'rows':[]};var _0x3c1c48=_[_0x53b5('0x2b')](db[_0x53b5('0x2c')][_0x53b5('0x2d')],function(_0x3fe853){return{'name':_0x3fe853['fieldName'],'type':_0x3fe853[_0x53b5('0x2e')][_0x53b5('0x2f')]};});_0x3a76ce[_0x53b5('0x30')]=_[_0x53b5('0x2b')](_0x3c1c48,_0x53b5('0x28'));_0x3a76ce[_0x53b5('0x31')]=_['keys'](_0x5f367f['query']);_0x3a76ce[_0x53b5('0x32')]=_[_0x53b5('0x33')](_0x3a76ce[_0x53b5('0x30')],_0x3a76ce[_0x53b5('0x31')]);_0x235d52['attributes']=_[_0x53b5('0x33')](_0x3a76ce[_0x53b5('0x30')],qs[_0x53b5('0x34')](_0x5f367f[_0x53b5('0x31')][_0x53b5('0x34')]));_0x235d52[_0x53b5('0x35')]=_0x235d52['attributes'][_0x53b5('0x36')]?_0x235d52[_0x53b5('0x35')]:_0x3a76ce[_0x53b5('0x30')];if(!_0x5f367f[_0x53b5('0x31')][_0x53b5('0x37')]('nolimit')){_0x235d52['limit']=qs[_0x53b5('0x1c')](_0x5f367f[_0x53b5('0x31')][_0x53b5('0x1c')]);_0x235d52[_0x53b5('0x1b')]=qs['offset'](_0x5f367f[_0x53b5('0x31')]['offset']);}_0x235d52[_0x53b5('0x38')]=qs[_0x53b5('0x39')](_0x5f367f['query']['sort']);_0x235d52[_0x53b5('0x3a')]=qs[_0x53b5('0x32')](_['pick'](_0x5f367f[_0x53b5('0x31')],_0x3a76ce[_0x53b5('0x32')]),_0x3c1c48);if(_0x5f367f['query']['filter']){_0x235d52['where']=_['merge'](_0x235d52[_0x53b5('0x3a')],{'$or':_[_0x53b5('0x2b')](_0x3c1c48,function(_0x16c893){if(_0x16c893[_0x53b5('0x2e')]!==_0x53b5('0x3b')){var _0x348f1e={};_0x348f1e[_0x16c893['name']]={'$like':'%'+_0x5f367f['query']['filter']+'%'};return _0x348f1e;}})});}_0x235d52=_[_0x53b5('0x3c')]({},_0x235d52,_0x5f367f[_0x53b5('0x3d')]);var _0x308097={'where':_0x235d52[_0x53b5('0x3a')]};return db[_0x53b5('0x2c')]['count'](_0x308097)[_0x53b5('0x24')](function(_0x36e2f9){_0x5e9d11[_0x53b5('0x1a')]=_0x36e2f9;if(_0x5f367f[_0x53b5('0x31')][_0x53b5('0x3e')]){_0x235d52[_0x53b5('0x3f')]=[{'all':!![]}];}return db[_0x53b5('0x2c')][_0x53b5('0x40')](_0x235d52);})[_0x53b5('0x24')](function(_0x1acd2b){_0x5e9d11[_0x53b5('0x41')]=_0x1acd2b;return _0x5e9d11;})[_0x53b5('0x24')](respondWithFilteredResult(_0x1b3324,_0x235d52))[_0x53b5('0x42')](handleError(_0x1b3324,null));};exports[_0x53b5('0x43')]=function(_0x436b2d,_0x1b00c9){var _0x3b6246={'raw':!![],'where':{'id':_0x436b2d[_0x53b5('0x44')]['id']}},_0x347787={};_0x347787[_0x53b5('0x30')]=_[_0x53b5('0x45')](db['Dynamics365Field'][_0x53b5('0x2d')]);_0x347787[_0x53b5('0x31')]=_[_0x53b5('0x45')](_0x436b2d['query']);_0x347787['filters']=_['intersection'](_0x347787[_0x53b5('0x30')],_0x347787['query']);_0x3b6246['attributes']=_[_0x53b5('0x33')](_0x347787[_0x53b5('0x30')],qs[_0x53b5('0x34')](_0x436b2d['query'][_0x53b5('0x34')]));_0x3b6246[_0x53b5('0x35')]=_0x3b6246[_0x53b5('0x35')][_0x53b5('0x36')]?_0x3b6246['attributes']:_0x347787['model'];if(_0x436b2d[_0x53b5('0x31')][_0x53b5('0x3e')]){_0x3b6246[_0x53b5('0x3f')]=[{'all':!![]}];}_0x3b6246=_[_0x53b5('0x3c')]({},_0x3b6246,_0x436b2d[_0x53b5('0x3d')]);return db[_0x53b5('0x2c')][_0x53b5('0x46')](_0x3b6246)[_0x53b5('0x24')](handleEntityNotFound(_0x1b00c9,null))[_0x53b5('0x24')](respondWithResult(_0x1b00c9,null))[_0x53b5('0x42')](handleError(_0x1b00c9,null));};exports['create']=function(_0x67b02d,_0x3c66c2){return db['Dynamics365Field'][_0x53b5('0x47')](_0x67b02d[_0x53b5('0x48')],{})[_0x53b5('0x24')](respondWithResult(_0x3c66c2,0xc9))[_0x53b5('0x42')](handleError(_0x3c66c2,null));};exports[_0x53b5('0x23')]=function(_0x5c26ee,_0x43251c){if(_0x5c26ee['body']['id']){delete _0x5c26ee['body']['id'];}return db[_0x53b5('0x2c')][_0x53b5('0x46')]({'where':{'id':_0x5c26ee[_0x53b5('0x44')]['id']}})[_0x53b5('0x24')](handleEntityNotFound(_0x43251c,null))[_0x53b5('0x24')](saveUpdates(_0x5c26ee[_0x53b5('0x48')],null))[_0x53b5('0x24')](respondWithResult(_0x43251c,null))['catch'](handleError(_0x43251c,null));};exports[_0x53b5('0x25')]=function(_0x508fd5,_0x1f6c96){return db['Dynamics365Field']['find']({'where':{'id':_0x508fd5[_0x53b5('0x44')]['id']}})[_0x53b5('0x24')](handleEntityNotFound(_0x1f6c96,null))['then'](removeEntity(_0x1f6c96,null))[_0x53b5('0x42')](handleError(_0x1f6c96,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5af7fe6..fd50b27 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 _0x87d5=['dynamics365_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_dynamics365_fields'];(function(_0x12f7a4,_0x2b3c43){var _0x5a4e93=function(_0x45612a){while(--_0x45612a){_0x12f7a4['push'](_0x12f7a4['shift']());}};_0x5a4e93(++_0x2b3c43);}(_0x87d5,0xf3));var _0x587d=function(_0x1b8f91,_0x40edb4){_0x1b8f91=_0x1b8f91-0x0;var _0x486299=_0x87d5[_0x1b8f91];return _0x486299;};'use strict';var _=require(_0x587d('0x0'));var util=require(_0x587d('0x1'));var logger=require('../../config/logger')(_0x587d('0x2'));var moment=require(_0x587d('0x3'));var BPromise=require(_0x587d('0x4'));var rp=require(_0x587d('0x5'));var fs=require('fs');var path=require(_0x587d('0x6'));var rimraf=require(_0x587d('0x7'));var config=require(_0x587d('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0x587d('0x9')]=function(_0x1e012c,_0x4a776c){return _0x1e012c[_0x587d('0xa')]('Dynamics365Field',attributes,{'tableName':_0x587d('0xb'),'paranoid':![],'indexes':[{'name':_0x587d('0xc'),'fields':[_0x587d('0xd'),_0x587d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5482=['define','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x1652c9,_0x4cb5f5){var _0x387cf7=function(_0x3cc7bd){while(--_0x3cc7bd){_0x1652c9['push'](_0x1652c9['shift']());}};_0x387cf7(++_0x4cb5f5);}(_0x5482,0x1e0));var _0x2548=function(_0x4496c1,_0x103294){_0x4496c1=_0x4496c1-0x0;var _0xa2da11=_0x5482[_0x4496c1];return _0xa2da11;};'use strict';var _=require(_0x2548('0x0'));var util=require(_0x2548('0x1'));var logger=require(_0x2548('0x2'))(_0x2548('0x3'));var moment=require(_0x2548('0x4'));var BPromise=require(_0x2548('0x5'));var rp=require(_0x2548('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2548('0x7'));var config=require(_0x2548('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0x2548('0x9')]=function(_0x42841e,_0x5f466e){return _0x42841e[_0x2548('0xa')]('Dynamics365Field',attributes,{'tableName':_0x2548('0xb'),'paranoid':![],'indexes':[{'name':_0x2548('0xc'),'fields':[_0x2548('0xd'),'FieldId'],'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 f3e7295..a60957f 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 _0x6333=['../../config/environment','jayson/promise','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x434c8d,_0x3300c7){var _0x534d73=function(_0x57925b){while(--_0x57925b){_0x434c8d['push'](_0x434c8d['shift']());}};_0x534d73(++_0x3300c7);}(_0x6333,0x83));var _0x3633=function(_0x3fb334,_0x3665b2){_0x3fb334=_0x3fb334-0x0;var _0x27b29a=_0x6333[_0x3fb334];return _0x27b29a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3633('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3633('0x1'));var db=require(_0x3633('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3633('0x3'))('rpc');var config=require(_0x3633('0x4'));var jayson=require(_0x3633('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23c014,_0x1c4c20,_0x272da5){return new BPromise(function(_0x5c35ba,_0x5b5055){return client[_0x3633('0x6')](_0x23c014,_0x272da5)['then'](function(_0x4ee8e3){logger[_0x3633('0x7')](_0x3633('0x8'),_0x1c4c20,_0x3633('0x9'));logger['debug'](_0x3633('0xa'),_0x1c4c20,_0x3633('0x9'),JSON['stringify'](_0x4ee8e3));if(_0x4ee8e3['error']){if(_0x4ee8e3[_0x3633('0xb')]['code']===0x1f4){logger['error'](_0x3633('0x8'),_0x1c4c20,_0x4ee8e3[_0x3633('0xb')][_0x3633('0xc')]);return _0x5b5055(_0x4ee8e3[_0x3633('0xb')][_0x3633('0xc')]);}logger['error'](_0x3633('0x8'),_0x1c4c20,_0x4ee8e3[_0x3633('0xb')][_0x3633('0xc')]);return _0x5c35ba(_0x4ee8e3[_0x3633('0xb')]['message']);}else{logger['info'](_0x3633('0x8'),_0x1c4c20,_0x3633('0x9'));_0x5c35ba(_0x4ee8e3[_0x3633('0xd')][_0x3633('0xc')]);}})[_0x3633('0xe')](function(_0x3b0fd7){logger['error'](_0x3633('0x8'),_0x1c4c20,_0x3b0fd7);_0x5b5055(_0x3b0fd7);});});} \ No newline at end of file +var _0xf0f4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x254722,_0x5896d6){var _0x4086b4=function(_0x35e567){while(--_0x35e567){_0x254722['push'](_0x254722['shift']());}};_0x4086b4(++_0x5896d6);}(_0xf0f4,0x182));var _0x4f0f=function(_0x5e7208,_0x3b9f32){_0x5e7208=_0x5e7208-0x0;var _0x3bc76a=_0xf0f4[_0x5e7208];return _0x3bc76a;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47faf5,_0x39ad76,_0x1dd6bd){return new BPromise(function(_0x95b1cf,_0x5da92f){return client[_0x4f0f('0xa')](_0x47faf5,_0x1dd6bd)[_0x4f0f('0xb')](function(_0x19cecb){logger[_0x4f0f('0xc')](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));logger[_0x4f0f('0xf')](_0x4f0f('0x10'),_0x39ad76,'request\x20sent',JSON[_0x4f0f('0x11')](_0x19cecb));if(_0x19cecb[_0x4f0f('0x12')]){if(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x13')]===0x1f4){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x5da92f(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}logger[_0x4f0f('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x95b1cf(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}else{logger['info'](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));_0x95b1cf(_0x19cecb[_0x4f0f('0x15')][_0x4f0f('0x14')]);}})[_0x4f0f('0x16')](function(_0x5f171b){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x5f171b);_0x5da92f(_0x5f171b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 255f6bd..e90b341 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 _0x19fd=['post','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x1a20ec,_0x27626c){var _0x3a2ec1=function(_0xb45d54){while(--_0xb45d54){_0x1a20ec['push'](_0x1a20ec['shift']());}};_0x3a2ec1(++_0x27626c);}(_0x19fd,0x17b));var _0xd19f=function(_0x157627,_0x47fa1b){_0x157627=_0x157627-0x0;var _0x468a28=_0x19fd[_0x157627];return _0x468a28;};'use strict';var multer=require(_0xd19f('0x0'));var util=require(_0xd19f('0x1'));var path=require(_0xd19f('0x2'));var timeout=require(_0xd19f('0x3'));var express=require(_0xd19f('0x4'));var router=express[_0xd19f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd19f('0x6'));var config=require(_0xd19f('0x7'));var controller=require(_0xd19f('0x8'));router[_0xd19f('0x9')]('/',auth[_0xd19f('0xa')](),controller['index']);router[_0xd19f('0x9')](_0xd19f('0xb'),auth['isAuthenticated'](),controller[_0xd19f('0xc')]);router[_0xd19f('0x9')](_0xd19f('0xd'),auth[_0xd19f('0xa')](),controller[_0xd19f('0xe')]);router[_0xd19f('0x9')](_0xd19f('0xf'),auth[_0xd19f('0xa')](),controller['getFields']);router['post']('/',auth[_0xd19f('0xa')](),controller[_0xd19f('0x10')]);router[_0xd19f('0x11')]('/:id/configurations',auth[_0xd19f('0xa')](),controller[_0xd19f('0x12')]);router['put'](_0xd19f('0xb'),auth['isAuthenticated'](),controller[_0xd19f('0x13')]);router[_0xd19f('0x14')](_0xd19f('0xb'),auth[_0xd19f('0xa')](),controller[_0xd19f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x143a=['./intFreshdeskAccount.controller','index','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0x143a,0x6c));var _0xa143=function(_0x37d76d,_0x57d3ed){_0x37d76d=_0x37d76d-0x0;var _0x424fe8=_0x143a[_0x37d76d];return _0x424fe8;};'use strict';var multer=require(_0xa143('0x0'));var util=require(_0xa143('0x1'));var path=require('path');var timeout=require(_0xa143('0x2'));var express=require(_0xa143('0x3'));var router=express[_0xa143('0x4')]();var auth=require(_0xa143('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa143('0x6'));var controller=require(_0xa143('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa143('0x8')]);router[_0xa143('0x9')](_0xa143('0xa'),auth[_0xa143('0xb')](),controller[_0xa143('0xc')]);router['get']('/:id/configurations',auth[_0xa143('0xb')](),controller[_0xa143('0xd')]);router['get'](_0xa143('0xe'),auth['isAuthenticated'](),controller[_0xa143('0xf')]);router[_0xa143('0x10')]('/',auth[_0xa143('0xb')](),controller[_0xa143('0x11')]);router['post'](_0xa143('0x12'),auth[_0xa143('0xb')](),controller[_0xa143('0x13')]);router['put'](_0xa143('0xa'),auth[_0xa143('0xb')](),controller['update']);router[_0xa143('0x14')](_0xa143('0xa'),auth[_0xa143('0xb')](),controller[_0xa143('0x15')]);module[_0xa143('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index f692325..1229abe 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 _0x3e30=['exports','STRING','username','remoteUri'];(function(_0x54b305,_0x3f7821){var _0x249102=function(_0x471520){while(--_0x471520){_0x54b305['push'](_0x54b305['shift']());}};_0x249102(++_0x3f7821);}(_0x3e30,0x15c));var _0x03e3=function(_0x1664ba,_0x4029b4){_0x1664ba=_0x1664ba-0x0;var _0x231115=_0x3e30[_0x1664ba];return _0x231115;};'use strict';var Sequelize=require('sequelize');module[_0x03e3('0x0')]={'name':{'type':Sequelize[_0x03e3('0x1')]},'description':{'type':Sequelize[_0x03e3('0x1')]},'username':{'type':Sequelize[_0x03e3('0x1')],'unique':_0x03e3('0x2')},'apiKey':{'type':Sequelize[_0x03e3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x03e3('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd2b8=['remoteUri','exports','STRING'];(function(_0x196172,_0x8c0de4){var _0x2fc859=function(_0x1af24b){while(--_0x1af24b){_0x196172['push'](_0x196172['shift']());}};_0x2fc859(++_0x8c0de4);}(_0xd2b8,0x190));var _0x8d2b=function(_0x5e3c53,_0xca9ab7){_0x5e3c53=_0x5e3c53-0x0;var _0x28f2f1=_0xd2b8[_0x5e3c53];return _0x28f2f1;};'use strict';var Sequelize=require('sequelize');module[_0x8d2b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d2b('0x1')]},'username':{'type':Sequelize[_0x8d2b('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0x8d2b('0x1')]},'remoteUri':{'type':Sequelize[_0x8d2b('0x1')],'unique':_0x8d2b('0x2')},'serverUrl':{'type':Sequelize[_0x8d2b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 0f1ec6a..53beb1d 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 _0xff76=['group','source','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','rows','show','params','length','include','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','sort','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri','substring','GET','format','%s:X','requester','subject','priority'];(function(_0x27f9d3,_0x54ee48){var _0x1d2c10=function(_0x591eae){while(--_0x591eae){_0x27f9d3['push'](_0x27f9d3['shift']());}};_0x1d2c10(++_0x54ee48);}(_0xff76,0xf6));var _0x6ff7=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xff76[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require(_0x6ff7('0x0'));var emlformat=require(_0x6ff7('0x1'));var rimraf=require(_0x6ff7('0x2'));var zipdir=require(_0x6ff7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ff7('0x4'));var moment=require(_0x6ff7('0x5'));var BPromise=require(_0x6ff7('0x6'));var Mustache=require(_0x6ff7('0x7'));var util=require(_0x6ff7('0x8'));var path=require(_0x6ff7('0x9'));var sox=require('sox');var csv=require(_0x6ff7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6ff7('0xb'));var squel=require('squel');var crypto=require(_0x6ff7('0xc'));var jsforce=require(_0x6ff7('0xd'));var deskjs=require(_0x6ff7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ff7('0xf'));var Papa=require(_0x6ff7('0x10'));var Redis=require(_0x6ff7('0x11'));var authService=require(_0x6ff7('0x12'));var qs=require(_0x6ff7('0x13'));var as=require(_0x6ff7('0x14'));var hardwareService=require(_0x6ff7('0x15'));var logger=require(_0x6ff7('0x16'))(_0x6ff7('0x17'));var utils=require('../../config/utils');var config=require(_0x6ff7('0x18'));var licenseUtil=require(_0x6ff7('0x19'));var db=require(_0x6ff7('0x1a'))['db'];var integrations=require(_0x6ff7('0x1b'));var jayson=require(_0x6ff7('0x1c'));var client=jayson[_0x6ff7('0x1d')][_0x6ff7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x49da13,_0x3ee507,_0x2f25c3,_0x151150){return new BPromise(function(_0x11ec60,_0x432d2b){var _0x3518ea=_0x151150||client;return _0x3518ea['request'](_0x49da13,_0x2f25c3)[_0x6ff7('0x1f')](function(_0x26421a){logger[_0x6ff7('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x3ee507,'request\x20sent');logger[_0x6ff7('0x21')](_0x6ff7('0x22'),_0x3ee507,'request\x20sent',JSON[_0x6ff7('0x23')](_0x26421a));if(_0x26421a['error']){if(_0x26421a[_0x6ff7('0x24')][_0x6ff7('0x25')]===0x1f4){logger[_0x6ff7('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x3ee507,_0x26421a[_0x6ff7('0x24')][_0x6ff7('0x26')]);return _0x432d2b(_0x26421a[_0x6ff7('0x24')][_0x6ff7('0x26')]);}logger[_0x6ff7('0x24')](_0x6ff7('0x27'),_0x3ee507,_0x26421a[_0x6ff7('0x24')][_0x6ff7('0x26')]);return _0x11ec60(_0x26421a[_0x6ff7('0x24')][_0x6ff7('0x26')]);}else{logger[_0x6ff7('0x20')](_0x6ff7('0x27'),_0x3ee507,'request\x20sent');_0x11ec60(_0x26421a['result'][_0x6ff7('0x26')]);}})[_0x6ff7('0x28')](function(_0x5d18b){logger[_0x6ff7('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x3ee507,_0x5d18b);_0x432d2b(_0x5d18b);});});}function respondWithStatusCode(_0x2fd7e8,_0x396055){_0x396055=_0x396055||0xcc;return function(_0x17901e){if(_0x17901e){return _0x2fd7e8[_0x6ff7('0x29')](_0x396055);}return _0x2fd7e8[_0x6ff7('0x2a')](_0x396055)[_0x6ff7('0x2b')]();};}function respondWithResult(_0x441677,_0x519cc9){_0x519cc9=_0x519cc9||0xc8;return function(_0x7cee87){if(_0x7cee87){return _0x441677['status'](_0x519cc9)['json'](_0x7cee87);}};}function respondWithFilteredResult(_0x55047b,_0x101faf){return function(_0x91c07e){if(_0x91c07e){var _0x533e86=_0x91c07e[_0x6ff7('0x2c')],_0x4d4aeb=_0x101faf[_0x6ff7('0x2d')],_0x401e08=_0x101faf[_0x6ff7('0x2d')]+_0x101faf[_0x6ff7('0x2e')],_0x4f0c98;if(_0x401e08>=_0x533e86){_0x401e08=_0x533e86;_0x4f0c98=0xc8;}else{_0x4f0c98=0xce;}_0x55047b[_0x6ff7('0x2a')](_0x4f0c98);return _0x55047b[_0x6ff7('0x2f')](_0x6ff7('0x30'),_0x4d4aeb+'-'+_0x401e08+'/'+_0x533e86)[_0x6ff7('0x31')](_0x91c07e);}return null;};}function patchUpdates(_0x1a97a7){return function(_0x5925c5){try{jsonpatch[_0x6ff7('0x32')](_0x5925c5,_0x1a97a7,!![]);}catch(_0x137026){return BPromise['reject'](_0x137026);}return _0x5925c5['save']();};}function saveUpdates(_0x12b5cc,_0x34d459){return function(_0x42b9de){if(_0x42b9de){return _0x42b9de[_0x6ff7('0x33')](_0x12b5cc)['then'](function(_0x258493){return _0x258493;});}return null;};}function removeEntity(_0x18dfb3,_0x1d4b57){return function(_0x29704a){if(_0x29704a){return _0x29704a[_0x6ff7('0x34')]()['then'](function(){_0x18dfb3['status'](0xcc)[_0x6ff7('0x2b')]();});}};}function handleEntityNotFound(_0x1d4c82,_0x4fde7d){return function(_0x55a589){if(!_0x55a589){_0x1d4c82[_0x6ff7('0x29')](0x194);}return _0x55a589;};}function handleError(_0x2c8a71,_0x2aec73){_0x2aec73=_0x2aec73||0x1f4;return function(_0x2d169a){logger[_0x6ff7('0x24')](_0x2d169a[_0x6ff7('0x35')]);if(_0x2d169a[_0x6ff7('0x36')]){delete _0x2d169a[_0x6ff7('0x36')];}_0x2c8a71['status'](_0x2aec73)[_0x6ff7('0x37')](_0x2d169a);};}exports['index']=function(_0x231954,_0x36f500){var _0x310115={},_0x445a45={},_0x1c5556={'count':0x0,'rows':[]};var _0x3d4bbc=_[_0x6ff7('0x38')](db[_0x6ff7('0x39')][_0x6ff7('0x3a')],function(_0x5bf55d){return{'name':_0x5bf55d[_0x6ff7('0x3b')],'type':_0x5bf55d[_0x6ff7('0x3c')]['key']};});_0x445a45[_0x6ff7('0x3d')]=_[_0x6ff7('0x38')](_0x3d4bbc,_0x6ff7('0x36'));_0x445a45[_0x6ff7('0x3e')]=_[_0x6ff7('0x3f')](_0x231954[_0x6ff7('0x3e')]);_0x445a45['filters']=_[_0x6ff7('0x40')](_0x445a45[_0x6ff7('0x3d')],_0x445a45[_0x6ff7('0x3e')]);_0x310115[_0x6ff7('0x41')]=_['intersection'](_0x445a45[_0x6ff7('0x3d')],qs[_0x6ff7('0x42')](_0x231954[_0x6ff7('0x3e')]['fields']));_0x310115['attributes']=_0x310115[_0x6ff7('0x41')]['length']?_0x310115[_0x6ff7('0x41')]:_0x445a45[_0x6ff7('0x3d')];if(!_0x231954[_0x6ff7('0x3e')]['hasOwnProperty'](_0x6ff7('0x43'))){_0x310115['limit']=qs[_0x6ff7('0x2e')](_0x231954[_0x6ff7('0x3e')][_0x6ff7('0x2e')]);_0x310115[_0x6ff7('0x2d')]=qs[_0x6ff7('0x2d')](_0x231954[_0x6ff7('0x3e')][_0x6ff7('0x2d')]);}_0x310115[_0x6ff7('0x44')]=qs['sort'](_0x231954['query']['sort']);_0x310115['where']=qs[_0x6ff7('0x45')](_[_0x6ff7('0x46')](_0x231954[_0x6ff7('0x3e')],_0x445a45[_0x6ff7('0x45')]),_0x3d4bbc);if(_0x231954['query'][_0x6ff7('0x47')]){_0x310115[_0x6ff7('0x48')]=_[_0x6ff7('0x49')](_0x310115[_0x6ff7('0x48')],{'$or':_[_0x6ff7('0x38')](_0x3d4bbc,function(_0x198f89){if(_0x198f89[_0x6ff7('0x3c')]!==_0x6ff7('0x4a')){var _0xea9a31={};_0xea9a31[_0x198f89[_0x6ff7('0x36')]]={'$like':'%'+_0x231954[_0x6ff7('0x3e')][_0x6ff7('0x47')]+'%'};return _0xea9a31;}})});}_0x310115=_[_0x6ff7('0x49')]({},_0x310115,_0x231954['options']);var _0x1569ce={'where':_0x310115[_0x6ff7('0x48')]};return db[_0x6ff7('0x39')][_0x6ff7('0x2c')](_0x1569ce)['then'](function(_0x1000ef){_0x1c5556['count']=_0x1000ef;if(_0x231954[_0x6ff7('0x3e')][_0x6ff7('0x4b')]){_0x310115['include']=[{'all':!![]}];}return db[_0x6ff7('0x39')]['findAll'](_0x310115);})[_0x6ff7('0x1f')](function(_0x7d403a){_0x1c5556[_0x6ff7('0x4c')]=_0x7d403a;return _0x1c5556;})['then'](respondWithFilteredResult(_0x36f500,_0x310115))['catch'](handleError(_0x36f500,null));};exports[_0x6ff7('0x4d')]=function(_0xa4b428,_0x3c3b54){var _0xb0378b={'raw':![],'where':{'id':_0xa4b428[_0x6ff7('0x4e')]['id']}},_0x9bc11a={};_0x9bc11a[_0x6ff7('0x3d')]=_[_0x6ff7('0x3f')](db['FreshdeskAccount'][_0x6ff7('0x3a')]);_0x9bc11a['query']=_[_0x6ff7('0x3f')](_0xa4b428['query']);_0x9bc11a[_0x6ff7('0x45')]=_[_0x6ff7('0x40')](_0x9bc11a['model'],_0x9bc11a['query']);_0xb0378b[_0x6ff7('0x41')]=_[_0x6ff7('0x40')](_0x9bc11a[_0x6ff7('0x3d')],qs[_0x6ff7('0x42')](_0xa4b428[_0x6ff7('0x3e')][_0x6ff7('0x42')]));_0xb0378b[_0x6ff7('0x41')]=_0xb0378b[_0x6ff7('0x41')][_0x6ff7('0x4f')]?_0xb0378b[_0x6ff7('0x41')]:_0x9bc11a[_0x6ff7('0x3d')];if(_0xa4b428[_0x6ff7('0x3e')][_0x6ff7('0x4b')]){_0xb0378b[_0x6ff7('0x50')]=[{'all':!![]}];}_0xb0378b=_[_0x6ff7('0x49')]({},_0xb0378b,_0xa4b428[_0x6ff7('0x51')]);return db[_0x6ff7('0x39')][_0x6ff7('0x52')](_0xb0378b)[_0x6ff7('0x1f')](handleEntityNotFound(_0x3c3b54,null))[_0x6ff7('0x1f')](respondWithResult(_0x3c3b54,null))['catch'](handleError(_0x3c3b54,null));};exports[_0x6ff7('0x53')]=function(_0x3120a5,_0x360425){return db[_0x6ff7('0x39')][_0x6ff7('0x53')](_0x3120a5['body'],{})[_0x6ff7('0x1f')](respondWithResult(_0x360425,0xc9))[_0x6ff7('0x28')](handleError(_0x360425,null));};exports[_0x6ff7('0x33')]=function(_0x517870,_0x255bda){if(_0x517870[_0x6ff7('0x54')]['id']){delete _0x517870[_0x6ff7('0x54')]['id'];}return db[_0x6ff7('0x39')][_0x6ff7('0x52')]({'where':{'id':_0x517870[_0x6ff7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x255bda,null))[_0x6ff7('0x1f')](saveUpdates(_0x517870[_0x6ff7('0x54')],null))[_0x6ff7('0x1f')](respondWithResult(_0x255bda,null))[_0x6ff7('0x28')](handleError(_0x255bda,null));};exports[_0x6ff7('0x34')]=function(_0x25ef65,_0x32f6b4){return db['FreshdeskAccount']['find']({'where':{'id':_0x25ef65[_0x6ff7('0x4e')]['id']}})[_0x6ff7('0x1f')](handleEntityNotFound(_0x32f6b4,null))[_0x6ff7('0x1f')](removeEntity(_0x32f6b4,null))['catch'](handleError(_0x32f6b4,null));};exports[_0x6ff7('0x55')]=function(_0x127288,_0x37c7dd,_0x4bda6e){var _0x49fc43={};var _0x224ee2={};var _0x35e228;var _0x5a268a;return db[_0x6ff7('0x39')][_0x6ff7('0x56')]({'where':{'id':_0x127288[_0x6ff7('0x4e')]['id']}})[_0x6ff7('0x1f')](handleEntityNotFound(_0x37c7dd,null))[_0x6ff7('0x1f')](function(_0x2adbf0){if(_0x2adbf0){_0x35e228=_0x2adbf0;_0x224ee2[_0x6ff7('0x3d')]=_['keys'](db[_0x6ff7('0x57')][_0x6ff7('0x3a')]);_0x224ee2[_0x6ff7('0x3e')]=_[_0x6ff7('0x3f')](_0x127288['query']);_0x224ee2[_0x6ff7('0x45')]=_[_0x6ff7('0x40')](_0x224ee2[_0x6ff7('0x3d')],_0x224ee2[_0x6ff7('0x3e')]);_0x49fc43[_0x6ff7('0x41')]=_[_0x6ff7('0x40')](_0x224ee2['model'],qs[_0x6ff7('0x42')](_0x127288[_0x6ff7('0x3e')]['fields']));_0x49fc43['attributes']=_0x49fc43['attributes'][_0x6ff7('0x4f')]?_0x49fc43[_0x6ff7('0x41')]:_0x224ee2[_0x6ff7('0x3d')];_0x49fc43[_0x6ff7('0x44')]=qs[_0x6ff7('0x58')](_0x127288[_0x6ff7('0x3e')][_0x6ff7('0x58')]);_0x49fc43['where']=qs[_0x6ff7('0x45')](_[_0x6ff7('0x46')](_0x127288[_0x6ff7('0x3e')],_0x224ee2[_0x6ff7('0x45')]));if(_0x127288[_0x6ff7('0x3e')]['filter']){_0x49fc43[_0x6ff7('0x48')]=_[_0x6ff7('0x49')](_0x49fc43[_0x6ff7('0x48')],{'$or':_[_0x6ff7('0x38')](_0x49fc43[_0x6ff7('0x41')],function(_0x38652c){var _0x54303d={};_0x54303d[_0x38652c]={'$like':'%'+_0x127288['query'][_0x6ff7('0x47')]+'%'};return _0x54303d;})});}_0x49fc43=_[_0x6ff7('0x49')]({},_0x49fc43,_0x127288[_0x6ff7('0x51')]);return _0x35e228[_0x6ff7('0x55')](_0x49fc43);}})[_0x6ff7('0x1f')](function(_0x4158e7){if(_0x4158e7){_0x5a268a=_0x4158e7[_0x6ff7('0x4f')];if(!_0x127288[_0x6ff7('0x3e')]['hasOwnProperty'](_0x6ff7('0x43'))){_0x49fc43[_0x6ff7('0x2e')]=qs[_0x6ff7('0x2e')](_0x127288['query'][_0x6ff7('0x2e')]);_0x49fc43[_0x6ff7('0x2d')]=qs[_0x6ff7('0x2d')](_0x127288[_0x6ff7('0x3e')]['offset']);}return _0x35e228[_0x6ff7('0x55')](_0x49fc43);}})[_0x6ff7('0x1f')](function(_0x12343f){if(_0x12343f){return _0x12343f?{'count':_0x5a268a,'rows':_0x12343f}:null;}})[_0x6ff7('0x1f')](respondWithResult(_0x37c7dd,null))[_0x6ff7('0x28')](handleError(_0x37c7dd,null));};exports[_0x6ff7('0x59')]=function(_0x3fbeb6,_0x2fc295,_0x344580){if(_0x3fbeb6[_0x6ff7('0x54')]['id']){delete _0x3fbeb6['body']['id'];}return db[_0x6ff7('0x39')]['findOne']({'where':{'id':_0x3fbeb6[_0x6ff7('0x4e')]['id']}})[_0x6ff7('0x1f')](handleEntityNotFound(_0x2fc295,null))[_0x6ff7('0x1f')](function(_0x2ad67c){if(_0x2ad67c){_0x3fbeb6[_0x6ff7('0x54')]['AccountId']=_0x2ad67c['id'];_0x3fbeb6[_0x6ff7('0x54')][_0x6ff7('0x5a')]=integrations[_0x6ff7('0x5b')](_0x3fbeb6[_0x6ff7('0x54')]['channel'],_0x3fbeb6[_0x6ff7('0x54')][_0x6ff7('0x3c')]);_0x3fbeb6[_0x6ff7('0x54')][_0x6ff7('0x5c')]=integrations[_0x6ff7('0x5d')](_0x3fbeb6['body'][_0x6ff7('0x5e')],_0x3fbeb6['body'][_0x6ff7('0x3c')]);return db[_0x6ff7('0x57')][_0x6ff7('0x53')](_0x3fbeb6['body'],{'include':[{'model':db[_0x6ff7('0x5f')],'as':_0x6ff7('0x5a')},{'model':db[_0x6ff7('0x5f')],'as':_0x6ff7('0x5c')}]});}return null;})['then'](respondWithResult(_0x2fc295,null))[_0x6ff7('0x28')](handleError(_0x2fc295,null));};exports[_0x6ff7('0x60')]=function(_0x2e042d,_0x4d7a83,_0x2adaa4){var _0x13a015='';return db[_0x6ff7('0x39')]['findOne']({'where':{'id':_0x2e042d['params']['id']},'attributes':['id',_0x6ff7('0x61'),'apiKey']})[_0x6ff7('0x1f')](handleEntityNotFound(_0x4d7a83,null))[_0x6ff7('0x1f')](function(_0x38550a){if(_0x38550a){_0x13a015=_0x38550a['remoteUri'];var _0xa7bbe8=_0x13a015['slice'](-0x1);if(_0xa7bbe8==='/'){_0x13a015=_0x13a015[_0x6ff7('0x62')](0x0,_0x13a015['lastIndexOf'](_0xa7bbe8));}return rp({'method':_0x6ff7('0x63'),'uri':util['format']('%s/%s',_0x13a015,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x6ff7('0x64')]('Basic\x20%s',new Buffer(util[_0x6ff7('0x64')](_0x6ff7('0x65'),_0x38550a['apiKey']))['toString']('base64'))},'json':!![]});}})[_0x6ff7('0x1f')](function(_0x2e6e0f){if(_0x2e6e0f){var _0x243c02=[_0x6ff7('0x66'),_0x6ff7('0x67'),'agent','description','status',_0x6ff7('0x68'),_0x6ff7('0x69'),_0x6ff7('0x6a'),'ticket_type',_0x6ff7('0x69'),_0x6ff7('0x6b')];_['remove'](_0x2e6e0f,function(_0x2daff2){return _0x243c02[_0x6ff7('0x6c')](_0x2daff2['name'])||!_0x2daff2[_0x6ff7('0x6d')]&&_0x2daff2[_0x6ff7('0x3c')]!=='custom_text'&&_0x2daff2[_0x6ff7('0x3c')]!==_0x6ff7('0x6e');});return{'count':_0x2e6e0f[_0x6ff7('0x4f')],'rows':_['map'](_0x2e6e0f,function(_0x35005b){return{'id':_0x35005b[_0x6ff7('0x36')],'name':_0x35005b[_0x6ff7('0x6f')],'custom':!_0x35005b[_0x6ff7('0x6d')],'options':_0x35005b[_0x6ff7('0x70')]?_[_0x6ff7('0x38')](_0x35005b[_0x6ff7('0x70')],function(_0x1a56aa){return{'name':_[_0x6ff7('0x71')](_0x1a56aa),'value':_0x1a56aa};}):[]};})};}})[_0x6ff7('0x1f')](respondWithResult(_0x4d7a83,null))[_0x6ff7('0x28')](function(_0x62fb21){var _0x288eec=_0x2e042d[_0x6ff7('0x3e')][_0x6ff7('0x72')]?0x1f4:_0x62fb21[_0x6ff7('0x73')]||0x1f4;logger[_0x6ff7('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x6ff7('0x60'),_0x288eec,JSON['stringify'](_0x62fb21));delete _0x62fb21['name'];if(_0x288eec===0x191){_0x288eec=0x190;}_0x4d7a83[_0x6ff7('0x2a')](_0x288eec)[_0x6ff7('0x37')](_0x2e042d['query']['test']?{'message':_0x6ff7('0x74'),'statusCode':_0x62fb21[_0x6ff7('0x73')]}:_0x62fb21);});}; \ No newline at end of file +var _0xa5ed=['fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','findAll','show','params','create','body','find','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','set','apply','reject','save','update','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0xa5ed,0xb6));var _0xda5e=function(_0x382f20,_0x22cadd){_0x382f20=_0x382f20-0x0;var _0x321e38=_0xa5ed[_0x382f20];return _0x321e38;};'use strict';var pdf=require(_0xda5e('0x0'));var emlformat=require(_0xda5e('0x1'));var rimraf=require(_0xda5e('0x2'));var zipdir=require(_0xda5e('0x3'));var jsonpatch=require(_0xda5e('0x4'));var rp=require(_0xda5e('0x5'));var moment=require(_0xda5e('0x6'));var BPromise=require(_0xda5e('0x7'));var Mustache=require(_0xda5e('0x8'));var util=require(_0xda5e('0x9'));var path=require(_0xda5e('0xa'));var sox=require(_0xda5e('0xb'));var csv=require(_0xda5e('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda5e('0xd'));var squel=require(_0xda5e('0xe'));var crypto=require(_0xda5e('0xf'));var jsforce=require(_0xda5e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xda5e('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xda5e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xda5e('0x12'));var as=require(_0xda5e('0x13'));var hardwareService=require(_0xda5e('0x14'));var logger=require(_0xda5e('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xda5e('0x16'));var client=jayson[_0xda5e('0x17')][_0xda5e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x8420ae,_0x110167,_0x2a462e,_0x41740b){return new BPromise(function(_0x1f4046,_0x470811){var _0x545c46=_0x41740b||client;return _0x545c46[_0xda5e('0x19')](_0x8420ae,_0x2a462e)[_0xda5e('0x1a')](function(_0x3ccea4){logger['info'](_0xda5e('0x1b'),_0x110167,_0xda5e('0x1c'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x110167,'request\x20sent',JSON[_0xda5e('0x1d')](_0x3ccea4));if(_0x3ccea4['error']){if(_0x3ccea4[_0xda5e('0x1e')][_0xda5e('0x1f')]===0x1f4){logger[_0xda5e('0x1e')](_0xda5e('0x1b'),_0x110167,_0x3ccea4[_0xda5e('0x1e')][_0xda5e('0x20')]);return _0x470811(_0x3ccea4['error'][_0xda5e('0x20')]);}logger[_0xda5e('0x1e')](_0xda5e('0x1b'),_0x110167,_0x3ccea4['error']['message']);return _0x1f4046(_0x3ccea4[_0xda5e('0x1e')][_0xda5e('0x20')]);}else{logger[_0xda5e('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x110167,_0xda5e('0x1c'));_0x1f4046(_0x3ccea4[_0xda5e('0x22')][_0xda5e('0x20')]);}})[_0xda5e('0x23')](function(_0x328754){logger[_0xda5e('0x1e')](_0xda5e('0x1b'),_0x110167,_0x328754);_0x470811(_0x328754);});});}function respondWithStatusCode(_0x5e608a,_0x1ad69f){_0x1ad69f=_0x1ad69f||0xcc;return function(_0x415af6){if(_0x415af6){return _0x5e608a[_0xda5e('0x24')](_0x1ad69f);}return _0x5e608a['status'](_0x1ad69f)[_0xda5e('0x25')]();};}function respondWithResult(_0x5e0532,_0x313a6e){_0x313a6e=_0x313a6e||0xc8;return function(_0x42e10a){if(_0x42e10a){return _0x5e0532[_0xda5e('0x26')](_0x313a6e)[_0xda5e('0x27')](_0x42e10a);}};}function respondWithFilteredResult(_0x4a0811,_0x24ae9c){return function(_0x56d841){if(_0x56d841){var _0x510397=_0x56d841['count'],_0x22e77a=_0x24ae9c['offset'],_0x322e41=_0x24ae9c[_0xda5e('0x28')]+_0x24ae9c['limit'],_0x3f0dc0;if(_0x322e41>=_0x510397){_0x322e41=_0x510397;_0x3f0dc0=0xc8;}else{_0x3f0dc0=0xce;}_0x4a0811[_0xda5e('0x26')](_0x3f0dc0);return _0x4a0811[_0xda5e('0x29')]('Content-Range',_0x22e77a+'-'+_0x322e41+'/'+_0x510397)[_0xda5e('0x27')](_0x56d841);}return null;};}function patchUpdates(_0x207ba9){return function(_0x422f37){try{jsonpatch[_0xda5e('0x2a')](_0x422f37,_0x207ba9,!![]);}catch(_0x186070){return BPromise[_0xda5e('0x2b')](_0x186070);}return _0x422f37[_0xda5e('0x2c')]();};}function saveUpdates(_0x1e63ce,_0x2b545c){return function(_0x209fb2){if(_0x209fb2){return _0x209fb2[_0xda5e('0x2d')](_0x1e63ce)[_0xda5e('0x1a')](function(_0x32ea28){return _0x32ea28;});}return null;};}function removeEntity(_0x5a91c0,_0x3e948c){return function(_0x4c905e){if(_0x4c905e){return _0x4c905e['destroy']()[_0xda5e('0x1a')](function(){_0x5a91c0[_0xda5e('0x26')](0xcc)[_0xda5e('0x25')]();});}};}function handleEntityNotFound(_0x4f8228,_0x4172db){return function(_0x390a43){if(!_0x390a43){_0x4f8228['sendStatus'](0x194);}return _0x390a43;};}function handleError(_0x457db0,_0x4de4c9){_0x4de4c9=_0x4de4c9||0x1f4;return function(_0x3549b7){logger[_0xda5e('0x1e')](_0x3549b7[_0xda5e('0x2e')]);if(_0x3549b7[_0xda5e('0x2f')]){delete _0x3549b7[_0xda5e('0x2f')];}_0x457db0['status'](_0x4de4c9)[_0xda5e('0x30')](_0x3549b7);};}exports[_0xda5e('0x31')]=function(_0x5a08f8,_0x4951ef){var _0x12935a={},_0x2b9cf0={},_0x5e4e32={'count':0x0,'rows':[]};var _0x314db9=_[_0xda5e('0x32')](db[_0xda5e('0x33')][_0xda5e('0x34')],function(_0x5776d6){return{'name':_0x5776d6[_0xda5e('0x35')],'type':_0x5776d6['type'][_0xda5e('0x36')]};});_0x2b9cf0[_0xda5e('0x37')]=_[_0xda5e('0x32')](_0x314db9,'name');_0x2b9cf0[_0xda5e('0x38')]=_[_0xda5e('0x39')](_0x5a08f8[_0xda5e('0x38')]);_0x2b9cf0['filters']=_[_0xda5e('0x3a')](_0x2b9cf0[_0xda5e('0x37')],_0x2b9cf0[_0xda5e('0x38')]);_0x12935a[_0xda5e('0x3b')]=_[_0xda5e('0x3a')](_0x2b9cf0['model'],qs[_0xda5e('0x3c')](_0x5a08f8[_0xda5e('0x38')]['fields']));_0x12935a[_0xda5e('0x3b')]=_0x12935a[_0xda5e('0x3b')][_0xda5e('0x3d')]?_0x12935a[_0xda5e('0x3b')]:_0x2b9cf0[_0xda5e('0x37')];if(!_0x5a08f8[_0xda5e('0x38')][_0xda5e('0x3e')](_0xda5e('0x3f'))){_0x12935a['limit']=qs[_0xda5e('0x40')](_0x5a08f8[_0xda5e('0x38')][_0xda5e('0x40')]);_0x12935a[_0xda5e('0x28')]=qs[_0xda5e('0x28')](_0x5a08f8[_0xda5e('0x38')][_0xda5e('0x28')]);}_0x12935a[_0xda5e('0x41')]=qs[_0xda5e('0x42')](_0x5a08f8['query'][_0xda5e('0x42')]);_0x12935a['where']=qs[_0xda5e('0x43')](_[_0xda5e('0x44')](_0x5a08f8[_0xda5e('0x38')],_0x2b9cf0[_0xda5e('0x43')]),_0x314db9);if(_0x5a08f8['query'][_0xda5e('0x45')]){_0x12935a[_0xda5e('0x46')]=_[_0xda5e('0x47')](_0x12935a[_0xda5e('0x46')],{'$or':_[_0xda5e('0x32')](_0x314db9,function(_0x154f0a){if(_0x154f0a[_0xda5e('0x48')]!==_0xda5e('0x49')){var _0x270d1d={};_0x270d1d[_0x154f0a[_0xda5e('0x2f')]]={'$like':'%'+_0x5a08f8[_0xda5e('0x38')]['filter']+'%'};return _0x270d1d;}})});}_0x12935a=_[_0xda5e('0x47')]({},_0x12935a,_0x5a08f8[_0xda5e('0x4a')]);var _0x3d8270={'where':_0x12935a[_0xda5e('0x46')]};return db[_0xda5e('0x33')]['count'](_0x3d8270)[_0xda5e('0x1a')](function(_0xf5c883){_0x5e4e32[_0xda5e('0x4b')]=_0xf5c883;if(_0x5a08f8[_0xda5e('0x38')][_0xda5e('0x4c')]){_0x12935a['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0xda5e('0x4d')](_0x12935a);})[_0xda5e('0x1a')](function(_0x38920d){_0x5e4e32['rows']=_0x38920d;return _0x5e4e32;})[_0xda5e('0x1a')](respondWithFilteredResult(_0x4951ef,_0x12935a))[_0xda5e('0x23')](handleError(_0x4951ef,null));};exports[_0xda5e('0x4e')]=function(_0x5214b0,_0x5a086c){var _0x898b98={'raw':![],'where':{'id':_0x5214b0[_0xda5e('0x4f')]['id']}},_0x4ac493={};_0x4ac493['model']=_[_0xda5e('0x39')](db[_0xda5e('0x33')]['rawAttributes']);_0x4ac493[_0xda5e('0x38')]=_[_0xda5e('0x39')](_0x5214b0[_0xda5e('0x38')]);_0x4ac493[_0xda5e('0x43')]=_[_0xda5e('0x3a')](_0x4ac493[_0xda5e('0x37')],_0x4ac493[_0xda5e('0x38')]);_0x898b98[_0xda5e('0x3b')]=_[_0xda5e('0x3a')](_0x4ac493['model'],qs[_0xda5e('0x3c')](_0x5214b0[_0xda5e('0x38')][_0xda5e('0x3c')]));_0x898b98[_0xda5e('0x3b')]=_0x898b98[_0xda5e('0x3b')]['length']?_0x898b98[_0xda5e('0x3b')]:_0x4ac493[_0xda5e('0x37')];if(_0x5214b0['query'][_0xda5e('0x4c')]){_0x898b98['include']=[{'all':!![]}];}_0x898b98=_[_0xda5e('0x47')]({},_0x898b98,_0x5214b0['options']);return db[_0xda5e('0x33')]['find'](_0x898b98)[_0xda5e('0x1a')](handleEntityNotFound(_0x5a086c,null))['then'](respondWithResult(_0x5a086c,null))[_0xda5e('0x23')](handleError(_0x5a086c,null));};exports[_0xda5e('0x50')]=function(_0x27de85,_0x1a314f){return db[_0xda5e('0x33')][_0xda5e('0x50')](_0x27de85['body'],{})[_0xda5e('0x1a')](respondWithResult(_0x1a314f,0xc9))[_0xda5e('0x23')](handleError(_0x1a314f,null));};exports['update']=function(_0x38f794,_0x1a12c1){if(_0x38f794[_0xda5e('0x51')]['id']){delete _0x38f794[_0xda5e('0x51')]['id'];}return db[_0xda5e('0x33')]['find']({'where':{'id':_0x38f794[_0xda5e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a12c1,null))[_0xda5e('0x1a')](saveUpdates(_0x38f794[_0xda5e('0x51')],null))[_0xda5e('0x1a')](respondWithResult(_0x1a12c1,null))[_0xda5e('0x23')](handleError(_0x1a12c1,null));};exports['destroy']=function(_0x4a7bcf,_0xe0cdb0){return db[_0xda5e('0x33')][_0xda5e('0x52')]({'where':{'id':_0x4a7bcf[_0xda5e('0x4f')]['id']}})[_0xda5e('0x1a')](handleEntityNotFound(_0xe0cdb0,null))[_0xda5e('0x1a')](removeEntity(_0xe0cdb0,null))[_0xda5e('0x23')](handleError(_0xe0cdb0,null));};exports['getConfigurations']=function(_0x4404f3,_0xdc1b2b,_0x552d54){var _0x26715c={};var _0x4b09a9={};var _0x4c6a33;var _0x9e60ad;return db[_0xda5e('0x33')][_0xda5e('0x53')]({'where':{'id':_0x4404f3[_0xda5e('0x4f')]['id']}})['then'](handleEntityNotFound(_0xdc1b2b,null))['then'](function(_0x1b074a){if(_0x1b074a){_0x4c6a33=_0x1b074a;_0x4b09a9['model']=_[_0xda5e('0x39')](db[_0xda5e('0x54')]['rawAttributes']);_0x4b09a9[_0xda5e('0x38')]=_[_0xda5e('0x39')](_0x4404f3['query']);_0x4b09a9['filters']=_[_0xda5e('0x3a')](_0x4b09a9[_0xda5e('0x37')],_0x4b09a9[_0xda5e('0x38')]);_0x26715c[_0xda5e('0x3b')]=_[_0xda5e('0x3a')](_0x4b09a9['model'],qs['fields'](_0x4404f3[_0xda5e('0x38')][_0xda5e('0x3c')]));_0x26715c[_0xda5e('0x3b')]=_0x26715c[_0xda5e('0x3b')]['length']?_0x26715c[_0xda5e('0x3b')]:_0x4b09a9[_0xda5e('0x37')];_0x26715c[_0xda5e('0x41')]=qs[_0xda5e('0x42')](_0x4404f3[_0xda5e('0x38')][_0xda5e('0x42')]);_0x26715c['where']=qs[_0xda5e('0x43')](_[_0xda5e('0x44')](_0x4404f3[_0xda5e('0x38')],_0x4b09a9[_0xda5e('0x43')]));if(_0x4404f3[_0xda5e('0x38')][_0xda5e('0x45')]){_0x26715c[_0xda5e('0x46')]=_[_0xda5e('0x47')](_0x26715c[_0xda5e('0x46')],{'$or':_[_0xda5e('0x32')](_0x26715c[_0xda5e('0x3b')],function(_0x1ec5c6){var _0x17467c={};_0x17467c[_0x1ec5c6]={'$like':'%'+_0x4404f3[_0xda5e('0x38')][_0xda5e('0x45')]+'%'};return _0x17467c;})});}_0x26715c=_['merge']({},_0x26715c,_0x4404f3['options']);return _0x4c6a33[_0xda5e('0x55')](_0x26715c);}})[_0xda5e('0x1a')](function(_0x74fd0b){if(_0x74fd0b){_0x9e60ad=_0x74fd0b[_0xda5e('0x3d')];if(!_0x4404f3['query']['hasOwnProperty']('nolimit')){_0x26715c[_0xda5e('0x40')]=qs[_0xda5e('0x40')](_0x4404f3[_0xda5e('0x38')][_0xda5e('0x40')]);_0x26715c[_0xda5e('0x28')]=qs[_0xda5e('0x28')](_0x4404f3[_0xda5e('0x38')][_0xda5e('0x28')]);}return _0x4c6a33[_0xda5e('0x55')](_0x26715c);}})[_0xda5e('0x1a')](function(_0x1bc62a){if(_0x1bc62a){return _0x1bc62a?{'count':_0x9e60ad,'rows':_0x1bc62a}:null;}})[_0xda5e('0x1a')](respondWithResult(_0xdc1b2b,null))[_0xda5e('0x23')](handleError(_0xdc1b2b,null));};exports[_0xda5e('0x56')]=function(_0x364785,_0x1fa649,_0x3f37c1){if(_0x364785[_0xda5e('0x51')]['id']){delete _0x364785[_0xda5e('0x51')]['id'];}return db[_0xda5e('0x33')][_0xda5e('0x53')]({'where':{'id':_0x364785[_0xda5e('0x4f')]['id']}})[_0xda5e('0x1a')](handleEntityNotFound(_0x1fa649,null))['then'](function(_0x2e08b0){if(_0x2e08b0){_0x364785[_0xda5e('0x51')][_0xda5e('0x57')]=_0x2e08b0['id'];_0x364785['body'][_0xda5e('0x58')]=integrations[_0xda5e('0x59')](_0x364785[_0xda5e('0x51')][_0xda5e('0x5a')],_0x364785[_0xda5e('0x51')][_0xda5e('0x48')]);_0x364785[_0xda5e('0x51')][_0xda5e('0x5b')]=integrations['getDescriptions'](_0x364785[_0xda5e('0x51')][_0xda5e('0x5a')],_0x364785[_0xda5e('0x51')][_0xda5e('0x48')]);return db[_0xda5e('0x54')][_0xda5e('0x50')](_0x364785['body'],{'include':[{'model':db[_0xda5e('0x5c')],'as':_0xda5e('0x58')},{'model':db[_0xda5e('0x5c')],'as':_0xda5e('0x5b')}]});}return null;})['then'](respondWithResult(_0x1fa649,null))[_0xda5e('0x23')](handleError(_0x1fa649,null));};exports[_0xda5e('0x5d')]=function(_0x268755,_0x25c8c1,_0x72add0){var _0x15bc85='';return db[_0xda5e('0x33')][_0xda5e('0x53')]({'where':{'id':_0x268755[_0xda5e('0x4f')]['id']},'attributes':['id',_0xda5e('0x5e'),_0xda5e('0x5f')]})['then'](handleEntityNotFound(_0x25c8c1,null))[_0xda5e('0x1a')](function(_0x440579){if(_0x440579){_0x15bc85=_0x440579['remoteUri'];var _0x3fcc6a=_0x15bc85['slice'](-0x1);if(_0x3fcc6a==='/'){_0x15bc85=_0x15bc85[_0xda5e('0x60')](0x0,_0x15bc85[_0xda5e('0x61')](_0x3fcc6a));}return rp({'method':'GET','uri':util[_0xda5e('0x62')]('%s/%s',_0x15bc85,_0xda5e('0x63')),'headers':{'Authorization':util[_0xda5e('0x62')](_0xda5e('0x64'),new Buffer(util[_0xda5e('0x62')](_0xda5e('0x65'),_0x440579['apiKey']))[_0xda5e('0x66')](_0xda5e('0x67')))},'json':!![]});}})[_0xda5e('0x1a')](function(_0x737001){if(_0x737001){var _0x3150d4=['requester',_0xda5e('0x68'),_0xda5e('0x69'),_0xda5e('0x6a'),_0xda5e('0x26'),_0xda5e('0x6b'),_0xda5e('0x6c'),_0xda5e('0x6d'),_0xda5e('0x6e'),_0xda5e('0x6c'),_0xda5e('0x6f')];_[_0xda5e('0x70')](_0x737001,function(_0x46e5c1){return _0x3150d4[_0xda5e('0x71')](_0x46e5c1[_0xda5e('0x2f')])||!_0x46e5c1[_0xda5e('0x72')]&&_0x46e5c1[_0xda5e('0x48')]!==_0xda5e('0x73')&&_0x46e5c1[_0xda5e('0x48')]!=='custom_dropdown';});return{'count':_0x737001[_0xda5e('0x3d')],'rows':_[_0xda5e('0x32')](_0x737001,function(_0x2d487f){return{'id':_0x2d487f[_0xda5e('0x2f')],'name':_0x2d487f['label'],'custom':!_0x2d487f['default'],'options':_0x2d487f[_0xda5e('0x74')]?_[_0xda5e('0x32')](_0x2d487f[_0xda5e('0x74')],function(_0x5ddf73){return{'name':_[_0xda5e('0x75')](_0x5ddf73),'value':_0x5ddf73};}):[]};})};}})[_0xda5e('0x1a')](respondWithResult(_0x25c8c1,null))['catch'](function(_0x31919f){var _0x468524=_0x268755['query']['test']?0x1f4:_0x31919f[_0xda5e('0x76')]||0x1f4;logger['error'](_0xda5e('0x77'),_0xda5e('0x5d'),_0x468524,JSON[_0xda5e('0x1d')](_0x31919f));delete _0x31919f[_0xda5e('0x2f')];if(_0x468524===0x191){_0x468524=0x190;}_0x25c8c1['status'](_0x468524)[_0xda5e('0x30')](_0x268755['query']['test']?{'message':_0xda5e('0x78'),'statusCode':_0x31919f[_0xda5e('0x76')]}:_0x31919f);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 88b3a7e..e70b4f4 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 _0x60ab=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x60ab,0xf2));var _0xb60a=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x60ab[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0xb60a('0x0'));var util=require(_0xb60a('0x1'));var logger=require('../../config/logger')(_0xb60a('0x2'));var moment=require(_0xb60a('0x3'));var BPromise=require(_0xb60a('0x4'));var rp=require(_0xb60a('0x5'));var fs=require('fs');var path=require(_0xb60a('0x6'));var rimraf=require(_0xb60a('0x7'));var config=require(_0xb60a('0x8'));var attributes=require(_0xb60a('0x9'));var integrations=require(_0xb60a('0xa'));module[_0xb60a('0xb')]=function(_0x350146,_0x2240dd){return _0x350146['define'](_0xb60a('0xc'),attributes,{'tableName':_0xb60a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd56=['moment','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api'];(function(_0x272932,_0x59f3a8){var _0x4b7519=function(_0x301942){while(--_0x301942){_0x272932['push'](_0x272932['shift']());}};_0x4b7519(++_0x59f3a8);}(_0xcd56,0xb1));var _0x6cd5=function(_0x552b0f,_0xd8fb13){_0x552b0f=_0x552b0f-0x0;var _0x490fbe=_0xcd56[_0x552b0f];return _0x490fbe;};'use strict';var _=require(_0x6cd5('0x0'));var util=require(_0x6cd5('0x1'));var logger=require('../../config/logger')(_0x6cd5('0x2'));var moment=require(_0x6cd5('0x3'));var BPromise=require('bluebird');var rp=require(_0x6cd5('0x4'));var fs=require('fs');var path=require(_0x6cd5('0x5'));var rimraf=require(_0x6cd5('0x6'));var config=require('../../config/environment');var attributes=require(_0x6cd5('0x7'));var integrations=require(_0x6cd5('0x8'));module[_0x6cd5('0x9')]=function(_0x3b6a98,_0x3ba33f){return _0x3b6a98['define'](_0x6cd5('0xa'),attributes,{'tableName':_0x6cd5('0xb'),'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 33a2fa3..ecc7a11 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 _0x8087=['map','debug','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshdeskAccount','options','raw','where','limit','include','model','attributes'];(function(_0x2d2309,_0x360354){var _0x51e163=function(_0x51ad18){while(--_0x51ad18){_0x2d2309['push'](_0x2d2309['shift']());}};_0x51e163(++_0x360354);}(_0x8087,0x91));var _0x7808=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8087[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x7808('0x0'));var util=require(_0x7808('0x1'));var moment=require(_0x7808('0x2'));var BPromise=require(_0x7808('0x3'));var rs=require(_0x7808('0x4'));var fs=require('fs');var Redis=require(_0x7808('0x5'));var db=require(_0x7808('0x6'))['db'];var utils=require(_0x7808('0x7'));var logger=require(_0x7808('0x8'))(_0x7808('0x9'));var config=require(_0x7808('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7808('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4246cc,_0x454690,_0x2028e4){return new BPromise(function(_0x3bdae7,_0x38b454){return client['request'](_0x4246cc,_0x2028e4)[_0x7808('0xc')](function(_0x4c3cd8){logger[_0x7808('0xd')](_0x7808('0xe'),_0x454690,_0x7808('0xf'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x454690,_0x7808('0xf'),JSON[_0x7808('0x10')](_0x4c3cd8));if(_0x4c3cd8['error']){if(_0x4c3cd8[_0x7808('0x11')][_0x7808('0x12')]===0x1f4){logger[_0x7808('0x11')](_0x7808('0xe'),_0x454690,_0x4c3cd8[_0x7808('0x11')][_0x7808('0x13')]);return _0x38b454(_0x4c3cd8['error']['message']);}logger[_0x7808('0x11')](_0x7808('0xe'),_0x454690,_0x4c3cd8[_0x7808('0x11')][_0x7808('0x13')]);return _0x3bdae7(_0x4c3cd8[_0x7808('0x11')][_0x7808('0x13')]);}else{logger[_0x7808('0xd')](_0x7808('0xe'),_0x454690,_0x7808('0xf'));_0x3bdae7(_0x4c3cd8[_0x7808('0x14')]['message']);}})[_0x7808('0x15')](function(_0x117226){logger[_0x7808('0x11')](_0x7808('0xe'),_0x454690,_0x117226);_0x38b454(_0x117226);});});}exports['GetFreshdeskAccount']=function(_0x574f84){var _0x527fee=this;return new Promise(function(_0x5ea5c0,_0x29fdc9){return db[_0x7808('0x16')]['findAll']({'raw':_0x574f84[_0x7808('0x17')]?_0x574f84[_0x7808('0x17')][_0x7808('0x18')]===undefined?!![]:![]:!![],'where':_0x574f84[_0x7808('0x17')]?_0x574f84[_0x7808('0x17')][_0x7808('0x19')]||null:null,'attributes':_0x574f84[_0x7808('0x17')]?_0x574f84[_0x7808('0x17')]['attributes']||null:null,'limit':_0x574f84[_0x7808('0x17')]?_0x574f84[_0x7808('0x17')][_0x7808('0x1a')]||null:null,'include':_0x574f84[_0x7808('0x17')]?_0x574f84[_0x7808('0x17')][_0x7808('0x1b')]?_['map'](_0x574f84[_0x7808('0x17')][_0x7808('0x1b')],function(_0x1b4be1){return{'model':db[_0x1b4be1[_0x7808('0x1c')]],'as':_0x1b4be1['as'],'attributes':_0x1b4be1[_0x7808('0x1d')],'include':_0x1b4be1[_0x7808('0x1b')]?_[_0x7808('0x1e')](_0x1b4be1['include'],function(_0x3d20d5){return{'model':db[_0x3d20d5['model']],'as':_0x3d20d5['as'],'attributes':_0x3d20d5['attributes'],'include':_0x3d20d5[_0x7808('0x1b')]?_[_0x7808('0x1e')](_0x3d20d5[_0x7808('0x1b')],function(_0x4a2eaf){return{'model':db[_0x4a2eaf['model']],'as':_0x4a2eaf['as'],'attributes':_0x4a2eaf[_0x7808('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b0038){logger[_0x7808('0xd')]('GetFreshdeskAccount',_0x574f84);logger[_0x7808('0x1f')](_0x7808('0x20'),_0x574f84,JSON[_0x7808('0x10')](_0x4b0038));_0x5ea5c0(_0x4b0038);})[_0x7808('0x15')](function(_0x3bcbd8){logger[_0x7808('0x11')](_0x7808('0x20'),_0x3bcbd8['message'],_0x574f84);_0x29fdc9(_0x527fee[_0x7808('0x11')](0x1f4,_0x3bcbd8[_0x7808('0x13')]));});});};exports[_0x7808('0x21')]=function(_0x3f7828){var _0x20257f=this;return new Promise(function(_0x1da4d3,_0x561fe2){return db[_0x7808('0x16')][_0x7808('0x22')]({'raw':_0x3f7828[_0x7808('0x17')]?_0x3f7828['options'][_0x7808('0x18')]===undefined?!![]:![]:!![],'where':_0x3f7828[_0x7808('0x17')]?_0x3f7828[_0x7808('0x17')]['where']||null:null,'attributes':_0x3f7828['options']?_0x3f7828[_0x7808('0x17')][_0x7808('0x1d')]||null:null,'include':_0x3f7828[_0x7808('0x17')]?_0x3f7828[_0x7808('0x17')]['include']?_[_0x7808('0x1e')](_0x3f7828[_0x7808('0x17')][_0x7808('0x1b')],function(_0x55e077){return{'model':db[_0x55e077[_0x7808('0x1c')]],'as':_0x55e077['as'],'attributes':_0x55e077[_0x7808('0x1d')],'include':_0x55e077[_0x7808('0x1b')]?_['map'](_0x55e077['include'],function(_0x1c3f6){return{'model':db[_0x1c3f6[_0x7808('0x1c')]],'as':_0x1c3f6['as'],'attributes':_0x1c3f6['attributes'],'include':_0x1c3f6[_0x7808('0x1b')]?_[_0x7808('0x1e')](_0x1c3f6[_0x7808('0x1b')],function(_0x43e44c){return{'model':db[_0x43e44c[_0x7808('0x1c')]],'as':_0x43e44c['as'],'attributes':_0x43e44c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7808('0xc')](function(_0x3a050b){logger[_0x7808('0xd')](_0x7808('0x21'),_0x3f7828);logger[_0x7808('0x1f')](_0x7808('0x21'),_0x3f7828,JSON['stringify'](_0x3a050b));_0x1da4d3(_0x3a050b);})[_0x7808('0x15')](function(_0x15adfb){logger[_0x7808('0x11')](_0x7808('0x21'),_0x15adfb[_0x7808('0x13')],_0x3f7828);_0x561fe2(_0x20257f['error'](0x1f4,_0x15adfb[_0x7808('0x13')]));});});}; \ No newline at end of file +var _0x2895=['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','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','catch','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x695685,_0x2067b2){var _0x1b2090=function(_0x1325ba){while(--_0x1325ba){_0x695685['push'](_0x695685['shift']());}};_0x1b2090(++_0x2067b2);}(_0x2895,0x1a7));var _0x5289=function(_0x3f46aa,_0x25d595){_0x3f46aa=_0x3f46aa-0x0;var _0x4811e5=_0x2895[_0x3f46aa];return _0x4811e5;};'use strict';var _=require(_0x5289('0x0'));var util=require(_0x5289('0x1'));var moment=require(_0x5289('0x2'));var BPromise=require(_0x5289('0x3'));var rs=require(_0x5289('0x4'));var fs=require('fs');var Redis=require(_0x5289('0x5'));var db=require(_0x5289('0x6'))['db'];var utils=require(_0x5289('0x7'));var logger=require('../../config/logger')(_0x5289('0x8'));var config=require('../../config/environment');var jayson=require(_0x5289('0x9'));var client=jayson[_0x5289('0xa')][_0x5289('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x102b85,_0x51fa76,_0xc8aca2){return new BPromise(function(_0x39ddb9,_0x121c04){return client['request'](_0x102b85,_0xc8aca2)[_0x5289('0xc')](function(_0x3b2749){logger[_0x5289('0xd')](_0x5289('0xe'),_0x51fa76,_0x5289('0xf'));logger[_0x5289('0x10')](_0x5289('0x11'),_0x51fa76,_0x5289('0xf'),JSON[_0x5289('0x12')](_0x3b2749));if(_0x3b2749[_0x5289('0x13')]){if(_0x3b2749[_0x5289('0x13')][_0x5289('0x14')]===0x1f4){logger[_0x5289('0x13')](_0x5289('0xe'),_0x51fa76,_0x3b2749[_0x5289('0x13')]['message']);return _0x121c04(_0x3b2749['error']['message']);}logger[_0x5289('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x51fa76,_0x3b2749['error'][_0x5289('0x15')]);return _0x39ddb9(_0x3b2749[_0x5289('0x13')][_0x5289('0x15')]);}else{logger['info'](_0x5289('0xe'),_0x51fa76,_0x5289('0xf'));_0x39ddb9(_0x3b2749['result']['message']);}})['catch'](function(_0x57a412){logger['error'](_0x5289('0xe'),_0x51fa76,_0x57a412);_0x121c04(_0x57a412);});});}exports['GetFreshdeskAccount']=function(_0x3adde9){var _0x108380=this;return new Promise(function(_0x12eb6c,_0x532f99){return db[_0x5289('0x16')][_0x5289('0x17')]({'raw':_0x3adde9[_0x5289('0x18')]?_0x3adde9[_0x5289('0x18')][_0x5289('0x19')]===undefined?!![]:![]:!![],'where':_0x3adde9[_0x5289('0x18')]?_0x3adde9[_0x5289('0x18')][_0x5289('0x1a')]||null:null,'attributes':_0x3adde9['options']?_0x3adde9[_0x5289('0x18')][_0x5289('0x1b')]||null:null,'limit':_0x3adde9[_0x5289('0x18')]?_0x3adde9['options'][_0x5289('0x1c')]||null:null,'include':_0x3adde9[_0x5289('0x18')]?_0x3adde9[_0x5289('0x18')][_0x5289('0x1d')]?_[_0x5289('0x1e')](_0x3adde9[_0x5289('0x18')][_0x5289('0x1d')],function(_0x3a6103){return{'model':db[_0x3a6103['model']],'as':_0x3a6103['as'],'attributes':_0x3a6103[_0x5289('0x1b')],'include':_0x3a6103[_0x5289('0x1d')]?_['map'](_0x3a6103['include'],function(_0x1aa423){return{'model':db[_0x1aa423['model']],'as':_0x1aa423['as'],'attributes':_0x1aa423[_0x5289('0x1b')],'include':_0x1aa423['include']?_[_0x5289('0x1e')](_0x1aa423['include'],function(_0x11ea35){return{'model':db[_0x11ea35[_0x5289('0x1f')]],'as':_0x11ea35['as'],'attributes':_0x11ea35[_0x5289('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5289('0xc')](function(_0x500401){logger[_0x5289('0xd')]('GetFreshdeskAccount',_0x3adde9);logger['debug'](_0x5289('0x20'),_0x3adde9,JSON['stringify'](_0x500401));_0x12eb6c(_0x500401);})[_0x5289('0x21')](function(_0x2d1a68){logger['error']('GetFreshdeskAccount',_0x2d1a68[_0x5289('0x15')],_0x3adde9);_0x532f99(_0x108380[_0x5289('0x13')](0x1f4,_0x2d1a68['message']));});});};exports['ShowFreshdeskAccount']=function(_0x2e7c28){var _0x572fc8=this;return new Promise(function(_0x312173,_0x2249d5){return db[_0x5289('0x16')][_0x5289('0x22')]({'raw':_0x2e7c28[_0x5289('0x18')]?_0x2e7c28[_0x5289('0x18')][_0x5289('0x19')]===undefined?!![]:![]:!![],'where':_0x2e7c28['options']?_0x2e7c28['options'][_0x5289('0x1a')]||null:null,'attributes':_0x2e7c28[_0x5289('0x18')]?_0x2e7c28[_0x5289('0x18')][_0x5289('0x1b')]||null:null,'include':_0x2e7c28[_0x5289('0x18')]?_0x2e7c28[_0x5289('0x18')][_0x5289('0x1d')]?_[_0x5289('0x1e')](_0x2e7c28[_0x5289('0x18')][_0x5289('0x1d')],function(_0x57071d){return{'model':db[_0x57071d[_0x5289('0x1f')]],'as':_0x57071d['as'],'attributes':_0x57071d[_0x5289('0x1b')],'include':_0x57071d['include']?_[_0x5289('0x1e')](_0x57071d[_0x5289('0x1d')],function(_0x138106){return{'model':db[_0x138106[_0x5289('0x1f')]],'as':_0x138106['as'],'attributes':_0x138106[_0x5289('0x1b')],'include':_0x138106['include']?_[_0x5289('0x1e')](_0x138106[_0x5289('0x1d')],function(_0x125e3d){return{'model':db[_0x125e3d[_0x5289('0x1f')]],'as':_0x125e3d['as'],'attributes':_0x125e3d[_0x5289('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5289('0xc')](function(_0x29ddda){logger[_0x5289('0xd')](_0x5289('0x23'),_0x2e7c28);logger[_0x5289('0x10')](_0x5289('0x23'),_0x2e7c28,JSON[_0x5289('0x12')](_0x29ddda));_0x312173(_0x29ddda);})['catch'](function(_0x1ff975){logger[_0x5289('0x13')](_0x5289('0x23'),_0x1ff975[_0x5289('0x15')],_0x2e7c28);_0x2249d5(_0x572fc8[_0x5289('0x13')](0x1f4,_0x1ff975['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4d352cf..5c68d93 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 _0x0a0a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','create','post','setTags','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x30d934,_0x10338b){var _0x10bb34=function(_0x2bf7a9){while(--_0x2bf7a9){_0x30d934['push'](_0x30d934['shift']());}};_0x10bb34(++_0x10338b);}(_0x0a0a,0x135));var _0xa0a0=function(_0x54e225,_0x1a9c83){_0x54e225=_0x54e225-0x0;var _0x4a0449=_0x0a0a[_0x54e225];return _0x4a0449;};'use strict';var multer=require(_0xa0a0('0x0'));var util=require(_0xa0a0('0x1'));var path=require(_0xa0a0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0a0('0x3')]();var auth=require(_0xa0a0('0x4'));var interaction=require(_0xa0a0('0x5'));var config=require(_0xa0a0('0x6'));var controller=require(_0xa0a0('0x7'));router[_0xa0a0('0x8')]('/',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xa')]);router['get']('/:id',auth[_0xa0a0('0x9')](),controller['show']);router[_0xa0a0('0x8')]('/:id/fields',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xb')]);router['get']('/:id/subjects',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xc')]);router[_0xa0a0('0x8')](_0xa0a0('0xd'),auth[_0xa0a0('0x9')](),controller['getDescriptions']);router[_0xa0a0('0x8')](_0xa0a0('0xe'),auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xf')]);router['post']('/',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0x10')]);router[_0xa0a0('0x11')](_0xa0a0('0xe'),auth[_0xa0a0('0x9')](),controller[_0xa0a0('0x12')]);router[_0xa0a0('0x13')](_0xa0a0('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xa0a0('0x15')](_0xa0a0('0x14'),auth['isAuthenticated'](),controller[_0xa0a0('0x16')]);module[_0xa0a0('0x17')]=router; \ No newline at end of file +var _0x63fe=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','put','/:id','update','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id/fields'];(function(_0x3a3d5f,_0xb7dfc6){var _0x493475=function(_0x142af1){while(--_0x142af1){_0x3a3d5f['push'](_0x3a3d5f['shift']());}};_0x493475(++_0xb7dfc6);}(_0x63fe,0x152));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe63f('0x0'));var util=require(_0xe63f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe63f('0x2'));var router=express[_0xe63f('0x3')]();var auth=require(_0xe63f('0x4'));var interaction=require(_0xe63f('0x5'));var config=require(_0xe63f('0x6'));var controller=require(_0xe63f('0x7'));router['get']('/',auth[_0xe63f('0x8')](),controller[_0xe63f('0x9')]);router['get']('/:id',auth[_0xe63f('0x8')](),controller['show']);router[_0xe63f('0xa')](_0xe63f('0xb'),auth[_0xe63f('0x8')](),controller[_0xe63f('0xc')]);router[_0xe63f('0xa')](_0xe63f('0xd'),auth[_0xe63f('0x8')](),controller[_0xe63f('0xe')]);router['get'](_0xe63f('0xf'),auth[_0xe63f('0x8')](),controller[_0xe63f('0x10')]);router[_0xe63f('0xa')]('/:id/tags',auth[_0xe63f('0x8')](),controller[_0xe63f('0x11')]);router[_0xe63f('0x12')]('/',auth[_0xe63f('0x8')](),controller['create']);router['post'](_0xe63f('0x13'),auth[_0xe63f('0x8')](),controller[_0xe63f('0x14')]);router[_0xe63f('0x15')](_0xe63f('0x16'),auth[_0xe63f('0x8')](),controller[_0xe63f('0x17')]);router[_0xe63f('0x18')]('/:id',auth[_0xe63f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 771d320..cc30d23 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 _0xb4d7=['sequelize','STRING'];(function(_0x52a7cf,_0x5cec2c){var _0x20f65f=function(_0x1a7a45){while(--_0x1a7a45){_0x52a7cf['push'](_0x52a7cf['shift']());}};_0x20f65f(++_0x5cec2c);}(_0xb4d7,0x1d8));var _0x7b4d=function(_0xf66d59,_0x635fe1){_0xf66d59=_0xf66d59-0x0;var _0x1bf0c3=_0xb4d7[_0xf66d59];return _0x1bf0c3;};'use strict';var Sequelize=require(_0x7b4d('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b4d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7d2c=['sequelize','exports','STRING'];(function(_0x66af70,_0x7b7589){var _0x2b930f=function(_0x146737){while(--_0x146737){_0x66af70['push'](_0x66af70['shift']());}};_0x2b930f(++_0x7b7589);}(_0x7d2c,0x15f));var _0xc7d2=function(_0x454c12,_0x45c282){_0x454c12=_0x454c12-0x0;var _0x7bb4dc=_0x7d2c[_0x454c12];return _0x7bb4dc;};'use strict';var Sequelize=require(_0xc7d2('0x0'));module[_0xc7d2('0x1')]={'name':{'type':Sequelize[_0xc7d2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 0207d43..c0354b5 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 _0xbfe7=['limit','Content-Range','apply','destroy','then','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','length','include','find','create','update','params','body','pick','nolimit','getFields','getSubjects','findOne','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset'];(function(_0x1fcc7d,_0x4eb620){var _0x3daa39=function(_0x2b90f9){while(--_0x2b90f9){_0x1fcc7d['push'](_0x1fcc7d['shift']());}};_0x3daa39(++_0x4eb620);}(_0xbfe7,0x89));var _0x7bfe=function(_0x301aac,_0x30bd61){_0x301aac=_0x301aac-0x0;var _0x18dd5d=_0xbfe7[_0x301aac];return _0x18dd5d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7bfe('0x0'));var zipdir=require(_0x7bfe('0x1'));var jsonpatch=require(_0x7bfe('0x2'));var rp=require('request-promise');var moment=require(_0x7bfe('0x3'));var BPromise=require(_0x7bfe('0x4'));var Mustache=require(_0x7bfe('0x5'));var util=require(_0x7bfe('0x6'));var path=require(_0x7bfe('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7bfe('0x8'));var squel=require(_0x7bfe('0x9'));var crypto=require(_0x7bfe('0xa'));var jsforce=require(_0x7bfe('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7bfe('0xc'));var querystring=require(_0x7bfe('0xd'));var Papa=require(_0x7bfe('0xe'));var Redis=require(_0x7bfe('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bfe('0x10'))(_0x7bfe('0x11'));var utils=require('../../config/utils');var config=require(_0x7bfe('0x12'));var licenseUtil=require(_0x7bfe('0x13'));var db=require(_0x7bfe('0x14'))['db'];var jayson=require(_0x7bfe('0x15'));var client=jayson[_0x7bfe('0x16')][_0x7bfe('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x14859b,_0x4a70fa,_0x4d91cd,_0x4d8e2e){return new BPromise(function(_0x3d1792,_0x20357d){var _0x535ee8=_0x4d8e2e||client;return _0x535ee8[_0x7bfe('0x18')](_0x14859b,_0x4d91cd)['then'](function(_0x793aef){logger[_0x7bfe('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4a70fa,_0x7bfe('0x1a'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4a70fa,_0x7bfe('0x1a'),JSON[_0x7bfe('0x1b')](_0x793aef));if(_0x793aef['error']){if(_0x793aef[_0x7bfe('0x1c')][_0x7bfe('0x1d')]===0x1f4){logger[_0x7bfe('0x1c')](_0x7bfe('0x1e'),_0x4a70fa,_0x793aef[_0x7bfe('0x1c')][_0x7bfe('0x1f')]);return _0x20357d(_0x793aef[_0x7bfe('0x1c')][_0x7bfe('0x1f')]);}logger[_0x7bfe('0x1c')](_0x7bfe('0x1e'),_0x4a70fa,_0x793aef[_0x7bfe('0x1c')][_0x7bfe('0x1f')]);return _0x3d1792(_0x793aef['error'][_0x7bfe('0x1f')]);}else{logger[_0x7bfe('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4a70fa,_0x7bfe('0x1a'));_0x3d1792(_0x793aef['result']['message']);}})[_0x7bfe('0x20')](function(_0x42dbde){logger[_0x7bfe('0x1c')](_0x7bfe('0x1e'),_0x4a70fa,_0x42dbde);_0x20357d(_0x42dbde);});});}function respondWithStatusCode(_0x483f77,_0x41439a){_0x41439a=_0x41439a||0xcc;return function(_0x9a389c){if(_0x9a389c){return _0x483f77[_0x7bfe('0x21')](_0x41439a);}return _0x483f77['status'](_0x41439a)[_0x7bfe('0x22')]();};}function respondWithResult(_0x3ed1e0,_0xb272c8){_0xb272c8=_0xb272c8||0xc8;return function(_0x4e0895){if(_0x4e0895){return _0x3ed1e0[_0x7bfe('0x23')](_0xb272c8)[_0x7bfe('0x24')](_0x4e0895);}};}function respondWithFilteredResult(_0xe9a865,_0x1916e8){return function(_0x9e335b){if(_0x9e335b){var _0x18ce1d=_0x9e335b[_0x7bfe('0x25')],_0x27d166=_0x1916e8[_0x7bfe('0x26')],_0x131326=_0x1916e8['offset']+_0x1916e8[_0x7bfe('0x27')],_0x50d16c;if(_0x131326>=_0x18ce1d){_0x131326=_0x18ce1d;_0x50d16c=0xc8;}else{_0x50d16c=0xce;}_0xe9a865[_0x7bfe('0x23')](_0x50d16c);return _0xe9a865['set'](_0x7bfe('0x28'),_0x27d166+'-'+_0x131326+'/'+_0x18ce1d)[_0x7bfe('0x24')](_0x9e335b);}return null;};}function patchUpdates(_0xa49fc6){return function(_0x5f3cda){try{jsonpatch[_0x7bfe('0x29')](_0x5f3cda,_0xa49fc6,!![]);}catch(_0x1a69e7){return BPromise['reject'](_0x1a69e7);}return _0x5f3cda['save']();};}function saveUpdates(_0x41482a,_0x371c2e){return function(_0x5a7aa8){if(_0x5a7aa8){return _0x5a7aa8['update'](_0x41482a)['then'](function(_0x5423da){return _0x5423da;});}return null;};}function removeEntity(_0x55cc39,_0x2a0803){return function(_0x60e01f){if(_0x60e01f){return _0x60e01f[_0x7bfe('0x2a')]()[_0x7bfe('0x2b')](function(){_0x55cc39['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xff6ac9,_0x583a43){return function(_0x5a41a0){if(!_0x5a41a0){_0xff6ac9[_0x7bfe('0x21')](0x194);}return _0x5a41a0;};}function handleError(_0x37eba0,_0x5252d4){_0x5252d4=_0x5252d4||0x1f4;return function(_0x36e70b){logger[_0x7bfe('0x1c')](_0x36e70b['stack']);if(_0x36e70b[_0x7bfe('0x2c')]){delete _0x36e70b['name'];}_0x37eba0[_0x7bfe('0x23')](_0x5252d4)[_0x7bfe('0x2d')](_0x36e70b);};}exports[_0x7bfe('0x2e')]=function(_0x10a5d7,_0x5b601c){var _0x3a453a={},_0x3ee861={},_0x22ed43={'count':0x0,'rows':[]};var _0x4438c5=_['map'](db[_0x7bfe('0x2f')][_0x7bfe('0x30')],function(_0x5c46f4){return{'name':_0x5c46f4[_0x7bfe('0x31')],'type':_0x5c46f4[_0x7bfe('0x32')][_0x7bfe('0x33')]};});_0x3ee861[_0x7bfe('0x34')]=_[_0x7bfe('0x35')](_0x4438c5,'name');_0x3ee861[_0x7bfe('0x36')]=_[_0x7bfe('0x37')](_0x10a5d7['query']);_0x3ee861['filters']=_[_0x7bfe('0x38')](_0x3ee861['model'],_0x3ee861['query']);_0x3a453a[_0x7bfe('0x39')]=_[_0x7bfe('0x38')](_0x3ee861[_0x7bfe('0x34')],qs[_0x7bfe('0x3a')](_0x10a5d7[_0x7bfe('0x36')][_0x7bfe('0x3a')]));_0x3a453a[_0x7bfe('0x39')]=_0x3a453a[_0x7bfe('0x39')]['length']?_0x3a453a[_0x7bfe('0x39')]:_0x3ee861[_0x7bfe('0x34')];if(!_0x10a5d7[_0x7bfe('0x36')][_0x7bfe('0x3b')]('nolimit')){_0x3a453a['limit']=qs['limit'](_0x10a5d7[_0x7bfe('0x36')][_0x7bfe('0x27')]);_0x3a453a[_0x7bfe('0x26')]=qs[_0x7bfe('0x26')](_0x10a5d7[_0x7bfe('0x36')]['offset']);}_0x3a453a[_0x7bfe('0x3c')]=qs[_0x7bfe('0x3d')](_0x10a5d7[_0x7bfe('0x36')][_0x7bfe('0x3d')]);_0x3a453a[_0x7bfe('0x3e')]=qs[_0x7bfe('0x3f')](_['pick'](_0x10a5d7[_0x7bfe('0x36')],_0x3ee861[_0x7bfe('0x3f')]),_0x4438c5);if(_0x10a5d7[_0x7bfe('0x36')][_0x7bfe('0x40')]){_0x3a453a[_0x7bfe('0x3e')]=_[_0x7bfe('0x41')](_0x3a453a[_0x7bfe('0x3e')],{'$or':_[_0x7bfe('0x35')](_0x4438c5,function(_0x9bf0d6){if(_0x9bf0d6[_0x7bfe('0x32')]!==_0x7bfe('0x42')){var _0x494c10={};_0x494c10[_0x9bf0d6[_0x7bfe('0x2c')]]={'$like':'%'+_0x10a5d7['query'][_0x7bfe('0x40')]+'%'};return _0x494c10;}})});}_0x3a453a=_['merge']({},_0x3a453a,_0x10a5d7[_0x7bfe('0x43')]);var _0x5d4a11={'where':_0x3a453a[_0x7bfe('0x3e')]};return db[_0x7bfe('0x2f')][_0x7bfe('0x25')](_0x5d4a11)[_0x7bfe('0x2b')](function(_0x5454c9){_0x22ed43[_0x7bfe('0x25')]=_0x5454c9;if(_0x10a5d7[_0x7bfe('0x36')][_0x7bfe('0x44')]){_0x3a453a['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x7bfe('0x45')](_0x3a453a);})['then'](function(_0x5b6d5d){_0x22ed43['rows']=_0x5b6d5d;return _0x22ed43;})[_0x7bfe('0x2b')](respondWithFilteredResult(_0x5b601c,_0x3a453a))[_0x7bfe('0x20')](handleError(_0x5b601c,null));};exports['show']=function(_0x4c3a73,_0x3142c2){var _0x44b544={'raw':![],'where':{'id':_0x4c3a73['params']['id']}},_0x10d6e1={};_0x10d6e1[_0x7bfe('0x34')]=_['keys'](db[_0x7bfe('0x2f')][_0x7bfe('0x30')]);_0x10d6e1[_0x7bfe('0x36')]=_[_0x7bfe('0x37')](_0x4c3a73['query']);_0x10d6e1[_0x7bfe('0x3f')]=_[_0x7bfe('0x38')](_0x10d6e1[_0x7bfe('0x34')],_0x10d6e1['query']);_0x44b544[_0x7bfe('0x39')]=_[_0x7bfe('0x38')](_0x10d6e1[_0x7bfe('0x34')],qs[_0x7bfe('0x3a')](_0x4c3a73[_0x7bfe('0x36')]['fields']));_0x44b544['attributes']=_0x44b544['attributes'][_0x7bfe('0x46')]?_0x44b544[_0x7bfe('0x39')]:_0x10d6e1[_0x7bfe('0x34')];if(_0x4c3a73[_0x7bfe('0x36')]['includeAll']){_0x44b544[_0x7bfe('0x47')]=[{'all':!![]}];}_0x44b544=_[_0x7bfe('0x41')]({},_0x44b544,_0x4c3a73[_0x7bfe('0x43')]);return db['FreshdeskConfiguration'][_0x7bfe('0x48')](_0x44b544)[_0x7bfe('0x2b')](handleEntityNotFound(_0x3142c2,null))[_0x7bfe('0x2b')](respondWithResult(_0x3142c2,null))[_0x7bfe('0x20')](handleError(_0x3142c2,null));};exports[_0x7bfe('0x49')]=function(_0x30006e,_0x3e467c){return db[_0x7bfe('0x2f')][_0x7bfe('0x49')](_0x30006e['body'],{})[_0x7bfe('0x2b')](respondWithResult(_0x3e467c,0xc9))[_0x7bfe('0x20')](handleError(_0x3e467c,null));};exports[_0x7bfe('0x4a')]=function(_0x4fb9e4,_0x5326de){if(_0x4fb9e4['body']['id']){delete _0x4fb9e4['body']['id'];}return db['FreshdeskConfiguration'][_0x7bfe('0x48')]({'where':{'id':_0x4fb9e4[_0x7bfe('0x4b')]['id']}})[_0x7bfe('0x2b')](handleEntityNotFound(_0x5326de,null))[_0x7bfe('0x2b')](saveUpdates(_0x4fb9e4[_0x7bfe('0x4c')],null))[_0x7bfe('0x2b')](respondWithResult(_0x5326de,null))[_0x7bfe('0x20')](handleError(_0x5326de,null));};exports[_0x7bfe('0x2a')]=function(_0x5de8c8,_0x5d13a2){return db[_0x7bfe('0x2f')][_0x7bfe('0x48')]({'where':{'id':_0x5de8c8[_0x7bfe('0x4b')]['id']}})[_0x7bfe('0x2b')](handleEntityNotFound(_0x5d13a2,null))[_0x7bfe('0x2b')](removeEntity(_0x5d13a2,null))['catch'](handleError(_0x5d13a2,null));};exports['getFields']=function(_0x3761ba,_0x342186,_0x19d120){var _0xd7feb8={};var _0x491d35={};var _0x303f00;var _0x550c97;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3761ba[_0x7bfe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x342186,null))['then'](function(_0x309383){if(_0x309383){_0x303f00=_0x309383;_0x491d35[_0x7bfe('0x34')]=_[_0x7bfe('0x37')](db['FreshdeskField']['rawAttributes']);_0x491d35['query']=_['keys'](_0x3761ba['query']);_0x491d35[_0x7bfe('0x3f')]=_[_0x7bfe('0x38')](_0x491d35['model'],_0x491d35['query']);_0xd7feb8[_0x7bfe('0x39')]=_[_0x7bfe('0x38')](_0x491d35[_0x7bfe('0x34')],qs['fields'](_0x3761ba[_0x7bfe('0x36')][_0x7bfe('0x3a')]));_0xd7feb8['attributes']=_0xd7feb8[_0x7bfe('0x39')][_0x7bfe('0x46')]?_0xd7feb8[_0x7bfe('0x39')]:_0x491d35[_0x7bfe('0x34')];_0xd7feb8['order']=qs[_0x7bfe('0x3d')](_0x3761ba[_0x7bfe('0x36')][_0x7bfe('0x3d')]);_0xd7feb8[_0x7bfe('0x3e')]=qs[_0x7bfe('0x3f')](_[_0x7bfe('0x4d')](_0x3761ba[_0x7bfe('0x36')],_0x491d35[_0x7bfe('0x3f')]));if(_0x3761ba['query'][_0x7bfe('0x40')]){_0xd7feb8[_0x7bfe('0x3e')]=_[_0x7bfe('0x41')](_0xd7feb8[_0x7bfe('0x3e')],{'$or':_[_0x7bfe('0x35')](_0xd7feb8['attributes'],function(_0x5be1c2){var _0x70e82a={};_0x70e82a[_0x5be1c2]={'$like':'%'+_0x3761ba['query']['filter']+'%'};return _0x70e82a;})});}_0xd7feb8=_[_0x7bfe('0x41')]({},_0xd7feb8,_0x3761ba[_0x7bfe('0x43')]);return _0x303f00['getFields'](_0xd7feb8);}})[_0x7bfe('0x2b')](function(_0x5f3cd4){if(_0x5f3cd4){_0x550c97=_0x5f3cd4['length'];if(!_0x3761ba[_0x7bfe('0x36')]['hasOwnProperty'](_0x7bfe('0x4e'))){_0xd7feb8[_0x7bfe('0x27')]=qs['limit'](_0x3761ba[_0x7bfe('0x36')]['limit']);_0xd7feb8[_0x7bfe('0x26')]=qs[_0x7bfe('0x26')](_0x3761ba['query'][_0x7bfe('0x26')]);}return _0x303f00[_0x7bfe('0x4f')](_0xd7feb8);}})['then'](function(_0x4a9334){if(_0x4a9334){return _0x4a9334?{'count':_0x550c97,'rows':_0x4a9334}:null;}})[_0x7bfe('0x2b')](respondWithResult(_0x342186,null))[_0x7bfe('0x20')](handleError(_0x342186,null));};exports[_0x7bfe('0x50')]=function(_0x2a40bf,_0x243be0,_0x5eae11){var _0x403ca3={};var _0x215445={};var _0x402373;var _0x31da0f;return db['FreshdeskConfiguration'][_0x7bfe('0x51')]({'where':{'id':_0x2a40bf['params']['id']}})[_0x7bfe('0x2b')](handleEntityNotFound(_0x243be0,null))['then'](function(_0x3861d5){if(_0x3861d5){_0x402373=_0x3861d5;_0x215445[_0x7bfe('0x34')]=_[_0x7bfe('0x37')](db[_0x7bfe('0x52')][_0x7bfe('0x30')]);_0x215445[_0x7bfe('0x36')]=_[_0x7bfe('0x37')](_0x2a40bf[_0x7bfe('0x36')]);_0x215445[_0x7bfe('0x3f')]=_['intersection'](_0x215445[_0x7bfe('0x34')],_0x215445[_0x7bfe('0x36')]);_0x403ca3['attributes']=_[_0x7bfe('0x38')](_0x215445[_0x7bfe('0x34')],qs['fields'](_0x2a40bf[_0x7bfe('0x36')][_0x7bfe('0x3a')]));_0x403ca3['attributes']=_0x403ca3[_0x7bfe('0x39')][_0x7bfe('0x46')]?_0x403ca3['attributes']:_0x215445['model'];_0x403ca3[_0x7bfe('0x3c')]=qs[_0x7bfe('0x3d')](_0x2a40bf[_0x7bfe('0x36')][_0x7bfe('0x3d')]);_0x403ca3[_0x7bfe('0x3e')]=qs['filters'](_['pick'](_0x2a40bf[_0x7bfe('0x36')],_0x215445[_0x7bfe('0x3f')]));if(_0x2a40bf[_0x7bfe('0x36')][_0x7bfe('0x40')]){_0x403ca3['where']=_[_0x7bfe('0x41')](_0x403ca3[_0x7bfe('0x3e')],{'$or':_[_0x7bfe('0x35')](_0x403ca3[_0x7bfe('0x39')],function(_0x2a344b){var _0x5d1ee3={};_0x5d1ee3[_0x2a344b]={'$like':'%'+_0x2a40bf[_0x7bfe('0x36')][_0x7bfe('0x40')]+'%'};return _0x5d1ee3;})});}_0x403ca3=_['merge']({},_0x403ca3,_0x2a40bf[_0x7bfe('0x43')]);return _0x402373[_0x7bfe('0x50')](_0x403ca3);}})[_0x7bfe('0x2b')](function(_0x208d30){if(_0x208d30){_0x31da0f=_0x208d30[_0x7bfe('0x46')];if(!_0x2a40bf['query']['hasOwnProperty'](_0x7bfe('0x4e'))){_0x403ca3[_0x7bfe('0x27')]=qs[_0x7bfe('0x27')](_0x2a40bf['query'][_0x7bfe('0x27')]);_0x403ca3['offset']=qs[_0x7bfe('0x26')](_0x2a40bf[_0x7bfe('0x36')]['offset']);}return _0x402373[_0x7bfe('0x50')](_0x403ca3);}})['then'](function(_0x10522f){if(_0x10522f){return _0x10522f?{'count':_0x31da0f,'rows':_0x10522f}:null;}})['then'](respondWithResult(_0x243be0,null))[_0x7bfe('0x20')](handleError(_0x243be0,null));};exports[_0x7bfe('0x53')]=function(_0x1e0e83,_0x40055e,_0x282762){var _0x52723d={};var _0x38166d={};var _0x144f43;var _0x4e44ce;return db[_0x7bfe('0x2f')]['findOne']({'where':{'id':_0x1e0e83[_0x7bfe('0x4b')]['id']}})[_0x7bfe('0x2b')](handleEntityNotFound(_0x40055e,null))[_0x7bfe('0x2b')](function(_0x32057a){if(_0x32057a){_0x144f43=_0x32057a;_0x38166d['model']=_[_0x7bfe('0x37')](db[_0x7bfe('0x52')]['rawAttributes']);_0x38166d[_0x7bfe('0x36')]=_[_0x7bfe('0x37')](_0x1e0e83['query']);_0x38166d['filters']=_[_0x7bfe('0x38')](_0x38166d[_0x7bfe('0x34')],_0x38166d[_0x7bfe('0x36')]);_0x52723d['attributes']=_[_0x7bfe('0x38')](_0x38166d['model'],qs[_0x7bfe('0x3a')](_0x1e0e83['query']['fields']));_0x52723d[_0x7bfe('0x39')]=_0x52723d[_0x7bfe('0x39')][_0x7bfe('0x46')]?_0x52723d[_0x7bfe('0x39')]:_0x38166d['model'];_0x52723d['order']=qs[_0x7bfe('0x3d')](_0x1e0e83['query'][_0x7bfe('0x3d')]);_0x52723d[_0x7bfe('0x3e')]=qs['filters'](_[_0x7bfe('0x4d')](_0x1e0e83[_0x7bfe('0x36')],_0x38166d[_0x7bfe('0x3f')]));if(_0x1e0e83['query'][_0x7bfe('0x40')]){_0x52723d[_0x7bfe('0x3e')]=_['merge'](_0x52723d[_0x7bfe('0x3e')],{'$or':_[_0x7bfe('0x35')](_0x52723d[_0x7bfe('0x39')],function(_0x34bafd){var _0x186e80={};_0x186e80[_0x34bafd]={'$like':'%'+_0x1e0e83[_0x7bfe('0x36')]['filter']+'%'};return _0x186e80;})});}_0x52723d=_['merge']({},_0x52723d,_0x1e0e83[_0x7bfe('0x43')]);return _0x144f43['getDescriptions'](_0x52723d);}})['then'](function(_0x4e339e){if(_0x4e339e){_0x4e44ce=_0x4e339e[_0x7bfe('0x46')];if(!_0x1e0e83[_0x7bfe('0x36')]['hasOwnProperty'](_0x7bfe('0x4e'))){_0x52723d[_0x7bfe('0x27')]=qs['limit'](_0x1e0e83[_0x7bfe('0x36')]['limit']);_0x52723d[_0x7bfe('0x26')]=qs[_0x7bfe('0x26')](_0x1e0e83[_0x7bfe('0x36')][_0x7bfe('0x26')]);}return _0x144f43['getDescriptions'](_0x52723d);}})[_0x7bfe('0x2b')](function(_0x391917){if(_0x391917){return _0x391917?{'count':_0x4e44ce,'rows':_0x391917}:null;}})[_0x7bfe('0x2b')](respondWithResult(_0x40055e,null))['catch'](handleError(_0x40055e,null));};exports[_0x7bfe('0x54')]=function(_0x5e45e9,_0x32644a,_0x55e183){var _0x3fe1e8={};var _0x25e761={};var _0x47dcce;var _0x57b7e7;return db['FreshdeskConfiguration'][_0x7bfe('0x51')]({'where':{'id':_0x5e45e9[_0x7bfe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32644a,null))[_0x7bfe('0x2b')](function(_0x51b695){if(_0x51b695){_0x47dcce=_0x51b695;_0x25e761[_0x7bfe('0x34')]=_[_0x7bfe('0x37')](db[_0x7bfe('0x55')]['rawAttributes']);_0x25e761[_0x7bfe('0x36')]=_[_0x7bfe('0x37')](_0x5e45e9[_0x7bfe('0x36')]);_0x25e761[_0x7bfe('0x3f')]=_[_0x7bfe('0x38')](_0x25e761['model'],_0x25e761[_0x7bfe('0x36')]);_0x3fe1e8[_0x7bfe('0x39')]=_[_0x7bfe('0x38')](_0x25e761[_0x7bfe('0x34')],qs[_0x7bfe('0x3a')](_0x5e45e9['query'][_0x7bfe('0x3a')]));_0x3fe1e8['attributes']=_0x3fe1e8[_0x7bfe('0x39')]['length']?_0x3fe1e8[_0x7bfe('0x39')]:_0x25e761['model'];_0x3fe1e8[_0x7bfe('0x3c')]=qs[_0x7bfe('0x3d')](_0x5e45e9['query'][_0x7bfe('0x3d')]);_0x3fe1e8[_0x7bfe('0x3e')]=qs['filters'](_[_0x7bfe('0x4d')](_0x5e45e9[_0x7bfe('0x36')],_0x25e761[_0x7bfe('0x3f')]));if(_0x5e45e9[_0x7bfe('0x36')][_0x7bfe('0x40')]){_0x3fe1e8['where']=_[_0x7bfe('0x41')](_0x3fe1e8[_0x7bfe('0x3e')],{'$or':_[_0x7bfe('0x35')](_0x3fe1e8[_0x7bfe('0x39')],function(_0x9fa604){var _0x10e180={};_0x10e180[_0x9fa604]={'$like':'%'+_0x5e45e9[_0x7bfe('0x36')][_0x7bfe('0x40')]+'%'};return _0x10e180;})});}_0x3fe1e8=_['merge']({},_0x3fe1e8,_0x5e45e9[_0x7bfe('0x43')]);return _0x47dcce[_0x7bfe('0x54')](_0x3fe1e8);}})[_0x7bfe('0x2b')](function(_0x5548d0){if(_0x5548d0){_0x57b7e7=_0x5548d0[_0x7bfe('0x46')];if(!_0x5e45e9['query'][_0x7bfe('0x3b')](_0x7bfe('0x4e'))){_0x3fe1e8['limit']=qs[_0x7bfe('0x27')](_0x5e45e9[_0x7bfe('0x36')][_0x7bfe('0x27')]);_0x3fe1e8['offset']=qs[_0x7bfe('0x26')](_0x5e45e9['query'][_0x7bfe('0x26')]);}return _0x47dcce[_0x7bfe('0x54')](_0x3fe1e8);}})[_0x7bfe('0x2b')](function(_0x3f53c7){if(_0x3f53c7){return _0x3f53c7?{'count':_0x57b7e7,'rows':_0x3f53c7}:null;}})['then'](respondWithResult(_0x32644a,null))[_0x7bfe('0x20')](handleError(_0x32644a,null));};exports[_0x7bfe('0x56')]=function(_0x4a777b,_0x161847,_0x146b98){if(_0x4a777b[_0x7bfe('0x4c')]['id']){delete _0x4a777b[_0x7bfe('0x4c')]['id'];}return db[_0x7bfe('0x2f')][_0x7bfe('0x51')]({'where':{'id':_0x4a777b[_0x7bfe('0x4b')]['id']}})[_0x7bfe('0x2b')](handleEntityNotFound(_0x161847,null))[_0x7bfe('0x2b')](function(_0x39d77a){if(_0x39d77a){return _0x39d77a[_0x7bfe('0x56')](_0x4a777b[_0x7bfe('0x4c')][_0x7bfe('0x57')]||[]);}return null;})['then'](respondWithResult(_0x161847,null))['catch'](handleError(_0x161847,null));}; \ No newline at end of file +var _0x9dae=['key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','update','destroy','getFields','findOne','FreshdeskField','order','filter','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','count','offset','limit','status','set','Content-Range','apply','reject','save','then','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x9dae,0x148));var _0xe9da=function(_0x5cab96,_0x215dbf){_0x5cab96=_0x5cab96-0x0;var _0x3a1993=_0x9dae[_0x5cab96];return _0x3a1993;};'use strict';var pdf=require(_0xe9da('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe9da('0x1'));var jsonpatch=require(_0xe9da('0x2'));var rp=require(_0xe9da('0x3'));var moment=require(_0xe9da('0x4'));var BPromise=require(_0xe9da('0x5'));var Mustache=require(_0xe9da('0x6'));var util=require(_0xe9da('0x7'));var path=require(_0xe9da('0x8'));var sox=require('sox');var csv=require(_0xe9da('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9da('0xa'));var squel=require(_0xe9da('0xb'));var crypto=require('crypto');var jsforce=require(_0xe9da('0xc'));var deskjs=require(_0xe9da('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe9da('0xe'));var Redis=require(_0xe9da('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe9da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9da('0x11'));var logger=require(_0xe9da('0x12'))(_0xe9da('0x13'));var utils=require('../../config/utils');var config=require(_0xe9da('0x14'));var licenseUtil=require(_0xe9da('0x15'));var db=require(_0xe9da('0x16'))['db'];var jayson=require(_0xe9da('0x17'));var client=jayson[_0xe9da('0x18')][_0xe9da('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x51efcc,_0x5ce04f,_0x718ba9,_0x4e385b){return new BPromise(function(_0x85cc0b,_0x5da6de){var _0x23c1c8=_0x4e385b||client;return _0x23c1c8[_0xe9da('0x1a')](_0x51efcc,_0x718ba9)['then'](function(_0x3875eb){logger[_0xe9da('0x1b')](_0xe9da('0x1c'),_0x5ce04f,'request\x20sent');logger['debug'](_0xe9da('0x1d'),_0x5ce04f,_0xe9da('0x1e'),JSON[_0xe9da('0x1f')](_0x3875eb));if(_0x3875eb[_0xe9da('0x20')]){if(_0x3875eb['error'][_0xe9da('0x21')]===0x1f4){logger[_0xe9da('0x20')](_0xe9da('0x1c'),_0x5ce04f,_0x3875eb['error']['message']);return _0x5da6de(_0x3875eb[_0xe9da('0x20')][_0xe9da('0x22')]);}logger[_0xe9da('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ce04f,_0x3875eb[_0xe9da('0x20')]['message']);return _0x85cc0b(_0x3875eb[_0xe9da('0x20')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5ce04f,_0xe9da('0x1e'));_0x85cc0b(_0x3875eb[_0xe9da('0x23')]['message']);}})[_0xe9da('0x24')](function(_0x8149cf){logger[_0xe9da('0x20')](_0xe9da('0x1c'),_0x5ce04f,_0x8149cf);_0x5da6de(_0x8149cf);});});}function respondWithStatusCode(_0x199444,_0x75b0cb){_0x75b0cb=_0x75b0cb||0xcc;return function(_0x4ee634){if(_0x4ee634){return _0x199444[_0xe9da('0x25')](_0x75b0cb);}return _0x199444['status'](_0x75b0cb)[_0xe9da('0x26')]();};}function respondWithResult(_0x4ad1ab,_0x96f0e4){_0x96f0e4=_0x96f0e4||0xc8;return function(_0x4475c3){if(_0x4475c3){return _0x4ad1ab['status'](_0x96f0e4)['json'](_0x4475c3);}};}function respondWithFilteredResult(_0x48f2a6,_0x5697ea){return function(_0x138ec6){if(_0x138ec6){var _0x12a8d5=_0x138ec6[_0xe9da('0x27')],_0x2a61ff=_0x5697ea['offset'],_0x523624=_0x5697ea[_0xe9da('0x28')]+_0x5697ea[_0xe9da('0x29')],_0x497ccf;if(_0x523624>=_0x12a8d5){_0x523624=_0x12a8d5;_0x497ccf=0xc8;}else{_0x497ccf=0xce;}_0x48f2a6[_0xe9da('0x2a')](_0x497ccf);return _0x48f2a6[_0xe9da('0x2b')](_0xe9da('0x2c'),_0x2a61ff+'-'+_0x523624+'/'+_0x12a8d5)['json'](_0x138ec6);}return null;};}function patchUpdates(_0x219023){return function(_0x4b8dad){try{jsonpatch[_0xe9da('0x2d')](_0x4b8dad,_0x219023,!![]);}catch(_0x7fda84){return BPromise[_0xe9da('0x2e')](_0x7fda84);}return _0x4b8dad[_0xe9da('0x2f')]();};}function saveUpdates(_0x2480b2,_0x3ff94b){return function(_0x2ccbfb){if(_0x2ccbfb){return _0x2ccbfb['update'](_0x2480b2)[_0xe9da('0x30')](function(_0x132604){return _0x132604;});}return null;};}function removeEntity(_0x5f22b2,_0x20e672){return function(_0x327e07){if(_0x327e07){return _0x327e07['destroy']()[_0xe9da('0x30')](function(){_0x5f22b2['status'](0xcc)[_0xe9da('0x26')]();});}};}function handleEntityNotFound(_0x389781,_0x44c546){return function(_0x30e129){if(!_0x30e129){_0x389781['sendStatus'](0x194);}return _0x30e129;};}function handleError(_0xb007bb,_0x3df74f){_0x3df74f=_0x3df74f||0x1f4;return function(_0x434695){logger[_0xe9da('0x20')](_0x434695[_0xe9da('0x31')]);if(_0x434695['name']){delete _0x434695[_0xe9da('0x32')];}_0xb007bb[_0xe9da('0x2a')](_0x3df74f)['send'](_0x434695);};}exports[_0xe9da('0x33')]=function(_0x5aa35d,_0x41837f){var _0x23b5e6={},_0x49ba5f={},_0x1d0323={'count':0x0,'rows':[]};var _0x3e4187=_[_0xe9da('0x34')](db[_0xe9da('0x35')][_0xe9da('0x36')],function(_0x574fb6){return{'name':_0x574fb6[_0xe9da('0x37')],'type':_0x574fb6['type'][_0xe9da('0x38')]};});_0x49ba5f['model']=_[_0xe9da('0x34')](_0x3e4187,_0xe9da('0x32'));_0x49ba5f[_0xe9da('0x39')]=_[_0xe9da('0x3a')](_0x5aa35d[_0xe9da('0x39')]);_0x49ba5f[_0xe9da('0x3b')]=_[_0xe9da('0x3c')](_0x49ba5f['model'],_0x49ba5f[_0xe9da('0x39')]);_0x23b5e6[_0xe9da('0x3d')]=_['intersection'](_0x49ba5f[_0xe9da('0x3e')],qs[_0xe9da('0x3f')](_0x5aa35d[_0xe9da('0x39')][_0xe9da('0x3f')]));_0x23b5e6['attributes']=_0x23b5e6['attributes'][_0xe9da('0x40')]?_0x23b5e6[_0xe9da('0x3d')]:_0x49ba5f[_0xe9da('0x3e')];if(!_0x5aa35d[_0xe9da('0x39')]['hasOwnProperty'](_0xe9da('0x41'))){_0x23b5e6['limit']=qs[_0xe9da('0x29')](_0x5aa35d[_0xe9da('0x39')][_0xe9da('0x29')]);_0x23b5e6['offset']=qs[_0xe9da('0x28')](_0x5aa35d[_0xe9da('0x39')]['offset']);}_0x23b5e6['order']=qs[_0xe9da('0x42')](_0x5aa35d['query'][_0xe9da('0x42')]);_0x23b5e6[_0xe9da('0x43')]=qs['filters'](_[_0xe9da('0x44')](_0x5aa35d[_0xe9da('0x39')],_0x49ba5f[_0xe9da('0x3b')]),_0x3e4187);if(_0x5aa35d[_0xe9da('0x39')]['filter']){_0x23b5e6[_0xe9da('0x43')]=_[_0xe9da('0x45')](_0x23b5e6['where'],{'$or':_['map'](_0x3e4187,function(_0x59a146){if(_0x59a146[_0xe9da('0x46')]!==_0xe9da('0x47')){var _0x2637d3={};_0x2637d3[_0x59a146[_0xe9da('0x32')]]={'$like':'%'+_0x5aa35d[_0xe9da('0x39')]['filter']+'%'};return _0x2637d3;}})});}_0x23b5e6=_['merge']({},_0x23b5e6,_0x5aa35d['options']);var _0x11be20={'where':_0x23b5e6['where']};return db[_0xe9da('0x35')][_0xe9da('0x27')](_0x11be20)[_0xe9da('0x30')](function(_0x1ea881){_0x1d0323[_0xe9da('0x27')]=_0x1ea881;if(_0x5aa35d[_0xe9da('0x39')][_0xe9da('0x48')]){_0x23b5e6[_0xe9da('0x49')]=[{'all':!![]}];}return db[_0xe9da('0x35')][_0xe9da('0x4a')](_0x23b5e6);})[_0xe9da('0x30')](function(_0xa20c65){_0x1d0323[_0xe9da('0x4b')]=_0xa20c65;return _0x1d0323;})[_0xe9da('0x30')](respondWithFilteredResult(_0x41837f,_0x23b5e6))[_0xe9da('0x24')](handleError(_0x41837f,null));};exports[_0xe9da('0x4c')]=function(_0x70fee8,_0x49d2df){var _0x5abbe1={'raw':![],'where':{'id':_0x70fee8[_0xe9da('0x4d')]['id']}},_0x207b02={};_0x207b02[_0xe9da('0x3e')]=_[_0xe9da('0x3a')](db[_0xe9da('0x35')][_0xe9da('0x36')]);_0x207b02[_0xe9da('0x39')]=_['keys'](_0x70fee8[_0xe9da('0x39')]);_0x207b02[_0xe9da('0x3b')]=_[_0xe9da('0x3c')](_0x207b02[_0xe9da('0x3e')],_0x207b02[_0xe9da('0x39')]);_0x5abbe1[_0xe9da('0x3d')]=_['intersection'](_0x207b02[_0xe9da('0x3e')],qs[_0xe9da('0x3f')](_0x70fee8['query'][_0xe9da('0x3f')]));_0x5abbe1['attributes']=_0x5abbe1[_0xe9da('0x3d')][_0xe9da('0x40')]?_0x5abbe1[_0xe9da('0x3d')]:_0x207b02['model'];if(_0x70fee8[_0xe9da('0x39')][_0xe9da('0x48')]){_0x5abbe1[_0xe9da('0x49')]=[{'all':!![]}];}_0x5abbe1=_[_0xe9da('0x45')]({},_0x5abbe1,_0x70fee8[_0xe9da('0x4e')]);return db[_0xe9da('0x35')][_0xe9da('0x4f')](_0x5abbe1)['then'](handleEntityNotFound(_0x49d2df,null))['then'](respondWithResult(_0x49d2df,null))[_0xe9da('0x24')](handleError(_0x49d2df,null));};exports[_0xe9da('0x50')]=function(_0x441234,_0x164d25){return db[_0xe9da('0x35')][_0xe9da('0x50')](_0x441234[_0xe9da('0x51')],{})[_0xe9da('0x30')](respondWithResult(_0x164d25,0xc9))['catch'](handleError(_0x164d25,null));};exports[_0xe9da('0x52')]=function(_0x53c85f,_0x56f076){if(_0x53c85f[_0xe9da('0x51')]['id']){delete _0x53c85f[_0xe9da('0x51')]['id'];}return db[_0xe9da('0x35')][_0xe9da('0x4f')]({'where':{'id':_0x53c85f['params']['id']}})['then'](handleEntityNotFound(_0x56f076,null))['then'](saveUpdates(_0x53c85f[_0xe9da('0x51')],null))['then'](respondWithResult(_0x56f076,null))[_0xe9da('0x24')](handleError(_0x56f076,null));};exports[_0xe9da('0x53')]=function(_0x57382d,_0x7aab28){return db[_0xe9da('0x35')]['find']({'where':{'id':_0x57382d[_0xe9da('0x4d')]['id']}})[_0xe9da('0x30')](handleEntityNotFound(_0x7aab28,null))['then'](removeEntity(_0x7aab28,null))['catch'](handleError(_0x7aab28,null));};exports[_0xe9da('0x54')]=function(_0x3666c3,_0x323534,_0x486128){var _0x5f34c6={};var _0x18d0f7={};var _0x15880d;var _0x876591;return db['FreshdeskConfiguration'][_0xe9da('0x55')]({'where':{'id':_0x3666c3['params']['id']}})[_0xe9da('0x30')](handleEntityNotFound(_0x323534,null))[_0xe9da('0x30')](function(_0x2b065e){if(_0x2b065e){_0x15880d=_0x2b065e;_0x18d0f7[_0xe9da('0x3e')]=_[_0xe9da('0x3a')](db[_0xe9da('0x56')]['rawAttributes']);_0x18d0f7['query']=_['keys'](_0x3666c3['query']);_0x18d0f7[_0xe9da('0x3b')]=_[_0xe9da('0x3c')](_0x18d0f7['model'],_0x18d0f7['query']);_0x5f34c6['attributes']=_[_0xe9da('0x3c')](_0x18d0f7[_0xe9da('0x3e')],qs[_0xe9da('0x3f')](_0x3666c3[_0xe9da('0x39')][_0xe9da('0x3f')]));_0x5f34c6['attributes']=_0x5f34c6[_0xe9da('0x3d')][_0xe9da('0x40')]?_0x5f34c6['attributes']:_0x18d0f7[_0xe9da('0x3e')];_0x5f34c6[_0xe9da('0x57')]=qs[_0xe9da('0x42')](_0x3666c3[_0xe9da('0x39')][_0xe9da('0x42')]);_0x5f34c6['where']=qs[_0xe9da('0x3b')](_[_0xe9da('0x44')](_0x3666c3['query'],_0x18d0f7[_0xe9da('0x3b')]));if(_0x3666c3['query'][_0xe9da('0x58')]){_0x5f34c6[_0xe9da('0x43')]=_[_0xe9da('0x45')](_0x5f34c6[_0xe9da('0x43')],{'$or':_['map'](_0x5f34c6[_0xe9da('0x3d')],function(_0x3614fa){var _0x3bce65={};_0x3bce65[_0x3614fa]={'$like':'%'+_0x3666c3[_0xe9da('0x39')][_0xe9da('0x58')]+'%'};return _0x3bce65;})});}_0x5f34c6=_['merge']({},_0x5f34c6,_0x3666c3['options']);return _0x15880d[_0xe9da('0x54')](_0x5f34c6);}})['then'](function(_0x48f6b3){if(_0x48f6b3){_0x876591=_0x48f6b3[_0xe9da('0x40')];if(!_0x3666c3[_0xe9da('0x39')]['hasOwnProperty'](_0xe9da('0x41'))){_0x5f34c6['limit']=qs[_0xe9da('0x29')](_0x3666c3[_0xe9da('0x39')][_0xe9da('0x29')]);_0x5f34c6['offset']=qs[_0xe9da('0x28')](_0x3666c3['query'][_0xe9da('0x28')]);}return _0x15880d[_0xe9da('0x54')](_0x5f34c6);}})[_0xe9da('0x30')](function(_0x4f6461){if(_0x4f6461){return _0x4f6461?{'count':_0x876591,'rows':_0x4f6461}:null;}})['then'](respondWithResult(_0x323534,null))[_0xe9da('0x24')](handleError(_0x323534,null));};exports[_0xe9da('0x59')]=function(_0x15e6ec,_0x4dcd2f,_0x2ac66a){var _0x5df249={};var _0x2b4e0a={};var _0x5a3997;var _0x47631f;return db[_0xe9da('0x35')][_0xe9da('0x55')]({'where':{'id':_0x15e6ec[_0xe9da('0x4d')]['id']}})[_0xe9da('0x30')](handleEntityNotFound(_0x4dcd2f,null))['then'](function(_0x5557a4){if(_0x5557a4){_0x5a3997=_0x5557a4;_0x2b4e0a['model']=_[_0xe9da('0x3a')](db[_0xe9da('0x56')][_0xe9da('0x36')]);_0x2b4e0a[_0xe9da('0x39')]=_[_0xe9da('0x3a')](_0x15e6ec[_0xe9da('0x39')]);_0x2b4e0a[_0xe9da('0x3b')]=_['intersection'](_0x2b4e0a[_0xe9da('0x3e')],_0x2b4e0a[_0xe9da('0x39')]);_0x5df249['attributes']=_[_0xe9da('0x3c')](_0x2b4e0a['model'],qs['fields'](_0x15e6ec[_0xe9da('0x39')][_0xe9da('0x3f')]));_0x5df249[_0xe9da('0x3d')]=_0x5df249[_0xe9da('0x3d')][_0xe9da('0x40')]?_0x5df249[_0xe9da('0x3d')]:_0x2b4e0a[_0xe9da('0x3e')];_0x5df249['order']=qs[_0xe9da('0x42')](_0x15e6ec[_0xe9da('0x39')][_0xe9da('0x42')]);_0x5df249[_0xe9da('0x43')]=qs[_0xe9da('0x3b')](_[_0xe9da('0x44')](_0x15e6ec[_0xe9da('0x39')],_0x2b4e0a['filters']));if(_0x15e6ec['query']['filter']){_0x5df249[_0xe9da('0x43')]=_[_0xe9da('0x45')](_0x5df249[_0xe9da('0x43')],{'$or':_[_0xe9da('0x34')](_0x5df249['attributes'],function(_0x3852c5){var _0x484fb4={};_0x484fb4[_0x3852c5]={'$like':'%'+_0x15e6ec[_0xe9da('0x39')][_0xe9da('0x58')]+'%'};return _0x484fb4;})});}_0x5df249=_['merge']({},_0x5df249,_0x15e6ec[_0xe9da('0x4e')]);return _0x5a3997['getSubjects'](_0x5df249);}})[_0xe9da('0x30')](function(_0x54146d){if(_0x54146d){_0x47631f=_0x54146d[_0xe9da('0x40')];if(!_0x15e6ec[_0xe9da('0x39')][_0xe9da('0x5a')](_0xe9da('0x41'))){_0x5df249['limit']=qs[_0xe9da('0x29')](_0x15e6ec[_0xe9da('0x39')][_0xe9da('0x29')]);_0x5df249[_0xe9da('0x28')]=qs[_0xe9da('0x28')](_0x15e6ec[_0xe9da('0x39')]['offset']);}return _0x5a3997['getSubjects'](_0x5df249);}})[_0xe9da('0x30')](function(_0xdc1c57){if(_0xdc1c57){return _0xdc1c57?{'count':_0x47631f,'rows':_0xdc1c57}:null;}})[_0xe9da('0x30')](respondWithResult(_0x4dcd2f,null))[_0xe9da('0x24')](handleError(_0x4dcd2f,null));};exports[_0xe9da('0x5b')]=function(_0x53f59c,_0x2f831b,_0xc9e8f7){var _0x14fc3f={};var _0x159f92={};var _0x95db7e;var _0x3bbf8f;return db[_0xe9da('0x35')][_0xe9da('0x55')]({'where':{'id':_0x53f59c['params']['id']}})[_0xe9da('0x30')](handleEntityNotFound(_0x2f831b,null))[_0xe9da('0x30')](function(_0x50a71c){if(_0x50a71c){_0x95db7e=_0x50a71c;_0x159f92['model']=_[_0xe9da('0x3a')](db[_0xe9da('0x56')][_0xe9da('0x36')]);_0x159f92[_0xe9da('0x39')]=_[_0xe9da('0x3a')](_0x53f59c[_0xe9da('0x39')]);_0x159f92[_0xe9da('0x3b')]=_[_0xe9da('0x3c')](_0x159f92[_0xe9da('0x3e')],_0x159f92['query']);_0x14fc3f[_0xe9da('0x3d')]=_[_0xe9da('0x3c')](_0x159f92[_0xe9da('0x3e')],qs[_0xe9da('0x3f')](_0x53f59c['query'][_0xe9da('0x3f')]));_0x14fc3f[_0xe9da('0x3d')]=_0x14fc3f['attributes'][_0xe9da('0x40')]?_0x14fc3f[_0xe9da('0x3d')]:_0x159f92['model'];_0x14fc3f[_0xe9da('0x57')]=qs[_0xe9da('0x42')](_0x53f59c[_0xe9da('0x39')][_0xe9da('0x42')]);_0x14fc3f[_0xe9da('0x43')]=qs[_0xe9da('0x3b')](_[_0xe9da('0x44')](_0x53f59c[_0xe9da('0x39')],_0x159f92[_0xe9da('0x3b')]));if(_0x53f59c['query'][_0xe9da('0x58')]){_0x14fc3f[_0xe9da('0x43')]=_[_0xe9da('0x45')](_0x14fc3f[_0xe9da('0x43')],{'$or':_[_0xe9da('0x34')](_0x14fc3f[_0xe9da('0x3d')],function(_0x1c6594){var _0xf4b9cb={};_0xf4b9cb[_0x1c6594]={'$like':'%'+_0x53f59c[_0xe9da('0x39')][_0xe9da('0x58')]+'%'};return _0xf4b9cb;})});}_0x14fc3f=_['merge']({},_0x14fc3f,_0x53f59c['options']);return _0x95db7e[_0xe9da('0x5b')](_0x14fc3f);}})[_0xe9da('0x30')](function(_0x4c90b0){if(_0x4c90b0){_0x3bbf8f=_0x4c90b0[_0xe9da('0x40')];if(!_0x53f59c['query'][_0xe9da('0x5a')]('nolimit')){_0x14fc3f[_0xe9da('0x29')]=qs[_0xe9da('0x29')](_0x53f59c[_0xe9da('0x39')][_0xe9da('0x29')]);_0x14fc3f[_0xe9da('0x28')]=qs[_0xe9da('0x28')](_0x53f59c[_0xe9da('0x39')][_0xe9da('0x28')]);}return _0x95db7e[_0xe9da('0x5b')](_0x14fc3f);}})[_0xe9da('0x30')](function(_0x150977){if(_0x150977){return _0x150977?{'count':_0x3bbf8f,'rows':_0x150977}:null;}})['then'](respondWithResult(_0x2f831b,null))['catch'](handleError(_0x2f831b,null));};exports[_0xe9da('0x5c')]=function(_0x2179d2,_0xfd2237,_0x33d765){var _0x40ac46={};var _0x295d10={};var _0x1f7958;var _0x2f401c;return db[_0xe9da('0x35')]['findOne']({'where':{'id':_0x2179d2['params']['id']}})[_0xe9da('0x30')](handleEntityNotFound(_0xfd2237,null))[_0xe9da('0x30')](function(_0x3083a2){if(_0x3083a2){_0x1f7958=_0x3083a2;_0x295d10['model']=_[_0xe9da('0x3a')](db[_0xe9da('0x5d')][_0xe9da('0x36')]);_0x295d10[_0xe9da('0x39')]=_[_0xe9da('0x3a')](_0x2179d2[_0xe9da('0x39')]);_0x295d10[_0xe9da('0x3b')]=_[_0xe9da('0x3c')](_0x295d10[_0xe9da('0x3e')],_0x295d10[_0xe9da('0x39')]);_0x40ac46[_0xe9da('0x3d')]=_[_0xe9da('0x3c')](_0x295d10['model'],qs[_0xe9da('0x3f')](_0x2179d2[_0xe9da('0x39')][_0xe9da('0x3f')]));_0x40ac46[_0xe9da('0x3d')]=_0x40ac46['attributes']['length']?_0x40ac46[_0xe9da('0x3d')]:_0x295d10[_0xe9da('0x3e')];_0x40ac46[_0xe9da('0x57')]=qs['sort'](_0x2179d2[_0xe9da('0x39')]['sort']);_0x40ac46['where']=qs[_0xe9da('0x3b')](_[_0xe9da('0x44')](_0x2179d2[_0xe9da('0x39')],_0x295d10[_0xe9da('0x3b')]));if(_0x2179d2[_0xe9da('0x39')][_0xe9da('0x58')]){_0x40ac46[_0xe9da('0x43')]=_[_0xe9da('0x45')](_0x40ac46[_0xe9da('0x43')],{'$or':_[_0xe9da('0x34')](_0x40ac46['attributes'],function(_0x4b1004){var _0x3d84ef={};_0x3d84ef[_0x4b1004]={'$like':'%'+_0x2179d2[_0xe9da('0x39')][_0xe9da('0x58')]+'%'};return _0x3d84ef;})});}_0x40ac46=_[_0xe9da('0x45')]({},_0x40ac46,_0x2179d2[_0xe9da('0x4e')]);return _0x1f7958[_0xe9da('0x5c')](_0x40ac46);}})[_0xe9da('0x30')](function(_0x150474){if(_0x150474){_0x2f401c=_0x150474[_0xe9da('0x40')];if(!_0x2179d2[_0xe9da('0x39')][_0xe9da('0x5a')]('nolimit')){_0x40ac46['limit']=qs[_0xe9da('0x29')](_0x2179d2[_0xe9da('0x39')][_0xe9da('0x29')]);_0x40ac46[_0xe9da('0x28')]=qs[_0xe9da('0x28')](_0x2179d2['query'][_0xe9da('0x28')]);}return _0x1f7958['getTags'](_0x40ac46);}})[_0xe9da('0x30')](function(_0x53d5e3){if(_0x53d5e3){return _0x53d5e3?{'count':_0x2f401c,'rows':_0x53d5e3}:null;}})['then'](respondWithResult(_0xfd2237,null))[_0xe9da('0x24')](handleError(_0xfd2237,null));};exports[_0xe9da('0x5e')]=function(_0x5804b3,_0x2a0f18,_0x1bae14){if(_0x5804b3['body']['id']){delete _0x5804b3['body']['id'];}return db[_0xe9da('0x35')][_0xe9da('0x55')]({'where':{'id':_0x5804b3[_0xe9da('0x4d')]['id']}})[_0xe9da('0x30')](handleEntityNotFound(_0x2a0f18,null))[_0xe9da('0x30')](function(_0x1aa057){if(_0x1aa057){return _0x1aa057[_0xe9da('0x5e')](_0x5804b3[_0xe9da('0x51')][_0xe9da('0x5f')]||[]);}return null;})[_0xe9da('0x30')](respondWithResult(_0x2a0f18,null))[_0xe9da('0x24')](handleError(_0x2a0f18,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3a35cda..a9a09b5 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 _0x6bba=['api','moment','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger'];(function(_0x42f270,_0x452dec){var _0x57bc5b=function(_0x258159){while(--_0x258159){_0x42f270['push'](_0x42f270['shift']());}};_0x57bc5b(++_0x452dec);}(_0x6bba,0x15f));var _0xa6bb=function(_0x1cc8a2,_0x5dce88){_0x1cc8a2=_0x1cc8a2-0x0;var _0xadb7a6=_0x6bba[_0x1cc8a2];return _0xadb7a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa6bb('0x0'))(_0xa6bb('0x1'));var moment=require(_0xa6bb('0x2'));var BPromise=require('bluebird');var rp=require(_0xa6bb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa6bb('0x4'));var attributes=require(_0xa6bb('0x5'));module['exports']=function(_0x138ee5,_0x155856){return _0x138ee5['define'](_0xa6bb('0x6'),attributes,{'tableName':_0xa6bb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca7a=['util','api','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x12f27d,_0x241d85){var _0x54d3fd=function(_0x442df1){while(--_0x442df1){_0x12f27d['push'](_0x12f27d['shift']());}};_0x54d3fd(++_0x241d85);}(_0xca7a,0x8f));var _0xaca7=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0xca7a[_0x197065];return _0x3d9404;};'use strict';var _=require(_0xaca7('0x0'));var util=require(_0xaca7('0x1'));var logger=require('../../config/logger')(_0xaca7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaca7('0x3'));var fs=require('fs');var path=require(_0xaca7('0x4'));var rimraf=require(_0xaca7('0x5'));var config=require(_0xaca7('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xaca7('0x7')]=function(_0x57849f,_0x1ab7d8){return _0x57849f[_0xaca7('0x8')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index cd307ff..28195c4 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 _0x8880=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x8880,0xb9));var _0x0888=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x8880[_0x241424];return _0x3da798;};'use strict';var _=require(_0x0888('0x0'));var util=require('util');var moment=require(_0x0888('0x1'));var BPromise=require('bluebird');var rs=require(_0x0888('0x2'));var fs=require('fs');var Redis=require(_0x0888('0x3'));var db=require(_0x0888('0x4'))['db'];var utils=require(_0x0888('0x5'));var logger=require(_0x0888('0x6'))(_0x0888('0x7'));var config=require(_0x0888('0x8'));var jayson=require(_0x0888('0x9'));var client=jayson[_0x0888('0xa')][_0x0888('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x154ead,_0x40f7c5,_0xe024f3){return new BPromise(function(_0x3ddc00,_0x3fdca2){return client[_0x0888('0xc')](_0x154ead,_0xe024f3)[_0x0888('0xd')](function(_0x52845a){logger['info'](_0x0888('0xe'),_0x40f7c5,_0x0888('0xf'));logger['debug'](_0x0888('0x10'),_0x40f7c5,'request\x20sent',JSON[_0x0888('0x11')](_0x52845a));if(_0x52845a[_0x0888('0x12')]){if(_0x52845a[_0x0888('0x12')]['code']===0x1f4){logger['error'](_0x0888('0xe'),_0x40f7c5,_0x52845a['error'][_0x0888('0x13')]);return _0x3fdca2(_0x52845a[_0x0888('0x12')][_0x0888('0x13')]);}logger[_0x0888('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x40f7c5,_0x52845a[_0x0888('0x12')][_0x0888('0x13')]);return _0x3ddc00(_0x52845a[_0x0888('0x12')]['message']);}else{logger['info'](_0x0888('0xe'),_0x40f7c5,_0x0888('0xf'));_0x3ddc00(_0x52845a[_0x0888('0x14')][_0x0888('0x13')]);}})['catch'](function(_0xf404e2){logger['error'](_0x0888('0xe'),_0x40f7c5,_0xf404e2);_0x3fdca2(_0xf404e2);});});} \ No newline at end of file +var _0x49b1=['../../config/environment','client','http','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','FreshdeskConfiguration,\x20%s,\x20%s','info','result','lodash','util','moment','randomstring','../../config/utils'];(function(_0x18f288,_0x189071){var _0x240a58=function(_0x33b361){while(--_0x33b361){_0x18f288['push'](_0x18f288['shift']());}};_0x240a58(++_0x189071);}(_0x49b1,0x163));var _0x149b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x49b1[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x149b('0x0'));var util=require(_0x149b('0x1'));var moment=require(_0x149b('0x2'));var BPromise=require('bluebird');var rs=require(_0x149b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x149b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x149b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x149b('0x6')][_0x149b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c6dc3,_0x96276f,_0x4d2b12){return new BPromise(function(_0x1e05bb,_0x393d09){return client[_0x149b('0x8')](_0x4c6dc3,_0x4d2b12)[_0x149b('0x9')](function(_0x32cdf5){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x96276f,_0x149b('0xa'));logger[_0x149b('0xb')](_0x149b('0xc'),_0x96276f,_0x149b('0xa'),JSON['stringify'](_0x32cdf5));if(_0x32cdf5[_0x149b('0xd')]){if(_0x32cdf5[_0x149b('0xd')]['code']===0x1f4){logger[_0x149b('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x96276f,_0x32cdf5[_0x149b('0xd')][_0x149b('0xe')]);return _0x393d09(_0x32cdf5[_0x149b('0xd')]['message']);}logger[_0x149b('0xd')](_0x149b('0xf'),_0x96276f,_0x32cdf5[_0x149b('0xd')][_0x149b('0xe')]);return _0x1e05bb(_0x32cdf5[_0x149b('0xd')][_0x149b('0xe')]);}else{logger[_0x149b('0x10')](_0x149b('0xf'),_0x96276f,_0x149b('0xa'));_0x1e05bb(_0x32cdf5[_0x149b('0x11')]['message']);}})['catch'](function(_0x56f80a){logger[_0x149b('0xd')](_0x149b('0xf'),_0x96276f,_0x56f80a);_0x393d09(_0x56f80a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 3cafc63..8e925f8 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 _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x54a7b1,_0x5be69f){var _0x12c423=function(_0x1b9e49){while(--_0x1b9e49){_0x54a7b1['push'](_0x54a7b1['shift']());}};_0x12c423(++_0x5be69f);}(_0x3e74,0x175));var _0x43e7=function(_0x2d7445,_0xb5da1c){_0x2d7445=_0x2d7445-0x0;var _0x2977f5=_0x3e74[_0x2d7445];return _0x2977f5;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x34e8,0x12c));var _0x834e=function(_0x3feaa5,_0x50550c){_0x3feaa5=_0x3feaa5-0x0;var _0xafefe0=_0x34e8[_0x3feaa5];return _0xafefe0;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 06dd73c..1e574c6 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 _0xa378=['BOOLEAN','sequelize','exports','variable','customVariable','string','STRING','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa378,0xb9));var _0x8a37=function(_0x183fb0,_0x3d1d14){_0x183fb0=_0x183fb0-0x0;var _0x5d94ac=_0xa378[_0x183fb0];return _0x5d94ac;};'use strict';var Sequelize=require(_0x8a37('0x0'));module[_0x8a37('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8a37('0x2'),_0x8a37('0x3'),'keyValue'),'defaultValue':_0x8a37('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8a37('0x5')]},'keyType':{'type':Sequelize[_0x8a37('0x6')](_0x8a37('0x4'),_0x8a37('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a37('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8a37('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a37('0x5')]}}; \ No newline at end of file +var _0xf9fd=['sequelize','exports','ENUM','variable','customVariable','string','STRING'];(function(_0x2b64f9,_0x57ba7b){var _0x4ac0d3=function(_0x372df3){while(--_0x372df3){_0x2b64f9['push'](_0x2b64f9['shift']());}};_0x4ac0d3(++_0x57ba7b);}(_0xf9fd,0x118));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xdf9f('0x0'));module[_0xdf9f('0x1')]={'type':{'type':Sequelize[_0xdf9f('0x2')]('string',_0xdf9f('0x3'),_0xdf9f('0x4'),'keyValue'),'defaultValue':_0xdf9f('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdf9f('0x2')]('string',_0xdf9f('0x3'),_0xdf9f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdf9f('0x6')]},'nameField':{'type':Sequelize[_0xdf9f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf9f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c63e494..1296fd4 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 _0xb73c=['../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','create','update','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xb73c,0xd2));var _0xcb73=function(_0x1a1176,_0x27b39e){_0x1a1176=_0x1a1176-0x0;var _0x3a3423=_0xb73c[_0x1a1176];return _0x3a3423;};'use strict';var pdf=require(_0xcb73('0x0'));var emlformat=require(_0xcb73('0x1'));var rimraf=require(_0xcb73('0x2'));var zipdir=require(_0xcb73('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb73('0x4'));var moment=require(_0xcb73('0x5'));var BPromise=require(_0xcb73('0x6'));var Mustache=require('mustache');var util=require(_0xcb73('0x7'));var path=require(_0xcb73('0x8'));var sox=require(_0xcb73('0x9'));var csv=require(_0xcb73('0xa'));var ejs=require(_0xcb73('0xb'));var fs=require('fs');var _=require(_0xcb73('0xc'));var squel=require(_0xcb73('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcb73('0xe'));var toCsv=require(_0xcb73('0xa'));var querystring=require(_0xcb73('0xf'));var Papa=require(_0xcb73('0x10'));var Redis=require('ioredis');var authService=require(_0xcb73('0x11'));var qs=require(_0xcb73('0x12'));var as=require(_0xcb73('0x13'));var hardwareService=require(_0xcb73('0x14'));var logger=require(_0xcb73('0x15'))(_0xcb73('0x16'));var utils=require(_0xcb73('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcb73('0x18'));var db=require(_0xcb73('0x19'))['db'];function respondWithStatusCode(_0x3630f7,_0x2bbbc3){_0x2bbbc3=_0x2bbbc3||0xcc;return function(_0x1b7583){if(_0x1b7583){return _0x3630f7[_0xcb73('0x1a')](_0x2bbbc3);}return _0x3630f7[_0xcb73('0x1b')](_0x2bbbc3)['end']();};}function respondWithResult(_0x8bb139,_0x198b6c){_0x198b6c=_0x198b6c||0xc8;return function(_0x1b1023){if(_0x1b1023){return _0x8bb139['status'](_0x198b6c)[_0xcb73('0x1c')](_0x1b1023);}};}function respondWithFilteredResult(_0x557228,_0x442cd4){return function(_0x2ac681){if(_0x2ac681){var _0x318b2e=_0x2ac681[_0xcb73('0x1d')],_0x3caeed=_0x442cd4[_0xcb73('0x1e')],_0x3f9896=_0x442cd4[_0xcb73('0x1e')]+_0x442cd4[_0xcb73('0x1f')],_0x2f8cea;if(_0x3f9896>=_0x318b2e){_0x3f9896=_0x318b2e;_0x2f8cea=0xc8;}else{_0x2f8cea=0xce;}_0x557228[_0xcb73('0x1b')](_0x2f8cea);return _0x557228[_0xcb73('0x20')](_0xcb73('0x21'),_0x3caeed+'-'+_0x3f9896+'/'+_0x318b2e)[_0xcb73('0x1c')](_0x2ac681);}return null;};}function patchUpdates(_0x4fe854){return function(_0x5e2a7e){try{jsonpatch[_0xcb73('0x22')](_0x5e2a7e,_0x4fe854,!![]);}catch(_0x259368){return BPromise[_0xcb73('0x23')](_0x259368);}return _0x5e2a7e[_0xcb73('0x24')]();};}function saveUpdates(_0x401f6f,_0x18bc38){return function(_0x507b17){if(_0x507b17){return _0x507b17['update'](_0x401f6f)[_0xcb73('0x25')](function(_0x59f1ca){return _0x59f1ca;});}return null;};}function removeEntity(_0x500e8e,_0x4ba46c){return function(_0x1d2062){if(_0x1d2062){return _0x1d2062[_0xcb73('0x26')]()[_0xcb73('0x25')](function(){_0x500e8e[_0xcb73('0x1b')](0xcc)[_0xcb73('0x27')]();});}};}function handleEntityNotFound(_0x456607,_0x3d8022){return function(_0x34eddc){if(!_0x34eddc){_0x456607[_0xcb73('0x1a')](0x194);}return _0x34eddc;};}function handleError(_0x319a2e,_0xbbb62b){_0xbbb62b=_0xbbb62b||0x1f4;return function(_0x4ef666){logger[_0xcb73('0x28')](_0x4ef666['stack']);if(_0x4ef666[_0xcb73('0x29')]){delete _0x4ef666['name'];}_0x319a2e[_0xcb73('0x1b')](_0xbbb62b)[_0xcb73('0x2a')](_0x4ef666);};}exports[_0xcb73('0x2b')]=function(_0x15c1d0,_0x4689ec){var _0x1f21f5={},_0x260a37={},_0x187812={'count':0x0,'rows':[]};var _0x1a077b=_[_0xcb73('0x2c')](db['FreshdeskField']['rawAttributes'],function(_0x39599d){return{'name':_0x39599d[_0xcb73('0x2d')],'type':_0x39599d[_0xcb73('0x2e')][_0xcb73('0x2f')]};});_0x260a37[_0xcb73('0x30')]=_[_0xcb73('0x2c')](_0x1a077b,'name');_0x260a37[_0xcb73('0x31')]=_['keys'](_0x15c1d0[_0xcb73('0x31')]);_0x260a37[_0xcb73('0x32')]=_['intersection'](_0x260a37[_0xcb73('0x30')],_0x260a37[_0xcb73('0x31')]);_0x1f21f5[_0xcb73('0x33')]=_[_0xcb73('0x34')](_0x260a37[_0xcb73('0x30')],qs[_0xcb73('0x35')](_0x15c1d0['query'][_0xcb73('0x35')]));_0x1f21f5['attributes']=_0x1f21f5[_0xcb73('0x33')]['length']?_0x1f21f5[_0xcb73('0x33')]:_0x260a37[_0xcb73('0x30')];if(!_0x15c1d0[_0xcb73('0x31')][_0xcb73('0x36')](_0xcb73('0x37'))){_0x1f21f5['limit']=qs['limit'](_0x15c1d0['query'][_0xcb73('0x1f')]);_0x1f21f5[_0xcb73('0x1e')]=qs[_0xcb73('0x1e')](_0x15c1d0['query']['offset']);}_0x1f21f5[_0xcb73('0x38')]=qs[_0xcb73('0x39')](_0x15c1d0['query'][_0xcb73('0x39')]);_0x1f21f5[_0xcb73('0x3a')]=qs[_0xcb73('0x32')](_[_0xcb73('0x3b')](_0x15c1d0[_0xcb73('0x31')],_0x260a37[_0xcb73('0x32')]),_0x1a077b);if(_0x15c1d0[_0xcb73('0x31')][_0xcb73('0x3c')]){_0x1f21f5['where']=_[_0xcb73('0x3d')](_0x1f21f5[_0xcb73('0x3a')],{'$or':_['map'](_0x1a077b,function(_0x4b0b97){if(_0x4b0b97['type']!==_0xcb73('0x3e')){var _0x2ac505={};_0x2ac505[_0x4b0b97[_0xcb73('0x29')]]={'$like':'%'+_0x15c1d0[_0xcb73('0x31')][_0xcb73('0x3c')]+'%'};return _0x2ac505;}})});}_0x1f21f5=_[_0xcb73('0x3d')]({},_0x1f21f5,_0x15c1d0['options']);var _0x12c451={'where':_0x1f21f5[_0xcb73('0x3a')]};return db[_0xcb73('0x3f')][_0xcb73('0x1d')](_0x12c451)[_0xcb73('0x25')](function(_0x4365f8){_0x187812[_0xcb73('0x1d')]=_0x4365f8;if(_0x15c1d0[_0xcb73('0x31')][_0xcb73('0x40')]){_0x1f21f5[_0xcb73('0x41')]=[{'all':!![]}];}return db[_0xcb73('0x3f')][_0xcb73('0x42')](_0x1f21f5);})[_0xcb73('0x25')](function(_0x373e9f){_0x187812[_0xcb73('0x43')]=_0x373e9f;return _0x187812;})[_0xcb73('0x25')](respondWithFilteredResult(_0x4689ec,_0x1f21f5))[_0xcb73('0x44')](handleError(_0x4689ec,null));};exports[_0xcb73('0x45')]=function(_0x551d24,_0x2b302a){var _0x564cf8={'raw':!![],'where':{'id':_0x551d24[_0xcb73('0x46')]['id']}},_0x7debd3={};_0x7debd3[_0xcb73('0x30')]=_[_0xcb73('0x47')](db[_0xcb73('0x3f')][_0xcb73('0x48')]);_0x7debd3[_0xcb73('0x31')]=_[_0xcb73('0x47')](_0x551d24[_0xcb73('0x31')]);_0x7debd3['filters']=_[_0xcb73('0x34')](_0x7debd3[_0xcb73('0x30')],_0x7debd3[_0xcb73('0x31')]);_0x564cf8[_0xcb73('0x33')]=_[_0xcb73('0x34')](_0x7debd3[_0xcb73('0x30')],qs[_0xcb73('0x35')](_0x551d24[_0xcb73('0x31')][_0xcb73('0x35')]));_0x564cf8[_0xcb73('0x33')]=_0x564cf8['attributes']['length']?_0x564cf8[_0xcb73('0x33')]:_0x7debd3[_0xcb73('0x30')];if(_0x551d24[_0xcb73('0x31')][_0xcb73('0x40')]){_0x564cf8['include']=[{'all':!![]}];}_0x564cf8=_[_0xcb73('0x3d')]({},_0x564cf8,_0x551d24[_0xcb73('0x49')]);return db[_0xcb73('0x3f')]['find'](_0x564cf8)[_0xcb73('0x25')](handleEntityNotFound(_0x2b302a,null))[_0xcb73('0x25')](respondWithResult(_0x2b302a,null))[_0xcb73('0x44')](handleError(_0x2b302a,null));};exports[_0xcb73('0x4a')]=function(_0x4f9fcb,_0x51e277){return db['FreshdeskField']['create'](_0x4f9fcb['body'],{})[_0xcb73('0x25')](respondWithResult(_0x51e277,0xc9))[_0xcb73('0x44')](handleError(_0x51e277,null));};exports[_0xcb73('0x4b')]=function(_0x5e14e4,_0x248107){if(_0x5e14e4[_0xcb73('0x4c')]['id']){delete _0x5e14e4[_0xcb73('0x4c')]['id'];}return db[_0xcb73('0x3f')][_0xcb73('0x4d')]({'where':{'id':_0x5e14e4['params']['id']}})[_0xcb73('0x25')](handleEntityNotFound(_0x248107,null))[_0xcb73('0x25')](saveUpdates(_0x5e14e4['body'],null))['then'](respondWithResult(_0x248107,null))['catch'](handleError(_0x248107,null));};exports[_0xcb73('0x26')]=function(_0x51f1c0,_0x4ce564){return db[_0xcb73('0x3f')][_0xcb73('0x4d')]({'where':{'id':_0x51f1c0[_0xcb73('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ce564,null))[_0xcb73('0x25')](removeEntity(_0x4ce564,null))[_0xcb73('0x44')](handleError(_0x4ce564,null));}; \ No newline at end of file +var _0xc2b0=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xc2b0,0x13c));var _0x0c2b=function(_0x395155,_0x192ffd){_0x395155=_0x395155-0x0;var _0x179767=_0xc2b0[_0x395155];return _0x179767;};'use strict';var pdf=require(_0x0c2b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c2b('0x1'));var jsonpatch=require(_0x0c2b('0x2'));var rp=require('request-promise');var moment=require(_0x0c2b('0x3'));var BPromise=require(_0x0c2b('0x4'));var Mustache=require(_0x0c2b('0x5'));var util=require(_0x0c2b('0x6'));var path=require(_0x0c2b('0x7'));var sox=require('sox');var csv=require(_0x0c2b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c2b('0x9'));var squel=require('squel');var crypto=require(_0x0c2b('0xa'));var jsforce=require(_0x0c2b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0c2b('0x8'));var querystring=require(_0x0c2b('0xc'));var Papa=require(_0x0c2b('0xd'));var Redis=require('ioredis');var authService=require(_0x0c2b('0xe'));var qs=require(_0x0c2b('0xf'));var as=require(_0x0c2b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c2b('0x11'))('api');var utils=require(_0x0c2b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0c2b('0x13'));var db=require(_0x0c2b('0x14'))['db'];function respondWithStatusCode(_0x3b27e1,_0x477d67){_0x477d67=_0x477d67||0xcc;return function(_0x1b862f){if(_0x1b862f){return _0x3b27e1[_0x0c2b('0x15')](_0x477d67);}return _0x3b27e1[_0x0c2b('0x16')](_0x477d67)['end']();};}function respondWithResult(_0x292b18,_0x5aec89){_0x5aec89=_0x5aec89||0xc8;return function(_0x70c2e0){if(_0x70c2e0){return _0x292b18['status'](_0x5aec89)[_0x0c2b('0x17')](_0x70c2e0);}};}function respondWithFilteredResult(_0x1ad948,_0x1d7970){return function(_0x1f7741){if(_0x1f7741){var _0x1b4d3e=_0x1f7741[_0x0c2b('0x18')],_0xefaba7=_0x1d7970['offset'],_0x156b93=_0x1d7970[_0x0c2b('0x19')]+_0x1d7970[_0x0c2b('0x1a')],_0x220527;if(_0x156b93>=_0x1b4d3e){_0x156b93=_0x1b4d3e;_0x220527=0xc8;}else{_0x220527=0xce;}_0x1ad948[_0x0c2b('0x16')](_0x220527);return _0x1ad948[_0x0c2b('0x1b')](_0x0c2b('0x1c'),_0xefaba7+'-'+_0x156b93+'/'+_0x1b4d3e)[_0x0c2b('0x17')](_0x1f7741);}return null;};}function patchUpdates(_0x17af0f){return function(_0x16b0e1){try{jsonpatch[_0x0c2b('0x1d')](_0x16b0e1,_0x17af0f,!![]);}catch(_0x374f62){return BPromise[_0x0c2b('0x1e')](_0x374f62);}return _0x16b0e1[_0x0c2b('0x1f')]();};}function saveUpdates(_0x3e444a,_0x45a965){return function(_0x4bf2c5){if(_0x4bf2c5){return _0x4bf2c5[_0x0c2b('0x20')](_0x3e444a)[_0x0c2b('0x21')](function(_0x1adb0c){return _0x1adb0c;});}return null;};}function removeEntity(_0x42ab9d,_0x7123e7){return function(_0x4d5fe7){if(_0x4d5fe7){return _0x4d5fe7[_0x0c2b('0x22')]()[_0x0c2b('0x21')](function(){_0x42ab9d['status'](0xcc)[_0x0c2b('0x23')]();});}};}function handleEntityNotFound(_0x5e9411,_0x115f52){return function(_0x530431){if(!_0x530431){_0x5e9411[_0x0c2b('0x15')](0x194);}return _0x530431;};}function handleError(_0x284e47,_0x7cf8cd){_0x7cf8cd=_0x7cf8cd||0x1f4;return function(_0x19db3b){logger['error'](_0x19db3b[_0x0c2b('0x24')]);if(_0x19db3b[_0x0c2b('0x25')]){delete _0x19db3b['name'];}_0x284e47[_0x0c2b('0x16')](_0x7cf8cd)['send'](_0x19db3b);};}exports[_0x0c2b('0x26')]=function(_0x2d96ac,_0x542a54){var _0x173c30={},_0x4030ad={},_0x137bff={'count':0x0,'rows':[]};var _0x52a06c=_['map'](db[_0x0c2b('0x27')][_0x0c2b('0x28')],function(_0x1e09ed){return{'name':_0x1e09ed[_0x0c2b('0x29')],'type':_0x1e09ed[_0x0c2b('0x2a')]['key']};});_0x4030ad['model']=_[_0x0c2b('0x2b')](_0x52a06c,_0x0c2b('0x25'));_0x4030ad['query']=_[_0x0c2b('0x2c')](_0x2d96ac[_0x0c2b('0x2d')]);_0x4030ad[_0x0c2b('0x2e')]=_['intersection'](_0x4030ad[_0x0c2b('0x2f')],_0x4030ad[_0x0c2b('0x2d')]);_0x173c30[_0x0c2b('0x30')]=_[_0x0c2b('0x31')](_0x4030ad[_0x0c2b('0x2f')],qs[_0x0c2b('0x32')](_0x2d96ac[_0x0c2b('0x2d')][_0x0c2b('0x32')]));_0x173c30[_0x0c2b('0x30')]=_0x173c30['attributes']['length']?_0x173c30[_0x0c2b('0x30')]:_0x4030ad[_0x0c2b('0x2f')];if(!_0x2d96ac[_0x0c2b('0x2d')][_0x0c2b('0x33')](_0x0c2b('0x34'))){_0x173c30[_0x0c2b('0x1a')]=qs[_0x0c2b('0x1a')](_0x2d96ac[_0x0c2b('0x2d')][_0x0c2b('0x1a')]);_0x173c30[_0x0c2b('0x19')]=qs[_0x0c2b('0x19')](_0x2d96ac[_0x0c2b('0x2d')]['offset']);}_0x173c30[_0x0c2b('0x35')]=qs[_0x0c2b('0x36')](_0x2d96ac['query'][_0x0c2b('0x36')]);_0x173c30[_0x0c2b('0x37')]=qs[_0x0c2b('0x2e')](_[_0x0c2b('0x38')](_0x2d96ac[_0x0c2b('0x2d')],_0x4030ad['filters']),_0x52a06c);if(_0x2d96ac['query'][_0x0c2b('0x39')]){_0x173c30[_0x0c2b('0x37')]=_[_0x0c2b('0x3a')](_0x173c30[_0x0c2b('0x37')],{'$or':_[_0x0c2b('0x2b')](_0x52a06c,function(_0x513423){if(_0x513423['type']!=='VIRTUAL'){var _0x180a0a={};_0x180a0a[_0x513423[_0x0c2b('0x25')]]={'$like':'%'+_0x2d96ac[_0x0c2b('0x2d')][_0x0c2b('0x39')]+'%'};return _0x180a0a;}})});}_0x173c30=_[_0x0c2b('0x3a')]({},_0x173c30,_0x2d96ac[_0x0c2b('0x3b')]);var _0x14e12b={'where':_0x173c30['where']};return db[_0x0c2b('0x27')][_0x0c2b('0x18')](_0x14e12b)['then'](function(_0x351dde){_0x137bff[_0x0c2b('0x18')]=_0x351dde;if(_0x2d96ac[_0x0c2b('0x2d')][_0x0c2b('0x3c')]){_0x173c30[_0x0c2b('0x3d')]=[{'all':!![]}];}return db[_0x0c2b('0x27')][_0x0c2b('0x3e')](_0x173c30);})[_0x0c2b('0x21')](function(_0x147bb4){_0x137bff['rows']=_0x147bb4;return _0x137bff;})[_0x0c2b('0x21')](respondWithFilteredResult(_0x542a54,_0x173c30))[_0x0c2b('0x3f')](handleError(_0x542a54,null));};exports[_0x0c2b('0x40')]=function(_0x215770,_0x5603db){var _0x4f0995={'raw':!![],'where':{'id':_0x215770['params']['id']}},_0x5bc61b={};_0x5bc61b['model']=_[_0x0c2b('0x2c')](db[_0x0c2b('0x27')][_0x0c2b('0x28')]);_0x5bc61b[_0x0c2b('0x2d')]=_[_0x0c2b('0x2c')](_0x215770[_0x0c2b('0x2d')]);_0x5bc61b[_0x0c2b('0x2e')]=_['intersection'](_0x5bc61b[_0x0c2b('0x2f')],_0x5bc61b[_0x0c2b('0x2d')]);_0x4f0995['attributes']=_[_0x0c2b('0x31')](_0x5bc61b['model'],qs['fields'](_0x215770[_0x0c2b('0x2d')]['fields']));_0x4f0995['attributes']=_0x4f0995[_0x0c2b('0x30')]['length']?_0x4f0995[_0x0c2b('0x30')]:_0x5bc61b['model'];if(_0x215770[_0x0c2b('0x2d')][_0x0c2b('0x3c')]){_0x4f0995['include']=[{'all':!![]}];}_0x4f0995=_[_0x0c2b('0x3a')]({},_0x4f0995,_0x215770[_0x0c2b('0x3b')]);return db[_0x0c2b('0x27')][_0x0c2b('0x41')](_0x4f0995)['then'](handleEntityNotFound(_0x5603db,null))[_0x0c2b('0x21')](respondWithResult(_0x5603db,null))[_0x0c2b('0x3f')](handleError(_0x5603db,null));};exports[_0x0c2b('0x42')]=function(_0x407d57,_0x4a1e55){return db[_0x0c2b('0x27')][_0x0c2b('0x42')](_0x407d57[_0x0c2b('0x43')],{})[_0x0c2b('0x21')](respondWithResult(_0x4a1e55,0xc9))[_0x0c2b('0x3f')](handleError(_0x4a1e55,null));};exports[_0x0c2b('0x20')]=function(_0x9ba2aa,_0x1fe817){if(_0x9ba2aa[_0x0c2b('0x43')]['id']){delete _0x9ba2aa[_0x0c2b('0x43')]['id'];}return db[_0x0c2b('0x27')][_0x0c2b('0x41')]({'where':{'id':_0x9ba2aa['params']['id']}})[_0x0c2b('0x21')](handleEntityNotFound(_0x1fe817,null))[_0x0c2b('0x21')](saveUpdates(_0x9ba2aa['body'],null))['then'](respondWithResult(_0x1fe817,null))[_0x0c2b('0x3f')](handleError(_0x1fe817,null));};exports[_0x0c2b('0x22')]=function(_0x272c46,_0x35ae9f){return db['FreshdeskField'][_0x0c2b('0x41')]({'where':{'id':_0x272c46['params']['id']}})['then'](handleEntityNotFound(_0x35ae9f,null))['then'](removeEntity(_0x35ae9f,null))[_0x0c2b('0x3f')](handleError(_0x35ae9f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index fbe1f8b..ea196ee 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 _0xca13=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xca13,0x170));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3ca1('0x0'));var util=require('util');var logger=require(_0x3ca1('0x1'))(_0x3ca1('0x2'));var moment=require('moment');var BPromise=require(_0x3ca1('0x3'));var rp=require(_0x3ca1('0x4'));var fs=require('fs');var path=require(_0x3ca1('0x5'));var rimraf=require(_0x3ca1('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ca1('0x7'));module[_0x3ca1('0x8')]=function(_0x38cd83,_0x22201f){return _0x38cd83[_0x3ca1('0x9')](_0x3ca1('0xa'),attributes,{'tableName':_0x3ca1('0xb'),'paranoid':![],'indexes':[{'name':_0x3ca1('0xc'),'fields':['idField',_0x3ca1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa87a=['../../config/environment','./intFreshdeskField.attributes','exports','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x3bc642,_0x480870){var _0x4a66f3=function(_0x54fd19){while(--_0x54fd19){_0x3bc642['push'](_0x3bc642['shift']());}};_0x4a66f3(++_0x480870);}(_0xa87a,0x12e));var _0xaa87=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa87a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xaa87('0x0'));var util=require(_0xaa87('0x1'));var logger=require(_0xaa87('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa87('0x3'));var fs=require('fs');var path=require(_0xaa87('0x4'));var rimraf=require(_0xaa87('0x5'));var config=require(_0xaa87('0x6'));var attributes=require(_0xaa87('0x7'));module[_0xaa87('0x8')]=function(_0x53cb9e,_0x2953){return _0x53cb9e['define']('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xaa87('0x9'),'fields':['idField',_0xaa87('0xa')],'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 35c9e59..79a3793 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x5af825,_0x3a3e13){_0x5af825=_0x5af825-0x0;var _0xe2dce1=_0x7a54[_0x5af825];return _0xe2dce1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x520342,_0x17b1ef){var _0x5c94cf=function(_0xa1a9e9){while(--_0xa1a9e9){_0x520342['push'](_0x520342['shift']());}};_0x5c94cf(++_0x17b1ef);}(_0xb10b,0x12a));var _0xbb10=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0xb10b[_0x17dcd1];return _0x12af77;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 5507f4c..14f9834 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 _0x8f4d=['addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x25e8ba,_0x505fe3){var _0x341adb=function(_0x3a633a){while(--_0x3a633a){_0x25e8ba['push'](_0x25e8ba['shift']());}};_0x341adb(++_0x505fe3);}(_0x8f4d,0x195));var _0xd8f4=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x8f4d[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0xd8f4('0x0'));var util=require(_0xd8f4('0x1'));var path=require(_0xd8f4('0x2'));var timeout=require(_0xd8f4('0x3'));var express=require(_0xd8f4('0x4'));var router=express[_0xd8f4('0x5')]();var auth=require(_0xd8f4('0x6'));var interaction=require(_0xd8f4('0x7'));var config=require(_0xd8f4('0x8'));var controller=require(_0xd8f4('0x9'));router[_0xd8f4('0xa')]('/',auth[_0xd8f4('0xb')](),controller[_0xd8f4('0xc')]);router[_0xd8f4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd8f4('0xd')]);router[_0xd8f4('0xa')](_0xd8f4('0xe'),auth['isAuthenticated'](),controller[_0xd8f4('0xf')]);router[_0xd8f4('0xa')](_0xd8f4('0x10'),auth[_0xd8f4('0xb')](),controller[_0xd8f4('0x11')]);router[_0xd8f4('0x12')]('/',auth['isAuthenticated'](),controller[_0xd8f4('0x13')]);router['post'](_0xd8f4('0xe'),auth[_0xd8f4('0xb')](),controller[_0xd8f4('0x14')]);router[_0xd8f4('0x15')](_0xd8f4('0x16'),auth[_0xd8f4('0xb')](),controller['update']);router[_0xd8f4('0x17')](_0xd8f4('0x16'),auth[_0xd8f4('0xb')](),controller[_0xd8f4('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4382=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb4a17,_0x3ecda7){var _0x207b2b=function(_0x37af0a){while(--_0x37af0a){_0xb4a17['push'](_0xb4a17['shift']());}};_0x207b2b(++_0x3ecda7);}(_0x4382,0xb1));var _0x2438=function(_0x3d9248,_0x543e22){_0x3d9248=_0x3d9248-0x0;var _0x352c9f=_0x4382[_0x3d9248];return _0x352c9f;};'use strict';var multer=require(_0x2438('0x0'));var util=require('util');var path=require(_0x2438('0x1'));var timeout=require(_0x2438('0x2'));var express=require('express');var router=express[_0x2438('0x3')]();var auth=require(_0x2438('0x4'));var interaction=require(_0x2438('0x5'));var config=require(_0x2438('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x2438('0x7')]('/',auth[_0x2438('0x8')](),controller[_0x2438('0x9')]);router['get'](_0x2438('0xa'),auth[_0x2438('0x8')](),controller[_0x2438('0xb')]);router['get'](_0x2438('0xc'),auth[_0x2438('0x8')](),controller[_0x2438('0xd')]);router['get'](_0x2438('0xe'),auth[_0x2438('0x8')](),controller[_0x2438('0xf')]);router[_0x2438('0x10')]('/',auth['isAuthenticated'](),controller[_0x2438('0x11')]);router['post']('/:id/configurations',auth[_0x2438('0x8')](),controller[_0x2438('0x12')]);router[_0x2438('0x13')]('/:id',auth[_0x2438('0x8')](),controller[_0x2438('0x14')]);router[_0x2438('0x15')](_0x2438('0xa'),auth[_0x2438('0x8')](),controller[_0x2438('0x16')]);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 2aabf48..232a786 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 _0xf35e=['STRING','username','remoteUri','exports'];(function(_0x4d85ec,_0x130e08){var _0x519535=function(_0x40d55e){while(--_0x40d55e){_0x4d85ec['push'](_0x4d85ec['shift']());}};_0x519535(++_0x130e08);}(_0xf35e,0xe7));var _0xef35=function(_0x593b53,_0x4fb972){_0x593b53=_0x593b53-0x0;var _0x4e8696=_0xf35e[_0x593b53];return _0x4e8696;};'use strict';var Sequelize=require('sequelize');module[_0xef35('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef35('0x1')]},'username':{'type':Sequelize[_0xef35('0x1')],'unique':_0xef35('0x2')},'apiKey':{'type':Sequelize[_0xef35('0x1')]},'remoteUri':{'type':Sequelize[_0xef35('0x1')],'unique':_0xef35('0x3')},'serverUrl':{'type':Sequelize[_0xef35('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x620f=['sequelize','STRING','username'];(function(_0x1f2b56,_0x4df540){var _0x2e832d=function(_0x10477d){while(--_0x10477d){_0x1f2b56['push'](_0x1f2b56['shift']());}};_0x2e832d(++_0x4df540);}(_0x620f,0x69));var _0xf620=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x620f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf620('0x0'));module['exports']={'name':{'type':Sequelize[_0xf620('0x1')]},'description':{'type':Sequelize[_0xf620('0x1')]},'username':{'type':Sequelize[_0xf620('0x1')],'unique':_0xf620('0x2')},'apiKey':{'type':Sequelize[_0xf620('0x1')]},'remoteUri':{'type':Sequelize[_0xf620('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf620('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 2e43a4e..5a43457 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 _0x3140=['sendStatus','status','end','json','count','offset','limit','apply','reject','update','destroy','stack','name','send','FreshsalesAccount','type','query','keys','filters','model','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','intersection','fields','length','find','create','body','getConfigurations','FreshsalesConfiguration','rawAttributes','nolimit','findOne','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','stringify','test','statusCode','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0xfadc1a,_0xc6a189){var _0x1be3a4=function(_0x1a9107){while(--_0x1a9107){_0xfadc1a['push'](_0xfadc1a['shift']());}};_0x1be3a4(++_0xc6a189);}(_0x3140,0xaf));var _0x0314=function(_0x8d5de5,_0x143d83){_0x8d5de5=_0x8d5de5-0x0;var _0x400b7d=_0x3140[_0x8d5de5];return _0x400b7d;};'use strict';var pdf=require(_0x0314('0x0'));var emlformat=require(_0x0314('0x1'));var rimraf=require(_0x0314('0x2'));var zipdir=require(_0x0314('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0314('0x4'));var BPromise=require(_0x0314('0x5'));var Mustache=require(_0x0314('0x6'));var util=require(_0x0314('0x7'));var path=require(_0x0314('0x8'));var sox=require(_0x0314('0x9'));var csv=require(_0x0314('0xa'));var ejs=require(_0x0314('0xb'));var fs=require('fs');var _=require(_0x0314('0xc'));var squel=require(_0x0314('0xd'));var crypto=require(_0x0314('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0314('0xf'));var toCsv=require(_0x0314('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0314('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0314('0x11'));var as=require(_0x0314('0x12'));var hardwareService=require(_0x0314('0x13'));var logger=require(_0x0314('0x14'))(_0x0314('0x15'));var utils=require(_0x0314('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0314('0x17'));var db=require(_0x0314('0x18'))['db'];var integrations=require(_0x0314('0x19'));var jayson=require(_0x0314('0x1a'));var client=jayson[_0x0314('0x1b')][_0x0314('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x149b67,_0x53e271,_0x1c26ff,_0xbe0b07){return new BPromise(function(_0x1316a0,_0x12d026){var _0x40566e=_0xbe0b07||client;return _0x40566e[_0x0314('0x1d')](_0x149b67,_0x1c26ff)[_0x0314('0x1e')](function(_0x3ea356){logger['info'](_0x0314('0x1f'),_0x53e271,_0x0314('0x20'));logger[_0x0314('0x21')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x53e271,_0x0314('0x20'),JSON['stringify'](_0x3ea356));if(_0x3ea356['error']){if(_0x3ea356[_0x0314('0x22')][_0x0314('0x23')]===0x1f4){logger['error'](_0x0314('0x1f'),_0x53e271,_0x3ea356[_0x0314('0x22')]['message']);return _0x12d026(_0x3ea356[_0x0314('0x22')]['message']);}logger[_0x0314('0x22')](_0x0314('0x1f'),_0x53e271,_0x3ea356[_0x0314('0x22')][_0x0314('0x24')]);return _0x1316a0(_0x3ea356[_0x0314('0x22')][_0x0314('0x24')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x53e271,_0x0314('0x20'));_0x1316a0(_0x3ea356[_0x0314('0x25')][_0x0314('0x24')]);}})[_0x0314('0x26')](function(_0x3ec03d){logger[_0x0314('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0x53e271,_0x3ec03d);_0x12d026(_0x3ec03d);});});}function respondWithStatusCode(_0x3c743e,_0x43fb0e){_0x43fb0e=_0x43fb0e||0xcc;return function(_0x590e94){if(_0x590e94){return _0x3c743e[_0x0314('0x27')](_0x43fb0e);}return _0x3c743e[_0x0314('0x28')](_0x43fb0e)[_0x0314('0x29')]();};}function respondWithResult(_0x26c6a4,_0x867cf7){_0x867cf7=_0x867cf7||0xc8;return function(_0x3af9d3){if(_0x3af9d3){return _0x26c6a4['status'](_0x867cf7)[_0x0314('0x2a')](_0x3af9d3);}};}function respondWithFilteredResult(_0x2e0c77,_0x2d636b){return function(_0x47c2d1){if(_0x47c2d1){var _0x29b4b5=_0x47c2d1[_0x0314('0x2b')],_0x5e3eba=_0x2d636b[_0x0314('0x2c')],_0x47c102=_0x2d636b['offset']+_0x2d636b[_0x0314('0x2d')],_0x5da2c7;if(_0x47c102>=_0x29b4b5){_0x47c102=_0x29b4b5;_0x5da2c7=0xc8;}else{_0x5da2c7=0xce;}_0x2e0c77[_0x0314('0x28')](_0x5da2c7);return _0x2e0c77['set']('Content-Range',_0x5e3eba+'-'+_0x47c102+'/'+_0x29b4b5)[_0x0314('0x2a')](_0x47c2d1);}return null;};}function patchUpdates(_0x345cef){return function(_0x4e34a1){try{jsonpatch[_0x0314('0x2e')](_0x4e34a1,_0x345cef,!![]);}catch(_0x16e74a){return BPromise[_0x0314('0x2f')](_0x16e74a);}return _0x4e34a1['save']();};}function saveUpdates(_0x5b82b2,_0x37ab90){return function(_0x2ce20c){if(_0x2ce20c){return _0x2ce20c[_0x0314('0x30')](_0x5b82b2)['then'](function(_0x1d01b5){return _0x1d01b5;});}return null;};}function removeEntity(_0x554109,_0x52700f){return function(_0x127927){if(_0x127927){return _0x127927[_0x0314('0x31')]()[_0x0314('0x1e')](function(){_0x554109['status'](0xcc)[_0x0314('0x29')]();});}};}function handleEntityNotFound(_0x4a110d,_0x21d907){return function(_0x5a0767){if(!_0x5a0767){_0x4a110d['sendStatus'](0x194);}return _0x5a0767;};}function handleError(_0x2559b2,_0x5d3b0e){_0x5d3b0e=_0x5d3b0e||0x1f4;return function(_0x3e587d){logger[_0x0314('0x22')](_0x3e587d[_0x0314('0x32')]);if(_0x3e587d[_0x0314('0x33')]){delete _0x3e587d[_0x0314('0x33')];}_0x2559b2[_0x0314('0x28')](_0x5d3b0e)[_0x0314('0x34')](_0x3e587d);};}exports['index']=function(_0xf52c24,_0x28c6d0){var _0x292c10={},_0x2cd9d6={},_0x3cab24={'count':0x0,'rows':[]};var _0x26515e=_['map'](db[_0x0314('0x35')]['rawAttributes'],function(_0x22f9f4){return{'name':_0x22f9f4['fieldName'],'type':_0x22f9f4[_0x0314('0x36')]['key']};});_0x2cd9d6['model']=_['map'](_0x26515e,_0x0314('0x33'));_0x2cd9d6[_0x0314('0x37')]=_[_0x0314('0x38')](_0xf52c24[_0x0314('0x37')]);_0x2cd9d6[_0x0314('0x39')]=_['intersection'](_0x2cd9d6[_0x0314('0x3a')],_0x2cd9d6[_0x0314('0x37')]);_0x292c10[_0x0314('0x3b')]=_['intersection'](_0x2cd9d6[_0x0314('0x3a')],qs['fields'](_0xf52c24[_0x0314('0x37')]['fields']));_0x292c10[_0x0314('0x3b')]=_0x292c10['attributes']['length']?_0x292c10[_0x0314('0x3b')]:_0x2cd9d6[_0x0314('0x3a')];if(!_0xf52c24['query'][_0x0314('0x3c')]('nolimit')){_0x292c10[_0x0314('0x2d')]=qs[_0x0314('0x2d')](_0xf52c24[_0x0314('0x37')][_0x0314('0x2d')]);_0x292c10[_0x0314('0x2c')]=qs['offset'](_0xf52c24[_0x0314('0x37')][_0x0314('0x2c')]);}_0x292c10[_0x0314('0x3d')]=qs['sort'](_0xf52c24[_0x0314('0x37')][_0x0314('0x3e')]);_0x292c10[_0x0314('0x3f')]=qs['filters'](_[_0x0314('0x40')](_0xf52c24['query'],_0x2cd9d6[_0x0314('0x39')]),_0x26515e);if(_0xf52c24[_0x0314('0x37')][_0x0314('0x41')]){_0x292c10['where']=_[_0x0314('0x42')](_0x292c10[_0x0314('0x3f')],{'$or':_['map'](_0x26515e,function(_0x48965e){if(_0x48965e['type']!==_0x0314('0x43')){var _0x70bcd={};_0x70bcd[_0x48965e[_0x0314('0x33')]]={'$like':'%'+_0xf52c24['query'][_0x0314('0x41')]+'%'};return _0x70bcd;}})});}_0x292c10=_[_0x0314('0x42')]({},_0x292c10,_0xf52c24[_0x0314('0x44')]);var _0xff99de={'where':_0x292c10[_0x0314('0x3f')]};return db['FreshsalesAccount'][_0x0314('0x2b')](_0xff99de)[_0x0314('0x1e')](function(_0xaa427b){_0x3cab24[_0x0314('0x2b')]=_0xaa427b;if(_0xf52c24[_0x0314('0x37')][_0x0314('0x45')]){_0x292c10[_0x0314('0x46')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x0314('0x47')](_0x292c10);})[_0x0314('0x1e')](function(_0x539d2c){_0x3cab24[_0x0314('0x48')]=_0x539d2c;return _0x3cab24;})[_0x0314('0x1e')](respondWithFilteredResult(_0x28c6d0,_0x292c10))[_0x0314('0x26')](handleError(_0x28c6d0,null));};exports['show']=function(_0x4a1850,_0x128889){var _0x1a4033={'raw':![],'where':{'id':_0x4a1850[_0x0314('0x49')]['id']}},_0x2cbed3={};_0x2cbed3[_0x0314('0x3a')]=_[_0x0314('0x38')](db[_0x0314('0x35')]['rawAttributes']);_0x2cbed3[_0x0314('0x37')]=_['keys'](_0x4a1850[_0x0314('0x37')]);_0x2cbed3[_0x0314('0x39')]=_[_0x0314('0x4a')](_0x2cbed3[_0x0314('0x3a')],_0x2cbed3[_0x0314('0x37')]);_0x1a4033['attributes']=_['intersection'](_0x2cbed3[_0x0314('0x3a')],qs[_0x0314('0x4b')](_0x4a1850[_0x0314('0x37')][_0x0314('0x4b')]));_0x1a4033['attributes']=_0x1a4033[_0x0314('0x3b')][_0x0314('0x4c')]?_0x1a4033[_0x0314('0x3b')]:_0x2cbed3[_0x0314('0x3a')];if(_0x4a1850[_0x0314('0x37')][_0x0314('0x45')]){_0x1a4033[_0x0314('0x46')]=[{'all':!![]}];}_0x1a4033=_['merge']({},_0x1a4033,_0x4a1850[_0x0314('0x44')]);return db[_0x0314('0x35')][_0x0314('0x4d')](_0x1a4033)['then'](handleEntityNotFound(_0x128889,null))[_0x0314('0x1e')](respondWithResult(_0x128889,null))[_0x0314('0x26')](handleError(_0x128889,null));};exports['create']=function(_0x92cb75,_0xfb5170){return db[_0x0314('0x35')][_0x0314('0x4e')](_0x92cb75['body'],{})[_0x0314('0x1e')](respondWithResult(_0xfb5170,0xc9))[_0x0314('0x26')](handleError(_0xfb5170,null));};exports[_0x0314('0x30')]=function(_0x2903c1,_0x227ee1){if(_0x2903c1[_0x0314('0x4f')]['id']){delete _0x2903c1[_0x0314('0x4f')]['id'];}return db[_0x0314('0x35')][_0x0314('0x4d')]({'where':{'id':_0x2903c1[_0x0314('0x49')]['id']}})['then'](handleEntityNotFound(_0x227ee1,null))[_0x0314('0x1e')](saveUpdates(_0x2903c1[_0x0314('0x4f')],null))[_0x0314('0x1e')](respondWithResult(_0x227ee1,null))[_0x0314('0x26')](handleError(_0x227ee1,null));};exports[_0x0314('0x31')]=function(_0x39bc9,_0x40a8e1){return db['FreshsalesAccount']['find']({'where':{'id':_0x39bc9['params']['id']}})[_0x0314('0x1e')](handleEntityNotFound(_0x40a8e1,null))[_0x0314('0x1e')](removeEntity(_0x40a8e1,null))['catch'](handleError(_0x40a8e1,null));};exports[_0x0314('0x50')]=function(_0x35c961,_0x2ef23f,_0x4b35d8){var _0x50e8dc={};var _0x2e29ce={};var _0x40a4d8;var _0x4df44b;return db[_0x0314('0x35')]['findOne']({'where':{'id':_0x35c961[_0x0314('0x49')]['id']}})[_0x0314('0x1e')](handleEntityNotFound(_0x2ef23f,null))[_0x0314('0x1e')](function(_0x37764f){if(_0x37764f){_0x40a4d8=_0x37764f;_0x2e29ce['model']=_[_0x0314('0x38')](db[_0x0314('0x51')][_0x0314('0x52')]);_0x2e29ce['query']=_[_0x0314('0x38')](_0x35c961[_0x0314('0x37')]);_0x2e29ce[_0x0314('0x39')]=_[_0x0314('0x4a')](_0x2e29ce[_0x0314('0x3a')],_0x2e29ce[_0x0314('0x37')]);_0x50e8dc[_0x0314('0x3b')]=_['intersection'](_0x2e29ce[_0x0314('0x3a')],qs['fields'](_0x35c961['query'][_0x0314('0x4b')]));_0x50e8dc['attributes']=_0x50e8dc[_0x0314('0x3b')][_0x0314('0x4c')]?_0x50e8dc[_0x0314('0x3b')]:_0x2e29ce[_0x0314('0x3a')];_0x50e8dc[_0x0314('0x3d')]=qs[_0x0314('0x3e')](_0x35c961[_0x0314('0x37')][_0x0314('0x3e')]);_0x50e8dc['where']=qs['filters'](_[_0x0314('0x40')](_0x35c961[_0x0314('0x37')],_0x2e29ce[_0x0314('0x39')]));if(_0x35c961['query']['filter']){_0x50e8dc['where']=_[_0x0314('0x42')](_0x50e8dc[_0x0314('0x3f')],{'$or':_['map'](_0x50e8dc[_0x0314('0x3b')],function(_0x3befab){var _0x405be8={};_0x405be8[_0x3befab]={'$like':'%'+_0x35c961[_0x0314('0x37')][_0x0314('0x41')]+'%'};return _0x405be8;})});}_0x50e8dc=_[_0x0314('0x42')]({},_0x50e8dc,_0x35c961['options']);return _0x40a4d8[_0x0314('0x50')](_0x50e8dc);}})[_0x0314('0x1e')](function(_0x15b523){if(_0x15b523){_0x4df44b=_0x15b523['length'];if(!_0x35c961[_0x0314('0x37')][_0x0314('0x3c')](_0x0314('0x53'))){_0x50e8dc['limit']=qs[_0x0314('0x2d')](_0x35c961[_0x0314('0x37')]['limit']);_0x50e8dc[_0x0314('0x2c')]=qs[_0x0314('0x2c')](_0x35c961[_0x0314('0x37')][_0x0314('0x2c')]);}return _0x40a4d8[_0x0314('0x50')](_0x50e8dc);}})['then'](function(_0x296579){if(_0x296579){return _0x296579?{'count':_0x4df44b,'rows':_0x296579}:null;}})[_0x0314('0x1e')](respondWithResult(_0x2ef23f,null))['catch'](handleError(_0x2ef23f,null));};exports['addConfiguration']=function(_0x186dde,_0x381a5d,_0x30726f){if(_0x186dde[_0x0314('0x4f')]['id']){delete _0x186dde[_0x0314('0x4f')]['id'];}return db[_0x0314('0x35')][_0x0314('0x54')]({'where':{'id':_0x186dde['params']['id']}})[_0x0314('0x1e')](handleEntityNotFound(_0x381a5d,null))[_0x0314('0x1e')](function(_0x1cbdd7){if(_0x1cbdd7){_0x186dde[_0x0314('0x4f')]['AccountId']=_0x1cbdd7['id'];_0x186dde[_0x0314('0x4f')][_0x0314('0x55')]=integrations['getSubjects'](_0x186dde[_0x0314('0x4f')][_0x0314('0x56')],_0x186dde['body']['type']);_0x186dde[_0x0314('0x4f')][_0x0314('0x57')]=integrations[_0x0314('0x58')](_0x186dde['body']['channel'],_0x186dde[_0x0314('0x4f')][_0x0314('0x36')]);return db[_0x0314('0x51')][_0x0314('0x4e')](_0x186dde[_0x0314('0x4f')],{'include':[{'model':db['FreshsalesField'],'as':_0x0314('0x55')},{'model':db[_0x0314('0x59')],'as':_0x0314('0x57')}]});}return null;})[_0x0314('0x1e')](respondWithResult(_0x381a5d,null))[_0x0314('0x26')](handleError(_0x381a5d,null));};exports[_0x0314('0x5a')]=function(_0x144929,_0x68ac7f,_0x2d00ab){var _0x4ed0ed='';var _0x907195='';return db[_0x0314('0x35')][_0x0314('0x54')]({'where':{'id':_0x144929[_0x0314('0x49')]['id']},'attributes':['id',_0x0314('0x5b'),_0x0314('0x5c'),_0x0314('0x5d')]})[_0x0314('0x1e')](handleEntityNotFound(_0x68ac7f,null))[_0x0314('0x1e')](function(_0x875ca2){if(_0x875ca2){_0x907195=_0x875ca2[_0x0314('0x5b')];_0x4ed0ed=_0x875ca2['remoteUri'];var _0x2238e8=_0x875ca2[_0x0314('0x5c')][_0x0314('0x5e')](-0x1);if(_0x2238e8==='/'){_0x4ed0ed=_0x4ed0ed['substring'](0x0,_0x4ed0ed[_0x0314('0x5f')](_0x2238e8));}return rp({'method':_0x0314('0x60'),'uri':util[_0x0314('0x61')](_0x0314('0x62'),_0x4ed0ed,_0x0314('0x63')),'headers':{'Authorization':_0x0314('0x64')+_0x875ca2[_0x0314('0x5d')]},'json':!![]});}})[_0x0314('0x1e')](function(_0xb220cf){if(_0xb220cf){var _0x1c7120=_0xb220cf[_0x0314('0x65')];var _0x54e58a=![];var _0x23515e=null;for(_0x23515e=0x0;_0x23515e<_0x1c7120[_0x0314('0x4c')];_0x23515e++){if(_0x1c7120[_0x23515e][_0x0314('0x66')]===_0x907195){_0x54e58a=!![];}}if(_0x54e58a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0314('0x67')});}}})[_0x0314('0x1e')](respondWithResult(_0x68ac7f,null))['catch'](function(_0x3bbd81){var _0x59e223=_0x144929[_0x0314('0x37')]['test']?0x1f4:_0x3bbd81['statusCode']||0x1f4;logger[_0x0314('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x0314('0x5a'),_0x59e223,JSON[_0x0314('0x68')](_0x3bbd81));delete _0x3bbd81[_0x0314('0x33')];if(_0x59e223===0x191){_0x59e223=0x190;}_0x68ac7f[_0x0314('0x28')](_0x59e223)['send'](_0x144929[_0x0314('0x37')][_0x0314('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x3bbd81[_0x0314('0x6a')]}:_0x3bbd81);});}; \ No newline at end of file +var _0x5b02=['Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','rows','params','keys','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','options','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','apiKey','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','stringify','test'];(function(_0x343625,_0x34ceb3){var _0x539f79=function(_0x3b3bf3){while(--_0x3b3bf3){_0x343625['push'](_0x343625['shift']());}};_0x539f79(++_0x34ceb3);}(_0x5b02,0xe9));var _0x25b0=function(_0x14108c,_0x8d9d9e){_0x14108c=_0x14108c-0x0;var _0x144e80=_0x5b02[_0x14108c];return _0x144e80;};'use strict';var pdf=require(_0x25b0('0x0'));var emlformat=require(_0x25b0('0x1'));var rimraf=require(_0x25b0('0x2'));var zipdir=require(_0x25b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25b0('0x5'));var util=require(_0x25b0('0x6'));var path=require(_0x25b0('0x7'));var sox=require(_0x25b0('0x8'));var csv=require(_0x25b0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var licenseUtil=require(_0x25b0('0x17'));var db=require(_0x25b0('0x18'))['db'];var integrations=require(_0x25b0('0x19'));var jayson=require(_0x25b0('0x1a'));var client=jayson[_0x25b0('0x1b')][_0x25b0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3655c2,_0x1ceeb1,_0x42cc07,_0x293203){return new BPromise(function(_0x211658,_0x418954){var _0x3b89e7=_0x293203||client;return _0x3b89e7[_0x25b0('0x1d')](_0x3655c2,_0x42cc07)['then'](function(_0x51542b){logger[_0x25b0('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x1ceeb1,_0x25b0('0x1f'));logger[_0x25b0('0x20')](_0x25b0('0x21'),_0x1ceeb1,_0x25b0('0x1f'),JSON['stringify'](_0x51542b));if(_0x51542b[_0x25b0('0x22')]){if(_0x51542b[_0x25b0('0x22')][_0x25b0('0x23')]===0x1f4){logger[_0x25b0('0x22')](_0x25b0('0x24'),_0x1ceeb1,_0x51542b[_0x25b0('0x22')]['message']);return _0x418954(_0x51542b[_0x25b0('0x22')][_0x25b0('0x25')]);}logger[_0x25b0('0x22')](_0x25b0('0x24'),_0x1ceeb1,_0x51542b[_0x25b0('0x22')][_0x25b0('0x25')]);return _0x211658(_0x51542b[_0x25b0('0x22')][_0x25b0('0x25')]);}else{logger[_0x25b0('0x1e')](_0x25b0('0x24'),_0x1ceeb1,_0x25b0('0x1f'));_0x211658(_0x51542b[_0x25b0('0x26')]['message']);}})[_0x25b0('0x27')](function(_0x16623c){logger['error'](_0x25b0('0x24'),_0x1ceeb1,_0x16623c);_0x418954(_0x16623c);});});}function respondWithStatusCode(_0x2023d8,_0x3546f0){_0x3546f0=_0x3546f0||0xcc;return function(_0x498fef){if(_0x498fef){return _0x2023d8['sendStatus'](_0x3546f0);}return _0x2023d8['status'](_0x3546f0)[_0x25b0('0x28')]();};}function respondWithResult(_0x433085,_0x99bd3a){_0x99bd3a=_0x99bd3a||0xc8;return function(_0x24f847){if(_0x24f847){return _0x433085[_0x25b0('0x29')](_0x99bd3a)[_0x25b0('0x2a')](_0x24f847);}};}function respondWithFilteredResult(_0x40268a,_0x75ce7a){return function(_0x22e024){if(_0x22e024){var _0x596d14=_0x22e024['count'],_0x2ea408=_0x75ce7a['offset'],_0xbfba84=_0x75ce7a[_0x25b0('0x2b')]+_0x75ce7a[_0x25b0('0x2c')],_0x5ed7d2;if(_0xbfba84>=_0x596d14){_0xbfba84=_0x596d14;_0x5ed7d2=0xc8;}else{_0x5ed7d2=0xce;}_0x40268a[_0x25b0('0x29')](_0x5ed7d2);return _0x40268a[_0x25b0('0x2d')](_0x25b0('0x2e'),_0x2ea408+'-'+_0xbfba84+'/'+_0x596d14)[_0x25b0('0x2a')](_0x22e024);}return null;};}function patchUpdates(_0x12676b){return function(_0x227287){try{jsonpatch[_0x25b0('0x2f')](_0x227287,_0x12676b,!![]);}catch(_0x285a2b){return BPromise[_0x25b0('0x30')](_0x285a2b);}return _0x227287[_0x25b0('0x31')]();};}function saveUpdates(_0x1ea374,_0x4f640f){return function(_0x559fc8){if(_0x559fc8){return _0x559fc8[_0x25b0('0x32')](_0x1ea374)['then'](function(_0x4dfeea){return _0x4dfeea;});}return null;};}function removeEntity(_0x3317fc,_0x419975){return function(_0x46c5e8){if(_0x46c5e8){return _0x46c5e8[_0x25b0('0x33')]()[_0x25b0('0x34')](function(){_0x3317fc['status'](0xcc)[_0x25b0('0x28')]();});}};}function handleEntityNotFound(_0x3636be,_0x4dad3a){return function(_0x13ce9){if(!_0x13ce9){_0x3636be[_0x25b0('0x35')](0x194);}return _0x13ce9;};}function handleError(_0x5004cd,_0x215fb8){_0x215fb8=_0x215fb8||0x1f4;return function(_0x49b3a5){logger[_0x25b0('0x22')](_0x49b3a5[_0x25b0('0x36')]);if(_0x49b3a5[_0x25b0('0x37')]){delete _0x49b3a5[_0x25b0('0x37')];}_0x5004cd[_0x25b0('0x29')](_0x215fb8)[_0x25b0('0x38')](_0x49b3a5);};}exports[_0x25b0('0x39')]=function(_0x206186,_0x2f123c){var _0x4790fe={},_0x461a06={},_0x434bda={'count':0x0,'rows':[]};var _0x3887e8=_[_0x25b0('0x3a')](db[_0x25b0('0x3b')][_0x25b0('0x3c')],function(_0x1eee05){return{'name':_0x1eee05[_0x25b0('0x3d')],'type':_0x1eee05[_0x25b0('0x3e')][_0x25b0('0x3f')]};});_0x461a06['model']=_[_0x25b0('0x3a')](_0x3887e8,_0x25b0('0x37'));_0x461a06[_0x25b0('0x40')]=_['keys'](_0x206186[_0x25b0('0x40')]);_0x461a06[_0x25b0('0x41')]=_[_0x25b0('0x42')](_0x461a06[_0x25b0('0x43')],_0x461a06[_0x25b0('0x40')]);_0x4790fe[_0x25b0('0x44')]=_[_0x25b0('0x42')](_0x461a06[_0x25b0('0x43')],qs['fields'](_0x206186['query'][_0x25b0('0x45')]));_0x4790fe[_0x25b0('0x44')]=_0x4790fe[_0x25b0('0x44')]['length']?_0x4790fe[_0x25b0('0x44')]:_0x461a06['model'];if(!_0x206186[_0x25b0('0x40')][_0x25b0('0x46')](_0x25b0('0x47'))){_0x4790fe[_0x25b0('0x2c')]=qs[_0x25b0('0x2c')](_0x206186['query'][_0x25b0('0x2c')]);_0x4790fe[_0x25b0('0x2b')]=qs[_0x25b0('0x2b')](_0x206186[_0x25b0('0x40')][_0x25b0('0x2b')]);}_0x4790fe['order']=qs[_0x25b0('0x48')](_0x206186[_0x25b0('0x40')][_0x25b0('0x48')]);_0x4790fe[_0x25b0('0x49')]=qs[_0x25b0('0x41')](_[_0x25b0('0x4a')](_0x206186[_0x25b0('0x40')],_0x461a06[_0x25b0('0x41')]),_0x3887e8);if(_0x206186[_0x25b0('0x40')][_0x25b0('0x4b')]){_0x4790fe[_0x25b0('0x49')]=_['merge'](_0x4790fe[_0x25b0('0x49')],{'$or':_['map'](_0x3887e8,function(_0x11a766){if(_0x11a766[_0x25b0('0x3e')]!==_0x25b0('0x4c')){var _0x365805={};_0x365805[_0x11a766['name']]={'$like':'%'+_0x206186[_0x25b0('0x40')][_0x25b0('0x4b')]+'%'};return _0x365805;}})});}_0x4790fe=_[_0x25b0('0x4d')]({},_0x4790fe,_0x206186['options']);var _0x4734b1={'where':_0x4790fe[_0x25b0('0x49')]};return db[_0x25b0('0x3b')][_0x25b0('0x4e')](_0x4734b1)[_0x25b0('0x34')](function(_0x3c6ec1){_0x434bda[_0x25b0('0x4e')]=_0x3c6ec1;if(_0x206186['query'][_0x25b0('0x4f')]){_0x4790fe[_0x25b0('0x50')]=[{'all':!![]}];}return db[_0x25b0('0x3b')]['findAll'](_0x4790fe);})[_0x25b0('0x34')](function(_0xda629){_0x434bda[_0x25b0('0x51')]=_0xda629;return _0x434bda;})[_0x25b0('0x34')](respondWithFilteredResult(_0x2f123c,_0x4790fe))[_0x25b0('0x27')](handleError(_0x2f123c,null));};exports['show']=function(_0x1e8a8d,_0x1cf933){var _0x23de77={'raw':![],'where':{'id':_0x1e8a8d[_0x25b0('0x52')]['id']}},_0x524e9a={};_0x524e9a[_0x25b0('0x43')]=_[_0x25b0('0x53')](db[_0x25b0('0x3b')][_0x25b0('0x3c')]);_0x524e9a[_0x25b0('0x40')]=_['keys'](_0x1e8a8d['query']);_0x524e9a['filters']=_[_0x25b0('0x42')](_0x524e9a['model'],_0x524e9a['query']);_0x23de77[_0x25b0('0x44')]=_['intersection'](_0x524e9a[_0x25b0('0x43')],qs['fields'](_0x1e8a8d['query'][_0x25b0('0x45')]));_0x23de77[_0x25b0('0x44')]=_0x23de77[_0x25b0('0x44')][_0x25b0('0x54')]?_0x23de77[_0x25b0('0x44')]:_0x524e9a[_0x25b0('0x43')];if(_0x1e8a8d[_0x25b0('0x40')][_0x25b0('0x4f')]){_0x23de77[_0x25b0('0x50')]=[{'all':!![]}];}_0x23de77=_[_0x25b0('0x4d')]({},_0x23de77,_0x1e8a8d['options']);return db['FreshsalesAccount']['find'](_0x23de77)[_0x25b0('0x34')](handleEntityNotFound(_0x1cf933,null))[_0x25b0('0x34')](respondWithResult(_0x1cf933,null))[_0x25b0('0x27')](handleError(_0x1cf933,null));};exports[_0x25b0('0x55')]=function(_0x14db4c,_0x3f460f){return db[_0x25b0('0x3b')]['create'](_0x14db4c[_0x25b0('0x56')],{})['then'](respondWithResult(_0x3f460f,0xc9))[_0x25b0('0x27')](handleError(_0x3f460f,null));};exports['update']=function(_0x488df6,_0x403508){if(_0x488df6['body']['id']){delete _0x488df6['body']['id'];}return db[_0x25b0('0x3b')][_0x25b0('0x57')]({'where':{'id':_0x488df6[_0x25b0('0x52')]['id']}})[_0x25b0('0x34')](handleEntityNotFound(_0x403508,null))[_0x25b0('0x34')](saveUpdates(_0x488df6[_0x25b0('0x56')],null))[_0x25b0('0x34')](respondWithResult(_0x403508,null))[_0x25b0('0x27')](handleError(_0x403508,null));};exports[_0x25b0('0x33')]=function(_0xfd3b6c,_0x56bc21){return db['FreshsalesAccount'][_0x25b0('0x57')]({'where':{'id':_0xfd3b6c[_0x25b0('0x52')]['id']}})['then'](handleEntityNotFound(_0x56bc21,null))[_0x25b0('0x34')](removeEntity(_0x56bc21,null))[_0x25b0('0x27')](handleError(_0x56bc21,null));};exports[_0x25b0('0x58')]=function(_0x43ad53,_0x345349,_0x4cce6a){var _0x163a01={};var _0x2d1577={};var _0x135371;var _0x5b39d3;return db[_0x25b0('0x3b')][_0x25b0('0x59')]({'where':{'id':_0x43ad53[_0x25b0('0x52')]['id']}})[_0x25b0('0x34')](handleEntityNotFound(_0x345349,null))[_0x25b0('0x34')](function(_0x256338){if(_0x256338){_0x135371=_0x256338;_0x2d1577[_0x25b0('0x43')]=_[_0x25b0('0x53')](db[_0x25b0('0x5a')][_0x25b0('0x3c')]);_0x2d1577[_0x25b0('0x40')]=_[_0x25b0('0x53')](_0x43ad53[_0x25b0('0x40')]);_0x2d1577[_0x25b0('0x41')]=_['intersection'](_0x2d1577[_0x25b0('0x43')],_0x2d1577[_0x25b0('0x40')]);_0x163a01['attributes']=_[_0x25b0('0x42')](_0x2d1577['model'],qs[_0x25b0('0x45')](_0x43ad53[_0x25b0('0x40')]['fields']));_0x163a01[_0x25b0('0x44')]=_0x163a01[_0x25b0('0x44')][_0x25b0('0x54')]?_0x163a01['attributes']:_0x2d1577[_0x25b0('0x43')];_0x163a01['order']=qs[_0x25b0('0x48')](_0x43ad53[_0x25b0('0x40')]['sort']);_0x163a01[_0x25b0('0x49')]=qs[_0x25b0('0x41')](_['pick'](_0x43ad53[_0x25b0('0x40')],_0x2d1577['filters']));if(_0x43ad53['query']['filter']){_0x163a01[_0x25b0('0x49')]=_[_0x25b0('0x4d')](_0x163a01[_0x25b0('0x49')],{'$or':_['map'](_0x163a01[_0x25b0('0x44')],function(_0x431482){var _0x290ccb={};_0x290ccb[_0x431482]={'$like':'%'+_0x43ad53[_0x25b0('0x40')][_0x25b0('0x4b')]+'%'};return _0x290ccb;})});}_0x163a01=_[_0x25b0('0x4d')]({},_0x163a01,_0x43ad53[_0x25b0('0x5b')]);return _0x135371[_0x25b0('0x58')](_0x163a01);}})[_0x25b0('0x34')](function(_0x330e6d){if(_0x330e6d){_0x5b39d3=_0x330e6d[_0x25b0('0x54')];if(!_0x43ad53[_0x25b0('0x40')][_0x25b0('0x46')](_0x25b0('0x47'))){_0x163a01[_0x25b0('0x2c')]=qs[_0x25b0('0x2c')](_0x43ad53[_0x25b0('0x40')]['limit']);_0x163a01[_0x25b0('0x2b')]=qs['offset'](_0x43ad53[_0x25b0('0x40')][_0x25b0('0x2b')]);}return _0x135371[_0x25b0('0x58')](_0x163a01);}})[_0x25b0('0x34')](function(_0x568f95){if(_0x568f95){return _0x568f95?{'count':_0x5b39d3,'rows':_0x568f95}:null;}})[_0x25b0('0x34')](respondWithResult(_0x345349,null))[_0x25b0('0x27')](handleError(_0x345349,null));};exports[_0x25b0('0x5c')]=function(_0x2217e7,_0x46a1d1,_0x19e49c){if(_0x2217e7['body']['id']){delete _0x2217e7['body']['id'];}return db[_0x25b0('0x3b')]['findOne']({'where':{'id':_0x2217e7[_0x25b0('0x52')]['id']}})[_0x25b0('0x34')](handleEntityNotFound(_0x46a1d1,null))[_0x25b0('0x34')](function(_0x5279ab){if(_0x5279ab){_0x2217e7[_0x25b0('0x56')][_0x25b0('0x5d')]=_0x5279ab['id'];_0x2217e7[_0x25b0('0x56')][_0x25b0('0x5e')]=integrations['getSubjects'](_0x2217e7[_0x25b0('0x56')][_0x25b0('0x5f')],_0x2217e7[_0x25b0('0x56')]['type']);_0x2217e7[_0x25b0('0x56')][_0x25b0('0x60')]=integrations[_0x25b0('0x61')](_0x2217e7[_0x25b0('0x56')][_0x25b0('0x5f')],_0x2217e7[_0x25b0('0x56')][_0x25b0('0x3e')]);return db[_0x25b0('0x5a')]['create'](_0x2217e7[_0x25b0('0x56')],{'include':[{'model':db[_0x25b0('0x62')],'as':_0x25b0('0x5e')},{'model':db[_0x25b0('0x62')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x46a1d1,null))[_0x25b0('0x27')](handleError(_0x46a1d1,null));};exports[_0x25b0('0x63')]=function(_0x10f062,_0x350fc1,_0x4d9412){var _0x3315bf='';var _0x4ac6b7='';return db['FreshsalesAccount'][_0x25b0('0x59')]({'where':{'id':_0x10f062[_0x25b0('0x52')]['id']},'attributes':['id','username','remoteUri',_0x25b0('0x64')]})[_0x25b0('0x34')](handleEntityNotFound(_0x350fc1,null))[_0x25b0('0x34')](function(_0x2ea20e){if(_0x2ea20e){_0x4ac6b7=_0x2ea20e[_0x25b0('0x65')];_0x3315bf=_0x2ea20e[_0x25b0('0x66')];var _0x2b43d4=_0x2ea20e[_0x25b0('0x66')][_0x25b0('0x67')](-0x1);if(_0x2b43d4==='/'){_0x3315bf=_0x3315bf[_0x25b0('0x68')](0x0,_0x3315bf[_0x25b0('0x69')](_0x2b43d4));}return rp({'method':_0x25b0('0x6a'),'uri':util[_0x25b0('0x6b')]('%s%s',_0x3315bf,_0x25b0('0x6c')),'headers':{'Authorization':'Token\x20token='+_0x2ea20e[_0x25b0('0x64')]},'json':!![]});}})[_0x25b0('0x34')](function(_0x5c0604){if(_0x5c0604){var _0x37e531=_0x5c0604[_0x25b0('0x6d')];var _0x2e1bef=![];var _0x21a3de=null;for(_0x21a3de=0x0;_0x21a3de<_0x37e531[_0x25b0('0x54')];_0x21a3de++){if(_0x37e531[_0x21a3de][_0x25b0('0x6e')]===_0x4ac6b7){_0x2e1bef=!![];}}if(_0x2e1bef){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x25b0('0x6f')});}}})[_0x25b0('0x34')](respondWithResult(_0x350fc1,null))[_0x25b0('0x27')](function(_0xd5351e){var _0x36252f=_0x10f062['query']['test']?0x1f4:_0xd5351e[_0x25b0('0x70')]||0x1f4;logger[_0x25b0('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x36252f,JSON[_0x25b0('0x71')](_0xd5351e));delete _0xd5351e['name'];if(_0x36252f===0x191){_0x36252f=0x190;}_0x350fc1[_0x25b0('0x29')](_0x36252f)[_0x25b0('0x38')](_0x10f062['query'][_0x25b0('0x72')]?{'message':_0x25b0('0x73'),'statusCode':_0xd5351e['statusCode']}:_0xd5351e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 6fb4575..5ff6411 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 _0x5b43=['define','int_freshsales_accounts','util','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b43,0x11a));var _0x35b4=function(_0x293ceb,_0x95f566){_0x293ceb=_0x293ceb-0x0;var _0x241eff=_0x5b43[_0x293ceb];return _0x241eff;};'use strict';var _=require('lodash');var util=require(_0x35b4('0x0'));var logger=require('../../config/logger')(_0x35b4('0x1'));var moment=require(_0x35b4('0x2'));var BPromise=require('bluebird');var rp=require(_0x35b4('0x3'));var fs=require('fs');var path=require(_0x35b4('0x4'));var rimraf=require('rimraf');var config=require(_0x35b4('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x35b4('0x6'));module[_0x35b4('0x7')]=function(_0x1c1da4,_0x5b4077){return _0x1c1da4[_0x35b4('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x35b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7353=['api','moment','bluebird','path','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7353,0x1f2));var _0x3735=function(_0x1ef718,_0x3bf0bd){_0x1ef718=_0x1ef718-0x0;var _0x42ce90=_0x7353[_0x1ef718];return _0x42ce90;};'use strict';var _=require('lodash');var util=require(_0x3735('0x0'));var logger=require(_0x3735('0x1'))(_0x3735('0x2'));var moment=require(_0x3735('0x3'));var BPromise=require(_0x3735('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3735('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3735('0x6'));var integrations=require(_0x3735('0x7'));module['exports']=function(_0x208d67,_0x242efe){return _0x208d67['define'](_0x3735('0x8'),attributes,{'tableName':_0x3735('0x9'),'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 cea4dfd..c617c0f 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 _0xd959=['where','attributes','include','map','model','then','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd959,0x94));var _0x9d95=function(_0x81fdea,_0x218f20){_0x81fdea=_0x81fdea-0x0;var _0x2b4593=_0xd959[_0x81fdea];return _0x2b4593;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var moment=require(_0x9d95('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d95('0x3'));var fs=require('fs');var Redis=require(_0x9d95('0x4'));var db=require(_0x9d95('0x5'))['db'];var utils=require(_0x9d95('0x6'));var logger=require(_0x9d95('0x7'))('rpc');var config=require(_0x9d95('0x8'));var jayson=require(_0x9d95('0x9'));var client=jayson[_0x9d95('0xa')][_0x9d95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cd4ff,_0x3b9ddc,_0x300ffe){return new BPromise(function(_0x22af66,_0x561877){return client[_0x9d95('0xc')](_0x5cd4ff,_0x300ffe)['then'](function(_0x156d8a){logger[_0x9d95('0xd')](_0x9d95('0xe'),_0x3b9ddc,_0x9d95('0xf'));logger[_0x9d95('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3b9ddc,_0x9d95('0xf'),JSON[_0x9d95('0x11')](_0x156d8a));if(_0x156d8a['error']){if(_0x156d8a[_0x9d95('0x12')][_0x9d95('0x13')]===0x1f4){logger['error'](_0x9d95('0xe'),_0x3b9ddc,_0x156d8a[_0x9d95('0x12')][_0x9d95('0x14')]);return _0x561877(_0x156d8a[_0x9d95('0x12')]['message']);}logger[_0x9d95('0x12')](_0x9d95('0xe'),_0x3b9ddc,_0x156d8a['error'][_0x9d95('0x14')]);return _0x22af66(_0x156d8a[_0x9d95('0x12')][_0x9d95('0x14')]);}else{logger['info'](_0x9d95('0xe'),_0x3b9ddc,'request\x20sent');_0x22af66(_0x156d8a[_0x9d95('0x15')][_0x9d95('0x14')]);}})[_0x9d95('0x16')](function(_0x581647){logger[_0x9d95('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b9ddc,_0x581647);_0x561877(_0x581647);});});}exports[_0x9d95('0x17')]=function(_0x3ab916){var _0x1d267c=this;return new Promise(function(_0x453074,_0x481fd6){return db['FreshsalesAccount'][_0x9d95('0x18')]({'raw':_0x3ab916['options']?_0x3ab916[_0x9d95('0x19')][_0x9d95('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ab916[_0x9d95('0x19')]?_0x3ab916[_0x9d95('0x19')][_0x9d95('0x1b')]||null:null,'attributes':_0x3ab916[_0x9d95('0x19')]?_0x3ab916[_0x9d95('0x19')][_0x9d95('0x1c')]||null:null,'limit':_0x3ab916['options']?_0x3ab916[_0x9d95('0x19')]['limit']||null:null,'include':_0x3ab916['options']?_0x3ab916[_0x9d95('0x19')][_0x9d95('0x1d')]?_['map'](_0x3ab916[_0x9d95('0x19')][_0x9d95('0x1d')],function(_0x4fcf09){return{'model':db[_0x4fcf09['model']],'as':_0x4fcf09['as'],'attributes':_0x4fcf09[_0x9d95('0x1c')],'include':_0x4fcf09[_0x9d95('0x1d')]?_[_0x9d95('0x1e')](_0x4fcf09[_0x9d95('0x1d')],function(_0x4c9abd){return{'model':db[_0x4c9abd[_0x9d95('0x1f')]],'as':_0x4c9abd['as'],'attributes':_0x4c9abd[_0x9d95('0x1c')],'include':_0x4c9abd[_0x9d95('0x1d')]?_[_0x9d95('0x1e')](_0x4c9abd[_0x9d95('0x1d')],function(_0x6c3c73){return{'model':db[_0x6c3c73[_0x9d95('0x1f')]],'as':_0x6c3c73['as'],'attributes':_0x6c3c73[_0x9d95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9d95('0x20')](function(_0xb69ff8){logger['info'](_0x9d95('0x17'),_0x3ab916);logger[_0x9d95('0x10')](_0x9d95('0x17'),_0x3ab916,JSON[_0x9d95('0x11')](_0xb69ff8));_0x453074(_0xb69ff8);})[_0x9d95('0x16')](function(_0x1dc801){logger[_0x9d95('0x12')](_0x9d95('0x17'),_0x1dc801[_0x9d95('0x14')],_0x3ab916);_0x481fd6(_0x1d267c[_0x9d95('0x12')](0x1f4,_0x1dc801['message']));});});};exports[_0x9d95('0x21')]=function(_0x121630){var _0x2b456e=this;return new Promise(function(_0x31770d,_0x9466a8){return db['FreshsalesAccount'][_0x9d95('0x22')]({'raw':_0x121630[_0x9d95('0x19')]?_0x121630[_0x9d95('0x19')][_0x9d95('0x1a')]===undefined?!![]:![]:!![],'where':_0x121630['options']?_0x121630[_0x9d95('0x19')]['where']||null:null,'attributes':_0x121630[_0x9d95('0x19')]?_0x121630[_0x9d95('0x19')][_0x9d95('0x1c')]||null:null,'include':_0x121630['options']?_0x121630[_0x9d95('0x19')]['include']?_['map'](_0x121630[_0x9d95('0x19')]['include'],function(_0x590409){return{'model':db[_0x590409[_0x9d95('0x1f')]],'as':_0x590409['as'],'attributes':_0x590409['attributes'],'include':_0x590409['include']?_[_0x9d95('0x1e')](_0x590409[_0x9d95('0x1d')],function(_0x336e18){return{'model':db[_0x336e18[_0x9d95('0x1f')]],'as':_0x336e18['as'],'attributes':_0x336e18['attributes'],'include':_0x336e18[_0x9d95('0x1d')]?_[_0x9d95('0x1e')](_0x336e18[_0x9d95('0x1d')],function(_0x22b431){return{'model':db[_0x22b431[_0x9d95('0x1f')]],'as':_0x22b431['as'],'attributes':_0x22b431[_0x9d95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9d95('0x20')](function(_0x16406d){logger[_0x9d95('0xd')]('ShowFreshsalesAccount',_0x121630);logger['debug'](_0x9d95('0x21'),_0x121630,JSON[_0x9d95('0x11')](_0x16406d));_0x31770d(_0x16406d);})[_0x9d95('0x16')](function(_0x4f026c){logger[_0x9d95('0x12')](_0x9d95('0x21'),_0x4f026c[_0x9d95('0x14')],_0x121630);_0x9466a8(_0x2b456e[_0x9d95('0x12')](0x1f4,_0x4f026c['message']));});});}; \ No newline at end of file +var _0xbdfb=['result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','map','include','model','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','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'];(function(_0x8e933b,_0x53491a){var _0x19c520=function(_0x520212){while(--_0x520212){_0x8e933b['push'](_0x8e933b['shift']());}};_0x19c520(++_0x53491a);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x5cc556,_0x158710){_0x5cc556=_0x5cc556-0x0;var _0x12103b=_0xbdfb[_0x5cc556];return _0x12103b;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var moment=require(_0xbbdf('0x2'));var BPromise=require(_0xbbdf('0x3'));var rs=require(_0xbbdf('0x4'));var fs=require('fs');var Redis=require(_0xbbdf('0x5'));var db=require(_0xbbdf('0x6'))['db'];var utils=require(_0xbbdf('0x7'));var logger=require(_0xbbdf('0x8'))(_0xbbdf('0x9'));var config=require('../../config/environment');var jayson=require(_0xbbdf('0xa'));var client=jayson[_0xbbdf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c930d,_0x17c835,_0x58a929){return new BPromise(function(_0x2f9954,_0x2ae0d8){return client[_0xbbdf('0xc')](_0x3c930d,_0x58a929)[_0xbbdf('0xd')](function(_0x4c1436){logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');logger[_0xbbdf('0x10')](_0xbbdf('0x11'),_0x17c835,_0xbbdf('0x12'),JSON[_0xbbdf('0x13')](_0x4c1436));if(_0x4c1436['error']){if(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x15')]===0x1f4){logger[_0xbbdf('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x17c835,_0x4c1436['error']['message']);return _0x2ae0d8(_0x4c1436['error'][_0xbbdf('0x16')]);}logger[_0xbbdf('0x14')](_0xbbdf('0xf'),_0x17c835,_0x4c1436['error'][_0xbbdf('0x16')]);return _0x2f9954(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x16')]);}else{logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');_0x2f9954(_0x4c1436[_0xbbdf('0x17')][_0xbbdf('0x16')]);}})[_0xbbdf('0x18')](function(_0x547b94){logger['error'](_0xbbdf('0xf'),_0x17c835,_0x547b94);_0x2ae0d8(_0x547b94);});});}exports[_0xbbdf('0x19')]=function(_0xa723dc){var _0x276062=this;return new Promise(function(_0x37919c,_0x482d55){return db['FreshsalesAccount'][_0xbbdf('0x1a')]({'raw':_0xa723dc[_0xbbdf('0x1b')]?_0xa723dc[_0xbbdf('0x1b')][_0xbbdf('0x1c')]===undefined?!![]:![]:!![],'where':_0xa723dc[_0xbbdf('0x1b')]?_0xa723dc[_0xbbdf('0x1b')][_0xbbdf('0x1d')]||null:null,'attributes':_0xa723dc[_0xbbdf('0x1b')]?_0xa723dc[_0xbbdf('0x1b')][_0xbbdf('0x1e')]||null:null,'limit':_0xa723dc[_0xbbdf('0x1b')]?_0xa723dc[_0xbbdf('0x1b')]['limit']||null:null,'include':_0xa723dc['options']?_0xa723dc[_0xbbdf('0x1b')]['include']?_[_0xbbdf('0x1f')](_0xa723dc[_0xbbdf('0x1b')][_0xbbdf('0x20')],function(_0x5d03a5){return{'model':db[_0x5d03a5[_0xbbdf('0x21')]],'as':_0x5d03a5['as'],'attributes':_0x5d03a5[_0xbbdf('0x1e')],'include':_0x5d03a5[_0xbbdf('0x20')]?_[_0xbbdf('0x1f')](_0x5d03a5['include'],function(_0xa67162){return{'model':db[_0xa67162[_0xbbdf('0x21')]],'as':_0xa67162['as'],'attributes':_0xa67162[_0xbbdf('0x1e')],'include':_0xa67162['include']?_['map'](_0xa67162[_0xbbdf('0x20')],function(_0x49b3f1){return{'model':db[_0x49b3f1['model']],'as':_0x49b3f1['as'],'attributes':_0x49b3f1[_0xbbdf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbbdf('0xd')](function(_0x1d8590){logger[_0xbbdf('0xe')](_0xbbdf('0x19'),_0xa723dc);logger[_0xbbdf('0x10')](_0xbbdf('0x19'),_0xa723dc,JSON['stringify'](_0x1d8590));_0x37919c(_0x1d8590);})[_0xbbdf('0x18')](function(_0x392265){logger[_0xbbdf('0x14')](_0xbbdf('0x19'),_0x392265[_0xbbdf('0x16')],_0xa723dc);_0x482d55(_0x276062[_0xbbdf('0x14')](0x1f4,_0x392265[_0xbbdf('0x16')]));});});};exports['ShowFreshsalesAccount']=function(_0x5b3965){var _0x42ce4d=this;return new Promise(function(_0x568c87,_0x26cbb2){return db[_0xbbdf('0x22')][_0xbbdf('0x23')]({'raw':_0x5b3965[_0xbbdf('0x1b')]?_0x5b3965[_0xbbdf('0x1b')][_0xbbdf('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b3965[_0xbbdf('0x1b')]?_0x5b3965[_0xbbdf('0x1b')][_0xbbdf('0x1d')]||null:null,'attributes':_0x5b3965[_0xbbdf('0x1b')]?_0x5b3965[_0xbbdf('0x1b')]['attributes']||null:null,'include':_0x5b3965[_0xbbdf('0x1b')]?_0x5b3965[_0xbbdf('0x1b')][_0xbbdf('0x20')]?_['map'](_0x5b3965[_0xbbdf('0x1b')][_0xbbdf('0x20')],function(_0x3c697b){return{'model':db[_0x3c697b[_0xbbdf('0x21')]],'as':_0x3c697b['as'],'attributes':_0x3c697b[_0xbbdf('0x1e')],'include':_0x3c697b[_0xbbdf('0x20')]?_[_0xbbdf('0x1f')](_0x3c697b['include'],function(_0x2df293){return{'model':db[_0x2df293[_0xbbdf('0x21')]],'as':_0x2df293['as'],'attributes':_0x2df293[_0xbbdf('0x1e')],'include':_0x2df293[_0xbbdf('0x20')]?_[_0xbbdf('0x1f')](_0x2df293[_0xbbdf('0x20')],function(_0x576f37){return{'model':db[_0x576f37[_0xbbdf('0x21')]],'as':_0x576f37['as'],'attributes':_0x576f37[_0xbbdf('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x531a45){logger[_0xbbdf('0xe')](_0xbbdf('0x24'),_0x5b3965);logger[_0xbbdf('0x10')](_0xbbdf('0x24'),_0x5b3965,JSON['stringify'](_0x531a45));_0x568c87(_0x531a45);})[_0xbbdf('0x18')](function(_0x417811){logger[_0xbbdf('0x14')](_0xbbdf('0x24'),_0x417811['message'],_0x5b3965);_0x26cbb2(_0x42ce4d['error'](0x1f4,_0x417811[_0xbbdf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index b532793..ac4dcb0 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 _0xc1a7=['getFields','put','update','/:id','destroy','exports','multer','util','Router','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0x42a951,_0x4650bf){var _0x3a7f14=function(_0x32f122){while(--_0x32f122){_0x42a951['push'](_0x42a951['shift']());}};_0x3a7f14(++_0x4650bf);}(_0xc1a7,0x146));var _0x7c1a=function(_0xf2267d,_0x10c87c){_0xf2267d=_0xf2267d-0x0;var _0x207e0d=_0xc1a7[_0xf2267d];return _0x207e0d;};'use strict';var multer=require(_0x7c1a('0x0'));var util=require(_0x7c1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7c1a('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7c1a('0x3'));var controller=require(_0x7c1a('0x4'));router[_0x7c1a('0x5')]('/',auth[_0x7c1a('0x6')](),controller[_0x7c1a('0x7')]);router[_0x7c1a('0x5')]('/:id',auth[_0x7c1a('0x6')](),controller[_0x7c1a('0x8')]);router[_0x7c1a('0x5')](_0x7c1a('0x9'),auth[_0x7c1a('0x6')](),controller[_0x7c1a('0xa')]);router[_0x7c1a('0x5')](_0x7c1a('0xb'),auth[_0x7c1a('0x6')](),controller[_0x7c1a('0xc')]);router[_0x7c1a('0x5')](_0x7c1a('0xd'),auth[_0x7c1a('0x6')](),controller[_0x7c1a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7c1a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7c1a('0x10')]);router['delete'](_0x7c1a('0x11'),auth[_0x7c1a('0x6')](),controller[_0x7c1a('0x12')]);module[_0x7c1a('0x13')]=router; \ No newline at end of file +var _0x69a3=['/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','index','/:id','isAuthenticated','get','getSubjects'];(function(_0x5c4753,_0x4d7dc3){var _0xe9e24f=function(_0x451d28){while(--_0x451d28){_0x5c4753['push'](_0x5c4753['shift']());}};_0xe9e24f(++_0x4d7dc3);}(_0x69a3,0xd9));var _0x369a=function(_0x16f307,_0x3f2677){_0x16f307=_0x16f307-0x0;var _0x5dea52=_0x69a3[_0x16f307];return _0x5dea52;};'use strict';var multer=require(_0x369a('0x0'));var util=require(_0x369a('0x1'));var path=require(_0x369a('0x2'));var timeout=require(_0x369a('0x3'));var express=require('express');var router=express[_0x369a('0x4')]();var auth=require(_0x369a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x369a('0x6'));var controller=require(_0x369a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x369a('0x8')]);router['get'](_0x369a('0x9'),auth[_0x369a('0xa')](),controller['show']);router[_0x369a('0xb')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x369a('0xc')]);router[_0x369a('0xb')](_0x369a('0xd'),auth[_0x369a('0xa')](),controller['getDescriptions']);router[_0x369a('0xb')](_0x369a('0xe'),auth['isAuthenticated'](),controller[_0x369a('0xf')]);router[_0x369a('0x10')]('/',auth[_0x369a('0xa')](),controller[_0x369a('0x11')]);router[_0x369a('0x12')](_0x369a('0x9'),auth[_0x369a('0xa')](),controller[_0x369a('0x13')]);router[_0x369a('0x14')]('/:id',auth[_0x369a('0xa')](),controller[_0x369a('0x15')]);module[_0x369a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0328f9b..1ead957 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 _0xcdaf=['sequelize','exports','STRING'];(function(_0x37395e,_0x2e34df){var _0x39b3d5=function(_0x514566){while(--_0x514566){_0x37395e['push'](_0x37395e['shift']());}};_0x39b3d5(++_0x2e34df);}(_0xcdaf,0x1bc));var _0xfcda=function(_0x37a423,_0x4341db){_0x37a423=_0x37a423-0x0;var _0x31af9d=_0xcdaf[_0x37a423];return _0x31af9d;};'use strict';var Sequelize=require(_0xfcda('0x0'));module[_0xfcda('0x1')]={'name':{'type':Sequelize[_0xfcda('0x2')]},'description':{'type':Sequelize[_0xfcda('0x2')]}}; \ No newline at end of file +var _0x8641=['exports','STRING','sequelize'];(function(_0x376935,_0x396606){var _0x584703=function(_0x2177f1){while(--_0x2177f1){_0x376935['push'](_0x376935['shift']());}};_0x584703(++_0x396606);}(_0x8641,0x152));var _0x1864=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0x8641[_0x29bfbe];return _0x230663;};'use strict';var Sequelize=require(_0x1864('0x0'));module[_0x1864('0x1')]={'name':{'type':Sequelize[_0x1864('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3f3340c..61d66f9 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 _0x1261=['result','message','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','FreshsalesConfiguration','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1261,0x144));var _0x1126=function(_0x3e5b7b,_0x1ca279){_0x3e5b7b=_0x3e5b7b-0x0;var _0x441af8=_0x1261[_0x3e5b7b];return _0x441af8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var jayson=require(_0x1126('0x18'));var client=jayson[_0x1126('0x19')][_0x1126('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3f10e9,_0xd8ca42,_0x2048ad,_0x43850b){return new BPromise(function(_0x53a8f0,_0x5de9a7){var _0x1af673=_0x43850b||client;return _0x1af673[_0x1126('0x1b')](_0x3f10e9,_0x2048ad)[_0x1126('0x1c')](function(_0x4be0c6){logger[_0x1126('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd8ca42,_0x1126('0x1e'));logger[_0x1126('0x1f')](_0x1126('0x20'),_0xd8ca42,'request\x20sent',JSON[_0x1126('0x21')](_0x4be0c6));if(_0x4be0c6[_0x1126('0x22')]){if(_0x4be0c6['error']['code']===0x1f4){logger[_0x1126('0x22')](_0x1126('0x23'),_0xd8ca42,_0x4be0c6['error']['message']);return _0x5de9a7(_0x4be0c6[_0x1126('0x22')]['message']);}logger[_0x1126('0x22')](_0x1126('0x23'),_0xd8ca42,_0x4be0c6[_0x1126('0x22')]['message']);return _0x53a8f0(_0x4be0c6[_0x1126('0x22')]['message']);}else{logger['info'](_0x1126('0x23'),_0xd8ca42,_0x1126('0x1e'));_0x53a8f0(_0x4be0c6[_0x1126('0x24')][_0x1126('0x25')]);}})['catch'](function(_0x29ab60){logger[_0x1126('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd8ca42,_0x29ab60);_0x5de9a7(_0x29ab60);});});}function respondWithStatusCode(_0x2175fa,_0x59cd8e){_0x59cd8e=_0x59cd8e||0xcc;return function(_0x529dd9){if(_0x529dd9){return _0x2175fa['sendStatus'](_0x59cd8e);}return _0x2175fa[_0x1126('0x26')](_0x59cd8e)[_0x1126('0x27')]();};}function respondWithResult(_0x329914,_0x34bcf1){_0x34bcf1=_0x34bcf1||0xc8;return function(_0x566c09){if(_0x566c09){return _0x329914[_0x1126('0x26')](_0x34bcf1)[_0x1126('0x28')](_0x566c09);}};}function respondWithFilteredResult(_0x38119d,_0x589725){return function(_0x35eec3){if(_0x35eec3){var _0x375e59=_0x35eec3[_0x1126('0x29')],_0xa293f4=_0x589725[_0x1126('0x2a')],_0x5ddf63=_0x589725['offset']+_0x589725[_0x1126('0x2b')],_0x541bc9;if(_0x5ddf63>=_0x375e59){_0x5ddf63=_0x375e59;_0x541bc9=0xc8;}else{_0x541bc9=0xce;}_0x38119d[_0x1126('0x26')](_0x541bc9);return _0x38119d['set'](_0x1126('0x2c'),_0xa293f4+'-'+_0x5ddf63+'/'+_0x375e59)['json'](_0x35eec3);}return null;};}function patchUpdates(_0xc62460){return function(_0x4bd50b){try{jsonpatch[_0x1126('0x2d')](_0x4bd50b,_0xc62460,!![]);}catch(_0x583ce6){return BPromise[_0x1126('0x2e')](_0x583ce6);}return _0x4bd50b['save']();};}function saveUpdates(_0x5252e0,_0x4a53ab){return function(_0x17646e){if(_0x17646e){return _0x17646e[_0x1126('0x2f')](_0x5252e0)[_0x1126('0x1c')](function(_0x5b8bea){return _0x5b8bea;});}return null;};}function removeEntity(_0x2a3055,_0x226afb){return function(_0x56f7f8){if(_0x56f7f8){return _0x56f7f8[_0x1126('0x30')]()[_0x1126('0x1c')](function(){_0x2a3055[_0x1126('0x26')](0xcc)[_0x1126('0x27')]();});}};}function handleEntityNotFound(_0x5836a2,_0x5ecbc3){return function(_0x2a7edc){if(!_0x2a7edc){_0x5836a2[_0x1126('0x31')](0x194);}return _0x2a7edc;};}function handleError(_0x2d9bd2,_0x2c67eb){_0x2c67eb=_0x2c67eb||0x1f4;return function(_0x55244a){logger[_0x1126('0x22')](_0x55244a[_0x1126('0x32')]);if(_0x55244a[_0x1126('0x33')]){delete _0x55244a[_0x1126('0x33')];}_0x2d9bd2[_0x1126('0x26')](_0x2c67eb)['send'](_0x55244a);};}exports[_0x1126('0x34')]=function(_0x457efd,_0x1e8402){var _0x42e773={},_0x5c019d={},_0x4ca51c={'count':0x0,'rows':[]};var _0x22827a=_[_0x1126('0x35')](db['FreshsalesConfiguration'][_0x1126('0x36')],function(_0xf3c21b){return{'name':_0xf3c21b[_0x1126('0x37')],'type':_0xf3c21b['type']['key']};});_0x5c019d[_0x1126('0x38')]=_[_0x1126('0x35')](_0x22827a,_0x1126('0x33'));_0x5c019d[_0x1126('0x39')]=_['keys'](_0x457efd[_0x1126('0x39')]);_0x5c019d['filters']=_[_0x1126('0x3a')](_0x5c019d[_0x1126('0x38')],_0x5c019d[_0x1126('0x39')]);_0x42e773[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x5c019d['model'],qs[_0x1126('0x3c')](_0x457efd[_0x1126('0x39')][_0x1126('0x3c')]));_0x42e773[_0x1126('0x3b')]=_0x42e773[_0x1126('0x3b')][_0x1126('0x3d')]?_0x42e773[_0x1126('0x3b')]:_0x5c019d['model'];if(!_0x457efd[_0x1126('0x39')][_0x1126('0x3e')](_0x1126('0x3f'))){_0x42e773[_0x1126('0x2b')]=qs[_0x1126('0x2b')](_0x457efd['query']['limit']);_0x42e773[_0x1126('0x2a')]=qs[_0x1126('0x2a')](_0x457efd[_0x1126('0x39')][_0x1126('0x2a')]);}_0x42e773[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x457efd['query']['sort']);_0x42e773['where']=qs[_0x1126('0x42')](_['pick'](_0x457efd[_0x1126('0x39')],_0x5c019d[_0x1126('0x42')]),_0x22827a);if(_0x457efd[_0x1126('0x39')][_0x1126('0x43')]){_0x42e773['where']=_['merge'](_0x42e773[_0x1126('0x44')],{'$or':_[_0x1126('0x35')](_0x22827a,function(_0x1d63b9){if(_0x1d63b9['type']!==_0x1126('0x45')){var _0x5f35fa={};_0x5f35fa[_0x1d63b9[_0x1126('0x33')]]={'$like':'%'+_0x457efd['query'][_0x1126('0x43')]+'%'};return _0x5f35fa;}})});}_0x42e773=_[_0x1126('0x46')]({},_0x42e773,_0x457efd[_0x1126('0x47')]);var _0x4cbe19={'where':_0x42e773[_0x1126('0x44')]};return db[_0x1126('0x48')][_0x1126('0x29')](_0x4cbe19)['then'](function(_0x58ff3a){_0x4ca51c['count']=_0x58ff3a;if(_0x457efd[_0x1126('0x39')]['includeAll']){_0x42e773[_0x1126('0x49')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x1126('0x4a')](_0x42e773);})[_0x1126('0x1c')](function(_0x146066){_0x4ca51c[_0x1126('0x4b')]=_0x146066;return _0x4ca51c;})[_0x1126('0x1c')](respondWithFilteredResult(_0x1e8402,_0x42e773))['catch'](handleError(_0x1e8402,null));};exports[_0x1126('0x4c')]=function(_0x512f60,_0x5111d3){var _0x1a15f8={'raw':![],'where':{'id':_0x512f60['params']['id']}},_0x13dc39={};_0x13dc39[_0x1126('0x38')]=_[_0x1126('0x4d')](db['FreshsalesConfiguration'][_0x1126('0x36')]);_0x13dc39[_0x1126('0x39')]=_[_0x1126('0x4d')](_0x512f60['query']);_0x13dc39[_0x1126('0x42')]=_[_0x1126('0x3a')](_0x13dc39[_0x1126('0x38')],_0x13dc39[_0x1126('0x39')]);_0x1a15f8[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x13dc39[_0x1126('0x38')],qs[_0x1126('0x3c')](_0x512f60['query'][_0x1126('0x3c')]));_0x1a15f8['attributes']=_0x1a15f8[_0x1126('0x3b')][_0x1126('0x3d')]?_0x1a15f8['attributes']:_0x13dc39['model'];if(_0x512f60[_0x1126('0x39')][_0x1126('0x4e')]){_0x1a15f8[_0x1126('0x49')]=[{'all':!![]}];}_0x1a15f8=_['merge']({},_0x1a15f8,_0x512f60[_0x1126('0x47')]);return db[_0x1126('0x48')][_0x1126('0x4f')](_0x1a15f8)[_0x1126('0x1c')](handleEntityNotFound(_0x5111d3,null))['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x50')](handleError(_0x5111d3,null));};exports[_0x1126('0x51')]=function(_0x5c36b9,_0x4bcc08){return db['FreshsalesConfiguration']['create'](_0x5c36b9[_0x1126('0x52')],{})[_0x1126('0x1c')](respondWithResult(_0x4bcc08,0xc9))['catch'](handleError(_0x4bcc08,null));};exports[_0x1126('0x2f')]=function(_0x1c7a2b,_0x38093e){if(_0x1c7a2b[_0x1126('0x52')]['id']){delete _0x1c7a2b[_0x1126('0x52')]['id'];}return db['FreshsalesConfiguration'][_0x1126('0x4f')]({'where':{'id':_0x1c7a2b[_0x1126('0x53')]['id']}})['then'](handleEntityNotFound(_0x38093e,null))[_0x1126('0x1c')](saveUpdates(_0x1c7a2b[_0x1126('0x52')],null))[_0x1126('0x1c')](respondWithResult(_0x38093e,null))[_0x1126('0x50')](handleError(_0x38093e,null));};exports[_0x1126('0x30')]=function(_0x59c3d0,_0x673c09){return db['FreshsalesConfiguration'][_0x1126('0x4f')]({'where':{'id':_0x59c3d0[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x673c09,null))['then'](removeEntity(_0x673c09,null))[_0x1126('0x50')](handleError(_0x673c09,null));};exports[_0x1126('0x54')]=function(_0x5763b4,_0x30812d,_0x25038f){var _0x9bad53={};var _0x5a5340={};var _0x2fe6dc;var _0x3377db;return db[_0x1126('0x48')][_0x1126('0x55')]({'where':{'id':_0x5763b4[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x30812d,null))[_0x1126('0x1c')](function(_0x114be2){if(_0x114be2){_0x2fe6dc=_0x114be2;_0x5a5340['model']=_[_0x1126('0x4d')](db[_0x1126('0x56')][_0x1126('0x36')]);_0x5a5340[_0x1126('0x39')]=_[_0x1126('0x4d')](_0x5763b4['query']);_0x5a5340[_0x1126('0x42')]=_[_0x1126('0x3a')](_0x5a5340['model'],_0x5a5340[_0x1126('0x39')]);_0x9bad53['attributes']=_[_0x1126('0x3a')](_0x5a5340[_0x1126('0x38')],qs['fields'](_0x5763b4[_0x1126('0x39')][_0x1126('0x3c')]));_0x9bad53[_0x1126('0x3b')]=_0x9bad53['attributes'][_0x1126('0x3d')]?_0x9bad53['attributes']:_0x5a5340['model'];_0x9bad53[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x5763b4[_0x1126('0x39')][_0x1126('0x41')]);_0x9bad53[_0x1126('0x44')]=qs[_0x1126('0x42')](_[_0x1126('0x57')](_0x5763b4['query'],_0x5a5340[_0x1126('0x42')]));if(_0x5763b4[_0x1126('0x39')][_0x1126('0x43')]){_0x9bad53[_0x1126('0x44')]=_[_0x1126('0x46')](_0x9bad53[_0x1126('0x44')],{'$or':_['map'](_0x9bad53['attributes'],function(_0x16a343){var _0x3921c2={};_0x3921c2[_0x16a343]={'$like':'%'+_0x5763b4['query']['filter']+'%'};return _0x3921c2;})});}_0x9bad53=_['merge']({},_0x9bad53,_0x5763b4['options']);return _0x2fe6dc[_0x1126('0x54')](_0x9bad53);}})[_0x1126('0x1c')](function(_0x3440c5){if(_0x3440c5){_0x3377db=_0x3440c5['length'];if(!_0x5763b4[_0x1126('0x39')][_0x1126('0x3e')](_0x1126('0x3f'))){_0x9bad53[_0x1126('0x2b')]=qs[_0x1126('0x2b')](_0x5763b4[_0x1126('0x39')][_0x1126('0x2b')]);_0x9bad53['offset']=qs[_0x1126('0x2a')](_0x5763b4[_0x1126('0x39')][_0x1126('0x2a')]);}return _0x2fe6dc[_0x1126('0x54')](_0x9bad53);}})[_0x1126('0x1c')](function(_0x56c003){if(_0x56c003){return _0x56c003?{'count':_0x3377db,'rows':_0x56c003}:null;}})['then'](respondWithResult(_0x30812d,null))[_0x1126('0x50')](handleError(_0x30812d,null));};exports[_0x1126('0x58')]=function(_0x4f1b61,_0x3bf25d,_0x1fb2f0){var _0x366675={};var _0x6a41c0={};var _0x2828d4;var _0x30d240;return db[_0x1126('0x48')][_0x1126('0x55')]({'where':{'id':_0x4f1b61[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x3bf25d,null))[_0x1126('0x1c')](function(_0x1228cf){if(_0x1228cf){_0x2828d4=_0x1228cf;_0x6a41c0[_0x1126('0x38')]=_['keys'](db[_0x1126('0x56')][_0x1126('0x36')]);_0x6a41c0[_0x1126('0x39')]=_['keys'](_0x4f1b61['query']);_0x6a41c0[_0x1126('0x42')]=_[_0x1126('0x3a')](_0x6a41c0[_0x1126('0x38')],_0x6a41c0[_0x1126('0x39')]);_0x366675['attributes']=_['intersection'](_0x6a41c0['model'],qs[_0x1126('0x3c')](_0x4f1b61[_0x1126('0x39')][_0x1126('0x3c')]));_0x366675[_0x1126('0x3b')]=_0x366675['attributes'][_0x1126('0x3d')]?_0x366675['attributes']:_0x6a41c0[_0x1126('0x38')];_0x366675[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x4f1b61[_0x1126('0x39')][_0x1126('0x41')]);_0x366675[_0x1126('0x44')]=qs[_0x1126('0x42')](_['pick'](_0x4f1b61[_0x1126('0x39')],_0x6a41c0['filters']));if(_0x4f1b61[_0x1126('0x39')][_0x1126('0x43')]){_0x366675['where']=_[_0x1126('0x46')](_0x366675[_0x1126('0x44')],{'$or':_['map'](_0x366675[_0x1126('0x3b')],function(_0x1442ab){var _0x4b1d04={};_0x4b1d04[_0x1442ab]={'$like':'%'+_0x4f1b61['query'][_0x1126('0x43')]+'%'};return _0x4b1d04;})});}_0x366675=_[_0x1126('0x46')]({},_0x366675,_0x4f1b61[_0x1126('0x47')]);return _0x2828d4['getDescriptions'](_0x366675);}})['then'](function(_0x4b0fab){if(_0x4b0fab){_0x30d240=_0x4b0fab[_0x1126('0x3d')];if(!_0x4f1b61['query']['hasOwnProperty'](_0x1126('0x3f'))){_0x366675['limit']=qs[_0x1126('0x2b')](_0x4f1b61[_0x1126('0x39')]['limit']);_0x366675[_0x1126('0x2a')]=qs[_0x1126('0x2a')](_0x4f1b61[_0x1126('0x39')][_0x1126('0x2a')]);}return _0x2828d4[_0x1126('0x58')](_0x366675);}})['then'](function(_0xec8540){if(_0xec8540){return _0xec8540?{'count':_0x30d240,'rows':_0xec8540}:null;}})[_0x1126('0x1c')](respondWithResult(_0x3bf25d,null))['catch'](handleError(_0x3bf25d,null));};exports[_0x1126('0x59')]=function(_0x2d6fcf,_0x2c0908,_0x2af2d0){var _0x2598a7={};var _0x2cf3b9={};var _0x59512b;var _0x301118;return db[_0x1126('0x48')][_0x1126('0x55')]({'where':{'id':_0x2d6fcf[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x2c0908,null))[_0x1126('0x1c')](function(_0x3b5384){if(_0x3b5384){_0x59512b=_0x3b5384;_0x2cf3b9[_0x1126('0x38')]=_[_0x1126('0x4d')](db['FreshsalesField'][_0x1126('0x36')]);_0x2cf3b9[_0x1126('0x39')]=_[_0x1126('0x4d')](_0x2d6fcf[_0x1126('0x39')]);_0x2cf3b9[_0x1126('0x42')]=_['intersection'](_0x2cf3b9[_0x1126('0x38')],_0x2cf3b9['query']);_0x2598a7['attributes']=_[_0x1126('0x3a')](_0x2cf3b9[_0x1126('0x38')],qs['fields'](_0x2d6fcf['query'][_0x1126('0x3c')]));_0x2598a7[_0x1126('0x3b')]=_0x2598a7[_0x1126('0x3b')][_0x1126('0x3d')]?_0x2598a7[_0x1126('0x3b')]:_0x2cf3b9[_0x1126('0x38')];_0x2598a7[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x2d6fcf[_0x1126('0x39')]['sort']);_0x2598a7[_0x1126('0x44')]=qs[_0x1126('0x42')](_[_0x1126('0x57')](_0x2d6fcf[_0x1126('0x39')],_0x2cf3b9[_0x1126('0x42')]));if(_0x2d6fcf[_0x1126('0x39')]['filter']){_0x2598a7[_0x1126('0x44')]=_[_0x1126('0x46')](_0x2598a7[_0x1126('0x44')],{'$or':_[_0x1126('0x35')](_0x2598a7[_0x1126('0x3b')],function(_0x1796eb){var _0x2418ca={};_0x2418ca[_0x1796eb]={'$like':'%'+_0x2d6fcf[_0x1126('0x39')][_0x1126('0x43')]+'%'};return _0x2418ca;})});}_0x2598a7=_[_0x1126('0x46')]({},_0x2598a7,_0x2d6fcf['options']);return _0x59512b['getFields'](_0x2598a7);}})[_0x1126('0x1c')](function(_0x55496f){if(_0x55496f){_0x301118=_0x55496f[_0x1126('0x3d')];if(!_0x2d6fcf['query'][_0x1126('0x3e')]('nolimit')){_0x2598a7[_0x1126('0x2b')]=qs['limit'](_0x2d6fcf['query']['limit']);_0x2598a7[_0x1126('0x2a')]=qs[_0x1126('0x2a')](_0x2d6fcf['query']['offset']);}return _0x59512b[_0x1126('0x59')](_0x2598a7);}})[_0x1126('0x1c')](function(_0x185fd6){if(_0x185fd6){return _0x185fd6?{'count':_0x301118,'rows':_0x185fd6}:null;}})['then'](respondWithResult(_0x2c0908,null))['catch'](handleError(_0x2c0908,null));}; \ No newline at end of file +var _0x4975=['limit','Content-Range','reject','save','then','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','rows','show','params','includeAll','find','create','update','body','destroy','FreshsalesConfiguration','getSubjects','findOne','FreshsalesField','order','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json'];(function(_0x941f93,_0x512d1e){var _0x18997d=function(_0x321eb7){while(--_0x321eb7){_0x941f93['push'](_0x941f93['shift']());}};_0x18997d(++_0x512d1e);}(_0x4975,0x86));var _0x5497=function(_0x3f0af9,_0x29d7c4){_0x3f0af9=_0x3f0af9-0x0;var _0x324d6e=_0x4975[_0x3f0af9];return _0x324d6e;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x18'))['db'];var jayson=require(_0x5497('0x19'));var client=jayson[_0x5497('0x1a')][_0x5497('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x747dc7,_0x365144,_0x1f7169,_0xaca97d){return new BPromise(function(_0x363a5b,_0x1a4c74){var _0x55f590=_0xaca97d||client;return _0x55f590[_0x5497('0x1c')](_0x747dc7,_0x1f7169)['then'](function(_0x4237a9){logger[_0x5497('0x1d')](_0x5497('0x1e'),_0x365144,_0x5497('0x1f'));logger[_0x5497('0x20')](_0x5497('0x21'),_0x365144,_0x5497('0x1f'),JSON['stringify'](_0x4237a9));if(_0x4237a9['error']){if(_0x4237a9[_0x5497('0x22')][_0x5497('0x23')]===0x1f4){logger[_0x5497('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x1a4c74(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x363a5b(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}else{logger[_0x5497('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x5497('0x1f'));_0x363a5b(_0x4237a9['result'][_0x5497('0x24')]);}})[_0x5497('0x25')](function(_0x44265c){logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x44265c);_0x1a4c74(_0x44265c);});});}function respondWithStatusCode(_0x3b2fbc,_0x5018fa){_0x5018fa=_0x5018fa||0xcc;return function(_0x54043a){if(_0x54043a){return _0x3b2fbc[_0x5497('0x26')](_0x5018fa);}return _0x3b2fbc[_0x5497('0x27')](_0x5018fa)[_0x5497('0x28')]();};}function respondWithResult(_0x281155,_0x5223b5){_0x5223b5=_0x5223b5||0xc8;return function(_0x13b7a4){if(_0x13b7a4){return _0x281155['status'](_0x5223b5)[_0x5497('0x29')](_0x13b7a4);}};}function respondWithFilteredResult(_0x16a2b4,_0x429d36){return function(_0x34a1a5){if(_0x34a1a5){var _0x163a30=_0x34a1a5['count'],_0x31cd01=_0x429d36['offset'],_0x48b835=_0x429d36['offset']+_0x429d36[_0x5497('0x2a')],_0x4af5f4;if(_0x48b835>=_0x163a30){_0x48b835=_0x163a30;_0x4af5f4=0xc8;}else{_0x4af5f4=0xce;}_0x16a2b4['status'](_0x4af5f4);return _0x16a2b4['set'](_0x5497('0x2b'),_0x31cd01+'-'+_0x48b835+'/'+_0x163a30)[_0x5497('0x29')](_0x34a1a5);}return null;};}function patchUpdates(_0x1cf908){return function(_0x4c442a){try{jsonpatch['apply'](_0x4c442a,_0x1cf908,!![]);}catch(_0x58230b){return BPromise[_0x5497('0x2c')](_0x58230b);}return _0x4c442a[_0x5497('0x2d')]();};}function saveUpdates(_0xf4c117,_0x5b8f79){return function(_0x489f71){if(_0x489f71){return _0x489f71['update'](_0xf4c117)[_0x5497('0x2e')](function(_0x572460){return _0x572460;});}return null;};}function removeEntity(_0x438ee4,_0x258c2d){return function(_0x77c575){if(_0x77c575){return _0x77c575['destroy']()[_0x5497('0x2e')](function(){_0x438ee4[_0x5497('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce7cb2,_0xce2e81){return function(_0x331dfc){if(!_0x331dfc){_0xce7cb2['sendStatus'](0x194);}return _0x331dfc;};}function handleError(_0x3395f6,_0x2fe1f2){_0x2fe1f2=_0x2fe1f2||0x1f4;return function(_0x125d51){logger[_0x5497('0x22')](_0x125d51[_0x5497('0x2f')]);if(_0x125d51['name']){delete _0x125d51[_0x5497('0x30')];}_0x3395f6[_0x5497('0x27')](_0x2fe1f2)['send'](_0x125d51);};}exports[_0x5497('0x31')]=function(_0x44299b,_0xc7730){var _0x1b9cd8={},_0x1656c7={},_0x37011c={'count':0x0,'rows':[]};var _0x580e86=_[_0x5497('0x32')](db['FreshsalesConfiguration'][_0x5497('0x33')],function(_0x212199){return{'name':_0x212199[_0x5497('0x34')],'type':_0x212199['type']['key']};});_0x1656c7[_0x5497('0x35')]=_[_0x5497('0x32')](_0x580e86,_0x5497('0x30'));_0x1656c7[_0x5497('0x36')]=_[_0x5497('0x37')](_0x44299b[_0x5497('0x36')]);_0x1656c7['filters']=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],_0x1656c7[_0x5497('0x36')]);_0x1b9cd8[_0x5497('0x39')]=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x44299b[_0x5497('0x36')][_0x5497('0x3a')]));_0x1b9cd8['attributes']=_0x1b9cd8[_0x5497('0x39')][_0x5497('0x3b')]?_0x1b9cd8[_0x5497('0x39')]:_0x1656c7[_0x5497('0x35')];if(!_0x44299b[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1b9cd8['limit']=qs[_0x5497('0x2a')](_0x44299b[_0x5497('0x36')][_0x5497('0x2a')]);_0x1b9cd8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x44299b[_0x5497('0x36')][_0x5497('0x3e')]);}_0x1b9cd8['order']=qs[_0x5497('0x3f')](_0x44299b[_0x5497('0x36')][_0x5497('0x3f')]);_0x1b9cd8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x44299b[_0x5497('0x36')],_0x1656c7[_0x5497('0x41')]),_0x580e86);if(_0x44299b[_0x5497('0x36')][_0x5497('0x43')]){_0x1b9cd8['where']=_[_0x5497('0x44')](_0x1b9cd8['where'],{'$or':_[_0x5497('0x32')](_0x580e86,function(_0x9fc24){if(_0x9fc24[_0x5497('0x45')]!==_0x5497('0x46')){var _0x133746={};_0x133746[_0x9fc24['name']]={'$like':'%'+_0x44299b[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x133746;}})});}_0x1b9cd8=_['merge']({},_0x1b9cd8,_0x44299b[_0x5497('0x47')]);var _0x553279={'where':_0x1b9cd8[_0x5497('0x40')]};return db['FreshsalesConfiguration'][_0x5497('0x48')](_0x553279)[_0x5497('0x2e')](function(_0x2e8c6a){_0x37011c[_0x5497('0x48')]=_0x2e8c6a;if(_0x44299b[_0x5497('0x36')]['includeAll']){_0x1b9cd8['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1b9cd8);})[_0x5497('0x2e')](function(_0x43c430){_0x37011c[_0x5497('0x49')]=_0x43c430;return _0x37011c;})[_0x5497('0x2e')](respondWithFilteredResult(_0xc7730,_0x1b9cd8))[_0x5497('0x25')](handleError(_0xc7730,null));};exports[_0x5497('0x4a')]=function(_0xc78abe,_0x466287){var _0x2626bf={'raw':![],'where':{'id':_0xc78abe[_0x5497('0x4b')]['id']}},_0x57350a={};_0x57350a[_0x5497('0x35')]=_[_0x5497('0x37')](db['FreshsalesConfiguration'][_0x5497('0x33')]);_0x57350a['query']=_[_0x5497('0x37')](_0xc78abe[_0x5497('0x36')]);_0x57350a[_0x5497('0x41')]=_['intersection'](_0x57350a[_0x5497('0x35')],_0x57350a[_0x5497('0x36')]);_0x2626bf['attributes']=_[_0x5497('0x38')](_0x57350a['model'],qs[_0x5497('0x3a')](_0xc78abe['query'][_0x5497('0x3a')]));_0x2626bf[_0x5497('0x39')]=_0x2626bf[_0x5497('0x39')][_0x5497('0x3b')]?_0x2626bf[_0x5497('0x39')]:_0x57350a[_0x5497('0x35')];if(_0xc78abe[_0x5497('0x36')][_0x5497('0x4c')]){_0x2626bf['include']=[{'all':!![]}];}_0x2626bf=_[_0x5497('0x44')]({},_0x2626bf,_0xc78abe['options']);return db['FreshsalesConfiguration'][_0x5497('0x4d')](_0x2626bf)[_0x5497('0x2e')](handleEntityNotFound(_0x466287,null))['then'](respondWithResult(_0x466287,null))[_0x5497('0x25')](handleError(_0x466287,null));};exports[_0x5497('0x4e')]=function(_0x436a83,_0x3094c7){return db['FreshsalesConfiguration'][_0x5497('0x4e')](_0x436a83['body'],{})['then'](respondWithResult(_0x3094c7,0xc9))[_0x5497('0x25')](handleError(_0x3094c7,null));};exports[_0x5497('0x4f')]=function(_0x2f7ec8,_0x49c85a){if(_0x2f7ec8['body']['id']){delete _0x2f7ec8[_0x5497('0x50')]['id'];}return db['FreshsalesConfiguration'][_0x5497('0x4d')]({'where':{'id':_0x2f7ec8['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x49c85a,null))['then'](saveUpdates(_0x2f7ec8[_0x5497('0x50')],null))[_0x5497('0x2e')](respondWithResult(_0x49c85a,null))['catch'](handleError(_0x49c85a,null));};exports[_0x5497('0x51')]=function(_0x5dccfb,_0x506d69){return db[_0x5497('0x52')][_0x5497('0x4d')]({'where':{'id':_0x5dccfb['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x506d69,null))[_0x5497('0x2e')](removeEntity(_0x506d69,null))[_0x5497('0x25')](handleError(_0x506d69,null));};exports[_0x5497('0x53')]=function(_0x3fca40,_0x25c75e,_0x590be7){var _0x215ea8={};var _0x4916cd={};var _0x4e0d4c;var _0x480582;return db[_0x5497('0x52')][_0x5497('0x54')]({'where':{'id':_0x3fca40[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25c75e,null))[_0x5497('0x2e')](function(_0x528fb4){if(_0x528fb4){_0x4e0d4c=_0x528fb4;_0x4916cd['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x4916cd[_0x5497('0x36')]=_[_0x5497('0x37')](_0x3fca40[_0x5497('0x36')]);_0x4916cd['filters']=_[_0x5497('0x38')](_0x4916cd[_0x5497('0x35')],_0x4916cd[_0x5497('0x36')]);_0x215ea8[_0x5497('0x39')]=_['intersection'](_0x4916cd[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x3fca40[_0x5497('0x36')][_0x5497('0x3a')]));_0x215ea8['attributes']=_0x215ea8[_0x5497('0x39')][_0x5497('0x3b')]?_0x215ea8[_0x5497('0x39')]:_0x4916cd['model'];_0x215ea8[_0x5497('0x56')]=qs['sort'](_0x3fca40['query']['sort']);_0x215ea8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x3fca40['query'],_0x4916cd[_0x5497('0x41')]));if(_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]){_0x215ea8[_0x5497('0x40')]=_['merge'](_0x215ea8[_0x5497('0x40')],{'$or':_[_0x5497('0x32')](_0x215ea8[_0x5497('0x39')],function(_0x49617c){var _0x164de1={};_0x164de1[_0x49617c]={'$like':'%'+_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x164de1;})});}_0x215ea8=_[_0x5497('0x44')]({},_0x215ea8,_0x3fca40[_0x5497('0x47')]);return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x4b4cfe){if(_0x4b4cfe){_0x480582=_0x4b4cfe[_0x5497('0x3b')];if(!_0x3fca40[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x215ea8['limit']=qs['limit'](_0x3fca40['query'][_0x5497('0x2a')]);_0x215ea8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x3fca40['query'][_0x5497('0x3e')]);}return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x464df3){if(_0x464df3){return _0x464df3?{'count':_0x480582,'rows':_0x464df3}:null;}})[_0x5497('0x2e')](respondWithResult(_0x25c75e,null))[_0x5497('0x25')](handleError(_0x25c75e,null));};exports[_0x5497('0x57')]=function(_0x23bd32,_0x21da3d,_0x940188){var _0x1fc6ad={};var _0x5a8b3a={};var _0x15d5a4;var _0x2940ec;return db[_0x5497('0x52')]['findOne']({'where':{'id':_0x23bd32[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21da3d,null))[_0x5497('0x2e')](function(_0x469e97){if(_0x469e97){_0x15d5a4=_0x469e97;_0x5a8b3a['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x5a8b3a[_0x5497('0x36')]=_['keys'](_0x23bd32[_0x5497('0x36')]);_0x5a8b3a[_0x5497('0x41')]=_[_0x5497('0x38')](_0x5a8b3a['model'],_0x5a8b3a[_0x5497('0x36')]);_0x1fc6ad[_0x5497('0x39')]=_['intersection'](_0x5a8b3a[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x23bd32[_0x5497('0x36')]['fields']));_0x1fc6ad['attributes']=_0x1fc6ad[_0x5497('0x39')][_0x5497('0x3b')]?_0x1fc6ad[_0x5497('0x39')]:_0x5a8b3a[_0x5497('0x35')];_0x1fc6ad[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x23bd32[_0x5497('0x36')]['sort']);_0x1fc6ad['where']=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x23bd32['query'],_0x5a8b3a[_0x5497('0x41')]));if(_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]){_0x1fc6ad['where']=_[_0x5497('0x44')](_0x1fc6ad[_0x5497('0x40')],{'$or':_['map'](_0x1fc6ad[_0x5497('0x39')],function(_0x16e2cf){var _0x9458d7={};_0x9458d7[_0x16e2cf]={'$like':'%'+_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x9458d7;})});}_0x1fc6ad=_['merge']({},_0x1fc6ad,_0x23bd32[_0x5497('0x47')]);return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x23e259){if(_0x23e259){_0x2940ec=_0x23e259[_0x5497('0x3b')];if(!_0x23bd32['query'][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1fc6ad[_0x5497('0x2a')]=qs[_0x5497('0x2a')](_0x23bd32['query'][_0x5497('0x2a')]);_0x1fc6ad[_0x5497('0x3e')]=qs['offset'](_0x23bd32[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x53b1b7){if(_0x53b1b7){return _0x53b1b7?{'count':_0x2940ec,'rows':_0x53b1b7}:null;}})['then'](respondWithResult(_0x21da3d,null))['catch'](handleError(_0x21da3d,null));};exports['getFields']=function(_0x594761,_0x2d5543,_0x2375cc){var _0x15d0da={};var _0x1f02d3={};var _0x41f347;var _0x4b7c43;return db['FreshsalesConfiguration'][_0x5497('0x54')]({'where':{'id':_0x594761[_0x5497('0x4b')]['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x2d5543,null))[_0x5497('0x2e')](function(_0x307dc5){if(_0x307dc5){_0x41f347=_0x307dc5;_0x1f02d3[_0x5497('0x35')]=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x1f02d3[_0x5497('0x36')]=_['keys'](_0x594761[_0x5497('0x36')]);_0x1f02d3[_0x5497('0x41')]=_[_0x5497('0x38')](_0x1f02d3[_0x5497('0x35')],_0x1f02d3[_0x5497('0x36')]);_0x15d0da[_0x5497('0x39')]=_['intersection'](_0x1f02d3[_0x5497('0x35')],qs['fields'](_0x594761[_0x5497('0x36')][_0x5497('0x3a')]));_0x15d0da[_0x5497('0x39')]=_0x15d0da['attributes']['length']?_0x15d0da[_0x5497('0x39')]:_0x1f02d3[_0x5497('0x35')];_0x15d0da[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x594761[_0x5497('0x36')][_0x5497('0x3f')]);_0x15d0da[_0x5497('0x40')]=qs[_0x5497('0x41')](_['pick'](_0x594761['query'],_0x1f02d3['filters']));if(_0x594761[_0x5497('0x36')][_0x5497('0x43')]){_0x15d0da[_0x5497('0x40')]=_[_0x5497('0x44')](_0x15d0da['where'],{'$or':_['map'](_0x15d0da[_0x5497('0x39')],function(_0xf38193){var _0x5dd9bc={};_0x5dd9bc[_0xf38193]={'$like':'%'+_0x594761[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x5dd9bc;})});}_0x15d0da=_[_0x5497('0x44')]({},_0x15d0da,_0x594761[_0x5497('0x47')]);return _0x41f347['getFields'](_0x15d0da);}})['then'](function(_0x55e597){if(_0x55e597){_0x4b7c43=_0x55e597['length'];if(!_0x594761['query'][_0x5497('0x3c')]('nolimit')){_0x15d0da[_0x5497('0x2a')]=qs['limit'](_0x594761[_0x5497('0x36')][_0x5497('0x2a')]);_0x15d0da[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x594761[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x41f347['getFields'](_0x15d0da);}})[_0x5497('0x2e')](function(_0x513479){if(_0x513479){return _0x513479?{'count':_0x4b7c43,'rows':_0x513479}:null;}})[_0x5497('0x2e')](respondWithResult(_0x2d5543,null))[_0x5497('0x25')](handleError(_0x2d5543,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ac30671..fc147fa 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 _0xc577=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','lodash','api','moment','bluebird'];(function(_0x182648,_0x2a7b01){var _0x10d106=function(_0x343645){while(--_0x343645){_0x182648['push'](_0x182648['shift']());}};_0x10d106(++_0x2a7b01);}(_0xc577,0x172));var _0x7c57=function(_0x4d3b1b,_0x1b1049){_0x4d3b1b=_0x4d3b1b-0x0;var _0x521593=_0xc577[_0x4d3b1b];return _0x521593;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7c57('0x1'));var moment=require(_0x7c57('0x2'));var BPromise=require(_0x7c57('0x3'));var rp=require(_0x7c57('0x4'));var fs=require('fs');var path=require(_0x7c57('0x5'));var rimraf=require(_0x7c57('0x6'));var config=require(_0x7c57('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x7c57('0x8')]=function(_0x1339b3,_0xf50a9f){return _0x1339b3[_0x7c57('0x9')](_0x7c57('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa376=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','../../config/logger','moment','bluebird','rimraf'];(function(_0x193ea2,_0x402967){var _0x101cba=function(_0x4cc1a8){while(--_0x4cc1a8){_0x193ea2['push'](_0x193ea2['shift']());}};_0x101cba(++_0x402967);}(_0xa376,0x88));var _0x6a37=function(_0x4b8f46,_0x6c231a){_0x4b8f46=_0x4b8f46-0x0;var _0x4a3483=_0xa376[_0x4b8f46];return _0x4a3483;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a37('0x0'))('api');var moment=require(_0x6a37('0x1'));var BPromise=require(_0x6a37('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6a37('0x3'));var config=require(_0x6a37('0x4'));var attributes=require(_0x6a37('0x5'));module[_0x6a37('0x6')]=function(_0x2bf48c,_0x58a562){return _0x2bf48c[_0x6a37('0x7')](_0x6a37('0x8'),attributes,{'tableName':_0x6a37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index ce1a04f..979fbf2 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 _0xcce8=['FreshsalesConfiguration,\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','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1ec3ba,_0x312f55){var _0x4516ba=function(_0x45f55a){while(--_0x45f55a){_0x1ec3ba['push'](_0x1ec3ba['shift']());}};_0x4516ba(++_0x312f55);}(_0xcce8,0x1a5));var _0x8cce=function(_0x47c920,_0x48e0c1){_0x47c920=_0x47c920-0x0;var _0x36a003=_0xcce8[_0x47c920];return _0x36a003;};'use strict';var _=require(_0x8cce('0x0'));var util=require(_0x8cce('0x1'));var moment=require(_0x8cce('0x2'));var BPromise=require(_0x8cce('0x3'));var rs=require(_0x8cce('0x4'));var fs=require('fs');var Redis=require(_0x8cce('0x5'));var db=require(_0x8cce('0x6'))['db'];var utils=require(_0x8cce('0x7'));var logger=require(_0x8cce('0x8'))(_0x8cce('0x9'));var config=require('../../config/environment');var jayson=require(_0x8cce('0xa'));var client=jayson[_0x8cce('0xb')][_0x8cce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xca15a9,_0x382fca,_0x1421b3){return new BPromise(function(_0x5244e1,_0x56c14d){return client['request'](_0xca15a9,_0x1421b3)[_0x8cce('0xd')](function(_0x525d11){logger['info'](_0x8cce('0xe'),_0x382fca,_0x8cce('0xf'));logger['debug'](_0x8cce('0x10'),_0x382fca,_0x8cce('0xf'),JSON[_0x8cce('0x11')](_0x525d11));if(_0x525d11['error']){if(_0x525d11[_0x8cce('0x12')][_0x8cce('0x13')]===0x1f4){logger[_0x8cce('0x12')](_0x8cce('0xe'),_0x382fca,_0x525d11['error'][_0x8cce('0x14')]);return _0x56c14d(_0x525d11[_0x8cce('0x12')][_0x8cce('0x14')]);}logger[_0x8cce('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x382fca,_0x525d11[_0x8cce('0x12')]['message']);return _0x5244e1(_0x525d11['error'][_0x8cce('0x14')]);}else{logger['info'](_0x8cce('0xe'),_0x382fca,_0x8cce('0xf'));_0x5244e1(_0x525d11[_0x8cce('0x15')][_0x8cce('0x14')]);}})[_0x8cce('0x16')](function(_0x251edd){logger[_0x8cce('0x12')](_0x8cce('0xe'),_0x382fca,_0x251edd);_0x56c14d(_0x251edd);});});} \ No newline at end of file +var _0x4dc0=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x417fcd,_0x16a009){var _0x5af139=function(_0xe24a36){while(--_0xe24a36){_0x417fcd['push'](_0x417fcd['shift']());}};_0x5af139(++_0x16a009);}(_0x4dc0,0x13d));var _0x04dc=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4dc0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x04dc('0x0'));var BPromise=require(_0x04dc('0x1'));var rs=require(_0x04dc('0x2'));var fs=require('fs');var Redis=require(_0x04dc('0x3'));var db=require(_0x04dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x04dc('0x5'))(_0x04dc('0x6'));var config=require(_0x04dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x04dc('0x8')][_0x04dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40d327,_0x53cc43,_0x53f6e4){return new BPromise(function(_0x5ce79e,_0x118c0e){return client[_0x04dc('0xa')](_0x40d327,_0x53f6e4)[_0x04dc('0xb')](function(_0x2641fa){logger[_0x04dc('0xc')](_0x04dc('0xd'),_0x53cc43,_0x04dc('0xe'));logger[_0x04dc('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x53cc43,_0x04dc('0xe'),JSON[_0x04dc('0x10')](_0x2641fa));if(_0x2641fa[_0x04dc('0x11')]){if(_0x2641fa['error'][_0x04dc('0x12')]===0x1f4){logger[_0x04dc('0x11')](_0x04dc('0xd'),_0x53cc43,_0x2641fa['error'][_0x04dc('0x13')]);return _0x118c0e(_0x2641fa[_0x04dc('0x11')][_0x04dc('0x13')]);}logger[_0x04dc('0x11')](_0x04dc('0xd'),_0x53cc43,_0x2641fa[_0x04dc('0x11')][_0x04dc('0x13')]);return _0x5ce79e(_0x2641fa['error']['message']);}else{logger['info'](_0x04dc('0xd'),_0x53cc43,_0x04dc('0xe'));_0x5ce79e(_0x2641fa[_0x04dc('0x14')][_0x04dc('0x13')]);}})[_0x04dc('0x15')](function(_0x1ff3eb){logger[_0x04dc('0x11')](_0x04dc('0xd'),_0x53cc43,_0x1ff3eb);_0x118c0e(_0x1ff3eb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f5f4f0e..62e6d05 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 _0x1ec6=['put','update','destroy','exports','multer','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x314afa,_0x5ad073){var _0x386bfb=function(_0x3f7b89){while(--_0x3f7b89){_0x314afa['push'](_0x314afa['shift']());}};_0x386bfb(++_0x5ad073);}(_0x1ec6,0x170));var _0x61ec=function(_0x593f0e,_0x3555e7){_0x593f0e=_0x593f0e-0x0;var _0x116f30=_0x1ec6[_0x593f0e];return _0x116f30;};'use strict';var multer=require(_0x61ec('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x61ec('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x61ec('0x2'));var config=require(_0x61ec('0x3'));var controller=require('./intFreshsalesField.controller');router[_0x61ec('0x4')]('/',auth[_0x61ec('0x5')](),controller[_0x61ec('0x6')]);router[_0x61ec('0x4')](_0x61ec('0x7'),auth[_0x61ec('0x5')](),controller[_0x61ec('0x8')]);router[_0x61ec('0x9')]('/',auth[_0x61ec('0x5')](),controller['create']);router[_0x61ec('0xa')]('/:id',auth[_0x61ec('0x5')](),controller[_0x61ec('0xb')]);router['delete'](_0x61ec('0x7'),auth[_0x61ec('0x5')](),controller[_0x61ec('0xc')]);module[_0x61ec('0xd')]=router; \ No newline at end of file +var _0xfadd=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','create','put','update','multer','path','connect-timeout','express'];(function(_0x2e0fb0,_0x1b022d){var _0x5e6e2b=function(_0x51713c){while(--_0x51713c){_0x2e0fb0['push'](_0x2e0fb0['shift']());}};_0x5e6e2b(++_0x1b022d);}(_0xfadd,0x1dc));var _0xdfad=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfadd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdfad('0x0'));var util=require('util');var path=require(_0xdfad('0x1'));var timeout=require(_0xdfad('0x2'));var express=require(_0xdfad('0x3'));var router=express[_0xdfad('0x4')]();var auth=require(_0xdfad('0x5'));var interaction=require(_0xdfad('0x6'));var config=require('../../config/environment');var controller=require(_0xdfad('0x7'));router['get']('/',auth[_0xdfad('0x8')](),controller[_0xdfad('0x9')]);router[_0xdfad('0xa')](_0xdfad('0xb'),auth['isAuthenticated'](),controller[_0xdfad('0xc')]);router['post']('/',auth[_0xdfad('0x8')](),controller[_0xdfad('0xd')]);router[_0xdfad('0xe')](_0xdfad('0xb'),auth[_0xdfad('0x8')](),controller[_0xdfad('0xf')]);router['delete'](_0xdfad('0xb'),auth[_0xdfad('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d7a2ff6..8f6ed29 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 _0x04d0=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x53fb9a,_0x5d9d96){var _0x4cbf98=function(_0x5a2a59){while(--_0x5a2a59){_0x53fb9a['push'](_0x53fb9a['shift']());}};_0x4cbf98(++_0x5d9d96);}(_0x04d0,0x10a));var _0x004d=function(_0x12c71d,_0x3a831d){_0x12c71d=_0x12c71d-0x0;var _0x155cca=_0x04d0[_0x12c71d];return _0x155cca;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x004d('0x0')](_0x004d('0x1'),_0x004d('0x2'),_0x004d('0x3'),_0x004d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x004d('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x004d('0x1'),_0x004d('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x004d('0x5')]},'idField':{'type':Sequelize[_0x004d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x004d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2258=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x26e921,_0x26a8b3){var _0x3296da=function(_0x2d9cd2){while(--_0x2d9cd2){_0x26e921['push'](_0x26e921['shift']());}};_0x3296da(++_0x26a8b3);}(_0x2258,0x108));var _0x8225=function(_0x3017d1,_0x2e07c8){_0x3017d1=_0x3017d1-0x0;var _0x31c289=_0x2258[_0x3017d1];return _0x31c289;};'use strict';var Sequelize=require(_0x8225('0x0'));module[_0x8225('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8225('0x2'),_0x8225('0x3'),_0x8225('0x4'),_0x8225('0x5')),'defaultValue':_0x8225('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8225('0x6')]},'keyType':{'type':Sequelize[_0x8225('0x7')](_0x8225('0x2'),_0x8225('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x8225('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8225('0x6')]},'customField':{'type':Sequelize[_0x8225('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8225('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 243d850..7d141e4 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 _0x8ba6=['query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','FreshsalesField','includeAll','rows','show','include','find','create','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map'];(function(_0x6d070a,_0x47e825){var _0x2c065d=function(_0xd0565c){while(--_0xd0565c){_0x6d070a['push'](_0x6d070a['shift']());}};_0x2c065d(++_0x47e825);}(_0x8ba6,0xa1));var _0x68ba=function(_0xa348f6,_0x575a1a){_0xa348f6=_0xa348f6-0x0;var _0xc03a0f=_0x8ba6[_0xa348f6];return _0xc03a0f;};'use strict';var pdf=require(_0x68ba('0x0'));var emlformat=require(_0x68ba('0x1'));var rimraf=require(_0x68ba('0x2'));var zipdir=require(_0x68ba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68ba('0x4'));var moment=require('moment');var BPromise=require(_0x68ba('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x68ba('0x6'));var sox=require(_0x68ba('0x7'));var csv=require('to-csv');var ejs=require(_0x68ba('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x68ba('0x9'));var crypto=require('crypto');var jsforce=require(_0x68ba('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68ba('0xb'));var Papa=require('papaparse');var Redis=require(_0x68ba('0xc'));var authService=require(_0x68ba('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68ba('0xe'));var logger=require(_0x68ba('0xf'))(_0x68ba('0x10'));var utils=require('../../config/utils');var config=require(_0x68ba('0x11'));var licenseUtil=require(_0x68ba('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a608a,_0x442624){_0x442624=_0x442624||0xcc;return function(_0x227239){if(_0x227239){return _0x2a608a['sendStatus'](_0x442624);}return _0x2a608a[_0x68ba('0x13')](_0x442624)[_0x68ba('0x14')]();};}function respondWithResult(_0x1c3f5f,_0x5bb868){_0x5bb868=_0x5bb868||0xc8;return function(_0x89d6f5){if(_0x89d6f5){return _0x1c3f5f[_0x68ba('0x13')](_0x5bb868)[_0x68ba('0x15')](_0x89d6f5);}};}function respondWithFilteredResult(_0x315536,_0x5523e2){return function(_0x1835fd){if(_0x1835fd){var _0x2e50e3=_0x1835fd[_0x68ba('0x16')],_0x3063fc=_0x5523e2[_0x68ba('0x17')],_0x4f6377=_0x5523e2[_0x68ba('0x17')]+_0x5523e2[_0x68ba('0x18')],_0x3aafe0;if(_0x4f6377>=_0x2e50e3){_0x4f6377=_0x2e50e3;_0x3aafe0=0xc8;}else{_0x3aafe0=0xce;}_0x315536[_0x68ba('0x13')](_0x3aafe0);return _0x315536[_0x68ba('0x19')]('Content-Range',_0x3063fc+'-'+_0x4f6377+'/'+_0x2e50e3)[_0x68ba('0x15')](_0x1835fd);}return null;};}function patchUpdates(_0x1288b9){return function(_0x4abbe0){try{jsonpatch[_0x68ba('0x1a')](_0x4abbe0,_0x1288b9,!![]);}catch(_0x2a74b6){return BPromise[_0x68ba('0x1b')](_0x2a74b6);}return _0x4abbe0[_0x68ba('0x1c')]();};}function saveUpdates(_0x15a767,_0x1da18c){return function(_0x2b1cc0){if(_0x2b1cc0){return _0x2b1cc0[_0x68ba('0x1d')](_0x15a767)[_0x68ba('0x1e')](function(_0x526d1b){return _0x526d1b;});}return null;};}function removeEntity(_0x49770e,_0xdf2362){return function(_0x1899b7){if(_0x1899b7){return _0x1899b7[_0x68ba('0x1f')]()['then'](function(){_0x49770e[_0x68ba('0x13')](0xcc)[_0x68ba('0x14')]();});}};}function handleEntityNotFound(_0x4cb0c0,_0x367674){return function(_0x5f4d08){if(!_0x5f4d08){_0x4cb0c0[_0x68ba('0x20')](0x194);}return _0x5f4d08;};}function handleError(_0x2286cc,_0x227ec1){_0x227ec1=_0x227ec1||0x1f4;return function(_0x3e7c0e){logger[_0x68ba('0x21')](_0x3e7c0e[_0x68ba('0x22')]);if(_0x3e7c0e[_0x68ba('0x23')]){delete _0x3e7c0e[_0x68ba('0x23')];}_0x2286cc[_0x68ba('0x13')](_0x227ec1)[_0x68ba('0x24')](_0x3e7c0e);};}exports[_0x68ba('0x25')]=function(_0x2dc9e7,_0x564933){var _0x46dd05={},_0x5d7e43={},_0x5917d8={'count':0x0,'rows':[]};var _0x25f360=_['map'](db['FreshsalesField'][_0x68ba('0x26')],function(_0x1ad2e5){return{'name':_0x1ad2e5['fieldName'],'type':_0x1ad2e5[_0x68ba('0x27')][_0x68ba('0x28')]};});_0x5d7e43[_0x68ba('0x29')]=_[_0x68ba('0x2a')](_0x25f360,_0x68ba('0x23'));_0x5d7e43[_0x68ba('0x2b')]=_[_0x68ba('0x2c')](_0x2dc9e7[_0x68ba('0x2b')]);_0x5d7e43['filters']=_['intersection'](_0x5d7e43[_0x68ba('0x29')],_0x5d7e43[_0x68ba('0x2b')]);_0x46dd05['attributes']=_[_0x68ba('0x2d')](_0x5d7e43[_0x68ba('0x29')],qs[_0x68ba('0x2e')](_0x2dc9e7['query']['fields']));_0x46dd05[_0x68ba('0x2f')]=_0x46dd05[_0x68ba('0x2f')][_0x68ba('0x30')]?_0x46dd05[_0x68ba('0x2f')]:_0x5d7e43[_0x68ba('0x29')];if(!_0x2dc9e7[_0x68ba('0x2b')][_0x68ba('0x31')]('nolimit')){_0x46dd05[_0x68ba('0x18')]=qs['limit'](_0x2dc9e7['query'][_0x68ba('0x18')]);_0x46dd05[_0x68ba('0x17')]=qs[_0x68ba('0x17')](_0x2dc9e7[_0x68ba('0x2b')][_0x68ba('0x17')]);}_0x46dd05[_0x68ba('0x32')]=qs[_0x68ba('0x33')](_0x2dc9e7[_0x68ba('0x2b')][_0x68ba('0x33')]);_0x46dd05['where']=qs[_0x68ba('0x34')](_[_0x68ba('0x35')](_0x2dc9e7[_0x68ba('0x2b')],_0x5d7e43[_0x68ba('0x34')]),_0x25f360);if(_0x2dc9e7[_0x68ba('0x2b')][_0x68ba('0x36')]){_0x46dd05['where']=_['merge'](_0x46dd05[_0x68ba('0x37')],{'$or':_[_0x68ba('0x2a')](_0x25f360,function(_0x5d8764){if(_0x5d8764[_0x68ba('0x27')]!=='VIRTUAL'){var _0x8ff6df={};_0x8ff6df[_0x5d8764['name']]={'$like':'%'+_0x2dc9e7[_0x68ba('0x2b')][_0x68ba('0x36')]+'%'};return _0x8ff6df;}})});}_0x46dd05=_[_0x68ba('0x38')]({},_0x46dd05,_0x2dc9e7[_0x68ba('0x39')]);var _0x12a0cd={'where':_0x46dd05[_0x68ba('0x37')]};return db[_0x68ba('0x3a')][_0x68ba('0x16')](_0x12a0cd)[_0x68ba('0x1e')](function(_0x564b63){_0x5917d8[_0x68ba('0x16')]=_0x564b63;if(_0x2dc9e7[_0x68ba('0x2b')][_0x68ba('0x3b')]){_0x46dd05['include']=[{'all':!![]}];}return db[_0x68ba('0x3a')]['findAll'](_0x46dd05);})[_0x68ba('0x1e')](function(_0x45daa1){_0x5917d8[_0x68ba('0x3c')]=_0x45daa1;return _0x5917d8;})[_0x68ba('0x1e')](respondWithFilteredResult(_0x564933,_0x46dd05))['catch'](handleError(_0x564933,null));};exports[_0x68ba('0x3d')]=function(_0x3c38e7,_0x1d7495){var _0x3ee5b6={'raw':!![],'where':{'id':_0x3c38e7['params']['id']}},_0x4edcc3={};_0x4edcc3[_0x68ba('0x29')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x4edcc3[_0x68ba('0x2b')]=_['keys'](_0x3c38e7['query']);_0x4edcc3['filters']=_['intersection'](_0x4edcc3[_0x68ba('0x29')],_0x4edcc3['query']);_0x3ee5b6[_0x68ba('0x2f')]=_[_0x68ba('0x2d')](_0x4edcc3[_0x68ba('0x29')],qs[_0x68ba('0x2e')](_0x3c38e7[_0x68ba('0x2b')]['fields']));_0x3ee5b6['attributes']=_0x3ee5b6[_0x68ba('0x2f')]['length']?_0x3ee5b6[_0x68ba('0x2f')]:_0x4edcc3['model'];if(_0x3c38e7[_0x68ba('0x2b')]['includeAll']){_0x3ee5b6[_0x68ba('0x3e')]=[{'all':!![]}];}_0x3ee5b6=_['merge']({},_0x3ee5b6,_0x3c38e7['options']);return db['FreshsalesField'][_0x68ba('0x3f')](_0x3ee5b6)['then'](handleEntityNotFound(_0x1d7495,null))[_0x68ba('0x1e')](respondWithResult(_0x1d7495,null))['catch'](handleError(_0x1d7495,null));};exports['create']=function(_0x5efa48,_0xe303f){return db[_0x68ba('0x3a')][_0x68ba('0x40')](_0x5efa48['body'],{})['then'](respondWithResult(_0xe303f,0xc9))[_0x68ba('0x41')](handleError(_0xe303f,null));};exports[_0x68ba('0x1d')]=function(_0x59439f,_0x4fb194){if(_0x59439f[_0x68ba('0x42')]['id']){delete _0x59439f[_0x68ba('0x42')]['id'];}return db[_0x68ba('0x3a')][_0x68ba('0x3f')]({'where':{'id':_0x59439f['params']['id']}})[_0x68ba('0x1e')](handleEntityNotFound(_0x4fb194,null))['then'](saveUpdates(_0x59439f[_0x68ba('0x42')],null))[_0x68ba('0x1e')](respondWithResult(_0x4fb194,null))[_0x68ba('0x41')](handleError(_0x4fb194,null));};exports['destroy']=function(_0x28442d,_0x4a7fe1){return db[_0x68ba('0x3a')][_0x68ba('0x3f')]({'where':{'id':_0x28442d[_0x68ba('0x43')]['id']}})[_0x68ba('0x1e')](handleEntityNotFound(_0x4a7fe1,null))[_0x68ba('0x1e')](removeEntity(_0x4a7fe1,null))[_0x68ba('0x41')](handleError(_0x4a7fe1,null));}; \ No newline at end of file +var _0xa0fe=['error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','options','FreshsalesField','includeAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0xa0fe,0x13d));var _0xea0f=function(_0x12ad72,_0x4fc1d3){_0x12ad72=_0x12ad72-0x0;var _0xe59be7=_0xa0fe[_0x12ad72];return _0xe59be7;};'use strict';var pdf=require(_0xea0f('0x0'));var emlformat=require(_0xea0f('0x1'));var rimraf=require(_0xea0f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea0f('0x3'));var rp=require(_0xea0f('0x4'));var moment=require(_0xea0f('0x5'));var BPromise=require(_0xea0f('0x6'));var Mustache=require(_0xea0f('0x7'));var util=require(_0xea0f('0x8'));var path=require('path');var sox=require(_0xea0f('0x9'));var csv=require(_0xea0f('0xa'));var ejs=require(_0xea0f('0xb'));var fs=require('fs');var _=require(_0xea0f('0xc'));var squel=require(_0xea0f('0xd'));var crypto=require(_0xea0f('0xe'));var jsforce=require(_0xea0f('0xf'));var deskjs=require(_0xea0f('0x10'));var toCsv=require(_0xea0f('0xa'));var querystring=require(_0xea0f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea0f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xea0f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea0f('0x14'));var utils=require(_0xea0f('0x15'));var config=require(_0xea0f('0x16'));var licenseUtil=require(_0xea0f('0x17'));var db=require(_0xea0f('0x18'))['db'];function respondWithStatusCode(_0xa7fce3,_0xfd27c8){_0xfd27c8=_0xfd27c8||0xcc;return function(_0x55bdb3){if(_0x55bdb3){return _0xa7fce3['sendStatus'](_0xfd27c8);}return _0xa7fce3[_0xea0f('0x19')](_0xfd27c8)[_0xea0f('0x1a')]();};}function respondWithResult(_0x1929f1,_0x360233){_0x360233=_0x360233||0xc8;return function(_0x5f5b10){if(_0x5f5b10){return _0x1929f1[_0xea0f('0x19')](_0x360233)[_0xea0f('0x1b')](_0x5f5b10);}};}function respondWithFilteredResult(_0x314ec4,_0x1652aa){return function(_0xdbf95f){if(_0xdbf95f){var _0x273aed=_0xdbf95f[_0xea0f('0x1c')],_0xa7c420=_0x1652aa[_0xea0f('0x1d')],_0x5e91fc=_0x1652aa[_0xea0f('0x1d')]+_0x1652aa[_0xea0f('0x1e')],_0x10a9ec;if(_0x5e91fc>=_0x273aed){_0x5e91fc=_0x273aed;_0x10a9ec=0xc8;}else{_0x10a9ec=0xce;}_0x314ec4[_0xea0f('0x19')](_0x10a9ec);return _0x314ec4[_0xea0f('0x1f')](_0xea0f('0x20'),_0xa7c420+'-'+_0x5e91fc+'/'+_0x273aed)[_0xea0f('0x1b')](_0xdbf95f);}return null;};}function patchUpdates(_0x1423f4){return function(_0x582134){try{jsonpatch['apply'](_0x582134,_0x1423f4,!![]);}catch(_0x5dead4){return BPromise[_0xea0f('0x21')](_0x5dead4);}return _0x582134['save']();};}function saveUpdates(_0x4c066a,_0x4693a1){return function(_0xe953e9){if(_0xe953e9){return _0xe953e9[_0xea0f('0x22')](_0x4c066a)[_0xea0f('0x23')](function(_0x244cbb){return _0x244cbb;});}return null;};}function removeEntity(_0xec859c,_0x4474c1){return function(_0x321f7b){if(_0x321f7b){return _0x321f7b[_0xea0f('0x24')]()[_0xea0f('0x23')](function(){_0xec859c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4907ae,_0x509940){return function(_0x442ccf){if(!_0x442ccf){_0x4907ae[_0xea0f('0x25')](0x194);}return _0x442ccf;};}function handleError(_0x4421c6,_0xf26b62){_0xf26b62=_0xf26b62||0x1f4;return function(_0xad2507){logger[_0xea0f('0x26')](_0xad2507[_0xea0f('0x27')]);if(_0xad2507['name']){delete _0xad2507[_0xea0f('0x28')];}_0x4421c6[_0xea0f('0x19')](_0xf26b62)[_0xea0f('0x29')](_0xad2507);};}exports[_0xea0f('0x2a')]=function(_0x43fdfa,_0x5765eb){var _0x1c2a02={},_0x144faf={},_0x1c72e0={'count':0x0,'rows':[]};var _0x3359fe=_[_0xea0f('0x2b')](db['FreshsalesField'][_0xea0f('0x2c')],function(_0x16bb8d){return{'name':_0x16bb8d[_0xea0f('0x2d')],'type':_0x16bb8d['type']['key']};});_0x144faf[_0xea0f('0x2e')]=_[_0xea0f('0x2b')](_0x3359fe,'name');_0x144faf[_0xea0f('0x2f')]=_[_0xea0f('0x30')](_0x43fdfa[_0xea0f('0x2f')]);_0x144faf['filters']=_[_0xea0f('0x31')](_0x144faf['model'],_0x144faf['query']);_0x1c2a02['attributes']=_['intersection'](_0x144faf[_0xea0f('0x2e')],qs['fields'](_0x43fdfa[_0xea0f('0x2f')][_0xea0f('0x32')]));_0x1c2a02[_0xea0f('0x33')]=_0x1c2a02[_0xea0f('0x33')][_0xea0f('0x34')]?_0x1c2a02[_0xea0f('0x33')]:_0x144faf[_0xea0f('0x2e')];if(!_0x43fdfa['query'][_0xea0f('0x35')](_0xea0f('0x36'))){_0x1c2a02[_0xea0f('0x1e')]=qs[_0xea0f('0x1e')](_0x43fdfa['query'][_0xea0f('0x1e')]);_0x1c2a02['offset']=qs[_0xea0f('0x1d')](_0x43fdfa[_0xea0f('0x2f')][_0xea0f('0x1d')]);}_0x1c2a02['order']=qs[_0xea0f('0x37')](_0x43fdfa[_0xea0f('0x2f')][_0xea0f('0x37')]);_0x1c2a02['where']=qs[_0xea0f('0x38')](_[_0xea0f('0x39')](_0x43fdfa[_0xea0f('0x2f')],_0x144faf[_0xea0f('0x38')]),_0x3359fe);if(_0x43fdfa[_0xea0f('0x2f')]['filter']){_0x1c2a02[_0xea0f('0x3a')]=_[_0xea0f('0x3b')](_0x1c2a02[_0xea0f('0x3a')],{'$or':_['map'](_0x3359fe,function(_0xc8f706){if(_0xc8f706['type']!=='VIRTUAL'){var _0x20f9c2={};_0x20f9c2[_0xc8f706[_0xea0f('0x28')]]={'$like':'%'+_0x43fdfa[_0xea0f('0x2f')]['filter']+'%'};return _0x20f9c2;}})});}_0x1c2a02=_[_0xea0f('0x3b')]({},_0x1c2a02,_0x43fdfa[_0xea0f('0x3c')]);var _0x3ca559={'where':_0x1c2a02[_0xea0f('0x3a')]};return db[_0xea0f('0x3d')]['count'](_0x3ca559)[_0xea0f('0x23')](function(_0x5c4ca9){_0x1c72e0[_0xea0f('0x1c')]=_0x5c4ca9;if(_0x43fdfa[_0xea0f('0x2f')][_0xea0f('0x3e')]){_0x1c2a02['include']=[{'all':!![]}];}return db[_0xea0f('0x3d')]['findAll'](_0x1c2a02);})['then'](function(_0x479814){_0x1c72e0[_0xea0f('0x3f')]=_0x479814;return _0x1c72e0;})[_0xea0f('0x23')](respondWithFilteredResult(_0x5765eb,_0x1c2a02))[_0xea0f('0x40')](handleError(_0x5765eb,null));};exports[_0xea0f('0x41')]=function(_0x26ef2f,_0x6d3e5a){var _0x3078bb={'raw':!![],'where':{'id':_0x26ef2f[_0xea0f('0x42')]['id']}},_0x2f1e2d={};_0x2f1e2d[_0xea0f('0x2e')]=_['keys'](db[_0xea0f('0x3d')][_0xea0f('0x2c')]);_0x2f1e2d[_0xea0f('0x2f')]=_[_0xea0f('0x30')](_0x26ef2f[_0xea0f('0x2f')]);_0x2f1e2d[_0xea0f('0x38')]=_['intersection'](_0x2f1e2d[_0xea0f('0x2e')],_0x2f1e2d[_0xea0f('0x2f')]);_0x3078bb[_0xea0f('0x33')]=_[_0xea0f('0x31')](_0x2f1e2d['model'],qs[_0xea0f('0x32')](_0x26ef2f[_0xea0f('0x2f')][_0xea0f('0x32')]));_0x3078bb[_0xea0f('0x33')]=_0x3078bb[_0xea0f('0x33')][_0xea0f('0x34')]?_0x3078bb[_0xea0f('0x33')]:_0x2f1e2d['model'];if(_0x26ef2f[_0xea0f('0x2f')]['includeAll']){_0x3078bb[_0xea0f('0x43')]=[{'all':!![]}];}_0x3078bb=_['merge']({},_0x3078bb,_0x26ef2f[_0xea0f('0x3c')]);return db['FreshsalesField'][_0xea0f('0x44')](_0x3078bb)[_0xea0f('0x23')](handleEntityNotFound(_0x6d3e5a,null))[_0xea0f('0x23')](respondWithResult(_0x6d3e5a,null))[_0xea0f('0x40')](handleError(_0x6d3e5a,null));};exports[_0xea0f('0x45')]=function(_0x2a87e1,_0x310804){return db['FreshsalesField']['create'](_0x2a87e1[_0xea0f('0x46')],{})['then'](respondWithResult(_0x310804,0xc9))[_0xea0f('0x40')](handleError(_0x310804,null));};exports[_0xea0f('0x22')]=function(_0x11465f,_0xc1a45a){if(_0x11465f[_0xea0f('0x46')]['id']){delete _0x11465f[_0xea0f('0x46')]['id'];}return db[_0xea0f('0x3d')][_0xea0f('0x44')]({'where':{'id':_0x11465f[_0xea0f('0x42')]['id']}})[_0xea0f('0x23')](handleEntityNotFound(_0xc1a45a,null))[_0xea0f('0x23')](saveUpdates(_0x11465f[_0xea0f('0x46')],null))[_0xea0f('0x23')](respondWithResult(_0xc1a45a,null))['catch'](handleError(_0xc1a45a,null));};exports[_0xea0f('0x24')]=function(_0x355568,_0x1984f9){return db['FreshsalesField'][_0xea0f('0x44')]({'where':{'id':_0x355568['params']['id']}})[_0xea0f('0x23')](handleEntityNotFound(_0x1984f9,null))[_0xea0f('0x23')](removeEntity(_0x1984f9,null))[_0xea0f('0x40')](handleError(_0x1984f9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 23a16c3..5c9cdfd 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 _0xc4af=['../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xc4af,0x77));var _0xfc4a=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc4af[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xfc4a('0x0'));var util=require('util');var logger=require(_0xfc4a('0x1'))(_0xfc4a('0x2'));var moment=require(_0xfc4a('0x3'));var BPromise=require(_0xfc4a('0x4'));var rp=require(_0xfc4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc4a('0x6'));var config=require(_0xfc4a('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0xfc4a('0x8')]=function(_0x5a2f5f,_0x516108){return _0x5a2f5f['define'](_0xfc4a('0x9'),attributes,{'tableName':_0xfc4a('0xa'),'paranoid':![],'indexes':[{'name':_0xfc4a('0xb'),'fields':[_0xfc4a('0xc'),_0xfc4a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a34=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','int_freshsales_fields','FieldId','util','../../config/logger','api','moment'];(function(_0x14a398,_0x4d3fd5){var _0x39a9e4=function(_0x25c76b){while(--_0x25c76b){_0x14a398['push'](_0x14a398['shift']());}};_0x39a9e4(++_0x4d3fd5);}(_0x0a34,0x1c3));var _0x40a3=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0a34[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require(_0x40a3('0x0'));var logger=require(_0x40a3('0x1'))(_0x40a3('0x2'));var moment=require(_0x40a3('0x3'));var BPromise=require(_0x40a3('0x4'));var rp=require(_0x40a3('0x5'));var fs=require('fs');var path=require(_0x40a3('0x6'));var rimraf=require(_0x40a3('0x7'));var config=require(_0x40a3('0x8'));var attributes=require(_0x40a3('0x9'));module['exports']=function(_0x40cc7f,_0x4efb5c){return _0x40cc7f[_0x40a3('0xa')]('FreshsalesField',attributes,{'tableName':_0x40a3('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x40a3('0xc')],'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 4d24722..bfd808e 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 _0xf9f8=['error','code','FreshsalesField,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0xf9f8,0x98));var _0x8f9f=function(_0xf3f0ad,_0x50e85a){_0xf3f0ad=_0xf3f0ad-0x0;var _0x421d08=_0xf9f8[_0xf3f0ad];return _0x421d08;};'use strict';var _=require(_0x8f9f('0x0'));var util=require('util');var moment=require(_0x8f9f('0x1'));var BPromise=require(_0x8f9f('0x2'));var rs=require(_0x8f9f('0x3'));var fs=require('fs');var Redis=require(_0x8f9f('0x4'));var db=require(_0x8f9f('0x5'))['db'];var utils=require(_0x8f9f('0x6'));var logger=require('../../config/logger')(_0x8f9f('0x7'));var config=require(_0x8f9f('0x8'));var jayson=require(_0x8f9f('0x9'));var client=jayson[_0x8f9f('0xa')][_0x8f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58de90,_0x293574,_0x41f078){return new BPromise(function(_0x2df4b9,_0x574130){return client[_0x8f9f('0xc')](_0x58de90,_0x41f078)[_0x8f9f('0xd')](function(_0x1b1148){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x293574,_0x8f9f('0xe'));logger['debug'](_0x8f9f('0xf'),_0x293574,_0x8f9f('0xe'),JSON['stringify'](_0x1b1148));if(_0x1b1148[_0x8f9f('0x10')]){if(_0x1b1148['error'][_0x8f9f('0x11')]===0x1f4){logger[_0x8f9f('0x10')](_0x8f9f('0x12'),_0x293574,_0x1b1148[_0x8f9f('0x10')][_0x8f9f('0x13')]);return _0x574130(_0x1b1148['error']['message']);}logger[_0x8f9f('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x293574,_0x1b1148[_0x8f9f('0x10')]['message']);return _0x2df4b9(_0x1b1148[_0x8f9f('0x10')]['message']);}else{logger[_0x8f9f('0x14')](_0x8f9f('0x12'),_0x293574,_0x8f9f('0xe'));_0x2df4b9(_0x1b1148['result']['message']);}})['catch'](function(_0x1fbed9){logger[_0x8f9f('0x10')](_0x8f9f('0x12'),_0x293574,_0x1fbed9);_0x574130(_0x1fbed9);});});} \ No newline at end of file +var _0xe2d2=['error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe2d2,0xf7));var _0x2e2d=function(_0x4d2c6a,_0x1befca){_0x4d2c6a=_0x4d2c6a-0x0;var _0x5a31b2=_0xe2d2[_0x4d2c6a];return _0x5a31b2;};'use strict';var _=require(_0x2e2d('0x0'));var util=require(_0x2e2d('0x1'));var moment=require(_0x2e2d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e2d('0x3'));var fs=require('fs');var Redis=require(_0x2e2d('0x4'));var db=require(_0x2e2d('0x5'))['db'];var utils=require(_0x2e2d('0x6'));var logger=require(_0x2e2d('0x7'))(_0x2e2d('0x8'));var config=require(_0x2e2d('0x9'));var jayson=require(_0x2e2d('0xa'));var client=jayson[_0x2e2d('0xb')][_0x2e2d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5055dd,_0x4e7403,_0x2c16bd){return new BPromise(function(_0x7223f2,_0x41f20d){return client[_0x2e2d('0xd')](_0x5055dd,_0x2c16bd)[_0x2e2d('0xe')](function(_0x48fb22){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e7403,_0x2e2d('0xf'));logger[_0x2e2d('0x10')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4e7403,_0x2e2d('0xf'),JSON['stringify'](_0x48fb22));if(_0x48fb22[_0x2e2d('0x11')]){if(_0x48fb22['error'][_0x2e2d('0x12')]===0x1f4){logger[_0x2e2d('0x11')](_0x2e2d('0x13'),_0x4e7403,_0x48fb22[_0x2e2d('0x11')][_0x2e2d('0x14')]);return _0x41f20d(_0x48fb22[_0x2e2d('0x11')]['message']);}logger[_0x2e2d('0x11')](_0x2e2d('0x13'),_0x4e7403,_0x48fb22['error'][_0x2e2d('0x14')]);return _0x7223f2(_0x48fb22[_0x2e2d('0x11')][_0x2e2d('0x14')]);}else{logger[_0x2e2d('0x15')](_0x2e2d('0x13'),_0x4e7403,_0x2e2d('0xf'));_0x7223f2(_0x48fb22[_0x2e2d('0x16')][_0x2e2d('0x14')]);}})[_0x2e2d('0x17')](function(_0x515ac2){logger[_0x2e2d('0x11')](_0x2e2d('0x13'),_0x4e7403,_0x515ac2);_0x41f20d(_0x515ac2);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f3d2058..74d04a1 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 _0x8448=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x5e2c70,_0x108e64){var _0x1e6cbc=function(_0x46e5fd){while(--_0x46e5fd){_0x5e2c70['push'](_0x5e2c70['shift']());}};_0x1e6cbc(++_0x108e64);}(_0x8448,0x97));var _0x8844=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x8448[_0x2eb5bc];return _0x51c7b1;};'use strict';var multer=require(_0x8844('0x0'));var util=require(_0x8844('0x1'));var path=require(_0x8844('0x2'));var timeout=require(_0x8844('0x3'));var express=require(_0x8844('0x4'));var router=express[_0x8844('0x5')]();var auth=require(_0x8844('0x6'));var interaction=require(_0x8844('0x7'));var config=require(_0x8844('0x8'));var controller=require(_0x8844('0x9'));router['get']('/',auth[_0x8844('0xa')](),controller[_0x8844('0xb')]);router[_0x8844('0xc')](_0x8844('0xd'),auth['isAuthenticated'](),controller[_0x8844('0xe')]);router['get']('/:id/configurations',auth[_0x8844('0xa')](),controller[_0x8844('0xf')]);router[_0x8844('0xc')](_0x8844('0x10'),auth['isAuthenticated'](),controller[_0x8844('0x11')]);router['post']('/',auth[_0x8844('0xa')](),controller[_0x8844('0x12')]);router[_0x8844('0x13')](_0x8844('0x14'),auth[_0x8844('0xa')](),controller[_0x8844('0x15')]);router[_0x8844('0x16')](_0x8844('0xd'),auth[_0x8844('0xa')](),controller[_0x8844('0x17')]);router[_0x8844('0x18')](_0x8844('0xd'),auth[_0x8844('0xa')](),controller['destroy']);module[_0x8844('0x19')]=router; \ No newline at end of file +var _0x3446=['../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3446,0x6d));var _0x6344=function(_0x57f26f,_0x8c417b){_0x57f26f=_0x57f26f-0x0;var _0x10a29d=_0x3446[_0x57f26f];return _0x10a29d;};'use strict';var multer=require('multer');var util=require(_0x6344('0x0'));var path=require(_0x6344('0x1'));var timeout=require('connect-timeout');var express=require(_0x6344('0x2'));var router=express[_0x6344('0x3')]();var auth=require(_0x6344('0x4'));var interaction=require(_0x6344('0x5'));var config=require(_0x6344('0x6'));var controller=require(_0x6344('0x7'));router[_0x6344('0x8')]('/',auth[_0x6344('0x9')](),controller[_0x6344('0xa')]);router[_0x6344('0x8')](_0x6344('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6344('0xc'),auth[_0x6344('0x9')](),controller['getConfigurations']);router[_0x6344('0x8')](_0x6344('0xd'),auth[_0x6344('0x9')](),controller[_0x6344('0xe')]);router[_0x6344('0xf')]('/',auth[_0x6344('0x9')](),controller[_0x6344('0x10')]);router[_0x6344('0xf')](_0x6344('0xc'),auth[_0x6344('0x9')](),controller[_0x6344('0x11')]);router[_0x6344('0x12')](_0x6344('0xb'),auth['isAuthenticated'](),controller[_0x6344('0x13')]);router[_0x6344('0x14')](_0x6344('0xb'),auth[_0x6344('0x9')](),controller[_0x6344('0x15')]);module[_0x6344('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 ada602f..4df71bd 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 _0xfc53=['integrationTab','newTab','sequelize','STRING','username'];(function(_0x460290,_0x1f6fcb){var _0x431b71=function(_0x32ebdf){while(--_0x32ebdf){_0x460290['push'](_0x460290['shift']());}};_0x431b71(++_0x1f6fcb);}(_0xfc53,0x1f1));var _0x3fc5=function(_0x1d4110,_0xfa3eb9){_0x1d4110=_0x1d4110-0x0;var _0x433e87=_0xfc53[_0x1d4110];return _0x433e87;};'use strict';var Sequelize=require(_0x3fc5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fc5('0x1')],'unique':_0x3fc5('0x2')},'remoteUri':{'type':Sequelize[_0x3fc5('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3fc5('0x1')]},'securityToken':{'type':Sequelize[_0x3fc5('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3fc5('0x3'),_0x3fc5('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2180=['STRING','integrationTab','newTab','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2180,0x11b));var _0x0218=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x2180[_0x507c81];return _0x368a25;};'use strict';var Sequelize=require(_0x0218('0x0'));module[_0x0218('0x1')]={'name':{'type':Sequelize[_0x0218('0x2')]},'description':{'type':Sequelize[_0x0218('0x2')]},'username':{'type':Sequelize[_0x0218('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x0218('0x2')]},'password':{'type':Sequelize[_0x0218('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0218('0x2')]},'securityToken':{'type':Sequelize[_0x0218('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0218('0x3'),_0x0218('0x4')),'defaultValue':_0x0218('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 30e581a..62ea8ca 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 _0xfdb8=['keys','merge','options','find','create','body','destroy','getConfigurations','SalesforceConfiguration','rawAttributes','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','True','true','False','false','test','getFields','send','Wrong\x20credentials','html-pdf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','stack','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','name','filter','count','includeAll','include','SalesforceAccount','findAll','rows','catch','show','params'];(function(_0x33902b,_0x3d962d){var _0x4c3151=function(_0x9bec56){while(--_0x9bec56){_0x33902b['push'](_0x33902b['shift']());}};_0x4c3151(++_0x3d962d);}(_0xfdb8,0x1dd));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8fdb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8fdb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fdb('0x2'));var moment=require(_0x8fdb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8fdb('0x4'));var util=require(_0x8fdb('0x5'));var path=require(_0x8fdb('0x6'));var sox=require(_0x8fdb('0x7'));var csv=require(_0x8fdb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8fdb('0x9'));var squel=require(_0x8fdb('0xa'));var crypto=require('crypto');var jsforce=require(_0x8fdb('0xb'));var deskjs=require(_0x8fdb('0xc'));var toCsv=require(_0x8fdb('0x8'));var querystring=require('querystring');var Papa=require(_0x8fdb('0xd'));var Redis=require('ioredis');var authService=require(_0x8fdb('0xe'));var qs=require(_0x8fdb('0xf'));var as=require(_0x8fdb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fdb('0x11'))('api');var utils=require(_0x8fdb('0x12'));var config=require(_0x8fdb('0x13'));var licenseUtil=require(_0x8fdb('0x14'));var db=require(_0x8fdb('0x15'))['db'];var integrations=require(_0x8fdb('0x16'));var jayson=require(_0x8fdb('0x17'));var client=jayson[_0x8fdb('0x18')][_0x8fdb('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x28adfc,_0x48b251,_0x2e2193,_0x36d35b){return new BPromise(function(_0x4c41b4,_0x3da335){var _0x17288f=_0x36d35b||client;return _0x17288f[_0x8fdb('0x1a')](_0x28adfc,_0x2e2193)['then'](function(_0x268fcc){logger['info'](_0x8fdb('0x1b'),_0x48b251,_0x8fdb('0x1c'));logger[_0x8fdb('0x1d')](_0x8fdb('0x1e'),_0x48b251,_0x8fdb('0x1c'),JSON[_0x8fdb('0x1f')](_0x268fcc));if(_0x268fcc[_0x8fdb('0x20')]){if(_0x268fcc['error'][_0x8fdb('0x21')]===0x1f4){logger[_0x8fdb('0x20')](_0x8fdb('0x1b'),_0x48b251,_0x268fcc['error'][_0x8fdb('0x22')]);return _0x3da335(_0x268fcc[_0x8fdb('0x20')][_0x8fdb('0x22')]);}logger[_0x8fdb('0x20')](_0x8fdb('0x1b'),_0x48b251,_0x268fcc[_0x8fdb('0x20')][_0x8fdb('0x22')]);return _0x4c41b4(_0x268fcc[_0x8fdb('0x20')]['message']);}else{logger[_0x8fdb('0x23')](_0x8fdb('0x1b'),_0x48b251,_0x8fdb('0x1c'));_0x4c41b4(_0x268fcc[_0x8fdb('0x24')][_0x8fdb('0x22')]);}})['catch'](function(_0x36930b){logger[_0x8fdb('0x20')](_0x8fdb('0x1b'),_0x48b251,_0x36930b);_0x3da335(_0x36930b);});});}function respondWithStatusCode(_0x338f6e,_0x42213e){_0x42213e=_0x42213e||0xcc;return function(_0x6c1deb){if(_0x6c1deb){return _0x338f6e['sendStatus'](_0x42213e);}return _0x338f6e['status'](_0x42213e)[_0x8fdb('0x25')]();};}function respondWithResult(_0x39e3fc,_0x3b5f5f){_0x3b5f5f=_0x3b5f5f||0xc8;return function(_0x3757ce){if(_0x3757ce){return _0x39e3fc[_0x8fdb('0x26')](_0x3b5f5f)[_0x8fdb('0x27')](_0x3757ce);}};}function respondWithFilteredResult(_0x4d6dd0,_0x19748a){return function(_0x211960){if(_0x211960){var _0x395ba1=_0x211960['count'],_0xf5260a=_0x19748a[_0x8fdb('0x28')],_0x1dcf19=_0x19748a['offset']+_0x19748a[_0x8fdb('0x29')],_0xa09599;if(_0x1dcf19>=_0x395ba1){_0x1dcf19=_0x395ba1;_0xa09599=0xc8;}else{_0xa09599=0xce;}_0x4d6dd0[_0x8fdb('0x26')](_0xa09599);return _0x4d6dd0[_0x8fdb('0x2a')](_0x8fdb('0x2b'),_0xf5260a+'-'+_0x1dcf19+'/'+_0x395ba1)[_0x8fdb('0x27')](_0x211960);}return null;};}function patchUpdates(_0x3d197d){return function(_0x267415){try{jsonpatch['apply'](_0x267415,_0x3d197d,!![]);}catch(_0x2fe05f){return BPromise[_0x8fdb('0x2c')](_0x2fe05f);}return _0x267415[_0x8fdb('0x2d')]();};}function saveUpdates(_0x1ca2e9,_0x4de9db){return function(_0xb3bc80){if(_0xb3bc80){return _0xb3bc80[_0x8fdb('0x2e')](_0x1ca2e9)[_0x8fdb('0x2f')](function(_0xb1cd51){return _0xb1cd51;});}return null;};}function removeEntity(_0x354010,_0x1e7895){return function(_0x329426){if(_0x329426){return _0x329426['destroy']()[_0x8fdb('0x2f')](function(){_0x354010[_0x8fdb('0x26')](0xcc)[_0x8fdb('0x25')]();});}};}function handleEntityNotFound(_0x4870f9,_0x58c509){return function(_0x17fe91){if(!_0x17fe91){_0x4870f9[_0x8fdb('0x30')](0x194);}return _0x17fe91;};}function handleError(_0x3e18c8,_0x31ce9c){_0x31ce9c=_0x31ce9c||0x1f4;return function(_0x1b6d53){logger[_0x8fdb('0x20')](_0x1b6d53[_0x8fdb('0x31')]);if(_0x1b6d53['name']){delete _0x1b6d53['name'];}_0x3e18c8[_0x8fdb('0x26')](_0x31ce9c)['send'](_0x1b6d53);};}exports[_0x8fdb('0x32')]=function(_0x283e09,_0x27c37c){var _0x2108e8={},_0x538248={},_0x2c0530={'count':0x0,'rows':[]};var _0x11964b=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x2be3fa){return{'name':_0x2be3fa[_0x8fdb('0x33')],'type':_0x2be3fa[_0x8fdb('0x34')][_0x8fdb('0x35')]};});_0x538248[_0x8fdb('0x36')]=_['map'](_0x11964b,'name');_0x538248[_0x8fdb('0x37')]=_['keys'](_0x283e09['query']);_0x538248[_0x8fdb('0x38')]=_[_0x8fdb('0x39')](_0x538248[_0x8fdb('0x36')],_0x538248['query']);_0x2108e8[_0x8fdb('0x3a')]=_[_0x8fdb('0x39')](_0x538248[_0x8fdb('0x36')],qs[_0x8fdb('0x3b')](_0x283e09['query'][_0x8fdb('0x3b')]));_0x2108e8[_0x8fdb('0x3a')]=_0x2108e8[_0x8fdb('0x3a')][_0x8fdb('0x3c')]?_0x2108e8['attributes']:_0x538248[_0x8fdb('0x36')];if(!_0x283e09['query'][_0x8fdb('0x3d')](_0x8fdb('0x3e'))){_0x2108e8[_0x8fdb('0x29')]=qs['limit'](_0x283e09[_0x8fdb('0x37')][_0x8fdb('0x29')]);_0x2108e8[_0x8fdb('0x28')]=qs[_0x8fdb('0x28')](_0x283e09[_0x8fdb('0x37')]['offset']);}_0x2108e8['order']=qs[_0x8fdb('0x3f')](_0x283e09[_0x8fdb('0x37')][_0x8fdb('0x3f')]);_0x2108e8[_0x8fdb('0x40')]=qs['filters'](_[_0x8fdb('0x41')](_0x283e09[_0x8fdb('0x37')],_0x538248[_0x8fdb('0x38')]),_0x11964b);if(_0x283e09[_0x8fdb('0x37')]['filter']){_0x2108e8[_0x8fdb('0x40')]=_['merge'](_0x2108e8[_0x8fdb('0x40')],{'$or':_[_0x8fdb('0x42')](_0x11964b,function(_0x289166){if(_0x289166[_0x8fdb('0x34')]!==_0x8fdb('0x43')){var _0x2cd58e={};_0x2cd58e[_0x289166[_0x8fdb('0x44')]]={'$like':'%'+_0x283e09[_0x8fdb('0x37')][_0x8fdb('0x45')]+'%'};return _0x2cd58e;}})});}_0x2108e8=_['merge']({},_0x2108e8,_0x283e09['options']);var _0x98c3c2={'where':_0x2108e8['where']};return db['SalesforceAccount'][_0x8fdb('0x46')](_0x98c3c2)['then'](function(_0x54270e){_0x2c0530['count']=_0x54270e;if(_0x283e09[_0x8fdb('0x37')][_0x8fdb('0x47')]){_0x2108e8[_0x8fdb('0x48')]=[{'all':!![]}];}return db[_0x8fdb('0x49')][_0x8fdb('0x4a')](_0x2108e8);})[_0x8fdb('0x2f')](function(_0x20ed00){_0x2c0530[_0x8fdb('0x4b')]=_0x20ed00;return _0x2c0530;})[_0x8fdb('0x2f')](respondWithFilteredResult(_0x27c37c,_0x2108e8))[_0x8fdb('0x4c')](handleError(_0x27c37c,null));};exports[_0x8fdb('0x4d')]=function(_0x5159ca,_0x44eb42){var _0x2ec9ff={'raw':![],'where':{'id':_0x5159ca[_0x8fdb('0x4e')]['id']}},_0x3d1c47={};_0x3d1c47[_0x8fdb('0x36')]=_[_0x8fdb('0x4f')](db[_0x8fdb('0x49')]['rawAttributes']);_0x3d1c47['query']=_['keys'](_0x5159ca['query']);_0x3d1c47['filters']=_['intersection'](_0x3d1c47[_0x8fdb('0x36')],_0x3d1c47['query']);_0x2ec9ff[_0x8fdb('0x3a')]=_[_0x8fdb('0x39')](_0x3d1c47['model'],qs[_0x8fdb('0x3b')](_0x5159ca[_0x8fdb('0x37')][_0x8fdb('0x3b')]));_0x2ec9ff[_0x8fdb('0x3a')]=_0x2ec9ff[_0x8fdb('0x3a')][_0x8fdb('0x3c')]?_0x2ec9ff[_0x8fdb('0x3a')]:_0x3d1c47['model'];if(_0x5159ca[_0x8fdb('0x37')][_0x8fdb('0x47')]){_0x2ec9ff[_0x8fdb('0x48')]=[{'all':!![]}];}_0x2ec9ff=_[_0x8fdb('0x50')]({},_0x2ec9ff,_0x5159ca[_0x8fdb('0x51')]);return db[_0x8fdb('0x49')][_0x8fdb('0x52')](_0x2ec9ff)['then'](handleEntityNotFound(_0x44eb42,null))[_0x8fdb('0x2f')](respondWithResult(_0x44eb42,null))[_0x8fdb('0x4c')](handleError(_0x44eb42,null));};exports[_0x8fdb('0x53')]=function(_0x474338,_0x4c49b6){return db[_0x8fdb('0x49')][_0x8fdb('0x53')](_0x474338[_0x8fdb('0x54')],{})[_0x8fdb('0x2f')](respondWithResult(_0x4c49b6,0xc9))[_0x8fdb('0x4c')](handleError(_0x4c49b6,null));};exports['update']=function(_0x194d94,_0x3d846b){if(_0x194d94[_0x8fdb('0x54')]['id']){delete _0x194d94[_0x8fdb('0x54')]['id'];}return db[_0x8fdb('0x49')][_0x8fdb('0x52')]({'where':{'id':_0x194d94['params']['id']}})['then'](handleEntityNotFound(_0x3d846b,null))[_0x8fdb('0x2f')](saveUpdates(_0x194d94['body'],null))['then'](respondWithResult(_0x3d846b,null))[_0x8fdb('0x4c')](handleError(_0x3d846b,null));};exports[_0x8fdb('0x55')]=function(_0x4f6625,_0x2b4442){return db[_0x8fdb('0x49')]['find']({'where':{'id':_0x4f6625['params']['id']}})[_0x8fdb('0x2f')](handleEntityNotFound(_0x2b4442,null))[_0x8fdb('0x2f')](removeEntity(_0x2b4442,null))['catch'](handleError(_0x2b4442,null));};exports[_0x8fdb('0x56')]=function(_0x4a7a40,_0x6d1b75,_0x5cd09a){var _0x48b004={};var _0x589e53={};var _0x492711;var _0x57347c;return db[_0x8fdb('0x49')]['findOne']({'where':{'id':_0x4a7a40[_0x8fdb('0x4e')]['id']}})[_0x8fdb('0x2f')](handleEntityNotFound(_0x6d1b75,null))['then'](function(_0xde87ea){if(_0xde87ea){_0x492711=_0xde87ea;_0x589e53[_0x8fdb('0x36')]=_['keys'](db[_0x8fdb('0x57')][_0x8fdb('0x58')]);_0x589e53[_0x8fdb('0x37')]=_[_0x8fdb('0x4f')](_0x4a7a40[_0x8fdb('0x37')]);_0x589e53['filters']=_[_0x8fdb('0x39')](_0x589e53['model'],_0x589e53[_0x8fdb('0x37')]);_0x48b004['attributes']=_[_0x8fdb('0x39')](_0x589e53['model'],qs['fields'](_0x4a7a40[_0x8fdb('0x37')][_0x8fdb('0x3b')]));_0x48b004['attributes']=_0x48b004[_0x8fdb('0x3a')][_0x8fdb('0x3c')]?_0x48b004['attributes']:_0x589e53['model'];_0x48b004[_0x8fdb('0x59')]=qs[_0x8fdb('0x3f')](_0x4a7a40[_0x8fdb('0x37')][_0x8fdb('0x3f')]);_0x48b004[_0x8fdb('0x40')]=qs[_0x8fdb('0x38')](_[_0x8fdb('0x41')](_0x4a7a40['query'],_0x589e53[_0x8fdb('0x38')]));if(_0x4a7a40[_0x8fdb('0x37')][_0x8fdb('0x45')]){_0x48b004[_0x8fdb('0x40')]=_[_0x8fdb('0x50')](_0x48b004[_0x8fdb('0x40')],{'$or':_[_0x8fdb('0x42')](_0x48b004['attributes'],function(_0xf097a8){var _0x1b9c7d={};_0x1b9c7d[_0xf097a8]={'$like':'%'+_0x4a7a40[_0x8fdb('0x37')][_0x8fdb('0x45')]+'%'};return _0x1b9c7d;})});}_0x48b004=_[_0x8fdb('0x50')]({},_0x48b004,_0x4a7a40[_0x8fdb('0x51')]);return _0x492711[_0x8fdb('0x56')](_0x48b004);}})[_0x8fdb('0x2f')](function(_0x56f942){if(_0x56f942){_0x57347c=_0x56f942[_0x8fdb('0x3c')];if(!_0x4a7a40['query']['hasOwnProperty'](_0x8fdb('0x3e'))){_0x48b004[_0x8fdb('0x29')]=qs[_0x8fdb('0x29')](_0x4a7a40['query'][_0x8fdb('0x29')]);_0x48b004['offset']=qs['offset'](_0x4a7a40[_0x8fdb('0x37')][_0x8fdb('0x28')]);}return _0x492711['getConfigurations'](_0x48b004);}})[_0x8fdb('0x2f')](function(_0x1f87c2){if(_0x1f87c2){return _0x1f87c2?{'count':_0x57347c,'rows':_0x1f87c2}:null;}})['then'](respondWithResult(_0x6d1b75,null))[_0x8fdb('0x4c')](handleError(_0x6d1b75,null));};exports[_0x8fdb('0x5a')]=function(_0x4178b8,_0x1287e4,_0x4617cc){if(_0x4178b8[_0x8fdb('0x54')]['id']){delete _0x4178b8[_0x8fdb('0x54')]['id'];}return db['SalesforceAccount'][_0x8fdb('0x5b')]({'where':{'id':_0x4178b8[_0x8fdb('0x4e')]['id']}})[_0x8fdb('0x2f')](handleEntityNotFound(_0x1287e4,null))[_0x8fdb('0x2f')](function(_0x300416){if(_0x300416){_0x4178b8[_0x8fdb('0x54')][_0x8fdb('0x5c')]=_0x300416['id'];_0x4178b8[_0x8fdb('0x54')][_0x8fdb('0x5d')]=integrations[_0x8fdb('0x5e')](_0x4178b8[_0x8fdb('0x54')][_0x8fdb('0x5f')],_0x4178b8[_0x8fdb('0x54')][_0x8fdb('0x34')]);_0x4178b8[_0x8fdb('0x54')][_0x8fdb('0x60')]=integrations[_0x8fdb('0x61')](_0x4178b8[_0x8fdb('0x54')][_0x8fdb('0x5f')],_0x4178b8[_0x8fdb('0x54')][_0x8fdb('0x34')]);return db[_0x8fdb('0x57')]['create'](_0x4178b8[_0x8fdb('0x54')],{'include':[{'model':db['SalesforceField'],'as':_0x8fdb('0x5d')},{'model':db[_0x8fdb('0x62')],'as':_0x8fdb('0x60')}]});}return null;})[_0x8fdb('0x2f')](respondWithResult(_0x1287e4,null))[_0x8fdb('0x4c')](handleError(_0x1287e4,null));};exports['getFields']=function(_0x5c2dda,_0x52a673,_0x574197){var _0x29e071;var _0x19736c='';var _0x3178d2=_0x8fdb('0x63');return db['SalesforceAccount']['findOne']({'where':{'id':_0x5c2dda['params']['id']},'attributes':['id',_0x8fdb('0x64'),'clientId',_0x8fdb('0x65'),_0x8fdb('0x66'),_0x8fdb('0x67'),_0x8fdb('0x68')]})[_0x8fdb('0x2f')](handleEntityNotFound(_0x52a673,null))['then'](function(_0x41acf1){if(_0x41acf1){_0x19736c=_0x41acf1[_0x8fdb('0x64')];var _0x588a66=_0x19736c[_0x8fdb('0x69')](-0x1);if(_0x588a66==='/'){_0x19736c=_0x19736c[_0x8fdb('0x6a')](0x0,_0x19736c[_0x8fdb('0x6b')](_0x588a66));}_0x29e071=new jsforce[(_0x8fdb('0x6c'))]({'oauth2':{'loginUrl':_0x19736c,'clientId':_0x41acf1[_0x8fdb('0x6d')],'clientSecret':_0x41acf1['clientSecret']}});return _0x29e071[_0x8fdb('0x6e')](_0x41acf1['username'],_0x41acf1[_0x8fdb('0x67')][_0x8fdb('0x6f')](_0x41acf1[_0x8fdb('0x68')]));}})['then'](function(_0x36598b){if(_0x36598b){if(!_[_0x8fdb('0x70')](_0x5c2dda[_0x8fdb('0x37')][_0x8fdb('0x71')])){_0x3178d2=_0x5c2dda[_0x8fdb('0x37')]['ticketType'];}return _0x29e071[_0x8fdb('0x72')](_0x3178d2)[_0x8fdb('0x73')]();}})[_0x8fdb('0x2f')](function(_0x245d50){var _0x257b60=[_0x8fdb('0x74'),'ActivityDate',_0x8fdb('0x75'),_0x8fdb('0x76'),_0x8fdb('0x77'),_0x8fdb('0x78')];var _0xb70b3d=['string',_0x8fdb('0x79'),_0x8fdb('0x7a'),_0x8fdb('0x7b'),_0x8fdb('0x7c'),'textarea',_0x8fdb('0x7d')];if(_0x245d50){_[_0x8fdb('0x7e')](_0x245d50[_0x8fdb('0x3b')],function(_0x3dce69){return _0x257b60[_0x8fdb('0x7f')](_0x3dce69['name'])||!_0xb70b3d[_0x8fdb('0x7f')](_0x3dce69[_0x8fdb('0x34')]);});return{'count':_0x245d50[_0x8fdb('0x3b')][_0x8fdb('0x3c')],'rows':_[_0x8fdb('0x42')](_0x245d50['fields'],function(_0xb70407){return{'id':_0xb70407['name'],'name':_0xb70407[_0x8fdb('0x80')],'custom':_0xb70407[_0x8fdb('0x81')],'options':_0xb70407[_0x8fdb('0x82')][_0x8fdb('0x3c')]>0x0?_[_0x8fdb('0x42')](_0xb70407[_0x8fdb('0x82')],function(_0x3f33da){return{'name':_0x3f33da[_0x8fdb('0x80')],'value':_0x3f33da['value']};}):_0xb70407['type']==_0x8fdb('0x7b')?[{'name':_0x8fdb('0x83'),'value':_0x8fdb('0x84')},{'name':_0x8fdb('0x85'),'value':_0x8fdb('0x86')}]:[]};})};}})[_0x8fdb('0x2f')](respondWithResult(_0x52a673,null))[_0x8fdb('0x4c')](function(_0x38b790){var _0x24c88d=_0x5c2dda['query'][_0x8fdb('0x87')]?0x1f4:_0x38b790['statusCode']||0x1f4;logger[_0x8fdb('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x8fdb('0x88'),_0x24c88d,JSON[_0x8fdb('0x1f')](_0x38b790));delete _0x38b790['name'];if(_0x24c88d===0x191){_0x24c88d=0x190;}_0x52a673['status'](_0x24c88d)[_0x8fdb('0x89')](_0x5c2dda[_0x8fdb('0x37')][_0x8fdb('0x87')]?{'message':_0x8fdb('0x8a'),'statusCode':_0x38b790['statusCode']}:_0x38b790);});}; \ No newline at end of file +var _0xb4ae=['string','int','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','count','offset','limit','status','set','Content-Range','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SalesforceAccount','includeAll','include','findAll','show','keys','length','options','find','create','params','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','lastIndexOf','Connection','login','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description'];(function(_0x523de1,_0x438192){var _0x4402c7=function(_0x10df18){while(--_0x10df18){_0x523de1['push'](_0x523de1['shift']());}};_0x4402c7(++_0x438192);}(_0xb4ae,0x198));var _0xeb4a=function(_0x1fcda0,_0x5e6410){_0x1fcda0=_0x1fcda0-0x0;var _0x540337=_0xb4ae[_0x1fcda0];return _0x540337;};'use strict';var pdf=require(_0xeb4a('0x0'));var emlformat=require(_0xeb4a('0x1'));var rimraf=require(_0xeb4a('0x2'));var zipdir=require(_0xeb4a('0x3'));var jsonpatch=require(_0xeb4a('0x4'));var rp=require(_0xeb4a('0x5'));var moment=require(_0xeb4a('0x6'));var BPromise=require(_0xeb4a('0x7'));var Mustache=require(_0xeb4a('0x8'));var util=require('util');var path=require(_0xeb4a('0x9'));var sox=require(_0xeb4a('0xa'));var csv=require(_0xeb4a('0xb'));var ejs=require(_0xeb4a('0xc'));var fs=require('fs');var _=require(_0xeb4a('0xd'));var squel=require(_0xeb4a('0xe'));var crypto=require(_0xeb4a('0xf'));var jsforce=require(_0xeb4a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xeb4a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb4a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb4a('0x12'));var hardwareService=require(_0xeb4a('0x13'));var logger=require(_0xeb4a('0x14'))(_0xeb4a('0x15'));var utils=require('../../config/utils');var config=require(_0xeb4a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb4a('0x17'))['db'];var integrations=require(_0xeb4a('0x18'));var jayson=require(_0xeb4a('0x19'));var client=jayson[_0xeb4a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53b1d1,_0x261b3a,_0x2e421d,_0x2daeb8){return new BPromise(function(_0x3be811,_0x2958cc){var _0x503589=_0x2daeb8||client;return _0x503589[_0xeb4a('0x1b')](_0x53b1d1,_0x2e421d)[_0xeb4a('0x1c')](function(_0x31ef6e){logger['info'](_0xeb4a('0x1d'),_0x261b3a,_0xeb4a('0x1e'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x261b3a,_0xeb4a('0x1e'),JSON[_0xeb4a('0x1f')](_0x31ef6e));if(_0x31ef6e[_0xeb4a('0x20')]){if(_0x31ef6e['error'][_0xeb4a('0x21')]===0x1f4){logger[_0xeb4a('0x20')]('SalesforceAccount,\x20%s,\x20%s',_0x261b3a,_0x31ef6e['error'][_0xeb4a('0x22')]);return _0x2958cc(_0x31ef6e[_0xeb4a('0x20')][_0xeb4a('0x22')]);}logger[_0xeb4a('0x20')](_0xeb4a('0x1d'),_0x261b3a,_0x31ef6e[_0xeb4a('0x20')]['message']);return _0x3be811(_0x31ef6e[_0xeb4a('0x20')]['message']);}else{logger['info'](_0xeb4a('0x1d'),_0x261b3a,_0xeb4a('0x1e'));_0x3be811(_0x31ef6e['result'][_0xeb4a('0x22')]);}})[_0xeb4a('0x23')](function(_0x35da0b){logger[_0xeb4a('0x20')](_0xeb4a('0x1d'),_0x261b3a,_0x35da0b);_0x2958cc(_0x35da0b);});});}function respondWithStatusCode(_0x4ddc8e,_0x8e9684){_0x8e9684=_0x8e9684||0xcc;return function(_0x24adfb){if(_0x24adfb){return _0x4ddc8e[_0xeb4a('0x24')](_0x8e9684);}return _0x4ddc8e['status'](_0x8e9684)['end']();};}function respondWithResult(_0x3ac6d8,_0x42bf09){_0x42bf09=_0x42bf09||0xc8;return function(_0x5a865a){if(_0x5a865a){return _0x3ac6d8['status'](_0x42bf09)['json'](_0x5a865a);}};}function respondWithFilteredResult(_0xa63993,_0x1830b7){return function(_0x429f74){if(_0x429f74){var _0x3bb481=_0x429f74[_0xeb4a('0x25')],_0x37ea01=_0x1830b7[_0xeb4a('0x26')],_0x5b61af=_0x1830b7['offset']+_0x1830b7[_0xeb4a('0x27')],_0x971be7;if(_0x5b61af>=_0x3bb481){_0x5b61af=_0x3bb481;_0x971be7=0xc8;}else{_0x971be7=0xce;}_0xa63993[_0xeb4a('0x28')](_0x971be7);return _0xa63993[_0xeb4a('0x29')](_0xeb4a('0x2a'),_0x37ea01+'-'+_0x5b61af+'/'+_0x3bb481)['json'](_0x429f74);}return null;};}function patchUpdates(_0x11a377){return function(_0x23d9a6){try{jsonpatch['apply'](_0x23d9a6,_0x11a377,!![]);}catch(_0x4dc581){return BPromise['reject'](_0x4dc581);}return _0x23d9a6[_0xeb4a('0x2b')]();};}function saveUpdates(_0xd4efc1,_0x2c5d99){return function(_0x1e08f2){if(_0x1e08f2){return _0x1e08f2[_0xeb4a('0x2c')](_0xd4efc1)[_0xeb4a('0x1c')](function(_0x36ffd1){return _0x36ffd1;});}return null;};}function removeEntity(_0x3220a5,_0x1b4909){return function(_0x305645){if(_0x305645){return _0x305645[_0xeb4a('0x2d')]()[_0xeb4a('0x1c')](function(){_0x3220a5[_0xeb4a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5371fc,_0x2ef7fd){return function(_0x118f75){if(!_0x118f75){_0x5371fc[_0xeb4a('0x24')](0x194);}return _0x118f75;};}function handleError(_0x145e02,_0x11ecdc){_0x11ecdc=_0x11ecdc||0x1f4;return function(_0x494f17){logger[_0xeb4a('0x20')](_0x494f17[_0xeb4a('0x2e')]);if(_0x494f17[_0xeb4a('0x2f')]){delete _0x494f17[_0xeb4a('0x2f')];}_0x145e02[_0xeb4a('0x28')](_0x11ecdc)[_0xeb4a('0x30')](_0x494f17);};}exports[_0xeb4a('0x31')]=function(_0x2cef4d,_0x4a2c33){var _0x3404f9={},_0x371f40={},_0x3b6826={'count':0x0,'rows':[]};var _0x47cffa=_[_0xeb4a('0x32')](db['SalesforceAccount'][_0xeb4a('0x33')],function(_0x41497f){return{'name':_0x41497f[_0xeb4a('0x34')],'type':_0x41497f[_0xeb4a('0x35')][_0xeb4a('0x36')]};});_0x371f40[_0xeb4a('0x37')]=_[_0xeb4a('0x32')](_0x47cffa,'name');_0x371f40['query']=_['keys'](_0x2cef4d[_0xeb4a('0x38')]);_0x371f40[_0xeb4a('0x39')]=_[_0xeb4a('0x3a')](_0x371f40[_0xeb4a('0x37')],_0x371f40[_0xeb4a('0x38')]);_0x3404f9[_0xeb4a('0x3b')]=_[_0xeb4a('0x3a')](_0x371f40[_0xeb4a('0x37')],qs['fields'](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x3c')]));_0x3404f9['attributes']=_0x3404f9[_0xeb4a('0x3b')]['length']?_0x3404f9['attributes']:_0x371f40[_0xeb4a('0x37')];if(!_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x3d')](_0xeb4a('0x3e'))){_0x3404f9[_0xeb4a('0x27')]=qs[_0xeb4a('0x27')](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x27')]);_0x3404f9[_0xeb4a('0x26')]=qs[_0xeb4a('0x26')](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x26')]);}_0x3404f9[_0xeb4a('0x3f')]=qs[_0xeb4a('0x40')](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x40')]);_0x3404f9[_0xeb4a('0x41')]=qs[_0xeb4a('0x39')](_[_0xeb4a('0x42')](_0x2cef4d['query'],_0x371f40['filters']),_0x47cffa);if(_0x2cef4d[_0xeb4a('0x38')]['filter']){_0x3404f9[_0xeb4a('0x41')]=_[_0xeb4a('0x43')](_0x3404f9[_0xeb4a('0x41')],{'$or':_['map'](_0x47cffa,function(_0x5c3cb0){if(_0x5c3cb0[_0xeb4a('0x35')]!==_0xeb4a('0x44')){var _0x1de8f5={};_0x1de8f5[_0x5c3cb0['name']]={'$like':'%'+_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x45')]+'%'};return _0x1de8f5;}})});}_0x3404f9=_[_0xeb4a('0x43')]({},_0x3404f9,_0x2cef4d['options']);var _0xa8bc4e={'where':_0x3404f9['where']};return db[_0xeb4a('0x46')][_0xeb4a('0x25')](_0xa8bc4e)[_0xeb4a('0x1c')](function(_0x3d4d6e){_0x3b6826[_0xeb4a('0x25')]=_0x3d4d6e;if(_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x47')]){_0x3404f9[_0xeb4a('0x48')]=[{'all':!![]}];}return db[_0xeb4a('0x46')][_0xeb4a('0x49')](_0x3404f9);})['then'](function(_0x355122){_0x3b6826['rows']=_0x355122;return _0x3b6826;})[_0xeb4a('0x1c')](respondWithFilteredResult(_0x4a2c33,_0x3404f9))[_0xeb4a('0x23')](handleError(_0x4a2c33,null));};exports[_0xeb4a('0x4a')]=function(_0x3c9823,_0x5dd805){var _0x26e08e={'raw':![],'where':{'id':_0x3c9823['params']['id']}},_0x3fd739={};_0x3fd739['model']=_[_0xeb4a('0x4b')](db[_0xeb4a('0x46')]['rawAttributes']);_0x3fd739[_0xeb4a('0x38')]=_['keys'](_0x3c9823[_0xeb4a('0x38')]);_0x3fd739['filters']=_['intersection'](_0x3fd739[_0xeb4a('0x37')],_0x3fd739['query']);_0x26e08e['attributes']=_[_0xeb4a('0x3a')](_0x3fd739[_0xeb4a('0x37')],qs[_0xeb4a('0x3c')](_0x3c9823['query'][_0xeb4a('0x3c')]));_0x26e08e[_0xeb4a('0x3b')]=_0x26e08e[_0xeb4a('0x3b')][_0xeb4a('0x4c')]?_0x26e08e[_0xeb4a('0x3b')]:_0x3fd739[_0xeb4a('0x37')];if(_0x3c9823['query'][_0xeb4a('0x47')]){_0x26e08e[_0xeb4a('0x48')]=[{'all':!![]}];}_0x26e08e=_[_0xeb4a('0x43')]({},_0x26e08e,_0x3c9823[_0xeb4a('0x4d')]);return db['SalesforceAccount'][_0xeb4a('0x4e')](_0x26e08e)['then'](handleEntityNotFound(_0x5dd805,null))['then'](respondWithResult(_0x5dd805,null))[_0xeb4a('0x23')](handleError(_0x5dd805,null));};exports[_0xeb4a('0x4f')]=function(_0x2598fd,_0x72ebf4){return db[_0xeb4a('0x46')][_0xeb4a('0x4f')](_0x2598fd['body'],{})['then'](respondWithResult(_0x72ebf4,0xc9))[_0xeb4a('0x23')](handleError(_0x72ebf4,null));};exports[_0xeb4a('0x2c')]=function(_0x5206e0,_0x5e9819){if(_0x5206e0['body']['id']){delete _0x5206e0['body']['id'];}return db[_0xeb4a('0x46')]['find']({'where':{'id':_0x5206e0[_0xeb4a('0x50')]['id']}})[_0xeb4a('0x1c')](handleEntityNotFound(_0x5e9819,null))[_0xeb4a('0x1c')](saveUpdates(_0x5206e0[_0xeb4a('0x51')],null))['then'](respondWithResult(_0x5e9819,null))[_0xeb4a('0x23')](handleError(_0x5e9819,null));};exports[_0xeb4a('0x2d')]=function(_0x100a05,_0x300831){return db[_0xeb4a('0x46')]['find']({'where':{'id':_0x100a05[_0xeb4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x300831,null))[_0xeb4a('0x1c')](removeEntity(_0x300831,null))[_0xeb4a('0x23')](handleError(_0x300831,null));};exports['getConfigurations']=function(_0x24332a,_0x157d07,_0x5d573a){var _0x41c402={};var _0xf9229f={};var _0x10f727;var _0x847d33;return db[_0xeb4a('0x46')][_0xeb4a('0x52')]({'where':{'id':_0x24332a[_0xeb4a('0x50')]['id']}})[_0xeb4a('0x1c')](handleEntityNotFound(_0x157d07,null))[_0xeb4a('0x1c')](function(_0x1c8ecf){if(_0x1c8ecf){_0x10f727=_0x1c8ecf;_0xf9229f[_0xeb4a('0x37')]=_[_0xeb4a('0x4b')](db[_0xeb4a('0x53')][_0xeb4a('0x33')]);_0xf9229f[_0xeb4a('0x38')]=_[_0xeb4a('0x4b')](_0x24332a['query']);_0xf9229f['filters']=_['intersection'](_0xf9229f['model'],_0xf9229f[_0xeb4a('0x38')]);_0x41c402[_0xeb4a('0x3b')]=_[_0xeb4a('0x3a')](_0xf9229f[_0xeb4a('0x37')],qs['fields'](_0x24332a['query'][_0xeb4a('0x3c')]));_0x41c402[_0xeb4a('0x3b')]=_0x41c402[_0xeb4a('0x3b')][_0xeb4a('0x4c')]?_0x41c402[_0xeb4a('0x3b')]:_0xf9229f['model'];_0x41c402[_0xeb4a('0x3f')]=qs['sort'](_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x40')]);_0x41c402['where']=qs[_0xeb4a('0x39')](_['pick'](_0x24332a[_0xeb4a('0x38')],_0xf9229f[_0xeb4a('0x39')]));if(_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x45')]){_0x41c402[_0xeb4a('0x41')]=_['merge'](_0x41c402['where'],{'$or':_[_0xeb4a('0x32')](_0x41c402[_0xeb4a('0x3b')],function(_0x1c1693){var _0x5204d9={};_0x5204d9[_0x1c1693]={'$like':'%'+_0x24332a[_0xeb4a('0x38')]['filter']+'%'};return _0x5204d9;})});}_0x41c402=_[_0xeb4a('0x43')]({},_0x41c402,_0x24332a[_0xeb4a('0x4d')]);return _0x10f727[_0xeb4a('0x54')](_0x41c402);}})[_0xeb4a('0x1c')](function(_0x4966ab){if(_0x4966ab){_0x847d33=_0x4966ab[_0xeb4a('0x4c')];if(!_0x24332a['query'][_0xeb4a('0x3d')](_0xeb4a('0x3e'))){_0x41c402[_0xeb4a('0x27')]=qs['limit'](_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x27')]);_0x41c402[_0xeb4a('0x26')]=qs[_0xeb4a('0x26')](_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x26')]);}return _0x10f727[_0xeb4a('0x54')](_0x41c402);}})['then'](function(_0x467d2d){if(_0x467d2d){return _0x467d2d?{'count':_0x847d33,'rows':_0x467d2d}:null;}})[_0xeb4a('0x1c')](respondWithResult(_0x157d07,null))['catch'](handleError(_0x157d07,null));};exports[_0xeb4a('0x55')]=function(_0x155067,_0x1b72ce,_0x542d66){if(_0x155067[_0xeb4a('0x51')]['id']){delete _0x155067[_0xeb4a('0x51')]['id'];}return db[_0xeb4a('0x46')][_0xeb4a('0x52')]({'where':{'id':_0x155067[_0xeb4a('0x50')]['id']}})[_0xeb4a('0x1c')](handleEntityNotFound(_0x1b72ce,null))[_0xeb4a('0x1c')](function(_0x2f26de){if(_0x2f26de){_0x155067[_0xeb4a('0x51')][_0xeb4a('0x56')]=_0x2f26de['id'];_0x155067['body'][_0xeb4a('0x57')]=integrations[_0xeb4a('0x58')](_0x155067['body'][_0xeb4a('0x59')],_0x155067[_0xeb4a('0x51')]['type']);_0x155067[_0xeb4a('0x51')][_0xeb4a('0x5a')]=integrations[_0xeb4a('0x5b')](_0x155067[_0xeb4a('0x51')]['channel'],_0x155067[_0xeb4a('0x51')][_0xeb4a('0x35')]);return db[_0xeb4a('0x53')][_0xeb4a('0x4f')](_0x155067[_0xeb4a('0x51')],{'include':[{'model':db[_0xeb4a('0x5c')],'as':_0xeb4a('0x57')},{'model':db[_0xeb4a('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1b72ce,null))[_0xeb4a('0x23')](handleError(_0x1b72ce,null));};exports[_0xeb4a('0x5d')]=function(_0x516408,_0x4bb524,_0x1af697){var _0x528be8;var _0x55de64='';var _0x820d0e='Task';return db[_0xeb4a('0x46')][_0xeb4a('0x52')]({'where':{'id':_0x516408[_0xeb4a('0x50')]['id']},'attributes':['id',_0xeb4a('0x5e'),_0xeb4a('0x5f'),_0xeb4a('0x60'),_0xeb4a('0x61'),_0xeb4a('0x62'),_0xeb4a('0x63')]})['then'](handleEntityNotFound(_0x4bb524,null))[_0xeb4a('0x1c')](function(_0x5a5751){if(_0x5a5751){_0x55de64=_0x5a5751[_0xeb4a('0x5e')];var _0x14f8a5=_0x55de64['slice'](-0x1);if(_0x14f8a5==='/'){_0x55de64=_0x55de64['substring'](0x0,_0x55de64[_0xeb4a('0x64')](_0x14f8a5));}_0x528be8=new jsforce[(_0xeb4a('0x65'))]({'oauth2':{'loginUrl':_0x55de64,'clientId':_0x5a5751[_0xeb4a('0x5f')],'clientSecret':_0x5a5751['clientSecret']}});return _0x528be8[_0xeb4a('0x66')](_0x5a5751['username'],_0x5a5751[_0xeb4a('0x62')]['concat'](_0x5a5751['securityToken']));}})[_0xeb4a('0x1c')](function(_0x148b08){if(_0x148b08){if(!_[_0xeb4a('0x67')](_0x516408[_0xeb4a('0x38')][_0xeb4a('0x68')])){_0x820d0e=_0x516408[_0xeb4a('0x38')][_0xeb4a('0x68')];}return _0x528be8[_0xeb4a('0x69')](_0x820d0e)['describe']();}})[_0xeb4a('0x1c')](function(_0x5c507b){var _0x434763=[_0xeb4a('0x6a'),_0xeb4a('0x6b'),_0xeb4a('0x6c'),_0xeb4a('0x6d'),_0xeb4a('0x6e'),_0xeb4a('0x6f')];var _0x43db72=[_0xeb4a('0x70'),_0xeb4a('0x71'),'picklist',_0xeb4a('0x72'),_0xeb4a('0x73'),_0xeb4a('0x74'),_0xeb4a('0x75')];if(_0x5c507b){_['remove'](_0x5c507b[_0xeb4a('0x3c')],function(_0x16d897){return _0x434763[_0xeb4a('0x76')](_0x16d897['name'])||!_0x43db72[_0xeb4a('0x76')](_0x16d897[_0xeb4a('0x35')]);});return{'count':_0x5c507b['fields'][_0xeb4a('0x4c')],'rows':_['map'](_0x5c507b[_0xeb4a('0x3c')],function(_0x1857ef){return{'id':_0x1857ef[_0xeb4a('0x2f')],'name':_0x1857ef[_0xeb4a('0x77')],'custom':_0x1857ef[_0xeb4a('0x78')],'options':_0x1857ef[_0xeb4a('0x79')][_0xeb4a('0x4c')]>0x0?_[_0xeb4a('0x32')](_0x1857ef[_0xeb4a('0x79')],function(_0x39d4b6){return{'name':_0x39d4b6[_0xeb4a('0x77')],'value':_0x39d4b6[_0xeb4a('0x7a')]};}):_0x1857ef[_0xeb4a('0x35')]==_0xeb4a('0x72')?[{'name':'True','value':_0xeb4a('0x7b')},{'name':_0xeb4a('0x7c'),'value':_0xeb4a('0x7d')}]:[]};})};}})['then'](respondWithResult(_0x4bb524,null))[_0xeb4a('0x23')](function(_0xc40654){var _0x401643=_0x516408[_0xeb4a('0x38')][_0xeb4a('0x7e')]?0x1f4:_0xc40654[_0xeb4a('0x7f')]||0x1f4;logger[_0xeb4a('0x20')](_0xeb4a('0x80'),_0xeb4a('0x5d'),_0x401643,JSON[_0xeb4a('0x1f')](_0xc40654));delete _0xc40654[_0xeb4a('0x2f')];if(_0x401643===0x191){_0x401643=0x190;}_0x4bb524[_0xeb4a('0x28')](_0x401643)['send'](_0x516408['query'][_0xeb4a('0x7e')]?{'message':_0xeb4a('0x81'),'statusCode':_0xc40654[_0xeb4a('0x7f')]}:_0xc40654);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 80b6ccb..4ea7e9b 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 _0x43f8=['define','SalesforceAccount','int_salesforce_accounts','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1bd788,_0x3ac69a){var _0x3229b4=function(_0x45605e){while(--_0x45605e){_0x1bd788['push'](_0x1bd788['shift']());}};_0x3229b4(++_0x3ac69a);}(_0x43f8,0x1bd));var _0x843f=function(_0x13b82a,_0x8f477d){_0x13b82a=_0x13b82a-0x0;var _0x140fe3=_0x43f8[_0x13b82a];return _0x140fe3;};'use strict';var _=require('lodash');var util=require(_0x843f('0x0'));var logger=require('../../config/logger')(_0x843f('0x1'));var moment=require(_0x843f('0x2'));var BPromise=require(_0x843f('0x3'));var rp=require(_0x843f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x843f('0x5'));var config=require(_0x843f('0x6'));var attributes=require(_0x843f('0x7'));var integrations=require(_0x843f('0x8'));module[_0x843f('0x9')]=function(_0xf9ea02,_0x13bd26){return _0xf9ea02[_0x843f('0xa')](_0x843f('0xb'),attributes,{'tableName':_0x843f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5227=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount','lodash'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x5227,0x81));var _0x7522=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x5227[_0x27bd2c];return _0x3784ea;};'use strict';var _=require(_0x7522('0x0'));var util=require(_0x7522('0x1'));var logger=require(_0x7522('0x2'))(_0x7522('0x3'));var moment=require(_0x7522('0x4'));var BPromise=require(_0x7522('0x5'));var rp=require(_0x7522('0x6'));var fs=require('fs');var path=require(_0x7522('0x7'));var rimraf=require(_0x7522('0x8'));var config=require(_0x7522('0x9'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x7522('0xa'));module[_0x7522('0xb')]=function(_0x13fe2b,_0x263369){return _0x13fe2b['define'](_0x7522('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 01bcd3a..6aaff77 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 _0xe14d=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2e812d,_0x5c69fa){var _0x173ec0=function(_0x16808d){while(--_0x16808d){_0x2e812d['push'](_0x2e812d['shift']());}};_0x173ec0(++_0x5c69fa);}(_0xe14d,0x1ee));var _0xde14=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe14d[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});}exports[_0xde14('0x19')]=function(_0x3cc317){var _0x10c4ab=this;return new Promise(function(_0x590a8b,_0x3f5fcf){return db[_0xde14('0x1a')][_0xde14('0x1b')]({'raw':_0x3cc317[_0xde14('0x1c')]?_0x3cc317['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cc317['options']?_0x3cc317[_0xde14('0x1c')]['where']||null:null,'attributes':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1e')]||null:null,'limit':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1f')]||null:null,'include':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')]?_[_0xde14('0x21')](_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')],function(_0x8f8033){return{'model':db[_0x8f8033['model']],'as':_0x8f8033['as'],'attributes':_0x8f8033[_0xde14('0x1e')],'include':_0x8f8033[_0xde14('0x20')]?_[_0xde14('0x21')](_0x8f8033[_0xde14('0x20')],function(_0x1bb7be){return{'model':db[_0x1bb7be[_0xde14('0x22')]],'as':_0x1bb7be['as'],'attributes':_0x1bb7be[_0xde14('0x1e')],'include':_0x1bb7be[_0xde14('0x20')]?_[_0xde14('0x21')](_0x1bb7be[_0xde14('0x20')],function(_0x4eff65){return{'model':db[_0x4eff65[_0xde14('0x22')]],'as':_0x4eff65['as'],'attributes':_0x4eff65[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0xf8279a){logger['info'](_0xde14('0x19'),_0x3cc317);logger[_0xde14('0x10')](_0xde14('0x19'),_0x3cc317,JSON['stringify'](_0xf8279a));_0x590a8b(_0xf8279a);})[_0xde14('0x18')](function(_0x582537){logger[_0xde14('0x14')](_0xde14('0x19'),_0x582537[_0xde14('0x16')],_0x3cc317);_0x3f5fcf(_0x10c4ab[_0xde14('0x14')](0x1f4,_0x582537[_0xde14('0x16')]));});});};exports[_0xde14('0x23')]=function(_0xae9dca){var _0x464666=this;return new Promise(function(_0x4e7c5b,_0xbfc01b){return db[_0xde14('0x1a')]['find']({'raw':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0xae9dca[_0xde14('0x1c')]?_0xae9dca[_0xde14('0x1c')][_0xde14('0x24')]||null:null,'attributes':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1e')]||null:null,'include':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x20')]?_[_0xde14('0x21')](_0xae9dca[_0xde14('0x1c')][_0xde14('0x20')],function(_0x2713fb){return{'model':db[_0x2713fb[_0xde14('0x22')]],'as':_0x2713fb['as'],'attributes':_0x2713fb[_0xde14('0x1e')],'include':_0x2713fb[_0xde14('0x20')]?_[_0xde14('0x21')](_0x2713fb['include'],function(_0x50084f){return{'model':db[_0x50084f[_0xde14('0x22')]],'as':_0x50084f['as'],'attributes':_0x50084f[_0xde14('0x1e')],'include':_0x50084f[_0xde14('0x20')]?_[_0xde14('0x21')](_0x50084f[_0xde14('0x20')],function(_0x23813f){return{'model':db[_0x23813f[_0xde14('0x22')]],'as':_0x23813f['as'],'attributes':_0x23813f[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0x4e33e0){logger[_0xde14('0xe')]('ShowSalesforceAccount',_0xae9dca);logger['debug']('ShowSalesforceAccount',_0xae9dca,JSON[_0xde14('0x13')](_0x4e33e0));_0x4e7c5b(_0x4e33e0);})[_0xde14('0x18')](function(_0x398f63){logger[_0xde14('0x14')](_0xde14('0x23'),_0x398f63[_0xde14('0x16')],_0xae9dca);_0xbfc01b(_0x464666[_0xde14('0x14')](0x1f4,_0x398f63[_0xde14('0x16')]));});});}; \ No newline at end of file +var _0x702d=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','SalesforceAccount','findAll','options','raw','attributes','include','map','model','GetSalesforceAccount','catch','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x3a980f,_0x49e4d6){var _0x36010f=function(_0x2835e6){while(--_0x2835e6){_0x3a980f['push'](_0x3a980f['shift']());}};_0x36010f(++_0x49e4d6);}(_0x702d,0x147));var _0xd702=function(_0x490086,_0x3677d4){_0x490086=_0x490086-0x0;var _0x2acda4=_0x702d[_0x490086];return _0x2acda4;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});}exports['GetSalesforceAccount']=function(_0x5b3b1d){var _0x2205de=this;return new Promise(function(_0x5a296e,_0x3fbcec){return db[_0xd702('0x17')][_0xd702('0x18')]({'raw':_0x5b3b1d[_0xd702('0x19')]?_0x5b3b1d[_0xd702('0x19')][_0xd702('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b3b1d[_0xd702('0x19')]?_0x5b3b1d['options']['where']||null:null,'attributes':_0x5b3b1d['options']?_0x5b3b1d[_0xd702('0x19')][_0xd702('0x1b')]||null:null,'limit':_0x5b3b1d['options']?_0x5b3b1d[_0xd702('0x19')]['limit']||null:null,'include':_0x5b3b1d[_0xd702('0x19')]?_0x5b3b1d['options']['include']?_['map'](_0x5b3b1d[_0xd702('0x19')][_0xd702('0x1c')],function(_0x459184){return{'model':db[_0x459184['model']],'as':_0x459184['as'],'attributes':_0x459184[_0xd702('0x1b')],'include':_0x459184[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x459184[_0xd702('0x1c')],function(_0x1200ed){return{'model':db[_0x1200ed[_0xd702('0x1e')]],'as':_0x1200ed['as'],'attributes':_0x1200ed[_0xd702('0x1b')],'include':_0x1200ed[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x1200ed['include'],function(_0x116b2f){return{'model':db[_0x116b2f[_0xd702('0x1e')]],'as':_0x116b2f['as'],'attributes':_0x116b2f[_0xd702('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd702('0xc')](function(_0xbe4518){logger[_0xd702('0xd')](_0xd702('0x1f'),_0x5b3b1d);logger[_0xd702('0x10')]('GetSalesforceAccount',_0x5b3b1d,JSON['stringify'](_0xbe4518));_0x5a296e(_0xbe4518);})[_0xd702('0x20')](function(_0x43cd38){logger['error'](_0xd702('0x1f'),_0x43cd38[_0xd702('0x15')],_0x5b3b1d);_0x3fbcec(_0x2205de[_0xd702('0x14')](0x1f4,_0x43cd38[_0xd702('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x213c31){var _0x313281=this;return new Promise(function(_0x1630ed,_0x43fe18){return db[_0xd702('0x17')]['find']({'raw':_0x213c31[_0xd702('0x19')]?_0x213c31[_0xd702('0x19')][_0xd702('0x1a')]===undefined?!![]:![]:!![],'where':_0x213c31['options']?_0x213c31[_0xd702('0x19')]['where']||null:null,'attributes':_0x213c31['options']?_0x213c31[_0xd702('0x19')][_0xd702('0x1b')]||null:null,'include':_0x213c31[_0xd702('0x19')]?_0x213c31['options'][_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x213c31['options'][_0xd702('0x1c')],function(_0x1f7c7e){return{'model':db[_0x1f7c7e[_0xd702('0x1e')]],'as':_0x1f7c7e['as'],'attributes':_0x1f7c7e[_0xd702('0x1b')],'include':_0x1f7c7e[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x1f7c7e[_0xd702('0x1c')],function(_0x25d2cd){return{'model':db[_0x25d2cd[_0xd702('0x1e')]],'as':_0x25d2cd['as'],'attributes':_0x25d2cd[_0xd702('0x1b')],'include':_0x25d2cd[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x25d2cd[_0xd702('0x1c')],function(_0x508652){return{'model':db[_0x508652[_0xd702('0x1e')]],'as':_0x508652['as'],'attributes':_0x508652[_0xd702('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd702('0xc')](function(_0x36a94b){logger[_0xd702('0xd')](_0xd702('0x21'),_0x213c31);logger[_0xd702('0x10')]('ShowSalesforceAccount',_0x213c31,JSON['stringify'](_0x36a94b));_0x1630ed(_0x36a94b);})[_0xd702('0x20')](function(_0x1810ee){logger['error']('ShowSalesforceAccount',_0x1810ee[_0xd702('0x15')],_0x213c31);_0x43fe18(_0x313281[_0xd702('0x14')](0x1f4,_0x1810ee['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 802064e..af36063 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 _0xc277=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports'];(function(_0x24ec6f,_0x1de736){var _0x2b3d05=function(_0x1d5215){while(--_0x1d5215){_0x24ec6f['push'](_0x24ec6f['shift']());}};_0x2b3d05(++_0x1de736);}(_0xc277,0x120));var _0x7c27=function(_0x458cc9,_0x556c88){_0x458cc9=_0x458cc9-0x0;var _0x490336=_0xc277[_0x458cc9];return _0x490336;};'use strict';var multer=require(_0x7c27('0x0'));var util=require(_0x7c27('0x1'));var path=require('path');var timeout=require(_0x7c27('0x2'));var express=require(_0x7c27('0x3'));var router=express[_0x7c27('0x4')]();var auth=require(_0x7c27('0x5'));var interaction=require(_0x7c27('0x6'));var config=require(_0x7c27('0x7'));var controller=require('./intSalesforceConfiguration.controller');router[_0x7c27('0x8')]('/',auth[_0x7c27('0x9')](),controller[_0x7c27('0xa')]);router[_0x7c27('0x8')](_0x7c27('0xb'),auth['isAuthenticated'](),controller[_0x7c27('0xc')]);router[_0x7c27('0x8')](_0x7c27('0xd'),auth['isAuthenticated'](),controller[_0x7c27('0xe')]);router[_0x7c27('0x8')]('/:id/subjects',auth[_0x7c27('0x9')](),controller[_0x7c27('0xf')]);router[_0x7c27('0x8')](_0x7c27('0x10'),auth[_0x7c27('0x9')](),controller[_0x7c27('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c27('0x12')]);router[_0x7c27('0x13')](_0x7c27('0xb'),auth['isAuthenticated'](),controller[_0x7c27('0x14')]);router[_0x7c27('0x15')](_0x7c27('0xb'),auth[_0x7c27('0x9')](),controller[_0x7c27('0x16')]);module[_0x7c27('0x17')]=router; \ No newline at end of file +var _0xe671=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','/:id','destroy'];(function(_0x14f74b,_0x38b3bc){var _0x3ad94a=function(_0x56edc4){while(--_0x56edc4){_0x14f74b['push'](_0x14f74b['shift']());}};_0x3ad94a(++_0x38b3bc);}(_0xe671,0x1b1));var _0x1e67=function(_0x390dce,_0x1da917){_0x390dce=_0x390dce-0x0;var _0x501eed=_0xe671[_0x390dce];return _0x501eed;};'use strict';var multer=require(_0x1e67('0x0'));var util=require(_0x1e67('0x1'));var path=require('path');var timeout=require(_0x1e67('0x2'));var express=require(_0x1e67('0x3'));var router=express[_0x1e67('0x4')]();var auth=require(_0x1e67('0x5'));var interaction=require(_0x1e67('0x6'));var config=require('../../config/environment');var controller=require(_0x1e67('0x7'));router[_0x1e67('0x8')]('/',auth[_0x1e67('0x9')](),controller['index']);router['get']('/:id',auth[_0x1e67('0x9')](),controller[_0x1e67('0xa')]);router[_0x1e67('0x8')](_0x1e67('0xb'),auth[_0x1e67('0x9')](),controller[_0x1e67('0xc')]);router[_0x1e67('0x8')](_0x1e67('0xd'),auth[_0x1e67('0x9')](),controller[_0x1e67('0xe')]);router[_0x1e67('0x8')](_0x1e67('0xf'),auth[_0x1e67('0x9')](),controller[_0x1e67('0x10')]);router[_0x1e67('0x11')]('/',auth[_0x1e67('0x9')](),controller[_0x1e67('0x12')]);router[_0x1e67('0x13')]('/:id',auth[_0x1e67('0x9')](),controller['update']);router[_0x1e67('0x14')](_0x1e67('0x15'),auth[_0x1e67('0x9')](),controller[_0x1e67('0x16')]);module[_0x1e67('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4f9bba8..f38fd2f 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 _0x8652=['lead','nothing','exports','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x8652,0x1bb));var _0x2865=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x8652[_0x47408e];return _0x1636bc;};'use strict';var Sequelize=require('sequelize');module[_0x2865('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2865('0x1')]},'ticketType':{'type':Sequelize[_0x2865('0x2')](_0x2865('0x3'),_0x2865('0x4')),'defaultValue':_0x2865('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x2865('0x5'),_0x2865('0x6'),_0x2865('0x7')),'defaultValue':_0x2865('0x5')},'moduleCreate':{'type':Sequelize[_0x2865('0x2')](_0x2865('0x8'),'contact',_0x2865('0x7')),'defaultValue':_0x2865('0x7')}}; \ No newline at end of file +var _0xaaa0=['lead','contact_lead','exports','STRING','ENUM','Case','Task','contact'];(function(_0x54005b,_0x2d806d){var _0x2294ee=function(_0x3fdb6f){while(--_0x3fdb6f){_0x54005b['push'](_0x54005b['shift']());}};_0x2294ee(++_0x2d806d);}(_0xaaa0,0x1e2));var _0x0aaa=function(_0x5a4f86,_0x4e95b1){_0x5a4f86=_0x5a4f86-0x0;var _0x150da0=_0xaaa0[_0x5a4f86];return _0x150da0;};'use strict';var Sequelize=require('sequelize');module[_0x0aaa('0x0')]={'name':{'type':Sequelize[_0x0aaa('0x1')]},'description':{'type':Sequelize[_0x0aaa('0x1')]},'ticketType':{'type':Sequelize[_0x0aaa('0x2')]('Task',_0x0aaa('0x3')),'defaultValue':_0x0aaa('0x4')},'moduleSearch':{'type':Sequelize[_0x0aaa('0x2')]('contact_lead',_0x0aaa('0x5'),_0x0aaa('0x6')),'defaultValue':_0x0aaa('0x7')},'moduleCreate':{'type':Sequelize[_0x0aaa('0x2')]('nothing',_0x0aaa('0x5'),_0x0aaa('0x6')),'defaultValue':_0x0aaa('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3c7d5f1..db115fd 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 _0x74a1=['query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','count','includeAll','include','rows','show','params','rawAttributes','length','find','create','body','update','getFields','SalesforceField','getSubjects','pick','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','destroy','end','stack','name','send','index','map','SalesforceConfiguration','type','key'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x74a1,0x199));var _0x174a=function(_0x546a88,_0x48d512){_0x546a88=_0x546a88-0x0;var _0x60ec43=_0x74a1[_0x546a88];return _0x60ec43;};'use strict';var pdf=require(_0x174a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x174a('0x1'));var zipdir=require(_0x174a('0x2'));var jsonpatch=require(_0x174a('0x3'));var rp=require(_0x174a('0x4'));var moment=require(_0x174a('0x5'));var BPromise=require(_0x174a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x174a('0x7'));var sox=require(_0x174a('0x8'));var csv=require('to-csv');var ejs=require(_0x174a('0x9'));var fs=require('fs');var _=require(_0x174a('0xa'));var squel=require(_0x174a('0xb'));var crypto=require(_0x174a('0xc'));var jsforce=require(_0x174a('0xd'));var deskjs=require(_0x174a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x174a('0xf'));var Papa=require(_0x174a('0x10'));var Redis=require('ioredis');var authService=require(_0x174a('0x11'));var qs=require(_0x174a('0x12'));var as=require(_0x174a('0x13'));var hardwareService=require(_0x174a('0x14'));var logger=require(_0x174a('0x15'))('api');var utils=require(_0x174a('0x16'));var config=require(_0x174a('0x17'));var licenseUtil=require(_0x174a('0x18'));var db=require(_0x174a('0x19'))['db'];var jayson=require(_0x174a('0x1a'));var client=jayson[_0x174a('0x1b')][_0x174a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x473c00,_0x16e5f7,_0xc082e9,_0x3f23d4){return new BPromise(function(_0x518135,_0xc70a69){var _0x3deaa7=_0x3f23d4||client;return _0x3deaa7[_0x174a('0x1d')](_0x473c00,_0xc082e9)[_0x174a('0x1e')](function(_0x6f3913){logger[_0x174a('0x1f')](_0x174a('0x20'),_0x16e5f7,_0x174a('0x21'));logger[_0x174a('0x22')](_0x174a('0x23'),_0x16e5f7,_0x174a('0x21'),JSON[_0x174a('0x24')](_0x6f3913));if(_0x6f3913['error']){if(_0x6f3913[_0x174a('0x25')][_0x174a('0x26')]===0x1f4){logger[_0x174a('0x25')]('SalesforceConfiguration,\x20%s,\x20%s',_0x16e5f7,_0x6f3913['error']['message']);return _0xc70a69(_0x6f3913[_0x174a('0x25')]['message']);}logger[_0x174a('0x25')]('SalesforceConfiguration,\x20%s,\x20%s',_0x16e5f7,_0x6f3913[_0x174a('0x25')][_0x174a('0x27')]);return _0x518135(_0x6f3913[_0x174a('0x25')][_0x174a('0x27')]);}else{logger[_0x174a('0x1f')](_0x174a('0x20'),_0x16e5f7,'request\x20sent');_0x518135(_0x6f3913[_0x174a('0x28')]['message']);}})[_0x174a('0x29')](function(_0x5be378){logger[_0x174a('0x25')](_0x174a('0x20'),_0x16e5f7,_0x5be378);_0xc70a69(_0x5be378);});});}function respondWithStatusCode(_0x2aa7f6,_0x1ec22f){_0x1ec22f=_0x1ec22f||0xcc;return function(_0x2aaa56){if(_0x2aaa56){return _0x2aa7f6[_0x174a('0x2a')](_0x1ec22f);}return _0x2aa7f6[_0x174a('0x2b')](_0x1ec22f)['end']();};}function respondWithResult(_0x5ec6bc,_0x193309){_0x193309=_0x193309||0xc8;return function(_0x546699){if(_0x546699){return _0x5ec6bc[_0x174a('0x2b')](_0x193309)[_0x174a('0x2c')](_0x546699);}};}function respondWithFilteredResult(_0xfbc807,_0x323000){return function(_0x495134){if(_0x495134){var _0x2b1d88=_0x495134['count'],_0x335a51=_0x323000[_0x174a('0x2d')],_0xd461ac=_0x323000[_0x174a('0x2d')]+_0x323000[_0x174a('0x2e')],_0x469518;if(_0xd461ac>=_0x2b1d88){_0xd461ac=_0x2b1d88;_0x469518=0xc8;}else{_0x469518=0xce;}_0xfbc807[_0x174a('0x2b')](_0x469518);return _0xfbc807[_0x174a('0x2f')](_0x174a('0x30'),_0x335a51+'-'+_0xd461ac+'/'+_0x2b1d88)[_0x174a('0x2c')](_0x495134);}return null;};}function patchUpdates(_0x40592e){return function(_0x143a0d){try{jsonpatch[_0x174a('0x31')](_0x143a0d,_0x40592e,!![]);}catch(_0x433b67){return BPromise[_0x174a('0x32')](_0x433b67);}return _0x143a0d['save']();};}function saveUpdates(_0x3307fc,_0x1f9681){return function(_0x4d88ec){if(_0x4d88ec){return _0x4d88ec['update'](_0x3307fc)['then'](function(_0x3c2854){return _0x3c2854;});}return null;};}function removeEntity(_0x5abd79,_0xe14a66){return function(_0x4cb187){if(_0x4cb187){return _0x4cb187[_0x174a('0x33')]()['then'](function(){_0x5abd79[_0x174a('0x2b')](0xcc)[_0x174a('0x34')]();});}};}function handleEntityNotFound(_0x1ea743,_0x389dd7){return function(_0x2abfbd){if(!_0x2abfbd){_0x1ea743[_0x174a('0x2a')](0x194);}return _0x2abfbd;};}function handleError(_0x1bf4de,_0x45438f){_0x45438f=_0x45438f||0x1f4;return function(_0x2e292b){logger['error'](_0x2e292b[_0x174a('0x35')]);if(_0x2e292b[_0x174a('0x36')]){delete _0x2e292b[_0x174a('0x36')];}_0x1bf4de[_0x174a('0x2b')](_0x45438f)[_0x174a('0x37')](_0x2e292b);};}exports[_0x174a('0x38')]=function(_0x5e781c,_0x221d9c){var _0x1725ae={},_0x21c715={},_0x922bcc={'count':0x0,'rows':[]};var _0x551734=_[_0x174a('0x39')](db[_0x174a('0x3a')]['rawAttributes'],function(_0x54ce3e){return{'name':_0x54ce3e['fieldName'],'type':_0x54ce3e[_0x174a('0x3b')][_0x174a('0x3c')]};});_0x21c715['model']=_[_0x174a('0x39')](_0x551734,_0x174a('0x36'));_0x21c715[_0x174a('0x3d')]=_[_0x174a('0x3e')](_0x5e781c[_0x174a('0x3d')]);_0x21c715[_0x174a('0x3f')]=_[_0x174a('0x40')](_0x21c715['model'],_0x21c715[_0x174a('0x3d')]);_0x1725ae[_0x174a('0x41')]=_[_0x174a('0x40')](_0x21c715[_0x174a('0x42')],qs[_0x174a('0x43')](_0x5e781c[_0x174a('0x3d')][_0x174a('0x43')]));_0x1725ae[_0x174a('0x41')]=_0x1725ae[_0x174a('0x41')]['length']?_0x1725ae[_0x174a('0x41')]:_0x21c715[_0x174a('0x42')];if(!_0x5e781c['query'][_0x174a('0x44')](_0x174a('0x45'))){_0x1725ae[_0x174a('0x2e')]=qs['limit'](_0x5e781c[_0x174a('0x3d')][_0x174a('0x2e')]);_0x1725ae['offset']=qs['offset'](_0x5e781c['query'][_0x174a('0x2d')]);}_0x1725ae[_0x174a('0x46')]=qs[_0x174a('0x47')](_0x5e781c['query'][_0x174a('0x47')]);_0x1725ae['where']=qs[_0x174a('0x3f')](_['pick'](_0x5e781c['query'],_0x21c715[_0x174a('0x3f')]),_0x551734);if(_0x5e781c[_0x174a('0x3d')][_0x174a('0x48')]){_0x1725ae['where']=_[_0x174a('0x49')](_0x1725ae[_0x174a('0x4a')],{'$or':_[_0x174a('0x39')](_0x551734,function(_0x236b49){if(_0x236b49['type']!==_0x174a('0x4b')){var _0x5d92fd={};_0x5d92fd[_0x236b49['name']]={'$like':'%'+_0x5e781c[_0x174a('0x3d')][_0x174a('0x48')]+'%'};return _0x5d92fd;}})});}_0x1725ae=_['merge']({},_0x1725ae,_0x5e781c[_0x174a('0x4c')]);var _0x18837d={'where':_0x1725ae[_0x174a('0x4a')]};return db[_0x174a('0x3a')][_0x174a('0x4d')](_0x18837d)['then'](function(_0xa65539){_0x922bcc[_0x174a('0x4d')]=_0xa65539;if(_0x5e781c[_0x174a('0x3d')][_0x174a('0x4e')]){_0x1725ae[_0x174a('0x4f')]=[{'all':!![]}];}return db[_0x174a('0x3a')]['findAll'](_0x1725ae);})[_0x174a('0x1e')](function(_0x2978f0){_0x922bcc[_0x174a('0x50')]=_0x2978f0;return _0x922bcc;})[_0x174a('0x1e')](respondWithFilteredResult(_0x221d9c,_0x1725ae))[_0x174a('0x29')](handleError(_0x221d9c,null));};exports[_0x174a('0x51')]=function(_0x2fa339,_0x18d2ee){var _0x4b46e9={'raw':![],'where':{'id':_0x2fa339[_0x174a('0x52')]['id']}},_0xc14ad={};_0xc14ad[_0x174a('0x42')]=_[_0x174a('0x3e')](db['SalesforceConfiguration'][_0x174a('0x53')]);_0xc14ad['query']=_[_0x174a('0x3e')](_0x2fa339[_0x174a('0x3d')]);_0xc14ad[_0x174a('0x3f')]=_[_0x174a('0x40')](_0xc14ad['model'],_0xc14ad[_0x174a('0x3d')]);_0x4b46e9['attributes']=_['intersection'](_0xc14ad[_0x174a('0x42')],qs['fields'](_0x2fa339['query'][_0x174a('0x43')]));_0x4b46e9[_0x174a('0x41')]=_0x4b46e9[_0x174a('0x41')][_0x174a('0x54')]?_0x4b46e9[_0x174a('0x41')]:_0xc14ad['model'];if(_0x2fa339[_0x174a('0x3d')]['includeAll']){_0x4b46e9[_0x174a('0x4f')]=[{'all':!![]}];}_0x4b46e9=_[_0x174a('0x49')]({},_0x4b46e9,_0x2fa339[_0x174a('0x4c')]);return db[_0x174a('0x3a')][_0x174a('0x55')](_0x4b46e9)['then'](handleEntityNotFound(_0x18d2ee,null))[_0x174a('0x1e')](respondWithResult(_0x18d2ee,null))['catch'](handleError(_0x18d2ee,null));};exports[_0x174a('0x56')]=function(_0x56ea01,_0x548746){return db['SalesforceConfiguration'][_0x174a('0x56')](_0x56ea01[_0x174a('0x57')],{})[_0x174a('0x1e')](respondWithResult(_0x548746,0xc9))[_0x174a('0x29')](handleError(_0x548746,null));};exports[_0x174a('0x58')]=function(_0x477244,_0x507aad){if(_0x477244[_0x174a('0x57')]['id']){delete _0x477244['body']['id'];}return db[_0x174a('0x3a')]['find']({'where':{'id':_0x477244[_0x174a('0x52')]['id']}})[_0x174a('0x1e')](handleEntityNotFound(_0x507aad,null))[_0x174a('0x1e')](saveUpdates(_0x477244[_0x174a('0x57')],null))[_0x174a('0x1e')](respondWithResult(_0x507aad,null))['catch'](handleError(_0x507aad,null));};exports['destroy']=function(_0x4e02fe,_0x4ff754){return db['SalesforceConfiguration']['find']({'where':{'id':_0x4e02fe['params']['id']}})[_0x174a('0x1e')](handleEntityNotFound(_0x4ff754,null))[_0x174a('0x1e')](removeEntity(_0x4ff754,null))['catch'](handleError(_0x4ff754,null));};exports[_0x174a('0x59')]=function(_0x176430,_0x3e3795,_0x279c1c){var _0x81ea88={};var _0x3d058d={};var _0x21d20d;var _0x39f308;return db[_0x174a('0x3a')]['findOne']({'where':{'id':_0x176430[_0x174a('0x52')]['id']}})[_0x174a('0x1e')](handleEntityNotFound(_0x3e3795,null))[_0x174a('0x1e')](function(_0x1147ac){if(_0x1147ac){_0x21d20d=_0x1147ac;_0x3d058d[_0x174a('0x42')]=_[_0x174a('0x3e')](db[_0x174a('0x5a')][_0x174a('0x53')]);_0x3d058d[_0x174a('0x3d')]=_[_0x174a('0x3e')](_0x176430[_0x174a('0x3d')]);_0x3d058d[_0x174a('0x3f')]=_[_0x174a('0x40')](_0x3d058d[_0x174a('0x42')],_0x3d058d[_0x174a('0x3d')]);_0x81ea88[_0x174a('0x41')]=_['intersection'](_0x3d058d[_0x174a('0x42')],qs[_0x174a('0x43')](_0x176430[_0x174a('0x3d')][_0x174a('0x43')]));_0x81ea88['attributes']=_0x81ea88[_0x174a('0x41')][_0x174a('0x54')]?_0x81ea88[_0x174a('0x41')]:_0x3d058d[_0x174a('0x42')];_0x81ea88[_0x174a('0x46')]=qs[_0x174a('0x47')](_0x176430['query'][_0x174a('0x47')]);_0x81ea88['where']=qs['filters'](_['pick'](_0x176430[_0x174a('0x3d')],_0x3d058d[_0x174a('0x3f')]));if(_0x176430[_0x174a('0x3d')][_0x174a('0x48')]){_0x81ea88[_0x174a('0x4a')]=_[_0x174a('0x49')](_0x81ea88[_0x174a('0x4a')],{'$or':_['map'](_0x81ea88['attributes'],function(_0x59d8ee){var _0x278b3b={};_0x278b3b[_0x59d8ee]={'$like':'%'+_0x176430['query'][_0x174a('0x48')]+'%'};return _0x278b3b;})});}_0x81ea88=_['merge']({},_0x81ea88,_0x176430[_0x174a('0x4c')]);return _0x21d20d[_0x174a('0x59')](_0x81ea88);}})[_0x174a('0x1e')](function(_0x255ea2){if(_0x255ea2){_0x39f308=_0x255ea2['length'];if(!_0x176430[_0x174a('0x3d')][_0x174a('0x44')](_0x174a('0x45'))){_0x81ea88[_0x174a('0x2e')]=qs[_0x174a('0x2e')](_0x176430[_0x174a('0x3d')][_0x174a('0x2e')]);_0x81ea88['offset']=qs[_0x174a('0x2d')](_0x176430[_0x174a('0x3d')][_0x174a('0x2d')]);}return _0x21d20d[_0x174a('0x59')](_0x81ea88);}})[_0x174a('0x1e')](function(_0x3aaed0){if(_0x3aaed0){return _0x3aaed0?{'count':_0x39f308,'rows':_0x3aaed0}:null;}})[_0x174a('0x1e')](respondWithResult(_0x3e3795,null))[_0x174a('0x29')](handleError(_0x3e3795,null));};exports[_0x174a('0x5b')]=function(_0x5a6c4f,_0x400759,_0x2cbe46){var _0xcf0fe4={};var _0x394df0={};var _0x1fb4e2;var _0x379f40;return db[_0x174a('0x3a')]['findOne']({'where':{'id':_0x5a6c4f[_0x174a('0x52')]['id']}})['then'](handleEntityNotFound(_0x400759,null))[_0x174a('0x1e')](function(_0x426e3c){if(_0x426e3c){_0x1fb4e2=_0x426e3c;_0x394df0[_0x174a('0x42')]=_['keys'](db['SalesforceField'][_0x174a('0x53')]);_0x394df0['query']=_[_0x174a('0x3e')](_0x5a6c4f[_0x174a('0x3d')]);_0x394df0[_0x174a('0x3f')]=_[_0x174a('0x40')](_0x394df0[_0x174a('0x42')],_0x394df0[_0x174a('0x3d')]);_0xcf0fe4['attributes']=_['intersection'](_0x394df0[_0x174a('0x42')],qs[_0x174a('0x43')](_0x5a6c4f[_0x174a('0x3d')]['fields']));_0xcf0fe4[_0x174a('0x41')]=_0xcf0fe4[_0x174a('0x41')][_0x174a('0x54')]?_0xcf0fe4[_0x174a('0x41')]:_0x394df0[_0x174a('0x42')];_0xcf0fe4[_0x174a('0x46')]=qs['sort'](_0x5a6c4f[_0x174a('0x3d')][_0x174a('0x47')]);_0xcf0fe4[_0x174a('0x4a')]=qs['filters'](_[_0x174a('0x5c')](_0x5a6c4f[_0x174a('0x3d')],_0x394df0[_0x174a('0x3f')]));if(_0x5a6c4f[_0x174a('0x3d')][_0x174a('0x48')]){_0xcf0fe4[_0x174a('0x4a')]=_['merge'](_0xcf0fe4[_0x174a('0x4a')],{'$or':_[_0x174a('0x39')](_0xcf0fe4[_0x174a('0x41')],function(_0x58e982){var _0x4795da={};_0x4795da[_0x58e982]={'$like':'%'+_0x5a6c4f[_0x174a('0x3d')][_0x174a('0x48')]+'%'};return _0x4795da;})});}_0xcf0fe4=_[_0x174a('0x49')]({},_0xcf0fe4,_0x5a6c4f[_0x174a('0x4c')]);return _0x1fb4e2[_0x174a('0x5b')](_0xcf0fe4);}})[_0x174a('0x1e')](function(_0x4bb910){if(_0x4bb910){_0x379f40=_0x4bb910[_0x174a('0x54')];if(!_0x5a6c4f[_0x174a('0x3d')][_0x174a('0x44')](_0x174a('0x45'))){_0xcf0fe4['limit']=qs[_0x174a('0x2e')](_0x5a6c4f[_0x174a('0x3d')][_0x174a('0x2e')]);_0xcf0fe4[_0x174a('0x2d')]=qs['offset'](_0x5a6c4f['query'][_0x174a('0x2d')]);}return _0x1fb4e2[_0x174a('0x5b')](_0xcf0fe4);}})['then'](function(_0x5efd60){if(_0x5efd60){return _0x5efd60?{'count':_0x379f40,'rows':_0x5efd60}:null;}})[_0x174a('0x1e')](respondWithResult(_0x400759,null))[_0x174a('0x29')](handleError(_0x400759,null));};exports[_0x174a('0x5d')]=function(_0x179b3d,_0x4090b4,_0x371b01){var _0x18f51a={};var _0x587d71={};var _0x55408f;var _0x9158e;return db[_0x174a('0x3a')]['findOne']({'where':{'id':_0x179b3d[_0x174a('0x52')]['id']}})[_0x174a('0x1e')](handleEntityNotFound(_0x4090b4,null))[_0x174a('0x1e')](function(_0x3b468){if(_0x3b468){_0x55408f=_0x3b468;_0x587d71[_0x174a('0x42')]=_[_0x174a('0x3e')](db[_0x174a('0x5a')]['rawAttributes']);_0x587d71[_0x174a('0x3d')]=_[_0x174a('0x3e')](_0x179b3d[_0x174a('0x3d')]);_0x587d71[_0x174a('0x3f')]=_['intersection'](_0x587d71[_0x174a('0x42')],_0x587d71[_0x174a('0x3d')]);_0x18f51a[_0x174a('0x41')]=_[_0x174a('0x40')](_0x587d71[_0x174a('0x42')],qs[_0x174a('0x43')](_0x179b3d[_0x174a('0x3d')][_0x174a('0x43')]));_0x18f51a[_0x174a('0x41')]=_0x18f51a[_0x174a('0x41')][_0x174a('0x54')]?_0x18f51a['attributes']:_0x587d71[_0x174a('0x42')];_0x18f51a[_0x174a('0x46')]=qs['sort'](_0x179b3d[_0x174a('0x3d')]['sort']);_0x18f51a['where']=qs['filters'](_[_0x174a('0x5c')](_0x179b3d[_0x174a('0x3d')],_0x587d71[_0x174a('0x3f')]));if(_0x179b3d[_0x174a('0x3d')][_0x174a('0x48')]){_0x18f51a[_0x174a('0x4a')]=_[_0x174a('0x49')](_0x18f51a[_0x174a('0x4a')],{'$or':_['map'](_0x18f51a[_0x174a('0x41')],function(_0x20eab2){var _0x4c3706={};_0x4c3706[_0x20eab2]={'$like':'%'+_0x179b3d['query'][_0x174a('0x48')]+'%'};return _0x4c3706;})});}_0x18f51a=_[_0x174a('0x49')]({},_0x18f51a,_0x179b3d[_0x174a('0x4c')]);return _0x55408f[_0x174a('0x5d')](_0x18f51a);}})[_0x174a('0x1e')](function(_0x5a67e3){if(_0x5a67e3){_0x9158e=_0x5a67e3[_0x174a('0x54')];if(!_0x179b3d['query'][_0x174a('0x44')]('nolimit')){_0x18f51a[_0x174a('0x2e')]=qs[_0x174a('0x2e')](_0x179b3d[_0x174a('0x3d')][_0x174a('0x2e')]);_0x18f51a[_0x174a('0x2d')]=qs[_0x174a('0x2d')](_0x179b3d['query'][_0x174a('0x2d')]);}return _0x55408f[_0x174a('0x5d')](_0x18f51a);}})['then'](function(_0x19c335){if(_0x19c335){return _0x19c335?{'count':_0x9158e,'rows':_0x19c335}:null;}})['then'](respondWithResult(_0x4090b4,null))['catch'](handleError(_0x4090b4,null));}; \ No newline at end of file +var _0x62c3=['options','includeAll','include','findAll','rows','catch','params','intersection','create','body','find','getFields','findOne','filters','nolimit','getSubjects','SalesforceField','getDescriptions','order','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','keys','attributes','model','fields','length','hasOwnProperty','limit','sort','pick','merge','where','VIRTUAL','filter'];(function(_0x4f0a4d,_0x283462){var _0x220db0=function(_0x19c5f2){while(--_0x19c5f2){_0x4f0a4d['push'](_0x4f0a4d['shift']());}};_0x220db0(++_0x283462);}(_0x62c3,0x177));var _0x362c=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x62c3[_0x187279];return _0x3da59d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x362c('0x0'));var rimraf=require(_0x362c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x362c('0x2'));var moment=require(_0x362c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x362c('0x4'));var util=require('util');var path=require(_0x362c('0x5'));var sox=require(_0x362c('0x6'));var csv=require(_0x362c('0x7'));var ejs=require(_0x362c('0x8'));var fs=require('fs');var _=require(_0x362c('0x9'));var squel=require(_0x362c('0xa'));var crypto=require(_0x362c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x362c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x362c('0xd'));var Papa=require('papaparse');var Redis=require(_0x362c('0xe'));var authService=require(_0x362c('0xf'));var qs=require(_0x362c('0x10'));var as=require(_0x362c('0x11'));var hardwareService=require(_0x362c('0x12'));var logger=require(_0x362c('0x13'))(_0x362c('0x14'));var utils=require(_0x362c('0x15'));var config=require(_0x362c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x362c('0x17'))['db'];var jayson=require(_0x362c('0x18'));var client=jayson[_0x362c('0x19')][_0x362c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1b9468,_0x30c47a,_0x3ce656,_0x220bf6){return new BPromise(function(_0x266d18,_0x1ff87f){var _0xaba032=_0x220bf6||client;return _0xaba032[_0x362c('0x1b')](_0x1b9468,_0x3ce656)['then'](function(_0x1084c8){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x30c47a,_0x362c('0x1c'));logger[_0x362c('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x30c47a,'request\x20sent',JSON['stringify'](_0x1084c8));if(_0x1084c8[_0x362c('0x1e')]){if(_0x1084c8[_0x362c('0x1e')][_0x362c('0x1f')]===0x1f4){logger['error'](_0x362c('0x20'),_0x30c47a,_0x1084c8[_0x362c('0x1e')][_0x362c('0x21')]);return _0x1ff87f(_0x1084c8['error']['message']);}logger[_0x362c('0x1e')](_0x362c('0x20'),_0x30c47a,_0x1084c8[_0x362c('0x1e')]['message']);return _0x266d18(_0x1084c8[_0x362c('0x1e')]['message']);}else{logger[_0x362c('0x22')](_0x362c('0x20'),_0x30c47a,_0x362c('0x1c'));_0x266d18(_0x1084c8[_0x362c('0x23')]['message']);}})['catch'](function(_0xf172eb){logger[_0x362c('0x1e')](_0x362c('0x20'),_0x30c47a,_0xf172eb);_0x1ff87f(_0xf172eb);});});}function respondWithStatusCode(_0x23a513,_0xbaa561){_0xbaa561=_0xbaa561||0xcc;return function(_0x34e624){if(_0x34e624){return _0x23a513[_0x362c('0x24')](_0xbaa561);}return _0x23a513[_0x362c('0x25')](_0xbaa561)[_0x362c('0x26')]();};}function respondWithResult(_0x50829b,_0x26e4a4){_0x26e4a4=_0x26e4a4||0xc8;return function(_0x4d1752){if(_0x4d1752){return _0x50829b[_0x362c('0x25')](_0x26e4a4)['json'](_0x4d1752);}};}function respondWithFilteredResult(_0x1f1d53,_0x4b0b55){return function(_0x47eacf){if(_0x47eacf){var _0x412e81=_0x47eacf[_0x362c('0x27')],_0xa57a20=_0x4b0b55[_0x362c('0x28')],_0x55d3e2=_0x4b0b55[_0x362c('0x28')]+_0x4b0b55['limit'],_0x58f6f6;if(_0x55d3e2>=_0x412e81){_0x55d3e2=_0x412e81;_0x58f6f6=0xc8;}else{_0x58f6f6=0xce;}_0x1f1d53[_0x362c('0x25')](_0x58f6f6);return _0x1f1d53[_0x362c('0x29')]('Content-Range',_0xa57a20+'-'+_0x55d3e2+'/'+_0x412e81)[_0x362c('0x2a')](_0x47eacf);}return null;};}function patchUpdates(_0x1d6b0c){return function(_0x20b889){try{jsonpatch[_0x362c('0x2b')](_0x20b889,_0x1d6b0c,!![]);}catch(_0x1630a1){return BPromise[_0x362c('0x2c')](_0x1630a1);}return _0x20b889[_0x362c('0x2d')]();};}function saveUpdates(_0x38d81b,_0x3ff15b){return function(_0x39e48e){if(_0x39e48e){return _0x39e48e[_0x362c('0x2e')](_0x38d81b)[_0x362c('0x2f')](function(_0x27aa8e){return _0x27aa8e;});}return null;};}function removeEntity(_0x952f11,_0x289cc6){return function(_0x4a3fab){if(_0x4a3fab){return _0x4a3fab[_0x362c('0x30')]()['then'](function(){_0x952f11[_0x362c('0x25')](0xcc)[_0x362c('0x26')]();});}};}function handleEntityNotFound(_0x378f9e,_0x202494){return function(_0x1df47d){if(!_0x1df47d){_0x378f9e['sendStatus'](0x194);}return _0x1df47d;};}function handleError(_0x3e5167,_0x5bc3ee){_0x5bc3ee=_0x5bc3ee||0x1f4;return function(_0x15dab5){logger['error'](_0x15dab5['stack']);if(_0x15dab5[_0x362c('0x31')]){delete _0x15dab5[_0x362c('0x31')];}_0x3e5167[_0x362c('0x25')](_0x5bc3ee)['send'](_0x15dab5);};}exports[_0x362c('0x32')]=function(_0x2f0126,_0x639218){var _0x5627aa={},_0x3b6e84={},_0x442174={'count':0x0,'rows':[]};var _0x496937=_[_0x362c('0x33')](db[_0x362c('0x34')][_0x362c('0x35')],function(_0x24b499){return{'name':_0x24b499[_0x362c('0x36')],'type':_0x24b499[_0x362c('0x37')]['key']};});_0x3b6e84['model']=_['map'](_0x496937,_0x362c('0x31'));_0x3b6e84[_0x362c('0x38')]=_[_0x362c('0x39')](_0x2f0126[_0x362c('0x38')]);_0x3b6e84['filters']=_['intersection'](_0x3b6e84['model'],_0x3b6e84[_0x362c('0x38')]);_0x5627aa[_0x362c('0x3a')]=_['intersection'](_0x3b6e84[_0x362c('0x3b')],qs[_0x362c('0x3c')](_0x2f0126[_0x362c('0x38')][_0x362c('0x3c')]));_0x5627aa['attributes']=_0x5627aa[_0x362c('0x3a')][_0x362c('0x3d')]?_0x5627aa['attributes']:_0x3b6e84[_0x362c('0x3b')];if(!_0x2f0126['query'][_0x362c('0x3e')]('nolimit')){_0x5627aa[_0x362c('0x3f')]=qs[_0x362c('0x3f')](_0x2f0126['query'][_0x362c('0x3f')]);_0x5627aa[_0x362c('0x28')]=qs[_0x362c('0x28')](_0x2f0126[_0x362c('0x38')][_0x362c('0x28')]);}_0x5627aa['order']=qs['sort'](_0x2f0126[_0x362c('0x38')][_0x362c('0x40')]);_0x5627aa['where']=qs['filters'](_[_0x362c('0x41')](_0x2f0126[_0x362c('0x38')],_0x3b6e84['filters']),_0x496937);if(_0x2f0126[_0x362c('0x38')]['filter']){_0x5627aa['where']=_[_0x362c('0x42')](_0x5627aa[_0x362c('0x43')],{'$or':_[_0x362c('0x33')](_0x496937,function(_0x45ad1c){if(_0x45ad1c['type']!==_0x362c('0x44')){var _0x55ab9e={};_0x55ab9e[_0x45ad1c[_0x362c('0x31')]]={'$like':'%'+_0x2f0126[_0x362c('0x38')][_0x362c('0x45')]+'%'};return _0x55ab9e;}})});}_0x5627aa=_[_0x362c('0x42')]({},_0x5627aa,_0x2f0126[_0x362c('0x46')]);var _0x5abb53={'where':_0x5627aa[_0x362c('0x43')]};return db[_0x362c('0x34')]['count'](_0x5abb53)[_0x362c('0x2f')](function(_0x331a3e){_0x442174[_0x362c('0x27')]=_0x331a3e;if(_0x2f0126['query'][_0x362c('0x47')]){_0x5627aa[_0x362c('0x48')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x362c('0x49')](_0x5627aa);})[_0x362c('0x2f')](function(_0x4d30a7){_0x442174[_0x362c('0x4a')]=_0x4d30a7;return _0x442174;})[_0x362c('0x2f')](respondWithFilteredResult(_0x639218,_0x5627aa))[_0x362c('0x4b')](handleError(_0x639218,null));};exports['show']=function(_0x3f25ca,_0x1aa741){var _0x16e044={'raw':![],'where':{'id':_0x3f25ca[_0x362c('0x4c')]['id']}},_0x4948db={};_0x4948db['model']=_[_0x362c('0x39')](db[_0x362c('0x34')][_0x362c('0x35')]);_0x4948db[_0x362c('0x38')]=_['keys'](_0x3f25ca['query']);_0x4948db['filters']=_[_0x362c('0x4d')](_0x4948db[_0x362c('0x3b')],_0x4948db['query']);_0x16e044[_0x362c('0x3a')]=_[_0x362c('0x4d')](_0x4948db['model'],qs[_0x362c('0x3c')](_0x3f25ca['query'][_0x362c('0x3c')]));_0x16e044[_0x362c('0x3a')]=_0x16e044[_0x362c('0x3a')][_0x362c('0x3d')]?_0x16e044[_0x362c('0x3a')]:_0x4948db[_0x362c('0x3b')];if(_0x3f25ca[_0x362c('0x38')][_0x362c('0x47')]){_0x16e044['include']=[{'all':!![]}];}_0x16e044=_[_0x362c('0x42')]({},_0x16e044,_0x3f25ca['options']);return db[_0x362c('0x34')]['find'](_0x16e044)[_0x362c('0x2f')](handleEntityNotFound(_0x1aa741,null))[_0x362c('0x2f')](respondWithResult(_0x1aa741,null))['catch'](handleError(_0x1aa741,null));};exports['create']=function(_0x1aae64,_0x53ec8a){return db[_0x362c('0x34')][_0x362c('0x4e')](_0x1aae64[_0x362c('0x4f')],{})[_0x362c('0x2f')](respondWithResult(_0x53ec8a,0xc9))[_0x362c('0x4b')](handleError(_0x53ec8a,null));};exports[_0x362c('0x2e')]=function(_0x33fd5f,_0x121cd6){if(_0x33fd5f[_0x362c('0x4f')]['id']){delete _0x33fd5f['body']['id'];}return db[_0x362c('0x34')][_0x362c('0x50')]({'where':{'id':_0x33fd5f[_0x362c('0x4c')]['id']}})[_0x362c('0x2f')](handleEntityNotFound(_0x121cd6,null))[_0x362c('0x2f')](saveUpdates(_0x33fd5f['body'],null))[_0x362c('0x2f')](respondWithResult(_0x121cd6,null))[_0x362c('0x4b')](handleError(_0x121cd6,null));};exports[_0x362c('0x30')]=function(_0x434e56,_0xd3f2d2){return db[_0x362c('0x34')][_0x362c('0x50')]({'where':{'id':_0x434e56['params']['id']}})[_0x362c('0x2f')](handleEntityNotFound(_0xd3f2d2,null))['then'](removeEntity(_0xd3f2d2,null))[_0x362c('0x4b')](handleError(_0xd3f2d2,null));};exports[_0x362c('0x51')]=function(_0xd86f39,_0x2fece2,_0x1e32f3){var _0x45c350={};var _0x38c06b={};var _0x418a49;var _0x532826;return db[_0x362c('0x34')][_0x362c('0x52')]({'where':{'id':_0xd86f39[_0x362c('0x4c')]['id']}})[_0x362c('0x2f')](handleEntityNotFound(_0x2fece2,null))[_0x362c('0x2f')](function(_0x3b6a1b){if(_0x3b6a1b){_0x418a49=_0x3b6a1b;_0x38c06b['model']=_[_0x362c('0x39')](db['SalesforceField']['rawAttributes']);_0x38c06b[_0x362c('0x38')]=_[_0x362c('0x39')](_0xd86f39[_0x362c('0x38')]);_0x38c06b['filters']=_[_0x362c('0x4d')](_0x38c06b[_0x362c('0x3b')],_0x38c06b[_0x362c('0x38')]);_0x45c350[_0x362c('0x3a')]=_[_0x362c('0x4d')](_0x38c06b[_0x362c('0x3b')],qs[_0x362c('0x3c')](_0xd86f39[_0x362c('0x38')][_0x362c('0x3c')]));_0x45c350[_0x362c('0x3a')]=_0x45c350[_0x362c('0x3a')][_0x362c('0x3d')]?_0x45c350['attributes']:_0x38c06b[_0x362c('0x3b')];_0x45c350['order']=qs[_0x362c('0x40')](_0xd86f39[_0x362c('0x38')]['sort']);_0x45c350[_0x362c('0x43')]=qs[_0x362c('0x53')](_[_0x362c('0x41')](_0xd86f39[_0x362c('0x38')],_0x38c06b[_0x362c('0x53')]));if(_0xd86f39[_0x362c('0x38')][_0x362c('0x45')]){_0x45c350[_0x362c('0x43')]=_[_0x362c('0x42')](_0x45c350[_0x362c('0x43')],{'$or':_[_0x362c('0x33')](_0x45c350[_0x362c('0x3a')],function(_0x138464){var _0x3d3a0b={};_0x3d3a0b[_0x138464]={'$like':'%'+_0xd86f39[_0x362c('0x38')]['filter']+'%'};return _0x3d3a0b;})});}_0x45c350=_[_0x362c('0x42')]({},_0x45c350,_0xd86f39[_0x362c('0x46')]);return _0x418a49['getFields'](_0x45c350);}})[_0x362c('0x2f')](function(_0xa99772){if(_0xa99772){_0x532826=_0xa99772['length'];if(!_0xd86f39['query'][_0x362c('0x3e')](_0x362c('0x54'))){_0x45c350[_0x362c('0x3f')]=qs[_0x362c('0x3f')](_0xd86f39['query'][_0x362c('0x3f')]);_0x45c350['offset']=qs[_0x362c('0x28')](_0xd86f39[_0x362c('0x38')][_0x362c('0x28')]);}return _0x418a49[_0x362c('0x51')](_0x45c350);}})[_0x362c('0x2f')](function(_0xae511f){if(_0xae511f){return _0xae511f?{'count':_0x532826,'rows':_0xae511f}:null;}})[_0x362c('0x2f')](respondWithResult(_0x2fece2,null))[_0x362c('0x4b')](handleError(_0x2fece2,null));};exports[_0x362c('0x55')]=function(_0x13c64d,_0x387312,_0x5c45d1){var _0xecb242={};var _0x352779={};var _0x21cf76;var _0x432339;return db[_0x362c('0x34')][_0x362c('0x52')]({'where':{'id':_0x13c64d[_0x362c('0x4c')]['id']}})[_0x362c('0x2f')](handleEntityNotFound(_0x387312,null))['then'](function(_0x1d711d){if(_0x1d711d){_0x21cf76=_0x1d711d;_0x352779['model']=_[_0x362c('0x39')](db[_0x362c('0x56')][_0x362c('0x35')]);_0x352779[_0x362c('0x38')]=_['keys'](_0x13c64d[_0x362c('0x38')]);_0x352779[_0x362c('0x53')]=_['intersection'](_0x352779['model'],_0x352779[_0x362c('0x38')]);_0xecb242[_0x362c('0x3a')]=_[_0x362c('0x4d')](_0x352779[_0x362c('0x3b')],qs['fields'](_0x13c64d['query']['fields']));_0xecb242['attributes']=_0xecb242['attributes'][_0x362c('0x3d')]?_0xecb242[_0x362c('0x3a')]:_0x352779[_0x362c('0x3b')];_0xecb242['order']=qs[_0x362c('0x40')](_0x13c64d[_0x362c('0x38')][_0x362c('0x40')]);_0xecb242[_0x362c('0x43')]=qs[_0x362c('0x53')](_[_0x362c('0x41')](_0x13c64d[_0x362c('0x38')],_0x352779['filters']));if(_0x13c64d[_0x362c('0x38')][_0x362c('0x45')]){_0xecb242['where']=_[_0x362c('0x42')](_0xecb242[_0x362c('0x43')],{'$or':_[_0x362c('0x33')](_0xecb242[_0x362c('0x3a')],function(_0x3dafcd){var _0x5e6ce7={};_0x5e6ce7[_0x3dafcd]={'$like':'%'+_0x13c64d['query'][_0x362c('0x45')]+'%'};return _0x5e6ce7;})});}_0xecb242=_[_0x362c('0x42')]({},_0xecb242,_0x13c64d[_0x362c('0x46')]);return _0x21cf76[_0x362c('0x55')](_0xecb242);}})[_0x362c('0x2f')](function(_0x4284f5){if(_0x4284f5){_0x432339=_0x4284f5[_0x362c('0x3d')];if(!_0x13c64d[_0x362c('0x38')][_0x362c('0x3e')](_0x362c('0x54'))){_0xecb242[_0x362c('0x3f')]=qs['limit'](_0x13c64d[_0x362c('0x38')]['limit']);_0xecb242['offset']=qs[_0x362c('0x28')](_0x13c64d[_0x362c('0x38')]['offset']);}return _0x21cf76[_0x362c('0x55')](_0xecb242);}})[_0x362c('0x2f')](function(_0xa275b7){if(_0xa275b7){return _0xa275b7?{'count':_0x432339,'rows':_0xa275b7}:null;}})[_0x362c('0x2f')](respondWithResult(_0x387312,null))[_0x362c('0x4b')](handleError(_0x387312,null));};exports[_0x362c('0x57')]=function(_0x46e893,_0x398cef,_0x110a19){var _0x122d61={};var _0x54f7d4={};var _0x503fc4;var _0x4c311c;return db[_0x362c('0x34')][_0x362c('0x52')]({'where':{'id':_0x46e893[_0x362c('0x4c')]['id']}})[_0x362c('0x2f')](handleEntityNotFound(_0x398cef,null))[_0x362c('0x2f')](function(_0x267ae8){if(_0x267ae8){_0x503fc4=_0x267ae8;_0x54f7d4[_0x362c('0x3b')]=_[_0x362c('0x39')](db[_0x362c('0x56')][_0x362c('0x35')]);_0x54f7d4[_0x362c('0x38')]=_[_0x362c('0x39')](_0x46e893[_0x362c('0x38')]);_0x54f7d4[_0x362c('0x53')]=_[_0x362c('0x4d')](_0x54f7d4['model'],_0x54f7d4[_0x362c('0x38')]);_0x122d61[_0x362c('0x3a')]=_[_0x362c('0x4d')](_0x54f7d4[_0x362c('0x3b')],qs[_0x362c('0x3c')](_0x46e893[_0x362c('0x38')][_0x362c('0x3c')]));_0x122d61[_0x362c('0x3a')]=_0x122d61[_0x362c('0x3a')][_0x362c('0x3d')]?_0x122d61[_0x362c('0x3a')]:_0x54f7d4[_0x362c('0x3b')];_0x122d61[_0x362c('0x58')]=qs[_0x362c('0x40')](_0x46e893[_0x362c('0x38')][_0x362c('0x40')]);_0x122d61['where']=qs[_0x362c('0x53')](_[_0x362c('0x41')](_0x46e893[_0x362c('0x38')],_0x54f7d4[_0x362c('0x53')]));if(_0x46e893[_0x362c('0x38')][_0x362c('0x45')]){_0x122d61[_0x362c('0x43')]=_['merge'](_0x122d61['where'],{'$or':_[_0x362c('0x33')](_0x122d61[_0x362c('0x3a')],function(_0xfd9d8){var _0x9f3ed2={};_0x9f3ed2[_0xfd9d8]={'$like':'%'+_0x46e893['query'][_0x362c('0x45')]+'%'};return _0x9f3ed2;})});}_0x122d61=_[_0x362c('0x42')]({},_0x122d61,_0x46e893[_0x362c('0x46')]);return _0x503fc4[_0x362c('0x57')](_0x122d61);}})[_0x362c('0x2f')](function(_0x2d63b8){if(_0x2d63b8){_0x4c311c=_0x2d63b8[_0x362c('0x3d')];if(!_0x46e893[_0x362c('0x38')][_0x362c('0x3e')](_0x362c('0x54'))){_0x122d61[_0x362c('0x3f')]=qs[_0x362c('0x3f')](_0x46e893[_0x362c('0x38')]['limit']);_0x122d61[_0x362c('0x28')]=qs[_0x362c('0x28')](_0x46e893[_0x362c('0x38')][_0x362c('0x28')]);}return _0x503fc4[_0x362c('0x57')](_0x122d61);}})[_0x362c('0x2f')](function(_0x40b652){if(_0x40b652){return _0x40b652?{'count':_0x4c311c,'rows':_0x40b652}:null;}})['then'](respondWithResult(_0x398cef,null))['catch'](handleError(_0x398cef,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 53cf5a7..bf84dce 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 _0xbaba=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util'];(function(_0x4d0fde,_0x3bd3fc){var _0x2a0c2f=function(_0x484374){while(--_0x484374){_0x4d0fde['push'](_0x4d0fde['shift']());}};_0x2a0c2f(++_0x3bd3fc);}(_0xbaba,0xa7));var _0xabab=function(_0x31726b,_0x2789b6){_0x31726b=_0x31726b-0x0;var _0x35a1a4=_0xbaba[_0x31726b];return _0x35a1a4;};'use strict';var _=require('lodash');var util=require(_0xabab('0x0'));var logger=require('../../config/logger')(_0xabab('0x1'));var moment=require('moment');var BPromise=require(_0xabab('0x2'));var rp=require(_0xabab('0x3'));var fs=require('fs');var path=require(_0xabab('0x4'));var rimraf=require(_0xabab('0x5'));var config=require(_0xabab('0x6'));var attributes=require(_0xabab('0x7'));module[_0xabab('0x8')]=function(_0x19928c,_0x548bcf){return _0x19928c[_0xabab('0x9')](_0xabab('0xa'),attributes,{'tableName':_0xabab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d56=['../../config/logger','moment','bluebird','request-promise','path','exports','define','int_salesforce_configurations','lodash','util'];(function(_0xa0eba8,_0x3b4239){var _0x509622=function(_0x492fa8){while(--_0x492fa8){_0xa0eba8['push'](_0xa0eba8['shift']());}};_0x509622(++_0x3b4239);}(_0x2d56,0x198));var _0x62d5=function(_0x1f4dba,_0x183c4b){_0x1f4dba=_0x1f4dba-0x0;var _0x1699cd=_0x2d56[_0x1f4dba];return _0x1699cd;};'use strict';var _=require(_0x62d5('0x0'));var util=require(_0x62d5('0x1'));var logger=require(_0x62d5('0x2'))('api');var moment=require(_0x62d5('0x3'));var BPromise=require(_0x62d5('0x4'));var rp=require(_0x62d5('0x5'));var fs=require('fs');var path=require(_0x62d5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x62d5('0x7')]=function(_0x5cb4e1,_0x26e7bf){return _0x5cb4e1[_0x62d5('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x62d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 917ef0b..137628a 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 _0x5505=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4520d8,_0x1979c2){var _0x58de9a=function(_0x45f2d0){while(--_0x45f2d0){_0x4520d8['push'](_0x4520d8['shift']());}};_0x58de9a(++_0x1979c2);}(_0x5505,0x145));var _0x5550=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5505[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x5550('0x0'));var util=require(_0x5550('0x1'));var moment=require(_0x5550('0x2'));var BPromise=require(_0x5550('0x3'));var rs=require(_0x5550('0x4'));var fs=require('fs');var Redis=require(_0x5550('0x5'));var db=require(_0x5550('0x6'))['db'];var utils=require(_0x5550('0x7'));var logger=require(_0x5550('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5550('0x9'));var client=jayson[_0x5550('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45a6eb,_0x1e53ce,_0x298281){return new BPromise(function(_0x16e5c3,_0x39b93e){return client[_0x5550('0xb')](_0x45a6eb,_0x298281)[_0x5550('0xc')](function(_0x2c9379){logger['info'](_0x5550('0xd'),_0x1e53ce,_0x5550('0xe'));logger[_0x5550('0xf')](_0x5550('0x10'),_0x1e53ce,_0x5550('0xe'),JSON['stringify'](_0x2c9379));if(_0x2c9379[_0x5550('0x11')]){if(_0x2c9379[_0x5550('0x11')][_0x5550('0x12')]===0x1f4){logger[_0x5550('0x11')](_0x5550('0xd'),_0x1e53ce,_0x2c9379[_0x5550('0x11')][_0x5550('0x13')]);return _0x39b93e(_0x2c9379['error'][_0x5550('0x13')]);}logger[_0x5550('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1e53ce,_0x2c9379[_0x5550('0x11')]['message']);return _0x16e5c3(_0x2c9379[_0x5550('0x11')][_0x5550('0x13')]);}else{logger[_0x5550('0x14')](_0x5550('0xd'),_0x1e53ce,_0x5550('0xe'));_0x16e5c3(_0x2c9379[_0x5550('0x15')]['message']);}})[_0x5550('0x16')](function(_0x149677){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1e53ce,_0x149677);_0x39b93e(_0x149677);});});} \ No newline at end of file +var _0xb8b3=['jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xb8b3,0xfd));var _0x3b8b=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xb8b3[_0x310a1b];return _0xdea206;};'use strict';var _=require('lodash');var util=require(_0x3b8b('0x0'));var moment=require(_0x3b8b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b8b('0x2'))['db'];var utils=require(_0x3b8b('0x3'));var logger=require(_0x3b8b('0x4'))(_0x3b8b('0x5'));var config=require(_0x3b8b('0x6'));var jayson=require(_0x3b8b('0x7'));var client=jayson['client'][_0x3b8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38b7b6,_0x270a86,_0x4b5326){return new BPromise(function(_0xd0453d,_0x597cc0){return client[_0x3b8b('0x9')](_0x38b7b6,_0x4b5326)[_0x3b8b('0xa')](function(_0x2ec045){logger[_0x3b8b('0xb')](_0x3b8b('0xc'),_0x270a86,_0x3b8b('0xd'));logger[_0x3b8b('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x270a86,'request\x20sent',JSON[_0x3b8b('0xf')](_0x2ec045));if(_0x2ec045[_0x3b8b('0x10')]){if(_0x2ec045[_0x3b8b('0x10')][_0x3b8b('0x11')]===0x1f4){logger[_0x3b8b('0x10')](_0x3b8b('0xc'),_0x270a86,_0x2ec045[_0x3b8b('0x10')]['message']);return _0x597cc0(_0x2ec045['error'][_0x3b8b('0x12')]);}logger[_0x3b8b('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x270a86,_0x2ec045[_0x3b8b('0x10')][_0x3b8b('0x12')]);return _0xd0453d(_0x2ec045[_0x3b8b('0x10')][_0x3b8b('0x12')]);}else{logger['info'](_0x3b8b('0xc'),_0x270a86,_0x3b8b('0xd'));_0xd0453d(_0x2ec045[_0x3b8b('0x13')][_0x3b8b('0x12')]);}})['catch'](function(_0x5c1f4e){logger[_0x3b8b('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x270a86,_0x5c1f4e);_0x597cc0(_0x5c1f4e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index acd8d6f..89245aa 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 _0x5075=['express','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0xd1cf23,_0x58de24){var _0xc38cf0=function(_0x47a34d){while(--_0x47a34d){_0xd1cf23['push'](_0xd1cf23['shift']());}};_0xc38cf0(++_0x58de24);}(_0x5075,0x73));var _0x5507=function(_0x5ee907,_0x27e587){_0x5ee907=_0x5ee907-0x0;var _0x2cba70=_0x5075[_0x5ee907];return _0x2cba70;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var auth=require(_0x5507('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5507('0x7'));var controller=require(_0x5507('0x8'));router[_0x5507('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5507('0x9')](_0x5507('0xa'),auth['isAuthenticated'](),controller[_0x5507('0xb')]);router[_0x5507('0xc')]('/',auth[_0x5507('0xd')](),controller['create']);router['put'](_0x5507('0xa'),auth[_0x5507('0xd')](),controller[_0x5507('0xe')]);router[_0x5507('0xf')]('/:id',auth[_0x5507('0xd')](),controller[_0x5507('0x10')]);module['exports']=router; \ No newline at end of file +var _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','index','get','/:id','post','isAuthenticated','create','put'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x11e5,0x8b));var _0x511e=function(_0x1a32fe,_0xdab6ac){_0x1a32fe=_0x1a32fe-0x0;var _0x1abca6=_0x11e5[_0x1a32fe];return _0x1abca6;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var auth=require(_0x511e('0x4'));var interaction=require(_0x511e('0x5'));var config=require('../../config/environment');var controller=require(_0x511e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x511e('0x7')]);router[_0x511e('0x8')](_0x511e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x511e('0xa')]('/',auth[_0x511e('0xb')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0x9'),auth[_0x511e('0xb')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0x9'),auth[_0x511e('0xb')](),controller[_0x511e('0x10')]);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 ae5e4fe..ea83ae5 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 _0xf409=['string','variable','STRING','customVariable','exports','ENUM'];(function(_0x45d350,_0x3e7b4c){var _0x1fe4d4=function(_0x5640d6){while(--_0x5640d6){_0x45d350['push'](_0x45d350['shift']());}};_0x1fe4d4(++_0x3e7b4c);}(_0xf409,0xb8));var _0x9f40=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf409[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x9f40('0x0')]={'type':{'type':Sequelize[_0x9f40('0x1')](_0x9f40('0x2'),_0x9f40('0x3'),'customVariable','keyValue'),'defaultValue':_0x9f40('0x2')},'content':{'type':Sequelize[_0x9f40('0x4')]},'key':{'type':Sequelize[_0x9f40('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x9f40('0x2'),'variable',_0x9f40('0x5'))},'keyContent':{'type':Sequelize[_0x9f40('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9f40('0x4')]}}; \ No newline at end of file +var _0x0e85=['customVariable','keyValue','STRING','exports','ENUM','string','variable'];(function(_0x32a328,_0x3456c0){var _0x272e7b=function(_0x59147b){while(--_0x59147b){_0x32a328['push'](_0x32a328['shift']());}};_0x272e7b(++_0x3456c0);}(_0x0e85,0x96));var _0x50e8=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x0e85[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require('sequelize');module[_0x50e8('0x0')]={'type':{'type':Sequelize[_0x50e8('0x1')](_0x50e8('0x2'),_0x50e8('0x3'),_0x50e8('0x4'),_0x50e8('0x5')),'defaultValue':_0x50e8('0x2')},'content':{'type':Sequelize[_0x50e8('0x6')]},'key':{'type':Sequelize[_0x50e8('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x50e8('0x2'),_0x50e8('0x3'),_0x50e8('0x4'))},'keyContent':{'type':Sequelize[_0x50e8('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 68a18ed..2de0a0f 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 _0x1548=['length','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1548,0x1c2));var _0x8154=function(_0x20c8ef,_0x77211a){_0x20c8ef=_0x20c8ef-0x0;var _0x4de872=_0x1548[_0x20c8ef];return _0x4de872;};'use strict';var pdf=require(_0x8154('0x0'));var emlformat=require(_0x8154('0x1'));var rimraf=require(_0x8154('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8154('0x3'));var rp=require(_0x8154('0x4'));var moment=require(_0x8154('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8154('0x6'));var util=require(_0x8154('0x7'));var path=require(_0x8154('0x8'));var sox=require('sox');var csv=require(_0x8154('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8154('0xa'));var squel=require(_0x8154('0xb'));var crypto=require(_0x8154('0xc'));var jsforce=require(_0x8154('0xd'));var deskjs=require(_0x8154('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8154('0xf'));var Papa=require(_0x8154('0x10'));var Redis=require('ioredis');var authService=require(_0x8154('0x11'));var qs=require(_0x8154('0x12'));var as=require(_0x8154('0x13'));var hardwareService=require(_0x8154('0x14'));var logger=require(_0x8154('0x15'))(_0x8154('0x16'));var utils=require(_0x8154('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d7f4,_0x1d1423){_0x1d1423=_0x1d1423||0xcc;return function(_0x29b886){if(_0x29b886){return _0x53d7f4[_0x8154('0x18')](_0x1d1423);}return _0x53d7f4[_0x8154('0x19')](_0x1d1423)[_0x8154('0x1a')]();};}function respondWithResult(_0x35a5d1,_0x44d13d){_0x44d13d=_0x44d13d||0xc8;return function(_0x204c0e){if(_0x204c0e){return _0x35a5d1[_0x8154('0x19')](_0x44d13d)[_0x8154('0x1b')](_0x204c0e);}};}function respondWithFilteredResult(_0x26657b,_0x426202){return function(_0x28d83e){if(_0x28d83e){var _0xc06026=_0x28d83e[_0x8154('0x1c')],_0x255f0d=_0x426202[_0x8154('0x1d')],_0x1bbacd=_0x426202[_0x8154('0x1d')]+_0x426202[_0x8154('0x1e')],_0x3feb80;if(_0x1bbacd>=_0xc06026){_0x1bbacd=_0xc06026;_0x3feb80=0xc8;}else{_0x3feb80=0xce;}_0x26657b[_0x8154('0x19')](_0x3feb80);return _0x26657b[_0x8154('0x1f')](_0x8154('0x20'),_0x255f0d+'-'+_0x1bbacd+'/'+_0xc06026)['json'](_0x28d83e);}return null;};}function patchUpdates(_0x20da73){return function(_0x40bc5d){try{jsonpatch[_0x8154('0x21')](_0x40bc5d,_0x20da73,!![]);}catch(_0x14b1a6){return BPromise[_0x8154('0x22')](_0x14b1a6);}return _0x40bc5d[_0x8154('0x23')]();};}function saveUpdates(_0x58a418,_0x5415b7){return function(_0x434dbf){if(_0x434dbf){return _0x434dbf['update'](_0x58a418)[_0x8154('0x24')](function(_0xf677ea){return _0xf677ea;});}return null;};}function removeEntity(_0x941ca1,_0x11428f){return function(_0x6bfce0){if(_0x6bfce0){return _0x6bfce0[_0x8154('0x25')]()['then'](function(){_0x941ca1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x406f89,_0x1655ff){return function(_0x58bf9f){if(!_0x58bf9f){_0x406f89[_0x8154('0x18')](0x194);}return _0x58bf9f;};}function handleError(_0x3c6fee,_0x15d072){_0x15d072=_0x15d072||0x1f4;return function(_0x4b6832){logger[_0x8154('0x26')](_0x4b6832[_0x8154('0x27')]);if(_0x4b6832[_0x8154('0x28')]){delete _0x4b6832[_0x8154('0x28')];}_0x3c6fee[_0x8154('0x19')](_0x15d072)[_0x8154('0x29')](_0x4b6832);};}exports[_0x8154('0x2a')]=function(_0x316628,_0xd70a42){var _0x2f2247={},_0x51af02={},_0x59dcbd={'count':0x0,'rows':[]};var _0xc18c3d=_[_0x8154('0x2b')](db[_0x8154('0x2c')][_0x8154('0x2d')],function(_0x5a6d1f){return{'name':_0x5a6d1f[_0x8154('0x2e')],'type':_0x5a6d1f['type']['key']};});_0x51af02[_0x8154('0x2f')]=_[_0x8154('0x2b')](_0xc18c3d,_0x8154('0x28'));_0x51af02[_0x8154('0x30')]=_[_0x8154('0x31')](_0x316628[_0x8154('0x30')]);_0x51af02['filters']=_[_0x8154('0x32')](_0x51af02[_0x8154('0x2f')],_0x51af02[_0x8154('0x30')]);_0x2f2247['attributes']=_[_0x8154('0x32')](_0x51af02['model'],qs[_0x8154('0x33')](_0x316628[_0x8154('0x30')][_0x8154('0x33')]));_0x2f2247[_0x8154('0x34')]=_0x2f2247['attributes']['length']?_0x2f2247['attributes']:_0x51af02[_0x8154('0x2f')];if(!_0x316628[_0x8154('0x30')]['hasOwnProperty'](_0x8154('0x35'))){_0x2f2247[_0x8154('0x1e')]=qs[_0x8154('0x1e')](_0x316628[_0x8154('0x30')][_0x8154('0x1e')]);_0x2f2247[_0x8154('0x1d')]=qs['offset'](_0x316628['query']['offset']);}_0x2f2247[_0x8154('0x36')]=qs[_0x8154('0x37')](_0x316628['query'][_0x8154('0x37')]);_0x2f2247['where']=qs[_0x8154('0x38')](_[_0x8154('0x39')](_0x316628[_0x8154('0x30')],_0x51af02[_0x8154('0x38')]),_0xc18c3d);if(_0x316628[_0x8154('0x30')][_0x8154('0x3a')]){_0x2f2247[_0x8154('0x3b')]=_['merge'](_0x2f2247[_0x8154('0x3b')],{'$or':_[_0x8154('0x2b')](_0xc18c3d,function(_0x507561){if(_0x507561['type']!==_0x8154('0x3c')){var _0x24d7ee={};_0x24d7ee[_0x507561[_0x8154('0x28')]]={'$like':'%'+_0x316628[_0x8154('0x30')][_0x8154('0x3a')]+'%'};return _0x24d7ee;}})});}_0x2f2247=_[_0x8154('0x3d')]({},_0x2f2247,_0x316628[_0x8154('0x3e')]);var _0x37ad29={'where':_0x2f2247[_0x8154('0x3b')]};return db[_0x8154('0x2c')][_0x8154('0x1c')](_0x37ad29)[_0x8154('0x24')](function(_0x46fdb4){_0x59dcbd[_0x8154('0x1c')]=_0x46fdb4;if(_0x316628[_0x8154('0x30')]['includeAll']){_0x2f2247['include']=[{'all':!![]}];}return db[_0x8154('0x2c')][_0x8154('0x3f')](_0x2f2247);})[_0x8154('0x24')](function(_0x29da41){_0x59dcbd[_0x8154('0x40')]=_0x29da41;return _0x59dcbd;})[_0x8154('0x24')](respondWithFilteredResult(_0xd70a42,_0x2f2247))[_0x8154('0x41')](handleError(_0xd70a42,null));};exports[_0x8154('0x42')]=function(_0x294984,_0x191e9b){var _0x4a4c8e={'raw':!![],'where':{'id':_0x294984[_0x8154('0x43')]['id']}},_0x1e3dc0={};_0x1e3dc0[_0x8154('0x2f')]=_['keys'](db['SalesforceField'][_0x8154('0x2d')]);_0x1e3dc0[_0x8154('0x30')]=_[_0x8154('0x31')](_0x294984['query']);_0x1e3dc0[_0x8154('0x38')]=_[_0x8154('0x32')](_0x1e3dc0[_0x8154('0x2f')],_0x1e3dc0[_0x8154('0x30')]);_0x4a4c8e[_0x8154('0x34')]=_[_0x8154('0x32')](_0x1e3dc0[_0x8154('0x2f')],qs[_0x8154('0x33')](_0x294984[_0x8154('0x30')]['fields']));_0x4a4c8e[_0x8154('0x34')]=_0x4a4c8e['attributes'][_0x8154('0x44')]?_0x4a4c8e[_0x8154('0x34')]:_0x1e3dc0[_0x8154('0x2f')];if(_0x294984[_0x8154('0x30')][_0x8154('0x45')]){_0x4a4c8e[_0x8154('0x46')]=[{'all':!![]}];}_0x4a4c8e=_[_0x8154('0x3d')]({},_0x4a4c8e,_0x294984[_0x8154('0x3e')]);return db[_0x8154('0x2c')]['find'](_0x4a4c8e)[_0x8154('0x24')](handleEntityNotFound(_0x191e9b,null))[_0x8154('0x24')](respondWithResult(_0x191e9b,null))[_0x8154('0x41')](handleError(_0x191e9b,null));};exports[_0x8154('0x47')]=function(_0x5a4b27,_0x3f4f3e){return db[_0x8154('0x2c')]['create'](_0x5a4b27[_0x8154('0x48')],{})['then'](respondWithResult(_0x3f4f3e,0xc9))['catch'](handleError(_0x3f4f3e,null));};exports['update']=function(_0x2d79e1,_0x2676da){if(_0x2d79e1[_0x8154('0x48')]['id']){delete _0x2d79e1[_0x8154('0x48')]['id'];}return db[_0x8154('0x2c')]['find']({'where':{'id':_0x2d79e1[_0x8154('0x43')]['id']}})[_0x8154('0x24')](handleEntityNotFound(_0x2676da,null))['then'](saveUpdates(_0x2d79e1[_0x8154('0x48')],null))[_0x8154('0x24')](respondWithResult(_0x2676da,null))[_0x8154('0x41')](handleError(_0x2676da,null));};exports[_0x8154('0x25')]=function(_0x5f5224,_0x271f87){return db['SalesforceField'][_0x8154('0x49')]({'where':{'id':_0x5f5224['params']['id']}})[_0x8154('0x24')](handleEntityNotFound(_0x271f87,null))[_0x8154('0x24')](removeEntity(_0x271f87,null))[_0x8154('0x41')](handleError(_0x271f87,null));}; \ No newline at end of file +var _0xce44=['nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0xce44,0xf9));var _0x4ce4=function(_0xd589b1,_0x2b560a){_0xd589b1=_0xd589b1-0x0;var _0x43a424=_0xce44[_0xd589b1];return _0x43a424;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4ce4('0x0'));var rimraf=require(_0x4ce4('0x1'));var zipdir=require(_0x4ce4('0x2'));var jsonpatch=require(_0x4ce4('0x3'));var rp=require(_0x4ce4('0x4'));var moment=require(_0x4ce4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4ce4('0x6'));var util=require(_0x4ce4('0x7'));var path=require(_0x4ce4('0x8'));var sox=require(_0x4ce4('0x9'));var csv=require(_0x4ce4('0xa'));var ejs=require(_0x4ce4('0xb'));var fs=require('fs');var _=require(_0x4ce4('0xc'));var squel=require(_0x4ce4('0xd'));var crypto=require(_0x4ce4('0xe'));var jsforce=require(_0x4ce4('0xf'));var deskjs=require(_0x4ce4('0x10'));var toCsv=require(_0x4ce4('0xa'));var querystring=require(_0x4ce4('0x11'));var Papa=require(_0x4ce4('0x12'));var Redis=require('ioredis');var authService=require(_0x4ce4('0x13'));var qs=require(_0x4ce4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ce4('0x15'));var logger=require(_0x4ce4('0x16'))('api');var utils=require(_0x4ce4('0x17'));var config=require(_0x4ce4('0x18'));var licenseUtil=require(_0x4ce4('0x19'));var db=require(_0x4ce4('0x1a'))['db'];function respondWithStatusCode(_0x46b6de,_0x56e6e9){_0x56e6e9=_0x56e6e9||0xcc;return function(_0x3b655d){if(_0x3b655d){return _0x46b6de[_0x4ce4('0x1b')](_0x56e6e9);}return _0x46b6de[_0x4ce4('0x1c')](_0x56e6e9)[_0x4ce4('0x1d')]();};}function respondWithResult(_0x10d17f,_0x292c34){_0x292c34=_0x292c34||0xc8;return function(_0x42ac69){if(_0x42ac69){return _0x10d17f[_0x4ce4('0x1c')](_0x292c34)[_0x4ce4('0x1e')](_0x42ac69);}};}function respondWithFilteredResult(_0xbde014,_0x5bc967){return function(_0x4bcc25){if(_0x4bcc25){var _0xdfaccf=_0x4bcc25[_0x4ce4('0x1f')],_0x47c457=_0x5bc967[_0x4ce4('0x20')],_0x41736a=_0x5bc967[_0x4ce4('0x20')]+_0x5bc967[_0x4ce4('0x21')],_0x8e06b3;if(_0x41736a>=_0xdfaccf){_0x41736a=_0xdfaccf;_0x8e06b3=0xc8;}else{_0x8e06b3=0xce;}_0xbde014[_0x4ce4('0x1c')](_0x8e06b3);return _0xbde014['set']('Content-Range',_0x47c457+'-'+_0x41736a+'/'+_0xdfaccf)[_0x4ce4('0x1e')](_0x4bcc25);}return null;};}function patchUpdates(_0x4d6bb2){return function(_0x19b5c2){try{jsonpatch[_0x4ce4('0x22')](_0x19b5c2,_0x4d6bb2,!![]);}catch(_0x49e309){return BPromise[_0x4ce4('0x23')](_0x49e309);}return _0x19b5c2[_0x4ce4('0x24')]();};}function saveUpdates(_0x3fd83f,_0x29a3e2){return function(_0x9ead11){if(_0x9ead11){return _0x9ead11[_0x4ce4('0x25')](_0x3fd83f)[_0x4ce4('0x26')](function(_0x1d25fa){return _0x1d25fa;});}return null;};}function removeEntity(_0x2af600,_0x31cbd1){return function(_0x46356a){if(_0x46356a){return _0x46356a[_0x4ce4('0x27')]()['then'](function(){_0x2af600[_0x4ce4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aae83,_0x1e9dc5){return function(_0x4eb4f2){if(!_0x4eb4f2){_0x4aae83[_0x4ce4('0x1b')](0x194);}return _0x4eb4f2;};}function handleError(_0xeb28d3,_0x34e8c0){_0x34e8c0=_0x34e8c0||0x1f4;return function(_0x13f2ae){logger[_0x4ce4('0x28')](_0x13f2ae[_0x4ce4('0x29')]);if(_0x13f2ae['name']){delete _0x13f2ae['name'];}_0xeb28d3[_0x4ce4('0x1c')](_0x34e8c0)[_0x4ce4('0x2a')](_0x13f2ae);};}exports[_0x4ce4('0x2b')]=function(_0x585dc3,_0x4fa941){var _0x291618={},_0x3f7029={},_0x43d117={'count':0x0,'rows':[]};var _0x56ffc8=_[_0x4ce4('0x2c')](db[_0x4ce4('0x2d')][_0x4ce4('0x2e')],function(_0x535373){return{'name':_0x535373[_0x4ce4('0x2f')],'type':_0x535373[_0x4ce4('0x30')][_0x4ce4('0x31')]};});_0x3f7029[_0x4ce4('0x32')]=_[_0x4ce4('0x2c')](_0x56ffc8,'name');_0x3f7029[_0x4ce4('0x33')]=_[_0x4ce4('0x34')](_0x585dc3[_0x4ce4('0x33')]);_0x3f7029[_0x4ce4('0x35')]=_[_0x4ce4('0x36')](_0x3f7029[_0x4ce4('0x32')],_0x3f7029[_0x4ce4('0x33')]);_0x291618[_0x4ce4('0x37')]=_[_0x4ce4('0x36')](_0x3f7029[_0x4ce4('0x32')],qs[_0x4ce4('0x38')](_0x585dc3[_0x4ce4('0x33')][_0x4ce4('0x38')]));_0x291618[_0x4ce4('0x37')]=_0x291618[_0x4ce4('0x37')][_0x4ce4('0x39')]?_0x291618['attributes']:_0x3f7029[_0x4ce4('0x32')];if(!_0x585dc3[_0x4ce4('0x33')][_0x4ce4('0x3a')](_0x4ce4('0x3b'))){_0x291618['limit']=qs[_0x4ce4('0x21')](_0x585dc3[_0x4ce4('0x33')][_0x4ce4('0x21')]);_0x291618[_0x4ce4('0x20')]=qs['offset'](_0x585dc3[_0x4ce4('0x33')][_0x4ce4('0x20')]);}_0x291618[_0x4ce4('0x3c')]=qs[_0x4ce4('0x3d')](_0x585dc3[_0x4ce4('0x33')][_0x4ce4('0x3d')]);_0x291618[_0x4ce4('0x3e')]=qs[_0x4ce4('0x35')](_['pick'](_0x585dc3['query'],_0x3f7029[_0x4ce4('0x35')]),_0x56ffc8);if(_0x585dc3[_0x4ce4('0x33')][_0x4ce4('0x3f')]){_0x291618[_0x4ce4('0x3e')]=_[_0x4ce4('0x40')](_0x291618[_0x4ce4('0x3e')],{'$or':_[_0x4ce4('0x2c')](_0x56ffc8,function(_0x760368){if(_0x760368[_0x4ce4('0x30')]!==_0x4ce4('0x41')){var _0x2680a8={};_0x2680a8[_0x760368[_0x4ce4('0x42')]]={'$like':'%'+_0x585dc3[_0x4ce4('0x33')][_0x4ce4('0x3f')]+'%'};return _0x2680a8;}})});}_0x291618=_[_0x4ce4('0x40')]({},_0x291618,_0x585dc3[_0x4ce4('0x43')]);var _0x4c6177={'where':_0x291618[_0x4ce4('0x3e')]};return db['SalesforceField'][_0x4ce4('0x1f')](_0x4c6177)[_0x4ce4('0x26')](function(_0x10306b){_0x43d117[_0x4ce4('0x1f')]=_0x10306b;if(_0x585dc3['query'][_0x4ce4('0x44')]){_0x291618[_0x4ce4('0x45')]=[{'all':!![]}];}return db[_0x4ce4('0x2d')]['findAll'](_0x291618);})[_0x4ce4('0x26')](function(_0x2fcfbe){_0x43d117[_0x4ce4('0x46')]=_0x2fcfbe;return _0x43d117;})[_0x4ce4('0x26')](respondWithFilteredResult(_0x4fa941,_0x291618))[_0x4ce4('0x47')](handleError(_0x4fa941,null));};exports[_0x4ce4('0x48')]=function(_0x4a9c99,_0x4a48e0){var _0x25b0f4={'raw':!![],'where':{'id':_0x4a9c99[_0x4ce4('0x49')]['id']}},_0x8087fb={};_0x8087fb[_0x4ce4('0x32')]=_[_0x4ce4('0x34')](db[_0x4ce4('0x2d')][_0x4ce4('0x2e')]);_0x8087fb[_0x4ce4('0x33')]=_[_0x4ce4('0x34')](_0x4a9c99[_0x4ce4('0x33')]);_0x8087fb['filters']=_[_0x4ce4('0x36')](_0x8087fb[_0x4ce4('0x32')],_0x8087fb['query']);_0x25b0f4[_0x4ce4('0x37')]=_[_0x4ce4('0x36')](_0x8087fb[_0x4ce4('0x32')],qs[_0x4ce4('0x38')](_0x4a9c99[_0x4ce4('0x33')][_0x4ce4('0x38')]));_0x25b0f4['attributes']=_0x25b0f4[_0x4ce4('0x37')]['length']?_0x25b0f4['attributes']:_0x8087fb['model'];if(_0x4a9c99['query'][_0x4ce4('0x44')]){_0x25b0f4['include']=[{'all':!![]}];}_0x25b0f4=_['merge']({},_0x25b0f4,_0x4a9c99[_0x4ce4('0x43')]);return db['SalesforceField'][_0x4ce4('0x4a')](_0x25b0f4)[_0x4ce4('0x26')](handleEntityNotFound(_0x4a48e0,null))[_0x4ce4('0x26')](respondWithResult(_0x4a48e0,null))[_0x4ce4('0x47')](handleError(_0x4a48e0,null));};exports[_0x4ce4('0x4b')]=function(_0x403a90,_0x2ba1ca){return db[_0x4ce4('0x2d')]['create'](_0x403a90['body'],{})[_0x4ce4('0x26')](respondWithResult(_0x2ba1ca,0xc9))[_0x4ce4('0x47')](handleError(_0x2ba1ca,null));};exports[_0x4ce4('0x25')]=function(_0x44ebaa,_0x14576c){if(_0x44ebaa['body']['id']){delete _0x44ebaa[_0x4ce4('0x4c')]['id'];}return db[_0x4ce4('0x2d')][_0x4ce4('0x4a')]({'where':{'id':_0x44ebaa[_0x4ce4('0x49')]['id']}})[_0x4ce4('0x26')](handleEntityNotFound(_0x14576c,null))['then'](saveUpdates(_0x44ebaa['body'],null))[_0x4ce4('0x26')](respondWithResult(_0x14576c,null))[_0x4ce4('0x47')](handleError(_0x14576c,null));};exports['destroy']=function(_0x39624d,_0x4b28be){return db[_0x4ce4('0x2d')]['find']({'where':{'id':_0x39624d[_0x4ce4('0x49')]['id']}})[_0x4ce4('0x26')](handleEntityNotFound(_0x4b28be,null))[_0x4ce4('0x26')](removeEntity(_0x4b28be,null))[_0x4ce4('0x47')](handleError(_0x4b28be,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 49acc98..d9dd93a 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 _0x7234=['../../config/environment','exports','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7234,0x172));var _0x4723=function(_0x58071b,_0x2a7ef0){_0x58071b=_0x58071b-0x0;var _0x5742ce=_0x7234[_0x58071b];return _0x5742ce;};'use strict';var _=require(_0x4723('0x0'));var util=require(_0x4723('0x1'));var logger=require(_0x4723('0x2'))(_0x4723('0x3'));var moment=require(_0x4723('0x4'));var BPromise=require('bluebird');var rp=require(_0x4723('0x5'));var fs=require('fs');var path=require(_0x4723('0x6'));var rimraf=require(_0x4723('0x7'));var config=require(_0x4723('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x4723('0x9')]=function(_0x2ae064,_0x84e6e3){return _0x2ae064['define'](_0x4723('0xa'),attributes,{'tableName':_0x4723('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x4723('0xc'),_0x4723('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f02=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','util','../../config/logger','api','moment'];(function(_0x49d403,_0x45be58){var _0x4cca62=function(_0x1f61fe){while(--_0x1f61fe){_0x49d403['push'](_0x49d403['shift']());}};_0x4cca62(++_0x45be58);}(_0x8f02,0xa1));var _0x28f0=function(_0x5b5e66,_0x4362e2){_0x5b5e66=_0x5b5e66-0x0;var _0x258bca=_0x8f02[_0x5b5e66];return _0x258bca;};'use strict';var _=require('lodash');var util=require(_0x28f0('0x0'));var logger=require(_0x28f0('0x1'))(_0x28f0('0x2'));var moment=require(_0x28f0('0x3'));var BPromise=require('bluebird');var rp=require(_0x28f0('0x4'));var fs=require('fs');var path=require(_0x28f0('0x5'));var rimraf=require(_0x28f0('0x6'));var config=require(_0x28f0('0x7'));var attributes=require(_0x28f0('0x8'));module[_0x28f0('0x9')]=function(_0x124a9c,_0x81ebfd){return _0x124a9c[_0x28f0('0xa')](_0x28f0('0xb'),attributes,{'tableName':_0x28f0('0xc'),'paranoid':![],'indexes':[{'name':_0x28f0('0xd'),'fields':[_0x28f0('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b269352..83d78ac 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 _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(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xdace,0xc5));var _0xedac=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xdace[_0x349367];return _0x14179b;};'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 +var _0x6f0d=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x25fd49,_0x5407f0){var _0x1663c1=function(_0x15455a){while(--_0x15455a){_0x25fd49['push'](_0x25fd49['shift']());}};_0x1663c1(++_0x5407f0);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3e898a,_0x597efd){_0x3e898a=_0x3e898a-0x0;var _0x5543e8=_0x6f0d[_0x3e898a];return _0x5543e8;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 35939cc..b996245 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 _0x6c0d=['getConfigurations','post','addConfiguration','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x414a33,_0x5bf179){var _0x1922bd=function(_0xa5ca9c){while(--_0xa5ca9c){_0x414a33['push'](_0x414a33['shift']());}};_0x1922bd(++_0x5bf179);}(_0x6c0d,0x132));var _0xd6c0=function(_0x2c6f10,_0xc65686){_0x2c6f10=_0x2c6f10-0x0;var _0x4f78c5=_0x6c0d[_0x2c6f10];return _0x4f78c5;};'use strict';var multer=require(_0xd6c0('0x0'));var util=require(_0xd6c0('0x1'));var path=require(_0xd6c0('0x2'));var timeout=require('connect-timeout');var express=require(_0xd6c0('0x3'));var router=express[_0xd6c0('0x4')]();var auth=require(_0xd6c0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd6c0('0x6'));var controller=require(_0xd6c0('0x7'));router[_0xd6c0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6c0('0x9')]);router[_0xd6c0('0x8')](_0xd6c0('0xa'),auth[_0xd6c0('0xb')](),controller[_0xd6c0('0xc')]);router[_0xd6c0('0x8')](_0xd6c0('0xd'),auth[_0xd6c0('0xb')](),controller[_0xd6c0('0xe')]);router[_0xd6c0('0x8')]('/:id/fields',auth[_0xd6c0('0xb')](),controller['getFields']);router['post']('/',auth[_0xd6c0('0xb')](),controller['create']);router[_0xd6c0('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd6c0('0x10')]);router[_0xd6c0('0x11')](_0xd6c0('0xa'),auth[_0xd6c0('0xb')](),controller[_0xd6c0('0x12')]);router['delete'](_0xd6c0('0xa'),auth[_0xd6c0('0xb')](),controller[_0xd6c0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3266=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/configurations'];(function(_0xfa3b30,_0x13fb4d){var _0x3ec719=function(_0xdd2dbe){while(--_0xdd2dbe){_0xfa3b30['push'](_0xfa3b30['shift']());}};_0x3ec719(++_0x13fb4d);}(_0x3266,0x6a));var _0x6326=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x3266[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var auth=require(_0x6326('0x6'));var interaction=require(_0x6326('0x7'));var config=require(_0x6326('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x6326('0x9')]('/',auth['isAuthenticated'](),controller[_0x6326('0xa')]);router[_0x6326('0x9')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0xc')]);router['get'](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0xf')]);router[_0x6326('0x9')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xe')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0x14')]);router[_0x6326('0x15')](_0x6326('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6326('0x16')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d640bbe..68dfac4 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 _0x272f=['remoteUri','sequelize','exports','STRING'];(function(_0x102493,_0x424a25){var _0x2187d6=function(_0x22e12e){while(--_0x22e12e){_0x102493['push'](_0x102493['shift']());}};_0x2187d6(++_0x424a25);}(_0x272f,0x65));var _0xf272=function(_0x5ad3cb,_0x4ff404){_0x5ad3cb=_0x5ad3cb-0x0;var _0xbea1e2=_0x272f[_0x5ad3cb];return _0xbea1e2;};'use strict';var Sequelize=require(_0xf272('0x0'));module[_0xf272('0x1')]={'name':{'type':Sequelize[_0xf272('0x2')]},'description':{'type':Sequelize[_0xf272('0x2')]},'username':{'type':Sequelize[_0xf272('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xf272('0x2')]},'email':{'type':Sequelize[_0xf272('0x2')]},'remoteUri':{'type':Sequelize[_0xf272('0x2')],'unique':_0xf272('0x3')},'serverUrl':{'type':Sequelize[_0xf272('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x660d=['STRING','username','sequelize'];(function(_0xbd4746,_0x9ca2c8){var _0x2afcef=function(_0x5c6a0b){while(--_0x5c6a0b){_0xbd4746['push'](_0xbd4746['shift']());}};_0x2afcef(++_0x9ca2c8);}(_0x660d,0x18b));var _0xd660=function(_0x3348db,_0x5ca88c){_0x3348db=_0x3348db-0x0;var _0x48910d=_0x660d[_0x3348db];return _0x48910d;};'use strict';var Sequelize=require(_0xd660('0x0'));module['exports']={'name':{'type':Sequelize[_0xd660('0x1')]},'description':{'type':Sequelize[_0xd660('0x1')]},'username':{'type':Sequelize[_0xd660('0x1')],'unique':_0xd660('0x2')},'password':{'type':Sequelize[_0xd660('0x1')]},'email':{'type':Sequelize[_0xd660('0x1')]},'remoteUri':{'type':Sequelize[_0xd660('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd660('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7a2ff8c..a0ce586 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 _0xdd39=['options','count','includeAll','include','rows','show','params','fields','merge','find','catch','create','body','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','caused_by','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','time_worked','expected_start','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','correlation_display','work_start','description','sys_class_name','close_notes','closed_by','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','push','all','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','false','inactive','label','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../components/integrations/configuration','jayson/promise','http','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ServicenowAccount','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','length','nolimit','sort','where','VIRTUAL','filter'];(function(_0x1abef5,_0x52945c){var _0x557fd8=function(_0x251268){while(--_0x251268){_0x1abef5['push'](_0x1abef5['shift']());}};_0x557fd8(++_0x52945c);}(_0xdd39,0x71));var _0x9dd3=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xdd39[_0x4ae6ef];return _0x3cbb4e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9dd3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9dd3('0x1'));var jsonpatch=require(_0x9dd3('0x2'));var rp=require(_0x9dd3('0x3'));var moment=require(_0x9dd3('0x4'));var BPromise=require(_0x9dd3('0x5'));var Mustache=require('mustache');var util=require(_0x9dd3('0x6'));var path=require(_0x9dd3('0x7'));var sox=require(_0x9dd3('0x8'));var csv=require(_0x9dd3('0x9'));var ejs=require(_0x9dd3('0xa'));var fs=require('fs');var _=require(_0x9dd3('0xb'));var squel=require(_0x9dd3('0xc'));var crypto=require(_0x9dd3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9dd3('0x9'));var querystring=require('querystring');var Papa=require(_0x9dd3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9dd3('0xf'));var hardwareService=require(_0x9dd3('0x10'));var logger=require('../../config/logger')(_0x9dd3('0x11'));var utils=require(_0x9dd3('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x9dd3('0x13'));var jayson=require(_0x9dd3('0x14'));var client=jayson['client'][_0x9dd3('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x35e888,_0x4e903c,_0x2480d6,_0x5a8a8c){return new BPromise(function(_0x16b5f3,_0x1203e4){var _0x412851=_0x5a8a8c||client;return _0x412851['request'](_0x35e888,_0x2480d6)['then'](function(_0x325656){logger['info'](_0x9dd3('0x16'),_0x4e903c,_0x9dd3('0x17'));logger[_0x9dd3('0x18')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4e903c,_0x9dd3('0x17'),JSON[_0x9dd3('0x19')](_0x325656));if(_0x325656['error']){if(_0x325656[_0x9dd3('0x1a')]['code']===0x1f4){logger[_0x9dd3('0x1a')](_0x9dd3('0x16'),_0x4e903c,_0x325656['error']['message']);return _0x1203e4(_0x325656['error']['message']);}logger[_0x9dd3('0x1a')](_0x9dd3('0x16'),_0x4e903c,_0x325656['error'][_0x9dd3('0x1b')]);return _0x16b5f3(_0x325656[_0x9dd3('0x1a')][_0x9dd3('0x1b')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x4e903c,_0x9dd3('0x17'));_0x16b5f3(_0x325656[_0x9dd3('0x1c')][_0x9dd3('0x1b')]);}})['catch'](function(_0x1021e6){logger['error'](_0x9dd3('0x16'),_0x4e903c,_0x1021e6);_0x1203e4(_0x1021e6);});});}function respondWithStatusCode(_0x270f49,_0x31b024){_0x31b024=_0x31b024||0xcc;return function(_0x1d13e0){if(_0x1d13e0){return _0x270f49[_0x9dd3('0x1d')](_0x31b024);}return _0x270f49[_0x9dd3('0x1e')](_0x31b024)['end']();};}function respondWithResult(_0x227071,_0x95dfd9){_0x95dfd9=_0x95dfd9||0xc8;return function(_0x402f19){if(_0x402f19){return _0x227071[_0x9dd3('0x1e')](_0x95dfd9)[_0x9dd3('0x1f')](_0x402f19);}};}function respondWithFilteredResult(_0x165bdd,_0x42f74f){return function(_0x276231){if(_0x276231){var _0x4bcda9=_0x276231['count'],_0xd74122=_0x42f74f[_0x9dd3('0x20')],_0x1991be=_0x42f74f[_0x9dd3('0x20')]+_0x42f74f[_0x9dd3('0x21')],_0x59e6a4;if(_0x1991be>=_0x4bcda9){_0x1991be=_0x4bcda9;_0x59e6a4=0xc8;}else{_0x59e6a4=0xce;}_0x165bdd['status'](_0x59e6a4);return _0x165bdd[_0x9dd3('0x22')](_0x9dd3('0x23'),_0xd74122+'-'+_0x1991be+'/'+_0x4bcda9)[_0x9dd3('0x1f')](_0x276231);}return null;};}function patchUpdates(_0x2e7e75){return function(_0x56341a){try{jsonpatch[_0x9dd3('0x24')](_0x56341a,_0x2e7e75,!![]);}catch(_0x200150){return BPromise[_0x9dd3('0x25')](_0x200150);}return _0x56341a[_0x9dd3('0x26')]();};}function saveUpdates(_0x1dae0d,_0x16b002){return function(_0x19dd7a){if(_0x19dd7a){return _0x19dd7a[_0x9dd3('0x27')](_0x1dae0d)[_0x9dd3('0x28')](function(_0x928821){return _0x928821;});}return null;};}function removeEntity(_0x5de43c,_0x46fa7b){return function(_0x3abf4f){if(_0x3abf4f){return _0x3abf4f[_0x9dd3('0x29')]()[_0x9dd3('0x28')](function(){_0x5de43c['status'](0xcc)[_0x9dd3('0x2a')]();});}};}function handleEntityNotFound(_0x1a2e53,_0x5c9c78){return function(_0x343a60){if(!_0x343a60){_0x1a2e53[_0x9dd3('0x1d')](0x194);}return _0x343a60;};}function handleError(_0xecb2ee,_0x228533){_0x228533=_0x228533||0x1f4;return function(_0x447ab0){logger[_0x9dd3('0x1a')](_0x447ab0[_0x9dd3('0x2b')]);if(_0x447ab0[_0x9dd3('0x2c')]){delete _0x447ab0['name'];}_0xecb2ee[_0x9dd3('0x1e')](_0x228533)[_0x9dd3('0x2d')](_0x447ab0);};}exports[_0x9dd3('0x2e')]=function(_0x2b5d4c,_0x54d562){var _0x2f446e={},_0x1cabc2={},_0x25ef5d={'count':0x0,'rows':[]};var _0x2ccf43=_[_0x9dd3('0x2f')](db[_0x9dd3('0x30')][_0x9dd3('0x31')],function(_0x54b391){return{'name':_0x54b391['fieldName'],'type':_0x54b391[_0x9dd3('0x32')][_0x9dd3('0x33')]};});_0x1cabc2[_0x9dd3('0x34')]=_[_0x9dd3('0x2f')](_0x2ccf43,'name');_0x1cabc2['query']=_[_0x9dd3('0x35')](_0x2b5d4c['query']);_0x1cabc2[_0x9dd3('0x36')]=_[_0x9dd3('0x37')](_0x1cabc2[_0x9dd3('0x34')],_0x1cabc2[_0x9dd3('0x38')]);_0x2f446e[_0x9dd3('0x39')]=_[_0x9dd3('0x37')](_0x1cabc2['model'],qs['fields'](_0x2b5d4c[_0x9dd3('0x38')]['fields']));_0x2f446e[_0x9dd3('0x39')]=_0x2f446e[_0x9dd3('0x39')][_0x9dd3('0x3a')]?_0x2f446e[_0x9dd3('0x39')]:_0x1cabc2['model'];if(!_0x2b5d4c['query']['hasOwnProperty'](_0x9dd3('0x3b'))){_0x2f446e['limit']=qs[_0x9dd3('0x21')](_0x2b5d4c['query'][_0x9dd3('0x21')]);_0x2f446e['offset']=qs['offset'](_0x2b5d4c['query'][_0x9dd3('0x20')]);}_0x2f446e['order']=qs['sort'](_0x2b5d4c[_0x9dd3('0x38')][_0x9dd3('0x3c')]);_0x2f446e['where']=qs[_0x9dd3('0x36')](_['pick'](_0x2b5d4c[_0x9dd3('0x38')],_0x1cabc2[_0x9dd3('0x36')]),_0x2ccf43);if(_0x2b5d4c[_0x9dd3('0x38')]['filter']){_0x2f446e[_0x9dd3('0x3d')]=_['merge'](_0x2f446e[_0x9dd3('0x3d')],{'$or':_[_0x9dd3('0x2f')](_0x2ccf43,function(_0x1cd753){if(_0x1cd753[_0x9dd3('0x32')]!==_0x9dd3('0x3e')){var _0x5bda9c={};_0x5bda9c[_0x1cd753['name']]={'$like':'%'+_0x2b5d4c[_0x9dd3('0x38')][_0x9dd3('0x3f')]+'%'};return _0x5bda9c;}})});}_0x2f446e=_['merge']({},_0x2f446e,_0x2b5d4c[_0x9dd3('0x40')]);var _0x3dbf02={'where':_0x2f446e['where']};return db['ServicenowAccount'][_0x9dd3('0x41')](_0x3dbf02)[_0x9dd3('0x28')](function(_0x62be6d){_0x25ef5d[_0x9dd3('0x41')]=_0x62be6d;if(_0x2b5d4c[_0x9dd3('0x38')][_0x9dd3('0x42')]){_0x2f446e[_0x9dd3('0x43')]=[{'all':!![]}];}return db[_0x9dd3('0x30')]['findAll'](_0x2f446e);})[_0x9dd3('0x28')](function(_0x53cd32){_0x25ef5d[_0x9dd3('0x44')]=_0x53cd32;return _0x25ef5d;})['then'](respondWithFilteredResult(_0x54d562,_0x2f446e))['catch'](handleError(_0x54d562,null));};exports[_0x9dd3('0x45')]=function(_0x19ab0d,_0x26c822){var _0x47e999={'raw':![],'where':{'id':_0x19ab0d[_0x9dd3('0x46')]['id']}},_0x4a092f={};_0x4a092f[_0x9dd3('0x34')]=_[_0x9dd3('0x35')](db['ServicenowAccount'][_0x9dd3('0x31')]);_0x4a092f[_0x9dd3('0x38')]=_[_0x9dd3('0x35')](_0x19ab0d[_0x9dd3('0x38')]);_0x4a092f[_0x9dd3('0x36')]=_[_0x9dd3('0x37')](_0x4a092f[_0x9dd3('0x34')],_0x4a092f[_0x9dd3('0x38')]);_0x47e999[_0x9dd3('0x39')]=_[_0x9dd3('0x37')](_0x4a092f['model'],qs[_0x9dd3('0x47')](_0x19ab0d['query'][_0x9dd3('0x47')]));_0x47e999[_0x9dd3('0x39')]=_0x47e999[_0x9dd3('0x39')]['length']?_0x47e999[_0x9dd3('0x39')]:_0x4a092f[_0x9dd3('0x34')];if(_0x19ab0d[_0x9dd3('0x38')]['includeAll']){_0x47e999[_0x9dd3('0x43')]=[{'all':!![]}];}_0x47e999=_[_0x9dd3('0x48')]({},_0x47e999,_0x19ab0d[_0x9dd3('0x40')]);return db['ServicenowAccount'][_0x9dd3('0x49')](_0x47e999)[_0x9dd3('0x28')](handleEntityNotFound(_0x26c822,null))['then'](respondWithResult(_0x26c822,null))[_0x9dd3('0x4a')](handleError(_0x26c822,null));};exports['create']=function(_0x1dfed6,_0x4ea145){return db[_0x9dd3('0x30')][_0x9dd3('0x4b')](_0x1dfed6['body'],{})['then'](respondWithResult(_0x4ea145,0xc9))['catch'](handleError(_0x4ea145,null));};exports[_0x9dd3('0x27')]=function(_0x4c1e12,_0x4e9c96){if(_0x4c1e12[_0x9dd3('0x4c')]['id']){delete _0x4c1e12['body']['id'];}return db[_0x9dd3('0x30')]['find']({'where':{'id':_0x4c1e12[_0x9dd3('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e9c96,null))[_0x9dd3('0x28')](saveUpdates(_0x4c1e12[_0x9dd3('0x4c')],null))[_0x9dd3('0x28')](respondWithResult(_0x4e9c96,null))[_0x9dd3('0x4a')](handleError(_0x4e9c96,null));};exports[_0x9dd3('0x29')]=function(_0x376f54,_0x18446c){return db['ServicenowAccount'][_0x9dd3('0x49')]({'where':{'id':_0x376f54[_0x9dd3('0x46')]['id']}})['then'](handleEntityNotFound(_0x18446c,null))[_0x9dd3('0x28')](removeEntity(_0x18446c,null))['catch'](handleError(_0x18446c,null));};exports[_0x9dd3('0x4d')]=function(_0x4f6811,_0x2fa4dc,_0x2d1c41){var _0xdb7be7={};var _0x56fc25={};var _0xb3eb84;var _0x56c1f2;return db[_0x9dd3('0x30')][_0x9dd3('0x4e')]({'where':{'id':_0x4f6811[_0x9dd3('0x46')]['id']}})[_0x9dd3('0x28')](handleEntityNotFound(_0x2fa4dc,null))[_0x9dd3('0x28')](function(_0x42b48c){if(_0x42b48c){_0xb3eb84=_0x42b48c;_0x56fc25[_0x9dd3('0x34')]=_[_0x9dd3('0x35')](db['ServicenowConfiguration'][_0x9dd3('0x31')]);_0x56fc25[_0x9dd3('0x38')]=_['keys'](_0x4f6811[_0x9dd3('0x38')]);_0x56fc25[_0x9dd3('0x36')]=_['intersection'](_0x56fc25[_0x9dd3('0x34')],_0x56fc25[_0x9dd3('0x38')]);_0xdb7be7['attributes']=_[_0x9dd3('0x37')](_0x56fc25['model'],qs[_0x9dd3('0x47')](_0x4f6811[_0x9dd3('0x38')][_0x9dd3('0x47')]));_0xdb7be7[_0x9dd3('0x39')]=_0xdb7be7[_0x9dd3('0x39')]['length']?_0xdb7be7[_0x9dd3('0x39')]:_0x56fc25[_0x9dd3('0x34')];_0xdb7be7[_0x9dd3('0x4f')]=qs[_0x9dd3('0x3c')](_0x4f6811[_0x9dd3('0x38')][_0x9dd3('0x3c')]);_0xdb7be7[_0x9dd3('0x3d')]=qs[_0x9dd3('0x36')](_['pick'](_0x4f6811[_0x9dd3('0x38')],_0x56fc25[_0x9dd3('0x36')]));if(_0x4f6811[_0x9dd3('0x38')][_0x9dd3('0x3f')]){_0xdb7be7[_0x9dd3('0x3d')]=_[_0x9dd3('0x48')](_0xdb7be7['where'],{'$or':_[_0x9dd3('0x2f')](_0xdb7be7['attributes'],function(_0x34df4b){var _0x1547d2={};_0x1547d2[_0x34df4b]={'$like':'%'+_0x4f6811[_0x9dd3('0x38')]['filter']+'%'};return _0x1547d2;})});}_0xdb7be7=_[_0x9dd3('0x48')]({},_0xdb7be7,_0x4f6811[_0x9dd3('0x40')]);return _0xb3eb84[_0x9dd3('0x4d')](_0xdb7be7);}})[_0x9dd3('0x28')](function(_0x31e723){if(_0x31e723){_0x56c1f2=_0x31e723[_0x9dd3('0x3a')];if(!_0x4f6811['query'][_0x9dd3('0x50')](_0x9dd3('0x3b'))){_0xdb7be7[_0x9dd3('0x21')]=qs[_0x9dd3('0x21')](_0x4f6811[_0x9dd3('0x38')][_0x9dd3('0x21')]);_0xdb7be7['offset']=qs['offset'](_0x4f6811[_0x9dd3('0x38')][_0x9dd3('0x20')]);}return _0xb3eb84[_0x9dd3('0x4d')](_0xdb7be7);}})[_0x9dd3('0x28')](function(_0x1ce730){if(_0x1ce730){return _0x1ce730?{'count':_0x56c1f2,'rows':_0x1ce730}:null;}})[_0x9dd3('0x28')](respondWithResult(_0x2fa4dc,null))['catch'](handleError(_0x2fa4dc,null));};exports[_0x9dd3('0x51')]=function(_0x46f096,_0x102e75,_0xb99ca2){if(_0x46f096[_0x9dd3('0x4c')]['id']){delete _0x46f096[_0x9dd3('0x4c')]['id'];}return db[_0x9dd3('0x30')]['findOne']({'where':{'id':_0x46f096['params']['id']}})[_0x9dd3('0x28')](handleEntityNotFound(_0x102e75,null))[_0x9dd3('0x28')](function(_0x450249){if(_0x450249){_0x46f096[_0x9dd3('0x4c')][_0x9dd3('0x52')]=_0x450249['id'];_0x46f096[_0x9dd3('0x4c')][_0x9dd3('0x53')]=integrations[_0x9dd3('0x54')](_0x46f096['body'][_0x9dd3('0x55')],_0x46f096[_0x9dd3('0x4c')][_0x9dd3('0x32')]);_0x46f096['body'][_0x9dd3('0x56')]=integrations['getDescriptions'](_0x46f096['body'][_0x9dd3('0x55')],_0x46f096['body'][_0x9dd3('0x32')]);return db[_0x9dd3('0x57')]['create'](_0x46f096[_0x9dd3('0x4c')],{'include':[{'model':db[_0x9dd3('0x58')],'as':_0x9dd3('0x53')},{'model':db[_0x9dd3('0x58')],'as':'Descriptions'}]});}return null;})[_0x9dd3('0x28')](respondWithResult(_0x102e75,null))['catch'](handleError(_0x102e75,null));};exports['getFields']=function(_0x241d0b,_0x10e5a8,_0x15f71d){var _0xf5c0c6=[_0x9dd3('0x59'),_0x9dd3('0x5a'),'knowledge',_0x9dd3('0x5b'),_0x9dd3('0x5c'),_0x9dd3('0x5d'),_0x9dd3('0x5e'),_0x9dd3('0x5f'),_0x9dd3('0x60')];var _0x461d6e=['parent',_0x9dd3('0x59'),_0x9dd3('0x61'),'watch_list',_0x9dd3('0x62'),_0x9dd3('0x63'),'child_incidents','hold_reason','approval_history',_0x9dd3('0x64'),_0x9dd3('0x65'),_0x9dd3('0x66'),'opened_by',_0x9dd3('0x67'),_0x9dd3('0x68'),_0x9dd3('0x69'),_0x9dd3('0x6a'),_0x9dd3('0x6b'),_0x9dd3('0x6c'),_0x9dd3('0x4f'),_0x9dd3('0x6d'),_0x9dd3('0x6e'),_0x9dd3('0x6f'),_0x9dd3('0x70'),_0x9dd3('0x71'),_0x9dd3('0x72'),_0x9dd3('0x73'),_0x9dd3('0x74'),_0x9dd3('0x75'),'sys_domain_path','rfc',_0x9dd3('0x76'),_0x9dd3('0x77'),'opened_at','business_duration',_0x9dd3('0x78'),_0x9dd3('0x79'),_0x9dd3('0x7a'),_0x9dd3('0x7b'),'caller_id',_0x9dd3('0x7c'),_0x9dd3('0x5b'),_0x9dd3('0x7d'),'short_description','close_code',_0x9dd3('0x7e'),'delivery_task',_0x9dd3('0x7f'),'assignment_group','business_stc','additional_assignee_list',_0x9dd3('0x80'),'calendar_duration',_0x9dd3('0x5d'),_0x9dd3('0x81'),_0x9dd3('0x82'),_0x9dd3('0x83'),'follow_up','parent_incident','sys_id',_0x9dd3('0x84'),_0x9dd3('0x85'),_0x9dd3('0x5e'),_0x9dd3('0x86'),_0x9dd3('0x87'),_0x9dd3('0x88'),'reassignment_count',_0x9dd3('0x89'),_0x9dd3('0x8a'),'severity',_0x9dd3('0x8b'),'sla_due',_0x9dd3('0x8c'),_0x9dd3('0x8d'),_0x9dd3('0x8e'),'sys_mod_count',_0x9dd3('0x8f'),_0x9dd3('0x90'),_0x9dd3('0x91'),_0x9dd3('0x92'),_0x9dd3('0x93'),_0x9dd3('0x94'),'category'];var _0x44ff8c='';var _0x1a8da6='';var _0x4bdf6d=[];var _0x1a7985='';var _0x4a89f0='';var _0x5db32f=[];var _0x35be99='';var _0x7aeecb='';var _0x337a2a={};var _0x241998='';return db[_0x9dd3('0x30')]['findOne']({'where':{'id':_0x241d0b[_0x9dd3('0x46')]['id']},'attributes':['id','username',_0x9dd3('0x95'),_0x9dd3('0x96'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x10e5a8,null))['then'](function(_0x5bd593){if(_0x5bd593){_0x241998=_0x5bd593[_0x9dd3('0x97')];var _0x1df2fd=_0x241998['slice'](-0x1);if(_0x1df2fd==='/'){_0x241998=_0x241998['substring'](0x0,_0x241998[_0x9dd3('0x98')](_0x1df2fd));}_0x7aeecb=util['format']('%s/api/now/doc/table/schema/',_0x241998);_0x35be99=util[_0x9dd3('0x99')](_0x9dd3('0x9a'),_0x241998);_0x337a2a={'user':_0x5bd593['username'],'pass':_0x5bd593[_0x9dd3('0x95')]};var _0x58fdf4={'method':'GET','uri':_0x7aeecb+_0x9dd3('0x9b'),'auth':_0x337a2a,'json':!![]};return rp(_0x58fdf4);}})['then'](function(_0x584a93){if(_0x584a93[_0x9dd3('0x1c')][_0x9dd3('0x3a')]>0x0){_0x44ff8c=_0x584a93[_0x9dd3('0x1c')];}console[_0x9dd3('0x9c')](_0x9dd3('0x9d'),_0x44ff8c);_0x5db32f=[];_0x1a8da6=Object[_0x9dd3('0x9e')]([],_0x44ff8c);_[_0x9dd3('0x9f')](_0x1a8da6,function(_0x4d8735){return!_0xf5c0c6[_0x9dd3('0xa0')](_0x4d8735['name']);});_0x1a8da6[_0x9dd3('0xa1')](function(_0x2665e0){var _0x480e4e=createFieldObject(_0x35be99,_0x337a2a,_0x2665e0['internalType'],_0x2665e0[_0x9dd3('0x2c')],_0x2665e0['label'],![]);_0x5db32f[_0x9dd3('0xa2')](_0x480e4e);});return Promise[_0x9dd3('0xa3')](_0x5db32f);})[_0x9dd3('0x28')](function(_0x1866a5){_0x4bdf6d=_0x1866a5;_0x1a7985=Object[_0x9dd3('0x9e')]([],_0x44ff8c);console[_0x9dd3('0x9c')]('TCL:\x20_object',_0x44ff8c);_['remove'](_0x1a7985,function(_0xab450f){return _0x461d6e['includes'](_0xab450f['name']);});console[_0x9dd3('0x9c')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1a7985);_0x5db32f=[];_0x1a7985[_0x9dd3('0xa1')](function(_0x38ec40){var _0x14d61a=createFieldObject(_0x35be99,_0x337a2a,_0x38ec40[_0x9dd3('0xa4')],_0x38ec40[_0x9dd3('0x2c')],_0x38ec40['label'],!![]);_0x5db32f[_0x9dd3('0xa2')](_0x14d61a);});return Promise[_0x9dd3('0xa3')](_0x5db32f);})[_0x9dd3('0x28')](function(_0x5e7d5d){_0x4a89f0=_0x5e7d5d;var _0x28a972=_0x4bdf6d[_0x9dd3('0xa5')](_0x4a89f0);return{'count':_0x28a972['length'],'rows':_0x28a972};})[_0x9dd3('0x28')](respondWithResult(_0x10e5a8,null))[_0x9dd3('0x4a')](function(_0x3b951b){console[_0x9dd3('0x9c')](_0x9dd3('0xa6')+_0x3b951b);var _0x26b2b8=_0x241d0b['query'][_0x9dd3('0xa7')]?0x1f4:_0x3b951b[_0x9dd3('0xa8')]||0x1f4;logger[_0x9dd3('0x1a')](_0x3b951b[_0x9dd3('0x2b')]);delete _0x3b951b[_0x9dd3('0x2c')];if(_0x26b2b8===0x191){_0x26b2b8=0x190;}_0x10e5a8[_0x9dd3('0x1e')](_0x26b2b8)[_0x9dd3('0x2d')](_0x241d0b[_0x9dd3('0x38')][_0x9dd3('0xa7')]?{'message':_0x9dd3('0xa9'),'statusCode':_0x3b951b[_0x9dd3('0xa8')]}:_0x3b951b);});};function createFieldObject(_0x1d87a1,_0x2e9342,_0x26f9ad,_0x321e6c,_0x54dc90,_0x28747e){return new Promise(function(_0x25cbe0,_0x477412){var _0x587b45={'id':_0x321e6c,'name':_0x54dc90,'custom':_0x28747e};if(_0x26f9ad===_0x9dd3('0xaa')){_0x587b45[_0x9dd3('0x40')]=[{'name':_0x9dd3('0xab'),'value':_0x9dd3('0xac')},{'name':'False','value':_0x9dd3('0xad')}];_0x25cbe0(_0x587b45);}else{var _0x1594f3={'method':'GET','uri':_0x1d87a1+'sys_choice?sysparm_query=name=incident^element='+_0x321e6c,'auth':_0x2e9342,'json':!![]};return rp(_0x1594f3)[_0x9dd3('0x28')](function(_0x221440){var _0xc73b8e=[];if(_0x221440[_0x9dd3('0x1c')][_0x9dd3('0x3a')]>0x0){_0x221440[_0x9dd3('0x1c')][_0x9dd3('0xa1')](function(_0x1cff29){if(_0x1cff29[_0x9dd3('0xae')]==='false'){var _0x2535f8={'name':_0x1cff29[_0x9dd3('0xaf')],'value':_0x1cff29[_0x9dd3('0xb0')]};_0xc73b8e[_0x9dd3('0xa2')](_0x2535f8);}});}_0x587b45['options']=_0xc73b8e;if(_0x587b45['options'][_0x9dd3('0x3a')]>0x0){_0x25cbe0(_0x587b45);}else{if(_0x28747e==![]){_0x25cbe0();}else{_0x25cbe0(_0x587b45);}}});}});} \ No newline at end of file +var _0xb345=['opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','findOne','password','email','remoteUri','substring','lastIndexOf','format','%s/api/now/table/','GET','result','log','assign','remove','forEach','push','all','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','json','offset','limit','set','reject','update','destroy','then','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','getConfigurations','order','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by'];(function(_0x3ffc19,_0x207411){var _0x536398=function(_0x1b8a32){while(--_0x1b8a32){_0x3ffc19['push'](_0x3ffc19['shift']());}};_0x536398(++_0x207411);}(_0xb345,0x116));var _0x5b34=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xb345[_0x311c35];return _0x5cc50c;};'use strict';var pdf=require(_0x5b34('0x0'));var emlformat=require(_0x5b34('0x1'));var rimraf=require(_0x5b34('0x2'));var zipdir=require(_0x5b34('0x3'));var jsonpatch=require(_0x5b34('0x4'));var rp=require(_0x5b34('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5b34('0x6'));var path=require(_0x5b34('0x7'));var sox=require('sox');var csv=require(_0x5b34('0x8'));var ejs=require(_0x5b34('0x9'));var fs=require('fs');var _=require(_0x5b34('0xa'));var squel=require('squel');var crypto=require(_0x5b34('0xb'));var jsforce=require(_0x5b34('0xc'));var deskjs=require(_0x5b34('0xd'));var toCsv=require(_0x5b34('0x8'));var querystring=require(_0x5b34('0xe'));var Papa=require(_0x5b34('0xf'));var Redis=require('ioredis');var authService=require(_0x5b34('0x10'));var qs=require(_0x5b34('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b34('0x12'))(_0x5b34('0x13'));var utils=require('../../config/utils');var config=require(_0x5b34('0x14'));var licenseUtil=require(_0x5b34('0x15'));var db=require(_0x5b34('0x16'))['db'];var integrations=require(_0x5b34('0x17'));var jayson=require(_0x5b34('0x18'));var client=jayson[_0x5b34('0x19')][_0x5b34('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x500985,_0x296ecc,_0x2dab8c,_0x1f7c14){return new BPromise(function(_0x3efaa5,_0x4549cc){var _0x5cf663=_0x1f7c14||client;return _0x5cf663[_0x5b34('0x1b')](_0x500985,_0x2dab8c)['then'](function(_0x3633c4){logger[_0x5b34('0x1c')](_0x5b34('0x1d'),_0x296ecc,_0x5b34('0x1e'));logger[_0x5b34('0x1f')](_0x5b34('0x20'),_0x296ecc,_0x5b34('0x1e'),JSON['stringify'](_0x3633c4));if(_0x3633c4[_0x5b34('0x21')]){if(_0x3633c4[_0x5b34('0x21')][_0x5b34('0x22')]===0x1f4){logger['error'](_0x5b34('0x1d'),_0x296ecc,_0x3633c4[_0x5b34('0x21')]['message']);return _0x4549cc(_0x3633c4[_0x5b34('0x21')][_0x5b34('0x23')]);}logger['error'](_0x5b34('0x1d'),_0x296ecc,_0x3633c4[_0x5b34('0x21')]['message']);return _0x3efaa5(_0x3633c4[_0x5b34('0x21')]['message']);}else{logger[_0x5b34('0x1c')](_0x5b34('0x1d'),_0x296ecc,'request\x20sent');_0x3efaa5(_0x3633c4['result'][_0x5b34('0x23')]);}})['catch'](function(_0xf3104){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x296ecc,_0xf3104);_0x4549cc(_0xf3104);});});}function respondWithStatusCode(_0x5a8761,_0x43fc1a){_0x43fc1a=_0x43fc1a||0xcc;return function(_0x38d5ed){if(_0x38d5ed){return _0x5a8761[_0x5b34('0x24')](_0x43fc1a);}return _0x5a8761[_0x5b34('0x25')](_0x43fc1a)['end']();};}function respondWithResult(_0x2b7cb7,_0x10f976){_0x10f976=_0x10f976||0xc8;return function(_0x1d006b){if(_0x1d006b){return _0x2b7cb7['status'](_0x10f976)[_0x5b34('0x26')](_0x1d006b);}};}function respondWithFilteredResult(_0x481fb5,_0x564646){return function(_0x137d57){if(_0x137d57){var _0x576b03=_0x137d57['count'],_0x49c863=_0x564646[_0x5b34('0x27')],_0x4913ab=_0x564646['offset']+_0x564646[_0x5b34('0x28')],_0x46e878;if(_0x4913ab>=_0x576b03){_0x4913ab=_0x576b03;_0x46e878=0xc8;}else{_0x46e878=0xce;}_0x481fb5['status'](_0x46e878);return _0x481fb5[_0x5b34('0x29')]('Content-Range',_0x49c863+'-'+_0x4913ab+'/'+_0x576b03)['json'](_0x137d57);}return null;};}function patchUpdates(_0x269b97){return function(_0x4b68b3){try{jsonpatch['apply'](_0x4b68b3,_0x269b97,!![]);}catch(_0x2ed68f){return BPromise[_0x5b34('0x2a')](_0x2ed68f);}return _0x4b68b3['save']();};}function saveUpdates(_0x40f043,_0x2d79d5){return function(_0x140901){if(_0x140901){return _0x140901[_0x5b34('0x2b')](_0x40f043)['then'](function(_0x804394){return _0x804394;});}return null;};}function removeEntity(_0x128d85,_0x338d6f){return function(_0x9c04fe){if(_0x9c04fe){return _0x9c04fe[_0x5b34('0x2c')]()[_0x5b34('0x2d')](function(){_0x128d85[_0x5b34('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4424bb,_0x5bc87c){return function(_0x22341a){if(!_0x22341a){_0x4424bb[_0x5b34('0x24')](0x194);}return _0x22341a;};}function handleError(_0x559b85,_0x4a6250){_0x4a6250=_0x4a6250||0x1f4;return function(_0x4d9752){logger[_0x5b34('0x21')](_0x4d9752[_0x5b34('0x2e')]);if(_0x4d9752[_0x5b34('0x2f')]){delete _0x4d9752[_0x5b34('0x2f')];}_0x559b85[_0x5b34('0x25')](_0x4a6250)[_0x5b34('0x30')](_0x4d9752);};}exports[_0x5b34('0x31')]=function(_0x965436,_0x109db6){var _0x3b0320={},_0x106343={},_0x20f995={'count':0x0,'rows':[]};var _0x3ef8df=_[_0x5b34('0x32')](db[_0x5b34('0x33')][_0x5b34('0x34')],function(_0x5cc93c){return{'name':_0x5cc93c[_0x5b34('0x35')],'type':_0x5cc93c[_0x5b34('0x36')][_0x5b34('0x37')]};});_0x106343['model']=_[_0x5b34('0x32')](_0x3ef8df,_0x5b34('0x2f'));_0x106343[_0x5b34('0x38')]=_['keys'](_0x965436[_0x5b34('0x38')]);_0x106343[_0x5b34('0x39')]=_['intersection'](_0x106343[_0x5b34('0x3a')],_0x106343[_0x5b34('0x38')]);_0x3b0320['attributes']=_[_0x5b34('0x3b')](_0x106343['model'],qs['fields'](_0x965436[_0x5b34('0x38')][_0x5b34('0x3c')]));_0x3b0320[_0x5b34('0x3d')]=_0x3b0320[_0x5b34('0x3d')][_0x5b34('0x3e')]?_0x3b0320['attributes']:_0x106343[_0x5b34('0x3a')];if(!_0x965436[_0x5b34('0x38')][_0x5b34('0x3f')]('nolimit')){_0x3b0320[_0x5b34('0x28')]=qs[_0x5b34('0x28')](_0x965436[_0x5b34('0x38')][_0x5b34('0x28')]);_0x3b0320[_0x5b34('0x27')]=qs[_0x5b34('0x27')](_0x965436['query'][_0x5b34('0x27')]);}_0x3b0320['order']=qs['sort'](_0x965436[_0x5b34('0x38')][_0x5b34('0x40')]);_0x3b0320[_0x5b34('0x41')]=qs[_0x5b34('0x39')](_['pick'](_0x965436[_0x5b34('0x38')],_0x106343[_0x5b34('0x39')]),_0x3ef8df);if(_0x965436[_0x5b34('0x38')]['filter']){_0x3b0320[_0x5b34('0x41')]=_[_0x5b34('0x42')](_0x3b0320[_0x5b34('0x41')],{'$or':_[_0x5b34('0x32')](_0x3ef8df,function(_0x14d3de){if(_0x14d3de[_0x5b34('0x36')]!==_0x5b34('0x43')){var _0x4eba19={};_0x4eba19[_0x14d3de[_0x5b34('0x2f')]]={'$like':'%'+_0x965436[_0x5b34('0x38')][_0x5b34('0x44')]+'%'};return _0x4eba19;}})});}_0x3b0320=_[_0x5b34('0x42')]({},_0x3b0320,_0x965436['options']);var _0x3e53e6={'where':_0x3b0320[_0x5b34('0x41')]};return db[_0x5b34('0x33')][_0x5b34('0x45')](_0x3e53e6)[_0x5b34('0x2d')](function(_0x4a5609){_0x20f995['count']=_0x4a5609;if(_0x965436['query'][_0x5b34('0x46')]){_0x3b0320[_0x5b34('0x47')]=[{'all':!![]}];}return db[_0x5b34('0x33')][_0x5b34('0x48')](_0x3b0320);})[_0x5b34('0x2d')](function(_0x523bc5){_0x20f995[_0x5b34('0x49')]=_0x523bc5;return _0x20f995;})[_0x5b34('0x2d')](respondWithFilteredResult(_0x109db6,_0x3b0320))['catch'](handleError(_0x109db6,null));};exports[_0x5b34('0x4a')]=function(_0x11a7f1,_0x81680f){var _0x55a8cd={'raw':![],'where':{'id':_0x11a7f1[_0x5b34('0x4b')]['id']}},_0x3ac710={};_0x3ac710[_0x5b34('0x3a')]=_[_0x5b34('0x4c')](db['ServicenowAccount']['rawAttributes']);_0x3ac710['query']=_['keys'](_0x11a7f1[_0x5b34('0x38')]);_0x3ac710[_0x5b34('0x39')]=_[_0x5b34('0x3b')](_0x3ac710[_0x5b34('0x3a')],_0x3ac710['query']);_0x55a8cd[_0x5b34('0x3d')]=_['intersection'](_0x3ac710[_0x5b34('0x3a')],qs[_0x5b34('0x3c')](_0x11a7f1['query'][_0x5b34('0x3c')]));_0x55a8cd[_0x5b34('0x3d')]=_0x55a8cd[_0x5b34('0x3d')][_0x5b34('0x3e')]?_0x55a8cd[_0x5b34('0x3d')]:_0x3ac710[_0x5b34('0x3a')];if(_0x11a7f1[_0x5b34('0x38')][_0x5b34('0x46')]){_0x55a8cd[_0x5b34('0x47')]=[{'all':!![]}];}_0x55a8cd=_[_0x5b34('0x42')]({},_0x55a8cd,_0x11a7f1[_0x5b34('0x4d')]);return db[_0x5b34('0x33')][_0x5b34('0x4e')](_0x55a8cd)[_0x5b34('0x2d')](handleEntityNotFound(_0x81680f,null))['then'](respondWithResult(_0x81680f,null))[_0x5b34('0x4f')](handleError(_0x81680f,null));};exports[_0x5b34('0x50')]=function(_0x1f4b4d,_0x2662b9){return db[_0x5b34('0x33')]['create'](_0x1f4b4d[_0x5b34('0x51')],{})[_0x5b34('0x2d')](respondWithResult(_0x2662b9,0xc9))['catch'](handleError(_0x2662b9,null));};exports[_0x5b34('0x2b')]=function(_0xdbc4b0,_0x5b035c){if(_0xdbc4b0[_0x5b34('0x51')]['id']){delete _0xdbc4b0['body']['id'];}return db['ServicenowAccount'][_0x5b34('0x4e')]({'where':{'id':_0xdbc4b0[_0x5b34('0x4b')]['id']}})[_0x5b34('0x2d')](handleEntityNotFound(_0x5b035c,null))[_0x5b34('0x2d')](saveUpdates(_0xdbc4b0[_0x5b34('0x51')],null))[_0x5b34('0x2d')](respondWithResult(_0x5b035c,null))[_0x5b34('0x4f')](handleError(_0x5b035c,null));};exports[_0x5b34('0x2c')]=function(_0x56361a,_0x1b1d53){return db['ServicenowAccount'][_0x5b34('0x4e')]({'where':{'id':_0x56361a['params']['id']}})['then'](handleEntityNotFound(_0x1b1d53,null))[_0x5b34('0x2d')](removeEntity(_0x1b1d53,null))[_0x5b34('0x4f')](handleError(_0x1b1d53,null));};exports[_0x5b34('0x52')]=function(_0x5eff7f,_0x58c0cf,_0x512adf){var _0x5a17c5={};var _0x4133c8={};var _0x17b8f0;var _0x4ef47c;return db[_0x5b34('0x33')]['findOne']({'where':{'id':_0x5eff7f[_0x5b34('0x4b')]['id']}})[_0x5b34('0x2d')](handleEntityNotFound(_0x58c0cf,null))[_0x5b34('0x2d')](function(_0x465091){if(_0x465091){_0x17b8f0=_0x465091;_0x4133c8[_0x5b34('0x3a')]=_[_0x5b34('0x4c')](db['ServicenowConfiguration'][_0x5b34('0x34')]);_0x4133c8[_0x5b34('0x38')]=_[_0x5b34('0x4c')](_0x5eff7f[_0x5b34('0x38')]);_0x4133c8[_0x5b34('0x39')]=_[_0x5b34('0x3b')](_0x4133c8['model'],_0x4133c8[_0x5b34('0x38')]);_0x5a17c5[_0x5b34('0x3d')]=_['intersection'](_0x4133c8['model'],qs[_0x5b34('0x3c')](_0x5eff7f[_0x5b34('0x38')]['fields']));_0x5a17c5['attributes']=_0x5a17c5['attributes'][_0x5b34('0x3e')]?_0x5a17c5[_0x5b34('0x3d')]:_0x4133c8[_0x5b34('0x3a')];_0x5a17c5[_0x5b34('0x53')]=qs['sort'](_0x5eff7f[_0x5b34('0x38')][_0x5b34('0x40')]);_0x5a17c5[_0x5b34('0x41')]=qs[_0x5b34('0x39')](_['pick'](_0x5eff7f['query'],_0x4133c8[_0x5b34('0x39')]));if(_0x5eff7f['query'][_0x5b34('0x44')]){_0x5a17c5[_0x5b34('0x41')]=_[_0x5b34('0x42')](_0x5a17c5['where'],{'$or':_[_0x5b34('0x32')](_0x5a17c5[_0x5b34('0x3d')],function(_0x4e7fa2){var _0x1860e0={};_0x1860e0[_0x4e7fa2]={'$like':'%'+_0x5eff7f[_0x5b34('0x38')][_0x5b34('0x44')]+'%'};return _0x1860e0;})});}_0x5a17c5=_[_0x5b34('0x42')]({},_0x5a17c5,_0x5eff7f['options']);return _0x17b8f0[_0x5b34('0x52')](_0x5a17c5);}})['then'](function(_0x2912e1){if(_0x2912e1){_0x4ef47c=_0x2912e1[_0x5b34('0x3e')];if(!_0x5eff7f['query'][_0x5b34('0x3f')](_0x5b34('0x54'))){_0x5a17c5[_0x5b34('0x28')]=qs[_0x5b34('0x28')](_0x5eff7f[_0x5b34('0x38')][_0x5b34('0x28')]);_0x5a17c5[_0x5b34('0x27')]=qs[_0x5b34('0x27')](_0x5eff7f[_0x5b34('0x38')][_0x5b34('0x27')]);}return _0x17b8f0['getConfigurations'](_0x5a17c5);}})['then'](function(_0x1817c5){if(_0x1817c5){return _0x1817c5?{'count':_0x4ef47c,'rows':_0x1817c5}:null;}})[_0x5b34('0x2d')](respondWithResult(_0x58c0cf,null))['catch'](handleError(_0x58c0cf,null));};exports['addConfiguration']=function(_0xf6fd73,_0x100c58,_0x149c40){if(_0xf6fd73['body']['id']){delete _0xf6fd73[_0x5b34('0x51')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0xf6fd73[_0x5b34('0x4b')]['id']}})[_0x5b34('0x2d')](handleEntityNotFound(_0x100c58,null))[_0x5b34('0x2d')](function(_0x237eba){if(_0x237eba){_0xf6fd73[_0x5b34('0x51')][_0x5b34('0x55')]=_0x237eba['id'];_0xf6fd73[_0x5b34('0x51')][_0x5b34('0x56')]=integrations[_0x5b34('0x57')](_0xf6fd73['body'][_0x5b34('0x58')],_0xf6fd73['body'][_0x5b34('0x36')]);_0xf6fd73[_0x5b34('0x51')][_0x5b34('0x59')]=integrations[_0x5b34('0x5a')](_0xf6fd73[_0x5b34('0x51')][_0x5b34('0x58')],_0xf6fd73[_0x5b34('0x51')][_0x5b34('0x36')]);return db[_0x5b34('0x5b')]['create'](_0xf6fd73['body'],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x5b34('0x59')}]});}return null;})[_0x5b34('0x2d')](respondWithResult(_0x100c58,null))['catch'](handleError(_0x100c58,null));};exports[_0x5b34('0x5c')]=function(_0x225736,_0x53b379,_0x166c81){var _0x22a351=[_0x5b34('0x5d'),_0x5b34('0x5e'),'knowledge',_0x5b34('0x5f'),_0x5b34('0x60'),_0x5b34('0x61'),_0x5b34('0x62'),'severity',_0x5b34('0x63')];var _0x259fa3=['parent',_0x5b34('0x5d'),_0x5b34('0x64'),_0x5b34('0x65'),_0x5b34('0x66'),_0x5b34('0x67'),_0x5b34('0x68'),_0x5b34('0x5e'),_0x5b34('0x69'),_0x5b34('0x6a'),'resolved_by',_0x5b34('0x6b'),_0x5b34('0x6c'),_0x5b34('0x6d'),_0x5b34('0x6e'),_0x5b34('0x6f'),_0x5b34('0x70'),_0x5b34('0x71'),_0x5b34('0x72'),_0x5b34('0x53'),_0x5b34('0x73'),_0x5b34('0x74'),_0x5b34('0x75'),'delivery_plan',_0x5b34('0x76'),_0x5b34('0x77'),_0x5b34('0x78'),_0x5b34('0x79'),_0x5b34('0x7a'),_0x5b34('0x7b'),_0x5b34('0x7c'),_0x5b34('0x7d'),_0x5b34('0x7e'),_0x5b34('0x7f'),'business_duration','group_list',_0x5b34('0x80'),_0x5b34('0x81'),'resolved_at',_0x5b34('0x82'),_0x5b34('0x83'),_0x5b34('0x5f'),_0x5b34('0x84'),_0x5b34('0x85'),'close_code',_0x5b34('0x86'),_0x5b34('0x87'),_0x5b34('0x88'),_0x5b34('0x89'),_0x5b34('0x8a'),'additional_assignee_list',_0x5b34('0x8b'),_0x5b34('0x8c'),_0x5b34('0x61'),_0x5b34('0x8d'),_0x5b34('0x8e'),_0x5b34('0x8f'),_0x5b34('0x90'),'parent_incident',_0x5b34('0x91'),_0x5b34('0x92'),_0x5b34('0x93'),_0x5b34('0x62'),_0x5b34('0x94'),_0x5b34('0x95'),_0x5b34('0x96'),_0x5b34('0x97'),_0x5b34('0x98'),'assigned_to','severity',_0x5b34('0x99'),'sla_due',_0x5b34('0x9a'),_0x5b34('0x9b'),_0x5b34('0x9c'),_0x5b34('0x9d'),_0x5b34('0x9e'),_0x5b34('0x9f'),_0x5b34('0xa0'),_0x5b34('0xa1'),'correlation_id',_0x5b34('0xa2'),'category'];var _0x55e419='';var _0x330216='';var _0x338398=[];var _0x510a2d='';var _0x2a0896='';var _0x2eabb3=[];var _0x7661b1='';var _0x228d64='';var _0x4fecf6={};var _0x2a53c7='';return db['ServicenowAccount'][_0x5b34('0xa3')]({'where':{'id':_0x225736[_0x5b34('0x4b')]['id']},'attributes':['id','username',_0x5b34('0xa4'),_0x5b34('0xa5'),_0x5b34('0xa6'),'serverUrl']})[_0x5b34('0x2d')](handleEntityNotFound(_0x53b379,null))[_0x5b34('0x2d')](function(_0x21274e){if(_0x21274e){_0x2a53c7=_0x21274e[_0x5b34('0xa6')];var _0x229306=_0x2a53c7['slice'](-0x1);if(_0x229306==='/'){_0x2a53c7=_0x2a53c7[_0x5b34('0xa7')](0x0,_0x2a53c7[_0x5b34('0xa8')](_0x229306));}_0x228d64=util['format']('%s/api/now/doc/table/schema/',_0x2a53c7);_0x7661b1=util[_0x5b34('0xa9')](_0x5b34('0xaa'),_0x2a53c7);_0x4fecf6={'user':_0x21274e['username'],'pass':_0x21274e[_0x5b34('0xa4')]};var _0x5e95e9={'method':_0x5b34('0xab'),'uri':_0x228d64+'incident?sysparm_display_value=all','auth':_0x4fecf6,'json':!![]};return rp(_0x5e95e9);}})['then'](function(_0x3d2980){if(_0x3d2980[_0x5b34('0xac')][_0x5b34('0x3e')]>0x0){_0x55e419=_0x3d2980[_0x5b34('0xac')];}console[_0x5b34('0xad')]('incident\x20table\x20objects',_0x55e419);_0x2eabb3=[];_0x330216=Object[_0x5b34('0xae')]([],_0x55e419);_[_0x5b34('0xaf')](_0x330216,function(_0x20d0e5){return!_0x22a351['includes'](_0x20d0e5[_0x5b34('0x2f')]);});_0x330216[_0x5b34('0xb0')](function(_0x3feb05){var _0x29f192=createFieldObject(_0x7661b1,_0x4fecf6,_0x3feb05['internalType'],_0x3feb05[_0x5b34('0x2f')],_0x3feb05['label'],![]);_0x2eabb3[_0x5b34('0xb1')](_0x29f192);});return Promise[_0x5b34('0xb2')](_0x2eabb3);})[_0x5b34('0x2d')](function(_0x1b563d){_0x338398=_0x1b563d;_0x510a2d=Object[_0x5b34('0xae')]([],_0x55e419);console[_0x5b34('0xad')]('TCL:\x20_object',_0x55e419);_[_0x5b34('0xaf')](_0x510a2d,function(_0x1bd3e4){return _0x259fa3[_0x5b34('0xb3')](_0x1bd3e4[_0x5b34('0x2f')]);});console[_0x5b34('0xad')](_0x5b34('0xb4'),_0x510a2d);_0x2eabb3=[];_0x510a2d[_0x5b34('0xb0')](function(_0x419eb3){var _0x50cd9a=createFieldObject(_0x7661b1,_0x4fecf6,_0x419eb3['internalType'],_0x419eb3[_0x5b34('0x2f')],_0x419eb3[_0x5b34('0xb5')],!![]);_0x2eabb3[_0x5b34('0xb1')](_0x50cd9a);});return Promise[_0x5b34('0xb2')](_0x2eabb3);})[_0x5b34('0x2d')](function(_0x459ef2){_0x2a0896=_0x459ef2;var _0xc98d1=_0x338398['concat'](_0x2a0896);return{'count':_0xc98d1[_0x5b34('0x3e')],'rows':_0xc98d1};})[_0x5b34('0x2d')](respondWithResult(_0x53b379,null))['catch'](function(_0x2708af){console[_0x5b34('0xad')](_0x5b34('0xb6')+_0x2708af);var _0x26e9e6=_0x225736['query'][_0x5b34('0xb7')]?0x1f4:_0x2708af[_0x5b34('0xb8')]||0x1f4;logger[_0x5b34('0x21')](_0x2708af[_0x5b34('0x2e')]);delete _0x2708af['name'];if(_0x26e9e6===0x191){_0x26e9e6=0x190;}_0x53b379[_0x5b34('0x25')](_0x26e9e6)[_0x5b34('0x30')](_0x225736['query'][_0x5b34('0xb7')]?{'message':_0x5b34('0xb9'),'statusCode':_0x2708af[_0x5b34('0xb8')]}:_0x2708af);});};function createFieldObject(_0x5040d4,_0x2f0bed,_0x3fcd65,_0x16ef11,_0x2506ed,_0x2fb20b){return new Promise(function(_0x172528,_0x3b78e6){var _0x2fb073={'id':_0x16ef11,'name':_0x2506ed,'custom':_0x2fb20b};if(_0x3fcd65===_0x5b34('0xba')){_0x2fb073['options']=[{'name':_0x5b34('0xbb'),'value':_0x5b34('0xbc')},{'name':_0x5b34('0xbd'),'value':'false'}];_0x172528(_0x2fb073);}else{var _0x1c954e={'method':'GET','uri':_0x5040d4+_0x5b34('0xbe')+_0x16ef11,'auth':_0x2f0bed,'json':!![]};return rp(_0x1c954e)['then'](function(_0x232648){var _0x42b9d2=[];if(_0x232648['result']['length']>0x0){_0x232648[_0x5b34('0xac')][_0x5b34('0xb0')](function(_0x37294f){if(_0x37294f[_0x5b34('0xbf')]===_0x5b34('0xc0')){var _0x1b0440={'name':_0x37294f[_0x5b34('0xb5')],'value':_0x37294f['value']};_0x42b9d2[_0x5b34('0xb1')](_0x1b0440);}});}_0x2fb073[_0x5b34('0x4d')]=_0x42b9d2;if(_0x2fb073[_0x5b34('0x4d')][_0x5b34('0x3e')]>0x0){_0x172528(_0x2fb073);}else{if(_0x2fb20b==![]){_0x172528();}else{_0x172528(_0x2fb073);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 214998f..a3445df 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 _0x0faf=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xcec00a,_0x487619){var _0x333fc2=function(_0x466666){while(--_0x466666){_0xcec00a['push'](_0xcec00a['shift']());}};_0x333fc2(++_0x487619);}(_0x0faf,0x132));var _0xf0fa=function(_0x6620b8,_0x8b3d5e){_0x6620b8=_0x6620b8-0x0;var _0x33de50=_0x0faf[_0x6620b8];return _0x33de50;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf0fa('0xa')]=function(_0x44ffa0,_0x25b5c4){return _0x44ffa0[_0xf0fa('0xb')](_0xf0fa('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7a3=['moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_servicenow_accounts','util','../../config/logger','api'];(function(_0x4b7026,_0x3160b6){var _0x19fff2=function(_0x9a21a){while(--_0x9a21a){_0x4b7026['push'](_0x4b7026['shift']());}};_0x19fff2(++_0x3160b6);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x49157d,_0x396dc8){_0x49157d=_0x49157d-0x0;var _0x4e3cf1=_0xc7a3[_0x49157d];return _0x4e3cf1;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var logger=require(_0x3c7a('0x1'))(_0x3c7a('0x2'));var moment=require(_0x3c7a('0x3'));var BPromise=require(_0x3c7a('0x4'));var rp=require(_0x3c7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x3c7a('0x8'));module[_0x3c7a('0x9')]=function(_0x2736c1,_0x48e820){return _0x2736c1[_0x3c7a('0xa')]('ServicenowAccount',attributes,{'tableName':_0x3c7a('0xb'),'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 b30ec71..91a06c3 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 _0xf5b8=['stringify','catch','ShowServicenowAccount','ServicenowAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','findAll','options','raw','where','limit','include','map','model','attributes','then','GetServicenowAccount'];(function(_0x4220e0,_0x38bffd){var _0x12e0e4=function(_0xfe381c){while(--_0xfe381c){_0x4220e0['push'](_0x4220e0['shift']());}};_0x12e0e4(++_0x38bffd);}(_0xf5b8,0x10c));var _0x8f5b=function(_0x1d7087,_0x3e0f13){_0x1d7087=_0x1d7087-0x0;var _0x2289e5=_0xf5b8[_0x1d7087];return _0x2289e5;};'use strict';var _=require(_0x8f5b('0x0'));var util=require(_0x8f5b('0x1'));var moment=require('moment');var BPromise=require(_0x8f5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f5b('0x3'));var db=require(_0x8f5b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f5b('0x5'))('rpc');var config=require(_0x8f5b('0x6'));var jayson=require(_0x8f5b('0x7'));var client=jayson[_0x8f5b('0x8')][_0x8f5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf9aab1,_0x4bdfd5,_0x3893f8){return new BPromise(function(_0x5720a8,_0x13a6ae){return client['request'](_0xf9aab1,_0x3893f8)['then'](function(_0x14c609){logger[_0x8f5b('0xa')](_0x8f5b('0xb'),_0x4bdfd5,_0x8f5b('0xc'));logger[_0x8f5b('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4bdfd5,_0x8f5b('0xc'),JSON['stringify'](_0x14c609));if(_0x14c609[_0x8f5b('0xe')]){if(_0x14c609[_0x8f5b('0xe')][_0x8f5b('0xf')]===0x1f4){logger[_0x8f5b('0xe')](_0x8f5b('0xb'),_0x4bdfd5,_0x14c609[_0x8f5b('0xe')][_0x8f5b('0x10')]);return _0x13a6ae(_0x14c609[_0x8f5b('0xe')][_0x8f5b('0x10')]);}logger['error'](_0x8f5b('0xb'),_0x4bdfd5,_0x14c609[_0x8f5b('0xe')][_0x8f5b('0x10')]);return _0x5720a8(_0x14c609[_0x8f5b('0xe')][_0x8f5b('0x10')]);}else{logger['info'](_0x8f5b('0xb'),_0x4bdfd5,_0x8f5b('0xc'));_0x5720a8(_0x14c609[_0x8f5b('0x11')][_0x8f5b('0x10')]);}})['catch'](function(_0x28a349){logger[_0x8f5b('0xe')](_0x8f5b('0xb'),_0x4bdfd5,_0x28a349);_0x13a6ae(_0x28a349);});});}exports['GetServicenowAccount']=function(_0x5eef0d){var _0x114172=this;return new Promise(function(_0x5846e2,_0x3558a6){return db['ServicenowAccount'][_0x8f5b('0x12')]({'raw':_0x5eef0d[_0x8f5b('0x13')]?_0x5eef0d[_0x8f5b('0x13')][_0x8f5b('0x14')]===undefined?!![]:![]:!![],'where':_0x5eef0d[_0x8f5b('0x13')]?_0x5eef0d[_0x8f5b('0x13')][_0x8f5b('0x15')]||null:null,'attributes':_0x5eef0d[_0x8f5b('0x13')]?_0x5eef0d[_0x8f5b('0x13')]['attributes']||null:null,'limit':_0x5eef0d[_0x8f5b('0x13')]?_0x5eef0d[_0x8f5b('0x13')][_0x8f5b('0x16')]||null:null,'include':_0x5eef0d[_0x8f5b('0x13')]?_0x5eef0d[_0x8f5b('0x13')][_0x8f5b('0x17')]?_[_0x8f5b('0x18')](_0x5eef0d[_0x8f5b('0x13')]['include'],function(_0x2f149e){return{'model':db[_0x2f149e[_0x8f5b('0x19')]],'as':_0x2f149e['as'],'attributes':_0x2f149e[_0x8f5b('0x1a')],'include':_0x2f149e[_0x8f5b('0x17')]?_[_0x8f5b('0x18')](_0x2f149e[_0x8f5b('0x17')],function(_0xa62f2a){return{'model':db[_0xa62f2a[_0x8f5b('0x19')]],'as':_0xa62f2a['as'],'attributes':_0xa62f2a[_0x8f5b('0x1a')],'include':_0xa62f2a['include']?_['map'](_0xa62f2a[_0x8f5b('0x17')],function(_0x5be921){return{'model':db[_0x5be921[_0x8f5b('0x19')]],'as':_0x5be921['as'],'attributes':_0x5be921[_0x8f5b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8f5b('0x1b')](function(_0x51a520){logger[_0x8f5b('0xa')](_0x8f5b('0x1c'),_0x5eef0d);logger[_0x8f5b('0xd')](_0x8f5b('0x1c'),_0x5eef0d,JSON[_0x8f5b('0x1d')](_0x51a520));_0x5846e2(_0x51a520);})[_0x8f5b('0x1e')](function(_0x4d908a){logger[_0x8f5b('0xe')](_0x8f5b('0x1c'),_0x4d908a[_0x8f5b('0x10')],_0x5eef0d);_0x3558a6(_0x114172['error'](0x1f4,_0x4d908a[_0x8f5b('0x10')]));});});};exports[_0x8f5b('0x1f')]=function(_0x596a7a){var _0x393b72=this;return new Promise(function(_0x33df69,_0x298527){return db[_0x8f5b('0x20')]['find']({'raw':_0x596a7a['options']?_0x596a7a[_0x8f5b('0x13')][_0x8f5b('0x14')]===undefined?!![]:![]:!![],'where':_0x596a7a['options']?_0x596a7a[_0x8f5b('0x13')][_0x8f5b('0x15')]||null:null,'attributes':_0x596a7a['options']?_0x596a7a[_0x8f5b('0x13')][_0x8f5b('0x1a')]||null:null,'include':_0x596a7a['options']?_0x596a7a[_0x8f5b('0x13')][_0x8f5b('0x17')]?_['map'](_0x596a7a['options'][_0x8f5b('0x17')],function(_0x54e6ce){return{'model':db[_0x54e6ce['model']],'as':_0x54e6ce['as'],'attributes':_0x54e6ce[_0x8f5b('0x1a')],'include':_0x54e6ce['include']?_[_0x8f5b('0x18')](_0x54e6ce[_0x8f5b('0x17')],function(_0x4bf232){return{'model':db[_0x4bf232[_0x8f5b('0x19')]],'as':_0x4bf232['as'],'attributes':_0x4bf232[_0x8f5b('0x1a')],'include':_0x4bf232[_0x8f5b('0x17')]?_[_0x8f5b('0x18')](_0x4bf232[_0x8f5b('0x17')],function(_0x5161f8){return{'model':db[_0x5161f8[_0x8f5b('0x19')]],'as':_0x5161f8['as'],'attributes':_0x5161f8[_0x8f5b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50eb59){logger[_0x8f5b('0xa')](_0x8f5b('0x1f'),_0x596a7a);logger[_0x8f5b('0xd')](_0x8f5b('0x1f'),_0x596a7a,JSON[_0x8f5b('0x1d')](_0x50eb59));_0x33df69(_0x50eb59);})[_0x8f5b('0x1e')](function(_0x79212e){logger[_0x8f5b('0xe')]('ShowServicenowAccount',_0x79212e[_0x8f5b('0x10')],_0x596a7a);_0x298527(_0x393b72['error'](0x1f4,_0x79212e['message']));});});}; \ No newline at end of file +var _0x48a1=['ServicenowAccount','find','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetServicenowAccount','options','where','limit','include','model','attributes','map','then','ShowServicenowAccount'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x48a1,0x8f));var _0x148a=function(_0x46be92,_0x3a772b){_0x46be92=_0x46be92-0x0;var _0x459798=_0x48a1[_0x46be92];return _0x459798;};'use strict';var _=require(_0x148a('0x0'));var util=require(_0x148a('0x1'));var moment=require(_0x148a('0x2'));var BPromise=require(_0x148a('0x3'));var rs=require(_0x148a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x148a('0x5'))['db'];var utils=require(_0x148a('0x6'));var logger=require(_0x148a('0x7'))('rpc');var config=require(_0x148a('0x8'));var jayson=require(_0x148a('0x9'));var client=jayson[_0x148a('0xa')][_0x148a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55df68,_0x4b5b71,_0x53e3e5){return new BPromise(function(_0x5ee004,_0x5b4be7){return client[_0x148a('0xc')](_0x55df68,_0x53e3e5)['then'](function(_0x180177){logger[_0x148a('0xd')](_0x148a('0xe'),_0x4b5b71,'request\x20sent');logger[_0x148a('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4b5b71,_0x148a('0x10'),JSON['stringify'](_0x180177));if(_0x180177[_0x148a('0x11')]){if(_0x180177[_0x148a('0x11')][_0x148a('0x12')]===0x1f4){logger['error'](_0x148a('0xe'),_0x4b5b71,_0x180177[_0x148a('0x11')][_0x148a('0x13')]);return _0x5b4be7(_0x180177[_0x148a('0x11')][_0x148a('0x13')]);}logger[_0x148a('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4b5b71,_0x180177[_0x148a('0x11')][_0x148a('0x13')]);return _0x5ee004(_0x180177[_0x148a('0x11')][_0x148a('0x13')]);}else{logger[_0x148a('0xd')](_0x148a('0xe'),_0x4b5b71,'request\x20sent');_0x5ee004(_0x180177[_0x148a('0x14')][_0x148a('0x13')]);}})[_0x148a('0x15')](function(_0x4562b6){logger[_0x148a('0x11')](_0x148a('0xe'),_0x4b5b71,_0x4562b6);_0x5b4be7(_0x4562b6);});});}exports[_0x148a('0x16')]=function(_0x563429){var _0x16aa39=this;return new Promise(function(_0xac1d7e,_0xd1a45d){return db['ServicenowAccount']['findAll']({'raw':_0x563429[_0x148a('0x17')]?_0x563429[_0x148a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x563429[_0x148a('0x17')]?_0x563429[_0x148a('0x17')][_0x148a('0x18')]||null:null,'attributes':_0x563429['options']?_0x563429[_0x148a('0x17')]['attributes']||null:null,'limit':_0x563429[_0x148a('0x17')]?_0x563429[_0x148a('0x17')][_0x148a('0x19')]||null:null,'include':_0x563429['options']?_0x563429[_0x148a('0x17')][_0x148a('0x1a')]?_['map'](_0x563429[_0x148a('0x17')]['include'],function(_0x24004e){return{'model':db[_0x24004e[_0x148a('0x1b')]],'as':_0x24004e['as'],'attributes':_0x24004e[_0x148a('0x1c')],'include':_0x24004e[_0x148a('0x1a')]?_[_0x148a('0x1d')](_0x24004e[_0x148a('0x1a')],function(_0x1d73ef){return{'model':db[_0x1d73ef['model']],'as':_0x1d73ef['as'],'attributes':_0x1d73ef['attributes'],'include':_0x1d73ef[_0x148a('0x1a')]?_[_0x148a('0x1d')](_0x1d73ef[_0x148a('0x1a')],function(_0x53c62e){return{'model':db[_0x53c62e['model']],'as':_0x53c62e['as'],'attributes':_0x53c62e[_0x148a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x148a('0x1e')](function(_0x365f8a){logger[_0x148a('0xd')](_0x148a('0x16'),_0x563429);logger[_0x148a('0xf')](_0x148a('0x16'),_0x563429,JSON['stringify'](_0x365f8a));_0xac1d7e(_0x365f8a);})[_0x148a('0x15')](function(_0x5b0b05){logger['error'](_0x148a('0x16'),_0x5b0b05['message'],_0x563429);_0xd1a45d(_0x16aa39['error'](0x1f4,_0x5b0b05[_0x148a('0x13')]));});});};exports[_0x148a('0x1f')]=function(_0x24d5c9){var _0x2627a8=this;return new Promise(function(_0x5d7a97,_0x2c2624){return db[_0x148a('0x20')][_0x148a('0x21')]({'raw':_0x24d5c9['options']?_0x24d5c9[_0x148a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x24d5c9[_0x148a('0x17')]?_0x24d5c9['options'][_0x148a('0x18')]||null:null,'attributes':_0x24d5c9[_0x148a('0x17')]?_0x24d5c9[_0x148a('0x17')][_0x148a('0x1c')]||null:null,'include':_0x24d5c9[_0x148a('0x17')]?_0x24d5c9[_0x148a('0x17')][_0x148a('0x1a')]?_[_0x148a('0x1d')](_0x24d5c9['options'][_0x148a('0x1a')],function(_0x14fcb2){return{'model':db[_0x14fcb2['model']],'as':_0x14fcb2['as'],'attributes':_0x14fcb2[_0x148a('0x1c')],'include':_0x14fcb2['include']?_[_0x148a('0x1d')](_0x14fcb2[_0x148a('0x1a')],function(_0x2df2b6){return{'model':db[_0x2df2b6[_0x148a('0x1b')]],'as':_0x2df2b6['as'],'attributes':_0x2df2b6[_0x148a('0x1c')],'include':_0x2df2b6[_0x148a('0x1a')]?_[_0x148a('0x1d')](_0x2df2b6[_0x148a('0x1a')],function(_0x3a8aba){return{'model':db[_0x3a8aba['model']],'as':_0x3a8aba['as'],'attributes':_0x3a8aba[_0x148a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x148a('0x1e')](function(_0x5db325){logger[_0x148a('0xd')](_0x148a('0x1f'),_0x24d5c9);logger['debug'](_0x148a('0x1f'),_0x24d5c9,JSON[_0x148a('0x22')](_0x5db325));_0x5d7a97(_0x5db325);})['catch'](function(_0x5c402f){logger['error'](_0x148a('0x1f'),_0x5c402f[_0x148a('0x13')],_0x24d5c9);_0x2c2624(_0x2627a8[_0x148a('0x11')](0x1f4,_0x5c402f['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f9f7aeb..a9a85b8 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 _0xcbeb=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x5df90,_0x3472ab){var _0x8b1477=function(_0x183d03){while(--_0x183d03){_0x5df90['push'](_0x5df90['shift']());}};_0x8b1477(++_0x3472ab);}(_0xcbeb,0x176));var _0xbcbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbeb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbcbe('0x0'));var util=require(_0xbcbe('0x1'));var path=require('path');var timeout=require(_0xbcbe('0x2'));var express=require('express');var router=express[_0xbcbe('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbcbe('0x4'));var config=require(_0xbcbe('0x5'));var controller=require(_0xbcbe('0x6'));router[_0xbcbe('0x7')]('/',auth[_0xbcbe('0x8')](),controller['index']);router[_0xbcbe('0x7')](_0xbcbe('0x9'),auth[_0xbcbe('0x8')](),controller[_0xbcbe('0xa')]);router['get'](_0xbcbe('0xb'),auth[_0xbcbe('0x8')](),controller[_0xbcbe('0xc')]);router['get'](_0xbcbe('0xd'),auth['isAuthenticated'](),controller[_0xbcbe('0xe')]);router['get'](_0xbcbe('0xf'),auth[_0xbcbe('0x8')](),controller['getDescriptions']);router[_0xbcbe('0x10')]('/',auth[_0xbcbe('0x8')](),controller[_0xbcbe('0x11')]);router[_0xbcbe('0x12')]('/:id',auth[_0xbcbe('0x8')](),controller[_0xbcbe('0x13')]);router[_0xbcbe('0x14')](_0xbcbe('0x9'),auth['isAuthenticated'](),controller[_0xbcbe('0x15')]);module[_0xbcbe('0x16')]=router; \ No newline at end of file +var _0x5054=['create','/:id','update','delete','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5054,0xa5));var _0x4505=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5054[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4505('0x0'));var express=require('express');var router=express[_0x4505('0x1')]();var auth=require(_0x4505('0x2'));var interaction=require(_0x4505('0x3'));var config=require(_0x4505('0x4'));var controller=require(_0x4505('0x5'));router[_0x4505('0x6')]('/',auth[_0x4505('0x7')](),controller[_0x4505('0x8')]);router[_0x4505('0x6')]('/:id',auth[_0x4505('0x7')](),controller['show']);router['get'](_0x4505('0x9'),auth[_0x4505('0x7')](),controller['getFields']);router['get'](_0x4505('0xa'),auth[_0x4505('0x7')](),controller[_0x4505('0xb')]);router[_0x4505('0x6')](_0x4505('0xc'),auth[_0x4505('0x7')](),controller[_0x4505('0xd')]);router[_0x4505('0xe')]('/',auth[_0x4505('0x7')](),controller[_0x4505('0xf')]);router['put'](_0x4505('0x10'),auth[_0x4505('0x7')](),controller[_0x4505('0x11')]);router[_0x4505('0x12')](_0x4505('0x10'),auth[_0x4505('0x7')](),controller['destroy']);module[_0x4505('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index cfb7deb..90ce6d2 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 _0xeacf=['sequelize','STRING'];(function(_0x118533,_0x4a16c3){var _0xfde3cd=function(_0x18305e){while(--_0x18305e){_0x118533['push'](_0x118533['shift']());}};_0xfde3cd(++_0x4a16c3);}(_0xeacf,0x1d6));var _0xfeac=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xeacf[_0x30b0d8];return _0x459c09;};'use strict';var Sequelize=require(_0xfeac('0x0'));module['exports']={'name':{'type':Sequelize[_0xfeac('0x1')]},'description':{'type':Sequelize[_0xfeac('0x1')]}}; \ No newline at end of file +var _0x0986=['sequelize','exports','STRING'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x0986,0x13b));var _0x6098=function(_0x4f9f38,_0x4b6a38){_0x4f9f38=_0x4f9f38-0x0;var _0x37bd8b=_0x0986[_0x4f9f38];return _0x37bd8b;};'use strict';var Sequelize=require(_0x6098('0x0'));module[_0x6098('0x1')]={'name':{'type':Sequelize[_0x6098('0x2')]},'description':{'type':Sequelize[_0x6098('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 9242570..1a3846c 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 _0x282f=['length','hasOwnProperty','nolimit','order','sort','pick','filter','type','VIRTUAL','ServicenowConfiguration','includeAll','include','show','params','keys','merge','options','find','create','getFields','findOne','ServicenowField','where','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x37e72d,_0x375c79){var _0x308633=function(_0x50da7f){while(--_0x50da7f){_0x37e72d['push'](_0x37e72d['shift']());}};_0x308633(++_0x375c79);}(_0x282f,0x70));var _0xf282=function(_0x26e4df,_0x385231){_0x26e4df=_0x26e4df-0x0;var _0x145a3c=_0x282f[_0x26e4df];return _0x145a3c;};'use strict';var pdf=require(_0xf282('0x0'));var emlformat=require(_0xf282('0x1'));var rimraf=require(_0xf282('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf282('0x3'));var rp=require(_0xf282('0x4'));var moment=require(_0xf282('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf282('0x6'));var util=require(_0xf282('0x7'));var path=require(_0xf282('0x8'));var sox=require(_0xf282('0x9'));var csv=require(_0xf282('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf282('0xb'));var crypto=require(_0xf282('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf282('0xd'));var toCsv=require(_0xf282('0xa'));var querystring=require(_0xf282('0xe'));var Papa=require(_0xf282('0xf'));var Redis=require(_0xf282('0x10'));var authService=require(_0xf282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf282('0x12'));var logger=require(_0xf282('0x13'))(_0xf282('0x14'));var utils=require('../../config/utils');var config=require(_0xf282('0x15'));var licenseUtil=require(_0xf282('0x16'));var db=require(_0xf282('0x17'))['db'];var jayson=require(_0xf282('0x18'));var client=jayson[_0xf282('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ae5ba,_0xd267a3,_0x3fda5d,_0x55409a){return new BPromise(function(_0x42329b,_0x17b05e){var _0x4e0a87=_0x55409a||client;return _0x4e0a87[_0xf282('0x1a')](_0x5ae5ba,_0x3fda5d)['then'](function(_0x476403){logger[_0xf282('0x1b')](_0xf282('0x1c'),_0xd267a3,_0xf282('0x1d'));logger['debug'](_0xf282('0x1e'),_0xd267a3,'request\x20sent',JSON['stringify'](_0x476403));if(_0x476403['error']){if(_0x476403[_0xf282('0x1f')][_0xf282('0x20')]===0x1f4){logger[_0xf282('0x1f')](_0xf282('0x1c'),_0xd267a3,_0x476403['error'][_0xf282('0x21')]);return _0x17b05e(_0x476403[_0xf282('0x1f')]['message']);}logger[_0xf282('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0xd267a3,_0x476403[_0xf282('0x1f')][_0xf282('0x21')]);return _0x42329b(_0x476403[_0xf282('0x1f')]['message']);}else{logger['info'](_0xf282('0x1c'),_0xd267a3,_0xf282('0x1d'));_0x42329b(_0x476403[_0xf282('0x22')][_0xf282('0x21')]);}})[_0xf282('0x23')](function(_0x1ec04d){logger[_0xf282('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0xd267a3,_0x1ec04d);_0x17b05e(_0x1ec04d);});});}function respondWithStatusCode(_0x54a74b,_0x252d30){_0x252d30=_0x252d30||0xcc;return function(_0x386f1f){if(_0x386f1f){return _0x54a74b[_0xf282('0x24')](_0x252d30);}return _0x54a74b[_0xf282('0x25')](_0x252d30)[_0xf282('0x26')]();};}function respondWithResult(_0x26f97a,_0x562598){_0x562598=_0x562598||0xc8;return function(_0x159b73){if(_0x159b73){return _0x26f97a[_0xf282('0x25')](_0x562598)['json'](_0x159b73);}};}function respondWithFilteredResult(_0x40c691,_0x3285a1){return function(_0x3ea2e9){if(_0x3ea2e9){var _0x58a5f6=_0x3ea2e9[_0xf282('0x27')],_0x2a832d=_0x3285a1['offset'],_0x2f14b8=_0x3285a1[_0xf282('0x28')]+_0x3285a1[_0xf282('0x29')],_0x7116df;if(_0x2f14b8>=_0x58a5f6){_0x2f14b8=_0x58a5f6;_0x7116df=0xc8;}else{_0x7116df=0xce;}_0x40c691['status'](_0x7116df);return _0x40c691[_0xf282('0x2a')](_0xf282('0x2b'),_0x2a832d+'-'+_0x2f14b8+'/'+_0x58a5f6)[_0xf282('0x2c')](_0x3ea2e9);}return null;};}function patchUpdates(_0x197dad){return function(_0x3d82fb){try{jsonpatch[_0xf282('0x2d')](_0x3d82fb,_0x197dad,!![]);}catch(_0x477f85){return BPromise[_0xf282('0x2e')](_0x477f85);}return _0x3d82fb['save']();};}function saveUpdates(_0x1c9446,_0x85cfe2){return function(_0x55e6a1){if(_0x55e6a1){return _0x55e6a1[_0xf282('0x2f')](_0x1c9446)['then'](function(_0x4de479){return _0x4de479;});}return null;};}function removeEntity(_0x3e3aa4,_0x353a2c){return function(_0xfd9aaa){if(_0xfd9aaa){return _0xfd9aaa[_0xf282('0x30')]()[_0xf282('0x31')](function(){_0x3e3aa4[_0xf282('0x25')](0xcc)[_0xf282('0x26')]();});}};}function handleEntityNotFound(_0x3b8521,_0x12207c){return function(_0x22af6b){if(!_0x22af6b){_0x3b8521[_0xf282('0x24')](0x194);}return _0x22af6b;};}function handleError(_0x5243a7,_0x1b80c7){_0x1b80c7=_0x1b80c7||0x1f4;return function(_0x1e2d04){logger['error'](_0x1e2d04[_0xf282('0x32')]);if(_0x1e2d04[_0xf282('0x33')]){delete _0x1e2d04[_0xf282('0x33')];}_0x5243a7[_0xf282('0x25')](_0x1b80c7)['send'](_0x1e2d04);};}exports[_0xf282('0x34')]=function(_0x35ad09,_0x42bb9a){var _0xbffce1={},_0x5882fe={},_0x2369bb={'count':0x0,'rows':[]};var _0xd4ca7b=_['map'](db['ServicenowConfiguration'][_0xf282('0x35')],function(_0x808015){return{'name':_0x808015['fieldName'],'type':_0x808015['type'][_0xf282('0x36')]};});_0x5882fe[_0xf282('0x37')]=_[_0xf282('0x38')](_0xd4ca7b,_0xf282('0x33'));_0x5882fe[_0xf282('0x39')]=_['keys'](_0x35ad09[_0xf282('0x39')]);_0x5882fe[_0xf282('0x3a')]=_[_0xf282('0x3b')](_0x5882fe['model'],_0x5882fe[_0xf282('0x39')]);_0xbffce1[_0xf282('0x3c')]=_[_0xf282('0x3b')](_0x5882fe['model'],qs[_0xf282('0x3d')](_0x35ad09['query']['fields']));_0xbffce1['attributes']=_0xbffce1['attributes'][_0xf282('0x3e')]?_0xbffce1['attributes']:_0x5882fe[_0xf282('0x37')];if(!_0x35ad09['query'][_0xf282('0x3f')](_0xf282('0x40'))){_0xbffce1['limit']=qs['limit'](_0x35ad09[_0xf282('0x39')][_0xf282('0x29')]);_0xbffce1[_0xf282('0x28')]=qs[_0xf282('0x28')](_0x35ad09[_0xf282('0x39')][_0xf282('0x28')]);}_0xbffce1[_0xf282('0x41')]=qs[_0xf282('0x42')](_0x35ad09[_0xf282('0x39')][_0xf282('0x42')]);_0xbffce1['where']=qs[_0xf282('0x3a')](_[_0xf282('0x43')](_0x35ad09[_0xf282('0x39')],_0x5882fe[_0xf282('0x3a')]),_0xd4ca7b);if(_0x35ad09[_0xf282('0x39')][_0xf282('0x44')]){_0xbffce1['where']=_['merge'](_0xbffce1['where'],{'$or':_['map'](_0xd4ca7b,function(_0x2a746d){if(_0x2a746d[_0xf282('0x45')]!==_0xf282('0x46')){var _0x264d65={};_0x264d65[_0x2a746d[_0xf282('0x33')]]={'$like':'%'+_0x35ad09[_0xf282('0x39')][_0xf282('0x44')]+'%'};return _0x264d65;}})});}_0xbffce1=_['merge']({},_0xbffce1,_0x35ad09['options']);var _0x34f09b={'where':_0xbffce1['where']};return db[_0xf282('0x47')][_0xf282('0x27')](_0x34f09b)[_0xf282('0x31')](function(_0x352c22){_0x2369bb[_0xf282('0x27')]=_0x352c22;if(_0x35ad09['query'][_0xf282('0x48')]){_0xbffce1[_0xf282('0x49')]=[{'all':!![]}];}return db[_0xf282('0x47')]['findAll'](_0xbffce1);})[_0xf282('0x31')](function(_0x5b4bd5){_0x2369bb['rows']=_0x5b4bd5;return _0x2369bb;})['then'](respondWithFilteredResult(_0x42bb9a,_0xbffce1))[_0xf282('0x23')](handleError(_0x42bb9a,null));};exports[_0xf282('0x4a')]=function(_0x33f936,_0x257cf4){var _0xc5ae7b={'raw':![],'where':{'id':_0x33f936[_0xf282('0x4b')]['id']}},_0x2ed5b6={};_0x2ed5b6[_0xf282('0x37')]=_['keys'](db[_0xf282('0x47')][_0xf282('0x35')]);_0x2ed5b6[_0xf282('0x39')]=_[_0xf282('0x4c')](_0x33f936[_0xf282('0x39')]);_0x2ed5b6[_0xf282('0x3a')]=_[_0xf282('0x3b')](_0x2ed5b6['model'],_0x2ed5b6[_0xf282('0x39')]);_0xc5ae7b[_0xf282('0x3c')]=_[_0xf282('0x3b')](_0x2ed5b6[_0xf282('0x37')],qs[_0xf282('0x3d')](_0x33f936[_0xf282('0x39')][_0xf282('0x3d')]));_0xc5ae7b['attributes']=_0xc5ae7b[_0xf282('0x3c')]['length']?_0xc5ae7b[_0xf282('0x3c')]:_0x2ed5b6[_0xf282('0x37')];if(_0x33f936[_0xf282('0x39')][_0xf282('0x48')]){_0xc5ae7b[_0xf282('0x49')]=[{'all':!![]}];}_0xc5ae7b=_[_0xf282('0x4d')]({},_0xc5ae7b,_0x33f936[_0xf282('0x4e')]);return db[_0xf282('0x47')][_0xf282('0x4f')](_0xc5ae7b)[_0xf282('0x31')](handleEntityNotFound(_0x257cf4,null))[_0xf282('0x31')](respondWithResult(_0x257cf4,null))[_0xf282('0x23')](handleError(_0x257cf4,null));};exports[_0xf282('0x50')]=function(_0x5890a6,_0x6f86){return db['ServicenowConfiguration'][_0xf282('0x50')](_0x5890a6['body'],{})[_0xf282('0x31')](respondWithResult(_0x6f86,0xc9))[_0xf282('0x23')](handleError(_0x6f86,null));};exports['update']=function(_0x4a588f,_0xd261db){if(_0x4a588f['body']['id']){delete _0x4a588f['body']['id'];}return db[_0xf282('0x47')][_0xf282('0x4f')]({'where':{'id':_0x4a588f['params']['id']}})[_0xf282('0x31')](handleEntityNotFound(_0xd261db,null))[_0xf282('0x31')](saveUpdates(_0x4a588f['body'],null))[_0xf282('0x31')](respondWithResult(_0xd261db,null))[_0xf282('0x23')](handleError(_0xd261db,null));};exports['destroy']=function(_0x47b5f4,_0x4c50b5){return db[_0xf282('0x47')][_0xf282('0x4f')]({'where':{'id':_0x47b5f4[_0xf282('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c50b5,null))[_0xf282('0x31')](removeEntity(_0x4c50b5,null))[_0xf282('0x23')](handleError(_0x4c50b5,null));};exports[_0xf282('0x51')]=function(_0x17735d,_0x759157,_0x3fc215){var _0x598195={};var _0xcbd21a={};var _0x51ebb7;var _0xdcf388;return db[_0xf282('0x47')][_0xf282('0x52')]({'where':{'id':_0x17735d[_0xf282('0x4b')]['id']}})['then'](handleEntityNotFound(_0x759157,null))[_0xf282('0x31')](function(_0x2d3a51){if(_0x2d3a51){_0x51ebb7=_0x2d3a51;_0xcbd21a[_0xf282('0x37')]=_['keys'](db[_0xf282('0x53')][_0xf282('0x35')]);_0xcbd21a[_0xf282('0x39')]=_[_0xf282('0x4c')](_0x17735d[_0xf282('0x39')]);_0xcbd21a['filters']=_[_0xf282('0x3b')](_0xcbd21a['model'],_0xcbd21a['query']);_0x598195['attributes']=_[_0xf282('0x3b')](_0xcbd21a[_0xf282('0x37')],qs[_0xf282('0x3d')](_0x17735d[_0xf282('0x39')][_0xf282('0x3d')]));_0x598195[_0xf282('0x3c')]=_0x598195[_0xf282('0x3c')][_0xf282('0x3e')]?_0x598195[_0xf282('0x3c')]:_0xcbd21a[_0xf282('0x37')];_0x598195[_0xf282('0x41')]=qs[_0xf282('0x42')](_0x17735d[_0xf282('0x39')][_0xf282('0x42')]);_0x598195[_0xf282('0x54')]=qs[_0xf282('0x3a')](_[_0xf282('0x43')](_0x17735d[_0xf282('0x39')],_0xcbd21a[_0xf282('0x3a')]));if(_0x17735d['query'][_0xf282('0x44')]){_0x598195[_0xf282('0x54')]=_['merge'](_0x598195['where'],{'$or':_[_0xf282('0x38')](_0x598195[_0xf282('0x3c')],function(_0x4ce7d6){var _0x840a14={};_0x840a14[_0x4ce7d6]={'$like':'%'+_0x17735d['query']['filter']+'%'};return _0x840a14;})});}_0x598195=_[_0xf282('0x4d')]({},_0x598195,_0x17735d['options']);return _0x51ebb7[_0xf282('0x51')](_0x598195);}})[_0xf282('0x31')](function(_0x33d2fb){if(_0x33d2fb){_0xdcf388=_0x33d2fb['length'];if(!_0x17735d[_0xf282('0x39')]['hasOwnProperty']('nolimit')){_0x598195[_0xf282('0x29')]=qs['limit'](_0x17735d['query'][_0xf282('0x29')]);_0x598195['offset']=qs[_0xf282('0x28')](_0x17735d[_0xf282('0x39')]['offset']);}return _0x51ebb7['getFields'](_0x598195);}})[_0xf282('0x31')](function(_0x7f4dc3){if(_0x7f4dc3){return _0x7f4dc3?{'count':_0xdcf388,'rows':_0x7f4dc3}:null;}})[_0xf282('0x31')](respondWithResult(_0x759157,null))[_0xf282('0x23')](handleError(_0x759157,null));};exports['getSubjects']=function(_0x3c60c3,_0x443dc8,_0x57a40c){var _0x2bc081={};var _0x45ea39={};var _0x219951;var _0x5aeca3;return db[_0xf282('0x47')][_0xf282('0x52')]({'where':{'id':_0x3c60c3[_0xf282('0x4b')]['id']}})[_0xf282('0x31')](handleEntityNotFound(_0x443dc8,null))['then'](function(_0x4b389a){if(_0x4b389a){_0x219951=_0x4b389a;_0x45ea39[_0xf282('0x37')]=_[_0xf282('0x4c')](db[_0xf282('0x53')][_0xf282('0x35')]);_0x45ea39['query']=_[_0xf282('0x4c')](_0x3c60c3[_0xf282('0x39')]);_0x45ea39[_0xf282('0x3a')]=_[_0xf282('0x3b')](_0x45ea39[_0xf282('0x37')],_0x45ea39[_0xf282('0x39')]);_0x2bc081['attributes']=_[_0xf282('0x3b')](_0x45ea39[_0xf282('0x37')],qs[_0xf282('0x3d')](_0x3c60c3[_0xf282('0x39')]['fields']));_0x2bc081[_0xf282('0x3c')]=_0x2bc081[_0xf282('0x3c')][_0xf282('0x3e')]?_0x2bc081[_0xf282('0x3c')]:_0x45ea39[_0xf282('0x37')];_0x2bc081[_0xf282('0x41')]=qs[_0xf282('0x42')](_0x3c60c3[_0xf282('0x39')][_0xf282('0x42')]);_0x2bc081[_0xf282('0x54')]=qs[_0xf282('0x3a')](_[_0xf282('0x43')](_0x3c60c3[_0xf282('0x39')],_0x45ea39[_0xf282('0x3a')]));if(_0x3c60c3[_0xf282('0x39')][_0xf282('0x44')]){_0x2bc081[_0xf282('0x54')]=_[_0xf282('0x4d')](_0x2bc081['where'],{'$or':_[_0xf282('0x38')](_0x2bc081[_0xf282('0x3c')],function(_0x41f6aa){var _0x789dc8={};_0x789dc8[_0x41f6aa]={'$like':'%'+_0x3c60c3['query'][_0xf282('0x44')]+'%'};return _0x789dc8;})});}_0x2bc081=_[_0xf282('0x4d')]({},_0x2bc081,_0x3c60c3[_0xf282('0x4e')]);return _0x219951[_0xf282('0x55')](_0x2bc081);}})[_0xf282('0x31')](function(_0xc6eee6){if(_0xc6eee6){_0x5aeca3=_0xc6eee6[_0xf282('0x3e')];if(!_0x3c60c3[_0xf282('0x39')][_0xf282('0x3f')]('nolimit')){_0x2bc081['limit']=qs['limit'](_0x3c60c3[_0xf282('0x39')][_0xf282('0x29')]);_0x2bc081['offset']=qs[_0xf282('0x28')](_0x3c60c3[_0xf282('0x39')]['offset']);}return _0x219951[_0xf282('0x55')](_0x2bc081);}})[_0xf282('0x31')](function(_0x5f3859){if(_0x5f3859){return _0x5f3859?{'count':_0x5aeca3,'rows':_0x5f3859}:null;}})['then'](respondWithResult(_0x443dc8,null))[_0xf282('0x23')](handleError(_0x443dc8,null));};exports[_0xf282('0x56')]=function(_0x1a6428,_0x30de43,_0x33a654){var _0x279f76={};var _0x14e9c2={};var _0xd6a98;var _0x27cf19;return db[_0xf282('0x47')][_0xf282('0x52')]({'where':{'id':_0x1a6428['params']['id']}})['then'](handleEntityNotFound(_0x30de43,null))[_0xf282('0x31')](function(_0x5c94b7){if(_0x5c94b7){_0xd6a98=_0x5c94b7;_0x14e9c2[_0xf282('0x37')]=_['keys'](db['ServicenowField'][_0xf282('0x35')]);_0x14e9c2[_0xf282('0x39')]=_[_0xf282('0x4c')](_0x1a6428[_0xf282('0x39')]);_0x14e9c2[_0xf282('0x3a')]=_[_0xf282('0x3b')](_0x14e9c2[_0xf282('0x37')],_0x14e9c2['query']);_0x279f76[_0xf282('0x3c')]=_[_0xf282('0x3b')](_0x14e9c2['model'],qs[_0xf282('0x3d')](_0x1a6428[_0xf282('0x39')][_0xf282('0x3d')]));_0x279f76[_0xf282('0x3c')]=_0x279f76[_0xf282('0x3c')][_0xf282('0x3e')]?_0x279f76['attributes']:_0x14e9c2[_0xf282('0x37')];_0x279f76[_0xf282('0x41')]=qs[_0xf282('0x42')](_0x1a6428[_0xf282('0x39')][_0xf282('0x42')]);_0x279f76[_0xf282('0x54')]=qs[_0xf282('0x3a')](_['pick'](_0x1a6428[_0xf282('0x39')],_0x14e9c2['filters']));if(_0x1a6428[_0xf282('0x39')][_0xf282('0x44')]){_0x279f76[_0xf282('0x54')]=_[_0xf282('0x4d')](_0x279f76['where'],{'$or':_['map'](_0x279f76[_0xf282('0x3c')],function(_0x26ca9b){var _0x730c0={};_0x730c0[_0x26ca9b]={'$like':'%'+_0x1a6428[_0xf282('0x39')]['filter']+'%'};return _0x730c0;})});}_0x279f76=_['merge']({},_0x279f76,_0x1a6428[_0xf282('0x4e')]);return _0xd6a98['getDescriptions'](_0x279f76);}})[_0xf282('0x31')](function(_0x146cb0){if(_0x146cb0){_0x27cf19=_0x146cb0[_0xf282('0x3e')];if(!_0x1a6428[_0xf282('0x39')][_0xf282('0x3f')]('nolimit')){_0x279f76['limit']=qs[_0xf282('0x29')](_0x1a6428[_0xf282('0x39')][_0xf282('0x29')]);_0x279f76[_0xf282('0x28')]=qs[_0xf282('0x28')](_0x1a6428['query'][_0xf282('0x28')]);}return _0xd6a98[_0xf282('0x56')](_0x279f76);}})[_0xf282('0x31')](function(_0x5d6296){if(_0x5d6296){return _0x5d6296?{'count':_0x27cf19,'rows':_0x5d6296}:null;}})[_0xf282('0x31')](respondWithResult(_0x30de43,null))[_0xf282('0x23')](handleError(_0x30de43,null));}; \ No newline at end of file +var _0xd62b=['result','catch','sendStatus','status','count','offset','limit','Content-Range','json','reject','destroy','end','stack','name','index','ServicenowConfiguration','type','key','map','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','getFields','findOne','rawAttributes','getSubjects','getDescriptions','ServicenowField','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x4bc4c4,_0x5d6c2c){var _0x2b5b13=function(_0x991e28){while(--_0x991e28){_0x4bc4c4['push'](_0x4bc4c4['shift']());}};_0x2b5b13(++_0x5d6c2c);}(_0xd62b,0x8c));var _0xbd62=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0xd62b[_0x53b594];return _0x1e616f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbd62('0x0'));var zipdir=require(_0xbd62('0x1'));var jsonpatch=require(_0xbd62('0x2'));var rp=require('request-promise');var moment=require(_0xbd62('0x3'));var BPromise=require(_0xbd62('0x4'));var Mustache=require(_0xbd62('0x5'));var util=require(_0xbd62('0x6'));var path=require(_0xbd62('0x7'));var sox=require(_0xbd62('0x8'));var csv=require(_0xbd62('0x9'));var ejs=require(_0xbd62('0xa'));var fs=require('fs');var _=require(_0xbd62('0xb'));var squel=require('squel');var crypto=require(_0xbd62('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbd62('0x9'));var querystring=require(_0xbd62('0xd'));var Papa=require(_0xbd62('0xe'));var Redis=require(_0xbd62('0xf'));var authService=require(_0xbd62('0x10'));var qs=require(_0xbd62('0x11'));var as=require(_0xbd62('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbd62('0x13'));var utils=require(_0xbd62('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd62('0x15'));var db=require(_0xbd62('0x16'))['db'];var jayson=require(_0xbd62('0x17'));var client=jayson[_0xbd62('0x18')][_0xbd62('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3d74b6,_0x5968df,_0x42997e,_0x351594){return new BPromise(function(_0x17146f,_0x54527b){var _0x10d00c=_0x351594||client;return _0x10d00c[_0xbd62('0x1a')](_0x3d74b6,_0x42997e)[_0xbd62('0x1b')](function(_0x5cd7e0){logger['info'](_0xbd62('0x1c'),_0x5968df,_0xbd62('0x1d'));logger[_0xbd62('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5968df,'request\x20sent',JSON[_0xbd62('0x1f')](_0x5cd7e0));if(_0x5cd7e0[_0xbd62('0x20')]){if(_0x5cd7e0[_0xbd62('0x20')][_0xbd62('0x21')]===0x1f4){logger[_0xbd62('0x20')](_0xbd62('0x1c'),_0x5968df,_0x5cd7e0['error'][_0xbd62('0x22')]);return _0x54527b(_0x5cd7e0['error']['message']);}logger[_0xbd62('0x20')](_0xbd62('0x1c'),_0x5968df,_0x5cd7e0[_0xbd62('0x20')]['message']);return _0x17146f(_0x5cd7e0[_0xbd62('0x20')][_0xbd62('0x22')]);}else{logger[_0xbd62('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5968df,_0xbd62('0x1d'));_0x17146f(_0x5cd7e0[_0xbd62('0x24')][_0xbd62('0x22')]);}})[_0xbd62('0x25')](function(_0x35238a){logger[_0xbd62('0x20')](_0xbd62('0x1c'),_0x5968df,_0x35238a);_0x54527b(_0x35238a);});});}function respondWithStatusCode(_0x1bca75,_0x328868){_0x328868=_0x328868||0xcc;return function(_0x1b8fbe){if(_0x1b8fbe){return _0x1bca75[_0xbd62('0x26')](_0x328868);}return _0x1bca75[_0xbd62('0x27')](_0x328868)['end']();};}function respondWithResult(_0x28fabc,_0x3e1222){_0x3e1222=_0x3e1222||0xc8;return function(_0x5c512b){if(_0x5c512b){return _0x28fabc['status'](_0x3e1222)['json'](_0x5c512b);}};}function respondWithFilteredResult(_0x568f6e,_0xdf69aa){return function(_0x55359a){if(_0x55359a){var _0x582a0e=_0x55359a[_0xbd62('0x28')],_0x34bcc3=_0xdf69aa[_0xbd62('0x29')],_0x2077a9=_0xdf69aa[_0xbd62('0x29')]+_0xdf69aa[_0xbd62('0x2a')],_0x361089;if(_0x2077a9>=_0x582a0e){_0x2077a9=_0x582a0e;_0x361089=0xc8;}else{_0x361089=0xce;}_0x568f6e[_0xbd62('0x27')](_0x361089);return _0x568f6e['set'](_0xbd62('0x2b'),_0x34bcc3+'-'+_0x2077a9+'/'+_0x582a0e)[_0xbd62('0x2c')](_0x55359a);}return null;};}function patchUpdates(_0x2340eb){return function(_0x1a58d5){try{jsonpatch['apply'](_0x1a58d5,_0x2340eb,!![]);}catch(_0x2e500a){return BPromise[_0xbd62('0x2d')](_0x2e500a);}return _0x1a58d5['save']();};}function saveUpdates(_0x404342,_0x2f300e){return function(_0x4878c3){if(_0x4878c3){return _0x4878c3['update'](_0x404342)[_0xbd62('0x1b')](function(_0x117952){return _0x117952;});}return null;};}function removeEntity(_0x50d01c,_0x3a326b){return function(_0x230b82){if(_0x230b82){return _0x230b82[_0xbd62('0x2e')]()[_0xbd62('0x1b')](function(){_0x50d01c[_0xbd62('0x27')](0xcc)[_0xbd62('0x2f')]();});}};}function handleEntityNotFound(_0xd9871a,_0x15ff71){return function(_0x1e0b19){if(!_0x1e0b19){_0xd9871a[_0xbd62('0x26')](0x194);}return _0x1e0b19;};}function handleError(_0x4f57d2,_0x3d8465){_0x3d8465=_0x3d8465||0x1f4;return function(_0x389f3a){logger['error'](_0x389f3a[_0xbd62('0x30')]);if(_0x389f3a[_0xbd62('0x31')]){delete _0x389f3a[_0xbd62('0x31')];}_0x4f57d2[_0xbd62('0x27')](_0x3d8465)['send'](_0x389f3a);};}exports[_0xbd62('0x32')]=function(_0x4b7346,_0x2d9acc){var _0x2f9e9d={},_0x1086bd={},_0x1a27e3={'count':0x0,'rows':[]};var _0x33ce37=_['map'](db[_0xbd62('0x33')]['rawAttributes'],function(_0xec8aa1){return{'name':_0xec8aa1['fieldName'],'type':_0xec8aa1[_0xbd62('0x34')][_0xbd62('0x35')]};});_0x1086bd['model']=_[_0xbd62('0x36')](_0x33ce37,_0xbd62('0x31'));_0x1086bd[_0xbd62('0x37')]=_[_0xbd62('0x38')](_0x4b7346['query']);_0x1086bd['filters']=_[_0xbd62('0x39')](_0x1086bd['model'],_0x1086bd[_0xbd62('0x37')]);_0x2f9e9d[_0xbd62('0x3a')]=_[_0xbd62('0x39')](_0x1086bd[_0xbd62('0x3b')],qs['fields'](_0x4b7346[_0xbd62('0x37')][_0xbd62('0x3c')]));_0x2f9e9d['attributes']=_0x2f9e9d['attributes']['length']?_0x2f9e9d['attributes']:_0x1086bd[_0xbd62('0x3b')];if(!_0x4b7346[_0xbd62('0x37')][_0xbd62('0x3d')](_0xbd62('0x3e'))){_0x2f9e9d[_0xbd62('0x2a')]=qs[_0xbd62('0x2a')](_0x4b7346[_0xbd62('0x37')][_0xbd62('0x2a')]);_0x2f9e9d[_0xbd62('0x29')]=qs['offset'](_0x4b7346[_0xbd62('0x37')]['offset']);}_0x2f9e9d[_0xbd62('0x3f')]=qs[_0xbd62('0x40')](_0x4b7346['query'][_0xbd62('0x40')]);_0x2f9e9d['where']=qs[_0xbd62('0x41')](_[_0xbd62('0x42')](_0x4b7346['query'],_0x1086bd['filters']),_0x33ce37);if(_0x4b7346['query'][_0xbd62('0x43')]){_0x2f9e9d[_0xbd62('0x44')]=_[_0xbd62('0x45')](_0x2f9e9d[_0xbd62('0x44')],{'$or':_[_0xbd62('0x36')](_0x33ce37,function(_0xa90dd){if(_0xa90dd[_0xbd62('0x34')]!==_0xbd62('0x46')){var _0x5406f8={};_0x5406f8[_0xa90dd[_0xbd62('0x31')]]={'$like':'%'+_0x4b7346[_0xbd62('0x37')][_0xbd62('0x43')]+'%'};return _0x5406f8;}})});}_0x2f9e9d=_[_0xbd62('0x45')]({},_0x2f9e9d,_0x4b7346[_0xbd62('0x47')]);var _0x1474a3={'where':_0x2f9e9d[_0xbd62('0x44')]};return db[_0xbd62('0x33')][_0xbd62('0x28')](_0x1474a3)[_0xbd62('0x1b')](function(_0x4f0986){_0x1a27e3['count']=_0x4f0986;if(_0x4b7346[_0xbd62('0x37')][_0xbd62('0x48')]){_0x2f9e9d[_0xbd62('0x49')]=[{'all':!![]}];}return db[_0xbd62('0x33')][_0xbd62('0x4a')](_0x2f9e9d);})[_0xbd62('0x1b')](function(_0x506d3d){_0x1a27e3[_0xbd62('0x4b')]=_0x506d3d;return _0x1a27e3;})[_0xbd62('0x1b')](respondWithFilteredResult(_0x2d9acc,_0x2f9e9d))[_0xbd62('0x25')](handleError(_0x2d9acc,null));};exports[_0xbd62('0x4c')]=function(_0x31a116,_0x45c35f){var _0x248699={'raw':![],'where':{'id':_0x31a116[_0xbd62('0x4d')]['id']}},_0x28b201={};_0x28b201[_0xbd62('0x3b')]=_[_0xbd62('0x38')](db[_0xbd62('0x33')]['rawAttributes']);_0x28b201[_0xbd62('0x37')]=_[_0xbd62('0x38')](_0x31a116[_0xbd62('0x37')]);_0x28b201[_0xbd62('0x41')]=_[_0xbd62('0x39')](_0x28b201['model'],_0x28b201[_0xbd62('0x37')]);_0x248699['attributes']=_[_0xbd62('0x39')](_0x28b201[_0xbd62('0x3b')],qs['fields'](_0x31a116[_0xbd62('0x37')][_0xbd62('0x3c')]));_0x248699[_0xbd62('0x3a')]=_0x248699[_0xbd62('0x3a')][_0xbd62('0x4e')]?_0x248699['attributes']:_0x28b201['model'];if(_0x31a116[_0xbd62('0x37')]['includeAll']){_0x248699[_0xbd62('0x49')]=[{'all':!![]}];}_0x248699=_[_0xbd62('0x45')]({},_0x248699,_0x31a116[_0xbd62('0x47')]);return db[_0xbd62('0x33')][_0xbd62('0x4f')](_0x248699)[_0xbd62('0x1b')](handleEntityNotFound(_0x45c35f,null))[_0xbd62('0x1b')](respondWithResult(_0x45c35f,null))[_0xbd62('0x25')](handleError(_0x45c35f,null));};exports[_0xbd62('0x50')]=function(_0x776195,_0xb3f4b6){return db['ServicenowConfiguration'][_0xbd62('0x50')](_0x776195[_0xbd62('0x51')],{})[_0xbd62('0x1b')](respondWithResult(_0xb3f4b6,0xc9))[_0xbd62('0x25')](handleError(_0xb3f4b6,null));};exports['update']=function(_0x37f364,_0x1bc630){if(_0x37f364['body']['id']){delete _0x37f364['body']['id'];}return db[_0xbd62('0x33')][_0xbd62('0x4f')]({'where':{'id':_0x37f364[_0xbd62('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1bc630,null))[_0xbd62('0x1b')](saveUpdates(_0x37f364['body'],null))[_0xbd62('0x1b')](respondWithResult(_0x1bc630,null))[_0xbd62('0x25')](handleError(_0x1bc630,null));};exports['destroy']=function(_0x187fb4,_0x4fdbc4){return db[_0xbd62('0x33')][_0xbd62('0x4f')]({'where':{'id':_0x187fb4[_0xbd62('0x4d')]['id']}})[_0xbd62('0x1b')](handleEntityNotFound(_0x4fdbc4,null))['then'](removeEntity(_0x4fdbc4,null))[_0xbd62('0x25')](handleError(_0x4fdbc4,null));};exports[_0xbd62('0x52')]=function(_0x312080,_0x1ec2c9,_0x5763c9){var _0x2b3898={};var _0x17eae5={};var _0x3d42ce;var _0x5501ee;return db[_0xbd62('0x33')][_0xbd62('0x53')]({'where':{'id':_0x312080['params']['id']}})[_0xbd62('0x1b')](handleEntityNotFound(_0x1ec2c9,null))['then'](function(_0x39d74f){if(_0x39d74f){_0x3d42ce=_0x39d74f;_0x17eae5['model']=_[_0xbd62('0x38')](db['ServicenowField'][_0xbd62('0x54')]);_0x17eae5['query']=_[_0xbd62('0x38')](_0x312080['query']);_0x17eae5[_0xbd62('0x41')]=_['intersection'](_0x17eae5['model'],_0x17eae5[_0xbd62('0x37')]);_0x2b3898[_0xbd62('0x3a')]=_['intersection'](_0x17eae5[_0xbd62('0x3b')],qs['fields'](_0x312080[_0xbd62('0x37')][_0xbd62('0x3c')]));_0x2b3898[_0xbd62('0x3a')]=_0x2b3898[_0xbd62('0x3a')]['length']?_0x2b3898[_0xbd62('0x3a')]:_0x17eae5[_0xbd62('0x3b')];_0x2b3898['order']=qs[_0xbd62('0x40')](_0x312080[_0xbd62('0x37')][_0xbd62('0x40')]);_0x2b3898[_0xbd62('0x44')]=qs[_0xbd62('0x41')](_[_0xbd62('0x42')](_0x312080[_0xbd62('0x37')],_0x17eae5[_0xbd62('0x41')]));if(_0x312080[_0xbd62('0x37')]['filter']){_0x2b3898[_0xbd62('0x44')]=_[_0xbd62('0x45')](_0x2b3898[_0xbd62('0x44')],{'$or':_[_0xbd62('0x36')](_0x2b3898['attributes'],function(_0x2d5a66){var _0x2948ac={};_0x2948ac[_0x2d5a66]={'$like':'%'+_0x312080[_0xbd62('0x37')][_0xbd62('0x43')]+'%'};return _0x2948ac;})});}_0x2b3898=_[_0xbd62('0x45')]({},_0x2b3898,_0x312080[_0xbd62('0x47')]);return _0x3d42ce[_0xbd62('0x52')](_0x2b3898);}})[_0xbd62('0x1b')](function(_0xb58b51){if(_0xb58b51){_0x5501ee=_0xb58b51[_0xbd62('0x4e')];if(!_0x312080[_0xbd62('0x37')]['hasOwnProperty']('nolimit')){_0x2b3898[_0xbd62('0x2a')]=qs[_0xbd62('0x2a')](_0x312080[_0xbd62('0x37')]['limit']);_0x2b3898['offset']=qs['offset'](_0x312080[_0xbd62('0x37')][_0xbd62('0x29')]);}return _0x3d42ce[_0xbd62('0x52')](_0x2b3898);}})['then'](function(_0x5b2d21){if(_0x5b2d21){return _0x5b2d21?{'count':_0x5501ee,'rows':_0x5b2d21}:null;}})[_0xbd62('0x1b')](respondWithResult(_0x1ec2c9,null))[_0xbd62('0x25')](handleError(_0x1ec2c9,null));};exports['getSubjects']=function(_0x31bb06,_0x5ebdf3,_0x5d9efc){var _0xc95b36={};var _0x549170={};var _0x27a24b;var _0x1058fa;return db[_0xbd62('0x33')][_0xbd62('0x53')]({'where':{'id':_0x31bb06[_0xbd62('0x4d')]['id']}})[_0xbd62('0x1b')](handleEntityNotFound(_0x5ebdf3,null))['then'](function(_0x5f2111){if(_0x5f2111){_0x27a24b=_0x5f2111;_0x549170[_0xbd62('0x3b')]=_['keys'](db['ServicenowField'][_0xbd62('0x54')]);_0x549170['query']=_['keys'](_0x31bb06[_0xbd62('0x37')]);_0x549170['filters']=_[_0xbd62('0x39')](_0x549170[_0xbd62('0x3b')],_0x549170[_0xbd62('0x37')]);_0xc95b36[_0xbd62('0x3a')]=_['intersection'](_0x549170['model'],qs['fields'](_0x31bb06[_0xbd62('0x37')]['fields']));_0xc95b36[_0xbd62('0x3a')]=_0xc95b36[_0xbd62('0x3a')][_0xbd62('0x4e')]?_0xc95b36[_0xbd62('0x3a')]:_0x549170[_0xbd62('0x3b')];_0xc95b36['order']=qs[_0xbd62('0x40')](_0x31bb06[_0xbd62('0x37')][_0xbd62('0x40')]);_0xc95b36[_0xbd62('0x44')]=qs[_0xbd62('0x41')](_[_0xbd62('0x42')](_0x31bb06[_0xbd62('0x37')],_0x549170[_0xbd62('0x41')]));if(_0x31bb06[_0xbd62('0x37')][_0xbd62('0x43')]){_0xc95b36[_0xbd62('0x44')]=_[_0xbd62('0x45')](_0xc95b36[_0xbd62('0x44')],{'$or':_[_0xbd62('0x36')](_0xc95b36['attributes'],function(_0x1138ac){var _0x5eaa8a={};_0x5eaa8a[_0x1138ac]={'$like':'%'+_0x31bb06[_0xbd62('0x37')][_0xbd62('0x43')]+'%'};return _0x5eaa8a;})});}_0xc95b36=_['merge']({},_0xc95b36,_0x31bb06[_0xbd62('0x47')]);return _0x27a24b['getSubjects'](_0xc95b36);}})[_0xbd62('0x1b')](function(_0x1553ef){if(_0x1553ef){_0x1058fa=_0x1553ef['length'];if(!_0x31bb06[_0xbd62('0x37')]['hasOwnProperty'](_0xbd62('0x3e'))){_0xc95b36['limit']=qs[_0xbd62('0x2a')](_0x31bb06[_0xbd62('0x37')][_0xbd62('0x2a')]);_0xc95b36['offset']=qs[_0xbd62('0x29')](_0x31bb06[_0xbd62('0x37')][_0xbd62('0x29')]);}return _0x27a24b[_0xbd62('0x55')](_0xc95b36);}})[_0xbd62('0x1b')](function(_0x2881a8){if(_0x2881a8){return _0x2881a8?{'count':_0x1058fa,'rows':_0x2881a8}:null;}})[_0xbd62('0x1b')](respondWithResult(_0x5ebdf3,null))[_0xbd62('0x25')](handleError(_0x5ebdf3,null));};exports[_0xbd62('0x56')]=function(_0x48127f,_0x5b947a,_0x52b020){var _0xe6fe52={};var _0x3df30b={};var _0xcfd590;var _0x522be7;return db[_0xbd62('0x33')][_0xbd62('0x53')]({'where':{'id':_0x48127f[_0xbd62('0x4d')]['id']}})[_0xbd62('0x1b')](handleEntityNotFound(_0x5b947a,null))[_0xbd62('0x1b')](function(_0x19a0eb){if(_0x19a0eb){_0xcfd590=_0x19a0eb;_0x3df30b['model']=_[_0xbd62('0x38')](db[_0xbd62('0x57')][_0xbd62('0x54')]);_0x3df30b[_0xbd62('0x37')]=_[_0xbd62('0x38')](_0x48127f[_0xbd62('0x37')]);_0x3df30b['filters']=_[_0xbd62('0x39')](_0x3df30b[_0xbd62('0x3b')],_0x3df30b[_0xbd62('0x37')]);_0xe6fe52[_0xbd62('0x3a')]=_[_0xbd62('0x39')](_0x3df30b[_0xbd62('0x3b')],qs[_0xbd62('0x3c')](_0x48127f['query'][_0xbd62('0x3c')]));_0xe6fe52[_0xbd62('0x3a')]=_0xe6fe52[_0xbd62('0x3a')][_0xbd62('0x4e')]?_0xe6fe52[_0xbd62('0x3a')]:_0x3df30b['model'];_0xe6fe52[_0xbd62('0x3f')]=qs['sort'](_0x48127f['query'][_0xbd62('0x40')]);_0xe6fe52['where']=qs[_0xbd62('0x41')](_['pick'](_0x48127f[_0xbd62('0x37')],_0x3df30b['filters']));if(_0x48127f[_0xbd62('0x37')][_0xbd62('0x43')]){_0xe6fe52[_0xbd62('0x44')]=_['merge'](_0xe6fe52[_0xbd62('0x44')],{'$or':_[_0xbd62('0x36')](_0xe6fe52[_0xbd62('0x3a')],function(_0x33ad65){var _0x39f0db={};_0x39f0db[_0x33ad65]={'$like':'%'+_0x48127f['query'][_0xbd62('0x43')]+'%'};return _0x39f0db;})});}_0xe6fe52=_[_0xbd62('0x45')]({},_0xe6fe52,_0x48127f[_0xbd62('0x47')]);return _0xcfd590[_0xbd62('0x56')](_0xe6fe52);}})[_0xbd62('0x1b')](function(_0x2c3fc5){if(_0x2c3fc5){_0x522be7=_0x2c3fc5['length'];if(!_0x48127f['query']['hasOwnProperty'](_0xbd62('0x3e'))){_0xe6fe52[_0xbd62('0x2a')]=qs[_0xbd62('0x2a')](_0x48127f['query'][_0xbd62('0x2a')]);_0xe6fe52[_0xbd62('0x29')]=qs[_0xbd62('0x29')](_0x48127f[_0xbd62('0x37')][_0xbd62('0x29')]);}return _0xcfd590[_0xbd62('0x56')](_0xe6fe52);}})['then'](function(_0x58e827){if(_0x58e827){return _0x58e827?{'count':_0x522be7,'rows':_0x58e827}:null;}})[_0xbd62('0x1b')](respondWithResult(_0x5b947a,null))['catch'](handleError(_0x5b947a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 150e8c2..a24d255 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 _0xe912=['int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','ServicenowConfiguration'];(function(_0x55fea7,_0x14e3cc){var _0x320c9f=function(_0x3beb04){while(--_0x3beb04){_0x55fea7['push'](_0x55fea7['shift']());}};_0x320c9f(++_0x14e3cc);}(_0xe912,0x65));var _0x2e91=function(_0x34d9a0,_0x2efbd7){_0x34d9a0=_0x34d9a0-0x0;var _0xcd3bc7=_0xe912[_0x34d9a0];return _0xcd3bc7;};'use strict';var _=require(_0x2e91('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2e91('0x1'));var moment=require(_0x2e91('0x2'));var BPromise=require(_0x2e91('0x3'));var rp=require(_0x2e91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e91('0x5'));var config=require(_0x2e91('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x2e91('0x7')]=function(_0x4636ae,_0x5b89e4){return _0x4636ae['define'](_0x2e91('0x8'),attributes,{'tableName':_0x2e91('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdffe=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0xdffe,0x109));var _0xedff=function(_0x5436a1,_0x43ce08){_0x5436a1=_0x5436a1-0x0;var _0x46c586=_0xdffe[_0x5436a1];return _0x46c586;};'use strict';var _=require(_0xedff('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xedff('0x1'));var moment=require(_0xedff('0x2'));var BPromise=require(_0xedff('0x3'));var rp=require(_0xedff('0x4'));var fs=require('fs');var path=require(_0xedff('0x5'));var rimraf=require(_0xedff('0x6'));var config=require(_0xedff('0x7'));var attributes=require(_0xedff('0x8'));module[_0xedff('0x9')]=function(_0x51c9d1,_0x17fa32){return _0x51c9d1[_0xedff('0xa')](_0xedff('0xb'),attributes,{'tableName':_0xedff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 3f6020a..fbca460 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 _0x2e30=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b0057,_0x3a98d6){var _0x31a70e=function(_0x1330d8){while(--_0x1330d8){_0x1b0057['push'](_0x1b0057['shift']());}};_0x31a70e(++_0x3a98d6);}(_0x2e30,0x1bc));var _0x02e3=function(_0x7887c3,_0x30c060){_0x7887c3=_0x7887c3-0x0;var _0xc7f10d=_0x2e30[_0x7887c3];return _0xc7f10d;};'use strict';var _=require(_0x02e3('0x0'));var util=require(_0x02e3('0x1'));var moment=require('moment');var BPromise=require(_0x02e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02e3('0x3'))['db'];var utils=require(_0x02e3('0x4'));var logger=require(_0x02e3('0x5'))(_0x02e3('0x6'));var config=require(_0x02e3('0x7'));var jayson=require(_0x02e3('0x8'));var client=jayson[_0x02e3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d95ac,_0x5792ff,_0xe1f5f2){return new BPromise(function(_0x38d695,_0x387826){return client[_0x02e3('0xa')](_0x1d95ac,_0xe1f5f2)[_0x02e3('0xb')](function(_0x3fec70){logger[_0x02e3('0xc')](_0x02e3('0xd'),_0x5792ff,_0x02e3('0xe'));logger[_0x02e3('0xf')](_0x02e3('0x10'),_0x5792ff,_0x02e3('0xe'),JSON[_0x02e3('0x11')](_0x3fec70));if(_0x3fec70['error']){if(_0x3fec70[_0x02e3('0x12')][_0x02e3('0x13')]===0x1f4){logger[_0x02e3('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5792ff,_0x3fec70[_0x02e3('0x12')][_0x02e3('0x14')]);return _0x387826(_0x3fec70[_0x02e3('0x12')][_0x02e3('0x14')]);}logger[_0x02e3('0x12')](_0x02e3('0xd'),_0x5792ff,_0x3fec70[_0x02e3('0x12')][_0x02e3('0x14')]);return _0x38d695(_0x3fec70[_0x02e3('0x12')]['message']);}else{logger[_0x02e3('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5792ff,_0x02e3('0xe'));_0x38d695(_0x3fec70[_0x02e3('0x15')][_0x02e3('0x14')]);}})[_0x02e3('0x16')](function(_0x3bb541){logger['error'](_0x02e3('0xd'),_0x5792ff,_0x3bb541);_0x387826(_0x3bb541);});});} \ No newline at end of file +var _0x175e=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x175e,0x12a));var _0xe175=function(_0x168e31,_0x578d5c){_0x168e31=_0x168e31-0x0;var _0x9a683=_0x175e[_0x168e31];return _0x9a683;};'use strict';var _=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var moment=require(_0xe175('0x2'));var BPromise=require(_0xe175('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe175('0x4'));var db=require(_0xe175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe175('0x6'))(_0xe175('0x7'));var config=require(_0xe175('0x8'));var jayson=require(_0xe175('0x9'));var client=jayson[_0xe175('0xa')][_0xe175('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39905f,_0x232384,_0x41434e){return new BPromise(function(_0x30b77d,_0x2b9a72){return client['request'](_0x39905f,_0x41434e)[_0xe175('0xc')](function(_0x4cbbe6){logger[_0xe175('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x232384,_0xe175('0xe'));logger[_0xe175('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x232384,'request\x20sent',JSON[_0xe175('0x10')](_0x4cbbe6));if(_0x4cbbe6['error']){if(_0x4cbbe6[_0xe175('0x11')][_0xe175('0x12')]===0x1f4){logger[_0xe175('0x11')](_0xe175('0x13'),_0x232384,_0x4cbbe6[_0xe175('0x11')][_0xe175('0x14')]);return _0x2b9a72(_0x4cbbe6[_0xe175('0x11')][_0xe175('0x14')]);}logger[_0xe175('0x11')](_0xe175('0x13'),_0x232384,_0x4cbbe6[_0xe175('0x11')][_0xe175('0x14')]);return _0x30b77d(_0x4cbbe6['error'][_0xe175('0x14')]);}else{logger[_0xe175('0xd')](_0xe175('0x13'),_0x232384,_0xe175('0xe'));_0x30b77d(_0x4cbbe6[_0xe175('0x15')][_0xe175('0x14')]);}})[_0xe175('0x16')](function(_0x599dd7){logger[_0xe175('0x11')](_0xe175('0x13'),_0x232384,_0x599dd7);_0x2b9a72(_0x599dd7);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3c35057..e542877 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 _0x208a=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x8639c5,_0x38ce0c){var _0x5972c3=function(_0x5bce3d){while(--_0x5bce3d){_0x8639c5['push'](_0x8639c5['shift']());}};_0x5972c3(++_0x38ce0c);}(_0x208a,0x120));var _0xa208=function(_0x17e82b,_0x408574){_0x17e82b=_0x17e82b-0x0;var _0x3131b6=_0x208a[_0x17e82b];return _0x3131b6;};'use strict';var multer=require(_0xa208('0x0'));var util=require('util');var path=require(_0xa208('0x1'));var timeout=require('connect-timeout');var express=require(_0xa208('0x2'));var router=express[_0xa208('0x3')]();var auth=require(_0xa208('0x4'));var interaction=require(_0xa208('0x5'));var config=require('../../config/environment');var controller=require(_0xa208('0x6'));router['get']('/',auth[_0xa208('0x7')](),controller[_0xa208('0x8')]);router[_0xa208('0x9')](_0xa208('0xa'),auth[_0xa208('0x7')](),controller[_0xa208('0xb')]);router[_0xa208('0xc')]('/',auth[_0xa208('0x7')](),controller[_0xa208('0xd')]);router[_0xa208('0xe')](_0xa208('0xa'),auth['isAuthenticated'](),controller[_0xa208('0xf')]);router[_0xa208('0x10')](_0xa208('0xa'),auth[_0xa208('0x7')](),controller[_0xa208('0x11')]);module[_0xa208('0x12')]=router; \ No newline at end of file +var _0xadb6=['../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router'];(function(_0x367a33,_0x77adfa){var _0x7b2731=function(_0xe61bb8){while(--_0xe61bb8){_0x367a33['push'](_0x367a33['shift']());}};_0x7b2731(++_0x77adfa);}(_0xadb6,0xc8));var _0x6adb=function(_0x5d4d93,_0x3b58a5){_0x5d4d93=_0x5d4d93-0x0;var _0x302890=_0xadb6[_0x5d4d93];return _0x302890;};'use strict';var multer=require('multer');var util=require(_0x6adb('0x0'));var path=require(_0x6adb('0x1'));var timeout=require(_0x6adb('0x2'));var express=require('express');var router=express[_0x6adb('0x3')]();var auth=require(_0x6adb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6adb('0x5'));var controller=require(_0x6adb('0x6'));router[_0x6adb('0x7')]('/',auth[_0x6adb('0x8')](),controller['index']);router[_0x6adb('0x7')](_0x6adb('0x9'),auth[_0x6adb('0x8')](),controller[_0x6adb('0xa')]);router[_0x6adb('0xb')]('/',auth[_0x6adb('0x8')](),controller[_0x6adb('0xc')]);router[_0x6adb('0xd')](_0x6adb('0x9'),auth[_0x6adb('0x8')](),controller[_0x6adb('0xe')]);router[_0x6adb('0xf')](_0x6adb('0x9'),auth[_0x6adb('0x8')](),controller['destroy']);module[_0x6adb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 802f046..ed85233 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 _0x2ec0=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x13941a,_0x34bb36){var _0x14645c=function(_0x26002f){while(--_0x26002f){_0x13941a['push'](_0x13941a['shift']());}};_0x14645c(++_0x34bb36);}(_0x2ec0,0x69));var _0x02ec=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x2ec0[_0x21ecc8];return _0x510c1d;};'use strict';var Sequelize=require(_0x02ec('0x0'));module[_0x02ec('0x1')]={'type':{'type':Sequelize[_0x02ec('0x2')](_0x02ec('0x3'),'variable',_0x02ec('0x4'),_0x02ec('0x5')),'defaultValue':_0x02ec('0x3')},'content':{'type':Sequelize[_0x02ec('0x6')]},'key':{'type':Sequelize[_0x02ec('0x6')]},'keyType':{'type':Sequelize[_0x02ec('0x2')](_0x02ec('0x3'),_0x02ec('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x02ec('0x6')]},'idField':{'type':Sequelize[_0x02ec('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x02ec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x02ec('0x6')]}}; \ No newline at end of file +var _0x2ac4=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x4eb3a6,_0x3502c3){var _0x37132f=function(_0x4ef3e4){while(--_0x4ef3e4){_0x4eb3a6['push'](_0x4eb3a6['shift']());}};_0x37132f(++_0x3502c3);}(_0x2ac4,0x130));var _0x42ac=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0x2ac4[_0xca1091];return _0xd3019c;};'use strict';var Sequelize=require(_0x42ac('0x0'));module[_0x42ac('0x1')]={'type':{'type':Sequelize[_0x42ac('0x2')](_0x42ac('0x3'),_0x42ac('0x4'),_0x42ac('0x5'),_0x42ac('0x6')),'defaultValue':_0x42ac('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x42ac('0x7')]},'keyType':{'type':Sequelize[_0x42ac('0x2')](_0x42ac('0x3'),_0x42ac('0x4'),_0x42ac('0x5'))},'keyContent':{'type':Sequelize[_0x42ac('0x7')]},'idField':{'type':Sequelize[_0x42ac('0x7')]},'nameField':{'type':Sequelize[_0x42ac('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 078cd16..cc13576 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 _0xbf77=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','ServicenowField','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','fields','options','find'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xbf77,0xec));var _0x7bf7=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xbf77[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0x7bf7('0x0'));var emlformat=require(_0x7bf7('0x1'));var rimraf=require(_0x7bf7('0x2'));var zipdir=require(_0x7bf7('0x3'));var jsonpatch=require(_0x7bf7('0x4'));var rp=require(_0x7bf7('0x5'));var moment=require(_0x7bf7('0x6'));var BPromise=require(_0x7bf7('0x7'));var Mustache=require('mustache');var util=require(_0x7bf7('0x8'));var path=require(_0x7bf7('0x9'));var sox=require(_0x7bf7('0xa'));var csv=require('to-csv');var ejs=require(_0x7bf7('0xb'));var fs=require('fs');var _=require(_0x7bf7('0xc'));var squel=require('squel');var crypto=require(_0x7bf7('0xd'));var jsforce=require(_0x7bf7('0xe'));var deskjs=require(_0x7bf7('0xf'));var toCsv=require(_0x7bf7('0x10'));var querystring=require('querystring');var Papa=require(_0x7bf7('0x11'));var Redis=require(_0x7bf7('0x12'));var authService=require(_0x7bf7('0x13'));var qs=require(_0x7bf7('0x14'));var as=require(_0x7bf7('0x15'));var hardwareService=require(_0x7bf7('0x16'));var logger=require(_0x7bf7('0x17'))(_0x7bf7('0x18'));var utils=require(_0x7bf7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7bf7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358af0,_0x20b1e7){_0x20b1e7=_0x20b1e7||0xcc;return function(_0x4df560){if(_0x4df560){return _0x358af0[_0x7bf7('0x1b')](_0x20b1e7);}return _0x358af0[_0x7bf7('0x1c')](_0x20b1e7)[_0x7bf7('0x1d')]();};}function respondWithResult(_0x25417e,_0x3c204f){_0x3c204f=_0x3c204f||0xc8;return function(_0x16c12d){if(_0x16c12d){return _0x25417e[_0x7bf7('0x1c')](_0x3c204f)[_0x7bf7('0x1e')](_0x16c12d);}};}function respondWithFilteredResult(_0x22e730,_0x4f78f1){return function(_0x1f1ff4){if(_0x1f1ff4){var _0x1dba4d=_0x1f1ff4[_0x7bf7('0x1f')],_0x508562=_0x4f78f1[_0x7bf7('0x20')],_0x3882d1=_0x4f78f1[_0x7bf7('0x20')]+_0x4f78f1[_0x7bf7('0x21')],_0x2feb44;if(_0x3882d1>=_0x1dba4d){_0x3882d1=_0x1dba4d;_0x2feb44=0xc8;}else{_0x2feb44=0xce;}_0x22e730['status'](_0x2feb44);return _0x22e730[_0x7bf7('0x22')](_0x7bf7('0x23'),_0x508562+'-'+_0x3882d1+'/'+_0x1dba4d)[_0x7bf7('0x1e')](_0x1f1ff4);}return null;};}function patchUpdates(_0x3513b3){return function(_0x1bf1c1){try{jsonpatch[_0x7bf7('0x24')](_0x1bf1c1,_0x3513b3,!![]);}catch(_0x47057a){return BPromise[_0x7bf7('0x25')](_0x47057a);}return _0x1bf1c1[_0x7bf7('0x26')]();};}function saveUpdates(_0x4b164a,_0x26aafc){return function(_0x3d1156){if(_0x3d1156){return _0x3d1156[_0x7bf7('0x27')](_0x4b164a)[_0x7bf7('0x28')](function(_0x235062){return _0x235062;});}return null;};}function removeEntity(_0x28ee36,_0xf17450){return function(_0x21b02d){if(_0x21b02d){return _0x21b02d[_0x7bf7('0x29')]()[_0x7bf7('0x28')](function(){_0x28ee36[_0x7bf7('0x1c')](0xcc)[_0x7bf7('0x1d')]();});}};}function handleEntityNotFound(_0x4a09eb,_0x4584c4){return function(_0x138fcf){if(!_0x138fcf){_0x4a09eb[_0x7bf7('0x1b')](0x194);}return _0x138fcf;};}function handleError(_0xf6dd77,_0xa055da){_0xa055da=_0xa055da||0x1f4;return function(_0x2d50d7){logger[_0x7bf7('0x2a')](_0x2d50d7[_0x7bf7('0x2b')]);if(_0x2d50d7['name']){delete _0x2d50d7['name'];}_0xf6dd77[_0x7bf7('0x1c')](_0xa055da)[_0x7bf7('0x2c')](_0x2d50d7);};}exports['index']=function(_0x303d84,_0x465664){var _0x30cd5d={},_0x2d936f={},_0x111531={'count':0x0,'rows':[]};var _0x58e36a=_['map'](db[_0x7bf7('0x2d')][_0x7bf7('0x2e')],function(_0x166719){return{'name':_0x166719[_0x7bf7('0x2f')],'type':_0x166719[_0x7bf7('0x30')][_0x7bf7('0x31')]};});_0x2d936f[_0x7bf7('0x32')]=_[_0x7bf7('0x33')](_0x58e36a,_0x7bf7('0x34'));_0x2d936f[_0x7bf7('0x35')]=_[_0x7bf7('0x36')](_0x303d84[_0x7bf7('0x35')]);_0x2d936f[_0x7bf7('0x37')]=_[_0x7bf7('0x38')](_0x2d936f['model'],_0x2d936f[_0x7bf7('0x35')]);_0x30cd5d[_0x7bf7('0x39')]=_['intersection'](_0x2d936f[_0x7bf7('0x32')],qs['fields'](_0x303d84[_0x7bf7('0x35')]['fields']));_0x30cd5d['attributes']=_0x30cd5d[_0x7bf7('0x39')][_0x7bf7('0x3a')]?_0x30cd5d['attributes']:_0x2d936f['model'];if(!_0x303d84[_0x7bf7('0x35')][_0x7bf7('0x3b')](_0x7bf7('0x3c'))){_0x30cd5d['limit']=qs[_0x7bf7('0x21')](_0x303d84['query'][_0x7bf7('0x21')]);_0x30cd5d['offset']=qs[_0x7bf7('0x20')](_0x303d84[_0x7bf7('0x35')]['offset']);}_0x30cd5d['order']=qs['sort'](_0x303d84[_0x7bf7('0x35')][_0x7bf7('0x3d')]);_0x30cd5d[_0x7bf7('0x3e')]=qs['filters'](_[_0x7bf7('0x3f')](_0x303d84[_0x7bf7('0x35')],_0x2d936f[_0x7bf7('0x37')]),_0x58e36a);if(_0x303d84[_0x7bf7('0x35')][_0x7bf7('0x40')]){_0x30cd5d[_0x7bf7('0x3e')]=_[_0x7bf7('0x41')](_0x30cd5d['where'],{'$or':_['map'](_0x58e36a,function(_0x3c3698){if(_0x3c3698[_0x7bf7('0x30')]!==_0x7bf7('0x42')){var _0x3f35d0={};_0x3f35d0[_0x3c3698[_0x7bf7('0x34')]]={'$like':'%'+_0x303d84[_0x7bf7('0x35')][_0x7bf7('0x40')]+'%'};return _0x3f35d0;}})});}_0x30cd5d=_[_0x7bf7('0x41')]({},_0x30cd5d,_0x303d84['options']);var _0xd152b3={'where':_0x30cd5d[_0x7bf7('0x3e')]};return db['ServicenowField']['count'](_0xd152b3)[_0x7bf7('0x28')](function(_0x4dca87){_0x111531[_0x7bf7('0x1f')]=_0x4dca87;if(_0x303d84[_0x7bf7('0x35')][_0x7bf7('0x43')]){_0x30cd5d[_0x7bf7('0x44')]=[{'all':!![]}];}return db[_0x7bf7('0x2d')][_0x7bf7('0x45')](_0x30cd5d);})[_0x7bf7('0x28')](function(_0x11bf6f){_0x111531[_0x7bf7('0x46')]=_0x11bf6f;return _0x111531;})['then'](respondWithFilteredResult(_0x465664,_0x30cd5d))[_0x7bf7('0x47')](handleError(_0x465664,null));};exports['show']=function(_0xe23446,_0x53add7){var _0x3a5d97={'raw':!![],'where':{'id':_0xe23446[_0x7bf7('0x48')]['id']}},_0x905a39={};_0x905a39[_0x7bf7('0x32')]=_[_0x7bf7('0x36')](db['ServicenowField'][_0x7bf7('0x2e')]);_0x905a39[_0x7bf7('0x35')]=_['keys'](_0xe23446[_0x7bf7('0x35')]);_0x905a39[_0x7bf7('0x37')]=_[_0x7bf7('0x38')](_0x905a39[_0x7bf7('0x32')],_0x905a39[_0x7bf7('0x35')]);_0x3a5d97['attributes']=_['intersection'](_0x905a39['model'],qs[_0x7bf7('0x49')](_0xe23446[_0x7bf7('0x35')][_0x7bf7('0x49')]));_0x3a5d97['attributes']=_0x3a5d97[_0x7bf7('0x39')][_0x7bf7('0x3a')]?_0x3a5d97['attributes']:_0x905a39[_0x7bf7('0x32')];if(_0xe23446[_0x7bf7('0x35')][_0x7bf7('0x43')]){_0x3a5d97[_0x7bf7('0x44')]=[{'all':!![]}];}_0x3a5d97=_['merge']({},_0x3a5d97,_0xe23446[_0x7bf7('0x4a')]);return db[_0x7bf7('0x2d')][_0x7bf7('0x4b')](_0x3a5d97)[_0x7bf7('0x28')](handleEntityNotFound(_0x53add7,null))[_0x7bf7('0x28')](respondWithResult(_0x53add7,null))[_0x7bf7('0x47')](handleError(_0x53add7,null));};exports['create']=function(_0x31ada9,_0x35cfc7){return db['ServicenowField'][_0x7bf7('0x4c')](_0x31ada9[_0x7bf7('0x4d')],{})[_0x7bf7('0x28')](respondWithResult(_0x35cfc7,0xc9))['catch'](handleError(_0x35cfc7,null));};exports[_0x7bf7('0x27')]=function(_0x520376,_0x3e513b){if(_0x520376[_0x7bf7('0x4d')]['id']){delete _0x520376[_0x7bf7('0x4d')]['id'];}return db[_0x7bf7('0x2d')][_0x7bf7('0x4b')]({'where':{'id':_0x520376['params']['id']}})['then'](handleEntityNotFound(_0x3e513b,null))[_0x7bf7('0x28')](saveUpdates(_0x520376[_0x7bf7('0x4d')],null))['then'](respondWithResult(_0x3e513b,null))[_0x7bf7('0x47')](handleError(_0x3e513b,null));};exports['destroy']=function(_0x47d2f1,_0xe395f0){return db[_0x7bf7('0x2d')][_0x7bf7('0x4b')]({'where':{'id':_0x47d2f1['params']['id']}})[_0x7bf7('0x28')](handleEntityNotFound(_0xe395f0,null))['then'](removeEntity(_0xe395f0,null))[_0x7bf7('0x47')](handleError(_0xe395f0,null));}; \ No newline at end of file +var _0xcdd0=['sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','stack','name','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5b1862,_0x47c031){var _0x529dac=function(_0x20ab68){while(--_0x20ab68){_0x5b1862['push'](_0x5b1862['shift']());}};_0x529dac(++_0x47c031);}(_0xcdd0,0xbd));var _0x0cdd=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xcdd0[_0x5317b5];return _0x3b7ce2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0cdd('0x0'));var rimraf=require(_0x0cdd('0x1'));var zipdir=require(_0x0cdd('0x2'));var jsonpatch=require(_0x0cdd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0cdd('0x4'));var Mustache=require(_0x0cdd('0x5'));var util=require(_0x0cdd('0x6'));var path=require(_0x0cdd('0x7'));var sox=require(_0x0cdd('0x8'));var csv=require(_0x0cdd('0x9'));var ejs=require(_0x0cdd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0cdd('0xb'));var deskjs=require(_0x0cdd('0xc'));var toCsv=require(_0x0cdd('0x9'));var querystring=require(_0x0cdd('0xd'));var Papa=require(_0x0cdd('0xe'));var Redis=require(_0x0cdd('0xf'));var authService=require(_0x0cdd('0x10'));var qs=require(_0x0cdd('0x11'));var as=require(_0x0cdd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0cdd('0x13'));var utils=require(_0x0cdd('0x14'));var config=require(_0x0cdd('0x15'));var licenseUtil=require(_0x0cdd('0x16'));var db=require(_0x0cdd('0x17'))['db'];function respondWithStatusCode(_0x95134f,_0x5b73cf){_0x5b73cf=_0x5b73cf||0xcc;return function(_0x202d66){if(_0x202d66){return _0x95134f[_0x0cdd('0x18')](_0x5b73cf);}return _0x95134f[_0x0cdd('0x19')](_0x5b73cf)[_0x0cdd('0x1a')]();};}function respondWithResult(_0x294eb9,_0x2ee25a){_0x2ee25a=_0x2ee25a||0xc8;return function(_0x3b650e){if(_0x3b650e){return _0x294eb9[_0x0cdd('0x19')](_0x2ee25a)[_0x0cdd('0x1b')](_0x3b650e);}};}function respondWithFilteredResult(_0xd5cd92,_0x46d3f8){return function(_0x4eccdf){if(_0x4eccdf){var _0x58b910=_0x4eccdf['count'],_0xf911fe=_0x46d3f8[_0x0cdd('0x1c')],_0x5d28f4=_0x46d3f8[_0x0cdd('0x1c')]+_0x46d3f8[_0x0cdd('0x1d')],_0x4b8ed8;if(_0x5d28f4>=_0x58b910){_0x5d28f4=_0x58b910;_0x4b8ed8=0xc8;}else{_0x4b8ed8=0xce;}_0xd5cd92[_0x0cdd('0x19')](_0x4b8ed8);return _0xd5cd92[_0x0cdd('0x1e')](_0x0cdd('0x1f'),_0xf911fe+'-'+_0x5d28f4+'/'+_0x58b910)[_0x0cdd('0x1b')](_0x4eccdf);}return null;};}function patchUpdates(_0x55ac8f){return function(_0x1c0d45){try{jsonpatch['apply'](_0x1c0d45,_0x55ac8f,!![]);}catch(_0x3d8f86){return BPromise[_0x0cdd('0x20')](_0x3d8f86);}return _0x1c0d45[_0x0cdd('0x21')]();};}function saveUpdates(_0x439013,_0x3cc52a){return function(_0x3c2702){if(_0x3c2702){return _0x3c2702['update'](_0x439013)[_0x0cdd('0x22')](function(_0x208da2){return _0x208da2;});}return null;};}function removeEntity(_0x301d64,_0x5eb5ad){return function(_0x55c89d){if(_0x55c89d){return _0x55c89d['destroy']()[_0x0cdd('0x22')](function(){_0x301d64[_0x0cdd('0x19')](0xcc)[_0x0cdd('0x1a')]();});}};}function handleEntityNotFound(_0x1785c6,_0x233e44){return function(_0x321ac7){if(!_0x321ac7){_0x1785c6[_0x0cdd('0x18')](0x194);}return _0x321ac7;};}function handleError(_0x122bcb,_0x5bdb24){_0x5bdb24=_0x5bdb24||0x1f4;return function(_0x59a0a6){logger['error'](_0x59a0a6[_0x0cdd('0x23')]);if(_0x59a0a6[_0x0cdd('0x24')]){delete _0x59a0a6['name'];}_0x122bcb['status'](_0x5bdb24)['send'](_0x59a0a6);};}exports[_0x0cdd('0x25')]=function(_0x39c489,_0x3185b8){var _0x34534d={},_0x4b8d37={},_0x3021ed={'count':0x0,'rows':[]};var _0x4aa2d0=_[_0x0cdd('0x26')](db[_0x0cdd('0x27')][_0x0cdd('0x28')],function(_0x3ed2ec){return{'name':_0x3ed2ec[_0x0cdd('0x29')],'type':_0x3ed2ec['type'][_0x0cdd('0x2a')]};});_0x4b8d37[_0x0cdd('0x2b')]=_[_0x0cdd('0x26')](_0x4aa2d0,_0x0cdd('0x24'));_0x4b8d37[_0x0cdd('0x2c')]=_['keys'](_0x39c489[_0x0cdd('0x2c')]);_0x4b8d37['filters']=_[_0x0cdd('0x2d')](_0x4b8d37[_0x0cdd('0x2b')],_0x4b8d37[_0x0cdd('0x2c')]);_0x34534d[_0x0cdd('0x2e')]=_['intersection'](_0x4b8d37[_0x0cdd('0x2b')],qs[_0x0cdd('0x2f')](_0x39c489['query'][_0x0cdd('0x2f')]));_0x34534d[_0x0cdd('0x2e')]=_0x34534d[_0x0cdd('0x2e')][_0x0cdd('0x30')]?_0x34534d[_0x0cdd('0x2e')]:_0x4b8d37[_0x0cdd('0x2b')];if(!_0x39c489[_0x0cdd('0x2c')][_0x0cdd('0x31')](_0x0cdd('0x32'))){_0x34534d[_0x0cdd('0x1d')]=qs[_0x0cdd('0x1d')](_0x39c489[_0x0cdd('0x2c')]['limit']);_0x34534d[_0x0cdd('0x1c')]=qs[_0x0cdd('0x1c')](_0x39c489[_0x0cdd('0x2c')]['offset']);}_0x34534d[_0x0cdd('0x33')]=qs['sort'](_0x39c489['query'][_0x0cdd('0x34')]);_0x34534d[_0x0cdd('0x35')]=qs[_0x0cdd('0x36')](_[_0x0cdd('0x37')](_0x39c489['query'],_0x4b8d37['filters']),_0x4aa2d0);if(_0x39c489['query']['filter']){_0x34534d[_0x0cdd('0x35')]=_[_0x0cdd('0x38')](_0x34534d[_0x0cdd('0x35')],{'$or':_['map'](_0x4aa2d0,function(_0x1ac89a){if(_0x1ac89a[_0x0cdd('0x39')]!=='VIRTUAL'){var _0x5725e9={};_0x5725e9[_0x1ac89a[_0x0cdd('0x24')]]={'$like':'%'+_0x39c489[_0x0cdd('0x2c')][_0x0cdd('0x3a')]+'%'};return _0x5725e9;}})});}_0x34534d=_[_0x0cdd('0x38')]({},_0x34534d,_0x39c489[_0x0cdd('0x3b')]);var _0x2c31c2={'where':_0x34534d[_0x0cdd('0x35')]};return db[_0x0cdd('0x27')][_0x0cdd('0x3c')](_0x2c31c2)[_0x0cdd('0x22')](function(_0x9b8ad1){_0x3021ed['count']=_0x9b8ad1;if(_0x39c489['query'][_0x0cdd('0x3d')]){_0x34534d[_0x0cdd('0x3e')]=[{'all':!![]}];}return db['ServicenowField'][_0x0cdd('0x3f')](_0x34534d);})[_0x0cdd('0x22')](function(_0x274cf6){_0x3021ed[_0x0cdd('0x40')]=_0x274cf6;return _0x3021ed;})[_0x0cdd('0x22')](respondWithFilteredResult(_0x3185b8,_0x34534d))[_0x0cdd('0x41')](handleError(_0x3185b8,null));};exports['show']=function(_0x638a94,_0x185079){var _0x170625={'raw':!![],'where':{'id':_0x638a94[_0x0cdd('0x42')]['id']}},_0x24fc97={};_0x24fc97['model']=_['keys'](db[_0x0cdd('0x27')][_0x0cdd('0x28')]);_0x24fc97[_0x0cdd('0x2c')]=_[_0x0cdd('0x43')](_0x638a94[_0x0cdd('0x2c')]);_0x24fc97['filters']=_[_0x0cdd('0x2d')](_0x24fc97[_0x0cdd('0x2b')],_0x24fc97['query']);_0x170625[_0x0cdd('0x2e')]=_['intersection'](_0x24fc97[_0x0cdd('0x2b')],qs[_0x0cdd('0x2f')](_0x638a94[_0x0cdd('0x2c')][_0x0cdd('0x2f')]));_0x170625['attributes']=_0x170625[_0x0cdd('0x2e')]['length']?_0x170625['attributes']:_0x24fc97[_0x0cdd('0x2b')];if(_0x638a94['query']['includeAll']){_0x170625[_0x0cdd('0x3e')]=[{'all':!![]}];}_0x170625=_[_0x0cdd('0x38')]({},_0x170625,_0x638a94[_0x0cdd('0x3b')]);return db[_0x0cdd('0x27')][_0x0cdd('0x44')](_0x170625)[_0x0cdd('0x22')](handleEntityNotFound(_0x185079,null))[_0x0cdd('0x22')](respondWithResult(_0x185079,null))[_0x0cdd('0x41')](handleError(_0x185079,null));};exports[_0x0cdd('0x45')]=function(_0x459903,_0x35329c){return db[_0x0cdd('0x27')][_0x0cdd('0x45')](_0x459903['body'],{})[_0x0cdd('0x22')](respondWithResult(_0x35329c,0xc9))[_0x0cdd('0x41')](handleError(_0x35329c,null));};exports['update']=function(_0x59f911,_0x58a1a3){if(_0x59f911[_0x0cdd('0x46')]['id']){delete _0x59f911[_0x0cdd('0x46')]['id'];}return db[_0x0cdd('0x27')][_0x0cdd('0x44')]({'where':{'id':_0x59f911[_0x0cdd('0x42')]['id']}})[_0x0cdd('0x22')](handleEntityNotFound(_0x58a1a3,null))[_0x0cdd('0x22')](saveUpdates(_0x59f911[_0x0cdd('0x46')],null))['then'](respondWithResult(_0x58a1a3,null))[_0x0cdd('0x41')](handleError(_0x58a1a3,null));};exports['destroy']=function(_0x333678,_0x4d5c73){return db[_0x0cdd('0x27')][_0x0cdd('0x44')]({'where':{'id':_0x333678[_0x0cdd('0x42')]['id']}})[_0x0cdd('0x22')](handleEntityNotFound(_0x4d5c73,null))[_0x0cdd('0x22')](removeEntity(_0x4d5c73,null))[_0x0cdd('0x41')](handleError(_0x4d5c73,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 318e1ce..8ba81fc 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 _0x9500=['path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','api','bluebird'];(function(_0x375fa4,_0x12d344){var _0x1ed0cc=function(_0x2259ac){while(--_0x2259ac){_0x375fa4['push'](_0x375fa4['shift']());}};_0x1ed0cc(++_0x12d344);}(_0x9500,0x134));var _0x0950=function(_0x34167b,_0x5630f3){_0x34167b=_0x34167b-0x0;var _0x498e0c=_0x9500[_0x34167b];return _0x498e0c;};'use strict';var _=require(_0x0950('0x0'));var util=require(_0x0950('0x1'));var logger=require('../../config/logger')(_0x0950('0x2'));var moment=require('moment');var BPromise=require(_0x0950('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0950('0x4'));var rimraf=require('rimraf');var config=require(_0x0950('0x5'));var attributes=require(_0x0950('0x6'));module[_0x0950('0x7')]=function(_0x4b5969,_0x433e6d){return _0x4b5969[_0x0950('0x8')](_0x0950('0x9'),attributes,{'tableName':_0x0950('0xa'),'paranoid':![],'indexes':[{'name':_0x0950('0xb'),'fields':['idField',_0x0950('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4166=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes'];(function(_0x2b0139,_0xc838f7){var _0x40d3ab=function(_0x4bbd1d){while(--_0x4bbd1d){_0x2b0139['push'](_0x2b0139['shift']());}};_0x40d3ab(++_0xc838f7);}(_0x4166,0x1d7));var _0x6416=function(_0x5e02c3,_0x4a80eb){_0x5e02c3=_0x5e02c3-0x0;var _0x20dcb9=_0x4166[_0x5e02c3];return _0x20dcb9;};'use strict';var _=require(_0x6416('0x0'));var util=require('util');var logger=require(_0x6416('0x1'))(_0x6416('0x2'));var moment=require(_0x6416('0x3'));var BPromise=require(_0x6416('0x4'));var rp=require(_0x6416('0x5'));var fs=require('fs');var path=require(_0x6416('0x6'));var rimraf=require('rimraf');var config=require(_0x6416('0x7'));var attributes=require(_0x6416('0x8'));module[_0x6416('0x9')]=function(_0x12fad9,_0x38c00f){return _0x12fad9[_0x6416('0xa')](_0x6416('0xb'),attributes,{'tableName':_0x6416('0xc'),'paranoid':![],'indexes':[{'name':_0x6416('0xd'),'fields':[_0x6416('0xe'),_0x6416('0xf')],'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 916d5b5..6aab60a 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 _0x8267=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x5a0261,_0x5663e1){var _0x4448d7=function(_0x7d9ba9){while(--_0x7d9ba9){_0x5a0261['push'](_0x5a0261['shift']());}};_0x4448d7(++_0x5663e1);}(_0x8267,0x185));var _0x7826=function(_0x4af868,_0x9ef8cb){_0x4af868=_0x4af868-0x0;var _0x4f7095=_0x8267[_0x4af868];return _0x4f7095;};'use strict';var _=require(_0x7826('0x0'));var util=require(_0x7826('0x1'));var moment=require(_0x7826('0x2'));var BPromise=require('bluebird');var rs=require(_0x7826('0x3'));var fs=require('fs');var Redis=require(_0x7826('0x4'));var db=require(_0x7826('0x5'))['db'];var utils=require(_0x7826('0x6'));var logger=require(_0x7826('0x7'))(_0x7826('0x8'));var config=require('../../config/environment');var jayson=require(_0x7826('0x9'));var client=jayson[_0x7826('0xa')][_0x7826('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3132fc,_0x42bf88,_0x4bae96){return new BPromise(function(_0x246c4c,_0x4830a9){return client[_0x7826('0xc')](_0x3132fc,_0x4bae96)['then'](function(_0x2ee828){logger[_0x7826('0xd')](_0x7826('0xe'),_0x42bf88,'request\x20sent');logger[_0x7826('0xf')](_0x7826('0x10'),_0x42bf88,_0x7826('0x11'),JSON[_0x7826('0x12')](_0x2ee828));if(_0x2ee828[_0x7826('0x13')]){if(_0x2ee828['error'][_0x7826('0x14')]===0x1f4){logger[_0x7826('0x13')](_0x7826('0xe'),_0x42bf88,_0x2ee828['error'][_0x7826('0x15')]);return _0x4830a9(_0x2ee828[_0x7826('0x13')]['message']);}logger[_0x7826('0x13')](_0x7826('0xe'),_0x42bf88,_0x2ee828[_0x7826('0x13')][_0x7826('0x15')]);return _0x246c4c(_0x2ee828[_0x7826('0x13')]['message']);}else{logger[_0x7826('0xd')](_0x7826('0xe'),_0x42bf88,_0x7826('0x11'));_0x246c4c(_0x2ee828[_0x7826('0x16')][_0x7826('0x15')]);}})['catch'](function(_0x2b9738){logger['error'](_0x7826('0xe'),_0x42bf88,_0x2b9738);_0x4830a9(_0x2b9738);});});} \ No newline at end of file +var _0xda0d=['randomstring','ioredis','../../config/environment','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xda0d,0x13d));var _0xdda0=function(_0x47355d,_0x1fca1a){_0x47355d=_0x47355d-0x0;var _0x25a059=_0xda0d[_0x47355d];return _0x25a059;};'use strict';var _=require(_0xdda0('0x0'));var util=require('util');var moment=require(_0xdda0('0x1'));var BPromise=require(_0xdda0('0x2'));var rs=require(_0xdda0('0x3'));var fs=require('fs');var Redis=require(_0xdda0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdda0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdda0('0x6')][_0xdda0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc2e97f,_0x4abcf8,_0x21dde8){return new BPromise(function(_0x22d7e6,_0x5ae831){return client[_0xdda0('0x8')](_0xc2e97f,_0x21dde8)[_0xdda0('0x9')](function(_0x2f2cfb){logger[_0xdda0('0xa')](_0xdda0('0xb'),_0x4abcf8,_0xdda0('0xc'));logger[_0xdda0('0xd')](_0xdda0('0xe'),_0x4abcf8,'request\x20sent',JSON['stringify'](_0x2f2cfb));if(_0x2f2cfb[_0xdda0('0xf')]){if(_0x2f2cfb[_0xdda0('0xf')][_0xdda0('0x10')]===0x1f4){logger[_0xdda0('0xf')](_0xdda0('0xb'),_0x4abcf8,_0x2f2cfb[_0xdda0('0xf')][_0xdda0('0x11')]);return _0x5ae831(_0x2f2cfb[_0xdda0('0xf')]['message']);}logger['error'](_0xdda0('0xb'),_0x4abcf8,_0x2f2cfb[_0xdda0('0xf')][_0xdda0('0x11')]);return _0x22d7e6(_0x2f2cfb['error']['message']);}else{logger[_0xdda0('0xa')](_0xdda0('0xb'),_0x4abcf8,_0xdda0('0xc'));_0x22d7e6(_0x2f2cfb[_0xdda0('0x12')][_0xdda0('0x11')]);}})[_0xdda0('0x13')](function(_0x4e62be){logger[_0xdda0('0xf')](_0xdda0('0xb'),_0x4abcf8,_0x4e62be);_0x5ae831(_0x4e62be);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7c3a864..1e28d5a 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 _0x6824=['../../config/environment','./intSugarcrmAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','express','../../components/auth/service'];(function(_0x425727,_0x3aaaf4){var _0x52b40e=function(_0x261269){while(--_0x261269){_0x425727['push'](_0x425727['shift']());}};_0x52b40e(++_0x3aaaf4);}(_0x6824,0x80));var _0x4682=function(_0x59258f,_0x594d9f){_0x59258f=_0x59258f-0x0;var _0x2a3836=_0x6824[_0x59258f];return _0x2a3836;};'use strict';var multer=require(_0x4682('0x0'));var util=require(_0x4682('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4682('0x2'));var router=express['Router']();var auth=require(_0x4682('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4682('0x4'));var controller=require(_0x4682('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x4682('0x6')]);router[_0x4682('0x7')](_0x4682('0x8'),auth['isAuthenticated'](),controller[_0x4682('0x9')]);router[_0x4682('0x7')](_0x4682('0xa'),auth[_0x4682('0xb')](),controller[_0x4682('0xc')]);router['get'](_0x4682('0xd'),auth[_0x4682('0xb')](),controller[_0x4682('0xe')]);router[_0x4682('0xf')]('/',auth[_0x4682('0xb')](),controller[_0x4682('0x10')]);router[_0x4682('0xf')](_0x4682('0xa'),auth[_0x4682('0xb')](),controller[_0x4682('0x11')]);router[_0x4682('0x12')](_0x4682('0x8'),auth['isAuthenticated'](),controller[_0x4682('0x13')]);router[_0x4682('0x14')](_0x4682('0x8'),auth[_0x4682('0xb')](),controller[_0x4682('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6655=['post','create','addConfiguration','put','update','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','get','getFields'];(function(_0x41288f,_0x5af4f0){var _0x1cf9c7=function(_0x2fb51a){while(--_0x2fb51a){_0x41288f['push'](_0x41288f['shift']());}};_0x1cf9c7(++_0x5af4f0);}(_0x6655,0x193));var _0x5665=function(_0x355476,_0x80e809){_0x355476=_0x355476-0x0;var _0x32185f=_0x6655[_0x355476];return _0x32185f;};'use strict';var multer=require(_0x5665('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5665('0x1')]();var auth=require(_0x5665('0x2'));var interaction=require(_0x5665('0x3'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router['get']('/',auth[_0x5665('0x4')](),controller[_0x5665('0x5')]);router['get'](_0x5665('0x6'),auth[_0x5665('0x4')](),controller['show']);router['get'](_0x5665('0x7'),auth[_0x5665('0x4')](),controller[_0x5665('0x8')]);router[_0x5665('0x9')]('/:id/fields',auth[_0x5665('0x4')](),controller[_0x5665('0xa')]);router[_0x5665('0xb')]('/',auth[_0x5665('0x4')](),controller[_0x5665('0xc')]);router[_0x5665('0xb')](_0x5665('0x7'),auth[_0x5665('0x4')](),controller[_0x5665('0xd')]);router[_0x5665('0xe')]('/:id',auth[_0x5665('0x4')](),controller[_0x5665('0xf')]);router['delete'](_0x5665('0x6'),auth[_0x5665('0x4')](),controller[_0x5665('0x10')]);module[_0x5665('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 11a49e8..406e0db 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 _0xa60d=['exports','STRING','username','remoteUri'];(function(_0x495027,_0x23c87b){var _0x26e234=function(_0x2f4efb){while(--_0x2f4efb){_0x495027['push'](_0x495027['shift']());}};_0x26e234(++_0x23c87b);}(_0xa60d,0x1bc));var _0xda60=function(_0x3cd975,_0x23f21f){_0x3cd975=_0x3cd975-0x0;var _0x579111=_0xa60d[_0x3cd975];return _0x579111;};'use strict';var Sequelize=require('sequelize');module[_0xda60('0x0')]={'name':{'type':Sequelize[_0xda60('0x1')]},'description':{'type':Sequelize[_0xda60('0x1')]},'username':{'type':Sequelize[_0xda60('0x1')],'unique':_0xda60('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xda60('0x1')],'unique':_0xda60('0x3')},'serverUrl':{'type':Sequelize[_0xda60('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1bdd=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2cd0e7,_0xe6f026){var _0x57333f=function(_0x4a94f4){while(--_0x4a94f4){_0x2cd0e7['push'](_0x2cd0e7['shift']());}};_0x57333f(++_0xe6f026);}(_0x1bdd,0xd2));var _0xd1bd=function(_0x476565,_0x22944d){_0x476565=_0x476565-0x0;var _0x4e8838=_0x1bdd[_0x476565];return _0x4e8838;};'use strict';var Sequelize=require(_0xd1bd('0x0'));module[_0xd1bd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd1bd('0x2')]},'username':{'type':Sequelize[_0xd1bd('0x2')],'unique':_0xd1bd('0x3')},'password':{'type':Sequelize[_0xd1bd('0x2')]},'remoteUri':{'type':Sequelize[_0xd1bd('0x2')],'unique':_0xd1bd('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 189018b..56ae98e 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 _0x474d=['show','params','keys','find','create','body','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','direction','username','password','remoteUri','slice','POST','format','%s%s','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes','label','values','value','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','status','end','count','offset','limit','Content-Range','json','apply','update','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x43c24f,_0x50f615){var _0x337ec5=function(_0x1fdb76){while(--_0x1fdb76){_0x43c24f['push'](_0x43c24f['shift']());}};_0x337ec5(++_0x50f615);}(_0x474d,0xad));var _0xd474=function(_0x42b94,_0x2e3090){_0x42b94=_0x42b94-0x0;var _0x563f2e=_0x474d[_0x42b94];return _0x563f2e;};'use strict';var pdf=require(_0xd474('0x0'));var emlformat=require(_0xd474('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd474('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd474('0x3'));var moment=require('moment');var BPromise=require(_0xd474('0x4'));var Mustache=require(_0xd474('0x5'));var util=require(_0xd474('0x6'));var path=require('path');var sox=require(_0xd474('0x7'));var csv=require(_0xd474('0x8'));var ejs=require(_0xd474('0x9'));var fs=require('fs');var _=require(_0xd474('0xa'));var squel=require('squel');var crypto=require(_0xd474('0xb'));var jsforce=require(_0xd474('0xc'));var deskjs=require(_0xd474('0xd'));var toCsv=require(_0xd474('0x8'));var querystring=require(_0xd474('0xe'));var Papa=require('papaparse');var Redis=require(_0xd474('0xf'));var authService=require(_0xd474('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd474('0x11'));var hardwareService=require(_0xd474('0x12'));var logger=require(_0xd474('0x13'))(_0xd474('0x14'));var utils=require('../../config/utils');var config=require(_0xd474('0x15'));var licenseUtil=require(_0xd474('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd474('0x17'));var client=jayson['client'][_0xd474('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x23dbc9,_0x1fc5d4,_0x2334e7,_0x4746e7){return new BPromise(function(_0x972e7c,_0x22d3a5){var _0x42f5fb=_0x4746e7||client;return _0x42f5fb[_0xd474('0x19')](_0x23dbc9,_0x2334e7)[_0xd474('0x1a')](function(_0x2e62b1){logger[_0xd474('0x1b')]('SugarcrmAccount,\x20%s,\x20%s',_0x1fc5d4,_0xd474('0x1c'));logger[_0xd474('0x1d')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1fc5d4,_0xd474('0x1c'),JSON[_0xd474('0x1e')](_0x2e62b1));if(_0x2e62b1[_0xd474('0x1f')]){if(_0x2e62b1[_0xd474('0x1f')][_0xd474('0x20')]===0x1f4){logger[_0xd474('0x1f')]('SugarcrmAccount,\x20%s,\x20%s',_0x1fc5d4,_0x2e62b1[_0xd474('0x1f')][_0xd474('0x21')]);return _0x22d3a5(_0x2e62b1[_0xd474('0x1f')][_0xd474('0x21')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1fc5d4,_0x2e62b1[_0xd474('0x1f')][_0xd474('0x21')]);return _0x972e7c(_0x2e62b1['error']['message']);}else{logger[_0xd474('0x1b')](_0xd474('0x22'),_0x1fc5d4,_0xd474('0x1c'));_0x972e7c(_0x2e62b1[_0xd474('0x23')][_0xd474('0x21')]);}})[_0xd474('0x24')](function(_0x2523e7){logger[_0xd474('0x1f')](_0xd474('0x22'),_0x1fc5d4,_0x2523e7);_0x22d3a5(_0x2523e7);});});}function respondWithStatusCode(_0x332c92,_0x1e802e){_0x1e802e=_0x1e802e||0xcc;return function(_0x218f09){if(_0x218f09){return _0x332c92['sendStatus'](_0x1e802e);}return _0x332c92[_0xd474('0x25')](_0x1e802e)[_0xd474('0x26')]();};}function respondWithResult(_0x40ebbe,_0x49606f){_0x49606f=_0x49606f||0xc8;return function(_0x2cdb93){if(_0x2cdb93){return _0x40ebbe[_0xd474('0x25')](_0x49606f)['json'](_0x2cdb93);}};}function respondWithFilteredResult(_0x5f4d68,_0x29338e){return function(_0x5a2e46){if(_0x5a2e46){var _0x57e186=_0x5a2e46[_0xd474('0x27')],_0x1748e6=_0x29338e['offset'],_0x4bab6a=_0x29338e[_0xd474('0x28')]+_0x29338e[_0xd474('0x29')],_0x25cbe0;if(_0x4bab6a>=_0x57e186){_0x4bab6a=_0x57e186;_0x25cbe0=0xc8;}else{_0x25cbe0=0xce;}_0x5f4d68[_0xd474('0x25')](_0x25cbe0);return _0x5f4d68['set'](_0xd474('0x2a'),_0x1748e6+'-'+_0x4bab6a+'/'+_0x57e186)[_0xd474('0x2b')](_0x5a2e46);}return null;};}function patchUpdates(_0x55ad4c){return function(_0x37388b){try{jsonpatch[_0xd474('0x2c')](_0x37388b,_0x55ad4c,!![]);}catch(_0x4a9de8){return BPromise['reject'](_0x4a9de8);}return _0x37388b['save']();};}function saveUpdates(_0x26a2b4,_0x57df95){return function(_0x13bcb6){if(_0x13bcb6){return _0x13bcb6[_0xd474('0x2d')](_0x26a2b4)[_0xd474('0x1a')](function(_0x376364){return _0x376364;});}return null;};}function removeEntity(_0x713db7,_0xc2674){return function(_0x5e8efe){if(_0x5e8efe){return _0x5e8efe[_0xd474('0x2e')]()[_0xd474('0x1a')](function(){_0x713db7[_0xd474('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384d4a,_0x16d6dc){return function(_0x2c3d99){if(!_0x2c3d99){_0x384d4a[_0xd474('0x2f')](0x194);}return _0x2c3d99;};}function handleError(_0x158121,_0x2e4a15){_0x2e4a15=_0x2e4a15||0x1f4;return function(_0xa343d){logger['error'](_0xa343d[_0xd474('0x30')]);if(_0xa343d['name']){delete _0xa343d[_0xd474('0x31')];}_0x158121['status'](_0x2e4a15)[_0xd474('0x32')](_0xa343d);};}exports[_0xd474('0x33')]=function(_0x5dfdfe,_0x55446b){var _0x17ba3a={},_0x1f15b8={},_0x548004={'count':0x0,'rows':[]};var _0x18e843=_[_0xd474('0x34')](db[_0xd474('0x35')][_0xd474('0x36')],function(_0x51aba6){return{'name':_0x51aba6[_0xd474('0x37')],'type':_0x51aba6[_0xd474('0x38')][_0xd474('0x39')]};});_0x1f15b8[_0xd474('0x3a')]=_[_0xd474('0x34')](_0x18e843,_0xd474('0x31'));_0x1f15b8[_0xd474('0x3b')]=_['keys'](_0x5dfdfe[_0xd474('0x3b')]);_0x1f15b8[_0xd474('0x3c')]=_['intersection'](_0x1f15b8['model'],_0x1f15b8[_0xd474('0x3b')]);_0x17ba3a[_0xd474('0x3d')]=_[_0xd474('0x3e')](_0x1f15b8[_0xd474('0x3a')],qs[_0xd474('0x3f')](_0x5dfdfe['query'][_0xd474('0x3f')]));_0x17ba3a[_0xd474('0x3d')]=_0x17ba3a[_0xd474('0x3d')][_0xd474('0x40')]?_0x17ba3a[_0xd474('0x3d')]:_0x1f15b8[_0xd474('0x3a')];if(!_0x5dfdfe[_0xd474('0x3b')][_0xd474('0x41')](_0xd474('0x42'))){_0x17ba3a[_0xd474('0x29')]=qs[_0xd474('0x29')](_0x5dfdfe[_0xd474('0x3b')][_0xd474('0x29')]);_0x17ba3a[_0xd474('0x28')]=qs[_0xd474('0x28')](_0x5dfdfe['query'][_0xd474('0x28')]);}_0x17ba3a[_0xd474('0x43')]=qs[_0xd474('0x44')](_0x5dfdfe[_0xd474('0x3b')][_0xd474('0x44')]);_0x17ba3a['where']=qs[_0xd474('0x3c')](_[_0xd474('0x45')](_0x5dfdfe[_0xd474('0x3b')],_0x1f15b8[_0xd474('0x3c')]),_0x18e843);if(_0x5dfdfe[_0xd474('0x3b')][_0xd474('0x46')]){_0x17ba3a[_0xd474('0x47')]=_[_0xd474('0x48')](_0x17ba3a[_0xd474('0x47')],{'$or':_[_0xd474('0x34')](_0x18e843,function(_0x308257){if(_0x308257[_0xd474('0x38')]!==_0xd474('0x49')){var _0x17cc29={};_0x17cc29[_0x308257[_0xd474('0x31')]]={'$like':'%'+_0x5dfdfe[_0xd474('0x3b')]['filter']+'%'};return _0x17cc29;}})});}_0x17ba3a=_[_0xd474('0x48')]({},_0x17ba3a,_0x5dfdfe[_0xd474('0x4a')]);var _0x3bdf53={'where':_0x17ba3a[_0xd474('0x47')]};return db[_0xd474('0x35')][_0xd474('0x27')](_0x3bdf53)['then'](function(_0x419976){_0x548004[_0xd474('0x27')]=_0x419976;if(_0x5dfdfe['query'][_0xd474('0x4b')]){_0x17ba3a[_0xd474('0x4c')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xd474('0x4d')](_0x17ba3a);})[_0xd474('0x1a')](function(_0x163e1){_0x548004[_0xd474('0x4e')]=_0x163e1;return _0x548004;})[_0xd474('0x1a')](respondWithFilteredResult(_0x55446b,_0x17ba3a))[_0xd474('0x24')](handleError(_0x55446b,null));};exports[_0xd474('0x4f')]=function(_0x516903,_0x539bbf){var _0x4ccd4a={'raw':![],'where':{'id':_0x516903[_0xd474('0x50')]['id']}},_0x3706fa={};_0x3706fa[_0xd474('0x3a')]=_[_0xd474('0x51')](db[_0xd474('0x35')]['rawAttributes']);_0x3706fa[_0xd474('0x3b')]=_[_0xd474('0x51')](_0x516903[_0xd474('0x3b')]);_0x3706fa[_0xd474('0x3c')]=_[_0xd474('0x3e')](_0x3706fa[_0xd474('0x3a')],_0x3706fa[_0xd474('0x3b')]);_0x4ccd4a[_0xd474('0x3d')]=_[_0xd474('0x3e')](_0x3706fa[_0xd474('0x3a')],qs[_0xd474('0x3f')](_0x516903[_0xd474('0x3b')][_0xd474('0x3f')]));_0x4ccd4a[_0xd474('0x3d')]=_0x4ccd4a[_0xd474('0x3d')][_0xd474('0x40')]?_0x4ccd4a[_0xd474('0x3d')]:_0x3706fa['model'];if(_0x516903[_0xd474('0x3b')][_0xd474('0x4b')]){_0x4ccd4a['include']=[{'all':!![]}];}_0x4ccd4a=_[_0xd474('0x48')]({},_0x4ccd4a,_0x516903[_0xd474('0x4a')]);return db[_0xd474('0x35')][_0xd474('0x52')](_0x4ccd4a)[_0xd474('0x1a')](handleEntityNotFound(_0x539bbf,null))['then'](respondWithResult(_0x539bbf,null))['catch'](handleError(_0x539bbf,null));};exports[_0xd474('0x53')]=function(_0x3f9b04,_0x4b110b){return db[_0xd474('0x35')]['create'](_0x3f9b04['body'],{})[_0xd474('0x1a')](respondWithResult(_0x4b110b,0xc9))[_0xd474('0x24')](handleError(_0x4b110b,null));};exports[_0xd474('0x2d')]=function(_0x256e5c,_0xc0d7da){if(_0x256e5c[_0xd474('0x54')]['id']){delete _0x256e5c[_0xd474('0x54')]['id'];}return db['SugarcrmAccount'][_0xd474('0x52')]({'where':{'id':_0x256e5c[_0xd474('0x50')]['id']}})[_0xd474('0x1a')](handleEntityNotFound(_0xc0d7da,null))['then'](saveUpdates(_0x256e5c[_0xd474('0x54')],null))[_0xd474('0x1a')](respondWithResult(_0xc0d7da,null))[_0xd474('0x24')](handleError(_0xc0d7da,null));};exports[_0xd474('0x2e')]=function(_0x451752,_0x347034){return db[_0xd474('0x35')][_0xd474('0x52')]({'where':{'id':_0x451752[_0xd474('0x50')]['id']}})[_0xd474('0x1a')](handleEntityNotFound(_0x347034,null))['then'](removeEntity(_0x347034,null))[_0xd474('0x24')](handleError(_0x347034,null));};exports[_0xd474('0x55')]=function(_0x294e8b,_0x271690,_0x2ff48f){var _0x3c9619={};var _0x58ad1a={};var _0x4774b6;var _0x3096ea;return db[_0xd474('0x35')]['findOne']({'where':{'id':_0x294e8b[_0xd474('0x50')]['id']}})[_0xd474('0x1a')](handleEntityNotFound(_0x271690,null))[_0xd474('0x1a')](function(_0x1d957d){if(_0x1d957d){_0x4774b6=_0x1d957d;_0x58ad1a[_0xd474('0x3a')]=_[_0xd474('0x51')](db[_0xd474('0x56')][_0xd474('0x36')]);_0x58ad1a['query']=_[_0xd474('0x51')](_0x294e8b[_0xd474('0x3b')]);_0x58ad1a[_0xd474('0x3c')]=_[_0xd474('0x3e')](_0x58ad1a[_0xd474('0x3a')],_0x58ad1a[_0xd474('0x3b')]);_0x3c9619[_0xd474('0x3d')]=_['intersection'](_0x58ad1a[_0xd474('0x3a')],qs['fields'](_0x294e8b[_0xd474('0x3b')][_0xd474('0x3f')]));_0x3c9619[_0xd474('0x3d')]=_0x3c9619[_0xd474('0x3d')][_0xd474('0x40')]?_0x3c9619['attributes']:_0x58ad1a[_0xd474('0x3a')];_0x3c9619[_0xd474('0x43')]=qs[_0xd474('0x44')](_0x294e8b['query']['sort']);_0x3c9619[_0xd474('0x47')]=qs[_0xd474('0x3c')](_[_0xd474('0x45')](_0x294e8b[_0xd474('0x3b')],_0x58ad1a[_0xd474('0x3c')]));if(_0x294e8b[_0xd474('0x3b')][_0xd474('0x46')]){_0x3c9619['where']=_['merge'](_0x3c9619[_0xd474('0x47')],{'$or':_[_0xd474('0x34')](_0x3c9619[_0xd474('0x3d')],function(_0x4cb7b7){var _0x3201bb={};_0x3201bb[_0x4cb7b7]={'$like':'%'+_0x294e8b['query'][_0xd474('0x46')]+'%'};return _0x3201bb;})});}_0x3c9619=_[_0xd474('0x48')]({},_0x3c9619,_0x294e8b[_0xd474('0x4a')]);return _0x4774b6[_0xd474('0x55')](_0x3c9619);}})[_0xd474('0x1a')](function(_0x4e657e){if(_0x4e657e){_0x3096ea=_0x4e657e[_0xd474('0x40')];if(!_0x294e8b[_0xd474('0x3b')][_0xd474('0x41')](_0xd474('0x42'))){_0x3c9619[_0xd474('0x29')]=qs[_0xd474('0x29')](_0x294e8b[_0xd474('0x3b')][_0xd474('0x29')]);_0x3c9619[_0xd474('0x28')]=qs[_0xd474('0x28')](_0x294e8b[_0xd474('0x3b')]['offset']);}return _0x4774b6[_0xd474('0x55')](_0x3c9619);}})[_0xd474('0x1a')](function(_0x3c6782){if(_0x3c6782){return _0x3c6782?{'count':_0x3096ea,'rows':_0x3c6782}:null;}})[_0xd474('0x1a')](respondWithResult(_0x271690,null))[_0xd474('0x24')](handleError(_0x271690,null));};exports[_0xd474('0x57')]=function(_0x32a383,_0x405a78,_0xf250c6){if(_0x32a383['body']['id']){delete _0x32a383[_0xd474('0x54')]['id'];}return db['SugarcrmAccount'][_0xd474('0x58')]({'where':{'id':_0x32a383[_0xd474('0x50')]['id']}})[_0xd474('0x1a')](handleEntityNotFound(_0x405a78,null))[_0xd474('0x1a')](function(_0x1fb200){if(_0x1fb200){_0x32a383[_0xd474('0x54')][_0xd474('0x59')]=_0x1fb200['id'];_0x32a383['body'][_0xd474('0x5a')]=integrations[_0xd474('0x5b')](_0x32a383[_0xd474('0x54')][_0xd474('0x5c')],_0x32a383[_0xd474('0x54')][_0xd474('0x38')]);_0x32a383['body'][_0xd474('0x5d')]=integrations[_0xd474('0x5e')](_0x32a383[_0xd474('0x54')][_0xd474('0x5c')],_0x32a383[_0xd474('0x54')][_0xd474('0x38')]);return db[_0xd474('0x56')][_0xd474('0x53')](_0x32a383[_0xd474('0x54')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xd474('0x5f')],'as':_0xd474('0x5d')}]});}return null;})[_0xd474('0x1a')](respondWithResult(_0x405a78,null))['catch'](handleError(_0x405a78,null));};exports[_0xd474('0x60')]=function(_0x5ed2bb,_0x138202,_0x2b5e0e){var _0x627245='';var _0x1c2a1a=['id',_0xd474('0x31'),_0xd474('0x61'),_0xd474('0x62'),'description',_0xd474('0x63'),'duration_hours',_0xd474('0x64'),_0xd474('0x65'),'parent_type','parent_name',_0xd474('0x66')];return db[_0xd474('0x35')][_0xd474('0x58')]({'where':{'id':_0x5ed2bb[_0xd474('0x50')]['id']},'attributes':['id',_0xd474('0x67'),_0xd474('0x68'),_0xd474('0x69')]})['then'](handleEntityNotFound(_0x138202,null))[_0xd474('0x1a')](function(_0x39f7b2){if(_0x39f7b2){_0x627245=_0x39f7b2[_0xd474('0x69')];var _0x593051=_0x627245[_0xd474('0x6a')](-0x1);if(_0x593051==='/'){_0x627245=_0x627245['substring'](0x0,_0x627245['lastIndexOf'](_0x593051));}return rp({'method':_0xd474('0x6b'),'uri':util[_0xd474('0x6c')](_0xd474('0x6d'),_0x627245,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xd474('0x6e'),'rest_data':JSON[_0xd474('0x1e')]({'user_auth':{'user_name':_0x39f7b2['username'],'password':_0x39f7b2[_0xd474('0x68')],'encryption':_0xd474('0x6f')},'application':_0xd474('0x70')})}});}})[_0xd474('0x1a')](function(_0x46c012){if(_0x46c012&&_0x46c012['name']!==_0xd474('0x71')&&_0x46c012['name']!==_0xd474('0x72')){return rp({'method':_0xd474('0x6b'),'uri':util[_0xd474('0x6c')](_0xd474('0x6d'),_0x627245,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd474('0x73'),'input_type':_0xd474('0x6e'),'response_type':_0xd474('0x6e'),'rest_data':JSON[_0xd474('0x1e')]({'session':_0x46c012['id'],'module_name':_0xd474('0x74')})}})[_0xd474('0x1a')](function(_0x253055){if(_0x253055){var _0x3b027e=_['values'](_0x253055[_0xd474('0x75')]);_[_0xd474('0x76')](_0x3b027e,function(_0x201a8b){return _0x1c2a1a[_0xd474('0x77')](_0x201a8b[_0xd474('0x31')]);});return{'count':_0x3b027e['length'],'rows':_['map'](_0x3b027e,function(_0x1ba1bc){return{'id':_0x1ba1bc[_0xd474('0x31')],'name':_0x1ba1bc[_0xd474('0x78')],'custom':_['endsWith'](_0x1ba1bc[_0xd474('0x31')],'_c')?!![]:![],'options':_0x1ba1bc[_0xd474('0x4a')]?_['map'](_[_0xd474('0x79')](_0x1ba1bc[_0xd474('0x4a')]),function(_0x1e4857){return{'name':_0x1e4857[_0xd474('0x7a')],'value':_0x1e4857[_0xd474('0x31')]};}):[]};})};}})['then'](respondWithResult(_0x138202,null))[_0xd474('0x24')](function(_0x5555b0){var _0x31e8c5=_0x5ed2bb[_0xd474('0x3b')][_0xd474('0x7b')]?0x1f4:_0x5555b0[_0xd474('0x7c')]||0x1f4;logger[_0xd474('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xd474('0x60'),_0x31e8c5,JSON[_0xd474('0x1e')](_0x5555b0));delete _0x5555b0['name'];if(_0x31e8c5===0x191){_0x31e8c5=0x190;}_0x138202[_0xd474('0x25')](_0x31e8c5)[_0xd474('0x32')](_0x5ed2bb[_0xd474('0x3b')][_0xd474('0x7b')]?{'message':_0xd474('0x7d'),'statusCode':_0x5555b0[_0xd474('0x7c')]}:_0x5555b0);});}else{var _0x110803=0x1f4;_0x138202['status'](_0x110803)[_0xd474('0x32')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xbfd3=['remove','includes','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','count','offset','limit','set','save','update','then','destroy','stack','name','send','index','SugarcrmAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','username','password','remoteUri','slice','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','module_fields'];(function(_0xd21618,_0x1c88fc){var _0x4ad2e5=function(_0x44badf){while(--_0x44badf){_0xd21618['push'](_0xd21618['shift']());}};_0x4ad2e5(++_0x1c88fc);}(_0xbfd3,0x84));var _0x3bfd=function(_0x21edda,_0x4135e9){_0x21edda=_0x21edda-0x0;var _0x19161a=_0xbfd3[_0x21edda];return _0x19161a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3bfd('0x0'));var zipdir=require(_0x3bfd('0x1'));var jsonpatch=require(_0x3bfd('0x2'));var rp=require(_0x3bfd('0x3'));var moment=require(_0x3bfd('0x4'));var BPromise=require(_0x3bfd('0x5'));var Mustache=require(_0x3bfd('0x6'));var util=require(_0x3bfd('0x7'));var path=require(_0x3bfd('0x8'));var sox=require(_0x3bfd('0x9'));var csv=require(_0x3bfd('0xa'));var ejs=require(_0x3bfd('0xb'));var fs=require('fs');var _=require(_0x3bfd('0xc'));var squel=require(_0x3bfd('0xd'));var crypto=require(_0x3bfd('0xe'));var jsforce=require(_0x3bfd('0xf'));var deskjs=require(_0x3bfd('0x10'));var toCsv=require(_0x3bfd('0xa'));var querystring=require(_0x3bfd('0x11'));var Papa=require(_0x3bfd('0x12'));var Redis=require(_0x3bfd('0x13'));var authService=require(_0x3bfd('0x14'));var qs=require(_0x3bfd('0x15'));var as=require(_0x3bfd('0x16'));var hardwareService=require(_0x3bfd('0x17'));var logger=require(_0x3bfd('0x18'))(_0x3bfd('0x19'));var utils=require(_0x3bfd('0x1a'));var config=require(_0x3bfd('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3bfd('0x1c'));var jayson=require('jayson/promise');var client=jayson[_0x3bfd('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x106720,_0x4527dc,_0x1f674f,_0xa149d3){return new BPromise(function(_0x125c3c,_0x1b8ef3){var _0x4baaa7=_0xa149d3||client;return _0x4baaa7['request'](_0x106720,_0x1f674f)['then'](function(_0x4a34e){logger[_0x3bfd('0x1e')](_0x3bfd('0x1f'),_0x4527dc,_0x3bfd('0x20'));logger['debug'](_0x3bfd('0x21'),_0x4527dc,_0x3bfd('0x20'),JSON[_0x3bfd('0x22')](_0x4a34e));if(_0x4a34e[_0x3bfd('0x23')]){if(_0x4a34e[_0x3bfd('0x23')][_0x3bfd('0x24')]===0x1f4){logger[_0x3bfd('0x23')](_0x3bfd('0x1f'),_0x4527dc,_0x4a34e[_0x3bfd('0x23')][_0x3bfd('0x25')]);return _0x1b8ef3(_0x4a34e['error'][_0x3bfd('0x25')]);}logger[_0x3bfd('0x23')](_0x3bfd('0x1f'),_0x4527dc,_0x4a34e[_0x3bfd('0x23')][_0x3bfd('0x25')]);return _0x125c3c(_0x4a34e['error'][_0x3bfd('0x25')]);}else{logger[_0x3bfd('0x1e')](_0x3bfd('0x1f'),_0x4527dc,_0x3bfd('0x20'));_0x125c3c(_0x4a34e['result']['message']);}})[_0x3bfd('0x26')](function(_0x38c2c7){logger[_0x3bfd('0x23')](_0x3bfd('0x1f'),_0x4527dc,_0x38c2c7);_0x1b8ef3(_0x38c2c7);});});}function respondWithStatusCode(_0x11473c,_0x558a63){_0x558a63=_0x558a63||0xcc;return function(_0x471ce8){if(_0x471ce8){return _0x11473c['sendStatus'](_0x558a63);}return _0x11473c['status'](_0x558a63)[_0x3bfd('0x27')]();};}function respondWithResult(_0x3acde9,_0x51ba37){_0x51ba37=_0x51ba37||0xc8;return function(_0x41e4c4){if(_0x41e4c4){return _0x3acde9[_0x3bfd('0x28')](_0x51ba37)[_0x3bfd('0x29')](_0x41e4c4);}};}function respondWithFilteredResult(_0x2f7855,_0x29cd84){return function(_0x55b146){if(_0x55b146){var _0x4ad590=_0x55b146[_0x3bfd('0x2a')],_0x287fa0=_0x29cd84[_0x3bfd('0x2b')],_0x159d40=_0x29cd84['offset']+_0x29cd84[_0x3bfd('0x2c')],_0x5e4fc0;if(_0x159d40>=_0x4ad590){_0x159d40=_0x4ad590;_0x5e4fc0=0xc8;}else{_0x5e4fc0=0xce;}_0x2f7855[_0x3bfd('0x28')](_0x5e4fc0);return _0x2f7855[_0x3bfd('0x2d')]('Content-Range',_0x287fa0+'-'+_0x159d40+'/'+_0x4ad590)[_0x3bfd('0x29')](_0x55b146);}return null;};}function patchUpdates(_0x45aad1){return function(_0x1a809f){try{jsonpatch['apply'](_0x1a809f,_0x45aad1,!![]);}catch(_0x40cd58){return BPromise['reject'](_0x40cd58);}return _0x1a809f[_0x3bfd('0x2e')]();};}function saveUpdates(_0x2740c8,_0x4e4721){return function(_0x2e1994){if(_0x2e1994){return _0x2e1994[_0x3bfd('0x2f')](_0x2740c8)[_0x3bfd('0x30')](function(_0x58ee88){return _0x58ee88;});}return null;};}function removeEntity(_0x5025d8,_0x51f8da){return function(_0x53c9fd){if(_0x53c9fd){return _0x53c9fd[_0x3bfd('0x31')]()[_0x3bfd('0x30')](function(){_0x5025d8[_0x3bfd('0x28')](0xcc)[_0x3bfd('0x27')]();});}};}function handleEntityNotFound(_0x243972,_0x8065cf){return function(_0x5e0851){if(!_0x5e0851){_0x243972['sendStatus'](0x194);}return _0x5e0851;};}function handleError(_0x10c4eb,_0x5aa589){_0x5aa589=_0x5aa589||0x1f4;return function(_0x103bb2){logger[_0x3bfd('0x23')](_0x103bb2[_0x3bfd('0x32')]);if(_0x103bb2[_0x3bfd('0x33')]){delete _0x103bb2[_0x3bfd('0x33')];}_0x10c4eb[_0x3bfd('0x28')](_0x5aa589)[_0x3bfd('0x34')](_0x103bb2);};}exports[_0x3bfd('0x35')]=function(_0x5992f7,_0x151a6d){var _0x5135b5={},_0x3af35c={},_0x29873f={'count':0x0,'rows':[]};var _0x48c1cf=_['map'](db[_0x3bfd('0x36')][_0x3bfd('0x37')],function(_0x239536){return{'name':_0x239536['fieldName'],'type':_0x239536['type'][_0x3bfd('0x38')]};});_0x3af35c[_0x3bfd('0x39')]=_[_0x3bfd('0x3a')](_0x48c1cf,'name');_0x3af35c[_0x3bfd('0x3b')]=_[_0x3bfd('0x3c')](_0x5992f7[_0x3bfd('0x3b')]);_0x3af35c[_0x3bfd('0x3d')]=_[_0x3bfd('0x3e')](_0x3af35c[_0x3bfd('0x39')],_0x3af35c[_0x3bfd('0x3b')]);_0x5135b5[_0x3bfd('0x3f')]=_[_0x3bfd('0x3e')](_0x3af35c[_0x3bfd('0x39')],qs[_0x3bfd('0x40')](_0x5992f7[_0x3bfd('0x3b')]['fields']));_0x5135b5[_0x3bfd('0x3f')]=_0x5135b5[_0x3bfd('0x3f')][_0x3bfd('0x41')]?_0x5135b5[_0x3bfd('0x3f')]:_0x3af35c[_0x3bfd('0x39')];if(!_0x5992f7[_0x3bfd('0x3b')][_0x3bfd('0x42')](_0x3bfd('0x43'))){_0x5135b5[_0x3bfd('0x2c')]=qs[_0x3bfd('0x2c')](_0x5992f7[_0x3bfd('0x3b')][_0x3bfd('0x2c')]);_0x5135b5[_0x3bfd('0x2b')]=qs['offset'](_0x5992f7[_0x3bfd('0x3b')][_0x3bfd('0x2b')]);}_0x5135b5[_0x3bfd('0x44')]=qs['sort'](_0x5992f7['query'][_0x3bfd('0x45')]);_0x5135b5[_0x3bfd('0x46')]=qs[_0x3bfd('0x3d')](_[_0x3bfd('0x47')](_0x5992f7[_0x3bfd('0x3b')],_0x3af35c[_0x3bfd('0x3d')]),_0x48c1cf);if(_0x5992f7[_0x3bfd('0x3b')][_0x3bfd('0x48')]){_0x5135b5[_0x3bfd('0x46')]=_[_0x3bfd('0x49')](_0x5135b5[_0x3bfd('0x46')],{'$or':_['map'](_0x48c1cf,function(_0x680fb){if(_0x680fb['type']!=='VIRTUAL'){var _0x365e6c={};_0x365e6c[_0x680fb[_0x3bfd('0x33')]]={'$like':'%'+_0x5992f7[_0x3bfd('0x3b')][_0x3bfd('0x48')]+'%'};return _0x365e6c;}})});}_0x5135b5=_[_0x3bfd('0x49')]({},_0x5135b5,_0x5992f7[_0x3bfd('0x4a')]);var _0x5380bc={'where':_0x5135b5[_0x3bfd('0x46')]};return db[_0x3bfd('0x36')][_0x3bfd('0x2a')](_0x5380bc)['then'](function(_0x45ca01){_0x29873f['count']=_0x45ca01;if(_0x5992f7[_0x3bfd('0x3b')]['includeAll']){_0x5135b5[_0x3bfd('0x4b')]=[{'all':!![]}];}return db[_0x3bfd('0x36')][_0x3bfd('0x4c')](_0x5135b5);})[_0x3bfd('0x30')](function(_0x31f2fc){_0x29873f['rows']=_0x31f2fc;return _0x29873f;})[_0x3bfd('0x30')](respondWithFilteredResult(_0x151a6d,_0x5135b5))[_0x3bfd('0x26')](handleError(_0x151a6d,null));};exports[_0x3bfd('0x4d')]=function(_0x572697,_0x576d14){var _0x52f53d={'raw':![],'where':{'id':_0x572697[_0x3bfd('0x4e')]['id']}},_0x3eb3cf={};_0x3eb3cf['model']=_['keys'](db[_0x3bfd('0x36')][_0x3bfd('0x37')]);_0x3eb3cf[_0x3bfd('0x3b')]=_[_0x3bfd('0x3c')](_0x572697[_0x3bfd('0x3b')]);_0x3eb3cf[_0x3bfd('0x3d')]=_[_0x3bfd('0x3e')](_0x3eb3cf[_0x3bfd('0x39')],_0x3eb3cf['query']);_0x52f53d[_0x3bfd('0x3f')]=_['intersection'](_0x3eb3cf[_0x3bfd('0x39')],qs[_0x3bfd('0x40')](_0x572697[_0x3bfd('0x3b')][_0x3bfd('0x40')]));_0x52f53d[_0x3bfd('0x3f')]=_0x52f53d[_0x3bfd('0x3f')][_0x3bfd('0x41')]?_0x52f53d[_0x3bfd('0x3f')]:_0x3eb3cf['model'];if(_0x572697[_0x3bfd('0x3b')]['includeAll']){_0x52f53d[_0x3bfd('0x4b')]=[{'all':!![]}];}_0x52f53d=_[_0x3bfd('0x49')]({},_0x52f53d,_0x572697[_0x3bfd('0x4a')]);return db['SugarcrmAccount'][_0x3bfd('0x4f')](_0x52f53d)[_0x3bfd('0x30')](handleEntityNotFound(_0x576d14,null))['then'](respondWithResult(_0x576d14,null))[_0x3bfd('0x26')](handleError(_0x576d14,null));};exports[_0x3bfd('0x50')]=function(_0x1727ff,_0x1050a4){return db[_0x3bfd('0x36')][_0x3bfd('0x50')](_0x1727ff[_0x3bfd('0x51')],{})['then'](respondWithResult(_0x1050a4,0xc9))[_0x3bfd('0x26')](handleError(_0x1050a4,null));};exports[_0x3bfd('0x2f')]=function(_0x35b840,_0x30abf3){if(_0x35b840['body']['id']){delete _0x35b840[_0x3bfd('0x51')]['id'];}return db['SugarcrmAccount'][_0x3bfd('0x4f')]({'where':{'id':_0x35b840[_0x3bfd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x30abf3,null))['then'](saveUpdates(_0x35b840['body'],null))[_0x3bfd('0x30')](respondWithResult(_0x30abf3,null))[_0x3bfd('0x26')](handleError(_0x30abf3,null));};exports[_0x3bfd('0x31')]=function(_0x1a4d09,_0x15d930){return db['SugarcrmAccount']['find']({'where':{'id':_0x1a4d09[_0x3bfd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x15d930,null))[_0x3bfd('0x30')](removeEntity(_0x15d930,null))[_0x3bfd('0x26')](handleError(_0x15d930,null));};exports['getConfigurations']=function(_0x208c2b,_0x1447c8,_0x598f3b){var _0x23f832={};var _0x4740db={};var _0x49b831;var _0x4128e9;return db['SugarcrmAccount'][_0x3bfd('0x52')]({'where':{'id':_0x208c2b[_0x3bfd('0x4e')]['id']}})[_0x3bfd('0x30')](handleEntityNotFound(_0x1447c8,null))['then'](function(_0x33bf5a){if(_0x33bf5a){_0x49b831=_0x33bf5a;_0x4740db['model']=_[_0x3bfd('0x3c')](db[_0x3bfd('0x53')][_0x3bfd('0x37')]);_0x4740db[_0x3bfd('0x3b')]=_[_0x3bfd('0x3c')](_0x208c2b['query']);_0x4740db[_0x3bfd('0x3d')]=_[_0x3bfd('0x3e')](_0x4740db['model'],_0x4740db[_0x3bfd('0x3b')]);_0x23f832['attributes']=_[_0x3bfd('0x3e')](_0x4740db[_0x3bfd('0x39')],qs[_0x3bfd('0x40')](_0x208c2b[_0x3bfd('0x3b')][_0x3bfd('0x40')]));_0x23f832['attributes']=_0x23f832[_0x3bfd('0x3f')][_0x3bfd('0x41')]?_0x23f832[_0x3bfd('0x3f')]:_0x4740db[_0x3bfd('0x39')];_0x23f832[_0x3bfd('0x44')]=qs['sort'](_0x208c2b[_0x3bfd('0x3b')][_0x3bfd('0x45')]);_0x23f832[_0x3bfd('0x46')]=qs[_0x3bfd('0x3d')](_[_0x3bfd('0x47')](_0x208c2b['query'],_0x4740db[_0x3bfd('0x3d')]));if(_0x208c2b[_0x3bfd('0x3b')][_0x3bfd('0x48')]){_0x23f832[_0x3bfd('0x46')]=_['merge'](_0x23f832[_0x3bfd('0x46')],{'$or':_[_0x3bfd('0x3a')](_0x23f832['attributes'],function(_0x3423fc){var _0x4c0b46={};_0x4c0b46[_0x3423fc]={'$like':'%'+_0x208c2b[_0x3bfd('0x3b')][_0x3bfd('0x48')]+'%'};return _0x4c0b46;})});}_0x23f832=_['merge']({},_0x23f832,_0x208c2b[_0x3bfd('0x4a')]);return _0x49b831[_0x3bfd('0x54')](_0x23f832);}})[_0x3bfd('0x30')](function(_0x526b54){if(_0x526b54){_0x4128e9=_0x526b54[_0x3bfd('0x41')];if(!_0x208c2b[_0x3bfd('0x3b')][_0x3bfd('0x42')](_0x3bfd('0x43'))){_0x23f832[_0x3bfd('0x2c')]=qs[_0x3bfd('0x2c')](_0x208c2b[_0x3bfd('0x3b')][_0x3bfd('0x2c')]);_0x23f832[_0x3bfd('0x2b')]=qs[_0x3bfd('0x2b')](_0x208c2b[_0x3bfd('0x3b')][_0x3bfd('0x2b')]);}return _0x49b831['getConfigurations'](_0x23f832);}})['then'](function(_0x12b58a){if(_0x12b58a){return _0x12b58a?{'count':_0x4128e9,'rows':_0x12b58a}:null;}})['then'](respondWithResult(_0x1447c8,null))[_0x3bfd('0x26')](handleError(_0x1447c8,null));};exports['addConfiguration']=function(_0x3fbe7d,_0xa7484a,_0x19105c){if(_0x3fbe7d[_0x3bfd('0x51')]['id']){delete _0x3fbe7d['body']['id'];}return db[_0x3bfd('0x36')][_0x3bfd('0x52')]({'where':{'id':_0x3fbe7d['params']['id']}})['then'](handleEntityNotFound(_0xa7484a,null))[_0x3bfd('0x30')](function(_0x145c38){if(_0x145c38){_0x3fbe7d['body']['AccountId']=_0x145c38['id'];_0x3fbe7d[_0x3bfd('0x51')][_0x3bfd('0x55')]=integrations[_0x3bfd('0x56')](_0x3fbe7d[_0x3bfd('0x51')]['channel'],_0x3fbe7d[_0x3bfd('0x51')][_0x3bfd('0x57')]);_0x3fbe7d[_0x3bfd('0x51')][_0x3bfd('0x58')]=integrations[_0x3bfd('0x59')](_0x3fbe7d[_0x3bfd('0x51')][_0x3bfd('0x5a')],_0x3fbe7d[_0x3bfd('0x51')]['type']);return db['SugarcrmConfiguration'][_0x3bfd('0x50')](_0x3fbe7d[_0x3bfd('0x51')],{'include':[{'model':db[_0x3bfd('0x5b')],'as':_0x3bfd('0x55')},{'model':db['SugarcrmField'],'as':_0x3bfd('0x58')}]});}return null;})[_0x3bfd('0x30')](respondWithResult(_0xa7484a,null))[_0x3bfd('0x26')](handleError(_0xa7484a,null));};exports[_0x3bfd('0x5c')]=function(_0x42c9a0,_0x2e0f35,_0x449b21){var _0x25477e='';var _0x2a8ad7=['id',_0x3bfd('0x33'),_0x3bfd('0x5d'),_0x3bfd('0x5e'),'description',_0x3bfd('0x5f'),'duration_hours',_0x3bfd('0x60'),_0x3bfd('0x61'),_0x3bfd('0x62'),'parent_name','direction'];return db[_0x3bfd('0x36')][_0x3bfd('0x52')]({'where':{'id':_0x42c9a0[_0x3bfd('0x4e')]['id']},'attributes':['id',_0x3bfd('0x63'),_0x3bfd('0x64'),'remoteUri']})['then'](handleEntityNotFound(_0x2e0f35,null))[_0x3bfd('0x30')](function(_0x48d8c6){if(_0x48d8c6){_0x25477e=_0x48d8c6[_0x3bfd('0x65')];var _0x4e3cc5=_0x25477e[_0x3bfd('0x66')](-0x1);if(_0x4e3cc5==='/'){_0x25477e=_0x25477e['substring'](0x0,_0x25477e['lastIndexOf'](_0x4e3cc5));}return rp({'method':_0x3bfd('0x67'),'uri':util[_0x3bfd('0x68')](_0x3bfd('0x69'),_0x25477e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x3bfd('0x6a'),'input_type':_0x3bfd('0x6b'),'response_type':_0x3bfd('0x6b'),'rest_data':JSON[_0x3bfd('0x22')]({'user_auth':{'user_name':_0x48d8c6[_0x3bfd('0x63')],'password':_0x48d8c6[_0x3bfd('0x64')],'encryption':_0x3bfd('0x6c')},'application':_0x3bfd('0x6d')})}});}})[_0x3bfd('0x30')](function(_0x2971c0){if(_0x2971c0&&_0x2971c0['name']!=='Invalid\x20Login'&&_0x2971c0[_0x3bfd('0x33')]!==_0x3bfd('0x6e')){return rp({'method':'POST','uri':util[_0x3bfd('0x68')](_0x3bfd('0x69'),_0x25477e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x3bfd('0x6f'),'input_type':_0x3bfd('0x6b'),'response_type':_0x3bfd('0x6b'),'rest_data':JSON[_0x3bfd('0x22')]({'session':_0x2971c0['id'],'module_name':_0x3bfd('0x70')})}})['then'](function(_0x1678ff){if(_0x1678ff){var _0x382a8b=_['values'](_0x1678ff[_0x3bfd('0x71')]);_[_0x3bfd('0x72')](_0x382a8b,function(_0x18c6f1){return _0x2a8ad7[_0x3bfd('0x73')](_0x18c6f1['name']);});return{'count':_0x382a8b[_0x3bfd('0x41')],'rows':_[_0x3bfd('0x3a')](_0x382a8b,function(_0x57df68){return{'id':_0x57df68[_0x3bfd('0x33')],'name':_0x57df68['label'],'custom':_[_0x3bfd('0x74')](_0x57df68[_0x3bfd('0x33')],'_c')?!![]:![],'options':_0x57df68[_0x3bfd('0x4a')]?_[_0x3bfd('0x3a')](_[_0x3bfd('0x75')](_0x57df68['options']),function(_0x4fd887){return{'name':_0x4fd887[_0x3bfd('0x76')],'value':_0x4fd887[_0x3bfd('0x33')]};}):[]};})};}})[_0x3bfd('0x30')](respondWithResult(_0x2e0f35,null))[_0x3bfd('0x26')](function(_0x4f64bd){var _0x298520=_0x42c9a0[_0x3bfd('0x3b')]['test']?0x1f4:_0x4f64bd[_0x3bfd('0x77')]||0x1f4;logger[_0x3bfd('0x23')](_0x3bfd('0x78'),'getFields',_0x298520,JSON['stringify'](_0x4f64bd));delete _0x4f64bd[_0x3bfd('0x33')];if(_0x298520===0x191){_0x298520=0x190;}_0x2e0f35[_0x3bfd('0x28')](_0x298520)[_0x3bfd('0x34')](_0x42c9a0[_0x3bfd('0x3b')][_0x3bfd('0x79')]?{'message':_0x3bfd('0x7a'),'statusCode':_0x4f64bd['statusCode']}:_0x4f64bd);});}else{var _0x260121=0x1f4;_0x2e0f35[_0x3bfd('0x28')](_0x260121)[_0x3bfd('0x34')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 4f81c8b..6607024 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 _0xb784=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x3a349e,_0x35c4af){var _0x3130ae=function(_0xfebce5){while(--_0xfebce5){_0x3a349e['push'](_0x3a349e['shift']());}};_0x3130ae(++_0x35c4af);}(_0xb784,0x16d));var _0x4b78=function(_0xbfe284,_0x4c162c){_0xbfe284=_0xbfe284-0x0;var _0x94832b=_0xb784[_0xbfe284];return _0x94832b;};'use strict';var _=require(_0x4b78('0x0'));var util=require(_0x4b78('0x1'));var logger=require(_0x4b78('0x2'))(_0x4b78('0x3'));var moment=require(_0x4b78('0x4'));var BPromise=require(_0x4b78('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b78('0x6'));var rimraf=require(_0x4b78('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x4b78('0x8'));module[_0x4b78('0x9')]=function(_0x3965e7,_0x27bd99){return _0x3965e7[_0x4b78('0xa')](_0x4b78('0xb'),attributes,{'tableName':_0x4b78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44df=['./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x44df,0x94));var _0xf44d=function(_0x485d75,_0x18a4eb){_0x485d75=_0x485d75-0x0;var _0x18584c=_0x44df[_0x485d75];return _0x18584c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf44d('0x0'))(_0xf44d('0x1'));var moment=require('moment');var BPromise=require(_0xf44d('0x2'));var rp=require(_0xf44d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf44d('0x4'));var config=require(_0xf44d('0x5'));var attributes=require(_0xf44d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xf44d('0x7')]=function(_0x4ce73f,_0x3e3b4d){return _0x4ce73f[_0xf44d('0x8')](_0xf44d('0x9'),attributes,{'tableName':_0xf44d('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 424bf15..fe9a15c 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 _0xe9fb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x251432,_0x29226e){var _0x291d1e=function(_0x56963a){while(--_0x56963a){_0x251432['push'](_0x251432['shift']());}};_0x291d1e(++_0x29226e);}(_0xe9fb,0xf0));var _0xbe9f=function(_0x113638,_0x3104fe){_0x113638=_0x113638-0x0;var _0x43adca=_0xe9fb[_0x113638];return _0x43adca;};'use strict';var _=require(_0xbe9f('0x0'));var util=require(_0xbe9f('0x1'));var moment=require('moment');var BPromise=require(_0xbe9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe9f('0x3'));var db=require(_0xbe9f('0x4'))['db'];var utils=require(_0xbe9f('0x5'));var logger=require(_0xbe9f('0x6'))(_0xbe9f('0x7'));var config=require(_0xbe9f('0x8'));var jayson=require(_0xbe9f('0x9'));var client=jayson[_0xbe9f('0xa')][_0xbe9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x506b8a,_0x506496,_0x47d24b){return new BPromise(function(_0x4fe3ee,_0x1a1598){return client[_0xbe9f('0xc')](_0x506b8a,_0x47d24b)[_0xbe9f('0xd')](function(_0x251072){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x506496,_0xbe9f('0xe'));logger[_0xbe9f('0xf')](_0xbe9f('0x10'),_0x506496,_0xbe9f('0xe'),JSON[_0xbe9f('0x11')](_0x251072));if(_0x251072[_0xbe9f('0x12')]){if(_0x251072[_0xbe9f('0x12')]['code']===0x1f4){logger[_0xbe9f('0x12')](_0xbe9f('0x13'),_0x506496,_0x251072[_0xbe9f('0x12')][_0xbe9f('0x14')]);return _0x1a1598(_0x251072[_0xbe9f('0x12')][_0xbe9f('0x14')]);}logger[_0xbe9f('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x506496,_0x251072[_0xbe9f('0x12')][_0xbe9f('0x14')]);return _0x4fe3ee(_0x251072[_0xbe9f('0x12')][_0xbe9f('0x14')]);}else{logger[_0xbe9f('0x15')](_0xbe9f('0x13'),_0x506496,_0xbe9f('0xe'));_0x4fe3ee(_0x251072[_0xbe9f('0x16')][_0xbe9f('0x14')]);}})[_0xbe9f('0x17')](function(_0x33afea){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x506496,_0x33afea);_0x1a1598(_0x33afea);});});}exports['GetSugarcrmAccount']=function(_0x575d7b){var _0x1b5290=this;return new Promise(function(_0x143ac1,_0x9ee9d2){return db[_0xbe9f('0x18')][_0xbe9f('0x19')]({'raw':_0x575d7b[_0xbe9f('0x1a')]?_0x575d7b[_0xbe9f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x575d7b[_0xbe9f('0x1a')]?_0x575d7b[_0xbe9f('0x1a')][_0xbe9f('0x1b')]||null:null,'attributes':_0x575d7b[_0xbe9f('0x1a')]?_0x575d7b['options'][_0xbe9f('0x1c')]||null:null,'limit':_0x575d7b[_0xbe9f('0x1a')]?_0x575d7b[_0xbe9f('0x1a')][_0xbe9f('0x1d')]||null:null,'include':_0x575d7b['options']?_0x575d7b[_0xbe9f('0x1a')][_0xbe9f('0x1e')]?_[_0xbe9f('0x1f')](_0x575d7b['options'][_0xbe9f('0x1e')],function(_0x5d3124){return{'model':db[_0x5d3124[_0xbe9f('0x20')]],'as':_0x5d3124['as'],'attributes':_0x5d3124[_0xbe9f('0x1c')],'include':_0x5d3124['include']?_['map'](_0x5d3124[_0xbe9f('0x1e')],function(_0x34f137){return{'model':db[_0x34f137[_0xbe9f('0x20')]],'as':_0x34f137['as'],'attributes':_0x34f137[_0xbe9f('0x1c')],'include':_0x34f137[_0xbe9f('0x1e')]?_[_0xbe9f('0x1f')](_0x34f137[_0xbe9f('0x1e')],function(_0x3959f9){return{'model':db[_0x3959f9[_0xbe9f('0x20')]],'as':_0x3959f9['as'],'attributes':_0x3959f9[_0xbe9f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe9f('0xd')](function(_0xea50ef){logger['info'](_0xbe9f('0x21'),_0x575d7b);logger[_0xbe9f('0xf')]('GetSugarcrmAccount',_0x575d7b,JSON['stringify'](_0xea50ef));_0x143ac1(_0xea50ef);})['catch'](function(_0x6ed2c5){logger[_0xbe9f('0x12')](_0xbe9f('0x21'),_0x6ed2c5[_0xbe9f('0x14')],_0x575d7b);_0x9ee9d2(_0x1b5290[_0xbe9f('0x12')](0x1f4,_0x6ed2c5[_0xbe9f('0x14')]));});});};exports[_0xbe9f('0x22')]=function(_0x1e9e93){var _0x3bea05=this;return new Promise(function(_0x332aab,_0x45ad5d){return db['SugarcrmAccount']['find']({'raw':_0x1e9e93[_0xbe9f('0x1a')]?_0x1e9e93['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e9e93[_0xbe9f('0x1a')]?_0x1e9e93['options'][_0xbe9f('0x1b')]||null:null,'attributes':_0x1e9e93['options']?_0x1e9e93[_0xbe9f('0x1a')][_0xbe9f('0x1c')]||null:null,'include':_0x1e9e93[_0xbe9f('0x1a')]?_0x1e9e93[_0xbe9f('0x1a')][_0xbe9f('0x1e')]?_[_0xbe9f('0x1f')](_0x1e9e93[_0xbe9f('0x1a')][_0xbe9f('0x1e')],function(_0x4f8f65){return{'model':db[_0x4f8f65['model']],'as':_0x4f8f65['as'],'attributes':_0x4f8f65[_0xbe9f('0x1c')],'include':_0x4f8f65[_0xbe9f('0x1e')]?_[_0xbe9f('0x1f')](_0x4f8f65['include'],function(_0x4129fb){return{'model':db[_0x4129fb[_0xbe9f('0x20')]],'as':_0x4129fb['as'],'attributes':_0x4129fb[_0xbe9f('0x1c')],'include':_0x4129fb['include']?_['map'](_0x4129fb[_0xbe9f('0x1e')],function(_0x16380d){return{'model':db[_0x16380d[_0xbe9f('0x20')]],'as':_0x16380d['as'],'attributes':_0x16380d[_0xbe9f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe9f('0xd')](function(_0x1169c5){logger[_0xbe9f('0x15')](_0xbe9f('0x22'),_0x1e9e93);logger[_0xbe9f('0xf')](_0xbe9f('0x22'),_0x1e9e93,JSON[_0xbe9f('0x11')](_0x1169c5));_0x332aab(_0x1169c5);})[_0xbe9f('0x17')](function(_0x178103){logger[_0xbe9f('0x12')]('ShowSugarcrmAccount',_0x178103['message'],_0x1e9e93);_0x45ad5d(_0x3bea05[_0xbe9f('0x12')](0x1f4,_0x178103[_0xbe9f('0x14')]));});});}; \ No newline at end of file +var _0x6f10=['raw','where','limit','include','map','model','attributes','then','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options'];(function(_0x4ed9c9,_0x1b9648){var _0x591fc0=function(_0x11c379){while(--_0x11c379){_0x4ed9c9['push'](_0x4ed9c9['shift']());}};_0x591fc0(++_0x1b9648);}(_0x6f10,0x1ba));var _0x06f1=function(_0x632300,_0x311819){_0x632300=_0x632300-0x0;var _0x497ead=_0x6f10[_0x632300];return _0x497ead;};'use strict';var _=require(_0x06f1('0x0'));var util=require('util');var moment=require(_0x06f1('0x1'));var BPromise=require(_0x06f1('0x2'));var rs=require(_0x06f1('0x3'));var fs=require('fs');var Redis=require(_0x06f1('0x4'));var db=require(_0x06f1('0x5'))['db'];var utils=require(_0x06f1('0x6'));var logger=require(_0x06f1('0x7'))(_0x06f1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x06f1('0x9')][_0x06f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116e57,_0x30bb87,_0x19e7e8){return new BPromise(function(_0x203188,_0x4468de){return client[_0x06f1('0xb')](_0x116e57,_0x19e7e8)['then'](function(_0x10ecbc){logger[_0x06f1('0xc')](_0x06f1('0xd'),_0x30bb87,_0x06f1('0xe'));logger[_0x06f1('0xf')](_0x06f1('0x10'),_0x30bb87,_0x06f1('0xe'),JSON[_0x06f1('0x11')](_0x10ecbc));if(_0x10ecbc['error']){if(_0x10ecbc[_0x06f1('0x12')][_0x06f1('0x13')]===0x1f4){logger[_0x06f1('0x12')](_0x06f1('0xd'),_0x30bb87,_0x10ecbc[_0x06f1('0x12')][_0x06f1('0x14')]);return _0x4468de(_0x10ecbc[_0x06f1('0x12')][_0x06f1('0x14')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x30bb87,_0x10ecbc[_0x06f1('0x12')][_0x06f1('0x14')]);return _0x203188(_0x10ecbc[_0x06f1('0x12')][_0x06f1('0x14')]);}else{logger[_0x06f1('0xc')](_0x06f1('0xd'),_0x30bb87,_0x06f1('0xe'));_0x203188(_0x10ecbc[_0x06f1('0x15')][_0x06f1('0x14')]);}})[_0x06f1('0x16')](function(_0x59fb45){logger['error'](_0x06f1('0xd'),_0x30bb87,_0x59fb45);_0x4468de(_0x59fb45);});});}exports[_0x06f1('0x17')]=function(_0x3a1344){var _0x3c39af=this;return new Promise(function(_0x4cb556,_0x33e348){return db[_0x06f1('0x18')]['findAll']({'raw':_0x3a1344[_0x06f1('0x19')]?_0x3a1344[_0x06f1('0x19')][_0x06f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a1344['options']?_0x3a1344[_0x06f1('0x19')][_0x06f1('0x1b')]||null:null,'attributes':_0x3a1344[_0x06f1('0x19')]?_0x3a1344['options']['attributes']||null:null,'limit':_0x3a1344[_0x06f1('0x19')]?_0x3a1344[_0x06f1('0x19')][_0x06f1('0x1c')]||null:null,'include':_0x3a1344[_0x06f1('0x19')]?_0x3a1344[_0x06f1('0x19')][_0x06f1('0x1d')]?_[_0x06f1('0x1e')](_0x3a1344['options'][_0x06f1('0x1d')],function(_0x2fa69c){return{'model':db[_0x2fa69c[_0x06f1('0x1f')]],'as':_0x2fa69c['as'],'attributes':_0x2fa69c['attributes'],'include':_0x2fa69c['include']?_[_0x06f1('0x1e')](_0x2fa69c[_0x06f1('0x1d')],function(_0x8c396b){return{'model':db[_0x8c396b[_0x06f1('0x1f')]],'as':_0x8c396b['as'],'attributes':_0x8c396b[_0x06f1('0x20')],'include':_0x8c396b['include']?_['map'](_0x8c396b[_0x06f1('0x1d')],function(_0x4c676d){return{'model':db[_0x4c676d['model']],'as':_0x4c676d['as'],'attributes':_0x4c676d['attributes']};}):[]};}):[]};}):[]:[]})[_0x06f1('0x21')](function(_0x2605d3){logger[_0x06f1('0xc')](_0x06f1('0x17'),_0x3a1344);logger[_0x06f1('0xf')](_0x06f1('0x17'),_0x3a1344,JSON[_0x06f1('0x11')](_0x2605d3));_0x4cb556(_0x2605d3);})[_0x06f1('0x16')](function(_0x1b3fea){logger[_0x06f1('0x12')](_0x06f1('0x17'),_0x1b3fea[_0x06f1('0x14')],_0x3a1344);_0x33e348(_0x3c39af['error'](0x1f4,_0x1b3fea[_0x06f1('0x14')]));});});};exports[_0x06f1('0x22')]=function(_0x5f3305){var _0x120b68=this;return new Promise(function(_0x425b72,_0x388de4){return db[_0x06f1('0x18')][_0x06f1('0x23')]({'raw':_0x5f3305[_0x06f1('0x19')]?_0x5f3305[_0x06f1('0x19')][_0x06f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f3305[_0x06f1('0x19')]?_0x5f3305[_0x06f1('0x19')]['where']||null:null,'attributes':_0x5f3305['options']?_0x5f3305[_0x06f1('0x19')]['attributes']||null:null,'include':_0x5f3305[_0x06f1('0x19')]?_0x5f3305[_0x06f1('0x19')][_0x06f1('0x1d')]?_['map'](_0x5f3305['options'][_0x06f1('0x1d')],function(_0x568cf8){return{'model':db[_0x568cf8[_0x06f1('0x1f')]],'as':_0x568cf8['as'],'attributes':_0x568cf8[_0x06f1('0x20')],'include':_0x568cf8[_0x06f1('0x1d')]?_['map'](_0x568cf8['include'],function(_0xc21758){return{'model':db[_0xc21758[_0x06f1('0x1f')]],'as':_0xc21758['as'],'attributes':_0xc21758[_0x06f1('0x20')],'include':_0xc21758[_0x06f1('0x1d')]?_[_0x06f1('0x1e')](_0xc21758['include'],function(_0x23c01f){return{'model':db[_0x23c01f[_0x06f1('0x1f')]],'as':_0x23c01f['as'],'attributes':_0x23c01f['attributes']};}):[]};}):[]};}):[]:[]})[_0x06f1('0x21')](function(_0x52ace9){logger[_0x06f1('0xc')](_0x06f1('0x22'),_0x5f3305);logger['debug'](_0x06f1('0x22'),_0x5f3305,JSON[_0x06f1('0x11')](_0x52ace9));_0x425b72(_0x52ace9);})['catch'](function(_0x4e8d85){logger[_0x06f1('0x12')]('ShowSugarcrmAccount',_0x4e8d85[_0x06f1('0x14')],_0x5f3305);_0x388de4(_0x120b68[_0x06f1('0x12')](0x1f4,_0x4e8d85[_0x06f1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2600054..4fb8442 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 _0x727c=['index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1ee5fe,_0x57e68b){var _0x2947f6=function(_0x403481){while(--_0x403481){_0x1ee5fe['push'](_0x1ee5fe['shift']());}};_0x2947f6(++_0x57e68b);}(_0x727c,0x182));var _0xc727=function(_0x34a14d,_0xc49d24){_0x34a14d=_0x34a14d-0x0;var _0x2015f2=_0x727c[_0x34a14d];return _0x2015f2;};'use strict';var multer=require(_0xc727('0x0'));var util=require(_0xc727('0x1'));var path=require(_0xc727('0x2'));var timeout=require(_0xc727('0x3'));var express=require('express');var router=express[_0xc727('0x4')]();var auth=require(_0xc727('0x5'));var interaction=require(_0xc727('0x6'));var config=require(_0xc727('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xc727('0x8')]('/',auth[_0xc727('0x9')](),controller[_0xc727('0xa')]);router['get'](_0xc727('0xb'),auth[_0xc727('0x9')](),controller['show']);router[_0xc727('0x8')](_0xc727('0xc'),auth[_0xc727('0x9')](),controller[_0xc727('0xd')]);router[_0xc727('0x8')](_0xc727('0xe'),auth[_0xc727('0x9')](),controller[_0xc727('0xf')]);router['get'](_0xc727('0x10'),auth[_0xc727('0x9')](),controller[_0xc727('0x11')]);router[_0xc727('0x12')]('/',auth[_0xc727('0x9')](),controller['create']);router[_0xc727('0x13')](_0xc727('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xc727('0x9')](),controller[_0xc727('0x14')]);module[_0xc727('0x15')]=router; \ No newline at end of file +var _0xd818=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy'];(function(_0x58d88d,_0xa62a0e){var _0xa525b1=function(_0x3ca12b){while(--_0x3ca12b){_0x58d88d['push'](_0x58d88d['shift']());}};_0xa525b1(++_0xa62a0e);}(_0xd818,0xf1));var _0x8d81=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0xd818[_0x529abc];return _0x453afa;};'use strict';var multer=require(_0x8d81('0x0'));var util=require(_0x8d81('0x1'));var path=require(_0x8d81('0x2'));var timeout=require(_0x8d81('0x3'));var express=require('express');var router=express[_0x8d81('0x4')]();var auth=require(_0x8d81('0x5'));var interaction=require(_0x8d81('0x6'));var config=require(_0x8d81('0x7'));var controller=require(_0x8d81('0x8'));router[_0x8d81('0x9')]('/',auth['isAuthenticated'](),controller[_0x8d81('0xa')]);router['get'](_0x8d81('0xb'),auth['isAuthenticated'](),controller[_0x8d81('0xc')]);router[_0x8d81('0x9')](_0x8d81('0xd'),auth[_0x8d81('0xe')](),controller['getFields']);router['get'](_0x8d81('0xf'),auth[_0x8d81('0xe')](),controller[_0x8d81('0x10')]);router[_0x8d81('0x9')](_0x8d81('0x11'),auth[_0x8d81('0xe')](),controller[_0x8d81('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8d81('0x13')]);router[_0x8d81('0x14')](_0x8d81('0xb'),auth[_0x8d81('0xe')](),controller['update']);router[_0x8d81('0x15')](_0x8d81('0xb'),auth[_0x8d81('0xe')](),controller[_0x8d81('0x16')]);module[_0x8d81('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 645611f..8d1e463 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 _0xb50c=['exports','STRING','sequelize'];(function(_0x563b1e,_0x2b73dd){var _0x20642c=function(_0x19e521){while(--_0x19e521){_0x563b1e['push'](_0x563b1e['shift']());}};_0x20642c(++_0x2b73dd);}(_0xb50c,0x14c));var _0xcb50=function(_0x3c7bbd,_0x487548){_0x3c7bbd=_0x3c7bbd-0x0;var _0xed4182=_0xb50c[_0x3c7bbd];return _0xed4182;};'use strict';var Sequelize=require(_0xcb50('0x0'));module[_0xcb50('0x1')]={'name':{'type':Sequelize[_0xcb50('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x12a8=['exports','STRING','sequelize'];(function(_0x360516,_0x4417e9){var _0x39df49=function(_0x3d5bcb){while(--_0x3d5bcb){_0x360516['push'](_0x360516['shift']());}};_0x39df49(++_0x4417e9);}(_0x12a8,0x128));var _0x812a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x12a8[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x812a('0x0'));module[_0x812a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x812a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 7c0c4f8..e99ebda 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 _0x8ac0=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','map','SugarcrmConfiguration','rawAttributes','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getFields','findOne','SugarcrmField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x3e8643,_0x18d174){var _0x18198f=function(_0x3677ad){while(--_0x3677ad){_0x3e8643['push'](_0x3e8643['shift']());}};_0x18198f(++_0x18d174);}(_0x8ac0,0xfe));var _0x08ac=function(_0x454207,_0xe465c3){_0x454207=_0x454207-0x0;var _0x10e6b0=_0x8ac0[_0x454207];return _0x10e6b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x08ac('0x0'));var rimraf=require(_0x08ac('0x1'));var zipdir=require(_0x08ac('0x2'));var jsonpatch=require(_0x08ac('0x3'));var rp=require(_0x08ac('0x4'));var moment=require(_0x08ac('0x5'));var BPromise=require(_0x08ac('0x6'));var Mustache=require(_0x08ac('0x7'));var util=require(_0x08ac('0x8'));var path=require('path');var sox=require(_0x08ac('0x9'));var csv=require('to-csv');var ejs=require(_0x08ac('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x08ac('0xb'));var crypto=require('crypto');var jsforce=require(_0x08ac('0xc'));var deskjs=require(_0x08ac('0xd'));var toCsv=require(_0x08ac('0xe'));var querystring=require(_0x08ac('0xf'));var Papa=require(_0x08ac('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x08ac('0x11'));var as=require(_0x08ac('0x12'));var hardwareService=require(_0x08ac('0x13'));var logger=require('../../config/logger')(_0x08ac('0x14'));var utils=require('../../config/utils');var config=require(_0x08ac('0x15'));var licenseUtil=require(_0x08ac('0x16'));var db=require(_0x08ac('0x17'))['db'];var jayson=require(_0x08ac('0x18'));var client=jayson['client'][_0x08ac('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x37fbab,_0x4f8de0,_0x380532,_0x420c54){return new BPromise(function(_0x256ff0,_0x43e74f){var _0x53f958=_0x420c54||client;return _0x53f958[_0x08ac('0x1a')](_0x37fbab,_0x380532)['then'](function(_0x996c81){logger[_0x08ac('0x1b')](_0x08ac('0x1c'),_0x4f8de0,_0x08ac('0x1d'));logger[_0x08ac('0x1e')](_0x08ac('0x1f'),_0x4f8de0,_0x08ac('0x1d'),JSON['stringify'](_0x996c81));if(_0x996c81[_0x08ac('0x20')]){if(_0x996c81[_0x08ac('0x20')][_0x08ac('0x21')]===0x1f4){logger[_0x08ac('0x20')](_0x08ac('0x1c'),_0x4f8de0,_0x996c81['error']['message']);return _0x43e74f(_0x996c81[_0x08ac('0x20')][_0x08ac('0x22')]);}logger[_0x08ac('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4f8de0,_0x996c81[_0x08ac('0x20')][_0x08ac('0x22')]);return _0x256ff0(_0x996c81['error'][_0x08ac('0x22')]);}else{logger[_0x08ac('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4f8de0,'request\x20sent');_0x256ff0(_0x996c81[_0x08ac('0x23')][_0x08ac('0x22')]);}})[_0x08ac('0x24')](function(_0x51c60f){logger[_0x08ac('0x20')](_0x08ac('0x1c'),_0x4f8de0,_0x51c60f);_0x43e74f(_0x51c60f);});});}function respondWithStatusCode(_0x2cd274,_0x1bb590){_0x1bb590=_0x1bb590||0xcc;return function(_0x29e1bf){if(_0x29e1bf){return _0x2cd274[_0x08ac('0x25')](_0x1bb590);}return _0x2cd274[_0x08ac('0x26')](_0x1bb590)[_0x08ac('0x27')]();};}function respondWithResult(_0xd99234,_0x2a52d9){_0x2a52d9=_0x2a52d9||0xc8;return function(_0x71cc6d){if(_0x71cc6d){return _0xd99234['status'](_0x2a52d9)[_0x08ac('0x28')](_0x71cc6d);}};}function respondWithFilteredResult(_0x395d49,_0x5b82c6){return function(_0x287faa){if(_0x287faa){var _0x297902=_0x287faa[_0x08ac('0x29')],_0x5c7444=_0x5b82c6['offset'],_0x150ab2=_0x5b82c6[_0x08ac('0x2a')]+_0x5b82c6[_0x08ac('0x2b')],_0x77c937;if(_0x150ab2>=_0x297902){_0x150ab2=_0x297902;_0x77c937=0xc8;}else{_0x77c937=0xce;}_0x395d49[_0x08ac('0x26')](_0x77c937);return _0x395d49[_0x08ac('0x2c')](_0x08ac('0x2d'),_0x5c7444+'-'+_0x150ab2+'/'+_0x297902)[_0x08ac('0x28')](_0x287faa);}return null;};}function patchUpdates(_0x58af97){return function(_0x11680b){try{jsonpatch[_0x08ac('0x2e')](_0x11680b,_0x58af97,!![]);}catch(_0x550f8c){return BPromise[_0x08ac('0x2f')](_0x550f8c);}return _0x11680b[_0x08ac('0x30')]();};}function saveUpdates(_0x3aa227,_0x3890c7){return function(_0x1b739a){if(_0x1b739a){return _0x1b739a['update'](_0x3aa227)['then'](function(_0x5b6420){return _0x5b6420;});}return null;};}function removeEntity(_0x1f6eba,_0x185a1f){return function(_0x23985e){if(_0x23985e){return _0x23985e[_0x08ac('0x31')]()[_0x08ac('0x32')](function(){_0x1f6eba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x284925,_0x2d42e8){return function(_0x3c1124){if(!_0x3c1124){_0x284925[_0x08ac('0x25')](0x194);}return _0x3c1124;};}function handleError(_0x3cd7b5,_0x49d29f){_0x49d29f=_0x49d29f||0x1f4;return function(_0x35553d){logger['error'](_0x35553d[_0x08ac('0x33')]);if(_0x35553d['name']){delete _0x35553d[_0x08ac('0x34')];}_0x3cd7b5[_0x08ac('0x26')](_0x49d29f)['send'](_0x35553d);};}exports['index']=function(_0x24d268,_0x1d0630){var _0x57957e={},_0xb898c={},_0x40d846={'count':0x0,'rows':[]};var _0x38c5fc=_[_0x08ac('0x35')](db[_0x08ac('0x36')][_0x08ac('0x37')],function(_0x46cd41){return{'name':_0x46cd41['fieldName'],'type':_0x46cd41[_0x08ac('0x38')][_0x08ac('0x39')]};});_0xb898c['model']=_[_0x08ac('0x35')](_0x38c5fc,_0x08ac('0x34'));_0xb898c[_0x08ac('0x3a')]=_['keys'](_0x24d268['query']);_0xb898c['filters']=_[_0x08ac('0x3b')](_0xb898c[_0x08ac('0x3c')],_0xb898c[_0x08ac('0x3a')]);_0x57957e[_0x08ac('0x3d')]=_[_0x08ac('0x3b')](_0xb898c[_0x08ac('0x3c')],qs[_0x08ac('0x3e')](_0x24d268[_0x08ac('0x3a')][_0x08ac('0x3e')]));_0x57957e[_0x08ac('0x3d')]=_0x57957e['attributes'][_0x08ac('0x3f')]?_0x57957e[_0x08ac('0x3d')]:_0xb898c[_0x08ac('0x3c')];if(!_0x24d268[_0x08ac('0x3a')]['hasOwnProperty'](_0x08ac('0x40'))){_0x57957e['limit']=qs['limit'](_0x24d268[_0x08ac('0x3a')]['limit']);_0x57957e[_0x08ac('0x2a')]=qs['offset'](_0x24d268[_0x08ac('0x3a')][_0x08ac('0x2a')]);}_0x57957e[_0x08ac('0x41')]=qs['sort'](_0x24d268[_0x08ac('0x3a')][_0x08ac('0x42')]);_0x57957e['where']=qs[_0x08ac('0x43')](_['pick'](_0x24d268[_0x08ac('0x3a')],_0xb898c[_0x08ac('0x43')]),_0x38c5fc);if(_0x24d268[_0x08ac('0x3a')][_0x08ac('0x44')]){_0x57957e[_0x08ac('0x45')]=_[_0x08ac('0x46')](_0x57957e[_0x08ac('0x45')],{'$or':_[_0x08ac('0x35')](_0x38c5fc,function(_0x3f29cb){if(_0x3f29cb[_0x08ac('0x38')]!==_0x08ac('0x47')){var _0x5e7483={};_0x5e7483[_0x3f29cb[_0x08ac('0x34')]]={'$like':'%'+_0x24d268[_0x08ac('0x3a')][_0x08ac('0x44')]+'%'};return _0x5e7483;}})});}_0x57957e=_[_0x08ac('0x46')]({},_0x57957e,_0x24d268[_0x08ac('0x48')]);var _0x50588f={'where':_0x57957e[_0x08ac('0x45')]};return db['SugarcrmConfiguration']['count'](_0x50588f)[_0x08ac('0x32')](function(_0x2cf23c){_0x40d846['count']=_0x2cf23c;if(_0x24d268[_0x08ac('0x3a')][_0x08ac('0x49')]){_0x57957e[_0x08ac('0x4a')]=[{'all':!![]}];}return db[_0x08ac('0x36')][_0x08ac('0x4b')](_0x57957e);})['then'](function(_0x1f0bad){_0x40d846[_0x08ac('0x4c')]=_0x1f0bad;return _0x40d846;})[_0x08ac('0x32')](respondWithFilteredResult(_0x1d0630,_0x57957e))[_0x08ac('0x24')](handleError(_0x1d0630,null));};exports[_0x08ac('0x4d')]=function(_0x28e9ad,_0x189f11){var _0x437fba={'raw':![],'where':{'id':_0x28e9ad[_0x08ac('0x4e')]['id']}},_0x5ea634={};_0x5ea634[_0x08ac('0x3c')]=_[_0x08ac('0x4f')](db[_0x08ac('0x36')][_0x08ac('0x37')]);_0x5ea634['query']=_['keys'](_0x28e9ad[_0x08ac('0x3a')]);_0x5ea634[_0x08ac('0x43')]=_[_0x08ac('0x3b')](_0x5ea634['model'],_0x5ea634[_0x08ac('0x3a')]);_0x437fba[_0x08ac('0x3d')]=_['intersection'](_0x5ea634[_0x08ac('0x3c')],qs[_0x08ac('0x3e')](_0x28e9ad[_0x08ac('0x3a')][_0x08ac('0x3e')]));_0x437fba['attributes']=_0x437fba[_0x08ac('0x3d')][_0x08ac('0x3f')]?_0x437fba[_0x08ac('0x3d')]:_0x5ea634[_0x08ac('0x3c')];if(_0x28e9ad[_0x08ac('0x3a')][_0x08ac('0x49')]){_0x437fba['include']=[{'all':!![]}];}_0x437fba=_['merge']({},_0x437fba,_0x28e9ad[_0x08ac('0x48')]);return db[_0x08ac('0x36')][_0x08ac('0x50')](_0x437fba)[_0x08ac('0x32')](handleEntityNotFound(_0x189f11,null))[_0x08ac('0x32')](respondWithResult(_0x189f11,null))[_0x08ac('0x24')](handleError(_0x189f11,null));};exports[_0x08ac('0x51')]=function(_0x4d8f41,_0xb0a9b5){return db['SugarcrmConfiguration'][_0x08ac('0x51')](_0x4d8f41[_0x08ac('0x52')],{})[_0x08ac('0x32')](respondWithResult(_0xb0a9b5,0xc9))[_0x08ac('0x24')](handleError(_0xb0a9b5,null));};exports['update']=function(_0x4a93c6,_0x3a7a2f){if(_0x4a93c6[_0x08ac('0x52')]['id']){delete _0x4a93c6[_0x08ac('0x52')]['id'];}return db['SugarcrmConfiguration'][_0x08ac('0x50')]({'where':{'id':_0x4a93c6[_0x08ac('0x4e')]['id']}})[_0x08ac('0x32')](handleEntityNotFound(_0x3a7a2f,null))[_0x08ac('0x32')](saveUpdates(_0x4a93c6[_0x08ac('0x52')],null))[_0x08ac('0x32')](respondWithResult(_0x3a7a2f,null))[_0x08ac('0x24')](handleError(_0x3a7a2f,null));};exports['destroy']=function(_0x43f194,_0x24766a){return db[_0x08ac('0x36')]['find']({'where':{'id':_0x43f194[_0x08ac('0x4e')]['id']}})[_0x08ac('0x32')](handleEntityNotFound(_0x24766a,null))[_0x08ac('0x32')](removeEntity(_0x24766a,null))['catch'](handleError(_0x24766a,null));};exports[_0x08ac('0x53')]=function(_0x1b6328,_0x5ca564,_0x4b4279){var _0x5e3958={};var _0x45979a={};var _0x58352e;var _0x7d703;return db['SugarcrmConfiguration'][_0x08ac('0x54')]({'where':{'id':_0x1b6328['params']['id']}})['then'](handleEntityNotFound(_0x5ca564,null))[_0x08ac('0x32')](function(_0xc51a90){if(_0xc51a90){_0x58352e=_0xc51a90;_0x45979a['model']=_[_0x08ac('0x4f')](db[_0x08ac('0x55')]['rawAttributes']);_0x45979a['query']=_[_0x08ac('0x4f')](_0x1b6328[_0x08ac('0x3a')]);_0x45979a[_0x08ac('0x43')]=_[_0x08ac('0x3b')](_0x45979a[_0x08ac('0x3c')],_0x45979a['query']);_0x5e3958[_0x08ac('0x3d')]=_[_0x08ac('0x3b')](_0x45979a[_0x08ac('0x3c')],qs[_0x08ac('0x3e')](_0x1b6328['query'][_0x08ac('0x3e')]));_0x5e3958[_0x08ac('0x3d')]=_0x5e3958[_0x08ac('0x3d')][_0x08ac('0x3f')]?_0x5e3958[_0x08ac('0x3d')]:_0x45979a['model'];_0x5e3958[_0x08ac('0x41')]=qs[_0x08ac('0x42')](_0x1b6328[_0x08ac('0x3a')][_0x08ac('0x42')]);_0x5e3958['where']=qs[_0x08ac('0x43')](_[_0x08ac('0x56')](_0x1b6328[_0x08ac('0x3a')],_0x45979a[_0x08ac('0x43')]));if(_0x1b6328[_0x08ac('0x3a')][_0x08ac('0x44')]){_0x5e3958['where']=_[_0x08ac('0x46')](_0x5e3958[_0x08ac('0x45')],{'$or':_[_0x08ac('0x35')](_0x5e3958[_0x08ac('0x3d')],function(_0x3494fc){var _0x20af9e={};_0x20af9e[_0x3494fc]={'$like':'%'+_0x1b6328[_0x08ac('0x3a')]['filter']+'%'};return _0x20af9e;})});}_0x5e3958=_['merge']({},_0x5e3958,_0x1b6328[_0x08ac('0x48')]);return _0x58352e[_0x08ac('0x53')](_0x5e3958);}})[_0x08ac('0x32')](function(_0x1e0672){if(_0x1e0672){_0x7d703=_0x1e0672[_0x08ac('0x3f')];if(!_0x1b6328['query'][_0x08ac('0x57')](_0x08ac('0x40'))){_0x5e3958['limit']=qs[_0x08ac('0x2b')](_0x1b6328[_0x08ac('0x3a')]['limit']);_0x5e3958[_0x08ac('0x2a')]=qs[_0x08ac('0x2a')](_0x1b6328['query']['offset']);}return _0x58352e['getFields'](_0x5e3958);}})[_0x08ac('0x32')](function(_0xd74d3f){if(_0xd74d3f){return _0xd74d3f?{'count':_0x7d703,'rows':_0xd74d3f}:null;}})['then'](respondWithResult(_0x5ca564,null))[_0x08ac('0x24')](handleError(_0x5ca564,null));};exports[_0x08ac('0x58')]=function(_0x22e856,_0x5b48e4,_0x1a6665){var _0x550fd9={};var _0x5e35d7={};var _0x12a60d;var _0x55694d;return db['SugarcrmConfiguration'][_0x08ac('0x54')]({'where':{'id':_0x22e856[_0x08ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b48e4,null))[_0x08ac('0x32')](function(_0x4a0d1e){if(_0x4a0d1e){_0x12a60d=_0x4a0d1e;_0x5e35d7[_0x08ac('0x3c')]=_[_0x08ac('0x4f')](db[_0x08ac('0x55')]['rawAttributes']);_0x5e35d7[_0x08ac('0x3a')]=_[_0x08ac('0x4f')](_0x22e856['query']);_0x5e35d7[_0x08ac('0x43')]=_[_0x08ac('0x3b')](_0x5e35d7[_0x08ac('0x3c')],_0x5e35d7[_0x08ac('0x3a')]);_0x550fd9[_0x08ac('0x3d')]=_[_0x08ac('0x3b')](_0x5e35d7['model'],qs[_0x08ac('0x3e')](_0x22e856[_0x08ac('0x3a')][_0x08ac('0x3e')]));_0x550fd9[_0x08ac('0x3d')]=_0x550fd9[_0x08ac('0x3d')][_0x08ac('0x3f')]?_0x550fd9[_0x08ac('0x3d')]:_0x5e35d7[_0x08ac('0x3c')];_0x550fd9[_0x08ac('0x41')]=qs[_0x08ac('0x42')](_0x22e856[_0x08ac('0x3a')]['sort']);_0x550fd9[_0x08ac('0x45')]=qs[_0x08ac('0x43')](_[_0x08ac('0x56')](_0x22e856[_0x08ac('0x3a')],_0x5e35d7['filters']));if(_0x22e856[_0x08ac('0x3a')][_0x08ac('0x44')]){_0x550fd9[_0x08ac('0x45')]=_[_0x08ac('0x46')](_0x550fd9['where'],{'$or':_[_0x08ac('0x35')](_0x550fd9[_0x08ac('0x3d')],function(_0x174299){var _0x175436={};_0x175436[_0x174299]={'$like':'%'+_0x22e856[_0x08ac('0x3a')]['filter']+'%'};return _0x175436;})});}_0x550fd9=_['merge']({},_0x550fd9,_0x22e856[_0x08ac('0x48')]);return _0x12a60d['getSubjects'](_0x550fd9);}})[_0x08ac('0x32')](function(_0x310518){if(_0x310518){_0x55694d=_0x310518['length'];if(!_0x22e856[_0x08ac('0x3a')]['hasOwnProperty']('nolimit')){_0x550fd9[_0x08ac('0x2b')]=qs[_0x08ac('0x2b')](_0x22e856[_0x08ac('0x3a')][_0x08ac('0x2b')]);_0x550fd9['offset']=qs[_0x08ac('0x2a')](_0x22e856[_0x08ac('0x3a')][_0x08ac('0x2a')]);}return _0x12a60d[_0x08ac('0x58')](_0x550fd9);}})['then'](function(_0x125202){if(_0x125202){return _0x125202?{'count':_0x55694d,'rows':_0x125202}:null;}})['then'](respondWithResult(_0x5b48e4,null))[_0x08ac('0x24')](handleError(_0x5b48e4,null));};exports[_0x08ac('0x59')]=function(_0x4049cf,_0x20b339,_0x363577){var _0x512e56={};var _0x53a733={};var _0x2d9507;var _0x368af2;return db[_0x08ac('0x36')][_0x08ac('0x54')]({'where':{'id':_0x4049cf[_0x08ac('0x4e')]['id']}})[_0x08ac('0x32')](handleEntityNotFound(_0x20b339,null))[_0x08ac('0x32')](function(_0x2e87bf){if(_0x2e87bf){_0x2d9507=_0x2e87bf;_0x53a733[_0x08ac('0x3c')]=_[_0x08ac('0x4f')](db[_0x08ac('0x55')][_0x08ac('0x37')]);_0x53a733[_0x08ac('0x3a')]=_[_0x08ac('0x4f')](_0x4049cf[_0x08ac('0x3a')]);_0x53a733[_0x08ac('0x43')]=_[_0x08ac('0x3b')](_0x53a733['model'],_0x53a733[_0x08ac('0x3a')]);_0x512e56[_0x08ac('0x3d')]=_['intersection'](_0x53a733[_0x08ac('0x3c')],qs['fields'](_0x4049cf[_0x08ac('0x3a')]['fields']));_0x512e56[_0x08ac('0x3d')]=_0x512e56[_0x08ac('0x3d')][_0x08ac('0x3f')]?_0x512e56[_0x08ac('0x3d')]:_0x53a733[_0x08ac('0x3c')];_0x512e56[_0x08ac('0x41')]=qs[_0x08ac('0x42')](_0x4049cf[_0x08ac('0x3a')]['sort']);_0x512e56[_0x08ac('0x45')]=qs['filters'](_['pick'](_0x4049cf[_0x08ac('0x3a')],_0x53a733[_0x08ac('0x43')]));if(_0x4049cf[_0x08ac('0x3a')][_0x08ac('0x44')]){_0x512e56[_0x08ac('0x45')]=_[_0x08ac('0x46')](_0x512e56[_0x08ac('0x45')],{'$or':_['map'](_0x512e56['attributes'],function(_0xafe9c9){var _0x1bba82={};_0x1bba82[_0xafe9c9]={'$like':'%'+_0x4049cf['query'][_0x08ac('0x44')]+'%'};return _0x1bba82;})});}_0x512e56=_[_0x08ac('0x46')]({},_0x512e56,_0x4049cf[_0x08ac('0x48')]);return _0x2d9507[_0x08ac('0x59')](_0x512e56);}})['then'](function(_0x42a7ee){if(_0x42a7ee){_0x368af2=_0x42a7ee[_0x08ac('0x3f')];if(!_0x4049cf[_0x08ac('0x3a')][_0x08ac('0x57')]('nolimit')){_0x512e56[_0x08ac('0x2b')]=qs[_0x08ac('0x2b')](_0x4049cf[_0x08ac('0x3a')][_0x08ac('0x2b')]);_0x512e56[_0x08ac('0x2a')]=qs['offset'](_0x4049cf[_0x08ac('0x3a')][_0x08ac('0x2a')]);}return _0x2d9507[_0x08ac('0x59')](_0x512e56);}})[_0x08ac('0x32')](function(_0x176368){if(_0x176368){return _0x176368?{'count':_0x368af2,'rows':_0x176368}:null;}})[_0x08ac('0x32')](respondWithResult(_0x20b339,null))[_0x08ac('0x24')](handleError(_0x20b339,null));}; \ No newline at end of file +var _0xa8c1=['sort','filter','where','merge','includeAll','include','findAll','rows','show','params','find','create','update','body','findOne','SugarcrmField','pick','options','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','request','then','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','destroy','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xa8c1,0x172));var _0x1a8c=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0xa8c1[_0x1c470d];return _0x12141b;};'use strict';var pdf=require(_0x1a8c('0x0'));var emlformat=require(_0x1a8c('0x1'));var rimraf=require(_0x1a8c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a8c('0x3'));var rp=require(_0x1a8c('0x4'));var moment=require(_0x1a8c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1a8c('0x6'));var util=require(_0x1a8c('0x7'));var path=require(_0x1a8c('0x8'));var sox=require(_0x1a8c('0x9'));var csv=require(_0x1a8c('0xa'));var ejs=require(_0x1a8c('0xb'));var fs=require('fs');var _=require(_0x1a8c('0xc'));var squel=require(_0x1a8c('0xd'));var crypto=require(_0x1a8c('0xe'));var jsforce=require(_0x1a8c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a8c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1a8c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1a8c('0x12'));var hardwareService=require(_0x1a8c('0x13'));var logger=require('../../config/logger')(_0x1a8c('0x14'));var utils=require(_0x1a8c('0x15'));var config=require(_0x1a8c('0x16'));var licenseUtil=require(_0x1a8c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1a8c('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a412a,_0x335eb6,_0x1bb0bf,_0x44e0d2){return new BPromise(function(_0x28fc55,_0x267f5e){var _0x38a7a5=_0x44e0d2||client;return _0x38a7a5[_0x1a8c('0x19')](_0x2a412a,_0x1bb0bf)[_0x1a8c('0x1a')](function(_0x550443){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x335eb6,_0x1a8c('0x1b'));logger['debug'](_0x1a8c('0x1c'),_0x335eb6,_0x1a8c('0x1b'),JSON[_0x1a8c('0x1d')](_0x550443));if(_0x550443['error']){if(_0x550443[_0x1a8c('0x1e')]['code']===0x1f4){logger[_0x1a8c('0x1e')](_0x1a8c('0x1f'),_0x335eb6,_0x550443['error'][_0x1a8c('0x20')]);return _0x267f5e(_0x550443[_0x1a8c('0x1e')][_0x1a8c('0x20')]);}logger[_0x1a8c('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x335eb6,_0x550443['error'][_0x1a8c('0x20')]);return _0x28fc55(_0x550443['error'][_0x1a8c('0x20')]);}else{logger[_0x1a8c('0x21')](_0x1a8c('0x1f'),_0x335eb6,_0x1a8c('0x1b'));_0x28fc55(_0x550443[_0x1a8c('0x22')][_0x1a8c('0x20')]);}})[_0x1a8c('0x23')](function(_0x20df98){logger[_0x1a8c('0x1e')](_0x1a8c('0x1f'),_0x335eb6,_0x20df98);_0x267f5e(_0x20df98);});});}function respondWithStatusCode(_0x17411f,_0x170d95){_0x170d95=_0x170d95||0xcc;return function(_0x31532c){if(_0x31532c){return _0x17411f[_0x1a8c('0x24')](_0x170d95);}return _0x17411f[_0x1a8c('0x25')](_0x170d95)[_0x1a8c('0x26')]();};}function respondWithResult(_0x15ef1b,_0x383938){_0x383938=_0x383938||0xc8;return function(_0x355480){if(_0x355480){return _0x15ef1b[_0x1a8c('0x25')](_0x383938)[_0x1a8c('0x27')](_0x355480);}};}function respondWithFilteredResult(_0x42c890,_0x2844e2){return function(_0x5ede29){if(_0x5ede29){var _0x3d896c=_0x5ede29[_0x1a8c('0x28')],_0x25ed90=_0x2844e2[_0x1a8c('0x29')],_0x7a2f1e=_0x2844e2[_0x1a8c('0x29')]+_0x2844e2[_0x1a8c('0x2a')],_0x127808;if(_0x7a2f1e>=_0x3d896c){_0x7a2f1e=_0x3d896c;_0x127808=0xc8;}else{_0x127808=0xce;}_0x42c890[_0x1a8c('0x25')](_0x127808);return _0x42c890[_0x1a8c('0x2b')]('Content-Range',_0x25ed90+'-'+_0x7a2f1e+'/'+_0x3d896c)[_0x1a8c('0x27')](_0x5ede29);}return null;};}function patchUpdates(_0x175790){return function(_0x563f99){try{jsonpatch[_0x1a8c('0x2c')](_0x563f99,_0x175790,!![]);}catch(_0x434cec){return BPromise['reject'](_0x434cec);}return _0x563f99[_0x1a8c('0x2d')]();};}function saveUpdates(_0x2862a1,_0x415242){return function(_0x2a16dc){if(_0x2a16dc){return _0x2a16dc['update'](_0x2862a1)[_0x1a8c('0x1a')](function(_0x16e770){return _0x16e770;});}return null;};}function removeEntity(_0x149190,_0x1cd6c2){return function(_0x5868c2){if(_0x5868c2){return _0x5868c2[_0x1a8c('0x2e')]()[_0x1a8c('0x1a')](function(){_0x149190[_0x1a8c('0x25')](0xcc)[_0x1a8c('0x26')]();});}};}function handleEntityNotFound(_0x15ad47,_0xf10f58){return function(_0x219af6){if(!_0x219af6){_0x15ad47[_0x1a8c('0x24')](0x194);}return _0x219af6;};}function handleError(_0x28f9e2,_0x4ca06f){_0x4ca06f=_0x4ca06f||0x1f4;return function(_0x177637){logger[_0x1a8c('0x1e')](_0x177637['stack']);if(_0x177637[_0x1a8c('0x2f')]){delete _0x177637[_0x1a8c('0x2f')];}_0x28f9e2['status'](_0x4ca06f)[_0x1a8c('0x30')](_0x177637);};}exports[_0x1a8c('0x31')]=function(_0x48c8eb,_0x407216){var _0x3a444a={},_0x4a556c={},_0x3b1ec1={'count':0x0,'rows':[]};var _0x86e397=_[_0x1a8c('0x32')](db[_0x1a8c('0x33')][_0x1a8c('0x34')],function(_0x391694){return{'name':_0x391694[_0x1a8c('0x35')],'type':_0x391694[_0x1a8c('0x36')]['key']};});_0x4a556c['model']=_[_0x1a8c('0x32')](_0x86e397,'name');_0x4a556c[_0x1a8c('0x37')]=_[_0x1a8c('0x38')](_0x48c8eb[_0x1a8c('0x37')]);_0x4a556c[_0x1a8c('0x39')]=_[_0x1a8c('0x3a')](_0x4a556c[_0x1a8c('0x3b')],_0x4a556c[_0x1a8c('0x37')]);_0x3a444a[_0x1a8c('0x3c')]=_[_0x1a8c('0x3a')](_0x4a556c[_0x1a8c('0x3b')],qs[_0x1a8c('0x3d')](_0x48c8eb[_0x1a8c('0x37')][_0x1a8c('0x3d')]));_0x3a444a[_0x1a8c('0x3c')]=_0x3a444a[_0x1a8c('0x3c')][_0x1a8c('0x3e')]?_0x3a444a[_0x1a8c('0x3c')]:_0x4a556c[_0x1a8c('0x3b')];if(!_0x48c8eb[_0x1a8c('0x37')][_0x1a8c('0x3f')]('nolimit')){_0x3a444a['limit']=qs[_0x1a8c('0x2a')](_0x48c8eb[_0x1a8c('0x37')][_0x1a8c('0x2a')]);_0x3a444a[_0x1a8c('0x29')]=qs[_0x1a8c('0x29')](_0x48c8eb[_0x1a8c('0x37')][_0x1a8c('0x29')]);}_0x3a444a[_0x1a8c('0x40')]=qs[_0x1a8c('0x41')](_0x48c8eb['query'][_0x1a8c('0x41')]);_0x3a444a['where']=qs[_0x1a8c('0x39')](_['pick'](_0x48c8eb[_0x1a8c('0x37')],_0x4a556c[_0x1a8c('0x39')]),_0x86e397);if(_0x48c8eb[_0x1a8c('0x37')][_0x1a8c('0x42')]){_0x3a444a[_0x1a8c('0x43')]=_[_0x1a8c('0x44')](_0x3a444a[_0x1a8c('0x43')],{'$or':_[_0x1a8c('0x32')](_0x86e397,function(_0x39e11d){if(_0x39e11d[_0x1a8c('0x36')]!=='VIRTUAL'){var _0x2cda03={};_0x2cda03[_0x39e11d[_0x1a8c('0x2f')]]={'$like':'%'+_0x48c8eb[_0x1a8c('0x37')][_0x1a8c('0x42')]+'%'};return _0x2cda03;}})});}_0x3a444a=_[_0x1a8c('0x44')]({},_0x3a444a,_0x48c8eb['options']);var _0x117305={'where':_0x3a444a[_0x1a8c('0x43')]};return db[_0x1a8c('0x33')][_0x1a8c('0x28')](_0x117305)[_0x1a8c('0x1a')](function(_0x3ba2ca){_0x3b1ec1[_0x1a8c('0x28')]=_0x3ba2ca;if(_0x48c8eb[_0x1a8c('0x37')][_0x1a8c('0x45')]){_0x3a444a[_0x1a8c('0x46')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x1a8c('0x47')](_0x3a444a);})[_0x1a8c('0x1a')](function(_0x2b8ab4){_0x3b1ec1[_0x1a8c('0x48')]=_0x2b8ab4;return _0x3b1ec1;})[_0x1a8c('0x1a')](respondWithFilteredResult(_0x407216,_0x3a444a))[_0x1a8c('0x23')](handleError(_0x407216,null));};exports[_0x1a8c('0x49')]=function(_0x2b3cf4,_0x3e18e9){var _0x460730={'raw':![],'where':{'id':_0x2b3cf4[_0x1a8c('0x4a')]['id']}},_0x218719={};_0x218719['model']=_[_0x1a8c('0x38')](db[_0x1a8c('0x33')][_0x1a8c('0x34')]);_0x218719[_0x1a8c('0x37')]=_[_0x1a8c('0x38')](_0x2b3cf4['query']);_0x218719['filters']=_[_0x1a8c('0x3a')](_0x218719[_0x1a8c('0x3b')],_0x218719[_0x1a8c('0x37')]);_0x460730[_0x1a8c('0x3c')]=_['intersection'](_0x218719[_0x1a8c('0x3b')],qs[_0x1a8c('0x3d')](_0x2b3cf4[_0x1a8c('0x37')][_0x1a8c('0x3d')]));_0x460730[_0x1a8c('0x3c')]=_0x460730[_0x1a8c('0x3c')][_0x1a8c('0x3e')]?_0x460730['attributes']:_0x218719['model'];if(_0x2b3cf4[_0x1a8c('0x37')]['includeAll']){_0x460730[_0x1a8c('0x46')]=[{'all':!![]}];}_0x460730=_[_0x1a8c('0x44')]({},_0x460730,_0x2b3cf4['options']);return db[_0x1a8c('0x33')][_0x1a8c('0x4b')](_0x460730)[_0x1a8c('0x1a')](handleEntityNotFound(_0x3e18e9,null))['then'](respondWithResult(_0x3e18e9,null))[_0x1a8c('0x23')](handleError(_0x3e18e9,null));};exports[_0x1a8c('0x4c')]=function(_0x3e8585,_0x2249fb){return db['SugarcrmConfiguration'][_0x1a8c('0x4c')](_0x3e8585['body'],{})['then'](respondWithResult(_0x2249fb,0xc9))[_0x1a8c('0x23')](handleError(_0x2249fb,null));};exports[_0x1a8c('0x4d')]=function(_0x45855f,_0x3e3518){if(_0x45855f[_0x1a8c('0x4e')]['id']){delete _0x45855f['body']['id'];}return db[_0x1a8c('0x33')][_0x1a8c('0x4b')]({'where':{'id':_0x45855f['params']['id']}})[_0x1a8c('0x1a')](handleEntityNotFound(_0x3e3518,null))[_0x1a8c('0x1a')](saveUpdates(_0x45855f[_0x1a8c('0x4e')],null))[_0x1a8c('0x1a')](respondWithResult(_0x3e3518,null))['catch'](handleError(_0x3e3518,null));};exports[_0x1a8c('0x2e')]=function(_0x247705,_0x6c2ba1){return db[_0x1a8c('0x33')][_0x1a8c('0x4b')]({'where':{'id':_0x247705[_0x1a8c('0x4a')]['id']}})[_0x1a8c('0x1a')](handleEntityNotFound(_0x6c2ba1,null))[_0x1a8c('0x1a')](removeEntity(_0x6c2ba1,null))[_0x1a8c('0x23')](handleError(_0x6c2ba1,null));};exports['getFields']=function(_0x2ffdae,_0x3476f0,_0x5f1f89){var _0x36a3b5={};var _0x30baa8={};var _0x2e950a;var _0x314f2a;return db[_0x1a8c('0x33')][_0x1a8c('0x4f')]({'where':{'id':_0x2ffdae[_0x1a8c('0x4a')]['id']}})[_0x1a8c('0x1a')](handleEntityNotFound(_0x3476f0,null))[_0x1a8c('0x1a')](function(_0x184ad9){if(_0x184ad9){_0x2e950a=_0x184ad9;_0x30baa8['model']=_[_0x1a8c('0x38')](db[_0x1a8c('0x50')]['rawAttributes']);_0x30baa8[_0x1a8c('0x37')]=_[_0x1a8c('0x38')](_0x2ffdae[_0x1a8c('0x37')]);_0x30baa8[_0x1a8c('0x39')]=_[_0x1a8c('0x3a')](_0x30baa8[_0x1a8c('0x3b')],_0x30baa8[_0x1a8c('0x37')]);_0x36a3b5[_0x1a8c('0x3c')]=_[_0x1a8c('0x3a')](_0x30baa8['model'],qs[_0x1a8c('0x3d')](_0x2ffdae[_0x1a8c('0x37')][_0x1a8c('0x3d')]));_0x36a3b5['attributes']=_0x36a3b5['attributes'][_0x1a8c('0x3e')]?_0x36a3b5[_0x1a8c('0x3c')]:_0x30baa8[_0x1a8c('0x3b')];_0x36a3b5[_0x1a8c('0x40')]=qs['sort'](_0x2ffdae[_0x1a8c('0x37')][_0x1a8c('0x41')]);_0x36a3b5[_0x1a8c('0x43')]=qs['filters'](_[_0x1a8c('0x51')](_0x2ffdae[_0x1a8c('0x37')],_0x30baa8[_0x1a8c('0x39')]));if(_0x2ffdae[_0x1a8c('0x37')][_0x1a8c('0x42')]){_0x36a3b5[_0x1a8c('0x43')]=_[_0x1a8c('0x44')](_0x36a3b5[_0x1a8c('0x43')],{'$or':_[_0x1a8c('0x32')](_0x36a3b5[_0x1a8c('0x3c')],function(_0x1186c5){var _0x45ba91={};_0x45ba91[_0x1186c5]={'$like':'%'+_0x2ffdae['query'][_0x1a8c('0x42')]+'%'};return _0x45ba91;})});}_0x36a3b5=_[_0x1a8c('0x44')]({},_0x36a3b5,_0x2ffdae[_0x1a8c('0x52')]);return _0x2e950a[_0x1a8c('0x53')](_0x36a3b5);}})[_0x1a8c('0x1a')](function(_0x9f9d8f){if(_0x9f9d8f){_0x314f2a=_0x9f9d8f[_0x1a8c('0x3e')];if(!_0x2ffdae[_0x1a8c('0x37')][_0x1a8c('0x3f')](_0x1a8c('0x54'))){_0x36a3b5[_0x1a8c('0x2a')]=qs[_0x1a8c('0x2a')](_0x2ffdae[_0x1a8c('0x37')][_0x1a8c('0x2a')]);_0x36a3b5['offset']=qs['offset'](_0x2ffdae['query']['offset']);}return _0x2e950a[_0x1a8c('0x53')](_0x36a3b5);}})[_0x1a8c('0x1a')](function(_0x5c69a4){if(_0x5c69a4){return _0x5c69a4?{'count':_0x314f2a,'rows':_0x5c69a4}:null;}})[_0x1a8c('0x1a')](respondWithResult(_0x3476f0,null))[_0x1a8c('0x23')](handleError(_0x3476f0,null));};exports['getSubjects']=function(_0x1df5d6,_0x4e9d47,_0x3dbf25){var _0x523bb1={};var _0x70b8d={};var _0x26ee68;var _0x375adf;return db[_0x1a8c('0x33')][_0x1a8c('0x4f')]({'where':{'id':_0x1df5d6[_0x1a8c('0x4a')]['id']}})[_0x1a8c('0x1a')](handleEntityNotFound(_0x4e9d47,null))[_0x1a8c('0x1a')](function(_0x29d086){if(_0x29d086){_0x26ee68=_0x29d086;_0x70b8d['model']=_[_0x1a8c('0x38')](db[_0x1a8c('0x50')][_0x1a8c('0x34')]);_0x70b8d[_0x1a8c('0x37')]=_['keys'](_0x1df5d6[_0x1a8c('0x37')]);_0x70b8d['filters']=_[_0x1a8c('0x3a')](_0x70b8d['model'],_0x70b8d[_0x1a8c('0x37')]);_0x523bb1['attributes']=_[_0x1a8c('0x3a')](_0x70b8d[_0x1a8c('0x3b')],qs[_0x1a8c('0x3d')](_0x1df5d6['query'][_0x1a8c('0x3d')]));_0x523bb1[_0x1a8c('0x3c')]=_0x523bb1[_0x1a8c('0x3c')][_0x1a8c('0x3e')]?_0x523bb1[_0x1a8c('0x3c')]:_0x70b8d['model'];_0x523bb1[_0x1a8c('0x40')]=qs[_0x1a8c('0x41')](_0x1df5d6[_0x1a8c('0x37')][_0x1a8c('0x41')]);_0x523bb1[_0x1a8c('0x43')]=qs[_0x1a8c('0x39')](_[_0x1a8c('0x51')](_0x1df5d6[_0x1a8c('0x37')],_0x70b8d[_0x1a8c('0x39')]));if(_0x1df5d6[_0x1a8c('0x37')]['filter']){_0x523bb1[_0x1a8c('0x43')]=_['merge'](_0x523bb1[_0x1a8c('0x43')],{'$or':_[_0x1a8c('0x32')](_0x523bb1[_0x1a8c('0x3c')],function(_0x106154){var _0x55dd00={};_0x55dd00[_0x106154]={'$like':'%'+_0x1df5d6[_0x1a8c('0x37')][_0x1a8c('0x42')]+'%'};return _0x55dd00;})});}_0x523bb1=_[_0x1a8c('0x44')]({},_0x523bb1,_0x1df5d6[_0x1a8c('0x52')]);return _0x26ee68[_0x1a8c('0x55')](_0x523bb1);}})['then'](function(_0x33fe10){if(_0x33fe10){_0x375adf=_0x33fe10[_0x1a8c('0x3e')];if(!_0x1df5d6[_0x1a8c('0x37')]['hasOwnProperty'](_0x1a8c('0x54'))){_0x523bb1[_0x1a8c('0x2a')]=qs['limit'](_0x1df5d6[_0x1a8c('0x37')][_0x1a8c('0x2a')]);_0x523bb1[_0x1a8c('0x29')]=qs[_0x1a8c('0x29')](_0x1df5d6[_0x1a8c('0x37')][_0x1a8c('0x29')]);}return _0x26ee68[_0x1a8c('0x55')](_0x523bb1);}})[_0x1a8c('0x1a')](function(_0x16f3f6){if(_0x16f3f6){return _0x16f3f6?{'count':_0x375adf,'rows':_0x16f3f6}:null;}})['then'](respondWithResult(_0x4e9d47,null))[_0x1a8c('0x23')](handleError(_0x4e9d47,null));};exports[_0x1a8c('0x56')]=function(_0x3b21d1,_0x3be863,_0x4ac24d){var _0x1c18d0={};var _0x430892={};var _0x34e24f;var _0x721408;return db[_0x1a8c('0x33')][_0x1a8c('0x4f')]({'where':{'id':_0x3b21d1[_0x1a8c('0x4a')]['id']}})[_0x1a8c('0x1a')](handleEntityNotFound(_0x3be863,null))['then'](function(_0x49f327){if(_0x49f327){_0x34e24f=_0x49f327;_0x430892[_0x1a8c('0x3b')]=_[_0x1a8c('0x38')](db[_0x1a8c('0x50')]['rawAttributes']);_0x430892[_0x1a8c('0x37')]=_[_0x1a8c('0x38')](_0x3b21d1[_0x1a8c('0x37')]);_0x430892[_0x1a8c('0x39')]=_[_0x1a8c('0x3a')](_0x430892[_0x1a8c('0x3b')],_0x430892['query']);_0x1c18d0[_0x1a8c('0x3c')]=_['intersection'](_0x430892[_0x1a8c('0x3b')],qs[_0x1a8c('0x3d')](_0x3b21d1[_0x1a8c('0x37')]['fields']));_0x1c18d0[_0x1a8c('0x3c')]=_0x1c18d0[_0x1a8c('0x3c')][_0x1a8c('0x3e')]?_0x1c18d0['attributes']:_0x430892[_0x1a8c('0x3b')];_0x1c18d0[_0x1a8c('0x40')]=qs[_0x1a8c('0x41')](_0x3b21d1[_0x1a8c('0x37')][_0x1a8c('0x41')]);_0x1c18d0[_0x1a8c('0x43')]=qs[_0x1a8c('0x39')](_['pick'](_0x3b21d1[_0x1a8c('0x37')],_0x430892['filters']));if(_0x3b21d1[_0x1a8c('0x37')][_0x1a8c('0x42')]){_0x1c18d0[_0x1a8c('0x43')]=_['merge'](_0x1c18d0[_0x1a8c('0x43')],{'$or':_[_0x1a8c('0x32')](_0x1c18d0[_0x1a8c('0x3c')],function(_0x556ea5){var _0x5b56d7={};_0x5b56d7[_0x556ea5]={'$like':'%'+_0x3b21d1[_0x1a8c('0x37')]['filter']+'%'};return _0x5b56d7;})});}_0x1c18d0=_[_0x1a8c('0x44')]({},_0x1c18d0,_0x3b21d1[_0x1a8c('0x52')]);return _0x34e24f['getDescriptions'](_0x1c18d0);}})[_0x1a8c('0x1a')](function(_0x46e452){if(_0x46e452){_0x721408=_0x46e452[_0x1a8c('0x3e')];if(!_0x3b21d1[_0x1a8c('0x37')][_0x1a8c('0x3f')](_0x1a8c('0x54'))){_0x1c18d0[_0x1a8c('0x2a')]=qs[_0x1a8c('0x2a')](_0x3b21d1[_0x1a8c('0x37')]['limit']);_0x1c18d0[_0x1a8c('0x29')]=qs['offset'](_0x3b21d1[_0x1a8c('0x37')][_0x1a8c('0x29')]);}return _0x34e24f[_0x1a8c('0x56')](_0x1c18d0);}})[_0x1a8c('0x1a')](function(_0xf93b1c){if(_0xf93b1c){return _0xf93b1c?{'count':_0x721408,'rows':_0xf93b1c}:null;}})[_0x1a8c('0x1a')](respondWithResult(_0x3be863,null))['catch'](handleError(_0x3be863,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ecf54d7..0f2f444 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 _0x32a6=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','lodash','../../config/logger'];(function(_0xb6c490,_0x23b361){var _0x3be82d=function(_0x28bcf2){while(--_0x28bcf2){_0xb6c490['push'](_0xb6c490['shift']());}};_0x3be82d(++_0x23b361);}(_0x32a6,0x1c1));var _0x632a=function(_0x585cc1,_0x9769c9){_0x585cc1=_0x585cc1-0x0;var _0x51dcbf=_0x32a6[_0x585cc1];return _0x51dcbf;};'use strict';var _=require(_0x632a('0x0'));var util=require('util');var logger=require(_0x632a('0x1'))(_0x632a('0x2'));var moment=require(_0x632a('0x3'));var BPromise=require('bluebird');var rp=require(_0x632a('0x4'));var fs=require('fs');var path=require(_0x632a('0x5'));var rimraf=require(_0x632a('0x6'));var config=require(_0x632a('0x7'));var attributes=require(_0x632a('0x8'));module[_0x632a('0x9')]=function(_0x281597,_0x20ec63){return _0x281597[_0x632a('0xa')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c22=['path','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','api','moment','bluebird'];(function(_0x37a89e,_0x14f5b3){var _0x5b44ce=function(_0x392ecb){while(--_0x392ecb){_0x37a89e['push'](_0x37a89e['shift']());}};_0x5b44ce(++_0x14f5b3);}(_0x5c22,0x146));var _0x25c2=function(_0x1aa308,_0x4462a7){_0x1aa308=_0x1aa308-0x0;var _0x2aacb2=_0x5c22[_0x1aa308];return _0x2aacb2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x25c2('0x0'))(_0x25c2('0x1'));var moment=require(_0x25c2('0x2'));var BPromise=require(_0x25c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25c2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x25c2('0x5'));module[_0x25c2('0x6')]=function(_0x11fe30,_0x52032c){return _0x11fe30[_0x25c2('0x7')](_0x25c2('0x8'),attributes,{'tableName':_0x25c2('0x9'),'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 48016e6..30d6aef 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 _0x4e9b=['request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x52a2e3,_0x5327c9){var _0x356950=function(_0x14f9bc){while(--_0x14f9bc){_0x52a2e3['push'](_0x52a2e3['shift']());}};_0x356950(++_0x5327c9);}(_0x4e9b,0x136));var _0xb4e9=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x4e9b[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xb4e9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb4e9('0x1'));var rs=require(_0xb4e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4e9('0x3'))['db'];var utils=require(_0xb4e9('0x4'));var logger=require(_0xb4e9('0x5'))(_0xb4e9('0x6'));var config=require(_0xb4e9('0x7'));var jayson=require(_0xb4e9('0x8'));var client=jayson['client'][_0xb4e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fecbf,_0x27dd49,_0x416025){return new BPromise(function(_0x302b8a,_0x4c0b10){return client[_0xb4e9('0xa')](_0x1fecbf,_0x416025)['then'](function(_0x36af24){logger[_0xb4e9('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x27dd49,_0xb4e9('0xc'));logger[_0xb4e9('0xd')](_0xb4e9('0xe'),_0x27dd49,_0xb4e9('0xc'),JSON[_0xb4e9('0xf')](_0x36af24));if(_0x36af24['error']){if(_0x36af24[_0xb4e9('0x10')]['code']===0x1f4){logger[_0xb4e9('0x10')](_0xb4e9('0x11'),_0x27dd49,_0x36af24[_0xb4e9('0x10')][_0xb4e9('0x12')]);return _0x4c0b10(_0x36af24[_0xb4e9('0x10')]['message']);}logger[_0xb4e9('0x10')](_0xb4e9('0x11'),_0x27dd49,_0x36af24[_0xb4e9('0x10')][_0xb4e9('0x12')]);return _0x302b8a(_0x36af24[_0xb4e9('0x10')][_0xb4e9('0x12')]);}else{logger['info'](_0xb4e9('0x11'),_0x27dd49,_0xb4e9('0xc'));_0x302b8a(_0x36af24[_0xb4e9('0x13')][_0xb4e9('0x12')]);}})['catch'](function(_0x29345f){logger['error'](_0xb4e9('0x11'),_0x27dd49,_0x29345f);_0x4c0b10(_0x29345f);});});} \ No newline at end of file +var _0x17f5=['error','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','stringify'];(function(_0x22d589,_0xd25c43){var _0xb89b3=function(_0x148a02){while(--_0x148a02){_0x22d589['push'](_0x22d589['shift']());}};_0xb89b3(++_0xd25c43);}(_0x17f5,0xe0));var _0x517f=function(_0x572663,_0x11715e){_0x572663=_0x572663-0x0;var _0x58ec34=_0x17f5[_0x572663];return _0x58ec34;};'use strict';var _=require(_0x517f('0x0'));var util=require(_0x517f('0x1'));var moment=require(_0x517f('0x2'));var BPromise=require('bluebird');var rs=require(_0x517f('0x3'));var fs=require('fs');var Redis=require(_0x517f('0x4'));var db=require(_0x517f('0x5'))['db'];var utils=require(_0x517f('0x6'));var logger=require(_0x517f('0x7'))(_0x517f('0x8'));var config=require('../../config/environment');var jayson=require(_0x517f('0x9'));var client=jayson['client'][_0x517f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20f69b,_0x502513,_0x1ace02){return new BPromise(function(_0x34b51b,_0x486476){return client[_0x517f('0xb')](_0x20f69b,_0x1ace02)['then'](function(_0x49e260){logger[_0x517f('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x502513,_0x517f('0xd'));logger[_0x517f('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x502513,_0x517f('0xd'),JSON[_0x517f('0xf')](_0x49e260));if(_0x49e260[_0x517f('0x10')]){if(_0x49e260[_0x517f('0x10')]['code']===0x1f4){logger[_0x517f('0x10')](_0x517f('0x11'),_0x502513,_0x49e260[_0x517f('0x10')][_0x517f('0x12')]);return _0x486476(_0x49e260[_0x517f('0x10')][_0x517f('0x12')]);}logger[_0x517f('0x10')](_0x517f('0x11'),_0x502513,_0x49e260[_0x517f('0x10')][_0x517f('0x12')]);return _0x34b51b(_0x49e260[_0x517f('0x10')][_0x517f('0x12')]);}else{logger[_0x517f('0xc')](_0x517f('0x11'),_0x502513,_0x517f('0xd'));_0x34b51b(_0x49e260['result']['message']);}})[_0x517f('0x13')](function(_0x3f761c){logger['error'](_0x517f('0x11'),_0x502513,_0x3f761c);_0x486476(_0x3f761c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 45f34ad..510efce 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 _0x70f3=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0x1d53bd,_0x2653b1){var _0x38a8e5=function(_0x566da5){while(--_0x566da5){_0x1d53bd['push'](_0x1d53bd['shift']());}};_0x38a8e5(++_0x2653b1);}(_0x70f3,0xc7));var _0x370f=function(_0xde4037,_0x368fcd){_0xde4037=_0xde4037-0x0;var _0x296e14=_0x70f3[_0xde4037];return _0x296e14;};'use strict';var multer=require('multer');var util=require(_0x370f('0x0'));var path=require(_0x370f('0x1'));var timeout=require(_0x370f('0x2'));var express=require(_0x370f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x370f('0x4'));var config=require(_0x370f('0x5'));var controller=require(_0x370f('0x6'));router[_0x370f('0x7')]('/',auth[_0x370f('0x8')](),controller[_0x370f('0x9')]);router['get'](_0x370f('0xa'),auth[_0x370f('0x8')](),controller[_0x370f('0xb')]);router[_0x370f('0xc')]('/',auth['isAuthenticated'](),controller[_0x370f('0xd')]);router[_0x370f('0xe')](_0x370f('0xa'),auth[_0x370f('0x8')](),controller[_0x370f('0xf')]);router[_0x370f('0x10')]('/:id',auth[_0x370f('0x8')](),controller[_0x370f('0x11')]);module[_0x370f('0x12')]=router; \ No newline at end of file +var _0x9d60=['put','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x4e18d0,_0x51badd){var _0x185ff7=function(_0x389e61){while(--_0x389e61){_0x4e18d0['push'](_0x4e18d0['shift']());}};_0x185ff7(++_0x51badd);}(_0x9d60,0x124));var _0x09d6=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x9d60[_0x495b3d];return _0x4cb329;};'use strict';var multer=require(_0x09d6('0x0'));var util=require(_0x09d6('0x1'));var path=require('path');var timeout=require(_0x09d6('0x2'));var express=require('express');var router=express[_0x09d6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09d6('0x4'));var config=require(_0x09d6('0x5'));var controller=require(_0x09d6('0x6'));router[_0x09d6('0x7')]('/',auth['isAuthenticated'](),controller[_0x09d6('0x8')]);router[_0x09d6('0x7')](_0x09d6('0x9'),auth[_0x09d6('0xa')](),controller[_0x09d6('0xb')]);router[_0x09d6('0xc')]('/',auth['isAuthenticated'](),controller[_0x09d6('0xd')]);router[_0x09d6('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x09d6('0xf')](_0x09d6('0x9'),auth['isAuthenticated'](),controller[_0x09d6('0x10')]);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 83690d6..d6f3554 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 _0xc73a=['variable','BOOLEAN','exports','ENUM','string','keyValue','STRING'];(function(_0x49f5e8,_0x2ee007){var _0x4fa732=function(_0x3117fe){while(--_0x3117fe){_0x49f5e8['push'](_0x49f5e8['shift']());}};_0x4fa732(++_0x2ee007);}(_0xc73a,0x72));var _0xac73=function(_0xe425b6,_0x1735ab){_0xe425b6=_0xe425b6-0x0;var _0x40a989=_0xc73a[_0xe425b6];return _0x40a989;};'use strict';var Sequelize=require('sequelize');module[_0xac73('0x0')]={'type':{'type':Sequelize[_0xac73('0x1')](_0xac73('0x2'),'variable','customVariable',_0xac73('0x3')),'defaultValue':_0xac73('0x2')},'content':{'type':Sequelize[_0xac73('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xac73('0x1')](_0xac73('0x2'),_0xac73('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0xac73('0x4')]},'idField':{'type':Sequelize[_0xac73('0x4')]},'nameField':{'type':Sequelize[_0xac73('0x4')]},'customField':{'type':Sequelize[_0xac73('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfaec=['exports','ENUM','keyValue','string','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfaec,0x12f));var _0xcfae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfaec[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xcfae('0x0'));module[_0xcfae('0x1')]={'type':{'type':Sequelize[_0xcfae('0x2')]('string','variable','customVariable',_0xcfae('0x3')),'defaultValue':_0xcfae('0x4')},'content':{'type':Sequelize[_0xcfae('0x5')]},'key':{'type':Sequelize[_0xcfae('0x5')]},'keyType':{'type':Sequelize[_0xcfae('0x2')]('string','variable',_0xcfae('0x6'))},'keyContent':{'type':Sequelize[_0xcfae('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcfae('0x5')]},'customField':{'type':Sequelize[_0xcfae('0x7')],'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 ec8b126..b56f5d9 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 _0x7da7=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','SugarcrmField','rows','catch','params','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x3addca,_0x18fc2a){var _0x7b9468=function(_0x457f0b){while(--_0x457f0b){_0x3addca['push'](_0x3addca['shift']());}};_0x7b9468(++_0x18fc2a);}(_0x7da7,0x10d));var _0x77da=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x7da7[_0x5f0501];return _0x3c2c45;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=_0x29cd7b['count'],_0x1b0e17=_0x4e130c['offset'],_0x4500c4=_0x4e130c['offset']+_0x4e130c[_0x77da('0x19')],_0x4ecd98;if(_0x4500c4>=_0x366443){_0x4500c4=_0x366443;_0x4ecd98=0xc8;}else{_0x4ecd98=0xce;}_0x2172d0[_0x77da('0x18')](_0x4ecd98);return _0x2172d0[_0x77da('0x1a')](_0x77da('0x1b'),_0x1b0e17+'-'+_0x4500c4+'/'+_0x366443)[_0x77da('0x1c')](_0x29cd7b);}return null;};}function patchUpdates(_0x12d2b1){return function(_0x1d325c){try{jsonpatch[_0x77da('0x1d')](_0x1d325c,_0x12d2b1,!![]);}catch(_0x544104){return BPromise['reject'](_0x544104);}return _0x1d325c[_0x77da('0x1e')]();};}function saveUpdates(_0x4d1512,_0x507979){return function(_0x45a122){if(_0x45a122){return _0x45a122[_0x77da('0x1f')](_0x4d1512)[_0x77da('0x20')](function(_0x5ab79a){return _0x5ab79a;});}return null;};}function removeEntity(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x21')]()[_0x77da('0x20')](function(){_0x58270c[_0x77da('0x18')](0xcc)[_0x77da('0x22')]();});}};}function handleEntityNotFound(_0x10399a,_0x270318){return function(_0x95b5db){if(!_0x95b5db){_0x10399a['sendStatus'](0x194);}return _0x95b5db;};}function handleError(_0x4885ec,_0xfd160){_0xfd160=_0xfd160||0x1f4;return function(_0x2d009f){logger[_0x77da('0x23')](_0x2d009f[_0x77da('0x24')]);if(_0x2d009f['name']){delete _0x2d009f[_0x77da('0x25')];}_0x4885ec[_0x77da('0x18')](_0xfd160)[_0x77da('0x26')](_0x2d009f);};}exports[_0x77da('0x27')]=function(_0x446ae7,_0x5997b6){var _0xce24b8={},_0x3e090d={},_0x1f2279={'count':0x0,'rows':[]};var _0x2913f7=_['map'](db['SugarcrmField']['rawAttributes'],function(_0x2258e9){return{'name':_0x2258e9[_0x77da('0x28')],'type':_0x2258e9[_0x77da('0x29')][_0x77da('0x2a')]};});_0x3e090d[_0x77da('0x2b')]=_['map'](_0x2913f7,_0x77da('0x25'));_0x3e090d[_0x77da('0x2c')]=_[_0x77da('0x2d')](_0x446ae7[_0x77da('0x2c')]);_0x3e090d[_0x77da('0x2e')]=_[_0x77da('0x2f')](_0x3e090d['model'],_0x3e090d[_0x77da('0x2c')]);_0xce24b8[_0x77da('0x30')]=_[_0x77da('0x2f')](_0x3e090d[_0x77da('0x2b')],qs[_0x77da('0x31')](_0x446ae7[_0x77da('0x2c')][_0x77da('0x31')]));_0xce24b8[_0x77da('0x30')]=_0xce24b8['attributes']['length']?_0xce24b8[_0x77da('0x30')]:_0x3e090d[_0x77da('0x2b')];if(!_0x446ae7['query'][_0x77da('0x32')](_0x77da('0x33'))){_0xce24b8[_0x77da('0x19')]=qs[_0x77da('0x19')](_0x446ae7[_0x77da('0x2c')][_0x77da('0x19')]);_0xce24b8[_0x77da('0x34')]=qs['offset'](_0x446ae7[_0x77da('0x2c')]['offset']);}_0xce24b8['order']=qs['sort'](_0x446ae7[_0x77da('0x2c')]['sort']);_0xce24b8[_0x77da('0x35')]=qs[_0x77da('0x2e')](_[_0x77da('0x36')](_0x446ae7[_0x77da('0x2c')],_0x3e090d[_0x77da('0x2e')]),_0x2913f7);if(_0x446ae7[_0x77da('0x2c')][_0x77da('0x37')]){_0xce24b8['where']=_[_0x77da('0x38')](_0xce24b8[_0x77da('0x35')],{'$or':_[_0x77da('0x39')](_0x2913f7,function(_0x32785f){if(_0x32785f[_0x77da('0x29')]!==_0x77da('0x3a')){var _0x48fccc={};_0x48fccc[_0x32785f[_0x77da('0x25')]]={'$like':'%'+_0x446ae7[_0x77da('0x2c')][_0x77da('0x37')]+'%'};return _0x48fccc;}})});}_0xce24b8=_['merge']({},_0xce24b8,_0x446ae7[_0x77da('0x3b')]);var _0x505ffb={'where':_0xce24b8['where']};return db['SugarcrmField']['count'](_0x505ffb)[_0x77da('0x20')](function(_0x1adba5){_0x1f2279[_0x77da('0x3c')]=_0x1adba5;if(_0x446ae7['query'][_0x77da('0x3d')]){_0xce24b8['include']=[{'all':!![]}];}return db[_0x77da('0x3e')]['findAll'](_0xce24b8);})[_0x77da('0x20')](function(_0xa19b50){_0x1f2279[_0x77da('0x3f')]=_0xa19b50;return _0x1f2279;})[_0x77da('0x20')](respondWithFilteredResult(_0x5997b6,_0xce24b8))[_0x77da('0x40')](handleError(_0x5997b6,null));};exports['show']=function(_0x759b86,_0x1f48bd){var _0x44717a={'raw':!![],'where':{'id':_0x759b86[_0x77da('0x41')]['id']}},_0x2f14f4={};_0x2f14f4[_0x77da('0x2b')]=_['keys'](db[_0x77da('0x3e')][_0x77da('0x42')]);_0x2f14f4[_0x77da('0x2c')]=_[_0x77da('0x2d')](_0x759b86[_0x77da('0x2c')]);_0x2f14f4[_0x77da('0x2e')]=_['intersection'](_0x2f14f4[_0x77da('0x2b')],_0x2f14f4['query']);_0x44717a[_0x77da('0x30')]=_[_0x77da('0x2f')](_0x2f14f4[_0x77da('0x2b')],qs['fields'](_0x759b86[_0x77da('0x2c')][_0x77da('0x31')]));_0x44717a[_0x77da('0x30')]=_0x44717a[_0x77da('0x30')][_0x77da('0x43')]?_0x44717a[_0x77da('0x30')]:_0x2f14f4[_0x77da('0x2b')];if(_0x759b86[_0x77da('0x2c')][_0x77da('0x3d')]){_0x44717a['include']=[{'all':!![]}];}_0x44717a=_[_0x77da('0x38')]({},_0x44717a,_0x759b86[_0x77da('0x3b')]);return db[_0x77da('0x3e')][_0x77da('0x44')](_0x44717a)[_0x77da('0x20')](handleEntityNotFound(_0x1f48bd,null))[_0x77da('0x20')](respondWithResult(_0x1f48bd,null))['catch'](handleError(_0x1f48bd,null));};exports['create']=function(_0x240d7b,_0x1597d8){return db[_0x77da('0x3e')][_0x77da('0x45')](_0x240d7b[_0x77da('0x46')],{})[_0x77da('0x20')](respondWithResult(_0x1597d8,0xc9))['catch'](handleError(_0x1597d8,null));};exports[_0x77da('0x1f')]=function(_0x357ee4,_0x332f80){if(_0x357ee4[_0x77da('0x46')]['id']){delete _0x357ee4['body']['id'];}return db[_0x77da('0x3e')]['find']({'where':{'id':_0x357ee4['params']['id']}})[_0x77da('0x20')](handleEntityNotFound(_0x332f80,null))[_0x77da('0x20')](saveUpdates(_0x357ee4[_0x77da('0x46')],null))[_0x77da('0x20')](respondWithResult(_0x332f80,null))['catch'](handleError(_0x332f80,null));};exports[_0x77da('0x21')]=function(_0x1e36ee,_0x56a3d9){return db[_0x77da('0x3e')][_0x77da('0x44')]({'where':{'id':_0x1e36ee['params']['id']}})[_0x77da('0x20')](handleEntityNotFound(_0x56a3d9,null))[_0x77da('0x20')](removeEntity(_0x56a3d9,null))[_0x77da('0x40')](handleError(_0x56a3d9,null));}; \ No newline at end of file +var _0xae24=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SugarcrmField','includeAll','findAll','catch','show','params','include','find','body','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x186550,_0x26f3ee){var _0x4b4c70=function(_0x2e255e){while(--_0x2e255e){_0x186550['push'](_0x186550['shift']());}};_0x4b4c70(++_0x26f3ee);}(_0xae24,0x182));var _0x4ae2=function(_0x200cd8,_0x5550d3){_0x200cd8=_0x200cd8-0x0;var _0x2c21f9=_0xae24[_0x200cd8];return _0x2c21f9;};'use strict';var pdf=require(_0x4ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae2('0x4'));var util=require('util');var path=require(_0x4ae2('0x5'));var sox=require(_0x4ae2('0x6'));var csv=require(_0x4ae2('0x7'));var ejs=require(_0x4ae2('0x8'));var fs=require('fs');var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=_0xf834a1[_0x4ae2('0x18')],_0x463765=_0x2f3936[_0x4ae2('0x19')],_0x9fb8db=_0x2f3936[_0x4ae2('0x19')]+_0x2f3936[_0x4ae2('0x1a')],_0x1fde63;if(_0x9fb8db>=_0x5f447a){_0x9fb8db=_0x5f447a;_0x1fde63=0xc8;}else{_0x1fde63=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x1fde63);return _0x4d5cab[_0x4ae2('0x1b')](_0x4ae2('0x1c'),_0x463765+'-'+_0x9fb8db+'/'+_0x5f447a)['json'](_0xf834a1);}return null;};}function patchUpdates(_0x4a97af){return function(_0x44a2d3){try{jsonpatch[_0x4ae2('0x1d')](_0x44a2d3,_0x4a97af,!![]);}catch(_0x51e20c){return BPromise[_0x4ae2('0x1e')](_0x51e20c);}return _0x44a2d3[_0x4ae2('0x1f')]();};}function saveUpdates(_0xccb3b,_0x2ad222){return function(_0x8732bb){if(_0x8732bb){return _0x8732bb['update'](_0xccb3b)[_0x4ae2('0x20')](function(_0x53c686){return _0x53c686;});}return null;};}function removeEntity(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x21')]()[_0x4ae2('0x20')](function(){_0x522165[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1005e0,_0x4a0ddb){return function(_0x2049fa){if(!_0x2049fa){_0x1005e0[_0x4ae2('0x15')](0x194);}return _0x2049fa;};}function handleError(_0x130239,_0x57933b){_0x57933b=_0x57933b||0x1f4;return function(_0x43f112){logger[_0x4ae2('0x22')](_0x43f112[_0x4ae2('0x23')]);if(_0x43f112[_0x4ae2('0x24')]){delete _0x43f112[_0x4ae2('0x24')];}_0x130239[_0x4ae2('0x16')](_0x57933b)['send'](_0x43f112);};}exports['index']=function(_0x9508d7,_0x3030f8){var _0x3fa514={},_0x329588={},_0x3a9b96={'count':0x0,'rows':[]};var _0x20ef44=_['map'](db['SugarcrmField'][_0x4ae2('0x25')],function(_0x4e7741){return{'name':_0x4e7741['fieldName'],'type':_0x4e7741['type'][_0x4ae2('0x26')]};});_0x329588[_0x4ae2('0x27')]=_['map'](_0x20ef44,_0x4ae2('0x24'));_0x329588[_0x4ae2('0x28')]=_[_0x4ae2('0x29')](_0x9508d7[_0x4ae2('0x28')]);_0x329588[_0x4ae2('0x2a')]=_[_0x4ae2('0x2b')](_0x329588[_0x4ae2('0x27')],_0x329588[_0x4ae2('0x28')]);_0x3fa514[_0x4ae2('0x2c')]=_[_0x4ae2('0x2b')](_0x329588[_0x4ae2('0x27')],qs[_0x4ae2('0x2d')](_0x9508d7[_0x4ae2('0x28')][_0x4ae2('0x2d')]));_0x3fa514[_0x4ae2('0x2c')]=_0x3fa514[_0x4ae2('0x2c')][_0x4ae2('0x2e')]?_0x3fa514['attributes']:_0x329588[_0x4ae2('0x27')];if(!_0x9508d7['query'][_0x4ae2('0x2f')](_0x4ae2('0x30'))){_0x3fa514['limit']=qs[_0x4ae2('0x1a')](_0x9508d7[_0x4ae2('0x28')][_0x4ae2('0x1a')]);_0x3fa514[_0x4ae2('0x19')]=qs['offset'](_0x9508d7[_0x4ae2('0x28')][_0x4ae2('0x19')]);}_0x3fa514[_0x4ae2('0x31')]=qs[_0x4ae2('0x32')](_0x9508d7[_0x4ae2('0x28')][_0x4ae2('0x32')]);_0x3fa514[_0x4ae2('0x33')]=qs[_0x4ae2('0x2a')](_[_0x4ae2('0x34')](_0x9508d7['query'],_0x329588[_0x4ae2('0x2a')]),_0x20ef44);if(_0x9508d7['query'][_0x4ae2('0x35')]){_0x3fa514[_0x4ae2('0x33')]=_[_0x4ae2('0x36')](_0x3fa514[_0x4ae2('0x33')],{'$or':_[_0x4ae2('0x37')](_0x20ef44,function(_0x129adf){if(_0x129adf['type']!==_0x4ae2('0x38')){var _0x700f27={};_0x700f27[_0x129adf[_0x4ae2('0x24')]]={'$like':'%'+_0x9508d7[_0x4ae2('0x28')]['filter']+'%'};return _0x700f27;}})});}_0x3fa514=_[_0x4ae2('0x36')]({},_0x3fa514,_0x9508d7[_0x4ae2('0x39')]);var _0x2f0d83={'where':_0x3fa514[_0x4ae2('0x33')]};return db[_0x4ae2('0x3a')][_0x4ae2('0x18')](_0x2f0d83)[_0x4ae2('0x20')](function(_0x1b04ee){_0x3a9b96[_0x4ae2('0x18')]=_0x1b04ee;if(_0x9508d7[_0x4ae2('0x28')][_0x4ae2('0x3b')]){_0x3fa514['include']=[{'all':!![]}];}return db[_0x4ae2('0x3a')][_0x4ae2('0x3c')](_0x3fa514);})[_0x4ae2('0x20')](function(_0x1473e6){_0x3a9b96['rows']=_0x1473e6;return _0x3a9b96;})['then'](respondWithFilteredResult(_0x3030f8,_0x3fa514))[_0x4ae2('0x3d')](handleError(_0x3030f8,null));};exports[_0x4ae2('0x3e')]=function(_0x2cbdcc,_0x3cdf23){var _0x567371={'raw':!![],'where':{'id':_0x2cbdcc[_0x4ae2('0x3f')]['id']}},_0x3c0a56={};_0x3c0a56['model']=_[_0x4ae2('0x29')](db[_0x4ae2('0x3a')][_0x4ae2('0x25')]);_0x3c0a56['query']=_[_0x4ae2('0x29')](_0x2cbdcc[_0x4ae2('0x28')]);_0x3c0a56[_0x4ae2('0x2a')]=_[_0x4ae2('0x2b')](_0x3c0a56[_0x4ae2('0x27')],_0x3c0a56[_0x4ae2('0x28')]);_0x567371[_0x4ae2('0x2c')]=_[_0x4ae2('0x2b')](_0x3c0a56['model'],qs[_0x4ae2('0x2d')](_0x2cbdcc[_0x4ae2('0x28')]['fields']));_0x567371[_0x4ae2('0x2c')]=_0x567371[_0x4ae2('0x2c')]['length']?_0x567371[_0x4ae2('0x2c')]:_0x3c0a56[_0x4ae2('0x27')];if(_0x2cbdcc['query'][_0x4ae2('0x3b')]){_0x567371[_0x4ae2('0x40')]=[{'all':!![]}];}_0x567371=_[_0x4ae2('0x36')]({},_0x567371,_0x2cbdcc['options']);return db['SugarcrmField'][_0x4ae2('0x41')](_0x567371)[_0x4ae2('0x20')](handleEntityNotFound(_0x3cdf23,null))[_0x4ae2('0x20')](respondWithResult(_0x3cdf23,null))[_0x4ae2('0x3d')](handleError(_0x3cdf23,null));};exports['create']=function(_0x16a072,_0x28b33a){return db[_0x4ae2('0x3a')]['create'](_0x16a072[_0x4ae2('0x42')],{})[_0x4ae2('0x20')](respondWithResult(_0x28b33a,0xc9))[_0x4ae2('0x3d')](handleError(_0x28b33a,null));};exports['update']=function(_0x16bf0b,_0x24ec08){if(_0x16bf0b[_0x4ae2('0x42')]['id']){delete _0x16bf0b[_0x4ae2('0x42')]['id'];}return db[_0x4ae2('0x3a')][_0x4ae2('0x41')]({'where':{'id':_0x16bf0b[_0x4ae2('0x3f')]['id']}})[_0x4ae2('0x20')](handleEntityNotFound(_0x24ec08,null))[_0x4ae2('0x20')](saveUpdates(_0x16bf0b[_0x4ae2('0x42')],null))['then'](respondWithResult(_0x24ec08,null))[_0x4ae2('0x3d')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x21')]=function(_0x10db30,_0x1c0898){return db[_0x4ae2('0x3a')][_0x4ae2('0x41')]({'where':{'id':_0x10db30[_0x4ae2('0x3f')]['id']}})[_0x4ae2('0x20')](handleEntityNotFound(_0x1c0898,null))['then'](removeEntity(_0x1c0898,null))[_0x4ae2('0x3d')](handleError(_0x1c0898,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 2f73aa4..059ef95 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 _0x355b=['idField','FieldId','util','../../config/logger','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x355430,_0x290b3e){var _0x234979=function(_0x137d7b){while(--_0x137d7b){_0x355430['push'](_0x355430['shift']());}};_0x234979(++_0x290b3e);}(_0x355b,0x13a));var _0xb355=function(_0x5ae8fc,_0xdbb986){_0x5ae8fc=_0x5ae8fc-0x0;var _0x303c8a=_0x355b[_0x5ae8fc];return _0x303c8a;};'use strict';var _=require('lodash');var util=require(_0xb355('0x0'));var logger=require(_0xb355('0x1'))('api');var moment=require(_0xb355('0x2'));var BPromise=require(_0xb355('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb355('0x4'));var rimraf=require(_0xb355('0x5'));var config=require('../../config/environment');var attributes=require(_0xb355('0x6'));module[_0xb355('0x7')]=function(_0x21f018,_0x2a7607){return _0x21f018['define']('SugarcrmField',attributes,{'tableName':_0xb355('0x8'),'paranoid':![],'indexes':[{'name':_0xb355('0x9'),'fields':[_0xb355('0xa'),_0xb355('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4bb=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField'];(function(_0x5148eb,_0x4dcd6f){var _0xb25381=function(_0x20a590){while(--_0x20a590){_0x5148eb['push'](_0x5148eb['shift']());}};_0xb25381(++_0x4dcd6f);}(_0xe4bb,0xd1));var _0xbe4b=function(_0x4af3d5,_0x4b16b4){_0x4af3d5=_0x4af3d5-0x0;var _0x49d764=_0xe4bb[_0x4af3d5];return _0x49d764;};'use strict';var _=require('lodash');var util=require(_0xbe4b('0x0'));var logger=require(_0xbe4b('0x1'))(_0xbe4b('0x2'));var moment=require(_0xbe4b('0x3'));var BPromise=require(_0xbe4b('0x4'));var rp=require(_0xbe4b('0x5'));var fs=require('fs');var path=require(_0xbe4b('0x6'));var rimraf=require(_0xbe4b('0x7'));var config=require(_0xbe4b('0x8'));var attributes=require(_0xbe4b('0x9'));module[_0xbe4b('0xa')]=function(_0x28608d,_0x493bae){return _0x28608d[_0xbe4b('0xb')](_0xbe4b('0xc'),attributes,{'tableName':_0xbe4b('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xbe4b('0xe'),_0xbe4b('0xf')],'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 fe58217..5392ddc 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x8f06f2,_0x1f5cd1){var _0x18f28e=function(_0x1801db){while(--_0x1801db){_0x8f06f2['push'](_0x8f06f2['shift']());}};_0x18f28e(++_0x1f5cd1);}(_0x2032,0xd9));var _0x2203=function(_0x149789,_0x4b63dc){_0x149789=_0x149789-0x0;var _0x32eaed=_0x2032[_0x149789];return _0x32eaed;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x5dbbb2,_0x6d6303){var _0x12ba58=function(_0x11ec77){while(--_0x11ec77){_0x5dbbb2['push'](_0x5dbbb2['shift']());}};_0x12ba58(++_0x6d6303);}(_0x2032,0xd9));var _0x2203=function(_0x204a2f,_0xe903c){_0x204a2f=_0x204a2f-0x0;var _0x576485=_0x2032[_0x204a2f];return _0x576485;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ae48b7f..fa3fa24 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 _0xf566=['create','addConfiguration','put','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x16fb2e,_0x419d67){var _0xf5a924=function(_0x2ac4d4){while(--_0x2ac4d4){_0x16fb2e['push'](_0x16fb2e['shift']());}};_0xf5a924(++_0x419d67);}(_0xf566,0x180));var _0x6f56=function(_0x5601f8,_0x211c63){_0x5601f8=_0x5601f8-0x0;var _0x1e1901=_0xf566[_0x5601f8];return _0x1e1901;};'use strict';var multer=require(_0x6f56('0x0'));var util=require(_0x6f56('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6f56('0x2'));var router=express['Router']();var auth=require(_0x6f56('0x3'));var interaction=require(_0x6f56('0x4'));var config=require(_0x6f56('0x5'));var controller=require(_0x6f56('0x6'));router[_0x6f56('0x7')]('/',auth[_0x6f56('0x8')](),controller['index']);router[_0x6f56('0x7')](_0x6f56('0x9'),auth[_0x6f56('0x8')](),controller[_0x6f56('0xa')]);router['get'](_0x6f56('0xb'),auth['isAuthenticated'](),controller[_0x6f56('0xc')]);router[_0x6f56('0x7')]('/:id/fields',auth[_0x6f56('0x8')](),controller[_0x6f56('0xd')]);router[_0x6f56('0xe')]('/',auth[_0x6f56('0x8')](),controller[_0x6f56('0xf')]);router[_0x6f56('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6f56('0x10')]);router[_0x6f56('0x11')](_0x6f56('0x9'),auth[_0x6f56('0x8')](),controller[_0x6f56('0x12')]);router[_0x6f56('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6f56('0x14')]=router; \ No newline at end of file +var _0xcc54=['/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x354425,_0x3264c7){var _0x30b484=function(_0x1244f3){while(--_0x1244f3){_0x354425['push'](_0x354425['shift']());}};_0x30b484(++_0x3264c7);}(_0xcc54,0x1e9));var _0x4cc5=function(_0x16c8ca,_0x342006){_0x16c8ca=_0x16c8ca-0x0;var _0x59dd4e=_0xcc54[_0x16c8ca];return _0x59dd4e;};'use strict';var multer=require(_0x4cc5('0x0'));var util=require('util');var path=require(_0x4cc5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x4cc5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x4cc5('0x3'));var controller=require(_0x4cc5('0x4'));router[_0x4cc5('0x5')]('/',auth[_0x4cc5('0x6')](),controller[_0x4cc5('0x7')]);router['get'](_0x4cc5('0x8'),auth[_0x4cc5('0x6')](),controller[_0x4cc5('0x9')]);router[_0x4cc5('0x5')](_0x4cc5('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4cc5('0x5')](_0x4cc5('0xb'),auth['isAuthenticated'](),controller[_0x4cc5('0xc')]);router[_0x4cc5('0xd')]('/',auth[_0x4cc5('0x6')](),controller[_0x4cc5('0xe')]);router[_0x4cc5('0xd')]('/:id/configurations',auth[_0x4cc5('0x6')](),controller['addConfiguration']);router[_0x4cc5('0xf')](_0x4cc5('0x8'),auth[_0x4cc5('0x6')](),controller[_0x4cc5('0x10')]);router[_0x4cc5('0x11')](_0x4cc5('0x8'),auth[_0x4cc5('0x6')](),controller[_0x4cc5('0x12')]);module[_0x4cc5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 933ee1e..e6ce21e 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 _0xe12c=['HelpDesk','exports','STRING'];(function(_0x264a6a,_0x321a9a){var _0x2b26c8=function(_0x267b8d){while(--_0x267b8d){_0x264a6a['push'](_0x264a6a['shift']());}};_0x2b26c8(++_0x321a9a);}(_0xe12c,0x118));var _0xce12=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xe12c[_0x5416db];return _0x243e35;};'use strict';var Sequelize=require('sequelize');module[_0xce12('0x0')]={'name':{'type':Sequelize[_0xce12('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xce12('0x1')]},'username':{'type':Sequelize[_0xce12('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xce12('0x1')],'allowNull':![],'defaultValue':_0xce12('0x2')},'remoteUri':{'type':Sequelize[_0xce12('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xce12('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xce12('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc52c=['sequelize','exports','STRING','HelpDesk'];(function(_0x4e615d,_0x88b712){var _0x4240bd=function(_0x15fbbc){while(--_0x15fbbc){_0x4e615d['push'](_0x4e615d['shift']());}};_0x4240bd(++_0x88b712);}(_0xc52c,0x144));var _0xcc52=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xc52c[_0x57add2];return _0x4e3670;};'use strict';var Sequelize=require(_0xcc52('0x0'));module[_0xcc52('0x1')]={'name':{'type':Sequelize[_0xcc52('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcc52('0x2')]},'username':{'type':Sequelize[_0xcc52('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcc52('0x2')],'allowNull':![],'defaultValue':_0xcc52('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xcc52('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 693d55f..0532fdc 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 _0x2dc3=['show','params','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','pick','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','VtigerField','md5','getFields','description','moduleName','remoteUri','accessKey','username','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','login','token','success','describe','sessionName','autogenerated','reference','includes','remove','false','startsWith','picklistValues','label','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','reject','update','destroy','then','end','stack','name','index','map','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','filter','merge','options','includeAll','include','findAll','catch'];(function(_0x2d238f,_0x51d70d){var _0x4169e5=function(_0x414ca8){while(--_0x414ca8){_0x2d238f['push'](_0x2d238f['shift']());}};_0x4169e5(++_0x51d70d);}(_0x2dc3,0x127));var _0x32dc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2dc3[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32dc('0x0'));var rimraf=require(_0x32dc('0x1'));var zipdir=require(_0x32dc('0x2'));var jsonpatch=require(_0x32dc('0x3'));var rp=require(_0x32dc('0x4'));var moment=require(_0x32dc('0x5'));var BPromise=require(_0x32dc('0x6'));var Mustache=require(_0x32dc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x32dc('0x8'));var csv=require('to-csv');var ejs=require(_0x32dc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32dc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x32dc('0xc'));var Papa=require(_0x32dc('0xd'));var Redis=require(_0x32dc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32dc('0xf'));var hardwareService=require(_0x32dc('0x10'));var logger=require(_0x32dc('0x11'))(_0x32dc('0x12'));var utils=require(_0x32dc('0x13'));var config=require(_0x32dc('0x14'));var licenseUtil=require(_0x32dc('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x32dc('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x32dc('0x17')][_0x32dc('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2a33a7,_0x5c54c2,_0x355d98,_0x10f169){return new BPromise(function(_0x5e373a,_0x1fb775){var _0x4bf4ca=_0x10f169||client;return _0x4bf4ca[_0x32dc('0x19')](_0x2a33a7,_0x355d98)['then'](function(_0x47fe19){logger['info'](_0x32dc('0x1a'),_0x5c54c2,_0x32dc('0x1b'));logger[_0x32dc('0x1c')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5c54c2,_0x32dc('0x1b'),JSON[_0x32dc('0x1d')](_0x47fe19));if(_0x47fe19[_0x32dc('0x1e')]){if(_0x47fe19['error'][_0x32dc('0x1f')]===0x1f4){logger[_0x32dc('0x1e')](_0x32dc('0x1a'),_0x5c54c2,_0x47fe19[_0x32dc('0x1e')]['message']);return _0x1fb775(_0x47fe19[_0x32dc('0x1e')][_0x32dc('0x20')]);}logger[_0x32dc('0x1e')](_0x32dc('0x1a'),_0x5c54c2,_0x47fe19[_0x32dc('0x1e')][_0x32dc('0x20')]);return _0x5e373a(_0x47fe19[_0x32dc('0x1e')][_0x32dc('0x20')]);}else{logger['info'](_0x32dc('0x1a'),_0x5c54c2,_0x32dc('0x1b'));_0x5e373a(_0x47fe19[_0x32dc('0x21')][_0x32dc('0x20')]);}})['catch'](function(_0xa5c303){logger[_0x32dc('0x1e')](_0x32dc('0x1a'),_0x5c54c2,_0xa5c303);_0x1fb775(_0xa5c303);});});}function respondWithStatusCode(_0x39182b,_0x57e1e3){_0x57e1e3=_0x57e1e3||0xcc;return function(_0x36a190){if(_0x36a190){return _0x39182b[_0x32dc('0x22')](_0x57e1e3);}return _0x39182b[_0x32dc('0x23')](_0x57e1e3)['end']();};}function respondWithResult(_0x51af54,_0x3718e1){_0x3718e1=_0x3718e1||0xc8;return function(_0x4a0e6e){if(_0x4a0e6e){return _0x51af54[_0x32dc('0x23')](_0x3718e1)['json'](_0x4a0e6e);}};}function respondWithFilteredResult(_0x5a7382,_0x50ccf4){return function(_0x2664db){if(_0x2664db){var _0x4a1e63=_0x2664db[_0x32dc('0x24')],_0x6f190e=_0x50ccf4[_0x32dc('0x25')],_0x26e348=_0x50ccf4[_0x32dc('0x25')]+_0x50ccf4[_0x32dc('0x26')],_0x58a46c;if(_0x26e348>=_0x4a1e63){_0x26e348=_0x4a1e63;_0x58a46c=0xc8;}else{_0x58a46c=0xce;}_0x5a7382[_0x32dc('0x23')](_0x58a46c);return _0x5a7382[_0x32dc('0x27')](_0x32dc('0x28'),_0x6f190e+'-'+_0x26e348+'/'+_0x4a1e63)['json'](_0x2664db);}return null;};}function patchUpdates(_0x1beb46){return function(_0x38c113){try{jsonpatch['apply'](_0x38c113,_0x1beb46,!![]);}catch(_0x486c19){return BPromise[_0x32dc('0x29')](_0x486c19);}return _0x38c113['save']();};}function saveUpdates(_0x46a526,_0x5b9c3a){return function(_0x1c90dc){if(_0x1c90dc){return _0x1c90dc[_0x32dc('0x2a')](_0x46a526)['then'](function(_0x3e251a){return _0x3e251a;});}return null;};}function removeEntity(_0x194fcb,_0x1ec064){return function(_0x4b9c0e){if(_0x4b9c0e){return _0x4b9c0e[_0x32dc('0x2b')]()[_0x32dc('0x2c')](function(){_0x194fcb[_0x32dc('0x23')](0xcc)[_0x32dc('0x2d')]();});}};}function handleEntityNotFound(_0x4003ab,_0x38c001){return function(_0x76d766){if(!_0x76d766){_0x4003ab[_0x32dc('0x22')](0x194);}return _0x76d766;};}function handleError(_0x40e6f8,_0x1e12d2){_0x1e12d2=_0x1e12d2||0x1f4;return function(_0x4846be){logger[_0x32dc('0x1e')](_0x4846be[_0x32dc('0x2e')]);if(_0x4846be[_0x32dc('0x2f')]){delete _0x4846be[_0x32dc('0x2f')];}_0x40e6f8[_0x32dc('0x23')](_0x1e12d2)['send'](_0x4846be);};}exports[_0x32dc('0x30')]=function(_0x56a93e,_0x26c987){var _0x57537b={},_0x314ffa={},_0x50ff9a={'count':0x0,'rows':[]};var _0x55bacb=_[_0x32dc('0x31')](db[_0x32dc('0x32')][_0x32dc('0x33')],function(_0x3ac0e6){return{'name':_0x3ac0e6['fieldName'],'type':_0x3ac0e6[_0x32dc('0x34')][_0x32dc('0x35')]};});_0x314ffa[_0x32dc('0x36')]=_[_0x32dc('0x31')](_0x55bacb,'name');_0x314ffa[_0x32dc('0x37')]=_[_0x32dc('0x38')](_0x56a93e[_0x32dc('0x37')]);_0x314ffa[_0x32dc('0x39')]=_[_0x32dc('0x3a')](_0x314ffa['model'],_0x314ffa['query']);_0x57537b['attributes']=_['intersection'](_0x314ffa['model'],qs[_0x32dc('0x3b')](_0x56a93e[_0x32dc('0x37')]['fields']));_0x57537b[_0x32dc('0x3c')]=_0x57537b[_0x32dc('0x3c')]['length']?_0x57537b[_0x32dc('0x3c')]:_0x314ffa[_0x32dc('0x36')];if(!_0x56a93e[_0x32dc('0x37')]['hasOwnProperty']('nolimit')){_0x57537b[_0x32dc('0x26')]=qs[_0x32dc('0x26')](_0x56a93e[_0x32dc('0x37')][_0x32dc('0x26')]);_0x57537b[_0x32dc('0x25')]=qs[_0x32dc('0x25')](_0x56a93e[_0x32dc('0x37')][_0x32dc('0x25')]);}_0x57537b[_0x32dc('0x3d')]=qs[_0x32dc('0x3e')](_0x56a93e[_0x32dc('0x37')][_0x32dc('0x3e')]);_0x57537b[_0x32dc('0x3f')]=qs['filters'](_['pick'](_0x56a93e[_0x32dc('0x37')],_0x314ffa[_0x32dc('0x39')]),_0x55bacb);if(_0x56a93e[_0x32dc('0x37')][_0x32dc('0x40')]){_0x57537b['where']=_[_0x32dc('0x41')](_0x57537b[_0x32dc('0x3f')],{'$or':_[_0x32dc('0x31')](_0x55bacb,function(_0x530e46){if(_0x530e46[_0x32dc('0x34')]!=='VIRTUAL'){var _0x61744d={};_0x61744d[_0x530e46[_0x32dc('0x2f')]]={'$like':'%'+_0x56a93e[_0x32dc('0x37')][_0x32dc('0x40')]+'%'};return _0x61744d;}})});}_0x57537b=_['merge']({},_0x57537b,_0x56a93e[_0x32dc('0x42')]);var _0x51580b={'where':_0x57537b[_0x32dc('0x3f')]};return db['VtigerAccount'][_0x32dc('0x24')](_0x51580b)[_0x32dc('0x2c')](function(_0x185e29){_0x50ff9a[_0x32dc('0x24')]=_0x185e29;if(_0x56a93e[_0x32dc('0x37')][_0x32dc('0x43')]){_0x57537b[_0x32dc('0x44')]=[{'all':!![]}];}return db[_0x32dc('0x32')][_0x32dc('0x45')](_0x57537b);})[_0x32dc('0x2c')](function(_0x241d53){_0x50ff9a['rows']=_0x241d53;return _0x50ff9a;})[_0x32dc('0x2c')](respondWithFilteredResult(_0x26c987,_0x57537b))[_0x32dc('0x46')](handleError(_0x26c987,null));};exports[_0x32dc('0x47')]=function(_0xdd70f5,_0x5d3bd5){var _0x2b9755={'raw':![],'where':{'id':_0xdd70f5[_0x32dc('0x48')]['id']}},_0x539c66={};_0x539c66['model']=_['keys'](db[_0x32dc('0x32')][_0x32dc('0x33')]);_0x539c66[_0x32dc('0x37')]=_[_0x32dc('0x38')](_0xdd70f5['query']);_0x539c66[_0x32dc('0x39')]=_[_0x32dc('0x3a')](_0x539c66[_0x32dc('0x36')],_0x539c66['query']);_0x2b9755['attributes']=_[_0x32dc('0x3a')](_0x539c66['model'],qs[_0x32dc('0x3b')](_0xdd70f5['query']['fields']));_0x2b9755[_0x32dc('0x3c')]=_0x2b9755[_0x32dc('0x3c')][_0x32dc('0x49')]?_0x2b9755[_0x32dc('0x3c')]:_0x539c66['model'];if(_0xdd70f5[_0x32dc('0x37')]['includeAll']){_0x2b9755[_0x32dc('0x44')]=[{'all':!![]}];}_0x2b9755=_[_0x32dc('0x41')]({},_0x2b9755,_0xdd70f5[_0x32dc('0x42')]);return db[_0x32dc('0x32')][_0x32dc('0x4a')](_0x2b9755)['then'](handleEntityNotFound(_0x5d3bd5,null))['then'](respondWithResult(_0x5d3bd5,null))[_0x32dc('0x46')](handleError(_0x5d3bd5,null));};exports['create']=function(_0x3dd105,_0x1d6f71){return db[_0x32dc('0x32')][_0x32dc('0x4b')](_0x3dd105[_0x32dc('0x4c')],{})[_0x32dc('0x2c')](respondWithResult(_0x1d6f71,0xc9))[_0x32dc('0x46')](handleError(_0x1d6f71,null));};exports[_0x32dc('0x2a')]=function(_0x1dc573,_0x293602){if(_0x1dc573[_0x32dc('0x4c')]['id']){delete _0x1dc573[_0x32dc('0x4c')]['id'];}return db[_0x32dc('0x32')][_0x32dc('0x4a')]({'where':{'id':_0x1dc573['params']['id']}})[_0x32dc('0x2c')](handleEntityNotFound(_0x293602,null))['then'](saveUpdates(_0x1dc573[_0x32dc('0x4c')],null))[_0x32dc('0x2c')](respondWithResult(_0x293602,null))[_0x32dc('0x46')](handleError(_0x293602,null));};exports['destroy']=function(_0x197684,_0x238d74){return db[_0x32dc('0x32')][_0x32dc('0x4a')]({'where':{'id':_0x197684[_0x32dc('0x48')]['id']}})[_0x32dc('0x2c')](handleEntityNotFound(_0x238d74,null))['then'](removeEntity(_0x238d74,null))['catch'](handleError(_0x238d74,null));};exports[_0x32dc('0x4d')]=function(_0x32c973,_0x507ba2,_0x26e0d4){var _0x54f701={};var _0x401a9b={};var _0x5008e1;var _0x394a47;return db[_0x32dc('0x32')][_0x32dc('0x4e')]({'where':{'id':_0x32c973[_0x32dc('0x48')]['id']}})[_0x32dc('0x2c')](handleEntityNotFound(_0x507ba2,null))[_0x32dc('0x2c')](function(_0x499e32){if(_0x499e32){_0x5008e1=_0x499e32;_0x401a9b[_0x32dc('0x36')]=_['keys'](db[_0x32dc('0x4f')]['rawAttributes']);_0x401a9b[_0x32dc('0x37')]=_[_0x32dc('0x38')](_0x32c973[_0x32dc('0x37')]);_0x401a9b[_0x32dc('0x39')]=_[_0x32dc('0x3a')](_0x401a9b[_0x32dc('0x36')],_0x401a9b[_0x32dc('0x37')]);_0x54f701[_0x32dc('0x3c')]=_[_0x32dc('0x3a')](_0x401a9b['model'],qs[_0x32dc('0x3b')](_0x32c973['query']['fields']));_0x54f701[_0x32dc('0x3c')]=_0x54f701[_0x32dc('0x3c')][_0x32dc('0x49')]?_0x54f701['attributes']:_0x401a9b[_0x32dc('0x36')];_0x54f701[_0x32dc('0x3d')]=qs[_0x32dc('0x3e')](_0x32c973[_0x32dc('0x37')][_0x32dc('0x3e')]);_0x54f701[_0x32dc('0x3f')]=qs['filters'](_[_0x32dc('0x50')](_0x32c973[_0x32dc('0x37')],_0x401a9b[_0x32dc('0x39')]));if(_0x32c973['query'][_0x32dc('0x40')]){_0x54f701[_0x32dc('0x3f')]=_['merge'](_0x54f701[_0x32dc('0x3f')],{'$or':_[_0x32dc('0x31')](_0x54f701[_0x32dc('0x3c')],function(_0x1d9363){var _0x47b66c={};_0x47b66c[_0x1d9363]={'$like':'%'+_0x32c973[_0x32dc('0x37')][_0x32dc('0x40')]+'%'};return _0x47b66c;})});}_0x54f701=_[_0x32dc('0x41')]({},_0x54f701,_0x32c973[_0x32dc('0x42')]);return _0x5008e1[_0x32dc('0x4d')](_0x54f701);}})[_0x32dc('0x2c')](function(_0x388cef){if(_0x388cef){_0x394a47=_0x388cef[_0x32dc('0x49')];if(!_0x32c973[_0x32dc('0x37')]['hasOwnProperty'](_0x32dc('0x51'))){_0x54f701[_0x32dc('0x26')]=qs[_0x32dc('0x26')](_0x32c973[_0x32dc('0x37')]['limit']);_0x54f701[_0x32dc('0x25')]=qs[_0x32dc('0x25')](_0x32c973[_0x32dc('0x37')][_0x32dc('0x25')]);}return _0x5008e1[_0x32dc('0x4d')](_0x54f701);}})[_0x32dc('0x2c')](function(_0xf62624){if(_0xf62624){return _0xf62624?{'count':_0x394a47,'rows':_0xf62624}:null;}})[_0x32dc('0x2c')](respondWithResult(_0x507ba2,null))[_0x32dc('0x46')](handleError(_0x507ba2,null));};exports[_0x32dc('0x52')]=function(_0x3f480c,_0xe5a261,_0x39abcc){if(_0x3f480c[_0x32dc('0x4c')]['id']){delete _0x3f480c[_0x32dc('0x4c')]['id'];}return db[_0x32dc('0x32')][_0x32dc('0x4e')]({'where':{'id':_0x3f480c[_0x32dc('0x48')]['id']}})[_0x32dc('0x2c')](handleEntityNotFound(_0xe5a261,null))['then'](function(_0x50304b){if(_0x50304b){_0x3f480c[_0x32dc('0x4c')][_0x32dc('0x53')]=_0x50304b['id'];_0x3f480c[_0x32dc('0x4c')]['Subjects']=integrations[_0x32dc('0x54')](_0x3f480c[_0x32dc('0x4c')][_0x32dc('0x55')],_0x3f480c[_0x32dc('0x4c')][_0x32dc('0x34')]);_0x3f480c[_0x32dc('0x4c')][_0x32dc('0x56')]=integrations[_0x32dc('0x57')](_0x3f480c[_0x32dc('0x4c')][_0x32dc('0x55')],_0x3f480c[_0x32dc('0x4c')][_0x32dc('0x34')]);return db['VtigerConfiguration'][_0x32dc('0x4b')](_0x3f480c[_0x32dc('0x4c')],{'include':[{'model':db['VtigerField'],'as':_0x32dc('0x58')},{'model':db[_0x32dc('0x59')],'as':_0x32dc('0x56')}]});}return null;})[_0x32dc('0x2c')](respondWithResult(_0xe5a261,null))[_0x32dc('0x46')](handleError(_0xe5a261,null));};var md5=require(_0x32dc('0x5a'));exports[_0x32dc('0x5b')]=function(_0x5d289b,_0x4114b6,_0x22e9bd){var _0x18e402=null;var _0x2f84dd=null;var _0x326c8f=null;var _0x17e837=null;var _0x4f534b='';return db[_0x32dc('0x32')]['findOne']({'where':{'id':_0x5d289b[_0x32dc('0x48')]['id']},'attributes':['id',_0x32dc('0x2f'),'username',_0x32dc('0x5c'),_0x32dc('0x5d'),_0x32dc('0x5e'),'serverUrl',_0x32dc('0x5f')]})[_0x32dc('0x2c')](handleEntityNotFound(_0x4114b6,null))[_0x32dc('0x2c')](function(_0x3a8c6b){if(_0x3a8c6b){_0x18e402=_0x3a8c6b[_0x32dc('0x60')];_0x2f84dd=_0x3a8c6b[_0x32dc('0x5f')];_0x326c8f=_0x3a8c6b[_0x32dc('0x5d')];_0x4f534b=_0x3a8c6b['remoteUri'];var _0x3efe15=_0x4f534b['slice'](-0x1);if(_0x3efe15==='/'){_0x4f534b=_0x4f534b[_0x32dc('0x61')](0x0,_0x4f534b[_0x32dc('0x62')](_0x3efe15));}_0x17e837=util['format'](_0x32dc('0x63'),_0x4f534b);var _0x280fd4={'method':_0x32dc('0x64'),'uri':_0x17e837,'qs':{'operation':_0x32dc('0x65'),'username':_0x3a8c6b[_0x32dc('0x60')]},'json':!![]};return rp(_0x280fd4);}})[_0x32dc('0x2c')](function(_0x151680){if(_0x151680['success']){var _0x473869={'method':'POST','uri':_0x17e837,'form':{'operation':_0x32dc('0x66'),'username':_0x18e402,'accessKey':md5(_0x151680[_0x32dc('0x21')][_0x32dc('0x67')]+_0x2f84dd)},'json':!![]};return rp(_0x473869);}})[_0x32dc('0x2c')](function(_0x3c6c0a){if(_0x3c6c0a[_0x32dc('0x68')]){var _0x5b996e={'method':_0x32dc('0x64'),'uri':_0x17e837,'qs':{'operation':_0x32dc('0x69'),'username':_0x18e402,'sessionName':_0x3c6c0a[_0x32dc('0x21')][_0x32dc('0x6a')],'elementType':_0x326c8f},'json':!![]};return rp(_0x5b996e);}})[_0x32dc('0x2c')](function(_0x46e61c){if(_0x46e61c[_0x32dc('0x68')]){var _0x33d556=[_0x32dc('0x6b'),_0x32dc('0x6c'),'owner'];_['remove'](_0x46e61c['result'][_0x32dc('0x3b')],function(_0x240475){return _0x33d556[_0x32dc('0x6d')](_0x240475[_0x32dc('0x34')][_0x32dc('0x2f')]);});_[_0x32dc('0x6e')](_0x46e61c[_0x32dc('0x21')][_0x32dc('0x3b')],function(_0x12d9c7){return _0x12d9c7['editable']===_0x32dc('0x6f');});return{'count':_0x46e61c[_0x32dc('0x21')][_0x32dc('0x3b')][_0x32dc('0x49')],'rows':_['map'](_0x46e61c[_0x32dc('0x21')][_0x32dc('0x3b')],function(_0x136a9e){return{'id':_0x136a9e[_0x32dc('0x2f')],'name':_0x136a9e['label'],'custom':_[_0x32dc('0x70')](_0x136a9e[_0x32dc('0x2f')],'cf_')?!![]:![],'options':_0x136a9e['type'][_0x32dc('0x2f')]==='picklist'&&_0x136a9e['type'][_0x32dc('0x71')][_0x32dc('0x49')]>0x0?_[_0x32dc('0x31')](_0x136a9e[_0x32dc('0x34')][_0x32dc('0x71')],function(_0x108555){return{'name':_0x108555[_0x32dc('0x72')],'value':_0x108555['value']};}):[]};})};}})[_0x32dc('0x2c')](respondWithResult(_0x4114b6,null))[_0x32dc('0x46')](function(_0x16414a){console[_0x32dc('0x73')](_0x32dc('0x74')+_0x16414a);var _0x36add3=_0x5d289b[_0x32dc('0x37')]['test']?0x1f4:_0x16414a['statusCode']||0x1f4;logger['error'](_0x32dc('0x75'),_0x32dc('0x5b'),_0x36add3,JSON[_0x32dc('0x1d')](_0x16414a));delete _0x16414a[_0x32dc('0x2f')];if(_0x36add3===0x191){_0x36add3=0x190;}_0x4114b6[_0x32dc('0x23')](_0x36add3)[_0x32dc('0x76')](_0x5d289b[_0x32dc('0x37')][_0x32dc('0x77')]?{'message':_0x32dc('0x78'),'statusCode':_0x16414a[_0x32dc('0x79')]}:_0x16414a);});}; \ No newline at end of file +var _0xb84b=['findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','username','moduleName','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','reference','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations'];(function(_0x5d35d3,_0x580066){var _0x13cb11=function(_0x30849b){while(--_0x30849b){_0x5d35d3['push'](_0x5d35d3['shift']());}};_0x13cb11(++_0x580066);}(_0xb84b,0x1a2));var _0xbb84=function(_0xfcdbbb,_0xd75d65){_0xfcdbbb=_0xfcdbbb-0x0;var _0x42c6e1=_0xb84b[_0xfcdbbb];return _0x42c6e1;};'use strict';var pdf=require(_0xbb84('0x0'));var emlformat=require(_0xbb84('0x1'));var rimraf=require(_0xbb84('0x2'));var zipdir=require(_0xbb84('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb84('0x4'));var moment=require(_0xbb84('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbb84('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbb84('0x7'));var ejs=require(_0xbb84('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbb84('0x9'));var crypto=require('crypto');var jsforce=require(_0xbb84('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbb84('0x7'));var querystring=require(_0xbb84('0xb'));var Papa=require('papaparse');var Redis=require(_0xbb84('0xc'));var authService=require(_0xbb84('0xd'));var qs=require(_0xbb84('0xe'));var as=require(_0xbb84('0xf'));var hardwareService=require(_0xbb84('0x10'));var logger=require(_0xbb84('0x11'))('api');var utils=require(_0xbb84('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbb84('0x13'));var db=require(_0xbb84('0x14'))['db'];var integrations=require(_0xbb84('0x15'));var jayson=require(_0xbb84('0x16'));var client=jayson['client'][_0xbb84('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4bcb36,_0x4abcf6,_0x149c1d,_0x305618){return new BPromise(function(_0x94a983,_0xe6cf18){var _0x5afebf=_0x305618||client;return _0x5afebf[_0xbb84('0x18')](_0x4bcb36,_0x149c1d)[_0xbb84('0x19')](function(_0x41e28b){logger['info'](_0xbb84('0x1a'),_0x4abcf6,_0xbb84('0x1b'));logger['debug'](_0xbb84('0x1c'),_0x4abcf6,_0xbb84('0x1b'),JSON[_0xbb84('0x1d')](_0x41e28b));if(_0x41e28b[_0xbb84('0x1e')]){if(_0x41e28b['error'][_0xbb84('0x1f')]===0x1f4){logger[_0xbb84('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x4abcf6,_0x41e28b[_0xbb84('0x1e')][_0xbb84('0x20')]);return _0xe6cf18(_0x41e28b['error'][_0xbb84('0x20')]);}logger['error'](_0xbb84('0x1a'),_0x4abcf6,_0x41e28b[_0xbb84('0x1e')][_0xbb84('0x20')]);return _0x94a983(_0x41e28b['error']['message']);}else{logger[_0xbb84('0x21')](_0xbb84('0x1a'),_0x4abcf6,_0xbb84('0x1b'));_0x94a983(_0x41e28b[_0xbb84('0x22')][_0xbb84('0x20')]);}})[_0xbb84('0x23')](function(_0x3f9c48){logger[_0xbb84('0x1e')](_0xbb84('0x1a'),_0x4abcf6,_0x3f9c48);_0xe6cf18(_0x3f9c48);});});}function respondWithStatusCode(_0x17726f,_0x1fd546){_0x1fd546=_0x1fd546||0xcc;return function(_0x23a0a0){if(_0x23a0a0){return _0x17726f[_0xbb84('0x24')](_0x1fd546);}return _0x17726f[_0xbb84('0x25')](_0x1fd546)[_0xbb84('0x26')]();};}function respondWithResult(_0xe83f2a,_0xffaaef){_0xffaaef=_0xffaaef||0xc8;return function(_0x385261){if(_0x385261){return _0xe83f2a['status'](_0xffaaef)[_0xbb84('0x27')](_0x385261);}};}function respondWithFilteredResult(_0x3fc0c9,_0x5ccf42){return function(_0x227627){if(_0x227627){var _0x4a9e62=_0x227627[_0xbb84('0x28')],_0x420773=_0x5ccf42[_0xbb84('0x29')],_0x5506d0=_0x5ccf42[_0xbb84('0x29')]+_0x5ccf42[_0xbb84('0x2a')],_0x5e9973;if(_0x5506d0>=_0x4a9e62){_0x5506d0=_0x4a9e62;_0x5e9973=0xc8;}else{_0x5e9973=0xce;}_0x3fc0c9[_0xbb84('0x25')](_0x5e9973);return _0x3fc0c9[_0xbb84('0x2b')]('Content-Range',_0x420773+'-'+_0x5506d0+'/'+_0x4a9e62)[_0xbb84('0x27')](_0x227627);}return null;};}function patchUpdates(_0xf61953){return function(_0x515359){try{jsonpatch[_0xbb84('0x2c')](_0x515359,_0xf61953,!![]);}catch(_0x192e85){return BPromise[_0xbb84('0x2d')](_0x192e85);}return _0x515359[_0xbb84('0x2e')]();};}function saveUpdates(_0x3faaa4,_0x3545cc){return function(_0x5c105c){if(_0x5c105c){return _0x5c105c[_0xbb84('0x2f')](_0x3faaa4)[_0xbb84('0x19')](function(_0x531906){return _0x531906;});}return null;};}function removeEntity(_0x145146,_0x3a2abc){return function(_0x35a81d){if(_0x35a81d){return _0x35a81d[_0xbb84('0x30')]()[_0xbb84('0x19')](function(){_0x145146[_0xbb84('0x25')](0xcc)[_0xbb84('0x26')]();});}};}function handleEntityNotFound(_0x30d855,_0x51a15b){return function(_0x46d0b5){if(!_0x46d0b5){_0x30d855[_0xbb84('0x24')](0x194);}return _0x46d0b5;};}function handleError(_0x1fa5c3,_0x54287d){_0x54287d=_0x54287d||0x1f4;return function(_0x143b11){logger[_0xbb84('0x1e')](_0x143b11[_0xbb84('0x31')]);if(_0x143b11[_0xbb84('0x32')]){delete _0x143b11['name'];}_0x1fa5c3['status'](_0x54287d)[_0xbb84('0x33')](_0x143b11);};}exports[_0xbb84('0x34')]=function(_0x444d63,_0x23b5f9){var _0x58e7d={},_0xd4f90d={},_0x2a475d={'count':0x0,'rows':[]};var _0x2ca142=_[_0xbb84('0x35')](db[_0xbb84('0x36')][_0xbb84('0x37')],function(_0x39aa62){return{'name':_0x39aa62[_0xbb84('0x38')],'type':_0x39aa62[_0xbb84('0x39')][_0xbb84('0x3a')]};});_0xd4f90d[_0xbb84('0x3b')]=_[_0xbb84('0x35')](_0x2ca142,_0xbb84('0x32'));_0xd4f90d[_0xbb84('0x3c')]=_['keys'](_0x444d63['query']);_0xd4f90d[_0xbb84('0x3d')]=_[_0xbb84('0x3e')](_0xd4f90d['model'],_0xd4f90d['query']);_0x58e7d['attributes']=_[_0xbb84('0x3e')](_0xd4f90d[_0xbb84('0x3b')],qs['fields'](_0x444d63['query'][_0xbb84('0x3f')]));_0x58e7d[_0xbb84('0x40')]=_0x58e7d[_0xbb84('0x40')][_0xbb84('0x41')]?_0x58e7d[_0xbb84('0x40')]:_0xd4f90d['model'];if(!_0x444d63[_0xbb84('0x3c')][_0xbb84('0x42')](_0xbb84('0x43'))){_0x58e7d[_0xbb84('0x2a')]=qs[_0xbb84('0x2a')](_0x444d63[_0xbb84('0x3c')][_0xbb84('0x2a')]);_0x58e7d['offset']=qs[_0xbb84('0x29')](_0x444d63[_0xbb84('0x3c')][_0xbb84('0x29')]);}_0x58e7d[_0xbb84('0x44')]=qs[_0xbb84('0x45')](_0x444d63[_0xbb84('0x3c')][_0xbb84('0x45')]);_0x58e7d[_0xbb84('0x46')]=qs[_0xbb84('0x3d')](_['pick'](_0x444d63[_0xbb84('0x3c')],_0xd4f90d[_0xbb84('0x3d')]),_0x2ca142);if(_0x444d63[_0xbb84('0x3c')]['filter']){_0x58e7d[_0xbb84('0x46')]=_[_0xbb84('0x47')](_0x58e7d['where'],{'$or':_[_0xbb84('0x35')](_0x2ca142,function(_0x55cae1){if(_0x55cae1['type']!==_0xbb84('0x48')){var _0x13dc7b={};_0x13dc7b[_0x55cae1[_0xbb84('0x32')]]={'$like':'%'+_0x444d63[_0xbb84('0x3c')][_0xbb84('0x49')]+'%'};return _0x13dc7b;}})});}_0x58e7d=_['merge']({},_0x58e7d,_0x444d63[_0xbb84('0x4a')]);var _0x1b58c6={'where':_0x58e7d[_0xbb84('0x46')]};return db[_0xbb84('0x36')][_0xbb84('0x28')](_0x1b58c6)['then'](function(_0x4c47af){_0x2a475d[_0xbb84('0x28')]=_0x4c47af;if(_0x444d63[_0xbb84('0x3c')][_0xbb84('0x4b')]){_0x58e7d[_0xbb84('0x4c')]=[{'all':!![]}];}return db[_0xbb84('0x36')][_0xbb84('0x4d')](_0x58e7d);})[_0xbb84('0x19')](function(_0x51e8a0){_0x2a475d[_0xbb84('0x4e')]=_0x51e8a0;return _0x2a475d;})['then'](respondWithFilteredResult(_0x23b5f9,_0x58e7d))[_0xbb84('0x23')](handleError(_0x23b5f9,null));};exports[_0xbb84('0x4f')]=function(_0x36f897,_0x324c3b){var _0x42c680={'raw':![],'where':{'id':_0x36f897[_0xbb84('0x50')]['id']}},_0x1b1894={};_0x1b1894[_0xbb84('0x3b')]=_[_0xbb84('0x51')](db[_0xbb84('0x36')][_0xbb84('0x37')]);_0x1b1894[_0xbb84('0x3c')]=_[_0xbb84('0x51')](_0x36f897[_0xbb84('0x3c')]);_0x1b1894[_0xbb84('0x3d')]=_[_0xbb84('0x3e')](_0x1b1894[_0xbb84('0x3b')],_0x1b1894[_0xbb84('0x3c')]);_0x42c680[_0xbb84('0x40')]=_[_0xbb84('0x3e')](_0x1b1894[_0xbb84('0x3b')],qs['fields'](_0x36f897[_0xbb84('0x3c')][_0xbb84('0x3f')]));_0x42c680[_0xbb84('0x40')]=_0x42c680[_0xbb84('0x40')][_0xbb84('0x41')]?_0x42c680[_0xbb84('0x40')]:_0x1b1894['model'];if(_0x36f897[_0xbb84('0x3c')][_0xbb84('0x4b')]){_0x42c680[_0xbb84('0x4c')]=[{'all':!![]}];}_0x42c680=_[_0xbb84('0x47')]({},_0x42c680,_0x36f897[_0xbb84('0x4a')]);return db[_0xbb84('0x36')][_0xbb84('0x52')](_0x42c680)[_0xbb84('0x19')](handleEntityNotFound(_0x324c3b,null))['then'](respondWithResult(_0x324c3b,null))[_0xbb84('0x23')](handleError(_0x324c3b,null));};exports[_0xbb84('0x53')]=function(_0x553029,_0x37bfcc){return db[_0xbb84('0x36')][_0xbb84('0x53')](_0x553029[_0xbb84('0x54')],{})['then'](respondWithResult(_0x37bfcc,0xc9))[_0xbb84('0x23')](handleError(_0x37bfcc,null));};exports[_0xbb84('0x2f')]=function(_0x31b9dc,_0x37f3e9){if(_0x31b9dc['body']['id']){delete _0x31b9dc[_0xbb84('0x54')]['id'];}return db[_0xbb84('0x36')][_0xbb84('0x52')]({'where':{'id':_0x31b9dc[_0xbb84('0x50')]['id']}})[_0xbb84('0x19')](handleEntityNotFound(_0x37f3e9,null))[_0xbb84('0x19')](saveUpdates(_0x31b9dc[_0xbb84('0x54')],null))[_0xbb84('0x19')](respondWithResult(_0x37f3e9,null))[_0xbb84('0x23')](handleError(_0x37f3e9,null));};exports['destroy']=function(_0x3ce337,_0x5737a0){return db['VtigerAccount'][_0xbb84('0x52')]({'where':{'id':_0x3ce337[_0xbb84('0x50')]['id']}})['then'](handleEntityNotFound(_0x5737a0,null))[_0xbb84('0x19')](removeEntity(_0x5737a0,null))[_0xbb84('0x23')](handleError(_0x5737a0,null));};exports[_0xbb84('0x55')]=function(_0x5389ad,_0x14dfc1,_0x2de619){var _0x47fd8b={};var _0x58e539={};var _0x5140f9;var _0x3f4823;return db[_0xbb84('0x36')][_0xbb84('0x56')]({'where':{'id':_0x5389ad[_0xbb84('0x50')]['id']}})['then'](handleEntityNotFound(_0x14dfc1,null))[_0xbb84('0x19')](function(_0x489e26){if(_0x489e26){_0x5140f9=_0x489e26;_0x58e539[_0xbb84('0x3b')]=_['keys'](db[_0xbb84('0x57')][_0xbb84('0x37')]);_0x58e539[_0xbb84('0x3c')]=_[_0xbb84('0x51')](_0x5389ad[_0xbb84('0x3c')]);_0x58e539['filters']=_[_0xbb84('0x3e')](_0x58e539[_0xbb84('0x3b')],_0x58e539[_0xbb84('0x3c')]);_0x47fd8b[_0xbb84('0x40')]=_[_0xbb84('0x3e')](_0x58e539[_0xbb84('0x3b')],qs['fields'](_0x5389ad['query'][_0xbb84('0x3f')]));_0x47fd8b[_0xbb84('0x40')]=_0x47fd8b[_0xbb84('0x40')][_0xbb84('0x41')]?_0x47fd8b[_0xbb84('0x40')]:_0x58e539[_0xbb84('0x3b')];_0x47fd8b['order']=qs['sort'](_0x5389ad['query']['sort']);_0x47fd8b['where']=qs[_0xbb84('0x3d')](_['pick'](_0x5389ad[_0xbb84('0x3c')],_0x58e539[_0xbb84('0x3d')]));if(_0x5389ad[_0xbb84('0x3c')][_0xbb84('0x49')]){_0x47fd8b[_0xbb84('0x46')]=_[_0xbb84('0x47')](_0x47fd8b['where'],{'$or':_[_0xbb84('0x35')](_0x47fd8b['attributes'],function(_0x1a3178){var _0x35e14a={};_0x35e14a[_0x1a3178]={'$like':'%'+_0x5389ad[_0xbb84('0x3c')][_0xbb84('0x49')]+'%'};return _0x35e14a;})});}_0x47fd8b=_[_0xbb84('0x47')]({},_0x47fd8b,_0x5389ad['options']);return _0x5140f9[_0xbb84('0x55')](_0x47fd8b);}})[_0xbb84('0x19')](function(_0x4449a0){if(_0x4449a0){_0x3f4823=_0x4449a0[_0xbb84('0x41')];if(!_0x5389ad[_0xbb84('0x3c')]['hasOwnProperty'](_0xbb84('0x43'))){_0x47fd8b[_0xbb84('0x2a')]=qs['limit'](_0x5389ad[_0xbb84('0x3c')][_0xbb84('0x2a')]);_0x47fd8b[_0xbb84('0x29')]=qs['offset'](_0x5389ad[_0xbb84('0x3c')][_0xbb84('0x29')]);}return _0x5140f9[_0xbb84('0x55')](_0x47fd8b);}})[_0xbb84('0x19')](function(_0x1f7ab8){if(_0x1f7ab8){return _0x1f7ab8?{'count':_0x3f4823,'rows':_0x1f7ab8}:null;}})[_0xbb84('0x19')](respondWithResult(_0x14dfc1,null))[_0xbb84('0x23')](handleError(_0x14dfc1,null));};exports[_0xbb84('0x58')]=function(_0x59fcce,_0x4276ed,_0x64c16){if(_0x59fcce[_0xbb84('0x54')]['id']){delete _0x59fcce['body']['id'];}return db[_0xbb84('0x36')]['findOne']({'where':{'id':_0x59fcce[_0xbb84('0x50')]['id']}})[_0xbb84('0x19')](handleEntityNotFound(_0x4276ed,null))[_0xbb84('0x19')](function(_0x3795e9){if(_0x3795e9){_0x59fcce[_0xbb84('0x54')][_0xbb84('0x59')]=_0x3795e9['id'];_0x59fcce[_0xbb84('0x54')][_0xbb84('0x5a')]=integrations[_0xbb84('0x5b')](_0x59fcce[_0xbb84('0x54')][_0xbb84('0x5c')],_0x59fcce['body'][_0xbb84('0x39')]);_0x59fcce[_0xbb84('0x54')][_0xbb84('0x5d')]=integrations['getDescriptions'](_0x59fcce[_0xbb84('0x54')][_0xbb84('0x5c')],_0x59fcce[_0xbb84('0x54')][_0xbb84('0x39')]);return db[_0xbb84('0x57')][_0xbb84('0x53')](_0x59fcce['body'],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xbb84('0x5e')],'as':_0xbb84('0x5d')}]});}return null;})[_0xbb84('0x19')](respondWithResult(_0x4276ed,null))[_0xbb84('0x23')](handleError(_0x4276ed,null));};var md5=require(_0xbb84('0x5f'));exports['getFields']=function(_0x55a59f,_0x5bb6c8,_0x795737){var _0x4568df=null;var _0x2b4f6e=null;var _0x48ee74=null;var _0x2dc54d=null;var _0x4b57a1='';return db[_0xbb84('0x36')]['findOne']({'where':{'id':_0x55a59f['params']['id']},'attributes':['id',_0xbb84('0x32'),_0xbb84('0x60'),'description',_0xbb84('0x61'),'remoteUri','serverUrl',_0xbb84('0x62')]})[_0xbb84('0x19')](handleEntityNotFound(_0x5bb6c8,null))[_0xbb84('0x19')](function(_0x45f41b){if(_0x45f41b){_0x4568df=_0x45f41b[_0xbb84('0x60')];_0x2b4f6e=_0x45f41b[_0xbb84('0x62')];_0x48ee74=_0x45f41b['moduleName'];_0x4b57a1=_0x45f41b['remoteUri'];var _0x4da58e=_0x4b57a1[_0xbb84('0x63')](-0x1);if(_0x4da58e==='/'){_0x4b57a1=_0x4b57a1['substring'](0x0,_0x4b57a1[_0xbb84('0x64')](_0x4da58e));}_0x2dc54d=util[_0xbb84('0x65')](_0xbb84('0x66'),_0x4b57a1);var _0x8b684f={'method':_0xbb84('0x67'),'uri':_0x2dc54d,'qs':{'operation':_0xbb84('0x68'),'username':_0x45f41b['username']},'json':!![]};return rp(_0x8b684f);}})[_0xbb84('0x19')](function(_0xf8deb9){if(_0xf8deb9[_0xbb84('0x69')]){var _0x51af99={'method':_0xbb84('0x6a'),'uri':_0x2dc54d,'form':{'operation':_0xbb84('0x6b'),'username':_0x4568df,'accessKey':md5(_0xf8deb9[_0xbb84('0x22')][_0xbb84('0x6c')]+_0x2b4f6e)},'json':!![]};return rp(_0x51af99);}})['then'](function(_0x7a61fa){if(_0x7a61fa[_0xbb84('0x69')]){var _0x1361ea={'method':'GET','uri':_0x2dc54d,'qs':{'operation':_0xbb84('0x6d'),'username':_0x4568df,'sessionName':_0x7a61fa[_0xbb84('0x22')][_0xbb84('0x6e')],'elementType':_0x48ee74},'json':!![]};return rp(_0x1361ea);}})[_0xbb84('0x19')](function(_0x2cbb9a){if(_0x2cbb9a[_0xbb84('0x69')]){var _0xa8e673=['autogenerated',_0xbb84('0x6f'),'owner'];_['remove'](_0x2cbb9a['result'][_0xbb84('0x3f')],function(_0x5cde77){return _0xa8e673[_0xbb84('0x70')](_0x5cde77['type'][_0xbb84('0x32')]);});_['remove'](_0x2cbb9a[_0xbb84('0x22')][_0xbb84('0x3f')],function(_0x2dba44){return _0x2dba44[_0xbb84('0x71')]===_0xbb84('0x72');});return{'count':_0x2cbb9a[_0xbb84('0x22')][_0xbb84('0x3f')][_0xbb84('0x41')],'rows':_[_0xbb84('0x35')](_0x2cbb9a[_0xbb84('0x22')][_0xbb84('0x3f')],function(_0x51ef49){return{'id':_0x51ef49[_0xbb84('0x32')],'name':_0x51ef49[_0xbb84('0x73')],'custom':_[_0xbb84('0x74')](_0x51ef49['name'],_0xbb84('0x75'))?!![]:![],'options':_0x51ef49[_0xbb84('0x39')][_0xbb84('0x32')]===_0xbb84('0x76')&&_0x51ef49['type'][_0xbb84('0x77')][_0xbb84('0x41')]>0x0?_['map'](_0x51ef49[_0xbb84('0x39')]['picklistValues'],function(_0x2049df){return{'name':_0x2049df['label'],'value':_0x2049df['value']};}):[]};})};}})['then'](respondWithResult(_0x5bb6c8,null))[_0xbb84('0x23')](function(_0x1e4f00){console[_0xbb84('0x78')](_0xbb84('0x79')+_0x1e4f00);var _0x574682=_0x55a59f[_0xbb84('0x3c')][_0xbb84('0x7a')]?0x1f4:_0x1e4f00[_0xbb84('0x7b')]||0x1f4;logger['error'](_0xbb84('0x7c'),_0xbb84('0x7d'),_0x574682,JSON[_0xbb84('0x1d')](_0x1e4f00));delete _0x1e4f00['name'];if(_0x574682===0x191){_0x574682=0x190;}_0x5bb6c8[_0xbb84('0x25')](_0x574682)[_0xbb84('0x33')](_0x55a59f['query'][_0xbb84('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x1e4f00['statusCode']}:_0x1e4f00);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 862b632..91ec101 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 _0x51c4=['define','VtigerAccount','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x51c4,0x120));var _0x451c=function(_0x21e4cd,_0x53be40){_0x21e4cd=_0x21e4cd-0x0;var _0x524578=_0x51c4[_0x21e4cd];return _0x524578;};'use strict';var _=require(_0x451c('0x0'));var util=require(_0x451c('0x1'));var logger=require('../../config/logger')(_0x451c('0x2'));var moment=require(_0x451c('0x3'));var BPromise=require(_0x451c('0x4'));var rp=require(_0x451c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x451c('0x6'));var config=require(_0x451c('0x7'));var attributes=require(_0x451c('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x30c55b,_0x496778){return _0x30c55b[_0x451c('0x9')](_0x451c('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8656=['../../config/environment','./intVtigerAccount.attributes','exports','define','int_vtiger_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3e590d,_0x441a2){var _0x50244e=function(_0x1037cf){while(--_0x1037cf){_0x3e590d['push'](_0x3e590d['shift']());}};_0x50244e(++_0x441a2);}(_0x8656,0x185));var _0x6865=function(_0x3d8b1d,_0x1c0f88){_0x3d8b1d=_0x3d8b1d-0x0;var _0x2bb57a=_0x8656[_0x3d8b1d];return _0x2bb57a;};'use strict';var _=require(_0x6865('0x0'));var util=require('util');var logger=require(_0x6865('0x1'))(_0x6865('0x2'));var moment=require('moment');var BPromise=require(_0x6865('0x3'));var rp=require(_0x6865('0x4'));var fs=require('fs');var path=require(_0x6865('0x5'));var rimraf=require(_0x6865('0x6'));var config=require(_0x6865('0x7'));var attributes=require(_0x6865('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x6865('0x9')]=function(_0x752d5e,_0xeaf10){return _0x752d5e[_0x6865('0xa')]('VtigerAccount',attributes,{'tableName':_0x6865('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 97535ae..e376b09 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 _0xef8b=['limit','model','include','map','find','ShowVtigerAccount','catch','util','ioredis','../../mysqldb','../../config/utils','client','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes'];(function(_0x2bd362,_0x59526d){var _0x16263a=function(_0x5b74e6){while(--_0x5b74e6){_0x2bd362['push'](_0x2bd362['shift']());}};_0x16263a(++_0x59526d);}(_0xef8b,0x16f));var _0xbef8=function(_0xd580e2,_0x109182){_0xd580e2=_0xd580e2-0x0;var _0x4d955f=_0xef8b[_0xd580e2];return _0x4d955f;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbef8('0x1'));var db=require(_0xbef8('0x2'))['db'];var utils=require(_0xbef8('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbef8('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ba8c,_0x5e6fae,_0xf52509){return new BPromise(function(_0x56ca7c,_0x1a759e){return client[_0xbef8('0x5')](_0x18ba8c,_0xf52509)[_0xbef8('0x6')](function(_0x198211){logger['info'](_0xbef8('0x7'),_0x5e6fae,_0xbef8('0x8'));logger[_0xbef8('0x9')](_0xbef8('0xa'),_0x5e6fae,_0xbef8('0x8'),JSON['stringify'](_0x198211));if(_0x198211[_0xbef8('0xb')]){if(_0x198211[_0xbef8('0xb')][_0xbef8('0xc')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5e6fae,_0x198211['error'][_0xbef8('0xd')]);return _0x1a759e(_0x198211[_0xbef8('0xb')]['message']);}logger[_0xbef8('0xb')](_0xbef8('0x7'),_0x5e6fae,_0x198211[_0xbef8('0xb')][_0xbef8('0xd')]);return _0x56ca7c(_0x198211[_0xbef8('0xb')][_0xbef8('0xd')]);}else{logger[_0xbef8('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x5e6fae,'request\x20sent');_0x56ca7c(_0x198211[_0xbef8('0xf')][_0xbef8('0xd')]);}})['catch'](function(_0x58baa5){logger[_0xbef8('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x5e6fae,_0x58baa5);_0x1a759e(_0x58baa5);});});}exports[_0xbef8('0x10')]=function(_0x3594f6){var _0x14addb=this;return new Promise(function(_0x27fdd1,_0x1b8730){return db[_0xbef8('0x11')][_0xbef8('0x12')]({'raw':_0x3594f6['options']?_0x3594f6[_0xbef8('0x13')][_0xbef8('0x14')]===undefined?!![]:![]:!![],'where':_0x3594f6['options']?_0x3594f6[_0xbef8('0x13')][_0xbef8('0x15')]||null:null,'attributes':_0x3594f6['options']?_0x3594f6[_0xbef8('0x13')][_0xbef8('0x16')]||null:null,'limit':_0x3594f6[_0xbef8('0x13')]?_0x3594f6[_0xbef8('0x13')][_0xbef8('0x17')]||null:null,'include':_0x3594f6[_0xbef8('0x13')]?_0x3594f6[_0xbef8('0x13')]['include']?_['map'](_0x3594f6[_0xbef8('0x13')]['include'],function(_0x136a1d){return{'model':db[_0x136a1d[_0xbef8('0x18')]],'as':_0x136a1d['as'],'attributes':_0x136a1d['attributes'],'include':_0x136a1d[_0xbef8('0x19')]?_[_0xbef8('0x1a')](_0x136a1d[_0xbef8('0x19')],function(_0x5854e1){return{'model':db[_0x5854e1[_0xbef8('0x18')]],'as':_0x5854e1['as'],'attributes':_0x5854e1[_0xbef8('0x16')],'include':_0x5854e1['include']?_[_0xbef8('0x1a')](_0x5854e1[_0xbef8('0x19')],function(_0x50d9dd){return{'model':db[_0x50d9dd['model']],'as':_0x50d9dd['as'],'attributes':_0x50d9dd[_0xbef8('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c147d){logger[_0xbef8('0xe')](_0xbef8('0x10'),_0x3594f6);logger[_0xbef8('0x9')](_0xbef8('0x10'),_0x3594f6,JSON['stringify'](_0x2c147d));_0x27fdd1(_0x2c147d);})['catch'](function(_0x32722c){logger[_0xbef8('0xb')](_0xbef8('0x10'),_0x32722c[_0xbef8('0xd')],_0x3594f6);_0x1b8730(_0x14addb['error'](0x1f4,_0x32722c[_0xbef8('0xd')]));});});};exports['ShowVtigerAccount']=function(_0x206093){var _0xa13ca8=this;return new Promise(function(_0x4bce19,_0x2f80b9){return db[_0xbef8('0x11')][_0xbef8('0x1b')]({'raw':_0x206093[_0xbef8('0x13')]?_0x206093[_0xbef8('0x13')][_0xbef8('0x14')]===undefined?!![]:![]:!![],'where':_0x206093[_0xbef8('0x13')]?_0x206093[_0xbef8('0x13')][_0xbef8('0x15')]||null:null,'attributes':_0x206093['options']?_0x206093[_0xbef8('0x13')]['attributes']||null:null,'include':_0x206093['options']?_0x206093[_0xbef8('0x13')][_0xbef8('0x19')]?_[_0xbef8('0x1a')](_0x206093[_0xbef8('0x13')][_0xbef8('0x19')],function(_0x23c357){return{'model':db[_0x23c357[_0xbef8('0x18')]],'as':_0x23c357['as'],'attributes':_0x23c357[_0xbef8('0x16')],'include':_0x23c357['include']?_['map'](_0x23c357['include'],function(_0x5960e0){return{'model':db[_0x5960e0[_0xbef8('0x18')]],'as':_0x5960e0['as'],'attributes':_0x5960e0[_0xbef8('0x16')],'include':_0x5960e0[_0xbef8('0x19')]?_[_0xbef8('0x1a')](_0x5960e0[_0xbef8('0x19')],function(_0x5d5811){return{'model':db[_0x5d5811['model']],'as':_0x5d5811['as'],'attributes':_0x5d5811[_0xbef8('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x444eb5){logger['info'](_0xbef8('0x1c'),_0x206093);logger[_0xbef8('0x9')](_0xbef8('0x1c'),_0x206093,JSON['stringify'](_0x444eb5));_0x4bce19(_0x444eb5);})[_0xbef8('0x1d')](function(_0x3fd2dd){logger[_0xbef8('0xb')](_0xbef8('0x1c'),_0x3fd2dd[_0xbef8('0xd')],_0x206093);_0x2f80b9(_0xa13ca8[_0xbef8('0xb')](0x1f4,_0x3fd2dd[_0xbef8('0xd')]));});});}; \ No newline at end of file +var _0xa487=['debug','ShowVtigerAccount','VtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xa487,0x135));var _0x7a48=function(_0x51a2df,_0x1b15cf){_0x51a2df=_0x51a2df-0x0;var _0x30dc29=_0xa487[_0x51a2df];return _0x30dc29;};'use strict';var _=require(_0x7a48('0x0'));var util=require(_0x7a48('0x1'));var moment=require(_0x7a48('0x2'));var BPromise=require(_0x7a48('0x3'));var rs=require(_0x7a48('0x4'));var fs=require('fs');var Redis=require(_0x7a48('0x5'));var db=require(_0x7a48('0x6'))['db'];var utils=require(_0x7a48('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7a48('0x8'));var jayson=require(_0x7a48('0x9'));var client=jayson[_0x7a48('0xa')][_0x7a48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37b4fb,_0x7d3dc9,_0x13f2c5){return new BPromise(function(_0x2d9540,_0x446a7e){return client['request'](_0x37b4fb,_0x13f2c5)[_0x7a48('0xc')](function(_0x3eb0d){logger[_0x7a48('0xd')](_0x7a48('0xe'),_0x7d3dc9,'request\x20sent');logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x7d3dc9,_0x7a48('0xf'),JSON[_0x7a48('0x10')](_0x3eb0d));if(_0x3eb0d[_0x7a48('0x11')]){if(_0x3eb0d[_0x7a48('0x11')]['code']===0x1f4){logger[_0x7a48('0x11')](_0x7a48('0xe'),_0x7d3dc9,_0x3eb0d[_0x7a48('0x11')][_0x7a48('0x12')]);return _0x446a7e(_0x3eb0d[_0x7a48('0x11')][_0x7a48('0x12')]);}logger['error'](_0x7a48('0xe'),_0x7d3dc9,_0x3eb0d[_0x7a48('0x11')][_0x7a48('0x12')]);return _0x2d9540(_0x3eb0d[_0x7a48('0x11')][_0x7a48('0x12')]);}else{logger[_0x7a48('0xd')](_0x7a48('0xe'),_0x7d3dc9,'request\x20sent');_0x2d9540(_0x3eb0d[_0x7a48('0x13')][_0x7a48('0x12')]);}})[_0x7a48('0x14')](function(_0x685f27){logger[_0x7a48('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x7d3dc9,_0x685f27);_0x446a7e(_0x685f27);});});}exports[_0x7a48('0x15')]=function(_0x2368b6){var _0x1e05df=this;return new Promise(function(_0x360f38,_0x452492){return db['VtigerAccount'][_0x7a48('0x16')]({'raw':_0x2368b6[_0x7a48('0x17')]?_0x2368b6[_0x7a48('0x17')][_0x7a48('0x18')]===undefined?!![]:![]:!![],'where':_0x2368b6['options']?_0x2368b6[_0x7a48('0x17')][_0x7a48('0x19')]||null:null,'attributes':_0x2368b6[_0x7a48('0x17')]?_0x2368b6[_0x7a48('0x17')]['attributes']||null:null,'limit':_0x2368b6[_0x7a48('0x17')]?_0x2368b6['options'][_0x7a48('0x1a')]||null:null,'include':_0x2368b6[_0x7a48('0x17')]?_0x2368b6[_0x7a48('0x17')][_0x7a48('0x1b')]?_[_0x7a48('0x1c')](_0x2368b6['options']['include'],function(_0x5ef01c){return{'model':db[_0x5ef01c[_0x7a48('0x1d')]],'as':_0x5ef01c['as'],'attributes':_0x5ef01c[_0x7a48('0x1e')],'include':_0x5ef01c[_0x7a48('0x1b')]?_[_0x7a48('0x1c')](_0x5ef01c[_0x7a48('0x1b')],function(_0x5c094d){return{'model':db[_0x5c094d[_0x7a48('0x1d')]],'as':_0x5c094d['as'],'attributes':_0x5c094d['attributes'],'include':_0x5c094d[_0x7a48('0x1b')]?_[_0x7a48('0x1c')](_0x5c094d[_0x7a48('0x1b')],function(_0x59356b){return{'model':db[_0x59356b[_0x7a48('0x1d')]],'as':_0x59356b['as'],'attributes':_0x59356b[_0x7a48('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8c0f71){logger[_0x7a48('0xd')](_0x7a48('0x15'),_0x2368b6);logger[_0x7a48('0x1f')](_0x7a48('0x15'),_0x2368b6,JSON[_0x7a48('0x10')](_0x8c0f71));_0x360f38(_0x8c0f71);})[_0x7a48('0x14')](function(_0x86be02){logger[_0x7a48('0x11')](_0x7a48('0x15'),_0x86be02[_0x7a48('0x12')],_0x2368b6);_0x452492(_0x1e05df[_0x7a48('0x11')](0x1f4,_0x86be02[_0x7a48('0x12')]));});});};exports[_0x7a48('0x20')]=function(_0x6dd42e){var _0x30749b=this;return new Promise(function(_0x3b4178,_0x113518){return db[_0x7a48('0x21')]['find']({'raw':_0x6dd42e[_0x7a48('0x17')]?_0x6dd42e[_0x7a48('0x17')][_0x7a48('0x18')]===undefined?!![]:![]:!![],'where':_0x6dd42e[_0x7a48('0x17')]?_0x6dd42e[_0x7a48('0x17')][_0x7a48('0x19')]||null:null,'attributes':_0x6dd42e['options']?_0x6dd42e[_0x7a48('0x17')][_0x7a48('0x1e')]||null:null,'include':_0x6dd42e[_0x7a48('0x17')]?_0x6dd42e[_0x7a48('0x17')][_0x7a48('0x1b')]?_[_0x7a48('0x1c')](_0x6dd42e[_0x7a48('0x17')][_0x7a48('0x1b')],function(_0x588603){return{'model':db[_0x588603['model']],'as':_0x588603['as'],'attributes':_0x588603[_0x7a48('0x1e')],'include':_0x588603[_0x7a48('0x1b')]?_[_0x7a48('0x1c')](_0x588603[_0x7a48('0x1b')],function(_0x280d5d){return{'model':db[_0x280d5d[_0x7a48('0x1d')]],'as':_0x280d5d['as'],'attributes':_0x280d5d[_0x7a48('0x1e')],'include':_0x280d5d[_0x7a48('0x1b')]?_[_0x7a48('0x1c')](_0x280d5d[_0x7a48('0x1b')],function(_0x52623b){return{'model':db[_0x52623b[_0x7a48('0x1d')]],'as':_0x52623b['as'],'attributes':_0x52623b[_0x7a48('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a48('0xc')](function(_0x482900){logger[_0x7a48('0xd')](_0x7a48('0x20'),_0x6dd42e);logger[_0x7a48('0x1f')](_0x7a48('0x20'),_0x6dd42e,JSON[_0x7a48('0x10')](_0x482900));_0x3b4178(_0x482900);})[_0x7a48('0x14')](function(_0x21602b){logger[_0x7a48('0x11')](_0x7a48('0x20'),_0x21602b['message'],_0x6dd42e);_0x113518(_0x30749b[_0x7a48('0x11')](0x1f4,_0x21602b[_0x7a48('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 98d1336..2bf02f2 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 _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0xc2024b,_0x140ae8){var _0x178d9d=function(_0x1698bc){while(--_0x1698bc){_0xc2024b['push'](_0xc2024b['shift']());}};_0x178d9d(++_0x140ae8);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b166b,_0x2c8ba1){_0x3b166b=_0x3b166b-0x0;var _0x579602=_0xb10b[_0x3b166b];return _0x579602;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x513f27,_0x1cbc87){var _0xa316b7=function(_0x3b592d){while(--_0x3b592d){_0x513f27['push'](_0x513f27['shift']());}};_0xa316b7(++_0x1cbc87);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 87d0030..1d39ac0 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 _0xb585=['STRING','sequelize'];(function(_0x386c00,_0x1ba086){var _0x373a15=function(_0x12a3ef){while(--_0x12a3ef){_0x386c00['push'](_0x386c00['shift']());}};_0x373a15(++_0x1ba086);}(_0xb585,0xa9));var _0x5b58=function(_0x262782,_0x3665b9){_0x262782=_0x262782-0x0;var _0x476af4=_0xb585[_0x262782];return _0x476af4;};'use strict';var Sequelize=require(_0x5b58('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b58('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x257e=['exports','STRING'];(function(_0x309791,_0xecba97){var _0x45a86d=function(_0x29cd5c){while(--_0x29cd5c){_0x309791['push'](_0x309791['shift']());}};_0x45a86d(++_0xecba97);}(_0x257e,0x6a));var _0xe257=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x257e[_0x4c0622];return _0x1799d8;};'use strict';var Sequelize=require('sequelize');module[_0xe257('0x0')]={'name':{'type':Sequelize[_0xe257('0x1')]},'description':{'type':Sequelize[_0xe257('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8764d67..cdc1161 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 _0x0b3d=['type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','include','show','keys','fields','includeAll','find','create','body','update','params','getFields','findOne','VtigerField','pick','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','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/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','end','json','count','offset','limit','status','apply','reject','save','destroy','sendStatus','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName'];(function(_0x15dc4a,_0x37ac48){var _0x23c048=function(_0xf6d775){while(--_0xf6d775){_0x15dc4a['push'](_0x15dc4a['shift']());}};_0x23c048(++_0x37ac48);}(_0x0b3d,0x1e3));var _0xd0b3=function(_0x184abd,_0x3bf822){_0x184abd=_0x184abd-0x0;var _0x48e2e0=_0x0b3d[_0x184abd];return _0x48e2e0;};'use strict';var pdf=require(_0xd0b3('0x0'));var emlformat=require(_0xd0b3('0x1'));var rimraf=require(_0xd0b3('0x2'));var zipdir=require(_0xd0b3('0x3'));var jsonpatch=require(_0xd0b3('0x4'));var rp=require(_0xd0b3('0x5'));var moment=require(_0xd0b3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd0b3('0x7'));var util=require(_0xd0b3('0x8'));var path=require(_0xd0b3('0x9'));var sox=require(_0xd0b3('0xa'));var csv=require('to-csv');var ejs=require(_0xd0b3('0xb'));var fs=require('fs');var _=require(_0xd0b3('0xc'));var squel=require('squel');var crypto=require(_0xd0b3('0xd'));var jsforce=require(_0xd0b3('0xe'));var deskjs=require(_0xd0b3('0xf'));var toCsv=require(_0xd0b3('0x10'));var querystring=require(_0xd0b3('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd0b3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd0b3('0x13'));var hardwareService=require(_0xd0b3('0x14'));var logger=require('../../config/logger')(_0xd0b3('0x15'));var utils=require('../../config/utils');var config=require(_0xd0b3('0x16'));var licenseUtil=require(_0xd0b3('0x17'));var db=require(_0xd0b3('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd0b3('0x19')][_0xd0b3('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1a350b,_0x533760,_0x284410,_0x88f72e){return new BPromise(function(_0x2b083c,_0x1d1fd2){var _0x1b1747=_0x88f72e||client;return _0x1b1747[_0xd0b3('0x1b')](_0x1a350b,_0x284410)[_0xd0b3('0x1c')](function(_0x2a272e){logger[_0xd0b3('0x1d')](_0xd0b3('0x1e'),_0x533760,'request\x20sent');logger[_0xd0b3('0x1f')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x533760,_0xd0b3('0x20'),JSON[_0xd0b3('0x21')](_0x2a272e));if(_0x2a272e[_0xd0b3('0x22')]){if(_0x2a272e[_0xd0b3('0x22')][_0xd0b3('0x23')]===0x1f4){logger[_0xd0b3('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x533760,_0x2a272e[_0xd0b3('0x22')]['message']);return _0x1d1fd2(_0x2a272e[_0xd0b3('0x22')][_0xd0b3('0x24')]);}logger[_0xd0b3('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x533760,_0x2a272e[_0xd0b3('0x22')][_0xd0b3('0x24')]);return _0x2b083c(_0x2a272e[_0xd0b3('0x22')]['message']);}else{logger['info'](_0xd0b3('0x1e'),_0x533760,_0xd0b3('0x20'));_0x2b083c(_0x2a272e[_0xd0b3('0x25')][_0xd0b3('0x24')]);}})[_0xd0b3('0x26')](function(_0x16277d){logger[_0xd0b3('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x533760,_0x16277d);_0x1d1fd2(_0x16277d);});});}function respondWithStatusCode(_0x4bdf67,_0x1b8293){_0x1b8293=_0x1b8293||0xcc;return function(_0x3b7794){if(_0x3b7794){return _0x4bdf67['sendStatus'](_0x1b8293);}return _0x4bdf67['status'](_0x1b8293)[_0xd0b3('0x27')]();};}function respondWithResult(_0x5342a8,_0x26c55d){_0x26c55d=_0x26c55d||0xc8;return function(_0xe02e3e){if(_0xe02e3e){return _0x5342a8['status'](_0x26c55d)[_0xd0b3('0x28')](_0xe02e3e);}};}function respondWithFilteredResult(_0x50be46,_0x20a657){return function(_0x431bcc){if(_0x431bcc){var _0x22d513=_0x431bcc[_0xd0b3('0x29')],_0x422df6=_0x20a657['offset'],_0x3e44a5=_0x20a657[_0xd0b3('0x2a')]+_0x20a657[_0xd0b3('0x2b')],_0x206ef3;if(_0x3e44a5>=_0x22d513){_0x3e44a5=_0x22d513;_0x206ef3=0xc8;}else{_0x206ef3=0xce;}_0x50be46[_0xd0b3('0x2c')](_0x206ef3);return _0x50be46['set']('Content-Range',_0x422df6+'-'+_0x3e44a5+'/'+_0x22d513)[_0xd0b3('0x28')](_0x431bcc);}return null;};}function patchUpdates(_0x27766e){return function(_0x20ee10){try{jsonpatch[_0xd0b3('0x2d')](_0x20ee10,_0x27766e,!![]);}catch(_0x2af471){return BPromise[_0xd0b3('0x2e')](_0x2af471);}return _0x20ee10[_0xd0b3('0x2f')]();};}function saveUpdates(_0x4ed8d6,_0x587094){return function(_0x5ead2d){if(_0x5ead2d){return _0x5ead2d['update'](_0x4ed8d6)[_0xd0b3('0x1c')](function(_0x257e94){return _0x257e94;});}return null;};}function removeEntity(_0x1de705,_0x44a885){return function(_0x556858){if(_0x556858){return _0x556858[_0xd0b3('0x30')]()[_0xd0b3('0x1c')](function(){_0x1de705[_0xd0b3('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x295448,_0x4ed8d2){return function(_0x57bd99){if(!_0x57bd99){_0x295448[_0xd0b3('0x31')](0x194);}return _0x57bd99;};}function handleError(_0x42055e,_0x487a81){_0x487a81=_0x487a81||0x1f4;return function(_0x4b2677){logger[_0xd0b3('0x22')](_0x4b2677['stack']);if(_0x4b2677[_0xd0b3('0x32')]){delete _0x4b2677[_0xd0b3('0x32')];}_0x42055e[_0xd0b3('0x2c')](_0x487a81)[_0xd0b3('0x33')](_0x4b2677);};}exports[_0xd0b3('0x34')]=function(_0x3a44f9,_0x2e075){var _0x6cf36e={},_0x3de40d={},_0x5b9991={'count':0x0,'rows':[]};var _0x2649d1=_[_0xd0b3('0x35')](db[_0xd0b3('0x36')][_0xd0b3('0x37')],function(_0x398d4c){return{'name':_0x398d4c[_0xd0b3('0x38')],'type':_0x398d4c[_0xd0b3('0x39')][_0xd0b3('0x3a')]};});_0x3de40d[_0xd0b3('0x3b')]=_[_0xd0b3('0x35')](_0x2649d1,_0xd0b3('0x32'));_0x3de40d['query']=_['keys'](_0x3a44f9[_0xd0b3('0x3c')]);_0x3de40d[_0xd0b3('0x3d')]=_[_0xd0b3('0x3e')](_0x3de40d['model'],_0x3de40d[_0xd0b3('0x3c')]);_0x6cf36e[_0xd0b3('0x3f')]=_['intersection'](_0x3de40d[_0xd0b3('0x3b')],qs['fields'](_0x3a44f9[_0xd0b3('0x3c')]['fields']));_0x6cf36e[_0xd0b3('0x3f')]=_0x6cf36e[_0xd0b3('0x3f')][_0xd0b3('0x40')]?_0x6cf36e[_0xd0b3('0x3f')]:_0x3de40d[_0xd0b3('0x3b')];if(!_0x3a44f9['query'][_0xd0b3('0x41')]('nolimit')){_0x6cf36e[_0xd0b3('0x2b')]=qs[_0xd0b3('0x2b')](_0x3a44f9[_0xd0b3('0x3c')][_0xd0b3('0x2b')]);_0x6cf36e[_0xd0b3('0x2a')]=qs[_0xd0b3('0x2a')](_0x3a44f9['query'][_0xd0b3('0x2a')]);}_0x6cf36e[_0xd0b3('0x42')]=qs['sort'](_0x3a44f9['query'][_0xd0b3('0x43')]);_0x6cf36e['where']=qs[_0xd0b3('0x3d')](_['pick'](_0x3a44f9[_0xd0b3('0x3c')],_0x3de40d[_0xd0b3('0x3d')]),_0x2649d1);if(_0x3a44f9[_0xd0b3('0x3c')][_0xd0b3('0x44')]){_0x6cf36e['where']=_[_0xd0b3('0x45')](_0x6cf36e[_0xd0b3('0x46')],{'$or':_['map'](_0x2649d1,function(_0x3a42fe){if(_0x3a42fe['type']!==_0xd0b3('0x47')){var _0x116922={};_0x116922[_0x3a42fe[_0xd0b3('0x32')]]={'$like':'%'+_0x3a44f9[_0xd0b3('0x3c')][_0xd0b3('0x44')]+'%'};return _0x116922;}})});}_0x6cf36e=_['merge']({},_0x6cf36e,_0x3a44f9[_0xd0b3('0x48')]);var _0x285171={'where':_0x6cf36e[_0xd0b3('0x46')]};return db['VtigerConfiguration'][_0xd0b3('0x29')](_0x285171)[_0xd0b3('0x1c')](function(_0x116d1a){_0x5b9991['count']=_0x116d1a;if(_0x3a44f9[_0xd0b3('0x3c')]['includeAll']){_0x6cf36e[_0xd0b3('0x49')]=[{'all':!![]}];}return db[_0xd0b3('0x36')]['findAll'](_0x6cf36e);})['then'](function(_0x5002e4){_0x5b9991['rows']=_0x5002e4;return _0x5b9991;})['then'](respondWithFilteredResult(_0x2e075,_0x6cf36e))[_0xd0b3('0x26')](handleError(_0x2e075,null));};exports[_0xd0b3('0x4a')]=function(_0x4db6d0,_0x44f1ec){var _0x272262={'raw':![],'where':{'id':_0x4db6d0['params']['id']}},_0x1febea={};_0x1febea[_0xd0b3('0x3b')]=_[_0xd0b3('0x4b')](db['VtigerConfiguration'][_0xd0b3('0x37')]);_0x1febea[_0xd0b3('0x3c')]=_[_0xd0b3('0x4b')](_0x4db6d0[_0xd0b3('0x3c')]);_0x1febea['filters']=_[_0xd0b3('0x3e')](_0x1febea[_0xd0b3('0x3b')],_0x1febea[_0xd0b3('0x3c')]);_0x272262[_0xd0b3('0x3f')]=_[_0xd0b3('0x3e')](_0x1febea[_0xd0b3('0x3b')],qs[_0xd0b3('0x4c')](_0x4db6d0[_0xd0b3('0x3c')]['fields']));_0x272262[_0xd0b3('0x3f')]=_0x272262['attributes'][_0xd0b3('0x40')]?_0x272262[_0xd0b3('0x3f')]:_0x1febea[_0xd0b3('0x3b')];if(_0x4db6d0[_0xd0b3('0x3c')][_0xd0b3('0x4d')]){_0x272262[_0xd0b3('0x49')]=[{'all':!![]}];}_0x272262=_['merge']({},_0x272262,_0x4db6d0[_0xd0b3('0x48')]);return db[_0xd0b3('0x36')][_0xd0b3('0x4e')](_0x272262)[_0xd0b3('0x1c')](handleEntityNotFound(_0x44f1ec,null))[_0xd0b3('0x1c')](respondWithResult(_0x44f1ec,null))[_0xd0b3('0x26')](handleError(_0x44f1ec,null));};exports[_0xd0b3('0x4f')]=function(_0x4a7de9,_0xbcb27a){return db['VtigerConfiguration'][_0xd0b3('0x4f')](_0x4a7de9[_0xd0b3('0x50')],{})[_0xd0b3('0x1c')](respondWithResult(_0xbcb27a,0xc9))['catch'](handleError(_0xbcb27a,null));};exports[_0xd0b3('0x51')]=function(_0xa2489a,_0x4bb3b4){if(_0xa2489a[_0xd0b3('0x50')]['id']){delete _0xa2489a[_0xd0b3('0x50')]['id'];}return db[_0xd0b3('0x36')][_0xd0b3('0x4e')]({'where':{'id':_0xa2489a[_0xd0b3('0x52')]['id']}})[_0xd0b3('0x1c')](handleEntityNotFound(_0x4bb3b4,null))[_0xd0b3('0x1c')](saveUpdates(_0xa2489a['body'],null))[_0xd0b3('0x1c')](respondWithResult(_0x4bb3b4,null))[_0xd0b3('0x26')](handleError(_0x4bb3b4,null));};exports['destroy']=function(_0x4fe4a7,_0x5523cf){return db[_0xd0b3('0x36')][_0xd0b3('0x4e')]({'where':{'id':_0x4fe4a7[_0xd0b3('0x52')]['id']}})[_0xd0b3('0x1c')](handleEntityNotFound(_0x5523cf,null))[_0xd0b3('0x1c')](removeEntity(_0x5523cf,null))[_0xd0b3('0x26')](handleError(_0x5523cf,null));};exports[_0xd0b3('0x53')]=function(_0x182839,_0x21a500,_0x5c9804){var _0x35766e={};var _0x50f881={};var _0x277f0e;var _0x1ae35c;return db['VtigerConfiguration'][_0xd0b3('0x54')]({'where':{'id':_0x182839[_0xd0b3('0x52')]['id']}})[_0xd0b3('0x1c')](handleEntityNotFound(_0x21a500,null))[_0xd0b3('0x1c')](function(_0x54e563){if(_0x54e563){_0x277f0e=_0x54e563;_0x50f881[_0xd0b3('0x3b')]=_[_0xd0b3('0x4b')](db[_0xd0b3('0x55')]['rawAttributes']);_0x50f881['query']=_['keys'](_0x182839[_0xd0b3('0x3c')]);_0x50f881['filters']=_[_0xd0b3('0x3e')](_0x50f881[_0xd0b3('0x3b')],_0x50f881['query']);_0x35766e[_0xd0b3('0x3f')]=_[_0xd0b3('0x3e')](_0x50f881['model'],qs[_0xd0b3('0x4c')](_0x182839[_0xd0b3('0x3c')][_0xd0b3('0x4c')]));_0x35766e['attributes']=_0x35766e['attributes'][_0xd0b3('0x40')]?_0x35766e['attributes']:_0x50f881[_0xd0b3('0x3b')];_0x35766e[_0xd0b3('0x42')]=qs[_0xd0b3('0x43')](_0x182839['query']['sort']);_0x35766e[_0xd0b3('0x46')]=qs[_0xd0b3('0x3d')](_[_0xd0b3('0x56')](_0x182839['query'],_0x50f881[_0xd0b3('0x3d')]));if(_0x182839['query'][_0xd0b3('0x44')]){_0x35766e[_0xd0b3('0x46')]=_[_0xd0b3('0x45')](_0x35766e[_0xd0b3('0x46')],{'$or':_[_0xd0b3('0x35')](_0x35766e['attributes'],function(_0x3b8e9c){var _0x4935b8={};_0x4935b8[_0x3b8e9c]={'$like':'%'+_0x182839[_0xd0b3('0x3c')][_0xd0b3('0x44')]+'%'};return _0x4935b8;})});}_0x35766e=_[_0xd0b3('0x45')]({},_0x35766e,_0x182839['options']);return _0x277f0e[_0xd0b3('0x53')](_0x35766e);}})[_0xd0b3('0x1c')](function(_0x3bfc78){if(_0x3bfc78){_0x1ae35c=_0x3bfc78[_0xd0b3('0x40')];if(!_0x182839[_0xd0b3('0x3c')][_0xd0b3('0x41')](_0xd0b3('0x57'))){_0x35766e[_0xd0b3('0x2b')]=qs['limit'](_0x182839[_0xd0b3('0x3c')][_0xd0b3('0x2b')]);_0x35766e[_0xd0b3('0x2a')]=qs['offset'](_0x182839[_0xd0b3('0x3c')][_0xd0b3('0x2a')]);}return _0x277f0e[_0xd0b3('0x53')](_0x35766e);}})['then'](function(_0x5ab12a){if(_0x5ab12a){return _0x5ab12a?{'count':_0x1ae35c,'rows':_0x5ab12a}:null;}})['then'](respondWithResult(_0x21a500,null))[_0xd0b3('0x26')](handleError(_0x21a500,null));};exports[_0xd0b3('0x58')]=function(_0x5c51cf,_0x500160,_0x7a4138){var _0x4b3acf={};var _0x196fa9={};var _0x5c4a8f;var _0x26095e;return db[_0xd0b3('0x36')][_0xd0b3('0x54')]({'where':{'id':_0x5c51cf[_0xd0b3('0x52')]['id']}})[_0xd0b3('0x1c')](handleEntityNotFound(_0x500160,null))[_0xd0b3('0x1c')](function(_0x12136e){if(_0x12136e){_0x5c4a8f=_0x12136e;_0x196fa9[_0xd0b3('0x3b')]=_[_0xd0b3('0x4b')](db[_0xd0b3('0x55')][_0xd0b3('0x37')]);_0x196fa9[_0xd0b3('0x3c')]=_[_0xd0b3('0x4b')](_0x5c51cf[_0xd0b3('0x3c')]);_0x196fa9['filters']=_['intersection'](_0x196fa9[_0xd0b3('0x3b')],_0x196fa9[_0xd0b3('0x3c')]);_0x4b3acf['attributes']=_[_0xd0b3('0x3e')](_0x196fa9[_0xd0b3('0x3b')],qs[_0xd0b3('0x4c')](_0x5c51cf[_0xd0b3('0x3c')][_0xd0b3('0x4c')]));_0x4b3acf[_0xd0b3('0x3f')]=_0x4b3acf[_0xd0b3('0x3f')][_0xd0b3('0x40')]?_0x4b3acf[_0xd0b3('0x3f')]:_0x196fa9['model'];_0x4b3acf[_0xd0b3('0x42')]=qs[_0xd0b3('0x43')](_0x5c51cf[_0xd0b3('0x3c')][_0xd0b3('0x43')]);_0x4b3acf[_0xd0b3('0x46')]=qs['filters'](_[_0xd0b3('0x56')](_0x5c51cf[_0xd0b3('0x3c')],_0x196fa9[_0xd0b3('0x3d')]));if(_0x5c51cf[_0xd0b3('0x3c')][_0xd0b3('0x44')]){_0x4b3acf[_0xd0b3('0x46')]=_['merge'](_0x4b3acf[_0xd0b3('0x46')],{'$or':_[_0xd0b3('0x35')](_0x4b3acf['attributes'],function(_0x375fac){var _0x6f24eb={};_0x6f24eb[_0x375fac]={'$like':'%'+_0x5c51cf[_0xd0b3('0x3c')]['filter']+'%'};return _0x6f24eb;})});}_0x4b3acf=_[_0xd0b3('0x45')]({},_0x4b3acf,_0x5c51cf[_0xd0b3('0x48')]);return _0x5c4a8f['getSubjects'](_0x4b3acf);}})['then'](function(_0x1d702d){if(_0x1d702d){_0x26095e=_0x1d702d['length'];if(!_0x5c51cf[_0xd0b3('0x3c')][_0xd0b3('0x41')](_0xd0b3('0x57'))){_0x4b3acf[_0xd0b3('0x2b')]=qs['limit'](_0x5c51cf[_0xd0b3('0x3c')][_0xd0b3('0x2b')]);_0x4b3acf[_0xd0b3('0x2a')]=qs[_0xd0b3('0x2a')](_0x5c51cf[_0xd0b3('0x3c')][_0xd0b3('0x2a')]);}return _0x5c4a8f['getSubjects'](_0x4b3acf);}})[_0xd0b3('0x1c')](function(_0x5236c0){if(_0x5236c0){return _0x5236c0?{'count':_0x26095e,'rows':_0x5236c0}:null;}})[_0xd0b3('0x1c')](respondWithResult(_0x500160,null))[_0xd0b3('0x26')](handleError(_0x500160,null));};exports[_0xd0b3('0x59')]=function(_0x481398,_0x49d14f,_0x42e610){var _0x38ca9d={};var _0x3a354c={};var _0x457260;var _0x2312fe;return db['VtigerConfiguration'][_0xd0b3('0x54')]({'where':{'id':_0x481398[_0xd0b3('0x52')]['id']}})[_0xd0b3('0x1c')](handleEntityNotFound(_0x49d14f,null))[_0xd0b3('0x1c')](function(_0x396de3){if(_0x396de3){_0x457260=_0x396de3;_0x3a354c[_0xd0b3('0x3b')]=_['keys'](db[_0xd0b3('0x55')][_0xd0b3('0x37')]);_0x3a354c[_0xd0b3('0x3c')]=_[_0xd0b3('0x4b')](_0x481398[_0xd0b3('0x3c')]);_0x3a354c[_0xd0b3('0x3d')]=_[_0xd0b3('0x3e')](_0x3a354c['model'],_0x3a354c[_0xd0b3('0x3c')]);_0x38ca9d[_0xd0b3('0x3f')]=_[_0xd0b3('0x3e')](_0x3a354c[_0xd0b3('0x3b')],qs[_0xd0b3('0x4c')](_0x481398['query'][_0xd0b3('0x4c')]));_0x38ca9d[_0xd0b3('0x3f')]=_0x38ca9d['attributes'][_0xd0b3('0x40')]?_0x38ca9d[_0xd0b3('0x3f')]:_0x3a354c['model'];_0x38ca9d['order']=qs[_0xd0b3('0x43')](_0x481398[_0xd0b3('0x3c')][_0xd0b3('0x43')]);_0x38ca9d[_0xd0b3('0x46')]=qs['filters'](_[_0xd0b3('0x56')](_0x481398[_0xd0b3('0x3c')],_0x3a354c[_0xd0b3('0x3d')]));if(_0x481398['query'][_0xd0b3('0x44')]){_0x38ca9d[_0xd0b3('0x46')]=_['merge'](_0x38ca9d[_0xd0b3('0x46')],{'$or':_['map'](_0x38ca9d[_0xd0b3('0x3f')],function(_0x499de8){var _0x70d4cd={};_0x70d4cd[_0x499de8]={'$like':'%'+_0x481398['query'][_0xd0b3('0x44')]+'%'};return _0x70d4cd;})});}_0x38ca9d=_['merge']({},_0x38ca9d,_0x481398[_0xd0b3('0x48')]);return _0x457260[_0xd0b3('0x59')](_0x38ca9d);}})['then'](function(_0x9708a7){if(_0x9708a7){_0x2312fe=_0x9708a7[_0xd0b3('0x40')];if(!_0x481398[_0xd0b3('0x3c')]['hasOwnProperty'](_0xd0b3('0x57'))){_0x38ca9d[_0xd0b3('0x2b')]=qs[_0xd0b3('0x2b')](_0x481398[_0xd0b3('0x3c')][_0xd0b3('0x2b')]);_0x38ca9d[_0xd0b3('0x2a')]=qs[_0xd0b3('0x2a')](_0x481398[_0xd0b3('0x3c')][_0xd0b3('0x2a')]);}return _0x457260[_0xd0b3('0x59')](_0x38ca9d);}})[_0xd0b3('0x1c')](function(_0x7c99f){if(_0x7c99f){return _0x7c99f?{'count':_0x2312fe,'rows':_0x7c99f}:null;}})[_0xd0b3('0x1c')](respondWithResult(_0x49d14f,null))[_0xd0b3('0x26')](handleError(_0x49d14f,null));}; \ No newline at end of file +var _0xf036=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','map','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1837f6,_0x2daff9){var _0x487418=function(_0x1a25ec){while(--_0x1a25ec){_0x1837f6['push'](_0x1837f6['shift']());}};_0x487418(++_0x2daff9);}(_0xf036,0x174));var _0x6f03=function(_0x4065eb,_0x9f4169){_0x4065eb=_0x4065eb-0x0;var _0xe695c1=_0xf036[_0x4065eb];return _0xe695c1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6f03('0x0'));var rimraf=require(_0x6f03('0x1'));var zipdir=require(_0x6f03('0x2'));var jsonpatch=require(_0x6f03('0x3'));var rp=require(_0x6f03('0x4'));var moment=require('moment');var BPromise=require(_0x6f03('0x5'));var Mustache=require(_0x6f03('0x6'));var util=require(_0x6f03('0x7'));var path=require(_0x6f03('0x8'));var sox=require(_0x6f03('0x9'));var csv=require(_0x6f03('0xa'));var ejs=require(_0x6f03('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f03('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f03('0xd'));var deskjs=require(_0x6f03('0xe'));var toCsv=require(_0x6f03('0xa'));var querystring=require(_0x6f03('0xf'));var Papa=require(_0x6f03('0x10'));var Redis=require(_0x6f03('0x11'));var authService=require(_0x6f03('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6f03('0x13'));var hardwareService=require(_0x6f03('0x14'));var logger=require(_0x6f03('0x15'))(_0x6f03('0x16'));var utils=require(_0x6f03('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f03('0x18'))['db'];var jayson=require(_0x6f03('0x19'));var client=jayson[_0x6f03('0x1a')][_0x6f03('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5732bc,_0x3954ed,_0x2d62d8,_0x5c4579){return new BPromise(function(_0xae8102,_0x238c82){var _0xcf65aa=_0x5c4579||client;return _0xcf65aa[_0x6f03('0x1c')](_0x5732bc,_0x2d62d8)[_0x6f03('0x1d')](function(_0x1fac75){logger['info'](_0x6f03('0x1e'),_0x3954ed,_0x6f03('0x1f'));logger[_0x6f03('0x20')](_0x6f03('0x21'),_0x3954ed,_0x6f03('0x1f'),JSON[_0x6f03('0x22')](_0x1fac75));if(_0x1fac75[_0x6f03('0x23')]){if(_0x1fac75[_0x6f03('0x23')][_0x6f03('0x24')]===0x1f4){logger[_0x6f03('0x23')](_0x6f03('0x1e'),_0x3954ed,_0x1fac75[_0x6f03('0x23')][_0x6f03('0x25')]);return _0x238c82(_0x1fac75[_0x6f03('0x23')][_0x6f03('0x25')]);}logger[_0x6f03('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x3954ed,_0x1fac75[_0x6f03('0x23')]['message']);return _0xae8102(_0x1fac75[_0x6f03('0x23')]['message']);}else{logger[_0x6f03('0x26')](_0x6f03('0x1e'),_0x3954ed,_0x6f03('0x1f'));_0xae8102(_0x1fac75['result'][_0x6f03('0x25')]);}})[_0x6f03('0x27')](function(_0xa668f2){logger[_0x6f03('0x23')](_0x6f03('0x1e'),_0x3954ed,_0xa668f2);_0x238c82(_0xa668f2);});});}function respondWithStatusCode(_0x458bdc,_0xf4bb55){_0xf4bb55=_0xf4bb55||0xcc;return function(_0x1fa39b){if(_0x1fa39b){return _0x458bdc[_0x6f03('0x28')](_0xf4bb55);}return _0x458bdc['status'](_0xf4bb55)[_0x6f03('0x29')]();};}function respondWithResult(_0x3694c6,_0x12f84a){_0x12f84a=_0x12f84a||0xc8;return function(_0x1c9584){if(_0x1c9584){return _0x3694c6[_0x6f03('0x2a')](_0x12f84a)['json'](_0x1c9584);}};}function respondWithFilteredResult(_0x5a7735,_0x5f071f){return function(_0x92f319){if(_0x92f319){var _0x425dbb=_0x92f319[_0x6f03('0x2b')],_0x1af00b=_0x5f071f[_0x6f03('0x2c')],_0x4ab8b5=_0x5f071f[_0x6f03('0x2c')]+_0x5f071f[_0x6f03('0x2d')],_0x5c0857;if(_0x4ab8b5>=_0x425dbb){_0x4ab8b5=_0x425dbb;_0x5c0857=0xc8;}else{_0x5c0857=0xce;}_0x5a7735[_0x6f03('0x2a')](_0x5c0857);return _0x5a7735[_0x6f03('0x2e')](_0x6f03('0x2f'),_0x1af00b+'-'+_0x4ab8b5+'/'+_0x425dbb)[_0x6f03('0x30')](_0x92f319);}return null;};}function patchUpdates(_0x13361c){return function(_0x309259){try{jsonpatch[_0x6f03('0x31')](_0x309259,_0x13361c,!![]);}catch(_0x2192fa){return BPromise[_0x6f03('0x32')](_0x2192fa);}return _0x309259[_0x6f03('0x33')]();};}function saveUpdates(_0x21811b,_0x5f5c93){return function(_0x1dfea8){if(_0x1dfea8){return _0x1dfea8[_0x6f03('0x34')](_0x21811b)[_0x6f03('0x1d')](function(_0x55d433){return _0x55d433;});}return null;};}function removeEntity(_0x441db0,_0x4d079f){return function(_0xf82f07){if(_0xf82f07){return _0xf82f07[_0x6f03('0x35')]()[_0x6f03('0x1d')](function(){_0x441db0[_0x6f03('0x2a')](0xcc)[_0x6f03('0x29')]();});}};}function handleEntityNotFound(_0x18084e,_0x149782){return function(_0x52915a){if(!_0x52915a){_0x18084e['sendStatus'](0x194);}return _0x52915a;};}function handleError(_0x11ae27,_0x8385c9){_0x8385c9=_0x8385c9||0x1f4;return function(_0x170ef2){logger['error'](_0x170ef2['stack']);if(_0x170ef2[_0x6f03('0x36')]){delete _0x170ef2[_0x6f03('0x36')];}_0x11ae27['status'](_0x8385c9)[_0x6f03('0x37')](_0x170ef2);};}exports[_0x6f03('0x38')]=function(_0x27550a,_0x3bb769){var _0x241207={},_0x161079={},_0x15971d={'count':0x0,'rows':[]};var _0x2729d3=_['map'](db[_0x6f03('0x39')][_0x6f03('0x3a')],function(_0x50ed60){return{'name':_0x50ed60[_0x6f03('0x3b')],'type':_0x50ed60[_0x6f03('0x3c')]['key']};});_0x161079['model']=_[_0x6f03('0x3d')](_0x2729d3,_0x6f03('0x36'));_0x161079['query']=_[_0x6f03('0x3e')](_0x27550a[_0x6f03('0x3f')]);_0x161079[_0x6f03('0x40')]=_['intersection'](_0x161079['model'],_0x161079['query']);_0x241207[_0x6f03('0x41')]=_[_0x6f03('0x42')](_0x161079[_0x6f03('0x43')],qs[_0x6f03('0x44')](_0x27550a[_0x6f03('0x3f')]['fields']));_0x241207['attributes']=_0x241207[_0x6f03('0x41')][_0x6f03('0x45')]?_0x241207[_0x6f03('0x41')]:_0x161079[_0x6f03('0x43')];if(!_0x27550a[_0x6f03('0x3f')][_0x6f03('0x46')](_0x6f03('0x47'))){_0x241207[_0x6f03('0x2d')]=qs[_0x6f03('0x2d')](_0x27550a[_0x6f03('0x3f')][_0x6f03('0x2d')]);_0x241207[_0x6f03('0x2c')]=qs[_0x6f03('0x2c')](_0x27550a[_0x6f03('0x3f')]['offset']);}_0x241207['order']=qs['sort'](_0x27550a[_0x6f03('0x3f')][_0x6f03('0x48')]);_0x241207[_0x6f03('0x49')]=qs[_0x6f03('0x40')](_[_0x6f03('0x4a')](_0x27550a[_0x6f03('0x3f')],_0x161079[_0x6f03('0x40')]),_0x2729d3);if(_0x27550a['query'][_0x6f03('0x4b')]){_0x241207[_0x6f03('0x49')]=_[_0x6f03('0x4c')](_0x241207[_0x6f03('0x49')],{'$or':_[_0x6f03('0x3d')](_0x2729d3,function(_0x2e5e08){if(_0x2e5e08[_0x6f03('0x3c')]!==_0x6f03('0x4d')){var _0x2adab4={};_0x2adab4[_0x2e5e08[_0x6f03('0x36')]]={'$like':'%'+_0x27550a['query'][_0x6f03('0x4b')]+'%'};return _0x2adab4;}})});}_0x241207=_[_0x6f03('0x4c')]({},_0x241207,_0x27550a[_0x6f03('0x4e')]);var _0x5d9a0c={'where':_0x241207[_0x6f03('0x49')]};return db[_0x6f03('0x39')][_0x6f03('0x2b')](_0x5d9a0c)[_0x6f03('0x1d')](function(_0x4144d1){_0x15971d[_0x6f03('0x2b')]=_0x4144d1;if(_0x27550a[_0x6f03('0x3f')][_0x6f03('0x4f')]){_0x241207[_0x6f03('0x50')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x6f03('0x51')](_0x241207);})['then'](function(_0x2f2a23){_0x15971d[_0x6f03('0x52')]=_0x2f2a23;return _0x15971d;})[_0x6f03('0x1d')](respondWithFilteredResult(_0x3bb769,_0x241207))[_0x6f03('0x27')](handleError(_0x3bb769,null));};exports[_0x6f03('0x53')]=function(_0x103134,_0x212846){var _0x468a75={'raw':![],'where':{'id':_0x103134[_0x6f03('0x54')]['id']}},_0x104c74={};_0x104c74[_0x6f03('0x43')]=_[_0x6f03('0x3e')](db[_0x6f03('0x39')][_0x6f03('0x3a')]);_0x104c74[_0x6f03('0x3f')]=_[_0x6f03('0x3e')](_0x103134['query']);_0x104c74[_0x6f03('0x40')]=_[_0x6f03('0x42')](_0x104c74[_0x6f03('0x43')],_0x104c74[_0x6f03('0x3f')]);_0x468a75['attributes']=_[_0x6f03('0x42')](_0x104c74[_0x6f03('0x43')],qs[_0x6f03('0x44')](_0x103134[_0x6f03('0x3f')][_0x6f03('0x44')]));_0x468a75[_0x6f03('0x41')]=_0x468a75[_0x6f03('0x41')][_0x6f03('0x45')]?_0x468a75[_0x6f03('0x41')]:_0x104c74[_0x6f03('0x43')];if(_0x103134['query'][_0x6f03('0x4f')]){_0x468a75[_0x6f03('0x50')]=[{'all':!![]}];}_0x468a75=_[_0x6f03('0x4c')]({},_0x468a75,_0x103134[_0x6f03('0x4e')]);return db[_0x6f03('0x39')]['find'](_0x468a75)['then'](handleEntityNotFound(_0x212846,null))[_0x6f03('0x1d')](respondWithResult(_0x212846,null))[_0x6f03('0x27')](handleError(_0x212846,null));};exports[_0x6f03('0x55')]=function(_0xccb399,_0x133592){return db[_0x6f03('0x39')][_0x6f03('0x55')](_0xccb399[_0x6f03('0x56')],{})[_0x6f03('0x1d')](respondWithResult(_0x133592,0xc9))[_0x6f03('0x27')](handleError(_0x133592,null));};exports[_0x6f03('0x34')]=function(_0x29a346,_0x438606){if(_0x29a346[_0x6f03('0x56')]['id']){delete _0x29a346[_0x6f03('0x56')]['id'];}return db[_0x6f03('0x39')][_0x6f03('0x57')]({'where':{'id':_0x29a346[_0x6f03('0x54')]['id']}})[_0x6f03('0x1d')](handleEntityNotFound(_0x438606,null))[_0x6f03('0x1d')](saveUpdates(_0x29a346[_0x6f03('0x56')],null))['then'](respondWithResult(_0x438606,null))[_0x6f03('0x27')](handleError(_0x438606,null));};exports['destroy']=function(_0x28f67d,_0x9175d3){return db[_0x6f03('0x39')][_0x6f03('0x57')]({'where':{'id':_0x28f67d[_0x6f03('0x54')]['id']}})[_0x6f03('0x1d')](handleEntityNotFound(_0x9175d3,null))[_0x6f03('0x1d')](removeEntity(_0x9175d3,null))[_0x6f03('0x27')](handleError(_0x9175d3,null));};exports[_0x6f03('0x58')]=function(_0x2308fa,_0x214555,_0x5f5402){var _0x3028e1={};var _0x52532f={};var _0x44b8e1;var _0x1c4243;return db['VtigerConfiguration'][_0x6f03('0x59')]({'where':{'id':_0x2308fa[_0x6f03('0x54')]['id']}})[_0x6f03('0x1d')](handleEntityNotFound(_0x214555,null))['then'](function(_0x4362a0){if(_0x4362a0){_0x44b8e1=_0x4362a0;_0x52532f['model']=_[_0x6f03('0x3e')](db[_0x6f03('0x5a')][_0x6f03('0x3a')]);_0x52532f[_0x6f03('0x3f')]=_[_0x6f03('0x3e')](_0x2308fa[_0x6f03('0x3f')]);_0x52532f[_0x6f03('0x40')]=_['intersection'](_0x52532f['model'],_0x52532f[_0x6f03('0x3f')]);_0x3028e1[_0x6f03('0x41')]=_[_0x6f03('0x42')](_0x52532f['model'],qs[_0x6f03('0x44')](_0x2308fa[_0x6f03('0x3f')]['fields']));_0x3028e1[_0x6f03('0x41')]=_0x3028e1[_0x6f03('0x41')][_0x6f03('0x45')]?_0x3028e1[_0x6f03('0x41')]:_0x52532f[_0x6f03('0x43')];_0x3028e1[_0x6f03('0x5b')]=qs[_0x6f03('0x48')](_0x2308fa[_0x6f03('0x3f')][_0x6f03('0x48')]);_0x3028e1[_0x6f03('0x49')]=qs['filters'](_[_0x6f03('0x4a')](_0x2308fa[_0x6f03('0x3f')],_0x52532f[_0x6f03('0x40')]));if(_0x2308fa[_0x6f03('0x3f')]['filter']){_0x3028e1[_0x6f03('0x49')]=_[_0x6f03('0x4c')](_0x3028e1['where'],{'$or':_[_0x6f03('0x3d')](_0x3028e1['attributes'],function(_0x4df7d8){var _0x956210={};_0x956210[_0x4df7d8]={'$like':'%'+_0x2308fa['query'][_0x6f03('0x4b')]+'%'};return _0x956210;})});}_0x3028e1=_[_0x6f03('0x4c')]({},_0x3028e1,_0x2308fa[_0x6f03('0x4e')]);return _0x44b8e1['getFields'](_0x3028e1);}})['then'](function(_0x100dd3){if(_0x100dd3){_0x1c4243=_0x100dd3['length'];if(!_0x2308fa[_0x6f03('0x3f')][_0x6f03('0x46')]('nolimit')){_0x3028e1[_0x6f03('0x2d')]=qs[_0x6f03('0x2d')](_0x2308fa['query'][_0x6f03('0x2d')]);_0x3028e1[_0x6f03('0x2c')]=qs[_0x6f03('0x2c')](_0x2308fa[_0x6f03('0x3f')][_0x6f03('0x2c')]);}return _0x44b8e1[_0x6f03('0x58')](_0x3028e1);}})[_0x6f03('0x1d')](function(_0x2040ac){if(_0x2040ac){return _0x2040ac?{'count':_0x1c4243,'rows':_0x2040ac}:null;}})[_0x6f03('0x1d')](respondWithResult(_0x214555,null))[_0x6f03('0x27')](handleError(_0x214555,null));};exports[_0x6f03('0x5c')]=function(_0x134e3e,_0x507096,_0x156b37){var _0x2a8723={};var _0x2b78e4={};var _0x4b5ed8;var _0x3f98f9;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x134e3e[_0x6f03('0x54')]['id']}})[_0x6f03('0x1d')](handleEntityNotFound(_0x507096,null))[_0x6f03('0x1d')](function(_0x4bbbea){if(_0x4bbbea){_0x4b5ed8=_0x4bbbea;_0x2b78e4[_0x6f03('0x43')]=_[_0x6f03('0x3e')](db[_0x6f03('0x5a')]['rawAttributes']);_0x2b78e4[_0x6f03('0x3f')]=_[_0x6f03('0x3e')](_0x134e3e[_0x6f03('0x3f')]);_0x2b78e4[_0x6f03('0x40')]=_[_0x6f03('0x42')](_0x2b78e4[_0x6f03('0x43')],_0x2b78e4[_0x6f03('0x3f')]);_0x2a8723[_0x6f03('0x41')]=_['intersection'](_0x2b78e4[_0x6f03('0x43')],qs[_0x6f03('0x44')](_0x134e3e[_0x6f03('0x3f')][_0x6f03('0x44')]));_0x2a8723[_0x6f03('0x41')]=_0x2a8723['attributes']['length']?_0x2a8723['attributes']:_0x2b78e4[_0x6f03('0x43')];_0x2a8723[_0x6f03('0x5b')]=qs[_0x6f03('0x48')](_0x134e3e[_0x6f03('0x3f')][_0x6f03('0x48')]);_0x2a8723['where']=qs[_0x6f03('0x40')](_[_0x6f03('0x4a')](_0x134e3e[_0x6f03('0x3f')],_0x2b78e4[_0x6f03('0x40')]));if(_0x134e3e[_0x6f03('0x3f')]['filter']){_0x2a8723[_0x6f03('0x49')]=_[_0x6f03('0x4c')](_0x2a8723[_0x6f03('0x49')],{'$or':_['map'](_0x2a8723[_0x6f03('0x41')],function(_0x33d11a){var _0xf05ddb={};_0xf05ddb[_0x33d11a]={'$like':'%'+_0x134e3e['query']['filter']+'%'};return _0xf05ddb;})});}_0x2a8723=_['merge']({},_0x2a8723,_0x134e3e[_0x6f03('0x4e')]);return _0x4b5ed8[_0x6f03('0x5c')](_0x2a8723);}})[_0x6f03('0x1d')](function(_0x3a6bcf){if(_0x3a6bcf){_0x3f98f9=_0x3a6bcf['length'];if(!_0x134e3e['query']['hasOwnProperty'](_0x6f03('0x47'))){_0x2a8723['limit']=qs['limit'](_0x134e3e[_0x6f03('0x3f')][_0x6f03('0x2d')]);_0x2a8723['offset']=qs[_0x6f03('0x2c')](_0x134e3e[_0x6f03('0x3f')]['offset']);}return _0x4b5ed8[_0x6f03('0x5c')](_0x2a8723);}})[_0x6f03('0x1d')](function(_0x1105b6){if(_0x1105b6){return _0x1105b6?{'count':_0x3f98f9,'rows':_0x1105b6}:null;}})[_0x6f03('0x1d')](respondWithResult(_0x507096,null))[_0x6f03('0x27')](handleError(_0x507096,null));};exports[_0x6f03('0x5d')]=function(_0x163fc9,_0xf4b166,_0x1650da){var _0x13ce94={};var _0x273096={};var _0x42a944;var _0x4c09f2;return db[_0x6f03('0x39')][_0x6f03('0x59')]({'where':{'id':_0x163fc9[_0x6f03('0x54')]['id']}})['then'](handleEntityNotFound(_0xf4b166,null))['then'](function(_0x440bac){if(_0x440bac){_0x42a944=_0x440bac;_0x273096[_0x6f03('0x43')]=_[_0x6f03('0x3e')](db[_0x6f03('0x5a')][_0x6f03('0x3a')]);_0x273096[_0x6f03('0x3f')]=_['keys'](_0x163fc9[_0x6f03('0x3f')]);_0x273096[_0x6f03('0x40')]=_[_0x6f03('0x42')](_0x273096[_0x6f03('0x43')],_0x273096[_0x6f03('0x3f')]);_0x13ce94[_0x6f03('0x41')]=_[_0x6f03('0x42')](_0x273096[_0x6f03('0x43')],qs[_0x6f03('0x44')](_0x163fc9[_0x6f03('0x3f')][_0x6f03('0x44')]));_0x13ce94['attributes']=_0x13ce94['attributes'][_0x6f03('0x45')]?_0x13ce94[_0x6f03('0x41')]:_0x273096['model'];_0x13ce94[_0x6f03('0x5b')]=qs[_0x6f03('0x48')](_0x163fc9[_0x6f03('0x3f')][_0x6f03('0x48')]);_0x13ce94[_0x6f03('0x49')]=qs[_0x6f03('0x40')](_[_0x6f03('0x4a')](_0x163fc9[_0x6f03('0x3f')],_0x273096[_0x6f03('0x40')]));if(_0x163fc9[_0x6f03('0x3f')]['filter']){_0x13ce94[_0x6f03('0x49')]=_[_0x6f03('0x4c')](_0x13ce94['where'],{'$or':_[_0x6f03('0x3d')](_0x13ce94[_0x6f03('0x41')],function(_0x75914a){var _0x1e9def={};_0x1e9def[_0x75914a]={'$like':'%'+_0x163fc9[_0x6f03('0x3f')]['filter']+'%'};return _0x1e9def;})});}_0x13ce94=_[_0x6f03('0x4c')]({},_0x13ce94,_0x163fc9[_0x6f03('0x4e')]);return _0x42a944[_0x6f03('0x5d')](_0x13ce94);}})[_0x6f03('0x1d')](function(_0x46af2c){if(_0x46af2c){_0x4c09f2=_0x46af2c[_0x6f03('0x45')];if(!_0x163fc9[_0x6f03('0x3f')]['hasOwnProperty'](_0x6f03('0x47'))){_0x13ce94[_0x6f03('0x2d')]=qs['limit'](_0x163fc9['query'][_0x6f03('0x2d')]);_0x13ce94[_0x6f03('0x2c')]=qs[_0x6f03('0x2c')](_0x163fc9[_0x6f03('0x3f')][_0x6f03('0x2c')]);}return _0x42a944['getDescriptions'](_0x13ce94);}})[_0x6f03('0x1d')](function(_0x18a8e5){if(_0x18a8e5){return _0x18a8e5?{'count':_0x4c09f2,'rows':_0x18a8e5}:null;}})['then'](respondWithResult(_0xf4b166,null))[_0x6f03('0x27')](handleError(_0xf4b166,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 667c031..aff93cc 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 _0x0fc3=['../../config/environment','int_vtiger_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x38a121,_0x5c4303){var _0x246a66=function(_0x39502b){while(--_0x39502b){_0x38a121['push'](_0x38a121['shift']());}};_0x246a66(++_0x5c4303);}(_0x0fc3,0x1bb));var _0x30fc=function(_0x255005,_0x1e1de1){_0x255005=_0x255005-0x0;var _0x3c4730=_0x0fc3[_0x255005];return _0x3c4730;};'use strict';var _=require(_0x30fc('0x0'));var util=require('util');var logger=require(_0x30fc('0x1'))(_0x30fc('0x2'));var moment=require(_0x30fc('0x3'));var BPromise=require('bluebird');var rp=require(_0x30fc('0x4'));var fs=require('fs');var path=require(_0x30fc('0x5'));var rimraf=require(_0x30fc('0x6'));var config=require(_0x30fc('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x148a8c,_0x4379d0){return _0x148a8c['define']('VtigerConfiguration',attributes,{'tableName':_0x30fc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x106f=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25fc58,_0x2719c4){var _0x3f11f0=function(_0x2f1f3a){while(--_0x2f1f3a){_0x25fc58['push'](_0x25fc58['shift']());}};_0x3f11f0(++_0x2719c4);}(_0x106f,0xf3));var _0xf106=function(_0xcbd61c,_0x2bfdfa){_0xcbd61c=_0xcbd61c-0x0;var _0x44df83=_0x106f[_0xcbd61c];return _0x44df83;};'use strict';var _=require(_0xf106('0x0'));var util=require('util');var logger=require(_0xf106('0x1'))(_0xf106('0x2'));var moment=require(_0xf106('0x3'));var BPromise=require(_0xf106('0x4'));var rp=require(_0xf106('0x5'));var fs=require('fs');var path=require(_0xf106('0x6'));var rimraf=require(_0xf106('0x7'));var config=require(_0xf106('0x8'));var attributes=require(_0xf106('0x9'));module[_0xf106('0xa')]=function(_0x563d5f,_0x323bee){return _0x563d5f[_0xf106('0xb')](_0xf106('0xc'),attributes,{'tableName':_0xf106('0xd'),'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 708d926..964c5b4 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 _0x9cdb=['util','moment','bluebird','../../mysqldb','jayson/promise','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x9cdb,0x131));var _0xb9cd=function(_0x1be648,_0x1e8622){_0x1be648=_0x1be648-0x0;var _0x281bd1=_0x9cdb[_0x1be648];return _0x281bd1;};'use strict';var _=require(_0xb9cd('0x0'));var util=require(_0xb9cd('0x1'));var moment=require(_0xb9cd('0x2'));var BPromise=require(_0xb9cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb9cd('0x5'));var client=jayson['client'][_0xb9cd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4185d1,_0x1eb6ab,_0x2b096f){return new BPromise(function(_0x3e0281,_0x4dc6d7){return client[_0xb9cd('0x7')](_0x4185d1,_0x2b096f)['then'](function(_0x2eda20){logger['info'](_0xb9cd('0x8'),_0x1eb6ab,_0xb9cd('0x9'));logger[_0xb9cd('0xa')](_0xb9cd('0xb'),_0x1eb6ab,'request\x20sent',JSON[_0xb9cd('0xc')](_0x2eda20));if(_0x2eda20[_0xb9cd('0xd')]){if(_0x2eda20[_0xb9cd('0xd')][_0xb9cd('0xe')]===0x1f4){logger[_0xb9cd('0xd')](_0xb9cd('0x8'),_0x1eb6ab,_0x2eda20[_0xb9cd('0xd')][_0xb9cd('0xf')]);return _0x4dc6d7(_0x2eda20['error'][_0xb9cd('0xf')]);}logger[_0xb9cd('0xd')](_0xb9cd('0x8'),_0x1eb6ab,_0x2eda20[_0xb9cd('0xd')]['message']);return _0x3e0281(_0x2eda20[_0xb9cd('0xd')][_0xb9cd('0xf')]);}else{logger[_0xb9cd('0x10')](_0xb9cd('0x8'),_0x1eb6ab,_0xb9cd('0x9'));_0x3e0281(_0x2eda20[_0xb9cd('0x11')][_0xb9cd('0xf')]);}})['catch'](function(_0x56aae9){logger[_0xb9cd('0xd')](_0xb9cd('0x8'),_0x1eb6ab,_0x56aae9);_0x4dc6d7(_0x56aae9);});});} \ No newline at end of file +var _0x1666=['../../config/logger','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5451c9,_0x3babf7){var _0x3a10ff=function(_0x19f8b6){while(--_0x19f8b6){_0x5451c9['push'](_0x5451c9['shift']());}};_0x3a10ff(++_0x3babf7);}(_0x1666,0x1b1));var _0x6166=function(_0x588c0b,_0xeacbfb){_0x588c0b=_0x588c0b-0x0;var _0x258f6c=_0x1666[_0x588c0b];return _0x258f6c;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require(_0x6166('0x2'));var BPromise=require(_0x6166('0x3'));var rs=require(_0x6166('0x4'));var fs=require('fs');var Redis=require(_0x6166('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6166('0x6'));var logger=require(_0x6166('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6166('0x8'));var client=jayson[_0x6166('0x9')][_0x6166('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7967d9,_0x148a2c,_0x44add9){return new BPromise(function(_0x4d4ee3,_0xd87f98){return client[_0x6166('0xb')](_0x7967d9,_0x44add9)[_0x6166('0xc')](function(_0x470f45){logger[_0x6166('0xd')](_0x6166('0xe'),_0x148a2c,_0x6166('0xf'));logger['debug'](_0x6166('0x10'),_0x148a2c,_0x6166('0xf'),JSON[_0x6166('0x11')](_0x470f45));if(_0x470f45[_0x6166('0x12')]){if(_0x470f45[_0x6166('0x12')][_0x6166('0x13')]===0x1f4){logger['error'](_0x6166('0xe'),_0x148a2c,_0x470f45[_0x6166('0x12')][_0x6166('0x14')]);return _0xd87f98(_0x470f45[_0x6166('0x12')][_0x6166('0x14')]);}logger['error'](_0x6166('0xe'),_0x148a2c,_0x470f45['error'][_0x6166('0x14')]);return _0x4d4ee3(_0x470f45[_0x6166('0x12')]['message']);}else{logger[_0x6166('0xd')](_0x6166('0xe'),_0x148a2c,_0x6166('0xf'));_0x4d4ee3(_0x470f45[_0x6166('0x15')][_0x6166('0x14')]);}})['catch'](function(_0x396661){logger[_0x6166('0x12')](_0x6166('0xe'),_0x148a2c,_0x396661);_0xd87f98(_0x396661);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 42f2344..0a38468 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 _0xbc05=['./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment'];(function(_0x4fec18,_0x4ca292){var _0x2772ee=function(_0x4c07a2){while(--_0x4c07a2){_0x4fec18['push'](_0x4fec18['shift']());}};_0x2772ee(++_0x4ca292);}(_0xbc05,0xb8));var _0x5bc0=function(_0x55d3e0,_0x4c0ac3){_0x55d3e0=_0x55d3e0-0x0;var _0x2e0858=_0xbc05[_0x55d3e0];return _0x2e0858;};'use strict';var multer=require(_0x5bc0('0x0'));var util=require(_0x5bc0('0x1'));var path=require(_0x5bc0('0x2'));var timeout=require(_0x5bc0('0x3'));var express=require('express');var router=express[_0x5bc0('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5bc0('0x5'));var controller=require(_0x5bc0('0x6'));router[_0x5bc0('0x7')]('/',auth[_0x5bc0('0x8')](),controller[_0x5bc0('0x9')]);router['get'](_0x5bc0('0xa'),auth['isAuthenticated'](),controller[_0x5bc0('0xb')]);router[_0x5bc0('0xc')]('/',auth[_0x5bc0('0x8')](),controller[_0x5bc0('0xd')]);router[_0x5bc0('0xe')](_0x5bc0('0xa'),auth[_0x5bc0('0x8')](),controller[_0x5bc0('0xf')]);router[_0x5bc0('0x10')](_0x5bc0('0xa'),auth[_0x5bc0('0x8')](),controller[_0x5bc0('0x11')]);module[_0x5bc0('0x12')]=router; \ No newline at end of file +var _0xbb14=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x24a851,_0x18e4d2){var _0x406437=function(_0x122979){while(--_0x122979){_0x24a851['push'](_0x24a851['shift']());}};_0x406437(++_0x18e4d2);}(_0xbb14,0x189));var _0x4bb1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbb14[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x4bb1('0x0'));var path=require(_0x4bb1('0x1'));var timeout=require(_0x4bb1('0x2'));var express=require(_0x4bb1('0x3'));var router=express[_0x4bb1('0x4')]();var auth=require(_0x4bb1('0x5'));var interaction=require(_0x4bb1('0x6'));var config=require(_0x4bb1('0x7'));var controller=require('./intVtigerField.controller');router[_0x4bb1('0x8')]('/',auth[_0x4bb1('0x9')](),controller[_0x4bb1('0xa')]);router[_0x4bb1('0x8')](_0x4bb1('0xb'),auth['isAuthenticated'](),controller[_0x4bb1('0xc')]);router[_0x4bb1('0xd')]('/',auth[_0x4bb1('0x9')](),controller[_0x4bb1('0xe')]);router[_0x4bb1('0xf')](_0x4bb1('0xb'),auth[_0x4bb1('0x9')](),controller[_0x4bb1('0x10')]);router[_0x4bb1('0x11')](_0x4bb1('0xb'),auth[_0x4bb1('0x9')](),controller[_0x4bb1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a3efd31..ef3649e 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 _0xaa9d=['exports','ENUM','string','variable','STRING','BOOLEAN','sequelize'];(function(_0x12f887,_0x42de26){var _0x1532c6=function(_0x18254c){while(--_0x18254c){_0x12f887['push'](_0x12f887['shift']());}};_0x1532c6(++_0x42de26);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x3c04cf,_0x159434){_0x3c04cf=_0x3c04cf-0x0;var _0x54b34e=_0xaa9d[_0x3c04cf];return _0x54b34e;};'use strict';var Sequelize=require(_0xdaa9('0x0'));module[_0xdaa9('0x1')]={'type':{'type':Sequelize[_0xdaa9('0x2')](_0xdaa9('0x3'),_0xdaa9('0x4'),'customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdaa9('0x5')]},'keyType':{'type':Sequelize[_0xdaa9('0x2')](_0xdaa9('0x3'),_0xdaa9('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdaa9('0x5')]},'nameField':{'type':Sequelize[_0xdaa9('0x5')]},'customField':{'type':Sequelize[_0xdaa9('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdaa9('0x5')]}}; \ No newline at end of file +var _0x535f=['BOOLEAN','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x1b0af7,_0x505ede){var _0x1beb82=function(_0x5b5fe0){while(--_0x5b5fe0){_0x1b0af7['push'](_0x1b0af7['shift']());}};_0x1beb82(++_0x505ede);}(_0x535f,0x111));var _0xf535=function(_0x14562a,_0x4d3bed){_0x14562a=_0x14562a-0x0;var _0x1d1f9a=_0x535f[_0x14562a];return _0x1d1f9a;};'use strict';var Sequelize=require('sequelize');module[_0xf535('0x0')]={'type':{'type':Sequelize[_0xf535('0x1')]('string',_0xf535('0x2'),_0xf535('0x3'),_0xf535('0x4')),'defaultValue':_0xf535('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf535('0x6')]},'keyType':{'type':Sequelize[_0xf535('0x1')](_0xf535('0x5'),_0xf535('0x2'),_0xf535('0x3'))},'keyContent':{'type':Sequelize[_0xf535('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf535('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf535('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4189961..c53076d 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 _0xaa37=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','end','status','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','length','find','body','params','html-pdf'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xaa37[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x7aa3('0x0'));var emlformat=require(_0x7aa3('0x1'));var rimraf=require(_0x7aa3('0x2'));var zipdir=require(_0x7aa3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7aa3('0x4'));var moment=require(_0x7aa3('0x5'));var BPromise=require(_0x7aa3('0x6'));var Mustache=require(_0x7aa3('0x7'));var util=require(_0x7aa3('0x8'));var path=require(_0x7aa3('0x9'));var sox=require(_0x7aa3('0xa'));var csv=require('to-csv');var ejs=require(_0x7aa3('0xb'));var fs=require('fs');var _=require(_0x7aa3('0xc'));var squel=require('squel');var crypto=require(_0x7aa3('0xd'));var jsforce=require(_0x7aa3('0xe'));var deskjs=require(_0x7aa3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7aa3('0x10'));var Papa=require(_0x7aa3('0x11'));var Redis=require(_0x7aa3('0x12'));var authService=require(_0x7aa3('0x13'));var qs=require(_0x7aa3('0x14'));var as=require(_0x7aa3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7aa3('0x16'));var utils=require('../../config/utils');var config=require(_0x7aa3('0x17'));var licenseUtil=require(_0x7aa3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c68b8,_0xc11cd3){_0xc11cd3=_0xc11cd3||0xcc;return function(_0x552ec9){if(_0x552ec9){return _0x3c68b8['sendStatus'](_0xc11cd3);}return _0x3c68b8['status'](_0xc11cd3)[_0x7aa3('0x19')]();};}function respondWithResult(_0x20f370,_0x1c53a9){_0x1c53a9=_0x1c53a9||0xc8;return function(_0x451fe4){if(_0x451fe4){return _0x20f370[_0x7aa3('0x1a')](_0x1c53a9)['json'](_0x451fe4);}};}function respondWithFilteredResult(_0x235040,_0x3df7e8){return function(_0x36e9f9){if(_0x36e9f9){var _0x1f2d89=_0x36e9f9['count'],_0x50da7c=_0x3df7e8[_0x7aa3('0x1b')],_0x5ae383=_0x3df7e8[_0x7aa3('0x1b')]+_0x3df7e8['limit'],_0x3fab08;if(_0x5ae383>=_0x1f2d89){_0x5ae383=_0x1f2d89;_0x3fab08=0xc8;}else{_0x3fab08=0xce;}_0x235040[_0x7aa3('0x1a')](_0x3fab08);return _0x235040[_0x7aa3('0x1c')](_0x7aa3('0x1d'),_0x50da7c+'-'+_0x5ae383+'/'+_0x1f2d89)[_0x7aa3('0x1e')](_0x36e9f9);}return null;};}function patchUpdates(_0x12fdd3){return function(_0x5994b6){try{jsonpatch[_0x7aa3('0x1f')](_0x5994b6,_0x12fdd3,!![]);}catch(_0x266529){return BPromise[_0x7aa3('0x20')](_0x266529);}return _0x5994b6[_0x7aa3('0x21')]();};}function saveUpdates(_0x2360d1,_0xa57443){return function(_0x5a7c65){if(_0x5a7c65){return _0x5a7c65[_0x7aa3('0x22')](_0x2360d1)[_0x7aa3('0x23')](function(_0x35f0f8){return _0x35f0f8;});}return null;};}function removeEntity(_0x4177b9,_0x36c619){return function(_0x49a566){if(_0x49a566){return _0x49a566[_0x7aa3('0x24')]()[_0x7aa3('0x23')](function(){_0x4177b9[_0x7aa3('0x1a')](0xcc)[_0x7aa3('0x19')]();});}};}function handleEntityNotFound(_0x3b382d,_0x10887d){return function(_0x25bc1f){if(!_0x25bc1f){_0x3b382d[_0x7aa3('0x25')](0x194);}return _0x25bc1f;};}function handleError(_0x1d5271,_0x23f168){_0x23f168=_0x23f168||0x1f4;return function(_0x44377a){logger[_0x7aa3('0x26')](_0x44377a[_0x7aa3('0x27')]);if(_0x44377a['name']){delete _0x44377a[_0x7aa3('0x28')];}_0x1d5271[_0x7aa3('0x1a')](_0x23f168)[_0x7aa3('0x29')](_0x44377a);};}exports[_0x7aa3('0x2a')]=function(_0x183ffc,_0x1fa6a1){var _0x47cf18={},_0x3618df={},_0x183567={'count':0x0,'rows':[]};var _0x447c9f=_['map'](db[_0x7aa3('0x2b')][_0x7aa3('0x2c')],function(_0x539ec0){return{'name':_0x539ec0[_0x7aa3('0x2d')],'type':_0x539ec0[_0x7aa3('0x2e')][_0x7aa3('0x2f')]};});_0x3618df[_0x7aa3('0x30')]=_[_0x7aa3('0x31')](_0x447c9f,_0x7aa3('0x28'));_0x3618df[_0x7aa3('0x32')]=_[_0x7aa3('0x33')](_0x183ffc[_0x7aa3('0x32')]);_0x3618df[_0x7aa3('0x34')]=_[_0x7aa3('0x35')](_0x3618df[_0x7aa3('0x30')],_0x3618df[_0x7aa3('0x32')]);_0x47cf18[_0x7aa3('0x36')]=_[_0x7aa3('0x35')](_0x3618df[_0x7aa3('0x30')],qs[_0x7aa3('0x37')](_0x183ffc[_0x7aa3('0x32')][_0x7aa3('0x37')]));_0x47cf18[_0x7aa3('0x36')]=_0x47cf18[_0x7aa3('0x36')]['length']?_0x47cf18[_0x7aa3('0x36')]:_0x3618df[_0x7aa3('0x30')];if(!_0x183ffc[_0x7aa3('0x32')][_0x7aa3('0x38')](_0x7aa3('0x39'))){_0x47cf18[_0x7aa3('0x3a')]=qs[_0x7aa3('0x3a')](_0x183ffc[_0x7aa3('0x32')][_0x7aa3('0x3a')]);_0x47cf18[_0x7aa3('0x1b')]=qs[_0x7aa3('0x1b')](_0x183ffc['query'][_0x7aa3('0x1b')]);}_0x47cf18[_0x7aa3('0x3b')]=qs[_0x7aa3('0x3c')](_0x183ffc[_0x7aa3('0x32')][_0x7aa3('0x3c')]);_0x47cf18[_0x7aa3('0x3d')]=qs[_0x7aa3('0x34')](_[_0x7aa3('0x3e')](_0x183ffc[_0x7aa3('0x32')],_0x3618df[_0x7aa3('0x34')]),_0x447c9f);if(_0x183ffc[_0x7aa3('0x32')][_0x7aa3('0x3f')]){_0x47cf18[_0x7aa3('0x3d')]=_[_0x7aa3('0x40')](_0x47cf18['where'],{'$or':_[_0x7aa3('0x31')](_0x447c9f,function(_0x304017){if(_0x304017[_0x7aa3('0x2e')]!==_0x7aa3('0x41')){var _0x4ce94b={};_0x4ce94b[_0x304017[_0x7aa3('0x28')]]={'$like':'%'+_0x183ffc['query'][_0x7aa3('0x3f')]+'%'};return _0x4ce94b;}})});}_0x47cf18=_[_0x7aa3('0x40')]({},_0x47cf18,_0x183ffc[_0x7aa3('0x42')]);var _0x1177b4={'where':_0x47cf18[_0x7aa3('0x3d')]};return db[_0x7aa3('0x2b')][_0x7aa3('0x43')](_0x1177b4)[_0x7aa3('0x23')](function(_0x839ecf){_0x183567[_0x7aa3('0x43')]=_0x839ecf;if(_0x183ffc['query'][_0x7aa3('0x44')]){_0x47cf18[_0x7aa3('0x45')]=[{'all':!![]}];}return db[_0x7aa3('0x2b')][_0x7aa3('0x46')](_0x47cf18);})[_0x7aa3('0x23')](function(_0x143d77){_0x183567[_0x7aa3('0x47')]=_0x143d77;return _0x183567;})[_0x7aa3('0x23')](respondWithFilteredResult(_0x1fa6a1,_0x47cf18))[_0x7aa3('0x48')](handleError(_0x1fa6a1,null));};exports[_0x7aa3('0x49')]=function(_0xc21d54,_0x119cdd){var _0x3efe01={'raw':!![],'where':{'id':_0xc21d54['params']['id']}},_0x13be4a={};_0x13be4a[_0x7aa3('0x30')]=_[_0x7aa3('0x33')](db['VtigerField'][_0x7aa3('0x2c')]);_0x13be4a[_0x7aa3('0x32')]=_['keys'](_0xc21d54[_0x7aa3('0x32')]);_0x13be4a[_0x7aa3('0x34')]=_[_0x7aa3('0x35')](_0x13be4a[_0x7aa3('0x30')],_0x13be4a['query']);_0x3efe01['attributes']=_[_0x7aa3('0x35')](_0x13be4a['model'],qs[_0x7aa3('0x37')](_0xc21d54['query']['fields']));_0x3efe01[_0x7aa3('0x36')]=_0x3efe01[_0x7aa3('0x36')][_0x7aa3('0x4a')]?_0x3efe01[_0x7aa3('0x36')]:_0x13be4a[_0x7aa3('0x30')];if(_0xc21d54['query'][_0x7aa3('0x44')]){_0x3efe01[_0x7aa3('0x45')]=[{'all':!![]}];}_0x3efe01=_['merge']({},_0x3efe01,_0xc21d54[_0x7aa3('0x42')]);return db[_0x7aa3('0x2b')][_0x7aa3('0x4b')](_0x3efe01)['then'](handleEntityNotFound(_0x119cdd,null))[_0x7aa3('0x23')](respondWithResult(_0x119cdd,null))[_0x7aa3('0x48')](handleError(_0x119cdd,null));};exports['create']=function(_0x2cc4aa,_0xc74dce){return db['VtigerField']['create'](_0x2cc4aa[_0x7aa3('0x4c')],{})[_0x7aa3('0x23')](respondWithResult(_0xc74dce,0xc9))[_0x7aa3('0x48')](handleError(_0xc74dce,null));};exports[_0x7aa3('0x22')]=function(_0x4d716c,_0x4e3bc1){if(_0x4d716c[_0x7aa3('0x4c')]['id']){delete _0x4d716c[_0x7aa3('0x4c')]['id'];}return db[_0x7aa3('0x2b')][_0x7aa3('0x4b')]({'where':{'id':_0x4d716c['params']['id']}})['then'](handleEntityNotFound(_0x4e3bc1,null))['then'](saveUpdates(_0x4d716c[_0x7aa3('0x4c')],null))[_0x7aa3('0x23')](respondWithResult(_0x4e3bc1,null))[_0x7aa3('0x48')](handleError(_0x4e3bc1,null));};exports['destroy']=function(_0x24017d,_0x62de12){return db[_0x7aa3('0x2b')][_0x7aa3('0x4b')]({'where':{'id':_0x24017d[_0x7aa3('0x4d')]['id']}})[_0x7aa3('0x23')](handleEntityNotFound(_0x62de12,null))['then'](removeEntity(_0x62de12,null))[_0x7aa3('0x48')](handleError(_0x62de12,null));}; \ No newline at end of file +var _0xb4c7=['apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x19b4d4,_0x2df908){_0x19b4d4=_0x19b4d4-0x0;var _0x380eb4=_0xb4c7[_0x19b4d4];return _0x380eb4;};'use strict';var pdf=require(_0x7b4c('0x0'));var emlformat=require(_0x7b4c('0x1'));var rimraf=require(_0x7b4c('0x2'));var zipdir=require(_0x7b4c('0x3'));var jsonpatch=require(_0x7b4c('0x4'));var rp=require('request-promise');var moment=require(_0x7b4c('0x5'));var BPromise=require(_0x7b4c('0x6'));var Mustache=require(_0x7b4c('0x7'));var util=require(_0x7b4c('0x8'));var path=require(_0x7b4c('0x9'));var sox=require('sox');var csv=require(_0x7b4c('0xa'));var ejs=require(_0x7b4c('0xb'));var fs=require('fs');var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xa'));var querystring=require(_0x7b4c('0xf'));var Papa=require(_0x7b4c('0x10'));var Redis=require(_0x7b4c('0x11'));var authService=require(_0x7b4c('0x12'));var qs=require(_0x7b4c('0x13'));var as=require(_0x7b4c('0x14'));var hardwareService=require(_0x7b4c('0x15'));var logger=require(_0x7b4c('0x16'))(_0x7b4c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x18'));var db=require(_0x7b4c('0x19'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1a')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1b')](_0x1722ad)[_0x7b4c('0x1c')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1b')](_0x387488)[_0x7b4c('0x1d')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=_0xa0a812[_0x7b4c('0x1e')],_0x1642e1=_0x2a0e2f[_0x7b4c('0x1f')],_0x22c409=_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x20')],_0x4d3f5e;if(_0x22c409>=_0x2471b3){_0x22c409=_0x2471b3;_0x4d3f5e=0xc8;}else{_0x4d3f5e=0xce;}_0xdc71cd['status'](_0x4d3f5e);return _0xdc71cd[_0x7b4c('0x21')](_0x7b4c('0x22'),_0x1642e1+'-'+_0x22c409+'/'+_0x2471b3)[_0x7b4c('0x1d')](_0xa0a812);}return null;};}function patchUpdates(_0x380b79){return function(_0x2d4c72){try{jsonpatch[_0x7b4c('0x23')](_0x2d4c72,_0x380b79,!![]);}catch(_0x237110){return BPromise[_0x7b4c('0x24')](_0x237110);}return _0x2d4c72[_0x7b4c('0x25')]();};}function saveUpdates(_0x55e3df,_0x1f06ec){return function(_0x331e24){if(_0x331e24){return _0x331e24[_0x7b4c('0x26')](_0x55e3df)[_0x7b4c('0x27')](function(_0x148a79){return _0x148a79;});}return null;};}function removeEntity(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')]()[_0x7b4c('0x27')](function(){_0x168ac9['status'](0xcc)[_0x7b4c('0x1c')]();});}};}function handleEntityNotFound(_0x4350c9,_0x276271){return function(_0x3157b8){if(!_0x3157b8){_0x4350c9[_0x7b4c('0x1a')](0x194);}return _0x3157b8;};}function handleError(_0x2bdc4d,_0x37c059){_0x37c059=_0x37c059||0x1f4;return function(_0x459eb4){logger[_0x7b4c('0x29')](_0x459eb4[_0x7b4c('0x2a')]);if(_0x459eb4[_0x7b4c('0x2b')]){delete _0x459eb4[_0x7b4c('0x2b')];}_0x2bdc4d[_0x7b4c('0x1b')](_0x37c059)['send'](_0x459eb4);};}exports[_0x7b4c('0x2c')]=function(_0x3ab614,_0x1fe0f5){var _0x3671c4={},_0x207c2f={},_0x4ce02c={'count':0x0,'rows':[]};var _0x1de2b1=_[_0x7b4c('0x2d')](db[_0x7b4c('0x2e')][_0x7b4c('0x2f')],function(_0x3585cd){return{'name':_0x3585cd[_0x7b4c('0x30')],'type':_0x3585cd[_0x7b4c('0x31')][_0x7b4c('0x32')]};});_0x207c2f[_0x7b4c('0x33')]=_[_0x7b4c('0x2d')](_0x1de2b1,_0x7b4c('0x2b'));_0x207c2f[_0x7b4c('0x34')]=_[_0x7b4c('0x35')](_0x3ab614['query']);_0x207c2f['filters']=_['intersection'](_0x207c2f[_0x7b4c('0x33')],_0x207c2f[_0x7b4c('0x34')]);_0x3671c4[_0x7b4c('0x36')]=_[_0x7b4c('0x37')](_0x207c2f['model'],qs[_0x7b4c('0x38')](_0x3ab614[_0x7b4c('0x34')]['fields']));_0x3671c4[_0x7b4c('0x36')]=_0x3671c4['attributes'][_0x7b4c('0x39')]?_0x3671c4[_0x7b4c('0x36')]:_0x207c2f[_0x7b4c('0x33')];if(!_0x3ab614['query'][_0x7b4c('0x3a')](_0x7b4c('0x3b'))){_0x3671c4['limit']=qs[_0x7b4c('0x20')](_0x3ab614[_0x7b4c('0x34')][_0x7b4c('0x20')]);_0x3671c4[_0x7b4c('0x1f')]=qs['offset'](_0x3ab614['query'][_0x7b4c('0x1f')]);}_0x3671c4[_0x7b4c('0x3c')]=qs['sort'](_0x3ab614[_0x7b4c('0x34')]['sort']);_0x3671c4['where']=qs[_0x7b4c('0x3d')](_[_0x7b4c('0x3e')](_0x3ab614[_0x7b4c('0x34')],_0x207c2f[_0x7b4c('0x3d')]),_0x1de2b1);if(_0x3ab614['query'][_0x7b4c('0x3f')]){_0x3671c4[_0x7b4c('0x40')]=_[_0x7b4c('0x41')](_0x3671c4[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x2d')](_0x1de2b1,function(_0xddd16){if(_0xddd16[_0x7b4c('0x31')]!=='VIRTUAL'){var _0x5675dc={};_0x5675dc[_0xddd16[_0x7b4c('0x2b')]]={'$like':'%'+_0x3ab614[_0x7b4c('0x34')][_0x7b4c('0x3f')]+'%'};return _0x5675dc;}})});}_0x3671c4=_[_0x7b4c('0x41')]({},_0x3671c4,_0x3ab614[_0x7b4c('0x42')]);var _0x592834={'where':_0x3671c4[_0x7b4c('0x40')]};return db[_0x7b4c('0x2e')][_0x7b4c('0x1e')](_0x592834)[_0x7b4c('0x27')](function(_0x22f71b){_0x4ce02c[_0x7b4c('0x1e')]=_0x22f71b;if(_0x3ab614[_0x7b4c('0x34')][_0x7b4c('0x43')]){_0x3671c4[_0x7b4c('0x44')]=[{'all':!![]}];}return db['VtigerField'][_0x7b4c('0x45')](_0x3671c4);})['then'](function(_0x2a3a74){_0x4ce02c['rows']=_0x2a3a74;return _0x4ce02c;})[_0x7b4c('0x27')](respondWithFilteredResult(_0x1fe0f5,_0x3671c4))[_0x7b4c('0x46')](handleError(_0x1fe0f5,null));};exports['show']=function(_0x50f2ed,_0x354578){var _0x4314b6={'raw':!![],'where':{'id':_0x50f2ed[_0x7b4c('0x47')]['id']}},_0x1def44={};_0x1def44['model']=_[_0x7b4c('0x35')](db[_0x7b4c('0x2e')][_0x7b4c('0x2f')]);_0x1def44['query']=_[_0x7b4c('0x35')](_0x50f2ed['query']);_0x1def44['filters']=_[_0x7b4c('0x37')](_0x1def44['model'],_0x1def44[_0x7b4c('0x34')]);_0x4314b6[_0x7b4c('0x36')]=_[_0x7b4c('0x37')](_0x1def44[_0x7b4c('0x33')],qs[_0x7b4c('0x38')](_0x50f2ed[_0x7b4c('0x34')][_0x7b4c('0x38')]));_0x4314b6[_0x7b4c('0x36')]=_0x4314b6[_0x7b4c('0x36')]['length']?_0x4314b6[_0x7b4c('0x36')]:_0x1def44['model'];if(_0x50f2ed['query'][_0x7b4c('0x43')]){_0x4314b6[_0x7b4c('0x44')]=[{'all':!![]}];}_0x4314b6=_['merge']({},_0x4314b6,_0x50f2ed['options']);return db[_0x7b4c('0x2e')][_0x7b4c('0x48')](_0x4314b6)[_0x7b4c('0x27')](handleEntityNotFound(_0x354578,null))[_0x7b4c('0x27')](respondWithResult(_0x354578,null))[_0x7b4c('0x46')](handleError(_0x354578,null));};exports[_0x7b4c('0x49')]=function(_0x336796,_0x1cf7c7){return db['VtigerField'][_0x7b4c('0x49')](_0x336796[_0x7b4c('0x4a')],{})[_0x7b4c('0x27')](respondWithResult(_0x1cf7c7,0xc9))[_0x7b4c('0x46')](handleError(_0x1cf7c7,null));};exports[_0x7b4c('0x26')]=function(_0x379f15,_0x11a6f9){if(_0x379f15[_0x7b4c('0x4a')]['id']){delete _0x379f15[_0x7b4c('0x4a')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x379f15[_0x7b4c('0x47')]['id']}})[_0x7b4c('0x27')](handleEntityNotFound(_0x11a6f9,null))[_0x7b4c('0x27')](saveUpdates(_0x379f15['body'],null))[_0x7b4c('0x27')](respondWithResult(_0x11a6f9,null))[_0x7b4c('0x46')](handleError(_0x11a6f9,null));};exports['destroy']=function(_0x1d82ee,_0x5c2ecd){return db[_0x7b4c('0x2e')]['find']({'where':{'id':_0x1d82ee[_0x7b4c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c2ecd,null))[_0x7b4c('0x27')](removeEntity(_0x5c2ecd,null))[_0x7b4c('0x46')](handleError(_0x5c2ecd,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 478db34..2fe2d48 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(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x43cbf3,_0x5aaae6){var _0x3a6f4b=function(_0x5ba66d){while(--_0x5ba66d){_0x43cbf3['push'](_0x43cbf3['shift']());}};_0x3a6f4b(++_0x5aaae6);}(_0x7a54,0x106));var _0x47a5=function(_0x48ee1e,_0x338df0){_0x48ee1e=_0x48ee1e-0x0;var _0x415196=_0x7a54[_0x48ee1e];return _0x415196;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6170005..ff3c7fb 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 _0xd506=['catch','lodash','../../config/logger','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x4615ee,_0xed7e84){var _0x4f8d9b=function(_0x27ad2e){while(--_0x27ad2e){_0x4615ee['push'](_0x4615ee['shift']());}};_0x4f8d9b(++_0xed7e84);}(_0xd506,0x197));var _0x6d50=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd506[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x6d50('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('../../config/utils');var logger=require(_0x6d50('0x1'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6d50('0x2')][_0x6d50('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x1b0af3,_0x4cf512,_0x9565b6){return new BPromise(function(_0xce67b6,_0x2dacde){return client['request'](_0x1b0af3,_0x9565b6)[_0x6d50('0x4')](function(_0x5012ed){logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,_0x6d50('0x7'));logger[_0x6d50('0x8')](_0x6d50('0x9'),_0x4cf512,_0x6d50('0x7'),JSON['stringify'](_0x5012ed));if(_0x5012ed['error']){if(_0x5012ed['error'][_0x6d50('0xa')]===0x1f4){logger[_0x6d50('0xb')](_0x6d50('0x6'),_0x4cf512,_0x5012ed[_0x6d50('0xb')]['message']);return _0x2dacde(_0x5012ed[_0x6d50('0xb')]['message']);}logger[_0x6d50('0xb')]('VtigerField,\x20%s,\x20%s',_0x4cf512,_0x5012ed['error']['message']);return _0xce67b6(_0x5012ed[_0x6d50('0xb')]['message']);}else{logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,'request\x20sent');_0xce67b6(_0x5012ed['result'][_0x6d50('0xc')]);}})[_0x6d50('0xd')](function(_0x38068e){logger['error'](_0x6d50('0x6'),_0x4cf512,_0x38068e);_0x2dacde(_0x38068e);});});} \ No newline at end of file +var _0x0bb4=['../../config/environment','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x0bb4,0x77));var _0x40bb=function(_0x3ded7b,_0x1e907e){_0x3ded7b=_0x3ded7b-0x0;var _0x15b013=_0x0bb4[_0x3ded7b];return _0x15b013;};'use strict';var _=require(_0x40bb('0x0'));var util=require(_0x40bb('0x1'));var moment=require('moment');var BPromise=require(_0x40bb('0x2'));var rs=require(_0x40bb('0x3'));var fs=require('fs');var Redis=require(_0x40bb('0x4'));var db=require(_0x40bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40bb('0x6'))('rpc');var config=require(_0x40bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x40bb('0x8')][_0x40bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d15f6,_0x266c1e,_0x1243f4){return new BPromise(function(_0x50d70f,_0x1dc35d){return client['request'](_0x4d15f6,_0x1243f4)[_0x40bb('0xa')](function(_0x3bc5c5){logger[_0x40bb('0xb')](_0x40bb('0xc'),_0x266c1e,_0x40bb('0xd'));logger[_0x40bb('0xe')](_0x40bb('0xf'),_0x266c1e,_0x40bb('0xd'),JSON[_0x40bb('0x10')](_0x3bc5c5));if(_0x3bc5c5[_0x40bb('0x11')]){if(_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x12')]===0x1f4){logger[_0x40bb('0x11')](_0x40bb('0xc'),_0x266c1e,_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);return _0x1dc35d(_0x3bc5c5[_0x40bb('0x11')]['message']);}logger['error'](_0x40bb('0xc'),_0x266c1e,_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);return _0x50d70f(_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);}else{logger[_0x40bb('0xb')](_0x40bb('0xc'),_0x266c1e,_0x40bb('0xd'));_0x50d70f(_0x3bc5c5['result'][_0x40bb('0x13')]);}})[_0x40bb('0x14')](function(_0x416d95){logger[_0x40bb('0x11')](_0x40bb('0xc'),_0x266c1e,_0x416d95);_0x1dc35d(_0x416d95);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d21a307..e873a53 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 _0x63e4=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1cb29b,_0x9bf287){var _0x12b692=function(_0x15797f){while(--_0x15797f){_0x1cb29b['push'](_0x1cb29b['shift']());}};_0x12b692(++_0x9bf287);}(_0x63e4,0x12a));var _0x463e=function(_0x47f31c,_0x1f1fdf){_0x47f31c=_0x47f31c-0x0;var _0x138b8c=_0x63e4[_0x47f31c];return _0x138b8c;};'use strict';var multer=require(_0x463e('0x0'));var util=require(_0x463e('0x1'));var path=require(_0x463e('0x2'));var timeout=require(_0x463e('0x3'));var express=require(_0x463e('0x4'));var router=express[_0x463e('0x5')]();var auth=require(_0x463e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x463e('0x7'));var controller=require(_0x463e('0x8'));router[_0x463e('0x9')]('/',auth[_0x463e('0xa')](),controller[_0x463e('0xb')]);router[_0x463e('0x9')](_0x463e('0xc'),auth[_0x463e('0xa')](),controller[_0x463e('0xd')]);router[_0x463e('0x9')](_0x463e('0xe'),auth[_0x463e('0xa')](),controller[_0x463e('0xf')]);router[_0x463e('0x9')](_0x463e('0x10'),auth['isAuthenticated'](),controller[_0x463e('0x11')]);router[_0x463e('0x12')]('/',auth[_0x463e('0xa')](),controller[_0x463e('0x13')]);router['post'](_0x463e('0xe'),auth[_0x463e('0xa')](),controller['addConfiguration']);router[_0x463e('0x14')](_0x463e('0xc'),auth[_0x463e('0xa')](),controller[_0x463e('0x15')]);router['delete'](_0x463e('0xc'),auth[_0x463e('0xa')](),controller[_0x463e('0x16')]);module[_0x463e('0x17')]=router; \ No newline at end of file +var _0x5f30=['destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x980915,_0x57e76f){var _0x54d8d4=function(_0x3107e5){while(--_0x3107e5){_0x980915['push'](_0x980915['shift']());}};_0x54d8d4(++_0x57e76f);}(_0x5f30,0xe9));var _0x05f3=function(_0x35f581,_0x26a7d0){_0x35f581=_0x35f581-0x0;var _0x43858a=_0x5f30[_0x35f581];return _0x43858a;};'use strict';var multer=require(_0x05f3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x05f3('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x05f3('0x2'));var interaction=require(_0x05f3('0x3'));var config=require(_0x05f3('0x4'));var controller=require('./intZendeskAccount.controller');router[_0x05f3('0x5')]('/',auth[_0x05f3('0x6')](),controller[_0x05f3('0x7')]);router[_0x05f3('0x5')](_0x05f3('0x8'),auth[_0x05f3('0x6')](),controller[_0x05f3('0x9')]);router[_0x05f3('0x5')](_0x05f3('0xa'),auth[_0x05f3('0x6')](),controller[_0x05f3('0xb')]);router[_0x05f3('0x5')](_0x05f3('0xc'),auth[_0x05f3('0x6')](),controller[_0x05f3('0xd')]);router['post']('/',auth[_0x05f3('0x6')](),controller['create']);router[_0x05f3('0xe')]('/:id/configurations',auth[_0x05f3('0x6')](),controller[_0x05f3('0xf')]);router[_0x05f3('0x10')](_0x05f3('0x8'),auth[_0x05f3('0x6')](),controller[_0x05f3('0x11')]);router[_0x05f3('0x12')](_0x05f3('0x8'),auth[_0x05f3('0x6')](),controller[_0x05f3('0x13')]);module[_0x05f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d3b4bc1..494539e 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 _0x2769=['integrationTab','newTab','sequelize','STRING','username','remoteUri','password','ENUM'];(function(_0x7fcfa6,_0x1d0bcf){var _0x182fba=function(_0x44b038){while(--_0x44b038){_0x7fcfa6['push'](_0x7fcfa6['shift']());}};_0x182fba(++_0x1d0bcf);}(_0x2769,0xfa));var _0x9276=function(_0x4945ef,_0x3f0304){_0x4945ef=_0x4945ef-0x0;var _0x2ae647=_0x2769[_0x4945ef];return _0x2ae647;};'use strict';var Sequelize=require(_0x9276('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9276('0x1')]},'username':{'type':Sequelize[_0x9276('0x1')],'unique':_0x9276('0x2')},'password':{'type':Sequelize[_0x9276('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9276('0x1')],'unique':_0x9276('0x3')},'authType':{'type':Sequelize['ENUM'](_0x9276('0x4'),'token'),'defaultValue':_0x9276('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9276('0x5')](_0x9276('0x6'),_0x9276('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x80b8=['ENUM','password','integrationTab','sequelize','exports','STRING','username'];(function(_0x42ce67,_0x5b7b2e){var _0x47a4cf=function(_0x4fb87c){while(--_0x4fb87c){_0x42ce67['push'](_0x42ce67['shift']());}};_0x47a4cf(++_0x5b7b2e);}(_0x80b8,0x168));var _0x880b=function(_0x1fbabc,_0x1e89c2){_0x1fbabc=_0x1fbabc-0x0;var _0x47d18e=_0x80b8[_0x1fbabc];return _0x47d18e;};'use strict';var Sequelize=require(_0x880b('0x0'));module[_0x880b('0x1')]={'name':{'type':Sequelize[_0x880b('0x2')]},'description':{'type':Sequelize[_0x880b('0x2')]},'username':{'type':Sequelize[_0x880b('0x2')],'unique':_0x880b('0x3')},'password':{'type':Sequelize[_0x880b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x880b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x880b('0x4')]('password','token'),'defaultValue':_0x880b('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x880b('0x4')](_0x880b('0x6'),'newTab'),'defaultValue':_0x880b('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 19adf81..7f3d800 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 _0x9000=['findOne','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','token','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','authType','password','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body'];(function(_0x498b54,_0x36e06d){var _0x9446d3=function(_0xf4e613){while(--_0xf4e613){_0x498b54['push'](_0x498b54['shift']());}};_0x9446d3(++_0x36e06d);}(_0x9000,0x19e));var _0x0900=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0x9000[_0x33e93d];return _0x19e99d;};'use strict';var pdf=require(_0x0900('0x0'));var emlformat=require(_0x0900('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0900('0x2'));var jsonpatch=require(_0x0900('0x3'));var rp=require(_0x0900('0x4'));var moment=require(_0x0900('0x5'));var BPromise=require(_0x0900('0x6'));var Mustache=require(_0x0900('0x7'));var util=require(_0x0900('0x8'));var path=require(_0x0900('0x9'));var sox=require(_0x0900('0xa'));var csv=require('to-csv');var ejs=require(_0x0900('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0900('0xc'));var crypto=require(_0x0900('0xd'));var jsforce=require(_0x0900('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0900('0xf'));var Papa=require(_0x0900('0x10'));var Redis=require(_0x0900('0x11'));var authService=require(_0x0900('0x12'));var qs=require(_0x0900('0x13'));var as=require(_0x0900('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0900('0x15'))(_0x0900('0x16'));var utils=require(_0x0900('0x17'));var config=require(_0x0900('0x18'));var licenseUtil=require(_0x0900('0x19'));var db=require(_0x0900('0x1a'))['db'];var integrations=require(_0x0900('0x1b'));var jayson=require(_0x0900('0x1c'));var client=jayson[_0x0900('0x1d')][_0x0900('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4cf896,_0x40bfa0,_0x183ca6,_0x4ea071){return new BPromise(function(_0x52bb65,_0x3594fd){var _0x593ab7=_0x4ea071||client;return _0x593ab7[_0x0900('0x1f')](_0x4cf896,_0x183ca6)['then'](function(_0x35dbd6){logger[_0x0900('0x20')](_0x0900('0x21'),_0x40bfa0,_0x0900('0x22'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x40bfa0,_0x0900('0x22'),JSON[_0x0900('0x23')](_0x35dbd6));if(_0x35dbd6[_0x0900('0x24')]){if(_0x35dbd6[_0x0900('0x24')]['code']===0x1f4){logger[_0x0900('0x24')](_0x0900('0x21'),_0x40bfa0,_0x35dbd6[_0x0900('0x24')][_0x0900('0x25')]);return _0x3594fd(_0x35dbd6[_0x0900('0x24')][_0x0900('0x25')]);}logger[_0x0900('0x24')](_0x0900('0x21'),_0x40bfa0,_0x35dbd6['error']['message']);return _0x52bb65(_0x35dbd6[_0x0900('0x24')]['message']);}else{logger[_0x0900('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x40bfa0,_0x0900('0x22'));_0x52bb65(_0x35dbd6[_0x0900('0x26')][_0x0900('0x25')]);}})['catch'](function(_0x29e21c){logger['error'](_0x0900('0x21'),_0x40bfa0,_0x29e21c);_0x3594fd(_0x29e21c);});});}function respondWithStatusCode(_0x369f5a,_0xce8f6e){_0xce8f6e=_0xce8f6e||0xcc;return function(_0x3a6517){if(_0x3a6517){return _0x369f5a[_0x0900('0x27')](_0xce8f6e);}return _0x369f5a[_0x0900('0x28')](_0xce8f6e)[_0x0900('0x29')]();};}function respondWithResult(_0x51fe9f,_0x7b6765){_0x7b6765=_0x7b6765||0xc8;return function(_0x34d63f){if(_0x34d63f){return _0x51fe9f[_0x0900('0x28')](_0x7b6765)['json'](_0x34d63f);}};}function respondWithFilteredResult(_0x574307,_0x51ee3a){return function(_0x5e39cf){if(_0x5e39cf){var _0x23c627=_0x5e39cf['count'],_0x322b9f=_0x51ee3a[_0x0900('0x2a')],_0x48bd3b=_0x51ee3a[_0x0900('0x2a')]+_0x51ee3a[_0x0900('0x2b')],_0x3d18bc;if(_0x48bd3b>=_0x23c627){_0x48bd3b=_0x23c627;_0x3d18bc=0xc8;}else{_0x3d18bc=0xce;}_0x574307[_0x0900('0x28')](_0x3d18bc);return _0x574307[_0x0900('0x2c')](_0x0900('0x2d'),_0x322b9f+'-'+_0x48bd3b+'/'+_0x23c627)['json'](_0x5e39cf);}return null;};}function patchUpdates(_0x102d9c){return function(_0x4fafa9){try{jsonpatch[_0x0900('0x2e')](_0x4fafa9,_0x102d9c,!![]);}catch(_0x2d3ec4){return BPromise[_0x0900('0x2f')](_0x2d3ec4);}return _0x4fafa9['save']();};}function saveUpdates(_0x3708f1,_0x419f94){return function(_0x238efb){if(_0x238efb){return _0x238efb[_0x0900('0x30')](_0x3708f1)['then'](function(_0xf42ef5){return _0xf42ef5;});}return null;};}function removeEntity(_0x4a2213,_0x44cf3d){return function(_0x3b779f){if(_0x3b779f){return _0x3b779f[_0x0900('0x31')]()[_0x0900('0x32')](function(){_0x4a2213[_0x0900('0x28')](0xcc)[_0x0900('0x29')]();});}};}function handleEntityNotFound(_0x5c1898,_0x1eb0fc){return function(_0xd5485){if(!_0xd5485){_0x5c1898[_0x0900('0x27')](0x194);}return _0xd5485;};}function handleError(_0x5e6ea7,_0xac1842){_0xac1842=_0xac1842||0x1f4;return function(_0x215163){logger[_0x0900('0x24')](_0x215163[_0x0900('0x33')]);if(_0x215163[_0x0900('0x34')]){delete _0x215163[_0x0900('0x34')];}_0x5e6ea7[_0x0900('0x28')](_0xac1842)[_0x0900('0x35')](_0x215163);};}exports['index']=function(_0x4d67ad,_0x5017c5){var _0x19b7dc={},_0x32c50d={},_0x2ffc42={'count':0x0,'rows':[]};var _0x50532f=_['map'](db[_0x0900('0x36')][_0x0900('0x37')],function(_0x18dac7){return{'name':_0x18dac7['fieldName'],'type':_0x18dac7[_0x0900('0x38')][_0x0900('0x39')]};});_0x32c50d[_0x0900('0x3a')]=_[_0x0900('0x3b')](_0x50532f,_0x0900('0x34'));_0x32c50d[_0x0900('0x3c')]=_[_0x0900('0x3d')](_0x4d67ad[_0x0900('0x3c')]);_0x32c50d[_0x0900('0x3e')]=_[_0x0900('0x3f')](_0x32c50d['model'],_0x32c50d['query']);_0x19b7dc['attributes']=_[_0x0900('0x3f')](_0x32c50d[_0x0900('0x3a')],qs[_0x0900('0x40')](_0x4d67ad[_0x0900('0x3c')][_0x0900('0x40')]));_0x19b7dc[_0x0900('0x41')]=_0x19b7dc[_0x0900('0x41')][_0x0900('0x42')]?_0x19b7dc[_0x0900('0x41')]:_0x32c50d[_0x0900('0x3a')];if(!_0x4d67ad[_0x0900('0x3c')][_0x0900('0x43')](_0x0900('0x44'))){_0x19b7dc[_0x0900('0x2b')]=qs[_0x0900('0x2b')](_0x4d67ad['query'][_0x0900('0x2b')]);_0x19b7dc[_0x0900('0x2a')]=qs[_0x0900('0x2a')](_0x4d67ad[_0x0900('0x3c')][_0x0900('0x2a')]);}_0x19b7dc[_0x0900('0x45')]=qs[_0x0900('0x46')](_0x4d67ad[_0x0900('0x3c')][_0x0900('0x46')]);_0x19b7dc[_0x0900('0x47')]=qs[_0x0900('0x3e')](_['pick'](_0x4d67ad[_0x0900('0x3c')],_0x32c50d[_0x0900('0x3e')]),_0x50532f);if(_0x4d67ad[_0x0900('0x3c')][_0x0900('0x48')]){_0x19b7dc[_0x0900('0x47')]=_[_0x0900('0x49')](_0x19b7dc['where'],{'$or':_['map'](_0x50532f,function(_0x30df33){if(_0x30df33[_0x0900('0x38')]!==_0x0900('0x4a')){var _0x3f23a4={};_0x3f23a4[_0x30df33[_0x0900('0x34')]]={'$like':'%'+_0x4d67ad['query']['filter']+'%'};return _0x3f23a4;}})});}_0x19b7dc=_[_0x0900('0x49')]({},_0x19b7dc,_0x4d67ad[_0x0900('0x4b')]);var _0x1a760b={'where':_0x19b7dc[_0x0900('0x47')]};return db[_0x0900('0x36')][_0x0900('0x4c')](_0x1a760b)[_0x0900('0x32')](function(_0x25a7ea){_0x2ffc42[_0x0900('0x4c')]=_0x25a7ea;if(_0x4d67ad[_0x0900('0x3c')][_0x0900('0x4d')]){_0x19b7dc[_0x0900('0x4e')]=[{'all':!![]}];}return db[_0x0900('0x36')][_0x0900('0x4f')](_0x19b7dc);})[_0x0900('0x32')](function(_0x8cc6de){_0x2ffc42['rows']=_0x8cc6de;return _0x2ffc42;})['then'](respondWithFilteredResult(_0x5017c5,_0x19b7dc))[_0x0900('0x50')](handleError(_0x5017c5,null));};exports[_0x0900('0x51')]=function(_0x11ad29,_0x1aa982){var _0x115d1d={'raw':![],'where':{'id':_0x11ad29[_0x0900('0x52')]['id']}},_0x198936={};_0x198936[_0x0900('0x3a')]=_[_0x0900('0x3d')](db[_0x0900('0x36')][_0x0900('0x37')]);_0x198936[_0x0900('0x3c')]=_[_0x0900('0x3d')](_0x11ad29['query']);_0x198936[_0x0900('0x3e')]=_[_0x0900('0x3f')](_0x198936['model'],_0x198936[_0x0900('0x3c')]);_0x115d1d[_0x0900('0x41')]=_['intersection'](_0x198936[_0x0900('0x3a')],qs['fields'](_0x11ad29[_0x0900('0x3c')][_0x0900('0x40')]));_0x115d1d[_0x0900('0x41')]=_0x115d1d[_0x0900('0x41')][_0x0900('0x42')]?_0x115d1d[_0x0900('0x41')]:_0x198936[_0x0900('0x3a')];if(_0x11ad29[_0x0900('0x3c')][_0x0900('0x4d')]){_0x115d1d['include']=[{'all':!![]}];}_0x115d1d=_['merge']({},_0x115d1d,_0x11ad29[_0x0900('0x4b')]);return db[_0x0900('0x36')][_0x0900('0x53')](_0x115d1d)[_0x0900('0x32')](handleEntityNotFound(_0x1aa982,null))[_0x0900('0x32')](respondWithResult(_0x1aa982,null))['catch'](handleError(_0x1aa982,null));};exports[_0x0900('0x54')]=function(_0xff0e6c,_0x5a9923){return db['ZendeskAccount'][_0x0900('0x54')](_0xff0e6c[_0x0900('0x55')],{})[_0x0900('0x32')](respondWithResult(_0x5a9923,0xc9))[_0x0900('0x50')](handleError(_0x5a9923,null));};exports[_0x0900('0x30')]=function(_0x27cc15,_0x1b718d){if(_0x27cc15[_0x0900('0x55')]['id']){delete _0x27cc15[_0x0900('0x55')]['id'];}return db['ZendeskAccount'][_0x0900('0x53')]({'where':{'id':_0x27cc15[_0x0900('0x52')]['id']}})[_0x0900('0x32')](handleEntityNotFound(_0x1b718d,null))[_0x0900('0x32')](saveUpdates(_0x27cc15[_0x0900('0x55')],null))[_0x0900('0x32')](respondWithResult(_0x1b718d,null))[_0x0900('0x50')](handleError(_0x1b718d,null));};exports[_0x0900('0x31')]=function(_0x370b40,_0x3bf5c8){return db[_0x0900('0x36')][_0x0900('0x53')]({'where':{'id':_0x370b40['params']['id']}})['then'](handleEntityNotFound(_0x3bf5c8,null))['then'](removeEntity(_0x3bf5c8,null))['catch'](handleError(_0x3bf5c8,null));};exports['getConfigurations']=function(_0x357c96,_0x56f35c,_0x266289){var _0x5661ba={};var _0x277eaa={};var _0x4b05c9;var _0x28384d;return db[_0x0900('0x36')][_0x0900('0x56')]({'where':{'id':_0x357c96['params']['id']}})['then'](handleEntityNotFound(_0x56f35c,null))[_0x0900('0x32')](function(_0x4c1f03){if(_0x4c1f03){_0x4b05c9=_0x4c1f03;_0x277eaa[_0x0900('0x3a')]=_[_0x0900('0x3d')](db['ZendeskConfiguration'][_0x0900('0x37')]);_0x277eaa[_0x0900('0x3c')]=_[_0x0900('0x3d')](_0x357c96[_0x0900('0x3c')]);_0x277eaa[_0x0900('0x3e')]=_[_0x0900('0x3f')](_0x277eaa[_0x0900('0x3a')],_0x277eaa[_0x0900('0x3c')]);_0x5661ba[_0x0900('0x41')]=_[_0x0900('0x3f')](_0x277eaa['model'],qs[_0x0900('0x40')](_0x357c96[_0x0900('0x3c')][_0x0900('0x40')]));_0x5661ba[_0x0900('0x41')]=_0x5661ba[_0x0900('0x41')][_0x0900('0x42')]?_0x5661ba[_0x0900('0x41')]:_0x277eaa['model'];_0x5661ba[_0x0900('0x45')]=qs['sort'](_0x357c96['query'][_0x0900('0x46')]);_0x5661ba['where']=qs[_0x0900('0x3e')](_['pick'](_0x357c96[_0x0900('0x3c')],_0x277eaa[_0x0900('0x3e')]));if(_0x357c96['query'][_0x0900('0x48')]){_0x5661ba[_0x0900('0x47')]=_['merge'](_0x5661ba['where'],{'$or':_[_0x0900('0x3b')](_0x5661ba['attributes'],function(_0x5d23f7){var _0x1ea5cf={};_0x1ea5cf[_0x5d23f7]={'$like':'%'+_0x357c96[_0x0900('0x3c')][_0x0900('0x48')]+'%'};return _0x1ea5cf;})});}_0x5661ba=_[_0x0900('0x49')]({},_0x5661ba,_0x357c96[_0x0900('0x4b')]);return _0x4b05c9[_0x0900('0x57')](_0x5661ba);}})[_0x0900('0x32')](function(_0x2910e4){if(_0x2910e4){_0x28384d=_0x2910e4[_0x0900('0x42')];if(!_0x357c96[_0x0900('0x3c')]['hasOwnProperty'](_0x0900('0x44'))){_0x5661ba['limit']=qs[_0x0900('0x2b')](_0x357c96[_0x0900('0x3c')][_0x0900('0x2b')]);_0x5661ba[_0x0900('0x2a')]=qs['offset'](_0x357c96[_0x0900('0x3c')]['offset']);}return _0x4b05c9[_0x0900('0x57')](_0x5661ba);}})[_0x0900('0x32')](function(_0x56c547){if(_0x56c547){return _0x56c547?{'count':_0x28384d,'rows':_0x56c547}:null;}})['then'](respondWithResult(_0x56f35c,null))['catch'](handleError(_0x56f35c,null));};exports[_0x0900('0x58')]=function(_0x2634de,_0x1365ae,_0x495a60){if(_0x2634de[_0x0900('0x55')]['id']){delete _0x2634de['body']['id'];}return db[_0x0900('0x36')][_0x0900('0x56')]({'where':{'id':_0x2634de[_0x0900('0x52')]['id']}})[_0x0900('0x32')](handleEntityNotFound(_0x1365ae,null))[_0x0900('0x32')](function(_0x588a82){if(_0x588a82){_0x2634de[_0x0900('0x55')][_0x0900('0x59')]=_0x588a82['id'];_0x2634de['body'][_0x0900('0x5a')]=integrations['getSubjects'](_0x2634de[_0x0900('0x55')]['channel'],_0x2634de[_0x0900('0x55')][_0x0900('0x38')]);_0x2634de[_0x0900('0x55')][_0x0900('0x5b')]=integrations[_0x0900('0x5c')](_0x2634de['body'][_0x0900('0x5d')],_0x2634de[_0x0900('0x55')][_0x0900('0x38')]);return db[_0x0900('0x5e')][_0x0900('0x54')](_0x2634de[_0x0900('0x55')],{'include':[{'model':db[_0x0900('0x5f')],'as':'Subjects'},{'model':db[_0x0900('0x5f')],'as':'Descriptions'}]});}return null;})[_0x0900('0x32')](respondWithResult(_0x1365ae,null))[_0x0900('0x50')](handleError(_0x1365ae,null));};exports['getFields']=function(_0xdde429,_0x421c3c,_0x59ee95){var _0x55f7c9='';return db[_0x0900('0x36')][_0x0900('0x56')]({'where':{'id':_0xdde429[_0x0900('0x52')]['id']},'attributes':['id','username','password',_0x0900('0x60'),'authType','remoteUri']})[_0x0900('0x32')](handleEntityNotFound(_0x421c3c,null))['then'](function(_0x506380){if(_0x506380){_0x55f7c9=_0x506380[_0x0900('0x61')];var _0x574345=_0x55f7c9[_0x0900('0x62')](-0x1);if(_0x574345==='/'){_0x55f7c9=_0x55f7c9[_0x0900('0x63')](0x0,_0x55f7c9[_0x0900('0x64')](_0x574345));}var _0x31eecb={'method':'GET','uri':util[_0x0900('0x65')]('%s/%s',_0x55f7c9,_0x0900('0x66')),'json':!![]};switch(_0x506380[_0x0900('0x67')]){case _0x0900('0x68'):_0x31eecb[_0x0900('0x69')]={'Authorization':util[_0x0900('0x65')](_0x0900('0x6a'),new Buffer(util[_0x0900('0x65')](_0x0900('0x6b'),_0x506380[_0x0900('0x6c')],_0x506380[_0x0900('0x68')]))[_0x0900('0x6d')](_0x0900('0x6e')))};break;case _0x0900('0x60'):_0x31eecb[_0x0900('0x69')]={'Authorization':util[_0x0900('0x65')](_0x0900('0x6a'),new Buffer(util[_0x0900('0x65')](_0x0900('0x6f'),_0x506380[_0x0900('0x6c')],_0x506380[_0x0900('0x60')]))[_0x0900('0x6d')](_0x0900('0x6e')))};break;default:throw new db[(_0x0900('0x70'))][(_0x0900('0x71'))](_0x0900('0x72'));}return rp(_0x31eecb);}})[_0x0900('0x32')](function(_0x1effe3){if(_0x1effe3){var _0x2ead6a=[_0x0900('0x73'),_0x0900('0x74'),'group','assignee'];_[_0x0900('0x75')](_0x1effe3[_0x0900('0x66')],function(_0x22523c){return _0x2ead6a[_0x0900('0x76')](_0x22523c['type']);});return{'count':_0x1effe3['ticket_fields'][_0x0900('0x42')],'rows':_[_0x0900('0x3b')](_0x1effe3['ticket_fields'],function(_0x117a59){return{'id':_0x117a59['id'],'name':_0x117a59[_0x0900('0x77')]>0x7?_0x117a59[_0x0900('0x78')]:_0x117a59[_0x0900('0x38')],'custom':_0x117a59[_0x0900('0x77')]>0x7?!![]:![],'options':_0x117a59[_0x0900('0x79')]?_0x117a59[_0x0900('0x79')]:_0x117a59[_0x0900('0x7a')]?_0x117a59['custom_field_options']:[]};})};}})[_0x0900('0x32')](respondWithResult(_0x421c3c,null))[_0x0900('0x50')](function(_0x50ab9f){var _0x1fce2c=_0xdde429[_0x0900('0x3c')][_0x0900('0x7b')]?0x1f4:_0x50ab9f[_0x0900('0x7c')]||0x1f4;logger[_0x0900('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1fce2c,JSON[_0x0900('0x23')](_0x50ab9f));delete _0x50ab9f[_0x0900('0x34')];if(_0x1fce2c===0x191){_0x1fce2c=0x190;}_0x421c3c[_0x0900('0x28')](_0x1fce2c)[_0x0900('0x35')](_0xdde429[_0x0900('0x3c')][_0x0900('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x50ab9f[_0x0900('0x7c')]}:_0x50ab9f);});}; \ No newline at end of file +var _0x2621=['save','update','destroy','end','sendStatus','send','index','map','ZendeskAccount','rawAttributes','key','model','query','attributes','fields','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','length','pick','hasOwnProperty','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','name','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskAccount,\x20%s,\x20%s','status','json','count','offset','limit','set','apply','reject'];(function(_0x1a73c6,_0x1c7624){var _0x31908b=function(_0xe6fecd){while(--_0xe6fecd){_0x1a73c6['push'](_0x1a73c6['shift']());}};_0x31908b(++_0x1c7624);}(_0x2621,0x1d2));var _0x1262=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2621[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1262('0x0'));var emlformat=require(_0x1262('0x1'));var rimraf=require(_0x1262('0x2'));var zipdir=require(_0x1262('0x3'));var jsonpatch=require(_0x1262('0x4'));var rp=require(_0x1262('0x5'));var moment=require(_0x1262('0x6'));var BPromise=require(_0x1262('0x7'));var Mustache=require(_0x1262('0x8'));var util=require(_0x1262('0x9'));var path=require(_0x1262('0xa'));var sox=require(_0x1262('0xb'));var csv=require(_0x1262('0xc'));var ejs=require(_0x1262('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1262('0xe'));var crypto=require('crypto');var jsforce=require(_0x1262('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1262('0xc'));var querystring=require(_0x1262('0x10'));var Papa=require(_0x1262('0x11'));var Redis=require('ioredis');var authService=require(_0x1262('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1262('0x13'));var hardwareService=require(_0x1262('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1262('0x15'));var config=require(_0x1262('0x16'));var licenseUtil=require(_0x1262('0x17'));var db=require(_0x1262('0x18'))['db'];var integrations=require(_0x1262('0x19'));var jayson=require(_0x1262('0x1a'));var client=jayson['client'][_0x1262('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x16ee80,_0x1e5837,_0x566bb2,_0x36b4ee){return new BPromise(function(_0x3a66b0,_0x4bb535){var _0x58df0c=_0x36b4ee||client;return _0x58df0c[_0x1262('0x1c')](_0x16ee80,_0x566bb2)[_0x1262('0x1d')](function(_0x5a91b7){logger[_0x1262('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x1e5837,_0x1262('0x1f'));logger[_0x1262('0x20')](_0x1262('0x21'),_0x1e5837,_0x1262('0x1f'),JSON[_0x1262('0x22')](_0x5a91b7));if(_0x5a91b7[_0x1262('0x23')]){if(_0x5a91b7[_0x1262('0x23')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1e5837,_0x5a91b7[_0x1262('0x23')][_0x1262('0x24')]);return _0x4bb535(_0x5a91b7['error']['message']);}logger[_0x1262('0x23')](_0x1262('0x25'),_0x1e5837,_0x5a91b7['error'][_0x1262('0x24')]);return _0x3a66b0(_0x5a91b7[_0x1262('0x23')][_0x1262('0x24')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x1e5837,_0x1262('0x1f'));_0x3a66b0(_0x5a91b7['result']['message']);}})['catch'](function(_0x1fe803){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1e5837,_0x1fe803);_0x4bb535(_0x1fe803);});});}function respondWithStatusCode(_0x2aa124,_0x386b91){_0x386b91=_0x386b91||0xcc;return function(_0x5b6786){if(_0x5b6786){return _0x2aa124['sendStatus'](_0x386b91);}return _0x2aa124[_0x1262('0x26')](_0x386b91)['end']();};}function respondWithResult(_0x4e8b70,_0x343bd1){_0x343bd1=_0x343bd1||0xc8;return function(_0x4e285e){if(_0x4e285e){return _0x4e8b70[_0x1262('0x26')](_0x343bd1)[_0x1262('0x27')](_0x4e285e);}};}function respondWithFilteredResult(_0x167db1,_0xac1fb6){return function(_0x26af44){if(_0x26af44){var _0x3b6533=_0x26af44[_0x1262('0x28')],_0x3044f6=_0xac1fb6[_0x1262('0x29')],_0x1229da=_0xac1fb6[_0x1262('0x29')]+_0xac1fb6[_0x1262('0x2a')],_0x39a53b;if(_0x1229da>=_0x3b6533){_0x1229da=_0x3b6533;_0x39a53b=0xc8;}else{_0x39a53b=0xce;}_0x167db1[_0x1262('0x26')](_0x39a53b);return _0x167db1[_0x1262('0x2b')]('Content-Range',_0x3044f6+'-'+_0x1229da+'/'+_0x3b6533)[_0x1262('0x27')](_0x26af44);}return null;};}function patchUpdates(_0x179b32){return function(_0x58af53){try{jsonpatch[_0x1262('0x2c')](_0x58af53,_0x179b32,!![]);}catch(_0x53c596){return BPromise[_0x1262('0x2d')](_0x53c596);}return _0x58af53[_0x1262('0x2e')]();};}function saveUpdates(_0x37e5a0,_0x2fe4ba){return function(_0x341488){if(_0x341488){return _0x341488[_0x1262('0x2f')](_0x37e5a0)[_0x1262('0x1d')](function(_0x331bc7){return _0x331bc7;});}return null;};}function removeEntity(_0x2a58d1,_0x5465fd){return function(_0x135b12){if(_0x135b12){return _0x135b12[_0x1262('0x30')]()['then'](function(){_0x2a58d1[_0x1262('0x26')](0xcc)[_0x1262('0x31')]();});}};}function handleEntityNotFound(_0x190bf0,_0x1ac818){return function(_0x5c05b4){if(!_0x5c05b4){_0x190bf0[_0x1262('0x32')](0x194);}return _0x5c05b4;};}function handleError(_0x108627,_0x12fd63){_0x12fd63=_0x12fd63||0x1f4;return function(_0x5f4d25){logger[_0x1262('0x23')](_0x5f4d25['stack']);if(_0x5f4d25['name']){delete _0x5f4d25['name'];}_0x108627[_0x1262('0x26')](_0x12fd63)[_0x1262('0x33')](_0x5f4d25);};}exports[_0x1262('0x34')]=function(_0x52a815,_0x57bb3b){var _0xb4275e={},_0x4540a2={},_0x29b931={'count':0x0,'rows':[]};var _0x1df965=_[_0x1262('0x35')](db[_0x1262('0x36')][_0x1262('0x37')],function(_0x35b70c){return{'name':_0x35b70c['fieldName'],'type':_0x35b70c['type'][_0x1262('0x38')]};});_0x4540a2[_0x1262('0x39')]=_[_0x1262('0x35')](_0x1df965,'name');_0x4540a2[_0x1262('0x3a')]=_['keys'](_0x52a815[_0x1262('0x3a')]);_0x4540a2['filters']=_['intersection'](_0x4540a2['model'],_0x4540a2[_0x1262('0x3a')]);_0xb4275e[_0x1262('0x3b')]=_['intersection'](_0x4540a2[_0x1262('0x39')],qs['fields'](_0x52a815[_0x1262('0x3a')][_0x1262('0x3c')]));_0xb4275e['attributes']=_0xb4275e[_0x1262('0x3b')]['length']?_0xb4275e[_0x1262('0x3b')]:_0x4540a2[_0x1262('0x39')];if(!_0x52a815[_0x1262('0x3a')]['hasOwnProperty']('nolimit')){_0xb4275e['limit']=qs[_0x1262('0x2a')](_0x52a815[_0x1262('0x3a')][_0x1262('0x2a')]);_0xb4275e[_0x1262('0x29')]=qs[_0x1262('0x29')](_0x52a815[_0x1262('0x3a')][_0x1262('0x29')]);}_0xb4275e[_0x1262('0x3d')]=qs[_0x1262('0x3e')](_0x52a815[_0x1262('0x3a')][_0x1262('0x3e')]);_0xb4275e[_0x1262('0x3f')]=qs[_0x1262('0x40')](_['pick'](_0x52a815['query'],_0x4540a2['filters']),_0x1df965);if(_0x52a815['query']['filter']){_0xb4275e['where']=_[_0x1262('0x41')](_0xb4275e[_0x1262('0x3f')],{'$or':_['map'](_0x1df965,function(_0x56440a){if(_0x56440a[_0x1262('0x42')]!==_0x1262('0x43')){var _0x6d9c73={};_0x6d9c73[_0x56440a['name']]={'$like':'%'+_0x52a815[_0x1262('0x3a')][_0x1262('0x44')]+'%'};return _0x6d9c73;}})});}_0xb4275e=_[_0x1262('0x41')]({},_0xb4275e,_0x52a815[_0x1262('0x45')]);var _0x3bd2b7={'where':_0xb4275e[_0x1262('0x3f')]};return db[_0x1262('0x36')]['count'](_0x3bd2b7)[_0x1262('0x1d')](function(_0x26fce9){_0x29b931[_0x1262('0x28')]=_0x26fce9;if(_0x52a815[_0x1262('0x3a')][_0x1262('0x46')]){_0xb4275e[_0x1262('0x47')]=[{'all':!![]}];}return db[_0x1262('0x36')][_0x1262('0x48')](_0xb4275e);})[_0x1262('0x1d')](function(_0x52a4c4){_0x29b931[_0x1262('0x49')]=_0x52a4c4;return _0x29b931;})[_0x1262('0x1d')](respondWithFilteredResult(_0x57bb3b,_0xb4275e))[_0x1262('0x4a')](handleError(_0x57bb3b,null));};exports[_0x1262('0x4b')]=function(_0x3a232c,_0x24185b){var _0x523bfd={'raw':![],'where':{'id':_0x3a232c['params']['id']}},_0x4f4e74={};_0x4f4e74[_0x1262('0x39')]=_[_0x1262('0x4c')](db[_0x1262('0x36')][_0x1262('0x37')]);_0x4f4e74[_0x1262('0x3a')]=_[_0x1262('0x4c')](_0x3a232c[_0x1262('0x3a')]);_0x4f4e74[_0x1262('0x40')]=_[_0x1262('0x4d')](_0x4f4e74['model'],_0x4f4e74[_0x1262('0x3a')]);_0x523bfd[_0x1262('0x3b')]=_['intersection'](_0x4f4e74[_0x1262('0x39')],qs[_0x1262('0x3c')](_0x3a232c[_0x1262('0x3a')][_0x1262('0x3c')]));_0x523bfd[_0x1262('0x3b')]=_0x523bfd[_0x1262('0x3b')]['length']?_0x523bfd['attributes']:_0x4f4e74[_0x1262('0x39')];if(_0x3a232c['query'][_0x1262('0x46')]){_0x523bfd[_0x1262('0x47')]=[{'all':!![]}];}_0x523bfd=_['merge']({},_0x523bfd,_0x3a232c[_0x1262('0x45')]);return db[_0x1262('0x36')][_0x1262('0x4e')](_0x523bfd)[_0x1262('0x1d')](handleEntityNotFound(_0x24185b,null))[_0x1262('0x1d')](respondWithResult(_0x24185b,null))[_0x1262('0x4a')](handleError(_0x24185b,null));};exports[_0x1262('0x4f')]=function(_0x2d04b1,_0x46d60f){return db[_0x1262('0x36')][_0x1262('0x4f')](_0x2d04b1[_0x1262('0x50')],{})[_0x1262('0x1d')](respondWithResult(_0x46d60f,0xc9))[_0x1262('0x4a')](handleError(_0x46d60f,null));};exports[_0x1262('0x2f')]=function(_0x5453a2,_0x48bd43){if(_0x5453a2['body']['id']){delete _0x5453a2['body']['id'];}return db[_0x1262('0x36')][_0x1262('0x4e')]({'where':{'id':_0x5453a2[_0x1262('0x51')]['id']}})[_0x1262('0x1d')](handleEntityNotFound(_0x48bd43,null))['then'](saveUpdates(_0x5453a2['body'],null))[_0x1262('0x1d')](respondWithResult(_0x48bd43,null))[_0x1262('0x4a')](handleError(_0x48bd43,null));};exports[_0x1262('0x30')]=function(_0x33d5fd,_0x1fbbea){return db['ZendeskAccount'][_0x1262('0x4e')]({'where':{'id':_0x33d5fd[_0x1262('0x51')]['id']}})[_0x1262('0x1d')](handleEntityNotFound(_0x1fbbea,null))[_0x1262('0x1d')](removeEntity(_0x1fbbea,null))[_0x1262('0x4a')](handleError(_0x1fbbea,null));};exports[_0x1262('0x52')]=function(_0x333547,_0x212cd2,_0x41c009){var _0x1340db={};var _0x56e70e={};var _0x3944d2;var _0xdcb1a;return db[_0x1262('0x36')][_0x1262('0x53')]({'where':{'id':_0x333547['params']['id']}})[_0x1262('0x1d')](handleEntityNotFound(_0x212cd2,null))[_0x1262('0x1d')](function(_0x357dea){if(_0x357dea){_0x3944d2=_0x357dea;_0x56e70e[_0x1262('0x39')]=_['keys'](db[_0x1262('0x54')]['rawAttributes']);_0x56e70e[_0x1262('0x3a')]=_[_0x1262('0x4c')](_0x333547[_0x1262('0x3a')]);_0x56e70e['filters']=_[_0x1262('0x4d')](_0x56e70e[_0x1262('0x39')],_0x56e70e['query']);_0x1340db[_0x1262('0x3b')]=_['intersection'](_0x56e70e[_0x1262('0x39')],qs['fields'](_0x333547[_0x1262('0x3a')][_0x1262('0x3c')]));_0x1340db[_0x1262('0x3b')]=_0x1340db[_0x1262('0x3b')][_0x1262('0x55')]?_0x1340db[_0x1262('0x3b')]:_0x56e70e[_0x1262('0x39')];_0x1340db[_0x1262('0x3d')]=qs[_0x1262('0x3e')](_0x333547['query'][_0x1262('0x3e')]);_0x1340db[_0x1262('0x3f')]=qs[_0x1262('0x40')](_[_0x1262('0x56')](_0x333547['query'],_0x56e70e[_0x1262('0x40')]));if(_0x333547[_0x1262('0x3a')][_0x1262('0x44')]){_0x1340db[_0x1262('0x3f')]=_[_0x1262('0x41')](_0x1340db[_0x1262('0x3f')],{'$or':_['map'](_0x1340db[_0x1262('0x3b')],function(_0x4f0588){var _0x4792a5={};_0x4792a5[_0x4f0588]={'$like':'%'+_0x333547[_0x1262('0x3a')][_0x1262('0x44')]+'%'};return _0x4792a5;})});}_0x1340db=_[_0x1262('0x41')]({},_0x1340db,_0x333547[_0x1262('0x45')]);return _0x3944d2[_0x1262('0x52')](_0x1340db);}})[_0x1262('0x1d')](function(_0x3abb41){if(_0x3abb41){_0xdcb1a=_0x3abb41[_0x1262('0x55')];if(!_0x333547[_0x1262('0x3a')][_0x1262('0x57')]('nolimit')){_0x1340db[_0x1262('0x2a')]=qs[_0x1262('0x2a')](_0x333547[_0x1262('0x3a')]['limit']);_0x1340db[_0x1262('0x29')]=qs[_0x1262('0x29')](_0x333547[_0x1262('0x3a')]['offset']);}return _0x3944d2[_0x1262('0x52')](_0x1340db);}})[_0x1262('0x1d')](function(_0x17ea32){if(_0x17ea32){return _0x17ea32?{'count':_0xdcb1a,'rows':_0x17ea32}:null;}})['then'](respondWithResult(_0x212cd2,null))[_0x1262('0x4a')](handleError(_0x212cd2,null));};exports[_0x1262('0x58')]=function(_0x565b2a,_0x34e0d8,_0x2eb8ad){if(_0x565b2a[_0x1262('0x50')]['id']){delete _0x565b2a[_0x1262('0x50')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x565b2a[_0x1262('0x51')]['id']}})[_0x1262('0x1d')](handleEntityNotFound(_0x34e0d8,null))[_0x1262('0x1d')](function(_0x39f951){if(_0x39f951){_0x565b2a[_0x1262('0x50')]['AccountId']=_0x39f951['id'];_0x565b2a[_0x1262('0x50')][_0x1262('0x59')]=integrations['getSubjects'](_0x565b2a[_0x1262('0x50')][_0x1262('0x5a')],_0x565b2a[_0x1262('0x50')][_0x1262('0x42')]);_0x565b2a['body'][_0x1262('0x5b')]=integrations[_0x1262('0x5c')](_0x565b2a['body'][_0x1262('0x5a')],_0x565b2a['body'][_0x1262('0x42')]);return db[_0x1262('0x54')][_0x1262('0x4f')](_0x565b2a[_0x1262('0x50')],{'include':[{'model':db[_0x1262('0x5d')],'as':_0x1262('0x59')},{'model':db[_0x1262('0x5d')],'as':_0x1262('0x5b')}]});}return null;})[_0x1262('0x1d')](respondWithResult(_0x34e0d8,null))[_0x1262('0x4a')](handleError(_0x34e0d8,null));};exports['getFields']=function(_0xa71023,_0x3fbad8,_0x14fa44){var _0x19dad5='';return db['ZendeskAccount'][_0x1262('0x53')]({'where':{'id':_0xa71023[_0x1262('0x51')]['id']},'attributes':['id',_0x1262('0x5e'),_0x1262('0x5f'),_0x1262('0x60'),_0x1262('0x61'),_0x1262('0x62')]})[_0x1262('0x1d')](handleEntityNotFound(_0x3fbad8,null))[_0x1262('0x1d')](function(_0x26133a){if(_0x26133a){_0x19dad5=_0x26133a['remoteUri'];var _0x101481=_0x19dad5[_0x1262('0x63')](-0x1);if(_0x101481==='/'){_0x19dad5=_0x19dad5[_0x1262('0x64')](0x0,_0x19dad5[_0x1262('0x65')](_0x101481));}var _0x1c3465={'method':_0x1262('0x66'),'uri':util[_0x1262('0x67')]('%s/%s',_0x19dad5,_0x1262('0x68')),'json':!![]};switch(_0x26133a[_0x1262('0x61')]){case _0x1262('0x5f'):_0x1c3465[_0x1262('0x69')]={'Authorization':util[_0x1262('0x67')]('Basic\x20%s',new Buffer(util[_0x1262('0x67')](_0x1262('0x6a'),_0x26133a[_0x1262('0x5e')],_0x26133a[_0x1262('0x5f')]))[_0x1262('0x6b')](_0x1262('0x6c')))};break;case'token':_0x1c3465[_0x1262('0x69')]={'Authorization':util['format'](_0x1262('0x6d'),new Buffer(util[_0x1262('0x67')](_0x1262('0x6e'),_0x26133a['username'],_0x26133a['token']))[_0x1262('0x6b')]('base64'))};break;default:throw new db[(_0x1262('0x6f'))][(_0x1262('0x70'))]('Unknown\x20authentication\x20type');}return rp(_0x1c3465);}})[_0x1262('0x1d')](function(_0x55e1d5){if(_0x55e1d5){var _0x14909f=[_0x1262('0x71'),_0x1262('0x72'),_0x1262('0x73'),_0x1262('0x74')];_['remove'](_0x55e1d5[_0x1262('0x68')],function(_0x5405d1){return _0x14909f[_0x1262('0x75')](_0x5405d1[_0x1262('0x42')]);});return{'count':_0x55e1d5['ticket_fields']['length'],'rows':_[_0x1262('0x35')](_0x55e1d5['ticket_fields'],function(_0x3446c5){return{'id':_0x3446c5['id'],'name':_0x3446c5['position']>0x7?_0x3446c5[_0x1262('0x76')]:_0x3446c5[_0x1262('0x42')],'custom':_0x3446c5[_0x1262('0x77')]>0x7?!![]:![],'options':_0x3446c5[_0x1262('0x78')]?_0x3446c5['system_field_options']:_0x3446c5[_0x1262('0x79')]?_0x3446c5['custom_field_options']:[]};})};}})[_0x1262('0x1d')](respondWithResult(_0x3fbad8,null))[_0x1262('0x4a')](function(_0x1e4477){var _0x46287f=_0xa71023[_0x1262('0x3a')][_0x1262('0x7a')]?0x1f4:_0x1e4477[_0x1262('0x7b')]||0x1f4;logger[_0x1262('0x23')](_0x1262('0x7c'),_0x1262('0x7d'),_0x46287f,JSON[_0x1262('0x22')](_0x1e4477));delete _0x1e4477[_0x1262('0x7e')];if(_0x46287f===0x191){_0x46287f=0x190;}_0x3fbad8[_0x1262('0x26')](_0x46287f)[_0x1262('0x33')](_0xa71023[_0x1262('0x3a')][_0x1262('0x7a')]?{'message':_0x1262('0x7f'),'statusCode':_0x1e4477[_0x1262('0x7b')]}:_0x1e4477);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 74f68e7..bcb3b42 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 _0x00be=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','moment','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x1d1fdf,_0x33ba5a){var _0x3521d6=function(_0x53281c){while(--_0x53281c){_0x1d1fdf['push'](_0x1d1fdf['shift']());}};_0x3521d6(++_0x33ba5a);}(_0x00be,0x1e7));var _0xe00b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x00be[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xe00b('0x0'));var util=require(_0xe00b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe00b('0x2'));var BPromise=require(_0xe00b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe00b('0x4'));var config=require(_0xe00b('0x5'));var attributes=require(_0xe00b('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xe00b('0x7')]=function(_0x34b556,_0x1de612){return _0x34b556[_0xe00b('0x8')](_0xe00b('0x9'),attributes,{'tableName':_0xe00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe023=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0xe023,0x150));var _0x3e02=function(_0x3f960c,_0x13ee7a){_0x3f960c=_0x3f960c-0x0;var _0x14766e=_0xe023[_0x3f960c];return _0x14766e;};'use strict';var _=require(_0x3e02('0x0'));var util=require(_0x3e02('0x1'));var logger=require(_0x3e02('0x2'))(_0x3e02('0x3'));var moment=require('moment');var BPromise=require(_0x3e02('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e02('0x5'));var rimraf=require(_0x3e02('0x6'));var config=require(_0x3e02('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3e02('0x8'));module[_0x3e02('0x9')]=function(_0x395b5c,_0x36200b){return _0x395b5c[_0x3e02('0xa')](_0x3e02('0xb'),attributes,{'tableName':_0x3e02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index c999c28..72d96a7 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 _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0xcb91[_0x1b1a3b];return _0x385347;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index fe2e203..e5a93b4 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 _0xa420=['./intZendeskConfiguration.controller','index','get','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3a7b0c,_0x89f976){var _0x26ef80=function(_0x349baf){while(--_0x349baf){_0x3a7b0c['push'](_0x3a7b0c['shift']());}};_0x26ef80(++_0x89f976);}(_0xa420,0x96));var _0x0a42=function(_0x2f6971,_0x13c977){_0x2f6971=_0x2f6971-0x0;var _0x47d50a=_0xa420[_0x2f6971];return _0x47d50a;};'use strict';var multer=require(_0x0a42('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a42('0x1'));var express=require(_0x0a42('0x2'));var router=express[_0x0a42('0x3')]();var auth=require(_0x0a42('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a42('0x5'));var controller=require(_0x0a42('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0a42('0x7')]);router[_0x0a42('0x8')](_0x0a42('0x9'),auth['isAuthenticated'](),controller[_0x0a42('0xa')]);router['get']('/:id/fields',auth[_0x0a42('0xb')](),controller[_0x0a42('0xc')]);router[_0x0a42('0x8')](_0x0a42('0xd'),auth[_0x0a42('0xb')](),controller[_0x0a42('0xe')]);router[_0x0a42('0x8')](_0x0a42('0xf'),auth[_0x0a42('0xb')](),controller[_0x0a42('0x10')]);router[_0x0a42('0x8')](_0x0a42('0x11'),auth[_0x0a42('0xb')](),controller[_0x0a42('0x12')]);router[_0x0a42('0x13')]('/',auth[_0x0a42('0xb')](),controller[_0x0a42('0x14')]);router['post'](_0x0a42('0x11'),auth['isAuthenticated'](),controller[_0x0a42('0x15')]);router[_0x0a42('0x16')](_0x0a42('0x9'),auth[_0x0a42('0xb')](),controller[_0x0a42('0x17')]);router['delete']('/:id',auth[_0x0a42('0xb')](),controller[_0x0a42('0x18')]);module[_0x0a42('0x19')]=router; \ No newline at end of file +var _0x6176=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','update'];(function(_0x42a8f8,_0x1a996e){var _0xf682b4=function(_0x2a0864){while(--_0x2a0864){_0x42a8f8['push'](_0x42a8f8['shift']());}};_0xf682b4(++_0x1a996e);}(_0x6176,0xf3));var _0x6617=function(_0xf606ee,_0x48433c){_0xf606ee=_0xf606ee-0x0;var _0x530f9a=_0x6176[_0xf606ee];return _0x530f9a;};'use strict';var multer=require(_0x6617('0x0'));var util=require(_0x6617('0x1'));var path=require(_0x6617('0x2'));var timeout=require(_0x6617('0x3'));var express=require('express');var router=express[_0x6617('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6617('0x5'));var config=require(_0x6617('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x6617('0x7')]('/',auth[_0x6617('0x8')](),controller[_0x6617('0x9')]);router[_0x6617('0x7')](_0x6617('0xa'),auth['isAuthenticated'](),controller[_0x6617('0xb')]);router[_0x6617('0x7')]('/:id/fields',auth[_0x6617('0x8')](),controller[_0x6617('0xc')]);router[_0x6617('0x7')](_0x6617('0xd'),auth[_0x6617('0x8')](),controller['getSubjects']);router['get'](_0x6617('0xe'),auth[_0x6617('0x8')](),controller[_0x6617('0xf')]);router[_0x6617('0x7')](_0x6617('0x10'),auth[_0x6617('0x8')](),controller['getTags']);router[_0x6617('0x11')]('/',auth[_0x6617('0x8')](),controller['create']);router[_0x6617('0x11')](_0x6617('0x10'),auth[_0x6617('0x8')](),controller[_0x6617('0x12')]);router[_0x6617('0x13')](_0x6617('0xa'),auth[_0x6617('0x8')](),controller[_0x6617('0x14')]);router[_0x6617('0x15')](_0x6617('0xa'),auth['isAuthenticated'](),controller[_0x6617('0x16')]);module[_0x6617('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8e64847..b85c41f 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 _0xdb82=['STRING','sequelize','exports'];(function(_0x2b9822,_0x29d732){var _0x53e3f6=function(_0x5c11ae){while(--_0x5c11ae){_0x2b9822['push'](_0x2b9822['shift']());}};_0x53e3f6(++_0x29d732);}(_0xdb82,0x10f));var _0x2db8=function(_0x427b0c,_0x46b422){_0x427b0c=_0x427b0c-0x0;var _0x3c2509=_0xdb82[_0x427b0c];return _0x3c2509;};'use strict';var Sequelize=require(_0x2db8('0x0'));module[_0x2db8('0x1')]={'name':{'type':Sequelize[_0x2db8('0x2')]},'description':{'type':Sequelize[_0x2db8('0x2')]}}; \ No newline at end of file +var _0x60ec=['exports','STRING','sequelize'];(function(_0x42041f,_0x4b61f9){var _0x22ce6e=function(_0x370676){while(--_0x370676){_0x42041f['push'](_0x42041f['shift']());}};_0x22ce6e(++_0x4b61f9);}(_0x60ec,0x83));var _0xc60e=function(_0x5e3749,_0x48bb34){_0x5e3749=_0x5e3749-0x0;var _0x3164e3=_0x60ec[_0x5e3749];return _0x3164e3;};'use strict';var Sequelize=require(_0xc60e('0x0'));module[_0xc60e('0x1')]={'name':{'type':Sequelize[_0xc60e('0x2')]},'description':{'type':Sequelize[_0xc60e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index da6690e..b935637 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 _0x2662=['mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','ZendeskConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','update','body','find','getFields','findOne','ZendeskField','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x519de3,_0xe7c04e){var _0x3e21d9=function(_0x1c98fb){while(--_0x1c98fb){_0x519de3['push'](_0x519de3['shift']());}};_0x3e21d9(++_0xe7c04e);}(_0x2662,0x17e));var _0x2266=function(_0x210bcb,_0x775cd0){_0x210bcb=_0x210bcb-0x0;var _0x4a6551=_0x2662[_0x210bcb];return _0x4a6551;};'use strict';var pdf=require(_0x2266('0x0'));var emlformat=require(_0x2266('0x1'));var rimraf=require(_0x2266('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2266('0x3'));var moment=require(_0x2266('0x4'));var BPromise=require(_0x2266('0x5'));var Mustache=require(_0x2266('0x6'));var util=require(_0x2266('0x7'));var path=require(_0x2266('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2266('0x9'));var fs=require('fs');var _=require(_0x2266('0xa'));var squel=require('squel');var crypto=require(_0x2266('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2266('0xc'));var toCsv=require(_0x2266('0xd'));var querystring=require(_0x2266('0xe'));var Papa=require(_0x2266('0xf'));var Redis=require(_0x2266('0x10'));var authService=require(_0x2266('0x11'));var qs=require(_0x2266('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2266('0x13'));var logger=require(_0x2266('0x14'))('api');var utils=require(_0x2266('0x15'));var config=require(_0x2266('0x16'));var licenseUtil=require(_0x2266('0x17'));var db=require(_0x2266('0x18'))['db'];var jayson=require(_0x2266('0x19'));var client=jayson[_0x2266('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x546d28,_0x30ddbd,_0x18c30f,_0x252170){return new BPromise(function(_0x277069,_0x2f3515){var _0x5dafda=_0x252170||client;return _0x5dafda['request'](_0x546d28,_0x18c30f)[_0x2266('0x1b')](function(_0x41c438){logger['info'](_0x2266('0x1c'),_0x30ddbd,_0x2266('0x1d'));logger[_0x2266('0x1e')](_0x2266('0x1f'),_0x30ddbd,_0x2266('0x1d'),JSON[_0x2266('0x20')](_0x41c438));if(_0x41c438[_0x2266('0x21')]){if(_0x41c438[_0x2266('0x21')]['code']===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x30ddbd,_0x41c438[_0x2266('0x21')][_0x2266('0x22')]);return _0x2f3515(_0x41c438[_0x2266('0x21')][_0x2266('0x22')]);}logger[_0x2266('0x21')](_0x2266('0x1c'),_0x30ddbd,_0x41c438['error']['message']);return _0x277069(_0x41c438['error'][_0x2266('0x22')]);}else{logger[_0x2266('0x23')](_0x2266('0x1c'),_0x30ddbd,_0x2266('0x1d'));_0x277069(_0x41c438[_0x2266('0x24')][_0x2266('0x22')]);}})[_0x2266('0x25')](function(_0x16ff90){logger[_0x2266('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x30ddbd,_0x16ff90);_0x2f3515(_0x16ff90);});});}function respondWithStatusCode(_0x2bf342,_0x7e1dd1){_0x7e1dd1=_0x7e1dd1||0xcc;return function(_0x3f6b64){if(_0x3f6b64){return _0x2bf342[_0x2266('0x26')](_0x7e1dd1);}return _0x2bf342[_0x2266('0x27')](_0x7e1dd1)[_0x2266('0x28')]();};}function respondWithResult(_0x5b17ab,_0x327c57){_0x327c57=_0x327c57||0xc8;return function(_0xabd020){if(_0xabd020){return _0x5b17ab[_0x2266('0x27')](_0x327c57)[_0x2266('0x29')](_0xabd020);}};}function respondWithFilteredResult(_0x3d34e2,_0x588e07){return function(_0x1a9839){if(_0x1a9839){var _0x244189=_0x1a9839[_0x2266('0x2a')],_0x31723c=_0x588e07[_0x2266('0x2b')],_0x406d7c=_0x588e07[_0x2266('0x2b')]+_0x588e07[_0x2266('0x2c')],_0x30c0bc;if(_0x406d7c>=_0x244189){_0x406d7c=_0x244189;_0x30c0bc=0xc8;}else{_0x30c0bc=0xce;}_0x3d34e2[_0x2266('0x27')](_0x30c0bc);return _0x3d34e2[_0x2266('0x2d')](_0x2266('0x2e'),_0x31723c+'-'+_0x406d7c+'/'+_0x244189)[_0x2266('0x29')](_0x1a9839);}return null;};}function patchUpdates(_0x55eb3a){return function(_0x269f74){try{jsonpatch[_0x2266('0x2f')](_0x269f74,_0x55eb3a,!![]);}catch(_0x17c982){return BPromise[_0x2266('0x30')](_0x17c982);}return _0x269f74[_0x2266('0x31')]();};}function saveUpdates(_0x3223ae,_0x233ecc){return function(_0x1f94d){if(_0x1f94d){return _0x1f94d['update'](_0x3223ae)[_0x2266('0x1b')](function(_0x3900eb){return _0x3900eb;});}return null;};}function removeEntity(_0x1a826c,_0x838c80){return function(_0x25d51d){if(_0x25d51d){return _0x25d51d[_0x2266('0x32')]()[_0x2266('0x1b')](function(){_0x1a826c['status'](0xcc)[_0x2266('0x28')]();});}};}function handleEntityNotFound(_0x2d702c,_0x358850){return function(_0x4877bc){if(!_0x4877bc){_0x2d702c[_0x2266('0x26')](0x194);}return _0x4877bc;};}function handleError(_0x5b4d4a,_0x1da800){_0x1da800=_0x1da800||0x1f4;return function(_0xe77550){logger[_0x2266('0x21')](_0xe77550[_0x2266('0x33')]);if(_0xe77550[_0x2266('0x34')]){delete _0xe77550[_0x2266('0x34')];}_0x5b4d4a[_0x2266('0x27')](_0x1da800)[_0x2266('0x35')](_0xe77550);};}exports[_0x2266('0x36')]=function(_0x5ef739,_0x55a06a){var _0x50df4e={},_0x2a4462={},_0x1c2d81={'count':0x0,'rows':[]};var _0x3fc4be=_[_0x2266('0x37')](db[_0x2266('0x38')]['rawAttributes'],function(_0x1e82fe){return{'name':_0x1e82fe['fieldName'],'type':_0x1e82fe[_0x2266('0x39')][_0x2266('0x3a')]};});_0x2a4462[_0x2266('0x3b')]=_[_0x2266('0x37')](_0x3fc4be,_0x2266('0x34'));_0x2a4462[_0x2266('0x3c')]=_[_0x2266('0x3d')](_0x5ef739['query']);_0x2a4462[_0x2266('0x3e')]=_[_0x2266('0x3f')](_0x2a4462[_0x2266('0x3b')],_0x2a4462[_0x2266('0x3c')]);_0x50df4e[_0x2266('0x40')]=_[_0x2266('0x3f')](_0x2a4462['model'],qs[_0x2266('0x41')](_0x5ef739[_0x2266('0x3c')][_0x2266('0x41')]));_0x50df4e[_0x2266('0x40')]=_0x50df4e['attributes'][_0x2266('0x42')]?_0x50df4e['attributes']:_0x2a4462[_0x2266('0x3b')];if(!_0x5ef739[_0x2266('0x3c')]['hasOwnProperty']('nolimit')){_0x50df4e[_0x2266('0x2c')]=qs[_0x2266('0x2c')](_0x5ef739[_0x2266('0x3c')][_0x2266('0x2c')]);_0x50df4e[_0x2266('0x2b')]=qs[_0x2266('0x2b')](_0x5ef739['query']['offset']);}_0x50df4e[_0x2266('0x43')]=qs[_0x2266('0x44')](_0x5ef739[_0x2266('0x3c')][_0x2266('0x44')]);_0x50df4e['where']=qs[_0x2266('0x3e')](_[_0x2266('0x45')](_0x5ef739[_0x2266('0x3c')],_0x2a4462[_0x2266('0x3e')]),_0x3fc4be);if(_0x5ef739['query']['filter']){_0x50df4e['where']=_[_0x2266('0x46')](_0x50df4e[_0x2266('0x47')],{'$or':_[_0x2266('0x37')](_0x3fc4be,function(_0x5147f9){if(_0x5147f9[_0x2266('0x39')]!==_0x2266('0x48')){var _0x1850b0={};_0x1850b0[_0x5147f9[_0x2266('0x34')]]={'$like':'%'+_0x5ef739[_0x2266('0x3c')][_0x2266('0x49')]+'%'};return _0x1850b0;}})});}_0x50df4e=_[_0x2266('0x46')]({},_0x50df4e,_0x5ef739[_0x2266('0x4a')]);var _0x55f0ec={'where':_0x50df4e[_0x2266('0x47')]};return db[_0x2266('0x38')][_0x2266('0x2a')](_0x55f0ec)[_0x2266('0x1b')](function(_0x4598b8){_0x1c2d81[_0x2266('0x2a')]=_0x4598b8;if(_0x5ef739[_0x2266('0x3c')][_0x2266('0x4b')]){_0x50df4e[_0x2266('0x4c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x2266('0x4d')](_0x50df4e);})[_0x2266('0x1b')](function(_0x54c36a){_0x1c2d81[_0x2266('0x4e')]=_0x54c36a;return _0x1c2d81;})[_0x2266('0x1b')](respondWithFilteredResult(_0x55a06a,_0x50df4e))[_0x2266('0x25')](handleError(_0x55a06a,null));};exports[_0x2266('0x4f')]=function(_0x6299c6,_0x521e17){var _0x4c910d={'raw':![],'where':{'id':_0x6299c6[_0x2266('0x50')]['id']}},_0x31e94a={};_0x31e94a[_0x2266('0x3b')]=_['keys'](db[_0x2266('0x38')][_0x2266('0x51')]);_0x31e94a[_0x2266('0x3c')]=_[_0x2266('0x3d')](_0x6299c6[_0x2266('0x3c')]);_0x31e94a[_0x2266('0x3e')]=_[_0x2266('0x3f')](_0x31e94a[_0x2266('0x3b')],_0x31e94a[_0x2266('0x3c')]);_0x4c910d[_0x2266('0x40')]=_[_0x2266('0x3f')](_0x31e94a[_0x2266('0x3b')],qs[_0x2266('0x41')](_0x6299c6[_0x2266('0x3c')][_0x2266('0x41')]));_0x4c910d[_0x2266('0x40')]=_0x4c910d[_0x2266('0x40')][_0x2266('0x42')]?_0x4c910d['attributes']:_0x31e94a[_0x2266('0x3b')];if(_0x6299c6[_0x2266('0x3c')][_0x2266('0x4b')]){_0x4c910d[_0x2266('0x4c')]=[{'all':!![]}];}_0x4c910d=_[_0x2266('0x46')]({},_0x4c910d,_0x6299c6[_0x2266('0x4a')]);return db[_0x2266('0x38')]['find'](_0x4c910d)[_0x2266('0x1b')](handleEntityNotFound(_0x521e17,null))[_0x2266('0x1b')](respondWithResult(_0x521e17,null))[_0x2266('0x25')](handleError(_0x521e17,null));};exports[_0x2266('0x52')]=function(_0x4814f4,_0x108a4d){return db[_0x2266('0x38')]['create'](_0x4814f4['body'],{})[_0x2266('0x1b')](respondWithResult(_0x108a4d,0xc9))[_0x2266('0x25')](handleError(_0x108a4d,null));};exports[_0x2266('0x53')]=function(_0x599d92,_0x22ac31){if(_0x599d92[_0x2266('0x54')]['id']){delete _0x599d92[_0x2266('0x54')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x599d92['params']['id']}})[_0x2266('0x1b')](handleEntityNotFound(_0x22ac31,null))[_0x2266('0x1b')](saveUpdates(_0x599d92[_0x2266('0x54')],null))[_0x2266('0x1b')](respondWithResult(_0x22ac31,null))[_0x2266('0x25')](handleError(_0x22ac31,null));};exports['destroy']=function(_0x23ac70,_0xf6c5da){return db[_0x2266('0x38')][_0x2266('0x55')]({'where':{'id':_0x23ac70[_0x2266('0x50')]['id']}})[_0x2266('0x1b')](handleEntityNotFound(_0xf6c5da,null))[_0x2266('0x1b')](removeEntity(_0xf6c5da,null))[_0x2266('0x25')](handleError(_0xf6c5da,null));};exports[_0x2266('0x56')]=function(_0x5a2387,_0x6d199a,_0x1cf95c){var _0x485b68={};var _0x3a473f={};var _0x24ccd1;var _0x396ef2;return db[_0x2266('0x38')][_0x2266('0x57')]({'where':{'id':_0x5a2387[_0x2266('0x50')]['id']}})[_0x2266('0x1b')](handleEntityNotFound(_0x6d199a,null))[_0x2266('0x1b')](function(_0x1091b9){if(_0x1091b9){_0x24ccd1=_0x1091b9;_0x3a473f[_0x2266('0x3b')]=_[_0x2266('0x3d')](db[_0x2266('0x58')][_0x2266('0x51')]);_0x3a473f[_0x2266('0x3c')]=_[_0x2266('0x3d')](_0x5a2387[_0x2266('0x3c')]);_0x3a473f[_0x2266('0x3e')]=_['intersection'](_0x3a473f[_0x2266('0x3b')],_0x3a473f[_0x2266('0x3c')]);_0x485b68[_0x2266('0x40')]=_[_0x2266('0x3f')](_0x3a473f[_0x2266('0x3b')],qs[_0x2266('0x41')](_0x5a2387['query'][_0x2266('0x41')]));_0x485b68[_0x2266('0x40')]=_0x485b68['attributes'][_0x2266('0x42')]?_0x485b68[_0x2266('0x40')]:_0x3a473f[_0x2266('0x3b')];_0x485b68['order']=qs['sort'](_0x5a2387[_0x2266('0x3c')]['sort']);_0x485b68[_0x2266('0x47')]=qs[_0x2266('0x3e')](_['pick'](_0x5a2387['query'],_0x3a473f[_0x2266('0x3e')]));if(_0x5a2387[_0x2266('0x3c')]['filter']){_0x485b68['where']=_[_0x2266('0x46')](_0x485b68[_0x2266('0x47')],{'$or':_[_0x2266('0x37')](_0x485b68[_0x2266('0x40')],function(_0x4b1b25){var _0x22e6cc={};_0x22e6cc[_0x4b1b25]={'$like':'%'+_0x5a2387['query'][_0x2266('0x49')]+'%'};return _0x22e6cc;})});}_0x485b68=_[_0x2266('0x46')]({},_0x485b68,_0x5a2387['options']);return _0x24ccd1['getFields'](_0x485b68);}})['then'](function(_0x17f265){if(_0x17f265){_0x396ef2=_0x17f265[_0x2266('0x42')];if(!_0x5a2387[_0x2266('0x3c')][_0x2266('0x59')](_0x2266('0x5a'))){_0x485b68[_0x2266('0x2c')]=qs[_0x2266('0x2c')](_0x5a2387[_0x2266('0x3c')][_0x2266('0x2c')]);_0x485b68[_0x2266('0x2b')]=qs[_0x2266('0x2b')](_0x5a2387[_0x2266('0x3c')][_0x2266('0x2b')]);}return _0x24ccd1[_0x2266('0x56')](_0x485b68);}})[_0x2266('0x1b')](function(_0x132b2b){if(_0x132b2b){return _0x132b2b?{'count':_0x396ef2,'rows':_0x132b2b}:null;}})[_0x2266('0x1b')](respondWithResult(_0x6d199a,null))[_0x2266('0x25')](handleError(_0x6d199a,null));};exports[_0x2266('0x5b')]=function(_0x219d90,_0x5f9902,_0xc0d93b){var _0x5cdc78={};var _0x332b54={};var _0x11dcea;var _0x3f4883;return db[_0x2266('0x38')][_0x2266('0x57')]({'where':{'id':_0x219d90[_0x2266('0x50')]['id']}})[_0x2266('0x1b')](handleEntityNotFound(_0x5f9902,null))[_0x2266('0x1b')](function(_0x5e2f7c){if(_0x5e2f7c){_0x11dcea=_0x5e2f7c;_0x332b54[_0x2266('0x3b')]=_[_0x2266('0x3d')](db['ZendeskField'][_0x2266('0x51')]);_0x332b54[_0x2266('0x3c')]=_['keys'](_0x219d90[_0x2266('0x3c')]);_0x332b54[_0x2266('0x3e')]=_[_0x2266('0x3f')](_0x332b54[_0x2266('0x3b')],_0x332b54[_0x2266('0x3c')]);_0x5cdc78[_0x2266('0x40')]=_[_0x2266('0x3f')](_0x332b54[_0x2266('0x3b')],qs[_0x2266('0x41')](_0x219d90['query'][_0x2266('0x41')]));_0x5cdc78[_0x2266('0x40')]=_0x5cdc78[_0x2266('0x40')][_0x2266('0x42')]?_0x5cdc78[_0x2266('0x40')]:_0x332b54[_0x2266('0x3b')];_0x5cdc78[_0x2266('0x43')]=qs[_0x2266('0x44')](_0x219d90[_0x2266('0x3c')]['sort']);_0x5cdc78['where']=qs[_0x2266('0x3e')](_['pick'](_0x219d90[_0x2266('0x3c')],_0x332b54[_0x2266('0x3e')]));if(_0x219d90[_0x2266('0x3c')][_0x2266('0x49')]){_0x5cdc78[_0x2266('0x47')]=_['merge'](_0x5cdc78[_0x2266('0x47')],{'$or':_[_0x2266('0x37')](_0x5cdc78['attributes'],function(_0x4913ed){var _0x45f891={};_0x45f891[_0x4913ed]={'$like':'%'+_0x219d90[_0x2266('0x3c')]['filter']+'%'};return _0x45f891;})});}_0x5cdc78=_[_0x2266('0x46')]({},_0x5cdc78,_0x219d90[_0x2266('0x4a')]);return _0x11dcea[_0x2266('0x5b')](_0x5cdc78);}})[_0x2266('0x1b')](function(_0x5af893){if(_0x5af893){_0x3f4883=_0x5af893[_0x2266('0x42')];if(!_0x219d90[_0x2266('0x3c')]['hasOwnProperty'](_0x2266('0x5a'))){_0x5cdc78[_0x2266('0x2c')]=qs['limit'](_0x219d90[_0x2266('0x3c')][_0x2266('0x2c')]);_0x5cdc78[_0x2266('0x2b')]=qs[_0x2266('0x2b')](_0x219d90[_0x2266('0x3c')]['offset']);}return _0x11dcea['getSubjects'](_0x5cdc78);}})[_0x2266('0x1b')](function(_0x5ed4eb){if(_0x5ed4eb){return _0x5ed4eb?{'count':_0x3f4883,'rows':_0x5ed4eb}:null;}})[_0x2266('0x1b')](respondWithResult(_0x5f9902,null))['catch'](handleError(_0x5f9902,null));};exports[_0x2266('0x5c')]=function(_0x2941ba,_0x427189,_0x1abcb1){var _0x475f30={};var _0x2cc17c={};var _0x1cb4ce;var _0x599f5f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2941ba[_0x2266('0x50')]['id']}})[_0x2266('0x1b')](handleEntityNotFound(_0x427189,null))[_0x2266('0x1b')](function(_0x39c615){if(_0x39c615){_0x1cb4ce=_0x39c615;_0x2cc17c[_0x2266('0x3b')]=_[_0x2266('0x3d')](db[_0x2266('0x58')][_0x2266('0x51')]);_0x2cc17c['query']=_[_0x2266('0x3d')](_0x2941ba[_0x2266('0x3c')]);_0x2cc17c[_0x2266('0x3e')]=_[_0x2266('0x3f')](_0x2cc17c[_0x2266('0x3b')],_0x2cc17c['query']);_0x475f30[_0x2266('0x40')]=_[_0x2266('0x3f')](_0x2cc17c[_0x2266('0x3b')],qs['fields'](_0x2941ba['query']['fields']));_0x475f30[_0x2266('0x40')]=_0x475f30[_0x2266('0x40')][_0x2266('0x42')]?_0x475f30['attributes']:_0x2cc17c[_0x2266('0x3b')];_0x475f30[_0x2266('0x43')]=qs['sort'](_0x2941ba[_0x2266('0x3c')][_0x2266('0x44')]);_0x475f30['where']=qs['filters'](_[_0x2266('0x45')](_0x2941ba[_0x2266('0x3c')],_0x2cc17c[_0x2266('0x3e')]));if(_0x2941ba[_0x2266('0x3c')][_0x2266('0x49')]){_0x475f30[_0x2266('0x47')]=_['merge'](_0x475f30[_0x2266('0x47')],{'$or':_[_0x2266('0x37')](_0x475f30[_0x2266('0x40')],function(_0x14c83c){var _0x3e3a9b={};_0x3e3a9b[_0x14c83c]={'$like':'%'+_0x2941ba['query']['filter']+'%'};return _0x3e3a9b;})});}_0x475f30=_['merge']({},_0x475f30,_0x2941ba[_0x2266('0x4a')]);return _0x1cb4ce[_0x2266('0x5c')](_0x475f30);}})['then'](function(_0x5e88e2){if(_0x5e88e2){_0x599f5f=_0x5e88e2[_0x2266('0x42')];if(!_0x2941ba[_0x2266('0x3c')]['hasOwnProperty'](_0x2266('0x5a'))){_0x475f30[_0x2266('0x2c')]=qs[_0x2266('0x2c')](_0x2941ba['query'][_0x2266('0x2c')]);_0x475f30[_0x2266('0x2b')]=qs[_0x2266('0x2b')](_0x2941ba[_0x2266('0x3c')]['offset']);}return _0x1cb4ce['getDescriptions'](_0x475f30);}})['then'](function(_0x5b354f){if(_0x5b354f){return _0x5b354f?{'count':_0x599f5f,'rows':_0x5b354f}:null;}})['then'](respondWithResult(_0x427189,null))['catch'](handleError(_0x427189,null));};exports[_0x2266('0x5d')]=function(_0x42a8b8,_0x1c7253,_0x44de4f){var _0x3d4e61={};var _0x4048b={};var _0x1a168e;var _0x132671;return db['ZendeskConfiguration'][_0x2266('0x57')]({'where':{'id':_0x42a8b8[_0x2266('0x50')]['id']}})['then'](handleEntityNotFound(_0x1c7253,null))[_0x2266('0x1b')](function(_0x5ac186){if(_0x5ac186){_0x1a168e=_0x5ac186;_0x4048b[_0x2266('0x3b')]=_[_0x2266('0x3d')](db[_0x2266('0x5e')]['rawAttributes']);_0x4048b[_0x2266('0x3c')]=_[_0x2266('0x3d')](_0x42a8b8[_0x2266('0x3c')]);_0x4048b['filters']=_[_0x2266('0x3f')](_0x4048b[_0x2266('0x3b')],_0x4048b[_0x2266('0x3c')]);_0x3d4e61[_0x2266('0x40')]=_['intersection'](_0x4048b[_0x2266('0x3b')],qs[_0x2266('0x41')](_0x42a8b8[_0x2266('0x3c')]['fields']));_0x3d4e61[_0x2266('0x40')]=_0x3d4e61['attributes'][_0x2266('0x42')]?_0x3d4e61['attributes']:_0x4048b[_0x2266('0x3b')];_0x3d4e61[_0x2266('0x43')]=qs[_0x2266('0x44')](_0x42a8b8[_0x2266('0x3c')][_0x2266('0x44')]);_0x3d4e61[_0x2266('0x47')]=qs[_0x2266('0x3e')](_['pick'](_0x42a8b8['query'],_0x4048b[_0x2266('0x3e')]));if(_0x42a8b8[_0x2266('0x3c')][_0x2266('0x49')]){_0x3d4e61[_0x2266('0x47')]=_[_0x2266('0x46')](_0x3d4e61[_0x2266('0x47')],{'$or':_[_0x2266('0x37')](_0x3d4e61[_0x2266('0x40')],function(_0x363888){var _0x397adf={};_0x397adf[_0x363888]={'$like':'%'+_0x42a8b8[_0x2266('0x3c')]['filter']+'%'};return _0x397adf;})});}_0x3d4e61=_['merge']({},_0x3d4e61,_0x42a8b8[_0x2266('0x4a')]);return _0x1a168e[_0x2266('0x5d')](_0x3d4e61);}})[_0x2266('0x1b')](function(_0x1c3da7){if(_0x1c3da7){_0x132671=_0x1c3da7[_0x2266('0x42')];if(!_0x42a8b8[_0x2266('0x3c')]['hasOwnProperty'](_0x2266('0x5a'))){_0x3d4e61['limit']=qs['limit'](_0x42a8b8[_0x2266('0x3c')][_0x2266('0x2c')]);_0x3d4e61[_0x2266('0x2b')]=qs[_0x2266('0x2b')](_0x42a8b8[_0x2266('0x3c')]['offset']);}return _0x1a168e[_0x2266('0x5d')](_0x3d4e61);}})[_0x2266('0x1b')](function(_0x1caa31){if(_0x1caa31){return _0x1caa31?{'count':_0x132671,'rows':_0x1caa31}:null;}})[_0x2266('0x1b')](respondWithResult(_0x1c7253,null))[_0x2266('0x25')](handleError(_0x1c7253,null));};exports[_0x2266('0x5f')]=function(_0x3bf597,_0x1e4da7,_0x1b3030){if(_0x3bf597['body']['id']){delete _0x3bf597[_0x2266('0x54')]['id'];}return db[_0x2266('0x38')][_0x2266('0x57')]({'where':{'id':_0x3bf597['params']['id']}})[_0x2266('0x1b')](handleEntityNotFound(_0x1e4da7,null))[_0x2266('0x1b')](function(_0x4da919){if(_0x4da919){return _0x4da919[_0x2266('0x5f')](_0x3bf597[_0x2266('0x54')][_0x2266('0x60')]||[]);}return null;})['then'](respondWithResult(_0x1e4da7,null))[_0x2266('0x25')](handleError(_0x1e4da7,null));}; \ No newline at end of file +var _0x8aea=['rows','show','params','includeAll','include','find','create','body','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','html-pdf','rimraf','zip-dir','fast-json-patch','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','../../mysqldb','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','count','offset','limit','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','ZendeskConfiguration','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8aea,0x121));var _0xa8ae=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8aea[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xa8ae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa8ae('0x1'));var zipdir=require(_0xa8ae('0x2'));var jsonpatch=require(_0xa8ae('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8ae('0x4'));var path=require('path');var sox=require(_0xa8ae('0x5'));var csv=require(_0xa8ae('0x6'));var ejs=require(_0xa8ae('0x7'));var fs=require('fs');var _=require(_0xa8ae('0x8'));var squel=require(_0xa8ae('0x9'));var crypto=require(_0xa8ae('0xa'));var jsforce=require(_0xa8ae('0xb'));var deskjs=require(_0xa8ae('0xc'));var toCsv=require(_0xa8ae('0x6'));var querystring=require(_0xa8ae('0xd'));var Papa=require(_0xa8ae('0xe'));var Redis=require(_0xa8ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa8ae('0x10'));var as=require(_0xa8ae('0x11'));var hardwareService=require(_0xa8ae('0x12'));var logger=require(_0xa8ae('0x13'))(_0xa8ae('0x14'));var utils=require(_0xa8ae('0x15'));var config=require(_0xa8ae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8ae('0x17'))['db'];var jayson=require(_0xa8ae('0x18'));var client=jayson[_0xa8ae('0x19')][_0xa8ae('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x327116,_0x1c07fe,_0x5a8848,_0x95b863){return new BPromise(function(_0x44ec0e,_0x11260e){var _0x5c00fb=_0x95b863||client;return _0x5c00fb['request'](_0x327116,_0x5a8848)[_0xa8ae('0x1b')](function(_0x29cec6){logger[_0xa8ae('0x1c')](_0xa8ae('0x1d'),_0x1c07fe,_0xa8ae('0x1e'));logger[_0xa8ae('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1c07fe,_0xa8ae('0x1e'),JSON[_0xa8ae('0x20')](_0x29cec6));if(_0x29cec6['error']){if(_0x29cec6[_0xa8ae('0x21')]['code']===0x1f4){logger[_0xa8ae('0x21')](_0xa8ae('0x1d'),_0x1c07fe,_0x29cec6[_0xa8ae('0x21')][_0xa8ae('0x22')]);return _0x11260e(_0x29cec6['error']['message']);}logger[_0xa8ae('0x21')](_0xa8ae('0x1d'),_0x1c07fe,_0x29cec6[_0xa8ae('0x21')][_0xa8ae('0x22')]);return _0x44ec0e(_0x29cec6[_0xa8ae('0x21')][_0xa8ae('0x22')]);}else{logger[_0xa8ae('0x1c')](_0xa8ae('0x1d'),_0x1c07fe,_0xa8ae('0x1e'));_0x44ec0e(_0x29cec6[_0xa8ae('0x23')][_0xa8ae('0x22')]);}})[_0xa8ae('0x24')](function(_0x1a5b90){logger['error'](_0xa8ae('0x1d'),_0x1c07fe,_0x1a5b90);_0x11260e(_0x1a5b90);});});}function respondWithStatusCode(_0x2adc9b,_0x43fec8){_0x43fec8=_0x43fec8||0xcc;return function(_0x2b72c0){if(_0x2b72c0){return _0x2adc9b['sendStatus'](_0x43fec8);}return _0x2adc9b[_0xa8ae('0x25')](_0x43fec8)[_0xa8ae('0x26')]();};}function respondWithResult(_0x59699e,_0x4424fa){_0x4424fa=_0x4424fa||0xc8;return function(_0xc9235f){if(_0xc9235f){return _0x59699e[_0xa8ae('0x25')](_0x4424fa)[_0xa8ae('0x27')](_0xc9235f);}};}function respondWithFilteredResult(_0x3ef2a2,_0x1e4f5a){return function(_0x266cf0){if(_0x266cf0){var _0x2824ca=_0x266cf0[_0xa8ae('0x28')],_0x2ccf35=_0x1e4f5a[_0xa8ae('0x29')],_0x23a58f=_0x1e4f5a['offset']+_0x1e4f5a[_0xa8ae('0x2a')],_0x5d7745;if(_0x23a58f>=_0x2824ca){_0x23a58f=_0x2824ca;_0x5d7745=0xc8;}else{_0x5d7745=0xce;}_0x3ef2a2[_0xa8ae('0x25')](_0x5d7745);return _0x3ef2a2['set']('Content-Range',_0x2ccf35+'-'+_0x23a58f+'/'+_0x2824ca)[_0xa8ae('0x27')](_0x266cf0);}return null;};}function patchUpdates(_0x421eaa){return function(_0x1b5e0){try{jsonpatch['apply'](_0x1b5e0,_0x421eaa,!![]);}catch(_0xa5d396){return BPromise[_0xa8ae('0x2b')](_0xa5d396);}return _0x1b5e0[_0xa8ae('0x2c')]();};}function saveUpdates(_0x20f4ff,_0x5e06ba){return function(_0x355b4e){if(_0x355b4e){return _0x355b4e[_0xa8ae('0x2d')](_0x20f4ff)[_0xa8ae('0x1b')](function(_0x54235b){return _0x54235b;});}return null;};}function removeEntity(_0x5396b5,_0x163d7c){return function(_0x2ae78d){if(_0x2ae78d){return _0x2ae78d['destroy']()['then'](function(){_0x5396b5[_0xa8ae('0x25')](0xcc)[_0xa8ae('0x26')]();});}};}function handleEntityNotFound(_0x4f642b,_0x1baa68){return function(_0x5536b4){if(!_0x5536b4){_0x4f642b[_0xa8ae('0x2e')](0x194);}return _0x5536b4;};}function handleError(_0xcdda38,_0x2f00d6){_0x2f00d6=_0x2f00d6||0x1f4;return function(_0x68dc1b){logger[_0xa8ae('0x21')](_0x68dc1b[_0xa8ae('0x2f')]);if(_0x68dc1b['name']){delete _0x68dc1b[_0xa8ae('0x30')];}_0xcdda38[_0xa8ae('0x25')](_0x2f00d6)[_0xa8ae('0x31')](_0x68dc1b);};}exports[_0xa8ae('0x32')]=function(_0x2ea71d,_0x30a922){var _0x48eb3f={},_0x310475={},_0x173e43={'count':0x0,'rows':[]};var _0x56b58b=_[_0xa8ae('0x33')](db['ZendeskConfiguration'][_0xa8ae('0x34')],function(_0x3df4c4){return{'name':_0x3df4c4[_0xa8ae('0x35')],'type':_0x3df4c4[_0xa8ae('0x36')][_0xa8ae('0x37')]};});_0x310475[_0xa8ae('0x38')]=_['map'](_0x56b58b,_0xa8ae('0x30'));_0x310475[_0xa8ae('0x39')]=_[_0xa8ae('0x3a')](_0x2ea71d[_0xa8ae('0x39')]);_0x310475['filters']=_[_0xa8ae('0x3b')](_0x310475[_0xa8ae('0x38')],_0x310475[_0xa8ae('0x39')]);_0x48eb3f[_0xa8ae('0x3c')]=_[_0xa8ae('0x3b')](_0x310475['model'],qs[_0xa8ae('0x3d')](_0x2ea71d['query'][_0xa8ae('0x3d')]));_0x48eb3f[_0xa8ae('0x3c')]=_0x48eb3f['attributes'][_0xa8ae('0x3e')]?_0x48eb3f[_0xa8ae('0x3c')]:_0x310475[_0xa8ae('0x38')];if(!_0x2ea71d[_0xa8ae('0x39')][_0xa8ae('0x3f')](_0xa8ae('0x40'))){_0x48eb3f[_0xa8ae('0x2a')]=qs[_0xa8ae('0x2a')](_0x2ea71d[_0xa8ae('0x39')][_0xa8ae('0x2a')]);_0x48eb3f[_0xa8ae('0x29')]=qs['offset'](_0x2ea71d[_0xa8ae('0x39')][_0xa8ae('0x29')]);}_0x48eb3f[_0xa8ae('0x41')]=qs['sort'](_0x2ea71d[_0xa8ae('0x39')][_0xa8ae('0x42')]);_0x48eb3f[_0xa8ae('0x43')]=qs[_0xa8ae('0x44')](_[_0xa8ae('0x45')](_0x2ea71d[_0xa8ae('0x39')],_0x310475[_0xa8ae('0x44')]),_0x56b58b);if(_0x2ea71d[_0xa8ae('0x39')][_0xa8ae('0x46')]){_0x48eb3f[_0xa8ae('0x43')]=_['merge'](_0x48eb3f['where'],{'$or':_['map'](_0x56b58b,function(_0x392674){if(_0x392674[_0xa8ae('0x36')]!=='VIRTUAL'){var _0x5550f2={};_0x5550f2[_0x392674[_0xa8ae('0x30')]]={'$like':'%'+_0x2ea71d[_0xa8ae('0x39')]['filter']+'%'};return _0x5550f2;}})});}_0x48eb3f=_[_0xa8ae('0x47')]({},_0x48eb3f,_0x2ea71d[_0xa8ae('0x48')]);var _0x5be37d={'where':_0x48eb3f['where']};return db[_0xa8ae('0x49')][_0xa8ae('0x28')](_0x5be37d)['then'](function(_0x354ab5){_0x173e43['count']=_0x354ab5;if(_0x2ea71d[_0xa8ae('0x39')]['includeAll']){_0x48eb3f['include']=[{'all':!![]}];}return db[_0xa8ae('0x49')][_0xa8ae('0x4a')](_0x48eb3f);})[_0xa8ae('0x1b')](function(_0x11d00a){_0x173e43[_0xa8ae('0x4b')]=_0x11d00a;return _0x173e43;})[_0xa8ae('0x1b')](respondWithFilteredResult(_0x30a922,_0x48eb3f))[_0xa8ae('0x24')](handleError(_0x30a922,null));};exports[_0xa8ae('0x4c')]=function(_0xf6f312,_0x38683c){var _0x13b48f={'raw':![],'where':{'id':_0xf6f312[_0xa8ae('0x4d')]['id']}},_0x14b200={};_0x14b200[_0xa8ae('0x38')]=_[_0xa8ae('0x3a')](db['ZendeskConfiguration'][_0xa8ae('0x34')]);_0x14b200[_0xa8ae('0x39')]=_[_0xa8ae('0x3a')](_0xf6f312['query']);_0x14b200[_0xa8ae('0x44')]=_[_0xa8ae('0x3b')](_0x14b200[_0xa8ae('0x38')],_0x14b200[_0xa8ae('0x39')]);_0x13b48f[_0xa8ae('0x3c')]=_[_0xa8ae('0x3b')](_0x14b200[_0xa8ae('0x38')],qs['fields'](_0xf6f312[_0xa8ae('0x39')]['fields']));_0x13b48f['attributes']=_0x13b48f['attributes'][_0xa8ae('0x3e')]?_0x13b48f[_0xa8ae('0x3c')]:_0x14b200['model'];if(_0xf6f312[_0xa8ae('0x39')][_0xa8ae('0x4e')]){_0x13b48f[_0xa8ae('0x4f')]=[{'all':!![]}];}_0x13b48f=_[_0xa8ae('0x47')]({},_0x13b48f,_0xf6f312[_0xa8ae('0x48')]);return db[_0xa8ae('0x49')][_0xa8ae('0x50')](_0x13b48f)['then'](handleEntityNotFound(_0x38683c,null))[_0xa8ae('0x1b')](respondWithResult(_0x38683c,null))[_0xa8ae('0x24')](handleError(_0x38683c,null));};exports[_0xa8ae('0x51')]=function(_0x3a1124,_0x4d309c){return db['ZendeskConfiguration'][_0xa8ae('0x51')](_0x3a1124[_0xa8ae('0x52')],{})[_0xa8ae('0x1b')](respondWithResult(_0x4d309c,0xc9))[_0xa8ae('0x24')](handleError(_0x4d309c,null));};exports['update']=function(_0x898ef8,_0x4ed446){if(_0x898ef8[_0xa8ae('0x52')]['id']){delete _0x898ef8['body']['id'];}return db[_0xa8ae('0x49')][_0xa8ae('0x50')]({'where':{'id':_0x898ef8[_0xa8ae('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4ed446,null))[_0xa8ae('0x1b')](saveUpdates(_0x898ef8[_0xa8ae('0x52')],null))[_0xa8ae('0x1b')](respondWithResult(_0x4ed446,null))[_0xa8ae('0x24')](handleError(_0x4ed446,null));};exports['destroy']=function(_0x2d67db,_0x2161bb){return db[_0xa8ae('0x49')]['find']({'where':{'id':_0x2d67db['params']['id']}})[_0xa8ae('0x1b')](handleEntityNotFound(_0x2161bb,null))[_0xa8ae('0x1b')](removeEntity(_0x2161bb,null))[_0xa8ae('0x24')](handleError(_0x2161bb,null));};exports[_0xa8ae('0x53')]=function(_0x21ceb5,_0x221bb6,_0x1f8ac2){var _0x460289={};var _0x382d83={};var _0x4ca1b8;var _0x5d86de;return db[_0xa8ae('0x49')]['findOne']({'where':{'id':_0x21ceb5[_0xa8ae('0x4d')]['id']}})['then'](handleEntityNotFound(_0x221bb6,null))['then'](function(_0xd15f3d){if(_0xd15f3d){_0x4ca1b8=_0xd15f3d;_0x382d83[_0xa8ae('0x38')]=_['keys'](db[_0xa8ae('0x54')]['rawAttributes']);_0x382d83[_0xa8ae('0x39')]=_[_0xa8ae('0x3a')](_0x21ceb5['query']);_0x382d83[_0xa8ae('0x44')]=_[_0xa8ae('0x3b')](_0x382d83[_0xa8ae('0x38')],_0x382d83[_0xa8ae('0x39')]);_0x460289[_0xa8ae('0x3c')]=_[_0xa8ae('0x3b')](_0x382d83[_0xa8ae('0x38')],qs['fields'](_0x21ceb5[_0xa8ae('0x39')]['fields']));_0x460289[_0xa8ae('0x3c')]=_0x460289[_0xa8ae('0x3c')][_0xa8ae('0x3e')]?_0x460289[_0xa8ae('0x3c')]:_0x382d83['model'];_0x460289[_0xa8ae('0x41')]=qs[_0xa8ae('0x42')](_0x21ceb5[_0xa8ae('0x39')][_0xa8ae('0x42')]);_0x460289[_0xa8ae('0x43')]=qs[_0xa8ae('0x44')](_[_0xa8ae('0x45')](_0x21ceb5[_0xa8ae('0x39')],_0x382d83[_0xa8ae('0x44')]));if(_0x21ceb5[_0xa8ae('0x39')][_0xa8ae('0x46')]){_0x460289[_0xa8ae('0x43')]=_[_0xa8ae('0x47')](_0x460289[_0xa8ae('0x43')],{'$or':_[_0xa8ae('0x33')](_0x460289['attributes'],function(_0x438118){var _0x46a04c={};_0x46a04c[_0x438118]={'$like':'%'+_0x21ceb5[_0xa8ae('0x39')][_0xa8ae('0x46')]+'%'};return _0x46a04c;})});}_0x460289=_[_0xa8ae('0x47')]({},_0x460289,_0x21ceb5[_0xa8ae('0x48')]);return _0x4ca1b8['getFields'](_0x460289);}})[_0xa8ae('0x1b')](function(_0x432168){if(_0x432168){_0x5d86de=_0x432168[_0xa8ae('0x3e')];if(!_0x21ceb5[_0xa8ae('0x39')][_0xa8ae('0x3f')](_0xa8ae('0x40'))){_0x460289['limit']=qs[_0xa8ae('0x2a')](_0x21ceb5[_0xa8ae('0x39')][_0xa8ae('0x2a')]);_0x460289['offset']=qs[_0xa8ae('0x29')](_0x21ceb5[_0xa8ae('0x39')][_0xa8ae('0x29')]);}return _0x4ca1b8[_0xa8ae('0x53')](_0x460289);}})[_0xa8ae('0x1b')](function(_0x1e2e45){if(_0x1e2e45){return _0x1e2e45?{'count':_0x5d86de,'rows':_0x1e2e45}:null;}})[_0xa8ae('0x1b')](respondWithResult(_0x221bb6,null))['catch'](handleError(_0x221bb6,null));};exports[_0xa8ae('0x55')]=function(_0x7b85f3,_0x1a0275,_0x3629ab){var _0x5b747a={};var _0x1bb8a6={};var _0x240f30;var _0x24a512;return db[_0xa8ae('0x49')]['findOne']({'where':{'id':_0x7b85f3[_0xa8ae('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a0275,null))[_0xa8ae('0x1b')](function(_0x4b42d3){if(_0x4b42d3){_0x240f30=_0x4b42d3;_0x1bb8a6[_0xa8ae('0x38')]=_[_0xa8ae('0x3a')](db[_0xa8ae('0x54')][_0xa8ae('0x34')]);_0x1bb8a6[_0xa8ae('0x39')]=_[_0xa8ae('0x3a')](_0x7b85f3['query']);_0x1bb8a6[_0xa8ae('0x44')]=_['intersection'](_0x1bb8a6[_0xa8ae('0x38')],_0x1bb8a6[_0xa8ae('0x39')]);_0x5b747a['attributes']=_['intersection'](_0x1bb8a6[_0xa8ae('0x38')],qs[_0xa8ae('0x3d')](_0x7b85f3[_0xa8ae('0x39')][_0xa8ae('0x3d')]));_0x5b747a[_0xa8ae('0x3c')]=_0x5b747a[_0xa8ae('0x3c')][_0xa8ae('0x3e')]?_0x5b747a[_0xa8ae('0x3c')]:_0x1bb8a6['model'];_0x5b747a[_0xa8ae('0x41')]=qs['sort'](_0x7b85f3[_0xa8ae('0x39')][_0xa8ae('0x42')]);_0x5b747a[_0xa8ae('0x43')]=qs[_0xa8ae('0x44')](_[_0xa8ae('0x45')](_0x7b85f3[_0xa8ae('0x39')],_0x1bb8a6[_0xa8ae('0x44')]));if(_0x7b85f3[_0xa8ae('0x39')][_0xa8ae('0x46')]){_0x5b747a['where']=_[_0xa8ae('0x47')](_0x5b747a[_0xa8ae('0x43')],{'$or':_[_0xa8ae('0x33')](_0x5b747a[_0xa8ae('0x3c')],function(_0x1f2266){var _0x3552cb={};_0x3552cb[_0x1f2266]={'$like':'%'+_0x7b85f3['query'][_0xa8ae('0x46')]+'%'};return _0x3552cb;})});}_0x5b747a=_[_0xa8ae('0x47')]({},_0x5b747a,_0x7b85f3[_0xa8ae('0x48')]);return _0x240f30[_0xa8ae('0x55')](_0x5b747a);}})[_0xa8ae('0x1b')](function(_0x64c321){if(_0x64c321){_0x24a512=_0x64c321['length'];if(!_0x7b85f3['query'][_0xa8ae('0x3f')]('nolimit')){_0x5b747a[_0xa8ae('0x2a')]=qs[_0xa8ae('0x2a')](_0x7b85f3['query'][_0xa8ae('0x2a')]);_0x5b747a[_0xa8ae('0x29')]=qs['offset'](_0x7b85f3[_0xa8ae('0x39')][_0xa8ae('0x29')]);}return _0x240f30[_0xa8ae('0x55')](_0x5b747a);}})['then'](function(_0x221ced){if(_0x221ced){return _0x221ced?{'count':_0x24a512,'rows':_0x221ced}:null;}})[_0xa8ae('0x1b')](respondWithResult(_0x1a0275,null))[_0xa8ae('0x24')](handleError(_0x1a0275,null));};exports['getDescriptions']=function(_0x6aed38,_0x485f07,_0x3be65b){var _0x2af360={};var _0x234c62={};var _0x486406;var _0x30fd85;return db[_0xa8ae('0x49')][_0xa8ae('0x56')]({'where':{'id':_0x6aed38['params']['id']}})[_0xa8ae('0x1b')](handleEntityNotFound(_0x485f07,null))[_0xa8ae('0x1b')](function(_0xe73e85){if(_0xe73e85){_0x486406=_0xe73e85;_0x234c62['model']=_['keys'](db['ZendeskField'][_0xa8ae('0x34')]);_0x234c62[_0xa8ae('0x39')]=_[_0xa8ae('0x3a')](_0x6aed38[_0xa8ae('0x39')]);_0x234c62['filters']=_[_0xa8ae('0x3b')](_0x234c62[_0xa8ae('0x38')],_0x234c62[_0xa8ae('0x39')]);_0x2af360[_0xa8ae('0x3c')]=_['intersection'](_0x234c62[_0xa8ae('0x38')],qs[_0xa8ae('0x3d')](_0x6aed38['query'][_0xa8ae('0x3d')]));_0x2af360['attributes']=_0x2af360[_0xa8ae('0x3c')]['length']?_0x2af360['attributes']:_0x234c62[_0xa8ae('0x38')];_0x2af360[_0xa8ae('0x41')]=qs[_0xa8ae('0x42')](_0x6aed38[_0xa8ae('0x39')]['sort']);_0x2af360[_0xa8ae('0x43')]=qs[_0xa8ae('0x44')](_[_0xa8ae('0x45')](_0x6aed38[_0xa8ae('0x39')],_0x234c62['filters']));if(_0x6aed38['query'][_0xa8ae('0x46')]){_0x2af360[_0xa8ae('0x43')]=_[_0xa8ae('0x47')](_0x2af360[_0xa8ae('0x43')],{'$or':_['map'](_0x2af360['attributes'],function(_0x54e438){var _0x45b4ea={};_0x45b4ea[_0x54e438]={'$like':'%'+_0x6aed38['query'][_0xa8ae('0x46')]+'%'};return _0x45b4ea;})});}_0x2af360=_[_0xa8ae('0x47')]({},_0x2af360,_0x6aed38[_0xa8ae('0x48')]);return _0x486406[_0xa8ae('0x57')](_0x2af360);}})[_0xa8ae('0x1b')](function(_0x14d95d){if(_0x14d95d){_0x30fd85=_0x14d95d['length'];if(!_0x6aed38[_0xa8ae('0x39')][_0xa8ae('0x3f')]('nolimit')){_0x2af360[_0xa8ae('0x2a')]=qs['limit'](_0x6aed38[_0xa8ae('0x39')]['limit']);_0x2af360[_0xa8ae('0x29')]=qs['offset'](_0x6aed38[_0xa8ae('0x39')][_0xa8ae('0x29')]);}return _0x486406[_0xa8ae('0x57')](_0x2af360);}})[_0xa8ae('0x1b')](function(_0x5abc0b){if(_0x5abc0b){return _0x5abc0b?{'count':_0x30fd85,'rows':_0x5abc0b}:null;}})[_0xa8ae('0x1b')](respondWithResult(_0x485f07,null))[_0xa8ae('0x24')](handleError(_0x485f07,null));};exports[_0xa8ae('0x58')]=function(_0x281217,_0x838499,_0x1417c6){var _0x14dff0={};var _0x4bc4c4={};var _0x377dd4;var _0x48dee0;return db[_0xa8ae('0x49')][_0xa8ae('0x56')]({'where':{'id':_0x281217[_0xa8ae('0x4d')]['id']}})['then'](handleEntityNotFound(_0x838499,null))[_0xa8ae('0x1b')](function(_0x2bf61c){if(_0x2bf61c){_0x377dd4=_0x2bf61c;_0x4bc4c4[_0xa8ae('0x38')]=_['keys'](db[_0xa8ae('0x59')][_0xa8ae('0x34')]);_0x4bc4c4[_0xa8ae('0x39')]=_['keys'](_0x281217['query']);_0x4bc4c4[_0xa8ae('0x44')]=_['intersection'](_0x4bc4c4[_0xa8ae('0x38')],_0x4bc4c4['query']);_0x14dff0[_0xa8ae('0x3c')]=_[_0xa8ae('0x3b')](_0x4bc4c4[_0xa8ae('0x38')],qs['fields'](_0x281217[_0xa8ae('0x39')][_0xa8ae('0x3d')]));_0x14dff0[_0xa8ae('0x3c')]=_0x14dff0[_0xa8ae('0x3c')]['length']?_0x14dff0[_0xa8ae('0x3c')]:_0x4bc4c4[_0xa8ae('0x38')];_0x14dff0[_0xa8ae('0x41')]=qs[_0xa8ae('0x42')](_0x281217[_0xa8ae('0x39')]['sort']);_0x14dff0[_0xa8ae('0x43')]=qs[_0xa8ae('0x44')](_['pick'](_0x281217[_0xa8ae('0x39')],_0x4bc4c4[_0xa8ae('0x44')]));if(_0x281217[_0xa8ae('0x39')][_0xa8ae('0x46')]){_0x14dff0[_0xa8ae('0x43')]=_[_0xa8ae('0x47')](_0x14dff0[_0xa8ae('0x43')],{'$or':_[_0xa8ae('0x33')](_0x14dff0['attributes'],function(_0x2d0e27){var _0x23dd9c={};_0x23dd9c[_0x2d0e27]={'$like':'%'+_0x281217[_0xa8ae('0x39')][_0xa8ae('0x46')]+'%'};return _0x23dd9c;})});}_0x14dff0=_['merge']({},_0x14dff0,_0x281217[_0xa8ae('0x48')]);return _0x377dd4['getTags'](_0x14dff0);}})[_0xa8ae('0x1b')](function(_0x153dea){if(_0x153dea){_0x48dee0=_0x153dea[_0xa8ae('0x3e')];if(!_0x281217['query']['hasOwnProperty']('nolimit')){_0x14dff0[_0xa8ae('0x2a')]=qs[_0xa8ae('0x2a')](_0x281217['query'][_0xa8ae('0x2a')]);_0x14dff0[_0xa8ae('0x29')]=qs[_0xa8ae('0x29')](_0x281217[_0xa8ae('0x39')][_0xa8ae('0x29')]);}return _0x377dd4[_0xa8ae('0x58')](_0x14dff0);}})[_0xa8ae('0x1b')](function(_0x31a733){if(_0x31a733){return _0x31a733?{'count':_0x48dee0,'rows':_0x31a733}:null;}})[_0xa8ae('0x1b')](respondWithResult(_0x838499,null))[_0xa8ae('0x24')](handleError(_0x838499,null));};exports[_0xa8ae('0x5a')]=function(_0x5603a9,_0x5ad614,_0x333ced){if(_0x5603a9[_0xa8ae('0x52')]['id']){delete _0x5603a9['body']['id'];}return db[_0xa8ae('0x49')][_0xa8ae('0x56')]({'where':{'id':_0x5603a9[_0xa8ae('0x4d')]['id']}})[_0xa8ae('0x1b')](handleEntityNotFound(_0x5ad614,null))[_0xa8ae('0x1b')](function(_0x7bf052){if(_0x7bf052){return _0x7bf052[_0xa8ae('0x5a')](_0x5603a9[_0xa8ae('0x52')]['ids']||[]);}return null;})[_0xa8ae('0x1b')](respondWithResult(_0x5ad614,null))['catch'](handleError(_0x5ad614,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c214f16..e778722 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 _0xf37e=['path','rimraf','exports','define','ZendeskConfiguration','lodash','request-promise'];(function(_0x5e5e13,_0x3723ed){var _0x1e68c9=function(_0x4c2c0a){while(--_0x4c2c0a){_0x5e5e13['push'](_0x5e5e13['shift']());}};_0x1e68c9(++_0x3723ed);}(_0xf37e,0x1b0));var _0xef37=function(_0x1bc5f5,_0x50088f){_0x1bc5f5=_0x1bc5f5-0x0;var _0xca7977=_0xf37e[_0x1bc5f5];return _0xca7977;};'use strict';var _=require(_0xef37('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xef37('0x1'));var fs=require('fs');var path=require(_0xef37('0x2'));var rimraf=require(_0xef37('0x3'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xef37('0x4')]=function(_0x4079c5,_0x4ab67b){return _0x4079c5[_0xef37('0x5')](_0xef37('0x6'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x265b=['int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ZendeskConfiguration'];(function(_0x394f4f,_0x4cc102){var _0x25c3f0=function(_0x1851ee){while(--_0x1851ee){_0x394f4f['push'](_0x394f4f['shift']());}};_0x25c3f0(++_0x4cc102);}(_0x265b,0x1e1));var _0xb265=function(_0x356ba2,_0xec942d){_0x356ba2=_0x356ba2-0x0;var _0x5a517a=_0x265b[_0x356ba2];return _0x5a517a;};'use strict';var _=require(_0xb265('0x0'));var util=require(_0xb265('0x1'));var logger=require(_0xb265('0x2'))(_0xb265('0x3'));var moment=require(_0xb265('0x4'));var BPromise=require(_0xb265('0x5'));var rp=require(_0xb265('0x6'));var fs=require('fs');var path=require(_0xb265('0x7'));var rimraf=require(_0xb265('0x8'));var config=require(_0xb265('0x9'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x42ed28,_0x142b0d){return _0x42ed28['define'](_0xb265('0xa'),attributes,{'tableName':_0xb265('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 5b74e8c..d7e5262 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 _0x57c4=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x2dfd4f,_0x100f65){var _0x3ea92e=function(_0xfe13f5){while(--_0xfe13f5){_0x2dfd4f['push'](_0x2dfd4f['shift']());}};_0x3ea92e(++_0x100f65);}(_0x57c4,0x13d));var _0x457c=function(_0x284217,_0x5ab1dd){_0x284217=_0x284217-0x0;var _0x157275=_0x57c4[_0x284217];return _0x157275;};'use strict';var _=require(_0x457c('0x0'));var util=require(_0x457c('0x1'));var moment=require('moment');var BPromise=require(_0x457c('0x2'));var rs=require(_0x457c('0x3'));var fs=require('fs');var Redis=require(_0x457c('0x4'));var db=require(_0x457c('0x5'))['db'];var utils=require(_0x457c('0x6'));var logger=require('../../config/logger')(_0x457c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x457c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1765ed,_0x347da1,_0x2e4348){return new BPromise(function(_0x4bd553,_0x335b87){return client[_0x457c('0x9')](_0x1765ed,_0x2e4348)[_0x457c('0xa')](function(_0x31916b){logger[_0x457c('0xb')](_0x457c('0xc'),_0x347da1,'request\x20sent');logger[_0x457c('0xd')](_0x457c('0xe'),_0x347da1,'request\x20sent',JSON['stringify'](_0x31916b));if(_0x31916b['error']){if(_0x31916b[_0x457c('0xf')][_0x457c('0x10')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x347da1,_0x31916b[_0x457c('0xf')][_0x457c('0x11')]);return _0x335b87(_0x31916b[_0x457c('0xf')][_0x457c('0x11')]);}logger[_0x457c('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x347da1,_0x31916b[_0x457c('0xf')][_0x457c('0x11')]);return _0x4bd553(_0x31916b[_0x457c('0xf')][_0x457c('0x11')]);}else{logger['info'](_0x457c('0xc'),_0x347da1,_0x457c('0x12'));_0x4bd553(_0x31916b[_0x457c('0x13')]['message']);}})[_0x457c('0x14')](function(_0x55c914){logger[_0x457c('0xf')](_0x457c('0xc'),_0x347da1,_0x55c914);_0x335b87(_0x55c914);});});} \ No newline at end of file +var _0x8bef=['message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5d1acd,_0x1a6401){var _0x1b68dd=function(_0xa8b274){while(--_0xa8b274){_0x5d1acd['push'](_0x5d1acd['shift']());}};_0x1b68dd(++_0x1a6401);}(_0x8bef,0x76));var _0xf8be=function(_0x2a9153,_0x44fd73){_0x2a9153=_0x2a9153-0x0;var _0x2f6615=_0x8bef[_0x2a9153];return _0x2f6615;};'use strict';var _=require(_0xf8be('0x0'));var util=require(_0xf8be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8be('0x3'))['db'];var utils=require(_0xf8be('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf8be('0x5'));var jayson=require(_0xf8be('0x6'));var client=jayson[_0xf8be('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47b48a,_0x3b3a46,_0x5d0c0e){return new BPromise(function(_0x11f54e,_0x496c6f){return client['request'](_0x47b48a,_0x5d0c0e)[_0xf8be('0x8')](function(_0x4f5d14){logger[_0xf8be('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b3a46,_0xf8be('0xa'));logger['debug'](_0xf8be('0xb'),_0x3b3a46,_0xf8be('0xa'),JSON[_0xf8be('0xc')](_0x4f5d14));if(_0x4f5d14[_0xf8be('0xd')]){if(_0x4f5d14['error'][_0xf8be('0xe')]===0x1f4){logger[_0xf8be('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b3a46,_0x4f5d14[_0xf8be('0xd')][_0xf8be('0xf')]);return _0x496c6f(_0x4f5d14[_0xf8be('0xd')][_0xf8be('0xf')]);}logger['error'](_0xf8be('0x10'),_0x3b3a46,_0x4f5d14['error'][_0xf8be('0xf')]);return _0x11f54e(_0x4f5d14['error'][_0xf8be('0xf')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3b3a46,_0xf8be('0xa'));_0x11f54e(_0x4f5d14[_0xf8be('0x11')][_0xf8be('0xf')]);}})[_0xf8be('0x12')](function(_0xc213df){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3b3a46,_0xc213df);_0x496c6f(_0xc213df);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f382d0b..6bf6804 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 _0xb93d=['../../config/environment','get','index','/:id','isAuthenticated','show','post','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xb93d,0xaa));var _0xdb93=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xb93d[_0x2aea9e];return _0x430b92;};'use strict';var multer=require('multer');var util=require(_0xdb93('0x0'));var path=require(_0xdb93('0x1'));var timeout=require(_0xdb93('0x2'));var express=require(_0xdb93('0x3'));var router=express[_0xdb93('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdb93('0x5'));var config=require(_0xdb93('0x6'));var controller=require('./intZendeskField.controller');router[_0xdb93('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb93('0x8')]);router[_0xdb93('0x7')](_0xdb93('0x9'),auth[_0xdb93('0xa')](),controller[_0xdb93('0xb')]);router[_0xdb93('0xc')]('/',auth[_0xdb93('0xa')](),controller['create']);router['put'](_0xdb93('0x9'),auth[_0xdb93('0xa')](),controller['update']);router[_0xdb93('0xd')](_0xdb93('0x9'),auth[_0xdb93('0xa')](),controller[_0xdb93('0xe')]);module[_0xdb93('0xf')]=router; \ No newline at end of file +var _0xb87c=['../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x1a837b,_0x7cae3a){var _0x5d0e20=function(_0x5e19c9){while(--_0x5e19c9){_0x1a837b['push'](_0x1a837b['shift']());}};_0x5d0e20(++_0x7cae3a);}(_0xb87c,0x1d7));var _0xcb87=function(_0x2e2b00,_0x2e0003){_0x2e2b00=_0x2e2b00-0x0;var _0x4ea586=_0xb87c[_0x2e2b00];return _0x4ea586;};'use strict';var multer=require('multer');var util=require(_0xcb87('0x0'));var path=require(_0xcb87('0x1'));var timeout=require(_0xcb87('0x2'));var express=require(_0xcb87('0x3'));var router=express[_0xcb87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcb87('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xcb87('0x6')]('/',auth[_0xcb87('0x7')](),controller[_0xcb87('0x8')]);router[_0xcb87('0x6')](_0xcb87('0x9'),auth[_0xcb87('0x7')](),controller['show']);router[_0xcb87('0xa')]('/',auth[_0xcb87('0x7')](),controller[_0xcb87('0xb')]);router[_0xcb87('0xc')](_0xcb87('0x9'),auth['isAuthenticated'](),controller[_0xcb87('0xd')]);router[_0xcb87('0xe')](_0xcb87('0x9'),auth[_0xcb87('0x7')](),controller[_0xcb87('0xf')]);module[_0xcb87('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6503b9f..64d9767 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 _0x2d17=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0xd2c485,_0x54a352){var _0x1d3a3c=function(_0x5af7a1){while(--_0x5af7a1){_0xd2c485['push'](_0xd2c485['shift']());}};_0x1d3a3c(++_0x54a352);}(_0x2d17,0x17e));var _0x72d1=function(_0x32a474,_0x23c4fa){_0x32a474=_0x32a474-0x0;var _0x4e8f99=_0x2d17[_0x32a474];return _0x4e8f99;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x72d1('0x2'),_0x72d1('0x3'),'customVariable',_0x72d1('0x4')),'defaultValue':_0x72d1('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x72d1('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x72d1('0x2'),'variable',_0x72d1('0x6'))},'keyContent':{'type':Sequelize[_0x72d1('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x72d1('0x5')]},'customField':{'type':Sequelize[_0x72d1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72d1('0x5')]}}; \ No newline at end of file +var _0xcee8=['customVariable','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3de100,_0x4c0d95){var _0x5106af=function(_0x5b0105){while(--_0x5b0105){_0x3de100['push'](_0x3de100['shift']());}};_0x5106af(++_0x4c0d95);}(_0xcee8,0xb1));var _0x8cee=function(_0x190b20,_0x175658){_0x190b20=_0x190b20-0x0;var _0x5a2ed2=_0xcee8[_0x190b20];return _0x5a2ed2;};'use strict';var Sequelize=require(_0x8cee('0x0'));module[_0x8cee('0x1')]={'type':{'type':Sequelize[_0x8cee('0x2')](_0x8cee('0x3'),_0x8cee('0x4'),_0x8cee('0x5'),'keyValue'),'defaultValue':_0x8cee('0x3')},'content':{'type':Sequelize[_0x8cee('0x6')]},'key':{'type':Sequelize[_0x8cee('0x6')]},'keyType':{'type':Sequelize[_0x8cee('0x2')]('string',_0x8cee('0x4'),_0x8cee('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8cee('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8cee('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e18ac1f..4de0275 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 _0x8952=['limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','ZendeskField','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x2047af,_0x44b840){var _0x1b4b9f=function(_0x3b8d03){while(--_0x3b8d03){_0x2047af['push'](_0x2047af['shift']());}};_0x1b4b9f(++_0x44b840);}(_0x8952,0x17e));var _0x2895=function(_0x27f2e4,_0x663522){_0x27f2e4=_0x27f2e4-0x0;var _0x5478d3=_0x8952[_0x27f2e4];return _0x5478d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2895('0x0'));var rimraf=require(_0x2895('0x1'));var zipdir=require(_0x2895('0x2'));var jsonpatch=require(_0x2895('0x3'));var rp=require(_0x2895('0x4'));var moment=require('moment');var BPromise=require(_0x2895('0x5'));var Mustache=require(_0x2895('0x6'));var util=require(_0x2895('0x7'));var path=require('path');var sox=require(_0x2895('0x8'));var csv=require(_0x2895('0x9'));var ejs=require(_0x2895('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x9'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=_0x1d3659[_0x2895('0x18')],_0x6a5c7e=_0x1ae013[_0x2895('0x19')],_0x31bb7f=_0x1ae013[_0x2895('0x19')]+_0x1ae013[_0x2895('0x1a')],_0x3e96d7;if(_0x31bb7f>=_0x2627e6){_0x31bb7f=_0x2627e6;_0x3e96d7=0xc8;}else{_0x3e96d7=0xce;}_0x27b50e[_0x2895('0x16')](_0x3e96d7);return _0x27b50e[_0x2895('0x1b')](_0x2895('0x1c'),_0x6a5c7e+'-'+_0x31bb7f+'/'+_0x2627e6)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x1e8d47){return function(_0x5a8eab){try{jsonpatch['apply'](_0x5a8eab,_0x1e8d47,!![]);}catch(_0x493851){return BPromise[_0x2895('0x1d')](_0x493851);}return _0x5a8eab[_0x2895('0x1e')]();};}function saveUpdates(_0x3ec4da,_0x593e47){return function(_0x2813a3){if(_0x2813a3){return _0x2813a3[_0x2895('0x1f')](_0x3ec4da)[_0x2895('0x20')](function(_0x19228e){return _0x19228e;});}return null;};}function removeEntity(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x21')]()['then'](function(){_0x8b75e0[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x6f8ad4,_0x511286){return function(_0x4e884f){if(!_0x4e884f){_0x6f8ad4[_0x2895('0x15')](0x194);}return _0x4e884f;};}function handleError(_0x4569b5,_0x23b0eb){_0x23b0eb=_0x23b0eb||0x1f4;return function(_0x4a21cf){logger[_0x2895('0x23')](_0x4a21cf[_0x2895('0x24')]);if(_0x4a21cf['name']){delete _0x4a21cf[_0x2895('0x25')];}_0x4569b5[_0x2895('0x16')](_0x23b0eb)[_0x2895('0x26')](_0x4a21cf);};}exports['index']=function(_0x320661,_0x30f491){var _0x5eedfc={},_0x21f549={},_0x501898={'count':0x0,'rows':[]};var _0x5d70f5=_[_0x2895('0x27')](db['ZendeskField'][_0x2895('0x28')],function(_0x381538){return{'name':_0x381538['fieldName'],'type':_0x381538['type'][_0x2895('0x29')]};});_0x21f549[_0x2895('0x2a')]=_[_0x2895('0x27')](_0x5d70f5,_0x2895('0x25'));_0x21f549[_0x2895('0x2b')]=_[_0x2895('0x2c')](_0x320661[_0x2895('0x2b')]);_0x21f549['filters']=_[_0x2895('0x2d')](_0x21f549[_0x2895('0x2a')],_0x21f549[_0x2895('0x2b')]);_0x5eedfc['attributes']=_[_0x2895('0x2d')](_0x21f549[_0x2895('0x2a')],qs[_0x2895('0x2e')](_0x320661[_0x2895('0x2b')]['fields']));_0x5eedfc[_0x2895('0x2f')]=_0x5eedfc[_0x2895('0x2f')][_0x2895('0x30')]?_0x5eedfc[_0x2895('0x2f')]:_0x21f549[_0x2895('0x2a')];if(!_0x320661['query']['hasOwnProperty'](_0x2895('0x31'))){_0x5eedfc[_0x2895('0x1a')]=qs['limit'](_0x320661[_0x2895('0x2b')]['limit']);_0x5eedfc[_0x2895('0x19')]=qs[_0x2895('0x19')](_0x320661['query'][_0x2895('0x19')]);}_0x5eedfc['order']=qs[_0x2895('0x32')](_0x320661['query']['sort']);_0x5eedfc[_0x2895('0x33')]=qs[_0x2895('0x34')](_[_0x2895('0x35')](_0x320661['query'],_0x21f549[_0x2895('0x34')]),_0x5d70f5);if(_0x320661[_0x2895('0x2b')][_0x2895('0x36')]){_0x5eedfc[_0x2895('0x33')]=_[_0x2895('0x37')](_0x5eedfc[_0x2895('0x33')],{'$or':_[_0x2895('0x27')](_0x5d70f5,function(_0x240230){if(_0x240230[_0x2895('0x38')]!==_0x2895('0x39')){var _0x59b0e6={};_0x59b0e6[_0x240230[_0x2895('0x25')]]={'$like':'%'+_0x320661[_0x2895('0x2b')][_0x2895('0x36')]+'%'};return _0x59b0e6;}})});}_0x5eedfc=_[_0x2895('0x37')]({},_0x5eedfc,_0x320661[_0x2895('0x3a')]);var _0x12d7d8={'where':_0x5eedfc[_0x2895('0x33')]};return db['ZendeskField']['count'](_0x12d7d8)[_0x2895('0x20')](function(_0x29dc63){_0x501898[_0x2895('0x18')]=_0x29dc63;if(_0x320661[_0x2895('0x2b')][_0x2895('0x3b')]){_0x5eedfc[_0x2895('0x3c')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x5eedfc);})[_0x2895('0x20')](function(_0x20208f){_0x501898['rows']=_0x20208f;return _0x501898;})['then'](respondWithFilteredResult(_0x30f491,_0x5eedfc))[_0x2895('0x3d')](handleError(_0x30f491,null));};exports[_0x2895('0x3e')]=function(_0x3cc827,_0x28967f){var _0x2bac35={'raw':!![],'where':{'id':_0x3cc827['params']['id']}},_0x3e1d16={};_0x3e1d16[_0x2895('0x2a')]=_[_0x2895('0x2c')](db[_0x2895('0x3f')][_0x2895('0x28')]);_0x3e1d16['query']=_[_0x2895('0x2c')](_0x3cc827[_0x2895('0x2b')]);_0x3e1d16[_0x2895('0x34')]=_[_0x2895('0x2d')](_0x3e1d16['model'],_0x3e1d16['query']);_0x2bac35[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x3e1d16[_0x2895('0x2a')],qs[_0x2895('0x2e')](_0x3cc827[_0x2895('0x2b')]['fields']));_0x2bac35['attributes']=_0x2bac35[_0x2895('0x2f')][_0x2895('0x30')]?_0x2bac35[_0x2895('0x2f')]:_0x3e1d16[_0x2895('0x2a')];if(_0x3cc827[_0x2895('0x2b')][_0x2895('0x3b')]){_0x2bac35[_0x2895('0x3c')]=[{'all':!![]}];}_0x2bac35=_['merge']({},_0x2bac35,_0x3cc827[_0x2895('0x3a')]);return db[_0x2895('0x3f')][_0x2895('0x40')](_0x2bac35)[_0x2895('0x20')](handleEntityNotFound(_0x28967f,null))[_0x2895('0x20')](respondWithResult(_0x28967f,null))[_0x2895('0x3d')](handleError(_0x28967f,null));};exports[_0x2895('0x41')]=function(_0x299d71,_0x549059){return db[_0x2895('0x3f')][_0x2895('0x41')](_0x299d71[_0x2895('0x42')],{})['then'](respondWithResult(_0x549059,0xc9))[_0x2895('0x3d')](handleError(_0x549059,null));};exports[_0x2895('0x1f')]=function(_0x5e4f70,_0xbb09a6){if(_0x5e4f70[_0x2895('0x42')]['id']){delete _0x5e4f70[_0x2895('0x42')]['id'];}return db[_0x2895('0x3f')][_0x2895('0x40')]({'where':{'id':_0x5e4f70[_0x2895('0x43')]['id']}})[_0x2895('0x20')](handleEntityNotFound(_0xbb09a6,null))['then'](saveUpdates(_0x5e4f70[_0x2895('0x42')],null))[_0x2895('0x20')](respondWithResult(_0xbb09a6,null))['catch'](handleError(_0xbb09a6,null));};exports['destroy']=function(_0x574839,_0x212a1f){return db[_0x2895('0x3f')][_0x2895('0x40')]({'where':{'id':_0x574839[_0x2895('0x43')]['id']}})[_0x2895('0x20')](handleEntityNotFound(_0x212a1f,null))[_0x2895('0x20')](removeEntity(_0x212a1f,null))[_0x2895('0x3d')](handleError(_0x212a1f,null));}; \ No newline at end of file +var _0xf2e3=['catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','ZendeskField','findAll','rows','params','includeAll','find'];(function(_0x1cf9c1,_0x487f27){var _0x197626=function(_0x44c524){while(--_0x44c524){_0x1cf9c1['push'](_0x1cf9c1['shift']());}};_0x197626(++_0x487f27);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf2e3[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0x3f2e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f2e('0x1'));var zipdir=require(_0x3f2e('0x2'));var jsonpatch=require(_0x3f2e('0x3'));var rp=require(_0x3f2e('0x4'));var moment=require(_0x3f2e('0x5'));var BPromise=require(_0x3f2e('0x6'));var Mustache=require(_0x3f2e('0x7'));var util=require(_0x3f2e('0x8'));var path=require(_0x3f2e('0x9'));var sox=require('sox');var csv=require(_0x3f2e('0xa'));var ejs=require(_0x3f2e('0xb'));var fs=require('fs');var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0xa'));var querystring=require(_0x3f2e('0x11'));var Papa=require(_0x3f2e('0x12'));var Redis=require(_0x3f2e('0x13'));var authService=require(_0x3f2e('0x14'));var qs=require(_0x3f2e('0x15'));var as=require(_0x3f2e('0x16'));var hardwareService=require(_0x3f2e('0x17'));var logger=require(_0x3f2e('0x18'))(_0x3f2e('0x19'));var utils=require(_0x3f2e('0x1a'));var config=require(_0x3f2e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1c'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1d')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9)[_0x3f2e('0x1f')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1e')](_0x57cba7)[_0x3f2e('0x20')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=_0x218b44[_0x3f2e('0x21')],_0x2c4feb=_0x43f69e[_0x3f2e('0x22')],_0x1dc5d0=_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x23')],_0x2fef73;if(_0x1dc5d0>=_0x17ef58){_0x1dc5d0=_0x17ef58;_0x2fef73=0xc8;}else{_0x2fef73=0xce;}_0x4f2e38[_0x3f2e('0x1e')](_0x2fef73);return _0x4f2e38['set'](_0x3f2e('0x24'),_0x2c4feb+'-'+_0x1dc5d0+'/'+_0x17ef58)[_0x3f2e('0x20')](_0x218b44);}return null;};}function patchUpdates(_0x38925f){return function(_0xbe899c){try{jsonpatch[_0x3f2e('0x25')](_0xbe899c,_0x38925f,!![]);}catch(_0x4eb1e7){return BPromise['reject'](_0x4eb1e7);}return _0xbe899c[_0x3f2e('0x26')]();};}function saveUpdates(_0x11f84c,_0x38bbae){return function(_0x2ac500){if(_0x2ac500){return _0x2ac500[_0x3f2e('0x27')](_0x11f84c)[_0x3f2e('0x28')](function(_0x552443){return _0x552443;});}return null;};}function removeEntity(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['destroy']()['then'](function(){_0x5a7047[_0x3f2e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8c67,_0x401ed9){return function(_0x515e32){if(!_0x515e32){_0x1b8c67['sendStatus'](0x194);}return _0x515e32;};}function handleError(_0x52803d,_0x265bf1){_0x265bf1=_0x265bf1||0x1f4;return function(_0x3d7631){logger['error'](_0x3d7631[_0x3f2e('0x29')]);if(_0x3d7631['name']){delete _0x3d7631[_0x3f2e('0x2a')];}_0x52803d['status'](_0x265bf1)[_0x3f2e('0x2b')](_0x3d7631);};}exports[_0x3f2e('0x2c')]=function(_0x12926e,_0x9c6c34){var _0x11bad1={},_0x4799d3={},_0x426d68={'count':0x0,'rows':[]};var _0x28ef64=_['map'](db['ZendeskField'][_0x3f2e('0x2d')],function(_0x1e5db4){return{'name':_0x1e5db4[_0x3f2e('0x2e')],'type':_0x1e5db4[_0x3f2e('0x2f')]['key']};});_0x4799d3[_0x3f2e('0x30')]=_[_0x3f2e('0x31')](_0x28ef64,_0x3f2e('0x2a'));_0x4799d3['query']=_[_0x3f2e('0x32')](_0x12926e[_0x3f2e('0x33')]);_0x4799d3[_0x3f2e('0x34')]=_['intersection'](_0x4799d3[_0x3f2e('0x30')],_0x4799d3[_0x3f2e('0x33')]);_0x11bad1[_0x3f2e('0x35')]=_[_0x3f2e('0x36')](_0x4799d3[_0x3f2e('0x30')],qs[_0x3f2e('0x37')](_0x12926e['query'][_0x3f2e('0x37')]));_0x11bad1[_0x3f2e('0x35')]=_0x11bad1[_0x3f2e('0x35')][_0x3f2e('0x38')]?_0x11bad1[_0x3f2e('0x35')]:_0x4799d3[_0x3f2e('0x30')];if(!_0x12926e[_0x3f2e('0x33')]['hasOwnProperty'](_0x3f2e('0x39'))){_0x11bad1[_0x3f2e('0x23')]=qs[_0x3f2e('0x23')](_0x12926e[_0x3f2e('0x33')]['limit']);_0x11bad1['offset']=qs[_0x3f2e('0x22')](_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x22')]);}_0x11bad1[_0x3f2e('0x3a')]=qs[_0x3f2e('0x3b')](_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x3b')]);_0x11bad1[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_[_0x3f2e('0x3d')](_0x12926e['query'],_0x4799d3[_0x3f2e('0x34')]),_0x28ef64);if(_0x12926e[_0x3f2e('0x33')][_0x3f2e('0x3e')]){_0x11bad1[_0x3f2e('0x3c')]=_['merge'](_0x11bad1[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x31')](_0x28ef64,function(_0x3f41af){if(_0x3f41af[_0x3f2e('0x2f')]!==_0x3f2e('0x3f')){var _0x69f940={};_0x69f940[_0x3f41af[_0x3f2e('0x2a')]]={'$like':'%'+_0x12926e[_0x3f2e('0x33')]['filter']+'%'};return _0x69f940;}})});}_0x11bad1=_[_0x3f2e('0x40')]({},_0x11bad1,_0x12926e[_0x3f2e('0x41')]);var _0x238b6b={'where':_0x11bad1[_0x3f2e('0x3c')]};return db['ZendeskField'][_0x3f2e('0x21')](_0x238b6b)[_0x3f2e('0x28')](function(_0x4cb56b){_0x426d68[_0x3f2e('0x21')]=_0x4cb56b;if(_0x12926e[_0x3f2e('0x33')]['includeAll']){_0x11bad1[_0x3f2e('0x42')]=[{'all':!![]}];}return db[_0x3f2e('0x43')][_0x3f2e('0x44')](_0x11bad1);})[_0x3f2e('0x28')](function(_0x59e383){_0x426d68[_0x3f2e('0x45')]=_0x59e383;return _0x426d68;})[_0x3f2e('0x28')](respondWithFilteredResult(_0x9c6c34,_0x11bad1))['catch'](handleError(_0x9c6c34,null));};exports['show']=function(_0x2be69f,_0x23de01){var _0xe67d03={'raw':!![],'where':{'id':_0x2be69f[_0x3f2e('0x46')]['id']}},_0x5b5dc2={};_0x5b5dc2[_0x3f2e('0x30')]=_[_0x3f2e('0x32')](db[_0x3f2e('0x43')][_0x3f2e('0x2d')]);_0x5b5dc2[_0x3f2e('0x33')]=_[_0x3f2e('0x32')](_0x2be69f[_0x3f2e('0x33')]);_0x5b5dc2[_0x3f2e('0x34')]=_[_0x3f2e('0x36')](_0x5b5dc2['model'],_0x5b5dc2['query']);_0xe67d03[_0x3f2e('0x35')]=_[_0x3f2e('0x36')](_0x5b5dc2['model'],qs['fields'](_0x2be69f[_0x3f2e('0x33')][_0x3f2e('0x37')]));_0xe67d03[_0x3f2e('0x35')]=_0xe67d03['attributes'][_0x3f2e('0x38')]?_0xe67d03[_0x3f2e('0x35')]:_0x5b5dc2[_0x3f2e('0x30')];if(_0x2be69f['query'][_0x3f2e('0x47')]){_0xe67d03[_0x3f2e('0x42')]=[{'all':!![]}];}_0xe67d03=_[_0x3f2e('0x40')]({},_0xe67d03,_0x2be69f['options']);return db[_0x3f2e('0x43')][_0x3f2e('0x48')](_0xe67d03)[_0x3f2e('0x28')](handleEntityNotFound(_0x23de01,null))['then'](respondWithResult(_0x23de01,null))[_0x3f2e('0x49')](handleError(_0x23de01,null));};exports['create']=function(_0x3dc995,_0x538a4f){return db['ZendeskField'][_0x3f2e('0x4a')](_0x3dc995[_0x3f2e('0x4b')],{})[_0x3f2e('0x28')](respondWithResult(_0x538a4f,0xc9))[_0x3f2e('0x49')](handleError(_0x538a4f,null));};exports[_0x3f2e('0x27')]=function(_0x5c9cda,_0x5e2abd){if(_0x5c9cda[_0x3f2e('0x4b')]['id']){delete _0x5c9cda[_0x3f2e('0x4b')]['id'];}return db[_0x3f2e('0x43')][_0x3f2e('0x48')]({'where':{'id':_0x5c9cda[_0x3f2e('0x46')]['id']}})[_0x3f2e('0x28')](handleEntityNotFound(_0x5e2abd,null))[_0x3f2e('0x28')](saveUpdates(_0x5c9cda[_0x3f2e('0x4b')],null))[_0x3f2e('0x28')](respondWithResult(_0x5e2abd,null))['catch'](handleError(_0x5e2abd,null));};exports['destroy']=function(_0x2fe0c3,_0x5bdea1){return db[_0x3f2e('0x43')][_0x3f2e('0x48')]({'where':{'id':_0x2fe0c3[_0x3f2e('0x46')]['id']}})[_0x3f2e('0x28')](handleEntityNotFound(_0x5bdea1,null))['then'](removeEntity(_0x5bdea1,null))[_0x3f2e('0x49')](handleError(_0x5bdea1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d8c7fa8..d399fdf 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 _0x9086=['path','rimraf','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x38cd12,_0x375b42){var _0x4278f3=function(_0x1a0df9){while(--_0x1a0df9){_0x38cd12['push'](_0x38cd12['shift']());}};_0x4278f3(++_0x375b42);}(_0x9086,0x10b));var _0x6908=function(_0x165c96,_0x2269de){_0x165c96=_0x165c96-0x0;var _0x5c2420=_0x9086[_0x165c96];return _0x5c2420;};'use strict';var _=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var logger=require('../../config/logger')(_0x6908('0x2'));var moment=require(_0x6908('0x3'));var BPromise=require(_0x6908('0x4'));var rp=require(_0x6908('0x5'));var fs=require('fs');var path=require(_0x6908('0x6'));var rimraf=require(_0x6908('0x7'));var config=require('../../config/environment');var attributes=require(_0x6908('0x8'));module['exports']=function(_0x578f7a,_0xecf3b7){return _0x578f7a['define'](_0x6908('0x9'),attributes,{'tableName':_0x6908('0xa'),'paranoid':![],'indexes':[{'name':_0x6908('0xb'),'fields':['idField',_0x6908('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc91b=['../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc91b,0x16f));var _0xbc91=function(_0x5ec2c9,_0x11ae04){_0x5ec2c9=_0x5ec2c9-0x0;var _0x5a1b5e=_0xc91b[_0x5ec2c9];return _0x5a1b5e;};'use strict';var _=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var logger=require(_0xbc91('0x2'))(_0xbc91('0x3'));var moment=require(_0xbc91('0x4'));var BPromise=require(_0xbc91('0x5'));var rp=require(_0xbc91('0x6'));var fs=require('fs');var path=require(_0xbc91('0x7'));var rimraf=require('rimraf');var config=require(_0xbc91('0x8'));var attributes=require(_0xbc91('0x9'));module['exports']=function(_0x222ed7,_0x1e295b){return _0x222ed7['define'](_0xbc91('0xa'),attributes,{'tableName':_0xbc91('0xb'),'paranoid':![],'indexes':[{'name':_0xbc91('0xc'),'fields':[_0xbc91('0xd'),_0xbc91('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 15f81fa..49ebe6d 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 _0xa321=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0xa321,0x14b));var _0x1a32=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0xa321[_0x145b3c];return _0x1b6e36;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a32('0x0'));var BPromise=require(_0x1a32('0x1'));var rs=require(_0x1a32('0x2'));var fs=require('fs');var Redis=require(_0x1a32('0x3'));var db=require(_0x1a32('0x4'))['db'];var utils=require(_0x1a32('0x5'));var logger=require(_0x1a32('0x6'))(_0x1a32('0x7'));var config=require(_0x1a32('0x8'));var jayson=require(_0x1a32('0x9'));var client=jayson[_0x1a32('0xa')][_0x1a32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11240d,_0x429ad6,_0x41e8f3){return new BPromise(function(_0x1a74e6,_0x18c0b8){return client[_0x1a32('0xc')](_0x11240d,_0x41e8f3)['then'](function(_0xb71990){logger[_0x1a32('0xd')](_0x1a32('0xe'),_0x429ad6,_0x1a32('0xf'));logger[_0x1a32('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x429ad6,_0x1a32('0xf'),JSON['stringify'](_0xb71990));if(_0xb71990['error']){if(_0xb71990[_0x1a32('0x11')][_0x1a32('0x12')]===0x1f4){logger['error'](_0x1a32('0xe'),_0x429ad6,_0xb71990[_0x1a32('0x11')][_0x1a32('0x13')]);return _0x18c0b8(_0xb71990['error'][_0x1a32('0x13')]);}logger[_0x1a32('0x11')](_0x1a32('0xe'),_0x429ad6,_0xb71990[_0x1a32('0x11')][_0x1a32('0x13')]);return _0x1a74e6(_0xb71990[_0x1a32('0x11')][_0x1a32('0x13')]);}else{logger['info'](_0x1a32('0xe'),_0x429ad6,_0x1a32('0xf'));_0x1a74e6(_0xb71990[_0x1a32('0x14')][_0x1a32('0x13')]);}})[_0x1a32('0x15')](function(_0x2ee4dc){logger[_0x1a32('0x11')](_0x1a32('0xe'),_0x429ad6,_0x2ee4dc);_0x18c0b8(_0x2ee4dc);});});} \ No newline at end of file +var _0x5fa8=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x556e97,_0x550c48){var _0x44f6a4=function(_0x5cbd92){while(--_0x5cbd92){_0x556e97['push'](_0x556e97['shift']());}};_0x44f6a4(++_0x550c48);}(_0x5fa8,0x69));var _0x85fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fa8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x85fa('0x0'));var moment=require(_0x85fa('0x1'));var BPromise=require(_0x85fa('0x2'));var rs=require(_0x85fa('0x3'));var fs=require('fs');var Redis=require(_0x85fa('0x4'));var db=require(_0x85fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x85fa('0x6'))(_0x85fa('0x7'));var config=require(_0x85fa('0x8'));var jayson=require(_0x85fa('0x9'));var client=jayson[_0x85fa('0xa')][_0x85fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x495c92,_0x544a90,_0x1cc86f){return new BPromise(function(_0x33584e,_0x37d0f6){return client[_0x85fa('0xc')](_0x495c92,_0x1cc86f)[_0x85fa('0xd')](function(_0x5e2fb7){logger['info'](_0x85fa('0xe'),_0x544a90,_0x85fa('0xf'));logger[_0x85fa('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x544a90,_0x85fa('0xf'),JSON[_0x85fa('0x11')](_0x5e2fb7));if(_0x5e2fb7[_0x85fa('0x12')]){if(_0x5e2fb7[_0x85fa('0x12')][_0x85fa('0x13')]===0x1f4){logger[_0x85fa('0x12')]('ZendeskField,\x20%s,\x20%s',_0x544a90,_0x5e2fb7[_0x85fa('0x12')]['message']);return _0x37d0f6(_0x5e2fb7['error'][_0x85fa('0x14')]);}logger[_0x85fa('0x12')](_0x85fa('0xe'),_0x544a90,_0x5e2fb7[_0x85fa('0x12')]['message']);return _0x33584e(_0x5e2fb7[_0x85fa('0x12')][_0x85fa('0x14')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x544a90,_0x85fa('0xf'));_0x33584e(_0x5e2fb7[_0x85fa('0x15')][_0x85fa('0x14')]);}})['catch'](function(_0x88da1){logger['error'](_0x85fa('0xe'),_0x544a90,_0x88da1);_0x37d0f6(_0x88da1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ac500c3..27820c8 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x2d7260,_0x570e8d){var _0x3bbdfa=function(_0x465c4a){while(--_0x465c4a){_0x2d7260['push'](_0x2d7260['shift']());}};_0x3bbdfa(++_0x570e8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x26ae6a,_0x2ece29){var _0x50cb89=function(_0x3da453){while(--_0x3da453){_0x26ae6a['push'](_0x26ae6a['shift']());}};_0x50cb89(++_0x2ece29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 7cc6fbe..b18a6c9 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 _0x479a=['STRING','sequelize','exports'];(function(_0x43bc81,_0x43a697){var _0x352432=function(_0x2ff2d0){while(--_0x2ff2d0){_0x43bc81['push'](_0x43bc81['shift']());}};_0x352432(++_0x43a697);}(_0x479a,0x157));var _0xa479=function(_0x36923f,_0xef51a5){_0x36923f=_0x36923f-0x0;var _0xd03048=_0x479a[_0x36923f];return _0xd03048;};'use strict';var Sequelize=require(_0xa479('0x0'));module[_0xa479('0x1')]={'name':{'type':Sequelize[_0xa479('0x2')]},'description':{'type':Sequelize[_0xa479('0x2')]},'host':{'type':Sequelize[_0xa479('0x2')]},'zone':{'type':Sequelize[_0xa479('0x2')]},'clientId':{'type':Sequelize[_0xa479('0x2')]},'clientSecret':{'type':Sequelize[_0xa479('0x2')]},'serverUrl':{'type':Sequelize[_0xa479('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa479('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa2b1=['STRING','sequelize','exports'];(function(_0x561f76,_0x3c0bef){var _0x48b8e4=function(_0x3b7865){while(--_0x3b7865){_0x561f76['push'](_0x561f76['shift']());}};_0x48b8e4(++_0x3c0bef);}(_0xa2b1,0x184));var _0x1a2b=function(_0x50d5a3,_0x5c8a1e){_0x50d5a3=_0x50d5a3-0x0;var _0x46e263=_0xa2b1[_0x50d5a3];return _0x46e263;};'use strict';var Sequelize=require(_0x1a2b('0x0'));module[_0x1a2b('0x1')]={'name':{'type':Sequelize[_0x1a2b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1a2b('0x2')]},'zone':{'type':Sequelize[_0x1a2b('0x2')]},'clientId':{'type':Sequelize[_0x1a2b('0x2')]},'clientSecret':{'type':Sequelize[_0x1a2b('0x2')]},'serverUrl':{'type':Sequelize[_0x1a2b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x1a2b('0x2')]},'refreshToken':{'type':Sequelize[_0x1a2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 0f29113..2b68f28 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 _0x4dcb=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','status','end','count','offset','set','apply','reject','save','destroy','stack','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','include','show','params','find','create','body','getConfigurations','ZohoConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','system_mandatory','push','data_type','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xf8538c,_0x402ace){var _0x264330=function(_0xe8fa9a){while(--_0xe8fa9a){_0xf8538c['push'](_0xf8538c['shift']());}};_0x264330(++_0x402ace);}(_0x4dcb,0x186));var _0xb4dc=function(_0x32025b,_0x3b2f7f){_0x32025b=_0x32025b-0x0;var _0x37c280=_0x4dcb[_0x32025b];return _0x37c280;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb4dc('0x0'));var rimraf=require(_0xb4dc('0x1'));var zipdir=require(_0xb4dc('0x2'));var jsonpatch=require(_0xb4dc('0x3'));var rp=require(_0xb4dc('0x4'));var moment=require(_0xb4dc('0x5'));var BPromise=require(_0xb4dc('0x6'));var Mustache=require(_0xb4dc('0x7'));var util=require(_0xb4dc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb4dc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb4dc('0xa'));var squel=require(_0xb4dc('0xb'));var crypto=require(_0xb4dc('0xc'));var jsforce=require(_0xb4dc('0xd'));var deskjs=require(_0xb4dc('0xe'));var toCsv=require(_0xb4dc('0x9'));var querystring=require('querystring');var Papa=require(_0xb4dc('0xf'));var Redis=require(_0xb4dc('0x10'));var authService=require(_0xb4dc('0x11'));var qs=require(_0xb4dc('0x12'));var as=require(_0xb4dc('0x13'));var hardwareService=require(_0xb4dc('0x14'));var logger=require(_0xb4dc('0x15'))(_0xb4dc('0x16'));var utils=require(_0xb4dc('0x17'));var config=require(_0xb4dc('0x18'));var licenseUtil=require(_0xb4dc('0x19'));var db=require(_0xb4dc('0x1a'))['db'];var integrations=require(_0xb4dc('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0xb4dc('0x1c')][_0xb4dc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x186a6d,_0x311af9,_0x242f58,_0x4fbad5){return new BPromise(function(_0x5cd1dc,_0x410c88){var _0x1ecca2=_0x4fbad5||client;return _0x1ecca2[_0xb4dc('0x1e')](_0x186a6d,_0x242f58)[_0xb4dc('0x1f')](function(_0x35e5dd){logger[_0xb4dc('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x311af9,'request\x20sent');logger[_0xb4dc('0x21')](_0xb4dc('0x22'),_0x311af9,_0xb4dc('0x23'),JSON[_0xb4dc('0x24')](_0x35e5dd));if(_0x35e5dd[_0xb4dc('0x25')]){if(_0x35e5dd[_0xb4dc('0x25')][_0xb4dc('0x26')]===0x1f4){logger[_0xb4dc('0x25')](_0xb4dc('0x27'),_0x311af9,_0x35e5dd[_0xb4dc('0x25')][_0xb4dc('0x28')]);return _0x410c88(_0x35e5dd[_0xb4dc('0x25')][_0xb4dc('0x28')]);}logger[_0xb4dc('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x311af9,_0x35e5dd[_0xb4dc('0x25')]['message']);return _0x5cd1dc(_0x35e5dd[_0xb4dc('0x25')][_0xb4dc('0x28')]);}else{logger['info'](_0xb4dc('0x27'),_0x311af9,_0xb4dc('0x23'));_0x5cd1dc(_0x35e5dd[_0xb4dc('0x29')][_0xb4dc('0x28')]);}})[_0xb4dc('0x2a')](function(_0x1783c1){logger[_0xb4dc('0x25')](_0xb4dc('0x27'),_0x311af9,_0x1783c1);_0x410c88(_0x1783c1);});});}function respondWithStatusCode(_0xa2561d,_0x3f27f5){_0x3f27f5=_0x3f27f5||0xcc;return function(_0x528e6b){if(_0x528e6b){return _0xa2561d['sendStatus'](_0x3f27f5);}return _0xa2561d[_0xb4dc('0x2b')](_0x3f27f5)[_0xb4dc('0x2c')]();};}function respondWithResult(_0x2ffcd3,_0x32de62){_0x32de62=_0x32de62||0xc8;return function(_0x411c16){if(_0x411c16){return _0x2ffcd3[_0xb4dc('0x2b')](_0x32de62)['json'](_0x411c16);}};}function respondWithFilteredResult(_0x1039f2,_0x5c3c87){return function(_0x41b5b9){if(_0x41b5b9){var _0x4f72b7=_0x41b5b9[_0xb4dc('0x2d')],_0x4e070b=_0x5c3c87['offset'],_0x568d75=_0x5c3c87[_0xb4dc('0x2e')]+_0x5c3c87['limit'],_0x4a2c0c;if(_0x568d75>=_0x4f72b7){_0x568d75=_0x4f72b7;_0x4a2c0c=0xc8;}else{_0x4a2c0c=0xce;}_0x1039f2[_0xb4dc('0x2b')](_0x4a2c0c);return _0x1039f2[_0xb4dc('0x2f')]('Content-Range',_0x4e070b+'-'+_0x568d75+'/'+_0x4f72b7)['json'](_0x41b5b9);}return null;};}function patchUpdates(_0x10317a){return function(_0x11d20a){try{jsonpatch[_0xb4dc('0x30')](_0x11d20a,_0x10317a,!![]);}catch(_0x31d0c0){return BPromise[_0xb4dc('0x31')](_0x31d0c0);}return _0x11d20a[_0xb4dc('0x32')]();};}function saveUpdates(_0x151627,_0x340431){return function(_0x5942e4){if(_0x5942e4){return _0x5942e4['update'](_0x151627)[_0xb4dc('0x1f')](function(_0x392cdf){return _0x392cdf;});}return null;};}function removeEntity(_0x5d35c0,_0x195b6d){return function(_0x53e8ab){if(_0x53e8ab){return _0x53e8ab[_0xb4dc('0x33')]()[_0xb4dc('0x1f')](function(){_0x5d35c0[_0xb4dc('0x2b')](0xcc)[_0xb4dc('0x2c')]();});}};}function handleEntityNotFound(_0x4d4c78,_0x55bf60){return function(_0x684340){if(!_0x684340){_0x4d4c78['sendStatus'](0x194);}return _0x684340;};}function handleError(_0x526d99,_0x93cf8e){_0x93cf8e=_0x93cf8e||0x1f4;return function(_0x5eac3e){logger[_0xb4dc('0x25')](_0x5eac3e[_0xb4dc('0x34')]);if(_0x5eac3e['name']){delete _0x5eac3e['name'];}_0x526d99['status'](_0x93cf8e)['send'](_0x5eac3e);};}exports['index']=function(_0x450716,_0x46ab88){var _0x146214={},_0x4d30b6={},_0x467148={'count':0x0,'rows':[]};var _0x4516ca=_[_0xb4dc('0x35')](db[_0xb4dc('0x36')][_0xb4dc('0x37')],function(_0x5b90e0){return{'name':_0x5b90e0[_0xb4dc('0x38')],'type':_0x5b90e0[_0xb4dc('0x39')][_0xb4dc('0x3a')]};});_0x4d30b6[_0xb4dc('0x3b')]=_[_0xb4dc('0x35')](_0x4516ca,'name');_0x4d30b6['query']=_[_0xb4dc('0x3c')](_0x450716[_0xb4dc('0x3d')]);_0x4d30b6[_0xb4dc('0x3e')]=_['intersection'](_0x4d30b6[_0xb4dc('0x3b')],_0x4d30b6[_0xb4dc('0x3d')]);_0x146214[_0xb4dc('0x3f')]=_[_0xb4dc('0x40')](_0x4d30b6['model'],qs[_0xb4dc('0x41')](_0x450716[_0xb4dc('0x3d')][_0xb4dc('0x41')]));_0x146214[_0xb4dc('0x3f')]=_0x146214[_0xb4dc('0x3f')][_0xb4dc('0x42')]?_0x146214[_0xb4dc('0x3f')]:_0x4d30b6[_0xb4dc('0x3b')];if(!_0x450716['query'][_0xb4dc('0x43')](_0xb4dc('0x44'))){_0x146214['limit']=qs['limit'](_0x450716[_0xb4dc('0x3d')][_0xb4dc('0x45')]);_0x146214[_0xb4dc('0x2e')]=qs[_0xb4dc('0x2e')](_0x450716[_0xb4dc('0x3d')][_0xb4dc('0x2e')]);}_0x146214['order']=qs[_0xb4dc('0x46')](_0x450716[_0xb4dc('0x3d')][_0xb4dc('0x46')]);_0x146214['where']=qs[_0xb4dc('0x3e')](_[_0xb4dc('0x47')](_0x450716[_0xb4dc('0x3d')],_0x4d30b6[_0xb4dc('0x3e')]),_0x4516ca);if(_0x450716[_0xb4dc('0x3d')][_0xb4dc('0x48')]){_0x146214[_0xb4dc('0x49')]=_['merge'](_0x146214['where'],{'$or':_[_0xb4dc('0x35')](_0x4516ca,function(_0x10cd27){if(_0x10cd27['type']!==_0xb4dc('0x4a')){var _0x9eb3bf={};_0x9eb3bf[_0x10cd27[_0xb4dc('0x4b')]]={'$like':'%'+_0x450716[_0xb4dc('0x3d')][_0xb4dc('0x48')]+'%'};return _0x9eb3bf;}})});}_0x146214=_[_0xb4dc('0x4c')]({},_0x146214,_0x450716[_0xb4dc('0x4d')]);var _0x54e93b={'where':_0x146214['where']};return db[_0xb4dc('0x36')][_0xb4dc('0x2d')](_0x54e93b)['then'](function(_0x226372){_0x467148[_0xb4dc('0x2d')]=_0x226372;if(_0x450716[_0xb4dc('0x3d')][_0xb4dc('0x4e')]){_0x146214[_0xb4dc('0x4f')]=[{'all':!![]}];}return db[_0xb4dc('0x36')]['findAll'](_0x146214);})[_0xb4dc('0x1f')](function(_0x15194f){_0x467148['rows']=_0x15194f;return _0x467148;})[_0xb4dc('0x1f')](respondWithFilteredResult(_0x46ab88,_0x146214))[_0xb4dc('0x2a')](handleError(_0x46ab88,null));};exports[_0xb4dc('0x50')]=function(_0x917af6,_0x14a781){var _0x308cc7={'raw':![],'where':{'id':_0x917af6[_0xb4dc('0x51')]['id']}},_0x104781={};_0x104781[_0xb4dc('0x3b')]=_['keys'](db[_0xb4dc('0x36')][_0xb4dc('0x37')]);_0x104781['query']=_[_0xb4dc('0x3c')](_0x917af6[_0xb4dc('0x3d')]);_0x104781[_0xb4dc('0x3e')]=_[_0xb4dc('0x40')](_0x104781[_0xb4dc('0x3b')],_0x104781[_0xb4dc('0x3d')]);_0x308cc7[_0xb4dc('0x3f')]=_[_0xb4dc('0x40')](_0x104781['model'],qs[_0xb4dc('0x41')](_0x917af6['query'][_0xb4dc('0x41')]));_0x308cc7[_0xb4dc('0x3f')]=_0x308cc7[_0xb4dc('0x3f')][_0xb4dc('0x42')]?_0x308cc7['attributes']:_0x104781['model'];if(_0x917af6[_0xb4dc('0x3d')][_0xb4dc('0x4e')]){_0x308cc7[_0xb4dc('0x4f')]=[{'all':!![]}];}_0x308cc7=_[_0xb4dc('0x4c')]({},_0x308cc7,_0x917af6[_0xb4dc('0x4d')]);return db[_0xb4dc('0x36')][_0xb4dc('0x52')](_0x308cc7)[_0xb4dc('0x1f')](handleEntityNotFound(_0x14a781,null))[_0xb4dc('0x1f')](respondWithResult(_0x14a781,null))[_0xb4dc('0x2a')](handleError(_0x14a781,null));};exports[_0xb4dc('0x53')]=function(_0x3ef790,_0x1da38c){return db['ZohoAccount'][_0xb4dc('0x53')](_0x3ef790[_0xb4dc('0x54')],{})[_0xb4dc('0x1f')](respondWithResult(_0x1da38c,0xc9))[_0xb4dc('0x2a')](handleError(_0x1da38c,null));};exports['update']=function(_0x358c4e,_0x4f5923){if(_0x358c4e['body']['id']){delete _0x358c4e['body']['id'];}return db[_0xb4dc('0x36')][_0xb4dc('0x52')]({'where':{'id':_0x358c4e['params']['id']}})['then'](handleEntityNotFound(_0x4f5923,null))[_0xb4dc('0x1f')](saveUpdates(_0x358c4e[_0xb4dc('0x54')],null))[_0xb4dc('0x1f')](respondWithResult(_0x4f5923,null))[_0xb4dc('0x2a')](handleError(_0x4f5923,null));};exports[_0xb4dc('0x33')]=function(_0x123219,_0x2fadc1){return db[_0xb4dc('0x36')]['find']({'where':{'id':_0x123219[_0xb4dc('0x51')]['id']}})[_0xb4dc('0x1f')](handleEntityNotFound(_0x2fadc1,null))[_0xb4dc('0x1f')](removeEntity(_0x2fadc1,null))[_0xb4dc('0x2a')](handleError(_0x2fadc1,null));};exports[_0xb4dc('0x55')]=function(_0xe32dbd,_0x262cf0,_0x434899){var _0x13e66c={};var _0x3acb7e={};var _0x2960a4;var _0x1469be;return db[_0xb4dc('0x36')]['findOne']({'where':{'id':_0xe32dbd[_0xb4dc('0x51')]['id']}})['then'](handleEntityNotFound(_0x262cf0,null))[_0xb4dc('0x1f')](function(_0x4b49ce){if(_0x4b49ce){_0x2960a4=_0x4b49ce;_0x3acb7e['model']=_['keys'](db[_0xb4dc('0x56')]['rawAttributes']);_0x3acb7e['query']=_['keys'](_0xe32dbd[_0xb4dc('0x3d')]);_0x3acb7e[_0xb4dc('0x3e')]=_[_0xb4dc('0x40')](_0x3acb7e['model'],_0x3acb7e[_0xb4dc('0x3d')]);_0x13e66c[_0xb4dc('0x3f')]=_[_0xb4dc('0x40')](_0x3acb7e[_0xb4dc('0x3b')],qs[_0xb4dc('0x41')](_0xe32dbd[_0xb4dc('0x3d')][_0xb4dc('0x41')]));_0x13e66c[_0xb4dc('0x3f')]=_0x13e66c['attributes'][_0xb4dc('0x42')]?_0x13e66c['attributes']:_0x3acb7e['model'];_0x13e66c[_0xb4dc('0x57')]=qs[_0xb4dc('0x46')](_0xe32dbd[_0xb4dc('0x3d')][_0xb4dc('0x46')]);_0x13e66c['where']=qs[_0xb4dc('0x3e')](_[_0xb4dc('0x47')](_0xe32dbd['query'],_0x3acb7e[_0xb4dc('0x3e')]));if(_0xe32dbd[_0xb4dc('0x3d')][_0xb4dc('0x48')]){_0x13e66c['where']=_['merge'](_0x13e66c[_0xb4dc('0x49')],{'$or':_[_0xb4dc('0x35')](_0x13e66c[_0xb4dc('0x3f')],function(_0x59bffe){var _0x4b1ac0={};_0x4b1ac0[_0x59bffe]={'$like':'%'+_0xe32dbd[_0xb4dc('0x3d')]['filter']+'%'};return _0x4b1ac0;})});}_0x13e66c=_[_0xb4dc('0x4c')]({},_0x13e66c,_0xe32dbd['options']);return _0x2960a4[_0xb4dc('0x55')](_0x13e66c);}})['then'](function(_0x1b1149){if(_0x1b1149){_0x1469be=_0x1b1149[_0xb4dc('0x42')];if(!_0xe32dbd[_0xb4dc('0x3d')]['hasOwnProperty'](_0xb4dc('0x44'))){_0x13e66c[_0xb4dc('0x45')]=qs[_0xb4dc('0x45')](_0xe32dbd[_0xb4dc('0x3d')][_0xb4dc('0x45')]);_0x13e66c['offset']=qs['offset'](_0xe32dbd[_0xb4dc('0x3d')][_0xb4dc('0x2e')]);}return _0x2960a4[_0xb4dc('0x55')](_0x13e66c);}})[_0xb4dc('0x1f')](function(_0x188932){if(_0x188932){return _0x188932?{'count':_0x1469be,'rows':_0x188932}:null;}})[_0xb4dc('0x1f')](respondWithResult(_0x262cf0,null))['catch'](handleError(_0x262cf0,null));};exports[_0xb4dc('0x58')]=function(_0xb8c16,_0x50bd99,_0x11819d){if(_0xb8c16[_0xb4dc('0x54')]['id']){delete _0xb8c16[_0xb4dc('0x54')]['id'];}return db[_0xb4dc('0x36')][_0xb4dc('0x59')]({'where':{'id':_0xb8c16[_0xb4dc('0x51')]['id']}})[_0xb4dc('0x1f')](handleEntityNotFound(_0x50bd99,null))[_0xb4dc('0x1f')](function(_0xe94421){if(_0xe94421){_0xb8c16[_0xb4dc('0x54')][_0xb4dc('0x5a')]=_0xe94421['id'];_0xb8c16['body'][_0xb4dc('0x5b')]=integrations['getSubjects'](_0xb8c16[_0xb4dc('0x54')]['channel'],_0xb8c16[_0xb4dc('0x54')][_0xb4dc('0x39')]);_0xb8c16[_0xb4dc('0x54')][_0xb4dc('0x5c')]=integrations['getDescriptions'](_0xb8c16[_0xb4dc('0x54')][_0xb4dc('0x5d')],_0xb8c16[_0xb4dc('0x54')][_0xb4dc('0x39')]);return db[_0xb4dc('0x56')]['create'](_0xb8c16[_0xb4dc('0x54')],{'include':[{'model':db[_0xb4dc('0x5e')],'as':_0xb4dc('0x5b')},{'model':db['ZohoField'],'as':_0xb4dc('0x5c')}]});}return null;})[_0xb4dc('0x1f')](respondWithResult(_0x50bd99,null))[_0xb4dc('0x2a')](handleError(_0x50bd99,null));};function getAccessToken(_0x5b4198){return new Promise(function(_0x116f0b,_0xc43980){var _0x5d0231;switch(_0x5b4198[_0xb4dc('0x5f')]){case'US':_0x5d0231=_0xb4dc('0x60');break;case'AU':_0x5d0231=_0xb4dc('0x61');break;case'EU':_0x5d0231=_0xb4dc('0x62');break;case'IN':_0x5d0231='https://accounts.zoho.in';break;case'CN':_0x5d0231=_0xb4dc('0x63');break;default:_0x5d0231=_0xb4dc('0x62');break;}var _0x317d59={'method':_0xb4dc('0x64'),'uri':_0x5d0231+'/oauth/v2/token','qs':{'refresh_token':_0x5b4198[_0xb4dc('0x65')],'client_id':_0x5b4198[_0xb4dc('0x66')],'client_secret':_0x5b4198[_0xb4dc('0x67')],'grant_type':_0xb4dc('0x68')},'json':!![]};return rp(_0x317d59)[_0xb4dc('0x1f')](function(_0x5453af){if(_0x5453af['access_token']){_0x116f0b(_0x5453af[_0xb4dc('0x69')]);}else{_0xc43980(_0xb4dc('0x6a'));}})['catch'](function(_0x5b70c8){_0xc43980(_0x5b70c8);});});}exports[_0xb4dc('0x6b')]=function(_0x17ef07,_0x49ffdc,_0x46edc9){var _0x7ca105,_0x43cb3f,_0x154294,_0x5e5f35,_0x3337a5;return db[_0xb4dc('0x36')]['findOne']({'where':{'id':_0x17ef07[_0xb4dc('0x51')]['id']},'attributes':['id',_0xb4dc('0x6c'),_0xb4dc('0x5f'),_0xb4dc('0x66'),_0xb4dc('0x67'),_0xb4dc('0x6d'),_0xb4dc('0x26'),_0xb4dc('0x65')]})[_0xb4dc('0x1f')](handleEntityNotFound(_0x49ffdc,null))[_0xb4dc('0x1f')](function(_0x1466b2){_0x3337a5=_0x1466b2;_0x7ca105=_0x3337a5[_0xb4dc('0x6c')];_0x43cb3f=_0x7ca105===_0xb4dc('0x6e')?'eu':_0xb4dc('0x6f');_0x154294=_0x3337a5[_0xb4dc('0x6d')];var _0x3fb9b9=_0x154294[_0xb4dc('0x70')](-0x1);if(_0x3fb9b9==='/'||_0x3fb9b9==='\x5c'||_0x3fb9b9===':'){_0x154294=_0x154294[_0xb4dc('0x71')](0x0,_0x154294[_0xb4dc('0x72')](_0x3fb9b9));}if(!_0x3337a5[_0xb4dc('0x65')]){throw new Error(_0xb4dc('0x73'));}return getAccessToken(_0x3337a5);})[_0xb4dc('0x1f')](function(_0x2f9305){if(_0x2f9305){return rp({'method':_0xb4dc('0x74'),'uri':util[_0xb4dc('0x75')](_0xb4dc('0x76'),_0x43cb3f),'qs':{'module':_0xb4dc('0x77')},'headers':{'Authorization':_0xb4dc('0x78')+_0x2f9305},'json':!![]});}})[_0xb4dc('0x1f')](function(_0x34b67a){if(_0x34b67a){if(_0x34b67a[_0xb4dc('0x79')]&&_0x34b67a[_0xb4dc('0x79')][_0xb4dc('0x25')]){throw new Error(_0x34b67a[_0xb4dc('0x79')][_0xb4dc('0x25')][_0xb4dc('0x28')]);}var _0x571e0f=[];var _0x34f9ef=[];var _0x93300c=[_0xb4dc('0x7a'),_0xb4dc('0x7b'),'Description',_0xb4dc('0x7c'),_0xb4dc('0x7d'),_0xb4dc('0x7e'),_0xb4dc('0x7f'),_0xb4dc('0x80')];_0x34f9ef=_[_0xb4dc('0x81')](_0x34b67a[_0xb4dc('0x41')],function(_0x225bdf){return _0x93300c['includes'](_0x225bdf['api_name']);});for(var _0x1f10ed=0x0;_0x1f10ed<_0x34f9ef['length'];_0x1f10ed++){if(_0x34f9ef[_0x1f10ed][_0xb4dc('0x82')]===![]){_0x571e0f[_0xb4dc('0x83')]({'id':_0x34f9ef[_0x1f10ed]['id'],'name':_0x34f9ef[_0x1f10ed]['display_label'],'custom':_0x34f9ef[_0x1f10ed]['custom_field'],'options':_0x34f9ef[_0x1f10ed][_0xb4dc('0x84')]==='picklist'&&_0x34f9ef[_0x1f10ed][_0xb4dc('0x85')][_0xb4dc('0x42')]>-0x1?_['map'](_0x34f9ef[_0x1f10ed]['pick_list_values'],function(_0xd7bcfa){return{'name':_0xd7bcfa,'value':_0xd7bcfa};}):[]});}}return{'count':_0x571e0f[_0xb4dc('0x42')],'rows':_0x571e0f};}else{return{'count':0x0,'rows':[]};}})[_0xb4dc('0x1f')](respondWithResult(_0x49ffdc,null))['catch'](function(_0x588269){var _0x1368fc=_0x17ef07[_0xb4dc('0x3d')]['test']?0x1f4:_0x588269['statusCode']||0x1f4;logger[_0xb4dc('0x25')](_0xb4dc('0x86'),'getFields',_0x1368fc,JSON['stringify'](_0x588269));delete _0x588269[_0xb4dc('0x4b')];if(_0x1368fc===0x191){_0x1368fc=0x190;}_0x49ffdc[_0xb4dc('0x2b')](_0x1368fc)['send'](_0x17ef07[_0xb4dc('0x3d')][_0xb4dc('0x87')]?{'message':_0xb4dc('0x88'),'statusCode':_0x588269[_0xb4dc('0x89')]}:_0x588269);});}; \ No newline at end of file +var _0x7da6=['data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','find','create','body','findOne','ZohoConfiguration','hasOwnProperty','getConfigurations','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','refreshToken','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field'];(function(_0x3accdb,_0x187888){var _0x4dab57=function(_0x2ac22b){while(--_0x2ac22b){_0x3accdb['push'](_0x3accdb['shift']());}};_0x4dab57(++_0x187888);}(_0x7da6,0x124));var _0x67da=function(_0x4eaa9c,_0x3a879a){_0x4eaa9c=_0x4eaa9c-0x0;var _0x46b796=_0x7da6[_0x4eaa9c];return _0x46b796;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x67da('0x0'));var zipdir=require(_0x67da('0x1'));var jsonpatch=require(_0x67da('0x2'));var rp=require(_0x67da('0x3'));var moment=require('moment');var BPromise=require(_0x67da('0x4'));var Mustache=require(_0x67da('0x5'));var util=require(_0x67da('0x6'));var path=require(_0x67da('0x7'));var sox=require(_0x67da('0x8'));var csv=require(_0x67da('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x67da('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x67da('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x67da('0x9'));var querystring=require('querystring');var Papa=require(_0x67da('0xc'));var Redis=require(_0x67da('0xd'));var authService=require(_0x67da('0xe'));var qs=require(_0x67da('0xf'));var as=require(_0x67da('0x10'));var hardwareService=require(_0x67da('0x11'));var logger=require(_0x67da('0x12'))('api');var utils=require(_0x67da('0x13'));var config=require(_0x67da('0x14'));var licenseUtil=require(_0x67da('0x15'));var db=require(_0x67da('0x16'))['db'];var integrations=require(_0x67da('0x17'));var jayson=require(_0x67da('0x18'));var client=jayson['client'][_0x67da('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x9beca6,_0x3929fb,_0x12d4d1,_0x13bb5b){return new BPromise(function(_0x508b4a,_0x11c7b5){var _0x33c466=_0x13bb5b||client;return _0x33c466['request'](_0x9beca6,_0x12d4d1)[_0x67da('0x1a')](function(_0x3b7f96){logger[_0x67da('0x1b')](_0x67da('0x1c'),_0x3929fb,_0x67da('0x1d'));logger[_0x67da('0x1e')](_0x67da('0x1f'),_0x3929fb,_0x67da('0x1d'),JSON['stringify'](_0x3b7f96));if(_0x3b7f96[_0x67da('0x20')]){if(_0x3b7f96['error'][_0x67da('0x21')]===0x1f4){logger['error'](_0x67da('0x1c'),_0x3929fb,_0x3b7f96[_0x67da('0x20')][_0x67da('0x22')]);return _0x11c7b5(_0x3b7f96[_0x67da('0x20')]['message']);}logger[_0x67da('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x3929fb,_0x3b7f96['error'][_0x67da('0x22')]);return _0x508b4a(_0x3b7f96[_0x67da('0x20')][_0x67da('0x22')]);}else{logger[_0x67da('0x1b')]('ZohoAccount,\x20%s,\x20%s',_0x3929fb,'request\x20sent');_0x508b4a(_0x3b7f96['result'][_0x67da('0x22')]);}})[_0x67da('0x23')](function(_0x45fe05){logger[_0x67da('0x20')](_0x67da('0x1c'),_0x3929fb,_0x45fe05);_0x11c7b5(_0x45fe05);});});}function respondWithStatusCode(_0x4e6cb1,_0x5f1a47){_0x5f1a47=_0x5f1a47||0xcc;return function(_0xc2667e){if(_0xc2667e){return _0x4e6cb1[_0x67da('0x24')](_0x5f1a47);}return _0x4e6cb1['status'](_0x5f1a47)[_0x67da('0x25')]();};}function respondWithResult(_0x599a9d,_0x4417e5){_0x4417e5=_0x4417e5||0xc8;return function(_0x15207c){if(_0x15207c){return _0x599a9d[_0x67da('0x26')](_0x4417e5)[_0x67da('0x27')](_0x15207c);}};}function respondWithFilteredResult(_0x33a74d,_0x35b1bc){return function(_0x4c4bfe){if(_0x4c4bfe){var _0x2d2549=_0x4c4bfe[_0x67da('0x28')],_0x168a49=_0x35b1bc[_0x67da('0x29')],_0x5875d9=_0x35b1bc[_0x67da('0x29')]+_0x35b1bc[_0x67da('0x2a')],_0x5afdc4;if(_0x5875d9>=_0x2d2549){_0x5875d9=_0x2d2549;_0x5afdc4=0xc8;}else{_0x5afdc4=0xce;}_0x33a74d['status'](_0x5afdc4);return _0x33a74d[_0x67da('0x2b')](_0x67da('0x2c'),_0x168a49+'-'+_0x5875d9+'/'+_0x2d2549)[_0x67da('0x27')](_0x4c4bfe);}return null;};}function patchUpdates(_0x3a40f5){return function(_0x22fa93){try{jsonpatch[_0x67da('0x2d')](_0x22fa93,_0x3a40f5,!![]);}catch(_0x6962a0){return BPromise[_0x67da('0x2e')](_0x6962a0);}return _0x22fa93[_0x67da('0x2f')]();};}function saveUpdates(_0x91fc5c,_0x18dd99){return function(_0x181b99){if(_0x181b99){return _0x181b99[_0x67da('0x30')](_0x91fc5c)[_0x67da('0x1a')](function(_0x48e08a){return _0x48e08a;});}return null;};}function removeEntity(_0x229b6b,_0x2a949a){return function(_0x19e68c){if(_0x19e68c){return _0x19e68c[_0x67da('0x31')]()[_0x67da('0x1a')](function(){_0x229b6b[_0x67da('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x762be5,_0x31f025){return function(_0x6c4b32){if(!_0x6c4b32){_0x762be5['sendStatus'](0x194);}return _0x6c4b32;};}function handleError(_0x5a21e6,_0x5c9ab8){_0x5c9ab8=_0x5c9ab8||0x1f4;return function(_0x4cfcab){logger[_0x67da('0x20')](_0x4cfcab['stack']);if(_0x4cfcab[_0x67da('0x32')]){delete _0x4cfcab[_0x67da('0x32')];}_0x5a21e6[_0x67da('0x26')](_0x5c9ab8)[_0x67da('0x33')](_0x4cfcab);};}exports[_0x67da('0x34')]=function(_0x16b425,_0x2e37cb){var _0x13dbcb={},_0x3a4140={},_0x11ec02={'count':0x0,'rows':[]};var _0x207e63=_[_0x67da('0x35')](db[_0x67da('0x36')][_0x67da('0x37')],function(_0x3e48bf){return{'name':_0x3e48bf[_0x67da('0x38')],'type':_0x3e48bf[_0x67da('0x39')][_0x67da('0x3a')]};});_0x3a4140[_0x67da('0x3b')]=_[_0x67da('0x35')](_0x207e63,_0x67da('0x32'));_0x3a4140[_0x67da('0x3c')]=_[_0x67da('0x3d')](_0x16b425[_0x67da('0x3c')]);_0x3a4140[_0x67da('0x3e')]=_[_0x67da('0x3f')](_0x3a4140['model'],_0x3a4140[_0x67da('0x3c')]);_0x13dbcb[_0x67da('0x40')]=_['intersection'](_0x3a4140[_0x67da('0x3b')],qs[_0x67da('0x41')](_0x16b425['query']['fields']));_0x13dbcb['attributes']=_0x13dbcb[_0x67da('0x40')][_0x67da('0x42')]?_0x13dbcb[_0x67da('0x40')]:_0x3a4140[_0x67da('0x3b')];if(!_0x16b425[_0x67da('0x3c')]['hasOwnProperty'](_0x67da('0x43'))){_0x13dbcb['limit']=qs[_0x67da('0x2a')](_0x16b425[_0x67da('0x3c')][_0x67da('0x2a')]);_0x13dbcb[_0x67da('0x29')]=qs['offset'](_0x16b425[_0x67da('0x3c')]['offset']);}_0x13dbcb[_0x67da('0x44')]=qs[_0x67da('0x45')](_0x16b425[_0x67da('0x3c')]['sort']);_0x13dbcb[_0x67da('0x46')]=qs[_0x67da('0x3e')](_[_0x67da('0x47')](_0x16b425[_0x67da('0x3c')],_0x3a4140[_0x67da('0x3e')]),_0x207e63);if(_0x16b425[_0x67da('0x3c')]['filter']){_0x13dbcb['where']=_[_0x67da('0x48')](_0x13dbcb[_0x67da('0x46')],{'$or':_['map'](_0x207e63,function(_0x2ebc66){if(_0x2ebc66[_0x67da('0x39')]!=='VIRTUAL'){var _0x52840a={};_0x52840a[_0x2ebc66[_0x67da('0x32')]]={'$like':'%'+_0x16b425[_0x67da('0x3c')][_0x67da('0x49')]+'%'};return _0x52840a;}})});}_0x13dbcb=_['merge']({},_0x13dbcb,_0x16b425[_0x67da('0x4a')]);var _0x482734={'where':_0x13dbcb[_0x67da('0x46')]};return db[_0x67da('0x36')][_0x67da('0x28')](_0x482734)['then'](function(_0x883f08){_0x11ec02['count']=_0x883f08;if(_0x16b425[_0x67da('0x3c')][_0x67da('0x4b')]){_0x13dbcb[_0x67da('0x4c')]=[{'all':!![]}];}return db[_0x67da('0x36')]['findAll'](_0x13dbcb);})[_0x67da('0x1a')](function(_0x56671f){_0x11ec02[_0x67da('0x4d')]=_0x56671f;return _0x11ec02;})[_0x67da('0x1a')](respondWithFilteredResult(_0x2e37cb,_0x13dbcb))[_0x67da('0x23')](handleError(_0x2e37cb,null));};exports[_0x67da('0x4e')]=function(_0x446fb3,_0x40420b){var _0x5d9ebc={'raw':![],'where':{'id':_0x446fb3[_0x67da('0x4f')]['id']}},_0x3d4288={};_0x3d4288['model']=_[_0x67da('0x3d')](db[_0x67da('0x36')][_0x67da('0x37')]);_0x3d4288[_0x67da('0x3c')]=_[_0x67da('0x3d')](_0x446fb3['query']);_0x3d4288[_0x67da('0x3e')]=_[_0x67da('0x3f')](_0x3d4288[_0x67da('0x3b')],_0x3d4288[_0x67da('0x3c')]);_0x5d9ebc[_0x67da('0x40')]=_[_0x67da('0x3f')](_0x3d4288[_0x67da('0x3b')],qs[_0x67da('0x41')](_0x446fb3['query'][_0x67da('0x41')]));_0x5d9ebc[_0x67da('0x40')]=_0x5d9ebc[_0x67da('0x40')]['length']?_0x5d9ebc[_0x67da('0x40')]:_0x3d4288[_0x67da('0x3b')];if(_0x446fb3[_0x67da('0x3c')]['includeAll']){_0x5d9ebc[_0x67da('0x4c')]=[{'all':!![]}];}_0x5d9ebc=_[_0x67da('0x48')]({},_0x5d9ebc,_0x446fb3[_0x67da('0x4a')]);return db[_0x67da('0x36')][_0x67da('0x50')](_0x5d9ebc)[_0x67da('0x1a')](handleEntityNotFound(_0x40420b,null))[_0x67da('0x1a')](respondWithResult(_0x40420b,null))['catch'](handleError(_0x40420b,null));};exports[_0x67da('0x51')]=function(_0x28b71a,_0x4efb75){return db[_0x67da('0x36')]['create'](_0x28b71a[_0x67da('0x52')],{})[_0x67da('0x1a')](respondWithResult(_0x4efb75,0xc9))[_0x67da('0x23')](handleError(_0x4efb75,null));};exports['update']=function(_0x1b82f9,_0x54602d){if(_0x1b82f9['body']['id']){delete _0x1b82f9['body']['id'];}return db[_0x67da('0x36')][_0x67da('0x50')]({'where':{'id':_0x1b82f9[_0x67da('0x4f')]['id']}})['then'](handleEntityNotFound(_0x54602d,null))[_0x67da('0x1a')](saveUpdates(_0x1b82f9['body'],null))['then'](respondWithResult(_0x54602d,null))['catch'](handleError(_0x54602d,null));};exports[_0x67da('0x31')]=function(_0x525f1a,_0x4c96ca){return db[_0x67da('0x36')]['find']({'where':{'id':_0x525f1a[_0x67da('0x4f')]['id']}})[_0x67da('0x1a')](handleEntityNotFound(_0x4c96ca,null))[_0x67da('0x1a')](removeEntity(_0x4c96ca,null))[_0x67da('0x23')](handleError(_0x4c96ca,null));};exports['getConfigurations']=function(_0x1c478f,_0x1160b1,_0x4ac3df){var _0x27cebd={};var _0x45f320={};var _0x142518;var _0xbc383c;return db[_0x67da('0x36')][_0x67da('0x53')]({'where':{'id':_0x1c478f[_0x67da('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1160b1,null))[_0x67da('0x1a')](function(_0x542ae2){if(_0x542ae2){_0x142518=_0x542ae2;_0x45f320[_0x67da('0x3b')]=_[_0x67da('0x3d')](db[_0x67da('0x54')]['rawAttributes']);_0x45f320[_0x67da('0x3c')]=_[_0x67da('0x3d')](_0x1c478f[_0x67da('0x3c')]);_0x45f320[_0x67da('0x3e')]=_[_0x67da('0x3f')](_0x45f320[_0x67da('0x3b')],_0x45f320['query']);_0x27cebd['attributes']=_['intersection'](_0x45f320[_0x67da('0x3b')],qs[_0x67da('0x41')](_0x1c478f[_0x67da('0x3c')][_0x67da('0x41')]));_0x27cebd['attributes']=_0x27cebd['attributes'][_0x67da('0x42')]?_0x27cebd[_0x67da('0x40')]:_0x45f320[_0x67da('0x3b')];_0x27cebd[_0x67da('0x44')]=qs['sort'](_0x1c478f[_0x67da('0x3c')][_0x67da('0x45')]);_0x27cebd['where']=qs[_0x67da('0x3e')](_[_0x67da('0x47')](_0x1c478f[_0x67da('0x3c')],_0x45f320[_0x67da('0x3e')]));if(_0x1c478f[_0x67da('0x3c')][_0x67da('0x49')]){_0x27cebd['where']=_[_0x67da('0x48')](_0x27cebd[_0x67da('0x46')],{'$or':_[_0x67da('0x35')](_0x27cebd['attributes'],function(_0x2f265c){var _0x5ceac9={};_0x5ceac9[_0x2f265c]={'$like':'%'+_0x1c478f[_0x67da('0x3c')][_0x67da('0x49')]+'%'};return _0x5ceac9;})});}_0x27cebd=_[_0x67da('0x48')]({},_0x27cebd,_0x1c478f[_0x67da('0x4a')]);return _0x142518['getConfigurations'](_0x27cebd);}})[_0x67da('0x1a')](function(_0x1fa2ab){if(_0x1fa2ab){_0xbc383c=_0x1fa2ab['length'];if(!_0x1c478f['query'][_0x67da('0x55')](_0x67da('0x43'))){_0x27cebd[_0x67da('0x2a')]=qs[_0x67da('0x2a')](_0x1c478f[_0x67da('0x3c')][_0x67da('0x2a')]);_0x27cebd[_0x67da('0x29')]=qs[_0x67da('0x29')](_0x1c478f['query'][_0x67da('0x29')]);}return _0x142518[_0x67da('0x56')](_0x27cebd);}})[_0x67da('0x1a')](function(_0x511448){if(_0x511448){return _0x511448?{'count':_0xbc383c,'rows':_0x511448}:null;}})[_0x67da('0x1a')](respondWithResult(_0x1160b1,null))[_0x67da('0x23')](handleError(_0x1160b1,null));};exports[_0x67da('0x57')]=function(_0xd28cb4,_0x167038,_0x454d30){if(_0xd28cb4[_0x67da('0x52')]['id']){delete _0xd28cb4[_0x67da('0x52')]['id'];}return db[_0x67da('0x36')][_0x67da('0x53')]({'where':{'id':_0xd28cb4[_0x67da('0x4f')]['id']}})[_0x67da('0x1a')](handleEntityNotFound(_0x167038,null))[_0x67da('0x1a')](function(_0x4f2317){if(_0x4f2317){_0xd28cb4[_0x67da('0x52')][_0x67da('0x58')]=_0x4f2317['id'];_0xd28cb4[_0x67da('0x52')]['Subjects']=integrations[_0x67da('0x59')](_0xd28cb4[_0x67da('0x52')][_0x67da('0x5a')],_0xd28cb4[_0x67da('0x52')][_0x67da('0x39')]);_0xd28cb4[_0x67da('0x52')]['Descriptions']=integrations[_0x67da('0x5b')](_0xd28cb4[_0x67da('0x52')][_0x67da('0x5a')],_0xd28cb4['body'][_0x67da('0x39')]);return db[_0x67da('0x54')][_0x67da('0x51')](_0xd28cb4[_0x67da('0x52')],{'include':[{'model':db[_0x67da('0x5c')],'as':'Subjects'},{'model':db[_0x67da('0x5c')],'as':_0x67da('0x5d')}]});}return null;})[_0x67da('0x1a')](respondWithResult(_0x167038,null))['catch'](handleError(_0x167038,null));};function getAccessToken(_0x445634){return new Promise(function(_0x30332e,_0x5154cf){var _0x41f1a2;switch(_0x445634[_0x67da('0x5e')]){case'US':_0x41f1a2=_0x67da('0x5f');break;case'AU':_0x41f1a2=_0x67da('0x60');break;case'EU':_0x41f1a2='https://accounts.zoho.eu';break;case'IN':_0x41f1a2=_0x67da('0x61');break;case'CN':_0x41f1a2=_0x67da('0x62');break;default:_0x41f1a2=_0x67da('0x63');break;}var _0x21be6a={'method':'POST','uri':_0x41f1a2+_0x67da('0x64'),'qs':{'refresh_token':_0x445634['refreshToken'],'client_id':_0x445634[_0x67da('0x65')],'client_secret':_0x445634[_0x67da('0x66')],'grant_type':_0x67da('0x67')},'json':!![]};return rp(_0x21be6a)[_0x67da('0x1a')](function(_0x2ffc32){if(_0x2ffc32[_0x67da('0x68')]){_0x30332e(_0x2ffc32[_0x67da('0x68')]);}else{_0x5154cf(_0x67da('0x69'));}})['catch'](function(_0x41b2f6){_0x5154cf(_0x41b2f6);});});}exports[_0x67da('0x6a')]=function(_0x59ebe9,_0x52c000,_0x2257ab){var _0x5c8ce6,_0x20d037,_0xd8c49,_0x10063f,_0x3c94d8;return db['ZohoAccount']['findOne']({'where':{'id':_0x59ebe9[_0x67da('0x4f')]['id']},'attributes':['id','host',_0x67da('0x5e'),_0x67da('0x65'),_0x67da('0x66'),'serverUrl',_0x67da('0x21'),_0x67da('0x6b')]})[_0x67da('0x1a')](handleEntityNotFound(_0x52c000,null))[_0x67da('0x1a')](function(_0x5b2008){_0x3c94d8=_0x5b2008;_0x5c8ce6=_0x3c94d8[_0x67da('0x6c')];_0x20d037=_0x5c8ce6===_0x67da('0x6d')?'eu':_0x67da('0x6e');_0xd8c49=_0x3c94d8[_0x67da('0x6f')];var _0x4c9a19=_0xd8c49[_0x67da('0x70')](-0x1);if(_0x4c9a19==='/'||_0x4c9a19==='\x5c'||_0x4c9a19===':'){_0xd8c49=_0xd8c49[_0x67da('0x71')](0x0,_0xd8c49[_0x67da('0x72')](_0x4c9a19));}if(!_0x3c94d8['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x3c94d8);})[_0x67da('0x1a')](function(_0x434565){if(_0x434565){return rp({'method':_0x67da('0x73'),'uri':util[_0x67da('0x74')](_0x67da('0x75'),_0x20d037),'qs':{'module':_0x67da('0x76')},'headers':{'Authorization':_0x67da('0x77')+_0x434565},'json':!![]});}})['then'](function(_0xd1565e){if(_0xd1565e){if(_0xd1565e[_0x67da('0x78')]&&_0xd1565e[_0x67da('0x78')][_0x67da('0x20')]){throw new Error(_0xd1565e[_0x67da('0x78')][_0x67da('0x20')]['message']);}var _0x132915=[];var _0x490ba2=[];var _0x4f2233=[_0x67da('0x79'),_0x67da('0x7a'),_0x67da('0x7b'),_0x67da('0x7c'),_0x67da('0x7d'),'Call_Result',_0x67da('0x7e'),_0x67da('0x7f')];_0x490ba2=_[_0x67da('0x80')](_0xd1565e[_0x67da('0x41')],function(_0x5687b7){return _0x4f2233[_0x67da('0x81')](_0x5687b7['api_name']);});for(var _0x35c58c=0x0;_0x35c58c<_0x490ba2[_0x67da('0x42')];_0x35c58c++){if(_0x490ba2[_0x35c58c][_0x67da('0x82')]===![]){_0x132915[_0x67da('0x83')]({'id':_0x490ba2[_0x35c58c]['id'],'name':_0x490ba2[_0x35c58c][_0x67da('0x84')],'custom':_0x490ba2[_0x35c58c][_0x67da('0x85')],'options':_0x490ba2[_0x35c58c][_0x67da('0x86')]===_0x67da('0x87')&&_0x490ba2[_0x35c58c][_0x67da('0x88')][_0x67da('0x42')]>-0x1?_[_0x67da('0x35')](_0x490ba2[_0x35c58c][_0x67da('0x88')],function(_0x1d2aa5){return{'name':_0x1d2aa5,'value':_0x1d2aa5};}):[]});}}return{'count':_0x132915[_0x67da('0x42')],'rows':_0x132915};}else{return{'count':0x0,'rows':[]};}})[_0x67da('0x1a')](respondWithResult(_0x52c000,null))['catch'](function(_0x28b9ff){var _0x518888=_0x59ebe9['query']['test']?0x1f4:_0x28b9ff[_0x67da('0x89')]||0x1f4;logger[_0x67da('0x20')](_0x67da('0x8a'),_0x67da('0x6a'),_0x518888,JSON[_0x67da('0x8b')](_0x28b9ff));delete _0x28b9ff[_0x67da('0x32')];if(_0x518888===0x191){_0x518888=0x190;}_0x52c000[_0x67da('0x26')](_0x518888)[_0x67da('0x33')](_0x59ebe9['query'][_0x67da('0x8c')]?{'message':_0x67da('0x8d'),'statusCode':_0x28b9ff[_0x67da('0x89')]}:_0x28b9ff);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 85cdefa..d51cea2 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 _0x91e9=['then','parse','refresh_token','refreshToken','info','format','name','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','https://accounts.zoho.com','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','catch','lodash','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x91e9,0x176));var _0x991e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x91e9[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x991e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x991e('0x1'));var moment=require(_0x991e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x991e('0x3'));var rimraf=require(_0x991e('0x4'));var config=require(_0x991e('0x5'));var attributes=require(_0x991e('0x6'));var integrations=require(_0x991e('0x7'));module[_0x991e('0x8')]=function(_0x2f9c4d,_0x5598ce){return _0x2f9c4d['define']('ZohoAccount',attributes,{'tableName':_0x991e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x323bfc,_0xbbf70c,_0x1c44e2){if(_0x323bfc['changed'](_0x991e('0xa'))||_0x323bfc[_0x991e('0xb')](_0x991e('0xc'))||_0x323bfc[_0x991e('0xb')](_0x991e('0xd'))||_0x323bfc[_0x991e('0xb')](_0x991e('0xe'))||_0x323bfc[_0x991e('0xb')](_0x991e('0xf'))||_0x323bfc[_0x991e('0xb')](_0x991e('0x10'))){var _0x1246a4,_0x87e290;_0x1246a4=_0x323bfc[_0x991e('0xc')];var _0xb997d5=_0x1246a4['slice'](-0x1);if(_0xb997d5==='/'||_0xb997d5==='\x5c'||_0xb997d5===':'){_0x1246a4=_0x1246a4[_0x991e('0x11')](0x0,_0x1246a4[_0x991e('0x12')](_0xb997d5));}switch(_0x323bfc[_0x991e('0xa')]){case'US':_0x87e290='https://accounts.zoho.com';break;case'AU':_0x87e290=_0x991e('0x13');break;case'IN':_0x87e290=_0x991e('0x14');break;case'CN':_0x87e290=_0x991e('0x15');break;default:_0x87e290='https://accounts.zoho.eu';break;}var _0x2c38ae={'method':_0x991e('0x16'),'uri':_0x87e290+_0x991e('0x17'),'form':{'grant_type':_0x991e('0x18'),'client_id':_0x323bfc[_0x991e('0xd')],'client_secret':_0x323bfc['clientSecret'],'redirect_uri':_0x323bfc['serverUrl'],'code':_0x323bfc[_0x991e('0xf')]},'headers':{'Content-Type':_0x991e('0x19')}};return rp(_0x2c38ae)[_0x991e('0x1a')](function(_0x58ddac){var _0x711e27=JSON[_0x991e('0x1b')](_0x58ddac);if(_0x711e27[_0x991e('0x1c')]){_0x323bfc[_0x991e('0x1d')]=_0x711e27[_0x991e('0x1c')];logger[_0x991e('0x1e')](util[_0x991e('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x323bfc[_0x991e('0x20')],_0x323bfc['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x323bfc[_0x991e('0x20')],_0x323bfc['id']),util[_0x991e('0x21')](_0x711e27,{'showHidden':![],'depth':null}));}return _0x1c44e2(null,_0xbbf70c);})['catch'](function(_0x4d9899){logger['error'](util[_0x991e('0x1f')](_0x991e('0x22'),_0x323bfc[_0x991e('0x20')],_0x323bfc['id']),util[_0x991e('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c44e2(_0x4d9899);});}else{return _0x1c44e2(null,_0xbbf70c);}},'beforeUpdate':function(_0x11119a,_0x213896,_0x5b6aa6){if(_0x11119a['changed']('zone')||_0x11119a[_0x991e('0xb')](_0x991e('0xc'))||_0x11119a['changed'](_0x991e('0xd'))||_0x11119a[_0x991e('0xb')](_0x991e('0xe'))||_0x11119a[_0x991e('0xb')](_0x991e('0xf'))||_0x11119a[_0x991e('0xb')](_0x991e('0x10'))){var _0x34db77,_0x58a704;_0x34db77=_0x11119a[_0x991e('0xc')];var _0x4daec7=_0x34db77[_0x991e('0x23')](-0x1);if(_0x4daec7==='/'||_0x4daec7==='\x5c'||_0x4daec7===':'){_0x34db77=_0x34db77[_0x991e('0x11')](0x0,_0x34db77[_0x991e('0x12')](_0x4daec7));}switch(_0x11119a[_0x991e('0xa')]){case'US':_0x58a704=_0x991e('0x24');break;case'AU':_0x58a704=_0x991e('0x13');break;case'IN':_0x58a704=_0x991e('0x14');break;case'CN':_0x58a704=_0x991e('0x15');break;default:_0x58a704='https://accounts.zoho.eu';break;}var _0x5b46c3={'method':_0x991e('0x16'),'uri':_0x58a704+_0x991e('0x17'),'form':{'grant_type':_0x991e('0x18'),'client_id':_0x11119a['clientId'],'client_secret':_0x11119a[_0x991e('0xe')],'redirect_uri':_0x11119a[_0x991e('0xc')],'code':_0x11119a[_0x991e('0xf')]},'headers':{'Content-Type':_0x991e('0x19')}};return rp(_0x5b46c3)[_0x991e('0x1a')](function(_0x23fc02){var _0x10ac3e=JSON[_0x991e('0x1b')](_0x23fc02);if(_0x10ac3e[_0x991e('0x1c')]){_0x11119a['refreshToken']=_0x10ac3e[_0x991e('0x1c')];logger['info'](util[_0x991e('0x1f')](_0x991e('0x25'),_0x11119a[_0x991e('0x20')],_0x11119a['id']));}else{logger[_0x991e('0x26')](util[_0x991e('0x1f')](_0x991e('0x22'),_0x11119a[_0x991e('0x20')],_0x11119a['id']),util['inspect'](_0x10ac3e,{'showHidden':![],'depth':null}));}return _0x5b6aa6(null,_0x213896);})[_0x991e('0x27')](function(_0x5da3a3){logger[_0x991e('0x26')](util[_0x991e('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x11119a[_0x991e('0x20')],_0x11119a['id']),util[_0x991e('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b6aa6(_0x5da3a3);});}else{return _0x5b6aa6(null,_0x213896);}}}});}; \ No newline at end of file +var _0xabcf=['host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','https://accounts.zoho.com.au','POST','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','moment','path','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code'];(function(_0x321e0d,_0x2c4375){var _0x157be5=function(_0x51d449){while(--_0x51d449){_0x321e0d['push'](_0x321e0d['shift']());}};_0x157be5(++_0x2c4375);}(_0xabcf,0x115));var _0xfabc=function(_0x5ba939,_0xb20c7a){_0x5ba939=_0x5ba939-0x0;var _0x7e1b2c=_0xabcf[_0x5ba939];return _0x7e1b2c;};'use strict';var _=require(_0xfabc('0x0'));var util=require(_0xfabc('0x1'));var logger=require(_0xfabc('0x2'))('api');var moment=require(_0xfabc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfabc('0x4'));var rimraf=require('rimraf');var config=require(_0xfabc('0x5'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xfabc('0x6'));module[_0xfabc('0x7')]=function(_0x302362,_0xf17b9a){return _0x302362[_0xfabc('0x8')](_0xfabc('0x9'),attributes,{'tableName':_0xfabc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x156750,_0x4d319f,_0x1e8f45){if(_0x156750[_0xfabc('0xb')](_0xfabc('0xc'))||_0x156750['changed'](_0xfabc('0xd'))||_0x156750[_0xfabc('0xb')](_0xfabc('0xe'))||_0x156750[_0xfabc('0xb')](_0xfabc('0xf'))||_0x156750[_0xfabc('0xb')](_0xfabc('0x10'))||_0x156750['changed'](_0xfabc('0x11'))){var _0x2d89fb,_0x2aded7;_0x2d89fb=_0x156750['serverUrl'];var _0xb6a707=_0x2d89fb[_0xfabc('0x12')](-0x1);if(_0xb6a707==='/'||_0xb6a707==='\x5c'||_0xb6a707===':'){_0x2d89fb=_0x2d89fb[_0xfabc('0x13')](0x0,_0x2d89fb[_0xfabc('0x14')](_0xb6a707));}switch(_0x156750[_0xfabc('0xc')]){case'US':_0x2aded7=_0xfabc('0x15');break;case'AU':_0x2aded7='https://accounts.zoho.com.au';break;case'IN':_0x2aded7=_0xfabc('0x16');break;case'CN':_0x2aded7=_0xfabc('0x17');break;default:_0x2aded7=_0xfabc('0x18');break;}var _0xa72c63={'method':'POST','uri':_0x2aded7+_0xfabc('0x19'),'form':{'grant_type':_0xfabc('0x1a'),'client_id':_0x156750[_0xfabc('0xe')],'client_secret':_0x156750['clientSecret'],'redirect_uri':_0x156750[_0xfabc('0xd')],'code':_0x156750[_0xfabc('0x10')]},'headers':{'Content-Type':_0xfabc('0x1b')}};return rp(_0xa72c63)[_0xfabc('0x1c')](function(_0xbe2dff){var _0x25911c=JSON[_0xfabc('0x1d')](_0xbe2dff);if(_0x25911c[_0xfabc('0x1e')]){_0x156750[_0xfabc('0x1f')]=_0x25911c[_0xfabc('0x1e')];logger[_0xfabc('0x20')](util[_0xfabc('0x21')](_0xfabc('0x22'),_0x156750[_0xfabc('0x23')],_0x156750['id']));}else{logger[_0xfabc('0x24')](util[_0xfabc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x156750[_0xfabc('0x23')],_0x156750['id']),util[_0xfabc('0x25')](_0x25911c,{'showHidden':![],'depth':null}));}return _0x1e8f45(null,_0x4d319f);})['catch'](function(_0x25009d){logger[_0xfabc('0x24')](util[_0xfabc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x156750[_0xfabc('0x23')],_0x156750['id']),util[_0xfabc('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1e8f45(_0x25009d);});}else{return _0x1e8f45(null,_0x4d319f);}},'beforeUpdate':function(_0x3e24a3,_0x2e67e8,_0x3b6ce5){if(_0x3e24a3[_0xfabc('0xb')](_0xfabc('0xc'))||_0x3e24a3[_0xfabc('0xb')](_0xfabc('0xd'))||_0x3e24a3[_0xfabc('0xb')]('clientId')||_0x3e24a3['changed'](_0xfabc('0xf'))||_0x3e24a3[_0xfabc('0xb')](_0xfabc('0x10'))||_0x3e24a3[_0xfabc('0xb')](_0xfabc('0x11'))){var _0xdb2deb,_0x3580f4;_0xdb2deb=_0x3e24a3[_0xfabc('0xd')];var _0x124ba2=_0xdb2deb[_0xfabc('0x12')](-0x1);if(_0x124ba2==='/'||_0x124ba2==='\x5c'||_0x124ba2===':'){_0xdb2deb=_0xdb2deb['substring'](0x0,_0xdb2deb['lastIndexOf'](_0x124ba2));}switch(_0x3e24a3[_0xfabc('0xc')]){case'US':_0x3580f4=_0xfabc('0x15');break;case'AU':_0x3580f4=_0xfabc('0x26');break;case'IN':_0x3580f4=_0xfabc('0x16');break;case'CN':_0x3580f4=_0xfabc('0x17');break;default:_0x3580f4=_0xfabc('0x18');break;}var _0x281a0d={'method':_0xfabc('0x27'),'uri':_0x3580f4+_0xfabc('0x19'),'form':{'grant_type':_0xfabc('0x1a'),'client_id':_0x3e24a3[_0xfabc('0xe')],'client_secret':_0x3e24a3[_0xfabc('0xf')],'redirect_uri':_0x3e24a3[_0xfabc('0xd')],'code':_0x3e24a3[_0xfabc('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x281a0d)[_0xfabc('0x1c')](function(_0x3d544c){var _0x4b4b75=JSON[_0xfabc('0x1d')](_0x3d544c);if(_0x4b4b75[_0xfabc('0x1e')]){_0x3e24a3['refreshToken']=_0x4b4b75['refresh_token'];logger['info'](util[_0xfabc('0x21')](_0xfabc('0x22'),_0x3e24a3['name'],_0x3e24a3['id']));}else{logger[_0xfabc('0x24')](util[_0xfabc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e24a3[_0xfabc('0x23')],_0x3e24a3['id']),util['inspect'](_0x4b4b75,{'showHidden':![],'depth':null}));}return _0x3b6ce5(null,_0x2e67e8);})[_0xfabc('0x28')](function(_0x1f7989){logger['error'](util[_0xfabc('0x21')](_0xfabc('0x29'),_0x3e24a3['name'],_0x3e24a3['id']),util[_0xfabc('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3b6ce5(_0x1f7989);});}else{return _0x3b6ce5(null,_0x2e67e8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4a73b60..4aac6b0 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 _0x0149=['options','raw','where','attributes','include','map','model','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0149,0x92));var _0x9014=function(_0x2bf574,_0x22c7a2){_0x2bf574=_0x2bf574-0x0;var _0xc59df8=_0x0149[_0x2bf574];return _0xc59df8;};'use strict';var _=require(_0x9014('0x0'));var util=require(_0x9014('0x1'));var moment=require(_0x9014('0x2'));var BPromise=require(_0x9014('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9014('0x4'));var db=require(_0x9014('0x5'))['db'];var utils=require(_0x9014('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9014('0x7'));var client=jayson[_0x9014('0x8')][_0x9014('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cf20c,_0x298a8a,_0x11c7ef){return new BPromise(function(_0x2da2f9,_0x2ff4c4){return client[_0x9014('0xa')](_0x3cf20c,_0x11c7ef)[_0x9014('0xb')](function(_0x21ee79){logger[_0x9014('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x298a8a,_0x9014('0xd'));logger[_0x9014('0xe')](_0x9014('0xf'),_0x298a8a,'request\x20sent',JSON[_0x9014('0x10')](_0x21ee79));if(_0x21ee79[_0x9014('0x11')]){if(_0x21ee79[_0x9014('0x11')][_0x9014('0x12')]===0x1f4){logger[_0x9014('0x11')](_0x9014('0x13'),_0x298a8a,_0x21ee79[_0x9014('0x11')][_0x9014('0x14')]);return _0x2ff4c4(_0x21ee79[_0x9014('0x11')][_0x9014('0x14')]);}logger['error'](_0x9014('0x13'),_0x298a8a,_0x21ee79[_0x9014('0x11')][_0x9014('0x14')]);return _0x2da2f9(_0x21ee79[_0x9014('0x11')][_0x9014('0x14')]);}else{logger[_0x9014('0xc')](_0x9014('0x13'),_0x298a8a,_0x9014('0xd'));_0x2da2f9(_0x21ee79[_0x9014('0x15')][_0x9014('0x14')]);}})['catch'](function(_0x1bdc70){logger[_0x9014('0x11')](_0x9014('0x13'),_0x298a8a,_0x1bdc70);_0x2ff4c4(_0x1bdc70);});});}exports[_0x9014('0x16')]=function(_0x2bfb3e){var _0x4e6228=this;return new Promise(function(_0x39163f,_0x31275d){return db[_0x9014('0x17')]['findAll']({'raw':_0x2bfb3e[_0x9014('0x18')]?_0x2bfb3e[_0x9014('0x18')][_0x9014('0x19')]===undefined?!![]:![]:!![],'where':_0x2bfb3e[_0x9014('0x18')]?_0x2bfb3e['options'][_0x9014('0x1a')]||null:null,'attributes':_0x2bfb3e['options']?_0x2bfb3e[_0x9014('0x18')][_0x9014('0x1b')]||null:null,'limit':_0x2bfb3e[_0x9014('0x18')]?_0x2bfb3e['options']['limit']||null:null,'include':_0x2bfb3e[_0x9014('0x18')]?_0x2bfb3e['options'][_0x9014('0x1c')]?_[_0x9014('0x1d')](_0x2bfb3e[_0x9014('0x18')][_0x9014('0x1c')],function(_0xf4dc4f){return{'model':db[_0xf4dc4f[_0x9014('0x1e')]],'as':_0xf4dc4f['as'],'attributes':_0xf4dc4f['attributes'],'include':_0xf4dc4f[_0x9014('0x1c')]?_[_0x9014('0x1d')](_0xf4dc4f[_0x9014('0x1c')],function(_0x180c38){return{'model':db[_0x180c38[_0x9014('0x1e')]],'as':_0x180c38['as'],'attributes':_0x180c38[_0x9014('0x1b')],'include':_0x180c38['include']?_[_0x9014('0x1d')](_0x180c38[_0x9014('0x1c')],function(_0x30a79b){return{'model':db[_0x30a79b[_0x9014('0x1e')]],'as':_0x30a79b['as'],'attributes':_0x30a79b[_0x9014('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9014('0xb')](function(_0x22beee){logger[_0x9014('0xc')](_0x9014('0x16'),_0x2bfb3e);logger['debug'](_0x9014('0x16'),_0x2bfb3e,JSON[_0x9014('0x10')](_0x22beee));_0x39163f(_0x22beee);})[_0x9014('0x1f')](function(_0x497c0c){logger[_0x9014('0x11')](_0x9014('0x16'),_0x497c0c[_0x9014('0x14')],_0x2bfb3e);_0x31275d(_0x4e6228[_0x9014('0x11')](0x1f4,_0x497c0c[_0x9014('0x14')]));});});};exports[_0x9014('0x20')]=function(_0x2ac534){var _0x1ef9e0=this;return new Promise(function(_0x2d46e4,_0x4a6bc4){return db[_0x9014('0x17')][_0x9014('0x21')]({'raw':_0x2ac534['options']?_0x2ac534[_0x9014('0x18')][_0x9014('0x19')]===undefined?!![]:![]:!![],'where':_0x2ac534[_0x9014('0x18')]?_0x2ac534[_0x9014('0x18')]['where']||null:null,'attributes':_0x2ac534[_0x9014('0x18')]?_0x2ac534[_0x9014('0x18')][_0x9014('0x1b')]||null:null,'include':_0x2ac534['options']?_0x2ac534['options'][_0x9014('0x1c')]?_[_0x9014('0x1d')](_0x2ac534[_0x9014('0x18')][_0x9014('0x1c')],function(_0x5d117a){return{'model':db[_0x5d117a[_0x9014('0x1e')]],'as':_0x5d117a['as'],'attributes':_0x5d117a[_0x9014('0x1b')],'include':_0x5d117a[_0x9014('0x1c')]?_[_0x9014('0x1d')](_0x5d117a[_0x9014('0x1c')],function(_0x2796db){return{'model':db[_0x2796db['model']],'as':_0x2796db['as'],'attributes':_0x2796db['attributes'],'include':_0x2796db[_0x9014('0x1c')]?_[_0x9014('0x1d')](_0x2796db[_0x9014('0x1c')],function(_0x32785a){return{'model':db[_0x32785a[_0x9014('0x1e')]],'as':_0x32785a['as'],'attributes':_0x32785a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f6e78){logger[_0x9014('0xc')](_0x9014('0x20'),_0x2ac534);logger[_0x9014('0xe')](_0x9014('0x20'),_0x2ac534,JSON[_0x9014('0x10')](_0x4f6e78));_0x2d46e4(_0x4f6e78);})['catch'](function(_0x14eeb8){logger[_0x9014('0x11')](_0x9014('0x20'),_0x14eeb8[_0x9014('0x14')],_0x2ac534);_0x4a6bc4(_0x1ef9e0[_0x9014('0x11')](0x1f4,_0x14eeb8['message']));});});}; \ No newline at end of file +var _0xed53=['GetZohoAccount','ZohoAccount','options','where','limit','map','include','model','ShowZohoAccount','raw','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xed53,0xf9));var _0x3ed5=function(_0xf1b3a3,_0x5634dd){_0xf1b3a3=_0xf1b3a3-0x0;var _0x28bf98=_0xed53[_0xf1b3a3];return _0x28bf98;};'use strict';var _=require(_0x3ed5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3ed5('0x1'));var rs=require(_0x3ed5('0x2'));var fs=require('fs');var Redis=require(_0x3ed5('0x3'));var db=require(_0x3ed5('0x4'))['db'];var utils=require(_0x3ed5('0x5'));var logger=require(_0x3ed5('0x6'))(_0x3ed5('0x7'));var config=require(_0x3ed5('0x8'));var jayson=require(_0x3ed5('0x9'));var client=jayson[_0x3ed5('0xa')][_0x3ed5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36edcb,_0x5088f1,_0x2f119d){return new BPromise(function(_0x54dcd4,_0x272930){return client['request'](_0x36edcb,_0x2f119d)[_0x3ed5('0xc')](function(_0x471f85){logger[_0x3ed5('0xd')](_0x3ed5('0xe'),_0x5088f1,'request\x20sent');logger[_0x3ed5('0xf')](_0x3ed5('0x10'),_0x5088f1,_0x3ed5('0x11'),JSON['stringify'](_0x471f85));if(_0x471f85[_0x3ed5('0x12')]){if(_0x471f85[_0x3ed5('0x12')][_0x3ed5('0x13')]===0x1f4){logger[_0x3ed5('0x12')](_0x3ed5('0xe'),_0x5088f1,_0x471f85[_0x3ed5('0x12')]['message']);return _0x272930(_0x471f85[_0x3ed5('0x12')][_0x3ed5('0x14')]);}logger[_0x3ed5('0x12')](_0x3ed5('0xe'),_0x5088f1,_0x471f85[_0x3ed5('0x12')][_0x3ed5('0x14')]);return _0x54dcd4(_0x471f85[_0x3ed5('0x12')][_0x3ed5('0x14')]);}else{logger[_0x3ed5('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x5088f1,'request\x20sent');_0x54dcd4(_0x471f85[_0x3ed5('0x15')][_0x3ed5('0x14')]);}})[_0x3ed5('0x16')](function(_0x182073){logger[_0x3ed5('0x12')](_0x3ed5('0xe'),_0x5088f1,_0x182073);_0x272930(_0x182073);});});}exports[_0x3ed5('0x17')]=function(_0x437098){var _0x5ad932=this;return new Promise(function(_0x27787e,_0x56fa4d){return db[_0x3ed5('0x18')]['findAll']({'raw':_0x437098[_0x3ed5('0x19')]?_0x437098[_0x3ed5('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x437098[_0x3ed5('0x19')]?_0x437098['options'][_0x3ed5('0x1a')]||null:null,'attributes':_0x437098[_0x3ed5('0x19')]?_0x437098[_0x3ed5('0x19')]['attributes']||null:null,'limit':_0x437098[_0x3ed5('0x19')]?_0x437098[_0x3ed5('0x19')][_0x3ed5('0x1b')]||null:null,'include':_0x437098[_0x3ed5('0x19')]?_0x437098['options']['include']?_[_0x3ed5('0x1c')](_0x437098[_0x3ed5('0x19')][_0x3ed5('0x1d')],function(_0x45e58f){return{'model':db[_0x45e58f[_0x3ed5('0x1e')]],'as':_0x45e58f['as'],'attributes':_0x45e58f['attributes'],'include':_0x45e58f[_0x3ed5('0x1d')]?_[_0x3ed5('0x1c')](_0x45e58f['include'],function(_0x123689){return{'model':db[_0x123689['model']],'as':_0x123689['as'],'attributes':_0x123689['attributes'],'include':_0x123689[_0x3ed5('0x1d')]?_[_0x3ed5('0x1c')](_0x123689['include'],function(_0x44a723){return{'model':db[_0x44a723['model']],'as':_0x44a723['as'],'attributes':_0x44a723['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d6fac){logger[_0x3ed5('0xd')](_0x3ed5('0x17'),_0x437098);logger[_0x3ed5('0xf')](_0x3ed5('0x17'),_0x437098,JSON['stringify'](_0x3d6fac));_0x27787e(_0x3d6fac);})[_0x3ed5('0x16')](function(_0x2993f7){logger[_0x3ed5('0x12')]('GetZohoAccount',_0x2993f7[_0x3ed5('0x14')],_0x437098);_0x56fa4d(_0x5ad932[_0x3ed5('0x12')](0x1f4,_0x2993f7['message']));});});};exports[_0x3ed5('0x1f')]=function(_0x3abce2){var _0x1d9ba1=this;return new Promise(function(_0x291321,_0x521fba){return db['ZohoAccount']['find']({'raw':_0x3abce2[_0x3ed5('0x19')]?_0x3abce2[_0x3ed5('0x19')][_0x3ed5('0x20')]===undefined?!![]:![]:!![],'where':_0x3abce2[_0x3ed5('0x19')]?_0x3abce2[_0x3ed5('0x19')][_0x3ed5('0x1a')]||null:null,'attributes':_0x3abce2[_0x3ed5('0x19')]?_0x3abce2[_0x3ed5('0x19')][_0x3ed5('0x21')]||null:null,'include':_0x3abce2[_0x3ed5('0x19')]?_0x3abce2['options']['include']?_['map'](_0x3abce2[_0x3ed5('0x19')][_0x3ed5('0x1d')],function(_0x49e080){return{'model':db[_0x49e080['model']],'as':_0x49e080['as'],'attributes':_0x49e080[_0x3ed5('0x21')],'include':_0x49e080['include']?_['map'](_0x49e080['include'],function(_0xb94b7){return{'model':db[_0xb94b7[_0x3ed5('0x1e')]],'as':_0xb94b7['as'],'attributes':_0xb94b7[_0x3ed5('0x21')],'include':_0xb94b7[_0x3ed5('0x1d')]?_[_0x3ed5('0x1c')](_0xb94b7['include'],function(_0x2a2779){return{'model':db[_0x2a2779['model']],'as':_0x2a2779['as'],'attributes':_0x2a2779[_0x3ed5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ed5('0xc')](function(_0x16d9d1){logger['info'](_0x3ed5('0x1f'),_0x3abce2);logger[_0x3ed5('0xf')](_0x3ed5('0x1f'),_0x3abce2,JSON['stringify'](_0x16d9d1));_0x291321(_0x16d9d1);})[_0x3ed5('0x16')](function(_0x498d7d){logger[_0x3ed5('0x12')](_0x3ed5('0x1f'),_0x498d7d[_0x3ed5('0x14')],_0x3abce2);_0x521fba(_0x1d9ba1[_0x3ed5('0x12')](0x1f4,_0x498d7d[_0x3ed5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 78e1ab6..a146e83 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 _0x2f68=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','get','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports'];(function(_0x3dc321,_0x2f3748){var _0x264ab3=function(_0x22f1c6){while(--_0x22f1c6){_0x3dc321['push'](_0x3dc321['shift']());}};_0x264ab3(++_0x2f3748);}(_0x2f68,0x9a));var _0x82f6=function(_0x30c07f,_0x30745f){_0x30c07f=_0x30c07f-0x0;var _0x2a90d2=_0x2f68[_0x30c07f];return _0x2a90d2;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var auth=require(_0x82f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82f6('0x5'));var controller=require(_0x82f6('0x6'));router['get']('/',auth[_0x82f6('0x7')](),controller[_0x82f6('0x8')]);router['get']('/:id',auth[_0x82f6('0x7')](),controller['show']);router['get'](_0x82f6('0x9'),auth[_0x82f6('0x7')](),controller[_0x82f6('0xa')]);router['get'](_0x82f6('0xb'),auth[_0x82f6('0x7')](),controller['getSubjects']);router[_0x82f6('0xc')](_0x82f6('0xd'),auth[_0x82f6('0x7')](),controller[_0x82f6('0xe')]);router[_0x82f6('0xf')]('/',auth[_0x82f6('0x7')](),controller['create']);router[_0x82f6('0x10')](_0x82f6('0x11'),auth['isAuthenticated'](),controller[_0x82f6('0x12')]);router[_0x82f6('0x13')](_0x82f6('0x11'),auth[_0x82f6('0x7')](),controller[_0x82f6('0x14')]);module[_0x82f6('0x15')]=router; \ No newline at end of file +var _0x2e21=['getDescriptions','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects'];(function(_0x3fb560,_0x4b212c){var _0x7e0bce=function(_0x4e1bd0){while(--_0x4e1bd0){_0x3fb560['push'](_0x3fb560['shift']());}};_0x7e0bce(++_0x4b212c);}(_0x2e21,0xba));var _0x12e2=function(_0x32c9cc,_0x4c81c9){_0x32c9cc=_0x32c9cc-0x0;var _0x324e77=_0x2e21[_0x32c9cc];return _0x324e77;};'use strict';var multer=require(_0x12e2('0x0'));var util=require(_0x12e2('0x1'));var path=require(_0x12e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x12e2('0x3'));var router=express['Router']();var auth=require(_0x12e2('0x4'));var interaction=require(_0x12e2('0x5'));var config=require(_0x12e2('0x6'));var controller=require(_0x12e2('0x7'));router[_0x12e2('0x8')]('/',auth[_0x12e2('0x9')](),controller[_0x12e2('0xa')]);router[_0x12e2('0x8')](_0x12e2('0xb'),auth[_0x12e2('0x9')](),controller[_0x12e2('0xc')]);router[_0x12e2('0x8')]('/:id/fields',auth[_0x12e2('0x9')](),controller['getFields']);router[_0x12e2('0x8')]('/:id/subjects',auth[_0x12e2('0x9')](),controller[_0x12e2('0xd')]);router[_0x12e2('0x8')]('/:id/descriptions',auth[_0x12e2('0x9')](),controller[_0x12e2('0xe')]);router['post']('/',auth[_0x12e2('0x9')](),controller['create']);router[_0x12e2('0xf')]('/:id',auth[_0x12e2('0x9')](),controller[_0x12e2('0x10')]);router[_0x12e2('0x11')](_0x12e2('0xb'),auth[_0x12e2('0x9')](),controller[_0x12e2('0x12')]);module[_0x12e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index c10c551..c9f6c2d 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 _0x8241=['STRING','sequelize','exports','ENUM','lead','contact','nothing','contact_lead'];(function(_0x305517,_0x9ef104){var _0x58641b=function(_0x262e6e){while(--_0x262e6e){_0x305517['push'](_0x305517['shift']());}};_0x58641b(++_0x9ef104);}(_0x8241,0x89));var _0x1824=function(_0x156774,_0x1a22bc){_0x156774=_0x156774-0x0;var _0x458b9c=_0x8241[_0x156774];return _0x458b9c;};'use strict';var Sequelize=require(_0x1824('0x0'));module[_0x1824('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x1824('0x2')](_0x1824('0x3'),_0x1824('0x4'),_0x1824('0x5')),'defaultValue':_0x1824('0x3')},'moduleSearch':{'type':Sequelize[_0x1824('0x2')](_0x1824('0x6'),_0x1824('0x4'),_0x1824('0x3')),'defaultValue':_0x1824('0x6')},'description':{'type':Sequelize[_0x1824('0x7')]}}; \ No newline at end of file +var _0xbc16=['exports','ENUM','lead','contact','contact_lead','sequelize'];(function(_0x4e7bca,_0x2f4529){var _0x3ff4c7=function(_0x1e5531){while(--_0x1e5531){_0x4e7bca['push'](_0x4e7bca['shift']());}};_0x3ff4c7(++_0x2f4529);}(_0xbc16,0x11f));var _0x6bc1=function(_0x32f2fa,_0xb1b4d){_0x32f2fa=_0x32f2fa-0x0;var _0x12a2bb=_0xbc16[_0x32f2fa];return _0x12a2bb;};'use strict';var Sequelize=require(_0x6bc1('0x0'));module[_0x6bc1('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x6bc1('0x2')](_0x6bc1('0x3'),_0x6bc1('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x6bc1('0x5'),_0x6bc1('0x4'),'lead'),'defaultValue':_0x6bc1('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 0758225..09f6fdc 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e3dc1d9..de4e382 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 _0xa75d=['path','rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2059df,_0x367401){var _0xdd848b=function(_0x13055b){while(--_0x13055b){_0x2059df['push'](_0x2059df['shift']());}};_0xdd848b(++_0x367401);}(_0xa75d,0x7d));var _0xda75=function(_0x2796d9,_0x5b6f6f){_0x2796d9=_0x2796d9-0x0;var _0x570126=_0xa75d[_0x2796d9];return _0x570126;};'use strict';var _=require(_0xda75('0x0'));var util=require('util');var logger=require(_0xda75('0x1'))(_0xda75('0x2'));var moment=require(_0xda75('0x3'));var BPromise=require('bluebird');var rp=require(_0xda75('0x4'));var fs=require('fs');var path=require(_0xda75('0x5'));var rimraf=require(_0xda75('0x6'));var config=require('../../config/environment');var attributes=require(_0xda75('0x7'));module[_0xda75('0x8')]=function(_0x3b59b7,_0x1482f8){return _0x3b59b7['define'](_0xda75('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0050=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations','api','moment','bluebird','request-promise','path'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x0050,0x127));var _0x0005=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0050[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0005('0x0'));var moment=require(_0x0005('0x1'));var BPromise=require(_0x0005('0x2'));var rp=require(_0x0005('0x3'));var fs=require('fs');var path=require(_0x0005('0x4'));var rimraf=require(_0x0005('0x5'));var config=require(_0x0005('0x6'));var attributes=require(_0x0005('0x7'));module[_0x0005('0x8')]=function(_0x58f866,_0x30f85d){return _0x58f866['define']('ZohoConfiguration',attributes,{'tableName':_0x0005('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 39c78df..24e5553 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 _0x37b8=['request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x6cf3b6,_0x4b7560){var _0xdbe948=function(_0x1504d6){while(--_0x1504d6){_0x6cf3b6['push'](_0x6cf3b6['shift']());}};_0xdbe948(++_0x4b7560);}(_0x37b8,0x122));var _0x837b=function(_0x33de88,_0x581346){_0x33de88=_0x33de88-0x0;var _0x105957=_0x37b8[_0x33de88];return _0x105957;};'use strict';var _=require(_0x837b('0x0'));var util=require(_0x837b('0x1'));var moment=require(_0x837b('0x2'));var BPromise=require(_0x837b('0x3'));var rs=require(_0x837b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x837b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x837b('0x6'));var jayson=require(_0x837b('0x7'));var client=jayson[_0x837b('0x8')][_0x837b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cf852,_0x3ad850,_0x46089b){return new BPromise(function(_0x3c3d2a,_0x19d716){return client[_0x837b('0xa')](_0x4cf852,_0x46089b)[_0x837b('0xb')](function(_0x486aa8){logger[_0x837b('0xc')](_0x837b('0xd'),_0x3ad850,_0x837b('0xe'));logger[_0x837b('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3ad850,'request\x20sent',JSON['stringify'](_0x486aa8));if(_0x486aa8[_0x837b('0x10')]){if(_0x486aa8[_0x837b('0x10')][_0x837b('0x11')]===0x1f4){logger[_0x837b('0x10')](_0x837b('0xd'),_0x3ad850,_0x486aa8[_0x837b('0x10')][_0x837b('0x12')]);return _0x19d716(_0x486aa8[_0x837b('0x10')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3ad850,_0x486aa8[_0x837b('0x10')][_0x837b('0x12')]);return _0x3c3d2a(_0x486aa8[_0x837b('0x10')]['message']);}else{logger[_0x837b('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ad850,_0x837b('0xe'));_0x3c3d2a(_0x486aa8['result'][_0x837b('0x12')]);}})['catch'](function(_0x2c6383){logger[_0x837b('0x10')](_0x837b('0xd'),_0x3ad850,_0x2c6383);_0x19d716(_0x2c6383);});});} \ No newline at end of file +var _0x1ea1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ea1,0x124));var _0x11ea=function(_0x58391e,_0x22dcf8){_0x58391e=_0x58391e-0x0;var _0x5082ef=_0x1ea1[_0x58391e];return _0x5082ef;};'use strict';var _=require(_0x11ea('0x0'));var util=require(_0x11ea('0x1'));var moment=require(_0x11ea('0x2'));var BPromise=require(_0x11ea('0x3'));var rs=require(_0x11ea('0x4'));var fs=require('fs');var Redis=require(_0x11ea('0x5'));var db=require(_0x11ea('0x6'))['db'];var utils=require(_0x11ea('0x7'));var logger=require(_0x11ea('0x8'))(_0x11ea('0x9'));var config=require(_0x11ea('0xa'));var jayson=require(_0x11ea('0xb'));var client=jayson[_0x11ea('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x699f9,_0x225ee8,_0x37b376){return new BPromise(function(_0x5eab39,_0x3d47be){return client['request'](_0x699f9,_0x37b376)[_0x11ea('0xd')](function(_0x9804f6){logger[_0x11ea('0xe')](_0x11ea('0xf'),_0x225ee8,_0x11ea('0x10'));logger['debug'](_0x11ea('0x11'),_0x225ee8,_0x11ea('0x10'),JSON['stringify'](_0x9804f6));if(_0x9804f6[_0x11ea('0x12')]){if(_0x9804f6['error']['code']===0x1f4){logger[_0x11ea('0x12')](_0x11ea('0xf'),_0x225ee8,_0x9804f6[_0x11ea('0x12')][_0x11ea('0x13')]);return _0x3d47be(_0x9804f6[_0x11ea('0x12')][_0x11ea('0x13')]);}logger[_0x11ea('0x12')](_0x11ea('0xf'),_0x225ee8,_0x9804f6['error'][_0x11ea('0x13')]);return _0x5eab39(_0x9804f6[_0x11ea('0x12')][_0x11ea('0x13')]);}else{logger[_0x11ea('0xe')](_0x11ea('0xf'),_0x225ee8,_0x11ea('0x10'));_0x5eab39(_0x9804f6['result'][_0x11ea('0x13')]);}})[_0x11ea('0x14')](function(_0x3b833a){logger[_0x11ea('0x12')](_0x11ea('0xf'),_0x225ee8,_0x3b833a);_0x3d47be(_0x3b833a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 70b2e74..8ca3353 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 _0x77d4=['Router','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports','util','connect-timeout'];(function(_0x397f06,_0x1ca554){var _0x3a462a=function(_0xa49d7c){while(--_0xa49d7c){_0x397f06['push'](_0x397f06['shift']());}};_0x3a462a(++_0x1ca554);}(_0x77d4,0x108));var _0x477d=function(_0x3ebb11,_0x35cc63){_0x3ebb11=_0x3ebb11-0x0;var _0x269b88=_0x77d4[_0x3ebb11];return _0x269b88;};'use strict';var multer=require('multer');var util=require(_0x477d('0x0'));var path=require('path');var timeout=require(_0x477d('0x1'));var express=require('express');var router=express[_0x477d('0x2')]();var auth=require(_0x477d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x477d('0x4'));router[_0x477d('0x5')]('/',auth[_0x477d('0x6')](),controller[_0x477d('0x7')]);router[_0x477d('0x5')](_0x477d('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x477d('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x477d('0xa')](_0x477d('0x8'),auth[_0x477d('0x6')](),controller[_0x477d('0xb')]);router[_0x477d('0xc')]('/:id',auth[_0x477d('0x6')](),controller['destroy']);module[_0x477d('0xd')]=router; \ No newline at end of file +var _0x896e=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x29c2f7,_0x1ffb8b){var _0x3582e6=function(_0x4e91dc){while(--_0x4e91dc){_0x29c2f7['push'](_0x29c2f7['shift']());}};_0x3582e6(++_0x1ffb8b);}(_0x896e,0x1e9));var _0xe896=function(_0x20ada4,_0x3e279a){_0x20ada4=_0x20ada4-0x0;var _0x498cf8=_0x896e[_0x20ada4];return _0x498cf8;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var auth=require(_0xe896('0x6'));var interaction=require(_0xe896('0x7'));var config=require(_0xe896('0x8'));var controller=require(_0xe896('0x9'));router[_0xe896('0xa')]('/',auth[_0xe896('0xb')](),controller['index']);router[_0xe896('0xa')](_0xe896('0xc'),auth[_0xe896('0xb')](),controller[_0xe896('0xd')]);router[_0xe896('0xe')]('/',auth['isAuthenticated'](),controller[_0xe896('0xf')]);router[_0xe896('0x10')](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x11')]);router['delete'](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x12')]);module[_0xe896('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b6a0c1b..6d0ddad 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 _0x38fb=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x47147a,_0x590819){var _0x434409=function(_0x5220ca){while(--_0x5220ca){_0x47147a['push'](_0x47147a['shift']());}};_0x434409(++_0x590819);}(_0x38fb,0x1b0));var _0xb38f=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0x38fb[_0x49c653];return _0x31e169;};'use strict';var Sequelize=require(_0xb38f('0x0'));module[_0xb38f('0x1')]={'type':{'type':Sequelize[_0xb38f('0x2')](_0xb38f('0x3'),_0xb38f('0x4'),_0xb38f('0x5'),_0xb38f('0x6')),'defaultValue':_0xb38f('0x3')},'content':{'type':Sequelize[_0xb38f('0x7')]},'key':{'type':Sequelize[_0xb38f('0x7')]},'keyType':{'type':Sequelize[_0xb38f('0x2')](_0xb38f('0x3'),_0xb38f('0x4'),_0xb38f('0x5'))},'keyContent':{'type':Sequelize[_0xb38f('0x7')]},'idField':{'type':Sequelize[_0xb38f('0x7')]},'nameField':{'type':Sequelize[_0xb38f('0x7')]},'customField':{'type':Sequelize[_0xb38f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2755=['variable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x1cd555,_0xa065c2){var _0xa7f8f5=function(_0x16ab1a){while(--_0x16ab1a){_0x1cd555['push'](_0x1cd555['shift']());}};_0xa7f8f5(++_0xa065c2);}(_0x2755,0x19a));var _0x5275=function(_0x5a0e32,_0x347ae2){_0x5a0e32=_0x5a0e32-0x0;var _0xea8f24=_0x2755[_0x5a0e32];return _0xea8f24;};'use strict';var Sequelize=require(_0x5275('0x0'));module['exports']={'type':{'type':Sequelize[_0x5275('0x1')](_0x5275('0x2'),_0x5275('0x3'),'customVariable',_0x5275('0x4')),'defaultValue':_0x5275('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5275('0x5')]},'keyType':{'type':Sequelize[_0x5275('0x1')](_0x5275('0x2'),_0x5275('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5275('0x5')]},'customField':{'type':Sequelize[_0x5275('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5275('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7ac7268..66fa9d1 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 _0xbbcf=['set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','ZohoField','include','rows','show','find','create','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status'];(function(_0x586af9,_0x5d61cd){var _0x4af104=function(_0x4c752a){while(--_0x4c752a){_0x586af9['push'](_0x586af9['shift']());}};_0x4af104(++_0x5d61cd);}(_0xbbcf,0x13f));var _0xfbbc=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xbbcf[_0x263a74];return _0x2aa86c;};'use strict';var pdf=require(_0xfbbc('0x0'));var emlformat=require(_0xfbbc('0x1'));var rimraf=require(_0xfbbc('0x2'));var zipdir=require(_0xfbbc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbbc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfbbc('0x5'));var util=require('util');var path=require(_0xfbbc('0x6'));var sox=require(_0xfbbc('0x7'));var csv=require(_0xfbbc('0x8'));var ejs=require(_0xfbbc('0x9'));var fs=require('fs');var _=require(_0xfbbc('0xa'));var squel=require('squel');var crypto=require(_0xfbbc('0xb'));var jsforce=require(_0xfbbc('0xc'));var deskjs=require(_0xfbbc('0xd'));var toCsv=require(_0xfbbc('0x8'));var querystring=require('querystring');var Papa=require(_0xfbbc('0xe'));var Redis=require(_0xfbbc('0xf'));var authService=require(_0xfbbc('0x10'));var qs=require(_0xfbbc('0x11'));var as=require(_0xfbbc('0x12'));var hardwareService=require(_0xfbbc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfbbc('0x14'));var config=require(_0xfbbc('0x15'));var licenseUtil=require(_0xfbbc('0x16'));var db=require(_0xfbbc('0x17'))['db'];function respondWithStatusCode(_0x28217c,_0x549918){_0x549918=_0x549918||0xcc;return function(_0x40367e){if(_0x40367e){return _0x28217c[_0xfbbc('0x18')](_0x549918);}return _0x28217c['status'](_0x549918)[_0xfbbc('0x19')]();};}function respondWithResult(_0x39a27c,_0x1b2552){_0x1b2552=_0x1b2552||0xc8;return function(_0xfd6ea6){if(_0xfd6ea6){return _0x39a27c['status'](_0x1b2552)[_0xfbbc('0x1a')](_0xfd6ea6);}};}function respondWithFilteredResult(_0x4b928a,_0x9477dc){return function(_0x5ed658){if(_0x5ed658){var _0x110fac=_0x5ed658[_0xfbbc('0x1b')],_0xd85258=_0x9477dc[_0xfbbc('0x1c')],_0x432375=_0x9477dc[_0xfbbc('0x1c')]+_0x9477dc[_0xfbbc('0x1d')],_0x3bd9bb;if(_0x432375>=_0x110fac){_0x432375=_0x110fac;_0x3bd9bb=0xc8;}else{_0x3bd9bb=0xce;}_0x4b928a[_0xfbbc('0x1e')](_0x3bd9bb);return _0x4b928a[_0xfbbc('0x1f')](_0xfbbc('0x20'),_0xd85258+'-'+_0x432375+'/'+_0x110fac)['json'](_0x5ed658);}return null;};}function patchUpdates(_0x41037d){return function(_0x2a748a){try{jsonpatch['apply'](_0x2a748a,_0x41037d,!![]);}catch(_0x3732cd){return BPromise['reject'](_0x3732cd);}return _0x2a748a[_0xfbbc('0x21')]();};}function saveUpdates(_0x98c436,_0x57be29){return function(_0x3a56b1){if(_0x3a56b1){return _0x3a56b1[_0xfbbc('0x22')](_0x98c436)[_0xfbbc('0x23')](function(_0x577b1b){return _0x577b1b;});}return null;};}function removeEntity(_0x3e3399,_0x5d18e6){return function(_0x413a36){if(_0x413a36){return _0x413a36[_0xfbbc('0x24')]()['then'](function(){_0x3e3399[_0xfbbc('0x1e')](0xcc)[_0xfbbc('0x19')]();});}};}function handleEntityNotFound(_0x45dd10,_0x1e2fbb){return function(_0x1510aa){if(!_0x1510aa){_0x45dd10['sendStatus'](0x194);}return _0x1510aa;};}function handleError(_0x24d3ab,_0x5f4c68){_0x5f4c68=_0x5f4c68||0x1f4;return function(_0x14f7c2){logger['error'](_0x14f7c2[_0xfbbc('0x25')]);if(_0x14f7c2[_0xfbbc('0x26')]){delete _0x14f7c2[_0xfbbc('0x26')];}_0x24d3ab[_0xfbbc('0x1e')](_0x5f4c68)[_0xfbbc('0x27')](_0x14f7c2);};}exports[_0xfbbc('0x28')]=function(_0x299b43,_0x466ff8){var _0x20faf3={},_0x65418b={},_0x25120d={'count':0x0,'rows':[]};var _0x214e66=_[_0xfbbc('0x29')](db['ZohoField'][_0xfbbc('0x2a')],function(_0x4dda70){return{'name':_0x4dda70['fieldName'],'type':_0x4dda70[_0xfbbc('0x2b')][_0xfbbc('0x2c')]};});_0x65418b[_0xfbbc('0x2d')]=_[_0xfbbc('0x29')](_0x214e66,_0xfbbc('0x26'));_0x65418b[_0xfbbc('0x2e')]=_[_0xfbbc('0x2f')](_0x299b43[_0xfbbc('0x2e')]);_0x65418b[_0xfbbc('0x30')]=_[_0xfbbc('0x31')](_0x65418b[_0xfbbc('0x2d')],_0x65418b[_0xfbbc('0x2e')]);_0x20faf3['attributes']=_[_0xfbbc('0x31')](_0x65418b[_0xfbbc('0x2d')],qs[_0xfbbc('0x32')](_0x299b43[_0xfbbc('0x2e')][_0xfbbc('0x32')]));_0x20faf3[_0xfbbc('0x33')]=_0x20faf3[_0xfbbc('0x33')][_0xfbbc('0x34')]?_0x20faf3[_0xfbbc('0x33')]:_0x65418b[_0xfbbc('0x2d')];if(!_0x299b43[_0xfbbc('0x2e')]['hasOwnProperty'](_0xfbbc('0x35'))){_0x20faf3['limit']=qs[_0xfbbc('0x1d')](_0x299b43[_0xfbbc('0x2e')][_0xfbbc('0x1d')]);_0x20faf3[_0xfbbc('0x1c')]=qs[_0xfbbc('0x1c')](_0x299b43['query']['offset']);}_0x20faf3[_0xfbbc('0x36')]=qs[_0xfbbc('0x37')](_0x299b43[_0xfbbc('0x2e')][_0xfbbc('0x37')]);_0x20faf3[_0xfbbc('0x38')]=qs[_0xfbbc('0x30')](_['pick'](_0x299b43[_0xfbbc('0x2e')],_0x65418b[_0xfbbc('0x30')]),_0x214e66);if(_0x299b43[_0xfbbc('0x2e')]['filter']){_0x20faf3['where']=_[_0xfbbc('0x39')](_0x20faf3[_0xfbbc('0x38')],{'$or':_[_0xfbbc('0x29')](_0x214e66,function(_0x4f7e43){if(_0x4f7e43['type']!==_0xfbbc('0x3a')){var _0x1d0597={};_0x1d0597[_0x4f7e43[_0xfbbc('0x26')]]={'$like':'%'+_0x299b43[_0xfbbc('0x2e')][_0xfbbc('0x3b')]+'%'};return _0x1d0597;}})});}_0x20faf3=_[_0xfbbc('0x39')]({},_0x20faf3,_0x299b43[_0xfbbc('0x3c')]);var _0x25cd04={'where':_0x20faf3[_0xfbbc('0x38')]};return db[_0xfbbc('0x3d')][_0xfbbc('0x1b')](_0x25cd04)['then'](function(_0xbc4be2){_0x25120d[_0xfbbc('0x1b')]=_0xbc4be2;if(_0x299b43['query']['includeAll']){_0x20faf3[_0xfbbc('0x3e')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x20faf3);})[_0xfbbc('0x23')](function(_0x34b833){_0x25120d[_0xfbbc('0x3f')]=_0x34b833;return _0x25120d;})[_0xfbbc('0x23')](respondWithFilteredResult(_0x466ff8,_0x20faf3))['catch'](handleError(_0x466ff8,null));};exports[_0xfbbc('0x40')]=function(_0x3cddd5,_0x1e2b6d){var _0x3c0dc8={'raw':!![],'where':{'id':_0x3cddd5['params']['id']}},_0x4d0027={};_0x4d0027[_0xfbbc('0x2d')]=_[_0xfbbc('0x2f')](db[_0xfbbc('0x3d')][_0xfbbc('0x2a')]);_0x4d0027[_0xfbbc('0x2e')]=_['keys'](_0x3cddd5['query']);_0x4d0027[_0xfbbc('0x30')]=_[_0xfbbc('0x31')](_0x4d0027[_0xfbbc('0x2d')],_0x4d0027[_0xfbbc('0x2e')]);_0x3c0dc8[_0xfbbc('0x33')]=_[_0xfbbc('0x31')](_0x4d0027['model'],qs[_0xfbbc('0x32')](_0x3cddd5[_0xfbbc('0x2e')][_0xfbbc('0x32')]));_0x3c0dc8[_0xfbbc('0x33')]=_0x3c0dc8[_0xfbbc('0x33')]['length']?_0x3c0dc8['attributes']:_0x4d0027[_0xfbbc('0x2d')];if(_0x3cddd5['query']['includeAll']){_0x3c0dc8[_0xfbbc('0x3e')]=[{'all':!![]}];}_0x3c0dc8=_[_0xfbbc('0x39')]({},_0x3c0dc8,_0x3cddd5[_0xfbbc('0x3c')]);return db['ZohoField'][_0xfbbc('0x41')](_0x3c0dc8)[_0xfbbc('0x23')](handleEntityNotFound(_0x1e2b6d,null))[_0xfbbc('0x23')](respondWithResult(_0x1e2b6d,null))['catch'](handleError(_0x1e2b6d,null));};exports[_0xfbbc('0x42')]=function(_0x51fc73,_0x31dc01){return db[_0xfbbc('0x3d')][_0xfbbc('0x42')](_0x51fc73['body'],{})['then'](respondWithResult(_0x31dc01,0xc9))[_0xfbbc('0x43')](handleError(_0x31dc01,null));};exports['update']=function(_0x5ed165,_0x4c1350){if(_0x5ed165[_0xfbbc('0x44')]['id']){delete _0x5ed165[_0xfbbc('0x44')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x5ed165[_0xfbbc('0x45')]['id']}})[_0xfbbc('0x23')](handleEntityNotFound(_0x4c1350,null))[_0xfbbc('0x23')](saveUpdates(_0x5ed165['body'],null))[_0xfbbc('0x23')](respondWithResult(_0x4c1350,null))['catch'](handleError(_0x4c1350,null));};exports[_0xfbbc('0x24')]=function(_0x1e1fe4,_0x2dcc77){return db['ZohoField']['find']({'where':{'id':_0x1e1fe4['params']['id']}})[_0xfbbc('0x23')](handleEntityNotFound(_0x2dcc77,null))['then'](removeEntity(_0x2dcc77,null))[_0xfbbc('0x43')](handleError(_0x2dcc77,null));}; \ No newline at end of file +var _0x4460=['update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','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','limit','set','Content-Range','reject','save','destroy','then','stack','name','send','index','map','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','ZohoField','includeAll','show','params','keys','rawAttributes','include','find','catch','create','body'];(function(_0x12ae9,_0x3d8aa6){var _0x4cebb2=function(_0x564132){while(--_0x564132){_0x12ae9['push'](_0x12ae9['shift']());}};_0x4cebb2(++_0x3d8aa6);}(_0x4460,0x97));var _0x0446=function(_0x217c86,_0x97c004){_0x217c86=_0x217c86-0x0;var _0x32284d=_0x4460[_0x217c86];return _0x32284d;};'use strict';var pdf=require(_0x0446('0x0'));var emlformat=require(_0x0446('0x1'));var rimraf=require(_0x0446('0x2'));var zipdir=require(_0x0446('0x3'));var jsonpatch=require(_0x0446('0x4'));var rp=require(_0x0446('0x5'));var moment=require(_0x0446('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0446('0x7'));var util=require(_0x0446('0x8'));var path=require(_0x0446('0x9'));var sox=require(_0x0446('0xa'));var csv=require(_0x0446('0xb'));var ejs=require(_0x0446('0xc'));var fs=require('fs');var _=require(_0x0446('0xd'));var squel=require('squel');var crypto=require(_0x0446('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0446('0xf'));var toCsv=require(_0x0446('0xb'));var querystring=require(_0x0446('0x10'));var Papa=require('papaparse');var Redis=require(_0x0446('0x11'));var authService=require(_0x0446('0x12'));var qs=require(_0x0446('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0446('0x14'));var logger=require(_0x0446('0x15'))(_0x0446('0x16'));var utils=require(_0x0446('0x17'));var config=require(_0x0446('0x18'));var licenseUtil=require(_0x0446('0x19'));var db=require(_0x0446('0x1a'))['db'];function respondWithStatusCode(_0x11411c,_0x54a5f2){_0x54a5f2=_0x54a5f2||0xcc;return function(_0xd22be3){if(_0xd22be3){return _0x11411c[_0x0446('0x1b')](_0x54a5f2);}return _0x11411c[_0x0446('0x1c')](_0x54a5f2)[_0x0446('0x1d')]();};}function respondWithResult(_0x5a9fa5,_0x41e35d){_0x41e35d=_0x41e35d||0xc8;return function(_0x58f453){if(_0x58f453){return _0x5a9fa5[_0x0446('0x1c')](_0x41e35d)[_0x0446('0x1e')](_0x58f453);}};}function respondWithFilteredResult(_0x2d0173,_0x331141){return function(_0x4976bc){if(_0x4976bc){var _0x38e268=_0x4976bc[_0x0446('0x1f')],_0x437377=_0x331141[_0x0446('0x20')],_0x55423d=_0x331141['offset']+_0x331141[_0x0446('0x21')],_0x27ab42;if(_0x55423d>=_0x38e268){_0x55423d=_0x38e268;_0x27ab42=0xc8;}else{_0x27ab42=0xce;}_0x2d0173[_0x0446('0x1c')](_0x27ab42);return _0x2d0173[_0x0446('0x22')](_0x0446('0x23'),_0x437377+'-'+_0x55423d+'/'+_0x38e268)[_0x0446('0x1e')](_0x4976bc);}return null;};}function patchUpdates(_0x608479){return function(_0x3f989c){try{jsonpatch['apply'](_0x3f989c,_0x608479,!![]);}catch(_0xd646c0){return BPromise[_0x0446('0x24')](_0xd646c0);}return _0x3f989c[_0x0446('0x25')]();};}function saveUpdates(_0x3656ae,_0x3a1161){return function(_0x148533){if(_0x148533){return _0x148533['update'](_0x3656ae)['then'](function(_0x5ddfab){return _0x5ddfab;});}return null;};}function removeEntity(_0x1d74ad,_0x533e3a){return function(_0x5535f9){if(_0x5535f9){return _0x5535f9[_0x0446('0x26')]()[_0x0446('0x27')](function(){_0x1d74ad[_0x0446('0x1c')](0xcc)[_0x0446('0x1d')]();});}};}function handleEntityNotFound(_0xefeae2,_0x5d9a6b){return function(_0x223acc){if(!_0x223acc){_0xefeae2[_0x0446('0x1b')](0x194);}return _0x223acc;};}function handleError(_0x243a8d,_0xe7251b){_0xe7251b=_0xe7251b||0x1f4;return function(_0x35cc40){logger['error'](_0x35cc40[_0x0446('0x28')]);if(_0x35cc40[_0x0446('0x29')]){delete _0x35cc40[_0x0446('0x29')];}_0x243a8d[_0x0446('0x1c')](_0xe7251b)[_0x0446('0x2a')](_0x35cc40);};}exports[_0x0446('0x2b')]=function(_0x1dc96d,_0x194c23){var _0x3c8f83={},_0x2d36fd={},_0xf9d619={'count':0x0,'rows':[]};var _0x2618c5=_[_0x0446('0x2c')](db['ZohoField']['rawAttributes'],function(_0x46027a){return{'name':_0x46027a[_0x0446('0x2d')],'type':_0x46027a[_0x0446('0x2e')][_0x0446('0x2f')]};});_0x2d36fd[_0x0446('0x30')]=_[_0x0446('0x2c')](_0x2618c5,_0x0446('0x29'));_0x2d36fd['query']=_['keys'](_0x1dc96d[_0x0446('0x31')]);_0x2d36fd['filters']=_['intersection'](_0x2d36fd[_0x0446('0x30')],_0x2d36fd[_0x0446('0x31')]);_0x3c8f83[_0x0446('0x32')]=_[_0x0446('0x33')](_0x2d36fd[_0x0446('0x30')],qs[_0x0446('0x34')](_0x1dc96d[_0x0446('0x31')]['fields']));_0x3c8f83['attributes']=_0x3c8f83['attributes'][_0x0446('0x35')]?_0x3c8f83[_0x0446('0x32')]:_0x2d36fd[_0x0446('0x30')];if(!_0x1dc96d['query'][_0x0446('0x36')]('nolimit')){_0x3c8f83[_0x0446('0x21')]=qs['limit'](_0x1dc96d[_0x0446('0x31')][_0x0446('0x21')]);_0x3c8f83[_0x0446('0x20')]=qs[_0x0446('0x20')](_0x1dc96d[_0x0446('0x31')][_0x0446('0x20')]);}_0x3c8f83[_0x0446('0x37')]=qs[_0x0446('0x38')](_0x1dc96d[_0x0446('0x31')][_0x0446('0x38')]);_0x3c8f83['where']=qs[_0x0446('0x39')](_['pick'](_0x1dc96d[_0x0446('0x31')],_0x2d36fd[_0x0446('0x39')]),_0x2618c5);if(_0x1dc96d[_0x0446('0x31')][_0x0446('0x3a')]){_0x3c8f83[_0x0446('0x3b')]=_[_0x0446('0x3c')](_0x3c8f83[_0x0446('0x3b')],{'$or':_[_0x0446('0x2c')](_0x2618c5,function(_0x5a717d){if(_0x5a717d['type']!==_0x0446('0x3d')){var _0x37211e={};_0x37211e[_0x5a717d[_0x0446('0x29')]]={'$like':'%'+_0x1dc96d['query']['filter']+'%'};return _0x37211e;}})});}_0x3c8f83=_[_0x0446('0x3c')]({},_0x3c8f83,_0x1dc96d[_0x0446('0x3e')]);var _0x14d438={'where':_0x3c8f83['where']};return db[_0x0446('0x3f')]['count'](_0x14d438)['then'](function(_0x524b16){_0xf9d619[_0x0446('0x1f')]=_0x524b16;if(_0x1dc96d[_0x0446('0x31')][_0x0446('0x40')]){_0x3c8f83['include']=[{'all':!![]}];}return db[_0x0446('0x3f')]['findAll'](_0x3c8f83);})[_0x0446('0x27')](function(_0xbae86d){_0xf9d619['rows']=_0xbae86d;return _0xf9d619;})[_0x0446('0x27')](respondWithFilteredResult(_0x194c23,_0x3c8f83))['catch'](handleError(_0x194c23,null));};exports[_0x0446('0x41')]=function(_0x2feab3,_0x30314e){var _0x2ec584={'raw':!![],'where':{'id':_0x2feab3[_0x0446('0x42')]['id']}},_0x21e440={};_0x21e440[_0x0446('0x30')]=_[_0x0446('0x43')](db[_0x0446('0x3f')][_0x0446('0x44')]);_0x21e440['query']=_[_0x0446('0x43')](_0x2feab3[_0x0446('0x31')]);_0x21e440[_0x0446('0x39')]=_['intersection'](_0x21e440[_0x0446('0x30')],_0x21e440[_0x0446('0x31')]);_0x2ec584[_0x0446('0x32')]=_['intersection'](_0x21e440[_0x0446('0x30')],qs[_0x0446('0x34')](_0x2feab3[_0x0446('0x31')]['fields']));_0x2ec584[_0x0446('0x32')]=_0x2ec584[_0x0446('0x32')][_0x0446('0x35')]?_0x2ec584[_0x0446('0x32')]:_0x21e440['model'];if(_0x2feab3[_0x0446('0x31')][_0x0446('0x40')]){_0x2ec584[_0x0446('0x45')]=[{'all':!![]}];}_0x2ec584=_[_0x0446('0x3c')]({},_0x2ec584,_0x2feab3[_0x0446('0x3e')]);return db['ZohoField'][_0x0446('0x46')](_0x2ec584)[_0x0446('0x27')](handleEntityNotFound(_0x30314e,null))[_0x0446('0x27')](respondWithResult(_0x30314e,null))[_0x0446('0x47')](handleError(_0x30314e,null));};exports[_0x0446('0x48')]=function(_0x2e51e7,_0x574625){return db[_0x0446('0x3f')]['create'](_0x2e51e7[_0x0446('0x49')],{})['then'](respondWithResult(_0x574625,0xc9))[_0x0446('0x47')](handleError(_0x574625,null));};exports[_0x0446('0x4a')]=function(_0x478757,_0x1c6184){if(_0x478757['body']['id']){delete _0x478757['body']['id'];}return db[_0x0446('0x3f')][_0x0446('0x46')]({'where':{'id':_0x478757[_0x0446('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c6184,null))[_0x0446('0x27')](saveUpdates(_0x478757[_0x0446('0x49')],null))[_0x0446('0x27')](respondWithResult(_0x1c6184,null))[_0x0446('0x47')](handleError(_0x1c6184,null));};exports['destroy']=function(_0x51c0a4,_0x413d14){return db[_0x0446('0x3f')][_0x0446('0x46')]({'where':{'id':_0x51c0a4[_0x0446('0x42')]['id']}})['then'](handleEntityNotFound(_0x413d14,null))['then'](removeEntity(_0x413d14,null))['catch'](handleError(_0x413d14,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index dcd0890..ea56a8f 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 _0x0931=['rimraf','../../config/environment','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3e3425,_0x44d3e){var _0x85e273=function(_0x3d606b){while(--_0x3d606b){_0x3e3425['push'](_0x3e3425['shift']());}};_0x85e273(++_0x44d3e);}(_0x0931,0xbd));var _0x1093=function(_0x3c9845,_0x5de9c8){_0x3c9845=_0x3c9845-0x0;var _0x23eb05=_0x0931[_0x3c9845];return _0x23eb05;};'use strict';var _=require(_0x1093('0x0'));var util=require(_0x1093('0x1'));var logger=require(_0x1093('0x2'))('api');var moment=require(_0x1093('0x3'));var BPromise=require(_0x1093('0x4'));var rp=require(_0x1093('0x5'));var fs=require('fs');var path=require(_0x1093('0x6'));var rimraf=require(_0x1093('0x7'));var config=require(_0x1093('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0xbe186f,_0x14e402){return _0xbe186f[_0x1093('0x9')](_0x1093('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x1093('0xb'),'fields':[_0x1093('0xc'),_0x1093('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8dc5=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0xf13dc6,_0x3130c2){var _0x2c82be=function(_0x225794){while(--_0x225794){_0xf13dc6['push'](_0xf13dc6['shift']());}};_0x2c82be(++_0x3130c2);}(_0x8dc5,0x1bb));var _0x58dc=function(_0x139a23,_0x184a3f){_0x139a23=_0x139a23-0x0;var _0x4da424=_0x8dc5[_0x139a23];return _0x4da424;};'use strict';var _=require(_0x58dc('0x0'));var util=require('util');var logger=require(_0x58dc('0x1'))(_0x58dc('0x2'));var moment=require(_0x58dc('0x3'));var BPromise=require(_0x58dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58dc('0x5'));var rimraf=require(_0x58dc('0x6'));var config=require(_0x58dc('0x7'));var attributes=require(_0x58dc('0x8'));module[_0x58dc('0x9')]=function(_0x22ba46,_0x4f89c4){return _0x22ba46['define']('ZohoField',attributes,{'tableName':_0x58dc('0xa'),'paranoid':![],'indexes':[{'name':_0x58dc('0xb'),'fields':[_0x58dc('0xc'),_0x58dc('0xd')],'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 e6d0b08..a168bf9 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x7217,0x19e));var _0x7721=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7217[_0xae7c2f];return _0x5d7001;};'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});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('ZohoField,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x1c3920,_0x4ecc10){var _0x27b9a4=function(_0x34f961){while(--_0x34f961){_0x1c3920['push'](_0x1c3920['shift']());}};_0x27b9a4(++_0x4ecc10);}(_0x55ca,0x126));var _0xa55c=function(_0x3ec751,_0x3009cd){_0x3ec751=_0x3ec751-0x0;var _0x252150=_0x55ca[_0x3ec751];return _0x252150;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3d82a33..da229fc 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 _0xad0b=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xad0b,0x100));var _0xbad0=function(_0x5cf58f,_0xe83a7c){_0x5cf58f=_0x5cf58f-0x0;var _0x1c06ba=_0xad0b[_0x5cf58f];return _0x1c06ba;};'use strict';var multer=require(_0xbad0('0x0'));var util=require(_0xbad0('0x1'));var path=require(_0xbad0('0x2'));var timeout=require(_0xbad0('0x3'));var express=require(_0xbad0('0x4'));var router=express[_0xbad0('0x5')]();var auth=require(_0xbad0('0x6'));var interaction=require(_0xbad0('0x7'));var config=require('../../config/environment');module[_0xbad0('0x8')]=router; \ No newline at end of file +var _0x9c60=['../../config/environment','path','express','Router','../../components/interaction/service'];(function(_0x10e8e2,_0x222fa2){var _0x5cd382=function(_0x4a71c6){while(--_0x4a71c6){_0x10e8e2['push'](_0x10e8e2['shift']());}};_0x5cd382(++_0x222fa2);}(_0x9c60,0x164));var _0x09c6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9c60[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x09c6('0x0'));var timeout=require('connect-timeout');var express=require(_0x09c6('0x1'));var router=express[_0x09c6('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x09c6('0x3'));var config=require(_0x09c6('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index af2e05e..a2a7317 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 _0x04a3=['unique_name_and_version','INTEGER','exports','STRING'];(function(_0x564922,_0x3ef65a){var _0x49c500=function(_0x492547){while(--_0x492547){_0x564922['push'](_0x564922['shift']());}};_0x49c500(++_0x3ef65a);}(_0x04a3,0x1a6));var _0x304a=function(_0x64ec9f,_0x1308d9){_0x64ec9f=_0x64ec9f-0x0;var _0x1acec9=_0x04a3[_0x64ec9f];return _0x1acec9;};'use strict';var Sequelize=require('sequelize');module[_0x304a('0x0')]={'name':{'type':Sequelize[_0x304a('0x1')],'allowNull':![],'unique':_0x304a('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x304a('0x2')},'main':{'type':Sequelize[_0x304a('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x304a('0x1')]},'path':{'type':Sequelize[_0x304a('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x304a('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x304a('0x1')]},'logo':{'type':Sequelize[_0x304a('0x1')]},'state':{'type':Sequelize[_0x304a('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x304a('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x304a('0x1')]},'link':{'type':Sequelize[_0x304a('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x6d2b=['unique_name_and_version','app.js','INTEGER','state','sequelize','exports','STRING'];(function(_0x2dffff,_0x2ae95a){var _0x452114=function(_0x4504ed){while(--_0x4504ed){_0x2dffff['push'](_0x2dffff['shift']());}};_0x452114(++_0x2ae95a);}(_0x6d2b,0xcf));var _0xb6d2=function(_0x547104,_0x4b2dce){_0x547104=_0x547104-0x0;var _0xc6947f=_0x6d2b[_0x547104];return _0xc6947f;};'use strict';var Sequelize=require(_0xb6d2('0x0'));module[_0xb6d2('0x1')]={'name':{'type':Sequelize[_0xb6d2('0x2')],'allowNull':![],'unique':_0xb6d2('0x3')},'version':{'type':Sequelize[_0xb6d2('0x2')],'allowNull':![],'unique':_0xb6d2('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb6d2('0x4')},'filename':{'type':Sequelize[_0xb6d2('0x2')]},'path':{'type':Sequelize[_0xb6d2('0x2')]},'type':{'type':Sequelize[_0xb6d2('0x2')]},'size':{'type':Sequelize[_0xb6d2('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xb6d2('0x2')]},'logo':{'type':Sequelize[_0xb6d2('0x2')]},'state':{'type':Sequelize[_0xb6d2('0x2')],'unique':_0xb6d2('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xb6d2('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xb6d2('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 38b61ed..5048591 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 _0xd2f0=['where','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','merge','create','body','find','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','error','name','index','Integration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','filter'];(function(_0xbf689c,_0x20dd8f){var _0x300a05=function(_0x530367){while(--_0x530367){_0xbf689c['push'](_0xbf689c['shift']());}};_0x300a05(++_0x20dd8f);}(_0xd2f0,0x18b));var _0x0d2f=function(_0x13c5d8,_0xa5b145){_0x13c5d8=_0x13c5d8-0x0;var _0x1c8c17=_0xd2f0[_0x13c5d8];return _0x1c8c17;};'use strict';var pdf=require(_0x0d2f('0x0'));var emlformat=require(_0x0d2f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d2f('0x2'));var jsonpatch=require(_0x0d2f('0x3'));var rp=require('request-promise');var moment=require(_0x0d2f('0x4'));var BPromise=require(_0x0d2f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0d2f('0x6'));var sox=require(_0x0d2f('0x7'));var csv=require('to-csv');var ejs=require(_0x0d2f('0x8'));var fs=require('fs');var _=require(_0x0d2f('0x9'));var squel=require(_0x0d2f('0xa'));var crypto=require(_0x0d2f('0xb'));var jsforce=require(_0x0d2f('0xc'));var deskjs=require(_0x0d2f('0xd'));var toCsv=require(_0x0d2f('0xe'));var querystring=require(_0x0d2f('0xf'));var Papa=require(_0x0d2f('0x10'));var Redis=require(_0x0d2f('0x11'));var authService=require(_0x0d2f('0x12'));var qs=require(_0x0d2f('0x13'));var as=require(_0x0d2f('0x14'));var hardwareService=require(_0x0d2f('0x15'));var logger=require(_0x0d2f('0x16'))(_0x0d2f('0x17'));var utils=require(_0x0d2f('0x18'));var config=require(_0x0d2f('0x19'));var licenseUtil=require(_0x0d2f('0x1a'));var db=require(_0x0d2f('0x1b'))['db'];function respondWithStatusCode(_0x4155d4,_0x37cf96){_0x37cf96=_0x37cf96||0xcc;return function(_0x1dd686){if(_0x1dd686){return _0x4155d4[_0x0d2f('0x1c')](_0x37cf96);}return _0x4155d4[_0x0d2f('0x1d')](_0x37cf96)[_0x0d2f('0x1e')]();};}function respondWithResult(_0x4e4e9c,_0x93a557){_0x93a557=_0x93a557||0xc8;return function(_0x182bdd){if(_0x182bdd){return _0x4e4e9c[_0x0d2f('0x1d')](_0x93a557)[_0x0d2f('0x1f')](_0x182bdd);}};}function respondWithFilteredResult(_0xc9eec1,_0x1f8fcb){return function(_0x492d06){if(_0x492d06){var _0x22e2c1=_0x492d06['count'],_0x4c99a8=_0x1f8fcb['offset'],_0x475ee5=_0x1f8fcb[_0x0d2f('0x20')]+_0x1f8fcb['limit'],_0x36336e;if(_0x475ee5>=_0x22e2c1){_0x475ee5=_0x22e2c1;_0x36336e=0xc8;}else{_0x36336e=0xce;}_0xc9eec1['status'](_0x36336e);return _0xc9eec1[_0x0d2f('0x21')]('Content-Range',_0x4c99a8+'-'+_0x475ee5+'/'+_0x22e2c1)['json'](_0x492d06);}return null;};}function patchUpdates(_0x4eda1e){return function(_0x4dff15){try{jsonpatch[_0x0d2f('0x22')](_0x4dff15,_0x4eda1e,!![]);}catch(_0x3b5b0d){return BPromise[_0x0d2f('0x23')](_0x3b5b0d);}return _0x4dff15[_0x0d2f('0x24')]();};}function saveUpdates(_0x52ea44,_0x47e306){return function(_0x2d6ed7){if(_0x2d6ed7){return _0x2d6ed7[_0x0d2f('0x25')](_0x52ea44)[_0x0d2f('0x26')](function(_0x99249){return _0x99249;});}return null;};}function removeEntity(_0x9d11c7,_0x3cdb97){return function(_0x3ba294){if(_0x3ba294){return _0x3ba294['destroy']()['then'](function(){_0x9d11c7[_0x0d2f('0x1d')](0xcc)[_0x0d2f('0x1e')]();});}};}function handleEntityNotFound(_0x383f50,_0x503044){return function(_0x38fb51){if(!_0x38fb51){_0x383f50[_0x0d2f('0x1c')](0x194);}return _0x38fb51;};}function handleError(_0x40d93f,_0x5ec9e4){_0x5ec9e4=_0x5ec9e4||0x1f4;return function(_0x2f44e1){logger[_0x0d2f('0x27')](_0x2f44e1['stack']);if(_0x2f44e1[_0x0d2f('0x28')]){delete _0x2f44e1['name'];}_0x40d93f['status'](_0x5ec9e4)['send'](_0x2f44e1);};}exports[_0x0d2f('0x29')]=function(_0x50ea5c,_0x590027){var _0x248de6={},_0x54a8fd={},_0x352ecd={'count':0x0,'rows':[]};var _0x49e386=_['map'](db[_0x0d2f('0x2a')][_0x0d2f('0x2b')],function(_0x40a0df){return{'name':_0x40a0df[_0x0d2f('0x2c')],'type':_0x40a0df[_0x0d2f('0x2d')][_0x0d2f('0x2e')]};});_0x54a8fd['model']=_[_0x0d2f('0x2f')](_0x49e386,_0x0d2f('0x28'));_0x54a8fd[_0x0d2f('0x30')]=_[_0x0d2f('0x31')](_0x50ea5c['query']);_0x54a8fd[_0x0d2f('0x32')]=_['intersection'](_0x54a8fd['model'],_0x54a8fd[_0x0d2f('0x30')]);_0x248de6['attributes']=_[_0x0d2f('0x33')](_0x54a8fd[_0x0d2f('0x34')],qs[_0x0d2f('0x35')](_0x50ea5c[_0x0d2f('0x30')][_0x0d2f('0x35')]));_0x248de6['attributes']=_0x248de6[_0x0d2f('0x36')][_0x0d2f('0x37')]?_0x248de6[_0x0d2f('0x36')]:_0x54a8fd['model'];if(!_0x50ea5c[_0x0d2f('0x30')][_0x0d2f('0x38')]('nolimit')){_0x248de6[_0x0d2f('0x39')]=qs[_0x0d2f('0x39')](_0x50ea5c['query'][_0x0d2f('0x39')]);_0x248de6['offset']=qs[_0x0d2f('0x20')](_0x50ea5c[_0x0d2f('0x30')][_0x0d2f('0x20')]);}_0x248de6[_0x0d2f('0x3a')]=qs[_0x0d2f('0x3b')](_0x50ea5c[_0x0d2f('0x30')]['sort']);_0x248de6['where']=qs['filters'](_['pick'](_0x50ea5c[_0x0d2f('0x30')],_0x54a8fd[_0x0d2f('0x32')]),_0x49e386);if(_0x50ea5c[_0x0d2f('0x30')][_0x0d2f('0x3c')]){_0x248de6[_0x0d2f('0x3d')]=_['merge'](_0x248de6['where'],{'$or':_[_0x0d2f('0x2f')](_0x49e386,function(_0xc7200e){if(_0xc7200e[_0x0d2f('0x2d')]!==_0x0d2f('0x3e')){var _0x1b1947={};_0x1b1947[_0xc7200e['name']]={'$like':'%'+_0x50ea5c[_0x0d2f('0x30')]['filter']+'%'};return _0x1b1947;}})});}_0x248de6=_['merge']({},_0x248de6,_0x50ea5c[_0x0d2f('0x3f')]);var _0x32787b={'where':_0x248de6[_0x0d2f('0x3d')]};return db['Integration'][_0x0d2f('0x40')](_0x32787b)[_0x0d2f('0x26')](function(_0x3ca05d){_0x352ecd[_0x0d2f('0x40')]=_0x3ca05d;if(_0x50ea5c['query'][_0x0d2f('0x41')]){_0x248de6[_0x0d2f('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x248de6);})[_0x0d2f('0x26')](function(_0xd13b1){_0x352ecd[_0x0d2f('0x43')]=_0xd13b1;return _0x352ecd;})[_0x0d2f('0x26')](respondWithFilteredResult(_0x590027,_0x248de6))[_0x0d2f('0x44')](handleError(_0x590027,null));};exports[_0x0d2f('0x45')]=function(_0x9daeb9,_0x294e20){var _0x4ce28b={'raw':![],'where':{'id':_0x9daeb9[_0x0d2f('0x46')]['id']}},_0xe3ac96={};_0xe3ac96['model']=_['keys'](db['Integration'][_0x0d2f('0x2b')]);_0xe3ac96[_0x0d2f('0x30')]=_[_0x0d2f('0x31')](_0x9daeb9['query']);_0xe3ac96[_0x0d2f('0x32')]=_[_0x0d2f('0x33')](_0xe3ac96[_0x0d2f('0x34')],_0xe3ac96[_0x0d2f('0x30')]);_0x4ce28b[_0x0d2f('0x36')]=_[_0x0d2f('0x33')](_0xe3ac96[_0x0d2f('0x34')],qs[_0x0d2f('0x35')](_0x9daeb9[_0x0d2f('0x30')][_0x0d2f('0x35')]));_0x4ce28b['attributes']=_0x4ce28b[_0x0d2f('0x36')][_0x0d2f('0x37')]?_0x4ce28b['attributes']:_0xe3ac96['model'];if(_0x9daeb9[_0x0d2f('0x30')][_0x0d2f('0x41')]){_0x4ce28b[_0x0d2f('0x42')]=[{'all':!![]}];}_0x4ce28b=_[_0x0d2f('0x47')]({},_0x4ce28b,_0x9daeb9[_0x0d2f('0x3f')]);return db['Integration']['find'](_0x4ce28b)[_0x0d2f('0x26')](handleEntityNotFound(_0x294e20,null))[_0x0d2f('0x26')](respondWithResult(_0x294e20,null))[_0x0d2f('0x44')](handleError(_0x294e20,null));};exports[_0x0d2f('0x48')]=function(_0x12c919,_0x128797){return db['Integration'][_0x0d2f('0x48')](_0x12c919[_0x0d2f('0x49')],{})[_0x0d2f('0x26')](respondWithResult(_0x128797,0xc9))[_0x0d2f('0x44')](handleError(_0x128797,null));};exports[_0x0d2f('0x25')]=function(_0x59084a,_0x3d3ea8){if(_0x59084a[_0x0d2f('0x49')]['id']){delete _0x59084a[_0x0d2f('0x49')]['id'];}return db['Integration'][_0x0d2f('0x4a')]({'where':{'id':_0x59084a[_0x0d2f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d3ea8,null))[_0x0d2f('0x26')](saveUpdates(_0x59084a[_0x0d2f('0x49')],null))[_0x0d2f('0x26')](respondWithResult(_0x3d3ea8,null))['catch'](handleError(_0x3d3ea8,null));};exports[_0x0d2f('0x4b')]=function(_0x4254d3,_0x416437){return db[_0x0d2f('0x2a')][_0x0d2f('0x4a')]({'where':{'id':_0x4254d3[_0x0d2f('0x46')]['id']}})[_0x0d2f('0x26')](handleEntityNotFound(_0x416437,null))['then'](removeEntity(_0x416437,null))[_0x0d2f('0x44')](handleError(_0x416437,null));}; \ No newline at end of file +var _0x6efe=['catch','params','intersection','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','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','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6efe,0x1a5));var _0xe6ef=function(_0x10ce1b,_0x4bd436){_0x10ce1b=_0x10ce1b-0x0;var _0x2a3d53=_0x6efe[_0x10ce1b];return _0x2a3d53;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe6ef('0x1'));var jsonpatch=require(_0xe6ef('0x2'));var rp=require(_0xe6ef('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe6ef('0x4'));var util=require(_0xe6ef('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe6ef('0x6'));var crypto=require('crypto');var jsforce=require(_0xe6ef('0x7'));var deskjs=require(_0xe6ef('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe6ef('0x9'));var Redis=require(_0xe6ef('0xa'));var authService=require(_0xe6ef('0xb'));var qs=require(_0xe6ef('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6ef('0xd'));var logger=require(_0xe6ef('0xe'))(_0xe6ef('0xf'));var utils=require(_0xe6ef('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe6ef('0x11'));var db=require(_0xe6ef('0x12'))['db'];function respondWithStatusCode(_0x4ef60c,_0xa2f540){_0xa2f540=_0xa2f540||0xcc;return function(_0x3b9220){if(_0x3b9220){return _0x4ef60c[_0xe6ef('0x13')](_0xa2f540);}return _0x4ef60c[_0xe6ef('0x14')](_0xa2f540)['end']();};}function respondWithResult(_0xc94cbb,_0x570ec0){_0x570ec0=_0x570ec0||0xc8;return function(_0x22c51e){if(_0x22c51e){return _0xc94cbb[_0xe6ef('0x14')](_0x570ec0)[_0xe6ef('0x15')](_0x22c51e);}};}function respondWithFilteredResult(_0x23e11f,_0x594fda){return function(_0x108edf){if(_0x108edf){var _0x522ce8=_0x108edf[_0xe6ef('0x16')],_0x30039a=_0x594fda[_0xe6ef('0x17')],_0x5d9a32=_0x594fda['offset']+_0x594fda[_0xe6ef('0x18')],_0x39a873;if(_0x5d9a32>=_0x522ce8){_0x5d9a32=_0x522ce8;_0x39a873=0xc8;}else{_0x39a873=0xce;}_0x23e11f[_0xe6ef('0x14')](_0x39a873);return _0x23e11f['set'](_0xe6ef('0x19'),_0x30039a+'-'+_0x5d9a32+'/'+_0x522ce8)[_0xe6ef('0x15')](_0x108edf);}return null;};}function patchUpdates(_0x3beef1){return function(_0x47cc92){try{jsonpatch[_0xe6ef('0x1a')](_0x47cc92,_0x3beef1,!![]);}catch(_0x34b7c2){return BPromise[_0xe6ef('0x1b')](_0x34b7c2);}return _0x47cc92['save']();};}function saveUpdates(_0x5710f7,_0x2d0a6d){return function(_0x1920c0){if(_0x1920c0){return _0x1920c0[_0xe6ef('0x1c')](_0x5710f7)[_0xe6ef('0x1d')](function(_0x232f14){return _0x232f14;});}return null;};}function removeEntity(_0x33fdad,_0x49a6e4){return function(_0x38e3b7){if(_0x38e3b7){return _0x38e3b7[_0xe6ef('0x1e')]()[_0xe6ef('0x1d')](function(){_0x33fdad[_0xe6ef('0x14')](0xcc)[_0xe6ef('0x1f')]();});}};}function handleEntityNotFound(_0x2f0ca3,_0x4eb415){return function(_0x532698){if(!_0x532698){_0x2f0ca3[_0xe6ef('0x13')](0x194);}return _0x532698;};}function handleError(_0x30c215,_0xd00592){_0xd00592=_0xd00592||0x1f4;return function(_0x5e6a1f){logger[_0xe6ef('0x20')](_0x5e6a1f[_0xe6ef('0x21')]);if(_0x5e6a1f[_0xe6ef('0x22')]){delete _0x5e6a1f[_0xe6ef('0x22')];}_0x30c215['status'](_0xd00592)[_0xe6ef('0x23')](_0x5e6a1f);};}exports[_0xe6ef('0x24')]=function(_0x50d2c8,_0x45c97d){var _0x5bdfe4={},_0x1cd86a={},_0x6d5116={'count':0x0,'rows':[]};var _0x387e8a=_[_0xe6ef('0x25')](db[_0xe6ef('0x26')][_0xe6ef('0x27')],function(_0x596b62){return{'name':_0x596b62[_0xe6ef('0x28')],'type':_0x596b62[_0xe6ef('0x29')][_0xe6ef('0x2a')]};});_0x1cd86a[_0xe6ef('0x2b')]=_[_0xe6ef('0x25')](_0x387e8a,_0xe6ef('0x22'));_0x1cd86a[_0xe6ef('0x2c')]=_[_0xe6ef('0x2d')](_0x50d2c8[_0xe6ef('0x2c')]);_0x1cd86a[_0xe6ef('0x2e')]=_['intersection'](_0x1cd86a[_0xe6ef('0x2b')],_0x1cd86a['query']);_0x5bdfe4[_0xe6ef('0x2f')]=_['intersection'](_0x1cd86a[_0xe6ef('0x2b')],qs[_0xe6ef('0x30')](_0x50d2c8[_0xe6ef('0x2c')][_0xe6ef('0x30')]));_0x5bdfe4[_0xe6ef('0x2f')]=_0x5bdfe4['attributes'][_0xe6ef('0x31')]?_0x5bdfe4[_0xe6ef('0x2f')]:_0x1cd86a[_0xe6ef('0x2b')];if(!_0x50d2c8[_0xe6ef('0x2c')][_0xe6ef('0x32')](_0xe6ef('0x33'))){_0x5bdfe4['limit']=qs[_0xe6ef('0x18')](_0x50d2c8[_0xe6ef('0x2c')]['limit']);_0x5bdfe4[_0xe6ef('0x17')]=qs[_0xe6ef('0x17')](_0x50d2c8[_0xe6ef('0x2c')][_0xe6ef('0x17')]);}_0x5bdfe4['order']=qs[_0xe6ef('0x34')](_0x50d2c8[_0xe6ef('0x2c')][_0xe6ef('0x34')]);_0x5bdfe4[_0xe6ef('0x35')]=qs[_0xe6ef('0x2e')](_[_0xe6ef('0x36')](_0x50d2c8[_0xe6ef('0x2c')],_0x1cd86a[_0xe6ef('0x2e')]),_0x387e8a);if(_0x50d2c8[_0xe6ef('0x2c')][_0xe6ef('0x37')]){_0x5bdfe4[_0xe6ef('0x35')]=_['merge'](_0x5bdfe4[_0xe6ef('0x35')],{'$or':_['map'](_0x387e8a,function(_0x32a28a){if(_0x32a28a[_0xe6ef('0x29')]!==_0xe6ef('0x38')){var _0xd7cb63={};_0xd7cb63[_0x32a28a[_0xe6ef('0x22')]]={'$like':'%'+_0x50d2c8[_0xe6ef('0x2c')][_0xe6ef('0x37')]+'%'};return _0xd7cb63;}})});}_0x5bdfe4=_[_0xe6ef('0x39')]({},_0x5bdfe4,_0x50d2c8[_0xe6ef('0x3a')]);var _0x2e0fb6={'where':_0x5bdfe4['where']};return db[_0xe6ef('0x26')][_0xe6ef('0x16')](_0x2e0fb6)[_0xe6ef('0x1d')](function(_0x4fb786){_0x6d5116[_0xe6ef('0x16')]=_0x4fb786;if(_0x50d2c8[_0xe6ef('0x2c')]['includeAll']){_0x5bdfe4[_0xe6ef('0x3b')]=[{'all':!![]}];}return db['Integration'][_0xe6ef('0x3c')](_0x5bdfe4);})[_0xe6ef('0x1d')](function(_0x5e4735){_0x6d5116[_0xe6ef('0x3d')]=_0x5e4735;return _0x6d5116;})[_0xe6ef('0x1d')](respondWithFilteredResult(_0x45c97d,_0x5bdfe4))[_0xe6ef('0x3e')](handleError(_0x45c97d,null));};exports['show']=function(_0x485c61,_0x3b20ef){var _0x26e073={'raw':![],'where':{'id':_0x485c61[_0xe6ef('0x3f')]['id']}},_0x57f8d1={};_0x57f8d1['model']=_[_0xe6ef('0x2d')](db[_0xe6ef('0x26')]['rawAttributes']);_0x57f8d1['query']=_[_0xe6ef('0x2d')](_0x485c61[_0xe6ef('0x2c')]);_0x57f8d1['filters']=_[_0xe6ef('0x40')](_0x57f8d1[_0xe6ef('0x2b')],_0x57f8d1[_0xe6ef('0x2c')]);_0x26e073[_0xe6ef('0x2f')]=_[_0xe6ef('0x40')](_0x57f8d1[_0xe6ef('0x2b')],qs[_0xe6ef('0x30')](_0x485c61[_0xe6ef('0x2c')]['fields']));_0x26e073['attributes']=_0x26e073[_0xe6ef('0x2f')]['length']?_0x26e073[_0xe6ef('0x2f')]:_0x57f8d1[_0xe6ef('0x2b')];if(_0x485c61[_0xe6ef('0x2c')][_0xe6ef('0x41')]){_0x26e073[_0xe6ef('0x3b')]=[{'all':!![]}];}_0x26e073=_['merge']({},_0x26e073,_0x485c61[_0xe6ef('0x3a')]);return db['Integration']['find'](_0x26e073)[_0xe6ef('0x1d')](handleEntityNotFound(_0x3b20ef,null))[_0xe6ef('0x1d')](respondWithResult(_0x3b20ef,null))[_0xe6ef('0x3e')](handleError(_0x3b20ef,null));};exports['create']=function(_0x50fa10,_0x1463a6){return db[_0xe6ef('0x26')][_0xe6ef('0x42')](_0x50fa10[_0xe6ef('0x43')],{})[_0xe6ef('0x1d')](respondWithResult(_0x1463a6,0xc9))[_0xe6ef('0x3e')](handleError(_0x1463a6,null));};exports['update']=function(_0x3e0754,_0x1946db){if(_0x3e0754[_0xe6ef('0x43')]['id']){delete _0x3e0754[_0xe6ef('0x43')]['id'];}return db[_0xe6ef('0x26')][_0xe6ef('0x44')]({'where':{'id':_0x3e0754[_0xe6ef('0x3f')]['id']}})[_0xe6ef('0x1d')](handleEntityNotFound(_0x1946db,null))[_0xe6ef('0x1d')](saveUpdates(_0x3e0754[_0xe6ef('0x43')],null))[_0xe6ef('0x1d')](respondWithResult(_0x1946db,null))[_0xe6ef('0x3e')](handleError(_0x1946db,null));};exports[_0xe6ef('0x1e')]=function(_0x10977d,_0x113b41){return db['Integration'][_0xe6ef('0x44')]({'where':{'id':_0x10977d[_0xe6ef('0x3f')]['id']}})['then'](handleEntityNotFound(_0x113b41,null))['then'](removeEntity(_0x113b41,null))['catch'](handleError(_0x113b41,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index e09d573..2f6a349 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 _0xdf0d=['rimraf','exports','define','Integration','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xdf0d,0x17a));var _0xddf0=function(_0x471b98,_0x7028dc){_0x471b98=_0x471b98-0x0;var _0x529f89=_0xdf0d[_0x471b98];return _0x529f89;};'use strict';var _=require(_0xddf0('0x0'));var util=require(_0xddf0('0x1'));var logger=require(_0xddf0('0x2'))(_0xddf0('0x3'));var moment=require('moment');var BPromise=require(_0xddf0('0x4'));var rp=require(_0xddf0('0x5'));var fs=require('fs');var path=require(_0xddf0('0x6'));var rimraf=require(_0xddf0('0x7'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0xddf0('0x8')]=function(_0x215c75,_0x19c148){return _0x215c75[_0xddf0('0x9')](_0xddf0('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5c0=['../../config/environment','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc5c0,0x14f));var _0x0c5c=function(_0x20792c,_0x5245bc){_0x20792c=_0x20792c-0x0;var _0x5f25a8=_0xc5c0[_0x20792c];return _0x5f25a8;};'use strict';var _=require(_0x0c5c('0x0'));var util=require(_0x0c5c('0x1'));var logger=require(_0x0c5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0c5c('0x3'));var rp=require(_0x0c5c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c5c('0x5'));var config=require(_0x0c5c('0x6'));var attributes=require(_0x0c5c('0x7'));module[_0x0c5c('0x8')]=function(_0x48024b,_0x519ffb){return _0x48024b[_0x0c5c('0x9')]('Integration',attributes,{'tableName':_0x0c5c('0xa'),'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 bf91328..904ae01 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 _0x7d33=['debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent'];(function(_0x3f0642,_0x2f1fbf){var _0x33738e=function(_0x2a5fa1){while(--_0x2a5fa1){_0x3f0642['push'](_0x3f0642['shift']());}};_0x33738e(++_0x2f1fbf);}(_0x7d33,0x162));var _0x37d3=function(_0x4d0d0e,_0x301fd5){_0x4d0d0e=_0x4d0d0e-0x0;var _0x566eaa=_0x7d33[_0x4d0d0e];return _0x566eaa;};'use strict';var _=require(_0x37d3('0x0'));var util=require('util');var moment=require(_0x37d3('0x1'));var BPromise=require(_0x37d3('0x2'));var rs=require(_0x37d3('0x3'));var fs=require('fs');var Redis=require(_0x37d3('0x4'));var db=require(_0x37d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x37d3('0x6'))(_0x37d3('0x7'));var config=require(_0x37d3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x37d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446563,_0x7321c1,_0x59907c){return new BPromise(function(_0x1bdc48,_0x473042){return client[_0x37d3('0xa')](_0x446563,_0x59907c)[_0x37d3('0xb')](function(_0x10ffc0){logger[_0x37d3('0xc')]('Integration,\x20%s,\x20%s',_0x7321c1,_0x37d3('0xd'));logger[_0x37d3('0xe')](_0x37d3('0xf'),_0x7321c1,_0x37d3('0xd'),JSON[_0x37d3('0x10')](_0x10ffc0));if(_0x10ffc0[_0x37d3('0x11')]){if(_0x10ffc0[_0x37d3('0x11')][_0x37d3('0x12')]===0x1f4){logger[_0x37d3('0x11')](_0x37d3('0x13'),_0x7321c1,_0x10ffc0[_0x37d3('0x11')][_0x37d3('0x14')]);return _0x473042(_0x10ffc0['error'][_0x37d3('0x14')]);}logger[_0x37d3('0x11')](_0x37d3('0x13'),_0x7321c1,_0x10ffc0[_0x37d3('0x11')]['message']);return _0x1bdc48(_0x10ffc0[_0x37d3('0x11')]['message']);}else{logger[_0x37d3('0xc')](_0x37d3('0x13'),_0x7321c1,_0x37d3('0xd'));_0x1bdc48(_0x10ffc0[_0x37d3('0x15')][_0x37d3('0x14')]);}})[_0x37d3('0x16')](function(_0x3e0865){logger[_0x37d3('0x11')](_0x37d3('0x13'),_0x7321c1,_0x3e0865);_0x473042(_0x3e0865);});});} \ No newline at end of file +var _0x7025=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x3bbb2d,_0x57d915){var _0x5425b1=function(_0x27c570){while(--_0x27c570){_0x3bbb2d['push'](_0x3bbb2d['shift']());}};_0x5425b1(++_0x57d915);}(_0x7025,0x132));var _0x5702=function(_0x1e1096,_0x116bc0){_0x1e1096=_0x1e1096-0x0;var _0xf9b303=_0x7025[_0x1e1096];return _0xf9b303;};'use strict';var _=require(_0x5702('0x0'));var util=require(_0x5702('0x1'));var moment=require(_0x5702('0x2'));var BPromise=require(_0x5702('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5702('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5702('0x5'));var logger=require(_0x5702('0x6'))(_0x5702('0x7'));var config=require(_0x5702('0x8'));var jayson=require(_0x5702('0x9'));var client=jayson[_0x5702('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ee158,_0x35beac,_0x253d20){return new BPromise(function(_0x6cc969,_0x19d775){return client[_0x5702('0xb')](_0x5ee158,_0x253d20)[_0x5702('0xc')](function(_0x203d8c){logger[_0x5702('0xd')](_0x5702('0xe'),_0x35beac,_0x5702('0xf'));logger[_0x5702('0x10')](_0x5702('0x11'),_0x35beac,_0x5702('0xf'),JSON[_0x5702('0x12')](_0x203d8c));if(_0x203d8c[_0x5702('0x13')]){if(_0x203d8c[_0x5702('0x13')]['code']===0x1f4){logger['error'](_0x5702('0xe'),_0x35beac,_0x203d8c[_0x5702('0x13')]['message']);return _0x19d775(_0x203d8c[_0x5702('0x13')]['message']);}logger['error'](_0x5702('0xe'),_0x35beac,_0x203d8c['error'][_0x5702('0x14')]);return _0x6cc969(_0x203d8c[_0x5702('0x13')][_0x5702('0x14')]);}else{logger[_0x5702('0xd')](_0x5702('0xe'),_0x35beac,_0x5702('0xf'));_0x6cc969(_0x203d8c[_0x5702('0x15')][_0x5702('0x14')]);}})['catch'](function(_0x3b76d4){logger[_0x5702('0x13')]('Integration,\x20%s,\x20%s',_0x35beac,_0x3b76d4);_0x19d775(_0x3b76d4);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 298b4cf..80db44f 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 _0xaecf=['isAuthenticated','index','show','put','/:id','update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x5b22ca,_0x37edfc){var _0x18e885=function(_0x2bc396){while(--_0x2bc396){_0x5b22ca['push'](_0x5b22ca['shift']());}};_0x18e885(++_0x37edfc);}(_0xaecf,0x149));var _0xfaec=function(_0x106510,_0x3f2c15){_0x106510=_0x106510-0x0;var _0x53371d=_0xaecf[_0x106510];return _0x53371d;};'use strict';var multer=require(_0xfaec('0x0'));var util=require(_0xfaec('0x1'));var path=require(_0xfaec('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaec('0x3'));var router=express['Router']();var auth=require(_0xfaec('0x4'));var interaction=require(_0xfaec('0x5'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0xfaec('0x6')]('/',auth[_0xfaec('0x7')](),controller[_0xfaec('0x8')]);router[_0xfaec('0x6')]('/describe',auth[_0xfaec('0x7')](),controller['describe']);router[_0xfaec('0x6')]('/:id',auth[_0xfaec('0x7')](),controller[_0xfaec('0x9')]);router['post']('/',auth[_0xfaec('0x7')](),controller['create']);router[_0xfaec('0xa')](_0xfaec('0xb'),auth[_0xfaec('0x7')](),controller[_0xfaec('0xc')]);router['delete']('/:id',auth[_0xfaec('0x7')](),controller['destroy']);module[_0xfaec('0xd')]=router; \ No newline at end of file +var _0xfba1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3c3185,_0x3c0e7b){var _0xd18df5=function(_0x277f46){while(--_0x277f46){_0x3c3185['push'](_0x3c3185['shift']());}};_0xd18df5(++_0x3c0e7b);}(_0xfba1,0x1ca));var _0x1fba=function(_0x318596,_0x3be2da){_0x318596=_0x318596-0x0;var _0x14bf65=_0xfba1[_0x318596];return _0x14bf65;};'use strict';var multer=require(_0x1fba('0x0'));var util=require('util');var path=require(_0x1fba('0x1'));var timeout=require(_0x1fba('0x2'));var express=require(_0x1fba('0x3'));var router=express[_0x1fba('0x4')]();var auth=require(_0x1fba('0x5'));var interaction=require(_0x1fba('0x6'));var config=require(_0x1fba('0x7'));var controller=require('./integrationReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1fba('0x8')]);router[_0x1fba('0x9')](_0x1fba('0xa'),auth[_0x1fba('0xb')](),controller[_0x1fba('0xc')]);router['get'](_0x1fba('0xd'),auth['isAuthenticated'](),controller[_0x1fba('0xe')]);router[_0x1fba('0xf')]('/',auth[_0x1fba('0xb')](),controller[_0x1fba('0x10')]);router[_0x1fba('0x11')](_0x1fba('0xd'),auth['isAuthenticated'](),controller[_0x1fba('0x12')]);router['delete'](_0x1fba('0xd'),auth['isAuthenticated'](),controller[_0x1fba('0x13')]);module[_0x1fba('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4798827..1d5c732 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 _0x7473=['STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','FAILED','sequelize','exports'];(function(_0x2599f1,_0x2cfd64){var _0x45f2fd=function(_0x3a4b64){while(--_0x3a4b64){_0x2599f1['push'](_0x2599f1['shift']());}};_0x45f2fd(++_0x2cfd64);}(_0x7473,0x198));var _0x3747=function(_0x586232,_0x448f52){_0x586232=_0x586232-0x0;var _0x42c6e4=_0x7473[_0x586232];return _0x42c6e4;};'use strict';var Sequelize=require(_0x3747('0x0'));module[_0x3747('0x1')]={'integration':{'type':Sequelize[_0x3747('0x2')]},'eventChannel':{'type':Sequelize[_0x3747('0x2')]},'exitStatus':{'type':Sequelize[_0x3747('0x2')]},'ticketId':{'type':Sequelize[_0x3747('0x2')]},'integrationId':{'type':Sequelize[_0x3747('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3747('0x2')]},'calleridnum':{'type':Sequelize[_0x3747('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3747('0x2')]},'interface':{'type':Sequelize[_0x3747('0x2')]},'membername':{'type':Sequelize[_0x3747('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3747('0x4')]},'holdtime':{'type':Sequelize[_0x3747('0x3')]},'agentcomplete':{'type':Sequelize[_0x3747('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3747('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3747('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x3747('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3747('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3747('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3747('0x2')]},'connectedlinename':{'type':Sequelize[_0x3747('0x2')]},'language':{'type':Sequelize[_0x3747('0x2')]},'accountcode':{'type':Sequelize[_0x3747('0x2')]},'context':{'type':Sequelize[_0x3747('0x2')]},'exten':{'type':Sequelize[_0x3747('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3747('0x2')]},'destchannelstate':{'type':Sequelize[_0x3747('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3747('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3747('0x2')]},'destcalleridname':{'type':Sequelize[_0x3747('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3747('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x3747('0x2')]},'destcontext':{'type':Sequelize[_0x3747('0x2')]},'destexten':{'type':Sequelize[_0x3747('0x2')]},'destpriority':{'type':Sequelize[_0x3747('0x2')]},'destuniqueid':{'type':Sequelize[_0x3747('0x2')]},'messageId':{'type':Sequelize[_0x3747('0x2')]},'inReplyTo':{'type':Sequelize[_0x3747('0x2')]},'subject':{'type':Sequelize[_0x3747('0x2')]},'from':{'type':Sequelize[_0x3747('0x2')]},'to':{'type':Sequelize[_0x3747('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3747('0x6')]},'html':{'type':Sequelize[_0x3747('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x3747('0x7'),_0x3747('0x8'),'RECEIVED',_0x3747('0x9'))},'url':{'type':Sequelize[_0x3747('0x2')]},'app':{'type':Sequelize[_0x3747('0x2')]},'appdata':{'type':Sequelize[_0x3747('0x2')]},'projectId':{'type':Sequelize[_0x3747('0x3')]}}; \ No newline at end of file +var _0x23ca=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','ENUM','SENT','SENDING','RECEIVED'];(function(_0x411761,_0x80588d){var _0xe874e9=function(_0x33e303){while(--_0x33e303){_0x411761['push'](_0x411761['shift']());}};_0xe874e9(++_0x80588d);}(_0x23ca,0x182));var _0xa23c=function(_0x4bc704,_0x36f591){_0x4bc704=_0x4bc704-0x0;var _0x5bc927=_0x23ca[_0x4bc704];return _0x5bc927;};'use strict';var Sequelize=require(_0xa23c('0x0'));module[_0xa23c('0x1')]={'integration':{'type':Sequelize[_0xa23c('0x2')]},'eventChannel':{'type':Sequelize[_0xa23c('0x2')]},'exitStatus':{'type':Sequelize[_0xa23c('0x2')]},'ticketId':{'type':Sequelize[_0xa23c('0x2')]},'integrationId':{'type':Sequelize[_0xa23c('0x3')]},'contacts':{'type':Sequelize[_0xa23c('0x2')]},'uniqueid':{'type':Sequelize[_0xa23c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa23c('0x2')]},'queue':{'type':Sequelize[_0xa23c('0x2')]},'interface':{'type':Sequelize[_0xa23c('0x2')]},'membername':{'type':Sequelize[_0xa23c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa23c('0x4')]},'agentconnectAt':{'type':Sequelize[_0xa23c('0x4')]},'holdtime':{'type':Sequelize[_0xa23c('0x3')]},'agentcomplete':{'type':Sequelize[_0xa23c('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa23c('0x4')]},'talktime':{'type':Sequelize[_0xa23c('0x3')]},'agentacw':{'type':Sequelize[_0xa23c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa23c('0x3')]},'reason':{'type':Sequelize[_0xa23c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa23c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa23c('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa23c('0x4')]},'lastevent':{'type':Sequelize[_0xa23c('0x2')]},'channel':{'type':Sequelize[_0xa23c('0x2')]},'channelstate':{'type':Sequelize[_0xa23c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xa23c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa23c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa23c('0x2')]},'context':{'type':Sequelize[_0xa23c('0x2')]},'exten':{'type':Sequelize[_0xa23c('0x2')]},'priority':{'type':Sequelize[_0xa23c('0x2')]},'destchannel':{'type':Sequelize[_0xa23c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa23c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa23c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa23c('0x2')]},'destlanguage':{'type':Sequelize[_0xa23c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa23c('0x2')]},'destcontext':{'type':Sequelize[_0xa23c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xa23c('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xa23c('0x2')]},'subject':{'type':Sequelize[_0xa23c('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa23c('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xa23c('0x6')](_0xa23c('0x7'),_0xa23c('0x8'),_0xa23c('0x9'),_0xa23c('0xa'))},'url':{'type':Sequelize[_0xa23c('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xa23c('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d34321a..8e48fc4 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 _0x4f09=['VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','map','query','keys','attributes','intersection','model','fields','nolimit','limit','sort','pick','filters','filter','where','merge','type'];(function(_0x1ff41c,_0x5c466e){var _0x471218=function(_0x1291b4){while(--_0x1291b4){_0x1ff41c['push'](_0x1ff41c['shift']());}};_0x471218(++_0x5c466e);}(_0x4f09,0x1c2));var _0x94f0=function(_0xcb4af1,_0x1284e4){_0xcb4af1=_0xcb4af1-0x0;var _0x582348=_0x4f09[_0xcb4af1];return _0x582348;};'use strict';var pdf=require(_0x94f0('0x0'));var emlformat=require(_0x94f0('0x1'));var rimraf=require(_0x94f0('0x2'));var zipdir=require(_0x94f0('0x3'));var jsonpatch=require(_0x94f0('0x4'));var rp=require(_0x94f0('0x5'));var moment=require(_0x94f0('0x6'));var BPromise=require(_0x94f0('0x7'));var Mustache=require(_0x94f0('0x8'));var util=require('util');var path=require(_0x94f0('0x9'));var sox=require(_0x94f0('0xa'));var csv=require(_0x94f0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x94f0('0xc'));var squel=require(_0x94f0('0xd'));var crypto=require(_0x94f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x94f0('0xf'));var toCsv=require(_0x94f0('0xb'));var querystring=require(_0x94f0('0x10'));var Papa=require('papaparse');var Redis=require(_0x94f0('0x11'));var authService=require(_0x94f0('0x12'));var qs=require(_0x94f0('0x13'));var as=require(_0x94f0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x94f0('0x15'))('api');var utils=require(_0x94f0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x94f0('0x17'))['db'];function respondWithStatusCode(_0x519ed0,_0x33c2e7){_0x33c2e7=_0x33c2e7||0xcc;return function(_0x1d2b5e){if(_0x1d2b5e){return _0x519ed0[_0x94f0('0x18')](_0x33c2e7);}return _0x519ed0['status'](_0x33c2e7)[_0x94f0('0x19')]();};}function respondWithResult(_0xc7a8ea,_0x3d6c2b){_0x3d6c2b=_0x3d6c2b||0xc8;return function(_0x4f5ffd){if(_0x4f5ffd){return _0xc7a8ea[_0x94f0('0x1a')](_0x3d6c2b)[_0x94f0('0x1b')](_0x4f5ffd);}};}function respondWithFilteredResult(_0x59d80,_0x2c3178){return function(_0x145b47){if(_0x145b47){var _0x190d49=_0x145b47[_0x94f0('0x1c')],_0x23b09d=_0x2c3178['offset'],_0x1d260c=_0x2c3178[_0x94f0('0x1d')]+_0x2c3178['limit'],_0xfc22e7;if(_0x1d260c>=_0x190d49){_0x1d260c=_0x190d49;_0xfc22e7=0xc8;}else{_0xfc22e7=0xce;}_0x59d80[_0x94f0('0x1a')](_0xfc22e7);return _0x59d80[_0x94f0('0x1e')](_0x94f0('0x1f'),_0x23b09d+'-'+_0x1d260c+'/'+_0x190d49)[_0x94f0('0x1b')](_0x145b47);}return null;};}function patchUpdates(_0x1387b2){return function(_0x5af7b3){try{jsonpatch['apply'](_0x5af7b3,_0x1387b2,!![]);}catch(_0x19ff41){return BPromise['reject'](_0x19ff41);}return _0x5af7b3[_0x94f0('0x20')]();};}function saveUpdates(_0x6d86b,_0x5557e8){return function(_0x53b335){if(_0x53b335){return _0x53b335[_0x94f0('0x21')](_0x6d86b)[_0x94f0('0x22')](function(_0x24e91a){return _0x24e91a;});}return null;};}function removeEntity(_0x26a463,_0x34b9fa){return function(_0x45c3f1){if(_0x45c3f1){return _0x45c3f1[_0x94f0('0x23')]()['then'](function(){_0x26a463['status'](0xcc)[_0x94f0('0x19')]();});}};}function handleEntityNotFound(_0x4ddde6,_0x19326f){return function(_0x3542c1){if(!_0x3542c1){_0x4ddde6[_0x94f0('0x18')](0x194);}return _0x3542c1;};}function handleError(_0x9e78f6,_0x5d6fba){_0x5d6fba=_0x5d6fba||0x1f4;return function(_0x5baefd){logger[_0x94f0('0x24')](_0x5baefd[_0x94f0('0x25')]);if(_0x5baefd[_0x94f0('0x26')]){delete _0x5baefd[_0x94f0('0x26')];}_0x9e78f6[_0x94f0('0x1a')](_0x5d6fba)[_0x94f0('0x27')](_0x5baefd);};}exports[_0x94f0('0x28')]=function(_0x211d15,_0x1bbd3e){var _0x1e96df={},_0x17f4c2={},_0x40225e={'count':0x0,'rows':[]};var _0x386ae1=_['map'](db[_0x94f0('0x29')][_0x94f0('0x2a')],function(_0x175c8f){return{'name':_0x175c8f[_0x94f0('0x2b')],'type':_0x175c8f['type'][_0x94f0('0x2c')]};});_0x17f4c2['model']=_[_0x94f0('0x2d')](_0x386ae1,'name');_0x17f4c2[_0x94f0('0x2e')]=_[_0x94f0('0x2f')](_0x211d15[_0x94f0('0x2e')]);_0x17f4c2['filters']=_['intersection'](_0x17f4c2['model'],_0x17f4c2[_0x94f0('0x2e')]);_0x1e96df[_0x94f0('0x30')]=_[_0x94f0('0x31')](_0x17f4c2[_0x94f0('0x32')],qs['fields'](_0x211d15[_0x94f0('0x2e')][_0x94f0('0x33')]));_0x1e96df[_0x94f0('0x30')]=_0x1e96df[_0x94f0('0x30')]['length']?_0x1e96df[_0x94f0('0x30')]:_0x17f4c2['model'];if(!_0x211d15[_0x94f0('0x2e')]['hasOwnProperty'](_0x94f0('0x34'))){_0x1e96df[_0x94f0('0x35')]=qs[_0x94f0('0x35')](_0x211d15['query']['limit']);_0x1e96df['offset']=qs[_0x94f0('0x1d')](_0x211d15[_0x94f0('0x2e')][_0x94f0('0x1d')]);}_0x1e96df['order']=qs[_0x94f0('0x36')](_0x211d15[_0x94f0('0x2e')][_0x94f0('0x36')]);_0x1e96df['where']=qs['filters'](_[_0x94f0('0x37')](_0x211d15[_0x94f0('0x2e')],_0x17f4c2[_0x94f0('0x38')]),_0x386ae1);if(_0x211d15[_0x94f0('0x2e')][_0x94f0('0x39')]){_0x1e96df[_0x94f0('0x3a')]=_[_0x94f0('0x3b')](_0x1e96df['where'],{'$or':_[_0x94f0('0x2d')](_0x386ae1,function(_0x1bfbaf){if(_0x1bfbaf[_0x94f0('0x3c')]!==_0x94f0('0x3d')){var _0x4faf66={};_0x4faf66[_0x1bfbaf['name']]={'$like':'%'+_0x211d15[_0x94f0('0x2e')][_0x94f0('0x39')]+'%'};return _0x4faf66;}})});}_0x1e96df=_[_0x94f0('0x3b')]({},_0x1e96df,_0x211d15[_0x94f0('0x3e')]);var _0x3b2125={'where':_0x1e96df[_0x94f0('0x3a')]};return db[_0x94f0('0x29')][_0x94f0('0x1c')](_0x3b2125)[_0x94f0('0x22')](function(_0x5c97dc){_0x40225e[_0x94f0('0x1c')]=_0x5c97dc;if(_0x211d15[_0x94f0('0x2e')][_0x94f0('0x3f')]){_0x1e96df[_0x94f0('0x40')]=[{'all':!![]}];}return db[_0x94f0('0x29')][_0x94f0('0x41')](_0x1e96df);})[_0x94f0('0x22')](function(_0xd82300){_0x40225e['rows']=_0xd82300;return _0x40225e;})['then'](respondWithFilteredResult(_0x1bbd3e,_0x1e96df))[_0x94f0('0x42')](handleError(_0x1bbd3e,null));};exports['show']=function(_0x519126,_0x4e2f12){var _0x5bb57c={'raw':![],'where':{'id':_0x519126[_0x94f0('0x43')]['id']}},_0x90bfbe={};_0x90bfbe['model']=_['keys'](db[_0x94f0('0x29')]['rawAttributes']);_0x90bfbe[_0x94f0('0x2e')]=_[_0x94f0('0x2f')](_0x519126['query']);_0x90bfbe['filters']=_['intersection'](_0x90bfbe[_0x94f0('0x32')],_0x90bfbe[_0x94f0('0x2e')]);_0x5bb57c[_0x94f0('0x30')]=_['intersection'](_0x90bfbe[_0x94f0('0x32')],qs[_0x94f0('0x33')](_0x519126[_0x94f0('0x2e')]['fields']));_0x5bb57c[_0x94f0('0x30')]=_0x5bb57c[_0x94f0('0x30')][_0x94f0('0x44')]?_0x5bb57c[_0x94f0('0x30')]:_0x90bfbe[_0x94f0('0x32')];if(_0x519126[_0x94f0('0x2e')][_0x94f0('0x3f')]){_0x5bb57c[_0x94f0('0x40')]=[{'all':!![]}];}_0x5bb57c=_['merge']({},_0x5bb57c,_0x519126[_0x94f0('0x3e')]);return db[_0x94f0('0x29')][_0x94f0('0x45')](_0x5bb57c)[_0x94f0('0x22')](handleEntityNotFound(_0x4e2f12,null))[_0x94f0('0x22')](respondWithResult(_0x4e2f12,null))[_0x94f0('0x42')](handleError(_0x4e2f12,null));};exports[_0x94f0('0x46')]=function(_0x51ddab,_0x105d8d){return db[_0x94f0('0x29')][_0x94f0('0x46')](_0x51ddab[_0x94f0('0x47')],{})['then'](respondWithResult(_0x105d8d,0xc9))[_0x94f0('0x42')](handleError(_0x105d8d,null));};exports[_0x94f0('0x21')]=function(_0x1d8c55,_0x4560a0){if(_0x1d8c55[_0x94f0('0x47')]['id']){delete _0x1d8c55[_0x94f0('0x47')]['id'];}return db[_0x94f0('0x29')][_0x94f0('0x45')]({'where':{'id':_0x1d8c55['params']['id']}})[_0x94f0('0x22')](handleEntityNotFound(_0x4560a0,null))[_0x94f0('0x22')](saveUpdates(_0x1d8c55[_0x94f0('0x47')],null))['then'](respondWithResult(_0x4560a0,null))[_0x94f0('0x42')](handleError(_0x4560a0,null));};exports[_0x94f0('0x23')]=function(_0x365bbd,_0x323007){return db[_0x94f0('0x29')][_0x94f0('0x45')]({'where':{'id':_0x365bbd[_0x94f0('0x43')]['id']}})[_0x94f0('0x22')](handleEntityNotFound(_0x323007,null))['then'](removeEntity(_0x323007,null))[_0x94f0('0x42')](handleError(_0x323007,null));};exports['describe']=function(_0x381935,_0x219ee6){return db['IntegrationReport'][_0x94f0('0x48')]()[_0x94f0('0x22')](respondWithResult(_0x219ee6,null))[_0x94f0('0x42')](handleError(_0x219ee6,null));}; \ No newline at end of file +var _0x7af4=['then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','find','describe','eml-format','fast-json-patch','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update'];(function(_0x234889,_0xfdad61){var _0x1e07ba=function(_0x51d7d3){while(--_0x51d7d3){_0x234889['push'](_0x234889['shift']());}};_0x1e07ba(++_0xfdad61);}(_0x7af4,0x14e));var _0x47af=function(_0x4fb9ed,_0x187ea0){_0x4fb9ed=_0x4fb9ed-0x0;var _0x263645=_0x7af4[_0x4fb9ed];return _0x263645;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x47af('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x47af('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x47af('0x2'));var util=require('util');var path=require(_0x47af('0x3'));var sox=require(_0x47af('0x4'));var csv=require('to-csv');var ejs=require(_0x47af('0x5'));var fs=require('fs');var _=require(_0x47af('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x47af('0x7'));var deskjs=require(_0x47af('0x8'));var toCsv=require(_0x47af('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47af('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x47af('0xb'));var as=require(_0x47af('0xc'));var hardwareService=require(_0x47af('0xd'));var logger=require(_0x47af('0xe'))('api');var utils=require(_0x47af('0xf'));var config=require(_0x47af('0x10'));var licenseUtil=require(_0x47af('0x11'));var db=require(_0x47af('0x12'))['db'];function respondWithStatusCode(_0x16be03,_0x22ccf7){_0x22ccf7=_0x22ccf7||0xcc;return function(_0x3e38f2){if(_0x3e38f2){return _0x16be03[_0x47af('0x13')](_0x22ccf7);}return _0x16be03[_0x47af('0x14')](_0x22ccf7)[_0x47af('0x15')]();};}function respondWithResult(_0x108f47,_0x5241f8){_0x5241f8=_0x5241f8||0xc8;return function(_0xf4a217){if(_0xf4a217){return _0x108f47[_0x47af('0x14')](_0x5241f8)[_0x47af('0x16')](_0xf4a217);}};}function respondWithFilteredResult(_0x3eb799,_0x44639f){return function(_0x147604){if(_0x147604){var _0x586b07=_0x147604[_0x47af('0x17')],_0x1ff738=_0x44639f[_0x47af('0x18')],_0x546d77=_0x44639f['offset']+_0x44639f[_0x47af('0x19')],_0x89830f;if(_0x546d77>=_0x586b07){_0x546d77=_0x586b07;_0x89830f=0xc8;}else{_0x89830f=0xce;}_0x3eb799['status'](_0x89830f);return _0x3eb799[_0x47af('0x1a')]('Content-Range',_0x1ff738+'-'+_0x546d77+'/'+_0x586b07)[_0x47af('0x16')](_0x147604);}return null;};}function patchUpdates(_0x3e8ce1){return function(_0x36ca11){try{jsonpatch[_0x47af('0x1b')](_0x36ca11,_0x3e8ce1,!![]);}catch(_0x28a49f){return BPromise[_0x47af('0x1c')](_0x28a49f);}return _0x36ca11[_0x47af('0x1d')]();};}function saveUpdates(_0x14bc8a,_0x96470){return function(_0x1f44a1){if(_0x1f44a1){return _0x1f44a1[_0x47af('0x1e')](_0x14bc8a)[_0x47af('0x1f')](function(_0x4de9b3){return _0x4de9b3;});}return null;};}function removeEntity(_0x36378c,_0x376934){return function(_0x1c91b3){if(_0x1c91b3){return _0x1c91b3[_0x47af('0x20')]()[_0x47af('0x1f')](function(){_0x36378c['status'](0xcc)[_0x47af('0x15')]();});}};}function handleEntityNotFound(_0x1f7aab,_0x1aee97){return function(_0x498e09){if(!_0x498e09){_0x1f7aab[_0x47af('0x13')](0x194);}return _0x498e09;};}function handleError(_0x1652c6,_0x3b2688){_0x3b2688=_0x3b2688||0x1f4;return function(_0x16c81f){logger[_0x47af('0x21')](_0x16c81f[_0x47af('0x22')]);if(_0x16c81f['name']){delete _0x16c81f[_0x47af('0x23')];}_0x1652c6[_0x47af('0x14')](_0x3b2688)[_0x47af('0x24')](_0x16c81f);};}exports[_0x47af('0x25')]=function(_0x5bb86d,_0x271b50){var _0x3ad8e0={},_0x10948c={},_0x1f9d10={'count':0x0,'rows':[]};var _0x556d5a=_[_0x47af('0x26')](db[_0x47af('0x27')][_0x47af('0x28')],function(_0xa5c09b){return{'name':_0xa5c09b[_0x47af('0x29')],'type':_0xa5c09b[_0x47af('0x2a')][_0x47af('0x2b')]};});_0x10948c[_0x47af('0x2c')]=_[_0x47af('0x26')](_0x556d5a,_0x47af('0x23'));_0x10948c[_0x47af('0x2d')]=_['keys'](_0x5bb86d[_0x47af('0x2d')]);_0x10948c[_0x47af('0x2e')]=_[_0x47af('0x2f')](_0x10948c['model'],_0x10948c['query']);_0x3ad8e0[_0x47af('0x30')]=_['intersection'](_0x10948c['model'],qs['fields'](_0x5bb86d[_0x47af('0x2d')]['fields']));_0x3ad8e0['attributes']=_0x3ad8e0[_0x47af('0x30')][_0x47af('0x31')]?_0x3ad8e0['attributes']:_0x10948c[_0x47af('0x2c')];if(!_0x5bb86d['query'][_0x47af('0x32')](_0x47af('0x33'))){_0x3ad8e0[_0x47af('0x19')]=qs['limit'](_0x5bb86d[_0x47af('0x2d')][_0x47af('0x19')]);_0x3ad8e0[_0x47af('0x18')]=qs['offset'](_0x5bb86d[_0x47af('0x2d')]['offset']);}_0x3ad8e0[_0x47af('0x34')]=qs[_0x47af('0x35')](_0x5bb86d[_0x47af('0x2d')][_0x47af('0x35')]);_0x3ad8e0[_0x47af('0x36')]=qs['filters'](_[_0x47af('0x37')](_0x5bb86d[_0x47af('0x2d')],_0x10948c[_0x47af('0x2e')]),_0x556d5a);if(_0x5bb86d[_0x47af('0x2d')][_0x47af('0x38')]){_0x3ad8e0[_0x47af('0x36')]=_[_0x47af('0x39')](_0x3ad8e0[_0x47af('0x36')],{'$or':_[_0x47af('0x26')](_0x556d5a,function(_0x13efdf){if(_0x13efdf[_0x47af('0x2a')]!==_0x47af('0x3a')){var _0x2c4e51={};_0x2c4e51[_0x13efdf[_0x47af('0x23')]]={'$like':'%'+_0x5bb86d['query'][_0x47af('0x38')]+'%'};return _0x2c4e51;}})});}_0x3ad8e0=_[_0x47af('0x39')]({},_0x3ad8e0,_0x5bb86d[_0x47af('0x3b')]);var _0xb9944d={'where':_0x3ad8e0[_0x47af('0x36')]};return db[_0x47af('0x27')][_0x47af('0x17')](_0xb9944d)[_0x47af('0x1f')](function(_0x2269f9){_0x1f9d10[_0x47af('0x17')]=_0x2269f9;if(_0x5bb86d[_0x47af('0x2d')][_0x47af('0x3c')]){_0x3ad8e0[_0x47af('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0x47af('0x3e')](_0x3ad8e0);})[_0x47af('0x1f')](function(_0x35ed76){_0x1f9d10[_0x47af('0x3f')]=_0x35ed76;return _0x1f9d10;})[_0x47af('0x1f')](respondWithFilteredResult(_0x271b50,_0x3ad8e0))[_0x47af('0x40')](handleError(_0x271b50,null));};exports[_0x47af('0x41')]=function(_0x59aa2d,_0x56f84b){var _0x32765d={'raw':![],'where':{'id':_0x59aa2d[_0x47af('0x42')]['id']}},_0x418811={};_0x418811[_0x47af('0x2c')]=_[_0x47af('0x43')](db['IntegrationReport'][_0x47af('0x28')]);_0x418811[_0x47af('0x2d')]=_['keys'](_0x59aa2d[_0x47af('0x2d')]);_0x418811[_0x47af('0x2e')]=_[_0x47af('0x2f')](_0x418811[_0x47af('0x2c')],_0x418811[_0x47af('0x2d')]);_0x32765d[_0x47af('0x30')]=_[_0x47af('0x2f')](_0x418811[_0x47af('0x2c')],qs[_0x47af('0x44')](_0x59aa2d[_0x47af('0x2d')][_0x47af('0x44')]));_0x32765d[_0x47af('0x30')]=_0x32765d['attributes'][_0x47af('0x31')]?_0x32765d[_0x47af('0x30')]:_0x418811[_0x47af('0x2c')];if(_0x59aa2d[_0x47af('0x2d')][_0x47af('0x3c')]){_0x32765d[_0x47af('0x3d')]=[{'all':!![]}];}_0x32765d=_[_0x47af('0x39')]({},_0x32765d,_0x59aa2d[_0x47af('0x3b')]);return db['IntegrationReport']['find'](_0x32765d)[_0x47af('0x1f')](handleEntityNotFound(_0x56f84b,null))['then'](respondWithResult(_0x56f84b,null))[_0x47af('0x40')](handleError(_0x56f84b,null));};exports[_0x47af('0x45')]=function(_0x4302f3,_0x76f41c){return db[_0x47af('0x27')]['create'](_0x4302f3[_0x47af('0x46')],{})[_0x47af('0x1f')](respondWithResult(_0x76f41c,0xc9))[_0x47af('0x40')](handleError(_0x76f41c,null));};exports['update']=function(_0x10030e,_0x543dcb){if(_0x10030e['body']['id']){delete _0x10030e['body']['id'];}return db[_0x47af('0x27')][_0x47af('0x47')]({'where':{'id':_0x10030e['params']['id']}})[_0x47af('0x1f')](handleEntityNotFound(_0x543dcb,null))['then'](saveUpdates(_0x10030e[_0x47af('0x46')],null))[_0x47af('0x1f')](respondWithResult(_0x543dcb,null))[_0x47af('0x40')](handleError(_0x543dcb,null));};exports[_0x47af('0x20')]=function(_0x5a69a5,_0x3969f0){return db['IntegrationReport']['find']({'where':{'id':_0x5a69a5[_0x47af('0x42')]['id']}})[_0x47af('0x1f')](handleEntityNotFound(_0x3969f0,null))[_0x47af('0x1f')](removeEntity(_0x3969f0,null))[_0x47af('0x40')](handleError(_0x3969f0,null));};exports[_0x47af('0x48')]=function(_0xae26b6,_0x22ca7e){return db[_0x47af('0x27')]['describe']()['then'](respondWithResult(_0x22ca7e,null))[_0x47af('0x40')](handleError(_0x22ca7e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 810ee02..aa6770d 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 _0x4710=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x1957bd,_0x49c1c6){var _0x8c3290=function(_0xb40134){while(--_0xb40134){_0x1957bd['push'](_0x1957bd['shift']());}};_0x8c3290(++_0x49c1c6);}(_0x4710,0x139));var _0x0471=function(_0x430121,_0xd99aa9){_0x430121=_0x430121-0x0;var _0x37fc1a=_0x4710[_0x430121];return _0x37fc1a;};'use strict';var _=require(_0x0471('0x0'));var util=require(_0x0471('0x1'));var logger=require(_0x0471('0x2'))(_0x0471('0x3'));var moment=require(_0x0471('0x4'));var BPromise=require(_0x0471('0x5'));var rp=require(_0x0471('0x6'));var fs=require('fs');var path=require(_0x0471('0x7'));var rimraf=require(_0x0471('0x8'));var config=require(_0x0471('0x9'));var attributes=require(_0x0471('0xa'));module[_0x0471('0xb')]=function(_0x1d0d24,_0x23cb8e){return _0x1d0d24[_0x0471('0xc')](_0x0471('0xd'),attributes,{'tableName':_0x0471('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4399=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','report_integration'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x4399,0x1d9));var _0x9439=function(_0xe9bba5,_0x39f7ec){_0xe9bba5=_0xe9bba5-0x0;var _0x200478=_0x4399[_0xe9bba5];return _0x200478;};'use strict';var _=require(_0x9439('0x0'));var util=require(_0x9439('0x1'));var logger=require(_0x9439('0x2'))(_0x9439('0x3'));var moment=require(_0x9439('0x4'));var BPromise=require('bluebird');var rp=require(_0x9439('0x5'));var fs=require('fs');var path=require(_0x9439('0x6'));var rimraf=require(_0x9439('0x7'));var config=require(_0x9439('0x8'));var attributes=require('./integrationReport.attributes');module[_0x9439('0x9')]=function(_0x2210c0,_0x4e1bfc){return _0x2210c0['define']('IntegrationReport',attributes,{'tableName':_0x9439('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index bd69fe7..cf5290f 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 _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4ab147,_0x56f30a){var _0x5147eb=function(_0x5cd7d9){while(--_0x5cd7d9){_0x4ab147['push'](_0x4ab147['shift']());}};_0x5147eb(++_0x56f30a);}(_0x757a,0xde));var _0xa757=function(_0x13c578,_0x52d53f){_0x13c578=_0x13c578-0x0;var _0xd5f244=_0x757a[_0x13c578];return _0xd5f244;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file +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(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 8cb2efe..afcc2d8 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x89b27,_0x407786){var _0x4d01cc=function(_0x5e4c24){while(--_0x5e4c24){_0x89b27['push'](_0x89b27['shift']());}};_0x4d01cc(++_0x407786);}(_0x008c,0x188));var _0xc008=function(_0x21ab42,_0x8ab09a){_0x21ab42=_0x21ab42-0x0;var _0x4f6351=_0x008c[_0x21ab42];return _0x4f6351;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index dd14b19..35683fb 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 _0xab70=['exports','STRING'];(function(_0x47deea,_0x1596aa){var _0x5c674c=function(_0x151204){while(--_0x151204){_0x47deea['push'](_0x47deea['shift']());}};_0x5c674c(++_0x1596aa);}(_0xab70,0xc4));var _0x0ab7=function(_0x2477fe,_0x5b44db){_0x2477fe=_0x2477fe-0x0;var _0x322cd1=_0xab70[_0x2477fe];return _0x322cd1;};'use strict';var Sequelize=require('sequelize');module[_0x0ab7('0x0')]={'name':{'type':Sequelize[_0x0ab7('0x1')]},'description':{'type':Sequelize[_0x0ab7('0x1')]},'interval':{'type':Sequelize[_0x0ab7('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xa26c=['STRING','sequelize'];(function(_0x927964,_0x1a437c){var _0x125c26=function(_0x57704f){while(--_0x57704f){_0x927964['push'](_0x927964['shift']());}};_0x125c26(++_0x1a437c);}(_0xa26c,0x93));var _0xca26=function(_0x4082c7,_0x383e54){_0x4082c7=_0x4082c7-0x0;var _0x196a2c=_0xa26c[_0x4082c7];return _0x196a2c;};'use strict';var Sequelize=require(_0xca26('0x0'));module['exports']={'name':{'type':Sequelize[_0xca26('0x1')]},'description':{'type':Sequelize[_0xca26('0x1')]},'interval':{'type':Sequelize[_0xca26('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index e185251..1f8882e 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 _0x3ebc=['name','send','index','Interval','rawAttributes','type','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','findAll','catch','show','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','order','pick','addIntervals','findOne','sequelize','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ebc,0x85));var _0xc3eb=function(_0x1056e7,_0x12296f){_0x1056e7=_0x1056e7-0x0;var _0x55b3c2=_0x3ebc[_0x1056e7];return _0x55b3c2;};'use strict';var pdf=require(_0xc3eb('0x0'));var emlformat=require(_0xc3eb('0x1'));var rimraf=require(_0xc3eb('0x2'));var zipdir=require(_0xc3eb('0x3'));var jsonpatch=require(_0xc3eb('0x4'));var rp=require(_0xc3eb('0x5'));var moment=require(_0xc3eb('0x6'));var BPromise=require(_0xc3eb('0x7'));var Mustache=require(_0xc3eb('0x8'));var util=require(_0xc3eb('0x9'));var path=require(_0xc3eb('0xa'));var sox=require('sox');var csv=require(_0xc3eb('0xb'));var ejs=require(_0xc3eb('0xc'));var fs=require('fs');var _=require(_0xc3eb('0xd'));var squel=require('squel');var crypto=require(_0xc3eb('0xe'));var jsforce=require(_0xc3eb('0xf'));var deskjs=require(_0xc3eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc3eb('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc3eb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3eb('0x13'));var logger=require('../../config/logger')(_0xc3eb('0x14'));var utils=require(_0xc3eb('0x15'));var config=require(_0xc3eb('0x16'));var licenseUtil=require(_0xc3eb('0x17'));var db=require(_0xc3eb('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x42a029,_0x36027c){_0x36027c=_0x36027c||0xcc;return function(_0x1d1a50){if(_0x1d1a50){return _0x42a029[_0xc3eb('0x19')](_0x36027c);}return _0x42a029[_0xc3eb('0x1a')](_0x36027c)[_0xc3eb('0x1b')]();};}function respondWithResult(_0x49f07d,_0x5de5d2){_0x5de5d2=_0x5de5d2||0xc8;return function(_0x1fcea9){if(_0x1fcea9){return _0x49f07d[_0xc3eb('0x1a')](_0x5de5d2)[_0xc3eb('0x1c')](_0x1fcea9);}};}function respondWithFilteredResult(_0x3c17ab,_0x4e6199){return function(_0x5b5ebc){if(_0x5b5ebc){var _0x5ac71c=_0x5b5ebc[_0xc3eb('0x1d')],_0x36f499=_0x4e6199[_0xc3eb('0x1e')],_0x590033=_0x4e6199[_0xc3eb('0x1e')]+_0x4e6199[_0xc3eb('0x1f')],_0x4cbc1e;if(_0x590033>=_0x5ac71c){_0x590033=_0x5ac71c;_0x4cbc1e=0xc8;}else{_0x4cbc1e=0xce;}_0x3c17ab[_0xc3eb('0x1a')](_0x4cbc1e);return _0x3c17ab['set']('Content-Range',_0x36f499+'-'+_0x590033+'/'+_0x5ac71c)['json'](_0x5b5ebc);}return null;};}function patchUpdates(_0x53192a){return function(_0x10ce2e){try{jsonpatch[_0xc3eb('0x20')](_0x10ce2e,_0x53192a,!![]);}catch(_0x31a130){return BPromise[_0xc3eb('0x21')](_0x31a130);}return _0x10ce2e[_0xc3eb('0x22')]();};}function saveUpdates(_0x3de0f9,_0x131bd4){return function(_0x561e3e){if(_0x561e3e){return _0x561e3e[_0xc3eb('0x23')](_0x3de0f9)[_0xc3eb('0x24')](function(_0x298382){return _0x298382;});}return null;};}function removeEntity(_0x341b6a,_0x3185bd){return function(_0x430946){if(_0x430946){return _0x430946[_0xc3eb('0x25')]()[_0xc3eb('0x24')](function(){var _0x5f0acd=_0x430946[_0xc3eb('0x26')]({'plain':!![]});var _0x250ea7=_0xc3eb('0x27');return db[_0xc3eb('0x28')][_0xc3eb('0x25')]({'where':{'type':_0x250ea7,'resourceId':_0x5f0acd['id']}})[_0xc3eb('0x24')](function(){return _0x430946;});})['then'](function(){_0x341b6a[_0xc3eb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x995c6f,_0xa452c6){return function(_0x25c2c9){if(!_0x25c2c9){_0x995c6f[_0xc3eb('0x19')](0x194);}return _0x25c2c9;};}function handleError(_0x5e9e11,_0x23bd98){_0x23bd98=_0x23bd98||0x1f4;return function(_0x4a6cdd){logger[_0xc3eb('0x29')](_0x4a6cdd[_0xc3eb('0x2a')]);if(_0x4a6cdd[_0xc3eb('0x2b')]){delete _0x4a6cdd[_0xc3eb('0x2b')];}_0x5e9e11['status'](_0x23bd98)[_0xc3eb('0x2c')](_0x4a6cdd);};}exports[_0xc3eb('0x2d')]=function(_0x5b096e,_0x32e0c6){var _0x25f603={},_0xffbe2b={},_0x4e82d2={'count':0x0,'rows':[]};var _0x1df5ac=_['map'](db[_0xc3eb('0x2e')][_0xc3eb('0x2f')],function(_0x23dce5){return{'name':_0x23dce5['fieldName'],'type':_0x23dce5[_0xc3eb('0x30')]['key']};});_0xffbe2b[_0xc3eb('0x31')]=_[_0xc3eb('0x32')](_0x1df5ac,_0xc3eb('0x2b'));_0xffbe2b['query']=_[_0xc3eb('0x33')](_0x5b096e[_0xc3eb('0x34')]);_0xffbe2b[_0xc3eb('0x35')]=_['intersection'](_0xffbe2b['model'],_0xffbe2b[_0xc3eb('0x34')]);_0x25f603[_0xc3eb('0x36')]=_['intersection'](_0xffbe2b[_0xc3eb('0x31')],qs['fields'](_0x5b096e[_0xc3eb('0x34')][_0xc3eb('0x37')]));_0x25f603['attributes']=_0x25f603[_0xc3eb('0x36')][_0xc3eb('0x38')]?_0x25f603['attributes']:_0xffbe2b['model'];if(!_0x5b096e[_0xc3eb('0x34')][_0xc3eb('0x39')](_0xc3eb('0x3a'))){_0x25f603['limit']=qs[_0xc3eb('0x1f')](_0x5b096e[_0xc3eb('0x34')][_0xc3eb('0x1f')]);_0x25f603[_0xc3eb('0x1e')]=qs[_0xc3eb('0x1e')](_0x5b096e[_0xc3eb('0x34')][_0xc3eb('0x1e')]);}_0x25f603['order']=qs[_0xc3eb('0x3b')](_0x5b096e[_0xc3eb('0x34')][_0xc3eb('0x3b')]);_0x25f603['where']=qs[_0xc3eb('0x35')](_['pick'](_0x5b096e[_0xc3eb('0x34')],_0xffbe2b['filters']),_0x1df5ac);if(_0x5b096e[_0xc3eb('0x34')][_0xc3eb('0x3c')]){_0x25f603['where']=_[_0xc3eb('0x3d')](_0x25f603[_0xc3eb('0x3e')],{'$or':_[_0xc3eb('0x32')](_0x1df5ac,function(_0x350fe0){if(_0x350fe0[_0xc3eb('0x30')]!==_0xc3eb('0x3f')){var _0x42e3fe={};_0x42e3fe[_0x350fe0[_0xc3eb('0x2b')]]={'$like':'%'+_0x5b096e['query'][_0xc3eb('0x3c')]+'%'};return _0x42e3fe;}})});}_0x25f603=_[_0xc3eb('0x3d')]({},_0x25f603,_0x5b096e[_0xc3eb('0x40')]);var _0x12a814={'where':_0x25f603['where']};return db[_0xc3eb('0x2e')][_0xc3eb('0x1d')](_0x12a814)[_0xc3eb('0x24')](function(_0x1bc9e2){_0x4e82d2[_0xc3eb('0x1d')]=_0x1bc9e2;if(_0x5b096e[_0xc3eb('0x34')]['includeAll']){_0x25f603['include']=[{'all':!![]}];}return db[_0xc3eb('0x2e')][_0xc3eb('0x41')](_0x25f603);})[_0xc3eb('0x24')](function(_0x5cc120){_0x4e82d2['rows']=_0x5cc120;return _0x4e82d2;})['then'](respondWithFilteredResult(_0x32e0c6,_0x25f603))[_0xc3eb('0x42')](handleError(_0x32e0c6,null));};exports[_0xc3eb('0x43')]=function(_0x122be6,_0x46899f){var _0x1a126c={'raw':!![],'where':{'id':_0x122be6['params']['id']}},_0x1c310b={};_0x1c310b[_0xc3eb('0x31')]=_[_0xc3eb('0x33')](db[_0xc3eb('0x2e')][_0xc3eb('0x2f')]);_0x1c310b[_0xc3eb('0x34')]=_[_0xc3eb('0x33')](_0x122be6[_0xc3eb('0x34')]);_0x1c310b['filters']=_['intersection'](_0x1c310b[_0xc3eb('0x31')],_0x1c310b[_0xc3eb('0x34')]);_0x1a126c[_0xc3eb('0x36')]=_[_0xc3eb('0x44')](_0x1c310b['model'],qs[_0xc3eb('0x37')](_0x122be6[_0xc3eb('0x34')][_0xc3eb('0x37')]));_0x1a126c['attributes']=_0x1a126c[_0xc3eb('0x36')]['length']?_0x1a126c[_0xc3eb('0x36')]:_0x1c310b[_0xc3eb('0x31')];if(_0x122be6[_0xc3eb('0x34')][_0xc3eb('0x45')]){_0x1a126c['include']=[{'all':!![]}];}_0x1a126c=_['merge']({},_0x1a126c,_0x122be6[_0xc3eb('0x40')]);return db[_0xc3eb('0x2e')][_0xc3eb('0x46')](_0x1a126c)['then'](handleEntityNotFound(_0x46899f,null))[_0xc3eb('0x24')](respondWithResult(_0x46899f,null))['catch'](handleError(_0x46899f,null));};exports[_0xc3eb('0x47')]=function(_0x12026d,_0x106785){return db[_0xc3eb('0x2e')][_0xc3eb('0x47')](_0x12026d[_0xc3eb('0x48')],{})[_0xc3eb('0x24')](function(_0x3f2d13){var _0x5667f8=_0x12026d[_0xc3eb('0x49')][_0xc3eb('0x26')]({'plain':!![]});if(!_0x5667f8)throw new Error(_0xc3eb('0x4a'));if(_0x5667f8[_0xc3eb('0x4b')]===_0xc3eb('0x49')){var _0x1785f9=_0x3f2d13[_0xc3eb('0x26')]({'plain':!![]});var _0x142019='Intervals';return db[_0xc3eb('0x4c')][_0xc3eb('0x46')]({'where':{'name':_0x142019,'userProfileId':_0x5667f8['userProfileId']},'raw':!![]})[_0xc3eb('0x24')](function(_0x1187fa){if(_0x1187fa&&_0x1187fa[_0xc3eb('0x4d')]===0x0){return db[_0xc3eb('0x28')][_0xc3eb('0x47')]({'name':_0x1785f9[_0xc3eb('0x2b')],'resourceId':_0x1785f9['id'],'type':_0x1187fa[_0xc3eb('0x2b')],'sectionId':_0x1187fa['id']},{})['then'](function(){return _0x3f2d13;});}else{return _0x3f2d13;}})['catch'](function(_0x540cc1){logger[_0xc3eb('0x29')](_0xc3eb('0x4e'),_0x540cc1);throw _0x540cc1;});}return _0x3f2d13;})['then'](respondWithResult(_0x106785,0xc9))[_0xc3eb('0x42')](handleError(_0x106785,null));};exports[_0xc3eb('0x23')]=function(_0x16c356,_0x5be624){if(_0x16c356[_0xc3eb('0x48')]['id']){delete _0x16c356[_0xc3eb('0x48')]['id'];}return db[_0xc3eb('0x2e')][_0xc3eb('0x46')]({'where':{'id':_0x16c356['params']['id']}})[_0xc3eb('0x24')](handleEntityNotFound(_0x5be624,null))[_0xc3eb('0x24')](saveUpdates(_0x16c356['body'],null))[_0xc3eb('0x24')](respondWithResult(_0x5be624,null))[_0xc3eb('0x42')](handleError(_0x5be624,null));};exports[_0xc3eb('0x25')]=function(_0x3daa31,_0x3d63ce){return db[_0xc3eb('0x2e')][_0xc3eb('0x46')]({'where':{'id':_0x3daa31[_0xc3eb('0x4f')]['id']}})[_0xc3eb('0x24')](handleEntityNotFound(_0x3d63ce,null))[_0xc3eb('0x24')](removeEntity(_0x3d63ce,null))['catch'](handleError(_0x3d63ce,null));};exports['addInterval']=function(_0x47ef5b,_0x38964a,_0xc4c0c2){if(_0x47ef5b[_0xc3eb('0x48')]['id']){delete _0x47ef5b['body']['id'];}return db['Interval'][_0xc3eb('0x46')]({'where':{'id':_0x47ef5b[_0xc3eb('0x4f')]['id']}})[_0xc3eb('0x24')](handleEntityNotFound(_0x38964a,null))['then'](function(_0x1a50b5){if(_0x1a50b5){_0x47ef5b['body'][_0xc3eb('0x50')]=_0x1a50b5['id'];return db[_0xc3eb('0x2e')][_0xc3eb('0x47')](_0x47ef5b[_0xc3eb('0x48')]);}})[_0xc3eb('0x24')](respondWithResult(_0x38964a,null))[_0xc3eb('0x42')](handleError(_0x38964a,null));};exports[_0xc3eb('0x51')]=function(_0x155ea8,_0x238cda,_0x4615ca){var _0x4f78df={};var _0x128ba2={};var _0x5e6103;var _0x2957ff;return db['Interval']['findOne']({'where':{'id':_0x155ea8[_0xc3eb('0x4f')]['id']}})[_0xc3eb('0x24')](handleEntityNotFound(_0x238cda,null))[_0xc3eb('0x24')](function(_0x47b826){if(_0x47b826){_0x5e6103=_0x47b826;_0x128ba2[_0xc3eb('0x31')]=_[_0xc3eb('0x33')](db[_0xc3eb('0x2e')][_0xc3eb('0x2f')]);_0x128ba2[_0xc3eb('0x34')]=_[_0xc3eb('0x33')](_0x155ea8[_0xc3eb('0x34')]);_0x128ba2[_0xc3eb('0x35')]=_[_0xc3eb('0x44')](_0x128ba2['model'],_0x128ba2[_0xc3eb('0x34')]);_0x4f78df[_0xc3eb('0x36')]=_['intersection'](_0x128ba2[_0xc3eb('0x31')],qs[_0xc3eb('0x37')](_0x155ea8[_0xc3eb('0x34')][_0xc3eb('0x37')]));_0x4f78df[_0xc3eb('0x36')]=_0x4f78df[_0xc3eb('0x36')][_0xc3eb('0x38')]?_0x4f78df['attributes']:_0x128ba2[_0xc3eb('0x31')];_0x4f78df[_0xc3eb('0x52')]=qs['sort'](_0x155ea8[_0xc3eb('0x34')][_0xc3eb('0x3b')]);_0x4f78df[_0xc3eb('0x3e')]=qs['filters'](_[_0xc3eb('0x53')](_0x155ea8[_0xc3eb('0x34')],_0x128ba2[_0xc3eb('0x35')]));if(_0x155ea8[_0xc3eb('0x34')][_0xc3eb('0x3c')]){_0x4f78df[_0xc3eb('0x3e')]=_[_0xc3eb('0x3d')](_0x4f78df[_0xc3eb('0x3e')],{'$or':_[_0xc3eb('0x32')](_0x4f78df[_0xc3eb('0x36')],function(_0xcc191){var _0x5504e8={};_0x5504e8[_0xcc191]={'$like':'%'+_0x155ea8[_0xc3eb('0x34')][_0xc3eb('0x3c')]+'%'};return _0x5504e8;})});}_0x4f78df=_[_0xc3eb('0x3d')]({},_0x4f78df,_0x155ea8[_0xc3eb('0x40')]);return _0x5e6103['getIntervals'](_0x4f78df);}})[_0xc3eb('0x24')](function(_0x538178){if(_0x538178){_0x2957ff=_0x538178[_0xc3eb('0x38')];if(!_0x155ea8['query'][_0xc3eb('0x39')]('nolimit')){_0x4f78df[_0xc3eb('0x1f')]=qs[_0xc3eb('0x1f')](_0x155ea8[_0xc3eb('0x34')][_0xc3eb('0x1f')]);_0x4f78df[_0xc3eb('0x1e')]=qs[_0xc3eb('0x1e')](_0x155ea8['query'][_0xc3eb('0x1e')]);}return _0x5e6103[_0xc3eb('0x51')](_0x4f78df);}})['then'](function(_0xedae6d){if(_0xedae6d){return _0xedae6d?{'count':_0x2957ff,'rows':_0xedae6d}:null;}})[_0xc3eb('0x24')](respondWithResult(_0x238cda,null))[_0xc3eb('0x42')](handleError(_0x238cda,null));};exports[_0xc3eb('0x54')]=function(_0x4d87f7,_0x5b61ec,_0x52c27f){return db[_0xc3eb('0x2e')][_0xc3eb('0x55')]({'where':{'id':_0x4d87f7[_0xc3eb('0x4f')]['id']}})[_0xc3eb('0x24')](handleEntityNotFound(_0x5b61ec,null))[_0xc3eb('0x24')](function(_0xd545f8){if(_0xd545f8){return db[_0xc3eb('0x56')]['transaction'](function(_0x36f7bc){return db['Interval'][_0xc3eb('0x25')]({'where':{'IntervalId':_0x4d87f7['params']['id']},'transaction':_0x36f7bc})['then'](function(_0x337802){var _0x930a8c=_[_0xc3eb('0x32')](_0x4d87f7[_0xc3eb('0x48')],function(_0x93a646){delete _0x93a646['id'];_0x93a646[_0xc3eb('0x50')]=_0x4d87f7['params']['id'];return _0x93a646;});return db[_0xc3eb('0x2e')][_0xc3eb('0x57')](_0x930a8c,{'transaction':_0x36f7bc});});})[_0xc3eb('0x24')](function(){return db['Interval'][_0xc3eb('0x41')]({'where':{'IntervalId':_0x4d87f7[_0xc3eb('0x4f')]['id']}});});}})[_0xc3eb('0x24')](respondWithResult(_0x5b61ec,null))[_0xc3eb('0x42')](handleError(_0x5b61ec,null));}; \ No newline at end of file +var _0x233d=['type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','Interval','include','findAll','rows','catch','show','rawAttributes','keys','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','findOne','sequelize','transaction','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','Intervals','stack','name','send','index','map','fieldName'];(function(_0x59bcd2,_0x33c1e0){var _0x1901bf=function(_0x1c5eb9){while(--_0x1c5eb9){_0x59bcd2['push'](_0x59bcd2['shift']());}};_0x1901bf(++_0x33c1e0);}(_0x233d,0x18f));var _0xd233=function(_0x1bd85d,_0xdc683f){_0x1bd85d=_0x1bd85d-0x0;var _0xd40669=_0x233d[_0x1bd85d];return _0xd40669;};'use strict';var pdf=require(_0xd233('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd233('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd233('0x2'));var rp=require(_0xd233('0x3'));var moment=require(_0xd233('0x4'));var BPromise=require(_0xd233('0x5'));var Mustache=require(_0xd233('0x6'));var util=require(_0xd233('0x7'));var path=require('path');var sox=require(_0xd233('0x8'));var csv=require('to-csv');var ejs=require(_0xd233('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd233('0xa'));var crypto=require(_0xd233('0xb'));var jsforce=require(_0xd233('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd233('0xd'));var Papa=require(_0xd233('0xe'));var Redis=require(_0xd233('0xf'));var authService=require(_0xd233('0x10'));var qs=require(_0xd233('0x11'));var as=require(_0xd233('0x12'));var hardwareService=require(_0xd233('0x13'));var logger=require('../../config/logger')(_0xd233('0x14'));var utils=require(_0xd233('0x15'));var config=require(_0xd233('0x16'));var licenseUtil=require(_0xd233('0x17'));var db=require(_0xd233('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x262b0d,_0xc24168){_0xc24168=_0xc24168||0xcc;return function(_0x911a5a){if(_0x911a5a){return _0x262b0d[_0xd233('0x19')](_0xc24168);}return _0x262b0d[_0xd233('0x1a')](_0xc24168)[_0xd233('0x1b')]();};}function respondWithResult(_0xce3aa6,_0x4fbd22){_0x4fbd22=_0x4fbd22||0xc8;return function(_0x124503){if(_0x124503){return _0xce3aa6['status'](_0x4fbd22)[_0xd233('0x1c')](_0x124503);}};}function respondWithFilteredResult(_0x5947a6,_0xbd3803){return function(_0x4e0580){if(_0x4e0580){var _0x3055cc=_0x4e0580[_0xd233('0x1d')],_0x5d8f0c=_0xbd3803[_0xd233('0x1e')],_0x12ab32=_0xbd3803[_0xd233('0x1e')]+_0xbd3803[_0xd233('0x1f')],_0x4c3713;if(_0x12ab32>=_0x3055cc){_0x12ab32=_0x3055cc;_0x4c3713=0xc8;}else{_0x4c3713=0xce;}_0x5947a6[_0xd233('0x1a')](_0x4c3713);return _0x5947a6[_0xd233('0x20')]('Content-Range',_0x5d8f0c+'-'+_0x12ab32+'/'+_0x3055cc)[_0xd233('0x1c')](_0x4e0580);}return null;};}function patchUpdates(_0x4a9d06){return function(_0x4156c1){try{jsonpatch[_0xd233('0x21')](_0x4156c1,_0x4a9d06,!![]);}catch(_0x4ad227){return BPromise[_0xd233('0x22')](_0x4ad227);}return _0x4156c1[_0xd233('0x23')]();};}function saveUpdates(_0x66526,_0x400a53){return function(_0x1a35e1){if(_0x1a35e1){return _0x1a35e1[_0xd233('0x24')](_0x66526)[_0xd233('0x25')](function(_0x3ec880){return _0x3ec880;});}return null;};}function removeEntity(_0xa85dc,_0x34dbc9){return function(_0x578710){if(_0x578710){return _0x578710[_0xd233('0x26')]()[_0xd233('0x25')](function(){var _0x268b1c=_0x578710['get']({'plain':!![]});var _0x3ea9f9=_0xd233('0x27');return db['UserProfileResource'][_0xd233('0x26')]({'where':{'type':_0x3ea9f9,'resourceId':_0x268b1c['id']}})[_0xd233('0x25')](function(){return _0x578710;});})['then'](function(){_0xa85dc[_0xd233('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d70c,_0x19731c){return function(_0x1ce292){if(!_0x1ce292){_0x12d70c['sendStatus'](0x194);}return _0x1ce292;};}function handleError(_0x25eb8a,_0x2b1d87){_0x2b1d87=_0x2b1d87||0x1f4;return function(_0x54231b){logger['error'](_0x54231b[_0xd233('0x28')]);if(_0x54231b[_0xd233('0x29')]){delete _0x54231b[_0xd233('0x29')];}_0x25eb8a[_0xd233('0x1a')](_0x2b1d87)[_0xd233('0x2a')](_0x54231b);};}exports[_0xd233('0x2b')]=function(_0x3cbad6,_0x173aeb){var _0x49fe82={},_0x40727={},_0x45dbc9={'count':0x0,'rows':[]};var _0x28bb49=_[_0xd233('0x2c')](db['Interval']['rawAttributes'],function(_0x3e4ff8){return{'name':_0x3e4ff8[_0xd233('0x2d')],'type':_0x3e4ff8[_0xd233('0x2e')][_0xd233('0x2f')]};});_0x40727[_0xd233('0x30')]=_['map'](_0x28bb49,'name');_0x40727['query']=_['keys'](_0x3cbad6[_0xd233('0x31')]);_0x40727[_0xd233('0x32')]=_[_0xd233('0x33')](_0x40727[_0xd233('0x30')],_0x40727[_0xd233('0x31')]);_0x49fe82[_0xd233('0x34')]=_['intersection'](_0x40727[_0xd233('0x30')],qs[_0xd233('0x35')](_0x3cbad6[_0xd233('0x31')]['fields']));_0x49fe82[_0xd233('0x34')]=_0x49fe82['attributes']['length']?_0x49fe82['attributes']:_0x40727[_0xd233('0x30')];if(!_0x3cbad6[_0xd233('0x31')][_0xd233('0x36')]('nolimit')){_0x49fe82[_0xd233('0x1f')]=qs[_0xd233('0x1f')](_0x3cbad6['query']['limit']);_0x49fe82[_0xd233('0x1e')]=qs[_0xd233('0x1e')](_0x3cbad6[_0xd233('0x31')]['offset']);}_0x49fe82[_0xd233('0x37')]=qs[_0xd233('0x38')](_0x3cbad6[_0xd233('0x31')]['sort']);_0x49fe82['where']=qs[_0xd233('0x32')](_[_0xd233('0x39')](_0x3cbad6['query'],_0x40727[_0xd233('0x32')]),_0x28bb49);if(_0x3cbad6[_0xd233('0x31')][_0xd233('0x3a')]){_0x49fe82[_0xd233('0x3b')]=_[_0xd233('0x3c')](_0x49fe82[_0xd233('0x3b')],{'$or':_['map'](_0x28bb49,function(_0x14275a){if(_0x14275a[_0xd233('0x2e')]!=='VIRTUAL'){var _0x288569={};_0x288569[_0x14275a['name']]={'$like':'%'+_0x3cbad6[_0xd233('0x31')][_0xd233('0x3a')]+'%'};return _0x288569;}})});}_0x49fe82=_['merge']({},_0x49fe82,_0x3cbad6[_0xd233('0x3d')]);var _0x212e92={'where':_0x49fe82[_0xd233('0x3b')]};return db[_0xd233('0x3e')][_0xd233('0x1d')](_0x212e92)['then'](function(_0x3b0399){_0x45dbc9[_0xd233('0x1d')]=_0x3b0399;if(_0x3cbad6[_0xd233('0x31')]['includeAll']){_0x49fe82[_0xd233('0x3f')]=[{'all':!![]}];}return db['Interval'][_0xd233('0x40')](_0x49fe82);})[_0xd233('0x25')](function(_0x336ae0){_0x45dbc9[_0xd233('0x41')]=_0x336ae0;return _0x45dbc9;})[_0xd233('0x25')](respondWithFilteredResult(_0x173aeb,_0x49fe82))[_0xd233('0x42')](handleError(_0x173aeb,null));};exports[_0xd233('0x43')]=function(_0xe6d729,_0x46e9ac){var _0x382649={'raw':!![],'where':{'id':_0xe6d729['params']['id']}},_0x74f87b={};_0x74f87b[_0xd233('0x30')]=_['keys'](db[_0xd233('0x3e')][_0xd233('0x44')]);_0x74f87b[_0xd233('0x31')]=_[_0xd233('0x45')](_0xe6d729[_0xd233('0x31')]);_0x74f87b[_0xd233('0x32')]=_[_0xd233('0x33')](_0x74f87b[_0xd233('0x30')],_0x74f87b[_0xd233('0x31')]);_0x382649[_0xd233('0x34')]=_['intersection'](_0x74f87b[_0xd233('0x30')],qs['fields'](_0xe6d729[_0xd233('0x31')][_0xd233('0x35')]));_0x382649[_0xd233('0x34')]=_0x382649['attributes'][_0xd233('0x46')]?_0x382649[_0xd233('0x34')]:_0x74f87b['model'];if(_0xe6d729[_0xd233('0x31')][_0xd233('0x47')]){_0x382649[_0xd233('0x3f')]=[{'all':!![]}];}_0x382649=_[_0xd233('0x3c')]({},_0x382649,_0xe6d729[_0xd233('0x3d')]);return db['Interval'][_0xd233('0x48')](_0x382649)[_0xd233('0x25')](handleEntityNotFound(_0x46e9ac,null))[_0xd233('0x25')](respondWithResult(_0x46e9ac,null))[_0xd233('0x42')](handleError(_0x46e9ac,null));};exports[_0xd233('0x49')]=function(_0x5ba6e1,_0x5d191f){return db[_0xd233('0x3e')][_0xd233('0x49')](_0x5ba6e1[_0xd233('0x4a')],{})['then'](function(_0x21ec96){var _0x13cf4c=_0x5ba6e1['user'][_0xd233('0x4b')]({'plain':!![]});if(!_0x13cf4c)throw new Error(_0xd233('0x4c'));if(_0x13cf4c[_0xd233('0x4d')]===_0xd233('0x4e')){var _0x171b12=_0x21ec96['get']({'plain':!![]});var _0x5b594e=_0xd233('0x27');return db['UserProfileSection'][_0xd233('0x48')]({'where':{'name':_0x5b594e,'userProfileId':_0x13cf4c[_0xd233('0x4f')]},'raw':!![]})['then'](function(_0x3baafb){if(_0x3baafb&&_0x3baafb[_0xd233('0x50')]===0x0){return db[_0xd233('0x51')][_0xd233('0x49')]({'name':_0x171b12[_0xd233('0x29')],'resourceId':_0x171b12['id'],'type':_0x3baafb[_0xd233('0x29')],'sectionId':_0x3baafb['id']},{})[_0xd233('0x25')](function(){return _0x21ec96;});}else{return _0x21ec96;}})[_0xd233('0x42')](function(_0x5dd9be){logger[_0xd233('0x52')](_0xd233('0x53'),_0x5dd9be);throw _0x5dd9be;});}return _0x21ec96;})['then'](respondWithResult(_0x5d191f,0xc9))[_0xd233('0x42')](handleError(_0x5d191f,null));};exports['update']=function(_0x4ecaa7,_0x4a91e7){if(_0x4ecaa7[_0xd233('0x4a')]['id']){delete _0x4ecaa7[_0xd233('0x4a')]['id'];}return db[_0xd233('0x3e')][_0xd233('0x48')]({'where':{'id':_0x4ecaa7[_0xd233('0x54')]['id']}})[_0xd233('0x25')](handleEntityNotFound(_0x4a91e7,null))[_0xd233('0x25')](saveUpdates(_0x4ecaa7[_0xd233('0x4a')],null))[_0xd233('0x25')](respondWithResult(_0x4a91e7,null))[_0xd233('0x42')](handleError(_0x4a91e7,null));};exports[_0xd233('0x26')]=function(_0x1df5d3,_0x4c3993){return db['Interval'][_0xd233('0x48')]({'where':{'id':_0x1df5d3['params']['id']}})[_0xd233('0x25')](handleEntityNotFound(_0x4c3993,null))[_0xd233('0x25')](removeEntity(_0x4c3993,null))['catch'](handleError(_0x4c3993,null));};exports['addInterval']=function(_0x33868b,_0x10e814,_0x3fda22){if(_0x33868b[_0xd233('0x4a')]['id']){delete _0x33868b[_0xd233('0x4a')]['id'];}return db['Interval'][_0xd233('0x48')]({'where':{'id':_0x33868b['params']['id']}})[_0xd233('0x25')](handleEntityNotFound(_0x10e814,null))[_0xd233('0x25')](function(_0x25dad8){if(_0x25dad8){_0x33868b[_0xd233('0x4a')][_0xd233('0x55')]=_0x25dad8['id'];return db[_0xd233('0x3e')][_0xd233('0x49')](_0x33868b['body']);}})['then'](respondWithResult(_0x10e814,null))[_0xd233('0x42')](handleError(_0x10e814,null));};exports['getIntervals']=function(_0x52295d,_0x13851d,_0x29d74d){var _0x1391e6={};var _0x42baf1={};var _0x2e70a1;var _0x49bd84;return db[_0xd233('0x3e')][_0xd233('0x56')]({'where':{'id':_0x52295d[_0xd233('0x54')]['id']}})[_0xd233('0x25')](handleEntityNotFound(_0x13851d,null))[_0xd233('0x25')](function(_0x32ea83){if(_0x32ea83){_0x2e70a1=_0x32ea83;_0x42baf1[_0xd233('0x30')]=_[_0xd233('0x45')](db[_0xd233('0x3e')]['rawAttributes']);_0x42baf1[_0xd233('0x31')]=_[_0xd233('0x45')](_0x52295d[_0xd233('0x31')]);_0x42baf1[_0xd233('0x32')]=_[_0xd233('0x33')](_0x42baf1['model'],_0x42baf1[_0xd233('0x31')]);_0x1391e6[_0xd233('0x34')]=_[_0xd233('0x33')](_0x42baf1[_0xd233('0x30')],qs[_0xd233('0x35')](_0x52295d[_0xd233('0x31')][_0xd233('0x35')]));_0x1391e6[_0xd233('0x34')]=_0x1391e6['attributes']['length']?_0x1391e6[_0xd233('0x34')]:_0x42baf1[_0xd233('0x30')];_0x1391e6['order']=qs['sort'](_0x52295d['query'][_0xd233('0x38')]);_0x1391e6[_0xd233('0x3b')]=qs[_0xd233('0x32')](_[_0xd233('0x39')](_0x52295d[_0xd233('0x31')],_0x42baf1[_0xd233('0x32')]));if(_0x52295d[_0xd233('0x31')][_0xd233('0x3a')]){_0x1391e6[_0xd233('0x3b')]=_['merge'](_0x1391e6[_0xd233('0x3b')],{'$or':_[_0xd233('0x2c')](_0x1391e6[_0xd233('0x34')],function(_0x2a0eea){var _0x2c6e38={};_0x2c6e38[_0x2a0eea]={'$like':'%'+_0x52295d['query'][_0xd233('0x3a')]+'%'};return _0x2c6e38;})});}_0x1391e6=_[_0xd233('0x3c')]({},_0x1391e6,_0x52295d[_0xd233('0x3d')]);return _0x2e70a1['getIntervals'](_0x1391e6);}})[_0xd233('0x25')](function(_0x2d18af){if(_0x2d18af){_0x49bd84=_0x2d18af['length'];if(!_0x52295d[_0xd233('0x31')][_0xd233('0x36')]('nolimit')){_0x1391e6['limit']=qs[_0xd233('0x1f')](_0x52295d[_0xd233('0x31')][_0xd233('0x1f')]);_0x1391e6[_0xd233('0x1e')]=qs[_0xd233('0x1e')](_0x52295d['query'][_0xd233('0x1e')]);}return _0x2e70a1['getIntervals'](_0x1391e6);}})[_0xd233('0x25')](function(_0x3e980a){if(_0x3e980a){return _0x3e980a?{'count':_0x49bd84,'rows':_0x3e980a}:null;}})[_0xd233('0x25')](respondWithResult(_0x13851d,null))[_0xd233('0x42')](handleError(_0x13851d,null));};exports['addIntervals']=function(_0xaa854,_0x35e8c5,_0x33dd2e){return db['Interval'][_0xd233('0x56')]({'where':{'id':_0xaa854[_0xd233('0x54')]['id']}})[_0xd233('0x25')](handleEntityNotFound(_0x35e8c5,null))[_0xd233('0x25')](function(_0x2e9aac){if(_0x2e9aac){return db[_0xd233('0x57')][_0xd233('0x58')](function(_0x1e1e3f){return db[_0xd233('0x3e')]['destroy']({'where':{'IntervalId':_0xaa854['params']['id']},'transaction':_0x1e1e3f})['then'](function(_0x21b6d5){var _0x401dc1=_[_0xd233('0x2c')](_0xaa854[_0xd233('0x4a')],function(_0x3fa52e){delete _0x3fa52e['id'];_0x3fa52e[_0xd233('0x55')]=_0xaa854[_0xd233('0x54')]['id'];return _0x3fa52e;});return db[_0xd233('0x3e')]['bulkCreate'](_0x401dc1,{'transaction':_0x1e1e3f});});})[_0xd233('0x25')](function(){return db[_0xd233('0x3e')][_0xd233('0x40')]({'where':{'IntervalId':_0xaa854['params']['id']}});});}})[_0xd233('0x25')](respondWithResult(_0x35e8c5,null))[_0xd233('0x42')](handleError(_0x35e8c5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7cd7867..63171aa 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 _0x959e=['rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','define','Interval'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x959e,0x1e2));var _0xe959=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x959e[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xe959('0x0'));var util=require(_0xe959('0x1'));var logger=require(_0xe959('0x2'))('api');var moment=require(_0xe959('0x3'));var BPromise=require(_0xe959('0x4'));var rp=require(_0xe959('0x5'));var fs=require('fs');var path=require(_0xe959('0x6'));var rimraf=require(_0xe959('0x7'));var config=require(_0xe959('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0xe959('0x9'));module['exports']=function(_0x29a59a,_0xd2bb6e){return _0x29a59a[_0xe959('0xa')](_0xe959('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ecd72,_0x257fc7){extensions['rewrite'](_0x29a59a,_0x4ecd72);},'afterBulkCreate':function(_0x4de475,_0x200c5d,_0x264816){_0x264816();extensions[_0xe959('0xc')](_0x29a59a,_0x4de475[0x0]);},'afterUpdate':function(_0x507982,_0x1caf58){extensions[_0xe959('0xc')](_0x29a59a,_0x507982);},'afterDestroy':function(_0x42c3fd,_0x58ca1c){extensions[_0xe959('0xc')](_0x29a59a,_0x42c3fd);}}});}; \ No newline at end of file +var _0x07be=['exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x2a2fdb,_0x5b5d57){var _0x34fbbf=function(_0x414ba3){while(--_0x414ba3){_0x2a2fdb['push'](_0x2a2fdb['shift']());}};_0x34fbbf(++_0x5b5d57);}(_0x07be,0xfb));var _0xe07b=function(_0x57d175,_0x1af1c0){_0x57d175=_0x57d175-0x0;var _0x2b9208=_0x07be[_0x57d175];return _0x2b9208;};'use strict';var _=require(_0xe07b('0x0'));var util=require(_0xe07b('0x1'));var logger=require(_0xe07b('0x2'))(_0xe07b('0x3'));var moment=require('moment');var BPromise=require(_0xe07b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe07b('0x5'));var rimraf=require(_0xe07b('0x6'));var config=require(_0xe07b('0x7'));var attributes=require(_0xe07b('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0xe07b('0x9')]=function(_0x1eb78f,_0x288525){return _0x1eb78f['define'](_0xe07b('0xa'),attributes,{'tableName':_0xe07b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1169b6,_0x93a553){extensions[_0xe07b('0xc')](_0x1eb78f,_0x1169b6);},'afterBulkCreate':function(_0x4e1cf4,_0x16f0ec,_0x12284e){_0x12284e();extensions[_0xe07b('0xc')](_0x1eb78f,_0x4e1cf4[0x0]);},'afterUpdate':function(_0x23ed16,_0xcf4339){extensions['rewrite'](_0x1eb78f,_0x23ed16);},'afterDestroy':function(_0x5a4adb,_0x54b133){extensions[_0xe07b('0xc')](_0x1eb78f,_0x5a4adb);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5aed98e..ce8945a 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 _0xc22c=['Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetInterval','Interval','options','raw','limit','map','include','model','attributes','catch','find','where','ShowInterval','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2701a8,_0x1bcb59){var _0x49d401=function(_0x480c9b){while(--_0x480c9b){_0x2701a8['push'](_0x2701a8['shift']());}};_0x49d401(++_0x1bcb59);}(_0xc22c,0xe5));var _0xcc22=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0xc22c[_0x53f0db];return _0xae0a5c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc22('0x0'));var BPromise=require('bluebird');var rs=require(_0xcc22('0x1'));var fs=require('fs');var Redis=require(_0xcc22('0x2'));var db=require(_0xcc22('0x3'))['db'];var utils=require(_0xcc22('0x4'));var logger=require(_0xcc22('0x5'))(_0xcc22('0x6'));var config=require(_0xcc22('0x7'));var jayson=require(_0xcc22('0x8'));var client=jayson['client'][_0xcc22('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x856283,_0x1d5eb5,_0x33401f){return new BPromise(function(_0x20be0f,_0x17e493){return client[_0xcc22('0xa')](_0x856283,_0x33401f)[_0xcc22('0xb')](function(_0x5356c0){logger[_0xcc22('0xc')](_0xcc22('0xd'),_0x1d5eb5,_0xcc22('0xe'));logger[_0xcc22('0xf')](_0xcc22('0x10'),_0x1d5eb5,'request\x20sent',JSON[_0xcc22('0x11')](_0x5356c0));if(_0x5356c0['error']){if(_0x5356c0[_0xcc22('0x12')][_0xcc22('0x13')]===0x1f4){logger[_0xcc22('0x12')]('Interval,\x20%s,\x20%s',_0x1d5eb5,_0x5356c0['error'][_0xcc22('0x14')]);return _0x17e493(_0x5356c0[_0xcc22('0x12')][_0xcc22('0x14')]);}logger[_0xcc22('0x12')](_0xcc22('0xd'),_0x1d5eb5,_0x5356c0[_0xcc22('0x12')][_0xcc22('0x14')]);return _0x20be0f(_0x5356c0[_0xcc22('0x12')][_0xcc22('0x14')]);}else{logger[_0xcc22('0xc')](_0xcc22('0xd'),_0x1d5eb5,_0xcc22('0xe'));_0x20be0f(_0x5356c0[_0xcc22('0x15')][_0xcc22('0x14')]);}})['catch'](function(_0x57129c){logger[_0xcc22('0x12')](_0xcc22('0xd'),_0x1d5eb5,_0x57129c);_0x17e493(_0x57129c);});});}exports[_0xcc22('0x16')]=function(_0x14052e){var _0x545298=this;return new Promise(function(_0x88c3dd,_0x4f71c4){return db[_0xcc22('0x17')]['findAll']({'raw':_0x14052e[_0xcc22('0x18')]?_0x14052e[_0xcc22('0x18')][_0xcc22('0x19')]===undefined?!![]:![]:!![],'where':_0x14052e[_0xcc22('0x18')]?_0x14052e['options']['where']||null:null,'attributes':_0x14052e[_0xcc22('0x18')]?_0x14052e[_0xcc22('0x18')]['attributes']||null:null,'limit':_0x14052e[_0xcc22('0x18')]?_0x14052e[_0xcc22('0x18')][_0xcc22('0x1a')]||null:null,'include':_0x14052e[_0xcc22('0x18')]?_0x14052e[_0xcc22('0x18')]['include']?_[_0xcc22('0x1b')](_0x14052e[_0xcc22('0x18')][_0xcc22('0x1c')],function(_0x1507aa){return{'model':db[_0x1507aa[_0xcc22('0x1d')]],'as':_0x1507aa['as'],'attributes':_0x1507aa[_0xcc22('0x1e')],'include':_0x1507aa[_0xcc22('0x1c')]?_['map'](_0x1507aa[_0xcc22('0x1c')],function(_0x98b4b8){return{'model':db[_0x98b4b8[_0xcc22('0x1d')]],'as':_0x98b4b8['as'],'attributes':_0x98b4b8[_0xcc22('0x1e')],'include':_0x98b4b8[_0xcc22('0x1c')]?_[_0xcc22('0x1b')](_0x98b4b8[_0xcc22('0x1c')],function(_0x41aaa5){return{'model':db[_0x41aaa5['model']],'as':_0x41aaa5['as'],'attributes':_0x41aaa5[_0xcc22('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc22('0xb')](function(_0x1a462b){logger[_0xcc22('0xc')]('GetInterval',_0x14052e);logger[_0xcc22('0xf')](_0xcc22('0x16'),_0x14052e,JSON[_0xcc22('0x11')](_0x1a462b));_0x88c3dd(_0x1a462b);})[_0xcc22('0x1f')](function(_0x88c4ad){logger['error']('GetInterval',_0x88c4ad[_0xcc22('0x14')],_0x14052e);_0x4f71c4(_0x545298[_0xcc22('0x12')](0x1f4,_0x88c4ad[_0xcc22('0x14')]));});});};exports['ShowInterval']=function(_0x33ded5){var _0x162d35=this;return new Promise(function(_0x3df112,_0x1691f3){return db[_0xcc22('0x17')][_0xcc22('0x20')]({'raw':_0x33ded5[_0xcc22('0x18')]?_0x33ded5[_0xcc22('0x18')][_0xcc22('0x19')]===undefined?!![]:![]:!![],'where':_0x33ded5[_0xcc22('0x18')]?_0x33ded5[_0xcc22('0x18')][_0xcc22('0x21')]||null:null,'attributes':_0x33ded5['options']?_0x33ded5[_0xcc22('0x18')][_0xcc22('0x1e')]||null:null,'include':_0x33ded5[_0xcc22('0x18')]?_0x33ded5['options']['include']?_[_0xcc22('0x1b')](_0x33ded5[_0xcc22('0x18')][_0xcc22('0x1c')],function(_0x3226c3){return{'model':db[_0x3226c3[_0xcc22('0x1d')]],'as':_0x3226c3['as'],'attributes':_0x3226c3[_0xcc22('0x1e')],'include':_0x3226c3[_0xcc22('0x1c')]?_[_0xcc22('0x1b')](_0x3226c3[_0xcc22('0x1c')],function(_0x168c9e){return{'model':db[_0x168c9e[_0xcc22('0x1d')]],'as':_0x168c9e['as'],'attributes':_0x168c9e['attributes'],'include':_0x168c9e[_0xcc22('0x1c')]?_[_0xcc22('0x1b')](_0x168c9e[_0xcc22('0x1c')],function(_0x2c00c8){return{'model':db[_0x2c00c8['model']],'as':_0x2c00c8['as'],'attributes':_0x2c00c8[_0xcc22('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc22('0xb')](function(_0x420778){logger[_0xcc22('0xc')]('ShowInterval',_0x33ded5);logger[_0xcc22('0xf')](_0xcc22('0x22'),_0x33ded5,JSON[_0xcc22('0x11')](_0x420778));_0x3df112(_0x420778);})['catch'](function(_0x32818b){logger[_0xcc22('0x12')](_0xcc22('0x22'),_0x32818b['message'],_0x33ded5);_0x1691f3(_0x162d35[_0xcc22('0x12')](0x1f4,_0x32818b[_0xcc22('0x14')]));});});}; \ No newline at end of file +var _0x1998=['Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','model','map','then','ShowInterval','raw','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1998,0x106));var _0x8199=function(_0x19e142,_0x561fa1){_0x19e142=_0x19e142-0x0;var _0x3d6f73=_0x1998[_0x19e142];return _0x3d6f73;};'use strict';var _=require(_0x8199('0x0'));var util=require(_0x8199('0x1'));var moment=require(_0x8199('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8199('0x3'));var logger=require(_0x8199('0x4'))(_0x8199('0x5'));var config=require(_0x8199('0x6'));var jayson=require(_0x8199('0x7'));var client=jayson[_0x8199('0x8')][_0x8199('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x234dab,_0x1f7588,_0x11570d){return new BPromise(function(_0x4ef4b3,_0x745575){return client['request'](_0x234dab,_0x11570d)['then'](function(_0x5f26fb){logger['info'](_0x8199('0xa'),_0x1f7588,_0x8199('0xb'));logger[_0x8199('0xc')](_0x8199('0xd'),_0x1f7588,'request\x20sent',JSON[_0x8199('0xe')](_0x5f26fb));if(_0x5f26fb[_0x8199('0xf')]){if(_0x5f26fb[_0x8199('0xf')][_0x8199('0x10')]===0x1f4){logger[_0x8199('0xf')]('Interval,\x20%s,\x20%s',_0x1f7588,_0x5f26fb['error'][_0x8199('0x11')]);return _0x745575(_0x5f26fb[_0x8199('0xf')]['message']);}logger[_0x8199('0xf')](_0x8199('0xa'),_0x1f7588,_0x5f26fb[_0x8199('0xf')][_0x8199('0x11')]);return _0x4ef4b3(_0x5f26fb['error'][_0x8199('0x11')]);}else{logger[_0x8199('0x12')](_0x8199('0xa'),_0x1f7588,_0x8199('0xb'));_0x4ef4b3(_0x5f26fb[_0x8199('0x13')][_0x8199('0x11')]);}})[_0x8199('0x14')](function(_0xdd6c81){logger[_0x8199('0xf')](_0x8199('0xa'),_0x1f7588,_0xdd6c81);_0x745575(_0xdd6c81);});});}exports[_0x8199('0x15')]=function(_0x2523ec){var _0x4f5b9c=this;return new Promise(function(_0x3f0dda,_0x253280){return db[_0x8199('0x16')][_0x8199('0x17')]({'raw':_0x2523ec[_0x8199('0x18')]?_0x2523ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x2523ec[_0x8199('0x18')]?_0x2523ec[_0x8199('0x18')][_0x8199('0x19')]||null:null,'attributes':_0x2523ec[_0x8199('0x18')]?_0x2523ec[_0x8199('0x18')][_0x8199('0x1a')]||null:null,'limit':_0x2523ec['options']?_0x2523ec['options'][_0x8199('0x1b')]||null:null,'include':_0x2523ec[_0x8199('0x18')]?_0x2523ec[_0x8199('0x18')][_0x8199('0x1c')]?_['map'](_0x2523ec[_0x8199('0x18')]['include'],function(_0x57258e){return{'model':db[_0x57258e['model']],'as':_0x57258e['as'],'attributes':_0x57258e[_0x8199('0x1a')],'include':_0x57258e[_0x8199('0x1c')]?_['map'](_0x57258e['include'],function(_0x315b40){return{'model':db[_0x315b40[_0x8199('0x1d')]],'as':_0x315b40['as'],'attributes':_0x315b40['attributes'],'include':_0x315b40[_0x8199('0x1c')]?_[_0x8199('0x1e')](_0x315b40[_0x8199('0x1c')],function(_0x4637ae){return{'model':db[_0x4637ae['model']],'as':_0x4637ae['as'],'attributes':_0x4637ae[_0x8199('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8199('0x1f')](function(_0x2a1159){logger['info']('GetInterval',_0x2523ec);logger['debug']('GetInterval',_0x2523ec,JSON[_0x8199('0xe')](_0x2a1159));_0x3f0dda(_0x2a1159);})[_0x8199('0x14')](function(_0x2c4375){logger[_0x8199('0xf')](_0x8199('0x15'),_0x2c4375[_0x8199('0x11')],_0x2523ec);_0x253280(_0x4f5b9c[_0x8199('0xf')](0x1f4,_0x2c4375[_0x8199('0x11')]));});});};exports[_0x8199('0x20')]=function(_0x1a6c19){var _0x525f2b=this;return new Promise(function(_0x3f9766,_0x58228b){return db[_0x8199('0x16')]['find']({'raw':_0x1a6c19['options']?_0x1a6c19['options'][_0x8199('0x21')]===undefined?!![]:![]:!![],'where':_0x1a6c19['options']?_0x1a6c19[_0x8199('0x18')]['where']||null:null,'attributes':_0x1a6c19['options']?_0x1a6c19['options']['attributes']||null:null,'include':_0x1a6c19['options']?_0x1a6c19[_0x8199('0x18')][_0x8199('0x1c')]?_[_0x8199('0x1e')](_0x1a6c19['options'][_0x8199('0x1c')],function(_0x5bfdc1){return{'model':db[_0x5bfdc1['model']],'as':_0x5bfdc1['as'],'attributes':_0x5bfdc1[_0x8199('0x1a')],'include':_0x5bfdc1[_0x8199('0x1c')]?_['map'](_0x5bfdc1['include'],function(_0x5f42e3){return{'model':db[_0x5f42e3['model']],'as':_0x5f42e3['as'],'attributes':_0x5f42e3['attributes'],'include':_0x5f42e3['include']?_[_0x8199('0x1e')](_0x5f42e3[_0x8199('0x1c')],function(_0x161af6){return{'model':db[_0x161af6[_0x8199('0x1d')]],'as':_0x161af6['as'],'attributes':_0x161af6[_0x8199('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8199('0x1f')](function(_0x1b716b){logger[_0x8199('0x12')]('ShowInterval',_0x1a6c19);logger[_0x8199('0xc')]('ShowInterval',_0x1a6c19,JSON[_0x8199('0xe')](_0x1b716b));_0x3f9766(_0x1b716b);})[_0x8199('0x14')](function(_0x1ab71c){logger['error'](_0x8199('0x20'),_0x1ab71c[_0x8199('0x11')],_0x1a6c19);_0x58228b(_0x525f2b[_0x8199('0xf')](0x1f4,_0x1ab71c[_0x8199('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6ed1e21..96f7f6b 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 _0xf79f=['exports','Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send'];(function(_0x12a237,_0x1433f7){var _0x557e9d=function(_0x2d34ec){while(--_0x2d34ec){_0x12a237['push'](_0x12a237['shift']());}};_0x557e9d(++_0x1433f7);}(_0xf79f,0x182));var _0xff79=function(_0x153863,_0x41363d){_0x153863=_0x153863-0x0;var _0x3bfc32=_0xf79f[_0x153863];return _0x3bfc32;};'use strict';var express=require('express');var router=express[_0xff79('0x0')]();var auth=require(_0xff79('0x1'));var controller=require(_0xff79('0x2'));router[_0xff79('0x3')]('/',auth[_0xff79('0x4')](),controller[_0xff79('0x5')]);module[_0xff79('0x6')]=router; \ No newline at end of file +var _0x60fd=['isAuthenticated','send','exports','Router','../../components/auth/service'];(function(_0x2806e4,_0x3cbd48){var _0xa5493d=function(_0x53e13b){while(--_0x53e13b){_0x2806e4['push'](_0x2806e4['shift']());}};_0xa5493d(++_0x3cbd48);}(_0x60fd,0xf8));var _0xd60f=function(_0x578809,_0x1dfb62){_0x578809=_0x578809-0x0;var _0x2a5e35=_0x60fd[_0x578809];return _0x2a5e35;};'use strict';var express=require('express');var router=express[_0xd60f('0x0')]();var auth=require(_0xd60f('0x1'));var controller=require('./jira.controller');router['post']('/',auth[_0xd60f('0x2')](),controller[_0xd60f('0x3')]);module[_0xd60f('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 2251493..849aba8 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 _0x4d92=['Basic\x20','toString','stringify','request','utf8','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','description','issuetype','Bug','customfield_11500','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json'];(function(_0x4a5f2a,_0x196991){var _0x1b5356=function(_0x816fd1){while(--_0x816fd1){_0x4a5f2a['push'](_0x4a5f2a['shift']());}};_0x1b5356(++_0x196991);}(_0x4d92,0x19f));var _0x24d9=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4d92[_0x40ac5e];return _0x2839d6;};'use strict';var BPromise=require(_0x24d9('0x0'));var https=require(_0x24d9('0x1'));var logger=require(_0x24d9('0x2'))(_0x24d9('0x3'));var USERNAME=_0x24d9('0x4');var PASSWORD=_0x24d9('0x5');function openIssue(_0x1371dd,_0xafb08f){var _0xe78f6a={'fields':{'project':{'key':_0x1371dd[_0x24d9('0x6')]||'MOTGUI'},'summary':(_0x1371dd[_0x24d9('0x7')]||'Report')+'\x20from\x20'+_0x1371dd['ip'],'description':_0x1371dd[_0x24d9('0x8')]||JSON['stringify'](_0x1371dd),'issuetype':{'name':_0x1371dd[_0x24d9('0x9')]||_0x24d9('0xa')}}};_0xe78f6a['fields'][_0x24d9('0xb')]=_0x1371dd['email'];_0xe78f6a[_0x24d9('0xc')][_0x24d9('0xd')]=_0x1371dd[_0x24d9('0xe')];_0xe78f6a[_0x24d9('0xc')][_0x24d9('0xf')]=_0x1371dd[_0x24d9('0x10')];_0xe78f6a[_0x24d9('0xc')][_0x24d9('0x11')]=_0x1371dd['name'];_0xe78f6a['fields'][_0x24d9('0x12')]=_0x1371dd[_0x24d9('0x13')];_0xe78f6a[_0x24d9('0xc')][_0x24d9('0x14')]=_0x1371dd['ip'];var _0xe895b2={'host':_0x24d9('0x15'),'port':0x1bb,'path':_0x24d9('0x16'),'method':_0x24d9('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x24d9('0x18'),'Authorization':_0x24d9('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x24d9('0x1a')]('base64')}};var _0x4cc69b=JSON[_0x24d9('0x1b')](_0xe78f6a);var _0x49a8cb=https[_0x24d9('0x1c')](_0xe895b2,function(_0x2d5176){_0x2d5176['setEncoding'](_0x24d9('0x1d'));var _0x20dc1a='';_0x2d5176['on']('data',function(_0x1223db){_0x20dc1a+=_0x1223db;});_0x2d5176['on']('end',function(){if(_0xafb08f){return _0xafb08f['status'](_0x2d5176[_0x24d9('0x1e')])[_0x24d9('0x1f')](JSON[_0x24d9('0x20')](_0x20dc1a));}});});_0x49a8cb['on'](_0x24d9('0x21'),function(_0x2db8fa){if(_0xafb08f){return _0xafb08f[_0x24d9('0x22')](0x1f4)[_0x24d9('0x1f')]({'errors':[{'message':_0x24d9('0x23'),'type':_0x24d9('0x24')}]});}});_0x49a8cb['write'](_0x4cc69b);_0x49a8cb[_0x24d9('0x25')]();}exports[_0x24d9('0x26')]=openIssue;exports['send']=function(_0x16ae03,_0x5a8f50){_0x16ae03[_0x24d9('0x27')]['ip']=_0x16ae03[_0x24d9('0x28')]['x-forwarded-for']||_0x16ae03[_0x24d9('0x29')][_0x24d9('0x2a')]||_0x16ae03[_0x24d9('0x2b')]['remoteAddress']||_0x16ae03[_0x24d9('0x29')][_0x24d9('0x2b')][_0x24d9('0x2a')];return openIssue(_0x16ae03[_0x24d9('0x27')],_0x5a8f50);}; \ No newline at end of file +var _0x8d01=['customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','base64','request','setEncoding','utf8','data','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields'];(function(_0x52f632,_0x4f951){var _0x47fecd=function(_0xe09fd0){while(--_0xe09fd0){_0x52f632['push'](_0x52f632['shift']());}};_0x47fecd(++_0x4f951);}(_0x8d01,0x76));var _0x18d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d01[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require(_0x18d0('0x0'));var logger=require(_0x18d0('0x1'))(_0x18d0('0x2'));var USERNAME=_0x18d0('0x3');var PASSWORD=_0x18d0('0x4');function openIssue(_0x4ea086,_0x10ed5e){var _0x2fad47={'fields':{'project':{'key':_0x4ea086[_0x18d0('0x5')]||_0x18d0('0x6')},'summary':(_0x4ea086[_0x18d0('0x7')]||_0x18d0('0x8'))+_0x18d0('0x9')+_0x4ea086['ip'],'description':_0x4ea086[_0x18d0('0xa')]||JSON[_0x18d0('0xb')](_0x4ea086),'issuetype':{'name':_0x4ea086['issuetype']||_0x18d0('0xc')}}};_0x2fad47[_0x18d0('0xd')][_0x18d0('0xe')]=_0x4ea086['email'];_0x2fad47['fields']['customfield_11501']=_0x4ea086[_0x18d0('0xf')];_0x2fad47[_0x18d0('0xd')][_0x18d0('0x10')]=_0x4ea086[_0x18d0('0x11')];_0x2fad47[_0x18d0('0xd')][_0x18d0('0x12')]=_0x4ea086[_0x18d0('0x13')];_0x2fad47[_0x18d0('0xd')]['customfield_11504']=_0x4ea086[_0x18d0('0x14')];_0x2fad47[_0x18d0('0xd')][_0x18d0('0x15')]=_0x4ea086['ip'];var _0x5ca2be={'host':_0x18d0('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x18d0('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x18d0('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x18d0('0x19'))}};var _0x2a3dac=JSON[_0x18d0('0xb')](_0x2fad47);var _0xad2ed8=https[_0x18d0('0x1a')](_0x5ca2be,function(_0x339877){_0x339877[_0x18d0('0x1b')](_0x18d0('0x1c'));var _0x4929f1='';_0x339877['on'](_0x18d0('0x1d'),function(_0x29beaf){_0x4929f1+=_0x29beaf;});_0x339877['on']('end',function(){if(_0x10ed5e){return _0x10ed5e[_0x18d0('0x1e')](_0x339877[_0x18d0('0x1f')])['json'](JSON['parse'](_0x4929f1));}});});_0xad2ed8['on'](_0x18d0('0x20'),function(_0x481d56){if(_0x10ed5e){return _0x10ed5e[_0x18d0('0x1e')](0x1f4)[_0x18d0('0x21')]({'errors':[{'message':_0x18d0('0x22'),'type':_0x18d0('0x23')}]});}});_0xad2ed8[_0x18d0('0x24')](_0x2a3dac);_0xad2ed8['end']();}exports['openIssue']=openIssue;exports[_0x18d0('0x25')]=function(_0x42d2e6,_0x14159e){_0x42d2e6['body']['ip']=_0x42d2e6[_0x18d0('0x26')][_0x18d0('0x27')]||_0x42d2e6[_0x18d0('0x28')][_0x18d0('0x29')]||_0x42d2e6[_0x18d0('0x2a')][_0x18d0('0x29')]||_0x42d2e6['connection']['socket']['remoteAddress'];return openIssue(_0x42d2e6[_0x18d0('0x2b')],_0x14159e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 867c40f..7421c2e 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 _0x1e0c=['../../components/interaction/service','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e0c,0x113));var _0xc1e0=function(_0x1f097d,_0x511f64){_0x1f097d=_0x1f097d-0x0;var _0x5e2cf9=_0x1e0c[_0x1f097d];return _0x5e2cf9;};'use strict';var multer=require(_0xc1e0('0x0'));var util=require(_0xc1e0('0x1'));var path=require(_0xc1e0('0x2'));var timeout=require(_0xc1e0('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc1e0('0x4'));var interaction=require(_0xc1e0('0x5'));var config=require('../../config/environment');var controller=require(_0xc1e0('0x6'));router[_0xc1e0('0x7')]('/',auth['isAuthenticated'](),controller[_0xc1e0('0x8')]);router[_0xc1e0('0x7')](_0xc1e0('0x9'),auth[_0xc1e0('0xa')](),controller[_0xc1e0('0xb')]);router[_0xc1e0('0x7')](_0xc1e0('0xc'),auth[_0xc1e0('0xa')](),controller['show']);router[_0xc1e0('0xd')]('/',auth[_0xc1e0('0xa')](),controller[_0xc1e0('0xe')]);router[_0xc1e0('0xf')](_0xc1e0('0xc'),auth[_0xc1e0('0xa')](),controller[_0xc1e0('0x10')]);router[_0xc1e0('0x11')]('/:id',auth[_0xc1e0('0xa')](),controller[_0xc1e0('0x12')]);module[_0xc1e0('0x13')]=router; \ No newline at end of file +var _0x6828=['delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','create','update'];(function(_0x26b626,_0x16466f){var _0xfc9ebb=function(_0x1e9a59){while(--_0x1e9a59){_0x26b626['push'](_0x26b626['shift']());}};_0xfc9ebb(++_0x16466f);}(_0x6828,0xc2));var _0x8682=function(_0x32affe,_0x26d291){_0x32affe=_0x32affe-0x0;var _0x4e25b0=_0x6828[_0x32affe];return _0x4e25b0;};'use strict';var multer=require(_0x8682('0x0'));var util=require(_0x8682('0x1'));var path=require(_0x8682('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8682('0x3')]();var auth=require(_0x8682('0x4'));var interaction=require(_0x8682('0x5'));var config=require(_0x8682('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x8682('0x7')]('/',auth[_0x8682('0x8')](),controller[_0x8682('0x9')]);router[_0x8682('0x7')](_0x8682('0xa'),auth[_0x8682('0x8')](),controller['describe']);router[_0x8682('0x7')](_0x8682('0xb'),auth[_0x8682('0x8')](),controller['show']);router['post']('/',auth[_0x8682('0x8')](),controller[_0x8682('0xc')]);router['put'](_0x8682('0xb'),auth['isAuthenticated'](),controller[_0x8682('0xd')]);router[_0x8682('0xe')]('/:id',auth[_0x8682('0x8')](),controller['destroy']);module[_0x8682('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9f1307e..98440d2 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 _0x0565=['long','STRING','sequelize','exports','TEXT'];(function(_0x539a93,_0x59d222){var _0x52f615=function(_0x18be18){while(--_0x18be18){_0x539a93['push'](_0x539a93['shift']());}};_0x52f615(++_0x59d222);}(_0x0565,0xf2));var _0x5056=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x0565[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'question':{'type':Sequelize[_0x5056('0x2')]},'answer':{'type':Sequelize[_0x5056('0x2')](_0x5056('0x3'))},'membername':{'type':Sequelize[_0x5056('0x4')]},'projectname':{'type':Sequelize[_0x5056('0x4')]},'queue':{'type':Sequelize[_0x5056('0x4')]},'uniqueid':{'type':Sequelize[_0x5056('0x4')]},'calleridname':{'type':Sequelize[_0x5056('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x5056('0x4')]}}; \ No newline at end of file +var _0x3495=['TEXT','long','STRING','sequelize','exports'];(function(_0x2fbb8e,_0x39edeb){var _0x556d49=function(_0x34c8bb){while(--_0x34c8bb){_0x2fbb8e['push'](_0x2fbb8e['shift']());}};_0x556d49(++_0x39edeb);}(_0x3495,0x1de));var _0x5349=function(_0x4ebff1,_0x3826d4){_0x4ebff1=_0x4ebff1-0x0;var _0x56c287=_0x3495[_0x4ebff1];return _0x56c287;};'use strict';var Sequelize=require(_0x5349('0x0'));module[_0x5349('0x1')]={'question':{'type':Sequelize[_0x5349('0x2')]},'answer':{'type':Sequelize[_0x5349('0x2')](_0x5349('0x3'))},'membername':{'type':Sequelize[_0x5349('0x4')]},'projectname':{'type':Sequelize[_0x5349('0x4')]},'queue':{'type':Sequelize[_0x5349('0x4')]},'uniqueid':{'type':Sequelize[_0x5349('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5349('0x4')]},'questionId':{'type':Sequelize[_0x5349('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index f6092a1..2d566b6 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 _0x28a1=['reject','save','update','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','keys','intersection','create','body','find','describe','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x1ce266,_0xf99ee4){var _0x2d08a6=function(_0x3a8be2){while(--_0x3a8be2){_0x1ce266['push'](_0x1ce266['shift']());}};_0x2d08a6(++_0xf99ee4);}(_0x28a1,0x152));var _0x128a=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x28a1[_0x4ab3fb];return _0x34fe1e;};'use strict';var pdf=require(_0x128a('0x0'));var emlformat=require(_0x128a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x128a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x128a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x128a('0x4'));var util=require(_0x128a('0x5'));var path=require(_0x128a('0x6'));var sox=require(_0x128a('0x7'));var csv=require(_0x128a('0x8'));var ejs=require(_0x128a('0x9'));var fs=require('fs');var _=require(_0x128a('0xa'));var squel=require(_0x128a('0xb'));var crypto=require(_0x128a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x128a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x128a('0xd'));var authService=require(_0x128a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x128a('0xf'));var hardwareService=require(_0x128a('0x10'));var logger=require(_0x128a('0x11'))(_0x128a('0x12'));var utils=require(_0x128a('0x13'));var config=require(_0x128a('0x14'));var licenseUtil=require(_0x128a('0x15'));var db=require(_0x128a('0x16'))['db'];function respondWithStatusCode(_0x44a26c,_0x3fa25c){_0x3fa25c=_0x3fa25c||0xcc;return function(_0x4f0f67){if(_0x4f0f67){return _0x44a26c[_0x128a('0x17')](_0x3fa25c);}return _0x44a26c[_0x128a('0x18')](_0x3fa25c)[_0x128a('0x19')]();};}function respondWithResult(_0x396aed,_0x60dce0){_0x60dce0=_0x60dce0||0xc8;return function(_0x57c1df){if(_0x57c1df){return _0x396aed[_0x128a('0x18')](_0x60dce0)[_0x128a('0x1a')](_0x57c1df);}};}function respondWithFilteredResult(_0x881460,_0xb80f07){return function(_0x4e8d2b){if(_0x4e8d2b){var _0x39be2f=_0x4e8d2b[_0x128a('0x1b')],_0x1356eb=_0xb80f07[_0x128a('0x1c')],_0x146b1e=_0xb80f07[_0x128a('0x1c')]+_0xb80f07[_0x128a('0x1d')],_0x3ea648;if(_0x146b1e>=_0x39be2f){_0x146b1e=_0x39be2f;_0x3ea648=0xc8;}else{_0x3ea648=0xce;}_0x881460[_0x128a('0x18')](_0x3ea648);return _0x881460[_0x128a('0x1e')](_0x128a('0x1f'),_0x1356eb+'-'+_0x146b1e+'/'+_0x39be2f)[_0x128a('0x1a')](_0x4e8d2b);}return null;};}function patchUpdates(_0x1169d4){return function(_0x31abe8){try{jsonpatch['apply'](_0x31abe8,_0x1169d4,!![]);}catch(_0x2ff30a){return BPromise[_0x128a('0x20')](_0x2ff30a);}return _0x31abe8[_0x128a('0x21')]();};}function saveUpdates(_0xb3bc04,_0x20141e){return function(_0x1a4d47){if(_0x1a4d47){return _0x1a4d47[_0x128a('0x22')](_0xb3bc04)[_0x128a('0x23')](function(_0x3169a0){return _0x3169a0;});}return null;};}function removeEntity(_0x1266d9,_0x5e7da8){return function(_0x1f5f71){if(_0x1f5f71){return _0x1f5f71[_0x128a('0x24')]()['then'](function(){_0x1266d9[_0x128a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57faa8,_0x4bbb4d){return function(_0x43b8c4){if(!_0x43b8c4){_0x57faa8['sendStatus'](0x194);}return _0x43b8c4;};}function handleError(_0x2d042d,_0x42b729){_0x42b729=_0x42b729||0x1f4;return function(_0xfccafd){logger[_0x128a('0x25')](_0xfccafd[_0x128a('0x26')]);if(_0xfccafd[_0x128a('0x27')]){delete _0xfccafd[_0x128a('0x27')];}_0x2d042d[_0x128a('0x18')](_0x42b729)[_0x128a('0x28')](_0xfccafd);};}exports['index']=function(_0x22669e,_0x1deba0){var _0x105f1f={},_0x14d142={},_0x63baf8={'count':0x0,'rows':[]};var _0x426fa7=_[_0x128a('0x29')](db[_0x128a('0x2a')][_0x128a('0x2b')],function(_0x493f0c){return{'name':_0x493f0c[_0x128a('0x2c')],'type':_0x493f0c[_0x128a('0x2d')][_0x128a('0x2e')]};});_0x14d142[_0x128a('0x2f')]=_[_0x128a('0x29')](_0x426fa7,_0x128a('0x27'));_0x14d142[_0x128a('0x30')]=_['keys'](_0x22669e[_0x128a('0x30')]);_0x14d142[_0x128a('0x31')]=_['intersection'](_0x14d142[_0x128a('0x2f')],_0x14d142[_0x128a('0x30')]);_0x105f1f['attributes']=_['intersection'](_0x14d142[_0x128a('0x2f')],qs['fields'](_0x22669e['query'][_0x128a('0x32')]));_0x105f1f[_0x128a('0x33')]=_0x105f1f['attributes'][_0x128a('0x34')]?_0x105f1f[_0x128a('0x33')]:_0x14d142[_0x128a('0x2f')];if(!_0x22669e[_0x128a('0x30')][_0x128a('0x35')](_0x128a('0x36'))){_0x105f1f['limit']=qs[_0x128a('0x1d')](_0x22669e[_0x128a('0x30')][_0x128a('0x1d')]);_0x105f1f[_0x128a('0x1c')]=qs['offset'](_0x22669e[_0x128a('0x30')][_0x128a('0x1c')]);}_0x105f1f[_0x128a('0x37')]=qs[_0x128a('0x38')](_0x22669e[_0x128a('0x30')]['sort']);_0x105f1f[_0x128a('0x39')]=qs[_0x128a('0x31')](_[_0x128a('0x3a')](_0x22669e['query'],_0x14d142[_0x128a('0x31')]),_0x426fa7);if(_0x22669e[_0x128a('0x30')]['filter']){_0x105f1f[_0x128a('0x39')]=_[_0x128a('0x3b')](_0x105f1f['where'],{'$or':_[_0x128a('0x29')](_0x426fa7,function(_0x533da7){if(_0x533da7[_0x128a('0x2d')]!==_0x128a('0x3c')){var _0x55f516={};_0x55f516[_0x533da7[_0x128a('0x27')]]={'$like':'%'+_0x22669e[_0x128a('0x30')][_0x128a('0x3d')]+'%'};return _0x55f516;}})});}_0x105f1f=_['merge']({},_0x105f1f,_0x22669e[_0x128a('0x3e')]);var _0x4c3cb9={'where':_0x105f1f[_0x128a('0x39')]};return db[_0x128a('0x2a')][_0x128a('0x1b')](_0x4c3cb9)['then'](function(_0x4fe7c4){_0x63baf8[_0x128a('0x1b')]=_0x4fe7c4;if(_0x22669e[_0x128a('0x30')][_0x128a('0x3f')]){_0x105f1f[_0x128a('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x105f1f);})[_0x128a('0x23')](function(_0x1401ef){_0x63baf8[_0x128a('0x41')]=_0x1401ef;return _0x63baf8;})['then'](respondWithFilteredResult(_0x1deba0,_0x105f1f))[_0x128a('0x42')](handleError(_0x1deba0,null));};exports['show']=function(_0x7f1220,_0x3b45d9){var _0x4510fc={'raw':!![],'where':{'id':_0x7f1220[_0x128a('0x43')]['id']}},_0x2eda0c={};_0x2eda0c[_0x128a('0x2f')]=_[_0x128a('0x44')](db['JscriptyAnswerReport']['rawAttributes']);_0x2eda0c['query']=_[_0x128a('0x44')](_0x7f1220['query']);_0x2eda0c[_0x128a('0x31')]=_[_0x128a('0x45')](_0x2eda0c[_0x128a('0x2f')],_0x2eda0c[_0x128a('0x30')]);_0x4510fc[_0x128a('0x33')]=_[_0x128a('0x45')](_0x2eda0c[_0x128a('0x2f')],qs[_0x128a('0x32')](_0x7f1220['query']['fields']));_0x4510fc[_0x128a('0x33')]=_0x4510fc['attributes'][_0x128a('0x34')]?_0x4510fc[_0x128a('0x33')]:_0x2eda0c[_0x128a('0x2f')];if(_0x7f1220['query'][_0x128a('0x3f')]){_0x4510fc[_0x128a('0x40')]=[{'all':!![]}];}_0x4510fc=_[_0x128a('0x3b')]({},_0x4510fc,_0x7f1220[_0x128a('0x3e')]);return db[_0x128a('0x2a')]['find'](_0x4510fc)[_0x128a('0x23')](handleEntityNotFound(_0x3b45d9,null))['then'](respondWithResult(_0x3b45d9,null))[_0x128a('0x42')](handleError(_0x3b45d9,null));};exports[_0x128a('0x46')]=function(_0x21deb8,_0x30ad53){return db[_0x128a('0x2a')]['create'](_0x21deb8[_0x128a('0x47')],{})[_0x128a('0x23')](respondWithResult(_0x30ad53,0xc9))[_0x128a('0x42')](handleError(_0x30ad53,null));};exports[_0x128a('0x22')]=function(_0x25d919,_0x1e9e00){if(_0x25d919[_0x128a('0x47')]['id']){delete _0x25d919[_0x128a('0x47')]['id'];}return db[_0x128a('0x2a')]['find']({'where':{'id':_0x25d919[_0x128a('0x43')]['id']}})[_0x128a('0x23')](handleEntityNotFound(_0x1e9e00,null))[_0x128a('0x23')](saveUpdates(_0x25d919[_0x128a('0x47')],null))[_0x128a('0x23')](respondWithResult(_0x1e9e00,null))[_0x128a('0x42')](handleError(_0x1e9e00,null));};exports[_0x128a('0x24')]=function(_0x57bfca,_0x596f8c){return db[_0x128a('0x2a')][_0x128a('0x48')]({'where':{'id':_0x57bfca[_0x128a('0x43')]['id']}})[_0x128a('0x23')](handleEntityNotFound(_0x596f8c,null))[_0x128a('0x23')](removeEntity(_0x596f8c,null))[_0x128a('0x42')](handleError(_0x596f8c,null));};exports['describe']=function(_0x260fa0,_0x1fc288){return db[_0x128a('0x2a')][_0x128a('0x49')]()[_0x128a('0x23')](respondWithResult(_0x1fc288,null))[_0x128a('0x42')](handleError(_0x1fc288,null));}; \ No newline at end of file +var _0x72b9=['count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','keys','filters','intersection','query','attributes','fields','model','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','JscriptyAnswerReport','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x4eb972,_0x3d9c2c){var _0x3967d5=function(_0x428127){while(--_0x428127){_0x4eb972['push'](_0x4eb972['shift']());}};_0x3967d5(++_0x3d9c2c);}(_0x72b9,0x1d0));var _0x972b=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x72b9[_0x27bd2c];return _0x3784ea;};'use strict';var pdf=require(_0x972b('0x0'));var emlformat=require(_0x972b('0x1'));var rimraf=require(_0x972b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x972b('0x3'));var rp=require(_0x972b('0x4'));var moment=require(_0x972b('0x5'));var BPromise=require(_0x972b('0x6'));var Mustache=require(_0x972b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x972b('0x8'));var csv=require(_0x972b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x972b('0xa'));var squel=require(_0x972b('0xb'));var crypto=require(_0x972b('0xc'));var jsforce=require(_0x972b('0xd'));var deskjs=require(_0x972b('0xe'));var toCsv=require(_0x972b('0x9'));var querystring=require(_0x972b('0xf'));var Papa=require(_0x972b('0x10'));var Redis=require('ioredis');var authService=require(_0x972b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x972b('0x12'));var logger=require(_0x972b('0x13'))(_0x972b('0x14'));var utils=require(_0x972b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x972b('0x16'));var db=require(_0x972b('0x17'))['db'];function respondWithStatusCode(_0x438c74,_0x4c582c){_0x4c582c=_0x4c582c||0xcc;return function(_0x2f565b){if(_0x2f565b){return _0x438c74[_0x972b('0x18')](_0x4c582c);}return _0x438c74[_0x972b('0x19')](_0x4c582c)['end']();};}function respondWithResult(_0x6baf50,_0x312d1f){_0x312d1f=_0x312d1f||0xc8;return function(_0xd8ff8d){if(_0xd8ff8d){return _0x6baf50[_0x972b('0x19')](_0x312d1f)['json'](_0xd8ff8d);}};}function respondWithFilteredResult(_0x301769,_0x43fd2b){return function(_0x279aca){if(_0x279aca){var _0x26f041=_0x279aca[_0x972b('0x1a')],_0x112f62=_0x43fd2b[_0x972b('0x1b')],_0x6db077=_0x43fd2b[_0x972b('0x1b')]+_0x43fd2b[_0x972b('0x1c')],_0x441ad2;if(_0x6db077>=_0x26f041){_0x6db077=_0x26f041;_0x441ad2=0xc8;}else{_0x441ad2=0xce;}_0x301769[_0x972b('0x19')](_0x441ad2);return _0x301769[_0x972b('0x1d')](_0x972b('0x1e'),_0x112f62+'-'+_0x6db077+'/'+_0x26f041)[_0x972b('0x1f')](_0x279aca);}return null;};}function patchUpdates(_0x49b9a3){return function(_0x1f94d9){try{jsonpatch['apply'](_0x1f94d9,_0x49b9a3,!![]);}catch(_0x563918){return BPromise[_0x972b('0x20')](_0x563918);}return _0x1f94d9[_0x972b('0x21')]();};}function saveUpdates(_0x679aa,_0x17c501){return function(_0x166f4e){if(_0x166f4e){return _0x166f4e[_0x972b('0x22')](_0x679aa)[_0x972b('0x23')](function(_0xb2842e){return _0xb2842e;});}return null;};}function removeEntity(_0x348169,_0x318f75){return function(_0x3aac16){if(_0x3aac16){return _0x3aac16[_0x972b('0x24')]()[_0x972b('0x23')](function(){_0x348169[_0x972b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ae35,_0x365a63){return function(_0x49114){if(!_0x49114){_0x45ae35[_0x972b('0x18')](0x194);}return _0x49114;};}function handleError(_0x23130e,_0x45a060){_0x45a060=_0x45a060||0x1f4;return function(_0x3fe179){logger[_0x972b('0x25')](_0x3fe179[_0x972b('0x26')]);if(_0x3fe179[_0x972b('0x27')]){delete _0x3fe179[_0x972b('0x27')];}_0x23130e[_0x972b('0x19')](_0x45a060)[_0x972b('0x28')](_0x3fe179);};}exports['index']=function(_0x43c3aa,_0x4d0398){var _0x16dc69={},_0x52d3f0={},_0x3f86ce={'count':0x0,'rows':[]};var _0x47a1fd=_[_0x972b('0x29')](db['JscriptyAnswerReport'][_0x972b('0x2a')],function(_0x4fcba1){return{'name':_0x4fcba1['fieldName'],'type':_0x4fcba1[_0x972b('0x2b')][_0x972b('0x2c')]};});_0x52d3f0['model']=_[_0x972b('0x29')](_0x47a1fd,_0x972b('0x27'));_0x52d3f0['query']=_[_0x972b('0x2d')](_0x43c3aa['query']);_0x52d3f0[_0x972b('0x2e')]=_[_0x972b('0x2f')](_0x52d3f0['model'],_0x52d3f0[_0x972b('0x30')]);_0x16dc69[_0x972b('0x31')]=_['intersection'](_0x52d3f0['model'],qs[_0x972b('0x32')](_0x43c3aa['query'][_0x972b('0x32')]));_0x16dc69[_0x972b('0x31')]=_0x16dc69['attributes']['length']?_0x16dc69['attributes']:_0x52d3f0[_0x972b('0x33')];if(!_0x43c3aa[_0x972b('0x30')][_0x972b('0x34')](_0x972b('0x35'))){_0x16dc69[_0x972b('0x1c')]=qs['limit'](_0x43c3aa[_0x972b('0x30')][_0x972b('0x1c')]);_0x16dc69['offset']=qs[_0x972b('0x1b')](_0x43c3aa[_0x972b('0x30')][_0x972b('0x1b')]);}_0x16dc69[_0x972b('0x36')]=qs[_0x972b('0x37')](_0x43c3aa['query'][_0x972b('0x37')]);_0x16dc69['where']=qs[_0x972b('0x2e')](_[_0x972b('0x38')](_0x43c3aa[_0x972b('0x30')],_0x52d3f0['filters']),_0x47a1fd);if(_0x43c3aa['query'][_0x972b('0x39')]){_0x16dc69['where']=_[_0x972b('0x3a')](_0x16dc69['where'],{'$or':_['map'](_0x47a1fd,function(_0x2928cf){if(_0x2928cf[_0x972b('0x2b')]!=='VIRTUAL'){var _0x538029={};_0x538029[_0x2928cf[_0x972b('0x27')]]={'$like':'%'+_0x43c3aa[_0x972b('0x30')]['filter']+'%'};return _0x538029;}})});}_0x16dc69=_[_0x972b('0x3a')]({},_0x16dc69,_0x43c3aa[_0x972b('0x3b')]);var _0x486af0={'where':_0x16dc69[_0x972b('0x3c')]};return db[_0x972b('0x3d')][_0x972b('0x1a')](_0x486af0)[_0x972b('0x23')](function(_0x1ca3fc){_0x3f86ce[_0x972b('0x1a')]=_0x1ca3fc;if(_0x43c3aa[_0x972b('0x30')]['includeAll']){_0x16dc69[_0x972b('0x3e')]=[{'all':!![]}];}return db[_0x972b('0x3d')][_0x972b('0x3f')](_0x16dc69);})[_0x972b('0x23')](function(_0x350d8d){_0x3f86ce['rows']=_0x350d8d;return _0x3f86ce;})['then'](respondWithFilteredResult(_0x4d0398,_0x16dc69))[_0x972b('0x40')](handleError(_0x4d0398,null));};exports['show']=function(_0x350bc4,_0x539297){var _0x4f3149={'raw':!![],'where':{'id':_0x350bc4[_0x972b('0x41')]['id']}},_0x36dfb1={};_0x36dfb1[_0x972b('0x33')]=_[_0x972b('0x2d')](db['JscriptyAnswerReport'][_0x972b('0x2a')]);_0x36dfb1['query']=_[_0x972b('0x2d')](_0x350bc4[_0x972b('0x30')]);_0x36dfb1[_0x972b('0x2e')]=_['intersection'](_0x36dfb1[_0x972b('0x33')],_0x36dfb1[_0x972b('0x30')]);_0x4f3149[_0x972b('0x31')]=_['intersection'](_0x36dfb1[_0x972b('0x33')],qs[_0x972b('0x32')](_0x350bc4[_0x972b('0x30')]['fields']));_0x4f3149['attributes']=_0x4f3149[_0x972b('0x31')]['length']?_0x4f3149[_0x972b('0x31')]:_0x36dfb1[_0x972b('0x33')];if(_0x350bc4[_0x972b('0x30')][_0x972b('0x42')]){_0x4f3149['include']=[{'all':!![]}];}_0x4f3149=_[_0x972b('0x3a')]({},_0x4f3149,_0x350bc4[_0x972b('0x3b')]);return db[_0x972b('0x3d')]['find'](_0x4f3149)[_0x972b('0x23')](handleEntityNotFound(_0x539297,null))[_0x972b('0x23')](respondWithResult(_0x539297,null))[_0x972b('0x40')](handleError(_0x539297,null));};exports['create']=function(_0x16406d,_0x181558){return db[_0x972b('0x3d')]['create'](_0x16406d[_0x972b('0x43')],{})['then'](respondWithResult(_0x181558,0xc9))['catch'](handleError(_0x181558,null));};exports[_0x972b('0x22')]=function(_0x1642f6,_0x474d9e){if(_0x1642f6[_0x972b('0x43')]['id']){delete _0x1642f6[_0x972b('0x43')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x1642f6[_0x972b('0x41')]['id']}})[_0x972b('0x23')](handleEntityNotFound(_0x474d9e,null))[_0x972b('0x23')](saveUpdates(_0x1642f6[_0x972b('0x43')],null))['then'](respondWithResult(_0x474d9e,null))['catch'](handleError(_0x474d9e,null));};exports[_0x972b('0x24')]=function(_0x223909,_0x4e8b8a){return db[_0x972b('0x3d')][_0x972b('0x44')]({'where':{'id':_0x223909[_0x972b('0x41')]['id']}})[_0x972b('0x23')](handleEntityNotFound(_0x4e8b8a,null))[_0x972b('0x23')](removeEntity(_0x4e8b8a,null))[_0x972b('0x40')](handleError(_0x4e8b8a,null));};exports[_0x972b('0x45')]=function(_0x5445a1,_0x2542b3){return db[_0x972b('0x3d')]['describe']()[_0x972b('0x23')](respondWithResult(_0x2542b3,null))['catch'](handleError(_0x2542b3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index d0876d6..0a7223b 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 _0xdbc4=['bluebird','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment'];(function(_0x15260d,_0x8f3028){var _0x38f3e3=function(_0x2151cd){while(--_0x2151cd){_0x15260d['push'](_0x15260d['shift']());}};_0x38f3e3(++_0x8f3028);}(_0xdbc4,0x164));var _0x4dbc=function(_0x32d26e,_0x24e03c){_0x32d26e=_0x32d26e-0x0;var _0x24fea4=_0xdbc4[_0x32d26e];return _0x24fea4;};'use strict';var _=require(_0x4dbc('0x0'));var util=require(_0x4dbc('0x1'));var logger=require('../../config/logger')(_0x4dbc('0x2'));var moment=require(_0x4dbc('0x3'));var BPromise=require(_0x4dbc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dbc('0x5'));var rimraf=require(_0x4dbc('0x6'));var config=require('../../config/environment');var attributes=require(_0x4dbc('0x7'));module[_0x4dbc('0x8')]=function(_0x4817dc,_0x1f7d40){return _0x4817dc[_0x4dbc('0x9')](_0x4dbc('0xa'),attributes,{'tableName':_0x4dbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4efd=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x30f976,_0x2d86e9){var _0x30ee0f=function(_0xf711e3){while(--_0xf711e3){_0x30f976['push'](_0x30f976['shift']());}};_0x30ee0f(++_0x2d86e9);}(_0x4efd,0x1e8));var _0xd4ef=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x4efd[_0x3ee1fe];return _0x1ae57a;};'use strict';var _=require(_0xd4ef('0x0'));var util=require(_0xd4ef('0x1'));var logger=require(_0xd4ef('0x2'))('api');var moment=require(_0xd4ef('0x3'));var BPromise=require(_0xd4ef('0x4'));var rp=require(_0xd4ef('0x5'));var fs=require('fs');var path=require(_0xd4ef('0x6'));var rimraf=require(_0xd4ef('0x7'));var config=require(_0xd4ef('0x8'));var attributes=require(_0xd4ef('0x9'));module[_0xd4ef('0xa')]=function(_0x501c20,_0x2558ef){return _0x501c20[_0xd4ef('0xb')](_0xd4ef('0xc'),attributes,{'tableName':_0xd4ef('0xd'),'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 0956f45..4834d8f 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 _0x2be5=['client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2be5,0xc5));var _0x52be=function(_0x2711b2,_0x5d6c25){_0x2711b2=_0x2711b2-0x0;var _0x5f5533=_0x2be5[_0x2711b2];return _0x5f5533;};'use strict';var _=require(_0x52be('0x0'));var util=require(_0x52be('0x1'));var moment=require(_0x52be('0x2'));var BPromise=require(_0x52be('0x3'));var rs=require(_0x52be('0x4'));var fs=require('fs');var Redis=require(_0x52be('0x5'));var db=require(_0x52be('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x52be('0x7'));var config=require(_0x52be('0x8'));var jayson=require(_0x52be('0x9'));var client=jayson[_0x52be('0xa')][_0x52be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43425c,_0x2219f6,_0x207b7d){return new BPromise(function(_0x27840a,_0x5b651a){return client[_0x52be('0xc')](_0x43425c,_0x207b7d)['then'](function(_0xf0f3b3){logger[_0x52be('0xd')](_0x52be('0xe'),_0x2219f6,_0x52be('0xf'));logger['debug'](_0x52be('0x10'),_0x2219f6,'request\x20sent',JSON[_0x52be('0x11')](_0xf0f3b3));if(_0xf0f3b3[_0x52be('0x12')]){if(_0xf0f3b3[_0x52be('0x12')][_0x52be('0x13')]===0x1f4){logger[_0x52be('0x12')](_0x52be('0xe'),_0x2219f6,_0xf0f3b3['error'][_0x52be('0x14')]);return _0x5b651a(_0xf0f3b3[_0x52be('0x12')][_0x52be('0x14')]);}logger[_0x52be('0x12')](_0x52be('0xe'),_0x2219f6,_0xf0f3b3[_0x52be('0x12')]['message']);return _0x27840a(_0xf0f3b3['error']['message']);}else{logger[_0x52be('0xd')](_0x52be('0xe'),_0x2219f6,_0x52be('0xf'));_0x27840a(_0xf0f3b3[_0x52be('0x15')][_0x52be('0x14')]);}})[_0x52be('0x16')](function(_0x1f9a6b){logger['error'](_0x52be('0xe'),_0x2219f6,_0x1f9a6b);_0x5b651a(_0x1f9a6b);});});} \ No newline at end of file +var _0x2bd9=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19a741,_0x237fb5){var _0x465d18=function(_0x2ee5e7){while(--_0x2ee5e7){_0x19a741['push'](_0x19a741['shift']());}};_0x465d18(++_0x237fb5);}(_0x2bd9,0x90));var _0x92bd=function(_0x2981bb,_0xbaee9a){_0x2981bb=_0x2981bb-0x0;var _0x1f8292=_0x2bd9[_0x2981bb];return _0x1f8292;};'use strict';var _=require(_0x92bd('0x0'));var util=require(_0x92bd('0x1'));var moment=require(_0x92bd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92bd('0x3'));var db=require(_0x92bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x92bd('0x5'))(_0x92bd('0x6'));var config=require(_0x92bd('0x7'));var jayson=require(_0x92bd('0x8'));var client=jayson[_0x92bd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3359,_0x4feb99,_0x2c1672){return new BPromise(function(_0x32b265,_0x70294f){return client[_0x92bd('0xa')](_0x4b3359,_0x2c1672)[_0x92bd('0xb')](function(_0x2397e1){logger[_0x92bd('0xc')](_0x92bd('0xd'),_0x4feb99,_0x92bd('0xe'));logger[_0x92bd('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4feb99,'request\x20sent',JSON[_0x92bd('0x10')](_0x2397e1));if(_0x2397e1[_0x92bd('0x11')]){if(_0x2397e1[_0x92bd('0x11')][_0x92bd('0x12')]===0x1f4){logger['error'](_0x92bd('0xd'),_0x4feb99,_0x2397e1['error'][_0x92bd('0x13')]);return _0x70294f(_0x2397e1[_0x92bd('0x11')][_0x92bd('0x13')]);}logger[_0x92bd('0x11')](_0x92bd('0xd'),_0x4feb99,_0x2397e1['error']['message']);return _0x32b265(_0x2397e1[_0x92bd('0x11')][_0x92bd('0x13')]);}else{logger[_0x92bd('0xc')](_0x92bd('0xd'),_0x4feb99,_0x92bd('0xe'));_0x32b265(_0x2397e1[_0x92bd('0x14')][_0x92bd('0x13')]);}})[_0x92bd('0x15')](function(_0x177c02){logger[_0x92bd('0x11')](_0x92bd('0xd'),_0x4feb99,_0x177c02);_0x70294f(_0x177c02);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3fd21b6..0650183 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 _0x7857=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','delete','destroy'];(function(_0x1d441c,_0x263409){var _0x3f9256=function(_0x2eeba5){while(--_0x2eeba5){_0x1d441c['push'](_0x1d441c['shift']());}};_0x3f9256(++_0x263409);}(_0x7857,0x120));var _0x7785=function(_0x373220,_0x1dfddb){_0x373220=_0x373220-0x0;var _0xa3f930=_0x7857[_0x373220];return _0xa3f930;};'use strict';var multer=require(_0x7785('0x0'));var util=require(_0x7785('0x1'));var path=require(_0x7785('0x2'));var timeout=require(_0x7785('0x3'));var express=require(_0x7785('0x4'));var router=express[_0x7785('0x5')]();var auth=require(_0x7785('0x6'));var interaction=require(_0x7785('0x7'));var config=require(_0x7785('0x8'));var controller=require(_0x7785('0x9'));router[_0x7785('0xa')]('/',auth['isAuthenticated'](),controller[_0x7785('0xb')]);router[_0x7785('0xa')](_0x7785('0xc'),auth[_0x7785('0xd')](),controller[_0x7785('0xe')]);router[_0x7785('0xa')](_0x7785('0xf'),auth[_0x7785('0xd')](),controller['getSessions']);router[_0x7785('0xa')](_0x7785('0x10'),auth[_0x7785('0xd')](),controller[_0x7785('0x11')]);router[_0x7785('0xa')](_0x7785('0x12'),auth[_0x7785('0xd')](),timeout(_0x7785('0x13')),controller['getSummary']);router[_0x7785('0x14')]('/',auth[_0x7785('0xd')](),controller['create']);router[_0x7785('0x14')](_0x7785('0x15'),auth[_0x7785('0xd')](),controller['clone']);router['put']('/:id',auth[_0x7785('0xd')](),controller['update']);router[_0x7785('0x16')](_0x7785('0xc'),auth[_0x7785('0xd')](),controller[_0x7785('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4e7e=['Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','/:id/clone','clone','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2a8bc9,_0x354eb1){var _0x3ced78=function(_0x7cb45b){while(--_0x7cb45b){_0x2a8bc9['push'](_0x2a8bc9['shift']());}};_0x3ced78(++_0x354eb1);}(_0x4e7e,0x93));var _0xe4e7=function(_0x141401,_0x114084){_0x141401=_0x141401-0x0;var _0x5a9ebe=_0x4e7e[_0x141401];return _0x5a9ebe;};'use strict';var multer=require(_0xe4e7('0x0'));var util=require(_0xe4e7('0x1'));var path=require(_0xe4e7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe4e7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe4e7('0x4'));var config=require(_0xe4e7('0x5'));var controller=require(_0xe4e7('0x6'));router[_0xe4e7('0x7')]('/',auth[_0xe4e7('0x8')](),controller[_0xe4e7('0x9')]);router[_0xe4e7('0x7')]('/:id',auth[_0xe4e7('0x8')](),controller[_0xe4e7('0xa')]);router['get'](_0xe4e7('0xb'),auth[_0xe4e7('0x8')](),controller[_0xe4e7('0xc')]);router[_0xe4e7('0x7')](_0xe4e7('0xd'),auth[_0xe4e7('0x8')](),controller[_0xe4e7('0xe')]);router[_0xe4e7('0x7')](_0xe4e7('0xf'),auth['isAuthenticated'](),timeout('30s'),controller[_0xe4e7('0x10')]);router['post']('/',auth[_0xe4e7('0x8')](),controller['create']);router[_0xe4e7('0x11')](_0xe4e7('0x12'),auth['isAuthenticated'](),controller[_0xe4e7('0x13')]);router['put'](_0xe4e7('0x14'),auth['isAuthenticated'](),controller[_0xe4e7('0x15')]);router[_0xe4e7('0x16')](_0xe4e7('0x14'),auth[_0xe4e7('0x8')](),controller[_0xe4e7('0x17')]);module[_0xe4e7('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 366eb74..174fd5b 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 _0xf2e7=['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','util'];(function(_0x55c518,_0x9bed09){var _0x290607=function(_0x4508b5){while(--_0x4508b5){_0x55c518['push'](_0x55c518['shift']());}};_0x290607(++_0x9bed09);}(_0xf2e7,0x193));var _0x7f2e=function(_0x3c2fdf,_0x20e8ca){_0x3c2fdf=_0x3c2fdf-0x0;var _0x5da2a4=_0xf2e7[_0x3c2fdf];return _0x5da2a4;};'use strict';var Sequelize=require(_0x7f2e('0x0'));var _=require('lodash');var util=require(_0x7f2e('0x1'));module['exports']={'name':{'type':Sequelize[_0x7f2e('0x2')],'unique':_0x7f2e('0x3')},'description':{'type':Sequelize[_0x7f2e('0x2')]},'formData':{'type':Sequelize[_0x7f2e('0x4')](_0x7f2e('0x5')),'set':function(_0x2ea9e2){if(_['isObjectLike'](_0x2ea9e2)){this[_0x7f2e('0x6')](_0x7f2e('0x7'),JSON[_0x7f2e('0x8')](_0x2ea9e2));}else if(_[_0x7f2e('0x9')](_0x2ea9e2)){this[_0x7f2e('0x6')](_0x7f2e('0x7'),_0x2ea9e2);}else{this[_0x7f2e('0x6')](_0x7f2e('0x7'),util[_0x7f2e('0xa')](_0x7f2e('0xb'),this[_0x7f2e('0xc')](_0x7f2e('0x3'))||'',this[_0x7f2e('0xc')](_0x7f2e('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7f2e('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7f2e('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xa864=['name','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','util','exports','STRING'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa864,0x83));var _0x4a86=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xa864[_0x26b8b5];return _0x2150a9;};'use strict';var Sequelize=require(_0x4a86('0x0'));var _=require('lodash');var util=require(_0x4a86('0x1'));module[_0x4a86('0x2')]={'name':{'type':Sequelize[_0x4a86('0x3')],'unique':_0x4a86('0x4')},'description':{'type':Sequelize[_0x4a86('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x4a86('0x5')),'set':function(_0x4e6563){if(_[_0x4a86('0x6')](_0x4e6563)){this[_0x4a86('0x7')](_0x4a86('0x8'),JSON[_0x4a86('0x9')](_0x4e6563));}else if(_[_0x4a86('0xa')](_0x4e6563)){this['setDataValue'](_0x4a86('0x8'),_0x4e6563);}else{this[_0x4a86('0x7')]('formData',util[_0x4a86('0xb')](_0x4a86('0xc'),this['getDataValue']('name')||'',this[_0x4a86('0xd')](_0x4a86('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9631686..7ec7e31 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 _0x0b2c=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','VIRTUAL','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','ProjectId','options','getAnswers','JscriptyAnswerReport','order','number','apply','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','map','JscriptyProject','fieldName','type'];(function(_0x521b61,_0x47e2b4){var _0x476cdf=function(_0xbca2ca){while(--_0xbca2ca){_0x521b61['push'](_0x521b61['shift']());}};_0x476cdf(++_0x47e2b4);}(_0x0b2c,0x1b0));var _0xc0b2=function(_0x4515da,_0x195cfd){_0x4515da=_0x4515da-0x0;var _0x4b14d3=_0x0b2c[_0x4515da];return _0x4b14d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc0b2('0x0'));var rimraf=require(_0xc0b2('0x1'));var zipdir=require(_0xc0b2('0x2'));var jsonpatch=require(_0xc0b2('0x3'));var rp=require(_0xc0b2('0x4'));var moment=require(_0xc0b2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc0b2('0x6'));var util=require(_0xc0b2('0x7'));var path=require('path');var sox=require(_0xc0b2('0x8'));var csv=require(_0xc0b2('0x9'));var ejs=require(_0xc0b2('0xa'));var fs=require('fs');var _=require(_0xc0b2('0xb'));var squel=require(_0xc0b2('0xc'));var crypto=require(_0xc0b2('0xd'));var jsforce=require(_0xc0b2('0xe'));var deskjs=require(_0xc0b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc0b2('0x10'));var Papa=require(_0xc0b2('0x11'));var Redis=require(_0xc0b2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc0b2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc0b2('0x14'));var utils=require('../../config/utils');var config=require(_0xc0b2('0x15'));var licenseUtil=require(_0xc0b2('0x16'));var db=require(_0xc0b2('0x17'))['db'];function respondWithStatusCode(_0x2aa2c2,_0x16f752){_0x16f752=_0x16f752||0xcc;return function(_0x2f6fb6){if(_0x2f6fb6){return _0x2aa2c2[_0xc0b2('0x18')](_0x16f752);}return _0x2aa2c2[_0xc0b2('0x19')](_0x16f752)[_0xc0b2('0x1a')]();};}function respondWithResult(_0x19d9b2,_0xa00db3){_0xa00db3=_0xa00db3||0xc8;return function(_0x5bf646){if(_0x5bf646){return _0x19d9b2['status'](_0xa00db3)[_0xc0b2('0x1b')](_0x5bf646);}};}function respondWithFilteredResult(_0xab3801,_0x516599){return function(_0xe41174){if(_0xe41174){var _0x12d844=_0xe41174[_0xc0b2('0x1c')],_0x53ae90=_0x516599[_0xc0b2('0x1d')],_0x320463=_0x516599['offset']+_0x516599['limit'],_0x50225b;if(_0x320463>=_0x12d844){_0x320463=_0x12d844;_0x50225b=0xc8;}else{_0x50225b=0xce;}_0xab3801[_0xc0b2('0x19')](_0x50225b);return _0xab3801[_0xc0b2('0x1e')](_0xc0b2('0x1f'),_0x53ae90+'-'+_0x320463+'/'+_0x12d844)['json'](_0xe41174);}return null;};}function patchUpdates(_0x4a750f){return function(_0x2a3d43){try{jsonpatch['apply'](_0x2a3d43,_0x4a750f,!![]);}catch(_0x444420){return BPromise[_0xc0b2('0x20')](_0x444420);}return _0x2a3d43[_0xc0b2('0x21')]();};}function saveUpdates(_0x1235ac,_0x55b286){return function(_0x2576b4){if(_0x2576b4){return _0x2576b4['update'](_0x1235ac)[_0xc0b2('0x22')](function(_0xc246fd){return _0xc246fd;});}return null;};}function removeEntity(_0x49797c,_0x2d5890){return function(_0x3d01b7){if(_0x3d01b7){return _0x3d01b7['destroy']()['then'](function(){var _0xe4191b=_0x3d01b7[_0xc0b2('0x23')]({'plain':!![]});var _0x61c01=_0xc0b2('0x24');return db[_0xc0b2('0x25')][_0xc0b2('0x26')]({'where':{'type':_0x61c01,'resourceId':_0xe4191b['id']}})[_0xc0b2('0x22')](function(){return _0x3d01b7;});})[_0xc0b2('0x22')](function(){_0x49797c[_0xc0b2('0x19')](0xcc)[_0xc0b2('0x1a')]();});}};}function handleEntityNotFound(_0x56ba7e,_0xfaa9eb){return function(_0x18148d){if(!_0x18148d){_0x56ba7e[_0xc0b2('0x18')](0x194);}return _0x18148d;};}function handleError(_0xa1a226,_0x480a4f){_0x480a4f=_0x480a4f||0x1f4;return function(_0x227f9a){logger[_0xc0b2('0x27')](_0x227f9a[_0xc0b2('0x28')]);if(_0x227f9a[_0xc0b2('0x29')]){delete _0x227f9a['name'];}_0xa1a226[_0xc0b2('0x19')](_0x480a4f)[_0xc0b2('0x2a')](_0x227f9a);};}exports[_0xc0b2('0x2b')]=function(_0x134719,_0x16a022){var _0x435163={},_0x423d88={},_0xb5448={'count':0x0,'rows':[]};var _0x2f30f9=_[_0xc0b2('0x2c')](db[_0xc0b2('0x2d')]['rawAttributes'],function(_0x239572){return{'name':_0x239572[_0xc0b2('0x2e')],'type':_0x239572[_0xc0b2('0x2f')][_0xc0b2('0x30')]};});_0x423d88[_0xc0b2('0x31')]=_['map'](_0x2f30f9,_0xc0b2('0x29'));_0x423d88[_0xc0b2('0x32')]=_[_0xc0b2('0x33')](_0x134719[_0xc0b2('0x32')]);_0x423d88[_0xc0b2('0x34')]=_[_0xc0b2('0x35')](_0x423d88[_0xc0b2('0x31')],_0x423d88[_0xc0b2('0x32')]);_0x435163[_0xc0b2('0x36')]=_[_0xc0b2('0x35')](_0x423d88[_0xc0b2('0x31')],qs['fields'](_0x134719[_0xc0b2('0x32')][_0xc0b2('0x37')]));_0x435163[_0xc0b2('0x36')]=_0x435163['attributes'][_0xc0b2('0x38')]?_0x435163[_0xc0b2('0x36')]:_0x423d88[_0xc0b2('0x31')];if(!_0x134719[_0xc0b2('0x32')][_0xc0b2('0x39')](_0xc0b2('0x3a'))){_0x435163[_0xc0b2('0x3b')]=qs[_0xc0b2('0x3b')](_0x134719[_0xc0b2('0x32')][_0xc0b2('0x3b')]);_0x435163[_0xc0b2('0x1d')]=qs[_0xc0b2('0x1d')](_0x134719[_0xc0b2('0x32')][_0xc0b2('0x1d')]);}_0x435163['order']=qs[_0xc0b2('0x3c')](_0x134719['query']['sort']);_0x435163['where']=qs[_0xc0b2('0x34')](_[_0xc0b2('0x3d')](_0x134719[_0xc0b2('0x32')],_0x423d88[_0xc0b2('0x34')]),_0x2f30f9);if(_0x134719['query']['filter']){_0x435163['where']=_['merge'](_0x435163[_0xc0b2('0x3e')],{'$or':_[_0xc0b2('0x2c')](_0x2f30f9,function(_0x1eecb5){if(_0x1eecb5['type']!==_0xc0b2('0x3f')){var _0x24f765={};_0x24f765[_0x1eecb5[_0xc0b2('0x29')]]={'$like':'%'+_0x134719[_0xc0b2('0x32')][_0xc0b2('0x40')]+'%'};return _0x24f765;}})});}_0x435163=_[_0xc0b2('0x41')]({},_0x435163,_0x134719['options']);var _0x344b98={'where':_0x435163[_0xc0b2('0x3e')]};return db[_0xc0b2('0x2d')][_0xc0b2('0x1c')](_0x344b98)[_0xc0b2('0x22')](function(_0x270863){_0xb5448['count']=_0x270863;if(_0x134719[_0xc0b2('0x32')][_0xc0b2('0x42')]){_0x435163['include']=[{'all':!![]}];}return db[_0xc0b2('0x2d')][_0xc0b2('0x43')](_0x435163);})[_0xc0b2('0x22')](function(_0x218c13){_0xb5448[_0xc0b2('0x44')]=_0x218c13;return _0xb5448;})[_0xc0b2('0x22')](respondWithFilteredResult(_0x16a022,_0x435163))[_0xc0b2('0x45')](handleError(_0x16a022,null));};exports[_0xc0b2('0x46')]=function(_0x2562a6,_0x43f8b3){var _0x94410e={'raw':![],'where':{'id':_0x2562a6[_0xc0b2('0x47')]['id']}},_0x38139e={};_0x38139e[_0xc0b2('0x31')]=_[_0xc0b2('0x33')](db['JscriptyProject'][_0xc0b2('0x48')]);_0x38139e[_0xc0b2('0x32')]=_[_0xc0b2('0x33')](_0x2562a6[_0xc0b2('0x32')]);_0x38139e[_0xc0b2('0x34')]=_[_0xc0b2('0x35')](_0x38139e[_0xc0b2('0x31')],_0x38139e[_0xc0b2('0x32')]);_0x94410e[_0xc0b2('0x36')]=_[_0xc0b2('0x35')](_0x38139e[_0xc0b2('0x31')],qs['fields'](_0x2562a6[_0xc0b2('0x32')][_0xc0b2('0x37')]));_0x94410e[_0xc0b2('0x36')]=_0x94410e[_0xc0b2('0x36')][_0xc0b2('0x38')]?_0x94410e[_0xc0b2('0x36')]:_0x38139e['model'];if(_0x2562a6[_0xc0b2('0x32')]['includeAll']){_0x94410e[_0xc0b2('0x49')]=[{'all':!![]}];}_0x94410e=_[_0xc0b2('0x41')]({},_0x94410e,_0x2562a6['options']);return db[_0xc0b2('0x2d')][_0xc0b2('0x4a')](_0x94410e)[_0xc0b2('0x22')](handleEntityNotFound(_0x43f8b3,null))['then'](respondWithResult(_0x43f8b3,null))[_0xc0b2('0x45')](handleError(_0x43f8b3,null));};exports[_0xc0b2('0x4b')]=function(_0x450526,_0x2a8b96){return db[_0xc0b2('0x2d')][_0xc0b2('0x4b')](_0x450526[_0xc0b2('0x4c')],{})[_0xc0b2('0x22')](function(_0x77b891){var _0x25cdd7=_0x450526[_0xc0b2('0x4d')][_0xc0b2('0x23')]({'plain':!![]});if(!_0x25cdd7)throw new Error(_0xc0b2('0x4e'));if(_0x25cdd7[_0xc0b2('0x4f')]===_0xc0b2('0x4d')){var _0xcb49ea=_0x77b891[_0xc0b2('0x23')]({'plain':!![]});var _0xa38073=_0xc0b2('0x24');return db[_0xc0b2('0x50')][_0xc0b2('0x4a')]({'where':{'name':_0xa38073,'userProfileId':_0x25cdd7[_0xc0b2('0x51')]},'raw':!![]})[_0xc0b2('0x22')](function(_0x56412a){if(_0x56412a&&_0x56412a[_0xc0b2('0x52')]===0x0){return db[_0xc0b2('0x25')]['create']({'name':_0xcb49ea[_0xc0b2('0x29')],'resourceId':_0xcb49ea['id'],'type':_0x56412a[_0xc0b2('0x29')],'sectionId':_0x56412a['id']},{})[_0xc0b2('0x22')](function(){return _0x77b891;});}else{return _0x77b891;}})[_0xc0b2('0x45')](function(_0xc275b4){logger[_0xc0b2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc275b4);throw _0xc275b4;});}return _0x77b891;})['then'](respondWithResult(_0x2a8b96,0xc9))[_0xc0b2('0x45')](handleError(_0x2a8b96,null));};exports[_0xc0b2('0x53')]=function(_0x3d6f69,_0x606dd){var _0x4441cc={'where':{'id':_0x3d6f69[_0xc0b2('0x47')]['id']}},_0x5823a4={};_0x5823a4[_0xc0b2('0x31')]=_[_0xc0b2('0x33')](db[_0xc0b2('0x2d')]['rawAttributes']);_0x4441cc['attributes']=_[_0xc0b2('0x35')](_0x5823a4[_0xc0b2('0x31')],qs[_0xc0b2('0x37')](_0x3d6f69[_0xc0b2('0x32')][_0xc0b2('0x37')]));_0x4441cc[_0xc0b2('0x36')]=_0x4441cc[_0xc0b2('0x36')][_0xc0b2('0x38')]?_0x4441cc[_0xc0b2('0x36')]:_0x5823a4[_0xc0b2('0x31')];if(_0x3d6f69[_0xc0b2('0x32')][_0xc0b2('0x42')]){_0x4441cc[_0xc0b2('0x49')]=[{'all':!![]}];}_0x4441cc=_['merge']({},_0x4441cc,_0x3d6f69['options']);return db[_0xc0b2('0x2d')]['find'](_0x4441cc)[_0xc0b2('0x22')](handleEntityNotFound(_0x606dd,null))['then'](function(_0x5f1b42){if(_0x5f1b42){var _0xa8e17a=_0x5f1b42['get']({'plain':!![]});_0xa8e17a=qs[_0xc0b2('0x54')](_0xa8e17a,['id','createdAt',_0xc0b2('0x55')]);_0x3d6f69['body']=_[_0xc0b2('0x54')](_0x3d6f69['body'],['id','createdAt',_0xc0b2('0x55')]);return db[_0xc0b2('0x2d')]['create'](_[_0xc0b2('0x41')](_0xa8e17a,_0x3d6f69[_0xc0b2('0x4c')]),{'include':_0x3d6f69['query'][_0xc0b2('0x42')]?[{'all':!![]}]:undefined})[_0xc0b2('0x22')](function(_0x438fce){var _0x38b179=_0x3d6f69[_0xc0b2('0x4d')][_0xc0b2('0x23')]({'plain':!![]});if(!_0x38b179)throw new Error(_0xc0b2('0x4e'));if(_0x38b179['role']===_0xc0b2('0x4d')){var _0x1522b5=_0x438fce['get']({'plain':!![]});var _0x229520=_0xc0b2('0x24');return db['UserProfileSection'][_0xc0b2('0x4a')]({'where':{'name':_0x229520,'userProfileId':_0x38b179[_0xc0b2('0x51')]},'raw':!![]})[_0xc0b2('0x22')](function(_0xd150c5){if(_0xd150c5&&_0xd150c5[_0xc0b2('0x52')]===0x0){return db[_0xc0b2('0x25')][_0xc0b2('0x4b')]({'name':_0x1522b5[_0xc0b2('0x29')],'resourceId':_0x1522b5['id'],'type':_0xd150c5[_0xc0b2('0x29')],'sectionId':_0xd150c5['id']},{})[_0xc0b2('0x22')](function(){return _0x438fce;});}else{return _0x438fce;}})[_0xc0b2('0x45')](function(_0x2f67e3){logger[_0xc0b2('0x27')](_0xc0b2('0x56'),_0x2f67e3);throw _0x2f67e3;});}return _0x438fce;});}})[_0xc0b2('0x22')](respondWithResult(_0x606dd,0xc9))[_0xc0b2('0x45')](handleError(_0x606dd,null));};exports[_0xc0b2('0x57')]=function(_0x16931a,_0x1c9ba1){if(_0x16931a[_0xc0b2('0x4c')]['id']){delete _0x16931a[_0xc0b2('0x4c')]['id'];}return db[_0xc0b2('0x2d')][_0xc0b2('0x4a')]({'where':{'id':_0x16931a[_0xc0b2('0x47')]['id']}})[_0xc0b2('0x22')](handleEntityNotFound(_0x1c9ba1,null))[_0xc0b2('0x22')](saveUpdates(_0x16931a[_0xc0b2('0x4c')],null))[_0xc0b2('0x22')](respondWithResult(_0x1c9ba1,null))[_0xc0b2('0x45')](handleError(_0x1c9ba1,null));};exports[_0xc0b2('0x26')]=function(_0x2cfdf1,_0xc5b6c2){return db[_0xc0b2('0x2d')][_0xc0b2('0x4a')]({'where':{'id':_0x2cfdf1[_0xc0b2('0x47')]['id']}})[_0xc0b2('0x22')](handleEntityNotFound(_0xc5b6c2,null))[_0xc0b2('0x22')](removeEntity(_0xc5b6c2,null))[_0xc0b2('0x45')](handleError(_0xc5b6c2,null));};exports[_0xc0b2('0x58')]=function(_0x2925bc,_0x2c38f3,_0x2c5987){var _0x198049={'raw':!![],'where':{}};var _0x22a34b={};var _0x22a255={'count':0x0,'rows':[]};return db[_0xc0b2('0x2d')][_0xc0b2('0x59')]({'where':{'id':_0x2925bc[_0xc0b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c38f3,null))[_0xc0b2('0x22')](function(_0x54e8a2){if(_0x54e8a2){_0x22a34b[_0xc0b2('0x31')]=_[_0xc0b2('0x33')](db[_0xc0b2('0x5a')][_0xc0b2('0x48')]);_0x22a34b['query']=_[_0xc0b2('0x33')](_0x2925bc[_0xc0b2('0x32')]);_0x22a34b[_0xc0b2('0x34')]=_[_0xc0b2('0x35')](_0x22a34b[_0xc0b2('0x31')],_0x22a34b[_0xc0b2('0x32')]);_0x198049[_0xc0b2('0x36')]=_[_0xc0b2('0x35')](_0x22a34b[_0xc0b2('0x31')],qs[_0xc0b2('0x37')](_0x2925bc[_0xc0b2('0x32')][_0xc0b2('0x37')]));_0x198049['attributes']=_0x198049[_0xc0b2('0x36')][_0xc0b2('0x38')]?_0x198049[_0xc0b2('0x36')]:_0x22a34b[_0xc0b2('0x31')];if(!_0x2925bc[_0xc0b2('0x32')]['hasOwnProperty'](_0xc0b2('0x3a'))){_0x198049[_0xc0b2('0x3b')]=qs[_0xc0b2('0x3b')](_0x2925bc[_0xc0b2('0x32')]['limit']);_0x198049[_0xc0b2('0x1d')]=qs[_0xc0b2('0x1d')](_0x2925bc[_0xc0b2('0x32')][_0xc0b2('0x1d')]);}_0x198049['order']=qs[_0xc0b2('0x3c')](_0x2925bc[_0xc0b2('0x32')][_0xc0b2('0x3c')]);_0x198049[_0xc0b2('0x3e')]=qs[_0xc0b2('0x34')](_[_0xc0b2('0x3d')](_0x2925bc['query'],_0x22a34b[_0xc0b2('0x34')]));_0x198049[_0xc0b2('0x3e')][_0xc0b2('0x5b')]=_0x54e8a2['id'];if(_0x2925bc[_0xc0b2('0x32')]['filter']){_0x198049[_0xc0b2('0x3e')]=_['merge'](_0x198049[_0xc0b2('0x3e')],{'$or':_[_0xc0b2('0x2c')](_0x198049['attributes'],function(_0x3df595){var _0x8face8={};_0x8face8[_0x3df595]={'$like':'%'+_0x2925bc['query'][_0xc0b2('0x40')]+'%'};return _0x8face8;})});}_0x198049=_[_0xc0b2('0x41')]({},_0x198049,_0x2925bc[_0xc0b2('0x5c')]);return db['JscriptySessionReport']['count']({'where':_0x198049[_0xc0b2('0x3e')]})['then'](function(_0xe6fea1){_0x22a255['count']=_0xe6fea1;if(_0x2925bc['query'][_0xc0b2('0x42')]){_0x198049['include']=[{'all':!![]}];}return db[_0xc0b2('0x5a')][_0xc0b2('0x43')](_0x198049);})[_0xc0b2('0x22')](function(_0x237e1c){_0x22a255['rows']=_0x237e1c;return _0x22a255;});}})[_0xc0b2('0x22')](respondWithFilteredResult(_0x2c38f3,_0x198049))[_0xc0b2('0x45')](handleError(_0x2c38f3,null));};exports[_0xc0b2('0x5d')]=function(_0x3e737f,_0x5e4dc1,_0x4e32df){var _0x323962={'raw':!![],'where':{}};var _0x323204={};var _0x54fad3={'count':0x0,'rows':[]};return db[_0xc0b2('0x2d')][_0xc0b2('0x59')]({'where':{'id':_0x3e737f[_0xc0b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e4dc1,null))['then'](function(_0x167043){if(_0x167043){_0x323204[_0xc0b2('0x31')]=_[_0xc0b2('0x33')](db[_0xc0b2('0x5e')][_0xc0b2('0x48')]);_0x323204[_0xc0b2('0x32')]=_[_0xc0b2('0x33')](_0x3e737f[_0xc0b2('0x32')]);_0x323204[_0xc0b2('0x34')]=_[_0xc0b2('0x35')](_0x323204[_0xc0b2('0x31')],_0x323204[_0xc0b2('0x32')]);_0x323962['attributes']=_[_0xc0b2('0x35')](_0x323204[_0xc0b2('0x31')],qs['fields'](_0x3e737f[_0xc0b2('0x32')][_0xc0b2('0x37')]));_0x323962[_0xc0b2('0x36')]=_0x323962[_0xc0b2('0x36')][_0xc0b2('0x38')]?_0x323962[_0xc0b2('0x36')]:_0x323204['model'];if(!_0x3e737f[_0xc0b2('0x32')][_0xc0b2('0x39')](_0xc0b2('0x3a'))){_0x323962['limit']=qs[_0xc0b2('0x3b')](_0x3e737f['query']['limit']);_0x323962['offset']=qs[_0xc0b2('0x1d')](_0x3e737f[_0xc0b2('0x32')][_0xc0b2('0x1d')]);}_0x323962[_0xc0b2('0x5f')]=qs[_0xc0b2('0x3c')](_0x3e737f[_0xc0b2('0x32')][_0xc0b2('0x3c')]);_0x323962['where']=qs[_0xc0b2('0x34')](_[_0xc0b2('0x3d')](_0x3e737f[_0xc0b2('0x32')],_0x323204[_0xc0b2('0x34')]));_0x323962[_0xc0b2('0x3e')][_0xc0b2('0x5b')]=_0x167043['id'];if(_0x3e737f[_0xc0b2('0x32')][_0xc0b2('0x40')]){_0x323962[_0xc0b2('0x3e')]=_[_0xc0b2('0x41')](_0x323962[_0xc0b2('0x3e')],{'$or':_['map'](_0x323962['attributes'],function(_0x31c267){var _0x38c473={};_0x38c473[_0x31c267]={'$like':'%'+_0x3e737f['query'][_0xc0b2('0x40')]+'%'};return _0x38c473;})});}_0x323962=_[_0xc0b2('0x41')]({},_0x323962,_0x3e737f[_0xc0b2('0x5c')]);return db[_0xc0b2('0x5e')][_0xc0b2('0x1c')]({'where':_0x323962[_0xc0b2('0x3e')]})[_0xc0b2('0x22')](function(_0x33663d){_0x54fad3[_0xc0b2('0x1c')]=_0x33663d;if(_0x3e737f[_0xc0b2('0x32')][_0xc0b2('0x42')]){_0x323962['include']=[{'all':!![]}];}return db[_0xc0b2('0x5e')][_0xc0b2('0x43')](_0x323962);})[_0xc0b2('0x22')](function(_0x1b4f65){_0x54fad3[_0xc0b2('0x44')]=_0x1b4f65;return _0x54fad3;});}})[_0xc0b2('0x22')](respondWithFilteredResult(_0x5e4dc1,_0x323962))['catch'](handleError(_0x5e4dc1,null));};function char(_0x468663){return _0xc0b2('0x60')===typeof _0x468663?String['fromCharCode'][_0xc0b2('0x61')](null,arguments):_0x468663;}function needsEncapsulation(_0x38c3d){return!!_0x38c3d&&(_0x38c3d[_0xc0b2('0x62')]()['indexOf'](char(0xd))>=0x0||_0x38c3d[_0xc0b2('0x62')]()[_0xc0b2('0x63')](char(0xa))>=0x0||_0x38c3d[_0xc0b2('0x62')]()[_0xc0b2('0x63')](char(0x2c))>=0x0||_0x38c3d['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x5d31bd){var _0x4ba021=char(0x22),_0x3ed85a='\x5c'+char(0x22),_0x464ec5=_0x5d31bd[_0xc0b2('0x62')]()[_0xc0b2('0x64')](new RegExp(_0x4ba021,'g'),_0x3ed85a);return _0x4ba021+_0x464ec5+_0x4ba021;}exports['getSummary']=function(_0x49ebe4,_0x4c431c,_0x57da3f){var _0x5e6dc6,_0x21f8ee;var _0x28111c={'where':{'ProjectId':_0x49ebe4[_0xc0b2('0x47')]['id']}};if(_0x49ebe4[_0xc0b2('0x32')][_0xc0b2('0x65')]){_0x28111c['where'][_0xc0b2('0x66')]=JSON[_0xc0b2('0x67')](_0x49ebe4[_0xc0b2('0x32')][_0xc0b2('0x65')]);}return db['JscriptySessionReport'][_0xc0b2('0x43')](_0x28111c)[_0xc0b2('0x22')](handleEntityNotFound(_0x4c431c,null))['then'](function(_0x330915){if(_0x330915){_0x5e6dc6=_0x330915;return db[_0xc0b2('0x68')][_0xc0b2('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x5e6dc6,'id')},'ProjectId':_0x49ebe4[_0xc0b2('0x47')]['id']},'order':_0xc0b2('0x69')});}})[_0xc0b2('0x22')](handleEntityNotFound(_0x4c431c,null))['then'](function(_0x4152a7){if(_0x4152a7){_0x21f8ee=_0x4152a7;var _0x16b238={};for(var _0x41a724=0x0,_0x35cca6=_0x21f8ee['length'];_0x41a724<_0x35cca6;_0x41a724++){if(!_0x16b238[_0xc0b2('0x39')](_0x21f8ee[_0x41a724][_0xc0b2('0x6a')])){_0x16b238[_0x21f8ee[_0x41a724][_0xc0b2('0x6a')]]=needsEncapsulation(_0x21f8ee[_0x41a724][_0xc0b2('0x6b')])?encapsulate(_0x21f8ee[_0x41a724][_0xc0b2('0x6b')]):_0x21f8ee[_0x41a724]['question'];}}var _0xb46477=[],_0x43a9ab={};for(var _0x4843a8=0x0,_0x31f3b2=_0x5e6dc6[_0xc0b2('0x38')];_0x4843a8<_0x31f3b2;_0x4843a8++){_0x43a9ab={'ProjectId':_0x49ebe4[_0xc0b2('0x47')]['id'],'SessionId':_0x5e6dc6[_0x4843a8]['id'],'StartTime':moment(_0x5e6dc6[_0x4843a8][_0xc0b2('0x66')])[_0xc0b2('0x6c')](_0xc0b2('0x6d'))};for(var _0x36d7fb=0x0,_0x4063ea=_0x21f8ee[_0xc0b2('0x38')];_0x36d7fb<_0x4063ea;_0x36d7fb++){if(_0x21f8ee[_0x36d7fb]['SessionId']==_0x5e6dc6[_0x4843a8]['id']&&_0x16b238[_0xc0b2('0x39')](_0x21f8ee[_0x36d7fb][_0xc0b2('0x6a')])){_0x43a9ab[_0x16b238[_0x21f8ee[_0x36d7fb][_0xc0b2('0x6a')]]]=_0x21f8ee[_0x36d7fb][_0xc0b2('0x6e')];}}for(var _0x5d977d in _0x16b238){if(!_0x43a9ab[_0xc0b2('0x39')](_0x16b238[_0x5d977d])){_0x43a9ab[_0x16b238[_0x5d977d]]=null;}}_0xb46477['push'](_0x43a9ab);}return _0xb46477;}})['then'](function(_0x2a7ed4){if(!_[_0xc0b2('0x6f')](_0x2a7ed4)){var _0x467293=toCsv(_0x2a7ed4);var _0x79bcb5=Date[_0xc0b2('0x70')]();fs[_0xc0b2('0x71')](util[_0xc0b2('0x6c')](_0xc0b2('0x72'),_0x49ebe4[_0xc0b2('0x47')]['id'],_0x79bcb5),_0x467293);_0x4c431c[_0xc0b2('0x73')]('Content-disposition','attachment;\x20filename='+util[_0xc0b2('0x6c')](_0xc0b2('0x74'),_0x49ebe4[_0xc0b2('0x47')]['id'],_0x79bcb5));_0x4c431c['setHeader'](_0xc0b2('0x75'),_0xc0b2('0x76'));return _0x4c431c[_0xc0b2('0x77')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x49ebe4[_0xc0b2('0x47')]['id'],_0x79bcb5));}else{return _0x4c431c[_0xc0b2('0x18')](0xcc);}})[_0xc0b2('0x45')](handleError(_0x4c431c,null));}; \ No newline at end of file +var _0xd033=['JscriptyAnswerReport','hasOwnProperty','ProjectId','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','html-pdf','eml-format','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','Projects','UserProfileResource','then','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','findOne','JscriptySessionReport','pick','getAnswers'];(function(_0x3afb39,_0x1713b5){var _0x405d89=function(_0x6e4205){while(--_0x6e4205){_0x3afb39['push'](_0x3afb39['shift']());}};_0x405d89(++_0x1713b5);}(_0xd033,0x87));var _0x3d03=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0xd033[_0x2fd0f0];return _0x57f71a;};'use strict';var pdf=require(_0x3d03('0x0'));var emlformat=require(_0x3d03('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3d03('0x2'));var moment=require(_0x3d03('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3d03('0x4'));var sox=require(_0x3d03('0x5'));var csv=require(_0x3d03('0x6'));var ejs=require(_0x3d03('0x7'));var fs=require('fs');var _=require(_0x3d03('0x8'));var squel=require(_0x3d03('0x9'));var crypto=require('crypto');var jsforce=require(_0x3d03('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3d03('0x6'));var querystring=require(_0x3d03('0xb'));var Papa=require('papaparse');var Redis=require(_0x3d03('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3d03('0xd'));var hardwareService=require(_0x3d03('0xe'));var logger=require(_0x3d03('0xf'))(_0x3d03('0x10'));var utils=require(_0x3d03('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3d03('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x236941,_0x9174ab){_0x9174ab=_0x9174ab||0xcc;return function(_0xd3fe5d){if(_0xd3fe5d){return _0x236941[_0x3d03('0x13')](_0x9174ab);}return _0x236941['status'](_0x9174ab)[_0x3d03('0x14')]();};}function respondWithResult(_0x2f1856,_0x3b97ea){_0x3b97ea=_0x3b97ea||0xc8;return function(_0x4b538e){if(_0x4b538e){return _0x2f1856[_0x3d03('0x15')](_0x3b97ea)[_0x3d03('0x16')](_0x4b538e);}};}function respondWithFilteredResult(_0x2ac1f9,_0x2035c6){return function(_0x3f9b21){if(_0x3f9b21){var _0x440801=_0x3f9b21[_0x3d03('0x17')],_0x33f024=_0x2035c6[_0x3d03('0x18')],_0xaf581a=_0x2035c6[_0x3d03('0x18')]+_0x2035c6[_0x3d03('0x19')],_0x563b28;if(_0xaf581a>=_0x440801){_0xaf581a=_0x440801;_0x563b28=0xc8;}else{_0x563b28=0xce;}_0x2ac1f9[_0x3d03('0x15')](_0x563b28);return _0x2ac1f9['set'](_0x3d03('0x1a'),_0x33f024+'-'+_0xaf581a+'/'+_0x440801)[_0x3d03('0x16')](_0x3f9b21);}return null;};}function patchUpdates(_0x57b5e5){return function(_0x36bd7a){try{jsonpatch['apply'](_0x36bd7a,_0x57b5e5,!![]);}catch(_0xf06295){return BPromise[_0x3d03('0x1b')](_0xf06295);}return _0x36bd7a[_0x3d03('0x1c')]();};}function saveUpdates(_0x5ca2df,_0x35e03c){return function(_0x3eee07){if(_0x3eee07){return _0x3eee07[_0x3d03('0x1d')](_0x5ca2df)['then'](function(_0x5ebb9a){return _0x5ebb9a;});}return null;};}function removeEntity(_0x34b8e3,_0x2eb6dc){return function(_0x5256a2){if(_0x5256a2){return _0x5256a2[_0x3d03('0x1e')]()['then'](function(){var _0x471d91=_0x5256a2['get']({'plain':!![]});var _0xb41b77=_0x3d03('0x1f');return db[_0x3d03('0x20')]['destroy']({'where':{'type':_0xb41b77,'resourceId':_0x471d91['id']}})[_0x3d03('0x21')](function(){return _0x5256a2;});})[_0x3d03('0x21')](function(){_0x34b8e3[_0x3d03('0x15')](0xcc)[_0x3d03('0x14')]();});}};}function handleEntityNotFound(_0x373dca,_0x4b25bf){return function(_0x1fce7e){if(!_0x1fce7e){_0x373dca[_0x3d03('0x13')](0x194);}return _0x1fce7e;};}function handleError(_0xe27c49,_0x44b898){_0x44b898=_0x44b898||0x1f4;return function(_0x47029b){logger[_0x3d03('0x22')](_0x47029b[_0x3d03('0x23')]);if(_0x47029b[_0x3d03('0x24')]){delete _0x47029b[_0x3d03('0x24')];}_0xe27c49[_0x3d03('0x15')](_0x44b898)[_0x3d03('0x25')](_0x47029b);};}exports[_0x3d03('0x26')]=function(_0x912fe3,_0x15a385){var _0x20ca12={},_0x117588={},_0x29bf5d={'count':0x0,'rows':[]};var _0x295627=_['map'](db[_0x3d03('0x27')][_0x3d03('0x28')],function(_0x2b6764){return{'name':_0x2b6764[_0x3d03('0x29')],'type':_0x2b6764['type']['key']};});_0x117588[_0x3d03('0x2a')]=_[_0x3d03('0x2b')](_0x295627,_0x3d03('0x24'));_0x117588[_0x3d03('0x2c')]=_[_0x3d03('0x2d')](_0x912fe3[_0x3d03('0x2c')]);_0x117588[_0x3d03('0x2e')]=_['intersection'](_0x117588['model'],_0x117588['query']);_0x20ca12[_0x3d03('0x2f')]=_[_0x3d03('0x30')](_0x117588['model'],qs[_0x3d03('0x31')](_0x912fe3[_0x3d03('0x2c')][_0x3d03('0x31')]));_0x20ca12[_0x3d03('0x2f')]=_0x20ca12[_0x3d03('0x2f')][_0x3d03('0x32')]?_0x20ca12['attributes']:_0x117588[_0x3d03('0x2a')];if(!_0x912fe3[_0x3d03('0x2c')]['hasOwnProperty'](_0x3d03('0x33'))){_0x20ca12[_0x3d03('0x19')]=qs[_0x3d03('0x19')](_0x912fe3['query'][_0x3d03('0x19')]);_0x20ca12[_0x3d03('0x18')]=qs[_0x3d03('0x18')](_0x912fe3[_0x3d03('0x2c')][_0x3d03('0x18')]);}_0x20ca12[_0x3d03('0x34')]=qs[_0x3d03('0x35')](_0x912fe3[_0x3d03('0x2c')][_0x3d03('0x35')]);_0x20ca12[_0x3d03('0x36')]=qs['filters'](_['pick'](_0x912fe3[_0x3d03('0x2c')],_0x117588[_0x3d03('0x2e')]),_0x295627);if(_0x912fe3[_0x3d03('0x2c')][_0x3d03('0x37')]){_0x20ca12[_0x3d03('0x36')]=_[_0x3d03('0x38')](_0x20ca12[_0x3d03('0x36')],{'$or':_[_0x3d03('0x2b')](_0x295627,function(_0x3736d3){if(_0x3736d3[_0x3d03('0x39')]!==_0x3d03('0x3a')){var _0x53c383={};_0x53c383[_0x3736d3['name']]={'$like':'%'+_0x912fe3[_0x3d03('0x2c')][_0x3d03('0x37')]+'%'};return _0x53c383;}})});}_0x20ca12=_[_0x3d03('0x38')]({},_0x20ca12,_0x912fe3[_0x3d03('0x3b')]);var _0x829f13={'where':_0x20ca12[_0x3d03('0x36')]};return db['JscriptyProject'][_0x3d03('0x17')](_0x829f13)[_0x3d03('0x21')](function(_0x3e77a8){_0x29bf5d[_0x3d03('0x17')]=_0x3e77a8;if(_0x912fe3['query'][_0x3d03('0x3c')]){_0x20ca12[_0x3d03('0x3d')]=[{'all':!![]}];}return db[_0x3d03('0x27')]['findAll'](_0x20ca12);})[_0x3d03('0x21')](function(_0x3fd27d){_0x29bf5d[_0x3d03('0x3e')]=_0x3fd27d;return _0x29bf5d;})[_0x3d03('0x21')](respondWithFilteredResult(_0x15a385,_0x20ca12))[_0x3d03('0x3f')](handleError(_0x15a385,null));};exports[_0x3d03('0x40')]=function(_0xe39706,_0x2f8fd5){var _0x1f8d55={'raw':![],'where':{'id':_0xe39706[_0x3d03('0x41')]['id']}},_0x5aefc5={};_0x5aefc5[_0x3d03('0x2a')]=_['keys'](db[_0x3d03('0x27')][_0x3d03('0x28')]);_0x5aefc5[_0x3d03('0x2c')]=_[_0x3d03('0x2d')](_0xe39706['query']);_0x5aefc5[_0x3d03('0x2e')]=_[_0x3d03('0x30')](_0x5aefc5['model'],_0x5aefc5['query']);_0x1f8d55['attributes']=_['intersection'](_0x5aefc5[_0x3d03('0x2a')],qs[_0x3d03('0x31')](_0xe39706[_0x3d03('0x2c')][_0x3d03('0x31')]));_0x1f8d55['attributes']=_0x1f8d55[_0x3d03('0x2f')][_0x3d03('0x32')]?_0x1f8d55['attributes']:_0x5aefc5[_0x3d03('0x2a')];if(_0xe39706[_0x3d03('0x2c')]['includeAll']){_0x1f8d55[_0x3d03('0x3d')]=[{'all':!![]}];}_0x1f8d55=_[_0x3d03('0x38')]({},_0x1f8d55,_0xe39706[_0x3d03('0x3b')]);return db['JscriptyProject']['find'](_0x1f8d55)[_0x3d03('0x21')](handleEntityNotFound(_0x2f8fd5,null))[_0x3d03('0x21')](respondWithResult(_0x2f8fd5,null))[_0x3d03('0x3f')](handleError(_0x2f8fd5,null));};exports[_0x3d03('0x42')]=function(_0x28dc55,_0x490583){return db['JscriptyProject'][_0x3d03('0x42')](_0x28dc55['body'],{})[_0x3d03('0x21')](function(_0x1f5e08){var _0x3e533c=_0x28dc55[_0x3d03('0x43')][_0x3d03('0x44')]({'plain':!![]});if(!_0x3e533c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e533c[_0x3d03('0x45')]===_0x3d03('0x43')){var _0x50b04f=_0x1f5e08['get']({'plain':!![]});var _0x299984='Projects';return db[_0x3d03('0x46')]['find']({'where':{'name':_0x299984,'userProfileId':_0x3e533c['userProfileId']},'raw':!![]})[_0x3d03('0x21')](function(_0x41ad83){if(_0x41ad83&&_0x41ad83[_0x3d03('0x47')]===0x0){return db['UserProfileResource'][_0x3d03('0x42')]({'name':_0x50b04f[_0x3d03('0x24')],'resourceId':_0x50b04f['id'],'type':_0x41ad83[_0x3d03('0x24')],'sectionId':_0x41ad83['id']},{})[_0x3d03('0x21')](function(){return _0x1f5e08;});}else{return _0x1f5e08;}})['catch'](function(_0x2e64ef){logger[_0x3d03('0x22')](_0x3d03('0x48'),_0x2e64ef);throw _0x2e64ef;});}return _0x1f5e08;})[_0x3d03('0x21')](respondWithResult(_0x490583,0xc9))['catch'](handleError(_0x490583,null));};exports[_0x3d03('0x49')]=function(_0x565622,_0x49f635){var _0x58719b={'where':{'id':_0x565622[_0x3d03('0x41')]['id']}},_0x22491e={};_0x22491e['model']=_[_0x3d03('0x2d')](db[_0x3d03('0x27')][_0x3d03('0x28')]);_0x58719b[_0x3d03('0x2f')]=_['intersection'](_0x22491e['model'],qs[_0x3d03('0x31')](_0x565622[_0x3d03('0x2c')][_0x3d03('0x31')]));_0x58719b[_0x3d03('0x2f')]=_0x58719b[_0x3d03('0x2f')]['length']?_0x58719b[_0x3d03('0x2f')]:_0x22491e[_0x3d03('0x2a')];if(_0x565622[_0x3d03('0x2c')][_0x3d03('0x3c')]){_0x58719b[_0x3d03('0x3d')]=[{'all':!![]}];}_0x58719b=_[_0x3d03('0x38')]({},_0x58719b,_0x565622[_0x3d03('0x3b')]);return db[_0x3d03('0x27')][_0x3d03('0x4a')](_0x58719b)[_0x3d03('0x21')](handleEntityNotFound(_0x49f635,null))['then'](function(_0x50aa28){if(_0x50aa28){var _0x21f01e=_0x50aa28[_0x3d03('0x44')]({'plain':!![]});_0x21f01e=qs[_0x3d03('0x4b')](_0x21f01e,['id',_0x3d03('0x4c'),_0x3d03('0x4d')]);_0x565622['body']=_[_0x3d03('0x4b')](_0x565622['body'],['id',_0x3d03('0x4c'),_0x3d03('0x4d')]);return db[_0x3d03('0x27')][_0x3d03('0x42')](_[_0x3d03('0x38')](_0x21f01e,_0x565622[_0x3d03('0x4e')]),{'include':_0x565622[_0x3d03('0x2c')][_0x3d03('0x3c')]?[{'all':!![]}]:undefined})[_0x3d03('0x21')](function(_0x5e65c0){var _0x9a9a36=_0x565622[_0x3d03('0x43')]['get']({'plain':!![]});if(!_0x9a9a36)throw new Error(_0x3d03('0x4f'));if(_0x9a9a36[_0x3d03('0x45')]===_0x3d03('0x43')){var _0x5a9020=_0x5e65c0[_0x3d03('0x44')]({'plain':!![]});var _0x4db10d=_0x3d03('0x1f');return db[_0x3d03('0x46')][_0x3d03('0x4a')]({'where':{'name':_0x4db10d,'userProfileId':_0x9a9a36[_0x3d03('0x50')]},'raw':!![]})[_0x3d03('0x21')](function(_0x344133){if(_0x344133&&_0x344133['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5a9020[_0x3d03('0x24')],'resourceId':_0x5a9020['id'],'type':_0x344133[_0x3d03('0x24')],'sectionId':_0x344133['id']},{})[_0x3d03('0x21')](function(){return _0x5e65c0;});}else{return _0x5e65c0;}})['catch'](function(_0x1e39db){logger[_0x3d03('0x22')](_0x3d03('0x48'),_0x1e39db);throw _0x1e39db;});}return _0x5e65c0;});}})[_0x3d03('0x21')](respondWithResult(_0x49f635,0xc9))['catch'](handleError(_0x49f635,null));};exports[_0x3d03('0x1d')]=function(_0x3b2c6a,_0x38dfb1){if(_0x3b2c6a[_0x3d03('0x4e')]['id']){delete _0x3b2c6a[_0x3d03('0x4e')]['id'];}return db[_0x3d03('0x27')][_0x3d03('0x4a')]({'where':{'id':_0x3b2c6a['params']['id']}})[_0x3d03('0x21')](handleEntityNotFound(_0x38dfb1,null))[_0x3d03('0x21')](saveUpdates(_0x3b2c6a[_0x3d03('0x4e')],null))['then'](respondWithResult(_0x38dfb1,null))['catch'](handleError(_0x38dfb1,null));};exports[_0x3d03('0x1e')]=function(_0x434052,_0x2921a2){return db['JscriptyProject'][_0x3d03('0x4a')]({'where':{'id':_0x434052['params']['id']}})['then'](handleEntityNotFound(_0x2921a2,null))[_0x3d03('0x21')](removeEntity(_0x2921a2,null))[_0x3d03('0x3f')](handleError(_0x2921a2,null));};exports['getSessions']=function(_0x3f3b81,_0x264b98,_0x19138e){var _0x52e13a={'raw':!![],'where':{}};var _0x490628={};var _0x155ad4={'count':0x0,'rows':[]};return db[_0x3d03('0x27')][_0x3d03('0x51')]({'where':{'id':_0x3f3b81[_0x3d03('0x41')]['id']}})[_0x3d03('0x21')](handleEntityNotFound(_0x264b98,null))[_0x3d03('0x21')](function(_0xa8e11e){if(_0xa8e11e){_0x490628['model']=_[_0x3d03('0x2d')](db[_0x3d03('0x52')][_0x3d03('0x28')]);_0x490628['query']=_['keys'](_0x3f3b81[_0x3d03('0x2c')]);_0x490628[_0x3d03('0x2e')]=_['intersection'](_0x490628['model'],_0x490628[_0x3d03('0x2c')]);_0x52e13a[_0x3d03('0x2f')]=_[_0x3d03('0x30')](_0x490628['model'],qs[_0x3d03('0x31')](_0x3f3b81[_0x3d03('0x2c')][_0x3d03('0x31')]));_0x52e13a[_0x3d03('0x2f')]=_0x52e13a[_0x3d03('0x2f')][_0x3d03('0x32')]?_0x52e13a[_0x3d03('0x2f')]:_0x490628['model'];if(!_0x3f3b81[_0x3d03('0x2c')]['hasOwnProperty']('nolimit')){_0x52e13a[_0x3d03('0x19')]=qs[_0x3d03('0x19')](_0x3f3b81[_0x3d03('0x2c')][_0x3d03('0x19')]);_0x52e13a[_0x3d03('0x18')]=qs['offset'](_0x3f3b81[_0x3d03('0x2c')][_0x3d03('0x18')]);}_0x52e13a[_0x3d03('0x34')]=qs[_0x3d03('0x35')](_0x3f3b81[_0x3d03('0x2c')][_0x3d03('0x35')]);_0x52e13a[_0x3d03('0x36')]=qs[_0x3d03('0x2e')](_[_0x3d03('0x53')](_0x3f3b81[_0x3d03('0x2c')],_0x490628[_0x3d03('0x2e')]));_0x52e13a['where']['ProjectId']=_0xa8e11e['id'];if(_0x3f3b81[_0x3d03('0x2c')][_0x3d03('0x37')]){_0x52e13a[_0x3d03('0x36')]=_['merge'](_0x52e13a[_0x3d03('0x36')],{'$or':_[_0x3d03('0x2b')](_0x52e13a[_0x3d03('0x2f')],function(_0x48631f){var _0x5a5c1b={};_0x5a5c1b[_0x48631f]={'$like':'%'+_0x3f3b81[_0x3d03('0x2c')][_0x3d03('0x37')]+'%'};return _0x5a5c1b;})});}_0x52e13a=_[_0x3d03('0x38')]({},_0x52e13a,_0x3f3b81[_0x3d03('0x3b')]);return db[_0x3d03('0x52')]['count']({'where':_0x52e13a['where']})[_0x3d03('0x21')](function(_0xa829b4){_0x155ad4[_0x3d03('0x17')]=_0xa829b4;if(_0x3f3b81[_0x3d03('0x2c')][_0x3d03('0x3c')]){_0x52e13a[_0x3d03('0x3d')]=[{'all':!![]}];}return db[_0x3d03('0x52')]['findAll'](_0x52e13a);})[_0x3d03('0x21')](function(_0x2cb339){_0x155ad4[_0x3d03('0x3e')]=_0x2cb339;return _0x155ad4;});}})[_0x3d03('0x21')](respondWithFilteredResult(_0x264b98,_0x52e13a))['catch'](handleError(_0x264b98,null));};exports[_0x3d03('0x54')]=function(_0x43e029,_0x19c97d,_0x4f1250){var _0x4ee92a={'raw':!![],'where':{}};var _0x579979={};var _0xf75fb8={'count':0x0,'rows':[]};return db[_0x3d03('0x27')][_0x3d03('0x51')]({'where':{'id':_0x43e029[_0x3d03('0x41')]['id']}})[_0x3d03('0x21')](handleEntityNotFound(_0x19c97d,null))[_0x3d03('0x21')](function(_0x1e6ee9){if(_0x1e6ee9){_0x579979['model']=_[_0x3d03('0x2d')](db[_0x3d03('0x55')]['rawAttributes']);_0x579979[_0x3d03('0x2c')]=_[_0x3d03('0x2d')](_0x43e029[_0x3d03('0x2c')]);_0x579979['filters']=_['intersection'](_0x579979[_0x3d03('0x2a')],_0x579979[_0x3d03('0x2c')]);_0x4ee92a[_0x3d03('0x2f')]=_['intersection'](_0x579979[_0x3d03('0x2a')],qs[_0x3d03('0x31')](_0x43e029[_0x3d03('0x2c')][_0x3d03('0x31')]));_0x4ee92a['attributes']=_0x4ee92a[_0x3d03('0x2f')][_0x3d03('0x32')]?_0x4ee92a[_0x3d03('0x2f')]:_0x579979[_0x3d03('0x2a')];if(!_0x43e029[_0x3d03('0x2c')][_0x3d03('0x56')](_0x3d03('0x33'))){_0x4ee92a[_0x3d03('0x19')]=qs[_0x3d03('0x19')](_0x43e029[_0x3d03('0x2c')][_0x3d03('0x19')]);_0x4ee92a[_0x3d03('0x18')]=qs['offset'](_0x43e029[_0x3d03('0x2c')][_0x3d03('0x18')]);}_0x4ee92a['order']=qs[_0x3d03('0x35')](_0x43e029[_0x3d03('0x2c')][_0x3d03('0x35')]);_0x4ee92a[_0x3d03('0x36')]=qs[_0x3d03('0x2e')](_[_0x3d03('0x53')](_0x43e029[_0x3d03('0x2c')],_0x579979[_0x3d03('0x2e')]));_0x4ee92a[_0x3d03('0x36')][_0x3d03('0x57')]=_0x1e6ee9['id'];if(_0x43e029[_0x3d03('0x2c')]['filter']){_0x4ee92a[_0x3d03('0x36')]=_['merge'](_0x4ee92a[_0x3d03('0x36')],{'$or':_[_0x3d03('0x2b')](_0x4ee92a[_0x3d03('0x2f')],function(_0x27c043){var _0x10f31a={};_0x10f31a[_0x27c043]={'$like':'%'+_0x43e029['query'][_0x3d03('0x37')]+'%'};return _0x10f31a;})});}_0x4ee92a=_[_0x3d03('0x38')]({},_0x4ee92a,_0x43e029[_0x3d03('0x3b')]);return db[_0x3d03('0x55')]['count']({'where':_0x4ee92a[_0x3d03('0x36')]})[_0x3d03('0x21')](function(_0xe50162){_0xf75fb8[_0x3d03('0x17')]=_0xe50162;if(_0x43e029[_0x3d03('0x2c')][_0x3d03('0x3c')]){_0x4ee92a['include']=[{'all':!![]}];}return db[_0x3d03('0x55')][_0x3d03('0x58')](_0x4ee92a);})[_0x3d03('0x21')](function(_0x50e1df){_0xf75fb8[_0x3d03('0x3e')]=_0x50e1df;return _0xf75fb8;});}})[_0x3d03('0x21')](respondWithFilteredResult(_0x19c97d,_0x4ee92a))[_0x3d03('0x3f')](handleError(_0x19c97d,null));};function char(_0x351ce1){return _0x3d03('0x59')===typeof _0x351ce1?String[_0x3d03('0x5a')]['apply'](null,arguments):_0x351ce1;}function needsEncapsulation(_0x3a5d05){return!!_0x3a5d05&&(_0x3a5d05[_0x3d03('0x5b')]()[_0x3d03('0x5c')](char(0xd))>=0x0||_0x3a5d05[_0x3d03('0x5b')]()[_0x3d03('0x5c')](char(0xa))>=0x0||_0x3a5d05[_0x3d03('0x5b')]()[_0x3d03('0x5c')](char(0x2c))>=0x0||_0x3a5d05[_0x3d03('0x5b')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x3d3477){var _0x20c720=char(0x22),_0x283c63='\x5c'+char(0x22),_0x1cdf3f=_0x3d3477[_0x3d03('0x5b')]()[_0x3d03('0x5d')](new RegExp(_0x20c720,'g'),_0x283c63);return _0x20c720+_0x1cdf3f+_0x20c720;}exports[_0x3d03('0x5e')]=function(_0x2c5f13,_0x40c5a2,_0x5f14ae){var _0x32a055,_0x31f555;var _0xb2ba82={'where':{'ProjectId':_0x2c5f13[_0x3d03('0x41')]['id']}};if(_0x2c5f13[_0x3d03('0x2c')][_0x3d03('0x5f')]){_0xb2ba82['where'][_0x3d03('0x60')]=JSON['parse'](_0x2c5f13[_0x3d03('0x2c')]['startTime']);}return db[_0x3d03('0x52')][_0x3d03('0x58')](_0xb2ba82)[_0x3d03('0x21')](handleEntityNotFound(_0x40c5a2,null))['then'](function(_0x1868ea){if(_0x1868ea){_0x32a055=_0x1868ea;return db['JscriptyQuestionReport'][_0x3d03('0x58')]({'where':{'SessionId':{'$in':_[_0x3d03('0x2b')](_0x32a055,'id')},'ProjectId':_0x2c5f13[_0x3d03('0x41')]['id']},'order':_0x3d03('0x61')});}})['then'](handleEntityNotFound(_0x40c5a2,null))['then'](function(_0x519d8c){if(_0x519d8c){_0x31f555=_0x519d8c;var _0x2ddf05={};for(var _0x3c550d=0x0,_0x1deda1=_0x31f555[_0x3d03('0x32')];_0x3c550d<_0x1deda1;_0x3c550d++){if(!_0x2ddf05['hasOwnProperty'](_0x31f555[_0x3c550d][_0x3d03('0x62')])){_0x2ddf05[_0x31f555[_0x3c550d][_0x3d03('0x62')]]=needsEncapsulation(_0x31f555[_0x3c550d][_0x3d03('0x63')])?encapsulate(_0x31f555[_0x3c550d][_0x3d03('0x63')]):_0x31f555[_0x3c550d][_0x3d03('0x63')];}}var _0x51c77d=[],_0x12907f={};for(var _0x9cb090=0x0,_0x185824=_0x32a055[_0x3d03('0x32')];_0x9cb090<_0x185824;_0x9cb090++){_0x12907f={'ProjectId':_0x2c5f13['params']['id'],'SessionId':_0x32a055[_0x9cb090]['id'],'StartTime':moment(_0x32a055[_0x9cb090][_0x3d03('0x60')])[_0x3d03('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3dde04=0x0,_0x10d5bd=_0x31f555[_0x3d03('0x32')];_0x3dde04<_0x10d5bd;_0x3dde04++){if(_0x31f555[_0x3dde04][_0x3d03('0x65')]==_0x32a055[_0x9cb090]['id']&&_0x2ddf05['hasOwnProperty'](_0x31f555[_0x3dde04][_0x3d03('0x62')])){_0x12907f[_0x2ddf05[_0x31f555[_0x3dde04][_0x3d03('0x62')]]]=_0x31f555[_0x3dde04][_0x3d03('0x66')];}}for(var _0x14f9dc in _0x2ddf05){if(!_0x12907f[_0x3d03('0x56')](_0x2ddf05[_0x14f9dc])){_0x12907f[_0x2ddf05[_0x14f9dc]]=null;}}_0x51c77d[_0x3d03('0x67')](_0x12907f);}return _0x51c77d;}})[_0x3d03('0x21')](function(_0x2966ea){if(!_[_0x3d03('0x68')](_0x2966ea)){var _0x257139=toCsv(_0x2966ea);var _0x43e315=Date['now']();fs['writeFileSync'](util[_0x3d03('0x64')](_0x3d03('0x69'),_0x2c5f13['params']['id'],_0x43e315),_0x257139);_0x40c5a2[_0x3d03('0x6a')](_0x3d03('0x6b'),'attachment;\x20filename='+util[_0x3d03('0x64')](_0x3d03('0x6c'),_0x2c5f13[_0x3d03('0x41')]['id'],_0x43e315));_0x40c5a2[_0x3d03('0x6a')]('Content-type',_0x3d03('0x6d'));return _0x40c5a2['download'](util[_0x3d03('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2c5f13[_0x3d03('0x41')]['id'],_0x43e315));}else{return _0x40c5a2[_0x3d03('0x13')](0xcc);}})['catch'](handleError(_0x40c5a2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b0b47ae..36aef2b 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 _0x6220=['request-promise','exports','define','jscripty_projects','util','../../config/logger','api','moment','bluebird'];(function(_0x4887ef,_0xf947c1){var _0x44dd61=function(_0x22e6e9){while(--_0x22e6e9){_0x4887ef['push'](_0x4887ef['shift']());}};_0x44dd61(++_0xf947c1);}(_0x6220,0xee));var _0x0622=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x6220[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0x0622('0x0'));var logger=require(_0x0622('0x1'))(_0x0622('0x2'));var moment=require(_0x0622('0x3'));var BPromise=require(_0x0622('0x4'));var rp=require(_0x0622('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x0622('0x6')]=function(_0x4b5782,_0x4e2039){return _0x4b5782[_0x0622('0x7')]('JscriptyProject',attributes,{'tableName':_0x0622('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56ac=['exports','jscripty_projects','../../config/logger','api','moment','request-promise','rimraf','./jscriptyProject.attributes'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x56ac,0x162));var _0xc56a=function(_0x261975,_0x51a03b){_0x261975=_0x261975-0x0;var _0x2472d7=_0x56ac[_0x261975];return _0x2472d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc56a('0x0'))(_0xc56a('0x1'));var moment=require(_0xc56a('0x2'));var BPromise=require('bluebird');var rp=require(_0xc56a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc56a('0x4'));var config=require('../../config/environment');var attributes=require(_0xc56a('0x5'));module[_0xc56a('0x6')]=function(_0x2dfa49,_0x296109){return _0x2dfa49['define']('JscriptyProject',attributes,{'tableName':_0xc56a('0x7'),'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 f3f009d..cde41fd 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 _0xce8e=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','message','result','catch','util'];(function(_0x1f7120,_0x53456a){var _0x512142=function(_0xae9761){while(--_0xae9761){_0x1f7120['push'](_0x1f7120['shift']());}};_0x512142(++_0x53456a);}(_0xce8e,0xd1));var _0xece8=function(_0x2bc075,_0x3ccbdf){_0x2bc075=_0x2bc075-0x0;var _0x342ad0=_0xce8e[_0x2bc075];return _0x342ad0;};'use strict';var _=require('lodash');var util=require(_0xece8('0x0'));var moment=require(_0xece8('0x1'));var BPromise=require(_0xece8('0x2'));var rs=require(_0xece8('0x3'));var fs=require('fs');var Redis=require(_0xece8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xece8('0x5'));var logger=require(_0xece8('0x6'))(_0xece8('0x7'));var config=require(_0xece8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xece8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cdd3,_0x2e3a5a,_0x1911be){return new BPromise(function(_0x104227,_0xec1a7){return client[_0xece8('0xa')](_0x55cdd3,_0x1911be)[_0xece8('0xb')](function(_0x3d1cf1){logger[_0xece8('0xc')](_0xece8('0xd'),_0x2e3a5a,_0xece8('0xe'));logger[_0xece8('0xf')](_0xece8('0x10'),_0x2e3a5a,'request\x20sent',JSON['stringify'](_0x3d1cf1));if(_0x3d1cf1[_0xece8('0x11')]){if(_0x3d1cf1['error']['code']===0x1f4){logger[_0xece8('0x11')](_0xece8('0xd'),_0x2e3a5a,_0x3d1cf1[_0xece8('0x11')][_0xece8('0x12')]);return _0xec1a7(_0x3d1cf1[_0xece8('0x11')][_0xece8('0x12')]);}logger['error'](_0xece8('0xd'),_0x2e3a5a,_0x3d1cf1[_0xece8('0x11')]['message']);return _0x104227(_0x3d1cf1[_0xece8('0x11')][_0xece8('0x12')]);}else{logger[_0xece8('0xc')](_0xece8('0xd'),_0x2e3a5a,_0xece8('0xe'));_0x104227(_0x3d1cf1[_0xece8('0x13')]['message']);}})[_0xece8('0x14')](function(_0x1904b3){logger[_0xece8('0x11')](_0xece8('0xd'),_0x2e3a5a,_0x1904b3);_0xec1a7(_0x1904b3);});});} \ No newline at end of file +var _0x33c0=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','JscriptyProject,\x20%s,\x20%s','message'];(function(_0xe8a015,_0x2ddf58){var _0x134746=function(_0x3f014c){while(--_0x3f014c){_0xe8a015['push'](_0xe8a015['shift']());}};_0x134746(++_0x2ddf58);}(_0x33c0,0xff));var _0x033c=function(_0x3b741f,_0x5e8f7c){_0x3b741f=_0x3b741f-0x0;var _0xfe199e=_0x33c0[_0x3b741f];return _0xfe199e;};'use strict';var _=require('lodash');var util=require(_0x033c('0x0'));var moment=require(_0x033c('0x1'));var BPromise=require(_0x033c('0x2'));var rs=require(_0x033c('0x3'));var fs=require('fs');var Redis=require(_0x033c('0x4'));var db=require(_0x033c('0x5'))['db'];var utils=require(_0x033c('0x6'));var logger=require('../../config/logger')(_0x033c('0x7'));var config=require(_0x033c('0x8'));var jayson=require(_0x033c('0x9'));var client=jayson[_0x033c('0xa')][_0x033c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30b272,_0x50289c,_0x3b99dc){return new BPromise(function(_0x48d9c5,_0x5bc0bc){return client[_0x033c('0xc')](_0x30b272,_0x3b99dc)[_0x033c('0xd')](function(_0x175cb2){logger[_0x033c('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x50289c,'request\x20sent');logger['debug'](_0x033c('0xf'),_0x50289c,_0x033c('0x10'),JSON[_0x033c('0x11')](_0x175cb2));if(_0x175cb2[_0x033c('0x12')]){if(_0x175cb2[_0x033c('0x12')]['code']===0x1f4){logger['error'](_0x033c('0x13'),_0x50289c,_0x175cb2[_0x033c('0x12')]['message']);return _0x5bc0bc(_0x175cb2[_0x033c('0x12')][_0x033c('0x14')]);}logger[_0x033c('0x12')](_0x033c('0x13'),_0x50289c,_0x175cb2['error'][_0x033c('0x14')]);return _0x48d9c5(_0x175cb2[_0x033c('0x12')][_0x033c('0x14')]);}else{logger[_0x033c('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x50289c,'request\x20sent');_0x48d9c5(_0x175cb2[_0x033c('0x15')][_0x033c('0x14')]);}})[_0x033c('0x16')](function(_0x344235){logger['error'](_0x033c('0x13'),_0x50289c,_0x344235);_0x5bc0bc(_0x344235);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 8a96e6a..d774b8c 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 _0x3748=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','multer','util','path','express','Router'];(function(_0x3025ba,_0x3f0826){var _0x4c2380=function(_0x1b0c9c){while(--_0x1b0c9c){_0x3025ba['push'](_0x3025ba['shift']());}};_0x4c2380(++_0x3f0826);}(_0x3748,0x12d));var _0x8374=function(_0xfaeb48,_0x35e639){_0xfaeb48=_0xfaeb48-0x0;var _0x2a6290=_0x3748[_0xfaeb48];return _0x2a6290;};'use strict';var multer=require(_0x8374('0x0'));var util=require(_0x8374('0x1'));var path=require(_0x8374('0x2'));var timeout=require('connect-timeout');var express=require(_0x8374('0x3'));var router=express[_0x8374('0x4')]();var auth=require(_0x8374('0x5'));var interaction=require(_0x8374('0x6'));var config=require(_0x8374('0x7'));var controller=require(_0x8374('0x8'));router[_0x8374('0x9')]('/',auth[_0x8374('0xa')](),controller[_0x8374('0xb')]);router[_0x8374('0x9')]('/describe',auth[_0x8374('0xa')](),controller['describe']);router[_0x8374('0x9')]('/:id',auth[_0x8374('0xa')](),controller['show']);router[_0x8374('0xc')]('/',auth[_0x8374('0xa')](),controller[_0x8374('0xd')]);router['put'](_0x8374('0xe'),auth[_0x8374('0xa')](),controller[_0x8374('0xf')]);router[_0x8374('0x10')](_0x8374('0xe'),auth[_0x8374('0xa')](),controller[_0x8374('0x11')]);module['exports']=router; \ No newline at end of file +var _0x659c=['isAuthenticated','index','/describe','/:id','create','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x659c,0x1aa));var _0xc659=function(_0xcbff5,_0x50eb75){_0xcbff5=_0xcbff5-0x0;var _0x13a00a=_0x659c[_0xcbff5];return _0x13a00a;};'use strict';var multer=require(_0xc659('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc659('0x1'));var express=require(_0xc659('0x2'));var router=express['Router']();var auth=require(_0xc659('0x3'));var interaction=require(_0xc659('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xc659('0x5')]('/',auth[_0xc659('0x6')](),controller[_0xc659('0x7')]);router[_0xc659('0x5')](_0xc659('0x8'),auth[_0xc659('0x6')](),controller['describe']);router['get'](_0xc659('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc659('0x6')](),controller[_0xc659('0xa')]);router[_0xc659('0xb')](_0xc659('0x9'),auth[_0xc659('0x6')](),controller[_0xc659('0xc')]);router[_0xc659('0xd')](_0xc659('0x9'),auth['isAuthenticated'](),controller[_0xc659('0xe')]);module[_0xc659('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5655f78..9b6784d 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 _0x9c00=['sequelize','exports','long','STRING'];(function(_0x4c3904,_0x56db61){var _0x44fd48=function(_0x1e84a2){while(--_0x1e84a2){_0x4c3904['push'](_0x4c3904['shift']());}};_0x44fd48(++_0x56db61);}(_0x9c00,0x1a0));var _0x09c0=function(_0x42c7b5,_0x3f2ccf){_0x42c7b5=_0x42c7b5-0x0;var _0x3919b2=_0x9c00[_0x42c7b5];return _0x3919b2;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize['TEXT'](_0x09c0('0x2'))},'membername':{'type':Sequelize[_0x09c0('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x09c0('0x3')]},'uniqueid':{'type':Sequelize[_0x09c0('0x3')]},'calleridname':{'type':Sequelize[_0x09c0('0x3')]},'calleridnum':{'type':Sequelize[_0x09c0('0x3')]},'questionId':{'type':Sequelize[_0x09c0('0x3')]}}; \ No newline at end of file +var _0xfef3=['sequelize','TEXT','long','STRING'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0xfef3,0x118));var _0x3fef=function(_0x8b6b09,_0x3f17e0){_0x8b6b09=_0x8b6b09-0x0;var _0x27d8c8=_0xfef3[_0x8b6b09];return _0x27d8c8;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'question':{'type':Sequelize[_0x3fef('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x3fef('0x2'))},'membername':{'type':Sequelize[_0x3fef('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3fef('0x3')]},'uniqueid':{'type':Sequelize[_0x3fef('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3fef('0x3')]},'questionId':{'type':Sequelize[_0x3fef('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index d9d499d..ab7b6ca 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 _0x54ec=['findAll','catch','show','params','includeAll','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','stack','name','index','map','rawAttributes','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport'];(function(_0xdfb4a8,_0x304450){var _0x45f979=function(_0x45d4b9){while(--_0x45d4b9){_0xdfb4a8['push'](_0xdfb4a8['shift']());}};_0x45f979(++_0x304450);}(_0x54ec,0x12e));var _0xc54e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54ec[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc54e('0x0'));var jsonpatch=require(_0xc54e('0x1'));var rp=require(_0xc54e('0x2'));var moment=require(_0xc54e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc54e('0x4'));var util=require('util');var path=require(_0xc54e('0x5'));var sox=require('sox');var csv=require(_0xc54e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc54e('0x7'));var squel=require(_0xc54e('0x8'));var crypto=require(_0xc54e('0x9'));var jsforce=require(_0xc54e('0xa'));var deskjs=require(_0xc54e('0xb'));var toCsv=require(_0xc54e('0x6'));var querystring=require(_0xc54e('0xc'));var Papa=require(_0xc54e('0xd'));var Redis=require(_0xc54e('0xe'));var authService=require(_0xc54e('0xf'));var qs=require(_0xc54e('0x10'));var as=require(_0xc54e('0x11'));var hardwareService=require(_0xc54e('0x12'));var logger=require(_0xc54e('0x13'))(_0xc54e('0x14'));var utils=require(_0xc54e('0x15'));var config=require(_0xc54e('0x16'));var licenseUtil=require(_0xc54e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d0577,_0x3b77d6){_0x3b77d6=_0x3b77d6||0xcc;return function(_0x23c98b){if(_0x23c98b){return _0x4d0577[_0xc54e('0x18')](_0x3b77d6);}return _0x4d0577[_0xc54e('0x19')](_0x3b77d6)[_0xc54e('0x1a')]();};}function respondWithResult(_0x569166,_0x51583e){_0x51583e=_0x51583e||0xc8;return function(_0x4b7e56){if(_0x4b7e56){return _0x569166['status'](_0x51583e)[_0xc54e('0x1b')](_0x4b7e56);}};}function respondWithFilteredResult(_0x5ece50,_0x236a95){return function(_0x3a9967){if(_0x3a9967){var _0x1af957=_0x3a9967[_0xc54e('0x1c')],_0x40a639=_0x236a95['offset'],_0x4a1899=_0x236a95[_0xc54e('0x1d')]+_0x236a95[_0xc54e('0x1e')],_0x440d62;if(_0x4a1899>=_0x1af957){_0x4a1899=_0x1af957;_0x440d62=0xc8;}else{_0x440d62=0xce;}_0x5ece50[_0xc54e('0x19')](_0x440d62);return _0x5ece50[_0xc54e('0x1f')](_0xc54e('0x20'),_0x40a639+'-'+_0x4a1899+'/'+_0x1af957)[_0xc54e('0x1b')](_0x3a9967);}return null;};}function patchUpdates(_0x17d080){return function(_0x55427e){try{jsonpatch['apply'](_0x55427e,_0x17d080,!![]);}catch(_0xfa7a33){return BPromise[_0xc54e('0x21')](_0xfa7a33);}return _0x55427e['save']();};}function saveUpdates(_0x320588,_0xe103b6){return function(_0x5b87fe){if(_0x5b87fe){return _0x5b87fe[_0xc54e('0x22')](_0x320588)['then'](function(_0x2b6544){return _0x2b6544;});}return null;};}function removeEntity(_0x239a33,_0x3282e0){return function(_0x3060e7){if(_0x3060e7){return _0x3060e7[_0xc54e('0x23')]()[_0xc54e('0x24')](function(){_0x239a33[_0xc54e('0x19')](0xcc)[_0xc54e('0x1a')]();});}};}function handleEntityNotFound(_0x4078d6,_0xcf2208){return function(_0x279cd8){if(!_0x279cd8){_0x4078d6[_0xc54e('0x18')](0x194);}return _0x279cd8;};}function handleError(_0x52e828,_0x4edadc){_0x4edadc=_0x4edadc||0x1f4;return function(_0x27c2d9){logger['error'](_0x27c2d9[_0xc54e('0x25')]);if(_0x27c2d9[_0xc54e('0x26')]){delete _0x27c2d9[_0xc54e('0x26')];}_0x52e828[_0xc54e('0x19')](_0x4edadc)['send'](_0x27c2d9);};}exports[_0xc54e('0x27')]=function(_0x283c6d,_0x2b1543){var _0x46ac62={},_0x4acf96={},_0x407ba4={'count':0x0,'rows':[]};var _0x179875=_[_0xc54e('0x28')](db['JscriptyQuestionReport'][_0xc54e('0x29')],function(_0x233ffc){return{'name':_0x233ffc['fieldName'],'type':_0x233ffc[_0xc54e('0x2a')][_0xc54e('0x2b')]};});_0x4acf96['model']=_[_0xc54e('0x28')](_0x179875,_0xc54e('0x26'));_0x4acf96['query']=_[_0xc54e('0x2c')](_0x283c6d[_0xc54e('0x2d')]);_0x4acf96[_0xc54e('0x2e')]=_[_0xc54e('0x2f')](_0x4acf96['model'],_0x4acf96['query']);_0x46ac62[_0xc54e('0x30')]=_['intersection'](_0x4acf96['model'],qs[_0xc54e('0x31')](_0x283c6d[_0xc54e('0x2d')][_0xc54e('0x31')]));_0x46ac62['attributes']=_0x46ac62['attributes'][_0xc54e('0x32')]?_0x46ac62['attributes']:_0x4acf96[_0xc54e('0x33')];if(!_0x283c6d[_0xc54e('0x2d')][_0xc54e('0x34')](_0xc54e('0x35'))){_0x46ac62[_0xc54e('0x1e')]=qs[_0xc54e('0x1e')](_0x283c6d[_0xc54e('0x2d')][_0xc54e('0x1e')]);_0x46ac62[_0xc54e('0x1d')]=qs[_0xc54e('0x1d')](_0x283c6d[_0xc54e('0x2d')][_0xc54e('0x1d')]);}_0x46ac62[_0xc54e('0x36')]=qs[_0xc54e('0x37')](_0x283c6d[_0xc54e('0x2d')][_0xc54e('0x37')]);_0x46ac62[_0xc54e('0x38')]=qs[_0xc54e('0x2e')](_[_0xc54e('0x39')](_0x283c6d['query'],_0x4acf96[_0xc54e('0x2e')]),_0x179875);if(_0x283c6d[_0xc54e('0x2d')][_0xc54e('0x3a')]){_0x46ac62[_0xc54e('0x38')]=_[_0xc54e('0x3b')](_0x46ac62['where'],{'$or':_[_0xc54e('0x28')](_0x179875,function(_0x51d5dc){if(_0x51d5dc['type']!==_0xc54e('0x3c')){var _0x371ba7={};_0x371ba7[_0x51d5dc[_0xc54e('0x26')]]={'$like':'%'+_0x283c6d[_0xc54e('0x2d')][_0xc54e('0x3a')]+'%'};return _0x371ba7;}})});}_0x46ac62=_[_0xc54e('0x3b')]({},_0x46ac62,_0x283c6d[_0xc54e('0x3d')]);var _0x452379={'where':_0x46ac62[_0xc54e('0x38')]};return db[_0xc54e('0x3e')][_0xc54e('0x1c')](_0x452379)['then'](function(_0x9a6699){_0x407ba4['count']=_0x9a6699;if(_0x283c6d['query']['includeAll']){_0x46ac62['include']=[{'all':!![]}];}return db[_0xc54e('0x3e')][_0xc54e('0x3f')](_0x46ac62);})[_0xc54e('0x24')](function(_0x3a8569){_0x407ba4['rows']=_0x3a8569;return _0x407ba4;})[_0xc54e('0x24')](respondWithFilteredResult(_0x2b1543,_0x46ac62))[_0xc54e('0x40')](handleError(_0x2b1543,null));};exports[_0xc54e('0x41')]=function(_0x545a26,_0x55e6df){var _0x1176cd={'raw':!![],'where':{'id':_0x545a26[_0xc54e('0x42')]['id']}},_0x5c776a={};_0x5c776a[_0xc54e('0x33')]=_[_0xc54e('0x2c')](db[_0xc54e('0x3e')][_0xc54e('0x29')]);_0x5c776a[_0xc54e('0x2d')]=_[_0xc54e('0x2c')](_0x545a26[_0xc54e('0x2d')]);_0x5c776a[_0xc54e('0x2e')]=_['intersection'](_0x5c776a[_0xc54e('0x33')],_0x5c776a[_0xc54e('0x2d')]);_0x1176cd[_0xc54e('0x30')]=_[_0xc54e('0x2f')](_0x5c776a[_0xc54e('0x33')],qs[_0xc54e('0x31')](_0x545a26[_0xc54e('0x2d')][_0xc54e('0x31')]));_0x1176cd[_0xc54e('0x30')]=_0x1176cd['attributes'][_0xc54e('0x32')]?_0x1176cd[_0xc54e('0x30')]:_0x5c776a[_0xc54e('0x33')];if(_0x545a26[_0xc54e('0x2d')][_0xc54e('0x43')]){_0x1176cd[_0xc54e('0x44')]=[{'all':!![]}];}_0x1176cd=_['merge']({},_0x1176cd,_0x545a26[_0xc54e('0x3d')]);return db['JscriptyQuestionReport'][_0xc54e('0x45')](_0x1176cd)[_0xc54e('0x24')](handleEntityNotFound(_0x55e6df,null))[_0xc54e('0x24')](respondWithResult(_0x55e6df,null))['catch'](handleError(_0x55e6df,null));};exports[_0xc54e('0x46')]=function(_0x1ffa41,_0x44b127){return db[_0xc54e('0x3e')][_0xc54e('0x46')](_0x1ffa41[_0xc54e('0x47')],{})['then'](respondWithResult(_0x44b127,0xc9))[_0xc54e('0x40')](handleError(_0x44b127,null));};exports[_0xc54e('0x22')]=function(_0x131336,_0x26b11b){if(_0x131336['body']['id']){delete _0x131336[_0xc54e('0x47')]['id'];}return db['JscriptyQuestionReport'][_0xc54e('0x45')]({'where':{'id':_0x131336['params']['id']}})[_0xc54e('0x24')](handleEntityNotFound(_0x26b11b,null))[_0xc54e('0x24')](saveUpdates(_0x131336['body'],null))[_0xc54e('0x24')](respondWithResult(_0x26b11b,null))[_0xc54e('0x40')](handleError(_0x26b11b,null));};exports[_0xc54e('0x23')]=function(_0x127157,_0x2ada88){return db['JscriptyQuestionReport'][_0xc54e('0x45')]({'where':{'id':_0x127157[_0xc54e('0x42')]['id']}})[_0xc54e('0x24')](handleEntityNotFound(_0x2ada88,null))[_0xc54e('0x24')](removeEntity(_0x2ada88,null))[_0xc54e('0x40')](handleError(_0x2ada88,null));};exports[_0xc54e('0x48')]=function(_0x12607f,_0x2643c5){return db[_0xc54e('0x3e')][_0xc54e('0x48')]()[_0xc54e('0x24')](respondWithResult(_0x2643c5,null))[_0xc54e('0x40')](handleError(_0x2643c5,null));}; \ No newline at end of file +var _0x9dda=['../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','describe','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5f2f62,_0x40ce7d){var _0x2c5f87=function(_0x277785){while(--_0x277785){_0x5f2f62['push'](_0x5f2f62['shift']());}};_0x2c5f87(++_0x40ce7d);}(_0x9dda,0x1d5));var _0xa9dd=function(_0x3ac1fa,_0x3c57d7){_0x3ac1fa=_0x3ac1fa-0x0;var _0xa8fca9=_0x9dda[_0x3ac1fa];return _0xa8fca9;};'use strict';var pdf=require(_0xa9dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa9dd('0x1'));var zipdir=require(_0xa9dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa9dd('0x3'));var BPromise=require(_0xa9dd('0x4'));var Mustache=require(_0xa9dd('0x5'));var util=require(_0xa9dd('0x6'));var path=require(_0xa9dd('0x7'));var sox=require(_0xa9dd('0x8'));var csv=require(_0xa9dd('0x9'));var ejs=require(_0xa9dd('0xa'));var fs=require('fs');var _=require(_0xa9dd('0xb'));var squel=require(_0xa9dd('0xc'));var crypto=require(_0xa9dd('0xd'));var jsforce=require(_0xa9dd('0xe'));var deskjs=require(_0xa9dd('0xf'));var toCsv=require(_0xa9dd('0x9'));var querystring=require(_0xa9dd('0x10'));var Papa=require('papaparse');var Redis=require(_0xa9dd('0x11'));var authService=require(_0xa9dd('0x12'));var qs=require(_0xa9dd('0x13'));var as=require(_0xa9dd('0x14'));var hardwareService=require(_0xa9dd('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa9dd('0x16'));var config=require(_0xa9dd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cc73c,_0x10b310){_0x10b310=_0x10b310||0xcc;return function(_0x37ae0f){if(_0x37ae0f){return _0x4cc73c[_0xa9dd('0x18')](_0x10b310);}return _0x4cc73c['status'](_0x10b310)[_0xa9dd('0x19')]();};}function respondWithResult(_0x19b965,_0x5b11d5){_0x5b11d5=_0x5b11d5||0xc8;return function(_0x12b53e){if(_0x12b53e){return _0x19b965[_0xa9dd('0x1a')](_0x5b11d5)[_0xa9dd('0x1b')](_0x12b53e);}};}function respondWithFilteredResult(_0x47ade9,_0x3d327e){return function(_0x106e07){if(_0x106e07){var _0x13e1ad=_0x106e07[_0xa9dd('0x1c')],_0x507303=_0x3d327e[_0xa9dd('0x1d')],_0xb8815a=_0x3d327e[_0xa9dd('0x1d')]+_0x3d327e[_0xa9dd('0x1e')],_0x4878db;if(_0xb8815a>=_0x13e1ad){_0xb8815a=_0x13e1ad;_0x4878db=0xc8;}else{_0x4878db=0xce;}_0x47ade9['status'](_0x4878db);return _0x47ade9['set'](_0xa9dd('0x1f'),_0x507303+'-'+_0xb8815a+'/'+_0x13e1ad)[_0xa9dd('0x1b')](_0x106e07);}return null;};}function patchUpdates(_0x59533e){return function(_0x368f73){try{jsonpatch[_0xa9dd('0x20')](_0x368f73,_0x59533e,!![]);}catch(_0x23866f){return BPromise[_0xa9dd('0x21')](_0x23866f);}return _0x368f73[_0xa9dd('0x22')]();};}function saveUpdates(_0x58bd35,_0x269df6){return function(_0x2f80fe){if(_0x2f80fe){return _0x2f80fe[_0xa9dd('0x23')](_0x58bd35)[_0xa9dd('0x24')](function(_0x48a231){return _0x48a231;});}return null;};}function removeEntity(_0x2249d7,_0x11d921){return function(_0x464f85){if(_0x464f85){return _0x464f85[_0xa9dd('0x25')]()[_0xa9dd('0x24')](function(){_0x2249d7[_0xa9dd('0x1a')](0xcc)[_0xa9dd('0x19')]();});}};}function handleEntityNotFound(_0x455578,_0x37eced){return function(_0x31a66e){if(!_0x31a66e){_0x455578[_0xa9dd('0x18')](0x194);}return _0x31a66e;};}function handleError(_0x3adf38,_0x2a8ccf){_0x2a8ccf=_0x2a8ccf||0x1f4;return function(_0x571d32){logger[_0xa9dd('0x26')](_0x571d32['stack']);if(_0x571d32['name']){delete _0x571d32[_0xa9dd('0x27')];}_0x3adf38[_0xa9dd('0x1a')](_0x2a8ccf)['send'](_0x571d32);};}exports['index']=function(_0x1c960f,_0x3e3234){var _0x323d7c={},_0x4bfb4c={},_0x2492e0={'count':0x0,'rows':[]};var _0x386413=_[_0xa9dd('0x28')](db[_0xa9dd('0x29')][_0xa9dd('0x2a')],function(_0xbf9b7b){return{'name':_0xbf9b7b[_0xa9dd('0x2b')],'type':_0xbf9b7b[_0xa9dd('0x2c')]['key']};});_0x4bfb4c[_0xa9dd('0x2d')]=_['map'](_0x386413,_0xa9dd('0x27'));_0x4bfb4c[_0xa9dd('0x2e')]=_[_0xa9dd('0x2f')](_0x1c960f[_0xa9dd('0x2e')]);_0x4bfb4c['filters']=_['intersection'](_0x4bfb4c[_0xa9dd('0x2d')],_0x4bfb4c[_0xa9dd('0x2e')]);_0x323d7c['attributes']=_[_0xa9dd('0x30')](_0x4bfb4c['model'],qs[_0xa9dd('0x31')](_0x1c960f[_0xa9dd('0x2e')]['fields']));_0x323d7c[_0xa9dd('0x32')]=_0x323d7c[_0xa9dd('0x32')][_0xa9dd('0x33')]?_0x323d7c[_0xa9dd('0x32')]:_0x4bfb4c[_0xa9dd('0x2d')];if(!_0x1c960f[_0xa9dd('0x2e')][_0xa9dd('0x34')]('nolimit')){_0x323d7c[_0xa9dd('0x1e')]=qs[_0xa9dd('0x1e')](_0x1c960f[_0xa9dd('0x2e')][_0xa9dd('0x1e')]);_0x323d7c[_0xa9dd('0x1d')]=qs[_0xa9dd('0x1d')](_0x1c960f[_0xa9dd('0x2e')][_0xa9dd('0x1d')]);}_0x323d7c['order']=qs[_0xa9dd('0x35')](_0x1c960f['query']['sort']);_0x323d7c[_0xa9dd('0x36')]=qs[_0xa9dd('0x37')](_[_0xa9dd('0x38')](_0x1c960f[_0xa9dd('0x2e')],_0x4bfb4c['filters']),_0x386413);if(_0x1c960f[_0xa9dd('0x2e')][_0xa9dd('0x39')]){_0x323d7c[_0xa9dd('0x36')]=_[_0xa9dd('0x3a')](_0x323d7c[_0xa9dd('0x36')],{'$or':_[_0xa9dd('0x28')](_0x386413,function(_0x248874){if(_0x248874['type']!==_0xa9dd('0x3b')){var _0x56cf83={};_0x56cf83[_0x248874[_0xa9dd('0x27')]]={'$like':'%'+_0x1c960f[_0xa9dd('0x2e')]['filter']+'%'};return _0x56cf83;}})});}_0x323d7c=_['merge']({},_0x323d7c,_0x1c960f[_0xa9dd('0x3c')]);var _0x3c9c9b={'where':_0x323d7c[_0xa9dd('0x36')]};return db['JscriptyQuestionReport'][_0xa9dd('0x1c')](_0x3c9c9b)[_0xa9dd('0x24')](function(_0x21f6cb){_0x2492e0[_0xa9dd('0x1c')]=_0x21f6cb;if(_0x1c960f[_0xa9dd('0x2e')][_0xa9dd('0x3d')]){_0x323d7c[_0xa9dd('0x3e')]=[{'all':!![]}];}return db[_0xa9dd('0x29')][_0xa9dd('0x3f')](_0x323d7c);})[_0xa9dd('0x24')](function(_0x47f30a){_0x2492e0['rows']=_0x47f30a;return _0x2492e0;})[_0xa9dd('0x24')](respondWithFilteredResult(_0x3e3234,_0x323d7c))[_0xa9dd('0x40')](handleError(_0x3e3234,null));};exports[_0xa9dd('0x41')]=function(_0x508a47,_0xa01059){var _0x519448={'raw':!![],'where':{'id':_0x508a47[_0xa9dd('0x42')]['id']}},_0x1efea7={};_0x1efea7[_0xa9dd('0x2d')]=_[_0xa9dd('0x2f')](db[_0xa9dd('0x29')]['rawAttributes']);_0x1efea7[_0xa9dd('0x2e')]=_[_0xa9dd('0x2f')](_0x508a47[_0xa9dd('0x2e')]);_0x1efea7[_0xa9dd('0x37')]=_[_0xa9dd('0x30')](_0x1efea7['model'],_0x1efea7[_0xa9dd('0x2e')]);_0x519448['attributes']=_[_0xa9dd('0x30')](_0x1efea7['model'],qs['fields'](_0x508a47[_0xa9dd('0x2e')][_0xa9dd('0x31')]));_0x519448[_0xa9dd('0x32')]=_0x519448[_0xa9dd('0x32')][_0xa9dd('0x33')]?_0x519448['attributes']:_0x1efea7['model'];if(_0x508a47[_0xa9dd('0x2e')][_0xa9dd('0x3d')]){_0x519448['include']=[{'all':!![]}];}_0x519448=_[_0xa9dd('0x3a')]({},_0x519448,_0x508a47[_0xa9dd('0x3c')]);return db[_0xa9dd('0x29')][_0xa9dd('0x43')](_0x519448)[_0xa9dd('0x24')](handleEntityNotFound(_0xa01059,null))['then'](respondWithResult(_0xa01059,null))['catch'](handleError(_0xa01059,null));};exports['create']=function(_0x41958c,_0x40101c){return db[_0xa9dd('0x29')]['create'](_0x41958c['body'],{})[_0xa9dd('0x24')](respondWithResult(_0x40101c,0xc9))[_0xa9dd('0x40')](handleError(_0x40101c,null));};exports[_0xa9dd('0x23')]=function(_0x2cb15d,_0x6639d7){if(_0x2cb15d[_0xa9dd('0x44')]['id']){delete _0x2cb15d['body']['id'];}return db[_0xa9dd('0x29')][_0xa9dd('0x43')]({'where':{'id':_0x2cb15d[_0xa9dd('0x42')]['id']}})[_0xa9dd('0x24')](handleEntityNotFound(_0x6639d7,null))['then'](saveUpdates(_0x2cb15d['body'],null))[_0xa9dd('0x24')](respondWithResult(_0x6639d7,null))['catch'](handleError(_0x6639d7,null));};exports[_0xa9dd('0x25')]=function(_0x12347e,_0xa0c154){return db['JscriptyQuestionReport'][_0xa9dd('0x43')]({'where':{'id':_0x12347e[_0xa9dd('0x42')]['id']}})[_0xa9dd('0x24')](handleEntityNotFound(_0xa0c154,null))[_0xa9dd('0x24')](removeEntity(_0xa0c154,null))[_0xa9dd('0x40')](handleError(_0xa0c154,null));};exports['describe']=function(_0x94392,_0x2fea99){return db[_0xa9dd('0x29')][_0xa9dd('0x45')]()[_0xa9dd('0x24')](respondWithResult(_0x2fea99,null))[_0xa9dd('0x40')](handleError(_0x2fea99,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c17ce08..fbdd5b3 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 _0x38f3=['path','rimraf','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','api','moment','bluebird','request-promise'];(function(_0x5e295b,_0xe559cc){var _0x594de8=function(_0x1fef83){while(--_0x1fef83){_0x5e295b['push'](_0x5e295b['shift']());}};_0x594de8(++_0xe559cc);}(_0x38f3,0x124));var _0x338f=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x38f3[_0x172948];return _0x4aeaa9;};'use strict';var _=require('lodash');var util=require(_0x338f('0x0'));var logger=require('../../config/logger')(_0x338f('0x1'));var moment=require(_0x338f('0x2'));var BPromise=require(_0x338f('0x3'));var rp=require(_0x338f('0x4'));var fs=require('fs');var path=require(_0x338f('0x5'));var rimraf=require(_0x338f('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x338f('0x7')]=function(_0x49b5cb,_0x4690ee){return _0x49b5cb[_0x338f('0x8')](_0x338f('0x9'),attributes,{'tableName':_0x338f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0777=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5b67ab,_0x2bbcb0){var _0x4270b4=function(_0xbeb4c3){while(--_0xbeb4c3){_0x5b67ab['push'](_0x5b67ab['shift']());}};_0x4270b4(++_0x2bbcb0);}(_0x0777,0x1a9));var _0x7077=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0777[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7077('0x0'));var util=require(_0x7077('0x1'));var logger=require(_0x7077('0x2'))(_0x7077('0x3'));var moment=require(_0x7077('0x4'));var BPromise=require(_0x7077('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7077('0x6'));var config=require('../../config/environment');var attributes=require(_0x7077('0x7'));module[_0x7077('0x8')]=function(_0x212fae,_0x5c15fd){return _0x212fae[_0x7077('0x9')](_0x7077('0xa'),attributes,{'tableName':_0x7077('0xb'),'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 07ff041..5db52af 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 _0xdfc0=['client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0xe74be,_0x5d53fc){var _0x3faf61=function(_0x1c7d76){while(--_0x1c7d76){_0xe74be['push'](_0xe74be['shift']());}};_0x3faf61(++_0x5d53fc);}(_0xdfc0,0x6b));var _0x0dfc=function(_0x49445b,_0xe876ee){_0x49445b=_0x49445b-0x0;var _0xf534b=_0xdfc0[_0x49445b];return _0xf534b;};'use strict';var _=require(_0x0dfc('0x0'));var util=require(_0x0dfc('0x1'));var moment=require(_0x0dfc('0x2'));var BPromise=require(_0x0dfc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dfc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0dfc('0x5'));var logger=require(_0x0dfc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0dfc('0x7'));var client=jayson[_0x0dfc('0x8')][_0x0dfc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c55f7,_0x30bb98,_0x3bd5ad){return new BPromise(function(_0x392336,_0x39871d){return client[_0x0dfc('0xa')](_0x1c55f7,_0x3bd5ad)[_0x0dfc('0xb')](function(_0x13413e){logger[_0x0dfc('0xc')](_0x0dfc('0xd'),_0x30bb98,_0x0dfc('0xe'));logger[_0x0dfc('0xf')](_0x0dfc('0x10'),_0x30bb98,_0x0dfc('0xe'),JSON[_0x0dfc('0x11')](_0x13413e));if(_0x13413e['error']){if(_0x13413e[_0x0dfc('0x12')][_0x0dfc('0x13')]===0x1f4){logger[_0x0dfc('0x12')](_0x0dfc('0xd'),_0x30bb98,_0x13413e[_0x0dfc('0x12')]['message']);return _0x39871d(_0x13413e[_0x0dfc('0x12')]['message']);}logger[_0x0dfc('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x30bb98,_0x13413e['error'][_0x0dfc('0x14')]);return _0x392336(_0x13413e[_0x0dfc('0x12')][_0x0dfc('0x14')]);}else{logger[_0x0dfc('0xc')](_0x0dfc('0xd'),_0x30bb98,'request\x20sent');_0x392336(_0x13413e[_0x0dfc('0x15')][_0x0dfc('0x14')]);}})[_0x0dfc('0x16')](function(_0x5c9d23){logger[_0x0dfc('0x12')](_0x0dfc('0xd'),_0x30bb98,_0x5c9d23);_0x39871d(_0x5c9d23);});});} \ No newline at end of file +var _0x3e4b=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5217d7,_0x1cfcc5){var _0x30670b=function(_0x2fa1d8){while(--_0x2fa1d8){_0x5217d7['push'](_0x5217d7['shift']());}};_0x30670b(++_0x1cfcc5);}(_0x3e4b,0xb3));var _0xb3e4=function(_0x226903,_0x39e099){_0x226903=_0x226903-0x0;var _0x36eef3=_0x3e4b[_0x226903];return _0x36eef3;};'use strict';var _=require(_0xb3e4('0x0'));var util=require(_0xb3e4('0x1'));var moment=require(_0xb3e4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3e4('0x3'));var fs=require('fs');var Redis=require(_0xb3e4('0x4'));var db=require(_0xb3e4('0x5'))['db'];var utils=require(_0xb3e4('0x6'));var logger=require(_0xb3e4('0x7'))(_0xb3e4('0x8'));var config=require(_0xb3e4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb3e4('0xa')][_0xb3e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4626cb,_0x4c00dd,_0x5915c5){return new BPromise(function(_0x2c5f65,_0x27363e){return client[_0xb3e4('0xc')](_0x4626cb,_0x5915c5)['then'](function(_0x18bd62){logger[_0xb3e4('0xd')](_0xb3e4('0xe'),_0x4c00dd,_0xb3e4('0xf'));logger[_0xb3e4('0x10')](_0xb3e4('0x11'),_0x4c00dd,'request\x20sent',JSON[_0xb3e4('0x12')](_0x18bd62));if(_0x18bd62[_0xb3e4('0x13')]){if(_0x18bd62['error'][_0xb3e4('0x14')]===0x1f4){logger[_0xb3e4('0x13')](_0xb3e4('0xe'),_0x4c00dd,_0x18bd62[_0xb3e4('0x13')]['message']);return _0x27363e(_0x18bd62[_0xb3e4('0x13')]['message']);}logger[_0xb3e4('0x13')](_0xb3e4('0xe'),_0x4c00dd,_0x18bd62[_0xb3e4('0x13')]['message']);return _0x2c5f65(_0x18bd62[_0xb3e4('0x13')][_0xb3e4('0x15')]);}else{logger['info'](_0xb3e4('0xe'),_0x4c00dd,_0xb3e4('0xf'));_0x2c5f65(_0x18bd62[_0xb3e4('0x16')]['message']);}})[_0xb3e4('0x17')](function(_0x40622c){logger['error'](_0xb3e4('0xe'),_0x4c00dd,_0x40622c);_0x27363e(_0x40622c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f80725c..a97dd45 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 _0xc569=['describe','/:id','show','getQuestions','post','create','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe'];(function(_0x5af10b,_0x6398ab){var _0x454bde=function(_0x5790f5){while(--_0x5790f5){_0x5af10b['push'](_0x5af10b['shift']());}};_0x454bde(++_0x6398ab);}(_0xc569,0x159));var _0x9c56=function(_0x4fa35d,_0x29403b){_0x4fa35d=_0x4fa35d-0x0;var _0x5362bd=_0xc569[_0x4fa35d];return _0x5362bd;};'use strict';var multer=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var path=require(_0x9c56('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c56('0x3'));var router=express[_0x9c56('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9c56('0x5'));var config=require(_0x9c56('0x6'));var controller=require(_0x9c56('0x7'));router['get']('/',auth[_0x9c56('0x8')](),controller[_0x9c56('0x9')]);router[_0x9c56('0xa')](_0x9c56('0xb'),auth['isAuthenticated'](),controller[_0x9c56('0xc')]);router[_0x9c56('0xa')](_0x9c56('0xd'),auth[_0x9c56('0x8')](),controller[_0x9c56('0xe')]);router['get']('/:id/questions',auth['isAuthenticated'](),controller[_0x9c56('0xf')]);router[_0x9c56('0x10')]('/',auth['isAuthenticated'](),controller[_0x9c56('0x11')]);router['put'](_0x9c56('0xd'),auth[_0x9c56('0x8')](),controller[_0x9c56('0x12')]);router[_0x9c56('0x13')](_0x9c56('0xd'),auth[_0x9c56('0x8')](),controller[_0x9c56('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf0ba=['get','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var path=require(_0xaf0b('0x2'));var timeout=require(_0xaf0b('0x3'));var express=require(_0xaf0b('0x4'));var router=express['Router']();var auth=require(_0xaf0b('0x5'));var interaction=require(_0xaf0b('0x6'));var config=require('../../config/environment');var controller=require(_0xaf0b('0x7'));router['get']('/',auth[_0xaf0b('0x8')](),controller['index']);router['get'](_0xaf0b('0x9'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0xa')]);router[_0xaf0b('0xb')](_0xaf0b('0xc'),auth['isAuthenticated'](),controller[_0xaf0b('0xd')]);router[_0xaf0b('0xb')](_0xaf0b('0xe'),auth['isAuthenticated'](),controller[_0xaf0b('0xf')]);router['post']('/',auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x10')]);router[_0xaf0b('0x11')]('/:id',auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x12')]);router[_0xaf0b('0x13')](_0xaf0b('0xc'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0bb988e..3b02ba1 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 _0x72a6=['endtime','format','STRING','BOOLEAN','moment','exports','DATE','setDataValue','starttime'];(function(_0x3216f5,_0xe32e8a){var _0x17035a=function(_0x5f28cd){while(--_0x5f28cd){_0x3216f5['push'](_0x3216f5['shift']());}};_0x17035a(++_0xe32e8a);}(_0x72a6,0x82));var _0x672a=function(_0x2e0324,_0x4642ac){_0x2e0324=_0x2e0324-0x0;var _0x22d0c8=_0x72a6[_0x2e0324];return _0x22d0c8;};'use strict';var moment=require(_0x672a('0x0'));var Sequelize=require('sequelize');module[_0x672a('0x1')]={'starttime':{'type':Sequelize[_0x672a('0x2')],'set':function(_0x3b8090){this[_0x672a('0x3')](_0x672a('0x4'),_0x3b8090);this['setDataValue'](_0x672a('0x5'),moment()[_0x672a('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x672a('0x7')]},'projectname':{'type':Sequelize[_0x672a('0x7')]},'queue':{'type':Sequelize[_0x672a('0x7')]},'uniqueid':{'type':Sequelize[_0x672a('0x7')]},'calleridname':{'type':Sequelize[_0x672a('0x7')]},'calleridnum':{'type':Sequelize[_0x672a('0x7')]},'completed':{'type':Sequelize[_0x672a('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x0405=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','format'];(function(_0x5d2516,_0x30862b){var _0x55cf98=function(_0x46c04f){while(--_0x46c04f){_0x5d2516['push'](_0x5d2516['shift']());}};_0x55cf98(++_0x30862b);}(_0x0405,0x17b));var _0x5040=function(_0x3e1aba,_0x7c44f3){_0x3e1aba=_0x3e1aba-0x0;var _0x3b3ab3=_0x0405[_0x3e1aba];return _0x3b3ab3;};'use strict';var moment=require(_0x5040('0x0'));var Sequelize=require(_0x5040('0x1'));module[_0x5040('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x57f9d5){this['setDataValue']('starttime',_0x57f9d5);this[_0x5040('0x3')]('endtime',moment()[_0x5040('0x4')](_0x5040('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x5040('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5040('0x6')]},'uniqueid':{'type':Sequelize[_0x5040('0x6')]},'calleridname':{'type':Sequelize[_0x5040('0x6')]},'calleridnum':{'type':Sequelize[_0x5040('0x6')]},'completed':{'type':Sequelize[_0x5040('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1e9cdaa..6d881b5 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 _0x0163=['params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','JscriptySessionReport','create','body'];(function(_0x1ca9bd,_0x550682){var _0x294790=function(_0x59ae8b){while(--_0x59ae8b){_0x1ca9bd['push'](_0x1ca9bd['shift']());}};_0x294790(++_0x550682);}(_0x0163,0xe7));var _0x3016=function(_0x3ab7ab,_0xe0e19b){_0x3ab7ab=_0x3ab7ab-0x0;var _0x1669ec=_0x0163[_0x3ab7ab];return _0x1669ec;};'use strict';var pdf=require(_0x3016('0x0'));var emlformat=require(_0x3016('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3016('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3016('0x3'));var moment=require(_0x3016('0x4'));var BPromise=require(_0x3016('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3016('0x6'));var sox=require(_0x3016('0x7'));var csv=require(_0x3016('0x8'));var ejs=require(_0x3016('0x9'));var fs=require('fs');var _=require(_0x3016('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3016('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3016('0x8'));var querystring=require(_0x3016('0xc'));var Papa=require('papaparse');var Redis=require(_0x3016('0xd'));var authService=require(_0x3016('0xe'));var qs=require(_0x3016('0xf'));var as=require(_0x3016('0x10'));var hardwareService=require(_0x3016('0x11'));var logger=require('../../config/logger')(_0x3016('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3016('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x383aef,_0x4a80e0){_0x4a80e0=_0x4a80e0||0xcc;return function(_0x38c0ae){if(_0x38c0ae){return _0x383aef[_0x3016('0x14')](_0x4a80e0);}return _0x383aef[_0x3016('0x15')](_0x4a80e0)[_0x3016('0x16')]();};}function respondWithResult(_0x188b40,_0x55297a){_0x55297a=_0x55297a||0xc8;return function(_0x5888e6){if(_0x5888e6){return _0x188b40[_0x3016('0x15')](_0x55297a)[_0x3016('0x17')](_0x5888e6);}};}function respondWithFilteredResult(_0x2b299b,_0x1b0cdf){return function(_0x30f74b){if(_0x30f74b){var _0x21d346=_0x30f74b[_0x3016('0x18')],_0xd6a73b=_0x1b0cdf[_0x3016('0x19')],_0x176094=_0x1b0cdf['offset']+_0x1b0cdf[_0x3016('0x1a')],_0x214ce6;if(_0x176094>=_0x21d346){_0x176094=_0x21d346;_0x214ce6=0xc8;}else{_0x214ce6=0xce;}_0x2b299b['status'](_0x214ce6);return _0x2b299b['set'](_0x3016('0x1b'),_0xd6a73b+'-'+_0x176094+'/'+_0x21d346)['json'](_0x30f74b);}return null;};}function patchUpdates(_0x3430e4){return function(_0xe3a232){try{jsonpatch[_0x3016('0x1c')](_0xe3a232,_0x3430e4,!![]);}catch(_0x43e097){return BPromise['reject'](_0x43e097);}return _0xe3a232[_0x3016('0x1d')]();};}function saveUpdates(_0x3bacdc,_0x5df416){return function(_0x4f691c){if(_0x4f691c){return _0x4f691c[_0x3016('0x1e')](_0x3bacdc)[_0x3016('0x1f')](function(_0x653470){return _0x653470;});}return null;};}function removeEntity(_0x29bbcc,_0xa8fed8){return function(_0x1f23de){if(_0x1f23de){return _0x1f23de[_0x3016('0x20')]()[_0x3016('0x1f')](function(){_0x29bbcc[_0x3016('0x15')](0xcc)[_0x3016('0x16')]();});}};}function handleEntityNotFound(_0x3ce61a,_0x56a50b){return function(_0x59e2db){if(!_0x59e2db){_0x3ce61a[_0x3016('0x14')](0x194);}return _0x59e2db;};}function handleError(_0x1c0e07,_0x129bfc){_0x129bfc=_0x129bfc||0x1f4;return function(_0x1e21e8){logger[_0x3016('0x21')](_0x1e21e8[_0x3016('0x22')]);if(_0x1e21e8[_0x3016('0x23')]){delete _0x1e21e8[_0x3016('0x23')];}_0x1c0e07['status'](_0x129bfc)[_0x3016('0x24')](_0x1e21e8);};}exports[_0x3016('0x25')]=function(_0xb7ffb3,_0x4eb2b5){var _0x3c0ae8={},_0x32d907={},_0x3cf889={'count':0x0,'rows':[]};var _0x1344e3=_[_0x3016('0x26')](db['JscriptySessionReport'][_0x3016('0x27')],function(_0x18227f){return{'name':_0x18227f[_0x3016('0x28')],'type':_0x18227f[_0x3016('0x29')][_0x3016('0x2a')]};});_0x32d907['model']=_[_0x3016('0x26')](_0x1344e3,_0x3016('0x23'));_0x32d907['query']=_['keys'](_0xb7ffb3[_0x3016('0x2b')]);_0x32d907[_0x3016('0x2c')]=_['intersection'](_0x32d907['model'],_0x32d907[_0x3016('0x2b')]);_0x3c0ae8[_0x3016('0x2d')]=_[_0x3016('0x2e')](_0x32d907[_0x3016('0x2f')],qs[_0x3016('0x30')](_0xb7ffb3[_0x3016('0x2b')][_0x3016('0x30')]));_0x3c0ae8[_0x3016('0x2d')]=_0x3c0ae8[_0x3016('0x2d')][_0x3016('0x31')]?_0x3c0ae8[_0x3016('0x2d')]:_0x32d907[_0x3016('0x2f')];if(!_0xb7ffb3['query'][_0x3016('0x32')](_0x3016('0x33'))){_0x3c0ae8[_0x3016('0x1a')]=qs['limit'](_0xb7ffb3[_0x3016('0x2b')][_0x3016('0x1a')]);_0x3c0ae8[_0x3016('0x19')]=qs[_0x3016('0x19')](_0xb7ffb3[_0x3016('0x2b')][_0x3016('0x19')]);}_0x3c0ae8[_0x3016('0x34')]=qs[_0x3016('0x35')](_0xb7ffb3[_0x3016('0x2b')]['sort']);_0x3c0ae8[_0x3016('0x36')]=qs['filters'](_[_0x3016('0x37')](_0xb7ffb3[_0x3016('0x2b')],_0x32d907[_0x3016('0x2c')]),_0x1344e3);if(_0xb7ffb3['query'][_0x3016('0x38')]){_0x3c0ae8[_0x3016('0x36')]=_[_0x3016('0x39')](_0x3c0ae8[_0x3016('0x36')],{'$or':_[_0x3016('0x26')](_0x1344e3,function(_0x3df996){if(_0x3df996[_0x3016('0x29')]!==_0x3016('0x3a')){var _0x532b3d={};_0x532b3d[_0x3df996[_0x3016('0x23')]]={'$like':'%'+_0xb7ffb3[_0x3016('0x2b')][_0x3016('0x38')]+'%'};return _0x532b3d;}})});}_0x3c0ae8=_[_0x3016('0x39')]({},_0x3c0ae8,_0xb7ffb3[_0x3016('0x3b')]);var _0x3f52d3={'where':_0x3c0ae8[_0x3016('0x36')]};return db['JscriptySessionReport'][_0x3016('0x18')](_0x3f52d3)['then'](function(_0x5e3046){_0x3cf889[_0x3016('0x18')]=_0x5e3046;if(_0xb7ffb3[_0x3016('0x2b')][_0x3016('0x3c')]){_0x3c0ae8[_0x3016('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3016('0x3e')](_0x3c0ae8);})[_0x3016('0x1f')](function(_0x5c7a46){_0x3cf889[_0x3016('0x3f')]=_0x5c7a46;return _0x3cf889;})[_0x3016('0x1f')](respondWithFilteredResult(_0x4eb2b5,_0x3c0ae8))[_0x3016('0x40')](handleError(_0x4eb2b5,null));};exports['show']=function(_0x295451,_0x534af4){var _0x3b7bbc={'raw':!![],'where':{'id':_0x295451['params']['id']}},_0x4d6384={};_0x4d6384[_0x3016('0x2f')]=_[_0x3016('0x41')](db[_0x3016('0x42')]['rawAttributes']);_0x4d6384['query']=_['keys'](_0x295451[_0x3016('0x2b')]);_0x4d6384[_0x3016('0x2c')]=_[_0x3016('0x2e')](_0x4d6384[_0x3016('0x2f')],_0x4d6384[_0x3016('0x2b')]);_0x3b7bbc[_0x3016('0x2d')]=_['intersection'](_0x4d6384[_0x3016('0x2f')],qs['fields'](_0x295451[_0x3016('0x2b')]['fields']));_0x3b7bbc[_0x3016('0x2d')]=_0x3b7bbc['attributes'][_0x3016('0x31')]?_0x3b7bbc['attributes']:_0x4d6384[_0x3016('0x2f')];if(_0x295451[_0x3016('0x2b')][_0x3016('0x3c')]){_0x3b7bbc['include']=[{'all':!![]}];}_0x3b7bbc=_['merge']({},_0x3b7bbc,_0x295451[_0x3016('0x3b')]);return db[_0x3016('0x42')]['find'](_0x3b7bbc)[_0x3016('0x1f')](handleEntityNotFound(_0x534af4,null))['then'](respondWithResult(_0x534af4,null))['catch'](handleError(_0x534af4,null));};exports[_0x3016('0x43')]=function(_0x307c9c,_0x2b5ce5){return db[_0x3016('0x42')][_0x3016('0x43')](_0x307c9c[_0x3016('0x44')],{})[_0x3016('0x1f')](respondWithResult(_0x2b5ce5,0xc9))[_0x3016('0x40')](handleError(_0x2b5ce5,null));};exports[_0x3016('0x1e')]=function(_0x1d49b0,_0x544d87){if(_0x1d49b0[_0x3016('0x44')]['id']){delete _0x1d49b0[_0x3016('0x44')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x1d49b0['params']['id']}})['then'](handleEntityNotFound(_0x544d87,null))[_0x3016('0x1f')](saveUpdates(_0x1d49b0[_0x3016('0x44')],null))[_0x3016('0x1f')](respondWithResult(_0x544d87,null))[_0x3016('0x40')](handleError(_0x544d87,null));};exports[_0x3016('0x20')]=function(_0x11ab9e,_0x1c6859){return db[_0x3016('0x42')]['find']({'where':{'id':_0x11ab9e[_0x3016('0x45')]['id']}})[_0x3016('0x1f')](handleEntityNotFound(_0x1c6859,null))[_0x3016('0x1f')](removeEntity(_0x1c6859,null))[_0x3016('0x40')](handleError(_0x1c6859,null));};exports[_0x3016('0x46')]=function(_0xc4b501,_0x562211){return db[_0x3016('0x42')]['describe']()[_0x3016('0x1f')](respondWithResult(_0x562211,null))[_0x3016('0x40')](handleError(_0x562211,null));};exports[_0x3016('0x47')]=function(_0x39d4b7,_0x47c170,_0x5c118c){var _0x548111={'raw':!![],'where':{}};var _0x3225ab={};var _0x575d23={'count':0x0,'rows':[]};return db[_0x3016('0x42')][_0x3016('0x48')]({'where':{'id':_0x39d4b7[_0x3016('0x45')]['id']}})[_0x3016('0x1f')](handleEntityNotFound(_0x47c170,null))[_0x3016('0x1f')](function(_0x3124d4){if(_0x3124d4){_0x3225ab[_0x3016('0x2f')]=_[_0x3016('0x41')](db[_0x3016('0x49')][_0x3016('0x27')]);_0x3225ab[_0x3016('0x2b')]=_['keys'](_0x39d4b7[_0x3016('0x2b')]);_0x3225ab[_0x3016('0x2c')]=_[_0x3016('0x2e')](_0x3225ab[_0x3016('0x2f')],_0x3225ab[_0x3016('0x2b')]);_0x548111['attributes']=_[_0x3016('0x2e')](_0x3225ab[_0x3016('0x2f')],qs[_0x3016('0x30')](_0x39d4b7[_0x3016('0x2b')][_0x3016('0x30')]));_0x548111['attributes']=_0x548111[_0x3016('0x2d')][_0x3016('0x31')]?_0x548111[_0x3016('0x2d')]:_0x3225ab[_0x3016('0x2f')];if(!_0x39d4b7[_0x3016('0x2b')][_0x3016('0x32')](_0x3016('0x33'))){_0x548111[_0x3016('0x1a')]=qs[_0x3016('0x1a')](_0x39d4b7[_0x3016('0x2b')][_0x3016('0x1a')]);_0x548111[_0x3016('0x19')]=qs[_0x3016('0x19')](_0x39d4b7[_0x3016('0x2b')][_0x3016('0x19')]);}_0x548111['order']=qs['sort'](_0x39d4b7[_0x3016('0x2b')][_0x3016('0x35')]);_0x548111[_0x3016('0x36')]=qs[_0x3016('0x2c')](_[_0x3016('0x37')](_0x39d4b7[_0x3016('0x2b')],_0x3225ab[_0x3016('0x2c')]));_0x548111[_0x3016('0x36')][_0x3016('0x4a')]=_0x3124d4['id'];if(_0x39d4b7['query'][_0x3016('0x38')]){_0x548111[_0x3016('0x36')]=_['merge'](_0x548111['where'],{'$or':_[_0x3016('0x26')](_0x548111[_0x3016('0x2d')],function(_0x1f35c5){var _0x524132={};_0x524132[_0x1f35c5]={'$like':'%'+_0x39d4b7[_0x3016('0x2b')]['filter']+'%'};return _0x524132;})});}_0x548111=_[_0x3016('0x39')]({},_0x548111,_0x39d4b7['options']);return db[_0x3016('0x49')][_0x3016('0x18')]({'where':_0x548111[_0x3016('0x36')]})[_0x3016('0x1f')](function(_0x36de4d){_0x575d23[_0x3016('0x18')]=_0x36de4d;if(_0x39d4b7[_0x3016('0x2b')][_0x3016('0x3c')]){_0x548111[_0x3016('0x3d')]=[{'all':!![]}];}return db[_0x3016('0x49')][_0x3016('0x3e')](_0x548111);})[_0x3016('0x1f')](function(_0x1f731c){_0x575d23[_0x3016('0x3f')]=_0x1f731c;return _0x575d23;});}})[_0x3016('0x1f')](respondWithFilteredResult(_0x47c170,_0x548111))[_0x3016('0x40')](handleError(_0x47c170,null));}; \ No newline at end of file +var _0xa2dc=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','options','JscriptySessionReport','includeAll','include','catch','show','params','find','create','body','destroy','getQuestions','findOne','JscriptyQuestionReport','findAll','rows','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x571825,_0x41b7a0){var _0x8c32e7=function(_0x1db730){while(--_0x1db730){_0x571825['push'](_0x571825['shift']());}};_0x8c32e7(++_0x41b7a0);}(_0xa2dc,0x14a));var _0xca2d=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xa2dc[_0x27d958];return _0x53e63e;};'use strict';var pdf=require(_0xca2d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xca2d('0x1'));var zipdir=require(_0xca2d('0x2'));var jsonpatch=require(_0xca2d('0x3'));var rp=require(_0xca2d('0x4'));var moment=require(_0xca2d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xca2d('0x6'));var util=require(_0xca2d('0x7'));var path=require(_0xca2d('0x8'));var sox=require(_0xca2d('0x9'));var csv=require(_0xca2d('0xa'));var ejs=require(_0xca2d('0xb'));var fs=require('fs');var _=require(_0xca2d('0xc'));var squel=require(_0xca2d('0xd'));var crypto=require(_0xca2d('0xe'));var jsforce=require(_0xca2d('0xf'));var deskjs=require(_0xca2d('0x10'));var toCsv=require(_0xca2d('0xa'));var querystring=require(_0xca2d('0x11'));var Papa=require(_0xca2d('0x12'));var Redis=require('ioredis');var authService=require(_0xca2d('0x13'));var qs=require(_0xca2d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca2d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xca2d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xca2d('0x17'))['db'];function respondWithStatusCode(_0x4ee272,_0x52b49a){_0x52b49a=_0x52b49a||0xcc;return function(_0x5e5652){if(_0x5e5652){return _0x4ee272[_0xca2d('0x18')](_0x52b49a);}return _0x4ee272[_0xca2d('0x19')](_0x52b49a)[_0xca2d('0x1a')]();};}function respondWithResult(_0x1e1932,_0x4a6e0c){_0x4a6e0c=_0x4a6e0c||0xc8;return function(_0x512d8){if(_0x512d8){return _0x1e1932[_0xca2d('0x19')](_0x4a6e0c)['json'](_0x512d8);}};}function respondWithFilteredResult(_0x34d079,_0x535cdf){return function(_0x52b9a9){if(_0x52b9a9){var _0x5b5c75=_0x52b9a9[_0xca2d('0x1b')],_0x36cd44=_0x535cdf[_0xca2d('0x1c')],_0x44e8ea=_0x535cdf['offset']+_0x535cdf['limit'],_0x35bd94;if(_0x44e8ea>=_0x5b5c75){_0x44e8ea=_0x5b5c75;_0x35bd94=0xc8;}else{_0x35bd94=0xce;}_0x34d079['status'](_0x35bd94);return _0x34d079['set'](_0xca2d('0x1d'),_0x36cd44+'-'+_0x44e8ea+'/'+_0x5b5c75)[_0xca2d('0x1e')](_0x52b9a9);}return null;};}function patchUpdates(_0x5dd1f6){return function(_0x405bae){try{jsonpatch['apply'](_0x405bae,_0x5dd1f6,!![]);}catch(_0x451f48){return BPromise['reject'](_0x451f48);}return _0x405bae[_0xca2d('0x1f')]();};}function saveUpdates(_0x4a7cf8,_0x5da4bb){return function(_0x5ca94f){if(_0x5ca94f){return _0x5ca94f[_0xca2d('0x20')](_0x4a7cf8)['then'](function(_0x3faa7b){return _0x3faa7b;});}return null;};}function removeEntity(_0x4a0527,_0x4434bf){return function(_0x15aabb){if(_0x15aabb){return _0x15aabb['destroy']()[_0xca2d('0x21')](function(){_0x4a0527[_0xca2d('0x19')](0xcc)[_0xca2d('0x1a')]();});}};}function handleEntityNotFound(_0x4dead6,_0x7a3ecb){return function(_0x1f7c37){if(!_0x1f7c37){_0x4dead6[_0xca2d('0x18')](0x194);}return _0x1f7c37;};}function handleError(_0x1e892a,_0xd0d66a){_0xd0d66a=_0xd0d66a||0x1f4;return function(_0x531492){logger['error'](_0x531492[_0xca2d('0x22')]);if(_0x531492[_0xca2d('0x23')]){delete _0x531492['name'];}_0x1e892a[_0xca2d('0x19')](_0xd0d66a)[_0xca2d('0x24')](_0x531492);};}exports[_0xca2d('0x25')]=function(_0x508205,_0x2a9082){var _0x4c5e9a={},_0x550cfc={},_0xa7e3c6={'count':0x0,'rows':[]};var _0x97a215=_[_0xca2d('0x26')](db['JscriptySessionReport'][_0xca2d('0x27')],function(_0x43bf2f){return{'name':_0x43bf2f[_0xca2d('0x28')],'type':_0x43bf2f[_0xca2d('0x29')][_0xca2d('0x2a')]};});_0x550cfc[_0xca2d('0x2b')]=_[_0xca2d('0x26')](_0x97a215,_0xca2d('0x23'));_0x550cfc[_0xca2d('0x2c')]=_[_0xca2d('0x2d')](_0x508205[_0xca2d('0x2c')]);_0x550cfc['filters']=_[_0xca2d('0x2e')](_0x550cfc[_0xca2d('0x2b')],_0x550cfc['query']);_0x4c5e9a[_0xca2d('0x2f')]=_['intersection'](_0x550cfc[_0xca2d('0x2b')],qs[_0xca2d('0x30')](_0x508205[_0xca2d('0x2c')][_0xca2d('0x30')]));_0x4c5e9a[_0xca2d('0x2f')]=_0x4c5e9a[_0xca2d('0x2f')][_0xca2d('0x31')]?_0x4c5e9a[_0xca2d('0x2f')]:_0x550cfc[_0xca2d('0x2b')];if(!_0x508205[_0xca2d('0x2c')][_0xca2d('0x32')](_0xca2d('0x33'))){_0x4c5e9a[_0xca2d('0x34')]=qs['limit'](_0x508205[_0xca2d('0x2c')][_0xca2d('0x34')]);_0x4c5e9a[_0xca2d('0x1c')]=qs[_0xca2d('0x1c')](_0x508205[_0xca2d('0x2c')][_0xca2d('0x1c')]);}_0x4c5e9a[_0xca2d('0x35')]=qs[_0xca2d('0x36')](_0x508205[_0xca2d('0x2c')]['sort']);_0x4c5e9a[_0xca2d('0x37')]=qs['filters'](_[_0xca2d('0x38')](_0x508205[_0xca2d('0x2c')],_0x550cfc[_0xca2d('0x39')]),_0x97a215);if(_0x508205[_0xca2d('0x2c')][_0xca2d('0x3a')]){_0x4c5e9a['where']=_['merge'](_0x4c5e9a[_0xca2d('0x37')],{'$or':_[_0xca2d('0x26')](_0x97a215,function(_0x55dc21){if(_0x55dc21['type']!=='VIRTUAL'){var _0x35cec7={};_0x35cec7[_0x55dc21[_0xca2d('0x23')]]={'$like':'%'+_0x508205['query'][_0xca2d('0x3a')]+'%'};return _0x35cec7;}})});}_0x4c5e9a=_[_0xca2d('0x3b')]({},_0x4c5e9a,_0x508205[_0xca2d('0x3c')]);var _0x57db4c={'where':_0x4c5e9a[_0xca2d('0x37')]};return db[_0xca2d('0x3d')][_0xca2d('0x1b')](_0x57db4c)['then'](function(_0x2fcb12){_0xa7e3c6[_0xca2d('0x1b')]=_0x2fcb12;if(_0x508205[_0xca2d('0x2c')][_0xca2d('0x3e')]){_0x4c5e9a[_0xca2d('0x3f')]=[{'all':!![]}];}return db[_0xca2d('0x3d')]['findAll'](_0x4c5e9a);})[_0xca2d('0x21')](function(_0x1d20ce){_0xa7e3c6['rows']=_0x1d20ce;return _0xa7e3c6;})[_0xca2d('0x21')](respondWithFilteredResult(_0x2a9082,_0x4c5e9a))[_0xca2d('0x40')](handleError(_0x2a9082,null));};exports[_0xca2d('0x41')]=function(_0xbb73bb,_0x230bb8){var _0x22850a={'raw':!![],'where':{'id':_0xbb73bb[_0xca2d('0x42')]['id']}},_0x3498cf={};_0x3498cf[_0xca2d('0x2b')]=_[_0xca2d('0x2d')](db[_0xca2d('0x3d')][_0xca2d('0x27')]);_0x3498cf[_0xca2d('0x2c')]=_[_0xca2d('0x2d')](_0xbb73bb['query']);_0x3498cf[_0xca2d('0x39')]=_['intersection'](_0x3498cf[_0xca2d('0x2b')],_0x3498cf[_0xca2d('0x2c')]);_0x22850a[_0xca2d('0x2f')]=_[_0xca2d('0x2e')](_0x3498cf[_0xca2d('0x2b')],qs[_0xca2d('0x30')](_0xbb73bb[_0xca2d('0x2c')][_0xca2d('0x30')]));_0x22850a[_0xca2d('0x2f')]=_0x22850a[_0xca2d('0x2f')][_0xca2d('0x31')]?_0x22850a[_0xca2d('0x2f')]:_0x3498cf[_0xca2d('0x2b')];if(_0xbb73bb[_0xca2d('0x2c')][_0xca2d('0x3e')]){_0x22850a['include']=[{'all':!![]}];}_0x22850a=_[_0xca2d('0x3b')]({},_0x22850a,_0xbb73bb[_0xca2d('0x3c')]);return db[_0xca2d('0x3d')][_0xca2d('0x43')](_0x22850a)[_0xca2d('0x21')](handleEntityNotFound(_0x230bb8,null))[_0xca2d('0x21')](respondWithResult(_0x230bb8,null))[_0xca2d('0x40')](handleError(_0x230bb8,null));};exports[_0xca2d('0x44')]=function(_0x211fe4,_0x9e4ea7){return db[_0xca2d('0x3d')][_0xca2d('0x44')](_0x211fe4[_0xca2d('0x45')],{})['then'](respondWithResult(_0x9e4ea7,0xc9))[_0xca2d('0x40')](handleError(_0x9e4ea7,null));};exports[_0xca2d('0x20')]=function(_0x4a5486,_0x3c3b69){if(_0x4a5486[_0xca2d('0x45')]['id']){delete _0x4a5486[_0xca2d('0x45')]['id'];}return db[_0xca2d('0x3d')]['find']({'where':{'id':_0x4a5486[_0xca2d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c3b69,null))[_0xca2d('0x21')](saveUpdates(_0x4a5486['body'],null))[_0xca2d('0x21')](respondWithResult(_0x3c3b69,null))[_0xca2d('0x40')](handleError(_0x3c3b69,null));};exports[_0xca2d('0x46')]=function(_0x52ea4d,_0x1217ec){return db[_0xca2d('0x3d')][_0xca2d('0x43')]({'where':{'id':_0x52ea4d['params']['id']}})[_0xca2d('0x21')](handleEntityNotFound(_0x1217ec,null))[_0xca2d('0x21')](removeEntity(_0x1217ec,null))[_0xca2d('0x40')](handleError(_0x1217ec,null));};exports['describe']=function(_0x20139c,_0x37e137){return db[_0xca2d('0x3d')]['describe']()[_0xca2d('0x21')](respondWithResult(_0x37e137,null))['catch'](handleError(_0x37e137,null));};exports[_0xca2d('0x47')]=function(_0x2f4fc3,_0x34f843,_0x43b58d){var _0x266e99={'raw':!![],'where':{}};var _0xab3933={};var _0x2f437c={'count':0x0,'rows':[]};return db[_0xca2d('0x3d')][_0xca2d('0x48')]({'where':{'id':_0x2f4fc3[_0xca2d('0x42')]['id']}})[_0xca2d('0x21')](handleEntityNotFound(_0x34f843,null))['then'](function(_0x529420){if(_0x529420){_0xab3933[_0xca2d('0x2b')]=_[_0xca2d('0x2d')](db['JscriptyQuestionReport']['rawAttributes']);_0xab3933[_0xca2d('0x2c')]=_['keys'](_0x2f4fc3[_0xca2d('0x2c')]);_0xab3933['filters']=_[_0xca2d('0x2e')](_0xab3933[_0xca2d('0x2b')],_0xab3933[_0xca2d('0x2c')]);_0x266e99[_0xca2d('0x2f')]=_[_0xca2d('0x2e')](_0xab3933[_0xca2d('0x2b')],qs[_0xca2d('0x30')](_0x2f4fc3['query']['fields']));_0x266e99['attributes']=_0x266e99[_0xca2d('0x2f')][_0xca2d('0x31')]?_0x266e99[_0xca2d('0x2f')]:_0xab3933[_0xca2d('0x2b')];if(!_0x2f4fc3[_0xca2d('0x2c')][_0xca2d('0x32')]('nolimit')){_0x266e99[_0xca2d('0x34')]=qs[_0xca2d('0x34')](_0x2f4fc3[_0xca2d('0x2c')][_0xca2d('0x34')]);_0x266e99['offset']=qs['offset'](_0x2f4fc3[_0xca2d('0x2c')][_0xca2d('0x1c')]);}_0x266e99['order']=qs[_0xca2d('0x36')](_0x2f4fc3[_0xca2d('0x2c')][_0xca2d('0x36')]);_0x266e99[_0xca2d('0x37')]=qs[_0xca2d('0x39')](_['pick'](_0x2f4fc3[_0xca2d('0x2c')],_0xab3933[_0xca2d('0x39')]));_0x266e99[_0xca2d('0x37')]['SessionId']=_0x529420['id'];if(_0x2f4fc3['query'][_0xca2d('0x3a')]){_0x266e99['where']=_[_0xca2d('0x3b')](_0x266e99[_0xca2d('0x37')],{'$or':_[_0xca2d('0x26')](_0x266e99[_0xca2d('0x2f')],function(_0x2f748a){var _0x4b33f0={};_0x4b33f0[_0x2f748a]={'$like':'%'+_0x2f4fc3[_0xca2d('0x2c')][_0xca2d('0x3a')]+'%'};return _0x4b33f0;})});}_0x266e99=_[_0xca2d('0x3b')]({},_0x266e99,_0x2f4fc3['options']);return db['JscriptyQuestionReport']['count']({'where':_0x266e99[_0xca2d('0x37')]})['then'](function(_0x4ffb1d){_0x2f437c[_0xca2d('0x1b')]=_0x4ffb1d;if(_0x2f4fc3['query'][_0xca2d('0x3e')]){_0x266e99[_0xca2d('0x3f')]=[{'all':!![]}];}return db[_0xca2d('0x49')][_0xca2d('0x4a')](_0x266e99);})[_0xca2d('0x21')](function(_0x5d97ee){_0x2f437c[_0xca2d('0x4b')]=_0x5d97ee;return _0x2f437c;});}})[_0xca2d('0x21')](respondWithFilteredResult(_0x34f843,_0x266e99))['catch'](handleError(_0x34f843,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 924443f..f0f920f 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 _0x454a=['report_jscripty_sessions','lodash','../../config/logger','api','moment','request-promise','rimraf','./jscriptySessionReport.attributes','JscriptySessionReport'];(function(_0x1c7386,_0x298a93){var _0x2b6b71=function(_0x3dfaf0){while(--_0x3dfaf0){_0x1c7386['push'](_0x1c7386['shift']());}};_0x2b6b71(++_0x298a93);}(_0x454a,0x18d));var _0xa454=function(_0x24a08a,_0x58f468){_0x24a08a=_0x24a08a-0x0;var _0x670e39=_0x454a[_0x24a08a];return _0x670e39;};'use strict';var _=require(_0xa454('0x0'));var util=require('util');var logger=require(_0xa454('0x1'))(_0xa454('0x2'));var moment=require(_0xa454('0x3'));var BPromise=require('bluebird');var rp=require(_0xa454('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa454('0x5'));var config=require('../../config/environment');var attributes=require(_0xa454('0x6'));module['exports']=function(_0xd0c2ec,_0x4bc16f){return _0xd0c2ec['define'](_0xa454('0x7'),attributes,{'tableName':_0xa454('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a49=['moment','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5a49,0x1e7));var _0x95a4=function(_0x16910b,_0xca7898){_0x16910b=_0x16910b-0x0;var _0x2ac267=_0x5a49[_0x16910b];return _0x2ac267;};'use strict';var _=require(_0x95a4('0x0'));var util=require(_0x95a4('0x1'));var logger=require(_0x95a4('0x2'))('api');var moment=require(_0x95a4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x95a4('0x4'));var rimraf=require(_0x95a4('0x5'));var config=require(_0x95a4('0x6'));var attributes=require(_0x95a4('0x7'));module['exports']=function(_0x5b1468,_0x370542){return _0x5b1468[_0x95a4('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x95a4('0x9'),'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 7953fb4..7b660e2 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 _0x37cf=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x37cf,0x133));var _0xf37c=function(_0x332e51,_0x4e3b00){_0x332e51=_0x332e51-0x0;var _0x2461dd=_0x37cf[_0x332e51];return _0x2461dd;};'use strict';var _=require('lodash');var util=require(_0xf37c('0x0'));var moment=require('moment');var BPromise=require(_0xf37c('0x1'));var rs=require(_0xf37c('0x2'));var fs=require('fs');var Redis=require(_0xf37c('0x3'));var db=require(_0xf37c('0x4'))['db'];var utils=require(_0xf37c('0x5'));var logger=require(_0xf37c('0x6'))(_0xf37c('0x7'));var config=require('../../config/environment');var jayson=require(_0xf37c('0x8'));var client=jayson['client'][_0xf37c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xedc009,_0x71ec3c,_0x2655eb){return new BPromise(function(_0x3c460d,_0x42d6cc){return client[_0xf37c('0xa')](_0xedc009,_0x2655eb)['then'](function(_0x3e4758){logger[_0xf37c('0xb')](_0xf37c('0xc'),_0x71ec3c,_0xf37c('0xd'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x71ec3c,_0xf37c('0xd'),JSON['stringify'](_0x3e4758));if(_0x3e4758[_0xf37c('0xe')]){if(_0x3e4758[_0xf37c('0xe')][_0xf37c('0xf')]===0x1f4){logger['error'](_0xf37c('0xc'),_0x71ec3c,_0x3e4758[_0xf37c('0xe')][_0xf37c('0x10')]);return _0x42d6cc(_0x3e4758[_0xf37c('0xe')][_0xf37c('0x10')]);}logger['error'](_0xf37c('0xc'),_0x71ec3c,_0x3e4758['error'][_0xf37c('0x10')]);return _0x3c460d(_0x3e4758[_0xf37c('0xe')][_0xf37c('0x10')]);}else{logger[_0xf37c('0xb')](_0xf37c('0xc'),_0x71ec3c,_0xf37c('0xd'));_0x3c460d(_0x3e4758[_0xf37c('0x11')][_0xf37c('0x10')]);}})[_0xf37c('0x12')](function(_0x4decb6){logger[_0xf37c('0xe')](_0xf37c('0xc'),_0x71ec3c,_0x4decb6);_0x42d6cc(_0x4decb6);});});} \ No newline at end of file +var _0xfc07=['debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4555bb,_0x1abb92){var _0x2a5293=function(_0x13b8ac){while(--_0x13b8ac){_0x4555bb['push'](_0x4555bb['shift']());}};_0x2a5293(++_0x1abb92);}(_0xfc07,0x183));var _0x7fc0=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xfc07[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0x7fc0('0x0'));var util=require(_0x7fc0('0x1'));var moment=require(_0x7fc0('0x2'));var BPromise=require(_0x7fc0('0x3'));var rs=require(_0x7fc0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7fc0('0x5'))(_0x7fc0('0x6'));var config=require(_0x7fc0('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea8f3,_0x387e89,_0xf95602){return new BPromise(function(_0x388659,_0xb0ed03){return client[_0x7fc0('0x8')](_0x5ea8f3,_0xf95602)[_0x7fc0('0x9')](function(_0x38f504){logger[_0x7fc0('0xa')](_0x7fc0('0xb'),_0x387e89,_0x7fc0('0xc'));logger[_0x7fc0('0xd')](_0x7fc0('0xe'),_0x387e89,_0x7fc0('0xc'),JSON[_0x7fc0('0xf')](_0x38f504));if(_0x38f504[_0x7fc0('0x10')]){if(_0x38f504[_0x7fc0('0x10')][_0x7fc0('0x11')]===0x1f4){logger[_0x7fc0('0x10')](_0x7fc0('0xb'),_0x387e89,_0x38f504['error']['message']);return _0xb0ed03(_0x38f504[_0x7fc0('0x10')][_0x7fc0('0x12')]);}logger[_0x7fc0('0x10')](_0x7fc0('0xb'),_0x387e89,_0x38f504[_0x7fc0('0x10')][_0x7fc0('0x12')]);return _0x388659(_0x38f504['error']['message']);}else{logger['info'](_0x7fc0('0xb'),_0x387e89,_0x7fc0('0xc'));_0x388659(_0x38f504[_0x7fc0('0x13')]['message']);}})['catch'](function(_0x50f4d1){logger[_0x7fc0('0x10')](_0x7fc0('0xb'),_0x387e89,_0x50f4d1);_0xb0ed03(_0x50f4d1);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7214f19..b8b179a 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 _0xadb1=['index','/:id','isAuthenticated','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0xadb1,0x179));var _0x1adb=function(_0x140bb4,_0x174850){_0x140bb4=_0x140bb4-0x0;var _0x284efe=_0xadb1[_0x140bb4];return _0x284efe;};'use strict';var multer=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var path=require(_0x1adb('0x2'));var timeout=require(_0x1adb('0x3'));var express=require(_0x1adb('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1adb('0x5'));var config=require(_0x1adb('0x6'));var controller=require(_0x1adb('0x7'));router['get']('/',controller[_0x1adb('0x8')]);router['put'](_0x1adb('0x9'),auth[_0x1adb('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xb59d=['Router','../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated','exports','util','path','connect-timeout','express'];(function(_0x1ef309,_0x5315b0){var _0x463ccc=function(_0x9676f4){while(--_0x9676f4){_0x1ef309['push'](_0x1ef309['shift']());}};_0x463ccc(++_0x5315b0);}(_0xb59d,0x17c));var _0xdb59=function(_0x3760c9,_0x4e8b67){_0x3760c9=_0x3760c9-0x0;var _0x57a111=_0xb59d[_0x3760c9];return _0x57a111;};'use strict';var multer=require('multer');var util=require(_0xdb59('0x0'));var path=require(_0xdb59('0x1'));var timeout=require(_0xdb59('0x2'));var express=require(_0xdb59('0x3'));var router=express[_0xdb59('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdb59('0x5'));var config=require(_0xdb59('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0xdb59('0x7')]);router[_0xdb59('0x8')](_0xdb59('0x9'),auth[_0xdb59('0xa')](),controller['update']);module[_0xdb59('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d0816b7..b8acf6d 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 _0x0295=['sequelize','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0295,0x1f0));var _0x5029=function(_0x499a43,_0x3cbee7){_0x499a43=_0x499a43-0x0;var _0x4e607e=_0x0295[_0x499a43];return _0x4e607e;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x5029('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ef3=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x745a81,_0xbe9c08){var _0x306efd=function(_0x35ec0a){while(--_0x35ec0a){_0x745a81['push'](_0x745a81['shift']());}};_0x306efd(++_0xbe9c08);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a1c49,_0x4884f0){_0x4a1c49=_0x4a1c49-0x0;var _0x37a252=_0x2ef3[_0x4a1c49];return _0x37a252;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'license':{'type':Sequelize[_0x32ef('0x2')]},'data1':{'type':Sequelize[_0x32ef('0x3')]},'data2':{'type':Sequelize[_0x32ef('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x32ef('0x4')],'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 cbb676b..f063950 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 _0xcb41=['query','attributes','intersection','model','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','key','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','keys','License','rawAttributes'];(function(_0x16760c,_0x2d0884){var _0x51c968=function(_0x567583){while(--_0x567583){_0x16760c['push'](_0x16760c['shift']());}};_0x51c968(++_0x2d0884);}(_0xcb41,0x1df));var _0x1cb4=function(_0x11a5ac,_0x4d1c0c){_0x11a5ac=_0x11a5ac-0x0;var _0x45d4a4=_0xcb41[_0x11a5ac];return _0x45d4a4;};'use strict';var pdf=require(_0x1cb4('0x0'));var emlformat=require(_0x1cb4('0x1'));var rimraf=require(_0x1cb4('0x2'));var zipdir=require(_0x1cb4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cb4('0x4'));var moment=require('moment');var BPromise=require(_0x1cb4('0x5'));var Mustache=require(_0x1cb4('0x6'));var util=require(_0x1cb4('0x7'));var path=require(_0x1cb4('0x8'));var sox=require(_0x1cb4('0x9'));var csv=require(_0x1cb4('0xa'));var ejs=require(_0x1cb4('0xb'));var fs=require('fs');var _=require(_0x1cb4('0xc'));var squel=require('squel');var crypto=require(_0x1cb4('0xd'));var jsforce=require(_0x1cb4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1cb4('0xa'));var querystring=require(_0x1cb4('0xf'));var Papa=require(_0x1cb4('0x10'));var Redis=require('ioredis');var authService=require(_0x1cb4('0x11'));var qs=require(_0x1cb4('0x12'));var as=require(_0x1cb4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cb4('0x14'));var utils=require('../../config/utils');var config=require(_0x1cb4('0x15'));var licenseUtil=require(_0x1cb4('0x16'));var db=require(_0x1cb4('0x17'))['db'];function respondWithStatusCode(_0xd57cb1,_0x2409a2){_0x2409a2=_0x2409a2||0xcc;return function(_0x4eafc0){if(_0x4eafc0){return _0xd57cb1[_0x1cb4('0x18')](_0x2409a2);}return _0xd57cb1['status'](_0x2409a2)[_0x1cb4('0x19')]();};}function respondWithResult(_0x3d2f2e,_0x29a3bf){_0x29a3bf=_0x29a3bf||0xc8;return function(_0xb01aec){if(_0xb01aec){return _0x3d2f2e[_0x1cb4('0x1a')](_0x29a3bf)[_0x1cb4('0x1b')](_0xb01aec);}};}function respondWithFilteredResult(_0x34e04e,_0x35783e){return function(_0xc444d){if(_0xc444d){var _0x1858f1=_0xc444d[_0x1cb4('0x1c')],_0x521b49=_0x35783e[_0x1cb4('0x1d')],_0xbc72fd=_0x35783e['offset']+_0x35783e['limit'],_0x514285;if(_0xbc72fd>=_0x1858f1){_0xbc72fd=_0x1858f1;_0x514285=0xc8;}else{_0x514285=0xce;}_0x34e04e[_0x1cb4('0x1a')](_0x514285);return _0x34e04e[_0x1cb4('0x1e')](_0x1cb4('0x1f'),_0x521b49+'-'+_0xbc72fd+'/'+_0x1858f1)[_0x1cb4('0x1b')](_0xc444d);}return null;};}function patchUpdates(_0x274f12){return function(_0x43e481){try{jsonpatch[_0x1cb4('0x20')](_0x43e481,_0x274f12,!![]);}catch(_0xdbb325){return BPromise['reject'](_0xdbb325);}return _0x43e481[_0x1cb4('0x21')]();};}function saveUpdates(_0x1d1a19,_0x5a24ec){return function(_0x33993b){if(_0x33993b){return _0x33993b[_0x1cb4('0x22')](_0x1d1a19)[_0x1cb4('0x23')](function(_0x19d342){return _0x19d342;});}return null;};}function removeEntity(_0x4e5f9b,_0x316325){return function(_0x51fc8d){if(_0x51fc8d){return _0x51fc8d['destroy']()[_0x1cb4('0x23')](function(){_0x4e5f9b[_0x1cb4('0x1a')](0xcc)[_0x1cb4('0x19')]();});}};}function handleEntityNotFound(_0x4d93b9,_0x3533e8){return function(_0x33ec9c){if(!_0x33ec9c){_0x4d93b9[_0x1cb4('0x18')](0x194);}return _0x33ec9c;};}function handleError(_0x5bce36,_0x70d3dc){_0x70d3dc=_0x70d3dc||0x1f4;return function(_0x1e8d9c){logger[_0x1cb4('0x24')](_0x1e8d9c[_0x1cb4('0x25')]);if(_0x1e8d9c['name']){delete _0x1e8d9c[_0x1cb4('0x26')];}_0x5bce36['status'](_0x70d3dc)['send'](_0x1e8d9c);};}var utilLicense=require('../../config/license/util');exports[_0x1cb4('0x27')]=function(_0x54b46f,_0x28ac89){var _0x17f4e1={'raw':!![],'where':{'id':0x1}},_0x569fff={};_0x569fff['model']=_[_0x1cb4('0x28')](db[_0x1cb4('0x29')][_0x1cb4('0x2a')]);_0x569fff[_0x1cb4('0x2b')]=_[_0x1cb4('0x28')](_0x54b46f[_0x1cb4('0x2b')]);_0x569fff['filters']=_['intersection'](_0x569fff['model'],_0x569fff[_0x1cb4('0x2b')]);_0x17f4e1[_0x1cb4('0x2c')]=_[_0x1cb4('0x2d')](_0x569fff[_0x1cb4('0x2e')],qs[_0x1cb4('0x2f')](_0x54b46f[_0x1cb4('0x2b')][_0x1cb4('0x2f')]));_0x17f4e1[_0x1cb4('0x2c')]=_0x17f4e1[_0x1cb4('0x2c')][_0x1cb4('0x30')]?_0x17f4e1[_0x1cb4('0x2c')]:_0x569fff[_0x1cb4('0x2e')];_0x17f4e1=_[_0x1cb4('0x31')]({},_0x17f4e1,_0x54b46f[_0x1cb4('0x32')]);return utilLicense[_0x1cb4('0x33')](_0x17f4e1)[_0x1cb4('0x23')](respondWithResult(_0x28ac89,null))[_0x1cb4('0x34')](handleError(_0x28ac89,null));};exports[_0x1cb4('0x22')]=function(_0x527875,_0x2722a2){if(_0x527875[_0x1cb4('0x35')]['id']){delete _0x527875[_0x1cb4('0x35')]['id'];}return db[_0x1cb4('0x29')][_0x1cb4('0x36')]({'where':{'id':_0x527875['params']['id']}})[_0x1cb4('0x23')](handleEntityNotFound(_0x2722a2,null))[_0x1cb4('0x23')](function(_0x5aa5e4){var _0x375a26=_0x5aa5e4[_0x1cb4('0x37')]({'plain':!![]});return utilLicense[_0x1cb4('0x38')](_0x375a26,_0x527875[_0x1cb4('0x35')][_0x1cb4('0x39')]);})[_0x1cb4('0x23')](function(_0x525af6){if(!_0x525af6['demo']){return saveUpdates(_0x527875[_0x1cb4('0x35')],null);}return _0x525af6;})['then'](respondWithResult(_0x2722a2,null))['catch'](handleError(_0x2722a2,null));}; \ No newline at end of file +var _0x05bc=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','options','getLicense','body','find','params','get','checkLicense','demo','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc05b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc05b('0x1'));var jsonpatch=require(_0xc05b('0x2'));var rp=require('request-promise');var moment=require(_0xc05b('0x3'));var BPromise=require(_0xc05b('0x4'));var Mustache=require(_0xc05b('0x5'));var util=require(_0xc05b('0x6'));var path=require(_0xc05b('0x7'));var sox=require(_0xc05b('0x8'));var csv=require(_0xc05b('0x9'));var ejs=require(_0xc05b('0xa'));var fs=require('fs');var _=require(_0xc05b('0xb'));var squel=require(_0xc05b('0xc'));var crypto=require(_0xc05b('0xd'));var jsforce=require(_0xc05b('0xe'));var deskjs=require(_0xc05b('0xf'));var toCsv=require(_0xc05b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc05b('0x10'));var authService=require(_0xc05b('0x11'));var qs=require(_0xc05b('0x12'));var as=require(_0xc05b('0x13'));var hardwareService=require(_0xc05b('0x14'));var logger=require(_0xc05b('0x15'))(_0xc05b('0x16'));var utils=require(_0xc05b('0x17'));var config=require(_0xc05b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc05b('0x19'))['db'];function respondWithStatusCode(_0x409384,_0x12c7ec){_0x12c7ec=_0x12c7ec||0xcc;return function(_0x160659){if(_0x160659){return _0x409384[_0xc05b('0x1a')](_0x12c7ec);}return _0x409384[_0xc05b('0x1b')](_0x12c7ec)['end']();};}function respondWithResult(_0xc3030a,_0x6b1880){_0x6b1880=_0x6b1880||0xc8;return function(_0x55ec04){if(_0x55ec04){return _0xc3030a['status'](_0x6b1880)[_0xc05b('0x1c')](_0x55ec04);}};}function respondWithFilteredResult(_0x142fd8,_0x5ce354){return function(_0xcceda9){if(_0xcceda9){var _0x387036=_0xcceda9[_0xc05b('0x1d')],_0x21435e=_0x5ce354[_0xc05b('0x1e')],_0xe94a8f=_0x5ce354[_0xc05b('0x1e')]+_0x5ce354[_0xc05b('0x1f')],_0x5a33c1;if(_0xe94a8f>=_0x387036){_0xe94a8f=_0x387036;_0x5a33c1=0xc8;}else{_0x5a33c1=0xce;}_0x142fd8[_0xc05b('0x1b')](_0x5a33c1);return _0x142fd8[_0xc05b('0x20')]('Content-Range',_0x21435e+'-'+_0xe94a8f+'/'+_0x387036)[_0xc05b('0x1c')](_0xcceda9);}return null;};}function patchUpdates(_0x49d1f8){return function(_0x3cc005){try{jsonpatch[_0xc05b('0x21')](_0x3cc005,_0x49d1f8,!![]);}catch(_0x45d561){return BPromise[_0xc05b('0x22')](_0x45d561);}return _0x3cc005[_0xc05b('0x23')]();};}function saveUpdates(_0x48c36e,_0x10eb99){return function(_0x40de30){if(_0x40de30){return _0x40de30[_0xc05b('0x24')](_0x48c36e)[_0xc05b('0x25')](function(_0x58374e){return _0x58374e;});}return null;};}function removeEntity(_0x1766bd,_0x456930){return function(_0x2692c2){if(_0x2692c2){return _0x2692c2[_0xc05b('0x26')]()[_0xc05b('0x25')](function(){_0x1766bd[_0xc05b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x585447,_0x2699fb){return function(_0x382743){if(!_0x382743){_0x585447['sendStatus'](0x194);}return _0x382743;};}function handleError(_0x949652,_0x5b9e1f){_0x5b9e1f=_0x5b9e1f||0x1f4;return function(_0x54b3a9){logger[_0xc05b('0x27')](_0x54b3a9['stack']);if(_0x54b3a9['name']){delete _0x54b3a9['name'];}_0x949652[_0xc05b('0x1b')](_0x5b9e1f)['send'](_0x54b3a9);};}var utilLicense=require(_0xc05b('0x28'));exports[_0xc05b('0x29')]=function(_0x4d1fd4,_0x337cc1){var _0x395baa={'raw':!![],'where':{'id':0x1}},_0x444a55={};_0x444a55[_0xc05b('0x2a')]=_[_0xc05b('0x2b')](db[_0xc05b('0x2c')][_0xc05b('0x2d')]);_0x444a55[_0xc05b('0x2e')]=_[_0xc05b('0x2b')](_0x4d1fd4[_0xc05b('0x2e')]);_0x444a55[_0xc05b('0x2f')]=_[_0xc05b('0x30')](_0x444a55['model'],_0x444a55[_0xc05b('0x2e')]);_0x395baa['attributes']=_[_0xc05b('0x30')](_0x444a55['model'],qs['fields'](_0x4d1fd4[_0xc05b('0x2e')][_0xc05b('0x31')]));_0x395baa[_0xc05b('0x32')]=_0x395baa['attributes'][_0xc05b('0x33')]?_0x395baa['attributes']:_0x444a55['model'];_0x395baa=_['merge']({},_0x395baa,_0x4d1fd4[_0xc05b('0x34')]);return utilLicense[_0xc05b('0x35')](_0x395baa)[_0xc05b('0x25')](respondWithResult(_0x337cc1,null))['catch'](handleError(_0x337cc1,null));};exports[_0xc05b('0x24')]=function(_0x1601e3,_0x3ca671){if(_0x1601e3[_0xc05b('0x36')]['id']){delete _0x1601e3['body']['id'];}return db[_0xc05b('0x2c')][_0xc05b('0x37')]({'where':{'id':_0x1601e3[_0xc05b('0x38')]['id']}})['then'](handleEntityNotFound(_0x3ca671,null))[_0xc05b('0x25')](function(_0x1b2e4d){var _0x5b57d7=_0x1b2e4d[_0xc05b('0x39')]({'plain':!![]});return utilLicense[_0xc05b('0x3a')](_0x5b57d7,_0x1601e3['body']['key']);})[_0xc05b('0x25')](function(_0x3bd87c){if(!_0x3bd87c[_0xc05b('0x3b')]){return saveUpdates(_0x1601e3[_0xc05b('0x36')],null);}return _0x3bd87c;})['then'](respondWithResult(_0x3ca671,null))[_0xc05b('0x3c')](handleError(_0x3ca671,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index edaae06..16dda3c 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 _0xa647=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','license','lodash'];(function(_0x165fa0,_0x3a25a9){var _0x5d58bb=function(_0x2dfaee){while(--_0x2dfaee){_0x165fa0['push'](_0x165fa0['shift']());}};_0x5d58bb(++_0x3a25a9);}(_0xa647,0xd1));var _0x7a64=function(_0x57c164,_0x572ae1){_0x57c164=_0x57c164-0x0;var _0x33b229=_0xa647[_0x57c164];return _0x33b229;};'use strict';var _=require(_0x7a64('0x0'));var util=require('util');var logger=require(_0x7a64('0x1'))(_0x7a64('0x2'));var moment=require('moment');var BPromise=require(_0x7a64('0x3'));var rp=require(_0x7a64('0x4'));var fs=require('fs');var path=require(_0x7a64('0x5'));var rimraf=require(_0x7a64('0x6'));var config=require(_0x7a64('0x7'));var attributes=require('./license.attributes');module[_0x7a64('0x8')]=function(_0xb0819e,_0x4cd60d){return _0xb0819e['define']('License',attributes,{'tableName':_0x7a64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb761=['bluebird','request-promise','define','License','license','lodash','util','../../config/logger','api','moment'];(function(_0x2d1ed5,_0x3c8100){var _0x4fd05c=function(_0x3f031e){while(--_0x3f031e){_0x2d1ed5['push'](_0x2d1ed5['shift']());}};_0x4fd05c(++_0x3c8100);}(_0xb761,0x113));var _0x1b76=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0xb761[_0x369a98];return _0x29565c;};'use strict';var _=require(_0x1b76('0x0'));var util=require(_0x1b76('0x1'));var logger=require(_0x1b76('0x2'))(_0x1b76('0x3'));var moment=require(_0x1b76('0x4'));var BPromise=require(_0x1b76('0x5'));var rp=require(_0x1b76('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x284ec8,_0x1acca9){return _0x284ec8[_0x1b76('0x7')](_0x1b76('0x8'),attributes,{'tableName':_0x1b76('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index caf598b..7a43c5d 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 _0xd403=['info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0xd403,0x1d5));var _0x3d40=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xd403[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x3d40('0x0'));var util=require(_0x3d40('0x1'));var moment=require(_0x3d40('0x2'));var BPromise=require(_0x3d40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d40('0x5'));var logger=require(_0x3d40('0x6'))(_0x3d40('0x7'));var config=require(_0x3d40('0x8'));var jayson=require(_0x3d40('0x9'));var client=jayson[_0x3d40('0xa')][_0x3d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd5569,_0x14dc5b,_0x1f488d){return new BPromise(function(_0x210104,_0x266868){return client[_0x3d40('0xc')](_0xfd5569,_0x1f488d)[_0x3d40('0xd')](function(_0xd96d5e){logger[_0x3d40('0xe')]('License,\x20%s,\x20%s',_0x14dc5b,_0x3d40('0xf'));logger['debug'](_0x3d40('0x10'),_0x14dc5b,_0x3d40('0xf'),JSON[_0x3d40('0x11')](_0xd96d5e));if(_0xd96d5e['error']){if(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x13')]===0x1f4){logger[_0x3d40('0x12')]('License,\x20%s,\x20%s',_0x14dc5b,_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);return _0x266868(_0xd96d5e['error']['message']);}logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0xd96d5e[_0x3d40('0x12')]['message']);return _0x210104(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);}else{logger[_0x3d40('0xe')](_0x3d40('0x15'),_0x14dc5b,_0x3d40('0xf'));_0x210104(_0xd96d5e[_0x3d40('0x16')][_0x3d40('0x14')]);}})['catch'](function(_0x496dfd){logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0x496dfd);_0x266868(_0x496dfd);});});} \ No newline at end of file +var _0xa74f=['result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xa74f,0x9a));var _0xfa74=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa74f[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 05010b1..0cc9f96 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 _0xf31b=['/:id/messages','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','/:id/applications','addApplications','send','update','delete','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','index','/describe','isAuthenticated','/:id','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','getApplications'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0xf31b,0x1a0));var _0xbf31=function(_0x4f97cd,_0x3dad71){_0x4f97cd=_0x4f97cd-0x0;var _0x152478=_0xf31b[_0x4f97cd];return _0x152478;};'use strict';var multer=require(_0xbf31('0x0'));var util=require(_0xbf31('0x1'));var path=require(_0xbf31('0x2'));var timeout=require(_0xbf31('0x3'));var express=require(_0xbf31('0x4'));var router=express[_0xbf31('0x5')]();var auth=require(_0xbf31('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbf31('0x7'));var controller=require(_0xbf31('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbf31('0x9')]);router['get'](_0xbf31('0xa'),auth[_0xbf31('0xb')](),controller['describe']);router['get'](_0xbf31('0xc'),auth['isAuthenticated'](),controller[_0xbf31('0xd')]);router[_0xbf31('0xe')](_0xbf31('0xf'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x10')]);router[_0xbf31('0xe')](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x12')]);router[_0xbf31('0xe')](_0xbf31('0x13'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x14')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0xbf31('0xe')](_0xbf31('0x15'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x16')]);router['get']('/:id/applications',auth[_0xbf31('0xb')](),controller[_0xbf31('0x17')]);router[_0xbf31('0xe')](_0xbf31('0x18'),auth[_0xbf31('0xb')](),controller['getMessages']);router[_0xbf31('0xe')]('/:id/verify',auth['isAuthenticated'](),controller[_0xbf31('0x19')]);router[_0xbf31('0xe')](_0xbf31('0x1a'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x1b')]);router['post']('/:id/dispositions',auth[_0xbf31('0xb')](),controller[_0xbf31('0x1c')]);router[_0xbf31('0x1d')]('/:id/canned_answers',auth[_0xbf31('0xb')](),controller[_0xbf31('0x1e')]);router[_0xbf31('0x1d')]('/',auth[_0xbf31('0xb')](),controller[_0xbf31('0x1f')]);router['post'](_0xbf31('0x13'),auth['isAuthenticated'](),controller['addImap']);router[_0xbf31('0x1d')](_0xbf31('0x20'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x21')]);router[_0xbf31('0x1d')](_0xbf31('0x15'),auth['isAuthenticated'](),controller[_0xbf31('0x22')]);router[_0xbf31('0x1d')](_0xbf31('0x23'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x24')]);router[_0xbf31('0x1d')]('/:id/send',auth[_0xbf31('0xb')](),controller[_0xbf31('0x25')]);router[_0xbf31('0x1d')](_0xbf31('0x1a'),auth[_0xbf31('0xb')](),controller['addAgents']);router['put'](_0xbf31('0xc'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x26')]);router[_0xbf31('0x27')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller['removeAnswers']);router[_0xbf31('0x27')](_0xbf31('0x13'),auth[_0xbf31('0xb')](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0xbf31('0xb')](),controller[_0xbf31('0x28')]);router[_0xbf31('0x27')](_0xbf31('0xc'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x29')]);router['delete'](_0xbf31('0x1a'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x2a')]);module[_0xbf31('0x2b')]=router; \ No newline at end of file +var _0xd916=['getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','/:id/dispositions','post','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','/:id/users','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions'];(function(_0x156811,_0x425950){var _0x3c53fc=function(_0x58f2ea){while(--_0x58f2ea){_0x156811['push'](_0x156811['shift']());}};_0x3c53fc(++_0x425950);}(_0xd916,0x18a));var _0x6d91=function(_0x16cadd,_0x468c99){_0x16cadd=_0x16cadd-0x0;var _0x2477ab=_0xd916[_0x16cadd];return _0x2477ab;};'use strict';var multer=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var path=require(_0x6d91('0x2'));var timeout=require(_0x6d91('0x3'));var express=require(_0x6d91('0x4'));var router=express['Router']();var auth=require(_0x6d91('0x5'));var interaction=require(_0x6d91('0x6'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x6d91('0x7')]('/',auth[_0x6d91('0x8')](),controller['index']);router[_0x6d91('0x7')](_0x6d91('0x9'),auth[_0x6d91('0x8')](),controller[_0x6d91('0xa')]);router[_0x6d91('0x7')](_0x6d91('0xb'),auth[_0x6d91('0x8')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x6d91('0xc')]);router[_0x6d91('0x7')](_0x6d91('0xd'),auth[_0x6d91('0x8')](),controller[_0x6d91('0xe')]);router['get'](_0x6d91('0xf'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x10')]);router[_0x6d91('0x7')](_0x6d91('0x11'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x12')]);router[_0x6d91('0x7')](_0x6d91('0x13'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x14')]);router[_0x6d91('0x7')](_0x6d91('0x15'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x16')]);router['get'](_0x6d91('0x17'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x18')]);router[_0x6d91('0x7')](_0x6d91('0x19'),auth[_0x6d91('0x8')](),controller['verifySmtp']);router[_0x6d91('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x6d91('0x1a')]);router['post'](_0x6d91('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x6d91('0x1c')](_0x6d91('0xd'),auth[_0x6d91('0x8')](),controller['addAnswer']);router[_0x6d91('0x1c')]('/',auth[_0x6d91('0x8')](),controller[_0x6d91('0x1d')]);router[_0x6d91('0x1c')](_0x6d91('0xf'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x1e')]);router[_0x6d91('0x1c')](_0x6d91('0x11'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x1f')]);router[_0x6d91('0x1c')]('/:id/interactions',auth[_0x6d91('0x8')](),controller[_0x6d91('0x20')]);router[_0x6d91('0x1c')]('/:id/applications',auth[_0x6d91('0x8')](),controller[_0x6d91('0x21')]);router['post'](_0x6d91('0x22'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x23')]);router[_0x6d91('0x1c')]('/:id/users',auth[_0x6d91('0x8')](),controller[_0x6d91('0x24')]);router[_0x6d91('0x25')]('/:id',auth[_0x6d91('0x8')](),controller[_0x6d91('0x26')]);router[_0x6d91('0x27')](_0x6d91('0x1b'),auth['isAuthenticated'](),controller[_0x6d91('0x28')]);router[_0x6d91('0x27')](_0x6d91('0xd'),auth['isAuthenticated'](),controller[_0x6d91('0x29')]);router[_0x6d91('0x27')]('/:id/in_servers',auth[_0x6d91('0x8')](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0x6d91('0x8')](),controller[_0x6d91('0x2a')]);router[_0x6d91('0x27')](_0x6d91('0xb'),auth[_0x6d91('0x8')](),controller[_0x6d91('0x2b')]);router[_0x6d91('0x27')](_0x6d91('0x2c'),auth[_0x6d91('0x8')](),controller['removeAgents']);module[_0x6d91('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 0bdb994..94e87ee 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 _0x19f2=['mandatoryDisposition','sequelize','exports','STRING','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'];(function(_0x4ee5d3,_0x432589){var _0x3a0562=function(_0x442e4a){while(--_0x442e4a){_0x4ee5d3['push'](_0x4ee5d3['shift']());}};_0x3a0562(++_0x432589);}(_0x19f2,0x7f));var _0x219f=function(_0x65a0db,_0x55c5a0){_0x65a0db=_0x65a0db-0x0;var _0x987620=_0x19f2[_0x65a0db];return _0x987620;};'use strict';var Sequelize=require(_0x219f('0x0'));module[_0x219f('0x1')]={'description':{'type':Sequelize[_0x219f('0x2')]},'name':{'type':Sequelize[_0x219f('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x219f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x219f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x219f('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x219f('0x4')]},'markAsUnread':{'type':Sequelize[_0x219f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x219f('0x5')},'fontSize':{'type':Sequelize[_0x219f('0x6')](0x2)[_0x219f('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x219f('0x4')],'defaultValue':function(){return _0x219f('0x8');}},'notificationSound':{'type':Sequelize[_0x219f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x219f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x219f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x219f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x219f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x219f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x219f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x219f('0x3')],'defaultValue':![],'comment':_0x219f('0xa'),'set':function(_0x557ec9){if(!_0x557ec9)this[_0x219f('0xb')](_0x219f('0xc'),null);this['setDataValue'](_0x219f('0xd'),_0x557ec9);}}}; \ No newline at end of file +var _0x79bd=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','setDataValue','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79bd,0x85));var _0xd79b=function(_0x4d6e35,_0x4e0da0){_0x4d6e35=_0x4d6e35-0x0;var _0x392f6b=_0x79bd[_0x4d6e35];return _0x392f6b;};'use strict';var Sequelize=require(_0xd79b('0x0'));module[_0xd79b('0x1')]={'description':{'type':Sequelize[_0xd79b('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd79b('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd79b('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd79b('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xd79b('0x4')]},'markAsUnread':{'type':Sequelize[_0xd79b('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd79b('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd79b('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd79b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd79b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd79b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd79b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd79b('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd79b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd79b('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd79b('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x481ace){if(!_0x481ace)this[_0xd79b('0x7')]('mandatoryDispositionPauseId',null);this[_0xd79b('0x7')]('mandatoryDisposition',_0x481ace);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d36cb6a..ec1bffb 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 _0x9559=['messageId','attach','out','Interaction','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','userMailAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','html-to-text','juice','../../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','./mailAccount.socket','jayson/promise','client','http','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','sendStatus','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','options','count','includeAll','include','rows','params','merge','MailAccount','body','find','describe','addDisposition','Disposition','create','getDispositions','findOne','hasOwnProperty','pick','MailAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','updatedAt','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','Contacts','defaults'];(function(_0x1f98eb,_0x1f3a0f){var _0x56c302=function(_0xe9cc5){while(--_0xe9cc5){_0x1f98eb['push'](_0x1f98eb['shift']());}};_0x56c302(++_0x1f3a0f);}(_0x9559,0x190));var _0x9955=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0x9559[_0xae1a83];return _0xdb9da8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9955('0x0'));var rimraf=require(_0x9955('0x1'));var zipdir=require(_0x9955('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9955('0x3'));var moment=require(_0x9955('0x4'));var BPromise=require(_0x9955('0x5'));var Mustache=require('mustache');var util=require(_0x9955('0x6'));var path=require(_0x9955('0x7'));var sox=require('sox');var csv=require(_0x9955('0x8'));var ejs=require(_0x9955('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9955('0xa'));var crypto=require(_0x9955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9955('0xc'));var toCsv=require(_0x9955('0x8'));var querystring=require(_0x9955('0xd'));var Papa=require('papaparse');var htmlToText=require(_0x9955('0xe'));var juice=require(_0x9955('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9955('0x10'));var as=require(_0x9955('0x11'));var hardwareService=require(_0x9955('0x12'));var logger=require(_0x9955('0x13'))(_0x9955('0x14'));var utils=require(_0x9955('0x15'));var config=require(_0x9955('0x16'));var licenseUtil=require(_0x9955('0x17'));var db=require(_0x9955('0x18'))['db'];config[_0x9955('0x19')]=_['defaults'](config['redis'],{'host':_0x9955('0x1a'),'port':0x18eb});var socket=require(_0x9955('0x1b'))(new Redis(config['redis']));require(_0x9955('0x1c'))['register'](socket);var jayson=require(_0x9955('0x1d'));var client=jayson[_0x9955('0x1e')][_0x9955('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x2055f1,_0x2596ac,_0x24f51f,_0xac9250){return new BPromise(function(_0x3ce06f,_0x3d899b){var _0x55ab0f=_0xac9250||client;return _0x55ab0f['request'](_0x2055f1,_0x24f51f)[_0x9955('0x20')](function(_0x220104){logger['info']('MailAccount,\x20%s,\x20%s',_0x2596ac,_0x9955('0x21'));logger[_0x9955('0x22')](_0x9955('0x23'),_0x2596ac,'request\x20sent',JSON[_0x9955('0x24')](_0x220104));if(_0x220104[_0x9955('0x25')]){if(_0x220104[_0x9955('0x25')][_0x9955('0x26')]===0x1f4){logger[_0x9955('0x25')](_0x9955('0x27'),_0x2596ac,_0x220104['error'][_0x9955('0x28')]);return _0x3d899b(_0x220104[_0x9955('0x25')][_0x9955('0x28')]);}logger[_0x9955('0x25')](_0x9955('0x27'),_0x2596ac,_0x220104[_0x9955('0x25')][_0x9955('0x28')]);return _0x3ce06f(_0x220104[_0x9955('0x25')][_0x9955('0x28')]);}else{logger[_0x9955('0x29')](_0x9955('0x27'),_0x2596ac,_0x9955('0x21'));_0x3ce06f(_0x220104[_0x9955('0x2a')][_0x9955('0x28')]);}})[_0x9955('0x2b')](function(_0x44b78f){logger[_0x9955('0x25')](_0x9955('0x27'),_0x2596ac,_0x44b78f);_0x3d899b(_0x44b78f);});});}function respondWithStatusCode(_0x560f76,_0x4e8159){_0x4e8159=_0x4e8159||0xcc;return function(_0x5795ce){if(_0x5795ce){return _0x560f76['sendStatus'](_0x4e8159);}return _0x560f76[_0x9955('0x2c')](_0x4e8159)[_0x9955('0x2d')]();};}function respondWithResult(_0x54d572,_0xb0168d){_0xb0168d=_0xb0168d||0xc8;return function(_0x232472){if(_0x232472){return _0x54d572[_0x9955('0x2c')](_0xb0168d)[_0x9955('0x2e')](_0x232472);}};}function respondWithFilteredResult(_0x2fd210,_0x2f8d2e){return function(_0x21d062){if(_0x21d062){var _0x5b3be3=_0x21d062['count'],_0x3207f5=_0x2f8d2e[_0x9955('0x2f')],_0x291465=_0x2f8d2e['offset']+_0x2f8d2e[_0x9955('0x30')],_0x2d7828;if(_0x291465>=_0x5b3be3){_0x291465=_0x5b3be3;_0x2d7828=0xc8;}else{_0x2d7828=0xce;}_0x2fd210[_0x9955('0x2c')](_0x2d7828);return _0x2fd210[_0x9955('0x31')](_0x9955('0x32'),_0x3207f5+'-'+_0x291465+'/'+_0x5b3be3)[_0x9955('0x2e')](_0x21d062);}return null;};}function patchUpdates(_0x509596){return function(_0x11ecba){try{jsonpatch[_0x9955('0x33')](_0x11ecba,_0x509596,!![]);}catch(_0x171dbc){return BPromise[_0x9955('0x34')](_0x171dbc);}return _0x11ecba[_0x9955('0x35')]();};}function saveUpdates(_0xda1c4f,_0x67fbd1){return function(_0x5ae676){if(_0x5ae676){return _0x5ae676[_0x9955('0x36')](_0xda1c4f)[_0x9955('0x20')](function(_0x4e94b2){return _0x4e94b2;});}return null;};}function removeEntity(_0x2abbcb,_0x3b01cf){return function(_0x13dc35){if(_0x13dc35){return _0x13dc35[_0x9955('0x37')]()['then'](function(){var _0x280ad5=_0x13dc35[_0x9955('0x38')]({'plain':!![]});var _0x25dd2b=_0x9955('0x39');return db['UserProfileResource'][_0x9955('0x37')]({'where':{'type':_0x25dd2b,'resourceId':_0x280ad5['id']}})[_0x9955('0x20')](function(){return _0x13dc35;});})[_0x9955('0x20')](function(){_0x2abbcb[_0x9955('0x2c')](0xcc)[_0x9955('0x2d')]();});}};}function handleEntityNotFound(_0x2c6470,_0x3f72ae){return function(_0x2bf11a){if(!_0x2bf11a){_0x2c6470[_0x9955('0x3a')](0x194);}return _0x2bf11a;};}function handleError(_0x425072,_0x18700f){_0x18700f=_0x18700f||0x1f4;return function(_0x11d0de){logger['error'](_0x11d0de[_0x9955('0x3b')]);if(_0x11d0de[_0x9955('0x3c')]){delete _0x11d0de['name'];}_0x425072[_0x9955('0x2c')](_0x18700f)[_0x9955('0x3d')](_0x11d0de);};}exports[_0x9955('0x3e')]=function(_0x30d930,_0x169a3f){var _0x5939f4={'include':[{'model':db[_0x9955('0x3f')],'as':_0x9955('0x40')},{'model':db[_0x9955('0x41')],'as':_0x9955('0x42')},{'model':db[_0x9955('0x43')],'as':_0x9955('0x44')}]},_0x14f523={},_0x49d797={'count':0x0,'rows':[]};var _0x4f8897=_[_0x9955('0x45')](db['MailAccount'][_0x9955('0x46')],function(_0x34349f){return{'name':_0x34349f[_0x9955('0x47')],'type':_0x34349f[_0x9955('0x48')][_0x9955('0x49')]};});_0x14f523['model']=_[_0x9955('0x45')](_0x4f8897,'name');_0x14f523[_0x9955('0x4a')]=_[_0x9955('0x4b')](_0x30d930[_0x9955('0x4a')]);_0x14f523['filters']=_[_0x9955('0x4c')](_0x14f523[_0x9955('0x4d')],_0x14f523[_0x9955('0x4a')]);_0x5939f4[_0x9955('0x4e')]=_[_0x9955('0x4c')](_0x14f523[_0x9955('0x4d')],qs[_0x9955('0x4f')](_0x30d930[_0x9955('0x4a')][_0x9955('0x4f')]));_0x5939f4[_0x9955('0x4e')]=_0x5939f4[_0x9955('0x4e')][_0x9955('0x50')]?_0x5939f4[_0x9955('0x4e')]:_0x14f523[_0x9955('0x4d')];if(!_0x30d930['query']['hasOwnProperty'](_0x9955('0x51'))){_0x5939f4[_0x9955('0x30')]=qs[_0x9955('0x30')](_0x30d930[_0x9955('0x4a')][_0x9955('0x30')]);_0x5939f4[_0x9955('0x2f')]=qs[_0x9955('0x2f')](_0x30d930[_0x9955('0x4a')][_0x9955('0x2f')]);}_0x5939f4[_0x9955('0x52')]=qs[_0x9955('0x53')](_0x30d930[_0x9955('0x4a')][_0x9955('0x53')]);_0x5939f4[_0x9955('0x54')]=qs[_0x9955('0x55')](_['pick'](_0x30d930[_0x9955('0x4a')],_0x14f523[_0x9955('0x55')]),_0x4f8897);if(_0x30d930[_0x9955('0x4a')][_0x9955('0x56')]){_0x5939f4[_0x9955('0x54')]=_['merge'](_0x5939f4[_0x9955('0x54')],{'$or':_[_0x9955('0x45')](_0x4f8897,function(_0x574bd3){if(_0x574bd3[_0x9955('0x48')]!=='VIRTUAL'){var _0x205f04={};_0x205f04[_0x574bd3[_0x9955('0x3c')]]={'$like':'%'+_0x30d930[_0x9955('0x4a')][_0x9955('0x56')]+'%'};return _0x205f04;}})});}_0x5939f4=_['merge']({},_0x5939f4,_0x30d930[_0x9955('0x57')]);var _0x3ff6ae={'where':_0x5939f4['where']};return db['MailAccount'][_0x9955('0x58')](_0x3ff6ae)['then'](function(_0x5f0f69){_0x49d797['count']=_0x5f0f69;if(_0x30d930[_0x9955('0x4a')][_0x9955('0x59')]){_0x5939f4[_0x9955('0x5a')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x5939f4);})[_0x9955('0x20')](function(_0x41d4f2){_0x49d797[_0x9955('0x5b')]=_0x41d4f2;return _0x49d797;})[_0x9955('0x20')](respondWithFilteredResult(_0x169a3f,_0x5939f4))[_0x9955('0x2b')](handleError(_0x169a3f,null));};exports['show']=function(_0x25aaff,_0x2bc59a){var _0x3fa5a6={'raw':![],'where':{'id':_0x25aaff[_0x9955('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9955('0x40')},{'model':db['MailServerOut'],'as':_0x9955('0x42')},{'model':db['Pause'],'as':_0x9955('0x44')}]},_0x52520e={};_0x52520e[_0x9955('0x4d')]=_['keys'](db['MailAccount']['rawAttributes']);_0x52520e['query']=_['keys'](_0x25aaff['query']);_0x52520e[_0x9955('0x55')]=_[_0x9955('0x4c')](_0x52520e[_0x9955('0x4d')],_0x52520e[_0x9955('0x4a')]);_0x3fa5a6[_0x9955('0x4e')]=_[_0x9955('0x4c')](_0x52520e[_0x9955('0x4d')],qs['fields'](_0x25aaff[_0x9955('0x4a')][_0x9955('0x4f')]));_0x3fa5a6[_0x9955('0x4e')]=_0x3fa5a6[_0x9955('0x4e')][_0x9955('0x50')]?_0x3fa5a6[_0x9955('0x4e')]:_0x52520e[_0x9955('0x4d')];if(_0x25aaff['query'][_0x9955('0x59')]){_0x3fa5a6[_0x9955('0x5a')]=[{'all':!![]}];}_0x3fa5a6=_[_0x9955('0x5d')]({},_0x3fa5a6,_0x25aaff[_0x9955('0x57')]);return db[_0x9955('0x5e')]['find'](_0x3fa5a6)[_0x9955('0x20')](handleEntityNotFound(_0x2bc59a,null))['then'](respondWithResult(_0x2bc59a,null))[_0x9955('0x2b')](handleError(_0x2bc59a,null));};exports[_0x9955('0x36')]=function(_0x2400c1,_0x37e86c){if(_0x2400c1['body']['id']){delete _0x2400c1[_0x9955('0x5f')]['id'];}return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x2400c1[_0x9955('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x9955('0x41')],'as':_0x9955('0x42')},{'model':db[_0x9955('0x43')],'as':_0x9955('0x44')}]})[_0x9955('0x20')](handleEntityNotFound(_0x37e86c,null))[_0x9955('0x20')](saveUpdates(_0x2400c1[_0x9955('0x5f')],null))[_0x9955('0x20')](function(_0x17eb33){if(_0x17eb33&&_0x2400c1[_0x9955('0x5f')][_0x9955('0x40')]){return db[_0x9955('0x3f')][_0x9955('0x36')](_0x2400c1[_0x9955('0x5f')][_0x9955('0x40')],{'where':{'MailAccountId':_0x17eb33['id']}})[_0x9955('0x20')](function(){return _0x17eb33;});}return _0x17eb33;})[_0x9955('0x20')](function(_0x20aecb){if(_0x20aecb&&_0x2400c1[_0x9955('0x5f')][_0x9955('0x42')]){return db[_0x9955('0x41')]['update'](_0x2400c1[_0x9955('0x5f')][_0x9955('0x42')],{'where':{'MailAccountId':_0x20aecb['id']}})[_0x9955('0x20')](function(){return _0x20aecb;});}return _0x20aecb;})[_0x9955('0x20')](respondWithResult(_0x37e86c,null))['catch'](handleError(_0x37e86c,null));};exports[_0x9955('0x61')]=function(_0xf5c477,_0x1014f0){return db[_0x9955('0x5e')][_0x9955('0x61')]()['then'](respondWithResult(_0x1014f0,null))[_0x9955('0x2b')](handleError(_0x1014f0,null));};exports[_0x9955('0x62')]=function(_0x1e362a,_0x210360,_0x2b2a49){if(_0x1e362a[_0x9955('0x5f')]['id']){delete _0x1e362a[_0x9955('0x5f')]['id'];}return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x1e362a[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x210360,null))[_0x9955('0x20')](function(_0x323b12){if(_0x323b12){_0x1e362a[_0x9955('0x5f')]['MailAccountId']=_0x323b12['id'];return db[_0x9955('0x63')][_0x9955('0x64')](_0x1e362a['body']);}})[_0x9955('0x20')](respondWithResult(_0x210360,null))['catch'](handleError(_0x210360,null));};exports[_0x9955('0x65')]=function(_0x2f5284,_0x278e83,_0x3e8fe3){var _0x4d5be1={'raw':![],'where':{}};var _0x34f334={};var _0x53b794={'count':0x0,'rows':[]};return db[_0x9955('0x5e')][_0x9955('0x66')]({'where':{'id':_0x2f5284[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x278e83,null))['then'](function(_0x3dcdc2){if(_0x3dcdc2){_0x34f334[_0x9955('0x4d')]=_['keys'](db['Disposition'][_0x9955('0x46')]);_0x34f334[_0x9955('0x4a')]=_['keys'](_0x2f5284['query']);_0x34f334[_0x9955('0x55')]=_[_0x9955('0x4c')](_0x34f334[_0x9955('0x4d')],_0x34f334[_0x9955('0x4a')]);_0x4d5be1[_0x9955('0x4e')]=_[_0x9955('0x4c')](_0x34f334['model'],qs['fields'](_0x2f5284[_0x9955('0x4a')]['fields']));_0x4d5be1[_0x9955('0x4e')]=_0x4d5be1[_0x9955('0x4e')][_0x9955('0x50')]?_0x4d5be1[_0x9955('0x4e')]:_0x34f334['model'];if(!_0x2f5284[_0x9955('0x4a')][_0x9955('0x67')]('nolimit')){_0x4d5be1['limit']=qs['limit'](_0x2f5284['query'][_0x9955('0x30')]);_0x4d5be1[_0x9955('0x2f')]=qs[_0x9955('0x2f')](_0x2f5284[_0x9955('0x4a')][_0x9955('0x2f')]);}_0x4d5be1['order']=qs['sort'](_0x2f5284['query']['sort']);_0x4d5be1['where']=qs[_0x9955('0x55')](_[_0x9955('0x68')](_0x2f5284['query'],_0x34f334['filters']));_0x4d5be1[_0x9955('0x54')][_0x9955('0x69')]=_0x3dcdc2['id'];if(_0x2f5284['query'][_0x9955('0x56')]){_0x4d5be1[_0x9955('0x54')]=_[_0x9955('0x5d')](_0x4d5be1['where'],{'$or':_[_0x9955('0x45')](_0x4d5be1[_0x9955('0x4e')],function(_0x45104c){var _0x5349ce={};_0x5349ce[_0x45104c]={'$like':'%'+_0x2f5284['query'][_0x9955('0x56')]+'%'};return _0x5349ce;})});}_0x4d5be1=_[_0x9955('0x5d')]({},_0x4d5be1,_0x2f5284[_0x9955('0x57')]);return db[_0x9955('0x63')][_0x9955('0x58')]({'where':_0x4d5be1[_0x9955('0x54')]})[_0x9955('0x20')](function(_0x5128c8){_0x53b794[_0x9955('0x58')]=_0x5128c8;if(_0x2f5284[_0x9955('0x4a')][_0x9955('0x59')]){_0x4d5be1[_0x9955('0x5a')]=[{'all':!![]}];}return db[_0x9955('0x63')][_0x9955('0x6a')](_0x4d5be1);})[_0x9955('0x20')](function(_0x413add){_0x53b794['rows']=_0x413add;return _0x53b794;});}})[_0x9955('0x20')](respondWithFilteredResult(_0x278e83,_0x4d5be1))['catch'](handleError(_0x278e83,null));};exports[_0x9955('0x6b')]=function(_0x56d1c2,_0x24fac4,_0xfec66){return db['MailAccount'][_0x9955('0x60')]({'where':{'id':_0x56d1c2[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x24fac4,null))[_0x9955('0x20')](function(_0x24f590){if(_0x24f590){return _0x24f590[_0x9955('0x6b')](_0x56d1c2[_0x9955('0x4a')][_0x9955('0x6c')]);}})[_0x9955('0x20')](respondWithStatusCode(_0x24fac4,null))[_0x9955('0x2b')](handleError(_0x24fac4,null));};exports[_0x9955('0x6d')]=function(_0x478cfb,_0x179c17,_0xd2f91b){if(_0x478cfb[_0x9955('0x5f')]['id']){delete _0x478cfb[_0x9955('0x5f')]['id'];}return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x478cfb['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x179c17,null))['then'](function(_0x8b5d3a){if(_0x8b5d3a){_0x478cfb[_0x9955('0x5f')][_0x9955('0x69')]=_0x8b5d3a['id'];return db[_0x9955('0x6e')][_0x9955('0x64')](_0x478cfb[_0x9955('0x5f')]);}})['then'](respondWithResult(_0x179c17,null))[_0x9955('0x2b')](handleError(_0x179c17,null));};exports['getAnswers']=function(_0x1449ff,_0x21bf95,_0x8f27cf){var _0x28a831={'raw':![],'where':{}};var _0x4ce2c1={};var _0x21f58b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1449ff[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x21bf95,null))['then'](function(_0x337ab6){if(_0x337ab6){_0x4ce2c1[_0x9955('0x4d')]=_[_0x9955('0x4b')](db['CannedAnswer'][_0x9955('0x46')]);_0x4ce2c1[_0x9955('0x4a')]=_[_0x9955('0x4b')](_0x1449ff[_0x9955('0x4a')]);_0x4ce2c1[_0x9955('0x55')]=_[_0x9955('0x4c')](_0x4ce2c1[_0x9955('0x4d')],_0x4ce2c1[_0x9955('0x4a')]);_0x28a831[_0x9955('0x4e')]=_[_0x9955('0x4c')](_0x4ce2c1[_0x9955('0x4d')],qs[_0x9955('0x4f')](_0x1449ff['query'][_0x9955('0x4f')]));_0x28a831[_0x9955('0x4e')]=_0x28a831[_0x9955('0x4e')][_0x9955('0x50')]?_0x28a831[_0x9955('0x4e')]:_0x4ce2c1['model'];if(!_0x1449ff['query']['hasOwnProperty'](_0x9955('0x51'))){_0x28a831['limit']=qs[_0x9955('0x30')](_0x1449ff[_0x9955('0x4a')][_0x9955('0x30')]);_0x28a831[_0x9955('0x2f')]=qs[_0x9955('0x2f')](_0x1449ff[_0x9955('0x4a')]['offset']);}_0x28a831[_0x9955('0x52')]=qs['sort'](_0x1449ff['query'][_0x9955('0x53')]);_0x28a831[_0x9955('0x54')]=qs[_0x9955('0x55')](_[_0x9955('0x68')](_0x1449ff[_0x9955('0x4a')],_0x4ce2c1[_0x9955('0x55')]));_0x28a831[_0x9955('0x54')]['MailAccountId']=_0x337ab6['id'];if(_0x1449ff['query'][_0x9955('0x56')]){_0x28a831['where']=_[_0x9955('0x5d')](_0x28a831[_0x9955('0x54')],{'$or':_[_0x9955('0x45')](_0x28a831['attributes'],function(_0x111297){var _0x5551bd={};_0x5551bd[_0x111297]={'$like':'%'+_0x1449ff[_0x9955('0x4a')][_0x9955('0x56')]+'%'};return _0x5551bd;})});}_0x28a831=_['merge']({},_0x28a831,_0x1449ff['options']);return db['CannedAnswer'][_0x9955('0x58')]({'where':_0x28a831[_0x9955('0x54')]})[_0x9955('0x20')](function(_0xdffe4e){_0x21f58b[_0x9955('0x58')]=_0xdffe4e;if(_0x1449ff[_0x9955('0x4a')][_0x9955('0x59')]){_0x28a831[_0x9955('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9955('0x6a')](_0x28a831);})[_0x9955('0x20')](function(_0x4cc167){_0x21f58b['rows']=_0x4cc167;return _0x21f58b;});}})[_0x9955('0x20')](respondWithFilteredResult(_0x21bf95,_0x28a831))['catch'](handleError(_0x21bf95,null));};exports[_0x9955('0x6f')]=function(_0x6a1e01,_0xb244cf,_0x41fd13){return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x6a1e01['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0xb244cf,null))['then'](function(_0x52b839){if(_0x52b839){return _0x52b839[_0x9955('0x6f')](_0x6a1e01['query'][_0x9955('0x6c')]);}})[_0x9955('0x20')](respondWithStatusCode(_0xb244cf,null))['catch'](handleError(_0xb244cf,null));};exports[_0x9955('0x64')]=function(_0xff639f,_0x4b9531){var _0x3d3c66={'name':_0xff639f[_0x9955('0x5f')]['name'],'key':_0xff639f[_0x9955('0x5f')][_0x9955('0x49')],'email':_0xff639f[_0x9955('0x5f')][_0x9955('0x70')],'ListId':_0xff639f['body'][_0x9955('0x71')],'active':!_[_0x9955('0x72')](_0xff639f[_0x9955('0x5f')][_0x9955('0x73')])?_0xff639f[_0x9955('0x5f')]['active']:!![],'description':_0xff639f['body'][_0x9955('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x9955('0x72')](_0xff639f['body'][_0x9955('0x75')])){if(_0xff639f[_0x9955('0x5f')]['cauthentication']){_0x3d3c66['Imap'][_0x9955('0x76')]=_0x3d3c66['Smtp'][_0x9955('0x76')]=_0xff639f[_0x9955('0x5f')][_0x9955('0x77')];_0x3d3c66['Imap'][_0x9955('0x78')]=_0x3d3c66['Smtp'][_0x9955('0x79')]=_0xff639f['body'][_0x9955('0x7a')];}else{_0x3d3c66[_0x9955('0x40')]['authentication']=_0x3d3c66['Smtp'][_0x9955('0x7b')]=![];}_0x3d3c66[_0x9955('0x40')][_0x9955('0x7c')]=_0xff639f['body'][_0x9955('0x40')][_0x9955('0x7c')];_0x3d3c66[_0x9955('0x40')]['port']=_0xff639f[_0x9955('0x5f')][_0x9955('0x40')][_0x9955('0x7d')];_0x3d3c66[_0x9955('0x42')][_0x9955('0x7c')]=_0xff639f[_0x9955('0x5f')][_0x9955('0x42')][_0x9955('0x7c')];_0x3d3c66['Smtp'][_0x9955('0x7d')]=_0xff639f['body'][_0x9955('0x42')][_0x9955('0x7d')];}else{_0x3d3c66[_0x9955('0x40')][_0x9955('0x7e')]=_0x3d3c66[_0x9955('0x42')][_0x9955('0x7e')]=_0xff639f[_0x9955('0x5f')]['cservice'];_0x3d3c66[_0x9955('0x40')]['user']=_0x3d3c66['Smtp']['user']=_0xff639f[_0x9955('0x5f')][_0x9955('0x77')];_0x3d3c66[_0x9955('0x40')][_0x9955('0x78')]=_0x3d3c66[_0x9955('0x42')]['pass']=_0xff639f[_0x9955('0x5f')][_0x9955('0x7a')];}return db['MailAccount'][_0x9955('0x64')](_0x3d3c66,{'include':[{'model':db['MailServerOut'],'as':_0x9955('0x42')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x9955('0x20')](function(_0x3fd58d){var _0x3f761d=_0xff639f[_0x9955('0x76')]['get']({'plain':!![]});if(!_0x3f761d)throw new Error(_0x9955('0x7f'));if(_0x3f761d[_0x9955('0x80')]==='user'){var _0x202758=_0x3fd58d['get']({'plain':!![]});return db[_0x9955('0x81')][_0x9955('0x60')]({'where':{'name':_0x9955('0x39'),'userProfileId':_0x3f761d[_0x9955('0x82')]},'raw':!![]})[_0x9955('0x20')](function(_0xc02927){if(_0xc02927&&_0xc02927[_0x9955('0x83')]===0x0){return db[_0x9955('0x84')][_0x9955('0x64')]({'name':_0x202758[_0x9955('0x3c')],'resourceId':_0x202758['id'],'type':_0xc02927[_0x9955('0x3c')],'sectionId':_0xc02927['id']},{})[_0x9955('0x20')](function(){return _0x3fd58d;});}else{return _0x3fd58d;}})[_0x9955('0x2b')](function(_0x520f0a){logger[_0x9955('0x25')](_0x9955('0x85'),_0x520f0a);throw _0x520f0a;});}return _0x3fd58d;})[_0x9955('0x20')](respondWithResult(_0x4b9531,0xc9))[_0x9955('0x2b')](handleError(_0x4b9531,null));};exports['getImap']=function(_0x2c797f,_0xce3ee6,_0xe3d743){return db[_0x9955('0x5e')][_0x9955('0x66')]({'where':{'id':_0x2c797f[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0xce3ee6,null))[_0x9955('0x20')](function(_0x213f83){if(_0x213f83){return _0x213f83[_0x9955('0x86')]();}return null;})['then'](respondWithResult(_0xce3ee6,null))[_0x9955('0x2b')](handleError(_0xce3ee6,null));};exports[_0x9955('0x87')]=function(_0x49e2c1,_0x12ae30,_0x384261){if(_0x49e2c1[_0x9955('0x5f')]['id']){delete _0x49e2c1['body']['id'];}return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x49e2c1[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x12ae30,null))[_0x9955('0x20')](function(_0x42e2aa){if(_0x42e2aa){_0x49e2c1[_0x9955('0x5f')]['MailAccountId']=_0x42e2aa['id'];return db[_0x9955('0x3f')][_0x9955('0x64')](_0x49e2c1[_0x9955('0x5f')]);}})[_0x9955('0x20')](respondWithResult(_0x12ae30,null))[_0x9955('0x2b')](handleError(_0x12ae30,null));};exports[_0x9955('0x88')]=function(_0x3729d7,_0x5aa71c,_0x4efebf){return db['MailAccount'][_0x9955('0x66')]({'where':{'id':_0x3729d7['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x5aa71c,null))[_0x9955('0x20')](function(_0x188529){if(_0x188529){return _0x188529[_0x9955('0x89')](null);}return null;})['then'](respondWithStatusCode(_0x5aa71c,null))[_0x9955('0x2b')](handleError(_0x5aa71c,null));};exports[_0x9955('0x8a')]=function(_0x17e35b,_0x122674,_0x1b366d){return db[_0x9955('0x5e')][_0x9955('0x66')]({'where':{'id':_0x17e35b['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x122674,null))['then'](function(_0x35946d){if(_0x35946d){return _0x35946d['getSmtp']();}return null;})[_0x9955('0x20')](respondWithResult(_0x122674,null))[_0x9955('0x2b')](handleError(_0x122674,null));};exports['addSmtp']=function(_0x1f209c,_0x5cdc55,_0x510693){if(_0x1f209c[_0x9955('0x5f')]['id']){delete _0x1f209c[_0x9955('0x5f')]['id'];}return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x1f209c['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x5cdc55,null))[_0x9955('0x20')](function(_0x4763b3){if(_0x4763b3){_0x1f209c['body'][_0x9955('0x69')]=_0x4763b3['id'];return db[_0x9955('0x41')]['create'](_0x1f209c['body']);}})[_0x9955('0x20')](respondWithResult(_0x5cdc55,null))[_0x9955('0x2b')](handleError(_0x5cdc55,null));};exports[_0x9955('0x8b')]=function(_0x2c9453,_0x4ecc1e,_0x803856){return db[_0x9955('0x5e')][_0x9955('0x66')]({'where':{'id':_0x2c9453['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x4ecc1e,null))[_0x9955('0x20')](function(_0x1e3765){if(_0x1e3765){return _0x1e3765[_0x9955('0x8c')](null);}return null;})[_0x9955('0x20')](respondWithStatusCode(_0x4ecc1e,null))[_0x9955('0x2b')](handleError(_0x4ecc1e,null));};exports['addInteraction']=function(_0x2e0fd7,_0x378709,_0x2f7913){return db[_0x9955('0x8d')][_0x9955('0x60')]({'where':{'id':_0x2e0fd7['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x378709,null))[_0x9955('0x20')](function(_0x39875a){if(_0x39875a){return _0x39875a[_0x9955('0x8e')](_0x2e0fd7[_0x9955('0x5f')]['ids'],_['omit'](_0x2e0fd7[_0x9955('0x5f')],[_0x9955('0x6c'),'id'])||{});}})[_0x9955('0x20')](respondWithResult(_0x378709,null))[_0x9955('0x2b')](handleError(_0x378709,null));};exports['getInteractions']=function(_0x2f239b,_0x2f602a,_0x30d7cf){var _0x113ea1={'raw':![],'where':{}};var _0x127323={};var _0xb07aac={'count':0x0,'rows':[]};return db[_0x9955('0x5e')]['findOne']({'where':{'id':_0x2f239b['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x2f602a,null))[_0x9955('0x20')](function(_0x5ba74a){if(_0x5ba74a){_0x127323[_0x9955('0x4d')]=_[_0x9955('0x4b')](db['MailInteraction'][_0x9955('0x46')]);_0x127323[_0x9955('0x4a')]=_[_0x9955('0x4b')](_0x2f239b[_0x9955('0x4a')]);_0x127323['filters']=_[_0x9955('0x4c')](_0x127323[_0x9955('0x4d')],_0x127323[_0x9955('0x4a')]);_0x113ea1[_0x9955('0x4e')]=_[_0x9955('0x4c')](_0x127323[_0x9955('0x4d')],qs['fields'](_0x2f239b[_0x9955('0x4a')]['fields']));_0x113ea1[_0x9955('0x4e')]=_0x113ea1[_0x9955('0x4e')][_0x9955('0x50')]?_0x113ea1[_0x9955('0x4e')]:_0x127323[_0x9955('0x4d')];if(!_0x2f239b[_0x9955('0x4a')][_0x9955('0x67')](_0x9955('0x51'))){_0x113ea1[_0x9955('0x30')]=qs[_0x9955('0x30')](_0x2f239b[_0x9955('0x4a')]['limit']);_0x113ea1['offset']=qs['offset'](_0x2f239b['query'][_0x9955('0x2f')]);}_0x113ea1['order']=qs['sort'](_0x2f239b[_0x9955('0x4a')][_0x9955('0x53')]);_0x113ea1['where']=qs[_0x9955('0x55')](_[_0x9955('0x68')](_0x2f239b['query'],_0x127323[_0x9955('0x55')]));_0x113ea1[_0x9955('0x54')][_0x9955('0x69')]=_0x5ba74a['id'];if(_0x2f239b['query']['filter']){_0x113ea1['where']=_[_0x9955('0x5d')](_0x113ea1['where'],{'$or':_[_0x9955('0x45')](_0x113ea1[_0x9955('0x4e')],function(_0x57cba2){var _0x5c7fe2={};_0x5c7fe2[_0x57cba2]={'$like':'%'+_0x2f239b[_0x9955('0x4a')]['filter']+'%'};return _0x5c7fe2;})});}_0x113ea1=_['merge']({},_0x113ea1,_0x2f239b['options']);return db[_0x9955('0x8d')]['count']({'where':_0x113ea1[_0x9955('0x54')]})[_0x9955('0x20')](function(_0x2868c2){_0xb07aac[_0x9955('0x58')]=_0x2868c2;if(_0x2f239b[_0x9955('0x4a')][_0x9955('0x59')]){_0x113ea1[_0x9955('0x5a')]=[{'model':db[_0x9955('0x8f')],'as':_0x9955('0x90'),'required':![]},{'model':db[_0x9955('0x91')],'as':_0x9955('0x92'),'attributes':['name',_0x9955('0x93'),'internal'],'required':![]},{'model':db[_0x9955('0x94')],'as':_0x9955('0x95'),'attributes':['id',_0x9955('0x3c'),_0x9955('0x96')],'where':_0x2f239b['query'][_0x9955('0x97')]?{'id':_0x2f239b['query'][_0x9955('0x97')]}:undefined,'required':_0x2f239b[_0x9955('0x4a')][_0x9955('0x97')]?!![]:![]}];}return db[_0x9955('0x8d')][_0x9955('0x6a')](_0x113ea1);})[_0x9955('0x20')](function(_0x3f736d){_0xb07aac['rows']=_0x3f736d;return _0xb07aac;});}})[_0x9955('0x20')](respondWithFilteredResult(_0x2f602a,_0x113ea1))[_0x9955('0x2b')](handleError(_0x2f602a,null));};exports[_0x9955('0x98')]=function(_0x59d2bf,_0x8cf288,_0x28a1b0){return db[_0x9955('0x5e')]['findOne']({'where':{'id':_0x59d2bf[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x8cf288,null))[_0x9955('0x20')](function(_0x27646c){if(_0x27646c){return db[_0x9955('0x99')][_0x9955('0x9a')](function(_0x20efca){return db[_0x9955('0x9b')][_0x9955('0x37')]({'where':{'MailAccountId':_0x59d2bf[_0x9955('0x5c')]['id']},'transaction':_0x20efca})[_0x9955('0x20')](function(_0x2f7635){var _0x3167af=_['map'](_0x59d2bf[_0x9955('0x5f')],function(_0x50e5ce){_0x50e5ce[_0x9955('0x69')]=_0x59d2bf[_0x9955('0x5c')]['id'];return _0x50e5ce;});return db['MailApplication'][_0x9955('0x9c')](_0x3167af,{'transaction':_0x20efca});});})[_0x9955('0x20')](function(){return db[_0x9955('0x9b')][_0x9955('0x9d')]({'where':{'MailAccountId':_0x59d2bf[_0x9955('0x5c')]['id']},'order':'priority'});});}})[_0x9955('0x20')](respondWithResult(_0x8cf288,null))['catch'](handleError(_0x8cf288,null));};exports['getApplications']=function(_0x3259ee,_0x5adf5e,_0x4afc1e){var _0x53090a={};var _0x749046={};var _0x36a4b8;var _0x3d98bb;return db['MailAccount'][_0x9955('0x66')]({'where':{'id':_0x3259ee[_0x9955('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5adf5e,null))[_0x9955('0x20')](function(_0x37a9a3){if(_0x37a9a3){_0x36a4b8=_0x37a9a3;_0x749046[_0x9955('0x4d')]=_[_0x9955('0x4b')](db['MailApplication'][_0x9955('0x46')]);_0x749046['query']=_[_0x9955('0x4b')](_0x3259ee[_0x9955('0x4a')]);_0x749046[_0x9955('0x55')]=_[_0x9955('0x4c')](_0x749046['model'],_0x749046[_0x9955('0x4a')]);_0x53090a[_0x9955('0x4e')]=_[_0x9955('0x4c')](_0x749046['model'],qs['fields'](_0x3259ee[_0x9955('0x4a')][_0x9955('0x4f')]));_0x53090a[_0x9955('0x4e')]=_0x53090a[_0x9955('0x4e')][_0x9955('0x50')]?_0x53090a['attributes']:_0x749046['model'];_0x53090a[_0x9955('0x52')]=qs['sort'](_0x3259ee['query'][_0x9955('0x53')]);_0x53090a['where']=qs[_0x9955('0x55')](_[_0x9955('0x68')](_0x3259ee[_0x9955('0x4a')],_0x749046[_0x9955('0x55')]));if(_0x3259ee[_0x9955('0x4a')][_0x9955('0x56')]){_0x53090a['where']=_[_0x9955('0x5d')](_0x53090a[_0x9955('0x54')],{'$or':_[_0x9955('0x45')](_0x53090a[_0x9955('0x4e')],function(_0x127d82){var _0x5c9739={};_0x5c9739[_0x127d82]={'$like':'%'+_0x3259ee['query'][_0x9955('0x56')]+'%'};return _0x5c9739;})});}_0x53090a=_[_0x9955('0x5d')]({},_0x53090a,_0x3259ee[_0x9955('0x57')]);return _0x36a4b8[_0x9955('0x9e')](_0x53090a);}})[_0x9955('0x20')](function(_0x3ca9ed){if(_0x3ca9ed){_0x3d98bb=_0x3ca9ed[_0x9955('0x50')];if(!_0x3259ee[_0x9955('0x4a')][_0x9955('0x67')](_0x9955('0x51'))){_0x53090a['limit']=qs[_0x9955('0x30')](_0x3259ee[_0x9955('0x4a')][_0x9955('0x30')]);_0x53090a[_0x9955('0x2f')]=qs[_0x9955('0x2f')](_0x3259ee[_0x9955('0x4a')]['offset']);}return _0x36a4b8[_0x9955('0x9e')](_0x53090a);}})[_0x9955('0x20')](function(_0x1aa658){if(_0x1aa658){return _0x1aa658?{'count':_0x3d98bb,'rows':_0x1aa658}:null;}})[_0x9955('0x20')](respondWithResult(_0x5adf5e,null))[_0x9955('0x2b')](handleError(_0x5adf5e,null));};exports['getMessages']=function(_0x415f99,_0x2be8d5,_0x4bd95a){var _0x1f5fd6={'raw':!![],'where':{}};var _0x4ecbdf={};var _0x38d6e1={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x415f99[_0x9955('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2be8d5,null))[_0x9955('0x20')](function(_0xbd0cb9){if(_0xbd0cb9){_0x4ecbdf['model']=_[_0x9955('0x4b')](db[_0x9955('0x9f')][_0x9955('0x46')]);_0x4ecbdf[_0x9955('0x4a')]=_[_0x9955('0x4b')](_0x415f99[_0x9955('0x4a')]);_0x4ecbdf[_0x9955('0x55')]=_[_0x9955('0x4c')](_0x4ecbdf[_0x9955('0x4d')],_0x4ecbdf[_0x9955('0x4a')]);_0x1f5fd6['attributes']=_[_0x9955('0x4c')](_0x4ecbdf[_0x9955('0x4d')],qs[_0x9955('0x4f')](_0x415f99['query'][_0x9955('0x4f')]));_0x1f5fd6[_0x9955('0x4e')]=_0x1f5fd6['attributes'][_0x9955('0x50')]?_0x1f5fd6['attributes']:_0x4ecbdf[_0x9955('0x4d')];if(!_0x415f99[_0x9955('0x4a')]['hasOwnProperty']('nolimit')){_0x1f5fd6['limit']=qs[_0x9955('0x30')](_0x415f99[_0x9955('0x4a')][_0x9955('0x30')]);_0x1f5fd6[_0x9955('0x2f')]=qs[_0x9955('0x2f')](_0x415f99[_0x9955('0x4a')][_0x9955('0x2f')]);}_0x1f5fd6[_0x9955('0x52')]=qs['sort'](_0x415f99[_0x9955('0x4a')]['sort']);_0x1f5fd6[_0x9955('0x54')]=qs['filters'](_[_0x9955('0x68')](_0x415f99['query'],_0x4ecbdf[_0x9955('0x55')]));_0x1f5fd6['where'][_0x9955('0x69')]=_0xbd0cb9['id'];if(_0x415f99[_0x9955('0x4a')][_0x9955('0x56')]){_0x1f5fd6[_0x9955('0x54')]=_[_0x9955('0x5d')](_0x1f5fd6['where'],{'$or':_[_0x9955('0x45')](_0x1f5fd6[_0x9955('0x4e')],function(_0x41b014){var _0x4c6927={};_0x4c6927[_0x41b014]={'$like':'%'+_0x415f99['query']['filter']+'%'};return _0x4c6927;})});}if(_0x415f99[_0x9955('0x4a')][_0x9955('0xa0')]){var _0x221b14=_0x415f99[_0x9955('0x4a')][_0x9955('0xa0')][_0x9955('0xa1')](',');var _0x2e47ca={};_0x2e47ca[_0x221b14[0x0]]={'$gte':moment(_0x221b14[0x1])[_0x9955('0xa2')](_0x9955('0xa3'))};_0x1f5fd6[_0x9955('0x54')]=_[_0x9955('0x5d')](_0x1f5fd6[_0x9955('0x54')],_0x2e47ca);}_0x1f5fd6=_[_0x9955('0x5d')]({},_0x1f5fd6,_0x415f99[_0x9955('0x57')]);return db[_0x9955('0x9f')][_0x9955('0x58')]({'where':_0x1f5fd6[_0x9955('0x54')]})[_0x9955('0x20')](function(_0x448104){_0x38d6e1[_0x9955('0x58')]=_0x448104;if(_0x415f99['query'][_0x9955('0x59')]){_0x1f5fd6[_0x9955('0x5a')]=[{'all':!![]}];}return db['MailMessage'][_0x9955('0x6a')](_0x1f5fd6);})['then'](function(_0x24074c){if(_0x415f99[_0x9955('0x4a')][_0x9955('0xa4')]==='true'){for(var _0xd56d64=0x0;_0xd56d64<_0x24074c[_0x9955('0x50')];_0xd56d64++){_0x24074c[_0xd56d64]['body']=juice(_0x24074c[_0xd56d64][_0x9955('0x5f')]);}}_0x38d6e1[_0x9955('0x5b')]=_0x24074c;return _0x38d6e1;});}})[_0x9955('0x20')](respondWithFilteredResult(_0x2be8d5,_0x1f5fd6))['catch'](handleError(_0x2be8d5,null));};exports['send']=function(_0x15bdce,_0x54c574,_0xdfc18c){var _0x2a050a,_0x37c21a={},_0x3afabf;if(_0x15bdce[_0x9955('0x5f')]['to']){_0x3afabf=_0x15bdce[_0x9955('0x5f')]['to'][_0x9955('0xa1')](',')[0x0];}return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x15bdce[_0x9955('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x9955('0xa5'),'include':[{'model':db[_0x9955('0x8f')],'as':'Contacts','where':{'email':_0x3afabf},'limit':0x1,'order':[[_0x9955('0xa6'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x54c574,null))['then'](function(_0x5c3ed4){if(_0x5c3ed4){_0x2a050a=_0x5c3ed4;if(_0x5c3ed4['Smtp']){if(_[_0x9955('0x72')](_0x15bdce['body']['from'])){_0x15bdce[_0x9955('0x5f')][_0x9955('0xa7')]=util['format'](_0x9955('0xa8'),_0x5c3ed4[_0x9955('0x3c')],_0x5c3ed4[_0x9955('0x70')]||_0x5c3ed4['Smtp'][_0x9955('0x76')]);}if(_0x15bdce[_0x9955('0x5f')][_0x9955('0xa9')]&&_0x15bdce[_0x9955('0x5f')][_0x9955('0xa9')]['length']){for(var _0x203b19=0x0;_0x203b19<_0x15bdce[_0x9955('0x5f')][_0x9955('0xa9')][_0x9955('0x50')];_0x203b19+=0x1){_0x15bdce[_0x9955('0x5f')]['attachments'][_0x203b19]={'filename':_0x15bdce[_0x9955('0x5f')][_0x9955('0xa9')][_0x203b19][_0x9955('0x3c')],'path':path[_0x9955('0xaa')](config['root'],_0x9955('0xab'),_0x15bdce[_0x9955('0x5f')][_0x9955('0xa9')][_0x203b19][_0x9955('0xac')])};}}var _0x41d912={'tls':{'rejectUnauthorized':![]}};if(_[_0x9955('0x72')](_0x5c3ed4[_0x9955('0x42')][_0x9955('0x7e')])){if(_0x5c3ed4[_0x9955('0x42')][_0x9955('0x7b')]){_0x41d912[_0x9955('0xad')]={'user':_0x5c3ed4[_0x9955('0x42')][_0x9955('0x76')],'pass':_0x5c3ed4[_0x9955('0x42')][_0x9955('0x79')]};}_0x41d912[_0x9955('0x7c')]=_0x5c3ed4[_0x9955('0x42')][_0x9955('0x7c')];_0x41d912[_0x9955('0x7d')]=_0x5c3ed4[_0x9955('0x42')]['port'];_0x41d912[_0x9955('0xae')]=_0x5c3ed4['Smtp'][_0x9955('0xae')];}else{_0x41d912['service']=_0x5c3ed4[_0x9955('0x42')][_0x9955('0x7e')];_0x41d912['auth']={'user':_0x5c3ed4['Smtp'][_0x9955('0x76')],'pass':_0x5c3ed4['Smtp'][_0x9955('0x79')]};}return respondWithRpcPromise(_0x9955('0xaf'),'sendMail',{'account':_0x41d912,'message':_0x15bdce[_0x9955('0x5f')]});}else{throw new Error(_0x9955('0xb0'));}}})['then'](function(_0x227eb6){if(_0x227eb6){_0x37c21a=_0x227eb6;if(_0x2a050a['List']){if(_0x2a050a[_0x9955('0xa5')][_0x9955('0xb1')]['length']){return _0x2a050a[_0x9955('0xa5')][_0x9955('0xb1')][0x0];}else{return db[_0x9955('0x8f')][_0x9955('0x64')](_[_0x9955('0xb2')](_0x15bdce[_0x9955('0x5f')],{'firstName':_0x15bdce['body']['to'],'email':_0x15bdce[_0x9955('0x5f')]['to'],'phone':_0x15bdce['body']['to'],'ListId':_0x2a050a['ListId']}));}}else{throw new Error(_0x9955('0xb0'));}}})['then'](function(_0xc60119){if(_0xc60119){var _0x2fd95d={'UserId':_0x15bdce[_0x9955('0x76')]['id'],'ContactId':_0xc60119['id'],'MailAccountId':_0x2a050a['id'],'inReplyTo':_0x37c21a[_0x9955('0xb3')],'to':_0x15bdce[_0x9955('0x5f')][_0x9955('0xa7')],'cc':_0x15bdce[_0x9955('0x5f')]['cc'],'subject':_0x15bdce['body']['subject'],'attach':_0x15bdce['body'][_0x9955('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9955('0xa2')](_0x9955('0xa3')),'lastMsgDirection':_0x9955('0xb5'),'lastMsgBody':_0x15bdce[_0x9955('0x5f')]['body'],'Messages':[_[_0x9955('0x5d')](_0x15bdce[_0x9955('0x5f')],{'messageId':_0x37c21a['messageId'],'sentAt':moment()[_0x9955('0xa2')](_0x9955('0xa3')),'read':!![],'MailAccountId':_0x2a050a['id'],'UserId':_0x15bdce[_0x9955('0x76')]['id'],'ContactId':_0xc60119['id']})]};if(_0x15bdce['body'][_0x9955('0xb6')]){_0x2fd95d=_[_0x9955('0x5d')](_0x2fd95d,_0x15bdce[_0x9955('0x5f')]['Interaction']);}return db[_0x9955('0x8d')][_0x9955('0x64')](_0x2fd95d,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x9955('0x20')](respondWithResult(_0x54c574,null))[_0x9955('0x2b')](handleError(_0x54c574,null));};exports['verifySmtp']=function(_0x421da3,_0x3b78dd,_0x4d88e6){return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x421da3[_0x9955('0x5c')]['id']},'include':[{'model':db[_0x9955('0x41')],'as':_0x9955('0x42'),'raw':!![]}]})[_0x9955('0x20')](handleEntityNotFound(_0x3b78dd,null))[_0x9955('0x20')](function(_0x229c92){if(_0x229c92&&_0x229c92['Smtp']){var _0x17e3b2={'id':_0x229c92['id'],'tls':{'rejectUnauthorized':![]}};if(_0x229c92[_0x9955('0x42')][_0x9955('0x7e')]){_0x17e3b2['service']=_0x229c92[_0x9955('0x42')]['service'];}else{_0x17e3b2['host']=_0x229c92['Smtp'][_0x9955('0x7c')];_0x17e3b2[_0x9955('0x7d')]=_0x229c92['Smtp'][_0x9955('0x7d')];_0x17e3b2[_0x9955('0xae')]=_0x229c92['Smtp'][_0x9955('0xae')];}if(_0x229c92[_0x9955('0x42')][_0x9955('0x7b')]){_0x17e3b2[_0x9955('0xad')]={'user':_0x229c92[_0x9955('0x42')]['user'],'pass':_0x229c92[_0x9955('0x42')][_0x9955('0x79')]};}return respondWithRpcPromise(_0x9955('0xb7'),_0x9955('0xb8'),{'account':_0x17e3b2});}})['then'](respondWithResult(_0x3b78dd,null))[_0x9955('0x2b')](handleError(_0x3b78dd,null));};exports[_0x9955('0x37')]=function(_0x32508e,_0x1702cc){return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x32508e[_0x9955('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1702cc,null))[_0x9955('0x20')](function(_0xd305bd){if(_0xd305bd&&_0xd305bd[_0x9955('0x7e')]){throw new db[(_0x9955('0xb9'))]['ValidationError'](_0x9955('0xba'));}return _0xd305bd;})['then'](removeEntity(_0x1702cc,null))[_0x9955('0x2b')](handleError(_0x1702cc,null));};exports[_0x9955('0xbb')]=function(_0x2b0adc,_0x5ccba8,_0x45ff89){return db[_0x9955('0x5e')]['find']({'where':{'id':_0x2b0adc['params']['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x5ccba8,null))[_0x9955('0x20')](function(_0x334bb0){if(_0x334bb0){return _0x334bb0[_0x9955('0xbb')](_0x2b0adc[_0x9955('0x5f')][_0x9955('0x6c')],_['omit'](_0x2b0adc[_0x9955('0x5f')],['ids','id'])||{})[_0x9955('0xbc')](function(_0x1761dd){for(var _0x31434e=0x0;_0x31434e<_0x2b0adc[_0x9955('0x5f')][_0x9955('0x6c')][_0x9955('0x50')];_0x31434e+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x2b0adc[_0x9955('0x5f')][_0x9955('0x6c')][_0x31434e],'MailAccountId':_0x2b0adc['params']['id']});}return _0x1761dd;});}})[_0x9955('0x20')](respondWithResult(_0x5ccba8,null))[_0x9955('0x2b')](handleError(_0x5ccba8,null));};exports['removeAgents']=function(_0x48230d,_0x466c24,_0x22aaba){return db[_0x9955('0x5e')][_0x9955('0x60')]({'where':{'id':_0x48230d[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x466c24,null))[_0x9955('0x20')](function(_0xdb6e9c){if(_0xdb6e9c){return _0xdb6e9c[_0x9955('0xbd')](_0x48230d['query'][_0x9955('0x6c')])[_0x9955('0x20')](function(){if(_['isArray'](_0x48230d[_0x9955('0x4a')][_0x9955('0x6c')])){for(var _0x513186=0x0;_0x513186<_0x48230d['query'][_0x9955('0x6c')]['length'];_0x513186+=0x1){socket['emit'](_0x9955('0xbe'),{'UserId':Number(_0x48230d[_0x9955('0x4a')][_0x9955('0x6c')][_0x513186]),'MailAccountId':Number(_0x48230d['params']['id'])});}}else{socket[_0x9955('0xbf')](_0x9955('0xbe'),{'UserId':Number(_0x48230d[_0x9955('0x4a')][_0x9955('0x6c')]),'MailAccountId':Number(_0x48230d[_0x9955('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x466c24,null))[_0x9955('0x2b')](handleError(_0x466c24,null));};exports[_0x9955('0xc0')]=function(_0x8db7c,_0x3795b9,_0x780048){var _0xc004af={};var _0xcc533c={};var _0x11abd9;var _0x5f3b69;return db[_0x9955('0x5e')][_0x9955('0x66')]({'where':{'id':_0x8db7c[_0x9955('0x5c')]['id']}})[_0x9955('0x20')](handleEntityNotFound(_0x3795b9,null))[_0x9955('0x20')](function(_0x104e23){if(_0x104e23){_0x11abd9=_0x104e23;_0xcc533c['model']=_[_0x9955('0x4b')](db[_0x9955('0x91')][_0x9955('0x46')]);_0xcc533c[_0x9955('0x4a')]=_[_0x9955('0x4b')](_0x8db7c[_0x9955('0x4a')]);_0xcc533c[_0x9955('0x55')]=_['intersection'](_0xcc533c[_0x9955('0x4d')],_0xcc533c['query']);_0xc004af['attributes']=_[_0x9955('0x4c')](_0xcc533c[_0x9955('0x4d')],qs['fields'](_0x8db7c[_0x9955('0x4a')][_0x9955('0x4f')]));_0xc004af[_0x9955('0x4e')]=_0xc004af[_0x9955('0x4e')]['length']?_0xc004af[_0x9955('0x4e')]:_0xcc533c[_0x9955('0x4d')];_0xc004af[_0x9955('0x52')]=qs[_0x9955('0x53')](_0x8db7c[_0x9955('0x4a')][_0x9955('0x53')]);_0xc004af[_0x9955('0x54')]=qs['filters'](_['pick'](_0x8db7c[_0x9955('0x4a')],_0xcc533c[_0x9955('0x55')]));if(_0x8db7c[_0x9955('0x4a')][_0x9955('0x56')]){_0xc004af[_0x9955('0x54')]=_['merge'](_0xc004af[_0x9955('0x54')],{'$or':_[_0x9955('0x45')](_0xc004af[_0x9955('0x4e')],function(_0x5cda48){var _0x18e6a1={};_0x18e6a1[_0x5cda48]={'$like':'%'+_0x8db7c['query'][_0x9955('0x56')]+'%'};return _0x18e6a1;})});}_0xc004af=_[_0x9955('0x5d')]({},_0xc004af,_0x8db7c[_0x9955('0x57')]);return _0x11abd9[_0x9955('0xc0')](_0xc004af);}})['then'](function(_0xcfbeab){if(_0xcfbeab){_0x5f3b69=_0xcfbeab['length'];if(!_0x8db7c[_0x9955('0x4a')]['hasOwnProperty'](_0x9955('0x51'))){_0xc004af[_0x9955('0x30')]=qs[_0x9955('0x30')](_0x8db7c['query'][_0x9955('0x30')]);_0xc004af[_0x9955('0x2f')]=qs[_0x9955('0x2f')](_0x8db7c['query']['offset']);}return _0x11abd9['getAgents'](_0xc004af);}})[_0x9955('0x20')](function(_0x33158a){if(_0x33158a){return _0x33158a?{'count':_0x5f3b69,'rows':_0x33158a}:null;}})[_0x9955('0x20')](respondWithResult(_0x3795b9,null))[_0x9955('0x2b')](handleError(_0x3795b9,null));}; \ No newline at end of file +var _0x1db5=['bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','html-to-text','juice','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','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','stack','name','send','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','Pause','keys','length','include','find','body','MailServerOut','describe','addDisposition','MailAccountId','create','findOne','hasOwnProperty','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tags','tag','rows','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','inlineCss','true','split','CmList','Contacts','updatedAt','from','format','attachments','join','root','server/files/attachments','secure','auth','SendMail','sendMail','List\x20not\x20found','List','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','request-promise','moment'];(function(_0x32125b,_0x363e00){var _0x29c0f9=function(_0x20e974){while(--_0x20e974){_0x32125b['push'](_0x32125b['shift']());}};_0x29c0f9(++_0x363e00);}(_0x1db5,0x18c));var _0x51db=function(_0x5a678a,_0x10998b){_0x5a678a=_0x5a678a-0x0;var _0x55808d=_0x1db5[_0x5a678a];return _0x55808d;};'use strict';var pdf=require(_0x51db('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x51db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51db('0x2'));var moment=require(_0x51db('0x3'));var BPromise=require(_0x51db('0x4'));var Mustache=require(_0x51db('0x5'));var util=require(_0x51db('0x6'));var path=require(_0x51db('0x7'));var sox=require('sox');var csv=require(_0x51db('0x8'));var ejs=require(_0x51db('0x9'));var fs=require('fs');var _=require(_0x51db('0xa'));var squel=require('squel');var crypto=require(_0x51db('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x51db('0x8'));var querystring=require(_0x51db('0xc'));var Papa=require('papaparse');var htmlToText=require(_0x51db('0xd'));var juice=require(_0x51db('0xe'));var Redis=require(_0x51db('0xf'));var authService=require(_0x51db('0x10'));var qs=require(_0x51db('0x11'));var as=require(_0x51db('0x12'));var hardwareService=require(_0x51db('0x13'));var logger=require(_0x51db('0x14'))(_0x51db('0x15'));var utils=require(_0x51db('0x16'));var config=require(_0x51db('0x17'));var licenseUtil=require(_0x51db('0x18'));var db=require(_0x51db('0x19'))['db'];config[_0x51db('0x1a')]=_[_0x51db('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x51db('0x1c'))(new Redis(config['redis']));require(_0x51db('0x1d'))[_0x51db('0x1e')](socket);var jayson=require(_0x51db('0x1f'));var client=jayson[_0x51db('0x20')][_0x51db('0x21')]({'port':0x232b});function respondWithRpcPromise(_0xe2753a,_0x17757d,_0x103af7,_0x1fbcff){return new BPromise(function(_0x59e399,_0x96089c){var _0x53b150=_0x1fbcff||client;return _0x53b150[_0x51db('0x22')](_0xe2753a,_0x103af7)['then'](function(_0x2b54ff){logger[_0x51db('0x23')](_0x51db('0x24'),_0x17757d,_0x51db('0x25'));logger[_0x51db('0x26')](_0x51db('0x27'),_0x17757d,_0x51db('0x25'),JSON['stringify'](_0x2b54ff));if(_0x2b54ff['error']){if(_0x2b54ff['error'][_0x51db('0x28')]===0x1f4){logger[_0x51db('0x29')](_0x51db('0x24'),_0x17757d,_0x2b54ff['error']['message']);return _0x96089c(_0x2b54ff['error'][_0x51db('0x2a')]);}logger['error'](_0x51db('0x24'),_0x17757d,_0x2b54ff[_0x51db('0x29')][_0x51db('0x2a')]);return _0x59e399(_0x2b54ff[_0x51db('0x29')]['message']);}else{logger['info'](_0x51db('0x24'),_0x17757d,'request\x20sent');_0x59e399(_0x2b54ff[_0x51db('0x2b')][_0x51db('0x2a')]);}})[_0x51db('0x2c')](function(_0x50bf1c){logger['error'](_0x51db('0x24'),_0x17757d,_0x50bf1c);_0x96089c(_0x50bf1c);});});}function respondWithStatusCode(_0x2614c0,_0x245110){_0x245110=_0x245110||0xcc;return function(_0x5540ab){if(_0x5540ab){return _0x2614c0[_0x51db('0x2d')](_0x245110);}return _0x2614c0[_0x51db('0x2e')](_0x245110)[_0x51db('0x2f')]();};}function respondWithResult(_0x35f5a7,_0x31e368){_0x31e368=_0x31e368||0xc8;return function(_0x3ad143){if(_0x3ad143){return _0x35f5a7[_0x51db('0x2e')](_0x31e368)[_0x51db('0x30')](_0x3ad143);}};}function respondWithFilteredResult(_0xe7bd49,_0x396bce){return function(_0x39dd6f){if(_0x39dd6f){var _0xe025b5=_0x39dd6f[_0x51db('0x31')],_0x19677b=_0x396bce['offset'],_0x3364d0=_0x396bce[_0x51db('0x32')]+_0x396bce[_0x51db('0x33')],_0x181f08;if(_0x3364d0>=_0xe025b5){_0x3364d0=_0xe025b5;_0x181f08=0xc8;}else{_0x181f08=0xce;}_0xe7bd49[_0x51db('0x2e')](_0x181f08);return _0xe7bd49['set']('Content-Range',_0x19677b+'-'+_0x3364d0+'/'+_0xe025b5)[_0x51db('0x30')](_0x39dd6f);}return null;};}function patchUpdates(_0x1002ab){return function(_0x2e032b){try{jsonpatch[_0x51db('0x34')](_0x2e032b,_0x1002ab,!![]);}catch(_0x19b4a7){return BPromise[_0x51db('0x35')](_0x19b4a7);}return _0x2e032b[_0x51db('0x36')]();};}function saveUpdates(_0x5a11fb,_0x25c83d){return function(_0xe8a03){if(_0xe8a03){return _0xe8a03[_0x51db('0x37')](_0x5a11fb)[_0x51db('0x38')](function(_0x5a6ff1){return _0x5a6ff1;});}return null;};}function removeEntity(_0x8f5b68,_0x54d81a){return function(_0x416300){if(_0x416300){return _0x416300[_0x51db('0x39')]()['then'](function(){var _0x314c66=_0x416300[_0x51db('0x3a')]({'plain':!![]});var _0x2c5599='MailAccounts';return db['UserProfileResource'][_0x51db('0x39')]({'where':{'type':_0x2c5599,'resourceId':_0x314c66['id']}})['then'](function(){return _0x416300;});})[_0x51db('0x38')](function(){_0x8f5b68['status'](0xcc)[_0x51db('0x2f')]();});}};}function handleEntityNotFound(_0x4fec57,_0x48f50b){return function(_0x196853){if(!_0x196853){_0x4fec57[_0x51db('0x2d')](0x194);}return _0x196853;};}function handleError(_0x44ba23,_0x684c49){_0x684c49=_0x684c49||0x1f4;return function(_0x45549d){logger[_0x51db('0x29')](_0x45549d[_0x51db('0x3b')]);if(_0x45549d[_0x51db('0x3c')]){delete _0x45549d[_0x51db('0x3c')];}_0x44ba23['status'](_0x684c49)[_0x51db('0x3d')](_0x45549d);};}exports[_0x51db('0x3e')]=function(_0x96e4e4,_0x43fa3b){var _0x3f9628={'include':[{'model':db[_0x51db('0x3f')],'as':_0x51db('0x40')},{'model':db['MailServerOut'],'as':_0x51db('0x41')},{'model':db['Pause'],'as':_0x51db('0x42')}]},_0x202865={},_0x3d87e3={'count':0x0,'rows':[]};var _0x5351f0=_[_0x51db('0x43')](db[_0x51db('0x44')][_0x51db('0x45')],function(_0x549c2e){return{'name':_0x549c2e[_0x51db('0x46')],'type':_0x549c2e[_0x51db('0x47')][_0x51db('0x48')]};});_0x202865['model']=_[_0x51db('0x43')](_0x5351f0,'name');_0x202865[_0x51db('0x49')]=_['keys'](_0x96e4e4[_0x51db('0x49')]);_0x202865['filters']=_[_0x51db('0x4a')](_0x202865['model'],_0x202865[_0x51db('0x49')]);_0x3f9628[_0x51db('0x4b')]=_[_0x51db('0x4a')](_0x202865[_0x51db('0x4c')],qs[_0x51db('0x4d')](_0x96e4e4[_0x51db('0x49')][_0x51db('0x4d')]));_0x3f9628[_0x51db('0x4b')]=_0x3f9628['attributes']['length']?_0x3f9628[_0x51db('0x4b')]:_0x202865[_0x51db('0x4c')];if(!_0x96e4e4[_0x51db('0x49')]['hasOwnProperty'](_0x51db('0x4e'))){_0x3f9628[_0x51db('0x33')]=qs[_0x51db('0x33')](_0x96e4e4['query'][_0x51db('0x33')]);_0x3f9628[_0x51db('0x32')]=qs[_0x51db('0x32')](_0x96e4e4[_0x51db('0x49')][_0x51db('0x32')]);}_0x3f9628[_0x51db('0x4f')]=qs[_0x51db('0x50')](_0x96e4e4[_0x51db('0x49')][_0x51db('0x50')]);_0x3f9628['where']=qs['filters'](_[_0x51db('0x51')](_0x96e4e4[_0x51db('0x49')],_0x202865[_0x51db('0x52')]),_0x5351f0);if(_0x96e4e4[_0x51db('0x49')][_0x51db('0x53')]){_0x3f9628['where']=_[_0x51db('0x54')](_0x3f9628[_0x51db('0x55')],{'$or':_[_0x51db('0x43')](_0x5351f0,function(_0x504151){if(_0x504151[_0x51db('0x47')]!==_0x51db('0x56')){var _0x35b46e={};_0x35b46e[_0x504151['name']]={'$like':'%'+_0x96e4e4[_0x51db('0x49')][_0x51db('0x53')]+'%'};return _0x35b46e;}})});}_0x3f9628=_[_0x51db('0x54')]({},_0x3f9628,_0x96e4e4[_0x51db('0x57')]);var _0x59df2b={'where':_0x3f9628[_0x51db('0x55')]};return db['MailAccount']['count'](_0x59df2b)['then'](function(_0x4f9c80){_0x3d87e3[_0x51db('0x31')]=_0x4f9c80;if(_0x96e4e4['query'][_0x51db('0x58')]){_0x3f9628['include']=[{'all':!![]}];}return db['MailAccount'][_0x51db('0x59')](_0x3f9628);})[_0x51db('0x38')](function(_0x3b759f){_0x3d87e3['rows']=_0x3b759f;return _0x3d87e3;})['then'](respondWithFilteredResult(_0x43fa3b,_0x3f9628))[_0x51db('0x2c')](handleError(_0x43fa3b,null));};exports[_0x51db('0x5a')]=function(_0x4fa0e6,_0x48ec12){var _0x253a6a={'raw':![],'where':{'id':_0x4fa0e6[_0x51db('0x5b')]['id']},'include':[{'model':db[_0x51db('0x3f')],'as':_0x51db('0x40')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x51db('0x5c')],'as':_0x51db('0x42')}]},_0x473cdc={};_0x473cdc[_0x51db('0x4c')]=_[_0x51db('0x5d')](db[_0x51db('0x44')][_0x51db('0x45')]);_0x473cdc[_0x51db('0x49')]=_[_0x51db('0x5d')](_0x4fa0e6[_0x51db('0x49')]);_0x473cdc['filters']=_['intersection'](_0x473cdc[_0x51db('0x4c')],_0x473cdc[_0x51db('0x49')]);_0x253a6a['attributes']=_[_0x51db('0x4a')](_0x473cdc[_0x51db('0x4c')],qs['fields'](_0x4fa0e6[_0x51db('0x49')]['fields']));_0x253a6a[_0x51db('0x4b')]=_0x253a6a['attributes'][_0x51db('0x5e')]?_0x253a6a[_0x51db('0x4b')]:_0x473cdc['model'];if(_0x4fa0e6[_0x51db('0x49')][_0x51db('0x58')]){_0x253a6a[_0x51db('0x5f')]=[{'all':!![]}];}_0x253a6a=_[_0x51db('0x54')]({},_0x253a6a,_0x4fa0e6['options']);return db['MailAccount'][_0x51db('0x60')](_0x253a6a)[_0x51db('0x38')](handleEntityNotFound(_0x48ec12,null))[_0x51db('0x38')](respondWithResult(_0x48ec12,null))[_0x51db('0x2c')](handleError(_0x48ec12,null));};exports[_0x51db('0x37')]=function(_0x161c75,_0x284bf5){if(_0x161c75[_0x51db('0x61')]['id']){delete _0x161c75[_0x51db('0x61')]['id'];}return db[_0x51db('0x44')][_0x51db('0x60')]({'where':{'id':_0x161c75[_0x51db('0x5b')]['id']},'include':[{'model':db[_0x51db('0x3f')],'as':'Imap'},{'model':db[_0x51db('0x62')],'as':_0x51db('0x41')},{'model':db['Pause'],'as':_0x51db('0x42')}]})[_0x51db('0x38')](handleEntityNotFound(_0x284bf5,null))[_0x51db('0x38')](saveUpdates(_0x161c75['body'],null))[_0x51db('0x38')](function(_0x2102c5){if(_0x2102c5&&_0x161c75['body'][_0x51db('0x40')]){return db['MailServerIn'][_0x51db('0x37')](_0x161c75['body'][_0x51db('0x40')],{'where':{'MailAccountId':_0x2102c5['id']}})[_0x51db('0x38')](function(){return _0x2102c5;});}return _0x2102c5;})['then'](function(_0x3ab2af){if(_0x3ab2af&&_0x161c75[_0x51db('0x61')]['Smtp']){return db[_0x51db('0x62')]['update'](_0x161c75[_0x51db('0x61')][_0x51db('0x41')],{'where':{'MailAccountId':_0x3ab2af['id']}})['then'](function(){return _0x3ab2af;});}return _0x3ab2af;})[_0x51db('0x38')](respondWithResult(_0x284bf5,null))[_0x51db('0x2c')](handleError(_0x284bf5,null));};exports[_0x51db('0x63')]=function(_0x46d6c6,_0x5a26ca){return db[_0x51db('0x44')][_0x51db('0x63')]()[_0x51db('0x38')](respondWithResult(_0x5a26ca,null))[_0x51db('0x2c')](handleError(_0x5a26ca,null));};exports[_0x51db('0x64')]=function(_0x4f7718,_0x4a5e8a,_0x5aa85c){if(_0x4f7718[_0x51db('0x61')]['id']){delete _0x4f7718[_0x51db('0x61')]['id'];}return db[_0x51db('0x44')]['find']({'where':{'id':_0x4f7718[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x4a5e8a,null))['then'](function(_0x2b12de){if(_0x2b12de){_0x4f7718[_0x51db('0x61')][_0x51db('0x65')]=_0x2b12de['id'];return db['Disposition'][_0x51db('0x66')](_0x4f7718[_0x51db('0x61')]);}})[_0x51db('0x38')](respondWithResult(_0x4a5e8a,null))[_0x51db('0x2c')](handleError(_0x4a5e8a,null));};exports['getDispositions']=function(_0x24f2d0,_0x2e998e,_0x1cc871){var _0x470845={'raw':![],'where':{}};var _0x13d33d={};var _0x51f069={'count':0x0,'rows':[]};return db['MailAccount'][_0x51db('0x67')]({'where':{'id':_0x24f2d0[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x2e998e,null))[_0x51db('0x38')](function(_0x34e28b){if(_0x34e28b){_0x13d33d[_0x51db('0x4c')]=_['keys'](db['Disposition'][_0x51db('0x45')]);_0x13d33d[_0x51db('0x49')]=_['keys'](_0x24f2d0[_0x51db('0x49')]);_0x13d33d[_0x51db('0x52')]=_[_0x51db('0x4a')](_0x13d33d['model'],_0x13d33d[_0x51db('0x49')]);_0x470845[_0x51db('0x4b')]=_['intersection'](_0x13d33d[_0x51db('0x4c')],qs[_0x51db('0x4d')](_0x24f2d0[_0x51db('0x49')][_0x51db('0x4d')]));_0x470845['attributes']=_0x470845[_0x51db('0x4b')]['length']?_0x470845[_0x51db('0x4b')]:_0x13d33d['model'];if(!_0x24f2d0[_0x51db('0x49')][_0x51db('0x68')](_0x51db('0x4e'))){_0x470845[_0x51db('0x33')]=qs[_0x51db('0x33')](_0x24f2d0[_0x51db('0x49')][_0x51db('0x33')]);_0x470845['offset']=qs['offset'](_0x24f2d0[_0x51db('0x49')]['offset']);}_0x470845['order']=qs[_0x51db('0x50')](_0x24f2d0[_0x51db('0x49')]['sort']);_0x470845[_0x51db('0x55')]=qs[_0x51db('0x52')](_[_0x51db('0x51')](_0x24f2d0[_0x51db('0x49')],_0x13d33d[_0x51db('0x52')]));_0x470845[_0x51db('0x55')][_0x51db('0x65')]=_0x34e28b['id'];if(_0x24f2d0[_0x51db('0x49')][_0x51db('0x53')]){_0x470845['where']=_[_0x51db('0x54')](_0x470845[_0x51db('0x55')],{'$or':_['map'](_0x470845[_0x51db('0x4b')],function(_0x2b9098){var _0x489152={};_0x489152[_0x2b9098]={'$like':'%'+_0x24f2d0[_0x51db('0x49')][_0x51db('0x53')]+'%'};return _0x489152;})});}_0x470845=_[_0x51db('0x54')]({},_0x470845,_0x24f2d0[_0x51db('0x57')]);return db['Disposition'][_0x51db('0x31')]({'where':_0x470845[_0x51db('0x55')]})[_0x51db('0x38')](function(_0x307c65){_0x51f069['count']=_0x307c65;if(_0x24f2d0[_0x51db('0x49')][_0x51db('0x58')]){_0x470845[_0x51db('0x5f')]=[{'all':!![]}];}return db[_0x51db('0x69')][_0x51db('0x59')](_0x470845);})[_0x51db('0x38')](function(_0x3d97cf){_0x51f069['rows']=_0x3d97cf;return _0x51f069;});}})[_0x51db('0x38')](respondWithFilteredResult(_0x2e998e,_0x470845))[_0x51db('0x2c')](handleError(_0x2e998e,null));};exports['removeDispositions']=function(_0x27631d,_0x19e970,_0x41fcb4){return db[_0x51db('0x44')][_0x51db('0x60')]({'where':{'id':_0x27631d[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x19e970,null))[_0x51db('0x38')](function(_0x6c0a4a){if(_0x6c0a4a){return _0x6c0a4a[_0x51db('0x6a')](_0x27631d[_0x51db('0x49')][_0x51db('0x6b')]);}})[_0x51db('0x38')](respondWithStatusCode(_0x19e970,null))['catch'](handleError(_0x19e970,null));};exports[_0x51db('0x6c')]=function(_0x2ccf51,_0x59efa0,_0x8e2c95){if(_0x2ccf51[_0x51db('0x61')]['id']){delete _0x2ccf51[_0x51db('0x61')]['id'];}return db[_0x51db('0x44')][_0x51db('0x60')]({'where':{'id':_0x2ccf51[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x59efa0,null))[_0x51db('0x38')](function(_0x1029b8){if(_0x1029b8){_0x2ccf51[_0x51db('0x61')][_0x51db('0x65')]=_0x1029b8['id'];return db[_0x51db('0x6d')][_0x51db('0x66')](_0x2ccf51[_0x51db('0x61')]);}})[_0x51db('0x38')](respondWithResult(_0x59efa0,null))[_0x51db('0x2c')](handleError(_0x59efa0,null));};exports[_0x51db('0x6e')]=function(_0x2fa6ac,_0x22996b,_0x2455f4){var _0x480845={'raw':![],'where':{}};var _0x90af42={};var _0x4db672={'count':0x0,'rows':[]};return db[_0x51db('0x44')][_0x51db('0x67')]({'where':{'id':_0x2fa6ac['params']['id']}})['then'](handleEntityNotFound(_0x22996b,null))[_0x51db('0x38')](function(_0x4c20e3){if(_0x4c20e3){_0x90af42[_0x51db('0x4c')]=_[_0x51db('0x5d')](db[_0x51db('0x6d')][_0x51db('0x45')]);_0x90af42[_0x51db('0x49')]=_[_0x51db('0x5d')](_0x2fa6ac[_0x51db('0x49')]);_0x90af42[_0x51db('0x52')]=_[_0x51db('0x4a')](_0x90af42[_0x51db('0x4c')],_0x90af42[_0x51db('0x49')]);_0x480845['attributes']=_[_0x51db('0x4a')](_0x90af42[_0x51db('0x4c')],qs[_0x51db('0x4d')](_0x2fa6ac[_0x51db('0x49')][_0x51db('0x4d')]));_0x480845[_0x51db('0x4b')]=_0x480845[_0x51db('0x4b')][_0x51db('0x5e')]?_0x480845[_0x51db('0x4b')]:_0x90af42['model'];if(!_0x2fa6ac['query'][_0x51db('0x68')]('nolimit')){_0x480845[_0x51db('0x33')]=qs[_0x51db('0x33')](_0x2fa6ac[_0x51db('0x49')][_0x51db('0x33')]);_0x480845[_0x51db('0x32')]=qs['offset'](_0x2fa6ac[_0x51db('0x49')][_0x51db('0x32')]);}_0x480845[_0x51db('0x4f')]=qs[_0x51db('0x50')](_0x2fa6ac[_0x51db('0x49')][_0x51db('0x50')]);_0x480845['where']=qs[_0x51db('0x52')](_[_0x51db('0x51')](_0x2fa6ac[_0x51db('0x49')],_0x90af42[_0x51db('0x52')]));_0x480845['where'][_0x51db('0x65')]=_0x4c20e3['id'];if(_0x2fa6ac['query'][_0x51db('0x53')]){_0x480845[_0x51db('0x55')]=_[_0x51db('0x54')](_0x480845[_0x51db('0x55')],{'$or':_[_0x51db('0x43')](_0x480845['attributes'],function(_0x5006b2){var _0xfba979={};_0xfba979[_0x5006b2]={'$like':'%'+_0x2fa6ac[_0x51db('0x49')][_0x51db('0x53')]+'%'};return _0xfba979;})});}_0x480845=_[_0x51db('0x54')]({},_0x480845,_0x2fa6ac['options']);return db[_0x51db('0x6d')][_0x51db('0x31')]({'where':_0x480845['where']})[_0x51db('0x38')](function(_0x2a0436){_0x4db672[_0x51db('0x31')]=_0x2a0436;if(_0x2fa6ac[_0x51db('0x49')][_0x51db('0x58')]){_0x480845[_0x51db('0x5f')]=[{'all':!![]}];}return db[_0x51db('0x6d')][_0x51db('0x59')](_0x480845);})[_0x51db('0x38')](function(_0x134411){_0x4db672['rows']=_0x134411;return _0x4db672;});}})[_0x51db('0x38')](respondWithFilteredResult(_0x22996b,_0x480845))[_0x51db('0x2c')](handleError(_0x22996b,null));};exports[_0x51db('0x6f')]=function(_0x585919,_0x2241c7,_0x19fdfc){return db[_0x51db('0x44')][_0x51db('0x60')]({'where':{'id':_0x585919[_0x51db('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2241c7,null))['then'](function(_0x2c0af7){if(_0x2c0af7){return _0x2c0af7[_0x51db('0x6f')](_0x585919[_0x51db('0x49')][_0x51db('0x6b')]);}})[_0x51db('0x38')](respondWithStatusCode(_0x2241c7,null))[_0x51db('0x2c')](handleError(_0x2241c7,null));};exports[_0x51db('0x66')]=function(_0x4a6f39,_0x288019){var _0x3980a8={'name':_0x4a6f39[_0x51db('0x61')]['name'],'key':_0x4a6f39[_0x51db('0x61')][_0x51db('0x48')],'email':_0x4a6f39[_0x51db('0x61')][_0x51db('0x70')],'ListId':_0x4a6f39[_0x51db('0x61')][_0x51db('0x71')],'active':!_[_0x51db('0x72')](_0x4a6f39[_0x51db('0x61')]['active'])?_0x4a6f39[_0x51db('0x61')][_0x51db('0x73')]:!![],'description':_0x4a6f39[_0x51db('0x61')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4a6f39['body'][_0x51db('0x74')])){if(_0x4a6f39[_0x51db('0x61')][_0x51db('0x75')]){_0x3980a8[_0x51db('0x40')][_0x51db('0x76')]=_0x3980a8[_0x51db('0x41')][_0x51db('0x76')]=_0x4a6f39[_0x51db('0x61')][_0x51db('0x77')];_0x3980a8[_0x51db('0x40')]['password']=_0x3980a8['Smtp']['pass']=_0x4a6f39[_0x51db('0x61')][_0x51db('0x78')];}else{_0x3980a8['Imap'][_0x51db('0x79')]=_0x3980a8[_0x51db('0x41')]['authentication']=![];}_0x3980a8[_0x51db('0x40')][_0x51db('0x7a')]=_0x4a6f39[_0x51db('0x61')][_0x51db('0x40')][_0x51db('0x7a')];_0x3980a8['Imap'][_0x51db('0x7b')]=_0x4a6f39[_0x51db('0x61')][_0x51db('0x40')][_0x51db('0x7b')];_0x3980a8['Smtp'][_0x51db('0x7a')]=_0x4a6f39['body']['Smtp'][_0x51db('0x7a')];_0x3980a8['Smtp']['port']=_0x4a6f39[_0x51db('0x61')][_0x51db('0x41')][_0x51db('0x7b')];}else{_0x3980a8['Imap'][_0x51db('0x7c')]=_0x3980a8['Smtp']['service']=_0x4a6f39['body'][_0x51db('0x74')];_0x3980a8[_0x51db('0x40')]['user']=_0x3980a8[_0x51db('0x41')][_0x51db('0x76')]=_0x4a6f39[_0x51db('0x61')][_0x51db('0x77')];_0x3980a8[_0x51db('0x40')][_0x51db('0x7d')]=_0x3980a8[_0x51db('0x41')][_0x51db('0x7e')]=_0x4a6f39['body'][_0x51db('0x78')];}return db['MailAccount'][_0x51db('0x66')](_0x3980a8,{'include':[{'model':db[_0x51db('0x62')],'as':_0x51db('0x41')},{'model':db[_0x51db('0x3f')],'as':_0x51db('0x40')}]})[_0x51db('0x38')](function(_0x915720){var _0x33ad6d=_0x4a6f39['user'][_0x51db('0x3a')]({'plain':!![]});if(!_0x33ad6d)throw new Error(_0x51db('0x7f'));if(_0x33ad6d[_0x51db('0x80')]===_0x51db('0x76')){var _0x8343c1=_0x915720[_0x51db('0x3a')]({'plain':!![]});return db[_0x51db('0x81')][_0x51db('0x60')]({'where':{'name':_0x51db('0x82'),'userProfileId':_0x33ad6d[_0x51db('0x83')]},'raw':!![]})[_0x51db('0x38')](function(_0x2e7225){if(_0x2e7225&&_0x2e7225[_0x51db('0x84')]===0x0){return db[_0x51db('0x85')][_0x51db('0x66')]({'name':_0x8343c1[_0x51db('0x3c')],'resourceId':_0x8343c1['id'],'type':_0x2e7225[_0x51db('0x3c')],'sectionId':_0x2e7225['id']},{})[_0x51db('0x38')](function(){return _0x915720;});}else{return _0x915720;}})[_0x51db('0x2c')](function(_0x44b5bb){logger['error'](_0x51db('0x86'),_0x44b5bb);throw _0x44b5bb;});}return _0x915720;})['then'](respondWithResult(_0x288019,0xc9))['catch'](handleError(_0x288019,null));};exports[_0x51db('0x87')]=function(_0x908a81,_0x5b7196,_0x41d2a6){return db['MailAccount'][_0x51db('0x67')]({'where':{'id':_0x908a81[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x5b7196,null))[_0x51db('0x38')](function(_0xa90722){if(_0xa90722){return _0xa90722[_0x51db('0x87')]();}return null;})['then'](respondWithResult(_0x5b7196,null))[_0x51db('0x2c')](handleError(_0x5b7196,null));};exports[_0x51db('0x88')]=function(_0x4bf620,_0x3da49d,_0x22703c){if(_0x4bf620[_0x51db('0x61')]['id']){delete _0x4bf620[_0x51db('0x61')]['id'];}return db[_0x51db('0x44')]['find']({'where':{'id':_0x4bf620[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x3da49d,null))[_0x51db('0x38')](function(_0x1b7fa1){if(_0x1b7fa1){_0x4bf620['body'][_0x51db('0x65')]=_0x1b7fa1['id'];return db[_0x51db('0x3f')][_0x51db('0x66')](_0x4bf620[_0x51db('0x61')]);}})[_0x51db('0x38')](respondWithResult(_0x3da49d,null))[_0x51db('0x2c')](handleError(_0x3da49d,null));};exports[_0x51db('0x89')]=function(_0x791705,_0x4c239e,_0xfd4606){return db[_0x51db('0x44')][_0x51db('0x67')]({'where':{'id':_0x791705[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x4c239e,null))[_0x51db('0x38')](function(_0x28ed61){if(_0x28ed61){return _0x28ed61[_0x51db('0x8a')](null);}return null;})[_0x51db('0x38')](respondWithStatusCode(_0x4c239e,null))[_0x51db('0x2c')](handleError(_0x4c239e,null));};exports['getSmtp']=function(_0x258ed0,_0xceb74d,_0xbf14ac){return db[_0x51db('0x44')][_0x51db('0x67')]({'where':{'id':_0x258ed0[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0xceb74d,null))[_0x51db('0x38')](function(_0x5a886a){if(_0x5a886a){return _0x5a886a[_0x51db('0x8b')]();}return null;})[_0x51db('0x38')](respondWithResult(_0xceb74d,null))[_0x51db('0x2c')](handleError(_0xceb74d,null));};exports[_0x51db('0x8c')]=function(_0x5a3e09,_0x435aa5,_0x2c90ad){if(_0x5a3e09[_0x51db('0x61')]['id']){delete _0x5a3e09[_0x51db('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5a3e09[_0x51db('0x5b')]['id']}})['then'](handleEntityNotFound(_0x435aa5,null))[_0x51db('0x38')](function(_0x44ac77){if(_0x44ac77){_0x5a3e09[_0x51db('0x61')][_0x51db('0x65')]=_0x44ac77['id'];return db[_0x51db('0x62')]['create'](_0x5a3e09[_0x51db('0x61')]);}})[_0x51db('0x38')](respondWithResult(_0x435aa5,null))['catch'](handleError(_0x435aa5,null));};exports[_0x51db('0x8d')]=function(_0x149d55,_0x59bba0,_0x510ed3){return db[_0x51db('0x44')][_0x51db('0x67')]({'where':{'id':_0x149d55[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x59bba0,null))[_0x51db('0x38')](function(_0x398777){if(_0x398777){return _0x398777[_0x51db('0x8e')](null);}return null;})[_0x51db('0x38')](respondWithStatusCode(_0x59bba0,null))['catch'](handleError(_0x59bba0,null));};exports['addInteraction']=function(_0x46e7fc,_0x263194,_0x516466){return db[_0x51db('0x8f')][_0x51db('0x60')]({'where':{'id':_0x46e7fc[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x263194,null))[_0x51db('0x38')](function(_0x12fdf7){if(_0x12fdf7){return _0x12fdf7['addInteraction'](_0x46e7fc[_0x51db('0x61')]['ids'],_[_0x51db('0x90')](_0x46e7fc[_0x51db('0x61')],[_0x51db('0x6b'),'id'])||{});}})[_0x51db('0x38')](respondWithResult(_0x263194,null))[_0x51db('0x2c')](handleError(_0x263194,null));};exports[_0x51db('0x91')]=function(_0x5c2bab,_0x13a792,_0x2cfd1c){var _0x38f8f7={'raw':![],'where':{}};var _0xc12b45={};var _0x3a2282={'count':0x0,'rows':[]};return db[_0x51db('0x44')][_0x51db('0x67')]({'where':{'id':_0x5c2bab[_0x51db('0x5b')]['id']}})['then'](handleEntityNotFound(_0x13a792,null))[_0x51db('0x38')](function(_0xc247e7){if(_0xc247e7){_0xc12b45[_0x51db('0x4c')]=_[_0x51db('0x5d')](db[_0x51db('0x8f')][_0x51db('0x45')]);_0xc12b45['query']=_['keys'](_0x5c2bab[_0x51db('0x49')]);_0xc12b45['filters']=_[_0x51db('0x4a')](_0xc12b45['model'],_0xc12b45[_0x51db('0x49')]);_0x38f8f7[_0x51db('0x4b')]=_['intersection'](_0xc12b45[_0x51db('0x4c')],qs['fields'](_0x5c2bab[_0x51db('0x49')][_0x51db('0x4d')]));_0x38f8f7[_0x51db('0x4b')]=_0x38f8f7[_0x51db('0x4b')][_0x51db('0x5e')]?_0x38f8f7[_0x51db('0x4b')]:_0xc12b45['model'];if(!_0x5c2bab[_0x51db('0x49')]['hasOwnProperty'](_0x51db('0x4e'))){_0x38f8f7['limit']=qs[_0x51db('0x33')](_0x5c2bab[_0x51db('0x49')][_0x51db('0x33')]);_0x38f8f7['offset']=qs[_0x51db('0x32')](_0x5c2bab[_0x51db('0x49')][_0x51db('0x32')]);}_0x38f8f7['order']=qs[_0x51db('0x50')](_0x5c2bab[_0x51db('0x49')][_0x51db('0x50')]);_0x38f8f7['where']=qs[_0x51db('0x52')](_[_0x51db('0x51')](_0x5c2bab[_0x51db('0x49')],_0xc12b45[_0x51db('0x52')]));_0x38f8f7['where']['MailAccountId']=_0xc247e7['id'];if(_0x5c2bab[_0x51db('0x49')][_0x51db('0x53')]){_0x38f8f7[_0x51db('0x55')]=_[_0x51db('0x54')](_0x38f8f7[_0x51db('0x55')],{'$or':_['map'](_0x38f8f7[_0x51db('0x4b')],function(_0xf9a041){var _0x212fcd={};_0x212fcd[_0xf9a041]={'$like':'%'+_0x5c2bab['query'][_0x51db('0x53')]+'%'};return _0x212fcd;})});}_0x38f8f7=_['merge']({},_0x38f8f7,_0x5c2bab[_0x51db('0x57')]);return db['MailInteraction'][_0x51db('0x31')]({'where':_0x38f8f7[_0x51db('0x55')]})[_0x51db('0x38')](function(_0x9dddf4){_0x3a2282[_0x51db('0x31')]=_0x9dddf4;if(_0x5c2bab[_0x51db('0x49')][_0x51db('0x58')]){_0x38f8f7[_0x51db('0x5f')]=[{'model':db[_0x51db('0x92')],'as':'Contact','required':![]},{'model':db[_0x51db('0x93')],'as':_0x51db('0x94'),'attributes':[_0x51db('0x3c'),_0x51db('0x95'),_0x51db('0x96')],'required':![]},{'model':db['Tag'],'as':_0x51db('0x97'),'attributes':['id','name','color'],'where':_0x5c2bab['query'][_0x51db('0x98')]?{'id':_0x5c2bab[_0x51db('0x49')][_0x51db('0x98')]}:undefined,'required':_0x5c2bab[_0x51db('0x49')]['tag']?!![]:![]}];}return db[_0x51db('0x8f')][_0x51db('0x59')](_0x38f8f7);})[_0x51db('0x38')](function(_0x235196){_0x3a2282[_0x51db('0x99')]=_0x235196;return _0x3a2282;});}})[_0x51db('0x38')](respondWithFilteredResult(_0x13a792,_0x38f8f7))[_0x51db('0x2c')](handleError(_0x13a792,null));};exports['addApplications']=function(_0x5849fe,_0x26754f,_0x49412c){return db['MailAccount'][_0x51db('0x67')]({'where':{'id':_0x5849fe[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x26754f,null))['then'](function(_0x216244){if(_0x216244){return db[_0x51db('0x9a')][_0x51db('0x9b')](function(_0x450e49){return db[_0x51db('0x9c')][_0x51db('0x39')]({'where':{'MailAccountId':_0x5849fe[_0x51db('0x5b')]['id']},'transaction':_0x450e49})[_0x51db('0x38')](function(_0x282f84){var _0x4da940=_[_0x51db('0x43')](_0x5849fe[_0x51db('0x61')],function(_0x4bacf6){_0x4bacf6[_0x51db('0x65')]=_0x5849fe[_0x51db('0x5b')]['id'];return _0x4bacf6;});return db[_0x51db('0x9c')]['bulkCreate'](_0x4da940,{'transaction':_0x450e49});});})[_0x51db('0x38')](function(){return db['MailApplication'][_0x51db('0x9d')]({'where':{'MailAccountId':_0x5849fe[_0x51db('0x5b')]['id']},'order':_0x51db('0x9e')});});}})['then'](respondWithResult(_0x26754f,null))[_0x51db('0x2c')](handleError(_0x26754f,null));};exports['getApplications']=function(_0x4cc6f4,_0x45d8f9,_0x27be6e){var _0x2691d5={};var _0xb3e9af={};var _0x23900f;var _0x33d9a0;return db[_0x51db('0x44')]['findOne']({'where':{'id':_0x4cc6f4[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x45d8f9,null))['then'](function(_0x41c617){if(_0x41c617){_0x23900f=_0x41c617;_0xb3e9af['model']=_[_0x51db('0x5d')](db[_0x51db('0x9c')][_0x51db('0x45')]);_0xb3e9af[_0x51db('0x49')]=_[_0x51db('0x5d')](_0x4cc6f4[_0x51db('0x49')]);_0xb3e9af[_0x51db('0x52')]=_[_0x51db('0x4a')](_0xb3e9af[_0x51db('0x4c')],_0xb3e9af[_0x51db('0x49')]);_0x2691d5[_0x51db('0x4b')]=_[_0x51db('0x4a')](_0xb3e9af[_0x51db('0x4c')],qs[_0x51db('0x4d')](_0x4cc6f4[_0x51db('0x49')]['fields']));_0x2691d5[_0x51db('0x4b')]=_0x2691d5[_0x51db('0x4b')][_0x51db('0x5e')]?_0x2691d5[_0x51db('0x4b')]:_0xb3e9af[_0x51db('0x4c')];_0x2691d5[_0x51db('0x4f')]=qs[_0x51db('0x50')](_0x4cc6f4['query'][_0x51db('0x50')]);_0x2691d5[_0x51db('0x55')]=qs[_0x51db('0x52')](_[_0x51db('0x51')](_0x4cc6f4[_0x51db('0x49')],_0xb3e9af[_0x51db('0x52')]));if(_0x4cc6f4[_0x51db('0x49')][_0x51db('0x53')]){_0x2691d5[_0x51db('0x55')]=_[_0x51db('0x54')](_0x2691d5[_0x51db('0x55')],{'$or':_[_0x51db('0x43')](_0x2691d5['attributes'],function(_0x40a2f7){var _0x5ef53c={};_0x5ef53c[_0x40a2f7]={'$like':'%'+_0x4cc6f4['query'][_0x51db('0x53')]+'%'};return _0x5ef53c;})});}_0x2691d5=_[_0x51db('0x54')]({},_0x2691d5,_0x4cc6f4[_0x51db('0x57')]);return _0x23900f[_0x51db('0x9f')](_0x2691d5);}})[_0x51db('0x38')](function(_0xaf9330){if(_0xaf9330){_0x33d9a0=_0xaf9330[_0x51db('0x5e')];if(!_0x4cc6f4[_0x51db('0x49')]['hasOwnProperty'](_0x51db('0x4e'))){_0x2691d5[_0x51db('0x33')]=qs[_0x51db('0x33')](_0x4cc6f4[_0x51db('0x49')][_0x51db('0x33')]);_0x2691d5[_0x51db('0x32')]=qs[_0x51db('0x32')](_0x4cc6f4[_0x51db('0x49')][_0x51db('0x32')]);}return _0x23900f[_0x51db('0x9f')](_0x2691d5);}})[_0x51db('0x38')](function(_0x469822){if(_0x469822){return _0x469822?{'count':_0x33d9a0,'rows':_0x469822}:null;}})['then'](respondWithResult(_0x45d8f9,null))[_0x51db('0x2c')](handleError(_0x45d8f9,null));};exports[_0x51db('0xa0')]=function(_0x37e10c,_0x2317b9,_0x5a139c){var _0x4906b6={'raw':!![],'where':{}};var _0x23cd32={};var _0x57bc73={'count':0x0,'rows':[]};return db['MailAccount'][_0x51db('0x67')]({'where':{'id':_0x37e10c[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x2317b9,null))['then'](function(_0x5cfafb){if(_0x5cfafb){_0x23cd32[_0x51db('0x4c')]=_[_0x51db('0x5d')](db[_0x51db('0xa1')]['rawAttributes']);_0x23cd32[_0x51db('0x49')]=_['keys'](_0x37e10c[_0x51db('0x49')]);_0x23cd32[_0x51db('0x52')]=_[_0x51db('0x4a')](_0x23cd32[_0x51db('0x4c')],_0x23cd32[_0x51db('0x49')]);_0x4906b6['attributes']=_[_0x51db('0x4a')](_0x23cd32[_0x51db('0x4c')],qs[_0x51db('0x4d')](_0x37e10c['query'][_0x51db('0x4d')]));_0x4906b6['attributes']=_0x4906b6[_0x51db('0x4b')][_0x51db('0x5e')]?_0x4906b6[_0x51db('0x4b')]:_0x23cd32[_0x51db('0x4c')];if(!_0x37e10c[_0x51db('0x49')][_0x51db('0x68')](_0x51db('0x4e'))){_0x4906b6[_0x51db('0x33')]=qs[_0x51db('0x33')](_0x37e10c[_0x51db('0x49')][_0x51db('0x33')]);_0x4906b6['offset']=qs[_0x51db('0x32')](_0x37e10c[_0x51db('0x49')][_0x51db('0x32')]);}_0x4906b6['order']=qs[_0x51db('0x50')](_0x37e10c['query'][_0x51db('0x50')]);_0x4906b6[_0x51db('0x55')]=qs[_0x51db('0x52')](_[_0x51db('0x51')](_0x37e10c[_0x51db('0x49')],_0x23cd32[_0x51db('0x52')]));_0x4906b6['where'][_0x51db('0x65')]=_0x5cfafb['id'];if(_0x37e10c[_0x51db('0x49')]['filter']){_0x4906b6[_0x51db('0x55')]=_['merge'](_0x4906b6['where'],{'$or':_[_0x51db('0x43')](_0x4906b6[_0x51db('0x4b')],function(_0x37ab04){var _0x1ef18a={};_0x1ef18a[_0x37ab04]={'$like':'%'+_0x37e10c[_0x51db('0x49')][_0x51db('0x53')]+'%'};return _0x1ef18a;})});}if(_0x37e10c['query'][_0x51db('0xa2')]){var _0x4c0f95=_0x37e10c[_0x51db('0x49')]['$gte']['split'](',');var _0x4372bc={};_0x4372bc[_0x4c0f95[0x0]]={'$gte':moment(_0x4c0f95[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4906b6[_0x51db('0x55')]=_[_0x51db('0x54')](_0x4906b6[_0x51db('0x55')],_0x4372bc);}_0x4906b6=_[_0x51db('0x54')]({},_0x4906b6,_0x37e10c[_0x51db('0x57')]);return db[_0x51db('0xa1')][_0x51db('0x31')]({'where':_0x4906b6[_0x51db('0x55')]})[_0x51db('0x38')](function(_0x27d1f5){_0x57bc73[_0x51db('0x31')]=_0x27d1f5;if(_0x37e10c['query'][_0x51db('0x58')]){_0x4906b6[_0x51db('0x5f')]=[{'all':!![]}];}return db[_0x51db('0xa1')][_0x51db('0x59')](_0x4906b6);})[_0x51db('0x38')](function(_0x3e63d8){if(_0x37e10c['query'][_0x51db('0xa3')]===_0x51db('0xa4')){for(var _0x560085=0x0;_0x560085<_0x3e63d8[_0x51db('0x5e')];_0x560085++){_0x3e63d8[_0x560085][_0x51db('0x61')]=juice(_0x3e63d8[_0x560085][_0x51db('0x61')]);}}_0x57bc73['rows']=_0x3e63d8;return _0x57bc73;});}})[_0x51db('0x38')](respondWithFilteredResult(_0x2317b9,_0x4906b6))[_0x51db('0x2c')](handleError(_0x2317b9,null));};exports['send']=function(_0x309e6f,_0x249f20,_0x2c5a82){var _0x157477,_0x13eaed={},_0x357ede;if(_0x309e6f['body']['to']){_0x357ede=_0x309e6f[_0x51db('0x61')]['to'][_0x51db('0xa5')](',')[0x0];}return db[_0x51db('0x44')]['find']({'where':{'id':_0x309e6f[_0x51db('0x5b')]['id']},'include':[{'model':db[_0x51db('0xa6')],'as':'List','include':[{'model':db[_0x51db('0x92')],'as':_0x51db('0xa7'),'where':{'email':_0x357ede},'limit':0x1,'order':[[_0x51db('0xa8'),'DESC']]}]},{'model':db[_0x51db('0x62')],'as':_0x51db('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x249f20,null))[_0x51db('0x38')](function(_0x2b7bf9){if(_0x2b7bf9){_0x157477=_0x2b7bf9;if(_0x2b7bf9['Smtp']){if(_[_0x51db('0x72')](_0x309e6f['body']['from'])){_0x309e6f[_0x51db('0x61')][_0x51db('0xa9')]=util[_0x51db('0xaa')]('%s\x20<%s>',_0x2b7bf9[_0x51db('0x3c')],_0x2b7bf9[_0x51db('0x70')]||_0x2b7bf9[_0x51db('0x41')][_0x51db('0x76')]);}if(_0x309e6f[_0x51db('0x61')]['attachments']&&_0x309e6f['body']['attachments']['length']){for(var _0x331013=0x0;_0x331013<_0x309e6f['body'][_0x51db('0xab')][_0x51db('0x5e')];_0x331013+=0x1){_0x309e6f['body'][_0x51db('0xab')][_0x331013]={'filename':_0x309e6f[_0x51db('0x61')][_0x51db('0xab')][_0x331013][_0x51db('0x3c')],'path':path[_0x51db('0xac')](config[_0x51db('0xad')],_0x51db('0xae'),_0x309e6f['body'][_0x51db('0xab')][_0x331013]['basename'])};}}var _0x3f3a94={'tls':{'rejectUnauthorized':![]}};if(_[_0x51db('0x72')](_0x2b7bf9[_0x51db('0x41')][_0x51db('0x7c')])){if(_0x2b7bf9[_0x51db('0x41')]['authentication']){_0x3f3a94['auth']={'user':_0x2b7bf9[_0x51db('0x41')][_0x51db('0x76')],'pass':_0x2b7bf9[_0x51db('0x41')][_0x51db('0x7e')]};}_0x3f3a94[_0x51db('0x7a')]=_0x2b7bf9[_0x51db('0x41')][_0x51db('0x7a')];_0x3f3a94[_0x51db('0x7b')]=_0x2b7bf9[_0x51db('0x41')]['port'];_0x3f3a94[_0x51db('0xaf')]=_0x2b7bf9[_0x51db('0x41')][_0x51db('0xaf')];}else{_0x3f3a94[_0x51db('0x7c')]=_0x2b7bf9[_0x51db('0x41')]['service'];_0x3f3a94[_0x51db('0xb0')]={'user':_0x2b7bf9[_0x51db('0x41')][_0x51db('0x76')],'pass':_0x2b7bf9[_0x51db('0x41')]['pass']};}return respondWithRpcPromise(_0x51db('0xb1'),_0x51db('0xb2'),{'account':_0x3f3a94,'message':_0x309e6f[_0x51db('0x61')]});}else{throw new Error(_0x51db('0xb3'));}}})[_0x51db('0x38')](function(_0x10d4f8){if(_0x10d4f8){_0x13eaed=_0x10d4f8;if(_0x157477[_0x51db('0xb4')]){if(_0x157477[_0x51db('0xb4')]['Contacts']['length']){return _0x157477[_0x51db('0xb4')][_0x51db('0xa7')][0x0];}else{return db['CmContact'][_0x51db('0x66')](_[_0x51db('0x1b')](_0x309e6f['body'],{'firstName':_0x309e6f['body']['to'],'email':_0x309e6f[_0x51db('0x61')]['to'],'phone':_0x309e6f[_0x51db('0x61')]['to'],'ListId':_0x157477[_0x51db('0x71')]}));}}else{throw new Error(_0x51db('0xb3'));}}})[_0x51db('0x38')](function(_0x4728f4){if(_0x4728f4){var _0x5c5089={'UserId':_0x309e6f[_0x51db('0x76')]['id'],'ContactId':_0x4728f4['id'],'MailAccountId':_0x157477['id'],'inReplyTo':_0x13eaed['messageId'],'to':_0x309e6f[_0x51db('0x61')][_0x51db('0xa9')],'cc':_0x309e6f[_0x51db('0x61')]['cc'],'subject':_0x309e6f[_0x51db('0x61')][_0x51db('0xb5')],'attach':_0x309e6f[_0x51db('0x61')][_0x51db('0xb6')],'firstMsgDirection':_0x51db('0xb7'),'lastMsgAt':moment()['format'](_0x51db('0xb8')),'lastMsgDirection':_0x51db('0xb7'),'lastMsgBody':_0x309e6f[_0x51db('0x61')]['body'],'Messages':[_[_0x51db('0x54')](_0x309e6f[_0x51db('0x61')],{'messageId':_0x13eaed[_0x51db('0xb9')],'sentAt':moment()[_0x51db('0xaa')](_0x51db('0xb8')),'read':!![],'MailAccountId':_0x157477['id'],'UserId':_0x309e6f[_0x51db('0x76')]['id'],'ContactId':_0x4728f4['id']})]};if(_0x309e6f['body'][_0x51db('0xba')]){_0x5c5089=_[_0x51db('0x54')](_0x5c5089,_0x309e6f[_0x51db('0x61')][_0x51db('0xba')]);}return db['MailInteraction'][_0x51db('0x66')](_0x5c5089,{'include':[{'model':db['MailMessage'],'as':_0x51db('0xbb')}]});}})[_0x51db('0x38')](respondWithResult(_0x249f20,null))[_0x51db('0x2c')](handleError(_0x249f20,null));};exports['verifySmtp']=function(_0x280859,_0x34e8f6,_0x4fa16d){return db[_0x51db('0x44')][_0x51db('0x60')]({'where':{'id':_0x280859[_0x51db('0x5b')]['id']},'include':[{'model':db[_0x51db('0x62')],'as':'Smtp','raw':!![]}]})[_0x51db('0x38')](handleEntityNotFound(_0x34e8f6,null))[_0x51db('0x38')](function(_0x54d0b8){if(_0x54d0b8&&_0x54d0b8[_0x51db('0x41')]){var _0x5191c0={'id':_0x54d0b8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x54d0b8[_0x51db('0x41')][_0x51db('0x7c')]){_0x5191c0[_0x51db('0x7c')]=_0x54d0b8[_0x51db('0x41')]['service'];}else{_0x5191c0[_0x51db('0x7a')]=_0x54d0b8[_0x51db('0x41')][_0x51db('0x7a')];_0x5191c0[_0x51db('0x7b')]=_0x54d0b8[_0x51db('0x41')][_0x51db('0x7b')];_0x5191c0[_0x51db('0xaf')]=_0x54d0b8[_0x51db('0x41')][_0x51db('0xaf')];}if(_0x54d0b8[_0x51db('0x41')][_0x51db('0x79')]){_0x5191c0['auth']={'user':_0x54d0b8['Smtp'][_0x51db('0x76')],'pass':_0x54d0b8[_0x51db('0x41')][_0x51db('0x7e')]};}return respondWithRpcPromise(_0x51db('0xbc'),_0x51db('0xbd'),{'account':_0x5191c0});}})[_0x51db('0x38')](respondWithResult(_0x34e8f6,null))[_0x51db('0x2c')](handleError(_0x34e8f6,null));};exports['destroy']=function(_0x1f61dd,_0x5d95cb){return db[_0x51db('0x44')][_0x51db('0x60')]({'where':{'id':_0x1f61dd[_0x51db('0x5b')]['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x5d95cb,null))[_0x51db('0x38')](function(_0x46846f){if(_0x46846f&&_0x46846f[_0x51db('0x7c')]){throw new db[(_0x51db('0xbe'))][(_0x51db('0xbf'))](_0x51db('0xc0'));}return _0x46846f;})[_0x51db('0x38')](removeEntity(_0x5d95cb,null))['catch'](handleError(_0x5d95cb,null));};exports[_0x51db('0xc1')]=function(_0x59402b,_0x247680,_0x12c532){return db[_0x51db('0x44')]['find']({'where':{'id':_0x59402b['params']['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x247680,null))[_0x51db('0x38')](function(_0x377ba9){if(_0x377ba9){return _0x377ba9['addAgents'](_0x59402b[_0x51db('0x61')][_0x51db('0x6b')],_['omit'](_0x59402b['body'],[_0x51db('0x6b'),'id'])||{})['spread'](function(_0x194fec){for(var _0x27e495=0x0;_0x27e495<_0x59402b[_0x51db('0x61')][_0x51db('0x6b')][_0x51db('0x5e')];_0x27e495+=0x1){socket[_0x51db('0xc2')](_0x51db('0xc3'),{'UserId':_0x59402b[_0x51db('0x61')]['ids'][_0x27e495],'MailAccountId':_0x59402b['params']['id']});}return _0x194fec;});}})[_0x51db('0x38')](respondWithResult(_0x247680,null))[_0x51db('0x2c')](handleError(_0x247680,null));};exports[_0x51db('0xc4')]=function(_0x353652,_0x595fce,_0x435a1d){return db['MailAccount'][_0x51db('0x60')]({'where':{'id':_0x353652[_0x51db('0x5b')]['id']}})['then'](handleEntityNotFound(_0x595fce,null))[_0x51db('0x38')](function(_0x1350c2){if(_0x1350c2){return _0x1350c2['removeAgents'](_0x353652[_0x51db('0x49')][_0x51db('0x6b')])[_0x51db('0x38')](function(){if(_[_0x51db('0xc5')](_0x353652[_0x51db('0x49')][_0x51db('0x6b')])){for(var _0x30e49c=0x0;_0x30e49c<_0x353652[_0x51db('0x49')][_0x51db('0x6b')]['length'];_0x30e49c+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x353652['query'][_0x51db('0x6b')][_0x30e49c]),'MailAccountId':Number(_0x353652[_0x51db('0x5b')]['id'])});}}else{socket['emit'](_0x51db('0xc6'),{'UserId':Number(_0x353652[_0x51db('0x49')][_0x51db('0x6b')]),'MailAccountId':Number(_0x353652[_0x51db('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x595fce,null))[_0x51db('0x2c')](handleError(_0x595fce,null));};exports[_0x51db('0xc7')]=function(_0xe46b36,_0x2680ca,_0x34a84e){var _0x4d44b1={};var _0x3bd04e={};var _0x3280bc;var _0x2c9bc0;return db[_0x51db('0x44')][_0x51db('0x67')]({'where':{'id':_0xe46b36['params']['id']}})[_0x51db('0x38')](handleEntityNotFound(_0x2680ca,null))[_0x51db('0x38')](function(_0x3af642){if(_0x3af642){_0x3280bc=_0x3af642;_0x3bd04e[_0x51db('0x4c')]=_['keys'](db['User'][_0x51db('0x45')]);_0x3bd04e['query']=_['keys'](_0xe46b36['query']);_0x3bd04e['filters']=_[_0x51db('0x4a')](_0x3bd04e[_0x51db('0x4c')],_0x3bd04e[_0x51db('0x49')]);_0x4d44b1[_0x51db('0x4b')]=_[_0x51db('0x4a')](_0x3bd04e['model'],qs[_0x51db('0x4d')](_0xe46b36[_0x51db('0x49')]['fields']));_0x4d44b1[_0x51db('0x4b')]=_0x4d44b1['attributes']['length']?_0x4d44b1[_0x51db('0x4b')]:_0x3bd04e[_0x51db('0x4c')];_0x4d44b1[_0x51db('0x4f')]=qs[_0x51db('0x50')](_0xe46b36[_0x51db('0x49')][_0x51db('0x50')]);_0x4d44b1[_0x51db('0x55')]=qs[_0x51db('0x52')](_[_0x51db('0x51')](_0xe46b36[_0x51db('0x49')],_0x3bd04e[_0x51db('0x52')]));if(_0xe46b36['query'][_0x51db('0x53')]){_0x4d44b1[_0x51db('0x55')]=_['merge'](_0x4d44b1[_0x51db('0x55')],{'$or':_['map'](_0x4d44b1[_0x51db('0x4b')],function(_0x5d8569){var _0x49b74c={};_0x49b74c[_0x5d8569]={'$like':'%'+_0xe46b36[_0x51db('0x49')]['filter']+'%'};return _0x49b74c;})});}_0x4d44b1=_['merge']({},_0x4d44b1,_0xe46b36['options']);return _0x3280bc[_0x51db('0xc7')](_0x4d44b1);}})[_0x51db('0x38')](function(_0x1295b5){if(_0x1295b5){_0x2c9bc0=_0x1295b5[_0x51db('0x5e')];if(!_0xe46b36[_0x51db('0x49')]['hasOwnProperty'](_0x51db('0x4e'))){_0x4d44b1[_0x51db('0x33')]=qs['limit'](_0xe46b36['query'][_0x51db('0x33')]);_0x4d44b1[_0x51db('0x32')]=qs[_0x51db('0x32')](_0xe46b36['query'][_0x51db('0x32')]);}return _0x3280bc[_0x51db('0xc7')](_0x4d44b1);}})[_0x51db('0x38')](function(_0x5a3ce1){if(_0x5a3ce1){return _0x5a3ce1?{'count':_0x2c9bc0,'rows':_0x5a3ce1}:null;}})[_0x51db('0x38')](respondWithResult(_0x2680ca,null))['catch'](handleError(_0x2680ca,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4ee2f43..1bc606e 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 _0x8bf3=['MailAccount','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x8bf3,0x130));var _0x38bf=function(_0x322da7,_0x249a61){_0x322da7=_0x322da7-0x0;var _0x268f47=_0x8bf3[_0x322da7];return _0x268f47;};'use strict';var EventEmitter=require(_0x38bf('0x0'));var MailAccount=require(_0x38bf('0x1'))['db'][_0x38bf('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x38bf('0x3')](0x0);var events={'afterCreate':_0x38bf('0x4'),'afterUpdate':_0x38bf('0x5'),'afterDestroy':_0x38bf('0x6')};function emitEvent(_0x364dda){return function(_0xbf6785,_0x47db9b,_0x2e1579){MailAccountEvents[_0x38bf('0x7')](_0x364dda+':'+_0xbf6785['id'],_0xbf6785);MailAccountEvents[_0x38bf('0x7')](_0x364dda,_0xbf6785);_0x2e1579(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x38bf('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x8446=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x8446,0x172));var _0x6844=function(_0x3d6745,_0x591e49){_0x3d6745=_0x3d6745-0x0;var _0x1a28e1=_0x8446[_0x3d6745];return _0x1a28e1;};'use strict';var EventEmitter=require(_0x6844('0x0'));var MailAccount=require(_0x6844('0x1'))['db'][_0x6844('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6844('0x3')](0x0);var events={'afterCreate':_0x6844('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b9986){return function(_0x20f090,_0x47b7d0,_0x43f48a){MailAccountEvents[_0x6844('0x5')](_0x5b9986+':'+_0x20f090['id'],_0x20f090);MailAccountEvents[_0x6844('0x5')](_0x5b9986,_0x20f090);_0x43f48a(null);};}for(var e in events){if(events[_0x6844('0x6')](e)){var event=events[e];MailAccount[_0x6844('0x7')](e,emitEvent(event));}}module[_0x6844('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0cc3d67..252b4c9 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 _0xa244=['mail_accounts','lodash','moment','bluebird','request-promise','path','rimraf','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa244,0xd2));var _0x4a24=function(_0x50dc38,_0x3c98d2){_0x50dc38=_0x50dc38-0x0;var _0x5140ed=_0xa244[_0x50dc38];return _0x5140ed;};'use strict';var _=require(_0x4a24('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4a24('0x1'));var BPromise=require(_0x4a24('0x2'));var rp=require(_0x4a24('0x3'));var fs=require('fs');var path=require(_0x4a24('0x4'));var rimraf=require(_0x4a24('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a24('0x6'));module[_0x4a24('0x7')]=function(_0x4fd8e5,_0x45b9c0){return _0x4fd8e5[_0x4a24('0x8')](_0x4a24('0x9'),attributes,{'tableName':_0x4a24('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93f0=['api','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x93f0,0x14d));var _0x093f=function(_0x589421,_0x44682b){_0x589421=_0x589421-0x0;var _0x5350ef=_0x93f0[_0x589421];return _0x5350ef;};'use strict';var _=require(_0x093f('0x0'));var util=require(_0x093f('0x1'));var logger=require(_0x093f('0x2'))(_0x093f('0x3'));var moment=require('moment');var BPromise=require(_0x093f('0x4'));var rp=require(_0x093f('0x5'));var fs=require('fs');var path=require(_0x093f('0x6'));var rimraf=require('rimraf');var config=require(_0x093f('0x7'));var attributes=require(_0x093f('0x8'));module[_0x093f('0x9')]=function(_0x2690b6,_0x7cdfdf){return _0x2690b6['define'](_0x093f('0xa'),attributes,{'tableName':_0x093f('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 661a5df..042ac1e 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 _0x0c07=['push','*,*,*,*','length','create','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','Contact\x20not\x20found','update','format','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','Attachment','Attachments','UserId','name','agent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','redis','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailAccount','MailAccount','findAll','options','where','limit','map','model','attributes','include','then','debug','stringify','catch','ShowMailAccount','find','raw','NotifyMailAccount','mail','difference','keys','rawAttributes','createdAt','CompanyId','ListId','body','isNil','from','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority','autoclose'];(function(_0x19e120,_0x3fc34a){var _0x6e9933=function(_0x4982bf){while(--_0x4982bf){_0x19e120['push'](_0x19e120['shift']());}};_0x6e9933(++_0x3fc34a);}(_0x0c07,0x199));var _0x70c0=function(_0xf39273,_0x15899a){_0xf39273=_0xf39273-0x0;var _0x27cc53=_0x0c07[_0xf39273];return _0x27cc53;};'use strict';var _=require('lodash');var util=require(_0x70c0('0x0'));var moment=require(_0x70c0('0x1'));var BPromise=require(_0x70c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70c0('0x3'));var db=require(_0x70c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x70c0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x70c0('0x6')][_0x70c0('0x7')]({'port':0x232c});config[_0x70c0('0x8')]=_['defaults'](config[_0x70c0('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x70c0('0x9'))(new Redis(config['redis']));require(_0x70c0('0xa'))['register'](socket);function respondWithRpcPromise(_0x551482,_0xb62669,_0x13e9ef){return new BPromise(function(_0x39a500,_0x5dab56){return client[_0x70c0('0xb')](_0x551482,_0x13e9ef)['then'](function(_0x30bc49){logger[_0x70c0('0xc')](_0x70c0('0xd'),_0xb62669,_0x70c0('0xe'));logger['debug'](_0x70c0('0xf'),_0xb62669,'request\x20sent',JSON['stringify'](_0x30bc49));if(_0x30bc49[_0x70c0('0x10')]){if(_0x30bc49[_0x70c0('0x10')][_0x70c0('0x11')]===0x1f4){logger[_0x70c0('0x10')](_0x70c0('0xd'),_0xb62669,_0x30bc49['error'][_0x70c0('0x12')]);return _0x5dab56(_0x30bc49['error']['message']);}logger[_0x70c0('0x10')]('MailAccount,\x20%s,\x20%s',_0xb62669,_0x30bc49[_0x70c0('0x10')][_0x70c0('0x12')]);return _0x39a500(_0x30bc49['error'][_0x70c0('0x12')]);}else{logger[_0x70c0('0xc')](_0x70c0('0xd'),_0xb62669,_0x70c0('0xe'));_0x39a500(_0x30bc49[_0x70c0('0x13')]['message']);}})['catch'](function(_0x38e191){logger[_0x70c0('0x10')](_0x70c0('0xd'),_0xb62669,_0x38e191);_0x5dab56(_0x38e191);});});}exports[_0x70c0('0x14')]=function(_0x2203fe){var _0x482076=this;return new Promise(function(_0x56ea96,_0x42725b){return db[_0x70c0('0x15')][_0x70c0('0x16')]({'raw':_0x2203fe[_0x70c0('0x17')]?_0x2203fe[_0x70c0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2203fe[_0x70c0('0x17')]?_0x2203fe['options'][_0x70c0('0x18')]||null:null,'attributes':_0x2203fe[_0x70c0('0x17')]?_0x2203fe['options']['attributes']||null:null,'limit':_0x2203fe[_0x70c0('0x17')]?_0x2203fe['options'][_0x70c0('0x19')]||null:null,'include':_0x2203fe[_0x70c0('0x17')]?_0x2203fe[_0x70c0('0x17')]['include']?_[_0x70c0('0x1a')](_0x2203fe[_0x70c0('0x17')]['include'],function(_0xf29132){return{'model':db[_0xf29132[_0x70c0('0x1b')]],'as':_0xf29132['as'],'attributes':_0xf29132[_0x70c0('0x1c')],'include':_0xf29132[_0x70c0('0x1d')]?_[_0x70c0('0x1a')](_0xf29132[_0x70c0('0x1d')],function(_0x19a4ed){return{'model':db[_0x19a4ed[_0x70c0('0x1b')]],'as':_0x19a4ed['as'],'attributes':_0x19a4ed['attributes'],'include':_0x19a4ed[_0x70c0('0x1d')]?_[_0x70c0('0x1a')](_0x19a4ed[_0x70c0('0x1d')],function(_0x102362){return{'model':db[_0x102362[_0x70c0('0x1b')]],'as':_0x102362['as'],'attributes':_0x102362['attributes']};}):[]};}):[]};}):[]:[]})[_0x70c0('0x1e')](function(_0x36e89c){logger[_0x70c0('0xc')]('GetMailAccount',_0x2203fe);logger[_0x70c0('0x1f')](_0x70c0('0x14'),_0x2203fe,JSON[_0x70c0('0x20')](_0x36e89c));_0x56ea96(_0x36e89c);})[_0x70c0('0x21')](function(_0x307523){logger[_0x70c0('0x10')](_0x70c0('0x14'),_0x307523[_0x70c0('0x12')],_0x2203fe);_0x42725b(_0x482076['error'](0x1f4,_0x307523[_0x70c0('0x12')]));});});};exports[_0x70c0('0x22')]=function(_0x211d72){var _0x420ecd=this;return new Promise(function(_0x512739,_0x1212be){return db['MailAccount'][_0x70c0('0x23')]({'raw':_0x211d72[_0x70c0('0x17')]?_0x211d72[_0x70c0('0x17')][_0x70c0('0x24')]===undefined?!![]:![]:!![],'where':_0x211d72[_0x70c0('0x17')]?_0x211d72[_0x70c0('0x17')]['where']||null:null,'attributes':_0x211d72[_0x70c0('0x17')]?_0x211d72['options'][_0x70c0('0x1c')]||null:null,'include':_0x211d72[_0x70c0('0x17')]?_0x211d72[_0x70c0('0x17')][_0x70c0('0x1d')]?_[_0x70c0('0x1a')](_0x211d72[_0x70c0('0x17')][_0x70c0('0x1d')],function(_0x20cb5e){return{'model':db[_0x20cb5e['model']],'as':_0x20cb5e['as'],'attributes':_0x20cb5e['attributes'],'include':_0x20cb5e[_0x70c0('0x1d')]?_['map'](_0x20cb5e['include'],function(_0x539cd2){return{'model':db[_0x539cd2[_0x70c0('0x1b')]],'as':_0x539cd2['as'],'attributes':_0x539cd2[_0x70c0('0x1c')],'include':_0x539cd2[_0x70c0('0x1d')]?_[_0x70c0('0x1a')](_0x539cd2[_0x70c0('0x1d')],function(_0x1dbdba){return{'model':db[_0x1dbdba[_0x70c0('0x1b')]],'as':_0x1dbdba['as'],'attributes':_0x1dbdba['attributes']};}):[]};}):[]};}):[]:[]})[_0x70c0('0x1e')](function(_0x4baed3){logger[_0x70c0('0xc')](_0x70c0('0x22'),_0x211d72);logger[_0x70c0('0x1f')](_0x70c0('0x22'),_0x211d72,JSON[_0x70c0('0x20')](_0x4baed3));_0x512739(_0x4baed3);})[_0x70c0('0x21')](function(_0x3b8b93){logger[_0x70c0('0x10')]('ShowMailAccount',_0x3b8b93[_0x70c0('0x12')],_0x211d72);_0x1212be(_0x420ecd['error'](0x1f4,_0x3b8b93[_0x70c0('0x12')]));});});};exports[_0x70c0('0x25')]=function(_0x148102){var _0xb1e84b=this;return new Promise(function(_0x4fbf17,_0x6a8062){var _0x1f747d={'body':_0x148102['body'],'channel':_0x70c0('0x26')};var _0x4baf9d=_[_0x70c0('0x27')](_[_0x70c0('0x28')](db['CmContact'][_0x70c0('0x29')]),[_0x70c0('0x2a'),'updatedAt',_0x70c0('0x2b'),_0x70c0('0x2c')]);var _0xa11100=![];if(_0x148102[_0x70c0('0x2d')]['id']){delete _0x148102['body']['id'];}if(_[_0x70c0('0x2e')](_0x148102[_0x70c0('0x2d')][_0x70c0('0x2f')])){return _0x6a8062(_0xb1e84b[_0x70c0('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x70c0('0x2e')](_0x148102[_0x70c0('0x2d')][_0x70c0('0x2d')])||_0x148102['body']['body']===''){return _0x6a8062(_0xb1e84b[_0x70c0('0x10')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x70c0('0x2e')](_0x148102[_0x70c0('0x2d')][_0x70c0('0x30')])){return _0x6a8062(_0xb1e84b[_0x70c0('0x10')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4baf9d));}if(!_['includes'](_0x4baf9d,_0x148102['body'][_0x70c0('0x30')])){return _0x6a8062(_0xb1e84b[_0x70c0('0x10')](0x1f4,_0x70c0('0x31')+_0x4baf9d));}var _0x31fc0e={};_0x31fc0e[_0x148102[_0x70c0('0x2d')]['mapKey']]=_0x148102[_0x70c0('0x2d')]['from'];return db['MailAccount'][_0x70c0('0x23')]({'where':{'id':_0x148102[_0x70c0('0x32')]['id']},'include':[{'model':db[_0x70c0('0x33')],'as':_0x70c0('0x34'),'include':[{'model':db[_0x70c0('0x35')],'as':_0x70c0('0x36'),'where':_0x31fc0e,'limit':0x1,'order':[['updatedAt',_0x70c0('0x37')]]}]},{'model':db[_0x70c0('0x38')],'as':_0x70c0('0x39')},{'model':db[_0x70c0('0x3a')],'as':_0x70c0('0x3b')}]})['then'](function(_0x400166){if(_0x400166&&_0x400166[_0x70c0('0x34')]){var _0x39dd9d=_0x400166[_0x70c0('0x3c')]({'plain':!![]});_0x1f747d[_0x70c0('0x32')]=_[_0x70c0('0x3d')](_0x39dd9d,[_0x70c0('0x39'),_0x70c0('0x34')]);_0x1f747d[_0x70c0('0x3e')]=_0x39dd9d[_0x70c0('0x39')];_0x1f747d['list']=_0x39dd9d['List'];_0x1f747d[_0x70c0('0x3e')]=_[_0x70c0('0x3f')](_0x1f747d[_0x70c0('0x3e')],[_0x70c0('0x40')],['asc']);if(_0x1f747d[_0x70c0('0x32')]&&_0x1f747d[_0x70c0('0x32')][_0x70c0('0x41')]){_0x1f747d[_0x70c0('0x3e')][_0x70c0('0x42')]({'id':0x0,'priority':_0x1f747d[_0x70c0('0x3e')]['length']+0x1,'app':'close','appdata':'autoclose','interval':_0x70c0('0x43')});}if(_0x1f747d['account'][_0x70c0('0x39')]){delete _0x1f747d[_0x70c0('0x32')][_0x70c0('0x39')];}if(_0x1f747d[_0x70c0('0x32')][_0x70c0('0x34')]){delete _0x1f747d[_0x70c0('0x32')]['List'];}if(_0x39dd9d[_0x70c0('0x34')][_0x70c0('0x36')][_0x70c0('0x44')]){return _0x39dd9d[_0x70c0('0x34')][_0x70c0('0x36')][0x0];}var _0x367f5a=_['defaults'](_0x148102[_0x70c0('0x2d')],{'firstName':_0x148102[_0x70c0('0x2d')][_0x70c0('0x2f')],'ListId':_0x39dd9d['ListId']});_0x367f5a[_0x148102[_0x70c0('0x2d')][_0x70c0('0x30')]]=_0x148102[_0x70c0('0x2d')][_0x70c0('0x2f')];return db['CmContact'][_0x70c0('0x45')](_0x367f5a);}else{throw new Error('List\x20not\x20found');}})[_0x70c0('0x1e')](function(_0x3f1986){_0x1f747d[_0x70c0('0x46')]=_0x3f1986;if(_0x3f1986){if(!_0x148102[_0x70c0('0x2d')]['message'][_0x70c0('0x47')]){_0x148102['body'][_0x70c0('0x12')][_0x70c0('0x47')]=rs[_0x70c0('0x48')]()+'\x20'+_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x2f')];}var _0x2a28da={'ContactId':_0x3f1986['id'],'MailAccountId':_0x148102['account']['id'],'inReplyTo':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x47')],'to':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')]['from'],'cc':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')]['cc'],'subject':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x49')],'attach':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x4a')],'lastMsgAt':moment()['format'](_0x70c0('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0x148102[_0x70c0('0x2d')][_0x70c0('0x2d')]};return db[_0x70c0('0x4c')][_0x70c0('0x23')]({'where':{'closed':![],'MailAccountId':_0x148102['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x70c0('0x4d'),'attributes':[_0x70c0('0x47')],'where':{'messageId':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')]['inReplyTo']}}]})[_0x70c0('0x1e')](function(_0x1a9f74){if(_0x1a9f74){return[_0x1a9f74,![]];}return db[_0x70c0('0x4c')][_0x70c0('0x45')](_0x2a28da)[_0x70c0('0x1e')](function(_0x3b0af2){return[_0x3b0af2,!![]];});});}else{throw new Error(_0x70c0('0x4e'));}})['spread'](function(_0x27cb29,_0x1b6a0e){if(_0x27cb29){_0xa11100=_0x1b6a0e;if(!_0x1b6a0e){return _0x27cb29[_0x70c0('0x4f')]({'inReplyTo':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')]['messageId'],'to':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x2f')],'cc':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')]['cc'],'subject':_0x148102['body'][_0x70c0('0x12')][_0x70c0('0x49')],'attach':_0x27cb29['attach']?_0x27cb29[_0x70c0('0x4a')]:_0x148102[_0x70c0('0x2d')]['message'][_0x70c0('0x4a')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x70c0('0x50')](_0x70c0('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0x148102[_0x70c0('0x2d')][_0x70c0('0x2d')]});}else{return _0x27cb29;}}})[_0x70c0('0x1e')](function(_0x269f42){_0x1f747d[_0x70c0('0x51')]=_0x269f42[_0x70c0('0x3c')]({'plain':!![]});_0x1f747d[_0x70c0('0x51')][_0x70c0('0x52')]=_0xa11100;return db['MailMessage'][_0x70c0('0x45')]({'body':_0x148102[_0x70c0('0x2d')]['body'],'MailAccountId':_0x148102[_0x70c0('0x32')]['id'],'MailInteractionId':_0x269f42['id'],'direction':'in','ContactId':_0x1f747d[_0x70c0('0x46')]['id'],'messageId':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x47')],'from':_0x148102[_0x70c0('0x2d')]['message'][_0x70c0('0x2f')],'to':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')]['to'],'cc':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')]['cc'],'subject':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x49')],'attach':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x4a')],'Attachments':_0x148102['body']['message']['attachments'],'originTo':_0x148102[_0x70c0('0x2d')]['message'][_0x70c0('0x53')],'originCc':_0x148102[_0x70c0('0x2d')]['message'][_0x70c0('0x54')],'bcc':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x55')],'ChatWebsiteId':_0x148102[_0x70c0('0x2d')]['message'][_0x70c0('0x56')]||null,'originChannel':_0x148102[_0x70c0('0x2d')][_0x70c0('0x12')][_0x70c0('0x57')]||'Email','ChatOfflineMessageId':_0x148102['body'][_0x70c0('0x12')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x70c0('0x58')],'as':_0x70c0('0x59')}]});})[_0x70c0('0x1e')](function(_0x26a8ee){_0x1f747d[_0x70c0('0x12')]=_0x26a8ee;if(_0x1f747d[_0x70c0('0x51')][_0x70c0('0x5a')]){return db['User'][_0x70c0('0x23')]({'attributes':['id',_0x70c0('0x5b')],'where':{'id':_0x1f747d[_0x70c0('0x51')][_0x70c0('0x5a')]}})[_0x70c0('0x1e')](function(_0x567b3e){if(_0x567b3e){_0x1f747d[_0x70c0('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x70c0('0x5c'),'appdata':_0x567b3e[_0x70c0('0x5b')]+','+(_0x1f747d['account']['waitForTheAssignedAgent']||0xa),'interval':_0x70c0('0x43')});}return respondWithRpcPromise(_0x70c0('0x5d'),_0x70c0('0x5e'),_0x1f747d);});}return respondWithRpcPromise(_0x70c0('0x5d'),_0x70c0('0x5e'),_0x1f747d);})[_0x70c0('0x1e')](function(_0x5271bb){_0x4fbf17(_0x5271bb);})[_0x70c0('0x21')](function(_0x4b2a4b){_0x6a8062(_0xb1e84b['error'](0x1f4,_0x4b2a4b[_0x70c0('0x12')]));});});}; \ No newline at end of file +var _0x1132=['YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','error','message','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowMailAccount','MailAccount','find','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','List','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','mapKey','create','List\x20not\x20found','contact','messageId','generate','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','subject'];(function(_0x3c35bb,_0x13b307){var _0x33cbac=function(_0x1ad6ad){while(--_0x1ad6ad){_0x3c35bb['push'](_0x3c35bb['shift']());}};_0x33cbac(++_0x13b307);}(_0x1132,0x1b5));var _0x2113=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1132[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2113('0x0'));var util=require(_0x2113('0x1'));var moment=require(_0x2113('0x2'));var BPromise=require(_0x2113('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2113('0x4'));var db=require(_0x2113('0x5'))['db'];var utils=require(_0x2113('0x6'));var logger=require('../../config/logger')(_0x2113('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2113('0x8')][_0x2113('0x9')]({'port':0x232c});config[_0x2113('0xa')]=_[_0x2113('0xb')](config[_0x2113('0xa')],{'host':_0x2113('0xc'),'port':0x18eb});var socket=require(_0x2113('0xd'))(new Redis(config[_0x2113('0xa')]));require(_0x2113('0xe'))[_0x2113('0xf')](socket);function respondWithRpcPromise(_0x271d76,_0x4ff62e,_0xef354){return new BPromise(function(_0x1687d7,_0x2848c6){return client[_0x2113('0x10')](_0x271d76,_0xef354)[_0x2113('0x11')](function(_0x3867c8){logger[_0x2113('0x12')](_0x2113('0x13'),_0x4ff62e,_0x2113('0x14'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4ff62e,_0x2113('0x14'),JSON['stringify'](_0x3867c8));if(_0x3867c8[_0x2113('0x15')]){if(_0x3867c8[_0x2113('0x15')]['code']===0x1f4){logger[_0x2113('0x15')](_0x2113('0x13'),_0x4ff62e,_0x3867c8['error']['message']);return _0x2848c6(_0x3867c8['error'][_0x2113('0x16')]);}logger['error'](_0x2113('0x13'),_0x4ff62e,_0x3867c8[_0x2113('0x15')][_0x2113('0x16')]);return _0x1687d7(_0x3867c8['error'][_0x2113('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x4ff62e,'request\x20sent');_0x1687d7(_0x3867c8['result'][_0x2113('0x16')]);}})[_0x2113('0x17')](function(_0x4f1bc7){logger[_0x2113('0x15')](_0x2113('0x13'),_0x4ff62e,_0x4f1bc7);_0x2848c6(_0x4f1bc7);});});}exports[_0x2113('0x18')]=function(_0x3266f1){var _0x308018=this;return new Promise(function(_0x83bb5,_0x445029){return db['MailAccount'][_0x2113('0x19')]({'raw':_0x3266f1['options']?_0x3266f1[_0x2113('0x1a')][_0x2113('0x1b')]===undefined?!![]:![]:!![],'where':_0x3266f1[_0x2113('0x1a')]?_0x3266f1[_0x2113('0x1a')][_0x2113('0x1c')]||null:null,'attributes':_0x3266f1[_0x2113('0x1a')]?_0x3266f1[_0x2113('0x1a')][_0x2113('0x1d')]||null:null,'limit':_0x3266f1[_0x2113('0x1a')]?_0x3266f1['options'][_0x2113('0x1e')]||null:null,'include':_0x3266f1[_0x2113('0x1a')]?_0x3266f1['options'][_0x2113('0x1f')]?_['map'](_0x3266f1[_0x2113('0x1a')][_0x2113('0x1f')],function(_0x3737f5){return{'model':db[_0x3737f5[_0x2113('0x20')]],'as':_0x3737f5['as'],'attributes':_0x3737f5['attributes'],'include':_0x3737f5[_0x2113('0x1f')]?_[_0x2113('0x21')](_0x3737f5[_0x2113('0x1f')],function(_0x294971){return{'model':db[_0x294971[_0x2113('0x20')]],'as':_0x294971['as'],'attributes':_0x294971[_0x2113('0x1d')],'include':_0x294971[_0x2113('0x1f')]?_[_0x2113('0x21')](_0x294971['include'],function(_0x242f36){return{'model':db[_0x242f36[_0x2113('0x20')]],'as':_0x242f36['as'],'attributes':_0x242f36[_0x2113('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2113('0x11')](function(_0x3c3012){logger[_0x2113('0x12')](_0x2113('0x18'),_0x3266f1);logger['debug'](_0x2113('0x18'),_0x3266f1,JSON[_0x2113('0x22')](_0x3c3012));_0x83bb5(_0x3c3012);})[_0x2113('0x17')](function(_0x40bf6f){logger[_0x2113('0x15')]('GetMailAccount',_0x40bf6f[_0x2113('0x16')],_0x3266f1);_0x445029(_0x308018[_0x2113('0x15')](0x1f4,_0x40bf6f[_0x2113('0x16')]));});});};exports[_0x2113('0x23')]=function(_0x5261d2){var _0x1f1535=this;return new Promise(function(_0x5575de,_0x181b63){return db[_0x2113('0x24')][_0x2113('0x25')]({'raw':_0x5261d2['options']?_0x5261d2[_0x2113('0x1a')][_0x2113('0x1b')]===undefined?!![]:![]:!![],'where':_0x5261d2[_0x2113('0x1a')]?_0x5261d2['options'][_0x2113('0x1c')]||null:null,'attributes':_0x5261d2[_0x2113('0x1a')]?_0x5261d2[_0x2113('0x1a')][_0x2113('0x1d')]||null:null,'include':_0x5261d2['options']?_0x5261d2[_0x2113('0x1a')][_0x2113('0x1f')]?_[_0x2113('0x21')](_0x5261d2[_0x2113('0x1a')][_0x2113('0x1f')],function(_0x41e5e2){return{'model':db[_0x41e5e2[_0x2113('0x20')]],'as':_0x41e5e2['as'],'attributes':_0x41e5e2[_0x2113('0x1d')],'include':_0x41e5e2[_0x2113('0x1f')]?_[_0x2113('0x21')](_0x41e5e2[_0x2113('0x1f')],function(_0x47c436){return{'model':db[_0x47c436[_0x2113('0x20')]],'as':_0x47c436['as'],'attributes':_0x47c436[_0x2113('0x1d')],'include':_0x47c436[_0x2113('0x1f')]?_[_0x2113('0x21')](_0x47c436[_0x2113('0x1f')],function(_0x15a2db){return{'model':db[_0x15a2db[_0x2113('0x20')]],'as':_0x15a2db['as'],'attributes':_0x15a2db['attributes']};}):[]};}):[]};}):[]:[]})[_0x2113('0x11')](function(_0x3fa8eb){logger[_0x2113('0x12')]('ShowMailAccount',_0x5261d2);logger['debug']('ShowMailAccount',_0x5261d2,JSON[_0x2113('0x22')](_0x3fa8eb));_0x5575de(_0x3fa8eb);})[_0x2113('0x17')](function(_0x4a9261){logger[_0x2113('0x15')]('ShowMailAccount',_0x4a9261['message'],_0x5261d2);_0x181b63(_0x1f1535['error'](0x1f4,_0x4a9261[_0x2113('0x16')]));});});};exports[_0x2113('0x26')]=function(_0xe0a52d){var _0x5b7361=this;return new Promise(function(_0x25b417,_0x5d026d){var _0x425aef={'body':_0xe0a52d[_0x2113('0x27')],'channel':'mail'};var _0x54b1c5=_[_0x2113('0x28')](_[_0x2113('0x29')](db[_0x2113('0x2a')][_0x2113('0x2b')]),[_0x2113('0x2c'),'updatedAt',_0x2113('0x2d'),_0x2113('0x2e')]);var _0x244f39=![];if(_0xe0a52d[_0x2113('0x27')]['id']){delete _0xe0a52d['body']['id'];}if(_[_0x2113('0x2f')](_0xe0a52d[_0x2113('0x27')]['from'])){return _0x5d026d(_0x5b7361[_0x2113('0x15')](0x1f4,_0x2113('0x30')));}if(_[_0x2113('0x2f')](_0xe0a52d['body'][_0x2113('0x27')])||_0xe0a52d[_0x2113('0x27')][_0x2113('0x27')]===''){return _0x5d026d(_0x5b7361[_0x2113('0x15')](0x1f4,_0x2113('0x31')));}if(_[_0x2113('0x2f')](_0xe0a52d[_0x2113('0x27')]['mapKey'])){return _0x5d026d(_0x5b7361[_0x2113('0x15')](0x1f4,_0x2113('0x32')+_0x54b1c5));}if(!_['includes'](_0x54b1c5,_0xe0a52d[_0x2113('0x27')]['mapKey'])){return _0x5d026d(_0x5b7361[_0x2113('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x54b1c5));}var _0x1d1b12={};_0x1d1b12[_0xe0a52d[_0x2113('0x27')]['mapKey']]=_0xe0a52d[_0x2113('0x27')][_0x2113('0x33')];return db['MailAccount'][_0x2113('0x25')]({'where':{'id':_0xe0a52d[_0x2113('0x34')]['id']},'include':[{'model':db[_0x2113('0x35')],'as':'List','include':[{'model':db[_0x2113('0x2a')],'as':_0x2113('0x36'),'where':_0x1d1b12,'limit':0x1,'order':[[_0x2113('0x37'),_0x2113('0x38')]]}]},{'model':db[_0x2113('0x39')],'as':_0x2113('0x3a')},{'model':db[_0x2113('0x3b')],'as':_0x2113('0x3c')}]})['then'](function(_0x4e6c09){if(_0x4e6c09&&_0x4e6c09[_0x2113('0x3d')]){var _0x3c33f4=_0x4e6c09[_0x2113('0x3e')]({'plain':!![]});_0x425aef[_0x2113('0x34')]=_[_0x2113('0x3f')](_0x3c33f4,[_0x2113('0x3a'),_0x2113('0x3d')]);_0x425aef[_0x2113('0x40')]=_0x3c33f4[_0x2113('0x3a')];_0x425aef[_0x2113('0x41')]=_0x3c33f4[_0x2113('0x3d')];_0x425aef['applications']=_[_0x2113('0x42')](_0x425aef[_0x2113('0x40')],[_0x2113('0x43')],[_0x2113('0x44')]);if(_0x425aef[_0x2113('0x34')]&&_0x425aef['account'][_0x2113('0x45')]){_0x425aef[_0x2113('0x40')][_0x2113('0x46')]({'id':0x0,'priority':_0x425aef[_0x2113('0x40')][_0x2113('0x47')]+0x1,'app':_0x2113('0x48'),'appdata':_0x2113('0x45'),'interval':'*,*,*,*'});}if(_0x425aef[_0x2113('0x34')]['Applications']){delete _0x425aef[_0x2113('0x34')][_0x2113('0x3a')];}if(_0x425aef[_0x2113('0x34')]['List']){delete _0x425aef[_0x2113('0x34')][_0x2113('0x3d')];}if(_0x3c33f4[_0x2113('0x3d')][_0x2113('0x36')][_0x2113('0x47')]){return _0x3c33f4[_0x2113('0x3d')][_0x2113('0x36')][0x0];}var _0x4d1d63=_[_0x2113('0xb')](_0xe0a52d['body'],{'firstName':_0xe0a52d[_0x2113('0x27')][_0x2113('0x33')],'ListId':_0x3c33f4[_0x2113('0x2e')]});_0x4d1d63[_0xe0a52d[_0x2113('0x27')][_0x2113('0x49')]]=_0xe0a52d[_0x2113('0x27')][_0x2113('0x33')];return db[_0x2113('0x2a')][_0x2113('0x4a')](_0x4d1d63);}else{throw new Error(_0x2113('0x4b'));}})['then'](function(_0x193645){_0x425aef[_0x2113('0x4c')]=_0x193645;if(_0x193645){if(!_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')][_0x2113('0x4d')]){_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')]['messageId']=rs[_0x2113('0x4e')]()+'\x20'+_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')][_0x2113('0x33')];}var _0x29d07a={'ContactId':_0x193645['id'],'MailAccountId':_0xe0a52d['account']['id'],'inReplyTo':_0xe0a52d[_0x2113('0x27')]['message']['messageId'],'to':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')][_0x2113('0x33')],'cc':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')]['cc'],'subject':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')]['subject'],'attach':_0xe0a52d['body']['message'][_0x2113('0x4f')],'lastMsgAt':moment()[_0x2113('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0xe0a52d['body']['body']};return db[_0x2113('0x51')][_0x2113('0x25')]({'where':{'closed':![],'MailAccountId':_0xe0a52d[_0x2113('0x34')]['id']},'include':[{'model':db[_0x2113('0x52')],'as':_0x2113('0x53'),'attributes':[_0x2113('0x4d')],'where':{'messageId':_0xe0a52d['body'][_0x2113('0x16')][_0x2113('0x54')]}}]})[_0x2113('0x11')](function(_0x393b4c){if(_0x393b4c){return[_0x393b4c,![]];}return db[_0x2113('0x51')][_0x2113('0x4a')](_0x29d07a)[_0x2113('0x11')](function(_0x7ab2d1){return[_0x7ab2d1,!![]];});});}else{throw new Error(_0x2113('0x55'));}})['spread'](function(_0x39596f,_0x59ad20){if(_0x39596f){_0x244f39=_0x59ad20;if(!_0x59ad20){return _0x39596f[_0x2113('0x56')]({'inReplyTo':_0xe0a52d['body'][_0x2113('0x16')]['messageId'],'to':_0xe0a52d[_0x2113('0x27')]['message'][_0x2113('0x33')],'cc':_0xe0a52d['body']['message']['cc'],'subject':_0xe0a52d[_0x2113('0x27')]['message'][_0x2113('0x57')],'attach':_0x39596f[_0x2113('0x4f')]?_0x39596f[_0x2113('0x4f')]:_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')][_0x2113('0x4f')],'substatus':null,'substatusAt':moment()['format'](_0x2113('0x58')),'lastMsgAt':moment()[_0x2113('0x50')](_0x2113('0x58')),'lastMsgDirection':'in','lastMsgBody':_0xe0a52d[_0x2113('0x27')][_0x2113('0x27')]});}else{return _0x39596f;}}})[_0x2113('0x11')](function(_0x485156){_0x425aef[_0x2113('0x59')]=_0x485156[_0x2113('0x3e')]({'plain':!![]});_0x425aef[_0x2113('0x59')][_0x2113('0x5a')]=_0x244f39;return db[_0x2113('0x52')]['create']({'body':_0xe0a52d['body'][_0x2113('0x27')],'MailAccountId':_0xe0a52d['account']['id'],'MailInteractionId':_0x485156['id'],'direction':'in','ContactId':_0x425aef[_0x2113('0x4c')]['id'],'messageId':_0xe0a52d['body'][_0x2113('0x16')][_0x2113('0x4d')],'from':_0xe0a52d['body']['message'][_0x2113('0x33')],'to':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')]['to'],'cc':_0xe0a52d[_0x2113('0x27')]['message']['cc'],'subject':_0xe0a52d['body'][_0x2113('0x16')][_0x2113('0x57')],'attach':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')][_0x2113('0x4f')],'Attachments':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')]['attachments'],'originTo':_0xe0a52d['body'][_0x2113('0x16')][_0x2113('0x5b')],'originCc':_0xe0a52d['body'][_0x2113('0x16')]['originCc'],'bcc':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')][_0x2113('0x5c')],'ChatWebsiteId':_0xe0a52d[_0x2113('0x27')]['message'][_0x2113('0x5d')]||null,'originChannel':_0xe0a52d[_0x2113('0x27')]['message']['originChannel']||_0x2113('0x5e'),'ChatOfflineMessageId':_0xe0a52d[_0x2113('0x27')][_0x2113('0x16')][_0x2113('0x5f')]||null},{'include':[{'model':db[_0x2113('0x60')],'as':_0x2113('0x61')}]});})['then'](function(_0x2e8d92){_0x425aef[_0x2113('0x16')]=_0x2e8d92;if(_0x425aef[_0x2113('0x59')][_0x2113('0x62')]){return db[_0x2113('0x63')]['find']({'attributes':['id',_0x2113('0x64')],'where':{'id':_0x425aef[_0x2113('0x59')][_0x2113('0x62')]}})[_0x2113('0x11')](function(_0x11a33f){if(_0x11a33f){_0x425aef[_0x2113('0x40')][_0x2113('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x11a33f[_0x2113('0x64')]+','+(_0x425aef['account'][_0x2113('0x66')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2113('0x67'),_0x2113('0x68'),_0x425aef);});}return respondWithRpcPromise(_0x2113('0x67'),'startRouting',_0x425aef);})[_0x2113('0x11')](function(_0x39b4af){_0x25b417(_0x39b4af);})['catch'](function(_0x1f6002){_0x5d026d(_0x5b7361[_0x2113('0x15')](0x1f4,_0x1f6002[_0x2113('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1f2a89c..75966ce 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 _0x0686=['update','removeListener','register','length','./mailAccount.events','save','remove'];(function(_0x5811d5,_0x420ad8){var _0x8e3a88=function(_0x1e0eda){while(--_0x1e0eda){_0x5811d5['push'](_0x5811d5['shift']());}};_0x8e3a88(++_0x420ad8);}(_0x0686,0x123));var _0x6068=function(_0x4b5861,_0x44133c){_0x4b5861=_0x4b5861-0x0;var _0x361d39=_0x0686[_0x4b5861];return _0x361d39;};'use strict';var MailAccountEvents=require(_0x6068('0x0'));var events=[_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x3')];function createListener(_0x199954,_0x408d70){return function(_0xe6eb70){_0x408d70['emit'](_0x199954,_0xe6eb70);};}function removeListener(_0x22449d,_0x4ccea4){return function(){MailAccountEvents[_0x6068('0x4')](_0x22449d,_0x4ccea4);};}exports[_0x6068('0x5')]=function(_0x2d4dd0){for(var _0x3e5dfd=0x0,_0x37489b=events[_0x6068('0x6')];_0x3e5dfd<_0x37489b;_0x3e5dfd++){var _0x3eb140=events[_0x3e5dfd];var _0x4e0ccf=createListener('mailAccount:'+_0x3eb140,_0x2d4dd0);MailAccountEvents['on'](_0x3eb140,_0x4e0ccf);}}; \ No newline at end of file +var _0x1670=['./mailAccount.events','save','update','emit','register','length','mailAccount:'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0x1670,0x9a));var _0x0167=function(_0x4ae625,_0x58a84e){_0x4ae625=_0x4ae625-0x0;var _0x2fb608=_0x1670[_0x4ae625];return _0x2fb608;};'use strict';var MailAccountEvents=require(_0x0167('0x0'));var events=[_0x0167('0x1'),'remove',_0x0167('0x2')];function createListener(_0x4dc6f6,_0x1c7a08){return function(_0x45bbfd){_0x1c7a08[_0x0167('0x3')](_0x4dc6f6,_0x45bbfd);};}function removeListener(_0x6f87ae,_0x5786d8){return function(){MailAccountEvents['removeListener'](_0x6f87ae,_0x5786d8);};}exports[_0x0167('0x4')]=function(_0x1ae650){for(var _0x295e51=0x0,_0x3e1507=events[_0x0167('0x5')];_0x295e51<_0x3e1507;_0x295e51++){var _0x149956=events[_0x295e51];var _0xcdfc5=createListener(_0x0167('0x6')+_0x149956,_0x1ae650);MailAccountEvents['on'](_0x149956,_0xcdfc5);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c44f1fd..ebd7286 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 _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer'];(function(_0x4b6ba6,_0x142fd7){var _0x361c8f=function(_0x25feca){while(--_0x25feca){_0x4b6ba6['push'](_0x4b6ba6['shift']());}};_0x361c8f(++_0x142fd7);}(_0x6b20,0xd1));var _0x06b2=function(_0xf588de,_0x2a1a0c){_0xf588de=_0xf588de-0x0;var _0x3f33de=_0x6b20[_0xf588de];return _0x3f33de;};'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 auth=require(_0x06b2('0x4'));var interaction=require(_0x06b2('0x5'));var config=require('../../config/environment');var controller=require(_0x06b2('0x6'));router[_0x06b2('0x7')](_0x06b2('0x8'),auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0xb')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0xd')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbee3=['../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','put','update','delete','exports','util','express','Router'];(function(_0x5d048d,_0x13ddae){var _0x280824=function(_0xf985fd){while(--_0xf985fd){_0x5d048d['push'](_0x5d048d['shift']());}};_0x280824(++_0x13ddae);}(_0xbee3,0xd5));var _0x3bee=function(_0x15c3c3,_0x5a2f09){_0x15c3c3=_0x15c3c3-0x0;var _0x41f1d8=_0xbee3[_0x15c3c3];return _0x41f1d8;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bee('0x3'));var config=require(_0x3bee('0x4'));var controller=require(_0x3bee('0x5'));router['get'](_0x3bee('0x6'),auth[_0x3bee('0x7')](),controller['show']);router[_0x3bee('0x8')](_0x3bee('0x6'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0xa')](_0x3bee('0x6'),auth[_0x3bee('0x7')](),controller['destroy']);module[_0x3bee('0xb')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index c46e35a..3c759a6 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 _0x71f5=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x2b29b0,_0x3a9875){var _0xc900a0=function(_0x294a52){while(--_0x294a52){_0x2b29b0['push'](_0x2b29b0['shift']());}};_0xc900a0(++_0x3a9875);}(_0x71f5,0x163));var _0x571f=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x71f5[_0x5c468f];return _0x2136b0;};'use strict';var Sequelize=require(_0x571f('0x0'));module[_0x571f('0x1')]={'priority':{'type':Sequelize[_0x571f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x571f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x571f('0x4')]()},'description':{'type':Sequelize[_0x571f('0x3')]},'interval':{'type':Sequelize[_0x571f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0474=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0474,0x1cf));var _0x4047=function(_0x557587,_0x2ea72b){_0x557587=_0x557587-0x0;var _0x2bbee1=_0x0474[_0x557587];return _0x2bbee1;};'use strict';var Sequelize=require(_0x4047('0x0'));module[_0x4047('0x1')]={'priority':{'type':Sequelize[_0x4047('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4047('0x3')],'allowNull':![],'defaultValue':_0x4047('0x4')},'appdata':{'type':Sequelize[_0x4047('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4047('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 3eae280..7112795 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 _0x5063=['apply','reject','update','then','end','sendStatus','error','stack','name','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','MailApplication','find','catch','body','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range'];(function(_0x1f8227,_0x23d1c1){var _0x1dddeb=function(_0x3a03e7){while(--_0x3a03e7){_0x1f8227['push'](_0x1f8227['shift']());}};_0x1dddeb(++_0x23d1c1);}(_0x5063,0x1a8));var _0x3506=function(_0x3c8cdd,_0x2f22de){_0x3c8cdd=_0x3c8cdd-0x0;var _0xfa056d=_0x5063[_0x3c8cdd];return _0xfa056d;};'use strict';var pdf=require(_0x3506('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3506('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3506('0x2'));var moment=require(_0x3506('0x3'));var BPromise=require(_0x3506('0x4'));var Mustache=require(_0x3506('0x5'));var util=require(_0x3506('0x6'));var path=require('path');var sox=require(_0x3506('0x7'));var csv=require(_0x3506('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3506('0x9'));var squel=require('squel');var crypto=require(_0x3506('0xa'));var jsforce=require(_0x3506('0xb'));var deskjs=require(_0x3506('0xc'));var toCsv=require(_0x3506('0x8'));var querystring=require(_0x3506('0xd'));var Papa=require(_0x3506('0xe'));var Redis=require(_0x3506('0xf'));var authService=require(_0x3506('0x10'));var qs=require(_0x3506('0x11'));var as=require(_0x3506('0x12'));var hardwareService=require(_0x3506('0x13'));var logger=require('../../config/logger')(_0x3506('0x14'));var utils=require(_0x3506('0x15'));var config=require(_0x3506('0x16'));var licenseUtil=require(_0x3506('0x17'));var db=require(_0x3506('0x18'))['db'];function respondWithStatusCode(_0x1d2767,_0x2d9358){_0x2d9358=_0x2d9358||0xcc;return function(_0x17c17a){if(_0x17c17a){return _0x1d2767['sendStatus'](_0x2d9358);}return _0x1d2767[_0x3506('0x19')](_0x2d9358)['end']();};}function respondWithResult(_0x435882,_0x16cfde){_0x16cfde=_0x16cfde||0xc8;return function(_0x1f2b30){if(_0x1f2b30){return _0x435882[_0x3506('0x19')](_0x16cfde)[_0x3506('0x1a')](_0x1f2b30);}};}function respondWithFilteredResult(_0xae19c5,_0x26d09e){return function(_0x5ea17b){if(_0x5ea17b){var _0x5f012e=_0x5ea17b[_0x3506('0x1b')],_0x7f7d81=_0x26d09e[_0x3506('0x1c')],_0x256e88=_0x26d09e[_0x3506('0x1c')]+_0x26d09e[_0x3506('0x1d')],_0x19c81f;if(_0x256e88>=_0x5f012e){_0x256e88=_0x5f012e;_0x19c81f=0xc8;}else{_0x19c81f=0xce;}_0xae19c5[_0x3506('0x19')](_0x19c81f);return _0xae19c5[_0x3506('0x1e')](_0x3506('0x1f'),_0x7f7d81+'-'+_0x256e88+'/'+_0x5f012e)[_0x3506('0x1a')](_0x5ea17b);}return null;};}function patchUpdates(_0x4f7868){return function(_0x13c62a){try{jsonpatch[_0x3506('0x20')](_0x13c62a,_0x4f7868,!![]);}catch(_0x42d638){return BPromise[_0x3506('0x21')](_0x42d638);}return _0x13c62a['save']();};}function saveUpdates(_0x81824a,_0x544225){return function(_0x120851){if(_0x120851){return _0x120851[_0x3506('0x22')](_0x81824a)[_0x3506('0x23')](function(_0x4ac86c){return _0x4ac86c;});}return null;};}function removeEntity(_0xb127d2,_0x22b275){return function(_0x272401){if(_0x272401){return _0x272401['destroy']()['then'](function(){_0xb127d2['status'](0xcc)[_0x3506('0x24')]();});}};}function handleEntityNotFound(_0x222c59,_0x1c5d4d){return function(_0x2accec){if(!_0x2accec){_0x222c59[_0x3506('0x25')](0x194);}return _0x2accec;};}function handleError(_0x1b36c3,_0x4f9d2e){_0x4f9d2e=_0x4f9d2e||0x1f4;return function(_0x33a6a6){logger[_0x3506('0x26')](_0x33a6a6[_0x3506('0x27')]);if(_0x33a6a6[_0x3506('0x28')]){delete _0x33a6a6[_0x3506('0x28')];}_0x1b36c3[_0x3506('0x19')](_0x4f9d2e)['send'](_0x33a6a6);};}exports['show']=function(_0x1dbca4,_0x417253){var _0xf2ede6={'raw':!![],'where':{'id':_0x1dbca4['params']['id']}},_0x1514b5={};_0x1514b5[_0x3506('0x29')]=_[_0x3506('0x2a')](db['MailApplication'][_0x3506('0x2b')]);_0x1514b5[_0x3506('0x2c')]=_[_0x3506('0x2a')](_0x1dbca4['query']);_0x1514b5[_0x3506('0x2d')]=_[_0x3506('0x2e')](_0x1514b5['model'],_0x1514b5['query']);_0xf2ede6[_0x3506('0x2f')]=_[_0x3506('0x2e')](_0x1514b5[_0x3506('0x29')],qs['fields'](_0x1dbca4['query'][_0x3506('0x30')]));_0xf2ede6['attributes']=_0xf2ede6[_0x3506('0x2f')][_0x3506('0x31')]?_0xf2ede6[_0x3506('0x2f')]:_0x1514b5[_0x3506('0x29')];if(_0x1dbca4[_0x3506('0x2c')][_0x3506('0x32')]){_0xf2ede6['include']=[{'all':!![]}];}_0xf2ede6=_[_0x3506('0x33')]({},_0xf2ede6,_0x1dbca4[_0x3506('0x34')]);return db[_0x3506('0x35')][_0x3506('0x36')](_0xf2ede6)['then'](handleEntityNotFound(_0x417253,null))[_0x3506('0x23')](respondWithResult(_0x417253,null))[_0x3506('0x37')](handleError(_0x417253,null));};exports[_0x3506('0x22')]=function(_0x246e7d,_0x29b92e){if(_0x246e7d[_0x3506('0x38')]['id']){delete _0x246e7d['body']['id'];}return db[_0x3506('0x35')][_0x3506('0x36')]({'where':{'id':_0x246e7d['params']['id']}})[_0x3506('0x23')](handleEntityNotFound(_0x29b92e,null))[_0x3506('0x23')](saveUpdates(_0x246e7d[_0x3506('0x38')],null))[_0x3506('0x23')](respondWithResult(_0x29b92e,null))[_0x3506('0x37')](handleError(_0x29b92e,null));};exports['destroy']=function(_0x2a0b67,_0x96b592){return db[_0x3506('0x35')][_0x3506('0x36')]({'where':{'id':_0x2a0b67['params']['id']}})[_0x3506('0x23')](handleEntityNotFound(_0x96b592,null))['then'](removeEntity(_0x96b592,null))[_0x3506('0x37')](handleError(_0x96b592,null));}; \ No newline at end of file +var _0x25d7=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','error','name','send','params','model','keys','query','filters','intersection','fields','attributes','length','include','MailApplication','catch','body','find','html-pdf'];(function(_0xf136bc,_0x4cb677){var _0x447aa6=function(_0x5c6f9b){while(--_0x5c6f9b){_0xf136bc['push'](_0xf136bc['shift']());}};_0x447aa6(++_0x4cb677);}(_0x25d7,0x10d));var _0x725d=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x25d7[_0x349367];return _0x14179b;};'use strict';var pdf=require(_0x725d('0x0'));var emlformat=require(_0x725d('0x1'));var rimraf=require(_0x725d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x725d('0x3'));var rp=require(_0x725d('0x4'));var moment=require(_0x725d('0x5'));var BPromise=require(_0x725d('0x6'));var Mustache=require(_0x725d('0x7'));var util=require(_0x725d('0x8'));var path=require(_0x725d('0x9'));var sox=require(_0x725d('0xa'));var csv=require(_0x725d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x725d('0xc'));var squel=require(_0x725d('0xd'));var crypto=require(_0x725d('0xe'));var jsforce=require(_0x725d('0xf'));var deskjs=require(_0x725d('0x10'));var toCsv=require(_0x725d('0xb'));var querystring=require(_0x725d('0x11'));var Papa=require('papaparse');var Redis=require(_0x725d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x725d('0x13'));var logger=require(_0x725d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x725d('0x15'));var licenseUtil=require(_0x725d('0x16'));var db=require(_0x725d('0x17'))['db'];function respondWithStatusCode(_0x4e9c5c,_0x3837cc){_0x3837cc=_0x3837cc||0xcc;return function(_0x783e7e){if(_0x783e7e){return _0x4e9c5c[_0x725d('0x18')](_0x3837cc);}return _0x4e9c5c[_0x725d('0x19')](_0x3837cc)['end']();};}function respondWithResult(_0x198d10,_0x284f96){_0x284f96=_0x284f96||0xc8;return function(_0x4ae90c){if(_0x4ae90c){return _0x198d10[_0x725d('0x19')](_0x284f96)['json'](_0x4ae90c);}};}function respondWithFilteredResult(_0xf6eb05,_0x3d99c0){return function(_0x39c9e0){if(_0x39c9e0){var _0x11bd14=_0x39c9e0[_0x725d('0x1a')],_0x2bb4e2=_0x3d99c0[_0x725d('0x1b')],_0x50f55c=_0x3d99c0['offset']+_0x3d99c0[_0x725d('0x1c')],_0x1c14a1;if(_0x50f55c>=_0x11bd14){_0x50f55c=_0x11bd14;_0x1c14a1=0xc8;}else{_0x1c14a1=0xce;}_0xf6eb05[_0x725d('0x19')](_0x1c14a1);return _0xf6eb05[_0x725d('0x1d')](_0x725d('0x1e'),_0x2bb4e2+'-'+_0x50f55c+'/'+_0x11bd14)['json'](_0x39c9e0);}return null;};}function patchUpdates(_0x42ff06){return function(_0x2e9184){try{jsonpatch['apply'](_0x2e9184,_0x42ff06,!![]);}catch(_0x1e3c5a){return BPromise[_0x725d('0x1f')](_0x1e3c5a);}return _0x2e9184[_0x725d('0x20')]();};}function saveUpdates(_0x2d352b,_0xf96d98){return function(_0x2d3646){if(_0x2d3646){return _0x2d3646[_0x725d('0x21')](_0x2d352b)['then'](function(_0x42c431){return _0x42c431;});}return null;};}function removeEntity(_0x1d4526,_0xfee846){return function(_0x3c1425){if(_0x3c1425){return _0x3c1425[_0x725d('0x22')]()[_0x725d('0x23')](function(){_0x1d4526[_0x725d('0x19')](0xcc)[_0x725d('0x24')]();});}};}function handleEntityNotFound(_0x413a11,_0x1b07d0){return function(_0x434340){if(!_0x434340){_0x413a11[_0x725d('0x18')](0x194);}return _0x434340;};}function handleError(_0x34b75f,_0x111147){_0x111147=_0x111147||0x1f4;return function(_0x335b70){logger[_0x725d('0x25')](_0x335b70['stack']);if(_0x335b70[_0x725d('0x26')]){delete _0x335b70['name'];}_0x34b75f[_0x725d('0x19')](_0x111147)[_0x725d('0x27')](_0x335b70);};}exports['show']=function(_0xe37e46,_0x45c249){var _0x586039={'raw':!![],'where':{'id':_0xe37e46[_0x725d('0x28')]['id']}},_0x10d407={};_0x10d407[_0x725d('0x29')]=_[_0x725d('0x2a')](db['MailApplication']['rawAttributes']);_0x10d407[_0x725d('0x2b')]=_[_0x725d('0x2a')](_0xe37e46[_0x725d('0x2b')]);_0x10d407[_0x725d('0x2c')]=_[_0x725d('0x2d')](_0x10d407['model'],_0x10d407[_0x725d('0x2b')]);_0x586039['attributes']=_['intersection'](_0x10d407['model'],qs['fields'](_0xe37e46[_0x725d('0x2b')][_0x725d('0x2e')]));_0x586039[_0x725d('0x2f')]=_0x586039[_0x725d('0x2f')][_0x725d('0x30')]?_0x586039[_0x725d('0x2f')]:_0x10d407[_0x725d('0x29')];if(_0xe37e46[_0x725d('0x2b')]['includeAll']){_0x586039[_0x725d('0x31')]=[{'all':!![]}];}_0x586039=_['merge']({},_0x586039,_0xe37e46['options']);return db[_0x725d('0x32')]['find'](_0x586039)[_0x725d('0x23')](handleEntityNotFound(_0x45c249,null))['then'](respondWithResult(_0x45c249,null))[_0x725d('0x33')](handleError(_0x45c249,null));};exports['update']=function(_0x4bc37f,_0x29b469){if(_0x4bc37f['body']['id']){delete _0x4bc37f[_0x725d('0x34')]['id'];}return db[_0x725d('0x32')][_0x725d('0x35')]({'where':{'id':_0x4bc37f[_0x725d('0x28')]['id']}})['then'](handleEntityNotFound(_0x29b469,null))[_0x725d('0x23')](saveUpdates(_0x4bc37f[_0x725d('0x34')],null))[_0x725d('0x23')](respondWithResult(_0x29b469,null))[_0x725d('0x33')](handleError(_0x29b469,null));};exports[_0x725d('0x22')]=function(_0x329deb,_0x3c9b83){return db['MailApplication'][_0x725d('0x35')]({'where':{'id':_0x329deb[_0x725d('0x28')]['id']}})[_0x725d('0x23')](handleEntityNotFound(_0x3c9b83,null))[_0x725d('0x23')](removeEntity(_0x3c9b83,null))[_0x725d('0x33')](handleError(_0x3c9b83,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a1aad87..696f1db 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 _0x62cf=['bluebird','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x3c08b2,_0x3d4af3){var _0x301ca0=function(_0x5ab197){while(--_0x5ab197){_0x3c08b2['push'](_0x3c08b2['shift']());}};_0x301ca0(++_0x3d4af3);}(_0x62cf,0x81));var _0xf62c=function(_0x7242f6,_0x493c74){_0x7242f6=_0x7242f6-0x0;var _0x195f08=_0x62cf[_0x7242f6];return _0x195f08;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var logger=require(_0xf62c('0x1'))('api');var moment=require(_0xf62c('0x2'));var BPromise=require(_0xf62c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var attributes=require(_0xf62c('0x6'));module[_0xf62c('0x7')]=function(_0x3604f0,_0x40487e){return _0x3604f0[_0xf62c('0x8')](_0xf62c('0x9'),attributes,{'tableName':_0xf62c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf62c('0xb')});}; \ No newline at end of file +var _0xadb5=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4bfd05,_0x207fc9){var _0x3efdde=function(_0x4a83a8){while(--_0x4a83a8){_0x4bfd05['push'](_0x4bfd05['shift']());}};_0x3efdde(++_0x207fc9);}(_0xadb5,0xad));var _0x5adb=function(_0xa05fd,_0x10996f){_0xa05fd=_0xa05fd-0x0;var _0x18fab9=_0xadb5[_0xa05fd];return _0x18fab9;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./mailApplication.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5adb('0xb'),'collate':_0x5adb('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5b1ea2f..f129412 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 _0xac07=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailApplication','options','raw','attributes','limit','UpdateMailApplication','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x5a47de,_0x57a87c){var _0x400ee6=function(_0x46745b){while(--_0x46745b){_0x5a47de['push'](_0x5a47de['shift']());}};_0x400ee6(++_0x57a87c);}(_0xac07,0x1e9));var _0x7ac0=function(_0x5ae4cc,_0x5e4585){_0x5ae4cc=_0x5ae4cc-0x0;var _0x38f93d=_0xac07[_0x5ae4cc];return _0x38f93d;};'use strict';var _=require(_0x7ac0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7ac0('0x1'));var fs=require('fs');var Redis=require(_0x7ac0('0x2'));var db=require(_0x7ac0('0x3'))['db'];var utils=require(_0x7ac0('0x4'));var logger=require(_0x7ac0('0x5'))(_0x7ac0('0x6'));var config=require(_0x7ac0('0x7'));var jayson=require(_0x7ac0('0x8'));var client=jayson[_0x7ac0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb8f0,_0x5c179a,_0xa96d64){return new BPromise(function(_0xd5f027,_0x26a727){return client[_0x7ac0('0xa')](_0x3eb8f0,_0xa96d64)[_0x7ac0('0xb')](function(_0x4534bf){logger[_0x7ac0('0xc')](_0x7ac0('0xd'),_0x5c179a,'request\x20sent');logger[_0x7ac0('0xe')](_0x7ac0('0xf'),_0x5c179a,_0x7ac0('0x10'),JSON[_0x7ac0('0x11')](_0x4534bf));if(_0x4534bf['error']){if(_0x4534bf[_0x7ac0('0x12')][_0x7ac0('0x13')]===0x1f4){logger[_0x7ac0('0x12')](_0x7ac0('0xd'),_0x5c179a,_0x4534bf[_0x7ac0('0x12')][_0x7ac0('0x14')]);return _0x26a727(_0x4534bf[_0x7ac0('0x12')][_0x7ac0('0x14')]);}logger[_0x7ac0('0x12')](_0x7ac0('0xd'),_0x5c179a,_0x4534bf[_0x7ac0('0x12')]['message']);return _0xd5f027(_0x4534bf[_0x7ac0('0x12')]['message']);}else{logger[_0x7ac0('0xc')](_0x7ac0('0xd'),_0x5c179a,_0x7ac0('0x10'));_0xd5f027(_0x4534bf[_0x7ac0('0x15')][_0x7ac0('0x14')]);}})['catch'](function(_0x2cdf6a){logger[_0x7ac0('0x12')](_0x7ac0('0xd'),_0x5c179a,_0x2cdf6a);_0x26a727(_0x2cdf6a);});});}exports['UpdateMailApplication']=function(_0x172a16){var _0x233420=this;return new Promise(function(_0x4104b2,_0x207960){return db[_0x7ac0('0x16')]['update'](_0x172a16['body'],{'raw':_0x172a16[_0x7ac0('0x17')]?_0x172a16[_0x7ac0('0x17')][_0x7ac0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172a16['options']?_0x172a16[_0x7ac0('0x17')]['where']||null:null,'attributes':_0x172a16['options']?_0x172a16[_0x7ac0('0x17')][_0x7ac0('0x19')]||null:null,'limit':_0x172a16['options']?_0x172a16['options'][_0x7ac0('0x1a')]||null:null})['then'](function(_0x1a1b12){logger[_0x7ac0('0xc')](_0x7ac0('0x1b'),_0x172a16);logger[_0x7ac0('0xe')](_0x7ac0('0x1b'),_0x172a16,JSON[_0x7ac0('0x11')](_0x1a1b12));_0x4104b2(_0x1a1b12);})[_0x7ac0('0x1c')](function(_0x58d0f2){logger[_0x7ac0('0x12')]('UpdateMailApplication',_0x58d0f2['message'],_0x172a16);_0x207960(_0x233420[_0x7ac0('0x12')](0x1f4,_0x58d0f2['message']));});});}; \ No newline at end of file +var _0x6e21=['raw','where','UpdateMailApplication','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailApplication','update','body','options'];(function(_0x3a0dd8,_0x49b5d0){var _0x241b64=function(_0x3c774a){while(--_0x3c774a){_0x3a0dd8['push'](_0x3a0dd8['shift']());}};_0x241b64(++_0x49b5d0);}(_0x6e21,0xff));var _0x16e2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6e21[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x16e2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16e2('0x1'));var fs=require('fs');var Redis=require(_0x16e2('0x2'));var db=require(_0x16e2('0x3'))['db'];var utils=require(_0x16e2('0x4'));var logger=require(_0x16e2('0x5'))(_0x16e2('0x6'));var config=require('../../config/environment');var jayson=require(_0x16e2('0x7'));var client=jayson['client'][_0x16e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xacfcc8,_0x47d370,_0x1f8cf2){return new BPromise(function(_0x1af85c,_0x4be2cc){return client[_0x16e2('0x9')](_0xacfcc8,_0x1f8cf2)[_0x16e2('0xa')](function(_0xf89132){logger[_0x16e2('0xb')](_0x16e2('0xc'),_0x47d370,_0x16e2('0xd'));logger[_0x16e2('0xe')](_0x16e2('0xf'),_0x47d370,'request\x20sent',JSON[_0x16e2('0x10')](_0xf89132));if(_0xf89132['error']){if(_0xf89132[_0x16e2('0x11')][_0x16e2('0x12')]===0x1f4){logger[_0x16e2('0x11')](_0x16e2('0xc'),_0x47d370,_0xf89132[_0x16e2('0x11')][_0x16e2('0x13')]);return _0x4be2cc(_0xf89132['error'][_0x16e2('0x13')]);}logger[_0x16e2('0x11')]('MailApplication,\x20%s,\x20%s',_0x47d370,_0xf89132['error']['message']);return _0x1af85c(_0xf89132[_0x16e2('0x11')]['message']);}else{logger[_0x16e2('0xb')]('MailApplication,\x20%s,\x20%s',_0x47d370,_0x16e2('0xd'));_0x1af85c(_0xf89132['result'][_0x16e2('0x13')]);}})[_0x16e2('0x14')](function(_0x164fb1){logger[_0x16e2('0x11')](_0x16e2('0xc'),_0x47d370,_0x164fb1);_0x4be2cc(_0x164fb1);});});}exports['UpdateMailApplication']=function(_0x3aa963){var _0x190f06=this;return new Promise(function(_0x5ac555,_0x5b630f){return db[_0x16e2('0x15')][_0x16e2('0x16')](_0x3aa963[_0x16e2('0x17')],{'raw':_0x3aa963['options']?_0x3aa963[_0x16e2('0x18')][_0x16e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa963[_0x16e2('0x18')]?_0x3aa963['options'][_0x16e2('0x1a')]||null:null,'attributes':_0x3aa963['options']?_0x3aa963[_0x16e2('0x18')]['attributes']||null:null,'limit':_0x3aa963[_0x16e2('0x18')]?_0x3aa963[_0x16e2('0x18')]['limit']||null:null})[_0x16e2('0xa')](function(_0x57c5f0){logger[_0x16e2('0xb')](_0x16e2('0x1b'),_0x3aa963);logger[_0x16e2('0xe')](_0x16e2('0x1b'),_0x3aa963,JSON[_0x16e2('0x10')](_0x57c5f0));_0x5ac555(_0x57c5f0);})[_0x16e2('0x14')](function(_0x1304f9){logger[_0x16e2('0x11')]('UpdateMailApplication',_0x1304f9[_0x16e2('0x13')],_0x3aa963);_0x5b630f(_0x190f06[_0x16e2('0x11')](0x1f4,_0x1304f9[_0x16e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ff3f725..c9bf35e 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 _0x682c=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','addTags','mailinteraction:update','update','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','/:id'];(function(_0x25a37d,_0x3c81fc){var _0x3421b6=function(_0x48d8f8){while(--_0x48d8f8){_0x25a37d['push'](_0x25a37d['shift']());}};_0x3421b6(++_0x3c81fc);}(_0x682c,0x129));var _0xc682=function(_0x4080a2,_0x41b2be){_0x4080a2=_0x4080a2-0x0;var _0x57c593=_0x682c[_0x4080a2];return _0x57c593;};'use strict';var multer=require(_0xc682('0x0'));var util=require(_0xc682('0x1'));var path=require(_0xc682('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc682('0x3')]();var auth=require(_0xc682('0x4'));var interaction=require(_0xc682('0x5'));var config=require(_0xc682('0x6'));var controller=require(_0xc682('0x7'));router[_0xc682('0x8')]('/',auth[_0xc682('0x9')](),controller['index']);router[_0xc682('0x8')]('/describe',auth[_0xc682('0x9')](),controller['describe']);router[_0xc682('0x8')](_0xc682('0xa'),auth['isAuthenticated'](),controller[_0xc682('0xb')]);router['get'](_0xc682('0xc'),auth[_0xc682('0x9')](),controller[_0xc682('0xd')]);router[_0xc682('0x8')](_0xc682('0xe'),auth['isAuthenticated'](),controller[_0xc682('0xf')]);router[_0xc682('0x10')]('/',auth[_0xc682('0x9')](),controller[_0xc682('0x11')]);router[_0xc682('0x10')](_0xc682('0xc'),auth[_0xc682('0x9')](),controller[_0xc682('0x12')]);router[_0xc682('0x10')](_0xc682('0x13'),auth['isAuthenticated'](),interaction[_0xc682('0x14')](_0xc682('0x15'),'mailinteraction:addtags'),controller[_0xc682('0x16')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xc682('0x14')](_0xc682('0x15'),_0xc682('0x17')),controller[_0xc682('0x18')]);router['delete'](_0xc682('0xa'),auth[_0xc682('0x9')](),interaction[_0xc682('0x14')](_0xc682('0x15'),'mailinteraction:destroy'),controller['destroy']);router[_0xc682('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xc682('0x1a')]);module[_0xc682('0x1b')]=router; \ No newline at end of file +var _0xa526=['create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa526,0x108));var _0x6a52=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xa526[_0xd050c6];return _0x7278a;};'use strict';var multer=require(_0x6a52('0x0'));var util=require(_0x6a52('0x1'));var path=require(_0x6a52('0x2'));var timeout=require(_0x6a52('0x3'));var express=require('express');var router=express[_0x6a52('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a52('0x5'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x6a52('0x6')]('/',auth[_0x6a52('0x7')](),controller[_0x6a52('0x8')]);router[_0x6a52('0x6')](_0x6a52('0x9'),auth[_0x6a52('0x7')](),controller['describe']);router['get'](_0x6a52('0xa'),auth['isAuthenticated'](),controller[_0x6a52('0xb')]);router[_0x6a52('0x6')](_0x6a52('0xc'),auth['isAuthenticated'](),controller[_0x6a52('0xd')]);router[_0x6a52('0x6')](_0x6a52('0xe'),auth[_0x6a52('0x7')](),controller['download']);router[_0x6a52('0xf')]('/',auth[_0x6a52('0x7')](),controller[_0x6a52('0x10')]);router[_0x6a52('0xf')](_0x6a52('0xc'),auth[_0x6a52('0x7')](),controller[_0x6a52('0x11')]);router[_0x6a52('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x6a52('0x12')](_0x6a52('0x13'),_0x6a52('0x14')),controller[_0x6a52('0x15')]);router[_0x6a52('0x16')](_0x6a52('0xa'),auth[_0x6a52('0x7')](),interaction[_0x6a52('0x12')]('mail','mailinteraction:update'),controller[_0x6a52('0x17')]);router[_0x6a52('0x18')]('/:id',auth[_0x6a52('0x7')](),interaction[_0x6a52('0x12')](_0x6a52('0x13'),_0x6a52('0x19')),controller['destroy']);router[_0x6a52('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x6a52('0x1a')]);module[_0x6a52('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d035ff4..ddf49cb 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 _0x3d10=['TEXT','DATE','out','ENUM','long','sequelize','exports','STRING'];(function(_0x37d1f3,_0x4120b4){var _0x2e2ddf=function(_0x58d7a4){while(--_0x58d7a4){_0x37d1f3['push'](_0x37d1f3['shift']());}};_0x2e2ddf(++_0x4120b4);}(_0x3d10,0x145));var _0x03d1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x3d10[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x03d1('0x0'));var iconv=require('iconv');module[_0x03d1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x03d1('0x2')]},'secondDisposition':{'type':Sequelize[_0x03d1('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x03d1('0x2')]},'inReplyTo':{'type':Sequelize[_0x03d1('0x2')](0x1fe)},'to':{'type':Sequelize[_0x03d1('0x2')]},'cc':{'type':Sequelize[_0x03d1('0x3')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x03d1('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x03d1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x03d1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x03d1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x03d1('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x03d1('0x3')]('long')},'lastMsgText':{'type':Sequelize[_0x03d1('0x3')](_0x03d1('0x7'))}}; \ No newline at end of file +var _0xa3cc=['out','long','sequelize','DATE','STRING','TEXT','BOOLEAN','ENUM'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0xa3cc,0x192));var _0xca3c=function(_0x5ac902,_0x56b2bc){_0x5ac902=_0x5ac902-0x0;var _0x9dd97=_0xa3cc[_0x5ac902];return _0x9dd97;};'use strict';var Sequelize=require(_0xca3c('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xca3c('0x1')]},'disposition':{'type':Sequelize[_0xca3c('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca3c('0x2')]},'note':{'type':Sequelize[_0xca3c('0x2')]},'inReplyTo':{'type':Sequelize[_0xca3c('0x2')](0x1fe)},'to':{'type':Sequelize[_0xca3c('0x2')]},'cc':{'type':Sequelize[_0xca3c('0x3')]('long')},'subject':{'type':Sequelize[_0xca3c('0x3')]()},'attach':{'type':Sequelize[_0xca3c('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xca3c('0x1')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xca3c('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xca3c('0x5')]('in',_0xca3c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xca3c('0x5')]('in',_0xca3c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xca3c('0x3')](_0xca3c('0x7'))},'lastMsgText':{'type':Sequelize[_0xca3c('0x3')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ddecfee..193cbe1 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 _0xed3c=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','field','color','from','tools_tags','select','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','plainBody','end','some','i.MailAccountId\x20IN\x20?','$gte','$lte','null','\x20IS\x20NULL','read','tag','isArray','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','MailAccountId','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','includeAll','include','merge','create','body','describe','addMessage','params','ids','getMessages','MailMessage','rawAttributes','findAll','inlineCss','true','addTags','omit','spread','mailInteractionTags:save','unix','join','root','server','files','tmp','format','attachments','Attachment','Messages','bcc','subject','mkdirSync','each','createdAt','headers','Bcc','Attachments','readFileSync','writeFileSync','message%d.eml','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','jsforce','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','count','offset','limit','set','apply','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','fieldName','type'];(function(_0x55309a,_0x316d40){var _0x12d419=function(_0x15ba8d){while(--_0x15ba8d){_0x55309a['push'](_0x55309a['shift']());}};_0x12d419(++_0x316d40);}(_0xed3c,0x1a6));var _0xced3=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xed3c[_0x564821];return _0x2b604d;};'use strict';var pdf=require(_0xced3('0x0'));var emlformat=require(_0xced3('0x1'));var rimraf=require(_0xced3('0x2'));var zipdir=require(_0xced3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xced3('0x4'));var moment=require(_0xced3('0x5'));var BPromise=require(_0xced3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xced3('0x7'));var sox=require(_0xced3('0x8'));var csv=require(_0xced3('0x9'));var ejs=require(_0xced3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var htmlToText=require(_0xced3('0xd'));var juice=require(_0xced3('0xe'));var Redis=require(_0xced3('0xf'));var authService=require(_0xced3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xced3('0x11'));var hardwareService=require(_0xced3('0x12'));var logger=require(_0xced3('0x13'))('api');var utils=require(_0xced3('0x14'));var config=require(_0xced3('0x15'));var licenseUtil=require(_0xced3('0x16'));var db=require(_0xced3('0x17'))['db'];config[_0xced3('0x18')]=_[_0xced3('0x19')](config[_0xced3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xced3('0x1a'))(new Redis(config['redis']));require(_0xced3('0x1b'))[_0xced3('0x1c')](socket);function respondWithStatusCode(_0x20d099,_0x39e4aa){_0x39e4aa=_0x39e4aa||0xcc;return function(_0x4dd4c3){if(_0x4dd4c3){return _0x20d099[_0xced3('0x1d')](_0x39e4aa);}return _0x20d099[_0xced3('0x1e')](_0x39e4aa)['end']();};}function respondWithResult(_0x3b5962,_0x37e2d5){_0x37e2d5=_0x37e2d5||0xc8;return function(_0x43a14f){if(_0x43a14f){return _0x3b5962[_0xced3('0x1e')](_0x37e2d5)['json'](_0x43a14f);}};}function respondWithFilteredResult(_0x4569af,_0x4a3afe){return function(_0x353580){if(_0x353580){var _0x4480a6=_0x353580[_0xced3('0x1f')],_0x32c402=_0x4a3afe[_0xced3('0x20')],_0x1fb300=_0x4a3afe[_0xced3('0x20')]+_0x4a3afe[_0xced3('0x21')],_0x44143f;if(_0x1fb300>=_0x4480a6){_0x1fb300=_0x4480a6;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x4569af[_0xced3('0x1e')](_0x44143f);return _0x4569af[_0xced3('0x22')]('Content-Range',_0x32c402+'-'+_0x1fb300+'/'+_0x4480a6)['json'](_0x353580);}return null;};}function patchUpdates(_0x5e8c44){return function(_0x1e8450){try{jsonpatch[_0xced3('0x23')](_0x1e8450,_0x5e8c44,!![]);}catch(_0x21e074){return BPromise['reject'](_0x21e074);}return _0x1e8450[_0xced3('0x24')]();};}function saveUpdates(_0x30d984,_0x526854){return function(_0x559fa2){if(_0x559fa2){return _0x559fa2[_0xced3('0x25')](_0x30d984)[_0xced3('0x26')](function(_0x219fa8){return _0x219fa8;});}return null;};}function removeEntity(_0x15c6c5,_0x50f7c1){return function(_0x1905a3){if(_0x1905a3){return _0x1905a3[_0xced3('0x27')]()['then'](function(){_0x15c6c5[_0xced3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dcc52,_0x4123ba){return function(_0x3b728d){if(!_0x3b728d){_0x1dcc52[_0xced3('0x1d')](0x194);}return _0x3b728d;};}function handleError(_0x2ec2c4,_0x502cf1){_0x502cf1=_0x502cf1||0x1f4;return function(_0x5454c0){logger[_0xced3('0x28')](_0x5454c0['stack']);if(_0x5454c0[_0xced3('0x29')]){delete _0x5454c0[_0xced3('0x29')];}_0x2ec2c4['status'](_0x502cf1)[_0xced3('0x2a')](_0x5454c0);};}function getInteractionUsers(_0x4024fa,_0x196956){return new BPromise(function(_0x1032d6,_0x4389f8){try{if(_0x196956[_0x4024fa['id']]){_0x4024fa[_0xced3('0x2b')]=_[_0xced3('0x2c')](_0x196956[_0x4024fa['id']],function(_0x41d003){return{'id':_0x41d003['id'],'fullname':_0x41d003[_0xced3('0x2d')]};});}}catch(_0x559b8e){_0x4389f8(_0x559b8e);}_0x1032d6(_0x4024fa);});}function getInteractionTags(_0xa78899,_0x1b8baa){return new BPromise(function(_0x101769,_0x5867af){try{if(_0xa78899[_0xced3('0x2e')]){_0xa78899[_0xced3('0x2f')]=[];_0xa78899[_0xced3('0x2e')][_0xced3('0x30')](',')[_0xced3('0x31')](function(_0x30cd7f){_0xa78899[_0xced3('0x2f')][_0xced3('0x32')](_0x1b8baa[_0x30cd7f]);});}delete _0xa78899[_0xced3('0x2e')];}catch(_0x407a24){_0x5867af(_0x407a24);}_0x101769(_0xa78899);});}function getLastMessageText(_0x3048d0){return new BPromise(function(_0x19509c,_0x45897d){return db[_0xced3('0x33')][_0xced3('0x34')]({'where':{'id':_0x3048d0['id']},'attributes':[_0xced3('0x35'),_0xced3('0x36')],'raw':!![]})['then'](function(_0x5b92fc){if(!_0x5b92fc['lastMsgText']){_0x3048d0[_0xced3('0x36')]=_[_0xced3('0x37')](htmlToText[_0xced3('0x38')](_0x5b92fc[_0xced3('0x35')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3048d0[_0xced3('0x36')]=_0x5b92fc[_0xced3('0x36')];}_0x19509c(_0x3048d0);})[_0xced3('0x39')](function(_0x340be1){_0x45897d(_0x340be1);});});}function updateMailInteraction(_0x464c5f,_0x310e10,_0x5c290d,_0x342c11){return new BPromise(function(_0x26a435,_0x53e401){return getInteractionUsers(_0x464c5f,_0x5c290d)[_0xced3('0x26')](function(_0x3bf5e5){return getInteractionTags(_0x3bf5e5,_0x310e10);})[_0xced3('0x26')](function(_0x4f6ada){if(_0x342c11){_0x26a435(getLastMessageText(_0x4f6ada));}else{_0x26a435(_0x4f6ada);}})['catch'](function(_0x197ab3){_0x53e401(_0x197ab3);});});}exports['index']=function(_0x410357,_0x413da3){var _0x5f0ab8={},_0x180b65={},_0x15ca03={'count':0x0,'rows':[]};var _0x2a6dbf=_['map'](db[_0xced3('0x33')]['rawAttributes'],function(_0x55cf74){return{'name':_0x55cf74[_0xced3('0x3a')],'type':_0x55cf74[_0xced3('0x3b')][_0xced3('0x3c')]};});_0x180b65['model']=_[_0xced3('0x2c')](_0x2a6dbf,_0xced3('0x29'));_0x180b65[_0xced3('0x3d')]=_[_0xced3('0x3e')](_0x410357[_0xced3('0x3d')]);_0x180b65[_0xced3('0x3f')]=_[_0xced3('0x40')](_0x180b65[_0xced3('0x41')],_0x180b65[_0xced3('0x3d')]);_0x5f0ab8[_0xced3('0x42')]=_[_0xced3('0x40')](_0x180b65[_0xced3('0x41')],qs[_0xced3('0x43')](_0x410357[_0xced3('0x3d')][_0xced3('0x43')]));_0x5f0ab8['attributes']=_0x5f0ab8[_0xced3('0x42')][_0xced3('0x44')]?_0x5f0ab8[_0xced3('0x42')]:_0x180b65[_0xced3('0x41')];if(!_0x410357[_0xced3('0x3d')][_0xced3('0x45')](_0xced3('0x46'))){_0x5f0ab8[_0xced3('0x21')]=qs[_0xced3('0x21')](_0x410357['query'][_0xced3('0x21')]);_0x5f0ab8['offset']=qs[_0xced3('0x20')](_0x410357[_0xced3('0x3d')][_0xced3('0x20')]);}_0x5f0ab8['order']=qs[_0xced3('0x47')](_0x410357[_0xced3('0x3d')][_0xced3('0x47')]);_0x5f0ab8[_0xced3('0x48')]=qs['filters'](_[_0xced3('0x49')](_0x410357[_0xced3('0x3d')],_0x180b65[_0xced3('0x3f')]),_0x2a6dbf);var _0x26d16c=[];var _0x198aad=squel['select']()[_0xced3('0x4a')]('id')[_0xced3('0x4a')](_0xced3('0x29'))[_0xced3('0x4a')](_0xced3('0x4b'))[_0xced3('0x4c')](_0xced3('0x4d'));var _0x532db9=squel[_0xced3('0x4e')]()[_0xced3('0x4a')]('u.id')['field'](_0xced3('0x4f'))['field'](_0xced3('0x50'))[_0xced3('0x4c')](_0xced3('0x51'),'ui')[_0xced3('0x52')](_0xced3('0x53'),'u',_0xced3('0x54'));var _0x3700ed=squel[_0xced3('0x4e')]()[_0xced3('0x4c')]('mail_interactions','i')[_0xced3('0x52')](_0xced3('0x55'),'c',_0xced3('0x56'))[_0xced3('0x52')](_0xced3('0x53'),'o',_0xced3('0x57'))['left_join'](_0xced3('0x58'),'a',_0xced3('0x59'))[_0xced3('0x52')](_0xced3('0x5a'),'me',_0xced3('0x5b'))[_0xced3('0x52')](_0xced3('0x5c'),'it',_0xced3('0x5d'))[_0xced3('0x52')](_0xced3('0x4d'),'t',_0xced3('0x5e'));var _0x3e2a19=squel['expr']();var _0x1c69df=[];var _0x4bd3cb=squel[_0xced3('0x5f')]();var _0x27ce0b;if(_0x410357[_0xced3('0x3d')]['search']){_0x27ce0b=as['parseSearch'](_0x410357[_0xced3('0x3d')][_0xced3('0x60')]);var _0x53724a=_0x27ce0b[_0xced3('0x61')];for(var _0x4ae67d=0x0;_0x4ae67d<_0x27ce0b[_0xced3('0x62')][_0xced3('0x44')];_0x4ae67d++){var _0x4f1860=_0x27ce0b[_0xced3('0x62')][_0x4ae67d];var _0x11eb76='i';var _0xf4d7bf=_['find'](_0x2a6dbf,[_0xced3('0x29'),_0x4f1860['field']]);if(!_0xf4d7bf){switch(_0x4f1860[_0xced3('0x4a')]){case _0xced3('0x63'):if(_0x4f1860[_0xced3('0x64')]==0x1){_0x3700ed[_0xced3('0x65')]('`'+_0x4f1860[_0xced3('0x4a')]+_0xced3('0x66'));}else{_0x3700ed[_0xced3('0x65')]('`'+_0x4f1860[_0xced3('0x4a')]+_0xced3('0x67'));}break;case _0xced3('0x68'):if(_0x4f1860[_0xced3('0x69')]==='$substring'){if(_0x4f1860[_0xced3('0x64')][_0xced3('0x30')]('\x20')[_0xced3('0x44')]>0x1){_0x3e2a19[_0x53724a](_0xced3('0x6a'),qs[_0xced3('0x6b')](_0x4f1860[_0xced3('0x64')]),null);}else{var _0x4d0916='%'+_0x4f1860[_0xced3('0x64')]+'%';_0x3e2a19[_0x53724a](_0xced3('0x6c'),_0x4d0916,_0x4d0916,_0x4d0916);}}else{_0xf4d7bf=_[_0xced3('0x6d')](_0x2a6dbf,[_0xced3('0x29'),_0xced3('0x6e')]);_0x4f1860[_0xced3('0x4a')]='ContactId';_0x58d7fc=as[_0xced3('0x6f')](_0x11eb76,_0xf4d7bf['type'],_0x4f1860);_0x3e2a19[_0x53724a](_0x58d7fc[_0xced3('0x70')],_0x58d7fc['value'][_0xced3('0x71')],_0x58d7fc[_0xced3('0x64')]['end']);}break;case _0xced3('0x72'):var _0xce41d9=_0x4f1860[_0xced3('0x64')][_0xced3('0x30')](',')[_0xced3('0x2c')](function(_0x21eeec){return Number(_0x21eeec);});_0xce41d9[_0xced3('0x31')](function(_0x206dd3){_0x4bd3cb['or'](_0xced3('0x73'),'%,'+_0x206dd3+',%');});_0x1c69df=_[_0xced3('0x74')](_0x1c69df,_0xce41d9);break;case _0xced3('0x75'):if(_0x4f1860[_0xced3('0x69')]===_0xced3('0x76')){_0x3e2a19[_0x53724a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4f1860[_0xced3('0x64')]+'%',null);}else{_0xf4d7bf=_[_0xced3('0x6d')](_0x2a6dbf,[_0xced3('0x29'),_0xced3('0x77')]);_0x4f1860['field']=_0xced3('0x77');_0x58d7fc=as[_0xced3('0x6f')](_0x11eb76,_0xf4d7bf[_0xced3('0x3b')],_0x4f1860);_0x3e2a19[_0x53724a](_0x58d7fc[_0xced3('0x70')],_0x58d7fc[_0xced3('0x64')][_0xced3('0x71')],_0x58d7fc[_0xced3('0x64')]['end']);}break;case _0xced3('0x78'):_0x58d7fc=as[_0xced3('0x6f')]('me',null,_0x4f1860);_0x3e2a19[_0x53724a](_0x58d7fc['text'],_0x58d7fc[_0xced3('0x64')][_0xced3('0x71')],_0x58d7fc[_0xced3('0x64')][_0xced3('0x79')]);break;}}else{var _0x58d7fc=as[_0xced3('0x6f')](_0x11eb76,_0xf4d7bf[_0xced3('0x3b')],_0x4f1860);_0x3e2a19[_0x53724a](_0x58d7fc[_0xced3('0x70')],_0x58d7fc[_0xced3('0x64')][_0xced3('0x71')],_0x58d7fc[_0xced3('0x64')][_0xced3('0x79')]);}}}else{var _0x3ad0e7=_(_0x410357[_0xced3('0x3d')])[_0xced3('0x3e')]()['map'](function(_0x3d39de){return _[_0xced3('0x7a')](_0x2a6dbf,['name',_0x3d39de])?_0x3d39de:undefined;})['compact']()[_0xced3('0x64')]();if(!_['isEmpty'](_0x3ad0e7)){_0x3ad0e7[_0xced3('0x31')](function(_0x256216){if(_0x256216==='MailAccountId'){_0x3700ed[_0xced3('0x48')](_0xced3('0x7b'),[]['concat'](_0x410357[_0xced3('0x3d')][_0x256216]));}else if(_0x256216==='createdAt'){var _0x39eead=JSON['parse'](_0x410357[_0xced3('0x3d')][_0x256216])[_0xced3('0x7c')];var _0x11f393=JSON['parse'](_0x410357[_0xced3('0x3d')][_0x256216])[_0xced3('0x7d')];_0x3700ed[_0xced3('0x48')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x39eead,_0x11f393);}else{if(_0x410357[_0xced3('0x3d')][_0x256216]===_0xced3('0x7e')){_0x3700ed[_0xced3('0x48')]('i.'+_0x256216+_0xced3('0x7f'));}else{_0x3700ed['where']('i.'+_0x256216+'\x20=\x20?',_0x410357[_0xced3('0x3d')][_0x256216]);}}});}if(_0x410357[_0xced3('0x3d')][_0xced3('0x80')]){if(_0x410357[_0xced3('0x3d')][_0xced3('0x80')]==0x1){_0x3700ed[_0xced3('0x65')]('`unreadMessages`\x20=\x200');}else{_0x3700ed[_0xced3('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x410357[_0xced3('0x3d')][_0xced3('0x81')]){_0x1c69df=_[_0xced3('0x82')](_0x410357[_0xced3('0x3d')]['tag'])?_0x410357[_0xced3('0x3d')][_0xced3('0x81')]:new Array(_0x410357['query']['tag']);_0x1c69df[_0xced3('0x31')](function(_0x14818f){_0x4bd3cb['or'](_0xced3('0x73'),'%,'+_0x14818f+',%');});}if(_0x410357[_0xced3('0x3d')][_0xced3('0x83')]){var _0x56c948=_0x410357[_0xced3('0x3d')][_0xced3('0x83')][_0xced3('0x84')]('\x5c','\x5c\x5c')[_0xced3('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x56c948)){_0x3e2a19['or'](_0xced3('0x85'),_0x56c948+'%');}else if(qs[_0xced3('0x86')](_0x56c948)){_0x3e2a19['or'](_0xced3('0x87'),_0x56c948+'%');}else{_0x3e2a19['or'](_0xced3('0x88'),qs[_0xced3('0x6b')](_0x56c948))['or'](_0xced3('0x89'),qs[_0xced3('0x6b')](_0x56c948));}}}_0x3700ed[_0xced3('0x48')](_0x3e2a19);_0x3700ed[_0xced3('0x8a')](_0xced3('0x8b'));var _0x4d8196={'type':db[_0xced3('0x8c')][_0xced3('0x8d')]['SELECT'],'raw':!![]};var _0x284cf2=_0x3700ed[_0xced3('0x8e')]();_0x284cf2[_0xced3('0x4a')](_0xced3('0x8b'));_0x284cf2[_0xced3('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xced3('0x63'));if(_0x5f0ab8[_0xced3('0x8f')]){_0x5f0ab8['order'][_0xced3('0x31')](function(_0xab85c0){var _0x2c8929=_0xab85c0[0x0]===_0xced3('0x90')?_0xab85c0[0x0]:'i.'+_0xab85c0[0x0];_0x3700ed[_0xced3('0x8f')](_0x2c8929,_0xab85c0[0x1]===_0xced3('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x1c69df)){_0x3700ed[_0xced3('0x65')](_0x4bd3cb);_0x284cf2[_0xced3('0x48')](_0xced3('0x92'),_0x1c69df);}BPromise[_0xced3('0x93')]()[_0xced3('0x26')](function(){if(!_0x27ce0b){if(_0x410357[_0xced3('0x3d')]['MailAccountId'])return;_0x284cf2['where'](_0xced3('0x94'));_0x3700ed[_0xced3('0x48')](_0xced3('0x94'));return;}if(_0x410357[_0xced3('0x95')][_0xced3('0x96')]!==_0xced3('0x97'))return;return _0x410357[_0xced3('0x95')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xced3('0x26')](function(_0x290ca3){if(_['isEmpty'](_0x290ca3)){_0x284cf2['where'](_0xced3('0x98'));_0x3700ed[_0xced3('0x48')](_0xced3('0x98'));}else{_0x284cf2[_0xced3('0x48')](_0xced3('0x7b'),_['map'](_0x290ca3,'id'));_0x3700ed[_0xced3('0x48')]('i.MailAccountId\x20IN\x20?',_[_0xced3('0x2c')](_0x290ca3,'id'));}});})[_0xced3('0x26')](function(){if(_0x410357[_0xced3('0x95')][_0xced3('0x96')]===_0xced3('0x97')&&!_0x27ce0b&&!_0x410357['query'][_0xced3('0x99')])return[];return db[_0xced3('0x9a')][_0xced3('0x3d')](_0x284cf2[_0xced3('0x9b')](),_0x4d8196);})['then'](function(_0x52df3c){_0x15ca03[_0xced3('0x1f')]=_0x52df3c[_0xced3('0x44')];if(_0x15ca03[_0xced3('0x1f')]===0x0)return[];return db[_0xced3('0x9a')][_0xced3('0x3d')](_0x198aad[_0xced3('0x9b')](),_0x4d8196)[_0xced3('0x26')](function(_0x1036c2){_0x26d16c=_['keyBy'](_0x1036c2,'id');_0x4d8196=_['merge'](_0x4d8196,{'model':db[_0xced3('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x410357[_0xced3('0x3d')][_0xced3('0x43')]){_0x5f0ab8[_0xced3('0x42')][_0xced3('0x31')](function(_0x2ba321){_0x3700ed[_0xced3('0x4a')]('i.'+_0x2ba321);});}else{_0x3700ed[_0xced3('0x4a')](_0xced3('0x9c'),_0xced3('0x63'));_0x3700ed[_0xced3('0x4a')]('a.key',_0xced3('0x9d'));_0x3700ed['field'](_0xced3('0x9e'),_0xced3('0x9f'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa0'),_0xced3('0x90'));_0x3700ed[_0xced3('0x4a')](_0xced3('0x8b'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa1'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa2'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa3'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa4'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa5'));_0x3700ed['field']('i.lastMsgAt');_0x3700ed['field'](_0xced3('0xa6'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa7'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xa8'));_0x3700ed[_0xced3('0x4a')]('i.secondDisposition');_0x3700ed[_0xced3('0x4a')](_0xced3('0xa9'));_0x3700ed['field']('i.substatus');_0x3700ed[_0xced3('0x4a')](_0xced3('0xaa'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xab'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xac'));_0x3700ed['field'](_0xced3('0xad'));_0x3700ed['field'](_0xced3('0xae'),_0xced3('0xaf'));_0x3700ed[_0xced3('0x4a')]('c.lastName','Contact.lastName');_0x3700ed['field'](_0xced3('0xb0'),_0xced3('0xb1'));_0x3700ed['field'](_0xced3('0xb2'),_0xced3('0xb3'));_0x3700ed['field'](_0xced3('0xb4'),_0xced3('0xb5'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xb6'),_0xced3('0xb7'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xb8'),_0xced3('0xb9'));_0x3700ed['field'](_0xced3('0xba'),_0xced3('0xbb'));_0x3700ed[_0xced3('0x4a')](_0xced3('0xbc'),_0xced3('0x2e'));}if(_0x5f0ab8[_0xced3('0x21')])_0x3700ed[_0xced3('0x21')](_0x5f0ab8[_0xced3('0x21')]);if(_0x5f0ab8[_0xced3('0x20')])_0x3700ed[_0xced3('0x20')](_0x5f0ab8[_0xced3('0x20')]);return db[_0xced3('0x9a')][_0xced3('0x3d')](_0x3700ed[_0xced3('0x9b')](),_0x4d8196);})[_0xced3('0x26')](function(_0x58c587){_0x532db9[_0xced3('0x48')](_0xced3('0xbd'),_[_0xced3('0x2c')](_0x58c587,'id'));return db[_0xced3('0x9a')][_0xced3('0x3d')](_0x532db9['toString'](),_0x4d8196)['then'](function(_0x9c4096){var _0x1f9354=_[_0xced3('0xbe')](_0x9c4096,_0xced3('0xbf'));var _0x81b3bc=[];return db[_0xced3('0xc0')][_0xced3('0x34')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x394416){var _0x4a720b=_0x394416[_0xced3('0xc1')];_0x58c587[_0xced3('0x31')](function(_0x236a53){_0x81b3bc[_0xced3('0x32')](updateMailInteraction(_0x236a53,_0x26d16c,_0x1f9354,_0x4a720b));});return BPromise[_0xced3('0xc2')](_0x81b3bc);});});});})[_0xced3('0x26')](function(_0xaec7bf){_0x15ca03[_0xced3('0xc3')]=_0xaec7bf;return _0x15ca03;})[_0xced3('0x26')](respondWithFilteredResult(_0x413da3,_0x5f0ab8))[_0xced3('0x39')](handleError(_0x413da3,null));};exports[_0xced3('0xc4')]=function(_0x28a497,_0x1994d3){var _0xbd91ef={'raw':![],'where':{'id':_0x28a497['params']['id']}},_0x561aca={};_0x561aca[_0xced3('0x41')]=_['keys'](db[_0xced3('0x33')]['rawAttributes']);_0x561aca['query']=_[_0xced3('0x3e')](_0x28a497[_0xced3('0x3d')]);_0x561aca[_0xced3('0x3f')]=_[_0xced3('0x40')](_0x561aca['model'],_0x561aca['query']);_0xbd91ef[_0xced3('0x42')]=_[_0xced3('0x40')](_0x561aca[_0xced3('0x41')],qs['fields'](_0x28a497[_0xced3('0x3d')]['fields']));_0xbd91ef['attributes']=_0xbd91ef[_0xced3('0x42')][_0xced3('0x44')]?_0xbd91ef[_0xced3('0x42')]:_0x561aca[_0xced3('0x41')];if(_0x28a497[_0xced3('0x3d')][_0xced3('0xc5')]){_0xbd91ef[_0xced3('0xc6')]=[{'all':!![]}];}_0xbd91ef=_[_0xced3('0xc7')]({},_0xbd91ef,_0x28a497['options']);return db['MailInteraction'][_0xced3('0x6d')](_0xbd91ef)['then'](handleEntityNotFound(_0x1994d3,null))[_0xced3('0x26')](respondWithResult(_0x1994d3,null))[_0xced3('0x39')](handleError(_0x1994d3,null));};exports['create']=function(_0x2e7c5c,_0x2e79d0){return db[_0xced3('0x33')][_0xced3('0xc8')](_0x2e7c5c[_0xced3('0xc9')],{})[_0xced3('0x26')](respondWithResult(_0x2e79d0,0xc9))['catch'](handleError(_0x2e79d0,null));};exports[_0xced3('0x25')]=function(_0x3e265,_0x3887a5){if(_0x3e265[_0xced3('0xc9')]['id']){delete _0x3e265[_0xced3('0xc9')]['id'];}return db[_0xced3('0x33')]['find']({'where':{'id':_0x3e265['params']['id']}})['then'](handleEntityNotFound(_0x3887a5,null))[_0xced3('0x26')](saveUpdates(_0x3e265[_0xced3('0xc9')],null))[_0xced3('0x26')](respondWithResult(_0x3887a5,null))[_0xced3('0x39')](handleError(_0x3887a5,null));};exports[_0xced3('0x27')]=function(_0x4af496,_0x5e31dd){return db[_0xced3('0x33')][_0xced3('0x6d')]({'where':{'id':_0x4af496['params']['id']}})['then'](handleEntityNotFound(_0x5e31dd,null))[_0xced3('0x26')](removeEntity(_0x5e31dd,null))[_0xced3('0x39')](handleError(_0x5e31dd,null));};exports[_0xced3('0xca')]=function(_0xbeffe6,_0x2211ed){return db[_0xced3('0x33')][_0xced3('0xca')]()[_0xced3('0x26')](respondWithResult(_0x2211ed,null))[_0xced3('0x39')](handleError(_0x2211ed,null));};exports[_0xced3('0xcb')]=function(_0x54d810,_0x7cfba,_0x212446){return db['MailMessage'][_0xced3('0x6d')]({'where':{'id':_0x54d810[_0xced3('0xcc')]['id']}})[_0xced3('0x26')](handleEntityNotFound(_0x7cfba,null))[_0xced3('0x26')](function(_0x4173eb){if(_0x4173eb){return _0x4173eb[_0xced3('0xcb')](_0x54d810[_0xced3('0xc9')][_0xced3('0xcd')],_['omit'](_0x54d810['body'],[_0xced3('0xcd'),'id'])||{});}})[_0xced3('0x26')](respondWithResult(_0x7cfba,null))['catch'](handleError(_0x7cfba,null));};exports[_0xced3('0xce')]=function(_0x445dff,_0x1d174e,_0x22b801){var _0x438582={'raw':![],'where':{}};var _0x477619={};var _0x5b53cb={'count':0x0,'rows':[]};return db[_0xced3('0x33')]['findOne']({'where':{'id':_0x445dff['params']['id']}})[_0xced3('0x26')](handleEntityNotFound(_0x1d174e,null))[_0xced3('0x26')](function(_0x21f013){if(_0x21f013){_0x477619[_0xced3('0x41')]=_['keys'](db[_0xced3('0xcf')][_0xced3('0xd0')]);_0x477619['query']=_['keys'](_0x445dff['query']);_0x477619[_0xced3('0x3f')]=_[_0xced3('0x40')](_0x477619[_0xced3('0x41')],_0x477619[_0xced3('0x3d')]);_0x438582[_0xced3('0x42')]=_[_0xced3('0x40')](_0x477619[_0xced3('0x41')],qs[_0xced3('0x43')](_0x445dff[_0xced3('0x3d')][_0xced3('0x43')]));_0x438582['attributes']=_0x438582['attributes'][_0xced3('0x44')]?_0x438582[_0xced3('0x42')]:_0x477619['model'];if(!_0x445dff['query'][_0xced3('0x45')](_0xced3('0x46'))){_0x438582[_0xced3('0x21')]=qs['limit'](_0x445dff[_0xced3('0x3d')]['limit']);_0x438582[_0xced3('0x20')]=qs['offset'](_0x445dff[_0xced3('0x3d')]['offset']);}_0x438582[_0xced3('0x8f')]=qs[_0xced3('0x47')](_0x445dff[_0xced3('0x3d')]['sort']);_0x438582['where']=qs[_0xced3('0x3f')](_[_0xced3('0x49')](_0x445dff[_0xced3('0x3d')],_0x477619[_0xced3('0x3f')]));_0x438582['where'][_0xced3('0xbf')]=_0x21f013['id'];if(_0x445dff[_0xced3('0x3d')][_0xced3('0x83')]){_0x438582[_0xced3('0x48')]=_['merge'](_0x438582[_0xced3('0x48')],{'$or':_[_0xced3('0x2c')](_0x438582[_0xced3('0x42')],function(_0x4073b9){var _0x404b7d={};_0x404b7d[_0x4073b9]={'$like':'%'+_0x445dff[_0xced3('0x3d')][_0xced3('0x83')]+'%'};return _0x404b7d;})});}if(_0x445dff[_0xced3('0x3d')]['$gte']){var _0x1aaa1c=_0x445dff[_0xced3('0x3d')][_0xced3('0x7c')][_0xced3('0x30')](',');var _0x2bac8f={};_0x2bac8f[_0x1aaa1c[0x0]]={'$gte':moment(_0x1aaa1c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x438582[_0xced3('0x48')]=_[_0xced3('0xc7')](_0x438582[_0xced3('0x48')],_0x2bac8f);}_0x438582=_[_0xced3('0xc7')]({},_0x438582,_0x445dff['options']);return db[_0xced3('0xcf')]['count']({'where':_0x438582['where']})[_0xced3('0x26')](function(_0x473560){_0x5b53cb['count']=_0x473560;if(_0x445dff[_0xced3('0x3d')]['includeAll']){_0x438582[_0xced3('0xc6')]=[{'all':!![]}];}return db['MailMessage'][_0xced3('0xd1')](_0x438582);})[_0xced3('0x26')](function(_0x38e79e){if(_0x445dff[_0xced3('0x3d')][_0xced3('0xd2')]===_0xced3('0xd3')){for(var _0xd6e93c=0x0;_0xd6e93c<_0x38e79e[_0xced3('0x44')];_0xd6e93c++){_0x38e79e[_0xd6e93c]['body']=juice(_0x38e79e[_0xd6e93c][_0xced3('0xc9')]);}}_0x5b53cb[_0xced3('0xc3')]=_0x38e79e;return _0x5b53cb;});}})[_0xced3('0x26')](respondWithFilteredResult(_0x1d174e,_0x438582))[_0xced3('0x39')](handleError(_0x1d174e,null));};exports[_0xced3('0xd4')]=function(_0x48343e,_0x3dadb4,_0x35bb1c){return db[_0xced3('0x33')][_0xced3('0x6d')]({'where':{'id':_0x48343e[_0xced3('0xcc')]['id']}})[_0xced3('0x26')](handleEntityNotFound(_0x3dadb4,null))[_0xced3('0x26')](function(_0x178619){if(_0x178619){return _0x178619['setTags'](_0x48343e[_0xced3('0xc9')]['ids'],_[_0xced3('0xd5')](_0x48343e[_0xced3('0xc9')],[_0xced3('0xcd'),'id'])||{})[_0xced3('0xd6')](function(){return db[_0xced3('0x72')]['findAll']({'attributes':['id',_0xced3('0x29'),'color'],'where':{'id':_0x48343e[_0xced3('0xc9')][_0xced3('0xcd')]}});})[_0xced3('0x26')](function(_0x29db96){socket['emit'](_0xced3('0xd7'),{'id':Number(_0x48343e[_0xced3('0xcc')]['id']),'tags':_0x29db96||[]});return{'id':Number(_0x48343e[_0xced3('0xcc')]['id']),'tags':_0x29db96||[]};});}})['then'](respondWithResult(_0x3dadb4,null))[_0xced3('0x39')](handleError(_0x3dadb4,null));};exports['removeTags']=function(_0x2a3216,_0x5d25b7,_0x4568e4){return db[_0xced3('0x33')][_0xced3('0x6d')]({'where':{'id':_0x2a3216[_0xced3('0xcc')]['id']}})[_0xced3('0x26')](handleEntityNotFound(_0x5d25b7,null))['then'](function(_0x1052ea){if(_0x1052ea){return _0x1052ea['removeTags'](_0x2a3216[_0xced3('0x3d')][_0xced3('0xcd')]);}})[_0xced3('0x26')](respondWithStatusCode(_0x5d25b7,null))[_0xced3('0x39')](handleError(_0x5d25b7,null));};exports['download']=function(_0x2c2efe,_0x35dfd4){var _0x5ca892=moment()[_0xced3('0xd8')]()[_0xced3('0x9b')]();var _0x6ae24f=path[_0xced3('0xd9')](config[_0xced3('0xda')],_0xced3('0xdb'),_0xced3('0xdc'),_0xced3('0xdd'));var _0x4d3a09=path['join'](config['root'],_0xced3('0xdb'),'files','attachments');var _0x2efdf6=path['join'](_0x6ae24f,_0x5ca892);var _0x4b93df=util[_0xced3('0xde')]('transcript-%d-%s.zip',_0x2c2efe['params']['id'],_0x5ca892);var _0x297523=path['join'](_0x6ae24f,_0x4b93df);var _0x29b3f4=[];if(_0x2c2efe['query'][_0xced3('0xdf')]){_0x29b3f4[_0xced3('0x32')]({'model':db[_0xced3('0xe0')],'as':'Attachments','raw':!![]});}var _0x5a4a32=[{'model':db[_0xced3('0xcf')],'as':_0xced3('0xe1'),'attributes':['id',_0xced3('0xc9'),_0xced3('0x4c'),'to','cc',_0xced3('0xe2'),_0xced3('0xe3'),'createdAt'],'where':{'secret':![]},'order':qs[_0xced3('0x47')]('id'),'include':_0x29b3f4}];return db[_0xced3('0x33')][_0xced3('0x6d')]({'where':{'id':_0x2c2efe[_0xced3('0xcc')]['id']},'include':_0x5a4a32})['then'](handleEntityNotFound(_0x35dfd4,null))['then'](function(_0x2e511e){if(_0x2e511e&&_0x2e511e[_0xced3('0xe1')]){var _0x329e5e=_0x2e511e['get']({'plain':!![]});fs[_0xced3('0xe4')](_0x2efdf6);return BPromise[_0xced3('0xe5')](_0x329e5e[_0xced3('0xe1')],function(_0x34a909,_0x54f62f){var _0x196276={'from':_0x34a909[_0xced3('0x4c')],'to':_0x34a909['to'],'subject':_0x34a909[_0xced3('0xe3')],'html':_0x34a909[_0xced3('0xc9')],'headers':{'Date':moment(_0x34a909[_0xced3('0xe6')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x34a909['cc']){_0x196276[_0xced3('0xe7')]['Cc']=_0x34a909['cc'];}if(_0x34a909[_0xced3('0xe2')]){_0x196276[_0xced3('0xe7')][_0xced3('0xe8')]=_0x34a909[_0xced3('0xe2')];}return new BPromise(function(_0x903ab8,_0xefa174){if(_0x34a909[_0xced3('0xe9')]){for(var _0x23f168=0x0;_0x23f168<_0x34a909['Attachments'][_0xced3('0x44')];_0x23f168++){var _0x10f5f8=_0x34a909[_0xced3('0xe9')][_0x23f168];var _0x87545=path[_0xced3('0xd9')](_0x4d3a09,_0x10f5f8['basename']);if(fs['existsSync'](_0x87545)){_0x196276[_0xced3('0xdf')][_0xced3('0x32')]({'name':_0x10f5f8['name'],'contentType':_0x10f5f8['type'],'data':fs[_0xced3('0xea')](_0x87545)});}}}emlformat['build'](_0x196276,function(_0x4ef82a,_0x404108){if(_0x4ef82a)return _0xefa174(_0x4ef82a);fs[_0xced3('0xeb')](path[_0xced3('0xd9')](_0x2efdf6,util[_0xced3('0xde')](_0xced3('0xec'),_0x54f62f)),_0x404108);return _0x903ab8(_0x404108);});});})[_0xced3('0x26')](function(){return new BPromise(function(_0x37a7e9,_0x560c00){zipdir(_0x2efdf6,{'saveTo':_0x297523},function(_0x26b3e7,_0x111aa8){if(_0x26b3e7)return _0x560c00(_0x26b3e7);return _0x37a7e9(_0x111aa8);});})[_0xced3('0x26')](function(){return new BPromise(function(_0x311789,_0xbfc8ab){rimraf(_0x2efdf6,function(_0x14df8c){if(_0x14df8c)_0xbfc8ab(_0x14df8c);return _0x311789();});});})[_0xced3('0x26')](function(){return _0x35dfd4[_0xced3('0xed')](_0x297523,_0x4b93df,function(_0x3cbbb3){if(_0x3cbbb3){console[_0xced3('0xee')](_0xced3('0xef'),_0x3cbbb3);}else{fs[_0xced3('0xf0')](_0x297523);}});});});}else{return _0x35dfd4[_0xced3('0x1d')](0xc8);}})[_0xced3('0x39')](handleError(_0x35dfd4,null));}; \ No newline at end of file +var _0x84a0=['replace','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','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','includeAll','include','options','create','body','params','describe','addMessage','MailMessage','ids','getMessages','hasOwnProperty','nolimit','format','findAll','inlineCss','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','bcc','subject','Messages','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','html-to-text','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','Users','fullname','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','select','field','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','search','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','start','Tag','union','User','find','UserId','buildExpression','plainBody','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x84a0,0x66));var _0x084a=function(_0x2098c8,_0x261100){_0x2098c8=_0x2098c8-0x0;var _0x32a7ae=_0x84a0[_0x2098c8];return _0x32a7ae;};'use strict';var pdf=require(_0x084a('0x0'));var emlformat=require(_0x084a('0x1'));var rimraf=require(_0x084a('0x2'));var zipdir=require(_0x084a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x084a('0x4'));var moment=require(_0x084a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x084a('0x6'));var path=require(_0x084a('0x7'));var sox=require('sox');var csv=require(_0x084a('0x8'));var ejs=require(_0x084a('0x9'));var fs=require('fs');var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0x8'));var querystring=require(_0x084a('0xe'));var Papa=require(_0x084a('0xf'));var htmlToText=require(_0x084a('0x10'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x084a('0x11'));var qs=require(_0x084a('0x12'));var as=require(_0x084a('0x13'));var hardwareService=require(_0x084a('0x14'));var logger=require(_0x084a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x084a('0x16'));var licenseUtil=require(_0x084a('0x17'));var db=require(_0x084a('0x18'))['db'];config[_0x084a('0x19')]=_[_0x084a('0x1a')](config[_0x084a('0x19')],{'host':_0x084a('0x1b'),'port':0x18eb});var socket=require(_0x084a('0x1c'))(new Redis(config['redis']));require(_0x084a('0x1d'))['register'](socket);function respondWithStatusCode(_0x225de0,_0x3ccaca){_0x3ccaca=_0x3ccaca||0xcc;return function(_0x366624){if(_0x366624){return _0x225de0[_0x084a('0x1e')](_0x3ccaca);}return _0x225de0[_0x084a('0x1f')](_0x3ccaca)['end']();};}function respondWithResult(_0x443ebb,_0x4abd81){_0x4abd81=_0x4abd81||0xc8;return function(_0x6799af){if(_0x6799af){return _0x443ebb[_0x084a('0x1f')](_0x4abd81)['json'](_0x6799af);}};}function respondWithFilteredResult(_0xf2c333,_0x32c729){return function(_0x4134b9){if(_0x4134b9){var _0x14bb19=_0x4134b9[_0x084a('0x20')],_0x33d3a6=_0x32c729[_0x084a('0x21')],_0x145636=_0x32c729[_0x084a('0x21')]+_0x32c729[_0x084a('0x22')],_0x447a19;if(_0x145636>=_0x14bb19){_0x145636=_0x14bb19;_0x447a19=0xc8;}else{_0x447a19=0xce;}_0xf2c333[_0x084a('0x1f')](_0x447a19);return _0xf2c333[_0x084a('0x23')](_0x084a('0x24'),_0x33d3a6+'-'+_0x145636+'/'+_0x14bb19)[_0x084a('0x25')](_0x4134b9);}return null;};}function patchUpdates(_0x506f71){return function(_0x343c5c){try{jsonpatch[_0x084a('0x26')](_0x343c5c,_0x506f71,!![]);}catch(_0x41a90f){return BPromise[_0x084a('0x27')](_0x41a90f);}return _0x343c5c[_0x084a('0x28')]();};}function saveUpdates(_0x4865c8,_0x755c24){return function(_0x288e9e){if(_0x288e9e){return _0x288e9e[_0x084a('0x29')](_0x4865c8)[_0x084a('0x2a')](function(_0x18b43d){return _0x18b43d;});}return null;};}function removeEntity(_0x3cdc1e,_0x5be167){return function(_0x297e5b){if(_0x297e5b){return _0x297e5b[_0x084a('0x2b')]()[_0x084a('0x2a')](function(){_0x3cdc1e['status'](0xcc)[_0x084a('0x2c')]();});}};}function handleEntityNotFound(_0x3dd8b9,_0xfc9b8c){return function(_0x4c5658){if(!_0x4c5658){_0x3dd8b9['sendStatus'](0x194);}return _0x4c5658;};}function handleError(_0x4874fe,_0x52227a){_0x52227a=_0x52227a||0x1f4;return function(_0x33b88f){logger['error'](_0x33b88f['stack']);if(_0x33b88f['name']){delete _0x33b88f[_0x084a('0x2d')];}_0x4874fe[_0x084a('0x1f')](_0x52227a)[_0x084a('0x2e')](_0x33b88f);};}function getInteractionUsers(_0x2c4149,_0x3be7a6){return new BPromise(function(_0x25a2a1,_0x378de6){try{if(_0x3be7a6[_0x2c4149['id']]){_0x2c4149[_0x084a('0x2f')]=_['map'](_0x3be7a6[_0x2c4149['id']],function(_0x2ed3cd){return{'id':_0x2ed3cd['id'],'fullname':_0x2ed3cd[_0x084a('0x30')]};});}}catch(_0x501a16){_0x378de6(_0x501a16);}_0x25a2a1(_0x2c4149);});}function getInteractionTags(_0xe1980b,_0x24bcf5){return new BPromise(function(_0x225000,_0x19937c){try{if(_0xe1980b[_0x084a('0x31')]){_0xe1980b[_0x084a('0x32')]=[];_0xe1980b[_0x084a('0x31')][_0x084a('0x33')](',')[_0x084a('0x34')](function(_0x2f59a6){_0xe1980b[_0x084a('0x32')][_0x084a('0x35')](_0x24bcf5[_0x2f59a6]);});}delete _0xe1980b[_0x084a('0x31')];}catch(_0x49c9db){_0x19937c(_0x49c9db);}_0x225000(_0xe1980b);});}function getLastMessageText(_0x54ff9b){return new BPromise(function(_0x1ecc73,_0x282fcc){return db[_0x084a('0x36')][_0x084a('0x37')]({'where':{'id':_0x54ff9b['id']},'attributes':[_0x084a('0x38'),'lastMsgText'],'raw':!![]})[_0x084a('0x2a')](function(_0x1b56ad){if(!_0x1b56ad[_0x084a('0x39')]){_0x54ff9b['lastMsgText']=_[_0x084a('0x3a')](htmlToText[_0x084a('0x3b')](_0x1b56ad[_0x084a('0x38')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x54ff9b['lastMsgText']=_0x1b56ad['lastMsgText'];}_0x1ecc73(_0x54ff9b);})['catch'](function(_0xf97d1b){_0x282fcc(_0xf97d1b);});});}function updateMailInteraction(_0x2e1806,_0x1444ed,_0x4e594f,_0x3c09c3){return new BPromise(function(_0x27e5bd,_0x3f9533){return getInteractionUsers(_0x2e1806,_0x4e594f)[_0x084a('0x2a')](function(_0x28a0a5){return getInteractionTags(_0x28a0a5,_0x1444ed);})[_0x084a('0x2a')](function(_0x175c64){if(_0x3c09c3){_0x27e5bd(getLastMessageText(_0x175c64));}else{_0x27e5bd(_0x175c64);}})[_0x084a('0x3c')](function(_0x434a06){_0x3f9533(_0x434a06);});});}exports[_0x084a('0x3d')]=function(_0x866960,_0x1454a9){var _0x284cdc={},_0x1659d3={},_0x10983f={'count':0x0,'rows':[]};var _0x597d87=_[_0x084a('0x3e')](db[_0x084a('0x36')][_0x084a('0x3f')],function(_0x37f630){return{'name':_0x37f630[_0x084a('0x40')],'type':_0x37f630[_0x084a('0x41')][_0x084a('0x42')]};});_0x1659d3[_0x084a('0x43')]=_[_0x084a('0x3e')](_0x597d87,'name');_0x1659d3[_0x084a('0x44')]=_[_0x084a('0x45')](_0x866960[_0x084a('0x44')]);_0x1659d3[_0x084a('0x46')]=_[_0x084a('0x47')](_0x1659d3[_0x084a('0x43')],_0x1659d3['query']);_0x284cdc[_0x084a('0x48')]=_[_0x084a('0x47')](_0x1659d3['model'],qs[_0x084a('0x49')](_0x866960[_0x084a('0x44')][_0x084a('0x49')]));_0x284cdc['attributes']=_0x284cdc[_0x084a('0x48')][_0x084a('0x4a')]?_0x284cdc['attributes']:_0x1659d3[_0x084a('0x43')];if(!_0x866960[_0x084a('0x44')]['hasOwnProperty']('nolimit')){_0x284cdc[_0x084a('0x22')]=qs[_0x084a('0x22')](_0x866960[_0x084a('0x44')][_0x084a('0x22')]);_0x284cdc[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x866960[_0x084a('0x44')][_0x084a('0x21')]);}_0x284cdc[_0x084a('0x4b')]=qs[_0x084a('0x4c')](_0x866960[_0x084a('0x44')]['sort']);_0x284cdc['where']=qs[_0x084a('0x46')](_[_0x084a('0x4d')](_0x866960[_0x084a('0x44')],_0x1659d3['filters']),_0x597d87);var _0x33b067=[];var _0x1598c4=squel[_0x084a('0x4e')]()[_0x084a('0x4f')]('id')[_0x084a('0x4f')]('name')[_0x084a('0x4f')]('color')[_0x084a('0x50')](_0x084a('0x51'));var _0x1ffd20=squel['select']()['field'](_0x084a('0x52'))[_0x084a('0x4f')]('u.fullname')[_0x084a('0x4f')](_0x084a('0x53'))[_0x084a('0x50')](_0x084a('0x54'),'ui')['left_join'](_0x084a('0x55'),'u',_0x084a('0x56'));var _0x31677b=squel[_0x084a('0x4e')]()['from'](_0x084a('0x57'),'i')[_0x084a('0x58')](_0x084a('0x59'),'c',_0x084a('0x5a'))['left_join']('users','o',_0x084a('0x5b'))[_0x084a('0x58')](_0x084a('0x5c'),'a',_0x084a('0x5d'))[_0x084a('0x58')](_0x084a('0x5e'),'me',_0x084a('0x5f'))[_0x084a('0x58')](_0x084a('0x60'),'it',_0x084a('0x61'))[_0x084a('0x58')](_0x084a('0x51'),'t','t.id\x20=\x20it.TagId');var _0xcdd5b=squel[_0x084a('0x62')]();var _0x29fa4b=[];var _0x39edc1=squel[_0x084a('0x62')]();var _0x1c972c;if(_0x866960[_0x084a('0x44')]['search']){_0x1c972c=as[_0x084a('0x63')](_0x866960[_0x084a('0x44')][_0x084a('0x64')]);var _0x54aa6c=_0x1c972c['sqlOperator'];for(var _0x424cd1=0x0;_0x424cd1<_0x1c972c['conditions'][_0x084a('0x4a')];_0x424cd1++){var _0x27278d=_0x1c972c['conditions'][_0x424cd1];var _0x36a3d3='i';var _0x54e9a5=_['find'](_0x597d87,[_0x084a('0x2d'),_0x27278d[_0x084a('0x4f')]]);if(!_0x54e9a5){switch(_0x27278d[_0x084a('0x4f')]){case _0x084a('0x65'):if(_0x27278d[_0x084a('0x66')]==0x1){_0x31677b[_0x084a('0x67')]('`'+_0x27278d[_0x084a('0x4f')]+'`\x20=\x200');}else{_0x31677b[_0x084a('0x67')]('`'+_0x27278d[_0x084a('0x4f')]+_0x084a('0x68'));}break;case'Contact':if(_0x27278d[_0x084a('0x69')]===_0x084a('0x6a')){if(_0x27278d[_0x084a('0x66')][_0x084a('0x33')]('\x20')['length']>0x1){_0xcdd5b[_0x54aa6c](_0x084a('0x6b'),qs['getFullTextValue'](_0x27278d[_0x084a('0x66')]),null);}else{var _0x2da4d4='%'+_0x27278d[_0x084a('0x66')]+'%';_0xcdd5b[_0x54aa6c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2da4d4,_0x2da4d4,_0x2da4d4);}}else{_0x54e9a5=_['find'](_0x597d87,[_0x084a('0x2d'),_0x084a('0x6c')]);_0x27278d['field']=_0x084a('0x6c');_0x3a8192=as['buildExpression'](_0x36a3d3,_0x54e9a5['type'],_0x27278d);_0xcdd5b[_0x54aa6c](_0x3a8192[_0x084a('0x6d')],_0x3a8192[_0x084a('0x66')][_0x084a('0x6e')],_0x3a8192[_0x084a('0x66')][_0x084a('0x2c')]);}break;case _0x084a('0x6f'):var _0x3f2c41=_0x27278d[_0x084a('0x66')][_0x084a('0x33')](',')['map'](function(_0x445563){return Number(_0x445563);});_0x3f2c41[_0x084a('0x34')](function(_0x3668eb){_0x39edc1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3668eb+',%');});_0x29fa4b=_[_0x084a('0x70')](_0x29fa4b,_0x3f2c41);break;case _0x084a('0x71'):if(_0x27278d['operator']===_0x084a('0x6a')){_0xcdd5b[_0x54aa6c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x27278d['value']+'%',null);}else{_0x54e9a5=_[_0x084a('0x72')](_0x597d87,['name','UserId']);_0x27278d[_0x084a('0x4f')]=_0x084a('0x73');_0x3a8192=as[_0x084a('0x74')](_0x36a3d3,_0x54e9a5['type'],_0x27278d);_0xcdd5b[_0x54aa6c](_0x3a8192[_0x084a('0x6d')],_0x3a8192[_0x084a('0x66')][_0x084a('0x6e')],_0x3a8192[_0x084a('0x66')][_0x084a('0x2c')]);}break;case _0x084a('0x75'):_0x3a8192=as[_0x084a('0x74')]('me',null,_0x27278d);_0xcdd5b[_0x54aa6c](_0x3a8192['text'],_0x3a8192['value'][_0x084a('0x6e')],_0x3a8192[_0x084a('0x66')]['end']);break;}}else{var _0x3a8192=as[_0x084a('0x74')](_0x36a3d3,_0x54e9a5[_0x084a('0x41')],_0x27278d);_0xcdd5b[_0x54aa6c](_0x3a8192[_0x084a('0x6d')],_0x3a8192['value'][_0x084a('0x6e')],_0x3a8192[_0x084a('0x66')][_0x084a('0x2c')]);}}}else{var _0x5a9bfe=_(_0x866960['query'])[_0x084a('0x45')]()[_0x084a('0x3e')](function(_0x2a6331){return _[_0x084a('0x76')](_0x597d87,[_0x084a('0x2d'),_0x2a6331])?_0x2a6331:undefined;})[_0x084a('0x77')]()[_0x084a('0x66')]();if(!_['isEmpty'](_0x5a9bfe)){_0x5a9bfe[_0x084a('0x34')](function(_0x51a066){if(_0x51a066==='MailAccountId'){_0x31677b[_0x084a('0x78')](_0x084a('0x79'),[][_0x084a('0x7a')](_0x866960['query'][_0x51a066]));}else if(_0x51a066===_0x084a('0x7b')){var _0x57729c=JSON[_0x084a('0x7c')](_0x866960[_0x084a('0x44')][_0x51a066])[_0x084a('0x7d')];var _0x12cef4=JSON[_0x084a('0x7c')](_0x866960[_0x084a('0x44')][_0x51a066])['$lte'];_0x31677b['where'](_0x084a('0x7e'),_0x57729c,_0x12cef4);}else{if(_0x866960[_0x084a('0x44')][_0x51a066]===_0x084a('0x7f')){_0x31677b[_0x084a('0x78')]('i.'+_0x51a066+_0x084a('0x80'));}else{_0x31677b[_0x084a('0x78')]('i.'+_0x51a066+'\x20=\x20?',_0x866960[_0x084a('0x44')][_0x51a066]);}}});}if(_0x866960[_0x084a('0x44')][_0x084a('0x81')]){if(_0x866960[_0x084a('0x44')][_0x084a('0x81')]==0x1){_0x31677b[_0x084a('0x67')](_0x084a('0x82'));}else{_0x31677b['having'](_0x084a('0x83'));}}if(_0x866960[_0x084a('0x44')][_0x084a('0x84')]){_0x29fa4b=_[_0x084a('0x85')](_0x866960[_0x084a('0x44')][_0x084a('0x84')])?_0x866960[_0x084a('0x44')][_0x084a('0x84')]:new Array(_0x866960[_0x084a('0x44')][_0x084a('0x84')]);_0x29fa4b['forEach'](function(_0x5d22aa){_0x39edc1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5d22aa+',%');});}if(_0x866960[_0x084a('0x44')][_0x084a('0x86')]){var _0x5a73ed=_0x866960[_0x084a('0x44')][_0x084a('0x86')][_0x084a('0x87')]('\x5c','\x5c\x5c')[_0x084a('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5a73ed)){_0xcdd5b['or']('i.id\x20LIKE\x20?',_0x5a73ed+'%');}else if(qs[_0x084a('0x88')](_0x5a73ed)){_0xcdd5b['or'](_0x084a('0x89'),_0x5a73ed+'%');}else{_0xcdd5b['or'](_0x084a('0x8a'),qs[_0x084a('0x8b')](_0x5a73ed))['or'](_0x084a('0x8c'),qs[_0x084a('0x8b')](_0x5a73ed));}}}_0x31677b[_0x084a('0x78')](_0xcdd5b);_0x31677b['group'](_0x084a('0x8d'));var _0xd14cab={'type':db[_0x084a('0x8e')][_0x084a('0x8f')][_0x084a('0x90')],'raw':!![]};var _0x31b89a=_0x31677b[_0x084a('0x91')]();_0x31b89a['field'](_0x084a('0x8d'));_0x31b89a[_0x084a('0x4f')](_0x084a('0x92'),_0x084a('0x65'));if(_0x284cdc[_0x084a('0x4b')]){_0x284cdc[_0x084a('0x4b')][_0x084a('0x34')](function(_0x7ca856){var _0x3da502=_0x7ca856[0x0]===_0x084a('0x93')?_0x7ca856[0x0]:'i.'+_0x7ca856[0x0];_0x31677b[_0x084a('0x4b')](_0x3da502,_0x7ca856[0x1]==='DESC'?![]:!![]);});}if(!_[_0x084a('0x94')](_0x29fa4b)){_0x31677b[_0x084a('0x67')](_0x39edc1);_0x31b89a['where'](_0x084a('0x95'),_0x29fa4b);}BPromise['resolve']()['then'](function(){if(!_0x1c972c){if(_0x866960[_0x084a('0x44')][_0x084a('0x96')])return;_0x31b89a['where'](_0x084a('0x97'));_0x31677b[_0x084a('0x78')](_0x084a('0x97'));return;}if(_0x866960[_0x084a('0x98')][_0x084a('0x99')]!==_0x084a('0x9a'))return;return _0x866960[_0x084a('0x98')][_0x084a('0x9b')]({'attributes':['id'],'raw':!![]})[_0x084a('0x2a')](function(_0x8074aa){if(_[_0x084a('0x94')](_0x8074aa)){_0x31b89a[_0x084a('0x78')](_0x084a('0x9c'));_0x31677b[_0x084a('0x78')](_0x084a('0x9c'));}else{_0x31b89a['where'](_0x084a('0x79'),_[_0x084a('0x3e')](_0x8074aa,'id'));_0x31677b[_0x084a('0x78')](_0x084a('0x79'),_[_0x084a('0x3e')](_0x8074aa,'id'));}});})[_0x084a('0x2a')](function(){if(_0x866960[_0x084a('0x98')][_0x084a('0x99')]==='agent'&&!_0x1c972c&&!_0x866960['query'][_0x084a('0x96')])return[];return db[_0x084a('0x9d')]['query'](_0x31b89a['toString'](),_0xd14cab);})[_0x084a('0x2a')](function(_0x496c2f){_0x10983f[_0x084a('0x20')]=_0x496c2f['length'];if(_0x10983f[_0x084a('0x20')]===0x0)return[];return db[_0x084a('0x9d')][_0x084a('0x44')](_0x1598c4[_0x084a('0x9e')](),_0xd14cab)['then'](function(_0x5ebbe8){_0x33b067=_['keyBy'](_0x5ebbe8,'id');_0xd14cab=_[_0x084a('0x9f')](_0xd14cab,{'model':db[_0x084a('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x866960[_0x084a('0x44')]['fields']){_0x284cdc[_0x084a('0x48')][_0x084a('0x34')](function(_0x59d977){_0x31677b[_0x084a('0x4f')]('i.'+_0x59d977);});}else{_0x31677b[_0x084a('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x084a('0x65'));_0x31677b[_0x084a('0x4f')](_0x084a('0xa0'),'Account.key');_0x31677b['field'](_0x084a('0xa1'),'Account.mandatoryDisposition');_0x31677b[_0x084a('0x4f')](_0x084a('0xa2'),_0x084a('0x93'));_0x31677b[_0x084a('0x4f')](_0x084a('0x8d'));_0x31677b[_0x084a('0x4f')]('i.createdAt');_0x31677b[_0x084a('0x4f')]('i.updatedAt');_0x31677b['field'](_0x084a('0xa3'));_0x31677b[_0x084a('0x4f')](_0x084a('0xa4'));_0x31677b[_0x084a('0x4f')](_0x084a('0xa5'));_0x31677b[_0x084a('0x4f')]('i.lastMsgAt');_0x31677b['field'](_0x084a('0xa6'));_0x31677b[_0x084a('0x4f')](_0x084a('0xa7'));_0x31677b['field'](_0x084a('0xa8'));_0x31677b[_0x084a('0x4f')]('i.secondDisposition');_0x31677b['field'](_0x084a('0xa9'));_0x31677b['field']('i.substatus');_0x31677b[_0x084a('0x4f')](_0x084a('0xaa'));_0x31677b['field'](_0x084a('0xab'));_0x31677b[_0x084a('0x4f')]('i.MailAccountId');_0x31677b[_0x084a('0x4f')](_0x084a('0xac'));_0x31677b[_0x084a('0x4f')](_0x084a('0xad'),_0x084a('0xae'));_0x31677b[_0x084a('0x4f')]('c.lastName','Contact.lastName');_0x31677b[_0x084a('0x4f')](_0x084a('0xaf'),'Contact.email');_0x31677b[_0x084a('0x4f')]('c.phone',_0x084a('0xb0'));_0x31677b[_0x084a('0x4f')](_0x084a('0xb1'),_0x084a('0xb2'));_0x31677b[_0x084a('0x4f')](_0x084a('0xb3'),'Contact.fax');_0x31677b['field'](_0x084a('0xb4'),_0x084a('0xb5'));_0x31677b[_0x084a('0x4f')](_0x084a('0xb6'),_0x084a('0xb7'));_0x31677b['field'](_0x084a('0xb8'),_0x084a('0x31'));}if(_0x284cdc[_0x084a('0x22')])_0x31677b[_0x084a('0x22')](_0x284cdc['limit']);if(_0x284cdc[_0x084a('0x21')])_0x31677b[_0x084a('0x21')](_0x284cdc[_0x084a('0x21')]);return db[_0x084a('0x9d')][_0x084a('0x44')](_0x31677b[_0x084a('0x9e')](),_0xd14cab);})[_0x084a('0x2a')](function(_0x8b4013){_0x1ffd20[_0x084a('0x78')](_0x084a('0xb9'),_[_0x084a('0x3e')](_0x8b4013,'id'));return db['sequelize']['query'](_0x1ffd20[_0x084a('0x9e')](),_0xd14cab)['then'](function(_0x3d8c48){var _0x41737e=_[_0x084a('0xba')](_0x3d8c48,_0x084a('0xbb'));var _0x9a5c6b=[];return db['Setting'][_0x084a('0x37')]({'attributes':[_0x084a('0xbc')],'raw':!![]})['then'](function(_0x439204){var _0x3e150d=_0x439204[_0x084a('0xbc')];_0x8b4013['forEach'](function(_0x3090b9){_0x9a5c6b[_0x084a('0x35')](updateMailInteraction(_0x3090b9,_0x33b067,_0x41737e,_0x3e150d));});return BPromise[_0x084a('0xbd')](_0x9a5c6b);});});});})[_0x084a('0x2a')](function(_0x318eca){_0x10983f[_0x084a('0xbe')]=_0x318eca;return _0x10983f;})[_0x084a('0x2a')](respondWithFilteredResult(_0x1454a9,_0x284cdc))[_0x084a('0x3c')](handleError(_0x1454a9,null));};exports['show']=function(_0x1de507,_0x1a58c6){var _0x355c04={'raw':![],'where':{'id':_0x1de507['params']['id']}},_0x8b89d0={};_0x8b89d0[_0x084a('0x43')]=_[_0x084a('0x45')](db[_0x084a('0x36')][_0x084a('0x3f')]);_0x8b89d0[_0x084a('0x44')]=_[_0x084a('0x45')](_0x1de507[_0x084a('0x44')]);_0x8b89d0['filters']=_[_0x084a('0x47')](_0x8b89d0[_0x084a('0x43')],_0x8b89d0[_0x084a('0x44')]);_0x355c04[_0x084a('0x48')]=_[_0x084a('0x47')](_0x8b89d0[_0x084a('0x43')],qs[_0x084a('0x49')](_0x1de507[_0x084a('0x44')][_0x084a('0x49')]));_0x355c04[_0x084a('0x48')]=_0x355c04[_0x084a('0x48')][_0x084a('0x4a')]?_0x355c04[_0x084a('0x48')]:_0x8b89d0[_0x084a('0x43')];if(_0x1de507[_0x084a('0x44')][_0x084a('0xbf')]){_0x355c04[_0x084a('0xc0')]=[{'all':!![]}];}_0x355c04=_['merge']({},_0x355c04,_0x1de507[_0x084a('0xc1')]);return db[_0x084a('0x36')][_0x084a('0x72')](_0x355c04)[_0x084a('0x2a')](handleEntityNotFound(_0x1a58c6,null))['then'](respondWithResult(_0x1a58c6,null))[_0x084a('0x3c')](handleError(_0x1a58c6,null));};exports[_0x084a('0xc2')]=function(_0x4662f9,_0x23df0c){return db[_0x084a('0x36')][_0x084a('0xc2')](_0x4662f9['body'],{})['then'](respondWithResult(_0x23df0c,0xc9))[_0x084a('0x3c')](handleError(_0x23df0c,null));};exports[_0x084a('0x29')]=function(_0x459907,_0x3b89f6){if(_0x459907[_0x084a('0xc3')]['id']){delete _0x459907[_0x084a('0xc3')]['id'];}return db[_0x084a('0x36')][_0x084a('0x72')]({'where':{'id':_0x459907['params']['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x3b89f6,null))[_0x084a('0x2a')](saveUpdates(_0x459907[_0x084a('0xc3')],null))[_0x084a('0x2a')](respondWithResult(_0x3b89f6,null))['catch'](handleError(_0x3b89f6,null));};exports['destroy']=function(_0x622764,_0x3ea85e){return db[_0x084a('0x36')][_0x084a('0x72')]({'where':{'id':_0x622764[_0x084a('0xc4')]['id']}})['then'](handleEntityNotFound(_0x3ea85e,null))['then'](removeEntity(_0x3ea85e,null))['catch'](handleError(_0x3ea85e,null));};exports[_0x084a('0xc5')]=function(_0x19aff1,_0x5dab17){return db[_0x084a('0x36')][_0x084a('0xc5')]()['then'](respondWithResult(_0x5dab17,null))[_0x084a('0x3c')](handleError(_0x5dab17,null));};exports[_0x084a('0xc6')]=function(_0x255b52,_0x565ae5,_0x157e31){return db[_0x084a('0xc7')][_0x084a('0x72')]({'where':{'id':_0x255b52[_0x084a('0xc4')]['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x565ae5,null))[_0x084a('0x2a')](function(_0x58b27b){if(_0x58b27b){return _0x58b27b[_0x084a('0xc6')](_0x255b52['body'][_0x084a('0xc8')],_['omit'](_0x255b52[_0x084a('0xc3')],[_0x084a('0xc8'),'id'])||{});}})[_0x084a('0x2a')](respondWithResult(_0x565ae5,null))[_0x084a('0x3c')](handleError(_0x565ae5,null));};exports[_0x084a('0xc9')]=function(_0x20d051,_0x3859d5,_0x1fb924){var _0x3ec164={'raw':![],'where':{}};var _0x33f4bd={};var _0xafff35={'count':0x0,'rows':[]};return db[_0x084a('0x36')]['findOne']({'where':{'id':_0x20d051[_0x084a('0xc4')]['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x3859d5,null))[_0x084a('0x2a')](function(_0x4725a0){if(_0x4725a0){_0x33f4bd[_0x084a('0x43')]=_[_0x084a('0x45')](db[_0x084a('0xc7')][_0x084a('0x3f')]);_0x33f4bd['query']=_['keys'](_0x20d051['query']);_0x33f4bd[_0x084a('0x46')]=_[_0x084a('0x47')](_0x33f4bd[_0x084a('0x43')],_0x33f4bd[_0x084a('0x44')]);_0x3ec164[_0x084a('0x48')]=_[_0x084a('0x47')](_0x33f4bd[_0x084a('0x43')],qs[_0x084a('0x49')](_0x20d051[_0x084a('0x44')][_0x084a('0x49')]));_0x3ec164[_0x084a('0x48')]=_0x3ec164[_0x084a('0x48')][_0x084a('0x4a')]?_0x3ec164[_0x084a('0x48')]:_0x33f4bd[_0x084a('0x43')];if(!_0x20d051[_0x084a('0x44')][_0x084a('0xca')](_0x084a('0xcb'))){_0x3ec164[_0x084a('0x22')]=qs[_0x084a('0x22')](_0x20d051[_0x084a('0x44')]['limit']);_0x3ec164[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x20d051[_0x084a('0x44')]['offset']);}_0x3ec164[_0x084a('0x4b')]=qs[_0x084a('0x4c')](_0x20d051[_0x084a('0x44')][_0x084a('0x4c')]);_0x3ec164['where']=qs[_0x084a('0x46')](_[_0x084a('0x4d')](_0x20d051['query'],_0x33f4bd[_0x084a('0x46')]));_0x3ec164['where']['MailInteractionId']=_0x4725a0['id'];if(_0x20d051[_0x084a('0x44')][_0x084a('0x86')]){_0x3ec164[_0x084a('0x78')]=_[_0x084a('0x9f')](_0x3ec164[_0x084a('0x78')],{'$or':_['map'](_0x3ec164[_0x084a('0x48')],function(_0x1efdfc){var _0x418564={};_0x418564[_0x1efdfc]={'$like':'%'+_0x20d051[_0x084a('0x44')][_0x084a('0x86')]+'%'};return _0x418564;})});}if(_0x20d051[_0x084a('0x44')]['$gte']){var _0xc77599=_0x20d051['query'][_0x084a('0x7d')][_0x084a('0x33')](',');var _0x409c4e={};_0x409c4e[_0xc77599[0x0]]={'$gte':moment(_0xc77599[0x1])[_0x084a('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3ec164['where']=_[_0x084a('0x9f')](_0x3ec164['where'],_0x409c4e);}_0x3ec164=_[_0x084a('0x9f')]({},_0x3ec164,_0x20d051[_0x084a('0xc1')]);return db[_0x084a('0xc7')][_0x084a('0x20')]({'where':_0x3ec164['where']})['then'](function(_0x56475e){_0xafff35['count']=_0x56475e;if(_0x20d051['query'][_0x084a('0xbf')]){_0x3ec164[_0x084a('0xc0')]=[{'all':!![]}];}return db[_0x084a('0xc7')][_0x084a('0xcd')](_0x3ec164);})[_0x084a('0x2a')](function(_0x35208f){if(_0x20d051[_0x084a('0x44')][_0x084a('0xce')]===_0x084a('0xcf')){for(var _0x5aecbc=0x0;_0x5aecbc<_0x35208f[_0x084a('0x4a')];_0x5aecbc++){_0x35208f[_0x5aecbc][_0x084a('0xc3')]=juice(_0x35208f[_0x5aecbc]['body']);}}_0xafff35[_0x084a('0xbe')]=_0x35208f;return _0xafff35;});}})[_0x084a('0x2a')](respondWithFilteredResult(_0x3859d5,_0x3ec164))[_0x084a('0x3c')](handleError(_0x3859d5,null));};exports[_0x084a('0xd0')]=function(_0x3d6b20,_0x1786fe,_0x53785c){return db[_0x084a('0x36')][_0x084a('0x72')]({'where':{'id':_0x3d6b20[_0x084a('0xc4')]['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x1786fe,null))[_0x084a('0x2a')](function(_0x4ff780){if(_0x4ff780){return _0x4ff780[_0x084a('0xd1')](_0x3d6b20['body'][_0x084a('0xc8')],_[_0x084a('0xd2')](_0x3d6b20[_0x084a('0xc3')],['ids','id'])||{})[_0x084a('0xd3')](function(){return db[_0x084a('0x6f')][_0x084a('0xcd')]({'attributes':['id',_0x084a('0x2d'),'color'],'where':{'id':_0x3d6b20[_0x084a('0xc3')][_0x084a('0xc8')]}});})[_0x084a('0x2a')](function(_0x2cb2c7){socket[_0x084a('0xd4')](_0x084a('0xd5'),{'id':Number(_0x3d6b20['params']['id']),'tags':_0x2cb2c7||[]});return{'id':Number(_0x3d6b20[_0x084a('0xc4')]['id']),'tags':_0x2cb2c7||[]};});}})[_0x084a('0x2a')](respondWithResult(_0x1786fe,null))[_0x084a('0x3c')](handleError(_0x1786fe,null));};exports['removeTags']=function(_0x47a8b8,_0x53406e,_0xdbc62a){return db[_0x084a('0x36')][_0x084a('0x72')]({'where':{'id':_0x47a8b8[_0x084a('0xc4')]['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x53406e,null))[_0x084a('0x2a')](function(_0x132d98){if(_0x132d98){return _0x132d98[_0x084a('0xd6')](_0x47a8b8['query'][_0x084a('0xc8')]);}})[_0x084a('0x2a')](respondWithStatusCode(_0x53406e,null))[_0x084a('0x3c')](handleError(_0x53406e,null));};exports[_0x084a('0xd7')]=function(_0x16d661,_0x38f42e){var _0x3cd38f=moment()['unix']()['toString']();var _0xee252d=path['join'](config['root'],_0x084a('0xd8'),_0x084a('0xd9'),_0x084a('0xda'));var _0x9c2089=path[_0x084a('0xdb')](config[_0x084a('0xdc')],_0x084a('0xd8'),_0x084a('0xd9'),_0x084a('0xdd'));var _0x5cf841=path[_0x084a('0xdb')](_0xee252d,_0x3cd38f);var _0x406fa2=util['format'](_0x084a('0xde'),_0x16d661[_0x084a('0xc4')]['id'],_0x3cd38f);var _0x596e44=path[_0x084a('0xdb')](_0xee252d,_0x406fa2);var _0x11c7e5=[];if(_0x16d661['query'][_0x084a('0xdd')]){_0x11c7e5[_0x084a('0x35')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x2c5097=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x084a('0xc3'),'from','to','cc',_0x084a('0xdf'),_0x084a('0xe0'),_0x084a('0x7b')],'where':{'secret':![]},'order':qs[_0x084a('0x4c')]('id'),'include':_0x11c7e5}];return db[_0x084a('0x36')][_0x084a('0x72')]({'where':{'id':_0x16d661[_0x084a('0xc4')]['id']},'include':_0x2c5097})[_0x084a('0x2a')](handleEntityNotFound(_0x38f42e,null))['then'](function(_0x14534d){if(_0x14534d&&_0x14534d[_0x084a('0xe1')]){var _0x58685b=_0x14534d['get']({'plain':!![]});fs[_0x084a('0xe2')](_0x5cf841);return BPromise['each'](_0x58685b[_0x084a('0xe1')],function(_0x503a6b,_0x287970){var _0x257358={'from':_0x503a6b[_0x084a('0x50')],'to':_0x503a6b['to'],'subject':_0x503a6b['subject'],'html':_0x503a6b[_0x084a('0xc3')],'headers':{'Date':moment(_0x503a6b[_0x084a('0x7b')])[_0x084a('0xcc')](_0x084a('0xe3'))},'attachments':[]};if(_0x503a6b['cc']){_0x257358['headers']['Cc']=_0x503a6b['cc'];}if(_0x503a6b['bcc']){_0x257358[_0x084a('0xe4')][_0x084a('0xe5')]=_0x503a6b[_0x084a('0xdf')];}return new BPromise(function(_0x1ae30a,_0x1e74cf){if(_0x503a6b[_0x084a('0xe6')]){for(var _0x548e23=0x0;_0x548e23<_0x503a6b['Attachments'][_0x084a('0x4a')];_0x548e23++){var _0xc47b46=_0x503a6b[_0x084a('0xe6')][_0x548e23];var _0x44d15f=path[_0x084a('0xdb')](_0x9c2089,_0xc47b46[_0x084a('0xe7')]);if(fs[_0x084a('0xe8')](_0x44d15f)){_0x257358[_0x084a('0xdd')][_0x084a('0x35')]({'name':_0xc47b46[_0x084a('0x2d')],'contentType':_0xc47b46['type'],'data':fs[_0x084a('0xe9')](_0x44d15f)});}}}emlformat[_0x084a('0xea')](_0x257358,function(_0x4ad0fc,_0x343216){if(_0x4ad0fc)return _0x1e74cf(_0x4ad0fc);fs[_0x084a('0xeb')](path[_0x084a('0xdb')](_0x5cf841,util[_0x084a('0xcc')]('message%d.eml',_0x287970)),_0x343216);return _0x1ae30a(_0x343216);});});})[_0x084a('0x2a')](function(){return new BPromise(function(_0x11e22e,_0xe59738){zipdir(_0x5cf841,{'saveTo':_0x596e44},function(_0x200513,_0x50b2b0){if(_0x200513)return _0xe59738(_0x200513);return _0x11e22e(_0x50b2b0);});})[_0x084a('0x2a')](function(){return new BPromise(function(_0x9aee10,_0x365495){rimraf(_0x5cf841,function(_0x315811){if(_0x315811)_0x365495(_0x315811);return _0x9aee10();});});})[_0x084a('0x2a')](function(){return _0x38f42e[_0x084a('0xd7')](_0x596e44,_0x406fa2,function(_0xe9c3d2){if(_0xe9c3d2){console['log']('err',_0xe9c3d2);}else{fs[_0x084a('0xec')](_0x596e44);}});});});}else{return _0x38f42e[_0x084a('0x1e')](0xc8);}})[_0x084a('0x3c')](handleError(_0x38f42e,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 71107d3..9cdf358 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 _0x84bd=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction'];(function(_0x63bee3,_0x527b34){var _0x22fff4=function(_0x1a4148){while(--_0x1a4148){_0x63bee3['push'](_0x63bee3['shift']());}};_0x22fff4(++_0x527b34);}(_0x84bd,0x9e));var _0xd84b=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x84bd[_0x4e7d25];return _0x526fe6;};'use strict';var EventEmitter=require(_0xd84b('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xd84b('0x1')];var MailMessage=require(_0xd84b('0x2'))['db'][_0xd84b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd84b('0x4')](0x0);var events={'afterCreate':_0xd84b('0x5'),'afterUpdate':_0xd84b('0x6'),'afterDestroy':_0xd84b('0x7')};function emitEvent(_0x217c23){return function(_0x531ee7,_0x3ff94b,_0x4f43f0){_0x531ee7[_0xd84b('0x8')]({'attributes':['id'],'raw':!![]})[_0xd84b('0x9')](function(_0xc90af4){_0x531ee7[_0xd84b('0xa')](_0xd84b('0xb'),_0xc90af4['map'](function(_0x135d87){return{'id':_0x135d87['id']};}));return MailMessage[_0xd84b('0xc')]({'where':{'MailInteractionId':_0x531ee7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd84b('0x9')](function(_0x5cab98){_0x531ee7[_0xd84b('0xa')](_0xd84b('0xd'),_0x5cab98[_0xd84b('0xe')]);MailInteractionEvents[_0xd84b('0xf')](_0x217c23+':'+_0x531ee7['id'],_0x531ee7);MailInteractionEvents[_0xd84b('0xf')](_0x217c23,_0x531ee7);_0x4f43f0(null);})[_0xd84b('0x10')](_0x4f43f0(null));};}for(var e in events){if(events[_0xd84b('0x11')](e)){var event=events[e];MailInteraction[_0xd84b('0x12')](e,emitEvent(event));}}module[_0xd84b('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0x0714=['emit','catch','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x159b72,_0x183756){var _0x4fa7b7=function(_0x43e36b){while(--_0x43e36b){_0x159b72['push'](_0x159b72['shift']());}};_0x4fa7b7(++_0x183756);}(_0x0714,0x1ea));var _0x4071=function(_0x48c8f4,_0xcc950d){_0x48c8f4=_0x48c8f4-0x0;var _0x1d1137=_0x0714[_0x48c8f4];return _0x1d1137;};'use strict';var EventEmitter=require(_0x4071('0x0'));var MailInteraction=require(_0x4071('0x1'))['db'][_0x4071('0x2')];var MailMessage=require(_0x4071('0x1'))['db'][_0x4071('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4071('0x4'),'afterDestroy':_0x4071('0x5')};function emitEvent(_0x182853){return function(_0x321595,_0x149251,_0x28d7f0){_0x321595[_0x4071('0x6')]({'attributes':['id'],'raw':!![]})[_0x4071('0x7')](function(_0x5087d4){_0x321595[_0x4071('0x8')](_0x4071('0x9'),_0x5087d4[_0x4071('0xa')](function(_0x22ab6b){return{'id':_0x22ab6b['id']};}));return MailMessage[_0x4071('0xb')]({'where':{'MailInteractionId':_0x321595['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4071('0x7')](function(_0x4c5da2){_0x321595[_0x4071('0x8')](_0x4071('0xc'),_0x4c5da2[_0x4071('0xd')]);MailInteractionEvents[_0x4071('0xe')](_0x182853+':'+_0x321595['id'],_0x321595);MailInteractionEvents[_0x4071('0xe')](_0x182853,_0x321595);_0x28d7f0(null);})[_0x4071('0xf')](_0x28d7f0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x4071('0x10')](e,emitEvent(event));}}module[_0x4071('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index dfbf3d8..023cbaa 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 _0xcbe1=['MailMessage','update','utf8mb4','utf8mb4_unicode_ci','util','request-promise','path','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatusAt','changed','models'];(function(_0x3b88d0,_0x5c74c3){var _0x30bb5c=function(_0x35eca2){while(--_0x35eca2){_0x3b88d0['push'](_0x3b88d0['shift']());}};_0x30bb5c(++_0x5c74c3);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xcbe1[_0x5275b8];return _0x568a9b;};'use strict';var _=require('lodash');var util=require(_0x1cbe('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1cbe('0x1'));var fs=require('fs');var path=require(_0x1cbe('0x2'));var rimraf=require('rimraf');var config=require(_0x1cbe('0x3'));var attributes=require('./mailInteraction.attributes');module[_0x1cbe('0x4')]=function(_0x168121,_0x5603f7){return _0x168121[_0x1cbe('0x5')](_0x1cbe('0x6'),attributes,{'tableName':_0x1cbe('0x7'),'paranoid':![],'indexes':[{'name':_0x1cbe('0x8'),'fields':[_0x1cbe('0x9'),'to'],'type':_0x1cbe('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45e737,_0x42232d,_0x5af288){if(_0x45e737[_0x1cbe('0xb')]){_0x45e737['substatusAt']=moment()[_0x1cbe('0xc')](_0x1cbe('0xd'));}if(_0x45e737[_0x1cbe('0xe')]){_0x45e737[_0x1cbe('0xf')]=moment()['format'](_0x1cbe('0xd'));}_0x5af288(null,_0x42232d);},'beforeUpdate':function(_0x50d9cd,_0xa42aa7,_0x15f8a9){if(_0x50d9cd['changed'](_0x1cbe('0xb'))){_0x50d9cd[_0x1cbe('0x10')]=_0x50d9cd[_0x1cbe('0xb')]?moment()['format'](_0x1cbe('0xd')):null;}if(_0x50d9cd[_0x1cbe('0x11')](_0x1cbe('0xe'))){_0x50d9cd[_0x1cbe('0xf')]=moment()[_0x1cbe('0xc')](_0x1cbe('0xd'));_0x50d9cd[_0x1cbe('0xb')]=null;_0x50d9cd[_0x1cbe('0x10')]=null;}_0x15f8a9(null,_0x50d9cd);},'afterUpdate':function(_0x109cd7,_0x41eec7,_0x4fd646){var _0x228488=_0x168121[_0x1cbe('0x12')];var _0x244a1d=_0x109cd7['get']({'plain':!![]});if(_0x244a1d[_0x1cbe('0xe')]){return _0x228488[_0x1cbe('0x13')][_0x1cbe('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x244a1d['id']}})['then'](function(){_0x4fd646();})['catch'](function(_0x30a154){_0x4fd646(_0x30a154);});}else{_0x4fd646();}}},'charset':_0x1cbe('0x15'),'collate':_0x1cbe('0x16')});}; \ No newline at end of file +var _0x657b=['api','moment','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','substatusAt','models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x393b5e,_0x86d273){var _0x1dd58f=function(_0x4d9b6a){while(--_0x4d9b6a){_0x393b5e['push'](_0x393b5e['shift']());}};_0x1dd58f(++_0x86d273);}(_0x657b,0x131));var _0xb657=function(_0x5916c6,_0x329433){_0x5916c6=_0x5916c6-0x0;var _0x4389d3=_0x657b[_0x5916c6];return _0x4389d3;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var logger=require(_0xb657('0x2'))(_0xb657('0x3'));var moment=require(_0xb657('0x4'));var BPromise=require('bluebird');var rp=require(_0xb657('0x5'));var fs=require('fs');var path=require(_0xb657('0x6'));var rimraf=require('rimraf');var config=require(_0xb657('0x7'));var attributes=require(_0xb657('0x8'));module[_0xb657('0x9')]=function(_0x25738d,_0x446b17){return _0x25738d['define'](_0xb657('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xb657('0xb'),'fields':[_0xb657('0xc'),'to'],'type':_0xb657('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ffc8e,_0x36b334,_0x490220){if(_0x4ffc8e[_0xb657('0xe')]){_0x4ffc8e['substatusAt']=moment()[_0xb657('0xf')](_0xb657('0x10'));}if(_0x4ffc8e[_0xb657('0x11')]){_0x4ffc8e['closedAt']=moment()[_0xb657('0xf')](_0xb657('0x10'));}_0x490220(null,_0x36b334);},'beforeUpdate':function(_0x193129,_0x169c29,_0x51228b){if(_0x193129[_0xb657('0x12')](_0xb657('0xe'))){_0x193129['substatusAt']=_0x193129[_0xb657('0xe')]?moment()[_0xb657('0xf')](_0xb657('0x10')):null;}if(_0x193129[_0xb657('0x12')]('closed')){_0x193129[_0xb657('0x13')]=moment()[_0xb657('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x193129['substatus']=null;_0x193129[_0xb657('0x14')]=null;}_0x51228b(null,_0x193129);},'afterUpdate':function(_0xbde891,_0x2c1fb7,_0x9dc84c){var _0x17c045=_0x25738d[_0xb657('0x15')];var _0x20919b=_0xbde891[_0xb657('0x16')]({'plain':!![]});if(_0x20919b[_0xb657('0x11')]){return _0x17c045[_0xb657('0x17')][_0xb657('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x20919b['id']}})['then'](function(){_0x9dc84c();})[_0xb657('0x19')](function(_0x12f79e){_0x9dc84c(_0x12f79e);});}else{_0x9dc84c();}}},'charset':_0xb657('0x1a'),'collate':_0xb657('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f08d150..35d6f6f 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 _0x22a4=['MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','find','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','debug','error','code'];(function(_0x20f502,_0x30130d){var _0x5ddceb=function(_0x3d427a){while(--_0x3d427a){_0x20f502['push'](_0x20f502['shift']());}};_0x5ddceb(++_0x30130d);}(_0x22a4,0x1cb));var _0x422a=function(_0x14a07a,_0xdf5495){_0x14a07a=_0x14a07a-0x0;var _0x2b609c=_0x22a4[_0x14a07a];return _0x2b609c;};'use strict';var _=require(_0x422a('0x0'));var util=require(_0x422a('0x1'));var moment=require(_0x422a('0x2'));var BPromise=require(_0x422a('0x3'));var rs=require(_0x422a('0x4'));var fs=require('fs');var Redis=require(_0x422a('0x5'));var db=require(_0x422a('0x6'))['db'];var utils=require(_0x422a('0x7'));var logger=require('../../config/logger')(_0x422a('0x8'));var config=require(_0x422a('0x9'));var jayson=require(_0x422a('0xa'));var client=jayson[_0x422a('0xb')][_0x422a('0xc')]({'port':0x232a});config['redis']=_[_0x422a('0xd')](config[_0x422a('0xe')],{'host':_0x422a('0xf'),'port':0x18eb});var socket=require(_0x422a('0x10'))(new Redis(config[_0x422a('0xe')]));require(_0x422a('0x11'))[_0x422a('0x12')](socket);function respondWithRpcPromise(_0x29caa4,_0x4b76b7,_0x4fef05){return new BPromise(function(_0x336959,_0x2eed9c){return client[_0x422a('0x13')](_0x29caa4,_0x4fef05)[_0x422a('0x14')](function(_0x78810){logger[_0x422a('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4b76b7,'request\x20sent');logger[_0x422a('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4b76b7,'request\x20sent',JSON['stringify'](_0x78810));if(_0x78810[_0x422a('0x17')]){if(_0x78810[_0x422a('0x17')][_0x422a('0x18')]===0x1f4){logger[_0x422a('0x17')](_0x422a('0x19'),_0x4b76b7,_0x78810[_0x422a('0x17')][_0x422a('0x1a')]);return _0x2eed9c(_0x78810[_0x422a('0x17')][_0x422a('0x1a')]);}logger[_0x422a('0x17')](_0x422a('0x19'),_0x4b76b7,_0x78810[_0x422a('0x17')][_0x422a('0x1a')]);return _0x336959(_0x78810[_0x422a('0x17')][_0x422a('0x1a')]);}else{logger[_0x422a('0x15')](_0x422a('0x19'),_0x4b76b7,'request\x20sent');_0x336959(_0x78810[_0x422a('0x1b')][_0x422a('0x1a')]);}})['catch'](function(_0x26bce9){logger['error']('MailInteraction,\x20%s,\x20%s',_0x4b76b7,_0x26bce9);_0x2eed9c(_0x26bce9);});});}exports[_0x422a('0x1c')]=function(_0xf84def){var _0x12d913=this;return new Promise(function(_0x1b69ca,_0x194c25){return db[_0x422a('0x1d')][_0x422a('0x1e')](_0xf84def[_0x422a('0x1f')],{'raw':_0xf84def['options']?_0xf84def[_0x422a('0x20')][_0x422a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf84def[_0x422a('0x20')]?_0xf84def[_0x422a('0x20')][_0x422a('0x22')]||null:null,'attributes':_0xf84def['options']?_0xf84def[_0x422a('0x20')][_0x422a('0x23')]||null:null,'limit':_0xf84def[_0x422a('0x20')]?_0xf84def['options'][_0x422a('0x24')]||null:null})[_0x422a('0x14')](function(_0x1fd126){logger[_0x422a('0x15')](_0x422a('0x1c'),_0xf84def);logger[_0x422a('0x16')](_0x422a('0x1c'),_0xf84def,JSON[_0x422a('0x25')](_0x1fd126));_0x1b69ca(_0x1fd126);})['catch'](function(_0x911cc9){logger[_0x422a('0x17')]('UpdateMailInteraction',_0x911cc9[_0x422a('0x1a')],_0xf84def);_0x194c25(_0x12d913['error'](0x1f4,_0x911cc9[_0x422a('0x1a')]));});});};exports[_0x422a('0x26')]=function(_0x3c2e5b){return new Promise(function(_0x24b6ec,_0x4badf8){return db[_0x422a('0x1d')][_0x422a('0x27')]({'where':_0x3c2e5b['options']?_0x3c2e5b['options'][_0x422a('0x22')]||null:null})[_0x422a('0x14')](function(_0x5e6218){if(_0x5e6218){return _0x5e6218['addTags'](_0x3c2e5b['body']['ids'],_['omit'](_0x3c2e5b[_0x422a('0x1f')],[_0x422a('0x28'),'id'])||{});}})[_0x422a('0x29')](function(_0x2aaa9c){logger[_0x422a('0x15')]('AddTags',_0x3c2e5b);logger[_0x422a('0x16')](_0x422a('0x2a'),_0x3c2e5b,JSON[_0x422a('0x25')](_0x2aaa9c));_0x24b6ec(_0x2aaa9c);})[_0x422a('0x2b')](function(_0x38a85a){logger[_0x422a('0x17')](_0x422a('0x2a'),_0x38a85a['message'],_0x3c2e5b);_0x4badf8(_this[_0x422a('0x17')](0x1f4,_0x38a85a[_0x422a('0x1a')]));});});}; \ No newline at end of file +var _0x69e6=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','MailInteraction,\x20%s,\x20%s','error','message','result','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','ids','omit','AddTags','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69e6,0x1e0));var _0x669e=function(_0x184aa9,_0x283c03){_0x184aa9=_0x184aa9-0x0;var _0x967354=_0x69e6[_0x184aa9];return _0x967354;};'use strict';var _=require('lodash');var util=require(_0x669e('0x0'));var moment=require(_0x669e('0x1'));var BPromise=require(_0x669e('0x2'));var rs=require(_0x669e('0x3'));var fs=require('fs');var Redis=require(_0x669e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x669e('0x5'));var logger=require(_0x669e('0x6'))(_0x669e('0x7'));var config=require(_0x669e('0x8'));var jayson=require(_0x669e('0x9'));var client=jayson[_0x669e('0xa')][_0x669e('0xb')]({'port':0x232a});config[_0x669e('0xc')]=_[_0x669e('0xd')](config[_0x669e('0xc')],{'host':_0x669e('0xe'),'port':0x18eb});var socket=require(_0x669e('0xf'))(new Redis(config['redis']));require(_0x669e('0x10'))[_0x669e('0x11')](socket);function respondWithRpcPromise(_0x23b057,_0x50cbb6,_0x47d875){return new BPromise(function(_0x50ba7d,_0x2bbcbe){return client[_0x669e('0x12')](_0x23b057,_0x47d875)[_0x669e('0x13')](function(_0x438271){logger[_0x669e('0x14')]('MailInteraction,\x20%s,\x20%s',_0x50cbb6,'request\x20sent');logger[_0x669e('0x15')](_0x669e('0x16'),_0x50cbb6,_0x669e('0x17'),JSON[_0x669e('0x18')](_0x438271));if(_0x438271['error']){if(_0x438271['error'][_0x669e('0x19')]===0x1f4){logger['error'](_0x669e('0x1a'),_0x50cbb6,_0x438271[_0x669e('0x1b')][_0x669e('0x1c')]);return _0x2bbcbe(_0x438271['error'][_0x669e('0x1c')]);}logger[_0x669e('0x1b')](_0x669e('0x1a'),_0x50cbb6,_0x438271[_0x669e('0x1b')]['message']);return _0x50ba7d(_0x438271[_0x669e('0x1b')]['message']);}else{logger[_0x669e('0x14')](_0x669e('0x1a'),_0x50cbb6,_0x669e('0x17'));_0x50ba7d(_0x438271[_0x669e('0x1d')][_0x669e('0x1c')]);}})['catch'](function(_0x48c385){logger[_0x669e('0x1b')](_0x669e('0x1a'),_0x50cbb6,_0x48c385);_0x2bbcbe(_0x48c385);});});}exports['UpdateMailInteraction']=function(_0x133b2c){var _0x6bdb7a=this;return new Promise(function(_0xdc8b90,_0x2db156){return db['MailInteraction'][_0x669e('0x1e')](_0x133b2c[_0x669e('0x1f')],{'raw':_0x133b2c['options']?_0x133b2c[_0x669e('0x20')][_0x669e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133b2c[_0x669e('0x20')]?_0x133b2c['options'][_0x669e('0x22')]||null:null,'attributes':_0x133b2c[_0x669e('0x20')]?_0x133b2c[_0x669e('0x20')][_0x669e('0x23')]||null:null,'limit':_0x133b2c[_0x669e('0x20')]?_0x133b2c[_0x669e('0x20')][_0x669e('0x24')]||null:null})[_0x669e('0x13')](function(_0x4f0762){logger['info'](_0x669e('0x25'),_0x133b2c);logger['debug'](_0x669e('0x25'),_0x133b2c,JSON['stringify'](_0x4f0762));_0xdc8b90(_0x4f0762);})[_0x669e('0x26')](function(_0x372ea3){logger[_0x669e('0x1b')](_0x669e('0x25'),_0x372ea3[_0x669e('0x1c')],_0x133b2c);_0x2db156(_0x6bdb7a[_0x669e('0x1b')](0x1f4,_0x372ea3['message']));});});};exports[_0x669e('0x27')]=function(_0x12045){return new Promise(function(_0x1a994a,_0x139cd7){return db['MailInteraction'][_0x669e('0x28')]({'where':_0x12045[_0x669e('0x20')]?_0x12045[_0x669e('0x20')][_0x669e('0x22')]||null:null})['then'](function(_0x478127){if(_0x478127){return _0x478127['addTags'](_0x12045[_0x669e('0x1f')][_0x669e('0x29')],_[_0x669e('0x2a')](_0x12045[_0x669e('0x1f')],[_0x669e('0x29'),'id'])||{});}})['spread'](function(_0x1bf748){logger[_0x669e('0x14')](_0x669e('0x2b'),_0x12045);logger['debug'](_0x669e('0x2b'),_0x12045,JSON[_0x669e('0x18')](_0x1bf748));_0x1a994a(_0x1bf748);})[_0x669e('0x26')](function(_0x3835e0){logger['error'](_0x669e('0x2b'),_0x3835e0['message'],_0x12045);_0x139cd7(_this['error'](0x1f4,_0x3835e0[_0x669e('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e91e9e1..4854550 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 _0x1a2f=['remove','emit','removeListener','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x1a2f,0x10f));var _0xf1a2=function(_0x4c611e,_0x286d5e){_0x4c611e=_0x4c611e-0x0;var _0x5db420=_0x1a2f[_0x4c611e];return _0x5db420;};'use strict';var MailInteractionEvents=require(_0xf1a2('0x0'));var events=[_0xf1a2('0x1'),_0xf1a2('0x2'),'update'];function createListener(_0x42ff26,_0x4c838f){return function(_0x471ca2){_0x4c838f[_0xf1a2('0x3')](_0x42ff26,_0x471ca2);};}function removeListener(_0x135451,_0x2d1722){return function(){MailInteractionEvents[_0xf1a2('0x4')](_0x135451,_0x2d1722);};}exports['register']=function(_0x1814fd){for(var _0x55cc46=0x0,_0xd7c9a1=events[_0xf1a2('0x5')];_0x55cc46<_0xd7c9a1;_0x55cc46++){var _0x220c45=events[_0x55cc46];var _0x4f8386=createListener(_0xf1a2('0x6')+_0x220c45,_0x1814fd);MailInteractionEvents['on'](_0x220c45,_0x4f8386);}}; \ No newline at end of file +var _0x32d1=['emit','removeListener','./mailInteraction.events','save','remove','update'];(function(_0x3237f6,_0x52e6dd){var _0x26a719=function(_0x308f17){while(--_0x308f17){_0x3237f6['push'](_0x3237f6['shift']());}};_0x26a719(++_0x52e6dd);}(_0x32d1,0x110));var _0x132d=function(_0x4d3ca6,_0xc33ee5){_0x4d3ca6=_0x4d3ca6-0x0;var _0x46c604=_0x32d1[_0x4d3ca6];return _0x46c604;};'use strict';var MailInteractionEvents=require(_0x132d('0x0'));var events=[_0x132d('0x1'),_0x132d('0x2'),_0x132d('0x3')];function createListener(_0x5e134c,_0x2f2b97){return function(_0x541f6b){_0x2f2b97[_0x132d('0x4')](_0x5e134c,_0x541f6b);};}function removeListener(_0x10e13a,_0x3d5880){return function(){MailInteractionEvents[_0x132d('0x5')](_0x10e13a,_0x3d5880);};}exports['register']=function(_0x1560c3){for(var _0x7762e0=0x0,_0x3a4699=events['length'];_0x7762e0<_0x3a4699;_0x7762e0++){var _0x475200=events[_0x7762e0];var _0x387042=createListener('mailInteraction:'+_0x475200,_0x1560c3);MailInteractionEvents['on'](_0x475200,_0x387042);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ed6a8f4..67174ba 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 _0x7217=['mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail'];(function(_0x19b0d2,_0x54396f){var _0xa2893b=function(_0x7ed54f){while(--_0x7ed54f){_0x19b0d2['push'](_0x19b0d2['shift']());}};_0xa2893b(++_0x54396f);}(_0x7217,0x19e));var _0x7721=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7217[_0x37c22c];return _0x119d79;};'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 auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0x7')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller['download']);router[_0x7721('0xf')]('/',auth[_0x7721('0x8')](),interaction[_0x7721('0x10')](_0x7721('0x11'),_0x7721('0x12')),controller[_0x7721('0x13')]);router[_0x7721('0x14')](_0x7721('0xc'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x14')]('/:id/accept',auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);router[_0x7721('0x14')](_0x7721('0x17'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router[_0x7721('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7721('0x1a')]=router; \ No newline at end of file +var _0xe5b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','mail','create','put','update','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x5ed29d,_0x37adf2){var _0x5328e4=function(_0x203911){while(--_0x203911){_0x5ed29d['push'](_0x5ed29d['shift']());}};_0x5328e4(++_0x37adf2);}(_0xe5b3,0x133));var _0x3e5b=function(_0x6e92af,_0x11d8f1){_0x6e92af=_0x6e92af-0x0;var _0x148519=_0xe5b3[_0x6e92af];return _0x148519;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0x9')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller['show']);router['get'](_0x3e5b('0xe'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x10')]('/',auth[_0x3e5b('0xa')](),interaction['tracked'](_0x3e5b('0x11'),'mailmessage:create'),controller[_0x3e5b('0x12')]);router[_0x3e5b('0x13')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0x14')]);router[_0x3e5b('0x13')](_0x3e5b('0x15'),auth['isAuthenticated'](),controller[_0x3e5b('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x3e5b('0x17')]);router[_0x3e5b('0x18')](_0x3e5b('0xd'),auth['isAuthenticated'](),controller[_0x3e5b('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 a480ee7..7299adb 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 _0x5b9b=['TEXT','medium','BOOLEAN','out','long','INTEGER','DATE','ENUM','Email','Chat','sequelize','lodash','exports'];(function(_0x4f4381,_0x14e83b){var _0x2d7c4e=function(_0x4f120d){while(--_0x4f120d){_0x4f4381['push'](_0x4f4381['shift']());}};_0x2d7c4e(++_0x14e83b);}(_0x5b9b,0x142));var _0xb5b9=function(_0xbf43b3,_0x546a4e){_0xbf43b3=_0xbf43b3-0x0;var _0x3c063c=_0x5b9b[_0xbf43b3];return _0x3c063c;};'use strict';var Sequelize=require(_0xb5b9('0x0'));var _=require(_0xb5b9('0x1'));module[_0xb5b9('0x2')]={'body':{'type':Sequelize[_0xb5b9('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb5b9('0x3')](_0xb5b9('0x4'))},'read':{'type':Sequelize[_0xb5b9('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xb5b9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xb5b9('0x3')]('long')},'cc':{'type':Sequelize[_0xb5b9('0x3')](_0xb5b9('0x7'))},'bcc':{'type':Sequelize[_0xb5b9('0x3')](_0xb5b9('0x7'))},'subject':{'type':Sequelize[_0xb5b9('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xb5b9('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb5b9('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xb5b9('0x7'))},'originCc':{'type':Sequelize[_0xb5b9('0x3')](_0xb5b9('0x7'))},'originChannel':{'type':Sequelize[_0xb5b9('0xa')](_0xb5b9('0xb'),_0xb5b9('0xc')),'defaultValue':_0xb5b9('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x2669=['TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports'];(function(_0x16a758,_0x1828b5){var _0x45168b=function(_0x4606df){while(--_0x4606df){_0x16a758['push'](_0x16a758['shift']());}};_0x45168b(++_0x1828b5);}(_0x2669,0x1cb));var _0x9266=function(_0x3ef0be,_0x235ed9){_0x3ef0be=_0x3ef0be-0x0;var _0x5ed611=_0x2669[_0x3ef0be];return _0x5ed611;};'use strict';var Sequelize=require(_0x9266('0x0'));var _=require(_0x9266('0x1'));module[_0x9266('0x2')]={'body':{'type':Sequelize[_0x9266('0x3')](_0x9266('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9266('0x3')](_0x9266('0x5'))},'read':{'type':Sequelize[_0x9266('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9266('0x7')]('in',_0x9266('0x8')),'defaultValue':_0x9266('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9266('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x9266('0x3')]('long')},'cc':{'type':Sequelize[_0x9266('0x3')](_0x9266('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x9266('0x3')]},'sentAt':{'type':Sequelize[_0x9266('0xa')]},'attach':{'type':Sequelize[_0x9266('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9266('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9266('0xa')]},'originTo':{'type':Sequelize[_0x9266('0x3')](_0x9266('0x4'))},'originCc':{'type':Sequelize[_0x9266('0x3')](_0x9266('0x4'))},'originChannel':{'type':Sequelize[_0x9266('0x7')](_0x9266('0xc'),_0x9266('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 513a4c1..77f83d2 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x318ef9,_0x3b8e59){var _0x3d7a24=function(_0x435ea9){while(--_0x435ea9){_0x318ef9['push'](_0x318ef9['shift']());}};_0x3d7a24(++_0x3b8e59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xd10cc6,_0x386bfc){var _0x3cbc06=function(_0x149a31){while(--_0x149a31){_0xd10cc6['push'](_0xd10cc6['shift']());}};_0x3cbc06(++_0x386bfc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 01d98e6..15d7b42 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 _0x0fb5=['update','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0fb5,0xa5));var _0x50fb=function(_0x433747,_0x18e5aa){_0x433747=_0x433747-0x0;var _0x629f70=_0x0fb5[_0x433747];return _0x629f70;};'use strict';var EventEmitter=require(_0x50fb('0x0'));var MailMessage=require(_0x50fb('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x50fb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x50fb('0x3'),'afterDestroy':_0x50fb('0x4')};function emitEvent(_0x2e969a){return function(_0x307ea3,_0x3bfd83,_0x2141f3){MailMessageEvents[_0x50fb('0x5')](_0x2e969a+':'+_0x307ea3['id'],_0x307ea3);MailMessageEvents[_0x50fb('0x5')](_0x2e969a,_0x307ea3);_0x2141f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x50fb('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x2c03=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','save','update'];(function(_0x4d270e,_0x409796){var _0x377f75=function(_0x276518){while(--_0x276518){_0x4d270e['push'](_0x4d270e['shift']());}};_0x377f75(++_0x409796);}(_0x2c03,0x16d));var _0x32c0=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x2c03[_0xb0de07];return _0x4633d8;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x32c0('0x0'))['db'][_0x32c0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x32c0('0x2'),'afterUpdate':_0x32c0('0x3'),'afterDestroy':_0x32c0('0x4')};function emitEvent(_0x37cde7){return function(_0x450cf7,_0x408213,_0x386a00){MailMessageEvents[_0x32c0('0x5')](_0x37cde7+':'+_0x450cf7['id'],_0x450cf7);MailMessageEvents[_0x32c0('0x5')](_0x37cde7,_0x450cf7);_0x386a00(null);};}for(var e in events){if(events[_0x32c0('0x6')](e)){var event=events[e];MailMessage[_0x32c0('0x7')](e,emitEvent(event));}}module[_0x32c0('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 16086cb..1fa3e9e 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 _0x1cb3=['error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','direction','toLowerCase','out','isNil','UserId','MailInteractionId','then','update','createdAt','catch'];(function(_0x1d929a,_0xedf23){var _0x521437=function(_0x294bd4){while(--_0x294bd4){_0x1d929a['push'](_0x1d929a['shift']());}};_0x521437(++_0xedf23);}(_0x1cb3,0x1a6));var _0x31cb=function(_0x3691bf,_0x337821){_0x3691bf=_0x3691bf-0x0;var _0x4d9163=_0x1cb3[_0x3691bf];return _0x4d9163;};'use strict';var _=require(_0x31cb('0x0'));var util=require(_0x31cb('0x1'));var logger=require(_0x31cb('0x2'))(_0x31cb('0x3'));var moment=require(_0x31cb('0x4'));var BPromise=require(_0x31cb('0x5'));var rp=require(_0x31cb('0x6'));var htmlToText=require(_0x31cb('0x7'));var fs=require('fs');var path=require(_0x31cb('0x8'));var rimraf=require(_0x31cb('0x9'));var config=require(_0x31cb('0xa'));var attributes=require(_0x31cb('0xb'));module[_0x31cb('0xc')]=function(_0xe630c9,_0x2c89ef){return _0xe630c9[_0x31cb('0xd')](_0x31cb('0xe'),attributes,{'tableName':_0x31cb('0xf'),'paranoid':![],'indexes':[{'name':_0x31cb('0x10'),'fields':['messageId']},{'name':_0x31cb('0x11'),'fields':[_0x31cb('0x12'),'subject'],'type':_0x31cb('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x320ab3,_0x54704d,_0x34985d){if(_0x320ab3[_0x31cb('0x14')]){_0x320ab3['plainBody']=htmlToText[_0x31cb('0x15')](_0x320ab3[_0x31cb('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x34985d(null,_0x54704d);},'afterCreate':function(_0x58d83c,_0x144224,_0x58814e){var _0x1075c2=_0xe630c9[_0x31cb('0x16')];var _0x277f4b=_0x58d83c['get']({'plain':!![]});if(_0x277f4b[_0x31cb('0x17')][_0x31cb('0x18')]()==='in'||_0x277f4b[_0x31cb('0x17')][_0x31cb('0x18')]()===_0x31cb('0x19')&&!_0x277f4b['secret']&&!_[_0x31cb('0x1a')](_0x277f4b[_0x31cb('0x1b')])){_0x1075c2['MailInteraction']['findOne']({'where':{'id':_0x277f4b[_0x31cb('0x1c')]}})[_0x31cb('0x1d')](function(_0x14f231){if(_0x14f231){_0x14f231[_0x31cb('0x1e')]({'lastMsgAt':_0x277f4b[_0x31cb('0x1f')],'lastMsgDirection':_0x277f4b[_0x31cb('0x17')][_0x31cb('0x18')](),'lastMsgBody':_0x277f4b['body']});}})[_0x31cb('0x20')](function(_0x246f97){console[_0x31cb('0x21')](_0x246f97);});}_0x58814e();}},'charset':'utf8mb4','collate':_0x31cb('0x22')});}; \ No newline at end of file +var _0x8c0f=['findOne','MailInteractionId','update','catch','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x8c0f,0xa5));var _0xf8c0=function(_0x47a0d3,_0x2398b1){_0x47a0d3=_0x47a0d3-0x0;var _0x20d918=_0x8c0f[_0x47a0d3];return _0x20d918;};'use strict';var _=require('lodash');var util=require(_0xf8c0('0x0'));var logger=require(_0xf8c0('0x1'))('api');var moment=require(_0xf8c0('0x2'));var BPromise=require(_0xf8c0('0x3'));var rp=require(_0xf8c0('0x4'));var htmlToText=require(_0xf8c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8c0('0x6'));var config=require(_0xf8c0('0x7'));var attributes=require(_0xf8c0('0x8'));module[_0xf8c0('0x9')]=function(_0x3d8419,_0x5d9cf2){return _0x3d8419[_0xf8c0('0xa')](_0xf8c0('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xf8c0('0xc'),'fields':['messageId']},{'name':_0xf8c0('0xd'),'fields':[_0xf8c0('0xe'),_0xf8c0('0xf')],'type':_0xf8c0('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53ec12,_0x4b34ec,_0x102178){if(_0x53ec12[_0xf8c0('0x11')]){_0x53ec12[_0xf8c0('0xe')]=htmlToText[_0xf8c0('0x12')](_0x53ec12[_0xf8c0('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x102178(null,_0x4b34ec);},'afterCreate':function(_0x4c011d,_0x9f73ca,_0x872e3c){var _0x11231f=_0x3d8419[_0xf8c0('0x13')];var _0x2e7395=_0x4c011d[_0xf8c0('0x14')]({'plain':!![]});if(_0x2e7395['direction']['toLowerCase']()==='in'||_0x2e7395[_0xf8c0('0x15')][_0xf8c0('0x16')]()===_0xf8c0('0x17')&&!_0x2e7395[_0xf8c0('0x18')]&&!_[_0xf8c0('0x19')](_0x2e7395[_0xf8c0('0x1a')])){_0x11231f['MailInteraction'][_0xf8c0('0x1b')]({'where':{'id':_0x2e7395[_0xf8c0('0x1c')]}})['then'](function(_0x5c33c2){if(_0x5c33c2){_0x5c33c2[_0xf8c0('0x1d')]({'lastMsgAt':_0x2e7395['createdAt'],'lastMsgDirection':_0x2e7395[_0xf8c0('0x15')][_0xf8c0('0x16')](),'lastMsgBody':_0x2e7395[_0xf8c0('0x11')]});}})[_0xf8c0('0x1e')](function(_0x2492ea){console['error'](_0x2492ea);});}_0x872e3c();}},'charset':_0xf8c0('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c0cd391..d1ab48d 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 _0x9bde=['debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','MailMessage','create','body','options','raw','CreateMailMessage'];(function(_0x2b5eae,_0x5b557e){var _0x13fa1e=function(_0x4aa660){while(--_0x4aa660){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x13fa1e(++_0x5b557e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2ec070,_0x335f52){_0x2ec070=_0x2ec070-0x0;var _0x538ce2=_0x9bde[_0x2ec070];return _0x538ce2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});config[_0xe9bd('0xa')]=_[_0xe9bd('0xb')](config[_0xe9bd('0xa')],{'host':_0xe9bd('0xc'),'port':0x18eb});var socket=require(_0xe9bd('0xd'))(new Redis(config[_0xe9bd('0xa')]));require(_0xe9bd('0xe'))[_0xe9bd('0xf')](socket);function respondWithRpcPromise(_0x45c7ba,_0x581602,_0x5f36c8){return new BPromise(function(_0x3c8e95,_0x145521){return client[_0xe9bd('0x10')](_0x45c7ba,_0x5f36c8)['then'](function(_0x12c96e){logger[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));logger['debug'](_0xe9bd('0x14'),_0x581602,'request\x20sent',JSON[_0xe9bd('0x15')](_0x12c96e));if(_0x12c96e[_0xe9bd('0x16')]){if(_0x12c96e[_0xe9bd('0x16')]['code']===0x1f4){logger['error'](_0xe9bd('0x12'),_0x581602,_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);return _0x145521(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}logger[_0xe9bd('0x16')](_0xe9bd('0x12'),_0x581602,_0x12c96e['error'][_0xe9bd('0x17')]);return _0x3c8e95(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}else{logger['info'](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));_0x3c8e95(_0x12c96e[_0xe9bd('0x18')][_0xe9bd('0x17')]);}})['catch'](function(_0x20ec32){logger['error'](_0xe9bd('0x12'),_0x581602,_0x20ec32);_0x145521(_0x20ec32);});});}exports['CreateMailMessage']=function(_0x26aa4a){var _0x417113=this;return new Promise(function(_0x134c4e,_0x3dda13){return db[_0xe9bd('0x19')][_0xe9bd('0x1a')](_0x26aa4a[_0xe9bd('0x1b')],{'raw':_0x26aa4a['options']?_0x26aa4a[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x37aec1){logger['info'](_0xe9bd('0x1e'),_0x26aa4a);logger[_0xe9bd('0x1f')](_0xe9bd('0x1e'),_0x26aa4a,JSON[_0xe9bd('0x15')](_0x37aec1));_0x134c4e(_0x37aec1);})['catch'](function(_0x24cf25){logger[_0xe9bd('0x16')](_0xe9bd('0x1e'),_0x24cf25[_0xe9bd('0x17')],_0x26aa4a);_0x3dda13(_0x417113[_0xe9bd('0x16')](0x1f4,_0x24cf25[_0xe9bd('0x17')]));});});}; \ No newline at end of file +var _0x257e=['defaults','socket.io-emitter','./mailMessage.socket','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','CreateMailMessage','options','stringify','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis'];(function(_0x210580,_0x1329d5){var _0x477835=function(_0x202c95){while(--_0x202c95){_0x210580['push'](_0x210580['shift']());}};_0x477835(++_0x1329d5);}(_0x257e,0x1dc));var _0xe257=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x257e[_0x47a40b];return _0x19610c;};'use strict';var _=require('lodash');var util=require(_0xe257('0x0'));var moment=require(_0xe257('0x1'));var BPromise=require('bluebird');var rs=require(_0xe257('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe257('0x3'))['db'];var utils=require(_0xe257('0x4'));var logger=require(_0xe257('0x5'))(_0xe257('0x6'));var config=require('../../config/environment');var jayson=require(_0xe257('0x7'));var client=jayson[_0xe257('0x8')]['http']({'port':0x232a});config[_0xe257('0x9')]=_[_0xe257('0xa')](config[_0xe257('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe257('0xb'))(new Redis(config[_0xe257('0x9')]));require(_0xe257('0xc'))[_0xe257('0xd')](socket);function respondWithRpcPromise(_0x3fe048,_0x500c5e,_0x4cb090){return new BPromise(function(_0x2a7825,_0x3585c1){return client['request'](_0x3fe048,_0x4cb090)[_0xe257('0xe')](function(_0x79d4e8){logger['info'](_0xe257('0xf'),_0x500c5e,_0xe257('0x10'));logger[_0xe257('0x11')](_0xe257('0x12'),_0x500c5e,_0xe257('0x10'),JSON['stringify'](_0x79d4e8));if(_0x79d4e8[_0xe257('0x13')]){if(_0x79d4e8[_0xe257('0x13')]['code']===0x1f4){logger[_0xe257('0x13')](_0xe257('0xf'),_0x500c5e,_0x79d4e8[_0xe257('0x13')][_0xe257('0x14')]);return _0x3585c1(_0x79d4e8[_0xe257('0x13')][_0xe257('0x14')]);}logger[_0xe257('0x13')](_0xe257('0xf'),_0x500c5e,_0x79d4e8[_0xe257('0x13')]['message']);return _0x2a7825(_0x79d4e8[_0xe257('0x13')]['message']);}else{logger[_0xe257('0x15')]('MailMessage,\x20%s,\x20%s',_0x500c5e,'request\x20sent');_0x2a7825(_0x79d4e8[_0xe257('0x16')]['message']);}})['catch'](function(_0x510320){logger['error'](_0xe257('0xf'),_0x500c5e,_0x510320);_0x3585c1(_0x510320);});});}exports[_0xe257('0x17')]=function(_0x4ba2a0){var _0x5e9d21=this;return new Promise(function(_0x5c9aef,_0x34033d){return db['MailMessage']['create'](_0x4ba2a0['body'],{'raw':_0x4ba2a0['options']?_0x4ba2a0[_0xe257('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xe257('0xe')](function(_0x3a8bc6){logger[_0xe257('0x15')](_0xe257('0x17'),_0x4ba2a0);logger['debug']('CreateMailMessage',_0x4ba2a0,JSON[_0xe257('0x19')](_0x3a8bc6));_0x5c9aef(_0x3a8bc6);})[_0xe257('0x1a')](function(_0x59e7fa){logger['error'](_0xe257('0x17'),_0x59e7fa[_0xe257('0x14')],_0x4ba2a0);_0x34033d(_0x5e9d21[_0xe257('0x13')](0x1f4,_0x59e7fa[_0xe257('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a83c359..d9b8f5f 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 _0xdc1b=['removeListener','register','length','remove','emit'];(function(_0x3ce900,_0x447e66){var _0x3d4ca6=function(_0x3069d9){while(--_0x3069d9){_0x3ce900['push'](_0x3ce900['shift']());}};_0x3d4ca6(++_0x447e66);}(_0xdc1b,0x161));var _0xbdc1=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xdc1b[_0x38b14f];return _0x22a324;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0xbdc1('0x0'),'update'];function createListener(_0x2f52fa,_0x2b2a6f){return function(_0x12a990){_0x2b2a6f[_0xbdc1('0x1')](_0x2f52fa,_0x12a990);};}function removeListener(_0x224c0c,_0x57ad17){return function(){MailMessageEvents[_0xbdc1('0x2')](_0x224c0c,_0x57ad17);};}exports[_0xbdc1('0x3')]=function(_0x2b20ab){for(var _0x171a5f=0x0,_0x5957af=events[_0xbdc1('0x4')];_0x171a5f<_0x5957af;_0x171a5f++){var _0x4397dc=events[_0x171a5f];var _0x23570a=createListener('mailMessage:'+_0x4397dc,_0x2b20ab);MailMessageEvents['on'](_0x4397dc,_0x23570a);}}; \ No newline at end of file +var _0xc7b4=['register','length','./mailMessage.events','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0x4c7b('0x0'));var events=['save',_0x4c7b('0x1'),_0x4c7b('0x2')];function createListener(_0x5c11d0,_0x1f769d){return function(_0x9305d5){_0x1f769d[_0x4c7b('0x3')](_0x5c11d0,_0x9305d5);};}function removeListener(_0x2a8b1d,_0x109687){return function(){MailMessageEvents['removeListener'](_0x2a8b1d,_0x109687);};}exports[_0x4c7b('0x4')]=function(_0x2272e8){for(var _0x46532e=0x0,_0xc18bc6=events[_0x4c7b('0x5')];_0x46532e<_0xc18bc6;_0x46532e++){var _0x2c005a=events[_0x46532e];var _0x12467d=createListener('mailMessage:'+_0x2c005a,_0x2272e8);MailMessageEvents['on'](_0x2c005a,_0x12467d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8a3b2d1..cf8d291 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 _0xa104=['destroy','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete'];(function(_0x43fbc4,_0x18fcc5){var _0x4ab859=function(_0x386f66){while(--_0x386f66){_0x43fbc4['push'](_0x43fbc4['shift']());}};_0x4ab859(++_0x18fcc5);}(_0xa104,0x16f));var _0x4a10=function(_0x3e4e98,_0x455ea1){_0x3e4e98=_0x3e4e98-0x0;var _0x2759ed=_0xa104[_0x3e4e98];return _0x2759ed;};'use strict';var multer=require('multer');var util=require(_0x4a10('0x0'));var path=require(_0x4a10('0x1'));var timeout=require(_0x4a10('0x2'));var express=require(_0x4a10('0x3'));var router=express[_0x4a10('0x4')]();var auth=require(_0x4a10('0x5'));var interaction=require(_0x4a10('0x6'));var config=require(_0x4a10('0x7'));var controller=require('./mailQueue.controller');router[_0x4a10('0x8')]('/',auth[_0x4a10('0x9')](),controller[_0x4a10('0xa')]);router[_0x4a10('0x8')](_0x4a10('0xb'),auth[_0x4a10('0x9')](),controller[_0x4a10('0xc')]);router[_0x4a10('0x8')](_0x4a10('0xd'),auth[_0x4a10('0x9')](),controller[_0x4a10('0xe')]);router[_0x4a10('0x8')]('/:id/members',auth[_0x4a10('0x9')](),controller[_0x4a10('0xf')]);router['get'](_0x4a10('0x10'),auth[_0x4a10('0x9')](),controller[_0x4a10('0x11')]);router[_0x4a10('0x8')](_0x4a10('0x12'),auth['isAuthenticated'](),controller[_0x4a10('0x13')]);router[_0x4a10('0x14')]('/',auth[_0x4a10('0x9')](),controller[_0x4a10('0x15')]);router[_0x4a10('0x14')](_0x4a10('0x10'),auth[_0x4a10('0x9')](),controller['addTeams']);router[_0x4a10('0x14')]('/:id/users',auth[_0x4a10('0x9')](),controller[_0x4a10('0x16')]);router[_0x4a10('0x17')](_0x4a10('0xd'),auth[_0x4a10('0x9')](),controller['update']);router[_0x4a10('0x18')](_0x4a10('0xd'),auth[_0x4a10('0x9')](),controller[_0x4a10('0x19')]);router['delete'](_0x4a10('0x10'),auth['isAuthenticated'](),controller[_0x4a10('0x1a')]);router[_0x4a10('0x18')](_0x4a10('0x12'),auth[_0x4a10('0x9')](),controller['removeAgents']);module[_0x4a10('0x1b')]=router; \ No newline at end of file +var _0xb1f7=['index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x2a90a6,_0x4967d4){var _0x3422cf=function(_0x391351){while(--_0x391351){_0x2a90a6['push'](_0x2a90a6['shift']());}};_0x3422cf(++_0x4967d4);}(_0xb1f7,0xba));var _0x7b1f=function(_0x233c11,_0x1083e4){_0x233c11=_0x233c11-0x0;var _0x381729=_0xb1f7[_0x233c11];return _0x381729;};'use strict';var multer=require('multer');var util=require(_0x7b1f('0x0'));var path=require(_0x7b1f('0x1'));var timeout=require(_0x7b1f('0x2'));var express=require(_0x7b1f('0x3'));var router=express[_0x7b1f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7b1f('0x5'));var config=require(_0x7b1f('0x6'));var controller=require(_0x7b1f('0x7'));router[_0x7b1f('0x8')]('/',auth[_0x7b1f('0x9')](),controller[_0x7b1f('0xa')]);router['get']('/describe',auth[_0x7b1f('0x9')](),controller[_0x7b1f('0xb')]);router[_0x7b1f('0x8')](_0x7b1f('0xc'),auth[_0x7b1f('0x9')](),controller['show']);router[_0x7b1f('0x8')](_0x7b1f('0xd'),auth[_0x7b1f('0x9')](),controller[_0x7b1f('0xe')]);router[_0x7b1f('0x8')](_0x7b1f('0xf'),auth[_0x7b1f('0x9')](),controller[_0x7b1f('0x10')]);router[_0x7b1f('0x8')]('/:id/users',auth[_0x7b1f('0x9')](),controller[_0x7b1f('0x11')]);router[_0x7b1f('0x12')]('/',auth[_0x7b1f('0x9')](),controller['create']);router['post'](_0x7b1f('0xf'),auth['isAuthenticated'](),controller[_0x7b1f('0x13')]);router['post'](_0x7b1f('0x14'),auth[_0x7b1f('0x9')](),controller[_0x7b1f('0x15')]);router['put'](_0x7b1f('0xc'),auth['isAuthenticated'](),controller[_0x7b1f('0x16')]);router[_0x7b1f('0x17')](_0x7b1f('0xc'),auth[_0x7b1f('0x9')](),controller[_0x7b1f('0x18')]);router['delete'](_0x7b1f('0xf'),auth['isAuthenticated'](),controller[_0x7b1f('0x19')]);router[_0x7b1f('0x17')](_0x7b1f('0x14'),auth[_0x7b1f('0x9')](),controller[_0x7b1f('0x1a')]);module[_0x7b1f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f236350..a0521e9 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 _0x3f94=['STRING','INTEGER','ENUM','exports','name'];(function(_0x52215e,_0x3644bd){var _0x5e787c=function(_0x34415f){while(--_0x34415f){_0x52215e['push'](_0x52215e['shift']());}};_0x5e787c(++_0x3644bd);}(_0x3f94,0x11b));var _0x43f9=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x3f94[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require('sequelize');module[_0x43f9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x43f9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x43f9('0x2')]},'timeout':{'type':Sequelize[_0x43f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x43f9('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xf780=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf780,0x17f));var _0x0f78=function(_0x34824c,_0x34c9ce){_0x34824c=_0x34824c-0x0;var _0x4d92d8=_0xf780[_0x34824c];return _0x4d92d8;};'use strict';var Sequelize=require(_0x0f78('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f78('0x1')],'unique':_0x0f78('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0f78('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0f78('0x4')](_0x0f78('0x5'),_0x0f78('0x6'),_0x0f78('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1574593..02b7310 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 _0x8e3f=['mailPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','order','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','MailQueue','rawAttributes','key','map','query','keys','intersection','model','attributes','length','nolimit','sort','where','pick','filters','filter','merge','type','options','count','includeAll','include','findAll','catch','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserMailQueue','hasOwnProperty','MailQueueId','findAndCountAll','agent'];(function(_0x130d31,_0x5c4cc1){var _0x35b2f4=function(_0x5f4118){while(--_0x5f4118){_0x130d31['push'](_0x130d31['shift']());}};_0x35b2f4(++_0x5c4cc1);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xf8e3('0x0'));var emlformat=require(_0xf8e3('0x1'));var rimraf=require(_0xf8e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8e3('0x3'));var rp=require(_0xf8e3('0x4'));var moment=require(_0xf8e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8e3('0x6'));var util=require(_0xf8e3('0x7'));var path=require('path');var sox=require(_0xf8e3('0x8'));var csv=require(_0xf8e3('0x9'));var ejs=require(_0xf8e3('0xa'));var fs=require('fs');var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x9'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];config[_0xf8e3('0x1a')]=_[_0xf8e3('0x1b')](config[_0xf8e3('0x1a')],{'host':_0xf8e3('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8e3('0x1a')]));require(_0xf8e3('0x1d'))[_0xf8e3('0x1e')](socket);function respondWithStatusCode(_0x4af736,_0x44f631){_0x44f631=_0x44f631||0xcc;return function(_0x5136c6){if(_0x5136c6){return _0x4af736[_0xf8e3('0x1f')](_0x44f631);}return _0x4af736[_0xf8e3('0x20')](_0x44f631)[_0xf8e3('0x21')]();};}function respondWithResult(_0x570ee3,_0x529c92){_0x529c92=_0x529c92||0xc8;return function(_0x564f43){if(_0x564f43){return _0x570ee3[_0xf8e3('0x20')](_0x529c92)[_0xf8e3('0x22')](_0x564f43);}};}function respondWithFilteredResult(_0x3b01ac,_0x110a78){return function(_0x11d4cc){if(_0x11d4cc){var _0x7a81c3=_0x11d4cc['count'],_0x2e27e3=_0x110a78[_0xf8e3('0x23')],_0x1337ae=_0x110a78[_0xf8e3('0x23')]+_0x110a78[_0xf8e3('0x24')],_0x13fb31;if(_0x1337ae>=_0x7a81c3){_0x1337ae=_0x7a81c3;_0x13fb31=0xc8;}else{_0x13fb31=0xce;}_0x3b01ac[_0xf8e3('0x20')](_0x13fb31);return _0x3b01ac[_0xf8e3('0x25')](_0xf8e3('0x26'),_0x2e27e3+'-'+_0x1337ae+'/'+_0x7a81c3)[_0xf8e3('0x22')](_0x11d4cc);}return null;};}function patchUpdates(_0x3fff85){return function(_0x5b99b1){try{jsonpatch[_0xf8e3('0x27')](_0x5b99b1,_0x3fff85,!![]);}catch(_0x1351ca){return BPromise[_0xf8e3('0x28')](_0x1351ca);}return _0x5b99b1[_0xf8e3('0x29')]();};}function saveUpdates(_0x4a1e5f,_0x39df34){return function(_0x4b3705){if(_0x4b3705){return _0x4b3705[_0xf8e3('0x2a')](_0x4a1e5f)[_0xf8e3('0x2b')](function(_0x33d526){return _0x33d526;});}return null;};}function removeEntity(_0x2dc856,_0x1f4b68){return function(_0x3ac384){if(_0x3ac384){return _0x3ac384['destroy']()[_0xf8e3('0x2b')](function(){var _0x2fc674=_0x3ac384[_0xf8e3('0x2c')]({'plain':!![]});var _0x417b42=_0xf8e3('0x2d');return db[_0xf8e3('0x2e')][_0xf8e3('0x2f')]({'where':{'type':_0x417b42,'resourceId':_0x2fc674['id']}})[_0xf8e3('0x2b')](function(){return _0x3ac384;});})['then'](function(){_0x2dc856[_0xf8e3('0x20')](0xcc)[_0xf8e3('0x21')]();});}};}function handleEntityNotFound(_0x12ebd2,_0xc4f21a){return function(_0x15b28c){if(!_0x15b28c){_0x12ebd2[_0xf8e3('0x1f')](0x194);}return _0x15b28c;};}function handleError(_0x16485e,_0xfaf15d){_0xfaf15d=_0xfaf15d||0x1f4;return function(_0x4f2ae9){logger[_0xf8e3('0x30')](_0x4f2ae9[_0xf8e3('0x31')]);if(_0x4f2ae9[_0xf8e3('0x32')]){delete _0x4f2ae9[_0xf8e3('0x32')];}_0x16485e['status'](_0xfaf15d)[_0xf8e3('0x33')](_0x4f2ae9);};}exports[_0xf8e3('0x34')]=function(_0x40f64d,_0x45df49){var _0x33f208={},_0x46c85d={},_0xb9c26={'count':0x0,'rows':[]};var _0x18c8ae=_['map'](db[_0xf8e3('0x35')][_0xf8e3('0x36')],function(_0x4acd6c){return{'name':_0x4acd6c['fieldName'],'type':_0x4acd6c['type'][_0xf8e3('0x37')]};});_0x46c85d['model']=_[_0xf8e3('0x38')](_0x18c8ae,_0xf8e3('0x32'));_0x46c85d[_0xf8e3('0x39')]=_[_0xf8e3('0x3a')](_0x40f64d['query']);_0x46c85d['filters']=_[_0xf8e3('0x3b')](_0x46c85d[_0xf8e3('0x3c')],_0x46c85d[_0xf8e3('0x39')]);_0x33f208[_0xf8e3('0x3d')]=_[_0xf8e3('0x3b')](_0x46c85d[_0xf8e3('0x3c')],qs['fields'](_0x40f64d[_0xf8e3('0x39')]['fields']));_0x33f208['attributes']=_0x33f208[_0xf8e3('0x3d')][_0xf8e3('0x3e')]?_0x33f208[_0xf8e3('0x3d')]:_0x46c85d[_0xf8e3('0x3c')];if(!_0x40f64d['query']['hasOwnProperty'](_0xf8e3('0x3f'))){_0x33f208[_0xf8e3('0x24')]=qs['limit'](_0x40f64d[_0xf8e3('0x39')][_0xf8e3('0x24')]);_0x33f208[_0xf8e3('0x23')]=qs[_0xf8e3('0x23')](_0x40f64d['query']['offset']);}_0x33f208['order']=qs[_0xf8e3('0x40')](_0x40f64d[_0xf8e3('0x39')][_0xf8e3('0x40')]);_0x33f208[_0xf8e3('0x41')]=qs['filters'](_[_0xf8e3('0x42')](_0x40f64d['query'],_0x46c85d[_0xf8e3('0x43')]),_0x18c8ae);if(_0x40f64d[_0xf8e3('0x39')][_0xf8e3('0x44')]){_0x33f208[_0xf8e3('0x41')]=_[_0xf8e3('0x45')](_0x33f208[_0xf8e3('0x41')],{'$or':_[_0xf8e3('0x38')](_0x18c8ae,function(_0x2db5b5){if(_0x2db5b5[_0xf8e3('0x46')]!=='VIRTUAL'){var _0x211620={};_0x211620[_0x2db5b5['name']]={'$like':'%'+_0x40f64d[_0xf8e3('0x39')][_0xf8e3('0x44')]+'%'};return _0x211620;}})});}_0x33f208=_[_0xf8e3('0x45')]({},_0x33f208,_0x40f64d[_0xf8e3('0x47')]);var _0x64bfc6={'where':_0x33f208[_0xf8e3('0x41')]};return db[_0xf8e3('0x35')][_0xf8e3('0x48')](_0x64bfc6)['then'](function(_0x302d03){_0xb9c26[_0xf8e3('0x48')]=_0x302d03;if(_0x40f64d[_0xf8e3('0x39')][_0xf8e3('0x49')]){_0x33f208[_0xf8e3('0x4a')]=[{'all':!![]}];}return db[_0xf8e3('0x35')][_0xf8e3('0x4b')](_0x33f208);})[_0xf8e3('0x2b')](function(_0x5175c0){_0xb9c26['rows']=_0x5175c0;return _0xb9c26;})['then'](respondWithFilteredResult(_0x45df49,_0x33f208))[_0xf8e3('0x4c')](handleError(_0x45df49,null));};exports[_0xf8e3('0x4d')]=function(_0x5056bc,_0x181908){var _0x489f20={'raw':!![],'where':{'id':_0x5056bc[_0xf8e3('0x4e')]['id']}},_0x2daecf={};_0x2daecf['model']=_[_0xf8e3('0x3a')](db['MailQueue'][_0xf8e3('0x36')]);_0x2daecf[_0xf8e3('0x39')]=_['keys'](_0x5056bc[_0xf8e3('0x39')]);_0x2daecf[_0xf8e3('0x43')]=_[_0xf8e3('0x3b')](_0x2daecf[_0xf8e3('0x3c')],_0x2daecf['query']);_0x489f20['attributes']=_['intersection'](_0x2daecf[_0xf8e3('0x3c')],qs[_0xf8e3('0x4f')](_0x5056bc[_0xf8e3('0x39')]['fields']));_0x489f20[_0xf8e3('0x3d')]=_0x489f20['attributes'][_0xf8e3('0x3e')]?_0x489f20[_0xf8e3('0x3d')]:_0x2daecf['model'];if(_0x5056bc['query'][_0xf8e3('0x49')]){_0x489f20[_0xf8e3('0x4a')]=[{'all':!![]}];}_0x489f20=_[_0xf8e3('0x45')]({},_0x489f20,_0x5056bc[_0xf8e3('0x47')]);return db[_0xf8e3('0x35')][_0xf8e3('0x50')](_0x489f20)[_0xf8e3('0x2b')](handleEntityNotFound(_0x181908,null))[_0xf8e3('0x2b')](respondWithResult(_0x181908,null))[_0xf8e3('0x4c')](handleError(_0x181908,null));};exports[_0xf8e3('0x51')]=function(_0x3200a0,_0x4c1c31){return db[_0xf8e3('0x35')][_0xf8e3('0x51')](_0x3200a0[_0xf8e3('0x52')],{})[_0xf8e3('0x2b')](function(_0x385a8f){var _0x3256e6=_0x3200a0['user'][_0xf8e3('0x2c')]({'plain':!![]});if(!_0x3256e6)throw new Error(_0xf8e3('0x53'));if(_0x3256e6[_0xf8e3('0x54')]===_0xf8e3('0x55')){var _0x2ee5fb=_0x385a8f[_0xf8e3('0x2c')]({'plain':!![]});var _0x5855f2=_0xf8e3('0x2d');return db[_0xf8e3('0x56')][_0xf8e3('0x50')]({'where':{'name':_0x5855f2,'userProfileId':_0x3256e6[_0xf8e3('0x57')]},'raw':!![]})[_0xf8e3('0x2b')](function(_0x2fef16){if(_0x2fef16&&_0x2fef16['autoAssociation']===0x0){return db[_0xf8e3('0x2e')][_0xf8e3('0x51')]({'name':_0x2ee5fb[_0xf8e3('0x32')],'resourceId':_0x2ee5fb['id'],'type':_0x2fef16[_0xf8e3('0x32')],'sectionId':_0x2fef16['id']},{})[_0xf8e3('0x2b')](function(){return _0x385a8f;});}else{return _0x385a8f;}})['catch'](function(_0x337106){logger[_0xf8e3('0x30')](_0xf8e3('0x58'),_0x337106);throw _0x337106;});}return _0x385a8f;})['then'](respondWithResult(_0x4c1c31,0xc9))['catch'](handleError(_0x4c1c31,null));};exports[_0xf8e3('0x2a')]=function(_0x3886dc,_0x2a0c85){if(_0x3886dc[_0xf8e3('0x52')]['id']){delete _0x3886dc['body']['id'];}return db[_0xf8e3('0x35')][_0xf8e3('0x50')]({'where':{'id':_0x3886dc['params']['id']}})['then'](handleEntityNotFound(_0x2a0c85,null))[_0xf8e3('0x2b')](saveUpdates(_0x3886dc[_0xf8e3('0x52')],null))[_0xf8e3('0x2b')](respondWithResult(_0x2a0c85,null))['catch'](handleError(_0x2a0c85,null));};exports['destroy']=function(_0x4892e9,_0x182e9b){return db[_0xf8e3('0x35')]['find']({'where':{'id':_0x4892e9['params']['id']}})['then'](handleEntityNotFound(_0x182e9b,null))[_0xf8e3('0x2b')](removeEntity(_0x182e9b,null))[_0xf8e3('0x4c')](handleError(_0x182e9b,null));};exports['describe']=function(_0x3c3775,_0x21cd28){return db[_0xf8e3('0x35')]['describe']()['then'](respondWithResult(_0x21cd28,null))['catch'](handleError(_0x21cd28,null));};exports['getMembers']=function(_0x3390a1,_0x3b120a,_0x3ef144){var _0x447efe={'raw':!![],'where':{}},_0x442349={},_0x22e270;return db[_0xf8e3('0x35')][_0xf8e3('0x59')]({'where':{'id':_0x3390a1[_0xf8e3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b120a,null))['then'](function(_0x221aba){if(_0x221aba){_0x22e270=_0x221aba[_0xf8e3('0x2c')]({'plain':!![]});_0x442349[_0xf8e3('0x3c')]=_['keys'](db[_0xf8e3('0x5a')][_0xf8e3('0x36')]);_0x442349['query']=_['keys'](_0x3390a1[_0xf8e3('0x39')]);_0x442349[_0xf8e3('0x43')]=_[_0xf8e3('0x3b')](_0x442349[_0xf8e3('0x3c')],_0x442349['query']);_0x447efe['attributes']=_[_0xf8e3('0x3b')](_0x442349[_0xf8e3('0x3c')],qs[_0xf8e3('0x4f')](_0x3390a1[_0xf8e3('0x39')]['fields']));_0x447efe['attributes']=_0x447efe[_0xf8e3('0x3d')][_0xf8e3('0x3e')]?_0x447efe['attributes']:_0x442349[_0xf8e3('0x3c')];if(!_0x3390a1[_0xf8e3('0x39')][_0xf8e3('0x5b')](_0xf8e3('0x3f'))){_0x447efe['limit']=qs[_0xf8e3('0x24')](_0x3390a1['query'][_0xf8e3('0x24')]);_0x447efe[_0xf8e3('0x23')]=qs['offset'](_0x3390a1[_0xf8e3('0x39')][_0xf8e3('0x23')]);}_0x447efe['order']=qs[_0xf8e3('0x40')](_0x3390a1[_0xf8e3('0x39')][_0xf8e3('0x40')]);_0x447efe[_0xf8e3('0x41')]=qs['filters'](_[_0xf8e3('0x42')](_0x3390a1[_0xf8e3('0x39')],_0x442349[_0xf8e3('0x43')]));_0x447efe[_0xf8e3('0x41')][_0xf8e3('0x5c')]=_0x221aba['id'];if(_0x3390a1[_0xf8e3('0x39')][_0xf8e3('0x44')]){_0x447efe[_0xf8e3('0x41')]=_[_0xf8e3('0x45')](_0x447efe[_0xf8e3('0x41')],{'$or':_[_0xf8e3('0x38')](_0x447efe[_0xf8e3('0x3d')],function(_0x520ce0){var _0x52d91d={};_0x52d91d[_0x520ce0]={'$like':'%'+_0x3390a1[_0xf8e3('0x39')][_0xf8e3('0x44')]+'%'};return _0x52d91d;})});}_0x447efe=_['merge']({},_0x447efe,_0x3390a1[_0xf8e3('0x47')]);return db[_0xf8e3('0x5a')][_0xf8e3('0x4b')](_0x447efe);}})[_0xf8e3('0x2b')](function(_0x18a810){if(_0x18a810){return db['User'][_0xf8e3('0x5d')]({'where':{'id':_[_0xf8e3('0x38')](_0x18a810,'UserId'),'role':_0xf8e3('0x5e')},'attributes':['id','name',_0xf8e3('0x5f'),'updatedAt',_0xf8e3('0x60')]});}})[_0xf8e3('0x2b')](function(_0x45361d){if(_0x45361d){return{'count':_0x45361d[_0xf8e3('0x48')],'rows':_[_0xf8e3('0x38')](_0x45361d['rows'],function(_0x1b03af){return{'membername':_0x1b03af[_0xf8e3('0x32')],'UserId':_0x1b03af['id'],'queue_name':_0x22e270[_0xf8e3('0x32')],'MailQueueId':_0x22e270['id'],'interface':util[_0xf8e3('0x61')](_0xf8e3('0x62'),_0xf8e3('0x63'),_0x1b03af[_0xf8e3('0x32')]),'penalty':0x0,'paused':_0x1b03af[_0xf8e3('0x5f')],'createdAt':_0x1b03af[_0xf8e3('0x60')],'updatedAt':_0x1b03af[_0xf8e3('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf8e3('0x2b')](respondWithFilteredResult(_0x3b120a,_0x447efe))[_0xf8e3('0x4c')](handleError(_0x3b120a,null));};exports['getTeams']=function(_0x3de318,_0x280f06,_0x3dc049){var _0x4b69db={};var _0x292247={};var _0x2df5db;var _0x19f362;return db[_0xf8e3('0x35')][_0xf8e3('0x59')]({'where':{'id':_0x3de318[_0xf8e3('0x4e')]['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0x280f06,null))[_0xf8e3('0x2b')](function(_0x1bf948){if(_0x1bf948){_0x2df5db=_0x1bf948;_0x292247[_0xf8e3('0x3c')]=_[_0xf8e3('0x3a')](db[_0xf8e3('0x65')]['rawAttributes']);_0x292247[_0xf8e3('0x39')]=_[_0xf8e3('0x3a')](_0x3de318[_0xf8e3('0x39')]);_0x292247[_0xf8e3('0x43')]=_['intersection'](_0x292247['model'],_0x292247[_0xf8e3('0x39')]);_0x4b69db[_0xf8e3('0x3d')]=_['intersection'](_0x292247['model'],qs[_0xf8e3('0x4f')](_0x3de318[_0xf8e3('0x39')]['fields']));_0x4b69db[_0xf8e3('0x3d')]=_0x4b69db[_0xf8e3('0x3d')][_0xf8e3('0x3e')]?_0x4b69db[_0xf8e3('0x3d')]:_0x292247[_0xf8e3('0x3c')];_0x4b69db['order']=qs[_0xf8e3('0x40')](_0x3de318[_0xf8e3('0x39')]['sort']);_0x4b69db['where']=qs[_0xf8e3('0x43')](_[_0xf8e3('0x42')](_0x3de318[_0xf8e3('0x39')],_0x292247[_0xf8e3('0x43')]));if(_0x3de318[_0xf8e3('0x39')][_0xf8e3('0x44')]){_0x4b69db[_0xf8e3('0x41')]=_[_0xf8e3('0x45')](_0x4b69db['where'],{'$or':_[_0xf8e3('0x38')](_0x4b69db[_0xf8e3('0x3d')],function(_0x8b202b){var _0x16f087={};_0x16f087[_0x8b202b]={'$like':'%'+_0x3de318[_0xf8e3('0x39')][_0xf8e3('0x44')]+'%'};return _0x16f087;})});}_0x4b69db=_['merge']({},_0x4b69db,_0x3de318[_0xf8e3('0x47')]);return _0x2df5db[_0xf8e3('0x66')](_0x4b69db);}})[_0xf8e3('0x2b')](function(_0x4b3b56){if(_0x4b3b56){_0x19f362=_0x4b3b56['length'];if(!_0x3de318[_0xf8e3('0x39')][_0xf8e3('0x5b')](_0xf8e3('0x3f'))){_0x4b69db[_0xf8e3('0x24')]=qs[_0xf8e3('0x24')](_0x3de318['query'][_0xf8e3('0x24')]);_0x4b69db[_0xf8e3('0x23')]=qs[_0xf8e3('0x23')](_0x3de318[_0xf8e3('0x39')][_0xf8e3('0x23')]);}return _0x2df5db[_0xf8e3('0x66')](_0x4b69db);}})[_0xf8e3('0x2b')](function(_0x2c44b1){if(_0x2c44b1){return _0x2c44b1?{'count':_0x19f362,'rows':_0x2c44b1}:null;}})[_0xf8e3('0x2b')](respondWithResult(_0x280f06,null))['catch'](handleError(_0x280f06,null));};exports[_0xf8e3('0x67')]=function(_0x2dd433,_0x3e4441,_0x35e551){var _0x2ab0e4=_0x2dd433[_0xf8e3('0x52')][_0xf8e3('0x68')];return db['Team']['findAll']({'where':{'id':_0x2ab0e4},'attributes':['id'],'include':[{'model':db[_0xf8e3('0x69')],'as':_0xf8e3('0x6a'),'attributes':['id','name',_0xf8e3('0x6b'),_0xf8e3('0x6c'),_0xf8e3('0x6d')],'raw':!![]}]})[_0xf8e3('0x2b')](function(_0xda6780){if(_0xda6780){var _0x3b387e=_[_0xf8e3('0x6e')](_0xda6780,function(_0x4b5a1f){var _0xddfaee=_0x4b5a1f[_0xf8e3('0x2c')]({'plain':!![]});return _0xddfaee[_0xf8e3('0x6a')];});return db[_0xf8e3('0x35')][_0xf8e3('0x50')]({'where':{'id':_0x2dd433[_0xf8e3('0x4e')]['id']}})[_0xf8e3('0x2b')](function(_0x4293b9){return db[_0xf8e3('0x6f')][_0xf8e3('0x70')](function(_0x188495){return _0x4293b9['addTeams'](_0x2ab0e4,{'transaction':_0x188495})['then'](function(){return BPromise[_0xf8e3('0x71')](_0x3b387e,function(_0x5d5b50){return db[_0xf8e3('0x5a')]['findOrCreate']({'where':{'UserId':_0x5d5b50['id'],'MailQueueId':_0x2dd433[_0xf8e3('0x4e')]['id']},'transaction':_0x188495});});})[_0xf8e3('0x2b')](function(){_0x3b387e[_0xf8e3('0x72')](function(_0x4baef7){socket[_0xf8e3('0x73')](_0xf8e3('0x74'),{'UserId':_0x4baef7['id'],'MailQueueId':_0x4293b9['id']});});});});});}})[_0xf8e3('0x2b')](respondWithStatusCode(_0x3e4441,null))[_0xf8e3('0x4c')](handleError(_0x3e4441,null));};exports[_0xf8e3('0x75')]=function(_0x49c366,_0xec1ff5,_0x562ef9){return db[_0xf8e3('0x65')][_0xf8e3('0x4b')]({'where':{'id':_0x49c366[_0xf8e3('0x39')][_0xf8e3('0x68')]},'attributes':['id'],'include':[{'model':db[_0xf8e3('0x69')],'as':_0xf8e3('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf8e3('0x2b')](handleEntityNotFound(_0xec1ff5,null))['then'](function(_0x419c63){var _0x1b0b89=_[_0xf8e3('0x38')](_0x419c63,'id');var _0x1a9ba6=[];var _0x5c3fb5=[];var _0x41ff23=squel[_0xf8e3('0x76')]();_0x41ff23[_0xf8e3('0x77')](_0xf8e3('0x78'))[_0xf8e3('0x79')](_0xf8e3('0x7a'),'tq')[_0xf8e3('0x7b')](_0xf8e3('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xf8e3('0x7d'),_0x49c366[_0xf8e3('0x4e')]['id']);for(var _0xf76814=0x0;_0xf76814<_0x419c63[_0xf8e3('0x3e')];_0xf76814+=0x1){let _0x131625=_0x419c63[_0xf76814];for(var _0x12bc5b=0x0;_0x12bc5b<_0x131625[_0xf8e3('0x6a')]['length'];_0x12bc5b+=0x1){let _0xcaa3c7=_0x131625['Agents'][_0x12bc5b];var _0x96012=_0x41ff23[_0xf8e3('0x7e')]();_0x96012[_0xf8e3('0x41')](_0xf8e3('0x7f'),_0xcaa3c7['id']);_0x5c3fb5['push'](db[_0xf8e3('0x6f')]['query'](_0x96012['toString'](),{'type':db[_0xf8e3('0x6f')][_0xf8e3('0x80')][_0xf8e3('0x81')]})[_0xf8e3('0x2b')](function(_0x5c838d){if(_0x5c838d['length']===0x1){return _0xcaa3c7['id'];}else{var _0x2e52ea=_[_0xf8e3('0x82')](_['map'](_0x5c838d,'TeamId'),function(_0x212b7c){return _[_0xf8e3('0x83')](_0x1b0b89,_0x212b7c);});if(_0x2e52ea){return _0xcaa3c7['id'];}}}));}}return BPromise['all'](_0x5c3fb5)[_0xf8e3('0x2b')](function(_0x87f685){_0x1a9ba6=_(_0x1a9ba6)[_0xf8e3('0x84')](_0x87f685)[_0xf8e3('0x85')]()[_0xf8e3('0x86')]();return db[_0xf8e3('0x35')][_0xf8e3('0x50')]({'where':{'id':_0x49c366['params']['id']}})[_0xf8e3('0x2b')](function(_0x58c30b){return db['sequelize'][_0xf8e3('0x70')](function(_0x4a8866){return _0x58c30b[_0xf8e3('0x75')](_0x49c366[_0xf8e3('0x39')][_0xf8e3('0x68')],{'transaction':_0x4a8866})['then'](function(){if(!_[_0xf8e3('0x87')](_0x1a9ba6)){return _0x58c30b['removeAgents'](_0x1a9ba6,{'transaction':_0x4a8866});}})[_0xf8e3('0x2b')](function(){_0x1a9ba6[_0xf8e3('0x72')](function(_0x364e6a){socket[_0xf8e3('0x73')]('userMailQueue:remove',{'UserId':_0x364e6a,'MailQueueId':_0x58c30b['id']});});});});});});})['then'](respondWithStatusCode(_0xec1ff5,null))[_0xf8e3('0x4c')](handleError(_0xec1ff5,null));};exports[_0xf8e3('0x88')]=function(_0x268855,_0x260cbf,_0x11bec6){return db[_0xf8e3('0x35')]['find']({'where':{'id':_0x268855[_0xf8e3('0x4e')]['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0x260cbf,null))[_0xf8e3('0x2b')](function(_0x348e59){if(_0x348e59){return _0x348e59['addAgents'](_0x268855[_0xf8e3('0x52')]['ids'],_[_0xf8e3('0x89')](_0x268855[_0xf8e3('0x52')],['ids','id'])||{})[_0xf8e3('0x8a')](function(_0x5dfb4c){for(var _0x1ca413=0x0;_0x1ca413<_0x268855[_0xf8e3('0x52')]['ids'][_0xf8e3('0x3e')];_0x1ca413+=0x1){socket[_0xf8e3('0x73')]('userMailQueue:save',{'UserId':_0x268855[_0xf8e3('0x52')][_0xf8e3('0x68')][_0x1ca413],'MailQueueId':_0x268855[_0xf8e3('0x4e')]['id']});}return _0x5dfb4c;});}})[_0xf8e3('0x2b')](respondWithResult(_0x260cbf,null))[_0xf8e3('0x4c')](handleError(_0x260cbf,null));};exports[_0xf8e3('0x8b')]=function(_0x13f467,_0xede851,_0x29c04b){return db[_0xf8e3('0x35')][_0xf8e3('0x50')]({'where':{'id':_0x13f467[_0xf8e3('0x4e')]['id']}})['then'](handleEntityNotFound(_0xede851,null))[_0xf8e3('0x2b')](function(_0x202427){if(_0x202427){return _0x202427[_0xf8e3('0x8b')](_0x13f467['query'][_0xf8e3('0x68')])[_0xf8e3('0x2b')](function(){if(_[_0xf8e3('0x8c')](_0x13f467[_0xf8e3('0x39')][_0xf8e3('0x68')])){for(var _0x4402ee=0x0;_0x4402ee<_0x13f467[_0xf8e3('0x39')]['ids']['length'];_0x4402ee+=0x1){socket[_0xf8e3('0x73')](_0xf8e3('0x8d'),{'UserId':Number(_0x13f467['query'][_0xf8e3('0x68')][_0x4402ee]),'MailQueueId':Number(_0x13f467[_0xf8e3('0x4e')]['id'])});}}else{socket['emit'](_0xf8e3('0x8d'),{'UserId':Number(_0x13f467[_0xf8e3('0x39')][_0xf8e3('0x68')]),'MailQueueId':Number(_0x13f467[_0xf8e3('0x4e')]['id'])});}});}})[_0xf8e3('0x2b')](respondWithStatusCode(_0xede851,null))['catch'](handleError(_0xede851,null));};exports[_0xf8e3('0x8e')]=function(_0x153a0d,_0x5def8d,_0x4f02bb){var _0x237eb6={};var _0xd9e796={};var _0x29baef;var _0x1b9ea4;return db[_0xf8e3('0x35')][_0xf8e3('0x59')]({'where':{'id':_0x153a0d['params']['id']}})[_0xf8e3('0x2b')](handleEntityNotFound(_0x5def8d,null))[_0xf8e3('0x2b')](function(_0x58c181){if(_0x58c181){_0x29baef=_0x58c181;_0xd9e796['model']=_['keys'](db[_0xf8e3('0x69')][_0xf8e3('0x36')]);_0xd9e796[_0xf8e3('0x39')]=_[_0xf8e3('0x3a')](_0x153a0d[_0xf8e3('0x39')]);_0xd9e796[_0xf8e3('0x43')]=_[_0xf8e3('0x3b')](_0xd9e796['model'],_0xd9e796['query']);_0x237eb6[_0xf8e3('0x3d')]=_['intersection'](_0xd9e796['model'],qs[_0xf8e3('0x4f')](_0x153a0d[_0xf8e3('0x39')]['fields']));_0x237eb6[_0xf8e3('0x3d')]=_0x237eb6[_0xf8e3('0x3d')][_0xf8e3('0x3e')]?_0x237eb6[_0xf8e3('0x3d')]:_0xd9e796[_0xf8e3('0x3c')];_0x237eb6[_0xf8e3('0x8f')]=qs[_0xf8e3('0x40')](_0x153a0d[_0xf8e3('0x39')][_0xf8e3('0x40')]);_0x237eb6[_0xf8e3('0x41')]=qs[_0xf8e3('0x43')](_[_0xf8e3('0x42')](_0x153a0d[_0xf8e3('0x39')],_0xd9e796[_0xf8e3('0x43')]));if(_0x153a0d[_0xf8e3('0x39')]['filter']){_0x237eb6[_0xf8e3('0x41')]=_[_0xf8e3('0x45')](_0x237eb6['where'],{'$or':_[_0xf8e3('0x38')](_0x237eb6['attributes'],function(_0x4aaf23){var _0x5a66ee={};_0x5a66ee[_0x4aaf23]={'$like':'%'+_0x153a0d[_0xf8e3('0x39')][_0xf8e3('0x44')]+'%'};return _0x5a66ee;})});}_0x237eb6=_['merge']({},_0x237eb6,_0x153a0d[_0xf8e3('0x47')]);return _0x29baef[_0xf8e3('0x8e')](_0x237eb6);}})[_0xf8e3('0x2b')](function(_0x51b7ee){if(_0x51b7ee){_0x1b9ea4=_0x51b7ee[_0xf8e3('0x3e')];if(!_0x153a0d[_0xf8e3('0x39')][_0xf8e3('0x5b')]('nolimit')){_0x237eb6[_0xf8e3('0x24')]=qs[_0xf8e3('0x24')](_0x153a0d[_0xf8e3('0x39')]['limit']);_0x237eb6[_0xf8e3('0x23')]=qs[_0xf8e3('0x23')](_0x153a0d[_0xf8e3('0x39')][_0xf8e3('0x23')]);}return _0x29baef[_0xf8e3('0x8e')](_0x237eb6);}})[_0xf8e3('0x2b')](function(_0x59aa1b){if(_0x59aa1b){return _0x59aa1b?{'count':_0x1b9ea4,'rows':_0x59aa1b}:null;}})[_0xf8e3('0x2b')](respondWithResult(_0x5def8d,null))[_0xf8e3('0x4c')](handleError(_0x5def8d,null));}; \ No newline at end of file +var _0x180d=['json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','filter','VIRTUAL','merge','options','MailQueue','includeAll','include','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','get','UserMailQueue','hasOwnProperty','order','where','pick','findAll','UserId','agent','mailPause','updatedAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','select','from','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status'];(function(_0x77d76e,_0x106ed2){var _0x5620c8=function(_0x481b37){while(--_0x481b37){_0x77d76e['push'](_0x77d76e['shift']());}};_0x5620c8(++_0x106ed2);}(_0x180d,0xf9));var _0xd180=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x180d[_0x4b2436];return _0x4f5ab2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd180('0x0'));var rimraf=require(_0xd180('0x1'));var zipdir=require(_0xd180('0x2'));var jsonpatch=require(_0xd180('0x3'));var rp=require(_0xd180('0x4'));var moment=require('moment');var BPromise=require(_0xd180('0x5'));var Mustache=require(_0xd180('0x6'));var util=require(_0xd180('0x7'));var path=require(_0xd180('0x8'));var sox=require(_0xd180('0x9'));var csv=require(_0xd180('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd180('0xb'));var crypto=require(_0xd180('0xc'));var jsforce=require(_0xd180('0xd'));var deskjs=require(_0xd180('0xe'));var toCsv=require(_0xd180('0xa'));var querystring=require(_0xd180('0xf'));var Papa=require(_0xd180('0x10'));var Redis=require(_0xd180('0x11'));var authService=require(_0xd180('0x12'));var qs=require(_0xd180('0x13'));var as=require(_0xd180('0x14'));var hardwareService=require(_0xd180('0x15'));var logger=require(_0xd180('0x16'))(_0xd180('0x17'));var utils=require('../../config/utils');var config=require(_0xd180('0x18'));var licenseUtil=require(_0xd180('0x19'));var db=require(_0xd180('0x1a'))['db'];config[_0xd180('0x1b')]=_[_0xd180('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd180('0x1d'))(new Redis(config[_0xd180('0x1b')]));require(_0xd180('0x1e'))[_0xd180('0x1f')](socket);function respondWithStatusCode(_0x349f5c,_0x3118da){_0x3118da=_0x3118da||0xcc;return function(_0x4f80a4){if(_0x4f80a4){return _0x349f5c['sendStatus'](_0x3118da);}return _0x349f5c[_0xd180('0x20')](_0x3118da)['end']();};}function respondWithResult(_0x544a38,_0x21653d){_0x21653d=_0x21653d||0xc8;return function(_0x488435){if(_0x488435){return _0x544a38[_0xd180('0x20')](_0x21653d)[_0xd180('0x21')](_0x488435);}};}function respondWithFilteredResult(_0x3ae54c,_0x254126){return function(_0x543e14){if(_0x543e14){var _0x45596d=_0x543e14[_0xd180('0x22')],_0x4fbfaa=_0x254126[_0xd180('0x23')],_0x3ed54d=_0x254126[_0xd180('0x23')]+_0x254126[_0xd180('0x24')],_0x24e5a4;if(_0x3ed54d>=_0x45596d){_0x3ed54d=_0x45596d;_0x24e5a4=0xc8;}else{_0x24e5a4=0xce;}_0x3ae54c[_0xd180('0x20')](_0x24e5a4);return _0x3ae54c['set'](_0xd180('0x25'),_0x4fbfaa+'-'+_0x3ed54d+'/'+_0x45596d)['json'](_0x543e14);}return null;};}function patchUpdates(_0x1bdeda){return function(_0x3e6f03){try{jsonpatch[_0xd180('0x26')](_0x3e6f03,_0x1bdeda,!![]);}catch(_0x26f4ff){return BPromise[_0xd180('0x27')](_0x26f4ff);}return _0x3e6f03[_0xd180('0x28')]();};}function saveUpdates(_0x33060f,_0xe6f3f2){return function(_0x651ff6){if(_0x651ff6){return _0x651ff6[_0xd180('0x29')](_0x33060f)[_0xd180('0x2a')](function(_0x4e7356){return _0x4e7356;});}return null;};}function removeEntity(_0x1ddd4e,_0x258932){return function(_0x514274){if(_0x514274){return _0x514274[_0xd180('0x2b')]()[_0xd180('0x2a')](function(){var _0x25b8dd=_0x514274['get']({'plain':!![]});var _0x23c690=_0xd180('0x2c');return db[_0xd180('0x2d')]['destroy']({'where':{'type':_0x23c690,'resourceId':_0x25b8dd['id']}})[_0xd180('0x2a')](function(){return _0x514274;});})[_0xd180('0x2a')](function(){_0x1ddd4e['status'](0xcc)[_0xd180('0x2e')]();});}};}function handleEntityNotFound(_0x38d44e,_0xa20dd){return function(_0x1a068e){if(!_0x1a068e){_0x38d44e[_0xd180('0x2f')](0x194);}return _0x1a068e;};}function handleError(_0x615dd0,_0x23bb24){_0x23bb24=_0x23bb24||0x1f4;return function(_0x4bd223){logger[_0xd180('0x30')](_0x4bd223[_0xd180('0x31')]);if(_0x4bd223[_0xd180('0x32')]){delete _0x4bd223[_0xd180('0x32')];}_0x615dd0[_0xd180('0x20')](_0x23bb24)[_0xd180('0x33')](_0x4bd223);};}exports[_0xd180('0x34')]=function(_0x5c6171,_0x3d54b0){var _0x301b48={},_0x4b412f={},_0x5b99eb={'count':0x0,'rows':[]};var _0x214924=_[_0xd180('0x35')](db['MailQueue'][_0xd180('0x36')],function(_0x2a7424){return{'name':_0x2a7424[_0xd180('0x37')],'type':_0x2a7424[_0xd180('0x38')][_0xd180('0x39')]};});_0x4b412f[_0xd180('0x3a')]=_[_0xd180('0x35')](_0x214924,'name');_0x4b412f['query']=_[_0xd180('0x3b')](_0x5c6171[_0xd180('0x3c')]);_0x4b412f[_0xd180('0x3d')]=_[_0xd180('0x3e')](_0x4b412f[_0xd180('0x3a')],_0x4b412f[_0xd180('0x3c')]);_0x301b48['attributes']=_['intersection'](_0x4b412f[_0xd180('0x3a')],qs[_0xd180('0x3f')](_0x5c6171['query'][_0xd180('0x3f')]));_0x301b48[_0xd180('0x40')]=_0x301b48[_0xd180('0x40')][_0xd180('0x41')]?_0x301b48[_0xd180('0x40')]:_0x4b412f[_0xd180('0x3a')];if(!_0x5c6171[_0xd180('0x3c')]['hasOwnProperty'](_0xd180('0x42'))){_0x301b48['limit']=qs['limit'](_0x5c6171[_0xd180('0x3c')][_0xd180('0x24')]);_0x301b48['offset']=qs[_0xd180('0x23')](_0x5c6171['query'][_0xd180('0x23')]);}_0x301b48['order']=qs[_0xd180('0x43')](_0x5c6171[_0xd180('0x3c')]['sort']);_0x301b48['where']=qs[_0xd180('0x3d')](_['pick'](_0x5c6171[_0xd180('0x3c')],_0x4b412f['filters']),_0x214924);if(_0x5c6171[_0xd180('0x3c')][_0xd180('0x44')]){_0x301b48['where']=_['merge'](_0x301b48['where'],{'$or':_[_0xd180('0x35')](_0x214924,function(_0x56d24e){if(_0x56d24e[_0xd180('0x38')]!==_0xd180('0x45')){var _0x2cb76b={};_0x2cb76b[_0x56d24e[_0xd180('0x32')]]={'$like':'%'+_0x5c6171[_0xd180('0x3c')][_0xd180('0x44')]+'%'};return _0x2cb76b;}})});}_0x301b48=_[_0xd180('0x46')]({},_0x301b48,_0x5c6171[_0xd180('0x47')]);var _0x26ef14={'where':_0x301b48['where']};return db[_0xd180('0x48')]['count'](_0x26ef14)[_0xd180('0x2a')](function(_0x58b7e9){_0x5b99eb[_0xd180('0x22')]=_0x58b7e9;if(_0x5c6171['query'][_0xd180('0x49')]){_0x301b48[_0xd180('0x4a')]=[{'all':!![]}];}return db[_0xd180('0x48')]['findAll'](_0x301b48);})[_0xd180('0x2a')](function(_0x518f94){_0x5b99eb[_0xd180('0x4b')]=_0x518f94;return _0x5b99eb;})[_0xd180('0x2a')](respondWithFilteredResult(_0x3d54b0,_0x301b48))['catch'](handleError(_0x3d54b0,null));};exports[_0xd180('0x4c')]=function(_0x3367f8,_0x29b95a){var _0xd772f2={'raw':!![],'where':{'id':_0x3367f8['params']['id']}},_0x11584b={};_0x11584b[_0xd180('0x3a')]=_[_0xd180('0x3b')](db[_0xd180('0x48')][_0xd180('0x36')]);_0x11584b['query']=_[_0xd180('0x3b')](_0x3367f8[_0xd180('0x3c')]);_0x11584b[_0xd180('0x3d')]=_[_0xd180('0x3e')](_0x11584b['model'],_0x11584b['query']);_0xd772f2['attributes']=_[_0xd180('0x3e')](_0x11584b[_0xd180('0x3a')],qs['fields'](_0x3367f8[_0xd180('0x3c')][_0xd180('0x3f')]));_0xd772f2[_0xd180('0x40')]=_0xd772f2[_0xd180('0x40')]['length']?_0xd772f2[_0xd180('0x40')]:_0x11584b[_0xd180('0x3a')];if(_0x3367f8[_0xd180('0x3c')][_0xd180('0x49')]){_0xd772f2['include']=[{'all':!![]}];}_0xd772f2=_['merge']({},_0xd772f2,_0x3367f8[_0xd180('0x47')]);return db[_0xd180('0x48')][_0xd180('0x4d')](_0xd772f2)[_0xd180('0x2a')](handleEntityNotFound(_0x29b95a,null))['then'](respondWithResult(_0x29b95a,null))[_0xd180('0x4e')](handleError(_0x29b95a,null));};exports['create']=function(_0x37973b,_0x2f85cc){return db[_0xd180('0x48')][_0xd180('0x4f')](_0x37973b[_0xd180('0x50')],{})[_0xd180('0x2a')](function(_0x5c0c01){var _0x56a646=_0x37973b[_0xd180('0x51')]['get']({'plain':!![]});if(!_0x56a646)throw new Error(_0xd180('0x52'));if(_0x56a646[_0xd180('0x53')]==='user'){var _0x38b2ef=_0x5c0c01['get']({'plain':!![]});var _0x1d906f=_0xd180('0x2c');return db['UserProfileSection'][_0xd180('0x4d')]({'where':{'name':_0x1d906f,'userProfileId':_0x56a646['userProfileId']},'raw':!![]})['then'](function(_0x1ee9aa){if(_0x1ee9aa&&_0x1ee9aa[_0xd180('0x54')]===0x0){return db['UserProfileResource'][_0xd180('0x4f')]({'name':_0x38b2ef[_0xd180('0x32')],'resourceId':_0x38b2ef['id'],'type':_0x1ee9aa[_0xd180('0x32')],'sectionId':_0x1ee9aa['id']},{})[_0xd180('0x2a')](function(){return _0x5c0c01;});}else{return _0x5c0c01;}})[_0xd180('0x4e')](function(_0x13aa89){logger['error'](_0xd180('0x55'),_0x13aa89);throw _0x13aa89;});}return _0x5c0c01;})[_0xd180('0x2a')](respondWithResult(_0x2f85cc,0xc9))[_0xd180('0x4e')](handleError(_0x2f85cc,null));};exports[_0xd180('0x29')]=function(_0x5e37b9,_0x1bc3b6){if(_0x5e37b9[_0xd180('0x50')]['id']){delete _0x5e37b9['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x5e37b9[_0xd180('0x56')]['id']}})[_0xd180('0x2a')](handleEntityNotFound(_0x1bc3b6,null))[_0xd180('0x2a')](saveUpdates(_0x5e37b9['body'],null))[_0xd180('0x2a')](respondWithResult(_0x1bc3b6,null))[_0xd180('0x4e')](handleError(_0x1bc3b6,null));};exports[_0xd180('0x2b')]=function(_0x169d9d,_0x59a757){return db[_0xd180('0x48')]['find']({'where':{'id':_0x169d9d[_0xd180('0x56')]['id']}})[_0xd180('0x2a')](handleEntityNotFound(_0x59a757,null))[_0xd180('0x2a')](removeEntity(_0x59a757,null))['catch'](handleError(_0x59a757,null));};exports[_0xd180('0x57')]=function(_0xa38223,_0x2a000a){return db[_0xd180('0x48')][_0xd180('0x57')]()[_0xd180('0x2a')](respondWithResult(_0x2a000a,null))[_0xd180('0x4e')](handleError(_0x2a000a,null));};exports[_0xd180('0x58')]=function(_0x16e64e,_0x1acb16,_0x4681d9){var _0x293677={'raw':!![],'where':{}},_0x5d4d20={},_0x1b84d3;return db['MailQueue'][_0xd180('0x59')]({'where':{'id':_0x16e64e[_0xd180('0x56')]['id']}})[_0xd180('0x2a')](handleEntityNotFound(_0x1acb16,null))[_0xd180('0x2a')](function(_0x10df19){if(_0x10df19){_0x1b84d3=_0x10df19[_0xd180('0x5a')]({'plain':!![]});_0x5d4d20['model']=_[_0xd180('0x3b')](db[_0xd180('0x5b')][_0xd180('0x36')]);_0x5d4d20[_0xd180('0x3c')]=_[_0xd180('0x3b')](_0x16e64e[_0xd180('0x3c')]);_0x5d4d20[_0xd180('0x3d')]=_[_0xd180('0x3e')](_0x5d4d20['model'],_0x5d4d20['query']);_0x293677[_0xd180('0x40')]=_[_0xd180('0x3e')](_0x5d4d20['model'],qs[_0xd180('0x3f')](_0x16e64e[_0xd180('0x3c')][_0xd180('0x3f')]));_0x293677[_0xd180('0x40')]=_0x293677[_0xd180('0x40')][_0xd180('0x41')]?_0x293677[_0xd180('0x40')]:_0x5d4d20['model'];if(!_0x16e64e[_0xd180('0x3c')][_0xd180('0x5c')]('nolimit')){_0x293677[_0xd180('0x24')]=qs[_0xd180('0x24')](_0x16e64e[_0xd180('0x3c')][_0xd180('0x24')]);_0x293677[_0xd180('0x23')]=qs[_0xd180('0x23')](_0x16e64e[_0xd180('0x3c')][_0xd180('0x23')]);}_0x293677[_0xd180('0x5d')]=qs[_0xd180('0x43')](_0x16e64e[_0xd180('0x3c')][_0xd180('0x43')]);_0x293677[_0xd180('0x5e')]=qs['filters'](_[_0xd180('0x5f')](_0x16e64e[_0xd180('0x3c')],_0x5d4d20[_0xd180('0x3d')]));_0x293677[_0xd180('0x5e')]['MailQueueId']=_0x10df19['id'];if(_0x16e64e['query'][_0xd180('0x44')]){_0x293677[_0xd180('0x5e')]=_[_0xd180('0x46')](_0x293677[_0xd180('0x5e')],{'$or':_[_0xd180('0x35')](_0x293677[_0xd180('0x40')],function(_0x328c6c){var _0x127143={};_0x127143[_0x328c6c]={'$like':'%'+_0x16e64e[_0xd180('0x3c')][_0xd180('0x44')]+'%'};return _0x127143;})});}_0x293677=_[_0xd180('0x46')]({},_0x293677,_0x16e64e['options']);return db[_0xd180('0x5b')][_0xd180('0x60')](_0x293677);}})[_0xd180('0x2a')](function(_0x4f3a55){if(_0x4f3a55){return db['User']['findAndCountAll']({'where':{'id':_[_0xd180('0x35')](_0x4f3a55,_0xd180('0x61')),'role':_0xd180('0x62')},'attributes':['id',_0xd180('0x32'),_0xd180('0x63'),_0xd180('0x64'),'createdAt']});}})['then'](function(_0x31aa07){if(_0x31aa07){return{'count':_0x31aa07[_0xd180('0x22')],'rows':_[_0xd180('0x35')](_0x31aa07[_0xd180('0x4b')],function(_0x1fb96d){return{'membername':_0x1fb96d[_0xd180('0x32')],'UserId':_0x1fb96d['id'],'queue_name':_0x1b84d3[_0xd180('0x32')],'MailQueueId':_0x1b84d3['id'],'interface':util['format'](_0xd180('0x65'),_0xd180('0x66'),_0x1fb96d[_0xd180('0x32')]),'penalty':0x0,'paused':_0x1fb96d['mailPause'],'createdAt':_0x1fb96d['createdAt'],'updatedAt':_0x1fb96d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1acb16,_0x293677))[_0xd180('0x4e')](handleError(_0x1acb16,null));};exports[_0xd180('0x67')]=function(_0x276d9b,_0x108161,_0x56c075){var _0x3d7c9f={};var _0x49ff78={};var _0x5f4406;var _0x76fffd;return db[_0xd180('0x48')][_0xd180('0x59')]({'where':{'id':_0x276d9b[_0xd180('0x56')]['id']}})['then'](handleEntityNotFound(_0x108161,null))[_0xd180('0x2a')](function(_0x30588a){if(_0x30588a){_0x5f4406=_0x30588a;_0x49ff78[_0xd180('0x3a')]=_[_0xd180('0x3b')](db[_0xd180('0x68')][_0xd180('0x36')]);_0x49ff78[_0xd180('0x3c')]=_[_0xd180('0x3b')](_0x276d9b[_0xd180('0x3c')]);_0x49ff78[_0xd180('0x3d')]=_[_0xd180('0x3e')](_0x49ff78[_0xd180('0x3a')],_0x49ff78['query']);_0x3d7c9f[_0xd180('0x40')]=_['intersection'](_0x49ff78[_0xd180('0x3a')],qs['fields'](_0x276d9b[_0xd180('0x3c')][_0xd180('0x3f')]));_0x3d7c9f[_0xd180('0x40')]=_0x3d7c9f['attributes'][_0xd180('0x41')]?_0x3d7c9f[_0xd180('0x40')]:_0x49ff78[_0xd180('0x3a')];_0x3d7c9f[_0xd180('0x5d')]=qs[_0xd180('0x43')](_0x276d9b[_0xd180('0x3c')]['sort']);_0x3d7c9f[_0xd180('0x5e')]=qs['filters'](_[_0xd180('0x5f')](_0x276d9b[_0xd180('0x3c')],_0x49ff78[_0xd180('0x3d')]));if(_0x276d9b[_0xd180('0x3c')]['filter']){_0x3d7c9f['where']=_[_0xd180('0x46')](_0x3d7c9f['where'],{'$or':_[_0xd180('0x35')](_0x3d7c9f['attributes'],function(_0x4d227d){var _0x53aa3d={};_0x53aa3d[_0x4d227d]={'$like':'%'+_0x276d9b[_0xd180('0x3c')]['filter']+'%'};return _0x53aa3d;})});}_0x3d7c9f=_[_0xd180('0x46')]({},_0x3d7c9f,_0x276d9b[_0xd180('0x47')]);return _0x5f4406[_0xd180('0x67')](_0x3d7c9f);}})[_0xd180('0x2a')](function(_0x279df1){if(_0x279df1){_0x76fffd=_0x279df1[_0xd180('0x41')];if(!_0x276d9b['query']['hasOwnProperty'](_0xd180('0x42'))){_0x3d7c9f[_0xd180('0x24')]=qs[_0xd180('0x24')](_0x276d9b[_0xd180('0x3c')][_0xd180('0x24')]);_0x3d7c9f[_0xd180('0x23')]=qs[_0xd180('0x23')](_0x276d9b[_0xd180('0x3c')][_0xd180('0x23')]);}return _0x5f4406[_0xd180('0x67')](_0x3d7c9f);}})[_0xd180('0x2a')](function(_0x537926){if(_0x537926){return _0x537926?{'count':_0x76fffd,'rows':_0x537926}:null;}})['then'](respondWithResult(_0x108161,null))[_0xd180('0x4e')](handleError(_0x108161,null));};exports[_0xd180('0x69')]=function(_0x4cc439,_0x2de533,_0xa701fe){var _0x132847=_0x4cc439['body'][_0xd180('0x6a')];return db[_0xd180('0x68')]['findAll']({'where':{'id':_0x132847},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd180('0x6b'),'attributes':['id',_0xd180('0x32'),_0xd180('0x6c'),_0xd180('0x6d'),'interface'],'raw':!![]}]})[_0xd180('0x2a')](function(_0x58bb50){if(_0x58bb50){var _0x20609b=_['flatMap'](_0x58bb50,function(_0x93f7f0){var _0x2360d0=_0x93f7f0[_0xd180('0x5a')]({'plain':!![]});return _0x2360d0['Agents'];});return db[_0xd180('0x48')][_0xd180('0x4d')]({'where':{'id':_0x4cc439[_0xd180('0x56')]['id']}})['then'](function(_0x146fdd){return db[_0xd180('0x6e')][_0xd180('0x6f')](function(_0x2738e8){return _0x146fdd[_0xd180('0x69')](_0x132847,{'transaction':_0x2738e8})[_0xd180('0x2a')](function(){return BPromise[_0xd180('0x70')](_0x20609b,function(_0x299045){return db[_0xd180('0x5b')][_0xd180('0x71')]({'where':{'UserId':_0x299045['id'],'MailQueueId':_0x4cc439[_0xd180('0x56')]['id']},'transaction':_0x2738e8});});})[_0xd180('0x2a')](function(){_0x20609b[_0xd180('0x72')](function(_0x31fffd){socket[_0xd180('0x73')](_0xd180('0x74'),{'UserId':_0x31fffd['id'],'MailQueueId':_0x146fdd['id']});});});});});}})[_0xd180('0x2a')](respondWithStatusCode(_0x2de533,null))[_0xd180('0x4e')](handleError(_0x2de533,null));};exports[_0xd180('0x75')]=function(_0x549c15,_0x551ef4,_0x123ca0){return db['Team'][_0xd180('0x60')]({'where':{'id':_0x549c15[_0xd180('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd180('0x76')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd180('0x2a')](handleEntityNotFound(_0x551ef4,null))[_0xd180('0x2a')](function(_0x3a750d){var _0x21562a=_[_0xd180('0x35')](_0x3a750d,'id');var _0x147edd=[];var _0x419bd0=[];var _0x326995=squel[_0xd180('0x77')]();_0x326995['field']('tq.TeamId')[_0xd180('0x78')](_0xd180('0x79'),'tq')['join']('user_has_teams','ut',_0xd180('0x7a'))[_0xd180('0x5e')](_0xd180('0x7b'),_0x549c15['params']['id']);for(var _0x55b5ed=0x0;_0x55b5ed<_0x3a750d[_0xd180('0x41')];_0x55b5ed+=0x1){let _0x520497=_0x3a750d[_0x55b5ed];for(var _0x1d8ec1=0x0;_0x1d8ec1<_0x520497[_0xd180('0x6b')][_0xd180('0x41')];_0x1d8ec1+=0x1){let _0x4d8358=_0x520497['Agents'][_0x1d8ec1];var _0x23bdca=_0x326995[_0xd180('0x7c')]();_0x23bdca[_0xd180('0x5e')](_0xd180('0x7d'),_0x4d8358['id']);_0x419bd0[_0xd180('0x7e')](db[_0xd180('0x6e')][_0xd180('0x3c')](_0x23bdca['toString'](),{'type':db[_0xd180('0x6e')][_0xd180('0x7f')]['SELECT']})[_0xd180('0x2a')](function(_0x3a88ce){if(_0x3a88ce[_0xd180('0x41')]===0x1){return _0x4d8358['id'];}else{var _0x1e9b54=_[_0xd180('0x80')](_[_0xd180('0x35')](_0x3a88ce,_0xd180('0x81')),function(_0x316656){return _['includes'](_0x21562a,_0x316656);});if(_0x1e9b54){return _0x4d8358['id'];}}}));}}return BPromise[_0xd180('0x82')](_0x419bd0)['then'](function(_0x7471ca){_0x147edd=_(_0x147edd)[_0xd180('0x83')](_0x7471ca)['compact']()[_0xd180('0x84')]();return db[_0xd180('0x48')][_0xd180('0x4d')]({'where':{'id':_0x549c15[_0xd180('0x56')]['id']}})[_0xd180('0x2a')](function(_0xa4c466){return db['sequelize'][_0xd180('0x6f')](function(_0x29ee3b){return _0xa4c466['removeTeams'](_0x549c15['query'][_0xd180('0x6a')],{'transaction':_0x29ee3b})[_0xd180('0x2a')](function(){if(!_[_0xd180('0x85')](_0x147edd)){return _0xa4c466[_0xd180('0x86')](_0x147edd,{'transaction':_0x29ee3b});}})[_0xd180('0x2a')](function(){_0x147edd[_0xd180('0x72')](function(_0x237b03){socket['emit'](_0xd180('0x87'),{'UserId':_0x237b03,'MailQueueId':_0xa4c466['id']});});});});});});})[_0xd180('0x2a')](respondWithStatusCode(_0x551ef4,null))[_0xd180('0x4e')](handleError(_0x551ef4,null));};exports[_0xd180('0x88')]=function(_0xbf0d26,_0x197b0c,_0x1e526b){return db['MailQueue']['find']({'where':{'id':_0xbf0d26[_0xd180('0x56')]['id']}})[_0xd180('0x2a')](handleEntityNotFound(_0x197b0c,null))[_0xd180('0x2a')](function(_0x22e42e){if(_0x22e42e){return _0x22e42e[_0xd180('0x88')](_0xbf0d26[_0xd180('0x50')][_0xd180('0x6a')],_[_0xd180('0x89')](_0xbf0d26[_0xd180('0x50')],[_0xd180('0x6a'),'id'])||{})[_0xd180('0x8a')](function(_0x14a5c6){for(var _0x1ad48f=0x0;_0x1ad48f<_0xbf0d26[_0xd180('0x50')][_0xd180('0x6a')][_0xd180('0x41')];_0x1ad48f+=0x1){socket[_0xd180('0x73')](_0xd180('0x74'),{'UserId':_0xbf0d26[_0xd180('0x50')][_0xd180('0x6a')][_0x1ad48f],'MailQueueId':_0xbf0d26[_0xd180('0x56')]['id']});}return _0x14a5c6;});}})[_0xd180('0x2a')](respondWithResult(_0x197b0c,null))[_0xd180('0x4e')](handleError(_0x197b0c,null));};exports[_0xd180('0x86')]=function(_0x256a68,_0x512bed,_0x38692d){return db[_0xd180('0x48')][_0xd180('0x4d')]({'where':{'id':_0x256a68['params']['id']}})[_0xd180('0x2a')](handleEntityNotFound(_0x512bed,null))['then'](function(_0x3621cd){if(_0x3621cd){return _0x3621cd[_0xd180('0x86')](_0x256a68['query']['ids'])[_0xd180('0x2a')](function(){if(_[_0xd180('0x8b')](_0x256a68['query'][_0xd180('0x6a')])){for(var _0x4f75b3=0x0;_0x4f75b3<_0x256a68[_0xd180('0x3c')]['ids'][_0xd180('0x41')];_0x4f75b3+=0x1){socket[_0xd180('0x73')](_0xd180('0x87'),{'UserId':Number(_0x256a68[_0xd180('0x3c')][_0xd180('0x6a')][_0x4f75b3]),'MailQueueId':Number(_0x256a68[_0xd180('0x56')]['id'])});}}else{socket['emit'](_0xd180('0x87'),{'UserId':Number(_0x256a68['query'][_0xd180('0x6a')]),'MailQueueId':Number(_0x256a68[_0xd180('0x56')]['id'])});}});}})[_0xd180('0x2a')](respondWithStatusCode(_0x512bed,null))[_0xd180('0x4e')](handleError(_0x512bed,null));};exports[_0xd180('0x8c')]=function(_0x470508,_0xb02088,_0x342b76){var _0x928ff9={};var _0x53810d={};var _0x4052fd;var _0x9fd2b;return db[_0xd180('0x48')]['findOne']({'where':{'id':_0x470508['params']['id']}})[_0xd180('0x2a')](handleEntityNotFound(_0xb02088,null))[_0xd180('0x2a')](function(_0x5831f1){if(_0x5831f1){_0x4052fd=_0x5831f1;_0x53810d[_0xd180('0x3a')]=_['keys'](db[_0xd180('0x76')][_0xd180('0x36')]);_0x53810d[_0xd180('0x3c')]=_[_0xd180('0x3b')](_0x470508['query']);_0x53810d['filters']=_[_0xd180('0x3e')](_0x53810d[_0xd180('0x3a')],_0x53810d[_0xd180('0x3c')]);_0x928ff9[_0xd180('0x40')]=_[_0xd180('0x3e')](_0x53810d['model'],qs[_0xd180('0x3f')](_0x470508[_0xd180('0x3c')]['fields']));_0x928ff9[_0xd180('0x40')]=_0x928ff9['attributes'][_0xd180('0x41')]?_0x928ff9[_0xd180('0x40')]:_0x53810d[_0xd180('0x3a')];_0x928ff9[_0xd180('0x5d')]=qs[_0xd180('0x43')](_0x470508['query'][_0xd180('0x43')]);_0x928ff9[_0xd180('0x5e')]=qs[_0xd180('0x3d')](_[_0xd180('0x5f')](_0x470508[_0xd180('0x3c')],_0x53810d['filters']));if(_0x470508[_0xd180('0x3c')]['filter']){_0x928ff9[_0xd180('0x5e')]=_[_0xd180('0x46')](_0x928ff9[_0xd180('0x5e')],{'$or':_['map'](_0x928ff9[_0xd180('0x40')],function(_0x91316e){var _0x258add={};_0x258add[_0x91316e]={'$like':'%'+_0x470508[_0xd180('0x3c')][_0xd180('0x44')]+'%'};return _0x258add;})});}_0x928ff9=_['merge']({},_0x928ff9,_0x470508['options']);return _0x4052fd['getAgents'](_0x928ff9);}})[_0xd180('0x2a')](function(_0x18116d){if(_0x18116d){_0x9fd2b=_0x18116d['length'];if(!_0x470508[_0xd180('0x3c')][_0xd180('0x5c')](_0xd180('0x42'))){_0x928ff9[_0xd180('0x24')]=qs[_0xd180('0x24')](_0x470508['query'][_0xd180('0x24')]);_0x928ff9[_0xd180('0x23')]=qs[_0xd180('0x23')](_0x470508[_0xd180('0x3c')]['offset']);}return _0x4052fd[_0xd180('0x8c')](_0x928ff9);}})[_0xd180('0x2a')](function(_0x47c220){if(_0x47c220){return _0x47c220?{'count':_0x9fd2b,'rows':_0x47c220}:null;}})[_0xd180('0x2a')](respondWithResult(_0xb02088,null))[_0xd180('0x4e')](handleError(_0xb02088,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 73913b5..0fbb081 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 _0xb28e=['emit','hasOwnProperty','hook','events','MailQueue','setMaxListeners','save','update'];(function(_0x47a371,_0x892e6a){var _0x50f139=function(_0x1d5556){while(--_0x1d5556){_0x47a371['push'](_0x47a371['shift']());}};_0x50f139(++_0x892e6a);}(_0xb28e,0x133));var _0xeb28=function(_0x169c09,_0x58cefe){_0x169c09=_0x169c09-0x0;var _0x245f3b=_0xb28e[_0x169c09];return _0x245f3b;};'use strict';var EventEmitter=require(_0xeb28('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xeb28('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xeb28('0x2')](0x0);var events={'afterCreate':_0xeb28('0x3'),'afterUpdate':_0xeb28('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49dccd){return function(_0xbe4c11,_0x590149,_0x3684c2){MailQueueEvents[_0xeb28('0x5')](_0x49dccd+':'+_0xbe4c11['id'],_0xbe4c11);MailQueueEvents[_0xeb28('0x5')](_0x49dccd,_0xbe4c11);_0x3684c2(null);};}for(var e in events){if(events[_0xeb28('0x6')](e)){var event=events[e];MailQueue[_0xeb28('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x9500=['hasOwnProperty','exports','../../mysqldb','MailQueue','remove','emit'];(function(_0xb1ee0e,_0x2126df){var _0x376116=function(_0x44b7ad){while(--_0x44b7ad){_0xb1ee0e['push'](_0xb1ee0e['shift']());}};_0x376116(++_0x2126df);}(_0x9500,0x1ac));var _0x0950=function(_0xbafa43,_0x24a0fc){_0xbafa43=_0xbafa43-0x0;var _0x3bba68=_0x9500[_0xbafa43];return _0x3bba68;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x0950('0x0'))['db'][_0x0950('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0950('0x2')};function emitEvent(_0x1d4d48){return function(_0x11a7e3,_0x348cbe,_0x112f27){MailQueueEvents[_0x0950('0x3')](_0x1d4d48+':'+_0x11a7e3['id'],_0x11a7e3);MailQueueEvents['emit'](_0x1d4d48,_0x11a7e3);_0x112f27(null);};}for(var e in events){if(events[_0x0950('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x0950('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d24e1ef..40a5140 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 _0x70e0=['api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','MailQueue','lodash','util','../../config/logger'];(function(_0x478ff8,_0x62697b){var _0x279bda=function(_0xb87af0){while(--_0xb87af0){_0x478ff8['push'](_0x478ff8['shift']());}};_0x279bda(++_0x62697b);}(_0x70e0,0x13c));var _0x070e=function(_0x125100,_0x114c84){_0x125100=_0x125100-0x0;var _0x2b1c9f=_0x70e0[_0x125100];return _0x2b1c9f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var rp=require(_0x070e('0x6'));var fs=require('fs');var path=require(_0x070e('0x7'));var rimraf=require('rimraf');var config=require(_0x070e('0x8'));var attributes=require(_0x070e('0x9'));module['exports']=function(_0x435ff0,_0xfb452f){return _0x435ff0['define'](_0x070e('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe037=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0xe037,0x15e));var _0x7e03=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0xe037[_0x4b03d3];return _0x58a968;};'use strict';var _=require(_0x7e03('0x0'));var util=require(_0x7e03('0x1'));var logger=require(_0x7e03('0x2'))(_0x7e03('0x3'));var moment=require(_0x7e03('0x4'));var BPromise=require(_0x7e03('0x5'));var rp=require(_0x7e03('0x6'));var fs=require('fs');var path=require(_0x7e03('0x7'));var rimraf=require('rimraf');var config=require(_0x7e03('0x8'));var attributes=require(_0x7e03('0x9'));module['exports']=function(_0x5ad689,_0x58c258){return _0x5ad689[_0x7e03('0xa')](_0x7e03('0xb'),attributes,{'tableName':_0x7e03('0xc'),'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 32a87ea..e568470 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 _0x010e=['catch','findAll','raw','options','where','attributes','map','include','model','GetMailQueue','MailQueue','find','ShowMailQueue','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x010e,0x1c9));var _0xe010=function(_0xe11921,_0x3c1e04){_0xe11921=_0xe11921-0x0;var _0x3cf02e=_0x010e[_0xe11921];return _0x3cf02e;};'use strict';var _=require(_0xe010('0x0'));var util=require('util');var moment=require(_0xe010('0x1'));var BPromise=require('bluebird');var rs=require(_0xe010('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe010('0x3'))['db'];var utils=require(_0xe010('0x4'));var logger=require('../../config/logger')(_0xe010('0x5'));var config=require(_0xe010('0x6'));var jayson=require(_0xe010('0x7'));var client=jayson[_0xe010('0x8')][_0xe010('0x9')]({'port':0x232a});config[_0xe010('0xa')]=_[_0xe010('0xb')](config['redis'],{'host':_0xe010('0xc'),'port':0x18eb});var socket=require(_0xe010('0xd'))(new Redis(config[_0xe010('0xa')]));require(_0xe010('0xe'))['register'](socket);function respondWithRpcPromise(_0x1fb7b6,_0x50ffdd,_0xac6c1){return new BPromise(function(_0x1a6a1c,_0xfb3f9f){return client['request'](_0x1fb7b6,_0xac6c1)[_0xe010('0xf')](function(_0x26634b){logger[_0xe010('0x10')](_0xe010('0x11'),_0x50ffdd,'request\x20sent');logger[_0xe010('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x50ffdd,_0xe010('0x13'),JSON[_0xe010('0x14')](_0x26634b));if(_0x26634b[_0xe010('0x15')]){if(_0x26634b['error'][_0xe010('0x16')]===0x1f4){logger[_0xe010('0x15')](_0xe010('0x11'),_0x50ffdd,_0x26634b[_0xe010('0x15')][_0xe010('0x17')]);return _0xfb3f9f(_0x26634b[_0xe010('0x15')][_0xe010('0x17')]);}logger[_0xe010('0x15')]('MailQueue,\x20%s,\x20%s',_0x50ffdd,_0x26634b[_0xe010('0x15')][_0xe010('0x17')]);return _0x1a6a1c(_0x26634b[_0xe010('0x15')][_0xe010('0x17')]);}else{logger['info'](_0xe010('0x11'),_0x50ffdd,_0xe010('0x13'));_0x1a6a1c(_0x26634b['result'][_0xe010('0x17')]);}})[_0xe010('0x18')](function(_0x27b3fd){logger[_0xe010('0x15')]('MailQueue,\x20%s,\x20%s',_0x50ffdd,_0x27b3fd);_0xfb3f9f(_0x27b3fd);});});}exports['GetMailQueue']=function(_0x1daad4){var _0x52a148=this;return new Promise(function(_0x493c75,_0x1205d5){return db['MailQueue'][_0xe010('0x19')]({'raw':_0x1daad4['options']?_0x1daad4['options'][_0xe010('0x1a')]===undefined?!![]:![]:!![],'where':_0x1daad4[_0xe010('0x1b')]?_0x1daad4[_0xe010('0x1b')][_0xe010('0x1c')]||null:null,'attributes':_0x1daad4['options']?_0x1daad4[_0xe010('0x1b')][_0xe010('0x1d')]||null:null,'limit':_0x1daad4[_0xe010('0x1b')]?_0x1daad4['options']['limit']||null:null,'include':_0x1daad4['options']?_0x1daad4[_0xe010('0x1b')]['include']?_[_0xe010('0x1e')](_0x1daad4['options'][_0xe010('0x1f')],function(_0x585eb4){return{'model':db[_0x585eb4[_0xe010('0x20')]],'as':_0x585eb4['as'],'attributes':_0x585eb4[_0xe010('0x1d')],'include':_0x585eb4[_0xe010('0x1f')]?_[_0xe010('0x1e')](_0x585eb4[_0xe010('0x1f')],function(_0x4cb4a3){return{'model':db[_0x4cb4a3[_0xe010('0x20')]],'as':_0x4cb4a3['as'],'attributes':_0x4cb4a3[_0xe010('0x1d')],'include':_0x4cb4a3[_0xe010('0x1f')]?_[_0xe010('0x1e')](_0x4cb4a3[_0xe010('0x1f')],function(_0x4bee51){return{'model':db[_0x4bee51[_0xe010('0x20')]],'as':_0x4bee51['as'],'attributes':_0x4bee51[_0xe010('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe010('0xf')](function(_0x58a480){logger[_0xe010('0x10')]('GetMailQueue',_0x1daad4);logger['debug'](_0xe010('0x21'),_0x1daad4,JSON[_0xe010('0x14')](_0x58a480));_0x493c75(_0x58a480);})[_0xe010('0x18')](function(_0x2b4537){logger[_0xe010('0x15')](_0xe010('0x21'),_0x2b4537[_0xe010('0x17')],_0x1daad4);_0x1205d5(_0x52a148['error'](0x1f4,_0x2b4537['message']));});});};exports['ShowMailQueue']=function(_0x107258){var _0x5b2c55=this;return new Promise(function(_0x4d9dae,_0x500f88){return db[_0xe010('0x22')][_0xe010('0x23')]({'raw':_0x107258[_0xe010('0x1b')]?_0x107258['options'][_0xe010('0x1a')]===undefined?!![]:![]:!![],'where':_0x107258[_0xe010('0x1b')]?_0x107258[_0xe010('0x1b')][_0xe010('0x1c')]||null:null,'attributes':_0x107258['options']?_0x107258['options']['attributes']||null:null,'include':_0x107258[_0xe010('0x1b')]?_0x107258[_0xe010('0x1b')][_0xe010('0x1f')]?_[_0xe010('0x1e')](_0x107258[_0xe010('0x1b')][_0xe010('0x1f')],function(_0x7fa9b7){return{'model':db[_0x7fa9b7[_0xe010('0x20')]],'as':_0x7fa9b7['as'],'attributes':_0x7fa9b7[_0xe010('0x1d')],'include':_0x7fa9b7['include']?_[_0xe010('0x1e')](_0x7fa9b7['include'],function(_0x41e99e){return{'model':db[_0x41e99e[_0xe010('0x20')]],'as':_0x41e99e['as'],'attributes':_0x41e99e[_0xe010('0x1d')],'include':_0x41e99e[_0xe010('0x1f')]?_[_0xe010('0x1e')](_0x41e99e[_0xe010('0x1f')],function(_0x5cdce5){return{'model':db[_0x5cdce5[_0xe010('0x20')]],'as':_0x5cdce5['as'],'attributes':_0x5cdce5[_0xe010('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe010('0xf')](function(_0x222864){logger[_0xe010('0x10')]('ShowMailQueue',_0x107258);logger[_0xe010('0x12')](_0xe010('0x24'),_0x107258,JSON['stringify'](_0x222864));_0x4d9dae(_0x222864);})['catch'](function(_0x37f891){logger[_0xe010('0x15')](_0xe010('0x24'),_0x37f891[_0xe010('0x17')],_0x107258);_0x500f88(_0x5b2c55['error'](0x1f4,_0x37f891['message']));});});}; \ No newline at end of file +var _0x533b=['where','attributes','map','include','model','debug','ShowMailQueue','find','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw'];(function(_0x3c8b46,_0x34e053){var _0x4bf0a8=function(_0x4fd53f){while(--_0x4fd53f){_0x3c8b46['push'](_0x3c8b46['shift']());}};_0x4bf0a8(++_0x34e053);}(_0x533b,0x98));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb533('0x0'));var moment=require(_0xb533('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb533('0x2'));var logger=require(_0xb533('0x3'))(_0xb533('0x4'));var config=require(_0xb533('0x5'));var jayson=require(_0xb533('0x6'));var client=jayson[_0xb533('0x7')]['http']({'port':0x232a});config['redis']=_[_0xb533('0x8')](config[_0xb533('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb533('0xa'))(new Redis(config['redis']));require(_0xb533('0xb'))[_0xb533('0xc')](socket);function respondWithRpcPromise(_0x597728,_0x4ac3e0,_0x3f326e){return new BPromise(function(_0x9d3955,_0xf04c26){return client['request'](_0x597728,_0x3f326e)[_0xb533('0xd')](function(_0x6ef72){logger[_0xb533('0xe')](_0xb533('0xf'),_0x4ac3e0,_0xb533('0x10'));logger['debug'](_0xb533('0x11'),_0x4ac3e0,_0xb533('0x10'),JSON[_0xb533('0x12')](_0x6ef72));if(_0x6ef72[_0xb533('0x13')]){if(_0x6ef72['error'][_0xb533('0x14')]===0x1f4){logger[_0xb533('0x13')](_0xb533('0xf'),_0x4ac3e0,_0x6ef72['error'][_0xb533('0x15')]);return _0xf04c26(_0x6ef72[_0xb533('0x13')][_0xb533('0x15')]);}logger[_0xb533('0x13')](_0xb533('0xf'),_0x4ac3e0,_0x6ef72['error']['message']);return _0x9d3955(_0x6ef72[_0xb533('0x13')][_0xb533('0x15')]);}else{logger[_0xb533('0xe')](_0xb533('0xf'),_0x4ac3e0,_0xb533('0x10'));_0x9d3955(_0x6ef72['result'][_0xb533('0x15')]);}})[_0xb533('0x16')](function(_0x2ba40b){logger['error'](_0xb533('0xf'),_0x4ac3e0,_0x2ba40b);_0xf04c26(_0x2ba40b);});});}exports[_0xb533('0x17')]=function(_0x99c8a2){var _0xa57adb=this;return new Promise(function(_0x2a02ef,_0x2151d4){return db[_0xb533('0x18')][_0xb533('0x19')]({'raw':_0x99c8a2[_0xb533('0x1a')]?_0x99c8a2[_0xb533('0x1a')][_0xb533('0x1b')]===undefined?!![]:![]:!![],'where':_0x99c8a2[_0xb533('0x1a')]?_0x99c8a2[_0xb533('0x1a')][_0xb533('0x1c')]||null:null,'attributes':_0x99c8a2[_0xb533('0x1a')]?_0x99c8a2[_0xb533('0x1a')][_0xb533('0x1d')]||null:null,'limit':_0x99c8a2[_0xb533('0x1a')]?_0x99c8a2['options']['limit']||null:null,'include':_0x99c8a2[_0xb533('0x1a')]?_0x99c8a2[_0xb533('0x1a')]['include']?_[_0xb533('0x1e')](_0x99c8a2[_0xb533('0x1a')][_0xb533('0x1f')],function(_0x5e873e){return{'model':db[_0x5e873e[_0xb533('0x20')]],'as':_0x5e873e['as'],'attributes':_0x5e873e[_0xb533('0x1d')],'include':_0x5e873e[_0xb533('0x1f')]?_['map'](_0x5e873e['include'],function(_0x32d218){return{'model':db[_0x32d218['model']],'as':_0x32d218['as'],'attributes':_0x32d218[_0xb533('0x1d')],'include':_0x32d218[_0xb533('0x1f')]?_[_0xb533('0x1e')](_0x32d218[_0xb533('0x1f')],function(_0x1a9897){return{'model':db[_0x1a9897[_0xb533('0x20')]],'as':_0x1a9897['as'],'attributes':_0x1a9897[_0xb533('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb533('0xd')](function(_0x33a56f){logger[_0xb533('0xe')](_0xb533('0x17'),_0x99c8a2);logger[_0xb533('0x21')](_0xb533('0x17'),_0x99c8a2,JSON[_0xb533('0x12')](_0x33a56f));_0x2a02ef(_0x33a56f);})['catch'](function(_0x447553){logger[_0xb533('0x13')](_0xb533('0x17'),_0x447553['message'],_0x99c8a2);_0x2151d4(_0xa57adb['error'](0x1f4,_0x447553[_0xb533('0x15')]));});});};exports[_0xb533('0x22')]=function(_0x4fd18e){var _0x12d665=this;return new Promise(function(_0x266bf9,_0x238ec7){return db[_0xb533('0x18')][_0xb533('0x23')]({'raw':_0x4fd18e[_0xb533('0x1a')]?_0x4fd18e[_0xb533('0x1a')][_0xb533('0x1b')]===undefined?!![]:![]:!![],'where':_0x4fd18e[_0xb533('0x1a')]?_0x4fd18e[_0xb533('0x1a')][_0xb533('0x1c')]||null:null,'attributes':_0x4fd18e[_0xb533('0x1a')]?_0x4fd18e[_0xb533('0x1a')][_0xb533('0x1d')]||null:null,'include':_0x4fd18e[_0xb533('0x1a')]?_0x4fd18e['options'][_0xb533('0x1f')]?_[_0xb533('0x1e')](_0x4fd18e[_0xb533('0x1a')]['include'],function(_0x5218ac){return{'model':db[_0x5218ac[_0xb533('0x20')]],'as':_0x5218ac['as'],'attributes':_0x5218ac[_0xb533('0x1d')],'include':_0x5218ac[_0xb533('0x1f')]?_['map'](_0x5218ac['include'],function(_0x48e60b){return{'model':db[_0x48e60b[_0xb533('0x20')]],'as':_0x48e60b['as'],'attributes':_0x48e60b[_0xb533('0x1d')],'include':_0x48e60b[_0xb533('0x1f')]?_['map'](_0x48e60b['include'],function(_0x833de3){return{'model':db[_0x833de3[_0xb533('0x20')]],'as':_0x833de3['as'],'attributes':_0x833de3[_0xb533('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb533('0xd')](function(_0x5507cc){logger[_0xb533('0xe')](_0xb533('0x22'),_0x4fd18e);logger[_0xb533('0x21')](_0xb533('0x22'),_0x4fd18e,JSON[_0xb533('0x12')](_0x5507cc));_0x266bf9(_0x5507cc);})[_0xb533('0x16')](function(_0x507855){logger[_0xb533('0x13')](_0xb533('0x22'),_0x507855[_0xb533('0x15')],_0x4fd18e);_0x238ec7(_0x12d665['error'](0x1f4,_0x507855[_0xb533('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7307cc8..a608cda 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 _0xd1e6=['remove','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x289650,_0x453586){var _0x4fcebf=function(_0x13336b){while(--_0x13336b){_0x289650['push'](_0x289650['shift']());}};_0x4fcebf(++_0x453586);}(_0xd1e6,0x156));var _0x6d1e=function(_0x96e6d1,_0x5c755a){_0x96e6d1=_0x96e6d1-0x0;var _0x8f96a5=_0xd1e6[_0x96e6d1];return _0x8f96a5;};'use strict';var MailQueueEvents=require(_0x6d1e('0x0'));var events=['save',_0x6d1e('0x1'),'update'];function createListener(_0x466645,_0x487601){return function(_0x195f20){_0x487601[_0x6d1e('0x2')](_0x466645,_0x195f20);};}function removeListener(_0x18622c,_0x2b2263){return function(){MailQueueEvents[_0x6d1e('0x3')](_0x18622c,_0x2b2263);};}exports[_0x6d1e('0x4')]=function(_0x585bb7){for(var _0x3f02e7=0x0,_0x2a8804=events[_0x6d1e('0x5')];_0x3f02e7<_0x2a8804;_0x3f02e7++){var _0x3345bc=events[_0x3f02e7];var _0x5e0a19=createListener(_0x6d1e('0x6')+_0x3345bc,_0x585bb7);MailQueueEvents['on'](_0x3345bc,_0x5e0a19);}}; \ No newline at end of file +var _0x7ca5=['mailQueue:','save','update','emit','removeListener','register','length'];(function(_0x50741a,_0x241f38){var _0x557f48=function(_0x3a501e){while(--_0x3a501e){_0x50741a['push'](_0x50741a['shift']());}};_0x557f48(++_0x241f38);}(_0x7ca5,0x13c));var _0x57ca=function(_0x4a3442,_0x494cf5){_0x4a3442=_0x4a3442-0x0;var _0xd0d6d5=_0x7ca5[_0x4a3442];return _0xd0d6d5;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x57ca('0x0'),'remove',_0x57ca('0x1')];function createListener(_0x5e3195,_0xe85223){return function(_0x3ab78e){_0xe85223[_0x57ca('0x2')](_0x5e3195,_0x3ab78e);};}function removeListener(_0x108a93,_0x58b07c){return function(){MailQueueEvents[_0x57ca('0x3')](_0x108a93,_0x58b07c);};}exports[_0x57ca('0x4')]=function(_0xda8521){for(var _0x54a93e=0x0,_0x3a5b9d=events[_0x57ca('0x5')];_0x54a93e<_0x3a5b9d;_0x54a93e++){var _0x5c145c=events[_0x54a93e];var _0x326a64=createListener(_0x57ca('0x6')+_0x5c145c,_0xda8521);MailQueueEvents['on'](_0x5c145c,_0x326a64);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7c89a10..253b197 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 _0x4c47=['show','post','create','put','delete','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x4c47,0xc2));var _0x74c4=function(_0x398c4a,_0x237aa4){_0x398c4a=_0x398c4a-0x0;var _0x20a473=_0x4c47[_0x398c4a];return _0x20a473;};'use strict';var multer=require(_0x74c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x74c4('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x74c4('0x2'));var interaction=require(_0x74c4('0x3'));var config=require(_0x74c4('0x4'));var controller=require(_0x74c4('0x5'));router[_0x74c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x74c4('0x7')]);router[_0x74c4('0x6')](_0x74c4('0x8'),auth[_0x74c4('0x9')](),controller['describe']);router[_0x74c4('0x6')]('/:id',auth[_0x74c4('0x9')](),controller[_0x74c4('0xa')]);router[_0x74c4('0xb')]('/',auth[_0x74c4('0x9')](),controller[_0x74c4('0xc')]);router[_0x74c4('0xd')]('/:id',auth[_0x74c4('0x9')](),controller['update']);router[_0x74c4('0xe')]('/:id',auth[_0x74c4('0x9')](),controller[_0x74c4('0xf')]);module[_0x74c4('0x10')]=router; \ No newline at end of file +var _0xa92e=['multer','util','connect-timeout','express','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports'];(function(_0xc6436a,_0x4c7d62){var _0x224f50=function(_0x73fa7){while(--_0x73fa7){_0xc6436a['push'](_0xc6436a['shift']());}};_0x224f50(++_0x4c7d62);}(_0xa92e,0x110));var _0xea92=function(_0x661b43,_0x157fe7){_0x661b43=_0x661b43-0x0;var _0x1f2810=_0xa92e[_0x661b43];return _0x1f2810;};'use strict';var multer=require(_0xea92('0x0'));var util=require(_0xea92('0x1'));var path=require('path');var timeout=require(_0xea92('0x2'));var express=require(_0xea92('0x3'));var router=express['Router']();var auth=require(_0xea92('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xea92('0x5'));router[_0xea92('0x6')]('/',auth[_0xea92('0x7')](),controller[_0xea92('0x8')]);router[_0xea92('0x6')](_0xea92('0x9'),auth[_0xea92('0x7')](),controller[_0xea92('0xa')]);router[_0xea92('0x6')](_0xea92('0xb'),auth[_0xea92('0x7')](),controller[_0xea92('0xc')]);router[_0xea92('0xd')]('/',auth[_0xea92('0x7')](),controller['create']);router[_0xea92('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xea92('0xb'),auth[_0xea92('0x7')](),controller[_0xea92('0xf')]);module[_0xea92('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 4688862..2e57d24 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 _0xecb9=['DATE','moment','sequelize','STRING'];(function(_0xca0fda,_0x38ac00){var _0x1d9826=function(_0x22f3bf){while(--_0x22f3bf){_0xca0fda['push'](_0xca0fda['shift']());}};_0x1d9826(++_0x38ac00);}(_0xecb9,0x175));var _0x9ecb=function(_0x2bc09e,_0x1ae747){_0x2bc09e=_0x2bc09e-0x0;var _0x3f7c75=_0xecb9[_0x2bc09e];return _0x3f7c75;};'use strict';var moment=require(_0x9ecb('0x0'));var Sequelize=require(_0x9ecb('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9ecb('0x2')]},'joinAt':{'type':Sequelize[_0x9ecb('0x3')]},'leaveAt':{'type':Sequelize[_0x9ecb('0x3')]},'acceptAt':{'type':Sequelize[_0x9ecb('0x3')]},'exitAt':{'type':Sequelize[_0x9ecb('0x3')]},'reason':{'type':Sequelize[_0x9ecb('0x2')]}}; \ No newline at end of file +var _0x13fa=['STRING','DATE','moment','sequelize'];(function(_0xb94ff7,_0x46f8dc){var _0x5951de=function(_0x394fcf){while(--_0x394fcf){_0xb94ff7['push'](_0xb94ff7['shift']());}};_0x5951de(++_0x46f8dc);}(_0x13fa,0xea));var _0xa13f=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0x13fa[_0x1306f3];return _0xc1c7bf;};'use strict';var moment=require(_0xa13f('0x0'));var Sequelize=require(_0xa13f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa13f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa13f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa13f('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa13f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8962714..3889ec8 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 _0x5ab0=['Content-Range','apply','save','then','error','stack','name','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','MailQueueReport','findAll','rows','catch','show','find','update','body','destroy','params','describe','eml-format','rimraf','zip-dir','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set'];(function(_0x8b6f53,_0x3c6293){var _0x34288e=function(_0x5d7c62){while(--_0x5d7c62){_0x8b6f53['push'](_0x8b6f53['shift']());}};_0x34288e(++_0x3c6293);}(_0x5ab0,0x75));var _0x05ab=function(_0x446d4f,_0x4f7b58){_0x446d4f=_0x446d4f-0x0;var _0x2d7d09=_0x5ab0[_0x446d4f];return _0x2d7d09;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x05ab('0x0'));var rimraf=require(_0x05ab('0x1'));var zipdir=require(_0x05ab('0x2'));var jsonpatch=require(_0x05ab('0x3'));var rp=require(_0x05ab('0x4'));var moment=require(_0x05ab('0x5'));var BPromise=require(_0x05ab('0x6'));var Mustache=require(_0x05ab('0x7'));var util=require(_0x05ab('0x8'));var path=require(_0x05ab('0x9'));var sox=require(_0x05ab('0xa'));var csv=require(_0x05ab('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x05ab('0xc'));var squel=require(_0x05ab('0xd'));var crypto=require('crypto');var jsforce=require(_0x05ab('0xe'));var deskjs=require(_0x05ab('0xf'));var toCsv=require('to-csv');var querystring=require(_0x05ab('0x10'));var Papa=require(_0x05ab('0x11'));var Redis=require(_0x05ab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x05ab('0x13'));var as=require(_0x05ab('0x14'));var hardwareService=require(_0x05ab('0x15'));var logger=require(_0x05ab('0x16'))(_0x05ab('0x17'));var utils=require(_0x05ab('0x18'));var config=require(_0x05ab('0x19'));var licenseUtil=require(_0x05ab('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f3d79,_0x5aa05e){_0x5aa05e=_0x5aa05e||0xcc;return function(_0x55e8e5){if(_0x55e8e5){return _0x3f3d79[_0x05ab('0x1b')](_0x5aa05e);}return _0x3f3d79['status'](_0x5aa05e)[_0x05ab('0x1c')]();};}function respondWithResult(_0x290fa7,_0x36e2f8){_0x36e2f8=_0x36e2f8||0xc8;return function(_0x181d14){if(_0x181d14){return _0x290fa7['status'](_0x36e2f8)[_0x05ab('0x1d')](_0x181d14);}};}function respondWithFilteredResult(_0x3d889f,_0x305638){return function(_0x35da13){if(_0x35da13){var _0x266914=_0x35da13[_0x05ab('0x1e')],_0x2bf70=_0x305638[_0x05ab('0x1f')],_0x224d8d=_0x305638['offset']+_0x305638[_0x05ab('0x20')],_0x59184e;if(_0x224d8d>=_0x266914){_0x224d8d=_0x266914;_0x59184e=0xc8;}else{_0x59184e=0xce;}_0x3d889f[_0x05ab('0x21')](_0x59184e);return _0x3d889f[_0x05ab('0x22')](_0x05ab('0x23'),_0x2bf70+'-'+_0x224d8d+'/'+_0x266914)[_0x05ab('0x1d')](_0x35da13);}return null;};}function patchUpdates(_0x5442b2){return function(_0x29ab96){try{jsonpatch[_0x05ab('0x24')](_0x29ab96,_0x5442b2,!![]);}catch(_0x40b781){return BPromise['reject'](_0x40b781);}return _0x29ab96[_0x05ab('0x25')]();};}function saveUpdates(_0x271cbb,_0x164f27){return function(_0x53d3ef){if(_0x53d3ef){return _0x53d3ef['update'](_0x271cbb)[_0x05ab('0x26')](function(_0x30dd05){return _0x30dd05;});}return null;};}function removeEntity(_0x3f7f07,_0x264b65){return function(_0x47a847){if(_0x47a847){return _0x47a847['destroy']()[_0x05ab('0x26')](function(){_0x3f7f07[_0x05ab('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeb5d77,_0x3d787c){return function(_0x43386c){if(!_0x43386c){_0xeb5d77[_0x05ab('0x1b')](0x194);}return _0x43386c;};}function handleError(_0x5a1890,_0x346a24){_0x346a24=_0x346a24||0x1f4;return function(_0x43e9ba){logger[_0x05ab('0x27')](_0x43e9ba[_0x05ab('0x28')]);if(_0x43e9ba[_0x05ab('0x29')]){delete _0x43e9ba[_0x05ab('0x29')];}_0x5a1890[_0x05ab('0x21')](_0x346a24)['send'](_0x43e9ba);};}exports['index']=function(_0x32b239,_0x4e233e){var _0x1f8942={},_0x59cb72={},_0xa65f76={'count':0x0,'rows':[]};var _0x1c6660=_['map'](db['MailQueueReport'][_0x05ab('0x2a')],function(_0x58f4e3){return{'name':_0x58f4e3['fieldName'],'type':_0x58f4e3['type'][_0x05ab('0x2b')]};});_0x59cb72[_0x05ab('0x2c')]=_[_0x05ab('0x2d')](_0x1c6660,'name');_0x59cb72[_0x05ab('0x2e')]=_[_0x05ab('0x2f')](_0x32b239['query']);_0x59cb72[_0x05ab('0x30')]=_[_0x05ab('0x31')](_0x59cb72[_0x05ab('0x2c')],_0x59cb72[_0x05ab('0x2e')]);_0x1f8942[_0x05ab('0x32')]=_[_0x05ab('0x31')](_0x59cb72[_0x05ab('0x2c')],qs['fields'](_0x32b239[_0x05ab('0x2e')][_0x05ab('0x33')]));_0x1f8942[_0x05ab('0x32')]=_0x1f8942[_0x05ab('0x32')][_0x05ab('0x34')]?_0x1f8942[_0x05ab('0x32')]:_0x59cb72[_0x05ab('0x2c')];if(!_0x32b239[_0x05ab('0x2e')][_0x05ab('0x35')](_0x05ab('0x36'))){_0x1f8942[_0x05ab('0x20')]=qs[_0x05ab('0x20')](_0x32b239[_0x05ab('0x2e')][_0x05ab('0x20')]);_0x1f8942[_0x05ab('0x1f')]=qs['offset'](_0x32b239[_0x05ab('0x2e')][_0x05ab('0x1f')]);}_0x1f8942[_0x05ab('0x37')]=qs[_0x05ab('0x38')](_0x32b239['query'][_0x05ab('0x38')]);_0x1f8942['where']=qs[_0x05ab('0x30')](_['pick'](_0x32b239['query'],_0x59cb72['filters']),_0x1c6660);if(_0x32b239[_0x05ab('0x2e')][_0x05ab('0x39')]){_0x1f8942[_0x05ab('0x3a')]=_[_0x05ab('0x3b')](_0x1f8942[_0x05ab('0x3a')],{'$or':_[_0x05ab('0x2d')](_0x1c6660,function(_0x43048f){if(_0x43048f[_0x05ab('0x3c')]!==_0x05ab('0x3d')){var _0x22f691={};_0x22f691[_0x43048f[_0x05ab('0x29')]]={'$like':'%'+_0x32b239[_0x05ab('0x2e')][_0x05ab('0x39')]+'%'};return _0x22f691;}})});}_0x1f8942=_[_0x05ab('0x3b')]({},_0x1f8942,_0x32b239[_0x05ab('0x3e')]);var _0xf61058={'where':_0x1f8942[_0x05ab('0x3a')]};return db['MailQueueReport']['count'](_0xf61058)[_0x05ab('0x26')](function(_0x513bd4){_0xa65f76[_0x05ab('0x1e')]=_0x513bd4;if(_0x32b239['query'][_0x05ab('0x3f')]){_0x1f8942[_0x05ab('0x40')]=[{'all':!![]}];}return db[_0x05ab('0x41')][_0x05ab('0x42')](_0x1f8942);})[_0x05ab('0x26')](function(_0x2ca358){_0xa65f76[_0x05ab('0x43')]=_0x2ca358;return _0xa65f76;})['then'](respondWithFilteredResult(_0x4e233e,_0x1f8942))[_0x05ab('0x44')](handleError(_0x4e233e,null));};exports[_0x05ab('0x45')]=function(_0x2a41c5,_0xcd4024){var _0x28db0b={'raw':!![],'where':{'id':_0x2a41c5['params']['id']}},_0x286429={};_0x286429[_0x05ab('0x2c')]=_['keys'](db[_0x05ab('0x41')][_0x05ab('0x2a')]);_0x286429[_0x05ab('0x2e')]=_[_0x05ab('0x2f')](_0x2a41c5[_0x05ab('0x2e')]);_0x286429[_0x05ab('0x30')]=_['intersection'](_0x286429[_0x05ab('0x2c')],_0x286429['query']);_0x28db0b[_0x05ab('0x32')]=_[_0x05ab('0x31')](_0x286429[_0x05ab('0x2c')],qs['fields'](_0x2a41c5[_0x05ab('0x2e')][_0x05ab('0x33')]));_0x28db0b[_0x05ab('0x32')]=_0x28db0b[_0x05ab('0x32')]['length']?_0x28db0b[_0x05ab('0x32')]:_0x286429['model'];if(_0x2a41c5['query'][_0x05ab('0x3f')]){_0x28db0b['include']=[{'all':!![]}];}_0x28db0b=_['merge']({},_0x28db0b,_0x2a41c5['options']);return db[_0x05ab('0x41')][_0x05ab('0x46')](_0x28db0b)['then'](handleEntityNotFound(_0xcd4024,null))[_0x05ab('0x26')](respondWithResult(_0xcd4024,null))['catch'](handleError(_0xcd4024,null));};exports['create']=function(_0x3f5517,_0x3e91bc){return db[_0x05ab('0x41')]['create'](_0x3f5517['body'],{})[_0x05ab('0x26')](respondWithResult(_0x3e91bc,0xc9))[_0x05ab('0x44')](handleError(_0x3e91bc,null));};exports[_0x05ab('0x47')]=function(_0x3f9618,_0x3f809f){if(_0x3f9618[_0x05ab('0x48')]['id']){delete _0x3f9618[_0x05ab('0x48')]['id'];}return db[_0x05ab('0x41')][_0x05ab('0x46')]({'where':{'id':_0x3f9618['params']['id']}})['then'](handleEntityNotFound(_0x3f809f,null))[_0x05ab('0x26')](saveUpdates(_0x3f9618[_0x05ab('0x48')],null))[_0x05ab('0x26')](respondWithResult(_0x3f809f,null))[_0x05ab('0x44')](handleError(_0x3f809f,null));};exports[_0x05ab('0x49')]=function(_0x48ac8a,_0x25f24a){return db[_0x05ab('0x41')][_0x05ab('0x46')]({'where':{'id':_0x48ac8a[_0x05ab('0x4a')]['id']}})[_0x05ab('0x26')](handleEntityNotFound(_0x25f24a,null))[_0x05ab('0x26')](removeEntity(_0x25f24a,null))[_0x05ab('0x44')](handleError(_0x25f24a,null));};exports['describe']=function(_0x3993a0,_0xf5540c){return db[_0x05ab('0x41')][_0x05ab('0x4b')]()['then'](respondWithResult(_0xf5540c,null))[_0x05ab('0x44')](handleError(_0xf5540c,null));}; \ No newline at end of file +var _0xd0fa=['../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','then','destroy','error','stack','name','send','MailQueueReport','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','catch','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xd0fa,0x155));var _0xad0f=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xd0fa[_0x9c2427];return _0x51984f;};'use strict';var pdf=require(_0xad0f('0x0'));var emlformat=require(_0xad0f('0x1'));var rimraf=require(_0xad0f('0x2'));var zipdir=require(_0xad0f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad0f('0x4'));var moment=require(_0xad0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad0f('0x6'));var util=require(_0xad0f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xad0f('0x8'));var ejs=require(_0xad0f('0x9'));var fs=require('fs');var _=require(_0xad0f('0xa'));var squel=require(_0xad0f('0xb'));var crypto=require(_0xad0f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xad0f('0xd'));var toCsv=require(_0xad0f('0x8'));var querystring=require(_0xad0f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad0f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xad0f('0x10'))('api');var utils=require(_0xad0f('0x11'));var config=require(_0xad0f('0x12'));var licenseUtil=require(_0xad0f('0x13'));var db=require(_0xad0f('0x14'))['db'];function respondWithStatusCode(_0x7ded31,_0x363a3f){_0x363a3f=_0x363a3f||0xcc;return function(_0x2b18fe){if(_0x2b18fe){return _0x7ded31[_0xad0f('0x15')](_0x363a3f);}return _0x7ded31[_0xad0f('0x16')](_0x363a3f)[_0xad0f('0x17')]();};}function respondWithResult(_0x4ef537,_0x30197d){_0x30197d=_0x30197d||0xc8;return function(_0x153fa6){if(_0x153fa6){return _0x4ef537['status'](_0x30197d)['json'](_0x153fa6);}};}function respondWithFilteredResult(_0x17a7fb,_0x54151b){return function(_0x759b54){if(_0x759b54){var _0x5d66e7=_0x759b54[_0xad0f('0x18')],_0x1171f4=_0x54151b[_0xad0f('0x19')],_0x40737c=_0x54151b[_0xad0f('0x19')]+_0x54151b[_0xad0f('0x1a')],_0x4f28e9;if(_0x40737c>=_0x5d66e7){_0x40737c=_0x5d66e7;_0x4f28e9=0xc8;}else{_0x4f28e9=0xce;}_0x17a7fb[_0xad0f('0x16')](_0x4f28e9);return _0x17a7fb[_0xad0f('0x1b')](_0xad0f('0x1c'),_0x1171f4+'-'+_0x40737c+'/'+_0x5d66e7)[_0xad0f('0x1d')](_0x759b54);}return null;};}function patchUpdates(_0x1f5df5){return function(_0x548917){try{jsonpatch['apply'](_0x548917,_0x1f5df5,!![]);}catch(_0x3cfb5e){return BPromise['reject'](_0x3cfb5e);}return _0x548917[_0xad0f('0x1e')]();};}function saveUpdates(_0x2fa9d2,_0x3a86fc){return function(_0x16f230){if(_0x16f230){return _0x16f230['update'](_0x2fa9d2)[_0xad0f('0x1f')](function(_0x1dc850){return _0x1dc850;});}return null;};}function removeEntity(_0x4e5271,_0xfc5264){return function(_0x2ebdae){if(_0x2ebdae){return _0x2ebdae[_0xad0f('0x20')]()[_0xad0f('0x1f')](function(){_0x4e5271['status'](0xcc)[_0xad0f('0x17')]();});}};}function handleEntityNotFound(_0xbdd5a2,_0x318092){return function(_0x10779f){if(!_0x10779f){_0xbdd5a2['sendStatus'](0x194);}return _0x10779f;};}function handleError(_0x2cb01e,_0x5c22b8){_0x5c22b8=_0x5c22b8||0x1f4;return function(_0x1c76b5){logger[_0xad0f('0x21')](_0x1c76b5[_0xad0f('0x22')]);if(_0x1c76b5[_0xad0f('0x23')]){delete _0x1c76b5[_0xad0f('0x23')];}_0x2cb01e[_0xad0f('0x16')](_0x5c22b8)[_0xad0f('0x24')](_0x1c76b5);};}exports['index']=function(_0xf95842,_0x8ffa35){var _0x380628={},_0x2acc5d={},_0x18c9ea={'count':0x0,'rows':[]};var _0x34a209=_['map'](db[_0xad0f('0x25')]['rawAttributes'],function(_0x2010cd){return{'name':_0x2010cd[_0xad0f('0x26')],'type':_0x2010cd[_0xad0f('0x27')][_0xad0f('0x28')]};});_0x2acc5d[_0xad0f('0x29')]=_[_0xad0f('0x2a')](_0x34a209,_0xad0f('0x23'));_0x2acc5d[_0xad0f('0x2b')]=_[_0xad0f('0x2c')](_0xf95842[_0xad0f('0x2b')]);_0x2acc5d['filters']=_[_0xad0f('0x2d')](_0x2acc5d['model'],_0x2acc5d[_0xad0f('0x2b')]);_0x380628[_0xad0f('0x2e')]=_[_0xad0f('0x2d')](_0x2acc5d[_0xad0f('0x29')],qs[_0xad0f('0x2f')](_0xf95842[_0xad0f('0x2b')][_0xad0f('0x2f')]));_0x380628[_0xad0f('0x2e')]=_0x380628['attributes'][_0xad0f('0x30')]?_0x380628[_0xad0f('0x2e')]:_0x2acc5d[_0xad0f('0x29')];if(!_0xf95842[_0xad0f('0x2b')][_0xad0f('0x31')](_0xad0f('0x32'))){_0x380628['limit']=qs[_0xad0f('0x1a')](_0xf95842[_0xad0f('0x2b')]['limit']);_0x380628[_0xad0f('0x19')]=qs[_0xad0f('0x19')](_0xf95842[_0xad0f('0x2b')]['offset']);}_0x380628[_0xad0f('0x33')]=qs[_0xad0f('0x34')](_0xf95842['query']['sort']);_0x380628['where']=qs[_0xad0f('0x35')](_[_0xad0f('0x36')](_0xf95842[_0xad0f('0x2b')],_0x2acc5d['filters']),_0x34a209);if(_0xf95842[_0xad0f('0x2b')][_0xad0f('0x37')]){_0x380628[_0xad0f('0x38')]=_[_0xad0f('0x39')](_0x380628[_0xad0f('0x38')],{'$or':_[_0xad0f('0x2a')](_0x34a209,function(_0xa87202){if(_0xa87202[_0xad0f('0x27')]!==_0xad0f('0x3a')){var _0x1db7ec={};_0x1db7ec[_0xa87202[_0xad0f('0x23')]]={'$like':'%'+_0xf95842[_0xad0f('0x2b')][_0xad0f('0x37')]+'%'};return _0x1db7ec;}})});}_0x380628=_['merge']({},_0x380628,_0xf95842[_0xad0f('0x3b')]);var _0x280566={'where':_0x380628['where']};return db[_0xad0f('0x25')]['count'](_0x280566)[_0xad0f('0x1f')](function(_0x536b8b){_0x18c9ea[_0xad0f('0x18')]=_0x536b8b;if(_0xf95842['query'][_0xad0f('0x3c')]){_0x380628['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xad0f('0x3d')](_0x380628);})['then'](function(_0x227497){_0x18c9ea[_0xad0f('0x3e')]=_0x227497;return _0x18c9ea;})[_0xad0f('0x1f')](respondWithFilteredResult(_0x8ffa35,_0x380628))['catch'](handleError(_0x8ffa35,null));};exports[_0xad0f('0x3f')]=function(_0x242d22,_0x34ad8d){var _0x540621={'raw':!![],'where':{'id':_0x242d22[_0xad0f('0x40')]['id']}},_0xf7f2fe={};_0xf7f2fe['model']=_['keys'](db[_0xad0f('0x25')][_0xad0f('0x41')]);_0xf7f2fe['query']=_[_0xad0f('0x2c')](_0x242d22[_0xad0f('0x2b')]);_0xf7f2fe[_0xad0f('0x35')]=_[_0xad0f('0x2d')](_0xf7f2fe['model'],_0xf7f2fe[_0xad0f('0x2b')]);_0x540621[_0xad0f('0x2e')]=_[_0xad0f('0x2d')](_0xf7f2fe[_0xad0f('0x29')],qs[_0xad0f('0x2f')](_0x242d22[_0xad0f('0x2b')][_0xad0f('0x2f')]));_0x540621[_0xad0f('0x2e')]=_0x540621[_0xad0f('0x2e')]['length']?_0x540621[_0xad0f('0x2e')]:_0xf7f2fe['model'];if(_0x242d22[_0xad0f('0x2b')][_0xad0f('0x3c')]){_0x540621['include']=[{'all':!![]}];}_0x540621=_[_0xad0f('0x39')]({},_0x540621,_0x242d22[_0xad0f('0x3b')]);return db[_0xad0f('0x25')]['find'](_0x540621)['then'](handleEntityNotFound(_0x34ad8d,null))[_0xad0f('0x1f')](respondWithResult(_0x34ad8d,null))[_0xad0f('0x42')](handleError(_0x34ad8d,null));};exports[_0xad0f('0x43')]=function(_0x1a3c11,_0x16ff33){return db['MailQueueReport'][_0xad0f('0x43')](_0x1a3c11[_0xad0f('0x44')],{})[_0xad0f('0x1f')](respondWithResult(_0x16ff33,0xc9))[_0xad0f('0x42')](handleError(_0x16ff33,null));};exports[_0xad0f('0x45')]=function(_0x49960a,_0x47a4fa){if(_0x49960a[_0xad0f('0x44')]['id']){delete _0x49960a['body']['id'];}return db[_0xad0f('0x25')][_0xad0f('0x46')]({'where':{'id':_0x49960a[_0xad0f('0x40')]['id']}})[_0xad0f('0x1f')](handleEntityNotFound(_0x47a4fa,null))['then'](saveUpdates(_0x49960a[_0xad0f('0x44')],null))[_0xad0f('0x1f')](respondWithResult(_0x47a4fa,null))[_0xad0f('0x42')](handleError(_0x47a4fa,null));};exports[_0xad0f('0x20')]=function(_0xb57c81,_0x5a5bb5){return db[_0xad0f('0x25')][_0xad0f('0x46')]({'where':{'id':_0xb57c81['params']['id']}})['then'](handleEntityNotFound(_0x5a5bb5,null))[_0xad0f('0x1f')](removeEntity(_0x5a5bb5,null))['catch'](handleError(_0x5a5bb5,null));};exports[_0xad0f('0x47')]=function(_0x521db2,_0x51dbbc){return db[_0xad0f('0x25')][_0xad0f('0x47')]()[_0xad0f('0x1f')](respondWithResult(_0x51dbbc,null))[_0xad0f('0x42')](handleError(_0x51dbbc,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index fe43ea0..9f64d37 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 _0x6113=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','report_mail_queue'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x6113,0x1c8));var _0x3611=function(_0x1527e7,_0x23e9d4){_0x1527e7=_0x1527e7-0x0;var _0x22b79d=_0x6113[_0x1527e7];return _0x22b79d;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))('api');var moment=require(_0x3611('0x3'));var BPromise=require(_0x3611('0x4'));var rp=require(_0x3611('0x5'));var fs=require('fs');var path=require(_0x3611('0x6'));var rimraf=require(_0x3611('0x7'));var config=require(_0x3611('0x8'));var attributes=require(_0x3611('0x9'));module['exports']=function(_0x377654,_0x18306f){return _0x377654[_0x3611('0xa')]('MailQueueReport',attributes,{'tableName':_0x3611('0xb'),'paranoid':![],'indexes':[{'name':_0x3611('0xc'),'fields':[_0x3611('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4e5=['util','moment','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x4ff401,_0x5c1854){var _0x59b0fb=function(_0x2ec9c2){while(--_0x2ec9c2){_0x4ff401['push'](_0x4ff401['shift']());}};_0x59b0fb(++_0x5c1854);}(_0xd4e5,0x1ae));var _0x5d4e=function(_0x1cf0a2,_0x11779c){_0x1cf0a2=_0x1cf0a2-0x0;var _0x377c3a=_0xd4e5[_0x1cf0a2];return _0x377c3a;};'use strict';var _=require('lodash');var util=require(_0x5d4e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5d4e('0x1'));var BPromise=require('bluebird');var rp=require(_0x5d4e('0x2'));var fs=require('fs');var path=require(_0x5d4e('0x3'));var rimraf=require('rimraf');var config=require(_0x5d4e('0x4'));var attributes=require(_0x5d4e('0x5'));module[_0x5d4e('0x6')]=function(_0x19c005,_0x374a6b){return _0x19c005['define'](_0x5d4e('0x7'),attributes,{'tableName':_0x5d4e('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5d4e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8dad423..1fce576 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 _0x461b=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','debug','update','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2ba07c,_0xb58e9d){var _0x4a73fb=function(_0xf1b954){while(--_0xf1b954){_0x2ba07c['push'](_0x2ba07c['shift']());}};_0x4a73fb(++_0xb58e9d);}(_0x461b,0x8a));var _0xb461=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x461b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb461('0x0'));var util=require(_0xb461('0x1'));var moment=require(_0xb461('0x2'));var BPromise=require(_0xb461('0x3'));var rs=require(_0xb461('0x4'));var fs=require('fs');var Redis=require(_0xb461('0x5'));var db=require(_0xb461('0x6'))['db'];var utils=require(_0xb461('0x7'));var logger=require(_0xb461('0x8'))(_0xb461('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb461('0xa')][_0xb461('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ac64,_0x4ff4aa,_0xe1b037){return new BPromise(function(_0x33c3c1,_0x22b7e6){return client[_0xb461('0xc')](_0x23ac64,_0xe1b037)[_0xb461('0xd')](function(_0x4e744c){logger[_0xb461('0xe')](_0xb461('0xf'),_0x4ff4aa,_0xb461('0x10'));logger['debug'](_0xb461('0x11'),_0x4ff4aa,_0xb461('0x10'),JSON[_0xb461('0x12')](_0x4e744c));if(_0x4e744c['error']){if(_0x4e744c[_0xb461('0x13')][_0xb461('0x14')]===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4ff4aa,_0x4e744c[_0xb461('0x13')][_0xb461('0x15')]);return _0x22b7e6(_0x4e744c[_0xb461('0x13')]['message']);}logger[_0xb461('0x13')](_0xb461('0xf'),_0x4ff4aa,_0x4e744c[_0xb461('0x13')][_0xb461('0x15')]);return _0x33c3c1(_0x4e744c[_0xb461('0x13')]['message']);}else{logger[_0xb461('0xe')](_0xb461('0xf'),_0x4ff4aa,_0xb461('0x10'));_0x33c3c1(_0x4e744c[_0xb461('0x16')][_0xb461('0x15')]);}})[_0xb461('0x17')](function(_0x265787){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4ff4aa,_0x265787);_0x22b7e6(_0x265787);});});}exports[_0xb461('0x18')]=function(_0x2a3e03){var _0x322ccc=this;return new Promise(function(_0xb84a00,_0x3400ca){return db[_0xb461('0x19')][_0xb461('0x1a')](_0x2a3e03[_0xb461('0x1b')],{'raw':_0x2a3e03[_0xb461('0x1c')]?_0x2a3e03['options'][_0xb461('0x1d')]===undefined?!![]:![]:!![]})[_0xb461('0xd')](function(_0x109229){logger['info'](_0xb461('0x18'),_0x2a3e03);logger[_0xb461('0x1e')](_0xb461('0x18'),_0x2a3e03,JSON['stringify'](_0x109229));_0xb84a00(_0x109229);})[_0xb461('0x17')](function(_0x1748f8){logger[_0xb461('0x13')](_0xb461('0x18'),_0x1748f8['message'],_0x2a3e03);_0x3400ca(_0x322ccc['error'](0x1f4,_0x1748f8[_0xb461('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x33b6fa){var _0x5d1bfb=this;return new Promise(function(_0x5a7430,_0x8fe163){return db[_0xb461('0x19')][_0xb461('0x1f')](_0x33b6fa[_0xb461('0x1b')],{'raw':_0x33b6fa[_0xb461('0x1c')]?_0x33b6fa[_0xb461('0x1c')][_0xb461('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b6fa['options']?_0x33b6fa[_0xb461('0x1c')][_0xb461('0x20')]||null:null,'attributes':_0x33b6fa[_0xb461('0x1c')]?_0x33b6fa[_0xb461('0x1c')][_0xb461('0x21')]||null:null,'limit':_0x33b6fa[_0xb461('0x1c')]?_0x33b6fa[_0xb461('0x1c')][_0xb461('0x22')]||null:null})[_0xb461('0xd')](function(_0xddb27a){logger[_0xb461('0xe')](_0xb461('0x23'),_0x33b6fa);logger[_0xb461('0x1e')](_0xb461('0x23'),_0x33b6fa,JSON['stringify'](_0xddb27a));_0x5a7430(_0xddb27a);})['catch'](function(_0x34750b){logger[_0xb461('0x13')](_0xb461('0x23'),_0x34750b[_0xb461('0x15')],_0x33b6fa);_0x8fe163(_0x5d1bfb['error'](0x1f4,_0x34750b[_0xb461('0x15')]));});});}; \ No newline at end of file +var _0x9f50=['result','CreateMailQueueReport','MailQueueReport','create','options','raw','catch','body','where','attributes','limit','UpdateMailQueueReport','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueueReport,\x20%s,\x20%s'];(function(_0x1111c6,_0x2272fe){var _0x28e8d3=function(_0x510a81){while(--_0x510a81){_0x1111c6['push'](_0x1111c6['shift']());}};_0x28e8d3(++_0x2272fe);}(_0x9f50,0x1ce));var _0x09f5=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x9f50[_0x47f719];return _0x407f4e;};'use strict';var _=require('lodash');var util=require(_0x09f5('0x0'));var moment=require(_0x09f5('0x1'));var BPromise=require(_0x09f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x09f5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x09f5('0x5'));var client=jayson[_0x09f5('0x6')][_0x09f5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x539b02,_0x402fa1,_0x5e7d90){return new BPromise(function(_0x140f52,_0x3754b6){return client['request'](_0x539b02,_0x5e7d90)[_0x09f5('0x8')](function(_0x343ea4){logger[_0x09f5('0x9')]('MailQueueReport,\x20%s,\x20%s',_0x402fa1,_0x09f5('0xa'));logger[_0x09f5('0xb')](_0x09f5('0xc'),_0x402fa1,_0x09f5('0xa'),JSON[_0x09f5('0xd')](_0x343ea4));if(_0x343ea4[_0x09f5('0xe')]){if(_0x343ea4[_0x09f5('0xe')][_0x09f5('0xf')]===0x1f4){logger[_0x09f5('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x402fa1,_0x343ea4['error'][_0x09f5('0x10')]);return _0x3754b6(_0x343ea4['error']['message']);}logger['error']('MailQueueReport,\x20%s,\x20%s',_0x402fa1,_0x343ea4[_0x09f5('0xe')][_0x09f5('0x10')]);return _0x140f52(_0x343ea4['error'][_0x09f5('0x10')]);}else{logger['info'](_0x09f5('0x11'),_0x402fa1,_0x09f5('0xa'));_0x140f52(_0x343ea4[_0x09f5('0x12')]['message']);}})['catch'](function(_0x382686){logger[_0x09f5('0xe')](_0x09f5('0x11'),_0x402fa1,_0x382686);_0x3754b6(_0x382686);});});}exports[_0x09f5('0x13')]=function(_0x4ff003){var _0x46cd3f=this;return new Promise(function(_0x38bf5d,_0x14926f){return db[_0x09f5('0x14')][_0x09f5('0x15')](_0x4ff003['body'],{'raw':_0x4ff003[_0x09f5('0x16')]?_0x4ff003[_0x09f5('0x16')][_0x09f5('0x17')]===undefined?!![]:![]:!![]})[_0x09f5('0x8')](function(_0x307c6d){logger[_0x09f5('0x9')]('CreateMailQueueReport',_0x4ff003);logger['debug'](_0x09f5('0x13'),_0x4ff003,JSON[_0x09f5('0xd')](_0x307c6d));_0x38bf5d(_0x307c6d);})[_0x09f5('0x18')](function(_0xf14d71){logger[_0x09f5('0xe')](_0x09f5('0x13'),_0xf14d71['message'],_0x4ff003);_0x14926f(_0x46cd3f[_0x09f5('0xe')](0x1f4,_0xf14d71['message']));});});};exports['UpdateMailQueueReport']=function(_0x446fec){var _0x4357e1=this;return new Promise(function(_0x5d24a0,_0x457514){return db[_0x09f5('0x14')]['update'](_0x446fec[_0x09f5('0x19')],{'raw':_0x446fec[_0x09f5('0x16')]?_0x446fec['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x446fec[_0x09f5('0x16')]?_0x446fec[_0x09f5('0x16')][_0x09f5('0x1a')]||null:null,'attributes':_0x446fec[_0x09f5('0x16')]?_0x446fec['options'][_0x09f5('0x1b')]||null:null,'limit':_0x446fec[_0x09f5('0x16')]?_0x446fec[_0x09f5('0x16')][_0x09f5('0x1c')]||null:null})[_0x09f5('0x8')](function(_0x17da1a){logger['info']('UpdateMailQueueReport',_0x446fec);logger['debug'](_0x09f5('0x1d'),_0x446fec,JSON[_0x09f5('0xd')](_0x17da1a));_0x5d24a0(_0x17da1a);})[_0x09f5('0x18')](function(_0x14dbef){logger[_0x09f5('0xe')](_0x09f5('0x1d'),_0x14dbef[_0x09f5('0x10')],_0x446fec);_0x457514(_0x4357e1[_0x09f5('0xe')](0x1f4,_0x14dbef[_0x09f5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6cf499b..4fd7fbe 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 _0xfed0=['multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3f9d5d,_0x4ee8dd){var _0x1b2cd7=function(_0x380e51){while(--_0x380e51){_0x3f9d5d['push'](_0x3f9d5d['shift']());}};_0x1b2cd7(++_0x4ee8dd);}(_0xfed0,0xd2));var _0x0fed=function(_0x5cbca7,_0x22b1e5){_0x5cbca7=_0x5cbca7-0x0;var _0x1d69f3=_0xfed0[_0x5cbca7];return _0x1d69f3;};'use strict';var multer=require(_0x0fed('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fed('0x1'));var router=express[_0x0fed('0x2')]();var auth=require(_0x0fed('0x3'));var interaction=require(_0x0fed('0x4'));var config=require(_0x0fed('0x5'));module[_0x0fed('0x6')]=router; \ No newline at end of file +var _0x2c0d=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x403418,_0xc1957){var _0xd18363=function(_0x3f1593){while(--_0x3f1593){_0x403418['push'](_0x403418['shift']());}};_0xd18363(++_0xc1957);}(_0x2c0d,0x1ec));var _0xd2c0=function(_0x36d2e9,_0x10d445){_0x36d2e9=_0x36d2e9-0x0;var _0x5e0a69=_0x2c0d[_0x36d2e9];return _0x5e0a69;};'use strict';var multer=require(_0xd2c0('0x0'));var util=require(_0xd2c0('0x1'));var path=require(_0xd2c0('0x2'));var timeout=require(_0xd2c0('0x3'));var express=require(_0xd2c0('0x4'));var router=express[_0xd2c0('0x5')]();var auth=require(_0xd2c0('0x6'));var interaction=require(_0xd2c0('0x7'));var config=require(_0xd2c0('0x8'));module[_0xd2c0('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8469b1d..0b7a07a 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 _0x45d5=['STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x584a8f,_0x330d6c){var _0x3913a1=function(_0x56ff2b){while(--_0x56ff2b){_0x584a8f['push'](_0x584a8f['shift']());}};_0x3913a1(++_0x330d6c);}(_0x45d5,0x1df));var _0x545d=function(_0x27eac4,_0x348e57){_0x27eac4=_0x27eac4-0x0;var _0x2c0dbd=_0x45d5[_0x27eac4];return _0x2c0dbd;};'use strict';var Sequelize=require(_0x545d('0x0'));module['exports']={'description':{'type':Sequelize[_0x545d('0x1')]},'host':{'type':Sequelize[_0x545d('0x1')]},'authentication':{'type':Sequelize[_0x545d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x545d('0x1')],'unique':_0x545d('0x3')},'password':{'type':Sequelize[_0x545d('0x1')]},'port':{'type':Sequelize[_0x545d('0x4')]},'tls':{'type':Sequelize[_0x545d('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x545d('0x1')],'defaultValue':_0x545d('0x5')},'connTimeout':{'type':Sequelize[_0x545d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x545d('0x1')]}}; \ No newline at end of file +var _0xa92e=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN','username'];(function(_0x2dea4b,_0x46dfc2){var _0x18ec7f=function(_0x49219a){while(--_0x49219a){_0x2dea4b['push'](_0x2dea4b['shift']());}};_0x18ec7f(++_0x46dfc2);}(_0xa92e,0x87));var _0xea92=function(_0x5279d1,_0x54c9d5){_0x5279d1=_0x5279d1-0x0;var _0x17d710=_0xa92e[_0x5279d1];return _0x17d710;};'use strict';var Sequelize=require(_0xea92('0x0'));module[_0xea92('0x1')]={'description':{'type':Sequelize[_0xea92('0x2')]},'host':{'type':Sequelize[_0xea92('0x2')]},'authentication':{'type':Sequelize[_0xea92('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xea92('0x2')],'unique':_0xea92('0x4')},'password':{'type':Sequelize[_0xea92('0x2')]},'port':{'type':Sequelize[_0xea92('0x5')]},'tls':{'type':Sequelize[_0xea92('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xea92('0x2')],'defaultValue':_0xea92('0x6')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xea92('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 922932c..ed38339 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 _0xc2da=['exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x588061,_0x2c1481){var _0x14136e=function(_0x56882b){while(--_0x56882b){_0x588061['push'](_0x588061['shift']());}};_0x14136e(++_0x2c1481);}(_0xc2da,0x124));var _0xac2d=function(_0x427572,_0x1d89f2){_0x427572=_0x427572-0x0;var _0x585590=_0xc2da[_0x427572];return _0x585590;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var logger=require(_0xac2d('0x1'))('api');var moment=require(_0xac2d('0x2'));var BPromise=require('bluebird');var rp=require(_0xac2d('0x3'));var fs=require('fs');var path=require(_0xac2d('0x4'));var rimraf=require(_0xac2d('0x5'));var config=require(_0xac2d('0x6'));var attributes=require(_0xac2d('0x7'));module[_0xac2d('0x8')]=function(_0x3db400,_0x133e22){return _0x3db400[_0xac2d('0x9')](_0xac2d('0xa'),attributes,{'tableName':_0xac2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6599=['bluebird','path','../../config/environment','exports','mail_servers_in','util','../../config/logger','api','moment'];(function(_0x339621,_0x2740ca){var _0x56af5d=function(_0x50821d){while(--_0x50821d){_0x339621['push'](_0x339621['shift']());}};_0x56af5d(++_0x2740ca);}(_0x6599,0xb0));var _0x9659=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6599[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var logger=require(_0x9659('0x1'))(_0x9659('0x2'));var moment=require(_0x9659('0x3'));var BPromise=require(_0x9659('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9659('0x5'));var rimraf=require('rimraf');var config=require(_0x9659('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x9659('0x7')]=function(_0xb08ede,_0x159ac2){return _0xb08ede['define']('MailServerIn',attributes,{'tableName':_0x9659('0x8'),'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 7906b5a..fcab2ba 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 _0xbd48=['jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x36dd93,_0x42941d){var _0x118866=function(_0x1d5d60){while(--_0x1d5d60){_0x36dd93['push'](_0x36dd93['shift']());}};_0x118866(++_0x42941d);}(_0xbd48,0x131));var _0x8bd4=function(_0x1d500d,_0x35992c){_0x1d500d=_0x1d500d-0x0;var _0x95a72b=_0xbd48[_0x1d500d];return _0x95a72b;};'use strict';var _=require(_0x8bd4('0x0'));var util=require(_0x8bd4('0x1'));var moment=require(_0x8bd4('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bd4('0x3'));var fs=require('fs');var Redis=require(_0x8bd4('0x4'));var db=require(_0x8bd4('0x5'))['db'];var utils=require(_0x8bd4('0x6'));var logger=require(_0x8bd4('0x7'))(_0x8bd4('0x8'));var config=require(_0x8bd4('0x9'));var jayson=require(_0x8bd4('0xa'));var client=jayson[_0x8bd4('0xb')][_0x8bd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b147b,_0x436d18,_0xb66508){return new BPromise(function(_0x4ba275,_0x52f284){return client[_0x8bd4('0xd')](_0x4b147b,_0xb66508)['then'](function(_0x3453e9){logger[_0x8bd4('0xe')](_0x8bd4('0xf'),_0x436d18,_0x8bd4('0x10'));logger['debug'](_0x8bd4('0x11'),_0x436d18,_0x8bd4('0x10'),JSON[_0x8bd4('0x12')](_0x3453e9));if(_0x3453e9[_0x8bd4('0x13')]){if(_0x3453e9[_0x8bd4('0x13')][_0x8bd4('0x14')]===0x1f4){logger[_0x8bd4('0x13')](_0x8bd4('0xf'),_0x436d18,_0x3453e9['error'][_0x8bd4('0x15')]);return _0x52f284(_0x3453e9['error'][_0x8bd4('0x15')]);}logger[_0x8bd4('0x13')](_0x8bd4('0xf'),_0x436d18,_0x3453e9[_0x8bd4('0x13')]['message']);return _0x4ba275(_0x3453e9['error'][_0x8bd4('0x15')]);}else{logger[_0x8bd4('0xe')](_0x8bd4('0xf'),_0x436d18,_0x8bd4('0x10'));_0x4ba275(_0x3453e9[_0x8bd4('0x16')]['message']);}})[_0x8bd4('0x17')](function(_0x2a91){logger['error'](_0x8bd4('0xf'),_0x436d18,_0x2a91);_0x52f284(_0x2a91);});});}exports[_0x8bd4('0x18')]=function(_0x1cb514){var _0x598e88=this;return new Promise(function(_0x313f0f,_0x48ccc2){return db[_0x8bd4('0x19')][_0x8bd4('0x1a')]({'raw':_0x1cb514['options']?_0x1cb514[_0x8bd4('0x1b')][_0x8bd4('0x1c')]===undefined?!![]:![]:!![],'where':_0x1cb514[_0x8bd4('0x1b')]?_0x1cb514[_0x8bd4('0x1b')][_0x8bd4('0x1d')]||null:null,'attributes':_0x1cb514[_0x8bd4('0x1b')]?_0x1cb514[_0x8bd4('0x1b')][_0x8bd4('0x1e')]||null:null,'limit':_0x1cb514['options']?_0x1cb514[_0x8bd4('0x1b')][_0x8bd4('0x1f')]||null:null,'include':_0x1cb514[_0x8bd4('0x1b')]?_0x1cb514[_0x8bd4('0x1b')][_0x8bd4('0x20')]?_[_0x8bd4('0x21')](_0x1cb514[_0x8bd4('0x1b')][_0x8bd4('0x20')],function(_0x29ffb7){return{'model':db[_0x29ffb7[_0x8bd4('0x22')]],'as':_0x29ffb7['as'],'attributes':_0x29ffb7['attributes'],'include':_0x29ffb7['include']?_[_0x8bd4('0x21')](_0x29ffb7[_0x8bd4('0x20')],function(_0x18e7e4){return{'model':db[_0x18e7e4['model']],'as':_0x18e7e4['as'],'attributes':_0x18e7e4['attributes'],'include':_0x18e7e4['include']?_[_0x8bd4('0x21')](_0x18e7e4[_0x8bd4('0x20')],function(_0x391ee4){return{'model':db[_0x391ee4[_0x8bd4('0x22')]],'as':_0x391ee4['as'],'attributes':_0x391ee4[_0x8bd4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x161320){logger[_0x8bd4('0xe')](_0x8bd4('0x18'),_0x1cb514);logger['debug']('GetMailServerIn',_0x1cb514,JSON[_0x8bd4('0x12')](_0x161320));_0x313f0f(_0x161320);})[_0x8bd4('0x17')](function(_0x4c537d){logger[_0x8bd4('0x13')](_0x8bd4('0x18'),_0x4c537d[_0x8bd4('0x15')],_0x1cb514);_0x48ccc2(_0x598e88[_0x8bd4('0x13')](0x1f4,_0x4c537d[_0x8bd4('0x15')]));});});}; \ No newline at end of file +var _0x7256=['model','map','then','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','GetMailServerIn','MailServerIn','options','where','attributes','limit','include'];(function(_0x1ffcb0,_0x15d73e){var _0x1f7cbd=function(_0x11a1ba){while(--_0x11a1ba){_0x1ffcb0['push'](_0x1ffcb0['shift']());}};_0x1f7cbd(++_0x15d73e);}(_0x7256,0x77));var _0x6725=function(_0x281ea4,_0x3ce540){_0x281ea4=_0x281ea4-0x0;var _0x4e1a31=_0x7256[_0x281ea4];return _0x4e1a31;};'use strict';var _=require(_0x6725('0x0'));var util=require('util');var moment=require(_0x6725('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6725('0x2'));var db=require(_0x6725('0x3'))['db'];var utils=require(_0x6725('0x4'));var logger=require(_0x6725('0x5'))(_0x6725('0x6'));var config=require('../../config/environment');var jayson=require(_0x6725('0x7'));var client=jayson[_0x6725('0x8')][_0x6725('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58d73c,_0x144e07,_0x408063){return new BPromise(function(_0x14aa46,_0x20b45e){return client[_0x6725('0xa')](_0x58d73c,_0x408063)['then'](function(_0x5b71f7){logger[_0x6725('0xb')](_0x6725('0xc'),_0x144e07,_0x6725('0xd'));logger[_0x6725('0xe')](_0x6725('0xf'),_0x144e07,_0x6725('0xd'),JSON[_0x6725('0x10')](_0x5b71f7));if(_0x5b71f7[_0x6725('0x11')]){if(_0x5b71f7[_0x6725('0x11')]['code']===0x1f4){logger[_0x6725('0x11')](_0x6725('0xc'),_0x144e07,_0x5b71f7[_0x6725('0x11')][_0x6725('0x12')]);return _0x20b45e(_0x5b71f7[_0x6725('0x11')][_0x6725('0x12')]);}logger['error'](_0x6725('0xc'),_0x144e07,_0x5b71f7[_0x6725('0x11')][_0x6725('0x12')]);return _0x14aa46(_0x5b71f7[_0x6725('0x11')][_0x6725('0x12')]);}else{logger[_0x6725('0xb')]('MailServerIn,\x20%s,\x20%s',_0x144e07,_0x6725('0xd'));_0x14aa46(_0x5b71f7['result'][_0x6725('0x12')]);}})['catch'](function(_0x11352d){logger[_0x6725('0x11')](_0x6725('0xc'),_0x144e07,_0x11352d);_0x20b45e(_0x11352d);});});}exports[_0x6725('0x13')]=function(_0x4d0e66){var _0x196c82=this;return new Promise(function(_0x2dea9e,_0x4bf98a){return db[_0x6725('0x14')]['findAll']({'raw':_0x4d0e66[_0x6725('0x15')]?_0x4d0e66['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d0e66['options']?_0x4d0e66[_0x6725('0x15')][_0x6725('0x16')]||null:null,'attributes':_0x4d0e66[_0x6725('0x15')]?_0x4d0e66[_0x6725('0x15')][_0x6725('0x17')]||null:null,'limit':_0x4d0e66[_0x6725('0x15')]?_0x4d0e66[_0x6725('0x15')][_0x6725('0x18')]||null:null,'include':_0x4d0e66[_0x6725('0x15')]?_0x4d0e66[_0x6725('0x15')][_0x6725('0x19')]?_['map'](_0x4d0e66['options'][_0x6725('0x19')],function(_0x3d5318){return{'model':db[_0x3d5318['model']],'as':_0x3d5318['as'],'attributes':_0x3d5318[_0x6725('0x17')],'include':_0x3d5318[_0x6725('0x19')]?_['map'](_0x3d5318['include'],function(_0x3e8ce5){return{'model':db[_0x3e8ce5[_0x6725('0x1a')]],'as':_0x3e8ce5['as'],'attributes':_0x3e8ce5[_0x6725('0x17')],'include':_0x3e8ce5[_0x6725('0x19')]?_[_0x6725('0x1b')](_0x3e8ce5['include'],function(_0x127d60){return{'model':db[_0x127d60[_0x6725('0x1a')]],'as':_0x127d60['as'],'attributes':_0x127d60['attributes']};}):[]};}):[]};}):[]:[]})[_0x6725('0x1c')](function(_0x2b3fa7){logger['info'](_0x6725('0x13'),_0x4d0e66);logger[_0x6725('0xe')](_0x6725('0x13'),_0x4d0e66,JSON[_0x6725('0x10')](_0x2b3fa7));_0x2dea9e(_0x2b3fa7);})['catch'](function(_0x37f142){logger[_0x6725('0x11')](_0x6725('0x13'),_0x37f142['message'],_0x4d0e66);_0x4bf98a(_0x196c82[_0x6725('0x11')](0x1f4,_0x37f142[_0x6725('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3371a5e..e713aec 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 _0x0409=['../../components/interaction/service','get','isAuthenticated','show','post','create','put','/:id','update','exports','multer','path','Router'];(function(_0x2a2d5a,_0x489d19){var _0x1c6895=function(_0x37eb20){while(--_0x37eb20){_0x2a2d5a['push'](_0x2a2d5a['shift']());}};_0x1c6895(++_0x489d19);}(_0x0409,0x183));var _0x9040=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0409[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x9040('0x0'));var util=require('util');var path=require(_0x9040('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9040('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x9040('0x3'));var config=require('../../config/environment');var controller=require('./mailServerOut.controller');router[_0x9040('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9040('0x4')]('/:id',auth[_0x9040('0x5')](),controller[_0x9040('0x6')]);router[_0x9040('0x7')]('/',auth[_0x9040('0x5')](),controller[_0x9040('0x8')]);router[_0x9040('0x9')](_0x9040('0xa'),auth[_0x9040('0x5')](),controller[_0x9040('0xb')]);router['delete'](_0x9040('0xa'),auth[_0x9040('0x5')](),controller['destroy']);module[_0x9040('0xc')]=router; \ No newline at end of file +var _0x6e83=['express','Router','../../components/auth/service','./mailServerOut.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','exports','util','path'];(function(_0x2251f3,_0x30e7c3){var _0x2642de=function(_0x297734){while(--_0x297734){_0x2251f3['push'](_0x2251f3['shift']());}};_0x2642de(++_0x30e7c3);}(_0x6e83,0x141));var _0x36e8=function(_0x13aa1d,_0x5bedda){_0x13aa1d=_0x13aa1d-0x0;var _0x1b5192=_0x6e83[_0x13aa1d];return _0x1b5192;};'use strict';var multer=require('multer');var util=require(_0x36e8('0x0'));var path=require(_0x36e8('0x1'));var timeout=require('connect-timeout');var express=require(_0x36e8('0x2'));var router=express[_0x36e8('0x3')]();var auth=require(_0x36e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x36e8('0x5'));router[_0x36e8('0x6')]('/',auth['isAuthenticated'](),controller[_0x36e8('0x7')]);router[_0x36e8('0x6')]('/:id',auth[_0x36e8('0x8')](),controller[_0x36e8('0x9')]);router[_0x36e8('0xa')]('/',auth['isAuthenticated'](),controller[_0x36e8('0xb')]);router[_0x36e8('0xc')](_0x36e8('0xd'),auth[_0x36e8('0x8')](),controller[_0x36e8('0xe')]);router[_0x36e8('0xf')](_0x36e8('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x36e8('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ed521f5..70cc9c0 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 _0xc21e=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x483fbf,_0x1ad988){var _0x4f3139=function(_0x4c0c5e){while(--_0x4c0c5e){_0x483fbf['push'](_0x483fbf['shift']());}};_0x4f3139(++_0x1ad988);}(_0xc21e,0x1ca));var _0xec21=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc21e[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xec21('0x0')]={'description':{'type':Sequelize[_0xec21('0x1')]},'host':{'type':Sequelize[_0xec21('0x1')]},'user':{'type':Sequelize[_0xec21('0x1')]},'pass':{'type':Sequelize[_0xec21('0x1')]},'port':{'type':Sequelize[_0xec21('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xec21('0x1')]},'authentication':{'type':Sequelize[_0xec21('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8085=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8085,0x71));var _0x5808=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x8085[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0x5808('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5808('0x1')]},'user':{'type':Sequelize[_0x5808('0x1')]},'pass':{'type':Sequelize[_0x5808('0x1')]},'port':{'type':Sequelize[_0x5808('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x5808('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9cbfae8..8598e0b 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 _0x829a=['catch','create','update','body','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','options','then','includeAll','findAll','rows','show','keys','include','find'];(function(_0x500431,_0x218167){var _0x39a01e=function(_0x2938c0){while(--_0x2938c0){_0x500431['push'](_0x500431['shift']());}};_0x39a01e(++_0x218167);}(_0x829a,0xa1));var _0xa829=function(_0x5a7aa4,_0x190480){_0x5a7aa4=_0x5a7aa4-0x0;var _0x496dc6=_0x829a[_0x5a7aa4];return _0x496dc6;};'use strict';var pdf=require(_0xa829('0x0'));var emlformat=require(_0xa829('0x1'));var rimraf=require(_0xa829('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa829('0x3'));var rp=require('request-promise');var moment=require(_0xa829('0x4'));var BPromise=require(_0xa829('0x5'));var Mustache=require(_0xa829('0x6'));var util=require(_0xa829('0x7'));var path=require(_0xa829('0x8'));var sox=require(_0xa829('0x9'));var csv=require('to-csv');var ejs=require(_0xa829('0xa'));var fs=require('fs');var _=require(_0xa829('0xb'));var squel=require(_0xa829('0xc'));var crypto=require(_0xa829('0xd'));var jsforce=require(_0xa829('0xe'));var deskjs=require(_0xa829('0xf'));var toCsv=require(_0xa829('0x10'));var querystring=require(_0xa829('0x11'));var Papa=require(_0xa829('0x12'));var Redis=require(_0xa829('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa829('0x14'));var as=require(_0xa829('0x15'));var hardwareService=require(_0xa829('0x16'));var logger=require(_0xa829('0x17'))(_0xa829('0x18'));var utils=require(_0xa829('0x19'));var config=require(_0xa829('0x1a'));var licenseUtil=require(_0xa829('0x1b'));var db=require(_0xa829('0x1c'))['db'];function respondWithStatusCode(_0x1dbf4f,_0x30f5ce){_0x30f5ce=_0x30f5ce||0xcc;return function(_0x283ed1){if(_0x283ed1){return _0x1dbf4f[_0xa829('0x1d')](_0x30f5ce);}return _0x1dbf4f[_0xa829('0x1e')](_0x30f5ce)[_0xa829('0x1f')]();};}function respondWithResult(_0x3d2006,_0xf53da0){_0xf53da0=_0xf53da0||0xc8;return function(_0x3841ca){if(_0x3841ca){return _0x3d2006['status'](_0xf53da0)['json'](_0x3841ca);}};}function respondWithFilteredResult(_0x64df79,_0x1f1be9){return function(_0xbc1d92){if(_0xbc1d92){var _0x6cdcae=_0xbc1d92[_0xa829('0x20')],_0x28f60d=_0x1f1be9[_0xa829('0x21')],_0x470926=_0x1f1be9[_0xa829('0x21')]+_0x1f1be9[_0xa829('0x22')],_0x3cba0e;if(_0x470926>=_0x6cdcae){_0x470926=_0x6cdcae;_0x3cba0e=0xc8;}else{_0x3cba0e=0xce;}_0x64df79[_0xa829('0x1e')](_0x3cba0e);return _0x64df79['set'](_0xa829('0x23'),_0x28f60d+'-'+_0x470926+'/'+_0x6cdcae)[_0xa829('0x24')](_0xbc1d92);}return null;};}function patchUpdates(_0x169c93){return function(_0x229476){try{jsonpatch[_0xa829('0x25')](_0x229476,_0x169c93,!![]);}catch(_0x2a7ee3){return BPromise[_0xa829('0x26')](_0x2a7ee3);}return _0x229476[_0xa829('0x27')]();};}function saveUpdates(_0x4ef239,_0x3897f2){return function(_0x17204f){if(_0x17204f){return _0x17204f['update'](_0x4ef239)['then'](function(_0x2c532f){return _0x2c532f;});}return null;};}function removeEntity(_0x3dfba6,_0x21156f){return function(_0x379582){if(_0x379582){return _0x379582[_0xa829('0x28')]()['then'](function(){_0x3dfba6['status'](0xcc)[_0xa829('0x1f')]();});}};}function handleEntityNotFound(_0x29387a,_0x3e3139){return function(_0x2d5bfe){if(!_0x2d5bfe){_0x29387a['sendStatus'](0x194);}return _0x2d5bfe;};}function handleError(_0x72a7d9,_0x4b6f7b){_0x4b6f7b=_0x4b6f7b||0x1f4;return function(_0x5f57ac){logger[_0xa829('0x29')](_0x5f57ac[_0xa829('0x2a')]);if(_0x5f57ac[_0xa829('0x2b')]){delete _0x5f57ac[_0xa829('0x2b')];}_0x72a7d9[_0xa829('0x1e')](_0x4b6f7b)[_0xa829('0x2c')](_0x5f57ac);};}exports[_0xa829('0x2d')]=function(_0x59ba7d,_0x4c42b2){var _0x387bd3={},_0x4194f2={},_0x27fad5={'count':0x0,'rows':[]};var _0x57ac4a=_['map'](db[_0xa829('0x2e')][_0xa829('0x2f')],function(_0x5b7fe1){return{'name':_0x5b7fe1['fieldName'],'type':_0x5b7fe1[_0xa829('0x30')][_0xa829('0x31')]};});_0x4194f2[_0xa829('0x32')]=_[_0xa829('0x33')](_0x57ac4a,_0xa829('0x2b'));_0x4194f2[_0xa829('0x34')]=_['keys'](_0x59ba7d[_0xa829('0x34')]);_0x4194f2['filters']=_[_0xa829('0x35')](_0x4194f2['model'],_0x4194f2[_0xa829('0x34')]);_0x387bd3[_0xa829('0x36')]=_['intersection'](_0x4194f2[_0xa829('0x32')],qs[_0xa829('0x37')](_0x59ba7d[_0xa829('0x34')]['fields']));_0x387bd3[_0xa829('0x36')]=_0x387bd3[_0xa829('0x36')][_0xa829('0x38')]?_0x387bd3[_0xa829('0x36')]:_0x4194f2[_0xa829('0x32')];if(!_0x59ba7d[_0xa829('0x34')][_0xa829('0x39')]('nolimit')){_0x387bd3[_0xa829('0x22')]=qs[_0xa829('0x22')](_0x59ba7d[_0xa829('0x34')][_0xa829('0x22')]);_0x387bd3['offset']=qs[_0xa829('0x21')](_0x59ba7d[_0xa829('0x34')]['offset']);}_0x387bd3['order']=qs[_0xa829('0x3a')](_0x59ba7d[_0xa829('0x34')][_0xa829('0x3a')]);_0x387bd3[_0xa829('0x3b')]=qs['filters'](_['pick'](_0x59ba7d[_0xa829('0x34')],_0x4194f2[_0xa829('0x3c')]),_0x57ac4a);if(_0x59ba7d[_0xa829('0x34')][_0xa829('0x3d')]){_0x387bd3[_0xa829('0x3b')]=_['merge'](_0x387bd3['where'],{'$or':_[_0xa829('0x33')](_0x57ac4a,function(_0x25ecbc){if(_0x25ecbc[_0xa829('0x30')]!==_0xa829('0x3e')){var _0x3380fc={};_0x3380fc[_0x25ecbc[_0xa829('0x2b')]]={'$like':'%'+_0x59ba7d[_0xa829('0x34')][_0xa829('0x3d')]+'%'};return _0x3380fc;}})});}_0x387bd3=_[_0xa829('0x3f')]({},_0x387bd3,_0x59ba7d[_0xa829('0x40')]);var _0x18485e={'where':_0x387bd3['where']};return db[_0xa829('0x2e')][_0xa829('0x20')](_0x18485e)[_0xa829('0x41')](function(_0x319b6c){_0x27fad5[_0xa829('0x20')]=_0x319b6c;if(_0x59ba7d[_0xa829('0x34')][_0xa829('0x42')]){_0x387bd3['include']=[{'all':!![]}];}return db[_0xa829('0x2e')][_0xa829('0x43')](_0x387bd3);})[_0xa829('0x41')](function(_0x487fd7){_0x27fad5[_0xa829('0x44')]=_0x487fd7;return _0x27fad5;})['then'](respondWithFilteredResult(_0x4c42b2,_0x387bd3))['catch'](handleError(_0x4c42b2,null));};exports[_0xa829('0x45')]=function(_0x506428,_0xaac02b){var _0x16c033={'raw':!![],'where':{'id':_0x506428['params']['id']}},_0x448363={};_0x448363[_0xa829('0x32')]=_[_0xa829('0x46')](db[_0xa829('0x2e')][_0xa829('0x2f')]);_0x448363[_0xa829('0x34')]=_[_0xa829('0x46')](_0x506428['query']);_0x448363['filters']=_[_0xa829('0x35')](_0x448363['model'],_0x448363[_0xa829('0x34')]);_0x16c033['attributes']=_[_0xa829('0x35')](_0x448363[_0xa829('0x32')],qs[_0xa829('0x37')](_0x506428[_0xa829('0x34')][_0xa829('0x37')]));_0x16c033[_0xa829('0x36')]=_0x16c033[_0xa829('0x36')][_0xa829('0x38')]?_0x16c033[_0xa829('0x36')]:_0x448363['model'];if(_0x506428['query']['includeAll']){_0x16c033[_0xa829('0x47')]=[{'all':!![]}];}_0x16c033=_[_0xa829('0x3f')]({},_0x16c033,_0x506428[_0xa829('0x40')]);return db[_0xa829('0x2e')][_0xa829('0x48')](_0x16c033)['then'](handleEntityNotFound(_0xaac02b,null))[_0xa829('0x41')](respondWithResult(_0xaac02b,null))[_0xa829('0x49')](handleError(_0xaac02b,null));};exports[_0xa829('0x4a')]=function(_0x43a967,_0x530a83){return db[_0xa829('0x2e')][_0xa829('0x4a')](_0x43a967['body'],{})[_0xa829('0x41')](respondWithResult(_0x530a83,0xc9))[_0xa829('0x49')](handleError(_0x530a83,null));};exports[_0xa829('0x4b')]=function(_0x541d77,_0x2a20a4){if(_0x541d77['body']['id']){delete _0x541d77[_0xa829('0x4c')]['id'];}return db[_0xa829('0x2e')]['find']({'where':{'id':_0x541d77[_0xa829('0x4d')]['id']}})[_0xa829('0x41')](handleEntityNotFound(_0x2a20a4,null))['then'](saveUpdates(_0x541d77[_0xa829('0x4c')],null))[_0xa829('0x41')](respondWithResult(_0x2a20a4,null))[_0xa829('0x49')](handleError(_0x2a20a4,null));};exports['destroy']=function(_0x116bfc,_0x5c24ca){return db['MailServerOut'][_0xa829('0x48')]({'where':{'id':_0x116bfc[_0xa829('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c24ca,null))[_0xa829('0x41')](removeEntity(_0x5c24ca,null))[_0xa829('0x49')](handleError(_0x5c24ca,null));}; \ No newline at end of file +var _0xa484=['moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','MailServerOut','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','catch','length','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x459051,_0x2881f4){var _0x32f4fe=function(_0x1bbbb9){while(--_0x1bbbb9){_0x459051['push'](_0x459051['shift']());}};_0x32f4fe(++_0x2881f4);}(_0xa484,0x15a));var _0x4a48=function(_0x5de713,_0x1c1ba1){_0x5de713=_0x5de713-0x0;var _0x1742a4=_0xa484[_0x5de713];return _0x1742a4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a48('0x1'));var jsonpatch=require(_0x4a48('0x2'));var rp=require(_0x4a48('0x3'));var moment=require(_0x4a48('0x4'));var BPromise=require(_0x4a48('0x5'));var Mustache=require(_0x4a48('0x6'));var util=require(_0x4a48('0x7'));var path=require('path');var sox=require(_0x4a48('0x8'));var csv=require(_0x4a48('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4a48('0xa'));var crypto=require(_0x4a48('0xb'));var jsforce=require(_0x4a48('0xc'));var deskjs=require(_0x4a48('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4a48('0xe'));var Papa=require('papaparse');var Redis=require(_0x4a48('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4a48('0x10'));var as=require(_0x4a48('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a48('0x12'));var utils=require(_0x4a48('0x13'));var config=require(_0x4a48('0x14'));var licenseUtil=require(_0x4a48('0x15'));var db=require(_0x4a48('0x16'))['db'];function respondWithStatusCode(_0x3c73e6,_0x18eff1){_0x18eff1=_0x18eff1||0xcc;return function(_0x2a50ce){if(_0x2a50ce){return _0x3c73e6[_0x4a48('0x17')](_0x18eff1);}return _0x3c73e6['status'](_0x18eff1)['end']();};}function respondWithResult(_0x28b259,_0x36d247){_0x36d247=_0x36d247||0xc8;return function(_0x237fe0){if(_0x237fe0){return _0x28b259[_0x4a48('0x18')](_0x36d247)[_0x4a48('0x19')](_0x237fe0);}};}function respondWithFilteredResult(_0x4c2361,_0x2c5d1b){return function(_0x39581d){if(_0x39581d){var _0x311448=_0x39581d[_0x4a48('0x1a')],_0x71b342=_0x2c5d1b[_0x4a48('0x1b')],_0x341534=_0x2c5d1b[_0x4a48('0x1b')]+_0x2c5d1b[_0x4a48('0x1c')],_0x29d2b2;if(_0x341534>=_0x311448){_0x341534=_0x311448;_0x29d2b2=0xc8;}else{_0x29d2b2=0xce;}_0x4c2361[_0x4a48('0x18')](_0x29d2b2);return _0x4c2361[_0x4a48('0x1d')](_0x4a48('0x1e'),_0x71b342+'-'+_0x341534+'/'+_0x311448)['json'](_0x39581d);}return null;};}function patchUpdates(_0x3de3df){return function(_0x433101){try{jsonpatch[_0x4a48('0x1f')](_0x433101,_0x3de3df,!![]);}catch(_0x550ed7){return BPromise[_0x4a48('0x20')](_0x550ed7);}return _0x433101[_0x4a48('0x21')]();};}function saveUpdates(_0x586acb,_0x36779c){return function(_0x5c3f62){if(_0x5c3f62){return _0x5c3f62[_0x4a48('0x22')](_0x586acb)[_0x4a48('0x23')](function(_0x19f942){return _0x19f942;});}return null;};}function removeEntity(_0x262102,_0x449360){return function(_0x39814f){if(_0x39814f){return _0x39814f[_0x4a48('0x24')]()[_0x4a48('0x23')](function(){_0x262102[_0x4a48('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x439d5d,_0x1fe292){return function(_0x53e97b){if(!_0x53e97b){_0x439d5d[_0x4a48('0x17')](0x194);}return _0x53e97b;};}function handleError(_0x49a436,_0x388701){_0x388701=_0x388701||0x1f4;return function(_0x839f72){logger[_0x4a48('0x25')](_0x839f72[_0x4a48('0x26')]);if(_0x839f72['name']){delete _0x839f72[_0x4a48('0x27')];}_0x49a436[_0x4a48('0x18')](_0x388701)[_0x4a48('0x28')](_0x839f72);};}exports['index']=function(_0x567158,_0x50d6f3){var _0x1acd3d={},_0x4e8f4a={},_0x64d8b4={'count':0x0,'rows':[]};var _0x5c81a1=_['map'](db[_0x4a48('0x29')]['rawAttributes'],function(_0x25b9af){return{'name':_0x25b9af['fieldName'],'type':_0x25b9af[_0x4a48('0x2a')][_0x4a48('0x2b')]};});_0x4e8f4a[_0x4a48('0x2c')]=_[_0x4a48('0x2d')](_0x5c81a1,_0x4a48('0x27'));_0x4e8f4a[_0x4a48('0x2e')]=_[_0x4a48('0x2f')](_0x567158['query']);_0x4e8f4a[_0x4a48('0x30')]=_[_0x4a48('0x31')](_0x4e8f4a[_0x4a48('0x2c')],_0x4e8f4a[_0x4a48('0x2e')]);_0x1acd3d[_0x4a48('0x32')]=_[_0x4a48('0x31')](_0x4e8f4a[_0x4a48('0x2c')],qs['fields'](_0x567158[_0x4a48('0x2e')][_0x4a48('0x33')]));_0x1acd3d[_0x4a48('0x32')]=_0x1acd3d[_0x4a48('0x32')]['length']?_0x1acd3d['attributes']:_0x4e8f4a['model'];if(!_0x567158[_0x4a48('0x2e')][_0x4a48('0x34')](_0x4a48('0x35'))){_0x1acd3d['limit']=qs[_0x4a48('0x1c')](_0x567158[_0x4a48('0x2e')][_0x4a48('0x1c')]);_0x1acd3d[_0x4a48('0x1b')]=qs['offset'](_0x567158[_0x4a48('0x2e')][_0x4a48('0x1b')]);}_0x1acd3d[_0x4a48('0x36')]=qs[_0x4a48('0x37')](_0x567158[_0x4a48('0x2e')][_0x4a48('0x37')]);_0x1acd3d['where']=qs[_0x4a48('0x30')](_[_0x4a48('0x38')](_0x567158[_0x4a48('0x2e')],_0x4e8f4a[_0x4a48('0x30')]),_0x5c81a1);if(_0x567158[_0x4a48('0x2e')]['filter']){_0x1acd3d[_0x4a48('0x39')]=_[_0x4a48('0x3a')](_0x1acd3d['where'],{'$or':_[_0x4a48('0x2d')](_0x5c81a1,function(_0x6eb68d){if(_0x6eb68d[_0x4a48('0x2a')]!==_0x4a48('0x3b')){var _0x6447c1={};_0x6447c1[_0x6eb68d[_0x4a48('0x27')]]={'$like':'%'+_0x567158['query'][_0x4a48('0x3c')]+'%'};return _0x6447c1;}})});}_0x1acd3d=_[_0x4a48('0x3a')]({},_0x1acd3d,_0x567158[_0x4a48('0x3d')]);var _0x172136={'where':_0x1acd3d[_0x4a48('0x39')]};return db[_0x4a48('0x29')][_0x4a48('0x1a')](_0x172136)['then'](function(_0x5cb2d5){_0x64d8b4[_0x4a48('0x1a')]=_0x5cb2d5;if(_0x567158['query'][_0x4a48('0x3e')]){_0x1acd3d['include']=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x1acd3d);})['then'](function(_0x4ae95c){_0x64d8b4['rows']=_0x4ae95c;return _0x64d8b4;})[_0x4a48('0x23')](respondWithFilteredResult(_0x50d6f3,_0x1acd3d))[_0x4a48('0x3f')](handleError(_0x50d6f3,null));};exports['show']=function(_0x1384db,_0x670074){var _0xa8b57e={'raw':!![],'where':{'id':_0x1384db['params']['id']}},_0x26db81={};_0x26db81[_0x4a48('0x2c')]=_[_0x4a48('0x2f')](db[_0x4a48('0x29')]['rawAttributes']);_0x26db81['query']=_[_0x4a48('0x2f')](_0x1384db['query']);_0x26db81[_0x4a48('0x30')]=_[_0x4a48('0x31')](_0x26db81[_0x4a48('0x2c')],_0x26db81['query']);_0xa8b57e[_0x4a48('0x32')]=_['intersection'](_0x26db81[_0x4a48('0x2c')],qs[_0x4a48('0x33')](_0x1384db[_0x4a48('0x2e')][_0x4a48('0x33')]));_0xa8b57e[_0x4a48('0x32')]=_0xa8b57e[_0x4a48('0x32')][_0x4a48('0x40')]?_0xa8b57e[_0x4a48('0x32')]:_0x26db81[_0x4a48('0x2c')];if(_0x1384db[_0x4a48('0x2e')][_0x4a48('0x3e')]){_0xa8b57e[_0x4a48('0x41')]=[{'all':!![]}];}_0xa8b57e=_[_0x4a48('0x3a')]({},_0xa8b57e,_0x1384db[_0x4a48('0x3d')]);return db[_0x4a48('0x29')][_0x4a48('0x42')](_0xa8b57e)[_0x4a48('0x23')](handleEntityNotFound(_0x670074,null))[_0x4a48('0x23')](respondWithResult(_0x670074,null))[_0x4a48('0x3f')](handleError(_0x670074,null));};exports[_0x4a48('0x43')]=function(_0x504741,_0x232628){return db[_0x4a48('0x29')][_0x4a48('0x43')](_0x504741['body'],{})[_0x4a48('0x23')](respondWithResult(_0x232628,0xc9))[_0x4a48('0x3f')](handleError(_0x232628,null));};exports[_0x4a48('0x22')]=function(_0x441218,_0x114950){if(_0x441218[_0x4a48('0x44')]['id']){delete _0x441218[_0x4a48('0x44')]['id'];}return db[_0x4a48('0x29')][_0x4a48('0x42')]({'where':{'id':_0x441218[_0x4a48('0x45')]['id']}})[_0x4a48('0x23')](handleEntityNotFound(_0x114950,null))['then'](saveUpdates(_0x441218['body'],null))[_0x4a48('0x23')](respondWithResult(_0x114950,null))[_0x4a48('0x3f')](handleError(_0x114950,null));};exports['destroy']=function(_0x1d8c7f,_0x3b439a){return db['MailServerOut'][_0x4a48('0x42')]({'where':{'id':_0x1d8c7f[_0x4a48('0x45')]['id']}})[_0x4a48('0x23')](handleEntityNotFound(_0x3b439a,null))['then'](removeEntity(_0x3b439a,null))[_0x4a48('0x3f')](handleError(_0x3b439a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 98a15d9..2e9c704 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 _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xdb012a,_0x264c29){var _0x124136=function(_0x279549){while(--_0x279549){_0xdb012a['push'](_0xdb012a['shift']());}};_0x124136(++_0x264c29);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3abbca,_0x577e93){_0x3abbca=_0x3abbca-0x0;var _0x380f1d=_0x9c5a[_0x3abbca];return _0x380f1d;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash','util','../../config/logger','api','moment'];(function(_0x1f3355,_0x2be71e){var _0x418230=function(_0x267680){while(--_0x267680){_0x1f3355['push'](_0x1f3355['shift']());}};_0x418230(++_0x2be71e);}(_0x53ec,0x192));var _0xc53e=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x53ec[_0x4536a4];return _0x4fd1c1;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('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 f08ea2f..582d316 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 _0x3e36=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x32be62,_0x22e6fd){var _0x1a37e9=function(_0x35a9c1){while(--_0x35a9c1){_0x32be62['push'](_0x32be62['shift']());}};_0x1a37e9(++_0x22e6fd);}(_0x3e36,0x18e));var _0x63e3=function(_0x1632d3,_0x10c3f3){_0x1632d3=_0x1632d3-0x0;var _0x193525=_0x3e36[_0x1632d3];return _0x193525;};'use strict';var _=require(_0x63e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63e3('0x1'));var db=require(_0x63e3('0x2'))['db'];var utils=require(_0x63e3('0x3'));var logger=require('../../config/logger')(_0x63e3('0x4'));var config=require(_0x63e3('0x5'));var jayson=require(_0x63e3('0x6'));var client=jayson[_0x63e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6e93e6,_0x1a8433,_0x979029){return new BPromise(function(_0x183243,_0x2b8269){return client[_0x63e3('0x8')](_0x6e93e6,_0x979029)[_0x63e3('0x9')](function(_0x5f56dd){logger[_0x63e3('0xa')](_0x63e3('0xb'),_0x1a8433,_0x63e3('0xc'));logger[_0x63e3('0xd')](_0x63e3('0xe'),_0x1a8433,'request\x20sent',JSON[_0x63e3('0xf')](_0x5f56dd));if(_0x5f56dd['error']){if(_0x5f56dd[_0x63e3('0x10')][_0x63e3('0x11')]===0x1f4){logger[_0x63e3('0x10')](_0x63e3('0xb'),_0x1a8433,_0x5f56dd[_0x63e3('0x10')][_0x63e3('0x12')]);return _0x2b8269(_0x5f56dd[_0x63e3('0x10')][_0x63e3('0x12')]);}logger[_0x63e3('0x10')]('MailServerOut,\x20%s,\x20%s',_0x1a8433,_0x5f56dd[_0x63e3('0x10')]['message']);return _0x183243(_0x5f56dd['error']['message']);}else{logger['info'](_0x63e3('0xb'),_0x1a8433,_0x63e3('0xc'));_0x183243(_0x5f56dd['result'][_0x63e3('0x12')]);}})['catch'](function(_0x3eee34){logger[_0x63e3('0x10')]('MailServerOut,\x20%s,\x20%s',_0x1a8433,_0x3eee34);_0x2b8269(_0x3eee34);});});} \ No newline at end of file +var _0xb9cd=['debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','MailServerOut,\x20%s,\x20%s','request\x20sent'];(function(_0x3a717e,_0x204e7b){var _0x5dbacc=function(_0x472de4){while(--_0x472de4){_0x3a717e['push'](_0x3a717e['shift']());}};_0x5dbacc(++_0x204e7b);}(_0xb9cd,0x16b));var _0xdb9c=function(_0x39782f,_0x4aa931){_0x39782f=_0x39782f-0x0;var _0x47768c=_0xb9cd[_0x39782f];return _0x47768c;};'use strict';var _=require(_0xdb9c('0x0'));var util=require(_0xdb9c('0x1'));var moment=require(_0xdb9c('0x2'));var BPromise=require(_0xdb9c('0x3'));var rs=require(_0xdb9c('0x4'));var fs=require('fs');var Redis=require(_0xdb9c('0x5'));var db=require(_0xdb9c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb9c('0x7'))(_0xdb9c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb9c('0x9')][_0xdb9c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9d38,_0x2607af,_0x572aac){return new BPromise(function(_0x2115e2,_0x4dcd14){return client[_0xdb9c('0xb')](_0x4a9d38,_0x572aac)['then'](function(_0x5477d3){logger[_0xdb9c('0xc')](_0xdb9c('0xd'),_0x2607af,_0xdb9c('0xe'));logger[_0xdb9c('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x2607af,_0xdb9c('0xe'),JSON['stringify'](_0x5477d3));if(_0x5477d3[_0xdb9c('0x10')]){if(_0x5477d3[_0xdb9c('0x10')][_0xdb9c('0x11')]===0x1f4){logger[_0xdb9c('0x10')](_0xdb9c('0xd'),_0x2607af,_0x5477d3['error'][_0xdb9c('0x12')]);return _0x4dcd14(_0x5477d3[_0xdb9c('0x10')]['message']);}logger[_0xdb9c('0x10')]('MailServerOut,\x20%s,\x20%s',_0x2607af,_0x5477d3[_0xdb9c('0x10')][_0xdb9c('0x12')]);return _0x2115e2(_0x5477d3[_0xdb9c('0x10')][_0xdb9c('0x12')]);}else{logger[_0xdb9c('0xc')](_0xdb9c('0xd'),_0x2607af,'request\x20sent');_0x2115e2(_0x5477d3[_0xdb9c('0x13')][_0xdb9c('0x12')]);}})[_0xdb9c('0x14')](function(_0x3f6a1a){logger[_0xdb9c('0x10')](_0xdb9c('0xd'),_0x2607af,_0x3f6a1a);_0x4dcd14(_0x3f6a1a);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index bd6edc9..47153a3 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 _0x1fb1=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x1fb1,0x142));var _0x11fb=function(_0x5be7a6,_0x4df8a9){_0x5be7a6=_0x5be7a6-0x0;var _0x2101a8=_0x1fb1[_0x5be7a6];return _0x2101a8;};'use strict';var multer=require(_0x11fb('0x0'));var util=require(_0x11fb('0x1'));var path=require(_0x11fb('0x2'));var timeout=require(_0x11fb('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x11fb('0x4'));var interaction=require(_0x11fb('0x5'));var config=require(_0x11fb('0x6'));var controller=require(_0x11fb('0x7'));router[_0x11fb('0x8')]('/',auth[_0x11fb('0x9')](),controller[_0x11fb('0xa')]);router[_0x11fb('0x8')](_0x11fb('0xb'),auth[_0x11fb('0x9')](),controller[_0x11fb('0xc')]);router['get'](_0x11fb('0xd'),auth['isAuthenticated'](),controller[_0x11fb('0xe')]);router['post']('/',auth[_0x11fb('0x9')](),controller[_0x11fb('0xf')]);router['put'](_0x11fb('0xd'),auth[_0x11fb('0x9')](),controller[_0x11fb('0x10')]);router[_0x11fb('0x11')](_0x11fb('0xd'),auth[_0x11fb('0x9')](),controller[_0x11fb('0x12')]);module[_0x11fb('0x13')]=router; \ No newline at end of file +var _0x6428=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x13ce6a,_0x1736fb){var _0x4dd026=function(_0x5b75b0){while(--_0x5b75b0){_0x13ce6a['push'](_0x13ce6a['shift']());}};_0x4dd026(++_0x1736fb);}(_0x6428,0x1bf));var _0x8642=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x6428[_0x18b5e8];return _0x25baed;};'use strict';var multer=require(_0x8642('0x0'));var util=require(_0x8642('0x1'));var path=require('path');var timeout=require(_0x8642('0x2'));var express=require(_0x8642('0x3'));var router=express['Router']();var auth=require(_0x8642('0x4'));var interaction=require(_0x8642('0x5'));var config=require(_0x8642('0x6'));var controller=require(_0x8642('0x7'));router[_0x8642('0x8')]('/',auth[_0x8642('0x9')](),controller['index']);router[_0x8642('0x8')](_0x8642('0xa'),auth[_0x8642('0x9')](),controller[_0x8642('0xb')]);router[_0x8642('0x8')](_0x8642('0xc'),auth[_0x8642('0x9')](),controller[_0x8642('0xd')]);router[_0x8642('0xe')]('/',auth[_0x8642('0x9')](),controller[_0x8642('0xf')]);router[_0x8642('0x10')](_0x8642('0xc'),auth['isAuthenticated'](),controller[_0x8642('0x11')]);router[_0x8642('0x12')]('/:id',auth[_0x8642('0x9')](),controller[_0x8642('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 382448e..152875a 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 _0x4f81=['STRING'];(function(_0x553f00,_0x58e9bb){var _0x18fdb1=function(_0xb39691){while(--_0xb39691){_0x553f00['push'](_0x553f00['shift']());}};_0x18fdb1(++_0x58e9bb);}(_0x4f81,0x1e3));var _0x14f8=function(_0xed6652,_0x4929d1){_0xed6652=_0xed6652-0x0;var _0x8c0e77=_0x4f81[_0xed6652];return _0x8c0e77;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x14f8('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x14f8('0x0')]}}; \ No newline at end of file +var _0x022a=['sequelize','exports','STRING','name'];(function(_0xef2862,_0x1a14ea){var _0x484bce=function(_0x2e77ca){while(--_0x2e77ca){_0xef2862['push'](_0xef2862['shift']());}};_0x484bce(++_0x1a14ea);}(_0x022a,0x1f0));var _0xa022=function(_0x16c2e0,_0x3dc335){_0x16c2e0=_0x16c2e0-0x0;var _0x49b690=_0x022a[_0x16c2e0];return _0x49b690;};'use strict';var Sequelize=require(_0xa022('0x0'));module[_0xa022('0x1')]={'name':{'type':Sequelize[_0xa022('0x2')],'unique':_0xa022('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa022('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2ec528f..d3ac83a 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 _0xdb52=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','findAll','catch','show','params','include','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','map','keys','query','filters','model','intersection'];(function(_0x527e8a,_0x206e6d){var _0x3b7e20=function(_0x3cd95a){while(--_0x3cd95a){_0x527e8a['push'](_0x527e8a['shift']());}};_0x3b7e20(++_0x206e6d);}(_0xdb52,0x144));var _0x2db5=function(_0x5535f2,_0x36da52){_0x5535f2=_0x5535f2-0x0;var _0x8691fa=_0xdb52[_0x5535f2];return _0x8691fa;};'use strict';var pdf=require(_0x2db5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2db5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2db5('0x2'));var rp=require(_0x2db5('0x3'));var moment=require('moment');var BPromise=require(_0x2db5('0x4'));var Mustache=require(_0x2db5('0x5'));var util=require(_0x2db5('0x6'));var path=require('path');var sox=require(_0x2db5('0x7'));var csv=require('to-csv');var ejs=require(_0x2db5('0x8'));var fs=require('fs');var _=require(_0x2db5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2db5('0xa'));var deskjs=require(_0x2db5('0xb'));var toCsv=require(_0x2db5('0xc'));var querystring=require('querystring');var Papa=require(_0x2db5('0xd'));var Redis=require('ioredis');var authService=require(_0x2db5('0xe'));var qs=require(_0x2db5('0xf'));var as=require(_0x2db5('0x10'));var hardwareService=require(_0x2db5('0x11'));var logger=require(_0x2db5('0x12'))(_0x2db5('0x13'));var utils=require(_0x2db5('0x14'));var config=require(_0x2db5('0x15'));var licenseUtil=require(_0x2db5('0x16'));var db=require(_0x2db5('0x17'))['db'];function respondWithStatusCode(_0x1a23be,_0x34fe61){_0x34fe61=_0x34fe61||0xcc;return function(_0x4a785d){if(_0x4a785d){return _0x1a23be[_0x2db5('0x18')](_0x34fe61);}return _0x1a23be['status'](_0x34fe61)[_0x2db5('0x19')]();};}function respondWithResult(_0x6f2ba,_0xbcdd3b){_0xbcdd3b=_0xbcdd3b||0xc8;return function(_0x305321){if(_0x305321){return _0x6f2ba['status'](_0xbcdd3b)[_0x2db5('0x1a')](_0x305321);}};}function respondWithFilteredResult(_0x471f07,_0x2f35d7){return function(_0x2f6ca4){if(_0x2f6ca4){var _0x4272bd=_0x2f6ca4[_0x2db5('0x1b')],_0x32f9ec=_0x2f35d7[_0x2db5('0x1c')],_0x722ce1=_0x2f35d7['offset']+_0x2f35d7[_0x2db5('0x1d')],_0x5dd436;if(_0x722ce1>=_0x4272bd){_0x722ce1=_0x4272bd;_0x5dd436=0xc8;}else{_0x5dd436=0xce;}_0x471f07[_0x2db5('0x1e')](_0x5dd436);return _0x471f07[_0x2db5('0x1f')]('Content-Range',_0x32f9ec+'-'+_0x722ce1+'/'+_0x4272bd)[_0x2db5('0x1a')](_0x2f6ca4);}return null;};}function patchUpdates(_0x80c4ce){return function(_0x17ab52){try{jsonpatch[_0x2db5('0x20')](_0x17ab52,_0x80c4ce,!![]);}catch(_0x45e8cc){return BPromise[_0x2db5('0x21')](_0x45e8cc);}return _0x17ab52[_0x2db5('0x22')]();};}function saveUpdates(_0x4724fa,_0x5c1267){return function(_0x5c4d60){if(_0x5c4d60){return _0x5c4d60[_0x2db5('0x23')](_0x4724fa)[_0x2db5('0x24')](function(_0x31c46a){return _0x31c46a;});}return null;};}function removeEntity(_0x5b7044,_0x527aaf){return function(_0x1820de){if(_0x1820de){return _0x1820de[_0x2db5('0x25')]()[_0x2db5('0x24')](function(){_0x5b7044[_0x2db5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc49b0f,_0x43275f){return function(_0x844606){if(!_0x844606){_0xc49b0f[_0x2db5('0x18')](0x194);}return _0x844606;};}function handleError(_0x1cdef0,_0x583674){_0x583674=_0x583674||0x1f4;return function(_0x3544a8){logger['error'](_0x3544a8[_0x2db5('0x26')]);if(_0x3544a8[_0x2db5('0x27')]){delete _0x3544a8[_0x2db5('0x27')];}_0x1cdef0[_0x2db5('0x1e')](_0x583674)[_0x2db5('0x28')](_0x3544a8);};}exports['index']=function(_0x3ce78f,_0x157be3){var _0x5e0462={},_0x3e28c6={},_0x5900eb={'count':0x0,'rows':[]};var _0x960ee4=_['map'](db['MailSubstatus'][_0x2db5('0x29')],function(_0x36a07f){return{'name':_0x36a07f[_0x2db5('0x2a')],'type':_0x36a07f[_0x2db5('0x2b')][_0x2db5('0x2c')]};});_0x3e28c6['model']=_[_0x2db5('0x2d')](_0x960ee4,_0x2db5('0x27'));_0x3e28c6['query']=_[_0x2db5('0x2e')](_0x3ce78f[_0x2db5('0x2f')]);_0x3e28c6[_0x2db5('0x30')]=_['intersection'](_0x3e28c6[_0x2db5('0x31')],_0x3e28c6[_0x2db5('0x2f')]);_0x5e0462['attributes']=_[_0x2db5('0x32')](_0x3e28c6[_0x2db5('0x31')],qs[_0x2db5('0x33')](_0x3ce78f['query'][_0x2db5('0x33')]));_0x5e0462[_0x2db5('0x34')]=_0x5e0462[_0x2db5('0x34')][_0x2db5('0x35')]?_0x5e0462['attributes']:_0x3e28c6[_0x2db5('0x31')];if(!_0x3ce78f[_0x2db5('0x2f')][_0x2db5('0x36')](_0x2db5('0x37'))){_0x5e0462['limit']=qs[_0x2db5('0x1d')](_0x3ce78f[_0x2db5('0x2f')]['limit']);_0x5e0462[_0x2db5('0x1c')]=qs['offset'](_0x3ce78f[_0x2db5('0x2f')]['offset']);}_0x5e0462[_0x2db5('0x38')]=qs['sort'](_0x3ce78f[_0x2db5('0x2f')][_0x2db5('0x39')]);_0x5e0462[_0x2db5('0x3a')]=qs['filters'](_[_0x2db5('0x3b')](_0x3ce78f[_0x2db5('0x2f')],_0x3e28c6[_0x2db5('0x30')]),_0x960ee4);if(_0x3ce78f[_0x2db5('0x2f')][_0x2db5('0x3c')]){_0x5e0462[_0x2db5('0x3a')]=_[_0x2db5('0x3d')](_0x5e0462['where'],{'$or':_['map'](_0x960ee4,function(_0x2059c9){if(_0x2059c9[_0x2db5('0x2b')]!==_0x2db5('0x3e')){var _0x3927fb={};_0x3927fb[_0x2059c9[_0x2db5('0x27')]]={'$like':'%'+_0x3ce78f[_0x2db5('0x2f')][_0x2db5('0x3c')]+'%'};return _0x3927fb;}})});}_0x5e0462=_[_0x2db5('0x3d')]({},_0x5e0462,_0x3ce78f[_0x2db5('0x3f')]);var _0x4423b4={'where':_0x5e0462[_0x2db5('0x3a')]};return db[_0x2db5('0x40')][_0x2db5('0x1b')](_0x4423b4)[_0x2db5('0x24')](function(_0x148290){_0x5900eb[_0x2db5('0x1b')]=_0x148290;if(_0x3ce78f['query'][_0x2db5('0x41')]){_0x5e0462['include']=[{'all':!![]}];}return db[_0x2db5('0x40')][_0x2db5('0x42')](_0x5e0462);})[_0x2db5('0x24')](function(_0x6071a8){_0x5900eb['rows']=_0x6071a8;return _0x5900eb;})[_0x2db5('0x24')](respondWithFilteredResult(_0x157be3,_0x5e0462))[_0x2db5('0x43')](handleError(_0x157be3,null));};exports[_0x2db5('0x44')]=function(_0x423e5c,_0x3954f6){var _0x131075={'raw':!![],'where':{'id':_0x423e5c[_0x2db5('0x45')]['id']}},_0x3af70d={};_0x3af70d[_0x2db5('0x31')]=_['keys'](db[_0x2db5('0x40')]['rawAttributes']);_0x3af70d[_0x2db5('0x2f')]=_[_0x2db5('0x2e')](_0x423e5c['query']);_0x3af70d[_0x2db5('0x30')]=_['intersection'](_0x3af70d['model'],_0x3af70d[_0x2db5('0x2f')]);_0x131075[_0x2db5('0x34')]=_[_0x2db5('0x32')](_0x3af70d[_0x2db5('0x31')],qs['fields'](_0x423e5c[_0x2db5('0x2f')]['fields']));_0x131075[_0x2db5('0x34')]=_0x131075[_0x2db5('0x34')]['length']?_0x131075[_0x2db5('0x34')]:_0x3af70d[_0x2db5('0x31')];if(_0x423e5c[_0x2db5('0x2f')][_0x2db5('0x41')]){_0x131075[_0x2db5('0x46')]=[{'all':!![]}];}_0x131075=_[_0x2db5('0x3d')]({},_0x131075,_0x423e5c[_0x2db5('0x3f')]);return db['MailSubstatus'][_0x2db5('0x47')](_0x131075)[_0x2db5('0x24')](handleEntityNotFound(_0x3954f6,null))[_0x2db5('0x24')](respondWithResult(_0x3954f6,null))[_0x2db5('0x43')](handleError(_0x3954f6,null));};exports['create']=function(_0x17a6e3,_0x52ef35){return db[_0x2db5('0x40')][_0x2db5('0x48')](_0x17a6e3[_0x2db5('0x49')],{})[_0x2db5('0x24')](respondWithResult(_0x52ef35,0xc9))[_0x2db5('0x43')](handleError(_0x52ef35,null));};exports[_0x2db5('0x23')]=function(_0x308725,_0x78bb31){if(_0x308725[_0x2db5('0x49')]['id']){delete _0x308725[_0x2db5('0x49')]['id'];}return db[_0x2db5('0x40')][_0x2db5('0x47')]({'where':{'id':_0x308725[_0x2db5('0x45')]['id']}})[_0x2db5('0x24')](handleEntityNotFound(_0x78bb31,null))[_0x2db5('0x24')](saveUpdates(_0x308725[_0x2db5('0x49')],null))[_0x2db5('0x24')](respondWithResult(_0x78bb31,null))[_0x2db5('0x43')](handleError(_0x78bb31,null));};exports[_0x2db5('0x25')]=function(_0x2d27cf,_0x56c5e2){return db[_0x2db5('0x40')][_0x2db5('0x47')]({'where':{'id':_0x2d27cf[_0x2db5('0x45')]['id']}})[_0x2db5('0x24')](handleEntityNotFound(_0x56c5e2,null))[_0x2db5('0x24')](removeEntity(_0x56c5e2,null))['catch'](handleError(_0x56c5e2,null));};exports[_0x2db5('0x4a')]=function(_0x32d691,_0x1946fe){return db[_0x2db5('0x40')][_0x2db5('0x4a')]()[_0x2db5('0x24')](respondWithResult(_0x1946fe,null))[_0x2db5('0x43')](handleError(_0x1946fe,null));}; \ No newline at end of file +var _0x7b76=['include','rows','catch','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7b76,0x180));var _0x67b7=function(_0x3357b8,_0xeb406){_0x3357b8=_0x3357b8-0x0;var _0x50737a=_0x7b76[_0x3357b8];return _0x50737a;};'use strict';var pdf=require(_0x67b7('0x0'));var emlformat=require(_0x67b7('0x1'));var rimraf=require(_0x67b7('0x2'));var zipdir=require(_0x67b7('0x3'));var jsonpatch=require(_0x67b7('0x4'));var rp=require('request-promise');var moment=require(_0x67b7('0x5'));var BPromise=require(_0x67b7('0x6'));var Mustache=require('mustache');var util=require(_0x67b7('0x7'));var path=require(_0x67b7('0x8'));var sox=require('sox');var csv=require(_0x67b7('0x9'));var ejs=require(_0x67b7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x67b7('0xb'));var crypto=require(_0x67b7('0xc'));var jsforce=require(_0x67b7('0xd'));var deskjs=require(_0x67b7('0xe'));var toCsv=require(_0x67b7('0x9'));var querystring=require('querystring');var Papa=require(_0x67b7('0xf'));var Redis=require(_0x67b7('0x10'));var authService=require(_0x67b7('0x11'));var qs=require(_0x67b7('0x12'));var as=require(_0x67b7('0x13'));var hardwareService=require(_0x67b7('0x14'));var logger=require('../../config/logger')(_0x67b7('0x15'));var utils=require('../../config/utils');var config=require(_0x67b7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x67b7('0x17'))['db'];function respondWithStatusCode(_0x4c2fb6,_0x4012cf){_0x4012cf=_0x4012cf||0xcc;return function(_0xe33a63){if(_0xe33a63){return _0x4c2fb6['sendStatus'](_0x4012cf);}return _0x4c2fb6[_0x67b7('0x18')](_0x4012cf)[_0x67b7('0x19')]();};}function respondWithResult(_0xfbb087,_0x32147e){_0x32147e=_0x32147e||0xc8;return function(_0x4fb707){if(_0x4fb707){return _0xfbb087[_0x67b7('0x18')](_0x32147e)[_0x67b7('0x1a')](_0x4fb707);}};}function respondWithFilteredResult(_0x2a1a95,_0x588624){return function(_0x313992){if(_0x313992){var _0x1d8d78=_0x313992[_0x67b7('0x1b')],_0x334312=_0x588624[_0x67b7('0x1c')],_0x5b0a1e=_0x588624[_0x67b7('0x1c')]+_0x588624['limit'],_0x5cd7ad;if(_0x5b0a1e>=_0x1d8d78){_0x5b0a1e=_0x1d8d78;_0x5cd7ad=0xc8;}else{_0x5cd7ad=0xce;}_0x2a1a95['status'](_0x5cd7ad);return _0x2a1a95[_0x67b7('0x1d')](_0x67b7('0x1e'),_0x334312+'-'+_0x5b0a1e+'/'+_0x1d8d78)['json'](_0x313992);}return null;};}function patchUpdates(_0x19e3f3){return function(_0x36aafd){try{jsonpatch[_0x67b7('0x1f')](_0x36aafd,_0x19e3f3,!![]);}catch(_0x111fee){return BPromise[_0x67b7('0x20')](_0x111fee);}return _0x36aafd[_0x67b7('0x21')]();};}function saveUpdates(_0x5df4a6,_0x590bc2){return function(_0x3d5d61){if(_0x3d5d61){return _0x3d5d61[_0x67b7('0x22')](_0x5df4a6)[_0x67b7('0x23')](function(_0x53842){return _0x53842;});}return null;};}function removeEntity(_0x4a9eea,_0x5e443e){return function(_0x44ed9e){if(_0x44ed9e){return _0x44ed9e[_0x67b7('0x24')]()[_0x67b7('0x23')](function(){_0x4a9eea[_0x67b7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa8b2,_0x382cc0){return function(_0x507a83){if(!_0x507a83){_0x3aa8b2['sendStatus'](0x194);}return _0x507a83;};}function handleError(_0x5809d6,_0x45c7f6){_0x45c7f6=_0x45c7f6||0x1f4;return function(_0x1fd0dc){logger[_0x67b7('0x25')](_0x1fd0dc[_0x67b7('0x26')]);if(_0x1fd0dc[_0x67b7('0x27')]){delete _0x1fd0dc[_0x67b7('0x27')];}_0x5809d6[_0x67b7('0x18')](_0x45c7f6)[_0x67b7('0x28')](_0x1fd0dc);};}exports[_0x67b7('0x29')]=function(_0x2e1cc7,_0xc0b72f){var _0x1df619={},_0x4955b9={},_0x50bb16={'count':0x0,'rows':[]};var _0x3ecf05=_[_0x67b7('0x2a')](db[_0x67b7('0x2b')][_0x67b7('0x2c')],function(_0x57465b){return{'name':_0x57465b[_0x67b7('0x2d')],'type':_0x57465b['type'][_0x67b7('0x2e')]};});_0x4955b9['model']=_[_0x67b7('0x2a')](_0x3ecf05,_0x67b7('0x27'));_0x4955b9[_0x67b7('0x2f')]=_[_0x67b7('0x30')](_0x2e1cc7[_0x67b7('0x2f')]);_0x4955b9[_0x67b7('0x31')]=_[_0x67b7('0x32')](_0x4955b9[_0x67b7('0x33')],_0x4955b9[_0x67b7('0x2f')]);_0x1df619['attributes']=_['intersection'](_0x4955b9[_0x67b7('0x33')],qs[_0x67b7('0x34')](_0x2e1cc7[_0x67b7('0x2f')][_0x67b7('0x34')]));_0x1df619[_0x67b7('0x35')]=_0x1df619[_0x67b7('0x35')][_0x67b7('0x36')]?_0x1df619[_0x67b7('0x35')]:_0x4955b9[_0x67b7('0x33')];if(!_0x2e1cc7[_0x67b7('0x2f')]['hasOwnProperty'](_0x67b7('0x37'))){_0x1df619[_0x67b7('0x38')]=qs['limit'](_0x2e1cc7[_0x67b7('0x2f')][_0x67b7('0x38')]);_0x1df619['offset']=qs[_0x67b7('0x1c')](_0x2e1cc7[_0x67b7('0x2f')][_0x67b7('0x1c')]);}_0x1df619[_0x67b7('0x39')]=qs['sort'](_0x2e1cc7['query'][_0x67b7('0x3a')]);_0x1df619[_0x67b7('0x3b')]=qs[_0x67b7('0x31')](_[_0x67b7('0x3c')](_0x2e1cc7[_0x67b7('0x2f')],_0x4955b9[_0x67b7('0x31')]),_0x3ecf05);if(_0x2e1cc7[_0x67b7('0x2f')][_0x67b7('0x3d')]){_0x1df619[_0x67b7('0x3b')]=_[_0x67b7('0x3e')](_0x1df619['where'],{'$or':_['map'](_0x3ecf05,function(_0x347658){if(_0x347658[_0x67b7('0x3f')]!==_0x67b7('0x40')){var _0x381fad={};_0x381fad[_0x347658[_0x67b7('0x27')]]={'$like':'%'+_0x2e1cc7[_0x67b7('0x2f')][_0x67b7('0x3d')]+'%'};return _0x381fad;}})});}_0x1df619=_[_0x67b7('0x3e')]({},_0x1df619,_0x2e1cc7['options']);var _0x3a0ebe={'where':_0x1df619[_0x67b7('0x3b')]};return db[_0x67b7('0x2b')]['count'](_0x3a0ebe)['then'](function(_0x36ef55){_0x50bb16[_0x67b7('0x1b')]=_0x36ef55;if(_0x2e1cc7[_0x67b7('0x2f')][_0x67b7('0x41')]){_0x1df619[_0x67b7('0x42')]=[{'all':!![]}];}return db[_0x67b7('0x2b')]['findAll'](_0x1df619);})[_0x67b7('0x23')](function(_0x39ad26){_0x50bb16[_0x67b7('0x43')]=_0x39ad26;return _0x50bb16;})[_0x67b7('0x23')](respondWithFilteredResult(_0xc0b72f,_0x1df619))[_0x67b7('0x44')](handleError(_0xc0b72f,null));};exports['show']=function(_0x402fd4,_0x3e6517){var _0x5c6d67={'raw':!![],'where':{'id':_0x402fd4[_0x67b7('0x45')]['id']}},_0x10dfab={};_0x10dfab[_0x67b7('0x33')]=_['keys'](db[_0x67b7('0x2b')][_0x67b7('0x2c')]);_0x10dfab[_0x67b7('0x2f')]=_[_0x67b7('0x30')](_0x402fd4[_0x67b7('0x2f')]);_0x10dfab['filters']=_[_0x67b7('0x32')](_0x10dfab[_0x67b7('0x33')],_0x10dfab[_0x67b7('0x2f')]);_0x5c6d67[_0x67b7('0x35')]=_[_0x67b7('0x32')](_0x10dfab[_0x67b7('0x33')],qs[_0x67b7('0x34')](_0x402fd4[_0x67b7('0x2f')][_0x67b7('0x34')]));_0x5c6d67[_0x67b7('0x35')]=_0x5c6d67[_0x67b7('0x35')][_0x67b7('0x36')]?_0x5c6d67[_0x67b7('0x35')]:_0x10dfab[_0x67b7('0x33')];if(_0x402fd4['query'][_0x67b7('0x41')]){_0x5c6d67[_0x67b7('0x42')]=[{'all':!![]}];}_0x5c6d67=_[_0x67b7('0x3e')]({},_0x5c6d67,_0x402fd4[_0x67b7('0x46')]);return db['MailSubstatus'][_0x67b7('0x47')](_0x5c6d67)[_0x67b7('0x23')](handleEntityNotFound(_0x3e6517,null))[_0x67b7('0x23')](respondWithResult(_0x3e6517,null))[_0x67b7('0x44')](handleError(_0x3e6517,null));};exports[_0x67b7('0x48')]=function(_0x2be360,_0x3889b6){return db[_0x67b7('0x2b')][_0x67b7('0x48')](_0x2be360['body'],{})[_0x67b7('0x23')](respondWithResult(_0x3889b6,0xc9))[_0x67b7('0x44')](handleError(_0x3889b6,null));};exports['update']=function(_0x5a1c84,_0x4c5025){if(_0x5a1c84[_0x67b7('0x49')]['id']){delete _0x5a1c84[_0x67b7('0x49')]['id'];}return db[_0x67b7('0x2b')][_0x67b7('0x47')]({'where':{'id':_0x5a1c84['params']['id']}})['then'](handleEntityNotFound(_0x4c5025,null))[_0x67b7('0x23')](saveUpdates(_0x5a1c84[_0x67b7('0x49')],null))[_0x67b7('0x23')](respondWithResult(_0x4c5025,null))[_0x67b7('0x44')](handleError(_0x4c5025,null));};exports[_0x67b7('0x24')]=function(_0x27665c,_0x2cb9ed){return db[_0x67b7('0x2b')][_0x67b7('0x47')]({'where':{'id':_0x27665c[_0x67b7('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cb9ed,null))['then'](removeEntity(_0x2cb9ed,null))[_0x67b7('0x44')](handleError(_0x2cb9ed,null));};exports['describe']=function(_0x25857a,_0x962bbd){return db[_0x67b7('0x2b')][_0x67b7('0x4a')]()['then'](respondWithResult(_0x962bbd,null))[_0x67b7('0x44')](handleError(_0x962bbd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f7c28a9..8c4f7d8 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash','../../config/logger'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a0755,_0xdf6bac){_0x2a0755=_0x2a0755-0x0;var _0x3eaf4f=_0xb10b[_0x2a0755];return _0x3eaf4f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('MailSubstatus',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a5c=['MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0x8a5c,0x136));var _0xc8a5=function(_0x4a6c72,_0x29e720){_0x4a6c72=_0x4a6c72-0x0;var _0x53bf02=_0x8a5c[_0x4a6c72];return _0x53bf02;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var logger=require(_0xc8a5('0x2'))(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var rp=require(_0xc8a5('0x6'));var fs=require('fs');var path=require(_0xc8a5('0x7'));var rimraf=require(_0xc8a5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc8a5('0x9'));module[_0xc8a5('0xa')]=function(_0x5b6cc2,_0x1b4ed4){return _0x5b6cc2[_0xc8a5('0xb')](_0xc8a5('0xc'),attributes,{'tableName':_0xc8a5('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 9822fb7..0e166bf 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 _0x750a=['error','code','MailSubstatus,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x5fb6d0,_0x1082c5){var _0x572752=function(_0x45fb19){while(--_0x45fb19){_0x5fb6d0['push'](_0x5fb6d0['shift']());}};_0x572752(++_0x1082c5);}(_0x750a,0x140));var _0xa750=function(_0x54482d,_0x48e95d){_0x54482d=_0x54482d-0x0;var _0x610d61=_0x750a[_0x54482d];return _0x610d61;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file +var _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(_0x567459,_0x2c9742){var _0x53e01a=function(_0x5007e9){while(--_0x5007e9){_0x567459['push'](_0x567459['shift']());}};_0x53e01a(++_0x2c9742);}(_0x3c81,0x102));var _0x13c8=function(_0x2763af,_0x297661){_0x2763af=_0x2763af-0x0;var _0x364b9c=_0x3c81[_0x2763af];return _0x364b9c;};'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 ea087c0..8b2da37 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 _0xe19a=['update','delete','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x184800,_0x13f14e){var _0x58e20b=function(_0x481e55){while(--_0x481e55){_0x184800['push'](_0x184800['shift']());}};_0x58e20b(++_0x13f14e);}(_0xe19a,0x73));var _0xae19=function(_0x5b24e7,_0x171047){_0x5b24e7=_0x5b24e7-0x0;var _0x5f20cb=_0xe19a[_0x5b24e7];return _0x5f20cb;};'use strict';var multer=require(_0xae19('0x0'));var util=require('util');var path=require(_0xae19('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae19('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xae19('0x3'));var config=require(_0xae19('0x4'));var controller=require(_0xae19('0x5'));router[_0xae19('0x6')]('/',auth[_0xae19('0x7')](),controller[_0xae19('0x8')]);router[_0xae19('0x6')]('/describe',auth[_0xae19('0x7')](),controller['describe']);router[_0xae19('0x6')](_0xae19('0x9'),auth[_0xae19('0x7')](),controller[_0xae19('0xa')]);router[_0xae19('0xb')]('/',auth[_0xae19('0x7')](),controller['create']);router[_0xae19('0xc')](_0xae19('0x9'),auth[_0xae19('0x7')](),controller[_0xae19('0xd')]);router[_0xae19('0xe')](_0xae19('0x9'),auth[_0xae19('0x7')](),controller['destroy']);module[_0xae19('0xf')]=router; \ No newline at end of file +var _0xbdda=['get','isAuthenticated','/describe','describe','/:id','show','post','delete','destroy','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdda,0x145));var _0xabdd=function(_0x5e5d5b,_0x1c0099){_0x5e5d5b=_0x5e5d5b-0x0;var _0x425d85=_0xbdda[_0x5e5d5b];return _0x425d85;};'use strict';var multer=require('multer');var util=require(_0xabdd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xabdd('0x1'));var router=express['Router']();var auth=require(_0xabdd('0x2'));var interaction=require(_0xabdd('0x3'));var config=require(_0xabdd('0x4'));var controller=require('./mailTransferReport.controller');router[_0xabdd('0x5')]('/',auth[_0xabdd('0x6')](),controller['index']);router[_0xabdd('0x5')](_0xabdd('0x7'),auth[_0xabdd('0x6')](),controller[_0xabdd('0x8')]);router[_0xabdd('0x5')](_0xabdd('0x9'),auth[_0xabdd('0x6')](),controller[_0xabdd('0xa')]);router[_0xabdd('0xb')]('/',auth[_0xabdd('0x6')](),controller['create']);router['put']('/:id',auth[_0xabdd('0x6')](),controller['update']);router[_0xabdd('0xc')]('/:id',auth[_0xabdd('0x6')](),controller[_0xabdd('0xd')]);module[_0xabdd('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index eafc05f..30f5853 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 _0x0831=['moment','sequelize','STRING','queue','NOW'];(function(_0x570d99,_0x34022b){var _0x1d2982=function(_0x160c0f){while(--_0x160c0f){_0x570d99['push'](_0x570d99['shift']());}};_0x1d2982(++_0x34022b);}(_0x0831,0xdc));var _0x1083=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x0831[_0x3299d1];return _0x44356e;};'use strict';var moment=require(_0x1083('0x0'));var Sequelize=require(_0x1083('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1083('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0x1083('0x3')),'allowNull':![],'defaultValue':_0x1083('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1083('0x4')]}}; \ No newline at end of file +var _0x83b7=['agent','queue','DATE','moment','STRING','ENUM'];(function(_0x223581,_0x2b22d5){var _0x4230ec=function(_0x1c1d3f){while(--_0x1c1d3f){_0x223581['push'](_0x223581['shift']());}};_0x4230ec(++_0x2b22d5);}(_0x83b7,0x69));var _0x783b=function(_0x35f363,_0x50f60d){_0x35f363=_0x35f363-0x0;var _0x3f4b10=_0x83b7[_0x35f363];return _0x3f4b10;};'use strict';var moment=require(_0x783b('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x783b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x783b('0x2')]('account',_0x783b('0x3'),_0x783b('0x4')),'allowNull':![],'defaultValue':_0x783b('0x4')},'transferredAt':{'type':Sequelize[_0x783b('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f7c8cc5..547254b 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 _0x1dcc=['mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','MailTransferReport','rawAttributes','fieldName','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','options','includeAll','findAll','rows','catch','show','params','filters','include','merge','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x53f41d,_0xca1b60){var _0x53d286=function(_0x153031){while(--_0x153031){_0x53f41d['push'](_0x53f41d['shift']());}};_0x53d286(++_0xca1b60);}(_0x1dcc,0x8c));var _0xc1dc=function(_0x466db8,_0x206093){_0x466db8=_0x466db8-0x0;var _0xdff2d1=_0x1dcc[_0x466db8];return _0xdff2d1;};'use strict';var pdf=require(_0xc1dc('0x0'));var emlformat=require(_0xc1dc('0x1'));var rimraf=require(_0xc1dc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1dc('0x3'));var rp=require(_0xc1dc('0x4'));var moment=require(_0xc1dc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x6'));var util=require('util');var path=require(_0xc1dc('0x7'));var sox=require(_0xc1dc('0x8'));var csv=require(_0xc1dc('0x9'));var ejs=require(_0xc1dc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1dc('0xb'));var crypto=require(_0xc1dc('0xc'));var jsforce=require(_0xc1dc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0x9'));var querystring=require(_0xc1dc('0xe'));var Papa=require(_0xc1dc('0xf'));var Redis=require('ioredis');var authService=require(_0xc1dc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1dc('0x11'));var logger=require(_0xc1dc('0x12'))(_0xc1dc('0x13'));var utils=require(_0xc1dc('0x14'));var config=require(_0xc1dc('0x15'));var licenseUtil=require(_0xc1dc('0x16'));var db=require(_0xc1dc('0x17'))['db'];function respondWithStatusCode(_0x5709cc,_0x144e89){_0x144e89=_0x144e89||0xcc;return function(_0x9b64c9){if(_0x9b64c9){return _0x5709cc[_0xc1dc('0x18')](_0x144e89);}return _0x5709cc[_0xc1dc('0x19')](_0x144e89)[_0xc1dc('0x1a')]();};}function respondWithResult(_0x184917,_0x2fcc30){_0x2fcc30=_0x2fcc30||0xc8;return function(_0x1da073){if(_0x1da073){return _0x184917[_0xc1dc('0x19')](_0x2fcc30)[_0xc1dc('0x1b')](_0x1da073);}};}function respondWithFilteredResult(_0x584d9e,_0x3330e4){return function(_0x2ff29b){if(_0x2ff29b){var _0xc82df4=_0x2ff29b[_0xc1dc('0x1c')],_0x1ab117=_0x3330e4[_0xc1dc('0x1d')],_0x6d3d4=_0x3330e4[_0xc1dc('0x1d')]+_0x3330e4[_0xc1dc('0x1e')],_0x312a82;if(_0x6d3d4>=_0xc82df4){_0x6d3d4=_0xc82df4;_0x312a82=0xc8;}else{_0x312a82=0xce;}_0x584d9e['status'](_0x312a82);return _0x584d9e['set'](_0xc1dc('0x1f'),_0x1ab117+'-'+_0x6d3d4+'/'+_0xc82df4)['json'](_0x2ff29b);}return null;};}function patchUpdates(_0x57688f){return function(_0x18dadd){try{jsonpatch[_0xc1dc('0x20')](_0x18dadd,_0x57688f,!![]);}catch(_0x52a3b0){return BPromise[_0xc1dc('0x21')](_0x52a3b0);}return _0x18dadd[_0xc1dc('0x22')]();};}function saveUpdates(_0x291f30,_0x4b37de){return function(_0x4e7e89){if(_0x4e7e89){return _0x4e7e89[_0xc1dc('0x23')](_0x291f30)[_0xc1dc('0x24')](function(_0x338580){return _0x338580;});}return null;};}function removeEntity(_0x49aefa,_0x5a7f5a){return function(_0x50ca59){if(_0x50ca59){return _0x50ca59[_0xc1dc('0x25')]()['then'](function(){_0x49aefa[_0xc1dc('0x19')](0xcc)[_0xc1dc('0x1a')]();});}};}function handleEntityNotFound(_0x56a8c8,_0x1ebba0){return function(_0x31a343){if(!_0x31a343){_0x56a8c8[_0xc1dc('0x18')](0x194);}return _0x31a343;};}function handleError(_0x437b26,_0x1a57b2){_0x1a57b2=_0x1a57b2||0x1f4;return function(_0x423a0e){logger[_0xc1dc('0x26')](_0x423a0e['stack']);if(_0x423a0e['name']){delete _0x423a0e[_0xc1dc('0x27')];}_0x437b26[_0xc1dc('0x19')](_0x1a57b2)[_0xc1dc('0x28')](_0x423a0e);};}exports['index']=function(_0x2cf618,_0x47aa47){var _0x6c223e={},_0x12180a={},_0xe0c01f={'count':0x0,'rows':[]};var _0x4fd297=_[_0xc1dc('0x29')](db[_0xc1dc('0x2a')][_0xc1dc('0x2b')],function(_0x567cc2){return{'name':_0x567cc2[_0xc1dc('0x2c')],'type':_0x567cc2['type'][_0xc1dc('0x2d')]};});_0x12180a['model']=_[_0xc1dc('0x29')](_0x4fd297,'name');_0x12180a['query']=_[_0xc1dc('0x2e')](_0x2cf618[_0xc1dc('0x2f')]);_0x12180a['filters']=_['intersection'](_0x12180a[_0xc1dc('0x30')],_0x12180a[_0xc1dc('0x2f')]);_0x6c223e[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x12180a[_0xc1dc('0x30')],qs[_0xc1dc('0x33')](_0x2cf618[_0xc1dc('0x2f')][_0xc1dc('0x33')]));_0x6c223e[_0xc1dc('0x31')]=_0x6c223e[_0xc1dc('0x31')][_0xc1dc('0x34')]?_0x6c223e[_0xc1dc('0x31')]:_0x12180a[_0xc1dc('0x30')];if(!_0x2cf618['query'][_0xc1dc('0x35')](_0xc1dc('0x36'))){_0x6c223e['limit']=qs[_0xc1dc('0x1e')](_0x2cf618['query']['limit']);_0x6c223e[_0xc1dc('0x1d')]=qs[_0xc1dc('0x1d')](_0x2cf618[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0x6c223e['order']=qs[_0xc1dc('0x37')](_0x2cf618['query'][_0xc1dc('0x37')]);_0x6c223e['where']=qs['filters'](_[_0xc1dc('0x38')](_0x2cf618[_0xc1dc('0x2f')],_0x12180a['filters']),_0x4fd297);if(_0x2cf618['query'][_0xc1dc('0x39')]){_0x6c223e['where']=_['merge'](_0x6c223e[_0xc1dc('0x3a')],{'$or':_[_0xc1dc('0x29')](_0x4fd297,function(_0x48a19f){if(_0x48a19f['type']!=='VIRTUAL'){var _0x196423={};_0x196423[_0x48a19f[_0xc1dc('0x27')]]={'$like':'%'+_0x2cf618[_0xc1dc('0x2f')][_0xc1dc('0x39')]+'%'};return _0x196423;}})});}_0x6c223e=_['merge']({},_0x6c223e,_0x2cf618[_0xc1dc('0x3b')]);var _0x22eef6={'where':_0x6c223e['where']};return db[_0xc1dc('0x2a')][_0xc1dc('0x1c')](_0x22eef6)['then'](function(_0x428e3c){_0xe0c01f[_0xc1dc('0x1c')]=_0x428e3c;if(_0x2cf618[_0xc1dc('0x2f')][_0xc1dc('0x3c')]){_0x6c223e['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xc1dc('0x3d')](_0x6c223e);})['then'](function(_0x57fda8){_0xe0c01f[_0xc1dc('0x3e')]=_0x57fda8;return _0xe0c01f;})[_0xc1dc('0x24')](respondWithFilteredResult(_0x47aa47,_0x6c223e))[_0xc1dc('0x3f')](handleError(_0x47aa47,null));};exports[_0xc1dc('0x40')]=function(_0xdb4787,_0xb3e3a7){var _0x24699b={'raw':!![],'where':{'id':_0xdb4787[_0xc1dc('0x41')]['id']}},_0x744c38={};_0x744c38[_0xc1dc('0x30')]=_[_0xc1dc('0x2e')](db[_0xc1dc('0x2a')][_0xc1dc('0x2b')]);_0x744c38[_0xc1dc('0x2f')]=_[_0xc1dc('0x2e')](_0xdb4787[_0xc1dc('0x2f')]);_0x744c38[_0xc1dc('0x42')]=_['intersection'](_0x744c38['model'],_0x744c38[_0xc1dc('0x2f')]);_0x24699b[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x744c38[_0xc1dc('0x30')],qs[_0xc1dc('0x33')](_0xdb4787[_0xc1dc('0x2f')]['fields']));_0x24699b[_0xc1dc('0x31')]=_0x24699b[_0xc1dc('0x31')]['length']?_0x24699b[_0xc1dc('0x31')]:_0x744c38[_0xc1dc('0x30')];if(_0xdb4787[_0xc1dc('0x2f')][_0xc1dc('0x3c')]){_0x24699b[_0xc1dc('0x43')]=[{'all':!![]}];}_0x24699b=_[_0xc1dc('0x44')]({},_0x24699b,_0xdb4787['options']);return db[_0xc1dc('0x2a')][_0xc1dc('0x45')](_0x24699b)[_0xc1dc('0x24')](handleEntityNotFound(_0xb3e3a7,null))[_0xc1dc('0x24')](respondWithResult(_0xb3e3a7,null))[_0xc1dc('0x3f')](handleError(_0xb3e3a7,null));};exports['create']=function(_0x3953d7,_0x33285b){return db[_0xc1dc('0x2a')][_0xc1dc('0x46')](_0x3953d7[_0xc1dc('0x47')],{})[_0xc1dc('0x24')](respondWithResult(_0x33285b,0xc9))[_0xc1dc('0x3f')](handleError(_0x33285b,null));};exports[_0xc1dc('0x23')]=function(_0x36e35e,_0x5c6c50){if(_0x36e35e['body']['id']){delete _0x36e35e[_0xc1dc('0x47')]['id'];}return db[_0xc1dc('0x2a')]['find']({'where':{'id':_0x36e35e['params']['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0x5c6c50,null))[_0xc1dc('0x24')](saveUpdates(_0x36e35e[_0xc1dc('0x47')],null))['then'](respondWithResult(_0x5c6c50,null))[_0xc1dc('0x3f')](handleError(_0x5c6c50,null));};exports['destroy']=function(_0x460064,_0x4e4271){return db[_0xc1dc('0x2a')][_0xc1dc('0x45')]({'where':{'id':_0x460064[_0xc1dc('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e4271,null))['then'](removeEntity(_0x4e4271,null))['catch'](handleError(_0x4e4271,null));};exports[_0xc1dc('0x48')]=function(_0x40e03c,_0x179db1){return db[_0xc1dc('0x2a')][_0xc1dc('0x48')]()[_0xc1dc('0x24')](respondWithResult(_0x179db1,null))[_0xc1dc('0x3f')](handleError(_0x179db1,null));}; \ No newline at end of file +var _0xab95=['attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','then','end','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xab95,0xaf));var _0x5ab9=function(_0x2d25ea,_0x5c3ab5){_0x2d25ea=_0x2d25ea-0x0;var _0x2699b6=_0xab95[_0x2d25ea];return _0x2699b6;};'use strict';var pdf=require(_0x5ab9('0x0'));var emlformat=require(_0x5ab9('0x1'));var rimraf=require(_0x5ab9('0x2'));var zipdir=require(_0x5ab9('0x3'));var jsonpatch=require(_0x5ab9('0x4'));var rp=require(_0x5ab9('0x5'));var moment=require(_0x5ab9('0x6'));var BPromise=require(_0x5ab9('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5ab9('0x8'));var sox=require(_0x5ab9('0x9'));var csv=require(_0x5ab9('0xa'));var ejs=require(_0x5ab9('0xb'));var fs=require('fs');var _=require(_0x5ab9('0xc'));var squel=require(_0x5ab9('0xd'));var crypto=require(_0x5ab9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5ab9('0xf'));var toCsv=require(_0x5ab9('0xa'));var querystring=require(_0x5ab9('0x10'));var Papa=require(_0x5ab9('0x11'));var Redis=require(_0x5ab9('0x12'));var authService=require(_0x5ab9('0x13'));var qs=require(_0x5ab9('0x14'));var as=require(_0x5ab9('0x15'));var hardwareService=require(_0x5ab9('0x16'));var logger=require(_0x5ab9('0x17'))(_0x5ab9('0x18'));var utils=require(_0x5ab9('0x19'));var config=require(_0x5ab9('0x1a'));var licenseUtil=require(_0x5ab9('0x1b'));var db=require(_0x5ab9('0x1c'))['db'];function respondWithStatusCode(_0x2f6119,_0x15d980){_0x15d980=_0x15d980||0xcc;return function(_0x268249){if(_0x268249){return _0x2f6119[_0x5ab9('0x1d')](_0x15d980);}return _0x2f6119[_0x5ab9('0x1e')](_0x15d980)['end']();};}function respondWithResult(_0x9e3d31,_0x1b9d9c){_0x1b9d9c=_0x1b9d9c||0xc8;return function(_0xe8395b){if(_0xe8395b){return _0x9e3d31['status'](_0x1b9d9c)[_0x5ab9('0x1f')](_0xe8395b);}};}function respondWithFilteredResult(_0x3bac85,_0x413ec9){return function(_0x259d7d){if(_0x259d7d){var _0x2a4e5b=_0x259d7d[_0x5ab9('0x20')],_0x74bb2b=_0x413ec9[_0x5ab9('0x21')],_0x1ec738=_0x413ec9[_0x5ab9('0x21')]+_0x413ec9[_0x5ab9('0x22')],_0x3c84f4;if(_0x1ec738>=_0x2a4e5b){_0x1ec738=_0x2a4e5b;_0x3c84f4=0xc8;}else{_0x3c84f4=0xce;}_0x3bac85[_0x5ab9('0x1e')](_0x3c84f4);return _0x3bac85[_0x5ab9('0x23')]('Content-Range',_0x74bb2b+'-'+_0x1ec738+'/'+_0x2a4e5b)['json'](_0x259d7d);}return null;};}function patchUpdates(_0x10d378){return function(_0x345f39){try{jsonpatch[_0x5ab9('0x24')](_0x345f39,_0x10d378,!![]);}catch(_0x11948c){return BPromise['reject'](_0x11948c);}return _0x345f39[_0x5ab9('0x25')]();};}function saveUpdates(_0x18fbcb,_0x43af6e){return function(_0x56feea){if(_0x56feea){return _0x56feea['update'](_0x18fbcb)[_0x5ab9('0x26')](function(_0x1a05fa){return _0x1a05fa;});}return null;};}function removeEntity(_0x177c6b,_0x3817fb){return function(_0x2b351b){if(_0x2b351b){return _0x2b351b['destroy']()[_0x5ab9('0x26')](function(){_0x177c6b[_0x5ab9('0x1e')](0xcc)[_0x5ab9('0x27')]();});}};}function handleEntityNotFound(_0x1d187b,_0x16a1ca){return function(_0x27468d){if(!_0x27468d){_0x1d187b[_0x5ab9('0x1d')](0x194);}return _0x27468d;};}function handleError(_0x42a408,_0x2b4a02){_0x2b4a02=_0x2b4a02||0x1f4;return function(_0x3d0cae){logger[_0x5ab9('0x28')](_0x3d0cae['stack']);if(_0x3d0cae[_0x5ab9('0x29')]){delete _0x3d0cae[_0x5ab9('0x29')];}_0x42a408[_0x5ab9('0x1e')](_0x2b4a02)[_0x5ab9('0x2a')](_0x3d0cae);};}exports[_0x5ab9('0x2b')]=function(_0x358edf,_0x40dcf4){var _0x476cba={},_0x7eabb9={},_0x22b576={'count':0x0,'rows':[]};var _0x42277a=_[_0x5ab9('0x2c')](db[_0x5ab9('0x2d')][_0x5ab9('0x2e')],function(_0x6c2dcc){return{'name':_0x6c2dcc[_0x5ab9('0x2f')],'type':_0x6c2dcc[_0x5ab9('0x30')][_0x5ab9('0x31')]};});_0x7eabb9[_0x5ab9('0x32')]=_[_0x5ab9('0x2c')](_0x42277a,_0x5ab9('0x29'));_0x7eabb9[_0x5ab9('0x33')]=_[_0x5ab9('0x34')](_0x358edf['query']);_0x7eabb9[_0x5ab9('0x35')]=_['intersection'](_0x7eabb9[_0x5ab9('0x32')],_0x7eabb9[_0x5ab9('0x33')]);_0x476cba['attributes']=_[_0x5ab9('0x36')](_0x7eabb9[_0x5ab9('0x32')],qs[_0x5ab9('0x37')](_0x358edf[_0x5ab9('0x33')]['fields']));_0x476cba['attributes']=_0x476cba[_0x5ab9('0x38')][_0x5ab9('0x39')]?_0x476cba[_0x5ab9('0x38')]:_0x7eabb9[_0x5ab9('0x32')];if(!_0x358edf['query']['hasOwnProperty'](_0x5ab9('0x3a'))){_0x476cba[_0x5ab9('0x22')]=qs['limit'](_0x358edf[_0x5ab9('0x33')][_0x5ab9('0x22')]);_0x476cba[_0x5ab9('0x21')]=qs[_0x5ab9('0x21')](_0x358edf[_0x5ab9('0x33')][_0x5ab9('0x21')]);}_0x476cba[_0x5ab9('0x3b')]=qs['sort'](_0x358edf['query'][_0x5ab9('0x3c')]);_0x476cba[_0x5ab9('0x3d')]=qs[_0x5ab9('0x35')](_[_0x5ab9('0x3e')](_0x358edf[_0x5ab9('0x33')],_0x7eabb9[_0x5ab9('0x35')]),_0x42277a);if(_0x358edf[_0x5ab9('0x33')][_0x5ab9('0x3f')]){_0x476cba[_0x5ab9('0x3d')]=_[_0x5ab9('0x40')](_0x476cba[_0x5ab9('0x3d')],{'$or':_[_0x5ab9('0x2c')](_0x42277a,function(_0x13637b){if(_0x13637b['type']!=='VIRTUAL'){var _0x39ef6c={};_0x39ef6c[_0x13637b[_0x5ab9('0x29')]]={'$like':'%'+_0x358edf[_0x5ab9('0x33')][_0x5ab9('0x3f')]+'%'};return _0x39ef6c;}})});}_0x476cba=_['merge']({},_0x476cba,_0x358edf[_0x5ab9('0x41')]);var _0x551053={'where':_0x476cba[_0x5ab9('0x3d')]};return db[_0x5ab9('0x2d')][_0x5ab9('0x20')](_0x551053)[_0x5ab9('0x26')](function(_0x24eba0){_0x22b576['count']=_0x24eba0;if(_0x358edf[_0x5ab9('0x33')][_0x5ab9('0x42')]){_0x476cba[_0x5ab9('0x43')]=[{'all':!![]}];}return db[_0x5ab9('0x2d')][_0x5ab9('0x44')](_0x476cba);})[_0x5ab9('0x26')](function(_0x180ead){_0x22b576[_0x5ab9('0x45')]=_0x180ead;return _0x22b576;})[_0x5ab9('0x26')](respondWithFilteredResult(_0x40dcf4,_0x476cba))[_0x5ab9('0x46')](handleError(_0x40dcf4,null));};exports['show']=function(_0x331a12,_0x385b3b){var _0x12d0b0={'raw':!![],'where':{'id':_0x331a12[_0x5ab9('0x47')]['id']}},_0x42b7aa={};_0x42b7aa['model']=_[_0x5ab9('0x34')](db[_0x5ab9('0x2d')][_0x5ab9('0x2e')]);_0x42b7aa[_0x5ab9('0x33')]=_[_0x5ab9('0x34')](_0x331a12[_0x5ab9('0x33')]);_0x42b7aa['filters']=_[_0x5ab9('0x36')](_0x42b7aa['model'],_0x42b7aa['query']);_0x12d0b0[_0x5ab9('0x38')]=_[_0x5ab9('0x36')](_0x42b7aa[_0x5ab9('0x32')],qs[_0x5ab9('0x37')](_0x331a12['query']['fields']));_0x12d0b0[_0x5ab9('0x38')]=_0x12d0b0[_0x5ab9('0x38')][_0x5ab9('0x39')]?_0x12d0b0[_0x5ab9('0x38')]:_0x42b7aa[_0x5ab9('0x32')];if(_0x331a12[_0x5ab9('0x33')]['includeAll']){_0x12d0b0[_0x5ab9('0x43')]=[{'all':!![]}];}_0x12d0b0=_[_0x5ab9('0x40')]({},_0x12d0b0,_0x331a12[_0x5ab9('0x41')]);return db[_0x5ab9('0x2d')][_0x5ab9('0x48')](_0x12d0b0)['then'](handleEntityNotFound(_0x385b3b,null))[_0x5ab9('0x26')](respondWithResult(_0x385b3b,null))[_0x5ab9('0x46')](handleError(_0x385b3b,null));};exports[_0x5ab9('0x49')]=function(_0x239172,_0x4ac292){return db[_0x5ab9('0x2d')][_0x5ab9('0x49')](_0x239172[_0x5ab9('0x4a')],{})['then'](respondWithResult(_0x4ac292,0xc9))[_0x5ab9('0x46')](handleError(_0x4ac292,null));};exports[_0x5ab9('0x4b')]=function(_0x3f2497,_0x755c1d){if(_0x3f2497[_0x5ab9('0x4a')]['id']){delete _0x3f2497['body']['id'];}return db[_0x5ab9('0x2d')][_0x5ab9('0x48')]({'where':{'id':_0x3f2497['params']['id']}})[_0x5ab9('0x26')](handleEntityNotFound(_0x755c1d,null))[_0x5ab9('0x26')](saveUpdates(_0x3f2497[_0x5ab9('0x4a')],null))[_0x5ab9('0x26')](respondWithResult(_0x755c1d,null))[_0x5ab9('0x46')](handleError(_0x755c1d,null));};exports['destroy']=function(_0x489c28,_0x531b5){return db[_0x5ab9('0x2d')][_0x5ab9('0x48')]({'where':{'id':_0x489c28[_0x5ab9('0x47')]['id']}})[_0x5ab9('0x26')](handleEntityNotFound(_0x531b5,null))[_0x5ab9('0x26')](removeEntity(_0x531b5,null))['catch'](handleError(_0x531b5,null));};exports[_0x5ab9('0x4c')]=function(_0xee3073,_0x92b3d6){return db[_0x5ab9('0x2d')]['describe']()[_0x5ab9('0x26')](respondWithResult(_0x92b3d6,null))[_0x5ab9('0x46')](handleError(_0x92b3d6,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ccbe3f0..b712244 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 _0xac5c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger'];(function(_0x42a0e2,_0x9a1e9b){var _0x175b5d=function(_0x4a8d2a){while(--_0x4a8d2a){_0x42a0e2['push'](_0x42a0e2['shift']());}};_0x175b5d(++_0x9a1e9b);}(_0xac5c,0xce));var _0xcac5=function(_0x1b66e6,_0x4a6d68){_0x1b66e6=_0x1b66e6-0x0;var _0x5476f3=_0xac5c[_0x1b66e6];return _0x5476f3;};'use strict';var _=require(_0xcac5('0x0'));var util=require('util');var logger=require(_0xcac5('0x1'))('api');var moment=require(_0xcac5('0x2'));var BPromise=require(_0xcac5('0x3'));var rp=require(_0xcac5('0x4'));var fs=require('fs');var path=require(_0xcac5('0x5'));var rimraf=require(_0xcac5('0x6'));var config=require(_0xcac5('0x7'));var attributes=require(_0xcac5('0x8'));module[_0xcac5('0x9')]=function(_0x3867f5,_0xd323d4){return _0x3867f5[_0xcac5('0xa')](_0xcac5('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xcac5('0xc'),'fields':[_0xcac5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x15bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','lodash','../../config/logger'];(function(_0x57e348,_0x592339){var _0xf247a2=function(_0x1fbb57){while(--_0x1fbb57){_0x57e348['push'](_0x57e348['shift']());}};_0xf247a2(++_0x592339);}(_0x15bf,0x73));var _0xf15b=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x15bf[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0xf15b('0x0'));var util=require('util');var logger=require(_0xf15b('0x1'))(_0xf15b('0x2'));var moment=require(_0xf15b('0x3'));var BPromise=require(_0xf15b('0x4'));var rp=require(_0xf15b('0x5'));var fs=require('fs');var path=require(_0xf15b('0x6'));var rimraf=require(_0xf15b('0x7'));var config=require(_0xf15b('0x8'));var attributes=require(_0xf15b('0x9'));module['exports']=function(_0x43104f,_0xb8435){return _0x43104f[_0xf15b('0xa')](_0xf15b('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf15b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 250e431..6eae2c6 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 _0xfb63=['message','MailTransferReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','then','info','debug','request\x20sent','stringify','error','code'];(function(_0x32bce8,_0x54f965){var _0x38badc=function(_0x1ed1ee){while(--_0x1ed1ee){_0x32bce8['push'](_0x32bce8['shift']());}};_0x38badc(++_0x54f965);}(_0xfb63,0xdf));var _0x3fb6=function(_0xcad371,_0x548e8d){_0xcad371=_0xcad371-0x0;var _0x18f0df=_0xfb63[_0xcad371];return _0x18f0df;};'use strict';var _=require(_0x3fb6('0x0'));var util=require(_0x3fb6('0x1'));var moment=require(_0x3fb6('0x2'));var BPromise=require(_0x3fb6('0x3'));var rs=require(_0x3fb6('0x4'));var fs=require('fs');var Redis=require(_0x3fb6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fb6('0x6'));var logger=require(_0x3fb6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3fb6('0x8'));var client=jayson[_0x3fb6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6bcb,_0x5ce84d,_0xe84c7a){return new BPromise(function(_0x1e945d,_0x3fac33){return client['request'](_0x4e6bcb,_0xe84c7a)[_0x3fb6('0xa')](function(_0x809bf7){logger[_0x3fb6('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x5ce84d,'request\x20sent');logger[_0x3fb6('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5ce84d,_0x3fb6('0xd'),JSON[_0x3fb6('0xe')](_0x809bf7));if(_0x809bf7[_0x3fb6('0xf')]){if(_0x809bf7[_0x3fb6('0xf')][_0x3fb6('0x10')]===0x1f4){logger[_0x3fb6('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x5ce84d,_0x809bf7['error']['message']);return _0x3fac33(_0x809bf7[_0x3fb6('0xf')][_0x3fb6('0x11')]);}logger[_0x3fb6('0xf')](_0x3fb6('0x12'),_0x5ce84d,_0x809bf7[_0x3fb6('0xf')]['message']);return _0x1e945d(_0x809bf7[_0x3fb6('0xf')][_0x3fb6('0x11')]);}else{logger['info'](_0x3fb6('0x12'),_0x5ce84d,'request\x20sent');_0x1e945d(_0x809bf7[_0x3fb6('0x13')]['message']);}})['catch'](function(_0x38bd2b){logger[_0x3fb6('0xf')](_0x3fb6('0x12'),_0x5ce84d,_0x38bd2b);_0x3fac33(_0x38bd2b);});});} \ No newline at end of file +var _0xb282=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','debug','stringify','error','MailTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x5eebec,_0x54c64e){var _0x670c06=function(_0x48aef1){while(--_0x48aef1){_0x5eebec['push'](_0x5eebec['shift']());}};_0x670c06(++_0x54c64e);}(_0xb282,0x122));var _0x2b28=function(_0xe2a1aa,_0x525d7b){_0xe2a1aa=_0xe2a1aa-0x0;var _0x5a8362=_0xb282[_0xe2a1aa];return _0x5a8362;};'use strict';var _=require(_0x2b28('0x0'));var util=require(_0x2b28('0x1'));var moment=require(_0x2b28('0x2'));var BPromise=require(_0x2b28('0x3'));var rs=require(_0x2b28('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b28('0x5'))['db'];var utils=require(_0x2b28('0x6'));var logger=require(_0x2b28('0x7'))(_0x2b28('0x8'));var config=require(_0x2b28('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2b28('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x380810,_0xaf099,_0x5b0a23){return new BPromise(function(_0x17a89a,_0x57977a){return client['request'](_0x380810,_0x5b0a23)[_0x2b28('0xb')](function(_0x1849a7){logger[_0x2b28('0xc')]('MailTransferReport,\x20%s,\x20%s',_0xaf099,'request\x20sent');logger[_0x2b28('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xaf099,'request\x20sent',JSON[_0x2b28('0xe')](_0x1849a7));if(_0x1849a7['error']){if(_0x1849a7['error']['code']===0x1f4){logger[_0x2b28('0xf')](_0x2b28('0x10'),_0xaf099,_0x1849a7[_0x2b28('0xf')][_0x2b28('0x11')]);return _0x57977a(_0x1849a7[_0x2b28('0xf')][_0x2b28('0x11')]);}logger[_0x2b28('0xf')]('MailTransferReport,\x20%s,\x20%s',_0xaf099,_0x1849a7[_0x2b28('0xf')][_0x2b28('0x11')]);return _0x17a89a(_0x1849a7[_0x2b28('0xf')][_0x2b28('0x11')]);}else{logger[_0x2b28('0xc')](_0x2b28('0x10'),_0xaf099,_0x2b28('0x12'));_0x17a89a(_0x1849a7[_0x2b28('0x13')][_0x2b28('0x11')]);}})[_0x2b28('0x14')](function(_0x4ef352){logger[_0x2b28('0xf')](_0x2b28('0x10'),_0xaf099,_0x4ef352);_0x57977a(_0x4ef352);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1aecd8a..a388b88 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 _0x9b0e=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x543af8,_0x54cfe8){var _0x22cb7b=function(_0x74b983){while(--_0x74b983){_0x543af8['push'](_0x543af8['shift']());}};_0x22cb7b(++_0x54cfe8);}(_0x9b0e,0x115));var _0xe9b0=function(_0x3d07bb,_0x13ea20){_0x3d07bb=_0x3d07bb-0x0;var _0x52eb0f=_0x9b0e[_0x3d07bb];return _0x52eb0f;};'use strict';var multer=require(_0xe9b0('0x0'));var util=require(_0xe9b0('0x1'));var path=require(_0xe9b0('0x2'));var timeout=require(_0xe9b0('0x3'));var express=require(_0xe9b0('0x4'));var router=express[_0xe9b0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe9b0('0x6'));var config=require(_0xe9b0('0x7'));var controller=require(_0xe9b0('0x8'));router[_0xe9b0('0x9')]('/',auth[_0xe9b0('0xa')](),controller[_0xe9b0('0xb')]);router[_0xe9b0('0x9')](_0xe9b0('0xc'),auth['isAuthenticated'](),controller[_0xe9b0('0xd')]);router[_0xe9b0('0x9')](_0xe9b0('0xe'),auth[_0xe9b0('0xa')](),controller[_0xe9b0('0xf')]);router[_0xe9b0('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9b0('0x11')]('/:id',auth[_0xe9b0('0xa')](),controller[_0xe9b0('0x12')]);router[_0xe9b0('0x13')](_0xe9b0('0xe'),auth[_0xe9b0('0xa')](),controller[_0xe9b0('0x14')]);module[_0xe9b0('0x15')]=router; \ No newline at end of file +var _0xea92=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','create','destroy','path','express','Router'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0xea92,0x189));var _0x2ea9=function(_0x22adb6,_0x432234){_0x22adb6=_0x22adb6-0x0;var _0x45624c=_0xea92[_0x22adb6];return _0x45624c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2ea9('0x0'));var timeout=require('connect-timeout');var express=require(_0x2ea9('0x1'));var router=express[_0x2ea9('0x2')]();var auth=require(_0x2ea9('0x3'));var interaction=require(_0x2ea9('0x4'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x2ea9('0x5')]('/',auth[_0x2ea9('0x6')](),controller[_0x2ea9('0x7')]);router[_0x2ea9('0x5')]('/describe',auth[_0x2ea9('0x6')](),controller[_0x2ea9('0x8')]);router[_0x2ea9('0x5')](_0x2ea9('0x9'),auth[_0x2ea9('0x6')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2ea9('0xa')]);router['put'](_0x2ea9('0x9'),auth[_0x2ea9('0x6')](),controller['update']);router['delete'](_0x2ea9('0x9'),auth[_0x2ea9('0x6')](),controller[_0x2ea9('0xb')]);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 341248f..233e0ba 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 _0x12b1=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING'];(function(_0x2f599b,_0x267a9d){var _0x20423d=function(_0x2b9832){while(--_0x2b9832){_0x2f599b['push'](_0x2f599b['shift']());}};_0x20423d(++_0x267a9d);}(_0x12b1,0x16d));var _0x112b=function(_0x4fcb07,_0x4a77a4){_0x4fcb07=_0x4fcb07-0x0;var _0xf2eeb=_0x12b1[_0x4fcb07];return _0xf2eeb;};'use strict';var Sequelize=require(_0x112b('0x0'));var moment=require('moment');module[_0x112b('0x1')]={'channel':{'type':Sequelize[_0x112b('0x2')]},'membername':{'type':Sequelize[_0x112b('0x2')]},'interface':{'type':Sequelize[_0x112b('0x2')]},'type':{'type':Sequelize[_0x112b('0x2')],'defaultValue':_0x112b('0x3'),'comment':_0x112b('0x4')},'duration':{'type':Sequelize[_0x112b('0x5')]},'enterAt':{'type':Sequelize[_0x112b('0x6')]},'exitAt':{'type':Sequelize[_0x112b('0x6')],'set':function(_0x36139a){var _0x1a8f6b=moment(_0x36139a);var _0x2c4233=moment(this[_0x112b('0x7')](_0x112b('0x8')));var _0x40684e=_0x1a8f6b['diff'](_0x2c4233,_0x112b('0x9'));this[_0x112b('0xa')]('exitAt',_0x36139a);this[_0x112b('0xa')]('duration',_0x40684e||null);}},'data1':{'type':Sequelize[_0x112b('0x2')],'comment':_0x112b('0xb')},'data2':{'type':Sequelize[_0x112b('0x2')],'comment':_0x112b('0xc')},'data3':{'type':Sequelize[_0x112b('0x2')],'comment':_0x112b('0xd')},'data4':{'type':Sequelize[_0x112b('0x2')],'comment':_0x112b('0xe')},'data5':{'type':Sequelize[_0x112b('0x2')],'comment':_0x112b('0xf')},'role':{'type':Sequelize[_0x112b('0x2')]},'internal':{'type':Sequelize[_0x112b('0x5')]},'uniqueid':{'type':Sequelize[_0x112b('0x2')]}}; \ No newline at end of file +var _0x895a=['diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x895a,0x119));var _0xa895=function(_0x30a548,_0x32cac2){_0x30a548=_0x30a548-0x0;var _0x5d780c=_0x895a[_0x30a548];return _0x5d780c;};'use strict';var Sequelize=require(_0xa895('0x0'));var moment=require(_0xa895('0x1'));module[_0xa895('0x2')]={'channel':{'type':Sequelize[_0xa895('0x3')]},'membername':{'type':Sequelize[_0xa895('0x3')]},'interface':{'type':Sequelize[_0xa895('0x3')]},'type':{'type':Sequelize[_0xa895('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xa895('0x4')},'duration':{'type':Sequelize[_0xa895('0x5')]},'enterAt':{'type':Sequelize[_0xa895('0x6')]},'exitAt':{'type':Sequelize[_0xa895('0x6')],'set':function(_0x2aaeb1){var _0x4a7c4d=moment(_0x2aaeb1);var _0x334442=moment(this['getDataValue'](_0xa895('0x7')));var _0x5584ee=_0x4a7c4d[_0xa895('0x8')](_0x334442,_0xa895('0x9'));this[_0xa895('0xa')](_0xa895('0xb'),_0x2aaeb1);this['setDataValue'](_0xa895('0xc'),_0x5584ee||null);}},'data1':{'type':Sequelize[_0xa895('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xa895('0x3')],'comment':_0xa895('0xd')},'data3':{'type':Sequelize[_0xa895('0x3')],'comment':_0xa895('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0xa895('0xf')},'data5':{'type':Sequelize[_0xa895('0x3')],'comment':_0xa895('0x10')},'role':{'type':Sequelize[_0xa895('0x3')]},'internal':{'type':Sequelize[_0xa895('0x5')]},'uniqueid':{'type':Sequelize[_0xa895('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c04c47d..3e093ed 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 _0xc2b3=['error','stack','name','send','map','MemberReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xc2b3,0xbb));var _0x3c2b=function(_0x5107cb,_0x1dfcf1){_0x5107cb=_0x5107cb-0x0;var _0x5586b8=_0xc2b3[_0x5107cb];return _0x5586b8;};'use strict';var pdf=require(_0x3c2b('0x0'));var emlformat=require(_0x3c2b('0x1'));var rimraf=require(_0x3c2b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c2b('0x3'));var rp=require(_0x3c2b('0x4'));var moment=require(_0x3c2b('0x5'));var BPromise=require(_0x3c2b('0x6'));var Mustache=require('mustache');var util=require(_0x3c2b('0x7'));var path=require(_0x3c2b('0x8'));var sox=require(_0x3c2b('0x9'));var csv=require(_0x3c2b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c2b('0xb'));var squel=require(_0x3c2b('0xc'));var crypto=require(_0x3c2b('0xd'));var jsforce=require(_0x3c2b('0xe'));var deskjs=require(_0x3c2b('0xf'));var toCsv=require(_0x3c2b('0xa'));var querystring=require(_0x3c2b('0x10'));var Papa=require(_0x3c2b('0x11'));var Redis=require(_0x3c2b('0x12'));var authService=require(_0x3c2b('0x13'));var qs=require(_0x3c2b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c2b('0x15'));var logger=require(_0x3c2b('0x16'))('api');var utils=require(_0x3c2b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3c2b('0x18'))['db'];function respondWithStatusCode(_0x2f5fd4,_0x4510bc){_0x4510bc=_0x4510bc||0xcc;return function(_0x1f53c6){if(_0x1f53c6){return _0x2f5fd4[_0x3c2b('0x19')](_0x4510bc);}return _0x2f5fd4['status'](_0x4510bc)[_0x3c2b('0x1a')]();};}function respondWithResult(_0x104348,_0x3493b4){_0x3493b4=_0x3493b4||0xc8;return function(_0x27497c){if(_0x27497c){return _0x104348[_0x3c2b('0x1b')](_0x3493b4)[_0x3c2b('0x1c')](_0x27497c);}};}function respondWithFilteredResult(_0x137660,_0x3bc37f){return function(_0x3e18ff){if(_0x3e18ff){var _0x4c9c2b=_0x3e18ff['count'],_0x49771f=_0x3bc37f[_0x3c2b('0x1d')],_0x304bb4=_0x3bc37f[_0x3c2b('0x1d')]+_0x3bc37f[_0x3c2b('0x1e')],_0x30a8cc;if(_0x304bb4>=_0x4c9c2b){_0x304bb4=_0x4c9c2b;_0x30a8cc=0xc8;}else{_0x30a8cc=0xce;}_0x137660['status'](_0x30a8cc);return _0x137660[_0x3c2b('0x1f')](_0x3c2b('0x20'),_0x49771f+'-'+_0x304bb4+'/'+_0x4c9c2b)[_0x3c2b('0x1c')](_0x3e18ff);}return null;};}function patchUpdates(_0x580986){return function(_0x3a50cb){try{jsonpatch[_0x3c2b('0x21')](_0x3a50cb,_0x580986,!![]);}catch(_0x1fb905){return BPromise[_0x3c2b('0x22')](_0x1fb905);}return _0x3a50cb['save']();};}function saveUpdates(_0x27c6df,_0x5cece9){return function(_0x127038){if(_0x127038){return _0x127038[_0x3c2b('0x23')](_0x27c6df)[_0x3c2b('0x24')](function(_0x554697){return _0x554697;});}return null;};}function removeEntity(_0x52b575,_0x1369cf){return function(_0x355c75){if(_0x355c75){return _0x355c75[_0x3c2b('0x25')]()[_0x3c2b('0x24')](function(){_0x52b575[_0x3c2b('0x1b')](0xcc)[_0x3c2b('0x1a')]();});}};}function handleEntityNotFound(_0x45f1dc,_0x500afc){return function(_0x5b677c){if(!_0x5b677c){_0x45f1dc[_0x3c2b('0x19')](0x194);}return _0x5b677c;};}function handleError(_0x427a8f,_0x3ce930){_0x3ce930=_0x3ce930||0x1f4;return function(_0x423dce){logger[_0x3c2b('0x26')](_0x423dce[_0x3c2b('0x27')]);if(_0x423dce[_0x3c2b('0x28')]){delete _0x423dce[_0x3c2b('0x28')];}_0x427a8f[_0x3c2b('0x1b')](_0x3ce930)[_0x3c2b('0x29')](_0x423dce);};}exports['index']=function(_0x23983c,_0x2130c2){var _0x20cd04={},_0x529ec6={},_0x45ff19={'count':0x0,'rows':[]};var _0x293af1=_[_0x3c2b('0x2a')](db[_0x3c2b('0x2b')][_0x3c2b('0x2c')],function(_0x4e4c44){return{'name':_0x4e4c44[_0x3c2b('0x2d')],'type':_0x4e4c44[_0x3c2b('0x2e')]['key']};});_0x529ec6[_0x3c2b('0x2f')]=_[_0x3c2b('0x2a')](_0x293af1,_0x3c2b('0x28'));_0x529ec6[_0x3c2b('0x30')]=_['keys'](_0x23983c[_0x3c2b('0x30')]);_0x529ec6['filters']=_[_0x3c2b('0x31')](_0x529ec6['model'],_0x529ec6[_0x3c2b('0x30')]);_0x20cd04[_0x3c2b('0x32')]=_[_0x3c2b('0x31')](_0x529ec6[_0x3c2b('0x2f')],qs[_0x3c2b('0x33')](_0x23983c['query'][_0x3c2b('0x33')]));_0x20cd04[_0x3c2b('0x32')]=_0x20cd04[_0x3c2b('0x32')][_0x3c2b('0x34')]?_0x20cd04[_0x3c2b('0x32')]:_0x529ec6[_0x3c2b('0x2f')];if(!_0x23983c[_0x3c2b('0x30')][_0x3c2b('0x35')](_0x3c2b('0x36'))){_0x20cd04[_0x3c2b('0x1e')]=qs[_0x3c2b('0x1e')](_0x23983c[_0x3c2b('0x30')][_0x3c2b('0x1e')]);_0x20cd04[_0x3c2b('0x1d')]=qs[_0x3c2b('0x1d')](_0x23983c[_0x3c2b('0x30')]['offset']);}_0x20cd04['order']=qs[_0x3c2b('0x37')](_0x23983c[_0x3c2b('0x30')][_0x3c2b('0x37')]);_0x20cd04[_0x3c2b('0x38')]=qs[_0x3c2b('0x39')](_['pick'](_0x23983c[_0x3c2b('0x30')],_0x529ec6[_0x3c2b('0x39')]),_0x293af1);if(_0x23983c[_0x3c2b('0x30')][_0x3c2b('0x3a')]){_0x20cd04[_0x3c2b('0x38')]=_['merge'](_0x20cd04[_0x3c2b('0x38')],{'$or':_[_0x3c2b('0x2a')](_0x293af1,function(_0x57de03){if(_0x57de03[_0x3c2b('0x2e')]!==_0x3c2b('0x3b')){var _0x12d0da={};_0x12d0da[_0x57de03[_0x3c2b('0x28')]]={'$like':'%'+_0x23983c['query'][_0x3c2b('0x3a')]+'%'};return _0x12d0da;}})});}_0x20cd04=_[_0x3c2b('0x3c')]({},_0x20cd04,_0x23983c[_0x3c2b('0x3d')]);var _0x3f44d2={'where':_0x20cd04[_0x3c2b('0x38')]};return db['MemberReport'][_0x3c2b('0x3e')](_0x3f44d2)[_0x3c2b('0x24')](function(_0x4186a5){_0x45ff19[_0x3c2b('0x3e')]=_0x4186a5;if(_0x23983c[_0x3c2b('0x30')][_0x3c2b('0x3f')]){_0x20cd04[_0x3c2b('0x40')]=[{'all':!![]}];}return db[_0x3c2b('0x2b')][_0x3c2b('0x41')](_0x20cd04);})[_0x3c2b('0x24')](function(_0x31d13b){_0x45ff19[_0x3c2b('0x42')]=_0x31d13b;return _0x45ff19;})['then'](respondWithFilteredResult(_0x2130c2,_0x20cd04))[_0x3c2b('0x43')](handleError(_0x2130c2,null));};exports[_0x3c2b('0x44')]=function(_0x4159ba,_0x41a490){var _0x5e8dea={'raw':!![],'where':{'id':_0x4159ba[_0x3c2b('0x45')]['id']}},_0x2fd5bc={};_0x2fd5bc['model']=_[_0x3c2b('0x46')](db[_0x3c2b('0x2b')][_0x3c2b('0x2c')]);_0x2fd5bc[_0x3c2b('0x30')]=_[_0x3c2b('0x46')](_0x4159ba[_0x3c2b('0x30')]);_0x2fd5bc[_0x3c2b('0x39')]=_[_0x3c2b('0x31')](_0x2fd5bc[_0x3c2b('0x2f')],_0x2fd5bc['query']);_0x5e8dea[_0x3c2b('0x32')]=_[_0x3c2b('0x31')](_0x2fd5bc[_0x3c2b('0x2f')],qs[_0x3c2b('0x33')](_0x4159ba[_0x3c2b('0x30')]['fields']));_0x5e8dea[_0x3c2b('0x32')]=_0x5e8dea['attributes'][_0x3c2b('0x34')]?_0x5e8dea['attributes']:_0x2fd5bc[_0x3c2b('0x2f')];if(_0x4159ba['query'][_0x3c2b('0x3f')]){_0x5e8dea['include']=[{'all':!![]}];}_0x5e8dea=_[_0x3c2b('0x3c')]({},_0x5e8dea,_0x4159ba['options']);return db[_0x3c2b('0x2b')][_0x3c2b('0x47')](_0x5e8dea)[_0x3c2b('0x24')](handleEntityNotFound(_0x41a490,null))['then'](respondWithResult(_0x41a490,null))['catch'](handleError(_0x41a490,null));};exports['create']=function(_0x389fe5,_0x2a60b4){return db['MemberReport'][_0x3c2b('0x48')](_0x389fe5['body'],{})[_0x3c2b('0x24')](respondWithResult(_0x2a60b4,0xc9))[_0x3c2b('0x43')](handleError(_0x2a60b4,null));};exports[_0x3c2b('0x23')]=function(_0x57bbf3,_0x65f685){if(_0x57bbf3[_0x3c2b('0x49')]['id']){delete _0x57bbf3[_0x3c2b('0x49')]['id'];}return db['MemberReport'][_0x3c2b('0x47')]({'where':{'id':_0x57bbf3[_0x3c2b('0x45')]['id']}})[_0x3c2b('0x24')](handleEntityNotFound(_0x65f685,null))[_0x3c2b('0x24')](saveUpdates(_0x57bbf3[_0x3c2b('0x49')],null))[_0x3c2b('0x24')](respondWithResult(_0x65f685,null))['catch'](handleError(_0x65f685,null));};exports[_0x3c2b('0x25')]=function(_0x2ca209,_0x2b141a){return db[_0x3c2b('0x2b')]['find']({'where':{'id':_0x2ca209[_0x3c2b('0x45')]['id']}})[_0x3c2b('0x24')](handleEntityNotFound(_0x2b141a,null))['then'](removeEntity(_0x2b141a,null))['catch'](handleError(_0x2b141a,null));};exports[_0x3c2b('0x4a')]=function(_0x3dc13f,_0x18e041){return db[_0x3c2b('0x2b')][_0x3c2b('0x4a')]()[_0x3c2b('0x24')](respondWithResult(_0x18e041,null))['catch'](handleError(_0x18e041,null));}; \ No newline at end of file +var _0x3a37=['rows','show','rawAttributes','keys','includeAll','create','body','catch','update','params','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','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','status','count','offset','set','Content-Range','json','apply','reject','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x46d786,_0xfaa203){var _0x3b5cdd=function(_0xd636ff){while(--_0xd636ff){_0x46d786['push'](_0x46d786['shift']());}};_0x3b5cdd(++_0xfaa203);}(_0x3a37,0xa8));var _0x73a3=function(_0x1fa19c,_0x5c740b){_0x1fa19c=_0x1fa19c-0x0;var _0x5b332d=_0x3a37[_0x1fa19c];return _0x5b332d;};'use strict';var pdf=require(_0x73a3('0x0'));var emlformat=require(_0x73a3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x73a3('0x2'));var jsonpatch=require(_0x73a3('0x3'));var rp=require(_0x73a3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x73a3('0x5'));var util=require(_0x73a3('0x6'));var path=require(_0x73a3('0x7'));var sox=require('sox');var csv=require(_0x73a3('0x8'));var ejs=require(_0x73a3('0x9'));var fs=require('fs');var _=require(_0x73a3('0xa'));var squel=require(_0x73a3('0xb'));var crypto=require(_0x73a3('0xc'));var jsforce=require(_0x73a3('0xd'));var deskjs=require(_0x73a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x73a3('0xf'));var Papa=require(_0x73a3('0x10'));var Redis=require(_0x73a3('0x11'));var authService=require(_0x73a3('0x12'));var qs=require(_0x73a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73a3('0x14'));var logger=require('../../config/logger')(_0x73a3('0x15'));var utils=require(_0x73a3('0x16'));var config=require(_0x73a3('0x17'));var licenseUtil=require(_0x73a3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369428,_0x2481f3){_0x2481f3=_0x2481f3||0xcc;return function(_0x2e7d85){if(_0x2e7d85){return _0x369428['sendStatus'](_0x2481f3);}return _0x369428[_0x73a3('0x19')](_0x2481f3)['end']();};}function respondWithResult(_0x2d4b79,_0xff41f9){_0xff41f9=_0xff41f9||0xc8;return function(_0x13e165){if(_0x13e165){return _0x2d4b79[_0x73a3('0x19')](_0xff41f9)['json'](_0x13e165);}};}function respondWithFilteredResult(_0x50283c,_0xdbb75f){return function(_0x3c32a0){if(_0x3c32a0){var _0x466195=_0x3c32a0[_0x73a3('0x1a')],_0x1e62ce=_0xdbb75f[_0x73a3('0x1b')],_0x1524bf=_0xdbb75f[_0x73a3('0x1b')]+_0xdbb75f['limit'],_0x36e5f5;if(_0x1524bf>=_0x466195){_0x1524bf=_0x466195;_0x36e5f5=0xc8;}else{_0x36e5f5=0xce;}_0x50283c[_0x73a3('0x19')](_0x36e5f5);return _0x50283c[_0x73a3('0x1c')](_0x73a3('0x1d'),_0x1e62ce+'-'+_0x1524bf+'/'+_0x466195)[_0x73a3('0x1e')](_0x3c32a0);}return null;};}function patchUpdates(_0x9db92b){return function(_0x40afe5){try{jsonpatch[_0x73a3('0x1f')](_0x40afe5,_0x9db92b,!![]);}catch(_0x19a51d){return BPromise[_0x73a3('0x20')](_0x19a51d);}return _0x40afe5['save']();};}function saveUpdates(_0x17a106,_0x368603){return function(_0x3fc73f){if(_0x3fc73f){return _0x3fc73f['update'](_0x17a106)['then'](function(_0x28e715){return _0x28e715;});}return null;};}function removeEntity(_0x3bcbd5,_0x1ec81e){return function(_0x55d66b){if(_0x55d66b){return _0x55d66b['destroy']()[_0x73a3('0x21')](function(){_0x3bcbd5['status'](0xcc)[_0x73a3('0x22')]();});}};}function handleEntityNotFound(_0x4d3cd0,_0x30c35e){return function(_0x236f46){if(!_0x236f46){_0x4d3cd0[_0x73a3('0x23')](0x194);}return _0x236f46;};}function handleError(_0x21a137,_0x640ac8){_0x640ac8=_0x640ac8||0x1f4;return function(_0x5b01b8){logger[_0x73a3('0x24')](_0x5b01b8[_0x73a3('0x25')]);if(_0x5b01b8[_0x73a3('0x26')]){delete _0x5b01b8[_0x73a3('0x26')];}_0x21a137[_0x73a3('0x19')](_0x640ac8)[_0x73a3('0x27')](_0x5b01b8);};}exports[_0x73a3('0x28')]=function(_0x22a135,_0x27e4e9){var _0x37c068={},_0x121893={},_0x519c82={'count':0x0,'rows':[]};var _0x53d9a2=_[_0x73a3('0x29')](db[_0x73a3('0x2a')]['rawAttributes'],function(_0x365966){return{'name':_0x365966[_0x73a3('0x2b')],'type':_0x365966[_0x73a3('0x2c')][_0x73a3('0x2d')]};});_0x121893['model']=_[_0x73a3('0x29')](_0x53d9a2,_0x73a3('0x26'));_0x121893[_0x73a3('0x2e')]=_['keys'](_0x22a135[_0x73a3('0x2e')]);_0x121893[_0x73a3('0x2f')]=_[_0x73a3('0x30')](_0x121893['model'],_0x121893['query']);_0x37c068[_0x73a3('0x31')]=_[_0x73a3('0x30')](_0x121893[_0x73a3('0x32')],qs[_0x73a3('0x33')](_0x22a135[_0x73a3('0x2e')][_0x73a3('0x33')]));_0x37c068[_0x73a3('0x31')]=_0x37c068[_0x73a3('0x31')][_0x73a3('0x34')]?_0x37c068[_0x73a3('0x31')]:_0x121893[_0x73a3('0x32')];if(!_0x22a135[_0x73a3('0x2e')][_0x73a3('0x35')](_0x73a3('0x36'))){_0x37c068['limit']=qs[_0x73a3('0x37')](_0x22a135[_0x73a3('0x2e')][_0x73a3('0x37')]);_0x37c068['offset']=qs[_0x73a3('0x1b')](_0x22a135['query'][_0x73a3('0x1b')]);}_0x37c068[_0x73a3('0x38')]=qs[_0x73a3('0x39')](_0x22a135['query']['sort']);_0x37c068[_0x73a3('0x3a')]=qs[_0x73a3('0x2f')](_[_0x73a3('0x3b')](_0x22a135[_0x73a3('0x2e')],_0x121893[_0x73a3('0x2f')]),_0x53d9a2);if(_0x22a135['query'][_0x73a3('0x3c')]){_0x37c068[_0x73a3('0x3a')]=_['merge'](_0x37c068[_0x73a3('0x3a')],{'$or':_[_0x73a3('0x29')](_0x53d9a2,function(_0x59f458){if(_0x59f458[_0x73a3('0x2c')]!==_0x73a3('0x3d')){var _0x56ffc0={};_0x56ffc0[_0x59f458[_0x73a3('0x26')]]={'$like':'%'+_0x22a135[_0x73a3('0x2e')][_0x73a3('0x3c')]+'%'};return _0x56ffc0;}})});}_0x37c068=_[_0x73a3('0x3e')]({},_0x37c068,_0x22a135[_0x73a3('0x3f')]);var _0xd5e10={'where':_0x37c068[_0x73a3('0x3a')]};return db[_0x73a3('0x2a')][_0x73a3('0x1a')](_0xd5e10)[_0x73a3('0x21')](function(_0x4473cd){_0x519c82[_0x73a3('0x1a')]=_0x4473cd;if(_0x22a135[_0x73a3('0x2e')]['includeAll']){_0x37c068[_0x73a3('0x40')]=[{'all':!![]}];}return db['MemberReport'][_0x73a3('0x41')](_0x37c068);})['then'](function(_0x259887){_0x519c82[_0x73a3('0x42')]=_0x259887;return _0x519c82;})[_0x73a3('0x21')](respondWithFilteredResult(_0x27e4e9,_0x37c068))['catch'](handleError(_0x27e4e9,null));};exports[_0x73a3('0x43')]=function(_0xfed712,_0x5d1a9e){var _0x46e789={'raw':!![],'where':{'id':_0xfed712['params']['id']}},_0x4ffebb={};_0x4ffebb[_0x73a3('0x32')]=_['keys'](db[_0x73a3('0x2a')][_0x73a3('0x44')]);_0x4ffebb[_0x73a3('0x2e')]=_[_0x73a3('0x45')](_0xfed712[_0x73a3('0x2e')]);_0x4ffebb[_0x73a3('0x2f')]=_[_0x73a3('0x30')](_0x4ffebb['model'],_0x4ffebb[_0x73a3('0x2e')]);_0x46e789['attributes']=_[_0x73a3('0x30')](_0x4ffebb['model'],qs[_0x73a3('0x33')](_0xfed712[_0x73a3('0x2e')][_0x73a3('0x33')]));_0x46e789[_0x73a3('0x31')]=_0x46e789['attributes'][_0x73a3('0x34')]?_0x46e789['attributes']:_0x4ffebb['model'];if(_0xfed712[_0x73a3('0x2e')][_0x73a3('0x46')]){_0x46e789[_0x73a3('0x40')]=[{'all':!![]}];}_0x46e789=_[_0x73a3('0x3e')]({},_0x46e789,_0xfed712['options']);return db['MemberReport']['find'](_0x46e789)[_0x73a3('0x21')](handleEntityNotFound(_0x5d1a9e,null))[_0x73a3('0x21')](respondWithResult(_0x5d1a9e,null))['catch'](handleError(_0x5d1a9e,null));};exports[_0x73a3('0x47')]=function(_0x4f1c35,_0x56980d){return db[_0x73a3('0x2a')]['create'](_0x4f1c35[_0x73a3('0x48')],{})[_0x73a3('0x21')](respondWithResult(_0x56980d,0xc9))[_0x73a3('0x49')](handleError(_0x56980d,null));};exports[_0x73a3('0x4a')]=function(_0x1df710,_0x1e8b0e){if(_0x1df710[_0x73a3('0x48')]['id']){delete _0x1df710[_0x73a3('0x48')]['id'];}return db[_0x73a3('0x2a')]['find']({'where':{'id':_0x1df710[_0x73a3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e8b0e,null))[_0x73a3('0x21')](saveUpdates(_0x1df710['body'],null))[_0x73a3('0x21')](respondWithResult(_0x1e8b0e,null))['catch'](handleError(_0x1e8b0e,null));};exports['destroy']=function(_0x2e1a24,_0x2b4d5e){return db[_0x73a3('0x2a')][_0x73a3('0x4c')]({'where':{'id':_0x2e1a24['params']['id']}})[_0x73a3('0x21')](handleEntityNotFound(_0x2b4d5e,null))['then'](removeEntity(_0x2b4d5e,null))['catch'](handleError(_0x2b4d5e,null));};exports[_0x73a3('0x4d')]=function(_0x5dc715,_0x162268){return db['MemberReport'][_0x73a3('0x4d')]()[_0x73a3('0x21')](respondWithResult(_0x162268,null))[_0x73a3('0x49')](handleError(_0x162268,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f81e2f4..c9d386f 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 _0xa51f=['rimraf','../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','membername','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x484278,_0x306bce){var _0x2dc343=function(_0x29bf1e){while(--_0x29bf1e){_0x484278['push'](_0x484278['shift']());}};_0x2dc343(++_0x306bce);}(_0xa51f,0x151));var _0xfa51=function(_0x3ec751,_0x3009cd){_0x3ec751=_0x3ec751-0x0;var _0x252150=_0xa51f[_0x3ec751];return _0x252150;};'use strict';var _=require(_0xfa51('0x0'));var util=require(_0xfa51('0x1'));var logger=require(_0xfa51('0x2'))(_0xfa51('0x3'));var moment=require(_0xfa51('0x4'));var BPromise=require(_0xfa51('0x5'));var rp=require(_0xfa51('0x6'));var fs=require('fs');var path=require(_0xfa51('0x7'));var rimraf=require(_0xfa51('0x8'));var config=require(_0xfa51('0x9'));var attributes=require(_0xfa51('0xa'));module[_0xfa51('0xb')]=function(_0x983ee3,_0x36ea0f){return _0x983ee3['define']('MemberReport',attributes,{'tableName':_0xfa51('0xc'),'paranoid':![],'indexes':[{'name':_0xfa51('0xd'),'fields':[_0xfa51('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c43=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','report_member','membername','interface'];(function(_0x13ca6d,_0x28f921){var _0x3e4ea8=function(_0xda15ed){while(--_0xda15ed){_0x13ca6d['push'](_0x13ca6d['shift']());}};_0x3e4ea8(++_0x28f921);}(_0x0c43,0xd2));var _0x30c4=function(_0x249d57,_0x471eda){_0x249d57=_0x249d57-0x0;var _0x51af30=_0x0c43[_0x249d57];return _0x51af30;};'use strict';var _=require(_0x30c4('0x0'));var util=require(_0x30c4('0x1'));var logger=require(_0x30c4('0x2'))(_0x30c4('0x3'));var moment=require(_0x30c4('0x4'));var BPromise=require(_0x30c4('0x5'));var rp=require(_0x30c4('0x6'));var fs=require('fs');var path=require(_0x30c4('0x7'));var rimraf=require(_0x30c4('0x8'));var config=require('../../config/environment');var attributes=require(_0x30c4('0x9'));module[_0x30c4('0xa')]=function(_0x1ed043,_0x164ffa){return _0x1ed043[_0x30c4('0xb')]('MemberReport',attributes,{'tableName':_0x30c4('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x30c4('0xd'),_0x30c4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5304fde..c552774 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 _0xfb9e=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','info','CreateMemberReport','body','raw','UpdateMemberReport'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xfb9e,0x90));var _0xefb9=function(_0x264ca3,_0x65b645){_0x264ca3=_0x264ca3-0x0;var _0x156d1e=_0xfb9e[_0x264ca3];return _0x156d1e;};'use strict';var _=require(_0xefb9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xefb9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefb9('0x2'));var db=require(_0xefb9('0x3'))['db'];var utils=require(_0xefb9('0x4'));var logger=require(_0xefb9('0x5'))(_0xefb9('0x6'));var config=require(_0xefb9('0x7'));var jayson=require(_0xefb9('0x8'));var client=jayson[_0xefb9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x495f2d,_0xdb0aaa,_0x36d4c7){return new BPromise(function(_0x24dd22,_0x2dc019){return client[_0xefb9('0xa')](_0x495f2d,_0x36d4c7)[_0xefb9('0xb')](function(_0x4ab8db){logger['info'](_0xefb9('0xc'),_0xdb0aaa,_0xefb9('0xd'));logger[_0xefb9('0xe')](_0xefb9('0xf'),_0xdb0aaa,_0xefb9('0xd'),JSON[_0xefb9('0x10')](_0x4ab8db));if(_0x4ab8db['error']){if(_0x4ab8db['error']['code']===0x1f4){logger[_0xefb9('0x11')](_0xefb9('0xc'),_0xdb0aaa,_0x4ab8db['error'][_0xefb9('0x12')]);return _0x2dc019(_0x4ab8db[_0xefb9('0x11')][_0xefb9('0x12')]);}logger[_0xefb9('0x11')]('MemberReport,\x20%s,\x20%s',_0xdb0aaa,_0x4ab8db['error'][_0xefb9('0x12')]);return _0x24dd22(_0x4ab8db[_0xefb9('0x11')]['message']);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xdb0aaa,_0xefb9('0xd'));_0x24dd22(_0x4ab8db[_0xefb9('0x13')][_0xefb9('0x12')]);}})[_0xefb9('0x14')](function(_0x5c568a){logger[_0xefb9('0x11')]('MemberReport,\x20%s,\x20%s',_0xdb0aaa,_0x5c568a);_0x2dc019(_0x5c568a);});});}exports[_0xefb9('0x15')]=function(_0x4c25c7){var _0x1f33ce=this;return new Promise(function(_0x5dc56d,_0x522c0d){return db[_0xefb9('0x16')][_0xefb9('0x17')]({'raw':_0x4c25c7[_0xefb9('0x18')]?_0x4c25c7[_0xefb9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c25c7[_0xefb9('0x18')]?_0x4c25c7[_0xefb9('0x18')][_0xefb9('0x19')]||null:null,'attributes':_0x4c25c7[_0xefb9('0x18')]?_0x4c25c7[_0xefb9('0x18')][_0xefb9('0x1a')]||null:null,'limit':_0x4c25c7[_0xefb9('0x18')]?_0x4c25c7[_0xefb9('0x18')][_0xefb9('0x1b')]||null:null,'include':_0x4c25c7[_0xefb9('0x18')]?_0x4c25c7[_0xefb9('0x18')][_0xefb9('0x1c')]?_[_0xefb9('0x1d')](_0x4c25c7[_0xefb9('0x18')]['include'],function(_0xfbb7b5){return{'model':db[_0xfbb7b5[_0xefb9('0x1e')]],'as':_0xfbb7b5['as'],'attributes':_0xfbb7b5[_0xefb9('0x1a')],'include':_0xfbb7b5[_0xefb9('0x1c')]?_[_0xefb9('0x1d')](_0xfbb7b5[_0xefb9('0x1c')],function(_0x538da3){return{'model':db[_0x538da3[_0xefb9('0x1e')]],'as':_0x538da3['as'],'attributes':_0x538da3[_0xefb9('0x1a')],'include':_0x538da3['include']?_[_0xefb9('0x1d')](_0x538da3[_0xefb9('0x1c')],function(_0x44e8d6){return{'model':db[_0x44e8d6['model']],'as':_0x44e8d6['as'],'attributes':_0x44e8d6[_0xefb9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xefb9('0xb')](function(_0x21cf7f){logger[_0xefb9('0x1f')]('GetMemberReport',_0x4c25c7);logger[_0xefb9('0xe')](_0xefb9('0x15'),_0x4c25c7,JSON['stringify'](_0x21cf7f));_0x5dc56d(_0x21cf7f);})['catch'](function(_0x4b70a4){logger[_0xefb9('0x11')](_0xefb9('0x15'),_0x4b70a4[_0xefb9('0x12')],_0x4c25c7);_0x522c0d(_0x1f33ce[_0xefb9('0x11')](0x1f4,_0x4b70a4[_0xefb9('0x12')]));});});};exports[_0xefb9('0x20')]=function(_0x1a6c86){var _0x8b5865=this;return new Promise(function(_0x44b4ec,_0x4dce21){return db['MemberReport']['create'](_0x1a6c86[_0xefb9('0x21')],{'raw':_0x1a6c86[_0xefb9('0x18')]?_0x1a6c86['options'][_0xefb9('0x22')]===undefined?!![]:![]:!![]})[_0xefb9('0xb')](function(_0x8cf925){logger[_0xefb9('0x1f')](_0xefb9('0x20'),_0x1a6c86);logger[_0xefb9('0xe')]('CreateMemberReport',_0x1a6c86,JSON[_0xefb9('0x10')](_0x8cf925));_0x44b4ec(_0x8cf925);})[_0xefb9('0x14')](function(_0x57546c){logger['error'](_0xefb9('0x20'),_0x57546c[_0xefb9('0x12')],_0x1a6c86);_0x4dce21(_0x8b5865[_0xefb9('0x11')](0x1f4,_0x57546c['message']));});});};exports[_0xefb9('0x23')]=function(_0x568018){var _0x2938c7=this;return new Promise(function(_0x3a998b,_0x6f5cea){return db['MemberReport']['update'](_0x568018[_0xefb9('0x21')],{'raw':_0x568018[_0xefb9('0x18')]?_0x568018[_0xefb9('0x18')][_0xefb9('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568018['options']?_0x568018[_0xefb9('0x18')][_0xefb9('0x19')]||null:null,'attributes':_0x568018[_0xefb9('0x18')]?_0x568018[_0xefb9('0x18')]['attributes']||null:null,'limit':_0x568018['options']?_0x568018[_0xefb9('0x18')][_0xefb9('0x1b')]||null:null})[_0xefb9('0xb')](function(_0x76039e){logger['info'](_0xefb9('0x23'),_0x568018);logger[_0xefb9('0xe')](_0xefb9('0x23'),_0x568018,JSON[_0xefb9('0x10')](_0x76039e));_0x3a998b(_0x76039e);})['catch'](function(_0x4c3bde){logger[_0xefb9('0x11')]('UpdateMemberReport',_0x4c3bde[_0xefb9('0x12')],_0x568018);_0x6f5cea(_0x2938c7['error'](0x1f4,_0x4c3bde[_0xefb9('0x12')]));});});}; \ No newline at end of file +var _0x7732=['code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','CreateMemberReport','create','UpdateMemberReport','update','body','where','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4f0e84,_0x311da0){var _0x42d53a=function(_0x152a18){while(--_0x152a18){_0x4f0e84['push'](_0x4f0e84['shift']());}};_0x42d53a(++_0x311da0);}(_0x7732,0x1cf));var _0x2773=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x7732[_0x2af29a];return _0x5ef02f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2773('0x0'));var rs=require(_0x2773('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2773('0x2'));var logger=require(_0x2773('0x3'))(_0x2773('0x4'));var config=require(_0x2773('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2773('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b3eb2,_0x3ce0be,_0x4af718){return new BPromise(function(_0x1bb321,_0x576890){return client['request'](_0x2b3eb2,_0x4af718)['then'](function(_0x587bab){logger[_0x2773('0x7')](_0x2773('0x8'),_0x3ce0be,_0x2773('0x9'));logger[_0x2773('0xa')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x3ce0be,'request\x20sent',JSON[_0x2773('0xb')](_0x587bab));if(_0x587bab[_0x2773('0xc')]){if(_0x587bab['error'][_0x2773('0xd')]===0x1f4){logger[_0x2773('0xc')](_0x2773('0x8'),_0x3ce0be,_0x587bab[_0x2773('0xc')][_0x2773('0xe')]);return _0x576890(_0x587bab[_0x2773('0xc')]['message']);}logger[_0x2773('0xc')](_0x2773('0x8'),_0x3ce0be,_0x587bab[_0x2773('0xc')]['message']);return _0x1bb321(_0x587bab[_0x2773('0xc')][_0x2773('0xe')]);}else{logger[_0x2773('0x7')](_0x2773('0x8'),_0x3ce0be,_0x2773('0x9'));_0x1bb321(_0x587bab[_0x2773('0xf')][_0x2773('0xe')]);}})[_0x2773('0x10')](function(_0xe4dbf2){logger[_0x2773('0xc')](_0x2773('0x8'),_0x3ce0be,_0xe4dbf2);_0x576890(_0xe4dbf2);});});}exports[_0x2773('0x11')]=function(_0x55a64e){var _0x52bf98=this;return new Promise(function(_0x430133,_0x2ac623){return db[_0x2773('0x12')][_0x2773('0x13')]({'raw':_0x55a64e['options']?_0x55a64e[_0x2773('0x14')][_0x2773('0x15')]===undefined?!![]:![]:!![],'where':_0x55a64e['options']?_0x55a64e[_0x2773('0x14')]['where']||null:null,'attributes':_0x55a64e[_0x2773('0x14')]?_0x55a64e['options'][_0x2773('0x16')]||null:null,'limit':_0x55a64e[_0x2773('0x14')]?_0x55a64e[_0x2773('0x14')][_0x2773('0x17')]||null:null,'include':_0x55a64e[_0x2773('0x14')]?_0x55a64e[_0x2773('0x14')][_0x2773('0x18')]?_[_0x2773('0x19')](_0x55a64e[_0x2773('0x14')]['include'],function(_0x21bd93){return{'model':db[_0x21bd93[_0x2773('0x1a')]],'as':_0x21bd93['as'],'attributes':_0x21bd93[_0x2773('0x16')],'include':_0x21bd93[_0x2773('0x18')]?_[_0x2773('0x19')](_0x21bd93['include'],function(_0x72f4e6){return{'model':db[_0x72f4e6['model']],'as':_0x72f4e6['as'],'attributes':_0x72f4e6['attributes'],'include':_0x72f4e6[_0x2773('0x18')]?_['map'](_0x72f4e6[_0x2773('0x18')],function(_0x21c7d0){return{'model':db[_0x21c7d0['model']],'as':_0x21c7d0['as'],'attributes':_0x21c7d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x2773('0x1b')](function(_0x373283){logger['info'](_0x2773('0x11'),_0x55a64e);logger['debug'](_0x2773('0x11'),_0x55a64e,JSON[_0x2773('0xb')](_0x373283));_0x430133(_0x373283);})[_0x2773('0x10')](function(_0x531886){logger[_0x2773('0xc')]('GetMemberReport',_0x531886[_0x2773('0xe')],_0x55a64e);_0x2ac623(_0x52bf98[_0x2773('0xc')](0x1f4,_0x531886[_0x2773('0xe')]));});});};exports[_0x2773('0x1c')]=function(_0x318752){var _0x2b285b=this;return new Promise(function(_0x344b55,_0x1491cc){return db[_0x2773('0x12')][_0x2773('0x1d')](_0x318752['body'],{'raw':_0x318752[_0x2773('0x14')]?_0x318752[_0x2773('0x14')][_0x2773('0x15')]===undefined?!![]:![]:!![]})[_0x2773('0x1b')](function(_0x5cdebe){logger[_0x2773('0x7')](_0x2773('0x1c'),_0x318752);logger[_0x2773('0xa')]('CreateMemberReport',_0x318752,JSON['stringify'](_0x5cdebe));_0x344b55(_0x5cdebe);})['catch'](function(_0x31048c){logger['error'](_0x2773('0x1c'),_0x31048c[_0x2773('0xe')],_0x318752);_0x1491cc(_0x2b285b[_0x2773('0xc')](0x1f4,_0x31048c[_0x2773('0xe')]));});});};exports[_0x2773('0x1e')]=function(_0x50fc18){var _0x27c2e5=this;return new Promise(function(_0x1b5386,_0x54b391){return db[_0x2773('0x12')][_0x2773('0x1f')](_0x50fc18[_0x2773('0x20')],{'raw':_0x50fc18['options']?_0x50fc18[_0x2773('0x14')][_0x2773('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50fc18['options']?_0x50fc18[_0x2773('0x14')][_0x2773('0x21')]||null:null,'attributes':_0x50fc18[_0x2773('0x14')]?_0x50fc18[_0x2773('0x14')][_0x2773('0x16')]||null:null,'limit':_0x50fc18[_0x2773('0x14')]?_0x50fc18[_0x2773('0x14')][_0x2773('0x17')]||null:null})[_0x2773('0x1b')](function(_0x4e5c56){logger[_0x2773('0x7')](_0x2773('0x1e'),_0x50fc18);logger[_0x2773('0xa')](_0x2773('0x1e'),_0x50fc18,JSON['stringify'](_0x4e5c56));_0x1b5386(_0x4e5c56);})['catch'](function(_0x10edd5){logger[_0x2773('0xc')](_0x2773('0x1e'),_0x10edd5[_0x2773('0xe')],_0x50fc18);_0x54b391(_0x27c2e5[_0x2773('0xc')](0x1f4,_0x10edd5['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f06924c..2650670 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 _0xd64b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','path','express'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0xd64b,0xc1));var _0xbd64=function(_0x4ee192,_0x1e8f15){_0x4ee192=_0x4ee192-0x0;var _0xe9538d=_0xd64b[_0x4ee192];return _0xe9538d;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var auth=require(_0xbd64('0x4'));var interaction=require(_0xbd64('0x5'));var config=require(_0xbd64('0x6'));var controller=require('./migration.controller');router['get']('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0xbdb7=['../../config/environment','get','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3935ff,_0x4e4a5e){var _0x3ac809=function(_0x2f1476){while(--_0x2f1476){_0x3935ff['push'](_0x3935ff['shift']());}};_0x3ac809(++_0x4e4a5e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1a6363,_0x205f25){_0x1a6363=_0x1a6363-0x0;var _0xd22157=_0xbdb7[_0x1a6363];return _0xd22157;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./migration.controller');router[_0x7bdb('0x9')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7ccd4fd..7cfa67b 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 _0xfa3e=['exports','STRING','version','sequelize'];(function(_0x3a7490,_0x265112){var _0x4209ab=function(_0x1e230c){while(--_0x1e230c){_0x3a7490['push'](_0x3a7490['shift']());}};_0x4209ab(++_0x265112);}(_0xfa3e,0x19f));var _0xefa3=function(_0xbc1511,_0x285e7a){_0xbc1511=_0xbc1511-0x0;var _0x58e9d6=_0xfa3e[_0xbc1511];return _0x58e9d6;};'use strict';var Sequelize=require(_0xefa3('0x0'));module[_0xefa3('0x1')]={'version':{'type':Sequelize[_0xefa3('0x2')],'unique':_0xefa3('0x3')}}; \ No newline at end of file +var _0xe961=['version','sequelize','exports','STRING'];(function(_0x202e3f,_0x4969a0){var _0x5af481=function(_0x5632a0){while(--_0x5632a0){_0x202e3f['push'](_0x202e3f['shift']());}};_0x5af481(++_0x4969a0);}(_0xe961,0x85));var _0x1e96=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xe961[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x1e96('0x0'));module[_0x1e96('0x1')]={'version':{'type':Sequelize[_0x1e96('0x2')],'unique':_0x1e96('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f9331c1..451478a 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 _0x94b6=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x13ace6,_0x27cab8){var _0x5b55c5=function(_0x16b011){while(--_0x16b011){_0x13ace6['push'](_0x13ace6['shift']());}};_0x5b55c5(++_0x27cab8);}(_0x94b6,0xb8));var _0x694b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x94b6[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0x694b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x694b('0x1'));var jsonpatch=require(_0x694b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x694b('0x3'));var Mustache=require(_0x694b('0x4'));var util=require(_0x694b('0x5'));var path=require(_0x694b('0x6'));var sox=require(_0x694b('0x7'));var csv=require(_0x694b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x694b('0x9'));var squel=require(_0x694b('0xa'));var crypto=require(_0x694b('0xb'));var jsforce=require(_0x694b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x694b('0x8'));var querystring=require(_0x694b('0xd'));var Papa=require('papaparse');var Redis=require(_0x694b('0xe'));var authService=require(_0x694b('0xf'));var qs=require(_0x694b('0x10'));var as=require(_0x694b('0x11'));var hardwareService=require(_0x694b('0x12'));var logger=require(_0x694b('0x13'))('api');var utils=require(_0x694b('0x14'));var config=require(_0x694b('0x15'));var licenseUtil=require(_0x694b('0x16'));var db=require(_0x694b('0x17'))['db'];function respondWithStatusCode(_0x30d759,_0x4a76ed){_0x4a76ed=_0x4a76ed||0xcc;return function(_0x187c9a){if(_0x187c9a){return _0x30d759['sendStatus'](_0x4a76ed);}return _0x30d759[_0x694b('0x18')](_0x4a76ed)[_0x694b('0x19')]();};}function respondWithResult(_0x58320b,_0x479362){_0x479362=_0x479362||0xc8;return function(_0x5f081f){if(_0x5f081f){return _0x58320b[_0x694b('0x18')](_0x479362)[_0x694b('0x1a')](_0x5f081f);}};}function respondWithFilteredResult(_0x1366b3,_0x5c35b7){return function(_0x19154f){if(_0x19154f){var _0x2c4500=_0x19154f[_0x694b('0x1b')],_0x2ad41e=_0x5c35b7[_0x694b('0x1c')],_0xab296=_0x5c35b7[_0x694b('0x1c')]+_0x5c35b7[_0x694b('0x1d')],_0x46976b;if(_0xab296>=_0x2c4500){_0xab296=_0x2c4500;_0x46976b=0xc8;}else{_0x46976b=0xce;}_0x1366b3[_0x694b('0x18')](_0x46976b);return _0x1366b3[_0x694b('0x1e')](_0x694b('0x1f'),_0x2ad41e+'-'+_0xab296+'/'+_0x2c4500)[_0x694b('0x1a')](_0x19154f);}return null;};}function patchUpdates(_0x479b4a){return function(_0x3164fc){try{jsonpatch['apply'](_0x3164fc,_0x479b4a,!![]);}catch(_0x5a1553){return BPromise[_0x694b('0x20')](_0x5a1553);}return _0x3164fc[_0x694b('0x21')]();};}function saveUpdates(_0x18a396,_0x252f23){return function(_0x2c1ed4){if(_0x2c1ed4){return _0x2c1ed4['update'](_0x18a396)[_0x694b('0x22')](function(_0x77c30){return _0x77c30;});}return null;};}function removeEntity(_0x4c80ad,_0x3a7222){return function(_0x4eb886){if(_0x4eb886){return _0x4eb886[_0x694b('0x23')]()[_0x694b('0x22')](function(){_0x4c80ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b41d5,_0x36fec7){return function(_0x5a5c9e){if(!_0x5a5c9e){_0x3b41d5[_0x694b('0x24')](0x194);}return _0x5a5c9e;};}function handleError(_0x24d86d,_0x578d6e){_0x578d6e=_0x578d6e||0x1f4;return function(_0x5321d7){logger[_0x694b('0x25')](_0x5321d7[_0x694b('0x26')]);if(_0x5321d7[_0x694b('0x27')]){delete _0x5321d7[_0x694b('0x27')];}_0x24d86d[_0x694b('0x18')](_0x578d6e)[_0x694b('0x28')](_0x5321d7);};}exports[_0x694b('0x29')]=function(_0x461ac8,_0x317184){var _0x5357ef={},_0x1ead3f={},_0x2f61ff={'count':0x0,'rows':[]};var _0xc91bf8=_[_0x694b('0x2a')](db[_0x694b('0x2b')][_0x694b('0x2c')],function(_0x6e920b){return{'name':_0x6e920b[_0x694b('0x2d')],'type':_0x6e920b['type'][_0x694b('0x2e')]};});_0x1ead3f[_0x694b('0x2f')]=_[_0x694b('0x2a')](_0xc91bf8,_0x694b('0x27'));_0x1ead3f[_0x694b('0x30')]=_[_0x694b('0x31')](_0x461ac8[_0x694b('0x30')]);_0x1ead3f['filters']=_[_0x694b('0x32')](_0x1ead3f[_0x694b('0x2f')],_0x1ead3f[_0x694b('0x30')]);_0x5357ef[_0x694b('0x33')]=_['intersection'](_0x1ead3f[_0x694b('0x2f')],qs[_0x694b('0x34')](_0x461ac8[_0x694b('0x30')][_0x694b('0x34')]));_0x5357ef[_0x694b('0x33')]=_0x5357ef['attributes'][_0x694b('0x35')]?_0x5357ef[_0x694b('0x33')]:_0x1ead3f[_0x694b('0x2f')];if(!_0x461ac8[_0x694b('0x30')][_0x694b('0x36')](_0x694b('0x37'))){_0x5357ef[_0x694b('0x1d')]=qs[_0x694b('0x1d')](_0x461ac8['query'][_0x694b('0x1d')]);_0x5357ef[_0x694b('0x1c')]=qs[_0x694b('0x1c')](_0x461ac8[_0x694b('0x30')][_0x694b('0x1c')]);}_0x5357ef['order']=qs[_0x694b('0x38')](_0x461ac8[_0x694b('0x30')][_0x694b('0x38')]);_0x5357ef['where']=qs[_0x694b('0x39')](_[_0x694b('0x3a')](_0x461ac8[_0x694b('0x30')],_0x1ead3f['filters']),_0xc91bf8);if(_0x461ac8[_0x694b('0x30')][_0x694b('0x3b')]){_0x5357ef[_0x694b('0x3c')]=_[_0x694b('0x3d')](_0x5357ef[_0x694b('0x3c')],{'$or':_[_0x694b('0x2a')](_0xc91bf8,function(_0x4f7733){if(_0x4f7733['type']!==_0x694b('0x3e')){var _0x5eaa19={};_0x5eaa19[_0x4f7733[_0x694b('0x27')]]={'$like':'%'+_0x461ac8[_0x694b('0x30')][_0x694b('0x3b')]+'%'};return _0x5eaa19;}})});}_0x5357ef=_[_0x694b('0x3d')]({},_0x5357ef,_0x461ac8[_0x694b('0x3f')]);var _0x35fb5d={'where':_0x5357ef[_0x694b('0x3c')]};return db[_0x694b('0x2b')][_0x694b('0x1b')](_0x35fb5d)[_0x694b('0x22')](function(_0x57eb91){_0x2f61ff[_0x694b('0x1b')]=_0x57eb91;if(_0x461ac8[_0x694b('0x30')][_0x694b('0x40')]){_0x5357ef[_0x694b('0x41')]=[{'all':!![]}];}return db[_0x694b('0x2b')]['findAll'](_0x5357ef);})[_0x694b('0x22')](function(_0x497d74){_0x2f61ff[_0x694b('0x42')]=_0x497d74;return _0x2f61ff;})[_0x694b('0x22')](respondWithFilteredResult(_0x317184,_0x5357ef))['catch'](handleError(_0x317184,null));}; \ No newline at end of file +var _0x0b2d=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Migration','includeAll','rows','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x602f8d,_0x45a593){var _0x78a427=function(_0x38961d){while(--_0x38961d){_0x602f8d['push'](_0x602f8d['shift']());}};_0x78a427(++_0x45a593);}(_0x0b2d,0x116));var _0xd0b2=function(_0xa92802,_0xa6ecec){_0xa92802=_0xa92802-0x0;var _0x56fdaa=_0x0b2d[_0xa92802];return _0x56fdaa;};'use strict';var pdf=require(_0xd0b2('0x0'));var emlformat=require(_0xd0b2('0x1'));var rimraf=require(_0xd0b2('0x2'));var zipdir=require(_0xd0b2('0x3'));var jsonpatch=require(_0xd0b2('0x4'));var rp=require(_0xd0b2('0x5'));var moment=require(_0xd0b2('0x6'));var BPromise=require(_0xd0b2('0x7'));var Mustache=require(_0xd0b2('0x8'));var util=require('util');var path=require(_0xd0b2('0x9'));var sox=require(_0xd0b2('0xa'));var csv=require(_0xd0b2('0xb'));var ejs=require(_0xd0b2('0xc'));var fs=require('fs');var _=require(_0xd0b2('0xd'));var squel=require('squel');var crypto=require(_0xd0b2('0xe'));var jsforce=require(_0xd0b2('0xf'));var deskjs=require(_0xd0b2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd0b2('0x11'));var Papa=require(_0xd0b2('0x12'));var Redis=require(_0xd0b2('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd0b2('0x14'));var hardwareService=require(_0xd0b2('0x15'));var logger=require(_0xd0b2('0x16'))(_0xd0b2('0x17'));var utils=require('../../config/utils');var config=require(_0xd0b2('0x18'));var licenseUtil=require(_0xd0b2('0x19'));var db=require(_0xd0b2('0x1a'))['db'];function respondWithStatusCode(_0x18878b,_0x11559b){_0x11559b=_0x11559b||0xcc;return function(_0x12b353){if(_0x12b353){return _0x18878b[_0xd0b2('0x1b')](_0x11559b);}return _0x18878b[_0xd0b2('0x1c')](_0x11559b)[_0xd0b2('0x1d')]();};}function respondWithResult(_0x4db69a,_0x1559bf){_0x1559bf=_0x1559bf||0xc8;return function(_0x278d29){if(_0x278d29){return _0x4db69a[_0xd0b2('0x1c')](_0x1559bf)[_0xd0b2('0x1e')](_0x278d29);}};}function respondWithFilteredResult(_0x40d926,_0x2846af){return function(_0x1e665d){if(_0x1e665d){var _0x58b4bf=_0x1e665d[_0xd0b2('0x1f')],_0x2d352a=_0x2846af[_0xd0b2('0x20')],_0x59899d=_0x2846af[_0xd0b2('0x20')]+_0x2846af[_0xd0b2('0x21')],_0x2a6e34;if(_0x59899d>=_0x58b4bf){_0x59899d=_0x58b4bf;_0x2a6e34=0xc8;}else{_0x2a6e34=0xce;}_0x40d926[_0xd0b2('0x1c')](_0x2a6e34);return _0x40d926['set'](_0xd0b2('0x22'),_0x2d352a+'-'+_0x59899d+'/'+_0x58b4bf)['json'](_0x1e665d);}return null;};}function patchUpdates(_0x157bf4){return function(_0x44758c){try{jsonpatch[_0xd0b2('0x23')](_0x44758c,_0x157bf4,!![]);}catch(_0x5db49e){return BPromise[_0xd0b2('0x24')](_0x5db49e);}return _0x44758c[_0xd0b2('0x25')]();};}function saveUpdates(_0x12eddb,_0x41d387){return function(_0x5b4e1e){if(_0x5b4e1e){return _0x5b4e1e[_0xd0b2('0x26')](_0x12eddb)[_0xd0b2('0x27')](function(_0x54860c){return _0x54860c;});}return null;};}function removeEntity(_0x40a62c,_0x88a945){return function(_0x47306c){if(_0x47306c){return _0x47306c[_0xd0b2('0x28')]()[_0xd0b2('0x27')](function(){_0x40a62c[_0xd0b2('0x1c')](0xcc)[_0xd0b2('0x1d')]();});}};}function handleEntityNotFound(_0x1bdab4,_0x170ab7){return function(_0xf2a82){if(!_0xf2a82){_0x1bdab4[_0xd0b2('0x1b')](0x194);}return _0xf2a82;};}function handleError(_0x400f93,_0x4a7217){_0x4a7217=_0x4a7217||0x1f4;return function(_0xf7eb86){logger[_0xd0b2('0x29')](_0xf7eb86['stack']);if(_0xf7eb86[_0xd0b2('0x2a')]){delete _0xf7eb86[_0xd0b2('0x2a')];}_0x400f93[_0xd0b2('0x1c')](_0x4a7217)[_0xd0b2('0x2b')](_0xf7eb86);};}exports[_0xd0b2('0x2c')]=function(_0x2410fb,_0x12128f){var _0x2c1be0={},_0x314539={},_0x58cc07={'count':0x0,'rows':[]};var _0x4c4589=_[_0xd0b2('0x2d')](db['Migration'][_0xd0b2('0x2e')],function(_0x4200e1){return{'name':_0x4200e1[_0xd0b2('0x2f')],'type':_0x4200e1[_0xd0b2('0x30')][_0xd0b2('0x31')]};});_0x314539[_0xd0b2('0x32')]=_[_0xd0b2('0x2d')](_0x4c4589,_0xd0b2('0x2a'));_0x314539[_0xd0b2('0x33')]=_[_0xd0b2('0x34')](_0x2410fb[_0xd0b2('0x33')]);_0x314539[_0xd0b2('0x35')]=_[_0xd0b2('0x36')](_0x314539[_0xd0b2('0x32')],_0x314539[_0xd0b2('0x33')]);_0x2c1be0[_0xd0b2('0x37')]=_[_0xd0b2('0x36')](_0x314539[_0xd0b2('0x32')],qs['fields'](_0x2410fb['query'][_0xd0b2('0x38')]));_0x2c1be0[_0xd0b2('0x37')]=_0x2c1be0[_0xd0b2('0x37')][_0xd0b2('0x39')]?_0x2c1be0[_0xd0b2('0x37')]:_0x314539[_0xd0b2('0x32')];if(!_0x2410fb[_0xd0b2('0x33')][_0xd0b2('0x3a')](_0xd0b2('0x3b'))){_0x2c1be0[_0xd0b2('0x21')]=qs[_0xd0b2('0x21')](_0x2410fb[_0xd0b2('0x33')]['limit']);_0x2c1be0['offset']=qs[_0xd0b2('0x20')](_0x2410fb['query'][_0xd0b2('0x20')]);}_0x2c1be0[_0xd0b2('0x3c')]=qs[_0xd0b2('0x3d')](_0x2410fb[_0xd0b2('0x33')][_0xd0b2('0x3d')]);_0x2c1be0[_0xd0b2('0x3e')]=qs['filters'](_[_0xd0b2('0x3f')](_0x2410fb[_0xd0b2('0x33')],_0x314539[_0xd0b2('0x35')]),_0x4c4589);if(_0x2410fb['query']['filter']){_0x2c1be0[_0xd0b2('0x3e')]=_['merge'](_0x2c1be0[_0xd0b2('0x3e')],{'$or':_['map'](_0x4c4589,function(_0x52860b){if(_0x52860b[_0xd0b2('0x30')]!==_0xd0b2('0x40')){var _0x5e051c={};_0x5e051c[_0x52860b[_0xd0b2('0x2a')]]={'$like':'%'+_0x2410fb['query'][_0xd0b2('0x41')]+'%'};return _0x5e051c;}})});}_0x2c1be0=_[_0xd0b2('0x42')]({},_0x2c1be0,_0x2410fb[_0xd0b2('0x43')]);var _0x239069={'where':_0x2c1be0['where']};return db[_0xd0b2('0x44')][_0xd0b2('0x1f')](_0x239069)[_0xd0b2('0x27')](function(_0x23588e){_0x58cc07[_0xd0b2('0x1f')]=_0x23588e;if(_0x2410fb[_0xd0b2('0x33')][_0xd0b2('0x45')]){_0x2c1be0['include']=[{'all':!![]}];}return db['Migration']['findAll'](_0x2c1be0);})[_0xd0b2('0x27')](function(_0x5a410d){_0x58cc07[_0xd0b2('0x46')]=_0x5a410d;return _0x58cc07;})[_0xd0b2('0x27')](respondWithFilteredResult(_0x12128f,_0x2c1be0))['catch'](handleError(_0x12128f,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a6f8a2c..f568dab 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 _0xe435=['api','moment','bluebird','path','rimraf','../../config/environment','define','Migration','migrations','lodash','../../config/logger'];(function(_0x338fa1,_0x1b4845){var _0x5bb839=function(_0x5e9c33){while(--_0x5e9c33){_0x338fa1['push'](_0x338fa1['shift']());}};_0x5bb839(++_0x1b4845);}(_0xe435,0xcf));var _0x5e43=function(_0x2319cb,_0x4cda03){_0x2319cb=_0x2319cb-0x0;var _0x5dec8e=_0xe435[_0x2319cb];return _0x5dec8e;};'use strict';var _=require(_0x5e43('0x0'));var util=require('util');var logger=require(_0x5e43('0x1'))(_0x5e43('0x2'));var moment=require(_0x5e43('0x3'));var BPromise=require(_0x5e43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e43('0x5'));var rimraf=require(_0x5e43('0x6'));var config=require(_0x5e43('0x7'));var attributes=require('./migration.attributes');module['exports']=function(_0x31ba0d,_0x4df9ec){return _0x31ba0d[_0x5e43('0x8')](_0x5e43('0x9'),attributes,{'tableName':_0x5e43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d1a=['api','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger'];(function(_0x14cd46,_0x43bda5){var _0x153848=function(_0x33dfef){while(--_0x33dfef){_0x14cd46['push'](_0x14cd46['shift']());}};_0x153848(++_0x43bda5);}(_0x3d1a,0x1a1));var _0xa3d1=function(_0x29fc45,_0x1d010b){_0x29fc45=_0x29fc45-0x0;var _0x512a89=_0x3d1a[_0x29fc45];return _0x512a89;};'use strict';var _=require(_0xa3d1('0x0'));var util=require(_0xa3d1('0x1'));var logger=require(_0xa3d1('0x2'))(_0xa3d1('0x3'));var moment=require('moment');var BPromise=require(_0xa3d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3d1('0x5'));var rimraf=require(_0xa3d1('0x6'));var config=require(_0xa3d1('0x7'));var attributes=require(_0xa3d1('0x8'));module[_0xa3d1('0x9')]=function(_0x4e3dea,_0x35e715){return _0x4e3dea['define'](_0xa3d1('0xa'),attributes,{'tableName':_0xa3d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 34f0db8..252e9c5 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 _0xe20c=['ioredis','../../config/logger','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring'];(function(_0x24029b,_0x419fe0){var _0x30f91c=function(_0x1567aa){while(--_0x1567aa){_0x24029b['push'](_0x24029b['shift']());}};_0x30f91c(++_0x419fe0);}(_0xe20c,0x9f));var _0xce20=function(_0x205382,_0x3ea16c){_0x205382=_0x205382-0x0;var _0x2a45e3=_0xe20c[_0x205382];return _0x2a45e3;};'use strict';var _=require(_0xce20('0x0'));var util=require('util');var moment=require(_0xce20('0x1'));var BPromise=require('bluebird');var rs=require(_0xce20('0x2'));var fs=require('fs');var Redis=require(_0xce20('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce20('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xce20('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x115fae,_0x5febc9,_0x24b640){return new BPromise(function(_0x613f1,_0x1f76cf){return client[_0xce20('0x6')](_0x115fae,_0x24b640)[_0xce20('0x7')](function(_0x36fcb3){logger[_0xce20('0x8')](_0xce20('0x9'),_0x5febc9,_0xce20('0xa'));logger[_0xce20('0xb')](_0xce20('0xc'),_0x5febc9,'request\x20sent',JSON[_0xce20('0xd')](_0x36fcb3));if(_0x36fcb3[_0xce20('0xe')]){if(_0x36fcb3[_0xce20('0xe')][_0xce20('0xf')]===0x1f4){logger[_0xce20('0xe')](_0xce20('0x9'),_0x5febc9,_0x36fcb3[_0xce20('0xe')]['message']);return _0x1f76cf(_0x36fcb3[_0xce20('0xe')][_0xce20('0x10')]);}logger[_0xce20('0xe')](_0xce20('0x9'),_0x5febc9,_0x36fcb3[_0xce20('0xe')][_0xce20('0x10')]);return _0x613f1(_0x36fcb3[_0xce20('0xe')][_0xce20('0x10')]);}else{logger[_0xce20('0x8')](_0xce20('0x9'),_0x5febc9,_0xce20('0xa'));_0x613f1(_0x36fcb3[_0xce20('0x11')][_0xce20('0x10')]);}})['catch'](function(_0x51c499){logger[_0xce20('0xe')]('Migration,\x20%s,\x20%s',_0x5febc9,_0x51c499);_0x1f76cf(_0x51c499);});});} \ No newline at end of file +var _0x9137=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x54eddb,_0x5c27e0){var _0x12002b=function(_0x127559){while(--_0x127559){_0x54eddb['push'](_0x54eddb['shift']());}};_0x12002b(++_0x5c27e0);}(_0x9137,0x7b));var _0x7913=function(_0x4adce1,_0x41d240){_0x4adce1=_0x4adce1-0x0;var _0x9110fa=_0x9137[_0x4adce1];return _0x9110fa;};'use strict';var _=require(_0x7913('0x0'));var util=require(_0x7913('0x1'));var moment=require(_0x7913('0x2'));var BPromise=require(_0x7913('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7913('0x4'));var db=require(_0x7913('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7913('0x6'))(_0x7913('0x7'));var config=require('../../config/environment');var jayson=require(_0x7913('0x8'));var client=jayson[_0x7913('0x9')][_0x7913('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e99c,_0x1226f2,_0x37f46b){return new BPromise(function(_0x479929,_0x38abbe){return client[_0x7913('0xb')](_0x45e99c,_0x37f46b)[_0x7913('0xc')](function(_0x52b5ef){logger[_0x7913('0xd')](_0x7913('0xe'),_0x1226f2,_0x7913('0xf'));logger['debug'](_0x7913('0x10'),_0x1226f2,'request\x20sent',JSON[_0x7913('0x11')](_0x52b5ef));if(_0x52b5ef['error']){if(_0x52b5ef[_0x7913('0x12')][_0x7913('0x13')]===0x1f4){logger['error'](_0x7913('0xe'),_0x1226f2,_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);return _0x38abbe(_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);}logger[_0x7913('0x12')](_0x7913('0xe'),_0x1226f2,_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);return _0x479929(_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);}else{logger[_0x7913('0xd')]('Migration,\x20%s,\x20%s',_0x1226f2,_0x7913('0xf'));_0x479929(_0x52b5ef[_0x7913('0x15')][_0x7913('0x14')]);}})[_0x7913('0x16')](function(_0x1ef8ca){logger[_0x7913('0x12')](_0x7913('0xe'),_0x1226f2,_0x1ef8ca);_0x38abbe(_0x1ef8ca);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 99d26d6..5fe774d 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 _0x739c=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x739c,0x1c4));var _0xc739=function(_0x92aef1,_0x38ab31){_0x92aef1=_0x92aef1-0x0;var _0x928a4c=_0x739c[_0x92aef1];return _0x928a4c;};'use strict';var multer=require(_0xc739('0x0'));var util=require(_0xc739('0x1'));var path=require(_0xc739('0x2'));var timeout=require(_0xc739('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc739('0x4'));var interaction=require(_0xc739('0x5'));var config=require(_0xc739('0x6'));var controller=require(_0xc739('0x7'));router[_0xc739('0x8')]('/',auth[_0xc739('0x9')](),controller[_0xc739('0xa')]);router['get'](_0xc739('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc739('0xc')]('/',auth['isAuthenticated'](),controller[_0xc739('0xd')]);router[_0xc739('0xe')]('/:id',auth[_0xc739('0x9')](),controller[_0xc739('0xf')]);router['delete'](_0xc739('0xb'),auth[_0xc739('0x9')](),controller[_0xc739('0x10')]);module[_0xc739('0x11')]=router; \ No newline at end of file +var _0x96e8=['isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x17d133,_0x3aebc5){var _0xf4f7a2=function(_0x30277d){while(--_0x30277d){_0x17d133['push'](_0x17d133['shift']());}};_0xf4f7a2(++_0x3aebc5);}(_0x96e8,0x99));var _0x896e=function(_0x52d6d7,_0xe2f108){_0x52d6d7=_0x52d6d7-0x0;var _0x479d30=_0x96e8[_0x52d6d7];return _0x479d30;};'use strict';var multer=require(_0x896e('0x0'));var util=require(_0x896e('0x1'));var path=require(_0x896e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x896e('0x3')]();var auth=require(_0x896e('0x4'));var interaction=require(_0x896e('0x5'));var config=require(_0x896e('0x6'));var controller=require(_0x896e('0x7'));router[_0x896e('0x8')]('/',auth[_0x896e('0x9')](),controller[_0x896e('0xa')]);router['get'](_0x896e('0xb'),auth[_0x896e('0x9')](),controller[_0x896e('0xc')]);router['post']('/',auth[_0x896e('0x9')](),controller[_0x896e('0xd')]);router[_0x896e('0xe')](_0x896e('0xb'),auth[_0x896e('0x9')](),controller[_0x896e('0xf')]);router['delete'](_0x896e('0xb'),auth[_0x896e('0x9')](),controller[_0x896e('0x10')]);module[_0x896e('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0132a9c..668db68 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(_0x8d90ed,_0x2629f0){var _0x2b8f32=function(_0x65e3b){while(--_0x65e3b){_0x8d90ed['push'](_0x8d90ed['shift']());}};_0x2b8f32(++_0x2629f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x544e98,_0x4737f4){var _0x4b5726=function(_0x4a7654){while(--_0x4a7654){_0x544e98['push'](_0x544e98['shift']());}};_0x4b5726(++_0x4737f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 fb98dd5..bb44d3a 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 _0xda20=['model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','options','includeAll','include','rows','show','params','merge','create','sequelize','transaction','body','findAll','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','/etc/asterisk/turn_xcally.conf','chan_sip.so','destroy','find','TURN','html-pdf','rimraf','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','stack','name','send','index','map','Network','rawAttributes','type','key'];(function(_0x5b7428,_0xfb032){var _0x1bb14b=function(_0x192ccd){while(--_0x192ccd){_0x5b7428['push'](_0x5b7428['shift']());}};_0x1bb14b(++_0xfb032);}(_0xda20,0x1d9));var _0x0da2=function(_0x1c52a5,_0x58673f){_0x1c52a5=_0x1c52a5-0x0;var _0x34a8cc=_0xda20[_0x1c52a5];return _0x34a8cc;};'use strict';var pdf=require(_0x0da2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0da2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0da2('0x2'));var moment=require('moment');var BPromise=require(_0x0da2('0x3'));var Mustache=require(_0x0da2('0x4'));var util=require('util');var path=require(_0x0da2('0x5'));var sox=require(_0x0da2('0x6'));var csv=require('to-csv');var ejs=require(_0x0da2('0x7'));var fs=require('fs');var _=require(_0x0da2('0x8'));var squel=require(_0x0da2('0x9'));var crypto=require(_0x0da2('0xa'));var jsforce=require(_0x0da2('0xb'));var deskjs=require(_0x0da2('0xc'));var toCsv=require(_0x0da2('0xd'));var querystring=require(_0x0da2('0xe'));var Papa=require(_0x0da2('0xf'));var Redis=require('ioredis');var authService=require(_0x0da2('0x10'));var qs=require(_0x0da2('0x11'));var as=require(_0x0da2('0x12'));var hardwareService=require(_0x0da2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0da2('0x14'));var config=require(_0x0da2('0x15'));var licenseUtil=require(_0x0da2('0x16'));var db=require(_0x0da2('0x17'))['db'];var jayson=require(_0x0da2('0x18'));var client=jayson[_0x0da2('0x19')][_0x0da2('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4d2a3d,_0x7dfc07,_0x570d68,_0x5496f5){return new BPromise(function(_0x4cc28c,_0x2289c2){var _0x51bb68=_0x5496f5||client;return _0x51bb68[_0x0da2('0x1b')](_0x4d2a3d,_0x570d68)[_0x0da2('0x1c')](function(_0x5d0f4e){logger[_0x0da2('0x1d')](_0x0da2('0x1e'),_0x7dfc07,'request\x20sent');logger[_0x0da2('0x1f')](_0x0da2('0x20'),_0x7dfc07,_0x0da2('0x21'),JSON['stringify'](_0x5d0f4e));if(_0x5d0f4e[_0x0da2('0x22')]){if(_0x5d0f4e[_0x0da2('0x22')]['code']===0x1f4){logger['error'](_0x0da2('0x1e'),_0x7dfc07,_0x5d0f4e['error'][_0x0da2('0x23')]);return _0x2289c2(_0x5d0f4e['error']['message']);}logger['error']('Network,\x20%s,\x20%s',_0x7dfc07,_0x5d0f4e[_0x0da2('0x22')][_0x0da2('0x23')]);return _0x4cc28c(_0x5d0f4e[_0x0da2('0x22')]['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x7dfc07,_0x0da2('0x21'));_0x4cc28c(_0x5d0f4e[_0x0da2('0x24')][_0x0da2('0x23')]);}})[_0x0da2('0x25')](function(_0x262630){logger['error'](_0x0da2('0x1e'),_0x7dfc07,_0x262630);_0x2289c2(_0x262630);});});}function respondWithStatusCode(_0x113c40,_0x1c3ab0){_0x1c3ab0=_0x1c3ab0||0xcc;return function(_0x3c3dbc){if(_0x3c3dbc){return _0x113c40[_0x0da2('0x26')](_0x1c3ab0);}return _0x113c40[_0x0da2('0x27')](_0x1c3ab0)[_0x0da2('0x28')]();};}function respondWithResult(_0x7c4de3,_0x3604d3){_0x3604d3=_0x3604d3||0xc8;return function(_0x484543){if(_0x484543){return _0x7c4de3[_0x0da2('0x27')](_0x3604d3)['json'](_0x484543);}};}function respondWithFilteredResult(_0x40fc6a,_0x437090){return function(_0x2aa651){if(_0x2aa651){var _0x3c0fb0=_0x2aa651[_0x0da2('0x29')],_0x4b9333=_0x437090[_0x0da2('0x2a')],_0x1e9ac4=_0x437090[_0x0da2('0x2a')]+_0x437090['limit'],_0x2a931d;if(_0x1e9ac4>=_0x3c0fb0){_0x1e9ac4=_0x3c0fb0;_0x2a931d=0xc8;}else{_0x2a931d=0xce;}_0x40fc6a[_0x0da2('0x27')](_0x2a931d);return _0x40fc6a['set'](_0x0da2('0x2b'),_0x4b9333+'-'+_0x1e9ac4+'/'+_0x3c0fb0)[_0x0da2('0x2c')](_0x2aa651);}return null;};}function patchUpdates(_0x19058e){return function(_0x3a2625){try{jsonpatch[_0x0da2('0x2d')](_0x3a2625,_0x19058e,!![]);}catch(_0x103857){return BPromise[_0x0da2('0x2e')](_0x103857);}return _0x3a2625[_0x0da2('0x2f')]();};}function saveUpdates(_0x1f2b6f,_0x20d591){return function(_0x3981a5){if(_0x3981a5){return _0x3981a5['update'](_0x1f2b6f)['then'](function(_0x51a83e){return _0x51a83e;});}return null;};}function removeEntity(_0x94accb,_0x45d53d){return function(_0x54eda5){if(_0x54eda5){return _0x54eda5['destroy']()[_0x0da2('0x1c')](function(){_0x94accb[_0x0da2('0x27')](0xcc)[_0x0da2('0x28')]();});}};}function handleEntityNotFound(_0x1e6a75,_0x516e63){return function(_0x58b9ea){if(!_0x58b9ea){_0x1e6a75['sendStatus'](0x194);}return _0x58b9ea;};}function handleError(_0x281829,_0x5fccd){_0x5fccd=_0x5fccd||0x1f4;return function(_0x339d33){logger[_0x0da2('0x22')](_0x339d33[_0x0da2('0x30')]);if(_0x339d33[_0x0da2('0x31')]){delete _0x339d33[_0x0da2('0x31')];}_0x281829['status'](_0x5fccd)[_0x0da2('0x32')](_0x339d33);};}exports[_0x0da2('0x33')]=function(_0x41cd52,_0xbef5da){var _0x2cfddc={},_0x1b3c60={},_0x540c8f={'count':0x0,'rows':[]};var _0x408b21=_[_0x0da2('0x34')](db[_0x0da2('0x35')][_0x0da2('0x36')],function(_0x578299){return{'name':_0x578299['fieldName'],'type':_0x578299[_0x0da2('0x37')][_0x0da2('0x38')]};});_0x1b3c60[_0x0da2('0x39')]=_[_0x0da2('0x34')](_0x408b21,_0x0da2('0x31'));_0x1b3c60[_0x0da2('0x3a')]=_[_0x0da2('0x3b')](_0x41cd52[_0x0da2('0x3a')]);_0x1b3c60[_0x0da2('0x3c')]=_['intersection'](_0x1b3c60[_0x0da2('0x39')],_0x1b3c60[_0x0da2('0x3a')]);_0x2cfddc[_0x0da2('0x3d')]=_[_0x0da2('0x3e')](_0x1b3c60[_0x0da2('0x39')],qs[_0x0da2('0x3f')](_0x41cd52[_0x0da2('0x3a')][_0x0da2('0x3f')]));_0x2cfddc['attributes']=_0x2cfddc[_0x0da2('0x3d')]['length']?_0x2cfddc['attributes']:_0x1b3c60[_0x0da2('0x39')];if(!_0x41cd52['query'][_0x0da2('0x40')](_0x0da2('0x41'))){_0x2cfddc[_0x0da2('0x42')]=qs[_0x0da2('0x42')](_0x41cd52['query'][_0x0da2('0x42')]);_0x2cfddc[_0x0da2('0x2a')]=qs[_0x0da2('0x2a')](_0x41cd52[_0x0da2('0x3a')][_0x0da2('0x2a')]);}_0x2cfddc[_0x0da2('0x43')]=qs[_0x0da2('0x44')](_0x41cd52[_0x0da2('0x3a')]['sort']);_0x2cfddc['where']=qs[_0x0da2('0x3c')](_['pick'](_0x41cd52[_0x0da2('0x3a')],_0x1b3c60['filters']),_0x408b21);if(_0x41cd52[_0x0da2('0x3a')]['filter']){_0x2cfddc['where']=_['merge'](_0x2cfddc[_0x0da2('0x45')],{'$or':_[_0x0da2('0x34')](_0x408b21,function(_0x11ade3){if(_0x11ade3[_0x0da2('0x37')]!=='VIRTUAL'){var _0x10ffdc={};_0x10ffdc[_0x11ade3['name']]={'$like':'%'+_0x41cd52[_0x0da2('0x3a')][_0x0da2('0x46')]+'%'};return _0x10ffdc;}})});}_0x2cfddc=_['merge']({},_0x2cfddc,_0x41cd52[_0x0da2('0x47')]);var _0x2dd376={'where':_0x2cfddc[_0x0da2('0x45')]};return db[_0x0da2('0x35')]['count'](_0x2dd376)[_0x0da2('0x1c')](function(_0x3b0e28){_0x540c8f['count']=_0x3b0e28;if(_0x41cd52[_0x0da2('0x3a')][_0x0da2('0x48')]){_0x2cfddc[_0x0da2('0x49')]=[{'all':!![]}];}return db[_0x0da2('0x35')]['findAll'](_0x2cfddc);})[_0x0da2('0x1c')](function(_0x5265f2){_0x540c8f[_0x0da2('0x4a')]=_0x5265f2;return _0x540c8f;})[_0x0da2('0x1c')](respondWithFilteredResult(_0xbef5da,_0x2cfddc))[_0x0da2('0x25')](handleError(_0xbef5da,null));};exports[_0x0da2('0x4b')]=function(_0x2e36c6,_0x520804){var _0x37ace0={'raw':!![],'where':{'id':_0x2e36c6[_0x0da2('0x4c')]['id']}},_0xbdcb74={};_0xbdcb74[_0x0da2('0x39')]=_['keys'](db[_0x0da2('0x35')][_0x0da2('0x36')]);_0xbdcb74[_0x0da2('0x3a')]=_[_0x0da2('0x3b')](_0x2e36c6[_0x0da2('0x3a')]);_0xbdcb74['filters']=_[_0x0da2('0x3e')](_0xbdcb74[_0x0da2('0x39')],_0xbdcb74[_0x0da2('0x3a')]);_0x37ace0[_0x0da2('0x3d')]=_[_0x0da2('0x3e')](_0xbdcb74[_0x0da2('0x39')],qs[_0x0da2('0x3f')](_0x2e36c6['query'][_0x0da2('0x3f')]));_0x37ace0['attributes']=_0x37ace0['attributes']['length']?_0x37ace0[_0x0da2('0x3d')]:_0xbdcb74[_0x0da2('0x39')];if(_0x2e36c6[_0x0da2('0x3a')][_0x0da2('0x48')]){_0x37ace0['include']=[{'all':!![]}];}_0x37ace0=_[_0x0da2('0x4d')]({},_0x37ace0,_0x2e36c6['options']);return db['Network']['find'](_0x37ace0)[_0x0da2('0x1c')](handleEntityNotFound(_0x520804,null))[_0x0da2('0x1c')](respondWithResult(_0x520804,null))[_0x0da2('0x25')](handleError(_0x520804,null));};exports[_0x0da2('0x4e')]=function(_0x4efcc1,_0xe1000e,_0x42dcd9){var _0x3a0d6f;return db[_0x0da2('0x4f')][_0x0da2('0x50')](function(_0x1cf2ff){return db[_0x0da2('0x35')]['create'](_0x4efcc1[_0x0da2('0x51')],{'raw':!![]})[_0x0da2('0x1c')](function(_0x3e5425){_0x3a0d6f=_0x3e5425;return db[_0x0da2('0x35')][_0x0da2('0x52')]({'where':{'type':_0x4efcc1['body']['type']},'raw':!![]});})[_0x0da2('0x1c')](function(_0x34f672){if(_0x3a0d6f['type']['toUpperCase']()==_0x0da2('0x53')){var _0x2e6353=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config[_0x0da2('0x56')],_0x0da2('0x57')),_0x0da2('0x58'));var _0x3ee485=ejs[_0x0da2('0x59')](_0x2e6353,{'networks':_0x34f672||[]});fs[_0x0da2('0x5a')](_0x0da2('0x5b'),_0x3ee485);return respondWithRpcPromise(_0x0da2('0x5c'),_0x0da2('0x4e'),{'module':_0x0da2('0x5d')});}else if(_0x3a0d6f['type'][_0x0da2('0x5e')]()=='TURN'){var _0x47abf2=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config[_0x0da2('0x56')],_0x0da2('0x5f')),_0x0da2('0x58'));var _0x282352=ejs[_0x0da2('0x59')](_0x47abf2,{'networks':_0x34f672||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x282352);return respondWithRpcPromise(_0x0da2('0x5c'),'create',{'module':'res_stun_monitor.so'});}else{var _0x3dd02f=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config[_0x0da2('0x56')],_0x0da2('0x60')),_0x0da2('0x58'));var _0x571728=ejs[_0x0da2('0x59')](_0x3dd02f,{'networks':_0x34f672||[]});fs[_0x0da2('0x5a')](util[_0x0da2('0x61')](_0x0da2('0x62'),_0x4efcc1['body'][_0x0da2('0x37')][_0x0da2('0x63')]()),_0x571728);return respondWithRpcPromise('Reload',_0x0da2('0x4e'),{'module':'chan_sip.so'});}return null;})[_0x0da2('0x1c')](function(){return _0x3a0d6f;});})[_0x0da2('0x1c')](respondWithResult(_0xe1000e,0xc9))[_0x0da2('0x25')](handleError(_0xe1000e,null));};exports[_0x0da2('0x64')]=function(_0x31910d,_0x26dd55,_0x5c1840){var _0x4c8800;return db['sequelize'][_0x0da2('0x50')](function(_0x3313b2){return db[_0x0da2('0x35')]['find']({'where':{'id':_0x31910d['params']['id']}})[_0x0da2('0x1c')](handleEntityNotFound(_0x26dd55,null))['then'](saveUpdates(_0x31910d[_0x0da2('0x51')],null))[_0x0da2('0x1c')](function(_0x15c7a2){if(_0x15c7a2){_0x4c8800=_0x15c7a2;return db[_0x0da2('0x35')][_0x0da2('0x52')]({'where':{'type':_0x4c8800[_0x0da2('0x37')]},'raw':!![]});}return null;})[_0x0da2('0x1c')](function(_0x36d9de){if(_0x4c8800[_0x0da2('0x37')]['toUpperCase']()=='STUN'){var _0xb71616=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config[_0x0da2('0x56')],_0x0da2('0x57')),_0x0da2('0x58'));var _0x220d4d=ejs[_0x0da2('0x59')](_0xb71616,{'networks':_0x36d9de||[]});fs[_0x0da2('0x5a')](_0x0da2('0x5b'),_0x220d4d);return respondWithRpcPromise(_0x0da2('0x5c'),_0x0da2('0x64'),{'module':_0x0da2('0x5d')});}else if(_0x4c8800[_0x0da2('0x37')][_0x0da2('0x5e')]()=='TURN'){var _0x3a43e7=fs[_0x0da2('0x54')](path['join'](config[_0x0da2('0x56')],_0x0da2('0x5f')),_0x0da2('0x58'));var _0x161e5c=ejs['render'](_0x3a43e7,{'networks':_0x36d9de||[]});fs['writeFileSync'](_0x0da2('0x65'),_0x161e5c);return respondWithRpcPromise(_0x0da2('0x5c'),_0x0da2('0x64'),{'module':_0x0da2('0x5d')});}else{var _0x1a80a1=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config['root'],_0x0da2('0x60')),_0x0da2('0x58'));var _0x1806df=ejs[_0x0da2('0x59')](_0x1a80a1,{'networks':_0x36d9de||[]});fs[_0x0da2('0x5a')](util['format'](_0x0da2('0x62'),_0x31910d[_0x0da2('0x51')]['type'][_0x0da2('0x63')]()),_0x1806df);return respondWithRpcPromise(_0x0da2('0x5c'),_0x0da2('0x64'),{'module':_0x0da2('0x66')});}return null;})[_0x0da2('0x1c')](function(_0x3a6fa8){if(_0x3a6fa8){return _0x4c8800;}return null;});})[_0x0da2('0x1c')](respondWithResult(_0x26dd55,null))[_0x0da2('0x25')](handleError(_0x26dd55,null));};exports[_0x0da2('0x67')]=function(_0x382a95,_0x169f2b,_0x2e61b6){var _0x49524f;return db['Network'][_0x0da2('0x68')]({'where':{'id':_0x382a95[_0x0da2('0x4c')]['id']}})['then'](function(_0x1a7308){_0x49524f=_0x1a7308;return _0x1a7308;})[_0x0da2('0x1c')](handleEntityNotFound(_0x169f2b,null))[_0x0da2('0x1c')](removeEntity(_0x169f2b,null))[_0x0da2('0x1c')](function(){if(_0x49524f){return db[_0x0da2('0x35')][_0x0da2('0x52')]({'where':{'type':_0x49524f[_0x0da2('0x37')]},'raw':!![]});}})[_0x0da2('0x1c')](function(_0x4fb21e){if(_0x49524f[_0x0da2('0x37')][_0x0da2('0x5e')]()==_0x0da2('0x53')){var _0x33c191=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config[_0x0da2('0x56')],_0x0da2('0x57')),_0x0da2('0x58'));var _0x5cb3a8=ejs['render'](_0x33c191,{'networks':_0x4fb21e||[]});fs[_0x0da2('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x5cb3a8);return respondWithRpcPromise('Reload',_0x0da2('0x67'),{'module':_0x0da2('0x5d')});}else if(_0x49524f[_0x0da2('0x37')][_0x0da2('0x5e')]()==_0x0da2('0x69')){var _0xb9a70b=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config[_0x0da2('0x56')],'server/files/templates/turn_multiple.ejs'),_0x0da2('0x58'));var _0x466258=ejs[_0x0da2('0x59')](_0xb9a70b,{'networks':_0x4fb21e||[]});fs['writeFileSync'](_0x0da2('0x65'),_0x466258);return respondWithRpcPromise(_0x0da2('0x5c'),_0x0da2('0x67'),{'module':_0x0da2('0x5d')});}else{var _0x3fa6a0=fs[_0x0da2('0x54')](path[_0x0da2('0x55')](config[_0x0da2('0x56')],_0x0da2('0x60')),_0x0da2('0x58'));var _0x15ac52=ejs['render'](_0x3fa6a0,{'networks':_0x4fb21e||[]});fs[_0x0da2('0x5a')](util[_0x0da2('0x61')]('/etc/asterisk/sip_xcally_%s.conf',_0x382a95[_0x0da2('0x51')]['type'][_0x0da2('0x63')]()),_0x15ac52);return respondWithRpcPromise(_0x0da2('0x5c'),_0x0da2('0x67'),{'module':_0x0da2('0x66')});}return null;})[_0x0da2('0x25')](handleError(_0x169f2b,null));}; \ No newline at end of file +var _0x285d=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Network,\x20%s,\x20%s','info','result','end','status','json','offset','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','include','catch','show','params','options','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','root','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','findAll','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','chan_sip.so','find','destroy','html-pdf'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x285d,0x6d));var _0xd285=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x285d[_0x42245d];return _0x4b211a;};'use strict';var pdf=require(_0xd285('0x0'));var emlformat=require(_0xd285('0x1'));var rimraf=require(_0xd285('0x2'));var zipdir=require(_0xd285('0x3'));var jsonpatch=require(_0xd285('0x4'));var rp=require(_0xd285('0x5'));var moment=require(_0xd285('0x6'));var BPromise=require(_0xd285('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd285('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd285('0x9'));var fs=require('fs');var _=require(_0xd285('0xa'));var squel=require('squel');var crypto=require(_0xd285('0xb'));var jsforce=require(_0xd285('0xc'));var deskjs=require(_0xd285('0xd'));var toCsv=require(_0xd285('0xe'));var querystring=require(_0xd285('0xf'));var Papa=require(_0xd285('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd285('0x11'));var as=require(_0xd285('0x12'));var hardwareService=require(_0xd285('0x13'));var logger=require(_0xd285('0x14'))(_0xd285('0x15'));var utils=require(_0xd285('0x16'));var config=require(_0xd285('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd285('0x18'))['db'];var jayson=require(_0xd285('0x19'));var client=jayson[_0xd285('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0c99,_0x2fc2a3,_0x5c65d2,_0x2a7b29){return new BPromise(function(_0x1aad04,_0x546032){var _0x2bb519=_0x2a7b29||client;return _0x2bb519['request'](_0x4e0c99,_0x5c65d2)[_0xd285('0x1b')](function(_0x257245){logger['info']('Network,\x20%s,\x20%s',_0x2fc2a3,_0xd285('0x1c'));logger[_0xd285('0x1d')](_0xd285('0x1e'),_0x2fc2a3,_0xd285('0x1c'),JSON[_0xd285('0x1f')](_0x257245));if(_0x257245['error']){if(_0x257245[_0xd285('0x20')][_0xd285('0x21')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x2fc2a3,_0x257245[_0xd285('0x20')][_0xd285('0x22')]);return _0x546032(_0x257245[_0xd285('0x20')]['message']);}logger[_0xd285('0x20')](_0xd285('0x23'),_0x2fc2a3,_0x257245[_0xd285('0x20')][_0xd285('0x22')]);return _0x1aad04(_0x257245[_0xd285('0x20')][_0xd285('0x22')]);}else{logger[_0xd285('0x24')]('Network,\x20%s,\x20%s',_0x2fc2a3,_0xd285('0x1c'));_0x1aad04(_0x257245[_0xd285('0x25')]['message']);}})['catch'](function(_0x549534){logger[_0xd285('0x20')](_0xd285('0x23'),_0x2fc2a3,_0x549534);_0x546032(_0x549534);});});}function respondWithStatusCode(_0x334ba3,_0x510241){_0x510241=_0x510241||0xcc;return function(_0x5ed5dd){if(_0x5ed5dd){return _0x334ba3['sendStatus'](_0x510241);}return _0x334ba3['status'](_0x510241)[_0xd285('0x26')]();};}function respondWithResult(_0x3c9772,_0x4dfac0){_0x4dfac0=_0x4dfac0||0xc8;return function(_0xc38241){if(_0xc38241){return _0x3c9772[_0xd285('0x27')](_0x4dfac0)[_0xd285('0x28')](_0xc38241);}};}function respondWithFilteredResult(_0x3ba8ae,_0x39cf24){return function(_0x5e66b5){if(_0x5e66b5){var _0x269c11=_0x5e66b5['count'],_0x18dd21=_0x39cf24[_0xd285('0x29')],_0x5255d4=_0x39cf24[_0xd285('0x29')]+_0x39cf24['limit'],_0x2d36f7;if(_0x5255d4>=_0x269c11){_0x5255d4=_0x269c11;_0x2d36f7=0xc8;}else{_0x2d36f7=0xce;}_0x3ba8ae[_0xd285('0x27')](_0x2d36f7);return _0x3ba8ae[_0xd285('0x2a')](_0xd285('0x2b'),_0x18dd21+'-'+_0x5255d4+'/'+_0x269c11)['json'](_0x5e66b5);}return null;};}function patchUpdates(_0x3f70db){return function(_0x12ace3){try{jsonpatch[_0xd285('0x2c')](_0x12ace3,_0x3f70db,!![]);}catch(_0xb03a00){return BPromise[_0xd285('0x2d')](_0xb03a00);}return _0x12ace3[_0xd285('0x2e')]();};}function saveUpdates(_0x34be49,_0x21ae12){return function(_0x11b633){if(_0x11b633){return _0x11b633[_0xd285('0x2f')](_0x34be49)['then'](function(_0x495531){return _0x495531;});}return null;};}function removeEntity(_0x58cc05,_0x5c4e0a){return function(_0x339f88){if(_0x339f88){return _0x339f88['destroy']()[_0xd285('0x1b')](function(){_0x58cc05['status'](0xcc)[_0xd285('0x26')]();});}};}function handleEntityNotFound(_0x1d036c,_0x26f55b){return function(_0x5531f5){if(!_0x5531f5){_0x1d036c[_0xd285('0x30')](0x194);}return _0x5531f5;};}function handleError(_0x4a24bc,_0x40dcfd){_0x40dcfd=_0x40dcfd||0x1f4;return function(_0x3fb339){logger['error'](_0x3fb339[_0xd285('0x31')]);if(_0x3fb339[_0xd285('0x32')]){delete _0x3fb339['name'];}_0x4a24bc['status'](_0x40dcfd)[_0xd285('0x33')](_0x3fb339);};}exports[_0xd285('0x34')]=function(_0x4cdbaa,_0x1eee85){var _0x578b5b={},_0x2cc450={},_0x45c99f={'count':0x0,'rows':[]};var _0x3a0da8=_[_0xd285('0x35')](db[_0xd285('0x36')][_0xd285('0x37')],function(_0x3391c5){return{'name':_0x3391c5['fieldName'],'type':_0x3391c5[_0xd285('0x38')][_0xd285('0x39')]};});_0x2cc450['model']=_[_0xd285('0x35')](_0x3a0da8,_0xd285('0x32'));_0x2cc450['query']=_[_0xd285('0x3a')](_0x4cdbaa[_0xd285('0x3b')]);_0x2cc450[_0xd285('0x3c')]=_['intersection'](_0x2cc450[_0xd285('0x3d')],_0x2cc450[_0xd285('0x3b')]);_0x578b5b[_0xd285('0x3e')]=_[_0xd285('0x3f')](_0x2cc450['model'],qs[_0xd285('0x40')](_0x4cdbaa[_0xd285('0x3b')][_0xd285('0x40')]));_0x578b5b['attributes']=_0x578b5b[_0xd285('0x3e')][_0xd285('0x41')]?_0x578b5b[_0xd285('0x3e')]:_0x2cc450[_0xd285('0x3d')];if(!_0x4cdbaa['query'][_0xd285('0x42')](_0xd285('0x43'))){_0x578b5b[_0xd285('0x44')]=qs['limit'](_0x4cdbaa[_0xd285('0x3b')]['limit']);_0x578b5b[_0xd285('0x29')]=qs[_0xd285('0x29')](_0x4cdbaa[_0xd285('0x3b')][_0xd285('0x29')]);}_0x578b5b[_0xd285('0x45')]=qs[_0xd285('0x46')](_0x4cdbaa['query'][_0xd285('0x46')]);_0x578b5b['where']=qs['filters'](_[_0xd285('0x47')](_0x4cdbaa[_0xd285('0x3b')],_0x2cc450[_0xd285('0x3c')]),_0x3a0da8);if(_0x4cdbaa[_0xd285('0x3b')]['filter']){_0x578b5b[_0xd285('0x48')]=_[_0xd285('0x49')](_0x578b5b[_0xd285('0x48')],{'$or':_[_0xd285('0x35')](_0x3a0da8,function(_0x2e50c7){if(_0x2e50c7['type']!==_0xd285('0x4a')){var _0x14a93e={};_0x14a93e[_0x2e50c7[_0xd285('0x32')]]={'$like':'%'+_0x4cdbaa['query'][_0xd285('0x4b')]+'%'};return _0x14a93e;}})});}_0x578b5b=_[_0xd285('0x49')]({},_0x578b5b,_0x4cdbaa['options']);var _0x2506f9={'where':_0x578b5b[_0xd285('0x48')]};return db[_0xd285('0x36')][_0xd285('0x4c')](_0x2506f9)[_0xd285('0x1b')](function(_0x4b3a30){_0x45c99f[_0xd285('0x4c')]=_0x4b3a30;if(_0x4cdbaa['query'][_0xd285('0x4d')]){_0x578b5b[_0xd285('0x4e')]=[{'all':!![]}];}return db['Network']['findAll'](_0x578b5b);})[_0xd285('0x1b')](function(_0x2262f8){_0x45c99f['rows']=_0x2262f8;return _0x45c99f;})[_0xd285('0x1b')](respondWithFilteredResult(_0x1eee85,_0x578b5b))[_0xd285('0x4f')](handleError(_0x1eee85,null));};exports[_0xd285('0x50')]=function(_0x2eb923,_0x3f721f){var _0x174bee={'raw':!![],'where':{'id':_0x2eb923[_0xd285('0x51')]['id']}},_0x3136da={};_0x3136da[_0xd285('0x3d')]=_[_0xd285('0x3a')](db[_0xd285('0x36')][_0xd285('0x37')]);_0x3136da[_0xd285('0x3b')]=_[_0xd285('0x3a')](_0x2eb923['query']);_0x3136da['filters']=_[_0xd285('0x3f')](_0x3136da[_0xd285('0x3d')],_0x3136da[_0xd285('0x3b')]);_0x174bee['attributes']=_[_0xd285('0x3f')](_0x3136da['model'],qs[_0xd285('0x40')](_0x2eb923[_0xd285('0x3b')][_0xd285('0x40')]));_0x174bee[_0xd285('0x3e')]=_0x174bee[_0xd285('0x3e')]['length']?_0x174bee[_0xd285('0x3e')]:_0x3136da[_0xd285('0x3d')];if(_0x2eb923[_0xd285('0x3b')][_0xd285('0x4d')]){_0x174bee['include']=[{'all':!![]}];}_0x174bee=_['merge']({},_0x174bee,_0x2eb923[_0xd285('0x52')]);return db['Network']['find'](_0x174bee)[_0xd285('0x1b')](handleEntityNotFound(_0x3f721f,null))['then'](respondWithResult(_0x3f721f,null))['catch'](handleError(_0x3f721f,null));};exports['create']=function(_0x4926a3,_0x2d6024,_0x588224){var _0x3f86ae;return db[_0xd285('0x53')][_0xd285('0x54')](function(_0x346148){return db[_0xd285('0x36')][_0xd285('0x55')](_0x4926a3[_0xd285('0x56')],{'raw':!![]})[_0xd285('0x1b')](function(_0x17bf62){_0x3f86ae=_0x17bf62;return db[_0xd285('0x36')]['findAll']({'where':{'type':_0x4926a3[_0xd285('0x56')][_0xd285('0x38')]},'raw':!![]});})['then'](function(_0x50e5bf){if(_0x3f86ae['type'][_0xd285('0x57')]()==_0xd285('0x58')){var _0xb15e33=fs[_0xd285('0x59')](path['join'](config[_0xd285('0x5a')],'server/files/templates/stun_multiple.ejs'),_0xd285('0x5b'));var _0x305072=ejs['render'](_0xb15e33,{'networks':_0x50e5bf||[]});fs[_0xd285('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x305072);return respondWithRpcPromise(_0xd285('0x5d'),_0xd285('0x55'),{'module':_0xd285('0x5e')});}else if(_0x3f86ae[_0xd285('0x38')]['toUpperCase']()==_0xd285('0x5f')){var _0x16bfa5=fs['readFileSync'](path[_0xd285('0x60')](config[_0xd285('0x5a')],_0xd285('0x61')),_0xd285('0x5b'));var _0x3a6b9e=ejs[_0xd285('0x62')](_0x16bfa5,{'networks':_0x50e5bf||[]});fs['writeFileSync'](_0xd285('0x63'),_0x3a6b9e);return respondWithRpcPromise('Reload',_0xd285('0x55'),{'module':_0xd285('0x5e')});}else{var _0x2cb231=fs[_0xd285('0x59')](path[_0xd285('0x60')](config['root'],_0xd285('0x64')),_0xd285('0x5b'));var _0x16b1bf=ejs[_0xd285('0x62')](_0x2cb231,{'networks':_0x50e5bf||[]});fs['writeFileSync'](util[_0xd285('0x65')](_0xd285('0x66'),_0x4926a3[_0xd285('0x56')][_0xd285('0x38')][_0xd285('0x67')]()),_0x16b1bf);return respondWithRpcPromise(_0xd285('0x5d'),_0xd285('0x55'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x3f86ae;});})[_0xd285('0x1b')](respondWithResult(_0x2d6024,0xc9))['catch'](handleError(_0x2d6024,null));};exports['update']=function(_0x1d741e,_0x597367,_0x2d0030){var _0x410159;return db[_0xd285('0x53')][_0xd285('0x54')](function(_0x39df99){return db['Network']['find']({'where':{'id':_0x1d741e['params']['id']}})[_0xd285('0x1b')](handleEntityNotFound(_0x597367,null))['then'](saveUpdates(_0x1d741e['body'],null))[_0xd285('0x1b')](function(_0x1fabcc){if(_0x1fabcc){_0x410159=_0x1fabcc;return db[_0xd285('0x36')][_0xd285('0x68')]({'where':{'type':_0x410159[_0xd285('0x38')]},'raw':!![]});}return null;})[_0xd285('0x1b')](function(_0x3099a3){if(_0x410159[_0xd285('0x38')][_0xd285('0x57')]()==_0xd285('0x58')){var _0x35a70e=fs[_0xd285('0x59')](path[_0xd285('0x60')](config['root'],_0xd285('0x69')),_0xd285('0x5b'));var _0x2b6447=ejs[_0xd285('0x62')](_0x35a70e,{'networks':_0x3099a3||[]});fs['writeFileSync'](_0xd285('0x6a'),_0x2b6447);return respondWithRpcPromise('Reload',_0xd285('0x2f'),{'module':_0xd285('0x5e')});}else if(_0x410159[_0xd285('0x38')][_0xd285('0x57')]()==_0xd285('0x5f')){var _0x43d912=fs[_0xd285('0x59')](path['join'](config['root'],_0xd285('0x61')),_0xd285('0x5b'));var _0xc0e641=ejs[_0xd285('0x62')](_0x43d912,{'networks':_0x3099a3||[]});fs[_0xd285('0x5c')]('/etc/asterisk/turn_xcally.conf',_0xc0e641);return respondWithRpcPromise(_0xd285('0x5d'),_0xd285('0x2f'),{'module':_0xd285('0x5e')});}else{var _0x29ff99=fs['readFileSync'](path[_0xd285('0x60')](config['root'],'server/files/templates/network.ejs'),_0xd285('0x5b'));var _0x3c84c6=ejs['render'](_0x29ff99,{'networks':_0x3099a3||[]});fs[_0xd285('0x5c')](util[_0xd285('0x65')](_0xd285('0x66'),_0x1d741e[_0xd285('0x56')][_0xd285('0x38')]['toLowerCase']()),_0x3c84c6);return respondWithRpcPromise(_0xd285('0x5d'),'update',{'module':_0xd285('0x6b')});}return null;})[_0xd285('0x1b')](function(_0x377d4b){if(_0x377d4b){return _0x410159;}return null;});})[_0xd285('0x1b')](respondWithResult(_0x597367,null))[_0xd285('0x4f')](handleError(_0x597367,null));};exports['destroy']=function(_0x1d738a,_0x4ed846,_0x4b1955){var _0x28d955;return db[_0xd285('0x36')][_0xd285('0x6c')]({'where':{'id':_0x1d738a[_0xd285('0x51')]['id']}})[_0xd285('0x1b')](function(_0x265334){_0x28d955=_0x265334;return _0x265334;})[_0xd285('0x1b')](handleEntityNotFound(_0x4ed846,null))['then'](removeEntity(_0x4ed846,null))['then'](function(){if(_0x28d955){return db[_0xd285('0x36')][_0xd285('0x68')]({'where':{'type':_0x28d955[_0xd285('0x38')]},'raw':!![]});}})[_0xd285('0x1b')](function(_0x8b3ed8){if(_0x28d955[_0xd285('0x38')][_0xd285('0x57')]()==_0xd285('0x58')){var _0x29ba36=fs[_0xd285('0x59')](path['join'](config[_0xd285('0x5a')],_0xd285('0x69')),_0xd285('0x5b'));var _0x27f267=ejs['render'](_0x29ba36,{'networks':_0x8b3ed8||[]});fs[_0xd285('0x5c')](_0xd285('0x6a'),_0x27f267);return respondWithRpcPromise(_0xd285('0x5d'),_0xd285('0x6d'),{'module':_0xd285('0x5e')});}else if(_0x28d955[_0xd285('0x38')]['toUpperCase']()=='TURN'){var _0x2227d2=fs['readFileSync'](path[_0xd285('0x60')](config[_0xd285('0x5a')],_0xd285('0x61')),_0xd285('0x5b'));var _0x360d5b=ejs[_0xd285('0x62')](_0x2227d2,{'networks':_0x8b3ed8||[]});fs[_0xd285('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x360d5b);return respondWithRpcPromise(_0xd285('0x5d'),_0xd285('0x6d'),{'module':_0xd285('0x5e')});}else{var _0x151ce8=fs['readFileSync'](path[_0xd285('0x60')](config[_0xd285('0x5a')],_0xd285('0x64')),_0xd285('0x5b'));var _0x1b5b74=ejs[_0xd285('0x62')](_0x151ce8,{'networks':_0x8b3ed8||[]});fs[_0xd285('0x5c')](util[_0xd285('0x65')](_0xd285('0x66'),_0x1d738a[_0xd285('0x56')][_0xd285('0x38')][_0xd285('0x67')]()),_0x1b5b74);return respondWithRpcPromise(_0xd285('0x5d'),_0xd285('0x6d'),{'module':'chan_sip.so'});}return null;})[_0xd285('0x4f')](handleError(_0x4ed846,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3b6c788..d2746b1 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 _0xc12d=['util','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','define','Network','network','lodash'];(function(_0x156e16,_0x28042a){var _0x3f5741=function(_0x156e8b){while(--_0x156e8b){_0x156e16['push'](_0x156e16['shift']());}};_0x3f5741(++_0x28042a);}(_0xc12d,0x15b));var _0xdc12=function(_0x385ef0,_0x1f3282){_0x385ef0=_0x385ef0-0x0;var _0xf908fb=_0xc12d[_0x385ef0];return _0xf908fb;};'use strict';var _=require(_0xdc12('0x0'));var util=require(_0xdc12('0x1'));var logger=require('../../config/logger')(_0xdc12('0x2'));var moment=require(_0xdc12('0x3'));var BPromise=require(_0xdc12('0x4'));var rp=require(_0xdc12('0x5'));var fs=require('fs');var path=require(_0xdc12('0x6'));var rimraf=require(_0xdc12('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc12('0x8'));module['exports']=function(_0x4ed862,_0x243969){return _0x4ed862[_0xdc12('0x9')](_0xdc12('0xa'),attributes,{'tableName':_0xdc12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7285=['Network','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0xa845c8,_0x335baa){var _0xae2c04=function(_0x54b1d6){while(--_0x54b1d6){_0xa845c8['push'](_0xa845c8['shift']());}};_0xae2c04(++_0x335baa);}(_0x7285,0x181));var _0x5728=function(_0x3aa1d6,_0x1f9794){_0x3aa1d6=_0x3aa1d6-0x0;var _0x386b3d=_0x7285[_0x3aa1d6];return _0x386b3d;};'use strict';var _=require(_0x5728('0x0'));var util=require('util');var logger=require(_0x5728('0x1'))(_0x5728('0x2'));var moment=require(_0x5728('0x3'));var BPromise=require(_0x5728('0x4'));var rp=require(_0x5728('0x5'));var fs=require('fs');var path=require(_0x5728('0x6'));var rimraf=require(_0x5728('0x7'));var config=require(_0x5728('0x8'));var attributes=require(_0x5728('0x9'));module[_0x5728('0xa')]=function(_0x13c2a5,_0x554155){return _0x13c2a5['define'](_0x5728('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index b170b67..8016b3d 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 _0xb2a4=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment'];(function(_0xbbf190,_0x5452e1){var _0x364164=function(_0x6dc8b5){while(--_0x6dc8b5){_0xbbf190['push'](_0xbbf190['shift']());}};_0x364164(++_0x5452e1);}(_0xb2a4,0x17a));var _0x4b2a=function(_0x41639f,_0x58c4e2){_0x41639f=_0x41639f-0x0;var _0x34e803=_0xb2a4[_0x41639f];return _0x34e803;};'use strict';var _=require(_0x4b2a('0x0'));var util=require('util');var moment=require(_0x4b2a('0x1'));var BPromise=require(_0x4b2a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b2a('0x3'));var db=require(_0x4b2a('0x4'))['db'];var utils=require(_0x4b2a('0x5'));var logger=require('../../config/logger')(_0x4b2a('0x6'));var config=require('../../config/environment');var jayson=require(_0x4b2a('0x7'));var client=jayson[_0x4b2a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bd40b,_0x27d2a6,_0x1fd912){return new BPromise(function(_0xfc149,_0x35726c){return client[_0x4b2a('0x9')](_0x4bd40b,_0x1fd912)['then'](function(_0x113162){logger['info'](_0x4b2a('0xa'),_0x27d2a6,_0x4b2a('0xb'));logger[_0x4b2a('0xc')](_0x4b2a('0xd'),_0x27d2a6,_0x4b2a('0xb'),JSON['stringify'](_0x113162));if(_0x113162['error']){if(_0x113162[_0x4b2a('0xe')][_0x4b2a('0xf')]===0x1f4){logger[_0x4b2a('0xe')](_0x4b2a('0xa'),_0x27d2a6,_0x113162['error'][_0x4b2a('0x10')]);return _0x35726c(_0x113162[_0x4b2a('0xe')][_0x4b2a('0x10')]);}logger[_0x4b2a('0xe')](_0x4b2a('0xa'),_0x27d2a6,_0x113162['error'][_0x4b2a('0x10')]);return _0xfc149(_0x113162[_0x4b2a('0xe')]['message']);}else{logger[_0x4b2a('0x11')]('Network,\x20%s,\x20%s',_0x27d2a6,'request\x20sent');_0xfc149(_0x113162[_0x4b2a('0x12')][_0x4b2a('0x10')]);}})[_0x4b2a('0x13')](function(_0x511f99){logger[_0x4b2a('0xe')](_0x4b2a('0xa'),_0x27d2a6,_0x511f99);_0x35726c(_0x511f99);});});} \ No newline at end of file +var _0x1b10=['Network,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x270a4e,_0x478486){var _0x2d73d5=function(_0x33a8b3){while(--_0x33a8b3){_0x270a4e['push'](_0x270a4e['shift']());}};_0x2d73d5(++_0x478486);}(_0x1b10,0xac));var _0x01b1=function(_0x259556,_0x488aca){_0x259556=_0x259556-0x0;var _0x5009de=_0x1b10[_0x259556];return _0x5009de;};'use strict';var _=require(_0x01b1('0x0'));var util=require('util');var moment=require(_0x01b1('0x1'));var BPromise=require(_0x01b1('0x2'));var rs=require(_0x01b1('0x3'));var fs=require('fs');var Redis=require(_0x01b1('0x4'));var db=require(_0x01b1('0x5'))['db'];var utils=require(_0x01b1('0x6'));var logger=require(_0x01b1('0x7'))(_0x01b1('0x8'));var config=require(_0x01b1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x01b1('0xa')][_0x01b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x230515,_0x4c7082,_0x537425){return new BPromise(function(_0x2ecfd9,_0x4e3917){return client[_0x01b1('0xc')](_0x230515,_0x537425)[_0x01b1('0xd')](function(_0x392ea1){logger[_0x01b1('0xe')]('Network,\x20%s,\x20%s',_0x4c7082,_0x01b1('0xf'));logger[_0x01b1('0x10')](_0x01b1('0x11'),_0x4c7082,'request\x20sent',JSON['stringify'](_0x392ea1));if(_0x392ea1[_0x01b1('0x12')]){if(_0x392ea1[_0x01b1('0x12')][_0x01b1('0x13')]===0x1f4){logger[_0x01b1('0x12')](_0x01b1('0x14'),_0x4c7082,_0x392ea1[_0x01b1('0x12')]['message']);return _0x4e3917(_0x392ea1[_0x01b1('0x12')]['message']);}logger[_0x01b1('0x12')]('Network,\x20%s,\x20%s',_0x4c7082,_0x392ea1[_0x01b1('0x12')]['message']);return _0x2ecfd9(_0x392ea1['error'][_0x01b1('0x15')]);}else{logger[_0x01b1('0xe')](_0x01b1('0x14'),_0x4c7082,_0x01b1('0xf'));_0x2ecfd9(_0x392ea1[_0x01b1('0x16')][_0x01b1('0x15')]);}})[_0x01b1('0x17')](function(_0x5747c2){logger['error'](_0x01b1('0x14'),_0x4c7082,_0x5747c2);_0x4e3917(_0x5747c2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index dac7998..a09b27c 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 _0x3756=['/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','addAgents'];(function(_0x2ca63b,_0x2e8b0){var _0x14d053=function(_0x2f90f3){while(--_0x2f90f3){_0x2ca63b['push'](_0x2ca63b['shift']());}};_0x14d053(++_0x2e8b0);}(_0x3756,0x160));var _0x6375=function(_0x36646a,_0x3b1e0b){_0x36646a=_0x36646a-0x0;var _0x16bb47=_0x3756[_0x36646a];return _0x16bb47;};'use strict';var multer=require('multer');var util=require(_0x6375('0x0'));var path=require(_0x6375('0x1'));var timeout=require('connect-timeout');var express=require(_0x6375('0x2'));var router=express[_0x6375('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6375('0x4'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x6375('0x5')]('/',auth['isAuthenticated'](),controller[_0x6375('0x6')]);router['get'](_0x6375('0x7'),auth[_0x6375('0x8')](),controller[_0x6375('0x9')]);router[_0x6375('0x5')](_0x6375('0xa'),auth[_0x6375('0x8')](),controller[_0x6375('0xb')]);router[_0x6375('0x5')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x6375('0xc')]);router[_0x6375('0x5')](_0x6375('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x6375('0x5')](_0x6375('0xe'),auth[_0x6375('0x8')](),controller[_0x6375('0xf')]);router['get'](_0x6375('0x10'),auth[_0x6375('0x8')](),controller[_0x6375('0x11')]);router[_0x6375('0x5')](_0x6375('0x12'),auth[_0x6375('0x8')](),controller[_0x6375('0x13')]);router[_0x6375('0x14')]('/',auth[_0x6375('0x8')](),controller[_0x6375('0x15')]);router[_0x6375('0x14')](_0x6375('0x16'),auth[_0x6375('0x8')](),controller[_0x6375('0x17')]);router[_0x6375('0x14')](_0x6375('0xd'),auth[_0x6375('0x8')](),controller['addAnswer']);router[_0x6375('0x14')](_0x6375('0x18'),controller[_0x6375('0x19')]);router['post'](_0x6375('0xe'),auth['isAuthenticated'](),controller[_0x6375('0x1a')]);router[_0x6375('0x14')]('/:id/users',auth[_0x6375('0x8')](),controller[_0x6375('0x1b')]);router[_0x6375('0x14')](_0x6375('0x1c'),auth[_0x6375('0x8')](),controller[_0x6375('0x1d')]);router[_0x6375('0x1e')](_0x6375('0xa'),auth[_0x6375('0x8')](),controller[_0x6375('0x1f')]);router[_0x6375('0x20')]('/:id',auth[_0x6375('0x8')](),controller[_0x6375('0x21')]);router[_0x6375('0x20')]('/:id/dispositions',auth[_0x6375('0x8')](),controller[_0x6375('0x22')]);router[_0x6375('0x20')](_0x6375('0xd'),auth[_0x6375('0x8')](),controller[_0x6375('0x23')]);router[_0x6375('0x20')](_0x6375('0x12'),auth[_0x6375('0x8')](),controller[_0x6375('0x24')]);module[_0x6375('0x25')]=router; \ No newline at end of file +var _0x8b7f=['addApplications','/:id/users','addAgents','send','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/:id','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','post','create','addDisposition','/:id/canned_answers','notify'];(function(_0x19561b,_0x2dccef){var _0x135586=function(_0x3ae2b5){while(--_0x3ae2b5){_0x19561b['push'](_0x19561b['shift']());}};_0x135586(++_0x2dccef);}(_0x8b7f,0xf0));var _0xf8b7=function(_0x23f2d0,_0xa9972){_0x23f2d0=_0x23f2d0-0x0;var _0x525a57=_0x8b7f[_0x23f2d0];return _0x525a57;};'use strict';var multer=require(_0xf8b7('0x0'));var util=require(_0xf8b7('0x1'));var path=require('path');var timeout=require(_0xf8b7('0x2'));var express=require(_0xf8b7('0x3'));var router=express['Router']();var auth=require(_0xf8b7('0x4'));var interaction=require(_0xf8b7('0x5'));var config=require(_0xf8b7('0x6'));var controller=require(_0xf8b7('0x7'));router[_0xf8b7('0x8')]('/',auth[_0xf8b7('0x9')](),controller[_0xf8b7('0xa')]);router['get']('/describe',auth[_0xf8b7('0x9')](),controller['describe']);router['get'](_0xf8b7('0xb'),auth[_0xf8b7('0x9')](),controller[_0xf8b7('0xc')]);router['get']('/:id/dispositions',auth[_0xf8b7('0x9')](),controller[_0xf8b7('0xd')]);router[_0xf8b7('0x8')]('/:id/canned_answers',auth[_0xf8b7('0x9')](),controller[_0xf8b7('0xe')]);router[_0xf8b7('0x8')](_0xf8b7('0xf'),auth[_0xf8b7('0x9')](),controller[_0xf8b7('0x10')]);router[_0xf8b7('0x8')](_0xf8b7('0x11'),auth['isAuthenticated'](),controller[_0xf8b7('0x12')]);router[_0xf8b7('0x8')]('/:id/users',auth[_0xf8b7('0x9')](),controller['getAgents']);router[_0xf8b7('0x13')]('/',auth[_0xf8b7('0x9')](),controller[_0xf8b7('0x14')]);router[_0xf8b7('0x13')]('/:id/dispositions',auth[_0xf8b7('0x9')](),controller[_0xf8b7('0x15')]);router['post'](_0xf8b7('0x16'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/:id/notify',controller[_0xf8b7('0x17')]);router[_0xf8b7('0x13')](_0xf8b7('0xf'),auth[_0xf8b7('0x9')](),controller[_0xf8b7('0x18')]);router[_0xf8b7('0x13')](_0xf8b7('0x19'),auth[_0xf8b7('0x9')](),controller[_0xf8b7('0x1a')]);router[_0xf8b7('0x13')]('/:id/send',auth['isAuthenticated'](),controller[_0xf8b7('0x1b')]);router['put'](_0xf8b7('0xb'),auth['isAuthenticated'](),controller[_0xf8b7('0x1c')]);router['delete'](_0xf8b7('0xb'),auth[_0xf8b7('0x9')](),controller['destroy']);router[_0xf8b7('0x1d')]('/:id/dispositions',auth[_0xf8b7('0x9')](),controller[_0xf8b7('0x1e')]);router[_0xf8b7('0x1d')](_0xf8b7('0x16'),auth[_0xf8b7('0x9')](),controller[_0xf8b7('0x1f')]);router[_0xf8b7('0x1d')](_0xf8b7('0x19'),auth[_0xf8b7('0x9')](),controller['removeAgents']);module[_0xf8b7('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 85cefb3..60f65eb 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 _0xa6fc=['mandatoryDisposition','sequelize','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1080f6,_0x54a299){var _0x1e69ac=function(_0x1c78f8){while(--_0x1c78f8){_0x1080f6['push'](_0x1080f6['shift']());}};_0x1e69ac(++_0x54a299);}(_0xa6fc,0x17a));var _0xca6f=function(_0x1c9ade,_0x1bea7d){_0x1c9ade=_0x1c9ade-0x0;var _0x453362=_0xa6fc[_0x1c9ade];return _0x453362;};'use strict';var Sequelize=require(_0xca6f('0x0'));var rs=require('randomstring');module[_0xca6f('0x1')]={'name':{'type':Sequelize[_0xca6f('0x2')],'unique':_0xca6f('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xca6f('0x4')]();}},'replyUri':{'type':Sequelize[_0xca6f('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xca6f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xca6f('0x5')],'defaultValue':function(){return _0xca6f('0x6');}},'notificationSound':{'type':Sequelize[_0xca6f('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca6f('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xca6f('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xca6f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca6f('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca6f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca6f('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xca6f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xca6f('0x7')],'defaultValue':![],'comment':_0xca6f('0xa'),'set':function(_0x4e3db8){if(!_0x4e3db8)this[_0xca6f('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xca6f('0xc'),_0x4e3db8);}}}; \ No newline at end of file +var _0xf0cc=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0cc,0x84));var _0xcf0c=function(_0x13dead,_0x4c38f9){_0x13dead=_0x13dead-0x0;var _0x3399ea=_0xf0cc[_0x13dead];return _0x3399ea;};'use strict';var Sequelize=require(_0xcf0c('0x0'));var rs=require(_0xcf0c('0x1'));module[_0xcf0c('0x2')]={'name':{'type':Sequelize[_0xcf0c('0x3')],'unique':_0xcf0c('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcf0c('0x5')]();}},'replyUri':{'type':Sequelize[_0xcf0c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcf0c('0x6')],'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[_0xcf0c('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcf0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcf0c('0x3')]},'queueTransfer':{'type':Sequelize[_0xcf0c('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcf0c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf0c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcf0c('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xcf0c('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xcf0c('0x7')],'defaultValue':![],'comment':_0xcf0c('0xa'),'set':function(_0x37fa82){if(!_0x37fa82)this[_0xcf0c('0xb')](_0xcf0c('0xc'),null);this[_0xcf0c('0xb')]('mandatoryDisposition',_0x37fa82);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 09543ab..eb94701 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 _0x613a=['dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','map','OpenchannelAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','merge','filter','options','includeAll','include','rows','show','params','Pause','mandatoryDispositionPause','keys','filters','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','rawAttributes','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','Applications','applications','orderBy','asc','account','from','contact','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','lastName','messageId','interaction','created','push','close','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','*,*,*,*','Start','startRouting','EventManager','addApplications','transaction','getApplications','pick','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages'];(function(_0x4d520a,_0x6be7c9){var _0x207f5a=function(_0x25bfe9){while(--_0x25bfe9){_0x4d520a['push'](_0x4d520a['shift']());}};_0x207f5a(++_0x6be7c9);}(_0x613a,0xba));var _0xa613=function(_0x3c9cae,_0x41b2d4){_0x3c9cae=_0x3c9cae-0x0;var _0x9e2aed=_0x613a[_0x3c9cae];return _0x9e2aed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa613('0x0'));var rimraf=require(_0xa613('0x1'));var zipdir=require(_0xa613('0x2'));var jsonpatch=require(_0xa613('0x3'));var rp=require(_0xa613('0x4'));var moment=require(_0xa613('0x5'));var BPromise=require(_0xa613('0x6'));var Mustache=require(_0xa613('0x7'));var util=require(_0xa613('0x8'));var path=require(_0xa613('0x9'));var sox=require(_0xa613('0xa'));var csv=require('to-csv');var ejs=require(_0xa613('0xb'));var fs=require('fs');var _=require(_0xa613('0xc'));var squel=require(_0xa613('0xd'));var crypto=require(_0xa613('0xe'));var jsforce=require(_0xa613('0xf'));var deskjs=require(_0xa613('0x10'));var toCsv=require(_0xa613('0x11'));var querystring=require(_0xa613('0x12'));var Papa=require('papaparse');var Redis=require(_0xa613('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa613('0x14'));var as=require(_0xa613('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa613('0x16'))(_0xa613('0x17'));var utils=require(_0xa613('0x18'));var config=require(_0xa613('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa613('0x1a'))['db'];config['redis']=_[_0xa613('0x1b')](config[_0xa613('0x1c')],{'host':_0xa613('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa613('0x1c')]));require(_0xa613('0x1e'))[_0xa613('0x1f')](socket);var jayson=require(_0xa613('0x20'));var client=jayson[_0xa613('0x21')][_0xa613('0x22')]({'port':0x232c});var client9002=jayson[_0xa613('0x21')][_0xa613('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x142602,_0x2fd432,_0x401c13,_0x247fdc){return new BPromise(function(_0x4f0722,_0x37bef2){var _0x45b687=_0x247fdc||client;return _0x45b687[_0xa613('0x23')](_0x142602,_0x401c13)[_0xa613('0x24')](function(_0x3e71a4){logger[_0xa613('0x25')](_0xa613('0x26'),_0x2fd432,_0xa613('0x27'));logger[_0xa613('0x28')](_0xa613('0x29'),_0x2fd432,_0xa613('0x27'),JSON[_0xa613('0x2a')](_0x3e71a4));if(_0x3e71a4['error']){if(_0x3e71a4[_0xa613('0x2b')][_0xa613('0x2c')]===0x1f4){logger[_0xa613('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x2fd432,_0x3e71a4[_0xa613('0x2b')][_0xa613('0x2d')]);return _0x37bef2(_0x3e71a4[_0xa613('0x2b')][_0xa613('0x2d')]);}logger[_0xa613('0x2b')](_0xa613('0x26'),_0x2fd432,_0x3e71a4['error']['message']);return _0x4f0722(_0x3e71a4['error'][_0xa613('0x2d')]);}else{logger[_0xa613('0x25')](_0xa613('0x26'),_0x2fd432,_0xa613('0x27'));_0x4f0722(_0x3e71a4[_0xa613('0x2e')][_0xa613('0x2d')]);}})[_0xa613('0x2f')](function(_0x3046ae){logger[_0xa613('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x2fd432,_0x3046ae);_0x37bef2(_0x3046ae);});});}function respondWithStatusCode(_0x256f51,_0x2537ac){_0x2537ac=_0x2537ac||0xcc;return function(_0x8ac55c){if(_0x8ac55c){return _0x256f51[_0xa613('0x30')](_0x2537ac);}return _0x256f51[_0xa613('0x31')](_0x2537ac)[_0xa613('0x32')]();};}function respondWithResult(_0x4058ca,_0x5bc39e){_0x5bc39e=_0x5bc39e||0xc8;return function(_0x27a440){if(_0x27a440){return _0x4058ca['status'](_0x5bc39e)['json'](_0x27a440);}};}function respondWithFilteredResult(_0xec768f,_0x5a15a){return function(_0x55ffea){if(_0x55ffea){var _0x407c86=_0x55ffea[_0xa613('0x33')],_0x47cb2a=_0x5a15a[_0xa613('0x34')],_0x279f01=_0x5a15a[_0xa613('0x34')]+_0x5a15a['limit'],_0x33ec46;if(_0x279f01>=_0x407c86){_0x279f01=_0x407c86;_0x33ec46=0xc8;}else{_0x33ec46=0xce;}_0xec768f[_0xa613('0x31')](_0x33ec46);return _0xec768f['set'](_0xa613('0x35'),_0x47cb2a+'-'+_0x279f01+'/'+_0x407c86)[_0xa613('0x36')](_0x55ffea);}return null;};}function patchUpdates(_0x593c76){return function(_0x243c20){try{jsonpatch['apply'](_0x243c20,_0x593c76,!![]);}catch(_0x485735){return BPromise[_0xa613('0x37')](_0x485735);}return _0x243c20['save']();};}function saveUpdates(_0x515110,_0x37f6d7){return function(_0x781c0d){if(_0x781c0d){return _0x781c0d[_0xa613('0x38')](_0x515110)[_0xa613('0x24')](function(_0xe2f21a){return _0xe2f21a;});}return null;};}function removeEntity(_0x3911ce,_0xb04ff6){return function(_0x3d5dd1){if(_0x3d5dd1){return _0x3d5dd1[_0xa613('0x39')]()[_0xa613('0x24')](function(){var _0x33a427=_0x3d5dd1[_0xa613('0x3a')]({'plain':!![]});var _0x13aec0=_0xa613('0x3b');return db[_0xa613('0x3c')][_0xa613('0x39')]({'where':{'type':_0x13aec0,'resourceId':_0x33a427['id']}})[_0xa613('0x24')](function(){return _0x3d5dd1;});})[_0xa613('0x24')](function(){_0x3911ce[_0xa613('0x31')](0xcc)[_0xa613('0x32')]();});}};}function handleEntityNotFound(_0x3f4ca5,_0x21eb6d){return function(_0x3f1979){if(!_0x3f1979){_0x3f4ca5[_0xa613('0x30')](0x194);}return _0x3f1979;};}function handleError(_0x4d7479,_0x45fccc){_0x45fccc=_0x45fccc||0x1f4;return function(_0x1c3b57){logger['error'](_0x1c3b57[_0xa613('0x3d')]);if(_0x1c3b57['name']){delete _0x1c3b57[_0xa613('0x3e')];}_0x4d7479[_0xa613('0x31')](_0x45fccc)[_0xa613('0x3f')](_0x1c3b57);};}exports[_0xa613('0x40')]=function(_0x1701d9,_0x51d9c7){var _0x265ba5={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2584e6={},_0x12beae={'count':0x0,'rows':[]};var _0x25a556=_[_0xa613('0x41')](db[_0xa613('0x42')]['rawAttributes'],function(_0x48ebb5){return{'name':_0x48ebb5[_0xa613('0x43')],'type':_0x48ebb5[_0xa613('0x44')][_0xa613('0x45')]};});_0x2584e6[_0xa613('0x46')]=_['map'](_0x25a556,_0xa613('0x3e'));_0x2584e6[_0xa613('0x47')]=_['keys'](_0x1701d9['query']);_0x2584e6['filters']=_[_0xa613('0x48')](_0x2584e6[_0xa613('0x46')],_0x2584e6[_0xa613('0x47')]);_0x265ba5[_0xa613('0x49')]=_[_0xa613('0x48')](_0x2584e6[_0xa613('0x46')],qs[_0xa613('0x4a')](_0x1701d9['query'][_0xa613('0x4a')]));_0x265ba5[_0xa613('0x49')]=_0x265ba5[_0xa613('0x49')][_0xa613('0x4b')]?_0x265ba5['attributes']:_0x2584e6['model'];if(!_0x1701d9[_0xa613('0x47')][_0xa613('0x4c')]('nolimit')){_0x265ba5['limit']=qs['limit'](_0x1701d9[_0xa613('0x47')][_0xa613('0x4d')]);_0x265ba5[_0xa613('0x34')]=qs[_0xa613('0x34')](_0x1701d9[_0xa613('0x47')][_0xa613('0x34')]);}_0x265ba5['order']=qs[_0xa613('0x4e')](_0x1701d9[_0xa613('0x47')]['sort']);_0x265ba5[_0xa613('0x4f')]=qs['filters'](_['pick'](_0x1701d9[_0xa613('0x47')],_0x2584e6['filters']),_0x25a556);if(_0x1701d9[_0xa613('0x47')]['filter']){_0x265ba5[_0xa613('0x4f')]=_[_0xa613('0x50')](_0x265ba5[_0xa613('0x4f')],{'$or':_['map'](_0x25a556,function(_0x183b0d){if(_0x183b0d[_0xa613('0x44')]!=='VIRTUAL'){var _0x13b7aa={};_0x13b7aa[_0x183b0d[_0xa613('0x3e')]]={'$like':'%'+_0x1701d9[_0xa613('0x47')][_0xa613('0x51')]+'%'};return _0x13b7aa;}})});}_0x265ba5=_[_0xa613('0x50')]({},_0x265ba5,_0x1701d9[_0xa613('0x52')]);var _0x47cd40={'where':_0x265ba5[_0xa613('0x4f')]};return db[_0xa613('0x42')][_0xa613('0x33')](_0x47cd40)[_0xa613('0x24')](function(_0x3e7f20){_0x12beae[_0xa613('0x33')]=_0x3e7f20;if(_0x1701d9[_0xa613('0x47')][_0xa613('0x53')]){_0x265ba5[_0xa613('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x265ba5);})['then'](function(_0xf8c24f){_0x12beae[_0xa613('0x55')]=_0xf8c24f;return _0x12beae;})[_0xa613('0x24')](respondWithFilteredResult(_0x51d9c7,_0x265ba5))[_0xa613('0x2f')](handleError(_0x51d9c7,null));};exports[_0xa613('0x56')]=function(_0x5ec74d,_0x328a4f){var _0x4008b3={'raw':![],'where':{'id':_0x5ec74d[_0xa613('0x57')]['id']},'include':[{'model':db[_0xa613('0x58')],'as':_0xa613('0x59')}]},_0x4a0787={};_0x4a0787[_0xa613('0x46')]=_[_0xa613('0x5a')](db[_0xa613('0x42')]['rawAttributes']);_0x4a0787['query']=_[_0xa613('0x5a')](_0x5ec74d[_0xa613('0x47')]);_0x4a0787[_0xa613('0x5b')]=_['intersection'](_0x4a0787[_0xa613('0x46')],_0x4a0787[_0xa613('0x47')]);_0x4008b3[_0xa613('0x49')]=_[_0xa613('0x48')](_0x4a0787[_0xa613('0x46')],qs[_0xa613('0x4a')](_0x5ec74d[_0xa613('0x47')][_0xa613('0x4a')]));_0x4008b3[_0xa613('0x49')]=_0x4008b3[_0xa613('0x49')][_0xa613('0x4b')]?_0x4008b3['attributes']:_0x4a0787[_0xa613('0x46')];if(_0x5ec74d['query'][_0xa613('0x53')]){_0x4008b3[_0xa613('0x54')]=[{'all':!![]}];}_0x4008b3=_[_0xa613('0x50')]({},_0x4008b3,_0x5ec74d[_0xa613('0x52')]);return db[_0xa613('0x42')][_0xa613('0x5c')](_0x4008b3)[_0xa613('0x24')](handleEntityNotFound(_0x328a4f,null))['then'](respondWithResult(_0x328a4f,null))[_0xa613('0x2f')](handleError(_0x328a4f,null));};exports[_0xa613('0x5d')]=function(_0x45386e,_0x1d879d){return db['OpenchannelAccount'][_0xa613('0x5d')](_0x45386e['body'],{})[_0xa613('0x24')](function(_0x29fe4e){var _0x112cf9=_0x45386e['user'][_0xa613('0x3a')]({'plain':!![]});if(!_0x112cf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x112cf9[_0xa613('0x5e')]===_0xa613('0x5f')){var _0x4f4935=_0x29fe4e['get']({'plain':!![]});var _0x4d7f38=_0xa613('0x3b');return db[_0xa613('0x60')]['find']({'where':{'name':_0x4d7f38,'userProfileId':_0x112cf9[_0xa613('0x61')]},'raw':!![]})['then'](function(_0x38dfb8){if(_0x38dfb8&&_0x38dfb8[_0xa613('0x62')]===0x0){return db['UserProfileResource'][_0xa613('0x5d')]({'name':_0x4f4935[_0xa613('0x3e')],'resourceId':_0x4f4935['id'],'type':_0x38dfb8[_0xa613('0x3e')],'sectionId':_0x38dfb8['id']},{})['then'](function(){return _0x29fe4e;});}else{return _0x29fe4e;}})['catch'](function(_0x2bd782){logger['error'](_0xa613('0x63'),_0x2bd782);throw _0x2bd782;});}return _0x29fe4e;})[_0xa613('0x24')](respondWithResult(_0x1d879d,0xc9))['catch'](handleError(_0x1d879d,null));};exports[_0xa613('0x38')]=function(_0x2516be,_0x1a8729){if(_0x2516be[_0xa613('0x64')]['id']){delete _0x2516be[_0xa613('0x64')]['id'];}return db['OpenchannelAccount'][_0xa613('0x5c')]({'where':{'id':_0x2516be['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xa613('0x24')](handleEntityNotFound(_0x1a8729,null))[_0xa613('0x24')](saveUpdates(_0x2516be[_0xa613('0x64')],null))[_0xa613('0x24')](respondWithResult(_0x1a8729,null))[_0xa613('0x2f')](handleError(_0x1a8729,null));};exports[_0xa613('0x39')]=function(_0x3d9728,_0x2d8919){return db[_0xa613('0x42')][_0xa613('0x5c')]({'where':{'id':_0x3d9728['params']['id']}})['then'](handleEntityNotFound(_0x2d8919,null))['then'](removeEntity(_0x2d8919,null))['catch'](handleError(_0x2d8919,null));};exports['describe']=function(_0x403215,_0xed75d1){return db[_0xa613('0x42')][_0xa613('0x65')]()['then'](respondWithResult(_0xed75d1,null))[_0xa613('0x2f')](handleError(_0xed75d1,null));};exports[_0xa613('0x66')]=function(_0x59295d,_0x32fa6d,_0x27beb8){if(_0x59295d[_0xa613('0x64')]['id']){delete _0x59295d[_0xa613('0x64')]['id'];}return db[_0xa613('0x42')][_0xa613('0x5c')]({'where':{'id':_0x59295d[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x32fa6d,null))['then'](function(_0x3e8087){if(_0x3e8087){_0x59295d[_0xa613('0x64')][_0xa613('0x67')]=_0x3e8087['id'];return db['Disposition']['create'](_0x59295d[_0xa613('0x64')]);}})[_0xa613('0x24')](respondWithResult(_0x32fa6d,null))[_0xa613('0x2f')](handleError(_0x32fa6d,null));};exports[_0xa613('0x68')]=function(_0x1efeb4,_0x31372c,_0x1c1caa){var _0x1d9499={'raw':![],'where':{}};var _0xa99069={};var _0x305b8c={'count':0x0,'rows':[]};return db[_0xa613('0x42')][_0xa613('0x69')]({'where':{'id':_0x1efeb4[_0xa613('0x57')]['id']}})['then'](handleEntityNotFound(_0x31372c,null))[_0xa613('0x24')](function(_0x57745c){if(_0x57745c){_0xa99069[_0xa613('0x46')]=_[_0xa613('0x5a')](db[_0xa613('0x6a')][_0xa613('0x6b')]);_0xa99069[_0xa613('0x47')]=_[_0xa613('0x5a')](_0x1efeb4['query']);_0xa99069[_0xa613('0x5b')]=_[_0xa613('0x48')](_0xa99069[_0xa613('0x46')],_0xa99069[_0xa613('0x47')]);_0x1d9499[_0xa613('0x49')]=_[_0xa613('0x48')](_0xa99069['model'],qs[_0xa613('0x4a')](_0x1efeb4[_0xa613('0x47')][_0xa613('0x4a')]));_0x1d9499[_0xa613('0x49')]=_0x1d9499[_0xa613('0x49')][_0xa613('0x4b')]?_0x1d9499['attributes']:_0xa99069['model'];if(!_0x1efeb4['query']['hasOwnProperty']('nolimit')){_0x1d9499['limit']=qs[_0xa613('0x4d')](_0x1efeb4['query'][_0xa613('0x4d')]);_0x1d9499[_0xa613('0x34')]=qs[_0xa613('0x34')](_0x1efeb4[_0xa613('0x47')]['offset']);}_0x1d9499[_0xa613('0x6c')]=qs[_0xa613('0x4e')](_0x1efeb4[_0xa613('0x47')][_0xa613('0x4e')]);_0x1d9499[_0xa613('0x4f')]=qs['filters'](_['pick'](_0x1efeb4[_0xa613('0x47')],_0xa99069[_0xa613('0x5b')]));_0x1d9499['where'][_0xa613('0x67')]=_0x57745c['id'];if(_0x1efeb4[_0xa613('0x47')][_0xa613('0x51')]){_0x1d9499[_0xa613('0x4f')]=_[_0xa613('0x50')](_0x1d9499[_0xa613('0x4f')],{'$or':_[_0xa613('0x41')](_0x1d9499[_0xa613('0x49')],function(_0x5b974b){var _0x4b4e96={};_0x4b4e96[_0x5b974b]={'$like':'%'+_0x1efeb4[_0xa613('0x47')]['filter']+'%'};return _0x4b4e96;})});}_0x1d9499=_[_0xa613('0x50')]({},_0x1d9499,_0x1efeb4['options']);return db[_0xa613('0x6a')][_0xa613('0x33')]({'where':_0x1d9499[_0xa613('0x4f')]})[_0xa613('0x24')](function(_0xaea700){_0x305b8c[_0xa613('0x33')]=_0xaea700;if(_0x1efeb4[_0xa613('0x47')][_0xa613('0x53')]){_0x1d9499[_0xa613('0x54')]=[{'all':!![]}];}return db[_0xa613('0x6a')][_0xa613('0x6d')](_0x1d9499);})[_0xa613('0x24')](function(_0xbc4daa){_0x305b8c[_0xa613('0x55')]=_0xbc4daa;return _0x305b8c;});}})[_0xa613('0x24')](respondWithFilteredResult(_0x31372c,_0x1d9499))[_0xa613('0x2f')](handleError(_0x31372c,null));};exports[_0xa613('0x6e')]=function(_0x440b14,_0x28360f,_0x444cc0){return db['OpenchannelAccount'][_0xa613('0x5c')]({'where':{'id':_0x440b14[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x28360f,null))[_0xa613('0x24')](function(_0x10df22){if(_0x10df22){return _0x10df22['removeDispositions'](_0x440b14[_0xa613('0x47')][_0xa613('0x6f')]);}})[_0xa613('0x24')](respondWithStatusCode(_0x28360f,null))[_0xa613('0x2f')](handleError(_0x28360f,null));};exports[_0xa613('0x70')]=function(_0x2476ee,_0x442eea,_0x13b6ad){if(_0x2476ee[_0xa613('0x64')]['id']){delete _0x2476ee['body']['id'];}return db[_0xa613('0x42')]['find']({'where':{'id':_0x2476ee[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x442eea,null))['then'](function(_0x4a61dc){if(_0x4a61dc){_0x2476ee[_0xa613('0x64')][_0xa613('0x67')]=_0x4a61dc['id'];return db[_0xa613('0x71')]['create'](_0x2476ee[_0xa613('0x64')]);}})[_0xa613('0x24')](respondWithResult(_0x442eea,null))[_0xa613('0x2f')](handleError(_0x442eea,null));};exports[_0xa613('0x72')]=function(_0xc267b1,_0x5d17c7,_0x51660b){var _0xc127be={'raw':![],'where':{}};var _0x3f3605={};var _0x9ce484={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xc267b1[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x5d17c7,null))[_0xa613('0x24')](function(_0x5c8127){if(_0x5c8127){_0x3f3605['model']=_[_0xa613('0x5a')](db[_0xa613('0x71')][_0xa613('0x6b')]);_0x3f3605[_0xa613('0x47')]=_[_0xa613('0x5a')](_0xc267b1['query']);_0x3f3605[_0xa613('0x5b')]=_[_0xa613('0x48')](_0x3f3605['model'],_0x3f3605[_0xa613('0x47')]);_0xc127be['attributes']=_[_0xa613('0x48')](_0x3f3605[_0xa613('0x46')],qs['fields'](_0xc267b1[_0xa613('0x47')][_0xa613('0x4a')]));_0xc127be[_0xa613('0x49')]=_0xc127be['attributes'][_0xa613('0x4b')]?_0xc127be[_0xa613('0x49')]:_0x3f3605[_0xa613('0x46')];if(!_0xc267b1[_0xa613('0x47')][_0xa613('0x4c')](_0xa613('0x73'))){_0xc127be[_0xa613('0x4d')]=qs['limit'](_0xc267b1['query'][_0xa613('0x4d')]);_0xc127be[_0xa613('0x34')]=qs[_0xa613('0x34')](_0xc267b1['query']['offset']);}_0xc127be[_0xa613('0x6c')]=qs[_0xa613('0x4e')](_0xc267b1['query'][_0xa613('0x4e')]);_0xc127be[_0xa613('0x4f')]=qs['filters'](_['pick'](_0xc267b1[_0xa613('0x47')],_0x3f3605['filters']));_0xc127be[_0xa613('0x4f')]['OpenchannelAccountId']=_0x5c8127['id'];if(_0xc267b1[_0xa613('0x47')][_0xa613('0x51')]){_0xc127be[_0xa613('0x4f')]=_[_0xa613('0x50')](_0xc127be[_0xa613('0x4f')],{'$or':_[_0xa613('0x41')](_0xc127be[_0xa613('0x49')],function(_0x4fc06a){var _0x3d77a1={};_0x3d77a1[_0x4fc06a]={'$like':'%'+_0xc267b1[_0xa613('0x47')][_0xa613('0x51')]+'%'};return _0x3d77a1;})});}_0xc127be=_[_0xa613('0x50')]({},_0xc127be,_0xc267b1[_0xa613('0x52')]);return db[_0xa613('0x71')]['count']({'where':_0xc127be['where']})['then'](function(_0x1fbb0e){_0x9ce484['count']=_0x1fbb0e;if(_0xc267b1[_0xa613('0x47')]['includeAll']){_0xc127be['include']=[{'all':!![]}];}return db[_0xa613('0x71')]['findAll'](_0xc127be);})[_0xa613('0x24')](function(_0x28cc5a){_0x9ce484[_0xa613('0x55')]=_0x28cc5a;return _0x9ce484;});}})['then'](respondWithFilteredResult(_0x5d17c7,_0xc127be))[_0xa613('0x2f')](handleError(_0x5d17c7,null));};exports[_0xa613('0x74')]=function(_0xc91556,_0x12bea5,_0xdad431){return db[_0xa613('0x42')][_0xa613('0x5c')]({'where':{'id':_0xc91556['params']['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x12bea5,null))[_0xa613('0x24')](function(_0x3d08d5){if(_0x3d08d5){return _0x3d08d5[_0xa613('0x74')](_0xc91556[_0xa613('0x47')][_0xa613('0x6f')]);}})[_0xa613('0x24')](respondWithStatusCode(_0x12bea5,null))[_0xa613('0x2f')](handleError(_0x12bea5,null));};exports[_0xa613('0x75')]=function(_0x19d2dc,_0x2dbcc0,_0x495623){var _0x21494f={'body':_0x19d2dc[_0xa613('0x64')],'channel':'openchannel'};var _0x222f2f=[];var _0x468ef4=[];var _0x18ea7a={};var _0x39cdb1=![];return db[_0xa613('0x76')][_0xa613('0x65')]()[_0xa613('0x24')](function(_0x4c30b5){if(!_0x4c30b5){throw new db[(_0xa613('0x77'))][(_0xa613('0x78'))](_0xa613('0x79'));}_0x222f2f=_['difference'](_[_0xa613('0x5a')](_0x4c30b5),[_0xa613('0x7a'),'updatedAt']);_0x468ef4=_[_0xa613('0x7b')](_[_0xa613('0x5a')](_0x4c30b5),[_0xa613('0x7a'),_0xa613('0x7c'),_0xa613('0x7d'),_0xa613('0x7e')]);if(_0x19d2dc[_0xa613('0x64')]['id']){delete _0x19d2dc[_0xa613('0x64')]['id'];}if(_[_0xa613('0x7f')](_0x19d2dc[_0xa613('0x64')]['from'])){throw new db['Sequelize'][(_0xa613('0x78'))](_0xa613('0x80'));}if(_[_0xa613('0x7f')](_0x19d2dc[_0xa613('0x64')][_0xa613('0x64')])||_0x19d2dc['body'][_0xa613('0x64')]===''){throw new db['Sequelize'][(_0xa613('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa613('0x7f')](_0x19d2dc[_0xa613('0x64')][_0xa613('0x81')])){throw new db[(_0xa613('0x77'))][(_0xa613('0x78'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x468ef4);}if(!_['includes'](_0x468ef4,_0x19d2dc[_0xa613('0x64')][_0xa613('0x81')])){throw new db['Sequelize']['ValidationError'](_0xa613('0x82')+_0x468ef4);}_0x18ea7a[_0x19d2dc['body']['mapKey']]=_0x19d2dc['body']['from'];})[_0xa613('0x24')](function(){return db['OpenchannelAccount'][_0xa613('0x5c')]({'where':{'id':_0x19d2dc[_0xa613('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xa613('0x83'),'include':[{'model':db[_0xa613('0x76')],'as':_0xa613('0x84'),'where':_0x18ea7a,'limit':0x1,'order':[[_0xa613('0x7c'),'DESC']]}]},{'model':db[_0xa613('0x85')],'as':_0xa613('0x86')}]});})[_0xa613('0x24')](handleEntityNotFound(_0x2dbcc0,null))[_0xa613('0x24')](function(_0x378cef){if(_0x378cef&&_0x378cef[_0xa613('0x83')]){_0x21494f['account']=_0x378cef;_0x21494f[_0xa613('0x87')]=_0x378cef['Applications'];_0x21494f['list']=_0x378cef['List'];_0x21494f[_0xa613('0x87')]=_[_0xa613('0x88')](_0x21494f[_0xa613('0x87')],['priority'],[_0xa613('0x89')]);if(_0x21494f['account'][_0xa613('0x86')]){delete _0x21494f[_0xa613('0x8a')][_0xa613('0x86')];}if(_0x21494f[_0xa613('0x8a')][_0xa613('0x83')]&&_0x21494f[_0xa613('0x8a')][_0xa613('0x83')][_0xa613('0x84')][_0xa613('0x4b')]){return _0x21494f[_0xa613('0x8a')]['List'][_0xa613('0x84')][0x0];}var _0xc25cac=_[_0xa613('0x1b')](_0x19d2dc[_0xa613('0x64')],{'firstName':_0x19d2dc[_0xa613('0x64')][_0xa613('0x8b')],'ListId':_0x378cef[_0xa613('0x7e')]});_0xc25cac[_0x19d2dc[_0xa613('0x64')][_0xa613('0x81')]]=_0x19d2dc['body'][_0xa613('0x8b')];return db[_0xa613('0x76')][_0xa613('0x5d')](_0xc25cac,{'fields':_0x222f2f,'raw':!![]});}})['then'](handleEntityNotFound(_0x2dbcc0,null))[_0xa613('0x24')](function(_0x4f9afc){_0x21494f[_0xa613('0x8c')]=_0x4f9afc;if(_0x4f9afc){var _0x19422b={'ContactId':_0x4f9afc['id'],'OpenchannelAccountId':_0x19d2dc[_0xa613('0x57')]['id'],'from':(_0x4f9afc['firstName']||'')+'\x20'+(_0x4f9afc['lastName']||'')};var _0x146f72={'OpenchannelAccountId':_0x19d2dc[_0xa613('0x57')]['id'],'closed':![]};if(_0x19d2dc[_0xa613('0x64')]['threadId']){_0x146f72[_0xa613('0x8d')]=_0x19d2dc['body'][_0xa613('0x8d')];return db['OpenchannelInteraction'][_0xa613('0x5c')]({'where':_0x146f72})[_0xa613('0x24')](function(_0x16b8cd){if(_0x16b8cd){return[_0x16b8cd,![]];}_0x19422b['threadId']=_0x19d2dc[_0xa613('0x64')]['threadId'];_0x19422b['externalUrl']=_0x19d2dc[_0xa613('0x64')][_0xa613('0x8e')];return db['OpenchannelInteraction']['create'](_0x19422b)[_0xa613('0x24')](function(_0x3764a5){return[_0x3764a5,!![]];});});}else{_0x146f72[_0xa613('0x8d')]=null;}_0x146f72[_0xa613('0x8f')]=_0x4f9afc['id'];return db['OpenchannelInteraction'][_0xa613('0x5c')]({'where':_0x146f72})[_0xa613('0x24')](function(_0x11289f){if(_0x11289f){return[_0x11289f,![]];}return db[_0xa613('0x90')][_0xa613('0x5d')](_0x19422b)['then'](function(_0x58b12a){return[_0x58b12a,!![]];});});}})[_0xa613('0x91')](function(_0x12ba92,_0x2b5205){if(_0x12ba92){_0x39cdb1=_0x2b5205;if(!_0x2b5205){var _0x4d2c55={'from':(_0x21494f[_0xa613('0x8c')]['firstName']||'')+'\x20'+(_0x21494f[_0xa613('0x8c')][_0xa613('0x92')]||'')};if(_0x19d2dc[_0xa613('0x64')]['threadId']&&_0x19d2dc[_0xa613('0x64')][_0xa613('0x93')]&&_0x19d2dc[_0xa613('0x64')][_0xa613('0x8d')]!=_0x19d2dc['body'][_0xa613('0x93')]){_0x4d2c55[_0xa613('0x8d')]=_0x19d2dc['body'][_0xa613('0x93')];}return _0x12ba92[_0xa613('0x38')](_0x4d2c55);}else{return _0x12ba92;}}})[_0xa613('0x24')](function(_0x453102){_0x21494f[_0xa613('0x94')]=_0x453102[_0xa613('0x3a')]({'plain':!![]});_0x21494f[_0xa613('0x94')][_0xa613('0x95')]=_0x39cdb1;if(_0x21494f[_0xa613('0x94')]['created']){if(_0x21494f['account']['autoclose']){_0x21494f[_0xa613('0x87')][_0xa613('0x96')]({'id':0x0,'priority':_0x21494f[_0xa613('0x87')][_0xa613('0x4b')]+0x1,'app':_0xa613('0x97'),'appdata':_0xa613('0x98'),'interval':'*,*,*,*'});}}return db[_0xa613('0x99')][_0xa613('0x5d')]({'body':_0x19d2dc['body'][_0xa613('0x64')],'OpenchannelAccountId':_0x19d2dc[_0xa613('0x57')]['id'],'OpenchannelInteractionId':_0x453102['id'],'direction':'in','ContactId':_0x21494f[_0xa613('0x8c')]['id'],'AttachmentId':_0x19d2dc[_0xa613('0x64')][_0xa613('0x9a')]});})['then'](function(_0x5132c2){_0x21494f[_0xa613('0x2d')]=_0x5132c2;if(_0x21494f[_0xa613('0x94')]['UserId']){return db[_0xa613('0x9b')][_0xa613('0x5c')]({'attributes':['id',_0xa613('0x3e')],'where':{'id':_0x21494f[_0xa613('0x94')][_0xa613('0x9c')]}})[_0xa613('0x24')](function(_0x176728){if(_0x176728){_0x21494f['applications'][_0xa613('0x9d')]({'id':0x0,'priority':0x0,'app':_0xa613('0x9e'),'appdata':_0x176728[_0xa613('0x3e')]+','+(_0x21494f[_0xa613('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':_0xa613('0x9f')});_0x21494f['forcedOwnership']=![];}return respondWithRpcPromise('Start','startRouting',_0x21494f);});}return respondWithRpcPromise(_0xa613('0xa0'),_0xa613('0xa1'),_0x21494f);})[_0xa613('0x24')](function(_0x2a1aef){respondWithRpcPromise(_0xa613('0xa2'),'EventManager',{'event':_0xa613('0x75'),'message':_0x2a1aef},client9002);return _0x2a1aef;})[_0xa613('0x24')](respondWithResult(_0x2dbcc0,null))['catch'](handleError(_0x2dbcc0,null));};exports[_0xa613('0xa3')]=function(_0x49eb5b,_0xd4c743,_0x575792){return db[_0xa613('0x42')][_0xa613('0x69')]({'where':{'id':_0x49eb5b[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0xd4c743,null))[_0xa613('0x24')](function(_0x1ec065){if(_0x1ec065){return db['sequelize'][_0xa613('0xa4')](function(_0x49a131){return db[_0xa613('0x85')][_0xa613('0x39')]({'where':{'OpenchannelAccountId':_0x49eb5b[_0xa613('0x57')]['id']},'transaction':_0x49a131})['then'](function(_0x27498f){var _0x3940a5=_[_0xa613('0x41')](_0x49eb5b[_0xa613('0x64')],function(_0xc29d11){_0xc29d11[_0xa613('0x67')]=_0x49eb5b['params']['id'];return _0xc29d11;});return db[_0xa613('0x85')]['bulkCreate'](_0x3940a5,{'transaction':_0x49a131});});})[_0xa613('0x24')](function(){return db[_0xa613('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x49eb5b[_0xa613('0x57')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0xd4c743,null))[_0xa613('0x2f')](handleError(_0xd4c743,null));};exports[_0xa613('0xa5')]=function(_0x1c3be5,_0x3c5ed8,_0x4d4c34){var _0x3f377a={};var _0x23946b={};var _0x216208;var _0x5dd0eb;return db[_0xa613('0x42')][_0xa613('0x69')]({'where':{'id':_0x1c3be5[_0xa613('0x57')]['id']}})['then'](handleEntityNotFound(_0x3c5ed8,null))[_0xa613('0x24')](function(_0x44c9ac){if(_0x44c9ac){_0x216208=_0x44c9ac;_0x23946b[_0xa613('0x46')]=_[_0xa613('0x5a')](db[_0xa613('0x85')][_0xa613('0x6b')]);_0x23946b[_0xa613('0x47')]=_['keys'](_0x1c3be5[_0xa613('0x47')]);_0x23946b[_0xa613('0x5b')]=_['intersection'](_0x23946b[_0xa613('0x46')],_0x23946b[_0xa613('0x47')]);_0x3f377a['attributes']=_[_0xa613('0x48')](_0x23946b[_0xa613('0x46')],qs[_0xa613('0x4a')](_0x1c3be5[_0xa613('0x47')][_0xa613('0x4a')]));_0x3f377a['attributes']=_0x3f377a[_0xa613('0x49')][_0xa613('0x4b')]?_0x3f377a[_0xa613('0x49')]:_0x23946b[_0xa613('0x46')];_0x3f377a['order']=qs[_0xa613('0x4e')](_0x1c3be5[_0xa613('0x47')]['sort']);_0x3f377a[_0xa613('0x4f')]=qs['filters'](_[_0xa613('0xa6')](_0x1c3be5[_0xa613('0x47')],_0x23946b['filters']));if(_0x1c3be5[_0xa613('0x47')][_0xa613('0x51')]){_0x3f377a[_0xa613('0x4f')]=_[_0xa613('0x50')](_0x3f377a[_0xa613('0x4f')],{'$or':_[_0xa613('0x41')](_0x3f377a[_0xa613('0x49')],function(_0x432ca6){var _0x1b6e87={};_0x1b6e87[_0x432ca6]={'$like':'%'+_0x1c3be5[_0xa613('0x47')][_0xa613('0x51')]+'%'};return _0x1b6e87;})});}_0x3f377a=_[_0xa613('0x50')]({},_0x3f377a,_0x1c3be5[_0xa613('0x52')]);return _0x216208[_0xa613('0xa5')](_0x3f377a);}})[_0xa613('0x24')](function(_0x382e25){if(_0x382e25){_0x5dd0eb=_0x382e25['length'];if(!_0x1c3be5[_0xa613('0x47')][_0xa613('0x4c')](_0xa613('0x73'))){_0x3f377a[_0xa613('0x4d')]=qs[_0xa613('0x4d')](_0x1c3be5['query'][_0xa613('0x4d')]);_0x3f377a['offset']=qs['offset'](_0x1c3be5['query']['offset']);}return _0x216208[_0xa613('0xa5')](_0x3f377a);}})[_0xa613('0x24')](function(_0x3a075a){if(_0x3a075a){return _0x3a075a?{'count':_0x5dd0eb,'rows':_0x3a075a}:null;}})[_0xa613('0x24')](respondWithResult(_0x3c5ed8,null))[_0xa613('0x2f')](handleError(_0x3c5ed8,null));};exports[_0xa613('0xa7')]=function(_0x536b35,_0x2ddca5,_0x363e39){var _0x273936={'raw':![],'where':{}};var _0x229ed7={};var _0x1237cc={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x536b35[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x2ddca5,null))['then'](function(_0x1949eb){if(_0x1949eb){_0x229ed7[_0xa613('0x46')]=_[_0xa613('0x5a')](db[_0xa613('0x90')][_0xa613('0x6b')]);_0x229ed7[_0xa613('0x47')]=_[_0xa613('0x5a')](_0x536b35[_0xa613('0x47')]);_0x229ed7[_0xa613('0x5b')]=_[_0xa613('0x48')](_0x229ed7[_0xa613('0x46')],_0x229ed7[_0xa613('0x47')]);_0x273936['attributes']=_['intersection'](_0x229ed7[_0xa613('0x46')],qs[_0xa613('0x4a')](_0x536b35[_0xa613('0x47')]['fields']));_0x273936[_0xa613('0x49')]=_0x273936[_0xa613('0x49')][_0xa613('0x4b')]?_0x273936[_0xa613('0x49')]:_0x229ed7[_0xa613('0x46')];if(!_0x536b35[_0xa613('0x47')][_0xa613('0x4c')]('nolimit')){_0x273936[_0xa613('0x4d')]=qs[_0xa613('0x4d')](_0x536b35[_0xa613('0x47')][_0xa613('0x4d')]);_0x273936['offset']=qs[_0xa613('0x34')](_0x536b35['query']['offset']);}_0x273936[_0xa613('0x6c')]=qs[_0xa613('0x4e')](_0x536b35[_0xa613('0x47')][_0xa613('0x4e')]);_0x273936['where']=qs['filters'](_[_0xa613('0xa6')](_0x536b35[_0xa613('0x47')],_0x229ed7[_0xa613('0x5b')]));_0x273936['where'][_0xa613('0x67')]=_0x1949eb['id'];if(_0x536b35[_0xa613('0x47')]['filter']){_0x273936['where']=_[_0xa613('0x50')](_0x273936['where'],{'$or':_[_0xa613('0x41')](_0x273936['attributes'],function(_0x56591c){var _0x29e585={};_0x29e585[_0x56591c]={'$like':'%'+_0x536b35[_0xa613('0x47')][_0xa613('0x51')]+'%'};return _0x29e585;})});}_0x273936=_[_0xa613('0x50')]({},_0x273936,_0x536b35[_0xa613('0x52')]);return db['OpenchannelInteraction']['count']({'where':_0x273936[_0xa613('0x4f')]})[_0xa613('0x24')](function(_0x2ac937){_0x1237cc[_0xa613('0x33')]=_0x2ac937;if(_0x536b35[_0xa613('0x47')]['includeAll']){_0x273936[_0xa613('0x54')]=[{'model':db[_0xa613('0x76')],'as':_0xa613('0xa8'),'required':![]},{'model':db[_0xa613('0x9b')],'as':_0xa613('0xa9'),'attributes':[_0xa613('0x3e'),_0xa613('0xaa'),_0xa613('0xab')],'required':![]},{'model':db[_0xa613('0xac')],'as':_0xa613('0xad'),'attributes':['id',_0xa613('0x3e'),_0xa613('0xae')],'where':_0x536b35['query']['tag']?{'id':_0x536b35[_0xa613('0x47')][_0xa613('0xaf')]}:undefined,'required':_0x536b35[_0xa613('0x47')][_0xa613('0xaf')]?!![]:![]}];}return db[_0xa613('0x90')][_0xa613('0x6d')](_0x273936);})[_0xa613('0x24')](function(_0x437258){_0x1237cc[_0xa613('0x55')]=_0x437258;return _0x1237cc;});}})[_0xa613('0x24')](respondWithFilteredResult(_0x2ddca5,_0x273936))[_0xa613('0x2f')](handleError(_0x2ddca5,null));};exports[_0xa613('0xb0')]=function(_0x3251e0,_0x51ce19,_0x356677){return db['OpenchannelAccount'][_0xa613('0x5c')]({'where':{'id':_0x3251e0['params']['id']}})['then'](handleEntityNotFound(_0x51ce19,null))[_0xa613('0x24')](function(_0x3290bf){if(_0x3290bf){return _0x3290bf[_0xa613('0xb0')](_0x3251e0[_0xa613('0x64')][_0xa613('0x6f')],_[_0xa613('0xb1')](_0x3251e0[_0xa613('0x64')],[_0xa613('0x6f'),'id'])||{})[_0xa613('0x91')](function(_0x529e21){for(var _0x15244e=0x0;_0x15244e<_0x3251e0[_0xa613('0x64')][_0xa613('0x6f')][_0xa613('0x4b')];_0x15244e+=0x1){socket[_0xa613('0xb2')]('userOpenchannelAccount:save',{'UserId':_0x3251e0[_0xa613('0x64')]['ids'][_0x15244e],'OpenchannelAccountId':_0x3251e0[_0xa613('0x57')]['id']});}return _0x529e21;});}})[_0xa613('0x24')](respondWithResult(_0x51ce19,null))[_0xa613('0x2f')](handleError(_0x51ce19,null));};exports[_0xa613('0xb3')]=function(_0x5b4e56,_0xcc6ea0,_0x1c5364){return db[_0xa613('0x42')][_0xa613('0x5c')]({'where':{'id':_0x5b4e56[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0xcc6ea0,null))['then'](function(_0x2baf6e){if(_0x2baf6e){return _0x2baf6e['removeAgents'](_0x5b4e56[_0xa613('0x47')][_0xa613('0x6f')])[_0xa613('0x24')](function(){if(_['isArray'](_0x5b4e56[_0xa613('0x47')][_0xa613('0x6f')])){for(var _0x5d1079=0x0;_0x5d1079<_0x5b4e56[_0xa613('0x47')][_0xa613('0x6f')][_0xa613('0x4b')];_0x5d1079+=0x1){socket[_0xa613('0xb2')](_0xa613('0xb4'),{'UserId':Number(_0x5b4e56[_0xa613('0x47')]['ids'][_0x5d1079]),'OpenchannelAccountId':Number(_0x5b4e56[_0xa613('0x57')]['id'])});}}else{socket[_0xa613('0xb2')](_0xa613('0xb4'),{'UserId':Number(_0x5b4e56[_0xa613('0x47')]['ids']),'OpenchannelAccountId':Number(_0x5b4e56['params']['id'])});}});}})['then'](respondWithStatusCode(_0xcc6ea0,null))[_0xa613('0x2f')](handleError(_0xcc6ea0,null));};exports['getAgents']=function(_0xf246ad,_0x29555a,_0x15c29c){var _0x175987={};var _0x361cb8={};var _0x27377e;var _0x5ddf11;return db[_0xa613('0x42')]['findOne']({'where':{'id':_0xf246ad[_0xa613('0x57')]['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x29555a,null))['then'](function(_0x5333a4){if(_0x5333a4){_0x27377e=_0x5333a4;_0x361cb8[_0xa613('0x46')]=_[_0xa613('0x5a')](db[_0xa613('0x9b')][_0xa613('0x6b')]);_0x361cb8[_0xa613('0x47')]=_[_0xa613('0x5a')](_0xf246ad[_0xa613('0x47')]);_0x361cb8[_0xa613('0x5b')]=_[_0xa613('0x48')](_0x361cb8[_0xa613('0x46')],_0x361cb8[_0xa613('0x47')]);_0x175987[_0xa613('0x49')]=_['intersection'](_0x361cb8['model'],qs[_0xa613('0x4a')](_0xf246ad['query'][_0xa613('0x4a')]));_0x175987[_0xa613('0x49')]=_0x175987[_0xa613('0x49')][_0xa613('0x4b')]?_0x175987[_0xa613('0x49')]:_0x361cb8['model'];_0x175987['order']=qs['sort'](_0xf246ad[_0xa613('0x47')][_0xa613('0x4e')]);_0x175987[_0xa613('0x4f')]=qs[_0xa613('0x5b')](_[_0xa613('0xa6')](_0xf246ad['query'],_0x361cb8[_0xa613('0x5b')]));if(_0xf246ad['query'][_0xa613('0x51')]){_0x175987['where']=_[_0xa613('0x50')](_0x175987['where'],{'$or':_[_0xa613('0x41')](_0x175987[_0xa613('0x49')],function(_0x49de29){var _0x386436={};_0x386436[_0x49de29]={'$like':'%'+_0xf246ad[_0xa613('0x47')][_0xa613('0x51')]+'%'};return _0x386436;})});}_0x175987=_[_0xa613('0x50')]({},_0x175987,_0xf246ad[_0xa613('0x52')]);return _0x27377e['getAgents'](_0x175987);}})[_0xa613('0x24')](function(_0x5f5c6e){if(_0x5f5c6e){_0x5ddf11=_0x5f5c6e[_0xa613('0x4b')];if(!_0xf246ad[_0xa613('0x47')]['hasOwnProperty'](_0xa613('0x73'))){_0x175987['limit']=qs[_0xa613('0x4d')](_0xf246ad[_0xa613('0x47')][_0xa613('0x4d')]);_0x175987[_0xa613('0x34')]=qs[_0xa613('0x34')](_0xf246ad[_0xa613('0x47')][_0xa613('0x34')]);}return _0x27377e[_0xa613('0xb5')](_0x175987);}})[_0xa613('0x24')](function(_0x3e7df7){if(_0x3e7df7){return _0x3e7df7?{'count':_0x5ddf11,'rows':_0x3e7df7}:null;}})[_0xa613('0x24')](respondWithResult(_0x29555a,null))['catch'](handleError(_0x29555a,null));};exports[_0xa613('0x3f')]=function(_0x181a6c,_0x4393b2,_0x1cce8d){var _0x55512f,_0x484a76,_0x505873;if(_[_0xa613('0x7f')](_0x181a6c['body'][_0xa613('0x64')])||_0x181a6c['body'][_0xa613('0x64')]===''){throw new db[(_0xa613('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x181a6c[_0xa613('0x64')]['to'])){}_0x55512f=_0x181a6c[_0xa613('0x64')]['to'];return db[_0xa613('0x42')][_0xa613('0x69')]({'where':{'id':_0x181a6c['params']['id']}})[_0xa613('0x24')](handleEntityNotFound(_0x4393b2,null))['then'](function(_0x7206ff){if(_0x7206ff){return db[_0xa613('0x42')][_0xa613('0x5c')]({'where':{'id':_0x7206ff['id']},'include':[{'model':db['CmList'],'as':_0xa613('0x83'),'include':[{'model':db[_0xa613('0x76')],'as':'Contacts','where':{[_0x7206ff[_0xa613('0x81')]]:_0x55512f},'limit':0x1,'order':[[_0xa613('0x7c'),'DESC']]}]}]})[_0xa613('0x24')](handleEntityNotFound(_0x4393b2,null))['then'](function(_0x2f83aa){if(_0x2f83aa&&_0x2f83aa[_0xa613('0x83')]){_0x484a76=_0x2f83aa['get']({'plain':!![]});if(_0x484a76[_0xa613('0x83')]&&_0x484a76[_0xa613('0x83')][_0xa613('0x84')][_0xa613('0x4b')]){return _0x484a76[_0xa613('0x83')][_0xa613('0x84')][0x0];}return db['CmContact'][_0xa613('0x5d')](_[_0xa613('0x1b')](_0x181a6c[_0xa613('0x64')],{'firstName':_0x55512f,[_0x2f83aa['mapKey']]:_0x55512f,'phone':_0x55512f,'ListId':_0x484a76[_0xa613('0x7e')]}));}})['then'](handleEntityNotFound(_0x4393b2,null))[_0xa613('0x24')](function(_0x393aac){if(_0x393aac){_0x505873=_0x393aac;return db[_0xa613('0x90')][_0xa613('0x5c')]({'where':{'ContactId':_0x505873['id'],'closed':![],'OpenchannelAccountId':_0x484a76['id']}})['then'](function(_0x4dfa65){if(_0x4dfa65){return[_0x4dfa65,![]];}return db[_0xa613('0x90')][_0xa613('0x5d')]({'UserId':_0x181a6c[_0xa613('0x5f')]['id'],'ContactId':_0x505873['id'],'OpenchannelAccountId':_0x484a76['id'],'lastMsgDirection':_0xa613('0xb6'),'Messages':[_[_0xa613('0x50')](_0x181a6c[_0xa613('0x64')],{'read':![],'body':_0x181a6c[_0xa613('0x64')][_0xa613('0x64')],'OpenchannelAccountId':_0x484a76['id'],'UserId':_0x181a6c[_0xa613('0x5f')]['id'],'ContactId':_0x505873['id']})]},{'include':[{'model':db[_0xa613('0x99')],'as':_0xa613('0xb7')}]})[_0xa613('0x24')](function(_0x87368f){return[_0x87368f,!![]];});});}})[_0xa613('0x91')](function(_0x14a82f,_0x4120ab){if(_0x4120ab){return _0x14a82f;}return db[_0xa613('0x99')][_0xa613('0x5d')](_[_0xa613('0x50')](_0x181a6c['body'],{'read':![],'body':_0x181a6c[_0xa613('0x64')][_0xa613('0x64')],'OpenchannelAccountId':_0x484a76['id'],'OpenchannelInteractionId':_0x14a82f['id'],'UserId':_0x181a6c['user']['id'],'ContactId':_0x505873['id']}))[_0xa613('0x24')](function(_0x2e36e6){_0x14a82f[_0xa613('0xb8')][_0xa613('0xb7')]=[];_0x14a82f['dataValues']['Messages']['push'](_0x2e36e6['dataValues']);return _0x14a82f;});});}})['then'](respondWithResult(_0x4393b2,null))[_0xa613('0x2f')](handleError(_0x4393b2,null));}; \ No newline at end of file +var _0x1d7b=['dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','options','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','updatedAt','DESC','OpenchannelApplication','Applications','applications','list','priority','asc','account','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','OpenchannelMessage','Messages'];(function(_0x53be08,_0x4b4609){var _0xe0a29c=function(_0x4b5095){while(--_0x4b5095){_0x53be08['push'](_0x53be08['shift']());}};_0xe0a29c(++_0x4b4609);}(_0x1d7b,0xb9));var _0xb1d7=function(_0x8f45e5,_0x4e1695){_0x8f45e5=_0x8f45e5-0x0;var _0x57c49e=_0x1d7b[_0x8f45e5];return _0x57c49e;};'use strict';var pdf=require(_0xb1d7('0x0'));var emlformat=require(_0xb1d7('0x1'));var rimraf=require(_0xb1d7('0x2'));var zipdir=require(_0xb1d7('0x3'));var jsonpatch=require(_0xb1d7('0x4'));var rp=require(_0xb1d7('0x5'));var moment=require(_0xb1d7('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb1d7('0x7'));var path=require(_0xb1d7('0x8'));var sox=require(_0xb1d7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb1d7('0xa'));var squel=require('squel');var crypto=require(_0xb1d7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb1d7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1d7('0xd'));var qs=require(_0xb1d7('0xe'));var as=require(_0xb1d7('0xf'));var hardwareService=require(_0xb1d7('0x10'));var logger=require(_0xb1d7('0x11'))(_0xb1d7('0x12'));var utils=require('../../config/utils');var config=require(_0xb1d7('0x13'));var licenseUtil=require(_0xb1d7('0x14'));var db=require(_0xb1d7('0x15'))['db'];config[_0xb1d7('0x16')]=_[_0xb1d7('0x17')](config[_0xb1d7('0x16')],{'host':_0xb1d7('0x18'),'port':0x18eb});var socket=require(_0xb1d7('0x19'))(new Redis(config['redis']));require(_0xb1d7('0x1a'))[_0xb1d7('0x1b')](socket);var jayson=require(_0xb1d7('0x1c'));var client=jayson[_0xb1d7('0x1d')][_0xb1d7('0x1e')]({'port':0x232c});var client9002=jayson[_0xb1d7('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x458350,_0x2e2bdc,_0x368de9,_0x28068c){return new BPromise(function(_0x3cd53c,_0xad2b82){var _0x354440=_0x28068c||client;return _0x354440[_0xb1d7('0x1f')](_0x458350,_0x368de9)['then'](function(_0x17cce2){logger['info'](_0xb1d7('0x20'),_0x2e2bdc,_0xb1d7('0x21'));logger[_0xb1d7('0x22')](_0xb1d7('0x23'),_0x2e2bdc,'request\x20sent',JSON[_0xb1d7('0x24')](_0x17cce2));if(_0x17cce2[_0xb1d7('0x25')]){if(_0x17cce2[_0xb1d7('0x25')][_0xb1d7('0x26')]===0x1f4){logger[_0xb1d7('0x25')](_0xb1d7('0x20'),_0x2e2bdc,_0x17cce2[_0xb1d7('0x25')][_0xb1d7('0x27')]);return _0xad2b82(_0x17cce2[_0xb1d7('0x25')]['message']);}logger[_0xb1d7('0x25')](_0xb1d7('0x20'),_0x2e2bdc,_0x17cce2[_0xb1d7('0x25')][_0xb1d7('0x27')]);return _0x3cd53c(_0x17cce2[_0xb1d7('0x25')][_0xb1d7('0x27')]);}else{logger[_0xb1d7('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e2bdc,'request\x20sent');_0x3cd53c(_0x17cce2['result'][_0xb1d7('0x27')]);}})['catch'](function(_0x2689f4){logger[_0xb1d7('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e2bdc,_0x2689f4);_0xad2b82(_0x2689f4);});});}function respondWithStatusCode(_0x1a6168,_0x526cd4){_0x526cd4=_0x526cd4||0xcc;return function(_0xb5cc7b){if(_0xb5cc7b){return _0x1a6168['sendStatus'](_0x526cd4);}return _0x1a6168['status'](_0x526cd4)[_0xb1d7('0x29')]();};}function respondWithResult(_0x11dc04,_0x145dd7){_0x145dd7=_0x145dd7||0xc8;return function(_0x57e8f2){if(_0x57e8f2){return _0x11dc04[_0xb1d7('0x2a')](_0x145dd7)[_0xb1d7('0x2b')](_0x57e8f2);}};}function respondWithFilteredResult(_0x9b9d7,_0x57768f){return function(_0x389e81){if(_0x389e81){var _0x1941be=_0x389e81[_0xb1d7('0x2c')],_0x28508f=_0x57768f[_0xb1d7('0x2d')],_0x423a68=_0x57768f[_0xb1d7('0x2d')]+_0x57768f[_0xb1d7('0x2e')],_0x1cf760;if(_0x423a68>=_0x1941be){_0x423a68=_0x1941be;_0x1cf760=0xc8;}else{_0x1cf760=0xce;}_0x9b9d7[_0xb1d7('0x2a')](_0x1cf760);return _0x9b9d7['set'](_0xb1d7('0x2f'),_0x28508f+'-'+_0x423a68+'/'+_0x1941be)['json'](_0x389e81);}return null;};}function patchUpdates(_0x2bd3cb){return function(_0x1101a5){try{jsonpatch[_0xb1d7('0x30')](_0x1101a5,_0x2bd3cb,!![]);}catch(_0x4a8254){return BPromise[_0xb1d7('0x31')](_0x4a8254);}return _0x1101a5[_0xb1d7('0x32')]();};}function saveUpdates(_0x53eec2,_0x4955a3){return function(_0x38d9e3){if(_0x38d9e3){return _0x38d9e3[_0xb1d7('0x33')](_0x53eec2)[_0xb1d7('0x34')](function(_0x5c81ae){return _0x5c81ae;});}return null;};}function removeEntity(_0x540e60,_0x5c4076){return function(_0xc54708){if(_0xc54708){return _0xc54708[_0xb1d7('0x35')]()['then'](function(){var _0x1e231b=_0xc54708[_0xb1d7('0x36')]({'plain':!![]});var _0x4bd02f=_0xb1d7('0x37');return db[_0xb1d7('0x38')][_0xb1d7('0x35')]({'where':{'type':_0x4bd02f,'resourceId':_0x1e231b['id']}})[_0xb1d7('0x34')](function(){return _0xc54708;});})[_0xb1d7('0x34')](function(){_0x540e60['status'](0xcc)[_0xb1d7('0x29')]();});}};}function handleEntityNotFound(_0x341d74,_0x566acd){return function(_0x2d14f8){if(!_0x2d14f8){_0x341d74['sendStatus'](0x194);}return _0x2d14f8;};}function handleError(_0x7e7c57,_0x4d1e0b){_0x4d1e0b=_0x4d1e0b||0x1f4;return function(_0x1acf9e){logger['error'](_0x1acf9e['stack']);if(_0x1acf9e[_0xb1d7('0x39')]){delete _0x1acf9e[_0xb1d7('0x39')];}_0x7e7c57[_0xb1d7('0x2a')](_0x4d1e0b)[_0xb1d7('0x3a')](_0x1acf9e);};}exports['index']=function(_0x39ce8c,_0x6e9f50){var _0x2f2ead={'include':[{'model':db[_0xb1d7('0x3b')],'as':_0xb1d7('0x3c')}]},_0x8ca49b={},_0xff4ff3={'count':0x0,'rows':[]};var _0x3adef9=_[_0xb1d7('0x3d')](db['OpenchannelAccount'][_0xb1d7('0x3e')],function(_0x18ad98){return{'name':_0x18ad98[_0xb1d7('0x3f')],'type':_0x18ad98[_0xb1d7('0x40')][_0xb1d7('0x41')]};});_0x8ca49b[_0xb1d7('0x42')]=_[_0xb1d7('0x3d')](_0x3adef9,'name');_0x8ca49b[_0xb1d7('0x43')]=_[_0xb1d7('0x44')](_0x39ce8c[_0xb1d7('0x43')]);_0x8ca49b[_0xb1d7('0x45')]=_[_0xb1d7('0x46')](_0x8ca49b[_0xb1d7('0x42')],_0x8ca49b['query']);_0x2f2ead[_0xb1d7('0x47')]=_[_0xb1d7('0x46')](_0x8ca49b[_0xb1d7('0x42')],qs[_0xb1d7('0x48')](_0x39ce8c[_0xb1d7('0x43')][_0xb1d7('0x48')]));_0x2f2ead[_0xb1d7('0x47')]=_0x2f2ead['attributes'][_0xb1d7('0x49')]?_0x2f2ead[_0xb1d7('0x47')]:_0x8ca49b[_0xb1d7('0x42')];if(!_0x39ce8c['query'][_0xb1d7('0x4a')](_0xb1d7('0x4b'))){_0x2f2ead[_0xb1d7('0x2e')]=qs[_0xb1d7('0x2e')](_0x39ce8c[_0xb1d7('0x43')][_0xb1d7('0x2e')]);_0x2f2ead['offset']=qs[_0xb1d7('0x2d')](_0x39ce8c[_0xb1d7('0x43')][_0xb1d7('0x2d')]);}_0x2f2ead[_0xb1d7('0x4c')]=qs[_0xb1d7('0x4d')](_0x39ce8c[_0xb1d7('0x43')][_0xb1d7('0x4d')]);_0x2f2ead[_0xb1d7('0x4e')]=qs[_0xb1d7('0x45')](_['pick'](_0x39ce8c[_0xb1d7('0x43')],_0x8ca49b[_0xb1d7('0x45')]),_0x3adef9);if(_0x39ce8c[_0xb1d7('0x43')][_0xb1d7('0x4f')]){_0x2f2ead[_0xb1d7('0x4e')]=_[_0xb1d7('0x50')](_0x2f2ead[_0xb1d7('0x4e')],{'$or':_[_0xb1d7('0x3d')](_0x3adef9,function(_0x46caa5){if(_0x46caa5['type']!==_0xb1d7('0x51')){var _0xb37874={};_0xb37874[_0x46caa5[_0xb1d7('0x39')]]={'$like':'%'+_0x39ce8c['query']['filter']+'%'};return _0xb37874;}})});}_0x2f2ead=_['merge']({},_0x2f2ead,_0x39ce8c['options']);var _0x26b902={'where':_0x2f2ead[_0xb1d7('0x4e')]};return db[_0xb1d7('0x52')][_0xb1d7('0x2c')](_0x26b902)[_0xb1d7('0x34')](function(_0x4dba54){_0xff4ff3[_0xb1d7('0x2c')]=_0x4dba54;if(_0x39ce8c[_0xb1d7('0x43')][_0xb1d7('0x53')]){_0x2f2ead[_0xb1d7('0x54')]=[{'all':!![]}];}return db[_0xb1d7('0x52')][_0xb1d7('0x55')](_0x2f2ead);})[_0xb1d7('0x34')](function(_0x569710){_0xff4ff3[_0xb1d7('0x56')]=_0x569710;return _0xff4ff3;})[_0xb1d7('0x34')](respondWithFilteredResult(_0x6e9f50,_0x2f2ead))[_0xb1d7('0x57')](handleError(_0x6e9f50,null));};exports[_0xb1d7('0x58')]=function(_0x397d2a,_0x2ed495){var _0x4a7b23={'raw':![],'where':{'id':_0x397d2a['params']['id']},'include':[{'model':db[_0xb1d7('0x3b')],'as':_0xb1d7('0x3c')}]},_0x586814={};_0x586814['model']=_[_0xb1d7('0x44')](db[_0xb1d7('0x52')][_0xb1d7('0x3e')]);_0x586814[_0xb1d7('0x43')]=_[_0xb1d7('0x44')](_0x397d2a['query']);_0x586814['filters']=_[_0xb1d7('0x46')](_0x586814[_0xb1d7('0x42')],_0x586814[_0xb1d7('0x43')]);_0x4a7b23['attributes']=_['intersection'](_0x586814[_0xb1d7('0x42')],qs[_0xb1d7('0x48')](_0x397d2a[_0xb1d7('0x43')]['fields']));_0x4a7b23[_0xb1d7('0x47')]=_0x4a7b23[_0xb1d7('0x47')]['length']?_0x4a7b23[_0xb1d7('0x47')]:_0x586814[_0xb1d7('0x42')];if(_0x397d2a[_0xb1d7('0x43')]['includeAll']){_0x4a7b23[_0xb1d7('0x54')]=[{'all':!![]}];}_0x4a7b23=_[_0xb1d7('0x50')]({},_0x4a7b23,_0x397d2a['options']);return db['OpenchannelAccount'][_0xb1d7('0x59')](_0x4a7b23)[_0xb1d7('0x34')](handleEntityNotFound(_0x2ed495,null))[_0xb1d7('0x34')](respondWithResult(_0x2ed495,null))[_0xb1d7('0x57')](handleError(_0x2ed495,null));};exports['create']=function(_0x4ee3b3,_0x3700d5){return db[_0xb1d7('0x52')]['create'](_0x4ee3b3['body'],{})[_0xb1d7('0x34')](function(_0x123689){var _0x307965=_0x4ee3b3[_0xb1d7('0x5a')][_0xb1d7('0x36')]({'plain':!![]});if(!_0x307965)throw new Error(_0xb1d7('0x5b'));if(_0x307965[_0xb1d7('0x5c')]===_0xb1d7('0x5a')){var _0xf9cc07=_0x123689[_0xb1d7('0x36')]({'plain':!![]});var _0x44b52e=_0xb1d7('0x37');return db[_0xb1d7('0x5d')][_0xb1d7('0x59')]({'where':{'name':_0x44b52e,'userProfileId':_0x307965['userProfileId']},'raw':!![]})[_0xb1d7('0x34')](function(_0x12c8f5){if(_0x12c8f5&&_0x12c8f5[_0xb1d7('0x5e')]===0x0){return db[_0xb1d7('0x38')][_0xb1d7('0x5f')]({'name':_0xf9cc07[_0xb1d7('0x39')],'resourceId':_0xf9cc07['id'],'type':_0x12c8f5[_0xb1d7('0x39')],'sectionId':_0x12c8f5['id']},{})['then'](function(){return _0x123689;});}else{return _0x123689;}})[_0xb1d7('0x57')](function(_0x50921d){logger[_0xb1d7('0x25')](_0xb1d7('0x60'),_0x50921d);throw _0x50921d;});}return _0x123689;})['then'](respondWithResult(_0x3700d5,0xc9))[_0xb1d7('0x57')](handleError(_0x3700d5,null));};exports[_0xb1d7('0x33')]=function(_0x4b6b62,_0x573af7){if(_0x4b6b62[_0xb1d7('0x61')]['id']){delete _0x4b6b62[_0xb1d7('0x61')]['id'];}return db[_0xb1d7('0x52')][_0xb1d7('0x59')]({'where':{'id':_0x4b6b62[_0xb1d7('0x62')]['id']},'include':[{'model':db[_0xb1d7('0x3b')],'as':_0xb1d7('0x3c')}]})[_0xb1d7('0x34')](handleEntityNotFound(_0x573af7,null))[_0xb1d7('0x34')](saveUpdates(_0x4b6b62[_0xb1d7('0x61')],null))['then'](respondWithResult(_0x573af7,null))[_0xb1d7('0x57')](handleError(_0x573af7,null));};exports['destroy']=function(_0x44c1b3,_0x56159f){return db[_0xb1d7('0x52')][_0xb1d7('0x59')]({'where':{'id':_0x44c1b3[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x56159f,null))[_0xb1d7('0x34')](removeEntity(_0x56159f,null))['catch'](handleError(_0x56159f,null));};exports[_0xb1d7('0x63')]=function(_0x32a2ed,_0xf559b4){return db[_0xb1d7('0x52')][_0xb1d7('0x63')]()[_0xb1d7('0x34')](respondWithResult(_0xf559b4,null))[_0xb1d7('0x57')](handleError(_0xf559b4,null));};exports[_0xb1d7('0x64')]=function(_0x144105,_0x327c00,_0x1a0f28){if(_0x144105['body']['id']){delete _0x144105[_0xb1d7('0x61')]['id'];}return db[_0xb1d7('0x52')][_0xb1d7('0x59')]({'where':{'id':_0x144105[_0xb1d7('0x62')]['id']}})['then'](handleEntityNotFound(_0x327c00,null))[_0xb1d7('0x34')](function(_0x64c455){if(_0x64c455){_0x144105[_0xb1d7('0x61')][_0xb1d7('0x65')]=_0x64c455['id'];return db[_0xb1d7('0x66')]['create'](_0x144105[_0xb1d7('0x61')]);}})[_0xb1d7('0x34')](respondWithResult(_0x327c00,null))[_0xb1d7('0x57')](handleError(_0x327c00,null));};exports[_0xb1d7('0x67')]=function(_0x443047,_0x2fd556,_0x34f5a5){var _0x555a85={'raw':![],'where':{}};var _0x3c7470={};var _0x258066={'count':0x0,'rows':[]};return db[_0xb1d7('0x52')][_0xb1d7('0x68')]({'where':{'id':_0x443047[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x2fd556,null))[_0xb1d7('0x34')](function(_0x3ba299){if(_0x3ba299){_0x3c7470['model']=_[_0xb1d7('0x44')](db[_0xb1d7('0x66')]['rawAttributes']);_0x3c7470['query']=_[_0xb1d7('0x44')](_0x443047[_0xb1d7('0x43')]);_0x3c7470['filters']=_[_0xb1d7('0x46')](_0x3c7470[_0xb1d7('0x42')],_0x3c7470[_0xb1d7('0x43')]);_0x555a85[_0xb1d7('0x47')]=_['intersection'](_0x3c7470[_0xb1d7('0x42')],qs[_0xb1d7('0x48')](_0x443047[_0xb1d7('0x43')][_0xb1d7('0x48')]));_0x555a85[_0xb1d7('0x47')]=_0x555a85['attributes'][_0xb1d7('0x49')]?_0x555a85[_0xb1d7('0x47')]:_0x3c7470['model'];if(!_0x443047[_0xb1d7('0x43')][_0xb1d7('0x4a')](_0xb1d7('0x4b'))){_0x555a85[_0xb1d7('0x2e')]=qs[_0xb1d7('0x2e')](_0x443047[_0xb1d7('0x43')][_0xb1d7('0x2e')]);_0x555a85[_0xb1d7('0x2d')]=qs[_0xb1d7('0x2d')](_0x443047['query'][_0xb1d7('0x2d')]);}_0x555a85[_0xb1d7('0x4c')]=qs[_0xb1d7('0x4d')](_0x443047[_0xb1d7('0x43')][_0xb1d7('0x4d')]);_0x555a85[_0xb1d7('0x4e')]=qs[_0xb1d7('0x45')](_[_0xb1d7('0x69')](_0x443047[_0xb1d7('0x43')],_0x3c7470[_0xb1d7('0x45')]));_0x555a85[_0xb1d7('0x4e')][_0xb1d7('0x65')]=_0x3ba299['id'];if(_0x443047[_0xb1d7('0x43')][_0xb1d7('0x4f')]){_0x555a85['where']=_[_0xb1d7('0x50')](_0x555a85[_0xb1d7('0x4e')],{'$or':_[_0xb1d7('0x3d')](_0x555a85[_0xb1d7('0x47')],function(_0x5940cd){var _0xd900aa={};_0xd900aa[_0x5940cd]={'$like':'%'+_0x443047[_0xb1d7('0x43')]['filter']+'%'};return _0xd900aa;})});}_0x555a85=_[_0xb1d7('0x50')]({},_0x555a85,_0x443047['options']);return db[_0xb1d7('0x66')][_0xb1d7('0x2c')]({'where':_0x555a85['where']})[_0xb1d7('0x34')](function(_0x1c11d3){_0x258066[_0xb1d7('0x2c')]=_0x1c11d3;if(_0x443047[_0xb1d7('0x43')][_0xb1d7('0x53')]){_0x555a85[_0xb1d7('0x54')]=[{'all':!![]}];}return db[_0xb1d7('0x66')][_0xb1d7('0x55')](_0x555a85);})[_0xb1d7('0x34')](function(_0xa9dbd){_0x258066[_0xb1d7('0x56')]=_0xa9dbd;return _0x258066;});}})[_0xb1d7('0x34')](respondWithFilteredResult(_0x2fd556,_0x555a85))[_0xb1d7('0x57')](handleError(_0x2fd556,null));};exports[_0xb1d7('0x6a')]=function(_0x348a7c,_0x4172af,_0x41cd15){return db[_0xb1d7('0x52')][_0xb1d7('0x59')]({'where':{'id':_0x348a7c[_0xb1d7('0x62')]['id']}})['then'](handleEntityNotFound(_0x4172af,null))['then'](function(_0x1487da){if(_0x1487da){return _0x1487da[_0xb1d7('0x6a')](_0x348a7c[_0xb1d7('0x43')][_0xb1d7('0x6b')]);}})[_0xb1d7('0x34')](respondWithStatusCode(_0x4172af,null))[_0xb1d7('0x57')](handleError(_0x4172af,null));};exports[_0xb1d7('0x6c')]=function(_0x8f95da,_0x25e774,_0x187e60){if(_0x8f95da[_0xb1d7('0x61')]['id']){delete _0x8f95da['body']['id'];}return db[_0xb1d7('0x52')][_0xb1d7('0x59')]({'where':{'id':_0x8f95da['params']['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x25e774,null))[_0xb1d7('0x34')](function(_0x3892c7){if(_0x3892c7){_0x8f95da[_0xb1d7('0x61')][_0xb1d7('0x65')]=_0x3892c7['id'];return db[_0xb1d7('0x6d')][_0xb1d7('0x5f')](_0x8f95da[_0xb1d7('0x61')]);}})['then'](respondWithResult(_0x25e774,null))[_0xb1d7('0x57')](handleError(_0x25e774,null));};exports[_0xb1d7('0x6e')]=function(_0x5e2974,_0x5e3a83,_0x276431){var _0x2c19d7={'raw':![],'where':{}};var _0x3d72fd={};var _0x328c24={'count':0x0,'rows':[]};return db[_0xb1d7('0x52')][_0xb1d7('0x68')]({'where':{'id':_0x5e2974[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x5e3a83,null))[_0xb1d7('0x34')](function(_0x533bac){if(_0x533bac){_0x3d72fd[_0xb1d7('0x42')]=_[_0xb1d7('0x44')](db['CannedAnswer'][_0xb1d7('0x3e')]);_0x3d72fd[_0xb1d7('0x43')]=_[_0xb1d7('0x44')](_0x5e2974[_0xb1d7('0x43')]);_0x3d72fd['filters']=_[_0xb1d7('0x46')](_0x3d72fd[_0xb1d7('0x42')],_0x3d72fd[_0xb1d7('0x43')]);_0x2c19d7[_0xb1d7('0x47')]=_[_0xb1d7('0x46')](_0x3d72fd[_0xb1d7('0x42')],qs[_0xb1d7('0x48')](_0x5e2974[_0xb1d7('0x43')][_0xb1d7('0x48')]));_0x2c19d7[_0xb1d7('0x47')]=_0x2c19d7[_0xb1d7('0x47')][_0xb1d7('0x49')]?_0x2c19d7[_0xb1d7('0x47')]:_0x3d72fd[_0xb1d7('0x42')];if(!_0x5e2974[_0xb1d7('0x43')][_0xb1d7('0x4a')](_0xb1d7('0x4b'))){_0x2c19d7[_0xb1d7('0x2e')]=qs[_0xb1d7('0x2e')](_0x5e2974[_0xb1d7('0x43')][_0xb1d7('0x2e')]);_0x2c19d7[_0xb1d7('0x2d')]=qs[_0xb1d7('0x2d')](_0x5e2974[_0xb1d7('0x43')][_0xb1d7('0x2d')]);}_0x2c19d7[_0xb1d7('0x4c')]=qs[_0xb1d7('0x4d')](_0x5e2974[_0xb1d7('0x43')][_0xb1d7('0x4d')]);_0x2c19d7[_0xb1d7('0x4e')]=qs[_0xb1d7('0x45')](_['pick'](_0x5e2974['query'],_0x3d72fd[_0xb1d7('0x45')]));_0x2c19d7[_0xb1d7('0x4e')][_0xb1d7('0x65')]=_0x533bac['id'];if(_0x5e2974[_0xb1d7('0x43')]['filter']){_0x2c19d7['where']=_['merge'](_0x2c19d7[_0xb1d7('0x4e')],{'$or':_['map'](_0x2c19d7[_0xb1d7('0x47')],function(_0xa743a5){var _0x1a69c4={};_0x1a69c4[_0xa743a5]={'$like':'%'+_0x5e2974[_0xb1d7('0x43')]['filter']+'%'};return _0x1a69c4;})});}_0x2c19d7=_[_0xb1d7('0x50')]({},_0x2c19d7,_0x5e2974[_0xb1d7('0x6f')]);return db[_0xb1d7('0x6d')][_0xb1d7('0x2c')]({'where':_0x2c19d7[_0xb1d7('0x4e')]})[_0xb1d7('0x34')](function(_0x5868cc){_0x328c24[_0xb1d7('0x2c')]=_0x5868cc;if(_0x5e2974[_0xb1d7('0x43')][_0xb1d7('0x53')]){_0x2c19d7[_0xb1d7('0x54')]=[{'all':!![]}];}return db[_0xb1d7('0x6d')][_0xb1d7('0x55')](_0x2c19d7);})[_0xb1d7('0x34')](function(_0x2689a9){_0x328c24[_0xb1d7('0x56')]=_0x2689a9;return _0x328c24;});}})['then'](respondWithFilteredResult(_0x5e3a83,_0x2c19d7))[_0xb1d7('0x57')](handleError(_0x5e3a83,null));};exports[_0xb1d7('0x70')]=function(_0x1e4b3f,_0x2a8817,_0x93c8df){return db['OpenchannelAccount'][_0xb1d7('0x59')]({'where':{'id':_0x1e4b3f[_0xb1d7('0x62')]['id']}})['then'](handleEntityNotFound(_0x2a8817,null))[_0xb1d7('0x34')](function(_0x51e3f4){if(_0x51e3f4){return _0x51e3f4['removeAnswers'](_0x1e4b3f[_0xb1d7('0x43')]['ids']);}})[_0xb1d7('0x34')](respondWithStatusCode(_0x2a8817,null))[_0xb1d7('0x57')](handleError(_0x2a8817,null));};exports[_0xb1d7('0x71')]=function(_0x517121,_0x249300,_0x411f3d){var _0x14a111={'body':_0x517121[_0xb1d7('0x61')],'channel':_0xb1d7('0x72')};var _0x19e86e=[];var _0x3cb71d=[];var _0x33ddc0={};var _0x293c60=![];return db[_0xb1d7('0x73')][_0xb1d7('0x63')]()[_0xb1d7('0x34')](function(_0x8b6a64){if(!_0x8b6a64){throw new db[(_0xb1d7('0x74'))][(_0xb1d7('0x75'))]('no\x20available\x20attributes');}_0x19e86e=_['difference'](_[_0xb1d7('0x44')](_0x8b6a64),['createdAt','updatedAt']);_0x3cb71d=_[_0xb1d7('0x76')](_['keys'](_0x8b6a64),['createdAt','updatedAt',_0xb1d7('0x77'),_0xb1d7('0x78')]);if(_0x517121[_0xb1d7('0x61')]['id']){delete _0x517121[_0xb1d7('0x61')]['id'];}if(_[_0xb1d7('0x79')](_0x517121[_0xb1d7('0x61')][_0xb1d7('0x7a')])){throw new db[(_0xb1d7('0x74'))][(_0xb1d7('0x75'))]('from\x20is\x20mandatory');}if(_[_0xb1d7('0x79')](_0x517121[_0xb1d7('0x61')]['body'])||_0x517121[_0xb1d7('0x61')][_0xb1d7('0x61')]===''){throw new db[(_0xb1d7('0x74'))][(_0xb1d7('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb1d7('0x79')](_0x517121[_0xb1d7('0x61')][_0xb1d7('0x7b')])){throw new db[(_0xb1d7('0x74'))][(_0xb1d7('0x75'))](_0xb1d7('0x7c')+_0x3cb71d);}if(!_[_0xb1d7('0x7d')](_0x3cb71d,_0x517121[_0xb1d7('0x61')]['mapKey'])){throw new db['Sequelize'][(_0xb1d7('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb71d);}_0x33ddc0[_0x517121['body'][_0xb1d7('0x7b')]]=_0x517121[_0xb1d7('0x61')][_0xb1d7('0x7a')];})[_0xb1d7('0x34')](function(){return db[_0xb1d7('0x52')][_0xb1d7('0x59')]({'where':{'id':_0x517121['params']['id']},'include':[{'model':db[_0xb1d7('0x7e')],'as':_0xb1d7('0x7f'),'include':[{'model':db['CmContact'],'as':_0xb1d7('0x80'),'where':_0x33ddc0,'limit':0x1,'order':[[_0xb1d7('0x81'),_0xb1d7('0x82')]]}]},{'model':db[_0xb1d7('0x83')],'as':_0xb1d7('0x84')}]});})[_0xb1d7('0x34')](handleEntityNotFound(_0x249300,null))[_0xb1d7('0x34')](function(_0x48cf3f){if(_0x48cf3f&&_0x48cf3f[_0xb1d7('0x7f')]){_0x14a111['account']=_0x48cf3f;_0x14a111[_0xb1d7('0x85')]=_0x48cf3f[_0xb1d7('0x84')];_0x14a111[_0xb1d7('0x86')]=_0x48cf3f[_0xb1d7('0x7f')];_0x14a111['applications']=_['orderBy'](_0x14a111[_0xb1d7('0x85')],[_0xb1d7('0x87')],[_0xb1d7('0x88')]);if(_0x14a111[_0xb1d7('0x89')][_0xb1d7('0x84')]){delete _0x14a111['account'][_0xb1d7('0x84')];}if(_0x14a111[_0xb1d7('0x89')][_0xb1d7('0x7f')]&&_0x14a111[_0xb1d7('0x89')]['List'][_0xb1d7('0x80')]['length']){return _0x14a111['account']['List'][_0xb1d7('0x80')][0x0];}var _0x2c2784=_['defaults'](_0x517121[_0xb1d7('0x61')],{'firstName':_0x517121['body'][_0xb1d7('0x7a')],'ListId':_0x48cf3f[_0xb1d7('0x78')]});_0x2c2784[_0x517121[_0xb1d7('0x61')][_0xb1d7('0x7b')]]=_0x517121[_0xb1d7('0x61')][_0xb1d7('0x7a')];return db[_0xb1d7('0x73')][_0xb1d7('0x5f')](_0x2c2784,{'fields':_0x19e86e,'raw':!![]});}})[_0xb1d7('0x34')](handleEntityNotFound(_0x249300,null))[_0xb1d7('0x34')](function(_0x478021){_0x14a111[_0xb1d7('0x8a')]=_0x478021;if(_0x478021){var _0x34bbe9={'ContactId':_0x478021['id'],'OpenchannelAccountId':_0x517121[_0xb1d7('0x62')]['id'],'from':(_0x478021['firstName']||'')+'\x20'+(_0x478021[_0xb1d7('0x8b')]||'')};var _0x505af0={'OpenchannelAccountId':_0x517121[_0xb1d7('0x62')]['id'],'closed':![]};if(_0x517121[_0xb1d7('0x61')][_0xb1d7('0x8c')]){_0x505af0[_0xb1d7('0x8c')]=_0x517121[_0xb1d7('0x61')][_0xb1d7('0x8c')];return db[_0xb1d7('0x8d')][_0xb1d7('0x59')]({'where':_0x505af0})[_0xb1d7('0x34')](function(_0x38ffdd){if(_0x38ffdd){return[_0x38ffdd,![]];}_0x34bbe9[_0xb1d7('0x8c')]=_0x517121[_0xb1d7('0x61')][_0xb1d7('0x8c')];_0x34bbe9[_0xb1d7('0x8e')]=_0x517121[_0xb1d7('0x61')][_0xb1d7('0x8e')];return db[_0xb1d7('0x8d')][_0xb1d7('0x5f')](_0x34bbe9)[_0xb1d7('0x34')](function(_0x43ad06){return[_0x43ad06,!![]];});});}else{_0x505af0[_0xb1d7('0x8c')]=null;}_0x505af0[_0xb1d7('0x8f')]=_0x478021['id'];return db[_0xb1d7('0x8d')][_0xb1d7('0x59')]({'where':_0x505af0})['then'](function(_0x590d15){if(_0x590d15){return[_0x590d15,![]];}return db[_0xb1d7('0x8d')][_0xb1d7('0x5f')](_0x34bbe9)[_0xb1d7('0x34')](function(_0x4a01b7){return[_0x4a01b7,!![]];});});}})[_0xb1d7('0x90')](function(_0x39929a,_0x4252cd){if(_0x39929a){_0x293c60=_0x4252cd;if(!_0x4252cd){var _0x25db1d={'from':(_0x14a111['contact'][_0xb1d7('0x91')]||'')+'\x20'+(_0x14a111[_0xb1d7('0x8a')][_0xb1d7('0x8b')]||'')};if(_0x517121[_0xb1d7('0x61')][_0xb1d7('0x8c')]&&_0x517121['body'][_0xb1d7('0x92')]&&_0x517121[_0xb1d7('0x61')]['threadId']!=_0x517121[_0xb1d7('0x61')][_0xb1d7('0x92')]){_0x25db1d[_0xb1d7('0x8c')]=_0x517121['body']['messageId'];}return _0x39929a[_0xb1d7('0x33')](_0x25db1d);}else{return _0x39929a;}}})[_0xb1d7('0x34')](function(_0x47335f){_0x14a111[_0xb1d7('0x93')]=_0x47335f['get']({'plain':!![]});_0x14a111['interaction'][_0xb1d7('0x94')]=_0x293c60;if(_0x14a111['interaction'][_0xb1d7('0x94')]){if(_0x14a111[_0xb1d7('0x89')][_0xb1d7('0x95')]){_0x14a111[_0xb1d7('0x85')]['push']({'id':0x0,'priority':_0x14a111[_0xb1d7('0x85')][_0xb1d7('0x49')]+0x1,'app':_0xb1d7('0x96'),'appdata':'unmanaged','interval':_0xb1d7('0x97')});}}return db['OpenchannelMessage']['create']({'body':_0x517121[_0xb1d7('0x61')][_0xb1d7('0x61')],'OpenchannelAccountId':_0x517121[_0xb1d7('0x62')]['id'],'OpenchannelInteractionId':_0x47335f['id'],'direction':'in','ContactId':_0x14a111[_0xb1d7('0x8a')]['id'],'AttachmentId':_0x517121[_0xb1d7('0x61')][_0xb1d7('0x98')]});})[_0xb1d7('0x34')](function(_0x4c8219){_0x14a111['message']=_0x4c8219;if(_0x14a111['interaction'][_0xb1d7('0x99')]){return db[_0xb1d7('0x9a')]['find']({'attributes':['id',_0xb1d7('0x39')],'where':{'id':_0x14a111['interaction'][_0xb1d7('0x99')]}})['then'](function(_0x5941d0){if(_0x5941d0){_0x14a111[_0xb1d7('0x85')][_0xb1d7('0x9b')]({'id':0x0,'priority':0x0,'app':_0xb1d7('0x9c'),'appdata':_0x5941d0['name']+','+(_0x14a111[_0xb1d7('0x89')][_0xb1d7('0x9d')]||0xa),'interval':_0xb1d7('0x97')});_0x14a111[_0xb1d7('0x9e')]=![];}return respondWithRpcPromise(_0xb1d7('0x9f'),'startRouting',_0x14a111);});}return respondWithRpcPromise(_0xb1d7('0x9f'),_0xb1d7('0xa0'),_0x14a111);})['then'](function(_0x3482c1){respondWithRpcPromise(_0xb1d7('0xa1'),_0xb1d7('0xa1'),{'event':_0xb1d7('0x71'),'message':_0x3482c1},client9002);return _0x3482c1;})[_0xb1d7('0x34')](respondWithResult(_0x249300,null))[_0xb1d7('0x57')](handleError(_0x249300,null));};exports[_0xb1d7('0xa2')]=function(_0x253bca,_0x5624db,_0x3846a4){return db[_0xb1d7('0x52')][_0xb1d7('0x68')]({'where':{'id':_0x253bca[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x5624db,null))[_0xb1d7('0x34')](function(_0x4724ad){if(_0x4724ad){return db['sequelize'][_0xb1d7('0xa3')](function(_0x1821c5){return db['OpenchannelApplication'][_0xb1d7('0x35')]({'where':{'OpenchannelAccountId':_0x253bca[_0xb1d7('0x62')]['id']},'transaction':_0x1821c5})[_0xb1d7('0x34')](function(_0x5375c1){var _0x3c0ede=_[_0xb1d7('0x3d')](_0x253bca[_0xb1d7('0x61')],function(_0x4f2a76){_0x4f2a76[_0xb1d7('0x65')]=_0x253bca[_0xb1d7('0x62')]['id'];return _0x4f2a76;});return db['OpenchannelApplication'][_0xb1d7('0xa4')](_0x3c0ede,{'transaction':_0x1821c5});});})[_0xb1d7('0x34')](function(){return db[_0xb1d7('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x253bca[_0xb1d7('0x62')]['id']},'order':_0xb1d7('0x87')});});}})['then'](respondWithResult(_0x5624db,null))[_0xb1d7('0x57')](handleError(_0x5624db,null));};exports[_0xb1d7('0xa5')]=function(_0x31f843,_0x37e3ae,_0x47188d){var _0x589fff={};var _0x3b5fec={};var _0x274099;var _0x4e1ca2;return db['OpenchannelAccount'][_0xb1d7('0x68')]({'where':{'id':_0x31f843[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x37e3ae,null))['then'](function(_0x3e313f){if(_0x3e313f){_0x274099=_0x3e313f;_0x3b5fec[_0xb1d7('0x42')]=_[_0xb1d7('0x44')](db[_0xb1d7('0x83')][_0xb1d7('0x3e')]);_0x3b5fec[_0xb1d7('0x43')]=_[_0xb1d7('0x44')](_0x31f843['query']);_0x3b5fec['filters']=_[_0xb1d7('0x46')](_0x3b5fec['model'],_0x3b5fec[_0xb1d7('0x43')]);_0x589fff['attributes']=_['intersection'](_0x3b5fec[_0xb1d7('0x42')],qs[_0xb1d7('0x48')](_0x31f843[_0xb1d7('0x43')][_0xb1d7('0x48')]));_0x589fff[_0xb1d7('0x47')]=_0x589fff['attributes'][_0xb1d7('0x49')]?_0x589fff[_0xb1d7('0x47')]:_0x3b5fec[_0xb1d7('0x42')];_0x589fff['order']=qs[_0xb1d7('0x4d')](_0x31f843['query'][_0xb1d7('0x4d')]);_0x589fff[_0xb1d7('0x4e')]=qs[_0xb1d7('0x45')](_[_0xb1d7('0x69')](_0x31f843[_0xb1d7('0x43')],_0x3b5fec[_0xb1d7('0x45')]));if(_0x31f843[_0xb1d7('0x43')][_0xb1d7('0x4f')]){_0x589fff['where']=_['merge'](_0x589fff[_0xb1d7('0x4e')],{'$or':_[_0xb1d7('0x3d')](_0x589fff[_0xb1d7('0x47')],function(_0x38c415){var _0x44dedc={};_0x44dedc[_0x38c415]={'$like':'%'+_0x31f843[_0xb1d7('0x43')][_0xb1d7('0x4f')]+'%'};return _0x44dedc;})});}_0x589fff=_[_0xb1d7('0x50')]({},_0x589fff,_0x31f843['options']);return _0x274099[_0xb1d7('0xa5')](_0x589fff);}})[_0xb1d7('0x34')](function(_0x2075a0){if(_0x2075a0){_0x4e1ca2=_0x2075a0['length'];if(!_0x31f843[_0xb1d7('0x43')][_0xb1d7('0x4a')]('nolimit')){_0x589fff[_0xb1d7('0x2e')]=qs[_0xb1d7('0x2e')](_0x31f843[_0xb1d7('0x43')][_0xb1d7('0x2e')]);_0x589fff['offset']=qs[_0xb1d7('0x2d')](_0x31f843[_0xb1d7('0x43')][_0xb1d7('0x2d')]);}return _0x274099[_0xb1d7('0xa5')](_0x589fff);}})['then'](function(_0x1f6be9){if(_0x1f6be9){return _0x1f6be9?{'count':_0x4e1ca2,'rows':_0x1f6be9}:null;}})[_0xb1d7('0x34')](respondWithResult(_0x37e3ae,null))['catch'](handleError(_0x37e3ae,null));};exports['getInteractions']=function(_0x32d0d5,_0x1c1826,_0x1c63e1){var _0x31eb39={'raw':![],'where':{}};var _0x592bdc={};var _0x2b753c={'count':0x0,'rows':[]};return db[_0xb1d7('0x52')][_0xb1d7('0x68')]({'where':{'id':_0x32d0d5[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x1c1826,null))[_0xb1d7('0x34')](function(_0x18931e){if(_0x18931e){_0x592bdc[_0xb1d7('0x42')]=_[_0xb1d7('0x44')](db[_0xb1d7('0x8d')][_0xb1d7('0x3e')]);_0x592bdc[_0xb1d7('0x43')]=_[_0xb1d7('0x44')](_0x32d0d5[_0xb1d7('0x43')]);_0x592bdc[_0xb1d7('0x45')]=_[_0xb1d7('0x46')](_0x592bdc[_0xb1d7('0x42')],_0x592bdc[_0xb1d7('0x43')]);_0x31eb39[_0xb1d7('0x47')]=_[_0xb1d7('0x46')](_0x592bdc[_0xb1d7('0x42')],qs[_0xb1d7('0x48')](_0x32d0d5[_0xb1d7('0x43')][_0xb1d7('0x48')]));_0x31eb39['attributes']=_0x31eb39['attributes'][_0xb1d7('0x49')]?_0x31eb39[_0xb1d7('0x47')]:_0x592bdc['model'];if(!_0x32d0d5[_0xb1d7('0x43')][_0xb1d7('0x4a')](_0xb1d7('0x4b'))){_0x31eb39[_0xb1d7('0x2e')]=qs[_0xb1d7('0x2e')](_0x32d0d5['query'][_0xb1d7('0x2e')]);_0x31eb39[_0xb1d7('0x2d')]=qs[_0xb1d7('0x2d')](_0x32d0d5[_0xb1d7('0x43')][_0xb1d7('0x2d')]);}_0x31eb39[_0xb1d7('0x4c')]=qs[_0xb1d7('0x4d')](_0x32d0d5[_0xb1d7('0x43')][_0xb1d7('0x4d')]);_0x31eb39[_0xb1d7('0x4e')]=qs[_0xb1d7('0x45')](_[_0xb1d7('0x69')](_0x32d0d5[_0xb1d7('0x43')],_0x592bdc[_0xb1d7('0x45')]));_0x31eb39[_0xb1d7('0x4e')][_0xb1d7('0x65')]=_0x18931e['id'];if(_0x32d0d5[_0xb1d7('0x43')][_0xb1d7('0x4f')]){_0x31eb39[_0xb1d7('0x4e')]=_[_0xb1d7('0x50')](_0x31eb39['where'],{'$or':_[_0xb1d7('0x3d')](_0x31eb39[_0xb1d7('0x47')],function(_0x49be96){var _0x50378d={};_0x50378d[_0x49be96]={'$like':'%'+_0x32d0d5[_0xb1d7('0x43')][_0xb1d7('0x4f')]+'%'};return _0x50378d;})});}_0x31eb39=_[_0xb1d7('0x50')]({},_0x31eb39,_0x32d0d5[_0xb1d7('0x6f')]);return db[_0xb1d7('0x8d')]['count']({'where':_0x31eb39[_0xb1d7('0x4e')]})[_0xb1d7('0x34')](function(_0x395b2e){_0x2b753c[_0xb1d7('0x2c')]=_0x395b2e;if(_0x32d0d5[_0xb1d7('0x43')]['includeAll']){_0x31eb39[_0xb1d7('0x54')]=[{'model':db[_0xb1d7('0x73')],'as':_0xb1d7('0xa6'),'required':![]},{'model':db[_0xb1d7('0x9a')],'as':_0xb1d7('0xa7'),'attributes':[_0xb1d7('0x39'),_0xb1d7('0xa8'),_0xb1d7('0xa9')],'required':![]},{'model':db[_0xb1d7('0xaa')],'as':'Tags','attributes':['id',_0xb1d7('0x39'),_0xb1d7('0xab')],'where':_0x32d0d5[_0xb1d7('0x43')]['tag']?{'id':_0x32d0d5[_0xb1d7('0x43')][_0xb1d7('0xac')]}:undefined,'required':_0x32d0d5[_0xb1d7('0x43')]['tag']?!![]:![]}];}return db[_0xb1d7('0x8d')][_0xb1d7('0x55')](_0x31eb39);})[_0xb1d7('0x34')](function(_0x4a93dd){_0x2b753c[_0xb1d7('0x56')]=_0x4a93dd;return _0x2b753c;});}})[_0xb1d7('0x34')](respondWithFilteredResult(_0x1c1826,_0x31eb39))['catch'](handleError(_0x1c1826,null));};exports[_0xb1d7('0xad')]=function(_0x566bb5,_0x4bef07,_0x57ad57){return db[_0xb1d7('0x52')][_0xb1d7('0x59')]({'where':{'id':_0x566bb5[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x4bef07,null))['then'](function(_0x5076c4){if(_0x5076c4){return _0x5076c4[_0xb1d7('0xad')](_0x566bb5['body'][_0xb1d7('0x6b')],_['omit'](_0x566bb5[_0xb1d7('0x61')],[_0xb1d7('0x6b'),'id'])||{})[_0xb1d7('0x90')](function(_0x502086){for(var _0x1e3043=0x0;_0x1e3043<_0x566bb5[_0xb1d7('0x61')][_0xb1d7('0x6b')][_0xb1d7('0x49')];_0x1e3043+=0x1){socket[_0xb1d7('0xae')](_0xb1d7('0xaf'),{'UserId':_0x566bb5['body'][_0xb1d7('0x6b')][_0x1e3043],'OpenchannelAccountId':_0x566bb5[_0xb1d7('0x62')]['id']});}return _0x502086;});}})[_0xb1d7('0x34')](respondWithResult(_0x4bef07,null))[_0xb1d7('0x57')](handleError(_0x4bef07,null));};exports[_0xb1d7('0xb0')]=function(_0x3f1daf,_0x3f0ce0,_0x8f1c73){return db['OpenchannelAccount'][_0xb1d7('0x59')]({'where':{'id':_0x3f1daf['params']['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x3f0ce0,null))[_0xb1d7('0x34')](function(_0x4e1414){if(_0x4e1414){return _0x4e1414[_0xb1d7('0xb0')](_0x3f1daf['query'][_0xb1d7('0x6b')])[_0xb1d7('0x34')](function(){if(_[_0xb1d7('0xb1')](_0x3f1daf[_0xb1d7('0x43')]['ids'])){for(var _0x3b2e71=0x0;_0x3b2e71<_0x3f1daf[_0xb1d7('0x43')][_0xb1d7('0x6b')]['length'];_0x3b2e71+=0x1){socket[_0xb1d7('0xae')](_0xb1d7('0xb2'),{'UserId':Number(_0x3f1daf['query'][_0xb1d7('0x6b')][_0x3b2e71]),'OpenchannelAccountId':Number(_0x3f1daf[_0xb1d7('0x62')]['id'])});}}else{socket[_0xb1d7('0xae')](_0xb1d7('0xb2'),{'UserId':Number(_0x3f1daf['query']['ids']),'OpenchannelAccountId':Number(_0x3f1daf['params']['id'])});}});}})[_0xb1d7('0x34')](respondWithStatusCode(_0x3f0ce0,null))[_0xb1d7('0x57')](handleError(_0x3f0ce0,null));};exports[_0xb1d7('0xb3')]=function(_0x4045b8,_0x1b2c29,_0x5d03d9){var _0x17dfb0={};var _0x31ef8d={};var _0x161835;var _0x191855;return db[_0xb1d7('0x52')]['findOne']({'where':{'id':_0x4045b8[_0xb1d7('0x62')]['id']}})['then'](handleEntityNotFound(_0x1b2c29,null))[_0xb1d7('0x34')](function(_0x229338){if(_0x229338){_0x161835=_0x229338;_0x31ef8d['model']=_[_0xb1d7('0x44')](db[_0xb1d7('0x9a')][_0xb1d7('0x3e')]);_0x31ef8d[_0xb1d7('0x43')]=_[_0xb1d7('0x44')](_0x4045b8[_0xb1d7('0x43')]);_0x31ef8d['filters']=_[_0xb1d7('0x46')](_0x31ef8d['model'],_0x31ef8d[_0xb1d7('0x43')]);_0x17dfb0['attributes']=_['intersection'](_0x31ef8d[_0xb1d7('0x42')],qs[_0xb1d7('0x48')](_0x4045b8[_0xb1d7('0x43')][_0xb1d7('0x48')]));_0x17dfb0[_0xb1d7('0x47')]=_0x17dfb0['attributes'][_0xb1d7('0x49')]?_0x17dfb0['attributes']:_0x31ef8d[_0xb1d7('0x42')];_0x17dfb0[_0xb1d7('0x4c')]=qs[_0xb1d7('0x4d')](_0x4045b8[_0xb1d7('0x43')][_0xb1d7('0x4d')]);_0x17dfb0[_0xb1d7('0x4e')]=qs[_0xb1d7('0x45')](_[_0xb1d7('0x69')](_0x4045b8['query'],_0x31ef8d['filters']));if(_0x4045b8['query'][_0xb1d7('0x4f')]){_0x17dfb0[_0xb1d7('0x4e')]=_[_0xb1d7('0x50')](_0x17dfb0['where'],{'$or':_[_0xb1d7('0x3d')](_0x17dfb0[_0xb1d7('0x47')],function(_0x5a005b){var _0x1db62b={};_0x1db62b[_0x5a005b]={'$like':'%'+_0x4045b8['query']['filter']+'%'};return _0x1db62b;})});}_0x17dfb0=_[_0xb1d7('0x50')]({},_0x17dfb0,_0x4045b8['options']);return _0x161835[_0xb1d7('0xb3')](_0x17dfb0);}})[_0xb1d7('0x34')](function(_0x4cb589){if(_0x4cb589){_0x191855=_0x4cb589['length'];if(!_0x4045b8[_0xb1d7('0x43')]['hasOwnProperty'](_0xb1d7('0x4b'))){_0x17dfb0[_0xb1d7('0x2e')]=qs[_0xb1d7('0x2e')](_0x4045b8['query']['limit']);_0x17dfb0['offset']=qs['offset'](_0x4045b8['query'][_0xb1d7('0x2d')]);}return _0x161835[_0xb1d7('0xb3')](_0x17dfb0);}})[_0xb1d7('0x34')](function(_0x8b37b2){if(_0x8b37b2){return _0x8b37b2?{'count':_0x191855,'rows':_0x8b37b2}:null;}})['then'](respondWithResult(_0x1b2c29,null))[_0xb1d7('0x57')](handleError(_0x1b2c29,null));};exports[_0xb1d7('0x3a')]=function(_0x4de1db,_0x590c12,_0x1dbc08){var _0x50ede4,_0x20ad58,_0x44877c;if(_['isNil'](_0x4de1db[_0xb1d7('0x61')]['body'])||_0x4de1db[_0xb1d7('0x61')][_0xb1d7('0x61')]===''){throw new db['Sequelize'][(_0xb1d7('0x75'))](_0xb1d7('0xb4'));}if(_[_0xb1d7('0x79')](_0x4de1db['body']['to'])){}_0x50ede4=_0x4de1db[_0xb1d7('0x61')]['to'];return db[_0xb1d7('0x52')]['findOne']({'where':{'id':_0x4de1db[_0xb1d7('0x62')]['id']}})[_0xb1d7('0x34')](handleEntityNotFound(_0x590c12,null))[_0xb1d7('0x34')](function(_0x58de2d){if(_0x58de2d){return db['OpenchannelAccount']['find']({'where':{'id':_0x58de2d['id']},'include':[{'model':db['CmList'],'as':_0xb1d7('0x7f'),'include':[{'model':db[_0xb1d7('0x73')],'as':_0xb1d7('0x80'),'where':{[_0x58de2d[_0xb1d7('0x7b')]]:_0x50ede4},'limit':0x1,'order':[[_0xb1d7('0x81'),_0xb1d7('0x82')]]}]}]})[_0xb1d7('0x34')](handleEntityNotFound(_0x590c12,null))[_0xb1d7('0x34')](function(_0x326b4a){if(_0x326b4a&&_0x326b4a[_0xb1d7('0x7f')]){_0x20ad58=_0x326b4a[_0xb1d7('0x36')]({'plain':!![]});if(_0x20ad58[_0xb1d7('0x7f')]&&_0x20ad58['List'][_0xb1d7('0x80')][_0xb1d7('0x49')]){return _0x20ad58['List'][_0xb1d7('0x80')][0x0];}return db[_0xb1d7('0x73')][_0xb1d7('0x5f')](_['defaults'](_0x4de1db[_0xb1d7('0x61')],{'firstName':_0x50ede4,[_0x326b4a['mapKey']]:_0x50ede4,'phone':_0x50ede4,'ListId':_0x20ad58['ListId']}));}})[_0xb1d7('0x34')](handleEntityNotFound(_0x590c12,null))[_0xb1d7('0x34')](function(_0x4501cf){if(_0x4501cf){_0x44877c=_0x4501cf;return db[_0xb1d7('0x8d')][_0xb1d7('0x59')]({'where':{'ContactId':_0x44877c['id'],'closed':![],'OpenchannelAccountId':_0x20ad58['id']}})[_0xb1d7('0x34')](function(_0x80785b){if(_0x80785b){return[_0x80785b,![]];}return db[_0xb1d7('0x8d')]['create']({'UserId':_0x4de1db['user']['id'],'ContactId':_0x44877c['id'],'OpenchannelAccountId':_0x20ad58['id'],'lastMsgDirection':'out','Messages':[_[_0xb1d7('0x50')](_0x4de1db[_0xb1d7('0x61')],{'read':![],'body':_0x4de1db['body'][_0xb1d7('0x61')],'OpenchannelAccountId':_0x20ad58['id'],'UserId':_0x4de1db['user']['id'],'ContactId':_0x44877c['id']})]},{'include':[{'model':db[_0xb1d7('0xb5')],'as':_0xb1d7('0xb6')}]})['then'](function(_0x480b22){return[_0x480b22,!![]];});});}})[_0xb1d7('0x90')](function(_0x3a816e,_0x5b5ba2){if(_0x5b5ba2){return _0x3a816e;}return db[_0xb1d7('0xb5')][_0xb1d7('0x5f')](_[_0xb1d7('0x50')](_0x4de1db[_0xb1d7('0x61')],{'read':![],'body':_0x4de1db[_0xb1d7('0x61')][_0xb1d7('0x61')],'OpenchannelAccountId':_0x20ad58['id'],'OpenchannelInteractionId':_0x3a816e['id'],'UserId':_0x4de1db[_0xb1d7('0x5a')]['id'],'ContactId':_0x44877c['id']}))[_0xb1d7('0x34')](function(_0x4d3907){_0x3a816e[_0xb1d7('0xb7')][_0xb1d7('0xb6')]=[];_0x3a816e[_0xb1d7('0xb7')]['Messages']['push'](_0x4d3907[_0xb1d7('0xb7')]);return _0x3a816e;});});}})[_0xb1d7('0x34')](respondWithResult(_0x590c12,null))[_0xb1d7('0x57')](handleError(_0x590c12,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index bcecec8..f79eef6 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 _0xc719=['exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x390717,_0x254de2){var _0x10bcf9=function(_0x43c480){while(--_0x43c480){_0x390717['push'](_0x390717['shift']());}};_0x10bcf9(++_0x254de2);}(_0xc719,0xb5));var _0x9c71=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0xc719[_0x2a0183];return _0x158c3a;};'use strict';var EventEmitter=require(_0x9c71('0x0'));var OpenchannelAccount=require(_0x9c71('0x1'))['db'][_0x9c71('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9c71('0x3')](0x0);var events={'afterCreate':_0x9c71('0x4'),'afterUpdate':_0x9c71('0x5'),'afterDestroy':_0x9c71('0x6')};function emitEvent(_0x173999){return function(_0x1e350a,_0x2e8f11,_0x51d6fb){OpenchannelAccountEvents[_0x9c71('0x7')](_0x173999+':'+_0x1e350a['id'],_0x1e350a);OpenchannelAccountEvents[_0x9c71('0x7')](_0x173999,_0x1e350a);_0x51d6fb(null);};}for(var e in events){if(events[_0x9c71('0x8')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9c71('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x00b3=['hook','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x29faec,_0x1c849f){var _0x34fc89=function(_0x1dcba8){while(--_0x1dcba8){_0x29faec['push'](_0x29faec['shift']());}};_0x34fc89(++_0x1c849f);}(_0x00b3,0xfd));var _0x300b=function(_0x418a72,_0x212aa1){_0x418a72=_0x418a72-0x0;var _0x1b1165=_0x00b3[_0x418a72];return _0x1b1165;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x300b('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x300b('0x1')](0x0);var events={'afterCreate':_0x300b('0x2'),'afterUpdate':_0x300b('0x3'),'afterDestroy':_0x300b('0x4')};function emitEvent(_0x42f00f){return function(_0x3c9b5b,_0x45c0b8,_0x465d11){OpenchannelAccountEvents[_0x300b('0x5')](_0x42f00f+':'+_0x3c9b5b['id'],_0x3c9b5b);OpenchannelAccountEvents[_0x300b('0x5')](_0x42f00f,_0x3c9b5b);_0x465d11(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x300b('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 91d3928..321cb0c 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 _0x4f45=['OpenchannelAccount','openchannel_accounts','util','../../config/logger','api','bluebird','request-promise','path','define'];(function(_0x454178,_0x11890a){var _0x1866dc=function(_0x37d2d6){while(--_0x37d2d6){_0x454178['push'](_0x454178['shift']());}};_0x1866dc(++_0x11890a);}(_0x4f45,0x89));var _0x54f4=function(_0x26992e,_0x59c600){_0x26992e=_0x26992e-0x0;var _0x2aab59=_0x4f45[_0x26992e];return _0x2aab59;};'use strict';var _=require('lodash');var util=require(_0x54f4('0x0'));var logger=require(_0x54f4('0x1'))(_0x54f4('0x2'));var moment=require('moment');var BPromise=require(_0x54f4('0x3'));var rp=require(_0x54f4('0x4'));var fs=require('fs');var path=require(_0x54f4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x19923f,_0x316c8d){return _0x19923f[_0x54f4('0x6')](_0x54f4('0x7'),attributes,{'tableName':_0x54f4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ddb=['util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts'];(function(_0x325303,_0x3a6612){var _0x3f9fa2=function(_0x2fc9ee){while(--_0x2fc9ee){_0x325303['push'](_0x325303['shift']());}};_0x3f9fa2(++_0x3a6612);}(_0x4ddb,0x168));var _0xb4dd=function(_0x3b71c2,_0x58f3bc){_0x3b71c2=_0x3b71c2-0x0;var _0x290839=_0x4ddb[_0x3b71c2];return _0x290839;};'use strict';var _=require('lodash');var util=require(_0xb4dd('0x0'));var logger=require(_0xb4dd('0x1'))(_0xb4dd('0x2'));var moment=require(_0xb4dd('0x3'));var BPromise=require(_0xb4dd('0x4'));var rp=require(_0xb4dd('0x5'));var fs=require('fs');var path=require(_0xb4dd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4dd('0x7'));module[_0xb4dd('0x8')]=function(_0x39d2a4,_0x4e7d49){return _0x39d2a4[_0xb4dd('0x9')](_0xb4dd('0xa'),attributes,{'tableName':_0xb4dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 14d153e..8029e48 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 _0x392b=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57e8b9,_0x1087bc){var _0x1cf6d0=function(_0x528343){while(--_0x528343){_0x57e8b9['push'](_0x57e8b9['shift']());}};_0x1cf6d0(++_0x1087bc);}(_0x392b,0x18d));var _0xb392=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x392b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb392('0x0'));var util=require(_0xb392('0x1'));var moment=require(_0xb392('0x2'));var BPromise=require(_0xb392('0x3'));var rs=require(_0xb392('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb392('0x5'))['db'];var utils=require(_0xb392('0x6'));var logger=require(_0xb392('0x7'))(_0xb392('0x8'));var config=require(_0xb392('0x9'));var jayson=require(_0xb392('0xa'));var client=jayson[_0xb392('0xb')][_0xb392('0xc')]({'port':0x232a});config[_0xb392('0xd')]=_['defaults'](config[_0xb392('0xd')],{'host':_0xb392('0xe'),'port':0x18eb});var socket=require(_0xb392('0xf'))(new Redis(config[_0xb392('0xd')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2b943e,_0x460a06,_0x557681){return new BPromise(function(_0x3d41b1,_0x4e94ca){return client[_0xb392('0x10')](_0x2b943e,_0x557681)[_0xb392('0x11')](function(_0x30af91){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x460a06,'request\x20sent');logger[_0xb392('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x460a06,'request\x20sent',JSON[_0xb392('0x13')](_0x30af91));if(_0x30af91[_0xb392('0x14')]){if(_0x30af91[_0xb392('0x14')][_0xb392('0x15')]===0x1f4){logger[_0xb392('0x14')](_0xb392('0x16'),_0x460a06,_0x30af91[_0xb392('0x14')]['message']);return _0x4e94ca(_0x30af91[_0xb392('0x14')][_0xb392('0x17')]);}logger[_0xb392('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x460a06,_0x30af91[_0xb392('0x14')][_0xb392('0x17')]);return _0x3d41b1(_0x30af91[_0xb392('0x14')]['message']);}else{logger['info'](_0xb392('0x16'),_0x460a06,_0xb392('0x18'));_0x3d41b1(_0x30af91[_0xb392('0x19')][_0xb392('0x17')]);}})[_0xb392('0x1a')](function(_0x33d605){logger[_0xb392('0x14')](_0xb392('0x16'),_0x460a06,_0x33d605);_0x4e94ca(_0x33d605);});});} \ No newline at end of file +var _0x3b1e=['jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x3b1e,0x1cc));var _0xe3b1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3b1e[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xe3b1('0x0'));var moment=require(_0xe3b1('0x1'));var BPromise=require('bluebird');var rs=require(_0xe3b1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3b1('0x3'))['db'];var utils=require(_0xe3b1('0x4'));var logger=require(_0xe3b1('0x5'))(_0xe3b1('0x6'));var config=require(_0xe3b1('0x7'));var jayson=require(_0xe3b1('0x8'));var client=jayson[_0xe3b1('0x9')][_0xe3b1('0xa')]({'port':0x232a});config[_0xe3b1('0xb')]=_[_0xe3b1('0xc')](config[_0xe3b1('0xb')],{'host':_0xe3b1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3b1('0xb')]));require(_0xe3b1('0xe'))[_0xe3b1('0xf')](socket);function respondWithRpcPromise(_0x15fb76,_0x5d779d,_0x46ceb2){return new BPromise(function(_0x3273e5,_0x2e36ea){return client[_0xe3b1('0x10')](_0x15fb76,_0x46ceb2)[_0xe3b1('0x11')](function(_0x3928cf){logger[_0xe3b1('0x12')](_0xe3b1('0x13'),_0x5d779d,'request\x20sent');logger['debug'](_0xe3b1('0x14'),_0x5d779d,_0xe3b1('0x15'),JSON['stringify'](_0x3928cf));if(_0x3928cf[_0xe3b1('0x16')]){if(_0x3928cf[_0xe3b1('0x16')][_0xe3b1('0x17')]===0x1f4){logger[_0xe3b1('0x16')](_0xe3b1('0x13'),_0x5d779d,_0x3928cf[_0xe3b1('0x16')][_0xe3b1('0x18')]);return _0x2e36ea(_0x3928cf[_0xe3b1('0x16')]['message']);}logger[_0xe3b1('0x16')](_0xe3b1('0x13'),_0x5d779d,_0x3928cf['error'][_0xe3b1('0x18')]);return _0x3273e5(_0x3928cf[_0xe3b1('0x16')][_0xe3b1('0x18')]);}else{logger[_0xe3b1('0x12')](_0xe3b1('0x13'),_0x5d779d,_0xe3b1('0x15'));_0x3273e5(_0x3928cf['result']['message']);}})[_0xe3b1('0x19')](function(_0x4c9c04){logger[_0xe3b1('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d779d,_0x4c9c04);_0x2e36ea(_0x4c9c04);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index adbbee7..d077ccc 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 _0x233b=['remove','update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x233b,0x186));var _0xb233=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x233b[_0x1d1779];return _0x2377e9;};'use strict';var OpenchannelAccountEvents=require(_0xb233('0x0'));var events=[_0xb233('0x1'),_0xb233('0x2'),_0xb233('0x3')];function createListener(_0x13b7a1,_0x43e4ab){return function(_0x3438bd){_0x43e4ab[_0xb233('0x4')](_0x13b7a1,_0x3438bd);};}function removeListener(_0x3307f7,_0x2e903e){return function(){OpenchannelAccountEvents[_0xb233('0x5')](_0x3307f7,_0x2e903e);};}exports[_0xb233('0x6')]=function(_0x2d806c){for(var _0x259566=0x0,_0x1e9298=events['length'];_0x259566<_0x1e9298;_0x259566++){var _0x589a95=events[_0x259566];var _0x551ff7=createListener(_0xb233('0x7')+_0x589a95,_0x2d806c);OpenchannelAccountEvents['on'](_0x589a95,_0x551ff7);}}; \ No newline at end of file +var _0xe9f9=['save','remove','update','removeListener','register','./openchannelAccount.events'];(function(_0x2199f1,_0x10c734){var _0x43436b=function(_0x524bf8){while(--_0x524bf8){_0x2199f1['push'](_0x2199f1['shift']());}};_0x43436b(++_0x10c734);}(_0xe9f9,0x155));var _0x9e9f=function(_0xe03751,_0x15d03d){_0xe03751=_0xe03751-0x0;var _0x37d00d=_0xe9f9[_0xe03751];return _0x37d00d;};'use strict';var OpenchannelAccountEvents=require(_0x9e9f('0x0'));var events=[_0x9e9f('0x1'),_0x9e9f('0x2'),_0x9e9f('0x3')];function createListener(_0x1c96a0,_0x27dadf){return function(_0x41e607){_0x27dadf['emit'](_0x1c96a0,_0x41e607);};}function removeListener(_0x30ed0e,_0x2e229a){return function(){OpenchannelAccountEvents[_0x9e9f('0x4')](_0x30ed0e,_0x2e229a);};}exports[_0x9e9f('0x5')]=function(_0x276433){for(var _0x1e4fd8=0x0,_0x1cf31e=events['length'];_0x1e4fd8<_0x1cf31e;_0x1e4fd8++){var _0x3907be=events[_0x1e4fd8];var _0x1588b3=createListener('openchannelAccount:'+_0x3907be,_0x276433);OpenchannelAccountEvents['on'](_0x3907be,_0x1588b3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b2fa044..032aa17 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 _0x350f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x11b417,_0x4ac108){var _0x5f015b=function(_0x2ff388){while(--_0x2ff388){_0x11b417['push'](_0x11b417['shift']());}};_0x5f015b(++_0x4ac108);}(_0x350f,0x131));var _0xf350=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x350f[_0x2e9187];return _0x1fc3a8;};'use strict';var multer=require(_0xf350('0x0'));var util=require(_0xf350('0x1'));var path=require(_0xf350('0x2'));var timeout=require(_0xf350('0x3'));var express=require(_0xf350('0x4'));var router=express[_0xf350('0x5')]();var auth=require(_0xf350('0x6'));var interaction=require(_0xf350('0x7'));var config=require(_0xf350('0x8'));var controller=require('./openchannelApplication.controller');router[_0xf350('0x9')]('/',auth[_0xf350('0xa')](),controller['index']);router[_0xf350('0x9')](_0xf350('0xb'),auth[_0xf350('0xa')](),controller[_0xf350('0xc')]);router[_0xf350('0xd')]('/',auth[_0xf350('0xa')](),controller[_0xf350('0xe')]);router[_0xf350('0xf')](_0xf350('0xb'),auth[_0xf350('0xa')](),controller[_0xf350('0x10')]);router[_0xf350('0x11')](_0xf350('0xb'),auth[_0xf350('0xa')](),controller[_0xf350('0x12')]);module[_0xf350('0x13')]=router; \ No newline at end of file +var _0x5791=['destroy','exports','multer','util','path','express','Router','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','delete'];(function(_0x80b34e,_0x1f371b){var _0x50b24d=function(_0x223698){while(--_0x223698){_0x80b34e['push'](_0x80b34e['shift']());}};_0x50b24d(++_0x1f371b);}(_0x5791,0x98));var _0x1579=function(_0x63f478,_0xd542b8){_0x63f478=_0x63f478-0x0;var _0x3a9a0f=_0x5791[_0x63f478];return _0x3a9a0f;};'use strict';var multer=require(_0x1579('0x0'));var util=require(_0x1579('0x1'));var path=require(_0x1579('0x2'));var timeout=require('connect-timeout');var express=require(_0x1579('0x3'));var router=express[_0x1579('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1579('0x5'));var controller=require(_0x1579('0x6'));router[_0x1579('0x7')]('/',auth[_0x1579('0x8')](),controller[_0x1579('0x9')]);router[_0x1579('0x7')](_0x1579('0xa'),auth[_0x1579('0x8')](),controller['show']);router[_0x1579('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1579('0xa'),auth[_0x1579('0x8')](),controller['update']);router[_0x1579('0xc')](_0x1579('0xa'),auth['isAuthenticated'](),controller[_0x1579('0xd')]);module[_0x1579('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a7f40ff..02cbc6d 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 _0x281e=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3db94a,_0x117062){var _0x5df368=function(_0x499cd6){while(--_0x499cd6){_0x3db94a['push'](_0x3db94a['shift']());}};_0x5df368(++_0x117062);}(_0x281e,0x8a));var _0xe281=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x281e[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0xe281('0x0'));module[_0xe281('0x1')]={'priority':{'type':Sequelize[_0xe281('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe281('0x3')],'allowNull':![],'defaultValue':_0xe281('0x4')},'appdata':{'type':Sequelize[_0xe281('0x5')]()},'description':{'type':Sequelize[_0xe281('0x3')]},'interval':{'type':Sequelize[_0xe281('0x3')],'defaultValue':_0xe281('0x6')}}; \ No newline at end of file +var _0x530d=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2a63c4,_0x3b8b98){var _0x509247=function(_0x408dc8){while(--_0x408dc8){_0x2a63c4['push'](_0x2a63c4['shift']());}};_0x509247(++_0x3b8b98);}(_0x530d,0x1e6));var _0xd530=function(_0x52cd0f,_0x70ca20){_0x52cd0f=_0x52cd0f-0x0;var _0x26a3da=_0x530d[_0x52cd0f];return _0x26a3da;};'use strict';var Sequelize=require(_0xd530('0x0'));module[_0xd530('0x1')]={'priority':{'type':Sequelize[_0xd530('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd530('0x3')],'allowNull':![],'defaultValue':_0xd530('0x4')},'appdata':{'type':Sequelize[_0xd530('0x5')]()},'description':{'type':Sequelize[_0xd530('0x3')]},'interval':{'type':Sequelize[_0xd530('0x3')],'defaultValue':_0xd530('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 885463c..610b74a 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 _0xb68a=['merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','catch','create','body','find','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','count','offset','limit','set','save','update','then','destroy','end','stack','name','index','map','OpenchannelApplication','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb68a,0x19a));var _0xab68=function(_0x6c6d75,_0xef7deb){_0x6c6d75=_0x6c6d75-0x0;var _0x48a161=_0xb68a[_0x6c6d75];return _0x48a161;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab68('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab68('0x1'));var moment=require(_0xab68('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xab68('0x3'));var util=require(_0xab68('0x4'));var path=require(_0xab68('0x5'));var sox=require(_0xab68('0x6'));var csv=require(_0xab68('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xab68('0x8'));var squel=require('squel');var crypto=require(_0xab68('0x9'));var jsforce=require(_0xab68('0xa'));var deskjs=require(_0xab68('0xb'));var toCsv=require(_0xab68('0x7'));var querystring=require(_0xab68('0xc'));var Papa=require(_0xab68('0xd'));var Redis=require(_0xab68('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xab68('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab68('0x10'));var logger=require(_0xab68('0x11'))(_0xab68('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab68('0x13'))['db'];function respondWithStatusCode(_0x28544a,_0x5a0ded){_0x5a0ded=_0x5a0ded||0xcc;return function(_0x29e570){if(_0x29e570){return _0x28544a['sendStatus'](_0x5a0ded);}return _0x28544a['status'](_0x5a0ded)['end']();};}function respondWithResult(_0x58129f,_0x2d5b2f){_0x2d5b2f=_0x2d5b2f||0xc8;return function(_0x4df28e){if(_0x4df28e){return _0x58129f[_0xab68('0x14')](_0x2d5b2f)[_0xab68('0x15')](_0x4df28e);}};}function respondWithFilteredResult(_0x28f0df,_0x209000){return function(_0x372742){if(_0x372742){var _0x206d39=_0x372742[_0xab68('0x16')],_0x1d1c4f=_0x209000[_0xab68('0x17')],_0x2849fb=_0x209000[_0xab68('0x17')]+_0x209000[_0xab68('0x18')],_0x337a20;if(_0x2849fb>=_0x206d39){_0x2849fb=_0x206d39;_0x337a20=0xc8;}else{_0x337a20=0xce;}_0x28f0df[_0xab68('0x14')](_0x337a20);return _0x28f0df[_0xab68('0x19')]('Content-Range',_0x1d1c4f+'-'+_0x2849fb+'/'+_0x206d39)['json'](_0x372742);}return null;};}function patchUpdates(_0x3118c9){return function(_0x462316){try{jsonpatch['apply'](_0x462316,_0x3118c9,!![]);}catch(_0x94593){return BPromise['reject'](_0x94593);}return _0x462316[_0xab68('0x1a')]();};}function saveUpdates(_0x1822a4,_0x3d70cf){return function(_0x2b807a){if(_0x2b807a){return _0x2b807a[_0xab68('0x1b')](_0x1822a4)[_0xab68('0x1c')](function(_0x193b34){return _0x193b34;});}return null;};}function removeEntity(_0x2b79b5,_0xa55dd2){return function(_0x22318c){if(_0x22318c){return _0x22318c[_0xab68('0x1d')]()[_0xab68('0x1c')](function(){_0x2b79b5[_0xab68('0x14')](0xcc)[_0xab68('0x1e')]();});}};}function handleEntityNotFound(_0x54db07,_0x38f284){return function(_0x44a011){if(!_0x44a011){_0x54db07['sendStatus'](0x194);}return _0x44a011;};}function handleError(_0x107a71,_0x54ff15){_0x54ff15=_0x54ff15||0x1f4;return function(_0x2363ed){logger['error'](_0x2363ed[_0xab68('0x1f')]);if(_0x2363ed['name']){delete _0x2363ed[_0xab68('0x20')];}_0x107a71[_0xab68('0x14')](_0x54ff15)['send'](_0x2363ed);};}exports[_0xab68('0x21')]=function(_0x405592,_0x389ba4){var _0x8943a7={},_0x5df321={},_0x345893={'count':0x0,'rows':[]};var _0x6c8269=_[_0xab68('0x22')](db[_0xab68('0x23')]['rawAttributes'],function(_0x806c73){return{'name':_0x806c73['fieldName'],'type':_0x806c73['type'][_0xab68('0x24')]};});_0x5df321[_0xab68('0x25')]=_[_0xab68('0x22')](_0x6c8269,_0xab68('0x20'));_0x5df321[_0xab68('0x26')]=_[_0xab68('0x27')](_0x405592[_0xab68('0x26')]);_0x5df321[_0xab68('0x28')]=_[_0xab68('0x29')](_0x5df321['model'],_0x5df321[_0xab68('0x26')]);_0x8943a7[_0xab68('0x2a')]=_[_0xab68('0x29')](_0x5df321['model'],qs[_0xab68('0x2b')](_0x405592['query']['fields']));_0x8943a7[_0xab68('0x2a')]=_0x8943a7[_0xab68('0x2a')][_0xab68('0x2c')]?_0x8943a7[_0xab68('0x2a')]:_0x5df321[_0xab68('0x25')];if(!_0x405592[_0xab68('0x26')][_0xab68('0x2d')](_0xab68('0x2e'))){_0x8943a7[_0xab68('0x18')]=qs[_0xab68('0x18')](_0x405592[_0xab68('0x26')][_0xab68('0x18')]);_0x8943a7['offset']=qs['offset'](_0x405592[_0xab68('0x26')][_0xab68('0x17')]);}_0x8943a7[_0xab68('0x2f')]=qs[_0xab68('0x30')](_0x405592['query'][_0xab68('0x30')]);_0x8943a7[_0xab68('0x31')]=qs[_0xab68('0x28')](_[_0xab68('0x32')](_0x405592['query'],_0x5df321[_0xab68('0x28')]),_0x6c8269);if(_0x405592[_0xab68('0x26')][_0xab68('0x33')]){_0x8943a7[_0xab68('0x31')]=_[_0xab68('0x34')](_0x8943a7[_0xab68('0x31')],{'$or':_['map'](_0x6c8269,function(_0x46f81d){if(_0x46f81d['type']!==_0xab68('0x35')){var _0x41f54f={};_0x41f54f[_0x46f81d['name']]={'$like':'%'+_0x405592[_0xab68('0x26')][_0xab68('0x33')]+'%'};return _0x41f54f;}})});}_0x8943a7=_[_0xab68('0x34')]({},_0x8943a7,_0x405592[_0xab68('0x36')]);var _0x51d51d={'where':_0x8943a7[_0xab68('0x31')]};return db[_0xab68('0x23')]['count'](_0x51d51d)[_0xab68('0x1c')](function(_0xbdf88){_0x345893['count']=_0xbdf88;if(_0x405592[_0xab68('0x26')][_0xab68('0x37')]){_0x8943a7['include']=[{'all':!![]}];}return db[_0xab68('0x23')][_0xab68('0x38')](_0x8943a7);})[_0xab68('0x1c')](function(_0x8b893b){_0x345893[_0xab68('0x39')]=_0x8b893b;return _0x345893;})[_0xab68('0x1c')](respondWithFilteredResult(_0x389ba4,_0x8943a7))['catch'](handleError(_0x389ba4,null));};exports[_0xab68('0x3a')]=function(_0x243352,_0xbe2804){var _0x66ffb6={'raw':!![],'where':{'id':_0x243352[_0xab68('0x3b')]['id']}},_0x5d27a6={};_0x5d27a6[_0xab68('0x25')]=_[_0xab68('0x27')](db[_0xab68('0x23')][_0xab68('0x3c')]);_0x5d27a6[_0xab68('0x26')]=_[_0xab68('0x27')](_0x243352[_0xab68('0x26')]);_0x5d27a6[_0xab68('0x28')]=_[_0xab68('0x29')](_0x5d27a6[_0xab68('0x25')],_0x5d27a6[_0xab68('0x26')]);_0x66ffb6[_0xab68('0x2a')]=_[_0xab68('0x29')](_0x5d27a6[_0xab68('0x25')],qs['fields'](_0x243352['query'][_0xab68('0x2b')]));_0x66ffb6[_0xab68('0x2a')]=_0x66ffb6['attributes'][_0xab68('0x2c')]?_0x66ffb6[_0xab68('0x2a')]:_0x5d27a6[_0xab68('0x25')];if(_0x243352[_0xab68('0x26')][_0xab68('0x37')]){_0x66ffb6[_0xab68('0x3d')]=[{'all':!![]}];}_0x66ffb6=_[_0xab68('0x34')]({},_0x66ffb6,_0x243352[_0xab68('0x36')]);return db['OpenchannelApplication']['find'](_0x66ffb6)['then'](handleEntityNotFound(_0xbe2804,null))[_0xab68('0x1c')](respondWithResult(_0xbe2804,null))[_0xab68('0x3e')](handleError(_0xbe2804,null));};exports['create']=function(_0xa1b73,_0x548f48){return db[_0xab68('0x23')][_0xab68('0x3f')](_0xa1b73[_0xab68('0x40')],{})[_0xab68('0x1c')](respondWithResult(_0x548f48,0xc9))['catch'](handleError(_0x548f48,null));};exports[_0xab68('0x1b')]=function(_0x50c066,_0x2ac185){if(_0x50c066['body']['id']){delete _0x50c066[_0xab68('0x40')]['id'];}return db[_0xab68('0x23')][_0xab68('0x41')]({'where':{'id':_0x50c066[_0xab68('0x3b')]['id']}})[_0xab68('0x1c')](handleEntityNotFound(_0x2ac185,null))['then'](saveUpdates(_0x50c066[_0xab68('0x40')],null))[_0xab68('0x1c')](respondWithResult(_0x2ac185,null))['catch'](handleError(_0x2ac185,null));};exports[_0xab68('0x1d')]=function(_0x328d92,_0x243d0c){return db[_0xab68('0x23')][_0xab68('0x41')]({'where':{'id':_0x328d92[_0xab68('0x3b')]['id']}})['then'](handleEntityNotFound(_0x243d0c,null))[_0xab68('0x1c')](removeEntity(_0x243d0c,null))[_0xab68('0x3e')](handleError(_0x243d0c,null));}; \ No newline at end of file +var _0xc4c1=['../../config/license/util','../../mysqldb','status','end','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x342de6,_0x343927){var _0x6b7e5a=function(_0x5be071){while(--_0x5be071){_0x342de6['push'](_0x342de6['shift']());}};_0x6b7e5a(++_0x343927);}(_0xc4c1,0x1ce));var _0x1c4c=function(_0x6f479e,_0x4a59e7){_0x6f479e=_0x6f479e-0x0;var _0x2a773b=_0xc4c1[_0x6f479e];return _0x2a773b;};'use strict';var pdf=require(_0x1c4c('0x0'));var emlformat=require(_0x1c4c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1c4c('0x2'));var jsonpatch=require(_0x1c4c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1c4c('0x4'));var Mustache=require(_0x1c4c('0x5'));var util=require('util');var path=require(_0x1c4c('0x6'));var sox=require('sox');var csv=require(_0x1c4c('0x7'));var ejs=require(_0x1c4c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1c4c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c4c('0xa'));var Papa=require(_0x1c4c('0xb'));var Redis=require(_0x1c4c('0xc'));var authService=require(_0x1c4c('0xd'));var qs=require(_0x1c4c('0xe'));var as=require(_0x1c4c('0xf'));var hardwareService=require(_0x1c4c('0x10'));var logger=require(_0x1c4c('0x11'))(_0x1c4c('0x12'));var utils=require(_0x1c4c('0x13'));var config=require(_0x1c4c('0x14'));var licenseUtil=require(_0x1c4c('0x15'));var db=require(_0x1c4c('0x16'))['db'];function respondWithStatusCode(_0xcb0cbf,_0x292279){_0x292279=_0x292279||0xcc;return function(_0x141888){if(_0x141888){return _0xcb0cbf['sendStatus'](_0x292279);}return _0xcb0cbf[_0x1c4c('0x17')](_0x292279)[_0x1c4c('0x18')]();};}function respondWithResult(_0x467ccb,_0x273c63){_0x273c63=_0x273c63||0xc8;return function(_0x4b0497){if(_0x4b0497){return _0x467ccb['status'](_0x273c63)['json'](_0x4b0497);}};}function respondWithFilteredResult(_0x55c3b2,_0x36cb06){return function(_0x26d221){if(_0x26d221){var _0x5a5f7d=_0x26d221[_0x1c4c('0x19')],_0x21878b=_0x36cb06[_0x1c4c('0x1a')],_0x329638=_0x36cb06['offset']+_0x36cb06[_0x1c4c('0x1b')],_0x370001;if(_0x329638>=_0x5a5f7d){_0x329638=_0x5a5f7d;_0x370001=0xc8;}else{_0x370001=0xce;}_0x55c3b2[_0x1c4c('0x17')](_0x370001);return _0x55c3b2['set'](_0x1c4c('0x1c'),_0x21878b+'-'+_0x329638+'/'+_0x5a5f7d)['json'](_0x26d221);}return null;};}function patchUpdates(_0x5b4fde){return function(_0x295b24){try{jsonpatch[_0x1c4c('0x1d')](_0x295b24,_0x5b4fde,!![]);}catch(_0xf3cf69){return BPromise[_0x1c4c('0x1e')](_0xf3cf69);}return _0x295b24['save']();};}function saveUpdates(_0x4cf1f1,_0x58124a){return function(_0x37422d){if(_0x37422d){return _0x37422d[_0x1c4c('0x1f')](_0x4cf1f1)[_0x1c4c('0x20')](function(_0x49bad7){return _0x49bad7;});}return null;};}function removeEntity(_0x2b039a,_0x2a8cde){return function(_0x3a5fa3){if(_0x3a5fa3){return _0x3a5fa3[_0x1c4c('0x21')]()[_0x1c4c('0x20')](function(){_0x2b039a['status'](0xcc)[_0x1c4c('0x18')]();});}};}function handleEntityNotFound(_0x4c1369,_0x521d3d){return function(_0x3f09d8){if(!_0x3f09d8){_0x4c1369[_0x1c4c('0x22')](0x194);}return _0x3f09d8;};}function handleError(_0x4ceb46,_0x26a6f4){_0x26a6f4=_0x26a6f4||0x1f4;return function(_0x49e812){logger[_0x1c4c('0x23')](_0x49e812['stack']);if(_0x49e812[_0x1c4c('0x24')]){delete _0x49e812[_0x1c4c('0x24')];}_0x4ceb46[_0x1c4c('0x17')](_0x26a6f4)[_0x1c4c('0x25')](_0x49e812);};}exports['index']=function(_0x14a923,_0x2f6a26){var _0x2e3cd6={},_0x12b9f0={},_0x42ebcb={'count':0x0,'rows':[]};var _0x35beb5=_[_0x1c4c('0x26')](db[_0x1c4c('0x27')][_0x1c4c('0x28')],function(_0x55d08c){return{'name':_0x55d08c[_0x1c4c('0x29')],'type':_0x55d08c['type'][_0x1c4c('0x2a')]};});_0x12b9f0[_0x1c4c('0x2b')]=_['map'](_0x35beb5,_0x1c4c('0x24'));_0x12b9f0[_0x1c4c('0x2c')]=_[_0x1c4c('0x2d')](_0x14a923[_0x1c4c('0x2c')]);_0x12b9f0[_0x1c4c('0x2e')]=_[_0x1c4c('0x2f')](_0x12b9f0[_0x1c4c('0x2b')],_0x12b9f0[_0x1c4c('0x2c')]);_0x2e3cd6[_0x1c4c('0x30')]=_[_0x1c4c('0x2f')](_0x12b9f0[_0x1c4c('0x2b')],qs[_0x1c4c('0x31')](_0x14a923[_0x1c4c('0x2c')][_0x1c4c('0x31')]));_0x2e3cd6[_0x1c4c('0x30')]=_0x2e3cd6['attributes'][_0x1c4c('0x32')]?_0x2e3cd6[_0x1c4c('0x30')]:_0x12b9f0[_0x1c4c('0x2b')];if(!_0x14a923[_0x1c4c('0x2c')][_0x1c4c('0x33')](_0x1c4c('0x34'))){_0x2e3cd6[_0x1c4c('0x1b')]=qs[_0x1c4c('0x1b')](_0x14a923['query'][_0x1c4c('0x1b')]);_0x2e3cd6[_0x1c4c('0x1a')]=qs['offset'](_0x14a923[_0x1c4c('0x2c')][_0x1c4c('0x1a')]);}_0x2e3cd6['order']=qs[_0x1c4c('0x35')](_0x14a923[_0x1c4c('0x2c')]['sort']);_0x2e3cd6['where']=qs[_0x1c4c('0x2e')](_[_0x1c4c('0x36')](_0x14a923[_0x1c4c('0x2c')],_0x12b9f0['filters']),_0x35beb5);if(_0x14a923[_0x1c4c('0x2c')][_0x1c4c('0x37')]){_0x2e3cd6[_0x1c4c('0x38')]=_[_0x1c4c('0x39')](_0x2e3cd6[_0x1c4c('0x38')],{'$or':_['map'](_0x35beb5,function(_0x3d6a1c){if(_0x3d6a1c[_0x1c4c('0x3a')]!==_0x1c4c('0x3b')){var _0x97aa88={};_0x97aa88[_0x3d6a1c['name']]={'$like':'%'+_0x14a923['query'][_0x1c4c('0x37')]+'%'};return _0x97aa88;}})});}_0x2e3cd6=_[_0x1c4c('0x39')]({},_0x2e3cd6,_0x14a923['options']);var _0x90d8bb={'where':_0x2e3cd6['where']};return db[_0x1c4c('0x27')][_0x1c4c('0x19')](_0x90d8bb)[_0x1c4c('0x20')](function(_0x52d15b){_0x42ebcb['count']=_0x52d15b;if(_0x14a923['query'][_0x1c4c('0x3c')]){_0x2e3cd6[_0x1c4c('0x3d')]=[{'all':!![]}];}return db[_0x1c4c('0x27')][_0x1c4c('0x3e')](_0x2e3cd6);})[_0x1c4c('0x20')](function(_0x11eacc){_0x42ebcb['rows']=_0x11eacc;return _0x42ebcb;})['then'](respondWithFilteredResult(_0x2f6a26,_0x2e3cd6))[_0x1c4c('0x3f')](handleError(_0x2f6a26,null));};exports['show']=function(_0x3cf53a,_0x1f4e3f){var _0x556faf={'raw':!![],'where':{'id':_0x3cf53a[_0x1c4c('0x40')]['id']}},_0x37f1c7={};_0x37f1c7[_0x1c4c('0x2b')]=_[_0x1c4c('0x2d')](db[_0x1c4c('0x27')][_0x1c4c('0x28')]);_0x37f1c7[_0x1c4c('0x2c')]=_[_0x1c4c('0x2d')](_0x3cf53a[_0x1c4c('0x2c')]);_0x37f1c7[_0x1c4c('0x2e')]=_['intersection'](_0x37f1c7[_0x1c4c('0x2b')],_0x37f1c7[_0x1c4c('0x2c')]);_0x556faf[_0x1c4c('0x30')]=_[_0x1c4c('0x2f')](_0x37f1c7[_0x1c4c('0x2b')],qs[_0x1c4c('0x31')](_0x3cf53a[_0x1c4c('0x2c')]['fields']));_0x556faf[_0x1c4c('0x30')]=_0x556faf['attributes'][_0x1c4c('0x32')]?_0x556faf[_0x1c4c('0x30')]:_0x37f1c7['model'];if(_0x3cf53a['query']['includeAll']){_0x556faf['include']=[{'all':!![]}];}_0x556faf=_['merge']({},_0x556faf,_0x3cf53a[_0x1c4c('0x41')]);return db[_0x1c4c('0x27')][_0x1c4c('0x42')](_0x556faf)[_0x1c4c('0x20')](handleEntityNotFound(_0x1f4e3f,null))[_0x1c4c('0x20')](respondWithResult(_0x1f4e3f,null))[_0x1c4c('0x3f')](handleError(_0x1f4e3f,null));};exports[_0x1c4c('0x43')]=function(_0x193505,_0x5381af){return db[_0x1c4c('0x27')][_0x1c4c('0x43')](_0x193505[_0x1c4c('0x44')],{})[_0x1c4c('0x20')](respondWithResult(_0x5381af,0xc9))[_0x1c4c('0x3f')](handleError(_0x5381af,null));};exports[_0x1c4c('0x1f')]=function(_0x1cd44c,_0x3a5f33){if(_0x1cd44c[_0x1c4c('0x44')]['id']){delete _0x1cd44c['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x1cd44c[_0x1c4c('0x40')]['id']}})[_0x1c4c('0x20')](handleEntityNotFound(_0x3a5f33,null))[_0x1c4c('0x20')](saveUpdates(_0x1cd44c[_0x1c4c('0x44')],null))[_0x1c4c('0x20')](respondWithResult(_0x3a5f33,null))[_0x1c4c('0x3f')](handleError(_0x3a5f33,null));};exports[_0x1c4c('0x21')]=function(_0x421f2e,_0x5807df){return db[_0x1c4c('0x27')][_0x1c4c('0x42')]({'where':{'id':_0x421f2e[_0x1c4c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5807df,null))[_0x1c4c('0x20')](removeEntity(_0x5807df,null))[_0x1c4c('0x3f')](handleError(_0x5807df,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 34e00e9..2324ad6 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 _0x05fd=['utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelApplication','utf8mb4'];(function(_0x286548,_0x44e4d1){var _0x496fd6=function(_0x37ec5){while(--_0x37ec5){_0x286548['push'](_0x286548['shift']());}};_0x496fd6(++_0x44e4d1);}(_0x05fd,0x6f));var _0xd05f=function(_0x12e165,_0x166183){_0x12e165=_0x12e165-0x0;var _0x2e5235=_0x05fd[_0x12e165];return _0x2e5235;};'use strict';var _=require(_0xd05f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd05f('0x1'));var BPromise=require(_0xd05f('0x2'));var rp=require(_0xd05f('0x3'));var fs=require('fs');var path=require(_0xd05f('0x4'));var rimraf=require(_0xd05f('0x5'));var config=require(_0xd05f('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0xfa5101,_0x57805e){return _0xfa5101[_0xd05f('0x7')](_0xd05f('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd05f('0x9'),'collate':_0xd05f('0xa')});}; \ No newline at end of file +var _0x5a3b=['openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x157339,_0x21e5f6){var _0x141b4b=function(_0x1fd5bb){while(--_0x1fd5bb){_0x157339['push'](_0x157339['shift']());}};_0x141b4b(++_0x21e5f6);}(_0x5a3b,0x183));var _0xb5a3=function(_0x258482,_0x58af95){_0x258482=_0x258482-0x0;var _0x207271=_0x5a3b[_0x258482];return _0x207271;};'use strict';var _=require(_0xb5a3('0x0'));var util=require(_0xb5a3('0x1'));var logger=require(_0xb5a3('0x2'))(_0xb5a3('0x3'));var moment=require('moment');var BPromise=require(_0xb5a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5a3('0x5'));var rimraf=require(_0xb5a3('0x6'));var config=require(_0xb5a3('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0xb5a3('0x8')]=function(_0x563ff0,_0x34a362){return _0x563ff0['define']('OpenchannelApplication',attributes,{'tableName':_0xb5a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb5a3('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 885ec04..cef1125 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x409ef4,_0x435589){var _0x50036b=function(_0x4d12ff){while(--_0x4d12ff){_0x409ef4['push'](_0x409ef4['shift']());}};_0x50036b(++_0x435589);}(_0x5f2f,0x73));var _0xf5f2=function(_0xcaf339,_0x4bd8ce){_0xcaf339=_0xcaf339-0x0;var _0x1eb36e=_0x5f2f[_0xcaf339];return _0x1eb36e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +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(_0x6ee51a,_0xc35002){var _0x3b6017=function(_0x3357d5){while(--_0x3357d5){_0x6ee51a['push'](_0x6ee51a['shift']());}};_0x3b6017(++_0xc35002);}(_0xb10b,0x12a));var _0xbb10=function(_0x278679,_0x1eb219){_0x278679=_0x278679-0x0;var _0x4874aa=_0xb10b[_0x278679];return _0x4874aa;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 759b399..6e19790 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 _0x8d85=['describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5cffc8,_0xc4b3b5){var _0x5d2d61=function(_0x309402){while(--_0x309402){_0x5cffc8['push'](_0x5cffc8['shift']());}};_0x5d2d61(++_0xc4b3b5);}(_0x8d85,0x6e));var _0x58d8=function(_0x31783e,_0x25c379){_0x31783e=_0x31783e-0x0;var _0x1de30f=_0x8d85[_0x31783e];return _0x1de30f;};'use strict';var multer=require(_0x58d8('0x0'));var util=require(_0x58d8('0x1'));var path=require(_0x58d8('0x2'));var timeout=require(_0x58d8('0x3'));var express=require(_0x58d8('0x4'));var router=express[_0x58d8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x58d8('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x58d8('0x7')]('/',auth[_0x58d8('0x8')](),controller[_0x58d8('0x9')]);router[_0x58d8('0x7')]('/describe',auth[_0x58d8('0x8')](),controller[_0x58d8('0xa')]);router[_0x58d8('0x7')](_0x58d8('0xb'),auth['isAuthenticated'](),controller[_0x58d8('0xc')]);router[_0x58d8('0x7')]('/:id/messages',auth[_0x58d8('0x8')](),controller[_0x58d8('0xd')]);router['get'](_0x58d8('0xe'),auth[_0x58d8('0x8')](),controller[_0x58d8('0xf')]);router[_0x58d8('0x10')]('/',auth[_0x58d8('0x8')](),controller[_0x58d8('0x11')]);router[_0x58d8('0x10')](_0x58d8('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x58d8('0x10')](_0x58d8('0x13'),auth['isAuthenticated'](),interaction[_0x58d8('0x14')](_0x58d8('0x15'),_0x58d8('0x16')),controller[_0x58d8('0x17')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x58d8('0x15'),_0x58d8('0x18')),controller[_0x58d8('0x19')]);router[_0x58d8('0x1a')](_0x58d8('0xb'),auth[_0x58d8('0x8')](),interaction['tracked'](_0x58d8('0x15'),_0x58d8('0x1b')),controller['destroy']);router['delete'](_0x58d8('0x13'),auth['isAuthenticated'](),controller[_0x58d8('0x1c')]);module[_0x58d8('0x1d')]=router; \ No newline at end of file +var _0xd86e=['addTags','put','update','delete','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel'];(function(_0xe1336b,_0x3f3130){var _0x1cf4b2=function(_0x38bcc5){while(--_0x38bcc5){_0xe1336b['push'](_0xe1336b['shift']());}};_0x1cf4b2(++_0x3f3130);}(_0xd86e,0x19c));var _0xed86=function(_0x19c475,_0x5d3305){_0x19c475=_0x19c475-0x0;var _0x35176d=_0xd86e[_0x19c475];return _0x35176d;};'use strict';var multer=require(_0xed86('0x0'));var util=require(_0xed86('0x1'));var path=require('path');var timeout=require(_0xed86('0x2'));var express=require(_0xed86('0x3'));var router=express[_0xed86('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed86('0x5'));var controller=require('./openchannelInteraction.controller');router[_0xed86('0x6')]('/',auth[_0xed86('0x7')](),controller['index']);router['get'](_0xed86('0x8'),auth[_0xed86('0x7')](),controller[_0xed86('0x9')]);router[_0xed86('0x6')](_0xed86('0xa'),auth['isAuthenticated'](),controller[_0xed86('0xb')]);router[_0xed86('0x6')](_0xed86('0xc'),auth[_0xed86('0x7')](),controller['getMessages']);router[_0xed86('0x6')](_0xed86('0xd'),auth[_0xed86('0x7')](),controller['download']);router['post']('/',auth[_0xed86('0x7')](),controller[_0xed86('0xe')]);router[_0xed86('0xf')](_0xed86('0xc'),auth['isAuthenticated'](),controller[_0xed86('0x10')]);router['post'](_0xed86('0x11'),auth[_0xed86('0x7')](),interaction[_0xed86('0x12')](_0xed86('0x13'),'openchannelinteraction:addtags'),controller[_0xed86('0x14')]);router[_0xed86('0x15')]('/:id',auth[_0xed86('0x7')](),interaction['tracked'](_0xed86('0x13'),'openchannelinteraction:update'),controller[_0xed86('0x16')]);router[_0xed86('0x17')](_0xed86('0xa'),auth[_0xed86('0x7')](),interaction[_0xed86('0x12')](_0xed86('0x13'),'openchannelinteraction:destroy'),controller[_0xed86('0x18')]);router[_0xed86('0x17')](_0xed86('0x11'),auth[_0xed86('0x7')](),controller[_0xed86('0x19')]);module[_0xed86('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4555631..872784b 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 _0x2227=['STRING','DATE','ENUM','sequelize','exports','BOOLEAN'];(function(_0x4cf88d,_0x5de590){var _0x1f49c0=function(_0x3aba91){while(--_0x3aba91){_0x4cf88d['push'](_0x4cf88d['shift']());}};_0x1f49c0(++_0x5de590);}(_0x2227,0x147));var _0x7222=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x2227[_0x1aba25];return _0x47d997;};'use strict';var Sequelize=require(_0x7222('0x0'));module[_0x7222('0x1')]={'closed':{'type':Sequelize[_0x7222('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7222('0x3')]},'secondDisposition':{'type':Sequelize[_0x7222('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7222('0x3')]},'note':{'type':Sequelize[_0x7222('0x3')]},'read1stAt':{'type':Sequelize[_0x7222('0x4')]},'threadId':{'type':Sequelize[_0x7222('0x3')]},'externalUrl':{'type':Sequelize[_0x7222('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7222('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb49=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb49,0x1c8));var _0x9db4=function(_0x164d5b,_0x5766f8){_0x164d5b=_0x164d5b-0x0;var _0x1db568=_0xdb49[_0x164d5b];return _0x1db568;};'use strict';var Sequelize=require(_0x9db4('0x0'));module[_0x9db4('0x1')]={'closed':{'type':Sequelize[_0x9db4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9db4('0x3')]},'disposition':{'type':Sequelize[_0x9db4('0x4')]},'secondDisposition':{'type':Sequelize[_0x9db4('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9db4('0x4')]},'note':{'type':Sequelize[_0x9db4('0x4')]},'read1stAt':{'type':Sequelize[_0x9db4('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x9db4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9db4('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 71740c4..63a3452 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 _0x31d7=['openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','toString','count','sequelize','merge','OpenchannelInteraction','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.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','all','rows','show','params','includeAll','include','create','body','update','describe','addMessage','omit','ids','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','findAll','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','mkdirSync','10px','%s\x20#%d','Openchannel','YYYY-MM-DD','Account','N.A.','closed','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','Users','map','TagIds','Tags','push','catch','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','sort','pick','field','color','tools_tags','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x31d7,0x194));var _0x731d=function(_0x34e52c,_0xee325a){_0x34e52c=_0x34e52c-0x0;var _0x9c1d26=_0x31d7[_0x34e52c];return _0x9c1d26;};'use strict';var pdf=require(_0x731d('0x0'));var emlformat=require(_0x731d('0x1'));var rimraf=require(_0x731d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x731d('0x3'));var rp=require(_0x731d('0x4'));var moment=require(_0x731d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x731d('0x6'));var util=require('util');var path=require(_0x731d('0x7'));var sox=require(_0x731d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x731d('0x9'));var squel=require(_0x731d('0xa'));var crypto=require(_0x731d('0xb'));var jsforce=require(_0x731d('0xc'));var deskjs=require(_0x731d('0xd'));var toCsv=require(_0x731d('0xe'));var querystring=require('querystring');var Papa=require(_0x731d('0xf'));var Redis=require(_0x731d('0x10'));var authService=require(_0x731d('0x11'));var qs=require(_0x731d('0x12'));var as=require(_0x731d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x731d('0x14'))(_0x731d('0x15'));var utils=require(_0x731d('0x16'));var config=require(_0x731d('0x17'));var licenseUtil=require(_0x731d('0x18'));var db=require(_0x731d('0x19'))['db'];config[_0x731d('0x1a')]=_[_0x731d('0x1b')](config[_0x731d('0x1a')],{'host':_0x731d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x731d('0x1d'))[_0x731d('0x1e')](socket);function respondWithStatusCode(_0x21cb47,_0x2c6f4d){_0x2c6f4d=_0x2c6f4d||0xcc;return function(_0x483a1d){if(_0x483a1d){return _0x21cb47[_0x731d('0x1f')](_0x2c6f4d);}return _0x21cb47[_0x731d('0x20')](_0x2c6f4d)[_0x731d('0x21')]();};}function respondWithResult(_0x5f0ad6,_0x4d65c7){_0x4d65c7=_0x4d65c7||0xc8;return function(_0x474182){if(_0x474182){return _0x5f0ad6[_0x731d('0x20')](_0x4d65c7)[_0x731d('0x22')](_0x474182);}};}function respondWithFilteredResult(_0x35434f,_0x40906b){return function(_0x4919b8){if(_0x4919b8){var _0x2bb368=_0x4919b8['count'],_0x3ed87e=_0x40906b['offset'],_0x3e0e7e=_0x40906b[_0x731d('0x23')]+_0x40906b[_0x731d('0x24')],_0x5d7fed;if(_0x3e0e7e>=_0x2bb368){_0x3e0e7e=_0x2bb368;_0x5d7fed=0xc8;}else{_0x5d7fed=0xce;}_0x35434f[_0x731d('0x20')](_0x5d7fed);return _0x35434f['set'](_0x731d('0x25'),_0x3ed87e+'-'+_0x3e0e7e+'/'+_0x2bb368)[_0x731d('0x22')](_0x4919b8);}return null;};}function patchUpdates(_0x5f1fd7){return function(_0x2971ff){try{jsonpatch[_0x731d('0x26')](_0x2971ff,_0x5f1fd7,!![]);}catch(_0x132b90){return BPromise[_0x731d('0x27')](_0x132b90);}return _0x2971ff[_0x731d('0x28')]();};}function saveUpdates(_0x2d7d30,_0x5a9ac5){return function(_0x171d1d){if(_0x171d1d){return _0x171d1d['update'](_0x2d7d30)['then'](function(_0x3ea6b6){return _0x3ea6b6;});}return null;};}function removeEntity(_0x47f33b,_0x3c3d96){return function(_0x5312ea){if(_0x5312ea){return _0x5312ea[_0x731d('0x29')]()[_0x731d('0x2a')](function(){_0x47f33b[_0x731d('0x20')](0xcc)[_0x731d('0x21')]();});}};}function handleEntityNotFound(_0x53228e,_0x24e780){return function(_0x1274f7){if(!_0x1274f7){_0x53228e[_0x731d('0x1f')](0x194);}return _0x1274f7;};}function handleError(_0x506078,_0x27ca30){_0x27ca30=_0x27ca30||0x1f4;return function(_0x220f84){logger[_0x731d('0x2b')](_0x220f84[_0x731d('0x2c')]);if(_0x220f84[_0x731d('0x2d')]){delete _0x220f84[_0x731d('0x2d')];}_0x506078['status'](_0x27ca30)[_0x731d('0x2e')](_0x220f84);};}function getInteractionUsers(_0x1a2494,_0x46b155){return new BPromise(function(_0x4d54ea,_0x4f7390){try{if(_0x46b155[_0x1a2494['id']]){_0x1a2494[_0x731d('0x2f')]=_[_0x731d('0x30')](_0x46b155[_0x1a2494['id']],function(_0x3503b1){return{'id':_0x3503b1['id'],'fullname':_0x3503b1['fullname']};});}}catch(_0x962a72){_0x4f7390(_0x962a72);}_0x4d54ea(_0x1a2494);});}function getInteractionTags(_0x1ee42d,_0x22a8d4){return new BPromise(function(_0x1cb4b5,_0x2a3d70){try{if(_0x1ee42d[_0x731d('0x31')]){_0x1ee42d[_0x731d('0x32')]=[];_0x1ee42d['TagIds']['split'](',')['forEach'](function(_0x116070){_0x1ee42d[_0x731d('0x32')][_0x731d('0x33')](_0x22a8d4[_0x116070]);});}delete _0x1ee42d['TagIds'];}catch(_0x36f046){_0x2a3d70(_0x36f046);}_0x1cb4b5(_0x1ee42d);});}function updateOpenchannelInteraction(_0x39b50a,_0x37af1a,_0xf10255){return new BPromise(function(_0x1cbed7,_0x1df6c5){return getInteractionUsers(_0x39b50a,_0xf10255)['then'](function(_0x15bdb0){return getInteractionTags(_0x15bdb0,_0x37af1a);})[_0x731d('0x2a')](function(_0x4af311){_0x1cbed7(_0x4af311);})[_0x731d('0x34')](function(_0x34bcae){_0x1df6c5(_0x34bcae);});});}exports[_0x731d('0x35')]=function(_0x2e423c,_0x38cebb){var _0x29a95e={},_0x4d1906={},_0x3e8648={'count':0x0,'rows':[]};var _0x3092c6=_['map'](db['OpenchannelInteraction'][_0x731d('0x36')],function(_0x374307){return{'name':_0x374307[_0x731d('0x37')],'type':_0x374307['type']['key']};});_0x4d1906[_0x731d('0x38')]=_[_0x731d('0x30')](_0x3092c6,_0x731d('0x2d'));_0x4d1906[_0x731d('0x39')]=_[_0x731d('0x3a')](_0x2e423c[_0x731d('0x39')]);_0x4d1906[_0x731d('0x3b')]=_[_0x731d('0x3c')](_0x4d1906['model'],_0x4d1906[_0x731d('0x39')]);_0x29a95e[_0x731d('0x3d')]=_[_0x731d('0x3c')](_0x4d1906[_0x731d('0x38')],qs[_0x731d('0x3e')](_0x2e423c['query'][_0x731d('0x3e')]));_0x29a95e[_0x731d('0x3d')]=_0x29a95e[_0x731d('0x3d')]['length']?_0x29a95e[_0x731d('0x3d')]:_0x4d1906['model'];if(!_0x2e423c[_0x731d('0x39')]['hasOwnProperty']('nolimit')){_0x29a95e[_0x731d('0x24')]=qs[_0x731d('0x24')](_0x2e423c[_0x731d('0x39')][_0x731d('0x24')]);_0x29a95e['offset']=qs[_0x731d('0x23')](_0x2e423c['query']['offset']);}_0x29a95e['order']=qs[_0x731d('0x3f')](_0x2e423c['query'][_0x731d('0x3f')]);_0x29a95e['where']=qs[_0x731d('0x3b')](_[_0x731d('0x40')](_0x2e423c[_0x731d('0x39')],_0x4d1906['filters']),_0x3092c6);var _0x5b101e=[];var _0x1f39bd=squel['select']()[_0x731d('0x41')]('id')['field'](_0x731d('0x2d'))[_0x731d('0x41')](_0x731d('0x42'))['from'](_0x731d('0x43'));var _0x327506=squel[_0x731d('0x44')]()[_0x731d('0x41')](_0x731d('0x45'))['field'](_0x731d('0x46'))[_0x731d('0x41')]('ui.OpenchannelInteractionId')['from'](_0x731d('0x47'),'ui')[_0x731d('0x48')]('users','u',_0x731d('0x49'));var _0x49c357=squel[_0x731d('0x44')]()[_0x731d('0x4a')](_0x731d('0x4b'),'i')['left_join'](_0x731d('0x4c'),'c',_0x731d('0x4d'))[_0x731d('0x48')](_0x731d('0x4e'),'o',_0x731d('0x4f'))['left_join'](_0x731d('0x50'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x731d('0x48')](_0x731d('0x51'),'me',_0x731d('0x52'))[_0x731d('0x48')](_0x731d('0x53'),'it',_0x731d('0x54'))[_0x731d('0x48')](_0x731d('0x43'),'t',_0x731d('0x55'));var _0x3db917=squel[_0x731d('0x56')]();var _0x2b2124=[];var _0xec7df8=squel[_0x731d('0x56')]();var _0x53fa5c;if(_0x2e423c['query'][_0x731d('0x57')]){_0x53fa5c=as[_0x731d('0x58')](_0x2e423c[_0x731d('0x39')][_0x731d('0x57')]);var _0xcd8d1b=_0x53fa5c['sqlOperator'];for(var _0x37fca7=0x0;_0x37fca7<_0x53fa5c[_0x731d('0x59')][_0x731d('0x5a')];_0x37fca7++){var _0x55f808=_0x53fa5c[_0x731d('0x59')][_0x37fca7];var _0x3d506b='i';var _0x4eaa6d=_[_0x731d('0x5b')](_0x3092c6,[_0x731d('0x2d'),_0x55f808['field']]);if(!_0x4eaa6d){switch(_0x55f808['field']){case _0x731d('0x5c'):if(_0x55f808['value']==0x1){_0x49c357['having']('`'+_0x55f808[_0x731d('0x41')]+_0x731d('0x5d'));}else{_0x49c357[_0x731d('0x5e')]('`'+_0x55f808[_0x731d('0x41')]+_0x731d('0x5f'));}break;case _0x731d('0x60'):if(_0x55f808[_0x731d('0x61')]===_0x731d('0x62')){if(_0x55f808[_0x731d('0x63')]['split']('\x20')[_0x731d('0x5a')]>0x1){_0x3db917[_0xcd8d1b](_0x731d('0x64'),qs[_0x731d('0x65')](_0x55f808[_0x731d('0x63')]),null);}else{var _0x22d19b='%'+_0x55f808['value']+'%';_0x3db917[_0xcd8d1b](_0x731d('0x66'),_0x22d19b,_0x22d19b,_0x22d19b);}}else{_0x4eaa6d=_[_0x731d('0x5b')](_0x3092c6,[_0x731d('0x2d'),'ContactId']);_0x55f808[_0x731d('0x41')]=_0x731d('0x67');_0x68c4c2=as[_0x731d('0x68')](_0x3d506b,_0x4eaa6d[_0x731d('0x69')],_0x55f808);_0x3db917[_0xcd8d1b](_0x68c4c2[_0x731d('0x6a')],_0x68c4c2[_0x731d('0x63')][_0x731d('0x6b')],_0x68c4c2[_0x731d('0x63')][_0x731d('0x21')]);}break;case'Tag':var _0x25b4e7=_0x55f808['value'][_0x731d('0x6c')](',')['map'](function(_0x14e509){return Number(_0x14e509);});_0x25b4e7[_0x731d('0x6d')](function(_0x4cad7f){_0xec7df8['or'](_0x731d('0x6e'),'%,'+_0x4cad7f+',%');});_0x2b2124=_[_0x731d('0x6f')](_0x2b2124,_0x25b4e7);break;case _0x731d('0x70'):if(_0x55f808[_0x731d('0x61')]==='$substring'){_0x3db917[_0xcd8d1b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x55f808[_0x731d('0x63')]+'%',null);}else{_0x4eaa6d=_[_0x731d('0x5b')](_0x3092c6,[_0x731d('0x2d'),_0x731d('0x71')]);_0x55f808['field']=_0x731d('0x71');_0x68c4c2=as['buildExpression'](_0x3d506b,_0x4eaa6d[_0x731d('0x69')],_0x55f808);_0x3db917[_0xcd8d1b](_0x68c4c2[_0x731d('0x6a')],_0x68c4c2[_0x731d('0x63')][_0x731d('0x6b')],_0x68c4c2[_0x731d('0x63')]['end']);}break;case'body':_0x68c4c2=as[_0x731d('0x68')]('me',null,_0x55f808);_0x3db917[_0xcd8d1b](_0x68c4c2['text'],_0x68c4c2[_0x731d('0x63')]['start'],_0x68c4c2[_0x731d('0x63')]['end']);break;}}else{var _0x68c4c2=as[_0x731d('0x68')](_0x3d506b,_0x4eaa6d[_0x731d('0x69')],_0x55f808);_0x3db917[_0xcd8d1b](_0x68c4c2[_0x731d('0x6a')],_0x68c4c2[_0x731d('0x63')][_0x731d('0x6b')],_0x68c4c2[_0x731d('0x63')][_0x731d('0x21')]);}}}else{var _0xdfa6cc=_(_0x2e423c[_0x731d('0x39')])['keys']()['map'](function(_0x4b5b11){return _['some'](_0x3092c6,['name',_0x4b5b11])?_0x4b5b11:undefined;})[_0x731d('0x72')]()[_0x731d('0x63')]();if(!_[_0x731d('0x73')](_0xdfa6cc)){_0xdfa6cc[_0x731d('0x6d')](function(_0xf1dab8){if(_0xf1dab8===_0x731d('0x74')){_0x49c357[_0x731d('0x75')](_0x731d('0x76'),[][_0x731d('0x77')](_0x2e423c['query'][_0xf1dab8]));}else if(_0xf1dab8===_0x731d('0x78')){var _0xde6bf6=JSON[_0x731d('0x79')](_0x2e423c[_0x731d('0x39')][_0xf1dab8])['$gte'];var _0x4763ee=JSON[_0x731d('0x79')](_0x2e423c[_0x731d('0x39')][_0xf1dab8])['$lte'];_0x49c357[_0x731d('0x75')](_0x731d('0x7a'),_0xde6bf6,_0x4763ee);}else{if(_0x2e423c[_0x731d('0x39')][_0xf1dab8]==='null'){_0x49c357[_0x731d('0x75')]('i.'+_0xf1dab8+_0x731d('0x7b'));}else{_0x49c357['where']('i.'+_0xf1dab8+_0x731d('0x7c'),_0x2e423c[_0x731d('0x39')][_0xf1dab8]);}}});}if(_0x2e423c[_0x731d('0x39')][_0x731d('0x7d')]){if(_0x2e423c[_0x731d('0x39')][_0x731d('0x7d')]==0x1){_0x49c357['having']('`unreadMessages`\x20=\x200');}else{_0x49c357[_0x731d('0x5e')](_0x731d('0x7e'));}}if(_0x2e423c['query']['tag']){_0x2b2124=_[_0x731d('0x7f')](_0x2e423c[_0x731d('0x39')]['tag'])?_0x2e423c[_0x731d('0x39')][_0x731d('0x80')]:new Array(_0x2e423c[_0x731d('0x39')][_0x731d('0x80')]);_0x2b2124[_0x731d('0x6d')](function(_0x59c7ba){_0xec7df8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x59c7ba+',%');});}if(_0x2e423c[_0x731d('0x39')][_0x731d('0x81')]){var _0x22dbf0=_0x2e423c[_0x731d('0x39')][_0x731d('0x81')][_0x731d('0x82')]('\x5c','\x5c\x5c')[_0x731d('0x82')](/'/g,'\x27\x27');if(qs[_0x731d('0x83')](_0x22dbf0)){_0x3db917['or']('i.id\x20LIKE\x20?',_0x22dbf0+'%');}else{_0x3db917['or'](_0x731d('0x84'),qs['getFullTextValue'](_0x22dbf0))['or'](_0x731d('0x85'),_0x22dbf0+'%')['or'](_0x731d('0x86'),_0x22dbf0+'%');}}}_0x49c357[_0x731d('0x75')](_0x3db917);_0x49c357[_0x731d('0x87')](_0x731d('0x88'));var _0x55dece={'type':db[_0x731d('0x89')][_0x731d('0x8a')][_0x731d('0x8b')],'raw':!![]};var _0x371403=_0x49c357[_0x731d('0x8c')]();_0x371403[_0x731d('0x41')]('i.id');_0x371403[_0x731d('0x41')](_0x731d('0x8d'),_0x731d('0x5c'));if(_0x29a95e[_0x731d('0x8e')]){_0x29a95e[_0x731d('0x8e')][_0x731d('0x6d')](function(_0x28de59){var _0x38b7a0=_0x28de59[0x0]===_0x731d('0x8f')?_0x28de59[0x0]:'i.'+_0x28de59[0x0];_0x49c357[_0x731d('0x8e')](_0x38b7a0,_0x28de59[0x1]===_0x731d('0x90')?![]:!![]);});}if(!_[_0x731d('0x73')](_0x2b2124)){_0x49c357[_0x731d('0x5e')](_0xec7df8);_0x371403[_0x731d('0x75')](_0x731d('0x91'),_0x2b2124);}BPromise[_0x731d('0x92')]()[_0x731d('0x2a')](function(){if(!_0x53fa5c){if(_0x2e423c[_0x731d('0x39')][_0x731d('0x74')])return;_0x371403[_0x731d('0x75')](_0x731d('0x93'));_0x49c357[_0x731d('0x75')](_0x731d('0x93'));return;}if(_0x2e423c[_0x731d('0x94')][_0x731d('0x95')]!=='agent')return;return _0x2e423c[_0x731d('0x94')][_0x731d('0x96')]({'attributes':['id'],'raw':!![]})[_0x731d('0x2a')](function(_0x2a86ec){if(_[_0x731d('0x73')](_0x2a86ec)){_0x371403[_0x731d('0x75')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x49c357[_0x731d('0x75')](_0x731d('0x97'));}else{_0x371403[_0x731d('0x75')](_0x731d('0x76'),_[_0x731d('0x30')](_0x2a86ec,'id'));_0x49c357[_0x731d('0x75')](_0x731d('0x76'),_['map'](_0x2a86ec,'id'));}});})[_0x731d('0x2a')](function(){if(_0x2e423c['user'][_0x731d('0x95')]===_0x731d('0x98')&&!_0x53fa5c&&!_0x2e423c[_0x731d('0x39')][_0x731d('0x74')])return[];return db['sequelize'][_0x731d('0x39')](_0x371403[_0x731d('0x99')](),_0x55dece);})[_0x731d('0x2a')](function(_0x2a4644){_0x3e8648['count']=_0x2a4644[_0x731d('0x5a')];if(_0x3e8648[_0x731d('0x9a')]===0x0)return[];return db[_0x731d('0x9b')][_0x731d('0x39')](_0x1f39bd[_0x731d('0x99')](),_0x55dece)[_0x731d('0x2a')](function(_0x8590e){_0x5b101e=_['keyBy'](_0x8590e,'id');_0x55dece=_[_0x731d('0x9c')](_0x55dece,{'model':db[_0x731d('0x9d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e423c[_0x731d('0x39')]['fields']){_0x29a95e[_0x731d('0x3d')]['forEach'](function(_0x4f6a04){_0x49c357[_0x731d('0x41')]('i.'+_0x4f6a04);});}else{_0x49c357[_0x731d('0x41')](_0x731d('0x8d'),_0x731d('0x5c'));_0x49c357[_0x731d('0x41')](_0x731d('0x9e'),_0x731d('0x9f'));_0x49c357[_0x731d('0x41')](_0x731d('0xa0'),_0x731d('0xa1'));_0x49c357[_0x731d('0x41')](_0x731d('0xa2'),_0x731d('0x8f'));_0x49c357[_0x731d('0x41')](_0x731d('0xa3'));_0x49c357['field']('c.firstName',_0x731d('0xa4'));_0x49c357['field']('c.lastName',_0x731d('0xa5'));_0x49c357[_0x731d('0x41')](_0x731d('0xa6'),_0x731d('0xa7'));_0x49c357[_0x731d('0x41')](_0x731d('0xa8'),'Contact.phone');_0x49c357[_0x731d('0x41')](_0x731d('0xa9'),_0x731d('0xaa'));_0x49c357[_0x731d('0x41')]('c.fax','Contact.fax');_0x49c357[_0x731d('0x41')](_0x731d('0xab'),_0x731d('0xac'));_0x49c357['field'](_0x731d('0xad'),_0x731d('0xae'));_0x49c357['field'](_0x731d('0xaf'),_0x731d('0x31'));}if(_0x29a95e[_0x731d('0x24')])_0x49c357[_0x731d('0x24')](_0x29a95e[_0x731d('0x24')]);if(_0x29a95e[_0x731d('0x23')])_0x49c357[_0x731d('0x23')](_0x29a95e[_0x731d('0x23')]);return db[_0x731d('0x9b')][_0x731d('0x39')](_0x49c357[_0x731d('0x99')](),_0x55dece);})['then'](function(_0x138edc){_0x327506[_0x731d('0x75')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x138edc,'id'));return db[_0x731d('0x9b')][_0x731d('0x39')](_0x327506[_0x731d('0x99')](),_0x55dece)[_0x731d('0x2a')](function(_0x4cfaff){var _0x461b45=_['groupBy'](_0x4cfaff,_0x731d('0xb0'));var _0x311b40=[];_0x138edc[_0x731d('0x6d')](function(_0x14c367){_0x311b40[_0x731d('0x33')](updateOpenchannelInteraction(_0x14c367,_0x5b101e,_0x461b45));});return BPromise[_0x731d('0xb1')](_0x311b40);});});})[_0x731d('0x2a')](function(_0x4eedfd){_0x3e8648[_0x731d('0xb2')]=_0x4eedfd;return _0x3e8648;})['then'](respondWithFilteredResult(_0x38cebb,_0x29a95e))[_0x731d('0x34')](handleError(_0x38cebb,null));};exports[_0x731d('0xb3')]=function(_0x477a9d,_0x46239d){var _0x212034={};if(_0x477a9d[_0x731d('0x39')]['type']&&_0x477a9d[_0x731d('0x39')][_0x731d('0x69')]===_0x731d('0x4a')){_0x212034[_0x731d('0x4a')]=_0x477a9d['params']['id'];}else{_0x212034['id']=_0x477a9d[_0x731d('0xb4')]['id'];}var _0x1f2706={'raw':![],'where':_0x212034},_0x2a31ea={};_0x2a31ea['model']=_['keys'](db[_0x731d('0x9d')]['rawAttributes']);_0x2a31ea['query']=_['keys'](_0x477a9d['query']);_0x2a31ea['filters']=_['intersection'](_0x2a31ea[_0x731d('0x38')],_0x2a31ea['query']);_0x1f2706[_0x731d('0x3d')]=_[_0x731d('0x3c')](_0x2a31ea[_0x731d('0x38')],qs['fields'](_0x477a9d[_0x731d('0x39')][_0x731d('0x3e')]));_0x1f2706[_0x731d('0x3d')]=_0x1f2706[_0x731d('0x3d')]['length']?_0x1f2706['attributes']:_0x2a31ea[_0x731d('0x38')];if(_0x477a9d[_0x731d('0x39')][_0x731d('0xb5')]){_0x1f2706[_0x731d('0xb6')]=[{'all':!![]}];}_0x1f2706=_[_0x731d('0x9c')]({},_0x1f2706,_0x477a9d['options']);return db[_0x731d('0x9d')]['find'](_0x1f2706)[_0x731d('0x2a')](handleEntityNotFound(_0x46239d,null))[_0x731d('0x2a')](respondWithResult(_0x46239d,null))[_0x731d('0x34')](handleError(_0x46239d,null));};exports[_0x731d('0xb7')]=function(_0x18429b,_0x268e48){return db['OpenchannelInteraction']['create'](_0x18429b[_0x731d('0xb8')],{})[_0x731d('0x2a')](respondWithResult(_0x268e48,0xc9))[_0x731d('0x34')](handleError(_0x268e48,null));};exports[_0x731d('0xb9')]=function(_0x4cd6fe,_0xbb10d7){if(_0x4cd6fe[_0x731d('0xb8')]['id']){delete _0x4cd6fe['body']['id'];}return db[_0x731d('0x9d')][_0x731d('0x5b')]({'where':{'id':_0x4cd6fe['params']['id']}})[_0x731d('0x2a')](handleEntityNotFound(_0xbb10d7,null))[_0x731d('0x2a')](saveUpdates(_0x4cd6fe[_0x731d('0xb8')],null))[_0x731d('0x2a')](respondWithResult(_0xbb10d7,null))['catch'](handleError(_0xbb10d7,null));};exports[_0x731d('0x29')]=function(_0x35770d,_0x482d65){return db[_0x731d('0x9d')][_0x731d('0x5b')]({'where':{'id':_0x35770d[_0x731d('0xb4')]['id']}})[_0x731d('0x2a')](handleEntityNotFound(_0x482d65,null))['then'](removeEntity(_0x482d65,null))[_0x731d('0x34')](handleError(_0x482d65,null));};exports[_0x731d('0xba')]=function(_0x114008,_0x363fcd){return db['OpenchannelInteraction'][_0x731d('0xba')]()[_0x731d('0x2a')](respondWithResult(_0x363fcd,null))[_0x731d('0x34')](handleError(_0x363fcd,null));};exports[_0x731d('0xbb')]=function(_0x417f41,_0x20fbda,_0x6758ce){return db['OpenchannelMessage'][_0x731d('0x5b')]({'where':{'id':_0x417f41[_0x731d('0xb4')]['id']}})['then'](handleEntityNotFound(_0x20fbda,null))['then'](function(_0x4e4879){if(_0x4e4879){return _0x4e4879[_0x731d('0xbb')](_0x417f41[_0x731d('0xb8')]['ids'],_[_0x731d('0xbc')](_0x417f41[_0x731d('0xb8')],[_0x731d('0xbd'),'id'])||{});}})[_0x731d('0x2a')](respondWithResult(_0x20fbda,null))[_0x731d('0x34')](handleError(_0x20fbda,null));};exports['getMessages']=function(_0x261070,_0xec9bf9,_0x4128d7){var _0x3ff3af={'raw':![],'where':{}};var _0x326719={};var _0x160ec1={'count':0x0,'rows':[]};return db[_0x731d('0x9d')]['findOne']({'where':{'id':_0x261070[_0x731d('0xb4')]['id']}})[_0x731d('0x2a')](handleEntityNotFound(_0xec9bf9,null))[_0x731d('0x2a')](function(_0x45e8cf){if(_0x45e8cf){_0x326719[_0x731d('0x38')]=_['keys'](db['OpenchannelMessage'][_0x731d('0x36')]);_0x326719[_0x731d('0x39')]=_[_0x731d('0x3a')](_0x261070[_0x731d('0x39')]);_0x326719[_0x731d('0x3b')]=_['intersection'](_0x326719[_0x731d('0x38')],_0x326719[_0x731d('0x39')]);_0x3ff3af[_0x731d('0x3d')]=_[_0x731d('0x3c')](_0x326719['model'],qs[_0x731d('0x3e')](_0x261070['query'][_0x731d('0x3e')]));_0x3ff3af[_0x731d('0x3d')]=_0x3ff3af['attributes'][_0x731d('0x5a')]?_0x3ff3af[_0x731d('0x3d')]:_0x326719[_0x731d('0x38')];if(!_0x261070[_0x731d('0x39')][_0x731d('0xbe')]('nolimit')){_0x3ff3af['limit']=qs[_0x731d('0x24')](_0x261070[_0x731d('0x39')][_0x731d('0x24')]);_0x3ff3af['offset']=qs[_0x731d('0x23')](_0x261070['query'][_0x731d('0x23')]);}_0x3ff3af['order']=qs['sort'](_0x261070['query'][_0x731d('0x3f')]);_0x3ff3af['where']=qs[_0x731d('0x3b')](_[_0x731d('0x40')](_0x261070[_0x731d('0x39')],_0x326719[_0x731d('0x3b')]));_0x3ff3af[_0x731d('0x75')][_0x731d('0xb0')]=_0x45e8cf['id'];if(_0x261070['query'][_0x731d('0x81')]){_0x3ff3af[_0x731d('0x75')]=_[_0x731d('0x9c')](_0x3ff3af[_0x731d('0x75')],{'$or':_[_0x731d('0x30')](_0x3ff3af[_0x731d('0x3d')],function(_0x502521){var _0x14aee2={};_0x14aee2[_0x502521]={'$like':'%'+_0x261070[_0x731d('0x39')][_0x731d('0x81')]+'%'};return _0x14aee2;})});}if(_0x261070[_0x731d('0x39')][_0x731d('0xbf')]){var _0x48e66a=_0x261070[_0x731d('0x39')][_0x731d('0xbf')][_0x731d('0x6c')](',');var _0x49e955={};_0x49e955[_0x48e66a[0x0]]={'$gte':moment(_0x48e66a[0x1])[_0x731d('0xc0')](_0x731d('0xc1'))};_0x3ff3af[_0x731d('0x75')]=_[_0x731d('0x9c')](_0x3ff3af[_0x731d('0x75')],_0x49e955);}_0x3ff3af=_[_0x731d('0x9c')]({},_0x3ff3af,_0x261070['options']);return db[_0x731d('0xc2')][_0x731d('0x9a')]({'where':_0x3ff3af['where']})['then'](function(_0x3858ee){_0x160ec1[_0x731d('0x9a')]=_0x3858ee;if(_0x261070[_0x731d('0x39')][_0x731d('0xb5')]){_0x3ff3af[_0x731d('0xb6')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x731d('0xc3')](_0x3ff3af);})['then'](function(_0x5d8db0){_0x160ec1['rows']=_0x5d8db0;return _0x160ec1;});}})[_0x731d('0x2a')](respondWithFilteredResult(_0xec9bf9,_0x3ff3af))[_0x731d('0x34')](handleError(_0xec9bf9,null));};exports[_0x731d('0xc4')]=function(_0x57ca04,_0x4e8896,_0x3364e0){return db[_0x731d('0x9d')][_0x731d('0x5b')]({'where':{'id':_0x57ca04['params']['id']}})['then'](handleEntityNotFound(_0x4e8896,null))[_0x731d('0x2a')](function(_0x8c2b33){if(_0x8c2b33){return _0x8c2b33['setTags'](_0x57ca04['body'][_0x731d('0xbd')],_['omit'](_0x57ca04[_0x731d('0xb8')],[_0x731d('0xbd'),'id'])||{})[_0x731d('0xc5')](function(){return db['Tag'][_0x731d('0xc3')]({'attributes':['id','name',_0x731d('0x42')],'where':{'id':_0x57ca04[_0x731d('0xb8')][_0x731d('0xbd')]}});})[_0x731d('0x2a')](function(_0x2ef451){socket[_0x731d('0xc6')](_0x731d('0xc7'),{'id':Number(_0x57ca04[_0x731d('0xb4')]['id']),'tags':_0x2ef451||[]});return{'id':Number(_0x57ca04[_0x731d('0xb4')]['id']),'tags':_0x2ef451||[]};});}})[_0x731d('0x2a')](respondWithResult(_0x4e8896,null))[_0x731d('0x34')](handleError(_0x4e8896,null));};exports[_0x731d('0xc8')]=function(_0x26ebbc,_0x5382c8,_0x89653f){return db[_0x731d('0x9d')][_0x731d('0x5b')]({'where':{'id':_0x26ebbc[_0x731d('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5382c8,null))[_0x731d('0x2a')](function(_0x48df10){if(_0x48df10){return _0x48df10[_0x731d('0xc8')](_0x26ebbc[_0x731d('0x39')]['ids']);}})[_0x731d('0x2a')](respondWithStatusCode(_0x5382c8,null))[_0x731d('0x34')](handleError(_0x5382c8,null));};exports[_0x731d('0xc9')]=function(_0x23dd3e,_0xac67de){var _0x50ffd7=moment()[_0x731d('0xca')]()[_0x731d('0x99')]();var _0x1fa9d1=path[_0x731d('0xcb')](config[_0x731d('0xcc')],_0x731d('0xcd'),_0x731d('0xce'),_0x731d('0xcf'));var _0x53c346=path[_0x731d('0xcb')](config['root'],_0x731d('0xcd'),'files',_0x731d('0xd0'));var _0x325607=path[_0x731d('0xcb')](_0x1fa9d1,_0x50ffd7);var _0x2451bb=util['format'](_0x731d('0xd1'),_0x23dd3e[_0x731d('0xb4')]['id'],_0x50ffd7);var _0x5915a0=path[_0x731d('0xcb')](_0x1fa9d1,_0x2451bb);var _0x5af296=[];_0x5af296[_0x731d('0x33')]({'model':db[_0x731d('0x70')],'as':_0x731d('0x70'),'attributes':['id',_0x731d('0xd2')],'raw':!![]});_0x5af296[_0x731d('0x33')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x731d('0xd3'),_0x731d('0xd4')],'raw':!![]});if(_0x23dd3e[_0x731d('0x39')][_0x731d('0xd0')]){_0x5af296[_0x731d('0x33')]({'model':db[_0x731d('0xd5')],'as':_0x731d('0xd5'),'raw':!![]});}var _0x5facc6=[{'model':db[_0x731d('0xc2')],'as':_0x731d('0xd6'),'attributes':['id','body',_0x731d('0x78'),_0x731d('0xd7'),_0x731d('0xd8'),'read'],'include':_0x5af296}];_0x5facc6[_0x731d('0x33')]({'model':db[_0x731d('0xd9')],'as':'Account','attributes':['id',_0x731d('0x2d')]});_0x5facc6[_0x731d('0x33')]({'model':db['User'],'as':_0x731d('0xda'),'attributes':['id',_0x731d('0xd2')]});return db['OpenchannelInteraction'][_0x731d('0x5b')]({'where':{'id':_0x23dd3e[_0x731d('0xb4')]['id']},'include':_0x5facc6})['then'](handleEntityNotFound(_0xac67de,null))[_0x731d('0x2a')](function(_0x2bdec7){if(_0x2bdec7){var _0x537463=_0x2bdec7['get']({'plain':!![]});fs[_0x731d('0xdb')](_0x325607);var _0x48bc7c={'format':'A4','border':_0x731d('0xdc'),'header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x731d('0xc0')](_0x731d('0xdd'),_0x731d('0xde'),_0x537463['id']),moment()['format'](_0x731d('0xdf'))['toString']())}}};var _0x14d69a={'channel':_0x731d('0xde'),'account':_0x537463[_0x731d('0xe0')][_0x731d('0x2d')],'agent':_0x537463['Owner']?_0x537463[_0x731d('0xda')]['fullname']:_0x731d('0xe1'),'createdAt':moment(_0x537463[_0x731d('0x78')])[_0x731d('0xc0')](_0x731d('0xc1'))['toString'](),'closedAt':_0x537463[_0x731d('0xe2')]?moment(_0x537463['closedAt'])[_0x731d('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x537463['disposition'],'visibility':_0x537463[_0x731d('0xe3')]?_0x731d('0xe4'):'Private','messages':_(_0x537463[_0x731d('0xd6')])['filter']({'secret':![]})[_0x731d('0x30')](function(_0x4bf41b){if(_0x4bf41b[_0x731d('0xd5')]){var _0x76f45d=path[_0x731d('0xcb')](_0x53c346,_0x4bf41b[_0x731d('0xd5')][_0x731d('0xe5')]);if(fs[_0x731d('0xe6')](_0x76f45d)){fs[_0x731d('0xe7')](_0x76f45d)[_0x731d('0xe8')](fs[_0x731d('0xe9')](path[_0x731d('0xcb')](_0x325607,_0x4bf41b['Attachment'][_0x731d('0xe5')])));}}return{'date':moment(_0x4bf41b[_0x731d('0x78')])[_0x731d('0xc0')](_0x731d('0xc1'))[_0x731d('0x99')](),'sender':_0x4bf41b[_0x731d('0xd7')]==='out'?_0x4bf41b['User']?_0x4bf41b[_0x731d('0x70')][_0x731d('0xd2')]:'System':_0x4bf41b[_0x731d('0x60')][_0x731d('0xd3')]+(_0x4bf41b[_0x731d('0x60')][_0x731d('0xd4')]?'\x20'+_0x4bf41b[_0x731d('0x60')][_0x731d('0xd4')]:''),'body':_0x4bf41b[_0x731d('0xd5')]?_0x4bf41b[_0x731d('0xd5')][_0x731d('0xe5')]:_0x4bf41b['body'],'direction':_0x4bf41b[_0x731d('0xd7')]==='out'?'A':'C','secret':_0x4bf41b[_0x731d('0xd8')],'read':_0x4bf41b[_0x731d('0x7d')],'attachment':_0x4bf41b[_0x731d('0xd5')]};})[_0x731d('0x63')]()};return ejs[_0x731d('0xea')](path['join'](config['root'],_0x731d('0xcd'),_0x731d('0xeb'),_0x731d('0xec')),{'interaction':_0x14d69a})['then'](function(_0x34773a){return new BPromise(function(_0x11a52f,_0x4a69ca){pdf['create'](_0x34773a,_0x48bc7c)[_0x731d('0xed')](path['join'](_0x325607,_0x731d('0xee')+_0x537463['id']+'-'+_0x50ffd7+_0x731d('0xef')),function(_0x4e56b0,_0x328cc1){if(_0x4e56b0)return _0x4a69ca(_0x4e56b0);_0x11a52f(_0x328cc1);});});})['then'](function(){return new BPromise(function(_0x162489,_0x422767){zipdir(_0x325607,{'saveTo':_0x5915a0},function(_0x21cda0,_0xee3f37){if(_0x21cda0)return _0x422767(_0x21cda0);return _0x162489(_0xee3f37);});})[_0x731d('0x2a')](function(){return new BPromise(function(_0x3b9e34,_0x1d1818){rimraf(_0x325607,function(_0x495c74){if(_0x495c74)_0x1d1818(_0x495c74);return _0x3b9e34();});});})[_0x731d('0x2a')](function(){return _0xac67de[_0x731d('0xc9')](_0x5915a0,_0x2451bb,function(_0x16b191){if(_0x16b191){console[_0x731d('0xf0')]('err',_0x16b191);}else{fs[_0x731d('0xf1')](_0x5915a0);}});});});}else{return _0xac67de[_0x731d('0x1f')](0xc8);}})['catch'](handleError(_0xac67de,null));}; \ No newline at end of file +var _0xc944=['limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','body','start','some','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','OpenchannelAccountId','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','show','params','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','root','server','tmp','files','join','lastName','attachments','Attachment','Messages','createdAt','secret','OpenchannelAccount','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','firstName','direction','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','count','offset'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xc944,0xd7));var _0x4c94=function(_0x2b6f2d,_0x36670e){_0x2b6f2d=_0x2b6f2d-0x0;var _0x568615=_0xc944[_0x2b6f2d];return _0x568615;};'use strict';var pdf=require(_0x4c94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4c94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c94('0x2'));var rp=require('request-promise');var moment=require(_0x4c94('0x3'));var BPromise=require(_0x4c94('0x4'));var Mustache=require(_0x4c94('0x5'));var util=require(_0x4c94('0x6'));var path=require(_0x4c94('0x7'));var sox=require(_0x4c94('0x8'));var csv=require(_0x4c94('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c94('0xa'));var squel=require(_0x4c94('0xb'));var crypto=require(_0x4c94('0xc'));var jsforce=require(_0x4c94('0xd'));var deskjs=require(_0x4c94('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4c94('0xf'));var Papa=require(_0x4c94('0x10'));var Redis=require(_0x4c94('0x11'));var authService=require(_0x4c94('0x12'));var qs=require(_0x4c94('0x13'));var as=require(_0x4c94('0x14'));var hardwareService=require(_0x4c94('0x15'));var logger=require(_0x4c94('0x16'))(_0x4c94('0x17'));var utils=require(_0x4c94('0x18'));var config=require(_0x4c94('0x19'));var licenseUtil=require(_0x4c94('0x1a'));var db=require(_0x4c94('0x1b'))['db'];config[_0x4c94('0x1c')]=_[_0x4c94('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c94('0x1c')]));require(_0x4c94('0x1e'))[_0x4c94('0x1f')](socket);function respondWithStatusCode(_0x200be6,_0x2a4505){_0x2a4505=_0x2a4505||0xcc;return function(_0x289341){if(_0x289341){return _0x200be6[_0x4c94('0x20')](_0x2a4505);}return _0x200be6[_0x4c94('0x21')](_0x2a4505)['end']();};}function respondWithResult(_0x3629f1,_0x3e5397){_0x3e5397=_0x3e5397||0xc8;return function(_0x124744){if(_0x124744){return _0x3629f1[_0x4c94('0x21')](_0x3e5397)['json'](_0x124744);}};}function respondWithFilteredResult(_0x4757ad,_0x510243){return function(_0x49c86d){if(_0x49c86d){var _0x5a5888=_0x49c86d[_0x4c94('0x22')],_0x52dd70=_0x510243[_0x4c94('0x23')],_0x3b0638=_0x510243[_0x4c94('0x23')]+_0x510243[_0x4c94('0x24')],_0x422e8a;if(_0x3b0638>=_0x5a5888){_0x3b0638=_0x5a5888;_0x422e8a=0xc8;}else{_0x422e8a=0xce;}_0x4757ad[_0x4c94('0x21')](_0x422e8a);return _0x4757ad[_0x4c94('0x25')](_0x4c94('0x26'),_0x52dd70+'-'+_0x3b0638+'/'+_0x5a5888)[_0x4c94('0x27')](_0x49c86d);}return null;};}function patchUpdates(_0x199137){return function(_0x3bd2c4){try{jsonpatch[_0x4c94('0x28')](_0x3bd2c4,_0x199137,!![]);}catch(_0x538f84){return BPromise[_0x4c94('0x29')](_0x538f84);}return _0x3bd2c4[_0x4c94('0x2a')]();};}function saveUpdates(_0x4b3529,_0x92dbb2){return function(_0x35e782){if(_0x35e782){return _0x35e782[_0x4c94('0x2b')](_0x4b3529)[_0x4c94('0x2c')](function(_0x5a024d){return _0x5a024d;});}return null;};}function removeEntity(_0x458585,_0x1c144e){return function(_0x40a4af){if(_0x40a4af){return _0x40a4af[_0x4c94('0x2d')]()['then'](function(){_0x458585[_0x4c94('0x21')](0xcc)[_0x4c94('0x2e')]();});}};}function handleEntityNotFound(_0x110688,_0x6357e2){return function(_0x35b335){if(!_0x35b335){_0x110688[_0x4c94('0x20')](0x194);}return _0x35b335;};}function handleError(_0x4c35c3,_0x401dc0){_0x401dc0=_0x401dc0||0x1f4;return function(_0x4515ee){logger['error'](_0x4515ee['stack']);if(_0x4515ee[_0x4c94('0x2f')]){delete _0x4515ee['name'];}_0x4c35c3['status'](_0x401dc0)[_0x4c94('0x30')](_0x4515ee);};}function getInteractionUsers(_0x3e257a,_0x3ee0b0){return new BPromise(function(_0x1bbce2,_0x46dde1){try{if(_0x3ee0b0[_0x3e257a['id']]){_0x3e257a['Users']=_[_0x4c94('0x31')](_0x3ee0b0[_0x3e257a['id']],function(_0x48ddf1){return{'id':_0x48ddf1['id'],'fullname':_0x48ddf1[_0x4c94('0x32')]};});}}catch(_0xe3f8fb){_0x46dde1(_0xe3f8fb);}_0x1bbce2(_0x3e257a);});}function getInteractionTags(_0x591ff5,_0x5f1b89){return new BPromise(function(_0x834f76,_0x379b4f){try{if(_0x591ff5[_0x4c94('0x33')]){_0x591ff5[_0x4c94('0x34')]=[];_0x591ff5['TagIds'][_0x4c94('0x35')](',')[_0x4c94('0x36')](function(_0x13ab37){_0x591ff5[_0x4c94('0x34')][_0x4c94('0x37')](_0x5f1b89[_0x13ab37]);});}delete _0x591ff5[_0x4c94('0x33')];}catch(_0x1a436a){_0x379b4f(_0x1a436a);}_0x834f76(_0x591ff5);});}function updateOpenchannelInteraction(_0x3f9a94,_0x1f66b9,_0x2bd4fe){return new BPromise(function(_0x4f1261,_0x29ebd1){return getInteractionUsers(_0x3f9a94,_0x2bd4fe)['then'](function(_0xa419a4){return getInteractionTags(_0xa419a4,_0x1f66b9);})[_0x4c94('0x2c')](function(_0x26466c){_0x4f1261(_0x26466c);})[_0x4c94('0x38')](function(_0x45b344){_0x29ebd1(_0x45b344);});});}exports[_0x4c94('0x39')]=function(_0xe2742d,_0xe5eac){var _0xbef912={},_0x5dc719={},_0x3a5398={'count':0x0,'rows':[]};var _0x5bbc35=_[_0x4c94('0x31')](db[_0x4c94('0x3a')]['rawAttributes'],function(_0x4cbdeb){return{'name':_0x4cbdeb['fieldName'],'type':_0x4cbdeb[_0x4c94('0x3b')][_0x4c94('0x3c')]};});_0x5dc719[_0x4c94('0x3d')]=_[_0x4c94('0x31')](_0x5bbc35,_0x4c94('0x2f'));_0x5dc719[_0x4c94('0x3e')]=_[_0x4c94('0x3f')](_0xe2742d[_0x4c94('0x3e')]);_0x5dc719['filters']=_[_0x4c94('0x40')](_0x5dc719[_0x4c94('0x3d')],_0x5dc719[_0x4c94('0x3e')]);_0xbef912[_0x4c94('0x41')]=_[_0x4c94('0x40')](_0x5dc719[_0x4c94('0x3d')],qs[_0x4c94('0x42')](_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x42')]));_0xbef912['attributes']=_0xbef912['attributes']['length']?_0xbef912[_0x4c94('0x41')]:_0x5dc719[_0x4c94('0x3d')];if(!_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x43')](_0x4c94('0x44'))){_0xbef912[_0x4c94('0x24')]=qs[_0x4c94('0x24')](_0xe2742d['query'][_0x4c94('0x24')]);_0xbef912[_0x4c94('0x23')]=qs[_0x4c94('0x23')](_0xe2742d['query']['offset']);}_0xbef912[_0x4c94('0x45')]=qs[_0x4c94('0x46')](_0xe2742d['query'][_0x4c94('0x46')]);_0xbef912['where']=qs[_0x4c94('0x47')](_[_0x4c94('0x48')](_0xe2742d['query'],_0x5dc719[_0x4c94('0x47')]),_0x5bbc35);var _0x251458=[];var _0x169750=squel[_0x4c94('0x49')]()['field']('id')[_0x4c94('0x4a')](_0x4c94('0x2f'))[_0x4c94('0x4a')]('color')[_0x4c94('0x4b')](_0x4c94('0x4c'));var _0x238e2a=squel[_0x4c94('0x49')]()[_0x4c94('0x4a')](_0x4c94('0x4d'))[_0x4c94('0x4a')](_0x4c94('0x4e'))[_0x4c94('0x4a')](_0x4c94('0x4f'))[_0x4c94('0x4b')](_0x4c94('0x50'),'ui')[_0x4c94('0x51')](_0x4c94('0x52'),'u',_0x4c94('0x53'));var _0x383f4f=squel[_0x4c94('0x49')]()['from']('openchannel_interactions','i')['left_join'](_0x4c94('0x54'),'c',_0x4c94('0x55'))[_0x4c94('0x51')](_0x4c94('0x52'),'o',_0x4c94('0x56'))[_0x4c94('0x51')]('openchannel_accounts','a',_0x4c94('0x57'))[_0x4c94('0x51')]('openchannel_messages','me',_0x4c94('0x58'))[_0x4c94('0x51')](_0x4c94('0x59'),'it',_0x4c94('0x5a'))['left_join']('tools_tags','t',_0x4c94('0x5b'));var _0x9c6e0e=squel['expr']();var _0x561444=[];var _0x47f951=squel[_0x4c94('0x5c')]();var _0x4061e4;if(_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x5d')]){_0x4061e4=as[_0x4c94('0x5e')](_0xe2742d[_0x4c94('0x3e')]['search']);var _0x56641d=_0x4061e4[_0x4c94('0x5f')];for(var _0x530be1=0x0;_0x530be1<_0x4061e4[_0x4c94('0x60')][_0x4c94('0x61')];_0x530be1++){var _0x164f74=_0x4061e4[_0x4c94('0x60')][_0x530be1];var _0x3ce48c='i';var _0x457ded=_[_0x4c94('0x62')](_0x5bbc35,[_0x4c94('0x2f'),_0x164f74[_0x4c94('0x4a')]]);if(!_0x457ded){switch(_0x164f74[_0x4c94('0x4a')]){case _0x4c94('0x63'):if(_0x164f74[_0x4c94('0x64')]==0x1){_0x383f4f[_0x4c94('0x65')]('`'+_0x164f74[_0x4c94('0x4a')]+_0x4c94('0x66'));}else{_0x383f4f[_0x4c94('0x65')]('`'+_0x164f74['field']+_0x4c94('0x67'));}break;case _0x4c94('0x68'):if(_0x164f74[_0x4c94('0x69')]===_0x4c94('0x6a')){if(_0x164f74[_0x4c94('0x64')][_0x4c94('0x35')]('\x20')[_0x4c94('0x61')]>0x1){_0x9c6e0e[_0x56641d](_0x4c94('0x6b'),qs[_0x4c94('0x6c')](_0x164f74['value']),null);}else{var _0x3e3828='%'+_0x164f74[_0x4c94('0x64')]+'%';_0x9c6e0e[_0x56641d](_0x4c94('0x6d'),_0x3e3828,_0x3e3828,_0x3e3828);}}else{_0x457ded=_[_0x4c94('0x62')](_0x5bbc35,[_0x4c94('0x2f'),_0x4c94('0x6e')]);_0x164f74[_0x4c94('0x4a')]=_0x4c94('0x6e');_0x53484f=as['buildExpression'](_0x3ce48c,_0x457ded[_0x4c94('0x3b')],_0x164f74);_0x9c6e0e[_0x56641d](_0x53484f[_0x4c94('0x6f')],_0x53484f[_0x4c94('0x64')]['start'],_0x53484f['value']['end']);}break;case _0x4c94('0x70'):var _0x3daf69=_0x164f74[_0x4c94('0x64')][_0x4c94('0x35')](',')[_0x4c94('0x31')](function(_0x44825c){return Number(_0x44825c);});_0x3daf69[_0x4c94('0x36')](function(_0x154a0b){_0x47f951['or'](_0x4c94('0x71'),'%,'+_0x154a0b+',%');});_0x561444=_[_0x4c94('0x72')](_0x561444,_0x3daf69);break;case _0x4c94('0x73'):if(_0x164f74['operator']===_0x4c94('0x6a')){_0x9c6e0e[_0x56641d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x164f74[_0x4c94('0x64')]+'%',null);}else{_0x457ded=_[_0x4c94('0x62')](_0x5bbc35,[_0x4c94('0x2f'),_0x4c94('0x74')]);_0x164f74[_0x4c94('0x4a')]=_0x4c94('0x74');_0x53484f=as[_0x4c94('0x75')](_0x3ce48c,_0x457ded['type'],_0x164f74);_0x9c6e0e[_0x56641d](_0x53484f[_0x4c94('0x6f')],_0x53484f[_0x4c94('0x64')]['start'],_0x53484f[_0x4c94('0x64')][_0x4c94('0x2e')]);}break;case _0x4c94('0x76'):_0x53484f=as['buildExpression']('me',null,_0x164f74);_0x9c6e0e[_0x56641d](_0x53484f['text'],_0x53484f[_0x4c94('0x64')][_0x4c94('0x77')],_0x53484f[_0x4c94('0x64')][_0x4c94('0x2e')]);break;}}else{var _0x53484f=as[_0x4c94('0x75')](_0x3ce48c,_0x457ded[_0x4c94('0x3b')],_0x164f74);_0x9c6e0e[_0x56641d](_0x53484f[_0x4c94('0x6f')],_0x53484f[_0x4c94('0x64')][_0x4c94('0x77')],_0x53484f[_0x4c94('0x64')][_0x4c94('0x2e')]);}}}else{var _0x1885be=_(_0xe2742d[_0x4c94('0x3e')])[_0x4c94('0x3f')]()[_0x4c94('0x31')](function(_0x65f5f2){return _[_0x4c94('0x78')](_0x5bbc35,[_0x4c94('0x2f'),_0x65f5f2])?_0x65f5f2:undefined;})['compact']()[_0x4c94('0x64')]();if(!_[_0x4c94('0x79')](_0x1885be)){_0x1885be['forEach'](function(_0x4d2781){if(_0x4d2781==='OpenchannelAccountId'){_0x383f4f[_0x4c94('0x7a')](_0x4c94('0x7b'),[][_0x4c94('0x7c')](_0xe2742d[_0x4c94('0x3e')][_0x4d2781]));}else if(_0x4d2781==='createdAt'){var _0x344b21=JSON[_0x4c94('0x7d')](_0xe2742d[_0x4c94('0x3e')][_0x4d2781])[_0x4c94('0x7e')];var _0x51e70d=JSON[_0x4c94('0x7d')](_0xe2742d[_0x4c94('0x3e')][_0x4d2781])[_0x4c94('0x7f')];_0x383f4f[_0x4c94('0x7a')](_0x4c94('0x80'),_0x344b21,_0x51e70d);}else{if(_0xe2742d['query'][_0x4d2781]===_0x4c94('0x81')){_0x383f4f[_0x4c94('0x7a')]('i.'+_0x4d2781+'\x20IS\x20NULL');}else{_0x383f4f[_0x4c94('0x7a')]('i.'+_0x4d2781+_0x4c94('0x82'),_0xe2742d[_0x4c94('0x3e')][_0x4d2781]);}}});}if(_0xe2742d[_0x4c94('0x3e')]['read']){if(_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x83')]==0x1){_0x383f4f[_0x4c94('0x65')]('`unreadMessages`\x20=\x200');}else{_0x383f4f[_0x4c94('0x65')](_0x4c94('0x84'));}}if(_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x85')]){_0x561444=_[_0x4c94('0x86')](_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x85')])?_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x85')]:new Array(_0xe2742d[_0x4c94('0x3e')]['tag']);_0x561444['forEach'](function(_0x2324cd){_0x47f951['or'](_0x4c94('0x71'),'%,'+_0x2324cd+',%');});}if(_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x87')]){var _0x346192=_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x87')][_0x4c94('0x88')]('\x5c','\x5c\x5c')[_0x4c94('0x88')](/'/g,'\x27\x27');if(qs[_0x4c94('0x89')](_0x346192)){_0x9c6e0e['or'](_0x4c94('0x8a'),_0x346192+'%');}else{_0x9c6e0e['or'](_0x4c94('0x8b'),qs[_0x4c94('0x6c')](_0x346192))['or']('i.from\x20LIKE\x20?',_0x346192+'%')['or'](_0x4c94('0x8c'),_0x346192+'%');}}}_0x383f4f[_0x4c94('0x7a')](_0x9c6e0e);_0x383f4f[_0x4c94('0x8d')](_0x4c94('0x8e'));var _0x25b7fc={'type':db['Sequelize']['QueryTypes'][_0x4c94('0x8f')],'raw':!![]};var _0x322d8e=_0x383f4f[_0x4c94('0x90')]();_0x322d8e[_0x4c94('0x4a')]('i.id');_0x322d8e['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4c94('0x63'));if(_0xbef912['order']){_0xbef912[_0x4c94('0x45')][_0x4c94('0x36')](function(_0x179b5b){var _0x5b091b=_0x179b5b[0x0]==='contactName'?_0x179b5b[0x0]:'i.'+_0x179b5b[0x0];_0x383f4f[_0x4c94('0x45')](_0x5b091b,_0x179b5b[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4c94('0x79')](_0x561444)){_0x383f4f['having'](_0x47f951);_0x322d8e['where'](_0x4c94('0x91'),_0x561444);}BPromise[_0x4c94('0x92')]()[_0x4c94('0x2c')](function(){if(!_0x4061e4){if(_0xe2742d[_0x4c94('0x3e')]['OpenchannelAccountId'])return;_0x322d8e[_0x4c94('0x7a')](_0x4c94('0x93'));_0x383f4f['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xe2742d[_0x4c94('0x94')][_0x4c94('0x95')]!==_0x4c94('0x96'))return;return _0xe2742d[_0x4c94('0x94')][_0x4c94('0x97')]({'attributes':['id'],'raw':!![]})[_0x4c94('0x2c')](function(_0x2c758d){if(_[_0x4c94('0x79')](_0x2c758d)){_0x322d8e[_0x4c94('0x7a')](_0x4c94('0x98'));_0x383f4f[_0x4c94('0x7a')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x322d8e[_0x4c94('0x7a')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x2c758d,'id'));_0x383f4f[_0x4c94('0x7a')](_0x4c94('0x7b'),_['map'](_0x2c758d,'id'));}});})[_0x4c94('0x2c')](function(){if(_0xe2742d['user']['role']===_0x4c94('0x96')&&!_0x4061e4&&!_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x99')])return[];return db[_0x4c94('0x9a')][_0x4c94('0x3e')](_0x322d8e[_0x4c94('0x9b')](),_0x25b7fc);})[_0x4c94('0x2c')](function(_0x562b1a){_0x3a5398[_0x4c94('0x22')]=_0x562b1a[_0x4c94('0x61')];if(_0x3a5398['count']===0x0)return[];return db[_0x4c94('0x9a')][_0x4c94('0x3e')](_0x169750[_0x4c94('0x9b')](),_0x25b7fc)[_0x4c94('0x2c')](function(_0xb191d9){_0x251458=_[_0x4c94('0x9c')](_0xb191d9,'id');_0x25b7fc=_[_0x4c94('0x9d')](_0x25b7fc,{'model':db[_0x4c94('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe2742d[_0x4c94('0x3e')][_0x4c94('0x42')]){_0xbef912[_0x4c94('0x41')][_0x4c94('0x36')](function(_0x21abb6){_0x383f4f[_0x4c94('0x4a')]('i.'+_0x21abb6);});}else{_0x383f4f['field'](_0x4c94('0x9e'),'unreadMessages');_0x383f4f['field'](_0x4c94('0x9f'),'Account.key');_0x383f4f['field'](_0x4c94('0xa0'),_0x4c94('0xa1'));_0x383f4f[_0x4c94('0x4a')]('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',_0x4c94('0xa2'));_0x383f4f['field']('i.*');_0x383f4f[_0x4c94('0x4a')](_0x4c94('0xa3'),_0x4c94('0xa4'));_0x383f4f['field']('c.lastName',_0x4c94('0xa5'));_0x383f4f[_0x4c94('0x4a')](_0x4c94('0xa6'),_0x4c94('0xa7'));_0x383f4f[_0x4c94('0x4a')](_0x4c94('0xa8'),_0x4c94('0xa9'));_0x383f4f[_0x4c94('0x4a')](_0x4c94('0xaa'),_0x4c94('0xab'));_0x383f4f[_0x4c94('0x4a')](_0x4c94('0xac'),_0x4c94('0xad'));_0x383f4f[_0x4c94('0x4a')](_0x4c94('0xae'),_0x4c94('0xaf'));_0x383f4f[_0x4c94('0x4a')](_0x4c94('0xb0'),'Owner.internal');_0x383f4f['field'](_0x4c94('0xb1'),_0x4c94('0x33'));}if(_0xbef912[_0x4c94('0x24')])_0x383f4f[_0x4c94('0x24')](_0xbef912[_0x4c94('0x24')]);if(_0xbef912[_0x4c94('0x23')])_0x383f4f[_0x4c94('0x23')](_0xbef912[_0x4c94('0x23')]);return db['sequelize'][_0x4c94('0x3e')](_0x383f4f[_0x4c94('0x9b')](),_0x25b7fc);})[_0x4c94('0x2c')](function(_0x4b2dea){_0x238e2a[_0x4c94('0x7a')](_0x4c94('0xb2'),_['map'](_0x4b2dea,'id'));return db[_0x4c94('0x9a')]['query'](_0x238e2a[_0x4c94('0x9b')](),_0x25b7fc)[_0x4c94('0x2c')](function(_0x773c6){var _0x89c9b0=_['groupBy'](_0x773c6,_0x4c94('0xb3'));var _0x540780=[];_0x4b2dea[_0x4c94('0x36')](function(_0xd4636b){_0x540780[_0x4c94('0x37')](updateOpenchannelInteraction(_0xd4636b,_0x251458,_0x89c9b0));});return BPromise['all'](_0x540780);});});})['then'](function(_0xff06c3){_0x3a5398[_0x4c94('0xb4')]=_0xff06c3;return _0x3a5398;})[_0x4c94('0x2c')](respondWithFilteredResult(_0xe5eac,_0xbef912))[_0x4c94('0x38')](handleError(_0xe5eac,null));};exports[_0x4c94('0xb5')]=function(_0x58e654,_0x176be0){var _0x217198={};if(_0x58e654['query'][_0x4c94('0x3b')]&&_0x58e654['query']['type']==='from'){_0x217198[_0x4c94('0x4b')]=_0x58e654[_0x4c94('0xb6')]['id'];}else{_0x217198['id']=_0x58e654[_0x4c94('0xb6')]['id'];}var _0xa1333f={'raw':![],'where':_0x217198},_0xa5c83a={};_0xa5c83a['model']=_['keys'](db[_0x4c94('0x3a')]['rawAttributes']);_0xa5c83a[_0x4c94('0x3e')]=_[_0x4c94('0x3f')](_0x58e654[_0x4c94('0x3e')]);_0xa5c83a['filters']=_['intersection'](_0xa5c83a[_0x4c94('0x3d')],_0xa5c83a['query']);_0xa1333f[_0x4c94('0x41')]=_['intersection'](_0xa5c83a[_0x4c94('0x3d')],qs[_0x4c94('0x42')](_0x58e654[_0x4c94('0x3e')][_0x4c94('0x42')]));_0xa1333f['attributes']=_0xa1333f[_0x4c94('0x41')][_0x4c94('0x61')]?_0xa1333f[_0x4c94('0x41')]:_0xa5c83a['model'];if(_0x58e654['query'][_0x4c94('0xb7')]){_0xa1333f[_0x4c94('0xb8')]=[{'all':!![]}];}_0xa1333f=_[_0x4c94('0x9d')]({},_0xa1333f,_0x58e654[_0x4c94('0xb9')]);return db[_0x4c94('0x3a')]['find'](_0xa1333f)['then'](handleEntityNotFound(_0x176be0,null))[_0x4c94('0x2c')](respondWithResult(_0x176be0,null))['catch'](handleError(_0x176be0,null));};exports['create']=function(_0x48e862,_0x328d21){return db[_0x4c94('0x3a')][_0x4c94('0xba')](_0x48e862['body'],{})[_0x4c94('0x2c')](respondWithResult(_0x328d21,0xc9))[_0x4c94('0x38')](handleError(_0x328d21,null));};exports[_0x4c94('0x2b')]=function(_0x31c054,_0x1ce255){if(_0x31c054[_0x4c94('0x76')]['id']){delete _0x31c054[_0x4c94('0x76')]['id'];}return db[_0x4c94('0x3a')][_0x4c94('0x62')]({'where':{'id':_0x31c054[_0x4c94('0xb6')]['id']}})[_0x4c94('0x2c')](handleEntityNotFound(_0x1ce255,null))[_0x4c94('0x2c')](saveUpdates(_0x31c054[_0x4c94('0x76')],null))[_0x4c94('0x2c')](respondWithResult(_0x1ce255,null))[_0x4c94('0x38')](handleError(_0x1ce255,null));};exports[_0x4c94('0x2d')]=function(_0xd4d4b4,_0x489c78){return db['OpenchannelInteraction'][_0x4c94('0x62')]({'where':{'id':_0xd4d4b4['params']['id']}})[_0x4c94('0x2c')](handleEntityNotFound(_0x489c78,null))[_0x4c94('0x2c')](removeEntity(_0x489c78,null))[_0x4c94('0x38')](handleError(_0x489c78,null));};exports[_0x4c94('0xbb')]=function(_0x1edbd8,_0x5ef968){return db[_0x4c94('0x3a')][_0x4c94('0xbb')]()[_0x4c94('0x2c')](respondWithResult(_0x5ef968,null))['catch'](handleError(_0x5ef968,null));};exports[_0x4c94('0xbc')]=function(_0x1186e6,_0x11a493,_0x530ee1){return db[_0x4c94('0xbd')][_0x4c94('0x62')]({'where':{'id':_0x1186e6['params']['id']}})[_0x4c94('0x2c')](handleEntityNotFound(_0x11a493,null))['then'](function(_0xa693aa){if(_0xa693aa){return _0xa693aa[_0x4c94('0xbc')](_0x1186e6[_0x4c94('0x76')]['ids'],_[_0x4c94('0xbe')](_0x1186e6['body'],[_0x4c94('0xbf'),'id'])||{});}})[_0x4c94('0x2c')](respondWithResult(_0x11a493,null))['catch'](handleError(_0x11a493,null));};exports[_0x4c94('0xc0')]=function(_0x3f7531,_0x5bd9df,_0x7ce907){var _0x2d7e70={'raw':![],'where':{}};var _0x462305={};var _0x30e684={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x4c94('0xc1')]({'where':{'id':_0x3f7531[_0x4c94('0xb6')]['id']}})[_0x4c94('0x2c')](handleEntityNotFound(_0x5bd9df,null))[_0x4c94('0x2c')](function(_0xd17987){if(_0xd17987){_0x462305['model']=_[_0x4c94('0x3f')](db['OpenchannelMessage'][_0x4c94('0xc2')]);_0x462305['query']=_[_0x4c94('0x3f')](_0x3f7531['query']);_0x462305[_0x4c94('0x47')]=_['intersection'](_0x462305[_0x4c94('0x3d')],_0x462305[_0x4c94('0x3e')]);_0x2d7e70[_0x4c94('0x41')]=_[_0x4c94('0x40')](_0x462305['model'],qs[_0x4c94('0x42')](_0x3f7531[_0x4c94('0x3e')]['fields']));_0x2d7e70[_0x4c94('0x41')]=_0x2d7e70[_0x4c94('0x41')]['length']?_0x2d7e70[_0x4c94('0x41')]:_0x462305[_0x4c94('0x3d')];if(!_0x3f7531[_0x4c94('0x3e')][_0x4c94('0x43')](_0x4c94('0x44'))){_0x2d7e70[_0x4c94('0x24')]=qs[_0x4c94('0x24')](_0x3f7531[_0x4c94('0x3e')][_0x4c94('0x24')]);_0x2d7e70[_0x4c94('0x23')]=qs['offset'](_0x3f7531[_0x4c94('0x3e')][_0x4c94('0x23')]);}_0x2d7e70[_0x4c94('0x45')]=qs[_0x4c94('0x46')](_0x3f7531[_0x4c94('0x3e')][_0x4c94('0x46')]);_0x2d7e70['where']=qs[_0x4c94('0x47')](_[_0x4c94('0x48')](_0x3f7531[_0x4c94('0x3e')],_0x462305[_0x4c94('0x47')]));_0x2d7e70[_0x4c94('0x7a')]['OpenchannelInteractionId']=_0xd17987['id'];if(_0x3f7531[_0x4c94('0x3e')]['filter']){_0x2d7e70[_0x4c94('0x7a')]=_['merge'](_0x2d7e70['where'],{'$or':_[_0x4c94('0x31')](_0x2d7e70[_0x4c94('0x41')],function(_0x8c64c3){var _0xa46ec={};_0xa46ec[_0x8c64c3]={'$like':'%'+_0x3f7531[_0x4c94('0x3e')]['filter']+'%'};return _0xa46ec;})});}if(_0x3f7531[_0x4c94('0x3e')][_0x4c94('0x7e')]){var _0x28d7a8=_0x3f7531[_0x4c94('0x3e')]['$gte']['split'](',');var _0xc11b92={};_0xc11b92[_0x28d7a8[0x0]]={'$gte':moment(_0x28d7a8[0x1])[_0x4c94('0xc3')](_0x4c94('0xc4'))};_0x2d7e70[_0x4c94('0x7a')]=_['merge'](_0x2d7e70[_0x4c94('0x7a')],_0xc11b92);}_0x2d7e70=_[_0x4c94('0x9d')]({},_0x2d7e70,_0x3f7531[_0x4c94('0xb9')]);return db[_0x4c94('0xbd')][_0x4c94('0x22')]({'where':_0x2d7e70[_0x4c94('0x7a')]})[_0x4c94('0x2c')](function(_0x5995eb){_0x30e684[_0x4c94('0x22')]=_0x5995eb;if(_0x3f7531[_0x4c94('0x3e')][_0x4c94('0xb7')]){_0x2d7e70[_0x4c94('0xb8')]=[{'all':!![]}];}return db[_0x4c94('0xbd')][_0x4c94('0xc5')](_0x2d7e70);})[_0x4c94('0x2c')](function(_0x56cfe6){_0x30e684[_0x4c94('0xb4')]=_0x56cfe6;return _0x30e684;});}})['then'](respondWithFilteredResult(_0x5bd9df,_0x2d7e70))[_0x4c94('0x38')](handleError(_0x5bd9df,null));};exports[_0x4c94('0xc6')]=function(_0x1af75c,_0x49270a,_0x24b703){return db[_0x4c94('0x3a')][_0x4c94('0x62')]({'where':{'id':_0x1af75c[_0x4c94('0xb6')]['id']}})[_0x4c94('0x2c')](handleEntityNotFound(_0x49270a,null))[_0x4c94('0x2c')](function(_0x107dcd){if(_0x107dcd){return _0x107dcd[_0x4c94('0xc7')](_0x1af75c['body'][_0x4c94('0xbf')],_[_0x4c94('0xbe')](_0x1af75c['body'],[_0x4c94('0xbf'),'id'])||{})[_0x4c94('0xc8')](function(){return db[_0x4c94('0x70')][_0x4c94('0xc5')]({'attributes':['id',_0x4c94('0x2f'),_0x4c94('0xc9')],'where':{'id':_0x1af75c[_0x4c94('0x76')][_0x4c94('0xbf')]}});})[_0x4c94('0x2c')](function(_0x219f8d){socket[_0x4c94('0xca')](_0x4c94('0xcb'),{'id':Number(_0x1af75c['params']['id']),'tags':_0x219f8d||[]});return{'id':Number(_0x1af75c[_0x4c94('0xb6')]['id']),'tags':_0x219f8d||[]};});}})['then'](respondWithResult(_0x49270a,null))[_0x4c94('0x38')](handleError(_0x49270a,null));};exports[_0x4c94('0xcc')]=function(_0x14538a,_0x430111,_0x36f745){return db[_0x4c94('0x3a')][_0x4c94('0x62')]({'where':{'id':_0x14538a[_0x4c94('0xb6')]['id']}})[_0x4c94('0x2c')](handleEntityNotFound(_0x430111,null))['then'](function(_0x40e38d){if(_0x40e38d){return _0x40e38d[_0x4c94('0xcc')](_0x14538a[_0x4c94('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x430111,null))[_0x4c94('0x38')](handleError(_0x430111,null));};exports['download']=function(_0x5d1ee2,_0x3baa3b){var _0x2e3f65=moment()['unix']()['toString']();var _0x5c3301=path['join'](config[_0x4c94('0xcd')],_0x4c94('0xce'),'files',_0x4c94('0xcf'));var _0x2bc8b7=path['join'](config['root'],_0x4c94('0xce'),_0x4c94('0xd0'),'attachments');var _0x52a66e=path[_0x4c94('0xd1')](_0x5c3301,_0x2e3f65);var _0x32fc8d=util[_0x4c94('0xc3')]('transcript-%d-%s.zip',_0x5d1ee2[_0x4c94('0xb6')]['id'],_0x2e3f65);var _0x3313b3=path[_0x4c94('0xd1')](_0x5c3301,_0x32fc8d);var _0x40927e=[];_0x40927e[_0x4c94('0x37')]({'model':db[_0x4c94('0x73')],'as':_0x4c94('0x73'),'attributes':['id',_0x4c94('0x32')],'raw':!![]});_0x40927e[_0x4c94('0x37')]({'model':db['CmContact'],'as':_0x4c94('0x68'),'attributes':['id','firstName',_0x4c94('0xd2')],'raw':!![]});if(_0x5d1ee2['query'][_0x4c94('0xd3')]){_0x40927e[_0x4c94('0x37')]({'model':db[_0x4c94('0xd4')],'as':_0x4c94('0xd4'),'raw':!![]});}var _0x358aa3=[{'model':db['OpenchannelMessage'],'as':_0x4c94('0xd5'),'attributes':['id',_0x4c94('0x76'),_0x4c94('0xd6'),'direction',_0x4c94('0xd7'),'read'],'include':_0x40927e}];_0x358aa3['push']({'model':db[_0x4c94('0xd8')],'as':_0x4c94('0xd9'),'attributes':['id',_0x4c94('0x2f')]});_0x358aa3['push']({'model':db[_0x4c94('0x73')],'as':'Owner','attributes':['id','fullname']});return db[_0x4c94('0x3a')][_0x4c94('0x62')]({'where':{'id':_0x5d1ee2[_0x4c94('0xb6')]['id']},'include':_0x358aa3})[_0x4c94('0x2c')](handleEntityNotFound(_0x3baa3b,null))['then'](function(_0x1aafe1){if(_0x1aafe1){var _0x31956a=_0x1aafe1[_0x4c94('0xda')]({'plain':!![]});fs[_0x4c94('0xdb')](_0x52a66e);var _0x549882={'format':'A4','border':_0x4c94('0xdc'),'header':{'height':_0x4c94('0xdd'),'contents':{'first':_0x4c94('0xde')}},'footer':{'height':_0x4c94('0xdf'),'contents':{'default':util[_0x4c94('0xc3')](_0x4c94('0xe0'),util[_0x4c94('0xc3')](_0x4c94('0xe1'),_0x4c94('0xe2'),_0x31956a['id']),moment()['format'](_0x4c94('0xe3'))[_0x4c94('0x9b')]())}}};var _0x41a56a={'channel':'Openchannel','account':_0x31956a[_0x4c94('0xd9')][_0x4c94('0x2f')],'agent':_0x31956a[_0x4c94('0xe4')]?_0x31956a[_0x4c94('0xe4')]['fullname']:_0x4c94('0xe5'),'createdAt':moment(_0x31956a[_0x4c94('0xd6')])[_0x4c94('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4c94('0x9b')](),'closedAt':_0x31956a[_0x4c94('0xe6')]?moment(_0x31956a[_0x4c94('0xe7')])['format'](_0x4c94('0xc4'))['toString']():'','disposition':_0x31956a[_0x4c94('0xe8')],'visibility':_0x31956a['threadId']?_0x4c94('0xe9'):_0x4c94('0xea'),'messages':_(_0x31956a[_0x4c94('0xd5')])[_0x4c94('0x87')]({'secret':![]})['map'](function(_0x18939c){if(_0x18939c[_0x4c94('0xd4')]){var _0x98dbae=path[_0x4c94('0xd1')](_0x2bc8b7,_0x18939c['Attachment'][_0x4c94('0xeb')]);if(fs[_0x4c94('0xec')](_0x98dbae)){fs[_0x4c94('0xed')](_0x98dbae)[_0x4c94('0xee')](fs[_0x4c94('0xef')](path[_0x4c94('0xd1')](_0x52a66e,_0x18939c[_0x4c94('0xd4')][_0x4c94('0xeb')])));}}return{'date':moment(_0x18939c[_0x4c94('0xd6')])[_0x4c94('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4c94('0x9b')](),'sender':_0x18939c['direction']==='out'?_0x18939c[_0x4c94('0x73')]?_0x18939c['User']['fullname']:_0x4c94('0xf0'):_0x18939c[_0x4c94('0x68')][_0x4c94('0xf1')]+(_0x18939c[_0x4c94('0x68')]['lastName']?'\x20'+_0x18939c[_0x4c94('0x68')][_0x4c94('0xd2')]:''),'body':_0x18939c['Attachment']?_0x18939c[_0x4c94('0xd4')][_0x4c94('0xeb')]:_0x18939c['body'],'direction':_0x18939c[_0x4c94('0xf2')]==='out'?'A':'C','secret':_0x18939c[_0x4c94('0xd7')],'read':_0x18939c[_0x4c94('0x83')],'attachment':_0x18939c[_0x4c94('0xd4')]};})[_0x4c94('0x64')]()};return ejs[_0x4c94('0xf3')](path[_0x4c94('0xd1')](config[_0x4c94('0xcd')],_0x4c94('0xce'),_0x4c94('0xf4'),_0x4c94('0xf5')),{'interaction':_0x41a56a})[_0x4c94('0x2c')](function(_0x4b7e96){return new BPromise(function(_0x3808a0,_0x3b8350){pdf[_0x4c94('0xba')](_0x4b7e96,_0x549882)[_0x4c94('0xf6')](path[_0x4c94('0xd1')](_0x52a66e,_0x4c94('0xf7')+_0x31956a['id']+'-'+_0x2e3f65+_0x4c94('0xf8')),function(_0x4a548a,_0x1ef1d3){if(_0x4a548a)return _0x3b8350(_0x4a548a);_0x3808a0(_0x1ef1d3);});});})['then'](function(){return new BPromise(function(_0x3a0138,_0x35ee52){zipdir(_0x52a66e,{'saveTo':_0x3313b3},function(_0x5d5820,_0x2954fb){if(_0x5d5820)return _0x35ee52(_0x5d5820);return _0x3a0138(_0x2954fb);});})[_0x4c94('0x2c')](function(){return new BPromise(function(_0x12f647,_0x37534c){rimraf(_0x52a66e,function(_0x3c45de){if(_0x3c45de)_0x37534c(_0x3c45de);return _0x12f647();});});})['then'](function(){return _0x3baa3b['download'](_0x3313b3,_0x32fc8d,function(_0x4a705f){if(_0x4a705f){console['log'](_0x4c94('0xf9'),_0x4a705f);}else{fs[_0x4c94('0xfa')](_0x3313b3);}});});});}else{return _0x3baa3b[_0x4c94('0x20')](0xc8);}})[_0x4c94('0x38')](handleError(_0x3baa3b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5b1bc0a..ccc612f 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 _0x7df8=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x42e57a,_0x206d5d){var _0x37b280=function(_0x24ac26){while(--_0x24ac26){_0x42e57a['push'](_0x42e57a['shift']());}};_0x37b280(++_0x206d5d);}(_0x7df8,0x1e2));var _0x87df=function(_0x5708b0,_0xfbf56c){_0x5708b0=_0x5708b0-0x0;var _0x2fcbe0=_0x7df8[_0x5708b0];return _0x2fcbe0;};'use strict';var EventEmitter=require(_0x87df('0x0'));var OpenchannelInteraction=require(_0x87df('0x1'))['db'][_0x87df('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x87df('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x87df('0x4'),'afterUpdate':_0x87df('0x5'),'afterDestroy':_0x87df('0x6')};function emitEvent(_0x4ef640){return function(_0x31a28f,_0x3dbc12,_0x30a995){_0x31a28f[_0x87df('0x7')]({'attributes':['id'],'raw':!![]})[_0x87df('0x8')](function(_0x1a0076){_0x31a28f[_0x87df('0x9')](_0x87df('0xa'),_0x1a0076[_0x87df('0xb')](function(_0x478d58){return{'id':_0x478d58['id']};}));return OpenchannelMessage[_0x87df('0xc')]({'where':{'OpenchannelInteractionId':_0x31a28f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x87df('0x8')](function(_0x471814){_0x31a28f[_0x87df('0x9')](_0x87df('0xd'),_0x471814[_0x87df('0xe')]);OpenchannelInteractionEvents[_0x87df('0xf')](_0x4ef640+':'+_0x31a28f['id'],_0x31a28f);OpenchannelInteractionEvents[_0x87df('0xf')](_0x4ef640,_0x31a28f);_0x30a995(null);})[_0x87df('0x10')](_0x30a995(null));};}for(var e in events){if(events[_0x87df('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x87df('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x34a7=['findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','then','setDataValue','Users','map'];(function(_0x224f30,_0x4483c7){var _0x2a67ad=function(_0xa2ece9){while(--_0xa2ece9){_0x224f30['push'](_0x224f30['shift']());}};_0x2a67ad(++_0x4483c7);}(_0x34a7,0x1f3));var _0x734a=function(_0x4c3888,_0x2d8d2){_0x4c3888=_0x4c3888-0x0;var _0x4b0bbc=_0x34a7[_0x4c3888];return _0x4b0bbc;};'use strict';var EventEmitter=require(_0x734a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x734a('0x1')];var OpenchannelMessage=require(_0x734a('0x2'))['db'][_0x734a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x734a('0x4')](0x0);var events={'afterCreate':_0x734a('0x5'),'afterUpdate':_0x734a('0x6'),'afterDestroy':'remove'};function emitEvent(_0x398734){return function(_0x4acfb6,_0x1806d1,_0x149d56){_0x4acfb6['getUsers']({'attributes':['id'],'raw':!![]})[_0x734a('0x7')](function(_0x1e32b4){_0x4acfb6[_0x734a('0x8')](_0x734a('0x9'),_0x1e32b4[_0x734a('0xa')](function(_0x5b1bca){return{'id':_0x5b1bca['id']};}));return OpenchannelMessage[_0x734a('0xb')]({'where':{'OpenchannelInteractionId':_0x4acfb6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x26e966){_0x4acfb6[_0x734a('0x8')](_0x734a('0xc'),_0x26e966['length']);OpenchannelInteractionEvents[_0x734a('0xd')](_0x398734+':'+_0x4acfb6['id'],_0x4acfb6);OpenchannelInteractionEvents['emit'](_0x398734,_0x4acfb6);_0x149d56(null);})[_0x734a('0xe')](_0x149d56(null));};}for(var e in events){if(events[_0x734a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x734a('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0f070b5..4ba0782 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 _0xd101=['request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird'];(function(_0x36e70a,_0x4b182d){var _0xcbbc9a=function(_0xfcd070){while(--_0xfcd070){_0x36e70a['push'](_0x36e70a['shift']());}};_0xcbbc9a(++_0x4b182d);}(_0xd101,0xc1));var _0x1d10=function(_0x42c4be,_0x8ea715){_0x42c4be=_0x42c4be-0x0;var _0x174b3f=_0xd101[_0x42c4be];return _0x174b3f;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x1d10('0x9')]=function(_0x203072,_0x2a4e2d){return _0x203072[_0x1d10('0xa')](_0x1d10('0xb'),attributes,{'tableName':_0x1d10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6d6def,_0x43df2c,_0x3a15c8){if(_0x6d6def[_0x1d10('0xd')](_0x1d10('0xe'))){_0x6d6def[_0x1d10('0xf')]=moment()[_0x1d10('0x10')](_0x1d10('0x11'));}_0x3a15c8(null,_0x6d6def);}}});}; \ No newline at end of file +var _0xd2bb=['openchannel_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x21a273,_0x5cd8e2){var _0x3e58a3=function(_0x2b525a){while(--_0x2b525a){_0x21a273['push'](_0x21a273['shift']());}};_0x3e58a3(++_0x5cd8e2);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x1aa13e,_0x1e7396){_0x1aa13e=_0x1aa13e-0x0;var _0x57ad6b=_0xd2bb[_0x1aa13e];return _0x57ad6b;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30cd3f,_0x259bca,_0x3fc39e){if(_0x30cd3f['changed'](_0xbd2b('0xc'))){_0x30cd3f['closedAt']=moment()[_0xbd2b('0xd')](_0xbd2b('0xe'));}_0x3fc39e(null,_0x30cd3f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 324c805..a44fe56 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 _0xa9c1=['update','body','options','where','attributes','limit','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction'];(function(_0x15f976,_0x158494){var _0x16b3a4=function(_0x4b39a6){while(--_0x4b39a6){_0x15f976['push'](_0x15f976['shift']());}};_0x16b3a4(++_0x158494);}(_0xa9c1,0x174));var _0x1a9c=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xa9c1[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x1a9c('0x0'));var util=require(_0x1a9c('0x1'));var moment=require(_0x1a9c('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a9c('0x3'));var fs=require('fs');var Redis=require(_0x1a9c('0x4'));var db=require(_0x1a9c('0x5'))['db'];var utils=require(_0x1a9c('0x6'));var logger=require(_0x1a9c('0x7'))(_0x1a9c('0x8'));var config=require(_0x1a9c('0x9'));var jayson=require(_0x1a9c('0xa'));var client=jayson[_0x1a9c('0xb')][_0x1a9c('0xc')]({'port':0x232a});config[_0x1a9c('0xd')]=_[_0x1a9c('0xe')](config[_0x1a9c('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a9c('0xd')]));require(_0x1a9c('0xf'))['register'](socket);function respondWithRpcPromise(_0x378bfe,_0x536cba,_0x1b8431){return new BPromise(function(_0x3e62cd,_0x243801){return client['request'](_0x378bfe,_0x1b8431)[_0x1a9c('0x10')](function(_0x381435){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x536cba,_0x1a9c('0x11'));logger[_0x1a9c('0x12')](_0x1a9c('0x13'),_0x536cba,'request\x20sent',JSON[_0x1a9c('0x14')](_0x381435));if(_0x381435[_0x1a9c('0x15')]){if(_0x381435['error'][_0x1a9c('0x16')]===0x1f4){logger[_0x1a9c('0x15')](_0x1a9c('0x17'),_0x536cba,_0x381435[_0x1a9c('0x15')][_0x1a9c('0x18')]);return _0x243801(_0x381435[_0x1a9c('0x15')]['message']);}logger['error'](_0x1a9c('0x17'),_0x536cba,_0x381435[_0x1a9c('0x15')][_0x1a9c('0x18')]);return _0x3e62cd(_0x381435[_0x1a9c('0x15')][_0x1a9c('0x18')]);}else{logger['info'](_0x1a9c('0x17'),_0x536cba,'request\x20sent');_0x3e62cd(_0x381435['result'][_0x1a9c('0x18')]);}})[_0x1a9c('0x19')](function(_0x3f1bce){logger[_0x1a9c('0x15')](_0x1a9c('0x17'),_0x536cba,_0x3f1bce);_0x243801(_0x3f1bce);});});}exports[_0x1a9c('0x1a')]=function(_0x1e8832){var _0x46782e=this;return new Promise(function(_0x269c92,_0x2de41b){return db[_0x1a9c('0x1b')][_0x1a9c('0x1c')](_0x1e8832[_0x1a9c('0x1d')],{'raw':_0x1e8832[_0x1a9c('0x1e')]?_0x1e8832[_0x1a9c('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8832['options']?_0x1e8832[_0x1a9c('0x1e')][_0x1a9c('0x1f')]||null:null,'attributes':_0x1e8832[_0x1a9c('0x1e')]?_0x1e8832[_0x1a9c('0x1e')][_0x1a9c('0x20')]||null:null,'limit':_0x1e8832[_0x1a9c('0x1e')]?_0x1e8832['options'][_0x1a9c('0x21')]||null:null})[_0x1a9c('0x10')](function(_0x4af777){logger['info'](_0x1a9c('0x1a'),_0x1e8832);logger[_0x1a9c('0x12')]('UpdateOpenchannelInteraction',_0x1e8832,JSON[_0x1a9c('0x14')](_0x4af777));_0x269c92(_0x4af777);})['catch'](function(_0x21a4b6){logger[_0x1a9c('0x15')](_0x1a9c('0x1a'),_0x21a4b6[_0x1a9c('0x18')],_0x1e8832);_0x2de41b(_0x46782e[_0x1a9c('0x15')](0x1f4,_0x21a4b6[_0x1a9c('0x18')]));});});};exports[_0x1a9c('0x22')]=function(_0x29f0a4){return new Promise(function(_0x3c1f41,_0x27e987){return db[_0x1a9c('0x1b')]['find']({'where':_0x29f0a4['options']?_0x29f0a4[_0x1a9c('0x1e')][_0x1a9c('0x1f')]||null:null})['then'](function(_0x24e152){if(_0x24e152){return _0x24e152[_0x1a9c('0x23')](_0x29f0a4[_0x1a9c('0x1d')][_0x1a9c('0x24')],_[_0x1a9c('0x25')](_0x29f0a4[_0x1a9c('0x1d')],[_0x1a9c('0x24'),'id'])||{});}})[_0x1a9c('0x26')](function(_0x2cf979){logger['info'](_0x1a9c('0x27'),_0x29f0a4);logger[_0x1a9c('0x12')](_0x1a9c('0x27'),_0x29f0a4,JSON['stringify'](_0x2cf979));_0x3c1f41(_0x2cf979);})['catch'](function(_0x1b0104){logger[_0x1a9c('0x15')]('AddTags',_0x1b0104[_0x1a9c('0x18')],_0x29f0a4);_0x27e987(_this[_0x1a9c('0x15')](0x1f4,_0x1b0104['message']));});});}; \ No newline at end of file +var _0x46ff=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelInteraction','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0xbf4b19,_0x477399){var _0x460c6a=function(_0x38023f){while(--_0x38023f){_0xbf4b19['push'](_0xbf4b19['shift']());}};_0x460c6a(++_0x477399);}(_0x46ff,0xee));var _0xf46f=function(_0x13bfeb,_0x27aa6c){_0x13bfeb=_0x13bfeb-0x0;var _0x218324=_0x46ff[_0x13bfeb];return _0x218324;};'use strict';var _=require(_0xf46f('0x0'));var util=require(_0xf46f('0x1'));var moment=require('moment');var BPromise=require(_0xf46f('0x2'));var rs=require(_0xf46f('0x3'));var fs=require('fs');var Redis=require(_0xf46f('0x4'));var db=require(_0xf46f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf46f('0x6'))('rpc');var config=require(_0xf46f('0x7'));var jayson=require(_0xf46f('0x8'));var client=jayson[_0xf46f('0x9')][_0xf46f('0xa')]({'port':0x232a});config[_0xf46f('0xb')]=_[_0xf46f('0xc')](config[_0xf46f('0xb')],{'host':_0xf46f('0xd'),'port':0x18eb});var socket=require(_0xf46f('0xe'))(new Redis(config[_0xf46f('0xb')]));require(_0xf46f('0xf'))[_0xf46f('0x10')](socket);function respondWithRpcPromise(_0x982538,_0x4fc81f,_0x3a9606){return new BPromise(function(_0x482fd6,_0x4335b8){return client[_0xf46f('0x11')](_0x982538,_0x3a9606)[_0xf46f('0x12')](function(_0x36b4e7){logger[_0xf46f('0x13')](_0xf46f('0x14'),_0x4fc81f,_0xf46f('0x15'));logger['debug'](_0xf46f('0x16'),_0x4fc81f,_0xf46f('0x15'),JSON[_0xf46f('0x17')](_0x36b4e7));if(_0x36b4e7[_0xf46f('0x18')]){if(_0x36b4e7['error']['code']===0x1f4){logger[_0xf46f('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4fc81f,_0x36b4e7['error'][_0xf46f('0x19')]);return _0x4335b8(_0x36b4e7[_0xf46f('0x18')]['message']);}logger[_0xf46f('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4fc81f,_0x36b4e7[_0xf46f('0x18')]['message']);return _0x482fd6(_0x36b4e7[_0xf46f('0x18')][_0xf46f('0x19')]);}else{logger[_0xf46f('0x13')](_0xf46f('0x14'),_0x4fc81f,'request\x20sent');_0x482fd6(_0x36b4e7['result']['message']);}})[_0xf46f('0x1a')](function(_0x1e0deb){logger[_0xf46f('0x18')](_0xf46f('0x14'),_0x4fc81f,_0x1e0deb);_0x4335b8(_0x1e0deb);});});}exports['UpdateOpenchannelInteraction']=function(_0x16b7d7){var _0x103a1e=this;return new Promise(function(_0x4779fa,_0x4baa9a){return db[_0xf46f('0x1b')][_0xf46f('0x1c')](_0x16b7d7['body'],{'raw':_0x16b7d7[_0xf46f('0x1d')]?_0x16b7d7[_0xf46f('0x1d')][_0xf46f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16b7d7[_0xf46f('0x1d')]?_0x16b7d7[_0xf46f('0x1d')][_0xf46f('0x1f')]||null:null,'attributes':_0x16b7d7[_0xf46f('0x1d')]?_0x16b7d7['options'][_0xf46f('0x20')]||null:null,'limit':_0x16b7d7[_0xf46f('0x1d')]?_0x16b7d7[_0xf46f('0x1d')][_0xf46f('0x21')]||null:null})[_0xf46f('0x12')](function(_0x4ccc39){logger[_0xf46f('0x13')]('UpdateOpenchannelInteraction',_0x16b7d7);logger['debug'](_0xf46f('0x22'),_0x16b7d7,JSON['stringify'](_0x4ccc39));_0x4779fa(_0x4ccc39);})['catch'](function(_0x237d52){logger[_0xf46f('0x18')](_0xf46f('0x22'),_0x237d52[_0xf46f('0x19')],_0x16b7d7);_0x4baa9a(_0x103a1e[_0xf46f('0x18')](0x1f4,_0x237d52['message']));});});};exports[_0xf46f('0x23')]=function(_0x1cc420){return new Promise(function(_0x2adef9,_0x1c375d){return db[_0xf46f('0x1b')][_0xf46f('0x24')]({'where':_0x1cc420[_0xf46f('0x1d')]?_0x1cc420['options']['where']||null:null})['then'](function(_0x1597f4){if(_0x1597f4){return _0x1597f4['addTags'](_0x1cc420[_0xf46f('0x25')][_0xf46f('0x26')],_['omit'](_0x1cc420['body'],[_0xf46f('0x26'),'id'])||{});}})[_0xf46f('0x27')](function(_0x412ea9){logger[_0xf46f('0x13')]('AddTags',_0x1cc420);logger['debug']('AddTags',_0x1cc420,JSON[_0xf46f('0x17')](_0x412ea9));_0x2adef9(_0x412ea9);})[_0xf46f('0x1a')](function(_0x4e5593){logger['error'](_0xf46f('0x28'),_0x4e5593[_0xf46f('0x19')],_0x1cc420);_0x1c375d(_this[_0xf46f('0x18')](0x1f4,_0x4e5593[_0xf46f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 59ab3ee..ce41fe6 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 _0x231d=['update','emit','removeListener','register','length','openchannelInteraction:','remove'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0x231d,0x187));var _0xd231=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x231d[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xd231('0x0'),_0xd231('0x1')];function createListener(_0x1cef29,_0x289d16){return function(_0x3ae521){_0x289d16[_0xd231('0x2')](_0x1cef29,_0x3ae521);};}function removeListener(_0x3d4eda,_0x230e1c){return function(){OpenchannelInteractionEvents[_0xd231('0x3')](_0x3d4eda,_0x230e1c);};}exports[_0xd231('0x4')]=function(_0x2b01c1){for(var _0x48509d=0x0,_0x55eaf5=events[_0xd231('0x5')];_0x48509d<_0x55eaf5;_0x48509d++){var _0x391919=events[_0x48509d];var _0x427313=createListener(_0xd231('0x6')+_0x391919,_0x2b01c1);OpenchannelInteractionEvents['on'](_0x391919,_0x427313);}}; \ No newline at end of file +var _0x76cc=['openchannelInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x76cc,0x1b9));var _0xc76c=function(_0x40e5f4,_0xeef05d){_0x40e5f4=_0x40e5f4-0x0;var _0x599025=_0x76cc[_0x40e5f4];return _0x599025;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xc76c('0x0'),_0xc76c('0x1'),_0xc76c('0x2')];function createListener(_0xd44a3a,_0x6d38e4){return function(_0x29bfd2){_0x6d38e4[_0xc76c('0x3')](_0xd44a3a,_0x29bfd2);};}function removeListener(_0x51625a,_0x1c725e){return function(){OpenchannelInteractionEvents[_0xc76c('0x4')](_0x51625a,_0x1c725e);};}exports[_0xc76c('0x5')]=function(_0xdf50ff){for(var _0x2e4a00=0x0,_0x42a3f5=events[_0xc76c('0x6')];_0x2e4a00<_0x42a3f5;_0x2e4a00++){var _0x4921b6=events[_0x2e4a00];var _0x1c0a16=createListener(_0xc76c('0x7')+_0x4921b6,_0xdf50ff);OpenchannelInteractionEvents['on'](_0x4921b6,_0x1c0a16);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ac6a696..e52356e 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 _0x7d0d=['accept','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','isAuthenticated','/:id','post','openchannelmessage:create','create','update','put'];(function(_0x22f7e8,_0x1d71bd){var _0x4f13b6=function(_0x157e73){while(--_0x157e73){_0x22f7e8['push'](_0x22f7e8['shift']());}};_0x4f13b6(++_0x1d71bd);}(_0x7d0d,0x7a));var _0xd7d0=function(_0xc63b73,_0x437e92){_0xc63b73=_0xc63b73-0x0;var _0x74dc42=_0x7d0d[_0xc63b73];return _0x74dc42;};'use strict';var multer=require(_0xd7d0('0x0'));var util=require(_0xd7d0('0x1'));var path=require(_0xd7d0('0x2'));var timeout=require(_0xd7d0('0x3'));var express=require('express');var router=express[_0xd7d0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7d0('0x5'));var config=require(_0xd7d0('0x6'));var controller=require(_0xd7d0('0x7'));router[_0xd7d0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd7d0('0x9')]);router[_0xd7d0('0x8')](_0xd7d0('0xa'),auth[_0xd7d0('0xb')](),controller['describe']);router['get'](_0xd7d0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd7d0('0xd')]('/',auth[_0xd7d0('0xb')](),interaction['tracked']('openchannel',_0xd7d0('0xe')),controller[_0xd7d0('0xf')]);router['put']('/:id',auth[_0xd7d0('0xb')](),controller[_0xd7d0('0x10')]);router[_0xd7d0('0x11')]('/:id/accept',auth[_0xd7d0('0xb')](),controller[_0xd7d0('0x12')]);router[_0xd7d0('0x11')]('/:id/reject',auth[_0xd7d0('0xb')](),controller['reject']);router[_0xd7d0('0x13')](_0xd7d0('0xc'),auth[_0xd7d0('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x68df=['delete','destroy','exports','multer','util','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','/:id','tracked','openchannelmessage:create','create','put','update','accept','/:id/reject','reject'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x68df,0x1e3));var _0xf68d=function(_0x2bbbc2,_0x2fd8b9){_0x2bbbc2=_0x2bbbc2-0x0;var _0x1f0319=_0x68df[_0x2bbbc2];return _0x1f0319;};'use strict';var multer=require(_0xf68d('0x0'));var util=require(_0xf68d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf68d('0x2'));var config=require(_0xf68d('0x3'));var controller=require(_0xf68d('0x4'));router[_0xf68d('0x5')]('/',auth[_0xf68d('0x6')](),controller['index']);router[_0xf68d('0x5')](_0xf68d('0x7'),auth[_0xf68d('0x6')](),controller['describe']);router['get'](_0xf68d('0x8'),auth[_0xf68d('0x6')](),controller['show']);router['post']('/',auth[_0xf68d('0x6')](),interaction[_0xf68d('0x9')]('openchannel',_0xf68d('0xa')),controller[_0xf68d('0xb')]);router[_0xf68d('0xc')](_0xf68d('0x8'),auth[_0xf68d('0x6')](),controller[_0xf68d('0xd')]);router[_0xf68d('0xc')]('/:id/accept',auth['isAuthenticated'](),controller[_0xf68d('0xe')]);router[_0xf68d('0xc')](_0xf68d('0xf'),auth[_0xf68d('0x6')](),controller[_0xf68d('0x10')]);router[_0xf68d('0x11')](_0xf68d('0x8'),auth[_0xf68d('0x6')](),controller[_0xf68d('0x12')]);module[_0xf68d('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 69688df..bde6333 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 _0xcdf3=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcdf3,0xf2));var _0x3cdf=function(_0x75c9f6,_0x5e44df){_0x75c9f6=_0x75c9f6-0x0;var _0x16e9b3=_0xcdf3[_0x75c9f6];return _0x16e9b3;};'use strict';var Sequelize=require(_0x3cdf('0x0'));module[_0x3cdf('0x1')]={'body':{'type':Sequelize[_0x3cdf('0x2')](_0x3cdf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3cdf('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3cdf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3cdf('0x5')]('in',_0x3cdf('0x6')),'defaultValue':_0x3cdf('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3cdf('0x7')]},'providerName':{'type':Sequelize[_0x3cdf('0x8')]},'providerResponse':{'type':Sequelize[_0x3cdf('0x2')]}}; \ No newline at end of file +var _0x2044=['BOOLEAN','ENUM','out','DATE','sequelize','medium'];(function(_0x4a2f38,_0x1f7a62){var _0x232fac=function(_0x42ef28){while(--_0x42ef28){_0x4a2f38['push'](_0x4a2f38['shift']());}};_0x232fac(++_0x1f7a62);}(_0x2044,0x10c));var _0x4204=function(_0x19e26f,_0x10cc8d){_0x19e26f=_0x19e26f-0x0;var _0x7492c8=_0x2044[_0x19e26f];return _0x7492c8;};'use strict';var Sequelize=require(_0x4204('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x4204('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4204('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4204('0x3')]('in','out'),'defaultValue':_0x4204('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4204('0x5')]},'providerName':{'type':Sequelize['STRING']},'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 4edd507..cc0b3fa 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 _0x8ad6=['findAll','params','keys','includeAll','create','update','body','find','destroy','describe','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','accept','EventManager','reject','interface','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./openchannelMessage.socket','register','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filter','where','type','VIRTUAL','merge','options','count','include'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x8ad6,0x9c));var _0x68ad=function(_0x2c9d73,_0x127513){_0x2c9d73=_0x2c9d73-0x0;var _0x2e2e7e=_0x8ad6[_0x2c9d73];return _0x2e2e7e;};'use strict';var pdf=require(_0x68ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x68ad('0x1'));var zipdir=require(_0x68ad('0x2'));var jsonpatch=require(_0x68ad('0x3'));var rp=require(_0x68ad('0x4'));var moment=require(_0x68ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x68ad('0x6'));var util=require('util');var path=require(_0x68ad('0x7'));var sox=require(_0x68ad('0x8'));var csv=require(_0x68ad('0x9'));var ejs=require(_0x68ad('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x68ad('0xb'));var crypto=require(_0x68ad('0xc'));var jsforce=require(_0x68ad('0xd'));var deskjs=require(_0x68ad('0xe'));var toCsv=require(_0x68ad('0x9'));var querystring=require(_0x68ad('0xf'));var Papa=require(_0x68ad('0x10'));var Redis=require(_0x68ad('0x11'));var authService=require(_0x68ad('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68ad('0x13'));var hardwareService=require(_0x68ad('0x14'));var logger=require(_0x68ad('0x15'))(_0x68ad('0x16'));var utils=require('../../config/utils');var config=require(_0x68ad('0x17'));var licenseUtil=require(_0x68ad('0x18'));var db=require(_0x68ad('0x19'))['db'];config['redis']=_[_0x68ad('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68ad('0x1b')]));require(_0x68ad('0x1c'))[_0x68ad('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x68ad('0x1e')][_0x68ad('0x1f')]({'port':0x232c});var client9002=jayson[_0x68ad('0x1e')][_0x68ad('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18c6ac,_0x40cf0b,_0x27bed7,_0x2fa61c){return new BPromise(function(_0x3451e4,_0x281de1){var _0x5cbb9c=_0x2fa61c||client;return _0x5cbb9c['request'](_0x18c6ac,_0x27bed7)[_0x68ad('0x20')](function(_0x4b310b){logger[_0x68ad('0x21')](_0x68ad('0x22'),_0x40cf0b,_0x68ad('0x23'));logger[_0x68ad('0x24')](_0x68ad('0x25'),_0x40cf0b,_0x68ad('0x23'),JSON[_0x68ad('0x26')](_0x4b310b));if(_0x4b310b[_0x68ad('0x27')]){if(_0x4b310b['error'][_0x68ad('0x28')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x40cf0b,_0x4b310b[_0x68ad('0x27')]['message']);return _0x281de1(_0x4b310b[_0x68ad('0x27')]['message']);}logger[_0x68ad('0x27')](_0x68ad('0x22'),_0x40cf0b,_0x4b310b[_0x68ad('0x27')]['message']);return _0x3451e4(_0x4b310b['error'][_0x68ad('0x29')]);}else{logger[_0x68ad('0x21')](_0x68ad('0x22'),_0x40cf0b,'request\x20sent');_0x3451e4(_0x4b310b['result'][_0x68ad('0x29')]);}})[_0x68ad('0x2a')](function(_0x2550f2){logger[_0x68ad('0x27')](_0x68ad('0x22'),_0x40cf0b,_0x2550f2);_0x281de1(_0x2550f2);});});}function respondWithStatusCode(_0x1bc3fc,_0x5cbd12){_0x5cbd12=_0x5cbd12||0xcc;return function(_0x37b1f2){if(_0x37b1f2){return _0x1bc3fc[_0x68ad('0x2b')](_0x5cbd12);}return _0x1bc3fc[_0x68ad('0x2c')](_0x5cbd12)[_0x68ad('0x2d')]();};}function respondWithResult(_0x4ddbe0,_0x254c88){_0x254c88=_0x254c88||0xc8;return function(_0x5ad54a){if(_0x5ad54a){return _0x4ddbe0[_0x68ad('0x2c')](_0x254c88)[_0x68ad('0x2e')](_0x5ad54a);}};}function respondWithFilteredResult(_0x24d0b3,_0x25c5d1){return function(_0xc7cdb3){if(_0xc7cdb3){var _0x5e8fba=_0xc7cdb3['count'],_0x2644b2=_0x25c5d1[_0x68ad('0x2f')],_0x19fd7e=_0x25c5d1[_0x68ad('0x2f')]+_0x25c5d1['limit'],_0x31865a;if(_0x19fd7e>=_0x5e8fba){_0x19fd7e=_0x5e8fba;_0x31865a=0xc8;}else{_0x31865a=0xce;}_0x24d0b3['status'](_0x31865a);return _0x24d0b3[_0x68ad('0x30')](_0x68ad('0x31'),_0x2644b2+'-'+_0x19fd7e+'/'+_0x5e8fba)[_0x68ad('0x2e')](_0xc7cdb3);}return null;};}function patchUpdates(_0x23f8f8){return function(_0x21e9ce){try{jsonpatch[_0x68ad('0x32')](_0x21e9ce,_0x23f8f8,!![]);}catch(_0x3768c1){return BPromise['reject'](_0x3768c1);}return _0x21e9ce['save']();};}function saveUpdates(_0xec6d48,_0x27eb1c){return function(_0x4e88ff){if(_0x4e88ff){return _0x4e88ff['update'](_0xec6d48)['then'](function(_0x4afffc){return _0x4afffc;});}return null;};}function removeEntity(_0x396db7,_0x494073){return function(_0x19f21d){if(_0x19f21d){return _0x19f21d['destroy']()[_0x68ad('0x20')](function(){_0x396db7[_0x68ad('0x2c')](0xcc)[_0x68ad('0x2d')]();});}};}function handleEntityNotFound(_0x58adb7,_0x42c18e){return function(_0x31f0cd){if(!_0x31f0cd){_0x58adb7[_0x68ad('0x2b')](0x194);}return _0x31f0cd;};}function handleError(_0x5a4652,_0x34282c){_0x34282c=_0x34282c||0x1f4;return function(_0x46ae84){logger['error'](_0x46ae84[_0x68ad('0x33')]);if(_0x46ae84[_0x68ad('0x34')]){delete _0x46ae84[_0x68ad('0x34')];}_0x5a4652[_0x68ad('0x2c')](_0x34282c)[_0x68ad('0x35')](_0x46ae84);};}exports[_0x68ad('0x36')]=function(_0x9359b9,_0x2340a7){var _0x46012e={},_0x49c439={},_0x12d28a={'count':0x0,'rows':[]};var _0xd1f6df=_[_0x68ad('0x37')](db[_0x68ad('0x38')][_0x68ad('0x39')],function(_0x2ed916){return{'name':_0x2ed916[_0x68ad('0x3a')],'type':_0x2ed916['type'][_0x68ad('0x3b')]};});_0x49c439[_0x68ad('0x3c')]=_[_0x68ad('0x37')](_0xd1f6df,_0x68ad('0x34'));_0x49c439[_0x68ad('0x3d')]=_['keys'](_0x9359b9[_0x68ad('0x3d')]);_0x49c439[_0x68ad('0x3e')]=_[_0x68ad('0x3f')](_0x49c439['model'],_0x49c439[_0x68ad('0x3d')]);_0x46012e[_0x68ad('0x40')]=_[_0x68ad('0x3f')](_0x49c439[_0x68ad('0x3c')],qs[_0x68ad('0x41')](_0x9359b9[_0x68ad('0x3d')][_0x68ad('0x41')]));_0x46012e[_0x68ad('0x40')]=_0x46012e[_0x68ad('0x40')][_0x68ad('0x42')]?_0x46012e['attributes']:_0x49c439[_0x68ad('0x3c')];if(!_0x9359b9[_0x68ad('0x3d')][_0x68ad('0x43')]('nolimit')){_0x46012e['limit']=qs[_0x68ad('0x44')](_0x9359b9[_0x68ad('0x3d')][_0x68ad('0x44')]);_0x46012e[_0x68ad('0x2f')]=qs['offset'](_0x9359b9[_0x68ad('0x3d')][_0x68ad('0x2f')]);}_0x46012e['order']=qs[_0x68ad('0x45')](_0x9359b9['query']['sort']);_0x46012e['where']=qs[_0x68ad('0x3e')](_['pick'](_0x9359b9['query'],_0x49c439[_0x68ad('0x3e')]),_0xd1f6df);if(_0x9359b9['query'][_0x68ad('0x46')]){_0x46012e['where']=_['merge'](_0x46012e[_0x68ad('0x47')],{'$or':_[_0x68ad('0x37')](_0xd1f6df,function(_0x12281c){if(_0x12281c[_0x68ad('0x48')]!==_0x68ad('0x49')){var _0x43d56b={};_0x43d56b[_0x12281c[_0x68ad('0x34')]]={'$like':'%'+_0x9359b9[_0x68ad('0x3d')]['filter']+'%'};return _0x43d56b;}})});}_0x46012e=_[_0x68ad('0x4a')]({},_0x46012e,_0x9359b9[_0x68ad('0x4b')]);var _0x50477a={'where':_0x46012e[_0x68ad('0x47')]};return db[_0x68ad('0x38')][_0x68ad('0x4c')](_0x50477a)[_0x68ad('0x20')](function(_0x3b3b91){_0x12d28a[_0x68ad('0x4c')]=_0x3b3b91;if(_0x9359b9['query']['includeAll']){_0x46012e[_0x68ad('0x4d')]=[{'all':!![]}];}return db[_0x68ad('0x38')][_0x68ad('0x4e')](_0x46012e);})[_0x68ad('0x20')](function(_0x235681){_0x12d28a['rows']=_0x235681;return _0x12d28a;})[_0x68ad('0x20')](respondWithFilteredResult(_0x2340a7,_0x46012e))[_0x68ad('0x2a')](handleError(_0x2340a7,null));};exports['show']=function(_0x58a8ee,_0x537386){var _0x56b903={'raw':!![],'where':{'id':_0x58a8ee[_0x68ad('0x4f')]['id']}},_0x503c32={};_0x503c32[_0x68ad('0x3c')]=_[_0x68ad('0x50')](db[_0x68ad('0x38')][_0x68ad('0x39')]);_0x503c32[_0x68ad('0x3d')]=_['keys'](_0x58a8ee['query']);_0x503c32[_0x68ad('0x3e')]=_['intersection'](_0x503c32['model'],_0x503c32[_0x68ad('0x3d')]);_0x56b903['attributes']=_[_0x68ad('0x3f')](_0x503c32[_0x68ad('0x3c')],qs['fields'](_0x58a8ee['query']['fields']));_0x56b903[_0x68ad('0x40')]=_0x56b903[_0x68ad('0x40')][_0x68ad('0x42')]?_0x56b903[_0x68ad('0x40')]:_0x503c32[_0x68ad('0x3c')];if(_0x58a8ee[_0x68ad('0x3d')][_0x68ad('0x51')]){_0x56b903[_0x68ad('0x4d')]=[{'all':!![]}];}_0x56b903=_['merge']({},_0x56b903,_0x58a8ee[_0x68ad('0x4b')]);return db[_0x68ad('0x38')]['find'](_0x56b903)[_0x68ad('0x20')](handleEntityNotFound(_0x537386,null))['then'](respondWithResult(_0x537386,null))[_0x68ad('0x2a')](handleError(_0x537386,null));};exports['create']=function(_0x3d5d57,_0x24086b){return db['OpenchannelMessage'][_0x68ad('0x52')](_0x3d5d57['body'],{})['then'](respondWithResult(_0x24086b,0xc9))[_0x68ad('0x2a')](handleError(_0x24086b,null));};exports[_0x68ad('0x53')]=function(_0xffb640,_0x4b7f3a){if(_0xffb640[_0x68ad('0x54')]['id']){delete _0xffb640[_0x68ad('0x54')]['id'];}return db[_0x68ad('0x38')][_0x68ad('0x55')]({'where':{'id':_0xffb640[_0x68ad('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b7f3a,null))[_0x68ad('0x20')](saveUpdates(_0xffb640['body'],null))['then'](respondWithResult(_0x4b7f3a,null))[_0x68ad('0x2a')](handleError(_0x4b7f3a,null));};exports[_0x68ad('0x56')]=function(_0x1cd055,_0x4f613b){return db['OpenchannelMessage']['find']({'where':{'id':_0x1cd055[_0x68ad('0x4f')]['id']}})[_0x68ad('0x20')](handleEntityNotFound(_0x4f613b,null))['then'](removeEntity(_0x4f613b,null))[_0x68ad('0x2a')](handleError(_0x4f613b,null));};exports['describe']=function(_0x5ae667,_0x27c914){return db['OpenchannelMessage'][_0x68ad('0x57')]()['then'](respondWithResult(_0x27c914,null))[_0x68ad('0x2a')](handleError(_0x27c914,null));};var interaction_log=require(_0x68ad('0x15'))(_0x68ad('0x58'));exports['accept']=function(_0x530830,_0x549de0,_0x493d7b){var _0x346dcd={'agent':{},'channel':_0x68ad('0x59')};if(_0x530830[_0x68ad('0x54')]['id']){delete _0x530830[_0x68ad('0x54')]['id'];}_0x530830['body'][_0x68ad('0x5a')]=!![];_0x530830[_0x68ad('0x54')]['readAt']=moment()[_0x68ad('0x5b')](_0x68ad('0x5c'));_0x530830[_0x68ad('0x54')][_0x68ad('0x5d')]=_0x530830['body'][_0x68ad('0x5d')]||_0x530830[_0x68ad('0x5e')]['id'];_0x346dcd[_0x68ad('0x5f')]['id']=_0x530830['body'][_0x68ad('0x5d')];return db[_0x68ad('0x38')][_0x68ad('0x55')]({'where':{'id':_0x530830['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x68ad('0x60')}]})[_0x68ad('0x20')](handleEntityNotFound(_0x549de0,null))[_0x68ad('0x20')](saveUpdates(_0x530830[_0x68ad('0x54')],null))[_0x68ad('0x20')](function(_0x258133){if(_0x258133){_0x346dcd[_0x68ad('0x29')]=_0x258133[_0x68ad('0x61')]({'plain':!![]});return db[_0x68ad('0x62')][_0x68ad('0x55')]({'where':{'id':_0x258133[_0x68ad('0x63')]}});}return null;})[_0x68ad('0x20')](handleEntityNotFound(_0x549de0,null))['then'](function(_0x433903){if(_0x433903){return _0x433903[_0x68ad('0x53')]({'UserId':_0x530830[_0x68ad('0x54')][_0x68ad('0x5d')],'read1stAt':_[_0x68ad('0x64')](_0x433903[_0x68ad('0x65')])?moment()['format'](_0x68ad('0x5c')):undefined});}return null;})[_0x68ad('0x20')](function(_0xc6e562){if(_0xc6e562){_0x346dcd[_0x68ad('0x66')]=_0xc6e562[_0x68ad('0x61')]({'plain':!![]});interaction_log[_0x68ad('0x21')](_0x68ad('0x67'),_0x530830[_0x68ad('0x5e')]['id'],_0x530830[_0x68ad('0x5e')][_0x68ad('0x34')],_0x530830[_0x68ad('0x5e')][_0x68ad('0x68')],_0x346dcd[_0x68ad('0x66')]['id'],_0x530830[_0x68ad('0x54')]?JSON['stringify'](_0x530830[_0x68ad('0x54')]):_0x68ad('0x69'));return respondWithRpcPromise(_0x68ad('0x6a'),_0x68ad('0x6b'),_0x346dcd);}return null;})['then'](function(_0x15de47){if(_0x15de47){if(_0x530830[_0x68ad('0x54')][_0x68ad('0x6c')]){_0x346dcd[_0x68ad('0x29')]['interface']=util[_0x68ad('0x5b')](_0x68ad('0x6d'),_0x530830[_0x68ad('0x5e')][_0x68ad('0x34')]);_0x346dcd[_0x68ad('0x29')][_0x68ad('0x6e')]=_0x346dcd['channel'];_0x346dcd[_0x68ad('0x29')][_0x68ad('0x6f')]=_0x68ad('0x70');return respondWithRpcPromise(_0x68ad('0x71'),_0x68ad('0x71'),{'event':'acceptmessage','message':_0x346dcd['message']},client9002)[_0x68ad('0x20')](function(){return _0x346dcd;});}return _0x346dcd;}return null;})[_0x68ad('0x20')](respondWithResult(_0x549de0,null))[_0x68ad('0x2a')](handleError(_0x549de0,null));};var interaction_log=require(_0x68ad('0x15'))('openchannel-interactions');exports[_0x68ad('0x72')]=function(_0x26eea7,_0xaec44f,_0x466517){var _0x5911cd={'agent':{},'channel':_0x68ad('0x59')};if(_0x26eea7[_0x68ad('0x54')]['id']){delete _0x26eea7['body']['id'];}_0x26eea7[_0x68ad('0x54')]['UserId']=_0x26eea7['body'][_0x68ad('0x5d')]||_0x26eea7[_0x68ad('0x5e')]['id'];_0x5911cd[_0x68ad('0x5f')]['id']=_0x26eea7[_0x68ad('0x54')]['UserId'];return db[_0x68ad('0x38')][_0x68ad('0x55')]({'where':{'id':_0x26eea7[_0x68ad('0x4f')]['id'],'UserId':null}})[_0x68ad('0x20')](handleEntityNotFound(_0xaec44f,null))[_0x68ad('0x20')](function(_0x529007){if(_0x529007){_0x5911cd[_0x68ad('0x29')]=_0x529007[_0x68ad('0x61')]({'plain':!![]});return db[_0x68ad('0x62')]['find']({'where':{'id':_0x529007[_0x68ad('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xaec44f,null))[_0x68ad('0x20')](function(_0x59f69a){if(_0x59f69a){_0x5911cd['interaction']=_0x59f69a['get']({'plain':!![]});interaction_log[_0x68ad('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26eea7[_0x68ad('0x5e')]['id'],_0x26eea7[_0x68ad('0x5e')][_0x68ad('0x34')],_0x26eea7[_0x68ad('0x5e')]['role'],_0x5911cd[_0x68ad('0x66')]['id'],_0x26eea7[_0x68ad('0x54')]?JSON[_0x68ad('0x26')](_0x26eea7[_0x68ad('0x54')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5911cd);}return null;})[_0x68ad('0x20')](function(_0x27a056){if(_0x27a056){_0x27a056[_0x68ad('0x29')][_0x68ad('0x73')]=util[_0x68ad('0x5b')]('SIP/%s',_0x26eea7['user']['name']);_0x27a056[_0x68ad('0x29')][_0x68ad('0x6e')]=_0x5911cd[_0x68ad('0x6e')];_0x27a056[_0x68ad('0x29')]['event']='reject';respondWithRpcPromise(_0x68ad('0x71'),_0x68ad('0x71'),{'event':_0x68ad('0x74'),'message':_0x27a056['message']},client9002);return _0x5911cd;}return null;})[_0x68ad('0x20')](respondWithResult(_0xaec44f,null))[_0x68ad('0x2a')](handleError(_0xaec44f,null));}; \ No newline at end of file +var _0x16da=['map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','accept','openchannel','read','format','UserId','agent','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','end','status','json','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name','send'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x16da,0x125));var _0xa16d=function(_0x7d7b6e,_0xd14a2d){_0x7d7b6e=_0x7d7b6e-0x0;var _0x533371=_0x16da[_0x7d7b6e];return _0x533371;};'use strict';var pdf=require(_0xa16d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa16d('0x1'));var zipdir=require(_0xa16d('0x2'));var jsonpatch=require(_0xa16d('0x3'));var rp=require(_0xa16d('0x4'));var moment=require(_0xa16d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa16d('0x6'));var util=require(_0xa16d('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa16d('0x8'));var crypto=require('crypto');var jsforce=require(_0xa16d('0x9'));var deskjs=require(_0xa16d('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa16d('0xb'));var Redis=require(_0xa16d('0xc'));var authService=require(_0xa16d('0xd'));var qs=require(_0xa16d('0xe'));var as=require(_0xa16d('0xf'));var hardwareService=require(_0xa16d('0x10'));var logger=require(_0xa16d('0x11'))(_0xa16d('0x12'));var utils=require(_0xa16d('0x13'));var config=require(_0xa16d('0x14'));var licenseUtil=require(_0xa16d('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa16d('0x16')](config['redis'],{'host':_0xa16d('0x17'),'port':0x18eb});var socket=require(_0xa16d('0x18'))(new Redis(config[_0xa16d('0x19')]));require('./openchannelMessage.socket')[_0xa16d('0x1a')](socket);var jayson=require(_0xa16d('0x1b'));var client=jayson[_0xa16d('0x1c')][_0xa16d('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xa16d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1afef5,_0x2f1d37,_0x1d1787,_0x4dd34a){return new BPromise(function(_0x4a6740,_0x22544e){var _0x2959b8=_0x4dd34a||client;return _0x2959b8[_0xa16d('0x1e')](_0x1afef5,_0x1d1787)[_0xa16d('0x1f')](function(_0xdf543d){logger['info'](_0xa16d('0x20'),_0x2f1d37,_0xa16d('0x21'));logger[_0xa16d('0x22')](_0xa16d('0x23'),_0x2f1d37,_0xa16d('0x21'),JSON[_0xa16d('0x24')](_0xdf543d));if(_0xdf543d['error']){if(_0xdf543d['error'][_0xa16d('0x25')]===0x1f4){logger[_0xa16d('0x26')](_0xa16d('0x20'),_0x2f1d37,_0xdf543d['error'][_0xa16d('0x27')]);return _0x22544e(_0xdf543d[_0xa16d('0x26')][_0xa16d('0x27')]);}logger['error'](_0xa16d('0x20'),_0x2f1d37,_0xdf543d[_0xa16d('0x26')][_0xa16d('0x27')]);return _0x4a6740(_0xdf543d[_0xa16d('0x26')][_0xa16d('0x27')]);}else{logger[_0xa16d('0x28')](_0xa16d('0x20'),_0x2f1d37,_0xa16d('0x21'));_0x4a6740(_0xdf543d['result'][_0xa16d('0x27')]);}})['catch'](function(_0x17e85e){logger[_0xa16d('0x26')](_0xa16d('0x20'),_0x2f1d37,_0x17e85e);_0x22544e(_0x17e85e);});});}function respondWithStatusCode(_0x13bd95,_0x134a4f){_0x134a4f=_0x134a4f||0xcc;return function(_0x446be3){if(_0x446be3){return _0x13bd95['sendStatus'](_0x134a4f);}return _0x13bd95['status'](_0x134a4f)[_0xa16d('0x29')]();};}function respondWithResult(_0x2c2132,_0x11e6a3){_0x11e6a3=_0x11e6a3||0xc8;return function(_0x30038d){if(_0x30038d){return _0x2c2132[_0xa16d('0x2a')](_0x11e6a3)[_0xa16d('0x2b')](_0x30038d);}};}function respondWithFilteredResult(_0x58f8e3,_0x425a98){return function(_0x28364a){if(_0x28364a){var _0x57f6e0=_0x28364a['count'],_0x56edaa=_0x425a98['offset'],_0x3c5591=_0x425a98[_0xa16d('0x2c')]+_0x425a98[_0xa16d('0x2d')],_0x508225;if(_0x3c5591>=_0x57f6e0){_0x3c5591=_0x57f6e0;_0x508225=0xc8;}else{_0x508225=0xce;}_0x58f8e3[_0xa16d('0x2a')](_0x508225);return _0x58f8e3[_0xa16d('0x2e')](_0xa16d('0x2f'),_0x56edaa+'-'+_0x3c5591+'/'+_0x57f6e0)[_0xa16d('0x2b')](_0x28364a);}return null;};}function patchUpdates(_0x217902){return function(_0x4000e3){try{jsonpatch['apply'](_0x4000e3,_0x217902,!![]);}catch(_0x321783){return BPromise[_0xa16d('0x30')](_0x321783);}return _0x4000e3['save']();};}function saveUpdates(_0x179a86,_0xb4c2b9){return function(_0x43909a){if(_0x43909a){return _0x43909a[_0xa16d('0x31')](_0x179a86)[_0xa16d('0x1f')](function(_0x20a26e){return _0x20a26e;});}return null;};}function removeEntity(_0x505ae8,_0x63205d){return function(_0x2470f3){if(_0x2470f3){return _0x2470f3[_0xa16d('0x32')]()['then'](function(){_0x505ae8[_0xa16d('0x2a')](0xcc)[_0xa16d('0x29')]();});}};}function handleEntityNotFound(_0x441c0f,_0x30b9f0){return function(_0x355485){if(!_0x355485){_0x441c0f[_0xa16d('0x33')](0x194);}return _0x355485;};}function handleError(_0x1030ae,_0x1382b5){_0x1382b5=_0x1382b5||0x1f4;return function(_0x4a34d5){logger[_0xa16d('0x26')](_0x4a34d5[_0xa16d('0x34')]);if(_0x4a34d5['name']){delete _0x4a34d5[_0xa16d('0x35')];}_0x1030ae[_0xa16d('0x2a')](_0x1382b5)[_0xa16d('0x36')](_0x4a34d5);};}exports['index']=function(_0x5ce186,_0x3b9b26){var _0x3d3909={},_0x33d3ea={},_0x3d028b={'count':0x0,'rows':[]};var _0x1314db=_[_0xa16d('0x37')](db[_0xa16d('0x38')][_0xa16d('0x39')],function(_0x46d875){return{'name':_0x46d875[_0xa16d('0x3a')],'type':_0x46d875['type'][_0xa16d('0x3b')]};});_0x33d3ea[_0xa16d('0x3c')]=_[_0xa16d('0x37')](_0x1314db,_0xa16d('0x35'));_0x33d3ea[_0xa16d('0x3d')]=_[_0xa16d('0x3e')](_0x5ce186[_0xa16d('0x3d')]);_0x33d3ea[_0xa16d('0x3f')]=_[_0xa16d('0x40')](_0x33d3ea[_0xa16d('0x3c')],_0x33d3ea['query']);_0x3d3909[_0xa16d('0x41')]=_[_0xa16d('0x40')](_0x33d3ea['model'],qs['fields'](_0x5ce186[_0xa16d('0x3d')][_0xa16d('0x42')]));_0x3d3909['attributes']=_0x3d3909[_0xa16d('0x41')][_0xa16d('0x43')]?_0x3d3909['attributes']:_0x33d3ea[_0xa16d('0x3c')];if(!_0x5ce186[_0xa16d('0x3d')]['hasOwnProperty']('nolimit')){_0x3d3909['limit']=qs[_0xa16d('0x2d')](_0x5ce186[_0xa16d('0x3d')]['limit']);_0x3d3909[_0xa16d('0x2c')]=qs[_0xa16d('0x2c')](_0x5ce186[_0xa16d('0x3d')][_0xa16d('0x2c')]);}_0x3d3909['order']=qs['sort'](_0x5ce186[_0xa16d('0x3d')]['sort']);_0x3d3909[_0xa16d('0x44')]=qs['filters'](_['pick'](_0x5ce186['query'],_0x33d3ea[_0xa16d('0x3f')]),_0x1314db);if(_0x5ce186[_0xa16d('0x3d')][_0xa16d('0x45')]){_0x3d3909[_0xa16d('0x44')]=_[_0xa16d('0x46')](_0x3d3909[_0xa16d('0x44')],{'$or':_[_0xa16d('0x37')](_0x1314db,function(_0x465275){if(_0x465275[_0xa16d('0x47')]!==_0xa16d('0x48')){var _0x321573={};_0x321573[_0x465275[_0xa16d('0x35')]]={'$like':'%'+_0x5ce186[_0xa16d('0x3d')][_0xa16d('0x45')]+'%'};return _0x321573;}})});}_0x3d3909=_[_0xa16d('0x46')]({},_0x3d3909,_0x5ce186[_0xa16d('0x49')]);var _0x37255c={'where':_0x3d3909[_0xa16d('0x44')]};return db[_0xa16d('0x38')][_0xa16d('0x4a')](_0x37255c)[_0xa16d('0x1f')](function(_0x3e4124){_0x3d028b[_0xa16d('0x4a')]=_0x3e4124;if(_0x5ce186[_0xa16d('0x3d')][_0xa16d('0x4b')]){_0x3d3909[_0xa16d('0x4c')]=[{'all':!![]}];}return db[_0xa16d('0x38')][_0xa16d('0x4d')](_0x3d3909);})[_0xa16d('0x1f')](function(_0x39c1e5){_0x3d028b[_0xa16d('0x4e')]=_0x39c1e5;return _0x3d028b;})['then'](respondWithFilteredResult(_0x3b9b26,_0x3d3909))[_0xa16d('0x4f')](handleError(_0x3b9b26,null));};exports['show']=function(_0x1d6866,_0x5a74cf){var _0x46403b={'raw':!![],'where':{'id':_0x1d6866[_0xa16d('0x50')]['id']}},_0x2639cf={};_0x2639cf[_0xa16d('0x3c')]=_['keys'](db['OpenchannelMessage'][_0xa16d('0x39')]);_0x2639cf[_0xa16d('0x3d')]=_[_0xa16d('0x3e')](_0x1d6866[_0xa16d('0x3d')]);_0x2639cf[_0xa16d('0x3f')]=_[_0xa16d('0x40')](_0x2639cf[_0xa16d('0x3c')],_0x2639cf[_0xa16d('0x3d')]);_0x46403b['attributes']=_[_0xa16d('0x40')](_0x2639cf[_0xa16d('0x3c')],qs[_0xa16d('0x42')](_0x1d6866[_0xa16d('0x3d')][_0xa16d('0x42')]));_0x46403b[_0xa16d('0x41')]=_0x46403b['attributes'][_0xa16d('0x43')]?_0x46403b[_0xa16d('0x41')]:_0x2639cf[_0xa16d('0x3c')];if(_0x1d6866[_0xa16d('0x3d')][_0xa16d('0x4b')]){_0x46403b[_0xa16d('0x4c')]=[{'all':!![]}];}_0x46403b=_['merge']({},_0x46403b,_0x1d6866[_0xa16d('0x49')]);return db[_0xa16d('0x38')][_0xa16d('0x51')](_0x46403b)[_0xa16d('0x1f')](handleEntityNotFound(_0x5a74cf,null))['then'](respondWithResult(_0x5a74cf,null))[_0xa16d('0x4f')](handleError(_0x5a74cf,null));};exports[_0xa16d('0x52')]=function(_0x516b69,_0x5b0ec6){return db[_0xa16d('0x38')][_0xa16d('0x52')](_0x516b69[_0xa16d('0x53')],{})[_0xa16d('0x1f')](respondWithResult(_0x5b0ec6,0xc9))['catch'](handleError(_0x5b0ec6,null));};exports['update']=function(_0x5a549f,_0x1c01df){if(_0x5a549f[_0xa16d('0x53')]['id']){delete _0x5a549f[_0xa16d('0x53')]['id'];}return db[_0xa16d('0x38')][_0xa16d('0x51')]({'where':{'id':_0x5a549f[_0xa16d('0x50')]['id']}})['then'](handleEntityNotFound(_0x1c01df,null))[_0xa16d('0x1f')](saveUpdates(_0x5a549f[_0xa16d('0x53')],null))['then'](respondWithResult(_0x1c01df,null))[_0xa16d('0x4f')](handleError(_0x1c01df,null));};exports[_0xa16d('0x32')]=function(_0x5f09ce,_0x1569bd){return db[_0xa16d('0x38')][_0xa16d('0x51')]({'where':{'id':_0x5f09ce[_0xa16d('0x50')]['id']}})[_0xa16d('0x1f')](handleEntityNotFound(_0x1569bd,null))['then'](removeEntity(_0x1569bd,null))[_0xa16d('0x4f')](handleError(_0x1569bd,null));};exports['describe']=function(_0x30bdad,_0x1755be){return db[_0xa16d('0x38')][_0xa16d('0x54')]()['then'](respondWithResult(_0x1755be,null))[_0xa16d('0x4f')](handleError(_0x1755be,null));};var interaction_log=require(_0xa16d('0x11'))('openchannel-interactions');exports[_0xa16d('0x55')]=function(_0x235a57,_0x16c792,_0x4bc7bc){var _0x596aca={'agent':{},'channel':_0xa16d('0x56')};if(_0x235a57[_0xa16d('0x53')]['id']){delete _0x235a57[_0xa16d('0x53')]['id'];}_0x235a57[_0xa16d('0x53')][_0xa16d('0x57')]=!![];_0x235a57[_0xa16d('0x53')]['readAt']=moment()[_0xa16d('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x235a57[_0xa16d('0x53')][_0xa16d('0x59')]=_0x235a57[_0xa16d('0x53')][_0xa16d('0x59')]||_0x235a57['user']['id'];_0x596aca[_0xa16d('0x5a')]['id']=_0x235a57[_0xa16d('0x53')][_0xa16d('0x59')];return db[_0xa16d('0x38')]['find']({'where':{'id':_0x235a57[_0xa16d('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xa16d('0x5b')],'as':_0xa16d('0x5c')}]})[_0xa16d('0x1f')](handleEntityNotFound(_0x16c792,null))[_0xa16d('0x1f')](saveUpdates(_0x235a57['body'],null))[_0xa16d('0x1f')](function(_0x555c87){if(_0x555c87){_0x596aca[_0xa16d('0x27')]=_0x555c87['get']({'plain':!![]});return db[_0xa16d('0x5d')][_0xa16d('0x51')]({'where':{'id':_0x555c87[_0xa16d('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x16c792,null))[_0xa16d('0x1f')](function(_0x59b5d1){if(_0x59b5d1){return _0x59b5d1[_0xa16d('0x31')]({'UserId':_0x235a57['body'][_0xa16d('0x59')],'read1stAt':_[_0xa16d('0x5f')](_0x59b5d1[_0xa16d('0x60')])?moment()[_0xa16d('0x58')](_0xa16d('0x61')):undefined});}return null;})[_0xa16d('0x1f')](function(_0x8a6c94){if(_0x8a6c94){_0x596aca[_0xa16d('0x62')]=_0x8a6c94[_0xa16d('0x63')]({'plain':!![]});interaction_log[_0xa16d('0x28')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x235a57['user']['id'],_0x235a57['user']['name'],_0x235a57[_0xa16d('0x64')][_0xa16d('0x65')],_0x596aca[_0xa16d('0x62')]['id'],_0x235a57[_0xa16d('0x53')]?JSON['stringify'](_0x235a57[_0xa16d('0x53')]):_0xa16d('0x66'));return respondWithRpcPromise(_0xa16d('0x67'),_0xa16d('0x68'),_0x596aca);}return null;})['then'](function(_0x34541f){if(_0x34541f){if(_0x235a57['body'][_0xa16d('0x69')]){_0x596aca['message'][_0xa16d('0x6a')]=util[_0xa16d('0x58')](_0xa16d('0x6b'),_0x235a57[_0xa16d('0x64')]['name']);_0x596aca['message'][_0xa16d('0x6c')]=_0x596aca['channel'];_0x596aca['message'][_0xa16d('0x6d')]='accept';return respondWithRpcPromise(_0xa16d('0x6e'),_0xa16d('0x6e'),{'event':'acceptmessage','message':_0x596aca[_0xa16d('0x27')]},client9002)['then'](function(){return _0x596aca;});}return _0x596aca;}return null;})[_0xa16d('0x1f')](respondWithResult(_0x16c792,null))['catch'](handleError(_0x16c792,null));};var interaction_log=require(_0xa16d('0x11'))(_0xa16d('0x6f'));exports[_0xa16d('0x30')]=function(_0x4234d9,_0x114989,_0xefe35e){var _0x4c7ef6={'agent':{},'channel':_0xa16d('0x56')};if(_0x4234d9[_0xa16d('0x53')]['id']){delete _0x4234d9[_0xa16d('0x53')]['id'];}_0x4234d9['body'][_0xa16d('0x59')]=_0x4234d9[_0xa16d('0x53')][_0xa16d('0x59')]||_0x4234d9[_0xa16d('0x64')]['id'];_0x4c7ef6[_0xa16d('0x5a')]['id']=_0x4234d9[_0xa16d('0x53')][_0xa16d('0x59')];return db[_0xa16d('0x38')][_0xa16d('0x51')]({'where':{'id':_0x4234d9[_0xa16d('0x50')]['id'],'UserId':null}})[_0xa16d('0x1f')](handleEntityNotFound(_0x114989,null))[_0xa16d('0x1f')](function(_0x21edb2){if(_0x21edb2){_0x4c7ef6[_0xa16d('0x27')]=_0x21edb2[_0xa16d('0x63')]({'plain':!![]});return db[_0xa16d('0x5d')]['find']({'where':{'id':_0x21edb2['OpenchannelInteractionId']}});}return null;})[_0xa16d('0x1f')](handleEntityNotFound(_0x114989,null))[_0xa16d('0x1f')](function(_0x332417){if(_0x332417){_0x4c7ef6[_0xa16d('0x62')]=_0x332417[_0xa16d('0x63')]({'plain':!![]});interaction_log['info'](_0xa16d('0x70'),_0x4234d9[_0xa16d('0x64')]['id'],_0x4234d9['user']['name'],_0x4234d9[_0xa16d('0x64')]['role'],_0x4c7ef6[_0xa16d('0x62')]['id'],_0x4234d9[_0xa16d('0x53')]?JSON[_0xa16d('0x24')](_0x4234d9[_0xa16d('0x53')]):'null');return respondWithRpcPromise(_0xa16d('0x71'),_0xa16d('0x72'),_0x4c7ef6);}return null;})[_0xa16d('0x1f')](function(_0x12a136){if(_0x12a136){_0x12a136['message'][_0xa16d('0x6a')]=util[_0xa16d('0x58')](_0xa16d('0x6b'),_0x4234d9[_0xa16d('0x64')][_0xa16d('0x35')]);_0x12a136[_0xa16d('0x27')][_0xa16d('0x6c')]=_0x4c7ef6[_0xa16d('0x6c')];_0x12a136[_0xa16d('0x27')][_0xa16d('0x6d')]=_0xa16d('0x30');respondWithRpcPromise(_0xa16d('0x6e'),'EventManager',{'event':_0xa16d('0x73'),'message':_0x12a136[_0xa16d('0x27')]},client9002);return _0x4c7ef6;}return null;})[_0xa16d('0x1f')](respondWithResult(_0x114989,null))[_0xa16d('0x4f')](handleError(_0x114989,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7aa5b80..d0eeb72 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 _0x4b0f=['save','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners'];(function(_0x3534a5,_0x450637){var _0xa8d784=function(_0x2fc4bb){while(--_0x2fc4bb){_0x3534a5['push'](_0x3534a5['shift']());}};_0xa8d784(++_0x450637);}(_0x4b0f,0x12f));var _0xf4b0=function(_0x1d04b3,_0x2dfd11){_0x1d04b3=_0x1d04b3-0x0;var _0x1cf900=_0x4b0f[_0x1d04b3];return _0x1cf900;};'use strict';var EventEmitter=require(_0xf4b0('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xf4b0('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf4b0('0x2')](0x0);var events={'afterCreate':_0xf4b0('0x3'),'afterUpdate':'update','afterDestroy':_0xf4b0('0x4')};function emitEvent(_0x51d6fb){return function(_0x4c3d7a,_0x50701b,_0x58ffca){OpenchannelMessageEvents[_0xf4b0('0x5')](_0x51d6fb+':'+_0x4c3d7a['id'],_0x4c3d7a);OpenchannelMessageEvents['emit'](_0x51d6fb,_0x4c3d7a);_0x58ffca(null);};}for(var e in events){if(events[_0xf4b0('0x6')](e)){var event=events[e];OpenchannelMessage[_0xf4b0('0x7')](e,emitEvent(event));}}module[_0xf4b0('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x264f=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x4d9a92,_0x2d76f0){var _0x4053fd=function(_0x2fd1ba){while(--_0x2fd1ba){_0x4d9a92['push'](_0x4d9a92['shift']());}};_0x4053fd(++_0x2d76f0);}(_0x264f,0x1e7));var _0xf264=function(_0x1a9574,_0x506994){_0x1a9574=_0x1a9574-0x0;var _0x110ee6=_0x264f[_0x1a9574];return _0x110ee6;};'use strict';var EventEmitter=require(_0xf264('0x0'));var OpenchannelMessage=require(_0xf264('0x1'))['db'][_0xf264('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf264('0x3')](0x0);var events={'afterCreate':_0xf264('0x4'),'afterUpdate':_0xf264('0x5'),'afterDestroy':_0xf264('0x6')};function emitEvent(_0x10667d){return function(_0x406374,_0x4bddc8,_0x275870){OpenchannelMessageEvents[_0xf264('0x7')](_0x10667d+':'+_0x406374['id'],_0x406374);OpenchannelMessageEvents[_0xf264('0x7')](_0x10667d,_0x406374);_0x275870(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xf264('0x8')](e,emitEvent(event));}}module[_0xf264('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8f39ab8..621dda9 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 _0xc46b=['info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','Contact','replyUri','GET','POST','body','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','secret','CmContact','OpenchannelAccount','find','OpenchannelAccountId','keys'];(function(_0x1aeb29,_0x245cfd){var _0x27b597=function(_0x2fbdea){while(--_0x2fbdea){_0x1aeb29['push'](_0x1aeb29['shift']());}};_0x27b597(++_0x245cfd);}(_0xc46b,0x7a));var _0xbc46=function(_0x45c1ca,_0x683fea){_0x45c1ca=_0x45c1ca-0x0;var _0x131c82=_0xc46b[_0x45c1ca];return _0x131c82;};'use strict';var _=require(_0xbc46('0x0'));var util=require(_0xbc46('0x1'));var logger=require(_0xbc46('0x2'))(_0xbc46('0x3'));var moment=require(_0xbc46('0x4'));var BPromise=require(_0xbc46('0x5'));var rp=require(_0xbc46('0x6'));var fs=require('fs');var path=require(_0xbc46('0x7'));var rimraf=require(_0xbc46('0x8'));var config=require(_0xbc46('0x9'));var attributes=require(_0xbc46('0xa'));module['exports']=function(_0x34d771,_0x137b04){return _0x34d771[_0xbc46('0xb')](_0xbc46('0xc'),attributes,{'tableName':_0xbc46('0xd'),'paranoid':![],'indexes':[{'name':_0xbc46('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f96d9,_0x4f4a60,_0x437244){var _0x32b05b=_0x34d771[_0xbc46('0xf')];var _0x1887d4=_0x2f96d9[_0xbc46('0x10')]({'plain':!![]});if(_0x1887d4[_0xbc46('0x11')][_0xbc46('0x12')]()==='in'||_0x1887d4[_0xbc46('0x11')][_0xbc46('0x12')]()===_0xbc46('0x13')&&!_0x1887d4['secret']&&!_[_0xbc46('0x14')](_0x1887d4[_0xbc46('0x15')])){_0x32b05b[_0xbc46('0x16')][_0xbc46('0x17')]({'where':{'id':_0x1887d4[_0xbc46('0x18')]}})[_0xbc46('0x19')](function(_0x3c17fc){if(_0x3c17fc){_0x3c17fc[_0xbc46('0x1a')]({'lastMsgAt':_0x1887d4[_0xbc46('0x1b')],'lastMsgDirection':_0x1887d4[_0xbc46('0x11')]['toLowerCase']()});}})['catch'](function(_0x46067f){console['error'](_0x46067f);});}if(_0x1887d4[_0xbc46('0x11')]==='out'&&!_0x1887d4[_0xbc46('0x1c')]){var _0x380d2f;_0x32b05b[_0xbc46('0x1d')]['describe']()[_0xbc46('0x19')](function(_0x5e34fd){return _0x32b05b[_0xbc46('0x1e')][_0xbc46('0x1f')]({'where':{'id':_0x1887d4[_0xbc46('0x20')]},'include':[{'model':_0x32b05b[_0xbc46('0x16')],'as':'Interactions','where':{'id':_0x1887d4[_0xbc46('0x18')]},'limit':0x1,'include':[{'model':_0x32b05b[_0xbc46('0x1d')],'as':'Contact','attributes':_[_0xbc46('0x21')](_0x5e34fd)}]}]});})[_0xbc46('0x19')](function(_0xdef835){_0x380d2f=_0xdef835[_0xbc46('0x10')]({'plain':!![]});if(_0x380d2f&&_0x380d2f['replyUri']){logger[_0xbc46('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xbc46('0x23'),util[_0xbc46('0x24')](_0xbc46('0x25'),_0x1887d4['id'],_0x380d2f['replyUri']));if(_0x380d2f[_0xbc46('0x26')]&&_0x380d2f[_0xbc46('0x26')]['length']){_0x1887d4[_0xbc46('0x27')]=_[_0xbc46('0x28')](_0x380d2f[_0xbc46('0x26')][0x0],_0xbc46('0x29'));_0x1887d4[_0xbc46('0x29')]=_0x380d2f[_0xbc46('0x26')][0x0][_0xbc46('0x29')];}var _0x4f4a60={'method':'POST','uri':encodeURI(_0x380d2f[_0xbc46('0x2a')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4f4a60['method']){case _0xbc46('0x2b'):_0x4f4a60['qs']=_0x1887d4;break;case _0xbc46('0x2c'):_0x4f4a60[_0xbc46('0x2d')]=_0x1887d4;break;}return rp(_0x4f4a60)['then'](function(_0x3ca047){logger[_0xbc46('0x22')](_0xbc46('0x2e'),_0xbc46('0x23'),util['format'](_0xbc46('0x2f'),_0x1887d4['id'],_0x380d2f[_0xbc46('0x2a')]));if(_0x3ca047['body'][_0xbc46('0x30')]&&_0x3ca047[_0xbc46('0x2d')][_0xbc46('0x30')]!=_0x1887d4[_0xbc46('0x27')]['threadId']){return _0x32b05b[_0xbc46('0x16')][_0xbc46('0x1a')]({'threadId':_0x3ca047['body'][_0xbc46('0x30')]},{'logging':!![],'where':{'id':_0x1887d4[_0xbc46('0x27')]['id']}});}else{return;}})[_0xbc46('0x19')](function(){return _0x2f96d9[_0xbc46('0x1a')]({'read':!![]});})[_0xbc46('0x31')](function(_0x455a8f){logger[_0xbc46('0x32')](_0xbc46('0x2e'),_0xbc46('0x23'),util['inspect'](_0x455a8f,{'showHidden':![],'depth':null}));_0x437244();});}else{_0x437244();}})['finally'](function(){_0x437244();});}else{_0x437244();}}},'charset':'utf8mb4','collate':_0xbc46('0x33')});}; \ No newline at end of file +var _0x7505=['get','toLowerCase','direction','out','isNil','UserId','update','createdAt','catch','error','CmContact','describe','then','find','OpenchannelAccountId','Interactions','Contact','keys','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports','OpenchannelMessage','fti_openchannel_messages','body','models'];(function(_0x5b1030,_0x1cb435){var _0xd65c64=function(_0x410a6c){while(--_0x410a6c){_0x5b1030['push'](_0x5b1030['shift']());}};_0xd65c64(++_0x1cb435);}(_0x7505,0x17c));var _0x5750=function(_0x387b5c,_0x55bbdd){_0x387b5c=_0x387b5c-0x0;var _0x3d299c=_0x7505[_0x387b5c];return _0x3d299c;};'use strict';var _=require(_0x5750('0x0'));var util=require(_0x5750('0x1'));var logger=require(_0x5750('0x2'))(_0x5750('0x3'));var moment=require(_0x5750('0x4'));var BPromise=require('bluebird');var rp=require(_0x5750('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5750('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x5750('0x7')]=function(_0x4730c9,_0x31f265){return _0x4730c9['define'](_0x5750('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x5750('0x9'),'fields':[_0x5750('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x242a73,_0x28f66f,_0x48c287){var _0x10fcbd=_0x4730c9[_0x5750('0xb')];var _0x2cad40=_0x242a73[_0x5750('0xc')]({'plain':!![]});if(_0x2cad40['direction'][_0x5750('0xd')]()==='in'||_0x2cad40[_0x5750('0xe')][_0x5750('0xd')]()===_0x5750('0xf')&&!_0x2cad40['secret']&&!_[_0x5750('0x10')](_0x2cad40[_0x5750('0x11')])){_0x10fcbd['OpenchannelInteraction']['findOne']({'where':{'id':_0x2cad40['OpenchannelInteractionId']}})['then'](function(_0x2a7f83){if(_0x2a7f83){_0x2a7f83[_0x5750('0x12')]({'lastMsgAt':_0x2cad40[_0x5750('0x13')],'lastMsgDirection':_0x2cad40[_0x5750('0xe')][_0x5750('0xd')]()});}})[_0x5750('0x14')](function(_0x13509d){console[_0x5750('0x15')](_0x13509d);});}if(_0x2cad40[_0x5750('0xe')]===_0x5750('0xf')&&!_0x2cad40['secret']){var _0x2aa2a2;_0x10fcbd[_0x5750('0x16')][_0x5750('0x17')]()[_0x5750('0x18')](function(_0x4ffe5c){return _0x10fcbd['OpenchannelAccount'][_0x5750('0x19')]({'where':{'id':_0x2cad40[_0x5750('0x1a')]},'include':[{'model':_0x10fcbd['OpenchannelInteraction'],'as':_0x5750('0x1b'),'where':{'id':_0x2cad40['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x10fcbd['CmContact'],'as':_0x5750('0x1c'),'attributes':_[_0x5750('0x1d')](_0x4ffe5c)}]}]});})['then'](function(_0x4c636e){_0x2aa2a2=_0x4c636e['get']({'plain':!![]});if(_0x2aa2a2&&_0x2aa2a2['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x5750('0x1e'),util[_0x5750('0x1f')](_0x5750('0x20'),_0x2cad40['id'],_0x2aa2a2[_0x5750('0x21')]));if(_0x2aa2a2[_0x5750('0x1b')]&&_0x2aa2a2['Interactions'][_0x5750('0x22')]){_0x2cad40[_0x5750('0x23')]=_[_0x5750('0x24')](_0x2aa2a2[_0x5750('0x1b')][0x0],'Contact');_0x2cad40['Contact']=_0x2aa2a2[_0x5750('0x1b')][0x0][_0x5750('0x1c')];}var _0x28f66f={'method':_0x5750('0x25'),'uri':encodeURI(_0x2aa2a2[_0x5750('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x28f66f[_0x5750('0x26')]){case _0x5750('0x27'):_0x28f66f['qs']=_0x2cad40;break;case _0x5750('0x25'):_0x28f66f[_0x5750('0xa')]=_0x2cad40;break;}return rp(_0x28f66f)[_0x5750('0x18')](function(_0x2e933b){logger[_0x5750('0x28')](_0x5750('0x29'),'afterCreate',util[_0x5750('0x1f')](_0x5750('0x2a'),_0x2cad40['id'],_0x2aa2a2[_0x5750('0x21')]));if(_0x2e933b[_0x5750('0xa')][_0x5750('0x2b')]&&_0x2e933b['body'][_0x5750('0x2b')]!=_0x2cad40['Interaction']['threadId']){return _0x10fcbd[_0x5750('0x2c')][_0x5750('0x12')]({'threadId':_0x2e933b[_0x5750('0xa')][_0x5750('0x2b')]},{'logging':!![],'where':{'id':_0x2cad40['Interaction']['id']}});}else{return;}})[_0x5750('0x18')](function(){return _0x242a73[_0x5750('0x12')]({'read':!![]});})[_0x5750('0x14')](function(_0x5fecab){logger['error'](_0x5750('0x29'),_0x5750('0x1e'),util[_0x5750('0x2d')](_0x5fecab,{'showHidden':![],'depth':null}));_0x48c287();});}else{_0x48c287();}})[_0x5750('0x2e')](function(){_0x48c287();});}else{_0x48c287();}}},'charset':_0x5750('0x2f'),'collate':_0x5750('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 04b2d7f..d9583a6 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x4e3b46,_0x196865){var _0x31da51=function(_0x9f98be){while(--_0x9f98be){_0x4e3b46['push'](_0x4e3b46['shift']());}};_0x31da51(++_0x196865);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bf57f,_0x255df4){_0x1bf57f=_0x1bf57f-0x0;var _0x23a86b=_0xb10b[_0x1bf57f];return _0x23a86b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x20af67,_0xd0c575){var _0x15975c=function(_0x1b6dfe){while(--_0x1b6dfe){_0x20af67['push'](_0x20af67['shift']());}};_0x15975c(++_0xd0c575);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xb10b[_0x4bcf38];return _0x4a89be;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index cb5844a..b019b65 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 _0xd8b0=['save','emit','./openchannelMessage.events'];(function(_0x4285f7,_0x1853d5){var _0x114bdd=function(_0x3a4f4c){while(--_0x3a4f4c){_0x4285f7['push'](_0x4285f7['shift']());}};_0x114bdd(++_0x1853d5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelMessageEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){OpenchannelMessageEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('openchannelMessage:'+_0x413284,_0x3f8b6f);OpenchannelMessageEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file +var _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x117fb1,_0x4b9774){var _0x53db22=function(_0x4de034){while(--_0x4de034){_0x117fb1['push'](_0x117fb1['shift']());}};_0x53db22(++_0x4b9774);}(_0xe706,0xa3));var _0x6e70=function(_0x4d7b67,_0x5b3c9f){_0x4d7b67=_0x4d7b67-0x0;var _0x2d85e6=_0xe706[_0x4d7b67];return _0x2d85e6;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5cf3f82..7e17dd4 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 _0x92e0=['removeTeams','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','getAgents','create','post','/:id/teams','/:id/users','put','update','destroy'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x092e('0x0'));var util=require('util');var path=require(_0x092e('0x1'));var timeout=require(_0x092e('0x2'));var express=require(_0x092e('0x3'));var router=express[_0x092e('0x4')]();var auth=require(_0x092e('0x5'));var interaction=require(_0x092e('0x6'));var config=require(_0x092e('0x7'));var controller=require(_0x092e('0x8'));router[_0x092e('0x9')]('/',auth[_0x092e('0xa')](),controller['index']);router['get'](_0x092e('0xb'),auth[_0x092e('0xa')](),controller[_0x092e('0xc')]);router['get'](_0x092e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x092e('0x9')](_0x092e('0xe'),auth['isAuthenticated'](),controller[_0x092e('0xf')]);router['get']('/:id/teams',auth[_0x092e('0xa')](),controller['getTeams']);router[_0x092e('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x092e('0x10')]);router['post']('/',auth[_0x092e('0xa')](),controller[_0x092e('0x11')]);router[_0x092e('0x12')](_0x092e('0x13'),auth[_0x092e('0xa')](),controller['addTeams']);router['post'](_0x092e('0x14'),auth[_0x092e('0xa')](),controller['addAgents']);router[_0x092e('0x15')](_0x092e('0xd'),auth[_0x092e('0xa')](),controller[_0x092e('0x16')]);router['delete'](_0x092e('0xd'),auth[_0x092e('0xa')](),controller[_0x092e('0x17')]);router['delete'](_0x092e('0x13'),auth[_0x092e('0xa')](),controller[_0x092e('0x18')]);router[_0x092e('0x19')](_0x092e('0x14'),auth['isAuthenticated'](),controller[_0x092e('0x1a')]);module[_0x092e('0x1b')]=router; \ No newline at end of file +var _0x4300=['show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','removeTeams','delete','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','get','describe','/:id'];(function(_0x5afcdf,_0x164d88){var _0x108b15=function(_0x476015){while(--_0x476015){_0x5afcdf['push'](_0x5afcdf['shift']());}};_0x108b15(++_0x164d88);}(_0x4300,0x1a6));var _0x0430=function(_0x1e5ddd,_0x531b8b){_0x1e5ddd=_0x1e5ddd-0x0;var _0x10075f=_0x4300[_0x1e5ddd];return _0x10075f;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var auth=require(_0x0430('0x2'));var interaction=require(_0x0430('0x3'));var config=require(_0x0430('0x4'));var controller=require(_0x0430('0x5'));router['get']('/',auth[_0x0430('0x6')](),controller['index']);router[_0x0430('0x7')]('/describe',auth[_0x0430('0x6')](),controller[_0x0430('0x8')]);router[_0x0430('0x7')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller[_0x0430('0xa')]);router[_0x0430('0x7')](_0x0430('0xb'),auth[_0x0430('0x6')](),controller['getMembers']);router[_0x0430('0x7')](_0x0430('0xc'),auth[_0x0430('0x6')](),controller[_0x0430('0xd')]);router[_0x0430('0x7')](_0x0430('0xe'),auth[_0x0430('0x6')](),controller[_0x0430('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0430('0x10')]);router[_0x0430('0x11')](_0x0430('0xc'),auth[_0x0430('0x6')](),controller[_0x0430('0x12')]);router[_0x0430('0x11')](_0x0430('0xe'),auth['isAuthenticated'](),controller[_0x0430('0x13')]);router[_0x0430('0x14')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller['update']);router['delete']('/:id',auth[_0x0430('0x6')](),controller['destroy']);router['delete'](_0x0430('0xc'),auth[_0x0430('0x6')](),controller[_0x0430('0x15')]);router[_0x0430('0x16')](_0x0430('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0430('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9af2304..aa83687 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 _0xb408=['STRING','ENUM','rrmemory','sequelize','exports','name'];(function(_0x4a528a,_0x57e2f6){var _0x21c12d=function(_0x31f27c){while(--_0x31f27c){_0x4a528a['push'](_0x4a528a['shift']());}};_0x21c12d(++_0x57e2f6);}(_0xb408,0x15f));var _0x8b40=function(_0x43b2e6,_0x14d773){_0x43b2e6=_0x43b2e6-0x0;var _0x102c0b=_0xb408[_0x43b2e6];return _0x102c0b;};'use strict';var Sequelize=require(_0x8b40('0x0'));module[_0x8b40('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8b40('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8b40('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8b40('0x4')](_0x8b40('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xf55d=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','rrmemory'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xf55d,0x14b));var _0xdf55=function(_0x80e892,_0x81a72c){_0x80e892=_0x80e892-0x0;var _0x253826=_0xf55d[_0x80e892];return _0x253826;};'use strict';var Sequelize=require(_0xdf55('0x0'));module[_0xdf55('0x1')]={'name':{'type':Sequelize[_0xdf55('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdf55('0x2')]},'timeout':{'type':Sequelize[_0xdf55('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdf55('0x4'),_0xdf55('0x5'),_0xdf55('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index c86c5a4..91a1881 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 _0xd8e5=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','user','get','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','forEach','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','emit','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x121b0e,_0x246ec5){var _0x1c1b61=function(_0x861144){while(--_0x861144){_0x121b0e['push'](_0x121b0e['shift']());}};_0x1c1b61(++_0x246ec5);}(_0xd8e5,0x1a6));var _0x5d8e=function(_0x19719d,_0x1cdb57){_0x19719d=_0x19719d-0x0;var _0x4faee4=_0xd8e5[_0x19719d];return _0x4faee4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d8e('0x0'));var rimraf=require(_0x5d8e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d8e('0x2'));var rp=require(_0x5d8e('0x3'));var moment=require('moment');var BPromise=require(_0x5d8e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5d8e('0x5'));var sox=require(_0x5d8e('0x6'));var csv=require(_0x5d8e('0x7'));var ejs=require(_0x5d8e('0x8'));var fs=require('fs');var _=require(_0x5d8e('0x9'));var squel=require('squel');var crypto=require(_0x5d8e('0xa'));var jsforce=require(_0x5d8e('0xb'));var deskjs=require(_0x5d8e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5d8e('0xd'));var Papa=require(_0x5d8e('0xe'));var Redis=require(_0x5d8e('0xf'));var authService=require(_0x5d8e('0x10'));var qs=require(_0x5d8e('0x11'));var as=require(_0x5d8e('0x12'));var hardwareService=require(_0x5d8e('0x13'));var logger=require(_0x5d8e('0x14'))(_0x5d8e('0x15'));var utils=require(_0x5d8e('0x16'));var config=require(_0x5d8e('0x17'));var licenseUtil=require(_0x5d8e('0x18'));var db=require(_0x5d8e('0x19'))['db'];config[_0x5d8e('0x1a')]=_[_0x5d8e('0x1b')](config[_0x5d8e('0x1a')],{'host':_0x5d8e('0x1c'),'port':0x18eb});var socket=require(_0x5d8e('0x1d'))(new Redis(config[_0x5d8e('0x1a')]));require(_0x5d8e('0x1e'))[_0x5d8e('0x1f')](socket);function respondWithStatusCode(_0x39ac7b,_0x3974dd){_0x3974dd=_0x3974dd||0xcc;return function(_0x48e5e7){if(_0x48e5e7){return _0x39ac7b['sendStatus'](_0x3974dd);}return _0x39ac7b[_0x5d8e('0x20')](_0x3974dd)[_0x5d8e('0x21')]();};}function respondWithResult(_0x18c494,_0x39fa5d){_0x39fa5d=_0x39fa5d||0xc8;return function(_0x37b144){if(_0x37b144){return _0x18c494[_0x5d8e('0x20')](_0x39fa5d)[_0x5d8e('0x22')](_0x37b144);}};}function respondWithFilteredResult(_0x5b8e17,_0x32d707){return function(_0x317a8b){if(_0x317a8b){var _0x10c9c8=_0x317a8b[_0x5d8e('0x23')],_0x795d83=_0x32d707[_0x5d8e('0x24')],_0x4eb186=_0x32d707[_0x5d8e('0x24')]+_0x32d707['limit'],_0x3d0ce8;if(_0x4eb186>=_0x10c9c8){_0x4eb186=_0x10c9c8;_0x3d0ce8=0xc8;}else{_0x3d0ce8=0xce;}_0x5b8e17[_0x5d8e('0x20')](_0x3d0ce8);return _0x5b8e17[_0x5d8e('0x25')](_0x5d8e('0x26'),_0x795d83+'-'+_0x4eb186+'/'+_0x10c9c8)[_0x5d8e('0x22')](_0x317a8b);}return null;};}function patchUpdates(_0x4a4ae1){return function(_0x316f0a){try{jsonpatch[_0x5d8e('0x27')](_0x316f0a,_0x4a4ae1,!![]);}catch(_0x11e69a){return BPromise[_0x5d8e('0x28')](_0x11e69a);}return _0x316f0a[_0x5d8e('0x29')]();};}function saveUpdates(_0x494528,_0x43d820){return function(_0x51dd77){if(_0x51dd77){return _0x51dd77[_0x5d8e('0x2a')](_0x494528)['then'](function(_0x4e9ee2){return _0x4e9ee2;});}return null;};}function removeEntity(_0x5127f3,_0x4f4d64){return function(_0xab788e){if(_0xab788e){return _0xab788e[_0x5d8e('0x2b')]()[_0x5d8e('0x2c')](function(){var _0x591c2f=_0xab788e['get']({'plain':!![]});var _0x25e90d='OpenchannelQueues';return db['UserProfileResource'][_0x5d8e('0x2b')]({'where':{'type':_0x25e90d,'resourceId':_0x591c2f['id']}})[_0x5d8e('0x2c')](function(){return _0xab788e;});})[_0x5d8e('0x2c')](function(){_0x5127f3['status'](0xcc)[_0x5d8e('0x21')]();});}};}function handleEntityNotFound(_0xe57eab,_0x2cedfe){return function(_0x1b9275){if(!_0x1b9275){_0xe57eab[_0x5d8e('0x2d')](0x194);}return _0x1b9275;};}function handleError(_0x2b28fa,_0x441ae1){_0x441ae1=_0x441ae1||0x1f4;return function(_0x2d66a1){logger[_0x5d8e('0x2e')](_0x2d66a1[_0x5d8e('0x2f')]);if(_0x2d66a1[_0x5d8e('0x30')]){delete _0x2d66a1['name'];}_0x2b28fa['status'](_0x441ae1)[_0x5d8e('0x31')](_0x2d66a1);};}exports[_0x5d8e('0x32')]=function(_0x489ebb,_0x528493){var _0x1fa6b={},_0x2a7932={},_0x547aa5={'count':0x0,'rows':[]};var _0x56eb6f=_[_0x5d8e('0x33')](db[_0x5d8e('0x34')]['rawAttributes'],function(_0x4f42b0){return{'name':_0x4f42b0[_0x5d8e('0x35')],'type':_0x4f42b0['type'][_0x5d8e('0x36')]};});_0x2a7932['model']=_[_0x5d8e('0x33')](_0x56eb6f,'name');_0x2a7932[_0x5d8e('0x37')]=_[_0x5d8e('0x38')](_0x489ebb[_0x5d8e('0x37')]);_0x2a7932[_0x5d8e('0x39')]=_['intersection'](_0x2a7932[_0x5d8e('0x3a')],_0x2a7932[_0x5d8e('0x37')]);_0x1fa6b[_0x5d8e('0x3b')]=_[_0x5d8e('0x3c')](_0x2a7932[_0x5d8e('0x3a')],qs[_0x5d8e('0x3d')](_0x489ebb[_0x5d8e('0x37')][_0x5d8e('0x3d')]));_0x1fa6b[_0x5d8e('0x3b')]=_0x1fa6b[_0x5d8e('0x3b')][_0x5d8e('0x3e')]?_0x1fa6b[_0x5d8e('0x3b')]:_0x2a7932['model'];if(!_0x489ebb[_0x5d8e('0x37')][_0x5d8e('0x3f')](_0x5d8e('0x40'))){_0x1fa6b[_0x5d8e('0x41')]=qs[_0x5d8e('0x41')](_0x489ebb['query']['limit']);_0x1fa6b['offset']=qs[_0x5d8e('0x24')](_0x489ebb[_0x5d8e('0x37')][_0x5d8e('0x24')]);}_0x1fa6b[_0x5d8e('0x42')]=qs['sort'](_0x489ebb[_0x5d8e('0x37')][_0x5d8e('0x43')]);_0x1fa6b[_0x5d8e('0x44')]=qs[_0x5d8e('0x39')](_['pick'](_0x489ebb[_0x5d8e('0x37')],_0x2a7932['filters']),_0x56eb6f);if(_0x489ebb[_0x5d8e('0x37')][_0x5d8e('0x45')]){_0x1fa6b[_0x5d8e('0x44')]=_[_0x5d8e('0x46')](_0x1fa6b[_0x5d8e('0x44')],{'$or':_['map'](_0x56eb6f,function(_0x2f72cd){if(_0x2f72cd[_0x5d8e('0x47')]!==_0x5d8e('0x48')){var _0x57c43f={};_0x57c43f[_0x2f72cd[_0x5d8e('0x30')]]={'$like':'%'+_0x489ebb[_0x5d8e('0x37')]['filter']+'%'};return _0x57c43f;}})});}_0x1fa6b=_['merge']({},_0x1fa6b,_0x489ebb[_0x5d8e('0x49')]);var _0x4bcdf3={'where':_0x1fa6b[_0x5d8e('0x44')]};return db[_0x5d8e('0x34')][_0x5d8e('0x23')](_0x4bcdf3)[_0x5d8e('0x2c')](function(_0x1df530){_0x547aa5[_0x5d8e('0x23')]=_0x1df530;if(_0x489ebb[_0x5d8e('0x37')][_0x5d8e('0x4a')]){_0x1fa6b['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x5d8e('0x4b')](_0x1fa6b);})[_0x5d8e('0x2c')](function(_0x5b9fbf){_0x547aa5[_0x5d8e('0x4c')]=_0x5b9fbf;return _0x547aa5;})['then'](respondWithFilteredResult(_0x528493,_0x1fa6b))[_0x5d8e('0x4d')](handleError(_0x528493,null));};exports['show']=function(_0x2941aa,_0x5c2dbb){var _0x3103a8={'raw':!![],'where':{'id':_0x2941aa[_0x5d8e('0x4e')]['id']}},_0x4f0194={};_0x4f0194['model']=_[_0x5d8e('0x38')](db['OpenchannelQueue'][_0x5d8e('0x4f')]);_0x4f0194[_0x5d8e('0x37')]=_[_0x5d8e('0x38')](_0x2941aa[_0x5d8e('0x37')]);_0x4f0194['filters']=_[_0x5d8e('0x3c')](_0x4f0194[_0x5d8e('0x3a')],_0x4f0194[_0x5d8e('0x37')]);_0x3103a8[_0x5d8e('0x3b')]=_['intersection'](_0x4f0194[_0x5d8e('0x3a')],qs[_0x5d8e('0x3d')](_0x2941aa['query']['fields']));_0x3103a8[_0x5d8e('0x3b')]=_0x3103a8[_0x5d8e('0x3b')][_0x5d8e('0x3e')]?_0x3103a8[_0x5d8e('0x3b')]:_0x4f0194[_0x5d8e('0x3a')];if(_0x2941aa[_0x5d8e('0x37')]['includeAll']){_0x3103a8[_0x5d8e('0x50')]=[{'all':!![]}];}_0x3103a8=_[_0x5d8e('0x46')]({},_0x3103a8,_0x2941aa[_0x5d8e('0x49')]);return db['OpenchannelQueue'][_0x5d8e('0x51')](_0x3103a8)[_0x5d8e('0x2c')](handleEntityNotFound(_0x5c2dbb,null))[_0x5d8e('0x2c')](respondWithResult(_0x5c2dbb,null))['catch'](handleError(_0x5c2dbb,null));};exports['create']=function(_0x491f93,_0xe4240a){return db[_0x5d8e('0x34')][_0x5d8e('0x52')](_0x491f93['body'],{})['then'](function(_0x1c243f){var _0x4e530f=_0x491f93[_0x5d8e('0x53')][_0x5d8e('0x54')]({'plain':!![]});if(!_0x4e530f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e530f[_0x5d8e('0x55')]==='user'){var _0x4ef770=_0x1c243f[_0x5d8e('0x54')]({'plain':!![]});var _0x9b7925=_0x5d8e('0x56');return db[_0x5d8e('0x57')][_0x5d8e('0x51')]({'where':{'name':_0x9b7925,'userProfileId':_0x4e530f[_0x5d8e('0x58')]},'raw':!![]})[_0x5d8e('0x2c')](function(_0x22bf38){if(_0x22bf38&&_0x22bf38[_0x5d8e('0x59')]===0x0){return db[_0x5d8e('0x5a')][_0x5d8e('0x52')]({'name':_0x4ef770[_0x5d8e('0x30')],'resourceId':_0x4ef770['id'],'type':_0x22bf38['name'],'sectionId':_0x22bf38['id']},{})[_0x5d8e('0x2c')](function(){return _0x1c243f;});}else{return _0x1c243f;}})[_0x5d8e('0x4d')](function(_0x7aa5d7){logger[_0x5d8e('0x2e')](_0x5d8e('0x5b'),_0x7aa5d7);throw _0x7aa5d7;});}return _0x1c243f;})['then'](respondWithResult(_0xe4240a,0xc9))['catch'](handleError(_0xe4240a,null));};exports[_0x5d8e('0x2a')]=function(_0x4d7c63,_0x13c5e4){if(_0x4d7c63['body']['id']){delete _0x4d7c63[_0x5d8e('0x5c')]['id'];}return db['OpenchannelQueue'][_0x5d8e('0x51')]({'where':{'id':_0x4d7c63[_0x5d8e('0x4e')]['id']}})[_0x5d8e('0x2c')](handleEntityNotFound(_0x13c5e4,null))['then'](saveUpdates(_0x4d7c63[_0x5d8e('0x5c')],null))[_0x5d8e('0x2c')](respondWithResult(_0x13c5e4,null))['catch'](handleError(_0x13c5e4,null));};exports[_0x5d8e('0x2b')]=function(_0x560377,_0x3f1d10){return db['OpenchannelQueue'][_0x5d8e('0x51')]({'where':{'id':_0x560377[_0x5d8e('0x4e')]['id']}})[_0x5d8e('0x2c')](handleEntityNotFound(_0x3f1d10,null))[_0x5d8e('0x2c')](removeEntity(_0x3f1d10,null))[_0x5d8e('0x4d')](handleError(_0x3f1d10,null));};exports[_0x5d8e('0x5d')]=function(_0x4a6efe,_0x37fd5f){return db[_0x5d8e('0x34')][_0x5d8e('0x5d')]()[_0x5d8e('0x2c')](respondWithResult(_0x37fd5f,null))['catch'](handleError(_0x37fd5f,null));};exports[_0x5d8e('0x5e')]=function(_0x394ee3,_0x36eb2c,_0x2ce8e9){var _0x4ff73c={'raw':!![],'where':{}},_0xfef889={},_0x5c187f;return db['OpenchannelQueue'][_0x5d8e('0x5f')]({'where':{'id':_0x394ee3[_0x5d8e('0x4e')]['id']}})[_0x5d8e('0x2c')](handleEntityNotFound(_0x36eb2c,null))[_0x5d8e('0x2c')](function(_0x15767d){if(_0x15767d){_0x5c187f=_0x15767d['get']({'plain':!![]});_0xfef889[_0x5d8e('0x3a')]=_['keys'](db[_0x5d8e('0x60')]['rawAttributes']);_0xfef889[_0x5d8e('0x37')]=_[_0x5d8e('0x38')](_0x394ee3[_0x5d8e('0x37')]);_0xfef889['filters']=_[_0x5d8e('0x3c')](_0xfef889['model'],_0xfef889[_0x5d8e('0x37')]);_0x4ff73c[_0x5d8e('0x3b')]=_[_0x5d8e('0x3c')](_0xfef889[_0x5d8e('0x3a')],qs['fields'](_0x394ee3[_0x5d8e('0x37')][_0x5d8e('0x3d')]));_0x4ff73c[_0x5d8e('0x3b')]=_0x4ff73c[_0x5d8e('0x3b')][_0x5d8e('0x3e')]?_0x4ff73c[_0x5d8e('0x3b')]:_0xfef889[_0x5d8e('0x3a')];if(!_0x394ee3['query'][_0x5d8e('0x3f')](_0x5d8e('0x40'))){_0x4ff73c[_0x5d8e('0x41')]=qs[_0x5d8e('0x41')](_0x394ee3[_0x5d8e('0x37')][_0x5d8e('0x41')]);_0x4ff73c['offset']=qs[_0x5d8e('0x24')](_0x394ee3['query'][_0x5d8e('0x24')]);}_0x4ff73c[_0x5d8e('0x42')]=qs[_0x5d8e('0x43')](_0x394ee3['query']['sort']);_0x4ff73c[_0x5d8e('0x44')]=qs[_0x5d8e('0x39')](_[_0x5d8e('0x61')](_0x394ee3[_0x5d8e('0x37')],_0xfef889[_0x5d8e('0x39')]));_0x4ff73c[_0x5d8e('0x44')][_0x5d8e('0x62')]=_0x15767d['id'];if(_0x394ee3[_0x5d8e('0x37')]['filter']){_0x4ff73c[_0x5d8e('0x44')]=_[_0x5d8e('0x46')](_0x4ff73c[_0x5d8e('0x44')],{'$or':_[_0x5d8e('0x33')](_0x4ff73c[_0x5d8e('0x3b')],function(_0x1719b2){var _0x359ad0={};_0x359ad0[_0x1719b2]={'$like':'%'+_0x394ee3['query'][_0x5d8e('0x45')]+'%'};return _0x359ad0;})});}_0x4ff73c=_[_0x5d8e('0x46')]({},_0x4ff73c,_0x394ee3[_0x5d8e('0x49')]);return db[_0x5d8e('0x60')]['findAll'](_0x4ff73c);}})[_0x5d8e('0x2c')](function(_0x4a6680){if(_0x4a6680){return db[_0x5d8e('0x63')][_0x5d8e('0x64')]({'where':{'id':_['map'](_0x4a6680,_0x5d8e('0x65')),'role':_0x5d8e('0x66')},'attributes':['id',_0x5d8e('0x30'),_0x5d8e('0x67'),_0x5d8e('0x68'),'createdAt']});}})[_0x5d8e('0x2c')](function(_0x37de1b){if(_0x37de1b){return{'count':_0x37de1b[_0x5d8e('0x23')],'rows':_['map'](_0x37de1b[_0x5d8e('0x4c')],function(_0x5f1912){return{'membername':_0x5f1912['name'],'UserId':_0x5f1912['id'],'queue_name':_0x5c187f[_0x5d8e('0x30')],'OpenchannelQueueId':_0x5c187f['id'],'interface':util['format'](_0x5d8e('0x69'),_0x5d8e('0x6a'),_0x5f1912[_0x5d8e('0x30')]),'penalty':0x0,'paused':_0x5f1912[_0x5d8e('0x67')],'createdAt':_0x5f1912[_0x5d8e('0x6b')],'updatedAt':_0x5f1912[_0x5d8e('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5d8e('0x2c')](respondWithFilteredResult(_0x36eb2c,_0x4ff73c))['catch'](handleError(_0x36eb2c,null));};exports[_0x5d8e('0x6c')]=function(_0x3c419d,_0xd7943,_0x52ad05){var _0x481f22={};var _0x4e9afa={};var _0x52140c;var _0x338f8e;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x3c419d[_0x5d8e('0x4e')]['id']}})[_0x5d8e('0x2c')](handleEntityNotFound(_0xd7943,null))['then'](function(_0x506b7d){if(_0x506b7d){_0x52140c=_0x506b7d;_0x4e9afa[_0x5d8e('0x3a')]=_[_0x5d8e('0x38')](db[_0x5d8e('0x6d')][_0x5d8e('0x4f')]);_0x4e9afa[_0x5d8e('0x37')]=_[_0x5d8e('0x38')](_0x3c419d[_0x5d8e('0x37')]);_0x4e9afa[_0x5d8e('0x39')]=_[_0x5d8e('0x3c')](_0x4e9afa[_0x5d8e('0x3a')],_0x4e9afa['query']);_0x481f22[_0x5d8e('0x3b')]=_[_0x5d8e('0x3c')](_0x4e9afa['model'],qs[_0x5d8e('0x3d')](_0x3c419d[_0x5d8e('0x37')][_0x5d8e('0x3d')]));_0x481f22[_0x5d8e('0x3b')]=_0x481f22[_0x5d8e('0x3b')]['length']?_0x481f22[_0x5d8e('0x3b')]:_0x4e9afa[_0x5d8e('0x3a')];_0x481f22['order']=qs['sort'](_0x3c419d[_0x5d8e('0x37')][_0x5d8e('0x43')]);_0x481f22[_0x5d8e('0x44')]=qs[_0x5d8e('0x39')](_['pick'](_0x3c419d['query'],_0x4e9afa[_0x5d8e('0x39')]));if(_0x3c419d[_0x5d8e('0x37')][_0x5d8e('0x45')]){_0x481f22[_0x5d8e('0x44')]=_[_0x5d8e('0x46')](_0x481f22[_0x5d8e('0x44')],{'$or':_['map'](_0x481f22[_0x5d8e('0x3b')],function(_0x134000){var _0x2be1a9={};_0x2be1a9[_0x134000]={'$like':'%'+_0x3c419d['query'][_0x5d8e('0x45')]+'%'};return _0x2be1a9;})});}_0x481f22=_[_0x5d8e('0x46')]({},_0x481f22,_0x3c419d[_0x5d8e('0x49')]);return _0x52140c['getTeams'](_0x481f22);}})['then'](function(_0x20bba0){if(_0x20bba0){_0x338f8e=_0x20bba0['length'];if(!_0x3c419d[_0x5d8e('0x37')][_0x5d8e('0x3f')]('nolimit')){_0x481f22[_0x5d8e('0x41')]=qs[_0x5d8e('0x41')](_0x3c419d[_0x5d8e('0x37')]['limit']);_0x481f22[_0x5d8e('0x24')]=qs[_0x5d8e('0x24')](_0x3c419d[_0x5d8e('0x37')][_0x5d8e('0x24')]);}return _0x52140c[_0x5d8e('0x6c')](_0x481f22);}})[_0x5d8e('0x2c')](function(_0x48f9e0){if(_0x48f9e0){return _0x48f9e0?{'count':_0x338f8e,'rows':_0x48f9e0}:null;}})[_0x5d8e('0x2c')](respondWithResult(_0xd7943,null))[_0x5d8e('0x4d')](handleError(_0xd7943,null));};exports['addTeams']=function(_0x138b52,_0x13662d,_0x49e5b5){var _0x571cc5=_0x138b52['body'][_0x5d8e('0x6e')];return db[_0x5d8e('0x6d')][_0x5d8e('0x4b')]({'where':{'id':_0x571cc5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5d8e('0x6f'),'attributes':['id',_0x5d8e('0x30'),_0x5d8e('0x70'),'voicePause',_0x5d8e('0x71')],'raw':!![]}]})[_0x5d8e('0x2c')](function(_0x128366){if(_0x128366){var _0x1d65d5=_[_0x5d8e('0x72')](_0x128366,function(_0x401fac){var _0x261e33=_0x401fac['get']({'plain':!![]});return _0x261e33[_0x5d8e('0x6f')];});return db[_0x5d8e('0x34')][_0x5d8e('0x51')]({'where':{'id':_0x138b52[_0x5d8e('0x4e')]['id']}})['then'](function(_0x56a361){return db[_0x5d8e('0x73')][_0x5d8e('0x74')](function(_0x48a167){return _0x56a361[_0x5d8e('0x75')](_0x571cc5,{'transaction':_0x48a167})[_0x5d8e('0x2c')](function(){return BPromise['each'](_0x1d65d5,function(_0x3e08b1){return db[_0x5d8e('0x60')]['findOrCreate']({'where':{'UserId':_0x3e08b1['id'],'OpenchannelQueueId':_0x138b52['params']['id']},'transaction':_0x48a167});});})['then'](function(){_0x1d65d5[_0x5d8e('0x76')](function(_0x513134){socket['emit'](_0x5d8e('0x77'),{'UserId':_0x513134['id'],'OpenchannelQueueId':_0x56a361['id']});});});});});}})['then'](respondWithStatusCode(_0x13662d,null))[_0x5d8e('0x4d')](handleError(_0x13662d,null));};exports[_0x5d8e('0x78')]=function(_0x471a9a,_0x520c42,_0x392b3c){return db[_0x5d8e('0x6d')][_0x5d8e('0x4b')]({'where':{'id':_0x471a9a[_0x5d8e('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5d8e('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x520c42,null))[_0x5d8e('0x2c')](function(_0xa7ddd1){var _0x407341=_[_0x5d8e('0x33')](_0xa7ddd1,'id');var _0x1b39d1=[];var _0x46c937=[];var _0x5645f5=squel[_0x5d8e('0x79')]();_0x5645f5['field'](_0x5d8e('0x7a'))[_0x5d8e('0x7b')]('team_has_openchannel_queues','tq')[_0x5d8e('0x7c')](_0x5d8e('0x7d'),'ut',_0x5d8e('0x7e'))['where'](_0x5d8e('0x7f'),_0x471a9a[_0x5d8e('0x4e')]['id']);for(var _0x2bf7bc=0x0;_0x2bf7bc<_0xa7ddd1[_0x5d8e('0x3e')];_0x2bf7bc+=0x1){let _0x43e140=_0xa7ddd1[_0x2bf7bc];for(var _0x119e68=0x0;_0x119e68<_0x43e140[_0x5d8e('0x6f')][_0x5d8e('0x3e')];_0x119e68+=0x1){let _0x1cd080=_0x43e140['Agents'][_0x119e68];var _0x4e1d23=_0x5645f5[_0x5d8e('0x80')]();_0x4e1d23[_0x5d8e('0x44')](_0x5d8e('0x81'),_0x1cd080['id']);_0x46c937[_0x5d8e('0x82')](db['sequelize'][_0x5d8e('0x37')](_0x4e1d23[_0x5d8e('0x83')](),{'type':db['sequelize']['QueryTypes'][_0x5d8e('0x84')]})['then'](function(_0x48f9ee){if(_0x48f9ee[_0x5d8e('0x3e')]===0x1){return _0x1cd080['id'];}else{var _0x415c7d=_[_0x5d8e('0x85')](_[_0x5d8e('0x33')](_0x48f9ee,_0x5d8e('0x86')),function(_0x40e94a){return _[_0x5d8e('0x87')](_0x407341,_0x40e94a);});if(_0x415c7d){return _0x1cd080['id'];}}}));}}return BPromise[_0x5d8e('0x88')](_0x46c937)[_0x5d8e('0x2c')](function(_0x45e3a5){_0x1b39d1=_(_0x1b39d1)[_0x5d8e('0x89')](_0x45e3a5)[_0x5d8e('0x8a')]()[_0x5d8e('0x8b')]();return db[_0x5d8e('0x34')][_0x5d8e('0x51')]({'where':{'id':_0x471a9a[_0x5d8e('0x4e')]['id']}})[_0x5d8e('0x2c')](function(_0xf054e8){return db[_0x5d8e('0x73')][_0x5d8e('0x74')](function(_0x258179){return _0xf054e8[_0x5d8e('0x78')](_0x471a9a[_0x5d8e('0x37')][_0x5d8e('0x6e')],{'transaction':_0x258179})[_0x5d8e('0x2c')](function(){if(!_['isEmpty'](_0x1b39d1)){return _0xf054e8[_0x5d8e('0x8c')](_0x1b39d1,{'transaction':_0x258179});}})[_0x5d8e('0x2c')](function(){_0x1b39d1[_0x5d8e('0x76')](function(_0x51369f){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x51369f,'OpenchannelQueueId':_0xf054e8['id']});});});});});});})[_0x5d8e('0x2c')](respondWithStatusCode(_0x520c42,null))[_0x5d8e('0x4d')](handleError(_0x520c42,null));};exports[_0x5d8e('0x8d')]=function(_0x431b4a,_0x342f02,_0x32e4c7){return db[_0x5d8e('0x34')][_0x5d8e('0x51')]({'where':{'id':_0x431b4a['params']['id']}})[_0x5d8e('0x2c')](handleEntityNotFound(_0x342f02,null))[_0x5d8e('0x2c')](function(_0x33bddf){if(_0x33bddf){return _0x33bddf[_0x5d8e('0x8d')](_0x431b4a['body'][_0x5d8e('0x6e')],_[_0x5d8e('0x8e')](_0x431b4a[_0x5d8e('0x5c')],[_0x5d8e('0x6e'),'id'])||{})['spread'](function(_0x19ce38){for(var _0x1d1b86=0x0;_0x1d1b86<_0x431b4a[_0x5d8e('0x5c')][_0x5d8e('0x6e')][_0x5d8e('0x3e')];_0x1d1b86+=0x1){socket[_0x5d8e('0x8f')](_0x5d8e('0x77'),{'UserId':_0x431b4a['body'][_0x5d8e('0x6e')][_0x1d1b86],'OpenchannelQueueId':_0x431b4a['params']['id']});}return _0x19ce38;});}})[_0x5d8e('0x2c')](respondWithResult(_0x342f02,null))[_0x5d8e('0x4d')](handleError(_0x342f02,null));};exports[_0x5d8e('0x8c')]=function(_0x5bce42,_0x4a0946,_0x57c8ad){return db[_0x5d8e('0x34')][_0x5d8e('0x51')]({'where':{'id':_0x5bce42[_0x5d8e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4a0946,null))[_0x5d8e('0x2c')](function(_0x3caaeb){if(_0x3caaeb){return _0x3caaeb['removeAgents'](_0x5bce42['query'][_0x5d8e('0x6e')])[_0x5d8e('0x2c')](function(){if(_[_0x5d8e('0x90')](_0x5bce42['query']['ids'])){for(var _0x30096a=0x0;_0x30096a<_0x5bce42[_0x5d8e('0x37')][_0x5d8e('0x6e')][_0x5d8e('0x3e')];_0x30096a+=0x1){socket[_0x5d8e('0x8f')](_0x5d8e('0x91'),{'UserId':Number(_0x5bce42[_0x5d8e('0x37')][_0x5d8e('0x6e')][_0x30096a]),'OpenchannelQueueId':Number(_0x5bce42[_0x5d8e('0x4e')]['id'])});}}else{socket[_0x5d8e('0x8f')](_0x5d8e('0x91'),{'UserId':Number(_0x5bce42['query'][_0x5d8e('0x6e')]),'OpenchannelQueueId':Number(_0x5bce42[_0x5d8e('0x4e')]['id'])});}});}})[_0x5d8e('0x2c')](respondWithStatusCode(_0x4a0946,null))['catch'](handleError(_0x4a0946,null));};exports[_0x5d8e('0x92')]=function(_0x1511ce,_0x118454,_0x2d6c3d){var _0xd7be76={};var _0x1fd8c4={};var _0x100fed;var _0x3cb17a;return db[_0x5d8e('0x34')][_0x5d8e('0x5f')]({'where':{'id':_0x1511ce[_0x5d8e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x118454,null))[_0x5d8e('0x2c')](function(_0x308a1b){if(_0x308a1b){_0x100fed=_0x308a1b;_0x1fd8c4[_0x5d8e('0x3a')]=_['keys'](db[_0x5d8e('0x63')][_0x5d8e('0x4f')]);_0x1fd8c4['query']=_[_0x5d8e('0x38')](_0x1511ce[_0x5d8e('0x37')]);_0x1fd8c4[_0x5d8e('0x39')]=_[_0x5d8e('0x3c')](_0x1fd8c4[_0x5d8e('0x3a')],_0x1fd8c4[_0x5d8e('0x37')]);_0xd7be76[_0x5d8e('0x3b')]=_[_0x5d8e('0x3c')](_0x1fd8c4[_0x5d8e('0x3a')],qs['fields'](_0x1511ce[_0x5d8e('0x37')][_0x5d8e('0x3d')]));_0xd7be76[_0x5d8e('0x3b')]=_0xd7be76['attributes']['length']?_0xd7be76[_0x5d8e('0x3b')]:_0x1fd8c4[_0x5d8e('0x3a')];_0xd7be76[_0x5d8e('0x42')]=qs[_0x5d8e('0x43')](_0x1511ce['query'][_0x5d8e('0x43')]);_0xd7be76[_0x5d8e('0x44')]=qs[_0x5d8e('0x39')](_[_0x5d8e('0x61')](_0x1511ce['query'],_0x1fd8c4['filters']));if(_0x1511ce[_0x5d8e('0x37')][_0x5d8e('0x45')]){_0xd7be76[_0x5d8e('0x44')]=_[_0x5d8e('0x46')](_0xd7be76[_0x5d8e('0x44')],{'$or':_[_0x5d8e('0x33')](_0xd7be76['attributes'],function(_0x2e1198){var _0x554bb2={};_0x554bb2[_0x2e1198]={'$like':'%'+_0x1511ce[_0x5d8e('0x37')][_0x5d8e('0x45')]+'%'};return _0x554bb2;})});}_0xd7be76=_[_0x5d8e('0x46')]({},_0xd7be76,_0x1511ce[_0x5d8e('0x49')]);return _0x100fed['getAgents'](_0xd7be76);}})[_0x5d8e('0x2c')](function(_0x541819){if(_0x541819){_0x3cb17a=_0x541819[_0x5d8e('0x3e')];if(!_0x1511ce['query'][_0x5d8e('0x3f')]('nolimit')){_0xd7be76[_0x5d8e('0x41')]=qs[_0x5d8e('0x41')](_0x1511ce['query']['limit']);_0xd7be76[_0x5d8e('0x24')]=qs['offset'](_0x1511ce['query'][_0x5d8e('0x24')]);}return _0x100fed[_0x5d8e('0x92')](_0xd7be76);}})[_0x5d8e('0x2c')](function(_0x3bd6ca){if(_0x3bd6ca){return _0x3bd6ca?{'count':_0x3cb17a,'rows':_0x3bd6ca}:null;}})[_0x5d8e('0x2c')](respondWithResult(_0x118454,null))[_0x5d8e('0x4d')](handleError(_0x118454,null));}; \ No newline at end of file +var _0x3bc9=['UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','User','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','get','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','keys','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAll','findAndCountAll'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x3bc9,0x14e));var _0x93bc=function(_0x477d97,_0x2ac82f){_0x477d97=_0x477d97-0x0;var _0xee1d94=_0x3bc9[_0x477d97];return _0xee1d94;};'use strict';var pdf=require(_0x93bc('0x0'));var emlformat=require(_0x93bc('0x1'));var rimraf=require(_0x93bc('0x2'));var zipdir=require(_0x93bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93bc('0x4'));var moment=require(_0x93bc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x93bc('0x6'));var util=require('util');var path=require(_0x93bc('0x7'));var sox=require(_0x93bc('0x8'));var csv=require(_0x93bc('0x9'));var ejs=require(_0x93bc('0xa'));var fs=require('fs');var _=require(_0x93bc('0xb'));var squel=require(_0x93bc('0xc'));var crypto=require(_0x93bc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x93bc('0xe'));var toCsv=require(_0x93bc('0x9'));var querystring=require(_0x93bc('0xf'));var Papa=require(_0x93bc('0x10'));var Redis=require(_0x93bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x93bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93bc('0x13'));var logger=require(_0x93bc('0x14'))(_0x93bc('0x15'));var utils=require(_0x93bc('0x16'));var config=require(_0x93bc('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x93bc('0x18')]=_[_0x93bc('0x19')](config[_0x93bc('0x18')],{'host':_0x93bc('0x1a'),'port':0x18eb});var socket=require(_0x93bc('0x1b'))(new Redis(config[_0x93bc('0x18')]));require(_0x93bc('0x1c'))[_0x93bc('0x1d')](socket);function respondWithStatusCode(_0x57c244,_0xa96862){_0xa96862=_0xa96862||0xcc;return function(_0x4b1ddd){if(_0x4b1ddd){return _0x57c244[_0x93bc('0x1e')](_0xa96862);}return _0x57c244[_0x93bc('0x1f')](_0xa96862)[_0x93bc('0x20')]();};}function respondWithResult(_0x268be0,_0x22c53d){_0x22c53d=_0x22c53d||0xc8;return function(_0x422783){if(_0x422783){return _0x268be0[_0x93bc('0x1f')](_0x22c53d)[_0x93bc('0x21')](_0x422783);}};}function respondWithFilteredResult(_0x2d614b,_0x59e7a2){return function(_0x3f1cdc){if(_0x3f1cdc){var _0x2d6a61=_0x3f1cdc[_0x93bc('0x22')],_0x20c583=_0x59e7a2['offset'],_0x305ba5=_0x59e7a2[_0x93bc('0x23')]+_0x59e7a2['limit'],_0xc1dc34;if(_0x305ba5>=_0x2d6a61){_0x305ba5=_0x2d6a61;_0xc1dc34=0xc8;}else{_0xc1dc34=0xce;}_0x2d614b['status'](_0xc1dc34);return _0x2d614b[_0x93bc('0x24')](_0x93bc('0x25'),_0x20c583+'-'+_0x305ba5+'/'+_0x2d6a61)['json'](_0x3f1cdc);}return null;};}function patchUpdates(_0x1ce889){return function(_0x4a937d){try{jsonpatch[_0x93bc('0x26')](_0x4a937d,_0x1ce889,!![]);}catch(_0x39d7de){return BPromise[_0x93bc('0x27')](_0x39d7de);}return _0x4a937d[_0x93bc('0x28')]();};}function saveUpdates(_0x5487bd,_0x51f08e){return function(_0x5b4018){if(_0x5b4018){return _0x5b4018['update'](_0x5487bd)['then'](function(_0x3ddbf4){return _0x3ddbf4;});}return null;};}function removeEntity(_0x41fd79,_0x3c311a){return function(_0x28f684){if(_0x28f684){return _0x28f684[_0x93bc('0x29')]()['then'](function(){var _0xfee76e=_0x28f684[_0x93bc('0x2a')]({'plain':!![]});var _0x147404=_0x93bc('0x2b');return db[_0x93bc('0x2c')][_0x93bc('0x29')]({'where':{'type':_0x147404,'resourceId':_0xfee76e['id']}})[_0x93bc('0x2d')](function(){return _0x28f684;});})[_0x93bc('0x2d')](function(){_0x41fd79[_0x93bc('0x1f')](0xcc)[_0x93bc('0x20')]();});}};}function handleEntityNotFound(_0x4a7e36,_0x45de93){return function(_0x291bad){if(!_0x291bad){_0x4a7e36[_0x93bc('0x1e')](0x194);}return _0x291bad;};}function handleError(_0x401e15,_0x2e92e8){_0x2e92e8=_0x2e92e8||0x1f4;return function(_0xbdf23b){logger[_0x93bc('0x2e')](_0xbdf23b[_0x93bc('0x2f')]);if(_0xbdf23b['name']){delete _0xbdf23b[_0x93bc('0x30')];}_0x401e15['status'](_0x2e92e8)[_0x93bc('0x31')](_0xbdf23b);};}exports['index']=function(_0x6b65cb,_0x5b8da5){var _0x22ab42={},_0x452506={},_0xc56e9e={'count':0x0,'rows':[]};var _0x4370f7=_['map'](db[_0x93bc('0x32')][_0x93bc('0x33')],function(_0x491a2e){return{'name':_0x491a2e[_0x93bc('0x34')],'type':_0x491a2e[_0x93bc('0x35')][_0x93bc('0x36')]};});_0x452506[_0x93bc('0x37')]=_[_0x93bc('0x38')](_0x4370f7,_0x93bc('0x30'));_0x452506[_0x93bc('0x39')]=_['keys'](_0x6b65cb['query']);_0x452506[_0x93bc('0x3a')]=_[_0x93bc('0x3b')](_0x452506[_0x93bc('0x37')],_0x452506['query']);_0x22ab42[_0x93bc('0x3c')]=_[_0x93bc('0x3b')](_0x452506[_0x93bc('0x37')],qs[_0x93bc('0x3d')](_0x6b65cb['query']['fields']));_0x22ab42[_0x93bc('0x3c')]=_0x22ab42[_0x93bc('0x3c')][_0x93bc('0x3e')]?_0x22ab42[_0x93bc('0x3c')]:_0x452506[_0x93bc('0x37')];if(!_0x6b65cb['query'][_0x93bc('0x3f')](_0x93bc('0x40'))){_0x22ab42[_0x93bc('0x41')]=qs[_0x93bc('0x41')](_0x6b65cb['query'][_0x93bc('0x41')]);_0x22ab42['offset']=qs[_0x93bc('0x23')](_0x6b65cb[_0x93bc('0x39')]['offset']);}_0x22ab42[_0x93bc('0x42')]=qs[_0x93bc('0x43')](_0x6b65cb[_0x93bc('0x39')][_0x93bc('0x43')]);_0x22ab42[_0x93bc('0x44')]=qs[_0x93bc('0x3a')](_[_0x93bc('0x45')](_0x6b65cb['query'],_0x452506[_0x93bc('0x3a')]),_0x4370f7);if(_0x6b65cb['query'][_0x93bc('0x46')]){_0x22ab42['where']=_[_0x93bc('0x47')](_0x22ab42[_0x93bc('0x44')],{'$or':_[_0x93bc('0x38')](_0x4370f7,function(_0x13cda7){if(_0x13cda7[_0x93bc('0x35')]!==_0x93bc('0x48')){var _0x3b3394={};_0x3b3394[_0x13cda7[_0x93bc('0x30')]]={'$like':'%'+_0x6b65cb[_0x93bc('0x39')]['filter']+'%'};return _0x3b3394;}})});}_0x22ab42=_[_0x93bc('0x47')]({},_0x22ab42,_0x6b65cb[_0x93bc('0x49')]);var _0x576429={'where':_0x22ab42[_0x93bc('0x44')]};return db['OpenchannelQueue'][_0x93bc('0x22')](_0x576429)['then'](function(_0x55a76e){_0xc56e9e[_0x93bc('0x22')]=_0x55a76e;if(_0x6b65cb[_0x93bc('0x39')][_0x93bc('0x4a')]){_0x22ab42[_0x93bc('0x4b')]=[{'all':!![]}];}return db[_0x93bc('0x32')]['findAll'](_0x22ab42);})[_0x93bc('0x2d')](function(_0x47bcd0){_0xc56e9e['rows']=_0x47bcd0;return _0xc56e9e;})[_0x93bc('0x2d')](respondWithFilteredResult(_0x5b8da5,_0x22ab42))['catch'](handleError(_0x5b8da5,null));};exports['show']=function(_0x12969b,_0x2e2ee8){var _0xff814e={'raw':!![],'where':{'id':_0x12969b[_0x93bc('0x4c')]['id']}},_0x1a4810={};_0x1a4810[_0x93bc('0x37')]=_[_0x93bc('0x4d')](db['OpenchannelQueue']['rawAttributes']);_0x1a4810[_0x93bc('0x39')]=_['keys'](_0x12969b['query']);_0x1a4810['filters']=_['intersection'](_0x1a4810[_0x93bc('0x37')],_0x1a4810['query']);_0xff814e[_0x93bc('0x3c')]=_[_0x93bc('0x3b')](_0x1a4810[_0x93bc('0x37')],qs[_0x93bc('0x3d')](_0x12969b[_0x93bc('0x39')][_0x93bc('0x3d')]));_0xff814e[_0x93bc('0x3c')]=_0xff814e['attributes'][_0x93bc('0x3e')]?_0xff814e[_0x93bc('0x3c')]:_0x1a4810['model'];if(_0x12969b[_0x93bc('0x39')][_0x93bc('0x4a')]){_0xff814e[_0x93bc('0x4b')]=[{'all':!![]}];}_0xff814e=_['merge']({},_0xff814e,_0x12969b[_0x93bc('0x49')]);return db[_0x93bc('0x32')][_0x93bc('0x4e')](_0xff814e)[_0x93bc('0x2d')](handleEntityNotFound(_0x2e2ee8,null))[_0x93bc('0x2d')](respondWithResult(_0x2e2ee8,null))[_0x93bc('0x4f')](handleError(_0x2e2ee8,null));};exports[_0x93bc('0x50')]=function(_0x1c2d3e,_0xd5f979){return db[_0x93bc('0x32')][_0x93bc('0x50')](_0x1c2d3e['body'],{})[_0x93bc('0x2d')](function(_0x5a98ff){var _0x3c44e8=_0x1c2d3e['user'][_0x93bc('0x2a')]({'plain':!![]});if(!_0x3c44e8)throw new Error(_0x93bc('0x51'));if(_0x3c44e8[_0x93bc('0x52')]===_0x93bc('0x53')){var _0x25e1f4=_0x5a98ff[_0x93bc('0x2a')]({'plain':!![]});var _0x5a5ec7='OpenchannelQueues';return db[_0x93bc('0x54')]['find']({'where':{'name':_0x5a5ec7,'userProfileId':_0x3c44e8[_0x93bc('0x55')]},'raw':!![]})[_0x93bc('0x2d')](function(_0x41c4b7){if(_0x41c4b7&&_0x41c4b7[_0x93bc('0x56')]===0x0){return db[_0x93bc('0x2c')][_0x93bc('0x50')]({'name':_0x25e1f4['name'],'resourceId':_0x25e1f4['id'],'type':_0x41c4b7[_0x93bc('0x30')],'sectionId':_0x41c4b7['id']},{})[_0x93bc('0x2d')](function(){return _0x5a98ff;});}else{return _0x5a98ff;}})[_0x93bc('0x4f')](function(_0x3cb178){logger['error'](_0x93bc('0x57'),_0x3cb178);throw _0x3cb178;});}return _0x5a98ff;})[_0x93bc('0x2d')](respondWithResult(_0xd5f979,0xc9))[_0x93bc('0x4f')](handleError(_0xd5f979,null));};exports[_0x93bc('0x58')]=function(_0x4540d3,_0x3d8cd7){if(_0x4540d3[_0x93bc('0x59')]['id']){delete _0x4540d3[_0x93bc('0x59')]['id'];}return db['OpenchannelQueue'][_0x93bc('0x4e')]({'where':{'id':_0x4540d3[_0x93bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d8cd7,null))[_0x93bc('0x2d')](saveUpdates(_0x4540d3[_0x93bc('0x59')],null))[_0x93bc('0x2d')](respondWithResult(_0x3d8cd7,null))[_0x93bc('0x4f')](handleError(_0x3d8cd7,null));};exports[_0x93bc('0x29')]=function(_0x88c0fe,_0x3b7fb2){return db[_0x93bc('0x32')][_0x93bc('0x4e')]({'where':{'id':_0x88c0fe[_0x93bc('0x4c')]['id']}})[_0x93bc('0x2d')](handleEntityNotFound(_0x3b7fb2,null))[_0x93bc('0x2d')](removeEntity(_0x3b7fb2,null))[_0x93bc('0x4f')](handleError(_0x3b7fb2,null));};exports['describe']=function(_0x44a3e8,_0x371d7a){return db[_0x93bc('0x32')]['describe']()[_0x93bc('0x2d')](respondWithResult(_0x371d7a,null))[_0x93bc('0x4f')](handleError(_0x371d7a,null));};exports['getMembers']=function(_0x3d35b2,_0x421dea,_0x2863d2){var _0xde147a={'raw':!![],'where':{}},_0x346f77={},_0x2ef66d;return db[_0x93bc('0x32')][_0x93bc('0x5a')]({'where':{'id':_0x3d35b2['params']['id']}})[_0x93bc('0x2d')](handleEntityNotFound(_0x421dea,null))[_0x93bc('0x2d')](function(_0x37d119){if(_0x37d119){_0x2ef66d=_0x37d119[_0x93bc('0x2a')]({'plain':!![]});_0x346f77[_0x93bc('0x37')]=_[_0x93bc('0x4d')](db['UserOpenchannelQueue'][_0x93bc('0x33')]);_0x346f77[_0x93bc('0x39')]=_[_0x93bc('0x4d')](_0x3d35b2[_0x93bc('0x39')]);_0x346f77[_0x93bc('0x3a')]=_['intersection'](_0x346f77['model'],_0x346f77[_0x93bc('0x39')]);_0xde147a[_0x93bc('0x3c')]=_[_0x93bc('0x3b')](_0x346f77[_0x93bc('0x37')],qs['fields'](_0x3d35b2[_0x93bc('0x39')]['fields']));_0xde147a[_0x93bc('0x3c')]=_0xde147a['attributes'][_0x93bc('0x3e')]?_0xde147a['attributes']:_0x346f77['model'];if(!_0x3d35b2[_0x93bc('0x39')][_0x93bc('0x3f')](_0x93bc('0x40'))){_0xde147a['limit']=qs[_0x93bc('0x41')](_0x3d35b2[_0x93bc('0x39')][_0x93bc('0x41')]);_0xde147a[_0x93bc('0x23')]=qs[_0x93bc('0x23')](_0x3d35b2['query'][_0x93bc('0x23')]);}_0xde147a[_0x93bc('0x42')]=qs[_0x93bc('0x43')](_0x3d35b2[_0x93bc('0x39')]['sort']);_0xde147a[_0x93bc('0x44')]=qs[_0x93bc('0x3a')](_[_0x93bc('0x45')](_0x3d35b2[_0x93bc('0x39')],_0x346f77[_0x93bc('0x3a')]));_0xde147a['where'][_0x93bc('0x5b')]=_0x37d119['id'];if(_0x3d35b2['query']['filter']){_0xde147a[_0x93bc('0x44')]=_['merge'](_0xde147a[_0x93bc('0x44')],{'$or':_[_0x93bc('0x38')](_0xde147a[_0x93bc('0x3c')],function(_0x41524c){var _0x5546fd={};_0x5546fd[_0x41524c]={'$like':'%'+_0x3d35b2[_0x93bc('0x39')][_0x93bc('0x46')]+'%'};return _0x5546fd;})});}_0xde147a=_[_0x93bc('0x47')]({},_0xde147a,_0x3d35b2[_0x93bc('0x49')]);return db[_0x93bc('0x5c')][_0x93bc('0x5d')](_0xde147a);}})[_0x93bc('0x2d')](function(_0x57931b){if(_0x57931b){return db['User'][_0x93bc('0x5e')]({'where':{'id':_[_0x93bc('0x38')](_0x57931b,_0x93bc('0x5f')),'role':_0x93bc('0x60')},'attributes':['id',_0x93bc('0x30'),_0x93bc('0x61'),_0x93bc('0x62'),_0x93bc('0x63')]});}})[_0x93bc('0x2d')](function(_0x61d47){if(_0x61d47){return{'count':_0x61d47['count'],'rows':_[_0x93bc('0x38')](_0x61d47[_0x93bc('0x64')],function(_0x699c02){return{'membername':_0x699c02[_0x93bc('0x30')],'UserId':_0x699c02['id'],'queue_name':_0x2ef66d['name'],'OpenchannelQueueId':_0x2ef66d['id'],'interface':util[_0x93bc('0x65')](_0x93bc('0x66'),_0x93bc('0x67'),_0x699c02[_0x93bc('0x30')]),'penalty':0x0,'paused':_0x699c02[_0x93bc('0x61')],'createdAt':_0x699c02[_0x93bc('0x63')],'updatedAt':_0x699c02[_0x93bc('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x93bc('0x2d')](respondWithFilteredResult(_0x421dea,_0xde147a))[_0x93bc('0x4f')](handleError(_0x421dea,null));};exports[_0x93bc('0x68')]=function(_0x5047e3,_0x20d309,_0x2d524c){var _0x5180f9={};var _0x49b0ec={};var _0x14372b;var _0x37a74b;return db[_0x93bc('0x32')][_0x93bc('0x5a')]({'where':{'id':_0x5047e3[_0x93bc('0x4c')]['id']}})[_0x93bc('0x2d')](handleEntityNotFound(_0x20d309,null))['then'](function(_0x276ad9){if(_0x276ad9){_0x14372b=_0x276ad9;_0x49b0ec[_0x93bc('0x37')]=_[_0x93bc('0x4d')](db['Team'][_0x93bc('0x33')]);_0x49b0ec[_0x93bc('0x39')]=_[_0x93bc('0x4d')](_0x5047e3[_0x93bc('0x39')]);_0x49b0ec[_0x93bc('0x3a')]=_[_0x93bc('0x3b')](_0x49b0ec[_0x93bc('0x37')],_0x49b0ec[_0x93bc('0x39')]);_0x5180f9[_0x93bc('0x3c')]=_[_0x93bc('0x3b')](_0x49b0ec[_0x93bc('0x37')],qs[_0x93bc('0x3d')](_0x5047e3[_0x93bc('0x39')][_0x93bc('0x3d')]));_0x5180f9[_0x93bc('0x3c')]=_0x5180f9[_0x93bc('0x3c')][_0x93bc('0x3e')]?_0x5180f9[_0x93bc('0x3c')]:_0x49b0ec[_0x93bc('0x37')];_0x5180f9[_0x93bc('0x42')]=qs[_0x93bc('0x43')](_0x5047e3[_0x93bc('0x39')][_0x93bc('0x43')]);_0x5180f9[_0x93bc('0x44')]=qs[_0x93bc('0x3a')](_['pick'](_0x5047e3['query'],_0x49b0ec['filters']));if(_0x5047e3['query'][_0x93bc('0x46')]){_0x5180f9[_0x93bc('0x44')]=_['merge'](_0x5180f9[_0x93bc('0x44')],{'$or':_[_0x93bc('0x38')](_0x5180f9[_0x93bc('0x3c')],function(_0x48e2fa){var _0x1a47d3={};_0x1a47d3[_0x48e2fa]={'$like':'%'+_0x5047e3[_0x93bc('0x39')][_0x93bc('0x46')]+'%'};return _0x1a47d3;})});}_0x5180f9=_[_0x93bc('0x47')]({},_0x5180f9,_0x5047e3[_0x93bc('0x49')]);return _0x14372b[_0x93bc('0x68')](_0x5180f9);}})[_0x93bc('0x2d')](function(_0xfafb96){if(_0xfafb96){_0x37a74b=_0xfafb96['length'];if(!_0x5047e3[_0x93bc('0x39')][_0x93bc('0x3f')](_0x93bc('0x40'))){_0x5180f9[_0x93bc('0x41')]=qs[_0x93bc('0x41')](_0x5047e3[_0x93bc('0x39')][_0x93bc('0x41')]);_0x5180f9[_0x93bc('0x23')]=qs[_0x93bc('0x23')](_0x5047e3[_0x93bc('0x39')][_0x93bc('0x23')]);}return _0x14372b[_0x93bc('0x68')](_0x5180f9);}})[_0x93bc('0x2d')](function(_0xcc609){if(_0xcc609){return _0xcc609?{'count':_0x37a74b,'rows':_0xcc609}:null;}})[_0x93bc('0x2d')](respondWithResult(_0x20d309,null))[_0x93bc('0x4f')](handleError(_0x20d309,null));};exports[_0x93bc('0x69')]=function(_0xd552ae,_0x4d3273,_0x2fffc3){var _0x2a91bf=_0xd552ae[_0x93bc('0x59')][_0x93bc('0x6a')];return db[_0x93bc('0x6b')][_0x93bc('0x5d')]({'where':{'id':_0x2a91bf},'attributes':['id'],'include':[{'model':db['User'],'as':_0x93bc('0x6c'),'attributes':['id',_0x93bc('0x30'),_0x93bc('0x6d'),_0x93bc('0x6e'),_0x93bc('0x6f')],'raw':!![]}]})[_0x93bc('0x2d')](function(_0x4a8254){if(_0x4a8254){var _0x29b6db=_[_0x93bc('0x70')](_0x4a8254,function(_0x585362){var _0x33c4c4=_0x585362[_0x93bc('0x2a')]({'plain':!![]});return _0x33c4c4[_0x93bc('0x6c')];});return db[_0x93bc('0x32')][_0x93bc('0x4e')]({'where':{'id':_0xd552ae[_0x93bc('0x4c')]['id']}})[_0x93bc('0x2d')](function(_0x5c4f4e){return db[_0x93bc('0x71')][_0x93bc('0x72')](function(_0x4c7a8e){return _0x5c4f4e[_0x93bc('0x69')](_0x2a91bf,{'transaction':_0x4c7a8e})[_0x93bc('0x2d')](function(){return BPromise[_0x93bc('0x73')](_0x29b6db,function(_0x5a566c){return db['UserOpenchannelQueue'][_0x93bc('0x74')]({'where':{'UserId':_0x5a566c['id'],'OpenchannelQueueId':_0xd552ae[_0x93bc('0x4c')]['id']},'transaction':_0x4c7a8e});});})[_0x93bc('0x2d')](function(){_0x29b6db['forEach'](function(_0x282df4){socket[_0x93bc('0x75')](_0x93bc('0x76'),{'UserId':_0x282df4['id'],'OpenchannelQueueId':_0x5c4f4e['id']});});});});});}})['then'](respondWithStatusCode(_0x4d3273,null))[_0x93bc('0x4f')](handleError(_0x4d3273,null));};exports['removeTeams']=function(_0x397f5c,_0x329a9d,_0xa4f905){return db[_0x93bc('0x6b')]['findAll']({'where':{'id':_0x397f5c[_0x93bc('0x39')][_0x93bc('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x93bc('0x77')],'as':_0x93bc('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x93bc('0x2d')](handleEntityNotFound(_0x329a9d,null))[_0x93bc('0x2d')](function(_0x1605eb){var _0x5d575b=_[_0x93bc('0x38')](_0x1605eb,'id');var _0x23f414=[];var _0x5b1d6a=[];var _0x354699=squel[_0x93bc('0x78')]();_0x354699[_0x93bc('0x79')]('tq.TeamId')[_0x93bc('0x7a')](_0x93bc('0x7b'),'tq')[_0x93bc('0x7c')](_0x93bc('0x7d'),'ut',_0x93bc('0x7e'))[_0x93bc('0x44')](_0x93bc('0x7f'),_0x397f5c['params']['id']);for(var _0x11e14f=0x0;_0x11e14f<_0x1605eb[_0x93bc('0x3e')];_0x11e14f+=0x1){let _0x47e73b=_0x1605eb[_0x11e14f];for(var _0x14a35c=0x0;_0x14a35c<_0x47e73b[_0x93bc('0x6c')][_0x93bc('0x3e')];_0x14a35c+=0x1){let _0x524fb3=_0x47e73b[_0x93bc('0x6c')][_0x14a35c];var _0x488363=_0x354699[_0x93bc('0x80')]();_0x488363[_0x93bc('0x44')]('ut.UserId\x20=\x20?',_0x524fb3['id']);_0x5b1d6a[_0x93bc('0x81')](db[_0x93bc('0x71')][_0x93bc('0x39')](_0x488363['toString'](),{'type':db[_0x93bc('0x71')]['QueryTypes']['SELECT']})[_0x93bc('0x2d')](function(_0x30f3d8){if(_0x30f3d8[_0x93bc('0x3e')]===0x1){return _0x524fb3['id'];}else{var _0x352aad=_['every'](_[_0x93bc('0x38')](_0x30f3d8,_0x93bc('0x82')),function(_0xc32fbd){return _[_0x93bc('0x83')](_0x5d575b,_0xc32fbd);});if(_0x352aad){return _0x524fb3['id'];}}}));}}return BPromise[_0x93bc('0x84')](_0x5b1d6a)['then'](function(_0x2180f5){_0x23f414=_(_0x23f414)['union'](_0x2180f5)[_0x93bc('0x85')]()[_0x93bc('0x86')]();return db[_0x93bc('0x32')][_0x93bc('0x4e')]({'where':{'id':_0x397f5c[_0x93bc('0x4c')]['id']}})['then'](function(_0x4357f3){return db[_0x93bc('0x71')][_0x93bc('0x72')](function(_0x30e8e1){return _0x4357f3['removeTeams'](_0x397f5c[_0x93bc('0x39')][_0x93bc('0x6a')],{'transaction':_0x30e8e1})[_0x93bc('0x2d')](function(){if(!_[_0x93bc('0x87')](_0x23f414)){return _0x4357f3[_0x93bc('0x88')](_0x23f414,{'transaction':_0x30e8e1});}})['then'](function(){_0x23f414[_0x93bc('0x89')](function(_0x48ffcb){socket['emit'](_0x93bc('0x8a'),{'UserId':_0x48ffcb,'OpenchannelQueueId':_0x4357f3['id']});});});});});});})[_0x93bc('0x2d')](respondWithStatusCode(_0x329a9d,null))[_0x93bc('0x4f')](handleError(_0x329a9d,null));};exports[_0x93bc('0x8b')]=function(_0x34bbf2,_0x45d745,_0x107174){return db[_0x93bc('0x32')][_0x93bc('0x4e')]({'where':{'id':_0x34bbf2['params']['id']}})['then'](handleEntityNotFound(_0x45d745,null))[_0x93bc('0x2d')](function(_0x412de3){if(_0x412de3){return _0x412de3[_0x93bc('0x8b')](_0x34bbf2[_0x93bc('0x59')][_0x93bc('0x6a')],_[_0x93bc('0x8c')](_0x34bbf2[_0x93bc('0x59')],[_0x93bc('0x6a'),'id'])||{})[_0x93bc('0x8d')](function(_0x264f8d){for(var _0x5967cb=0x0;_0x5967cb<_0x34bbf2[_0x93bc('0x59')]['ids']['length'];_0x5967cb+=0x1){socket[_0x93bc('0x75')](_0x93bc('0x76'),{'UserId':_0x34bbf2[_0x93bc('0x59')]['ids'][_0x5967cb],'OpenchannelQueueId':_0x34bbf2[_0x93bc('0x4c')]['id']});}return _0x264f8d;});}})[_0x93bc('0x2d')](respondWithResult(_0x45d745,null))[_0x93bc('0x4f')](handleError(_0x45d745,null));};exports[_0x93bc('0x88')]=function(_0x2e6d2f,_0x1278d0,_0x55b663){return db['OpenchannelQueue'][_0x93bc('0x4e')]({'where':{'id':_0x2e6d2f['params']['id']}})['then'](handleEntityNotFound(_0x1278d0,null))['then'](function(_0x4cab98){if(_0x4cab98){return _0x4cab98[_0x93bc('0x88')](_0x2e6d2f[_0x93bc('0x39')]['ids'])['then'](function(){if(_['isArray'](_0x2e6d2f[_0x93bc('0x39')][_0x93bc('0x6a')])){for(var _0x1f57cc=0x0;_0x1f57cc<_0x2e6d2f[_0x93bc('0x39')][_0x93bc('0x6a')][_0x93bc('0x3e')];_0x1f57cc+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x2e6d2f['query'][_0x93bc('0x6a')][_0x1f57cc]),'OpenchannelQueueId':Number(_0x2e6d2f['params']['id'])});}}else{socket[_0x93bc('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2e6d2f[_0x93bc('0x39')]['ids']),'OpenchannelQueueId':Number(_0x2e6d2f[_0x93bc('0x4c')]['id'])});}});}})[_0x93bc('0x2d')](respondWithStatusCode(_0x1278d0,null))[_0x93bc('0x4f')](handleError(_0x1278d0,null));};exports[_0x93bc('0x8e')]=function(_0x5c089b,_0x119ae4,_0x55c513){var _0x2908ca={};var _0x34aca7={};var _0x4d0b7b;var _0x49ecce;return db[_0x93bc('0x32')][_0x93bc('0x5a')]({'where':{'id':_0x5c089b[_0x93bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x119ae4,null))[_0x93bc('0x2d')](function(_0x1d5491){if(_0x1d5491){_0x4d0b7b=_0x1d5491;_0x34aca7[_0x93bc('0x37')]=_[_0x93bc('0x4d')](db[_0x93bc('0x77')][_0x93bc('0x33')]);_0x34aca7[_0x93bc('0x39')]=_[_0x93bc('0x4d')](_0x5c089b['query']);_0x34aca7[_0x93bc('0x3a')]=_['intersection'](_0x34aca7[_0x93bc('0x37')],_0x34aca7[_0x93bc('0x39')]);_0x2908ca[_0x93bc('0x3c')]=_['intersection'](_0x34aca7[_0x93bc('0x37')],qs[_0x93bc('0x3d')](_0x5c089b[_0x93bc('0x39')]['fields']));_0x2908ca['attributes']=_0x2908ca[_0x93bc('0x3c')]['length']?_0x2908ca['attributes']:_0x34aca7[_0x93bc('0x37')];_0x2908ca[_0x93bc('0x42')]=qs['sort'](_0x5c089b[_0x93bc('0x39')][_0x93bc('0x43')]);_0x2908ca['where']=qs[_0x93bc('0x3a')](_[_0x93bc('0x45')](_0x5c089b[_0x93bc('0x39')],_0x34aca7[_0x93bc('0x3a')]));if(_0x5c089b[_0x93bc('0x39')][_0x93bc('0x46')]){_0x2908ca[_0x93bc('0x44')]=_[_0x93bc('0x47')](_0x2908ca[_0x93bc('0x44')],{'$or':_[_0x93bc('0x38')](_0x2908ca[_0x93bc('0x3c')],function(_0x57e468){var _0x326949={};_0x326949[_0x57e468]={'$like':'%'+_0x5c089b[_0x93bc('0x39')][_0x93bc('0x46')]+'%'};return _0x326949;})});}_0x2908ca=_[_0x93bc('0x47')]({},_0x2908ca,_0x5c089b[_0x93bc('0x49')]);return _0x4d0b7b[_0x93bc('0x8e')](_0x2908ca);}})['then'](function(_0x4cd4b7){if(_0x4cd4b7){_0x49ecce=_0x4cd4b7[_0x93bc('0x3e')];if(!_0x5c089b['query'][_0x93bc('0x3f')](_0x93bc('0x40'))){_0x2908ca[_0x93bc('0x41')]=qs[_0x93bc('0x41')](_0x5c089b[_0x93bc('0x39')][_0x93bc('0x41')]);_0x2908ca[_0x93bc('0x23')]=qs[_0x93bc('0x23')](_0x5c089b['query'][_0x93bc('0x23')]);}return _0x4d0b7b['getAgents'](_0x2908ca);}})[_0x93bc('0x2d')](function(_0x446721){if(_0x446721){return _0x446721?{'count':_0x49ecce,'rows':_0x446721}:null;}})[_0x93bc('0x2d')](respondWithResult(_0x119ae4,null))[_0x93bc('0x4f')](handleError(_0x119ae4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a19ab0a..00f4152 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 _0x5843=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','update','remove'];(function(_0x1039e2,_0x1ff2d6){var _0x111c30=function(_0x36d232){while(--_0x36d232){_0x1039e2['push'](_0x1039e2['shift']());}};_0x111c30(++_0x1ff2d6);}(_0x5843,0x124));var _0x3584=function(_0x25ca73,_0x4c54df){_0x25ca73=_0x25ca73-0x0;var _0x4344d9=_0x5843[_0x25ca73];return _0x4344d9;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3584('0x0')](0x0);var events={'afterCreate':_0x3584('0x1'),'afterUpdate':_0x3584('0x2'),'afterDestroy':_0x3584('0x3')};function emitEvent(_0x191c5a){return function(_0x1658c8,_0x21e4dd,_0x503636){OpenchannelQueueEvents[_0x3584('0x4')](_0x191c5a+':'+_0x1658c8['id'],_0x1658c8);OpenchannelQueueEvents[_0x3584('0x4')](_0x191c5a,_0x1658c8);_0x503636(null);};}for(var e in events){if(events[_0x3584('0x5')](e)){var event=events[e];OpenchannelQueue[_0x3584('0x6')](e,emitEvent(event));}}module[_0x3584('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xbdfa=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x31638b,_0x152268){var _0x570151=function(_0x447622){while(--_0x447622){_0x31638b['push'](_0x31638b['shift']());}};_0x570151(++_0x152268);}(_0xbdfa,0x1df));var _0xabdf=function(_0x1fe126,_0x5068da){_0x1fe126=_0x1fe126-0x0;var _0x2cf9e8=_0xbdfa[_0x1fe126];return _0x2cf9e8;};'use strict';var EventEmitter=require(_0xabdf('0x0'));var OpenchannelQueue=require(_0xabdf('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xabdf('0x2')](0x0);var events={'afterCreate':_0xabdf('0x3'),'afterUpdate':'update','afterDestroy':_0xabdf('0x4')};function emitEvent(_0x1e6ac0){return function(_0x28d2db,_0x2d78c2,_0xb8e1ff){OpenchannelQueueEvents[_0xabdf('0x5')](_0x1e6ac0+':'+_0x28d2db['id'],_0x28d2db);OpenchannelQueueEvents[_0xabdf('0x5')](_0x1e6ac0,_0x28d2db);_0xb8e1ff(null);};}for(var e in events){if(events[_0xabdf('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xabdf('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 071f81b..67b2c45 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 _0xaa51=['path','rimraf','../../config/environment','exports','define','openchannel_queues','lodash','util','api','moment','bluebird'];(function(_0x5dacab,_0x3973f9){var _0x4e50cd=function(_0x4f4d3d){while(--_0x4f4d3d){_0x5dacab['push'](_0x5dacab['shift']());}};_0x4e50cd(++_0x3973f9);}(_0xaa51,0xf8));var _0x1aa5=function(_0x10ba25,_0x319ce1){_0x10ba25=_0x10ba25-0x0;var _0x2e9a19=_0xaa51[_0x10ba25];return _0x2e9a19;};'use strict';var _=require(_0x1aa5('0x0'));var util=require(_0x1aa5('0x1'));var logger=require('../../config/logger')(_0x1aa5('0x2'));var moment=require(_0x1aa5('0x3'));var BPromise=require(_0x1aa5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1aa5('0x5'));var rimraf=require(_0x1aa5('0x6'));var config=require(_0x1aa5('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x1aa5('0x8')]=function(_0x23ea50,_0x146e2b){return _0x23ea50[_0x1aa5('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x1aa5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b1b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b1b,0x17f));var _0xb4b1=function(_0x3a5f73,_0x1f2c9f){_0x3a5f73=_0x3a5f73-0x0;var _0xeb2c40=_0x4b1b[_0x3a5f73];return _0xeb2c40;};'use strict';var _=require(_0xb4b1('0x0'));var util=require(_0xb4b1('0x1'));var logger=require(_0xb4b1('0x2'))(_0xb4b1('0x3'));var moment=require(_0xb4b1('0x4'));var BPromise=require(_0xb4b1('0x5'));var rp=require(_0xb4b1('0x6'));var fs=require('fs');var path=require(_0xb4b1('0x7'));var rimraf=require(_0xb4b1('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x49ddcd,_0x2b28b4){return _0x49ddcd[_0xb4b1('0x9')](_0xb4b1('0xa'),attributes,{'tableName':_0xb4b1('0xb'),'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 b40619d..9964f45 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 _0xaf5b=['http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','model','map','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x41ff7b,_0x4df64c){var _0x188617=function(_0x57b280){while(--_0x57b280){_0x41ff7b['push'](_0x41ff7b['shift']());}};_0x188617(++_0x4df64c);}(_0xaf5b,0x1f0));var _0xbaf5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaf5b[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xbaf5('0x0'));var util=require('util');var moment=require(_0xbaf5('0x1'));var BPromise=require(_0xbaf5('0x2'));var rs=require(_0xbaf5('0x3'));var fs=require('fs');var Redis=require(_0xbaf5('0x4'));var db=require(_0xbaf5('0x5'))['db'];var utils=require(_0xbaf5('0x6'));var logger=require(_0xbaf5('0x7'))(_0xbaf5('0x8'));var config=require('../../config/environment');var jayson=require(_0xbaf5('0x9'));var client=jayson[_0xbaf5('0xa')][_0xbaf5('0xb')]({'port':0x232a});config[_0xbaf5('0xc')]=_[_0xbaf5('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbaf5('0xe'))(new Redis(config['redis']));require(_0xbaf5('0xf'))['register'](socket);function respondWithRpcPromise(_0x4aebb6,_0x5473ee,_0x1a01aa){return new BPromise(function(_0x3ab5a9,_0x3bf8a3){return client[_0xbaf5('0x10')](_0x4aebb6,_0x1a01aa)[_0xbaf5('0x11')](function(_0x35c30f){logger[_0xbaf5('0x12')](_0xbaf5('0x13'),_0x5473ee,_0xbaf5('0x14'));logger[_0xbaf5('0x15')](_0xbaf5('0x16'),_0x5473ee,_0xbaf5('0x14'),JSON[_0xbaf5('0x17')](_0x35c30f));if(_0x35c30f[_0xbaf5('0x18')]){if(_0x35c30f[_0xbaf5('0x18')][_0xbaf5('0x19')]===0x1f4){logger[_0xbaf5('0x18')](_0xbaf5('0x13'),_0x5473ee,_0x35c30f['error']['message']);return _0x3bf8a3(_0x35c30f[_0xbaf5('0x18')]['message']);}logger['error'](_0xbaf5('0x13'),_0x5473ee,_0x35c30f[_0xbaf5('0x18')][_0xbaf5('0x1a')]);return _0x3ab5a9(_0x35c30f[_0xbaf5('0x18')][_0xbaf5('0x1a')]);}else{logger[_0xbaf5('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x5473ee,_0xbaf5('0x14'));_0x3ab5a9(_0x35c30f[_0xbaf5('0x1b')]['message']);}})[_0xbaf5('0x1c')](function(_0xb2a30e){logger[_0xbaf5('0x18')](_0xbaf5('0x13'),_0x5473ee,_0xb2a30e);_0x3bf8a3(_0xb2a30e);});});}exports[_0xbaf5('0x1d')]=function(_0xb3f3b3){var _0x3037d0=this;return new Promise(function(_0xfd7d07,_0x178c74){return db[_0xbaf5('0x1e')]['findAll']({'raw':_0xb3f3b3[_0xbaf5('0x1f')]?_0xb3f3b3[_0xbaf5('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xb3f3b3[_0xbaf5('0x1f')]?_0xb3f3b3[_0xbaf5('0x1f')][_0xbaf5('0x20')]||null:null,'attributes':_0xb3f3b3[_0xbaf5('0x1f')]?_0xb3f3b3[_0xbaf5('0x1f')][_0xbaf5('0x21')]||null:null,'limit':_0xb3f3b3['options']?_0xb3f3b3[_0xbaf5('0x1f')][_0xbaf5('0x22')]||null:null,'include':_0xb3f3b3[_0xbaf5('0x1f')]?_0xb3f3b3[_0xbaf5('0x1f')][_0xbaf5('0x23')]?_['map'](_0xb3f3b3[_0xbaf5('0x1f')][_0xbaf5('0x23')],function(_0x310742){return{'model':db[_0x310742[_0xbaf5('0x24')]],'as':_0x310742['as'],'attributes':_0x310742['attributes'],'include':_0x310742['include']?_[_0xbaf5('0x25')](_0x310742[_0xbaf5('0x23')],function(_0xb7a003){return{'model':db[_0xb7a003[_0xbaf5('0x24')]],'as':_0xb7a003['as'],'attributes':_0xb7a003['attributes'],'include':_0xb7a003[_0xbaf5('0x23')]?_[_0xbaf5('0x25')](_0xb7a003[_0xbaf5('0x23')],function(_0x71cb5a){return{'model':db[_0x71cb5a[_0xbaf5('0x24')]],'as':_0x71cb5a['as'],'attributes':_0x71cb5a[_0xbaf5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12141b){logger['info'](_0xbaf5('0x1d'),_0xb3f3b3);logger['debug'](_0xbaf5('0x1d'),_0xb3f3b3,JSON[_0xbaf5('0x17')](_0x12141b));_0xfd7d07(_0x12141b);})['catch'](function(_0x516805){logger['error'](_0xbaf5('0x1d'),_0x516805[_0xbaf5('0x1a')],_0xb3f3b3);_0x178c74(_0x3037d0[_0xbaf5('0x18')](0x1f4,_0x516805[_0xbaf5('0x1a')]));});});};exports[_0xbaf5('0x26')]=function(_0x28d611){var _0x17c276=this;return new Promise(function(_0xdce48d,_0x4f288b){return db[_0xbaf5('0x1e')]['find']({'raw':_0x28d611['options']?_0x28d611[_0xbaf5('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x28d611[_0xbaf5('0x1f')]?_0x28d611[_0xbaf5('0x1f')][_0xbaf5('0x20')]||null:null,'attributes':_0x28d611[_0xbaf5('0x1f')]?_0x28d611[_0xbaf5('0x1f')][_0xbaf5('0x21')]||null:null,'include':_0x28d611[_0xbaf5('0x1f')]?_0x28d611[_0xbaf5('0x1f')][_0xbaf5('0x23')]?_[_0xbaf5('0x25')](_0x28d611[_0xbaf5('0x1f')][_0xbaf5('0x23')],function(_0x4ae07e){return{'model':db[_0x4ae07e['model']],'as':_0x4ae07e['as'],'attributes':_0x4ae07e['attributes'],'include':_0x4ae07e['include']?_[_0xbaf5('0x25')](_0x4ae07e[_0xbaf5('0x23')],function(_0x20e6bc){return{'model':db[_0x20e6bc['model']],'as':_0x20e6bc['as'],'attributes':_0x20e6bc[_0xbaf5('0x21')],'include':_0x20e6bc[_0xbaf5('0x23')]?_[_0xbaf5('0x25')](_0x20e6bc['include'],function(_0x19ed44){return{'model':db[_0x19ed44[_0xbaf5('0x24')]],'as':_0x19ed44['as'],'attributes':_0x19ed44[_0xbaf5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbaf5('0x11')](function(_0xe53c19){logger[_0xbaf5('0x12')](_0xbaf5('0x26'),_0x28d611);logger[_0xbaf5('0x15')](_0xbaf5('0x26'),_0x28d611,JSON[_0xbaf5('0x17')](_0xe53c19));_0xdce48d(_0xe53c19);})['catch'](function(_0x5e1830){logger[_0xbaf5('0x18')](_0xbaf5('0x26'),_0x5e1830['message'],_0x28d611);_0x4f288b(_0x17c276[_0xbaf5('0x18')](0x1f4,_0x5e1830[_0xbaf5('0x1a')]));});});}; \ No newline at end of file +var _0x1664=['request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x5d5d45,_0x30beb7){var _0x25978d=function(_0x550311){while(--_0x550311){_0x5d5d45['push'](_0x5d5d45['shift']());}};_0x25978d(++_0x30beb7);}(_0x1664,0xb3));var _0x4166=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x1664[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x4166('0x0'));var util=require(_0x4166('0x1'));var moment=require(_0x4166('0x2'));var BPromise=require(_0x4166('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4166('0x4'))['db'];var utils=require(_0x4166('0x5'));var logger=require(_0x4166('0x6'))('rpc');var config=require(_0x4166('0x7'));var jayson=require(_0x4166('0x8'));var client=jayson[_0x4166('0x9')][_0x4166('0xa')]({'port':0x232a});config[_0x4166('0xb')]=_[_0x4166('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4166('0xd'))(new Redis(config[_0x4166('0xb')]));require(_0x4166('0xe'))[_0x4166('0xf')](socket);function respondWithRpcPromise(_0x276772,_0x536c2b,_0x2ceeb7){return new BPromise(function(_0x5947bf,_0x1e6e0b){return client[_0x4166('0x10')](_0x276772,_0x2ceeb7)[_0x4166('0x11')](function(_0x487f6d){logger[_0x4166('0x12')](_0x4166('0x13'),_0x536c2b,'request\x20sent');logger[_0x4166('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x536c2b,_0x4166('0x15'),JSON[_0x4166('0x16')](_0x487f6d));if(_0x487f6d[_0x4166('0x17')]){if(_0x487f6d[_0x4166('0x17')][_0x4166('0x18')]===0x1f4){logger[_0x4166('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x536c2b,_0x487f6d[_0x4166('0x17')]['message']);return _0x1e6e0b(_0x487f6d['error']['message']);}logger[_0x4166('0x17')](_0x4166('0x13'),_0x536c2b,_0x487f6d[_0x4166('0x17')]['message']);return _0x5947bf(_0x487f6d['error'][_0x4166('0x19')]);}else{logger[_0x4166('0x12')](_0x4166('0x13'),_0x536c2b,'request\x20sent');_0x5947bf(_0x487f6d[_0x4166('0x1a')][_0x4166('0x19')]);}})[_0x4166('0x1b')](function(_0x189dc4){logger[_0x4166('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x536c2b,_0x189dc4);_0x1e6e0b(_0x189dc4);});});}exports[_0x4166('0x1c')]=function(_0x4f45e4){var _0x251817=this;return new Promise(function(_0xb90d0c,_0x307d69){return db[_0x4166('0x1d')][_0x4166('0x1e')]({'raw':_0x4f45e4[_0x4166('0x1f')]?_0x4f45e4[_0x4166('0x1f')][_0x4166('0x20')]===undefined?!![]:![]:!![],'where':_0x4f45e4[_0x4166('0x1f')]?_0x4f45e4[_0x4166('0x1f')][_0x4166('0x21')]||null:null,'attributes':_0x4f45e4[_0x4166('0x1f')]?_0x4f45e4[_0x4166('0x1f')][_0x4166('0x22')]||null:null,'limit':_0x4f45e4[_0x4166('0x1f')]?_0x4f45e4[_0x4166('0x1f')][_0x4166('0x23')]||null:null,'include':_0x4f45e4[_0x4166('0x1f')]?_0x4f45e4[_0x4166('0x1f')][_0x4166('0x24')]?_[_0x4166('0x25')](_0x4f45e4[_0x4166('0x1f')]['include'],function(_0x4fe2ae){return{'model':db[_0x4fe2ae[_0x4166('0x26')]],'as':_0x4fe2ae['as'],'attributes':_0x4fe2ae['attributes'],'include':_0x4fe2ae['include']?_['map'](_0x4fe2ae[_0x4166('0x24')],function(_0x442f73){return{'model':db[_0x442f73[_0x4166('0x26')]],'as':_0x442f73['as'],'attributes':_0x442f73['attributes'],'include':_0x442f73[_0x4166('0x24')]?_[_0x4166('0x25')](_0x442f73[_0x4166('0x24')],function(_0x1e9859){return{'model':db[_0x1e9859[_0x4166('0x26')]],'as':_0x1e9859['as'],'attributes':_0x1e9859[_0x4166('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1de9cf){logger[_0x4166('0x12')](_0x4166('0x1c'),_0x4f45e4);logger[_0x4166('0x14')]('GetOpenchannelQueue',_0x4f45e4,JSON[_0x4166('0x16')](_0x1de9cf));_0xb90d0c(_0x1de9cf);})[_0x4166('0x1b')](function(_0x44c8d0){logger['error'](_0x4166('0x1c'),_0x44c8d0[_0x4166('0x19')],_0x4f45e4);_0x307d69(_0x251817['error'](0x1f4,_0x44c8d0[_0x4166('0x19')]));});});};exports[_0x4166('0x27')]=function(_0x2d5923){var _0xdb71e5=this;return new Promise(function(_0x541f21,_0x5dd5b9){return db['OpenchannelQueue']['find']({'raw':_0x2d5923['options']?_0x2d5923[_0x4166('0x1f')][_0x4166('0x20')]===undefined?!![]:![]:!![],'where':_0x2d5923[_0x4166('0x1f')]?_0x2d5923[_0x4166('0x1f')][_0x4166('0x21')]||null:null,'attributes':_0x2d5923[_0x4166('0x1f')]?_0x2d5923[_0x4166('0x1f')]['attributes']||null:null,'include':_0x2d5923[_0x4166('0x1f')]?_0x2d5923[_0x4166('0x1f')][_0x4166('0x24')]?_[_0x4166('0x25')](_0x2d5923['options'][_0x4166('0x24')],function(_0x1cdc4a){return{'model':db[_0x1cdc4a[_0x4166('0x26')]],'as':_0x1cdc4a['as'],'attributes':_0x1cdc4a['attributes'],'include':_0x1cdc4a['include']?_[_0x4166('0x25')](_0x1cdc4a[_0x4166('0x24')],function(_0x1fdd93){return{'model':db[_0x1fdd93[_0x4166('0x26')]],'as':_0x1fdd93['as'],'attributes':_0x1fdd93[_0x4166('0x22')],'include':_0x1fdd93[_0x4166('0x24')]?_[_0x4166('0x25')](_0x1fdd93[_0x4166('0x24')],function(_0x1dc4c7){return{'model':db[_0x1dc4c7['model']],'as':_0x1dc4c7['as'],'attributes':_0x1dc4c7[_0x4166('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4166('0x11')](function(_0x34df73){logger[_0x4166('0x12')](_0x4166('0x27'),_0x2d5923);logger[_0x4166('0x14')](_0x4166('0x27'),_0x2d5923,JSON[_0x4166('0x16')](_0x34df73));_0x541f21(_0x34df73);})[_0x4166('0x1b')](function(_0x1f96ec){logger[_0x4166('0x17')]('ShowOpenchannelQueue',_0x1f96ec[_0x4166('0x19')],_0x2d5923);_0x5dd5b9(_0xdb71e5[_0x4166('0x17')](0x1f4,_0x1f96ec[_0x4166('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0ab9986..18634fb 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 _0x6cc2=['removeListener','register','openchannelQueue:','./openchannelQueue.events','emit'];(function(_0x1780ec,_0x3af2fa){var _0x5c5663=function(_0x23eac9){while(--_0x23eac9){_0x1780ec['push'](_0x1780ec['shift']());}};_0x5c5663(++_0x3af2fa);}(_0x6cc2,0xc6));var _0x26cc=function(_0x322a37,_0x227f87){_0x322a37=_0x322a37-0x0;var _0x524fd7=_0x6cc2[_0x322a37];return _0x524fd7;};'use strict';var OpenchannelQueueEvents=require(_0x26cc('0x0'));var events=['save','remove','update'];function createListener(_0x52541c,_0x2bf1a6){return function(_0x40d6e3){_0x2bf1a6[_0x26cc('0x1')](_0x52541c,_0x40d6e3);};}function removeListener(_0x2df057,_0x24187c){return function(){OpenchannelQueueEvents[_0x26cc('0x2')](_0x2df057,_0x24187c);};}exports[_0x26cc('0x3')]=function(_0x4c577a){for(var _0x5b7b5e=0x0,_0x1ad534=events['length'];_0x5b7b5e<_0x1ad534;_0x5b7b5e++){var _0x3be925=events[_0x5b7b5e];var _0x1a9b23=createListener(_0x26cc('0x4')+_0x3be925,_0x4c577a);OpenchannelQueueEvents['on'](_0x3be925,_0x1a9b23);}}; \ No newline at end of file +var _0xdba6=['register','openchannelQueue:','./openchannelQueue.events','save','emit','removeListener'];(function(_0x3f1394,_0x1336fd){var _0x4477e8=function(_0x67dde0){while(--_0x67dde0){_0x3f1394['push'](_0x3f1394['shift']());}};_0x4477e8(++_0x1336fd);}(_0xdba6,0x134));var _0x6dba=function(_0x93036a,_0x370bf1){_0x93036a=_0x93036a-0x0;var _0x2e6dcb=_0xdba6[_0x93036a];return _0x2e6dcb;};'use strict';var OpenchannelQueueEvents=require(_0x6dba('0x0'));var events=[_0x6dba('0x1'),'remove','update'];function createListener(_0x36d7bf,_0x181735){return function(_0x300ced){_0x181735[_0x6dba('0x2')](_0x36d7bf,_0x300ced);};}function removeListener(_0x210d34,_0xe5fd8d){return function(){OpenchannelQueueEvents[_0x6dba('0x3')](_0x210d34,_0xe5fd8d);};}exports[_0x6dba('0x4')]=function(_0x4479d9){for(var _0x5aa68e=0x0,_0x122995=events['length'];_0x5aa68e<_0x122995;_0x5aa68e++){var _0x50b237=events[_0x5aa68e];var _0x4cff08=createListener(_0x6dba('0x5')+_0x50b237,_0x4479d9);OpenchannelQueueEvents['on'](_0x50b237,_0x4cff08);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index eb17291..4c5019c 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 _0xd8fd=['/describe','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','isAuthenticated'];(function(_0x52eb16,_0x89c3d8){var _0x382d3f=function(_0x378238){while(--_0x378238){_0x52eb16['push'](_0x52eb16['shift']());}};_0x382d3f(++_0x89c3d8);}(_0xd8fd,0x70));var _0xdd8f=function(_0x4c21ee,_0x217ce3){_0x4c21ee=_0x4c21ee-0x0;var _0x34e9dc=_0xd8fd[_0x4c21ee];return _0x34e9dc;};'use strict';var multer=require(_0xdd8f('0x0'));var util=require(_0xdd8f('0x1'));var path=require(_0xdd8f('0x2'));var timeout=require(_0xdd8f('0x3'));var express=require('express');var router=express[_0xdd8f('0x4')]();var auth=require(_0xdd8f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xdd8f('0x6')](),controller['index']);router['get'](_0xdd8f('0x7'),auth[_0xdd8f('0x6')](),controller['describe']);router[_0xdd8f('0x8')](_0xdd8f('0x9'),auth[_0xdd8f('0x6')](),controller[_0xdd8f('0xa')]);router[_0xdd8f('0xb')]('/',auth[_0xdd8f('0x6')](),controller[_0xdd8f('0xc')]);router[_0xdd8f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xdd8f('0xe')]);router[_0xdd8f('0xf')](_0xdd8f('0x9'),auth[_0xdd8f('0x6')](),controller['destroy']);module[_0xdd8f('0x10')]=router; \ No newline at end of file +var _0x88ba=['./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x403859,_0x3794b7){var _0xaeeb1c=function(_0x34dcb9){while(--_0x34dcb9){_0x403859['push'](_0x403859['shift']());}};_0xaeeb1c(++_0x3794b7);}(_0x88ba,0xca));var _0xa88b=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x88ba[_0x2e913b];return _0x173899;};'use strict';var multer=require(_0xa88b('0x0'));var util=require(_0xa88b('0x1'));var path=require(_0xa88b('0x2'));var timeout=require(_0xa88b('0x3'));var express=require('express');var router=express[_0xa88b('0x4')]();var auth=require(_0xa88b('0x5'));var interaction=require(_0xa88b('0x6'));var config=require('../../config/environment');var controller=require(_0xa88b('0x7'));router[_0xa88b('0x8')]('/',auth[_0xa88b('0x9')](),controller['index']);router[_0xa88b('0x8')](_0xa88b('0xa'),auth[_0xa88b('0x9')](),controller[_0xa88b('0xb')]);router[_0xa88b('0x8')]('/:id',auth[_0xa88b('0x9')](),controller[_0xa88b('0xc')]);router[_0xa88b('0xd')]('/',auth[_0xa88b('0x9')](),controller[_0xa88b('0xe')]);router['put'](_0xa88b('0xf'),auth[_0xa88b('0x9')](),controller[_0xa88b('0x10')]);router[_0xa88b('0x11')]('/:id',auth[_0xa88b('0x9')](),controller[_0xa88b('0x12')]);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 65c3d0a..4526c68 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 _0x1d84=['STRING','DATE','moment','sequelize','exports'];(function(_0x31f6e3,_0x55e2fe){var _0x9f529e=function(_0x50fff1){while(--_0x50fff1){_0x31f6e3['push'](_0x31f6e3['shift']());}};_0x9f529e(++_0x55e2fe);}(_0x1d84,0x6b));var _0x41d8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1d84[_0x2c7618];return _0x5ce3f0;};'use strict';var moment=require(_0x41d8('0x0'));var Sequelize=require(_0x41d8('0x1'));module[_0x41d8('0x2')]={'uniqueid':{'type':Sequelize[_0x41d8('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x41d8('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x41d8('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f33=['DATE','STRING','moment'];(function(_0x98b6c2,_0x5560ab){var _0x171d03=function(_0x1aabab){while(--_0x1aabab){_0x98b6c2['push'](_0x98b6c2['shift']());}};_0x171d03(++_0x5560ab);}(_0x1f33,0x107));var _0x31f3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1f33[_0x2c7618];return _0x5ce3f0;};'use strict';var moment=require(_0x31f3('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x31f3('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x31f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 343a57a..26b7ea1 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 _0xd240=['fieldName','type','key','model','map','query','keys','intersection','attributes','length','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','OpenchannelQueueReport','rawAttributes'];(function(_0x5c9cfd,_0x3468a0){var _0x18021a=function(_0x3b6934){while(--_0x3b6934){_0x5c9cfd['push'](_0x5c9cfd['shift']());}};_0x18021a(++_0x3468a0);}(_0xd240,0x1c7));var _0x0d24=function(_0x1a1f19,_0x2d656f){_0x1a1f19=_0x1a1f19-0x0;var _0x3a4c0c=_0xd240[_0x1a1f19];return _0x3a4c0c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d24('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0d24('0x1'));var rp=require(_0x0d24('0x2'));var moment=require(_0x0d24('0x3'));var BPromise=require(_0x0d24('0x4'));var Mustache=require(_0x0d24('0x5'));var util=require(_0x0d24('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d24('0x7'));var ejs=require(_0x0d24('0x8'));var fs=require('fs');var _=require(_0x0d24('0x9'));var squel=require(_0x0d24('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d24('0xb'));var deskjs=require(_0x0d24('0xc'));var toCsv=require(_0x0d24('0x7'));var querystring=require(_0x0d24('0xd'));var Papa=require(_0x0d24('0xe'));var Redis=require(_0x0d24('0xf'));var authService=require(_0x0d24('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0d24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d24('0x12'))('api');var utils=require(_0x0d24('0x13'));var config=require(_0x0d24('0x14'));var licenseUtil=require(_0x0d24('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560ea5,_0x29f892){_0x29f892=_0x29f892||0xcc;return function(_0x1b6f50){if(_0x1b6f50){return _0x560ea5[_0x0d24('0x16')](_0x29f892);}return _0x560ea5['status'](_0x29f892)[_0x0d24('0x17')]();};}function respondWithResult(_0x106fb7,_0x58ac0d){_0x58ac0d=_0x58ac0d||0xc8;return function(_0x4d24b5){if(_0x4d24b5){return _0x106fb7[_0x0d24('0x18')](_0x58ac0d)[_0x0d24('0x19')](_0x4d24b5);}};}function respondWithFilteredResult(_0xb70f7e,_0x175841){return function(_0xd9a534){if(_0xd9a534){var _0x6ec239=_0xd9a534[_0x0d24('0x1a')],_0xf188c9=_0x175841[_0x0d24('0x1b')],_0x240f86=_0x175841['offset']+_0x175841[_0x0d24('0x1c')],_0x47ee4b;if(_0x240f86>=_0x6ec239){_0x240f86=_0x6ec239;_0x47ee4b=0xc8;}else{_0x47ee4b=0xce;}_0xb70f7e[_0x0d24('0x18')](_0x47ee4b);return _0xb70f7e[_0x0d24('0x1d')](_0x0d24('0x1e'),_0xf188c9+'-'+_0x240f86+'/'+_0x6ec239)['json'](_0xd9a534);}return null;};}function patchUpdates(_0x3bebf7){return function(_0x244281){try{jsonpatch['apply'](_0x244281,_0x3bebf7,!![]);}catch(_0x583b82){return BPromise[_0x0d24('0x1f')](_0x583b82);}return _0x244281[_0x0d24('0x20')]();};}function saveUpdates(_0x3af97e,_0x2f611b){return function(_0x30e520){if(_0x30e520){return _0x30e520[_0x0d24('0x21')](_0x3af97e)[_0x0d24('0x22')](function(_0xc9cd70){return _0xc9cd70;});}return null;};}function removeEntity(_0x2dc0cf,_0x5df68d){return function(_0x2499e1){if(_0x2499e1){return _0x2499e1[_0x0d24('0x23')]()[_0x0d24('0x22')](function(){_0x2dc0cf[_0x0d24('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23440c,_0x3cd88f){return function(_0x367028){if(!_0x367028){_0x23440c['sendStatus'](0x194);}return _0x367028;};}function handleError(_0xc5e565,_0x1842ab){_0x1842ab=_0x1842ab||0x1f4;return function(_0x425dd2){logger['error'](_0x425dd2[_0x0d24('0x24')]);if(_0x425dd2[_0x0d24('0x25')]){delete _0x425dd2[_0x0d24('0x25')];}_0xc5e565['status'](_0x1842ab)[_0x0d24('0x26')](_0x425dd2);};}exports[_0x0d24('0x27')]=function(_0x36a3f1,_0xbbd797){var _0x2b472a={},_0x212364={},_0x50c2ad={'count':0x0,'rows':[]};var _0x4f043f=_['map'](db[_0x0d24('0x28')][_0x0d24('0x29')],function(_0x1a1ef7){return{'name':_0x1a1ef7[_0x0d24('0x2a')],'type':_0x1a1ef7[_0x0d24('0x2b')][_0x0d24('0x2c')]};});_0x212364[_0x0d24('0x2d')]=_[_0x0d24('0x2e')](_0x4f043f,_0x0d24('0x25'));_0x212364[_0x0d24('0x2f')]=_[_0x0d24('0x30')](_0x36a3f1['query']);_0x212364['filters']=_[_0x0d24('0x31')](_0x212364['model'],_0x212364['query']);_0x2b472a[_0x0d24('0x32')]=_[_0x0d24('0x31')](_0x212364[_0x0d24('0x2d')],qs['fields'](_0x36a3f1[_0x0d24('0x2f')]['fields']));_0x2b472a[_0x0d24('0x32')]=_0x2b472a[_0x0d24('0x32')][_0x0d24('0x33')]?_0x2b472a[_0x0d24('0x32')]:_0x212364[_0x0d24('0x2d')];if(!_0x36a3f1['query']['hasOwnProperty'](_0x0d24('0x34'))){_0x2b472a[_0x0d24('0x1c')]=qs[_0x0d24('0x1c')](_0x36a3f1[_0x0d24('0x2f')][_0x0d24('0x1c')]);_0x2b472a[_0x0d24('0x1b')]=qs['offset'](_0x36a3f1[_0x0d24('0x2f')][_0x0d24('0x1b')]);}_0x2b472a['order']=qs[_0x0d24('0x35')](_0x36a3f1[_0x0d24('0x2f')]['sort']);_0x2b472a[_0x0d24('0x36')]=qs[_0x0d24('0x37')](_[_0x0d24('0x38')](_0x36a3f1['query'],_0x212364[_0x0d24('0x37')]),_0x4f043f);if(_0x36a3f1[_0x0d24('0x2f')][_0x0d24('0x39')]){_0x2b472a[_0x0d24('0x36')]=_['merge'](_0x2b472a['where'],{'$or':_[_0x0d24('0x2e')](_0x4f043f,function(_0x4b9617){if(_0x4b9617['type']!=='VIRTUAL'){var _0x238b99={};_0x238b99[_0x4b9617['name']]={'$like':'%'+_0x36a3f1[_0x0d24('0x2f')][_0x0d24('0x39')]+'%'};return _0x238b99;}})});}_0x2b472a=_[_0x0d24('0x3a')]({},_0x2b472a,_0x36a3f1[_0x0d24('0x3b')]);var _0x274ed6={'where':_0x2b472a[_0x0d24('0x36')]};return db[_0x0d24('0x28')][_0x0d24('0x1a')](_0x274ed6)[_0x0d24('0x22')](function(_0x4f6362){_0x50c2ad[_0x0d24('0x1a')]=_0x4f6362;if(_0x36a3f1['query']['includeAll']){_0x2b472a[_0x0d24('0x3c')]=[{'all':!![]}];}return db[_0x0d24('0x28')][_0x0d24('0x3d')](_0x2b472a);})[_0x0d24('0x22')](function(_0xe5edf9){_0x50c2ad[_0x0d24('0x3e')]=_0xe5edf9;return _0x50c2ad;})[_0x0d24('0x22')](respondWithFilteredResult(_0xbbd797,_0x2b472a))[_0x0d24('0x3f')](handleError(_0xbbd797,null));};exports[_0x0d24('0x40')]=function(_0x14e951,_0x2c5549){var _0x548fee={'raw':!![],'where':{'id':_0x14e951[_0x0d24('0x41')]['id']}},_0x2c9d4e={};_0x2c9d4e['model']=_[_0x0d24('0x30')](db[_0x0d24('0x28')][_0x0d24('0x29')]);_0x2c9d4e[_0x0d24('0x2f')]=_[_0x0d24('0x30')](_0x14e951['query']);_0x2c9d4e[_0x0d24('0x37')]=_['intersection'](_0x2c9d4e[_0x0d24('0x2d')],_0x2c9d4e[_0x0d24('0x2f')]);_0x548fee['attributes']=_[_0x0d24('0x31')](_0x2c9d4e[_0x0d24('0x2d')],qs['fields'](_0x14e951['query']['fields']));_0x548fee[_0x0d24('0x32')]=_0x548fee[_0x0d24('0x32')][_0x0d24('0x33')]?_0x548fee[_0x0d24('0x32')]:_0x2c9d4e[_0x0d24('0x2d')];if(_0x14e951['query'][_0x0d24('0x42')]){_0x548fee[_0x0d24('0x3c')]=[{'all':!![]}];}_0x548fee=_['merge']({},_0x548fee,_0x14e951[_0x0d24('0x3b')]);return db['OpenchannelQueueReport'][_0x0d24('0x43')](_0x548fee)[_0x0d24('0x22')](handleEntityNotFound(_0x2c5549,null))['then'](respondWithResult(_0x2c5549,null))[_0x0d24('0x3f')](handleError(_0x2c5549,null));};exports[_0x0d24('0x44')]=function(_0x1da5a1,_0x4673c){return db[_0x0d24('0x28')][_0x0d24('0x44')](_0x1da5a1[_0x0d24('0x45')],{})[_0x0d24('0x22')](respondWithResult(_0x4673c,0xc9))[_0x0d24('0x3f')](handleError(_0x4673c,null));};exports[_0x0d24('0x21')]=function(_0x149ea2,_0x316258){if(_0x149ea2['body']['id']){delete _0x149ea2[_0x0d24('0x45')]['id'];}return db[_0x0d24('0x28')][_0x0d24('0x43')]({'where':{'id':_0x149ea2[_0x0d24('0x41')]['id']}})[_0x0d24('0x22')](handleEntityNotFound(_0x316258,null))[_0x0d24('0x22')](saveUpdates(_0x149ea2[_0x0d24('0x45')],null))['then'](respondWithResult(_0x316258,null))['catch'](handleError(_0x316258,null));};exports[_0x0d24('0x23')]=function(_0x2c3647,_0x8a5846){return db[_0x0d24('0x28')]['find']({'where':{'id':_0x2c3647[_0x0d24('0x41')]['id']}})[_0x0d24('0x22')](handleEntityNotFound(_0x8a5846,null))[_0x0d24('0x22')](removeEntity(_0x8a5846,null))['catch'](handleError(_0x8a5846,null));};exports[_0x0d24('0x46')]=function(_0x14dcb3,_0x27bb96){return db[_0x0d24('0x28')][_0x0d24('0x46')]()[_0x0d24('0x22')](respondWithResult(_0x27bb96,null))[_0x0d24('0x3f')](handleError(_0x27bb96,null));}; \ No newline at end of file +var _0x303a=['destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','include','rows','params','catch','create','body','find'];(function(_0x237ffb,_0x568db7){var _0x2141ca=function(_0x568f13){while(--_0x568f13){_0x237ffb['push'](_0x237ffb['shift']());}};_0x2141ca(++_0x568db7);}(_0x303a,0x1a0));var _0xa303=function(_0x288d33,_0x58ee36){_0x288d33=_0x288d33-0x0;var _0x1033bd=_0x303a[_0x288d33];return _0x1033bd;};'use strict';var pdf=require(_0xa303('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa303('0x1'));var zipdir=require(_0xa303('0x2'));var jsonpatch=require(_0xa303('0x3'));var rp=require(_0xa303('0x4'));var moment=require('moment');var BPromise=require(_0xa303('0x5'));var Mustache=require(_0xa303('0x6'));var util=require(_0xa303('0x7'));var path=require(_0xa303('0x8'));var sox=require(_0xa303('0x9'));var csv=require(_0xa303('0xa'));var ejs=require(_0xa303('0xb'));var fs=require('fs');var _=require(_0xa303('0xc'));var squel=require(_0xa303('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa303('0xa'));var querystring=require(_0xa303('0xe'));var Papa=require('papaparse');var Redis=require(_0xa303('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa303('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa303('0x11'));var logger=require(_0xa303('0x12'))(_0xa303('0x13'));var utils=require(_0xa303('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa303('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf5df1e,_0x43a054){_0x43a054=_0x43a054||0xcc;return function(_0x2ed971){if(_0x2ed971){return _0xf5df1e['sendStatus'](_0x43a054);}return _0xf5df1e[_0xa303('0x16')](_0x43a054)[_0xa303('0x17')]();};}function respondWithResult(_0x28cd7f,_0xfa522c){_0xfa522c=_0xfa522c||0xc8;return function(_0xed0420){if(_0xed0420){return _0x28cd7f[_0xa303('0x16')](_0xfa522c)[_0xa303('0x18')](_0xed0420);}};}function respondWithFilteredResult(_0x2d1110,_0x4c8bc1){return function(_0x2c2939){if(_0x2c2939){var _0xd2e8ee=_0x2c2939[_0xa303('0x19')],_0x1f3ede=_0x4c8bc1['offset'],_0x288596=_0x4c8bc1[_0xa303('0x1a')]+_0x4c8bc1['limit'],_0x3e2813;if(_0x288596>=_0xd2e8ee){_0x288596=_0xd2e8ee;_0x3e2813=0xc8;}else{_0x3e2813=0xce;}_0x2d1110[_0xa303('0x16')](_0x3e2813);return _0x2d1110['set'](_0xa303('0x1b'),_0x1f3ede+'-'+_0x288596+'/'+_0xd2e8ee)['json'](_0x2c2939);}return null;};}function patchUpdates(_0x419575){return function(_0xe263f9){try{jsonpatch[_0xa303('0x1c')](_0xe263f9,_0x419575,!![]);}catch(_0x4bbec6){return BPromise[_0xa303('0x1d')](_0x4bbec6);}return _0xe263f9[_0xa303('0x1e')]();};}function saveUpdates(_0x1b0566,_0x59e551){return function(_0x282e25){if(_0x282e25){return _0x282e25[_0xa303('0x1f')](_0x1b0566)[_0xa303('0x20')](function(_0x904261){return _0x904261;});}return null;};}function removeEntity(_0x54b173,_0x14f9ab){return function(_0x2a2512){if(_0x2a2512){return _0x2a2512['destroy']()[_0xa303('0x20')](function(){_0x54b173[_0xa303('0x16')](0xcc)[_0xa303('0x17')]();});}};}function handleEntityNotFound(_0x122d1e,_0x65ab0e){return function(_0x577ea7){if(!_0x577ea7){_0x122d1e[_0xa303('0x21')](0x194);}return _0x577ea7;};}function handleError(_0x5d9dee,_0x35d287){_0x35d287=_0x35d287||0x1f4;return function(_0x57d584){logger['error'](_0x57d584['stack']);if(_0x57d584['name']){delete _0x57d584['name'];}_0x5d9dee[_0xa303('0x16')](_0x35d287)[_0xa303('0x22')](_0x57d584);};}exports[_0xa303('0x23')]=function(_0xbb93f0,_0x94d3e4){var _0x48e79f={},_0x2d1341={},_0xb35c22={'count':0x0,'rows':[]};var _0x561d73=_[_0xa303('0x24')](db[_0xa303('0x25')][_0xa303('0x26')],function(_0x32dcfb){return{'name':_0x32dcfb[_0xa303('0x27')],'type':_0x32dcfb[_0xa303('0x28')][_0xa303('0x29')]};});_0x2d1341[_0xa303('0x2a')]=_[_0xa303('0x24')](_0x561d73,_0xa303('0x2b'));_0x2d1341[_0xa303('0x2c')]=_[_0xa303('0x2d')](_0xbb93f0[_0xa303('0x2c')]);_0x2d1341[_0xa303('0x2e')]=_[_0xa303('0x2f')](_0x2d1341[_0xa303('0x2a')],_0x2d1341[_0xa303('0x2c')]);_0x48e79f['attributes']=_['intersection'](_0x2d1341[_0xa303('0x2a')],qs[_0xa303('0x30')](_0xbb93f0[_0xa303('0x2c')][_0xa303('0x30')]));_0x48e79f['attributes']=_0x48e79f[_0xa303('0x31')][_0xa303('0x32')]?_0x48e79f[_0xa303('0x31')]:_0x2d1341[_0xa303('0x2a')];if(!_0xbb93f0['query'][_0xa303('0x33')](_0xa303('0x34'))){_0x48e79f[_0xa303('0x35')]=qs['limit'](_0xbb93f0[_0xa303('0x2c')][_0xa303('0x35')]);_0x48e79f[_0xa303('0x1a')]=qs['offset'](_0xbb93f0[_0xa303('0x2c')][_0xa303('0x1a')]);}_0x48e79f[_0xa303('0x36')]=qs['sort'](_0xbb93f0[_0xa303('0x2c')][_0xa303('0x37')]);_0x48e79f[_0xa303('0x38')]=qs[_0xa303('0x2e')](_['pick'](_0xbb93f0[_0xa303('0x2c')],_0x2d1341[_0xa303('0x2e')]),_0x561d73);if(_0xbb93f0[_0xa303('0x2c')][_0xa303('0x39')]){_0x48e79f['where']=_[_0xa303('0x3a')](_0x48e79f[_0xa303('0x38')],{'$or':_[_0xa303('0x24')](_0x561d73,function(_0x16c680){if(_0x16c680[_0xa303('0x28')]!=='VIRTUAL'){var _0x5db393={};_0x5db393[_0x16c680[_0xa303('0x2b')]]={'$like':'%'+_0xbb93f0[_0xa303('0x2c')][_0xa303('0x39')]+'%'};return _0x5db393;}})});}_0x48e79f=_['merge']({},_0x48e79f,_0xbb93f0['options']);var _0x898020={'where':_0x48e79f[_0xa303('0x38')]};return db[_0xa303('0x25')][_0xa303('0x19')](_0x898020)['then'](function(_0x59e413){_0xb35c22[_0xa303('0x19')]=_0x59e413;if(_0xbb93f0[_0xa303('0x2c')][_0xa303('0x3b')]){_0x48e79f[_0xa303('0x3c')]=[{'all':!![]}];}return db[_0xa303('0x25')]['findAll'](_0x48e79f);})[_0xa303('0x20')](function(_0x20dae6){_0xb35c22[_0xa303('0x3d')]=_0x20dae6;return _0xb35c22;})[_0xa303('0x20')](respondWithFilteredResult(_0x94d3e4,_0x48e79f))['catch'](handleError(_0x94d3e4,null));};exports['show']=function(_0x581d50,_0x1805f6){var _0x253220={'raw':!![],'where':{'id':_0x581d50[_0xa303('0x3e')]['id']}},_0x3aece5={};_0x3aece5[_0xa303('0x2a')]=_[_0xa303('0x2d')](db[_0xa303('0x25')][_0xa303('0x26')]);_0x3aece5[_0xa303('0x2c')]=_[_0xa303('0x2d')](_0x581d50[_0xa303('0x2c')]);_0x3aece5['filters']=_['intersection'](_0x3aece5[_0xa303('0x2a')],_0x3aece5['query']);_0x253220[_0xa303('0x31')]=_['intersection'](_0x3aece5[_0xa303('0x2a')],qs[_0xa303('0x30')](_0x581d50[_0xa303('0x2c')][_0xa303('0x30')]));_0x253220[_0xa303('0x31')]=_0x253220[_0xa303('0x31')][_0xa303('0x32')]?_0x253220[_0xa303('0x31')]:_0x3aece5[_0xa303('0x2a')];if(_0x581d50[_0xa303('0x2c')][_0xa303('0x3b')]){_0x253220[_0xa303('0x3c')]=[{'all':!![]}];}_0x253220=_[_0xa303('0x3a')]({},_0x253220,_0x581d50['options']);return db[_0xa303('0x25')]['find'](_0x253220)[_0xa303('0x20')](handleEntityNotFound(_0x1805f6,null))[_0xa303('0x20')](respondWithResult(_0x1805f6,null))[_0xa303('0x3f')](handleError(_0x1805f6,null));};exports['create']=function(_0x5f3bc0,_0x9240e1){return db[_0xa303('0x25')][_0xa303('0x40')](_0x5f3bc0[_0xa303('0x41')],{})[_0xa303('0x20')](respondWithResult(_0x9240e1,0xc9))[_0xa303('0x3f')](handleError(_0x9240e1,null));};exports[_0xa303('0x1f')]=function(_0x3572e1,_0x473db1){if(_0x3572e1[_0xa303('0x41')]['id']){delete _0x3572e1['body']['id'];}return db[_0xa303('0x25')][_0xa303('0x42')]({'where':{'id':_0x3572e1['params']['id']}})[_0xa303('0x20')](handleEntityNotFound(_0x473db1,null))['then'](saveUpdates(_0x3572e1[_0xa303('0x41')],null))[_0xa303('0x20')](respondWithResult(_0x473db1,null))[_0xa303('0x3f')](handleError(_0x473db1,null));};exports[_0xa303('0x43')]=function(_0x5a6da0,_0x2edaeb){return db[_0xa303('0x25')][_0xa303('0x42')]({'where':{'id':_0x5a6da0[_0xa303('0x3e')]['id']}})[_0xa303('0x20')](handleEntityNotFound(_0x2edaeb,null))[_0xa303('0x20')](removeEntity(_0x2edaeb,null))['catch'](handleError(_0x2edaeb,null));};exports[_0xa303('0x44')]=function(_0x3b584e,_0xfc75fa){return db[_0xa303('0x25')]['describe']()['then'](respondWithResult(_0xfc75fa,null))[_0xa303('0x3f')](handleError(_0xfc75fa,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a11da93..df1727d 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 _0xd13e=['path','../../config/environment','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0xd13e,0x193));var _0xed13=function(_0x2e3420,_0x293a33){_0x2e3420=_0x2e3420-0x0;var _0x49e21a=_0xd13e[_0x2e3420];return _0x49e21a;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var logger=require(_0xed13('0x2'))(_0xed13('0x3'));var moment=require('moment');var BPromise=require(_0xed13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed13('0x5'));var rimraf=require('rimraf');var config=require(_0xed13('0x6'));var attributes=require(_0xed13('0x7'));module['exports']=function(_0x50de44,_0x5142bd){return _0x50de44[_0xed13('0x8')](_0xed13('0x9'),attributes,{'tableName':_0xed13('0xa'),'paranoid':![],'indexes':[{'name':_0xed13('0xb'),'fields':[_0xed13('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b75=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelQueueReport.attributes','exports','report_openchannel_queue','uniqueid'];(function(_0x2f2d46,_0x389f36){var _0x151b03=function(_0x5d0c3b){while(--_0x5d0c3b){_0x2f2d46['push'](_0x2f2d46['shift']());}};_0x151b03(++_0x389f36);}(_0x3b75,0x144));var _0x53b7=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0x3b75[_0x9b7a64];return _0x33fd98;};'use strict';var _=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var logger=require(_0x53b7('0x2'))(_0x53b7('0x3'));var moment=require(_0x53b7('0x4'));var BPromise=require(_0x53b7('0x5'));var rp=require(_0x53b7('0x6'));var fs=require('fs');var path=require(_0x53b7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53b7('0x8'));module[_0x53b7('0x9')]=function(_0x3bfde3,_0x46f651){return _0x3bfde3['define']('OpenchannelQueueReport',attributes,{'tableName':_0x53b7('0xa'),'paranoid':![],'indexes':[{'name':_0x53b7('0xb'),'fields':[_0x53b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 4c05185..28e2dbb 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 _0x8965=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','OpenchannelQueueReport','create','body','options','then','CreateOpenchannelQueueReport','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1a2780,_0x3ac28a){var _0x56719d=function(_0x13bc3f){while(--_0x13bc3f){_0x1a2780['push'](_0x1a2780['shift']());}};_0x56719d(++_0x3ac28a);}(_0x8965,0x1bb));var _0x5896=function(_0x4f3763,_0x32a15f){_0x4f3763=_0x4f3763-0x0;var _0x3c60b6=_0x8965[_0x4f3763];return _0x3c60b6;};'use strict';var _=require(_0x5896('0x0'));var util=require('util');var moment=require(_0x5896('0x1'));var BPromise=require(_0x5896('0x2'));var rs=require(_0x5896('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5896('0x4'))['db'];var utils=require(_0x5896('0x5'));var logger=require(_0x5896('0x6'))(_0x5896('0x7'));var config=require(_0x5896('0x8'));var jayson=require(_0x5896('0x9'));var client=jayson[_0x5896('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x89ff6d,_0x20c90e,_0x50db42){return new BPromise(function(_0x4bbc49,_0x338ab3){return client['request'](_0x89ff6d,_0x50db42)['then'](function(_0x3b859a){logger['info'](_0x5896('0xb'),_0x20c90e,'request\x20sent');logger[_0x5896('0xc')](_0x5896('0xd'),_0x20c90e,_0x5896('0xe'),JSON[_0x5896('0xf')](_0x3b859a));if(_0x3b859a[_0x5896('0x10')]){if(_0x3b859a['error']['code']===0x1f4){logger[_0x5896('0x10')](_0x5896('0xb'),_0x20c90e,_0x3b859a[_0x5896('0x10')]['message']);return _0x338ab3(_0x3b859a['error'][_0x5896('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x20c90e,_0x3b859a[_0x5896('0x10')]['message']);return _0x4bbc49(_0x3b859a['error'][_0x5896('0x11')]);}else{logger[_0x5896('0x12')](_0x5896('0xb'),_0x20c90e,_0x5896('0xe'));_0x4bbc49(_0x3b859a['result'][_0x5896('0x11')]);}})[_0x5896('0x13')](function(_0x37a14e){logger[_0x5896('0x10')](_0x5896('0xb'),_0x20c90e,_0x37a14e);_0x338ab3(_0x37a14e);});});}exports['CreateOpenchannelQueueReport']=function(_0xb9b1a1){var _0x53e8a1=this;return new Promise(function(_0x201024,_0xce014d){return db[_0x5896('0x14')][_0x5896('0x15')](_0xb9b1a1[_0x5896('0x16')],{'raw':_0xb9b1a1[_0x5896('0x17')]?_0xb9b1a1[_0x5896('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x5896('0x18')](function(_0xe29489){logger['info'](_0x5896('0x19'),_0xb9b1a1);logger[_0x5896('0xc')](_0x5896('0x19'),_0xb9b1a1,JSON[_0x5896('0xf')](_0xe29489));_0x201024(_0xe29489);})[_0x5896('0x13')](function(_0x985d0e){logger[_0x5896('0x10')](_0x5896('0x19'),_0x985d0e['message'],_0xb9b1a1);_0xce014d(_0x53e8a1['error'](0x1f4,_0x985d0e[_0x5896('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x4f5891){var _0x53658f=this;return new Promise(function(_0x88b016,_0x517e06){return db[_0x5896('0x14')][_0x5896('0x1a')](_0x4f5891[_0x5896('0x16')],{'raw':_0x4f5891[_0x5896('0x17')]?_0x4f5891['options'][_0x5896('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f5891[_0x5896('0x17')]?_0x4f5891['options'][_0x5896('0x1c')]||null:null,'attributes':_0x4f5891['options']?_0x4f5891[_0x5896('0x17')][_0x5896('0x1d')]||null:null,'limit':_0x4f5891[_0x5896('0x17')]?_0x4f5891[_0x5896('0x17')][_0x5896('0x1e')]||null:null})[_0x5896('0x18')](function(_0x14a0b5){logger['info'](_0x5896('0x1f'),_0x4f5891);logger[_0x5896('0xc')](_0x5896('0x1f'),_0x4f5891,JSON[_0x5896('0xf')](_0x14a0b5));_0x88b016(_0x14a0b5);})[_0x5896('0x13')](function(_0x444dc9){logger[_0x5896('0x10')](_0x5896('0x1f'),_0x444dc9[_0x5896('0x11')],_0x4f5891);_0x517e06(_0x53658f[_0x5896('0x10')](0x1f4,_0x444dc9['message']));});});}; \ No newline at end of file +var _0xce99=['message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','stringify','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','then','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','error','code'];(function(_0x4eca93,_0xaf500){var _0x466c77=function(_0x48bdef){while(--_0x48bdef){_0x4eca93['push'](_0x4eca93['shift']());}};_0x466c77(++_0xaf500);}(_0xce99,0x166));var _0x9ce9=function(_0x38533c,_0x596f55){_0x38533c=_0x38533c-0x0;var _0x33b55d=_0xce99[_0x38533c];return _0x33b55d;};'use strict';var _=require(_0x9ce9('0x0'));var util=require(_0x9ce9('0x1'));var moment=require('moment');var BPromise=require(_0x9ce9('0x2'));var rs=require(_0x9ce9('0x3'));var fs=require('fs');var Redis=require(_0x9ce9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9ce9('0x5'))(_0x9ce9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9ce9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x120528,_0x5473cc,_0x1baa6d){return new BPromise(function(_0x285102,_0x35a6c6){return client[_0x9ce9('0x8')](_0x120528,_0x1baa6d)['then'](function(_0x3b51d9){logger[_0x9ce9('0x9')](_0x9ce9('0xa'),_0x5473cc,'request\x20sent');logger[_0x9ce9('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5473cc,'request\x20sent',JSON['stringify'](_0x3b51d9));if(_0x3b51d9[_0x9ce9('0xc')]){if(_0x3b51d9[_0x9ce9('0xc')][_0x9ce9('0xd')]===0x1f4){logger['error'](_0x9ce9('0xa'),_0x5473cc,_0x3b51d9[_0x9ce9('0xc')]['message']);return _0x35a6c6(_0x3b51d9[_0x9ce9('0xc')][_0x9ce9('0xe')]);}logger[_0x9ce9('0xc')](_0x9ce9('0xa'),_0x5473cc,_0x3b51d9['error']['message']);return _0x285102(_0x3b51d9[_0x9ce9('0xc')][_0x9ce9('0xe')]);}else{logger[_0x9ce9('0x9')](_0x9ce9('0xa'),_0x5473cc,_0x9ce9('0xf'));_0x285102(_0x3b51d9[_0x9ce9('0x10')]['message']);}})[_0x9ce9('0x11')](function(_0x323dd9){logger[_0x9ce9('0xc')](_0x9ce9('0xa'),_0x5473cc,_0x323dd9);_0x35a6c6(_0x323dd9);});});}exports[_0x9ce9('0x12')]=function(_0x2d7bbc){var _0x34e812=this;return new Promise(function(_0x5e7fd6,_0x48621d){return db[_0x9ce9('0x13')][_0x9ce9('0x14')](_0x2d7bbc[_0x9ce9('0x15')],{'raw':_0x2d7bbc['options']?_0x2d7bbc[_0x9ce9('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a6433){logger[_0x9ce9('0x9')](_0x9ce9('0x12'),_0x2d7bbc);logger[_0x9ce9('0xb')](_0x9ce9('0x12'),_0x2d7bbc,JSON[_0x9ce9('0x17')](_0x4a6433));_0x5e7fd6(_0x4a6433);})[_0x9ce9('0x11')](function(_0x3c97c7){logger[_0x9ce9('0xc')]('CreateOpenchannelQueueReport',_0x3c97c7['message'],_0x2d7bbc);_0x48621d(_0x34e812[_0x9ce9('0xc')](0x1f4,_0x3c97c7[_0x9ce9('0xe')]));});});};exports[_0x9ce9('0x18')]=function(_0x4e581b){var _0x151800=this;return new Promise(function(_0x155259,_0xc1b37a){return db['OpenchannelQueueReport'][_0x9ce9('0x19')](_0x4e581b[_0x9ce9('0x15')],{'raw':_0x4e581b['options']?_0x4e581b['options'][_0x9ce9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e581b[_0x9ce9('0x16')]?_0x4e581b[_0x9ce9('0x16')][_0x9ce9('0x1b')]||null:null,'attributes':_0x4e581b[_0x9ce9('0x16')]?_0x4e581b[_0x9ce9('0x16')][_0x9ce9('0x1c')]||null:null,'limit':_0x4e581b['options']?_0x4e581b[_0x9ce9('0x16')][_0x9ce9('0x1d')]||null:null})[_0x9ce9('0x1e')](function(_0x5f5de1){logger['info'](_0x9ce9('0x18'),_0x4e581b);logger[_0x9ce9('0xb')](_0x9ce9('0x18'),_0x4e581b,JSON[_0x9ce9('0x17')](_0x5f5de1));_0x155259(_0x5f5de1);})[_0x9ce9('0x11')](function(_0x13a815){logger['error'](_0x9ce9('0x18'),_0x13a815[_0x9ce9('0xe')],_0x4e581b);_0xc1b37a(_0x151800['error'](0x1f4,_0x13a815[_0x9ce9('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 2e091dc..13977a8 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e2b8b46..bc6f2c7 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 _0x7ab5=['sequelize','exports','STRING','ENUM','account','agent','queue','NOW','moment'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x7ab5,0x1b8));var _0x57ab=function(_0x532d34,_0x3eed90){_0x532d34=_0x532d34-0x0;var _0x33f6b1=_0x7ab5[_0x532d34];return _0x33f6b1;};'use strict';var moment=require(_0x57ab('0x0'));var Sequelize=require(_0x57ab('0x1'));module[_0x57ab('0x2')]={'uniqueid':{'type':Sequelize[_0x57ab('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x57ab('0x4')](_0x57ab('0x5'),_0x57ab('0x6'),_0x57ab('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x57ab('0x8')]}}; \ No newline at end of file +var _0x5eef=['STRING','queue','NOW','moment','sequelize'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x5eef,0x85));var _0xf5ee=function(_0x22c330,_0x4db06e){_0x22c330=_0x22c330-0x0;var _0x2ec285=_0x5eef[_0x22c330];return _0x2ec285;};'use strict';var moment=require(_0xf5ee('0x0'));var Sequelize=require(_0xf5ee('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf5ee('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent','queue'),'allowNull':![],'defaultValue':_0xf5ee('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf5ee('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6ef0f94..552a139 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 _0xcd23=['path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','includeAll','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xcd23,0x129));var _0x3cd2=function(_0x3c2cf4,_0x5519f4){_0x3c2cf4=_0x3c2cf4-0x0;var _0x2632ef=_0xcd23[_0x3c2cf4];return _0x2632ef;};'use strict';var pdf=require(_0x3cd2('0x0'));var emlformat=require(_0x3cd2('0x1'));var rimraf=require(_0x3cd2('0x2'));var zipdir=require(_0x3cd2('0x3'));var jsonpatch=require(_0x3cd2('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3cd2('0x5'));var Mustache=require('mustache');var util=require(_0x3cd2('0x6'));var path=require(_0x3cd2('0x7'));var sox=require(_0x3cd2('0x8'));var csv=require('to-csv');var ejs=require(_0x3cd2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3cd2('0xa'));var crypto=require(_0x3cd2('0xb'));var jsforce=require(_0x3cd2('0xc'));var deskjs=require(_0x3cd2('0xd'));var toCsv=require(_0x3cd2('0xe'));var querystring=require(_0x3cd2('0xf'));var Papa=require(_0x3cd2('0x10'));var Redis=require('ioredis');var authService=require(_0x3cd2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3cd2('0x12'));var hardwareService=require(_0x3cd2('0x13'));var logger=require(_0x3cd2('0x14'))(_0x3cd2('0x15'));var utils=require(_0x3cd2('0x16'));var config=require(_0x3cd2('0x17'));var licenseUtil=require(_0x3cd2('0x18'));var db=require(_0x3cd2('0x19'))['db'];function respondWithStatusCode(_0x466c3a,_0x5725fb){_0x5725fb=_0x5725fb||0xcc;return function(_0x553586){if(_0x553586){return _0x466c3a[_0x3cd2('0x1a')](_0x5725fb);}return _0x466c3a[_0x3cd2('0x1b')](_0x5725fb)[_0x3cd2('0x1c')]();};}function respondWithResult(_0x48c66f,_0x31af23){_0x31af23=_0x31af23||0xc8;return function(_0xa6625c){if(_0xa6625c){return _0x48c66f[_0x3cd2('0x1b')](_0x31af23)['json'](_0xa6625c);}};}function respondWithFilteredResult(_0x293dae,_0x463cef){return function(_0x1cede0){if(_0x1cede0){var _0x4d04c6=_0x1cede0[_0x3cd2('0x1d')],_0x5b9153=_0x463cef['offset'],_0x144e92=_0x463cef[_0x3cd2('0x1e')]+_0x463cef[_0x3cd2('0x1f')],_0x3e23e8;if(_0x144e92>=_0x4d04c6){_0x144e92=_0x4d04c6;_0x3e23e8=0xc8;}else{_0x3e23e8=0xce;}_0x293dae[_0x3cd2('0x1b')](_0x3e23e8);return _0x293dae[_0x3cd2('0x20')]('Content-Range',_0x5b9153+'-'+_0x144e92+'/'+_0x4d04c6)[_0x3cd2('0x21')](_0x1cede0);}return null;};}function patchUpdates(_0x987f54){return function(_0x50cbf5){try{jsonpatch[_0x3cd2('0x22')](_0x50cbf5,_0x987f54,!![]);}catch(_0x226ddf){return BPromise[_0x3cd2('0x23')](_0x226ddf);}return _0x50cbf5[_0x3cd2('0x24')]();};}function saveUpdates(_0x5934b3,_0x11e4af){return function(_0xfb8292){if(_0xfb8292){return _0xfb8292[_0x3cd2('0x25')](_0x5934b3)[_0x3cd2('0x26')](function(_0x5cc9fe){return _0x5cc9fe;});}return null;};}function removeEntity(_0x5e8a64,_0x195f82){return function(_0x3c11f6){if(_0x3c11f6){return _0x3c11f6[_0x3cd2('0x27')]()[_0x3cd2('0x26')](function(){_0x5e8a64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0d54,_0x6dfd5a){return function(_0x21f0ef){if(!_0x21f0ef){_0x5e0d54[_0x3cd2('0x1a')](0x194);}return _0x21f0ef;};}function handleError(_0x55832a,_0x4716da){_0x4716da=_0x4716da||0x1f4;return function(_0x41aea0){logger[_0x3cd2('0x28')](_0x41aea0[_0x3cd2('0x29')]);if(_0x41aea0[_0x3cd2('0x2a')]){delete _0x41aea0[_0x3cd2('0x2a')];}_0x55832a['status'](_0x4716da)['send'](_0x41aea0);};}exports['index']=function(_0x4c6dea,_0x5c869b){var _0x265450={},_0x5608b7={},_0x1d3a55={'count':0x0,'rows':[]};var _0x26b159=_[_0x3cd2('0x2b')](db[_0x3cd2('0x2c')][_0x3cd2('0x2d')],function(_0x1b2722){return{'name':_0x1b2722[_0x3cd2('0x2e')],'type':_0x1b2722[_0x3cd2('0x2f')]['key']};});_0x5608b7[_0x3cd2('0x30')]=_[_0x3cd2('0x2b')](_0x26b159,_0x3cd2('0x2a'));_0x5608b7[_0x3cd2('0x31')]=_[_0x3cd2('0x32')](_0x4c6dea['query']);_0x5608b7[_0x3cd2('0x33')]=_[_0x3cd2('0x34')](_0x5608b7[_0x3cd2('0x30')],_0x5608b7[_0x3cd2('0x31')]);_0x265450[_0x3cd2('0x35')]=_[_0x3cd2('0x34')](_0x5608b7['model'],qs[_0x3cd2('0x36')](_0x4c6dea[_0x3cd2('0x31')]['fields']));_0x265450[_0x3cd2('0x35')]=_0x265450[_0x3cd2('0x35')][_0x3cd2('0x37')]?_0x265450[_0x3cd2('0x35')]:_0x5608b7[_0x3cd2('0x30')];if(!_0x4c6dea['query'][_0x3cd2('0x38')](_0x3cd2('0x39'))){_0x265450[_0x3cd2('0x1f')]=qs[_0x3cd2('0x1f')](_0x4c6dea[_0x3cd2('0x31')][_0x3cd2('0x1f')]);_0x265450['offset']=qs[_0x3cd2('0x1e')](_0x4c6dea[_0x3cd2('0x31')][_0x3cd2('0x1e')]);}_0x265450[_0x3cd2('0x3a')]=qs[_0x3cd2('0x3b')](_0x4c6dea[_0x3cd2('0x31')][_0x3cd2('0x3b')]);_0x265450[_0x3cd2('0x3c')]=qs[_0x3cd2('0x33')](_[_0x3cd2('0x3d')](_0x4c6dea[_0x3cd2('0x31')],_0x5608b7[_0x3cd2('0x33')]),_0x26b159);if(_0x4c6dea[_0x3cd2('0x31')][_0x3cd2('0x3e')]){_0x265450[_0x3cd2('0x3c')]=_[_0x3cd2('0x3f')](_0x265450[_0x3cd2('0x3c')],{'$or':_[_0x3cd2('0x2b')](_0x26b159,function(_0x12f6ea){if(_0x12f6ea[_0x3cd2('0x2f')]!==_0x3cd2('0x40')){var _0x304160={};_0x304160[_0x12f6ea[_0x3cd2('0x2a')]]={'$like':'%'+_0x4c6dea[_0x3cd2('0x31')][_0x3cd2('0x3e')]+'%'};return _0x304160;}})});}_0x265450=_[_0x3cd2('0x3f')]({},_0x265450,_0x4c6dea['options']);var _0x5f2dba={'where':_0x265450[_0x3cd2('0x3c')]};return db['OpenchannelTransferReport'][_0x3cd2('0x1d')](_0x5f2dba)[_0x3cd2('0x26')](function(_0x5a1cc1){_0x1d3a55[_0x3cd2('0x1d')]=_0x5a1cc1;if(_0x4c6dea['query']['includeAll']){_0x265450['include']=[{'all':!![]}];}return db[_0x3cd2('0x2c')][_0x3cd2('0x41')](_0x265450);})[_0x3cd2('0x26')](function(_0x4108e1){_0x1d3a55[_0x3cd2('0x42')]=_0x4108e1;return _0x1d3a55;})[_0x3cd2('0x26')](respondWithFilteredResult(_0x5c869b,_0x265450))[_0x3cd2('0x43')](handleError(_0x5c869b,null));};exports[_0x3cd2('0x44')]=function(_0x36f07e,_0x5369c3){var _0x1e4276={'raw':!![],'where':{'id':_0x36f07e['params']['id']}},_0x1725df={};_0x1725df['model']=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0x1725df[_0x3cd2('0x31')]=_[_0x3cd2('0x32')](_0x36f07e[_0x3cd2('0x31')]);_0x1725df[_0x3cd2('0x33')]=_[_0x3cd2('0x34')](_0x1725df[_0x3cd2('0x30')],_0x1725df[_0x3cd2('0x31')]);_0x1e4276[_0x3cd2('0x35')]=_[_0x3cd2('0x34')](_0x1725df[_0x3cd2('0x30')],qs[_0x3cd2('0x36')](_0x36f07e[_0x3cd2('0x31')][_0x3cd2('0x36')]));_0x1e4276['attributes']=_0x1e4276[_0x3cd2('0x35')][_0x3cd2('0x37')]?_0x1e4276[_0x3cd2('0x35')]:_0x1725df[_0x3cd2('0x30')];if(_0x36f07e[_0x3cd2('0x31')][_0x3cd2('0x45')]){_0x1e4276[_0x3cd2('0x46')]=[{'all':!![]}];}_0x1e4276=_[_0x3cd2('0x3f')]({},_0x1e4276,_0x36f07e['options']);return db[_0x3cd2('0x2c')][_0x3cd2('0x47')](_0x1e4276)[_0x3cd2('0x26')](handleEntityNotFound(_0x5369c3,null))['then'](respondWithResult(_0x5369c3,null))[_0x3cd2('0x43')](handleError(_0x5369c3,null));};exports[_0x3cd2('0x48')]=function(_0x187acc,_0x23290b){return db[_0x3cd2('0x2c')]['create'](_0x187acc[_0x3cd2('0x49')],{})[_0x3cd2('0x26')](respondWithResult(_0x23290b,0xc9))[_0x3cd2('0x43')](handleError(_0x23290b,null));};exports['update']=function(_0x265ea5,_0x1da56e){if(_0x265ea5['body']['id']){delete _0x265ea5['body']['id'];}return db[_0x3cd2('0x2c')]['find']({'where':{'id':_0x265ea5[_0x3cd2('0x4a')]['id']}})[_0x3cd2('0x26')](handleEntityNotFound(_0x1da56e,null))[_0x3cd2('0x26')](saveUpdates(_0x265ea5[_0x3cd2('0x49')],null))[_0x3cd2('0x26')](respondWithResult(_0x1da56e,null))[_0x3cd2('0x43')](handleError(_0x1da56e,null));};exports['destroy']=function(_0x4f86fd,_0x480502){return db[_0x3cd2('0x2c')][_0x3cd2('0x47')]({'where':{'id':_0x4f86fd[_0x3cd2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x480502,null))[_0x3cd2('0x26')](removeEntity(_0x480502,null))[_0x3cd2('0x43')](handleError(_0x480502,null));};exports[_0x3cd2('0x4b')]=function(_0x40b73e,_0x3c9a88){return db['OpenchannelTransferReport']['describe']()[_0x3cd2('0x26')](respondWithResult(_0x3c9a88,null))['catch'](handleError(_0x3c9a88,null));}; \ No newline at end of file +var _0xbb5d=['type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName'];(function(_0x32c8d8,_0x42bd3d){var _0x50b7cf=function(_0x249dac){while(--_0x249dac){_0x32c8d8['push'](_0x32c8d8['shift']());}};_0x50b7cf(++_0x42bd3d);}(_0xbb5d,0xaa));var _0xdbb5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb5d[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xdbb5('0x0'));var emlformat=require(_0xdbb5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdbb5('0x2'));var rp=require(_0xdbb5('0x3'));var moment=require(_0xdbb5('0x4'));var BPromise=require(_0xdbb5('0x5'));var Mustache=require(_0xdbb5('0x6'));var util=require('util');var path=require(_0xdbb5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdbb5('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdbb5('0x9'));var crypto=require(_0xdbb5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdbb5('0xb'));var toCsv=require(_0xdbb5('0xc'));var querystring=require(_0xdbb5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdbb5('0xe'));var as=require(_0xdbb5('0xf'));var hardwareService=require(_0xdbb5('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdbb5('0x11'));var licenseUtil=require(_0xdbb5('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x518435,_0x54abc2){_0x54abc2=_0x54abc2||0xcc;return function(_0xe58c7d){if(_0xe58c7d){return _0x518435[_0xdbb5('0x13')](_0x54abc2);}return _0x518435['status'](_0x54abc2)['end']();};}function respondWithResult(_0xdccd12,_0x44932d){_0x44932d=_0x44932d||0xc8;return function(_0x10a411){if(_0x10a411){return _0xdccd12[_0xdbb5('0x14')](_0x44932d)[_0xdbb5('0x15')](_0x10a411);}};}function respondWithFilteredResult(_0x165322,_0x37921e){return function(_0xccaacb){if(_0xccaacb){var _0x118edb=_0xccaacb[_0xdbb5('0x16')],_0x17f779=_0x37921e['offset'],_0x54e403=_0x37921e[_0xdbb5('0x17')]+_0x37921e['limit'],_0x73181;if(_0x54e403>=_0x118edb){_0x54e403=_0x118edb;_0x73181=0xc8;}else{_0x73181=0xce;}_0x165322[_0xdbb5('0x14')](_0x73181);return _0x165322['set'](_0xdbb5('0x18'),_0x17f779+'-'+_0x54e403+'/'+_0x118edb)[_0xdbb5('0x15')](_0xccaacb);}return null;};}function patchUpdates(_0x558497){return function(_0x445406){try{jsonpatch[_0xdbb5('0x19')](_0x445406,_0x558497,!![]);}catch(_0x3b4f59){return BPromise[_0xdbb5('0x1a')](_0x3b4f59);}return _0x445406[_0xdbb5('0x1b')]();};}function saveUpdates(_0x55896d,_0x1bd0c0){return function(_0x1565da){if(_0x1565da){return _0x1565da[_0xdbb5('0x1c')](_0x55896d)['then'](function(_0x909e58){return _0x909e58;});}return null;};}function removeEntity(_0x4664b8,_0x5b6ca8){return function(_0x5e5fa0){if(_0x5e5fa0){return _0x5e5fa0[_0xdbb5('0x1d')]()[_0xdbb5('0x1e')](function(){_0x4664b8['status'](0xcc)[_0xdbb5('0x1f')]();});}};}function handleEntityNotFound(_0xef2c52,_0x1f9018){return function(_0x790d1b){if(!_0x790d1b){_0xef2c52[_0xdbb5('0x13')](0x194);}return _0x790d1b;};}function handleError(_0x3a1119,_0xe123ce){_0xe123ce=_0xe123ce||0x1f4;return function(_0x113560){logger[_0xdbb5('0x20')](_0x113560[_0xdbb5('0x21')]);if(_0x113560[_0xdbb5('0x22')]){delete _0x113560[_0xdbb5('0x22')];}_0x3a1119[_0xdbb5('0x14')](_0xe123ce)['send'](_0x113560);};}exports[_0xdbb5('0x23')]=function(_0x31afaa,_0x40ae53){var _0x3ef3f8={},_0x3dee53={},_0x19470f={'count':0x0,'rows':[]};var _0x200074=_[_0xdbb5('0x24')](db[_0xdbb5('0x25')][_0xdbb5('0x26')],function(_0x3e6b5f){return{'name':_0x3e6b5f[_0xdbb5('0x27')],'type':_0x3e6b5f[_0xdbb5('0x28')]['key']};});_0x3dee53[_0xdbb5('0x29')]=_[_0xdbb5('0x24')](_0x200074,'name');_0x3dee53['query']=_[_0xdbb5('0x2a')](_0x31afaa[_0xdbb5('0x2b')]);_0x3dee53['filters']=_[_0xdbb5('0x2c')](_0x3dee53[_0xdbb5('0x29')],_0x3dee53[_0xdbb5('0x2b')]);_0x3ef3f8[_0xdbb5('0x2d')]=_[_0xdbb5('0x2c')](_0x3dee53['model'],qs[_0xdbb5('0x2e')](_0x31afaa[_0xdbb5('0x2b')][_0xdbb5('0x2e')]));_0x3ef3f8[_0xdbb5('0x2d')]=_0x3ef3f8['attributes'][_0xdbb5('0x2f')]?_0x3ef3f8[_0xdbb5('0x2d')]:_0x3dee53[_0xdbb5('0x29')];if(!_0x31afaa['query'][_0xdbb5('0x30')](_0xdbb5('0x31'))){_0x3ef3f8['limit']=qs[_0xdbb5('0x32')](_0x31afaa[_0xdbb5('0x2b')][_0xdbb5('0x32')]);_0x3ef3f8[_0xdbb5('0x17')]=qs[_0xdbb5('0x17')](_0x31afaa[_0xdbb5('0x2b')][_0xdbb5('0x17')]);}_0x3ef3f8[_0xdbb5('0x33')]=qs[_0xdbb5('0x34')](_0x31afaa['query'][_0xdbb5('0x34')]);_0x3ef3f8['where']=qs['filters'](_[_0xdbb5('0x35')](_0x31afaa[_0xdbb5('0x2b')],_0x3dee53[_0xdbb5('0x36')]),_0x200074);if(_0x31afaa[_0xdbb5('0x2b')][_0xdbb5('0x37')]){_0x3ef3f8[_0xdbb5('0x38')]=_[_0xdbb5('0x39')](_0x3ef3f8['where'],{'$or':_[_0xdbb5('0x24')](_0x200074,function(_0xf4ad0){if(_0xf4ad0[_0xdbb5('0x28')]!==_0xdbb5('0x3a')){var _0x4e4d6d={};_0x4e4d6d[_0xf4ad0[_0xdbb5('0x22')]]={'$like':'%'+_0x31afaa[_0xdbb5('0x2b')]['filter']+'%'};return _0x4e4d6d;}})});}_0x3ef3f8=_[_0xdbb5('0x39')]({},_0x3ef3f8,_0x31afaa['options']);var _0x3c8989={'where':_0x3ef3f8[_0xdbb5('0x38')]};return db[_0xdbb5('0x25')][_0xdbb5('0x16')](_0x3c8989)['then'](function(_0xa41212){_0x19470f[_0xdbb5('0x16')]=_0xa41212;if(_0x31afaa[_0xdbb5('0x2b')][_0xdbb5('0x3b')]){_0x3ef3f8[_0xdbb5('0x3c')]=[{'all':!![]}];}return db[_0xdbb5('0x25')][_0xdbb5('0x3d')](_0x3ef3f8);})[_0xdbb5('0x1e')](function(_0x12b650){_0x19470f[_0xdbb5('0x3e')]=_0x12b650;return _0x19470f;})['then'](respondWithFilteredResult(_0x40ae53,_0x3ef3f8))[_0xdbb5('0x3f')](handleError(_0x40ae53,null));};exports[_0xdbb5('0x40')]=function(_0x2a0fec,_0x3af46e){var _0x592884={'raw':!![],'where':{'id':_0x2a0fec[_0xdbb5('0x41')]['id']}},_0x56fcce={};_0x56fcce[_0xdbb5('0x29')]=_[_0xdbb5('0x2a')](db[_0xdbb5('0x25')][_0xdbb5('0x26')]);_0x56fcce[_0xdbb5('0x2b')]=_[_0xdbb5('0x2a')](_0x2a0fec[_0xdbb5('0x2b')]);_0x56fcce[_0xdbb5('0x36')]=_[_0xdbb5('0x2c')](_0x56fcce[_0xdbb5('0x29')],_0x56fcce[_0xdbb5('0x2b')]);_0x592884[_0xdbb5('0x2d')]=_[_0xdbb5('0x2c')](_0x56fcce[_0xdbb5('0x29')],qs[_0xdbb5('0x2e')](_0x2a0fec['query'][_0xdbb5('0x2e')]));_0x592884[_0xdbb5('0x2d')]=_0x592884['attributes']['length']?_0x592884[_0xdbb5('0x2d')]:_0x56fcce[_0xdbb5('0x29')];if(_0x2a0fec[_0xdbb5('0x2b')][_0xdbb5('0x3b')]){_0x592884[_0xdbb5('0x3c')]=[{'all':!![]}];}_0x592884=_['merge']({},_0x592884,_0x2a0fec[_0xdbb5('0x42')]);return db[_0xdbb5('0x25')][_0xdbb5('0x43')](_0x592884)[_0xdbb5('0x1e')](handleEntityNotFound(_0x3af46e,null))[_0xdbb5('0x1e')](respondWithResult(_0x3af46e,null))[_0xdbb5('0x3f')](handleError(_0x3af46e,null));};exports[_0xdbb5('0x44')]=function(_0x3ac54c,_0x392408){return db['OpenchannelTransferReport'][_0xdbb5('0x44')](_0x3ac54c['body'],{})[_0xdbb5('0x1e')](respondWithResult(_0x392408,0xc9))['catch'](handleError(_0x392408,null));};exports[_0xdbb5('0x1c')]=function(_0x1dcba6,_0x4d5edd){if(_0x1dcba6[_0xdbb5('0x45')]['id']){delete _0x1dcba6[_0xdbb5('0x45')]['id'];}return db[_0xdbb5('0x25')][_0xdbb5('0x43')]({'where':{'id':_0x1dcba6['params']['id']}})[_0xdbb5('0x1e')](handleEntityNotFound(_0x4d5edd,null))['then'](saveUpdates(_0x1dcba6[_0xdbb5('0x45')],null))[_0xdbb5('0x1e')](respondWithResult(_0x4d5edd,null))['catch'](handleError(_0x4d5edd,null));};exports[_0xdbb5('0x1d')]=function(_0x108591,_0x3654b2){return db[_0xdbb5('0x25')]['find']({'where':{'id':_0x108591[_0xdbb5('0x41')]['id']}})['then'](handleEntityNotFound(_0x3654b2,null))[_0xdbb5('0x1e')](removeEntity(_0x3654b2,null))['catch'](handleError(_0x3654b2,null));};exports['describe']=function(_0x135c62,_0x1451fb){return db[_0xdbb5('0x25')]['describe']()['then'](respondWithResult(_0x1451fb,null))[_0xdbb5('0x3f')](handleError(_0x1451fb,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 07a4789..b14a08c 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 _0xb1a8=['../../config/environment','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path'];(function(_0x295560,_0x3cdcec){var _0x197b3f=function(_0x45b15d){while(--_0x45b15d){_0x295560['push'](_0x295560['shift']());}};_0x197b3f(++_0x3cdcec);}(_0xb1a8,0x15a));var _0x8b1a=function(_0x123a63,_0x2761c9){_0x123a63=_0x123a63-0x0;var _0x2f8a5d=_0xb1a8[_0x123a63];return _0x2f8a5d;};'use strict';var _=require(_0x8b1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8b1a('0x1'));var moment=require(_0x8b1a('0x2'));var BPromise=require(_0x8b1a('0x3'));var rp=require(_0x8b1a('0x4'));var fs=require('fs');var path=require(_0x8b1a('0x5'));var rimraf=require('rimraf');var config=require(_0x8b1a('0x6'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x29828a,_0x55e653){return _0x29828a[_0x8b1a('0x7')](_0x8b1a('0x8'),attributes,{'tableName':_0x8b1a('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8b1a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b53=['../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','request-promise','path','rimraf'];(function(_0x4ddfe1,_0x35939d){var _0x4aaf51=function(_0x1e99a0){while(--_0x1e99a0){_0x4ddfe1['push'](_0x4ddfe1['shift']());}};_0x4aaf51(++_0x35939d);}(_0x1b53,0x96));var _0x31b5=function(_0x4e259c,_0x1e8bc5){_0x4e259c=_0x4e259c-0x0;var _0x506328=_0x1b53[_0x4e259c];return _0x506328;};'use strict';var _=require(_0x31b5('0x0'));var util=require(_0x31b5('0x1'));var logger=require('../../config/logger')(_0x31b5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x31b5('0x3'));var fs=require('fs');var path=require(_0x31b5('0x4'));var rimraf=require(_0x31b5('0x5'));var config=require(_0x31b5('0x6'));var attributes=require(_0x31b5('0x7'));module['exports']=function(_0x8ca923,_0x4d8782){return _0x8ca923[_0x31b5('0x8')](_0x31b5('0x9'),attributes,{'tableName':_0x31b5('0xa'),'paranoid':![],'indexes':[{'name':_0x31b5('0xb'),'fields':[_0x31b5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 364dd10..06b584b 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 _0xa10d=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa10d,0xd2));var _0xda10=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa10d[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xda10('0x0'));var util=require(_0xda10('0x1'));var moment=require(_0xda10('0x2'));var BPromise=require(_0xda10('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda10('0x4'));var db=require(_0xda10('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda10('0x6'))(_0xda10('0x7'));var config=require(_0xda10('0x8'));var jayson=require(_0xda10('0x9'));var client=jayson[_0xda10('0xa')][_0xda10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x254978,_0xab0d12,_0x20b491){return new BPromise(function(_0x199d35,_0x2e8849){return client[_0xda10('0xc')](_0x254978,_0x20b491)['then'](function(_0x5b439a){logger[_0xda10('0xd')](_0xda10('0xe'),_0xab0d12,_0xda10('0xf'));logger[_0xda10('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0xab0d12,_0xda10('0xf'),JSON[_0xda10('0x11')](_0x5b439a));if(_0x5b439a[_0xda10('0x12')]){if(_0x5b439a[_0xda10('0x12')][_0xda10('0x13')]===0x1f4){logger[_0xda10('0x12')](_0xda10('0xe'),_0xab0d12,_0x5b439a[_0xda10('0x12')][_0xda10('0x14')]);return _0x2e8849(_0x5b439a[_0xda10('0x12')][_0xda10('0x14')]);}logger[_0xda10('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xab0d12,_0x5b439a[_0xda10('0x12')]['message']);return _0x199d35(_0x5b439a[_0xda10('0x12')]['message']);}else{logger[_0xda10('0xd')](_0xda10('0xe'),_0xab0d12,'request\x20sent');_0x199d35(_0x5b439a['result'][_0xda10('0x14')]);}})['catch'](function(_0x19926e){logger[_0xda10('0x12')](_0xda10('0xe'),_0xab0d12,_0x19926e);_0x2e8849(_0x19926e);});});} \ No newline at end of file +var _0xad66=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','request\x20sent'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xad66,0x8c));var _0x6ad6=function(_0x430a0f,_0x48911b){_0x430a0f=_0x430a0f-0x0;var _0x357190=_0xad66[_0x430a0f];return _0x357190;};'use strict';var _=require(_0x6ad6('0x0'));var util=require(_0x6ad6('0x1'));var moment=require(_0x6ad6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ad6('0x3'));var db=require(_0x6ad6('0x4'))['db'];var utils=require(_0x6ad6('0x5'));var logger=require(_0x6ad6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ad6('0x7'));var client=jayson[_0x6ad6('0x8')][_0x6ad6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51942e,_0x2c1eae,_0x57fa75){return new BPromise(function(_0xe45687,_0x484237){return client['request'](_0x51942e,_0x57fa75)['then'](function(_0x4a22ce){logger[_0x6ad6('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2c1eae,_0x6ad6('0xb'));logger[_0x6ad6('0xc')](_0x6ad6('0xd'),_0x2c1eae,_0x6ad6('0xb'),JSON[_0x6ad6('0xe')](_0x4a22ce));if(_0x4a22ce[_0x6ad6('0xf')]){if(_0x4a22ce[_0x6ad6('0xf')]['code']===0x1f4){logger[_0x6ad6('0xf')](_0x6ad6('0x10'),_0x2c1eae,_0x4a22ce['error'][_0x6ad6('0x11')]);return _0x484237(_0x4a22ce[_0x6ad6('0xf')][_0x6ad6('0x11')]);}logger[_0x6ad6('0xf')](_0x6ad6('0x10'),_0x2c1eae,_0x4a22ce[_0x6ad6('0xf')]['message']);return _0xe45687(_0x4a22ce[_0x6ad6('0xf')][_0x6ad6('0x11')]);}else{logger[_0x6ad6('0xa')](_0x6ad6('0x10'),_0x2c1eae,_0x6ad6('0xb'));_0xe45687(_0x4a22ce[_0x6ad6('0x12')][_0x6ad6('0x11')]);}})['catch'](function(_0x5b542a){logger[_0x6ad6('0xf')](_0x6ad6('0x10'),_0x2c1eae,_0x5b542a);_0x484237(_0x5b542a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 60715de..f0b6d62 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 _0xbbd4=['update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','put'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xbbd4,0xe3));var _0x4bbd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbbd4[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x4bbd('0x0'));var util=require(_0x4bbd('0x1'));var path=require(_0x4bbd('0x2'));var timeout=require(_0x4bbd('0x3'));var express=require(_0x4bbd('0x4'));var router=express['Router']();var auth=require(_0x4bbd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4bbd('0x6'));var controller=require(_0x4bbd('0x7'));router[_0x4bbd('0x8')]('/',auth[_0x4bbd('0x9')](),controller['index']);router[_0x4bbd('0x8')](_0x4bbd('0xa'),auth[_0x4bbd('0x9')](),controller[_0x4bbd('0xb')]);router['post']('/',auth[_0x4bbd('0x9')](),controller['create']);router[_0x4bbd('0xc')]('/:id',auth[_0x4bbd('0x9')](),controller[_0x4bbd('0xd')]);router[_0x4bbd('0xe')](_0x4bbd('0xa'),auth[_0x4bbd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7214=['./pause.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service'];(function(_0x417bd6,_0x130030){var _0x3ff500=function(_0x47975e){while(--_0x47975e){_0x417bd6['push'](_0x417bd6['shift']());}};_0x3ff500(++_0x130030);}(_0x7214,0x6c));var _0x4721=function(_0x429e65,_0x2dd590){_0x429e65=_0x429e65-0x0;var _0xfaa37f=_0x7214[_0x429e65];return _0xfaa37f;};'use strict';var multer=require(_0x4721('0x0'));var util=require(_0x4721('0x1'));var path=require('path');var timeout=require(_0x4721('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4721('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4721('0x4'));router[_0x4721('0x5')]('/',auth[_0x4721('0x6')](),controller['index']);router[_0x4721('0x5')](_0x4721('0x7'),auth[_0x4721('0x6')](),controller[_0x4721('0x8')]);router[_0x4721('0x9')]('/',auth[_0x4721('0x6')](),controller[_0x4721('0xa')]);router[_0x4721('0xb')](_0x4721('0x7'),auth['isAuthenticated'](),controller[_0x4721('0xc')]);router[_0x4721('0xd')]('/:id',auth[_0x4721('0x6')](),controller[_0x4721('0xe')]);module[_0x4721('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index eb2c8c0..86e7faa 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 _0x35fc=['STRING','sequelize','exports','name'];(function(_0x21155e,_0x24abe7){var _0x9d22b3=function(_0x2895fa){while(--_0x2895fa){_0x21155e['push'](_0x21155e['shift']());}};_0x9d22b3(++_0x24abe7);}(_0x35fc,0x1e9));var _0xc35f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x35fc[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xc35f('0x0'));module[_0xc35f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc35f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc35f('0x3')]}}; \ No newline at end of file +var _0x52a6=['sequelize','exports','STRING','name'];(function(_0x2609ef,_0x356d7d){var _0x5ca63c=function(_0x161d7d){while(--_0x161d7d){_0x2609ef['push'](_0x2609ef['shift']());}};_0x5ca63c(++_0x356d7d);}(_0x52a6,0x104));var _0x652a=function(_0x3ea86e,_0x4ce7ed){_0x3ea86e=_0x3ea86e-0x0;var _0x3de213=_0x52a6[_0x3ea86e];return _0x3de213;};'use strict';var Sequelize=require(_0x652a('0x0'));module[_0x652a('0x1')]={'name':{'type':Sequelize[_0x652a('0x2')],'unique':_0x652a('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 061bd4e..21b380c 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 _0x1bbb=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','update','then','get','Pauses','UserProfileResource','error','stack','name','send','index','Pause','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','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','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x4b68aa,_0x2c5035){var _0x112bd3=function(_0x3c4fd7){while(--_0x3c4fd7){_0x4b68aa['push'](_0x4b68aa['shift']());}};_0x112bd3(++_0x2c5035);}(_0x1bbb,0x97));var _0xb1bb=function(_0x1e5f19,_0x50e1bf){_0x1e5f19=_0x1e5f19-0x0;var _0x857e87=_0x1bbb[_0x1e5f19];return _0x857e87;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb1bb('0x0'));var rimraf=require(_0xb1bb('0x1'));var zipdir=require(_0xb1bb('0x2'));var jsonpatch=require(_0xb1bb('0x3'));var rp=require(_0xb1bb('0x4'));var moment=require('moment');var BPromise=require(_0xb1bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb1bb('0x6'));var sox=require(_0xb1bb('0x7'));var csv=require(_0xb1bb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb1bb('0x9'));var jsforce=require(_0xb1bb('0xa'));var deskjs=require(_0xb1bb('0xb'));var toCsv=require(_0xb1bb('0x8'));var querystring=require(_0xb1bb('0xc'));var Papa=require(_0xb1bb('0xd'));var Redis=require(_0xb1bb('0xe'));var authService=require(_0xb1bb('0xf'));var qs=require(_0xb1bb('0x10'));var as=require(_0xb1bb('0x11'));var hardwareService=require(_0xb1bb('0x12'));var logger=require(_0xb1bb('0x13'))('api');var utils=require(_0xb1bb('0x14'));var config=require(_0xb1bb('0x15'));var licenseUtil=require(_0xb1bb('0x16'));var db=require(_0xb1bb('0x17'))['db'];function respondWithStatusCode(_0x32898d,_0x23a2ed){_0x23a2ed=_0x23a2ed||0xcc;return function(_0x3e577b){if(_0x3e577b){return _0x32898d[_0xb1bb('0x18')](_0x23a2ed);}return _0x32898d[_0xb1bb('0x19')](_0x23a2ed)['end']();};}function respondWithResult(_0x4f4a49,_0x3b053f){_0x3b053f=_0x3b053f||0xc8;return function(_0x527d6c){if(_0x527d6c){return _0x4f4a49[_0xb1bb('0x19')](_0x3b053f)[_0xb1bb('0x1a')](_0x527d6c);}};}function respondWithFilteredResult(_0x5e5e53,_0x19a030){return function(_0x152430){if(_0x152430){var _0xc50000=_0x152430[_0xb1bb('0x1b')],_0x1182c7=_0x19a030[_0xb1bb('0x1c')],_0x10b914=_0x19a030[_0xb1bb('0x1c')]+_0x19a030['limit'],_0x358b27;if(_0x10b914>=_0xc50000){_0x10b914=_0xc50000;_0x358b27=0xc8;}else{_0x358b27=0xce;}_0x5e5e53[_0xb1bb('0x19')](_0x358b27);return _0x5e5e53['set'](_0xb1bb('0x1d'),_0x1182c7+'-'+_0x10b914+'/'+_0xc50000)[_0xb1bb('0x1a')](_0x152430);}return null;};}function patchUpdates(_0xeaedb){return function(_0xe26bc0){try{jsonpatch[_0xb1bb('0x1e')](_0xe26bc0,_0xeaedb,!![]);}catch(_0x566f61){return BPromise['reject'](_0x566f61);}return _0xe26bc0['save']();};}function saveUpdates(_0x20d57c,_0x3461b9){return function(_0x38f863){if(_0x38f863){return _0x38f863[_0xb1bb('0x1f')](_0x20d57c)[_0xb1bb('0x20')](function(_0xd15510){return _0xd15510;});}return null;};}function removeEntity(_0x23813b,_0x4d337c){return function(_0xa94d3a){if(_0xa94d3a){return _0xa94d3a['destroy']()[_0xb1bb('0x20')](function(){var _0x2becbd=_0xa94d3a[_0xb1bb('0x21')]({'plain':!![]});var _0x584454=_0xb1bb('0x22');return db[_0xb1bb('0x23')]['destroy']({'where':{'type':_0x584454,'resourceId':_0x2becbd['id']}})['then'](function(){return _0xa94d3a;});})[_0xb1bb('0x20')](function(){_0x23813b[_0xb1bb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x556445,_0x1cb2b6){return function(_0x71043b){if(!_0x71043b){_0x556445[_0xb1bb('0x18')](0x194);}return _0x71043b;};}function handleError(_0x3f7114,_0x58f4bd){_0x58f4bd=_0x58f4bd||0x1f4;return function(_0x2aa6ee){logger[_0xb1bb('0x24')](_0x2aa6ee[_0xb1bb('0x25')]);if(_0x2aa6ee[_0xb1bb('0x26')]){delete _0x2aa6ee[_0xb1bb('0x26')];}_0x3f7114[_0xb1bb('0x19')](_0x58f4bd)[_0xb1bb('0x27')](_0x2aa6ee);};}exports[_0xb1bb('0x28')]=function(_0x3f0126,_0x38474f){var _0x27c022={},_0x532905={},_0x49d28a={'count':0x0,'rows':[]};var _0x43320c=_['map'](db[_0xb1bb('0x29')]['rawAttributes'],function(_0x1dc6be){return{'name':_0x1dc6be[_0xb1bb('0x2a')],'type':_0x1dc6be[_0xb1bb('0x2b')][_0xb1bb('0x2c')]};});_0x532905['model']=_[_0xb1bb('0x2d')](_0x43320c,_0xb1bb('0x26'));_0x532905[_0xb1bb('0x2e')]=_['keys'](_0x3f0126[_0xb1bb('0x2e')]);_0x532905[_0xb1bb('0x2f')]=_[_0xb1bb('0x30')](_0x532905[_0xb1bb('0x31')],_0x532905[_0xb1bb('0x2e')]);_0x27c022['attributes']=_['intersection'](_0x532905[_0xb1bb('0x31')],qs[_0xb1bb('0x32')](_0x3f0126[_0xb1bb('0x2e')][_0xb1bb('0x32')]));_0x27c022[_0xb1bb('0x33')]=_0x27c022[_0xb1bb('0x33')]['length']?_0x27c022[_0xb1bb('0x33')]:_0x532905[_0xb1bb('0x31')];if(!_0x3f0126['query'][_0xb1bb('0x34')](_0xb1bb('0x35'))){_0x27c022[_0xb1bb('0x36')]=qs[_0xb1bb('0x36')](_0x3f0126[_0xb1bb('0x2e')]['limit']);_0x27c022[_0xb1bb('0x1c')]=qs[_0xb1bb('0x1c')](_0x3f0126[_0xb1bb('0x2e')][_0xb1bb('0x1c')]);}_0x27c022[_0xb1bb('0x37')]=qs['sort'](_0x3f0126[_0xb1bb('0x2e')]['sort']);_0x27c022[_0xb1bb('0x38')]=qs[_0xb1bb('0x2f')](_[_0xb1bb('0x39')](_0x3f0126['query'],_0x532905[_0xb1bb('0x2f')]),_0x43320c);if(_0x3f0126['query'][_0xb1bb('0x3a')]){_0x27c022[_0xb1bb('0x38')]=_['merge'](_0x27c022['where'],{'$or':_[_0xb1bb('0x2d')](_0x43320c,function(_0x1f64b0){if(_0x1f64b0[_0xb1bb('0x2b')]!=='VIRTUAL'){var _0x4faa07={};_0x4faa07[_0x1f64b0[_0xb1bb('0x26')]]={'$like':'%'+_0x3f0126[_0xb1bb('0x2e')][_0xb1bb('0x3a')]+'%'};return _0x4faa07;}})});}_0x27c022=_[_0xb1bb('0x3b')]({},_0x27c022,_0x3f0126[_0xb1bb('0x3c')]);var _0x364e4e={'where':_0x27c022[_0xb1bb('0x38')]};return db[_0xb1bb('0x29')]['count'](_0x364e4e)[_0xb1bb('0x20')](function(_0x36f5d3){_0x49d28a['count']=_0x36f5d3;if(_0x3f0126[_0xb1bb('0x2e')][_0xb1bb('0x3d')]){_0x27c022[_0xb1bb('0x3e')]=[{'all':!![]}];}return db[_0xb1bb('0x29')][_0xb1bb('0x3f')](_0x27c022);})[_0xb1bb('0x20')](function(_0x476a23){_0x49d28a['rows']=_0x476a23;return _0x49d28a;})[_0xb1bb('0x20')](respondWithFilteredResult(_0x38474f,_0x27c022))[_0xb1bb('0x40')](handleError(_0x38474f,null));};exports[_0xb1bb('0x41')]=function(_0x48d345,_0x231ec4){var _0x3717b7={'raw':!![],'where':{'id':_0x48d345[_0xb1bb('0x42')]['id']}},_0x36d29a={};_0x36d29a[_0xb1bb('0x31')]=_[_0xb1bb('0x43')](db[_0xb1bb('0x29')]['rawAttributes']);_0x36d29a['query']=_[_0xb1bb('0x43')](_0x48d345[_0xb1bb('0x2e')]);_0x36d29a[_0xb1bb('0x2f')]=_['intersection'](_0x36d29a['model'],_0x36d29a[_0xb1bb('0x2e')]);_0x3717b7[_0xb1bb('0x33')]=_['intersection'](_0x36d29a[_0xb1bb('0x31')],qs[_0xb1bb('0x32')](_0x48d345['query'][_0xb1bb('0x32')]));_0x3717b7['attributes']=_0x3717b7[_0xb1bb('0x33')][_0xb1bb('0x44')]?_0x3717b7[_0xb1bb('0x33')]:_0x36d29a[_0xb1bb('0x31')];if(_0x48d345[_0xb1bb('0x2e')][_0xb1bb('0x3d')]){_0x3717b7[_0xb1bb('0x3e')]=[{'all':!![]}];}_0x3717b7=_[_0xb1bb('0x3b')]({},_0x3717b7,_0x48d345[_0xb1bb('0x3c')]);return db[_0xb1bb('0x29')][_0xb1bb('0x45')](_0x3717b7)[_0xb1bb('0x20')](handleEntityNotFound(_0x231ec4,null))[_0xb1bb('0x20')](respondWithResult(_0x231ec4,null))[_0xb1bb('0x40')](handleError(_0x231ec4,null));};exports[_0xb1bb('0x46')]=function(_0xca2c79,_0x4cec54){return db[_0xb1bb('0x29')][_0xb1bb('0x46')](_0xca2c79[_0xb1bb('0x47')],{})[_0xb1bb('0x20')](function(_0x396806){var _0x158d91=_0xca2c79[_0xb1bb('0x48')]['get']({'plain':!![]});if(!_0x158d91)throw new Error(_0xb1bb('0x49'));if(_0x158d91[_0xb1bb('0x4a')]===_0xb1bb('0x48')){var _0x5ded73=_0x396806[_0xb1bb('0x21')]({'plain':!![]});var _0x3f5d75=_0xb1bb('0x22');return db[_0xb1bb('0x4b')][_0xb1bb('0x45')]({'where':{'name':_0x3f5d75,'userProfileId':_0x158d91[_0xb1bb('0x4c')]},'raw':!![]})[_0xb1bb('0x20')](function(_0x2bed54){if(_0x2bed54&&_0x2bed54[_0xb1bb('0x4d')]===0x0){return db[_0xb1bb('0x23')][_0xb1bb('0x46')]({'name':_0x5ded73['name'],'resourceId':_0x5ded73['id'],'type':_0x2bed54[_0xb1bb('0x26')],'sectionId':_0x2bed54['id']},{})[_0xb1bb('0x20')](function(){return _0x396806;});}else{return _0x396806;}})['catch'](function(_0x316723){logger['error'](_0xb1bb('0x4e'),_0x316723);throw _0x316723;});}return _0x396806;})[_0xb1bb('0x20')](respondWithResult(_0x4cec54,0xc9))[_0xb1bb('0x40')](handleError(_0x4cec54,null));};exports[_0xb1bb('0x1f')]=function(_0x38b895,_0x51c5f1){if(_0x38b895[_0xb1bb('0x47')]['id']){delete _0x38b895[_0xb1bb('0x47')]['id'];}return db[_0xb1bb('0x29')][_0xb1bb('0x45')]({'where':{'id':_0x38b895[_0xb1bb('0x42')]['id']}})[_0xb1bb('0x20')](handleEntityNotFound(_0x51c5f1,null))[_0xb1bb('0x20')](saveUpdates(_0x38b895[_0xb1bb('0x47')],null))['then'](respondWithResult(_0x51c5f1,null))[_0xb1bb('0x40')](handleError(_0x51c5f1,null));};exports[_0xb1bb('0x4f')]=function(_0x196e86,_0x3d25c3){return db[_0xb1bb('0x29')][_0xb1bb('0x45')]({'where':{'id':_0x196e86['params']['id']}})[_0xb1bb('0x20')](handleEntityNotFound(_0x3d25c3,null))[_0xb1bb('0x20')](removeEntity(_0x3d25c3,null))['catch'](handleError(_0x3d25c3,null));}; \ No newline at end of file +var _0xe9c3=['Pause','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','limit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','index','map'];(function(_0x5d3d2f,_0x2d9f7b){var _0x580414=function(_0x2d7d1e){while(--_0x2d7d1e){_0x5d3d2f['push'](_0x5d3d2f['shift']());}};_0x580414(++_0x2d9f7b);}(_0xe9c3,0x10c));var _0x3e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3e9c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3e9c('0x1'));var rp=require(_0x3e9c('0x2'));var moment=require(_0x3e9c('0x3'));var BPromise=require(_0x3e9c('0x4'));var Mustache=require('mustache');var util=require(_0x3e9c('0x5'));var path=require(_0x3e9c('0x6'));var sox=require('sox');var csv=require(_0x3e9c('0x7'));var ejs=require(_0x3e9c('0x8'));var fs=require('fs');var _=require(_0x3e9c('0x9'));var squel=require(_0x3e9c('0xa'));var crypto=require('crypto');var jsforce=require(_0x3e9c('0xb'));var deskjs=require(_0x3e9c('0xc'));var toCsv=require(_0x3e9c('0x7'));var querystring=require(_0x3e9c('0xd'));var Papa=require(_0x3e9c('0xe'));var Redis=require(_0x3e9c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3e9c('0x10'));var hardwareService=require(_0x3e9c('0x11'));var logger=require('../../config/logger')(_0x3e9c('0x12'));var utils=require(_0x3e9c('0x13'));var config=require(_0x3e9c('0x14'));var licenseUtil=require(_0x3e9c('0x15'));var db=require(_0x3e9c('0x16'))['db'];function respondWithStatusCode(_0x8817e5,_0x5bc6e2){_0x5bc6e2=_0x5bc6e2||0xcc;return function(_0xfd07b){if(_0xfd07b){return _0x8817e5['sendStatus'](_0x5bc6e2);}return _0x8817e5[_0x3e9c('0x17')](_0x5bc6e2)[_0x3e9c('0x18')]();};}function respondWithResult(_0x195702,_0x4ed3fa){_0x4ed3fa=_0x4ed3fa||0xc8;return function(_0x393704){if(_0x393704){return _0x195702[_0x3e9c('0x17')](_0x4ed3fa)[_0x3e9c('0x19')](_0x393704);}};}function respondWithFilteredResult(_0x233c2e,_0x309a22){return function(_0x79a4c1){if(_0x79a4c1){var _0x45acb8=_0x79a4c1[_0x3e9c('0x1a')],_0x53c447=_0x309a22[_0x3e9c('0x1b')],_0x433017=_0x309a22[_0x3e9c('0x1b')]+_0x309a22['limit'],_0x11d1f4;if(_0x433017>=_0x45acb8){_0x433017=_0x45acb8;_0x11d1f4=0xc8;}else{_0x11d1f4=0xce;}_0x233c2e['status'](_0x11d1f4);return _0x233c2e[_0x3e9c('0x1c')](_0x3e9c('0x1d'),_0x53c447+'-'+_0x433017+'/'+_0x45acb8)[_0x3e9c('0x19')](_0x79a4c1);}return null;};}function patchUpdates(_0x4bbef5){return function(_0x43db9a){try{jsonpatch[_0x3e9c('0x1e')](_0x43db9a,_0x4bbef5,!![]);}catch(_0x4d6e7b){return BPromise['reject'](_0x4d6e7b);}return _0x43db9a[_0x3e9c('0x1f')]();};}function saveUpdates(_0x10a0dc,_0x1fcbe5){return function(_0x14e843){if(_0x14e843){return _0x14e843[_0x3e9c('0x20')](_0x10a0dc)[_0x3e9c('0x21')](function(_0x32d0b5){return _0x32d0b5;});}return null;};}function removeEntity(_0x2cc6df,_0xb419b2){return function(_0x74ca17){if(_0x74ca17){return _0x74ca17[_0x3e9c('0x22')]()[_0x3e9c('0x21')](function(){var _0x345bf4=_0x74ca17[_0x3e9c('0x23')]({'plain':!![]});var _0x3ab68f=_0x3e9c('0x24');return db[_0x3e9c('0x25')]['destroy']({'where':{'type':_0x3ab68f,'resourceId':_0x345bf4['id']}})[_0x3e9c('0x21')](function(){return _0x74ca17;});})[_0x3e9c('0x21')](function(){_0x2cc6df[_0x3e9c('0x17')](0xcc)[_0x3e9c('0x18')]();});}};}function handleEntityNotFound(_0x2c612b,_0x1c3e17){return function(_0x4fa4f3){if(!_0x4fa4f3){_0x2c612b[_0x3e9c('0x26')](0x194);}return _0x4fa4f3;};}function handleError(_0x3e9aa5,_0xb53fdd){_0xb53fdd=_0xb53fdd||0x1f4;return function(_0x2cc3cc){logger[_0x3e9c('0x27')](_0x2cc3cc[_0x3e9c('0x28')]);if(_0x2cc3cc[_0x3e9c('0x29')]){delete _0x2cc3cc['name'];}_0x3e9aa5[_0x3e9c('0x17')](_0xb53fdd)['send'](_0x2cc3cc);};}exports[_0x3e9c('0x2a')]=function(_0x53b2ef,_0x342f93){var _0x5b76e9={},_0x3c8b8d={},_0x3eff21={'count':0x0,'rows':[]};var _0x13715c=_[_0x3e9c('0x2b')](db[_0x3e9c('0x2c')]['rawAttributes'],function(_0x68201d){return{'name':_0x68201d[_0x3e9c('0x2d')],'type':_0x68201d[_0x3e9c('0x2e')]['key']};});_0x3c8b8d[_0x3e9c('0x2f')]=_['map'](_0x13715c,_0x3e9c('0x29'));_0x3c8b8d[_0x3e9c('0x30')]=_[_0x3e9c('0x31')](_0x53b2ef[_0x3e9c('0x30')]);_0x3c8b8d[_0x3e9c('0x32')]=_[_0x3e9c('0x33')](_0x3c8b8d[_0x3e9c('0x2f')],_0x3c8b8d['query']);_0x5b76e9[_0x3e9c('0x34')]=_[_0x3e9c('0x33')](_0x3c8b8d[_0x3e9c('0x2f')],qs['fields'](_0x53b2ef[_0x3e9c('0x30')]['fields']));_0x5b76e9[_0x3e9c('0x34')]=_0x5b76e9[_0x3e9c('0x34')][_0x3e9c('0x35')]?_0x5b76e9[_0x3e9c('0x34')]:_0x3c8b8d[_0x3e9c('0x2f')];if(!_0x53b2ef[_0x3e9c('0x30')]['hasOwnProperty'](_0x3e9c('0x36'))){_0x5b76e9[_0x3e9c('0x37')]=qs[_0x3e9c('0x37')](_0x53b2ef[_0x3e9c('0x30')][_0x3e9c('0x37')]);_0x5b76e9[_0x3e9c('0x1b')]=qs[_0x3e9c('0x1b')](_0x53b2ef[_0x3e9c('0x30')][_0x3e9c('0x1b')]);}_0x5b76e9['order']=qs[_0x3e9c('0x38')](_0x53b2ef[_0x3e9c('0x30')][_0x3e9c('0x38')]);_0x5b76e9[_0x3e9c('0x39')]=qs[_0x3e9c('0x32')](_[_0x3e9c('0x3a')](_0x53b2ef[_0x3e9c('0x30')],_0x3c8b8d['filters']),_0x13715c);if(_0x53b2ef[_0x3e9c('0x30')][_0x3e9c('0x3b')]){_0x5b76e9[_0x3e9c('0x39')]=_[_0x3e9c('0x3c')](_0x5b76e9[_0x3e9c('0x39')],{'$or':_[_0x3e9c('0x2b')](_0x13715c,function(_0x41787b){if(_0x41787b[_0x3e9c('0x2e')]!=='VIRTUAL'){var _0x243a4a={};_0x243a4a[_0x41787b[_0x3e9c('0x29')]]={'$like':'%'+_0x53b2ef[_0x3e9c('0x30')]['filter']+'%'};return _0x243a4a;}})});}_0x5b76e9=_[_0x3e9c('0x3c')]({},_0x5b76e9,_0x53b2ef[_0x3e9c('0x3d')]);var _0x522729={'where':_0x5b76e9[_0x3e9c('0x39')]};return db[_0x3e9c('0x2c')]['count'](_0x522729)[_0x3e9c('0x21')](function(_0x311738){_0x3eff21[_0x3e9c('0x1a')]=_0x311738;if(_0x53b2ef[_0x3e9c('0x30')]['includeAll']){_0x5b76e9[_0x3e9c('0x3e')]=[{'all':!![]}];}return db[_0x3e9c('0x2c')][_0x3e9c('0x3f')](_0x5b76e9);})[_0x3e9c('0x21')](function(_0x22b046){_0x3eff21[_0x3e9c('0x40')]=_0x22b046;return _0x3eff21;})[_0x3e9c('0x21')](respondWithFilteredResult(_0x342f93,_0x5b76e9))[_0x3e9c('0x41')](handleError(_0x342f93,null));};exports[_0x3e9c('0x42')]=function(_0x2b1cb4,_0x560903){var _0x2f3b88={'raw':!![],'where':{'id':_0x2b1cb4[_0x3e9c('0x43')]['id']}},_0xaaf7ca={};_0xaaf7ca[_0x3e9c('0x2f')]=_[_0x3e9c('0x31')](db[_0x3e9c('0x2c')][_0x3e9c('0x44')]);_0xaaf7ca[_0x3e9c('0x30')]=_[_0x3e9c('0x31')](_0x2b1cb4[_0x3e9c('0x30')]);_0xaaf7ca[_0x3e9c('0x32')]=_['intersection'](_0xaaf7ca[_0x3e9c('0x2f')],_0xaaf7ca[_0x3e9c('0x30')]);_0x2f3b88[_0x3e9c('0x34')]=_[_0x3e9c('0x33')](_0xaaf7ca[_0x3e9c('0x2f')],qs[_0x3e9c('0x45')](_0x2b1cb4[_0x3e9c('0x30')][_0x3e9c('0x45')]));_0x2f3b88[_0x3e9c('0x34')]=_0x2f3b88[_0x3e9c('0x34')][_0x3e9c('0x35')]?_0x2f3b88[_0x3e9c('0x34')]:_0xaaf7ca[_0x3e9c('0x2f')];if(_0x2b1cb4[_0x3e9c('0x30')][_0x3e9c('0x46')]){_0x2f3b88[_0x3e9c('0x3e')]=[{'all':!![]}];}_0x2f3b88=_[_0x3e9c('0x3c')]({},_0x2f3b88,_0x2b1cb4['options']);return db['Pause'][_0x3e9c('0x47')](_0x2f3b88)[_0x3e9c('0x21')](handleEntityNotFound(_0x560903,null))['then'](respondWithResult(_0x560903,null))[_0x3e9c('0x41')](handleError(_0x560903,null));};exports[_0x3e9c('0x48')]=function(_0x1274a1,_0x263465){return db[_0x3e9c('0x2c')]['create'](_0x1274a1['body'],{})['then'](function(_0x104555){var _0x376688=_0x1274a1[_0x3e9c('0x49')]['get']({'plain':!![]});if(!_0x376688)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376688[_0x3e9c('0x4a')]==='user'){var _0x145cbd=_0x104555[_0x3e9c('0x23')]({'plain':!![]});var _0x234cb1=_0x3e9c('0x24');return db['UserProfileSection'][_0x3e9c('0x47')]({'where':{'name':_0x234cb1,'userProfileId':_0x376688[_0x3e9c('0x4b')]},'raw':!![]})['then'](function(_0x4bbaa8){if(_0x4bbaa8&&_0x4bbaa8['autoAssociation']===0x0){return db[_0x3e9c('0x25')][_0x3e9c('0x48')]({'name':_0x145cbd[_0x3e9c('0x29')],'resourceId':_0x145cbd['id'],'type':_0x4bbaa8['name'],'sectionId':_0x4bbaa8['id']},{})[_0x3e9c('0x21')](function(){return _0x104555;});}else{return _0x104555;}})[_0x3e9c('0x41')](function(_0x1b3e14){logger['error'](_0x3e9c('0x4c'),_0x1b3e14);throw _0x1b3e14;});}return _0x104555;})[_0x3e9c('0x21')](respondWithResult(_0x263465,0xc9))[_0x3e9c('0x41')](handleError(_0x263465,null));};exports[_0x3e9c('0x20')]=function(_0x479c4a,_0x2df586){if(_0x479c4a['body']['id']){delete _0x479c4a[_0x3e9c('0x4d')]['id'];}return db[_0x3e9c('0x2c')][_0x3e9c('0x47')]({'where':{'id':_0x479c4a[_0x3e9c('0x43')]['id']}})[_0x3e9c('0x21')](handleEntityNotFound(_0x2df586,null))[_0x3e9c('0x21')](saveUpdates(_0x479c4a[_0x3e9c('0x4d')],null))[_0x3e9c('0x21')](respondWithResult(_0x2df586,null))[_0x3e9c('0x41')](handleError(_0x2df586,null));};exports['destroy']=function(_0x2cfb4b,_0x3c5c39){return db['Pause'][_0x3e9c('0x47')]({'where':{'id':_0x2cfb4b['params']['id']}})[_0x3e9c('0x21')](handleEntityNotFound(_0x3c5c39,null))[_0x3e9c('0x21')](removeEntity(_0x3c5c39,null))[_0x3e9c('0x41')](handleError(_0x3c5c39,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a866ca2..3060d49 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 _0xc664=['tools_pauses','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var logger=require('../../config/logger')(_0x4c66('0x2'));var moment=require(_0x4c66('0x3'));var BPromise=require(_0x4c66('0x4'));var rp=require(_0x4c66('0x5'));var fs=require('fs');var path=require(_0x4c66('0x6'));var rimraf=require('rimraf');var config=require(_0x4c66('0x7'));var attributes=require(_0x4c66('0x8'));module[_0x4c66('0x9')]=function(_0x28a065,_0x4ecac0){return _0x28a065[_0x4c66('0xa')](_0x4c66('0xb'),attributes,{'tableName':_0x4c66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc36=['tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','Pause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc36,0x169));var _0x6bc3=function(_0x481931,_0x21d500){_0x481931=_0x481931-0x0;var _0x367da4=_0xbc36[_0x481931];return _0x367da4;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var logger=require(_0x6bc3('0x1'))(_0x6bc3('0x2'));var moment=require(_0x6bc3('0x3'));var BPromise=require(_0x6bc3('0x4'));var rp=require(_0x6bc3('0x5'));var fs=require('fs');var path=require(_0x6bc3('0x6'));var rimraf=require(_0x6bc3('0x7'));var config=require(_0x6bc3('0x8'));var attributes=require(_0x6bc3('0x9'));module['exports']=function(_0x1c47e8,_0x4715c8){return _0x1c47e8['define'](_0x6bc3('0xa'),attributes,{'tableName':_0x6bc3('0xb'),'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 42ccabe..730980a 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 _0xd74c=['map','include','model','attributes','info','ShowPause','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Pause,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','Pause','options','raw','where'];(function(_0xf59106,_0x28ef6c){var _0xa9c416=function(_0x1c00e3){while(--_0x1c00e3){_0xf59106['push'](_0xf59106['shift']());}};_0xa9c416(++_0x28ef6c);}(_0xd74c,0xb4));var _0xcd74=function(_0x70baae,_0x2cffd1){_0x70baae=_0x70baae-0x0;var _0x5789ab=_0xd74c[_0x70baae];return _0x5789ab;};'use strict';var _=require('lodash');var util=require(_0xcd74('0x0'));var moment=require(_0xcd74('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd74('0x2'));var db=require(_0xcd74('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd74('0x4'))(_0xcd74('0x5'));var config=require(_0xcd74('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcd74('0x7')][_0xcd74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x184dca,_0x30833c,_0x2b50db){return new BPromise(function(_0x522e00,_0x34eede){return client[_0xcd74('0x9')](_0x184dca,_0x2b50db)[_0xcd74('0xa')](function(_0x2f50e8){logger['info'](_0xcd74('0xb'),_0x30833c,'request\x20sent');logger[_0xcd74('0xc')]('Pause,\x20%s,\x20%s,\x20%s',_0x30833c,_0xcd74('0xd'),JSON[_0xcd74('0xe')](_0x2f50e8));if(_0x2f50e8[_0xcd74('0xf')]){if(_0x2f50e8['error']['code']===0x1f4){logger[_0xcd74('0xf')](_0xcd74('0xb'),_0x30833c,_0x2f50e8[_0xcd74('0xf')][_0xcd74('0x10')]);return _0x34eede(_0x2f50e8[_0xcd74('0xf')]['message']);}logger[_0xcd74('0xf')](_0xcd74('0xb'),_0x30833c,_0x2f50e8[_0xcd74('0xf')][_0xcd74('0x10')]);return _0x522e00(_0x2f50e8[_0xcd74('0xf')]['message']);}else{logger['info'](_0xcd74('0xb'),_0x30833c,_0xcd74('0xd'));_0x522e00(_0x2f50e8[_0xcd74('0x11')][_0xcd74('0x10')]);}})[_0xcd74('0x12')](function(_0x6ebfb0){logger[_0xcd74('0xf')](_0xcd74('0xb'),_0x30833c,_0x6ebfb0);_0x34eede(_0x6ebfb0);});});}exports['ShowPause']=function(_0xf01474){var _0x108bfc=this;return new Promise(function(_0xba54eb,_0xf42bee){return db[_0xcd74('0x13')]['find']({'raw':_0xf01474['options']?_0xf01474[_0xcd74('0x14')][_0xcd74('0x15')]===undefined?!![]:![]:!![],'where':_0xf01474[_0xcd74('0x14')]?_0xf01474['options'][_0xcd74('0x16')]||null:null,'attributes':_0xf01474[_0xcd74('0x14')]?_0xf01474[_0xcd74('0x14')]['attributes']||null:null,'include':_0xf01474[_0xcd74('0x14')]?_0xf01474['options']['include']?_[_0xcd74('0x17')](_0xf01474[_0xcd74('0x14')][_0xcd74('0x18')],function(_0x139ee9){return{'model':db[_0x139ee9[_0xcd74('0x19')]],'as':_0x139ee9['as'],'attributes':_0x139ee9[_0xcd74('0x1a')],'include':_0x139ee9[_0xcd74('0x18')]?_[_0xcd74('0x17')](_0x139ee9[_0xcd74('0x18')],function(_0x596b79){return{'model':db[_0x596b79['model']],'as':_0x596b79['as'],'attributes':_0x596b79[_0xcd74('0x1a')],'include':_0x596b79[_0xcd74('0x18')]?_['map'](_0x596b79[_0xcd74('0x18')],function(_0xcc514b){return{'model':db[_0xcc514b[_0xcd74('0x19')]],'as':_0xcc514b['as'],'attributes':_0xcc514b[_0xcd74('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcd74('0xa')](function(_0x16e0c7){logger[_0xcd74('0x1b')](_0xcd74('0x1c'),_0xf01474);logger['debug']('ShowPause',_0xf01474,JSON[_0xcd74('0xe')](_0x16e0c7));_0xba54eb(_0x16e0c7);})[_0xcd74('0x12')](function(_0x17ea6a){logger[_0xcd74('0xf')](_0xcd74('0x1c'),_0x17ea6a[_0xcd74('0x10')],_0xf01474);_0xf42bee(_0x108bfc[_0xcd74('0xf')](0x1f4,_0x17ea6a[_0xcd74('0x10')]));});});}; \ No newline at end of file +var _0xc519=['result','find','options','raw','where','attributes','include','map','model','ShowPause','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc519,0x1ea));var _0x9c51=function(_0x3ddce0,_0x11741e){_0x3ddce0=_0x3ddce0-0x0;var _0x567d64=_0xc519[_0x3ddce0];return _0x567d64;};'use strict';var _=require(_0x9c51('0x0'));var util=require(_0x9c51('0x1'));var moment=require('moment');var BPromise=require(_0x9c51('0x2'));var rs=require(_0x9c51('0x3'));var fs=require('fs');var Redis=require(_0x9c51('0x4'));var db=require(_0x9c51('0x5'))['db'];var utils=require(_0x9c51('0x6'));var logger=require('../../config/logger')(_0x9c51('0x7'));var config=require('../../config/environment');var jayson=require(_0x9c51('0x8'));var client=jayson[_0x9c51('0x9')][_0x9c51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c4cb5,_0x528372,_0x24997d){return new BPromise(function(_0x504ad2,_0x984bde){return client['request'](_0x5c4cb5,_0x24997d)[_0x9c51('0xb')](function(_0x5d2b35){logger[_0x9c51('0xc')](_0x9c51('0xd'),_0x528372,_0x9c51('0xe'));logger[_0x9c51('0xf')](_0x9c51('0x10'),_0x528372,_0x9c51('0xe'),JSON[_0x9c51('0x11')](_0x5d2b35));if(_0x5d2b35['error']){if(_0x5d2b35[_0x9c51('0x12')]['code']===0x1f4){logger[_0x9c51('0x12')](_0x9c51('0xd'),_0x528372,_0x5d2b35[_0x9c51('0x12')][_0x9c51('0x13')]);return _0x984bde(_0x5d2b35[_0x9c51('0x12')][_0x9c51('0x13')]);}logger[_0x9c51('0x12')]('Pause,\x20%s,\x20%s',_0x528372,_0x5d2b35['error']['message']);return _0x504ad2(_0x5d2b35[_0x9c51('0x12')][_0x9c51('0x13')]);}else{logger[_0x9c51('0xc')](_0x9c51('0xd'),_0x528372,_0x9c51('0xe'));_0x504ad2(_0x5d2b35[_0x9c51('0x14')]['message']);}})['catch'](function(_0x553b17){logger['error'](_0x9c51('0xd'),_0x528372,_0x553b17);_0x984bde(_0x553b17);});});}exports['ShowPause']=function(_0x3763cb){var _0x4f8ff8=this;return new Promise(function(_0x1d9d5b,_0x2574d1){return db['Pause'][_0x9c51('0x15')]({'raw':_0x3763cb[_0x9c51('0x16')]?_0x3763cb[_0x9c51('0x16')][_0x9c51('0x17')]===undefined?!![]:![]:!![],'where':_0x3763cb[_0x9c51('0x16')]?_0x3763cb[_0x9c51('0x16')][_0x9c51('0x18')]||null:null,'attributes':_0x3763cb['options']?_0x3763cb['options'][_0x9c51('0x19')]||null:null,'include':_0x3763cb['options']?_0x3763cb[_0x9c51('0x16')][_0x9c51('0x1a')]?_[_0x9c51('0x1b')](_0x3763cb[_0x9c51('0x16')][_0x9c51('0x1a')],function(_0x526fe8){return{'model':db[_0x526fe8[_0x9c51('0x1c')]],'as':_0x526fe8['as'],'attributes':_0x526fe8['attributes'],'include':_0x526fe8[_0x9c51('0x1a')]?_[_0x9c51('0x1b')](_0x526fe8[_0x9c51('0x1a')],function(_0x5cae23){return{'model':db[_0x5cae23[_0x9c51('0x1c')]],'as':_0x5cae23['as'],'attributes':_0x5cae23['attributes'],'include':_0x5cae23[_0x9c51('0x1a')]?_['map'](_0x5cae23[_0x9c51('0x1a')],function(_0x35431a){return{'model':db[_0x35431a[_0x9c51('0x1c')]],'as':_0x35431a['as'],'attributes':_0x35431a[_0x9c51('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9c51('0xb')](function(_0x31ff65){logger[_0x9c51('0xc')](_0x9c51('0x1d'),_0x3763cb);logger['debug'](_0x9c51('0x1d'),_0x3763cb,JSON[_0x9c51('0x11')](_0x31ff65));_0x1d9d5b(_0x31ff65);})['catch'](function(_0x5e6573){logger[_0x9c51('0x12')]('ShowPause',_0x5e6573['message'],_0x3763cb);_0x2574d1(_0x4f8ff8['error'](0x1f4,_0x5e6573[_0x9c51('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fdcc30a..9350730 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 _0xb299=['/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','root','originalname','replace','format','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet'];(function(_0x3dfa44,_0x1cbb79){var _0x2766db=function(_0x470e89){while(--_0x470e89){_0x3dfa44['push'](_0x3dfa44['shift']());}};_0x2766db(++_0x1cbb79);}(_0xb299,0xd6));var _0x9b29=function(_0x4fc232,_0x1acdb5){_0x4fc232=_0x4fc232-0x0;var _0x3490cb=_0xb299[_0x4fc232];return _0x3490cb;};'use strict';var multer=require(_0x9b29('0x0'));var util=require(_0x9b29('0x1'));var path=require('path');var timeout=require(_0x9b29('0x2'));var express=require(_0x9b29('0x3'));var router=express[_0x9b29('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b29('0x5'));var config=require(_0x9b29('0x6'));var controller=require(_0x9b29('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9b29('0x8')]('/webhook',controller[_0x9b29('0x9')]);router[_0x9b29('0x8')](_0x9b29('0xa'),auth['isAuthenticated'](),controller[_0x9b29('0xb')]);router[_0x9b29('0x8')](_0x9b29('0xc'),auth[_0x9b29('0xd')](),controller[_0x9b29('0xe')]);var upload=multer({'storage':multer[_0x9b29('0xf')]({'destination':function(_0x374ac8,_0x58eb8e,_0x41c35a){_0x41c35a(null,path[_0x9b29('0x10')](config[_0x9b29('0x11')],'server/files/plugins'));},'filename':function(_0x550408,_0x144bd3,_0x4e7ba7){_0x144bd3[_0x9b29('0x12')]=_0x144bd3['originalname'][_0x9b29('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e7ba7(null,util[_0x9b29('0x14')]('%s-%s%s',path[_0x9b29('0x15')](_0x144bd3[_0x9b29('0x12')],path[_0x9b29('0x16')](_0x144bd3[_0x9b29('0x12')])),Date[_0x9b29('0x17')](),path[_0x9b29('0x16')](_0x144bd3['originalname'])));}})});router[_0x9b29('0x18')]('/',upload[_0x9b29('0x19')](_0x9b29('0x1a')),controller[_0x9b29('0x1b')]);router[_0x9b29('0x18')]('/webhook',controller[_0x9b29('0x1c')]);router[_0x9b29('0x1d')]('/:id',auth[_0x9b29('0xd')](),controller[_0x9b29('0x1e')]);router[_0x9b29('0x1f')](_0x9b29('0xa'),auth[_0x9b29('0xd')](),controller[_0x9b29('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xdf8b=['util','path','connect-timeout','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','webhookPost','put','update','delete','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf8b,0x13f));var _0xbdf8=function(_0x3fb5a8,_0x57d3f6){_0x3fb5a8=_0x3fb5a8-0x0;var _0x519841=_0xdf8b[_0x3fb5a8];return _0x519841;};'use strict';var multer=require(_0xbdf8('0x0'));var util=require(_0xbdf8('0x1'));var path=require(_0xbdf8('0x2'));var timeout=require(_0xbdf8('0x3'));var express=require('express');var router=express[_0xbdf8('0x4')]();var auth=require(_0xbdf8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbdf8('0x6'));router[_0xbdf8('0x7')]('/',auth[_0xbdf8('0x8')](),controller[_0xbdf8('0x9')]);router[_0xbdf8('0x7')](_0xbdf8('0xa'),controller[_0xbdf8('0xb')]);router[_0xbdf8('0x7')](_0xbdf8('0xc'),auth[_0xbdf8('0x8')](),controller[_0xbdf8('0xd')]);router[_0xbdf8('0x7')](_0xbdf8('0xe'),auth[_0xbdf8('0x8')](),controller[_0xbdf8('0xf')]);var upload=multer({'storage':multer[_0xbdf8('0x10')]({'destination':function(_0x5dc7db,_0x4d2e1d,_0x59951b){_0x59951b(null,path[_0xbdf8('0x11')](config[_0xbdf8('0x12')],_0xbdf8('0x13')));},'filename':function(_0x272e35,_0x1a4768,_0x4e920f){_0x1a4768[_0xbdf8('0x14')]=_0x1a4768[_0xbdf8('0x14')][_0xbdf8('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e920f(null,util[_0xbdf8('0x16')]('%s-%s%s',path[_0xbdf8('0x17')](_0x1a4768[_0xbdf8('0x14')],path['extname'](_0x1a4768[_0xbdf8('0x14')])),Date[_0xbdf8('0x18')](),path[_0xbdf8('0x19')](_0x1a4768[_0xbdf8('0x14')])));}})});router[_0xbdf8('0x1a')]('/',upload[_0xbdf8('0x1b')]('file'),controller['upload']);router[_0xbdf8('0x1a')](_0xbdf8('0xa'),controller[_0xbdf8('0x1c')]);router[_0xbdf8('0x1d')](_0xbdf8('0xc'),auth[_0xbdf8('0x8')](),controller[_0xbdf8('0x1e')]);router[_0xbdf8('0x1f')](_0xbdf8('0xc'),auth['isAuthenticated'](),controller[_0xbdf8('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d5a84a1..f008c21 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 _0x7bfa=['ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','sequelize'];(function(_0x1e4a66,_0xd9574f){var _0x8030f6=function(_0x54097d){while(--_0x54097d){_0x1e4a66['push'](_0x1e4a66['shift']());}};_0x8030f6(++_0xd9574f);}(_0x7bfa,0x173));var _0xa7bf=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x7bfa[_0x204eb7];return _0x37e444;};'use strict';var Sequelize=require(_0xa7bf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa7bf('0x1')](_0xa7bf('0x2'),'script')},'description':{'type':Sequelize[_0xa7bf('0x3')]},'version':{'type':Sequelize[_0xa7bf('0x3')]},'path':{'type':Sequelize[_0xa7bf('0x4')],'comment':_0xa7bf('0x5')},'active':{'type':Sequelize[_0xa7bf('0x6')],'defaultValue':0x0,'comment':_0xa7bf('0x7')},'sidebar':{'type':Sequelize[_0xa7bf('0x1')](_0xa7bf('0x8'),_0xa7bf('0x9'),_0xa7bf('0xa'),_0xa7bf('0xb')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xa7bf('0x4')]},'adminUrl':{'type':Sequelize[_0xa7bf('0x4')]},'agentUrl':{'type':Sequelize[_0xa7bf('0x4')]},'scriptName':{'type':Sequelize[_0xa7bf('0x4')]},'scriptPath':{'type':Sequelize[_0xa7bf('0x4')]}}; \ No newline at end of file +var _0xd4aa=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x4744da,_0xab2f61){var _0x43379f=function(_0x2c4459){while(--_0x2c4459){_0x4744da['push'](_0x4744da['shift']());}};_0x43379f(++_0xab2f61);}(_0xd4aa,0x99));var _0xad4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xd4aa[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xad4a('0x0'));module[_0xad4a('0x1')]={'name':{'type':Sequelize[_0xad4a('0x2')]},'type':{'type':Sequelize[_0xad4a('0x3')](_0xad4a('0x4'),_0xad4a('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xad4a('0x6')]},'path':{'type':Sequelize[_0xad4a('0x2')],'comment':_0xad4a('0x7')},'active':{'type':Sequelize[_0xad4a('0x8')],'defaultValue':0x0,'comment':_0xad4a('0x9')},'sidebar':{'type':Sequelize[_0xad4a('0x3')](_0xad4a('0xa'),_0xad4a('0xb'),_0xad4a('0xc'),_0xad4a('0xd')),'defaultValue':_0xad4a('0xc'),'comment':_0xad4a('0xe')},'icon':{'type':Sequelize[_0xad4a('0x2')]},'adminUrl':{'type':Sequelize[_0xad4a('0x2')]},'agentUrl':{'type':Sequelize[_0xad4a('0x2')]},'scriptName':{'type':Sequelize[_0xad4a('0x2')]},'scriptPath':{'type':Sequelize[_0xad4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 1332205..17e7d77 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 _0x5dea=['send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','Plugin','catch','show','params','length','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','Plugin\x20manifest\x20missing','manifest.json','undefined','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','test','plugins','scriptPath','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','%s%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','squel','crypto','jsforce','desk.js','to-csv','querystring','archiver','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','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','name'];(function(_0x57d399,_0x40071c){var _0x3a3fa9=function(_0x5ed659){while(--_0x5ed659){_0x57d399['push'](_0x57d399['shift']());}};_0x3a3fa9(++_0x40071c);}(_0x5dea,0x1bc));var _0xa5de=function(_0x380bd6,_0x15dff9){_0x380bd6=_0x380bd6-0x0;var _0x4b8d66=_0x5dea[_0x380bd6];return _0x4b8d66;};'use strict';var pdf=require(_0xa5de('0x0'));var emlformat=require(_0xa5de('0x1'));var rimraf=require(_0xa5de('0x2'));var zipdir=require(_0xa5de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5de('0x4'));var moment=require(_0xa5de('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa5de('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa5de('0x7'));var crypto=require(_0xa5de('0x8'));var jsforce=require(_0xa5de('0x9'));var deskjs=require(_0xa5de('0xa'));var toCsv=require(_0xa5de('0xb'));var querystring=require(_0xa5de('0xc'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xa5de('0x2'));var archiver=require(_0xa5de('0xd'));var Redis=require(_0xa5de('0xe'));var authService=require(_0xa5de('0xf'));var qs=require(_0xa5de('0x10'));var as=require(_0xa5de('0x11'));var hardwareService=require(_0xa5de('0x12'));var logger=require(_0xa5de('0x13'))(_0xa5de('0x14'));var utils=require(_0xa5de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa5de('0x16'));var db=require(_0xa5de('0x17'))['db'];config[_0xa5de('0x18')]=_[_0xa5de('0x19')](config[_0xa5de('0x18')],{'host':_0xa5de('0x1a'),'port':0x18eb});var socket=require(_0xa5de('0x1b'))(new Redis(config[_0xa5de('0x18')]));require(_0xa5de('0x1c'))['register'](socket);function respondWithStatusCode(_0xa461e2,_0xb5b0f4){_0xb5b0f4=_0xb5b0f4||0xcc;return function(_0x1e6c1e){if(_0x1e6c1e){return _0xa461e2[_0xa5de('0x1d')](_0xb5b0f4);}return _0xa461e2[_0xa5de('0x1e')](_0xb5b0f4)[_0xa5de('0x1f')]();};}function respondWithResult(_0x108fb7,_0x1a5a4e){_0x1a5a4e=_0x1a5a4e||0xc8;return function(_0x560f20){if(_0x560f20){return _0x108fb7[_0xa5de('0x1e')](_0x1a5a4e)[_0xa5de('0x20')](_0x560f20);}};}function respondWithFilteredResult(_0xb9188,_0xa5efea){return function(_0x1ef20b){if(_0x1ef20b){var _0x55e61b=_0x1ef20b[_0xa5de('0x21')],_0x18cd89=_0xa5efea[_0xa5de('0x22')],_0x3d7b1=_0xa5efea[_0xa5de('0x22')]+_0xa5efea['limit'],_0xa25097;if(_0x3d7b1>=_0x55e61b){_0x3d7b1=_0x55e61b;_0xa25097=0xc8;}else{_0xa25097=0xce;}_0xb9188[_0xa5de('0x1e')](_0xa25097);return _0xb9188[_0xa5de('0x23')](_0xa5de('0x24'),_0x18cd89+'-'+_0x3d7b1+'/'+_0x55e61b)[_0xa5de('0x20')](_0x1ef20b);}return null;};}function patchUpdates(_0x34427b){return function(_0x35f3dc){try{jsonpatch[_0xa5de('0x25')](_0x35f3dc,_0x34427b,!![]);}catch(_0xea4906){return BPromise[_0xa5de('0x26')](_0xea4906);}return _0x35f3dc[_0xa5de('0x27')]();};}function saveUpdates(_0x429fd3,_0x5a8d84){return function(_0x34b171){if(_0x34b171){return _0x34b171[_0xa5de('0x28')](_0x429fd3)[_0xa5de('0x29')](function(_0x330a16){return _0x330a16;});}return null;};}function removeEntity(_0x1f3538,_0x31091a){return function(_0x44f9af){if(_0x44f9af){return _0x44f9af[_0xa5de('0x2a')]()[_0xa5de('0x29')](function(){var _0x52a53d=_0x44f9af[_0xa5de('0x2b')]({'plain':!![]});var _0x5bbc38=_0xa5de('0x2c');return db[_0xa5de('0x2d')]['destroy']({'where':{'type':_0x5bbc38,'resourceId':_0x52a53d['id']}})['then'](function(){return _0x44f9af;});})[_0xa5de('0x29')](function(){_0x1f3538[_0xa5de('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea7da,_0x3d07e5){return function(_0x18c086){if(!_0x18c086){_0x1ea7da[_0xa5de('0x1d')](0x194);}return _0x18c086;};}function handleError(_0x2e0dc9,_0x176db1){_0x176db1=_0x176db1||0x1f4;return function(_0x51789c){logger[_0xa5de('0x2e')](_0x51789c['stack']);if(_0x51789c[_0xa5de('0x2f')]){delete _0x51789c[_0xa5de('0x2f')];}_0x2e0dc9[_0xa5de('0x1e')](_0x176db1)[_0xa5de('0x30')](_0x51789c);};}exports[_0xa5de('0x31')]=function(_0x4468e4,_0x592a86){var _0x5ebba9={},_0x40c6f8={},_0x39401a={'count':0x0,'rows':[]};var _0x4ebc55=_[_0xa5de('0x32')](db['Plugin']['rawAttributes'],function(_0x19c804){return{'name':_0x19c804[_0xa5de('0x33')],'type':_0x19c804[_0xa5de('0x34')][_0xa5de('0x35')]};});_0x40c6f8[_0xa5de('0x36')]=_['map'](_0x4ebc55,'name');_0x40c6f8[_0xa5de('0x37')]=_['keys'](_0x4468e4[_0xa5de('0x37')]);_0x40c6f8['filters']=_[_0xa5de('0x38')](_0x40c6f8[_0xa5de('0x36')],_0x40c6f8[_0xa5de('0x37')]);_0x5ebba9[_0xa5de('0x39')]=_[_0xa5de('0x38')](_0x40c6f8[_0xa5de('0x36')],qs[_0xa5de('0x3a')](_0x4468e4['query']['fields']));_0x5ebba9[_0xa5de('0x39')]=_0x5ebba9[_0xa5de('0x39')]['length']?_0x5ebba9[_0xa5de('0x39')]:_0x40c6f8[_0xa5de('0x36')];if(!_0x4468e4[_0xa5de('0x37')]['hasOwnProperty'](_0xa5de('0x3b'))){_0x5ebba9[_0xa5de('0x3c')]=qs['limit'](_0x4468e4[_0xa5de('0x37')][_0xa5de('0x3c')]);_0x5ebba9[_0xa5de('0x22')]=qs[_0xa5de('0x22')](_0x4468e4[_0xa5de('0x37')][_0xa5de('0x22')]);}_0x5ebba9['order']=qs[_0xa5de('0x3d')](_0x4468e4[_0xa5de('0x37')][_0xa5de('0x3d')]);_0x5ebba9[_0xa5de('0x3e')]=qs[_0xa5de('0x3f')](_[_0xa5de('0x40')](_0x4468e4[_0xa5de('0x37')],_0x40c6f8['filters']),_0x4ebc55);if(_0x4468e4[_0xa5de('0x37')][_0xa5de('0x41')]){_0x5ebba9[_0xa5de('0x3e')]=_['merge'](_0x5ebba9[_0xa5de('0x3e')],{'$or':_[_0xa5de('0x32')](_0x4ebc55,function(_0x2cc571){if(_0x2cc571[_0xa5de('0x34')]!=='VIRTUAL'){var _0xd3e2d0={};_0xd3e2d0[_0x2cc571[_0xa5de('0x2f')]]={'$like':'%'+_0x4468e4['query'][_0xa5de('0x41')]+'%'};return _0xd3e2d0;}})});}_0x5ebba9=_[_0xa5de('0x42')]({},_0x5ebba9,_0x4468e4[_0xa5de('0x43')]);var _0x57612c={'where':_0x5ebba9[_0xa5de('0x3e')]};return db['Plugin']['count'](_0x57612c)['then'](function(_0x4675fd){_0x39401a[_0xa5de('0x21')]=_0x4675fd;if(_0x4468e4[_0xa5de('0x37')][_0xa5de('0x44')]){_0x5ebba9[_0xa5de('0x45')]=[{'all':!![]}];}return db[_0xa5de('0x46')]['findAll'](_0x5ebba9);})[_0xa5de('0x29')](function(_0x545e2d){_0x39401a['rows']=_0x545e2d;return _0x39401a;})[_0xa5de('0x29')](respondWithFilteredResult(_0x592a86,_0x5ebba9))[_0xa5de('0x47')](handleError(_0x592a86,null));};exports[_0xa5de('0x48')]=function(_0x95d1fa,_0x2c4fef){var _0x1c5fa4={'raw':!![],'where':{'id':_0x95d1fa[_0xa5de('0x49')]['id']}},_0xc51229={};_0xc51229[_0xa5de('0x36')]=_['keys'](db[_0xa5de('0x46')]['rawAttributes']);_0xc51229['query']=_['keys'](_0x95d1fa[_0xa5de('0x37')]);_0xc51229[_0xa5de('0x3f')]=_[_0xa5de('0x38')](_0xc51229['model'],_0xc51229[_0xa5de('0x37')]);_0x1c5fa4['attributes']=_[_0xa5de('0x38')](_0xc51229['model'],qs[_0xa5de('0x3a')](_0x95d1fa[_0xa5de('0x37')]['fields']));_0x1c5fa4[_0xa5de('0x39')]=_0x1c5fa4[_0xa5de('0x39')][_0xa5de('0x4a')]?_0x1c5fa4['attributes']:_0xc51229['model'];if(_0x95d1fa['query'][_0xa5de('0x44')]){_0x1c5fa4[_0xa5de('0x45')]=[{'all':!![]}];}_0x1c5fa4=_['merge']({},_0x1c5fa4,_0x95d1fa[_0xa5de('0x43')]);return db[_0xa5de('0x46')][_0xa5de('0x4b')](_0x1c5fa4)[_0xa5de('0x29')](handleEntityNotFound(_0x2c4fef,null))[_0xa5de('0x29')](respondWithResult(_0x2c4fef,null))['catch'](handleError(_0x2c4fef,null));};exports[_0xa5de('0x4c')]=function(_0x568e56,_0x3b66dd,_0x310ce0){return db[_0xa5de('0x46')][_0xa5de('0x4b')]({'where':{'id':_0x568e56[_0xa5de('0x49')]['id']},'attributes':[_0xa5de('0x2f'),_0xa5de('0x6')],'raw':!![]})[_0xa5de('0x29')](handleEntityNotFound(_0x3b66dd,null))[_0xa5de('0x29')](function(_0x1ec667){if(_0x1ec667){var _0x37a228=path[_0xa5de('0x4d')](config[_0xa5de('0x4e')],_0xa5de('0x4f'),util['format'](_0xa5de('0x50'),path[_0xa5de('0x51')](_0x1ec667[_0xa5de('0x6')])));var _0x46b4e1=fs[_0xa5de('0x52')](_0x37a228);var _0x3392af=archiver(_0xa5de('0x53'),{'zlib':{'level':0x9}});_0x3392af['on']('warning',function(_0x2bc515){if(_0x2bc515[_0xa5de('0x54')]===_0xa5de('0x55')){logger['error'](_0x2bc515);}else{throw new db[(_0xa5de('0x56'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x3392af['on'](_0xa5de('0x2e'),function(_0x32294a){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x3392af[_0xa5de('0x57')](_0x46b4e1);_0x3392af[_0xa5de('0x58')]('**/*',{'cwd':path[_0xa5de('0x4d')](config['root'],'server/files/plugins',path[_0xa5de('0x59')](_0x1ec667[_0xa5de('0x6')])),'ignore':[path[_0xa5de('0x4d')](path[_0xa5de('0x51')](_0x1ec667[_0xa5de('0x6')]),_0xa5de('0x5a')),path[_0xa5de('0x4d')](path['basename'](_0x1ec667['path']),_0xa5de('0x5b'))],'nodir':!![]})[_0xa5de('0x5c')]();_0x46b4e1['on'](_0xa5de('0x5d'),function(){if(!fs[_0xa5de('0x5e')](_0x37a228)){throw new db[(_0xa5de('0x56'))][(_0xa5de('0x5f'))]('Plugin\x20not\x20found');}return _0x3b66dd[_0xa5de('0x4c')](_0x37a228,util[_0xa5de('0x60')](_0xa5de('0x50'),path[_0xa5de('0x51')](_0x1ec667[_0xa5de('0x6')])),function(_0x5eaad3){if(_0x5eaad3){throw new db['Sequelize'][(_0xa5de('0x5f'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xa5de('0x61')](_0x37a228);logger[_0xa5de('0x62')](_0xa5de('0x63'));logger[_0xa5de('0x62')](_0xa5de('0x64'));});});}return null;})[_0xa5de('0x47')](handleError(_0x3b66dd,null));};exports[_0xa5de('0x65')]=function(_0x11567d,_0x5a4847,_0x1acd08){var _0xf7624c=path['basename'](_0x11567d[_0xa5de('0x66')][_0xa5de('0x67')],path[_0xa5de('0x68')](_0x11567d[_0xa5de('0x66')][_0xa5de('0x67')]));var _0x221bef=path[_0xa5de('0x4d')](config[_0xa5de('0x4e')],_0xa5de('0x4f'),_0x11567d[_0xa5de('0x66')][_0xa5de('0x67')]);var _0x58543a=path[_0xa5de('0x4d')](config[_0xa5de('0x4e')],_0xa5de('0x4f'),_0xf7624c);logger['info'](_0xa5de('0x69'),_0x221bef);logger['info'](_0xa5de('0x6a'),_0x58543a);try{fs[_0xa5de('0x6b')](_0x221bef,parseInt(_0xa5de('0x6c'),0x8));extract(_0x221bef,{'dir':_0x58543a},function(_0x1e33d2){if(_0x1e33d2){logger['error'](_0x1e33d2);handleError(_0x1e33d2,!![]);};var _0x337331=fs[_0xa5de('0x6d')](_0x58543a);if(_0x337331[_0xa5de('0x4a')]>0x1){removeReferences(_0x221bef,_0x58543a);logger['error']('Invalid\x20plugin\x20structure');return _0x1acd08(new Error(_0xa5de('0x6e')));}var _0x476a13=fs[_0xa5de('0x6f')](path[_0xa5de('0x4d')](_0x58543a,_0x337331[0x0]));if(_0x476a13[_0xa5de('0x70')]()){removeReferences(_0x221bef,_0x58543a);logger[_0xa5de('0x2e')]('Invalid\x20plugin\x20structure');return _0x1acd08(new Error(_0xa5de('0x6e')));}if(_0x476a13['isDirectory']()){var _0x2d0586=fs[_0xa5de('0x6d')](path[_0xa5de('0x4d')](_0x58543a,_0x337331[0x0]));if(_0x2d0586[_0xa5de('0x4a')]===0x0){removeReferences(_0x221bef,_0x58543a);logger[_0xa5de('0x2e')](_0xa5de('0x6e'));return _0x1acd08(new Error(_0xa5de('0x6e')));}var _0x41d4a5=_0x2d0586[_0xa5de('0x71')](function(_0x5ba529){return _0x5ba529==='manifest.json';});if(!_0x41d4a5){return _0x1acd08(new Error(_0xa5de('0x72')));}var _0x58baab=fs['readFileSync'](path[_0xa5de('0x4d')](_0x58543a,_0x337331[0x0],_0xa5de('0x73')));var _0x32a3e9=JSON['parse'](_0x58baab);if(_0xa5de('0x74')==typeof _0x32a3e9[_0xa5de('0x2f')]){return _0x1acd08(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xa5de('0x74')==typeof _0x32a3e9[_0xa5de('0x34')]){return _0x1acd08(new Error(_0xa5de('0x75')));}if(_0xa5de('0x74')==typeof _0x32a3e9['version']){return _0x1acd08(new Error(_0xa5de('0x76')));}if(_0xa5de('0x74')==typeof _0x32a3e9[_0xa5de('0x77')]){return _0x1acd08(new Error(_0xa5de('0x78')));}if(_0x32a3e9[_0xa5de('0x34')]===_0xa5de('0x79')){if(_0xa5de('0x74')==typeof _0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')]){return _0x1acd08(new Error(_0xa5de('0x7b')));}if(_0xa5de('0x74')==typeof _0x32a3e9['parameters'][_0xa5de('0x7a')][_0xa5de('0x7c')]&&_0xa5de('0x74')==typeof _0x32a3e9[_0xa5de('0x77')]['views'][_0xa5de('0x7d')]){return _0x1acd08(new Error(_0xa5de('0x7e')));}}else if(_0x32a3e9[_0xa5de('0x34')]===_0xa5de('0x7f')){if(_0xa5de('0x74')==typeof _0x32a3e9[_0xa5de('0x77')][_0xa5de('0x80')]){return _0x1acd08(new Error(_0xa5de('0x81')));}if(_0xa5de('0x74')==typeof _0x32a3e9[_0xa5de('0x77')]['scriptPath']){return _0x1acd08(new Error(_0xa5de('0x82')));}}else{return _0x1acd08(new Error(_0xa5de('0x83')));}var _0x3beacf=_0x32a3e9[_0xa5de('0x2f')];var _0x5d7594=_0x32a3e9['description'];var _0x2bac92=_0x32a3e9['type'];var _0x48d443=_0x32a3e9[_0xa5de('0x84')]?_0x32a3e9[_0xa5de('0x84')]:_0xa5de('0x85');var _0x38ab3d=_0x32a3e9[_0xa5de('0x86')]?_0x32a3e9[_0xa5de('0x86')]:_0xa5de('0x87');var _0x4ce717='';var _0x40c119='';var _0x5cdb14='';var _0x28417e='';var _0x40a67c=_0x32a3e9[_0xa5de('0x88')];if(_0x2bac92===_0xa5de('0x79')){if(_0xa5de('0x74')!=typeof _0x32a3e9[_0xa5de('0x77')]['views'][_0xa5de('0x7c')]){var _0x1e2373=_0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa5de('0x89')](_0x1e2373)){_0x4ce717=path['join'](_0xa5de('0x8a'),_0xf7624c,_0x337331[0x0],_0x1e2373);}else{_0x4ce717=_0x1e2373;}}else{logger[_0xa5de('0x62')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')][_0xa5de('0x7d')]){var _0x5e7343=_0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')][_0xa5de('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xa5de('0x89')](_0x5e7343)){_0x40c119=path[_0xa5de('0x4d')](_0xa5de('0x8a'),_0xf7624c,_0x337331[0x0],_0x5e7343);}else{_0x40c119=_0x5e7343;}}else{logger[_0xa5de('0x62')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2bac92===_0xa5de('0x7f')){_0x5cdb14=_0x32a3e9[_0xa5de('0x77')][_0xa5de('0x80')];_0x28417e=_0x32a3e9['parameters'][_0xa5de('0x8b')];if(_0xa5de('0x74')!=typeof _0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')]){if('undefined'!=typeof _0x32a3e9['parameters']['views'][_0xa5de('0x7c')]){var _0x1e2373=_0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')][_0xa5de('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xa5de('0x89')](_0x1e2373)){_0x4ce717=path[_0xa5de('0x4d')](_0xa5de('0x8a'),_0xf7624c,_0x337331[0x0],_0x1e2373);}else{_0x4ce717=_0x1e2373;}}if(_0xa5de('0x74')!=typeof _0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')][_0xa5de('0x7d')]){var _0x5e7343=_0x32a3e9[_0xa5de('0x77')][_0xa5de('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa5de('0x89')](_0x5e7343)){_0x40c119=path[_0xa5de('0x4d')](_0xa5de('0x8a'),_0xf7624c,_0x337331[0x0],_0x5e7343);}else{_0x40c119=_0x5e7343;}}}}var _0x37a780={'name':_0x3beacf,'description':_0x5d7594,'path':path['join'](_0xf7624c,_0x337331[0x0]),'type':_0x2bac92,'sidebar':_0x48d443,'icon':_0x38ab3d,'adminUrl':_0x4ce717,'agentUrl':_0x40c119,'scriptName':_0x5cdb14,'scriptPath':_0x28417e,'version':_0x40a67c};removeReferences(_0x221bef,null);return db[_0xa5de('0x46')][_0xa5de('0x8c')](_0x37a780)[_0xa5de('0x29')](function(_0x3a60d7){var _0x29d46b={'role':_0x11567d['body'][_0xa5de('0x8d')],'userProfileId':_0x11567d['body'][_0xa5de('0x8e')]};if(!_0x29d46b)throw new Error(_0xa5de('0x8f'));if(_0x29d46b[_0xa5de('0x8d')]===_0xa5de('0x90')){var _0xd3bd5c=_0x3a60d7['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Plugins','userProfileId':_0x29d46b['userProfileId']},'raw':!![]})[_0xa5de('0x29')](function(_0x52ab10){if(_0x52ab10&&_0x52ab10[_0xa5de('0x91')]===0x0){return db['UserProfileResource'][_0xa5de('0x8c')]({'name':_0xd3bd5c[_0xa5de('0x2f')],'resourceId':_0xd3bd5c['id'],'type':_0x52ab10[_0xa5de('0x2f')],'sectionId':_0x52ab10['id']},{})[_0xa5de('0x29')](function(){return _0x3a60d7;});}else{return _0x3a60d7;}})[_0xa5de('0x47')](function(_0x27c44d){logger[_0xa5de('0x2e')](_0xa5de('0x92'),_0x27c44d);throw _0x27c44d;});}return _0x3a60d7;})['then'](respondWithResult(_0x5a4847,null))['catch'](handleError(_0x5a4847,null));}});}catch(_0x4456b6){_0x5a4847[_0xa5de('0x1e')](0x1f4)[_0xa5de('0x30')](_0x4456b6);}};function removeReferences(_0xbac1b1,_0x2caea7){try{if(_0xbac1b1){fs[_0xa5de('0x61')](_0xbac1b1);logger[_0xa5de('0x62')](_0xa5de('0x93'));}if(_0x2caea7){rimraf(_0x2caea7,function(){});logger[_0xa5de('0x62')](_0xa5de('0x94'));}}catch(_0x75d086){logger[_0xa5de('0x2e')](_0x75d086);}}exports[_0xa5de('0x28')]=function(_0x2be8eb,_0xc0939f,_0x577623){return db[_0xa5de('0x46')][_0xa5de('0x4b')]({'where':{'id':_0x2be8eb['params']['id']}})[_0xa5de('0x29')](handleEntityNotFound(_0xc0939f,null))[_0xa5de('0x29')](saveUpdates(_0x2be8eb[_0xa5de('0x95')],null))[_0xa5de('0x29')](respondWithResult(_0xc0939f,null))['catch'](handleError(_0xc0939f,null));};exports['delete']=function(_0x32ae35,_0x299ec5,_0x23d44d){return db[_0xa5de('0x46')][_0xa5de('0x4b')]({'where':{'id':_0x32ae35[_0xa5de('0x49')]['id']}})[_0xa5de('0x29')](function(_0x446c36){if(_0x446c36){return _0x446c36[_0xa5de('0x2a')]();}})[_0xa5de('0x29')](function(_0x44ba46){rimraf(path[_0xa5de('0x4d')](config[_0xa5de('0x4e')],_0xa5de('0x4f'),path['dirname'](_0x44ba46[_0xa5de('0x6')])),function(){});return _0x44ba46;})[_0xa5de('0x29')](handleEntityNotFound(_0x299ec5,null))[_0xa5de('0x29')](respondWithStatusCode(_0x299ec5,null))['catch'](handleError(_0x299ec5,null));};exports[_0xa5de('0x96')]=function(_0x462f13,_0x38064a,_0x5958a1){return BPromise['resolve']()[_0xa5de('0x29')](function(){if(!_0x462f13[_0xa5de('0x37')]['path']){throw new Error(_0xa5de('0x97'));}if(!_0x462f13['query'][_0xa5de('0x98')]){throw new Error(_0xa5de('0x99'));}var _0x278e33=_0x462f13['query'][_0xa5de('0x9a')]?_0x462f13[_0xa5de('0x37')]['hostname']+':'+_0x462f13[_0xa5de('0x37')][_0xa5de('0x98')]:_0xa5de('0x9b')+_0x462f13[_0xa5de('0x37')]['port'];var _0x1a9580=_0x462f13[_0xa5de('0x37')][_0xa5de('0x20')]?_0x462f13[_0xa5de('0x37')][_0xa5de('0x20')]:!![];var _0x20aae5=_0x462f13['query'][_0xa5de('0x9c')]?_0x462f13['query'][_0xa5de('0x9c')]:null;var _0x474fc5={'method':_0x462f13[_0xa5de('0x9d')],'uri':util[_0xa5de('0x60')]('%s%s',_0x278e33,_0x462f13[_0xa5de('0x37')]['path']),'json':_0x1a9580,'resolveWithFullResponse':!![],'encoding':_0x20aae5,'qs':_0x462f13[_0xa5de('0x37')]};if(_0x462f13[_0xa5de('0x9e')]){_0x474fc5[_0xa5de('0x9e')]=_0x462f13['headers'];if(_0x474fc5[_0xa5de('0x9e')][_0xa5de('0x9f')]){delete _0x474fc5['headers'][_0xa5de('0x9f')];}}if(_0x474fc5[_0xa5de('0x9e')][_0xa5de('0xa0')]){delete _0x474fc5[_0xa5de('0x9e')]['content-type'];}return rp(_0x474fc5);})['then'](function(_0x12cbd4){if(_0x12cbd4){_0x38064a[_0xa5de('0x23')](_0x12cbd4[_0xa5de('0x9e')]);logger[_0xa5de('0x62')](_0x12cbd4[_0xa5de('0x95')]);if(_[_0xa5de('0xa1')](_0x462f13[_0xa5de('0x37')][_0xa5de('0x6')],_0xa5de('0x4c'))&&_0x12cbd4[_0xa5de('0xa2')]==0x1f4){return _0x38064a[_0xa5de('0x1d')](_0x12cbd4[_0xa5de('0xa2')]);}else{return _0x38064a[_0xa5de('0x1e')](_0x12cbd4['statusCode'])[_0xa5de('0x30')](_0x12cbd4[_0xa5de('0x95')]);}}else{return _0x38064a[_0xa5de('0x1d')](0xc8);}})[_0xa5de('0x47')](handleError(_0x38064a,null));};exports['webhookPost']=function(_0x389e1c,_0x3c5936,_0xf666e6){return BPromise['resolve']()[_0xa5de('0x29')](function(){if(!_0x389e1c[_0xa5de('0x37')][_0xa5de('0x6')]){throw new Error(_0xa5de('0x97'));}if(!_0x389e1c[_0xa5de('0x37')][_0xa5de('0x98')]){throw new Error(_0xa5de('0x99'));}var _0x24c484=_0x389e1c[_0xa5de('0x37')][_0xa5de('0x9a')]?_0x389e1c['query']['hostname']+':'+_0x389e1c[_0xa5de('0x37')]['port']:_0xa5de('0x9b')+_0x389e1c[_0xa5de('0x37')][_0xa5de('0x98')];var _0x4a86da=_0x389e1c[_0xa5de('0x37')][_0xa5de('0x20')]?_0x389e1c[_0xa5de('0x37')][_0xa5de('0x20')]:!![];var _0x546a05=_0x389e1c[_0xa5de('0x37')][_0xa5de('0x9c')]?_0x389e1c[_0xa5de('0x37')][_0xa5de('0x9c')]:null;var _0xd5027={'method':_0x389e1c[_0xa5de('0x9d')],'uri':util['format'](_0xa5de('0xa3'),_0x24c484,_0x389e1c[_0xa5de('0x37')]['path']),'json':_0x4a86da,'resolveWithFullResponse':!![],'encoding':_0x546a05,'body':_0x389e1c[_0xa5de('0x95')]};if(_0x389e1c[_0xa5de('0x9e')]){_0xd5027[_0xa5de('0x9e')]=_0x389e1c[_0xa5de('0x9e')];if(_0xd5027['headers']['content-length']){delete _0xd5027[_0xa5de('0x9e')][_0xa5de('0x9f')];}}if(_0xd5027['headers'][_0xa5de('0xa0')]){delete _0xd5027[_0xa5de('0x9e')][_0xa5de('0xa0')];}return rp(_0xd5027);})[_0xa5de('0x29')](function(_0x4ffe6b){if(_0x4ffe6b){_0x3c5936[_0xa5de('0x23')](_0x4ffe6b[_0xa5de('0x9e')]);logger[_0xa5de('0x62')](_0x4ffe6b[_0xa5de('0x95')]);return _0x3c5936[_0xa5de('0x1e')](_0x4ffe6b['statusCode'])[_0xa5de('0x30')](_0x4ffe6b[_0xa5de('0x95')]);}else{return _0x3c5936[_0xa5de('0x1d')](0xc8);}})[_0xa5de('0x47')](handleError(_0x3c5936,null));}; \ No newline at end of file +var _0x8fcd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','status','end','json','count','offset','limit','set','save','update','then','get','Plugins','sendStatus','error','name','send','index','Plugin','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','keys','fields','includeAll','include','find','params','path','root','%s.zip','basename','createWriteStream','zip','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','format','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','filename','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','length','Invalid\x20plugin\x20structure','lstatSync','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','undefined','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','always','icon','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x8fcd,0x139));var _0xd8fc=function(_0x5587cb,_0x4c6c7a){_0x5587cb=_0x5587cb-0x0;var _0x580052=_0x8fcd[_0x5587cb];return _0x580052;};'use strict';var pdf=require(_0xd8fc('0x0'));var emlformat=require(_0xd8fc('0x1'));var rimraf=require(_0xd8fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8fc('0x3'));var rp=require(_0xd8fc('0x4'));var moment=require(_0xd8fc('0x5'));var BPromise=require(_0xd8fc('0x6'));var Mustache=require('mustache');var util=require(_0xd8fc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd8fc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd8fc('0x9'));var squel=require(_0xd8fc('0xa'));var crypto=require(_0xd8fc('0xb'));var jsforce=require(_0xd8fc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd8fc('0xd'));var Papa=require(_0xd8fc('0xe'));var extract=require('extract-zip');var rimraf=require(_0xd8fc('0x2'));var archiver=require(_0xd8fc('0xf'));var Redis=require(_0xd8fc('0x10'));var authService=require(_0xd8fc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd8fc('0x12'));var hardwareService=require(_0xd8fc('0x13'));var logger=require(_0xd8fc('0x14'))(_0xd8fc('0x15'));var utils=require(_0xd8fc('0x16'));var config=require(_0xd8fc('0x17'));var licenseUtil=require(_0xd8fc('0x18'));var db=require(_0xd8fc('0x19'))['db'];config[_0xd8fc('0x1a')]=_[_0xd8fc('0x1b')](config[_0xd8fc('0x1a')],{'host':_0xd8fc('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8fc('0x1a')]));require(_0xd8fc('0x1d'))[_0xd8fc('0x1e')](socket);function respondWithStatusCode(_0x834138,_0x528432){_0x528432=_0x528432||0xcc;return function(_0x508022){if(_0x508022){return _0x834138['sendStatus'](_0x528432);}return _0x834138[_0xd8fc('0x1f')](_0x528432)[_0xd8fc('0x20')]();};}function respondWithResult(_0x56e77b,_0x128483){_0x128483=_0x128483||0xc8;return function(_0x4d4ae2){if(_0x4d4ae2){return _0x56e77b[_0xd8fc('0x1f')](_0x128483)[_0xd8fc('0x21')](_0x4d4ae2);}};}function respondWithFilteredResult(_0x4ace16,_0x23ec8a){return function(_0x3ae81a){if(_0x3ae81a){var _0x5d5835=_0x3ae81a[_0xd8fc('0x22')],_0x22fea8=_0x23ec8a['offset'],_0x28483d=_0x23ec8a[_0xd8fc('0x23')]+_0x23ec8a[_0xd8fc('0x24')],_0x17bbb5;if(_0x28483d>=_0x5d5835){_0x28483d=_0x5d5835;_0x17bbb5=0xc8;}else{_0x17bbb5=0xce;}_0x4ace16['status'](_0x17bbb5);return _0x4ace16[_0xd8fc('0x25')]('Content-Range',_0x22fea8+'-'+_0x28483d+'/'+_0x5d5835)[_0xd8fc('0x21')](_0x3ae81a);}return null;};}function patchUpdates(_0x28dc24){return function(_0x5bcaac){try{jsonpatch['apply'](_0x5bcaac,_0x28dc24,!![]);}catch(_0x30f152){return BPromise['reject'](_0x30f152);}return _0x5bcaac[_0xd8fc('0x26')]();};}function saveUpdates(_0x84162c,_0x11af14){return function(_0xe0bf46){if(_0xe0bf46){return _0xe0bf46[_0xd8fc('0x27')](_0x84162c)['then'](function(_0x53ebb){return _0x53ebb;});}return null;};}function removeEntity(_0x3e17d6,_0x31f905){return function(_0x250b6b){if(_0x250b6b){return _0x250b6b['destroy']()[_0xd8fc('0x28')](function(){var _0x1c42dd=_0x250b6b[_0xd8fc('0x29')]({'plain':!![]});var _0x222087=_0xd8fc('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x222087,'resourceId':_0x1c42dd['id']}})['then'](function(){return _0x250b6b;});})[_0xd8fc('0x28')](function(){_0x3e17d6[_0xd8fc('0x1f')](0xcc)[_0xd8fc('0x20')]();});}};}function handleEntityNotFound(_0x2b78ee,_0x37de60){return function(_0x244941){if(!_0x244941){_0x2b78ee[_0xd8fc('0x2b')](0x194);}return _0x244941;};}function handleError(_0x4141f3,_0x2d6aad){_0x2d6aad=_0x2d6aad||0x1f4;return function(_0x57bced){logger[_0xd8fc('0x2c')](_0x57bced['stack']);if(_0x57bced[_0xd8fc('0x2d')]){delete _0x57bced[_0xd8fc('0x2d')];}_0x4141f3[_0xd8fc('0x1f')](_0x2d6aad)[_0xd8fc('0x2e')](_0x57bced);};}exports[_0xd8fc('0x2f')]=function(_0x37bfd8,_0x356109){var _0x18b528={},_0x244c09={},_0x58cb16={'count':0x0,'rows':[]};var _0x342dd5=_['map'](db[_0xd8fc('0x30')][_0xd8fc('0x31')],function(_0x5e586c){return{'name':_0x5e586c[_0xd8fc('0x32')],'type':_0x5e586c[_0xd8fc('0x33')]['key']};});_0x244c09['model']=_[_0xd8fc('0x34')](_0x342dd5,'name');_0x244c09[_0xd8fc('0x35')]=_['keys'](_0x37bfd8[_0xd8fc('0x35')]);_0x244c09[_0xd8fc('0x36')]=_[_0xd8fc('0x37')](_0x244c09[_0xd8fc('0x38')],_0x244c09['query']);_0x18b528[_0xd8fc('0x39')]=_[_0xd8fc('0x37')](_0x244c09['model'],qs['fields'](_0x37bfd8[_0xd8fc('0x35')]['fields']));_0x18b528[_0xd8fc('0x39')]=_0x18b528[_0xd8fc('0x39')]['length']?_0x18b528[_0xd8fc('0x39')]:_0x244c09[_0xd8fc('0x38')];if(!_0x37bfd8[_0xd8fc('0x35')]['hasOwnProperty'](_0xd8fc('0x3a'))){_0x18b528[_0xd8fc('0x24')]=qs[_0xd8fc('0x24')](_0x37bfd8[_0xd8fc('0x35')][_0xd8fc('0x24')]);_0x18b528[_0xd8fc('0x23')]=qs[_0xd8fc('0x23')](_0x37bfd8[_0xd8fc('0x35')][_0xd8fc('0x23')]);}_0x18b528['order']=qs[_0xd8fc('0x3b')](_0x37bfd8[_0xd8fc('0x35')]['sort']);_0x18b528[_0xd8fc('0x3c')]=qs['filters'](_[_0xd8fc('0x3d')](_0x37bfd8[_0xd8fc('0x35')],_0x244c09[_0xd8fc('0x36')]),_0x342dd5);if(_0x37bfd8[_0xd8fc('0x35')][_0xd8fc('0x3e')]){_0x18b528[_0xd8fc('0x3c')]=_[_0xd8fc('0x3f')](_0x18b528[_0xd8fc('0x3c')],{'$or':_[_0xd8fc('0x34')](_0x342dd5,function(_0x1babc6){if(_0x1babc6[_0xd8fc('0x33')]!==_0xd8fc('0x40')){var _0x2d4c71={};_0x2d4c71[_0x1babc6['name']]={'$like':'%'+_0x37bfd8[_0xd8fc('0x35')][_0xd8fc('0x3e')]+'%'};return _0x2d4c71;}})});}_0x18b528=_[_0xd8fc('0x3f')]({},_0x18b528,_0x37bfd8[_0xd8fc('0x41')]);var _0x3bc995={'where':_0x18b528[_0xd8fc('0x3c')]};return db[_0xd8fc('0x30')][_0xd8fc('0x22')](_0x3bc995)['then'](function(_0x6ea3cb){_0x58cb16[_0xd8fc('0x22')]=_0x6ea3cb;if(_0x37bfd8[_0xd8fc('0x35')]['includeAll']){_0x18b528['include']=[{'all':!![]}];}return db['Plugin'][_0xd8fc('0x42')](_0x18b528);})[_0xd8fc('0x28')](function(_0x3e89f5){_0x58cb16[_0xd8fc('0x43')]=_0x3e89f5;return _0x58cb16;})[_0xd8fc('0x28')](respondWithFilteredResult(_0x356109,_0x18b528))[_0xd8fc('0x44')](handleError(_0x356109,null));};exports[_0xd8fc('0x45')]=function(_0x3c27c1,_0xdd7820){var _0x1b0c26={'raw':!![],'where':{'id':_0x3c27c1['params']['id']}},_0xbf821={};_0xbf821['model']=_[_0xd8fc('0x46')](db[_0xd8fc('0x30')][_0xd8fc('0x31')]);_0xbf821[_0xd8fc('0x35')]=_['keys'](_0x3c27c1[_0xd8fc('0x35')]);_0xbf821[_0xd8fc('0x36')]=_['intersection'](_0xbf821[_0xd8fc('0x38')],_0xbf821['query']);_0x1b0c26[_0xd8fc('0x39')]=_[_0xd8fc('0x37')](_0xbf821[_0xd8fc('0x38')],qs[_0xd8fc('0x47')](_0x3c27c1[_0xd8fc('0x35')][_0xd8fc('0x47')]));_0x1b0c26[_0xd8fc('0x39')]=_0x1b0c26[_0xd8fc('0x39')]['length']?_0x1b0c26['attributes']:_0xbf821[_0xd8fc('0x38')];if(_0x3c27c1[_0xd8fc('0x35')][_0xd8fc('0x48')]){_0x1b0c26[_0xd8fc('0x49')]=[{'all':!![]}];}_0x1b0c26=_[_0xd8fc('0x3f')]({},_0x1b0c26,_0x3c27c1[_0xd8fc('0x41')]);return db[_0xd8fc('0x30')][_0xd8fc('0x4a')](_0x1b0c26)[_0xd8fc('0x28')](handleEntityNotFound(_0xdd7820,null))[_0xd8fc('0x28')](respondWithResult(_0xdd7820,null))[_0xd8fc('0x44')](handleError(_0xdd7820,null));};exports['download']=function(_0xa3033d,_0xec63ab,_0x14f1c7){return db['Plugin']['find']({'where':{'id':_0xa3033d[_0xd8fc('0x4b')]['id']},'attributes':[_0xd8fc('0x2d'),_0xd8fc('0x4c')],'raw':!![]})[_0xd8fc('0x28')](handleEntityNotFound(_0xec63ab,null))[_0xd8fc('0x28')](function(_0x281132){if(_0x281132){var _0x54838d=path['join'](config[_0xd8fc('0x4d')],'server/files/plugins',util['format'](_0xd8fc('0x4e'),path[_0xd8fc('0x4f')](_0x281132[_0xd8fc('0x4c')])));var _0x41a034=fs[_0xd8fc('0x50')](_0x54838d);var _0x90a113=archiver(_0xd8fc('0x51'),{'zlib':{'level':0x9}});_0x90a113['on']('warning',function(_0x4b1129){if(_0x4b1129[_0xd8fc('0x52')]===_0xd8fc('0x53')){logger[_0xd8fc('0x2c')](_0x4b1129);}else{throw new db['Sequelize'][(_0xd8fc('0x54'))](_0xd8fc('0x55'));}});_0x90a113['on'](_0xd8fc('0x2c'),function(_0x3ad468){throw new db['Sequelize'][(_0xd8fc('0x54'))](_0xd8fc('0x55'));});_0x90a113[_0xd8fc('0x56')](_0x41a034);_0x90a113[_0xd8fc('0x57')](_0xd8fc('0x58'),{'cwd':path[_0xd8fc('0x59')](config[_0xd8fc('0x4d')],_0xd8fc('0x5a'),path[_0xd8fc('0x5b')](_0x281132[_0xd8fc('0x4c')])),'ignore':[path[_0xd8fc('0x59')](path[_0xd8fc('0x4f')](_0x281132[_0xd8fc('0x4c')]),_0xd8fc('0x5c')),path[_0xd8fc('0x59')](path[_0xd8fc('0x4f')](_0x281132[_0xd8fc('0x4c')]),_0xd8fc('0x5d'))],'nodir':!![]})[_0xd8fc('0x5e')]();_0x41a034['on'](_0xd8fc('0x5f'),function(){if(!fs[_0xd8fc('0x60')](_0x54838d)){throw new db['Sequelize'][(_0xd8fc('0x54'))]('Plugin\x20not\x20found');}return _0xec63ab[_0xd8fc('0x61')](_0x54838d,util[_0xd8fc('0x62')]('%s.zip',path[_0xd8fc('0x4f')](_0x281132[_0xd8fc('0x4c')])),function(_0x15e1bf){if(_0x15e1bf){throw new db[(_0xd8fc('0x63'))][(_0xd8fc('0x54'))](_0xd8fc('0x64'));}fs[_0xd8fc('0x65')](_0x54838d);logger['info'](_0xd8fc('0x66'));logger[_0xd8fc('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xd8fc('0x44')](handleError(_0xec63ab,null));};exports['upload']=function(_0x1eba3a,_0xd3dde3,_0x5cc93c){var _0x2b7990=path[_0xd8fc('0x4f')](_0x1eba3a['file'][_0xd8fc('0x68')],path['extname'](_0x1eba3a['file'][_0xd8fc('0x68')]));var _0x329e6b=path[_0xd8fc('0x59')](config['root'],_0xd8fc('0x5a'),_0x1eba3a[_0xd8fc('0x69')][_0xd8fc('0x68')]);var _0x42d2ba=path[_0xd8fc('0x59')](config['root'],_0xd8fc('0x5a'),_0x2b7990);logger[_0xd8fc('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x329e6b);logger[_0xd8fc('0x67')](_0xd8fc('0x6a'),_0x42d2ba);try{fs[_0xd8fc('0x6b')](_0x329e6b,parseInt(_0xd8fc('0x6c'),0x8));extract(_0x329e6b,{'dir':_0x42d2ba},function(_0x1731df){if(_0x1731df){logger[_0xd8fc('0x2c')](_0x1731df);handleError(_0x1731df,!![]);};var _0x3dfa3d=fs['readdirSync'](_0x42d2ba);if(_0x3dfa3d[_0xd8fc('0x6d')]>0x1){removeReferences(_0x329e6b,_0x42d2ba);logger[_0xd8fc('0x2c')](_0xd8fc('0x6e'));return _0x5cc93c(new Error('Invalid\x20plugin\x20structure'));}var _0x36d960=fs[_0xd8fc('0x6f')](path['join'](_0x42d2ba,_0x3dfa3d[0x0]));if(_0x36d960['isFile']()){removeReferences(_0x329e6b,_0x42d2ba);logger[_0xd8fc('0x2c')](_0xd8fc('0x6e'));return _0x5cc93c(new Error('Invalid\x20plugin\x20structure'));}if(_0x36d960['isDirectory']()){var _0x272256=fs[_0xd8fc('0x70')](path[_0xd8fc('0x59')](_0x42d2ba,_0x3dfa3d[0x0]));if(_0x272256['length']===0x0){removeReferences(_0x329e6b,_0x42d2ba);logger[_0xd8fc('0x2c')](_0xd8fc('0x6e'));return _0x5cc93c(new Error(_0xd8fc('0x6e')));}var _0x454b68=_0x272256[_0xd8fc('0x71')](function(_0x2a756e){return _0x2a756e===_0xd8fc('0x72');});if(!_0x454b68){return _0x5cc93c(new Error(_0xd8fc('0x73')));}var _0x4e7dc7=fs[_0xd8fc('0x74')](path[_0xd8fc('0x59')](_0x42d2ba,_0x3dfa3d[0x0],'manifest.json'));var _0x2ece22=JSON['parse'](_0x4e7dc7);if('undefined'==typeof _0x2ece22[_0xd8fc('0x2d')]){return _0x5cc93c(new Error(_0xd8fc('0x75')));}if('undefined'==typeof _0x2ece22[_0xd8fc('0x33')]){return _0x5cc93c(new Error(_0xd8fc('0x76')));}if(_0xd8fc('0x77')==typeof _0x2ece22['version']){return _0x5cc93c(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x2ece22[_0xd8fc('0x78')]){return _0x5cc93c(new Error(_0xd8fc('0x79')));}if(_0x2ece22[_0xd8fc('0x33')]===_0xd8fc('0x7a')){if(_0xd8fc('0x77')==typeof _0x2ece22[_0xd8fc('0x78')][_0xd8fc('0x7b')]){return _0x5cc93c(new Error(_0xd8fc('0x7c')));}if(_0xd8fc('0x77')==typeof _0x2ece22[_0xd8fc('0x78')][_0xd8fc('0x7b')]['admin']&&'undefined'==typeof _0x2ece22[_0xd8fc('0x78')][_0xd8fc('0x7b')][_0xd8fc('0x7d')]){return _0x5cc93c(new Error(_0xd8fc('0x7e')));}}else if(_0x2ece22[_0xd8fc('0x33')]===_0xd8fc('0x7f')){if(_0xd8fc('0x77')==typeof _0x2ece22['parameters'][_0xd8fc('0x80')]){return _0x5cc93c(new Error(_0xd8fc('0x81')));}if('undefined'==typeof _0x2ece22[_0xd8fc('0x78')][_0xd8fc('0x82')]){return _0x5cc93c(new Error(_0xd8fc('0x83')));}}else{return _0x5cc93c(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x479849=_0x2ece22[_0xd8fc('0x2d')];var _0x3c8bcf=_0x2ece22[_0xd8fc('0x84')];var _0x166d59=_0x2ece22[_0xd8fc('0x33')];var _0x280fd7=_0x2ece22['sidebar']?_0x2ece22['sidebar']:_0xd8fc('0x85');var _0x2584d1=_0x2ece22[_0xd8fc('0x86')]?_0x2ece22['icon']:'icon-apps';var _0x26b1cb='';var _0x3eed38='';var _0x231772='';var _0x17ef32='';var _0x58b332=_0x2ece22['version'];if(_0x166d59===_0xd8fc('0x7a')){if(_0xd8fc('0x77')!=typeof _0x2ece22['parameters'][_0xd8fc('0x7b')]['admin']){var _0x227085=_0x2ece22[_0xd8fc('0x78')]['views'][_0xd8fc('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x227085)){_0x26b1cb=path[_0xd8fc('0x59')](_0xd8fc('0x88'),_0x2b7990,_0x3dfa3d[0x0],_0x227085);}else{_0x26b1cb=_0x227085;}}else{logger['info'](_0xd8fc('0x89'));}if(_0xd8fc('0x77')!=typeof _0x2ece22['parameters'][_0xd8fc('0x7b')][_0xd8fc('0x7d')]){var _0x266164=_0x2ece22[_0xd8fc('0x78')][_0xd8fc('0x7b')][_0xd8fc('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x266164)){_0x3eed38=path[_0xd8fc('0x59')](_0xd8fc('0x88'),_0x2b7990,_0x3dfa3d[0x0],_0x266164);}else{_0x3eed38=_0x266164;}}else{logger[_0xd8fc('0x67')](_0xd8fc('0x8a'));}}else if(_0x166d59===_0xd8fc('0x7f')){_0x231772=_0x2ece22['parameters'][_0xd8fc('0x80')];_0x17ef32=_0x2ece22[_0xd8fc('0x78')][_0xd8fc('0x82')];if(_0xd8fc('0x77')!=typeof _0x2ece22[_0xd8fc('0x78')]['views']){if(_0xd8fc('0x77')!=typeof _0x2ece22['parameters']['views'][_0xd8fc('0x87')]){var _0x227085=_0x2ece22['parameters']['views'][_0xd8fc('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x227085)){_0x26b1cb=path[_0xd8fc('0x59')](_0xd8fc('0x88'),_0x2b7990,_0x3dfa3d[0x0],_0x227085);}else{_0x26b1cb=_0x227085;}}if(_0xd8fc('0x77')!=typeof _0x2ece22[_0xd8fc('0x78')][_0xd8fc('0x7b')]['agent']){var _0x266164=_0x2ece22['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xd8fc('0x8b')](_0x266164)){_0x3eed38=path[_0xd8fc('0x59')](_0xd8fc('0x88'),_0x2b7990,_0x3dfa3d[0x0],_0x266164);}else{_0x3eed38=_0x266164;}}}}var _0x594160={'name':_0x479849,'description':_0x3c8bcf,'path':path[_0xd8fc('0x59')](_0x2b7990,_0x3dfa3d[0x0]),'type':_0x166d59,'sidebar':_0x280fd7,'icon':_0x2584d1,'adminUrl':_0x26b1cb,'agentUrl':_0x3eed38,'scriptName':_0x231772,'scriptPath':_0x17ef32,'version':_0x58b332};removeReferences(_0x329e6b,null);return db[_0xd8fc('0x30')][_0xd8fc('0x8c')](_0x594160)[_0xd8fc('0x28')](function(_0xc5c481){var _0x10e8e6={'role':_0x1eba3a[_0xd8fc('0x8d')]['role'],'userProfileId':_0x1eba3a[_0xd8fc('0x8d')][_0xd8fc('0x8e')]};if(!_0x10e8e6)throw new Error(_0xd8fc('0x8f'));if(_0x10e8e6['role']===_0xd8fc('0x90')){var _0x4e1f85=_0xc5c481['get']({'plain':!![]});return db[_0xd8fc('0x91')][_0xd8fc('0x4a')]({'where':{'name':_0xd8fc('0x2a'),'userProfileId':_0x10e8e6[_0xd8fc('0x8e')]},'raw':!![]})[_0xd8fc('0x28')](function(_0x1e5cc8){if(_0x1e5cc8&&_0x1e5cc8['autoAssociation']===0x0){return db[_0xd8fc('0x92')][_0xd8fc('0x8c')]({'name':_0x4e1f85[_0xd8fc('0x2d')],'resourceId':_0x4e1f85['id'],'type':_0x1e5cc8[_0xd8fc('0x2d')],'sectionId':_0x1e5cc8['id']},{})[_0xd8fc('0x28')](function(){return _0xc5c481;});}else{return _0xc5c481;}})[_0xd8fc('0x44')](function(_0x563f85){logger[_0xd8fc('0x2c')](_0xd8fc('0x93'),_0x563f85);throw _0x563f85;});}return _0xc5c481;})[_0xd8fc('0x28')](respondWithResult(_0xd3dde3,null))[_0xd8fc('0x44')](handleError(_0xd3dde3,null));}});}catch(_0x5d7068){_0xd3dde3[_0xd8fc('0x1f')](0x1f4)['send'](_0x5d7068);}};function removeReferences(_0x441a97,_0x3d965b){try{if(_0x441a97){fs[_0xd8fc('0x65')](_0x441a97);logger[_0xd8fc('0x67')](_0xd8fc('0x94'));}if(_0x3d965b){rimraf(_0x3d965b,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x536f39){logger[_0xd8fc('0x2c')](_0x536f39);}}exports['update']=function(_0x3c014e,_0x1ee24b,_0xe14ed1){return db[_0xd8fc('0x30')]['find']({'where':{'id':_0x3c014e[_0xd8fc('0x4b')]['id']}})[_0xd8fc('0x28')](handleEntityNotFound(_0x1ee24b,null))[_0xd8fc('0x28')](saveUpdates(_0x3c014e[_0xd8fc('0x8d')],null))[_0xd8fc('0x28')](respondWithResult(_0x1ee24b,null))[_0xd8fc('0x44')](handleError(_0x1ee24b,null));};exports[_0xd8fc('0x95')]=function(_0x23d134,_0xb8a428,_0x34a65d){return db[_0xd8fc('0x30')][_0xd8fc('0x4a')]({'where':{'id':_0x23d134[_0xd8fc('0x4b')]['id']}})['then'](function(_0xa1dea5){if(_0xa1dea5){return _0xa1dea5[_0xd8fc('0x96')]();}})[_0xd8fc('0x28')](function(_0x5cd58c){rimraf(path['join'](config[_0xd8fc('0x4d')],_0xd8fc('0x5a'),path[_0xd8fc('0x5b')](_0x5cd58c['path'])),function(){});return _0x5cd58c;})[_0xd8fc('0x28')](handleEntityNotFound(_0xb8a428,null))[_0xd8fc('0x28')](respondWithStatusCode(_0xb8a428,null))[_0xd8fc('0x44')](handleError(_0xb8a428,null));};exports[_0xd8fc('0x97')]=function(_0x1f87c7,_0x305c8d,_0x132644){return BPromise[_0xd8fc('0x98')]()[_0xd8fc('0x28')](function(){if(!_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x4c')]){throw new Error(_0xd8fc('0x99'));}if(!_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x57b042=_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x9b')]?_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x9b')]+':'+_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x9a')]:_0xd8fc('0x9c')+_0x1f87c7['query'][_0xd8fc('0x9a')];var _0x5f5017=_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x21')]?_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x21')]:!![];var _0x550e59=_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x9d')]?_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x9d')]:null;var _0x418595={'method':_0x1f87c7[_0xd8fc('0x9e')],'uri':util[_0xd8fc('0x62')](_0xd8fc('0x9f'),_0x57b042,_0x1f87c7[_0xd8fc('0x35')][_0xd8fc('0x4c')]),'json':_0x5f5017,'resolveWithFullResponse':!![],'encoding':_0x550e59,'qs':_0x1f87c7['query']};if(_0x1f87c7[_0xd8fc('0xa0')]){_0x418595[_0xd8fc('0xa0')]=_0x1f87c7[_0xd8fc('0xa0')];if(_0x418595['headers'][_0xd8fc('0xa1')]){delete _0x418595['headers']['content-length'];}}if(_0x418595['headers']['content-type']){delete _0x418595[_0xd8fc('0xa0')][_0xd8fc('0xa2')];}return rp(_0x418595);})[_0xd8fc('0x28')](function(_0x53cbdd){if(_0x53cbdd){_0x305c8d[_0xd8fc('0x25')](_0x53cbdd[_0xd8fc('0xa0')]);logger[_0xd8fc('0x67')](_0x53cbdd[_0xd8fc('0x8d')]);if(_[_0xd8fc('0xa3')](_0x1f87c7[_0xd8fc('0x35')]['path'],_0xd8fc('0x61'))&&_0x53cbdd['statusCode']==0x1f4){return _0x305c8d['sendStatus'](_0x53cbdd[_0xd8fc('0xa4')]);}else{return _0x305c8d[_0xd8fc('0x1f')](_0x53cbdd[_0xd8fc('0xa4')])[_0xd8fc('0x2e')](_0x53cbdd['body']);}}else{return _0x305c8d[_0xd8fc('0x2b')](0xc8);}})['catch'](handleError(_0x305c8d,null));};exports['webhookPost']=function(_0x162f5d,_0x455680,_0x50a5d2){return BPromise[_0xd8fc('0x98')]()[_0xd8fc('0x28')](function(){if(!_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x4c')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x9a')]){throw new Error(_0xd8fc('0xa5'));}var _0x4843be=_0x162f5d[_0xd8fc('0x35')]['hostname']?_0x162f5d[_0xd8fc('0x35')]['hostname']+':'+_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x9a')]:'http://localhost:'+_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x9a')];var _0x2e779e=_0x162f5d[_0xd8fc('0x35')]['json']?_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x21')]:!![];var _0x530baa=_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x9d')]?_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x9d')]:null;var _0x475305={'method':_0x162f5d[_0xd8fc('0x9e')],'uri':util[_0xd8fc('0x62')](_0xd8fc('0x9f'),_0x4843be,_0x162f5d[_0xd8fc('0x35')][_0xd8fc('0x4c')]),'json':_0x2e779e,'resolveWithFullResponse':!![],'encoding':_0x530baa,'body':_0x162f5d[_0xd8fc('0x8d')]};if(_0x162f5d[_0xd8fc('0xa0')]){_0x475305[_0xd8fc('0xa0')]=_0x162f5d[_0xd8fc('0xa0')];if(_0x475305[_0xd8fc('0xa0')][_0xd8fc('0xa1')]){delete _0x475305[_0xd8fc('0xa0')]['content-length'];}}if(_0x475305[_0xd8fc('0xa0')]['content-type']){delete _0x475305['headers']['content-type'];}return rp(_0x475305);})['then'](function(_0x1a01d8){if(_0x1a01d8){_0x455680[_0xd8fc('0x25')](_0x1a01d8[_0xd8fc('0xa0')]);logger['info'](_0x1a01d8[_0xd8fc('0x8d')]);return _0x455680[_0xd8fc('0x1f')](_0x1a01d8[_0xd8fc('0xa4')])[_0xd8fc('0x2e')](_0x1a01d8[_0xd8fc('0x8d')]);}else{return _0x455680['sendStatus'](0xc8);}})[_0xd8fc('0x44')](handleError(_0x455680,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 78eb88e..ec7dde8 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 _0x430c=['update','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x94b9d4,_0x1d58d8){var _0x4dfe17=function(_0x3f9aa4){while(--_0x3f9aa4){_0x94b9d4['push'](_0x94b9d4['shift']());}};_0x4dfe17(++_0x1d58d8);}(_0x430c,0x1a1));var _0xc430=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x430c[_0x5627e1];return _0x2f013f;};'use strict';var EventEmitter=require(_0xc430('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xc430('0x1')](0x0);var events={'afterCreate':_0xc430('0x2'),'afterUpdate':_0xc430('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f0118){return function(_0x5ccda6,_0x47d8b9,_0x338a82){PluginEvents[_0xc430('0x4')](_0x4f0118+':'+_0x5ccda6['id'],_0x5ccda6);PluginEvents['emit'](_0x4f0118,_0x5ccda6);_0x338a82(null);};}for(var e in events){if(events[_0xc430('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xc430('0x6')]=PluginEvents; \ No newline at end of file +var _0x4325=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x5432('0x0'));var Plugin=require(_0x5432('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5432('0x2')](0x0);var events={'afterCreate':_0x5432('0x3'),'afterUpdate':_0x5432('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fc4e9){return function(_0x20f704,_0x36ce53,_0xad26e9){PluginEvents['emit'](_0x4fc4e9+':'+_0x20f704['id'],_0x20f704);PluginEvents[_0x5432('0x5')](_0x4fc4e9,_0x20f704);_0xad26e9(null);};}for(var e in events){if(events[_0x5432('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5432('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 e16cc6e..1618265 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 _0xee14=['Plugin','plugins','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define'];(function(_0x53fba4,_0x2f3fa1){var _0x36040a=function(_0x173160){while(--_0x173160){_0x53fba4['push'](_0x53fba4['shift']());}};_0x36040a(++_0x2f3fa1);}(_0xee14,0x13a));var _0x4ee1=function(_0x4e6dd5,_0x3a99e8){_0x4e6dd5=_0x4e6dd5-0x0;var _0x4c05ec=_0xee14[_0x4e6dd5];return _0x4c05ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['define','Plugin','plugins','util','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x27f445,_0x2c0026){var _0xeb3dca=function(_0x16061a){while(--_0x16061a){_0x27f445['push'](_0x27f445['shift']());}};_0xeb3dca(++_0x2c0026);}(_0x8958,0x93));var _0x8895=function(_0x2e5667,_0x800d86){_0x2e5667=_0x2e5667-0x0;var _0x2f1817=_0x8958[_0x2e5667];return _0x2f1817;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'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 7143690..a8a0c0c 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 _0x69a3=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreatePlugin','create','body','options','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x499585,_0x342072){var _0x143e3e=function(_0x446719){while(--_0x446719){_0x499585['push'](_0x499585['shift']());}};_0x143e3e(++_0x342072);}(_0x69a3,0x143));var _0x369a=function(_0x46b854,_0x37556e){_0x46b854=_0x46b854-0x0;var _0x316dd7=_0x69a3[_0x46b854];return _0x316dd7;};'use strict';var _=require(_0x369a('0x0'));var util=require(_0x369a('0x1'));var moment=require(_0x369a('0x2'));var BPromise=require(_0x369a('0x3'));var rs=require(_0x369a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x369a('0x5'))['db'];var utils=require(_0x369a('0x6'));var logger=require('../../config/logger')(_0x369a('0x7'));var config=require(_0x369a('0x8'));var jayson=require(_0x369a('0x9'));var client=jayson[_0x369a('0xa')][_0x369a('0xb')]({'port':0x232a});config[_0x369a('0xc')]=_['defaults'](config[_0x369a('0xc')],{'host':_0x369a('0xd'),'port':0x18eb});var socket=require(_0x369a('0xe'))(new Redis(config['redis']));require(_0x369a('0xf'))[_0x369a('0x10')](socket);function respondWithRpcPromise(_0x1b3d59,_0x22e5b8,_0x4e84ed){return new BPromise(function(_0x3a37de,_0x17557a){return client[_0x369a('0x11')](_0x1b3d59,_0x4e84ed)[_0x369a('0x12')](function(_0x5da3a3){logger[_0x369a('0x13')](_0x369a('0x14'),_0x22e5b8,_0x369a('0x15'));logger[_0x369a('0x16')](_0x369a('0x17'),_0x22e5b8,_0x369a('0x15'),JSON[_0x369a('0x18')](_0x5da3a3));if(_0x5da3a3[_0x369a('0x19')]){if(_0x5da3a3[_0x369a('0x19')]['code']===0x1f4){logger[_0x369a('0x19')](_0x369a('0x14'),_0x22e5b8,_0x5da3a3[_0x369a('0x19')]['message']);return _0x17557a(_0x5da3a3['error'][_0x369a('0x1a')]);}logger[_0x369a('0x19')](_0x369a('0x14'),_0x22e5b8,_0x5da3a3[_0x369a('0x19')][_0x369a('0x1a')]);return _0x3a37de(_0x5da3a3[_0x369a('0x19')][_0x369a('0x1a')]);}else{logger['info'](_0x369a('0x14'),_0x22e5b8,_0x369a('0x15'));_0x3a37de(_0x5da3a3[_0x369a('0x1b')][_0x369a('0x1a')]);}})['catch'](function(_0x3508ca){logger[_0x369a('0x19')](_0x369a('0x14'),_0x22e5b8,_0x3508ca);_0x17557a(_0x3508ca);});});}exports[_0x369a('0x1c')]=function(_0x1bdda1){var _0x1db09d=this;return new Promise(function(_0x3690d6,_0xc0ad49){return db['Plugin'][_0x369a('0x1d')](_0x1bdda1[_0x369a('0x1e')],{'raw':_0x1bdda1['options']?_0x1bdda1[_0x369a('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ebfa7){logger[_0x369a('0x13')](_0x369a('0x1c'),_0x1bdda1);logger['debug'](_0x369a('0x1c'),_0x1bdda1,JSON[_0x369a('0x18')](_0x5ebfa7));_0x3690d6(_0x5ebfa7);})[_0x369a('0x20')](function(_0x5d38b1){logger[_0x369a('0x19')](_0x369a('0x1c'),_0x5d38b1[_0x369a('0x1a')],_0x1bdda1);_0xc0ad49(_0x1db09d['error'](0x1f4,_0x5d38b1[_0x369a('0x1a')]));});});}; \ No newline at end of file +var _0x77b7=['body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create'];(function(_0x1f041b,_0x40f0a7){var _0x5cc388=function(_0x5288c5){while(--_0x5288c5){_0x1f041b['push'](_0x1f041b['shift']());}};_0x5cc388(++_0x40f0a7);}(_0x77b7,0x123));var _0x777b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x77b7[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x777b('0x0'));var util=require(_0x777b('0x1'));var moment=require('moment');var BPromise=require(_0x777b('0x2'));var rs=require(_0x777b('0x3'));var fs=require('fs');var Redis=require(_0x777b('0x4'));var db=require(_0x777b('0x5'))['db'];var utils=require(_0x777b('0x6'));var logger=require(_0x777b('0x7'))(_0x777b('0x8'));var config=require(_0x777b('0x9'));var jayson=require(_0x777b('0xa'));var client=jayson[_0x777b('0xb')]['http']({'port':0x232a});config[_0x777b('0xc')]=_[_0x777b('0xd')](config[_0x777b('0xc')],{'host':_0x777b('0xe'),'port':0x18eb});var socket=require(_0x777b('0xf'))(new Redis(config['redis']));require('./plugin.socket')[_0x777b('0x10')](socket);function respondWithRpcPromise(_0x2283a6,_0x2e4f61,_0x58ce8b){return new BPromise(function(_0x263a76,_0x348b20){return client[_0x777b('0x11')](_0x2283a6,_0x58ce8b)[_0x777b('0x12')](function(_0x330921){logger[_0x777b('0x13')](_0x777b('0x14'),_0x2e4f61,_0x777b('0x15'));logger[_0x777b('0x16')](_0x777b('0x17'),_0x2e4f61,_0x777b('0x15'),JSON[_0x777b('0x18')](_0x330921));if(_0x330921['error']){if(_0x330921[_0x777b('0x19')][_0x777b('0x1a')]===0x1f4){logger[_0x777b('0x19')](_0x777b('0x14'),_0x2e4f61,_0x330921[_0x777b('0x19')][_0x777b('0x1b')]);return _0x348b20(_0x330921[_0x777b('0x19')]['message']);}logger[_0x777b('0x19')]('Plugin,\x20%s,\x20%s',_0x2e4f61,_0x330921['error'][_0x777b('0x1b')]);return _0x263a76(_0x330921[_0x777b('0x19')][_0x777b('0x1b')]);}else{logger['info'](_0x777b('0x14'),_0x2e4f61,_0x777b('0x15'));_0x263a76(_0x330921[_0x777b('0x1c')][_0x777b('0x1b')]);}})[_0x777b('0x1d')](function(_0x18a45d){logger[_0x777b('0x19')]('Plugin,\x20%s,\x20%s',_0x2e4f61,_0x18a45d);_0x348b20(_0x18a45d);});});}exports[_0x777b('0x1e')]=function(_0x3f6c5d){var _0x28b2ab=this;return new Promise(function(_0x31034d,_0x144c6f){return db[_0x777b('0x1f')][_0x777b('0x20')](_0x3f6c5d[_0x777b('0x21')],{'raw':_0x3f6c5d[_0x777b('0x22')]?_0x3f6c5d[_0x777b('0x22')][_0x777b('0x23')]===undefined?!![]:![]:!![]})[_0x777b('0x12')](function(_0x18b7af){logger[_0x777b('0x13')](_0x777b('0x1e'),_0x3f6c5d);logger[_0x777b('0x16')](_0x777b('0x1e'),_0x3f6c5d,JSON[_0x777b('0x18')](_0x18b7af));_0x31034d(_0x18b7af);})[_0x777b('0x1d')](function(_0x82dca0){logger[_0x777b('0x19')]('CreatePlugin',_0x82dca0[_0x777b('0x1b')],_0x3f6c5d);_0x144c6f(_0x28b2ab['error'](0x1f4,_0x82dca0['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0f0dc4f..a73d702 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 _0x98d4=['plugin:','update','emit','register','length'];(function(_0x5295c9,_0x52d41b){var _0x6de8ea=function(_0x20c69b){while(--_0x20c69b){_0x5295c9['push'](_0x5295c9['shift']());}};_0x6de8ea(++_0x52d41b);}(_0x98d4,0x6a));var _0x498d=function(_0x5ef0f5,_0x189ab4){_0x5ef0f5=_0x5ef0f5-0x0;var _0x2bf52e=_0x98d4[_0x5ef0f5];return _0x2bf52e;};'use strict';var PluginEvents=require('./plugin.events');var events=['save','remove',_0x498d('0x0')];function createListener(_0x2a053c,_0x5d70e3){return function(_0x11d7b6){_0x5d70e3[_0x498d('0x1')](_0x2a053c,_0x11d7b6);};}function removeListener(_0x38f752,_0x4ce788){return function(){PluginEvents['removeListener'](_0x38f752,_0x4ce788);};}exports[_0x498d('0x2')]=function(_0x52922b){for(var _0x2b027c=0x0,_0x5b84e7=events[_0x498d('0x3')];_0x2b027c<_0x5b84e7;_0x2b027c++){var _0x17ae57=events[_0x2b027c];var _0x3dcb57=createListener(_0x498d('0x4')+_0x17ae57,_0x52922b);PluginEvents['on'](_0x17ae57,_0x3dcb57);}}; \ No newline at end of file +var _0xe386=['removeListener','register','length','plugin:','save','remove','update','emit'];(function(_0x448624,_0x3c6e18){var _0x4c88d7=function(_0x10ecca){while(--_0x10ecca){_0x448624['push'](_0x448624['shift']());}};_0x4c88d7(++_0x3c6e18);}(_0xe386,0x11c));var _0x6e38=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe386[_0x57b54c];return _0x59cc19;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x6e38('0x0'),_0x6e38('0x1'),_0x6e38('0x2')];function createListener(_0x4a7eed,_0x1ce38a){return function(_0x3ead95){_0x1ce38a[_0x6e38('0x3')](_0x4a7eed,_0x3ead95);};}function removeListener(_0x1c0be0,_0x31cb98){return function(){PluginEvents[_0x6e38('0x4')](_0x1c0be0,_0x31cb98);};}exports[_0x6e38('0x5')]=function(_0x12c3dd){for(var _0x7c761c=0x0,_0x3a5b5f=events[_0x6e38('0x6')];_0x7c761c<_0x3a5b5f;_0x7c761c++){var _0x44a3e9=events[_0x7c761c];var _0x15b404=createListener(_0x6e38('0x7')+_0x44a3e9,_0x12c3dd);PluginEvents['on'](_0x44a3e9,_0x15b404);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 665ed96..448047f 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 _0xb73b=['delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xb73b,0x198));var _0xbb73=function(_0x5293c8,_0xab0c3c){_0x5293c8=_0x5293c8-0x0;var _0x3623fb=_0xb73b[_0x5293c8];return _0x3623fb;};'use strict';var express=require(_0xbb73('0x0'));var router=express[_0xbb73('0x1')]();var auth=require(_0xbb73('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0xbb73('0x3')](),controller[_0xbb73('0x4')]);router[_0xbb73('0x5')](_0xbb73('0x6'),auth[_0xbb73('0x3')](),controller[_0xbb73('0x7')]);router[_0xbb73('0x8')]('/',auth[_0xbb73('0x3')](),controller[_0xbb73('0x9')]);router[_0xbb73('0xa')](_0xbb73('0x6'),auth[_0xbb73('0x3')](),controller[_0xbb73('0xb')]);router[_0xbb73('0xc')](_0xbb73('0x6'),auth[_0xbb73('0x3')](),controller[_0xbb73('0xd')]);module[_0xbb73('0xe')]=router; \ No newline at end of file +var _0x2edd=['delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','create','put','update'];(function(_0x4d503d,_0x1fc5ee){var _0x1e37f7=function(_0x47537c){while(--_0x47537c){_0x4d503d['push'](_0x4d503d['shift']());}};_0x1e37f7(++_0x1fc5ee);}(_0x2edd,0x1e7));var _0xd2ed=function(_0x5da699,_0x56004e){_0x5da699=_0x5da699-0x0;var _0x5bbe2b=_0x2edd[_0x5da699];return _0x5bbe2b;};'use strict';var express=require(_0xd2ed('0x0'));var router=express[_0xd2ed('0x1')]();var auth=require(_0xd2ed('0x2'));var controller=require('./pm2.controller');router[_0xd2ed('0x3')]('/',auth[_0xd2ed('0x4')](),controller['index']);router[_0xd2ed('0x3')]('/:id',auth[_0xd2ed('0x4')](),controller['show']);router['post']('/',auth[_0xd2ed('0x4')](),controller[_0xd2ed('0x5')]);router[_0xd2ed('0x6')]('/:id',auth[_0xd2ed('0x4')](),controller[_0xd2ed('0x7')]);router[_0xd2ed('0x8')]('/:id',auth[_0xd2ed('0x4')](),controller[_0xd2ed('0x9')]);module[_0xd2ed('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index a2a4465..241e2de 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 _0x427e=['delete','dump','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','json','error','stack','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','body','script','join','dirname','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','status','Unknown\x20status'];(function(_0x159665,_0x464016){var _0x30bc4c=function(_0x21b6e9){while(--_0x21b6e9){_0x159665['push'](_0x159665['shift']());}};_0x30bc4c(++_0x464016);}(_0x427e,0xf3));var _0xe427=function(_0x37ac9d,_0xafe035){_0x37ac9d=_0x37ac9d-0x0;var _0x2c01a2=_0x427e[_0x37ac9d];return _0x2c01a2;};'use strict';var _=require(_0xe427('0x0'));var pm2=require(_0xe427('0x1'));var logger=require('../../config/logger')(_0xe427('0x2'));var path=require(_0xe427('0x3'));var exec=require(_0xe427('0x4'))[_0xe427('0x5')];var BPromise=require(_0xe427('0x6'));function handleEntityNotFound(_0x301d85,_0x4fe5f2){return function(_0x46685f){if(!_0x46685f){_0x301d85['sendStatus'](0x194);;}return _0x46685f;};}function respondWithResult(_0x1b0ac3,_0x287a96){_0x287a96=_0x287a96||0xc8;return function(_0x2ec037){if(_0x2ec037){return _0x1b0ac3['status'](_0x287a96)[_0xe427('0x7')](_0x2ec037);}return null;};}function handleError(_0x58a47a,_0xc78472){_0xc78472=_0xc78472||0x1f4;return function(_0x11e983){logger[_0xe427('0x8')](_0x11e983[_0xe427('0x9')]);if(_0x11e983['name']){delete _0x11e983[_0xe427('0xa')];}_0x58a47a['status'](_0xc78472)[_0xe427('0xb')](_0x11e983);};}function execChildProcess(){return new BPromise(function(_0x49fbaf,_0x4ac3de){exec(_0xe427('0xc'),function(_0x1540e3,_0x13d50c,_0x18b341){logger[_0xe427('0xd')](_0x13d50c);logger[_0xe427('0xd')](_0x18b341);if(_0x1540e3){logger[_0xe427('0x8')](_0x1540e3);return _0x4ac3de(_0x1540e3);}return _0x49fbaf(_0x13d50c);});});}exports[_0xe427('0xe')]=function(_0x4bb82f,_0x407e01){return pm2['list']()['then'](function(_0xe57ac7){if(_0xe57ac7){var _0xe04176=_[_0xe427('0xf')](_0xe57ac7,function(_0xafde89){return _0xafde89[_0xe427('0xa')]===_0xe427('0x10')||_0xafde89['name']===_0xe427('0x11');});return{'rows':_0xe04176,'count':_0xe04176[_0xe427('0x12')]};}return null;})[_0xe427('0x13')](respondWithResult(_0x407e01,null))[_0xe427('0x14')](handleError(_0x407e01,null));};exports[_0xe427('0x15')]=function(_0x53af52,_0x4d48aa){return pm2[_0xe427('0x16')](_0x53af52[_0xe427('0x17')]['id'])[_0xe427('0x13')](respondWithResult(_0x4d48aa,null))[_0xe427('0x13')](handleEntityNotFound(_0x4d48aa,null))[_0xe427('0x14')](handleError(_0x4d48aa,null));};exports['create']=function(_0x3ddc3f,_0xdc8a08){if(_0x3ddc3f[_0xe427('0x18')][_0xe427('0xa')]&&_0x3ddc3f[_0xe427('0x18')][_0xe427('0x19')]){var _0x34d1a4=path[_0xe427('0x1a')](__dirname,'../../files/plugins',_0x3ddc3f[_0xe427('0x18')][_0xe427('0x19')]);var _0x5d266d=process['cwd']();process['chdir'](path[_0xe427('0x1b')](_0x34d1a4));return execChildProcess()[_0xe427('0x13')](function(_0x28e1a5){process[_0xe427('0x1c')](_0x5d266d);return pm2[_0xe427('0x1d')]({'name':_0x3ddc3f['body'][_0xe427('0xa')],'script':_0x34d1a4});})[_0xe427('0x13')](function(_0x1f4daa){pm2['dump']();return _0x1f4daa[0x0];})[_0xe427('0x13')](respondWithResult(_0xdc8a08,0xc9))['catch'](handleError(_0xdc8a08,null));}else{return _0xdc8a08['status'](0x1f4)['send']({'message':_0xe427('0x1e')});}};exports[_0xe427('0x1f')]=function(_0x234910,_0x252987){if(_0x234910[_0xe427('0x18')]['id']){delete _0x234910[_0xe427('0x18')]['id'];}var _0x58f2e5={'online':_0xe427('0x20'),'stopped':_0xe427('0x21')};if(_0x58f2e5[_0xe427('0x22')](_0x234910['body'][_0xe427('0x23')])){return pm2[_0x58f2e5[_0x234910[_0xe427('0x18')]['status']]](_0x234910['params']['id'])[_0xe427('0x13')](respondWithResult(_0x252987,0xc8))[_0xe427('0x14')](handleError(_0x252987,null));}else{return _0x252987[_0xe427('0x23')](0x1f4)[_0xe427('0xb')]({'message':_0xe427('0x24')});}};exports['destroy']=function(_0x9801d8,_0x3e4454){if(_0x9801d8['body']['id']){delete _0x9801d8['body']['id'];}if(_0x9801d8[_0xe427('0x17')]['id']){return pm2[_0xe427('0x25')](_0x9801d8[_0xe427('0x17')]['id'])[_0xe427('0x13')](function(_0x4b6069){pm2[_0xe427('0x26')]();return _0x4b6069[0x0];})['then'](respondWithResult(_0x3e4454,null))[_0xe427('0x14')](handleError(_0x3e4454,null));}else{return _0x3e4454[_0xe427('0x23')](0x1f4)['send']({'message':_0xe427('0x27')});}}; \ No newline at end of file +var _0xe3d4=['path','exec','bluebird','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','reject','express','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','api'];(function(_0x5c7a75,_0x59be5a){var _0x3820d4=function(_0x3f5662){while(--_0x3f5662){_0x5c7a75['push'](_0x5c7a75['shift']());}};_0x3820d4(++_0x59be5a);}(_0xe3d4,0x184));var _0x4e3d=function(_0x3bac2b,_0x137306){_0x3bac2b=_0x3bac2b-0x0;var _0xbadf45=_0xe3d4[_0x3bac2b];return _0xbadf45;};'use strict';var _=require('lodash');var pm2=require(_0x4e3d('0x0'));var logger=require('../../config/logger')(_0x4e3d('0x1'));var path=require(_0x4e3d('0x2'));var exec=require('child_process')[_0x4e3d('0x3')];var BPromise=require(_0x4e3d('0x4'));function handleEntityNotFound(_0x57379d,_0x443019){return function(_0x291c33){if(!_0x291c33){_0x57379d[_0x4e3d('0x5')](0x194);;}return _0x291c33;};}function respondWithResult(_0x361c1b,_0x5cf36f){_0x5cf36f=_0x5cf36f||0xc8;return function(_0x44e92d){if(_0x44e92d){return _0x361c1b['status'](_0x5cf36f)[_0x4e3d('0x6')](_0x44e92d);}return null;};}function handleError(_0x61db06,_0x1cacfa){_0x1cacfa=_0x1cacfa||0x1f4;return function(_0x1a68c1){logger[_0x4e3d('0x7')](_0x1a68c1[_0x4e3d('0x8')]);if(_0x1a68c1[_0x4e3d('0x9')]){delete _0x1a68c1[_0x4e3d('0x9')];}_0x61db06[_0x4e3d('0xa')](_0x1cacfa)[_0x4e3d('0xb')](_0x1a68c1);};}function execChildProcess(){return new BPromise(function(_0x52f972,_0x6fae56){exec(_0x4e3d('0xc'),function(_0x39e5df,_0x11bc58,_0x137219){logger[_0x4e3d('0xd')](_0x11bc58);logger[_0x4e3d('0xd')](_0x137219);if(_0x39e5df){logger[_0x4e3d('0x7')](_0x39e5df);return _0x6fae56(_0x39e5df);}return _0x52f972(_0x11bc58);});});}exports[_0x4e3d('0xe')]=function(_0x20e76a,_0x32c6fd){return pm2['list']()['then'](function(_0x58d977){if(_0x58d977){var _0x59ca0c=_[_0x4e3d('0xf')](_0x58d977,function(_0xacb94){return _0xacb94['name']===_0x4e3d('0x10')||_0xacb94[_0x4e3d('0x9')]==='motion2';});return{'rows':_0x59ca0c,'count':_0x59ca0c['length']};}return null;})[_0x4e3d('0x11')](respondWithResult(_0x32c6fd,null))[_0x4e3d('0x12')](handleError(_0x32c6fd,null));};exports[_0x4e3d('0x13')]=function(_0x22619f,_0x2a9cc8){return pm2[_0x4e3d('0x14')](_0x22619f[_0x4e3d('0x15')]['id'])['then'](respondWithResult(_0x2a9cc8,null))['then'](handleEntityNotFound(_0x2a9cc8,null))[_0x4e3d('0x12')](handleError(_0x2a9cc8,null));};exports[_0x4e3d('0x16')]=function(_0x115e1f,_0x505ad0){if(_0x115e1f[_0x4e3d('0x17')][_0x4e3d('0x9')]&&_0x115e1f['body'][_0x4e3d('0x18')]){var _0x234530=path[_0x4e3d('0x19')](__dirname,_0x4e3d('0x1a'),_0x115e1f[_0x4e3d('0x17')]['script']);var _0x16da6a=process[_0x4e3d('0x1b')]();process[_0x4e3d('0x1c')](path['dirname'](_0x234530));return execChildProcess()[_0x4e3d('0x11')](function(_0x598219){process[_0x4e3d('0x1c')](_0x16da6a);return pm2[_0x4e3d('0x1d')]({'name':_0x115e1f[_0x4e3d('0x17')][_0x4e3d('0x9')],'script':_0x234530});})['then'](function(_0x551db5){pm2[_0x4e3d('0x1e')]();return _0x551db5[0x0];})[_0x4e3d('0x11')](respondWithResult(_0x505ad0,0xc9))[_0x4e3d('0x12')](handleError(_0x505ad0,null));}else{return _0x505ad0[_0x4e3d('0xa')](0x1f4)['send']({'message':_0x4e3d('0x1f')});}};exports[_0x4e3d('0x20')]=function(_0x196d1d,_0x76e4ee){if(_0x196d1d[_0x4e3d('0x17')]['id']){delete _0x196d1d[_0x4e3d('0x17')]['id'];}var _0x56ce13={'online':'restart','stopped':_0x4e3d('0x21')};if(_0x56ce13[_0x4e3d('0x22')](_0x196d1d['body']['status'])){return pm2[_0x56ce13[_0x196d1d[_0x4e3d('0x17')][_0x4e3d('0xa')]]](_0x196d1d['params']['id'])['then'](respondWithResult(_0x76e4ee,0xc8))['catch'](handleError(_0x76e4ee,null));}else{return _0x76e4ee[_0x4e3d('0xa')](0x1f4)['send']({'message':_0x4e3d('0x23')});}};exports[_0x4e3d('0x24')]=function(_0x1034d8,_0x5c97e0){if(_0x1034d8[_0x4e3d('0x17')]['id']){delete _0x1034d8[_0x4e3d('0x17')]['id'];}if(_0x1034d8[_0x4e3d('0x15')]['id']){return pm2[_0x4e3d('0x25')](_0x1034d8[_0x4e3d('0x15')]['id'])['then'](function(_0x3163bb){pm2[_0x4e3d('0x1e')]();return _0x3163bb[0x0];})[_0x4e3d('0x11')](respondWithResult(_0x5c97e0,null))[_0x4e3d('0x12')](handleError(_0x5c97e0,null));}else{return _0x5c97e0[_0x4e3d('0xa')](0x1f4)['send']({'message':_0x4e3d('0x26')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b44cb06..91ebaa3 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 _0x96a3=['multer','path','express','../../components/auth/service','../../config/environment','exports'];(function(_0x2a6ab8,_0x5eb621){var _0x5752ab=function(_0x49766d){while(--_0x49766d){_0x2a6ab8['push'](_0x2a6ab8['shift']());}};_0x5752ab(++_0x5eb621);}(_0x96a3,0x126));var _0x396a=function(_0x21e2af,_0x304255){_0x21e2af=_0x21e2af-0x0;var _0x37323c=_0x96a3[_0x21e2af];return _0x37323c;};'use strict';var multer=require(_0x396a('0x0'));var util=require('util');var path=require(_0x396a('0x1'));var timeout=require('connect-timeout');var express=require(_0x396a('0x2'));var router=express['Router']();var auth=require(_0x396a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x396a('0x4'));module[_0x396a('0x5')]=router; \ No newline at end of file +var _0xe8ef=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe8ef,0x17e));var _0xfe8e=function(_0x495c7b,_0x579346){_0x495c7b=_0x495c7b-0x0;var _0x28a4a5=_0xe8ef[_0x495c7b];return _0x28a4a5;};'use strict';var multer=require(_0xfe8e('0x0'));var util=require(_0xfe8e('0x1'));var path=require(_0xfe8e('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe8e('0x3'));var router=express['Router']();var auth=require(_0xfe8e('0x4'));var interaction=require(_0xfe8e('0x5'));var config=require(_0xfe8e('0x6'));module[_0xfe8e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index faced6f..6ce81b7 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 _0x9e99=['STRING','DATE','exports','INTEGER'];(function(_0x360c23,_0x419ba8){var _0x2491df=function(_0x349837){while(--_0x349837){_0x360c23['push'](_0x360c23['shift']());}};_0x2491df(++_0x419ba8);}(_0x9e99,0x12a));var _0x99e9=function(_0x53a823,_0x501144){_0x53a823=_0x53a823-0x0;var _0x112db0=_0x9e99[_0x53a823];return _0x112db0;};'use strict';var Sequelize=require('sequelize');module[_0x99e9('0x0')]={'state':{'type':Sequelize[_0x99e9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x99e9('0x2')]},'scheduledat':{'type':Sequelize[_0x99e9('0x3')]},'uniqueid':{'type':Sequelize[_0x99e9('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x99e9('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x99e9('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda9d=['exports','INTEGER','STRING','DATE'];(function(_0x2260e2,_0x9fa1bd){var _0x2986a7=function(_0x8a3823){while(--_0x8a3823){_0x2260e2['push'](_0x2260e2['shift']());}};_0x2986a7(++_0x9fa1bd);}(_0xda9d,0x1bc));var _0xdda9=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0xda9d[_0x1d1d09];return _0x8827e;};'use strict';var Sequelize=require('sequelize');module[_0xdda9('0x0')]={'state':{'type':Sequelize[_0xdda9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xdda9('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdda9('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdda9('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 86acc42..0eeae76 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 _0xe2b7=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','request-promise','rimraf','../../config/environment'];(function(_0x1ed46f,_0x7691d7){var _0x43b931=function(_0x5f2454){while(--_0x5f2454){_0x1ed46f['push'](_0x1ed46f['shift']());}};_0x43b931(++_0x7691d7);}(_0xe2b7,0xb5));var _0x7e2b=function(_0x2a744c,_0x3a34cc){_0x2a744c=_0x2a744c-0x0;var _0x485e5a=_0xe2b7[_0x2a744c];return _0x485e5a;};'use strict';var _=require(_0x7e2b('0x0'));var util=require(_0x7e2b('0x1'));var logger=require('../../config/logger')(_0x7e2b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e2b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e2b('0x4'));var config=require(_0x7e2b('0x5'));var attributes=require(_0x7e2b('0x6'));module[_0x7e2b('0x7')]=function(_0x1cde8e,_0x3ef9c8){return _0x1cde8e[_0x7e2b('0x8')](_0x7e2b('0x9'),attributes,{'tableName':_0x7e2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05ae=['../../config/environment','exports','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x43a2b2,_0x2938b9){var _0x94f2b8=function(_0xdde4f7){while(--_0xdde4f7){_0x43a2b2['push'](_0x43a2b2['shift']());}};_0x94f2b8(++_0x2938b9);}(_0x05ae,0x9d));var _0xe05a=function(_0xa3a6d4,_0xdb44b9){_0xa3a6d4=_0xa3a6d4-0x0;var _0x570398=_0x05ae[_0xa3a6d4];return _0x570398;};'use strict';var _=require(_0xe05a('0x0'));var util=require(_0xe05a('0x1'));var logger=require(_0xe05a('0x2'))(_0xe05a('0x3'));var moment=require(_0xe05a('0x4'));var BPromise=require(_0xe05a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe05a('0x6'));var rimraf=require(_0xe05a('0x7'));var config=require(_0xe05a('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0xe05a('0x9')]=function(_0x170225,_0x264607){return _0x170225['define']('ReportAgentPreview',attributes,{'tableName':_0xe05a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 0f9f78c..ced301c 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 _0xd317=['stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d5e82,_0x1e7112){var _0x18640c=function(_0x2d5b28){while(--_0x2d5b28){_0x3d5e82['push'](_0x3d5e82['shift']());}};_0x18640c(++_0x1e7112);}(_0xd317,0x173));var _0x7d31=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xd317[_0x313c96];return _0x522f53;};'use strict';var _=require('lodash');var util=require(_0x7d31('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d31('0x1'));var db=require(_0x7d31('0x2'))['db'];var utils=require(_0x7d31('0x3'));var logger=require(_0x7d31('0x4'))('rpc');var config=require(_0x7d31('0x5'));var jayson=require(_0x7d31('0x6'));var client=jayson['client'][_0x7d31('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2337b3,_0x15645e,_0x2d6579){return new BPromise(function(_0x568bed,_0x25b5b2){return client['request'](_0x2337b3,_0x2d6579)[_0x7d31('0x8')](function(_0x29fef1){logger[_0x7d31('0x9')](_0x7d31('0xa'),_0x15645e,_0x7d31('0xb'));logger[_0x7d31('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x15645e,_0x7d31('0xb'),JSON[_0x7d31('0xd')](_0x29fef1));if(_0x29fef1[_0x7d31('0xe')]){if(_0x29fef1[_0x7d31('0xe')][_0x7d31('0xf')]===0x1f4){logger[_0x7d31('0xe')](_0x7d31('0xa'),_0x15645e,_0x29fef1[_0x7d31('0xe')][_0x7d31('0x10')]);return _0x25b5b2(_0x29fef1[_0x7d31('0xe')][_0x7d31('0x10')]);}logger[_0x7d31('0xe')](_0x7d31('0xa'),_0x15645e,_0x29fef1[_0x7d31('0xe')][_0x7d31('0x10')]);return _0x568bed(_0x29fef1[_0x7d31('0xe')][_0x7d31('0x10')]);}else{logger[_0x7d31('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x15645e,_0x7d31('0xb'));_0x568bed(_0x29fef1[_0x7d31('0x11')][_0x7d31('0x10')]);}})['catch'](function(_0x34e4be){logger[_0x7d31('0xe')](_0x7d31('0xa'),_0x15645e,_0x34e4be);_0x25b5b2(_0x34e4be);});});}exports[_0x7d31('0x12')]=function(_0x37ab29){var _0x19eb33=this;return new Promise(function(_0x59f2b2,_0x17632e){return db[_0x7d31('0x13')][_0x7d31('0x14')](_0x37ab29[_0x7d31('0x15')],{'raw':_0x37ab29[_0x7d31('0x16')]?_0x37ab29[_0x7d31('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x7d31('0x8')](function(_0x4935cb){logger[_0x7d31('0x9')](_0x7d31('0x12'),_0x37ab29);logger['debug'](_0x7d31('0x12'),_0x37ab29,JSON[_0x7d31('0xd')](_0x4935cb));_0x59f2b2(_0x4935cb);})[_0x7d31('0x17')](function(_0x5a6ef4){logger['error'](_0x7d31('0x12'),_0x5a6ef4['message'],_0x37ab29);_0x17632e(_0x19eb33['error'](0x1f4,_0x5a6ef4[_0x7d31('0x10')]));});});}; \ No newline at end of file +var _0xc3b5=['error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x233e6f,_0x4019ac){var _0x1deeb0=function(_0x43f942){while(--_0x43f942){_0x233e6f['push'](_0x233e6f['shift']());}};_0x1deeb0(++_0x4019ac);}(_0xc3b5,0x193));var _0x5c3b=function(_0x40087c,_0x3d4b74){_0x40087c=_0x40087c-0x0;var _0x594c9d=_0xc3b5[_0x40087c];return _0x594c9d;};'use strict';var _=require(_0x5c3b('0x0'));var util=require(_0x5c3b('0x1'));var moment=require(_0x5c3b('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c3b('0x3'));var fs=require('fs');var Redis=require(_0x5c3b('0x4'));var db=require(_0x5c3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')][_0x5c3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6bca,_0xc51a5c,_0xc7394b){return new BPromise(function(_0x305450,_0x590123){return client[_0x5c3b('0xb')](_0x1f6bca,_0xc7394b)[_0x5c3b('0xc')](function(_0x4646f5){logger[_0x5c3b('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xc51a5c,_0x5c3b('0xe'));logger['debug'](_0x5c3b('0xf'),_0xc51a5c,'request\x20sent',JSON[_0x5c3b('0x10')](_0x4646f5));if(_0x4646f5[_0x5c3b('0x11')]){if(_0x4646f5[_0x5c3b('0x11')][_0x5c3b('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xc51a5c,_0x4646f5[_0x5c3b('0x11')][_0x5c3b('0x13')]);return _0x590123(_0x4646f5[_0x5c3b('0x11')][_0x5c3b('0x13')]);}logger[_0x5c3b('0x11')](_0x5c3b('0x14'),_0xc51a5c,_0x4646f5[_0x5c3b('0x11')][_0x5c3b('0x13')]);return _0x305450(_0x4646f5[_0x5c3b('0x11')][_0x5c3b('0x13')]);}else{logger[_0x5c3b('0xd')](_0x5c3b('0x14'),_0xc51a5c,'request\x20sent');_0x305450(_0x4646f5[_0x5c3b('0x15')][_0x5c3b('0x13')]);}})[_0x5c3b('0x16')](function(_0x308ba7){logger[_0x5c3b('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0xc51a5c,_0x308ba7);_0x590123(_0x308ba7);});});}exports['CreateReportAgentPreview']=function(_0x4611fb){var _0x3abcc6=this;return new Promise(function(_0x5b0624,_0x149824){return db[_0x5c3b('0x17')][_0x5c3b('0x18')](_0x4611fb[_0x5c3b('0x19')],{'raw':_0x4611fb[_0x5c3b('0x1a')]?_0x4611fb[_0x5c3b('0x1a')][_0x5c3b('0x1b')]===undefined?!![]:![]:!![]})[_0x5c3b('0xc')](function(_0x143d32){logger['info'](_0x5c3b('0x1c'),_0x4611fb);logger[_0x5c3b('0x1d')](_0x5c3b('0x1c'),_0x4611fb,JSON[_0x5c3b('0x10')](_0x143d32));_0x5b0624(_0x143d32);})[_0x5c3b('0x16')](function(_0x5a08f9){logger[_0x5c3b('0x11')](_0x5c3b('0x1c'),_0x5a08f9[_0x5c3b('0x13')],_0x4611fb);_0x149824(_0x3abcc6[_0x5c3b('0x11')](0x1f4,_0x5a08f9[_0x5c3b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 000b6e6..1a673e3 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 _0x64cd=['campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/outbound','outbound','/outbound/channels','/agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns'];(function(_0x59223a,_0x23479b){var _0x45da5e=function(_0x40370b){while(--_0x40370b){_0x59223a['push'](_0x59223a['shift']());}};_0x45da5e(++_0x23479b);}(_0x64cd,0xc7));var _0xd64c=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x64cd[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0xd64c('0x0'));var util=require(_0xd64c('0x1'));var path=require(_0xd64c('0x2'));var express=require(_0xd64c('0x3'));var router=express[_0xd64c('0x4')]();var auth=require(_0xd64c('0x5'));var controller=require(_0xd64c('0x6'));router[_0xd64c('0x7')]('/voice/channels',auth[_0xd64c('0x8')](),controller[_0xd64c('0x9')]);router[_0xd64c('0x7')](_0xd64c('0xa'),auth['isAuthenticated'](),controller[_0xd64c('0xb')]);router[_0xd64c('0x7')](_0xd64c('0xc'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0xd64c('0x7')]('/voice/queues',auth['isAuthenticated'](),controller[_0xd64c('0xd')]);router[_0xd64c('0x7')](_0xd64c('0xe'),auth[_0xd64c('0x8')](),controller[_0xd64c('0xf')]);router[_0xd64c('0x7')]('/mail/queues',auth['isAuthenticated'](),controller[_0xd64c('0x10')]);router[_0xd64c('0x7')](_0xd64c('0x11'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x12')]);router[_0xd64c('0x7')]('/openchannel/queues',auth[_0xd64c('0x8')](),controller[_0xd64c('0x13')]);router[_0xd64c('0x7')](_0xd64c('0x14'),auth['isAuthenticated'](),controller['smsQueues']);router[_0xd64c('0x7')](_0xd64c('0x15'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x16')]);router[_0xd64c('0x7')](_0xd64c('0x17'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x18')]);router[_0xd64c('0x7')](_0xd64c('0x19'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x1a')]);router[_0xd64c('0x7')](_0xd64c('0x1b'),auth[_0xd64c('0x8')](),controller['voiceQueuesChannels']);router[_0xd64c('0x7')](_0xd64c('0x1c'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x1d')]);router[_0xd64c('0x7')](_0xd64c('0x1e'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x1f')]);router[_0xd64c('0x7')](_0xd64c('0x20'),auth[_0xd64c('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0xd64c('0x7')]('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xd64c('0x7')](_0xd64c('0x21'),auth['isAuthenticated'](),controller[_0xd64c('0x22')]);router[_0xd64c('0x7')](_0xd64c('0x23'),auth[_0xd64c('0x8')](),controller['outboundChannels']);router[_0xd64c('0x7')](_0xd64c('0x24'),auth['isAuthenticated'](),controller['agents']);router[_0xd64c('0x25')](_0xd64c('0x26'),auth['isAuthenticated'](),controller[_0xd64c('0x27')]);router[_0xd64c('0x7')]('/telephones',auth[_0xd64c('0x8')](),controller[_0xd64c('0x28')]);router[_0xd64c('0x7')](_0xd64c('0x29'),auth['isAuthenticated'](),controller[_0xd64c('0x2a')]);router[_0xd64c('0x7')](_0xd64c('0x2b'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x2c')]);router[_0xd64c('0x7')](_0xd64c('0x2d'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x2e')]);router[_0xd64c('0x7')](_0xd64c('0x2f'),auth[_0xd64c('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xd64c('0x7')](_0xd64c('0x30'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x31')]);router[_0xd64c('0x7')]('/openchannel/queues/waitinginteractions',auth[_0xd64c('0x8')](),controller[_0xd64c('0x32')]);router[_0xd64c('0x7')](_0xd64c('0x33'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x34')]);router[_0xd64c('0x7')](_0xd64c('0x35'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x36')]);router[_0xd64c('0x7')](_0xd64c('0x37'),auth['isAuthenticated'](),controller[_0xd64c('0x38')]);router[_0xd64c('0x7')](_0xd64c('0x39'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x3a')]);router[_0xd64c('0x3b')](_0xd64c('0x3c'),auth['isAuthenticated'](),controller[_0xd64c('0x3d')]('mail'));router[_0xd64c('0x7')]('/mail/queues/:id',auth[_0xd64c('0x8')](),controller['showMailQueues']);router[_0xd64c('0x3b')](_0xd64c('0x3e'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x3d')](_0xd64c('0x3f')));router[_0xd64c('0x7')]('/chat/queues/:id',auth[_0xd64c('0x8')](),controller[_0xd64c('0x40')]);router[_0xd64c('0x3b')](_0xd64c('0x41'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x3d')](_0xd64c('0x42')));router[_0xd64c('0x7')](_0xd64c('0x43'),auth['isAuthenticated'](),controller[_0xd64c('0x44')]);router[_0xd64c('0x3b')](_0xd64c('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0xd64c('0x46')));router['get'](_0xd64c('0x47'),auth['isAuthenticated'](),controller[_0xd64c('0x48')]);router[_0xd64c('0x3b')](_0xd64c('0x49'),auth[_0xd64c('0x8')](),controller['queueNotify'](_0xd64c('0x4a')));router[_0xd64c('0x3b')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xd64c('0x4b')));router[_0xd64c('0x7')]('/sms/queues/:id',auth[_0xd64c('0x8')](),controller['showSmsQueues']);router['get'](_0xd64c('0x4c'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x4d')]);router[_0xd64c('0x3b')](_0xd64c('0x4e'),auth[_0xd64c('0x8')](),controller[_0xd64c('0x4f')]);module[_0xd64c('0x50')]=router; \ No newline at end of file +var _0x5c6d=['showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel'];(function(_0x4b6dc0,_0x27f881){var _0x4be496=function(_0x4d63ac){while(--_0x4d63ac){_0x4b6dc0['push'](_0x4b6dc0['shift']());}};_0x4be496(++_0x27f881);}(_0x5c6d,0xa7));var _0xd5c6=function(_0x5ed05c,_0x1351fb){_0x5ed05c=_0x5ed05c-0x0;var _0x45a2da=_0x5c6d[_0x5ed05c];return _0x45a2da;};'use strict';var multer=require('multer');var util=require(_0xd5c6('0x0'));var path=require('path');var express=require('express');var router=express[_0xd5c6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd5c6('0x2'));router['get'](_0xd5c6('0x3'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x5')]);router[_0xd5c6('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xd5c6('0x4')](),controller['voiceChannelMixMonitor']);router[_0xd5c6('0x6')](_0xd5c6('0x7'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x8')]);router[_0xd5c6('0x6')](_0xd5c6('0x9'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0xa')]);router[_0xd5c6('0x6')]('/chat/queues',auth[_0xd5c6('0x4')](),controller['chatQueues']);router['get'](_0xd5c6('0xb'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0xc')]);router[_0xd5c6('0x6')](_0xd5c6('0xd'),auth['isAuthenticated'](),controller[_0xd5c6('0xe')]);router[_0xd5c6('0x6')]('/openchannel/queues',auth[_0xd5c6('0x4')](),controller[_0xd5c6('0xf')]);router[_0xd5c6('0x6')](_0xd5c6('0x10'),auth['isAuthenticated'](),controller[_0xd5c6('0x11')]);router['get'](_0xd5c6('0x12'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x13')]);router[_0xd5c6('0x6')](_0xd5c6('0x14'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x15')]);router[_0xd5c6('0x6')](_0xd5c6('0x16'),auth[_0xd5c6('0x4')](),controller['voiceQueuesPreview']);router[_0xd5c6('0x6')](_0xd5c6('0x17'),auth['isAuthenticated'](),controller[_0xd5c6('0x18')]);router[_0xd5c6('0x6')](_0xd5c6('0x19'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x1a')]);router[_0xd5c6('0x6')](_0xd5c6('0x1b'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x1c')]);router[_0xd5c6('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x1d')]);router[_0xd5c6('0x6')](_0xd5c6('0x1e'),auth['isAuthenticated'](),controller[_0xd5c6('0x1f')]);router['get']('/outbound',auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x20')]);router['get'](_0xd5c6('0x21'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x22')]);router[_0xd5c6('0x6')]('/agents',auth[_0xd5c6('0x4')](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0xd5c6('0x4')](),controller['agentCapacity']);router[_0xd5c6('0x6')]('/telephones',auth['isAuthenticated'](),controller[_0xd5c6('0x23')]);router[_0xd5c6('0x6')]('/trunks',auth['isAuthenticated'](),controller[_0xd5c6('0x24')]);router[_0xd5c6('0x6')](_0xd5c6('0x25'),auth['isAuthenticated'](),controller[_0xd5c6('0x26')]);router['get'](_0xd5c6('0x27'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x28')]);router[_0xd5c6('0x6')](_0xd5c6('0x29'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x2a')]);router[_0xd5c6('0x6')](_0xd5c6('0x2b'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x2c')]);router[_0xd5c6('0x6')](_0xd5c6('0x2d'),auth[_0xd5c6('0x4')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xd5c6('0x2e'),auth[_0xd5c6('0x4')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xd5c6('0x6')](_0xd5c6('0x2f'),auth[_0xd5c6('0x4')](),controller['smsQueuesWaitingInteractions']);router['get'](_0xd5c6('0x30'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x31')]);router[_0xd5c6('0x6')](_0xd5c6('0x32'),auth['isAuthenticated'](),controller[_0xd5c6('0x33')]);router[_0xd5c6('0x34')](_0xd5c6('0x35'),auth[_0xd5c6('0x4')](),controller['queueNotify'](_0xd5c6('0x36')));router[_0xd5c6('0x6')](_0xd5c6('0x37'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x38')]);router['post'](_0xd5c6('0x39'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x3a')]('chat'));router['get'](_0xd5c6('0x3b'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x3c')]);router[_0xd5c6('0x34')](_0xd5c6('0x3d'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x3a')](_0xd5c6('0x3e')));router[_0xd5c6('0x6')](_0xd5c6('0x3f'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x40')]);router[_0xd5c6('0x34')](_0xd5c6('0x41'),auth['isAuthenticated'](),controller[_0xd5c6('0x3a')](_0xd5c6('0x42')));router[_0xd5c6('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0xd5c6('0x43')]);router[_0xd5c6('0x34')](_0xd5c6('0x44'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x3a')](_0xd5c6('0x45')));router[_0xd5c6('0x34')](_0xd5c6('0x46'),auth['isAuthenticated'](),controller[_0xd5c6('0x3a')](_0xd5c6('0x47')));router[_0xd5c6('0x6')](_0xd5c6('0x48'),auth[_0xd5c6('0x4')](),controller['showSmsQueues']);router[_0xd5c6('0x6')](_0xd5c6('0x49'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x4a')]);router[_0xd5c6('0x34')](_0xd5c6('0x4b'),auth[_0xd5c6('0x4')](),controller[_0xd5c6('0x4c')]);module[_0xd5c6('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index ebf7c52..12b17ff 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 _0x0441=['body','interaction','user','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','findOne','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','TransferReport','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','update','create','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','agents','agentCapacity'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x0441,0x1a5));var _0x1044=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x0441[_0x2b55b5];return _0x103d28;};'use strict';var BPromise=require(_0x1044('0x0'));var moment=require(_0x1044('0x1'));var _=require(_0x1044('0x2'));var util=require(_0x1044('0x3'));var db=require(_0x1044('0x4'))['db'];var logger=require('../../config/logger')('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x1044('0x5')][_0x1044('0x6')]({'port':0x232a});var mailClient=jayson[_0x1044('0x5')]['http']({'port':0x232b});var routingClient=jayson[_0x1044('0x5')][_0x1044('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x19f2ba,_0x1ee98c,_0x487ba4){return new BPromise(function(_0x41e6e8,_0x447ee8){var _0x3b5ceb=_0x487ba4?_0x487ba4:amiClient;return _0x3b5ceb[_0x1044('0x7')](_0x19f2ba,_0x1ee98c)[_0x1044('0x8')](function(_0x36025e){if(_0x36025e[_0x1044('0x9')]){if(_0x36025e[_0x1044('0x9')][_0x1044('0xa')]===0x1f4){return _0x447ee8(_0x36025e[_0x1044('0x9')][_0x1044('0xb')]);}return _0x41e6e8(_0x36025e[_0x1044('0x9')]['message']);}else{_0x41e6e8(_0x36025e[_0x1044('0xc')]);}})[_0x1044('0xd')](function(_0x1386bb){_0x447ee8(_0x1386bb);});});}function respondWithResult(_0x3e58da,_0x26b158){_0x26b158=_0x26b158||0xc8;return function(_0x7b372){if(_0x7b372){return _0x3e58da[_0x1044('0xe')](_0x26b158)[_0x1044('0xf')](_0x7b372);}return _0x3e58da['sendStatus'](0x194);};}function handleError(_0xb0542a,_0x42ef99){_0x42ef99=_0x42ef99||0x1f4;return function(_0x2765e1){logger[_0x1044('0x9')](_0x2765e1['stack']);if(_0x2765e1['name']){delete _0x2765e1[_0x1044('0x10')];}_0xb0542a[_0x1044('0xe')](_0x42ef99)[_0x1044('0x11')](_0x2765e1);};}function findById(_0x3d4b22){return function(_0x38b168){if(!_[_0x1044('0x12')](_0x3d4b22)&&!_[_0x1044('0x12')](_0x38b168)&&!_[_0x1044('0x12')](_0x38b168['rows'])){return _['find'](_0x38b168[_0x1044('0x13')],function(_0x2f9674){return _0x2f9674['id']==_0x3d4b22;});}return null;};}exports[_0x1044('0x14')]=function(_0x211506,_0x32a71b){return respondWithRpcPromise('VoiceChannels',_0x211506[_0x1044('0x15')])[_0x1044('0x8')](respondWithResult(_0x32a71b,null))[_0x1044('0xd')](handleError(_0x32a71b,null));};exports[_0x1044('0x16')]=function(_0x55ac59,_0x4f3729){return respondWithRpcPromise(_0x1044('0x17'),_[_0x1044('0x18')](_0x55ac59['query'],_0x55ac59[_0x1044('0x19')]))['then'](respondWithResult(_0x4f3729,null))[_0x1044('0xd')](handleError(_0x4f3729,null));};exports[_0x1044('0x1a')]=function(_0x21cec9,_0x3e8e53){return respondWithRpcPromise(_0x1044('0x1b'),_[_0x1044('0x18')](_0x21cec9[_0x1044('0x15')],_0x21cec9[_0x1044('0x19')]))[_0x1044('0x8')](respondWithResult(_0x3e8e53,null))[_0x1044('0xd')](handleError(_0x3e8e53,null));};exports[_0x1044('0x1c')]=function(_0x28a8ca,_0x39da61){return respondWithRpcPromise(_0x1044('0x1d'),_0x28a8ca[_0x1044('0x15')])[_0x1044('0x8')](respondWithResult(_0x39da61,null))[_0x1044('0xd')](handleError(_0x39da61,null));};exports[_0x1044('0x1e')]=function(_0x409f1a,_0x2e2ad8){return respondWithRpcPromise(_0x1044('0x1d'),_0x409f1a[_0x1044('0x15')])[_0x1044('0x8')](findById(_0x409f1a[_0x1044('0x19')]['id']))[_0x1044('0x8')](respondWithResult(_0x2e2ad8,null))['catch'](handleError(_0x2e2ad8,null));};exports[_0x1044('0x1f')]=function(_0x55b2b9,_0x185d24){return respondWithRpcPromise(_0x1044('0x20'),_[_0x1044('0x18')](_0x55b2b9[_0x1044('0x15')],_0x55b2b9[_0x1044('0x19')]))['then'](respondWithResult(_0x185d24,null))[_0x1044('0xd')](handleError(_0x185d24,null));};exports[_0x1044('0x21')]=function(_0x39363a,_0x5929f3){return respondWithRpcPromise(_0x1044('0x22'),_0x39363a['query'])[_0x1044('0x8')](respondWithResult(_0x5929f3,null))[_0x1044('0xd')](handleError(_0x5929f3,null));};exports['voiceQueuesChannel']=function(_0x3d08e6,_0xc667de){return respondWithRpcPromise(_0x1044('0x23'),_['merge'](_0x3d08e6['query'],_0x3d08e6['params']))[_0x1044('0x8')](respondWithResult(_0xc667de,null))[_0x1044('0xd')](handleError(_0xc667de,null));};exports[_0x1044('0x24')]=function(_0x13ead9,_0x118128){return respondWithRpcPromise(_0x1044('0x25'),_[_0x1044('0x18')](_0x13ead9[_0x1044('0x15')],_0x13ead9[_0x1044('0x19')]))[_0x1044('0x8')](respondWithResult(_0x118128,null))['catch'](handleError(_0x118128,null));};exports[_0x1044('0x26')]=function(_0x2b6e52,_0x308264){return respondWithRpcPromise(_0x1044('0x27'),_[_0x1044('0x18')](_0x2b6e52[_0x1044('0x15')],_0x2b6e52[_0x1044('0x19')]))[_0x1044('0x8')](respondWithResult(_0x308264,null))[_0x1044('0xd')](handleError(_0x308264,null));};exports[_0x1044('0x28')]=function(_0x549262,_0x3608f5){return respondWithRpcPromise('Outbound',_0x549262[_0x1044('0x15')])['then'](respondWithResult(_0x3608f5,null))[_0x1044('0xd')](handleError(_0x3608f5,null));};exports['outboundChannels']=function(_0x2225e4,_0x1a0dcc){return respondWithRpcPromise('OutboundChannels',_0x2225e4[_0x1044('0x15')])[_0x1044('0x8')](respondWithResult(_0x1a0dcc,null))[_0x1044('0xd')](handleError(_0x1a0dcc,null));};exports[_0x1044('0x29')]=function(_0x2cc17e,_0x579b30){var _0x33e303;return respondWithRpcPromise('Agents',_0x2cc17e[_0x1044('0x15')])[_0x1044('0x8')](function(_0x1a1189){_0x33e303=_0x1a1189;return respondWithRpcPromise('Agents',_0x2cc17e[_0x1044('0x15')],routingClient);})[_0x1044('0x8')](function(_0x27667f){return _[_0x1044('0x18')]({},_0x27667f,_0x33e303);})[_0x1044('0x8')](respondWithResult(_0x579b30,null))[_0x1044('0xd')](handleError(_0x579b30,null));};exports[_0x1044('0x2a')]=function(_0x1957d2,_0x3e9bdb){if(_0x1957d2[_0x1044('0x2b')]&&_0x1957d2[_0x1044('0x2b')][_0x1044('0x2c')]&&_0x1957d2['user']&&_0x1957d2[_0x1044('0x2d')][_0x1044('0x10')]){for(var _0x4c5798 in _0x1957d2['body'][_0x1044('0x2c')]){if(_0x1957d2[_0x1044('0x2b')]['interaction']['hasOwnProperty'](_0x4c5798)){db['MemberReport']['findAll']({'where':{'channel':_0x4c5798,'membername':_0x1957d2['user'][_0x1044('0x10')],'type':_0x1044('0x2e'),'exitAt':null,'uniqueid':_0x1957d2['body'][_0x1044('0x2c')][_0x4c5798]&&_0x1957d2['body'][_0x1044('0x2c')][_0x4c5798][_0x1044('0x2f')]?{'$notIn':_0x1957d2[_0x1044('0x2b')][_0x1044('0x2c')][_0x4c5798]}:{'$ne':null}}})['then'](function(_0x569b98){var _0x182b40=moment()[_0x1044('0x30')](_0x1044('0x31'));for(var _0x4f32a4=0x0,_0x3517c4=_0x569b98[_0x1044('0x2f')];_0x4f32a4<_0x3517c4;_0x4f32a4+=0x1){_0x569b98[_0x4f32a4][_0x1044('0x32')]({'exitAt':_0x182b40});}});for(var _0x2daddf=0x0;_0x2daddf<_0x1957d2[_0x1044('0x2b')][_0x1044('0x2c')][_0x4c5798]['length'];_0x2daddf+=0x1){db[_0x1044('0x33')][_0x1044('0x34')]({'where':{'channel':_0x4c5798,'membername':_0x1957d2[_0x1044('0x2d')][_0x1044('0x10')],'type':_0x1044('0x2e'),'uniqueid':_0x1957d2[_0x1044('0x2b')][_0x1044('0x2c')][_0x4c5798][_0x2daddf],'exitAt':null},'defaults':{'channel':_0x4c5798,'membername':_0x1957d2[_0x1044('0x2d')][_0x1044('0x10')],'interface':_['isNil'](_0x1957d2[_0x1044('0x2d')][_0x1044('0x35')])?util[_0x1044('0x30')](_0x1044('0x36'),_0x1957d2[_0x1044('0x2d')][_0x1044('0x10')]):_0x1957d2[_0x1044('0x2d')][_0x1044('0x35')],'type':'INTERACTION','enterAt':moment()[_0x1044('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1044('0x37'),'internal':_0x1957d2['user'][_0x1044('0x38')],'uniqueid':_0x1957d2['body']['interaction'][_0x4c5798][_0x2daddf]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x1957d2[_0x1044('0x19')]['id'],'capacity':_0x1957d2[_0x1044('0x2b')]['capacity']},routingClient)[_0x1044('0x8')](respondWithResult(_0x3e9bdb,null))['catch'](handleError(_0x3e9bdb,null));};exports[_0x1044('0x39')]=function(_0x18fb98,_0x3103c9){return respondWithRpcPromise('Telephones',_0x18fb98[_0x1044('0x15')])[_0x1044('0x8')](respondWithResult(_0x3103c9,null))[_0x1044('0xd')](handleError(_0x3103c9,null));};exports['trunks']=function(_0xa8a990,_0x2d6cb6){return respondWithRpcPromise(_0x1044('0x3a'),_0xa8a990[_0x1044('0x15')])[_0x1044('0x8')](respondWithResult(_0x2d6cb6,null))[_0x1044('0xd')](handleError(_0x2d6cb6,null));};exports[_0x1044('0x3b')]=function(_0x1df8eb,_0x1b09ac){return respondWithRpcPromise(_0x1044('0x3c'),_0x1df8eb['query'])[_0x1044('0x8')](respondWithResult(_0x1b09ac,null))[_0x1044('0xd')](handleError(_0x1b09ac,null));};exports[_0x1044('0x3d')]=function(_0x4a09c8,_0x24a605){return respondWithRpcPromise(_0x1044('0x3e'),_0x4a09c8['query'],routingClient)[_0x1044('0x8')](respondWithResult(_0x24a605,null))['catch'](handleError(_0x24a605,null));};exports[_0x1044('0x3f')]=function(_0x298625,_0x380a6c){return respondWithRpcPromise(_0x1044('0x3e'),_0x298625[_0x1044('0x15')],routingClient)[_0x1044('0x8')](findById(_0x298625[_0x1044('0x19')]['id']))[_0x1044('0x8')](respondWithResult(_0x380a6c,null))[_0x1044('0xd')](handleError(_0x380a6c,null));};exports[_0x1044('0x40')]=function(_0x94ad15,_0x185f32){return respondWithRpcPromise(_0x1044('0x41'),_0x94ad15[_0x1044('0x15')],routingClient)[_0x1044('0x8')](respondWithResult(_0x185f32,null))[_0x1044('0xd')](handleError(_0x185f32,null));};exports['showMailQueues']=function(_0x336a51,_0x4f7bbc){return respondWithRpcPromise(_0x1044('0x41'),_0x336a51[_0x1044('0x15')],routingClient)[_0x1044('0x8')](findById(_0x336a51[_0x1044('0x19')]['id']))['then'](respondWithResult(_0x4f7bbc,null))[_0x1044('0xd')](handleError(_0x4f7bbc,null));};exports['mailAccounts']=function(_0x36be83,_0x2d782d){return respondWithRpcPromise(_0x1044('0x42'),_0x36be83[_0x1044('0x15')],mailClient)['then'](respondWithResult(_0x2d782d,null))['catch'](handleError(_0x2d782d,null));};exports[_0x1044('0x43')]=function(_0x3cb531,_0x54c01c){return respondWithRpcPromise(_0x1044('0x44'),_0x3cb531[_0x1044('0x15')],routingClient)[_0x1044('0x8')](respondWithResult(_0x54c01c,null))[_0x1044('0xd')](handleError(_0x54c01c,null));};exports['showOpenchannelQueues']=function(_0x37f267,_0x3bbe77){return respondWithRpcPromise(_0x1044('0x44'),_0x37f267[_0x1044('0x15')],routingClient)[_0x1044('0x8')](findById(_0x37f267[_0x1044('0x19')]['id']))[_0x1044('0x8')](respondWithResult(_0x3bbe77,null))[_0x1044('0xd')](handleError(_0x3bbe77,null));};exports[_0x1044('0x45')]=function(_0x394c7e,_0x57cc6){return respondWithRpcPromise(_0x1044('0x46'),_0x394c7e['query'],routingClient)[_0x1044('0x8')](respondWithResult(_0x57cc6,null))[_0x1044('0xd')](handleError(_0x57cc6,null));};exports['showSmsQueues']=function(_0x71d561,_0x3268b5){return respondWithRpcPromise('SmsQueues',_0x71d561[_0x1044('0x15')],routingClient)['then'](findById(_0x71d561[_0x1044('0x19')]['id']))[_0x1044('0x8')](respondWithResult(_0x3268b5,null))['catch'](handleError(_0x3268b5,null));};exports[_0x1044('0x47')]=function(_0x4af9d9,_0x339b39){return respondWithRpcPromise(_0x1044('0x48'),_0x4af9d9['query'],routingClient)['then'](respondWithResult(_0x339b39,null))[_0x1044('0xd')](handleError(_0x339b39,null));};exports[_0x1044('0x49')]=function(_0x2acb09,_0x511efd){return respondWithRpcPromise('WhatsappQueues',_0x2acb09[_0x1044('0x15')],routingClient)[_0x1044('0x8')](findById(_0x2acb09[_0x1044('0x19')]['id']))[_0x1044('0x8')](respondWithResult(_0x511efd,null))[_0x1044('0xd')](handleError(_0x511efd,null));};exports[_0x1044('0x4a')]=function(_0x2f8d4d,_0x71d9ab){return respondWithRpcPromise(_0x1044('0x4b'),_0x2f8d4d['query'],routingClient)[_0x1044('0x8')](respondWithResult(_0x71d9ab,null))[_0x1044('0xd')](handleError(_0x71d9ab,null));};exports['showFaxQueues']=function(_0x31f5bc,_0x445f43){return respondWithRpcPromise(_0x1044('0x4b'),_0x31f5bc[_0x1044('0x15')],routingClient)[_0x1044('0x8')](findById(_0x31f5bc['params']['id']))['then'](respondWithResult(_0x445f43,null))['catch'](handleError(_0x445f43,null));};exports['faxAccounts']=function(_0x5399ce,_0x1f2ab1){return respondWithRpcPromise(_0x1044('0x4c'),_0x5399ce[_0x1044('0x15')])[_0x1044('0x8')](respondWithResult(_0x1f2ab1,null))[_0x1044('0xd')](handleError(_0x1f2ab1,null));};exports[_0x1044('0x4d')]=function(_0x5549c9,_0x5ca80f){return respondWithRpcPromise(_0x1044('0x4e'),_0x5549c9[_0x1044('0x15')],routingClient)[_0x1044('0x8')](respondWithResult(_0x5ca80f,null))[_0x1044('0xd')](handleError(_0x5ca80f,null));};exports[_0x1044('0x4f')]=function(_0x2b8d5e,_0x45fadb){return respondWithRpcPromise(_0x1044('0x50'),_0x2b8d5e['query'],routingClient)[_0x1044('0x8')](respondWithResult(_0x45fadb,null))[_0x1044('0xd')](handleError(_0x45fadb,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x31c54a,_0x3ae501){return respondWithRpcPromise(_0x1044('0x51'),_0x31c54a[_0x1044('0x15')],routingClient)[_0x1044('0x8')](respondWithResult(_0x3ae501,null))['catch'](handleError(_0x3ae501,null));};exports[_0x1044('0x52')]=function(_0x154856,_0x369f28){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x154856[_0x1044('0x15')],routingClient)[_0x1044('0x8')](function(_0x231d42){if(_0x154856[_0x1044('0x15')][_0x1044('0x53')]!==undefined){var _0x3d1a96=_(_0x231d42[_0x1044('0x13')])[_0x1044('0x54')]([_0x154856[_0x1044('0x15')][_0x1044('0x53')],_0x154856[_0x1044('0x19')]['id']])[_0x1044('0x55')](_0x1044('0x56'))[_0x1044('0x57')]()[_0x1044('0x58')]();return _0x231d42['rows'][_0x1044('0x54')](function(_0x1c001e){return _0x3d1a96[_0x1044('0x59')](_0x1c001e[_0x1044('0x56')])>-0x1;});}else{return _0x231d42['rows'][_0x1044('0x54')](function(_0x1d3649){return _0x1d3649[_0x1044('0x56')]===parseInt(_0x154856[_0x1044('0x19')]['id']);});}})['then'](respondWithResult(_0x369f28,null))[_0x1044('0xd')](handleError(_0x369f28,null));};exports[_0x1044('0x5a')]=function(_0x415561,_0x589ca3){return respondWithRpcPromise(_0x1044('0x5b'),_0x415561[_0x1044('0x15')],routingClient)['then'](respondWithResult(_0x589ca3,null))[_0x1044('0xd')](handleError(_0x589ca3,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x1adf43,_0x380fa3){return respondWithRpcPromise(_0x1044('0x5c'),_0x1adf43[_0x1044('0x15')],routingClient)[_0x1044('0x8')](respondWithResult(_0x380fa3,null))[_0x1044('0xd')](handleError(_0x380fa3,null));};exports['faxQueuesWaitingInteractions']=function(_0x2628fb,_0x1691cf){return respondWithRpcPromise(_0x1044('0x5d'),_0x2628fb[_0x1044('0x15')],routingClient)['then'](respondWithResult(_0x1691cf,null))[_0x1044('0xd')](handleError(_0x1691cf,null));};exports['queueNotify']=function(_0x25ab6a){return function(_0x7f56f8,_0x1d24c8){var _0x2d7f82,_0x742741;var _0xf13920=_[_0x1044('0x5e')](_0x25ab6a);var _0x20ab1c=_0x25ab6a==='chat'?_0x1044('0x5f'):'Account';return db[_0xf13920+'Queue'][_0x1044('0x60')]({'raw':!![],'where':{'id':_0x7f56f8[_0x1044('0x19')]['id']}})['then'](function(_0x22dae4){if(_[_0x1044('0x12')](_0x22dae4)){throw new Error(_0xf13920+'\x20Queue\x20not\x20found');}_0x2d7f82=_0x22dae4;return db[_0xf13920+_0x1044('0x61')][_0x1044('0x60')]({'where':{'id':_0x7f56f8[_0x1044('0x2b')][_0x1044('0x62')]},'include':[{'model':db[_0xf13920+_0x1044('0x63')],'as':_0x1044('0x63')},{'model':db[_0xf13920+_0x20ab1c],'as':_0x1044('0x64')}]});})[_0x1044('0x8')](function(_0x5d9fc7){if(_[_0x1044('0x12')](_0x5d9fc7)){throw new Error(_0xf13920+_0x1044('0x65'));}_0x742741=_0x5d9fc7;return _0x5d9fc7['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x1044('0x8')](function(){var _0x1d9958={'uniqueid':_0x25ab6a+'.'+_0x742741['id']+'.'+_0x742741[_0x1044('0x63')]['id'],'FromUserId':_0x7f56f8[_0x1044('0x2d')]['id'],'type':_0x1044('0x66')};_0x1d9958[_0xf13920+_0x1044('0x67')]=_0x742741['id'];_0x1d9958[_0xf13920+_0x1044('0x68')]=_0x742741['Interaction']['id'];_0x1d9958[_0x1044('0x69')+_0xf13920+_0x20ab1c+'Id']=_0x742741[_0x1044('0x64')]['id'];_0x1d9958['To'+_0xf13920+'QueueId']=_0x2d7f82['id'];return db[_0xf13920+_0x1044('0x6a')]['create'](_0x1d9958);})[_0x1044('0x8')](function(){return respondWithRpcPromise(_0x1044('0x6b'),{'channel':_0x25ab6a,'interaction':_0x742741[_0x1044('0x63')],'message':_0x742741,'account':_0x742741[_0x1044('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2d7f82['name']+','+(_0x742741[_0x1044('0x64')][_0x1044('0x6c')]||0x12c),'interval':_0x1044('0x6d')}]},routingClient);})[_0x1044('0x8')](respondWithResult(_0x1d24c8,null))[_0x1044('0xd')](handleError(_0x1d24c8,null));};};exports['agentNotify']=function(_0x11990b,_0x1ab40a){var _0x4d9aa5,_0x503796;if(_[_0x1044('0x12')](_0x11990b[_0x1044('0x2b')][_0x1044('0x6e')])){throw new Error(_0x1044('0x6f'));}var _0x4c239d=_0x11990b['body']['channel'];var _0x10dad6=_[_0x1044('0x5e')](_0x4c239d);var _0x1cbfb3=_0x4c239d==='chat'?'Website':_0x1044('0x64');return db['User']['findOne']({'raw':!![],'where':{'id':_0x11990b[_0x1044('0x19')]['id'],'role':_0x1044('0x37')}})[_0x1044('0x8')](function(_0x1caf82){if(_[_0x1044('0x12')](_0x1caf82)){throw new Error(_0x1044('0x70'));}_0x4d9aa5=_0x1caf82;return db[_0x10dad6+_0x1044('0x61')][_0x1044('0x60')]({'where':{'id':_0x11990b[_0x1044('0x2b')][_0x1044('0x62')]},'include':[{'model':db[_0x10dad6+'Interaction'],'as':_0x1044('0x63')},{'model':db[_0x10dad6+_0x1cbfb3],'as':'Account'}]});})[_0x1044('0x8')](function(_0x1c38ce){if(_['isNil'](_0x1c38ce)){throw new Error(_0x10dad6+'\x20Message\x20not\x20found');}_0x503796=_0x1c38ce;return _0x1c38ce[_0x1044('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1044('0x8')](function(){var _0xf2b452={'uniqueid':_0x4c239d+'.'+_0x503796['id']+'.'+_0x503796[_0x1044('0x63')]['id'],'FromUserId':_0x11990b['user']['id'],'type':'queue','ToUserId':_0x4d9aa5['id']};_0xf2b452[_0x10dad6+_0x1044('0x67')]=_0x503796['id'];_0xf2b452[_0x10dad6+_0x1044('0x68')]=_0x503796[_0x1044('0x63')]['id'];_0xf2b452['From'+_0x10dad6+_0x1cbfb3+'Id']=_0x503796['Account']['id'];return db[_0x10dad6+'TransferReport'][_0x1044('0x72')](_0xf2b452);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x4c239d,'interaction':_0x503796[_0x1044('0x63')],'message':_0x503796,'account':_0x503796[_0x1044('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1044('0x37'),'appdata':_0x4d9aa5['name']+','+(_0x503796[_0x1044('0x64')][_0x1044('0x73')]||0x12c),'interval':_0x1044('0x6d')}]},routingClient);})[_0x1044('0x8')](respondWithResult(_0x1ab40a,null))[_0x1044('0xd')](handleError(_0x1ab40a,null));}; \ No newline at end of file +var _0xf330=['telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','lodash','../../config/logger','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','body','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','format','SIP/%s','agent','internal','AgentCapacity','capacity'];(function(_0x1b3228,_0x220869){var _0x47dade=function(_0x27523b){while(--_0x27523b){_0x1b3228['push'](_0x1b3228['shift']());}};_0x47dade(++_0x220869);}(_0xf330,0x146));var _0x0f33=function(_0x558c62,_0x29495a){_0x558c62=_0x558c62-0x0;var _0xf27371=_0xf330[_0x558c62];return _0xf27371;};'use strict';var BPromise=require(_0x0f33('0x0'));var moment=require('moment');var _=require(_0x0f33('0x1'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0f33('0x2'))(_0x0f33('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0f33('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x0f33('0x4')][_0x0f33('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x0f33('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x3d36f2,_0x9596c1,_0x83c995){return new BPromise(function(_0x347233,_0x5c2649){var _0x6d782=_0x83c995?_0x83c995:amiClient;return _0x6d782[_0x0f33('0x6')](_0x3d36f2,_0x9596c1)[_0x0f33('0x7')](function(_0x5b907a){if(_0x5b907a[_0x0f33('0x8')]){if(_0x5b907a[_0x0f33('0x8')][_0x0f33('0x9')]===0x1f4){return _0x5c2649(_0x5b907a[_0x0f33('0x8')]['message']);}return _0x347233(_0x5b907a[_0x0f33('0x8')][_0x0f33('0xa')]);}else{_0x347233(_0x5b907a[_0x0f33('0xb')]);}})[_0x0f33('0xc')](function(_0x41e7ba){_0x5c2649(_0x41e7ba);});});}function respondWithResult(_0x39fce8,_0x5a48d6){_0x5a48d6=_0x5a48d6||0xc8;return function(_0x206c04){if(_0x206c04){return _0x39fce8[_0x0f33('0xd')](_0x5a48d6)['json'](_0x206c04);}return _0x39fce8[_0x0f33('0xe')](0x194);};}function handleError(_0x5b1b33,_0xe17008){_0xe17008=_0xe17008||0x1f4;return function(_0x134719){logger[_0x0f33('0x8')](_0x134719[_0x0f33('0xf')]);if(_0x134719['name']){delete _0x134719[_0x0f33('0x10')];}_0x5b1b33['status'](_0xe17008)[_0x0f33('0x11')](_0x134719);};}function findById(_0x3d454c){return function(_0x51e4f7){if(!_['isNil'](_0x3d454c)&&!_[_0x0f33('0x12')](_0x51e4f7)&&!_[_0x0f33('0x12')](_0x51e4f7[_0x0f33('0x13')])){return _[_0x0f33('0x14')](_0x51e4f7[_0x0f33('0x13')],function(_0x5843b6){return _0x5843b6['id']==_0x3d454c;});}return null;};}exports[_0x0f33('0x15')]=function(_0x321868,_0x29d414){return respondWithRpcPromise(_0x0f33('0x16'),_0x321868['query'])[_0x0f33('0x7')](respondWithResult(_0x29d414,null))[_0x0f33('0xc')](handleError(_0x29d414,null));};exports[_0x0f33('0x17')]=function(_0x145886,_0x44b2bf){return respondWithRpcPromise(_0x0f33('0x18'),_[_0x0f33('0x19')](_0x145886['query'],_0x145886[_0x0f33('0x1a')]))['then'](respondWithResult(_0x44b2bf,null))[_0x0f33('0xc')](handleError(_0x44b2bf,null));};exports['voiceChannelStopMixMonitor']=function(_0x16c945,_0x4bb882){return respondWithRpcPromise(_0x0f33('0x1b'),_[_0x0f33('0x19')](_0x16c945[_0x0f33('0x1c')],_0x16c945[_0x0f33('0x1a')]))[_0x0f33('0x7')](respondWithResult(_0x4bb882,null))[_0x0f33('0xc')](handleError(_0x4bb882,null));};exports[_0x0f33('0x1d')]=function(_0x4894e1,_0x3aa413){return respondWithRpcPromise(_0x0f33('0x1e'),_0x4894e1[_0x0f33('0x1c')])[_0x0f33('0x7')](respondWithResult(_0x3aa413,null))['catch'](handleError(_0x3aa413,null));};exports[_0x0f33('0x1f')]=function(_0x5d8cd5,_0x119122){return respondWithRpcPromise(_0x0f33('0x1e'),_0x5d8cd5[_0x0f33('0x1c')])[_0x0f33('0x7')](findById(_0x5d8cd5[_0x0f33('0x1a')]['id']))[_0x0f33('0x7')](respondWithResult(_0x119122,null))[_0x0f33('0xc')](handleError(_0x119122,null));};exports[_0x0f33('0x20')]=function(_0x215435,_0x271c96){return respondWithRpcPromise(_0x0f33('0x21'),_['merge'](_0x215435[_0x0f33('0x1c')],_0x215435['params']))[_0x0f33('0x7')](respondWithResult(_0x271c96,null))[_0x0f33('0xc')](handleError(_0x271c96,null));};exports[_0x0f33('0x22')]=function(_0x35216e,_0x1b5dd8){return respondWithRpcPromise('VoiceQueuesChannels',_0x35216e[_0x0f33('0x1c')])['then'](respondWithResult(_0x1b5dd8,null))[_0x0f33('0xc')](handleError(_0x1b5dd8,null));};exports[_0x0f33('0x23')]=function(_0x224064,_0x19980c){return respondWithRpcPromise(_0x0f33('0x24'),_[_0x0f33('0x19')](_0x224064[_0x0f33('0x1c')],_0x224064[_0x0f33('0x1a')]))[_0x0f33('0x7')](respondWithResult(_0x19980c,null))[_0x0f33('0xc')](handleError(_0x19980c,null));};exports[_0x0f33('0x25')]=function(_0x8c59e4,_0x3a6401){return respondWithRpcPromise(_0x0f33('0x26'),_[_0x0f33('0x19')](_0x8c59e4['query'],_0x8c59e4[_0x0f33('0x1a')]))['then'](respondWithResult(_0x3a6401,null))['catch'](handleError(_0x3a6401,null));};exports[_0x0f33('0x27')]=function(_0x466464,_0x138a73){return respondWithRpcPromise(_0x0f33('0x28'),_[_0x0f33('0x19')](_0x466464[_0x0f33('0x1c')],_0x466464[_0x0f33('0x1a')]))['then'](respondWithResult(_0x138a73,null))[_0x0f33('0xc')](handleError(_0x138a73,null));};exports[_0x0f33('0x29')]=function(_0x196335,_0x50e597){return respondWithRpcPromise(_0x0f33('0x2a'),_0x196335['query'])[_0x0f33('0x7')](respondWithResult(_0x50e597,null))[_0x0f33('0xc')](handleError(_0x50e597,null));};exports[_0x0f33('0x2b')]=function(_0x80afda,_0x435afa){return respondWithRpcPromise(_0x0f33('0x2c'),_0x80afda[_0x0f33('0x1c')])[_0x0f33('0x7')](respondWithResult(_0x435afa,null))[_0x0f33('0xc')](handleError(_0x435afa,null));};exports['agents']=function(_0x5da63c,_0x427533){var _0x2b9c2b;return respondWithRpcPromise('Agents',_0x5da63c[_0x0f33('0x1c')])[_0x0f33('0x7')](function(_0x370fbc){_0x2b9c2b=_0x370fbc;return respondWithRpcPromise(_0x0f33('0x2d'),_0x5da63c[_0x0f33('0x1c')],routingClient);})[_0x0f33('0x7')](function(_0xc4b3c2){return _['merge']({},_0xc4b3c2,_0x2b9c2b);})[_0x0f33('0x7')](respondWithResult(_0x427533,null))['catch'](handleError(_0x427533,null));};exports[_0x0f33('0x2e')]=function(_0x2b5083,_0x39ddf5){if(_0x2b5083['body']&&_0x2b5083['body'][_0x0f33('0x2f')]&&_0x2b5083[_0x0f33('0x30')]&&_0x2b5083[_0x0f33('0x30')][_0x0f33('0x10')]){for(var _0x4b9e21 in _0x2b5083[_0x0f33('0x31')][_0x0f33('0x2f')]){if(_0x2b5083[_0x0f33('0x31')][_0x0f33('0x2f')][_0x0f33('0x32')](_0x4b9e21)){db['MemberReport'][_0x0f33('0x33')]({'where':{'channel':_0x4b9e21,'membername':_0x2b5083[_0x0f33('0x30')]['name'],'type':_0x0f33('0x34'),'exitAt':null,'uniqueid':_0x2b5083[_0x0f33('0x31')][_0x0f33('0x2f')][_0x4b9e21]&&_0x2b5083[_0x0f33('0x31')][_0x0f33('0x2f')][_0x4b9e21][_0x0f33('0x35')]?{'$notIn':_0x2b5083[_0x0f33('0x31')][_0x0f33('0x2f')][_0x4b9e21]}:{'$ne':null}}})[_0x0f33('0x7')](function(_0x1774fb){var _0x24d7f3=moment()['format'](_0x0f33('0x36'));for(var _0x5772da=0x0,_0xec0096=_0x1774fb[_0x0f33('0x35')];_0x5772da<_0xec0096;_0x5772da+=0x1){_0x1774fb[_0x5772da]['updateAttributes']({'exitAt':_0x24d7f3});}});for(var _0x989b1e=0x0;_0x989b1e<_0x2b5083[_0x0f33('0x31')][_0x0f33('0x2f')][_0x4b9e21]['length'];_0x989b1e+=0x1){db[_0x0f33('0x37')][_0x0f33('0x38')]({'where':{'channel':_0x4b9e21,'membername':_0x2b5083['user'][_0x0f33('0x10')],'type':_0x0f33('0x34'),'uniqueid':_0x2b5083[_0x0f33('0x31')]['interaction'][_0x4b9e21][_0x989b1e],'exitAt':null},'defaults':{'channel':_0x4b9e21,'membername':_0x2b5083['user'][_0x0f33('0x10')],'interface':_['isNil'](_0x2b5083[_0x0f33('0x30')][_0x0f33('0x39')])?util[_0x0f33('0x3a')](_0x0f33('0x3b'),_0x2b5083[_0x0f33('0x30')]['name']):_0x2b5083['user'][_0x0f33('0x39')],'type':_0x0f33('0x34'),'enterAt':moment()[_0x0f33('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x0f33('0x3c'),'internal':_0x2b5083['user'][_0x0f33('0x3d')],'uniqueid':_0x2b5083[_0x0f33('0x31')][_0x0f33('0x2f')][_0x4b9e21][_0x989b1e]}});}}}}return respondWithRpcPromise(_0x0f33('0x3e'),{'id':_0x2b5083[_0x0f33('0x1a')]['id'],'capacity':_0x2b5083[_0x0f33('0x31')][_0x0f33('0x3f')]},routingClient)[_0x0f33('0x7')](respondWithResult(_0x39ddf5,null))[_0x0f33('0xc')](handleError(_0x39ddf5,null));};exports[_0x0f33('0x40')]=function(_0x269a21,_0x55bfa8){return respondWithRpcPromise(_0x0f33('0x41'),_0x269a21[_0x0f33('0x1c')])[_0x0f33('0x7')](respondWithResult(_0x55bfa8,null))[_0x0f33('0xc')](handleError(_0x55bfa8,null));};exports[_0x0f33('0x42')]=function(_0x3883d2,_0x1611b8){return respondWithRpcPromise('Trunks',_0x3883d2[_0x0f33('0x1c')])[_0x0f33('0x7')](respondWithResult(_0x1611b8,null))[_0x0f33('0xc')](handleError(_0x1611b8,null));};exports['campaigns']=function(_0x4274fb,_0x2ec358){return respondWithRpcPromise(_0x0f33('0x43'),_0x4274fb[_0x0f33('0x1c')])['then'](respondWithResult(_0x2ec358,null))['catch'](handleError(_0x2ec358,null));};exports[_0x0f33('0x44')]=function(_0x2f6ae7,_0x224e77){return respondWithRpcPromise(_0x0f33('0x45'),_0x2f6ae7[_0x0f33('0x1c')],routingClient)['then'](respondWithResult(_0x224e77,null))[_0x0f33('0xc')](handleError(_0x224e77,null));};exports[_0x0f33('0x46')]=function(_0x1b722c,_0x3b0059){return respondWithRpcPromise(_0x0f33('0x45'),_0x1b722c[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](findById(_0x1b722c[_0x0f33('0x1a')]['id']))[_0x0f33('0x7')](respondWithResult(_0x3b0059,null))[_0x0f33('0xc')](handleError(_0x3b0059,null));};exports[_0x0f33('0x47')]=function(_0x158ffd,_0x1c46f2){return respondWithRpcPromise(_0x0f33('0x48'),_0x158ffd['query'],routingClient)[_0x0f33('0x7')](respondWithResult(_0x1c46f2,null))['catch'](handleError(_0x1c46f2,null));};exports[_0x0f33('0x49')]=function(_0x2171bc,_0x3d9bc2){return respondWithRpcPromise(_0x0f33('0x48'),_0x2171bc[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](findById(_0x2171bc[_0x0f33('0x1a')]['id']))['then'](respondWithResult(_0x3d9bc2,null))[_0x0f33('0xc')](handleError(_0x3d9bc2,null));};exports['mailAccounts']=function(_0x846545,_0x3eb00f){return respondWithRpcPromise(_0x0f33('0x4a'),_0x846545[_0x0f33('0x1c')],mailClient)[_0x0f33('0x7')](respondWithResult(_0x3eb00f,null))[_0x0f33('0xc')](handleError(_0x3eb00f,null));};exports[_0x0f33('0x4b')]=function(_0x221498,_0x4e3dc4){return respondWithRpcPromise('OpenchannelQueues',_0x221498['query'],routingClient)[_0x0f33('0x7')](respondWithResult(_0x4e3dc4,null))[_0x0f33('0xc')](handleError(_0x4e3dc4,null));};exports[_0x0f33('0x4c')]=function(_0x54cd64,_0x156531){return respondWithRpcPromise(_0x0f33('0x4d'),_0x54cd64[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](findById(_0x54cd64[_0x0f33('0x1a')]['id']))[_0x0f33('0x7')](respondWithResult(_0x156531,null))[_0x0f33('0xc')](handleError(_0x156531,null));};exports['smsQueues']=function(_0x58d16d,_0x1ca1b8){return respondWithRpcPromise(_0x0f33('0x4e'),_0x58d16d['query'],routingClient)[_0x0f33('0x7')](respondWithResult(_0x1ca1b8,null))[_0x0f33('0xc')](handleError(_0x1ca1b8,null));};exports[_0x0f33('0x4f')]=function(_0x2eb7e0,_0x4a2d70){return respondWithRpcPromise(_0x0f33('0x4e'),_0x2eb7e0[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](findById(_0x2eb7e0[_0x0f33('0x1a')]['id']))[_0x0f33('0x7')](respondWithResult(_0x4a2d70,null))[_0x0f33('0xc')](handleError(_0x4a2d70,null));};exports[_0x0f33('0x50')]=function(_0x555665,_0x424cd6){return respondWithRpcPromise(_0x0f33('0x51'),_0x555665[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](respondWithResult(_0x424cd6,null))['catch'](handleError(_0x424cd6,null));};exports[_0x0f33('0x52')]=function(_0xacfed2,_0x457abf){return respondWithRpcPromise(_0x0f33('0x51'),_0xacfed2[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](findById(_0xacfed2[_0x0f33('0x1a')]['id']))[_0x0f33('0x7')](respondWithResult(_0x457abf,null))[_0x0f33('0xc')](handleError(_0x457abf,null));};exports['faxQueues']=function(_0x4b4a60,_0x52ff5e){return respondWithRpcPromise(_0x0f33('0x53'),_0x4b4a60[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](respondWithResult(_0x52ff5e,null))[_0x0f33('0xc')](handleError(_0x52ff5e,null));};exports[_0x0f33('0x54')]=function(_0x264de1,_0x28ccb9){return respondWithRpcPromise(_0x0f33('0x53'),_0x264de1['query'],routingClient)[_0x0f33('0x7')](findById(_0x264de1[_0x0f33('0x1a')]['id']))[_0x0f33('0x7')](respondWithResult(_0x28ccb9,null))['catch'](handleError(_0x28ccb9,null));};exports[_0x0f33('0x55')]=function(_0x3781b3,_0x5bade7){return respondWithRpcPromise(_0x0f33('0x56'),_0x3781b3[_0x0f33('0x1c')])['then'](respondWithResult(_0x5bade7,null))['catch'](handleError(_0x5bade7,null));};exports[_0x0f33('0x57')]=function(_0x1a4fe2,_0x366685){return respondWithRpcPromise(_0x0f33('0x58'),_0x1a4fe2['query'],routingClient)[_0x0f33('0x7')](respondWithResult(_0x366685,null))[_0x0f33('0xc')](handleError(_0x366685,null));};exports[_0x0f33('0x59')]=function(_0x378ce3,_0x2b4194){return respondWithRpcPromise(_0x0f33('0x5a'),_0x378ce3[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](respondWithResult(_0x2b4194,null))[_0x0f33('0xc')](handleError(_0x2b4194,null));};exports[_0x0f33('0x5b')]=function(_0x1601fb,_0x302ca8){return respondWithRpcPromise(_0x0f33('0x5c'),_0x1601fb['query'],routingClient)['then'](respondWithResult(_0x302ca8,null))['catch'](handleError(_0x302ca8,null));};exports[_0x0f33('0x5d')]=function(_0x3c7290,_0x449d66){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3c7290[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](function(_0x1c094e){if(_0x3c7290[_0x0f33('0x1c')][_0x0f33('0x5e')]!==undefined){var _0x11430c=_(_0x1c094e[_0x0f33('0x13')])[_0x0f33('0x5f')]([_0x3c7290['query'][_0x0f33('0x5e')],_0x3c7290['params']['id']])['map'](_0x0f33('0x60'))['uniq']()[_0x0f33('0x61')]();return _0x1c094e[_0x0f33('0x13')][_0x0f33('0x5f')](function(_0x2e3fa2){return _0x11430c[_0x0f33('0x62')](_0x2e3fa2[_0x0f33('0x60')])>-0x1;});}else{return _0x1c094e['rows']['filter'](function(_0x207fb4){return _0x207fb4[_0x0f33('0x60')]===parseInt(_0x3c7290[_0x0f33('0x1a')]['id']);});}})[_0x0f33('0x7')](respondWithResult(_0x449d66,null))[_0x0f33('0xc')](handleError(_0x449d66,null));};exports[_0x0f33('0x63')]=function(_0xb297,_0x511766){return respondWithRpcPromise(_0x0f33('0x64'),_0xb297[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](respondWithResult(_0x511766,null))[_0x0f33('0xc')](handleError(_0x511766,null));};exports[_0x0f33('0x65')]=function(_0x4cafd0,_0x2700c5){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4cafd0[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](respondWithResult(_0x2700c5,null))[_0x0f33('0xc')](handleError(_0x2700c5,null));};exports['faxQueuesWaitingInteractions']=function(_0x4153a7,_0x5c15a){return respondWithRpcPromise(_0x0f33('0x66'),_0x4153a7[_0x0f33('0x1c')],routingClient)[_0x0f33('0x7')](respondWithResult(_0x5c15a,null))[_0x0f33('0xc')](handleError(_0x5c15a,null));};exports['queueNotify']=function(_0x49529f){return function(_0x38f568,_0x5ee2f2){var _0x1855cc,_0x3e8181;var _0x40c8c7=_[_0x0f33('0x67')](_0x49529f);var _0x39f806=_0x49529f===_0x0f33('0x68')?_0x0f33('0x69'):_0x0f33('0x6a');return db[_0x40c8c7+_0x0f33('0x6b')][_0x0f33('0x6c')]({'raw':!![],'where':{'id':_0x38f568[_0x0f33('0x1a')]['id']}})['then'](function(_0x2fa443){if(_[_0x0f33('0x12')](_0x2fa443)){throw new Error(_0x40c8c7+_0x0f33('0x6d'));}_0x1855cc=_0x2fa443;return db[_0x40c8c7+_0x0f33('0x6e')][_0x0f33('0x6c')]({'where':{'id':_0x38f568['body'][_0x0f33('0x6f')]},'include':[{'model':db[_0x40c8c7+'Interaction'],'as':'Interaction'},{'model':db[_0x40c8c7+_0x39f806],'as':_0x0f33('0x6a')}]});})[_0x0f33('0x7')](function(_0x435167){if(_['isNil'](_0x435167)){throw new Error(_0x40c8c7+'\x20Message\x20not\x20found');}_0x3e8181=_0x435167;return _0x435167['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0f33('0x7')](function(){var _0x36b67b={'uniqueid':_0x49529f+'.'+_0x3e8181['id']+'.'+_0x3e8181[_0x0f33('0x70')]['id'],'FromUserId':_0x38f568[_0x0f33('0x30')]['id'],'type':_0x0f33('0x71')};_0x36b67b[_0x40c8c7+_0x0f33('0x72')]=_0x3e8181['id'];_0x36b67b[_0x40c8c7+_0x0f33('0x73')]=_0x3e8181[_0x0f33('0x70')]['id'];_0x36b67b[_0x0f33('0x74')+_0x40c8c7+_0x39f806+'Id']=_0x3e8181['Account']['id'];_0x36b67b['To'+_0x40c8c7+_0x0f33('0x75')]=_0x1855cc['id'];return db[_0x40c8c7+_0x0f33('0x76')][_0x0f33('0x77')](_0x36b67b);})[_0x0f33('0x7')](function(){return respondWithRpcPromise(_0x0f33('0x78'),{'channel':_0x49529f,'interaction':_0x3e8181[_0x0f33('0x70')],'message':_0x3e8181,'account':_0x3e8181[_0x0f33('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0f33('0x71'),'appdata':_0x1855cc[_0x0f33('0x10')]+','+(_0x3e8181[_0x0f33('0x6a')]['queueTransferTimeout']||0x12c),'interval':_0x0f33('0x79')}]},routingClient);})[_0x0f33('0x7')](respondWithResult(_0x5ee2f2,null))[_0x0f33('0xc')](handleError(_0x5ee2f2,null));};};exports[_0x0f33('0x7a')]=function(_0x1bc3be,_0x49d02c){var _0x46b5f4,_0xbeb634;if(_['isNil'](_0x1bc3be[_0x0f33('0x31')][_0x0f33('0x7b')])){throw new Error(_0x0f33('0x7c'));}var _0x4380f5=_0x1bc3be[_0x0f33('0x31')][_0x0f33('0x7b')];var _0x2f1ed0=_[_0x0f33('0x67')](_0x4380f5);var _0x2d89d3=_0x4380f5===_0x0f33('0x68')?_0x0f33('0x69'):_0x0f33('0x6a');return db[_0x0f33('0x7d')][_0x0f33('0x6c')]({'raw':!![],'where':{'id':_0x1bc3be[_0x0f33('0x1a')]['id'],'role':_0x0f33('0x3c')}})['then'](function(_0x484b5d){if(_[_0x0f33('0x12')](_0x484b5d)){throw new Error(_0x0f33('0x7e'));}_0x46b5f4=_0x484b5d;return db[_0x2f1ed0+'Message']['findOne']({'where':{'id':_0x1bc3be[_0x0f33('0x31')][_0x0f33('0x6f')]},'include':[{'model':db[_0x2f1ed0+_0x0f33('0x70')],'as':_0x0f33('0x70')},{'model':db[_0x2f1ed0+_0x2d89d3],'as':_0x0f33('0x6a')}]});})[_0x0f33('0x7')](function(_0x4803b0){if(_[_0x0f33('0x12')](_0x4803b0)){throw new Error(_0x2f1ed0+_0x0f33('0x7f'));}_0xbeb634=_0x4803b0;return _0x4803b0[_0x0f33('0x80')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0f33('0x7')](function(){var _0x4b1c6d={'uniqueid':_0x4380f5+'.'+_0xbeb634['id']+'.'+_0xbeb634[_0x0f33('0x70')]['id'],'FromUserId':_0x1bc3be[_0x0f33('0x30')]['id'],'type':_0x0f33('0x71'),'ToUserId':_0x46b5f4['id']};_0x4b1c6d[_0x2f1ed0+_0x0f33('0x72')]=_0xbeb634['id'];_0x4b1c6d[_0x2f1ed0+_0x0f33('0x73')]=_0xbeb634['Interaction']['id'];_0x4b1c6d[_0x0f33('0x74')+_0x2f1ed0+_0x2d89d3+'Id']=_0xbeb634[_0x0f33('0x6a')]['id'];return db[_0x2f1ed0+_0x0f33('0x76')][_0x0f33('0x77')](_0x4b1c6d);})[_0x0f33('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x4380f5,'interaction':_0xbeb634[_0x0f33('0x70')],'message':_0xbeb634,'account':_0xbeb634['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x46b5f4[_0x0f33('0x10')]+','+(_0xbeb634[_0x0f33('0x6a')][_0x0f33('0x81')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x49d02c,null))[_0x0f33('0xc')](handleError(_0x49d02c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 46ae7c7..34f4418 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 _0xdb25=['../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xdb25,0xa8));var _0x5db2=function(_0x1eb7bf,_0x3ec760){_0x1eb7bf=_0x1eb7bf-0x0;var _0x28092d=_0xdb25[_0x1eb7bf];return _0x28092d;};'use strict';var multer=require(_0x5db2('0x0'));var util=require(_0x5db2('0x1'));var path=require(_0x5db2('0x2'));var timeout=require(_0x5db2('0x3'));var express=require(_0x5db2('0x4'));var router=express[_0x5db2('0x5')]();var auth=require(_0x5db2('0x6'));var interaction=require(_0x5db2('0x7'));var config=require(_0x5db2('0x8'));var controller=require(_0x5db2('0x9'));router[_0x5db2('0xa')]('/',auth[_0x5db2('0xb')](),controller[_0x5db2('0xc')]);router[_0x5db2('0xa')](_0x5db2('0xd'),auth[_0x5db2('0xb')](),controller[_0x5db2('0xe')]);router[_0x5db2('0xa')](_0x5db2('0xf'),auth[_0x5db2('0xb')](),controller[_0x5db2('0x10')]);router[_0x5db2('0x11')]('/',auth[_0x5db2('0xb')](),controller[_0x5db2('0x12')]);router[_0x5db2('0x13')](_0x5db2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5db2('0x14')](_0x5db2('0xd'),auth['isAuthenticated'](),controller[_0x5db2('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3449=['connect-timeout','express','Router','../../components/interaction/service','./schedule.controller','get','index','isAuthenticated','put','/:id','update','multer','util','path'];(function(_0x419fab,_0x4f55cf){var _0x448b8f=function(_0x46cc73){while(--_0x46cc73){_0x419fab['push'](_0x419fab['shift']());}};_0x448b8f(++_0x4f55cf);}(_0x3449,0xf9));var _0x9344=function(_0xe139c4,_0x5102e1){_0xe139c4=_0xe139c4-0x0;var _0x1c800d=_0x3449[_0xe139c4];return _0x1c800d;};'use strict';var multer=require(_0x9344('0x0'));var util=require(_0x9344('0x1'));var path=require(_0x9344('0x2'));var timeout=require(_0x9344('0x3'));var express=require(_0x9344('0x4'));var router=express[_0x9344('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9344('0x6'));var config=require('../../config/environment');var controller=require(_0x9344('0x7'));router[_0x9344('0x8')]('/',auth['isAuthenticated'](),controller[_0x9344('0x9')]);router[_0x9344('0x8')]('/:id',auth[_0x9344('0xa')](),controller['show']);router[_0x9344('0x8')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9344('0xb')](_0x9344('0xc'),auth['isAuthenticated'](),controller[_0x9344('0xd')]);router['delete'](_0x9344('0xc'),auth[_0x9344('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0ec9e43..6ece98c 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 _0x66c7=['minutes','pdf','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','hours'];(function(_0x12fb76,_0x567022){var _0x5d4458=function(_0x184ef9){while(--_0x184ef9){_0x12fb76['push'](_0x12fb76['shift']());}};_0x5d4458(++_0x567022);}(_0x66c7,0x15c));var _0x766c=function(_0x398828,_0x52119b){_0x398828=_0x398828-0x0;var _0x399ce8=_0x66c7[_0x398828];return _0x399ce8;};'use strict';var Sequelize=require(_0x766c('0x0'));module[_0x766c('0x1')]={'name':{'type':Sequelize[_0x766c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x766c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x766c('0x2')],'allowNull':![],'defaultValue':_0x766c('0x4')},'startAt':{'type':Sequelize[_0x766c('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x766c('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x766c('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x766c('0x7'),_0x766c('0x8'),_0x766c('0x9'),_0x766c('0xa'),_0x766c('0xb'),_0x766c('0xc'),_0x766c('0xd')),'allowNull':![],'defaultValue':_0x766c('0xb')},'output':{'type':Sequelize['ENUM']('csv',_0x766c('0xe'),_0x766c('0xf')),'allowNull':![],'defaultValue':_0x766c('0x10')},'type':{'type':Sequelize['ENUM'](_0x766c('0x11'),'default'),'allowNull':![],'defaultValue':_0x766c('0x11')},'sendMail':{'type':Sequelize[_0x766c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x766c('0x2')]},'cc':{'type':Sequelize[_0x766c('0x12')]},'bcc':{'type':Sequelize[_0x766c('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x766c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4148=['days','ENUM','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','hours','minutes'];(function(_0xbd69d7,_0x4f607b){var _0x40bc39=function(_0x5b9a75){while(--_0x5b9a75){_0xbd69d7['push'](_0xbd69d7['shift']());}};_0x40bc39(++_0x4f607b);}(_0x4148,0xc6));var _0x8414=function(_0x2ecf03,_0x2adccf){_0x2ecf03=_0x2ecf03-0x0;var _0x4418ab=_0x4148[_0x2ecf03];return _0x4418ab;};'use strict';var Sequelize=require(_0x8414('0x0'));module[_0x8414('0x1')]={'name':{'type':Sequelize[_0x8414('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8414('0x2')]},'active':{'type':Sequelize[_0x8414('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8414('0x4')},'startAt':{'type':Sequelize[_0x8414('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8414('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8414('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x8414('0x7'),'quarters',_0x8414('0x8'),'weeks','days',_0x8414('0x9'),_0x8414('0xa')),'allowNull':![],'defaultValue':_0x8414('0xb')},'output':{'type':Sequelize[_0x8414('0xc')](_0x8414('0xd'),_0x8414('0xe'),_0x8414('0xf')),'allowNull':![],'defaultValue':_0x8414('0xd')},'type':{'type':Sequelize[_0x8414('0xc')](_0x8414('0x10'),_0x8414('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x8414('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8414('0x12')]},'bcc':{'type':Sequelize[_0x8414('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x8414('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d0d180c..9d3c986 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 _0x1801=['rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','run','../../config/schedule','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','reject','save','update','then','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','type','options','Schedule','count','includeAll','include','findAll'];(function(_0x29f6ab,_0x11237){var _0x8e53b2=function(_0x70fdca){while(--_0x70fdca){_0x29f6ab['push'](_0x29f6ab['shift']());}};_0x8e53b2(++_0x11237);}(_0x1801,0x104));var _0x1180=function(_0x182e4b,_0xf1aab0){_0x182e4b=_0x182e4b-0x0;var _0x5807bc=_0x1801[_0x182e4b];return _0x5807bc;};'use strict';var pdf=require(_0x1180('0x0'));var emlformat=require(_0x1180('0x1'));var rimraf=require(_0x1180('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1180('0x3'));var rp=require(_0x1180('0x4'));var moment=require('moment');var BPromise=require(_0x1180('0x5'));var Mustache=require(_0x1180('0x6'));var util=require('util');var path=require(_0x1180('0x7'));var sox=require('sox');var csv=require(_0x1180('0x8'));var ejs=require(_0x1180('0x9'));var fs=require('fs');var _=require(_0x1180('0xa'));var squel=require(_0x1180('0xb'));var crypto=require(_0x1180('0xc'));var jsforce=require(_0x1180('0xd'));var deskjs=require(_0x1180('0xe'));var toCsv=require(_0x1180('0x8'));var querystring=require(_0x1180('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1180('0x10'));var qs=require(_0x1180('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1180('0x12'));var utils=require(_0x1180('0x13'));var config=require(_0x1180('0x14'));var licenseUtil=require(_0x1180('0x15'));var db=require(_0x1180('0x16'))['db'];function respondWithStatusCode(_0x232269,_0x28df3e){_0x28df3e=_0x28df3e||0xcc;return function(_0xfbc2e5){if(_0xfbc2e5){return _0x232269[_0x1180('0x17')](_0x28df3e);}return _0x232269[_0x1180('0x18')](_0x28df3e)['end']();};}function respondWithResult(_0x39fabf,_0x82a5ca){_0x82a5ca=_0x82a5ca||0xc8;return function(_0x16aa55){if(_0x16aa55){return _0x39fabf[_0x1180('0x18')](_0x82a5ca)[_0x1180('0x19')](_0x16aa55);}};}function respondWithFilteredResult(_0xca4d21,_0x2c0e42){return function(_0x1a93b7){if(_0x1a93b7){var _0x3241b8=_0x1a93b7['count'],_0x4ccca4=_0x2c0e42[_0x1180('0x1a')],_0x5e2c56=_0x2c0e42['offset']+_0x2c0e42['limit'],_0xb362ff;if(_0x5e2c56>=_0x3241b8){_0x5e2c56=_0x3241b8;_0xb362ff=0xc8;}else{_0xb362ff=0xce;}_0xca4d21[_0x1180('0x18')](_0xb362ff);return _0xca4d21[_0x1180('0x1b')]('Content-Range',_0x4ccca4+'-'+_0x5e2c56+'/'+_0x3241b8)[_0x1180('0x19')](_0x1a93b7);}return null;};}function patchUpdates(_0x25db9b){return function(_0x9e373a){try{jsonpatch['apply'](_0x9e373a,_0x25db9b,!![]);}catch(_0x27a60f){return BPromise[_0x1180('0x1c')](_0x27a60f);}return _0x9e373a[_0x1180('0x1d')]();};}function saveUpdates(_0x628fc6,_0x5edc7d){return function(_0x57f945){if(_0x57f945){return _0x57f945[_0x1180('0x1e')](_0x628fc6)['then'](function(_0x50e383){return _0x50e383;});}return null;};}function removeEntity(_0x26ef10,_0x4c1894){return function(_0xa27e18){if(_0xa27e18){return _0xa27e18['destroy']()[_0x1180('0x1f')](function(){var _0x686ae=_0xa27e18['get']({'plain':!![]});var _0x230dbf='Scheduler';return db[_0x1180('0x20')]['destroy']({'where':{'type':_0x230dbf,'resourceId':_0x686ae['id']}})[_0x1180('0x1f')](function(){return _0xa27e18;});})[_0x1180('0x1f')](function(){_0x26ef10[_0x1180('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c173c,_0x2fd06b){return function(_0x476693){if(!_0x476693){_0x2c173c[_0x1180('0x17')](0x194);}return _0x476693;};}function handleError(_0x31c663,_0x2497d7){_0x2497d7=_0x2497d7||0x1f4;return function(_0x270d51){logger['error'](_0x270d51[_0x1180('0x21')]);if(_0x270d51[_0x1180('0x22')]){delete _0x270d51[_0x1180('0x22')];}_0x31c663[_0x1180('0x18')](_0x2497d7)[_0x1180('0x23')](_0x270d51);};}exports['index']=function(_0x4084c2,_0x37e5f2){var _0x3a8978={},_0x4044ed={},_0x7cc93={'count':0x0,'rows':[]};var _0x38a92c=_[_0x1180('0x24')](db['Schedule'][_0x1180('0x25')],function(_0x3d605d){return{'name':_0x3d605d[_0x1180('0x26')],'type':_0x3d605d['type']['key']};});_0x4044ed[_0x1180('0x27')]=_[_0x1180('0x24')](_0x38a92c,'name');_0x4044ed[_0x1180('0x28')]=_[_0x1180('0x29')](_0x4084c2[_0x1180('0x28')]);_0x4044ed['filters']=_[_0x1180('0x2a')](_0x4044ed[_0x1180('0x27')],_0x4044ed[_0x1180('0x28')]);_0x3a8978[_0x1180('0x2b')]=_['intersection'](_0x4044ed[_0x1180('0x27')],qs[_0x1180('0x2c')](_0x4084c2[_0x1180('0x28')][_0x1180('0x2c')]));_0x3a8978[_0x1180('0x2b')]=_0x3a8978[_0x1180('0x2b')][_0x1180('0x2d')]?_0x3a8978['attributes']:_0x4044ed['model'];if(!_0x4084c2['query']['hasOwnProperty']('nolimit')){_0x3a8978[_0x1180('0x2e')]=qs[_0x1180('0x2e')](_0x4084c2[_0x1180('0x28')][_0x1180('0x2e')]);_0x3a8978[_0x1180('0x1a')]=qs[_0x1180('0x1a')](_0x4084c2[_0x1180('0x28')]['offset']);}_0x3a8978[_0x1180('0x2f')]=qs[_0x1180('0x30')](_0x4084c2[_0x1180('0x28')][_0x1180('0x30')]);_0x3a8978[_0x1180('0x31')]=qs[_0x1180('0x32')](_[_0x1180('0x33')](_0x4084c2['query'],_0x4044ed['filters']),_0x38a92c);if(_0x4084c2[_0x1180('0x28')][_0x1180('0x34')]){_0x3a8978[_0x1180('0x31')]=_['merge'](_0x3a8978[_0x1180('0x31')],{'$or':_[_0x1180('0x24')](_0x38a92c,function(_0x506dbf){if(_0x506dbf[_0x1180('0x35')]!=='VIRTUAL'){var _0x3e1131={};_0x3e1131[_0x506dbf['name']]={'$like':'%'+_0x4084c2[_0x1180('0x28')][_0x1180('0x34')]+'%'};return _0x3e1131;}})});}_0x3a8978=_['merge']({},_0x3a8978,_0x4084c2[_0x1180('0x36')]);var _0x10e6e1={'where':_0x3a8978[_0x1180('0x31')]};return db[_0x1180('0x37')]['count'](_0x10e6e1)[_0x1180('0x1f')](function(_0x145564){_0x7cc93[_0x1180('0x38')]=_0x145564;if(_0x4084c2['query'][_0x1180('0x39')]){_0x3a8978[_0x1180('0x3a')]=[{'all':!![]}];}return db[_0x1180('0x37')][_0x1180('0x3b')](_0x3a8978);})[_0x1180('0x1f')](function(_0x13cec6){_0x7cc93[_0x1180('0x3c')]=_0x13cec6;return _0x7cc93;})[_0x1180('0x1f')](respondWithFilteredResult(_0x37e5f2,_0x3a8978))[_0x1180('0x3d')](handleError(_0x37e5f2,null));};exports[_0x1180('0x3e')]=function(_0x508977,_0x55c9c5){var _0x3d10fc={'raw':![],'where':{'id':_0x508977['params']['id']}},_0x15f788={};_0x15f788[_0x1180('0x27')]=_[_0x1180('0x29')](db[_0x1180('0x37')][_0x1180('0x25')]);_0x15f788[_0x1180('0x28')]=_[_0x1180('0x29')](_0x508977['query']);_0x15f788[_0x1180('0x32')]=_[_0x1180('0x2a')](_0x15f788['model'],_0x15f788[_0x1180('0x28')]);_0x3d10fc[_0x1180('0x2b')]=_['intersection'](_0x15f788[_0x1180('0x27')],qs[_0x1180('0x2c')](_0x508977[_0x1180('0x28')][_0x1180('0x2c')]));_0x3d10fc[_0x1180('0x2b')]=_0x3d10fc[_0x1180('0x2b')]['length']?_0x3d10fc['attributes']:_0x15f788[_0x1180('0x27')];if(_0x508977['query'][_0x1180('0x39')]){_0x3d10fc[_0x1180('0x3a')]=[{'all':!![]}];}_0x3d10fc=_['merge']({},_0x3d10fc,_0x508977[_0x1180('0x36')]);return db['Schedule']['find'](_0x3d10fc)[_0x1180('0x1f')](handleEntityNotFound(_0x55c9c5,null))['then'](respondWithResult(_0x55c9c5,null))[_0x1180('0x3d')](handleError(_0x55c9c5,null));};exports[_0x1180('0x3f')]=function(_0x275419,_0x4035d4){return db[_0x1180('0x37')][_0x1180('0x3f')](_0x275419[_0x1180('0x40')],{})[_0x1180('0x1f')](function(_0x3e8745){var _0xc0d391=_0x275419[_0x1180('0x41')]['get']({'plain':!![]});if(!_0xc0d391)throw new Error(_0x1180('0x42'));if(_0xc0d391[_0x1180('0x43')]==='user'){var _0x2218fa=_0x3e8745[_0x1180('0x44')]({'plain':!![]});var _0x263a03=_0x1180('0x45');return db[_0x1180('0x46')][_0x1180('0x47')]({'where':{'name':_0x263a03,'userProfileId':_0xc0d391[_0x1180('0x48')]},'raw':!![]})['then'](function(_0x4d2c8d){if(_0x4d2c8d&&_0x4d2c8d[_0x1180('0x49')]===0x0){return db[_0x1180('0x20')]['create']({'name':_0x2218fa[_0x1180('0x22')],'resourceId':_0x2218fa['id'],'type':_0x4d2c8d['name'],'sectionId':_0x4d2c8d['id']},{})[_0x1180('0x1f')](function(){return _0x3e8745;});}else{return _0x3e8745;}})[_0x1180('0x3d')](function(_0x4f89e1){logger[_0x1180('0x4a')](_0x1180('0x4b'),_0x4f89e1);throw _0x4f89e1;});}return _0x3e8745;})[_0x1180('0x1f')](respondWithResult(_0x4035d4,0xc9))['catch'](handleError(_0x4035d4,null));};exports[_0x1180('0x1e')]=function(_0xd9501,_0x8b52df){if(_0xd9501[_0x1180('0x40')]['id']){delete _0xd9501[_0x1180('0x40')]['id'];}return db[_0x1180('0x37')][_0x1180('0x47')]({'where':{'id':_0xd9501['params']['id']}})[_0x1180('0x1f')](handleEntityNotFound(_0x8b52df,null))[_0x1180('0x1f')](saveUpdates(_0xd9501['body'],null))[_0x1180('0x1f')](respondWithResult(_0x8b52df,null))[_0x1180('0x3d')](handleError(_0x8b52df,null));};exports[_0x1180('0x4c')]=function(_0x3cdfca,_0x4334b2){return db[_0x1180('0x37')][_0x1180('0x47')]({'where':{'id':_0x3cdfca[_0x1180('0x4d')]['id']}})[_0x1180('0x1f')](handleEntityNotFound(_0x4334b2,null))[_0x1180('0x1f')](removeEntity(_0x4334b2,null))[_0x1180('0x3d')](handleError(_0x4334b2,null));};exports[_0x1180('0x4e')]=function(_0x121bf1,_0xaa5410,_0x2f6b71){var _0x574c2c=require(_0x1180('0x4f'));return db[_0x1180('0x37')][_0x1180('0x47')]({'where':{'id':_0x121bf1['params']['id']},'raw':!![]})[_0x1180('0x1f')](handleEntityNotFound(_0xaa5410,null))[_0x1180('0x1f')](function(){_0x574c2c['run'](_0x121bf1[_0x1180('0x4d')]['id']);})['then'](respondWithStatusCode(_0xaa5410,null))[_0x1180('0x3d')](handleError(_0xaa5410,null));}; \ No newline at end of file +var _0x449f=['then','destroy','get','Scheduler','UserProfileResource','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','body','params','run','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x449f,0x182));var _0xf449=function(_0x4bbaba,_0x15097c){_0x4bbaba=_0x4bbaba-0x0;var _0x34ff2b=_0x449f[_0x4bbaba];return _0x34ff2b;};'use strict';var pdf=require(_0xf449('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf449('0x1'));var zipdir=require(_0xf449('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf449('0x3'));var moment=require('moment');var BPromise=require(_0xf449('0x4'));var Mustache=require(_0xf449('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf449('0x6'));var csv=require(_0xf449('0x7'));var ejs=require(_0xf449('0x8'));var fs=require('fs');var _=require(_0xf449('0x9'));var squel=require(_0xf449('0xa'));var crypto=require('crypto');var jsforce=require(_0xf449('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf449('0x7'));var querystring=require(_0xf449('0xc'));var Papa=require(_0xf449('0xd'));var Redis=require(_0xf449('0xe'));var authService=require(_0xf449('0xf'));var qs=require(_0xf449('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf449('0x11'));var logger=require(_0xf449('0x12'))(_0xf449('0x13'));var utils=require(_0xf449('0x14'));var config=require(_0xf449('0x15'));var licenseUtil=require(_0xf449('0x16'));var db=require(_0xf449('0x17'))['db'];function respondWithStatusCode(_0x49c81d,_0x1c6744){_0x1c6744=_0x1c6744||0xcc;return function(_0x53bca1){if(_0x53bca1){return _0x49c81d[_0xf449('0x18')](_0x1c6744);}return _0x49c81d[_0xf449('0x19')](_0x1c6744)[_0xf449('0x1a')]();};}function respondWithResult(_0x17708e,_0x166066){_0x166066=_0x166066||0xc8;return function(_0x20817f){if(_0x20817f){return _0x17708e[_0xf449('0x19')](_0x166066)[_0xf449('0x1b')](_0x20817f);}};}function respondWithFilteredResult(_0x4379f7,_0x1b36a1){return function(_0x53c753){if(_0x53c753){var _0x50827b=_0x53c753['count'],_0x407d4f=_0x1b36a1['offset'],_0x42c3b3=_0x1b36a1['offset']+_0x1b36a1[_0xf449('0x1c')],_0x3d3de1;if(_0x42c3b3>=_0x50827b){_0x42c3b3=_0x50827b;_0x3d3de1=0xc8;}else{_0x3d3de1=0xce;}_0x4379f7['status'](_0x3d3de1);return _0x4379f7['set'](_0xf449('0x1d'),_0x407d4f+'-'+_0x42c3b3+'/'+_0x50827b)[_0xf449('0x1b')](_0x53c753);}return null;};}function patchUpdates(_0x584565){return function(_0x10522a){try{jsonpatch[_0xf449('0x1e')](_0x10522a,_0x584565,!![]);}catch(_0x432283){return BPromise[_0xf449('0x1f')](_0x432283);}return _0x10522a[_0xf449('0x20')]();};}function saveUpdates(_0x5a5344,_0x4ea8cf){return function(_0x405c5a){if(_0x405c5a){return _0x405c5a[_0xf449('0x21')](_0x5a5344)[_0xf449('0x22')](function(_0x4ccf5c){return _0x4ccf5c;});}return null;};}function removeEntity(_0x136ba0,_0x200f98){return function(_0x4004d7){if(_0x4004d7){return _0x4004d7[_0xf449('0x23')]()[_0xf449('0x22')](function(){var _0x338bca=_0x4004d7[_0xf449('0x24')]({'plain':!![]});var _0x16a9e3=_0xf449('0x25');return db[_0xf449('0x26')][_0xf449('0x23')]({'where':{'type':_0x16a9e3,'resourceId':_0x338bca['id']}})['then'](function(){return _0x4004d7;});})['then'](function(){_0x136ba0[_0xf449('0x19')](0xcc)[_0xf449('0x1a')]();});}};}function handleEntityNotFound(_0x3b964d,_0x2b77f7){return function(_0xa47e69){if(!_0xa47e69){_0x3b964d['sendStatus'](0x194);}return _0xa47e69;};}function handleError(_0x21934a,_0x1fb6e7){_0x1fb6e7=_0x1fb6e7||0x1f4;return function(_0x5d6ee9){logger['error'](_0x5d6ee9[_0xf449('0x27')]);if(_0x5d6ee9['name']){delete _0x5d6ee9[_0xf449('0x28')];}_0x21934a[_0xf449('0x19')](_0x1fb6e7)['send'](_0x5d6ee9);};}exports[_0xf449('0x29')]=function(_0x1fc57c,_0x1da733){var _0x18ea4c={},_0x3fa60c={},_0x4fd08f={'count':0x0,'rows':[]};var _0x3c1aaf=_[_0xf449('0x2a')](db[_0xf449('0x2b')][_0xf449('0x2c')],function(_0x31091b){return{'name':_0x31091b[_0xf449('0x2d')],'type':_0x31091b[_0xf449('0x2e')][_0xf449('0x2f')]};});_0x3fa60c[_0xf449('0x30')]=_['map'](_0x3c1aaf,_0xf449('0x28'));_0x3fa60c[_0xf449('0x31')]=_[_0xf449('0x32')](_0x1fc57c[_0xf449('0x31')]);_0x3fa60c['filters']=_[_0xf449('0x33')](_0x3fa60c[_0xf449('0x30')],_0x3fa60c['query']);_0x18ea4c[_0xf449('0x34')]=_[_0xf449('0x33')](_0x3fa60c['model'],qs[_0xf449('0x35')](_0x1fc57c[_0xf449('0x31')][_0xf449('0x35')]));_0x18ea4c[_0xf449('0x34')]=_0x18ea4c[_0xf449('0x34')]['length']?_0x18ea4c[_0xf449('0x34')]:_0x3fa60c[_0xf449('0x30')];if(!_0x1fc57c['query'][_0xf449('0x36')]('nolimit')){_0x18ea4c[_0xf449('0x1c')]=qs[_0xf449('0x1c')](_0x1fc57c[_0xf449('0x31')][_0xf449('0x1c')]);_0x18ea4c[_0xf449('0x37')]=qs[_0xf449('0x37')](_0x1fc57c['query'][_0xf449('0x37')]);}_0x18ea4c[_0xf449('0x38')]=qs['sort'](_0x1fc57c[_0xf449('0x31')][_0xf449('0x39')]);_0x18ea4c[_0xf449('0x3a')]=qs['filters'](_[_0xf449('0x3b')](_0x1fc57c[_0xf449('0x31')],_0x3fa60c[_0xf449('0x3c')]),_0x3c1aaf);if(_0x1fc57c[_0xf449('0x31')]['filter']){_0x18ea4c['where']=_[_0xf449('0x3d')](_0x18ea4c[_0xf449('0x3a')],{'$or':_['map'](_0x3c1aaf,function(_0x2b15db){if(_0x2b15db[_0xf449('0x2e')]!==_0xf449('0x3e')){var _0x166300={};_0x166300[_0x2b15db[_0xf449('0x28')]]={'$like':'%'+_0x1fc57c[_0xf449('0x31')][_0xf449('0x3f')]+'%'};return _0x166300;}})});}_0x18ea4c=_[_0xf449('0x3d')]({},_0x18ea4c,_0x1fc57c[_0xf449('0x40')]);var _0x55f662={'where':_0x18ea4c['where']};return db['Schedule'][_0xf449('0x41')](_0x55f662)[_0xf449('0x22')](function(_0x3b4fcb){_0x4fd08f['count']=_0x3b4fcb;if(_0x1fc57c[_0xf449('0x31')][_0xf449('0x42')]){_0x18ea4c[_0xf449('0x43')]=[{'all':!![]}];}return db[_0xf449('0x2b')][_0xf449('0x44')](_0x18ea4c);})['then'](function(_0x395e3a){_0x4fd08f[_0xf449('0x45')]=_0x395e3a;return _0x4fd08f;})[_0xf449('0x22')](respondWithFilteredResult(_0x1da733,_0x18ea4c))[_0xf449('0x46')](handleError(_0x1da733,null));};exports[_0xf449('0x47')]=function(_0x5aa60a,_0x14c52e){var _0x57d4a3={'raw':![],'where':{'id':_0x5aa60a['params']['id']}},_0x1e1139={};_0x1e1139[_0xf449('0x30')]=_[_0xf449('0x32')](db[_0xf449('0x2b')]['rawAttributes']);_0x1e1139['query']=_['keys'](_0x5aa60a[_0xf449('0x31')]);_0x1e1139[_0xf449('0x3c')]=_['intersection'](_0x1e1139[_0xf449('0x30')],_0x1e1139['query']);_0x57d4a3[_0xf449('0x34')]=_['intersection'](_0x1e1139[_0xf449('0x30')],qs['fields'](_0x5aa60a[_0xf449('0x31')][_0xf449('0x35')]));_0x57d4a3['attributes']=_0x57d4a3['attributes']['length']?_0x57d4a3[_0xf449('0x34')]:_0x1e1139[_0xf449('0x30')];if(_0x5aa60a[_0xf449('0x31')][_0xf449('0x42')]){_0x57d4a3[_0xf449('0x43')]=[{'all':!![]}];}_0x57d4a3=_[_0xf449('0x3d')]({},_0x57d4a3,_0x5aa60a[_0xf449('0x40')]);return db[_0xf449('0x2b')][_0xf449('0x48')](_0x57d4a3)['then'](handleEntityNotFound(_0x14c52e,null))[_0xf449('0x22')](respondWithResult(_0x14c52e,null))[_0xf449('0x46')](handleError(_0x14c52e,null));};exports['create']=function(_0x27aec7,_0x442164){return db[_0xf449('0x2b')][_0xf449('0x49')](_0x27aec7['body'],{})[_0xf449('0x22')](function(_0x343758){var _0x2f117d=_0x27aec7[_0xf449('0x4a')][_0xf449('0x24')]({'plain':!![]});if(!_0x2f117d)throw new Error(_0xf449('0x4b'));if(_0x2f117d[_0xf449('0x4c')]===_0xf449('0x4a')){var _0xcc41f3=_0x343758[_0xf449('0x24')]({'plain':!![]});var _0x101cbf=_0xf449('0x25');return db[_0xf449('0x4d')][_0xf449('0x48')]({'where':{'name':_0x101cbf,'userProfileId':_0x2f117d[_0xf449('0x4e')]},'raw':!![]})[_0xf449('0x22')](function(_0x3997af){if(_0x3997af&&_0x3997af[_0xf449('0x4f')]===0x0){return db[_0xf449('0x26')][_0xf449('0x49')]({'name':_0xcc41f3[_0xf449('0x28')],'resourceId':_0xcc41f3['id'],'type':_0x3997af['name'],'sectionId':_0x3997af['id']},{})[_0xf449('0x22')](function(){return _0x343758;});}else{return _0x343758;}})['catch'](function(_0x46ae59){logger[_0xf449('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46ae59);throw _0x46ae59;});}return _0x343758;})[_0xf449('0x22')](respondWithResult(_0x442164,0xc9))['catch'](handleError(_0x442164,null));};exports[_0xf449('0x21')]=function(_0x184f60,_0x12dba6){if(_0x184f60[_0xf449('0x51')]['id']){delete _0x184f60[_0xf449('0x51')]['id'];}return db['Schedule']['find']({'where':{'id':_0x184f60['params']['id']}})[_0xf449('0x22')](handleEntityNotFound(_0x12dba6,null))[_0xf449('0x22')](saveUpdates(_0x184f60[_0xf449('0x51')],null))[_0xf449('0x22')](respondWithResult(_0x12dba6,null))[_0xf449('0x46')](handleError(_0x12dba6,null));};exports[_0xf449('0x23')]=function(_0x521166,_0xe9ca8c){return db[_0xf449('0x2b')]['find']({'where':{'id':_0x521166[_0xf449('0x52')]['id']}})['then'](handleEntityNotFound(_0xe9ca8c,null))[_0xf449('0x22')](removeEntity(_0xe9ca8c,null))[_0xf449('0x46')](handleError(_0xe9ca8c,null));};exports[_0xf449('0x53')]=function(_0x4b424f,_0x2e92eb,_0x2f276f){var _0x22f784=require('../../config/schedule');return db[_0xf449('0x2b')]['find']({'where':{'id':_0x4b424f[_0xf449('0x52')]['id']},'raw':!![]})[_0xf449('0x22')](handleEntityNotFound(_0x2e92eb,null))[_0xf449('0x22')](function(){_0x22f784['run'](_0x4b424f[_0xf449('0x52')]['id']);})[_0xf449('0x22')](respondWithStatusCode(_0x2e92eb,null))[_0xf449('0x46')](handleError(_0x2e92eb,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ac7b534..7e332e0 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 _0xc1ff=['./schedule.attributes','define','Schedule','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x15a346,_0x46d825){var _0x275a0f=function(_0x3df115){while(--_0x3df115){_0x15a346['push'](_0x15a346['shift']());}};_0x275a0f(++_0x46d825);}(_0xc1ff,0x19d));var _0xfc1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfc1f('0x0'));var logger=require(_0xfc1f('0x1'))('api');var moment=require(_0xfc1f('0x2'));var BPromise=require(_0xfc1f('0x3'));var rp=require(_0xfc1f('0x4'));var fs=require('fs');var path=require(_0xfc1f('0x5'));var rimraf=require('rimraf');var config=require(_0xfc1f('0x6'));var attributes=require(_0xfc1f('0x7'));module['exports']=function(_0x542ee2,_0x2aa454){return _0x542ee2[_0xfc1f('0x8')](_0xfc1f('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7aa=['api','moment','bluebird','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7aa,0x152));var _0xac7a=function(_0x93b2a1,_0x349f87){_0x93b2a1=_0x93b2a1-0x0;var _0x31a55d=_0xc7aa[_0x93b2a1];return _0x31a55d;};'use strict';var _=require('lodash');var util=require(_0xac7a('0x0'));var logger=require(_0xac7a('0x1'))(_0xac7a('0x2'));var moment=require(_0xac7a('0x3'));var BPromise=require(_0xac7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac7a('0x5'));var config=require(_0xac7a('0x6'));var attributes=require(_0xac7a('0x7'));module[_0xac7a('0x8')]=function(_0x446c44,_0x416f02){return _0x446c44['define'](_0xac7a('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index e4e7db1..d25f9e2 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 _0xa6b7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','stringify','error','Schedule,\x20%s,\x20%s','message','catch','lodash'];(function(_0x5734f9,_0x3ec8d9){var _0x1f8bcb=function(_0x44f2a3){while(--_0x44f2a3){_0x5734f9['push'](_0x5734f9['shift']());}};_0x1f8bcb(++_0x3ec8d9);}(_0xa6b7,0x84));var _0x7a6b=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xa6b7[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0x7a6b('0x0'));var util=require('util');var moment=require(_0x7a6b('0x1'));var BPromise=require(_0x7a6b('0x2'));var rs=require(_0x7a6b('0x3'));var fs=require('fs');var Redis=require(_0x7a6b('0x4'));var db=require(_0x7a6b('0x5'))['db'];var utils=require(_0x7a6b('0x6'));var logger=require(_0x7a6b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a6b('0x8')][_0x7a6b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d3c06,_0x413240,_0x36ecbd){return new BPromise(function(_0x1269aa,_0x57dbda){return client[_0x7a6b('0xa')](_0x1d3c06,_0x36ecbd)[_0x7a6b('0xb')](function(_0xbb8b18){logger[_0x7a6b('0xc')]('Schedule,\x20%s,\x20%s',_0x413240,_0x7a6b('0xd'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x413240,_0x7a6b('0xd'),JSON[_0x7a6b('0xe')](_0xbb8b18));if(_0xbb8b18[_0x7a6b('0xf')]){if(_0xbb8b18[_0x7a6b('0xf')]['code']===0x1f4){logger[_0x7a6b('0xf')](_0x7a6b('0x10'),_0x413240,_0xbb8b18[_0x7a6b('0xf')][_0x7a6b('0x11')]);return _0x57dbda(_0xbb8b18[_0x7a6b('0xf')][_0x7a6b('0x11')]);}logger[_0x7a6b('0xf')](_0x7a6b('0x10'),_0x413240,_0xbb8b18[_0x7a6b('0xf')][_0x7a6b('0x11')]);return _0x1269aa(_0xbb8b18[_0x7a6b('0xf')]['message']);}else{logger['info'](_0x7a6b('0x10'),_0x413240,_0x7a6b('0xd'));_0x1269aa(_0xbb8b18['result']['message']);}})[_0x7a6b('0x12')](function(_0x916598){logger['error'](_0x7a6b('0x10'),_0x413240,_0x916598);_0x57dbda(_0x916598);});});} \ No newline at end of file +var _0x6e37=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6e37,0x18f));var _0x76e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e37[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76e3('0x0'));var util=require(_0x76e3('0x1'));var moment=require(_0x76e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x76e3('0x3'));var fs=require('fs');var Redis=require(_0x76e3('0x4'));var db=require(_0x76e3('0x5'))['db'];var utils=require(_0x76e3('0x6'));var logger=require(_0x76e3('0x7'))(_0x76e3('0x8'));var config=require(_0x76e3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b159d,_0xde4c5,_0x48d098){return new BPromise(function(_0x1ffa49,_0x3975c6){return client[_0x76e3('0xb')](_0x2b159d,_0x48d098)['then'](function(_0x2e10e8){logger[_0x76e3('0xc')](_0x76e3('0xd'),_0xde4c5,_0x76e3('0xe'));logger['debug'](_0x76e3('0xf'),_0xde4c5,'request\x20sent',JSON[_0x76e3('0x10')](_0x2e10e8));if(_0x2e10e8[_0x76e3('0x11')]){if(_0x2e10e8[_0x76e3('0x11')]['code']===0x1f4){logger['error'](_0x76e3('0xd'),_0xde4c5,_0x2e10e8['error'][_0x76e3('0x12')]);return _0x3975c6(_0x2e10e8[_0x76e3('0x11')][_0x76e3('0x12')]);}logger[_0x76e3('0x11')]('Schedule,\x20%s,\x20%s',_0xde4c5,_0x2e10e8['error'][_0x76e3('0x12')]);return _0x1ffa49(_0x2e10e8[_0x76e3('0x11')]['message']);}else{logger[_0x76e3('0xc')](_0x76e3('0xd'),_0xde4c5,_0x76e3('0xe'));_0x1ffa49(_0x2e10e8['result']['message']);}})['catch'](function(_0x23d709){logger[_0x76e3('0x11')]('Schedule,\x20%s,\x20%s',_0xde4c5,_0x23d709);_0x3975c6(_0x23d709);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 82f91d8..93674b5 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 _0x8909=['/describe','describe','isAuthenticated','download','post','create','put','/:id','delete','destroy','util','path','connect-timeout','express','../../config/environment','./screenRecording.controller','get','index'];(function(_0x1627d0,_0x5c07b1){var _0x4d6e63=function(_0x2cac11){while(--_0x2cac11){_0x1627d0['push'](_0x1627d0['shift']());}};_0x4d6e63(++_0x5c07b1);}(_0x8909,0x1de));var _0x9890=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x8909[_0x33bc64];return _0x3fdd34;};'use strict';var multer=require('multer');var util=require(_0x9890('0x0'));var path=require(_0x9890('0x1'));var timeout=require(_0x9890('0x2'));var express=require(_0x9890('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9890('0x4'));var controller=require(_0x9890('0x5'));router[_0x9890('0x6')]('/',auth['isAuthenticated'](),controller[_0x9890('0x7')]);router[_0x9890('0x6')](_0x9890('0x8'),auth['isAuthenticated'](),controller[_0x9890('0x9')]);router[_0x9890('0x6')]('/:id',auth[_0x9890('0xa')](),controller['show']);router[_0x9890('0x6')]('/:id/download',auth[_0x9890('0xa')](),controller[_0x9890('0xb')]);router[_0x9890('0xc')]('/',auth['isAuthenticated'](),controller[_0x9890('0xd')]);router[_0x9890('0xe')](_0x9890('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x9890('0x10')](_0x9890('0xf'),auth[_0x9890('0xa')](),controller[_0x9890('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5114=['update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','download','put'];(function(_0x1292c7,_0x1b8bc9){var _0x4258cc=function(_0x5e8e3e){while(--_0x5e8e3e){_0x1292c7['push'](_0x1292c7['shift']());}};_0x4258cc(++_0x1b8bc9);}(_0x5114,0x1b8));var _0x4511=function(_0x65a4a2,_0x2d70bc){_0x65a4a2=_0x65a4a2-0x0;var _0x594262=_0x5114[_0x65a4a2];return _0x594262;};'use strict';var multer=require('multer');var util=require(_0x4511('0x0'));var path=require(_0x4511('0x1'));var timeout=require('connect-timeout');var express=require(_0x4511('0x2'));var router=express[_0x4511('0x3')]();var auth=require(_0x4511('0x4'));var interaction=require(_0x4511('0x5'));var config=require('../../config/environment');var controller=require(_0x4511('0x6'));router[_0x4511('0x7')]('/',auth['isAuthenticated'](),controller[_0x4511('0x8')]);router[_0x4511('0x7')](_0x4511('0x9'),auth[_0x4511('0xa')](),controller[_0x4511('0xb')]);router[_0x4511('0x7')](_0x4511('0xc'),auth[_0x4511('0xa')](),controller[_0x4511('0xd')]);router['get']('/:id/download',auth[_0x4511('0xa')](),controller[_0x4511('0xe')]);router['post']('/',auth[_0x4511('0xa')](),controller['create']);router[_0x4511('0xf')](_0x4511('0xc'),auth['isAuthenticated'](),controller[_0x4511('0x10')]);router[_0x4511('0x11')]('/:id',auth[_0x4511('0xa')](),controller[_0x4511('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 68c9445..b5d7174 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 _0x4bc3=['setDataValue','INTEGER','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','extname','STRING'];(function(_0x1fbc3a,_0x2a3f5e){var _0x477132=function(_0x1552eb){while(--_0x1552eb){_0x1fbc3a['push'](_0x1fbc3a['shift']());}};_0x477132(++_0x2a3f5e);}(_0x4bc3,0x16e));var _0x34bc=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x4bc3[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var path=require('path');var config=require(_0x34bc('0x2'));module[_0x34bc('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x34bc('0x4')](_0x34bc('0x5'))?path[_0x34bc('0x6')](this[_0x34bc('0x4')](_0x34bc('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x34bc('0x7')]},'channel':{'type':Sequelize[_0x34bc('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x21451b){var _0x50320d=_0x21451b['replace'](/\\/g,'/');this[_0x34bc('0x8')](_0x34bc('0x5'),_0x50320d);}},'rating':{'type':Sequelize[_0x34bc('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x34bc('0x9')],'set':function(_0x409105){this[_0x34bc('0x8')]('startedAt',moment()['subtract'](_0x409105,'ms'));this[_0x34bc('0x8')](_0x34bc('0xa'),moment());this[_0x34bc('0x8')]('duration',_0x409105);}},'startedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xc')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xa')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x34bc('0x4')]('createdAt'))[_0x34bc('0xd')](_0x34bc('0xe'))[_0x34bc('0xf')]();}},'updatedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this[_0x34bc('0x4')](_0x34bc('0x10')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x33c5=['path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','moment'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x33c5,0xe6));var _0x533c=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0x33c5[_0x224dda];return _0x2987ac;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var config=require('../../config/environment');module[_0x533c('0x2')]={'format':{'type':Sequelize[_0x533c('0x3')],'get':function(){return this[_0x533c('0x4')](_0x533c('0x5'))?path[_0x533c('0x6')](this['getDataValue'](_0x533c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x533c('0x7')]},'channel':{'type':Sequelize[_0x533c('0x7')]},'value':{'type':Sequelize[_0x533c('0x7')],'set':function(_0x34ca89){var _0x1699d5=_0x34ca89[_0x533c('0x8')](/\\/g,'/');this[_0x533c('0x9')](_0x533c('0x5'),_0x1699d5);}},'rating':{'type':Sequelize[_0x533c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x533c('0xa')],'set':function(_0x46536d){this[_0x533c('0x9')](_0x533c('0xb'),moment()[_0x533c('0xc')](_0x46536d,'ms'));this[_0x533c('0x9')]('closedAt',moment());this[_0x533c('0x9')](_0x533c('0xd'),_0x46536d);}},'startedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0xb')))[_0x533c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x533c('0x10')]();}},'closedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x11')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'createdAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this['getDataValue'](_0x533c('0x13')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x14')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 17872d7..343a069 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 _0x2874=['key','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','ScreenRecording','rawAttributes','fieldName','type'];(function(_0x2eee73,_0x3eecc4){var _0xb94756=function(_0x5ecf5d){while(--_0x5ecf5d){_0x2eee73['push'](_0x2eee73['shift']());}};_0xb94756(++_0x3eecc4);}(_0x2874,0xa3));var _0x4287=function(_0xf852,_0x4ddd76){_0xf852=_0xf852-0x0;var _0x5b2550=_0x2874[_0xf852];return _0x5b2550;};'use strict';var pdf=require(_0x4287('0x0'));var emlformat=require(_0x4287('0x1'));var rimraf=require(_0x4287('0x2'));var zipdir=require(_0x4287('0x3'));var jsonpatch=require(_0x4287('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4287('0x5'));var Mustache=require(_0x4287('0x6'));var util=require(_0x4287('0x7'));var path=require('path');var sox=require(_0x4287('0x8'));var csv=require(_0x4287('0x9'));var ejs=require(_0x4287('0xa'));var fs=require('fs');var _=require(_0x4287('0xb'));var squel=require(_0x4287('0xc'));var crypto=require('crypto');var jsforce=require(_0x4287('0xd'));var deskjs=require(_0x4287('0xe'));var toCsv=require(_0x4287('0x9'));var querystring=require(_0x4287('0xf'));var Papa=require(_0x4287('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4287('0x11'));var as=require(_0x4287('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4287('0x13'))(_0x4287('0x14'));var utils=require(_0x4287('0x15'));var config=require(_0x4287('0x16'));var licenseUtil=require(_0x4287('0x17'));var db=require(_0x4287('0x18'))['db'];function respondWithStatusCode(_0x6cea55,_0x5db54e){_0x5db54e=_0x5db54e||0xcc;return function(_0x167030){if(_0x167030){return _0x6cea55[_0x4287('0x19')](_0x5db54e);}return _0x6cea55['status'](_0x5db54e)[_0x4287('0x1a')]();};}function respondWithResult(_0x37049c,_0x8fb1c1){_0x8fb1c1=_0x8fb1c1||0xc8;return function(_0x1b4a5f){if(_0x1b4a5f){return _0x37049c[_0x4287('0x1b')](_0x8fb1c1)['json'](_0x1b4a5f);}};}function respondWithFilteredResult(_0x5b1114,_0x18fcd9){return function(_0x44ab24){if(_0x44ab24){var _0x2a483f=_0x44ab24[_0x4287('0x1c')],_0x6198b7=_0x18fcd9[_0x4287('0x1d')],_0x1c729b=_0x18fcd9[_0x4287('0x1d')]+_0x18fcd9[_0x4287('0x1e')],_0x2e0d7d;if(_0x1c729b>=_0x2a483f){_0x1c729b=_0x2a483f;_0x2e0d7d=0xc8;}else{_0x2e0d7d=0xce;}_0x5b1114[_0x4287('0x1b')](_0x2e0d7d);return _0x5b1114['set'](_0x4287('0x1f'),_0x6198b7+'-'+_0x1c729b+'/'+_0x2a483f)['json'](_0x44ab24);}return null;};}function patchUpdates(_0x4e6a7f){return function(_0x4894a0){try{jsonpatch[_0x4287('0x20')](_0x4894a0,_0x4e6a7f,!![]);}catch(_0x562a21){return BPromise[_0x4287('0x21')](_0x562a21);}return _0x4894a0[_0x4287('0x22')]();};}function saveUpdates(_0x130b0e,_0x58e535){return function(_0x399b56){if(_0x399b56){return _0x399b56[_0x4287('0x23')](_0x130b0e)['then'](function(_0x3221bd){return _0x3221bd;});}return null;};}function removeEntity(_0x2d48db,_0x2a0a5b){return function(_0x3bea7f){if(_0x3bea7f){return _0x3bea7f['destroy']()[_0x4287('0x24')](function(){_0x2d48db['status'](0xcc)[_0x4287('0x1a')]();});}};}function handleEntityNotFound(_0x30cf2f,_0xaab5a3){return function(_0x597ed8){if(!_0x597ed8){_0x30cf2f[_0x4287('0x19')](0x194);}return _0x597ed8;};}function handleError(_0x8f6ddb,_0x4af43a){_0x4af43a=_0x4af43a||0x1f4;return function(_0x1ed5b9){logger[_0x4287('0x25')](_0x1ed5b9['stack']);if(_0x1ed5b9['name']){delete _0x1ed5b9[_0x4287('0x26')];}_0x8f6ddb[_0x4287('0x1b')](_0x4af43a)[_0x4287('0x27')](_0x1ed5b9);};}exports['index']=function(_0x44b905,_0x45d43b){var _0x443e57={},_0x7336f8={},_0x48c4c7={'count':0x0,'rows':[]};var _0x5150ba=_[_0x4287('0x28')](db[_0x4287('0x29')][_0x4287('0x2a')],function(_0x25c09d){return{'name':_0x25c09d[_0x4287('0x2b')],'type':_0x25c09d[_0x4287('0x2c')][_0x4287('0x2d')]};});_0x7336f8['model']=_[_0x4287('0x2e')](_[_0x4287('0x28')](_0x5150ba,_0x4287('0x26')),[_0x4287('0x2f')]);_0x7336f8[_0x4287('0x30')]=_[_0x4287('0x31')](_0x44b905[_0x4287('0x30')]);_0x7336f8[_0x4287('0x32')]=_[_0x4287('0x33')](_0x7336f8['model'],_0x7336f8[_0x4287('0x30')]);_0x443e57[_0x4287('0x34')]=_[_0x4287('0x33')](_0x7336f8['model'],qs[_0x4287('0x35')](_0x44b905['query'][_0x4287('0x35')]));_0x443e57[_0x4287('0x34')]=_0x443e57[_0x4287('0x34')][_0x4287('0x36')]?_0x443e57['attributes']:_0x7336f8[_0x4287('0x37')];if(!_0x44b905[_0x4287('0x30')][_0x4287('0x38')](_0x4287('0x39'))){_0x443e57[_0x4287('0x1e')]=qs[_0x4287('0x1e')](_0x44b905[_0x4287('0x30')][_0x4287('0x1e')]);_0x443e57[_0x4287('0x1d')]=qs[_0x4287('0x1d')](_0x44b905[_0x4287('0x30')][_0x4287('0x1d')]);}_0x443e57[_0x4287('0x3a')]=qs[_0x4287('0x3b')](_0x44b905[_0x4287('0x30')][_0x4287('0x3b')]);_0x443e57[_0x4287('0x3c')]=qs[_0x4287('0x32')](_[_0x4287('0x3d')](_0x44b905[_0x4287('0x30')],_0x7336f8[_0x4287('0x32')]),_0x5150ba);if(_0x44b905[_0x4287('0x30')][_0x4287('0x3e')]){_0x443e57[_0x4287('0x3c')]=_[_0x4287('0x3f')](_0x443e57[_0x4287('0x3c')],{'$or':_[_0x4287('0x28')](_0x5150ba,function(_0x8ce691){if(_0x8ce691[_0x4287('0x2c')]!=='VIRTUAL'){var _0x3c46d4={};_0x3c46d4[_0x8ce691[_0x4287('0x26')]]={'$like':'%'+_0x44b905['query'][_0x4287('0x3e')]+'%'};return _0x3c46d4;}})});}_0x443e57=_[_0x4287('0x3f')]({},_0x443e57,_0x44b905[_0x4287('0x40')]);var _0x28da87={'where':_0x443e57['where']};return db['ScreenRecording'][_0x4287('0x1c')](_0x28da87)[_0x4287('0x24')](function(_0x54c25b){_0x48c4c7['count']=_0x54c25b;if(_0x44b905[_0x4287('0x30')][_0x4287('0x41')]){_0x443e57['include']=[{'all':!![]}];}return db[_0x4287('0x29')][_0x4287('0x42')](_0x443e57);})['then'](function(_0x15ae3b){_0x48c4c7[_0x4287('0x43')]=_0x15ae3b;return _0x48c4c7;})[_0x4287('0x24')](respondWithFilteredResult(_0x45d43b,_0x443e57))['catch'](handleError(_0x45d43b,null));};exports[_0x4287('0x44')]=function(_0x5d9a65,_0x51fbcb){var _0x48d5fa={'raw':![],'where':{'id':_0x5d9a65[_0x4287('0x45')]['id']}},_0x56fae0={};_0x56fae0['model']=_[_0x4287('0x31')](db['ScreenRecording'][_0x4287('0x2a')]);_0x56fae0[_0x4287('0x30')]=_[_0x4287('0x31')](_0x5d9a65['query']);_0x56fae0[_0x4287('0x32')]=_[_0x4287('0x33')](_0x56fae0[_0x4287('0x37')],_0x56fae0['query']);_0x48d5fa['attributes']=_[_0x4287('0x33')](_0x56fae0[_0x4287('0x37')],qs['fields'](_0x5d9a65[_0x4287('0x30')][_0x4287('0x35')]));_0x48d5fa[_0x4287('0x34')]=_0x48d5fa[_0x4287('0x34')][_0x4287('0x36')]?_0x48d5fa[_0x4287('0x34')]:_0x56fae0['model'];if(_0x5d9a65[_0x4287('0x30')][_0x4287('0x41')]){_0x48d5fa[_0x4287('0x46')]=[{'all':!![]}];}_0x48d5fa=_['merge']({},_0x48d5fa,_0x5d9a65[_0x4287('0x40')]);return db[_0x4287('0x29')][_0x4287('0x47')](_0x48d5fa)[_0x4287('0x24')](handleEntityNotFound(_0x51fbcb,null))[_0x4287('0x24')](respondWithResult(_0x51fbcb,null))['catch'](handleError(_0x51fbcb,null));};exports['create']=function(_0x380162,_0x118b5d){return db[_0x4287('0x29')][_0x4287('0x48')](_0x380162[_0x4287('0x49')],{})[_0x4287('0x24')](respondWithResult(_0x118b5d,0xc9))[_0x4287('0x4a')](handleError(_0x118b5d,null));};exports['update']=function(_0x15d5ce,_0x5606f5){if(_0x15d5ce[_0x4287('0x49')]['id']){delete _0x15d5ce[_0x4287('0x49')]['id'];}delete _0x15d5ce['body'][_0x4287('0x4b')];delete _0x15d5ce[_0x4287('0x49')][_0x4287('0x4c')];delete _0x15d5ce[_0x4287('0x49')][_0x4287('0x4d')];delete _0x15d5ce[_0x4287('0x49')][_0x4287('0x4e')];return db[_0x4287('0x29')][_0x4287('0x47')]({'where':{'id':_0x15d5ce[_0x4287('0x45')]['id']}})[_0x4287('0x24')](handleEntityNotFound(_0x5606f5,null))[_0x4287('0x24')](saveUpdates(_0x15d5ce[_0x4287('0x49')],null))[_0x4287('0x24')](respondWithResult(_0x5606f5,null))[_0x4287('0x4a')](handleError(_0x5606f5,null));};exports[_0x4287('0x4f')]=function(_0x52e99e,_0x1d04c5){return db['ScreenRecording'][_0x4287('0x4f')]()[_0x4287('0x24')](respondWithResult(_0x1d04c5,null))[_0x4287('0x4a')](handleError(_0x1d04c5,null));};exports[_0x4287('0x50')]=function(_0x2b1a91,_0x5a7249,_0x116025){var _0x39029d=require('../../components/encryptor');var _0x5dec93=![];var _0x357baa={};if(_0x2b1a91[_0x4287('0x30')][_0x4287('0x2c')]&&_0x2b1a91[_0x4287('0x30')][_0x4287('0x2c')]==='uniqueid'){_0x357baa[_0x4287('0x51')]=_0x2b1a91['params']['id'];}else{_0x357baa['id']=_0x2b1a91[_0x4287('0x45')]['id'];}return db[_0x4287('0x29')][_0x4287('0x47')]({'where':_0x357baa,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5a7249,null))[_0x4287('0x24')](function(_0x481cf4){if(_0x481cf4){var _0x55b86d=path[_0x4287('0x52')](config[_0x4287('0x53')],_0x4287('0x54'),_0x481cf4[_0x4287('0x4e')]);var _0x3759b9=util[_0x4287('0x2f')](_0x4287('0x55'),_0x55b86d);if(fs['existsSync'](_0x3759b9)){_0x5dec93=!![];return _0x39029d[_0x4287('0x56')](_0x3759b9,_0x55b86d,config[_0x4287('0x57')]['recording'])[_0x4287('0x24')](function(){return _0x481cf4;});}return _0x481cf4;}})[_0x4287('0x24')](function(_0x39b25a){if(_0x39b25a){var _0xabc668=path[_0x4287('0x52')](config[_0x4287('0x53')],_0x4287('0x54'),_0x39b25a[_0x4287('0x4e')]);if(!fs[_0x4287('0x58')](_0xabc668)){throw new db[(_0x4287('0x59'))][(_0x4287('0x5a'))](_0x4287('0x5b'));}if(_0x39b25a[_0x4287('0x5c')]){return _0x5a7249[_0x4287('0x50')](_0xabc668,_0x39b25a[_0x4287('0x5c')]+path[_0x4287('0x5d')](_0xabc668),function(){if(_0x5dec93){fs[_0x4287('0x5e')](_0xabc668);}});}else{return _0x5a7249[_0x4287('0x50')](_0xabc668,function(_0x3b54ec){if(_0x5dec93){fs[_0x4287('0x5e')](_0xabc668);}});}}})['catch'](function(_0x2ae17a){if(_0x2ae17a[_0x4287('0x5f')]===_0x4287('0x5b')){_0x5a7249[_0x4287('0x1b')](0x194)['send'](_0x4287('0x60'));}else{return handleError(_0x5a7249,null);}});};exports[_0x4287('0x61')]=function(_0x509023,_0x15316d){return db[_0x4287('0x29')][_0x4287('0x47')]({'where':{'id':_0x509023[_0x4287('0x45')]['id']}})[_0x4287('0x24')](function(_0x497866){if(!_0x497866)throw new ReferenceError('Entity\x20not\x20found');return _0x497866;})['then'](function(_0x470295){var _0x3a31ce=path['join'](config['root'],_0x4287('0x54'),_0x470295[_0x4287('0x4e')]);logger[_0x4287('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a31ce);if(!_[_0x4287('0x63')](_0x470295['value'])&&fs[_0x4287('0x58')](_0x3a31ce)){logger[_0x4287('0x62')](_0x4287('0x64')+_0x3a31ce+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4287('0x65')](_0x3a31ce);}_0x3a31ce=_0x3a31ce+_0x4287('0x66');if(!_[_0x4287('0x63')](_0x470295['value'])&&fs[_0x4287('0x58')](_0x3a31ce)){logger[_0x4287('0x62')](_0x4287('0x64')+_0x3a31ce+_0x4287('0x67'));fs[_0x4287('0x65')](_0x3a31ce);}return _0x470295;})['then'](function(_0x48ea6c){if(!_0x48ea6c)throw new InternalError();return _0x48ea6c[_0x4287('0x61')]();})[_0x4287('0x24')](function(){_0x15316d[_0x4287('0x1b')](0xcc)['end']();})[_0x4287('0x4a')](handleError(_0x15316d,null));}; \ No newline at end of file +var _0xc04a=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','ScreenRecording','fieldName','type','key','model','differenceBy','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','create','body','duration','closedAt','describe','download','../../components/encryptor','uniqueid','value','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found'];(function(_0x7828e3,_0x2083cd){var _0x191efd=function(_0x3d5eec){while(--_0x3d5eec){_0x7828e3['push'](_0x7828e3['shift']());}};_0x191efd(++_0x2083cd);}(_0xc04a,0xd7));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xac04('0x0'));var emlformat=require(_0xac04('0x1'));var rimraf=require(_0xac04('0x2'));var zipdir=require(_0xac04('0x3'));var jsonpatch=require(_0xac04('0x4'));var rp=require(_0xac04('0x5'));var moment=require('moment');var BPromise=require(_0xac04('0x6'));var Mustache=require(_0xac04('0x7'));var util=require(_0xac04('0x8'));var path=require('path');var sox=require(_0xac04('0x9'));var csv=require('to-csv');var ejs=require(_0xac04('0xa'));var fs=require('fs');var _=require(_0xac04('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac04('0xc'));var deskjs=require(_0xac04('0xd'));var toCsv=require(_0xac04('0xe'));var querystring=require(_0xac04('0xf'));var Papa=require(_0xac04('0x10'));var Redis=require(_0xac04('0x11'));var authService=require(_0xac04('0x12'));var qs=require(_0xac04('0x13'));var as=require(_0xac04('0x14'));var hardwareService=require(_0xac04('0x15'));var logger=require(_0xac04('0x16'))(_0xac04('0x17'));var utils=require(_0xac04('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac04('0x19'))['db'];function respondWithStatusCode(_0x303a81,_0x2c8768){_0x2c8768=_0x2c8768||0xcc;return function(_0x4806bc){if(_0x4806bc){return _0x303a81[_0xac04('0x1a')](_0x2c8768);}return _0x303a81['status'](_0x2c8768)['end']();};}function respondWithResult(_0x6924d,_0x24d37a){_0x24d37a=_0x24d37a||0xc8;return function(_0x5622d7){if(_0x5622d7){return _0x6924d[_0xac04('0x1b')](_0x24d37a)['json'](_0x5622d7);}};}function respondWithFilteredResult(_0x4f3f7b,_0x28e853){return function(_0x46d218){if(_0x46d218){var _0xdaa286=_0x46d218[_0xac04('0x1c')],_0x23a716=_0x28e853[_0xac04('0x1d')],_0x8077c0=_0x28e853[_0xac04('0x1d')]+_0x28e853[_0xac04('0x1e')],_0x465a5f;if(_0x8077c0>=_0xdaa286){_0x8077c0=_0xdaa286;_0x465a5f=0xc8;}else{_0x465a5f=0xce;}_0x4f3f7b['status'](_0x465a5f);return _0x4f3f7b['set'](_0xac04('0x1f'),_0x23a716+'-'+_0x8077c0+'/'+_0xdaa286)['json'](_0x46d218);}return null;};}function patchUpdates(_0x4298a0){return function(_0x1fba4f){try{jsonpatch[_0xac04('0x20')](_0x1fba4f,_0x4298a0,!![]);}catch(_0x4f5fc2){return BPromise['reject'](_0x4f5fc2);}return _0x1fba4f[_0xac04('0x21')]();};}function saveUpdates(_0x3005e1,_0x3c82b3){return function(_0x37e60e){if(_0x37e60e){return _0x37e60e[_0xac04('0x22')](_0x3005e1)[_0xac04('0x23')](function(_0x185a54){return _0x185a54;});}return null;};}function removeEntity(_0x627374,_0x3a5912){return function(_0x4af9cb){if(_0x4af9cb){return _0x4af9cb[_0xac04('0x24')]()[_0xac04('0x23')](function(){_0x627374[_0xac04('0x1b')](0xcc)[_0xac04('0x25')]();});}};}function handleEntityNotFound(_0x229119,_0x547a9){return function(_0x5aeac4){if(!_0x5aeac4){_0x229119[_0xac04('0x1a')](0x194);}return _0x5aeac4;};}function handleError(_0x548fbc,_0x4ef275){_0x4ef275=_0x4ef275||0x1f4;return function(_0x591535){logger[_0xac04('0x26')](_0x591535[_0xac04('0x27')]);if(_0x591535[_0xac04('0x28')]){delete _0x591535['name'];}_0x548fbc[_0xac04('0x1b')](_0x4ef275)[_0xac04('0x29')](_0x591535);};}exports[_0xac04('0x2a')]=function(_0x579f5c,_0x5cbc14){var _0x52ab66={},_0x14cb97={},_0x5eeb01={'count':0x0,'rows':[]};var _0x40728a=_['map'](db[_0xac04('0x2b')]['rawAttributes'],function(_0x5ad60d){return{'name':_0x5ad60d[_0xac04('0x2c')],'type':_0x5ad60d[_0xac04('0x2d')][_0xac04('0x2e')]};});_0x14cb97[_0xac04('0x2f')]=_[_0xac04('0x30')](_[_0xac04('0x31')](_0x40728a,_0xac04('0x28')),[_0xac04('0x32')]);_0x14cb97[_0xac04('0x33')]=_['keys'](_0x579f5c[_0xac04('0x33')]);_0x14cb97[_0xac04('0x34')]=_[_0xac04('0x35')](_0x14cb97[_0xac04('0x2f')],_0x14cb97['query']);_0x52ab66[_0xac04('0x36')]=_['intersection'](_0x14cb97[_0xac04('0x2f')],qs[_0xac04('0x37')](_0x579f5c[_0xac04('0x33')][_0xac04('0x37')]));_0x52ab66['attributes']=_0x52ab66[_0xac04('0x36')][_0xac04('0x38')]?_0x52ab66[_0xac04('0x36')]:_0x14cb97['model'];if(!_0x579f5c[_0xac04('0x33')][_0xac04('0x39')]('nolimit')){_0x52ab66[_0xac04('0x1e')]=qs[_0xac04('0x1e')](_0x579f5c[_0xac04('0x33')][_0xac04('0x1e')]);_0x52ab66[_0xac04('0x1d')]=qs[_0xac04('0x1d')](_0x579f5c[_0xac04('0x33')][_0xac04('0x1d')]);}_0x52ab66[_0xac04('0x3a')]=qs['sort'](_0x579f5c[_0xac04('0x33')][_0xac04('0x3b')]);_0x52ab66[_0xac04('0x3c')]=qs['filters'](_[_0xac04('0x3d')](_0x579f5c[_0xac04('0x33')],_0x14cb97['filters']),_0x40728a);if(_0x579f5c['query'][_0xac04('0x3e')]){_0x52ab66[_0xac04('0x3c')]=_[_0xac04('0x3f')](_0x52ab66[_0xac04('0x3c')],{'$or':_[_0xac04('0x31')](_0x40728a,function(_0x27ca30){if(_0x27ca30[_0xac04('0x2d')]!==_0xac04('0x40')){var _0x13e085={};_0x13e085[_0x27ca30[_0xac04('0x28')]]={'$like':'%'+_0x579f5c['query'][_0xac04('0x3e')]+'%'};return _0x13e085;}})});}_0x52ab66=_[_0xac04('0x3f')]({},_0x52ab66,_0x579f5c[_0xac04('0x41')]);var _0x1c4f53={'where':_0x52ab66[_0xac04('0x3c')]};return db[_0xac04('0x2b')][_0xac04('0x1c')](_0x1c4f53)[_0xac04('0x23')](function(_0x4b06f3){_0x5eeb01['count']=_0x4b06f3;if(_0x579f5c[_0xac04('0x33')][_0xac04('0x42')]){_0x52ab66['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x52ab66);})['then'](function(_0x4df8cd){_0x5eeb01[_0xac04('0x43')]=_0x4df8cd;return _0x5eeb01;})['then'](respondWithFilteredResult(_0x5cbc14,_0x52ab66))[_0xac04('0x44')](handleError(_0x5cbc14,null));};exports['show']=function(_0x3088fd,_0x36bd09){var _0x4e17f4={'raw':![],'where':{'id':_0x3088fd[_0xac04('0x45')]['id']}},_0x3ed9d6={};_0x3ed9d6['model']=_[_0xac04('0x46')](db[_0xac04('0x2b')]['rawAttributes']);_0x3ed9d6[_0xac04('0x33')]=_[_0xac04('0x46')](_0x3088fd[_0xac04('0x33')]);_0x3ed9d6['filters']=_[_0xac04('0x35')](_0x3ed9d6[_0xac04('0x2f')],_0x3ed9d6[_0xac04('0x33')]);_0x4e17f4[_0xac04('0x36')]=_['intersection'](_0x3ed9d6[_0xac04('0x2f')],qs[_0xac04('0x37')](_0x3088fd[_0xac04('0x33')][_0xac04('0x37')]));_0x4e17f4['attributes']=_0x4e17f4['attributes'][_0xac04('0x38')]?_0x4e17f4[_0xac04('0x36')]:_0x3ed9d6[_0xac04('0x2f')];if(_0x3088fd[_0xac04('0x33')][_0xac04('0x42')]){_0x4e17f4[_0xac04('0x47')]=[{'all':!![]}];}_0x4e17f4=_[_0xac04('0x3f')]({},_0x4e17f4,_0x3088fd[_0xac04('0x41')]);return db[_0xac04('0x2b')][_0xac04('0x48')](_0x4e17f4)['then'](handleEntityNotFound(_0x36bd09,null))['then'](respondWithResult(_0x36bd09,null))[_0xac04('0x44')](handleError(_0x36bd09,null));};exports[_0xac04('0x49')]=function(_0x138635,_0x4ae0f9){return db[_0xac04('0x2b')][_0xac04('0x49')](_0x138635[_0xac04('0x4a')],{})[_0xac04('0x23')](respondWithResult(_0x4ae0f9,0xc9))[_0xac04('0x44')](handleError(_0x4ae0f9,null));};exports[_0xac04('0x22')]=function(_0x18b235,_0x12d966){if(_0x18b235[_0xac04('0x4a')]['id']){delete _0x18b235[_0xac04('0x4a')]['id'];}delete _0x18b235[_0xac04('0x4a')][_0xac04('0x4b')];delete _0x18b235[_0xac04('0x4a')]['createdAt'];delete _0x18b235['body'][_0xac04('0x4c')];delete _0x18b235['body']['value'];return db[_0xac04('0x2b')][_0xac04('0x48')]({'where':{'id':_0x18b235[_0xac04('0x45')]['id']}})[_0xac04('0x23')](handleEntityNotFound(_0x12d966,null))[_0xac04('0x23')](saveUpdates(_0x18b235['body'],null))['then'](respondWithResult(_0x12d966,null))['catch'](handleError(_0x12d966,null));};exports[_0xac04('0x4d')]=function(_0x35c13b,_0x5d16fb){return db[_0xac04('0x2b')][_0xac04('0x4d')]()['then'](respondWithResult(_0x5d16fb,null))[_0xac04('0x44')](handleError(_0x5d16fb,null));};exports[_0xac04('0x4e')]=function(_0x7be663,_0xb29579,_0x31d87b){var _0x519bc8=require(_0xac04('0x4f'));var _0xcd6449=![];var _0x1846df={};if(_0x7be663['query'][_0xac04('0x2d')]&&_0x7be663['query'][_0xac04('0x2d')]==='uniqueid'){_0x1846df[_0xac04('0x50')]=_0x7be663[_0xac04('0x45')]['id'];}else{_0x1846df['id']=_0x7be663[_0xac04('0x45')]['id'];}return db[_0xac04('0x2b')]['find']({'where':_0x1846df,'attributes':['id',_0xac04('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0xb29579,null))['then'](function(_0x27a2ce){if(_0x27a2ce){var _0x464b8d=path['join'](config[_0xac04('0x52')],_0xac04('0x53'),_0x27a2ce['value']);var _0x23b549=util['format'](_0xac04('0x54'),_0x464b8d);if(fs['existsSync'](_0x23b549)){_0xcd6449=!![];return _0x519bc8[_0xac04('0x55')](_0x23b549,_0x464b8d,config[_0xac04('0x56')][_0xac04('0x57')])[_0xac04('0x23')](function(){return _0x27a2ce;});}return _0x27a2ce;}})[_0xac04('0x23')](function(_0x691ee8){if(_0x691ee8){var _0x2a7fd1=path['join'](config['root'],_0xac04('0x53'),_0x691ee8['value']);if(!fs[_0xac04('0x58')](_0x2a7fd1)){throw new db[(_0xac04('0x59'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x691ee8[_0xac04('0x5a')]){return _0xb29579[_0xac04('0x4e')](_0x2a7fd1,_0x691ee8['filename']+path[_0xac04('0x5b')](_0x2a7fd1),function(){if(_0xcd6449){fs['unlink'](_0x2a7fd1);}});}else{return _0xb29579[_0xac04('0x4e')](_0x2a7fd1,function(_0x2f36d2){if(_0xcd6449){fs[_0xac04('0x5c')](_0x2a7fd1);}});}}})[_0xac04('0x44')](function(_0x479272){if(_0x479272[_0xac04('0x5d')]===_0xac04('0x5e')){_0xb29579[_0xac04('0x1b')](0x194)[_0xac04('0x29')](_0xac04('0x5f'));}else{return handleError(_0xb29579,null);}});};exports[_0xac04('0x24')]=function(_0x46626e,_0x2936ee){return db['ScreenRecording'][_0xac04('0x48')]({'where':{'id':_0x46626e['params']['id']}})[_0xac04('0x23')](function(_0x452d2f){if(!_0x452d2f)throw new ReferenceError(_0xac04('0x60'));return _0x452d2f;})[_0xac04('0x23')](function(_0x1ebdcf){var _0x218728=path['join'](config[_0xac04('0x52')],_0xac04('0x53'),_0x1ebdcf[_0xac04('0x51')]);logger[_0xac04('0x61')](_0xac04('0x62'),_0x218728);if(!_[_0xac04('0x63')](_0x1ebdcf[_0xac04('0x51')])&&fs['existsSync'](_0x218728)){logger[_0xac04('0x61')](_0xac04('0x64')+_0x218728+_0xac04('0x65'));fs[_0xac04('0x66')](_0x218728);}_0x218728=_0x218728+_0xac04('0x67');if(!_[_0xac04('0x63')](_0x1ebdcf[_0xac04('0x51')])&&fs[_0xac04('0x58')](_0x218728)){logger[_0xac04('0x61')](_0xac04('0x64')+_0x218728+_0xac04('0x65'));fs[_0xac04('0x66')](_0x218728);}return _0x1ebdcf;})['then'](function(_0x58e3fc){if(!_0x58e3fc)throw new InternalError();return _0x58e3fc[_0xac04('0x24')]();})[_0xac04('0x23')](function(){_0x2936ee[_0xac04('0x1b')](0xcc)[_0xac04('0x25')]();})['catch'](handleError(_0x2936ee,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 025798b..0dfcf68 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 _0x9e75=['bluebird','request-promise','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment'];(function(_0x271474,_0x248441){var _0x72f117=function(_0x4ad1b9){while(--_0x4ad1b9){_0x271474['push'](_0x271474['shift']());}};_0x72f117(++_0x248441);}(_0x9e75,0x19c));var _0x59e7=function(_0x5d208c,_0x593581){_0x5d208c=_0x5d208c-0x0;var _0x4cb6a2=_0x9e75[_0x5d208c];return _0x4cb6a2;};'use strict';var _=require(_0x59e7('0x0'));var util=require(_0x59e7('0x1'));var logger=require(_0x59e7('0x2'))('api');var moment=require(_0x59e7('0x3'));var BPromise=require(_0x59e7('0x4'));var rp=require(_0x59e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59e7('0x6'));var attributes=require(_0x59e7('0x7'));module[_0x59e7('0x8')]=function(_0x352359,_0x20ef64){return _0x352359[_0x59e7('0x9')](_0x59e7('0xa'),attributes,{'tableName':_0x59e7('0xb'),'paranoid':![],'indexes':[{'name':_0x59e7('0xc'),'fields':[_0x59e7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd62=['lodash','../../config/logger','api','bluebird','../../config/environment','screen_recordings','interactionid'];(function(_0xd79f26,_0x42fe61){var _0x519262=function(_0x1e36bd){while(--_0x1e36bd){_0xd79f26['push'](_0xd79f26['shift']());}};_0x519262(++_0x42fe61);}(_0xdd62,0xb6));var _0x2dd6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd62[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x2dd6('0x0'));var util=require('util');var logger=require(_0x2dd6('0x1'))(_0x2dd6('0x2'));var moment=require('moment');var BPromise=require(_0x2dd6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2dd6('0x4'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x226aaa,_0xf04de3){return _0x226aaa['define']('ScreenRecording',attributes,{'tableName':_0x2dd6('0x5'),'paranoid':![],'indexes':[{'name':_0x2dd6('0x6'),'fields':[_0x2dd6('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index aef12b8..75f9880 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(_0x321bca,_0x378e78){var _0x20fdee=function(_0x2bda0c){while(--_0x2bda0c){_0x321bca['push'](_0x321bca['shift']());}};_0x20fdee(++_0x378e78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x3175f4,_0x3c9198){var _0x210bda=function(_0x2e9051){while(--_0x2e9051){_0x3175f4['push'](_0x3175f4['shift']());}};_0x210bda(++_0x3c9198);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 5634f70..4543cfb 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 _0x40a8=['get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','join','logologin','addLogoLogin','preferred','addPreferred','root','favicon','addFavicon','update','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./setting.controller'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x40a8,0x193));var _0x840a=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x40a8[_0x568496];return _0x26c5c1;};'use strict';var multer=require(_0x840a('0x0'));var util=require('util');var path=require(_0x840a('0x1'));var timeout=require(_0x840a('0x2'));var express=require(_0x840a('0x3'));var router=express['Router']();var auth=require(_0x840a('0x4'));var interaction=require(_0x840a('0x5'));var config=require('../../config/environment');var controller=require(_0x840a('0x6'));router[_0x840a('0x7')]('/',auth[_0x840a('0x8')](),controller[_0x840a('0x9')]);router[_0x840a('0x7')](_0x840a('0xa'),controller[_0x840a('0xb')]);router[_0x840a('0x7')](_0x840a('0xc'),controller['show']);router[_0x840a('0x7')](_0x840a('0xd'),controller['getLogo']);router['get'](_0x840a('0xe'),controller[_0x840a('0xf')]);router[_0x840a('0x7')](_0x840a('0x10'),controller[_0x840a('0x11')]);router['get'](_0x840a('0x12'),controller[_0x840a('0x13')]);router['get'](_0x840a('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0x840a('0x15')]({'destination':function(_0x23a071,_0x3a22a0,_0x4203b6){_0x4203b6(null,path['join'](config['root'],_0x840a('0x16')));},'filename':function(_0x4f137e,_0x4b605b,_0xc9136c){_0xc9136c(null,util[_0x840a('0x17')](_0x840a('0x18'),_0x840a('0x19'),path[_0x840a('0x1a')](_0x4b605b[_0x840a('0x1b')])));}})});router[_0x840a('0x1c')](_0x840a('0xd'),upload[_0x840a('0x1d')](_0x840a('0x1e')),controller[_0x840a('0x1f')]);var upload=multer({'storage':multer[_0x840a('0x15')]({'destination':function(_0x96acc7,_0x4fe074,_0x569acf){_0x569acf(null,path[_0x840a('0x20')](config['root'],_0x840a('0x16')));},'filename':function(_0xe35784,_0xe501ab,_0x45ea64){_0x45ea64(null,util[_0x840a('0x17')](_0x840a('0x18'),_0x840a('0x21'),path[_0x840a('0x1a')](_0xe501ab[_0x840a('0x1b')])));}})});router['post']('/:id/logo_login',upload['single'](_0x840a('0x1e')),controller[_0x840a('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbb0fb0,_0x18c8d1,_0x23141d){_0x23141d(null,path[_0x840a('0x20')](config['root'],'server/files/images/logos/'));},'filename':function(_0x43aea6,_0x14e0b2,_0x247d6f){_0x247d6f(null,util['format'](_0x840a('0x18'),_0x840a('0x23'),path[_0x840a('0x1a')](_0x14e0b2[_0x840a('0x1b')])));}})});router[_0x840a('0x1c')](_0x840a('0x12'),upload[_0x840a('0x1d')](_0x840a('0x1e')),controller[_0x840a('0x24')]);var upload=multer({'storage':multer[_0x840a('0x15')]({'destination':function(_0x266924,_0x3d204d,_0x3b412d){_0x3b412d(null,path['join'](config[_0x840a('0x25')],_0x840a('0x16')));},'filename':function(_0x1f2484,_0x2c8693,_0x5be3f9){_0x5be3f9(null,util[_0x840a('0x17')](_0x840a('0x18'),_0x840a('0x26'),path['extname'](_0x2c8693['originalname'])));}})});router[_0x840a('0x1c')](_0x840a('0x14'),upload[_0x840a('0x1d')]('file'),controller[_0x840a('0x27')]);router['put'](_0x840a('0xc'),auth[_0x840a('0x8')](),controller[_0x840a('0x28')]);module['exports']=router; \ No newline at end of file +var _0xf8f1=['server/files/images/logos/','format','%s%s','extname','originalname','file','addLogo','diskStorage','logologin','post','addLogoLogin','/:id/preferred','single','update','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/favicon','getFavicon','join','root'];(function(_0x185a67,_0x244aa7){var _0x95a3f4=function(_0x4f8e83){while(--_0x4f8e83){_0x185a67['push'](_0x185a67['shift']());}};_0x95a3f4(++_0x244aa7);}(_0xf8f1,0x16d));var _0x1f8f=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xf8f1[_0x5ca5bc];return _0x26ca86;};'use strict';var multer=require('multer');var util=require(_0x1f8f('0x0'));var path=require('path');var timeout=require(_0x1f8f('0x1'));var express=require('express');var router=express[_0x1f8f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x1f8f('0x3'));var config=require(_0x1f8f('0x4'));var controller=require('./setting.controller');router[_0x1f8f('0x5')]('/',auth['isAuthenticated'](),controller[_0x1f8f('0x6')]);router[_0x1f8f('0x5')](_0x1f8f('0x7'),controller[_0x1f8f('0x8')]);router[_0x1f8f('0x5')](_0x1f8f('0x9'),controller[_0x1f8f('0xa')]);router[_0x1f8f('0x5')](_0x1f8f('0xb'),controller[_0x1f8f('0xc')]);router[_0x1f8f('0x5')](_0x1f8f('0xd'),controller[_0x1f8f('0xe')]);router[_0x1f8f('0x5')]('/:id/gdpr',controller[_0x1f8f('0xf')]);router['get']('/:id/preferred',controller['getPreferred']);router[_0x1f8f('0x5')](_0x1f8f('0x10'),controller[_0x1f8f('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xeff99e,_0xa918a5,_0x1ff701){_0x1ff701(null,path[_0x1f8f('0x12')](config[_0x1f8f('0x13')],_0x1f8f('0x14')));},'filename':function(_0x145824,_0x10bd79,_0x461f05){_0x461f05(null,util[_0x1f8f('0x15')](_0x1f8f('0x16'),'logo',path[_0x1f8f('0x17')](_0x10bd79[_0x1f8f('0x18')])));}})});router['post']('/:id/logo',upload['single'](_0x1f8f('0x19')),controller[_0x1f8f('0x1a')]);var upload=multer({'storage':multer[_0x1f8f('0x1b')]({'destination':function(_0xf886a9,_0x26ebc0,_0x5235a6){_0x5235a6(null,path[_0x1f8f('0x12')](config[_0x1f8f('0x13')],_0x1f8f('0x14')));},'filename':function(_0x388b49,_0x1c4e5f,_0x3d52e7){_0x3d52e7(null,util[_0x1f8f('0x15')](_0x1f8f('0x16'),_0x1f8f('0x1c'),path[_0x1f8f('0x17')](_0x1c4e5f[_0x1f8f('0x18')])));}})});router[_0x1f8f('0x1d')](_0x1f8f('0xd'),upload['single'](_0x1f8f('0x19')),controller[_0x1f8f('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x552e98,_0x3baa5a,_0x2ebf7a){_0x2ebf7a(null,path[_0x1f8f('0x12')](config[_0x1f8f('0x13')],_0x1f8f('0x14')));},'filename':function(_0x14ff87,_0x59dfff,_0x35af25){_0x35af25(null,util[_0x1f8f('0x15')]('%s%s','preferred',path['extname'](_0x59dfff[_0x1f8f('0x18')])));}})});router['post'](_0x1f8f('0x1f'),upload[_0x1f8f('0x20')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x1f8f('0x1b')]({'destination':function(_0x5d06db,_0x201726,_0x1f20b1){_0x1f20b1(null,path['join'](config['root'],_0x1f8f('0x14')));},'filename':function(_0x5ebf10,_0x98de32,_0x2f22bd){_0x2f22bd(null,util['format']('%s%s','favicon',path['extname'](_0x98de32[_0x1f8f('0x18')])));}})});router['post'](_0x1f8f('0x10'),upload[_0x1f8f('0x20')](_0x1f8f('0x19')),controller['addFavicon']);router['put'](_0x1f8f('0x9'),auth['isAuthenticated'](),controller[_0x1f8f('0x21')]);module[_0x1f8f('0x22')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 561b946..be3f994 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 _0xdda2=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted'];(function(_0x302f85,_0x5bcca3){var _0x5ef7cb=function(_0x1f3afb){while(--_0x1f3afb){_0x302f85['push'](_0x302f85['shift']());}};_0x5ef7cb(++_0x5bcca3);}(_0xdda2,0x7c));var _0x2dda=function(_0x4d3538,_0xa4a970){_0x4d3538=_0x4d3538-0x0;var _0x358c02=_0xdda2[_0x4d3538];return _0x358c02;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x2dda('0x0')](0xb),'unique':_0x2dda('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2dda('0x0')](0xb),'unique':_0x2dda('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2dda('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x2dda('0x3')},'logo':{'type':Sequelize[_0x2dda('0x4')]},'defaultLogo':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2dda('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2dda('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2dda('0x4')]},'turnaddr':{'type':Sequelize[_0x2dda('0x4')]},'turnusername':{'type':Sequelize[_0x2dda('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2dda('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2dda('0x4')],'defaultValue':_0x2dda('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x2dda('0x7')},'chatTimeout':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2dda('0x4')]},'defaultPreferred':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2dda('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2dda('0x0')]},'transcribeRegion':{'type':Sequelize[_0x2dda('0x4')]},'sentiment':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x2dda('0x0')]},'sentimentRegion':{'type':Sequelize[_0x2dda('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x2dda('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2dda('0x0')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x2dda('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x387c=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','STRING'];(function(_0x17a68a,_0x1e7022){var _0x380e66=function(_0x2f8685){while(--_0x2f8685){_0x17a68a['push'](_0x17a68a['shift']());}};_0x380e66(++_0x1e7022);}(_0x387c,0x159));var _0xc387=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x387c[_0x401676];return _0x4f13fe;};'use strict';var Sequelize=require(_0xc387('0x0'));module[_0xc387('0x1')]={'min_internal':{'type':Sequelize[_0xc387('0x2')](0xb),'unique':_0xc387('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc387('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc387('0x4')],'defaultValue':_0xc387('0x5')},'logo':{'type':Sequelize[_0xc387('0x4')]},'defaultLogo':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc387('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xc387('0x4')]},'turnaddr':{'type':Sequelize[_0xc387('0x4')]},'turnusername':{'type':Sequelize[_0xc387('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xc387('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc387('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc387('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xc387('0x7')},'enableEmailPreview':{'type':Sequelize[_0xc387('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc387('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xc387('0x8')},'chatTimeout':{'type':Sequelize[_0xc387('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc387('0x4')]},'defaultPreferred':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc387('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc387('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xc387('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc387('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc387('0x2')]},'transcribeRegion':{'type':Sequelize[_0xc387('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc387('0x2')]},'sentimentRegion':{'type':Sequelize[_0xc387('0x4')]},'language':{'type':Sequelize[_0xc387('0x4')]},'bucket':{'type':Sequelize[_0xc387('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xc387('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xc387('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xc387('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xc387('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xc387('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xc387('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 927e6bc..1d6301a 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 _0x74c8=['nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','find','body','params','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','logo','favicon','defaultLoginLogo','defaultPreferred','join','toLower','root','default_logo.svg','custom','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','preferred','defaultLogo','defaultFavicon','default','default_loginLogo.svg','gdpr','securePassword','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74c8,0xb5));var _0x874c=function(_0x42118e,_0x4dfb3e){_0x42118e=_0x42118e-0x0;var _0x524646=_0x74c8[_0x42118e];return _0x524646;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x874c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x874c('0x1'));var jsonpatch=require(_0x874c('0x2'));var rp=require('request-promise');var moment=require(_0x874c('0x3'));var BPromise=require(_0x874c('0x4'));var Mustache=require(_0x874c('0x5'));var util=require(_0x874c('0x6'));var path=require('path');var sox=require(_0x874c('0x7'));var csv=require(_0x874c('0x8'));var ejs=require(_0x874c('0x9'));var fs=require('fs');var _=require(_0x874c('0xa'));var squel=require('squel');var crypto=require(_0x874c('0xb'));var jsforce=require(_0x874c('0xc'));var deskjs=require(_0x874c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x874c('0xe'));var Papa=require(_0x874c('0xf'));var Redis=require(_0x874c('0x10'));var authService=require(_0x874c('0x11'));var qs=require(_0x874c('0x12'));var as=require(_0x874c('0x13'));var hardwareService=require(_0x874c('0x14'));var logger=require(_0x874c('0x15'))(_0x874c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x874c('0x17'))['db'];var jayson=require(_0x874c('0x18'));var client=jayson[_0x874c('0x19')][_0x874c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5ae3d8,_0x22b17a,_0x3c02a3,_0x2e1f66){return new BPromise(function(_0x10de36,_0x2e2d24){var _0x4b1766=_0x2e1f66||client;return _0x4b1766['request'](_0x5ae3d8,_0x3c02a3)[_0x874c('0x1b')](function(_0x6d76eb){logger['info'](_0x874c('0x1c'),_0x22b17a,_0x874c('0x1d'));logger[_0x874c('0x1e')](_0x874c('0x1f'),_0x22b17a,_0x874c('0x1d'),JSON['stringify'](_0x6d76eb));if(_0x6d76eb[_0x874c('0x20')]){if(_0x6d76eb[_0x874c('0x20')][_0x874c('0x21')]===0x1f4){logger[_0x874c('0x20')](_0x874c('0x1c'),_0x22b17a,_0x6d76eb[_0x874c('0x20')][_0x874c('0x22')]);return _0x2e2d24(_0x6d76eb[_0x874c('0x20')][_0x874c('0x22')]);}logger[_0x874c('0x20')](_0x874c('0x1c'),_0x22b17a,_0x6d76eb['error'][_0x874c('0x22')]);return _0x10de36(_0x6d76eb['error'][_0x874c('0x22')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x22b17a,_0x874c('0x1d'));_0x10de36(_0x6d76eb[_0x874c('0x23')][_0x874c('0x22')]);}})['catch'](function(_0x552e0d){logger['error']('Setting,\x20%s,\x20%s',_0x22b17a,_0x552e0d);_0x2e2d24(_0x552e0d);});});}function respondWithStatusCode(_0x3c38f0,_0x54c7ce){_0x54c7ce=_0x54c7ce||0xcc;return function(_0x98fd53){if(_0x98fd53){return _0x3c38f0[_0x874c('0x24')](_0x54c7ce);}return _0x3c38f0[_0x874c('0x25')](_0x54c7ce)['end']();};}function respondWithResult(_0xa29722,_0x18e6b0){_0x18e6b0=_0x18e6b0||0xc8;return function(_0x2ba1f1){if(_0x2ba1f1){return _0xa29722[_0x874c('0x25')](_0x18e6b0)[_0x874c('0x26')](_0x2ba1f1);}};}function respondWithFilteredResult(_0x865fed,_0x475880){return function(_0x5bbf72){if(_0x5bbf72){var _0x380a7e=_0x5bbf72[_0x874c('0x27')],_0x94e4f9=_0x475880[_0x874c('0x28')],_0x489504=_0x475880[_0x874c('0x28')]+_0x475880[_0x874c('0x29')],_0x187db7;if(_0x489504>=_0x380a7e){_0x489504=_0x380a7e;_0x187db7=0xc8;}else{_0x187db7=0xce;}_0x865fed[_0x874c('0x25')](_0x187db7);return _0x865fed[_0x874c('0x2a')](_0x874c('0x2b'),_0x94e4f9+'-'+_0x489504+'/'+_0x380a7e)[_0x874c('0x26')](_0x5bbf72);}return null;};}function patchUpdates(_0x3e5285){return function(_0xaf69ae){try{jsonpatch['apply'](_0xaf69ae,_0x3e5285,!![]);}catch(_0x5d9f30){return BPromise[_0x874c('0x2c')](_0x5d9f30);}return _0xaf69ae[_0x874c('0x2d')]();};}function saveUpdates(_0x18ead0,_0x36331d){return function(_0x118197){if(_0x118197){return _0x118197[_0x874c('0x2e')](_0x18ead0)[_0x874c('0x1b')](function(_0x41849f){return _0x41849f;});}return null;};}function removeEntity(_0x5bcabf,_0x1dc32e){return function(_0xe0d960){if(_0xe0d960){return _0xe0d960[_0x874c('0x2f')]()[_0x874c('0x1b')](function(){_0x5bcabf[_0x874c('0x25')](0xcc)[_0x874c('0x30')]();});}};}function handleEntityNotFound(_0x4f2baf,_0x139d84){return function(_0x3c60e8){if(!_0x3c60e8){_0x4f2baf[_0x874c('0x24')](0x194);}return _0x3c60e8;};}function handleError(_0x6d1d6,_0x3dd284){_0x3dd284=_0x3dd284||0x1f4;return function(_0x36e252){logger[_0x874c('0x20')](_0x36e252[_0x874c('0x31')]);if(_0x36e252[_0x874c('0x32')]){delete _0x36e252['name'];}_0x6d1d6['status'](_0x3dd284)['send'](_0x36e252);};}exports[_0x874c('0x33')]=function(_0x49f83b,_0x39f14c){var _0x2ded95={},_0x3691a1={},_0x1aaf1b={'count':0x0,'rows':[]};var _0x585078=_[_0x874c('0x34')](db[_0x874c('0x35')][_0x874c('0x36')],function(_0x1756d2){return{'name':_0x1756d2[_0x874c('0x37')],'type':_0x1756d2['type'][_0x874c('0x38')]};});_0x3691a1[_0x874c('0x39')]=_['map'](_0x585078,_0x874c('0x32'));_0x3691a1[_0x874c('0x3a')]=_[_0x874c('0x3b')](_0x49f83b['query']);_0x3691a1['filters']=_[_0x874c('0x3c')](_0x3691a1[_0x874c('0x39')],_0x3691a1[_0x874c('0x3a')]);_0x2ded95['attributes']=_[_0x874c('0x3c')](_0x3691a1['model'],qs[_0x874c('0x3d')](_0x49f83b[_0x874c('0x3a')][_0x874c('0x3d')]));_0x2ded95[_0x874c('0x3e')]=_0x2ded95['attributes'][_0x874c('0x3f')]?_0x2ded95[_0x874c('0x3e')]:_0x3691a1['model'];if(!_0x49f83b['query'][_0x874c('0x40')](_0x874c('0x41'))){_0x2ded95[_0x874c('0x29')]=qs[_0x874c('0x29')](_0x49f83b['query']['limit']);_0x2ded95['offset']=qs[_0x874c('0x28')](_0x49f83b[_0x874c('0x3a')][_0x874c('0x28')]);}_0x2ded95[_0x874c('0x42')]=qs['sort'](_0x49f83b['query'][_0x874c('0x43')]);_0x2ded95[_0x874c('0x44')]=qs[_0x874c('0x45')](_['pick'](_0x49f83b[_0x874c('0x3a')],_0x3691a1[_0x874c('0x45')]),_0x585078);if(_0x49f83b[_0x874c('0x3a')]['filter']){_0x2ded95['where']=_[_0x874c('0x46')](_0x2ded95[_0x874c('0x44')],{'$or':_[_0x874c('0x34')](_0x585078,function(_0x3fd673){if(_0x3fd673[_0x874c('0x47')]!==_0x874c('0x48')){var _0x93b404={};_0x93b404[_0x3fd673[_0x874c('0x32')]]={'$like':'%'+_0x49f83b[_0x874c('0x3a')][_0x874c('0x49')]+'%'};return _0x93b404;}})});}_0x2ded95=_[_0x874c('0x46')]({},_0x2ded95,_0x49f83b['options']);var _0x3b82d3={'where':_0x2ded95[_0x874c('0x44')]};return db[_0x874c('0x35')][_0x874c('0x27')](_0x3b82d3)[_0x874c('0x1b')](function(_0x1eb7c6){_0x1aaf1b[_0x874c('0x27')]=_0x1eb7c6;if(_0x49f83b['query'][_0x874c('0x4a')]){_0x2ded95[_0x874c('0x4b')]=[{'all':!![]}];}return db[_0x874c('0x35')][_0x874c('0x4c')](_0x2ded95);})[_0x874c('0x1b')](function(_0x1b3356){_0x1aaf1b[_0x874c('0x4d')]=_0x1b3356;return _0x1aaf1b;})[_0x874c('0x1b')](respondWithFilteredResult(_0x39f14c,_0x2ded95))[_0x874c('0x4e')](handleError(_0x39f14c,null));};exports['show']=function(_0x27ddc8,_0x44624a){var _0xca3aba={'raw':![],'where':{'id':_0x27ddc8['params']['id']}},_0x25e9ab={};_0x25e9ab[_0x874c('0x39')]=_[_0x874c('0x3b')](db[_0x874c('0x35')][_0x874c('0x36')]);_0x25e9ab[_0x874c('0x3a')]=_['keys'](_0x27ddc8[_0x874c('0x3a')]);_0x25e9ab[_0x874c('0x45')]=_['intersection'](_0x25e9ab['model'],_0x25e9ab[_0x874c('0x3a')]);_0xca3aba[_0x874c('0x3e')]=_[_0x874c('0x3c')](_0x25e9ab[_0x874c('0x39')],qs[_0x874c('0x3d')](_0x27ddc8[_0x874c('0x3a')][_0x874c('0x3d')]));_0xca3aba['attributes']=_0xca3aba[_0x874c('0x3e')][_0x874c('0x3f')]?_0xca3aba[_0x874c('0x3e')]:_0x25e9ab['model'];if(_0x27ddc8[_0x874c('0x3a')][_0x874c('0x4a')]){_0xca3aba[_0x874c('0x4b')]=[{'all':!![]}];}_0xca3aba=_[_0x874c('0x46')]({},_0xca3aba,_0x27ddc8[_0x874c('0x4f')]);return db[_0x874c('0x35')][_0x874c('0x50')](_0xca3aba)[_0x874c('0x1b')](handleEntityNotFound(_0x44624a,null))[_0x874c('0x1b')](respondWithResult(_0x44624a,null))[_0x874c('0x4e')](handleError(_0x44624a,null));};exports['update']=function(_0x32f413,_0x28e4de){if(_0x32f413[_0x874c('0x51')]['id']){delete _0x32f413[_0x874c('0x51')]['id'];}return db['Setting'][_0x874c('0x50')]({'where':{'id':_0x32f413[_0x874c('0x52')]['id']}})[_0x874c('0x1b')](handleEntityNotFound(_0x28e4de,null))['then'](saveUpdates(_0x32f413['body'],null))[_0x874c('0x1b')](respondWithResult(_0x28e4de,null))[_0x874c('0x4e')](handleError(_0x28e4de,null));};exports[_0x874c('0x53')]=function(_0x1b70da,_0x2f727a,_0x248a1b){if(_0x1b70da[_0x874c('0x54')]&&_0x1b70da[_0x874c('0x54')]['filename']){_0x1b70da['body']['logo']=_0x1b70da['file'][_0x874c('0x55')];}return db[_0x874c('0x35')][_0x874c('0x50')]({'where':{'id':_0x1b70da[_0x874c('0x52')]['id']}})[_0x874c('0x1b')](handleEntityNotFound(_0x2f727a,null))[_0x874c('0x1b')](saveUpdates(_0x1b70da[_0x874c('0x51')],null))[_0x874c('0x1b')](respondWithResult(_0x2f727a,null))[_0x874c('0x4e')](handleError(_0x2f727a,null));};exports[_0x874c('0x56')]=function(_0x3b01a2,_0x27ccf9,_0x3f6be5){if(_0x3b01a2[_0x874c('0x54')]&&_0x3b01a2[_0x874c('0x54')]['filename']){_0x3b01a2[_0x874c('0x51')][_0x874c('0x57')]=_0x3b01a2[_0x874c('0x54')]['filename'];}return db[_0x874c('0x35')][_0x874c('0x50')]({'where':{'id':_0x3b01a2[_0x874c('0x52')]['id']}})[_0x874c('0x1b')](handleEntityNotFound(_0x27ccf9,null))[_0x874c('0x1b')](saveUpdates(_0x3b01a2[_0x874c('0x51')],null))[_0x874c('0x1b')](respondWithResult(_0x27ccf9,null))['catch'](handleError(_0x27ccf9,null));};var utilLicense=require(_0x874c('0x58'));exports['getLogo']=function(_0x15cb49,_0x58f8ec,_0x303520){var _0x30d37a=_0x874c('0x59');var _0xf65592={'custom':![]};return utilLicense[_0x874c('0x5a')]()[_0x874c('0x1b')](function(_0x5b554e){if(_0x5b554e){_0xf65592=_0x5b554e;}return db['Setting'][_0x874c('0x50')]({'where':{'id':_0x15cb49['params']['id']},'attributes':[_0x874c('0x5b'),'loginLogo','preferred',_0x874c('0x5c'),'defaultLogo',_0x874c('0x5d'),_0x874c('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x874c('0x1b')](handleEntityNotFound(_0x58f8ec,null))[_0x874c('0x1b')](function(_0x3e98b5){if(_0x3e98b5){var _0x33e921=_0x3e98b5[_0x874c('0x5b')]&&fs['existsSync'](path[_0x874c('0x5f')](config['root'],_0x30d37a,_[_0x874c('0x60')](_0x3e98b5[_0x874c('0x5b')])))?path[_0x874c('0x5f')](config[_0x874c('0x61')],_0x30d37a,_[_0x874c('0x60')](_0x3e98b5[_0x874c('0x5b')])):path[_0x874c('0x5f')](config[_0x874c('0x61')],_0x30d37a,_[_0x874c('0x60')](_0x874c('0x62')));var _0x12c85f='default'+_['upperFirst'](_0x874c('0x5b'));if(_0x3e98b5[_0x12c85f]||!_0xf65592[_0x874c('0x63')]){_0x33e921=path['join'](config[_0x874c('0x61')],_0x30d37a,_[_0x874c('0x60')]('default_logo.svg'));}if(!fs[_0x874c('0x64')](_0x33e921)){throw new db[(_0x874c('0x65'))][(_0x874c('0x66'))](_[_0x874c('0x67')](_0x874c('0x5b'))+_0x874c('0x68'));}return _0x58f8ec[_0x874c('0x69')](_0x33e921);}})[_0x874c('0x4e')](handleError(_0x58f8ec,null));};var utilLicense=require(_0x874c('0x58'));exports[_0x874c('0x6a')]=function(_0x5198c3,_0x584d72,_0x2fce9a){var _0x2c6439=_0x874c('0x59');var _0x129752={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4fb03a){if(_0x4fb03a){_0x129752=_0x4fb03a;}return db[_0x874c('0x35')][_0x874c('0x50')]({'where':{'id':_0x5198c3[_0x874c('0x52')]['id']},'attributes':[_0x874c('0x5b'),_0x874c('0x57'),_0x874c('0x6b'),'favicon',_0x874c('0x6c'),_0x874c('0x5d'),'defaultPreferred',_0x874c('0x6d')],'raw':!![]});})[_0x874c('0x1b')](handleEntityNotFound(_0x584d72,null))[_0x874c('0x1b')](function(_0x623fb0){if(_0x623fb0){var _0x30c5a9=_0x623fb0[_0x874c('0x57')]&&fs['existsSync'](path[_0x874c('0x5f')](config['root'],_0x2c6439,_['toLower'](_0x623fb0[_0x874c('0x57')])))?path[_0x874c('0x5f')](config[_0x874c('0x61')],_0x2c6439,_[_0x874c('0x60')](_0x623fb0[_0x874c('0x57')])):path[_0x874c('0x5f')](config[_0x874c('0x61')],_0x2c6439,_[_0x874c('0x60')]('default_loginLogo.svg'));var _0x513dcf=_0x874c('0x6e')+_['upperFirst'](_0x874c('0x57'));if(_0x623fb0[_0x513dcf]||!_0x129752['custom']){_0x30c5a9=path['join'](config[_0x874c('0x61')],_0x2c6439,_[_0x874c('0x60')](_0x874c('0x6f')));}if(!fs[_0x874c('0x64')](_0x30c5a9)){throw new db[(_0x874c('0x65'))][(_0x874c('0x66'))](_['upperFirst']('loginLogo')+_0x874c('0x68'));}return _0x584d72[_0x874c('0x69')](_0x30c5a9);}})[_0x874c('0x4e')](handleError(_0x584d72,null));};exports[_0x874c('0x70')]=function(_0x1e873c,_0x165e11){return db[_0x874c('0x35')][_0x874c('0x50')]({'where':{'id':_0x1e873c[_0x874c('0x52')]['id']},'attributes':[_0x874c('0x71')]})['then'](respondWithResult(_0x165e11,null))[_0x874c('0x4e')](handleError(_0x165e11,null));};exports['addPreferred']=function(_0x2f1540,_0xeafbea,_0x316315){if(_0x2f1540[_0x874c('0x54')]&&_0x2f1540['file'][_0x874c('0x55')]){_0x2f1540['body'][_0x874c('0x6b')]=_0x2f1540[_0x874c('0x54')][_0x874c('0x55')];}return db['Setting'][_0x874c('0x50')]({'where':{'id':_0x2f1540[_0x874c('0x52')]['id']}})[_0x874c('0x1b')](handleEntityNotFound(_0xeafbea,null))['then'](saveUpdates(_0x2f1540[_0x874c('0x51')],null))[_0x874c('0x1b')](respondWithResult(_0xeafbea,null))[_0x874c('0x4e')](handleError(_0xeafbea,null));};var utilLicense=require('../../config/license/util');exports[_0x874c('0x72')]=function(_0x5a80e3,_0x256c2d,_0x44200e){var _0x3a4a0b='server/files/images/logos';var _0x35c3d4={'custom':![]};return utilLicense['getLicense']()[_0x874c('0x1b')](function(_0xcf7d2){if(_0xcf7d2){_0x35c3d4=_0xcf7d2;}return db['Setting']['find']({'where':{'id':_0x5a80e3[_0x874c('0x52')]['id']},'attributes':[_0x874c('0x5b'),_0x874c('0x57'),'preferred',_0x874c('0x5c'),_0x874c('0x6c'),'defaultLoginLogo',_0x874c('0x5e'),_0x874c('0x6d')],'raw':!![]});})[_0x874c('0x1b')](handleEntityNotFound(_0x256c2d,null))[_0x874c('0x1b')](function(_0x295fd9){if(_0x295fd9){var _0x311464=_0x295fd9[_0x874c('0x6b')]&&fs[_0x874c('0x64')](path['join'](config[_0x874c('0x61')],_0x3a4a0b,_[_0x874c('0x60')](_0x295fd9['preferred'])))?path['join'](config[_0x874c('0x61')],_0x3a4a0b,_[_0x874c('0x60')](_0x295fd9[_0x874c('0x6b')])):path[_0x874c('0x5f')](config[_0x874c('0x61')],_0x3a4a0b,_[_0x874c('0x60')](_0x874c('0x73')));var _0x1c112d=_0x874c('0x6e')+_['upperFirst'](_0x874c('0x6b'));if(_0x295fd9[_0x1c112d]||!_0x35c3d4[_0x874c('0x63')]||!_0x35c3d4['preferred']){_0x311464=path['join'](config[_0x874c('0x61')],_0x3a4a0b,_[_0x874c('0x60')](_0x874c('0x73')));}if(!fs[_0x874c('0x64')](_0x311464)){throw new db[(_0x874c('0x65'))][(_0x874c('0x66'))](_[_0x874c('0x67')](_0x874c('0x6b'))+'\x20not\x20found');}return _0x256c2d[_0x874c('0x69')](_0x311464);}})[_0x874c('0x4e')](handleError(_0x256c2d,null));};exports['addFavicon']=function(_0x36f79e,_0x33272c,_0x46d860){if(_0x36f79e[_0x874c('0x54')]&&_0x36f79e[_0x874c('0x54')]['filename']){_0x36f79e[_0x874c('0x51')][_0x874c('0x5c')]=_0x36f79e[_0x874c('0x54')][_0x874c('0x55')];}return db[_0x874c('0x35')][_0x874c('0x50')]({'where':{'id':_0x36f79e[_0x874c('0x52')]['id']}})[_0x874c('0x1b')](handleEntityNotFound(_0x33272c,null))[_0x874c('0x1b')](saveUpdates(_0x36f79e[_0x874c('0x51')],null))[_0x874c('0x1b')](respondWithResult(_0x33272c,null))[_0x874c('0x4e')](handleError(_0x33272c,null));};var utilLicense=require('../../config/license/util');exports[_0x874c('0x74')]=function(_0x40b0a4,_0x4ba242,_0x5bd28a){var _0x30d181=_0x874c('0x59');var _0x2827d1={'custom':![]};return utilLicense[_0x874c('0x5a')]()['then'](function(_0x3011e7){if(_0x3011e7){_0x2827d1=_0x3011e7;}return db[_0x874c('0x35')][_0x874c('0x50')]({'where':{'id':_0x40b0a4['params']['id']},'attributes':['logo',_0x874c('0x57'),_0x874c('0x6b'),_0x874c('0x5c'),_0x874c('0x6c'),_0x874c('0x5d'),'defaultPreferred',_0x874c('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x4ba242,null))[_0x874c('0x1b')](function(_0x1dda9c){if(_0x1dda9c){var _0x41ebda=_0x1dda9c['favicon']&&fs[_0x874c('0x64')](path['join'](config[_0x874c('0x61')],_0x30d181,_[_0x874c('0x60')](_0x1dda9c['favicon'])))?path[_0x874c('0x5f')](config[_0x874c('0x61')],_0x30d181,_[_0x874c('0x60')](_0x1dda9c[_0x874c('0x5c')])):path[_0x874c('0x5f')](config[_0x874c('0x61')],_0x30d181,_['toLower'](_0x874c('0x75')));var _0x4fb1a4=_0x874c('0x6e')+_[_0x874c('0x67')](_0x874c('0x5c'));if(_0x1dda9c[_0x4fb1a4]||!_0x2827d1[_0x874c('0x63')]){_0x41ebda=path[_0x874c('0x5f')](config['root'],_0x30d181,_['toLower'](_0x874c('0x75')));}if(!fs['existsSync'](_0x41ebda)){throw new db[(_0x874c('0x65'))]['ValidationError'](_[_0x874c('0x67')](_0x874c('0x5c'))+_0x874c('0x68'));}return _0x4ba242[_0x874c('0x69')](_0x41ebda);}})[_0x874c('0x4e')](handleError(_0x4ba242,null));};exports['getDate']=function(_0x3135ca,_0x37507c){var _0x61f809={'offset':moment()[_0x874c('0x76')]()};_0x61f809[_0x874c('0x77')]=moment()[_0x874c('0x76')](_0x61f809[_0x874c('0x28')])[_0x874c('0x78')](_0x874c('0x79'));return _0x37507c[_0x874c('0x25')](0xc8)[_0x874c('0x7a')](_0x61f809);}; \ No newline at end of file +var _0x3427=['defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','logo','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','end','stack','name','send','index','map','Setting','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','body','addLogo','file','params','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo'];(function(_0x2253b8,_0x179bfc){var _0x103e01=function(_0x3f2c46){while(--_0x3f2c46){_0x2253b8['push'](_0x2253b8['shift']());}};_0x103e01(++_0x179bfc);}(_0x3427,0x1e8));var _0x7342=function(_0x49ead0,_0x3179b9){_0x49ead0=_0x49ead0-0x0;var _0x5e5de0=_0x3427[_0x49ead0];return _0x5e5de0;};'use strict';var pdf=require(_0x7342('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7342('0x1'));var zipdir=require(_0x7342('0x2'));var jsonpatch=require(_0x7342('0x3'));var rp=require(_0x7342('0x4'));var moment=require(_0x7342('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7342('0x6'));var util=require(_0x7342('0x7'));var path=require(_0x7342('0x8'));var sox=require(_0x7342('0x9'));var csv=require(_0x7342('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7342('0xb'));var crypto=require(_0x7342('0xc'));var jsforce=require(_0x7342('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7342('0xe'));var authService=require(_0x7342('0xf'));var qs=require(_0x7342('0x10'));var as=require(_0x7342('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7342('0x12'));var utils=require(_0x7342('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7342('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7342('0x15')][_0x7342('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x20f937,_0x1d46cc,_0x813580,_0x463976){return new BPromise(function(_0x541a73,_0x13c5db){var _0x5436cb=_0x463976||client;return _0x5436cb[_0x7342('0x17')](_0x20f937,_0x813580)['then'](function(_0x386291){logger['info'](_0x7342('0x18'),_0x1d46cc,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1d46cc,_0x7342('0x19'),JSON[_0x7342('0x1a')](_0x386291));if(_0x386291[_0x7342('0x1b')]){if(_0x386291['error']['code']===0x1f4){logger[_0x7342('0x1b')]('Setting,\x20%s,\x20%s',_0x1d46cc,_0x386291[_0x7342('0x1b')]['message']);return _0x13c5db(_0x386291[_0x7342('0x1b')][_0x7342('0x1c')]);}logger[_0x7342('0x1b')]('Setting,\x20%s,\x20%s',_0x1d46cc,_0x386291[_0x7342('0x1b')][_0x7342('0x1c')]);return _0x541a73(_0x386291[_0x7342('0x1b')]['message']);}else{logger[_0x7342('0x1d')](_0x7342('0x18'),_0x1d46cc,_0x7342('0x19'));_0x541a73(_0x386291[_0x7342('0x1e')][_0x7342('0x1c')]);}})[_0x7342('0x1f')](function(_0x45ce12){logger[_0x7342('0x1b')](_0x7342('0x18'),_0x1d46cc,_0x45ce12);_0x13c5db(_0x45ce12);});});}function respondWithStatusCode(_0x1b8b90,_0x16825e){_0x16825e=_0x16825e||0xcc;return function(_0x35f311){if(_0x35f311){return _0x1b8b90[_0x7342('0x20')](_0x16825e);}return _0x1b8b90['status'](_0x16825e)['end']();};}function respondWithResult(_0x552857,_0xaf2c48){_0xaf2c48=_0xaf2c48||0xc8;return function(_0x3e8696){if(_0x3e8696){return _0x552857[_0x7342('0x21')](_0xaf2c48)[_0x7342('0x22')](_0x3e8696);}};}function respondWithFilteredResult(_0x1b0d3c,_0xabb711){return function(_0x564d16){if(_0x564d16){var _0x2795f6=_0x564d16[_0x7342('0x23')],_0x8ffe75=_0xabb711[_0x7342('0x24')],_0x395683=_0xabb711[_0x7342('0x24')]+_0xabb711[_0x7342('0x25')],_0x122e5c;if(_0x395683>=_0x2795f6){_0x395683=_0x2795f6;_0x122e5c=0xc8;}else{_0x122e5c=0xce;}_0x1b0d3c[_0x7342('0x21')](_0x122e5c);return _0x1b0d3c['set']('Content-Range',_0x8ffe75+'-'+_0x395683+'/'+_0x2795f6)[_0x7342('0x22')](_0x564d16);}return null;};}function patchUpdates(_0xc26a8c){return function(_0x4e73d5){try{jsonpatch[_0x7342('0x26')](_0x4e73d5,_0xc26a8c,!![]);}catch(_0x2f223f){return BPromise['reject'](_0x2f223f);}return _0x4e73d5[_0x7342('0x27')]();};}function saveUpdates(_0x4cdce8,_0xcd8b2c){return function(_0x3af6b2){if(_0x3af6b2){return _0x3af6b2[_0x7342('0x28')](_0x4cdce8)[_0x7342('0x29')](function(_0x1e27b5){return _0x1e27b5;});}return null;};}function removeEntity(_0x524dfb,_0x48a4af){return function(_0x4cca57){if(_0x4cca57){return _0x4cca57[_0x7342('0x2a')]()[_0x7342('0x29')](function(){_0x524dfb[_0x7342('0x21')](0xcc)[_0x7342('0x2b')]();});}};}function handleEntityNotFound(_0xcf7a4,_0x3aee35){return function(_0x13d698){if(!_0x13d698){_0xcf7a4[_0x7342('0x20')](0x194);}return _0x13d698;};}function handleError(_0xeac345,_0x141ef7){_0x141ef7=_0x141ef7||0x1f4;return function(_0x3db578){logger[_0x7342('0x1b')](_0x3db578[_0x7342('0x2c')]);if(_0x3db578['name']){delete _0x3db578[_0x7342('0x2d')];}_0xeac345[_0x7342('0x21')](_0x141ef7)[_0x7342('0x2e')](_0x3db578);};}exports[_0x7342('0x2f')]=function(_0x2c69d2,_0x276afb){var _0x5133fd={},_0x5274ab={},_0x3f6525={'count':0x0,'rows':[]};var _0x376b20=_[_0x7342('0x30')](db[_0x7342('0x31')][_0x7342('0x32')],function(_0x3d9372){return{'name':_0x3d9372['fieldName'],'type':_0x3d9372['type'][_0x7342('0x33')]};});_0x5274ab[_0x7342('0x34')]=_[_0x7342('0x30')](_0x376b20,_0x7342('0x2d'));_0x5274ab[_0x7342('0x35')]=_[_0x7342('0x36')](_0x2c69d2[_0x7342('0x35')]);_0x5274ab[_0x7342('0x37')]=_[_0x7342('0x38')](_0x5274ab[_0x7342('0x34')],_0x5274ab[_0x7342('0x35')]);_0x5133fd['attributes']=_[_0x7342('0x38')](_0x5274ab['model'],qs[_0x7342('0x39')](_0x2c69d2['query'][_0x7342('0x39')]));_0x5133fd[_0x7342('0x3a')]=_0x5133fd[_0x7342('0x3a')][_0x7342('0x3b')]?_0x5133fd[_0x7342('0x3a')]:_0x5274ab[_0x7342('0x34')];if(!_0x2c69d2['query'][_0x7342('0x3c')](_0x7342('0x3d'))){_0x5133fd['limit']=qs[_0x7342('0x25')](_0x2c69d2[_0x7342('0x35')][_0x7342('0x25')]);_0x5133fd[_0x7342('0x24')]=qs['offset'](_0x2c69d2[_0x7342('0x35')][_0x7342('0x24')]);}_0x5133fd[_0x7342('0x3e')]=qs['sort'](_0x2c69d2[_0x7342('0x35')][_0x7342('0x3f')]);_0x5133fd[_0x7342('0x40')]=qs[_0x7342('0x37')](_[_0x7342('0x41')](_0x2c69d2['query'],_0x5274ab[_0x7342('0x37')]),_0x376b20);if(_0x2c69d2[_0x7342('0x35')][_0x7342('0x42')]){_0x5133fd[_0x7342('0x40')]=_[_0x7342('0x43')](_0x5133fd[_0x7342('0x40')],{'$or':_['map'](_0x376b20,function(_0x59066b){if(_0x59066b['type']!=='VIRTUAL'){var _0x1d112d={};_0x1d112d[_0x59066b[_0x7342('0x2d')]]={'$like':'%'+_0x2c69d2[_0x7342('0x35')][_0x7342('0x42')]+'%'};return _0x1d112d;}})});}_0x5133fd=_[_0x7342('0x43')]({},_0x5133fd,_0x2c69d2[_0x7342('0x44')]);var _0x40d08f={'where':_0x5133fd['where']};return db[_0x7342('0x31')]['count'](_0x40d08f)[_0x7342('0x29')](function(_0x4d1880){_0x3f6525[_0x7342('0x23')]=_0x4d1880;if(_0x2c69d2['query'][_0x7342('0x45')]){_0x5133fd[_0x7342('0x46')]=[{'all':!![]}];}return db[_0x7342('0x31')]['findAll'](_0x5133fd);})[_0x7342('0x29')](function(_0x59c2a8){_0x3f6525[_0x7342('0x47')]=_0x59c2a8;return _0x3f6525;})[_0x7342('0x29')](respondWithFilteredResult(_0x276afb,_0x5133fd))['catch'](handleError(_0x276afb,null));};exports[_0x7342('0x48')]=function(_0x3aa666,_0x52e8b5){var _0x10fc9e={'raw':![],'where':{'id':_0x3aa666['params']['id']}},_0x59da08={};_0x59da08[_0x7342('0x34')]=_[_0x7342('0x36')](db['Setting'][_0x7342('0x32')]);_0x59da08[_0x7342('0x35')]=_[_0x7342('0x36')](_0x3aa666[_0x7342('0x35')]);_0x59da08[_0x7342('0x37')]=_['intersection'](_0x59da08[_0x7342('0x34')],_0x59da08[_0x7342('0x35')]);_0x10fc9e[_0x7342('0x3a')]=_[_0x7342('0x38')](_0x59da08[_0x7342('0x34')],qs[_0x7342('0x39')](_0x3aa666[_0x7342('0x35')][_0x7342('0x39')]));_0x10fc9e[_0x7342('0x3a')]=_0x10fc9e[_0x7342('0x3a')][_0x7342('0x3b')]?_0x10fc9e[_0x7342('0x3a')]:_0x59da08[_0x7342('0x34')];if(_0x3aa666[_0x7342('0x35')]['includeAll']){_0x10fc9e['include']=[{'all':!![]}];}_0x10fc9e=_[_0x7342('0x43')]({},_0x10fc9e,_0x3aa666[_0x7342('0x44')]);return db['Setting'][_0x7342('0x49')](_0x10fc9e)[_0x7342('0x29')](handleEntityNotFound(_0x52e8b5,null))[_0x7342('0x29')](respondWithResult(_0x52e8b5,null))[_0x7342('0x1f')](handleError(_0x52e8b5,null));};exports[_0x7342('0x28')]=function(_0x17b409,_0x593573){if(_0x17b409[_0x7342('0x4a')]['id']){delete _0x17b409['body']['id'];}return db[_0x7342('0x31')][_0x7342('0x49')]({'where':{'id':_0x17b409['params']['id']}})['then'](handleEntityNotFound(_0x593573,null))[_0x7342('0x29')](saveUpdates(_0x17b409[_0x7342('0x4a')],null))[_0x7342('0x29')](respondWithResult(_0x593573,null))['catch'](handleError(_0x593573,null));};exports[_0x7342('0x4b')]=function(_0x34a1aa,_0x4fb45d,_0x31b298){if(_0x34a1aa[_0x7342('0x4c')]&&_0x34a1aa['file']['filename']){_0x34a1aa['body']['logo']=_0x34a1aa[_0x7342('0x4c')]['filename'];}return db['Setting'][_0x7342('0x49')]({'where':{'id':_0x34a1aa[_0x7342('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4fb45d,null))['then'](saveUpdates(_0x34a1aa['body'],null))[_0x7342('0x29')](respondWithResult(_0x4fb45d,null))['catch'](handleError(_0x4fb45d,null));};exports['addLogoLogin']=function(_0x48c41f,_0x38fda3,_0x2209ec){if(_0x48c41f['file']&&_0x48c41f[_0x7342('0x4c')][_0x7342('0x4e')]){_0x48c41f['body'][_0x7342('0x4f')]=_0x48c41f[_0x7342('0x4c')]['filename'];}return db[_0x7342('0x31')][_0x7342('0x49')]({'where':{'id':_0x48c41f[_0x7342('0x4d')]['id']}})[_0x7342('0x29')](handleEntityNotFound(_0x38fda3,null))[_0x7342('0x29')](saveUpdates(_0x48c41f[_0x7342('0x4a')],null))['then'](respondWithResult(_0x38fda3,null))[_0x7342('0x1f')](handleError(_0x38fda3,null));};var utilLicense=require(_0x7342('0x50'));exports[_0x7342('0x51')]=function(_0x33bbed,_0x5861a9,_0x461946){var _0x2d207a=_0x7342('0x52');var _0xeca44a={'custom':![]};return utilLicense[_0x7342('0x53')]()[_0x7342('0x29')](function(_0x561959){if(_0x561959){_0xeca44a=_0x561959;}return db[_0x7342('0x31')][_0x7342('0x49')]({'where':{'id':_0x33bbed[_0x7342('0x4d')]['id']},'attributes':['logo',_0x7342('0x4f'),_0x7342('0x54'),_0x7342('0x55'),_0x7342('0x56'),_0x7342('0x57'),_0x7342('0x58'),_0x7342('0x59')],'raw':!![]});})[_0x7342('0x29')](handleEntityNotFound(_0x5861a9,null))[_0x7342('0x29')](function(_0x3bd2b8){if(_0x3bd2b8){var _0xf0d521=_0x3bd2b8['logo']&&fs[_0x7342('0x5a')](path['join'](config['root'],_0x2d207a,_['toLower'](_0x3bd2b8[_0x7342('0x5b')])))?path[_0x7342('0x5c')](config[_0x7342('0x5d')],_0x2d207a,_['toLower'](_0x3bd2b8['logo'])):path[_0x7342('0x5c')](config[_0x7342('0x5d')],_0x2d207a,_[_0x7342('0x5e')](_0x7342('0x5f')));var _0x13663d=_0x7342('0x60')+_[_0x7342('0x61')](_0x7342('0x5b'));if(_0x3bd2b8[_0x13663d]||!_0xeca44a[_0x7342('0x62')]){_0xf0d521=path['join'](config[_0x7342('0x5d')],_0x2d207a,_[_0x7342('0x5e')](_0x7342('0x5f')));}if(!fs[_0x7342('0x5a')](_0xf0d521)){throw new db[(_0x7342('0x63'))][(_0x7342('0x64'))](_[_0x7342('0x61')](_0x7342('0x5b'))+_0x7342('0x65'));}return _0x5861a9[_0x7342('0x66')](_0xf0d521);}})[_0x7342('0x1f')](handleError(_0x5861a9,null));};var utilLicense=require(_0x7342('0x50'));exports[_0x7342('0x67')]=function(_0x4e5712,_0x382d01,_0x40484b){var _0x2dd442=_0x7342('0x52');var _0x162eaa={'custom':![]};return utilLicense[_0x7342('0x53')]()['then'](function(_0x989752){if(_0x989752){_0x162eaa=_0x989752;}return db[_0x7342('0x31')][_0x7342('0x49')]({'where':{'id':_0x4e5712[_0x7342('0x4d')]['id']},'attributes':['logo',_0x7342('0x4f'),'preferred',_0x7342('0x55'),_0x7342('0x56'),_0x7342('0x57'),'defaultPreferred',_0x7342('0x59')],'raw':!![]});})[_0x7342('0x29')](handleEntityNotFound(_0x382d01,null))['then'](function(_0x4418ec){if(_0x4418ec){var _0x1593b3=_0x4418ec['loginLogo']&&fs[_0x7342('0x5a')](path[_0x7342('0x5c')](config['root'],_0x2dd442,_[_0x7342('0x5e')](_0x4418ec[_0x7342('0x4f')])))?path['join'](config[_0x7342('0x5d')],_0x2dd442,_[_0x7342('0x5e')](_0x4418ec[_0x7342('0x4f')])):path[_0x7342('0x5c')](config['root'],_0x2dd442,_[_0x7342('0x5e')](_0x7342('0x68')));var _0x2a355e='default'+_[_0x7342('0x61')](_0x7342('0x4f'));if(_0x4418ec[_0x2a355e]||!_0x162eaa[_0x7342('0x62')]){_0x1593b3=path[_0x7342('0x5c')](config[_0x7342('0x5d')],_0x2dd442,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x1593b3)){throw new db[(_0x7342('0x63'))]['ValidationError'](_[_0x7342('0x61')](_0x7342('0x4f'))+_0x7342('0x65'));}return _0x382d01[_0x7342('0x66')](_0x1593b3);}})['catch'](handleError(_0x382d01,null));};exports[_0x7342('0x69')]=function(_0x271d99,_0x305a6b){return db[_0x7342('0x31')][_0x7342('0x49')]({'where':{'id':_0x271d99[_0x7342('0x4d')]['id']},'attributes':['securePassword']})[_0x7342('0x29')](respondWithResult(_0x305a6b,null))[_0x7342('0x1f')](handleError(_0x305a6b,null));};exports[_0x7342('0x6a')]=function(_0x287576,_0x2b3c44,_0x44c5a4){if(_0x287576['file']&&_0x287576[_0x7342('0x4c')][_0x7342('0x4e')]){_0x287576[_0x7342('0x4a')][_0x7342('0x54')]=_0x287576[_0x7342('0x4c')][_0x7342('0x4e')];}return db['Setting'][_0x7342('0x49')]({'where':{'id':_0x287576[_0x7342('0x4d')]['id']}})[_0x7342('0x29')](handleEntityNotFound(_0x2b3c44,null))[_0x7342('0x29')](saveUpdates(_0x287576[_0x7342('0x4a')],null))[_0x7342('0x29')](respondWithResult(_0x2b3c44,null))[_0x7342('0x1f')](handleError(_0x2b3c44,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x12174a,_0x12044f,_0x2b7017){var _0x6482df='server/files/images/logos';var _0x44c1a7={'custom':![]};return utilLicense[_0x7342('0x53')]()['then'](function(_0x51df85){if(_0x51df85){_0x44c1a7=_0x51df85;}return db['Setting'][_0x7342('0x49')]({'where':{'id':_0x12174a[_0x7342('0x4d')]['id']},'attributes':[_0x7342('0x5b'),_0x7342('0x4f'),'preferred','favicon','defaultLogo',_0x7342('0x57'),_0x7342('0x58'),_0x7342('0x59')],'raw':!![]});})[_0x7342('0x29')](handleEntityNotFound(_0x12044f,null))[_0x7342('0x29')](function(_0xe30de6){if(_0xe30de6){var _0x3adbb2=_0xe30de6[_0x7342('0x54')]&&fs[_0x7342('0x5a')](path[_0x7342('0x5c')](config[_0x7342('0x5d')],_0x6482df,_[_0x7342('0x5e')](_0xe30de6[_0x7342('0x54')])))?path[_0x7342('0x5c')](config['root'],_0x6482df,_['toLower'](_0xe30de6[_0x7342('0x54')])):path[_0x7342('0x5c')](config[_0x7342('0x5d')],_0x6482df,_[_0x7342('0x5e')](_0x7342('0x6b')));var _0x3e6a1c='default'+_[_0x7342('0x61')](_0x7342('0x54'));if(_0xe30de6[_0x3e6a1c]||!_0x44c1a7['custom']||!_0x44c1a7[_0x7342('0x54')]){_0x3adbb2=path[_0x7342('0x5c')](config['root'],_0x6482df,_['toLower']('default_preferred.png'));}if(!fs[_0x7342('0x5a')](_0x3adbb2)){throw new db[(_0x7342('0x63'))][(_0x7342('0x64'))](_['upperFirst'](_0x7342('0x54'))+_0x7342('0x65'));}return _0x12044f[_0x7342('0x66')](_0x3adbb2);}})[_0x7342('0x1f')](handleError(_0x12044f,null));};exports[_0x7342('0x6c')]=function(_0x1be65e,_0x3b423e,_0x3b75e6){if(_0x1be65e['file']&&_0x1be65e[_0x7342('0x4c')]['filename']){_0x1be65e[_0x7342('0x4a')]['favicon']=_0x1be65e[_0x7342('0x4c')][_0x7342('0x4e')];}return db[_0x7342('0x31')]['find']({'where':{'id':_0x1be65e[_0x7342('0x4d')]['id']}})[_0x7342('0x29')](handleEntityNotFound(_0x3b423e,null))[_0x7342('0x29')](saveUpdates(_0x1be65e[_0x7342('0x4a')],null))[_0x7342('0x29')](respondWithResult(_0x3b423e,null))['catch'](handleError(_0x3b423e,null));};var utilLicense=require(_0x7342('0x50'));exports[_0x7342('0x6d')]=function(_0x498ad7,_0x40c553,_0x844cd){var _0x1c559e=_0x7342('0x52');var _0x478981={'custom':![]};return utilLicense['getLicense']()[_0x7342('0x29')](function(_0x121727){if(_0x121727){_0x478981=_0x121727;}return db[_0x7342('0x31')][_0x7342('0x49')]({'where':{'id':_0x498ad7[_0x7342('0x4d')]['id']},'attributes':['logo','loginLogo',_0x7342('0x54'),_0x7342('0x55'),_0x7342('0x56'),'defaultLoginLogo',_0x7342('0x58'),_0x7342('0x59')],'raw':!![]});})[_0x7342('0x29')](handleEntityNotFound(_0x40c553,null))[_0x7342('0x29')](function(_0x1272ac){if(_0x1272ac){var _0x5113b0=_0x1272ac[_0x7342('0x55')]&&fs[_0x7342('0x5a')](path[_0x7342('0x5c')](config[_0x7342('0x5d')],_0x1c559e,_['toLower'](_0x1272ac[_0x7342('0x55')])))?path['join'](config[_0x7342('0x5d')],_0x1c559e,_[_0x7342('0x5e')](_0x1272ac[_0x7342('0x55')])):path[_0x7342('0x5c')](config[_0x7342('0x5d')],_0x1c559e,_[_0x7342('0x5e')](_0x7342('0x6e')));var _0x15e163=_0x7342('0x60')+_[_0x7342('0x61')]('favicon');if(_0x1272ac[_0x15e163]||!_0x478981['custom']){_0x5113b0=path[_0x7342('0x5c')](config['root'],_0x1c559e,_['toLower']('default_favicon.ico'));}if(!fs[_0x7342('0x5a')](_0x5113b0)){throw new db[(_0x7342('0x63'))][(_0x7342('0x64'))](_['upperFirst'](_0x7342('0x55'))+_0x7342('0x65'));}return _0x40c553['download'](_0x5113b0);}})[_0x7342('0x1f')](handleError(_0x40c553,null));};exports[_0x7342('0x6f')]=function(_0x45a08c,_0x1c7ce7){var _0x210fc8={'offset':moment()[_0x7342('0x70')]()};_0x210fc8['now']=moment()[_0x7342('0x70')](_0x210fc8['offset'])[_0x7342('0x71')](_0x7342('0x72'));return _0x1c7ce7[_0x7342('0x21')](0xc8)[_0x7342('0x2e')](_0x210fc8);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c93da17..b949270 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 _0x4c4f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','settings'];(function(_0x519cc4,_0x59d532){var _0x34f572=function(_0x28dc6a){while(--_0x28dc6a){_0x519cc4['push'](_0x519cc4['shift']());}};_0x34f572(++_0x59d532);}(_0x4c4f,0xfd));var _0xf4c4=function(_0x1f5594,_0x4b3e38){_0x1f5594=_0x1f5594-0x0;var _0x3b1c33=_0x4c4f[_0x1f5594];return _0x3b1c33;};'use strict';var _=require(_0xf4c4('0x0'));var util=require(_0xf4c4('0x1'));var logger=require(_0xf4c4('0x2'))(_0xf4c4('0x3'));var moment=require(_0xf4c4('0x4'));var BPromise=require(_0xf4c4('0x5'));var rp=require(_0xf4c4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4c4('0x7'));var config=require(_0xf4c4('0x8'));var attributes=require('./setting.attributes');module[_0xf4c4('0x9')]=function(_0x35551e,_0x3e1f2d){return _0x35551e['define']('Setting',attributes,{'tableName':_0xf4c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf45f=['api','bluebird','request-promise','path','rimraf','exports','define','Setting','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf45f,0x179));var _0xff45=function(_0x43f6f1,_0x43cb33){_0x43f6f1=_0x43f6f1-0x0;var _0x323935=_0xf45f[_0x43f6f1];return _0x323935;};'use strict';var _=require(_0xff45('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff45('0x1'));var moment=require('moment');var BPromise=require(_0xff45('0x2'));var rp=require(_0xff45('0x3'));var fs=require('fs');var path=require(_0xff45('0x4'));var rimraf=require(_0xff45('0x5'));var config=require('../../config/environment');var attributes=require('./setting.attributes');module[_0xff45('0x6')]=function(_0x193a24,_0x3e3390){return _0x193a24[_0xff45('0x7')](_0xff45('0x8'),attributes,{'tableName':'settings','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 c5aac62..21d680b 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 _0x4069=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x1c5657,_0x341135){var _0x372e31=function(_0x530d21){while(--_0x530d21){_0x1c5657['push'](_0x1c5657['shift']());}};_0x372e31(++_0x341135);}(_0x4069,0x178));var _0x9406=function(_0x3dfa17,_0xb89894){_0x3dfa17=_0x3dfa17-0x0;var _0x597f3f=_0x4069[_0x3dfa17];return _0x597f3f;};'use strict';var _=require(_0x9406('0x0'));var util=require('util');var moment=require(_0x9406('0x1'));var BPromise=require(_0x9406('0x2'));var rs=require(_0x9406('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9406('0x4'))['db'];var utils=require(_0x9406('0x5'));var logger=require('../../config/logger')(_0x9406('0x6'));var config=require(_0x9406('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9406('0x8')][_0x9406('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17eb74,_0x22a600,_0x29de75){return new BPromise(function(_0x4f11df,_0x58d563){return client[_0x9406('0xa')](_0x17eb74,_0x29de75)[_0x9406('0xb')](function(_0x553185){logger[_0x9406('0xc')](_0x9406('0xd'),_0x22a600,_0x9406('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x22a600,'request\x20sent',JSON[_0x9406('0xf')](_0x553185));if(_0x553185[_0x9406('0x10')]){if(_0x553185[_0x9406('0x10')][_0x9406('0x11')]===0x1f4){logger['error'](_0x9406('0xd'),_0x22a600,_0x553185['error'][_0x9406('0x12')]);return _0x58d563(_0x553185[_0x9406('0x10')][_0x9406('0x12')]);}logger[_0x9406('0x10')]('Setting,\x20%s,\x20%s',_0x22a600,_0x553185['error'][_0x9406('0x12')]);return _0x4f11df(_0x553185[_0x9406('0x10')][_0x9406('0x12')]);}else{logger[_0x9406('0xc')](_0x9406('0xd'),_0x22a600,_0x9406('0xe'));_0x4f11df(_0x553185[_0x9406('0x13')][_0x9406('0x12')]);}})[_0x9406('0x14')](function(_0x5f02b5){logger[_0x9406('0x10')](_0x9406('0xd'),_0x22a600,_0x5f02b5);_0x58d563(_0x5f02b5);});});} \ No newline at end of file +var _0x5f05=['rpc','jayson/promise','client','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x7d42e5,_0xe515f3){var _0x57b62c=function(_0x2b0f69){while(--_0x2b0f69){_0x7d42e5['push'](_0x7d42e5['shift']());}};_0x57b62c(++_0xe515f3);}(_0x5f05,0xc3));var _0x55f0=function(_0x13380c,_0x1b9894){_0x13380c=_0x13380c-0x0;var _0x18c461=_0x5f05[_0x13380c];return _0x18c461;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x55f0('0x0'));var BPromise=require(_0x55f0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55f0('0x2'))['db'];var utils=require(_0x55f0('0x3'));var logger=require(_0x55f0('0x4'))(_0x55f0('0x5'));var config=require('../../config/environment');var jayson=require(_0x55f0('0x6'));var client=jayson[_0x55f0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41cf98,_0x3cec89,_0xfec6b5){return new BPromise(function(_0x4547cc,_0x95eb48){return client[_0x55f0('0x8')](_0x41cf98,_0xfec6b5)[_0x55f0('0x9')](function(_0x21b2dc){logger[_0x55f0('0xa')]('Setting,\x20%s,\x20%s',_0x3cec89,_0x55f0('0xb'));logger['debug'](_0x55f0('0xc'),_0x3cec89,_0x55f0('0xb'),JSON[_0x55f0('0xd')](_0x21b2dc));if(_0x21b2dc[_0x55f0('0xe')]){if(_0x21b2dc[_0x55f0('0xe')][_0x55f0('0xf')]===0x1f4){logger[_0x55f0('0xe')](_0x55f0('0x10'),_0x3cec89,_0x21b2dc[_0x55f0('0xe')][_0x55f0('0x11')]);return _0x95eb48(_0x21b2dc[_0x55f0('0xe')][_0x55f0('0x11')]);}logger[_0x55f0('0xe')](_0x55f0('0x10'),_0x3cec89,_0x21b2dc[_0x55f0('0xe')][_0x55f0('0x11')]);return _0x4547cc(_0x21b2dc[_0x55f0('0xe')][_0x55f0('0x11')]);}else{logger['info'](_0x55f0('0x10'),_0x3cec89,'request\x20sent');_0x4547cc(_0x21b2dc[_0x55f0('0x12')][_0x55f0('0x11')]);}})[_0x55f0('0x13')](function(_0x1befe1){logger[_0x55f0('0xe')](_0x55f0('0x10'),_0x3cec89,_0x1befe1);_0x95eb48(_0x1befe1);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 17e217c..ea1e6b1 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 _0xd017=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','status','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0x4a489f,_0x5402ab){var _0x4a4137=function(_0x4e35f3){while(--_0x4e35f3){_0x4a489f['push'](_0x4a489f['shift']());}};_0x4a4137(++_0x5402ab);}(_0xd017,0x138));var _0x7d01=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xd017[_0x500419];return _0x241c1a;};'use strict';var multer=require('multer');var util=require(_0x7d01('0x0'));var path=require(_0x7d01('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d01('0x2'));var router=express[_0x7d01('0x3')]();var auth=require(_0x7d01('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7d01('0x5'));var controller=require(_0x7d01('0x6'));router['get']('/',auth[_0x7d01('0x7')](),controller['index']);router[_0x7d01('0x8')](_0x7d01('0x9'),auth[_0x7d01('0x7')](),controller[_0x7d01('0xa')]);router[_0x7d01('0x8')](_0x7d01('0xb'),auth[_0x7d01('0x7')](),controller[_0x7d01('0xc')]);router[_0x7d01('0x8')](_0x7d01('0xd'),auth[_0x7d01('0x7')](),controller['getDispositions']);router[_0x7d01('0x8')](_0x7d01('0xe'),auth[_0x7d01('0x7')](),controller[_0x7d01('0xf')]);router['get'](_0x7d01('0x10'),auth[_0x7d01('0x7')](),controller[_0x7d01('0x11')]);router[_0x7d01('0x8')](_0x7d01('0x12'),auth['isAuthenticated'](),controller[_0x7d01('0x13')]);router[_0x7d01('0x8')](_0x7d01('0x14'),controller[_0x7d01('0x15')]);router[_0x7d01('0x8')](_0x7d01('0x16'),auth['isAuthenticated'](),controller[_0x7d01('0x17')]);router[_0x7d01('0x18')]('/',auth[_0x7d01('0x7')](),controller[_0x7d01('0x19')]);router[_0x7d01('0x18')](_0x7d01('0xd'),auth[_0x7d01('0x7')](),controller[_0x7d01('0x1a')]);router[_0x7d01('0x18')](_0x7d01('0xe'),auth[_0x7d01('0x7')](),controller[_0x7d01('0x1b')]);router[_0x7d01('0x18')](_0x7d01('0x1c'),controller[_0x7d01('0x1d')]);router[_0x7d01('0x18')]('/:id/applications',auth[_0x7d01('0x7')](),controller[_0x7d01('0x1e')]);router[_0x7d01('0x18')](_0x7d01('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x7d01('0x18')](_0x7d01('0x14'),controller[_0x7d01('0x20')]);router[_0x7d01('0x18')](_0x7d01('0x16'),auth[_0x7d01('0x7')](),controller[_0x7d01('0x21')]);router[_0x7d01('0x22')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7d01('0x23')]('/:id',auth[_0x7d01('0x7')](),controller[_0x7d01('0x24')]);router['delete'](_0x7d01('0xd'),auth[_0x7d01('0x7')](),controller[_0x7d01('0x25')]);router[_0x7d01('0x23')](_0x7d01('0xe'),auth[_0x7d01('0x7')](),controller[_0x7d01('0x26')]);router[_0x7d01('0x23')]('/:id/users',auth[_0x7d01('0x7')](),controller[_0x7d01('0x27')]);module[_0x7d01('0x28')]=router; \ No newline at end of file +var _0x21ed=['getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x21ed,0x189));var _0xd21e=function(_0x30fbb9,_0x5c6fcb){_0x30fbb9=_0x30fbb9-0x0;var _0x5152c6=_0x21ed[_0x30fbb9];return _0x5152c6;};'use strict';var multer=require(_0xd21e('0x0'));var util=require(_0xd21e('0x1'));var path=require(_0xd21e('0x2'));var timeout=require(_0xd21e('0x3'));var express=require(_0xd21e('0x4'));var router=express[_0xd21e('0x5')]();var auth=require(_0xd21e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsAccount.controller');router[_0xd21e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd21e('0x8'),auth['isAuthenticated'](),controller[_0xd21e('0x9')]);router[_0xd21e('0x7')](_0xd21e('0xa'),auth[_0xd21e('0xb')](),controller['show']);router[_0xd21e('0x7')](_0xd21e('0xc'),auth[_0xd21e('0xb')](),controller[_0xd21e('0xd')]);router[_0xd21e('0x7')](_0xd21e('0xe'),auth['isAuthenticated'](),controller[_0xd21e('0xf')]);router['get'](_0xd21e('0x10'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x11')]);router[_0xd21e('0x7')](_0xd21e('0x12'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x13')]);router[_0xd21e('0x7')](_0xd21e('0x14'),controller[_0xd21e('0x15')]);router[_0xd21e('0x7')](_0xd21e('0x16'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd21e('0x18')]);router[_0xd21e('0x19')](_0xd21e('0xc'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x1a')]);router['post'](_0xd21e('0xe'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x1b')]);router[_0xd21e('0x19')](_0xd21e('0x1c'),controller[_0xd21e('0x1d')]);router['post'](_0xd21e('0x10'),auth[_0xd21e('0xb')](),controller['addApplications']);router[_0xd21e('0x19')](_0xd21e('0x1e'),auth['isAuthenticated'](),controller[_0xd21e('0x1f')]);router[_0xd21e('0x19')]('/:id/status',controller[_0xd21e('0x20')]);router[_0xd21e('0x19')](_0xd21e('0x16'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x21')]);router[_0xd21e('0x22')](_0xd21e('0xa'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x23')]);router[_0xd21e('0x24')](_0xd21e('0xa'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x25')]);router[_0xd21e('0x24')](_0xd21e('0xc'),auth[_0xd21e('0xb')](),controller['removeDispositions']);router['delete'](_0xd21e('0xe'),auth[_0xd21e('0xb')](),controller[_0xd21e('0x26')]);router[_0xd21e('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0xd21e('0x27')]);module[_0xd21e('0x28')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 18a100e..7ad968e 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 _0x8227=['bandwidth','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo'];(function(_0xc7928b,_0x51d4af){var _0x4565bc=function(_0x58e7ea){while(--_0x58e7ea){_0xc7928b['push'](_0xc7928b['shift']());}};_0x4565bc(++_0x51d4af);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7822('0x0'));module['exports']={'name':{'type':Sequelize[_0x7822('0x1')],'unique':_0x7822('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x7822('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x7822('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7822('0x3')]();}},'phone':{'type':Sequelize[_0x7822('0x1')]},'type':{'type':Sequelize[_0x7822('0x4')](_0x7822('0x5'),_0x7822('0x6'),_0x7822('0x7'),_0x7822('0x8'),_0x7822('0x9'),'clickatell',_0x7822('0xa'),'csc',_0x7822('0xb'),_0x7822('0xc'))},'accountSid':{'type':Sequelize[_0x7822('0x1')]},'authId':{'type':Sequelize[_0x7822('0x1')]},'authToken':{'type':Sequelize[_0x7822('0x1')]},'smsMethod':{'type':Sequelize[_0x7822('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x7822('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x7822('0x1')]},'senderString':{'type':Sequelize[_0x7822('0x1')]},'deliveryReport':{'type':Sequelize[_0x7822('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x7822('0x1')]},'notificationTemplate':{'type':Sequelize[_0x7822('0xe')],'defaultValue':function(){return _0x7822('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7822('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7822('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7822('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7822('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7822('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7822('0x10')],'comment':_0x7822('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x154c49){if(!_0x154c49)this[_0x7822('0x12')](_0x7822('0x13'),null);this[_0x7822('0x12')](_0x7822('0x14'),_0x154c49);}}}; \ No newline at end of file +var _0x4d08=['mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x4d08,0x1a5));var _0x84d0=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x4d08[_0x3227c1];return _0x31fd48;};'use strict';var Sequelize=require(_0x84d0('0x0'));var rs=require('randomstring');module[_0x84d0('0x1')]={'name':{'type':Sequelize[_0x84d0('0x2')],'unique':_0x84d0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x84d0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x84d0('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x84d0('0x4')]();}},'phone':{'type':Sequelize[_0x84d0('0x2')]},'type':{'type':Sequelize[_0x84d0('0x5')](_0x84d0('0x6'),_0x84d0('0x7'),_0x84d0('0x8'),_0x84d0('0x9'),_0x84d0('0xa'),_0x84d0('0xb'),_0x84d0('0xc'),_0x84d0('0xd'),_0x84d0('0xe'),_0x84d0('0xf'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x84d0('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x84d0('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x84d0('0x2')]},'accountId':{'type':Sequelize[_0x84d0('0x2')]},'senderString':{'type':Sequelize[_0x84d0('0x2')]},'deliveryReport':{'type':Sequelize[_0x84d0('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x84d0('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x84d0('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x84d0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x84d0('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x84d0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x84d0('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x84d0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x84d0('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x84d0('0x11')],'comment':_0x84d0('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2beef2){if(!_0x2beef2)this[_0x84d0('0x13')](_0x84d0('0x14'),null);this['setDataValue']('mandatoryDisposition',_0x2beef2);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6934984..81f2b08 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 _0x995f=['notify','sms','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','MessageSid','skebby','from','sender','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','DESC','list','Contacts','contact','SmsInteraction','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','interaction','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','pick','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','order','CannedAnswer','removeAnswers'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x995f,0x14f));var _0xf995=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0x995f[_0x3c04d7];return _0x2fb24;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf995('0x0'));var rimraf=require(_0xf995('0x1'));var zipdir=require(_0xf995('0x2'));var jsonpatch=require(_0xf995('0x3'));var rp=require(_0xf995('0x4'));var moment=require(_0xf995('0x5'));var BPromise=require(_0xf995('0x6'));var Mustache=require(_0xf995('0x7'));var util=require('util');var path=require(_0xf995('0x8'));var sox=require(_0xf995('0x9'));var csv=require('to-csv');var ejs=require(_0xf995('0xa'));var fs=require('fs');var _=require(_0xf995('0xb'));var squel=require('squel');var crypto=require(_0xf995('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf995('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf995('0xe'));var Papa=require(_0xf995('0xf'));var Redis=require(_0xf995('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf995('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf995('0x12'));var logger=require(_0xf995('0x13'))(_0xf995('0x14'));var utils=require(_0xf995('0x15'));var config=require(_0xf995('0x16'));var licenseUtil=require(_0xf995('0x17'));var db=require(_0xf995('0x18'))['db'];config[_0xf995('0x19')]=_[_0xf995('0x1a')](config[_0xf995('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf995('0x19')]));require(_0xf995('0x1b'))[_0xf995('0x1c')](socket);var jayson=require(_0xf995('0x1d'));var client=jayson[_0xf995('0x1e')][_0xf995('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x463c5b,_0x5b2b15,_0x5149b0,_0x273fb6){return new BPromise(function(_0x5c1581,_0x3c315f){var _0x2a0b8f=_0x273fb6||client;return _0x2a0b8f[_0xf995('0x20')](_0x463c5b,_0x5149b0)['then'](function(_0xdd0629){logger[_0xf995('0x21')]('SmsAccount,\x20%s,\x20%s',_0x5b2b15,_0xf995('0x22'));logger[_0xf995('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b2b15,_0xf995('0x22'),JSON[_0xf995('0x24')](_0xdd0629));if(_0xdd0629['error']){if(_0xdd0629[_0xf995('0x25')][_0xf995('0x26')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5b2b15,_0xdd0629[_0xf995('0x25')][_0xf995('0x27')]);return _0x3c315f(_0xdd0629[_0xf995('0x25')][_0xf995('0x27')]);}logger[_0xf995('0x25')](_0xf995('0x28'),_0x5b2b15,_0xdd0629[_0xf995('0x25')]['message']);return _0x5c1581(_0xdd0629[_0xf995('0x25')][_0xf995('0x27')]);}else{logger[_0xf995('0x21')](_0xf995('0x28'),_0x5b2b15,_0xf995('0x22'));_0x5c1581(_0xdd0629[_0xf995('0x29')][_0xf995('0x27')]);}})[_0xf995('0x2a')](function(_0x535eb6){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5b2b15,_0x535eb6);_0x3c315f(_0x535eb6);});});}function respondWithStatusCode(_0x4c5a6d,_0x5a4caa){_0x5a4caa=_0x5a4caa||0xcc;return function(_0x1dbc78){if(_0x1dbc78){return _0x4c5a6d[_0xf995('0x2b')](_0x5a4caa);}return _0x4c5a6d['status'](_0x5a4caa)[_0xf995('0x2c')]();};}function respondWithResult(_0x70a7be,_0x49cd79){_0x49cd79=_0x49cd79||0xc8;return function(_0x59b64b){if(_0x59b64b){return _0x70a7be[_0xf995('0x2d')](_0x49cd79)[_0xf995('0x2e')](_0x59b64b);}};}function respondWithFilteredResult(_0x20a385,_0x813b57){return function(_0xa36448){if(_0xa36448){var _0x330b31=_0xa36448[_0xf995('0x2f')],_0x10fd9d=_0x813b57[_0xf995('0x30')],_0x317fd4=_0x813b57['offset']+_0x813b57[_0xf995('0x31')],_0xe060b5;if(_0x317fd4>=_0x330b31){_0x317fd4=_0x330b31;_0xe060b5=0xc8;}else{_0xe060b5=0xce;}_0x20a385[_0xf995('0x2d')](_0xe060b5);return _0x20a385[_0xf995('0x32')](_0xf995('0x33'),_0x10fd9d+'-'+_0x317fd4+'/'+_0x330b31)[_0xf995('0x2e')](_0xa36448);}return null;};}function patchUpdates(_0x9171a1){return function(_0x1a3087){try{jsonpatch['apply'](_0x1a3087,_0x9171a1,!![]);}catch(_0x5046aa){return BPromise[_0xf995('0x34')](_0x5046aa);}return _0x1a3087['save']();};}function saveUpdates(_0x2c75d2,_0x41a9d8){return function(_0x4e14ff){if(_0x4e14ff){return _0x4e14ff[_0xf995('0x35')](_0x2c75d2)[_0xf995('0x36')](function(_0x1f2468){return _0x1f2468;});}return null;};}function removeEntity(_0x59e142,_0x10ed8a){return function(_0x22ed1c){if(_0x22ed1c){return _0x22ed1c[_0xf995('0x37')]()['then'](function(){var _0x591377=_0x22ed1c[_0xf995('0x38')]({'plain':!![]});var _0x21387f=_0xf995('0x39');return db[_0xf995('0x3a')]['destroy']({'where':{'type':_0x21387f,'resourceId':_0x591377['id']}})['then'](function(){return _0x22ed1c;});})[_0xf995('0x36')](function(){_0x59e142[_0xf995('0x2d')](0xcc)[_0xf995('0x2c')]();});}};}function handleEntityNotFound(_0x18d155,_0x3b4feb){return function(_0x870258){if(!_0x870258){_0x18d155['sendStatus'](0x194);}return _0x870258;};}function handleError(_0x5a2a7c,_0x1f1af2){_0x1f1af2=_0x1f1af2||0x1f4;return function(_0x5dcb46){logger[_0xf995('0x25')](_0x5dcb46[_0xf995('0x3b')]);if(_0x5dcb46[_0xf995('0x3c')]){delete _0x5dcb46[_0xf995('0x3c')];}_0x5a2a7c[_0xf995('0x2d')](_0x1f1af2)[_0xf995('0x3d')](_0x5dcb46);};}exports[_0xf995('0x3e')]=function(_0x104811,_0x473c1f){var _0x3b5330={'include':[{'model':db[_0xf995('0x3f')],'as':_0xf995('0x40')}]},_0x8cba0a={},_0x4e5c99={'count':0x0,'rows':[]};var _0x2a7aed=_[_0xf995('0x41')](db['SmsAccount'][_0xf995('0x42')],function(_0x377cd2){return{'name':_0x377cd2['fieldName'],'type':_0x377cd2[_0xf995('0x43')][_0xf995('0x44')]};});_0x8cba0a[_0xf995('0x45')]=_[_0xf995('0x41')](_0x2a7aed,_0xf995('0x3c'));_0x8cba0a[_0xf995('0x46')]=_[_0xf995('0x47')](_0x104811[_0xf995('0x46')]);_0x8cba0a[_0xf995('0x48')]=_['intersection'](_0x8cba0a[_0xf995('0x45')],_0x8cba0a[_0xf995('0x46')]);_0x3b5330[_0xf995('0x49')]=_[_0xf995('0x4a')](_0x8cba0a[_0xf995('0x45')],qs[_0xf995('0x4b')](_0x104811[_0xf995('0x46')][_0xf995('0x4b')]));_0x3b5330[_0xf995('0x49')]=_0x3b5330[_0xf995('0x49')]['length']?_0x3b5330[_0xf995('0x49')]:_0x8cba0a[_0xf995('0x45')];if(!_0x104811[_0xf995('0x46')][_0xf995('0x4c')](_0xf995('0x4d'))){_0x3b5330[_0xf995('0x31')]=qs[_0xf995('0x31')](_0x104811['query'][_0xf995('0x31')]);_0x3b5330[_0xf995('0x30')]=qs[_0xf995('0x30')](_0x104811[_0xf995('0x46')]['offset']);}_0x3b5330['order']=qs['sort'](_0x104811[_0xf995('0x46')][_0xf995('0x4e')]);_0x3b5330[_0xf995('0x4f')]=qs[_0xf995('0x48')](_['pick'](_0x104811['query'],_0x8cba0a['filters']),_0x2a7aed);if(_0x104811['query'][_0xf995('0x50')]){_0x3b5330[_0xf995('0x4f')]=_[_0xf995('0x51')](_0x3b5330[_0xf995('0x4f')],{'$or':_[_0xf995('0x41')](_0x2a7aed,function(_0x559074){if(_0x559074[_0xf995('0x43')]!==_0xf995('0x52')){var _0x1c2fdc={};_0x1c2fdc[_0x559074[_0xf995('0x3c')]]={'$like':'%'+_0x104811[_0xf995('0x46')][_0xf995('0x50')]+'%'};return _0x1c2fdc;}})});}_0x3b5330=_[_0xf995('0x51')]({},_0x3b5330,_0x104811[_0xf995('0x53')]);var _0x1a21b3={'where':_0x3b5330[_0xf995('0x4f')]};return db[_0xf995('0x54')]['count'](_0x1a21b3)[_0xf995('0x36')](function(_0x1146fd){_0x4e5c99[_0xf995('0x2f')]=_0x1146fd;if(_0x104811['query'][_0xf995('0x55')]){_0x3b5330[_0xf995('0x56')]=[{'all':!![]}];}return db[_0xf995('0x54')]['findAll'](_0x3b5330);})[_0xf995('0x36')](function(_0x2f420a){_0x4e5c99['rows']=_0x2f420a;return _0x4e5c99;})[_0xf995('0x36')](respondWithFilteredResult(_0x473c1f,_0x3b5330))[_0xf995('0x2a')](handleError(_0x473c1f,null));};exports[_0xf995('0x57')]=function(_0x2d5de0,_0x827ec4){var _0x1908ba={'raw':![],'where':{'id':_0x2d5de0[_0xf995('0x58')]['id']},'include':[{'model':db[_0xf995('0x3f')],'as':_0xf995('0x40')}]},_0x4beefe={};_0x4beefe['model']=_[_0xf995('0x47')](db[_0xf995('0x54')][_0xf995('0x42')]);_0x4beefe[_0xf995('0x46')]=_[_0xf995('0x47')](_0x2d5de0[_0xf995('0x46')]);_0x4beefe[_0xf995('0x48')]=_[_0xf995('0x4a')](_0x4beefe[_0xf995('0x45')],_0x4beefe[_0xf995('0x46')]);_0x1908ba[_0xf995('0x49')]=_[_0xf995('0x4a')](_0x4beefe[_0xf995('0x45')],qs['fields'](_0x2d5de0['query']['fields']));_0x1908ba['attributes']=_0x1908ba[_0xf995('0x49')][_0xf995('0x59')]?_0x1908ba['attributes']:_0x4beefe[_0xf995('0x45')];if(_0x2d5de0[_0xf995('0x46')][_0xf995('0x55')]){_0x1908ba[_0xf995('0x56')]=[{'all':!![]}];}_0x1908ba=_['merge']({},_0x1908ba,_0x2d5de0[_0xf995('0x53')]);return db[_0xf995('0x54')][_0xf995('0x5a')](_0x1908ba)[_0xf995('0x36')](handleEntityNotFound(_0x827ec4,null))[_0xf995('0x36')](respondWithResult(_0x827ec4,null))[_0xf995('0x2a')](handleError(_0x827ec4,null));};exports[_0xf995('0x5b')]=function(_0xf19ce,_0x310091){return db[_0xf995('0x54')][_0xf995('0x5b')](_0xf19ce[_0xf995('0x5c')],{})['then'](function(_0x4ebbab){var _0x3cb5a6=_0xf19ce['user'][_0xf995('0x38')]({'plain':!![]});if(!_0x3cb5a6)throw new Error(_0xf995('0x5d'));if(_0x3cb5a6[_0xf995('0x5e')]===_0xf995('0x5f')){var _0x4ce5ba=_0x4ebbab[_0xf995('0x38')]({'plain':!![]});var _0x371d21=_0xf995('0x39');return db[_0xf995('0x60')][_0xf995('0x5a')]({'where':{'name':_0x371d21,'userProfileId':_0x3cb5a6['userProfileId']},'raw':!![]})['then'](function(_0x3e0efe){if(_0x3e0efe&&_0x3e0efe['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4ce5ba['name'],'resourceId':_0x4ce5ba['id'],'type':_0x3e0efe[_0xf995('0x3c')],'sectionId':_0x3e0efe['id']},{})[_0xf995('0x36')](function(){return _0x4ebbab;});}else{return _0x4ebbab;}})['catch'](function(_0x35c01b){logger[_0xf995('0x25')](_0xf995('0x61'),_0x35c01b);throw _0x35c01b;});}return _0x4ebbab;})[_0xf995('0x36')](respondWithResult(_0x310091,0xc9))[_0xf995('0x2a')](handleError(_0x310091,null));};exports[_0xf995('0x35')]=function(_0x31e9c0,_0x2a7a40){if(_0x31e9c0[_0xf995('0x5c')]['id']){delete _0x31e9c0[_0xf995('0x5c')]['id'];}return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x31e9c0[_0xf995('0x58')]['id']},'include':[{'model':db[_0xf995('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2a7a40,null))[_0xf995('0x36')](saveUpdates(_0x31e9c0[_0xf995('0x5c')],null))[_0xf995('0x36')](respondWithResult(_0x2a7a40,null))[_0xf995('0x2a')](handleError(_0x2a7a40,null));};exports[_0xf995('0x37')]=function(_0x16c8ab,_0x268f2f){return db[_0xf995('0x54')]['find']({'where':{'id':_0x16c8ab[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x268f2f,null))[_0xf995('0x36')](removeEntity(_0x268f2f,null))[_0xf995('0x2a')](handleError(_0x268f2f,null));};exports[_0xf995('0x62')]=function(_0x19e527,_0x2a0773){return db[_0xf995('0x54')][_0xf995('0x62')]()[_0xf995('0x36')](respondWithResult(_0x2a0773,null))[_0xf995('0x2a')](handleError(_0x2a0773,null));};exports[_0xf995('0x63')]=function(_0x266a2a,_0x2759eb,_0x353099){if(_0x266a2a['body']['id']){delete _0x266a2a[_0xf995('0x5c')]['id'];}return db[_0xf995('0x54')]['find']({'where':{'id':_0x266a2a[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x2759eb,null))['then'](function(_0x30e97d){if(_0x30e97d){_0x266a2a[_0xf995('0x5c')][_0xf995('0x64')]=_0x30e97d['id'];return db[_0xf995('0x65')][_0xf995('0x5b')](_0x266a2a[_0xf995('0x5c')]);}})[_0xf995('0x36')](respondWithResult(_0x2759eb,null))[_0xf995('0x2a')](handleError(_0x2759eb,null));};exports[_0xf995('0x66')]=function(_0x51f6f7,_0x1017eb,_0x4b76e7){var _0x794717={'raw':![],'where':{}};var _0x554543={};var _0x573844={'count':0x0,'rows':[]};return db[_0xf995('0x54')]['findOne']({'where':{'id':_0x51f6f7[_0xf995('0x58')]['id']}})['then'](handleEntityNotFound(_0x1017eb,null))[_0xf995('0x36')](function(_0x13aa27){if(_0x13aa27){_0x554543[_0xf995('0x45')]=_[_0xf995('0x47')](db['Disposition']['rawAttributes']);_0x554543[_0xf995('0x46')]=_[_0xf995('0x47')](_0x51f6f7['query']);_0x554543[_0xf995('0x48')]=_[_0xf995('0x4a')](_0x554543[_0xf995('0x45')],_0x554543[_0xf995('0x46')]);_0x794717[_0xf995('0x49')]=_[_0xf995('0x4a')](_0x554543[_0xf995('0x45')],qs['fields'](_0x51f6f7[_0xf995('0x46')][_0xf995('0x4b')]));_0x794717[_0xf995('0x49')]=_0x794717[_0xf995('0x49')][_0xf995('0x59')]?_0x794717[_0xf995('0x49')]:_0x554543[_0xf995('0x45')];if(!_0x51f6f7[_0xf995('0x46')][_0xf995('0x4c')](_0xf995('0x4d'))){_0x794717[_0xf995('0x31')]=qs['limit'](_0x51f6f7[_0xf995('0x46')][_0xf995('0x31')]);_0x794717[_0xf995('0x30')]=qs[_0xf995('0x30')](_0x51f6f7['query'][_0xf995('0x30')]);}_0x794717['order']=qs[_0xf995('0x4e')](_0x51f6f7[_0xf995('0x46')][_0xf995('0x4e')]);_0x794717[_0xf995('0x4f')]=qs[_0xf995('0x48')](_['pick'](_0x51f6f7[_0xf995('0x46')],_0x554543[_0xf995('0x48')]));_0x794717[_0xf995('0x4f')][_0xf995('0x64')]=_0x13aa27['id'];if(_0x51f6f7[_0xf995('0x46')][_0xf995('0x50')]){_0x794717['where']=_[_0xf995('0x51')](_0x794717[_0xf995('0x4f')],{'$or':_['map'](_0x794717['attributes'],function(_0x1d78a7){var _0x4e5bdd={};_0x4e5bdd[_0x1d78a7]={'$like':'%'+_0x51f6f7[_0xf995('0x46')][_0xf995('0x50')]+'%'};return _0x4e5bdd;})});}_0x794717=_[_0xf995('0x51')]({},_0x794717,_0x51f6f7[_0xf995('0x53')]);return db[_0xf995('0x65')][_0xf995('0x2f')]({'where':_0x794717[_0xf995('0x4f')]})[_0xf995('0x36')](function(_0x3b1d8b){_0x573844[_0xf995('0x2f')]=_0x3b1d8b;if(_0x51f6f7[_0xf995('0x46')][_0xf995('0x55')]){_0x794717[_0xf995('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xf995('0x67')](_0x794717);})[_0xf995('0x36')](function(_0x20b64b){_0x573844[_0xf995('0x68')]=_0x20b64b;return _0x573844;});}})[_0xf995('0x36')](respondWithFilteredResult(_0x1017eb,_0x794717))['catch'](handleError(_0x1017eb,null));};exports[_0xf995('0x69')]=function(_0x400589,_0x1be928,_0x53ad5c){return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x400589[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x1be928,null))[_0xf995('0x36')](function(_0x1f26f6){if(_0x1f26f6){return _0x1f26f6[_0xf995('0x69')](_0x400589[_0xf995('0x46')][_0xf995('0x6a')]);}})[_0xf995('0x36')](respondWithStatusCode(_0x1be928,null))['catch'](handleError(_0x1be928,null));};exports[_0xf995('0x6b')]=function(_0x316b1c,_0x54770c,_0x4a050d){if(_0x316b1c['body']['id']){delete _0x316b1c['body']['id'];}return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x316b1c['params']['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x54770c,null))[_0xf995('0x36')](function(_0x3f732d){if(_0x3f732d){_0x316b1c[_0xf995('0x5c')]['SmsAccountId']=_0x3f732d['id'];return db['CannedAnswer'][_0xf995('0x5b')](_0x316b1c[_0xf995('0x5c')]);}})[_0xf995('0x36')](respondWithResult(_0x54770c,null))[_0xf995('0x2a')](handleError(_0x54770c,null));};exports[_0xf995('0x6c')]=function(_0x4835de,_0x4f6ba4,_0x42250c){var _0x1eff81={'raw':![],'where':{}};var _0x4c1eb9={};var _0x16dedb={'count':0x0,'rows':[]};return db['SmsAccount'][_0xf995('0x6d')]({'where':{'id':_0x4835de[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x4f6ba4,null))[_0xf995('0x36')](function(_0xfbce06){if(_0xfbce06){_0x4c1eb9[_0xf995('0x45')]=_[_0xf995('0x47')](db['CannedAnswer']['rawAttributes']);_0x4c1eb9[_0xf995('0x46')]=_[_0xf995('0x47')](_0x4835de['query']);_0x4c1eb9[_0xf995('0x48')]=_['intersection'](_0x4c1eb9[_0xf995('0x45')],_0x4c1eb9[_0xf995('0x46')]);_0x1eff81[_0xf995('0x49')]=_['intersection'](_0x4c1eb9[_0xf995('0x45')],qs[_0xf995('0x4b')](_0x4835de[_0xf995('0x46')]['fields']));_0x1eff81[_0xf995('0x49')]=_0x1eff81['attributes'][_0xf995('0x59')]?_0x1eff81[_0xf995('0x49')]:_0x4c1eb9[_0xf995('0x45')];if(!_0x4835de[_0xf995('0x46')][_0xf995('0x4c')](_0xf995('0x4d'))){_0x1eff81['limit']=qs[_0xf995('0x31')](_0x4835de[_0xf995('0x46')][_0xf995('0x31')]);_0x1eff81[_0xf995('0x30')]=qs['offset'](_0x4835de[_0xf995('0x46')][_0xf995('0x30')]);}_0x1eff81[_0xf995('0x6e')]=qs[_0xf995('0x4e')](_0x4835de[_0xf995('0x46')][_0xf995('0x4e')]);_0x1eff81[_0xf995('0x4f')]=qs[_0xf995('0x48')](_['pick'](_0x4835de[_0xf995('0x46')],_0x4c1eb9['filters']));_0x1eff81['where'][_0xf995('0x64')]=_0xfbce06['id'];if(_0x4835de[_0xf995('0x46')]['filter']){_0x1eff81['where']=_[_0xf995('0x51')](_0x1eff81[_0xf995('0x4f')],{'$or':_[_0xf995('0x41')](_0x1eff81[_0xf995('0x49')],function(_0x2a3c3d){var _0x4552cd={};_0x4552cd[_0x2a3c3d]={'$like':'%'+_0x4835de[_0xf995('0x46')]['filter']+'%'};return _0x4552cd;})});}_0x1eff81=_[_0xf995('0x51')]({},_0x1eff81,_0x4835de[_0xf995('0x53')]);return db['CannedAnswer'][_0xf995('0x2f')]({'where':_0x1eff81[_0xf995('0x4f')]})[_0xf995('0x36')](function(_0xf5de8c){_0x16dedb['count']=_0xf5de8c;if(_0x4835de[_0xf995('0x46')]['includeAll']){_0x1eff81[_0xf995('0x56')]=[{'all':!![]}];}return db[_0xf995('0x6f')][_0xf995('0x67')](_0x1eff81);})[_0xf995('0x36')](function(_0x38d421){_0x16dedb['rows']=_0x38d421;return _0x16dedb;});}})[_0xf995('0x36')](respondWithFilteredResult(_0x4f6ba4,_0x1eff81))['catch'](handleError(_0x4f6ba4,null));};exports[_0xf995('0x70')]=function(_0x271f51,_0x4973d2,_0x5a67ee){return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x271f51[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x4973d2,null))['then'](function(_0x19f0b8){if(_0x19f0b8){return _0x19f0b8[_0xf995('0x70')](_0x271f51[_0xf995('0x46')][_0xf995('0x6a')]);}})[_0xf995('0x36')](respondWithStatusCode(_0x4973d2,null))['catch'](handleError(_0x4973d2,null));};exports[_0xf995('0x71')]=function(_0x5eb722,_0x4be7c2,_0x218831){var _0x27dacc={'channel':_0xf995('0x72')};var _0x5cfb18=[];var _0x193bea=[];var _0x4b98c2={};return db[_0xf995('0x54')]['find']({'where':{'id':_0x5eb722[_0xf995('0x58')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x4be7c2,null))[_0xf995('0x36')](function(_0x35770e){_0x27dacc[_0xf995('0x73')]=_0x35770e;_0x27dacc[_0xf995('0x74')]=_[_0xf995('0x75')](_0x35770e[_0xf995('0x76')],[_0xf995('0x77')],[_0xf995('0x78')]);if(_0x27dacc[_0xf995('0x73')][_0xf995('0x76')]){delete _0x27dacc['account'][_0xf995('0x76')];}return db[_0xf995('0x79')]['describe']();})[_0xf995('0x36')](function(_0x48944b){if(!_0x48944b){throw new db[(_0xf995('0x7a'))][(_0xf995('0x7b'))](_0xf995('0x7c'));}_0x5cfb18=_[_0xf995('0x7d')](_[_0xf995('0x47')](_0x48944b),[_0xf995('0x7e'),_0xf995('0x7f')]);_0x193bea=_[_0xf995('0x7d')](_[_0xf995('0x47')](_0x48944b),['createdAt',_0xf995('0x7f'),_0xf995('0x80'),_0xf995('0x81')]);_0x27dacc['body']={'mapKey':_0xf995('0x82')};if(_0x27dacc[_0xf995('0x73')][_0xf995('0x43')]){switch(_0x27dacc[_0xf995('0x73')][_0xf995('0x43')]){case _0xf995('0x83'):_0x27dacc[_0xf995('0x5c')]['from']=_0x5eb722[_0xf995('0x5c')][_0xf995('0x84')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x5c')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x85')];_0x27dacc[_0xf995('0x5c')]['messageId']=_0x5eb722[_0xf995('0x5c')][_0xf995('0x86')];break;case _0xf995('0x87'):_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')]='+'+_0x5eb722[_0xf995('0x5c')][_0xf995('0x89')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x5c')]=_0x5eb722['body'][_0xf995('0x8a')];break;case _0xf995('0x8b'):_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')]=_0x5eb722['body'][_0xf995('0x88')];_0x27dacc['body'][_0xf995('0x5c')]=_0x5eb722['body'][_0xf995('0x27')];break;case _0xf995('0x8c'):_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x88')];_0x27dacc['body'][_0xf995('0x5c')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x5c')];_0x27dacc['body'][_0xf995('0x8d')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x8e')];break;case _0xf995('0x8f'):_0x27dacc['body'][_0xf995('0x88')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x84')];_0x27dacc['body'][_0xf995('0x5c')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x90')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x8d')]=_0x5eb722['body'][_0xf995('0x91')];break;case'infobip':_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')]='+'+_0x5eb722['body'][_0xf995('0x92')][0x0][_0xf995('0x88')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x5c')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x92')][0x0][_0xf995('0x8a')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x8d')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x92')][0x0][_0xf995('0x8d')];break;case _0xf995('0x93'):_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x94')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x5c')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x95')]['message'];break;case _0xf995('0x96'):_0x27dacc['body'][_0xf995('0x88')]=_0x5eb722['body']['fromNumber'];_0x27dacc[_0xf995('0x5c')]['body']=_0x5eb722[_0xf995('0x5c')][_0xf995('0x8a')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x8d')]=_0x5eb722[_0xf995('0x5c')][_0xf995('0x97')];break;case _0xf995('0x98'):_0x27dacc[_0xf995('0x5c')][_0xf995('0x8d')]=_0x5eb722[_0xf995('0x5c')][0x0][_0xf995('0x27')]['id'];_0x27dacc['body'][_0xf995('0x88')]=_0x5eb722[_0xf995('0x5c')][0x0][_0xf995('0x27')][_0xf995('0x88')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x5c')]=_0x5eb722['body'][0x0]['message'][_0xf995('0x8a')];break;case _0xf995('0x99'):_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')]=_0x5eb722['body']['from'];_0x27dacc[_0xf995('0x5c')]['body']=_0x5eb722[_0xf995('0x5c')][_0xf995('0x27')];_0x27dacc[_0xf995('0x5c')][_0xf995('0x8d')]=_0x5eb722[_0xf995('0x5c')]['refid'];break;}}if(_0x27dacc[_0xf995('0x5c')]['id']){delete _0x27dacc[_0xf995('0x5c')]['id'];}if(_[_0xf995('0x9a')](_0x27dacc['body'][_0xf995('0x88')])){throw new db[(_0xf995('0x7a'))][(_0xf995('0x7b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x27dacc[_0xf995('0x5c')][_0xf995('0x5c')])||_0x27dacc[_0xf995('0x5c')]['body']===''){throw new db[(_0xf995('0x7a'))][(_0xf995('0x7b'))](_0xf995('0x9b'));}if(_[_0xf995('0x9a')](_0x27dacc[_0xf995('0x5c')]['mapKey'])){throw new db[(_0xf995('0x7a'))][(_0xf995('0x7b'))](_0xf995('0x9c')+_0x193bea);}if(!_['includes'](_0x193bea,_0x27dacc[_0xf995('0x5c')][_0xf995('0x9d')])){throw new db[(_0xf995('0x7a'))][(_0xf995('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x193bea);}_0x4b98c2[_0x27dacc[_0xf995('0x5c')][_0xf995('0x9d')]]=_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')];return db['CmList']['find']({'where':{'id':_0x27dacc['account'][_0xf995('0x81')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4b98c2,'limit':0x1,'order':[['updatedAt',_0xf995('0x9e')]]}]});})[_0xf995('0x36')](handleEntityNotFound(_0x4be7c2,null))[_0xf995('0x36')](function(_0x4c8371){if(_0x4c8371){_0x27dacc[_0xf995('0x9f')]=_['omit'](_0x4c8371,[_0xf995('0xa0')]);if(_0x4c8371[_0xf995('0xa0')][_0xf995('0x59')]){return _0x4c8371[_0xf995('0xa0')][0x0];}var _0x46a855=_[_0xf995('0x1a')](_0x27dacc[_0xf995('0x5c')],{'firstName':_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')],'ListId':_0x4c8371['id']});_0x46a855[_0x27dacc['body'][_0xf995('0x9d')]]=_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')];return db[_0xf995('0x79')][_0xf995('0x5b')](_0x46a855,{'fields':_0x5cfb18,'raw':!![]});}})['then'](handleEntityNotFound(_0x4be7c2,null))['then'](function(_0x12ec82){if(_0x12ec82){_0x27dacc[_0xf995('0xa1')]=_0x12ec82;var _0x55d99e={'ContactId':_0x12ec82['id'],'phone':_0x27dacc['body'][_0xf995('0x88')],'SmsAccountId':_0x5eb722[_0xf995('0x58')]['id']};var _0x128ab2={'ContactId':_0x12ec82['id'],'SmsAccountId':_0x5eb722[_0xf995('0x58')]['id'],'closed':![]};return db[_0xf995('0xa2')]['find']({'where':_0x128ab2})[_0xf995('0x36')](function(_0x32ac96){if(_0x32ac96){return[_0x32ac96,![]];}return db[_0xf995('0xa2')][_0xf995('0x5b')](_0x55d99e)['then'](function(_0xa2aeec){return[_0xa2aeec,!![]];});});}})['spread'](function(_0x35417b,_0x1caafb){_0x27dacc['interaction']=_0x35417b[_0xf995('0x38')]({'plain':!![]});_0x27dacc['interaction']['created']=![];if(_0x1caafb){if(_0x27dacc[_0xf995('0x73')][_0xf995('0xa3')]){_0x27dacc[_0xf995('0x74')][_0xf995('0xa4')]({'id':0x0,'priority':_0x27dacc['applications']['length']+0x1,'app':_0xf995('0xa5'),'appdata':'unmanaged','interval':_0xf995('0xa6')});}_0x27dacc['interaction']['created']=!![];}return db['SmsMessage'][_0xf995('0x5b')]({'phone':_0x27dacc[_0xf995('0x5c')][_0xf995('0x88')],'messageId':_0x27dacc['body'][_0xf995('0x8d')],'body':_0x27dacc[_0xf995('0x5c')][_0xf995('0x5c')],'SmsAccountId':_0x5eb722['params']['id'],'SmsInteractionId':_0x35417b['id'],'direction':'in','ContactId':_0x35417b[_0xf995('0xa7')],'AttachmentId':_0x27dacc[_0xf995('0x5c')][_0xf995('0xa8')]});})[_0xf995('0x36')](function(_0x4d1e84){_0x27dacc[_0xf995('0x27')]=_0x4d1e84;if(_0x27dacc[_0xf995('0xa9')]['UserId']){return db[_0xf995('0xaa')][_0xf995('0x5a')]({'attributes':['id',_0xf995('0x3c')],'where':{'id':_0x27dacc['interaction']['UserId']}})['then'](function(_0xbad117){if(_0xbad117){_0x27dacc[_0xf995('0x74')][_0xf995('0xab')]({'id':0x0,'priority':0x0,'app':_0xf995('0xac'),'appdata':_0xbad117[_0xf995('0x3c')]+','+(_0x27dacc['account'][_0xf995('0xad')]||0xa),'interval':_0xf995('0xa6')});}return respondWithRpcPromise(_0xf995('0xae'),_0xf995('0xaf'),_0x27dacc);});}return respondWithRpcPromise(_0xf995('0xae'),'startRouting',_0x27dacc);})[_0xf995('0x36')](function(_0x3fd78b){if(_0x3fd78b){var _0x3a4189=0xc8;var _0x538e01='receiveMessage';logger[_0xf995('0x21')](_0xf995('0xb0'),_0x538e01,_0x3a4189,'entity\x20found');logger[_0xf995('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x538e01,_0x3a4189,'entity\x20found',JSON[_0xf995('0x24')](_0x3fd78b));if(_0x27dacc[_0xf995('0x73')]['type']===_0xf995('0x83')){return _0x4be7c2['status'](_0x3a4189)[_0xf995('0x32')]('Content-Type',_0xf995('0xb1'))[_0xf995('0x3d')](_0xf995('0xb2'));}else{return _0x4be7c2[_0xf995('0x2d')](_0x3a4189)[_0xf995('0x2e')](_0x3fd78b);}}})[_0xf995('0x2a')](handleError(_0x4be7c2,null));};exports[_0xf995('0xb3')]=function(_0x2581b2,_0xbf585f,_0xf03ef5){return db['SmsAccount'][_0xf995('0x6d')]({'where':{'id':_0x2581b2[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0xbf585f,null))['then'](function(_0x13554e){if(_0x13554e){return db[_0xf995('0xb4')][_0xf995('0xb5')](function(_0x42e818){return db[_0xf995('0xb6')][_0xf995('0x37')]({'where':{'SmsAccountId':_0x2581b2['params']['id']},'transaction':_0x42e818})[_0xf995('0x36')](function(_0x1613e4){var _0x33c285=_[_0xf995('0x41')](_0x2581b2[_0xf995('0x5c')],function(_0x1141f2){_0x1141f2[_0xf995('0x64')]=_0x2581b2[_0xf995('0x58')]['id'];return _0x1141f2;});return db[_0xf995('0xb6')][_0xf995('0xb7')](_0x33c285,{'transaction':_0x42e818});});})['then'](function(){return db['SmsApplication'][_0xf995('0xb8')]({'where':{'SmsAccountId':_0x2581b2[_0xf995('0x58')]['id']},'order':_0xf995('0x77')});});}})[_0xf995('0x36')](respondWithResult(_0xbf585f,null))[_0xf995('0x2a')](handleError(_0xbf585f,null));};exports['getApplications']=function(_0x48cc7b,_0x307fe1,_0x5c690d){var _0x1d31d6={};var _0x1bc734={};var _0xe29b11;var _0x26e1da;return db[_0xf995('0x54')][_0xf995('0x6d')]({'where':{'id':_0x48cc7b[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x307fe1,null))[_0xf995('0x36')](function(_0x296da8){if(_0x296da8){_0xe29b11=_0x296da8;_0x1bc734[_0xf995('0x45')]=_[_0xf995('0x47')](db[_0xf995('0xb6')][_0xf995('0x42')]);_0x1bc734[_0xf995('0x46')]=_[_0xf995('0x47')](_0x48cc7b['query']);_0x1bc734['filters']=_[_0xf995('0x4a')](_0x1bc734[_0xf995('0x45')],_0x1bc734[_0xf995('0x46')]);_0x1d31d6[_0xf995('0x49')]=_[_0xf995('0x4a')](_0x1bc734['model'],qs['fields'](_0x48cc7b[_0xf995('0x46')][_0xf995('0x4b')]));_0x1d31d6[_0xf995('0x49')]=_0x1d31d6['attributes'][_0xf995('0x59')]?_0x1d31d6[_0xf995('0x49')]:_0x1bc734[_0xf995('0x45')];_0x1d31d6[_0xf995('0x6e')]=qs[_0xf995('0x4e')](_0x48cc7b[_0xf995('0x46')][_0xf995('0x4e')]);_0x1d31d6[_0xf995('0x4f')]=qs['filters'](_[_0xf995('0xb9')](_0x48cc7b[_0xf995('0x46')],_0x1bc734[_0xf995('0x48')]));if(_0x48cc7b[_0xf995('0x46')][_0xf995('0x50')]){_0x1d31d6[_0xf995('0x4f')]=_[_0xf995('0x51')](_0x1d31d6[_0xf995('0x4f')],{'$or':_['map'](_0x1d31d6[_0xf995('0x49')],function(_0x157de6){var _0x8ba40={};_0x8ba40[_0x157de6]={'$like':'%'+_0x48cc7b[_0xf995('0x46')]['filter']+'%'};return _0x8ba40;})});}_0x1d31d6=_[_0xf995('0x51')]({},_0x1d31d6,_0x48cc7b[_0xf995('0x53')]);return _0xe29b11[_0xf995('0xba')](_0x1d31d6);}})[_0xf995('0x36')](function(_0x19b83f){if(_0x19b83f){_0x26e1da=_0x19b83f[_0xf995('0x59')];if(!_0x48cc7b[_0xf995('0x46')]['hasOwnProperty']('nolimit')){_0x1d31d6[_0xf995('0x31')]=qs[_0xf995('0x31')](_0x48cc7b['query'][_0xf995('0x31')]);_0x1d31d6['offset']=qs[_0xf995('0x30')](_0x48cc7b[_0xf995('0x46')][_0xf995('0x30')]);}return _0xe29b11[_0xf995('0xba')](_0x1d31d6);}})[_0xf995('0x36')](function(_0x530b76){if(_0x530b76){return _0x530b76?{'count':_0x26e1da,'rows':_0x530b76}:null;}})[_0xf995('0x36')](respondWithResult(_0x307fe1,null))[_0xf995('0x2a')](handleError(_0x307fe1,null));};exports[_0xf995('0xbb')]=function(_0x1b2b1d,_0x4b4cbf,_0x215380){var _0x11c496={'raw':![],'where':{}};var _0x5f3a16={};var _0x5ce3f8={'count':0x0,'rows':[]};return db[_0xf995('0x54')]['findOne']({'where':{'id':_0x1b2b1d[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x4b4cbf,null))[_0xf995('0x36')](function(_0x314e2a){if(_0x314e2a){_0x5f3a16[_0xf995('0x45')]=_[_0xf995('0x47')](db[_0xf995('0xa2')][_0xf995('0x42')]);_0x5f3a16[_0xf995('0x46')]=_['keys'](_0x1b2b1d['query']);_0x5f3a16[_0xf995('0x48')]=_['intersection'](_0x5f3a16[_0xf995('0x45')],_0x5f3a16[_0xf995('0x46')]);_0x11c496[_0xf995('0x49')]=_[_0xf995('0x4a')](_0x5f3a16[_0xf995('0x45')],qs[_0xf995('0x4b')](_0x1b2b1d['query']['fields']));_0x11c496[_0xf995('0x49')]=_0x11c496['attributes']['length']?_0x11c496[_0xf995('0x49')]:_0x5f3a16[_0xf995('0x45')];if(!_0x1b2b1d[_0xf995('0x46')][_0xf995('0x4c')]('nolimit')){_0x11c496['limit']=qs[_0xf995('0x31')](_0x1b2b1d[_0xf995('0x46')][_0xf995('0x31')]);_0x11c496['offset']=qs['offset'](_0x1b2b1d[_0xf995('0x46')][_0xf995('0x30')]);}_0x11c496[_0xf995('0x6e')]=qs['sort'](_0x1b2b1d[_0xf995('0x46')][_0xf995('0x4e')]);_0x11c496[_0xf995('0x4f')]=qs[_0xf995('0x48')](_[_0xf995('0xb9')](_0x1b2b1d[_0xf995('0x46')],_0x5f3a16['filters']));_0x11c496[_0xf995('0x4f')][_0xf995('0x64')]=_0x314e2a['id'];if(_0x1b2b1d['query'][_0xf995('0x50')]){_0x11c496[_0xf995('0x4f')]=_['merge'](_0x11c496[_0xf995('0x4f')],{'$or':_[_0xf995('0x41')](_0x11c496[_0xf995('0x49')],function(_0x1fb901){var _0x302cca={};_0x302cca[_0x1fb901]={'$like':'%'+_0x1b2b1d['query'][_0xf995('0x50')]+'%'};return _0x302cca;})});}_0x11c496=_[_0xf995('0x51')]({},_0x11c496,_0x1b2b1d[_0xf995('0x53')]);return db[_0xf995('0xa2')]['count']({'where':_0x11c496[_0xf995('0x4f')]})['then'](function(_0x1aa1a6){_0x5ce3f8[_0xf995('0x2f')]=_0x1aa1a6;if(_0x1b2b1d['query']['includeAll']){_0x11c496['include']=[{'model':db[_0xf995('0x79')],'as':'Contact','required':![]},{'model':db[_0xf995('0xaa')],'as':_0xf995('0xbc'),'attributes':[_0xf995('0x3c'),_0xf995('0xbd'),'internal'],'required':![]},{'model':db[_0xf995('0xbe')],'as':_0xf995('0xbf'),'attributes':['id',_0xf995('0x3c'),_0xf995('0xc0')],'where':_0x1b2b1d[_0xf995('0x46')][_0xf995('0xc1')]?{'id':_0x1b2b1d['query']['tag']}:undefined,'required':_0x1b2b1d[_0xf995('0x46')]['tag']?!![]:![]}];}return db[_0xf995('0xa2')][_0xf995('0x67')](_0x11c496);})[_0xf995('0x36')](function(_0x1f9176){_0x5ce3f8[_0xf995('0x68')]=_0x1f9176;return _0x5ce3f8;});}})[_0xf995('0x36')](respondWithFilteredResult(_0x4b4cbf,_0x11c496))['catch'](handleError(_0x4b4cbf,null));};exports[_0xf995('0x3d')]=function(_0x583783,_0x695420,_0x50df5d){var _0x4037da,_0x14fc3d,_0x5d7bc1;if(_['isNil'](_0x583783[_0xf995('0x5c')][_0xf995('0x5c')])||_0x583783[_0xf995('0x5c')][_0xf995('0x5c')]===''){throw new db[(_0xf995('0x7a'))]['ValidationError'](_0xf995('0x9b'));}if(_['isNil'](_0x583783[_0xf995('0x5c')]['to'])){throw new db[(_0xf995('0x7a'))][(_0xf995('0x7b'))](_0xf995('0xc2'));}_0x4037da=_0x583783[_0xf995('0x5c')]['to'];return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x583783[_0xf995('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xf995('0x79')],'as':_0xf995('0xa0'),'where':{'mobile':_0x4037da},'limit':0x1,'order':[[_0xf995('0x7f'),_0xf995('0x9e')]]}]}]})[_0xf995('0x36')](handleEntityNotFound(_0x695420,null))[_0xf995('0x36')](function(_0x394989){if(_0x394989&&_0x394989[_0xf995('0xc3')]){_0x14fc3d=_0x394989[_0xf995('0x38')]({'plain':!![]});if(_0x14fc3d[_0xf995('0xc3')]&&_0x14fc3d[_0xf995('0xc3')][_0xf995('0xa0')][_0xf995('0x59')]){return _0x14fc3d[_0xf995('0xc3')]['Contacts'][0x0];}return db[_0xf995('0x79')][_0xf995('0x5b')](_[_0xf995('0x1a')](_0x583783[_0xf995('0x5c')],{'firstName':_0x4037da,'mobile':_0x4037da,'phone':_0x4037da,'ListId':_0x14fc3d['ListId']}));}})[_0xf995('0x36')](handleEntityNotFound(_0x695420,null))[_0xf995('0x36')](function(_0x80c7a1){if(_0x80c7a1){_0x5d7bc1=_0x80c7a1;return db[_0xf995('0xa2')][_0xf995('0x5a')]({'where':{'ContactId':_0x5d7bc1['id'],'closed':![],'SmsAccountId':_0x14fc3d['id']}})[_0xf995('0x36')](function(_0x118708){if(_0x118708){return[_0x118708,![]];}return db[_0xf995('0xa2')]['create']({'UserId':_0x583783[_0xf995('0x5f')]['id'],'ContactId':_0x5d7bc1['id'],'SmsAccountId':_0x14fc3d['id'],'phone':_0x4037da,'firstMsgDirection':_0xf995('0xc4'),'Messages':[_['merge'](_0x583783[_0xf995('0x5c')],{'read':![],'body':_0x583783['body'][_0xf995('0x5c')],'phone':_0x4037da,'SmsAccountId':_0x14fc3d['id'],'UserId':_0x583783['user']['id'],'ContactId':_0x5d7bc1['id']})]},{'include':[{'model':db[_0xf995('0xc5')],'as':_0xf995('0xc6')}]})[_0xf995('0x36')](function(_0xf19884){return[_0xf19884,!![]];});});}})[_0xf995('0xc7')](function(_0x29077a,_0x216069){if(_0x216069){return _0x29077a;}return db[_0xf995('0xc5')][_0xf995('0x5b')](_[_0xf995('0x51')](_0x583783[_0xf995('0x5c')],{'read':![],'body':_0x583783['body'][_0xf995('0x5c')],'phone':_0x4037da,'SmsAccountId':_0x14fc3d['id'],'SmsInteractionId':_0x29077a['id'],'UserId':_0x583783['user']['id'],'ContactId':_0x5d7bc1['id']}))[_0xf995('0x36')](function(_0xcf39f4){_0x29077a[_0xf995('0xc8')][_0xf995('0xc6')]=[];_0x29077a[_0xf995('0xc8')][_0xf995('0xc6')][_0xf995('0xa4')](_0xcf39f4[_0xf995('0xc8')]);return _0x29077a;});})['then'](respondWithResult(_0x695420,null))[_0xf995('0x2a')](handleError(_0x695420,null));};exports[_0xf995('0x2d')]=function(_0x2870dc,_0x438bad,_0x547762){if(_0x2870dc[_0xf995('0x5c')]['id']){delete _0x2870dc['body']['id'];}var _0x228f78,_0x4e2f42,_0x3dea6b;return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x2870dc[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x438bad,null))['then'](function(_0x448c1c){if(_0x448c1c){_0x3dea6b=_0x448c1c;logger['debug'](_0xf995('0xb0'),'status',_0xf995('0xc9'),_0x448c1c[_0xf995('0x43')],util[_0xf995('0xca')](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));switch(_0x448c1c['type']){case _0xf995('0x87'):if(_0x2870dc[_0xf995('0x5c')][_0xf995('0xcb')]&&_0x2870dc['body'][_0xf995('0x2d')]){_0x4e2f42=_0x2870dc[_0xf995('0x5c')]['status'];return db[_0xf995('0xc5')][_0xf995('0x5a')]({'where':{'messageId':_0x2870dc[_0xf995('0x5c')][_0xf995('0xcb')]}});}break;case'connectel':if(_0x2870dc['body'][_0xf995('0xcc')]&&_0x2870dc[_0xf995('0x5c')][_0xf995('0xcd')]){_0x4e2f42=_0x2870dc['body'][_0xf995('0xcd')];return db['SmsMessage']['find']({'where':{'messageId':_0x2870dc['body']['requestid']}});}break;case _0xf995('0x8c'):if(_0x2870dc[_0xf995('0x5c')][_0xf995('0x8e')]&&_0x2870dc[_0xf995('0x5c')]['status_code']){_0x4e2f42=_0x2870dc['body'][_0xf995('0xce')];return db['SmsMessage'][_0xf995('0x5a')]({'where':{'messageId':_0x2870dc[_0xf995('0x5c')][_0xf995('0x8e')]}});}break;case _0xf995('0xcf'):var _0x68d528=_0x2870dc[_0xf995('0x5c')][_0xf995('0x92')][0x0];if(_0x68d528[_0xf995('0x8d')]&&_0x68d528[_0xf995('0x2d')][_0xf995('0xd0')]===_0xf995('0xd1')){_0x4e2f42=_0x68d528['status'][_0xf995('0xd0')];return db[_0xf995('0xc5')][_0xf995('0x5a')]({'where':{'messageId':_0x68d528[_0xf995('0x8d')]}});}break;case'clickatell':if(_0x2870dc[_0xf995('0x5c')][_0xf995('0x8d')]&&_0x2870dc[_0xf995('0x5c')][_0xf995('0x2d')]){_0x4e2f42=_0x2870dc[_0xf995('0x5c')][_0xf995('0x2d')];return db[_0xf995('0xc5')]['find']({'where':{'messageId':_0x2870dc[_0xf995('0x5c')][_0xf995('0x8d')]}});}break;case'bandwidth':if(_0x2870dc[_0xf995('0x5c')][0x0][_0xf995('0x27')]['id']){_0x4e2f42=_0x2870dc[_0xf995('0x5c')][0x0][_0xf995('0x43')];return db[_0xf995('0xc5')]['find']({'where':{'messageId':_0x2870dc[_0xf995('0x5c')][0x0][_0xf995('0x27')]['id']}});}break;case _0xf995('0x99'):if(_0x2870dc[_0xf995('0x5c')][_0xf995('0xd2')]&&_0x2870dc[_0xf995('0x5c')][_0xf995('0x2d')]){_0x4e2f42=_0x2870dc[_0xf995('0x5c')][_0xf995('0x2d')];return db[_0xf995('0xc5')][_0xf995('0x5a')]({'where':{'messageId':_0x2870dc[_0xf995('0x5c')][_0xf995('0xd2')]}});}break;}}})[_0xf995('0x36')](handleEntityNotFound(_0x438bad,null))[_0xf995('0x36')](function(_0x7fea51){if(_0x7fea51){_0x228f78=_0x7fea51;switch(_0x3dea6b[_0xf995('0x43')]){case _0xf995('0x87'):if(_0x4e2f42==='DELIVERED'){return _0x228f78[_0xf995('0x35')]({'read':!![]});}else{logger[_0xf995('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf995('0x87'),util[_0xf995('0xca')](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4e2f42==='1'){return _0x228f78[_0xf995('0x35')]({'read':!![]});}else{logger[_0xf995('0x25')](_0xf995('0xb0'),_0xf995('0x2d'),_0xf995('0x87'),util[_0xf995('0xca')](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xf995('0x8c'):if(!_0x2870dc[_0xf995('0x5c')][_0xf995('0xd3')]&&_0x4e2f42>=0xc8&&_0x4e2f42<=0xce){return _0x228f78['update']({'read':!![]});}else{logger[_0xf995('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf995('0x2d'),_0xf995('0x8c'),util[_0xf995('0xca')](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xf995('0xcf'):var _0x2b187a=_0x2870dc[_0xf995('0x5c')]['results'][0x0];if(_0x2b187a[_0xf995('0x2d')][_0xf995('0xd0')]===_0xf995('0xd1')){return _0x228f78[_0xf995('0x35')]({'read':!![]});}else{logger[_0xf995('0x25')](_0xf995('0xb0'),'status',_0xf995('0xcf'),util[_0xf995('0xca')](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xf995('0x96'):if(_0x4e2f42=='DELIVERED_TO_GATEWAY'||_0x4e2f42==_0xf995('0xd4')){return _0x228f78[_0xf995('0x35')]({'read':!![]});}else{logger[_0xf995('0x25')](_0xf995('0xb0'),_0xf995('0x2d'),'clickatell',util['inspect'](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xf995('0x98'):if(_0x4e2f42=='message-delivered'){return _0x228f78[_0xf995('0x35')]({'read':!![]});}else{logger[_0xf995('0x25')](_0xf995('0xb0'),_0xf995('0x2d'),'bandwidth',util[_0xf995('0xca')](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xf995('0x99'):if(_0x4e2f42==='DELIVRD'||_0x4e2f42===_0xf995('0xd5')){return _0x228f78['update']({'read':!![]});}else{logger[_0xf995('0x25')](_0xf995('0xb0'),_0xf995('0x2d'),_0xf995('0x99'),util['inspect'](_0x2870dc[_0xf995('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x228f78;}})['then'](respondWithResult(_0x438bad,null))[_0xf995('0x2a')](handleError(_0x438bad,null));};exports[_0xf995('0xd6')]=function(_0x3bf309,_0x55fd08,_0x29e1cd){var _0x337632,_0x5a0a01,_0x247f16;return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x3bf309[_0xf995('0x58')]['id']}})['then'](handleEntityNotFound(_0x55fd08,null))[_0xf995('0x36')](function(_0x504a29){if(_0x504a29){_0x247f16=_0x504a29;logger[_0xf995('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf995('0x2d'),'received\x20delivery\x20report\x20from',_0x504a29[_0xf995('0x43')],util[_0xf995('0xca')](_0x3bf309[_0xf995('0x46')],{'showHidden':![],'depth':null}));switch(_0x504a29['type']){case _0xf995('0x93'):if(_0x3bf309[_0xf995('0x46')][_0xf995('0xd7')]&&_0x3bf309[_0xf995('0x46')]['state']){_0x5a0a01=_0x3bf309[_0xf995('0x46')]['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x3bf309[_0xf995('0x46')][_0xf995('0xd7')]}});}break;}}})[_0xf995('0x36')](handleEntityNotFound(_0x55fd08,null))[_0xf995('0x36')](function(_0x49c9c0){if(_0x49c9c0){_0x337632=_0x49c9c0;switch(_0x247f16['type']){case'csc':if(_0x5a0a01==='2'||_0x5a0a01==='6'){return _0x337632[_0xf995('0x35')]({'read':!![]});}else{logger['error'](_0xf995('0xb0'),_0xf995('0x2d'),_0xf995('0x93'),util[_0xf995('0xca')](_0x3bf309['query'],{'showHidden':![],'depth':null}));};break;}return _0x337632;}})['then'](respondWithResult(_0x55fd08,null))[_0xf995('0x2a')](handleError(_0x55fd08,null));};exports['addAgents']=function(_0x37cbe0,_0x5eb121,_0x4afd06){return db[_0xf995('0x54')][_0xf995('0x5a')]({'where':{'id':_0x37cbe0[_0xf995('0x58')]['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x5eb121,null))[_0xf995('0x36')](function(_0x539ff4){if(_0x539ff4){return _0x539ff4[_0xf995('0xd8')](_0x37cbe0[_0xf995('0x5c')][_0xf995('0x6a')],_[_0xf995('0xd9')](_0x37cbe0[_0xf995('0x5c')],[_0xf995('0x6a'),'id'])||{})[_0xf995('0xc7')](function(_0x1cb642){for(var _0x35ba17=0x0;_0x35ba17<_0x37cbe0[_0xf995('0x5c')][_0xf995('0x6a')]['length'];_0x35ba17+=0x1){socket[_0xf995('0xda')](_0xf995('0xdb'),{'UserId':_0x37cbe0[_0xf995('0x5c')][_0xf995('0x6a')][_0x35ba17],'SmsAccountId':_0x37cbe0[_0xf995('0x58')]['id']});}return _0x1cb642;});}})[_0xf995('0x36')](respondWithResult(_0x5eb121,null))[_0xf995('0x2a')](handleError(_0x5eb121,null));};exports[_0xf995('0xdc')]=function(_0x4b83e5,_0x5061a4,_0x18c4b6){return db[_0xf995('0x54')]['find']({'where':{'id':_0x4b83e5[_0xf995('0x58')]['id']}})['then'](handleEntityNotFound(_0x5061a4,null))[_0xf995('0x36')](function(_0x4df4d7){if(_0x4df4d7){return _0x4df4d7[_0xf995('0xdc')](_0x4b83e5['query']['ids'])['then'](function(){if(_[_0xf995('0xdd')](_0x4b83e5[_0xf995('0x46')][_0xf995('0x6a')])){for(var _0x13a899=0x0;_0x13a899<_0x4b83e5[_0xf995('0x46')][_0xf995('0x6a')][_0xf995('0x59')];_0x13a899+=0x1){socket['emit'](_0xf995('0xde'),{'UserId':Number(_0x4b83e5[_0xf995('0x46')][_0xf995('0x6a')][_0x13a899]),'SmsAccountId':Number(_0x4b83e5['params']['id'])});}}else{socket[_0xf995('0xda')](_0xf995('0xde'),{'UserId':Number(_0x4b83e5[_0xf995('0x46')]['ids']),'SmsAccountId':Number(_0x4b83e5[_0xf995('0x58')]['id'])});}});}})[_0xf995('0x36')](respondWithStatusCode(_0x5061a4,null))[_0xf995('0x2a')](handleError(_0x5061a4,null));};exports[_0xf995('0xdf')]=function(_0x1e0081,_0x19b66c,_0x5e5ecd){var _0x33de8c={};var _0x11ede0={};var _0x43ec1a;var _0x515a9d;return db[_0xf995('0x54')][_0xf995('0x6d')]({'where':{'id':_0x1e0081['params']['id']}})[_0xf995('0x36')](handleEntityNotFound(_0x19b66c,null))[_0xf995('0x36')](function(_0x22798a){if(_0x22798a){_0x43ec1a=_0x22798a;_0x11ede0[_0xf995('0x45')]=_[_0xf995('0x47')](db['User']['rawAttributes']);_0x11ede0[_0xf995('0x46')]=_[_0xf995('0x47')](_0x1e0081[_0xf995('0x46')]);_0x11ede0[_0xf995('0x48')]=_[_0xf995('0x4a')](_0x11ede0[_0xf995('0x45')],_0x11ede0[_0xf995('0x46')]);_0x33de8c['attributes']=_[_0xf995('0x4a')](_0x11ede0[_0xf995('0x45')],qs[_0xf995('0x4b')](_0x1e0081[_0xf995('0x46')]['fields']));_0x33de8c[_0xf995('0x49')]=_0x33de8c[_0xf995('0x49')]['length']?_0x33de8c[_0xf995('0x49')]:_0x11ede0[_0xf995('0x45')];_0x33de8c[_0xf995('0x6e')]=qs[_0xf995('0x4e')](_0x1e0081[_0xf995('0x46')][_0xf995('0x4e')]);_0x33de8c['where']=qs[_0xf995('0x48')](_['pick'](_0x1e0081[_0xf995('0x46')],_0x11ede0[_0xf995('0x48')]));if(_0x1e0081[_0xf995('0x46')]['filter']){_0x33de8c['where']=_[_0xf995('0x51')](_0x33de8c[_0xf995('0x4f')],{'$or':_[_0xf995('0x41')](_0x33de8c[_0xf995('0x49')],function(_0x9cc9f9){var _0x24e562={};_0x24e562[_0x9cc9f9]={'$like':'%'+_0x1e0081['query'][_0xf995('0x50')]+'%'};return _0x24e562;})});}_0x33de8c=_[_0xf995('0x51')]({},_0x33de8c,_0x1e0081[_0xf995('0x53')]);return _0x43ec1a[_0xf995('0xdf')](_0x33de8c);}})['then'](function(_0x62921c){if(_0x62921c){_0x515a9d=_0x62921c[_0xf995('0x59')];if(!_0x1e0081['query'][_0xf995('0x4c')](_0xf995('0x4d'))){_0x33de8c[_0xf995('0x31')]=qs[_0xf995('0x31')](_0x1e0081['query'][_0xf995('0x31')]);_0x33de8c['offset']=qs['offset'](_0x1e0081[_0xf995('0x46')][_0xf995('0x30')]);}return _0x43ec1a['getAgents'](_0x33de8c);}})[_0xf995('0x36')](function(_0x1a73cc){if(_0x1a73cc){return _0x1a73cc?{'count':_0x515a9d,'rows':_0x1a73cc}:null;}})[_0xf995('0x36')](respondWithResult(_0x19b66c,null))['catch'](handleError(_0x19b66c,null));}; \ No newline at end of file +var _0x5e06=['ACCEPTD','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','redis','./smsAccount.socket','register','jayson/promise','client','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','end','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','keys','length','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','text','connectel','clicksend','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','info','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','sequelize','transaction','bulkCreate','getApplications','rawAttributes','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','spread','dataValues','inspect','skebby_dispatch_id','statusInt','requestid','message_id','status_code','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD'];(function(_0x2e547c,_0x43447d){var _0xf313f0=function(_0x2e5e2e){while(--_0x2e5e2e){_0x2e547c['push'](_0x2e547c['shift']());}};_0xf313f0(++_0x43447d);}(_0x5e06,0xf2));var _0x65e0=function(_0x3c5368,_0x33ddb0){_0x3c5368=_0x3c5368-0x0;var _0x53b77a=_0x5e06[_0x3c5368];return _0x53b77a;};'use strict';var pdf=require(_0x65e0('0x0'));var emlformat=require(_0x65e0('0x1'));var rimraf=require(_0x65e0('0x2'));var zipdir=require(_0x65e0('0x3'));var jsonpatch=require(_0x65e0('0x4'));var rp=require(_0x65e0('0x5'));var moment=require(_0x65e0('0x6'));var BPromise=require(_0x65e0('0x7'));var Mustache=require(_0x65e0('0x8'));var util=require('util');var path=require(_0x65e0('0x9'));var sox=require('sox');var csv=require(_0x65e0('0xa'));var ejs=require(_0x65e0('0xb'));var fs=require('fs');var _=require(_0x65e0('0xc'));var squel=require(_0x65e0('0xd'));var crypto=require(_0x65e0('0xe'));var jsforce=require(_0x65e0('0xf'));var deskjs=require(_0x65e0('0x10'));var toCsv=require(_0x65e0('0xa'));var querystring=require(_0x65e0('0x11'));var Papa=require('papaparse');var Redis=require(_0x65e0('0x12'));var authService=require(_0x65e0('0x13'));var qs=require(_0x65e0('0x14'));var as=require(_0x65e0('0x15'));var hardwareService=require(_0x65e0('0x16'));var logger=require(_0x65e0('0x17'))(_0x65e0('0x18'));var utils=require(_0x65e0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x65e0('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x65e0('0x1b')](config['redis'],{'host':_0x65e0('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65e0('0x1d')]));require(_0x65e0('0x1e'))[_0x65e0('0x1f')](socket);var jayson=require(_0x65e0('0x20'));var client=jayson[_0x65e0('0x21')][_0x65e0('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x28b157,_0x5c7620,_0x4f2972,_0x2d7fae){return new BPromise(function(_0x394659,_0xb9323b){var _0x3bd2fa=_0x2d7fae||client;return _0x3bd2fa[_0x65e0('0x23')](_0x28b157,_0x4f2972)['then'](function(_0x3f3a5a){logger['info'](_0x65e0('0x24'),_0x5c7620,_0x65e0('0x25'));logger[_0x65e0('0x26')](_0x65e0('0x27'),_0x5c7620,_0x65e0('0x25'),JSON['stringify'](_0x3f3a5a));if(_0x3f3a5a[_0x65e0('0x28')]){if(_0x3f3a5a[_0x65e0('0x28')][_0x65e0('0x29')]===0x1f4){logger[_0x65e0('0x28')](_0x65e0('0x24'),_0x5c7620,_0x3f3a5a[_0x65e0('0x28')][_0x65e0('0x2a')]);return _0xb9323b(_0x3f3a5a[_0x65e0('0x28')][_0x65e0('0x2a')]);}logger[_0x65e0('0x28')](_0x65e0('0x24'),_0x5c7620,_0x3f3a5a[_0x65e0('0x28')][_0x65e0('0x2a')]);return _0x394659(_0x3f3a5a[_0x65e0('0x28')][_0x65e0('0x2a')]);}else{logger['info'](_0x65e0('0x24'),_0x5c7620,_0x65e0('0x25'));_0x394659(_0x3f3a5a[_0x65e0('0x2b')][_0x65e0('0x2a')]);}})[_0x65e0('0x2c')](function(_0xc733de){logger[_0x65e0('0x28')](_0x65e0('0x24'),_0x5c7620,_0xc733de);_0xb9323b(_0xc733de);});});}function respondWithStatusCode(_0x56ae3e,_0x5ec581){_0x5ec581=_0x5ec581||0xcc;return function(_0x281e60){if(_0x281e60){return _0x56ae3e[_0x65e0('0x2d')](_0x5ec581);}return _0x56ae3e[_0x65e0('0x2e')](_0x5ec581)['end']();};}function respondWithResult(_0xbe2afd,_0x3f29be){_0x3f29be=_0x3f29be||0xc8;return function(_0x205c9a){if(_0x205c9a){return _0xbe2afd[_0x65e0('0x2e')](_0x3f29be)[_0x65e0('0x2f')](_0x205c9a);}};}function respondWithFilteredResult(_0x1838e7,_0x3563f7){return function(_0x1d7b22){if(_0x1d7b22){var _0x2035c0=_0x1d7b22[_0x65e0('0x30')],_0x5ec2d9=_0x3563f7[_0x65e0('0x31')],_0x2937bd=_0x3563f7[_0x65e0('0x31')]+_0x3563f7[_0x65e0('0x32')],_0x2b7020;if(_0x2937bd>=_0x2035c0){_0x2937bd=_0x2035c0;_0x2b7020=0xc8;}else{_0x2b7020=0xce;}_0x1838e7[_0x65e0('0x2e')](_0x2b7020);return _0x1838e7['set'](_0x65e0('0x33'),_0x5ec2d9+'-'+_0x2937bd+'/'+_0x2035c0)[_0x65e0('0x2f')](_0x1d7b22);}return null;};}function patchUpdates(_0x5e9305){return function(_0x1e73c4){try{jsonpatch['apply'](_0x1e73c4,_0x5e9305,!![]);}catch(_0x57116a){return BPromise[_0x65e0('0x34')](_0x57116a);}return _0x1e73c4[_0x65e0('0x35')]();};}function saveUpdates(_0x515b5a,_0x335c9b){return function(_0x5eebdd){if(_0x5eebdd){return _0x5eebdd['update'](_0x515b5a)[_0x65e0('0x36')](function(_0x5414ac){return _0x5414ac;});}return null;};}function removeEntity(_0x3f610f,_0x537ff1){return function(_0x3afe32){if(_0x3afe32){return _0x3afe32[_0x65e0('0x37')]()[_0x65e0('0x36')](function(){var _0x7972ed=_0x3afe32['get']({'plain':!![]});var _0x3e303b='SmsAccounts';return db['UserProfileResource'][_0x65e0('0x37')]({'where':{'type':_0x3e303b,'resourceId':_0x7972ed['id']}})[_0x65e0('0x36')](function(){return _0x3afe32;});})[_0x65e0('0x36')](function(){_0x3f610f[_0x65e0('0x2e')](0xcc)[_0x65e0('0x38')]();});}};}function handleEntityNotFound(_0x2c2021,_0x2392a0){return function(_0x3554b3){if(!_0x3554b3){_0x2c2021['sendStatus'](0x194);}return _0x3554b3;};}function handleError(_0x67b7ba,_0x1e2484){_0x1e2484=_0x1e2484||0x1f4;return function(_0x2c2b1c){logger['error'](_0x2c2b1c[_0x65e0('0x39')]);if(_0x2c2b1c[_0x65e0('0x3a')]){delete _0x2c2b1c[_0x65e0('0x3a')];}_0x67b7ba[_0x65e0('0x2e')](_0x1e2484)[_0x65e0('0x3b')](_0x2c2b1c);};}exports['index']=function(_0x4a86a3,_0x15eda5){var _0x4c7214={'include':[{'model':db[_0x65e0('0x3c')],'as':_0x65e0('0x3d')}]},_0x29127f={},_0x13e54c={'count':0x0,'rows':[]};var _0x3b8d1a=_[_0x65e0('0x3e')](db[_0x65e0('0x3f')]['rawAttributes'],function(_0x508bb4){return{'name':_0x508bb4[_0x65e0('0x40')],'type':_0x508bb4[_0x65e0('0x41')]['key']};});_0x29127f[_0x65e0('0x42')]=_[_0x65e0('0x3e')](_0x3b8d1a,'name');_0x29127f[_0x65e0('0x43')]=_['keys'](_0x4a86a3[_0x65e0('0x43')]);_0x29127f[_0x65e0('0x44')]=_[_0x65e0('0x45')](_0x29127f[_0x65e0('0x42')],_0x29127f[_0x65e0('0x43')]);_0x4c7214[_0x65e0('0x46')]=_[_0x65e0('0x45')](_0x29127f[_0x65e0('0x42')],qs['fields'](_0x4a86a3[_0x65e0('0x43')][_0x65e0('0x47')]));_0x4c7214[_0x65e0('0x46')]=_0x4c7214[_0x65e0('0x46')]['length']?_0x4c7214[_0x65e0('0x46')]:_0x29127f[_0x65e0('0x42')];if(!_0x4a86a3['query'][_0x65e0('0x48')](_0x65e0('0x49'))){_0x4c7214[_0x65e0('0x32')]=qs['limit'](_0x4a86a3[_0x65e0('0x43')]['limit']);_0x4c7214[_0x65e0('0x31')]=qs[_0x65e0('0x31')](_0x4a86a3[_0x65e0('0x43')]['offset']);}_0x4c7214[_0x65e0('0x4a')]=qs[_0x65e0('0x4b')](_0x4a86a3[_0x65e0('0x43')][_0x65e0('0x4b')]);_0x4c7214['where']=qs['filters'](_[_0x65e0('0x4c')](_0x4a86a3[_0x65e0('0x43')],_0x29127f[_0x65e0('0x44')]),_0x3b8d1a);if(_0x4a86a3[_0x65e0('0x43')][_0x65e0('0x4d')]){_0x4c7214[_0x65e0('0x4e')]=_[_0x65e0('0x4f')](_0x4c7214[_0x65e0('0x4e')],{'$or':_['map'](_0x3b8d1a,function(_0x42a600){if(_0x42a600['type']!==_0x65e0('0x50')){var _0x171e1a={};_0x171e1a[_0x42a600[_0x65e0('0x3a')]]={'$like':'%'+_0x4a86a3[_0x65e0('0x43')][_0x65e0('0x4d')]+'%'};return _0x171e1a;}})});}_0x4c7214=_[_0x65e0('0x4f')]({},_0x4c7214,_0x4a86a3[_0x65e0('0x51')]);var _0x1729bd={'where':_0x4c7214['where']};return db[_0x65e0('0x3f')][_0x65e0('0x30')](_0x1729bd)[_0x65e0('0x36')](function(_0x132e9f){_0x13e54c['count']=_0x132e9f;if(_0x4a86a3[_0x65e0('0x43')][_0x65e0('0x52')]){_0x4c7214['include']=[{'all':!![]}];}return db[_0x65e0('0x3f')]['findAll'](_0x4c7214);})[_0x65e0('0x36')](function(_0x4ded19){_0x13e54c[_0x65e0('0x53')]=_0x4ded19;return _0x13e54c;})['then'](respondWithFilteredResult(_0x15eda5,_0x4c7214))[_0x65e0('0x2c')](handleError(_0x15eda5,null));};exports[_0x65e0('0x54')]=function(_0x49d522,_0x32cea6){var _0x2e72fe={'raw':![],'where':{'id':_0x49d522[_0x65e0('0x55')]['id']},'include':[{'model':db[_0x65e0('0x3c')],'as':_0x65e0('0x3d')}]},_0x52de34={};_0x52de34[_0x65e0('0x42')]=_[_0x65e0('0x56')](db[_0x65e0('0x3f')]['rawAttributes']);_0x52de34['query']=_[_0x65e0('0x56')](_0x49d522[_0x65e0('0x43')]);_0x52de34['filters']=_[_0x65e0('0x45')](_0x52de34['model'],_0x52de34[_0x65e0('0x43')]);_0x2e72fe[_0x65e0('0x46')]=_[_0x65e0('0x45')](_0x52de34[_0x65e0('0x42')],qs[_0x65e0('0x47')](_0x49d522[_0x65e0('0x43')][_0x65e0('0x47')]));_0x2e72fe['attributes']=_0x2e72fe['attributes'][_0x65e0('0x57')]?_0x2e72fe['attributes']:_0x52de34[_0x65e0('0x42')];if(_0x49d522['query'][_0x65e0('0x52')]){_0x2e72fe[_0x65e0('0x58')]=[{'all':!![]}];}_0x2e72fe=_[_0x65e0('0x4f')]({},_0x2e72fe,_0x49d522['options']);return db[_0x65e0('0x3f')]['find'](_0x2e72fe)[_0x65e0('0x36')](handleEntityNotFound(_0x32cea6,null))[_0x65e0('0x36')](respondWithResult(_0x32cea6,null))[_0x65e0('0x2c')](handleError(_0x32cea6,null));};exports[_0x65e0('0x59')]=function(_0x4ddd9f,_0x3e0dfc){return db[_0x65e0('0x3f')][_0x65e0('0x59')](_0x4ddd9f[_0x65e0('0x5a')],{})[_0x65e0('0x36')](function(_0x372232){var _0x3ea847=_0x4ddd9f[_0x65e0('0x5b')][_0x65e0('0x5c')]({'plain':!![]});if(!_0x3ea847)throw new Error(_0x65e0('0x5d'));if(_0x3ea847[_0x65e0('0x5e')]===_0x65e0('0x5b')){var _0x329caa=_0x372232['get']({'plain':!![]});var _0x34f0aa='SmsAccounts';return db[_0x65e0('0x5f')][_0x65e0('0x60')]({'where':{'name':_0x34f0aa,'userProfileId':_0x3ea847[_0x65e0('0x61')]},'raw':!![]})[_0x65e0('0x36')](function(_0x24a75a){if(_0x24a75a&&_0x24a75a[_0x65e0('0x62')]===0x0){return db[_0x65e0('0x63')][_0x65e0('0x59')]({'name':_0x329caa[_0x65e0('0x3a')],'resourceId':_0x329caa['id'],'type':_0x24a75a['name'],'sectionId':_0x24a75a['id']},{})[_0x65e0('0x36')](function(){return _0x372232;});}else{return _0x372232;}})[_0x65e0('0x2c')](function(_0x4fa64f){logger[_0x65e0('0x28')](_0x65e0('0x64'),_0x4fa64f);throw _0x4fa64f;});}return _0x372232;})[_0x65e0('0x36')](respondWithResult(_0x3e0dfc,0xc9))[_0x65e0('0x2c')](handleError(_0x3e0dfc,null));};exports[_0x65e0('0x65')]=function(_0x3bd416,_0xee513b){if(_0x3bd416[_0x65e0('0x5a')]['id']){delete _0x3bd416[_0x65e0('0x5a')]['id'];}return db[_0x65e0('0x3f')][_0x65e0('0x60')]({'where':{'id':_0x3bd416[_0x65e0('0x55')]['id']},'include':[{'model':db[_0x65e0('0x3c')],'as':_0x65e0('0x3d')}]})[_0x65e0('0x36')](handleEntityNotFound(_0xee513b,null))['then'](saveUpdates(_0x3bd416[_0x65e0('0x5a')],null))['then'](respondWithResult(_0xee513b,null))[_0x65e0('0x2c')](handleError(_0xee513b,null));};exports[_0x65e0('0x37')]=function(_0x7986e,_0x20d32d){return db[_0x65e0('0x3f')]['find']({'where':{'id':_0x7986e[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x20d32d,null))[_0x65e0('0x36')](removeEntity(_0x20d32d,null))[_0x65e0('0x2c')](handleError(_0x20d32d,null));};exports[_0x65e0('0x66')]=function(_0x2650c8,_0x27078c){return db[_0x65e0('0x3f')][_0x65e0('0x66')]()[_0x65e0('0x36')](respondWithResult(_0x27078c,null))[_0x65e0('0x2c')](handleError(_0x27078c,null));};exports[_0x65e0('0x67')]=function(_0xa8fb3d,_0x440e4a,_0x40ed8b){if(_0xa8fb3d[_0x65e0('0x5a')]['id']){delete _0xa8fb3d[_0x65e0('0x5a')]['id'];}return db[_0x65e0('0x3f')][_0x65e0('0x60')]({'where':{'id':_0xa8fb3d[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x440e4a,null))[_0x65e0('0x36')](function(_0x273d59){if(_0x273d59){_0xa8fb3d['body'][_0x65e0('0x68')]=_0x273d59['id'];return db['Disposition'][_0x65e0('0x59')](_0xa8fb3d['body']);}})[_0x65e0('0x36')](respondWithResult(_0x440e4a,null))[_0x65e0('0x2c')](handleError(_0x440e4a,null));};exports[_0x65e0('0x69')]=function(_0x362609,_0x1150c6,_0x2b39de){var _0x362b41={'raw':![],'where':{}};var _0x5af0fe={};var _0x770043={'count':0x0,'rows':[]};return db[_0x65e0('0x3f')][_0x65e0('0x6a')]({'where':{'id':_0x362609[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x1150c6,null))[_0x65e0('0x36')](function(_0x477361){if(_0x477361){_0x5af0fe['model']=_[_0x65e0('0x56')](db[_0x65e0('0x6b')]['rawAttributes']);_0x5af0fe[_0x65e0('0x43')]=_[_0x65e0('0x56')](_0x362609[_0x65e0('0x43')]);_0x5af0fe[_0x65e0('0x44')]=_[_0x65e0('0x45')](_0x5af0fe[_0x65e0('0x42')],_0x5af0fe[_0x65e0('0x43')]);_0x362b41[_0x65e0('0x46')]=_['intersection'](_0x5af0fe[_0x65e0('0x42')],qs[_0x65e0('0x47')](_0x362609['query'][_0x65e0('0x47')]));_0x362b41[_0x65e0('0x46')]=_0x362b41[_0x65e0('0x46')]['length']?_0x362b41[_0x65e0('0x46')]:_0x5af0fe['model'];if(!_0x362609[_0x65e0('0x43')]['hasOwnProperty'](_0x65e0('0x49'))){_0x362b41[_0x65e0('0x32')]=qs[_0x65e0('0x32')](_0x362609[_0x65e0('0x43')][_0x65e0('0x32')]);_0x362b41[_0x65e0('0x31')]=qs[_0x65e0('0x31')](_0x362609[_0x65e0('0x43')][_0x65e0('0x31')]);}_0x362b41[_0x65e0('0x4a')]=qs[_0x65e0('0x4b')](_0x362609[_0x65e0('0x43')][_0x65e0('0x4b')]);_0x362b41['where']=qs[_0x65e0('0x44')](_[_0x65e0('0x4c')](_0x362609['query'],_0x5af0fe[_0x65e0('0x44')]));_0x362b41['where'][_0x65e0('0x68')]=_0x477361['id'];if(_0x362609['query'][_0x65e0('0x4d')]){_0x362b41[_0x65e0('0x4e')]=_[_0x65e0('0x4f')](_0x362b41['where'],{'$or':_['map'](_0x362b41['attributes'],function(_0x200d53){var _0x237c8d={};_0x237c8d[_0x200d53]={'$like':'%'+_0x362609['query']['filter']+'%'};return _0x237c8d;})});}_0x362b41=_[_0x65e0('0x4f')]({},_0x362b41,_0x362609[_0x65e0('0x51')]);return db['Disposition'][_0x65e0('0x30')]({'where':_0x362b41[_0x65e0('0x4e')]})[_0x65e0('0x36')](function(_0x19291f){_0x770043['count']=_0x19291f;if(_0x362609[_0x65e0('0x43')][_0x65e0('0x52')]){_0x362b41[_0x65e0('0x58')]=[{'all':!![]}];}return db[_0x65e0('0x6b')][_0x65e0('0x6c')](_0x362b41);})[_0x65e0('0x36')](function(_0x53595f){_0x770043[_0x65e0('0x53')]=_0x53595f;return _0x770043;});}})['then'](respondWithFilteredResult(_0x1150c6,_0x362b41))[_0x65e0('0x2c')](handleError(_0x1150c6,null));};exports[_0x65e0('0x6d')]=function(_0x35ef90,_0x46bb2e,_0x373a38){return db[_0x65e0('0x3f')][_0x65e0('0x60')]({'where':{'id':_0x35ef90[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x46bb2e,null))[_0x65e0('0x36')](function(_0x1723cd){if(_0x1723cd){return _0x1723cd['removeDispositions'](_0x35ef90[_0x65e0('0x43')][_0x65e0('0x6e')]);}})[_0x65e0('0x36')](respondWithStatusCode(_0x46bb2e,null))[_0x65e0('0x2c')](handleError(_0x46bb2e,null));};exports[_0x65e0('0x6f')]=function(_0x57615d,_0xc33338,_0x5a688b){if(_0x57615d[_0x65e0('0x5a')]['id']){delete _0x57615d[_0x65e0('0x5a')]['id'];}return db[_0x65e0('0x3f')][_0x65e0('0x60')]({'where':{'id':_0x57615d[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0xc33338,null))['then'](function(_0x158978){if(_0x158978){_0x57615d['body'][_0x65e0('0x68')]=_0x158978['id'];return db[_0x65e0('0x70')][_0x65e0('0x59')](_0x57615d[_0x65e0('0x5a')]);}})['then'](respondWithResult(_0xc33338,null))[_0x65e0('0x2c')](handleError(_0xc33338,null));};exports[_0x65e0('0x71')]=function(_0x69633f,_0x461327,_0x2b90cf){var _0x2ed654={'raw':![],'where':{}};var _0x22bf2f={};var _0x122a66={'count':0x0,'rows':[]};return db[_0x65e0('0x3f')][_0x65e0('0x6a')]({'where':{'id':_0x69633f['params']['id']}})['then'](handleEntityNotFound(_0x461327,null))[_0x65e0('0x36')](function(_0x20aa0b){if(_0x20aa0b){_0x22bf2f['model']=_[_0x65e0('0x56')](db['CannedAnswer']['rawAttributes']);_0x22bf2f[_0x65e0('0x43')]=_[_0x65e0('0x56')](_0x69633f[_0x65e0('0x43')]);_0x22bf2f[_0x65e0('0x44')]=_[_0x65e0('0x45')](_0x22bf2f[_0x65e0('0x42')],_0x22bf2f['query']);_0x2ed654['attributes']=_[_0x65e0('0x45')](_0x22bf2f[_0x65e0('0x42')],qs['fields'](_0x69633f[_0x65e0('0x43')][_0x65e0('0x47')]));_0x2ed654[_0x65e0('0x46')]=_0x2ed654[_0x65e0('0x46')][_0x65e0('0x57')]?_0x2ed654[_0x65e0('0x46')]:_0x22bf2f['model'];if(!_0x69633f[_0x65e0('0x43')][_0x65e0('0x48')](_0x65e0('0x49'))){_0x2ed654[_0x65e0('0x32')]=qs['limit'](_0x69633f[_0x65e0('0x43')]['limit']);_0x2ed654['offset']=qs[_0x65e0('0x31')](_0x69633f[_0x65e0('0x43')][_0x65e0('0x31')]);}_0x2ed654[_0x65e0('0x4a')]=qs[_0x65e0('0x4b')](_0x69633f[_0x65e0('0x43')][_0x65e0('0x4b')]);_0x2ed654[_0x65e0('0x4e')]=qs['filters'](_[_0x65e0('0x4c')](_0x69633f['query'],_0x22bf2f[_0x65e0('0x44')]));_0x2ed654[_0x65e0('0x4e')][_0x65e0('0x68')]=_0x20aa0b['id'];if(_0x69633f[_0x65e0('0x43')]['filter']){_0x2ed654[_0x65e0('0x4e')]=_[_0x65e0('0x4f')](_0x2ed654[_0x65e0('0x4e')],{'$or':_[_0x65e0('0x3e')](_0x2ed654[_0x65e0('0x46')],function(_0x253d61){var _0xf74415={};_0xf74415[_0x253d61]={'$like':'%'+_0x69633f[_0x65e0('0x43')]['filter']+'%'};return _0xf74415;})});}_0x2ed654=_[_0x65e0('0x4f')]({},_0x2ed654,_0x69633f['options']);return db[_0x65e0('0x70')][_0x65e0('0x30')]({'where':_0x2ed654[_0x65e0('0x4e')]})[_0x65e0('0x36')](function(_0x8e1595){_0x122a66[_0x65e0('0x30')]=_0x8e1595;if(_0x69633f[_0x65e0('0x43')][_0x65e0('0x52')]){_0x2ed654['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x65e0('0x6c')](_0x2ed654);})[_0x65e0('0x36')](function(_0x3b0820){_0x122a66[_0x65e0('0x53')]=_0x3b0820;return _0x122a66;});}})[_0x65e0('0x36')](respondWithFilteredResult(_0x461327,_0x2ed654))[_0x65e0('0x2c')](handleError(_0x461327,null));};exports['removeAnswers']=function(_0x201c17,_0x1526f3,_0xe28fe2){return db[_0x65e0('0x3f')][_0x65e0('0x60')]({'where':{'id':_0x201c17[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x1526f3,null))[_0x65e0('0x36')](function(_0x267717){if(_0x267717){return _0x267717[_0x65e0('0x72')](_0x201c17['query'][_0x65e0('0x6e')]);}})[_0x65e0('0x36')](respondWithStatusCode(_0x1526f3,null))[_0x65e0('0x2c')](handleError(_0x1526f3,null));};exports[_0x65e0('0x73')]=function(_0x4fb313,_0x479934,_0x1613d4){var _0x1adc68={'channel':'sms'};var _0x2f6ced=[];var _0x43caed=[];var _0x273720={};return db['SmsAccount']['find']({'where':{'id':_0x4fb313[_0x65e0('0x55')]['id']},'include':[{'model':db[_0x65e0('0x74')],'as':_0x65e0('0x75')}]})[_0x65e0('0x36')](handleEntityNotFound(_0x479934,null))['then'](function(_0x2779d1){_0x1adc68[_0x65e0('0x76')]=_0x2779d1;_0x1adc68[_0x65e0('0x77')]=_[_0x65e0('0x78')](_0x2779d1[_0x65e0('0x75')],[_0x65e0('0x79')],[_0x65e0('0x7a')]);if(_0x1adc68[_0x65e0('0x76')][_0x65e0('0x75')]){delete _0x1adc68[_0x65e0('0x76')][_0x65e0('0x75')];}return db['CmContact'][_0x65e0('0x66')]();})['then'](function(_0x7c7f07){if(!_0x7c7f07){throw new db['Sequelize'][(_0x65e0('0x7b'))](_0x65e0('0x7c'));}_0x2f6ced=_[_0x65e0('0x7d')](_[_0x65e0('0x56')](_0x7c7f07),[_0x65e0('0x7e'),_0x65e0('0x7f')]);_0x43caed=_['difference'](_[_0x65e0('0x56')](_0x7c7f07),[_0x65e0('0x7e'),_0x65e0('0x7f'),_0x65e0('0x80'),_0x65e0('0x81')]);_0x1adc68[_0x65e0('0x5a')]={'mapKey':_0x65e0('0x82')};if(_0x1adc68[_0x65e0('0x76')][_0x65e0('0x41')]){switch(_0x1adc68[_0x65e0('0x76')][_0x65e0('0x41')]){case _0x65e0('0x83'):_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')]=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x85')];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x5a')]=_0x4fb313[_0x65e0('0x5a')]['Body'];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x86')]=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x87')];break;case _0x65e0('0x88'):_0x1adc68['body'][_0x65e0('0x84')]='+'+_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x89')];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x5a')]=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x8a')];break;case _0x65e0('0x8b'):_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')]=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x84')];_0x1adc68['body']['body']=_0x4fb313[_0x65e0('0x5a')]['message'];break;case _0x65e0('0x8c'):_0x1adc68['body']['from']=_0x4fb313['body'][_0x65e0('0x84')];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x5a')]=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x5a')];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x86')]=_0x4fb313[_0x65e0('0x5a')]['message_id'];break;case'plivo':_0x1adc68[_0x65e0('0x5a')]['from']=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x85')];_0x1adc68['body'][_0x65e0('0x5a')]=_0x4fb313['body'][_0x65e0('0x8d')];_0x1adc68['body']['messageId']=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x8e')];break;case'infobip':_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')]='+'+_0x4fb313['body'][_0x65e0('0x8f')][0x0][_0x65e0('0x84')];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x5a')]=_0x4fb313['body']['results'][0x0]['text'];_0x1adc68['body']['messageId']=_0x4fb313['body']['results'][0x0][_0x65e0('0x86')];break;case _0x65e0('0x90'):_0x1adc68[_0x65e0('0x5a')]['from']=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x91')];_0x1adc68[_0x65e0('0x5a')]['body']=_0x4fb313[_0x65e0('0x5a')]['segmentedMessage'][_0x65e0('0x2a')];break;case _0x65e0('0x92'):_0x1adc68['body'][_0x65e0('0x84')]=_0x4fb313['body'][_0x65e0('0x93')];_0x1adc68[_0x65e0('0x5a')]['body']=_0x4fb313[_0x65e0('0x5a')]['text'];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x86')]=_0x4fb313['body'][_0x65e0('0x94')];break;case _0x65e0('0x95'):_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x86')]=_0x4fb313[_0x65e0('0x5a')][0x0][_0x65e0('0x2a')]['id'];_0x1adc68['body'][_0x65e0('0x84')]=_0x4fb313[_0x65e0('0x5a')][0x0]['message'][_0x65e0('0x84')];_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x5a')]=_0x4fb313[_0x65e0('0x5a')][0x0]['message'][_0x65e0('0x8a')];break;case'intelepeer':_0x1adc68['body'][_0x65e0('0x84')]=_0x4fb313['body'][_0x65e0('0x84')];_0x1adc68['body'][_0x65e0('0x5a')]=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x2a')];_0x1adc68['body'][_0x65e0('0x86')]=_0x4fb313[_0x65e0('0x5a')][_0x65e0('0x96')];break;}}if(_0x1adc68[_0x65e0('0x5a')]['id']){delete _0x1adc68['body']['id'];}if(_[_0x65e0('0x97')](_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')])){throw new db['Sequelize'][(_0x65e0('0x7b'))](_0x65e0('0x98'));}if(_['isNil'](_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x5a')])||_0x1adc68[_0x65e0('0x5a')]['body']===''){throw new db['Sequelize'][(_0x65e0('0x7b'))](_0x65e0('0x99'));}if(_[_0x65e0('0x97')](_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x9a')])){throw new db[(_0x65e0('0x9b'))][(_0x65e0('0x7b'))](_0x65e0('0x9c')+_0x43caed);}if(!_['includes'](_0x43caed,_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x9a')])){throw new db[(_0x65e0('0x9b'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43caed);}_0x273720[_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x9a')]]=_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')];return db[_0x65e0('0x9d')]['find']({'where':{'id':_0x1adc68[_0x65e0('0x76')]['ListId']},'include':[{'model':db[_0x65e0('0x9e')],'as':_0x65e0('0x9f'),'where':_0x273720,'limit':0x1,'order':[[_0x65e0('0x7f'),_0x65e0('0xa0')]]}]});})[_0x65e0('0x36')](handleEntityNotFound(_0x479934,null))[_0x65e0('0x36')](function(_0x424687){if(_0x424687){_0x1adc68[_0x65e0('0xa1')]=_[_0x65e0('0xa2')](_0x424687,[_0x65e0('0x9f')]);if(_0x424687[_0x65e0('0x9f')][_0x65e0('0x57')]){return _0x424687[_0x65e0('0x9f')][0x0];}var _0x11b6f8=_['defaults'](_0x1adc68[_0x65e0('0x5a')],{'firstName':_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')],'ListId':_0x424687['id']});_0x11b6f8[_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x9a')]]=_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')];return db[_0x65e0('0x9e')][_0x65e0('0x59')](_0x11b6f8,{'fields':_0x2f6ced,'raw':!![]});}})[_0x65e0('0x36')](handleEntityNotFound(_0x479934,null))[_0x65e0('0x36')](function(_0x5baf61){if(_0x5baf61){_0x1adc68[_0x65e0('0xa3')]=_0x5baf61;var _0x2f5c64={'ContactId':_0x5baf61['id'],'phone':_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x84')],'SmsAccountId':_0x4fb313[_0x65e0('0x55')]['id']};var _0x79a60={'ContactId':_0x5baf61['id'],'SmsAccountId':_0x4fb313[_0x65e0('0x55')]['id'],'closed':![]};return db['SmsInteraction'][_0x65e0('0x60')]({'where':_0x79a60})['then'](function(_0x262ebc){if(_0x262ebc){return[_0x262ebc,![]];}return db[_0x65e0('0xa4')][_0x65e0('0x59')](_0x2f5c64)[_0x65e0('0x36')](function(_0x4b2ab9){return[_0x4b2ab9,!![]];});});}})['spread'](function(_0x3d59d3,_0xf04fb3){_0x1adc68[_0x65e0('0xa5')]=_0x3d59d3[_0x65e0('0x5c')]({'plain':!![]});_0x1adc68[_0x65e0('0xa5')][_0x65e0('0xa6')]=![];if(_0xf04fb3){if(_0x1adc68[_0x65e0('0x76')][_0x65e0('0xa7')]){_0x1adc68[_0x65e0('0x77')][_0x65e0('0xa8')]({'id':0x0,'priority':_0x1adc68[_0x65e0('0x77')][_0x65e0('0x57')]+0x1,'app':_0x65e0('0xa9'),'appdata':'unmanaged','interval':_0x65e0('0xaa')});}_0x1adc68[_0x65e0('0xa5')][_0x65e0('0xa6')]=!![];}return db['SmsMessage'][_0x65e0('0x59')]({'phone':_0x1adc68[_0x65e0('0x5a')]['from'],'messageId':_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x86')],'body':_0x1adc68[_0x65e0('0x5a')][_0x65e0('0x5a')],'SmsAccountId':_0x4fb313['params']['id'],'SmsInteractionId':_0x3d59d3['id'],'direction':'in','ContactId':_0x3d59d3['ContactId'],'AttachmentId':_0x1adc68[_0x65e0('0x5a')][_0x65e0('0xab')]});})[_0x65e0('0x36')](function(_0x3ce2ad){_0x1adc68[_0x65e0('0x2a')]=_0x3ce2ad;if(_0x1adc68['interaction'][_0x65e0('0xac')]){return db[_0x65e0('0xad')][_0x65e0('0x60')]({'attributes':['id',_0x65e0('0x3a')],'where':{'id':_0x1adc68[_0x65e0('0xa5')][_0x65e0('0xac')]}})[_0x65e0('0x36')](function(_0x2c0f60){if(_0x2c0f60){_0x1adc68['applications'][_0x65e0('0xae')]({'id':0x0,'priority':0x0,'app':_0x65e0('0xaf'),'appdata':_0x2c0f60[_0x65e0('0x3a')]+','+(_0x1adc68[_0x65e0('0x76')][_0x65e0('0xb0')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x1adc68);});}return respondWithRpcPromise(_0x65e0('0xb1'),'startRouting',_0x1adc68);})[_0x65e0('0x36')](function(_0x319cca){if(_0x319cca){var _0x4f78b0=0xc8;var _0x2688e0=_0x65e0('0xb2');logger[_0x65e0('0xb3')](_0x65e0('0x27'),_0x2688e0,_0x4f78b0,_0x65e0('0xb4'));logger[_0x65e0('0x26')](_0x65e0('0xb5'),_0x2688e0,_0x4f78b0,_0x65e0('0xb4'),JSON['stringify'](_0x319cca));if(_0x1adc68['account'][_0x65e0('0x41')]===_0x65e0('0x83')){return _0x479934['status'](_0x4f78b0)[_0x65e0('0xb6')](_0x65e0('0xb7'),'text/xml')['send'](_0x65e0('0xb8'));}else{return _0x479934[_0x65e0('0x2e')](_0x4f78b0)[_0x65e0('0x2f')](_0x319cca);}}})[_0x65e0('0x2c')](handleError(_0x479934,null));};exports['addApplications']=function(_0x11d643,_0x389afa,_0x5e407d){return db['SmsAccount'][_0x65e0('0x6a')]({'where':{'id':_0x11d643[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x389afa,null))[_0x65e0('0x36')](function(_0x35e073){if(_0x35e073){return db[_0x65e0('0xb9')][_0x65e0('0xba')](function(_0x5134db){return db[_0x65e0('0x74')][_0x65e0('0x37')]({'where':{'SmsAccountId':_0x11d643[_0x65e0('0x55')]['id']},'transaction':_0x5134db})['then'](function(_0x5cf4e4){var _0x533fa6=_[_0x65e0('0x3e')](_0x11d643[_0x65e0('0x5a')],function(_0x193fb5){_0x193fb5[_0x65e0('0x68')]=_0x11d643[_0x65e0('0x55')]['id'];return _0x193fb5;});return db['SmsApplication'][_0x65e0('0xbb')](_0x533fa6,{'transaction':_0x5134db});});})[_0x65e0('0x36')](function(){return db[_0x65e0('0x74')]['findAndCountAll']({'where':{'SmsAccountId':_0x11d643[_0x65e0('0x55')]['id']},'order':_0x65e0('0x79')});});}})[_0x65e0('0x36')](respondWithResult(_0x389afa,null))[_0x65e0('0x2c')](handleError(_0x389afa,null));};exports[_0x65e0('0xbc')]=function(_0x32236e,_0xd8245a,_0x161784){var _0x36cefb={};var _0x2b6cf5={};var _0x448eec;var _0x215155;return db[_0x65e0('0x3f')][_0x65e0('0x6a')]({'where':{'id':_0x32236e[_0x65e0('0x55')]['id']}})['then'](handleEntityNotFound(_0xd8245a,null))[_0x65e0('0x36')](function(_0x5467bf){if(_0x5467bf){_0x448eec=_0x5467bf;_0x2b6cf5[_0x65e0('0x42')]=_[_0x65e0('0x56')](db['SmsApplication'][_0x65e0('0xbd')]);_0x2b6cf5['query']=_[_0x65e0('0x56')](_0x32236e[_0x65e0('0x43')]);_0x2b6cf5[_0x65e0('0x44')]=_['intersection'](_0x2b6cf5['model'],_0x2b6cf5['query']);_0x36cefb['attributes']=_[_0x65e0('0x45')](_0x2b6cf5[_0x65e0('0x42')],qs[_0x65e0('0x47')](_0x32236e['query'][_0x65e0('0x47')]));_0x36cefb[_0x65e0('0x46')]=_0x36cefb[_0x65e0('0x46')][_0x65e0('0x57')]?_0x36cefb['attributes']:_0x2b6cf5[_0x65e0('0x42')];_0x36cefb[_0x65e0('0x4a')]=qs[_0x65e0('0x4b')](_0x32236e[_0x65e0('0x43')]['sort']);_0x36cefb['where']=qs['filters'](_[_0x65e0('0x4c')](_0x32236e[_0x65e0('0x43')],_0x2b6cf5[_0x65e0('0x44')]));if(_0x32236e[_0x65e0('0x43')][_0x65e0('0x4d')]){_0x36cefb[_0x65e0('0x4e')]=_[_0x65e0('0x4f')](_0x36cefb[_0x65e0('0x4e')],{'$or':_['map'](_0x36cefb[_0x65e0('0x46')],function(_0xdde723){var _0x56d975={};_0x56d975[_0xdde723]={'$like':'%'+_0x32236e[_0x65e0('0x43')]['filter']+'%'};return _0x56d975;})});}_0x36cefb=_[_0x65e0('0x4f')]({},_0x36cefb,_0x32236e[_0x65e0('0x51')]);return _0x448eec[_0x65e0('0xbc')](_0x36cefb);}})['then'](function(_0x5945fe){if(_0x5945fe){_0x215155=_0x5945fe[_0x65e0('0x57')];if(!_0x32236e[_0x65e0('0x43')][_0x65e0('0x48')](_0x65e0('0x49'))){_0x36cefb[_0x65e0('0x32')]=qs['limit'](_0x32236e[_0x65e0('0x43')]['limit']);_0x36cefb[_0x65e0('0x31')]=qs[_0x65e0('0x31')](_0x32236e[_0x65e0('0x43')]['offset']);}return _0x448eec[_0x65e0('0xbc')](_0x36cefb);}})[_0x65e0('0x36')](function(_0x514560){if(_0x514560){return _0x514560?{'count':_0x215155,'rows':_0x514560}:null;}})[_0x65e0('0x36')](respondWithResult(_0xd8245a,null))[_0x65e0('0x2c')](handleError(_0xd8245a,null));};exports[_0x65e0('0xbe')]=function(_0x3cd73a,_0x22aaa1,_0x7d08bd){var _0x564fd8={'raw':![],'where':{}};var _0x11e2f1={};var _0x295ab4={'count':0x0,'rows':[]};return db[_0x65e0('0x3f')][_0x65e0('0x6a')]({'where':{'id':_0x3cd73a['params']['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x22aaa1,null))[_0x65e0('0x36')](function(_0x21f758){if(_0x21f758){_0x11e2f1[_0x65e0('0x42')]=_[_0x65e0('0x56')](db['SmsInteraction']['rawAttributes']);_0x11e2f1[_0x65e0('0x43')]=_[_0x65e0('0x56')](_0x3cd73a[_0x65e0('0x43')]);_0x11e2f1[_0x65e0('0x44')]=_[_0x65e0('0x45')](_0x11e2f1[_0x65e0('0x42')],_0x11e2f1[_0x65e0('0x43')]);_0x564fd8[_0x65e0('0x46')]=_['intersection'](_0x11e2f1[_0x65e0('0x42')],qs[_0x65e0('0x47')](_0x3cd73a[_0x65e0('0x43')]['fields']));_0x564fd8[_0x65e0('0x46')]=_0x564fd8[_0x65e0('0x46')][_0x65e0('0x57')]?_0x564fd8[_0x65e0('0x46')]:_0x11e2f1[_0x65e0('0x42')];if(!_0x3cd73a[_0x65e0('0x43')]['hasOwnProperty']('nolimit')){_0x564fd8['limit']=qs['limit'](_0x3cd73a[_0x65e0('0x43')]['limit']);_0x564fd8[_0x65e0('0x31')]=qs['offset'](_0x3cd73a[_0x65e0('0x43')][_0x65e0('0x31')]);}_0x564fd8[_0x65e0('0x4a')]=qs['sort'](_0x3cd73a[_0x65e0('0x43')][_0x65e0('0x4b')]);_0x564fd8[_0x65e0('0x4e')]=qs[_0x65e0('0x44')](_['pick'](_0x3cd73a[_0x65e0('0x43')],_0x11e2f1[_0x65e0('0x44')]));_0x564fd8['where'][_0x65e0('0x68')]=_0x21f758['id'];if(_0x3cd73a[_0x65e0('0x43')][_0x65e0('0x4d')]){_0x564fd8[_0x65e0('0x4e')]=_[_0x65e0('0x4f')](_0x564fd8[_0x65e0('0x4e')],{'$or':_['map'](_0x564fd8[_0x65e0('0x46')],function(_0x243c85){var _0x23085e={};_0x23085e[_0x243c85]={'$like':'%'+_0x3cd73a[_0x65e0('0x43')]['filter']+'%'};return _0x23085e;})});}_0x564fd8=_[_0x65e0('0x4f')]({},_0x564fd8,_0x3cd73a[_0x65e0('0x51')]);return db[_0x65e0('0xa4')]['count']({'where':_0x564fd8['where']})['then'](function(_0x558675){_0x295ab4[_0x65e0('0x30')]=_0x558675;if(_0x3cd73a[_0x65e0('0x43')][_0x65e0('0x52')]){_0x564fd8[_0x65e0('0x58')]=[{'model':db[_0x65e0('0x9e')],'as':_0x65e0('0xbf'),'required':![]},{'model':db[_0x65e0('0xad')],'as':_0x65e0('0xc0'),'attributes':[_0x65e0('0x3a'),_0x65e0('0xc1'),_0x65e0('0xc2')],'required':![]},{'model':db[_0x65e0('0xc3')],'as':'Tags','attributes':['id',_0x65e0('0x3a'),_0x65e0('0xc4')],'where':_0x3cd73a[_0x65e0('0x43')]['tag']?{'id':_0x3cd73a[_0x65e0('0x43')][_0x65e0('0xc5')]}:undefined,'required':_0x3cd73a['query'][_0x65e0('0xc5')]?!![]:![]}];}return db['SmsInteraction'][_0x65e0('0x6c')](_0x564fd8);})['then'](function(_0x216ef1){_0x295ab4[_0x65e0('0x53')]=_0x216ef1;return _0x295ab4;});}})[_0x65e0('0x36')](respondWithFilteredResult(_0x22aaa1,_0x564fd8))['catch'](handleError(_0x22aaa1,null));};exports[_0x65e0('0x3b')]=function(_0x424100,_0x3b887f,_0xce7bb){var _0x567cbf,_0x487517,_0x206af5;if(_['isNil'](_0x424100['body'][_0x65e0('0x5a')])||_0x424100[_0x65e0('0x5a')][_0x65e0('0x5a')]===''){throw new db['Sequelize'][(_0x65e0('0x7b'))](_0x65e0('0x99'));}if(_[_0x65e0('0x97')](_0x424100[_0x65e0('0x5a')]['to'])){throw new db['Sequelize'][(_0x65e0('0x7b'))](_0x65e0('0xc6'));}_0x567cbf=_0x424100['body']['to'];return db['SmsAccount'][_0x65e0('0x60')]({'where':{'id':_0x424100[_0x65e0('0x55')]['id']},'include':[{'model':db[_0x65e0('0x9d')],'as':'List','include':[{'model':db[_0x65e0('0x9e')],'as':_0x65e0('0x9f'),'where':{'mobile':_0x567cbf},'limit':0x1,'order':[[_0x65e0('0x7f'),_0x65e0('0xa0')]]}]}]})['then'](handleEntityNotFound(_0x3b887f,null))[_0x65e0('0x36')](function(_0x55a11a){if(_0x55a11a&&_0x55a11a['List']){_0x487517=_0x55a11a['get']({'plain':!![]});if(_0x487517[_0x65e0('0xc7')]&&_0x487517['List']['Contacts']['length']){return _0x487517[_0x65e0('0xc7')][_0x65e0('0x9f')][0x0];}return db[_0x65e0('0x9e')]['create'](_[_0x65e0('0x1b')](_0x424100[_0x65e0('0x5a')],{'firstName':_0x567cbf,'mobile':_0x567cbf,'phone':_0x567cbf,'ListId':_0x487517[_0x65e0('0x81')]}));}})[_0x65e0('0x36')](handleEntityNotFound(_0x3b887f,null))[_0x65e0('0x36')](function(_0x1538b5){if(_0x1538b5){_0x206af5=_0x1538b5;return db[_0x65e0('0xa4')][_0x65e0('0x60')]({'where':{'ContactId':_0x206af5['id'],'closed':![],'SmsAccountId':_0x487517['id']}})[_0x65e0('0x36')](function(_0x3c61ae){if(_0x3c61ae){return[_0x3c61ae,![]];}return db[_0x65e0('0xa4')][_0x65e0('0x59')]({'UserId':_0x424100['user']['id'],'ContactId':_0x206af5['id'],'SmsAccountId':_0x487517['id'],'phone':_0x567cbf,'firstMsgDirection':'out','Messages':[_[_0x65e0('0x4f')](_0x424100[_0x65e0('0x5a')],{'read':![],'body':_0x424100['body'][_0x65e0('0x5a')],'phone':_0x567cbf,'SmsAccountId':_0x487517['id'],'UserId':_0x424100[_0x65e0('0x5b')]['id'],'ContactId':_0x206af5['id']})]},{'include':[{'model':db[_0x65e0('0xc8')],'as':_0x65e0('0xc9')}]})[_0x65e0('0x36')](function(_0x8bd614){return[_0x8bd614,!![]];});});}})[_0x65e0('0xca')](function(_0x3b9bbf,_0x2254be){if(_0x2254be){return _0x3b9bbf;}return db[_0x65e0('0xc8')]['create'](_[_0x65e0('0x4f')](_0x424100[_0x65e0('0x5a')],{'read':![],'body':_0x424100[_0x65e0('0x5a')][_0x65e0('0x5a')],'phone':_0x567cbf,'SmsAccountId':_0x487517['id'],'SmsInteractionId':_0x3b9bbf['id'],'UserId':_0x424100['user']['id'],'ContactId':_0x206af5['id']}))[_0x65e0('0x36')](function(_0x3d0f5f){_0x3b9bbf['dataValues'][_0x65e0('0xc9')]=[];_0x3b9bbf[_0x65e0('0xcb')][_0x65e0('0xc9')][_0x65e0('0xa8')](_0x3d0f5f[_0x65e0('0xcb')]);return _0x3b9bbf;});})[_0x65e0('0x36')](respondWithResult(_0x3b887f,null))['catch'](handleError(_0x3b887f,null));};exports[_0x65e0('0x2e')]=function(_0x1e9f2f,_0x186089,_0x11baa8){if(_0x1e9f2f[_0x65e0('0x5a')]['id']){delete _0x1e9f2f[_0x65e0('0x5a')]['id'];}var _0x15540f,_0x407825,_0x3aba5f;return db[_0x65e0('0x3f')]['find']({'where':{'id':_0x1e9f2f[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x186089,null))[_0x65e0('0x36')](function(_0x34430c){if(_0x34430c){_0x3aba5f=_0x34430c;logger[_0x65e0('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x34430c['type'],util[_0x65e0('0xcc')](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));switch(_0x34430c['type']){case _0x65e0('0x88'):if(_0x1e9f2f[_0x65e0('0x5a')]['skebby_dispatch_id']&&_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0x2e')]){_0x407825=_0x1e9f2f['body'][_0x65e0('0x2e')];return db[_0x65e0('0xc8')][_0x65e0('0x60')]({'where':{'messageId':_0x1e9f2f['body'][_0x65e0('0xcd')]}});}break;case _0x65e0('0x8b'):if(_0x1e9f2f[_0x65e0('0x5a')]['requestid']&&_0x1e9f2f[_0x65e0('0x5a')]['statusInt']){_0x407825=_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0xce')];return db['SmsMessage'][_0x65e0('0x60')]({'where':{'messageId':_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0xcf')]}});}break;case _0x65e0('0x8c'):if(_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0xd0')]&&_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0xd1')]){_0x407825=_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0xd1')];return db[_0x65e0('0xc8')][_0x65e0('0x60')]({'where':{'messageId':_0x1e9f2f['body']['message_id']}});}break;case _0x65e0('0xd2'):var _0x4bf093=_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0x8f')][0x0];if(_0x4bf093[_0x65e0('0x86')]&&_0x4bf093[_0x65e0('0x2e')]['groupName']==='DELIVERED'){_0x407825=_0x4bf093[_0x65e0('0x2e')][_0x65e0('0xd3')];return db[_0x65e0('0xc8')]['find']({'where':{'messageId':_0x4bf093[_0x65e0('0x86')]}});}break;case'clickatell':if(_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0x86')]&&_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0x2e')]){_0x407825=_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0x2e')];return db[_0x65e0('0xc8')][_0x65e0('0x60')]({'where':{'messageId':_0x1e9f2f['body']['messageId']}});}break;case _0x65e0('0x95'):if(_0x1e9f2f[_0x65e0('0x5a')][0x0][_0x65e0('0x2a')]['id']){_0x407825=_0x1e9f2f['body'][0x0]['type'];return db['SmsMessage'][_0x65e0('0x60')]({'where':{'messageId':_0x1e9f2f[_0x65e0('0x5a')][0x0][_0x65e0('0x2a')]['id']}});}break;case'intelepeer':if(_0x1e9f2f[_0x65e0('0x5a')]['redif']&&_0x1e9f2f[_0x65e0('0x5a')]['status']){_0x407825=_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0x2e')];return db[_0x65e0('0xc8')][_0x65e0('0x60')]({'where':{'messageId':_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0xd4')]}});}break;}}})[_0x65e0('0x36')](handleEntityNotFound(_0x186089,null))['then'](function(_0x2559be){if(_0x2559be){_0x15540f=_0x2559be;switch(_0x3aba5f[_0x65e0('0x41')]){case'skebby':if(_0x407825===_0x65e0('0xd5')){return _0x15540f['update']({'read':!![]});}else{logger[_0x65e0('0x28')](_0x65e0('0x27'),'status',_0x65e0('0x88'),util['inspect'](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x407825==='1'){return _0x15540f['update']({'read':!![]});}else{logger[_0x65e0('0x28')](_0x65e0('0x27'),'status',_0x65e0('0x88'),util['inspect'](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x65e0('0x8c'):if(!_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0xd6')]&&_0x407825>=0xc8&&_0x407825<=0xce){return _0x15540f[_0x65e0('0x65')]({'read':!![]});}else{logger[_0x65e0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x65e0('0x2e'),_0x65e0('0x8c'),util[_0x65e0('0xcc')](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x65e0('0xd2'):var _0xbe80dd=_0x1e9f2f[_0x65e0('0x5a')][_0x65e0('0x8f')][0x0];if(_0xbe80dd['status'][_0x65e0('0xd3')]==='DELIVERED'){return _0x15540f[_0x65e0('0x65')]({'read':!![]});}else{logger[_0x65e0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x65e0('0x2e'),_0x65e0('0xd2'),util['inspect'](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x407825==_0x65e0('0xd7')||_0x407825==_0x65e0('0xd8')){return _0x15540f['update']({'read':!![]});}else{logger[_0x65e0('0x28')](_0x65e0('0x27'),_0x65e0('0x2e'),_0x65e0('0x92'),util['inspect'](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x407825==_0x65e0('0xd9')){return _0x15540f[_0x65e0('0x65')]({'read':!![]});}else{logger[_0x65e0('0x28')](_0x65e0('0x27'),'status','bandwidth',util[_0x65e0('0xcc')](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x65e0('0xda'):if(_0x407825===_0x65e0('0xdb')||_0x407825===_0x65e0('0xdc')){return _0x15540f[_0x65e0('0x65')]({'read':!![]});}else{logger['error'](_0x65e0('0x27'),'status',_0x65e0('0xda'),util['inspect'](_0x1e9f2f[_0x65e0('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x15540f;}})[_0x65e0('0x36')](respondWithResult(_0x186089,null))[_0x65e0('0x2c')](handleError(_0x186089,null));};exports['statusGet']=function(_0x35d16a,_0x38896d,_0x36d3f5){var _0x4fb785,_0x28d8f8,_0x4ff63b;return db[_0x65e0('0x3f')][_0x65e0('0x60')]({'where':{'id':_0x35d16a[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x38896d,null))[_0x65e0('0x36')](function(_0x57b3ae){if(_0x57b3ae){_0x4ff63b=_0x57b3ae;logger[_0x65e0('0x26')](_0x65e0('0x27'),_0x65e0('0x2e'),_0x65e0('0xdd'),_0x57b3ae[_0x65e0('0x41')],util[_0x65e0('0xcc')](_0x35d16a['query'],{'showHidden':![],'depth':null}));switch(_0x57b3ae[_0x65e0('0x41')]){case'csc':if(_0x35d16a[_0x65e0('0x43')][_0x65e0('0xde')]&&_0x35d16a[_0x65e0('0x43')][_0x65e0('0xdf')]){_0x28d8f8=_0x35d16a[_0x65e0('0x43')][_0x65e0('0xdf')];return db[_0x65e0('0xc8')][_0x65e0('0x60')]({'where':{'messageId':_0x35d16a['query'][_0x65e0('0xde')]}});}break;}}})[_0x65e0('0x36')](handleEntityNotFound(_0x38896d,null))['then'](function(_0x5fb221){if(_0x5fb221){_0x4fb785=_0x5fb221;switch(_0x4ff63b[_0x65e0('0x41')]){case'csc':if(_0x28d8f8==='2'||_0x28d8f8==='6'){return _0x4fb785['update']({'read':!![]});}else{logger[_0x65e0('0x28')](_0x65e0('0x27'),'status','csc',util['inspect'](_0x35d16a[_0x65e0('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x4fb785;}})[_0x65e0('0x36')](respondWithResult(_0x38896d,null))[_0x65e0('0x2c')](handleError(_0x38896d,null));};exports[_0x65e0('0xe0')]=function(_0x22fef9,_0x557428,_0x4ce66a){return db[_0x65e0('0x3f')]['find']({'where':{'id':_0x22fef9[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x557428,null))[_0x65e0('0x36')](function(_0x2067ca){if(_0x2067ca){return _0x2067ca[_0x65e0('0xe0')](_0x22fef9[_0x65e0('0x5a')][_0x65e0('0x6e')],_[_0x65e0('0xa2')](_0x22fef9[_0x65e0('0x5a')],[_0x65e0('0x6e'),'id'])||{})[_0x65e0('0xca')](function(_0x29c5d1){for(var _0x70a795=0x0;_0x70a795<_0x22fef9['body'][_0x65e0('0x6e')][_0x65e0('0x57')];_0x70a795+=0x1){socket[_0x65e0('0xe1')](_0x65e0('0xe2'),{'UserId':_0x22fef9[_0x65e0('0x5a')][_0x65e0('0x6e')][_0x70a795],'SmsAccountId':_0x22fef9[_0x65e0('0x55')]['id']});}return _0x29c5d1;});}})['then'](respondWithResult(_0x557428,null))[_0x65e0('0x2c')](handleError(_0x557428,null));};exports[_0x65e0('0xe3')]=function(_0x3a2cf8,_0x46a5ff,_0x2c063f){return db['SmsAccount']['find']({'where':{'id':_0x3a2cf8['params']['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x46a5ff,null))[_0x65e0('0x36')](function(_0x2f3d7e){if(_0x2f3d7e){return _0x2f3d7e[_0x65e0('0xe3')](_0x3a2cf8[_0x65e0('0x43')][_0x65e0('0x6e')])[_0x65e0('0x36')](function(){if(_[_0x65e0('0xe4')](_0x3a2cf8['query']['ids'])){for(var _0x5b330a=0x0;_0x5b330a<_0x3a2cf8[_0x65e0('0x43')][_0x65e0('0x6e')][_0x65e0('0x57')];_0x5b330a+=0x1){socket[_0x65e0('0xe1')](_0x65e0('0xe5'),{'UserId':Number(_0x3a2cf8['query'][_0x65e0('0x6e')][_0x5b330a]),'SmsAccountId':Number(_0x3a2cf8[_0x65e0('0x55')]['id'])});}}else{socket[_0x65e0('0xe1')](_0x65e0('0xe5'),{'UserId':Number(_0x3a2cf8[_0x65e0('0x43')][_0x65e0('0x6e')]),'SmsAccountId':Number(_0x3a2cf8[_0x65e0('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x46a5ff,null))[_0x65e0('0x2c')](handleError(_0x46a5ff,null));};exports[_0x65e0('0xe6')]=function(_0x4d0923,_0x329a14,_0x538c62){var _0x5c5d33={};var _0x4a2b3e={};var _0x2979f1;var _0x36db2f;return db[_0x65e0('0x3f')]['findOne']({'where':{'id':_0x4d0923[_0x65e0('0x55')]['id']}})[_0x65e0('0x36')](handleEntityNotFound(_0x329a14,null))[_0x65e0('0x36')](function(_0x208471){if(_0x208471){_0x2979f1=_0x208471;_0x4a2b3e[_0x65e0('0x42')]=_['keys'](db[_0x65e0('0xad')][_0x65e0('0xbd')]);_0x4a2b3e['query']=_[_0x65e0('0x56')](_0x4d0923['query']);_0x4a2b3e[_0x65e0('0x44')]=_[_0x65e0('0x45')](_0x4a2b3e[_0x65e0('0x42')],_0x4a2b3e[_0x65e0('0x43')]);_0x5c5d33[_0x65e0('0x46')]=_[_0x65e0('0x45')](_0x4a2b3e[_0x65e0('0x42')],qs[_0x65e0('0x47')](_0x4d0923[_0x65e0('0x43')]['fields']));_0x5c5d33[_0x65e0('0x46')]=_0x5c5d33[_0x65e0('0x46')]['length']?_0x5c5d33['attributes']:_0x4a2b3e[_0x65e0('0x42')];_0x5c5d33['order']=qs[_0x65e0('0x4b')](_0x4d0923[_0x65e0('0x43')]['sort']);_0x5c5d33[_0x65e0('0x4e')]=qs['filters'](_[_0x65e0('0x4c')](_0x4d0923[_0x65e0('0x43')],_0x4a2b3e['filters']));if(_0x4d0923[_0x65e0('0x43')][_0x65e0('0x4d')]){_0x5c5d33['where']=_['merge'](_0x5c5d33['where'],{'$or':_[_0x65e0('0x3e')](_0x5c5d33['attributes'],function(_0x5d531f){var _0x1740ad={};_0x1740ad[_0x5d531f]={'$like':'%'+_0x4d0923['query'][_0x65e0('0x4d')]+'%'};return _0x1740ad;})});}_0x5c5d33=_[_0x65e0('0x4f')]({},_0x5c5d33,_0x4d0923['options']);return _0x2979f1[_0x65e0('0xe6')](_0x5c5d33);}})[_0x65e0('0x36')](function(_0x2e69ac){if(_0x2e69ac){_0x36db2f=_0x2e69ac[_0x65e0('0x57')];if(!_0x4d0923[_0x65e0('0x43')][_0x65e0('0x48')](_0x65e0('0x49'))){_0x5c5d33[_0x65e0('0x32')]=qs[_0x65e0('0x32')](_0x4d0923[_0x65e0('0x43')][_0x65e0('0x32')]);_0x5c5d33[_0x65e0('0x31')]=qs[_0x65e0('0x31')](_0x4d0923[_0x65e0('0x43')][_0x65e0('0x31')]);}return _0x2979f1[_0x65e0('0xe6')](_0x5c5d33);}})['then'](function(_0x283166){if(_0x283166){return _0x283166?{'count':_0x36db2f,'rows':_0x283166}:null;}})[_0x65e0('0x36')](respondWithResult(_0x329a14,null))[_0x65e0('0x2c')](handleError(_0x329a14,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d223f7e..be55a4a 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 _0x8a97=['save','update','emit','hasOwnProperty','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8a97,0x15c));var _0x78a9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x8a97[_0x31e29a];return _0x32d892;};'use strict';var EventEmitter=require(_0x78a9('0x0'));var SmsAccount=require(_0x78a9('0x1'))['db'][_0x78a9('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x78a9('0x3')](0x0);var events={'afterCreate':_0x78a9('0x4'),'afterUpdate':_0x78a9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2117ae){return function(_0x3a907a,_0x142ce7,_0x50f88b){SmsAccountEvents[_0x78a9('0x6')](_0x2117ae+':'+_0x3a907a['id'],_0x3a907a);SmsAccountEvents['emit'](_0x2117ae,_0x3a907a);_0x50f88b(null);};}for(var e in events){if(events[_0x78a9('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x6138=['update','emit','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0x54a81b,_0x335fda){var _0x601917=function(_0x2bbdc8){while(--_0x2bbdc8){_0x54a81b['push'](_0x54a81b['shift']());}};_0x601917(++_0x335fda);}(_0x6138,0x16c));var _0x8613=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6138[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require(_0x8613('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x8613('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8613('0x2')](0x0);var events={'afterCreate':_0x8613('0x3'),'afterUpdate':_0x8613('0x4'),'afterDestroy':'remove'};function emitEvent(_0x199c9e){return function(_0x22dc45,_0x4283dc,_0x5bebb5){SmsAccountEvents[_0x8613('0x5')](_0x199c9e+':'+_0x22dc45['id'],_0x22dc45);SmsAccountEvents['emit'](_0x199c9e,_0x22dc45);_0x5bebb5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x8613('0x6')](e,emitEvent(event));}}module[_0x8613('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ffa7176..e51802e 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 _0x5665=['moment','bluebird','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api'];(function(_0x486c97,_0x3dab68){var _0x8e5107=function(_0x1dc713){while(--_0x1dc713){_0x486c97['push'](_0x486c97['shift']());}};_0x8e5107(++_0x3dab68);}(_0x5665,0x8b));var _0x5566=function(_0x320b6a,_0x339a1d){_0x320b6a=_0x320b6a-0x0;var _0x4d55ae=_0x5665[_0x320b6a];return _0x4d55ae;};'use strict';var _=require(_0x5566('0x0'));var util=require(_0x5566('0x1'));var logger=require(_0x5566('0x2'))(_0x5566('0x3'));var moment=require(_0x5566('0x4'));var BPromise=require(_0x5566('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5566('0x6'));var rimraf=require(_0x5566('0x7'));var config=require('../../config/environment');var attributes=require(_0x5566('0x8'));module[_0x5566('0x9')]=function(_0x170df7,_0x24d33e){return _0x170df7[_0x5566('0xa')](_0x5566('0xb'),attributes,{'tableName':_0x5566('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x168a=['api','moment','bluebird','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','util','../../config/logger'];(function(_0x1198a7,_0x58ca47){var _0x34e937=function(_0x38ee9b){while(--_0x38ee9b){_0x1198a7['push'](_0x1198a7['shift']());}};_0x34e937(++_0x58ca47);}(_0x168a,0x1cc));var _0xa168=function(_0x19f295,_0x2369c7){_0x19f295=_0x19f295-0x0;var _0x128989=_0x168a[_0x19f295];return _0x128989;};'use strict';var _=require('lodash');var util=require(_0xa168('0x0'));var logger=require(_0xa168('0x1'))(_0xa168('0x2'));var moment=require(_0xa168('0x3'));var BPromise=require(_0xa168('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa168('0x5'));var config=require(_0xa168('0x6'));var attributes=require(_0xa168('0x7'));module['exports']=function(_0x28d27c,_0x4e6eaf){return _0x28d27c[_0xa168('0x8')](_0xa168('0x9'),attributes,{'tableName':_0xa168('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index eeb8d15..fbc66f4 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 _0x30a1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','ShowSmsAccount','SmsAccount','find','raw','options','where','attributes','map','include','model','catch','lodash','util'];(function(_0x3d4e74,_0x21b4e5){var _0x57613d=function(_0x2fa3b3){while(--_0x2fa3b3){_0x3d4e74['push'](_0x3d4e74['shift']());}};_0x57613d(++_0x21b4e5);}(_0x30a1,0x1de));var _0x130a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x130a('0x0'));var util=require(_0x130a('0x1'));var moment=require(_0x130a('0x2'));var BPromise=require(_0x130a('0x3'));var rs=require(_0x130a('0x4'));var fs=require('fs');var Redis=require(_0x130a('0x5'));var db=require(_0x130a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x130a('0x7'))('rpc');var config=require(_0x130a('0x8'));var jayson=require(_0x130a('0x9'));var client=jayson[_0x130a('0xa')][_0x130a('0xb')]({'port':0x232a});config[_0x130a('0xc')]=_[_0x130a('0xd')](config[_0x130a('0xc')],{'host':_0x130a('0xe'),'port':0x18eb});var socket=require(_0x130a('0xf'))(new Redis(config[_0x130a('0xc')]));require(_0x130a('0x10'))['register'](socket);function respondWithRpcPromise(_0x3e4c83,_0x571f4b,_0x45a769){return new BPromise(function(_0x4db058,_0x34cd6e){return client[_0x130a('0x11')](_0x3e4c83,_0x45a769)[_0x130a('0x12')](function(_0x4d030d){logger[_0x130a('0x13')](_0x130a('0x14'),_0x571f4b,'request\x20sent');logger[_0x130a('0x15')](_0x130a('0x16'),_0x571f4b,'request\x20sent',JSON[_0x130a('0x17')](_0x4d030d));if(_0x4d030d['error']){if(_0x4d030d['error'][_0x130a('0x18')]===0x1f4){logger[_0x130a('0x19')](_0x130a('0x14'),_0x571f4b,_0x4d030d[_0x130a('0x19')][_0x130a('0x1a')]);return _0x34cd6e(_0x4d030d[_0x130a('0x19')][_0x130a('0x1a')]);}logger[_0x130a('0x19')](_0x130a('0x14'),_0x571f4b,_0x4d030d['error'][_0x130a('0x1a')]);return _0x4db058(_0x4d030d[_0x130a('0x19')][_0x130a('0x1a')]);}else{logger[_0x130a('0x13')]('SmsAccount,\x20%s,\x20%s',_0x571f4b,_0x130a('0x1b'));_0x4db058(_0x4d030d[_0x130a('0x1c')][_0x130a('0x1a')]);}})['catch'](function(_0x294b77){logger[_0x130a('0x19')](_0x130a('0x14'),_0x571f4b,_0x294b77);_0x34cd6e(_0x294b77);});});}exports[_0x130a('0x1d')]=function(_0x3f9636){var _0x37ae78=this;return new Promise(function(_0x4e49a3,_0x3a1e0f){return db[_0x130a('0x1e')][_0x130a('0x1f')]({'raw':_0x3f9636['options']?_0x3f9636['options'][_0x130a('0x20')]===undefined?!![]:![]:!![],'where':_0x3f9636[_0x130a('0x21')]?_0x3f9636[_0x130a('0x21')][_0x130a('0x22')]||null:null,'attributes':_0x3f9636[_0x130a('0x21')]?_0x3f9636[_0x130a('0x21')][_0x130a('0x23')]||null:null,'include':_0x3f9636[_0x130a('0x21')]?_0x3f9636['options']['include']?_[_0x130a('0x24')](_0x3f9636['options'][_0x130a('0x25')],function(_0x3c0383){return{'model':db[_0x3c0383[_0x130a('0x26')]],'as':_0x3c0383['as'],'attributes':_0x3c0383['attributes'],'include':_0x3c0383[_0x130a('0x25')]?_[_0x130a('0x24')](_0x3c0383[_0x130a('0x25')],function(_0x2eb353){return{'model':db[_0x2eb353[_0x130a('0x26')]],'as':_0x2eb353['as'],'attributes':_0x2eb353[_0x130a('0x23')],'include':_0x2eb353[_0x130a('0x25')]?_[_0x130a('0x24')](_0x2eb353['include'],function(_0x32e7bd){return{'model':db[_0x32e7bd[_0x130a('0x26')]],'as':_0x32e7bd['as'],'attributes':_0x32e7bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x130a('0x12')](function(_0x112970){logger[_0x130a('0x13')]('ShowSmsAccount',_0x3f9636);logger['debug']('ShowSmsAccount',_0x3f9636,JSON[_0x130a('0x17')](_0x112970));_0x4e49a3(_0x112970);})[_0x130a('0x27')](function(_0x2daadd){logger['error'](_0x130a('0x1d'),_0x2daadd[_0x130a('0x1a')],_0x3f9636);_0x3a1e0f(_0x37ae78['error'](0x1f4,_0x2daadd[_0x130a('0x1a')]));});});}; \ No newline at end of file +var _0xcbc1=['include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','ShowSmsAccount','find','options','raw','where','attributes'];(function(_0x325890,_0x4cd3b8){var _0x44a15a=function(_0x17de7b){while(--_0x17de7b){_0x325890['push'](_0x325890['shift']());}};_0x44a15a(++_0x4cd3b8);}(_0xcbc1,0x100));var _0x1cbc=function(_0x5e6c41,_0x11e182){_0x5e6c41=_0x5e6c41-0x0;var _0x254e22=_0xcbc1[_0x5e6c41];return _0x254e22;};'use strict';var _=require(_0x1cbc('0x0'));var util=require(_0x1cbc('0x1'));var moment=require(_0x1cbc('0x2'));var BPromise=require(_0x1cbc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cbc('0x4'));var db=require(_0x1cbc('0x5'))['db'];var utils=require(_0x1cbc('0x6'));var logger=require(_0x1cbc('0x7'))(_0x1cbc('0x8'));var config=require(_0x1cbc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1cbc('0xa')][_0x1cbc('0xb')]({'port':0x232a});config[_0x1cbc('0xc')]=_['defaults'](config[_0x1cbc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cbc('0xd'))(new Redis(config['redis']));require(_0x1cbc('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ca09d,_0xd71850,_0x5d9b23){return new BPromise(function(_0xe296cf,_0x3b177c){return client[_0x1cbc('0xf')](_0x4ca09d,_0x5d9b23)[_0x1cbc('0x10')](function(_0x1273fb){logger[_0x1cbc('0x11')](_0x1cbc('0x12'),_0xd71850,'request\x20sent');logger['debug'](_0x1cbc('0x13'),_0xd71850,'request\x20sent',JSON[_0x1cbc('0x14')](_0x1273fb));if(_0x1273fb[_0x1cbc('0x15')]){if(_0x1273fb['error']['code']===0x1f4){logger[_0x1cbc('0x15')](_0x1cbc('0x12'),_0xd71850,_0x1273fb['error'][_0x1cbc('0x16')]);return _0x3b177c(_0x1273fb[_0x1cbc('0x15')][_0x1cbc('0x16')]);}logger['error'](_0x1cbc('0x12'),_0xd71850,_0x1273fb[_0x1cbc('0x15')][_0x1cbc('0x16')]);return _0xe296cf(_0x1273fb[_0x1cbc('0x15')][_0x1cbc('0x16')]);}else{logger[_0x1cbc('0x11')]('SmsAccount,\x20%s,\x20%s',_0xd71850,_0x1cbc('0x17'));_0xe296cf(_0x1273fb[_0x1cbc('0x18')][_0x1cbc('0x16')]);}})[_0x1cbc('0x19')](function(_0x455ebb){logger[_0x1cbc('0x15')]('SmsAccount,\x20%s,\x20%s',_0xd71850,_0x455ebb);_0x3b177c(_0x455ebb);});});}exports[_0x1cbc('0x1a')]=function(_0x371621){var _0xe6160=this;return new Promise(function(_0x52a390,_0x1651d0){return db['SmsAccount'][_0x1cbc('0x1b')]({'raw':_0x371621[_0x1cbc('0x1c')]?_0x371621[_0x1cbc('0x1c')][_0x1cbc('0x1d')]===undefined?!![]:![]:!![],'where':_0x371621['options']?_0x371621[_0x1cbc('0x1c')][_0x1cbc('0x1e')]||null:null,'attributes':_0x371621[_0x1cbc('0x1c')]?_0x371621[_0x1cbc('0x1c')][_0x1cbc('0x1f')]||null:null,'include':_0x371621[_0x1cbc('0x1c')]?_0x371621[_0x1cbc('0x1c')][_0x1cbc('0x20')]?_[_0x1cbc('0x21')](_0x371621['options'][_0x1cbc('0x20')],function(_0x1f6415){return{'model':db[_0x1f6415[_0x1cbc('0x22')]],'as':_0x1f6415['as'],'attributes':_0x1f6415['attributes'],'include':_0x1f6415[_0x1cbc('0x20')]?_[_0x1cbc('0x21')](_0x1f6415[_0x1cbc('0x20')],function(_0x3a8dfa){return{'model':db[_0x3a8dfa[_0x1cbc('0x22')]],'as':_0x3a8dfa['as'],'attributes':_0x3a8dfa[_0x1cbc('0x1f')],'include':_0x3a8dfa[_0x1cbc('0x20')]?_[_0x1cbc('0x21')](_0x3a8dfa[_0x1cbc('0x20')],function(_0x59069f){return{'model':db[_0x59069f['model']],'as':_0x59069f['as'],'attributes':_0x59069f[_0x1cbc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1cbc('0x10')](function(_0x2380b6){logger['info'](_0x1cbc('0x1a'),_0x371621);logger[_0x1cbc('0x23')](_0x1cbc('0x1a'),_0x371621,JSON[_0x1cbc('0x14')](_0x2380b6));_0x52a390(_0x2380b6);})[_0x1cbc('0x19')](function(_0x50b4be){logger[_0x1cbc('0x15')](_0x1cbc('0x1a'),_0x50b4be[_0x1cbc('0x16')],_0x371621);_0x1651d0(_0xe6160['error'](0x1f4,_0x50b4be[_0x1cbc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b4432d0..f770a95 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 _0x299a=['length','smsAccount:','save','remove','update','emit','removeListener','register'];(function(_0x1d0162,_0x4db8b2){var _0x1e544e=function(_0x1c9466){while(--_0x1c9466){_0x1d0162['push'](_0x1d0162['shift']());}};_0x1e544e(++_0x4db8b2);}(_0x299a,0x182));var _0xa299=function(_0x49540b,_0x4d445e){_0x49540b=_0x49540b-0x0;var _0x1c0a06=_0x299a[_0x49540b];return _0x1c0a06;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xa299('0x0'),_0xa299('0x1'),_0xa299('0x2')];function createListener(_0x3d5150,_0x5ca431){return function(_0x2155c0){_0x5ca431[_0xa299('0x3')](_0x3d5150,_0x2155c0);};}function removeListener(_0x16aa7b,_0x123cd7){return function(){SmsAccountEvents[_0xa299('0x4')](_0x16aa7b,_0x123cd7);};}exports[_0xa299('0x5')]=function(_0x401e8b){for(var _0x1f4700=0x0,_0xeaea69=events[_0xa299('0x6')];_0x1f4700<_0xeaea69;_0x1f4700++){var _0xac0dca=events[_0x1f4700];var _0x5d6097=createListener(_0xa299('0x7')+_0xac0dca,_0x401e8b);SmsAccountEvents['on'](_0xac0dca,_0x5d6097);}}; \ No newline at end of file +var _0x3afb=['smsAccount:','./smsAccount.events','save','remove','update','emit','register','length'];(function(_0x45601b,_0x1dcd04){var _0x1313e6=function(_0x40d699){while(--_0x40d699){_0x45601b['push'](_0x45601b['shift']());}};_0x1313e6(++_0x1dcd04);}(_0x3afb,0xc1));var _0xb3af=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x3afb[_0xaa1b3e];return _0x454d7d;};'use strict';var SmsAccountEvents=require(_0xb3af('0x0'));var events=[_0xb3af('0x1'),_0xb3af('0x2'),_0xb3af('0x3')];function createListener(_0xdb76ec,_0x2be74c){return function(_0x200830){_0x2be74c[_0xb3af('0x4')](_0xdb76ec,_0x200830);};}function removeListener(_0x310aa5,_0x15f41a){return function(){SmsAccountEvents['removeListener'](_0x310aa5,_0x15f41a);};}exports[_0xb3af('0x5')]=function(_0x413018){for(var _0x1ce1ce=0x0,_0x44edd5=events[_0xb3af('0x6')];_0x1ce1ce<_0x44edd5;_0x1ce1ce++){var _0x39538c=events[_0x1ce1ce];var _0x19e654=createListener(_0xb3af('0x7')+_0x39538c,_0x413018);SmsAccountEvents['on'](_0x39538c,_0x19e654);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index d28fe95..cb67d7f 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 _0x1070=['path','express','Router','../../components/auth/service','get','isAuthenticated','show','post','create','put','/:id','destroy','multer','util'];(function(_0x3015b2,_0x2c2c6a){var _0x376315=function(_0x1a76b8){while(--_0x1a76b8){_0x3015b2['push'](_0x3015b2['shift']());}};_0x376315(++_0x2c2c6a);}(_0x1070,0xfa));var _0x0107=function(_0x62f6a0,_0x42a304){_0x62f6a0=_0x62f6a0-0x0;var _0x15c282=_0x1070[_0x62f6a0];return _0x15c282;};'use strict';var multer=require(_0x0107('0x0'));var util=require(_0x0107('0x1'));var path=require(_0x0107('0x2'));var timeout=require('connect-timeout');var express=require(_0x0107('0x3'));var router=express[_0x0107('0x4')]();var auth=require(_0x0107('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsApplication.controller');router[_0x0107('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0107('0x6')]('/:id',auth[_0x0107('0x7')](),controller[_0x0107('0x8')]);router[_0x0107('0x9')]('/',auth['isAuthenticated'](),controller[_0x0107('0xa')]);router[_0x0107('0xb')]('/:id',auth[_0x0107('0x7')](),controller['update']);router['delete'](_0x0107('0xc'),auth['isAuthenticated'](),controller[_0x0107('0xd')]);module['exports']=router; \ No newline at end of file +var _0x37d2=['path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','put','delete','destroy','exports','util'];(function(_0x5df937,_0x25cb5c){var _0x46cf32=function(_0x4e449e){while(--_0x4e449e){_0x5df937['push'](_0x5df937['shift']());}};_0x46cf32(++_0x25cb5c);}(_0x37d2,0x67));var _0x237d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37d2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x237d('0x0'));var path=require(_0x237d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x237d('0x2')]();var auth=require(_0x237d('0x3'));var interaction=require(_0x237d('0x4'));var config=require('../../config/environment');var controller=require('./smsApplication.controller');router[_0x237d('0x5')]('/',auth[_0x237d('0x6')](),controller[_0x237d('0x7')]);router[_0x237d('0x5')](_0x237d('0x8'),auth[_0x237d('0x6')](),controller['show']);router['post']('/',auth[_0x237d('0x6')](),controller['create']);router[_0x237d('0x9')](_0x237d('0x8'),auth[_0x237d('0x6')](),controller['update']);router[_0x237d('0xa')](_0x237d('0x8'),auth[_0x237d('0x6')](),controller[_0x237d('0xb')]);module[_0x237d('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 36a5fb5..976aec8 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 _0x3827=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x270f63,_0x296a6e){var _0x22130e=function(_0x28ef0b){while(--_0x28ef0b){_0x270f63['push'](_0x270f63['shift']());}};_0x22130e(++_0x296a6e);}(_0x3827,0xd0));var _0x7382=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x3827[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0x7382('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7382('0x1')],'allowNull':![],'defaultValue':_0x7382('0x2')},'appdata':{'type':Sequelize[_0x7382('0x3')]()},'description':{'type':Sequelize[_0x7382('0x1')]},'interval':{'type':Sequelize[_0x7382('0x1')],'defaultValue':_0x7382('0x4')}}; \ No newline at end of file +var _0xf8f5=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x442c77,_0x573c92){var _0x1afff0=function(_0x1960cb){while(--_0x1960cb){_0x442c77['push'](_0x442c77['shift']());}};_0x1afff0(++_0x573c92);}(_0xf8f5,0xda));var _0x5f8f=function(_0x15a47e,_0x43b99a){_0x15a47e=_0x15a47e-0x0;var _0x2f886c=_0xf8f5[_0x15a47e];return _0x2f886c;};'use strict';var Sequelize=require(_0x5f8f('0x0'));module[_0x5f8f('0x1')]={'priority':{'type':Sequelize[_0x5f8f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f8f('0x3')},'appdata':{'type':Sequelize[_0x5f8f('0x4')]()},'description':{'type':Sequelize[_0x5f8f('0x5')]},'interval':{'type':Sequelize[_0x5f8f('0x5')],'defaultValue':_0x5f8f('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index cfa7bdd..cbf33e5 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 _0x1198=['length','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','destroy','then','error','stack','name','send','index','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','map','type','VIRTUAL','filter','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x87d8bf,_0x230ed2){var _0x302508=function(_0x2e8526){while(--_0x2e8526){_0x87d8bf['push'](_0x87d8bf['shift']());}};_0x302508(++_0x230ed2);}(_0x1198,0x1b4));var _0x8119=function(_0x56fb02,_0x4f7058){_0x56fb02=_0x56fb02-0x0;var _0x2c2498=_0x1198[_0x56fb02];return _0x2c2498;};'use strict';var pdf=require(_0x8119('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8119('0x1'));var zipdir=require(_0x8119('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8119('0x3'));var moment=require(_0x8119('0x4'));var BPromise=require(_0x8119('0x5'));var Mustache=require(_0x8119('0x6'));var util=require('util');var path=require(_0x8119('0x7'));var sox=require(_0x8119('0x8'));var csv=require(_0x8119('0x9'));var ejs=require(_0x8119('0xa'));var fs=require('fs');var _=require(_0x8119('0xb'));var squel=require(_0x8119('0xc'));var crypto=require(_0x8119('0xd'));var jsforce=require(_0x8119('0xe'));var deskjs=require(_0x8119('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8119('0x10'));var Redis=require(_0x8119('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8119('0x12'));var hardwareService=require(_0x8119('0x13'));var logger=require(_0x8119('0x14'))('api');var utils=require(_0x8119('0x15'));var config=require(_0x8119('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8119('0x17'))['db'];function respondWithStatusCode(_0x4d2101,_0x451efc){_0x451efc=_0x451efc||0xcc;return function(_0x37b974){if(_0x37b974){return _0x4d2101[_0x8119('0x18')](_0x451efc);}return _0x4d2101[_0x8119('0x19')](_0x451efc)['end']();};}function respondWithResult(_0x58555d,_0x5de0c5){_0x5de0c5=_0x5de0c5||0xc8;return function(_0x4d9cfd){if(_0x4d9cfd){return _0x58555d[_0x8119('0x19')](_0x5de0c5)[_0x8119('0x1a')](_0x4d9cfd);}};}function respondWithFilteredResult(_0x625a1c,_0x26a140){return function(_0x58af62){if(_0x58af62){var _0x2243e2=_0x58af62[_0x8119('0x1b')],_0x5174bf=_0x26a140['offset'],_0x42f3c2=_0x26a140[_0x8119('0x1c')]+_0x26a140[_0x8119('0x1d')],_0x59cbd8;if(_0x42f3c2>=_0x2243e2){_0x42f3c2=_0x2243e2;_0x59cbd8=0xc8;}else{_0x59cbd8=0xce;}_0x625a1c[_0x8119('0x19')](_0x59cbd8);return _0x625a1c['set']('Content-Range',_0x5174bf+'-'+_0x42f3c2+'/'+_0x2243e2)[_0x8119('0x1a')](_0x58af62);}return null;};}function patchUpdates(_0x4306d8){return function(_0x37ffca){try{jsonpatch[_0x8119('0x1e')](_0x37ffca,_0x4306d8,!![]);}catch(_0x3c7f14){return BPromise[_0x8119('0x1f')](_0x3c7f14);}return _0x37ffca[_0x8119('0x20')]();};}function saveUpdates(_0x350b5d,_0x5b6bf4){return function(_0xa087d2){if(_0xa087d2){return _0xa087d2[_0x8119('0x21')](_0x350b5d)['then'](function(_0x21257f){return _0x21257f;});}return null;};}function removeEntity(_0x4bda7f,_0x2781a1){return function(_0x4bc885){if(_0x4bc885){return _0x4bc885[_0x8119('0x22')]()[_0x8119('0x23')](function(){_0x4bda7f[_0x8119('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cd8c5,_0x19ec0e){return function(_0x4aea59){if(!_0x4aea59){_0x1cd8c5[_0x8119('0x18')](0x194);}return _0x4aea59;};}function handleError(_0x1bc8a7,_0x395ae5){_0x395ae5=_0x395ae5||0x1f4;return function(_0x43898c){logger[_0x8119('0x24')](_0x43898c[_0x8119('0x25')]);if(_0x43898c[_0x8119('0x26')]){delete _0x43898c[_0x8119('0x26')];}_0x1bc8a7[_0x8119('0x19')](_0x395ae5)[_0x8119('0x27')](_0x43898c);};}exports[_0x8119('0x28')]=function(_0x3a377e,_0x24a655){var _0x16cd04={},_0x5d453d={},_0x38e576={'count':0x0,'rows':[]};var _0x5c723a=_['map'](db['SmsApplication']['rawAttributes'],function(_0x4c9532){return{'name':_0x4c9532[_0x8119('0x29')],'type':_0x4c9532['type']['key']};});_0x5d453d[_0x8119('0x2a')]=_['map'](_0x5c723a,_0x8119('0x26'));_0x5d453d[_0x8119('0x2b')]=_[_0x8119('0x2c')](_0x3a377e[_0x8119('0x2b')]);_0x5d453d[_0x8119('0x2d')]=_[_0x8119('0x2e')](_0x5d453d[_0x8119('0x2a')],_0x5d453d[_0x8119('0x2b')]);_0x16cd04[_0x8119('0x2f')]=_[_0x8119('0x2e')](_0x5d453d['model'],qs[_0x8119('0x30')](_0x3a377e[_0x8119('0x2b')]['fields']));_0x16cd04[_0x8119('0x2f')]=_0x16cd04['attributes']['length']?_0x16cd04['attributes']:_0x5d453d[_0x8119('0x2a')];if(!_0x3a377e[_0x8119('0x2b')][_0x8119('0x31')](_0x8119('0x32'))){_0x16cd04['limit']=qs[_0x8119('0x1d')](_0x3a377e['query'][_0x8119('0x1d')]);_0x16cd04[_0x8119('0x1c')]=qs[_0x8119('0x1c')](_0x3a377e['query']['offset']);}_0x16cd04['order']=qs[_0x8119('0x33')](_0x3a377e[_0x8119('0x2b')]['sort']);_0x16cd04[_0x8119('0x34')]=qs[_0x8119('0x2d')](_['pick'](_0x3a377e[_0x8119('0x2b')],_0x5d453d[_0x8119('0x2d')]),_0x5c723a);if(_0x3a377e['query']['filter']){_0x16cd04[_0x8119('0x34')]=_[_0x8119('0x35')](_0x16cd04[_0x8119('0x34')],{'$or':_[_0x8119('0x36')](_0x5c723a,function(_0x5ef3ac){if(_0x5ef3ac[_0x8119('0x37')]!==_0x8119('0x38')){var _0x363150={};_0x363150[_0x5ef3ac['name']]={'$like':'%'+_0x3a377e[_0x8119('0x2b')][_0x8119('0x39')]+'%'};return _0x363150;}})});}_0x16cd04=_[_0x8119('0x35')]({},_0x16cd04,_0x3a377e[_0x8119('0x3a')]);var _0x15de89={'where':_0x16cd04['where']};return db[_0x8119('0x3b')][_0x8119('0x1b')](_0x15de89)['then'](function(_0x5eea89){_0x38e576['count']=_0x5eea89;if(_0x3a377e['query'][_0x8119('0x3c')]){_0x16cd04[_0x8119('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x8119('0x3e')](_0x16cd04);})[_0x8119('0x23')](function(_0x55c9d6){_0x38e576[_0x8119('0x3f')]=_0x55c9d6;return _0x38e576;})[_0x8119('0x23')](respondWithFilteredResult(_0x24a655,_0x16cd04))[_0x8119('0x40')](handleError(_0x24a655,null));};exports[_0x8119('0x41')]=function(_0x2190df,_0x23a0f4){var _0x23b637={'raw':!![],'where':{'id':_0x2190df[_0x8119('0x42')]['id']}},_0x52a789={};_0x52a789[_0x8119('0x2a')]=_['keys'](db[_0x8119('0x3b')][_0x8119('0x43')]);_0x52a789[_0x8119('0x2b')]=_[_0x8119('0x2c')](_0x2190df[_0x8119('0x2b')]);_0x52a789[_0x8119('0x2d')]=_[_0x8119('0x2e')](_0x52a789[_0x8119('0x2a')],_0x52a789[_0x8119('0x2b')]);_0x23b637[_0x8119('0x2f')]=_['intersection'](_0x52a789['model'],qs[_0x8119('0x30')](_0x2190df['query']['fields']));_0x23b637[_0x8119('0x2f')]=_0x23b637[_0x8119('0x2f')][_0x8119('0x44')]?_0x23b637[_0x8119('0x2f')]:_0x52a789[_0x8119('0x2a')];if(_0x2190df[_0x8119('0x2b')]['includeAll']){_0x23b637[_0x8119('0x3d')]=[{'all':!![]}];}_0x23b637=_[_0x8119('0x35')]({},_0x23b637,_0x2190df[_0x8119('0x3a')]);return db[_0x8119('0x3b')][_0x8119('0x45')](_0x23b637)[_0x8119('0x23')](handleEntityNotFound(_0x23a0f4,null))['then'](respondWithResult(_0x23a0f4,null))[_0x8119('0x40')](handleError(_0x23a0f4,null));};exports[_0x8119('0x46')]=function(_0x4c13fb,_0x2a40d1){return db[_0x8119('0x3b')]['create'](_0x4c13fb['body'],{})[_0x8119('0x23')](respondWithResult(_0x2a40d1,0xc9))[_0x8119('0x40')](handleError(_0x2a40d1,null));};exports[_0x8119('0x21')]=function(_0x34e15e,_0xb10a8){if(_0x34e15e[_0x8119('0x47')]['id']){delete _0x34e15e[_0x8119('0x47')]['id'];}return db[_0x8119('0x3b')][_0x8119('0x45')]({'where':{'id':_0x34e15e['params']['id']}})['then'](handleEntityNotFound(_0xb10a8,null))[_0x8119('0x23')](saveUpdates(_0x34e15e[_0x8119('0x47')],null))[_0x8119('0x23')](respondWithResult(_0xb10a8,null))[_0x8119('0x40')](handleError(_0xb10a8,null));};exports[_0x8119('0x22')]=function(_0x3c7ec9,_0x2134f2){return db[_0x8119('0x3b')][_0x8119('0x45')]({'where':{'id':_0x3c7ec9[_0x8119('0x42')]['id']}})[_0x8119('0x23')](handleEntityNotFound(_0x2134f2,null))[_0x8119('0x23')](removeEntity(_0x2134f2,null))[_0x8119('0x40')](handleError(_0x2134f2,null));}; \ No newline at end of file +var _0x7208=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','merge','create','body','params','find','html-pdf','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce'];(function(_0x442dbf,_0x117087){var _0x294658=function(_0x469549){while(--_0x469549){_0x442dbf['push'](_0x442dbf['shift']());}};_0x294658(++_0x117087);}(_0x7208,0x16b));var _0x8720=function(_0x490040,_0x3291cc){_0x490040=_0x490040-0x0;var _0x44ca33=_0x7208[_0x490040];return _0x44ca33;};'use strict';var pdf=require(_0x8720('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8720('0x1'));var zipdir=require(_0x8720('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8720('0x3'));var moment=require(_0x8720('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8720('0x5'));var path=require(_0x8720('0x6'));var sox=require(_0x8720('0x7'));var csv=require(_0x8720('0x8'));var ejs=require(_0x8720('0x9'));var fs=require('fs');var _=require(_0x8720('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8720('0xb'));var deskjs=require(_0x8720('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8720('0xd'));var Papa=require(_0x8720('0xe'));var Redis=require(_0x8720('0xf'));var authService=require(_0x8720('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8720('0x11'));var logger=require(_0x8720('0x12'))(_0x8720('0x13'));var utils=require(_0x8720('0x14'));var config=require(_0x8720('0x15'));var licenseUtil=require(_0x8720('0x16'));var db=require(_0x8720('0x17'))['db'];function respondWithStatusCode(_0xa78555,_0x5469bb){_0x5469bb=_0x5469bb||0xcc;return function(_0x14f634){if(_0x14f634){return _0xa78555[_0x8720('0x18')](_0x5469bb);}return _0xa78555[_0x8720('0x19')](_0x5469bb)[_0x8720('0x1a')]();};}function respondWithResult(_0x15e5a7,_0x2e1a0b){_0x2e1a0b=_0x2e1a0b||0xc8;return function(_0x1c5668){if(_0x1c5668){return _0x15e5a7[_0x8720('0x19')](_0x2e1a0b)[_0x8720('0x1b')](_0x1c5668);}};}function respondWithFilteredResult(_0x467c41,_0x1e2f5b){return function(_0x54f3ce){if(_0x54f3ce){var _0xa8d3dc=_0x54f3ce[_0x8720('0x1c')],_0x424c86=_0x1e2f5b['offset'],_0x1d13ad=_0x1e2f5b[_0x8720('0x1d')]+_0x1e2f5b[_0x8720('0x1e')],_0x210ecd;if(_0x1d13ad>=_0xa8d3dc){_0x1d13ad=_0xa8d3dc;_0x210ecd=0xc8;}else{_0x210ecd=0xce;}_0x467c41[_0x8720('0x19')](_0x210ecd);return _0x467c41[_0x8720('0x1f')](_0x8720('0x20'),_0x424c86+'-'+_0x1d13ad+'/'+_0xa8d3dc)[_0x8720('0x1b')](_0x54f3ce);}return null;};}function patchUpdates(_0x46ab45){return function(_0x1937a7){try{jsonpatch[_0x8720('0x21')](_0x1937a7,_0x46ab45,!![]);}catch(_0x376057){return BPromise['reject'](_0x376057);}return _0x1937a7[_0x8720('0x22')]();};}function saveUpdates(_0x314f21,_0x21d32d){return function(_0x2a1a2e){if(_0x2a1a2e){return _0x2a1a2e[_0x8720('0x23')](_0x314f21)[_0x8720('0x24')](function(_0x3ba778){return _0x3ba778;});}return null;};}function removeEntity(_0x754a1d,_0x955f56){return function(_0x216736){if(_0x216736){return _0x216736[_0x8720('0x25')]()[_0x8720('0x24')](function(){_0x754a1d['status'](0xcc)[_0x8720('0x1a')]();});}};}function handleEntityNotFound(_0xe311ca,_0x1244f7){return function(_0xfa7b8b){if(!_0xfa7b8b){_0xe311ca[_0x8720('0x18')](0x194);}return _0xfa7b8b;};}function handleError(_0x4970eb,_0x5bd790){_0x5bd790=_0x5bd790||0x1f4;return function(_0x4f7c8f){logger[_0x8720('0x26')](_0x4f7c8f[_0x8720('0x27')]);if(_0x4f7c8f[_0x8720('0x28')]){delete _0x4f7c8f['name'];}_0x4970eb[_0x8720('0x19')](_0x5bd790)[_0x8720('0x29')](_0x4f7c8f);};}exports['index']=function(_0x43e4ec,_0x460f1a){var _0x518e03={},_0x1ca12d={},_0x1a92b0={'count':0x0,'rows':[]};var _0x4f4c50=_[_0x8720('0x2a')](db[_0x8720('0x2b')][_0x8720('0x2c')],function(_0x497490){return{'name':_0x497490[_0x8720('0x2d')],'type':_0x497490['type'][_0x8720('0x2e')]};});_0x1ca12d[_0x8720('0x2f')]=_[_0x8720('0x2a')](_0x4f4c50,_0x8720('0x28'));_0x1ca12d[_0x8720('0x30')]=_[_0x8720('0x31')](_0x43e4ec['query']);_0x1ca12d[_0x8720('0x32')]=_[_0x8720('0x33')](_0x1ca12d[_0x8720('0x2f')],_0x1ca12d[_0x8720('0x30')]);_0x518e03['attributes']=_[_0x8720('0x33')](_0x1ca12d[_0x8720('0x2f')],qs[_0x8720('0x34')](_0x43e4ec[_0x8720('0x30')][_0x8720('0x34')]));_0x518e03[_0x8720('0x35')]=_0x518e03[_0x8720('0x35')][_0x8720('0x36')]?_0x518e03['attributes']:_0x1ca12d[_0x8720('0x2f')];if(!_0x43e4ec[_0x8720('0x30')]['hasOwnProperty'](_0x8720('0x37'))){_0x518e03['limit']=qs[_0x8720('0x1e')](_0x43e4ec[_0x8720('0x30')]['limit']);_0x518e03[_0x8720('0x1d')]=qs[_0x8720('0x1d')](_0x43e4ec[_0x8720('0x30')][_0x8720('0x1d')]);}_0x518e03[_0x8720('0x38')]=qs[_0x8720('0x39')](_0x43e4ec[_0x8720('0x30')][_0x8720('0x39')]);_0x518e03[_0x8720('0x3a')]=qs[_0x8720('0x32')](_[_0x8720('0x3b')](_0x43e4ec[_0x8720('0x30')],_0x1ca12d[_0x8720('0x32')]),_0x4f4c50);if(_0x43e4ec['query'][_0x8720('0x3c')]){_0x518e03['where']=_['merge'](_0x518e03[_0x8720('0x3a')],{'$or':_['map'](_0x4f4c50,function(_0x5c66f9){if(_0x5c66f9[_0x8720('0x3d')]!==_0x8720('0x3e')){var _0xc12ac3={};_0xc12ac3[_0x5c66f9['name']]={'$like':'%'+_0x43e4ec[_0x8720('0x30')][_0x8720('0x3c')]+'%'};return _0xc12ac3;}})});}_0x518e03=_['merge']({},_0x518e03,_0x43e4ec[_0x8720('0x3f')]);var _0x3a17f6={'where':_0x518e03[_0x8720('0x3a')]};return db[_0x8720('0x2b')]['count'](_0x3a17f6)[_0x8720('0x24')](function(_0x493296){_0x1a92b0['count']=_0x493296;if(_0x43e4ec[_0x8720('0x30')][_0x8720('0x40')]){_0x518e03['include']=[{'all':!![]}];}return db[_0x8720('0x2b')][_0x8720('0x41')](_0x518e03);})['then'](function(_0x438bde){_0x1a92b0[_0x8720('0x42')]=_0x438bde;return _0x1a92b0;})[_0x8720('0x24')](respondWithFilteredResult(_0x460f1a,_0x518e03))[_0x8720('0x43')](handleError(_0x460f1a,null));};exports[_0x8720('0x44')]=function(_0xa053fc,_0x570261){var _0x4e9d24={'raw':!![],'where':{'id':_0xa053fc['params']['id']}},_0x4d1c0e={};_0x4d1c0e[_0x8720('0x2f')]=_[_0x8720('0x31')](db[_0x8720('0x2b')][_0x8720('0x2c')]);_0x4d1c0e[_0x8720('0x30')]=_[_0x8720('0x31')](_0xa053fc['query']);_0x4d1c0e['filters']=_[_0x8720('0x33')](_0x4d1c0e[_0x8720('0x2f')],_0x4d1c0e[_0x8720('0x30')]);_0x4e9d24[_0x8720('0x35')]=_['intersection'](_0x4d1c0e[_0x8720('0x2f')],qs['fields'](_0xa053fc[_0x8720('0x30')][_0x8720('0x34')]));_0x4e9d24['attributes']=_0x4e9d24['attributes'][_0x8720('0x36')]?_0x4e9d24['attributes']:_0x4d1c0e['model'];if(_0xa053fc[_0x8720('0x30')][_0x8720('0x40')]){_0x4e9d24[_0x8720('0x45')]=[{'all':!![]}];}_0x4e9d24=_[_0x8720('0x46')]({},_0x4e9d24,_0xa053fc[_0x8720('0x3f')]);return db['SmsApplication']['find'](_0x4e9d24)['then'](handleEntityNotFound(_0x570261,null))['then'](respondWithResult(_0x570261,null))['catch'](handleError(_0x570261,null));};exports[_0x8720('0x47')]=function(_0x5de2ff,_0x2175f7){return db[_0x8720('0x2b')][_0x8720('0x47')](_0x5de2ff['body'],{})[_0x8720('0x24')](respondWithResult(_0x2175f7,0xc9))[_0x8720('0x43')](handleError(_0x2175f7,null));};exports[_0x8720('0x23')]=function(_0x24553b,_0x47ad9b){if(_0x24553b[_0x8720('0x48')]['id']){delete _0x24553b[_0x8720('0x48')]['id'];}return db[_0x8720('0x2b')]['find']({'where':{'id':_0x24553b[_0x8720('0x49')]['id']}})[_0x8720('0x24')](handleEntityNotFound(_0x47ad9b,null))['then'](saveUpdates(_0x24553b['body'],null))['then'](respondWithResult(_0x47ad9b,null))['catch'](handleError(_0x47ad9b,null));};exports[_0x8720('0x25')]=function(_0x51791f,_0x5568a0){return db[_0x8720('0x2b')][_0x8720('0x4a')]({'where':{'id':_0x51791f[_0x8720('0x49')]['id']}})[_0x8720('0x24')](handleEntityNotFound(_0x5568a0,null))[_0x8720('0x24')](removeEntity(_0x5568a0,null))[_0x8720('0x43')](handleError(_0x5568a0,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d74f0fa..8ae1f23 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 _0xba15=['./smsApplication.attributes','exports','define','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1283a0,_0x3eee19){var _0x40359d=function(_0xc22972){while(--_0xc22972){_0x1283a0['push'](_0x1283a0['shift']());}};_0x40359d(++_0x3eee19);}(_0xba15,0x122));var _0x5ba1=function(_0x322c4e,_0x4d05b7){_0x322c4e=_0x322c4e-0x0;var _0x5e2970=_0xba15[_0x322c4e];return _0x5e2970;};'use strict';var _=require(_0x5ba1('0x0'));var util=require(_0x5ba1('0x1'));var logger=require(_0x5ba1('0x2'))(_0x5ba1('0x3'));var moment=require(_0x5ba1('0x4'));var BPromise=require(_0x5ba1('0x5'));var rp=require(_0x5ba1('0x6'));var fs=require('fs');var path=require(_0x5ba1('0x7'));var rimraf=require(_0x5ba1('0x8'));var config=require(_0x5ba1('0x9'));var attributes=require(_0x5ba1('0xa'));module[_0x5ba1('0xb')]=function(_0x1783eb,_0x18057e){return _0x1783eb[_0x5ba1('0xc')]('SmsApplication',attributes,{'tableName':_0x5ba1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ba1('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd2a6=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','utf8mb4'];(function(_0x33e8a5,_0x494629){var _0xc94fb0=function(_0x25c29e){while(--_0x25c29e){_0x33e8a5['push'](_0x33e8a5['shift']());}};_0xc94fb0(++_0x494629);}(_0xd2a6,0x1ad));var _0x6d2a=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xd2a6[_0x5e9a69];return _0x5979c8;};'use strict';var _=require(_0x6d2a('0x0'));var util=require(_0x6d2a('0x1'));var logger=require(_0x6d2a('0x2'))(_0x6d2a('0x3'));var moment=require('moment');var BPromise=require(_0x6d2a('0x4'));var rp=require(_0x6d2a('0x5'));var fs=require('fs');var path=require(_0x6d2a('0x6'));var rimraf=require(_0x6d2a('0x7'));var config=require(_0x6d2a('0x8'));var attributes=require(_0x6d2a('0x9'));module[_0x6d2a('0xa')]=function(_0x5e7c96,_0x24967e){return _0x5e7c96['define'](_0x6d2a('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d2a('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 65661ea..070d836 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 _0x4986=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x53f218,_0x27514c){var _0x21890a=function(_0x445133){while(--_0x445133){_0x53f218['push'](_0x53f218['shift']());}};_0x21890a(++_0x27514c);}(_0x4986,0x6e));var _0x6498=function(_0x584791,_0x5a29a5){_0x584791=_0x584791-0x0;var _0x4b758d=_0x4986[_0x584791];return _0x4b758d;};'use strict';var _=require(_0x6498('0x0'));var util=require(_0x6498('0x1'));var moment=require(_0x6498('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6498('0x3'));var db=require(_0x6498('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6498('0x5'))(_0x6498('0x6'));var config=require(_0x6498('0x7'));var jayson=require(_0x6498('0x8'));var client=jayson[_0x6498('0x9')][_0x6498('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26476d,_0x49b00a,_0x54e6af){return new BPromise(function(_0x1e2d8a,_0x2472af){return client[_0x6498('0xb')](_0x26476d,_0x54e6af)[_0x6498('0xc')](function(_0x1c590e){logger['info'](_0x6498('0xd'),_0x49b00a,_0x6498('0xe'));logger[_0x6498('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x49b00a,'request\x20sent',JSON[_0x6498('0x10')](_0x1c590e));if(_0x1c590e['error']){if(_0x1c590e[_0x6498('0x11')][_0x6498('0x12')]===0x1f4){logger[_0x6498('0x11')](_0x6498('0xd'),_0x49b00a,_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);return _0x2472af(_0x1c590e[_0x6498('0x11')]['message']);}logger['error'](_0x6498('0xd'),_0x49b00a,_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);return _0x1e2d8a(_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);}else{logger['info'](_0x6498('0xd'),_0x49b00a,_0x6498('0xe'));_0x1e2d8a(_0x1c590e[_0x6498('0x14')][_0x6498('0x13')]);}})[_0x6498('0x15')](function(_0x1b4083){logger[_0x6498('0x11')]('SmsApplication,\x20%s,\x20%s',_0x49b00a,_0x1b4083);_0x2472af(_0x1b4083);});});} \ No newline at end of file +var _0xa2c8=['jayson/promise','client','http','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x23ac3f,_0x3e164a){var _0x4d0589=function(_0x6ad74f){while(--_0x6ad74f){_0x23ac3f['push'](_0x23ac3f['shift']());}};_0x4d0589(++_0x3e164a);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var moment=require(_0x8a2c('0x2'));var BPromise=require(_0x8a2c('0x3'));var rs=require(_0x8a2c('0x4'));var fs=require('fs');var Redis=require(_0x8a2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a2c('0x7'));var client=jayson[_0x8a2c('0x8')][_0x8a2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1031fb,_0x4e007c,_0xe1e335){return new BPromise(function(_0x1d2885,_0x43745f){return client['request'](_0x1031fb,_0xe1e335)['then'](function(_0x4c237a){logger[_0x8a2c('0xa')](_0x8a2c('0xb'),_0x4e007c,'request\x20sent');logger[_0x8a2c('0xc')](_0x8a2c('0xd'),_0x4e007c,_0x8a2c('0xe'),JSON[_0x8a2c('0xf')](_0x4c237a));if(_0x4c237a[_0x8a2c('0x10')]){if(_0x4c237a[_0x8a2c('0x10')]['code']===0x1f4){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x43745f(_0x4c237a[_0x8a2c('0x10')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x1d2885(_0x4c237a[_0x8a2c('0x10')][_0x8a2c('0x11')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x4e007c,_0x8a2c('0xe'));_0x1d2885(_0x4c237a[_0x8a2c('0x12')][_0x8a2c('0x11')]);}})[_0x8a2c('0x13')](function(_0x4388b0){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4388b0);_0x43745f(_0x4388b0);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index dcbbda5..5e7d19d 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 _0x7d4d=['express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','sms','addTags','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','multer','util','path','connect-timeout'];(function(_0x51c388,_0x3b3bfd){var _0x395092=function(_0x38281e){while(--_0x38281e){_0x51c388['push'](_0x51c388['shift']());}};_0x395092(++_0x3b3bfd);}(_0x7d4d,0x170));var _0xd7d4=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0x7d4d[_0x1a3e23];return _0x5ee0d8;};'use strict';var multer=require(_0xd7d4('0x0'));var util=require(_0xd7d4('0x1'));var path=require(_0xd7d4('0x2'));var timeout=require(_0xd7d4('0x3'));var express=require(_0xd7d4('0x4'));var router=express[_0xd7d4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7d4('0x6'));var config=require(_0xd7d4('0x7'));var controller=require(_0xd7d4('0x8'));router['get']('/',auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xa')]);router[_0xd7d4('0xb')](_0xd7d4('0xc'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xd')]);router['get'](_0xd7d4('0xe'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xf')]);router[_0xd7d4('0xb')](_0xd7d4('0x10'),auth[_0xd7d4('0x9')](),controller['getMessages']);router[_0xd7d4('0xb')](_0xd7d4('0x11'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0x12')]);router[_0xd7d4('0x13')]('/',auth[_0xd7d4('0x9')](),controller[_0xd7d4('0x14')]);router[_0xd7d4('0x13')](_0xd7d4('0x10'),auth['isAuthenticated'](),controller[_0xd7d4('0x15')]);router['post'](_0xd7d4('0x16'),auth[_0xd7d4('0x9')](),interaction['tracked'](_0xd7d4('0x17'),'smsinteraction:addtags'),controller[_0xd7d4('0x18')]);router['put'](_0xd7d4('0xe'),auth[_0xd7d4('0x9')](),interaction['tracked'](_0xd7d4('0x17'),_0xd7d4('0x19')),controller[_0xd7d4('0x1a')]);router[_0xd7d4('0x1b')](_0xd7d4('0xe'),auth[_0xd7d4('0x9')](),interaction[_0xd7d4('0x1c')](_0xd7d4('0x17'),_0xd7d4('0x1d')),controller[_0xd7d4('0x1e')]);router[_0xd7d4('0x1b')](_0xd7d4('0x16'),auth[_0xd7d4('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x831c=['describe','/:id','show','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe'];(function(_0x10e3a2,_0x44fcc2){var _0x3d62d5=function(_0x5bdf0f){while(--_0x5bdf0f){_0x10e3a2['push'](_0x10e3a2['shift']());}};_0x3d62d5(++_0x44fcc2);}(_0x831c,0x1e2));var _0xc831=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x831c[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0xc831('0x0'));var util=require(_0xc831('0x1'));var path=require('path');var timeout=require(_0xc831('0x2'));var express=require(_0xc831('0x3'));var router=express[_0xc831('0x4')]();var auth=require(_0xc831('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc831('0x6'));var controller=require(_0xc831('0x7'));router[_0xc831('0x8')]('/',auth[_0xc831('0x9')](),controller['index']);router['get'](_0xc831('0xa'),auth['isAuthenticated'](),controller[_0xc831('0xb')]);router[_0xc831('0x8')](_0xc831('0xc'),auth[_0xc831('0x9')](),controller[_0xc831('0xd')]);router[_0xc831('0x8')](_0xc831('0xe'),auth[_0xc831('0x9')](),controller[_0xc831('0xf')]);router[_0xc831('0x8')](_0xc831('0x10'),auth[_0xc831('0x9')](),controller['download']);router[_0xc831('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xc831('0x11')](_0xc831('0x12'),auth['isAuthenticated'](),interaction[_0xc831('0x13')](_0xc831('0x14'),_0xc831('0x15')),controller[_0xc831('0x16')]);router[_0xc831('0x17')](_0xc831('0xc'),auth[_0xc831('0x9')](),interaction['tracked']('sms',_0xc831('0x18')),controller[_0xc831('0x19')]);router[_0xc831('0x1a')](_0xc831('0xc'),auth[_0xc831('0x9')](),interaction[_0xc831('0x13')](_0xc831('0x14'),_0xc831('0x1b')),controller[_0xc831('0x1c')]);router[_0xc831('0x1a')](_0xc831('0x12'),auth[_0xc831('0x9')](),controller['removeTags']);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 b29426f..d6063a0 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 _0x3ac2=['moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x52598d,_0x355f3d){var _0x471bfe=function(_0x47b62b){while(--_0x47b62b){_0x52598d['push'](_0x52598d['shift']());}};_0x471bfe(++_0x355f3d);}(_0x3ac2,0x198));var _0x23ac=function(_0x410202,_0x5533ff){_0x410202=_0x410202-0x0;var _0xa6ee57=_0x3ac2[_0x410202];return _0xa6ee57;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x23ac('0x0'));module['exports']={'closed':{'type':Sequelize[_0x23ac('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x23ac('0x2')]},'disposition':{'type':Sequelize[_0x23ac('0x3')]},'secondDisposition':{'type':Sequelize[_0x23ac('0x3')]},'thirdDisposition':{'type':Sequelize[_0x23ac('0x3')]},'note':{'type':Sequelize[_0x23ac('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x23ac('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x23ac('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x23ac('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x23ac('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x567e=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x820d7b,_0xa5564c){var _0x249af0=function(_0x5ce8fb){while(--_0x5ce8fb){_0x820d7b['push'](_0x820d7b['shift']());}};_0x249af0(++_0xa5564c);}(_0x567e,0xaa));var _0xe567=function(_0x1c6b26,_0x27d137){_0x1c6b26=_0x1c6b26-0x0;var _0xfb58b2=_0x567e[_0x1c6b26];return _0xfb58b2;};'use strict';var Sequelize=require(_0xe567('0x0'));var moment=require('moment');module[_0xe567('0x1')]={'closed':{'type':Sequelize[_0xe567('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe567('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe567('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe567('0x4')]},'note':{'type':Sequelize[_0xe567('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe567('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe567('0x5')]('in',_0xe567('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 064df44..1615c80 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 861f6db..4e06d77 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 _0x7579=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll'];(function(_0x4f6f19,_0x1ad45d){var _0x19ce80=function(_0x45ef75){while(--_0x45ef75){_0x4f6f19['push'](_0x4f6f19['shift']());}};_0x19ce80(++_0x1ad45d);}(_0x7579,0x1e2));var _0x9757=function(_0x3b7ebf,_0x168461){_0x3b7ebf=_0x3b7ebf-0x0;var _0x2a68f6=_0x7579[_0x3b7ebf];return _0x2a68f6;};'use strict';var EventEmitter=require(_0x9757('0x0'));var SmsInteraction=require(_0x9757('0x1'))['db'][_0x9757('0x2')];var SmsMessage=require(_0x9757('0x1'))['db'][_0x9757('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9757('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9757('0x5'),'afterDestroy':_0x9757('0x6')};function emitEvent(_0xcffaa0){return function(_0x213a7a,_0x4c1a67,_0x2aede4){_0x213a7a[_0x9757('0x7')]({'attributes':['id'],'raw':!![]})[_0x9757('0x8')](function(_0x4b5446){_0x213a7a[_0x9757('0x9')]('Users',_0x4b5446[_0x9757('0xa')](function(_0x2f9867){return{'id':_0x2f9867['id']};}));return SmsMessage[_0x9757('0xb')]({'where':{'SmsInteractionId':_0x213a7a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x375d91){_0x213a7a[_0x9757('0x9')](_0x9757('0xc'),_0x375d91[_0x9757('0xd')]);SmsInteractionEvents[_0x9757('0xe')](_0xcffaa0+':'+_0x213a7a['id'],_0x213a7a);SmsInteractionEvents[_0x9757('0xe')](_0xcffaa0,_0x213a7a);_0x2aede4(null);})[_0x9757('0xf')](_0x2aede4(null));};}for(var e in events){if(events[_0x9757('0x10')](e)){var event=events[e];SmsInteraction[_0x9757('0x11')](e,emitEvent(event));}}module[_0x9757('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x106f=['hook','exports','events','../../mysqldb','SmsMessage','save','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x3ccf60,_0x34d01d){var _0x46c4e3=function(_0x2cd6d2){while(--_0x2cd6d2){_0x3ccf60['push'](_0x3ccf60['shift']());}};_0x46c4e3(++_0x34d01d);}(_0x106f,0x162));var _0xf106=function(_0x5108bd,_0x201ae2){_0x5108bd=_0x5108bd-0x0;var _0x1ec98a=_0x106f[_0x5108bd];return _0x1ec98a;};'use strict';var EventEmitter=require(_0xf106('0x0'));var SmsInteraction=require(_0xf106('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xf106('0x1'))['db'][_0xf106('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf106('0x3'),'afterUpdate':'update','afterDestroy':_0xf106('0x4')};function emitEvent(_0x370f6a){return function(_0x1f2919,_0x318376,_0x253f6d){_0x1f2919[_0xf106('0x5')]({'attributes':['id'],'raw':!![]})[_0xf106('0x6')](function(_0x546acc){_0x1f2919[_0xf106('0x7')](_0xf106('0x8'),_0x546acc['map'](function(_0x4a35bc){return{'id':_0x4a35bc['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1f2919['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x52befe){_0x1f2919[_0xf106('0x7')](_0xf106('0x9'),_0x52befe[_0xf106('0xa')]);SmsInteractionEvents[_0xf106('0xb')](_0x370f6a+':'+_0x1f2919['id'],_0x1f2919);SmsInteractionEvents[_0xf106('0xb')](_0x370f6a,_0x1f2919);_0x253f6d(null);})[_0xf106('0xc')](_0x253f6d(null));};}for(var e in events){if(events[_0xf106('0xd')](e)){var event=events[e];SmsInteraction[_0xf106('0xe')](e,emitEvent(event));}}module[_0xf106('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9cb6b60..49a2b24 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 _0x49e1=['../../config/logger','api','moment','path','rimraf','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x49e1,0x1be));var _0x149e=function(_0x44fdf9,_0x3f3e09){_0x44fdf9=_0x44fdf9-0x0;var _0x8e5072=_0x49e1[_0x44fdf9];return _0x8e5072;};'use strict';var _=require(_0x149e('0x0'));var util=require(_0x149e('0x1'));var logger=require(_0x149e('0x2'))(_0x149e('0x3'));var moment=require(_0x149e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x149e('0x5'));var rimraf=require(_0x149e('0x6'));var config=require('../../config/environment');var attributes=require(_0x149e('0x7'));module['exports']=function(_0xda2d4b,_0x42f57b){return _0xda2d4b[_0x149e('0x8')](_0x149e('0x9'),attributes,{'tableName':_0x149e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x596152,_0x264af7,_0x25c9fb){if(_0x596152[_0x149e('0xb')](_0x149e('0xc'))){_0x596152[_0x149e('0xd')]=moment()[_0x149e('0xe')](_0x149e('0xf'));}_0x25c9fb(null,_0x596152);}}});}; \ No newline at end of file +var _0x4139=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed'];(function(_0x57bef5,_0x2161cf){var _0x5d2eb3=function(_0x28c769){while(--_0x28c769){_0x57bef5['push'](_0x57bef5['shift']());}};_0x5d2eb3(++_0x2161cf);}(_0x4139,0x101));var _0x9413=function(_0x46f071,_0xa83ef3){_0x46f071=_0x46f071-0x0;var _0x3ae2ae=_0x4139[_0x46f071];return _0x3ae2ae;};'use strict';var _=require(_0x9413('0x0'));var util=require('util');var logger=require(_0x9413('0x1'))(_0x9413('0x2'));var moment=require(_0x9413('0x3'));var BPromise=require(_0x9413('0x4'));var rp=require(_0x9413('0x5'));var fs=require('fs');var path=require(_0x9413('0x6'));var rimraf=require(_0x9413('0x7'));var config=require(_0x9413('0x8'));var attributes=require(_0x9413('0x9'));module['exports']=function(_0x11d123,_0x179940){return _0x11d123[_0x9413('0xa')](_0x9413('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3afe24,_0x39474a,_0x2a326e){if(_0x3afe24[_0x9413('0xc')]('closed')){_0x3afe24[_0x9413('0xd')]=moment()['format'](_0x9413('0xe'));}_0x2a326e(null,_0x3afe24);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2906ff8..7fb1395 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 _0x269b=['where','attributes','limit','info','AddTagsToSmsInteraction','find','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw'];(function(_0x4a1d90,_0x172b08){var _0x532165=function(_0x3c2b6a){while(--_0x3c2b6a){_0x4a1d90['push'](_0x4a1d90['shift']());}};_0x532165(++_0x172b08);}(_0x269b,0xb5));var _0xb269=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x269b[_0x500c0];return _0xdd146f;};'use strict';var _=require('lodash');var util=require(_0xb269('0x0'));var moment=require(_0xb269('0x1'));var BPromise=require(_0xb269('0x2'));var rs=require(_0xb269('0x3'));var fs=require('fs');var Redis=require(_0xb269('0x4'));var db=require(_0xb269('0x5'))['db'];var utils=require(_0xb269('0x6'));var logger=require(_0xb269('0x7'))(_0xb269('0x8'));var config=require('../../config/environment');var jayson=require(_0xb269('0x9'));var client=jayson[_0xb269('0xa')]['http']({'port':0x232a});config[_0xb269('0xb')]=_[_0xb269('0xc')](config[_0xb269('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb269('0xd'))(new Redis(config[_0xb269('0xb')]));require(_0xb269('0xe'))[_0xb269('0xf')](socket);function respondWithRpcPromise(_0x1b4e80,_0x3abd58,_0x1f2fd1){return new BPromise(function(_0x572882,_0x2406d3){return client[_0xb269('0x10')](_0x1b4e80,_0x1f2fd1)[_0xb269('0x11')](function(_0x541c9e){logger['info'](_0xb269('0x12'),_0x3abd58,_0xb269('0x13'));logger[_0xb269('0x14')](_0xb269('0x15'),_0x3abd58,_0xb269('0x13'),JSON[_0xb269('0x16')](_0x541c9e));if(_0x541c9e['error']){if(_0x541c9e[_0xb269('0x17')][_0xb269('0x18')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x3abd58,_0x541c9e[_0xb269('0x17')][_0xb269('0x19')]);return _0x2406d3(_0x541c9e[_0xb269('0x17')][_0xb269('0x19')]);}logger[_0xb269('0x17')](_0xb269('0x12'),_0x3abd58,_0x541c9e[_0xb269('0x17')][_0xb269('0x19')]);return _0x572882(_0x541c9e['error'][_0xb269('0x19')]);}else{logger['info'](_0xb269('0x12'),_0x3abd58,_0xb269('0x13'));_0x572882(_0x541c9e[_0xb269('0x1a')][_0xb269('0x19')]);}})[_0xb269('0x1b')](function(_0x3160ef){logger[_0xb269('0x17')](_0xb269('0x12'),_0x3abd58,_0x3160ef);_0x2406d3(_0x3160ef);});});}exports[_0xb269('0x1c')]=function(_0x171f07){var _0xd7fe6f=this;return new Promise(function(_0x288809,_0x3df1ef){return db[_0xb269('0x1d')][_0xb269('0x1e')](_0x171f07[_0xb269('0x1f')],{'raw':_0x171f07[_0xb269('0x20')]?_0x171f07['options'][_0xb269('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171f07['options']?_0x171f07[_0xb269('0x20')][_0xb269('0x22')]||null:null,'attributes':_0x171f07['options']?_0x171f07[_0xb269('0x20')][_0xb269('0x23')]||null:null,'limit':_0x171f07[_0xb269('0x20')]?_0x171f07[_0xb269('0x20')][_0xb269('0x24')]||null:null})[_0xb269('0x11')](function(_0x5c1a29){logger[_0xb269('0x25')]('UpdateSmsInteraction',_0x171f07);logger[_0xb269('0x14')](_0xb269('0x1c'),_0x171f07,JSON[_0xb269('0x16')](_0x5c1a29));_0x288809(_0x5c1a29);})[_0xb269('0x1b')](function(_0x410340){logger[_0xb269('0x17')](_0xb269('0x1c'),_0x410340['message'],_0x171f07);_0x3df1ef(_0xd7fe6f[_0xb269('0x17')](0x1f4,_0x410340['message']));});});};exports[_0xb269('0x26')]=function(_0x28b3ad){return new Promise(function(_0x550856,_0x38acdf){return db['SmsInteraction'][_0xb269('0x27')]({'where':_0x28b3ad['options']?_0x28b3ad['options'][_0xb269('0x22')]||null:null})[_0xb269('0x11')](function(_0x207b79){if(_0x207b79){return _0x207b79['addTags'](_0x28b3ad['body'][_0xb269('0x28')],_[_0xb269('0x29')](_0x28b3ad[_0xb269('0x1f')],[_0xb269('0x28'),'id'])||{});}})['spread'](function(_0x871444){logger['info'](_0xb269('0x2a'),_0x28b3ad);logger[_0xb269('0x14')]('AddTags',_0x28b3ad,JSON['stringify'](_0x871444));_0x550856(_0x871444);})[_0xb269('0x1b')](function(_0x13ad3b){logger['error'](_0xb269('0x2a'),_0x13ad3b[_0xb269('0x19')],_0x28b3ad);_0x38acdf(_this[_0xb269('0x17')](0x1f4,_0x13ad3b[_0xb269('0x19')]));});});}; \ No newline at end of file +var _0xaeb6=['jayson/promise','client','http','redis','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','body','options','where','attributes','limit','catch','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x27b289,_0x212753){var _0x4a81aa=function(_0x1c8faf){while(--_0x1c8faf){_0x27b289['push'](_0x27b289['shift']());}};_0x4a81aa(++_0x212753);}(_0xaeb6,0x115));var _0x6aeb=function(_0x1e8071,_0x54cb69){_0x1e8071=_0x1e8071-0x0;var _0x191472=_0xaeb6[_0x1e8071];return _0x191472;};'use strict';var _=require(_0x6aeb('0x0'));var util=require(_0x6aeb('0x1'));var moment=require(_0x6aeb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6aeb('0x3'));var fs=require('fs');var Redis=require(_0x6aeb('0x4'));var db=require(_0x6aeb('0x5'))['db'];var utils=require(_0x6aeb('0x6'));var logger=require(_0x6aeb('0x7'))(_0x6aeb('0x8'));var config=require(_0x6aeb('0x9'));var jayson=require(_0x6aeb('0xa'));var client=jayson[_0x6aeb('0xb')][_0x6aeb('0xc')]({'port':0x232a});config[_0x6aeb('0xd')]=_['defaults'](config[_0x6aeb('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6aeb('0xe'))(new Redis(config['redis']));require(_0x6aeb('0xf'))[_0x6aeb('0x10')](socket);function respondWithRpcPromise(_0x328026,_0x529417,_0x74a627){return new BPromise(function(_0x21dded,_0x197e11){return client[_0x6aeb('0x11')](_0x328026,_0x74a627)[_0x6aeb('0x12')](function(_0x96236b){logger[_0x6aeb('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x529417,_0x6aeb('0x14'));logger[_0x6aeb('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x529417,_0x6aeb('0x14'),JSON[_0x6aeb('0x16')](_0x96236b));if(_0x96236b[_0x6aeb('0x17')]){if(_0x96236b['error'][_0x6aeb('0x18')]===0x1f4){logger[_0x6aeb('0x17')](_0x6aeb('0x19'),_0x529417,_0x96236b[_0x6aeb('0x17')]['message']);return _0x197e11(_0x96236b[_0x6aeb('0x17')]['message']);}logger[_0x6aeb('0x17')](_0x6aeb('0x19'),_0x529417,_0x96236b[_0x6aeb('0x17')][_0x6aeb('0x1a')]);return _0x21dded(_0x96236b[_0x6aeb('0x17')]['message']);}else{logger[_0x6aeb('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x529417,_0x6aeb('0x14'));_0x21dded(_0x96236b[_0x6aeb('0x1b')][_0x6aeb('0x1a')]);}})['catch'](function(_0x37ba10){logger[_0x6aeb('0x17')](_0x6aeb('0x19'),_0x529417,_0x37ba10);_0x197e11(_0x37ba10);});});}exports[_0x6aeb('0x1c')]=function(_0x6f10bd){var _0x573f69=this;return new Promise(function(_0x1d31b0,_0xd9698b){return db['SmsInteraction']['update'](_0x6f10bd[_0x6aeb('0x1d')],{'raw':_0x6f10bd[_0x6aeb('0x1e')]?_0x6f10bd[_0x6aeb('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f10bd[_0x6aeb('0x1e')]?_0x6f10bd['options'][_0x6aeb('0x1f')]||null:null,'attributes':_0x6f10bd['options']?_0x6f10bd['options'][_0x6aeb('0x20')]||null:null,'limit':_0x6f10bd['options']?_0x6f10bd['options'][_0x6aeb('0x21')]||null:null})[_0x6aeb('0x12')](function(_0x57c85f){logger[_0x6aeb('0x13')](_0x6aeb('0x1c'),_0x6f10bd);logger[_0x6aeb('0x15')](_0x6aeb('0x1c'),_0x6f10bd,JSON[_0x6aeb('0x16')](_0x57c85f));_0x1d31b0(_0x57c85f);})[_0x6aeb('0x22')](function(_0x5c0b4d){logger[_0x6aeb('0x17')](_0x6aeb('0x1c'),_0x5c0b4d[_0x6aeb('0x1a')],_0x6f10bd);_0xd9698b(_0x573f69['error'](0x1f4,_0x5c0b4d['message']));});});};exports[_0x6aeb('0x23')]=function(_0x27f28f){return new Promise(function(_0x3b37c9,_0x4b5e8d){return db[_0x6aeb('0x24')][_0x6aeb('0x25')]({'where':_0x27f28f[_0x6aeb('0x1e')]?_0x27f28f[_0x6aeb('0x1e')][_0x6aeb('0x1f')]||null:null})[_0x6aeb('0x12')](function(_0x7b3f5a){if(_0x7b3f5a){return _0x7b3f5a[_0x6aeb('0x26')](_0x27f28f['body'][_0x6aeb('0x27')],_['omit'](_0x27f28f[_0x6aeb('0x1d')],['ids','id'])||{});}})['spread'](function(_0x41ee78){logger[_0x6aeb('0x13')](_0x6aeb('0x28'),_0x27f28f);logger[_0x6aeb('0x15')](_0x6aeb('0x28'),_0x27f28f,JSON['stringify'](_0x41ee78));_0x3b37c9(_0x41ee78);})[_0x6aeb('0x22')](function(_0x3d899f){logger[_0x6aeb('0x17')](_0x6aeb('0x28'),_0x3d899f[_0x6aeb('0x1a')],_0x27f28f);_0x4b5e8d(_this[_0x6aeb('0x17')](0x1f4,_0x3d899f[_0x6aeb('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4fad4a4..45cda04 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 _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x56386f,_0x5a44eb){var _0x565b42=function(_0x13adeb){while(--_0x13adeb){_0x56386f['push'](_0x56386f['shift']());}};_0x565b42(++_0x5a44eb);}(_0x757a,0xde));var _0xa757=function(_0x4ba0e1,_0x115d1b){_0x4ba0e1=_0x4ba0e1-0x0;var _0x493d6f=_0x757a[_0x4ba0e1];return _0x493d6f;};'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 +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fc435,_0x45eddf){_0x4fc435=_0x4fc435-0x0;var _0x3c5db1=_0xb10b[_0x4fc435];return _0x3c5db1;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d09b5be..15837e7 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 _0x094b=['exports','multer','path','connect-timeout','express','Router','./smsMessage.controller','get','isAuthenticated','index','/:id','post','tracked','sms','create','/:id/status','put','update','accept','/:id/reject','reject','delete'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x094b,0x11f));var _0xb094=function(_0x490cd3,_0x97d5ee){_0x490cd3=_0x490cd3-0x0;var _0x3320d7=_0x094b[_0x490cd3];return _0x3320d7;};'use strict';var multer=require(_0xb094('0x0'));var util=require('util');var path=require(_0xb094('0x1'));var timeout=require(_0xb094('0x2'));var express=require(_0xb094('0x3'));var router=express[_0xb094('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb094('0x5'));router[_0xb094('0x6')]('/',auth[_0xb094('0x7')](),controller[_0xb094('0x8')]);router[_0xb094('0x6')]('/describe',auth[_0xb094('0x7')](),controller['describe']);router['get'](_0xb094('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb094('0xa')]('/',auth[_0xb094('0x7')](),interaction[_0xb094('0xb')](_0xb094('0xc'),'smsmessage:create'),controller[_0xb094('0xd')]);router[_0xb094('0xa')](_0xb094('0xe'),controller['status']);router[_0xb094('0xf')](_0xb094('0x9'),auth['isAuthenticated'](),controller[_0xb094('0x10')]);router[_0xb094('0xf')]('/:id/accept',auth['isAuthenticated'](),controller[_0xb094('0x11')]);router['put'](_0xb094('0x12'),auth[_0xb094('0x7')](),controller[_0xb094('0x13')]);router[_0xb094('0x14')](_0xb094('0x9'),auth[_0xb094('0x7')](),controller['destroy']);module[_0xb094('0x15')]=router; \ No newline at end of file +var _0xe3c9=['/:id','show','post','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dcf93,_0x7061a0){var _0x40f012=function(_0x376220){while(--_0x376220){_0x3dcf93['push'](_0x3dcf93['shift']());}};_0x40f012(++_0x7061a0);}(_0xe3c9,0x197));var _0x9e3c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe3c9[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x9e3c('0x0'));var util=require(_0x9e3c('0x1'));var path=require(_0x9e3c('0x2'));var timeout=require(_0x9e3c('0x3'));var express=require(_0x9e3c('0x4'));var router=express[_0x9e3c('0x5')]();var auth=require(_0x9e3c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e3c('0x7'));router[_0x9e3c('0x8')]('/',auth[_0x9e3c('0x9')](),controller[_0x9e3c('0xa')]);router[_0x9e3c('0x8')](_0x9e3c('0xb'),auth[_0x9e3c('0x9')](),controller[_0x9e3c('0xc')]);router['get'](_0x9e3c('0xd'),auth[_0x9e3c('0x9')](),controller[_0x9e3c('0xe')]);router[_0x9e3c('0xf')]('/',auth[_0x9e3c('0x9')](),interaction['tracked'](_0x9e3c('0x10'),_0x9e3c('0x11')),controller[_0x9e3c('0x12')]);router[_0x9e3c('0xf')](_0x9e3c('0x13'),controller['status']);router[_0x9e3c('0x14')]('/:id',auth[_0x9e3c('0x9')](),controller[_0x9e3c('0x15')]);router[_0x9e3c('0x14')](_0x9e3c('0x16'),auth[_0x9e3c('0x9')](),controller['accept']);router[_0x9e3c('0x14')](_0x9e3c('0x17'),auth['isAuthenticated'](),controller[_0x9e3c('0x18')]);router[_0x9e3c('0x19')](_0x9e3c('0xd'),auth[_0x9e3c('0x9')](),controller[_0x9e3c('0x1a')]);module[_0x9e3c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4440361..d200b5d 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 _0x242f=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x242f,0x1e8));var _0xf242=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0x242f[_0x2e2c1b];return _0x43a4f2;};'use strict';var Sequelize=require(_0xf242('0x0'));module['exports']={'body':{'type':Sequelize[_0xf242('0x1')](_0xf242('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf242('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf242('0x4')]('in',_0xf242('0x5')),'defaultValue':_0xf242('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf242('0x6')]},'readAt':{'type':Sequelize[_0xf242('0x7')]},'secret':{'type':Sequelize[_0xf242('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf242('0x6')]},'providerResponse':{'type':Sequelize[_0xf242('0x1')]}}; \ No newline at end of file +var _0xce45=['out','STRING','DATE','TEXT','medium','BOOLEAN','ENUM'];(function(_0x504d51,_0x4bb9c0){var _0x37b686=function(_0x1f5076){while(--_0x1f5076){_0x504d51['push'](_0x504d51['shift']());}};_0x37b686(++_0x4bb9c0);}(_0xce45,0x192));var _0x5ce4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xce45[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5ce4('0x0')](_0x5ce4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5ce4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5ce4('0x3')]('in',_0x5ce4('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5ce4('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x5ce4('0x6')]},'secret':{'type':Sequelize[_0x5ce4('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5ce4('0x5')]},'providerResponse':{'type':Sequelize[_0x5ce4('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ab36f19..3026a0d 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 _0x09e5=['delivered','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','SmsMessage','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','where','pick','filter','merge','map','includeAll','include','findAll','rows','show','params','length','create','body','find','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','role','interaction','AcceptMessage','manual','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','messageId','indexOf','sent'];(function(_0x3f3118,_0x3aca27){var _0x5c3c17=function(_0x472b43){while(--_0x472b43){_0x3f3118['push'](_0x3f3118['shift']());}};_0x5c3c17(++_0x3aca27);}(_0x09e5,0x119));var _0x509e=function(_0x39e5dd,_0x4cc6e8){_0x39e5dd=_0x39e5dd-0x0;var _0x4dd531=_0x09e5[_0x39e5dd];return _0x4dd531;};'use strict';var pdf=require(_0x509e('0x0'));var emlformat=require(_0x509e('0x1'));var rimraf=require(_0x509e('0x2'));var zipdir=require(_0x509e('0x3'));var jsonpatch=require(_0x509e('0x4'));var rp=require(_0x509e('0x5'));var moment=require(_0x509e('0x6'));var BPromise=require(_0x509e('0x7'));var Mustache=require(_0x509e('0x8'));var util=require(_0x509e('0x9'));var path=require('path');var sox=require(_0x509e('0xa'));var csv=require(_0x509e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x509e('0xc'));var squel=require(_0x509e('0xd'));var crypto=require(_0x509e('0xe'));var jsforce=require(_0x509e('0xf'));var deskjs=require(_0x509e('0x10'));var toCsv=require(_0x509e('0xb'));var querystring=require(_0x509e('0x11'));var Papa=require(_0x509e('0x12'));var Redis=require(_0x509e('0x13'));var authService=require(_0x509e('0x14'));var qs=require(_0x509e('0x15'));var as=require(_0x509e('0x16'));var hardwareService=require(_0x509e('0x17'));var logger=require(_0x509e('0x18'))('api');var utils=require(_0x509e('0x19'));var config=require(_0x509e('0x1a'));var licenseUtil=require(_0x509e('0x1b'));var db=require(_0x509e('0x1c'))['db'];config[_0x509e('0x1d')]=_[_0x509e('0x1e')](config['redis'],{'host':_0x509e('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x509e('0x1d')]));require(_0x509e('0x20'))['register'](socket);var jayson=require(_0x509e('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x509e('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x42a139,_0x10248b,_0x440c5a,_0x3fc0dc){return new BPromise(function(_0x5a2245,_0x4c271c){var _0x4a57e7=_0x3fc0dc||client;return _0x4a57e7[_0x509e('0x23')](_0x42a139,_0x440c5a)['then'](function(_0xe5222a){logger[_0x509e('0x24')](_0x509e('0x25'),_0x10248b,_0x509e('0x26'));logger[_0x509e('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10248b,'request\x20sent',JSON[_0x509e('0x28')](_0xe5222a));if(_0xe5222a['error']){if(_0xe5222a[_0x509e('0x29')][_0x509e('0x2a')]===0x1f4){logger['error'](_0x509e('0x25'),_0x10248b,_0xe5222a[_0x509e('0x29')][_0x509e('0x2b')]);return _0x4c271c(_0xe5222a[_0x509e('0x29')][_0x509e('0x2b')]);}logger['error'](_0x509e('0x25'),_0x10248b,_0xe5222a[_0x509e('0x29')][_0x509e('0x2b')]);return _0x5a2245(_0xe5222a[_0x509e('0x29')][_0x509e('0x2b')]);}else{logger[_0x509e('0x24')](_0x509e('0x25'),_0x10248b,_0x509e('0x26'));_0x5a2245(_0xe5222a[_0x509e('0x2c')][_0x509e('0x2b')]);}})[_0x509e('0x2d')](function(_0x2dd0ad){logger[_0x509e('0x29')](_0x509e('0x25'),_0x10248b,_0x2dd0ad);_0x4c271c(_0x2dd0ad);});});}function respondWithStatusCode(_0x167ba5,_0x1c682b){_0x1c682b=_0x1c682b||0xcc;return function(_0x46bb12){if(_0x46bb12){return _0x167ba5[_0x509e('0x2e')](_0x1c682b);}return _0x167ba5[_0x509e('0x2f')](_0x1c682b)[_0x509e('0x30')]();};}function respondWithResult(_0x347e63,_0x38964a){_0x38964a=_0x38964a||0xc8;return function(_0x2ff8d0){if(_0x2ff8d0){return _0x347e63[_0x509e('0x2f')](_0x38964a)[_0x509e('0x31')](_0x2ff8d0);}};}function respondWithFilteredResult(_0x3937f9,_0x589a42){return function(_0x53530b){if(_0x53530b){var _0x26c825=_0x53530b[_0x509e('0x32')],_0x11c86a=_0x589a42[_0x509e('0x33')],_0x1710f3=_0x589a42[_0x509e('0x33')]+_0x589a42[_0x509e('0x34')],_0xc0f5b6;if(_0x1710f3>=_0x26c825){_0x1710f3=_0x26c825;_0xc0f5b6=0xc8;}else{_0xc0f5b6=0xce;}_0x3937f9[_0x509e('0x2f')](_0xc0f5b6);return _0x3937f9[_0x509e('0x35')](_0x509e('0x36'),_0x11c86a+'-'+_0x1710f3+'/'+_0x26c825)['json'](_0x53530b);}return null;};}function patchUpdates(_0x414df8){return function(_0x17341f){try{jsonpatch[_0x509e('0x37')](_0x17341f,_0x414df8,!![]);}catch(_0xba1cae){return BPromise[_0x509e('0x38')](_0xba1cae);}return _0x17341f[_0x509e('0x39')]();};}function saveUpdates(_0x37eec8,_0x20abf7){return function(_0x8f5c47){if(_0x8f5c47){return _0x8f5c47[_0x509e('0x3a')](_0x37eec8)[_0x509e('0x3b')](function(_0x5af8d3){return _0x5af8d3;});}return null;};}function removeEntity(_0x191e33,_0xc99907){return function(_0x2bece8){if(_0x2bece8){return _0x2bece8[_0x509e('0x3c')]()[_0x509e('0x3b')](function(){_0x191e33[_0x509e('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c32da,_0x280de9){return function(_0x1c590d){if(!_0x1c590d){_0x2c32da[_0x509e('0x2e')](0x194);}return _0x1c590d;};}function handleError(_0x5780db,_0x4b724c){_0x4b724c=_0x4b724c||0x1f4;return function(_0x5ae566){logger['error'](_0x5ae566['stack']);if(_0x5ae566[_0x509e('0x3d')]){delete _0x5ae566[_0x509e('0x3d')];}_0x5780db[_0x509e('0x2f')](_0x4b724c)[_0x509e('0x3e')](_0x5ae566);};}exports['index']=function(_0x2ca129,_0x1c3f7c){var _0x447587={},_0x44c940={},_0x2e19e9={'count':0x0,'rows':[]};var _0x1a3f6b=_['map'](db[_0x509e('0x3f')][_0x509e('0x40')],function(_0x5c72b7){return{'name':_0x5c72b7['fieldName'],'type':_0x5c72b7[_0x509e('0x41')]['key']};});_0x44c940[_0x509e('0x42')]=_['map'](_0x1a3f6b,'name');_0x44c940[_0x509e('0x43')]=_[_0x509e('0x44')](_0x2ca129[_0x509e('0x43')]);_0x44c940[_0x509e('0x45')]=_[_0x509e('0x46')](_0x44c940['model'],_0x44c940[_0x509e('0x43')]);_0x447587['attributes']=_[_0x509e('0x46')](_0x44c940[_0x509e('0x42')],qs[_0x509e('0x47')](_0x2ca129[_0x509e('0x43')][_0x509e('0x47')]));_0x447587[_0x509e('0x48')]=_0x447587[_0x509e('0x48')]['length']?_0x447587['attributes']:_0x44c940[_0x509e('0x42')];if(!_0x2ca129[_0x509e('0x43')]['hasOwnProperty'](_0x509e('0x49'))){_0x447587[_0x509e('0x34')]=qs[_0x509e('0x34')](_0x2ca129['query'][_0x509e('0x34')]);_0x447587[_0x509e('0x33')]=qs[_0x509e('0x33')](_0x2ca129[_0x509e('0x43')]['offset']);}_0x447587[_0x509e('0x4a')]=qs['sort'](_0x2ca129[_0x509e('0x43')]['sort']);_0x447587[_0x509e('0x4b')]=qs[_0x509e('0x45')](_[_0x509e('0x4c')](_0x2ca129[_0x509e('0x43')],_0x44c940[_0x509e('0x45')]),_0x1a3f6b);if(_0x2ca129[_0x509e('0x43')][_0x509e('0x4d')]){_0x447587[_0x509e('0x4b')]=_[_0x509e('0x4e')](_0x447587[_0x509e('0x4b')],{'$or':_[_0x509e('0x4f')](_0x1a3f6b,function(_0x51be66){if(_0x51be66[_0x509e('0x41')]!=='VIRTUAL'){var _0x411fbc={};_0x411fbc[_0x51be66[_0x509e('0x3d')]]={'$like':'%'+_0x2ca129[_0x509e('0x43')][_0x509e('0x4d')]+'%'};return _0x411fbc;}})});}_0x447587=_[_0x509e('0x4e')]({},_0x447587,_0x2ca129['options']);var _0x5e66a0={'where':_0x447587[_0x509e('0x4b')]};return db[_0x509e('0x3f')][_0x509e('0x32')](_0x5e66a0)[_0x509e('0x3b')](function(_0x291dd3){_0x2e19e9[_0x509e('0x32')]=_0x291dd3;if(_0x2ca129[_0x509e('0x43')][_0x509e('0x50')]){_0x447587[_0x509e('0x51')]=[{'all':!![]}];}return db[_0x509e('0x3f')][_0x509e('0x52')](_0x447587);})[_0x509e('0x3b')](function(_0x14ca7f){_0x2e19e9[_0x509e('0x53')]=_0x14ca7f;return _0x2e19e9;})['then'](respondWithFilteredResult(_0x1c3f7c,_0x447587))[_0x509e('0x2d')](handleError(_0x1c3f7c,null));};exports[_0x509e('0x54')]=function(_0x1880f4,_0x13d6d3){var _0x2bda84={'raw':!![],'where':{'id':_0x1880f4[_0x509e('0x55')]['id']}},_0x31d175={};_0x31d175[_0x509e('0x42')]=_[_0x509e('0x44')](db[_0x509e('0x3f')][_0x509e('0x40')]);_0x31d175[_0x509e('0x43')]=_['keys'](_0x1880f4[_0x509e('0x43')]);_0x31d175['filters']=_[_0x509e('0x46')](_0x31d175['model'],_0x31d175['query']);_0x2bda84[_0x509e('0x48')]=_[_0x509e('0x46')](_0x31d175[_0x509e('0x42')],qs[_0x509e('0x47')](_0x1880f4[_0x509e('0x43')]['fields']));_0x2bda84['attributes']=_0x2bda84['attributes'][_0x509e('0x56')]?_0x2bda84[_0x509e('0x48')]:_0x31d175[_0x509e('0x42')];if(_0x1880f4[_0x509e('0x43')][_0x509e('0x50')]){_0x2bda84[_0x509e('0x51')]=[{'all':!![]}];}_0x2bda84=_['merge']({},_0x2bda84,_0x1880f4['options']);return db[_0x509e('0x3f')]['find'](_0x2bda84)['then'](handleEntityNotFound(_0x13d6d3,null))[_0x509e('0x3b')](respondWithResult(_0x13d6d3,null))[_0x509e('0x2d')](handleError(_0x13d6d3,null));};exports[_0x509e('0x57')]=function(_0x3325d3,_0x194c75){return db[_0x509e('0x3f')][_0x509e('0x57')](_0x3325d3['body'],{})[_0x509e('0x3b')](respondWithResult(_0x194c75,0xc9))[_0x509e('0x2d')](handleError(_0x194c75,null));};exports[_0x509e('0x3a')]=function(_0x192d4d,_0x2febf2){if(_0x192d4d[_0x509e('0x58')]['id']){delete _0x192d4d[_0x509e('0x58')]['id'];}return db['SmsMessage'][_0x509e('0x59')]({'where':{'id':_0x192d4d[_0x509e('0x55')]['id']}})[_0x509e('0x3b')](handleEntityNotFound(_0x2febf2,null))['then'](saveUpdates(_0x192d4d[_0x509e('0x58')],null))[_0x509e('0x3b')](respondWithResult(_0x2febf2,null))['catch'](handleError(_0x2febf2,null));};exports[_0x509e('0x3c')]=function(_0x2788f8,_0x3a1449){return db['SmsMessage'][_0x509e('0x59')]({'where':{'id':_0x2788f8[_0x509e('0x55')]['id']}})['then'](handleEntityNotFound(_0x3a1449,null))['then'](removeEntity(_0x3a1449,null))[_0x509e('0x2d')](handleError(_0x3a1449,null));};exports['describe']=function(_0x4ddfd2,_0x45bc16){return db['SmsMessage'][_0x509e('0x5a')]()[_0x509e('0x3b')](respondWithResult(_0x45bc16,null))[_0x509e('0x2d')](handleError(_0x45bc16,null));};var interaction_log=require(_0x509e('0x18'))(_0x509e('0x5b'));exports[_0x509e('0x5c')]=function(_0x3157af,_0x195d58,_0x4d0428){var _0x806886={'agent':{},'channel':_0x509e('0x5d')};if(_0x3157af[_0x509e('0x58')]['id']){delete _0x3157af[_0x509e('0x58')]['id'];}_0x3157af[_0x509e('0x58')][_0x509e('0x5e')]=!![];_0x3157af['body'][_0x509e('0x5f')]=moment()['format'](_0x509e('0x60'));_0x3157af[_0x509e('0x58')][_0x509e('0x61')]=_0x3157af['body'][_0x509e('0x61')]||_0x3157af[_0x509e('0x62')]['id'];_0x806886[_0x509e('0x63')]['id']=_0x3157af['body'][_0x509e('0x61')];return db[_0x509e('0x3f')][_0x509e('0x59')]({'where':{'id':_0x3157af[_0x509e('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x509e('0x64')}]})['then'](handleEntityNotFound(_0x195d58,null))[_0x509e('0x3b')](saveUpdates(_0x3157af[_0x509e('0x58')],null))[_0x509e('0x3b')](function(_0x59cc40){if(_0x59cc40){_0x806886[_0x509e('0x2b')]=_0x59cc40[_0x509e('0x65')]({'plain':!![]});return db[_0x509e('0x66')][_0x509e('0x59')]({'where':{'id':_0x59cc40[_0x509e('0x67')]}});}return null;})[_0x509e('0x3b')](handleEntityNotFound(_0x195d58,null))[_0x509e('0x3b')](function(_0x3d8e36){if(_0x3d8e36){return _0x3d8e36['update']({'UserId':_0x3157af[_0x509e('0x58')][_0x509e('0x61')],'read1stAt':_[_0x509e('0x68')](_0x3d8e36[_0x509e('0x69')])?moment()[_0x509e('0x6a')](_0x509e('0x60')):undefined});}return null;})[_0x509e('0x3b')](function(_0x4decf6){if(_0x4decf6){_0x806886['interaction']=_0x4decf6['get']({'plain':!![]});interaction_log[_0x509e('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3157af[_0x509e('0x62')]['id'],_0x3157af[_0x509e('0x62')][_0x509e('0x3d')],_0x3157af[_0x509e('0x62')][_0x509e('0x6b')],_0x806886[_0x509e('0x6c')]['id'],_0x3157af['body']?JSON['stringify'](_0x3157af['body']):'null');return respondWithRpcPromise(_0x509e('0x6d'),'acceptMessage',_0x806886);}return null;})[_0x509e('0x3b')](function(_0x4c5c66){if(_0x4c5c66){if(_0x3157af[_0x509e('0x58')][_0x509e('0x6e')]){_0x806886[_0x509e('0x2b')]['interface']=util['format']('SIP/%s',_0x3157af[_0x509e('0x62')][_0x509e('0x3d')]);_0x806886[_0x509e('0x2b')][_0x509e('0x6f')]=_0x806886[_0x509e('0x6f')];_0x806886[_0x509e('0x2b')][_0x509e('0x70')]=_0x509e('0x5c');return respondWithRpcPromise(_0x509e('0x71'),'EventManager',{'event':_0x509e('0x72'),'message':_0x806886['message']},client9002)[_0x509e('0x3b')](function(){return _0x806886;});}return _0x806886;}return null;})[_0x509e('0x3b')](respondWithResult(_0x195d58,null))['catch'](handleError(_0x195d58,null));};var interaction_log=require('../../config/logger')(_0x509e('0x5b'));exports[_0x509e('0x38')]=function(_0x31ba47,_0x4a2abb,_0x2c0f73){var _0x1c3d9e={'agent':{},'channel':'sms'};if(_0x31ba47['body']['id']){delete _0x31ba47[_0x509e('0x58')]['id'];}_0x31ba47[_0x509e('0x58')]['UserId']=_0x31ba47[_0x509e('0x58')][_0x509e('0x61')]||_0x31ba47[_0x509e('0x62')]['id'];_0x1c3d9e['agent']['id']=_0x31ba47[_0x509e('0x58')][_0x509e('0x61')];return db[_0x509e('0x3f')]['find']({'where':{'id':_0x31ba47[_0x509e('0x55')]['id'],'UserId':null}})[_0x509e('0x3b')](handleEntityNotFound(_0x4a2abb,null))['then'](function(_0x547624){if(_0x547624){_0x1c3d9e[_0x509e('0x2b')]=_0x547624['get']({'plain':!![]});return db[_0x509e('0x66')][_0x509e('0x59')]({'where':{'id':_0x547624[_0x509e('0x67')]}});}return null;})[_0x509e('0x3b')](handleEntityNotFound(_0x4a2abb,null))['then'](function(_0x3855a0){if(_0x3855a0){_0x1c3d9e[_0x509e('0x6c')]=_0x3855a0[_0x509e('0x65')]({'plain':!![]});interaction_log[_0x509e('0x24')](_0x509e('0x73'),_0x31ba47[_0x509e('0x62')]['id'],_0x31ba47[_0x509e('0x62')][_0x509e('0x3d')],_0x31ba47['user']['role'],_0x1c3d9e[_0x509e('0x6c')]['id'],_0x31ba47[_0x509e('0x58')]?JSON[_0x509e('0x28')](_0x31ba47[_0x509e('0x58')]):'null');return respondWithRpcPromise(_0x509e('0x74'),_0x509e('0x75'),_0x1c3d9e);}return null;})[_0x509e('0x3b')](function(_0x1b4454){if(_0x1b4454){_0x1b4454[_0x509e('0x2b')][_0x509e('0x76')]=util[_0x509e('0x6a')](_0x509e('0x77'),_0x31ba47[_0x509e('0x62')][_0x509e('0x3d')]);_0x1b4454[_0x509e('0x2b')]['channel']=_0x1c3d9e['channel'];_0x1b4454[_0x509e('0x2b')][_0x509e('0x70')]=_0x509e('0x38');respondWithRpcPromise(_0x509e('0x71'),_0x509e('0x71'),{'event':_0x509e('0x78'),'message':_0x1b4454['message']},client9002);return _0x1c3d9e;}return null;})[_0x509e('0x3b')](respondWithResult(_0x4a2abb,null))[_0x509e('0x2d')](handleError(_0x4a2abb,null));};exports[_0x509e('0x2f')]=function(_0x22cdd7,_0x39566d,_0x299317){if(_0x22cdd7['body']['id']){delete _0x22cdd7[_0x509e('0x58')]['id'];}var _0x1e46fb;return db['SmsMessage']['find']({'where':{'id':_0x22cdd7[_0x509e('0x55')]['id']}})[_0x509e('0x3b')](handleEntityNotFound(_0x39566d,null))[_0x509e('0x3b')](function(_0x540350){if(_0x540350){_0x1e46fb=_0x540350;return db[_0x509e('0x79')]['find']({'where':{'id':_0x540350[_0x509e('0x7a')]}});}})['then'](handleEntityNotFound(_0x39566d,null))[_0x509e('0x3b')](function(_0x1a9390){if(_0x1a9390){logger[_0x509e('0x27')](_0x509e('0x7b'),_0x509e('0x2f'),_0x509e('0x7c'),_0x1a9390['type'],util['inspect'](_0x22cdd7[_0x509e('0x58')],{'showHidden':![],'depth':null}));switch(_0x1a9390[_0x509e('0x41')]){case _0x509e('0x7d'):if(_0x22cdd7[_0x509e('0x58')][_0x509e('0x7e')]&&_0x22cdd7[_0x509e('0x58')][_0x509e('0x7e')]===_0x1e46fb['messageId']){return _0x1e46fb[_0x509e('0x3a')]({'read':!![]});}else{logger[_0x509e('0x29')](_0x509e('0x7f'),_0x509e('0x2f'),_0x509e('0x7d'),util[_0x509e('0x80')](_0x22cdd7['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x22cdd7['body'][_0x509e('0x81')]&&_0x22cdd7[_0x509e('0x58')][_0x509e('0x81')]===_0x1e46fb[_0x509e('0x82')]&&_[_0x509e('0x83')]([_0x509e('0x84'),_0x509e('0x85')],_0x22cdd7[_0x509e('0x58')]['Status'])>=0x0){return _0x1e46fb[_0x509e('0x3a')]({'read':!![]});}else{logger[_0x509e('0x29')](_0x509e('0x7f'),'status','plivio',util[_0x509e('0x80')](_0x22cdd7[_0x509e('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x70e158=_0x22cdd7['body'][_0x509e('0x86')][0x0];if(_0x70e158['status'][_0x509e('0x87')]===_0x509e('0x88')){return _0x1e46fb[_0x509e('0x3a')]({'read':!![]});}else{logger[_0x509e('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x509e('0x2f'),_0x509e('0x89'),util[_0x509e('0x80')](_0x22cdd7[_0x509e('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x1e46fb;}})[_0x509e('0x3b')](respondWithResult(_0x39566d,null))[_0x509e('0x2d')](handleError(_0x39566d,null));}; \ No newline at end of file +var _0x3aaf=['sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','SmsInteraction','SmsInteractionId','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','describe'];(function(_0x1059cc,_0x5ce414){var _0x28dd79=function(_0x2dbd80){while(--_0x2dbd80){_0x1059cc['push'](_0x1059cc['shift']());}};_0x28dd79(++_0x5ce414);}(_0x3aaf,0xbf));var _0xf3aa=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x3aaf[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf3aa('0x0'));var rimraf=require(_0xf3aa('0x1'));var zipdir=require(_0xf3aa('0x2'));var jsonpatch=require(_0xf3aa('0x3'));var rp=require(_0xf3aa('0x4'));var moment=require(_0xf3aa('0x5'));var BPromise=require(_0xf3aa('0x6'));var Mustache=require(_0xf3aa('0x7'));var util=require(_0xf3aa('0x8'));var path=require(_0xf3aa('0x9'));var sox=require(_0xf3aa('0xa'));var csv=require(_0xf3aa('0xb'));var ejs=require(_0xf3aa('0xc'));var fs=require('fs');var _=require(_0xf3aa('0xd'));var squel=require(_0xf3aa('0xe'));var crypto=require('crypto');var jsforce=require(_0xf3aa('0xf'));var deskjs=require(_0xf3aa('0x10'));var toCsv=require(_0xf3aa('0xb'));var querystring=require('querystring');var Papa=require(_0xf3aa('0x11'));var Redis=require(_0xf3aa('0x12'));var authService=require(_0xf3aa('0x13'));var qs=require(_0xf3aa('0x14'));var as=require(_0xf3aa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3aa('0x16'))(_0xf3aa('0x17'));var utils=require('../../config/utils');var config=require(_0xf3aa('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3aa('0x19'))['db'];config[_0xf3aa('0x1a')]=_[_0xf3aa('0x1b')](config[_0xf3aa('0x1a')],{'host':_0xf3aa('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3aa('0x1a')]));require(_0xf3aa('0x1d'))[_0xf3aa('0x1e')](socket);var jayson=require(_0xf3aa('0x1f'));var client=jayson[_0xf3aa('0x20')][_0xf3aa('0x21')]({'port':0x232c});var client9002=jayson[_0xf3aa('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e06c7,_0x2da228,_0x269b0a,_0x1fff21){return new BPromise(function(_0x59dda4,_0x4c77fb){var _0x1584d3=_0x1fff21||client;return _0x1584d3['request'](_0x2e06c7,_0x269b0a)['then'](function(_0x1afa0c){logger['info'](_0xf3aa('0x22'),_0x2da228,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2da228,_0xf3aa('0x23'),JSON['stringify'](_0x1afa0c));if(_0x1afa0c[_0xf3aa('0x24')]){if(_0x1afa0c[_0xf3aa('0x24')][_0xf3aa('0x25')]===0x1f4){logger[_0xf3aa('0x24')]('SmsMessage,\x20%s,\x20%s',_0x2da228,_0x1afa0c[_0xf3aa('0x24')][_0xf3aa('0x26')]);return _0x4c77fb(_0x1afa0c[_0xf3aa('0x24')]['message']);}logger[_0xf3aa('0x24')]('SmsMessage,\x20%s,\x20%s',_0x2da228,_0x1afa0c[_0xf3aa('0x24')][_0xf3aa('0x26')]);return _0x59dda4(_0x1afa0c[_0xf3aa('0x24')][_0xf3aa('0x26')]);}else{logger['info'](_0xf3aa('0x22'),_0x2da228,'request\x20sent');_0x59dda4(_0x1afa0c[_0xf3aa('0x27')][_0xf3aa('0x26')]);}})['catch'](function(_0x690f17){logger['error'](_0xf3aa('0x22'),_0x2da228,_0x690f17);_0x4c77fb(_0x690f17);});});}function respondWithStatusCode(_0x3f25c8,_0x58c802){_0x58c802=_0x58c802||0xcc;return function(_0x5759d0){if(_0x5759d0){return _0x3f25c8[_0xf3aa('0x28')](_0x58c802);}return _0x3f25c8['status'](_0x58c802)['end']();};}function respondWithResult(_0x5b4a88,_0x102ec1){_0x102ec1=_0x102ec1||0xc8;return function(_0x2fd18b){if(_0x2fd18b){return _0x5b4a88[_0xf3aa('0x29')](_0x102ec1)[_0xf3aa('0x2a')](_0x2fd18b);}};}function respondWithFilteredResult(_0x327c2b,_0x66bb55){return function(_0x37c9cd){if(_0x37c9cd){var _0x1a1452=_0x37c9cd[_0xf3aa('0x2b')],_0x1108c7=_0x66bb55['offset'],_0x19f763=_0x66bb55[_0xf3aa('0x2c')]+_0x66bb55['limit'],_0x2cb0fa;if(_0x19f763>=_0x1a1452){_0x19f763=_0x1a1452;_0x2cb0fa=0xc8;}else{_0x2cb0fa=0xce;}_0x327c2b[_0xf3aa('0x29')](_0x2cb0fa);return _0x327c2b[_0xf3aa('0x2d')](_0xf3aa('0x2e'),_0x1108c7+'-'+_0x19f763+'/'+_0x1a1452)[_0xf3aa('0x2a')](_0x37c9cd);}return null;};}function patchUpdates(_0x3765d5){return function(_0x2c105a){try{jsonpatch[_0xf3aa('0x2f')](_0x2c105a,_0x3765d5,!![]);}catch(_0x4a5c27){return BPromise[_0xf3aa('0x30')](_0x4a5c27);}return _0x2c105a['save']();};}function saveUpdates(_0x5df852,_0x512092){return function(_0x4989d3){if(_0x4989d3){return _0x4989d3[_0xf3aa('0x31')](_0x5df852)['then'](function(_0x29c8e1){return _0x29c8e1;});}return null;};}function removeEntity(_0x278ea9,_0x308d9b){return function(_0x32a4af){if(_0x32a4af){return _0x32a4af[_0xf3aa('0x32')]()[_0xf3aa('0x33')](function(){_0x278ea9[_0xf3aa('0x29')](0xcc)[_0xf3aa('0x34')]();});}};}function handleEntityNotFound(_0x1c4b44,_0x1c3de1){return function(_0x149211){if(!_0x149211){_0x1c4b44['sendStatus'](0x194);}return _0x149211;};}function handleError(_0x3f5d7a,_0x9da67d){_0x9da67d=_0x9da67d||0x1f4;return function(_0x5a1044){logger[_0xf3aa('0x24')](_0x5a1044[_0xf3aa('0x35')]);if(_0x5a1044[_0xf3aa('0x36')]){delete _0x5a1044[_0xf3aa('0x36')];}_0x3f5d7a['status'](_0x9da67d)[_0xf3aa('0x37')](_0x5a1044);};}exports[_0xf3aa('0x38')]=function(_0x4f97f6,_0x1b19de){var _0x1f3ba2={},_0x2f27c3={},_0x488d86={'count':0x0,'rows':[]};var _0x1ec49f=_[_0xf3aa('0x39')](db[_0xf3aa('0x3a')][_0xf3aa('0x3b')],function(_0x48943d){return{'name':_0x48943d[_0xf3aa('0x3c')],'type':_0x48943d[_0xf3aa('0x3d')][_0xf3aa('0x3e')]};});_0x2f27c3[_0xf3aa('0x3f')]=_[_0xf3aa('0x39')](_0x1ec49f,'name');_0x2f27c3[_0xf3aa('0x40')]=_['keys'](_0x4f97f6[_0xf3aa('0x40')]);_0x2f27c3[_0xf3aa('0x41')]=_['intersection'](_0x2f27c3[_0xf3aa('0x3f')],_0x2f27c3['query']);_0x1f3ba2[_0xf3aa('0x42')]=_['intersection'](_0x2f27c3['model'],qs[_0xf3aa('0x43')](_0x4f97f6[_0xf3aa('0x40')]['fields']));_0x1f3ba2[_0xf3aa('0x42')]=_0x1f3ba2[_0xf3aa('0x42')][_0xf3aa('0x44')]?_0x1f3ba2['attributes']:_0x2f27c3[_0xf3aa('0x3f')];if(!_0x4f97f6['query'][_0xf3aa('0x45')](_0xf3aa('0x46'))){_0x1f3ba2['limit']=qs['limit'](_0x4f97f6['query'][_0xf3aa('0x47')]);_0x1f3ba2[_0xf3aa('0x2c')]=qs[_0xf3aa('0x2c')](_0x4f97f6['query'][_0xf3aa('0x2c')]);}_0x1f3ba2[_0xf3aa('0x48')]=qs[_0xf3aa('0x49')](_0x4f97f6[_0xf3aa('0x40')][_0xf3aa('0x49')]);_0x1f3ba2[_0xf3aa('0x4a')]=qs['filters'](_[_0xf3aa('0x4b')](_0x4f97f6[_0xf3aa('0x40')],_0x2f27c3['filters']),_0x1ec49f);if(_0x4f97f6[_0xf3aa('0x40')][_0xf3aa('0x4c')]){_0x1f3ba2['where']=_[_0xf3aa('0x4d')](_0x1f3ba2[_0xf3aa('0x4a')],{'$or':_[_0xf3aa('0x39')](_0x1ec49f,function(_0x559d2d){if(_0x559d2d['type']!==_0xf3aa('0x4e')){var _0x1762af={};_0x1762af[_0x559d2d[_0xf3aa('0x36')]]={'$like':'%'+_0x4f97f6['query'][_0xf3aa('0x4c')]+'%'};return _0x1762af;}})});}_0x1f3ba2=_['merge']({},_0x1f3ba2,_0x4f97f6[_0xf3aa('0x4f')]);var _0x56a6a9={'where':_0x1f3ba2['where']};return db[_0xf3aa('0x3a')]['count'](_0x56a6a9)[_0xf3aa('0x33')](function(_0x3fa2f4){_0x488d86[_0xf3aa('0x2b')]=_0x3fa2f4;if(_0x4f97f6[_0xf3aa('0x40')][_0xf3aa('0x50')]){_0x1f3ba2[_0xf3aa('0x51')]=[{'all':!![]}];}return db[_0xf3aa('0x3a')][_0xf3aa('0x52')](_0x1f3ba2);})[_0xf3aa('0x33')](function(_0x274df5){_0x488d86[_0xf3aa('0x53')]=_0x274df5;return _0x488d86;})[_0xf3aa('0x33')](respondWithFilteredResult(_0x1b19de,_0x1f3ba2))[_0xf3aa('0x54')](handleError(_0x1b19de,null));};exports[_0xf3aa('0x55')]=function(_0x11c516,_0x441e27){var _0x5108af={'raw':!![],'where':{'id':_0x11c516[_0xf3aa('0x56')]['id']}},_0x3fa930={};_0x3fa930['model']=_[_0xf3aa('0x57')](db[_0xf3aa('0x3a')][_0xf3aa('0x3b')]);_0x3fa930['query']=_[_0xf3aa('0x57')](_0x11c516[_0xf3aa('0x40')]);_0x3fa930[_0xf3aa('0x41')]=_[_0xf3aa('0x58')](_0x3fa930[_0xf3aa('0x3f')],_0x3fa930[_0xf3aa('0x40')]);_0x5108af['attributes']=_['intersection'](_0x3fa930['model'],qs['fields'](_0x11c516['query']['fields']));_0x5108af[_0xf3aa('0x42')]=_0x5108af[_0xf3aa('0x42')][_0xf3aa('0x44')]?_0x5108af[_0xf3aa('0x42')]:_0x3fa930[_0xf3aa('0x3f')];if(_0x11c516[_0xf3aa('0x40')]['includeAll']){_0x5108af['include']=[{'all':!![]}];}_0x5108af=_[_0xf3aa('0x4d')]({},_0x5108af,_0x11c516[_0xf3aa('0x4f')]);return db[_0xf3aa('0x3a')][_0xf3aa('0x59')](_0x5108af)[_0xf3aa('0x33')](handleEntityNotFound(_0x441e27,null))[_0xf3aa('0x33')](respondWithResult(_0x441e27,null))[_0xf3aa('0x54')](handleError(_0x441e27,null));};exports[_0xf3aa('0x5a')]=function(_0x4d9c84,_0x18c838){return db[_0xf3aa('0x3a')][_0xf3aa('0x5a')](_0x4d9c84[_0xf3aa('0x5b')],{})[_0xf3aa('0x33')](respondWithResult(_0x18c838,0xc9))[_0xf3aa('0x54')](handleError(_0x18c838,null));};exports[_0xf3aa('0x31')]=function(_0x29aaac,_0x2c17f3){if(_0x29aaac[_0xf3aa('0x5b')]['id']){delete _0x29aaac[_0xf3aa('0x5b')]['id'];}return db[_0xf3aa('0x3a')][_0xf3aa('0x59')]({'where':{'id':_0x29aaac[_0xf3aa('0x56')]['id']}})[_0xf3aa('0x33')](handleEntityNotFound(_0x2c17f3,null))[_0xf3aa('0x33')](saveUpdates(_0x29aaac[_0xf3aa('0x5b')],null))[_0xf3aa('0x33')](respondWithResult(_0x2c17f3,null))[_0xf3aa('0x54')](handleError(_0x2c17f3,null));};exports[_0xf3aa('0x32')]=function(_0x5a9958,_0xcf9a99){return db[_0xf3aa('0x3a')][_0xf3aa('0x59')]({'where':{'id':_0x5a9958[_0xf3aa('0x56')]['id']}})[_0xf3aa('0x33')](handleEntityNotFound(_0xcf9a99,null))[_0xf3aa('0x33')](removeEntity(_0xcf9a99,null))[_0xf3aa('0x54')](handleError(_0xcf9a99,null));};exports['describe']=function(_0x403e56,_0xcbbf2f){return db[_0xf3aa('0x3a')][_0xf3aa('0x5c')]()[_0xf3aa('0x33')](respondWithResult(_0xcbbf2f,null))['catch'](handleError(_0xcbbf2f,null));};var interaction_log=require(_0xf3aa('0x16'))(_0xf3aa('0x5d'));exports[_0xf3aa('0x5e')]=function(_0x1c27c8,_0xaad47f,_0x261c6b){var _0x6edccf={'agent':{},'channel':_0xf3aa('0x5f')};if(_0x1c27c8[_0xf3aa('0x5b')]['id']){delete _0x1c27c8[_0xf3aa('0x5b')]['id'];}_0x1c27c8[_0xf3aa('0x5b')]['read']=!![];_0x1c27c8[_0xf3aa('0x5b')]['readAt']=moment()[_0xf3aa('0x60')](_0xf3aa('0x61'));_0x1c27c8[_0xf3aa('0x5b')][_0xf3aa('0x62')]=_0x1c27c8[_0xf3aa('0x5b')]['UserId']||_0x1c27c8[_0xf3aa('0x63')]['id'];_0x6edccf[_0xf3aa('0x64')]['id']=_0x1c27c8[_0xf3aa('0x5b')][_0xf3aa('0x62')];return db[_0xf3aa('0x3a')]['find']({'where':{'id':_0x1c27c8[_0xf3aa('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xf3aa('0x65')],'as':_0xf3aa('0x66')}]})[_0xf3aa('0x33')](handleEntityNotFound(_0xaad47f,null))[_0xf3aa('0x33')](saveUpdates(_0x1c27c8[_0xf3aa('0x5b')],null))[_0xf3aa('0x33')](function(_0x337b0b){if(_0x337b0b){_0x6edccf['message']=_0x337b0b[_0xf3aa('0x67')]({'plain':!![]});return db[_0xf3aa('0x68')][_0xf3aa('0x59')]({'where':{'id':_0x337b0b[_0xf3aa('0x69')]}});}return null;})[_0xf3aa('0x33')](handleEntityNotFound(_0xaad47f,null))['then'](function(_0x1959be){if(_0x1959be){return _0x1959be[_0xf3aa('0x31')]({'UserId':_0x1c27c8['body'][_0xf3aa('0x62')],'read1stAt':_['isNil'](_0x1959be['read1stAt'])?moment()[_0xf3aa('0x60')](_0xf3aa('0x61')):undefined});}return null;})[_0xf3aa('0x33')](function(_0x447c7d){if(_0x447c7d){_0x6edccf['interaction']=_0x447c7d[_0xf3aa('0x67')]({'plain':!![]});interaction_log[_0xf3aa('0x6a')](_0xf3aa('0x6b'),_0x1c27c8[_0xf3aa('0x63')]['id'],_0x1c27c8[_0xf3aa('0x63')]['name'],_0x1c27c8[_0xf3aa('0x63')]['role'],_0x6edccf['interaction']['id'],_0x1c27c8[_0xf3aa('0x5b')]?JSON[_0xf3aa('0x6c')](_0x1c27c8[_0xf3aa('0x5b')]):_0xf3aa('0x6d'));return respondWithRpcPromise(_0xf3aa('0x6e'),_0xf3aa('0x6f'),_0x6edccf);}return null;})[_0xf3aa('0x33')](function(_0x2c607c){if(_0x2c607c){if(_0x1c27c8[_0xf3aa('0x5b')][_0xf3aa('0x70')]){_0x6edccf[_0xf3aa('0x26')][_0xf3aa('0x71')]=util[_0xf3aa('0x60')](_0xf3aa('0x72'),_0x1c27c8[_0xf3aa('0x63')][_0xf3aa('0x36')]);_0x6edccf[_0xf3aa('0x26')][_0xf3aa('0x73')]=_0x6edccf['channel'];_0x6edccf[_0xf3aa('0x26')][_0xf3aa('0x74')]=_0xf3aa('0x5e');return respondWithRpcPromise(_0xf3aa('0x75'),_0xf3aa('0x75'),{'event':_0xf3aa('0x76'),'message':_0x6edccf['message']},client9002)[_0xf3aa('0x33')](function(){return _0x6edccf;});}return _0x6edccf;}return null;})[_0xf3aa('0x33')](respondWithResult(_0xaad47f,null))['catch'](handleError(_0xaad47f,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xf3aa('0x30')]=function(_0x574e8d,_0x202e67,_0x15d5a5){var _0xcdb4f0={'agent':{},'channel':_0xf3aa('0x5f')};if(_0x574e8d[_0xf3aa('0x5b')]['id']){delete _0x574e8d['body']['id'];}_0x574e8d[_0xf3aa('0x5b')][_0xf3aa('0x62')]=_0x574e8d['body']['UserId']||_0x574e8d['user']['id'];_0xcdb4f0[_0xf3aa('0x64')]['id']=_0x574e8d[_0xf3aa('0x5b')][_0xf3aa('0x62')];return db[_0xf3aa('0x3a')]['find']({'where':{'id':_0x574e8d[_0xf3aa('0x56')]['id'],'UserId':null}})[_0xf3aa('0x33')](handleEntityNotFound(_0x202e67,null))[_0xf3aa('0x33')](function(_0x43b43d){if(_0x43b43d){_0xcdb4f0[_0xf3aa('0x26')]=_0x43b43d[_0xf3aa('0x67')]({'plain':!![]});return db['SmsInteraction'][_0xf3aa('0x59')]({'where':{'id':_0x43b43d[_0xf3aa('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x202e67,null))[_0xf3aa('0x33')](function(_0x2fe68a){if(_0x2fe68a){_0xcdb4f0[_0xf3aa('0x77')]=_0x2fe68a['get']({'plain':!![]});interaction_log[_0xf3aa('0x6a')](_0xf3aa('0x78'),_0x574e8d[_0xf3aa('0x63')]['id'],_0x574e8d['user'][_0xf3aa('0x36')],_0x574e8d[_0xf3aa('0x63')][_0xf3aa('0x79')],_0xcdb4f0[_0xf3aa('0x77')]['id'],_0x574e8d[_0xf3aa('0x5b')]?JSON[_0xf3aa('0x6c')](_0x574e8d[_0xf3aa('0x5b')]):_0xf3aa('0x6d'));return respondWithRpcPromise(_0xf3aa('0x7a'),_0xf3aa('0x7b'),_0xcdb4f0);}return null;})[_0xf3aa('0x33')](function(_0x4304d0){if(_0x4304d0){_0x4304d0[_0xf3aa('0x26')][_0xf3aa('0x71')]=util[_0xf3aa('0x60')](_0xf3aa('0x72'),_0x574e8d[_0xf3aa('0x63')][_0xf3aa('0x36')]);_0x4304d0[_0xf3aa('0x26')][_0xf3aa('0x73')]=_0xcdb4f0[_0xf3aa('0x73')];_0x4304d0[_0xf3aa('0x26')][_0xf3aa('0x74')]=_0xf3aa('0x30');respondWithRpcPromise(_0xf3aa('0x75'),'EventManager',{'event':'rejectmessage','message':_0x4304d0['message']},client9002);return _0xcdb4f0;}return null;})['then'](respondWithResult(_0x202e67,null))[_0xf3aa('0x54')](handleError(_0x202e67,null));};exports[_0xf3aa('0x29')]=function(_0x1cefc6,_0x491df5,_0x1f4294){if(_0x1cefc6[_0xf3aa('0x5b')]['id']){delete _0x1cefc6[_0xf3aa('0x5b')]['id'];}var _0x49ec12;return db[_0xf3aa('0x3a')]['find']({'where':{'id':_0x1cefc6[_0xf3aa('0x56')]['id']}})[_0xf3aa('0x33')](handleEntityNotFound(_0x491df5,null))[_0xf3aa('0x33')](function(_0x123003){if(_0x123003){_0x49ec12=_0x123003;return db[_0xf3aa('0x7c')][_0xf3aa('0x59')]({'where':{'id':_0x123003[_0xf3aa('0x7d')]}});}})[_0xf3aa('0x33')](handleEntityNotFound(_0x491df5,null))[_0xf3aa('0x33')](function(_0x2f681f){if(_0x2f681f){logger[_0xf3aa('0x7e')](_0xf3aa('0x7f'),_0xf3aa('0x29'),'received\x20delivery\x20report\x20from',_0x2f681f[_0xf3aa('0x3d')],util[_0xf3aa('0x80')](_0x1cefc6[_0xf3aa('0x5b')],{'showHidden':![],'depth':null}));switch(_0x2f681f['type']){case _0xf3aa('0x81'):if(_0x1cefc6[_0xf3aa('0x5b')][_0xf3aa('0x82')]&&_0x1cefc6[_0xf3aa('0x5b')][_0xf3aa('0x82')]===_0x49ec12['messageId']){return _0x49ec12[_0xf3aa('0x31')]({'read':!![]});}else{logger[_0xf3aa('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf3aa('0x29'),_0xf3aa('0x81'),util[_0xf3aa('0x80')](_0x1cefc6['body'],{'showHidden':![],'depth':null}));}break;case _0xf3aa('0x83'):if(_0x1cefc6[_0xf3aa('0x5b')][_0xf3aa('0x84')]&&_0x1cefc6[_0xf3aa('0x5b')][_0xf3aa('0x84')]===_0x49ec12[_0xf3aa('0x85')]&&_[_0xf3aa('0x86')]([_0xf3aa('0x87'),'delivered'],_0x1cefc6[_0xf3aa('0x5b')]['Status'])>=0x0){return _0x49ec12[_0xf3aa('0x31')]({'read':!![]});}else{logger[_0xf3aa('0x24')](_0xf3aa('0x88'),'status',_0xf3aa('0x89'),util['inspect'](_0x1cefc6[_0xf3aa('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe77852=_0x1cefc6[_0xf3aa('0x5b')][_0xf3aa('0x8a')][0x0];if(_0xe77852[_0xf3aa('0x29')][_0xf3aa('0x8b')]===_0xf3aa('0x8c')){return _0x49ec12['update']({'read':!![]});}else{logger['error'](_0xf3aa('0x88'),'status',_0xf3aa('0x8d'),util[_0xf3aa('0x80')](_0x1cefc6[_0xf3aa('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x49ec12;}})['then'](respondWithResult(_0x491df5,null))[_0xf3aa('0x54')](handleError(_0x491df5,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 40699be..8621417 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 _0x82e7=['emit','hasOwnProperty','hook','SmsMessage','setMaxListeners','save','update'];(function(_0x39f1ea,_0x10809c){var _0x346c06=function(_0x3d82c5){while(--_0x3d82c5){_0x39f1ea['push'](_0x39f1ea['shift']());}};_0x346c06(++_0x10809c);}(_0x82e7,0xc0));var _0x782e=function(_0x375b8b,_0x1d7939){_0x375b8b=_0x375b8b-0x0;var _0x1ef2f7=_0x82e7[_0x375b8b];return _0x1ef2f7;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x782e('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x782e('0x1')](0x0);var events={'afterCreate':_0x782e('0x2'),'afterUpdate':_0x782e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x475c44){return function(_0x4a3ec0,_0x4b32c3,_0x2c86b9){SmsMessageEvents[_0x782e('0x4')](_0x475c44+':'+_0x4a3ec0['id'],_0x4a3ec0);SmsMessageEvents['emit'](_0x475c44,_0x4a3ec0);_0x2c86b9(null);};}for(var e in events){if(events[_0x782e('0x5')](e)){var event=events[e];SmsMessage[_0x782e('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x4b65=['hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','emit'];(function(_0x28eedc,_0x176917){var _0x575e59=function(_0x40f58d){while(--_0x40f58d){_0x28eedc['push'](_0x28eedc['shift']());}};_0x575e59(++_0x176917);}(_0x4b65,0x95));var _0x54b6=function(_0x314cfb,_0x35ca09){_0x314cfb=_0x314cfb-0x0;var _0x4f5531=_0x4b65[_0x314cfb];return _0x4f5531;};'use strict';var EventEmitter=require(_0x54b6('0x0'));var SmsMessage=require(_0x54b6('0x1'))['db'][_0x54b6('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x54b6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x274734){return function(_0x26652a,_0x57ec92,_0x2ad301){SmsMessageEvents[_0x54b6('0x4')](_0x274734+':'+_0x26652a['id'],_0x26652a);SmsMessageEvents[_0x54b6('0x4')](_0x274734,_0x26652a);_0x2ad301(null);};}for(var e in events){if(events[_0x54b6('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x54b6('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d50d7dd..338d63b 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 _0x5c36=['createdAt','toLowerCase','catch','error','SmsAccount','type','twilio','accountSid','authToken','phone','messages','create','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','head','message_id','clickSend','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/api/sms/messages/','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','keys','sort','length','createHash','md5','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','application/json','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','findOne','then','update'];(function(_0x3e2fcb,_0x24ff7a){var _0x57eeb1=function(_0x5ab729){while(--_0x5ab729){_0x3e2fcb['push'](_0x3e2fcb['shift']());}};_0x57eeb1(++_0x24ff7a);}(_0x5c36,0x151));var _0x65c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5c36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x65c3('0x0'));var util=require(_0x65c3('0x1'));var logger=require(_0x65c3('0x2'))(_0x65c3('0x3'));var moment=require(_0x65c3('0x4'));var BPromise=require(_0x65c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65c3('0x6'));var rimraf=require(_0x65c3('0x7'));var config=require(_0x65c3('0x8'));var attributes=require(_0x65c3('0x9'));module[_0x65c3('0xa')]=function(_0x1787dc,_0x1cf41e){return _0x1787dc[_0x65c3('0xb')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x65c3('0xc'),'fields':[_0x65c3('0xc')]},{'name':_0x65c3('0xd'),'fields':[_0x65c3('0xe')],'type':_0x65c3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c2235,_0x420367,_0x60938d){var _0x56fe22=_0x1787dc[_0x65c3('0x10')];var _0x10fd8f=_0x5c2235[_0x65c3('0x11')]({'plain':!![]});if(_0x10fd8f[_0x65c3('0x12')]['toLowerCase']()==='in'||_0x10fd8f[_0x65c3('0x12')]['toLowerCase']()===_0x65c3('0x13')&&!_0x10fd8f[_0x65c3('0x14')]&&!_[_0x65c3('0x15')](_0x10fd8f[_0x65c3('0x16')])){_0x56fe22['SmsInteraction'][_0x65c3('0x17')]({'where':{'id':_0x10fd8f['SmsInteractionId']}})[_0x65c3('0x18')](function(_0x1c771e){if(_0x1c771e){_0x1c771e[_0x65c3('0x19')]({'lastMsgAt':_0x10fd8f[_0x65c3('0x1a')],'lastMsgDirection':_0x10fd8f[_0x65c3('0x12')][_0x65c3('0x1b')]()});}})[_0x65c3('0x1c')](function(_0x514bd1){console[_0x65c3('0x1d')](_0x514bd1);});}if(_0x10fd8f[_0x65c3('0x12')]===_0x65c3('0x13')&&!_0x10fd8f[_0x65c3('0x14')]){var _0x27a50f;_0x56fe22[_0x65c3('0x1e')]['find']({'where':{'id':_0x10fd8f['SmsAccountId']},'raw':!![]})['then'](function(_0x3aee95){_0x27a50f=_0x3aee95;if(_0x27a50f&&_0x27a50f[_0x65c3('0x1f')]){switch(_0x27a50f[_0x65c3('0x1f')]){case _0x65c3('0x20'):var _0x36265e=require(_0x65c3('0x20'));if(_0x27a50f[_0x65c3('0x21')]&&_0x27a50f[_0x65c3('0x22')]&&_0x27a50f[_0x65c3('0x23')]){var _0xeedaa6=new _0x36265e(_0x27a50f[_0x65c3('0x21')],_0x27a50f[_0x65c3('0x22')]);_0xeedaa6[_0x65c3('0x24')][_0x65c3('0x25')]({'body':_0x10fd8f[_0x65c3('0xe')],'to':_0x10fd8f[_0x65c3('0x23')],'from':_0x27a50f[_0x65c3('0x23')],'statusCallback':_0x27a50f[_0x65c3('0x26')]+'/api/sms/messages/'+_0x10fd8f['id']+'/status?token='+_0x27a50f[_0x65c3('0x27')]})[_0x65c3('0x18')](function(_0x2389cd){if(_0x2389cd[_0x65c3('0x28')]){return _0x5c2235['update']({'messageId':_0x2389cd[_0x65c3('0x28')]});}})[_0x65c3('0x1c')](function(_0x545c39){logger['error'](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x20'),util[_0x65c3('0x2b')](_0x545c39,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x20'),_0x65c3('0x2c'));}break;case _0x65c3('0x2d'):var _0x45864d=_0x65c3('0x2e');if(_0x27a50f[_0x65c3('0x2f')]&&_0x27a50f[_0x65c3('0x30')]){var _0x66f4d5={'recipient':[_0x10fd8f[_0x65c3('0x23')]],'message':_0x10fd8f[_0x65c3('0xe')],'message_type':_0x27a50f['smsMethod']};if(_0x27a50f[_0x65c3('0x31')]&&_0x27a50f[_0x65c3('0x31')]!=='SI'){_0x66f4d5[_0x65c3('0x32')]=_0x27a50f[_0x65c3('0x23')];}var _0x32b81f={'url':_0x45864d+_0x65c3('0x33')+_0x27a50f[_0x65c3('0x2f')]+_0x65c3('0x34')+_0x27a50f[_0x65c3('0x30')],'method':_0x65c3('0x35')};rp(_0x32b81f)[_0x65c3('0x18')](function(_0x3cfdf2){var _0x2fb819=_0x3cfdf2['split'](';');var _0x1b18e9={'user_key':_0x2fb819[0x0],'session_key':_0x2fb819[0x1]};_0x32b81f={'url':_0x45864d+_0x65c3('0x36'),'method':_0x65c3('0x37'),'headers':{'user_key':_0x1b18e9[_0x65c3('0x38')],'Session_key':_0x1b18e9[_0x65c3('0x39')]},'json':!![],'body':_0x66f4d5};return rp(_0x32b81f);})[_0x65c3('0x18')](function(_0x514a49){if(_0x514a49['total_sent']>=0x1){var _0x3dc2a3={'messageId':_0x514a49['internal_order_id']};if(_0x27a50f[_0x65c3('0x31')]!=='GP'||!_0x27a50f[_0x65c3('0x3a')]){_0x3dc2a3['read']=!![];}return _0x5c2235[_0x65c3('0x19')](_0x3dc2a3);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c3('0x2a'),_0x65c3('0x2d'),util[_0x65c3('0x2b')](_0x514a49,{'showHidden':![],'depth':null}));}})[_0x65c3('0x1c')](function(_0x17c25b){return logger['error'](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x2d'),util[_0x65c3('0x2b')](_0x17c25b,{'showHidden':![],'depth':null}));});}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x2d'),_0x65c3('0x3b'));}break;case _0x65c3('0x3c'):if(_0x27a50f[_0x65c3('0x22')]){var _0x103712={'recipient':_0x10fd8f[_0x65c3('0x23')],'message':_0x10fd8f[_0x65c3('0xe')],'sender':_0x27a50f[_0x65c3('0x3d')]||_0x27a50f[_0x65c3('0x23')],'authorization':_0x27a50f[_0x65c3('0x22')]};var _0x420367={'method':_0x65c3('0x37'),'uri':_0x65c3('0x3e'),'body':_0x103712,'json':!![]};rp(_0x420367)[_0x65c3('0x18')](function(_0x1e6d03){var _0x4ed1e6={'messageId':_0x1e6d03[_0x65c3('0x3f')]};if(!_0x27a50f['deliveryReport']){_0x4ed1e6[_0x65c3('0x40')]=!![];}return _0x5c2235[_0x65c3('0x19')](_0x4ed1e6);})[_0x65c3('0x1c')](function(_0x55dcad){logger[_0x65c3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c3('0x2a'),_0x65c3('0x3c'),util['inspect'](_0x55dcad,{'showHidden':![],'depth':null}));});}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x3c'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x27a50f[_0x65c3('0x2f')]&&_0x27a50f[_0x65c3('0x30')]){var _0x103712={'messages':[{'source':_0x65c3('0x41'),'to':_0x10fd8f[_0x65c3('0x23')],'body':_0x10fd8f[_0x65c3('0xe')],'from':_0x27a50f[_0x65c3('0x3d')]||_0x27a50f[_0x65c3('0x23')]}]};var _0xf75d86=util[_0x65c3('0x42')](_0x65c3('0x43'),_0x27a50f[_0x65c3('0x2f')],_0x27a50f[_0x65c3('0x30')]);var _0x420367={'method':_0x65c3('0x37'),'uri':_0x65c3('0x44'),'body':_0x103712,'headers':{'Authorization':util[_0x65c3('0x42')](_0x65c3('0x45'),new Buffer(_0xf75d86)['toString'](_0x65c3('0x46')))},'json':!![]};rp(_0x420367)['then'](function(_0x588666){if(_0x588666[_0x65c3('0x47')]>=0xc8&&_0x588666[_0x65c3('0x47')]<=0xce){if(_0x588666['data']&&_0x588666[_0x65c3('0x48')]['queued_count']>0x0){var _0x37d98a=_[_0x65c3('0x49')](_0x588666[_0x65c3('0x48')][_0x65c3('0x24')]);var _0x1c2824={'messageId':_0x37d98a[_0x65c3('0x4a')]};if(!_0x27a50f[_0x65c3('0x3a')]){_0x1c2824[_0x65c3('0x40')]=!![];}return _0x5c2235[_0x65c3('0x19')](_0x1c2824);}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x4b'),util['inspect'](_0x588666,{'showHidden':![],'depth':null}));}}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x4b'),util[_0x65c3('0x2b')](_0x588666,{'showHidden':![],'depth':null}));}})[_0x65c3('0x1c')](function(_0x4f6bea){logger[_0x65c3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x65c3('0x4b'),util[_0x65c3('0x2b')](_0x4f6bea,{'showHidden':![],'depth':null}));});}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x27a50f[_0x65c3('0x4c')]&&_0x27a50f[_0x65c3('0x22')]){var _0x103712={'dst':_0x10fd8f['phone'],'text':_0x10fd8f['body'],'src':_0x27a50f[_0x65c3('0x3d')]||_0x27a50f[_0x65c3('0x23')],'url':_0x27a50f[_0x65c3('0x26')]+'/api/sms/messages/'+_0x10fd8f['id']+_0x65c3('0x4d')+_0x27a50f[_0x65c3('0x27')]};var _0xf75d86=util['format'](_0x65c3('0x43'),_0x27a50f[_0x65c3('0x4c')],_0x27a50f[_0x65c3('0x22')]);var _0x420367={'method':_0x65c3('0x37'),'uri':util['format'](_0x65c3('0x4e'),_0x27a50f[_0x65c3('0x4c')]),'body':_0x103712,'headers':{'Authorization':util[_0x65c3('0x42')](_0x65c3('0x45'),new Buffer(_0xf75d86)['toString'](_0x65c3('0x46')))},'json':!![]};rp(_0x420367)[_0x65c3('0x18')](function(_0x1fbc9b){var _0x3f03da={'messageId':_0x1fbc9b['message_uuid'][0x0]};return _0x5c2235['update'](_0x3f03da);})[_0x65c3('0x1c')](function(_0x1ddee9){logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),'plivo',util[_0x65c3('0x2b')](_0x1ddee9,{'showHidden':![],'depth':null}));});}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),'afterCreate',_0x65c3('0x4f'),_0x65c3('0x50'));}break;case _0x65c3('0x51'):if(_0x27a50f[_0x65c3('0x2f')]&&_0x27a50f['password']){if(_0x27a50f[_0x65c3('0x52')]){var _0x39ad6a={'method':_0x65c3('0x37'),'uri':_0x27a50f[_0x65c3('0x52')]+_0x65c3('0x53'),'body':{'username':_0x27a50f[_0x65c3('0x2f')],'password':_0x27a50f[_0x65c3('0x30')]},'json':!![]};return rp(_0x39ad6a)['then'](function(_0x3dfb0b){var _0x4711c5={'method':_0x65c3('0x37'),'uri':_0x27a50f['baseUrl']+_0x65c3('0x54'),'body':{'messages':[{'from':_0x27a50f['phone'],'destinations':[{'to':_0x10fd8f[_0x65c3('0x23')]}],'text':_0x10fd8f[_0x65c3('0xe')],'notifyUrl':_0x27a50f['remote']+_0x65c3('0x55')+_0x10fd8f['id']+_0x65c3('0x4d')+_0x27a50f['token'],'notifyContentType':'application/json','callbackData':_0x27a50f[_0x65c3('0x23')]+';'+_0x10fd8f[_0x65c3('0xe')]}]},'headers':{'Authorization':_0x65c3('0x56')+_0x3dfb0b[_0x65c3('0x27')]},'json':!![]};return rp(_0x4711c5)['then'](function(_0x2a5bb3){if(_0x2a5bb3['messages']){var _0x54d169={'messageId':_0x2a5bb3[_0x65c3('0x24')][0x0][_0x65c3('0xc')]};if(!_0x27a50f['deliveryReport']){_0x54d169['read']=!![];}return _0x5c2235[_0x65c3('0x19')](_0x54d169);}else{return logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x51'),util[_0x65c3('0x2b')](_0x2a5bb3,{'showHidden':![],'depth':null}));}});})[_0x65c3('0x1c')](function(_0x4e2e48){return logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x51'),util[_0x65c3('0x2b')](_0x4e2e48,{'showHidden':![],'depth':null}));});}else{logger[_0x65c3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c3('0x2a'),'infobip',_0x65c3('0x57'));}}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x51'),_0x65c3('0x3b'));}break;case'csc':var _0x6c158e=require(_0x65c3('0x58'));if(_0x27a50f[_0x65c3('0x59')]){var _0x3c5e83={};_0x3c5e83[_0x65c3('0x5a')]=_0x27a50f[_0x65c3('0x2f')];_0x3c5e83['phone']=_0x10fd8f['phone'];_0x3c5e83[_0x65c3('0x32')]=_0x27a50f[_0x65c3('0x23')];_0x3c5e83[_0x65c3('0x5b')]=_0x10fd8f['body'];_0x3c5e83['timestamp']=+new Date();var _0x4ec2dc='';var _0x5c3855='';var _0x29b2ce=Object[_0x65c3('0x5c')](_0x3c5e83);_0x29b2ce[_0x65c3('0x5d')]();for(var _0xc9a589=0x0;_0xc9a589<_0x29b2ce[_0x65c3('0x5e')];_0xc9a589++){if(_0x4ec2dc!=''){_0x4ec2dc+='&';}_0x4ec2dc+=_0x29b2ce[_0xc9a589]+'='+encodeURIComponent(_0x3c5e83[_0x29b2ce[_0xc9a589]]);_0x5c3855+=_0x3c5e83[_0x29b2ce[_0xc9a589]];}_0x5c3855+=_0x27a50f[_0x65c3('0x59')];_0x5c3855=_0x6c158e[_0x65c3('0x5f')](_0x65c3('0x60'))['update'](_0x5c3855)['digest'](_0x65c3('0x61'));if(_0x4ec2dc!==''){_0x4ec2dc+='&';}_0x4ec2dc+='signature='+_0x5c3855;var _0x32b81f={'method':_0x65c3('0x35'),'uri':_0x27a50f[_0x65c3('0x52')]+_0x65c3('0x62')+_0x4ec2dc,'json':!![]};return rp(_0x32b81f)[_0x65c3('0x18')](function(_0x3af1bf){var _0x246654=Object['keys'](_0x3af1bf);if(_0x3af1bf[_0x246654[0x0]][_0x65c3('0x1d')]&&parseInt(_0x3af1bf[_0x246654[0x0]]['error'])===0x0){var _0x4ebb41={'messageId':_0x3af1bf[_0x246654[0x0]][_0x65c3('0x63')]};if(!_0x27a50f['deliveryReport']){_0x4ebb41[_0x65c3('0x40')]=!![];}return _0x5c2235['update'](_0x4ebb41);}else{return logger[_0x65c3('0x1d')](_0x65c3('0x29'),'afterCreate',_0x65c3('0x64'),util[_0x65c3('0x2b')](_0x3af1bf[_0x65c3('0x1d')],{'showHidden':![],'depth':null}));}})[_0x65c3('0x1c')](function(_0x2c1754){return logger['error'](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x64'),util['inspect'](_0x2c1754,{'showHidden':![],'depth':null}));});}else{logger[_0x65c3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x65c3('0x2a'),'csc',_0x65c3('0x65'));}break;case _0x65c3('0x66'):if(_0x27a50f[_0x65c3('0x59')]){var _0x2b028f={'method':_0x65c3('0x37'),'uri':_0x65c3('0x67'),'headers':{'Authorization':_0x27a50f[_0x65c3('0x59')]},'body':{'content':_0x10fd8f[_0x65c3('0xe')],'to':[_0x10fd8f[_0x65c3('0x23')]],'from':_0x27a50f[_0x65c3('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x65c3('0x68')},'json':!![]};rp(_0x2b028f)[_0x65c3('0x18')](function(_0x15a8f6){if(!_0x15a8f6[_0x65c3('0x1d')]){var _0x10261e={'messageId':_0x15a8f6[_0x65c3('0x24')][0x0][_0x65c3('0x69')]};if(!_0x27a50f[_0x65c3('0x3a')]){_0x10261e[_0x65c3('0x40')]=!![];}return _0x5c2235[_0x65c3('0x19')](_0x10261e);}else{return logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x66'),util[_0x65c3('0x2b')](_0x15a8f6[_0x65c3('0x1d')],{'showHidden':![],'depth':null}));}})[_0x65c3('0x1c')](function(_0x52242c){return logger[_0x65c3('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x65c3('0x66'),util['inspect'](_0x52242c,{'showHidden':![],'depth':null}));});}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x66'),_0x65c3('0x65'));}break;case _0x65c3('0x6a'):if(_0x27a50f[_0x65c3('0x2f')]&&_0x27a50f['password']){var _0xf75d86=util['format'](_0x65c3('0x43'),_0x27a50f['username'],_0x27a50f[_0x65c3('0x30')]);var _0x420367={'method':_0x65c3('0x37'),'uri':_0x65c3('0x6b')+_0x27a50f[_0x65c3('0x6c')]+_0x65c3('0x6d'),'body':{'to':[_0x10fd8f[_0x65c3('0x23')]],'text':_0x10fd8f['body'],'from':_0x27a50f[_0x65c3('0x23')],'applicationId':_0x27a50f[_0x65c3('0x6e')]},'headers':{'Authorization':util['format'](_0x65c3('0x45'),new Buffer(_0xf75d86)['toString']('base64'))},'json':!![]};rp(_0x420367)[_0x65c3('0x18')](function(_0x1e9286){if(_0x1e9286['id']){var _0x10f258={'messageId':_0x1e9286['id']};return _0x5c2235[_0x65c3('0x19')](_0x10f258);}else{logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),'bandwidth',util[_0x65c3('0x2b')](_0x1e9286,{'showHidden':![],'depth':null}));}})['catch'](function(_0x50f8df){logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),'bandwidth',util['inspect'](_0x50f8df,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x6a'),_0x65c3('0x3b'));}break;case _0x65c3('0x6f'):if(_0x27a50f['apiKey']){var _0x186091={};var _0x32b81f={'method':_0x65c3('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x65c3('0x70')+_0x27a50f[_0x65c3('0x59')],'Content-Type':'application/json'},'body':{'from':_0x27a50f[_0x65c3('0x23')],'to':_0x10fd8f[_0x65c3('0x23')],'text':_0x10fd8f[_0x65c3('0xe')]},'json':!![]};return rp(_0x32b81f)['then'](function(_0x15bdb2){if(_0x15bdb2[_0x65c3('0x71')]==0xca){_0x186091[_0x65c3('0x72')]=_0x15bdb2;var _0x471531={'method':_0x65c3('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x65c3('0x70')+_0x27a50f[_0x65c3('0x59')],'Content-Type':_0x65c3('0x73')},'body':{'refid':_0x186091[_0x65c3('0x72')][_0x65c3('0x74')]},'json':!![]};return rp(_0x471531)[_0x65c3('0x18')](function(_0x44ea75){_0x186091[_0x65c3('0x75')]=_0x44ea75;var _0x2aa699={'messageId':_0x186091[_0x65c3('0x72')][_0x65c3('0x74')],'read':!![]};return _0x5c2235['update'](_0x2aa699);});}else{return logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),_0x65c3('0x6f'),util[_0x65c3('0x2b')](_0x15bdb2,{'showHidden':![],'depth':null}));}})[_0x65c3('0x1c')](function(_0x5a34d9){return logger[_0x65c3('0x1d')](_0x65c3('0x29'),'afterCreate',_0x65c3('0x6f'),util[_0x65c3('0x2b')](_0x5a34d9,{'showHidden':![],'depth':null}));});}else{return logger[_0x65c3('0x1d')](_0x65c3('0x29'),_0x65c3('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x65c3('0x76')](function(){_0x60938d();});}else{_0x60938d();}}},'charset':_0x65c3('0x77'),'collate':_0x65c3('0x78')});}; \ No newline at end of file +var _0xe3e8=['internal_order_id','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','message_id','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','username','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','createHash','md5','digest','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','toLowerCase','catch','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','error','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','total_sent'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe3e8,0x1bf));var _0x8e3e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xe3e8[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x8e3e('0x0'));var util=require('util');var logger=require(_0x8e3e('0x1'))(_0x8e3e('0x2'));var moment=require(_0x8e3e('0x3'));var BPromise=require(_0x8e3e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e3e('0x5'));var rimraf=require(_0x8e3e('0x6'));var config=require(_0x8e3e('0x7'));var attributes=require(_0x8e3e('0x8'));module[_0x8e3e('0x9')]=function(_0x43907b,_0x36cb5b){return _0x43907b[_0x8e3e('0xa')](_0x8e3e('0xb'),attributes,{'tableName':_0x8e3e('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8e3e('0xd')]},{'name':_0x8e3e('0xe'),'fields':[_0x8e3e('0xf')],'type':_0x8e3e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x407cd6,_0x1e23ce,_0x39a5a8){var _0x5a6a28=_0x43907b[_0x8e3e('0x11')];var _0x865fd4=_0x407cd6[_0x8e3e('0x12')]({'plain':!![]});if(_0x865fd4[_0x8e3e('0x13')]['toLowerCase']()==='in'||_0x865fd4[_0x8e3e('0x13')]['toLowerCase']()===_0x8e3e('0x14')&&!_0x865fd4[_0x8e3e('0x15')]&&!_['isNil'](_0x865fd4[_0x8e3e('0x16')])){_0x5a6a28[_0x8e3e('0x17')][_0x8e3e('0x18')]({'where':{'id':_0x865fd4[_0x8e3e('0x19')]}})[_0x8e3e('0x1a')](function(_0x364a9d){if(_0x364a9d){_0x364a9d[_0x8e3e('0x1b')]({'lastMsgAt':_0x865fd4[_0x8e3e('0x1c')],'lastMsgDirection':_0x865fd4[_0x8e3e('0x13')][_0x8e3e('0x1d')]()});}})[_0x8e3e('0x1e')](function(_0x28726e){console['error'](_0x28726e);});}if(_0x865fd4[_0x8e3e('0x13')]==='out'&&!_0x865fd4[_0x8e3e('0x15')]){var _0x559895;_0x5a6a28[_0x8e3e('0x1f')]['find']({'where':{'id':_0x865fd4[_0x8e3e('0x20')]},'raw':!![]})[_0x8e3e('0x1a')](function(_0x3eadff){_0x559895=_0x3eadff;if(_0x559895&&_0x559895[_0x8e3e('0x21')]){switch(_0x559895[_0x8e3e('0x21')]){case _0x8e3e('0x22'):var _0x3f025a=require(_0x8e3e('0x22'));if(_0x559895[_0x8e3e('0x23')]&&_0x559895[_0x8e3e('0x24')]&&_0x559895['phone']){var _0x32e30a=new _0x3f025a(_0x559895[_0x8e3e('0x23')],_0x559895[_0x8e3e('0x24')]);_0x32e30a[_0x8e3e('0x25')][_0x8e3e('0x26')]({'body':_0x865fd4[_0x8e3e('0xf')],'to':_0x865fd4[_0x8e3e('0x27')],'from':_0x559895[_0x8e3e('0x27')],'statusCallback':_0x559895[_0x8e3e('0x28')]+_0x8e3e('0x29')+_0x865fd4['id']+_0x8e3e('0x2a')+_0x559895[_0x8e3e('0x2b')]})[_0x8e3e('0x1a')](function(_0x5592c9){if(_0x5592c9[_0x8e3e('0x2c')]){return _0x407cd6[_0x8e3e('0x1b')]({'messageId':_0x5592c9[_0x8e3e('0x2c')]});}})[_0x8e3e('0x1e')](function(_0x115b03){logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e3e('0x2e'),_0x8e3e('0x22'),util[_0x8e3e('0x2f')](_0x115b03,{'showHidden':![],'depth':null}));});}else{logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e3e('0x2e'),_0x8e3e('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x8e3e('0x30'):var _0x57b0c7=_0x8e3e('0x31');if(_0x559895['username']&&_0x559895[_0x8e3e('0x32')]){var _0x14b4b3={'recipient':[_0x865fd4[_0x8e3e('0x27')]],'message':_0x865fd4[_0x8e3e('0xf')],'message_type':_0x559895[_0x8e3e('0x33')]};if(_0x559895[_0x8e3e('0x33')]&&_0x559895[_0x8e3e('0x33')]!=='SI'){_0x14b4b3[_0x8e3e('0x34')]=_0x559895[_0x8e3e('0x27')];}var _0x5c7b57={'url':_0x57b0c7+_0x8e3e('0x35')+_0x559895['username']+_0x8e3e('0x36')+_0x559895[_0x8e3e('0x32')],'method':_0x8e3e('0x37')};rp(_0x5c7b57)[_0x8e3e('0x1a')](function(_0x3f1a19){var _0x426783=_0x3f1a19[_0x8e3e('0x38')](';');var _0x164757={'user_key':_0x426783[0x0],'session_key':_0x426783[0x1]};_0x5c7b57={'url':_0x57b0c7+_0x8e3e('0x39'),'method':_0x8e3e('0x3a'),'headers':{'user_key':_0x164757['user_key'],'Session_key':_0x164757[_0x8e3e('0x3b')]},'json':!![],'body':_0x14b4b3};return rp(_0x5c7b57);})[_0x8e3e('0x1a')](function(_0x12351b){if(_0x12351b[_0x8e3e('0x3c')]>=0x1){var _0x2a44ed={'messageId':_0x12351b[_0x8e3e('0x3d')]};if(_0x559895['smsMethod']!=='GP'||!_0x559895[_0x8e3e('0x3e')]){_0x2a44ed[_0x8e3e('0x3f')]=!![];}return _0x407cd6[_0x8e3e('0x1b')](_0x2a44ed);}else{return logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x30'),util[_0x8e3e('0x2f')](_0x12351b,{'showHidden':![],'depth':null}));}})[_0x8e3e('0x1e')](function(_0x3c5ca2){return logger['error'](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x30'),util['inspect'](_0x3c5ca2,{'showHidden':![],'depth':null}));});}else{logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),'afterCreate','skebby',_0x8e3e('0x41'));}break;case _0x8e3e('0x42'):if(_0x559895[_0x8e3e('0x24')]){var _0x46e35d={'recipient':_0x865fd4[_0x8e3e('0x27')],'message':_0x865fd4[_0x8e3e('0xf')],'sender':_0x559895[_0x8e3e('0x43')]||_0x559895[_0x8e3e('0x27')],'authorization':_0x559895['authToken']};var _0x1e23ce={'method':_0x8e3e('0x3a'),'uri':_0x8e3e('0x44'),'body':_0x46e35d,'json':!![]};rp(_0x1e23ce)['then'](function(_0xbed8c1){var _0x3d7c83={'messageId':_0xbed8c1[_0x8e3e('0x45')]};if(!_0x559895['deliveryReport']){_0x3d7c83['read']=!![];}return _0x407cd6[_0x8e3e('0x1b')](_0x3d7c83);})[_0x8e3e('0x1e')](function(_0x40650f){logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x42'),util['inspect'](_0x40650f,{'showHidden':![],'depth':null}));});}else{logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),'afterCreate',_0x8e3e('0x42'),_0x8e3e('0x46'));}break;case'clicksend':if(_0x559895['username']&&_0x559895['password']){var _0x46e35d={'messages':[{'source':_0x8e3e('0x47'),'to':_0x865fd4['phone'],'body':_0x865fd4['body'],'from':_0x559895['senderString']||_0x559895[_0x8e3e('0x27')]}]};var _0x34c5c2=util[_0x8e3e('0x48')](_0x8e3e('0x49'),_0x559895['username'],_0x559895[_0x8e3e('0x32')]);var _0x1e23ce={'method':_0x8e3e('0x3a'),'uri':_0x8e3e('0x4a'),'body':_0x46e35d,'headers':{'Authorization':util['format'](_0x8e3e('0x4b'),new Buffer(_0x34c5c2)['toString'](_0x8e3e('0x4c')))},'json':!![]};rp(_0x1e23ce)[_0x8e3e('0x1a')](function(_0x457ee5){if(_0x457ee5[_0x8e3e('0x4d')]>=0xc8&&_0x457ee5[_0x8e3e('0x4d')]<=0xce){if(_0x457ee5['data']&&_0x457ee5[_0x8e3e('0x4e')][_0x8e3e('0x4f')]>0x0){var _0x2c1e0b=_['head'](_0x457ee5[_0x8e3e('0x4e')][_0x8e3e('0x25')]);var _0x24ceed={'messageId':_0x2c1e0b[_0x8e3e('0x50')]};if(!_0x559895['deliveryReport']){_0x24ceed['read']=!![];}return _0x407cd6[_0x8e3e('0x1b')](_0x24ceed);}else{logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x51'),util[_0x8e3e('0x2f')](_0x457ee5,{'showHidden':![],'depth':null}));}}else{logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),'clickSend',util[_0x8e3e('0x2f')](_0x457ee5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x573e6a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e3e('0x2e'),_0x8e3e('0x51'),util[_0x8e3e('0x2f')](_0x573e6a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x51'),_0x8e3e('0x41'));}break;case _0x8e3e('0x52'):if(_0x559895['authId']&&_0x559895[_0x8e3e('0x24')]){var _0x46e35d={'dst':_0x865fd4[_0x8e3e('0x27')],'text':_0x865fd4[_0x8e3e('0xf')],'src':_0x559895[_0x8e3e('0x43')]||_0x559895['phone'],'url':_0x559895[_0x8e3e('0x28')]+'/api/sms/messages/'+_0x865fd4['id']+'/status?token='+_0x559895[_0x8e3e('0x2b')]};var _0x34c5c2=util[_0x8e3e('0x48')](_0x8e3e('0x49'),_0x559895['authId'],_0x559895['authToken']);var _0x1e23ce={'method':_0x8e3e('0x3a'),'uri':util['format'](_0x8e3e('0x53'),_0x559895['authId']),'body':_0x46e35d,'headers':{'Authorization':util[_0x8e3e('0x48')]('Basic\x20%s',new Buffer(_0x34c5c2)[_0x8e3e('0x54')](_0x8e3e('0x4c')))},'json':!![]};rp(_0x1e23ce)[_0x8e3e('0x1a')](function(_0x11df5f){var _0x2f8888={'messageId':_0x11df5f[_0x8e3e('0x55')][0x0]};return _0x407cd6[_0x8e3e('0x1b')](_0x2f8888);})['catch'](function(_0x19645d){logger['error'](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x52'),util[_0x8e3e('0x2f')](_0x19645d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x52'),_0x8e3e('0x56'));}break;case _0x8e3e('0x57'):if(_0x559895[_0x8e3e('0x58')]&&_0x559895[_0x8e3e('0x32')]){if(_0x559895[_0x8e3e('0x59')]){var _0x7ae3aa={'method':_0x8e3e('0x3a'),'uri':_0x559895[_0x8e3e('0x59')]+_0x8e3e('0x5a'),'body':{'username':_0x559895['username'],'password':_0x559895[_0x8e3e('0x32')]},'json':!![]};return rp(_0x7ae3aa)[_0x8e3e('0x1a')](function(_0x3c6345){var _0x46caca={'method':_0x8e3e('0x3a'),'uri':_0x559895['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x559895[_0x8e3e('0x27')],'destinations':[{'to':_0x865fd4['phone']}],'text':_0x865fd4[_0x8e3e('0xf')],'notifyUrl':_0x559895[_0x8e3e('0x28')]+_0x8e3e('0x29')+_0x865fd4['id']+'/status?token='+_0x559895[_0x8e3e('0x2b')],'notifyContentType':_0x8e3e('0x5b'),'callbackData':_0x559895['phone']+';'+_0x865fd4[_0x8e3e('0xf')]}]},'headers':{'Authorization':_0x8e3e('0x5c')+_0x3c6345['token']},'json':!![]};return rp(_0x46caca)[_0x8e3e('0x1a')](function(_0x2cb0f5){if(_0x2cb0f5[_0x8e3e('0x25')]){var _0x220d48={'messageId':_0x2cb0f5[_0x8e3e('0x25')][0x0][_0x8e3e('0xd')]};if(!_0x559895[_0x8e3e('0x3e')]){_0x220d48[_0x8e3e('0x3f')]=!![];}return _0x407cd6['update'](_0x220d48);}else{return logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8e3e('0x57'),util[_0x8e3e('0x2f')](_0x2cb0f5,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x26cc9c){return logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),'infobip',util['inspect'](_0x26cc9c,{'showHidden':![],'depth':null}));});}else{logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e3e('0x2e'),_0x8e3e('0x57'),_0x8e3e('0x5d'));}}else{logger['error'](_0x8e3e('0x40'),_0x8e3e('0x2e'),'infobip',_0x8e3e('0x41'));}break;case _0x8e3e('0x5e'):var _0x310511=require(_0x8e3e('0x5f'));if(_0x559895[_0x8e3e('0x60')]){var _0x374b7e={};_0x374b7e[_0x8e3e('0x61')]=_0x559895[_0x8e3e('0x58')];_0x374b7e[_0x8e3e('0x27')]=_0x865fd4['phone'];_0x374b7e['sender']=_0x559895[_0x8e3e('0x27')];_0x374b7e[_0x8e3e('0x62')]=_0x865fd4[_0x8e3e('0xf')];_0x374b7e[_0x8e3e('0x63')]=+new Date();var _0x1065ef='';var _0x233ad8='';var _0x59e14f=Object['keys'](_0x374b7e);_0x59e14f[_0x8e3e('0x64')]();for(var _0x20fe18=0x0;_0x20fe18<_0x59e14f['length'];_0x20fe18++){if(_0x1065ef!=''){_0x1065ef+='&';}_0x1065ef+=_0x59e14f[_0x20fe18]+'='+encodeURIComponent(_0x374b7e[_0x59e14f[_0x20fe18]]);_0x233ad8+=_0x374b7e[_0x59e14f[_0x20fe18]];}_0x233ad8+=_0x559895[_0x8e3e('0x60')];_0x233ad8=_0x310511[_0x8e3e('0x65')](_0x8e3e('0x66'))[_0x8e3e('0x1b')](_0x233ad8)[_0x8e3e('0x67')]('hex');if(_0x1065ef!==''){_0x1065ef+='&';}_0x1065ef+='signature='+_0x233ad8;var _0x5c7b57={'method':_0x8e3e('0x37'),'uri':_0x559895[_0x8e3e('0x59')]+_0x8e3e('0x68')+_0x1065ef,'json':!![]};return rp(_0x5c7b57)[_0x8e3e('0x1a')](function(_0x13d32b){var _0x317319=Object[_0x8e3e('0x69')](_0x13d32b);if(_0x13d32b[_0x317319[0x0]]['error']&&parseInt(_0x13d32b[_0x317319[0x0]][_0x8e3e('0x2d')])===0x0){var _0x23c326={'messageId':_0x13d32b[_0x317319[0x0]]['id_sms']};if(!_0x559895[_0x8e3e('0x3e')]){_0x23c326['read']=!![];}return _0x407cd6[_0x8e3e('0x1b')](_0x23c326);}else{return logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x5e'),util[_0x8e3e('0x2f')](_0x13d32b[_0x8e3e('0x2d')],{'showHidden':![],'depth':null}));}})[_0x8e3e('0x1e')](function(_0x90cc96){return logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),'csc',util['inspect'](_0x90cc96,{'showHidden':![],'depth':null}));});}else{logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x5e'),_0x8e3e('0x6a'));}break;case _0x8e3e('0x6b'):if(_0x559895[_0x8e3e('0x60')]){var _0x569afd={'method':_0x8e3e('0x3a'),'uri':_0x8e3e('0x6c'),'headers':{'Authorization':_0x559895[_0x8e3e('0x60')]},'body':{'content':_0x865fd4[_0x8e3e('0xf')],'to':[_0x865fd4['phone']],'from':_0x559895[_0x8e3e('0x27')],'binary':![],'clientMessageId':_0x8e3e('0x6d'),'charset':_0x8e3e('0x6e')},'json':!![]};rp(_0x569afd)['then'](function(_0x13329c){if(!_0x13329c[_0x8e3e('0x2d')]){var _0x31cd46={'messageId':_0x13329c[_0x8e3e('0x25')][0x0][_0x8e3e('0x6f')]};if(!_0x559895['deliveryReport']){_0x31cd46['read']=!![];}return _0x407cd6['update'](_0x31cd46);}else{return logger['error'](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x6b'),util[_0x8e3e('0x2f')](_0x13329c[_0x8e3e('0x2d')],{'showHidden':![],'depth':null}));}})[_0x8e3e('0x1e')](function(_0x51acfc){return logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),'clickatell',util[_0x8e3e('0x2f')](_0x51acfc,{'showHidden':![],'depth':null}));});}else{logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),'afterCreate',_0x8e3e('0x6b'),_0x8e3e('0x6a'));}break;case _0x8e3e('0x70'):if(_0x559895[_0x8e3e('0x58')]&&_0x559895['password']){var _0x34c5c2=util['format'](_0x8e3e('0x49'),_0x559895[_0x8e3e('0x58')],_0x559895['password']);var _0x1e23ce={'method':'POST','uri':_0x8e3e('0x71')+_0x559895[_0x8e3e('0x72')]+'/messages','body':{'to':[_0x865fd4[_0x8e3e('0x27')]],'text':_0x865fd4[_0x8e3e('0xf')],'from':_0x559895['phone'],'applicationId':_0x559895[_0x8e3e('0x73')]},'headers':{'Authorization':util[_0x8e3e('0x48')]('Basic\x20%s',new Buffer(_0x34c5c2)[_0x8e3e('0x54')](_0x8e3e('0x4c')))},'json':!![]};rp(_0x1e23ce)[_0x8e3e('0x1a')](function(_0x5716de){if(_0x5716de['id']){var _0x30ff20={'messageId':_0x5716de['id']};return _0x407cd6[_0x8e3e('0x1b')](_0x30ff20);}else{logger[_0x8e3e('0x2d')](_0x8e3e('0x40'),_0x8e3e('0x2e'),'bandwidth',util[_0x8e3e('0x2f')](_0x5716de,{'showHidden':![],'depth':null}));}})[_0x8e3e('0x1e')](function(_0x57c247){logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x8e3e('0x2f')](_0x57c247,{'showHidden':![],'depth':null}));});}else{logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e3e('0x2e'),_0x8e3e('0x70'),_0x8e3e('0x41'));}break;case'intelepeer':if(_0x559895['apiKey']){var _0x4f9477={};var _0x5c7b57={'method':'POST','uri':_0x8e3e('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x559895[_0x8e3e('0x60')],'Content-Type':_0x8e3e('0x5b')},'body':{'from':_0x559895[_0x8e3e('0x27')],'to':_0x865fd4[_0x8e3e('0x27')],'text':_0x865fd4[_0x8e3e('0xf')]},'json':!![]};return rp(_0x5c7b57)[_0x8e3e('0x1a')](function(_0x1ff24e){if(_0x1ff24e[_0x8e3e('0x75')]==0xca){_0x4f9477[_0x8e3e('0x76')]=_0x1ff24e;var _0x2e5661={'method':_0x8e3e('0x3a'),'uri':_0x8e3e('0x77'),'headers':{'Authorization':_0x8e3e('0x78')+_0x559895['apiKey'],'Content-Type':_0x8e3e('0x5b')},'body':{'refid':_0x4f9477[_0x8e3e('0x76')][_0x8e3e('0x79')]},'json':!![]};return rp(_0x2e5661)[_0x8e3e('0x1a')](function(_0xe336e4){_0x4f9477[_0x8e3e('0x7a')]=_0xe336e4;var _0x1f4ab5={'messageId':_0x4f9477[_0x8e3e('0x76')]['refid'],'read':!![]};return _0x407cd6[_0x8e3e('0x1b')](_0x1f4ab5);});}else{return logger['error'](_0x8e3e('0x40'),_0x8e3e('0x2e'),_0x8e3e('0x7b'),util['inspect'](_0x1ff24e,{'showHidden':![],'depth':null}));}})[_0x8e3e('0x1e')](function(_0x118d1a){return logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e3e('0x2e'),_0x8e3e('0x7b'),util['inspect'](_0x118d1a,{'showHidden':![],'depth':null}));});}else{return logger[_0x8e3e('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8e3e('0x2e'),_0x8e3e('0x7b'),'Token\x20not\x20received');}break;}}})[_0x8e3e('0x7c')](function(){_0x39a5a8();});}else{_0x39a5a8();}}},'charset':_0x8e3e('0x7d'),'collate':_0x8e3e('0x7e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d8891fe..d1ccda6 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 _0x1810=['code','message','result','catch','CreateSmsMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x400b4d,_0x9523bf){var _0x4786c7=function(_0x247fcc){while(--_0x247fcc){_0x400b4d['push'](_0x400b4d['shift']());}};_0x4786c7(++_0x9523bf);}(_0x1810,0x1e6));var _0x0181=function(_0x4495b6,_0x1660d5){_0x4495b6=_0x4495b6-0x0;var _0x2ff893=_0x1810[_0x4495b6];return _0x2ff893;};'use strict';var _=require(_0x0181('0x0'));var util=require(_0x0181('0x1'));var moment=require(_0x0181('0x2'));var BPromise=require(_0x0181('0x3'));var rs=require(_0x0181('0x4'));var fs=require('fs');var Redis=require(_0x0181('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0181('0x6'));var logger=require(_0x0181('0x7'))(_0x0181('0x8'));var config=require(_0x0181('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0181('0xa')][_0x0181('0xb')]({'port':0x232a});config[_0x0181('0xc')]=_[_0x0181('0xd')](config[_0x0181('0xc')],{'host':_0x0181('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0181('0xc')]));require(_0x0181('0xf'))[_0x0181('0x10')](socket);function respondWithRpcPromise(_0x15305d,_0x48d56d,_0x488a74){return new BPromise(function(_0x3a95c3,_0x201eec){return client[_0x0181('0x11')](_0x15305d,_0x488a74)[_0x0181('0x12')](function(_0x297eec){logger[_0x0181('0x13')](_0x0181('0x14'),_0x48d56d,_0x0181('0x15'));logger['debug'](_0x0181('0x16'),_0x48d56d,_0x0181('0x15'),JSON['stringify'](_0x297eec));if(_0x297eec[_0x0181('0x17')]){if(_0x297eec[_0x0181('0x17')][_0x0181('0x18')]===0x1f4){logger[_0x0181('0x17')](_0x0181('0x14'),_0x48d56d,_0x297eec[_0x0181('0x17')][_0x0181('0x19')]);return _0x201eec(_0x297eec[_0x0181('0x17')]['message']);}logger['error'](_0x0181('0x14'),_0x48d56d,_0x297eec[_0x0181('0x17')][_0x0181('0x19')]);return _0x3a95c3(_0x297eec[_0x0181('0x17')][_0x0181('0x19')]);}else{logger[_0x0181('0x13')]('SmsMessage,\x20%s,\x20%s',_0x48d56d,_0x0181('0x15'));_0x3a95c3(_0x297eec[_0x0181('0x1a')][_0x0181('0x19')]);}})[_0x0181('0x1b')](function(_0x2d0c6e){logger[_0x0181('0x17')](_0x0181('0x14'),_0x48d56d,_0x2d0c6e);_0x201eec(_0x2d0c6e);});});}exports[_0x0181('0x1c')]=function(_0x408ce7){var _0x244d25=this;return new Promise(function(_0x3384f9,_0x17c7b6){return db['SmsMessage'][_0x0181('0x1d')](_0x408ce7[_0x0181('0x1e')],{'raw':_0x408ce7[_0x0181('0x1f')]?_0x408ce7[_0x0181('0x1f')][_0x0181('0x20')]===undefined?!![]:![]:!![]})[_0x0181('0x12')](function(_0x1ac7b9){logger['info'](_0x0181('0x1c'),_0x408ce7);logger[_0x0181('0x21')](_0x0181('0x1c'),_0x408ce7,JSON['stringify'](_0x1ac7b9));_0x3384f9(_0x1ac7b9);})[_0x0181('0x1b')](function(_0x169dfa){logger[_0x0181('0x17')](_0x0181('0x1c'),_0x169dfa[_0x0181('0x19')],_0x408ce7);_0x17c7b6(_0x244d25[_0x0181('0x17')](0x1f4,_0x169dfa[_0x0181('0x19')]));});});}; \ No newline at end of file +var _0x2967=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSmsMessage','SmsMessage','create','body','options'];(function(_0x5f27d2,_0x34e719){var _0xdc6d0=function(_0x44c041){while(--_0x44c041){_0x5f27d2['push'](_0x5f27d2['shift']());}};_0xdc6d0(++_0x34e719);}(_0x2967,0x14a));var _0x7296=function(_0x335202,_0x16d8a7){_0x335202=_0x335202-0x0;var _0x93ca72=_0x2967[_0x335202];return _0x93ca72;};'use strict';var _=require(_0x7296('0x0'));var util=require(_0x7296('0x1'));var moment=require(_0x7296('0x2'));var BPromise=require('bluebird');var rs=require(_0x7296('0x3'));var fs=require('fs');var Redis=require(_0x7296('0x4'));var db=require(_0x7296('0x5'))['db'];var utils=require(_0x7296('0x6'));var logger=require(_0x7296('0x7'))(_0x7296('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7296('0x9')][_0x7296('0xa')]({'port':0x232a});config[_0x7296('0xb')]=_[_0x7296('0xc')](config[_0x7296('0xb')],{'host':_0x7296('0xd'),'port':0x18eb});var socket=require(_0x7296('0xe'))(new Redis(config[_0x7296('0xb')]));require(_0x7296('0xf'))[_0x7296('0x10')](socket);function respondWithRpcPromise(_0x133a99,_0x5eb1c5,_0x487d9d){return new BPromise(function(_0x99b3bb,_0x412510){return client[_0x7296('0x11')](_0x133a99,_0x487d9d)[_0x7296('0x12')](function(_0x836f3b){logger[_0x7296('0x13')](_0x7296('0x14'),_0x5eb1c5,_0x7296('0x15'));logger[_0x7296('0x16')](_0x7296('0x17'),_0x5eb1c5,'request\x20sent',JSON[_0x7296('0x18')](_0x836f3b));if(_0x836f3b[_0x7296('0x19')]){if(_0x836f3b[_0x7296('0x19')]['code']===0x1f4){logger[_0x7296('0x19')](_0x7296('0x14'),_0x5eb1c5,_0x836f3b['error'][_0x7296('0x1a')]);return _0x412510(_0x836f3b[_0x7296('0x19')][_0x7296('0x1a')]);}logger[_0x7296('0x19')](_0x7296('0x14'),_0x5eb1c5,_0x836f3b['error']['message']);return _0x99b3bb(_0x836f3b['error']['message']);}else{logger[_0x7296('0x13')](_0x7296('0x14'),_0x5eb1c5,'request\x20sent');_0x99b3bb(_0x836f3b['result'][_0x7296('0x1a')]);}})[_0x7296('0x1b')](function(_0x253b72){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5eb1c5,_0x253b72);_0x412510(_0x253b72);});});}exports[_0x7296('0x1c')]=function(_0x2ee7ed){var _0x18c8a1=this;return new Promise(function(_0x475bf5,_0x3776c0){return db[_0x7296('0x1d')][_0x7296('0x1e')](_0x2ee7ed[_0x7296('0x1f')],{'raw':_0x2ee7ed[_0x7296('0x20')]?_0x2ee7ed[_0x7296('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x271518){logger['info'](_0x7296('0x1c'),_0x2ee7ed);logger[_0x7296('0x16')](_0x7296('0x1c'),_0x2ee7ed,JSON[_0x7296('0x18')](_0x271518));_0x475bf5(_0x271518);})[_0x7296('0x1b')](function(_0x58afe1){logger['error']('CreateSmsMessage',_0x58afe1[_0x7296('0x1a')],_0x2ee7ed);_0x3776c0(_0x18c8a1[_0x7296('0x19')](0x1f4,_0x58afe1[_0x7296('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 56eebbc..67112f7 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 _0x577d=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x6a490b,_0x15bd57){var _0x427365=function(_0x3b53fa){while(--_0x3b53fa){_0x6a490b['push'](_0x6a490b['shift']());}};_0x427365(++_0x15bd57);}(_0x577d,0xf2));var _0xd577=function(_0x183a93,_0x44328c){_0x183a93=_0x183a93-0x0;var _0x15a866=_0x577d[_0x183a93];return _0x15a866;};'use strict';var SmsMessageEvents=require(_0xd577('0x0'));var events=[_0xd577('0x1'),_0xd577('0x2'),'update'];function createListener(_0x2460a2,_0x4b5028){return function(_0x425e41){_0x4b5028['emit'](_0x2460a2,_0x425e41);};}function removeListener(_0x1c85ba,_0x4c425e){return function(){SmsMessageEvents[_0xd577('0x3')](_0x1c85ba,_0x4c425e);};}exports[_0xd577('0x4')]=function(_0x5cf272){for(var _0x456bdd=0x0,_0x2f4d45=events[_0xd577('0x5')];_0x456bdd<_0x2f4d45;_0x456bdd++){var _0x2c2813=events[_0x456bdd];var _0x62bf42=createListener(_0xd577('0x6')+_0x2c2813,_0x5cf272);SmsMessageEvents['on'](_0x2c2813,_0x62bf42);}}; \ No newline at end of file +var _0x5c6c=['save','remove','update','emit','register','length','smsMessage:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c6c,0xfc));var _0xc5c6=function(_0x194086,_0x340cd7){_0x194086=_0x194086-0x0;var _0x561426=_0x5c6c[_0x194086];return _0x561426;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xc5c6('0x0'),_0xc5c6('0x1'),_0xc5c6('0x2')];function createListener(_0x2aabaf,_0x428b84){return function(_0x3fba4d){_0x428b84[_0xc5c6('0x3')](_0x2aabaf,_0x3fba4d);};}function removeListener(_0x1c0148,_0x2af004){return function(){SmsMessageEvents['removeListener'](_0x1c0148,_0x2af004);};}exports[_0xc5c6('0x4')]=function(_0x5f3bb6){for(var _0x9359ea=0x0,_0x965d4a=events[_0xc5c6('0x5')];_0x9359ea<_0x965d4a;_0x9359ea++){var _0x549691=events[_0x9359ea];var _0x479edd=createListener(_0xc5c6('0x6')+_0x549691,_0x5f3bb6);SmsMessageEvents['on'](_0x549691,_0x479edd);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7939ea6..872880b 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 _0x9b97=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','multer','path'];(function(_0x150f8e,_0x1bbd21){var _0x446ed4=function(_0x59c29c){while(--_0x59c29c){_0x150f8e['push'](_0x150f8e['shift']());}};_0x446ed4(++_0x1bbd21);}(_0x9b97,0x11e));var _0x79b9=function(_0x39f033,_0x59587c){_0x39f033=_0x39f033-0x0;var _0x2dad0b=_0x9b97[_0x39f033];return _0x2dad0b;};'use strict';var multer=require(_0x79b9('0x0'));var util=require('util');var path=require(_0x79b9('0x1'));var timeout=require(_0x79b9('0x2'));var express=require(_0x79b9('0x3'));var router=express[_0x79b9('0x4')]();var auth=require(_0x79b9('0x5'));var interaction=require(_0x79b9('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x79b9('0x7')]('/',auth[_0x79b9('0x8')](),controller[_0x79b9('0x9')]);router['get'](_0x79b9('0xa'),auth[_0x79b9('0x8')](),controller['describe']);router[_0x79b9('0x7')](_0x79b9('0xb'),auth[_0x79b9('0x8')](),controller[_0x79b9('0xc')]);router[_0x79b9('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x79b9('0xd')]);router[_0x79b9('0x7')](_0x79b9('0xe'),auth[_0x79b9('0x8')](),controller[_0x79b9('0xf')]);router[_0x79b9('0x7')](_0x79b9('0x10'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x11')]);router[_0x79b9('0x12')]('/',auth[_0x79b9('0x8')](),controller['create']);router[_0x79b9('0x12')](_0x79b9('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x79b9('0x10'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x13')]);router[_0x79b9('0x14')](_0x79b9('0xb'),auth['isAuthenticated'](),controller[_0x79b9('0x15')]);router[_0x79b9('0x16')](_0x79b9('0xb'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x17')]);router[_0x79b9('0x16')](_0x79b9('0xe'),auth[_0x79b9('0x8')](),controller['removeTeams']);router[_0x79b9('0x16')](_0x79b9('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xca84=['./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca84,0xf5));var _0x4ca8=function(_0x57deb0,_0xcfa42){_0x57deb0=_0x57deb0-0x0;var _0x21941a=_0xca84[_0x57deb0];return _0x21941a;};'use strict';var multer=require(_0x4ca8('0x0'));var util=require(_0x4ca8('0x1'));var path=require(_0x4ca8('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ca8('0x3'));var router=express[_0x4ca8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ca8('0x5'));var config=require(_0x4ca8('0x6'));var controller=require(_0x4ca8('0x7'));router[_0x4ca8('0x8')]('/',auth[_0x4ca8('0x9')](),controller[_0x4ca8('0xa')]);router[_0x4ca8('0x8')](_0x4ca8('0xb'),auth[_0x4ca8('0x9')](),controller[_0x4ca8('0xc')]);router['get'](_0x4ca8('0xd'),auth['isAuthenticated'](),controller[_0x4ca8('0xe')]);router['get'](_0x4ca8('0xf'),auth['isAuthenticated'](),controller[_0x4ca8('0x10')]);router[_0x4ca8('0x8')](_0x4ca8('0x11'),auth[_0x4ca8('0x9')](),controller[_0x4ca8('0x12')]);router[_0x4ca8('0x8')](_0x4ca8('0x13'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x4ca8('0x14')]);router['post'](_0x4ca8('0x11'),auth[_0x4ca8('0x9')](),controller['addTeams']);router['post'](_0x4ca8('0x13'),auth[_0x4ca8('0x9')](),controller[_0x4ca8('0x15')]);router[_0x4ca8('0x16')](_0x4ca8('0xd'),auth[_0x4ca8('0x9')](),controller[_0x4ca8('0x17')]);router[_0x4ca8('0x18')](_0x4ca8('0xd'),auth[_0x4ca8('0x9')](),controller[_0x4ca8('0x19')]);router[_0x4ca8('0x18')]('/:id/teams',auth[_0x4ca8('0x9')](),controller[_0x4ca8('0x1a')]);router[_0x4ca8('0x18')](_0x4ca8('0x13'),auth[_0x4ca8('0x9')](),controller['removeAgents']);module[_0x4ca8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c771c70..0572cdc 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 _0xddac=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xddac,0xe8));var _0xcdda=function(_0x36a99d,_0x4a9fa7){_0x36a99d=_0x36a99d-0x0;var _0x3564f4=_0xddac[_0x36a99d];return _0x3564f4;};'use strict';var Sequelize=require('sequelize');module[_0xcdda('0x0')]={'name':{'type':Sequelize[_0xcdda('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcdda('0x1')]},'timeout':{'type':Sequelize[_0xcdda('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcdda('0x3')](_0xcdda('0x4'),_0xcdda('0x5'),_0xcdda('0x6'))}}; \ No newline at end of file +var _0x078e=['STRING','INTEGER','ENUM','beepall','sequelize'];(function(_0x319c2b,_0x14059e){var _0x2e1965=function(_0x1de5e7){while(--_0x1de5e7){_0x319c2b['push'](_0x319c2b['shift']());}};_0x2e1965(++_0x14059e);}(_0x078e,0x112));var _0xe078=function(_0xdb1afc,_0xcf9b14){_0xdb1afc=_0xdb1afc-0x0;var _0x1e7a1a=_0x078e[_0xdb1afc];return _0x1e7a1a;};'use strict';var Sequelize=require(_0xe078('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe078('0x1')]},'timeout':{'type':Sequelize[_0xe078('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe078('0x3')]('rrmemory',_0xe078('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 350bacb..20f08f3 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 _0x4b19=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','json','count','offset','status','set','apply','reject','save','then','get','destroy','sendStatus','error','stack','name','index','map','SmsQueue','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','describe','getMembers','findOne','SmsQueueId','UserSmsQueue','findAll','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','Team','online','voicePause','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','forEach','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x51d4ee,_0xdead36){var _0x2939b0=function(_0x1d7bf6){while(--_0x1d7bf6){_0x51d4ee['push'](_0x51d4ee['shift']());}};_0x2939b0(++_0xdead36);}(_0x4b19,0x195));var _0x94b1=function(_0x46ab02,_0x46f430){_0x46ab02=_0x46ab02-0x0;var _0x39d9a4=_0x4b19[_0x46ab02];return _0x39d9a4;};'use strict';var pdf=require(_0x94b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b1('0x1'));var zipdir=require(_0x94b1('0x2'));var jsonpatch=require(_0x94b1('0x3'));var rp=require('request-promise');var moment=require(_0x94b1('0x4'));var BPromise=require(_0x94b1('0x5'));var Mustache=require(_0x94b1('0x6'));var util=require('util');var path=require(_0x94b1('0x7'));var sox=require(_0x94b1('0x8'));var csv=require('to-csv');var ejs=require(_0x94b1('0x9'));var fs=require('fs');var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var licenseUtil=require(_0x94b1('0x16'));var db=require(_0x94b1('0x17'))['db'];config[_0x94b1('0x18')]=_['defaults'](config['redis'],{'host':_0x94b1('0x19'),'port':0x18eb});var socket=require(_0x94b1('0x1a'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x94b1('0x1b')](socket);function respondWithStatusCode(_0xb9924c,_0x48a13c){_0x48a13c=_0x48a13c||0xcc;return function(_0x3f3eab){if(_0x3f3eab){return _0xb9924c['sendStatus'](_0x48a13c);}return _0xb9924c['status'](_0x48a13c)[_0x94b1('0x1c')]();};}function respondWithResult(_0x1f0560,_0x258e98){_0x258e98=_0x258e98||0xc8;return function(_0x1977f4){if(_0x1977f4){return _0x1f0560['status'](_0x258e98)[_0x94b1('0x1d')](_0x1977f4);}};}function respondWithFilteredResult(_0x424c45,_0xa29b90){return function(_0x224099){if(_0x224099){var _0x3a6ae0=_0x224099[_0x94b1('0x1e')],_0x1abb7f=_0xa29b90[_0x94b1('0x1f')],_0x2d33dc=_0xa29b90[_0x94b1('0x1f')]+_0xa29b90['limit'],_0x59d7cf;if(_0x2d33dc>=_0x3a6ae0){_0x2d33dc=_0x3a6ae0;_0x59d7cf=0xc8;}else{_0x59d7cf=0xce;}_0x424c45[_0x94b1('0x20')](_0x59d7cf);return _0x424c45[_0x94b1('0x21')]('Content-Range',_0x1abb7f+'-'+_0x2d33dc+'/'+_0x3a6ae0)[_0x94b1('0x1d')](_0x224099);}return null;};}function patchUpdates(_0x310b9f){return function(_0x29af54){try{jsonpatch[_0x94b1('0x22')](_0x29af54,_0x310b9f,!![]);}catch(_0x3a9c3c){return BPromise[_0x94b1('0x23')](_0x3a9c3c);}return _0x29af54[_0x94b1('0x24')]();};}function saveUpdates(_0xc8543,_0x1d88b4){return function(_0xeb777){if(_0xeb777){return _0xeb777['update'](_0xc8543)[_0x94b1('0x25')](function(_0xa112b1){return _0xa112b1;});}return null;};}function removeEntity(_0x34c324,_0x4e6409){return function(_0x374611){if(_0x374611){return _0x374611['destroy']()[_0x94b1('0x25')](function(){var _0x3d10ea=_0x374611[_0x94b1('0x26')]({'plain':!![]});var _0x109a81='SmsQueues';return db['UserProfileResource'][_0x94b1('0x27')]({'where':{'type':_0x109a81,'resourceId':_0x3d10ea['id']}})['then'](function(){return _0x374611;});})[_0x94b1('0x25')](function(){_0x34c324['status'](0xcc)[_0x94b1('0x1c')]();});}};}function handleEntityNotFound(_0x2f06b1,_0x1eda8c){return function(_0x4c2732){if(!_0x4c2732){_0x2f06b1[_0x94b1('0x28')](0x194);}return _0x4c2732;};}function handleError(_0x1d86bd,_0x467c42){_0x467c42=_0x467c42||0x1f4;return function(_0x319618){logger[_0x94b1('0x29')](_0x319618[_0x94b1('0x2a')]);if(_0x319618[_0x94b1('0x2b')]){delete _0x319618[_0x94b1('0x2b')];}_0x1d86bd[_0x94b1('0x20')](_0x467c42)['send'](_0x319618);};}exports[_0x94b1('0x2c')]=function(_0xf621ea,_0x47f019){var _0x42630a={},_0x1fe766={},_0xab9ac5={'count':0x0,'rows':[]};var _0x2d2acb=_[_0x94b1('0x2d')](db[_0x94b1('0x2e')]['rawAttributes'],function(_0x1a26eb){return{'name':_0x1a26eb['fieldName'],'type':_0x1a26eb[_0x94b1('0x2f')]['key']};});_0x1fe766['model']=_[_0x94b1('0x2d')](_0x2d2acb,_0x94b1('0x2b'));_0x1fe766[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0xf621ea[_0x94b1('0x30')]);_0x1fe766[_0x94b1('0x32')]=_[_0x94b1('0x33')](_0x1fe766[_0x94b1('0x34')],_0x1fe766[_0x94b1('0x30')]);_0x42630a[_0x94b1('0x35')]=_[_0x94b1('0x33')](_0x1fe766[_0x94b1('0x34')],qs['fields'](_0xf621ea['query'][_0x94b1('0x36')]));_0x42630a[_0x94b1('0x35')]=_0x42630a[_0x94b1('0x35')][_0x94b1('0x37')]?_0x42630a[_0x94b1('0x35')]:_0x1fe766[_0x94b1('0x34')];if(!_0xf621ea[_0x94b1('0x30')][_0x94b1('0x38')](_0x94b1('0x39'))){_0x42630a['limit']=qs[_0x94b1('0x3a')](_0xf621ea['query'][_0x94b1('0x3a')]);_0x42630a[_0x94b1('0x1f')]=qs[_0x94b1('0x1f')](_0xf621ea['query'][_0x94b1('0x1f')]);}_0x42630a[_0x94b1('0x3b')]=qs[_0x94b1('0x3c')](_0xf621ea['query'][_0x94b1('0x3c')]);_0x42630a[_0x94b1('0x3d')]=qs[_0x94b1('0x32')](_[_0x94b1('0x3e')](_0xf621ea[_0x94b1('0x30')],_0x1fe766[_0x94b1('0x32')]),_0x2d2acb);if(_0xf621ea[_0x94b1('0x30')][_0x94b1('0x3f')]){_0x42630a[_0x94b1('0x3d')]=_[_0x94b1('0x40')](_0x42630a[_0x94b1('0x3d')],{'$or':_[_0x94b1('0x2d')](_0x2d2acb,function(_0x235a44){if(_0x235a44['type']!==_0x94b1('0x41')){var _0x3a2b={};_0x3a2b[_0x235a44[_0x94b1('0x2b')]]={'$like':'%'+_0xf621ea[_0x94b1('0x30')][_0x94b1('0x3f')]+'%'};return _0x3a2b;}})});}_0x42630a=_['merge']({},_0x42630a,_0xf621ea[_0x94b1('0x42')]);var _0x158d1a={'where':_0x42630a[_0x94b1('0x3d')]};return db[_0x94b1('0x2e')][_0x94b1('0x1e')](_0x158d1a)[_0x94b1('0x25')](function(_0x51bc6b){_0xab9ac5[_0x94b1('0x1e')]=_0x51bc6b;if(_0xf621ea[_0x94b1('0x30')]['includeAll']){_0x42630a[_0x94b1('0x43')]=[{'all':!![]}];}return db[_0x94b1('0x2e')]['findAll'](_0x42630a);})[_0x94b1('0x25')](function(_0x442157){_0xab9ac5[_0x94b1('0x44')]=_0x442157;return _0xab9ac5;})['then'](respondWithFilteredResult(_0x47f019,_0x42630a))[_0x94b1('0x45')](handleError(_0x47f019,null));};exports[_0x94b1('0x46')]=function(_0x119f3a,_0xeb94e4){var _0x3f56a9={'raw':!![],'where':{'id':_0x119f3a[_0x94b1('0x47')]['id']}},_0x2a78a4={};_0x2a78a4['model']=_[_0x94b1('0x31')](db[_0x94b1('0x2e')][_0x94b1('0x48')]);_0x2a78a4['query']=_[_0x94b1('0x31')](_0x119f3a[_0x94b1('0x30')]);_0x2a78a4['filters']=_[_0x94b1('0x33')](_0x2a78a4[_0x94b1('0x34')],_0x2a78a4[_0x94b1('0x30')]);_0x3f56a9[_0x94b1('0x35')]=_[_0x94b1('0x33')](_0x2a78a4[_0x94b1('0x34')],qs[_0x94b1('0x36')](_0x119f3a[_0x94b1('0x30')][_0x94b1('0x36')]));_0x3f56a9[_0x94b1('0x35')]=_0x3f56a9[_0x94b1('0x35')][_0x94b1('0x37')]?_0x3f56a9[_0x94b1('0x35')]:_0x2a78a4[_0x94b1('0x34')];if(_0x119f3a[_0x94b1('0x30')][_0x94b1('0x49')]){_0x3f56a9[_0x94b1('0x43')]=[{'all':!![]}];}_0x3f56a9=_[_0x94b1('0x40')]({},_0x3f56a9,_0x119f3a[_0x94b1('0x42')]);return db['SmsQueue'][_0x94b1('0x4a')](_0x3f56a9)['then'](handleEntityNotFound(_0xeb94e4,null))[_0x94b1('0x25')](respondWithResult(_0xeb94e4,null))[_0x94b1('0x45')](handleError(_0xeb94e4,null));};exports[_0x94b1('0x4b')]=function(_0x54fc33,_0x4dacb2){return db['SmsQueue'][_0x94b1('0x4b')](_0x54fc33[_0x94b1('0x4c')],{})[_0x94b1('0x25')](function(_0x5ed93a){var _0x491128=_0x54fc33['user'][_0x94b1('0x26')]({'plain':!![]});if(!_0x491128)throw new Error(_0x94b1('0x4d'));if(_0x491128[_0x94b1('0x4e')]===_0x94b1('0x4f')){var _0x4109ca=_0x5ed93a[_0x94b1('0x26')]({'plain':!![]});var _0x213df3='SmsQueues';return db[_0x94b1('0x50')][_0x94b1('0x4a')]({'where':{'name':_0x213df3,'userProfileId':_0x491128[_0x94b1('0x51')]},'raw':!![]})[_0x94b1('0x25')](function(_0x344ebe){if(_0x344ebe&&_0x344ebe[_0x94b1('0x52')]===0x0){return db[_0x94b1('0x53')][_0x94b1('0x4b')]({'name':_0x4109ca[_0x94b1('0x2b')],'resourceId':_0x4109ca['id'],'type':_0x344ebe[_0x94b1('0x2b')],'sectionId':_0x344ebe['id']},{})[_0x94b1('0x25')](function(){return _0x5ed93a;});}else{return _0x5ed93a;}})[_0x94b1('0x45')](function(_0x94fe10){logger[_0x94b1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x94fe10);throw _0x94fe10;});}return _0x5ed93a;})[_0x94b1('0x25')](respondWithResult(_0x4dacb2,0xc9))[_0x94b1('0x45')](handleError(_0x4dacb2,null));};exports[_0x94b1('0x54')]=function(_0x137f67,_0x285385){if(_0x137f67[_0x94b1('0x4c')]['id']){delete _0x137f67[_0x94b1('0x4c')]['id'];}return db[_0x94b1('0x2e')][_0x94b1('0x4a')]({'where':{'id':_0x137f67['params']['id']}})[_0x94b1('0x25')](handleEntityNotFound(_0x285385,null))[_0x94b1('0x25')](saveUpdates(_0x137f67[_0x94b1('0x4c')],null))[_0x94b1('0x25')](respondWithResult(_0x285385,null))[_0x94b1('0x45')](handleError(_0x285385,null));};exports[_0x94b1('0x27')]=function(_0x572657,_0x155a56){return db[_0x94b1('0x2e')][_0x94b1('0x4a')]({'where':{'id':_0x572657[_0x94b1('0x47')]['id']}})[_0x94b1('0x25')](handleEntityNotFound(_0x155a56,null))[_0x94b1('0x25')](removeEntity(_0x155a56,null))[_0x94b1('0x45')](handleError(_0x155a56,null));};exports[_0x94b1('0x55')]=function(_0x3d7669,_0x502d2c){return db['SmsQueue'][_0x94b1('0x55')]()[_0x94b1('0x25')](respondWithResult(_0x502d2c,null))[_0x94b1('0x45')](handleError(_0x502d2c,null));};exports[_0x94b1('0x56')]=function(_0x21caaa,_0x2c240a,_0x152a22){var _0xcdf3e8={'raw':!![],'where':{}},_0x388b18={},_0x65157d;return db[_0x94b1('0x2e')][_0x94b1('0x57')]({'where':{'id':_0x21caaa[_0x94b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c240a,null))[_0x94b1('0x25')](function(_0x1ca461){if(_0x1ca461){_0x65157d=_0x1ca461[_0x94b1('0x26')]({'plain':!![]});_0x388b18[_0x94b1('0x34')]=_[_0x94b1('0x31')](db['UserSmsQueue'][_0x94b1('0x48')]);_0x388b18[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x21caaa[_0x94b1('0x30')]);_0x388b18[_0x94b1('0x32')]=_['intersection'](_0x388b18['model'],_0x388b18[_0x94b1('0x30')]);_0xcdf3e8[_0x94b1('0x35')]=_[_0x94b1('0x33')](_0x388b18['model'],qs[_0x94b1('0x36')](_0x21caaa[_0x94b1('0x30')]['fields']));_0xcdf3e8['attributes']=_0xcdf3e8[_0x94b1('0x35')][_0x94b1('0x37')]?_0xcdf3e8[_0x94b1('0x35')]:_0x388b18[_0x94b1('0x34')];if(!_0x21caaa[_0x94b1('0x30')][_0x94b1('0x38')](_0x94b1('0x39'))){_0xcdf3e8[_0x94b1('0x3a')]=qs['limit'](_0x21caaa[_0x94b1('0x30')]['limit']);_0xcdf3e8[_0x94b1('0x1f')]=qs[_0x94b1('0x1f')](_0x21caaa[_0x94b1('0x30')]['offset']);}_0xcdf3e8[_0x94b1('0x3b')]=qs['sort'](_0x21caaa[_0x94b1('0x30')][_0x94b1('0x3c')]);_0xcdf3e8[_0x94b1('0x3d')]=qs[_0x94b1('0x32')](_[_0x94b1('0x3e')](_0x21caaa['query'],_0x388b18['filters']));_0xcdf3e8[_0x94b1('0x3d')][_0x94b1('0x58')]=_0x1ca461['id'];if(_0x21caaa[_0x94b1('0x30')][_0x94b1('0x3f')]){_0xcdf3e8[_0x94b1('0x3d')]=_[_0x94b1('0x40')](_0xcdf3e8[_0x94b1('0x3d')],{'$or':_[_0x94b1('0x2d')](_0xcdf3e8['attributes'],function(_0x5c9e62){var _0x1578c9={};_0x1578c9[_0x5c9e62]={'$like':'%'+_0x21caaa['query'][_0x94b1('0x3f')]+'%'};return _0x1578c9;})});}_0xcdf3e8=_['merge']({},_0xcdf3e8,_0x21caaa[_0x94b1('0x42')]);return db[_0x94b1('0x59')][_0x94b1('0x5a')](_0xcdf3e8);}})[_0x94b1('0x25')](function(_0x1a3298){if(_0x1a3298){return db[_0x94b1('0x5b')]['findAndCountAll']({'where':{'id':_[_0x94b1('0x2d')](_0x1a3298,_0x94b1('0x5c')),'role':_0x94b1('0x5d')},'attributes':['id',_0x94b1('0x2b'),_0x94b1('0x5e'),_0x94b1('0x5f'),_0x94b1('0x60')]});}})['then'](function(_0x19319a){if(_0x19319a){return{'count':_0x19319a[_0x94b1('0x1e')],'rows':_[_0x94b1('0x2d')](_0x19319a[_0x94b1('0x44')],function(_0x416f80){return{'membername':_0x416f80[_0x94b1('0x2b')],'UserId':_0x416f80['id'],'queue_name':_0x65157d[_0x94b1('0x2b')],'SmsQueueId':_0x65157d['id'],'interface':util['format'](_0x94b1('0x61'),'SIP',_0x416f80[_0x94b1('0x2b')]),'penalty':0x0,'paused':_0x416f80[_0x94b1('0x5e')],'createdAt':_0x416f80[_0x94b1('0x60')],'updatedAt':_0x416f80[_0x94b1('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2c240a,_0xcdf3e8))['catch'](handleError(_0x2c240a,null));};exports[_0x94b1('0x62')]=function(_0xbecafd,_0x49ffcd,_0xe48788){var _0x3dd773={};var _0xc57189={};var _0x55981a;var _0x14e930;return db[_0x94b1('0x2e')][_0x94b1('0x57')]({'where':{'id':_0xbecafd[_0x94b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x49ffcd,null))[_0x94b1('0x25')](function(_0x486841){if(_0x486841){_0x55981a=_0x486841;_0xc57189['model']=_['keys'](db[_0x94b1('0x63')][_0x94b1('0x48')]);_0xc57189[_0x94b1('0x30')]=_['keys'](_0xbecafd['query']);_0xc57189['filters']=_[_0x94b1('0x33')](_0xc57189[_0x94b1('0x34')],_0xc57189['query']);_0x3dd773['attributes']=_['intersection'](_0xc57189[_0x94b1('0x34')],qs[_0x94b1('0x36')](_0xbecafd[_0x94b1('0x30')][_0x94b1('0x36')]));_0x3dd773['attributes']=_0x3dd773['attributes'][_0x94b1('0x37')]?_0x3dd773[_0x94b1('0x35')]:_0xc57189[_0x94b1('0x34')];_0x3dd773[_0x94b1('0x3b')]=qs['sort'](_0xbecafd['query']['sort']);_0x3dd773[_0x94b1('0x3d')]=qs[_0x94b1('0x32')](_[_0x94b1('0x3e')](_0xbecafd[_0x94b1('0x30')],_0xc57189[_0x94b1('0x32')]));if(_0xbecafd['query'][_0x94b1('0x3f')]){_0x3dd773[_0x94b1('0x3d')]=_['merge'](_0x3dd773[_0x94b1('0x3d')],{'$or':_['map'](_0x3dd773['attributes'],function(_0x416055){var _0x5edac4={};_0x5edac4[_0x416055]={'$like':'%'+_0xbecafd[_0x94b1('0x30')][_0x94b1('0x3f')]+'%'};return _0x5edac4;})});}_0x3dd773=_[_0x94b1('0x40')]({},_0x3dd773,_0xbecafd[_0x94b1('0x42')]);return _0x55981a[_0x94b1('0x62')](_0x3dd773);}})['then'](function(_0x4178f7){if(_0x4178f7){_0x14e930=_0x4178f7['length'];if(!_0xbecafd[_0x94b1('0x30')][_0x94b1('0x38')](_0x94b1('0x39'))){_0x3dd773['limit']=qs[_0x94b1('0x3a')](_0xbecafd[_0x94b1('0x30')]['limit']);_0x3dd773['offset']=qs[_0x94b1('0x1f')](_0xbecafd[_0x94b1('0x30')][_0x94b1('0x1f')]);}return _0x55981a[_0x94b1('0x62')](_0x3dd773);}})['then'](function(_0x505ccf){if(_0x505ccf){return _0x505ccf?{'count':_0x14e930,'rows':_0x505ccf}:null;}})['then'](respondWithResult(_0x49ffcd,null))[_0x94b1('0x45')](handleError(_0x49ffcd,null));};exports['addTeams']=function(_0x31e7f2,_0x4ba865,_0x497c2f){var _0x3f0958=_0x31e7f2[_0x94b1('0x4c')]['ids'];return db[_0x94b1('0x63')][_0x94b1('0x5a')]({'where':{'id':_0x3f0958},'attributes':['id'],'include':[{'model':db[_0x94b1('0x5b')],'as':'Agents','attributes':['id',_0x94b1('0x2b'),_0x94b1('0x64'),_0x94b1('0x65'),'interface'],'raw':!![]}]})[_0x94b1('0x25')](function(_0x4d6c7e){if(_0x4d6c7e){var _0x595ae3=_[_0x94b1('0x66')](_0x4d6c7e,function(_0x4bf1a7){var _0x3ca231=_0x4bf1a7['get']({'plain':!![]});return _0x3ca231[_0x94b1('0x67')];});return db['SmsQueue'][_0x94b1('0x4a')]({'where':{'id':_0x31e7f2['params']['id']}})[_0x94b1('0x25')](function(_0xc8dea3){return db[_0x94b1('0x68')][_0x94b1('0x69')](function(_0x16ce3d){return _0xc8dea3[_0x94b1('0x6a')](_0x3f0958,{'transaction':_0x16ce3d})['then'](function(){return BPromise[_0x94b1('0x6b')](_0x595ae3,function(_0x21c3b2){return db[_0x94b1('0x59')][_0x94b1('0x6c')]({'where':{'UserId':_0x21c3b2['id'],'SmsQueueId':_0x31e7f2[_0x94b1('0x47')]['id']},'transaction':_0x16ce3d});});})[_0x94b1('0x25')](function(){_0x595ae3['forEach'](function(_0x1e2f75){socket[_0x94b1('0x6d')]('userSmsQueue:save',{'UserId':_0x1e2f75['id'],'SmsQueueId':_0xc8dea3['id']});});});});});}})[_0x94b1('0x25')](respondWithStatusCode(_0x4ba865,null))[_0x94b1('0x45')](handleError(_0x4ba865,null));};exports[_0x94b1('0x6e')]=function(_0x40c5c2,_0x2d3c76,_0x2eefa3){return db[_0x94b1('0x63')][_0x94b1('0x5a')]({'where':{'id':_0x40c5c2[_0x94b1('0x30')][_0x94b1('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x94b1('0x5b')],'as':_0x94b1('0x67'),'attributes':['id'],'raw':!![]}]})[_0x94b1('0x25')](handleEntityNotFound(_0x2d3c76,null))[_0x94b1('0x25')](function(_0x22165b){var _0x11638f=_[_0x94b1('0x2d')](_0x22165b,'id');var _0x31a609=[];var _0x385485=[];var _0x2c7e26=squel[_0x94b1('0x70')]();_0x2c7e26[_0x94b1('0x71')](_0x94b1('0x72'))[_0x94b1('0x73')](_0x94b1('0x74'),'tq')[_0x94b1('0x75')](_0x94b1('0x76'),'ut',_0x94b1('0x77'))[_0x94b1('0x3d')](_0x94b1('0x78'),_0x40c5c2[_0x94b1('0x47')]['id']);for(var _0x472378=0x0;_0x472378<_0x22165b['length'];_0x472378+=0x1){let _0x17e525=_0x22165b[_0x472378];for(var _0x2f768a=0x0;_0x2f768a<_0x17e525['Agents']['length'];_0x2f768a+=0x1){let _0x35aa82=_0x17e525['Agents'][_0x2f768a];var _0x15dd47=_0x2c7e26['clone']();_0x15dd47[_0x94b1('0x3d')](_0x94b1('0x79'),_0x35aa82['id']);_0x385485[_0x94b1('0x7a')](db['sequelize']['query'](_0x15dd47[_0x94b1('0x7b')](),{'type':db[_0x94b1('0x68')][_0x94b1('0x7c')][_0x94b1('0x7d')]})[_0x94b1('0x25')](function(_0x2a291b){if(_0x2a291b[_0x94b1('0x37')]===0x1){return _0x35aa82['id'];}else{var _0x5dd6a4=_[_0x94b1('0x7e')](_[_0x94b1('0x2d')](_0x2a291b,_0x94b1('0x7f')),function(_0x338f2c){return _[_0x94b1('0x80')](_0x11638f,_0x338f2c);});if(_0x5dd6a4){return _0x35aa82['id'];}}}));}}return BPromise[_0x94b1('0x81')](_0x385485)['then'](function(_0x27267f){_0x31a609=_(_0x31a609)[_0x94b1('0x82')](_0x27267f)['compact']()[_0x94b1('0x83')]();return db[_0x94b1('0x2e')]['find']({'where':{'id':_0x40c5c2[_0x94b1('0x47')]['id']}})[_0x94b1('0x25')](function(_0x31d6ca){return db['sequelize'][_0x94b1('0x69')](function(_0x14e304){return _0x31d6ca['removeTeams'](_0x40c5c2['query'][_0x94b1('0x6f')],{'transaction':_0x14e304})[_0x94b1('0x25')](function(){if(!_[_0x94b1('0x84')](_0x31a609)){return _0x31d6ca['removeAgents'](_0x31a609,{'transaction':_0x14e304});}})[_0x94b1('0x25')](function(){_0x31a609[_0x94b1('0x85')](function(_0x45314c){socket[_0x94b1('0x6d')](_0x94b1('0x86'),{'UserId':_0x45314c,'SmsQueueId':_0x31d6ca['id']});});});});});});})[_0x94b1('0x25')](respondWithStatusCode(_0x2d3c76,null))['catch'](handleError(_0x2d3c76,null));};exports[_0x94b1('0x87')]=function(_0x24235c,_0xfa335e,_0x3f5384){return db[_0x94b1('0x2e')]['find']({'where':{'id':_0x24235c[_0x94b1('0x47')]['id']}})['then'](handleEntityNotFound(_0xfa335e,null))['then'](function(_0x2a10da){if(_0x2a10da){return _0x2a10da[_0x94b1('0x87')](_0x24235c[_0x94b1('0x4c')][_0x94b1('0x6f')],_['omit'](_0x24235c[_0x94b1('0x4c')],[_0x94b1('0x6f'),'id'])||{})[_0x94b1('0x88')](function(_0x528f1e){for(var _0x36325b=0x0;_0x36325b<_0x24235c[_0x94b1('0x4c')][_0x94b1('0x6f')]['length'];_0x36325b+=0x1){socket[_0x94b1('0x6d')](_0x94b1('0x89'),{'UserId':_0x24235c['body'][_0x94b1('0x6f')][_0x36325b],'SmsQueueId':_0x24235c[_0x94b1('0x47')]['id']});}return _0x528f1e;});}})[_0x94b1('0x25')](respondWithResult(_0xfa335e,null))[_0x94b1('0x45')](handleError(_0xfa335e,null));};exports[_0x94b1('0x8a')]=function(_0x4a0b5a,_0x5b9a71,_0x56deaa){return db[_0x94b1('0x2e')][_0x94b1('0x4a')]({'where':{'id':_0x4a0b5a[_0x94b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b9a71,null))[_0x94b1('0x25')](function(_0x10893f){if(_0x10893f){return _0x10893f[_0x94b1('0x8a')](_0x4a0b5a[_0x94b1('0x30')][_0x94b1('0x6f')])[_0x94b1('0x25')](function(){if(_[_0x94b1('0x8b')](_0x4a0b5a[_0x94b1('0x30')][_0x94b1('0x6f')])){for(var _0xe56903=0x0;_0xe56903<_0x4a0b5a['query'][_0x94b1('0x6f')][_0x94b1('0x37')];_0xe56903+=0x1){socket[_0x94b1('0x6d')](_0x94b1('0x86'),{'UserId':Number(_0x4a0b5a[_0x94b1('0x30')][_0x94b1('0x6f')][_0xe56903]),'SmsQueueId':Number(_0x4a0b5a[_0x94b1('0x47')]['id'])});}}else{socket[_0x94b1('0x6d')](_0x94b1('0x86'),{'UserId':Number(_0x4a0b5a['query']['ids']),'SmsQueueId':Number(_0x4a0b5a['params']['id'])});}});}})[_0x94b1('0x25')](respondWithStatusCode(_0x5b9a71,null))[_0x94b1('0x45')](handleError(_0x5b9a71,null));};exports[_0x94b1('0x8c')]=function(_0x1e751f,_0x51b24c,_0x1057de){var _0x2e43f0={};var _0x412d64={};var _0x251ff2;var _0x7f8aea;return db[_0x94b1('0x2e')]['findOne']({'where':{'id':_0x1e751f['params']['id']}})['then'](handleEntityNotFound(_0x51b24c,null))['then'](function(_0x40bef4){if(_0x40bef4){_0x251ff2=_0x40bef4;_0x412d64[_0x94b1('0x34')]=_[_0x94b1('0x31')](db[_0x94b1('0x5b')][_0x94b1('0x48')]);_0x412d64[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x1e751f[_0x94b1('0x30')]);_0x412d64['filters']=_[_0x94b1('0x33')](_0x412d64[_0x94b1('0x34')],_0x412d64[_0x94b1('0x30')]);_0x2e43f0['attributes']=_[_0x94b1('0x33')](_0x412d64[_0x94b1('0x34')],qs[_0x94b1('0x36')](_0x1e751f[_0x94b1('0x30')][_0x94b1('0x36')]));_0x2e43f0['attributes']=_0x2e43f0[_0x94b1('0x35')][_0x94b1('0x37')]?_0x2e43f0[_0x94b1('0x35')]:_0x412d64[_0x94b1('0x34')];_0x2e43f0[_0x94b1('0x3b')]=qs[_0x94b1('0x3c')](_0x1e751f[_0x94b1('0x30')][_0x94b1('0x3c')]);_0x2e43f0[_0x94b1('0x3d')]=qs[_0x94b1('0x32')](_['pick'](_0x1e751f['query'],_0x412d64[_0x94b1('0x32')]));if(_0x1e751f[_0x94b1('0x30')][_0x94b1('0x3f')]){_0x2e43f0[_0x94b1('0x3d')]=_[_0x94b1('0x40')](_0x2e43f0[_0x94b1('0x3d')],{'$or':_['map'](_0x2e43f0[_0x94b1('0x35')],function(_0x4dd54c){var _0xafaac={};_0xafaac[_0x4dd54c]={'$like':'%'+_0x1e751f['query'][_0x94b1('0x3f')]+'%'};return _0xafaac;})});}_0x2e43f0=_['merge']({},_0x2e43f0,_0x1e751f[_0x94b1('0x42')]);return _0x251ff2[_0x94b1('0x8c')](_0x2e43f0);}})[_0x94b1('0x25')](function(_0x5c4d3e){if(_0x5c4d3e){_0x7f8aea=_0x5c4d3e[_0x94b1('0x37')];if(!_0x1e751f[_0x94b1('0x30')][_0x94b1('0x38')](_0x94b1('0x39'))){_0x2e43f0[_0x94b1('0x3a')]=qs['limit'](_0x1e751f['query'][_0x94b1('0x3a')]);_0x2e43f0[_0x94b1('0x1f')]=qs[_0x94b1('0x1f')](_0x1e751f[_0x94b1('0x30')][_0x94b1('0x1f')]);}return _0x251ff2['getAgents'](_0x2e43f0);}})['then'](function(_0x2f2bac){if(_0x2f2bac){return _0x2f2bac?{'count':_0x7f8aea,'rows':_0x2f2bac}:null;}})[_0x94b1('0x25')](respondWithResult(_0x51b24c,null))[_0x94b1('0x45')](handleError(_0x51b24c,null));}; \ No newline at end of file +var _0x5fc3=['team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','userSmsQueue:remove','addAgents','omit','spread','emit','userSmsQueue:save','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','SmsQueues','destroy','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','nolimit','order','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','Team','addTeams','ids','Agents','voicePause','transaction','findOrCreate','forEach','removeTeams','select','tq.TeamId','from'];(function(_0x482a12,_0x38e1d2){var _0xcd464e=function(_0x4c82c9){while(--_0x4c82c9){_0x482a12['push'](_0x482a12['shift']());}};_0xcd464e(++_0x38e1d2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x5fc3[_0x45bf86];return _0x1f02b7;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');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('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var licenseUtil=require(_0x35fc('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x35fc('0x18')](config['redis'],{'host':_0x35fc('0x19'),'port':0x18eb});var socket=require(_0x35fc('0x1a'))(new Redis(config[_0x35fc('0x1b')]));require(_0x35fc('0x1c'))[_0x35fc('0x1d')](socket);function respondWithStatusCode(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xcc;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['sendStatus'](_0x59507a);}return _0x5cfe94[_0x35fc('0x1e')](_0x59507a)[_0x35fc('0x1f')]();};}function respondWithResult(_0x53b898,_0x154958){_0x154958=_0x154958||0xc8;return function(_0x227a49){if(_0x227a49){return _0x53b898[_0x35fc('0x1e')](_0x154958)['json'](_0x227a49);}};}function respondWithFilteredResult(_0x26ba54,_0x45c8b7){return function(_0x553677){if(_0x553677){var _0x41e165=_0x553677[_0x35fc('0x20')],_0x363e47=_0x45c8b7[_0x35fc('0x21')],_0x2e513b=_0x45c8b7[_0x35fc('0x21')]+_0x45c8b7['limit'],_0x5f56c6;if(_0x2e513b>=_0x41e165){_0x2e513b=_0x41e165;_0x5f56c6=0xc8;}else{_0x5f56c6=0xce;}_0x26ba54[_0x35fc('0x1e')](_0x5f56c6);return _0x26ba54[_0x35fc('0x22')](_0x35fc('0x23'),_0x363e47+'-'+_0x2e513b+'/'+_0x41e165)[_0x35fc('0x24')](_0x553677);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x25')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x26')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x27')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x28')](_0x5bd2b8)[_0x35fc('0x29')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x29')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x2a')]({'plain':!![]});var _0x51cfec=_0x35fc('0x2b');return db['UserProfileResource'][_0x35fc('0x2c')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x29')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1f')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2d')](_0x383837[_0x35fc('0x2e')]);if(_0x383837[_0x35fc('0x2f')]){delete _0x383837[_0x35fc('0x2f')];}_0x26b7cb[_0x35fc('0x1e')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x30')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x31')](db[_0x35fc('0x32')][_0x35fc('0x33')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x34')],'type':_0x222ddb[_0x35fc('0x35')][_0x35fc('0x36')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2f'));_0xe79f52['query']=_[_0x35fc('0x37')](_0x220931[_0x35fc('0x38')]);_0xe79f52[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0xe79f52[_0x35fc('0x3b')],_0xe79f52[_0x35fc('0x38')]);_0x52acc5['attributes']=_[_0x35fc('0x3a')](_0xe79f52[_0x35fc('0x3b')],qs[_0x35fc('0x3c')](_0x220931[_0x35fc('0x38')][_0x35fc('0x3c')]));_0x52acc5[_0x35fc('0x3d')]=_0x52acc5['attributes'][_0x35fc('0x3e')]?_0x52acc5[_0x35fc('0x3d')]:_0xe79f52[_0x35fc('0x3b')];if(!_0x220931['query'][_0x35fc('0x3f')]('nolimit')){_0x52acc5[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0x220931[_0x35fc('0x38')][_0x35fc('0x40')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x21')]);}_0x52acc5['order']=qs[_0x35fc('0x41')](_0x220931['query'][_0x35fc('0x41')]);_0x52acc5[_0x35fc('0x42')]=qs[_0x35fc('0x39')](_[_0x35fc('0x43')](_0x220931[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x39')]),_0x3822a8);if(_0x220931[_0x35fc('0x38')]['filter']){_0x52acc5[_0x35fc('0x42')]=_[_0x35fc('0x44')](_0x52acc5['where'],{'$or':_[_0x35fc('0x31')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x35')]!==_0x35fc('0x45')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2f')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x46')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x44')]({},_0x52acc5,_0x220931[_0x35fc('0x47')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x42')]};return db[_0x35fc('0x32')]['count'](_0x52543b)[_0x35fc('0x29')](function(_0x280af1){_0x16f067[_0x35fc('0x20')]=_0x280af1;if(_0x220931[_0x35fc('0x38')][_0x35fc('0x48')]){_0x52acc5[_0x35fc('0x49')]=[{'all':!![]}];}return db[_0x35fc('0x32')][_0x35fc('0x4a')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x4b')]=_0x596e83;return _0x16f067;})[_0x35fc('0x29')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x4c')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x3b')]=_[_0x35fc('0x37')](db[_0x35fc('0x32')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x3a')](_0x4e56ed[_0x35fc('0x3b')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3d')]=_['intersection'](_0x4e56ed[_0x35fc('0x3b')],qs[_0x35fc('0x3c')](_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3c')]));_0x10f98b[_0x35fc('0x3d')]=_0x10f98b['attributes'][_0x35fc('0x3e')]?_0x10f98b[_0x35fc('0x3d')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x38')][_0x35fc('0x48')]){_0x10f98b[_0x35fc('0x49')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x44')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x32')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x29')](respondWithResult(_0x79677d,null))[_0x35fc('0x4d')](handleError(_0x79677d,null));};exports[_0x35fc('0x4e')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x32')][_0x35fc('0x4e')](_0xca8aef[_0x35fc('0x4f')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x50')][_0x35fc('0x2a')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x51'));if(_0x91d7c0[_0x35fc('0x52')]===_0x35fc('0x50')){var _0x347a4a=_0x3e2961[_0x35fc('0x2a')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x2b');return db[_0x35fc('0x53')][_0x35fc('0x54')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x55')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x56')]===0x0){return db[_0x35fc('0x57')][_0x35fc('0x4e')]({'name':_0x347a4a[_0x35fc('0x2f')],'resourceId':_0x347a4a['id'],'type':_0x553ed6[_0x35fc('0x2f')],'sectionId':_0x553ed6['id']},{})[_0x35fc('0x29')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2d')](_0x35fc('0x58'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x29')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x4d')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4f')]['id'];}return db[_0x35fc('0x32')]['find']({'where':{'id':_0x467980[_0x35fc('0x4c')]['id']}})[_0x35fc('0x29')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x29')](saveUpdates(_0x467980[_0x35fc('0x4f')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['SmsQueue'][_0x35fc('0x54')]({'where':{'id':_0x240338[_0x35fc('0x4c')]['id']}})[_0x35fc('0x29')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x29')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x4d')](handleError(_0x2ea8d6,null));};exports['describe']=function(_0x2d9d45,_0x757aa6){return db[_0x35fc('0x32')]['describe']()[_0x35fc('0x29')](respondWithResult(_0x757aa6,null))[_0x35fc('0x4d')](handleError(_0x757aa6,null));};exports['getMembers']=function(_0x35a676,_0x164c7b,_0x1c46b1){var _0x1c4c33={'raw':!![],'where':{}},_0x314666={},_0x41453b;return db[_0x35fc('0x32')][_0x35fc('0x59')]({'where':{'id':_0x35a676['params']['id']}})[_0x35fc('0x29')](handleEntityNotFound(_0x164c7b,null))[_0x35fc('0x29')](function(_0x303927){if(_0x303927){_0x41453b=_0x303927['get']({'plain':!![]});_0x314666[_0x35fc('0x3b')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x314666[_0x35fc('0x38')]=_[_0x35fc('0x37')](_0x35a676[_0x35fc('0x38')]);_0x314666[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x314666['model'],_0x314666['query']);_0x1c4c33['attributes']=_['intersection'](_0x314666['model'],qs[_0x35fc('0x3c')](_0x35a676[_0x35fc('0x38')][_0x35fc('0x3c')]));_0x1c4c33[_0x35fc('0x3d')]=_0x1c4c33['attributes'][_0x35fc('0x3e')]?_0x1c4c33[_0x35fc('0x3d')]:_0x314666[_0x35fc('0x3b')];if(!_0x35a676[_0x35fc('0x38')][_0x35fc('0x3f')](_0x35fc('0x5a'))){_0x1c4c33[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0x35a676[_0x35fc('0x38')]['limit']);_0x1c4c33[_0x35fc('0x21')]=qs['offset'](_0x35a676[_0x35fc('0x38')][_0x35fc('0x21')]);}_0x1c4c33[_0x35fc('0x5b')]=qs[_0x35fc('0x41')](_0x35a676['query'][_0x35fc('0x41')]);_0x1c4c33['where']=qs['filters'](_['pick'](_0x35a676[_0x35fc('0x38')],_0x314666['filters']));_0x1c4c33[_0x35fc('0x42')]['SmsQueueId']=_0x303927['id'];if(_0x35a676[_0x35fc('0x38')]['filter']){_0x1c4c33[_0x35fc('0x42')]=_[_0x35fc('0x44')](_0x1c4c33[_0x35fc('0x42')],{'$or':_[_0x35fc('0x31')](_0x1c4c33['attributes'],function(_0x3d0ecc){var _0x1e2214={};_0x1e2214[_0x3d0ecc]={'$like':'%'+_0x35a676[_0x35fc('0x38')]['filter']+'%'};return _0x1e2214;})});}_0x1c4c33=_[_0x35fc('0x44')]({},_0x1c4c33,_0x35a676[_0x35fc('0x47')]);return db[_0x35fc('0x5c')][_0x35fc('0x4a')](_0x1c4c33);}})[_0x35fc('0x29')](function(_0x2c4309){if(_0x2c4309){return db[_0x35fc('0x5d')][_0x35fc('0x5e')]({'where':{'id':_['map'](_0x2c4309,_0x35fc('0x5f')),'role':_0x35fc('0x60')},'attributes':['id',_0x35fc('0x2f'),'smsPause',_0x35fc('0x61'),_0x35fc('0x62')]});}})['then'](function(_0x4d09d4){if(_0x4d09d4){return{'count':_0x4d09d4[_0x35fc('0x20')],'rows':_['map'](_0x4d09d4[_0x35fc('0x4b')],function(_0x2dbc81){return{'membername':_0x2dbc81[_0x35fc('0x2f')],'UserId':_0x2dbc81['id'],'queue_name':_0x41453b[_0x35fc('0x2f')],'SmsQueueId':_0x41453b['id'],'interface':util[_0x35fc('0x63')](_0x35fc('0x64'),_0x35fc('0x65'),_0x2dbc81[_0x35fc('0x2f')]),'penalty':0x0,'paused':_0x2dbc81[_0x35fc('0x66')],'createdAt':_0x2dbc81[_0x35fc('0x62')],'updatedAt':_0x2dbc81[_0x35fc('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x35fc('0x29')](respondWithFilteredResult(_0x164c7b,_0x1c4c33))[_0x35fc('0x4d')](handleError(_0x164c7b,null));};exports[_0x35fc('0x67')]=function(_0x184f28,_0xd1e7ed,_0x2d8219){var _0x2d7b16={};var _0x3b2160={};var _0x3f3f36;var _0x4ba1b0;return db[_0x35fc('0x32')]['findOne']({'where':{'id':_0x184f28[_0x35fc('0x4c')]['id']}})[_0x35fc('0x29')](handleEntityNotFound(_0xd1e7ed,null))[_0x35fc('0x29')](function(_0x516b26){if(_0x516b26){_0x3f3f36=_0x516b26;_0x3b2160[_0x35fc('0x3b')]=_[_0x35fc('0x37')](db[_0x35fc('0x68')][_0x35fc('0x33')]);_0x3b2160[_0x35fc('0x38')]=_[_0x35fc('0x37')](_0x184f28[_0x35fc('0x38')]);_0x3b2160['filters']=_[_0x35fc('0x3a')](_0x3b2160[_0x35fc('0x3b')],_0x3b2160[_0x35fc('0x38')]);_0x2d7b16[_0x35fc('0x3d')]=_[_0x35fc('0x3a')](_0x3b2160[_0x35fc('0x3b')],qs['fields'](_0x184f28[_0x35fc('0x38')][_0x35fc('0x3c')]));_0x2d7b16[_0x35fc('0x3d')]=_0x2d7b16[_0x35fc('0x3d')][_0x35fc('0x3e')]?_0x2d7b16[_0x35fc('0x3d')]:_0x3b2160[_0x35fc('0x3b')];_0x2d7b16[_0x35fc('0x5b')]=qs[_0x35fc('0x41')](_0x184f28['query'][_0x35fc('0x41')]);_0x2d7b16['where']=qs[_0x35fc('0x39')](_[_0x35fc('0x43')](_0x184f28['query'],_0x3b2160[_0x35fc('0x39')]));if(_0x184f28[_0x35fc('0x38')][_0x35fc('0x46')]){_0x2d7b16[_0x35fc('0x42')]=_[_0x35fc('0x44')](_0x2d7b16[_0x35fc('0x42')],{'$or':_[_0x35fc('0x31')](_0x2d7b16[_0x35fc('0x3d')],function(_0x25ee61){var _0x5806bf={};_0x5806bf[_0x25ee61]={'$like':'%'+_0x184f28['query']['filter']+'%'};return _0x5806bf;})});}_0x2d7b16=_['merge']({},_0x2d7b16,_0x184f28[_0x35fc('0x47')]);return _0x3f3f36[_0x35fc('0x67')](_0x2d7b16);}})[_0x35fc('0x29')](function(_0x1f5cbc){if(_0x1f5cbc){_0x4ba1b0=_0x1f5cbc[_0x35fc('0x3e')];if(!_0x184f28['query'][_0x35fc('0x3f')](_0x35fc('0x5a'))){_0x2d7b16[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0x184f28['query'][_0x35fc('0x40')]);_0x2d7b16[_0x35fc('0x21')]=qs[_0x35fc('0x21')](_0x184f28['query'][_0x35fc('0x21')]);}return _0x3f3f36[_0x35fc('0x67')](_0x2d7b16);}})[_0x35fc('0x29')](function(_0x9fe765){if(_0x9fe765){return _0x9fe765?{'count':_0x4ba1b0,'rows':_0x9fe765}:null;}})[_0x35fc('0x29')](respondWithResult(_0xd1e7ed,null))[_0x35fc('0x4d')](handleError(_0xd1e7ed,null));};exports[_0x35fc('0x69')]=function(_0x13fc47,_0x4b6c03,_0x2faff7){var _0xa2c5f8=_0x13fc47[_0x35fc('0x4f')][_0x35fc('0x6a')];return db[_0x35fc('0x68')][_0x35fc('0x4a')]({'where':{'id':_0xa2c5f8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x6b'),'attributes':['id','name','online',_0x35fc('0x6c'),'interface'],'raw':!![]}]})[_0x35fc('0x29')](function(_0x233b7d){if(_0x233b7d){var _0x2885b9=_['flatMap'](_0x233b7d,function(_0x205ee9){var _0x2b3edc=_0x205ee9[_0x35fc('0x2a')]({'plain':!![]});return _0x2b3edc[_0x35fc('0x6b')];});return db[_0x35fc('0x32')]['find']({'where':{'id':_0x13fc47['params']['id']}})['then'](function(_0x23b261){return db['sequelize'][_0x35fc('0x6d')](function(_0x1824c2){return _0x23b261[_0x35fc('0x69')](_0xa2c5f8,{'transaction':_0x1824c2})[_0x35fc('0x29')](function(){return BPromise['each'](_0x2885b9,function(_0x28e80d){return db[_0x35fc('0x5c')][_0x35fc('0x6e')]({'where':{'UserId':_0x28e80d['id'],'SmsQueueId':_0x13fc47['params']['id']},'transaction':_0x1824c2});});})[_0x35fc('0x29')](function(){_0x2885b9[_0x35fc('0x6f')](function(_0x163e70){socket['emit']('userSmsQueue:save',{'UserId':_0x163e70['id'],'SmsQueueId':_0x23b261['id']});});});});});}})['then'](respondWithStatusCode(_0x4b6c03,null))[_0x35fc('0x4d')](handleError(_0x4b6c03,null));};exports[_0x35fc('0x70')]=function(_0x163b04,_0x3858a9,_0x4859be){return db[_0x35fc('0x68')][_0x35fc('0x4a')]({'where':{'id':_0x163b04['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x35fc('0x5d')],'as':_0x35fc('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x29')](handleEntityNotFound(_0x3858a9,null))['then'](function(_0x4dd05f){var _0x134e60=_[_0x35fc('0x31')](_0x4dd05f,'id');var _0x4d5204=[];var _0x3439de=[];var _0x163edb=squel[_0x35fc('0x71')]();_0x163edb['field'](_0x35fc('0x72'))[_0x35fc('0x73')](_0x35fc('0x74'),'tq')[_0x35fc('0x75')]('user_has_teams','ut',_0x35fc('0x76'))[_0x35fc('0x42')](_0x35fc('0x77'),_0x163b04['params']['id']);for(var _0x96dfc=0x0;_0x96dfc<_0x4dd05f[_0x35fc('0x3e')];_0x96dfc+=0x1){let _0x425f72=_0x4dd05f[_0x96dfc];for(var _0x5c6c2b=0x0;_0x5c6c2b<_0x425f72[_0x35fc('0x6b')][_0x35fc('0x3e')];_0x5c6c2b+=0x1){let _0x524f49=_0x425f72[_0x35fc('0x6b')][_0x5c6c2b];var _0xa15c80=_0x163edb[_0x35fc('0x78')]();_0xa15c80[_0x35fc('0x42')](_0x35fc('0x79'),_0x524f49['id']);_0x3439de[_0x35fc('0x7a')](db[_0x35fc('0x7b')][_0x35fc('0x38')](_0xa15c80[_0x35fc('0x7c')](),{'type':db['sequelize'][_0x35fc('0x7d')][_0x35fc('0x7e')]})[_0x35fc('0x29')](function(_0x3f2788){if(_0x3f2788['length']===0x1){return _0x524f49['id'];}else{var _0x2f1c4d=_[_0x35fc('0x7f')](_[_0x35fc('0x31')](_0x3f2788,_0x35fc('0x80')),function(_0x4684b6){return _[_0x35fc('0x81')](_0x134e60,_0x4684b6);});if(_0x2f1c4d){return _0x524f49['id'];}}}));}}return BPromise[_0x35fc('0x82')](_0x3439de)[_0x35fc('0x29')](function(_0x5c4785){_0x4d5204=_(_0x4d5204)['union'](_0x5c4785)[_0x35fc('0x83')]()[_0x35fc('0x84')]();return db[_0x35fc('0x32')]['find']({'where':{'id':_0x163b04[_0x35fc('0x4c')]['id']}})[_0x35fc('0x29')](function(_0x699ecf){return db[_0x35fc('0x7b')]['transaction'](function(_0x5874db){return _0x699ecf[_0x35fc('0x70')](_0x163b04['query'][_0x35fc('0x6a')],{'transaction':_0x5874db})[_0x35fc('0x29')](function(){if(!_['isEmpty'](_0x4d5204)){return _0x699ecf['removeAgents'](_0x4d5204,{'transaction':_0x5874db});}})[_0x35fc('0x29')](function(){_0x4d5204[_0x35fc('0x6f')](function(_0xa4652b){socket['emit'](_0x35fc('0x85'),{'UserId':_0xa4652b,'SmsQueueId':_0x699ecf['id']});});});});});});})[_0x35fc('0x29')](respondWithStatusCode(_0x3858a9,null))[_0x35fc('0x4d')](handleError(_0x3858a9,null));};exports['addAgents']=function(_0xde26e7,_0x32cbd,_0x18b4bd){return db[_0x35fc('0x32')]['find']({'where':{'id':_0xde26e7[_0x35fc('0x4c')]['id']}})[_0x35fc('0x29')](handleEntityNotFound(_0x32cbd,null))[_0x35fc('0x29')](function(_0x2732a8){if(_0x2732a8){return _0x2732a8[_0x35fc('0x86')](_0xde26e7[_0x35fc('0x4f')]['ids'],_[_0x35fc('0x87')](_0xde26e7[_0x35fc('0x4f')],['ids','id'])||{})[_0x35fc('0x88')](function(_0xdb2f24){for(var _0x58feeb=0x0;_0x58feeb<_0xde26e7[_0x35fc('0x4f')][_0x35fc('0x6a')][_0x35fc('0x3e')];_0x58feeb+=0x1){socket[_0x35fc('0x89')](_0x35fc('0x8a'),{'UserId':_0xde26e7['body'][_0x35fc('0x6a')][_0x58feeb],'SmsQueueId':_0xde26e7[_0x35fc('0x4c')]['id']});}return _0xdb2f24;});}})[_0x35fc('0x29')](respondWithResult(_0x32cbd,null))['catch'](handleError(_0x32cbd,null));};exports[_0x35fc('0x8b')]=function(_0x5a8641,_0x58d3d5,_0x28582d){return db[_0x35fc('0x32')][_0x35fc('0x54')]({'where':{'id':_0x5a8641[_0x35fc('0x4c')]['id']}})[_0x35fc('0x29')](handleEntityNotFound(_0x58d3d5,null))['then'](function(_0x1a753){if(_0x1a753){return _0x1a753[_0x35fc('0x8b')](_0x5a8641[_0x35fc('0x38')]['ids'])[_0x35fc('0x29')](function(){if(_[_0x35fc('0x8c')](_0x5a8641[_0x35fc('0x38')][_0x35fc('0x6a')])){for(var _0x169112=0x0;_0x169112<_0x5a8641['query'][_0x35fc('0x6a')][_0x35fc('0x3e')];_0x169112+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5a8641[_0x35fc('0x38')][_0x35fc('0x6a')][_0x169112]),'SmsQueueId':Number(_0x5a8641[_0x35fc('0x4c')]['id'])});}}else{socket[_0x35fc('0x89')](_0x35fc('0x85'),{'UserId':Number(_0x5a8641[_0x35fc('0x38')][_0x35fc('0x6a')]),'SmsQueueId':Number(_0x5a8641['params']['id'])});}});}})['then'](respondWithStatusCode(_0x58d3d5,null))[_0x35fc('0x4d')](handleError(_0x58d3d5,null));};exports[_0x35fc('0x8d')]=function(_0x1c4eec,_0x1a92fa,_0x1c3630){var _0x4e40ad={};var _0x50e6bf={};var _0x2c213d;var _0x2451f2;return db[_0x35fc('0x32')][_0x35fc('0x59')]({'where':{'id':_0x1c4eec['params']['id']}})['then'](handleEntityNotFound(_0x1a92fa,null))[_0x35fc('0x29')](function(_0x2f7980){if(_0x2f7980){_0x2c213d=_0x2f7980;_0x50e6bf[_0x35fc('0x3b')]=_[_0x35fc('0x37')](db['User']['rawAttributes']);_0x50e6bf[_0x35fc('0x38')]=_[_0x35fc('0x37')](_0x1c4eec['query']);_0x50e6bf[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x50e6bf[_0x35fc('0x3b')],_0x50e6bf[_0x35fc('0x38')]);_0x4e40ad[_0x35fc('0x3d')]=_[_0x35fc('0x3a')](_0x50e6bf[_0x35fc('0x3b')],qs[_0x35fc('0x3c')](_0x1c4eec[_0x35fc('0x38')][_0x35fc('0x3c')]));_0x4e40ad[_0x35fc('0x3d')]=_0x4e40ad[_0x35fc('0x3d')][_0x35fc('0x3e')]?_0x4e40ad[_0x35fc('0x3d')]:_0x50e6bf[_0x35fc('0x3b')];_0x4e40ad[_0x35fc('0x5b')]=qs['sort'](_0x1c4eec[_0x35fc('0x38')]['sort']);_0x4e40ad[_0x35fc('0x42')]=qs['filters'](_['pick'](_0x1c4eec[_0x35fc('0x38')],_0x50e6bf[_0x35fc('0x39')]));if(_0x1c4eec[_0x35fc('0x38')]['filter']){_0x4e40ad[_0x35fc('0x42')]=_[_0x35fc('0x44')](_0x4e40ad[_0x35fc('0x42')],{'$or':_[_0x35fc('0x31')](_0x4e40ad[_0x35fc('0x3d')],function(_0x1f7090){var _0x59f733={};_0x59f733[_0x1f7090]={'$like':'%'+_0x1c4eec['query'][_0x35fc('0x46')]+'%'};return _0x59f733;})});}_0x4e40ad=_['merge']({},_0x4e40ad,_0x1c4eec['options']);return _0x2c213d[_0x35fc('0x8d')](_0x4e40ad);}})['then'](function(_0x556f9a){if(_0x556f9a){_0x2451f2=_0x556f9a['length'];if(!_0x1c4eec[_0x35fc('0x38')]['hasOwnProperty'](_0x35fc('0x5a'))){_0x4e40ad[_0x35fc('0x40')]=qs[_0x35fc('0x40')](_0x1c4eec[_0x35fc('0x38')][_0x35fc('0x40')]);_0x4e40ad[_0x35fc('0x21')]=qs['offset'](_0x1c4eec['query'][_0x35fc('0x21')]);}return _0x2c213d['getAgents'](_0x4e40ad);}})[_0x35fc('0x29')](function(_0x39d9ec){if(_0x39d9ec){return _0x39d9ec?{'count':_0x2451f2,'rows':_0x39d9ec}:null;}})['then'](respondWithResult(_0x1a92fa,null))['catch'](handleError(_0x1a92fa,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3ed1104..0287a25 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 _0xa832=['emit','hasOwnProperty','exports','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0x480843,_0x8121e6){var _0x1d5cd9=function(_0x54ca2a){while(--_0x54ca2a){_0x480843['push'](_0x480843['shift']());}};_0x1d5cd9(++_0x8121e6);}(_0xa832,0x16f));var _0x2a83=function(_0x849fd8,_0xf76b4d){_0x849fd8=_0x849fd8-0x0;var _0x2b2c37=_0xa832[_0x849fd8];return _0x2b2c37;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x2a83('0x0'))['db'][_0x2a83('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2a83('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2a83('0x3'),'afterDestroy':'remove'};function emitEvent(_0x21936c){return function(_0x38f546,_0x51294c,_0x4744d8){SmsQueueEvents[_0x2a83('0x4')](_0x21936c+':'+_0x38f546['id'],_0x38f546);SmsQueueEvents['emit'](_0x21936c,_0x38f546);_0x4744d8(null);};}for(var e in events){if(events[_0x2a83('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x2a83('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x7653=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4e7259,_0x52f635){var _0x12397a=function(_0x3f648b){while(--_0x3f648b){_0x4e7259['push'](_0x4e7259['shift']());}};_0x12397a(++_0x52f635);}(_0x7653,0x102));var _0x3765=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x7653[_0x4bed75];return _0x2dd8e8;};'use strict';var EventEmitter=require(_0x3765('0x0'));var SmsQueue=require(_0x3765('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3765('0x2')](0x0);var events={'afterCreate':_0x3765('0x3'),'afterUpdate':'update','afterDestroy':_0x3765('0x4')};function emitEvent(_0x3be07d){return function(_0x2d7d15,_0x559564,_0x581d0e){SmsQueueEvents[_0x3765('0x5')](_0x3be07d+':'+_0x2d7d15['id'],_0x2d7d15);SmsQueueEvents[_0x3765('0x5')](_0x3be07d,_0x2d7d15);_0x581d0e(null);};}for(var e in events){if(events[_0x3765('0x6')](e)){var event=events[e];SmsQueue[_0x3765('0x7')](e,emitEvent(event));}}module[_0x3765('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 4969019..c67f4be 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 _0x5464=['util','../../config/logger','request-promise','rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash'];(function(_0xd866e8,_0x4d3a65){var _0x5ddc0c=function(_0x6a216f){while(--_0x6a216f){_0xd866e8['push'](_0xd866e8['shift']());}};_0x5ddc0c(++_0x4d3a65);}(_0x5464,0xf9));var _0x4546=function(_0x26d50a,_0x3a58fb){_0x26d50a=_0x26d50a-0x0;var _0x2b2886=_0x5464[_0x26d50a];return _0x2b2886;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4546('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x4'));var config=require('../../config/environment');var attributes=require(_0x4546('0x5'));module[_0x4546('0x6')]=function(_0x418167,_0x29ef6f){return _0x418167[_0x4546('0x7')](_0x4546('0x8'),attributes,{'tableName':_0x4546('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86de=['./smsQueue.attributes','SmsQueue','sms_queues','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x343b13,_0x1826d1){var _0x28c6dc=function(_0x4e6e92){while(--_0x4e6e92){_0x343b13['push'](_0x343b13['shift']());}};_0x28c6dc(++_0x1826d1);}(_0x86de,0x11a));var _0xe86d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86de[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe86d('0x0'));var logger=require(_0xe86d('0x1'))('api');var moment=require(_0xe86d('0x2'));var BPromise=require(_0xe86d('0x3'));var rp=require(_0xe86d('0x4'));var fs=require('fs');var path=require(_0xe86d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe86d('0x6'));module['exports']=function(_0x1c4602,_0x2547a2){return _0x1c4602['define'](_0xe86d('0x7'),attributes,{'tableName':_0xe86d('0x8'),'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 0504bdc..0f6db7a 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 _0xdd55=['./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSmsQueue','SmsQueue','findAll','options','attributes','model','include','map','catch','find','raw','where','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdd55,0x6d));var _0x5dd5=function(_0x3962a3,_0x4a3813){_0x3962a3=_0x3962a3-0x0;var _0x5b5093=_0xdd55[_0x3962a3];return _0x5b5093;};'use strict';var _=require(_0x5dd5('0x0'));var util=require(_0x5dd5('0x1'));var moment=require(_0x5dd5('0x2'));var BPromise=require(_0x5dd5('0x3'));var rs=require(_0x5dd5('0x4'));var fs=require('fs');var Redis=require(_0x5dd5('0x5'));var db=require(_0x5dd5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dd5('0x7'))(_0x5dd5('0x8'));var config=require(_0x5dd5('0x9'));var jayson=require(_0x5dd5('0xa'));var client=jayson[_0x5dd5('0xb')][_0x5dd5('0xc')]({'port':0x232a});config[_0x5dd5('0xd')]=_[_0x5dd5('0xe')](config[_0x5dd5('0xd')],{'host':_0x5dd5('0xf'),'port':0x18eb});var socket=require(_0x5dd5('0x10'))(new Redis(config[_0x5dd5('0xd')]));require(_0x5dd5('0x11'))[_0x5dd5('0x12')](socket);function respondWithRpcPromise(_0x51ad0e,_0x4c4b54,_0x52c8da){return new BPromise(function(_0x4e9b76,_0x42b986){return client[_0x5dd5('0x13')](_0x51ad0e,_0x52c8da)[_0x5dd5('0x14')](function(_0x3afe9a){logger[_0x5dd5('0x15')](_0x5dd5('0x16'),_0x4c4b54,_0x5dd5('0x17'));logger[_0x5dd5('0x18')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4c4b54,_0x5dd5('0x17'),JSON[_0x5dd5('0x19')](_0x3afe9a));if(_0x3afe9a[_0x5dd5('0x1a')]){if(_0x3afe9a[_0x5dd5('0x1a')][_0x5dd5('0x1b')]===0x1f4){logger[_0x5dd5('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x4c4b54,_0x3afe9a[_0x5dd5('0x1a')][_0x5dd5('0x1c')]);return _0x42b986(_0x3afe9a[_0x5dd5('0x1a')][_0x5dd5('0x1c')]);}logger['error'](_0x5dd5('0x16'),_0x4c4b54,_0x3afe9a[_0x5dd5('0x1a')][_0x5dd5('0x1c')]);return _0x4e9b76(_0x3afe9a[_0x5dd5('0x1a')][_0x5dd5('0x1c')]);}else{logger[_0x5dd5('0x15')](_0x5dd5('0x16'),_0x4c4b54,_0x5dd5('0x17'));_0x4e9b76(_0x3afe9a['result'][_0x5dd5('0x1c')]);}})['catch'](function(_0x1b30a6){logger[_0x5dd5('0x1a')](_0x5dd5('0x16'),_0x4c4b54,_0x1b30a6);_0x42b986(_0x1b30a6);});});}exports[_0x5dd5('0x1d')]=function(_0x4df1f3){var _0x16522b=this;return new Promise(function(_0x47ed42,_0x98f19f){return db[_0x5dd5('0x1e')][_0x5dd5('0x1f')]({'raw':_0x4df1f3[_0x5dd5('0x20')]?_0x4df1f3[_0x5dd5('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4df1f3[_0x5dd5('0x20')]?_0x4df1f3[_0x5dd5('0x20')]['where']||null:null,'attributes':_0x4df1f3['options']?_0x4df1f3[_0x5dd5('0x20')][_0x5dd5('0x21')]||null:null,'limit':_0x4df1f3[_0x5dd5('0x20')]?_0x4df1f3[_0x5dd5('0x20')]['limit']||null:null,'include':_0x4df1f3[_0x5dd5('0x20')]?_0x4df1f3[_0x5dd5('0x20')]['include']?_['map'](_0x4df1f3[_0x5dd5('0x20')]['include'],function(_0x467c21){return{'model':db[_0x467c21[_0x5dd5('0x22')]],'as':_0x467c21['as'],'attributes':_0x467c21[_0x5dd5('0x21')],'include':_0x467c21[_0x5dd5('0x23')]?_['map'](_0x467c21[_0x5dd5('0x23')],function(_0x4290de){return{'model':db[_0x4290de[_0x5dd5('0x22')]],'as':_0x4290de['as'],'attributes':_0x4290de[_0x5dd5('0x21')],'include':_0x4290de['include']?_[_0x5dd5('0x24')](_0x4290de[_0x5dd5('0x23')],function(_0x2e206b){return{'model':db[_0x2e206b[_0x5dd5('0x22')]],'as':_0x2e206b['as'],'attributes':_0x2e206b[_0x5dd5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bdc17){logger[_0x5dd5('0x15')](_0x5dd5('0x1d'),_0x4df1f3);logger['debug']('GetSmsQueue',_0x4df1f3,JSON[_0x5dd5('0x19')](_0x3bdc17));_0x47ed42(_0x3bdc17);})[_0x5dd5('0x25')](function(_0x2c48f8){logger['error'](_0x5dd5('0x1d'),_0x2c48f8[_0x5dd5('0x1c')],_0x4df1f3);_0x98f19f(_0x16522b[_0x5dd5('0x1a')](0x1f4,_0x2c48f8['message']));});});};exports['ShowSmsQueue']=function(_0x1edbcc){var _0x1dc12d=this;return new Promise(function(_0x718f49,_0x3d1162){return db[_0x5dd5('0x1e')][_0x5dd5('0x26')]({'raw':_0x1edbcc[_0x5dd5('0x20')]?_0x1edbcc['options'][_0x5dd5('0x27')]===undefined?!![]:![]:!![],'where':_0x1edbcc['options']?_0x1edbcc[_0x5dd5('0x20')][_0x5dd5('0x28')]||null:null,'attributes':_0x1edbcc['options']?_0x1edbcc[_0x5dd5('0x20')][_0x5dd5('0x21')]||null:null,'include':_0x1edbcc[_0x5dd5('0x20')]?_0x1edbcc[_0x5dd5('0x20')][_0x5dd5('0x23')]?_[_0x5dd5('0x24')](_0x1edbcc[_0x5dd5('0x20')][_0x5dd5('0x23')],function(_0x36e6a2){return{'model':db[_0x36e6a2[_0x5dd5('0x22')]],'as':_0x36e6a2['as'],'attributes':_0x36e6a2[_0x5dd5('0x21')],'include':_0x36e6a2[_0x5dd5('0x23')]?_['map'](_0x36e6a2['include'],function(_0x3ae839){return{'model':db[_0x3ae839[_0x5dd5('0x22')]],'as':_0x3ae839['as'],'attributes':_0x3ae839[_0x5dd5('0x21')],'include':_0x3ae839[_0x5dd5('0x23')]?_[_0x5dd5('0x24')](_0x3ae839['include'],function(_0x698839){return{'model':db[_0x698839[_0x5dd5('0x22')]],'as':_0x698839['as'],'attributes':_0x698839[_0x5dd5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dd5('0x14')](function(_0x3051d9){logger['info'](_0x5dd5('0x29'),_0x1edbcc);logger[_0x5dd5('0x18')]('ShowSmsQueue',_0x1edbcc,JSON['stringify'](_0x3051d9));_0x718f49(_0x3051d9);})[_0x5dd5('0x25')](function(_0x48b4ea){logger[_0x5dd5('0x1a')](_0x5dd5('0x29'),_0x48b4ea[_0x5dd5('0x1c')],_0x1edbcc);_0x3d1162(_0x1dc12d['error'](0x1f4,_0x48b4ea[_0x5dd5('0x1c')]));});});}; \ No newline at end of file +var _0xffc1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','map','include','model','attributes','then','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x15cef4,_0x448b97){var _0x384430=function(_0x38ebce){while(--_0x38ebce){_0x15cef4['push'](_0x15cef4['shift']());}};_0x384430(++_0x448b97);}(_0xffc1,0x9f));var _0x1ffc=function(_0x4fe7aa,_0x36415a){_0x4fe7aa=_0x4fe7aa-0x0;var _0x57353e=_0xffc1[_0x4fe7aa];return _0x57353e;};'use strict';var _=require(_0x1ffc('0x0'));var util=require(_0x1ffc('0x1'));var moment=require(_0x1ffc('0x2'));var BPromise=require(_0x1ffc('0x3'));var rs=require(_0x1ffc('0x4'));var fs=require('fs');var Redis=require(_0x1ffc('0x5'));var db=require(_0x1ffc('0x6'))['db'];var utils=require(_0x1ffc('0x7'));var logger=require(_0x1ffc('0x8'))(_0x1ffc('0x9'));var config=require(_0x1ffc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1ffc('0xb')][_0x1ffc('0xc')]({'port':0x232a});config[_0x1ffc('0xd')]=_['defaults'](config[_0x1ffc('0xd')],{'host':_0x1ffc('0xe'),'port':0x18eb});var socket=require(_0x1ffc('0xf'))(new Redis(config[_0x1ffc('0xd')]));require('./smsQueue.socket')[_0x1ffc('0x10')](socket);function respondWithRpcPromise(_0xe608ca,_0x509094,_0xb85ea){return new BPromise(function(_0x2a589d,_0x3f7828){return client['request'](_0xe608ca,_0xb85ea)['then'](function(_0x55c193){logger[_0x1ffc('0x11')](_0x1ffc('0x12'),_0x509094,_0x1ffc('0x13'));logger[_0x1ffc('0x14')](_0x1ffc('0x15'),_0x509094,_0x1ffc('0x13'),JSON[_0x1ffc('0x16')](_0x55c193));if(_0x55c193[_0x1ffc('0x17')]){if(_0x55c193[_0x1ffc('0x17')][_0x1ffc('0x18')]===0x1f4){logger[_0x1ffc('0x17')](_0x1ffc('0x12'),_0x509094,_0x55c193['error']['message']);return _0x3f7828(_0x55c193['error'][_0x1ffc('0x19')]);}logger[_0x1ffc('0x17')]('SmsQueue,\x20%s,\x20%s',_0x509094,_0x55c193[_0x1ffc('0x17')][_0x1ffc('0x19')]);return _0x2a589d(_0x55c193[_0x1ffc('0x17')][_0x1ffc('0x19')]);}else{logger[_0x1ffc('0x11')](_0x1ffc('0x12'),_0x509094,_0x1ffc('0x13'));_0x2a589d(_0x55c193[_0x1ffc('0x1a')]['message']);}})[_0x1ffc('0x1b')](function(_0x42a1c4){logger['error'](_0x1ffc('0x12'),_0x509094,_0x42a1c4);_0x3f7828(_0x42a1c4);});});}exports[_0x1ffc('0x1c')]=function(_0x2ad494){var _0x1ea0c1=this;return new Promise(function(_0x59db0a,_0x30d8fd){return db[_0x1ffc('0x1d')][_0x1ffc('0x1e')]({'raw':_0x2ad494[_0x1ffc('0x1f')]?_0x2ad494['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ad494[_0x1ffc('0x1f')]?_0x2ad494['options'][_0x1ffc('0x20')]||null:null,'attributes':_0x2ad494[_0x1ffc('0x1f')]?_0x2ad494[_0x1ffc('0x1f')]['attributes']||null:null,'limit':_0x2ad494['options']?_0x2ad494[_0x1ffc('0x1f')]['limit']||null:null,'include':_0x2ad494[_0x1ffc('0x1f')]?_0x2ad494['options']['include']?_[_0x1ffc('0x21')](_0x2ad494[_0x1ffc('0x1f')][_0x1ffc('0x22')],function(_0x38be78){return{'model':db[_0x38be78[_0x1ffc('0x23')]],'as':_0x38be78['as'],'attributes':_0x38be78['attributes'],'include':_0x38be78['include']?_['map'](_0x38be78[_0x1ffc('0x22')],function(_0x665bf4){return{'model':db[_0x665bf4[_0x1ffc('0x23')]],'as':_0x665bf4['as'],'attributes':_0x665bf4[_0x1ffc('0x24')],'include':_0x665bf4['include']?_[_0x1ffc('0x21')](_0x665bf4[_0x1ffc('0x22')],function(_0x11ee04){return{'model':db[_0x11ee04[_0x1ffc('0x23')]],'as':_0x11ee04['as'],'attributes':_0x11ee04['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ffc('0x25')](function(_0x9ddf03){logger[_0x1ffc('0x11')](_0x1ffc('0x1c'),_0x2ad494);logger[_0x1ffc('0x14')](_0x1ffc('0x1c'),_0x2ad494,JSON[_0x1ffc('0x16')](_0x9ddf03));_0x59db0a(_0x9ddf03);})['catch'](function(_0x10e40f){logger[_0x1ffc('0x17')](_0x1ffc('0x1c'),_0x10e40f[_0x1ffc('0x19')],_0x2ad494);_0x30d8fd(_0x1ea0c1[_0x1ffc('0x17')](0x1f4,_0x10e40f[_0x1ffc('0x19')]));});});};exports[_0x1ffc('0x26')]=function(_0x3a4305){var _0x26bc39=this;return new Promise(function(_0x358db6,_0x4a60f0){return db[_0x1ffc('0x1d')][_0x1ffc('0x27')]({'raw':_0x3a4305[_0x1ffc('0x1f')]?_0x3a4305[_0x1ffc('0x1f')][_0x1ffc('0x28')]===undefined?!![]:![]:!![],'where':_0x3a4305['options']?_0x3a4305[_0x1ffc('0x1f')][_0x1ffc('0x20')]||null:null,'attributes':_0x3a4305['options']?_0x3a4305['options'][_0x1ffc('0x24')]||null:null,'include':_0x3a4305['options']?_0x3a4305[_0x1ffc('0x1f')]['include']?_['map'](_0x3a4305[_0x1ffc('0x1f')]['include'],function(_0x2c72ea){return{'model':db[_0x2c72ea[_0x1ffc('0x23')]],'as':_0x2c72ea['as'],'attributes':_0x2c72ea[_0x1ffc('0x24')],'include':_0x2c72ea['include']?_[_0x1ffc('0x21')](_0x2c72ea[_0x1ffc('0x22')],function(_0x59dad8){return{'model':db[_0x59dad8[_0x1ffc('0x23')]],'as':_0x59dad8['as'],'attributes':_0x59dad8[_0x1ffc('0x24')],'include':_0x59dad8[_0x1ffc('0x22')]?_[_0x1ffc('0x21')](_0x59dad8[_0x1ffc('0x22')],function(_0x105b3c){return{'model':db[_0x105b3c[_0x1ffc('0x23')]],'as':_0x105b3c['as'],'attributes':_0x105b3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ffc('0x25')](function(_0x58c3a8){logger[_0x1ffc('0x11')](_0x1ffc('0x26'),_0x3a4305);logger[_0x1ffc('0x14')]('ShowSmsQueue',_0x3a4305,JSON[_0x1ffc('0x16')](_0x58c3a8));_0x358db6(_0x58c3a8);})[_0x1ffc('0x1b')](function(_0x32ad0e){logger[_0x1ffc('0x17')]('ShowSmsQueue',_0x32ad0e[_0x1ffc('0x19')],_0x3a4305);_0x4a60f0(_0x26bc39[_0x1ffc('0x17')](0x1f4,_0x32ad0e[_0x1ffc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 1f0d7f0..73ba91a 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 _0xb2ae=['removeListener','register','smsQueue:','./smsQueue.events','remove','update'];(function(_0x1c3702,_0x536907){var _0x326173=function(_0x192abe){while(--_0x192abe){_0x1c3702['push'](_0x1c3702['shift']());}};_0x326173(++_0x536907);}(_0xb2ae,0x87));var _0xeb2a=function(_0x23a5ee,_0x1dbbf6){_0x23a5ee=_0x23a5ee-0x0;var _0x1d86ba=_0xb2ae[_0x23a5ee];return _0x1d86ba;};'use strict';var SmsQueueEvents=require(_0xeb2a('0x0'));var events=['save',_0xeb2a('0x1'),_0xeb2a('0x2')];function createListener(_0x476e07,_0x397a03){return function(_0x14ccdf){_0x397a03['emit'](_0x476e07,_0x14ccdf);};}function removeListener(_0x249755,_0x50a709){return function(){SmsQueueEvents[_0xeb2a('0x3')](_0x249755,_0x50a709);};}exports[_0xeb2a('0x4')]=function(_0x433d77){for(var _0x1b56af=0x0,_0x219312=events['length'];_0x1b56af<_0x219312;_0x1b56af++){var _0x46daa9=events[_0x1b56af];var _0x3267d2=createListener(_0xeb2a('0x5')+_0x46daa9,_0x433d77);SmsQueueEvents['on'](_0x46daa9,_0x3267d2);}}; \ No newline at end of file +var _0x52d1=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x52d1,0x1bd));var _0x152d=function(_0x201fcd,_0x681fc5){_0x201fcd=_0x201fcd-0x0;var _0x581558=_0x52d1[_0x201fcd];return _0x581558;};'use strict';var SmsQueueEvents=require(_0x152d('0x0'));var events=[_0x152d('0x1'),_0x152d('0x2'),'update'];function createListener(_0x3d3c78,_0x5ba9c3){return function(_0x4261f4){_0x5ba9c3['emit'](_0x3d3c78,_0x4261f4);};}function removeListener(_0xe9f821,_0x45dc60){return function(){SmsQueueEvents[_0x152d('0x3')](_0xe9f821,_0x45dc60);};}exports[_0x152d('0x4')]=function(_0x54d011){for(var _0x413ab3=0x0,_0x48ca65=events[_0x152d('0x5')];_0x413ab3<_0x48ca65;_0x413ab3++){var _0x3f1b1f=events[_0x413ab3];var _0x195af9=createListener(_0x152d('0x6')+_0x3f1b1f,_0x54d011);SmsQueueEvents['on'](_0x3f1b1f,_0x195af9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d2e05c1..e753f68 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 _0xb0d9=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x32f795,_0x306a9c){var _0x277dc1=function(_0x4d9c43){while(--_0x4d9c43){_0x32f795['push'](_0x32f795['shift']());}};_0x277dc1(++_0x306a9c);}(_0xb0d9,0x1df));var _0x9b0d=function(_0x3b92ce,_0x52a7d6){_0x3b92ce=_0x3b92ce-0x0;var _0x44d62a=_0xb0d9[_0x3b92ce];return _0x44d62a;};'use strict';var multer=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var path=require(_0x9b0d('0x2'));var timeout=require(_0x9b0d('0x3'));var express=require(_0x9b0d('0x4'));var router=express[_0x9b0d('0x5')]();var auth=require(_0x9b0d('0x6'));var interaction=require(_0x9b0d('0x7'));var config=require(_0x9b0d('0x8'));var controller=require(_0x9b0d('0x9'));router[_0x9b0d('0xa')]('/',auth[_0x9b0d('0xb')](),controller[_0x9b0d('0xc')]);router[_0x9b0d('0xa')](_0x9b0d('0xd'),auth[_0x9b0d('0xb')](),controller[_0x9b0d('0xe')]);router[_0x9b0d('0xa')](_0x9b0d('0xf'),auth[_0x9b0d('0xb')](),controller[_0x9b0d('0x10')]);router[_0x9b0d('0x11')]('/',auth[_0x9b0d('0xb')](),controller['create']);router[_0x9b0d('0x12')](_0x9b0d('0xf'),auth[_0x9b0d('0xb')](),controller[_0x9b0d('0x13')]);router[_0x9b0d('0x14')](_0x9b0d('0xf'),auth[_0x9b0d('0xb')](),controller[_0x9b0d('0x15')]);module[_0x9b0d('0x16')]=router; \ No newline at end of file +var _0x839c=['./smsQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8bd2c8,_0x243064){var _0x38f09e=function(_0x162324){while(--_0x162324){_0x8bd2c8['push'](_0x8bd2c8['shift']());}};_0x38f09e(++_0x243064);}(_0x839c,0x180));var _0xc839=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x839c[_0x296897];return _0x2b44ab;};'use strict';var multer=require('multer');var util=require(_0xc839('0x0'));var path=require(_0xc839('0x1'));var timeout=require('connect-timeout');var express=require(_0xc839('0x2'));var router=express[_0xc839('0x3')]();var auth=require(_0xc839('0x4'));var interaction=require(_0xc839('0x5'));var config=require(_0xc839('0x6'));var controller=require(_0xc839('0x7'));router['get']('/',auth[_0xc839('0x8')](),controller[_0xc839('0x9')]);router[_0xc839('0xa')]('/describe',auth[_0xc839('0x8')](),controller[_0xc839('0xb')]);router[_0xc839('0xa')](_0xc839('0xc'),auth[_0xc839('0x8')](),controller[_0xc839('0xd')]);router[_0xc839('0xe')]('/',auth[_0xc839('0x8')](),controller[_0xc839('0xf')]);router['put'](_0xc839('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc839('0xc'),auth[_0xc839('0x8')](),controller['destroy']);module[_0xc839('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c305ab6..b4ba91e 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 _0x1ffa=['DATE','moment','exports','STRING'];(function(_0x7eb670,_0x5356ed){var _0x21427f=function(_0x951762){while(--_0x951762){_0x7eb670['push'](_0x7eb670['shift']());}};_0x21427f(++_0x5356ed);}(_0x1ffa,0x125));var _0xa1ff=function(_0x4b3e99,_0xf1c5c1){_0x4b3e99=_0x4b3e99-0x0;var _0x4fccce=_0x1ffa[_0x4b3e99];return _0x4fccce;};'use strict';var moment=require(_0xa1ff('0x0'));var Sequelize=require('sequelize');module[_0xa1ff('0x1')]={'uniqueid':{'type':Sequelize[_0xa1ff('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa1ff('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa1ff('0x3')]},'acceptAt':{'type':Sequelize[_0xa1ff('0x3')]},'exitAt':{'type':Sequelize[_0xa1ff('0x3')]},'reason':{'type':Sequelize[_0xa1ff('0x2')]}}; \ No newline at end of file +var _0xcc3a=['sequelize','exports','STRING','DATE','moment'];(function(_0x41877e,_0x48aa69){var _0x4e7b9e=function(_0x41c074){while(--_0x41c074){_0x41877e['push'](_0x41877e['shift']());}};_0x4e7b9e(++_0x48aa69);}(_0xcc3a,0x1ee));var _0xacc3=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xcc3a[_0x44216d];return _0xeca523;};'use strict';var moment=require(_0xacc3('0x0'));var Sequelize=require(_0xacc3('0x1'));module[_0xacc3('0x2')]={'uniqueid':{'type':Sequelize[_0xacc3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xacc3('0x3')]},'joinAt':{'type':Sequelize[_0xacc3('0x4')]},'leaveAt':{'type':Sequelize[_0xacc3('0x4')]},'acceptAt':{'type':Sequelize[_0xacc3('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xacc3('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index cf34abf..06d6f1e 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 _0x6445=['describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','crypto','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','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','create','body'];(function(_0x25eb68,_0x2b9197){var _0x359151=function(_0x32ea66){while(--_0x32ea66){_0x25eb68['push'](_0x25eb68['shift']());}};_0x359151(++_0x2b9197);}(_0x6445,0xd6));var _0x5644=function(_0x411712,_0x4db8c9){_0x411712=_0x411712-0x0;var _0x14d031=_0x6445[_0x411712];return _0x14d031;};'use strict';var pdf=require(_0x5644('0x0'));var emlformat=require(_0x5644('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5644('0x2'));var jsonpatch=require(_0x5644('0x3'));var rp=require(_0x5644('0x4'));var moment=require('moment');var BPromise=require(_0x5644('0x5'));var Mustache=require(_0x5644('0x6'));var util=require(_0x5644('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5644('0x8'));var ejs=require(_0x5644('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5644('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5644('0xb'));var toCsv=require(_0x5644('0x8'));var querystring=require('querystring');var Papa=require(_0x5644('0xc'));var Redis=require(_0x5644('0xd'));var authService=require(_0x5644('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5644('0xf'));var hardwareService=require(_0x5644('0x10'));var logger=require(_0x5644('0x11'))(_0x5644('0x12'));var utils=require(_0x5644('0x13'));var config=require(_0x5644('0x14'));var licenseUtil=require(_0x5644('0x15'));var db=require(_0x5644('0x16'))['db'];function respondWithStatusCode(_0x3eed53,_0x26131a){_0x26131a=_0x26131a||0xcc;return function(_0x3a4758){if(_0x3a4758){return _0x3eed53[_0x5644('0x17')](_0x26131a);}return _0x3eed53[_0x5644('0x18')](_0x26131a)[_0x5644('0x19')]();};}function respondWithResult(_0x47eb74,_0x3d82a2){_0x3d82a2=_0x3d82a2||0xc8;return function(_0x3dda4b){if(_0x3dda4b){return _0x47eb74[_0x5644('0x18')](_0x3d82a2)[_0x5644('0x1a')](_0x3dda4b);}};}function respondWithFilteredResult(_0x2f6625,_0x3fb9c5){return function(_0x144c8e){if(_0x144c8e){var _0x5ba0dd=_0x144c8e[_0x5644('0x1b')],_0x4713d7=_0x3fb9c5[_0x5644('0x1c')],_0x568039=_0x3fb9c5[_0x5644('0x1c')]+_0x3fb9c5[_0x5644('0x1d')],_0x4ba333;if(_0x568039>=_0x5ba0dd){_0x568039=_0x5ba0dd;_0x4ba333=0xc8;}else{_0x4ba333=0xce;}_0x2f6625['status'](_0x4ba333);return _0x2f6625[_0x5644('0x1e')](_0x5644('0x1f'),_0x4713d7+'-'+_0x568039+'/'+_0x5ba0dd)[_0x5644('0x1a')](_0x144c8e);}return null;};}function patchUpdates(_0x5bce32){return function(_0x422d10){try{jsonpatch[_0x5644('0x20')](_0x422d10,_0x5bce32,!![]);}catch(_0x58b268){return BPromise[_0x5644('0x21')](_0x58b268);}return _0x422d10[_0x5644('0x22')]();};}function saveUpdates(_0x1404e9,_0x1be25a){return function(_0x10309f){if(_0x10309f){return _0x10309f[_0x5644('0x23')](_0x1404e9)[_0x5644('0x24')](function(_0x4a63a2){return _0x4a63a2;});}return null;};}function removeEntity(_0x4e58c9,_0x41ad9a){return function(_0x4a40bd){if(_0x4a40bd){return _0x4a40bd[_0x5644('0x25')]()[_0x5644('0x24')](function(){_0x4e58c9['status'](0xcc)[_0x5644('0x19')]();});}};}function handleEntityNotFound(_0x4ade09,_0x3c0ca8){return function(_0x4e4a94){if(!_0x4e4a94){_0x4ade09['sendStatus'](0x194);}return _0x4e4a94;};}function handleError(_0x422baa,_0x46beb0){_0x46beb0=_0x46beb0||0x1f4;return function(_0x4ff3fd){logger['error'](_0x4ff3fd[_0x5644('0x26')]);if(_0x4ff3fd[_0x5644('0x27')]){delete _0x4ff3fd[_0x5644('0x27')];}_0x422baa['status'](_0x46beb0)[_0x5644('0x28')](_0x4ff3fd);};}exports[_0x5644('0x29')]=function(_0x3e8a00,_0x8bd899){var _0xe600b1={},_0x395b28={},_0x1b9a66={'count':0x0,'rows':[]};var _0x312acd=_[_0x5644('0x2a')](db[_0x5644('0x2b')][_0x5644('0x2c')],function(_0x52ac2f){return{'name':_0x52ac2f['fieldName'],'type':_0x52ac2f[_0x5644('0x2d')][_0x5644('0x2e')]};});_0x395b28[_0x5644('0x2f')]=_['map'](_0x312acd,_0x5644('0x27'));_0x395b28[_0x5644('0x30')]=_[_0x5644('0x31')](_0x3e8a00['query']);_0x395b28[_0x5644('0x32')]=_[_0x5644('0x33')](_0x395b28[_0x5644('0x2f')],_0x395b28[_0x5644('0x30')]);_0xe600b1[_0x5644('0x34')]=_[_0x5644('0x33')](_0x395b28[_0x5644('0x2f')],qs[_0x5644('0x35')](_0x3e8a00['query'][_0x5644('0x35')]));_0xe600b1[_0x5644('0x34')]=_0xe600b1[_0x5644('0x34')][_0x5644('0x36')]?_0xe600b1[_0x5644('0x34')]:_0x395b28[_0x5644('0x2f')];if(!_0x3e8a00[_0x5644('0x30')][_0x5644('0x37')]('nolimit')){_0xe600b1['limit']=qs['limit'](_0x3e8a00['query'][_0x5644('0x1d')]);_0xe600b1[_0x5644('0x1c')]=qs[_0x5644('0x1c')](_0x3e8a00[_0x5644('0x30')][_0x5644('0x1c')]);}_0xe600b1[_0x5644('0x38')]=qs[_0x5644('0x39')](_0x3e8a00[_0x5644('0x30')][_0x5644('0x39')]);_0xe600b1[_0x5644('0x3a')]=qs[_0x5644('0x32')](_['pick'](_0x3e8a00[_0x5644('0x30')],_0x395b28[_0x5644('0x32')]),_0x312acd);if(_0x3e8a00[_0x5644('0x30')][_0x5644('0x3b')]){_0xe600b1['where']=_['merge'](_0xe600b1[_0x5644('0x3a')],{'$or':_[_0x5644('0x2a')](_0x312acd,function(_0x49608a){if(_0x49608a['type']!==_0x5644('0x3c')){var _0x38f96a={};_0x38f96a[_0x49608a['name']]={'$like':'%'+_0x3e8a00['query'][_0x5644('0x3b')]+'%'};return _0x38f96a;}})});}_0xe600b1=_[_0x5644('0x3d')]({},_0xe600b1,_0x3e8a00[_0x5644('0x3e')]);var _0x5eb86c={'where':_0xe600b1[_0x5644('0x3a')]};return db['SmsQueueReport'][_0x5644('0x1b')](_0x5eb86c)[_0x5644('0x24')](function(_0x79373e){_0x1b9a66['count']=_0x79373e;if(_0x3e8a00[_0x5644('0x30')][_0x5644('0x3f')]){_0xe600b1[_0x5644('0x40')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0xe600b1);})[_0x5644('0x24')](function(_0x521058){_0x1b9a66[_0x5644('0x41')]=_0x521058;return _0x1b9a66;})['then'](respondWithFilteredResult(_0x8bd899,_0xe600b1))[_0x5644('0x42')](handleError(_0x8bd899,null));};exports['show']=function(_0x1bec57,_0x3d571b){var _0x5f4854={'raw':!![],'where':{'id':_0x1bec57[_0x5644('0x43')]['id']}},_0x43f80e={};_0x43f80e['model']=_[_0x5644('0x31')](db[_0x5644('0x2b')][_0x5644('0x2c')]);_0x43f80e[_0x5644('0x30')]=_[_0x5644('0x31')](_0x1bec57[_0x5644('0x30')]);_0x43f80e[_0x5644('0x32')]=_[_0x5644('0x33')](_0x43f80e[_0x5644('0x2f')],_0x43f80e[_0x5644('0x30')]);_0x5f4854[_0x5644('0x34')]=_[_0x5644('0x33')](_0x43f80e[_0x5644('0x2f')],qs['fields'](_0x1bec57[_0x5644('0x30')]['fields']));_0x5f4854[_0x5644('0x34')]=_0x5f4854['attributes'][_0x5644('0x36')]?_0x5f4854[_0x5644('0x34')]:_0x43f80e['model'];if(_0x1bec57['query'][_0x5644('0x3f')]){_0x5f4854['include']=[{'all':!![]}];}_0x5f4854=_[_0x5644('0x3d')]({},_0x5f4854,_0x1bec57['options']);return db['SmsQueueReport']['find'](_0x5f4854)[_0x5644('0x24')](handleEntityNotFound(_0x3d571b,null))[_0x5644('0x24')](respondWithResult(_0x3d571b,null))[_0x5644('0x42')](handleError(_0x3d571b,null));};exports[_0x5644('0x44')]=function(_0x1395ec,_0x2bc1e2){return db['SmsQueueReport']['create'](_0x1395ec[_0x5644('0x45')],{})[_0x5644('0x24')](respondWithResult(_0x2bc1e2,0xc9))[_0x5644('0x42')](handleError(_0x2bc1e2,null));};exports[_0x5644('0x23')]=function(_0x5afe8e,_0x23c97a){if(_0x5afe8e[_0x5644('0x45')]['id']){delete _0x5afe8e[_0x5644('0x45')]['id'];}return db[_0x5644('0x2b')]['find']({'where':{'id':_0x5afe8e['params']['id']}})[_0x5644('0x24')](handleEntityNotFound(_0x23c97a,null))[_0x5644('0x24')](saveUpdates(_0x5afe8e[_0x5644('0x45')],null))[_0x5644('0x24')](respondWithResult(_0x23c97a,null))['catch'](handleError(_0x23c97a,null));};exports[_0x5644('0x25')]=function(_0x45db11,_0x444861){return db[_0x5644('0x2b')]['find']({'where':{'id':_0x45db11[_0x5644('0x43')]['id']}})[_0x5644('0x24')](handleEntityNotFound(_0x444861,null))[_0x5644('0x24')](removeEntity(_0x444861,null))['catch'](handleError(_0x444861,null));};exports[_0x5644('0x46')]=function(_0x165199,_0x48f8c2){return db[_0x5644('0x2b')][_0x5644('0x46')]()['then'](respondWithResult(_0x48f8c2,null))['catch'](handleError(_0x48f8c2,null));}; \ No newline at end of file +var _0x6788=['update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','index','map','SmsQueueReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x3650b0,_0x3dd348){var _0x360be8=function(_0xefb7a4){while(--_0xefb7a4){_0x3650b0['push'](_0x3650b0['shift']());}};_0x360be8(++_0x3dd348);}(_0x6788,0x132));var _0x8678=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x6788[_0x29d915];return _0x160f86;};'use strict';var pdf=require(_0x8678('0x0'));var emlformat=require(_0x8678('0x1'));var rimraf=require(_0x8678('0x2'));var zipdir=require(_0x8678('0x3'));var jsonpatch=require(_0x8678('0x4'));var rp=require(_0x8678('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8678('0x6'));var util=require(_0x8678('0x7'));var path=require(_0x8678('0x8'));var sox=require(_0x8678('0x9'));var csv=require(_0x8678('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8678('0xb'));var squel=require(_0x8678('0xc'));var crypto=require(_0x8678('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8678('0xe'));var toCsv=require(_0x8678('0xa'));var querystring=require(_0x8678('0xf'));var Papa=require(_0x8678('0x10'));var Redis=require(_0x8678('0x11'));var authService=require(_0x8678('0x12'));var qs=require(_0x8678('0x13'));var as=require(_0x8678('0x14'));var hardwareService=require(_0x8678('0x15'));var logger=require('../../config/logger')(_0x8678('0x16'));var utils=require(_0x8678('0x17'));var config=require(_0x8678('0x18'));var licenseUtil=require(_0x8678('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253415,_0x55a77c){_0x55a77c=_0x55a77c||0xcc;return function(_0x5b0d36){if(_0x5b0d36){return _0x253415[_0x8678('0x1a')](_0x55a77c);}return _0x253415[_0x8678('0x1b')](_0x55a77c)[_0x8678('0x1c')]();};}function respondWithResult(_0x1d45b4,_0x13865a){_0x13865a=_0x13865a||0xc8;return function(_0xd0f2fb){if(_0xd0f2fb){return _0x1d45b4[_0x8678('0x1b')](_0x13865a)[_0x8678('0x1d')](_0xd0f2fb);}};}function respondWithFilteredResult(_0x35f5e0,_0xebb1d0){return function(_0x2e9713){if(_0x2e9713){var _0x1d6a1f=_0x2e9713[_0x8678('0x1e')],_0x35c70a=_0xebb1d0[_0x8678('0x1f')],_0x3d63f4=_0xebb1d0[_0x8678('0x1f')]+_0xebb1d0[_0x8678('0x20')],_0x58d3d1;if(_0x3d63f4>=_0x1d6a1f){_0x3d63f4=_0x1d6a1f;_0x58d3d1=0xc8;}else{_0x58d3d1=0xce;}_0x35f5e0[_0x8678('0x1b')](_0x58d3d1);return _0x35f5e0[_0x8678('0x21')]('Content-Range',_0x35c70a+'-'+_0x3d63f4+'/'+_0x1d6a1f)['json'](_0x2e9713);}return null;};}function patchUpdates(_0x4f77d6){return function(_0xad7e57){try{jsonpatch[_0x8678('0x22')](_0xad7e57,_0x4f77d6,!![]);}catch(_0x41cec4){return BPromise[_0x8678('0x23')](_0x41cec4);}return _0xad7e57[_0x8678('0x24')]();};}function saveUpdates(_0x3122ab,_0x1e311f){return function(_0x2ddc90){if(_0x2ddc90){return _0x2ddc90['update'](_0x3122ab)[_0x8678('0x25')](function(_0x53c88d){return _0x53c88d;});}return null;};}function removeEntity(_0x16ae79,_0x27afde){return function(_0x8bf820){if(_0x8bf820){return _0x8bf820[_0x8678('0x26')]()[_0x8678('0x25')](function(){_0x16ae79[_0x8678('0x1b')](0xcc)[_0x8678('0x1c')]();});}};}function handleEntityNotFound(_0x500f41,_0x1ab2b1){return function(_0x250663){if(!_0x250663){_0x500f41[_0x8678('0x1a')](0x194);}return _0x250663;};}function handleError(_0x561617,_0x36bebb){_0x36bebb=_0x36bebb||0x1f4;return function(_0x489ad1){logger[_0x8678('0x27')](_0x489ad1['stack']);if(_0x489ad1[_0x8678('0x28')]){delete _0x489ad1['name'];}_0x561617['status'](_0x36bebb)[_0x8678('0x29')](_0x489ad1);};}exports[_0x8678('0x2a')]=function(_0x3f74fe,_0x402471){var _0x26fe06={},_0x35d8ec={},_0x3b76b4={'count':0x0,'rows':[]};var _0x7c8632=_[_0x8678('0x2b')](db[_0x8678('0x2c')]['rawAttributes'],function(_0x2ae5ef){return{'name':_0x2ae5ef['fieldName'],'type':_0x2ae5ef[_0x8678('0x2d')][_0x8678('0x2e')]};});_0x35d8ec['model']=_[_0x8678('0x2b')](_0x7c8632,_0x8678('0x28'));_0x35d8ec[_0x8678('0x2f')]=_[_0x8678('0x30')](_0x3f74fe[_0x8678('0x2f')]);_0x35d8ec[_0x8678('0x31')]=_[_0x8678('0x32')](_0x35d8ec[_0x8678('0x33')],_0x35d8ec[_0x8678('0x2f')]);_0x26fe06[_0x8678('0x34')]=_[_0x8678('0x32')](_0x35d8ec['model'],qs['fields'](_0x3f74fe[_0x8678('0x2f')][_0x8678('0x35')]));_0x26fe06[_0x8678('0x34')]=_0x26fe06[_0x8678('0x34')][_0x8678('0x36')]?_0x26fe06[_0x8678('0x34')]:_0x35d8ec[_0x8678('0x33')];if(!_0x3f74fe[_0x8678('0x2f')]['hasOwnProperty']('nolimit')){_0x26fe06[_0x8678('0x20')]=qs[_0x8678('0x20')](_0x3f74fe['query'][_0x8678('0x20')]);_0x26fe06[_0x8678('0x1f')]=qs[_0x8678('0x1f')](_0x3f74fe[_0x8678('0x2f')][_0x8678('0x1f')]);}_0x26fe06[_0x8678('0x37')]=qs[_0x8678('0x38')](_0x3f74fe['query'][_0x8678('0x38')]);_0x26fe06[_0x8678('0x39')]=qs[_0x8678('0x31')](_[_0x8678('0x3a')](_0x3f74fe[_0x8678('0x2f')],_0x35d8ec[_0x8678('0x31')]),_0x7c8632);if(_0x3f74fe[_0x8678('0x2f')][_0x8678('0x3b')]){_0x26fe06['where']=_[_0x8678('0x3c')](_0x26fe06[_0x8678('0x39')],{'$or':_[_0x8678('0x2b')](_0x7c8632,function(_0x180889){if(_0x180889[_0x8678('0x2d')]!==_0x8678('0x3d')){var _0x154b1f={};_0x154b1f[_0x180889['name']]={'$like':'%'+_0x3f74fe['query'][_0x8678('0x3b')]+'%'};return _0x154b1f;}})});}_0x26fe06=_[_0x8678('0x3c')]({},_0x26fe06,_0x3f74fe[_0x8678('0x3e')]);var _0x5b2775={'where':_0x26fe06[_0x8678('0x39')]};return db['SmsQueueReport']['count'](_0x5b2775)[_0x8678('0x25')](function(_0x2d38fa){_0x3b76b4[_0x8678('0x1e')]=_0x2d38fa;if(_0x3f74fe[_0x8678('0x2f')][_0x8678('0x3f')]){_0x26fe06[_0x8678('0x40')]=[{'all':!![]}];}return db[_0x8678('0x2c')][_0x8678('0x41')](_0x26fe06);})[_0x8678('0x25')](function(_0x5529bb){_0x3b76b4[_0x8678('0x42')]=_0x5529bb;return _0x3b76b4;})[_0x8678('0x25')](respondWithFilteredResult(_0x402471,_0x26fe06))[_0x8678('0x43')](handleError(_0x402471,null));};exports[_0x8678('0x44')]=function(_0x5263f6,_0x2c0938){var _0x4af4b2={'raw':!![],'where':{'id':_0x5263f6[_0x8678('0x45')]['id']}},_0x18d402={};_0x18d402['model']=_[_0x8678('0x30')](db['SmsQueueReport'][_0x8678('0x46')]);_0x18d402[_0x8678('0x2f')]=_['keys'](_0x5263f6['query']);_0x18d402['filters']=_[_0x8678('0x32')](_0x18d402[_0x8678('0x33')],_0x18d402[_0x8678('0x2f')]);_0x4af4b2['attributes']=_[_0x8678('0x32')](_0x18d402[_0x8678('0x33')],qs[_0x8678('0x35')](_0x5263f6['query'][_0x8678('0x35')]));_0x4af4b2[_0x8678('0x34')]=_0x4af4b2[_0x8678('0x34')][_0x8678('0x36')]?_0x4af4b2['attributes']:_0x18d402[_0x8678('0x33')];if(_0x5263f6[_0x8678('0x2f')]['includeAll']){_0x4af4b2['include']=[{'all':!![]}];}_0x4af4b2=_[_0x8678('0x3c')]({},_0x4af4b2,_0x5263f6['options']);return db[_0x8678('0x2c')][_0x8678('0x47')](_0x4af4b2)[_0x8678('0x25')](handleEntityNotFound(_0x2c0938,null))[_0x8678('0x25')](respondWithResult(_0x2c0938,null))[_0x8678('0x43')](handleError(_0x2c0938,null));};exports[_0x8678('0x48')]=function(_0xabe1d6,_0x4575b6){return db[_0x8678('0x2c')]['create'](_0xabe1d6[_0x8678('0x49')],{})['then'](respondWithResult(_0x4575b6,0xc9))['catch'](handleError(_0x4575b6,null));};exports[_0x8678('0x4a')]=function(_0x12a712,_0x3c9e16){if(_0x12a712[_0x8678('0x49')]['id']){delete _0x12a712[_0x8678('0x49')]['id'];}return db['SmsQueueReport'][_0x8678('0x47')]({'where':{'id':_0x12a712['params']['id']}})[_0x8678('0x25')](handleEntityNotFound(_0x3c9e16,null))[_0x8678('0x25')](saveUpdates(_0x12a712[_0x8678('0x49')],null))[_0x8678('0x25')](respondWithResult(_0x3c9e16,null))[_0x8678('0x43')](handleError(_0x3c9e16,null));};exports[_0x8678('0x26')]=function(_0x74609b,_0x3f0bb8){return db['SmsQueueReport'][_0x8678('0x47')]({'where':{'id':_0x74609b[_0x8678('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f0bb8,null))[_0x8678('0x25')](removeEntity(_0x3f0bb8,null))[_0x8678('0x43')](handleError(_0x3f0bb8,null));};exports[_0x8678('0x4b')]=function(_0x1b8213,_0x386708){return db[_0x8678('0x2c')][_0x8678('0x4b')]()['then'](respondWithResult(_0x386708,null))[_0x8678('0x43')](handleError(_0x386708,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d910b1d..4eeb1ce 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 _0x76f0=['./smsQueueReport.attributes','exports','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x76f0,0x157));var _0x076f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x76f0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x076f('0x0'));var util=require(_0x076f('0x1'));var logger=require(_0x076f('0x2'))(_0x076f('0x3'));var moment=require('moment');var BPromise=require(_0x076f('0x4'));var rp=require(_0x076f('0x5'));var fs=require('fs');var path=require(_0x076f('0x6'));var rimraf=require(_0x076f('0x7'));var config=require('../../config/environment');var attributes=require(_0x076f('0x8'));module[_0x076f('0x9')]=function(_0x4ec9e6,_0x2f0e2d){return _0x4ec9e6['define'](_0x076f('0xa'),attributes,{'tableName':_0x076f('0xb'),'paranoid':![],'indexes':[{'name':_0x076f('0xc'),'fields':[_0x076f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa79e=['../../config/environment','exports','define','SmsQueueReport','report_sms_queue','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5f44c3,_0x460f76){var _0x577bf7=function(_0x370579){while(--_0x370579){_0x5f44c3['push'](_0x5f44c3['shift']());}};_0x577bf7(++_0x460f76);}(_0xa79e,0xf7));var _0xea79=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa79e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xea79('0x0'));var util=require('util');var logger=require(_0xea79('0x1'))(_0xea79('0x2'));var moment=require(_0xea79('0x3'));var BPromise=require(_0xea79('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xea79('0x5'));var config=require(_0xea79('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0xea79('0x7')]=function(_0x29907d,_0x5836de){return _0x29907d[_0xea79('0x8')](_0xea79('0x9'),attributes,{'tableName':_0xea79('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d5d05b2..4ef4f57 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 _0xc531=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','options','stringify','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment'];(function(_0x3b545e,_0x3c98ac){var _0x470129=function(_0x1a59ac){while(--_0x1a59ac){_0x3b545e['push'](_0x3b545e['shift']());}};_0x470129(++_0x3c98ac);}(_0xc531,0x13d));var _0x1c53=function(_0x17cde7,_0x1f2a1d){_0x17cde7=_0x17cde7-0x0;var _0x256338=_0xc531[_0x17cde7];return _0x256338;};'use strict';var _=require(_0x1c53('0x0'));var util=require(_0x1c53('0x1'));var moment=require(_0x1c53('0x2'));var BPromise=require(_0x1c53('0x3'));var rs=require(_0x1c53('0x4'));var fs=require('fs');var Redis=require(_0x1c53('0x5'));var db=require(_0x1c53('0x6'))['db'];var utils=require(_0x1c53('0x7'));var logger=require(_0x1c53('0x8'))(_0x1c53('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1c53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39ee58,_0x5af494,_0x4f0985){return new BPromise(function(_0x417b1f,_0x165bee){return client[_0x1c53('0xb')](_0x39ee58,_0x4f0985)[_0x1c53('0xc')](function(_0x474633){logger[_0x1c53('0xd')](_0x1c53('0xe'),_0x5af494,_0x1c53('0xf'));logger[_0x1c53('0x10')](_0x1c53('0x11'),_0x5af494,'request\x20sent',JSON['stringify'](_0x474633));if(_0x474633[_0x1c53('0x12')]){if(_0x474633[_0x1c53('0x12')][_0x1c53('0x13')]===0x1f4){logger[_0x1c53('0x12')](_0x1c53('0xe'),_0x5af494,_0x474633['error'][_0x1c53('0x14')]);return _0x165bee(_0x474633['error'][_0x1c53('0x14')]);}logger[_0x1c53('0x12')](_0x1c53('0xe'),_0x5af494,_0x474633['error'][_0x1c53('0x14')]);return _0x417b1f(_0x474633[_0x1c53('0x12')][_0x1c53('0x14')]);}else{logger[_0x1c53('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x5af494,_0x1c53('0xf'));_0x417b1f(_0x474633[_0x1c53('0x15')][_0x1c53('0x14')]);}})[_0x1c53('0x16')](function(_0x32c4dd){logger[_0x1c53('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x5af494,_0x32c4dd);_0x165bee(_0x32c4dd);});});}exports[_0x1c53('0x17')]=function(_0x5a3647){var _0x251511=this;return new Promise(function(_0x20096d,_0x570a6b){return db[_0x1c53('0x18')]['create'](_0x5a3647['body'],{'raw':_0x5a3647['options']?_0x5a3647[_0x1c53('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x1c53('0xc')](function(_0x352f60){logger['info'](_0x1c53('0x17'),_0x5a3647);logger[_0x1c53('0x10')](_0x1c53('0x17'),_0x5a3647,JSON[_0x1c53('0x1a')](_0x352f60));_0x20096d(_0x352f60);})[_0x1c53('0x16')](function(_0x1f8b50){logger[_0x1c53('0x12')](_0x1c53('0x17'),_0x1f8b50['message'],_0x5a3647);_0x570a6b(_0x251511['error'](0x1f4,_0x1f8b50[_0x1c53('0x14')]));});});};exports[_0x1c53('0x1b')]=function(_0x3b64cc){var _0x3ecb16=this;return new Promise(function(_0x47d256,_0x1fe90a){return db[_0x1c53('0x18')][_0x1c53('0x1c')](_0x3b64cc['body'],{'raw':_0x3b64cc[_0x1c53('0x19')]?_0x3b64cc[_0x1c53('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b64cc['options']?_0x3b64cc[_0x1c53('0x19')][_0x1c53('0x1d')]||null:null,'attributes':_0x3b64cc[_0x1c53('0x19')]?_0x3b64cc[_0x1c53('0x19')][_0x1c53('0x1e')]||null:null,'limit':_0x3b64cc[_0x1c53('0x19')]?_0x3b64cc[_0x1c53('0x19')][_0x1c53('0x1f')]||null:null})['then'](function(_0x57e7ba){logger['info'](_0x1c53('0x1b'),_0x3b64cc);logger[_0x1c53('0x10')](_0x1c53('0x1b'),_0x3b64cc,JSON[_0x1c53('0x1a')](_0x57e7ba));_0x47d256(_0x57e7ba);})['catch'](function(_0x18f581){logger[_0x1c53('0x12')]('UpdateSmsQueueReport',_0x18f581[_0x1c53('0x14')],_0x3b64cc);_0x1fe90a(_0x3ecb16[_0x1c53('0x12')](0x1f4,_0x18f581['message']));});});}; \ No newline at end of file +var _0x72ea=['raw','UpdateSmsQueueReport','update','attributes','lodash','moment','bluebird','randomstring','../../config/utils','rpc','http','request','then','info','debug','request\x20sent','stringify','code','SmsQueueReport,\x20%s,\x20%s','error','message','catch','CreateSmsQueueReport','create','body','options'];(function(_0x51178d,_0x3f3cf2){var _0x531533=function(_0x1e83d8){while(--_0x1e83d8){_0x51178d['push'](_0x51178d['shift']());}};_0x531533(++_0x3f3cf2);}(_0x72ea,0x1a4));var _0xa72e=function(_0x40ccae,_0x24fac8){_0x40ccae=_0x40ccae-0x0;var _0x5b4165=_0x72ea[_0x40ccae];return _0x5b4165;};'use strict';var _=require(_0xa72e('0x0'));var util=require('util');var moment=require(_0xa72e('0x1'));var BPromise=require(_0xa72e('0x2'));var rs=require(_0xa72e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa72e('0x4'));var logger=require('../../config/logger')(_0xa72e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa72e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x72dc58,_0x55fb6c,_0x2c7033){return new BPromise(function(_0x114ac3,_0x398dab){return client[_0xa72e('0x7')](_0x72dc58,_0x2c7033)[_0xa72e('0x8')](function(_0x33cd2f){logger[_0xa72e('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x55fb6c,'request\x20sent');logger[_0xa72e('0xa')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x55fb6c,_0xa72e('0xb'),JSON[_0xa72e('0xc')](_0x33cd2f));if(_0x33cd2f['error']){if(_0x33cd2f['error'][_0xa72e('0xd')]===0x1f4){logger['error'](_0xa72e('0xe'),_0x55fb6c,_0x33cd2f[_0xa72e('0xf')][_0xa72e('0x10')]);return _0x398dab(_0x33cd2f[_0xa72e('0xf')][_0xa72e('0x10')]);}logger['error'](_0xa72e('0xe'),_0x55fb6c,_0x33cd2f[_0xa72e('0xf')][_0xa72e('0x10')]);return _0x114ac3(_0x33cd2f[_0xa72e('0xf')][_0xa72e('0x10')]);}else{logger[_0xa72e('0x9')](_0xa72e('0xe'),_0x55fb6c,_0xa72e('0xb'));_0x114ac3(_0x33cd2f['result'][_0xa72e('0x10')]);}})[_0xa72e('0x11')](function(_0x4e49b4){logger[_0xa72e('0xf')](_0xa72e('0xe'),_0x55fb6c,_0x4e49b4);_0x398dab(_0x4e49b4);});});}exports[_0xa72e('0x12')]=function(_0x4b94d0){var _0x1ab236=this;return new Promise(function(_0x3d05cd,_0x1f0251){return db['SmsQueueReport'][_0xa72e('0x13')](_0x4b94d0[_0xa72e('0x14')],{'raw':_0x4b94d0[_0xa72e('0x15')]?_0x4b94d0[_0xa72e('0x15')][_0xa72e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x18f57a){logger[_0xa72e('0x9')](_0xa72e('0x12'),_0x4b94d0);logger[_0xa72e('0xa')](_0xa72e('0x12'),_0x4b94d0,JSON['stringify'](_0x18f57a));_0x3d05cd(_0x18f57a);})[_0xa72e('0x11')](function(_0x2ad7d3){logger['error'](_0xa72e('0x12'),_0x2ad7d3[_0xa72e('0x10')],_0x4b94d0);_0x1f0251(_0x1ab236['error'](0x1f4,_0x2ad7d3[_0xa72e('0x10')]));});});};exports[_0xa72e('0x17')]=function(_0xa95255){var _0x5c008a=this;return new Promise(function(_0x246e6c,_0x3d7031){return db['SmsQueueReport'][_0xa72e('0x18')](_0xa95255[_0xa72e('0x14')],{'raw':_0xa95255[_0xa72e('0x15')]?_0xa95255['options'][_0xa72e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa95255[_0xa72e('0x15')]?_0xa95255['options']['where']||null:null,'attributes':_0xa95255[_0xa72e('0x15')]?_0xa95255['options'][_0xa72e('0x19')]||null:null,'limit':_0xa95255['options']?_0xa95255[_0xa72e('0x15')]['limit']||null:null})[_0xa72e('0x8')](function(_0x2e8f60){logger[_0xa72e('0x9')](_0xa72e('0x17'),_0xa95255);logger[_0xa72e('0xa')](_0xa72e('0x17'),_0xa95255,JSON['stringify'](_0x2e8f60));_0x246e6c(_0x2e8f60);})[_0xa72e('0x11')](function(_0x2281af){logger['error'](_0xa72e('0x17'),_0x2281af[_0xa72e('0x10')],_0xa95255);_0x3d7031(_0x5c008a[_0xa72e('0xf')](0x1f4,_0x2281af['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 59499cb..4ea9b43 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 _0x2547=['../../config/environment','get','isAuthenticated','index','describe','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x137f75,_0x15cea2){var _0x4c0cf4=function(_0x5cd4e){while(--_0x5cd4e){_0x137f75['push'](_0x137f75['shift']());}};_0x4c0cf4(++_0x15cea2);}(_0x2547,0x1cd));var _0x7254=function(_0x385a15,_0x523467){_0x385a15=_0x385a15-0x0;var _0x651e78=_0x2547[_0x385a15];return _0x651e78;};'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 auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./smsTransferReport.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/describe',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7254('0xc')]);router[_0x7254('0xd')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0xf')]);router[_0x7254('0x10')]('/:id',auth[_0x7254('0x9')](),controller['destroy']);module[_0x7254('0x11')]=router; \ No newline at end of file +var _0x0972=['put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x447839,_0x2d97d7){var _0x27b875=function(_0x3505d){while(--_0x3505d){_0x447839['push'](_0x447839['shift']());}};_0x27b875(++_0x2d97d7);}(_0x0972,0x64));var _0x2097=function(_0x489a5d,_0x1e5402){_0x489a5d=_0x489a5d-0x0;var _0x4dbfd0=_0x0972[_0x489a5d];return _0x4dbfd0;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var auth=require(_0x2097('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2097('0x4'));var controller=require(_0x2097('0x5'));router[_0x2097('0x6')]('/',auth[_0x2097('0x7')](),controller[_0x2097('0x8')]);router[_0x2097('0x6')](_0x2097('0x9'),auth['isAuthenticated'](),controller[_0x2097('0xa')]);router[_0x2097('0x6')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0xc')]);router['post']('/',auth[_0x2097('0x7')](),controller[_0x2097('0xd')]);router[_0x2097('0xe')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0xf')]);router[_0x2097('0x10')](_0x2097('0xb'),auth[_0x2097('0x7')](),controller[_0x2097('0x11')]);module[_0x2097('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 20f9bfc..18b2c4a 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 _0x1a39=['STRING','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a39,0xbd));var _0x91a3=function(_0x30d9a9,_0x2a7feb){_0x30d9a9=_0x30d9a9-0x0;var _0x1249ba=_0x1a39[_0x30d9a9];return _0x1249ba;};'use strict';var moment=require(_0x91a3('0x0'));var Sequelize=require(_0x91a3('0x1'));module[_0x91a3('0x2')]={'uniqueid':{'type':Sequelize[_0x91a3('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x91a3('0x4'),_0x91a3('0x5')),'allowNull':![],'defaultValue':_0x91a3('0x5')},'transferredAt':{'type':Sequelize[_0x91a3('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x91a3('0x7')]}}; \ No newline at end of file +var _0x8c0a=['moment','sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0x38115f,_0x191dca){var _0x2ad02c=function(_0x4a090){while(--_0x4a090){_0x38115f['push'](_0x38115f['shift']());}};_0x2ad02c(++_0x191dca);}(_0x8c0a,0x110));var _0xa8c0=function(_0x41bf76,_0x2dce9c){_0x41bf76=_0x41bf76-0x0;var _0x5897b7=_0x8c0a[_0x41bf76];return _0x5897b7;};'use strict';var moment=require(_0xa8c0('0x0'));var Sequelize=require(_0xa8c0('0x1'));module[_0xa8c0('0x2')]={'uniqueid':{'type':Sequelize[_0xa8c0('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa8c0('0x4'),_0xa8c0('0x5'),'queue'),'allowNull':![],'defaultValue':_0xa8c0('0x6')},'transferredAt':{'type':Sequelize[_0xa8c0('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 503eaca..8376f52 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 _0xc7b4=['sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SmsTransferReport','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2261b1,_0x55e5d6){var _0x5dbefe=function(_0x33fb6d){while(--_0x33fb6d){_0x2261b1['push'](_0x2261b1['shift']());}};_0x5dbefe(++_0x55e5d6);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x4c7b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4c7b('0x1'));var zipdir=require(_0x4c7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c7b('0x3'));var moment=require(_0x4c7b('0x4'));var BPromise=require(_0x4c7b('0x5'));var Mustache=require(_0x4c7b('0x6'));var util=require(_0x4c7b('0x7'));var path=require('path');var sox=require(_0x4c7b('0x8'));var csv=require(_0x4c7b('0x9'));var ejs=require(_0x4c7b('0xa'));var fs=require('fs');var _=require(_0x4c7b('0xb'));var squel=require(_0x4c7b('0xc'));var crypto=require(_0x4c7b('0xd'));var jsforce=require(_0x4c7b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c7b('0xf'));var Redis=require(_0x4c7b('0x10'));var authService=require(_0x4c7b('0x11'));var qs=require(_0x4c7b('0x12'));var as=require(_0x4c7b('0x13'));var hardwareService=require(_0x4c7b('0x14'));var logger=require('../../config/logger')(_0x4c7b('0x15'));var utils=require(_0x4c7b('0x16'));var config=require(_0x4c7b('0x17'));var licenseUtil=require(_0x4c7b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52a952,_0x262265){_0x262265=_0x262265||0xcc;return function(_0x18fd94){if(_0x18fd94){return _0x52a952[_0x4c7b('0x19')](_0x262265);}return _0x52a952[_0x4c7b('0x1a')](_0x262265)[_0x4c7b('0x1b')]();};}function respondWithResult(_0x572984,_0x5aa057){_0x5aa057=_0x5aa057||0xc8;return function(_0x4ad52f){if(_0x4ad52f){return _0x572984[_0x4c7b('0x1a')](_0x5aa057)['json'](_0x4ad52f);}};}function respondWithFilteredResult(_0x104043,_0x3ed0b2){return function(_0x450cb8){if(_0x450cb8){var _0x135bda=_0x450cb8['count'],_0x2f570f=_0x3ed0b2['offset'],_0x130d82=_0x3ed0b2[_0x4c7b('0x1c')]+_0x3ed0b2[_0x4c7b('0x1d')],_0x517602;if(_0x130d82>=_0x135bda){_0x130d82=_0x135bda;_0x517602=0xc8;}else{_0x517602=0xce;}_0x104043[_0x4c7b('0x1a')](_0x517602);return _0x104043[_0x4c7b('0x1e')](_0x4c7b('0x1f'),_0x2f570f+'-'+_0x130d82+'/'+_0x135bda)['json'](_0x450cb8);}return null;};}function patchUpdates(_0x30d481){return function(_0x407bed){try{jsonpatch[_0x4c7b('0x20')](_0x407bed,_0x30d481,!![]);}catch(_0x36029b){return BPromise[_0x4c7b('0x21')](_0x36029b);}return _0x407bed['save']();};}function saveUpdates(_0x212eee,_0x1c3971){return function(_0xb1feda){if(_0xb1feda){return _0xb1feda[_0x4c7b('0x22')](_0x212eee)[_0x4c7b('0x23')](function(_0x29e64f){return _0x29e64f;});}return null;};}function removeEntity(_0x26b743,_0x30d77a){return function(_0xe2568f){if(_0xe2568f){return _0xe2568f[_0x4c7b('0x24')]()['then'](function(){_0x26b743['status'](0xcc)[_0x4c7b('0x1b')]();});}};}function handleEntityNotFound(_0x543e52,_0x28347f){return function(_0x4029d9){if(!_0x4029d9){_0x543e52['sendStatus'](0x194);}return _0x4029d9;};}function handleError(_0x5cdbbc,_0x4983d0){_0x4983d0=_0x4983d0||0x1f4;return function(_0x26939b){logger[_0x4c7b('0x25')](_0x26939b[_0x4c7b('0x26')]);if(_0x26939b[_0x4c7b('0x27')]){delete _0x26939b[_0x4c7b('0x27')];}_0x5cdbbc['status'](_0x4983d0)[_0x4c7b('0x28')](_0x26939b);};}exports[_0x4c7b('0x29')]=function(_0x2b27c6,_0x23f8f4){var _0x3d036c={},_0x396847={},_0x4bc05a={'count':0x0,'rows':[]};var _0x2aa377=_[_0x4c7b('0x2a')](db['SmsTransferReport'][_0x4c7b('0x2b')],function(_0x2e5905){return{'name':_0x2e5905['fieldName'],'type':_0x2e5905[_0x4c7b('0x2c')]['key']};});_0x396847['model']=_['map'](_0x2aa377,_0x4c7b('0x27'));_0x396847['query']=_[_0x4c7b('0x2d')](_0x2b27c6[_0x4c7b('0x2e')]);_0x396847[_0x4c7b('0x2f')]=_['intersection'](_0x396847[_0x4c7b('0x30')],_0x396847[_0x4c7b('0x2e')]);_0x3d036c[_0x4c7b('0x31')]=_[_0x4c7b('0x32')](_0x396847[_0x4c7b('0x30')],qs[_0x4c7b('0x33')](_0x2b27c6['query'][_0x4c7b('0x33')]));_0x3d036c[_0x4c7b('0x31')]=_0x3d036c[_0x4c7b('0x31')][_0x4c7b('0x34')]?_0x3d036c[_0x4c7b('0x31')]:_0x396847[_0x4c7b('0x30')];if(!_0x2b27c6[_0x4c7b('0x2e')][_0x4c7b('0x35')](_0x4c7b('0x36'))){_0x3d036c[_0x4c7b('0x1d')]=qs[_0x4c7b('0x1d')](_0x2b27c6[_0x4c7b('0x2e')]['limit']);_0x3d036c[_0x4c7b('0x1c')]=qs[_0x4c7b('0x1c')](_0x2b27c6[_0x4c7b('0x2e')]['offset']);}_0x3d036c[_0x4c7b('0x37')]=qs['sort'](_0x2b27c6['query'][_0x4c7b('0x38')]);_0x3d036c['where']=qs[_0x4c7b('0x2f')](_[_0x4c7b('0x39')](_0x2b27c6[_0x4c7b('0x2e')],_0x396847[_0x4c7b('0x2f')]),_0x2aa377);if(_0x2b27c6[_0x4c7b('0x2e')][_0x4c7b('0x3a')]){_0x3d036c[_0x4c7b('0x3b')]=_[_0x4c7b('0x3c')](_0x3d036c[_0x4c7b('0x3b')],{'$or':_['map'](_0x2aa377,function(_0x27c66c){if(_0x27c66c[_0x4c7b('0x2c')]!==_0x4c7b('0x3d')){var _0x49f3a8={};_0x49f3a8[_0x27c66c[_0x4c7b('0x27')]]={'$like':'%'+_0x2b27c6[_0x4c7b('0x2e')][_0x4c7b('0x3a')]+'%'};return _0x49f3a8;}})});}_0x3d036c=_[_0x4c7b('0x3c')]({},_0x3d036c,_0x2b27c6['options']);var _0x26e126={'where':_0x3d036c[_0x4c7b('0x3b')]};return db[_0x4c7b('0x3e')][_0x4c7b('0x3f')](_0x26e126)[_0x4c7b('0x23')](function(_0x2b9392){_0x4bc05a[_0x4c7b('0x3f')]=_0x2b9392;if(_0x2b27c6[_0x4c7b('0x2e')][_0x4c7b('0x40')]){_0x3d036c[_0x4c7b('0x41')]=[{'all':!![]}];}return db[_0x4c7b('0x3e')][_0x4c7b('0x42')](_0x3d036c);})['then'](function(_0x5963ec){_0x4bc05a[_0x4c7b('0x43')]=_0x5963ec;return _0x4bc05a;})[_0x4c7b('0x23')](respondWithFilteredResult(_0x23f8f4,_0x3d036c))[_0x4c7b('0x44')](handleError(_0x23f8f4,null));};exports[_0x4c7b('0x45')]=function(_0x3ae3e1,_0x1ca2c2){var _0x520e44={'raw':!![],'where':{'id':_0x3ae3e1[_0x4c7b('0x46')]['id']}},_0x4042c9={};_0x4042c9[_0x4c7b('0x30')]=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x4042c9[_0x4c7b('0x2e')]=_[_0x4c7b('0x2d')](_0x3ae3e1[_0x4c7b('0x2e')]);_0x4042c9[_0x4c7b('0x2f')]=_[_0x4c7b('0x32')](_0x4042c9[_0x4c7b('0x30')],_0x4042c9['query']);_0x520e44[_0x4c7b('0x31')]=_[_0x4c7b('0x32')](_0x4042c9[_0x4c7b('0x30')],qs[_0x4c7b('0x33')](_0x3ae3e1[_0x4c7b('0x2e')][_0x4c7b('0x33')]));_0x520e44[_0x4c7b('0x31')]=_0x520e44['attributes'][_0x4c7b('0x34')]?_0x520e44[_0x4c7b('0x31')]:_0x4042c9[_0x4c7b('0x30')];if(_0x3ae3e1[_0x4c7b('0x2e')][_0x4c7b('0x40')]){_0x520e44['include']=[{'all':!![]}];}_0x520e44=_['merge']({},_0x520e44,_0x3ae3e1[_0x4c7b('0x47')]);return db[_0x4c7b('0x3e')]['find'](_0x520e44)[_0x4c7b('0x23')](handleEntityNotFound(_0x1ca2c2,null))['then'](respondWithResult(_0x1ca2c2,null))[_0x4c7b('0x44')](handleError(_0x1ca2c2,null));};exports[_0x4c7b('0x48')]=function(_0x373b48,_0x1e41c7){return db[_0x4c7b('0x3e')][_0x4c7b('0x48')](_0x373b48[_0x4c7b('0x49')],{})['then'](respondWithResult(_0x1e41c7,0xc9))['catch'](handleError(_0x1e41c7,null));};exports['update']=function(_0x429acf,_0x42979c){if(_0x429acf[_0x4c7b('0x49')]['id']){delete _0x429acf[_0x4c7b('0x49')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x429acf[_0x4c7b('0x46')]['id']}})[_0x4c7b('0x23')](handleEntityNotFound(_0x42979c,null))[_0x4c7b('0x23')](saveUpdates(_0x429acf['body'],null))[_0x4c7b('0x23')](respondWithResult(_0x42979c,null))['catch'](handleError(_0x42979c,null));};exports[_0x4c7b('0x24')]=function(_0x1060f0,_0x7dce8c){return db[_0x4c7b('0x3e')]['find']({'where':{'id':_0x1060f0['params']['id']}})['then'](handleEntityNotFound(_0x7dce8c,null))[_0x4c7b('0x23')](removeEntity(_0x7dce8c,null))['catch'](handleError(_0x7dce8c,null));};exports[_0x4c7b('0x4a')]=function(_0x3b11ce,_0x425ca5){return db[_0x4c7b('0x3e')][_0x4c7b('0x4a')]()[_0x4c7b('0x23')](respondWithResult(_0x425ca5,null))[_0x4c7b('0x44')](handleError(_0x425ca5,null));}; \ No newline at end of file +var _0xcea2=['save','update','then','error','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcea2,0x15a));var _0x2cea=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcea2[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x2cea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2cea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cea('0x2'));var rp=require(_0x2cea('0x3'));var moment=require(_0x2cea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cea('0x5'));var util=require(_0x2cea('0x6'));var path=require(_0x2cea('0x7'));var sox=require('sox');var csv=require(_0x2cea('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0x8'));var querystring=require('querystring');var Papa=require(_0x2cea('0xe'));var Redis=require(_0x2cea('0xf'));var authService=require(_0x2cea('0x10'));var qs=require(_0x2cea('0x11'));var as=require(_0x2cea('0x12'));var hardwareService=require(_0x2cea('0x13'));var logger=require(_0x2cea('0x14'))(_0x2cea('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cea('0x16'));var db=require(_0x2cea('0x17'))['db'];function respondWithStatusCode(_0x528c1d,_0x4bd265){_0x4bd265=_0x4bd265||0xcc;return function(_0x160eaf){if(_0x160eaf){return _0x528c1d['sendStatus'](_0x4bd265);}return _0x528c1d[_0x2cea('0x18')](_0x4bd265)[_0x2cea('0x19')]();};}function respondWithResult(_0x4377b1,_0x5cf805){_0x5cf805=_0x5cf805||0xc8;return function(_0x4d7f8b){if(_0x4d7f8b){return _0x4377b1['status'](_0x5cf805)[_0x2cea('0x1a')](_0x4d7f8b);}};}function respondWithFilteredResult(_0x586ad5,_0x3c7130){return function(_0x338669){if(_0x338669){var _0x981e3f=_0x338669[_0x2cea('0x1b')],_0x17322c=_0x3c7130[_0x2cea('0x1c')],_0x232dad=_0x3c7130['offset']+_0x3c7130[_0x2cea('0x1d')],_0x1bbfdb;if(_0x232dad>=_0x981e3f){_0x232dad=_0x981e3f;_0x1bbfdb=0xc8;}else{_0x1bbfdb=0xce;}_0x586ad5[_0x2cea('0x18')](_0x1bbfdb);return _0x586ad5[_0x2cea('0x1e')](_0x2cea('0x1f'),_0x17322c+'-'+_0x232dad+'/'+_0x981e3f)[_0x2cea('0x1a')](_0x338669);}return null;};}function patchUpdates(_0x17dc48){return function(_0x5d75c4){try{jsonpatch[_0x2cea('0x20')](_0x5d75c4,_0x17dc48,!![]);}catch(_0x5c37f1){return BPromise[_0x2cea('0x21')](_0x5c37f1);}return _0x5d75c4[_0x2cea('0x22')]();};}function saveUpdates(_0xa73bea,_0x4fd3d5){return function(_0x46a112){if(_0x46a112){return _0x46a112[_0x2cea('0x23')](_0xa73bea)[_0x2cea('0x24')](function(_0x1b389b){return _0x1b389b;});}return null;};}function removeEntity(_0x3246bc,_0x3f6f0e){return function(_0x10f13a){if(_0x10f13a){return _0x10f13a['destroy']()[_0x2cea('0x24')](function(){_0x3246bc['status'](0xcc)[_0x2cea('0x19')]();});}};}function handleEntityNotFound(_0x4926ff,_0x3966d5){return function(_0x18a394){if(!_0x18a394){_0x4926ff['sendStatus'](0x194);}return _0x18a394;};}function handleError(_0x41d272,_0xd4bd54){_0xd4bd54=_0xd4bd54||0x1f4;return function(_0x101314){logger[_0x2cea('0x25')](_0x101314[_0x2cea('0x26')]);if(_0x101314[_0x2cea('0x27')]){delete _0x101314['name'];}_0x41d272[_0x2cea('0x18')](_0xd4bd54)[_0x2cea('0x28')](_0x101314);};}exports[_0x2cea('0x29')]=function(_0x32af98,_0x46ef5a){var _0x3ea40c={},_0xe99cca={},_0x2741cb={'count':0x0,'rows':[]};var _0x4e9cab=_[_0x2cea('0x2a')](db[_0x2cea('0x2b')]['rawAttributes'],function(_0xfeb8bd){return{'name':_0xfeb8bd[_0x2cea('0x2c')],'type':_0xfeb8bd[_0x2cea('0x2d')][_0x2cea('0x2e')]};});_0xe99cca['model']=_[_0x2cea('0x2a')](_0x4e9cab,_0x2cea('0x27'));_0xe99cca['query']=_[_0x2cea('0x2f')](_0x32af98[_0x2cea('0x30')]);_0xe99cca[_0x2cea('0x31')]=_[_0x2cea('0x32')](_0xe99cca[_0x2cea('0x33')],_0xe99cca[_0x2cea('0x30')]);_0x3ea40c[_0x2cea('0x34')]=_[_0x2cea('0x32')](_0xe99cca[_0x2cea('0x33')],qs[_0x2cea('0x35')](_0x32af98[_0x2cea('0x30')]['fields']));_0x3ea40c[_0x2cea('0x34')]=_0x3ea40c[_0x2cea('0x34')][_0x2cea('0x36')]?_0x3ea40c[_0x2cea('0x34')]:_0xe99cca['model'];if(!_0x32af98['query'][_0x2cea('0x37')](_0x2cea('0x38'))){_0x3ea40c['limit']=qs[_0x2cea('0x1d')](_0x32af98['query'][_0x2cea('0x1d')]);_0x3ea40c['offset']=qs[_0x2cea('0x1c')](_0x32af98['query'][_0x2cea('0x1c')]);}_0x3ea40c[_0x2cea('0x39')]=qs['sort'](_0x32af98[_0x2cea('0x30')][_0x2cea('0x3a')]);_0x3ea40c['where']=qs[_0x2cea('0x31')](_[_0x2cea('0x3b')](_0x32af98[_0x2cea('0x30')],_0xe99cca[_0x2cea('0x31')]),_0x4e9cab);if(_0x32af98[_0x2cea('0x30')]['filter']){_0x3ea40c[_0x2cea('0x3c')]=_[_0x2cea('0x3d')](_0x3ea40c['where'],{'$or':_['map'](_0x4e9cab,function(_0x1913a2){if(_0x1913a2['type']!=='VIRTUAL'){var _0x4bd760={};_0x4bd760[_0x1913a2['name']]={'$like':'%'+_0x32af98[_0x2cea('0x30')][_0x2cea('0x3e')]+'%'};return _0x4bd760;}})});}_0x3ea40c=_['merge']({},_0x3ea40c,_0x32af98[_0x2cea('0x3f')]);var _0x3e0683={'where':_0x3ea40c[_0x2cea('0x3c')]};return db['SmsTransferReport'][_0x2cea('0x1b')](_0x3e0683)[_0x2cea('0x24')](function(_0x352f60){_0x2741cb[_0x2cea('0x1b')]=_0x352f60;if(_0x32af98[_0x2cea('0x30')][_0x2cea('0x40')]){_0x3ea40c[_0x2cea('0x41')]=[{'all':!![]}];}return db[_0x2cea('0x2b')][_0x2cea('0x42')](_0x3ea40c);})[_0x2cea('0x24')](function(_0x3c0b91){_0x2741cb[_0x2cea('0x43')]=_0x3c0b91;return _0x2741cb;})[_0x2cea('0x24')](respondWithFilteredResult(_0x46ef5a,_0x3ea40c))[_0x2cea('0x44')](handleError(_0x46ef5a,null));};exports[_0x2cea('0x45')]=function(_0x28bb35,_0x36efa8){var _0xa0692d={'raw':!![],'where':{'id':_0x28bb35[_0x2cea('0x46')]['id']}},_0x49fcfa={};_0x49fcfa['model']=_[_0x2cea('0x2f')](db[_0x2cea('0x2b')][_0x2cea('0x47')]);_0x49fcfa[_0x2cea('0x30')]=_[_0x2cea('0x2f')](_0x28bb35[_0x2cea('0x30')]);_0x49fcfa[_0x2cea('0x31')]=_[_0x2cea('0x32')](_0x49fcfa[_0x2cea('0x33')],_0x49fcfa[_0x2cea('0x30')]);_0xa0692d['attributes']=_['intersection'](_0x49fcfa[_0x2cea('0x33')],qs[_0x2cea('0x35')](_0x28bb35['query'][_0x2cea('0x35')]));_0xa0692d['attributes']=_0xa0692d[_0x2cea('0x34')]['length']?_0xa0692d[_0x2cea('0x34')]:_0x49fcfa[_0x2cea('0x33')];if(_0x28bb35[_0x2cea('0x30')][_0x2cea('0x40')]){_0xa0692d[_0x2cea('0x41')]=[{'all':!![]}];}_0xa0692d=_[_0x2cea('0x3d')]({},_0xa0692d,_0x28bb35[_0x2cea('0x3f')]);return db[_0x2cea('0x2b')][_0x2cea('0x48')](_0xa0692d)[_0x2cea('0x24')](handleEntityNotFound(_0x36efa8,null))['then'](respondWithResult(_0x36efa8,null))[_0x2cea('0x44')](handleError(_0x36efa8,null));};exports[_0x2cea('0x49')]=function(_0x123520,_0x348baf){return db['SmsTransferReport']['create'](_0x123520[_0x2cea('0x4a')],{})[_0x2cea('0x24')](respondWithResult(_0x348baf,0xc9))[_0x2cea('0x44')](handleError(_0x348baf,null));};exports['update']=function(_0x2a5e20,_0x1e8d0f){if(_0x2a5e20[_0x2cea('0x4a')]['id']){delete _0x2a5e20[_0x2cea('0x4a')]['id'];}return db['SmsTransferReport'][_0x2cea('0x48')]({'where':{'id':_0x2a5e20['params']['id']}})['then'](handleEntityNotFound(_0x1e8d0f,null))[_0x2cea('0x24')](saveUpdates(_0x2a5e20[_0x2cea('0x4a')],null))[_0x2cea('0x24')](respondWithResult(_0x1e8d0f,null))[_0x2cea('0x44')](handleError(_0x1e8d0f,null));};exports['destroy']=function(_0x492fcf,_0x3c8ede){return db[_0x2cea('0x2b')][_0x2cea('0x48')]({'where':{'id':_0x492fcf[_0x2cea('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c8ede,null))['then'](removeEntity(_0x3c8ede,null))['catch'](handleError(_0x3c8ede,null));};exports[_0x2cea('0x4b')]=function(_0x3e7d11,_0x127069){return db[_0x2cea('0x2b')][_0x2cea('0x4b')]()[_0x2cea('0x24')](respondWithResult(_0x127069,null))[_0x2cea('0x44')](handleError(_0x127069,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 603ecbb..1eb5194 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 _0x8f9d=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x7694a,_0x2b1575){var _0x3b63af=function(_0xf20605){while(--_0xf20605){_0x7694a['push'](_0x7694a['shift']());}};_0x3b63af(++_0x2b1575);}(_0x8f9d,0x93));var _0xd8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd8f9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','moment','bluebird'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x2675,0x75));var _0x5267=function(_0xd8aa,_0x2f061d){_0xd8aa=_0xd8aa-0x0;var _0x1414f4=_0x2675[_0xd8aa];return _0x1414f4;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index be5224e..20326cd 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 _0xcab7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x14e384,_0x2cf8f4){var _0x4a3a8d=function(_0x5533e7){while(--_0x5533e7){_0x14e384['push'](_0x14e384['shift']());}};_0x4a3a8d(++_0x2cf8f4);}(_0xcab7,0x70));var _0x7cab=function(_0x4057f9,_0x17c5b5){_0x4057f9=_0x4057f9-0x0;var _0x5552b7=_0xcab7[_0x4057f9];return _0x5552b7;};'use strict';var _=require(_0x7cab('0x0'));var util=require(_0x7cab('0x1'));var moment=require(_0x7cab('0x2'));var BPromise=require('bluebird');var rs=require(_0x7cab('0x3'));var fs=require('fs');var Redis=require(_0x7cab('0x4'));var db=require(_0x7cab('0x5'))['db'];var utils=require(_0x7cab('0x6'));var logger=require(_0x7cab('0x7'))('rpc');var config=require(_0x7cab('0x8'));var jayson=require(_0x7cab('0x9'));var client=jayson[_0x7cab('0xa')][_0x7cab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52000b,_0x38b9df,_0x10ae01){return new BPromise(function(_0x236146,_0x4b6c2f){return client[_0x7cab('0xc')](_0x52000b,_0x10ae01)[_0x7cab('0xd')](function(_0x5f53c2){logger[_0x7cab('0xe')](_0x7cab('0xf'),_0x38b9df,'request\x20sent');logger[_0x7cab('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38b9df,_0x7cab('0x11'),JSON['stringify'](_0x5f53c2));if(_0x5f53c2[_0x7cab('0x12')]){if(_0x5f53c2[_0x7cab('0x12')][_0x7cab('0x13')]===0x1f4){logger['error'](_0x7cab('0xf'),_0x38b9df,_0x5f53c2[_0x7cab('0x12')][_0x7cab('0x14')]);return _0x4b6c2f(_0x5f53c2[_0x7cab('0x12')][_0x7cab('0x14')]);}logger['error'](_0x7cab('0xf'),_0x38b9df,_0x5f53c2[_0x7cab('0x12')][_0x7cab('0x14')]);return _0x236146(_0x5f53c2[_0x7cab('0x12')]['message']);}else{logger['info'](_0x7cab('0xf'),_0x38b9df,_0x7cab('0x11'));_0x236146(_0x5f53c2[_0x7cab('0x15')][_0x7cab('0x14')]);}})[_0x7cab('0x16')](function(_0x4a6712){logger[_0x7cab('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x38b9df,_0x4a6712);_0x4b6c2f(_0x4a6712);});});} \ No newline at end of file +var _0xe671=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe671,0x1eb));var _0x1e67=function(_0x301905,_0x4d5d93){_0x301905=_0x301905-0x0;var _0x4aefdc=_0xe671[_0x301905];return _0x4aefdc;};'use strict';var _=require(_0x1e67('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1e67('0x1'));var rs=require(_0x1e67('0x2'));var fs=require('fs');var Redis=require(_0x1e67('0x3'));var db=require(_0x1e67('0x4'))['db'];var utils=require(_0x1e67('0x5'));var logger=require('../../config/logger')(_0x1e67('0x6'));var config=require('../../config/environment');var jayson=require(_0x1e67('0x7'));var client=jayson[_0x1e67('0x8')][_0x1e67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17c0be,_0x30b3c8,_0x437bca){return new BPromise(function(_0x390422,_0x16fc28){return client['request'](_0x17c0be,_0x437bca)[_0x1e67('0xa')](function(_0x32c4f9){logger[_0x1e67('0xb')](_0x1e67('0xc'),_0x30b3c8,_0x1e67('0xd'));logger[_0x1e67('0xe')](_0x1e67('0xf'),_0x30b3c8,_0x1e67('0xd'),JSON[_0x1e67('0x10')](_0x32c4f9));if(_0x32c4f9['error']){if(_0x32c4f9[_0x1e67('0x11')]['code']===0x1f4){logger[_0x1e67('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x30b3c8,_0x32c4f9[_0x1e67('0x11')][_0x1e67('0x12')]);return _0x16fc28(_0x32c4f9['error'][_0x1e67('0x12')]);}logger[_0x1e67('0x11')](_0x1e67('0xc'),_0x30b3c8,_0x32c4f9['error'][_0x1e67('0x12')]);return _0x390422(_0x32c4f9[_0x1e67('0x11')]['message']);}else{logger['info'](_0x1e67('0xc'),_0x30b3c8,'request\x20sent');_0x390422(_0x32c4f9[_0x1e67('0x13')][_0x1e67('0x12')]);}})[_0x1e67('0x14')](function(_0xa30267){logger['error'](_0x1e67('0xc'),_0x30b3c8,_0xa30267);_0x16fc28(_0xa30267);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 532072c..5640c46 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 _0x9f5f=['isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','basename','extname','now','post','single','file','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','show'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x9f5f,0x121));var _0xf9f5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9f5f[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0xf9f5('0x0'));var path=require(_0xf9f5('0x1'));var timeout=require(_0xf9f5('0x2'));var express=require(_0xf9f5('0x3'));var router=express[_0xf9f5('0x4')]();var auth=require(_0xf9f5('0x5'));var interaction=require(_0xf9f5('0x6'));var config=require('../../config/environment');var controller=require(_0xf9f5('0x7'));router[_0xf9f5('0x8')]('/',auth['isAuthenticated'](),controller[_0xf9f5('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf9f5('0xa')]);router[_0xf9f5('0x8')]('/:id/download',auth[_0xf9f5('0xb')](),controller[_0xf9f5('0xc')]);var upload=multer({'storage':multer[_0xf9f5('0xd')]({'destination':function(_0x318517,_0xebc2d1,_0x16eadb){_0x16eadb(null,path[_0xf9f5('0xe')](config[_0xf9f5('0xf')],_0xf9f5('0x10')));},'filename':function(_0x48230b,_0x5e029d,_0x35ba5f){_0x5e029d[_0xf9f5('0x11')]=_0x5e029d[_0xf9f5('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x35ba5f(null,util['format']('%s-%s%s',path[_0xf9f5('0x12')](_0x5e029d[_0xf9f5('0x11')],path[_0xf9f5('0x13')](_0x5e029d[_0xf9f5('0x11')])),Date[_0xf9f5('0x14')](),path[_0xf9f5('0x13')](_0x5e029d[_0xf9f5('0x11')])));}})});router[_0xf9f5('0x15')]('/',upload[_0xf9f5('0x16')](_0xf9f5('0x17')),controller[_0xf9f5('0x18')]);router[_0xf9f5('0x19')](_0xf9f5('0x1a'),auth[_0xf9f5('0xb')](),controller[_0xf9f5('0x1b')]);router[_0xf9f5('0x1c')]('/:id',auth[_0xf9f5('0xb')](),controller[_0xf9f5('0x1c')]);module[_0xf9f5('0x1d')]=router; \ No newline at end of file +var _0x9ef0=['put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','show','download','diskStorage','join','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','now','extname','post','single','file','create'];(function(_0x5a40ce,_0x20dad2){var _0xcb5a53=function(_0x2e264e){while(--_0x2e264e){_0x5a40ce['push'](_0x5a40ce['shift']());}};_0xcb5a53(++_0x20dad2);}(_0x9ef0,0x177));var _0x09ef=function(_0x11e6b3,_0x3f7374){_0x11e6b3=_0x11e6b3-0x0;var _0x2bb29d=_0x9ef0[_0x11e6b3];return _0x2bb29d;};'use strict';var multer=require(_0x09ef('0x0'));var util=require(_0x09ef('0x1'));var path=require('path');var timeout=require(_0x09ef('0x2'));var express=require(_0x09ef('0x3'));var router=express[_0x09ef('0x4')]();var auth=require(_0x09ef('0x5'));var interaction=require(_0x09ef('0x6'));var config=require(_0x09ef('0x7'));var controller=require(_0x09ef('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x09ef('0x9')](_0x09ef('0xa'),auth[_0x09ef('0xb')](),controller[_0x09ef('0xc')]);router[_0x09ef('0x9')]('/:id/download',auth[_0x09ef('0xb')](),controller[_0x09ef('0xd')]);var upload=multer({'storage':multer[_0x09ef('0xe')]({'destination':function(_0x19ad80,_0x18f18f,_0x31aa11){_0x31aa11(null,path[_0x09ef('0xf')](config['root'],_0x09ef('0x10')));},'filename':function(_0x16dd5f,_0x30e953,_0x57d5f6){_0x30e953['originalname']=_0x30e953['originalname'][_0x09ef('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57d5f6(null,util[_0x09ef('0x12')](_0x09ef('0x13'),path[_0x09ef('0x14')](_0x30e953['originalname'],path['extname'](_0x30e953[_0x09ef('0x15')])),Date[_0x09ef('0x16')](),path[_0x09ef('0x17')](_0x30e953[_0x09ef('0x15')])));}})});router[_0x09ef('0x18')]('/',upload[_0x09ef('0x19')](_0x09ef('0x1a')),controller[_0x09ef('0x1b')]);router[_0x09ef('0x1c')](_0x09ef('0xa'),auth[_0x09ef('0xb')](),controller['update']);router[_0x09ef('0x1d')](_0x09ef('0xa'),auth['isAuthenticated'](),controller[_0x09ef('0x1d')]);module[_0x09ef('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 4a47c2f..35e81ff 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 _0x04ad=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x307ada,_0x207bce){var _0x524c1f=function(_0x5c62f5){while(--_0x5c62f5){_0x307ada['push'](_0x307ada['shift']());}};_0x524c1f(++_0x207bce);}(_0x04ad,0x11d));var _0xd04a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x04ad[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd04a('0x0'));module[_0xd04a('0x1')]={'name':{'type':Sequelize[_0xd04a('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xd04a('0x2')]},'display_name':{'type':Sequelize[_0xd04a('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd04a('0x2')]},'original_format':{'type':Sequelize[_0xd04a('0x2')]},'original_duration':{'type':Sequelize[_0xd04a('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd04a('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd04a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd04a('0x5')]},'converted_format':{'type':Sequelize[_0xd04a('0x2')]},'converted_duration':{'type':Sequelize[_0xd04a('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xd04a('0x4')]},'converted_channelCount':{'type':Sequelize[_0xd04a('0x5')]},'converted_bitRate':{'type':Sequelize[_0xd04a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xd04a('0x5')]}}; \ No newline at end of file +var _0x620a=['exports','STRING','name','INTEGER','BIGINT','sequelize'];(function(_0x250c76,_0x32ba26){var _0x55b934=function(_0x6db9ea){while(--_0x6db9ea){_0x250c76['push'](_0x250c76['shift']());}};_0x55b934(++_0x32ba26);}(_0x620a,0x1c7));var _0xa620=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x620a[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0xa620('0x0'));module[_0xa620('0x1')]={'name':{'type':Sequelize[_0xa620('0x2')],'unique':_0xa620('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa620('0x2')]},'display_name':{'type':Sequelize[_0xa620('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xa620('0x2')]},'original_format':{'type':Sequelize[_0xa620('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xa620('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xa620('0x4')]},'converted_format':{'type':Sequelize[_0xa620('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa620('0x4')]},'converted_bitRate':{'type':Sequelize[_0xa620('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xa620('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index df71d79..d4a372a 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 _0x280f=['body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','params','pick','delete','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','Sound','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','catch','keys','rawAttributes','intersection','download','find','save_name','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','create','file','originalname','extname','filename','substring','wav','server/files/sounds/original','format','basename','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x280f,0x1dd));var _0xf280=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x280f[_0xd050c6];return _0x7278a;};'use strict';var pdf=require(_0xf280('0x0'));var emlformat=require(_0xf280('0x1'));var rimraf=require(_0xf280('0x2'));var zipdir=require(_0xf280('0x3'));var jsonpatch=require(_0xf280('0x4'));var rp=require('request-promise');var moment=require(_0xf280('0x5'));var BPromise=require(_0xf280('0x6'));var Mustache=require(_0xf280('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf280('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf280('0x9'));var squel=require(_0xf280('0xa'));var crypto=require(_0xf280('0xb'));var jsforce=require(_0xf280('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf280('0xd'));var Papa=require(_0xf280('0xe'));var Redis=require(_0xf280('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf280('0x10'));var as=require(_0xf280('0x11'));var hardwareService=require(_0xf280('0x12'));var logger=require(_0xf280('0x13'))(_0xf280('0x14'));var utils=require('../../config/utils');var config=require(_0xf280('0x15'));var licenseUtil=require(_0xf280('0x16'));var db=require(_0xf280('0x17'))['db'];function respondWithStatusCode(_0x575d8d,_0x18fb8f){_0x18fb8f=_0x18fb8f||0xcc;return function(_0x4048bf){if(_0x4048bf){return _0x575d8d[_0xf280('0x18')](_0x18fb8f);}return _0x575d8d[_0xf280('0x19')](_0x18fb8f)['end']();};}function respondWithResult(_0x5d5e2c,_0x54730f){_0x54730f=_0x54730f||0xc8;return function(_0x3c7f92){if(_0x3c7f92){return _0x5d5e2c[_0xf280('0x19')](_0x54730f)[_0xf280('0x1a')](_0x3c7f92);}};}function respondWithFilteredResult(_0x56fad0,_0x240566){return function(_0x3a31f2){if(_0x3a31f2){var _0x45da04=_0x3a31f2[_0xf280('0x1b')],_0x513bed=_0x240566[_0xf280('0x1c')],_0x4dde9d=_0x240566[_0xf280('0x1c')]+_0x240566[_0xf280('0x1d')],_0xcadded;if(_0x4dde9d>=_0x45da04){_0x4dde9d=_0x45da04;_0xcadded=0xc8;}else{_0xcadded=0xce;}_0x56fad0[_0xf280('0x19')](_0xcadded);return _0x56fad0['set'](_0xf280('0x1e'),_0x513bed+'-'+_0x4dde9d+'/'+_0x45da04)[_0xf280('0x1a')](_0x3a31f2);}return null;};}function patchUpdates(_0x2a5d82){return function(_0x4d9ea3){try{jsonpatch[_0xf280('0x1f')](_0x4d9ea3,_0x2a5d82,!![]);}catch(_0x430c1d){return BPromise['reject'](_0x430c1d);}return _0x4d9ea3[_0xf280('0x20')]();};}function saveUpdates(_0x5f1555,_0x155b2f){return function(_0x54cec1){if(_0x54cec1){return _0x54cec1['update'](_0x5f1555)[_0xf280('0x21')](function(_0x369877){return _0x369877;});}return null;};}function removeEntity(_0x171b24,_0x290bda){return function(_0x35f583){if(_0x35f583){return _0x35f583[_0xf280('0x22')]()[_0xf280('0x21')](function(){var _0x128491=_0x35f583[_0xf280('0x23')]({'plain':!![]});var _0x478a5a=_0xf280('0x24');return db[_0xf280('0x25')][_0xf280('0x22')]({'where':{'type':_0x478a5a,'resourceId':_0x128491['id']}})[_0xf280('0x21')](function(){return _0x35f583;});})['then'](function(){_0x171b24[_0xf280('0x19')](0xcc)[_0xf280('0x26')]();});}};}function handleEntityNotFound(_0x39b61d,_0x5896ac){return function(_0x6051b9){if(!_0x6051b9){_0x39b61d[_0xf280('0x18')](0x194);}return _0x6051b9;};}function handleError(_0x28bea3,_0x13b7f9){_0x13b7f9=_0x13b7f9||0x1f4;return function(_0x57d86d){logger[_0xf280('0x27')](_0x57d86d[_0xf280('0x28')]);if(_0x57d86d[_0xf280('0x29')]){delete _0x57d86d[_0xf280('0x29')];}_0x28bea3[_0xf280('0x19')](_0x13b7f9)[_0xf280('0x2a')](_0x57d86d);};}exports['index']=function(_0x93c643,_0x448f86){var _0x3e9b2a={},_0x4147e2={},_0x10b213={'count':0x0,'rows':[]};var _0xdab3e5=_['map'](db[_0xf280('0x2b')]['rawAttributes'],function(_0x5805df){return{'name':_0x5805df['fieldName'],'type':_0x5805df[_0xf280('0x2c')][_0xf280('0x2d')]};});_0x4147e2[_0xf280('0x2e')]=_[_0xf280('0x2f')](_0xdab3e5,_0xf280('0x29'));_0x4147e2[_0xf280('0x30')]=_['keys'](_0x93c643[_0xf280('0x30')]);_0x4147e2[_0xf280('0x31')]=_['intersection'](_0x4147e2['model'],_0x4147e2[_0xf280('0x30')]);_0x3e9b2a[_0xf280('0x32')]=_['intersection'](_0x4147e2['model'],qs[_0xf280('0x33')](_0x93c643[_0xf280('0x30')][_0xf280('0x33')]));_0x3e9b2a['attributes']=_0x3e9b2a[_0xf280('0x32')][_0xf280('0x34')]?_0x3e9b2a[_0xf280('0x32')]:_0x4147e2[_0xf280('0x2e')];if(!_0x93c643[_0xf280('0x30')][_0xf280('0x35')]('nolimit')){_0x3e9b2a['limit']=qs[_0xf280('0x1d')](_0x93c643[_0xf280('0x30')][_0xf280('0x1d')]);_0x3e9b2a[_0xf280('0x1c')]=qs[_0xf280('0x1c')](_0x93c643['query'][_0xf280('0x1c')]);}_0x3e9b2a['order']=qs[_0xf280('0x36')](_0x93c643[_0xf280('0x30')][_0xf280('0x36')]);_0x3e9b2a[_0xf280('0x37')]=qs[_0xf280('0x31')](_['pick'](_0x93c643[_0xf280('0x30')],_0x4147e2[_0xf280('0x31')]),_0xdab3e5);if(_0x93c643[_0xf280('0x30')][_0xf280('0x38')]){_0x3e9b2a['where']=_[_0xf280('0x39')](_0x3e9b2a['where'],{'$or':_[_0xf280('0x2f')](_0xdab3e5,function(_0x191232){if(_0x191232[_0xf280('0x2c')]!=='VIRTUAL'){var _0x59d5fa={};_0x59d5fa[_0x191232[_0xf280('0x29')]]={'$like':'%'+_0x93c643[_0xf280('0x30')]['filter']+'%'};return _0x59d5fa;}})});}_0x3e9b2a=_['merge']({},_0x3e9b2a,_0x93c643[_0xf280('0x3a')]);var _0x2c3847={'where':_0x3e9b2a[_0xf280('0x37')]};return db[_0xf280('0x2b')]['count'](_0x2c3847)[_0xf280('0x21')](function(_0x5f47e4){_0x10b213[_0xf280('0x1b')]=_0x5f47e4;if(_0x93c643['query'][_0xf280('0x3b')]){_0x3e9b2a['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x3e9b2a);})[_0xf280('0x21')](function(_0x25efae){_0x10b213['rows']=_0x25efae;return _0x10b213;})['then'](respondWithFilteredResult(_0x448f86,_0x3e9b2a))[_0xf280('0x3c')](handleError(_0x448f86,null));};exports['show']=function(_0x292428,_0x47ff10){var _0x1ba3e6={'raw':!![],'where':{'id':_0x292428['params']['id']}},_0x5c6f73={};_0x5c6f73[_0xf280('0x2e')]=_[_0xf280('0x3d')](db[_0xf280('0x2b')][_0xf280('0x3e')]);_0x5c6f73[_0xf280('0x30')]=_['keys'](_0x292428[_0xf280('0x30')]);_0x5c6f73[_0xf280('0x31')]=_[_0xf280('0x3f')](_0x5c6f73[_0xf280('0x2e')],_0x5c6f73[_0xf280('0x30')]);_0x1ba3e6[_0xf280('0x32')]=_[_0xf280('0x3f')](_0x5c6f73[_0xf280('0x2e')],qs[_0xf280('0x33')](_0x292428[_0xf280('0x30')][_0xf280('0x33')]));_0x1ba3e6['attributes']=_0x1ba3e6[_0xf280('0x32')]['length']?_0x1ba3e6['attributes']:_0x5c6f73[_0xf280('0x2e')];if(_0x292428['query'][_0xf280('0x3b')]){_0x1ba3e6['include']=[{'all':!![]}];}_0x1ba3e6=_['merge']({},_0x1ba3e6,_0x292428[_0xf280('0x3a')]);return db[_0xf280('0x2b')]['find'](_0x1ba3e6)[_0xf280('0x21')](handleEntityNotFound(_0x47ff10,null))[_0xf280('0x21')](respondWithResult(_0x47ff10,null))[_0xf280('0x3c')](handleError(_0x47ff10,null));};exports[_0xf280('0x40')]=function(_0x1a3222,_0x377fe1,_0x3ff961){return db['Sound'][_0xf280('0x41')]({'where':{'id':_0x1a3222['params']['id']},'attributes':[_0xf280('0x29'),_0xf280('0x42'),'converted_format'],'raw':!![]})[_0xf280('0x21')](handleEntityNotFound(_0x377fe1,null))[_0xf280('0x21')](function(_0x540df9){if(_0x540df9){if(!fs['existsSync'](path[_0xf280('0x43')](config[_0xf280('0x44')],_0xf280('0x45'),_0x540df9[_0xf280('0x42')]+'.'+_0x540df9[_0xf280('0x46')]))){throw new db[(_0xf280('0x47'))][(_0xf280('0x48'))](_0xf280('0x49'));}return _0x377fe1[_0xf280('0x40')](path[_0xf280('0x43')](config[_0xf280('0x44')],_0xf280('0x45'),util['format']('%s.%s',_0x540df9[_0xf280('0x42')],_0x540df9[_0xf280('0x46')])),util['format'](_0xf280('0x4a'),_0x540df9[_0xf280('0x29')],_0x540df9[_0xf280('0x46')]));}return null;})[_0xf280('0x3c')](handleError(_0x377fe1,null));};exports[_0xf280('0x4b')]=function(_0x18df15,_0x327144,_0x261fea){var _0x19f9cf={'name':path['basename'](_0x18df15[_0xf280('0x4c')][_0xf280('0x4d')],path[_0xf280('0x4e')](_0x18df15[_0xf280('0x4c')][_0xf280('0x4d')])),'save_name':path['basename'](_0x18df15[_0xf280('0x4c')][_0xf280('0x4f')],path[_0xf280('0x4e')](_0x18df15[_0xf280('0x4c')][_0xf280('0x4f')])),'original_format':path[_0xf280('0x4e')](_0x18df15['file'][_0xf280('0x4d')])[_0xf280('0x50')](0x1),'converted_format':_0xf280('0x51')};var _0x8e7513=path['join'](config[_0xf280('0x44')],_0xf280('0x52'),_0x18df15[_0xf280('0x4c')][_0xf280('0x4f')]);var _0x1fa425=path[_0xf280('0x43')](config[_0xf280('0x44')],_0xf280('0x45'),util[_0xf280('0x53')](_0xf280('0x4a'),path[_0xf280('0x54')](_0x18df15[_0xf280('0x4c')][_0xf280('0x4f')],path[_0xf280('0x4e')](_0x18df15[_0xf280('0x4c')]['filename'])),_0x19f9cf[_0xf280('0x46')]));logger['info'](_0xf280('0x55'),_0x8e7513);logger['info'](_0xf280('0x56'),_0x1fa425);try{fs['chmodSync'](_0x8e7513,parseInt(_0xf280('0x57'),0x8));var _0xa9e6a4=sox[_0xf280('0x58')](_0x8e7513,_0x1fa425,{'sampleRate':0x1f40,'format':_0xf280('0x51'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa9e6a4['on'](_0xf280('0x27'),function(_0x387a9d){fs[_0xf280('0x59')](_0x8e7513);_0x327144['status'](0x1f4)[_0xf280('0x2a')](_0x387a9d);});_0xa9e6a4['on']('src',function(_0x582e1a){_0x19f9cf[_0xf280('0x5a')]=isNaN(_0x582e1a['duration'])?null:_0x582e1a[_0xf280('0x5b')]*0x3e8;_0x19f9cf[_0xf280('0x5c')]=isNaN(_0x582e1a[_0xf280('0x5d')])?null:_0x582e1a[_0xf280('0x5d')];_0x19f9cf[_0xf280('0x5e')]=isNaN(_0x582e1a[_0xf280('0x5f')])?null:_0x582e1a['channelCount'];_0x19f9cf['original_bitRate']=isNaN(_0x582e1a[_0xf280('0x60')])?null:_0x582e1a[_0xf280('0x60')];_0x19f9cf[_0xf280('0x61')]=isNaN(_0x582e1a[_0xf280('0x62')])?null:_0x582e1a['sampleRate'];});_0xa9e6a4['on'](_0xf280('0x63'),function(_0x151a91){_0x19f9cf['converted_duration']=isNaN(_0x151a91['duration'])?null:_0x151a91[_0xf280('0x5b')]*0x3e8;_0x19f9cf['converted_sampleCount']=isNaN(_0x151a91[_0xf280('0x5d')])?null:_0x151a91['sampleCount'];_0x19f9cf[_0xf280('0x64')]=isNaN(_0x151a91[_0xf280('0x5f')])?null:_0x151a91[_0xf280('0x5f')];_0x19f9cf[_0xf280('0x65')]=isNaN(_0x151a91[_0xf280('0x60')])?null:_0x151a91[_0xf280('0x60')];_0x19f9cf[_0xf280('0x66')]=isNaN(_0x151a91[_0xf280('0x62')])?null:_0x151a91[_0xf280('0x62')];});_0xa9e6a4['on'](_0xf280('0x26'),function(){fs['chmodSync'](_0x1fa425,parseInt(_0xf280('0x57'),0x8));return db[_0xf280('0x2b')][_0xf280('0x4b')](_0x19f9cf)[_0xf280('0x21')](function(_0x3c1035){var _0x5684a6={'role':_0x18df15[_0xf280('0x67')][_0xf280('0x68')],'userProfileId':_0x18df15[_0xf280('0x67')][_0xf280('0x69')]};if(!_0x5684a6)throw new Error(_0xf280('0x6a'));if(_0x5684a6[_0xf280('0x68')]===_0xf280('0x6b')){var _0x523fb6=_0x3c1035['get']({'plain':!![]});return db[_0xf280('0x6c')]['find']({'where':{'name':_0xf280('0x24'),'userProfileId':_0x5684a6[_0xf280('0x69')]},'raw':!![]})[_0xf280('0x21')](function(_0x4234af){if(_0x4234af&&_0x4234af[_0xf280('0x6d')]===0x0){return db[_0xf280('0x25')][_0xf280('0x4b')]({'name':_0x523fb6[_0xf280('0x29')],'resourceId':_0x523fb6['id'],'type':_0x4234af[_0xf280('0x29')],'sectionId':_0x4234af['id']},{})[_0xf280('0x21')](function(){return _0x3c1035;});}else{return _0x3c1035;}})[_0xf280('0x3c')](function(_0x47b89b){logger['error'](_0xf280('0x6e'),_0x47b89b);throw _0x47b89b;});}return _0x3c1035;})[_0xf280('0x21')](respondWithResult(_0x327144,null))[_0xf280('0x3c')](handleError(_0x327144,null));});_0xa9e6a4[_0xf280('0x6f')]();}catch(_0x810d11){_0x327144[_0xf280('0x19')](0x1f4)[_0xf280('0x2a')](_0x810d11);}};exports[_0xf280('0x70')]=function(_0x457e60,_0x3ac97d,_0x5a2421){return db[_0xf280('0x2b')]['find']({'where':{'id':_0x457e60[_0xf280('0x71')]['id']}})[_0xf280('0x21')](handleEntityNotFound(_0x3ac97d,null))['then'](saveUpdates(_[_0xf280('0x72')](_0x457e60[_0xf280('0x67')],[_0xf280('0x29'),'description']),null))[_0xf280('0x21')](respondWithResult(_0x3ac97d,null))[_0xf280('0x3c')](handleError(_0x3ac97d,null));};exports[_0xf280('0x73')]=function(_0x151870,_0x56eb19,_0x228bb2){return db[_0xf280('0x2b')]['find']({'where':{'id':_0x151870[_0xf280('0x71')]['id']}})[_0xf280('0x21')](function(_0x454087){if(_0x454087){return _0x454087['destroy']();}})[_0xf280('0x21')](function(_0x43ff20){var _0x4df5ce=path['join'](config[_0xf280('0x44')],'server/files/sounds/original',util[_0xf280('0x53')]('%s.%s',_0x43ff20[_0xf280('0x42')],_0x43ff20['original_format']));var _0x5eb2db=path[_0xf280('0x43')](config['root'],_0xf280('0x45'),util[_0xf280('0x53')](_0xf280('0x4a'),_0x43ff20[_0xf280('0x42')],_0x43ff20[_0xf280('0x46')]));fs[_0xf280('0x59')](_0x4df5ce);fs['unlinkSync'](_0x5eb2db);return _0x43ff20;})['then'](function(_0x4c22b1){if(_0x4c22b1){return _0x56eb19[_0xf280('0x19')](0xcc)[_0xf280('0x26')]();}})[_0xf280('0x21')](handleEntityNotFound(_0x56eb19,null))[_0xf280('0x3c')](handleError(_0x56eb19,null));}; \ No newline at end of file +var _0x8fc0=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','update','destroy','then','Sounds','UserProfileResource','error','name','map','Sound','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','download','save_name','converted_format','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','basename','file','originalname','filename','extname','wav','join','Sound\x20upload\x20filepath:\x20%s','info','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','0777','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2da3ec,_0x13b6a5){var _0x3758f1=function(_0x5af356){while(--_0x5af356){_0x2da3ec['push'](_0x2da3ec['shift']());}};_0x3758f1(++_0x13b6a5);}(_0x8fc0,0x1d5));var _0x08fc=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x8fc0[_0x49b207];return _0x2dc8fa;};'use strict';var pdf=require(_0x08fc('0x0'));var emlformat=require(_0x08fc('0x1'));var rimraf=require(_0x08fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x08fc('0x3'));var moment=require(_0x08fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x08fc('0x5'));var util=require('util');var path=require(_0x08fc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x08fc('0x7'));var fs=require('fs');var _=require(_0x08fc('0x8'));var squel=require(_0x08fc('0x9'));var crypto=require(_0x08fc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x08fc('0xb'));var toCsv=require(_0x08fc('0xc'));var querystring=require('querystring');var Papa=require(_0x08fc('0xd'));var Redis=require('ioredis');var authService=require(_0x08fc('0xe'));var qs=require(_0x08fc('0xf'));var as=require(_0x08fc('0x10'));var hardwareService=require(_0x08fc('0x11'));var logger=require(_0x08fc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x08fc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x08fc('0x14'))['db'];function respondWithStatusCode(_0x58efd1,_0x4e1e48){_0x4e1e48=_0x4e1e48||0xcc;return function(_0x31021c){if(_0x31021c){return _0x58efd1['sendStatus'](_0x4e1e48);}return _0x58efd1[_0x08fc('0x15')](_0x4e1e48)[_0x08fc('0x16')]();};}function respondWithResult(_0x482f18,_0x9422d8){_0x9422d8=_0x9422d8||0xc8;return function(_0x373ba3){if(_0x373ba3){return _0x482f18[_0x08fc('0x15')](_0x9422d8)[_0x08fc('0x17')](_0x373ba3);}};}function respondWithFilteredResult(_0x1566e3,_0x703a69){return function(_0x553c20){if(_0x553c20){var _0x1dbc13=_0x553c20[_0x08fc('0x18')],_0x3a54a7=_0x703a69[_0x08fc('0x19')],_0x228e3e=_0x703a69[_0x08fc('0x19')]+_0x703a69[_0x08fc('0x1a')],_0x57d4ad;if(_0x228e3e>=_0x1dbc13){_0x228e3e=_0x1dbc13;_0x57d4ad=0xc8;}else{_0x57d4ad=0xce;}_0x1566e3['status'](_0x57d4ad);return _0x1566e3[_0x08fc('0x1b')]('Content-Range',_0x3a54a7+'-'+_0x228e3e+'/'+_0x1dbc13)[_0x08fc('0x17')](_0x553c20);}return null;};}function patchUpdates(_0x1a5ddb){return function(_0x5ba9c0){try{jsonpatch[_0x08fc('0x1c')](_0x5ba9c0,_0x1a5ddb,!![]);}catch(_0x3a6a95){return BPromise['reject'](_0x3a6a95);}return _0x5ba9c0[_0x08fc('0x1d')]();};}function saveUpdates(_0x1f6c53,_0x51561b){return function(_0x2442ef){if(_0x2442ef){return _0x2442ef[_0x08fc('0x1e')](_0x1f6c53)['then'](function(_0x61b801){return _0x61b801;});}return null;};}function removeEntity(_0x4aa4c1,_0x511b52){return function(_0x156570){if(_0x156570){return _0x156570[_0x08fc('0x1f')]()[_0x08fc('0x20')](function(){var _0x3d4fca=_0x156570['get']({'plain':!![]});var _0x42c0c1=_0x08fc('0x21');return db[_0x08fc('0x22')][_0x08fc('0x1f')]({'where':{'type':_0x42c0c1,'resourceId':_0x3d4fca['id']}})['then'](function(){return _0x156570;});})['then'](function(){_0x4aa4c1[_0x08fc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a3576,_0x34ec40){return function(_0x2489fb){if(!_0x2489fb){_0x4a3576['sendStatus'](0x194);}return _0x2489fb;};}function handleError(_0x2139e6,_0x25bf3d){_0x25bf3d=_0x25bf3d||0x1f4;return function(_0x228890){logger[_0x08fc('0x23')](_0x228890['stack']);if(_0x228890[_0x08fc('0x24')]){delete _0x228890[_0x08fc('0x24')];}_0x2139e6['status'](_0x25bf3d)['send'](_0x228890);};}exports['index']=function(_0x18c67a,_0x49f894){var _0x49ed4e={},_0x27c2e9={},_0x350630={'count':0x0,'rows':[]};var _0x42f67c=_[_0x08fc('0x25')](db[_0x08fc('0x26')]['rawAttributes'],function(_0x52a2cb){return{'name':_0x52a2cb['fieldName'],'type':_0x52a2cb[_0x08fc('0x27')][_0x08fc('0x28')]};});_0x27c2e9[_0x08fc('0x29')]=_[_0x08fc('0x25')](_0x42f67c,_0x08fc('0x24'));_0x27c2e9[_0x08fc('0x2a')]=_[_0x08fc('0x2b')](_0x18c67a[_0x08fc('0x2a')]);_0x27c2e9['filters']=_['intersection'](_0x27c2e9['model'],_0x27c2e9[_0x08fc('0x2a')]);_0x49ed4e['attributes']=_[_0x08fc('0x2c')](_0x27c2e9[_0x08fc('0x29')],qs[_0x08fc('0x2d')](_0x18c67a[_0x08fc('0x2a')]['fields']));_0x49ed4e[_0x08fc('0x2e')]=_0x49ed4e['attributes']['length']?_0x49ed4e[_0x08fc('0x2e')]:_0x27c2e9[_0x08fc('0x29')];if(!_0x18c67a[_0x08fc('0x2a')][_0x08fc('0x2f')]('nolimit')){_0x49ed4e[_0x08fc('0x1a')]=qs['limit'](_0x18c67a[_0x08fc('0x2a')]['limit']);_0x49ed4e[_0x08fc('0x19')]=qs[_0x08fc('0x19')](_0x18c67a[_0x08fc('0x2a')][_0x08fc('0x19')]);}_0x49ed4e[_0x08fc('0x30')]=qs[_0x08fc('0x31')](_0x18c67a['query']['sort']);_0x49ed4e[_0x08fc('0x32')]=qs[_0x08fc('0x33')](_['pick'](_0x18c67a[_0x08fc('0x2a')],_0x27c2e9[_0x08fc('0x33')]),_0x42f67c);if(_0x18c67a[_0x08fc('0x2a')][_0x08fc('0x34')]){_0x49ed4e['where']=_[_0x08fc('0x35')](_0x49ed4e[_0x08fc('0x32')],{'$or':_[_0x08fc('0x25')](_0x42f67c,function(_0x20a88d){if(_0x20a88d[_0x08fc('0x27')]!==_0x08fc('0x36')){var _0x5a4ce0={};_0x5a4ce0[_0x20a88d['name']]={'$like':'%'+_0x18c67a[_0x08fc('0x2a')][_0x08fc('0x34')]+'%'};return _0x5a4ce0;}})});}_0x49ed4e=_[_0x08fc('0x35')]({},_0x49ed4e,_0x18c67a[_0x08fc('0x37')]);var _0x1e4473={'where':_0x49ed4e[_0x08fc('0x32')]};return db['Sound'][_0x08fc('0x18')](_0x1e4473)[_0x08fc('0x20')](function(_0x438697){_0x350630[_0x08fc('0x18')]=_0x438697;if(_0x18c67a[_0x08fc('0x2a')][_0x08fc('0x38')]){_0x49ed4e[_0x08fc('0x39')]=[{'all':!![]}];}return db[_0x08fc('0x26')]['findAll'](_0x49ed4e);})[_0x08fc('0x20')](function(_0x48bca1){_0x350630[_0x08fc('0x3a')]=_0x48bca1;return _0x350630;})['then'](respondWithFilteredResult(_0x49f894,_0x49ed4e))[_0x08fc('0x3b')](handleError(_0x49f894,null));};exports[_0x08fc('0x3c')]=function(_0x5a68e0,_0x34cfea){var _0x20d470={'raw':!![],'where':{'id':_0x5a68e0[_0x08fc('0x3d')]['id']}},_0x5a19fa={};_0x5a19fa['model']=_[_0x08fc('0x2b')](db[_0x08fc('0x26')][_0x08fc('0x3e')]);_0x5a19fa['query']=_[_0x08fc('0x2b')](_0x5a68e0[_0x08fc('0x2a')]);_0x5a19fa[_0x08fc('0x33')]=_[_0x08fc('0x2c')](_0x5a19fa['model'],_0x5a19fa[_0x08fc('0x2a')]);_0x20d470['attributes']=_[_0x08fc('0x2c')](_0x5a19fa[_0x08fc('0x29')],qs[_0x08fc('0x2d')](_0x5a68e0[_0x08fc('0x2a')][_0x08fc('0x2d')]));_0x20d470[_0x08fc('0x2e')]=_0x20d470[_0x08fc('0x2e')][_0x08fc('0x3f')]?_0x20d470[_0x08fc('0x2e')]:_0x5a19fa[_0x08fc('0x29')];if(_0x5a68e0[_0x08fc('0x2a')][_0x08fc('0x38')]){_0x20d470['include']=[{'all':!![]}];}_0x20d470=_[_0x08fc('0x35')]({},_0x20d470,_0x5a68e0[_0x08fc('0x37')]);return db[_0x08fc('0x26')][_0x08fc('0x40')](_0x20d470)[_0x08fc('0x20')](handleEntityNotFound(_0x34cfea,null))[_0x08fc('0x20')](respondWithResult(_0x34cfea,null))[_0x08fc('0x3b')](handleError(_0x34cfea,null));};exports[_0x08fc('0x41')]=function(_0x19161b,_0x1689d4,_0x43a145){return db[_0x08fc('0x26')][_0x08fc('0x40')]({'where':{'id':_0x19161b[_0x08fc('0x3d')]['id']},'attributes':[_0x08fc('0x24'),_0x08fc('0x42'),_0x08fc('0x43')],'raw':!![]})[_0x08fc('0x20')](handleEntityNotFound(_0x1689d4,null))['then'](function(_0x557611){if(_0x557611){if(!fs['existsSync'](path['join'](config['root'],_0x08fc('0x44'),_0x557611[_0x08fc('0x42')]+'.'+_0x557611['converted_format']))){throw new db[(_0x08fc('0x45'))][(_0x08fc('0x46'))](_0x08fc('0x47'));}return _0x1689d4['download'](path['join'](config[_0x08fc('0x48')],_0x08fc('0x44'),util[_0x08fc('0x49')](_0x08fc('0x4a'),_0x557611[_0x08fc('0x42')],_0x557611[_0x08fc('0x43')])),util['format'](_0x08fc('0x4a'),_0x557611[_0x08fc('0x24')],_0x557611[_0x08fc('0x43')]));}return null;})[_0x08fc('0x3b')](handleError(_0x1689d4,null));};exports['create']=function(_0x2be50b,_0x1484b0,_0x58f58a){var _0x198667={'name':path[_0x08fc('0x4b')](_0x2be50b[_0x08fc('0x4c')][_0x08fc('0x4d')],path['extname'](_0x2be50b[_0x08fc('0x4c')][_0x08fc('0x4d')])),'save_name':path[_0x08fc('0x4b')](_0x2be50b[_0x08fc('0x4c')][_0x08fc('0x4e')],path[_0x08fc('0x4f')](_0x2be50b[_0x08fc('0x4c')]['filename'])),'original_format':path[_0x08fc('0x4f')](_0x2be50b[_0x08fc('0x4c')][_0x08fc('0x4d')])['substring'](0x1),'converted_format':_0x08fc('0x50')};var _0x4233f2=path[_0x08fc('0x51')](config['root'],'server/files/sounds/original',_0x2be50b[_0x08fc('0x4c')]['filename']);var _0x1d8a58=path[_0x08fc('0x51')](config[_0x08fc('0x48')],'server/files/sounds/converted',util[_0x08fc('0x49')]('%s.%s',path[_0x08fc('0x4b')](_0x2be50b[_0x08fc('0x4c')]['filename'],path[_0x08fc('0x4f')](_0x2be50b[_0x08fc('0x4c')][_0x08fc('0x4e')])),_0x198667[_0x08fc('0x43')]));logger['info'](_0x08fc('0x52'),_0x4233f2);logger[_0x08fc('0x53')]('Sound\x20upload\x20destination:\x20%s',_0x1d8a58);try{fs['chmodSync'](_0x4233f2,parseInt('0777',0x8));var _0x3ff160=sox['transcode'](_0x4233f2,_0x1d8a58,{'sampleRate':0x1f40,'format':_0x08fc('0x50'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3ff160['on'](_0x08fc('0x23'),function(_0xd88ceb){fs[_0x08fc('0x54')](_0x4233f2);_0x1484b0['status'](0x1f4)[_0x08fc('0x55')](_0xd88ceb);});_0x3ff160['on'](_0x08fc('0x56'),function(_0x89a880){_0x198667['original_duration']=isNaN(_0x89a880[_0x08fc('0x57')])?null:_0x89a880[_0x08fc('0x57')]*0x3e8;_0x198667[_0x08fc('0x58')]=isNaN(_0x89a880[_0x08fc('0x59')])?null:_0x89a880['sampleCount'];_0x198667[_0x08fc('0x5a')]=isNaN(_0x89a880[_0x08fc('0x5b')])?null:_0x89a880[_0x08fc('0x5b')];_0x198667[_0x08fc('0x5c')]=isNaN(_0x89a880[_0x08fc('0x5d')])?null:_0x89a880[_0x08fc('0x5d')];_0x198667[_0x08fc('0x5e')]=isNaN(_0x89a880[_0x08fc('0x5f')])?null:_0x89a880[_0x08fc('0x5f')];});_0x3ff160['on'](_0x08fc('0x60'),function(_0x31f520){_0x198667[_0x08fc('0x61')]=isNaN(_0x31f520[_0x08fc('0x57')])?null:_0x31f520['duration']*0x3e8;_0x198667['converted_sampleCount']=isNaN(_0x31f520[_0x08fc('0x59')])?null:_0x31f520[_0x08fc('0x59')];_0x198667[_0x08fc('0x62')]=isNaN(_0x31f520[_0x08fc('0x5b')])?null:_0x31f520[_0x08fc('0x5b')];_0x198667[_0x08fc('0x63')]=isNaN(_0x31f520[_0x08fc('0x5d')])?null:_0x31f520[_0x08fc('0x5d')];_0x198667[_0x08fc('0x64')]=isNaN(_0x31f520[_0x08fc('0x5f')])?null:_0x31f520['sampleRate'];});_0x3ff160['on'](_0x08fc('0x16'),function(){fs['chmodSync'](_0x1d8a58,parseInt(_0x08fc('0x65'),0x8));return db[_0x08fc('0x26')][_0x08fc('0x66')](_0x198667)[_0x08fc('0x20')](function(_0x1d3120){var _0x55408a={'role':_0x2be50b[_0x08fc('0x67')][_0x08fc('0x68')],'userProfileId':_0x2be50b[_0x08fc('0x67')]['userProfileId']};if(!_0x55408a)throw new Error(_0x08fc('0x69'));if(_0x55408a[_0x08fc('0x68')]==='user'){var _0x3531bd=_0x1d3120['get']({'plain':!![]});return db[_0x08fc('0x6a')][_0x08fc('0x40')]({'where':{'name':_0x08fc('0x21'),'userProfileId':_0x55408a[_0x08fc('0x6b')]},'raw':!![]})['then'](function(_0x19399c){if(_0x19399c&&_0x19399c[_0x08fc('0x6c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3531bd['name'],'resourceId':_0x3531bd['id'],'type':_0x19399c['name'],'sectionId':_0x19399c['id']},{})[_0x08fc('0x20')](function(){return _0x1d3120;});}else{return _0x1d3120;}})['catch'](function(_0x309700){logger[_0x08fc('0x23')](_0x08fc('0x6d'),_0x309700);throw _0x309700;});}return _0x1d3120;})[_0x08fc('0x20')](respondWithResult(_0x1484b0,null))[_0x08fc('0x3b')](handleError(_0x1484b0,null));});_0x3ff160[_0x08fc('0x6e')]();}catch(_0x32ff34){_0x1484b0[_0x08fc('0x15')](0x1f4)[_0x08fc('0x55')](_0x32ff34);}};exports['update']=function(_0x4fd2bc,_0x38c9cd,_0x551e1b){return db[_0x08fc('0x26')][_0x08fc('0x40')]({'where':{'id':_0x4fd2bc[_0x08fc('0x3d')]['id']}})[_0x08fc('0x20')](handleEntityNotFound(_0x38c9cd,null))[_0x08fc('0x20')](saveUpdates(_[_0x08fc('0x6f')](_0x4fd2bc['body'],[_0x08fc('0x24'),_0x08fc('0x70')]),null))[_0x08fc('0x20')](respondWithResult(_0x38c9cd,null))[_0x08fc('0x3b')](handleError(_0x38c9cd,null));};exports[_0x08fc('0x71')]=function(_0x4fe490,_0x4a44a6,_0x5ddea4){return db[_0x08fc('0x26')][_0x08fc('0x40')]({'where':{'id':_0x4fe490['params']['id']}})[_0x08fc('0x20')](function(_0x26e279){if(_0x26e279){return _0x26e279[_0x08fc('0x1f')]();}})[_0x08fc('0x20')](function(_0x540763){var _0x537308=path['join'](config[_0x08fc('0x48')],'server/files/sounds/original',util[_0x08fc('0x49')]('%s.%s',_0x540763[_0x08fc('0x42')],_0x540763[_0x08fc('0x72')]));var _0x48c228=path[_0x08fc('0x51')](config['root'],_0x08fc('0x44'),util[_0x08fc('0x49')](_0x08fc('0x4a'),_0x540763[_0x08fc('0x42')],_0x540763[_0x08fc('0x43')]));fs[_0x08fc('0x54')](_0x537308);fs[_0x08fc('0x54')](_0x48c228);return _0x540763;})['then'](function(_0x2f6534){if(_0x2f6534){return _0x4a44a6['status'](0xcc)['end']();}})[_0x08fc('0x20')](handleEntityNotFound(_0x4a44a6,null))[_0x08fc('0x3b')](handleError(_0x4a44a6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 1ada580..888bfb7 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 _0x2de6=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x2de6,0x108));var _0x62de=function(_0xc900f7,_0x33d3bf){_0xc900f7=_0xc900f7-0x0;var _0x365e5f=_0x2de6[_0xc900f7];return _0x365e5f;};'use strict';var _=require('lodash');var util=require(_0x62de('0x0'));var logger=require(_0x62de('0x1'))('api');var moment=require(_0x62de('0x2'));var BPromise=require(_0x62de('0x3'));var rp=require(_0x62de('0x4'));var fs=require('fs');var path=require(_0x62de('0x5'));var rimraf=require(_0x62de('0x6'));var config=require(_0x62de('0x7'));var attributes=require(_0x62de('0x8'));module['exports']=function(_0xfeabb3,_0x2e360e){return _0xfeabb3[_0x62de('0x9')](_0x62de('0xa'),attributes,{'tableName':_0x62de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31ae=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','api','moment'];(function(_0x426711,_0x12264c){var _0x592991=function(_0x564614){while(--_0x564614){_0x426711['push'](_0x426711['shift']());}};_0x592991(++_0x12264c);}(_0x31ae,0x1d8));var _0xe31a=function(_0x64e2ec,_0x14692d){_0x64e2ec=_0x64e2ec-0x0;var _0x28f791=_0x31ae[_0x64e2ec];return _0x28f791;};'use strict';var _=require(_0xe31a('0x0'));var util=require(_0xe31a('0x1'));var logger=require('../../config/logger')(_0xe31a('0x2'));var moment=require(_0xe31a('0x3'));var BPromise=require(_0xe31a('0x4'));var rp=require(_0xe31a('0x5'));var fs=require('fs');var path=require(_0xe31a('0x6'));var rimraf=require(_0xe31a('0x7'));var config=require(_0xe31a('0x8'));var attributes=require(_0xe31a('0x9'));module[_0xe31a('0xa')]=function(_0x5523ea,_0x534d83){return _0x5523ea[_0xe31a('0xb')](_0xe31a('0xc'),attributes,{'tableName':_0xe31a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 3929f92..9511735 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 _0x1bde=['jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ShowSound','Sound','options','raw','where','include','map','attributes','model','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x579c9d,_0x3321e5){var _0x2c355b=function(_0x33673b){while(--_0x33673b){_0x579c9d['push'](_0x579c9d['shift']());}};_0x2c355b(++_0x3321e5);}(_0x1bde,0x197));var _0xe1bd=function(_0x2cc86e,_0x5e9be8){_0x2cc86e=_0x2cc86e-0x0;var _0x3c43e1=_0x1bde[_0x2cc86e];return _0x3c43e1;};'use strict';var _=require(_0xe1bd('0x0'));var util=require(_0xe1bd('0x1'));var moment=require(_0xe1bd('0x2'));var BPromise=require(_0xe1bd('0x3'));var rs=require(_0xe1bd('0x4'));var fs=require('fs');var Redis=require(_0xe1bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1bd('0x6'));var logger=require('../../config/logger')(_0xe1bd('0x7'));var config=require(_0xe1bd('0x8'));var jayson=require(_0xe1bd('0x9'));var client=jayson[_0xe1bd('0xa')][_0xe1bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b451f,_0x440980,_0x1f68fb){return new BPromise(function(_0x135e6f,_0x5d59ce){return client[_0xe1bd('0xc')](_0x4b451f,_0x1f68fb)[_0xe1bd('0xd')](function(_0x3e6c5a){logger[_0xe1bd('0xe')](_0xe1bd('0xf'),_0x440980,_0xe1bd('0x10'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x440980,_0xe1bd('0x10'),JSON['stringify'](_0x3e6c5a));if(_0x3e6c5a['error']){if(_0x3e6c5a[_0xe1bd('0x11')]['code']===0x1f4){logger[_0xe1bd('0x11')](_0xe1bd('0xf'),_0x440980,_0x3e6c5a[_0xe1bd('0x11')][_0xe1bd('0x12')]);return _0x5d59ce(_0x3e6c5a[_0xe1bd('0x11')]['message']);}logger['error'](_0xe1bd('0xf'),_0x440980,_0x3e6c5a['error']['message']);return _0x135e6f(_0x3e6c5a['error'][_0xe1bd('0x12')]);}else{logger[_0xe1bd('0xe')]('Sound,\x20%s,\x20%s',_0x440980,'request\x20sent');_0x135e6f(_0x3e6c5a[_0xe1bd('0x13')][_0xe1bd('0x12')]);}})[_0xe1bd('0x14')](function(_0x3399dc){logger[_0xe1bd('0x11')](_0xe1bd('0xf'),_0x440980,_0x3399dc);_0x5d59ce(_0x3399dc);});});}exports[_0xe1bd('0x15')]=function(_0x550453){var _0x17fa03=this;return new Promise(function(_0x7834b0,_0x51f6df){return db[_0xe1bd('0x16')]['find']({'raw':_0x550453[_0xe1bd('0x17')]?_0x550453[_0xe1bd('0x17')][_0xe1bd('0x18')]===undefined?!![]:![]:!![],'where':_0x550453['options']?_0x550453[_0xe1bd('0x17')][_0xe1bd('0x19')]||null:null,'attributes':_0x550453[_0xe1bd('0x17')]?_0x550453['options']['attributes']||null:null,'include':_0x550453['options']?_0x550453['options'][_0xe1bd('0x1a')]?_[_0xe1bd('0x1b')](_0x550453['options'][_0xe1bd('0x1a')],function(_0x11d7fd){return{'model':db[_0x11d7fd['model']],'as':_0x11d7fd['as'],'attributes':_0x11d7fd['attributes'],'include':_0x11d7fd[_0xe1bd('0x1a')]?_[_0xe1bd('0x1b')](_0x11d7fd[_0xe1bd('0x1a')],function(_0x33fb84){return{'model':db[_0x33fb84['model']],'as':_0x33fb84['as'],'attributes':_0x33fb84[_0xe1bd('0x1c')],'include':_0x33fb84[_0xe1bd('0x1a')]?_[_0xe1bd('0x1b')](_0x33fb84['include'],function(_0x1dc83f){return{'model':db[_0x1dc83f[_0xe1bd('0x1d')]],'as':_0x1dc83f['as'],'attributes':_0x1dc83f[_0xe1bd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe1bd('0xd')](function(_0x3f559d){logger['info'](_0xe1bd('0x15'),_0x550453);logger[_0xe1bd('0x1e')](_0xe1bd('0x15'),_0x550453,JSON[_0xe1bd('0x1f')](_0x3f559d));_0x7834b0(_0x3f559d);})[_0xe1bd('0x14')](function(_0x3378e8){logger['error']('ShowSound',_0x3378e8[_0xe1bd('0x12')],_0x550453);_0x51f6df(_0x17fa03[_0xe1bd('0x11')](0x1f4,_0x3378e8[_0xe1bd('0x12')]));});});}; \ No newline at end of file +var _0xb886=['map','model','attributes','then','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Sound','find','options','raw','include'];(function(_0x1c0a00,_0xa582ba){var _0x34044a=function(_0x3020e5){while(--_0x3020e5){_0x1c0a00['push'](_0x1c0a00['shift']());}};_0x34044a(++_0xa582ba);}(_0xb886,0x165));var _0x6b88=function(_0x475c3e,_0x29459d){_0x475c3e=_0x475c3e-0x0;var _0x46977a=_0xb886[_0x475c3e];return _0x46977a;};'use strict';var _=require(_0x6b88('0x0'));var util=require(_0x6b88('0x1'));var moment=require(_0x6b88('0x2'));var BPromise=require(_0x6b88('0x3'));var rs=require(_0x6b88('0x4'));var fs=require('fs');var Redis=require(_0x6b88('0x5'));var db=require(_0x6b88('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b88('0x7'));var config=require(_0x6b88('0x8'));var jayson=require(_0x6b88('0x9'));var client=jayson[_0x6b88('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ec008,_0x55dafd,_0x4d3f20){return new BPromise(function(_0x27b5d9,_0x429c64){return client[_0x6b88('0xb')](_0x3ec008,_0x4d3f20)['then'](function(_0x4af55){logger[_0x6b88('0xc')](_0x6b88('0xd'),_0x55dafd,_0x6b88('0xe'));logger[_0x6b88('0xf')](_0x6b88('0x10'),_0x55dafd,'request\x20sent',JSON[_0x6b88('0x11')](_0x4af55));if(_0x4af55['error']){if(_0x4af55['error']['code']===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x55dafd,_0x4af55[_0x6b88('0x12')][_0x6b88('0x13')]);return _0x429c64(_0x4af55['error'][_0x6b88('0x13')]);}logger[_0x6b88('0x12')](_0x6b88('0xd'),_0x55dafd,_0x4af55[_0x6b88('0x12')][_0x6b88('0x13')]);return _0x27b5d9(_0x4af55[_0x6b88('0x12')]['message']);}else{logger[_0x6b88('0xc')]('Sound,\x20%s,\x20%s',_0x55dafd,'request\x20sent');_0x27b5d9(_0x4af55[_0x6b88('0x14')]['message']);}})[_0x6b88('0x15')](function(_0x16daa0){logger[_0x6b88('0x12')]('Sound,\x20%s,\x20%s',_0x55dafd,_0x16daa0);_0x429c64(_0x16daa0);});});}exports['ShowSound']=function(_0x523c79){var _0x2b9b0c=this;return new Promise(function(_0x3f7abb,_0xbd28f){return db[_0x6b88('0x16')][_0x6b88('0x17')]({'raw':_0x523c79[_0x6b88('0x18')]?_0x523c79[_0x6b88('0x18')][_0x6b88('0x19')]===undefined?!![]:![]:!![],'where':_0x523c79[_0x6b88('0x18')]?_0x523c79[_0x6b88('0x18')]['where']||null:null,'attributes':_0x523c79[_0x6b88('0x18')]?_0x523c79['options']['attributes']||null:null,'include':_0x523c79[_0x6b88('0x18')]?_0x523c79[_0x6b88('0x18')][_0x6b88('0x1a')]?_[_0x6b88('0x1b')](_0x523c79[_0x6b88('0x18')][_0x6b88('0x1a')],function(_0x8611ed){return{'model':db[_0x8611ed[_0x6b88('0x1c')]],'as':_0x8611ed['as'],'attributes':_0x8611ed[_0x6b88('0x1d')],'include':_0x8611ed['include']?_['map'](_0x8611ed[_0x6b88('0x1a')],function(_0xfab7c0){return{'model':db[_0xfab7c0[_0x6b88('0x1c')]],'as':_0xfab7c0['as'],'attributes':_0xfab7c0['attributes'],'include':_0xfab7c0['include']?_[_0x6b88('0x1b')](_0xfab7c0[_0x6b88('0x1a')],function(_0xe97234){return{'model':db[_0xe97234['model']],'as':_0xe97234['as'],'attributes':_0xe97234[_0x6b88('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6b88('0x1e')](function(_0x3daa0b){logger['info']('ShowSound',_0x523c79);logger['debug'](_0x6b88('0x1f'),_0x523c79,JSON[_0x6b88('0x11')](_0x3daa0b));_0x3f7abb(_0x3daa0b);})[_0x6b88('0x15')](function(_0x264e10){logger[_0x6b88('0x12')](_0x6b88('0x1f'),_0x264e10[_0x6b88('0x13')],_0x523c79);_0xbd28f(_0x2b9b0c['error'](0x1f4,_0x264e10[_0x6b88('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 31fc70e..8f2cf6b 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 _0x8d67=['../../config/environment','./squareMessage.controller','index','get','show','post','create','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xc24dfb,_0x5ef7f7){var _0x426e5b=function(_0x30471d){while(--_0x30471d){_0xc24dfb['push'](_0xc24dfb['shift']());}};_0x426e5b(++_0x5ef7f7);}(_0x8d67,0x92));var _0x78d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d67[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x78d6('0x0'));var util=require('util');var path=require(_0x78d6('0x1'));var timeout=require('connect-timeout');var express=require(_0x78d6('0x2'));var router=express[_0x78d6('0x3')]();var auth=require(_0x78d6('0x4'));var interaction=require(_0x78d6('0x5'));var config=require(_0x78d6('0x6'));var controller=require(_0x78d6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x78d6('0x8')]);router[_0x78d6('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x78d6('0xa')]);router[_0x78d6('0xb')]('/',auth['isAuthenticated'](),controller[_0x78d6('0xc')]);router[_0x78d6('0xd')](_0x78d6('0xe'),auth[_0x78d6('0xf')](),controller['update']);router[_0x78d6('0x10')](_0x78d6('0xe'),auth[_0x78d6('0xf')](),controller[_0x78d6('0x11')]);module[_0x78d6('0x12')]=router; \ No newline at end of file +var _0x4225=['put','delete','/:id','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','show','post','create'];(function(_0x279336,_0x19a13c){var _0x30bfd0=function(_0x1750ea){while(--_0x1750ea){_0x279336['push'](_0x279336['shift']());}};_0x30bfd0(++_0x19a13c);}(_0x4225,0xa6));var _0x5422=function(_0x585379,_0x1ecd07){_0x585379=_0x585379-0x0;var _0x2b0c92=_0x4225[_0x585379];return _0x2b0c92;};'use strict';var multer=require(_0x5422('0x0'));var util=require(_0x5422('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5422('0x2'));var router=express[_0x5422('0x3')]();var auth=require(_0x5422('0x4'));var interaction=require(_0x5422('0x5'));var config=require(_0x5422('0x6'));var controller=require(_0x5422('0x7'));router[_0x5422('0x8')]('/',auth[_0x5422('0x9')](),controller[_0x5422('0xa')]);router['get']('/:id',auth[_0x5422('0x9')](),controller[_0x5422('0xb')]);router[_0x5422('0xc')]('/',auth[_0x5422('0x9')](),controller[_0x5422('0xd')]);router[_0x5422('0xe')]('/:id',auth[_0x5422('0x9')](),controller['update']);router[_0x5422('0xf')](_0x5422('0x10'),auth[_0x5422('0x9')](),controller[_0x5422('0x11')]);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 b31fb73..ebe6ed6 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 _0x7da7=['exports','STRING','ENUM','out','TEXT','sequelize'];(function(_0x342e8f,_0x51d2f1){var _0x54fc73=function(_0x3c70d3){while(--_0x3c70d3){_0x342e8f['push'](_0x342e8f['shift']());}};_0x54fc73(++_0x51d2f1);}(_0x7da7,0x10d));var _0x77da=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x7da7[_0x4ab3fb];return _0x34fe1e;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'uniqueid':{'type':Sequelize[_0x77da('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x77da('0x3')]('in',_0x77da('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x77da('0x2')]},'providerResponse':{'type':Sequelize[_0x77da('0x5')]}}; \ No newline at end of file +var _0x1cb9=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x3af627,_0x54244c){var _0x12bcdf=function(_0x8aac6a){while(--_0x8aac6a){_0x3af627['push'](_0x3af627['shift']());}};_0x12bcdf(++_0x54244c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5a29b8,_0x262338){_0x5a29b8=_0x5a29b8-0x0;var _0x3aa81c=_0x1cb9[_0x5a29b8];return _0x3aa81c;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'body':{'type':Sequelize[_0x91cb('0x2')](_0x91cb('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x91cb('0x4')]('in','out'),'defaultValue':_0x91cb('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x91cb('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5fd1354..129fcb1 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 _0x718f=['where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort'];(function(_0x1d69e5,_0x2a29af){var _0x17da11=function(_0x36c61f){while(--_0x36c61f){_0x1d69e5['push'](_0x1d69e5['shift']());}};_0x17da11(++_0x2a29af);}(_0x718f,0x1f1));var _0xf718=function(_0x2aba0e,_0x1872be){_0x2aba0e=_0x2aba0e-0x0;var _0x3f277e=_0x718f[_0x2aba0e];return _0x3f277e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf718('0x0'));var rimraf=require(_0xf718('0x1'));var zipdir=require(_0xf718('0x2'));var jsonpatch=require(_0xf718('0x3'));var rp=require(_0xf718('0x4'));var moment=require(_0xf718('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf718('0x6'));var util=require(_0xf718('0x7'));var path=require('path');var sox=require(_0xf718('0x8'));var csv=require(_0xf718('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf718('0x9'));var querystring=require(_0xf718('0xa'));var Papa=require(_0xf718('0xb'));var Redis=require('ioredis');var authService=require(_0xf718('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xf718('0xd'));var hardwareService=require(_0xf718('0xe'));var logger=require(_0xf718('0xf'))(_0xf718('0x10'));var utils=require(_0xf718('0x11'));var config=require(_0xf718('0x12'));var licenseUtil=require(_0xf718('0x13'));var db=require(_0xf718('0x14'))['db'];function respondWithStatusCode(_0x27fded,_0x3a1023){_0x3a1023=_0x3a1023||0xcc;return function(_0x42e259){if(_0x42e259){return _0x27fded[_0xf718('0x15')](_0x3a1023);}return _0x27fded[_0xf718('0x16')](_0x3a1023)[_0xf718('0x17')]();};}function respondWithResult(_0x30bb94,_0x58f19a){_0x58f19a=_0x58f19a||0xc8;return function(_0x15a3e8){if(_0x15a3e8){return _0x30bb94[_0xf718('0x16')](_0x58f19a)[_0xf718('0x18')](_0x15a3e8);}};}function respondWithFilteredResult(_0x1581f1,_0x5b2e08){return function(_0xcb93da){if(_0xcb93da){var _0x1ee652=_0xcb93da[_0xf718('0x19')],_0x3530a8=_0x5b2e08['offset'],_0x1f5278=_0x5b2e08['offset']+_0x5b2e08[_0xf718('0x1a')],_0x108340;if(_0x1f5278>=_0x1ee652){_0x1f5278=_0x1ee652;_0x108340=0xc8;}else{_0x108340=0xce;}_0x1581f1['status'](_0x108340);return _0x1581f1['set'](_0xf718('0x1b'),_0x3530a8+'-'+_0x1f5278+'/'+_0x1ee652)[_0xf718('0x18')](_0xcb93da);}return null;};}function patchUpdates(_0x20d915){return function(_0x5a87f4){try{jsonpatch['apply'](_0x5a87f4,_0x20d915,!![]);}catch(_0x512d07){return BPromise[_0xf718('0x1c')](_0x512d07);}return _0x5a87f4[_0xf718('0x1d')]();};}function saveUpdates(_0x15e1c5,_0x434ac9){return function(_0x3c2828){if(_0x3c2828){return _0x3c2828[_0xf718('0x1e')](_0x15e1c5)[_0xf718('0x1f')](function(_0x4c1df){return _0x4c1df;});}return null;};}function removeEntity(_0x506889,_0x52ff0b){return function(_0x35829c){if(_0x35829c){return _0x35829c[_0xf718('0x20')]()[_0xf718('0x1f')](function(){_0x506889[_0xf718('0x16')](0xcc)[_0xf718('0x17')]();});}};}function handleEntityNotFound(_0x13bad1,_0x622ad0){return function(_0x32d98f){if(!_0x32d98f){_0x13bad1[_0xf718('0x15')](0x194);}return _0x32d98f;};}function handleError(_0xb4a218,_0xc82462){_0xc82462=_0xc82462||0x1f4;return function(_0x32b637){logger[_0xf718('0x21')](_0x32b637[_0xf718('0x22')]);if(_0x32b637['name']){delete _0x32b637[_0xf718('0x23')];}_0xb4a218['status'](_0xc82462)[_0xf718('0x24')](_0x32b637);};}exports[_0xf718('0x25')]=function(_0x1f6ee,_0x511a49){var _0x27c8e9={},_0x34d01e={},_0x34994d={'count':0x0,'rows':[]};var _0xdc5818=_['map'](db[_0xf718('0x26')][_0xf718('0x27')],function(_0x36a995){return{'name':_0x36a995['fieldName'],'type':_0x36a995[_0xf718('0x28')][_0xf718('0x29')]};});_0x34d01e['model']=_[_0xf718('0x2a')](_0xdc5818,_0xf718('0x23'));_0x34d01e[_0xf718('0x2b')]=_[_0xf718('0x2c')](_0x1f6ee[_0xf718('0x2b')]);_0x34d01e[_0xf718('0x2d')]=_[_0xf718('0x2e')](_0x34d01e[_0xf718('0x2f')],_0x34d01e[_0xf718('0x2b')]);_0x27c8e9[_0xf718('0x30')]=_[_0xf718('0x2e')](_0x34d01e[_0xf718('0x2f')],qs['fields'](_0x1f6ee[_0xf718('0x2b')][_0xf718('0x31')]));_0x27c8e9[_0xf718('0x30')]=_0x27c8e9[_0xf718('0x30')][_0xf718('0x32')]?_0x27c8e9[_0xf718('0x30')]:_0x34d01e['model'];if(!_0x1f6ee[_0xf718('0x2b')]['hasOwnProperty'](_0xf718('0x33'))){_0x27c8e9[_0xf718('0x1a')]=qs[_0xf718('0x1a')](_0x1f6ee['query'][_0xf718('0x1a')]);_0x27c8e9[_0xf718('0x34')]=qs[_0xf718('0x34')](_0x1f6ee['query'][_0xf718('0x34')]);}_0x27c8e9[_0xf718('0x35')]=qs['sort'](_0x1f6ee[_0xf718('0x2b')][_0xf718('0x36')]);_0x27c8e9[_0xf718('0x37')]=qs[_0xf718('0x2d')](_[_0xf718('0x38')](_0x1f6ee['query'],_0x34d01e['filters']),_0xdc5818);if(_0x1f6ee[_0xf718('0x2b')][_0xf718('0x39')]){_0x27c8e9[_0xf718('0x37')]=_[_0xf718('0x3a')](_0x27c8e9[_0xf718('0x37')],{'$or':_[_0xf718('0x2a')](_0xdc5818,function(_0x2943a1){if(_0x2943a1['type']!=='VIRTUAL'){var _0x273681={};_0x273681[_0x2943a1['name']]={'$like':'%'+_0x1f6ee[_0xf718('0x2b')]['filter']+'%'};return _0x273681;}})});}_0x27c8e9=_[_0xf718('0x3a')]({},_0x27c8e9,_0x1f6ee[_0xf718('0x3b')]);var _0x3fa9fa={'where':_0x27c8e9[_0xf718('0x37')]};return db[_0xf718('0x26')][_0xf718('0x19')](_0x3fa9fa)[_0xf718('0x1f')](function(_0x23a2ae){_0x34994d[_0xf718('0x19')]=_0x23a2ae;if(_0x1f6ee['query'][_0xf718('0x3c')]){_0x27c8e9[_0xf718('0x3d')]=[{'all':!![]}];}return db[_0xf718('0x26')][_0xf718('0x3e')](_0x27c8e9);})['then'](function(_0x3f8fb0){_0x34994d[_0xf718('0x3f')]=_0x3f8fb0;return _0x34994d;})[_0xf718('0x1f')](respondWithFilteredResult(_0x511a49,_0x27c8e9))[_0xf718('0x40')](handleError(_0x511a49,null));};exports['show']=function(_0x3c77ef,_0xa82ae){var _0x3c6009={'raw':!![],'where':{'id':_0x3c77ef['params']['id']}},_0x57809b={};_0x57809b[_0xf718('0x2f')]=_[_0xf718('0x2c')](db['SquareMessage'][_0xf718('0x27')]);_0x57809b['query']=_[_0xf718('0x2c')](_0x3c77ef['query']);_0x57809b['filters']=_[_0xf718('0x2e')](_0x57809b[_0xf718('0x2f')],_0x57809b[_0xf718('0x2b')]);_0x3c6009[_0xf718('0x30')]=_['intersection'](_0x57809b[_0xf718('0x2f')],qs[_0xf718('0x31')](_0x3c77ef['query'][_0xf718('0x31')]));_0x3c6009[_0xf718('0x30')]=_0x3c6009[_0xf718('0x30')][_0xf718('0x32')]?_0x3c6009[_0xf718('0x30')]:_0x57809b[_0xf718('0x2f')];if(_0x3c77ef[_0xf718('0x2b')]['includeAll']){_0x3c6009['include']=[{'all':!![]}];}_0x3c6009=_[_0xf718('0x3a')]({},_0x3c6009,_0x3c77ef[_0xf718('0x3b')]);return db[_0xf718('0x26')][_0xf718('0x41')](_0x3c6009)[_0xf718('0x1f')](handleEntityNotFound(_0xa82ae,null))[_0xf718('0x1f')](respondWithResult(_0xa82ae,null))['catch'](handleError(_0xa82ae,null));};exports[_0xf718('0x42')]=function(_0x16af11,_0x1abd84){return db[_0xf718('0x26')][_0xf718('0x42')](_0x16af11[_0xf718('0x43')],{})[_0xf718('0x1f')](respondWithResult(_0x1abd84,0xc9))['catch'](handleError(_0x1abd84,null));};exports[_0xf718('0x1e')]=function(_0x2da34f,_0x131314){if(_0x2da34f[_0xf718('0x43')]['id']){delete _0x2da34f[_0xf718('0x43')]['id'];}return db['SquareMessage'][_0xf718('0x41')]({'where':{'id':_0x2da34f[_0xf718('0x44')]['id']}})[_0xf718('0x1f')](handleEntityNotFound(_0x131314,null))[_0xf718('0x1f')](saveUpdates(_0x2da34f[_0xf718('0x43')],null))[_0xf718('0x1f')](respondWithResult(_0x131314,null))[_0xf718('0x40')](handleError(_0x131314,null));};exports['destroy']=function(_0x4efdb3,_0x3a2353){return db['SquareMessage'][_0xf718('0x41')]({'where':{'id':_0x4efdb3[_0xf718('0x44')]['id']}})[_0xf718('0x1f')](handleEntityNotFound(_0x3a2353,null))[_0xf718('0x1f')](removeEntity(_0x3a2353,null))['catch'](handleError(_0x3a2353,null));}; \ No newline at end of file +var _0x3066=['request-promise','moment','bluebird','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','order','sort','where','pick','filter','merge','type','name','options','SquareMessage','includeAll','include','findAll','rows','show','params','find','catch','body','eml-format','rimraf','zip-dir'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3066,0x119));var _0x6306=function(_0x14fa16,_0x4dd54c){_0x14fa16=_0x14fa16-0x0;var _0x48fa7d=_0x3066[_0x14fa16];return _0x48fa7d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6306('0x0'));var rimraf=require(_0x6306('0x1'));var zipdir=require(_0x6306('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6306('0x3'));var moment=require(_0x6306('0x4'));var BPromise=require(_0x6306('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6306('0x6'));var sox=require(_0x6306('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6306('0x8'));var squel=require('squel');var crypto=require(_0x6306('0x9'));var jsforce=require(_0x6306('0xa'));var deskjs=require(_0x6306('0xb'));var toCsv=require(_0x6306('0xc'));var querystring=require(_0x6306('0xd'));var Papa=require(_0x6306('0xe'));var Redis=require(_0x6306('0xf'));var authService=require(_0x6306('0x10'));var qs=require(_0x6306('0x11'));var as=require(_0x6306('0x12'));var hardwareService=require(_0x6306('0x13'));var logger=require('../../config/logger')(_0x6306('0x14'));var utils=require('../../config/utils');var config=require(_0x6306('0x15'));var licenseUtil=require(_0x6306('0x16'));var db=require(_0x6306('0x17'))['db'];function respondWithStatusCode(_0x50c81d,_0x5ddd84){_0x5ddd84=_0x5ddd84||0xcc;return function(_0x35e145){if(_0x35e145){return _0x50c81d['sendStatus'](_0x5ddd84);}return _0x50c81d['status'](_0x5ddd84)['end']();};}function respondWithResult(_0x29d80c,_0x4f3884){_0x4f3884=_0x4f3884||0xc8;return function(_0x156a8d){if(_0x156a8d){return _0x29d80c[_0x6306('0x18')](_0x4f3884)[_0x6306('0x19')](_0x156a8d);}};}function respondWithFilteredResult(_0x41ceea,_0x51dd51){return function(_0xf29177){if(_0xf29177){var _0x5e054d=_0xf29177[_0x6306('0x1a')],_0x441148=_0x51dd51[_0x6306('0x1b')],_0x34e0ac=_0x51dd51[_0x6306('0x1b')]+_0x51dd51[_0x6306('0x1c')],_0x56544b;if(_0x34e0ac>=_0x5e054d){_0x34e0ac=_0x5e054d;_0x56544b=0xc8;}else{_0x56544b=0xce;}_0x41ceea['status'](_0x56544b);return _0x41ceea[_0x6306('0x1d')]('Content-Range',_0x441148+'-'+_0x34e0ac+'/'+_0x5e054d)[_0x6306('0x19')](_0xf29177);}return null;};}function patchUpdates(_0x5db631){return function(_0x175775){try{jsonpatch[_0x6306('0x1e')](_0x175775,_0x5db631,!![]);}catch(_0x48dda5){return BPromise[_0x6306('0x1f')](_0x48dda5);}return _0x175775[_0x6306('0x20')]();};}function saveUpdates(_0x1da891,_0x19b05d){return function(_0x336abd){if(_0x336abd){return _0x336abd['update'](_0x1da891)[_0x6306('0x21')](function(_0x1dea36){return _0x1dea36;});}return null;};}function removeEntity(_0x304ecb,_0x2dc13b){return function(_0x5b58c1){if(_0x5b58c1){return _0x5b58c1[_0x6306('0x22')]()[_0x6306('0x21')](function(){_0x304ecb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16bc81,_0x53afc0){return function(_0x7cd921){if(!_0x7cd921){_0x16bc81[_0x6306('0x23')](0x194);}return _0x7cd921;};}function handleError(_0x27f8ce,_0x47718d){_0x47718d=_0x47718d||0x1f4;return function(_0x4bb98){logger[_0x6306('0x24')](_0x4bb98[_0x6306('0x25')]);if(_0x4bb98['name']){delete _0x4bb98['name'];}_0x27f8ce['status'](_0x47718d)[_0x6306('0x26')](_0x4bb98);};}exports[_0x6306('0x27')]=function(_0x376272,_0x5f132a){var _0x220a20={},_0x35ca70={},_0x2dedf0={'count':0x0,'rows':[]};var _0x38552a=_[_0x6306('0x28')](db['SquareMessage'][_0x6306('0x29')],function(_0x47aa1a){return{'name':_0x47aa1a[_0x6306('0x2a')],'type':_0x47aa1a['type'][_0x6306('0x2b')]};});_0x35ca70[_0x6306('0x2c')]=_[_0x6306('0x28')](_0x38552a,'name');_0x35ca70[_0x6306('0x2d')]=_[_0x6306('0x2e')](_0x376272[_0x6306('0x2d')]);_0x35ca70[_0x6306('0x2f')]=_[_0x6306('0x30')](_0x35ca70[_0x6306('0x2c')],_0x35ca70[_0x6306('0x2d')]);_0x220a20['attributes']=_[_0x6306('0x30')](_0x35ca70[_0x6306('0x2c')],qs[_0x6306('0x31')](_0x376272[_0x6306('0x2d')][_0x6306('0x31')]));_0x220a20['attributes']=_0x220a20['attributes'][_0x6306('0x32')]?_0x220a20[_0x6306('0x33')]:_0x35ca70[_0x6306('0x2c')];if(!_0x376272['query']['hasOwnProperty']('nolimit')){_0x220a20[_0x6306('0x1c')]=qs[_0x6306('0x1c')](_0x376272['query']['limit']);_0x220a20[_0x6306('0x1b')]=qs[_0x6306('0x1b')](_0x376272[_0x6306('0x2d')][_0x6306('0x1b')]);}_0x220a20[_0x6306('0x34')]=qs['sort'](_0x376272[_0x6306('0x2d')][_0x6306('0x35')]);_0x220a20[_0x6306('0x36')]=qs[_0x6306('0x2f')](_[_0x6306('0x37')](_0x376272[_0x6306('0x2d')],_0x35ca70['filters']),_0x38552a);if(_0x376272['query'][_0x6306('0x38')]){_0x220a20['where']=_[_0x6306('0x39')](_0x220a20[_0x6306('0x36')],{'$or':_['map'](_0x38552a,function(_0x5aeedf){if(_0x5aeedf[_0x6306('0x3a')]!=='VIRTUAL'){var _0x44d5c4={};_0x44d5c4[_0x5aeedf[_0x6306('0x3b')]]={'$like':'%'+_0x376272[_0x6306('0x2d')][_0x6306('0x38')]+'%'};return _0x44d5c4;}})});}_0x220a20=_[_0x6306('0x39')]({},_0x220a20,_0x376272[_0x6306('0x3c')]);var _0x58e103={'where':_0x220a20[_0x6306('0x36')]};return db[_0x6306('0x3d')]['count'](_0x58e103)[_0x6306('0x21')](function(_0x56f2d6){_0x2dedf0[_0x6306('0x1a')]=_0x56f2d6;if(_0x376272[_0x6306('0x2d')][_0x6306('0x3e')]){_0x220a20[_0x6306('0x3f')]=[{'all':!![]}];}return db[_0x6306('0x3d')][_0x6306('0x40')](_0x220a20);})[_0x6306('0x21')](function(_0x26c6eb){_0x2dedf0[_0x6306('0x41')]=_0x26c6eb;return _0x2dedf0;})[_0x6306('0x21')](respondWithFilteredResult(_0x5f132a,_0x220a20))['catch'](handleError(_0x5f132a,null));};exports[_0x6306('0x42')]=function(_0x1ec1c8,_0x19d457){var _0x30da01={'raw':!![],'where':{'id':_0x1ec1c8[_0x6306('0x43')]['id']}},_0xde40d5={};_0xde40d5[_0x6306('0x2c')]=_[_0x6306('0x2e')](db[_0x6306('0x3d')][_0x6306('0x29')]);_0xde40d5[_0x6306('0x2d')]=_[_0x6306('0x2e')](_0x1ec1c8[_0x6306('0x2d')]);_0xde40d5['filters']=_[_0x6306('0x30')](_0xde40d5[_0x6306('0x2c')],_0xde40d5[_0x6306('0x2d')]);_0x30da01[_0x6306('0x33')]=_[_0x6306('0x30')](_0xde40d5[_0x6306('0x2c')],qs[_0x6306('0x31')](_0x1ec1c8['query'][_0x6306('0x31')]));_0x30da01[_0x6306('0x33')]=_0x30da01[_0x6306('0x33')]['length']?_0x30da01[_0x6306('0x33')]:_0xde40d5[_0x6306('0x2c')];if(_0x1ec1c8[_0x6306('0x2d')][_0x6306('0x3e')]){_0x30da01[_0x6306('0x3f')]=[{'all':!![]}];}_0x30da01=_[_0x6306('0x39')]({},_0x30da01,_0x1ec1c8[_0x6306('0x3c')]);return db[_0x6306('0x3d')][_0x6306('0x44')](_0x30da01)[_0x6306('0x21')](handleEntityNotFound(_0x19d457,null))[_0x6306('0x21')](respondWithResult(_0x19d457,null))[_0x6306('0x45')](handleError(_0x19d457,null));};exports['create']=function(_0x4ecc9f,_0x15958e){return db[_0x6306('0x3d')]['create'](_0x4ecc9f[_0x6306('0x46')],{})[_0x6306('0x21')](respondWithResult(_0x15958e,0xc9))[_0x6306('0x45')](handleError(_0x15958e,null));};exports['update']=function(_0x29afa9,_0xeae402){if(_0x29afa9[_0x6306('0x46')]['id']){delete _0x29afa9[_0x6306('0x46')]['id'];}return db[_0x6306('0x3d')]['find']({'where':{'id':_0x29afa9[_0x6306('0x43')]['id']}})[_0x6306('0x21')](handleEntityNotFound(_0xeae402,null))[_0x6306('0x21')](saveUpdates(_0x29afa9[_0x6306('0x46')],null))[_0x6306('0x21')](respondWithResult(_0xeae402,null))[_0x6306('0x45')](handleError(_0xeae402,null));};exports[_0x6306('0x22')]=function(_0x54d1eb,_0x233648){return db[_0x6306('0x3d')][_0x6306('0x44')]({'where':{'id':_0x54d1eb['params']['id']}})[_0x6306('0x21')](handleEntityNotFound(_0x233648,null))[_0x6306('0x21')](removeEntity(_0x233648,null))[_0x6306('0x45')](handleError(_0x233648,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b2651eb..13f5b3f 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 _0xfbd4=['SquareMessage','square_messages','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x222524,_0x100b31){var _0x2871e0=function(_0x3e0cdf){while(--_0x3e0cdf){_0x222524['push'](_0x222524['shift']());}};_0x2871e0(++_0x100b31);}(_0xfbd4,0x162));var _0x4fbd=function(_0x31d808,_0x6a2f5c){_0x31d808=_0x31d808-0x0;var _0x264c9b=_0xfbd4[_0x31d808];return _0x264c9b;};'use strict';var _=require('lodash');var util=require(_0x4fbd('0x0'));var logger=require(_0x4fbd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4fbd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fbd('0x3'));var rimraf=require(_0x4fbd('0x4'));var config=require(_0x4fbd('0x5'));var attributes=require(_0x4fbd('0x6'));module[_0x4fbd('0x7')]=function(_0x113935,_0xe6a1e0){return _0x113935[_0x4fbd('0x8')](_0x4fbd('0x9'),attributes,{'tableName':_0x4fbd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0bd=['./squareMessage.attributes','define','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ce15c,_0x312a45){var _0x1c3013=function(_0x5ad656){while(--_0x5ad656){_0x4ce15c['push'](_0x4ce15c['shift']());}};_0x1c3013(++_0x312a45);}(_0xb0bd,0x78));var _0xdb0b=function(_0x3aae89,_0x1e5729){_0x3aae89=_0x3aae89-0x0;var _0x132d3a=_0xb0bd[_0x3aae89];return _0x132d3a;};'use strict';var _=require(_0xdb0b('0x0'));var util=require(_0xdb0b('0x1'));var logger=require(_0xdb0b('0x2'))(_0xdb0b('0x3'));var moment=require(_0xdb0b('0x4'));var BPromise=require(_0xdb0b('0x5'));var rp=require(_0xdb0b('0x6'));var fs=require('fs');var path=require(_0xdb0b('0x7'));var rimraf=require(_0xdb0b('0x8'));var config=require(_0xdb0b('0x9'));var attributes=require(_0xdb0b('0xa'));module['exports']=function(_0xb601f9,_0x48263e){return _0xb601f9[_0xdb0b('0xb')]('SquareMessage',attributes,{'tableName':_0xdb0b('0xc'),'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 f83b581..1ab4081 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(_0x1586a1,_0x3da674){var _0x57c74b=function(_0x12cc73){while(--_0x12cc73){_0x1586a1['push'](_0x1586a1['shift']());}};_0x57c74b(++_0x3da674);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x14a296,_0x508a29){var _0x4d6881=function(_0x4a5cbc){while(--_0x4a5cbc){_0x14a296['push'](_0x14a296['shift']());}};_0x4d6881(++_0x508a29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 bf010ff..e98fdcc 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 _0x2825=['/:id/test','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x2825,0xa8));var _0x5282=function(_0x451edf,_0x2554e8){_0x451edf=_0x451edf-0x0;var _0x593cb2=_0x2825[_0x451edf];return _0x593cb2;};'use strict';var multer=require(_0x5282('0x0'));var util=require(_0x5282('0x1'));var path=require(_0x5282('0x2'));var timeout=require(_0x5282('0x3'));var express=require('express');var router=express[_0x5282('0x4')]();var auth=require(_0x5282('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5282('0x6'));router[_0x5282('0x7')]('/',auth[_0x5282('0x8')](),controller[_0x5282('0x9')]);router['get'](_0x5282('0xa'),auth['isAuthenticated'](),controller[_0x5282('0xb')]);router[_0x5282('0x7')](_0x5282('0xc'),auth[_0x5282('0x8')](),timeout('15s'),controller['test']);router[_0x5282('0xd')]('/',auth[_0x5282('0x8')](),controller[_0x5282('0xe')]);router['put'](_0x5282('0xa'),auth[_0x5282('0x8')](),controller[_0x5282('0xf')]);router[_0x5282('0x10')]('/:id',auth[_0x5282('0x8')](),controller[_0x5282('0x11')]);module['exports']=router; \ No newline at end of file +var _0x32d2=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/test','test','post','create','put','update','delete'];(function(_0x3ccdcd,_0xb4f56d){var _0x3d5176=function(_0x1ed8dd){while(--_0x1ed8dd){_0x3ccdcd['push'](_0x3ccdcd['shift']());}};_0x3d5176(++_0xb4f56d);}(_0x32d2,0x191));var _0x232d=function(_0x53efa4,_0x1e673b){_0x53efa4=_0x53efa4-0x0;var _0x276274=_0x32d2[_0x53efa4];return _0x276274;};'use strict';var multer=require(_0x232d('0x0'));var util=require(_0x232d('0x1'));var path=require(_0x232d('0x2'));var timeout=require(_0x232d('0x3'));var express=require(_0x232d('0x4'));var router=express['Router']();var auth=require(_0x232d('0x5'));var interaction=require(_0x232d('0x6'));var config=require(_0x232d('0x7'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x232d('0x8')](),controller['index']);router['get'](_0x232d('0x9'),auth['isAuthenticated'](),controller[_0x232d('0xa')]);router[_0x232d('0xb')](_0x232d('0xc'),auth[_0x232d('0x8')](),timeout('15s'),controller[_0x232d('0xd')]);router[_0x232d('0xe')]('/',auth[_0x232d('0x8')](),controller[_0x232d('0xf')]);router[_0x232d('0x10')](_0x232d('0x9'),auth[_0x232d('0x8')](),controller[_0x232d('0x11')]);router[_0x232d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x232d('0x13')]);module[_0x232d('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b83505b..9374eed 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 _0xac45=['name','STRING'];(function(_0x2419ae,_0x22bd0b){var _0x5f5930=function(_0x479aa6){while(--_0x479aa6){_0x2419ae['push'](_0x2419ae['shift']());}};_0x5f5930(++_0x22bd0b);}(_0xac45,0x71));var _0x5ac4=function(_0x2fd6bd,_0x3a19a6){_0x2fd6bd=_0x2fd6bd-0x0;var _0x135afa=_0xac45[_0x2fd6bd];return _0x135afa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5ac4('0x0')],'unique':_0x5ac4('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56a0=['name','sequelize','exports','STRING'];(function(_0x29b7c6,_0xe71e36){var _0xaa671=function(_0x24b872){while(--_0x24b872){_0x29b7c6['push'](_0x29b7c6['shift']());}};_0xaa671(++_0xe71e36);}(_0x56a0,0x1b1));var _0x056a=function(_0x9aaca8,_0x222c1a){_0x9aaca8=_0x9aaca8-0x0;var _0x1a77bd=_0x56a0[_0x9aaca8];return _0x1a77bd;};'use strict';var Sequelize=require(_0x056a('0x0'));module[_0x056a('0x1')]={'name':{'type':Sequelize[_0x056a('0x2')],'unique':_0x056a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x056a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b3d91f6..4cd2612 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 _0xeecf=['model','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','filters'];(function(_0x6b8a35,_0x6410fa){var _0x598253=function(_0x11f6d5){while(--_0x11f6d5){_0x6b8a35['push'](_0x6b8a35['shift']());}};_0x598253(++_0x6410fa);}(_0xeecf,0x1cc));var _0xfeec=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xeecf[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0xfeec('0x0'));var emlformat=require(_0xfeec('0x1'));var rimraf=require(_0xfeec('0x2'));var zipdir=require(_0xfeec('0x3'));var jsonpatch=require(_0xfeec('0x4'));var rp=require(_0xfeec('0x5'));var moment=require(_0xfeec('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xfeec('0x7'));var util=require(_0xfeec('0x8'));var path=require(_0xfeec('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfeec('0xa'));var fs=require('fs');var _=require(_0xfeec('0xb'));var squel=require(_0xfeec('0xc'));var crypto=require('crypto');var jsforce=require(_0xfeec('0xd'));var deskjs=require(_0xfeec('0xe'));var toCsv=require(_0xfeec('0xf'));var querystring=require(_0xfeec('0x10'));var Papa=require(_0xfeec('0x11'));var Redis=require(_0xfeec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfeec('0x13'));var as=require(_0xfeec('0x14'));var hardwareService=require(_0xfeec('0x15'));var logger=require('../../config/logger')(_0xfeec('0x16'));var utils=require(_0xfeec('0x17'));var config=require(_0xfeec('0x18'));var licenseUtil=require(_0xfeec('0x19'));var db=require(_0xfeec('0x1a'))['db'];function respondWithStatusCode(_0xc1d2c1,_0x591304){_0x591304=_0x591304||0xcc;return function(_0x192a38){if(_0x192a38){return _0xc1d2c1['sendStatus'](_0x591304);}return _0xc1d2c1[_0xfeec('0x1b')](_0x591304)[_0xfeec('0x1c')]();};}function respondWithResult(_0x165082,_0x4b1e19){_0x4b1e19=_0x4b1e19||0xc8;return function(_0x3b6f5a){if(_0x3b6f5a){return _0x165082[_0xfeec('0x1b')](_0x4b1e19)[_0xfeec('0x1d')](_0x3b6f5a);}};}function respondWithFilteredResult(_0x35b367,_0x3e3011){return function(_0x1b9e42){if(_0x1b9e42){var _0x5b0a85=_0x1b9e42['count'],_0x79eee6=_0x3e3011[_0xfeec('0x1e')],_0x4623ee=_0x3e3011[_0xfeec('0x1e')]+_0x3e3011[_0xfeec('0x1f')],_0x5df808;if(_0x4623ee>=_0x5b0a85){_0x4623ee=_0x5b0a85;_0x5df808=0xc8;}else{_0x5df808=0xce;}_0x35b367['status'](_0x5df808);return _0x35b367[_0xfeec('0x20')](_0xfeec('0x21'),_0x79eee6+'-'+_0x4623ee+'/'+_0x5b0a85)[_0xfeec('0x1d')](_0x1b9e42);}return null;};}function patchUpdates(_0x4b1339){return function(_0x3aa218){try{jsonpatch[_0xfeec('0x22')](_0x3aa218,_0x4b1339,!![]);}catch(_0x4db1af){return BPromise[_0xfeec('0x23')](_0x4db1af);}return _0x3aa218[_0xfeec('0x24')]();};}function saveUpdates(_0x5845bd,_0x3253e9){return function(_0x11b72d){if(_0x11b72d){return _0x11b72d[_0xfeec('0x25')](_0x5845bd)[_0xfeec('0x26')](function(_0x44969d){return _0x44969d;});}return null;};}function removeEntity(_0x242089,_0x32bedf){return function(_0xcf0191){if(_0xcf0191){return _0xcf0191[_0xfeec('0x27')]()['then'](function(){var _0x1b8a5c=_0xcf0191[_0xfeec('0x28')]({'plain':!![]});var _0x341234='ODBC';return db[_0xfeec('0x29')][_0xfeec('0x27')]({'where':{'type':_0x341234,'resourceId':_0x1b8a5c['id']}})['then'](function(){return _0xcf0191;});})['then'](function(){_0x242089[_0xfeec('0x1b')](0xcc)[_0xfeec('0x1c')]();});}};}function handleEntityNotFound(_0x2fe22c,_0x5c6e1d){return function(_0x831f68){if(!_0x831f68){_0x2fe22c[_0xfeec('0x2a')](0x194);}return _0x831f68;};}function handleError(_0x516ed8,_0x542d6e){_0x542d6e=_0x542d6e||0x1f4;return function(_0x21a20f){logger[_0xfeec('0x2b')](_0x21a20f[_0xfeec('0x2c')]);if(_0x21a20f[_0xfeec('0x2d')]){delete _0x21a20f[_0xfeec('0x2d')];}_0x516ed8['status'](_0x542d6e)[_0xfeec('0x2e')](_0x21a20f);};}exports[_0xfeec('0x2f')]=function(_0x53a2a1,_0x5c1c9d){var _0x46a372={},_0x50e720={},_0x14c091={'count':0x0,'rows':[]};var _0x52a8ad=_[_0xfeec('0x30')](db[_0xfeec('0x31')][_0xfeec('0x32')],function(_0x58a0e6){return{'name':_0x58a0e6[_0xfeec('0x33')],'type':_0x58a0e6[_0xfeec('0x34')][_0xfeec('0x35')]};});_0x50e720['model']=_[_0xfeec('0x30')](_0x52a8ad,_0xfeec('0x2d'));_0x50e720[_0xfeec('0x36')]=_['keys'](_0x53a2a1[_0xfeec('0x36')]);_0x50e720[_0xfeec('0x37')]=_['intersection'](_0x50e720[_0xfeec('0x38')],_0x50e720[_0xfeec('0x36')]);_0x46a372[_0xfeec('0x39')]=_[_0xfeec('0x3a')](_0x50e720[_0xfeec('0x38')],qs[_0xfeec('0x3b')](_0x53a2a1['query'][_0xfeec('0x3b')]));_0x46a372[_0xfeec('0x39')]=_0x46a372[_0xfeec('0x39')][_0xfeec('0x3c')]?_0x46a372[_0xfeec('0x39')]:_0x50e720['model'];if(!_0x53a2a1[_0xfeec('0x36')]['hasOwnProperty']('nolimit')){_0x46a372[_0xfeec('0x1f')]=qs[_0xfeec('0x1f')](_0x53a2a1['query']['limit']);_0x46a372[_0xfeec('0x1e')]=qs[_0xfeec('0x1e')](_0x53a2a1[_0xfeec('0x36')][_0xfeec('0x1e')]);}_0x46a372[_0xfeec('0x3d')]=qs['sort'](_0x53a2a1[_0xfeec('0x36')][_0xfeec('0x3e')]);_0x46a372[_0xfeec('0x3f')]=qs[_0xfeec('0x37')](_['pick'](_0x53a2a1['query'],_0x50e720[_0xfeec('0x37')]),_0x52a8ad);if(_0x53a2a1['query'][_0xfeec('0x40')]){_0x46a372[_0xfeec('0x3f')]=_[_0xfeec('0x41')](_0x46a372[_0xfeec('0x3f')],{'$or':_['map'](_0x52a8ad,function(_0xde7fad){if(_0xde7fad[_0xfeec('0x34')]!==_0xfeec('0x42')){var _0x272295={};_0x272295[_0xde7fad['name']]={'$like':'%'+_0x53a2a1[_0xfeec('0x36')][_0xfeec('0x40')]+'%'};return _0x272295;}})});}_0x46a372=_[_0xfeec('0x41')]({},_0x46a372,_0x53a2a1['options']);var _0x5420f1={'where':_0x46a372['where']};return db[_0xfeec('0x31')][_0xfeec('0x43')](_0x5420f1)[_0xfeec('0x26')](function(_0xd6a1b9){_0x14c091[_0xfeec('0x43')]=_0xd6a1b9;if(_0x53a2a1[_0xfeec('0x36')][_0xfeec('0x44')]){_0x46a372[_0xfeec('0x45')]=[{'all':!![]}];}return db[_0xfeec('0x31')]['findAll'](_0x46a372);})[_0xfeec('0x26')](function(_0x5361ad){_0x14c091['rows']=_0x5361ad;return _0x14c091;})['then'](respondWithFilteredResult(_0x5c1c9d,_0x46a372))[_0xfeec('0x46')](handleError(_0x5c1c9d,null));};exports[_0xfeec('0x47')]=function(_0x173320,_0xa6a8c){var _0x349481={'raw':!![],'where':{'id':_0x173320[_0xfeec('0x48')]['id']}},_0x50b851={};_0x50b851[_0xfeec('0x38')]=_['keys'](db[_0xfeec('0x31')][_0xfeec('0x32')]);_0x50b851[_0xfeec('0x36')]=_['keys'](_0x173320['query']);_0x50b851[_0xfeec('0x37')]=_['intersection'](_0x50b851[_0xfeec('0x38')],_0x50b851['query']);_0x349481[_0xfeec('0x39')]=_[_0xfeec('0x3a')](_0x50b851['model'],qs[_0xfeec('0x3b')](_0x173320[_0xfeec('0x36')][_0xfeec('0x3b')]));_0x349481[_0xfeec('0x39')]=_0x349481['attributes'][_0xfeec('0x3c')]?_0x349481['attributes']:_0x50b851[_0xfeec('0x38')];if(_0x173320[_0xfeec('0x36')]['includeAll']){_0x349481[_0xfeec('0x45')]=[{'all':!![]}];}_0x349481=_['merge']({},_0x349481,_0x173320['options']);return db['SquareOdbc'][_0xfeec('0x49')](_0x349481)['then'](handleEntityNotFound(_0xa6a8c,null))[_0xfeec('0x26')](respondWithResult(_0xa6a8c,null))[_0xfeec('0x46')](handleError(_0xa6a8c,null));};exports[_0xfeec('0x4a')]=function(_0x9ca37f,_0x5ecfb3){return db[_0xfeec('0x31')][_0xfeec('0x4a')](_0x9ca37f[_0xfeec('0x4b')],{})[_0xfeec('0x26')](function(_0x1120de){var _0x5f25ec=_0x9ca37f[_0xfeec('0x4c')][_0xfeec('0x28')]({'plain':!![]});if(!_0x5f25ec)throw new Error(_0xfeec('0x4d'));if(_0x5f25ec[_0xfeec('0x4e')]===_0xfeec('0x4c')){var _0x2c875e=_0x1120de['get']({'plain':!![]});var _0x1a1243=_0xfeec('0x4f');return db['UserProfileSection'][_0xfeec('0x49')]({'where':{'name':_0x1a1243,'userProfileId':_0x5f25ec[_0xfeec('0x50')]},'raw':!![]})[_0xfeec('0x26')](function(_0x41e437){if(_0x41e437&&_0x41e437['autoAssociation']===0x0){return db[_0xfeec('0x29')]['create']({'name':_0x2c875e[_0xfeec('0x2d')],'resourceId':_0x2c875e['id'],'type':_0x41e437[_0xfeec('0x2d')],'sectionId':_0x41e437['id']},{})['then'](function(){return _0x1120de;});}else{return _0x1120de;}})[_0xfeec('0x46')](function(_0x2db9ae){logger[_0xfeec('0x2b')](_0xfeec('0x51'),_0x2db9ae);throw _0x2db9ae;});}return _0x1120de;})[_0xfeec('0x26')](respondWithResult(_0x5ecfb3,0xc9))[_0xfeec('0x46')](handleError(_0x5ecfb3,null));};exports[_0xfeec('0x25')]=function(_0x15b96e,_0x35f893){if(_0x15b96e[_0xfeec('0x4b')]['id']){delete _0x15b96e['body']['id'];}return db[_0xfeec('0x31')]['find']({'where':{'id':_0x15b96e[_0xfeec('0x48')]['id']}})[_0xfeec('0x26')](handleEntityNotFound(_0x35f893,null))[_0xfeec('0x26')](saveUpdates(_0x15b96e[_0xfeec('0x4b')],null))[_0xfeec('0x26')](respondWithResult(_0x35f893,null))[_0xfeec('0x46')](handleError(_0x35f893,null));};exports[_0xfeec('0x27')]=function(_0xfc7b07,_0x56ac84){return db[_0xfeec('0x31')]['find']({'where':{'id':_0xfc7b07[_0xfeec('0x48')]['id']}})[_0xfeec('0x26')](handleEntityNotFound(_0x56ac84,null))['then'](removeEntity(_0x56ac84,null))[_0xfeec('0x46')](handleError(_0x56ac84,null));};exports[_0xfeec('0x52')]=function(_0x215df5,_0x5da5bd,_0x648351){var _0x136d86;return db['SquareOdbc'][_0xfeec('0x49')]({'where':{'id':_0x215df5['params']['id']},'attributes':['id',_0xfeec('0x53')]})[_0xfeec('0x26')](handleEntityNotFound(_0x5da5bd,null))[_0xfeec('0x26')](function(_0x4afc38){if(_0x4afc38){var _0x36d566=require(_0xfeec('0x54'))();_0x36d566['openSync'](_0x4afc38[_0xfeec('0x53')]);_0x36d566[_0xfeec('0x55')]();return _0x4afc38;}})[_0xfeec('0x26')](respondWithResult(_0x5da5bd,null))[_0xfeec('0x46')](handleError(_0x5da5bd,null));}; \ No newline at end of file +var _0xf34f=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','dsn','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x812cf2,_0x1db171){var _0x19a552=function(_0x45c3d8){while(--_0x45c3d8){_0x812cf2['push'](_0x812cf2['shift']());}};_0x19a552(++_0x1db171);}(_0xf34f,0x1a5));var _0xff34=function(_0x100f1a,_0x4e35f9){_0x100f1a=_0x100f1a-0x0;var _0x2f5fa3=_0xf34f[_0x100f1a];return _0x2f5fa3;};'use strict';var pdf=require(_0xff34('0x0'));var emlformat=require(_0xff34('0x1'));var rimraf=require(_0xff34('0x2'));var zipdir=require(_0xff34('0x3'));var jsonpatch=require(_0xff34('0x4'));var rp=require(_0xff34('0x5'));var moment=require(_0xff34('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xff34('0x7'));var util=require(_0xff34('0x8'));var path=require(_0xff34('0x9'));var sox=require(_0xff34('0xa'));var csv=require(_0xff34('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff34('0xc'));var squel=require(_0xff34('0xd'));var crypto=require(_0xff34('0xe'));var jsforce=require(_0xff34('0xf'));var deskjs=require(_0xff34('0x10'));var toCsv=require(_0xff34('0xb'));var querystring=require(_0xff34('0x11'));var Papa=require(_0xff34('0x12'));var Redis=require(_0xff34('0x13'));var authService=require(_0xff34('0x14'));var qs=require(_0xff34('0x15'));var as=require(_0xff34('0x16'));var hardwareService=require(_0xff34('0x17'));var logger=require('../../config/logger')(_0xff34('0x18'));var utils=require('../../config/utils');var config=require(_0xff34('0x19'));var licenseUtil=require(_0xff34('0x1a'));var db=require(_0xff34('0x1b'))['db'];function respondWithStatusCode(_0x1fb3b2,_0x555d44){_0x555d44=_0x555d44||0xcc;return function(_0x33eb9f){if(_0x33eb9f){return _0x1fb3b2[_0xff34('0x1c')](_0x555d44);}return _0x1fb3b2[_0xff34('0x1d')](_0x555d44)[_0xff34('0x1e')]();};}function respondWithResult(_0x1f38ae,_0x357990){_0x357990=_0x357990||0xc8;return function(_0x1e255b){if(_0x1e255b){return _0x1f38ae[_0xff34('0x1d')](_0x357990)[_0xff34('0x1f')](_0x1e255b);}};}function respondWithFilteredResult(_0xc774a6,_0x2f3757){return function(_0x22203f){if(_0x22203f){var _0x4ca787=_0x22203f['count'],_0x3e10f8=_0x2f3757['offset'],_0x34164c=_0x2f3757[_0xff34('0x20')]+_0x2f3757[_0xff34('0x21')],_0x39ceca;if(_0x34164c>=_0x4ca787){_0x34164c=_0x4ca787;_0x39ceca=0xc8;}else{_0x39ceca=0xce;}_0xc774a6[_0xff34('0x1d')](_0x39ceca);return _0xc774a6[_0xff34('0x22')](_0xff34('0x23'),_0x3e10f8+'-'+_0x34164c+'/'+_0x4ca787)[_0xff34('0x1f')](_0x22203f);}return null;};}function patchUpdates(_0x2496c2){return function(_0x6d83a){try{jsonpatch[_0xff34('0x24')](_0x6d83a,_0x2496c2,!![]);}catch(_0x55800e){return BPromise['reject'](_0x55800e);}return _0x6d83a['save']();};}function saveUpdates(_0x3858bb,_0x1bf4aa){return function(_0x2e97eb){if(_0x2e97eb){return _0x2e97eb['update'](_0x3858bb)[_0xff34('0x25')](function(_0x24a598){return _0x24a598;});}return null;};}function removeEntity(_0x26724f,_0x29d688){return function(_0x517054){if(_0x517054){return _0x517054[_0xff34('0x26')]()['then'](function(){var _0x5bfc95=_0x517054[_0xff34('0x27')]({'plain':!![]});var _0x2c5415=_0xff34('0x28');return db[_0xff34('0x29')][_0xff34('0x26')]({'where':{'type':_0x2c5415,'resourceId':_0x5bfc95['id']}})[_0xff34('0x25')](function(){return _0x517054;});})['then'](function(){_0x26724f[_0xff34('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x547827,_0x3fe177){return function(_0x4be62e){if(!_0x4be62e){_0x547827[_0xff34('0x1c')](0x194);}return _0x4be62e;};}function handleError(_0x402c6d,_0x449fda){_0x449fda=_0x449fda||0x1f4;return function(_0x3ce456){logger[_0xff34('0x2a')](_0x3ce456['stack']);if(_0x3ce456[_0xff34('0x2b')]){delete _0x3ce456[_0xff34('0x2b')];}_0x402c6d[_0xff34('0x1d')](_0x449fda)[_0xff34('0x2c')](_0x3ce456);};}exports[_0xff34('0x2d')]=function(_0x44be8a,_0x378eed){var _0x32d9b6={},_0x4d9346={},_0x2df0d0={'count':0x0,'rows':[]};var _0x8802c7=_[_0xff34('0x2e')](db[_0xff34('0x2f')][_0xff34('0x30')],function(_0x4de3ab){return{'name':_0x4de3ab[_0xff34('0x31')],'type':_0x4de3ab[_0xff34('0x32')][_0xff34('0x33')]};});_0x4d9346[_0xff34('0x34')]=_[_0xff34('0x2e')](_0x8802c7,_0xff34('0x2b'));_0x4d9346[_0xff34('0x35')]=_[_0xff34('0x36')](_0x44be8a[_0xff34('0x35')]);_0x4d9346[_0xff34('0x37')]=_[_0xff34('0x38')](_0x4d9346[_0xff34('0x34')],_0x4d9346[_0xff34('0x35')]);_0x32d9b6[_0xff34('0x39')]=_[_0xff34('0x38')](_0x4d9346[_0xff34('0x34')],qs[_0xff34('0x3a')](_0x44be8a[_0xff34('0x35')][_0xff34('0x3a')]));_0x32d9b6[_0xff34('0x39')]=_0x32d9b6[_0xff34('0x39')][_0xff34('0x3b')]?_0x32d9b6[_0xff34('0x39')]:_0x4d9346[_0xff34('0x34')];if(!_0x44be8a['query']['hasOwnProperty']('nolimit')){_0x32d9b6[_0xff34('0x21')]=qs[_0xff34('0x21')](_0x44be8a['query']['limit']);_0x32d9b6[_0xff34('0x20')]=qs['offset'](_0x44be8a[_0xff34('0x35')][_0xff34('0x20')]);}_0x32d9b6[_0xff34('0x3c')]=qs['sort'](_0x44be8a[_0xff34('0x35')]['sort']);_0x32d9b6[_0xff34('0x3d')]=qs[_0xff34('0x37')](_[_0xff34('0x3e')](_0x44be8a[_0xff34('0x35')],_0x4d9346[_0xff34('0x37')]),_0x8802c7);if(_0x44be8a[_0xff34('0x35')][_0xff34('0x3f')]){_0x32d9b6[_0xff34('0x3d')]=_[_0xff34('0x40')](_0x32d9b6[_0xff34('0x3d')],{'$or':_[_0xff34('0x2e')](_0x8802c7,function(_0x4309eb){if(_0x4309eb[_0xff34('0x32')]!==_0xff34('0x41')){var _0x2527e9={};_0x2527e9[_0x4309eb[_0xff34('0x2b')]]={'$like':'%'+_0x44be8a[_0xff34('0x35')][_0xff34('0x3f')]+'%'};return _0x2527e9;}})});}_0x32d9b6=_[_0xff34('0x40')]({},_0x32d9b6,_0x44be8a[_0xff34('0x42')]);var _0x638135={'where':_0x32d9b6[_0xff34('0x3d')]};return db[_0xff34('0x2f')][_0xff34('0x43')](_0x638135)['then'](function(_0x1484f4){_0x2df0d0[_0xff34('0x43')]=_0x1484f4;if(_0x44be8a[_0xff34('0x35')][_0xff34('0x44')]){_0x32d9b6[_0xff34('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0xff34('0x46')](_0x32d9b6);})[_0xff34('0x25')](function(_0x4d0716){_0x2df0d0[_0xff34('0x47')]=_0x4d0716;return _0x2df0d0;})[_0xff34('0x25')](respondWithFilteredResult(_0x378eed,_0x32d9b6))[_0xff34('0x48')](handleError(_0x378eed,null));};exports[_0xff34('0x49')]=function(_0x52f61f,_0x3e5956){var _0x3114f7={'raw':!![],'where':{'id':_0x52f61f[_0xff34('0x4a')]['id']}},_0x445cef={};_0x445cef[_0xff34('0x34')]=_[_0xff34('0x36')](db[_0xff34('0x2f')][_0xff34('0x30')]);_0x445cef[_0xff34('0x35')]=_[_0xff34('0x36')](_0x52f61f[_0xff34('0x35')]);_0x445cef[_0xff34('0x37')]=_['intersection'](_0x445cef[_0xff34('0x34')],_0x445cef[_0xff34('0x35')]);_0x3114f7[_0xff34('0x39')]=_['intersection'](_0x445cef[_0xff34('0x34')],qs[_0xff34('0x3a')](_0x52f61f[_0xff34('0x35')][_0xff34('0x3a')]));_0x3114f7[_0xff34('0x39')]=_0x3114f7['attributes'][_0xff34('0x3b')]?_0x3114f7[_0xff34('0x39')]:_0x445cef[_0xff34('0x34')];if(_0x52f61f[_0xff34('0x35')][_0xff34('0x44')]){_0x3114f7[_0xff34('0x45')]=[{'all':!![]}];}_0x3114f7=_['merge']({},_0x3114f7,_0x52f61f[_0xff34('0x42')]);return db[_0xff34('0x2f')][_0xff34('0x4b')](_0x3114f7)[_0xff34('0x25')](handleEntityNotFound(_0x3e5956,null))[_0xff34('0x25')](respondWithResult(_0x3e5956,null))['catch'](handleError(_0x3e5956,null));};exports[_0xff34('0x4c')]=function(_0x413bb,_0x330492){return db[_0xff34('0x2f')][_0xff34('0x4c')](_0x413bb[_0xff34('0x4d')],{})[_0xff34('0x25')](function(_0x4da902){var _0x4503b9=_0x413bb[_0xff34('0x4e')][_0xff34('0x27')]({'plain':!![]});if(!_0x4503b9)throw new Error(_0xff34('0x4f'));if(_0x4503b9['role']===_0xff34('0x4e')){var _0x4a754d=_0x4da902[_0xff34('0x27')]({'plain':!![]});var _0xf8957a=_0xff34('0x28');return db[_0xff34('0x50')][_0xff34('0x4b')]({'where':{'name':_0xf8957a,'userProfileId':_0x4503b9[_0xff34('0x51')]},'raw':!![]})['then'](function(_0x25e84b){if(_0x25e84b&&_0x25e84b[_0xff34('0x52')]===0x0){return db['UserProfileResource'][_0xff34('0x4c')]({'name':_0x4a754d['name'],'resourceId':_0x4a754d['id'],'type':_0x25e84b['name'],'sectionId':_0x25e84b['id']},{})[_0xff34('0x25')](function(){return _0x4da902;});}else{return _0x4da902;}})[_0xff34('0x48')](function(_0x3be212){logger[_0xff34('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3be212);throw _0x3be212;});}return _0x4da902;})[_0xff34('0x25')](respondWithResult(_0x330492,0xc9))[_0xff34('0x48')](handleError(_0x330492,null));};exports[_0xff34('0x53')]=function(_0x1750af,_0x32d0f6){if(_0x1750af[_0xff34('0x4d')]['id']){delete _0x1750af['body']['id'];}return db[_0xff34('0x2f')]['find']({'where':{'id':_0x1750af[_0xff34('0x4a')]['id']}})[_0xff34('0x25')](handleEntityNotFound(_0x32d0f6,null))[_0xff34('0x25')](saveUpdates(_0x1750af[_0xff34('0x4d')],null))[_0xff34('0x25')](respondWithResult(_0x32d0f6,null))[_0xff34('0x48')](handleError(_0x32d0f6,null));};exports[_0xff34('0x26')]=function(_0x51415e,_0x45ca7c){return db[_0xff34('0x2f')][_0xff34('0x4b')]({'where':{'id':_0x51415e[_0xff34('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45ca7c,null))[_0xff34('0x25')](removeEntity(_0x45ca7c,null))['catch'](handleError(_0x45ca7c,null));};exports['test']=function(_0x1d27e0,_0x61ed6,_0x414f73){var _0x2932d7;return db[_0xff34('0x2f')][_0xff34('0x4b')]({'where':{'id':_0x1d27e0[_0xff34('0x4a')]['id']},'attributes':['id',_0xff34('0x54')]})[_0xff34('0x25')](handleEntityNotFound(_0x61ed6,null))[_0xff34('0x25')](function(_0x5d3c8d){if(_0x5d3c8d){var _0x989395=require('odbc')();_0x989395['openSync'](_0x5d3c8d['dsn']);_0x989395['closeSync']();return _0x5d3c8d;}})[_0xff34('0x25')](respondWithResult(_0x61ed6,null))[_0xff34('0x48')](handleError(_0x61ed6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index fbeeac1..e4440ec 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 _0x47d6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger'];(function(_0x5b6813,_0x3ab07f){var _0x38a9b5=function(_0xeaf93b){while(--_0xeaf93b){_0x5b6813['push'](_0x5b6813['shift']());}};_0x38a9b5(++_0x3ab07f);}(_0x47d6,0x13f));var _0x647d=function(_0x3232ac,_0xc59d49){_0x3232ac=_0x3232ac-0x0;var _0x1c4b3e=_0x47d6[_0x3232ac];return _0x1c4b3e;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var logger=require(_0x647d('0x2'))(_0x647d('0x3'));var moment=require(_0x647d('0x4'));var BPromise=require(_0x647d('0x5'));var rp=require(_0x647d('0x6'));var fs=require('fs');var path=require(_0x647d('0x7'));var rimraf=require(_0x647d('0x8'));var config=require(_0x647d('0x9'));var attributes=require(_0x647d('0xa'));module[_0x647d('0xb')]=function(_0x8a0753,_0x8ffe2b){return _0x8a0753[_0x647d('0xc')](_0x647d('0xd'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbde=['moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','square_odbc','lodash','../../config/logger','api'];(function(_0x639fc2,_0x5b4786){var _0x32ee5c=function(_0x297b79){while(--_0x297b79){_0x639fc2['push'](_0x639fc2['shift']());}};_0x32ee5c(++_0x5b4786);}(_0xcbde,0x141));var _0xecbd=function(_0x62c0e6,_0xdc8a38){_0x62c0e6=_0x62c0e6-0x0;var _0x455c22=_0xcbde[_0x62c0e6];return _0x455c22;};'use strict';var _=require(_0xecbd('0x0'));var util=require('util');var logger=require(_0xecbd('0x1'))(_0xecbd('0x2'));var moment=require(_0xecbd('0x3'));var BPromise=require(_0xecbd('0x4'));var rp=require(_0xecbd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xecbd('0x6'));var attributes=require(_0xecbd('0x7'));module['exports']=function(_0x25b899,_0x27a04d){return _0x25b899['define']('SquareOdbc',attributes,{'tableName':_0xecbd('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 81769bd..28d2b3b 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 _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x363f2b,_0x51f8ff){var _0xc2c0d6=function(_0xc789d8){while(--_0xc789d8){_0x363f2b['push'](_0x363f2b['shift']());}};_0xc2c0d6(++_0x51f8ff);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'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});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x43ad57,_0x463504){var _0x38c75f=function(_0x4c0185){while(--_0x4c0185){_0x43ad57['push'](_0x43ad57['shift']());}};_0x38c75f(++_0x463504);}(_0x55ca,0x126));var _0xa55c=function(_0x433e29,_0x14b418){_0x433e29=_0x433e29-0x0;var _0x84abd4=_0x55ca[_0x433e29];return _0x84abd4;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d4d7a39..c18f89b 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 _0xf734=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','/:id','delete','destroy','exports','multer','util'];(function(_0x579b5f,_0x5082c6){var _0x2cec9d=function(_0x1c9f9b){while(--_0x1c9f9b){_0x579b5f['push'](_0x579b5f['shift']());}};_0x2cec9d(++_0x5082c6);}(_0xf734,0x140));var _0x4f73=function(_0x2a1858,_0x4d5a4e){_0x2a1858=_0x2a1858-0x0;var _0x3d37f2=_0xf734[_0x2a1858];return _0x3d37f2;};'use strict';var multer=require(_0x4f73('0x0'));var util=require(_0x4f73('0x1'));var path=require(_0x4f73('0x2'));var timeout=require(_0x4f73('0x3'));var express=require(_0x4f73('0x4'));var router=express[_0x4f73('0x5')]();var auth=require(_0x4f73('0x6'));var interaction=require(_0x4f73('0x7'));var config=require(_0x4f73('0x8'));var controller=require('./squareProject.controller');router[_0x4f73('0x9')]('/',auth['isAuthenticated'](),controller[_0x4f73('0xa')]);router[_0x4f73('0x9')]('/:id',auth[_0x4f73('0xb')](),controller[_0x4f73('0xc')]);router[_0x4f73('0x9')](_0x4f73('0xd'),auth['isAuthenticated'](),controller[_0x4f73('0xe')]);router[_0x4f73('0xf')]('/',auth['isAuthenticated'](),controller[_0x4f73('0x10')]);router['post']('/:id/users',auth[_0x4f73('0xb')](),controller[_0x4f73('0x11')]);router[_0x4f73('0x12')](_0x4f73('0x13'),auth[_0x4f73('0xb')](),controller['update']);router[_0x4f73('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4f73('0x15')]);router['delete'](_0x4f73('0xd'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x4f73('0x16')]=router; \ No newline at end of file +var _0xab3a=['post','create','put','update','destroy','delete','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users'];(function(_0x126a10,_0x7bde76){var _0x15a853=function(_0x2bd2d6){while(--_0x2bd2d6){_0x126a10['push'](_0x126a10['shift']());}};_0x15a853(++_0x7bde76);}(_0xab3a,0x192));var _0xaab3=function(_0x5acfde,_0x3596d4){_0x5acfde=_0x5acfde-0x0;var _0x123d61=_0xab3a[_0x5acfde];return _0x123d61;};'use strict';var multer=require('multer');var util=require(_0xaab3('0x0'));var path=require(_0xaab3('0x1'));var timeout=require(_0xaab3('0x2'));var express=require('express');var router=express[_0xaab3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xaab3('0x4'));var config=require(_0xaab3('0x5'));var controller=require('./squareProject.controller');router[_0xaab3('0x6')]('/',auth[_0xaab3('0x7')](),controller[_0xaab3('0x8')]);router[_0xaab3('0x6')](_0xaab3('0x9'),auth['isAuthenticated'](),controller[_0xaab3('0xa')]);router[_0xaab3('0x6')](_0xaab3('0xb'),auth[_0xaab3('0x7')](),controller['getUsers']);router[_0xaab3('0xc')]('/',auth[_0xaab3('0x7')](),controller[_0xaab3('0xd')]);router[_0xaab3('0xc')](_0xaab3('0xb'),auth[_0xaab3('0x7')](),controller['addUsers']);router[_0xaab3('0xe')](_0xaab3('0x9'),auth['isAuthenticated'](),controller[_0xaab3('0xf')]);router['delete'](_0xaab3('0x9'),auth[_0xaab3('0x7')](),controller[_0xaab3('0x10')]);router[_0xaab3('0x11')](_0xaab3('0xb'),auth[_0xaab3('0x7')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index dcb512a..914fb57 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 _0x3d70=['utf8','BLOB','production','DATE','exports','STRING','name','TEXT','long','getDataValue','toString'];(function(_0x261bbf,_0x567f53){var _0x3434e5=function(_0x5c194c){while(--_0x5c194c){_0x261bbf['push'](_0x261bbf['shift']());}};_0x3434e5(++_0x567f53);}(_0x3d70,0xf6));var _0x03d7=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x3d70[_0x2d9c6a];return _0xf3c918;};'use strict';var Sequelize=require('sequelize');module[_0x03d7('0x0')]={'name':{'type':Sequelize[_0x03d7('0x1')],'unique':_0x03d7('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x03d7('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x03d7('0x4')),'get':function(){if(this[_0x03d7('0x5')]('preproduction')){return this[_0x03d7('0x5')]('preproduction')[_0x03d7('0x6')](_0x03d7('0x7'));}}},'production':{'type':Sequelize[_0x03d7('0x8')](_0x03d7('0x4')),'get':function(){if(this['getDataValue'](_0x03d7('0x9'))){return this[_0x03d7('0x5')](_0x03d7('0x9'))['toString'](_0x03d7('0x7'));}}},'savedAt':{'type':Sequelize[_0x03d7('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xd983=['long','getDataValue','preproduction','toString','production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0xd983,0x10b));var _0x3d98=function(_0x4654c3,_0x2e6037){_0x4654c3=_0x4654c3-0x0;var _0x2851db=_0xd983[_0x4654c3];return _0x2851db;};'use strict';var Sequelize=require(_0x3d98('0x0'));module[_0x3d98('0x1')]={'name':{'type':Sequelize[_0x3d98('0x2')],'unique':_0x3d98('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3d98('0x2')]},'notes':{'type':Sequelize[_0x3d98('0x4')]},'preproduction':{'type':Sequelize[_0x3d98('0x5')](_0x3d98('0x6')),'get':function(){if(this[_0x3d98('0x7')](_0x3d98('0x8'))){return this[_0x3d98('0x7')]('preproduction')[_0x3d98('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x3d98('0x5')](_0x3d98('0x6')),'get':function(){if(this[_0x3d98('0x7')]('production')){return this[_0x3d98('0x7')](_0x3d98('0xa'))['toString'](_0x3d98('0xb'));}}},'savedAt':{'type':Sequelize[_0x3d98('0xc')]},'publishedAt':{'type':Sequelize[_0x3d98('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 00ad92f..88c1de5 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 _0x2533=['UserProfileResource','end','name','index','map','SquareProject','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','getUsers','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x3173f9,_0x40447f){var _0x5bac62=function(_0x7936c9){while(--_0x7936c9){_0x3173f9['push'](_0x3173f9['shift']());}};_0x5bac62(++_0x40447f);}(_0x2533,0xf1));var _0x3253=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0x2533[_0x1f1511];return _0x1d9ab8;};'use strict';var pdf=require(_0x3253('0x0'));var emlformat=require(_0x3253('0x1'));var rimraf=require(_0x3253('0x2'));var zipdir=require(_0x3253('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3253('0x4'));var moment=require('moment');var BPromise=require(_0x3253('0x5'));var Mustache=require(_0x3253('0x6'));var util=require(_0x3253('0x7'));var path=require(_0x3253('0x8'));var sox=require('sox');var csv=require(_0x3253('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3253('0xa'));var crypto=require(_0x3253('0xb'));var jsforce=require(_0x3253('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3253('0x9'));var querystring=require(_0x3253('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3253('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3253('0xf'));var logger=require(_0x3253('0x10'))(_0x3253('0x11'));var utils=require(_0x3253('0x12'));var config=require(_0x3253('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3253('0x14'))['db'];config['redis']=_[_0x3253('0x15')](config['redis'],{'host':_0x3253('0x16'),'port':0x18eb});var socket=require(_0x3253('0x17'))(new Redis(config[_0x3253('0x18')]));require(_0x3253('0x19'))[_0x3253('0x1a')](socket);function respondWithStatusCode(_0x3fa5e0,_0x52fde9){_0x52fde9=_0x52fde9||0xcc;return function(_0xd3d1b1){if(_0xd3d1b1){return _0x3fa5e0[_0x3253('0x1b')](_0x52fde9);}return _0x3fa5e0[_0x3253('0x1c')](_0x52fde9)['end']();};}function respondWithResult(_0x54bbd1,_0x480106){_0x480106=_0x480106||0xc8;return function(_0x12847f){if(_0x12847f){return _0x54bbd1[_0x3253('0x1c')](_0x480106)[_0x3253('0x1d')](_0x12847f);}};}function respondWithFilteredResult(_0x3b6e7f,_0x4225be){return function(_0x2859c4){if(_0x2859c4){var _0x34118b=_0x2859c4[_0x3253('0x1e')],_0x4762b4=_0x4225be[_0x3253('0x1f')],_0x2bb756=_0x4225be['offset']+_0x4225be[_0x3253('0x20')],_0x48c5f9;if(_0x2bb756>=_0x34118b){_0x2bb756=_0x34118b;_0x48c5f9=0xc8;}else{_0x48c5f9=0xce;}_0x3b6e7f[_0x3253('0x1c')](_0x48c5f9);return _0x3b6e7f[_0x3253('0x21')](_0x3253('0x22'),_0x4762b4+'-'+_0x2bb756+'/'+_0x34118b)[_0x3253('0x1d')](_0x2859c4);}return null;};}function patchUpdates(_0x393910){return function(_0x4db03b){try{jsonpatch[_0x3253('0x23')](_0x4db03b,_0x393910,!![]);}catch(_0x246290){return BPromise[_0x3253('0x24')](_0x246290);}return _0x4db03b['save']();};}function saveUpdates(_0x17a76b,_0x15fc7b){return function(_0x24a0f6){if(_0x24a0f6){return _0x24a0f6[_0x3253('0x25')](_0x17a76b)[_0x3253('0x26')](function(_0x550872){return _0x550872;});}return null;};}function removeEntity(_0x5c645e,_0x5dec16){return function(_0x51f819){if(_0x51f819){return _0x51f819[_0x3253('0x27')]()[_0x3253('0x26')](function(){var _0x52117b=_0x51f819[_0x3253('0x28')]({'plain':!![]});var _0x441ebe='SquareProjects';return db[_0x3253('0x29')][_0x3253('0x27')]({'where':{'type':_0x441ebe,'resourceId':_0x52117b['id']}})[_0x3253('0x26')](function(){return _0x51f819;});})['then'](function(){_0x5c645e[_0x3253('0x1c')](0xcc)[_0x3253('0x2a')]();});}};}function handleEntityNotFound(_0x2ba6dd,_0x3dc6b7){return function(_0x33b782){if(!_0x33b782){_0x2ba6dd[_0x3253('0x1b')](0x194);}return _0x33b782;};}function handleError(_0x16c6d0,_0x290f9f){_0x290f9f=_0x290f9f||0x1f4;return function(_0x20799a){logger['error'](_0x20799a['stack']);if(_0x20799a[_0x3253('0x2b')]){delete _0x20799a[_0x3253('0x2b')];}_0x16c6d0[_0x3253('0x1c')](_0x290f9f)['send'](_0x20799a);};}exports[_0x3253('0x2c')]=function(_0x11755d,_0x230e6f){var _0x5c9b64={},_0x371ecc={},_0x1b1ac2={'count':0x0,'rows':[]};var _0x47bc2a=_[_0x3253('0x2d')](db[_0x3253('0x2e')]['rawAttributes'],function(_0x114ae5){return{'name':_0x114ae5[_0x3253('0x2f')],'type':_0x114ae5['type'][_0x3253('0x30')]};});_0x371ecc[_0x3253('0x31')]=_[_0x3253('0x2d')](_0x47bc2a,_0x3253('0x2b'));_0x371ecc['query']=_[_0x3253('0x32')](_0x11755d[_0x3253('0x33')]);_0x371ecc[_0x3253('0x34')]=_['intersection'](_0x371ecc[_0x3253('0x31')],_0x371ecc[_0x3253('0x33')]);_0x5c9b64[_0x3253('0x35')]=_[_0x3253('0x36')](_0x371ecc[_0x3253('0x31')],qs[_0x3253('0x37')](_0x11755d[_0x3253('0x33')][_0x3253('0x37')]));_0x5c9b64[_0x3253('0x35')]=_0x5c9b64['attributes'][_0x3253('0x38')]?_0x5c9b64[_0x3253('0x35')]:_0x371ecc['model'];if(!_0x11755d[_0x3253('0x33')][_0x3253('0x39')](_0x3253('0x3a'))){_0x5c9b64[_0x3253('0x20')]=qs[_0x3253('0x20')](_0x11755d[_0x3253('0x33')][_0x3253('0x20')]);_0x5c9b64[_0x3253('0x1f')]=qs['offset'](_0x11755d[_0x3253('0x33')][_0x3253('0x1f')]);}_0x5c9b64[_0x3253('0x3b')]=qs[_0x3253('0x3c')](_0x11755d[_0x3253('0x33')][_0x3253('0x3c')]);_0x5c9b64[_0x3253('0x3d')]=qs[_0x3253('0x34')](_[_0x3253('0x3e')](_0x11755d[_0x3253('0x33')],_0x371ecc[_0x3253('0x34')]),_0x47bc2a);if(_0x11755d[_0x3253('0x33')][_0x3253('0x3f')]){_0x5c9b64[_0x3253('0x3d')]=_[_0x3253('0x40')](_0x5c9b64[_0x3253('0x3d')],{'$or':_[_0x3253('0x2d')](_0x47bc2a,function(_0x4f6185){if(_0x4f6185[_0x3253('0x41')]!==_0x3253('0x42')){var _0x4e0416={};_0x4e0416[_0x4f6185[_0x3253('0x2b')]]={'$like':'%'+_0x11755d[_0x3253('0x33')][_0x3253('0x3f')]+'%'};return _0x4e0416;}})});}_0x5c9b64=_[_0x3253('0x40')]({},_0x5c9b64,_0x11755d[_0x3253('0x43')]);var _0x3c4038={'where':_0x5c9b64[_0x3253('0x3d')]};return db[_0x3253('0x2e')][_0x3253('0x1e')](_0x3c4038)['then'](function(_0x771200){_0x1b1ac2['count']=_0x771200;if(_0x11755d[_0x3253('0x33')][_0x3253('0x44')]){_0x5c9b64[_0x3253('0x45')]=[{'all':!![]}];}return db['SquareProject'][_0x3253('0x46')](_0x5c9b64);})[_0x3253('0x26')](function(_0x21da65){_0x1b1ac2[_0x3253('0x47')]=_0x21da65;return _0x1b1ac2;})[_0x3253('0x26')](respondWithFilteredResult(_0x230e6f,_0x5c9b64))[_0x3253('0x48')](handleError(_0x230e6f,null));};exports[_0x3253('0x49')]=function(_0x153fc6,_0x56f06e){var _0x36c2b6={'raw':![],'where':{'id':_0x153fc6['params']['id']}},_0x3b25c2={};_0x3b25c2[_0x3253('0x31')]=_[_0x3253('0x32')](db[_0x3253('0x2e')][_0x3253('0x4a')]);_0x3b25c2[_0x3253('0x33')]=_['keys'](_0x153fc6[_0x3253('0x33')]);_0x3b25c2[_0x3253('0x34')]=_['intersection'](_0x3b25c2['model'],_0x3b25c2['query']);_0x36c2b6[_0x3253('0x35')]=_[_0x3253('0x36')](_0x3b25c2[_0x3253('0x31')],qs[_0x3253('0x37')](_0x153fc6[_0x3253('0x33')]['fields']));_0x36c2b6[_0x3253('0x35')]=_0x36c2b6[_0x3253('0x35')][_0x3253('0x38')]?_0x36c2b6['attributes']:_0x3b25c2['model'];if(_0x153fc6['query']['includeAll']){_0x36c2b6[_0x3253('0x45')]=[{'all':!![]}];}_0x36c2b6=_[_0x3253('0x40')]({},_0x36c2b6,_0x153fc6[_0x3253('0x43')]);return db[_0x3253('0x2e')][_0x3253('0x4b')](_0x36c2b6)[_0x3253('0x26')](handleEntityNotFound(_0x56f06e,null))['then'](respondWithResult(_0x56f06e,null))[_0x3253('0x48')](handleError(_0x56f06e,null));};exports[_0x3253('0x4c')]=function(_0x231562,_0x2620e1){return db[_0x3253('0x2e')][_0x3253('0x4c')](_0x231562[_0x3253('0x4d')],{})['then'](function(_0x4f1e45){var _0x556ed3=_0x231562[_0x3253('0x4e')][_0x3253('0x28')]({'plain':!![]});if(!_0x556ed3)throw new Error(_0x3253('0x4f'));if(_0x556ed3[_0x3253('0x50')]===_0x3253('0x4e')){var _0x3d4151=_0x4f1e45[_0x3253('0x28')]({'plain':!![]});var _0x465a78=_0x3253('0x51');return db[_0x3253('0x52')][_0x3253('0x4b')]({'where':{'name':_0x465a78,'userProfileId':_0x556ed3[_0x3253('0x53')]},'raw':!![]})[_0x3253('0x26')](function(_0x28aea0){if(_0x28aea0&&_0x28aea0[_0x3253('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3d4151['name'],'resourceId':_0x3d4151['id'],'type':_0x28aea0[_0x3253('0x2b')],'sectionId':_0x28aea0['id']},{})[_0x3253('0x26')](function(){return _0x4f1e45;});}else{return _0x4f1e45;}})['catch'](function(_0x2b4e53){logger[_0x3253('0x55')](_0x3253('0x56'),_0x2b4e53);throw _0x2b4e53;});}return _0x4f1e45;})[_0x3253('0x26')](respondWithResult(_0x2620e1,0xc9))['catch'](handleError(_0x2620e1,null));};exports[_0x3253('0x25')]=function(_0xf4a08b,_0x135933){if(_0xf4a08b[_0x3253('0x4d')]['id']){delete _0xf4a08b['body']['id'];}return db['SquareProject'][_0x3253('0x4b')]({'where':{'id':_0xf4a08b[_0x3253('0x57')]['id']}})[_0x3253('0x26')](handleEntityNotFound(_0x135933,null))[_0x3253('0x26')](saveUpdates(_0xf4a08b[_0x3253('0x4d')],null))[_0x3253('0x26')](respondWithResult(_0x135933,null))[_0x3253('0x48')](handleError(_0x135933,null));};exports[_0x3253('0x27')]=function(_0x24728d,_0x32ad81){return db[_0x3253('0x2e')][_0x3253('0x4b')]({'where':{'id':_0x24728d[_0x3253('0x57')]['id']}})['then'](handleEntityNotFound(_0x32ad81,null))[_0x3253('0x26')](removeEntity(_0x32ad81,null))['catch'](handleError(_0x32ad81,null));};exports['addUsers']=function(_0x1c6537,_0x4c25f4,_0x57c38d){return db[_0x3253('0x2e')]['find']({'where':{'id':_0x1c6537[_0x3253('0x57')]['id']}})[_0x3253('0x26')](handleEntityNotFound(_0x4c25f4,null))['then'](function(_0x4b28ed){if(_0x4b28ed){return _0x4b28ed[_0x3253('0x58')](_0x1c6537[_0x3253('0x4d')][_0x3253('0x59')],_[_0x3253('0x5a')](_0x1c6537[_0x3253('0x4d')],[_0x3253('0x59'),'id'])||{});}})[_0x3253('0x26')](respondWithResult(_0x4c25f4,null))[_0x3253('0x48')](handleError(_0x4c25f4,null));};exports[_0x3253('0x5b')]=function(_0x3e10a0,_0x4fa7ca,_0x3565b3){return db[_0x3253('0x2e')][_0x3253('0x4b')]({'where':{'id':_0x3e10a0[_0x3253('0x57')]['id']}})['then'](handleEntityNotFound(_0x4fa7ca,null))[_0x3253('0x26')](function(_0x5cd2ca){if(_0x5cd2ca){return _0x5cd2ca[_0x3253('0x5b')](_0x3e10a0[_0x3253('0x33')][_0x3253('0x59')])['then'](function(){if(_[_0x3253('0x5c')](_0x3e10a0[_0x3253('0x33')][_0x3253('0x59')])){for(var _0x255ebd=0x0;_0x255ebd<_0x3e10a0[_0x3253('0x33')][_0x3253('0x59')]['length'];_0x255ebd+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x3e10a0[_0x3253('0x33')]['ids'][_0x255ebd]),'SquareProjectId':Number(_0x3e10a0[_0x3253('0x57')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x3e10a0[_0x3253('0x33')][_0x3253('0x59')]),'SquareProjectId':Number(_0x3e10a0['params']['id'])});}});}})[_0x3253('0x26')](respondWithStatusCode(_0x4fa7ca,null))[_0x3253('0x48')](handleError(_0x4fa7ca,null));};exports[_0x3253('0x5d')]=function(_0x5ca7d5,_0x59cdf4,_0x1206e2){var _0x2916f5={};var _0x4163f6={};var _0x20ca4e;var _0x93436f;return db[_0x3253('0x2e')]['findOne']({'where':{'id':_0x5ca7d5[_0x3253('0x57')]['id']}})[_0x3253('0x26')](handleEntityNotFound(_0x59cdf4,null))[_0x3253('0x26')](function(_0x3bba01){if(_0x3bba01){_0x20ca4e=_0x3bba01;_0x4163f6[_0x3253('0x31')]=_[_0x3253('0x32')](db['User'][_0x3253('0x4a')]);_0x4163f6[_0x3253('0x33')]=_[_0x3253('0x32')](_0x5ca7d5['query']);_0x4163f6[_0x3253('0x34')]=_['intersection'](_0x4163f6[_0x3253('0x31')],_0x4163f6['query']);_0x2916f5[_0x3253('0x35')]=_[_0x3253('0x36')](_0x4163f6['model'],qs['fields'](_0x5ca7d5[_0x3253('0x33')][_0x3253('0x37')]));_0x2916f5['attributes']=_0x2916f5['attributes']['length']?_0x2916f5[_0x3253('0x35')]:_0x4163f6[_0x3253('0x31')];_0x2916f5[_0x3253('0x3b')]=qs[_0x3253('0x3c')](_0x5ca7d5['query']['sort']);_0x2916f5['where']=qs[_0x3253('0x34')](_[_0x3253('0x3e')](_0x5ca7d5[_0x3253('0x33')],_0x4163f6['filters']));if(_0x5ca7d5[_0x3253('0x33')][_0x3253('0x3f')]){_0x2916f5['where']=_['merge'](_0x2916f5[_0x3253('0x3d')],{'$or':_[_0x3253('0x2d')](_0x2916f5[_0x3253('0x35')],function(_0x12dac7){var _0x3e2e81={};_0x3e2e81[_0x12dac7]={'$like':'%'+_0x5ca7d5[_0x3253('0x33')]['filter']+'%'};return _0x3e2e81;})});}_0x2916f5=_['merge']({},_0x2916f5,_0x5ca7d5[_0x3253('0x43')]);return _0x20ca4e[_0x3253('0x5d')](_0x2916f5);}})['then'](function(_0x3c8db6){if(_0x3c8db6){_0x93436f=_0x3c8db6[_0x3253('0x38')];if(!_0x5ca7d5[_0x3253('0x33')][_0x3253('0x39')]('nolimit')){_0x2916f5['limit']=qs['limit'](_0x5ca7d5[_0x3253('0x33')][_0x3253('0x20')]);_0x2916f5[_0x3253('0x1f')]=qs[_0x3253('0x1f')](_0x5ca7d5[_0x3253('0x33')][_0x3253('0x1f')]);}return _0x20ca4e[_0x3253('0x5d')](_0x2916f5);}})[_0x3253('0x26')](function(_0x355b57){if(_0x355b57){return _0x355b57?{'count':_0x93436f,'rows':_0x355b57}:null;}})[_0x3253('0x26')](respondWithResult(_0x59cdf4,null))[_0x3253('0x48')](handleError(_0x59cdf4,null));}; \ No newline at end of file +var _0x815d=['offset','limit','set','apply','reject','save','update','then','get','SquareProjects','error','stack','name','send','map','SquareProject','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','findOne','getUsers','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./squareProject.socket','register','sendStatus','end','status','json','count'];(function(_0x4fa916,_0x3ec36a){var _0x576439=function(_0x5692e0){while(--_0x5692e0){_0x4fa916['push'](_0x4fa916['shift']());}};_0x576439(++_0x3ec36a);}(_0x815d,0x15b));var _0xd815=function(_0x49b33e,_0xef5e0a){_0x49b33e=_0x49b33e-0x0;var _0x3128a2=_0x815d[_0x49b33e];return _0x3128a2;};'use strict';var pdf=require(_0xd815('0x0'));var emlformat=require(_0xd815('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd815('0x2'));var jsonpatch=require(_0xd815('0x3'));var rp=require('request-promise');var moment=require(_0xd815('0x4'));var BPromise=require(_0xd815('0x5'));var Mustache=require(_0xd815('0x6'));var util=require('util');var path=require(_0xd815('0x7'));var sox=require(_0xd815('0x8'));var csv=require(_0xd815('0x9'));var ejs=require(_0xd815('0xa'));var fs=require('fs');var _=require(_0xd815('0xb'));var squel=require(_0xd815('0xc'));var crypto=require(_0xd815('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd815('0x9'));var querystring=require(_0xd815('0xe'));var Papa=require(_0xd815('0xf'));var Redis=require(_0xd815('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd815('0x11'));var as=require(_0xd815('0x12'));var hardwareService=require(_0xd815('0x13'));var logger=require(_0xd815('0x14'))(_0xd815('0x15'));var utils=require(_0xd815('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd815('0x17'));var db=require('../../mysqldb')['db'];config[_0xd815('0x18')]=_['defaults'](config[_0xd815('0x18')],{'host':_0xd815('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd815('0x18')]));require(_0xd815('0x1a'))[_0xd815('0x1b')](socket);function respondWithStatusCode(_0x2db3e8,_0x5ef3ec){_0x5ef3ec=_0x5ef3ec||0xcc;return function(_0x23d002){if(_0x23d002){return _0x2db3e8[_0xd815('0x1c')](_0x5ef3ec);}return _0x2db3e8['status'](_0x5ef3ec)[_0xd815('0x1d')]();};}function respondWithResult(_0x4dd573,_0x229a8b){_0x229a8b=_0x229a8b||0xc8;return function(_0x3a85a2){if(_0x3a85a2){return _0x4dd573[_0xd815('0x1e')](_0x229a8b)[_0xd815('0x1f')](_0x3a85a2);}};}function respondWithFilteredResult(_0x53ac1e,_0x3dbb7e){return function(_0x112a7e){if(_0x112a7e){var _0x2da423=_0x112a7e[_0xd815('0x20')],_0x51887e=_0x3dbb7e[_0xd815('0x21')],_0x47c7ea=_0x3dbb7e[_0xd815('0x21')]+_0x3dbb7e[_0xd815('0x22')],_0x4f2e5d;if(_0x47c7ea>=_0x2da423){_0x47c7ea=_0x2da423;_0x4f2e5d=0xc8;}else{_0x4f2e5d=0xce;}_0x53ac1e['status'](_0x4f2e5d);return _0x53ac1e[_0xd815('0x23')]('Content-Range',_0x51887e+'-'+_0x47c7ea+'/'+_0x2da423)[_0xd815('0x1f')](_0x112a7e);}return null;};}function patchUpdates(_0x3f607c){return function(_0x32210a){try{jsonpatch[_0xd815('0x24')](_0x32210a,_0x3f607c,!![]);}catch(_0x3d680d){return BPromise[_0xd815('0x25')](_0x3d680d);}return _0x32210a[_0xd815('0x26')]();};}function saveUpdates(_0x249527,_0x37b786){return function(_0x412cbf){if(_0x412cbf){return _0x412cbf[_0xd815('0x27')](_0x249527)[_0xd815('0x28')](function(_0x4a1eda){return _0x4a1eda;});}return null;};}function removeEntity(_0x27b22f,_0x2f08ac){return function(_0x2ca859){if(_0x2ca859){return _0x2ca859['destroy']()['then'](function(){var _0x41a11a=_0x2ca859[_0xd815('0x29')]({'plain':!![]});var _0x2f4054=_0xd815('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f4054,'resourceId':_0x41a11a['id']}})[_0xd815('0x28')](function(){return _0x2ca859;});})[_0xd815('0x28')](function(){_0x27b22f[_0xd815('0x1e')](0xcc)[_0xd815('0x1d')]();});}};}function handleEntityNotFound(_0x1dd71f,_0x421e59){return function(_0xe6607a){if(!_0xe6607a){_0x1dd71f[_0xd815('0x1c')](0x194);}return _0xe6607a;};}function handleError(_0x23047f,_0x1948a2){_0x1948a2=_0x1948a2||0x1f4;return function(_0xa799bd){logger[_0xd815('0x2b')](_0xa799bd[_0xd815('0x2c')]);if(_0xa799bd[_0xd815('0x2d')]){delete _0xa799bd[_0xd815('0x2d')];}_0x23047f[_0xd815('0x1e')](_0x1948a2)[_0xd815('0x2e')](_0xa799bd);};}exports['index']=function(_0x3c6ca9,_0x3cc525){var _0x530a9a={},_0x406745={},_0x535557={'count':0x0,'rows':[]};var _0x17b682=_[_0xd815('0x2f')](db[_0xd815('0x30')][_0xd815('0x31')],function(_0x298681){return{'name':_0x298681['fieldName'],'type':_0x298681[_0xd815('0x32')][_0xd815('0x33')]};});_0x406745[_0xd815('0x34')]=_['map'](_0x17b682,_0xd815('0x2d'));_0x406745['query']=_[_0xd815('0x35')](_0x3c6ca9[_0xd815('0x36')]);_0x406745[_0xd815('0x37')]=_[_0xd815('0x38')](_0x406745['model'],_0x406745['query']);_0x530a9a[_0xd815('0x39')]=_[_0xd815('0x38')](_0x406745['model'],qs['fields'](_0x3c6ca9[_0xd815('0x36')][_0xd815('0x3a')]));_0x530a9a[_0xd815('0x39')]=_0x530a9a[_0xd815('0x39')][_0xd815('0x3b')]?_0x530a9a[_0xd815('0x39')]:_0x406745[_0xd815('0x34')];if(!_0x3c6ca9[_0xd815('0x36')][_0xd815('0x3c')](_0xd815('0x3d'))){_0x530a9a[_0xd815('0x22')]=qs[_0xd815('0x22')](_0x3c6ca9[_0xd815('0x36')]['limit']);_0x530a9a[_0xd815('0x21')]=qs[_0xd815('0x21')](_0x3c6ca9[_0xd815('0x36')][_0xd815('0x21')]);}_0x530a9a[_0xd815('0x3e')]=qs[_0xd815('0x3f')](_0x3c6ca9[_0xd815('0x36')][_0xd815('0x3f')]);_0x530a9a[_0xd815('0x40')]=qs[_0xd815('0x37')](_[_0xd815('0x41')](_0x3c6ca9[_0xd815('0x36')],_0x406745[_0xd815('0x37')]),_0x17b682);if(_0x3c6ca9[_0xd815('0x36')]['filter']){_0x530a9a[_0xd815('0x40')]=_[_0xd815('0x42')](_0x530a9a[_0xd815('0x40')],{'$or':_['map'](_0x17b682,function(_0x11bfb0){if(_0x11bfb0[_0xd815('0x32')]!==_0xd815('0x43')){var _0x2ab2db={};_0x2ab2db[_0x11bfb0[_0xd815('0x2d')]]={'$like':'%'+_0x3c6ca9['query'][_0xd815('0x44')]+'%'};return _0x2ab2db;}})});}_0x530a9a=_[_0xd815('0x42')]({},_0x530a9a,_0x3c6ca9[_0xd815('0x45')]);var _0x5cb213={'where':_0x530a9a[_0xd815('0x40')]};return db[_0xd815('0x30')][_0xd815('0x20')](_0x5cb213)[_0xd815('0x28')](function(_0x27e055){_0x535557[_0xd815('0x20')]=_0x27e055;if(_0x3c6ca9[_0xd815('0x36')][_0xd815('0x46')]){_0x530a9a[_0xd815('0x47')]=[{'all':!![]}];}return db['SquareProject'][_0xd815('0x48')](_0x530a9a);})['then'](function(_0x34a14f){_0x535557[_0xd815('0x49')]=_0x34a14f;return _0x535557;})['then'](respondWithFilteredResult(_0x3cc525,_0x530a9a))['catch'](handleError(_0x3cc525,null));};exports['show']=function(_0x18501c,_0x39cf56){var _0x40d004={'raw':![],'where':{'id':_0x18501c['params']['id']}},_0x32238a={};_0x32238a[_0xd815('0x34')]=_[_0xd815('0x35')](db[_0xd815('0x30')][_0xd815('0x31')]);_0x32238a['query']=_[_0xd815('0x35')](_0x18501c[_0xd815('0x36')]);_0x32238a[_0xd815('0x37')]=_[_0xd815('0x38')](_0x32238a[_0xd815('0x34')],_0x32238a[_0xd815('0x36')]);_0x40d004['attributes']=_[_0xd815('0x38')](_0x32238a[_0xd815('0x34')],qs[_0xd815('0x3a')](_0x18501c['query'][_0xd815('0x3a')]));_0x40d004[_0xd815('0x39')]=_0x40d004[_0xd815('0x39')][_0xd815('0x3b')]?_0x40d004[_0xd815('0x39')]:_0x32238a[_0xd815('0x34')];if(_0x18501c[_0xd815('0x36')][_0xd815('0x46')]){_0x40d004['include']=[{'all':!![]}];}_0x40d004=_[_0xd815('0x42')]({},_0x40d004,_0x18501c[_0xd815('0x45')]);return db[_0xd815('0x30')]['find'](_0x40d004)['then'](handleEntityNotFound(_0x39cf56,null))[_0xd815('0x28')](respondWithResult(_0x39cf56,null))[_0xd815('0x4a')](handleError(_0x39cf56,null));};exports[_0xd815('0x4b')]=function(_0x3e3fbc,_0x260053){return db['SquareProject'][_0xd815('0x4b')](_0x3e3fbc['body'],{})[_0xd815('0x28')](function(_0x28dd6d){var _0x2c5a8a=_0x3e3fbc[_0xd815('0x4c')][_0xd815('0x29')]({'plain':!![]});if(!_0x2c5a8a)throw new Error(_0xd815('0x4d'));if(_0x2c5a8a[_0xd815('0x4e')]==='user'){var _0x228c93=_0x28dd6d[_0xd815('0x29')]({'plain':!![]});var _0x1dc393=_0xd815('0x2a');return db[_0xd815('0x4f')][_0xd815('0x50')]({'where':{'name':_0x1dc393,'userProfileId':_0x2c5a8a['userProfileId']},'raw':!![]})[_0xd815('0x28')](function(_0x3c0807){if(_0x3c0807&&_0x3c0807[_0xd815('0x51')]===0x0){return db[_0xd815('0x52')][_0xd815('0x4b')]({'name':_0x228c93['name'],'resourceId':_0x228c93['id'],'type':_0x3c0807[_0xd815('0x2d')],'sectionId':_0x3c0807['id']},{})[_0xd815('0x28')](function(){return _0x28dd6d;});}else{return _0x28dd6d;}})['catch'](function(_0x31145e){logger[_0xd815('0x2b')](_0xd815('0x53'),_0x31145e);throw _0x31145e;});}return _0x28dd6d;})[_0xd815('0x28')](respondWithResult(_0x260053,0xc9))['catch'](handleError(_0x260053,null));};exports[_0xd815('0x27')]=function(_0x509db4,_0x3c438c){if(_0x509db4[_0xd815('0x54')]['id']){delete _0x509db4[_0xd815('0x54')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x509db4[_0xd815('0x55')]['id']}})[_0xd815('0x28')](handleEntityNotFound(_0x3c438c,null))[_0xd815('0x28')](saveUpdates(_0x509db4[_0xd815('0x54')],null))[_0xd815('0x28')](respondWithResult(_0x3c438c,null))['catch'](handleError(_0x3c438c,null));};exports[_0xd815('0x56')]=function(_0x160762,_0x3dbef6){return db['SquareProject']['find']({'where':{'id':_0x160762[_0xd815('0x55')]['id']}})['then'](handleEntityNotFound(_0x3dbef6,null))[_0xd815('0x28')](removeEntity(_0x3dbef6,null))['catch'](handleError(_0x3dbef6,null));};exports[_0xd815('0x57')]=function(_0x595124,_0x57964e,_0x5c0259){return db[_0xd815('0x30')][_0xd815('0x50')]({'where':{'id':_0x595124[_0xd815('0x55')]['id']}})['then'](handleEntityNotFound(_0x57964e,null))[_0xd815('0x28')](function(_0x347aa8){if(_0x347aa8){return _0x347aa8[_0xd815('0x57')](_0x595124[_0xd815('0x54')][_0xd815('0x58')],_[_0xd815('0x59')](_0x595124[_0xd815('0x54')],[_0xd815('0x58'),'id'])||{});}})['then'](respondWithResult(_0x57964e,null))['catch'](handleError(_0x57964e,null));};exports[_0xd815('0x5a')]=function(_0x489aa2,_0x990b70,_0x5e7f44){return db['SquareProject'][_0xd815('0x50')]({'where':{'id':_0x489aa2['params']['id']}})[_0xd815('0x28')](handleEntityNotFound(_0x990b70,null))[_0xd815('0x28')](function(_0x47c643){if(_0x47c643){return _0x47c643[_0xd815('0x5a')](_0x489aa2[_0xd815('0x36')][_0xd815('0x58')])[_0xd815('0x28')](function(){if(_[_0xd815('0x5b')](_0x489aa2[_0xd815('0x36')][_0xd815('0x58')])){for(var _0x3dd9ac=0x0;_0x3dd9ac<_0x489aa2[_0xd815('0x36')]['ids'][_0xd815('0x3b')];_0x3dd9ac+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x489aa2['query'][_0xd815('0x58')][_0x3dd9ac]),'SquareProjectId':Number(_0x489aa2[_0xd815('0x55')]['id'])});}}else{socket['emit'](_0xd815('0x5c'),{'UserId':Number(_0x489aa2[_0xd815('0x36')][_0xd815('0x58')]),'SquareProjectId':Number(_0x489aa2[_0xd815('0x55')]['id'])});}});}})[_0xd815('0x28')](respondWithStatusCode(_0x990b70,null))['catch'](handleError(_0x990b70,null));};exports['getUsers']=function(_0x5812f4,_0xe39a02,_0x528812){var _0xb735b4={};var _0x3365e2={};var _0x1105b8;var _0x124f87;return db['SquareProject'][_0xd815('0x5d')]({'where':{'id':_0x5812f4[_0xd815('0x55')]['id']}})[_0xd815('0x28')](handleEntityNotFound(_0xe39a02,null))[_0xd815('0x28')](function(_0x22ff48){if(_0x22ff48){_0x1105b8=_0x22ff48;_0x3365e2[_0xd815('0x34')]=_[_0xd815('0x35')](db['User'][_0xd815('0x31')]);_0x3365e2[_0xd815('0x36')]=_['keys'](_0x5812f4['query']);_0x3365e2[_0xd815('0x37')]=_[_0xd815('0x38')](_0x3365e2[_0xd815('0x34')],_0x3365e2['query']);_0xb735b4[_0xd815('0x39')]=_[_0xd815('0x38')](_0x3365e2[_0xd815('0x34')],qs[_0xd815('0x3a')](_0x5812f4['query'][_0xd815('0x3a')]));_0xb735b4[_0xd815('0x39')]=_0xb735b4[_0xd815('0x39')][_0xd815('0x3b')]?_0xb735b4[_0xd815('0x39')]:_0x3365e2[_0xd815('0x34')];_0xb735b4[_0xd815('0x3e')]=qs[_0xd815('0x3f')](_0x5812f4['query'][_0xd815('0x3f')]);_0xb735b4[_0xd815('0x40')]=qs[_0xd815('0x37')](_[_0xd815('0x41')](_0x5812f4[_0xd815('0x36')],_0x3365e2['filters']));if(_0x5812f4['query'][_0xd815('0x44')]){_0xb735b4[_0xd815('0x40')]=_['merge'](_0xb735b4[_0xd815('0x40')],{'$or':_[_0xd815('0x2f')](_0xb735b4[_0xd815('0x39')],function(_0x2054f9){var _0x17d925={};_0x17d925[_0x2054f9]={'$like':'%'+_0x5812f4[_0xd815('0x36')][_0xd815('0x44')]+'%'};return _0x17d925;})});}_0xb735b4=_[_0xd815('0x42')]({},_0xb735b4,_0x5812f4[_0xd815('0x45')]);return _0x1105b8['getUsers'](_0xb735b4);}})[_0xd815('0x28')](function(_0x3a9cb7){if(_0x3a9cb7){_0x124f87=_0x3a9cb7[_0xd815('0x3b')];if(!_0x5812f4[_0xd815('0x36')][_0xd815('0x3c')](_0xd815('0x3d'))){_0xb735b4['limit']=qs['limit'](_0x5812f4['query'][_0xd815('0x22')]);_0xb735b4[_0xd815('0x21')]=qs[_0xd815('0x21')](_0x5812f4[_0xd815('0x36')][_0xd815('0x21')]);}return _0x1105b8[_0xd815('0x5e')](_0xb735b4);}})[_0xd815('0x28')](function(_0x286980){if(_0x286980){return _0x286980?{'count':_0x124f87,'rows':_0x286980}:null;}})[_0xd815('0x28')](respondWithResult(_0xe39a02,null))[_0xd815('0x4a')](handleError(_0xe39a02,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b5acc4e..7a7d866 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 _0xfaa1=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xfaa1,0x110));var _0x1faa=function(_0x136bef,_0x2e75ec){_0x136bef=_0x136bef-0x0;var _0x4bf9a3=_0xfaa1[_0x136bef];return _0x4bf9a3;};'use strict';var EventEmitter=require(_0x1faa('0x0'));var SquareProject=require(_0x1faa('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1faa('0x2')](0x0);var events={'afterCreate':_0x1faa('0x3'),'afterUpdate':'update','afterDestroy':_0x1faa('0x4')};function emitEvent(_0xc2c684){return function(_0x515059,_0x4dbf57,_0x401fd4){SquareProjectEvents[_0x1faa('0x5')](_0xc2c684+':'+_0x515059['id'],_0x515059);SquareProjectEvents[_0x1faa('0x5')](_0xc2c684,_0x515059);_0x401fd4(null);};}for(var e in events){if(events[_0x1faa('0x6')](e)){var event=events[e];SquareProject[_0x1faa('0x7')](e,emitEvent(event));}}module[_0x1faa('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x920e=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x12c76c,_0x41429f){var _0x1b0133=function(_0x5c5742){while(--_0x5c5742){_0x12c76c['push'](_0x12c76c['shift']());}};_0x1b0133(++_0x41429f);}(_0x920e,0xc7));var _0xe920=function(_0x253fb5,_0x276d6f){_0x253fb5=_0x253fb5-0x0;var _0x5daf17=_0x920e[_0x253fb5];return _0x5daf17;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xe920('0x0'))['db'][_0xe920('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe920('0x2')](0x0);var events={'afterCreate':_0xe920('0x3'),'afterUpdate':_0xe920('0x4'),'afterDestroy':_0xe920('0x5')};function emitEvent(_0x2535dd){return function(_0xda2e29,_0x579748,_0x2788f9){SquareProjectEvents[_0xe920('0x6')](_0x2535dd+':'+_0xda2e29['id'],_0xda2e29);SquareProjectEvents['emit'](_0x2535dd,_0xda2e29);_0x2788f9(null);};}for(var e in events){if(events[_0xe920('0x7')](e)){var event=events[e];SquareProject[_0xe920('0x8')](e,emitEvent(event));}}module[_0xe920('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index c7bf82a..c7048ea 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 _0x5fd1=['preproduction','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','SquareProject'];(function(_0x1b6325,_0x1e53ce){var _0x5c8786=function(_0x5abb44){while(--_0x5abb44){_0x1b6325['push'](_0x1b6325['shift']());}};_0x5c8786(++_0x1e53ce);}(_0x5fd1,0x155));var _0x15fd=function(_0xba7507,_0x336146){_0xba7507=_0xba7507-0x0;var _0x2faa5a=_0x5fd1[_0xba7507];return _0x2faa5a;};'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('./squareProject.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x210e90,_0x1ee117,_0x19806f){if(_0x210e90['changed'](_0x15fd('0xa'))){_0x210e90['savedAt']=moment()[_0x15fd('0xb')](_0x15fd('0xc'));}if(_0x210e90['changed']('production')){_0x210e90['publishedAt']=moment()[_0x15fd('0xb')](_0x15fd('0xc'));}_0x19806f(null,_0x210e90);}}});}; \ No newline at end of file +var _0xd0bb=['request-promise','path','../../config/environment','exports','define','SquareProject','changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','lodash','util','../../config/logger','moment'];(function(_0x5b409a,_0x229314){var _0xed0114=function(_0x130c5b){while(--_0x130c5b){_0x5b409a['push'](_0x5b409a['shift']());}};_0xed0114(++_0x229314);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x13117b,_0x3449eb){_0x13117b=_0x13117b-0x0;var _0x418124=_0xd0bb[_0x13117b];return _0x418124;};'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('./squareProject.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a4075,_0x4533ff,_0x39c099){if(_0x2a4075[_0xbd0b('0xa')](_0xbd0b('0xb'))){_0x2a4075['savedAt']=moment()['format'](_0xbd0b('0xc'));}if(_0x2a4075[_0xbd0b('0xa')]('production')){_0x2a4075[_0xbd0b('0xd')]=moment()[_0xbd0b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x39c099(null,_0x2a4075);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1844b05..f4aedaf 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 _0xc74e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareProject,\x20%s,\x20%s','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','util'];(function(_0x456b63,_0x129688){var _0x1c37e1=function(_0x15cd06){while(--_0x15cd06){_0x456b63['push'](_0x456b63['shift']());}};_0x1c37e1(++_0x129688);}(_0xc74e,0x1ec));var _0xec74=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc74e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xec74('0x0'));var util=require(_0xec74('0x1'));var moment=require(_0xec74('0x2'));var BPromise=require(_0xec74('0x3'));var rs=require(_0xec74('0x4'));var fs=require('fs');var Redis=require(_0xec74('0x5'));var db=require(_0xec74('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xec74('0x7'))(_0xec74('0x8'));var config=require(_0xec74('0x9'));var jayson=require(_0xec74('0xa'));var client=jayson[_0xec74('0xb')][_0xec74('0xc')]({'port':0x232a});config[_0xec74('0xd')]=_[_0xec74('0xe')](config[_0xec74('0xd')],{'host':_0xec74('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')[_0xec74('0x10')](socket);function respondWithRpcPromise(_0x280d64,_0x1f140d,_0x4bc389){return new BPromise(function(_0x57ca6d,_0xe56805){return client[_0xec74('0x11')](_0x280d64,_0x4bc389)[_0xec74('0x12')](function(_0x12b80c){logger[_0xec74('0x13')]('SquareProject,\x20%s,\x20%s',_0x1f140d,'request\x20sent');logger[_0xec74('0x14')](_0xec74('0x15'),_0x1f140d,_0xec74('0x16'),JSON[_0xec74('0x17')](_0x12b80c));if(_0x12b80c[_0xec74('0x18')]){if(_0x12b80c[_0xec74('0x18')]['code']===0x1f4){logger[_0xec74('0x18')](_0xec74('0x19'),_0x1f140d,_0x12b80c[_0xec74('0x18')][_0xec74('0x1a')]);return _0xe56805(_0x12b80c[_0xec74('0x18')][_0xec74('0x1a')]);}logger[_0xec74('0x18')](_0xec74('0x19'),_0x1f140d,_0x12b80c[_0xec74('0x18')]['message']);return _0x57ca6d(_0x12b80c[_0xec74('0x18')][_0xec74('0x1a')]);}else{logger[_0xec74('0x13')](_0xec74('0x19'),_0x1f140d,_0xec74('0x16'));_0x57ca6d(_0x12b80c['result'][_0xec74('0x1a')]);}})[_0xec74('0x1b')](function(_0x337f6f){logger[_0xec74('0x18')](_0xec74('0x19'),_0x1f140d,_0x337f6f);_0xe56805(_0x337f6f);});});}exports[_0xec74('0x1c')]=function(_0xd76dae){var _0xd7b7f9=this;return new Promise(function(_0x1a3ecf,_0xf3661c){return db[_0xec74('0x1d')][_0xec74('0x1e')]({'raw':_0xd76dae[_0xec74('0x1f')]?_0xd76dae['options'][_0xec74('0x20')]===undefined?!![]:![]:!![],'where':_0xd76dae['options']?_0xd76dae[_0xec74('0x1f')][_0xec74('0x21')]||null:null,'attributes':_0xd76dae[_0xec74('0x1f')]?_0xd76dae[_0xec74('0x1f')][_0xec74('0x22')]||null:null,'include':_0xd76dae[_0xec74('0x1f')]?_0xd76dae[_0xec74('0x1f')][_0xec74('0x23')]?_[_0xec74('0x24')](_0xd76dae[_0xec74('0x1f')]['include'],function(_0x52caf7){return{'model':db[_0x52caf7[_0xec74('0x25')]],'as':_0x52caf7['as'],'attributes':_0x52caf7[_0xec74('0x22')],'include':_0x52caf7[_0xec74('0x23')]?_[_0xec74('0x24')](_0x52caf7[_0xec74('0x23')],function(_0x2f500e){return{'model':db[_0x2f500e[_0xec74('0x25')]],'as':_0x2f500e['as'],'attributes':_0x2f500e['attributes'],'include':_0x2f500e['include']?_[_0xec74('0x24')](_0x2f500e[_0xec74('0x23')],function(_0x243f29){return{'model':db[_0x243f29[_0xec74('0x25')]],'as':_0x243f29['as'],'attributes':_0x243f29[_0xec74('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46513a){logger[_0xec74('0x13')](_0xec74('0x1c'),_0xd76dae);logger[_0xec74('0x14')](_0xec74('0x1c'),_0xd76dae,JSON['stringify'](_0x46513a));_0x1a3ecf(_0x46513a);})['catch'](function(_0x2c8243){logger[_0xec74('0x18')]('ShowSquareProject',_0x2c8243[_0xec74('0x1a')],_0xd76dae);_0xf3661c(_0xd7b7f9['error'](0x1f4,_0x2c8243[_0xec74('0x1a')]));});});}; \ No newline at end of file +var _0xf69c=['rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSquareProject','SquareProject','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x117966,_0x580ae6){var _0x1f25ee=function(_0x4ae8ba){while(--_0x4ae8ba){_0x117966['push'](_0x117966['shift']());}};_0x1f25ee(++_0x580ae6);}(_0xf69c,0x128));var _0xcf69=function(_0x535e1e,_0x2b3930){_0x535e1e=_0x535e1e-0x0;var _0x5161d2=_0xf69c[_0x535e1e];return _0x5161d2;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var moment=require(_0xcf69('0x2'));var BPromise=require(_0xcf69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf69('0x4'));var db=require(_0xcf69('0x5'))['db'];var utils=require(_0xcf69('0x6'));var logger=require(_0xcf69('0x7'))(_0xcf69('0x8'));var config=require(_0xcf69('0x9'));var jayson=require(_0xcf69('0xa'));var client=jayson[_0xcf69('0xb')]['http']({'port':0x232a});config[_0xcf69('0xc')]=_['defaults'](config[_0xcf69('0xc')],{'host':_0xcf69('0xd'),'port':0x18eb});var socket=require(_0xcf69('0xe'))(new Redis(config[_0xcf69('0xc')]));require(_0xcf69('0xf'))[_0xcf69('0x10')](socket);function respondWithRpcPromise(_0x553454,_0x53c247,_0x28b265){return new BPromise(function(_0x1c7119,_0xdf90f3){return client[_0xcf69('0x11')](_0x553454,_0x28b265)[_0xcf69('0x12')](function(_0x1c2569){logger[_0xcf69('0x13')](_0xcf69('0x14'),_0x53c247,_0xcf69('0x15'));logger[_0xcf69('0x16')](_0xcf69('0x17'),_0x53c247,_0xcf69('0x15'),JSON[_0xcf69('0x18')](_0x1c2569));if(_0x1c2569[_0xcf69('0x19')]){if(_0x1c2569['error']['code']===0x1f4){logger[_0xcf69('0x19')](_0xcf69('0x14'),_0x53c247,_0x1c2569[_0xcf69('0x19')][_0xcf69('0x1a')]);return _0xdf90f3(_0x1c2569['error']['message']);}logger[_0xcf69('0x19')](_0xcf69('0x14'),_0x53c247,_0x1c2569[_0xcf69('0x19')][_0xcf69('0x1a')]);return _0x1c7119(_0x1c2569[_0xcf69('0x19')][_0xcf69('0x1a')]);}else{logger['info'](_0xcf69('0x14'),_0x53c247,_0xcf69('0x15'));_0x1c7119(_0x1c2569['result']['message']);}})[_0xcf69('0x1b')](function(_0x3bdbf4){logger[_0xcf69('0x19')](_0xcf69('0x14'),_0x53c247,_0x3bdbf4);_0xdf90f3(_0x3bdbf4);});});}exports[_0xcf69('0x1c')]=function(_0x2fa91d){var _0x59ea7a=this;return new Promise(function(_0x18295b,_0x1dab53){return db[_0xcf69('0x1d')][_0xcf69('0x1e')]({'raw':_0x2fa91d['options']?_0x2fa91d['options'][_0xcf69('0x1f')]===undefined?!![]:![]:!![],'where':_0x2fa91d[_0xcf69('0x20')]?_0x2fa91d['options'][_0xcf69('0x21')]||null:null,'attributes':_0x2fa91d['options']?_0x2fa91d[_0xcf69('0x20')][_0xcf69('0x22')]||null:null,'include':_0x2fa91d[_0xcf69('0x20')]?_0x2fa91d[_0xcf69('0x20')]['include']?_['map'](_0x2fa91d[_0xcf69('0x20')][_0xcf69('0x23')],function(_0x5c1a69){return{'model':db[_0x5c1a69['model']],'as':_0x5c1a69['as'],'attributes':_0x5c1a69[_0xcf69('0x22')],'include':_0x5c1a69[_0xcf69('0x23')]?_[_0xcf69('0x24')](_0x5c1a69[_0xcf69('0x23')],function(_0x1e0b80){return{'model':db[_0x1e0b80[_0xcf69('0x25')]],'as':_0x1e0b80['as'],'attributes':_0x1e0b80[_0xcf69('0x22')],'include':_0x1e0b80[_0xcf69('0x23')]?_[_0xcf69('0x24')](_0x1e0b80[_0xcf69('0x23')],function(_0x394443){return{'model':db[_0x394443['model']],'as':_0x394443['as'],'attributes':_0x394443['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf69('0x12')](function(_0x59c9c0){logger[_0xcf69('0x13')](_0xcf69('0x1c'),_0x2fa91d);logger[_0xcf69('0x16')](_0xcf69('0x1c'),_0x2fa91d,JSON[_0xcf69('0x18')](_0x59c9c0));_0x18295b(_0x59c9c0);})[_0xcf69('0x1b')](function(_0x3db3c1){logger[_0xcf69('0x19')](_0xcf69('0x1c'),_0x3db3c1[_0xcf69('0x1a')],_0x2fa91d);_0x1dab53(_0x59ea7a[_0xcf69('0x19')](0x1f4,_0x3db3c1[_0xcf69('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 47ed480..5e0791f 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 _0xc6ac=['removeListener','register','length','./squareProject.events','save','remove','update','emit'];(function(_0x3d3c6c,_0x14a056){var _0x56e147=function(_0x23de60){while(--_0x23de60){_0x3d3c6c['push'](_0x3d3c6c['shift']());}};_0x56e147(++_0x14a056);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x742173,_0xa73155){_0x742173=_0x742173-0x0;var _0x37d72e=_0xc6ac[_0x742173];return _0x37d72e;};'use strict';var SquareProjectEvents=require(_0xcc6a('0x0'));var events=[_0xcc6a('0x1'),_0xcc6a('0x2'),_0xcc6a('0x3')];function createListener(_0x276972,_0x279d85){return function(_0x17d786){_0x279d85[_0xcc6a('0x4')](_0x276972,_0x17d786);};}function removeListener(_0x297643,_0x22ee99){return function(){SquareProjectEvents[_0xcc6a('0x5')](_0x297643,_0x22ee99);};}exports[_0xcc6a('0x6')]=function(_0x12330e){for(var _0x197bd7=0x0,_0x5f3887=events[_0xcc6a('0x7')];_0x197bd7<_0x5f3887;_0x197bd7++){var _0x11b919=events[_0x197bd7];var _0xf02261=createListener('squareProject:'+_0x11b919,_0x12330e);SquareProjectEvents['on'](_0x11b919,_0xf02261);}}; \ No newline at end of file +var _0xbd51=['removeListener','register','length','squareProject:','./squareProject.events','remove','update'];(function(_0x5f329d,_0x50303a){var _0x268c5d=function(_0x15f828){while(--_0x15f828){_0x5f329d['push'](_0x5f329d['shift']());}};_0x268c5d(++_0x50303a);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x7d328b,_0x4fa79d){_0x7d328b=_0x7d328b-0x0;var _0x399f40=_0xbd51[_0x7d328b];return _0x399f40;};'use strict';var SquareProjectEvents=require(_0x1bd5('0x0'));var events=['save',_0x1bd5('0x1'),_0x1bd5('0x2')];function createListener(_0x3b9f71,_0x1a9dcc){return function(_0x545aac){_0x1a9dcc['emit'](_0x3b9f71,_0x545aac);};}function removeListener(_0x58af16,_0x531028){return function(){SquareProjectEvents[_0x1bd5('0x3')](_0x58af16,_0x531028);};}exports[_0x1bd5('0x4')]=function(_0x43e6b6){for(var _0x59ddfb=0x0,_0x29abea=events[_0x1bd5('0x5')];_0x59ddfb<_0x29abea;_0x59ddfb++){var _0x19077c=events[_0x59ddfb];var _0x27d58f=createListener(_0x1bd5('0x6')+_0x19077c,_0x43e6b6);SquareProjectEvents['on'](_0x19077c,_0x27d58f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 446a3c1..a7d8e97 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 _0x7d01=['put','/:id','delete','/:id/delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','isAuthenticated','index','get','/:id/download','download','post','create'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0x7d01,0x195));var _0x17d0=function(_0x58fa81,_0x564873){_0x58fa81=_0x58fa81-0x0;var _0x1356f4=_0x7d01[_0x58fa81];return _0x1356f4;};'use strict';var multer=require(_0x17d0('0x0'));var util=require(_0x17d0('0x1'));var path=require(_0x17d0('0x2'));var timeout=require(_0x17d0('0x3'));var express=require(_0x17d0('0x4'));var router=express[_0x17d0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x17d0('0x6'));var controller=require(_0x17d0('0x7'));router['get']('/',auth[_0x17d0('0x8')](),controller[_0x17d0('0x9')]);router[_0x17d0('0xa')]('/:id',auth[_0x17d0('0x8')](),controller['show']);router[_0x17d0('0xa')](_0x17d0('0xb'),auth[_0x17d0('0x8')](),controller[_0x17d0('0xc')]);router[_0x17d0('0xd')]('/',auth[_0x17d0('0x8')](),controller[_0x17d0('0xe')]);router[_0x17d0('0xf')](_0x17d0('0x10'),auth[_0x17d0('0x8')](),controller['update']);router[_0x17d0('0x11')](_0x17d0('0x12'),auth[_0x17d0('0x8')](),controller['destroy']);module[_0x17d0('0x13')]=router; \ No newline at end of file +var _0xdf9e=['/:id','show','/:id/download','download','post','create','put','delete','/:id/delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x309458,_0xba6e63){var _0x3306ee=function(_0x47e10c){while(--_0x47e10c){_0x309458['push'](_0x309458['shift']());}};_0x3306ee(++_0xba6e63);}(_0xdf9e,0x129));var _0xedf9=function(_0x1266d8,_0x294e98){_0x1266d8=_0x1266d8-0x0;var _0x14e0f2=_0xdf9e[_0x1266d8];return _0x14e0f2;};'use strict';var multer=require('multer');var util=require(_0xedf9('0x0'));var path=require(_0xedf9('0x1'));var timeout=require(_0xedf9('0x2'));var express=require(_0xedf9('0x3'));var router=express[_0xedf9('0x4')]();var auth=require(_0xedf9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xedf9('0x6'));var controller=require(_0xedf9('0x7'));router[_0xedf9('0x8')]('/',auth[_0xedf9('0x9')](),controller[_0xedf9('0xa')]);router['get'](_0xedf9('0xb'),auth[_0xedf9('0x9')](),controller[_0xedf9('0xc')]);router['get'](_0xedf9('0xd'),auth[_0xedf9('0x9')](),controller[_0xedf9('0xe')]);router[_0xedf9('0xf')]('/',auth[_0xedf9('0x9')](),controller[_0xedf9('0x10')]);router[_0xedf9('0x11')](_0xedf9('0xb'),auth[_0xedf9('0x9')](),controller['update']);router[_0xedf9('0x12')](_0xedf9('0x13'),auth[_0xedf9('0x9')](),controller[_0xedf9('0x14')]);module[_0xedf9('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 25324ad..2e41f3e 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 _0x391e=['savePath','substring','lastIndexOf','exports','STRING'];(function(_0x5e2862,_0x4760eb){var _0x8dcad4=function(_0x205ddf){while(--_0x205ddf){_0x5e2862['push'](_0x5e2862['shift']());}};_0x8dcad4(++_0x4760eb);}(_0x391e,0x1cf));var _0xe391=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x391e[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require('sequelize');module[_0xe391('0x0')]={'uniqueid':{'type':Sequelize[_0xe391('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe391('0x1')]},'context':{'type':Sequelize[_0xe391('0x1')]},'extension':{'type':Sequelize[_0xe391('0x1')]},'priority':{'type':Sequelize[_0xe391('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xe391('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xe391('0x1')]},'savePath':{'type':Sequelize[_0xe391('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x1630d4='';var _0x3c2ea2=this['getDataValue'](_0xe391('0x2'));if(_0x3c2ea2){_0x1630d4=_0x3c2ea2[_0xe391('0x3')](_0x3c2ea2[_0xe391('0x4')]('.'));}return _0x1630d4;}}}; \ No newline at end of file +var _0x0a22=['lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x419135,_0x432880){var _0x3b7c4d=function(_0x5e4fed){while(--_0x5e4fed){_0x419135['push'](_0x419135['shift']());}};_0x3b7c4d(++_0x432880);}(_0x0a22,0x1eb));var _0x20a2=function(_0x4e44a8,_0x6a475b){_0x4e44a8=_0x4e44a8-0x0;var _0x404bbf=_0x0a22[_0x4e44a8];return _0x404bbf;};'use strict';var Sequelize=require(_0x20a2('0x0'));module[_0x20a2('0x1')]={'uniqueid':{'type':Sequelize[_0x20a2('0x2')]},'callerid':{'type':Sequelize[_0x20a2('0x2')]},'calleridname':{'type':Sequelize[_0x20a2('0x2')]},'context':{'type':Sequelize[_0x20a2('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x20a2('0x2')]},'accountcode':{'type':Sequelize[_0x20a2('0x2')]},'dnid':{'type':Sequelize[_0x20a2('0x2')]},'projectName':{'type':Sequelize[_0x20a2('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x20a2('0x2')]},'format':{'type':Sequelize[_0x20a2('0x3')],'get':function(){var _0x248894='';var _0x9555aa=this['getDataValue']('savePath');if(_0x9555aa){_0x248894=_0x9555aa['substring'](_0x9555aa[_0x20a2('0x4')]('.'));}return _0x248894;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e0348df..b97d708 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 _0xf84b=['where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x5d06d8,_0x3ae99f){var _0x2ae557=function(_0x1e0905){while(--_0x1e0905){_0x5d06d8['push'](_0x5d06d8['shift']());}};_0x2ae557(++_0x3ae99f);}(_0xf84b,0x139));var _0xbf84=function(_0x2d9320,_0x303c7e){_0x2d9320=_0x2d9320-0x0;var _0x3b43d8=_0xf84b[_0x2d9320];return _0x3b43d8;};'use strict';var pdf=require(_0xbf84('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf84('0x2'));var BPromise=require(_0xbf84('0x3'));var Mustache=require('mustache');var util=require(_0xbf84('0x4'));var path=require('path');var sox=require(_0xbf84('0x5'));var csv=require(_0xbf84('0x6'));var ejs=require(_0xbf84('0x7'));var fs=require('fs');var _=require(_0xbf84('0x8'));var squel=require('squel');var crypto=require(_0xbf84('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf84('0x6'));var querystring=require(_0xbf84('0xa'));var Papa=require('papaparse');var Redis=require(_0xbf84('0xb'));var authService=require(_0xbf84('0xc'));var qs=require(_0xbf84('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf84('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbf84('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf84('0x10'))['db'];function respondWithStatusCode(_0x7bbe54,_0x276f93){_0x276f93=_0x276f93||0xcc;return function(_0x366876){if(_0x366876){return _0x7bbe54[_0xbf84('0x11')](_0x276f93);}return _0x7bbe54['status'](_0x276f93)[_0xbf84('0x12')]();};}function respondWithResult(_0x1bab80,_0x14a61c){_0x14a61c=_0x14a61c||0xc8;return function(_0x20f703){if(_0x20f703){return _0x1bab80[_0xbf84('0x13')](_0x14a61c)['json'](_0x20f703);}};}function respondWithFilteredResult(_0x38b08c,_0x32ba07){return function(_0x8bb34){if(_0x8bb34){var _0x1f0773=_0x8bb34[_0xbf84('0x14')],_0x757816=_0x32ba07['offset'],_0x1ecd11=_0x32ba07[_0xbf84('0x15')]+_0x32ba07['limit'],_0x468413;if(_0x1ecd11>=_0x1f0773){_0x1ecd11=_0x1f0773;_0x468413=0xc8;}else{_0x468413=0xce;}_0x38b08c['status'](_0x468413);return _0x38b08c[_0xbf84('0x16')](_0xbf84('0x17'),_0x757816+'-'+_0x1ecd11+'/'+_0x1f0773)['json'](_0x8bb34);}return null;};}function patchUpdates(_0x5d9568){return function(_0x2ddd27){try{jsonpatch[_0xbf84('0x18')](_0x2ddd27,_0x5d9568,!![]);}catch(_0x2eedd4){return BPromise['reject'](_0x2eedd4);}return _0x2ddd27[_0xbf84('0x19')]();};}function saveUpdates(_0x5a5d89,_0x95cacc){return function(_0x16a604){if(_0x16a604){return _0x16a604[_0xbf84('0x1a')](_0x5a5d89)[_0xbf84('0x1b')](function(_0x21c57c){return _0x21c57c;});}return null;};}function removeEntity(_0x409269,_0xe7370c){return function(_0x499223){if(_0x499223){return _0x499223[_0xbf84('0x1c')]()[_0xbf84('0x1b')](function(){_0x409269[_0xbf84('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f766,_0xe53ea9){return function(_0x5ae5ed){if(!_0x5ae5ed){_0x44f766[_0xbf84('0x11')](0x194);}return _0x5ae5ed;};}function handleError(_0x24d445,_0x4fa4b2){_0x4fa4b2=_0x4fa4b2||0x1f4;return function(_0x2fa057){logger[_0xbf84('0x1d')](_0x2fa057[_0xbf84('0x1e')]);if(_0x2fa057[_0xbf84('0x1f')]){delete _0x2fa057[_0xbf84('0x1f')];}_0x24d445[_0xbf84('0x13')](_0x4fa4b2)[_0xbf84('0x20')](_0x2fa057);};}exports[_0xbf84('0x21')]=function(_0xcb58ed,_0x8df152){var _0x47df5e={},_0x3d5f8f={},_0x4e1b04={'count':0x0,'rows':[]};var _0x4e816d=_[_0xbf84('0x22')](db[_0xbf84('0x23')][_0xbf84('0x24')],function(_0x53eadd){return{'name':_0x53eadd[_0xbf84('0x25')],'type':_0x53eadd[_0xbf84('0x26')]['key']};});_0x3d5f8f['model']=_[_0xbf84('0x22')](_0x4e816d,_0xbf84('0x1f'));_0x3d5f8f[_0xbf84('0x27')]=_[_0xbf84('0x28')](_0xcb58ed[_0xbf84('0x27')]);_0x3d5f8f[_0xbf84('0x29')]=_[_0xbf84('0x2a')](_0x3d5f8f[_0xbf84('0x2b')],_0x3d5f8f['query']);_0x47df5e[_0xbf84('0x2c')]=_[_0xbf84('0x2a')](_0x3d5f8f[_0xbf84('0x2b')],qs[_0xbf84('0x2d')](_0xcb58ed[_0xbf84('0x27')][_0xbf84('0x2d')]));_0x47df5e['attributes']=_0x47df5e['attributes'][_0xbf84('0x2e')]?_0x47df5e[_0xbf84('0x2c')]:_0x3d5f8f[_0xbf84('0x2b')];if(!_0xcb58ed[_0xbf84('0x27')][_0xbf84('0x2f')](_0xbf84('0x30'))){_0x47df5e[_0xbf84('0x31')]=qs[_0xbf84('0x31')](_0xcb58ed[_0xbf84('0x27')][_0xbf84('0x31')]);_0x47df5e[_0xbf84('0x15')]=qs[_0xbf84('0x15')](_0xcb58ed[_0xbf84('0x27')][_0xbf84('0x15')]);}_0x47df5e[_0xbf84('0x32')]=qs['sort'](_0xcb58ed[_0xbf84('0x27')]['sort']);_0x47df5e[_0xbf84('0x33')]=qs[_0xbf84('0x29')](_[_0xbf84('0x34')](_0xcb58ed[_0xbf84('0x27')],_0x3d5f8f[_0xbf84('0x29')]),_0x4e816d);if(_0xcb58ed[_0xbf84('0x27')][_0xbf84('0x35')]){_0x47df5e['where']=_['merge'](_0x47df5e[_0xbf84('0x33')],{'$or':_[_0xbf84('0x22')](_0x4e816d,function(_0xb07f13){if(_0xb07f13['type']!==_0xbf84('0x36')){var _0x2358c1={};_0x2358c1[_0xb07f13[_0xbf84('0x1f')]]={'$like':'%'+_0xcb58ed[_0xbf84('0x27')]['filter']+'%'};return _0x2358c1;}})});}_0x47df5e=_[_0xbf84('0x37')]({},_0x47df5e,_0xcb58ed[_0xbf84('0x38')]);var _0x47a52d={'where':_0x47df5e['where']};return db[_0xbf84('0x23')][_0xbf84('0x14')](_0x47a52d)[_0xbf84('0x1b')](function(_0x2217e2){_0x4e1b04[_0xbf84('0x14')]=_0x2217e2;if(_0xcb58ed['query'][_0xbf84('0x39')]){_0x47df5e['include']=[{'all':!![]}];}return db[_0xbf84('0x23')][_0xbf84('0x3a')](_0x47df5e);})[_0xbf84('0x1b')](function(_0x49c4b4){_0x4e1b04[_0xbf84('0x3b')]=_0x49c4b4;return _0x4e1b04;})[_0xbf84('0x1b')](respondWithFilteredResult(_0x8df152,_0x47df5e))[_0xbf84('0x3c')](handleError(_0x8df152,null));};exports[_0xbf84('0x3d')]=function(_0x1c4860,_0x55f515){var _0x4b9a49={'raw':!![],'where':{'id':_0x1c4860['params']['id']}},_0x283417={};_0x283417[_0xbf84('0x2b')]=_[_0xbf84('0x28')](db[_0xbf84('0x23')]['rawAttributes']);_0x283417['query']=_[_0xbf84('0x28')](_0x1c4860[_0xbf84('0x27')]);_0x283417[_0xbf84('0x29')]=_[_0xbf84('0x2a')](_0x283417[_0xbf84('0x2b')],_0x283417[_0xbf84('0x27')]);_0x4b9a49[_0xbf84('0x2c')]=_[_0xbf84('0x2a')](_0x283417['model'],qs['fields'](_0x1c4860[_0xbf84('0x27')]['fields']));_0x4b9a49[_0xbf84('0x2c')]=_0x4b9a49[_0xbf84('0x2c')][_0xbf84('0x2e')]?_0x4b9a49['attributes']:_0x283417[_0xbf84('0x2b')];if(_0x1c4860[_0xbf84('0x27')]['includeAll']){_0x4b9a49[_0xbf84('0x3e')]=[{'all':!![]}];}_0x4b9a49=_['merge']({},_0x4b9a49,_0x1c4860['options']);return db[_0xbf84('0x23')]['find'](_0x4b9a49)['then'](handleEntityNotFound(_0x55f515,null))[_0xbf84('0x1b')](respondWithResult(_0x55f515,null))[_0xbf84('0x3c')](handleError(_0x55f515,null));};exports[_0xbf84('0x3f')]=function(_0x34e5d4,_0x182188){return db['SquareRecording'][_0xbf84('0x3f')](_0x34e5d4[_0xbf84('0x40')],{})['then'](respondWithResult(_0x182188,0xc9))[_0xbf84('0x3c')](handleError(_0x182188,null));};exports[_0xbf84('0x1a')]=function(_0x5baaeb,_0x3636b1){if(_0x5baaeb[_0xbf84('0x40')]['id']){delete _0x5baaeb['body']['id'];}return db[_0xbf84('0x23')][_0xbf84('0x41')]({'where':{'id':_0x5baaeb[_0xbf84('0x42')]['id']}})[_0xbf84('0x1b')](handleEntityNotFound(_0x3636b1,null))[_0xbf84('0x1b')](saveUpdates(_0x5baaeb['body'],null))[_0xbf84('0x1b')](respondWithResult(_0x3636b1,null))['catch'](handleError(_0x3636b1,null));};exports[_0xbf84('0x43')]=function(_0x362adb,_0x2389c5,_0xdb518c){var _0x3e4780=require(_0xbf84('0x44'));var _0x2d87f8=![];var _0x20125a={};if(_0x362adb[_0xbf84('0x27')]['type']&&_0x362adb['query'][_0xbf84('0x26')]===_0xbf84('0x45')){_0x20125a['uniqueid']=_0x362adb[_0xbf84('0x42')]['id'];}else{_0x20125a['id']=_0x362adb['params']['id'];}return db[_0xbf84('0x23')][_0xbf84('0x41')]({'where':_0x20125a,'attributes':['id',_0xbf84('0x46'),_0xbf84('0x47')],'raw':!![]})[_0xbf84('0x1b')](handleEntityNotFound(_0x2389c5,null))[_0xbf84('0x1b')](function(_0x2b3320){if(_0x2b3320){var _0x2fb654=_0x2b3320['savePath'];var _0x5e87a8=util[_0xbf84('0x48')](_0xbf84('0x49'),_0x2fb654);if(fs[_0xbf84('0x4a')](_0x5e87a8)){_0x2d87f8=!![];return _0x3e4780[_0xbf84('0x4b')](_0x5e87a8,_0x2fb654,config[_0xbf84('0x4c')][_0xbf84('0x4d')])[_0xbf84('0x1b')](function(){return _0x2b3320;});}return _0x2b3320;}})[_0xbf84('0x1b')](function(_0x5711b8){if(_0x5711b8){var _0x1a13e9=_0x5711b8[_0xbf84('0x46')];if(!fs[_0xbf84('0x4a')](_0x1a13e9)){throw new db[(_0xbf84('0x4e'))]['ValidationError'](_0xbf84('0x4f'));}if(_0x5711b8[_0xbf84('0x47')]){return _0x2389c5[_0xbf84('0x43')](_0x1a13e9,_0x5711b8[_0xbf84('0x47')]+path[_0xbf84('0x50')](_0x1a13e9),function(){if(_0x2d87f8){fs[_0xbf84('0x51')](_0x1a13e9);}});}else{return _0x2389c5['download'](_0x1a13e9,function(_0x5641f1){if(_0x2d87f8){fs['unlink'](_0x1a13e9);}});}}})['catch'](function(_0x1948dc){if(_0x1948dc[_0xbf84('0x52')]===_0xbf84('0x4f')){_0x2389c5['status'](0x194)[_0xbf84('0x20')](_0xbf84('0x53'));}else{return handleError(_0x2389c5,null);}});};exports[_0xbf84('0x1c')]=function(_0x4e7b55,_0x232910){return db[_0xbf84('0x23')][_0xbf84('0x41')]({'where':{'id':_0x4e7b55[_0xbf84('0x42')]['id']}})[_0xbf84('0x1b')](function(_0x25e1bf){if(!_0x25e1bf)throw new ReferenceError(_0xbf84('0x54'));return _0x25e1bf;})[_0xbf84('0x1b')](function(_0x5abb4f){var _0x18ead1=_0x5abb4f['savePath'];logger['info'](_0xbf84('0x55'),_0x18ead1);if(!_[_0xbf84('0x56')](_0x5abb4f[_0xbf84('0x46')])&&fs[_0xbf84('0x4a')](_0x18ead1)){logger['info'](_0xbf84('0x57')+_0x18ead1+_0xbf84('0x58'));fs[_0xbf84('0x59')](_0x18ead1);}_0x18ead1=_0x18ead1+_0xbf84('0x5a');if(!_[_0xbf84('0x56')](_0x5abb4f[_0xbf84('0x46')])&&fs[_0xbf84('0x4a')](_0x18ead1)){logger['info'](_0xbf84('0x57')+_0x18ead1+_0xbf84('0x58'));fs[_0xbf84('0x59')](_0x18ead1);}return _0x5abb4f;})['then'](function(_0x451b46){if(!_0x451b46)throw new InternalError();return _0x451b46[_0xbf84('0x1c')]();})[_0xbf84('0x1b')](function(){_0x232910[_0xbf84('0x13')](0xcc)['end']();})[_0xbf84('0x3c')](handleError(_0x232910,null));}; \ No newline at end of file +var _0xde4d=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','length','find','catch','create','body','uniqueid','savePath','format','existsSync','decryptFile','recording','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Entity\x20not\x20found','info','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xde4d,0xb4));var _0xdde4=function(_0x1fb2a7,_0x584062){_0x1fb2a7=_0x1fb2a7-0x0;var _0x3364ed=_0xde4d[_0x1fb2a7];return _0x3364ed;};'use strict';var pdf=require(_0xdde4('0x0'));var emlformat=require(_0xdde4('0x1'));var rimraf=require(_0xdde4('0x2'));var zipdir=require(_0xdde4('0x3'));var jsonpatch=require(_0xdde4('0x4'));var rp=require(_0xdde4('0x5'));var moment=require(_0xdde4('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdde4('0x7'));var path=require('path');var sox=require(_0xdde4('0x8'));var csv=require(_0xdde4('0x9'));var ejs=require(_0xdde4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdde4('0xb'));var crypto=require(_0xdde4('0xc'));var jsforce=require(_0xdde4('0xd'));var deskjs=require(_0xdde4('0xe'));var toCsv=require(_0xdde4('0x9'));var querystring=require(_0xdde4('0xf'));var Papa=require(_0xdde4('0x10'));var Redis=require(_0xdde4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdde4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdde4('0x13'));var logger=require(_0xdde4('0x14'))(_0xdde4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdde4('0x16'));var db=require(_0xdde4('0x17'))['db'];function respondWithStatusCode(_0x1ff32d,_0x192dbc){_0x192dbc=_0x192dbc||0xcc;return function(_0x448296){if(_0x448296){return _0x1ff32d['sendStatus'](_0x192dbc);}return _0x1ff32d['status'](_0x192dbc)[_0xdde4('0x18')]();};}function respondWithResult(_0x1475fb,_0x3257a9){_0x3257a9=_0x3257a9||0xc8;return function(_0x3bf4df){if(_0x3bf4df){return _0x1475fb[_0xdde4('0x19')](_0x3257a9)['json'](_0x3bf4df);}};}function respondWithFilteredResult(_0x10cd72,_0x5587de){return function(_0x245b46){if(_0x245b46){var _0x13aa78=_0x245b46[_0xdde4('0x1a')],_0xa7e580=_0x5587de[_0xdde4('0x1b')],_0x5c7ade=_0x5587de['offset']+_0x5587de[_0xdde4('0x1c')],_0x1d5776;if(_0x5c7ade>=_0x13aa78){_0x5c7ade=_0x13aa78;_0x1d5776=0xc8;}else{_0x1d5776=0xce;}_0x10cd72[_0xdde4('0x19')](_0x1d5776);return _0x10cd72[_0xdde4('0x1d')](_0xdde4('0x1e'),_0xa7e580+'-'+_0x5c7ade+'/'+_0x13aa78)['json'](_0x245b46);}return null;};}function patchUpdates(_0xf9ed7c){return function(_0x31eab5){try{jsonpatch[_0xdde4('0x1f')](_0x31eab5,_0xf9ed7c,!![]);}catch(_0xb2095c){return BPromise[_0xdde4('0x20')](_0xb2095c);}return _0x31eab5[_0xdde4('0x21')]();};}function saveUpdates(_0xcee897,_0x2f5af9){return function(_0x5d1a67){if(_0x5d1a67){return _0x5d1a67[_0xdde4('0x22')](_0xcee897)[_0xdde4('0x23')](function(_0x558e8b){return _0x558e8b;});}return null;};}function removeEntity(_0x443999,_0x2b5cbe){return function(_0x121f6f){if(_0x121f6f){return _0x121f6f[_0xdde4('0x24')]()[_0xdde4('0x23')](function(){_0x443999[_0xdde4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5308b1,_0x320e55){return function(_0x227d6b){if(!_0x227d6b){_0x5308b1['sendStatus'](0x194);}return _0x227d6b;};}function handleError(_0x10965c,_0x1ef2c9){_0x1ef2c9=_0x1ef2c9||0x1f4;return function(_0xa2183d){logger['error'](_0xa2183d[_0xdde4('0x25')]);if(_0xa2183d[_0xdde4('0x26')]){delete _0xa2183d[_0xdde4('0x26')];}_0x10965c[_0xdde4('0x19')](_0x1ef2c9)[_0xdde4('0x27')](_0xa2183d);};}exports[_0xdde4('0x28')]=function(_0x366e57,_0x456708){var _0x30ecac={},_0x37e403={},_0x5c81a1={'count':0x0,'rows':[]};var _0x3ae437=_[_0xdde4('0x29')](db[_0xdde4('0x2a')][_0xdde4('0x2b')],function(_0x2fb1b3){return{'name':_0x2fb1b3[_0xdde4('0x2c')],'type':_0x2fb1b3[_0xdde4('0x2d')][_0xdde4('0x2e')]};});_0x37e403[_0xdde4('0x2f')]=_[_0xdde4('0x29')](_0x3ae437,_0xdde4('0x26'));_0x37e403['query']=_['keys'](_0x366e57[_0xdde4('0x30')]);_0x37e403[_0xdde4('0x31')]=_[_0xdde4('0x32')](_0x37e403[_0xdde4('0x2f')],_0x37e403['query']);_0x30ecac['attributes']=_[_0xdde4('0x32')](_0x37e403['model'],qs['fields'](_0x366e57[_0xdde4('0x30')][_0xdde4('0x33')]));_0x30ecac['attributes']=_0x30ecac[_0xdde4('0x34')]['length']?_0x30ecac[_0xdde4('0x34')]:_0x37e403['model'];if(!_0x366e57[_0xdde4('0x30')][_0xdde4('0x35')](_0xdde4('0x36'))){_0x30ecac['limit']=qs[_0xdde4('0x1c')](_0x366e57[_0xdde4('0x30')][_0xdde4('0x1c')]);_0x30ecac[_0xdde4('0x1b')]=qs[_0xdde4('0x1b')](_0x366e57[_0xdde4('0x30')]['offset']);}_0x30ecac[_0xdde4('0x37')]=qs[_0xdde4('0x38')](_0x366e57[_0xdde4('0x30')][_0xdde4('0x38')]);_0x30ecac[_0xdde4('0x39')]=qs[_0xdde4('0x31')](_['pick'](_0x366e57['query'],_0x37e403[_0xdde4('0x31')]),_0x3ae437);if(_0x366e57[_0xdde4('0x30')][_0xdde4('0x3a')]){_0x30ecac[_0xdde4('0x39')]=_[_0xdde4('0x3b')](_0x30ecac[_0xdde4('0x39')],{'$or':_[_0xdde4('0x29')](_0x3ae437,function(_0x3bf0d1){if(_0x3bf0d1['type']!==_0xdde4('0x3c')){var _0xe14aa0={};_0xe14aa0[_0x3bf0d1[_0xdde4('0x26')]]={'$like':'%'+_0x366e57[_0xdde4('0x30')][_0xdde4('0x3a')]+'%'};return _0xe14aa0;}})});}_0x30ecac=_[_0xdde4('0x3b')]({},_0x30ecac,_0x366e57[_0xdde4('0x3d')]);var _0x6dc8df={'where':_0x30ecac['where']};return db[_0xdde4('0x2a')][_0xdde4('0x1a')](_0x6dc8df)[_0xdde4('0x23')](function(_0x37762f){_0x5c81a1[_0xdde4('0x1a')]=_0x37762f;if(_0x366e57['query'][_0xdde4('0x3e')]){_0x30ecac[_0xdde4('0x3f')]=[{'all':!![]}];}return db[_0xdde4('0x2a')][_0xdde4('0x40')](_0x30ecac);})[_0xdde4('0x23')](function(_0x258e9e){_0x5c81a1['rows']=_0x258e9e;return _0x5c81a1;})[_0xdde4('0x23')](respondWithFilteredResult(_0x456708,_0x30ecac))['catch'](handleError(_0x456708,null));};exports[_0xdde4('0x41')]=function(_0x40c9b8,_0x33d17a){var _0x52fb2a={'raw':!![],'where':{'id':_0x40c9b8[_0xdde4('0x42')]['id']}},_0x2f5cbf={};_0x2f5cbf['model']=_[_0xdde4('0x43')](db[_0xdde4('0x2a')][_0xdde4('0x2b')]);_0x2f5cbf['query']=_[_0xdde4('0x43')](_0x40c9b8[_0xdde4('0x30')]);_0x2f5cbf[_0xdde4('0x31')]=_[_0xdde4('0x32')](_0x2f5cbf[_0xdde4('0x2f')],_0x2f5cbf['query']);_0x52fb2a[_0xdde4('0x34')]=_[_0xdde4('0x32')](_0x2f5cbf[_0xdde4('0x2f')],qs[_0xdde4('0x33')](_0x40c9b8[_0xdde4('0x30')][_0xdde4('0x33')]));_0x52fb2a[_0xdde4('0x34')]=_0x52fb2a[_0xdde4('0x34')][_0xdde4('0x44')]?_0x52fb2a['attributes']:_0x2f5cbf[_0xdde4('0x2f')];if(_0x40c9b8[_0xdde4('0x30')][_0xdde4('0x3e')]){_0x52fb2a['include']=[{'all':!![]}];}_0x52fb2a=_['merge']({},_0x52fb2a,_0x40c9b8['options']);return db[_0xdde4('0x2a')][_0xdde4('0x45')](_0x52fb2a)[_0xdde4('0x23')](handleEntityNotFound(_0x33d17a,null))[_0xdde4('0x23')](respondWithResult(_0x33d17a,null))[_0xdde4('0x46')](handleError(_0x33d17a,null));};exports['create']=function(_0x55a778,_0x29ba18){return db['SquareRecording'][_0xdde4('0x47')](_0x55a778[_0xdde4('0x48')],{})[_0xdde4('0x23')](respondWithResult(_0x29ba18,0xc9))[_0xdde4('0x46')](handleError(_0x29ba18,null));};exports[_0xdde4('0x22')]=function(_0x207117,_0x958bea){if(_0x207117['body']['id']){delete _0x207117[_0xdde4('0x48')]['id'];}return db['SquareRecording'][_0xdde4('0x45')]({'where':{'id':_0x207117[_0xdde4('0x42')]['id']}})['then'](handleEntityNotFound(_0x958bea,null))[_0xdde4('0x23')](saveUpdates(_0x207117[_0xdde4('0x48')],null))[_0xdde4('0x23')](respondWithResult(_0x958bea,null))[_0xdde4('0x46')](handleError(_0x958bea,null));};exports['download']=function(_0x56e691,_0x1f9c9e,_0x54a42f){var _0x1b9760=require('../../components/encryptor');var _0x19b179=![];var _0x99e8b9={};if(_0x56e691['query'][_0xdde4('0x2d')]&&_0x56e691['query'][_0xdde4('0x2d')]===_0xdde4('0x49')){_0x99e8b9['uniqueid']=_0x56e691['params']['id'];}else{_0x99e8b9['id']=_0x56e691[_0xdde4('0x42')]['id'];}return db[_0xdde4('0x2a')][_0xdde4('0x45')]({'where':_0x99e8b9,'attributes':['id',_0xdde4('0x4a'),'filename'],'raw':!![]})[_0xdde4('0x23')](handleEntityNotFound(_0x1f9c9e,null))['then'](function(_0xc39182){if(_0xc39182){var _0x3a9906=_0xc39182[_0xdde4('0x4a')];var _0x4eb345=util[_0xdde4('0x4b')]('%s.cypher',_0x3a9906);if(fs[_0xdde4('0x4c')](_0x4eb345)){_0x19b179=!![];return _0x1b9760[_0xdde4('0x4d')](_0x4eb345,_0x3a9906,config['secrets'][_0xdde4('0x4e')])[_0xdde4('0x23')](function(){return _0xc39182;});}return _0xc39182;}})[_0xdde4('0x23')](function(_0x3039ff){if(_0x3039ff){var _0x34aac8=_0x3039ff['savePath'];if(!fs['existsSync'](_0x34aac8)){throw new db['Sequelize'][(_0xdde4('0x4f'))](_0xdde4('0x50'));}if(_0x3039ff['filename']){return _0x1f9c9e[_0xdde4('0x51')](_0x34aac8,_0x3039ff['filename']+path[_0xdde4('0x52')](_0x34aac8),function(){if(_0x19b179){fs[_0xdde4('0x53')](_0x34aac8);}});}else{return _0x1f9c9e[_0xdde4('0x51')](_0x34aac8,function(_0x59264d){if(_0x19b179){fs[_0xdde4('0x53')](_0x34aac8);}});}}})[_0xdde4('0x46')](function(_0x3b1017){if(_0x3b1017[_0xdde4('0x54')]==='SquareRecording\x20not\x20found'){_0x1f9c9e[_0xdde4('0x19')](0x194)[_0xdde4('0x27')]('Not\x20found');}else{return handleError(_0x1f9c9e,null);}});};exports[_0xdde4('0x24')]=function(_0x2e9be5,_0x567f6c){return db[_0xdde4('0x2a')][_0xdde4('0x45')]({'where':{'id':_0x2e9be5['params']['id']}})[_0xdde4('0x23')](function(_0x29353f){if(!_0x29353f)throw new ReferenceError(_0xdde4('0x55'));return _0x29353f;})[_0xdde4('0x23')](function(_0x2c43f0){var _0x5d6645=_0x2c43f0['savePath'];logger[_0xdde4('0x56')]('cancellazione\x20fisica\x20documento\x20%s',_0x5d6645);if(!_[_0xdde4('0x57')](_0x2c43f0['savePath'])&&fs['existsSync'](_0x5d6645)){logger['info'](_0xdde4('0x58')+_0x5d6645+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5d6645);}_0x5d6645=_0x5d6645+_0xdde4('0x59');if(!_[_0xdde4('0x57')](_0x2c43f0['savePath'])&&fs[_0xdde4('0x4c')](_0x5d6645)){logger['info'](_0xdde4('0x58')+_0x5d6645+_0xdde4('0x5a'));fs['unlinkSync'](_0x5d6645);}return _0x2c43f0;})['then'](function(_0x32424d){if(!_0x32424d)throw new InternalError();return _0x32424d['destroy']();})[_0xdde4('0x23')](function(){_0x567f6c[_0xdde4('0x19')](0xcc)[_0xdde4('0x18')]();})[_0xdde4('0x46')](handleError(_0x567f6c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 10dd72d..1608b50 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 _0x676c=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording'];(function(_0x57b7f6,_0x5d6061){var _0x135fed=function(_0x14f057){while(--_0x14f057){_0x57b7f6['push'](_0x57b7f6['shift']());}};_0x135fed(++_0x5d6061);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc676('0x0'));var util=require(_0xc676('0x1'));var logger=require(_0xc676('0x2'))('api');var moment=require(_0xc676('0x3'));var BPromise=require(_0xc676('0x4'));var rp=require(_0xc676('0x5'));var fs=require('fs');var path=require(_0xc676('0x6'));var rimraf=require(_0xc676('0x7'));var config=require(_0xc676('0x8'));var attributes=require('./squareRecording.attributes');module[_0xc676('0x9')]=function(_0x228e07,_0x13c5a7){return _0x228e07[_0xc676('0xa')](_0xc676('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c32=['../../config/logger','moment','path','rimraf','./squareRecording.attributes','SquareRecording','square_recordings','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c32,0x15d));var _0x29c3=function(_0x4dd081,_0x1a246c){_0x4dd081=_0x4dd081-0x0;var _0x2f3945=_0x9c32[_0x4dd081];return _0x2f3945;};'use strict';var _=require(_0x29c3('0x0'));var util=require(_0x29c3('0x1'));var logger=require(_0x29c3('0x2'))('api');var moment=require(_0x29c3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29c3('0x4'));var rimraf=require(_0x29c3('0x5'));var config=require('../../config/environment');var attributes=require(_0x29c3('0x6'));module['exports']=function(_0xd8ab32,_0x597fa9){return _0xd8ab32['define'](_0x29c3('0x7'),attributes,{'tableName':_0x29c3('0x8'),'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 085d2eb..067f802 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 _0x1fdf=['code','message','result','catch','CreateSquareRecording','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5cecb3,_0x327dd9){var _0x5a55d7=function(_0x477789){while(--_0x477789){_0x5cecb3['push'](_0x5cecb3['shift']());}};_0x5a55d7(++_0x327dd9);}(_0x1fdf,0x8a));var _0xf1fd=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x1fdf[_0x1c8cc6];return _0x522936;};'use strict';var _=require(_0xf1fd('0x0'));var util=require(_0xf1fd('0x1'));var moment=require('moment');var BPromise=require(_0xf1fd('0x2'));var rs=require(_0xf1fd('0x3'));var fs=require('fs');var Redis=require(_0xf1fd('0x4'));var db=require(_0xf1fd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1fd('0x6'))(_0xf1fd('0x7'));var config=require('../../config/environment');var jayson=require(_0xf1fd('0x8'));var client=jayson['client'][_0xf1fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14b31f,_0x4278ae,_0x309fca){return new BPromise(function(_0xb2c4ed,_0x18a837){return client[_0xf1fd('0xa')](_0x14b31f,_0x309fca)[_0xf1fd('0xb')](function(_0x3142c8){logger[_0xf1fd('0xc')](_0xf1fd('0xd'),_0x4278ae,_0xf1fd('0xe'));logger[_0xf1fd('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4278ae,_0xf1fd('0xe'),JSON[_0xf1fd('0x10')](_0x3142c8));if(_0x3142c8[_0xf1fd('0x11')]){if(_0x3142c8['error'][_0xf1fd('0x12')]===0x1f4){logger[_0xf1fd('0x11')](_0xf1fd('0xd'),_0x4278ae,_0x3142c8['error'][_0xf1fd('0x13')]);return _0x18a837(_0x3142c8[_0xf1fd('0x11')][_0xf1fd('0x13')]);}logger[_0xf1fd('0x11')](_0xf1fd('0xd'),_0x4278ae,_0x3142c8['error']['message']);return _0xb2c4ed(_0x3142c8[_0xf1fd('0x11')][_0xf1fd('0x13')]);}else{logger[_0xf1fd('0xc')](_0xf1fd('0xd'),_0x4278ae,'request\x20sent');_0xb2c4ed(_0x3142c8[_0xf1fd('0x14')][_0xf1fd('0x13')]);}})[_0xf1fd('0x15')](function(_0xb31bfa){logger[_0xf1fd('0x11')]('SquareRecording,\x20%s,\x20%s',_0x4278ae,_0xb31bfa);_0x18a837(_0xb31bfa);});});}exports[_0xf1fd('0x16')]=function(_0x3e05e8){var _0x4acd95=this;return new Promise(function(_0x1307cd,_0x2f31b8){return db['SquareRecording'][_0xf1fd('0x17')](_0x3e05e8[_0xf1fd('0x18')],{'raw':_0x3e05e8['options']?_0x3e05e8[_0xf1fd('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf1fd('0xb')](function(_0x4b313e){logger[_0xf1fd('0xc')]('CreateSquareRecording',_0x3e05e8);logger[_0xf1fd('0xf')]('CreateSquareRecording',_0x3e05e8,JSON[_0xf1fd('0x10')](_0x4b313e));_0x1307cd(_0x4b313e);})['catch'](function(_0x324b16){logger[_0xf1fd('0x11')](_0xf1fd('0x16'),_0x324b16['message'],_0x3e05e8);_0x2f31b8(_0x4acd95['error'](0x1f4,_0x324b16[_0xf1fd('0x13')]));});});}; \ No newline at end of file +var _0x31a3=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','CreateSquareRecording','SquareRecording','create','body','options','raw'];(function(_0x13860a,_0x421420){var _0x2c980b=function(_0x47d467){while(--_0x47d467){_0x13860a['push'](_0x13860a['shift']());}};_0x2c980b(++_0x421420);}(_0x31a3,0x189));var _0x331a=function(_0x3546eb,_0x440f3f){_0x3546eb=_0x3546eb-0x0;var _0xe660bf=_0x31a3[_0x3546eb];return _0xe660bf;};'use strict';var _=require(_0x331a('0x0'));var util=require(_0x331a('0x1'));var moment=require('moment');var BPromise=require(_0x331a('0x2'));var rs=require(_0x331a('0x3'));var fs=require('fs');var Redis=require(_0x331a('0x4'));var db=require(_0x331a('0x5'))['db'];var utils=require(_0x331a('0x6'));var logger=require(_0x331a('0x7'))(_0x331a('0x8'));var config=require(_0x331a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x331a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3106c6,_0x4df5d6,_0x3f9908){return new BPromise(function(_0xaa4d52,_0x56f7b3){return client[_0x331a('0xb')](_0x3106c6,_0x3f9908)['then'](function(_0x31fd53){logger[_0x331a('0xc')](_0x331a('0xd'),_0x4df5d6,'request\x20sent');logger[_0x331a('0xe')](_0x331a('0xf'),_0x4df5d6,'request\x20sent',JSON[_0x331a('0x10')](_0x31fd53));if(_0x31fd53[_0x331a('0x11')]){if(_0x31fd53[_0x331a('0x11')]['code']===0x1f4){logger[_0x331a('0x11')](_0x331a('0xd'),_0x4df5d6,_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);return _0x56f7b3(_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);}logger['error'](_0x331a('0xd'),_0x4df5d6,_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);return _0xaa4d52(_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);}else{logger[_0x331a('0xc')](_0x331a('0xd'),_0x4df5d6,_0x331a('0x13'));_0xaa4d52(_0x31fd53[_0x331a('0x14')][_0x331a('0x12')]);}})['catch'](function(_0x375cb6){logger[_0x331a('0x11')](_0x331a('0xd'),_0x4df5d6,_0x375cb6);_0x56f7b3(_0x375cb6);});});}exports[_0x331a('0x15')]=function(_0x3b0d37){var _0x9e9bad=this;return new Promise(function(_0x3aebec,_0x4fa179){return db[_0x331a('0x16')][_0x331a('0x17')](_0x3b0d37[_0x331a('0x18')],{'raw':_0x3b0d37['options']?_0x3b0d37[_0x331a('0x19')][_0x331a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x242886){logger[_0x331a('0xc')](_0x331a('0x15'),_0x3b0d37);logger[_0x331a('0xe')](_0x331a('0x15'),_0x3b0d37,JSON['stringify'](_0x242886));_0x3aebec(_0x242886);})[_0x331a('0x1b')](function(_0xe62971){logger[_0x331a('0x11')](_0x331a('0x15'),_0xe62971[_0x331a('0x12')],_0x3b0d37);_0x4fa179(_0x9e9bad[_0x331a('0x11')](0x1f4,_0xe62971[_0x331a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 464ae6d..161453f 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 _0x52be=['update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x52be,0x75));var _0xe52b=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x52be[_0x3203a1];return _0x24215e;};'use strict';var multer=require(_0xe52b('0x0'));var util=require(_0xe52b('0x1'));var path=require('path');var timeout=require(_0xe52b('0x2'));var express=require(_0xe52b('0x3'));var router=express[_0xe52b('0x4')]();var auth=require(_0xe52b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe52b('0x6'));var controller=require(_0xe52b('0x7'));router[_0xe52b('0x8')]('/',auth[_0xe52b('0x9')](),controller[_0xe52b('0xa')]);router['get'](_0xe52b('0xb'),auth[_0xe52b('0x9')](),controller['describe']);router[_0xe52b('0x8')](_0xe52b('0xc'),auth['isAuthenticated'](),controller[_0xe52b('0xd')]);router[_0xe52b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe52b('0xf')](_0xe52b('0xc'),auth['isAuthenticated'](),controller[_0xe52b('0x10')]);router[_0xe52b('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe52b('0x12')]=router; \ No newline at end of file +var _0xef27=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x868837,_0x527c41){var _0x52039e=function(_0x203f36){while(--_0x203f36){_0x868837['push'](_0x868837['shift']());}};_0x52039e(++_0x527c41);}(_0xef27,0x155));var _0x7ef2=function(_0x4c7d02,_0x4110e2){_0x4c7d02=_0x4c7d02-0x0;var _0x3417b9=_0xef27[_0x4c7d02];return _0x3417b9;};'use strict';var multer=require('multer');var util=require(_0x7ef2('0x0'));var path=require(_0x7ef2('0x1'));var timeout=require(_0x7ef2('0x2'));var express=require(_0x7ef2('0x3'));var router=express[_0x7ef2('0x4')]();var auth=require(_0x7ef2('0x5'));var interaction=require(_0x7ef2('0x6'));var config=require(_0x7ef2('0x7'));var controller=require(_0x7ef2('0x8'));router[_0x7ef2('0x9')]('/',auth[_0x7ef2('0xa')](),controller[_0x7ef2('0xb')]);router['get']('/describe',auth[_0x7ef2('0xa')](),controller[_0x7ef2('0xc')]);router[_0x7ef2('0x9')](_0x7ef2('0xd'),auth['isAuthenticated'](),controller[_0x7ef2('0xe')]);router[_0x7ef2('0xf')]('/',auth[_0x7ef2('0xa')](),controller[_0x7ef2('0x10')]);router[_0x7ef2('0x11')](_0x7ef2('0xd'),auth[_0x7ef2('0xa')](),controller[_0x7ef2('0x12')]);router['delete'](_0x7ef2('0xd'),auth[_0x7ef2('0xa')](),controller[_0x7ef2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c44ee4d..65ff682 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 _0x7626=['exports','STRING','BOOLEAN','sequelize'];(function(_0x58d78e,_0x527a89){var _0x23cf08=function(_0x563a33){while(--_0x563a33){_0x58d78e['push'](_0x58d78e['shift']());}};_0x23cf08(++_0x527a89);}(_0x7626,0x1c3));var _0x6762=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7626[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x6762('0x0'));module[_0x6762('0x1')]={'network':{'type':Sequelize[_0x6762('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x6762('0x2')]},'channel':{'type':Sequelize[_0x6762('0x2')]},'language':{'type':Sequelize[_0x6762('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x6762('0x2')]},'callerid':{'type':Sequelize[_0x6762('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x6762('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x6762('0x2')]},'callingtns':{'type':Sequelize[_0x6762('0x2')]},'dnid':{'type':Sequelize[_0x6762('0x2')]},'rdnis':{'type':Sequelize[_0x6762('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6762('0x2')]},'enhanced':{'type':Sequelize[_0x6762('0x2')]},'accountcode':{'type':Sequelize[_0x6762('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6762('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4da2=['STRING','DATE'];(function(_0x25170c,_0x360970){var _0x54481d=function(_0x482d75){while(--_0x482d75){_0x25170c['push'](_0x25170c['shift']());}};_0x54481d(++_0x360970);}(_0x4da2,0x130));var _0x24da=function(_0x27c5ec,_0x197350){_0x27c5ec=_0x27c5ec-0x0;var _0xf1e07=_0x4da2[_0x27c5ec];return _0xf1e07;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x24da('0x0')]},'network_script':{'type':Sequelize[_0x24da('0x0')]},'request':{'type':Sequelize[_0x24da('0x0')]},'channel':{'type':Sequelize[_0x24da('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x24da('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x24da('0x0')]},'callerid':{'type':Sequelize[_0x24da('0x0')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x24da('0x0')]},'callingani2':{'type':Sequelize[_0x24da('0x0')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x24da('0x0')]},'dnid':{'type':Sequelize[_0x24da('0x0')]},'rdnis':{'type':Sequelize[_0x24da('0x0')]},'context':{'type':Sequelize[_0x24da('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x24da('0x0')]},'accountcode':{'type':Sequelize[_0x24da('0x0')]},'threadid':{'type':Sequelize[_0x24da('0x0')]},'project_name':{'type':Sequelize[_0x24da('0x0')]},'joinAt':{'type':Sequelize[_0x24da('0x1')]},'leaveAt':{'type':Sequelize[_0x24da('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a2a7c3c..080b1d5 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 _0xc812=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys'];(function(_0x3801ce,_0x12a546){var _0x8cca9b=function(_0x4f263d){while(--_0x4f263d){_0x3801ce['push'](_0x3801ce['shift']());}};_0x8cca9b(++_0x12a546);}(_0xc812,0xbc));var _0x2c81=function(_0x28dff3,_0x5d9089){_0x28dff3=_0x28dff3-0x0;var _0x51e272=_0xc812[_0x28dff3];return _0x51e272;};'use strict';var pdf=require(_0x2c81('0x0'));var emlformat=require(_0x2c81('0x1'));var rimraf=require(_0x2c81('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c81('0x3'));var rp=require(_0x2c81('0x4'));var moment=require(_0x2c81('0x5'));var BPromise=require(_0x2c81('0x6'));var Mustache=require('mustache');var util=require(_0x2c81('0x7'));var path=require(_0x2c81('0x8'));var sox=require('sox');var csv=require(_0x2c81('0x9'));var ejs=require(_0x2c81('0xa'));var fs=require('fs');var _=require(_0x2c81('0xb'));var squel=require(_0x2c81('0xc'));var crypto=require(_0x2c81('0xd'));var jsforce=require(_0x2c81('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2c81('0x9'));var querystring=require(_0x2c81('0xf'));var Papa=require(_0x2c81('0x10'));var Redis=require(_0x2c81('0x11'));var authService=require(_0x2c81('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2c81('0x13'));var hardwareService=require(_0x2c81('0x14'));var logger=require(_0x2c81('0x15'))(_0x2c81('0x16'));var utils=require(_0x2c81('0x17'));var config=require(_0x2c81('0x18'));var licenseUtil=require(_0x2c81('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22a187,_0x2270da){_0x2270da=_0x2270da||0xcc;return function(_0x5e2812){if(_0x5e2812){return _0x22a187['sendStatus'](_0x2270da);}return _0x22a187[_0x2c81('0x1a')](_0x2270da)[_0x2c81('0x1b')]();};}function respondWithResult(_0x4def60,_0x425a60){_0x425a60=_0x425a60||0xc8;return function(_0x258b0f){if(_0x258b0f){return _0x4def60[_0x2c81('0x1a')](_0x425a60)[_0x2c81('0x1c')](_0x258b0f);}};}function respondWithFilteredResult(_0x2de1ee,_0x3a51aa){return function(_0x35c42b){if(_0x35c42b){var _0x169c74=_0x35c42b['count'],_0x59ff30=_0x3a51aa[_0x2c81('0x1d')],_0x3541ea=_0x3a51aa[_0x2c81('0x1d')]+_0x3a51aa[_0x2c81('0x1e')],_0x24c35c;if(_0x3541ea>=_0x169c74){_0x3541ea=_0x169c74;_0x24c35c=0xc8;}else{_0x24c35c=0xce;}_0x2de1ee[_0x2c81('0x1a')](_0x24c35c);return _0x2de1ee[_0x2c81('0x1f')](_0x2c81('0x20'),_0x59ff30+'-'+_0x3541ea+'/'+_0x169c74)['json'](_0x35c42b);}return null;};}function patchUpdates(_0x29a2c7){return function(_0x9ec98){try{jsonpatch[_0x2c81('0x21')](_0x9ec98,_0x29a2c7,!![]);}catch(_0x7ddde6){return BPromise[_0x2c81('0x22')](_0x7ddde6);}return _0x9ec98[_0x2c81('0x23')]();};}function saveUpdates(_0x27bc2e,_0x46e141){return function(_0x5050ef){if(_0x5050ef){return _0x5050ef[_0x2c81('0x24')](_0x27bc2e)[_0x2c81('0x25')](function(_0x5e6593){return _0x5e6593;});}return null;};}function removeEntity(_0x296b46,_0x5d1d30){return function(_0x573dce){if(_0x573dce){return _0x573dce['destroy']()[_0x2c81('0x25')](function(){_0x296b46[_0x2c81('0x1a')](0xcc)[_0x2c81('0x1b')]();});}};}function handleEntityNotFound(_0x3e529f,_0x5a8980){return function(_0x3ca8bf){if(!_0x3ca8bf){_0x3e529f[_0x2c81('0x26')](0x194);}return _0x3ca8bf;};}function handleError(_0x34568e,_0x7ed8a0){_0x7ed8a0=_0x7ed8a0||0x1f4;return function(_0x309b2f){logger[_0x2c81('0x27')](_0x309b2f[_0x2c81('0x28')]);if(_0x309b2f['name']){delete _0x309b2f[_0x2c81('0x29')];}_0x34568e[_0x2c81('0x1a')](_0x7ed8a0)[_0x2c81('0x2a')](_0x309b2f);};}exports[_0x2c81('0x2b')]=function(_0xbc7426,_0x5959ab){var _0x2486fb={},_0xc98e18={},_0x2456ee={'count':0x0,'rows':[]};var _0xbf2d26=_[_0x2c81('0x2c')](db[_0x2c81('0x2d')][_0x2c81('0x2e')],function(_0x3adf97){return{'name':_0x3adf97[_0x2c81('0x2f')],'type':_0x3adf97[_0x2c81('0x30')][_0x2c81('0x31')]};});_0xc98e18[_0x2c81('0x32')]=_[_0x2c81('0x2c')](_0xbf2d26,_0x2c81('0x29'));_0xc98e18['query']=_[_0x2c81('0x33')](_0xbc7426[_0x2c81('0x34')]);_0xc98e18[_0x2c81('0x35')]=_[_0x2c81('0x36')](_0xc98e18['model'],_0xc98e18[_0x2c81('0x34')]);_0x2486fb[_0x2c81('0x37')]=_[_0x2c81('0x36')](_0xc98e18[_0x2c81('0x32')],qs[_0x2c81('0x38')](_0xbc7426[_0x2c81('0x34')][_0x2c81('0x38')]));_0x2486fb[_0x2c81('0x37')]=_0x2486fb[_0x2c81('0x37')][_0x2c81('0x39')]?_0x2486fb['attributes']:_0xc98e18['model'];if(!_0xbc7426[_0x2c81('0x34')][_0x2c81('0x3a')](_0x2c81('0x3b'))){_0x2486fb[_0x2c81('0x1e')]=qs[_0x2c81('0x1e')](_0xbc7426[_0x2c81('0x34')]['limit']);_0x2486fb[_0x2c81('0x1d')]=qs[_0x2c81('0x1d')](_0xbc7426['query']['offset']);}_0x2486fb['order']=qs[_0x2c81('0x3c')](_0xbc7426[_0x2c81('0x34')][_0x2c81('0x3c')]);_0x2486fb[_0x2c81('0x3d')]=qs[_0x2c81('0x35')](_[_0x2c81('0x3e')](_0xbc7426[_0x2c81('0x34')],_0xc98e18[_0x2c81('0x35')]),_0xbf2d26);if(_0xbc7426['query'][_0x2c81('0x3f')]){_0x2486fb[_0x2c81('0x3d')]=_[_0x2c81('0x40')](_0x2486fb[_0x2c81('0x3d')],{'$or':_[_0x2c81('0x2c')](_0xbf2d26,function(_0x221f2b){if(_0x221f2b[_0x2c81('0x30')]!==_0x2c81('0x41')){var _0x3a7884={};_0x3a7884[_0x221f2b[_0x2c81('0x29')]]={'$like':'%'+_0xbc7426[_0x2c81('0x34')][_0x2c81('0x3f')]+'%'};return _0x3a7884;}})});}_0x2486fb=_[_0x2c81('0x40')]({},_0x2486fb,_0xbc7426[_0x2c81('0x42')]);var _0x43e4ff={'where':_0x2486fb[_0x2c81('0x3d')]};return db[_0x2c81('0x2d')]['count'](_0x43e4ff)[_0x2c81('0x25')](function(_0x57a86f){_0x2456ee[_0x2c81('0x43')]=_0x57a86f;if(_0xbc7426[_0x2c81('0x34')]['includeAll']){_0x2486fb[_0x2c81('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x2c81('0x45')](_0x2486fb);})['then'](function(_0x2d812e){_0x2456ee[_0x2c81('0x46')]=_0x2d812e;return _0x2456ee;})[_0x2c81('0x25')](respondWithFilteredResult(_0x5959ab,_0x2486fb))[_0x2c81('0x47')](handleError(_0x5959ab,null));};exports[_0x2c81('0x48')]=function(_0x2c0c2e,_0x20d254){var _0x493dc8={'raw':!![],'where':{'id':_0x2c0c2e[_0x2c81('0x49')]['id']}},_0x594ead={};_0x594ead[_0x2c81('0x32')]=_[_0x2c81('0x33')](db[_0x2c81('0x2d')][_0x2c81('0x2e')]);_0x594ead[_0x2c81('0x34')]=_[_0x2c81('0x33')](_0x2c0c2e['query']);_0x594ead['filters']=_[_0x2c81('0x36')](_0x594ead[_0x2c81('0x32')],_0x594ead['query']);_0x493dc8[_0x2c81('0x37')]=_[_0x2c81('0x36')](_0x594ead[_0x2c81('0x32')],qs[_0x2c81('0x38')](_0x2c0c2e[_0x2c81('0x34')][_0x2c81('0x38')]));_0x493dc8[_0x2c81('0x37')]=_0x493dc8[_0x2c81('0x37')][_0x2c81('0x39')]?_0x493dc8[_0x2c81('0x37')]:_0x594ead[_0x2c81('0x32')];if(_0x2c0c2e[_0x2c81('0x34')][_0x2c81('0x4a')]){_0x493dc8['include']=[{'all':!![]}];}_0x493dc8=_[_0x2c81('0x40')]({},_0x493dc8,_0x2c0c2e[_0x2c81('0x42')]);return db[_0x2c81('0x2d')]['find'](_0x493dc8)[_0x2c81('0x25')](handleEntityNotFound(_0x20d254,null))['then'](respondWithResult(_0x20d254,null))[_0x2c81('0x47')](handleError(_0x20d254,null));};exports[_0x2c81('0x4b')]=function(_0x7cc606,_0x29e268){return db[_0x2c81('0x2d')][_0x2c81('0x4b')](_0x7cc606[_0x2c81('0x4c')],{})[_0x2c81('0x25')](respondWithResult(_0x29e268,0xc9))[_0x2c81('0x47')](handleError(_0x29e268,null));};exports['update']=function(_0x299f15,_0x7c08){if(_0x299f15[_0x2c81('0x4c')]['id']){delete _0x299f15['body']['id'];}return db[_0x2c81('0x2d')][_0x2c81('0x4d')]({'where':{'id':_0x299f15[_0x2c81('0x49')]['id']}})[_0x2c81('0x25')](handleEntityNotFound(_0x7c08,null))[_0x2c81('0x25')](saveUpdates(_0x299f15[_0x2c81('0x4c')],null))[_0x2c81('0x25')](respondWithResult(_0x7c08,null))[_0x2c81('0x47')](handleError(_0x7c08,null));};exports[_0x2c81('0x4e')]=function(_0x345a3c,_0x53fe5f){return db[_0x2c81('0x2d')][_0x2c81('0x4d')]({'where':{'id':_0x345a3c[_0x2c81('0x49')]['id']}})[_0x2c81('0x25')](handleEntityNotFound(_0x53fe5f,null))[_0x2c81('0x25')](removeEntity(_0x53fe5f,null))[_0x2c81('0x47')](handleError(_0x53fe5f,null));};exports[_0x2c81('0x4f')]=function(_0x152c04,_0x4d31f6){return db[_0x2c81('0x2d')][_0x2c81('0x4f')]()['then'](respondWithResult(_0x4d31f6,null))['catch'](handleError(_0x4d31f6,null));}; \ No newline at end of file +var _0xfd50=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','SquareReport','includeAll','findAll','rows','catch','show','params','create','body','find'];(function(_0x55d2c0,_0xee931a){var _0x4beda6=function(_0x1092df){while(--_0x1092df){_0x55d2c0['push'](_0x55d2c0['shift']());}};_0x4beda6(++_0xee931a);}(_0xfd50,0x178));var _0x0fd5=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xfd50[_0x4b2863];return _0x567d67;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0fd5('0x0'));var rimraf=require(_0x0fd5('0x1'));var zipdir=require(_0x0fd5('0x2'));var jsonpatch=require(_0x0fd5('0x3'));var rp=require(_0x0fd5('0x4'));var moment=require('moment');var BPromise=require(_0x0fd5('0x5'));var Mustache=require(_0x0fd5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0fd5('0x7'));var csv=require(_0x0fd5('0x8'));var ejs=require(_0x0fd5('0x9'));var fs=require('fs');var _=require(_0x0fd5('0xa'));var squel=require('squel');var crypto=require(_0x0fd5('0xb'));var jsforce=require(_0x0fd5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0fd5('0x8'));var querystring=require(_0x0fd5('0xd'));var Papa=require(_0x0fd5('0xe'));var Redis=require(_0x0fd5('0xf'));var authService=require(_0x0fd5('0x10'));var qs=require(_0x0fd5('0x11'));var as=require(_0x0fd5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fd5('0x13'))(_0x0fd5('0x14'));var utils=require('../../config/utils');var config=require(_0x0fd5('0x15'));var licenseUtil=require(_0x0fd5('0x16'));var db=require(_0x0fd5('0x17'))['db'];function respondWithStatusCode(_0x3ed5ab,_0x32bee0){_0x32bee0=_0x32bee0||0xcc;return function(_0x13ea82){if(_0x13ea82){return _0x3ed5ab[_0x0fd5('0x18')](_0x32bee0);}return _0x3ed5ab['status'](_0x32bee0)['end']();};}function respondWithResult(_0x2c9452,_0x4fc89b){_0x4fc89b=_0x4fc89b||0xc8;return function(_0x373420){if(_0x373420){return _0x2c9452[_0x0fd5('0x19')](_0x4fc89b)[_0x0fd5('0x1a')](_0x373420);}};}function respondWithFilteredResult(_0xd8e3f5,_0x200639){return function(_0x5e2911){if(_0x5e2911){var _0x1e70cf=_0x5e2911[_0x0fd5('0x1b')],_0xf1d476=_0x200639[_0x0fd5('0x1c')],_0x2721d9=_0x200639['offset']+_0x200639[_0x0fd5('0x1d')],_0x2a9cb7;if(_0x2721d9>=_0x1e70cf){_0x2721d9=_0x1e70cf;_0x2a9cb7=0xc8;}else{_0x2a9cb7=0xce;}_0xd8e3f5[_0x0fd5('0x19')](_0x2a9cb7);return _0xd8e3f5[_0x0fd5('0x1e')](_0x0fd5('0x1f'),_0xf1d476+'-'+_0x2721d9+'/'+_0x1e70cf)[_0x0fd5('0x1a')](_0x5e2911);}return null;};}function patchUpdates(_0x49c432){return function(_0xd6bf91){try{jsonpatch[_0x0fd5('0x20')](_0xd6bf91,_0x49c432,!![]);}catch(_0x132df5){return BPromise[_0x0fd5('0x21')](_0x132df5);}return _0xd6bf91[_0x0fd5('0x22')]();};}function saveUpdates(_0x50af04,_0x1c1e11){return function(_0x57a109){if(_0x57a109){return _0x57a109[_0x0fd5('0x23')](_0x50af04)[_0x0fd5('0x24')](function(_0x542a1a){return _0x542a1a;});}return null;};}function removeEntity(_0x87f640,_0xf5cefa){return function(_0x349fda){if(_0x349fda){return _0x349fda[_0x0fd5('0x25')]()['then'](function(){_0x87f640[_0x0fd5('0x19')](0xcc)[_0x0fd5('0x26')]();});}};}function handleEntityNotFound(_0x216034,_0x236e1e){return function(_0x5ba461){if(!_0x5ba461){_0x216034[_0x0fd5('0x18')](0x194);}return _0x5ba461;};}function handleError(_0x204490,_0xe0c5f5){_0xe0c5f5=_0xe0c5f5||0x1f4;return function(_0x2235d0){logger[_0x0fd5('0x27')](_0x2235d0[_0x0fd5('0x28')]);if(_0x2235d0[_0x0fd5('0x29')]){delete _0x2235d0[_0x0fd5('0x29')];}_0x204490[_0x0fd5('0x19')](_0xe0c5f5)[_0x0fd5('0x2a')](_0x2235d0);};}exports[_0x0fd5('0x2b')]=function(_0x2b0991,_0x2596d7){var _0x52a6a2={},_0x4e4a5d={},_0x597c06={'count':0x0,'rows':[]};var _0x594edf=_[_0x0fd5('0x2c')](db['SquareReport'][_0x0fd5('0x2d')],function(_0x28199e){return{'name':_0x28199e[_0x0fd5('0x2e')],'type':_0x28199e[_0x0fd5('0x2f')]['key']};});_0x4e4a5d[_0x0fd5('0x30')]=_[_0x0fd5('0x2c')](_0x594edf,_0x0fd5('0x29'));_0x4e4a5d['query']=_[_0x0fd5('0x31')](_0x2b0991[_0x0fd5('0x32')]);_0x4e4a5d[_0x0fd5('0x33')]=_[_0x0fd5('0x34')](_0x4e4a5d[_0x0fd5('0x30')],_0x4e4a5d['query']);_0x52a6a2[_0x0fd5('0x35')]=_['intersection'](_0x4e4a5d['model'],qs[_0x0fd5('0x36')](_0x2b0991['query'][_0x0fd5('0x36')]));_0x52a6a2[_0x0fd5('0x35')]=_0x52a6a2[_0x0fd5('0x35')][_0x0fd5('0x37')]?_0x52a6a2[_0x0fd5('0x35')]:_0x4e4a5d[_0x0fd5('0x30')];if(!_0x2b0991[_0x0fd5('0x32')][_0x0fd5('0x38')]('nolimit')){_0x52a6a2[_0x0fd5('0x1d')]=qs[_0x0fd5('0x1d')](_0x2b0991[_0x0fd5('0x32')][_0x0fd5('0x1d')]);_0x52a6a2[_0x0fd5('0x1c')]=qs[_0x0fd5('0x1c')](_0x2b0991[_0x0fd5('0x32')][_0x0fd5('0x1c')]);}_0x52a6a2[_0x0fd5('0x39')]=qs[_0x0fd5('0x3a')](_0x2b0991[_0x0fd5('0x32')][_0x0fd5('0x3a')]);_0x52a6a2[_0x0fd5('0x3b')]=qs[_0x0fd5('0x33')](_['pick'](_0x2b0991['query'],_0x4e4a5d[_0x0fd5('0x33')]),_0x594edf);if(_0x2b0991['query']['filter']){_0x52a6a2[_0x0fd5('0x3b')]=_[_0x0fd5('0x3c')](_0x52a6a2[_0x0fd5('0x3b')],{'$or':_[_0x0fd5('0x2c')](_0x594edf,function(_0x118525){if(_0x118525[_0x0fd5('0x2f')]!==_0x0fd5('0x3d')){var _0x1879a6={};_0x1879a6[_0x118525[_0x0fd5('0x29')]]={'$like':'%'+_0x2b0991[_0x0fd5('0x32')][_0x0fd5('0x3e')]+'%'};return _0x1879a6;}})});}_0x52a6a2=_[_0x0fd5('0x3c')]({},_0x52a6a2,_0x2b0991[_0x0fd5('0x3f')]);var _0x2cd18d={'where':_0x52a6a2[_0x0fd5('0x3b')]};return db[_0x0fd5('0x40')]['count'](_0x2cd18d)[_0x0fd5('0x24')](function(_0x5e1261){_0x597c06[_0x0fd5('0x1b')]=_0x5e1261;if(_0x2b0991[_0x0fd5('0x32')][_0x0fd5('0x41')]){_0x52a6a2['include']=[{'all':!![]}];}return db[_0x0fd5('0x40')][_0x0fd5('0x42')](_0x52a6a2);})['then'](function(_0x3ebdc0){_0x597c06[_0x0fd5('0x43')]=_0x3ebdc0;return _0x597c06;})['then'](respondWithFilteredResult(_0x2596d7,_0x52a6a2))[_0x0fd5('0x44')](handleError(_0x2596d7,null));};exports[_0x0fd5('0x45')]=function(_0x70c17b,_0x32b088){var _0x276872={'raw':!![],'where':{'id':_0x70c17b[_0x0fd5('0x46')]['id']}},_0x3878d1={};_0x3878d1[_0x0fd5('0x30')]=_[_0x0fd5('0x31')](db[_0x0fd5('0x40')][_0x0fd5('0x2d')]);_0x3878d1[_0x0fd5('0x32')]=_[_0x0fd5('0x31')](_0x70c17b[_0x0fd5('0x32')]);_0x3878d1[_0x0fd5('0x33')]=_['intersection'](_0x3878d1[_0x0fd5('0x30')],_0x3878d1[_0x0fd5('0x32')]);_0x276872[_0x0fd5('0x35')]=_[_0x0fd5('0x34')](_0x3878d1[_0x0fd5('0x30')],qs[_0x0fd5('0x36')](_0x70c17b[_0x0fd5('0x32')][_0x0fd5('0x36')]));_0x276872['attributes']=_0x276872[_0x0fd5('0x35')][_0x0fd5('0x37')]?_0x276872[_0x0fd5('0x35')]:_0x3878d1[_0x0fd5('0x30')];if(_0x70c17b[_0x0fd5('0x32')][_0x0fd5('0x41')]){_0x276872['include']=[{'all':!![]}];}_0x276872=_[_0x0fd5('0x3c')]({},_0x276872,_0x70c17b['options']);return db['SquareReport']['find'](_0x276872)[_0x0fd5('0x24')](handleEntityNotFound(_0x32b088,null))[_0x0fd5('0x24')](respondWithResult(_0x32b088,null))[_0x0fd5('0x44')](handleError(_0x32b088,null));};exports['create']=function(_0x1c9476,_0x36894a){return db[_0x0fd5('0x40')][_0x0fd5('0x47')](_0x1c9476['body'],{})[_0x0fd5('0x24')](respondWithResult(_0x36894a,0xc9))['catch'](handleError(_0x36894a,null));};exports[_0x0fd5('0x23')]=function(_0x2ebf9b,_0x1c2022){if(_0x2ebf9b[_0x0fd5('0x48')]['id']){delete _0x2ebf9b['body']['id'];}return db[_0x0fd5('0x40')][_0x0fd5('0x49')]({'where':{'id':_0x2ebf9b['params']['id']}})[_0x0fd5('0x24')](handleEntityNotFound(_0x1c2022,null))[_0x0fd5('0x24')](saveUpdates(_0x2ebf9b[_0x0fd5('0x48')],null))[_0x0fd5('0x24')](respondWithResult(_0x1c2022,null))['catch'](handleError(_0x1c2022,null));};exports[_0x0fd5('0x25')]=function(_0x5c8154,_0x29a5bf){return db[_0x0fd5('0x40')][_0x0fd5('0x49')]({'where':{'id':_0x5c8154[_0x0fd5('0x46')]['id']}})[_0x0fd5('0x24')](handleEntityNotFound(_0x29a5bf,null))[_0x0fd5('0x24')](removeEntity(_0x29a5bf,null))[_0x0fd5('0x44')](handleError(_0x29a5bf,null));};exports[_0x0fd5('0x4a')]=function(_0x31959b,_0x596063){return db[_0x0fd5('0x40')][_0x0fd5('0x4a')]()[_0x0fd5('0x24')](respondWithResult(_0x596063,null))[_0x0fd5('0x44')](handleError(_0x596063,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3a0f34a..2b91138 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 _0x0284=['SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareReport.attributes','exports','define'];(function(_0x31866c,_0x5ed969){var _0x37af94=function(_0x377e3a){while(--_0x377e3a){_0x31866c['push'](_0x31866c['shift']());}};_0x37af94(++_0x5ed969);}(_0x0284,0xb5));var _0x4028=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x0284[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0x4028('0x0'));var util=require(_0x4028('0x1'));var logger=require(_0x4028('0x2'))(_0x4028('0x3'));var moment=require(_0x4028('0x4'));var BPromise=require('bluebird');var rp=require(_0x4028('0x5'));var fs=require('fs');var path=require(_0x4028('0x6'));var rimraf=require(_0x4028('0x7'));var config=require('../../config/environment');var attributes=require(_0x4028('0x8'));module[_0x4028('0x9')]=function(_0x411356,_0x5ab968){return _0x411356[_0x4028('0xa')](_0x4028('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x4028('0xc'),'fields':[_0x4028('0xd'),_0x4028('0xe')]},{'name':_0x4028('0xf'),'fields':[_0x4028('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x03cc=['exports','SquareReport','report_square','uid_pname','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x49ca50,_0x3225f9){var _0x1ba0ac=function(_0x14bd83){while(--_0x14bd83){_0x49ca50['push'](_0x49ca50['shift']());}};_0x1ba0ac(++_0x3225f9);}(_0x03cc,0x1e0));var _0xc03c=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x03cc[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xc03c('0x0'));var util=require(_0xc03c('0x1'));var logger=require(_0xc03c('0x2'))(_0xc03c('0x3'));var moment=require(_0xc03c('0x4'));var BPromise=require(_0xc03c('0x5'));var rp=require(_0xc03c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc03c('0x7'));var config=require(_0xc03c('0x8'));var attributes=require(_0xc03c('0x9'));module[_0xc03c('0xa')]=function(_0x48a63c,_0x18804e){return _0x48a63c['define'](_0xc03c('0xb'),attributes,{'tableName':_0xc03c('0xc'),'paranoid':![],'indexes':[{'name':_0xc03c('0xd'),'fields':['uniqueid','project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index beca26a..3e91f0e 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 _0x8d0e=['../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','options','CreateSquareReport','debug','update','body','raw','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4176c4,_0x169a1c){_0x4176c4=_0x4176c4-0x0;var _0x1a47dd=_0x8d0e[_0x4176c4];return _0x1a47dd;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('SquareReport,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});}exports['CreateSquareReport']=function(_0x47c67a){var _0x1bdd94=this;return new Promise(function(_0x384854,_0x27b910){return db[_0xe8d0('0x16')][_0xe8d0('0x17')](_0x47c67a['body'],{'raw':_0x47c67a[_0xe8d0('0x18')]?_0x47c67a[_0xe8d0('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x554402){logger[_0xe8d0('0xd')](_0xe8d0('0x19'),_0x47c67a);logger[_0xe8d0('0x1a')](_0xe8d0('0x19'),_0x47c67a,JSON[_0xe8d0('0x10')](_0x554402));_0x384854(_0x554402);})[_0xe8d0('0x15')](function(_0x1bd25c){logger[_0xe8d0('0x11')](_0xe8d0('0x19'),_0x1bd25c['message'],_0x47c67a);_0x27b910(_0x1bdd94[_0xe8d0('0x11')](0x1f4,_0x1bd25c[_0xe8d0('0x13')]));});});};exports['UpdateSquareReport']=function(_0x106614){var _0x2e69d1=this;return new Promise(function(_0x274cac,_0xd86c76){return db[_0xe8d0('0x16')][_0xe8d0('0x1b')](_0x106614[_0xe8d0('0x1c')],{'raw':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')][_0xe8d0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106614[_0xe8d0('0x18')]?_0x106614['options'][_0xe8d0('0x1e')]||null:null,'attributes':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['attributes']||null:null,'limit':_0x106614[_0xe8d0('0x18')]?_0x106614[_0xe8d0('0x18')]['limit']||null:null})[_0xe8d0('0xc')](function(_0x3ffcb7){logger[_0xe8d0('0xd')](_0xe8d0('0x1f'),_0x106614);logger[_0xe8d0('0x1a')]('UpdateSquareReport',_0x106614,JSON[_0xe8d0('0x10')](_0x3ffcb7));_0x274cac(_0x3ffcb7);})['catch'](function(_0x5d3276){logger['error'](_0xe8d0('0x1f'),_0x5d3276[_0xe8d0('0x13')],_0x106614);_0xd86c76(_0x2e69d1[_0xe8d0('0x11')](0x1f4,_0x5d3276['message']));});});}; \ No newline at end of file +var _0x9957=['catch','CreateSquareReport','create','options','raw','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2bc326,_0x473cf8){var _0x43722e=function(_0x4dd559){while(--_0x4dd559){_0x2bc326['push'](_0x2bc326['shift']());}};_0x43722e(++_0x473cf8);}(_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 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']('SquareReport,\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['SquareReport'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3a9b54){logger['info']('CreateSquareReport',_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x3a9b54));_0x37a7d4(_0x3a9b54);})[_0x7995('0x17')](function(_0x460924){logger[_0x7995('0x13')]('CreateSquareReport',_0x460924[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x460924[_0x7995('0x15')]));});});};exports[_0x7995('0x1c')]=function(_0x563799){var _0x13bc35=this;return new Promise(function(_0x475351,_0x472195){return db['SquareReport'][_0x7995('0x1d')](_0x563799[_0x7995('0x1e')],{'raw':_0x563799[_0x7995('0x1a')]?_0x563799[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x563799[_0x7995('0x1a')]?_0x563799['options'][_0x7995('0x1f')]||null:null,'attributes':_0x563799['options']?_0x563799[_0x7995('0x1a')][_0x7995('0x20')]||null:null,'limit':_0x563799[_0x7995('0x1a')]?_0x563799[_0x7995('0x1a')][_0x7995('0x21')]||null:null})['then'](function(_0x9b2a15){logger['info'](_0x7995('0x1c'),_0x563799);logger[_0x7995('0x10')](_0x7995('0x1c'),_0x563799,JSON['stringify'](_0x9b2a15));_0x475351(_0x9b2a15);})['catch'](function(_0x48e573){logger[_0x7995('0x13')](_0x7995('0x1c'),_0x48e573[_0x7995('0x15')],_0x563799);_0x472195(_0x13bc35[_0x7995('0x13')](0x1f4,_0x48e573[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a52e082..fdd0dfc 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0xbd7e9a,_0x1b3bf8){var _0x107d66=function(_0x348299){while(--_0x348299){_0xbd7e9a['push'](_0xbd7e9a['shift']());}};_0x107d66(++_0x1b3bf8);}(_0x7a54,0x106));var _0x47a5=function(_0x1e7d75,_0x6dbdd5){_0x1e7d75=_0x1e7d75-0x0;var _0x1e50dd=_0x7a54[_0x1e7d75];return _0x1e50dd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x57785b,_0x1b3608){var _0x1080fd=function(_0x48af97){while(--_0x48af97){_0x57785b['push'](_0x57785b['shift']());}};_0x1080fd(++_0x1b3608);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3785ad,_0x4e9080){_0x3785ad=_0x3785ad-0x0;var _0x325a85=_0x5f2f[_0x3785ad];return _0x325a85;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b6b8742..8792027 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 _0xdd30=['exports','STRING','TEXT','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xdd30,0x93));var _0x0dd3=function(_0x3ee36d,_0x4f3b41){_0x3ee36d=_0x3ee36d-0x0;var _0x1677a9=_0xdd30[_0x3ee36d];return _0x1677a9;};'use strict';var Sequelize=require(_0x0dd3('0x0'));module[_0x0dd3('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0dd3('0x2')]},'data':{'type':Sequelize[_0x0dd3('0x3')]},'project_name':{'type':Sequelize[_0x0dd3('0x2')]},'callerid':{'type':Sequelize[_0x0dd3('0x2')]}}; \ No newline at end of file +var _0x898b=['TEXT','sequelize','STRING'];(function(_0x11c451,_0x388218){var _0x2d405e=function(_0x247f88){while(--_0x247f88){_0x11c451['push'](_0x11c451['shift']());}};_0x2d405e(++_0x388218);}(_0x898b,0x1ba));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb898('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb898('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xb898('0x1')]},'data':{'type':Sequelize[_0xb898('0x2')]},'project_name':{'type':Sequelize[_0xb898('0x1')]},'callerid':{'type':Sequelize[_0xb898('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 66dd601..fa57094 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 _0x28cc=['sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','SquareDetailsReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','merge','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x137043,_0x432ec0){var _0x135ae7=function(_0x289aa4){while(--_0x289aa4){_0x137043['push'](_0x137043['shift']());}};_0x135ae7(++_0x432ec0);}(_0x28cc,0x180));var _0xc28c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x28cc[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xc28c('0x0'));var emlformat=require(_0xc28c('0x1'));var rimraf=require(_0xc28c('0x2'));var zipdir=require(_0xc28c('0x3'));var jsonpatch=require(_0xc28c('0x4'));var rp=require(_0xc28c('0x5'));var moment=require(_0xc28c('0x6'));var BPromise=require(_0xc28c('0x7'));var Mustache=require(_0xc28c('0x8'));var util=require(_0xc28c('0x9'));var path=require(_0xc28c('0xa'));var sox=require(_0xc28c('0xb'));var csv=require(_0xc28c('0xc'));var ejs=require(_0xc28c('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc28c('0xe'));var crypto=require(_0xc28c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc28c('0x10'));var toCsv=require(_0xc28c('0xc'));var querystring=require('querystring');var Papa=require(_0xc28c('0x11'));var Redis=require(_0xc28c('0x12'));var authService=require(_0xc28c('0x13'));var qs=require(_0xc28c('0x14'));var as=require(_0xc28c('0x15'));var hardwareService=require(_0xc28c('0x16'));var logger=require(_0xc28c('0x17'))(_0xc28c('0x18'));var utils=require(_0xc28c('0x19'));var config=require(_0xc28c('0x1a'));var licenseUtil=require(_0xc28c('0x1b'));var db=require(_0xc28c('0x1c'))['db'];function respondWithStatusCode(_0x1bce4f,_0x41f130){_0x41f130=_0x41f130||0xcc;return function(_0x2930ef){if(_0x2930ef){return _0x1bce4f['sendStatus'](_0x41f130);}return _0x1bce4f['status'](_0x41f130)[_0xc28c('0x1d')]();};}function respondWithResult(_0x1c57ad,_0x19fbf3){_0x19fbf3=_0x19fbf3||0xc8;return function(_0x11ccad){if(_0x11ccad){return _0x1c57ad[_0xc28c('0x1e')](_0x19fbf3)[_0xc28c('0x1f')](_0x11ccad);}};}function respondWithFilteredResult(_0x37e128,_0x527329){return function(_0x47d104){if(_0x47d104){var _0x5daf5d=_0x47d104[_0xc28c('0x20')],_0x4549df=_0x527329[_0xc28c('0x21')],_0x113909=_0x527329[_0xc28c('0x21')]+_0x527329[_0xc28c('0x22')],_0x401938;if(_0x113909>=_0x5daf5d){_0x113909=_0x5daf5d;_0x401938=0xc8;}else{_0x401938=0xce;}_0x37e128[_0xc28c('0x1e')](_0x401938);return _0x37e128[_0xc28c('0x23')](_0xc28c('0x24'),_0x4549df+'-'+_0x113909+'/'+_0x5daf5d)[_0xc28c('0x1f')](_0x47d104);}return null;};}function patchUpdates(_0x2c850e){return function(_0x17e023){try{jsonpatch[_0xc28c('0x25')](_0x17e023,_0x2c850e,!![]);}catch(_0xf26ae9){return BPromise['reject'](_0xf26ae9);}return _0x17e023[_0xc28c('0x26')]();};}function saveUpdates(_0x470340,_0x2b96c9){return function(_0x2511bb){if(_0x2511bb){return _0x2511bb[_0xc28c('0x27')](_0x470340)[_0xc28c('0x28')](function(_0x508785){return _0x508785;});}return null;};}function removeEntity(_0x4808b8,_0x3c6cc8){return function(_0x35baad){if(_0x35baad){return _0x35baad[_0xc28c('0x29')]()[_0xc28c('0x28')](function(){_0x4808b8[_0xc28c('0x1e')](0xcc)[_0xc28c('0x1d')]();});}};}function handleEntityNotFound(_0xbf7f5a,_0x32ee3a){return function(_0x50dc99){if(!_0x50dc99){_0xbf7f5a[_0xc28c('0x2a')](0x194);}return _0x50dc99;};}function handleError(_0x558cca,_0x2c1f7c){_0x2c1f7c=_0x2c1f7c||0x1f4;return function(_0x1cc832){logger['error'](_0x1cc832[_0xc28c('0x2b')]);if(_0x1cc832[_0xc28c('0x2c')]){delete _0x1cc832[_0xc28c('0x2c')];}_0x558cca[_0xc28c('0x1e')](_0x2c1f7c)[_0xc28c('0x2d')](_0x1cc832);};}exports[_0xc28c('0x2e')]=function(_0x4f4a50,_0x392625){var _0x3ac7dc={},_0xec9c2={},_0x1dbecc={'count':0x0,'rows':[]};var _0x31de48=_[_0xc28c('0x2f')](db[_0xc28c('0x30')][_0xc28c('0x31')],function(_0x51bcf1){return{'name':_0x51bcf1['fieldName'],'type':_0x51bcf1['type'][_0xc28c('0x32')]};});_0xec9c2['model']=_[_0xc28c('0x2f')](_0x31de48,'name');_0xec9c2[_0xc28c('0x33')]=_[_0xc28c('0x34')](_0x4f4a50['query']);_0xec9c2[_0xc28c('0x35')]=_[_0xc28c('0x36')](_0xec9c2[_0xc28c('0x37')],_0xec9c2[_0xc28c('0x33')]);_0x3ac7dc[_0xc28c('0x38')]=_[_0xc28c('0x36')](_0xec9c2[_0xc28c('0x37')],qs['fields'](_0x4f4a50['query'][_0xc28c('0x39')]));_0x3ac7dc[_0xc28c('0x38')]=_0x3ac7dc[_0xc28c('0x38')][_0xc28c('0x3a')]?_0x3ac7dc[_0xc28c('0x38')]:_0xec9c2[_0xc28c('0x37')];if(!_0x4f4a50[_0xc28c('0x33')][_0xc28c('0x3b')](_0xc28c('0x3c'))){_0x3ac7dc[_0xc28c('0x22')]=qs['limit'](_0x4f4a50['query']['limit']);_0x3ac7dc[_0xc28c('0x21')]=qs[_0xc28c('0x21')](_0x4f4a50[_0xc28c('0x33')][_0xc28c('0x21')]);}_0x3ac7dc['order']=qs[_0xc28c('0x3d')](_0x4f4a50[_0xc28c('0x33')]['sort']);_0x3ac7dc[_0xc28c('0x3e')]=qs[_0xc28c('0x35')](_[_0xc28c('0x3f')](_0x4f4a50['query'],_0xec9c2['filters']),_0x31de48);if(_0x4f4a50[_0xc28c('0x33')][_0xc28c('0x40')]){_0x3ac7dc['where']=_['merge'](_0x3ac7dc['where'],{'$or':_[_0xc28c('0x2f')](_0x31de48,function(_0x3c579b){if(_0x3c579b[_0xc28c('0x41')]!==_0xc28c('0x42')){var _0x189902={};_0x189902[_0x3c579b[_0xc28c('0x2c')]]={'$like':'%'+_0x4f4a50[_0xc28c('0x33')][_0xc28c('0x40')]+'%'};return _0x189902;}})});}_0x3ac7dc=_['merge']({},_0x3ac7dc,_0x4f4a50[_0xc28c('0x43')]);var _0x59ef7e={'where':_0x3ac7dc[_0xc28c('0x3e')]};return db[_0xc28c('0x30')][_0xc28c('0x20')](_0x59ef7e)[_0xc28c('0x28')](function(_0x29f089){_0x1dbecc['count']=_0x29f089;if(_0x4f4a50['query'][_0xc28c('0x44')]){_0x3ac7dc['include']=[{'all':!![]}];}return db[_0xc28c('0x30')][_0xc28c('0x45')](_0x3ac7dc);})[_0xc28c('0x28')](function(_0x44699c){_0x1dbecc[_0xc28c('0x46')]=_0x44699c;return _0x1dbecc;})[_0xc28c('0x28')](respondWithFilteredResult(_0x392625,_0x3ac7dc))[_0xc28c('0x47')](handleError(_0x392625,null));};exports[_0xc28c('0x48')]=function(_0x5a920a,_0x5cdd0e){var _0x2ea7a4={'raw':!![],'where':{'id':_0x5a920a['params']['id']}},_0xe845ff={};_0xe845ff[_0xc28c('0x37')]=_['keys'](db[_0xc28c('0x30')][_0xc28c('0x31')]);_0xe845ff[_0xc28c('0x33')]=_[_0xc28c('0x34')](_0x5a920a[_0xc28c('0x33')]);_0xe845ff[_0xc28c('0x35')]=_[_0xc28c('0x36')](_0xe845ff[_0xc28c('0x37')],_0xe845ff[_0xc28c('0x33')]);_0x2ea7a4[_0xc28c('0x38')]=_[_0xc28c('0x36')](_0xe845ff[_0xc28c('0x37')],qs['fields'](_0x5a920a[_0xc28c('0x33')][_0xc28c('0x39')]));_0x2ea7a4[_0xc28c('0x38')]=_0x2ea7a4[_0xc28c('0x38')][_0xc28c('0x3a')]?_0x2ea7a4[_0xc28c('0x38')]:_0xe845ff[_0xc28c('0x37')];if(_0x5a920a[_0xc28c('0x33')]['includeAll']){_0x2ea7a4[_0xc28c('0x49')]=[{'all':!![]}];}_0x2ea7a4=_[_0xc28c('0x4a')]({},_0x2ea7a4,_0x5a920a[_0xc28c('0x43')]);return db[_0xc28c('0x30')]['find'](_0x2ea7a4)[_0xc28c('0x28')](handleEntityNotFound(_0x5cdd0e,null))[_0xc28c('0x28')](respondWithResult(_0x5cdd0e,null))[_0xc28c('0x47')](handleError(_0x5cdd0e,null));};exports['create']=function(_0x1b0603,_0x392c24){return db['SquareDetailsReport'][_0xc28c('0x4b')](_0x1b0603[_0xc28c('0x4c')],{})[_0xc28c('0x28')](respondWithResult(_0x392c24,0xc9))[_0xc28c('0x47')](handleError(_0x392c24,null));};exports['update']=function(_0x4496a5,_0x5a07e4){if(_0x4496a5[_0xc28c('0x4c')]['id']){delete _0x4496a5[_0xc28c('0x4c')]['id'];}return db['SquareDetailsReport'][_0xc28c('0x4d')]({'where':{'id':_0x4496a5[_0xc28c('0x4e')]['id']}})[_0xc28c('0x28')](handleEntityNotFound(_0x5a07e4,null))[_0xc28c('0x28')](saveUpdates(_0x4496a5[_0xc28c('0x4c')],null))[_0xc28c('0x28')](respondWithResult(_0x5a07e4,null))['catch'](handleError(_0x5a07e4,null));};exports[_0xc28c('0x29')]=function(_0x2e2740,_0x4b1b4b){return db[_0xc28c('0x30')]['find']({'where':{'id':_0x2e2740[_0xc28c('0x4e')]['id']}})[_0xc28c('0x28')](handleEntityNotFound(_0x4b1b4b,null))['then'](removeEntity(_0x4b1b4b,null))[_0xc28c('0x47')](handleError(_0x4b1b4b,null));};exports['describe']=function(_0xb22af6,_0x45fbbe){return db['SquareDetailsReport']['describe']()[_0xc28c('0x28')](respondWithResult(_0x45fbbe,null))[_0xc28c('0x47')](handleError(_0x45fbbe,null));}; \ No newline at end of file +var _0x7a8b=['VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x386095,_0x2a26df){var _0x41e3f8=function(_0x297f14){while(--_0x297f14){_0x386095['push'](_0x386095['shift']());}};_0x41e3f8(++_0x2a26df);}(_0x7a8b,0x153));var _0xb7a8=function(_0x209f4d,_0x3a4a53){_0x209f4d=_0x209f4d-0x0;var _0x4533a1=_0x7a8b[_0x209f4d];return _0x4533a1;};'use strict';var pdf=require(_0xb7a8('0x0'));var emlformat=require(_0xb7a8('0x1'));var rimraf=require(_0xb7a8('0x2'));var zipdir=require(_0xb7a8('0x3'));var jsonpatch=require(_0xb7a8('0x4'));var rp=require(_0xb7a8('0x5'));var moment=require(_0xb7a8('0x6'));var BPromise=require(_0xb7a8('0x7'));var Mustache=require('mustache');var util=require(_0xb7a8('0x8'));var path=require(_0xb7a8('0x9'));var sox=require('sox');var csv=require(_0xb7a8('0xa'));var ejs=require(_0xb7a8('0xb'));var fs=require('fs');var _=require(_0xb7a8('0xc'));var squel=require(_0xb7a8('0xd'));var crypto=require(_0xb7a8('0xe'));var jsforce=require(_0xb7a8('0xf'));var deskjs=require(_0xb7a8('0x10'));var toCsv=require(_0xb7a8('0xa'));var querystring=require(_0xb7a8('0x11'));var Papa=require(_0xb7a8('0x12'));var Redis=require(_0xb7a8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb7a8('0x14'));var as=require(_0xb7a8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7a8('0x16'))(_0xb7a8('0x17'));var utils=require(_0xb7a8('0x18'));var config=require(_0xb7a8('0x19'));var licenseUtil=require(_0xb7a8('0x1a'));var db=require(_0xb7a8('0x1b'))['db'];function respondWithStatusCode(_0x226575,_0x2788d5){_0x2788d5=_0x2788d5||0xcc;return function(_0x26bd54){if(_0x26bd54){return _0x226575[_0xb7a8('0x1c')](_0x2788d5);}return _0x226575[_0xb7a8('0x1d')](_0x2788d5)[_0xb7a8('0x1e')]();};}function respondWithResult(_0x7210d3,_0x477773){_0x477773=_0x477773||0xc8;return function(_0x124863){if(_0x124863){return _0x7210d3[_0xb7a8('0x1d')](_0x477773)[_0xb7a8('0x1f')](_0x124863);}};}function respondWithFilteredResult(_0x3b9964,_0x518bd2){return function(_0x5db844){if(_0x5db844){var _0x4744a2=_0x5db844['count'],_0x3f8151=_0x518bd2[_0xb7a8('0x20')],_0x4b0169=_0x518bd2['offset']+_0x518bd2[_0xb7a8('0x21')],_0x1b2447;if(_0x4b0169>=_0x4744a2){_0x4b0169=_0x4744a2;_0x1b2447=0xc8;}else{_0x1b2447=0xce;}_0x3b9964[_0xb7a8('0x1d')](_0x1b2447);return _0x3b9964[_0xb7a8('0x22')](_0xb7a8('0x23'),_0x3f8151+'-'+_0x4b0169+'/'+_0x4744a2)[_0xb7a8('0x1f')](_0x5db844);}return null;};}function patchUpdates(_0x3da0f0){return function(_0x28f7c6){try{jsonpatch[_0xb7a8('0x24')](_0x28f7c6,_0x3da0f0,!![]);}catch(_0x54df02){return BPromise[_0xb7a8('0x25')](_0x54df02);}return _0x28f7c6[_0xb7a8('0x26')]();};}function saveUpdates(_0x10e800,_0x57cac1){return function(_0x2d70ff){if(_0x2d70ff){return _0x2d70ff[_0xb7a8('0x27')](_0x10e800)[_0xb7a8('0x28')](function(_0x18314e){return _0x18314e;});}return null;};}function removeEntity(_0x224803,_0x14c6c2){return function(_0x1646da){if(_0x1646da){return _0x1646da[_0xb7a8('0x29')]()[_0xb7a8('0x28')](function(){_0x224803[_0xb7a8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d4bc,_0x4bc273){return function(_0x1d826c){if(!_0x1d826c){_0x29d4bc[_0xb7a8('0x1c')](0x194);}return _0x1d826c;};}function handleError(_0x551d6a,_0x3902bd){_0x3902bd=_0x3902bd||0x1f4;return function(_0x142ee9){logger[_0xb7a8('0x2a')](_0x142ee9[_0xb7a8('0x2b')]);if(_0x142ee9[_0xb7a8('0x2c')]){delete _0x142ee9[_0xb7a8('0x2c')];}_0x551d6a[_0xb7a8('0x1d')](_0x3902bd)[_0xb7a8('0x2d')](_0x142ee9);};}exports[_0xb7a8('0x2e')]=function(_0x53606c,_0x2aa5e8){var _0x4b3698={},_0x2ddbf4={},_0x2d67c8={'count':0x0,'rows':[]};var _0x30d682=_[_0xb7a8('0x2f')](db[_0xb7a8('0x30')][_0xb7a8('0x31')],function(_0x280b51){return{'name':_0x280b51['fieldName'],'type':_0x280b51[_0xb7a8('0x32')][_0xb7a8('0x33')]};});_0x2ddbf4[_0xb7a8('0x34')]=_[_0xb7a8('0x2f')](_0x30d682,_0xb7a8('0x2c'));_0x2ddbf4['query']=_[_0xb7a8('0x35')](_0x53606c[_0xb7a8('0x36')]);_0x2ddbf4[_0xb7a8('0x37')]=_[_0xb7a8('0x38')](_0x2ddbf4['model'],_0x2ddbf4[_0xb7a8('0x36')]);_0x4b3698['attributes']=_[_0xb7a8('0x38')](_0x2ddbf4[_0xb7a8('0x34')],qs[_0xb7a8('0x39')](_0x53606c[_0xb7a8('0x36')][_0xb7a8('0x39')]));_0x4b3698[_0xb7a8('0x3a')]=_0x4b3698[_0xb7a8('0x3a')][_0xb7a8('0x3b')]?_0x4b3698[_0xb7a8('0x3a')]:_0x2ddbf4['model'];if(!_0x53606c['query'][_0xb7a8('0x3c')](_0xb7a8('0x3d'))){_0x4b3698[_0xb7a8('0x21')]=qs[_0xb7a8('0x21')](_0x53606c['query'][_0xb7a8('0x21')]);_0x4b3698[_0xb7a8('0x20')]=qs[_0xb7a8('0x20')](_0x53606c['query']['offset']);}_0x4b3698[_0xb7a8('0x3e')]=qs[_0xb7a8('0x3f')](_0x53606c['query'][_0xb7a8('0x3f')]);_0x4b3698[_0xb7a8('0x40')]=qs[_0xb7a8('0x37')](_[_0xb7a8('0x41')](_0x53606c[_0xb7a8('0x36')],_0x2ddbf4[_0xb7a8('0x37')]),_0x30d682);if(_0x53606c[_0xb7a8('0x36')]['filter']){_0x4b3698[_0xb7a8('0x40')]=_['merge'](_0x4b3698['where'],{'$or':_[_0xb7a8('0x2f')](_0x30d682,function(_0x10099c){if(_0x10099c['type']!==_0xb7a8('0x42')){var _0x301552={};_0x301552[_0x10099c['name']]={'$like':'%'+_0x53606c[_0xb7a8('0x36')][_0xb7a8('0x43')]+'%'};return _0x301552;}})});}_0x4b3698=_[_0xb7a8('0x44')]({},_0x4b3698,_0x53606c['options']);var _0x343666={'where':_0x4b3698[_0xb7a8('0x40')]};return db[_0xb7a8('0x30')][_0xb7a8('0x45')](_0x343666)[_0xb7a8('0x28')](function(_0x25e5b2){_0x2d67c8[_0xb7a8('0x45')]=_0x25e5b2;if(_0x53606c[_0xb7a8('0x36')][_0xb7a8('0x46')]){_0x4b3698[_0xb7a8('0x47')]=[{'all':!![]}];}return db[_0xb7a8('0x30')][_0xb7a8('0x48')](_0x4b3698);})[_0xb7a8('0x28')](function(_0x259a4d){_0x2d67c8['rows']=_0x259a4d;return _0x2d67c8;})[_0xb7a8('0x28')](respondWithFilteredResult(_0x2aa5e8,_0x4b3698))['catch'](handleError(_0x2aa5e8,null));};exports[_0xb7a8('0x49')]=function(_0x4690fc,_0x24c1d){var _0x4414ef={'raw':!![],'where':{'id':_0x4690fc[_0xb7a8('0x4a')]['id']}},_0x19ea51={};_0x19ea51[_0xb7a8('0x34')]=_['keys'](db[_0xb7a8('0x30')][_0xb7a8('0x31')]);_0x19ea51[_0xb7a8('0x36')]=_[_0xb7a8('0x35')](_0x4690fc[_0xb7a8('0x36')]);_0x19ea51[_0xb7a8('0x37')]=_[_0xb7a8('0x38')](_0x19ea51['model'],_0x19ea51[_0xb7a8('0x36')]);_0x4414ef[_0xb7a8('0x3a')]=_[_0xb7a8('0x38')](_0x19ea51['model'],qs[_0xb7a8('0x39')](_0x4690fc[_0xb7a8('0x36')][_0xb7a8('0x39')]));_0x4414ef[_0xb7a8('0x3a')]=_0x4414ef[_0xb7a8('0x3a')]['length']?_0x4414ef[_0xb7a8('0x3a')]:_0x19ea51[_0xb7a8('0x34')];if(_0x4690fc['query'][_0xb7a8('0x46')]){_0x4414ef[_0xb7a8('0x47')]=[{'all':!![]}];}_0x4414ef=_[_0xb7a8('0x44')]({},_0x4414ef,_0x4690fc[_0xb7a8('0x4b')]);return db[_0xb7a8('0x30')][_0xb7a8('0x4c')](_0x4414ef)[_0xb7a8('0x28')](handleEntityNotFound(_0x24c1d,null))['then'](respondWithResult(_0x24c1d,null))[_0xb7a8('0x4d')](handleError(_0x24c1d,null));};exports[_0xb7a8('0x4e')]=function(_0x4f0efd,_0x245745){return db['SquareDetailsReport'][_0xb7a8('0x4e')](_0x4f0efd[_0xb7a8('0x4f')],{})[_0xb7a8('0x28')](respondWithResult(_0x245745,0xc9))[_0xb7a8('0x4d')](handleError(_0x245745,null));};exports[_0xb7a8('0x27')]=function(_0xa355a6,_0xd8c127){if(_0xa355a6[_0xb7a8('0x4f')]['id']){delete _0xa355a6[_0xb7a8('0x4f')]['id'];}return db[_0xb7a8('0x30')][_0xb7a8('0x4c')]({'where':{'id':_0xa355a6['params']['id']}})[_0xb7a8('0x28')](handleEntityNotFound(_0xd8c127,null))[_0xb7a8('0x28')](saveUpdates(_0xa355a6[_0xb7a8('0x4f')],null))[_0xb7a8('0x28')](respondWithResult(_0xd8c127,null))[_0xb7a8('0x4d')](handleError(_0xd8c127,null));};exports[_0xb7a8('0x29')]=function(_0x1627d3,_0x4f2140){return db[_0xb7a8('0x30')]['find']({'where':{'id':_0x1627d3['params']['id']}})['then'](handleEntityNotFound(_0x4f2140,null))[_0xb7a8('0x28')](removeEntity(_0x4f2140,null))[_0xb7a8('0x4d')](handleError(_0x4f2140,null));};exports['describe']=function(_0x37b406,_0x56673a){return db[_0xb7a8('0x30')][_0xb7a8('0x50')]()[_0xb7a8('0x28')](respondWithResult(_0x56673a,null))[_0xb7a8('0x4d')](handleError(_0x56673a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1657cc4..51efe2c 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 _0xb2f2=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_square_details','lodash','util','api','moment'];(function(_0x3e1f65,_0x15100d){var _0x8e3abb=function(_0x21228a){while(--_0x21228a){_0x3e1f65['push'](_0x3e1f65['shift']());}};_0x8e3abb(++_0x15100d);}(_0xb2f2,0xc8));var _0x2b2f=function(_0x8d904c,_0x1a26c3){_0x8d904c=_0x8d904c-0x0;var _0x2beb70=_0xb2f2[_0x8d904c];return _0x2beb70;};'use strict';var _=require(_0x2b2f('0x0'));var util=require(_0x2b2f('0x1'));var logger=require('../../config/logger')(_0x2b2f('0x2'));var moment=require(_0x2b2f('0x3'));var BPromise=require(_0x2b2f('0x4'));var rp=require(_0x2b2f('0x5'));var fs=require('fs');var path=require(_0x2b2f('0x6'));var rimraf=require(_0x2b2f('0x7'));var config=require(_0x2b2f('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x2b2f('0x9')]=function(_0x2dd1a8,_0x6d540e){return _0x2dd1a8[_0x2b2f('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x2b2f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf37a=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x4947a5,_0x14a78f){var _0x2b48aa=function(_0x1d4d98){while(--_0x1d4d98){_0x4947a5['push'](_0x4947a5['shift']());}};_0x2b48aa(++_0x14a78f);}(_0xf37a,0x1f4));var _0xaf37=function(_0x133c7c,_0x470a71){_0x133c7c=_0x133c7c-0x0;var _0x23aeed=_0xf37a[_0x133c7c];return _0x23aeed;};'use strict';var _=require(_0xaf37('0x0'));var util=require(_0xaf37('0x1'));var logger=require('../../config/logger')(_0xaf37('0x2'));var moment=require(_0xaf37('0x3'));var BPromise=require(_0xaf37('0x4'));var rp=require(_0xaf37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf37('0x6'));var config=require(_0xaf37('0x7'));var attributes=require(_0xaf37('0x8'));module[_0xaf37('0x9')]=function(_0x32d8ed,_0xb08fd0){return _0x32d8ed[_0xaf37('0xa')](_0xaf37('0xb'),attributes,{'tableName':_0xaf37('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 4ba4f0a..8b0c974 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 _0x84e5=['create','body','raw','util','moment','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareDetailsReport'];(function(_0x37f075,_0x14a9ac){var _0x48f5c2=function(_0x3aafca){while(--_0x3aafca){_0x37f075['push'](_0x37f075['shift']());}};_0x48f5c2(++_0x14a9ac);}(_0x84e5,0x93));var _0x584e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x84e5[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var util=require(_0x584e('0x0'));var moment=require(_0x584e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x584e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x584e('0x3'))(_0x584e('0x4'));var config=require(_0x584e('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x584e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xb9cd4b,_0x1b491a,_0x4b78fd){return new BPromise(function(_0x1bd256,_0x26e5b7){return client[_0x584e('0x7')](_0xb9cd4b,_0x4b78fd)[_0x584e('0x8')](function(_0x5b87ea){logger[_0x584e('0x9')](_0x584e('0xa'),_0x1b491a,'request\x20sent');logger[_0x584e('0xb')](_0x584e('0xc'),_0x1b491a,_0x584e('0xd'),JSON[_0x584e('0xe')](_0x5b87ea));if(_0x5b87ea[_0x584e('0xf')]){if(_0x5b87ea[_0x584e('0xf')][_0x584e('0x10')]===0x1f4){logger[_0x584e('0xf')](_0x584e('0xa'),_0x1b491a,_0x5b87ea[_0x584e('0xf')][_0x584e('0x11')]);return _0x26e5b7(_0x5b87ea[_0x584e('0xf')][_0x584e('0x11')]);}logger['error'](_0x584e('0xa'),_0x1b491a,_0x5b87ea[_0x584e('0xf')][_0x584e('0x11')]);return _0x1bd256(_0x5b87ea[_0x584e('0xf')][_0x584e('0x11')]);}else{logger[_0x584e('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x1b491a,_0x584e('0xd'));_0x1bd256(_0x5b87ea[_0x584e('0x12')][_0x584e('0x11')]);}})[_0x584e('0x13')](function(_0x52819b){logger[_0x584e('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x1b491a,_0x52819b);_0x26e5b7(_0x52819b);});});}exports[_0x584e('0x14')]=function(_0x3a19e6){var _0x5e4fd9=this;return new Promise(function(_0x3f1ebd,_0x1c9cbb){return db['SquareDetailsReport'][_0x584e('0x15')](_0x3a19e6[_0x584e('0x16')],{'raw':_0x3a19e6['options']?_0x3a19e6['options'][_0x584e('0x17')]===undefined?!![]:![]:!![]})[_0x584e('0x8')](function(_0x4b0337){logger[_0x584e('0x9')](_0x584e('0x14'),_0x3a19e6);logger[_0x584e('0xb')](_0x584e('0x14'),_0x3a19e6,JSON[_0x584e('0xe')](_0x4b0337));_0x3f1ebd(_0x4b0337);})[_0x584e('0x13')](function(_0xc97d94){logger[_0x584e('0xf')](_0x584e('0x14'),_0xc97d94[_0x584e('0x11')],_0x3a19e6);_0x1c9cbb(_0x5e4fd9[_0x584e('0xf')](0x1f4,_0xc97d94[_0x584e('0x11')]));});});}; \ No newline at end of file +var _0x6905=['http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xec305b,_0x3a92f9){var _0x414672=function(_0x2ff942){while(--_0x2ff942){_0xec305b['push'](_0xec305b['shift']());}};_0x414672(++_0x3a92f9);}(_0x6905,0xd6));var _0x5690=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x6905[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0x5690('0x0'));var util=require(_0x5690('0x1'));var moment=require('moment');var BPromise=require(_0x5690('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5690('0x3'));var db=require(_0x5690('0x4'))['db'];var utils=require(_0x5690('0x5'));var logger=require(_0x5690('0x6'))(_0x5690('0x7'));var config=require(_0x5690('0x8'));var jayson=require(_0x5690('0x9'));var client=jayson['client'][_0x5690('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7ee38f,_0x4673cd,_0x31473e){return new BPromise(function(_0x1b5941,_0x26b10e){return client[_0x5690('0xb')](_0x7ee38f,_0x31473e)[_0x5690('0xc')](function(_0x406e39){logger[_0x5690('0xd')](_0x5690('0xe'),_0x4673cd,_0x5690('0xf'));logger[_0x5690('0x10')](_0x5690('0x11'),_0x4673cd,'request\x20sent',JSON[_0x5690('0x12')](_0x406e39));if(_0x406e39[_0x5690('0x13')]){if(_0x406e39[_0x5690('0x13')]['code']===0x1f4){logger[_0x5690('0x13')](_0x5690('0xe'),_0x4673cd,_0x406e39[_0x5690('0x13')][_0x5690('0x14')]);return _0x26b10e(_0x406e39[_0x5690('0x13')]['message']);}logger[_0x5690('0x13')](_0x5690('0xe'),_0x4673cd,_0x406e39[_0x5690('0x13')][_0x5690('0x14')]);return _0x1b5941(_0x406e39[_0x5690('0x13')]['message']);}else{logger[_0x5690('0xd')](_0x5690('0xe'),_0x4673cd,_0x5690('0xf'));_0x1b5941(_0x406e39[_0x5690('0x15')][_0x5690('0x14')]);}})[_0x5690('0x16')](function(_0x5fe48b){logger[_0x5690('0x13')](_0x5690('0xe'),_0x4673cd,_0x5fe48b);_0x26b10e(_0x5fe48b);});});}exports[_0x5690('0x17')]=function(_0x9c18a0){var _0x2052bf=this;return new Promise(function(_0x5344e1,_0x1cb12f){return db[_0x5690('0x18')][_0x5690('0x19')](_0x9c18a0[_0x5690('0x1a')],{'raw':_0x9c18a0[_0x5690('0x1b')]?_0x9c18a0['options']['raw']===undefined?!![]:![]:!![]})[_0x5690('0xc')](function(_0x287a0f){logger[_0x5690('0xd')](_0x5690('0x17'),_0x9c18a0);logger[_0x5690('0x10')](_0x5690('0x17'),_0x9c18a0,JSON[_0x5690('0x12')](_0x287a0f));_0x5344e1(_0x287a0f);})[_0x5690('0x16')](function(_0x1e7fbf){logger[_0x5690('0x13')](_0x5690('0x17'),_0x1e7fbf['message'],_0x9c18a0);_0x1cb12f(_0x2052bf['error'](0x1f4,_0x1e7fbf[_0x5690('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ee30d94..6e6d065 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 _0xe301=['isAuthenticated','killProcess','exports','express','Router','./system.controller','get','index','/process/:pid/kill'];(function(_0x22895b,_0x171177){var _0x42554a=function(_0x2840dd){while(--_0x2840dd){_0x22895b['push'](_0x22895b['shift']());}};_0x42554a(++_0x171177);}(_0xe301,0xc0));var _0x1e30=function(_0x1d466f,_0x4e4c3e){_0x1d466f=_0x1d466f-0x0;var _0xf2ff3b=_0xe301[_0x1d466f];return _0xf2ff3b;};'use strict';var express=require(_0x1e30('0x0'));var router=express[_0x1e30('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1e30('0x2'));router[_0x1e30('0x3')]('/',auth['isAuthenticated'](),controller[_0x1e30('0x4')]);router[_0x1e30('0x3')](_0x1e30('0x5'),auth[_0x1e30('0x6')](),controller[_0x1e30('0x7')]);module[_0x1e30('0x8')]=router; \ No newline at end of file +var _0x3589=['get','isAuthenticated','index','/process/:pid/kill','express','../../components/auth/service'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0x3589,0x94));var _0x9358=function(_0x5dca66,_0x11ac16){_0x5dca66=_0x5dca66-0x0;var _0x1107a2=_0x3589[_0x5dca66];return _0x1107a2;};'use strict';var express=require(_0x9358('0x0'));var router=express['Router']();var auth=require(_0x9358('0x1'));var controller=require('./system.controller');router[_0x9358('0x2')]('/',auth[_0x9358('0x3')](),controller[_0x9358('0x4')]);router['get'](_0x9358('0x5'),auth[_0x9358('0x3')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 98f5107..b7c0227 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 _0xbbbc=['format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','params','split'];(function(_0x2ca4ef,_0x52d512){var _0x57e69c=function(_0x4fda79){while(--_0x4fda79){_0x2ca4ef['push'](_0x2ca4ef['shift']());}};_0x57e69c(++_0x52d512);}(_0xbbbc,0xac));var _0xcbbb=function(_0x19f5ad,_0xb7bc88){_0x19f5ad=_0x19f5ad-0x0;var _0x3c1507=_0xbbbc[_0x19f5ad];return _0x3c1507;};'use strict';var info=require(_0xcbbb('0x0'));var exec=require(_0xcbbb('0x1'))[_0xcbbb('0x2')];var logger=require(_0xcbbb('0x3'))(_0xcbbb('0x4'));var util=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var _=require(_0xcbbb('0x7'));function handleError(_0x3a30fa,_0x559646,_0xc425bf){_0x559646=_0x559646||0x1f4;return function(_0x2578e1){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0xc425bf,_0x559646,util['inspect'](_0x2578e1,{'showHidden':![],'depth':null}));delete _0x2578e1[_0xcbbb('0x8')];_0x3a30fa[_0xcbbb('0x9')](_0x559646)[_0xcbbb('0xa')](_0x2578e1);};}exports[_0xcbbb('0xb')]=function(_0x3481e5,_0x49c381){return info[_0xcbbb('0xc')]()[_0xcbbb('0xd')](function(_0x31d7c8){return _0x49c381[_0xcbbb('0x9')](0xc8)[_0xcbbb('0xe')](_0x31d7c8);})[_0xcbbb('0xf')](function(_0x5d8d35){return _0x49c381[_0xcbbb('0x9')](0x1f4)[_0xcbbb('0xe')](_0x5d8d35);});};exports[_0xcbbb('0x10')]=function(_0x35be88,_0x56a069){var _0x5294fb=[_0xcbbb('0x11')];return new BPromise(function(_0x22a608,_0x10f1ca){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x35be88[_0xcbbb('0x12')]['pid']),function(_0x465af4,_0x5c6ac3,_0x352c12){if(_0x465af4){return _0x10f1ca(_0x465af4);}return _0x22a608(_0x5c6ac3);});})[_0xcbbb('0xd')](function(_0x2e89f6){var _0x6df90f=![];var _0x5b5e01=_0x2e89f6[_0xcbbb('0x13')](/\n/);for(var _0x3983c4=0x0,_0x29f84e=_0x5294fb['length'];_0x3983c4<_0x29f84e,_0x6df90f===![];_0x3983c4+=0x1){if(_0x2e89f6['indexOf'](_0x5294fb[_0x3983c4])>=0x0){_0x6df90f=!![];}}if(!_0x6df90f){throw new Error(util[_0xcbbb('0x14')](_0xcbbb('0x15'),_0x35be88[_0xcbbb('0x12')][_0xcbbb('0x16')]));}process['kill'](_0x35be88['params'][_0xcbbb('0x16')],'SIGINT');return _0x56a069['status'](0xc8)[_0xcbbb('0xe')]({'message':util[_0xcbbb('0x14')](_0xcbbb('0x17'),_0x35be88[_0xcbbb('0x12')][_0xcbbb('0x16')])});})[_0xcbbb('0xf')](handleError(_0x56a069,null,_0xcbbb('0x10')));}; \ No newline at end of file +var _0xdcbb=['length','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','name','status','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0x590eb2,_0x10e2bf){var _0x5311d4=function(_0x249a90){while(--_0x249a90){_0x590eb2['push'](_0x590eb2['shift']());}};_0x5311d4(++_0x10e2bf);}(_0xdcbb,0x164));var _0xbdcb=function(_0x3f4f30,_0x4dddf6){_0x3f4f30=_0x3f4f30-0x0;var _0x33fcef=_0xdcbb[_0x3f4f30];return _0x33fcef;};'use strict';var info=require(_0xbdcb('0x0'));var exec=require(_0xbdcb('0x1'))[_0xbdcb('0x2')];var logger=require(_0xbdcb('0x3'))(_0xbdcb('0x4'));var util=require('util');var BPromise=require(_0xbdcb('0x5'));var _=require(_0xbdcb('0x6'));function handleError(_0x2b4f22,_0x3c5613,_0x4ea4bd){_0x3c5613=_0x3c5613||0x1f4;return function(_0x23fb55){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4ea4bd,_0x3c5613,util['inspect'](_0x23fb55,{'showHidden':![],'depth':null}));delete _0x23fb55[_0xbdcb('0x7')];_0x2b4f22[_0xbdcb('0x8')](_0x3c5613)['send'](_0x23fb55);};}exports['index']=function(_0x120d91,_0x39d295){return info[_0xbdcb('0x9')]()[_0xbdcb('0xa')](function(_0x3b5786){return _0x39d295[_0xbdcb('0x8')](0xc8)[_0xbdcb('0xb')](_0x3b5786);})['catch'](function(_0x987abd){return _0x39d295[_0xbdcb('0x8')](0x1f4)[_0xbdcb('0xb')](_0x987abd);});};exports[_0xbdcb('0xc')]=function(_0x1ea655,_0x8158e7){var _0x4f1ea4=[_0xbdcb('0xd')];return new BPromise(function(_0x862aff,_0x13578b){return exec(util[_0xbdcb('0xe')](_0xbdcb('0xf'),_0x1ea655[_0xbdcb('0x10')][_0xbdcb('0x11')]),function(_0x24e83e,_0x589b58,_0x436235){if(_0x24e83e){return _0x13578b(_0x24e83e);}return _0x862aff(_0x589b58);});})['then'](function(_0x4d12f7){var _0x774f66=![];var _0x490f90=_0x4d12f7['split'](/\n/);for(var _0x2c93bd=0x0,_0xee03c5=_0x4f1ea4[_0xbdcb('0x12')];_0x2c93bd<_0xee03c5,_0x774f66===![];_0x2c93bd+=0x1){if(_0x4d12f7['indexOf'](_0x4f1ea4[_0x2c93bd])>=0x0){_0x774f66=!![];}}if(!_0x774f66){throw new Error(util[_0xbdcb('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1ea655[_0xbdcb('0x10')][_0xbdcb('0x11')]));}process[_0xbdcb('0x13')](_0x1ea655[_0xbdcb('0x10')][_0xbdcb('0x11')],'SIGINT');return _0x8158e7[_0xbdcb('0x8')](0xc8)[_0xbdcb('0xb')]({'message':util[_0xbdcb('0xe')](_0xbdcb('0x14'),_0x1ea655[_0xbdcb('0x10')][_0xbdcb('0x11')])});})[_0xbdcb('0x15')](handleError(_0x8158e7,null,_0xbdcb('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 021a219..b890f68 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 _0xbdb7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x45afd6,_0x148563){var _0x23a5ff=function(_0x16875a){while(--_0x16875a){_0x45afd6['push'](_0x45afd6['shift']());}};_0x23a5ff(++_0x148563);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x33b880,_0xa71851){_0x33b880=_0x33b880-0x0;var _0x2390b0=_0xbdb7[_0x33b880];return _0x2390b0;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./tag.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0xb')]('/',auth[_0x7bdb('0xc')](),controller['create']);router['put'](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xf')]);module[_0x7bdb('0x10')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x1e48b3,_0x3150bc){var _0x295fae=function(_0x58b33a){while(--_0x58b33a){_0x1e48b3['push'](_0x1e48b3['shift']());}};_0x295fae(++_0x3150bc);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c4193bf..c77bf99 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 _0xb688=['STRING','name','#0091EA','exports'];(function(_0x10684,_0x405338){var _0x3b5e23=function(_0x1d1745){while(--_0x1d1745){_0x10684['push'](_0x10684['shift']());}};_0x3b5e23(++_0x405338);}(_0xb688,0xcf));var _0x8b68=function(_0x332247,_0x5c3753){_0x332247=_0x332247-0x0;var _0x3235f7=_0xb688[_0x332247];return _0x3235f7;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'unique':_0x8b68('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x3')},'description':{'type':Sequelize[_0x8b68('0x1')]}}; \ No newline at end of file +var _0xb688=['STRING','name','#0091EA','exports'];(function(_0x57376b,_0x4ae4fb){var _0x53a8f0=function(_0x5a5568){while(--_0x5a5568){_0x57376b['push'](_0x57376b['shift']());}};_0x53a8f0(++_0x4ae4fb);}(_0xb688,0xcf));var _0x8b68=function(_0x1aa804,_0x3fc392){_0x1aa804=_0x1aa804-0x0;var _0x34e3c0=_0xb688[_0x1aa804];return _0x34e3c0;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'unique':_0x8b68('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x3')},'description':{'type':Sequelize[_0x8b68('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fafb986..7b16f7e 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 _0xd918=['intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','count','includeAll','findAll','rows','show','params','include','find','catch','create','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','end','error','stack','name','send','index','map','Tag','rawAttributes','key','model','query','keys','filters'];(function(_0x85cb49,_0x50a08a){var _0x52f463=function(_0x3e816b){while(--_0x3e816b){_0x85cb49['push'](_0x85cb49['shift']());}};_0x52f463(++_0x50a08a);}(_0xd918,0x11c));var _0x8d91=function(_0x141646,_0x96ae4e){_0x141646=_0x141646-0x0;var _0x59c7ec=_0xd918[_0x141646];return _0x59c7ec;};'use strict';var pdf=require(_0x8d91('0x0'));var emlformat=require(_0x8d91('0x1'));var rimraf=require(_0x8d91('0x2'));var zipdir=require(_0x8d91('0x3'));var jsonpatch=require(_0x8d91('0x4'));var rp=require('request-promise');var moment=require(_0x8d91('0x5'));var BPromise=require(_0x8d91('0x6'));var Mustache=require(_0x8d91('0x7'));var util=require('util');var path=require(_0x8d91('0x8'));var sox=require(_0x8d91('0x9'));var csv=require(_0x8d91('0xa'));var ejs=require(_0x8d91('0xb'));var fs=require('fs');var _=require(_0x8d91('0xc'));var squel=require(_0x8d91('0xd'));var crypto=require(_0x8d91('0xe'));var jsforce=require(_0x8d91('0xf'));var deskjs=require(_0x8d91('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8d91('0x11'));var Papa=require(_0x8d91('0x12'));var Redis=require(_0x8d91('0x13'));var authService=require(_0x8d91('0x14'));var qs=require(_0x8d91('0x15'));var as=require(_0x8d91('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d91('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x8d91('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d91('0x19'))['db'];function respondWithStatusCode(_0x1d8253,_0x4a0193){_0x4a0193=_0x4a0193||0xcc;return function(_0x3da9a0){if(_0x3da9a0){return _0x1d8253[_0x8d91('0x1a')](_0x4a0193);}return _0x1d8253[_0x8d91('0x1b')](_0x4a0193)['end']();};}function respondWithResult(_0x48c7e6,_0x9ea9b4){_0x9ea9b4=_0x9ea9b4||0xc8;return function(_0x4f7e83){if(_0x4f7e83){return _0x48c7e6[_0x8d91('0x1b')](_0x9ea9b4)[_0x8d91('0x1c')](_0x4f7e83);}};}function respondWithFilteredResult(_0x143edb,_0xaabc33){return function(_0x3af41e){if(_0x3af41e){var _0x28d207=_0x3af41e['count'],_0x3b9feb=_0xaabc33[_0x8d91('0x1d')],_0xa4600b=_0xaabc33[_0x8d91('0x1d')]+_0xaabc33[_0x8d91('0x1e')],_0x19e0d0;if(_0xa4600b>=_0x28d207){_0xa4600b=_0x28d207;_0x19e0d0=0xc8;}else{_0x19e0d0=0xce;}_0x143edb[_0x8d91('0x1b')](_0x19e0d0);return _0x143edb[_0x8d91('0x1f')](_0x8d91('0x20'),_0x3b9feb+'-'+_0xa4600b+'/'+_0x28d207)['json'](_0x3af41e);}return null;};}function patchUpdates(_0x169f72){return function(_0x2a8cf6){try{jsonpatch[_0x8d91('0x21')](_0x2a8cf6,_0x169f72,!![]);}catch(_0x38dc15){return BPromise[_0x8d91('0x22')](_0x38dc15);}return _0x2a8cf6[_0x8d91('0x23')]();};}function saveUpdates(_0x539950,_0x31beab){return function(_0x293948){if(_0x293948){return _0x293948[_0x8d91('0x24')](_0x539950)[_0x8d91('0x25')](function(_0x2e9a8e){return _0x2e9a8e;});}return null;};}function removeEntity(_0x3b760e,_0x536614){return function(_0x6ec335){if(_0x6ec335){return _0x6ec335[_0x8d91('0x26')]()[_0x8d91('0x25')](function(){var _0x23c790=_0x6ec335[_0x8d91('0x27')]({'plain':!![]});var _0x4c9a56=_0x8d91('0x28');return db[_0x8d91('0x29')][_0x8d91('0x26')]({'where':{'type':_0x4c9a56,'resourceId':_0x23c790['id']}})[_0x8d91('0x25')](function(){return _0x6ec335;});})[_0x8d91('0x25')](function(){_0x3b760e[_0x8d91('0x1b')](0xcc)[_0x8d91('0x2a')]();});}};}function handleEntityNotFound(_0x4d7688,_0x35386b){return function(_0x1b95b0){if(!_0x1b95b0){_0x4d7688['sendStatus'](0x194);}return _0x1b95b0;};}function handleError(_0x3551f5,_0x766f37){_0x766f37=_0x766f37||0x1f4;return function(_0x59f27d){logger[_0x8d91('0x2b')](_0x59f27d[_0x8d91('0x2c')]);if(_0x59f27d[_0x8d91('0x2d')]){delete _0x59f27d['name'];}_0x3551f5['status'](_0x766f37)[_0x8d91('0x2e')](_0x59f27d);};}exports[_0x8d91('0x2f')]=function(_0x1ab4a1,_0x636bd9){var _0x46a043={},_0x32699d={},_0x1175a4={'count':0x0,'rows':[]};var _0x528026=_[_0x8d91('0x30')](db[_0x8d91('0x31')][_0x8d91('0x32')],function(_0x5e5c98){return{'name':_0x5e5c98['fieldName'],'type':_0x5e5c98['type'][_0x8d91('0x33')]};});_0x32699d[_0x8d91('0x34')]=_[_0x8d91('0x30')](_0x528026,_0x8d91('0x2d'));_0x32699d[_0x8d91('0x35')]=_[_0x8d91('0x36')](_0x1ab4a1[_0x8d91('0x35')]);_0x32699d[_0x8d91('0x37')]=_[_0x8d91('0x38')](_0x32699d[_0x8d91('0x34')],_0x32699d[_0x8d91('0x35')]);_0x46a043[_0x8d91('0x39')]=_[_0x8d91('0x38')](_0x32699d[_0x8d91('0x34')],qs['fields'](_0x1ab4a1[_0x8d91('0x35')][_0x8d91('0x3a')]));_0x46a043['attributes']=_0x46a043['attributes'][_0x8d91('0x3b')]?_0x46a043[_0x8d91('0x39')]:_0x32699d[_0x8d91('0x34')];if(!_0x1ab4a1['query']['hasOwnProperty'](_0x8d91('0x3c'))){_0x46a043['limit']=qs[_0x8d91('0x1e')](_0x1ab4a1[_0x8d91('0x35')][_0x8d91('0x1e')]);_0x46a043[_0x8d91('0x1d')]=qs[_0x8d91('0x1d')](_0x1ab4a1[_0x8d91('0x35')]['offset']);}_0x46a043[_0x8d91('0x3d')]=qs[_0x8d91('0x3e')](_0x1ab4a1[_0x8d91('0x35')]['sort']);_0x46a043['where']=qs[_0x8d91('0x37')](_[_0x8d91('0x3f')](_0x1ab4a1[_0x8d91('0x35')],_0x32699d[_0x8d91('0x37')]),_0x528026);if(_0x1ab4a1['query']['filter']){_0x46a043[_0x8d91('0x40')]=_[_0x8d91('0x41')](_0x46a043['where'],{'$or':_[_0x8d91('0x30')](_0x528026,function(_0x227e7e){if(_0x227e7e[_0x8d91('0x42')]!==_0x8d91('0x43')){var _0x7f79f6={};_0x7f79f6[_0x227e7e[_0x8d91('0x2d')]]={'$like':'%'+_0x1ab4a1[_0x8d91('0x35')][_0x8d91('0x44')]+'%'};return _0x7f79f6;}})});}_0x46a043=_[_0x8d91('0x41')]({},_0x46a043,_0x1ab4a1['options']);var _0x2fcf9d={'where':_0x46a043['where']};return db[_0x8d91('0x31')][_0x8d91('0x45')](_0x2fcf9d)[_0x8d91('0x25')](function(_0x304203){_0x1175a4[_0x8d91('0x45')]=_0x304203;if(_0x1ab4a1[_0x8d91('0x35')][_0x8d91('0x46')]){_0x46a043['include']=[{'all':!![]}];}return db['Tag'][_0x8d91('0x47')](_0x46a043);})[_0x8d91('0x25')](function(_0x289f32){_0x1175a4[_0x8d91('0x48')]=_0x289f32;return _0x1175a4;})[_0x8d91('0x25')](respondWithFilteredResult(_0x636bd9,_0x46a043))['catch'](handleError(_0x636bd9,null));};exports[_0x8d91('0x49')]=function(_0x28c6ec,_0x2c14c8){var _0x196c83={'raw':!![],'where':{'id':_0x28c6ec[_0x8d91('0x4a')]['id']}},_0x3567c1={};_0x3567c1[_0x8d91('0x34')]=_[_0x8d91('0x36')](db['Tag'][_0x8d91('0x32')]);_0x3567c1[_0x8d91('0x35')]=_[_0x8d91('0x36')](_0x28c6ec[_0x8d91('0x35')]);_0x3567c1[_0x8d91('0x37')]=_[_0x8d91('0x38')](_0x3567c1[_0x8d91('0x34')],_0x3567c1[_0x8d91('0x35')]);_0x196c83['attributes']=_[_0x8d91('0x38')](_0x3567c1['model'],qs[_0x8d91('0x3a')](_0x28c6ec[_0x8d91('0x35')][_0x8d91('0x3a')]));_0x196c83[_0x8d91('0x39')]=_0x196c83[_0x8d91('0x39')][_0x8d91('0x3b')]?_0x196c83['attributes']:_0x3567c1[_0x8d91('0x34')];if(_0x28c6ec[_0x8d91('0x35')][_0x8d91('0x46')]){_0x196c83[_0x8d91('0x4b')]=[{'all':!![]}];}_0x196c83=_['merge']({},_0x196c83,_0x28c6ec['options']);return db[_0x8d91('0x31')][_0x8d91('0x4c')](_0x196c83)[_0x8d91('0x25')](handleEntityNotFound(_0x2c14c8,null))[_0x8d91('0x25')](respondWithResult(_0x2c14c8,null))[_0x8d91('0x4d')](handleError(_0x2c14c8,null));};exports['create']=function(_0x26e8fc,_0x345ddd){return db['Tag'][_0x8d91('0x4e')](_0x26e8fc[_0x8d91('0x4f')],{})[_0x8d91('0x25')](function(_0x58e691){var _0x1cde93=_0x26e8fc['user'][_0x8d91('0x27')]({'plain':!![]});if(!_0x1cde93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cde93[_0x8d91('0x50')]===_0x8d91('0x51')){var _0xc96206=_0x58e691[_0x8d91('0x27')]({'plain':!![]});var _0x590d1b=_0x8d91('0x28');return db['UserProfileSection'][_0x8d91('0x4c')]({'where':{'name':_0x590d1b,'userProfileId':_0x1cde93[_0x8d91('0x52')]},'raw':!![]})[_0x8d91('0x25')](function(_0x2cf6a7){if(_0x2cf6a7&&_0x2cf6a7[_0x8d91('0x53')]===0x0){return db[_0x8d91('0x29')][_0x8d91('0x4e')]({'name':_0xc96206[_0x8d91('0x2d')],'resourceId':_0xc96206['id'],'type':_0x2cf6a7[_0x8d91('0x2d')],'sectionId':_0x2cf6a7['id']},{})['then'](function(){return _0x58e691;});}else{return _0x58e691;}})[_0x8d91('0x4d')](function(_0x4bebe3){logger[_0x8d91('0x2b')](_0x8d91('0x54'),_0x4bebe3);throw _0x4bebe3;});}return _0x58e691;})['then'](respondWithResult(_0x345ddd,0xc9))['catch'](handleError(_0x345ddd,null));};exports[_0x8d91('0x24')]=function(_0x20e00c,_0x4d5ffd){if(_0x20e00c[_0x8d91('0x4f')]['id']){delete _0x20e00c[_0x8d91('0x4f')]['id'];}return db[_0x8d91('0x31')][_0x8d91('0x4c')]({'where':{'id':_0x20e00c['params']['id']}})[_0x8d91('0x25')](handleEntityNotFound(_0x4d5ffd,null))[_0x8d91('0x25')](saveUpdates(_0x20e00c[_0x8d91('0x4f')],null))['then'](respondWithResult(_0x4d5ffd,null))[_0x8d91('0x4d')](handleError(_0x4d5ffd,null));};exports[_0x8d91('0x26')]=function(_0x7ab050,_0x2043d6){return db[_0x8d91('0x31')][_0x8d91('0x4c')]({'where':{'id':_0x7ab050[_0x8d91('0x4a')]['id']}})[_0x8d91('0x25')](handleEntityNotFound(_0x2043d6,null))[_0x8d91('0x25')](removeEntity(_0x2043d6,null))[_0x8d91('0x4d')](handleError(_0x2043d6,null));}; \ No newline at end of file +var _0xf161=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','then','get','UserProfileResource','sendStatus','error','stack','name','map','Tag','rawAttributes','fieldName','query','keys','filters','attributes','intersection','fields','length','model','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','autoAssociation','destroy','html-pdf','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf161,0x136));var _0x1f16=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xf161[_0xd0b415];return _0x2bdf2c;};'use strict';var pdf=require(_0x1f16('0x0'));var emlformat=require(_0x1f16('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1f16('0x2'));var jsonpatch=require(_0x1f16('0x3'));var rp=require(_0x1f16('0x4'));var moment=require(_0x1f16('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1f16('0x6'));var util=require(_0x1f16('0x7'));var path=require(_0x1f16('0x8'));var sox=require(_0x1f16('0x9'));var csv=require(_0x1f16('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1f16('0xb'));var crypto=require(_0x1f16('0xc'));var jsforce=require(_0x1f16('0xd'));var deskjs=require(_0x1f16('0xe'));var toCsv=require(_0x1f16('0xa'));var querystring=require(_0x1f16('0xf'));var Papa=require(_0x1f16('0x10'));var Redis=require(_0x1f16('0x11'));var authService=require(_0x1f16('0x12'));var qs=require(_0x1f16('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f16('0x14'));var logger=require('../../config/logger')(_0x1f16('0x15'));var utils=require(_0x1f16('0x16'));var config=require(_0x1f16('0x17'));var licenseUtil=require(_0x1f16('0x18'));var db=require(_0x1f16('0x19'))['db'];function respondWithStatusCode(_0xcb91ad,_0x46220a){_0x46220a=_0x46220a||0xcc;return function(_0x3a41dc){if(_0x3a41dc){return _0xcb91ad['sendStatus'](_0x46220a);}return _0xcb91ad[_0x1f16('0x1a')](_0x46220a)['end']();};}function respondWithResult(_0x250286,_0x4407b6){_0x4407b6=_0x4407b6||0xc8;return function(_0x1d2dfc){if(_0x1d2dfc){return _0x250286['status'](_0x4407b6)[_0x1f16('0x1b')](_0x1d2dfc);}};}function respondWithFilteredResult(_0x46301b,_0x4259b6){return function(_0xd343c0){if(_0xd343c0){var _0x251261=_0xd343c0['count'],_0x18ca7c=_0x4259b6[_0x1f16('0x1c')],_0x18710b=_0x4259b6[_0x1f16('0x1c')]+_0x4259b6[_0x1f16('0x1d')],_0x72d73b;if(_0x18710b>=_0x251261){_0x18710b=_0x251261;_0x72d73b=0xc8;}else{_0x72d73b=0xce;}_0x46301b['status'](_0x72d73b);return _0x46301b['set'](_0x1f16('0x1e'),_0x18ca7c+'-'+_0x18710b+'/'+_0x251261)[_0x1f16('0x1b')](_0xd343c0);}return null;};}function patchUpdates(_0x3f13a4){return function(_0x5b9884){try{jsonpatch[_0x1f16('0x1f')](_0x5b9884,_0x3f13a4,!![]);}catch(_0x565472){return BPromise[_0x1f16('0x20')](_0x565472);}return _0x5b9884['save']();};}function saveUpdates(_0x4d0f32,_0xfba2a2){return function(_0x502ebe){if(_0x502ebe){return _0x502ebe['update'](_0x4d0f32)[_0x1f16('0x21')](function(_0x329c3d){return _0x329c3d;});}return null;};}function removeEntity(_0x2bbc99,_0x15c40a){return function(_0x48ab0d){if(_0x48ab0d){return _0x48ab0d['destroy']()[_0x1f16('0x21')](function(){var _0x3cc402=_0x48ab0d[_0x1f16('0x22')]({'plain':!![]});var _0x27f4af='Tags';return db[_0x1f16('0x23')]['destroy']({'where':{'type':_0x27f4af,'resourceId':_0x3cc402['id']}})['then'](function(){return _0x48ab0d;});})[_0x1f16('0x21')](function(){_0x2bbc99['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30c508,_0x380c2c){return function(_0x2a3708){if(!_0x2a3708){_0x30c508[_0x1f16('0x24')](0x194);}return _0x2a3708;};}function handleError(_0x3f2645,_0x50a6df){_0x50a6df=_0x50a6df||0x1f4;return function(_0x4b7463){logger[_0x1f16('0x25')](_0x4b7463[_0x1f16('0x26')]);if(_0x4b7463[_0x1f16('0x27')]){delete _0x4b7463[_0x1f16('0x27')];}_0x3f2645[_0x1f16('0x1a')](_0x50a6df)['send'](_0x4b7463);};}exports['index']=function(_0x3a2d52,_0x4f264b){var _0xebfe03={},_0x3c93fe={},_0x4e0730={'count':0x0,'rows':[]};var _0xcd4107=_[_0x1f16('0x28')](db[_0x1f16('0x29')][_0x1f16('0x2a')],function(_0x4e13f4){return{'name':_0x4e13f4[_0x1f16('0x2b')],'type':_0x4e13f4['type']['key']};});_0x3c93fe['model']=_[_0x1f16('0x28')](_0xcd4107,_0x1f16('0x27'));_0x3c93fe[_0x1f16('0x2c')]=_[_0x1f16('0x2d')](_0x3a2d52['query']);_0x3c93fe[_0x1f16('0x2e')]=_['intersection'](_0x3c93fe['model'],_0x3c93fe[_0x1f16('0x2c')]);_0xebfe03[_0x1f16('0x2f')]=_[_0x1f16('0x30')](_0x3c93fe['model'],qs[_0x1f16('0x31')](_0x3a2d52[_0x1f16('0x2c')]['fields']));_0xebfe03[_0x1f16('0x2f')]=_0xebfe03[_0x1f16('0x2f')][_0x1f16('0x32')]?_0xebfe03[_0x1f16('0x2f')]:_0x3c93fe[_0x1f16('0x33')];if(!_0x3a2d52[_0x1f16('0x2c')]['hasOwnProperty']('nolimit')){_0xebfe03[_0x1f16('0x1d')]=qs['limit'](_0x3a2d52[_0x1f16('0x2c')][_0x1f16('0x1d')]);_0xebfe03['offset']=qs[_0x1f16('0x1c')](_0x3a2d52[_0x1f16('0x2c')][_0x1f16('0x1c')]);}_0xebfe03['order']=qs[_0x1f16('0x34')](_0x3a2d52[_0x1f16('0x2c')][_0x1f16('0x34')]);_0xebfe03[_0x1f16('0x35')]=qs[_0x1f16('0x2e')](_[_0x1f16('0x36')](_0x3a2d52[_0x1f16('0x2c')],_0x3c93fe['filters']),_0xcd4107);if(_0x3a2d52[_0x1f16('0x2c')][_0x1f16('0x37')]){_0xebfe03[_0x1f16('0x35')]=_[_0x1f16('0x38')](_0xebfe03[_0x1f16('0x35')],{'$or':_[_0x1f16('0x28')](_0xcd4107,function(_0x3aa668){if(_0x3aa668[_0x1f16('0x39')]!==_0x1f16('0x3a')){var _0x494eda={};_0x494eda[_0x3aa668['name']]={'$like':'%'+_0x3a2d52[_0x1f16('0x2c')]['filter']+'%'};return _0x494eda;}})});}_0xebfe03=_[_0x1f16('0x38')]({},_0xebfe03,_0x3a2d52[_0x1f16('0x3b')]);var _0x53a1f2={'where':_0xebfe03['where']};return db['Tag'][_0x1f16('0x3c')](_0x53a1f2)['then'](function(_0x1e4a12){_0x4e0730[_0x1f16('0x3c')]=_0x1e4a12;if(_0x3a2d52[_0x1f16('0x2c')][_0x1f16('0x3d')]){_0xebfe03[_0x1f16('0x3e')]=[{'all':!![]}];}return db[_0x1f16('0x29')][_0x1f16('0x3f')](_0xebfe03);})[_0x1f16('0x21')](function(_0x94ac06){_0x4e0730[_0x1f16('0x40')]=_0x94ac06;return _0x4e0730;})[_0x1f16('0x21')](respondWithFilteredResult(_0x4f264b,_0xebfe03))[_0x1f16('0x41')](handleError(_0x4f264b,null));};exports[_0x1f16('0x42')]=function(_0x4a8df4,_0x2e9b29){var _0x578100={'raw':!![],'where':{'id':_0x4a8df4[_0x1f16('0x43')]['id']}},_0x6fff25={};_0x6fff25[_0x1f16('0x33')]=_['keys'](db[_0x1f16('0x29')][_0x1f16('0x2a')]);_0x6fff25['query']=_[_0x1f16('0x2d')](_0x4a8df4[_0x1f16('0x2c')]);_0x6fff25[_0x1f16('0x2e')]=_[_0x1f16('0x30')](_0x6fff25[_0x1f16('0x33')],_0x6fff25[_0x1f16('0x2c')]);_0x578100['attributes']=_[_0x1f16('0x30')](_0x6fff25[_0x1f16('0x33')],qs[_0x1f16('0x31')](_0x4a8df4[_0x1f16('0x2c')][_0x1f16('0x31')]));_0x578100[_0x1f16('0x2f')]=_0x578100[_0x1f16('0x2f')][_0x1f16('0x32')]?_0x578100[_0x1f16('0x2f')]:_0x6fff25['model'];if(_0x4a8df4[_0x1f16('0x2c')]['includeAll']){_0x578100[_0x1f16('0x3e')]=[{'all':!![]}];}_0x578100=_[_0x1f16('0x38')]({},_0x578100,_0x4a8df4[_0x1f16('0x3b')]);return db['Tag'][_0x1f16('0x44')](_0x578100)[_0x1f16('0x21')](handleEntityNotFound(_0x2e9b29,null))[_0x1f16('0x21')](respondWithResult(_0x2e9b29,null))[_0x1f16('0x41')](handleError(_0x2e9b29,null));};exports[_0x1f16('0x45')]=function(_0xec64f1,_0x3e009a){return db['Tag'][_0x1f16('0x45')](_0xec64f1[_0x1f16('0x46')],{})['then'](function(_0x4ec858){var _0xe28022=_0xec64f1[_0x1f16('0x47')][_0x1f16('0x22')]({'plain':!![]});if(!_0xe28022)throw new Error(_0x1f16('0x48'));if(_0xe28022[_0x1f16('0x49')]==='user'){var _0x345c5c=_0x4ec858[_0x1f16('0x22')]({'plain':!![]});var _0xe55e0d=_0x1f16('0x4a');return db['UserProfileSection'][_0x1f16('0x44')]({'where':{'name':_0xe55e0d,'userProfileId':_0xe28022[_0x1f16('0x4b')]},'raw':!![]})[_0x1f16('0x21')](function(_0x193a69){if(_0x193a69&&_0x193a69[_0x1f16('0x4c')]===0x0){return db[_0x1f16('0x23')]['create']({'name':_0x345c5c[_0x1f16('0x27')],'resourceId':_0x345c5c['id'],'type':_0x193a69['name'],'sectionId':_0x193a69['id']},{})['then'](function(){return _0x4ec858;});}else{return _0x4ec858;}})['catch'](function(_0x1187c6){logger[_0x1f16('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1187c6);throw _0x1187c6;});}return _0x4ec858;})['then'](respondWithResult(_0x3e009a,0xc9))[_0x1f16('0x41')](handleError(_0x3e009a,null));};exports['update']=function(_0x45e5fe,_0x4a97c9){if(_0x45e5fe[_0x1f16('0x46')]['id']){delete _0x45e5fe[_0x1f16('0x46')]['id'];}return db[_0x1f16('0x29')]['find']({'where':{'id':_0x45e5fe[_0x1f16('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a97c9,null))[_0x1f16('0x21')](saveUpdates(_0x45e5fe[_0x1f16('0x46')],null))[_0x1f16('0x21')](respondWithResult(_0x4a97c9,null))[_0x1f16('0x41')](handleError(_0x4a97c9,null));};exports[_0x1f16('0x4d')]=function(_0x3cc918,_0x3f2b2f){return db[_0x1f16('0x29')][_0x1f16('0x44')]({'where':{'id':_0x3cc918[_0x1f16('0x43')]['id']}})[_0x1f16('0x21')](handleEntityNotFound(_0x3f2b2f,null))[_0x1f16('0x21')](removeEntity(_0x3f2b2f,null))[_0x1f16('0x41')](handleError(_0x3f2b2f,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 64c123e..75c3497 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 _0xca81=['./tag.attributes','exports','define','tools_tags','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x22395a,_0x4a4fd0){var _0x436c90=function(_0xf35f44){while(--_0xf35f44){_0x22395a['push'](_0x22395a['shift']());}};_0x436c90(++_0x4a4fd0);}(_0xca81,0x163));var _0x1ca8=function(_0x3d0203,_0x577b53){_0x3d0203=_0x3d0203-0x0;var _0xb2b875=_0xca81[_0x3d0203];return _0xb2b875;};'use strict';var _=require(_0x1ca8('0x0'));var util=require(_0x1ca8('0x1'));var logger=require('../../config/logger')(_0x1ca8('0x2'));var moment=require(_0x1ca8('0x3'));var BPromise=require(_0x1ca8('0x4'));var rp=require(_0x1ca8('0x5'));var fs=require('fs');var path=require(_0x1ca8('0x6'));var rimraf=require(_0x1ca8('0x7'));var config=require(_0x1ca8('0x8'));var attributes=require(_0x1ca8('0x9'));module[_0x1ca8('0xa')]=function(_0x53b5ea,_0x454f1e){return _0x53b5ea[_0x1ca8('0xb')]('Tag',attributes,{'tableName':_0x1ca8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb146=['./tag.attributes','exports','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38cd04,_0x2f578b){var _0x1741c0=function(_0x1355ad){while(--_0x1355ad){_0x38cd04['push'](_0x38cd04['shift']());}};_0x1741c0(++_0x2f578b);}(_0xb146,0xa0));var _0x6b14=function(_0x327e4e,_0x576ed9){_0x327e4e=_0x327e4e-0x0;var _0x143f9b=_0xb146[_0x327e4e];return _0x143f9b;};'use strict';var _=require('lodash');var util=require(_0x6b14('0x0'));var logger=require(_0x6b14('0x1'))(_0x6b14('0x2'));var moment=require(_0x6b14('0x3'));var BPromise=require(_0x6b14('0x4'));var rp=require(_0x6b14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b14('0x6'));var config=require(_0x6b14('0x7'));var attributes=require(_0x6b14('0x8'));module[_0x6b14('0x9')]=function(_0x56cdef,_0x18a76b){return _0x56cdef['define'](_0x6b14('0xa'),attributes,{'tableName':_0x6b14('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 7103c2a..15904b1 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 _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x31b4d4,_0x569fb3){var _0xf5016b=function(_0x3ca4c9){while(--_0x3ca4c9){_0x31b4d4['push'](_0x31b4d4['shift']());}};_0xf5016b(++_0x569fb3);}(_0x222f,0x1a4));var _0xf222=function(_0x20acdb,_0x210c8e){_0x20acdb=_0x20acdb-0x0;var _0x383b0d=_0x222f[_0x20acdb];return _0x383b0d;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('Tag,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});} \ No newline at end of file +var _0xc788=['request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','message','Tag,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc788,0xc4));var _0x8c78=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0xc788[_0x3c04d7];return _0x2fb24;};'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')]('Tag,\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')]('Tag,\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')]('Tag,\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/team/index.js b/server/api/team/index.js index 0cb9ce4..50ba3a9 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 _0xdb9d=['/:id/queues','/:id/users','getAgents','post','create','addQueues','addAgents','put','update','destroy','delete','removeQueues','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xdb9d,0x151));var _0xddb9=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0xdb9d[_0xee5d2a];return _0x346948;};'use strict';var multer=require(_0xddb9('0x0'));var util=require(_0xddb9('0x1'));var path=require(_0xddb9('0x2'));var timeout=require('connect-timeout');var express=require(_0xddb9('0x3'));var router=express[_0xddb9('0x4')]();var auth=require(_0xddb9('0x5'));var interaction=require(_0xddb9('0x6'));var config=require(_0xddb9('0x7'));var controller=require(_0xddb9('0x8'));router[_0xddb9('0x9')]('/',auth[_0xddb9('0xa')](),controller[_0xddb9('0xb')]);router[_0xddb9('0x9')](_0xddb9('0xc'),auth[_0xddb9('0xa')](),controller[_0xddb9('0xd')]);router[_0xddb9('0x9')](_0xddb9('0xe'),auth[_0xddb9('0xa')](),controller['getQueues']);router[_0xddb9('0x9')](_0xddb9('0xf'),auth[_0xddb9('0xa')](),controller[_0xddb9('0x10')]);router[_0xddb9('0x11')]('/',auth[_0xddb9('0xa')](),controller[_0xddb9('0x12')]);router['post'](_0xddb9('0xe'),auth['isAuthenticated'](),controller[_0xddb9('0x13')]);router[_0xddb9('0x11')](_0xddb9('0xf'),auth[_0xddb9('0xa')](),controller[_0xddb9('0x14')]);router[_0xddb9('0x15')](_0xddb9('0xc'),auth[_0xddb9('0xa')](),controller[_0xddb9('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xddb9('0x17')]);router[_0xddb9('0x18')](_0xddb9('0xe'),auth['isAuthenticated'](),controller[_0xddb9('0x19')]);router[_0xddb9('0x18')](_0xddb9('0xf'),auth[_0xddb9('0xa')](),controller[_0xddb9('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x25fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/queues','getQueues','getAgents','post','create','addQueues','/:id/users','addAgents','/:id','destroy','removeQueues','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x25fe,0x12e));var _0xe25f=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x25fe[_0x413b4d];return _0x8b810a;};'use strict';var multer=require(_0xe25f('0x0'));var util=require(_0xe25f('0x1'));var path=require(_0xe25f('0x2'));var timeout=require(_0xe25f('0x3'));var express=require(_0xe25f('0x4'));var router=express[_0xe25f('0x5')]();var auth=require(_0xe25f('0x6'));var interaction=require(_0xe25f('0x7'));var config=require(_0xe25f('0x8'));var controller=require(_0xe25f('0x9'));router[_0xe25f('0xa')]('/',auth[_0xe25f('0xb')](),controller[_0xe25f('0xc')]);router[_0xe25f('0xa')]('/:id',auth[_0xe25f('0xb')](),controller[_0xe25f('0xd')]);router[_0xe25f('0xa')](_0xe25f('0xe'),auth[_0xe25f('0xb')](),controller[_0xe25f('0xf')]);router[_0xe25f('0xa')]('/:id/users',auth[_0xe25f('0xb')](),controller[_0xe25f('0x10')]);router[_0xe25f('0x11')]('/',auth[_0xe25f('0xb')](),controller[_0xe25f('0x12')]);router[_0xe25f('0x11')]('/:id/queues',auth[_0xe25f('0xb')](),controller[_0xe25f('0x13')]);router['post'](_0xe25f('0x14'),auth[_0xe25f('0xb')](),controller[_0xe25f('0x15')]);router['put'](_0xe25f('0x16'),auth[_0xe25f('0xb')](),controller['update']);router['delete'](_0xe25f('0x16'),auth[_0xe25f('0xb')](),controller[_0xe25f('0x17')]);router['delete'](_0xe25f('0xe'),auth[_0xe25f('0xb')](),controller[_0xe25f('0x18')]);router[_0xe25f('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xe25f('0x1a')]);module[_0xe25f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index abc0874..7c1cb8f 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 _0x92f3=['STRING','name','sequelize','exports'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x92f3,0x72));var _0x392f=function(_0xb51120,_0x526748){_0xb51120=_0xb51120-0x0;var _0x241708=_0x92f3[_0xb51120];return _0x241708;};'use strict';var Sequelize=require(_0x392f('0x0'));module[_0x392f('0x1')]={'name':{'type':Sequelize[_0x392f('0x2')],'allowNull':![],'unique':_0x392f('0x3')},'description':{'type':Sequelize[_0x392f('0x2')]}}; \ No newline at end of file +var _0xf13a=['exports','STRING','name','sequelize'];(function(_0x4e9299,_0x5ac1ec){var _0x42359b=function(_0x12186e){while(--_0x12186e){_0x4e9299['push'](_0x4e9299['shift']());}};_0x42359b(++_0x5ac1ec);}(_0xf13a,0x1db));var _0xaf13=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xf13a[_0x11a55c];return _0x26c390;};'use strict';var Sequelize=require(_0xaf13('0x0'));module[_0xaf13('0x1')]={'name':{'type':Sequelize[_0xaf13('0x2')],'allowNull':![],'unique':_0xaf13('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 399bcbb..e03e85a 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 _0xde9f=['Openchannel','Whatsapp','sequelize','transaction','Voice','through','penalty','QueueId','TeamVoiceQueue','User','Queue','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','spread','Queue:remove','removeAgents','getAgents','html-pdf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Teams','UserProfileResource','destroy','error','stack','name','send','index','map','Team','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','findOne','ids','removeQueues','remove','addAgents','Chat','Mail','Sms','Fax'];(function(_0x43088c,_0xfb4ddf){var _0x361689=function(_0x5559e2){while(--_0x5559e2){_0x43088c['push'](_0x43088c['shift']());}};_0x361689(++_0xfb4ddf);}(_0xde9f,0x118));var _0xfde9=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0xde9f[_0x44c974];return _0x5214c6;};'use strict';var pdf=require(_0xfde9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfde9('0x1'));var jsonpatch=require(_0xfde9('0x2'));var rp=require('request-promise');var moment=require(_0xfde9('0x3'));var BPromise=require(_0xfde9('0x4'));var Mustache=require('mustache');var util=require(_0xfde9('0x5'));var path=require(_0xfde9('0x6'));var sox=require(_0xfde9('0x7'));var csv=require(_0xfde9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfde9('0x9'));var crypto=require(_0xfde9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfde9('0xb'));var toCsv=require(_0xfde9('0x8'));var querystring=require(_0xfde9('0xc'));var Papa=require(_0xfde9('0xd'));var Redis=require(_0xfde9('0xe'));var authService=require(_0xfde9('0xf'));var qs=require(_0xfde9('0x10'));var as=require(_0xfde9('0x11'));var hardwareService=require(_0xfde9('0x12'));var logger=require(_0xfde9('0x13'))(_0xfde9('0x14'));var utils=require(_0xfde9('0x15'));var config=require(_0xfde9('0x16'));var licenseUtil=require(_0xfde9('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfde9('0x18')](config[_0xfde9('0x19')],{'host':_0xfde9('0x1a'),'port':0x18eb});var socket=require(_0xfde9('0x1b'))(new Redis(config['redis']));require('./team.socket')[_0xfde9('0x1c')](socket);function respondWithStatusCode(_0x3f8d50,_0x22f774){_0x22f774=_0x22f774||0xcc;return function(_0x5961ae){if(_0x5961ae){return _0x3f8d50[_0xfde9('0x1d')](_0x22f774);}return _0x3f8d50['status'](_0x22f774)[_0xfde9('0x1e')]();};}function respondWithResult(_0x310b90,_0x1ed070){_0x1ed070=_0x1ed070||0xc8;return function(_0x5ebd40){if(_0x5ebd40){return _0x310b90[_0xfde9('0x1f')](_0x1ed070)[_0xfde9('0x20')](_0x5ebd40);}};}function respondWithFilteredResult(_0x1a42ef,_0x5b87ea){return function(_0x4c9f24){if(_0x4c9f24){var _0x5eb89e=_0x4c9f24['count'],_0x544f19=_0x5b87ea['offset'],_0x166f1c=_0x5b87ea[_0xfde9('0x21')]+_0x5b87ea[_0xfde9('0x22')],_0x3f1ab3;if(_0x166f1c>=_0x5eb89e){_0x166f1c=_0x5eb89e;_0x3f1ab3=0xc8;}else{_0x3f1ab3=0xce;}_0x1a42ef[_0xfde9('0x1f')](_0x3f1ab3);return _0x1a42ef[_0xfde9('0x23')](_0xfde9('0x24'),_0x544f19+'-'+_0x166f1c+'/'+_0x5eb89e)[_0xfde9('0x20')](_0x4c9f24);}return null;};}function patchUpdates(_0x335e55){return function(_0x2ef059){try{jsonpatch[_0xfde9('0x25')](_0x2ef059,_0x335e55,!![]);}catch(_0x4538a9){return BPromise[_0xfde9('0x26')](_0x4538a9);}return _0x2ef059[_0xfde9('0x27')]();};}function saveUpdates(_0x54c1b8,_0x2be7c5){return function(_0x49006c){if(_0x49006c){return _0x49006c[_0xfde9('0x28')](_0x54c1b8)[_0xfde9('0x29')](function(_0x20bdb3){return _0x20bdb3;});}return null;};}function removeEntity(_0x5d0a74,_0x12e3e7){return function(_0x10e809){if(_0x10e809){return _0x10e809['destroy']()[_0xfde9('0x29')](function(){var _0x1c4864=_0x10e809[_0xfde9('0x2a')]({'plain':!![]});var _0x242dae=_0xfde9('0x2b');return db[_0xfde9('0x2c')][_0xfde9('0x2d')]({'where':{'type':_0x242dae,'resourceId':_0x1c4864['id']}})[_0xfde9('0x29')](function(){return _0x10e809;});})[_0xfde9('0x29')](function(){_0x5d0a74[_0xfde9('0x1f')](0xcc)[_0xfde9('0x1e')]();});}};}function handleEntityNotFound(_0x4205f6,_0x457402){return function(_0x441bba){if(!_0x441bba){_0x4205f6[_0xfde9('0x1d')](0x194);}return _0x441bba;};}function handleError(_0x1514f8,_0x4b7956){_0x4b7956=_0x4b7956||0x1f4;return function(_0x5cbf71){logger[_0xfde9('0x2e')](_0x5cbf71[_0xfde9('0x2f')]);if(_0x5cbf71['name']){delete _0x5cbf71[_0xfde9('0x30')];}_0x1514f8[_0xfde9('0x1f')](_0x4b7956)[_0xfde9('0x31')](_0x5cbf71);};}exports[_0xfde9('0x32')]=function(_0x3c8c48,_0x595b4e){var _0x375b0d={},_0x1af09e={},_0x4a7e0b={'count':0x0,'rows':[]};var _0x150e21=_[_0xfde9('0x33')](db[_0xfde9('0x34')][_0xfde9('0x35')],function(_0x17d994){return{'name':_0x17d994['fieldName'],'type':_0x17d994[_0xfde9('0x36')]['key']};});_0x1af09e[_0xfde9('0x37')]=_['map'](_0x150e21,_0xfde9('0x30'));_0x1af09e['query']=_[_0xfde9('0x38')](_0x3c8c48['query']);_0x1af09e[_0xfde9('0x39')]=_[_0xfde9('0x3a')](_0x1af09e[_0xfde9('0x37')],_0x1af09e[_0xfde9('0x3b')]);_0x375b0d[_0xfde9('0x3c')]=_[_0xfde9('0x3a')](_0x1af09e[_0xfde9('0x37')],qs[_0xfde9('0x3d')](_0x3c8c48[_0xfde9('0x3b')][_0xfde9('0x3d')]));_0x375b0d[_0xfde9('0x3c')]=_0x375b0d['attributes'][_0xfde9('0x3e')]?_0x375b0d[_0xfde9('0x3c')]:_0x1af09e[_0xfde9('0x37')];if(!_0x3c8c48[_0xfde9('0x3b')]['hasOwnProperty'](_0xfde9('0x3f'))){_0x375b0d[_0xfde9('0x22')]=qs[_0xfde9('0x22')](_0x3c8c48[_0xfde9('0x3b')][_0xfde9('0x22')]);_0x375b0d[_0xfde9('0x21')]=qs['offset'](_0x3c8c48[_0xfde9('0x3b')]['offset']);}_0x375b0d[_0xfde9('0x40')]=qs[_0xfde9('0x41')](_0x3c8c48[_0xfde9('0x3b')]['sort']);_0x375b0d[_0xfde9('0x42')]=qs[_0xfde9('0x39')](_[_0xfde9('0x43')](_0x3c8c48[_0xfde9('0x3b')],_0x1af09e[_0xfde9('0x39')]),_0x150e21);if(_0x3c8c48[_0xfde9('0x3b')][_0xfde9('0x44')]){_0x375b0d[_0xfde9('0x42')]=_['merge'](_0x375b0d[_0xfde9('0x42')],{'$or':_[_0xfde9('0x33')](_0x150e21,function(_0x1bbea3){if(_0x1bbea3[_0xfde9('0x36')]!==_0xfde9('0x45')){var _0x588163={};_0x588163[_0x1bbea3[_0xfde9('0x30')]]={'$like':'%'+_0x3c8c48[_0xfde9('0x3b')]['filter']+'%'};return _0x588163;}})});}_0x375b0d=_[_0xfde9('0x46')]({},_0x375b0d,_0x3c8c48[_0xfde9('0x47')]);var _0x319aae={'where':_0x375b0d['where']};return db['Team']['count'](_0x319aae)[_0xfde9('0x29')](function(_0x465747){_0x4a7e0b[_0xfde9('0x48')]=_0x465747;if(_0x3c8c48[_0xfde9('0x3b')][_0xfde9('0x49')]){_0x375b0d[_0xfde9('0x4a')]=[{'all':!![]}];}return db[_0xfde9('0x34')][_0xfde9('0x4b')](_0x375b0d);})[_0xfde9('0x29')](function(_0x11401a){_0x4a7e0b[_0xfde9('0x4c')]=_0x11401a;return _0x4a7e0b;})[_0xfde9('0x29')](respondWithFilteredResult(_0x595b4e,_0x375b0d))['catch'](handleError(_0x595b4e,null));};exports['show']=function(_0x5aae81,_0x50823d){var _0x13f081={'raw':![],'where':{'id':_0x5aae81[_0xfde9('0x4d')]['id']}},_0x39dc2c={};_0x39dc2c[_0xfde9('0x37')]=_[_0xfde9('0x38')](db[_0xfde9('0x34')][_0xfde9('0x35')]);_0x39dc2c[_0xfde9('0x3b')]=_[_0xfde9('0x38')](_0x5aae81[_0xfde9('0x3b')]);_0x39dc2c[_0xfde9('0x39')]=_[_0xfde9('0x3a')](_0x39dc2c[_0xfde9('0x37')],_0x39dc2c[_0xfde9('0x3b')]);_0x13f081[_0xfde9('0x3c')]=_[_0xfde9('0x3a')](_0x39dc2c[_0xfde9('0x37')],qs[_0xfde9('0x3d')](_0x5aae81[_0xfde9('0x3b')]['fields']));_0x13f081[_0xfde9('0x3c')]=_0x13f081[_0xfde9('0x3c')][_0xfde9('0x3e')]?_0x13f081[_0xfde9('0x3c')]:_0x39dc2c[_0xfde9('0x37')];if(_0x5aae81[_0xfde9('0x3b')]['includeAll']){_0x13f081[_0xfde9('0x4a')]=[{'all':!![]}];}_0x13f081=_['merge']({},_0x13f081,_0x5aae81[_0xfde9('0x47')]);return db['Team'][_0xfde9('0x4e')](_0x13f081)[_0xfde9('0x29')](handleEntityNotFound(_0x50823d,null))[_0xfde9('0x29')](respondWithResult(_0x50823d,null))[_0xfde9('0x4f')](handleError(_0x50823d,null));};exports[_0xfde9('0x50')]=function(_0x562f94,_0x1c9140){return db[_0xfde9('0x34')][_0xfde9('0x50')](_0x562f94[_0xfde9('0x51')],{})[_0xfde9('0x29')](function(_0x3379a0){var _0x1a678c=_0x562f94[_0xfde9('0x52')][_0xfde9('0x2a')]({'plain':!![]});if(!_0x1a678c)throw new Error(_0xfde9('0x53'));if(_0x1a678c[_0xfde9('0x54')]==='user'){var _0x29b1ec=_0x3379a0[_0xfde9('0x2a')]({'plain':!![]});var _0x240698=_0xfde9('0x2b');return db[_0xfde9('0x55')][_0xfde9('0x4e')]({'where':{'name':_0x240698,'userProfileId':_0x1a678c[_0xfde9('0x56')]},'raw':!![]})[_0xfde9('0x29')](function(_0x3025ee){if(_0x3025ee&&_0x3025ee[_0xfde9('0x57')]===0x0){return db[_0xfde9('0x2c')][_0xfde9('0x50')]({'name':_0x29b1ec[_0xfde9('0x30')],'resourceId':_0x29b1ec['id'],'type':_0x3025ee['name'],'sectionId':_0x3025ee['id']},{})[_0xfde9('0x29')](function(){return _0x3379a0;});}else{return _0x3379a0;}})['catch'](function(_0x5e6fef){logger[_0xfde9('0x2e')](_0xfde9('0x58'),_0x5e6fef);throw _0x5e6fef;});}return _0x3379a0;})[_0xfde9('0x29')](respondWithResult(_0x1c9140,0xc9))[_0xfde9('0x4f')](handleError(_0x1c9140,null));};exports['update']=function(_0x397492,_0x22327a){if(_0x397492[_0xfde9('0x51')]['id']){delete _0x397492[_0xfde9('0x51')]['id'];}return db[_0xfde9('0x34')]['find']({'where':{'id':_0x397492[_0xfde9('0x4d')]['id']}})[_0xfde9('0x29')](handleEntityNotFound(_0x22327a,null))[_0xfde9('0x29')](saveUpdates(_0x397492[_0xfde9('0x51')],null))['then'](respondWithResult(_0x22327a,null))[_0xfde9('0x4f')](handleError(_0x22327a,null));};exports['destroy']=function(_0x2807be,_0x2e6328){return db[_0xfde9('0x34')][_0xfde9('0x4e')]({'where':{'id':_0x2807be[_0xfde9('0x4d')]['id']}})[_0xfde9('0x29')](handleEntityNotFound(_0x2e6328,null))[_0xfde9('0x29')](removeEntity(_0x2e6328,null))[_0xfde9('0x4f')](handleError(_0x2e6328,null));};exports[_0xfde9('0x59')]=function(_0x27150b,_0x441e6b,_0x1d74bb){return db[_0xfde9('0x34')]['findOne']({'where':{'id':_0x27150b[_0xfde9('0x4d')]['id']}})[_0xfde9('0x29')](handleEntityNotFound(_0x441e6b,null))['then'](function(_0x1aa1c1){if(!_0x27150b[_0xfde9('0x3b')][_0xfde9('0x5a')]||!utils[_0xfde9('0x5b')](_0x27150b[_0xfde9('0x3b')][_0xfde9('0x5a')])){throw new db[(_0xfde9('0x5c'))][(_0xfde9('0x5d'))](_0xfde9('0x5e'));}var _0x4dd622={};var _0x23404e={};_0x23404e['model']=_[_0xfde9('0x38')](db[_[_0xfde9('0x5f')](_0x27150b['query'][_0xfde9('0x5a')][_0xfde9('0x60')]())+'Queue'][_0xfde9('0x35')]);_0x23404e[_0xfde9('0x3b')]=_['keys'](_0x27150b[_0xfde9('0x3b')]);_0x23404e[_0xfde9('0x39')]=_[_0xfde9('0x3a')](_0x23404e['model'],_0x23404e[_0xfde9('0x3b')]);_0x4dd622[_0xfde9('0x3c')]=_[_0xfde9('0x3a')](_0x23404e[_0xfde9('0x37')],qs[_0xfde9('0x3d')](_0x27150b['query'][_0xfde9('0x3d')]));_0x4dd622[_0xfde9('0x3c')]=_0x4dd622['attributes']['length']?_0x4dd622[_0xfde9('0x3c')]:_0x23404e[_0xfde9('0x37')];_0x4dd622[_0xfde9('0x22')]=qs[_0xfde9('0x22')](_0x27150b[_0xfde9('0x3b')][_0xfde9('0x22')]);_0x4dd622['offset']=qs[_0xfde9('0x21')](_0x27150b[_0xfde9('0x3b')][_0xfde9('0x21')]);_0x4dd622[_0xfde9('0x40')]=qs['sort'](_0x27150b['query'][_0xfde9('0x41')]);_0x4dd622[_0xfde9('0x42')]=qs['filters'](_[_0xfde9('0x43')](_0x27150b[_0xfde9('0x3b')],_0x23404e['filters']));_0x4dd622=_[_0xfde9('0x46')]({},_0x4dd622,_0x27150b[_0xfde9('0x47')]);return _0x1aa1c1[_0xfde9('0x2a')+_[_0xfde9('0x5f')](_0x27150b[_0xfde9('0x3b')][_0xfde9('0x5a')][_0xfde9('0x60')]())+_0xfde9('0x61')](_0x4dd622);})['then'](respondWithResult(_0x441e6b,null))[_0xfde9('0x4f')](handleError(_0x441e6b,null));};exports['addQueues']=function(_0x55054a,_0x21577f,_0x30bca6){return db[_0xfde9('0x34')][_0xfde9('0x62')]({'where':{'id':_0x55054a['params']['id']}})[_0xfde9('0x29')](function(_0x3a4749){if(_0x3a4749){if(!_0x55054a[_0xfde9('0x51')][_0xfde9('0x5a')]||!utils[_0xfde9('0x5b')](_0x55054a['body'][_0xfde9('0x5a')])){throw new db[(_0xfde9('0x5c'))][(_0xfde9('0x5d'))](_0xfde9('0x5e'));}return _0x3a4749['add'+_[_0xfde9('0x5f')](_0x55054a[_0xfde9('0x51')][_0xfde9('0x5a')]['toLowerCase']())+_0xfde9('0x61')](_0x55054a[_0xfde9('0x51')][_0xfde9('0x63')]);}return null;})[_0xfde9('0x29')](handleEntityNotFound(_0x21577f,null))[_0xfde9('0x29')](respondWithStatusCode(_0x21577f,null))['catch'](handleError(_0x21577f,null));};exports[_0xfde9('0x64')]=function(_0x432496,_0x418dc2,_0x4a0843){return db[_0xfde9('0x34')][_0xfde9('0x62')]({'where':{'id':_0x432496['params']['id']}})['then'](function(_0x4b9506){if(_0x4b9506){if(!_0x432496[_0xfde9('0x3b')][_0xfde9('0x5a')]||!utils['isValidChannel'](_0x432496['query'][_0xfde9('0x5a')])){throw new db[(_0xfde9('0x5c'))]['ValidationError']('Unknown\x20channel');}return _0x4b9506[_0xfde9('0x65')+_[_0xfde9('0x5f')](_0x432496[_0xfde9('0x3b')]['channel'][_0xfde9('0x60')]())+_0xfde9('0x61')](_0x432496[_0xfde9('0x3b')]['ids']);}return null;})['then'](handleEntityNotFound(_0x418dc2,null))['then'](respondWithStatusCode(_0x418dc2,null))[_0xfde9('0x4f')](handleError(_0x418dc2,null));};exports[_0xfde9('0x66')]=function(_0x4a1ba3,_0x31774f){return db[_0xfde9('0x34')]['find']({'where':{'id':_0x4a1ba3[_0xfde9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31774f,null))[_0xfde9('0x29')](function(_0x58a330){if(_0x58a330){var _0x149841=['Voice',_0xfde9('0x67'),_0xfde9('0x68'),_0xfde9('0x69'),_0xfde9('0x6a'),_0xfde9('0x6b'),_0xfde9('0x6c')];return db[_0xfde9('0x6d')][_0xfde9('0x6e')](function(_0x3a4e81){var _0x515a64=_[_0xfde9('0x33')](_0x149841,function(_0x1f485c){var _0x75364a={'attributes':['id',_0xfde9('0x30')]};if(_0x1f485c===_0xfde9('0x6f')){_0x75364a[_0xfde9('0x70')]={'attributes':[_0xfde9('0x71')]};}return _0x58a330[_0xfde9('0x2a')+_0x1f485c+_0xfde9('0x61')](_0x75364a)[_0xfde9('0x29')](function(_0x23d932){var _0x4b2582=_[_0xfde9('0x33')](_0x23d932,function(_0x28400e){var _0x2d2e22=_[_0xfde9('0x33')](_0x4a1ba3[_0xfde9('0x51')][_0xfde9('0x63')],function(_0x217799){var _0x22afee={'where':{'UserId':_0x217799,[_0x1f485c+_0xfde9('0x72')]:_0x28400e['id']},'transaction':_0x3a4e81};if(_0x1f485c===_0xfde9('0x6f')){_0x22afee['defaults']={'penalty':_0x28400e[_0xfde9('0x73')][_0xfde9('0x71')]};}return db[_0xfde9('0x74')+_0x1f485c+_0xfde9('0x75')]['findOrCreate'](_0x22afee)[_0xfde9('0x29')](function(){socket['emit'](_0xfde9('0x52')+_0x1f485c+'Queue:save',{'UserId':_0x217799,[_0x1f485c+'QueueId']:_0x28400e['id']});if(_0x1f485c!==_0xfde9('0x6f'))return;return db['User'][_0xfde9('0x4b')]({'where':{'id':_0x4a1ba3[_0xfde9('0x51')][_0xfde9('0x63')],'online':0x1},'attributes':['id',_0xfde9('0x30'),_0xfde9('0x76'),'voicePause',_0xfde9('0x77')],'raw':!![]})['then'](function(_0x34a750){var _0x2ec37b=_[_0xfde9('0x33')](_0x34a750,function(_0x598e66){return db[_0xfde9('0x78')][_0xfde9('0x79')]({'membername':_0x598e66[_0xfde9('0x30')],'UserId':_0x598e66['id'],'queue_name':_0x28400e[_0xfde9('0x30')],'VoiceQueueId':_0x28400e['id'],'interface':_['isNil'](_0x598e66[_0xfde9('0x77')])?util[_0xfde9('0x7a')](_0xfde9('0x7b'),_0x598e66['name']):_0x598e66[_0xfde9('0x77')],'paused':_0x598e66['voicePause']||![],'penalty':_0x28400e[_0xfde9('0x73')][_0xfde9('0x71')]},{'transaction':_0x3a4e81});});return Promise[_0xfde9('0x7c')](_0x2ec37b);});});});return Promise[_0xfde9('0x7c')](_0x2d2e22);});return Promise['all'](_0x4b2582);});});return Promise[_0xfde9('0x7c')](_0x515a64)[_0xfde9('0x29')](function(){return _0x58a330[_0xfde9('0x66')](_0x4a1ba3[_0xfde9('0x51')][_0xfde9('0x63')],{'transaction':_0x3a4e81})[_0xfde9('0x7d')](function(_0x2d61a5){return _0x2d61a5;});});});}})[_0xfde9('0x29')](respondWithResult(_0x31774f,null))[_0xfde9('0x4f')](handleError(_0x31774f,null));};exports['removeAgents']=function(_0x24e40f,_0xf5ef10){return db[_0xfde9('0x34')][_0xfde9('0x4e')]({'where':{'id':_0x24e40f[_0xfde9('0x4d')]['id']}})[_0xfde9('0x29')](handleEntityNotFound(_0xf5ef10,null))['then'](function(_0x403b49){if(_0x403b49){var _0x37c7fa=[_0xfde9('0x6f'),_0xfde9('0x67'),_0xfde9('0x68'),'Sms',_0xfde9('0x6a'),_0xfde9('0x6b'),_0xfde9('0x6c')];return db['sequelize'][_0xfde9('0x6e')](function(_0x584984){var _0xa7756f=_[_0xfde9('0x33')](_0x37c7fa,function(_0x402d08){var _0x1cb72f={'attributes':['id',_0xfde9('0x30')]};return _0x403b49[_0xfde9('0x2a')+_0x402d08+_0xfde9('0x61')](_0x1cb72f)[_0xfde9('0x29')](function(_0x58d7b8){var _0x57e3f3=_[_0xfde9('0x33')](_0x58d7b8,function(_0x5585e3){return _0x5585e3['removeAgents'](_0x24e40f['query']['ids'],{'transaction':_0x584984})[_0xfde9('0x29')](function(){var _0x1db63e=JSON['parse']('['+_0x24e40f[_0xfde9('0x3b')][_0xfde9('0x63')]+']');var _0x4648b3=_['map'](_0x1db63e,function(_0x4a299a){socket['emit']('user'+_0x402d08+_0xfde9('0x7e'),{'UserId':Number(_0x4a299a),[_0x402d08+'QueueId']:_0x5585e3['id']});if(_0x402d08!==_0xfde9('0x6f'))return;return db[_0xfde9('0x78')][_0xfde9('0x2d')]({'where':{'VoiceQueueId':_0x5585e3['id'],'UserId':_0x4a299a},'transaction':_0x584984});});return Promise[_0xfde9('0x7c')](_0x4648b3);});});return Promise['all'](_0x57e3f3);});});return Promise[_0xfde9('0x7c')](_0xa7756f)[_0xfde9('0x29')](function(){return _0x403b49[_0xfde9('0x7f')](_0x24e40f[_0xfde9('0x3b')][_0xfde9('0x63')],{'transaction':_0x584984});});});}})[_0xfde9('0x29')](respondWithStatusCode(_0xf5ef10,null))[_0xfde9('0x4f')](handleError(_0xf5ef10,null));};exports[_0xfde9('0x80')]=function(_0x69dff2,_0xe8616d,_0x554ee9){var _0x39ae38={};var _0x574b41={};var _0x12674a;var _0x56ee1a;return db[_0xfde9('0x34')][_0xfde9('0x62')]({'where':{'id':_0x69dff2[_0xfde9('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe8616d,null))[_0xfde9('0x29')](function(_0x36cea0){if(_0x36cea0){_0x12674a=_0x36cea0;_0x574b41['model']=_['keys'](db[_0xfde9('0x74')]['rawAttributes']);_0x574b41[_0xfde9('0x3b')]=_[_0xfde9('0x38')](_0x69dff2[_0xfde9('0x3b')]);_0x574b41[_0xfde9('0x39')]=_[_0xfde9('0x3a')](_0x574b41['model'],_0x574b41[_0xfde9('0x3b')]);_0x39ae38[_0xfde9('0x3c')]=_[_0xfde9('0x3a')](_0x574b41[_0xfde9('0x37')],qs['fields'](_0x69dff2[_0xfde9('0x3b')][_0xfde9('0x3d')]));_0x39ae38['attributes']=_0x39ae38['attributes'][_0xfde9('0x3e')]?_0x39ae38[_0xfde9('0x3c')]:_0x574b41[_0xfde9('0x37')];_0x39ae38[_0xfde9('0x40')]=qs[_0xfde9('0x41')](_0x69dff2[_0xfde9('0x3b')][_0xfde9('0x41')]);_0x39ae38[_0xfde9('0x42')]=qs[_0xfde9('0x39')](_[_0xfde9('0x43')](_0x69dff2[_0xfde9('0x3b')],_0x574b41['filters']));if(_0x69dff2[_0xfde9('0x3b')][_0xfde9('0x44')]){_0x39ae38[_0xfde9('0x42')]=_[_0xfde9('0x46')](_0x39ae38[_0xfde9('0x42')],{'$or':_[_0xfde9('0x33')](_0x39ae38['attributes'],function(_0x82208f){var _0x436793={};_0x436793[_0x82208f]={'$like':'%'+_0x69dff2[_0xfde9('0x3b')]['filter']+'%'};return _0x436793;})});}_0x39ae38=_[_0xfde9('0x46')]({},_0x39ae38,_0x69dff2[_0xfde9('0x47')]);return _0x12674a[_0xfde9('0x80')](_0x39ae38);}})['then'](function(_0x12cfa5){if(_0x12cfa5){_0x56ee1a=_0x12cfa5[_0xfde9('0x3e')];if(!_0x69dff2[_0xfde9('0x3b')]['hasOwnProperty'](_0xfde9('0x3f'))){_0x39ae38[_0xfde9('0x22')]=qs['limit'](_0x69dff2[_0xfde9('0x3b')]['limit']);_0x39ae38['offset']=qs[_0xfde9('0x21')](_0x69dff2['query'][_0xfde9('0x21')]);}return _0x12674a[_0xfde9('0x80')](_0x39ae38);}})[_0xfde9('0x29')](function(_0x18231b){if(_0x18231b){return _0x18231b?{'count':_0x56ee1a,'rows':_0x18231b}:null;}})[_0xfde9('0x29')](respondWithResult(_0xe8616d,null))[_0xfde9('0x4f')](handleError(_0xe8616d,null));}; \ No newline at end of file +var _0xd523=['name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','VIRTUAL','merge','options','Team','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','channel','Sequelize','ValidationError','capitalize','Queue','order','toLowerCase','Queues','addQueues','findOne','isValidChannel','Unknown\x20channel','add','ids','removeQueues','addAgents','Voice','Mail','Openchannel','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','Queue:save','online','interface','UserVoiceQueueRt','upsert','isNil','format','voicePause','all','spread','removeAgents','Chat','Sms','Fax','Whatsapp','sequelize','transaction','getAgents','User','filter','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','./team.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x1a45d2,_0x461b4b){var _0x35866f=function(_0x2e0fbe){while(--_0x2e0fbe){_0x1a45d2['push'](_0x1a45d2['shift']());}};_0x35866f(++_0x461b4b);}(_0xd523,0x153));var _0x3d52=function(_0x44eb19,_0x5a7fd6){_0x44eb19=_0x44eb19-0x0;var _0x1e4611=_0xd523[_0x44eb19];return _0x1e4611;};'use strict';var pdf=require(_0x3d52('0x0'));var emlformat=require(_0x3d52('0x1'));var rimraf=require(_0x3d52('0x2'));var zipdir=require(_0x3d52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d52('0x4'));var moment=require(_0x3d52('0x5'));var BPromise=require(_0x3d52('0x6'));var Mustache=require('mustache');var util=require(_0x3d52('0x7'));var path=require(_0x3d52('0x8'));var sox=require(_0x3d52('0x9'));var csv=require(_0x3d52('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3d52('0xb'));var crypto=require(_0x3d52('0xc'));var jsforce=require(_0x3d52('0xd'));var deskjs=require(_0x3d52('0xe'));var toCsv=require(_0x3d52('0xa'));var querystring=require(_0x3d52('0xf'));var Papa=require(_0x3d52('0x10'));var Redis=require(_0x3d52('0x11'));var authService=require(_0x3d52('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d52('0x13'));var hardwareService=require(_0x3d52('0x14'));var logger=require(_0x3d52('0x15'))(_0x3d52('0x16'));var utils=require(_0x3d52('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3d52('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3d52('0x19')](config[_0x3d52('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d52('0x1b'))[_0x3d52('0x1c')](socket);function respondWithStatusCode(_0x1430c1,_0x2fd86e){_0x2fd86e=_0x2fd86e||0xcc;return function(_0x336261){if(_0x336261){return _0x1430c1[_0x3d52('0x1d')](_0x2fd86e);}return _0x1430c1[_0x3d52('0x1e')](_0x2fd86e)[_0x3d52('0x1f')]();};}function respondWithResult(_0x2e956d,_0x360659){_0x360659=_0x360659||0xc8;return function(_0x153c89){if(_0x153c89){return _0x2e956d[_0x3d52('0x1e')](_0x360659)[_0x3d52('0x20')](_0x153c89);}};}function respondWithFilteredResult(_0x10ec1e,_0x1dcea9){return function(_0x5bce9a){if(_0x5bce9a){var _0x163d88=_0x5bce9a[_0x3d52('0x21')],_0x3b3451=_0x1dcea9[_0x3d52('0x22')],_0x386cdb=_0x1dcea9[_0x3d52('0x22')]+_0x1dcea9['limit'],_0x54a514;if(_0x386cdb>=_0x163d88){_0x386cdb=_0x163d88;_0x54a514=0xc8;}else{_0x54a514=0xce;}_0x10ec1e[_0x3d52('0x1e')](_0x54a514);return _0x10ec1e[_0x3d52('0x23')](_0x3d52('0x24'),_0x3b3451+'-'+_0x386cdb+'/'+_0x163d88)[_0x3d52('0x20')](_0x5bce9a);}return null;};}function patchUpdates(_0x3bd95f){return function(_0xc0c16e){try{jsonpatch[_0x3d52('0x25')](_0xc0c16e,_0x3bd95f,!![]);}catch(_0x34b572){return BPromise['reject'](_0x34b572);}return _0xc0c16e[_0x3d52('0x26')]();};}function saveUpdates(_0x10f432,_0xd31ce4){return function(_0x5826c9){if(_0x5826c9){return _0x5826c9[_0x3d52('0x27')](_0x10f432)[_0x3d52('0x28')](function(_0x423d33){return _0x423d33;});}return null;};}function removeEntity(_0xc6c76,_0x3816bc){return function(_0x349b30){if(_0x349b30){return _0x349b30[_0x3d52('0x29')]()[_0x3d52('0x28')](function(){var _0x44ba59=_0x349b30[_0x3d52('0x2a')]({'plain':!![]});var _0x1ef6db='Teams';return db[_0x3d52('0x2b')][_0x3d52('0x29')]({'where':{'type':_0x1ef6db,'resourceId':_0x44ba59['id']}})[_0x3d52('0x28')](function(){return _0x349b30;});})[_0x3d52('0x28')](function(){_0xc6c76['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x473842,_0x11bf44){return function(_0x28e50d){if(!_0x28e50d){_0x473842['sendStatus'](0x194);}return _0x28e50d;};}function handleError(_0x209cca,_0x4312a7){_0x4312a7=_0x4312a7||0x1f4;return function(_0x2fd0ec){logger[_0x3d52('0x2c')](_0x2fd0ec['stack']);if(_0x2fd0ec[_0x3d52('0x2d')]){delete _0x2fd0ec[_0x3d52('0x2d')];}_0x209cca[_0x3d52('0x1e')](_0x4312a7)[_0x3d52('0x2e')](_0x2fd0ec);};}exports['index']=function(_0x12538a,_0x5a7455){var _0x5f006b={},_0x389582={},_0x45eabe={'count':0x0,'rows':[]};var _0x5e4e7b=_[_0x3d52('0x2f')](db['Team'][_0x3d52('0x30')],function(_0x4c0273){return{'name':_0x4c0273['fieldName'],'type':_0x4c0273[_0x3d52('0x31')][_0x3d52('0x32')]};});_0x389582[_0x3d52('0x33')]=_[_0x3d52('0x2f')](_0x5e4e7b,_0x3d52('0x2d'));_0x389582[_0x3d52('0x34')]=_[_0x3d52('0x35')](_0x12538a[_0x3d52('0x34')]);_0x389582[_0x3d52('0x36')]=_['intersection'](_0x389582[_0x3d52('0x33')],_0x389582[_0x3d52('0x34')]);_0x5f006b[_0x3d52('0x37')]=_[_0x3d52('0x38')](_0x389582['model'],qs[_0x3d52('0x39')](_0x12538a[_0x3d52('0x34')]['fields']));_0x5f006b[_0x3d52('0x37')]=_0x5f006b['attributes'][_0x3d52('0x3a')]?_0x5f006b[_0x3d52('0x37')]:_0x389582[_0x3d52('0x33')];if(!_0x12538a['query'][_0x3d52('0x3b')]('nolimit')){_0x5f006b[_0x3d52('0x3c')]=qs[_0x3d52('0x3c')](_0x12538a[_0x3d52('0x34')]['limit']);_0x5f006b['offset']=qs[_0x3d52('0x22')](_0x12538a[_0x3d52('0x34')][_0x3d52('0x22')]);}_0x5f006b['order']=qs[_0x3d52('0x3d')](_0x12538a[_0x3d52('0x34')][_0x3d52('0x3d')]);_0x5f006b[_0x3d52('0x3e')]=qs['filters'](_[_0x3d52('0x3f')](_0x12538a['query'],_0x389582['filters']),_0x5e4e7b);if(_0x12538a[_0x3d52('0x34')]['filter']){_0x5f006b[_0x3d52('0x3e')]=_['merge'](_0x5f006b[_0x3d52('0x3e')],{'$or':_['map'](_0x5e4e7b,function(_0x576562){if(_0x576562[_0x3d52('0x31')]!==_0x3d52('0x40')){var _0x5cecb5={};_0x5cecb5[_0x576562[_0x3d52('0x2d')]]={'$like':'%'+_0x12538a[_0x3d52('0x34')]['filter']+'%'};return _0x5cecb5;}})});}_0x5f006b=_[_0x3d52('0x41')]({},_0x5f006b,_0x12538a[_0x3d52('0x42')]);var _0x25702d={'where':_0x5f006b[_0x3d52('0x3e')]};return db[_0x3d52('0x43')][_0x3d52('0x21')](_0x25702d)[_0x3d52('0x28')](function(_0x5cf4b9){_0x45eabe['count']=_0x5cf4b9;if(_0x12538a['query']['includeAll']){_0x5f006b['include']=[{'all':!![]}];}return db[_0x3d52('0x43')]['findAll'](_0x5f006b);})[_0x3d52('0x28')](function(_0x49064e){_0x45eabe[_0x3d52('0x44')]=_0x49064e;return _0x45eabe;})[_0x3d52('0x28')](respondWithFilteredResult(_0x5a7455,_0x5f006b))[_0x3d52('0x45')](handleError(_0x5a7455,null));};exports[_0x3d52('0x46')]=function(_0x5cdeb7,_0x394200){var _0x1e0487={'raw':![],'where':{'id':_0x5cdeb7[_0x3d52('0x47')]['id']}},_0x5dd63c={};_0x5dd63c[_0x3d52('0x33')]=_[_0x3d52('0x35')](db['Team'][_0x3d52('0x30')]);_0x5dd63c['query']=_['keys'](_0x5cdeb7['query']);_0x5dd63c['filters']=_[_0x3d52('0x38')](_0x5dd63c[_0x3d52('0x33')],_0x5dd63c[_0x3d52('0x34')]);_0x1e0487['attributes']=_[_0x3d52('0x38')](_0x5dd63c['model'],qs[_0x3d52('0x39')](_0x5cdeb7[_0x3d52('0x34')]['fields']));_0x1e0487[_0x3d52('0x37')]=_0x1e0487[_0x3d52('0x37')][_0x3d52('0x3a')]?_0x1e0487[_0x3d52('0x37')]:_0x5dd63c['model'];if(_0x5cdeb7['query'][_0x3d52('0x48')]){_0x1e0487['include']=[{'all':!![]}];}_0x1e0487=_[_0x3d52('0x41')]({},_0x1e0487,_0x5cdeb7[_0x3d52('0x42')]);return db[_0x3d52('0x43')][_0x3d52('0x49')](_0x1e0487)['then'](handleEntityNotFound(_0x394200,null))[_0x3d52('0x28')](respondWithResult(_0x394200,null))['catch'](handleError(_0x394200,null));};exports[_0x3d52('0x4a')]=function(_0x2911da,_0x524b9a){return db[_0x3d52('0x43')][_0x3d52('0x4a')](_0x2911da[_0x3d52('0x4b')],{})[_0x3d52('0x28')](function(_0x2b0c0e){var _0x3f4db8=_0x2911da[_0x3d52('0x4c')][_0x3d52('0x2a')]({'plain':!![]});if(!_0x3f4db8)throw new Error(_0x3d52('0x4d'));if(_0x3f4db8['role']===_0x3d52('0x4c')){var _0x380699=_0x2b0c0e['get']({'plain':!![]});var _0x237a6e='Teams';return db[_0x3d52('0x4e')][_0x3d52('0x49')]({'where':{'name':_0x237a6e,'userProfileId':_0x3f4db8[_0x3d52('0x4f')]},'raw':!![]})['then'](function(_0x2cb287){if(_0x2cb287&&_0x2cb287[_0x3d52('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x380699[_0x3d52('0x2d')],'resourceId':_0x380699['id'],'type':_0x2cb287[_0x3d52('0x2d')],'sectionId':_0x2cb287['id']},{})['then'](function(){return _0x2b0c0e;});}else{return _0x2b0c0e;}})[_0x3d52('0x45')](function(_0x146a5b){logger[_0x3d52('0x2c')](_0x3d52('0x51'),_0x146a5b);throw _0x146a5b;});}return _0x2b0c0e;})[_0x3d52('0x28')](respondWithResult(_0x524b9a,0xc9))[_0x3d52('0x45')](handleError(_0x524b9a,null));};exports['update']=function(_0x2828d2,_0x1783d5){if(_0x2828d2[_0x3d52('0x4b')]['id']){delete _0x2828d2[_0x3d52('0x4b')]['id'];}return db[_0x3d52('0x43')][_0x3d52('0x49')]({'where':{'id':_0x2828d2[_0x3d52('0x47')]['id']}})[_0x3d52('0x28')](handleEntityNotFound(_0x1783d5,null))['then'](saveUpdates(_0x2828d2[_0x3d52('0x4b')],null))['then'](respondWithResult(_0x1783d5,null))[_0x3d52('0x45')](handleError(_0x1783d5,null));};exports[_0x3d52('0x29')]=function(_0x5434ee,_0x4e6d22){return db[_0x3d52('0x43')][_0x3d52('0x49')]({'where':{'id':_0x5434ee[_0x3d52('0x47')]['id']}})[_0x3d52('0x28')](handleEntityNotFound(_0x4e6d22,null))[_0x3d52('0x28')](removeEntity(_0x4e6d22,null))[_0x3d52('0x45')](handleError(_0x4e6d22,null));};exports[_0x3d52('0x52')]=function(_0x3e709b,_0x2f425f,_0x49f23f){return db[_0x3d52('0x43')]['findOne']({'where':{'id':_0x3e709b[_0x3d52('0x47')]['id']}})[_0x3d52('0x28')](handleEntityNotFound(_0x2f425f,null))[_0x3d52('0x28')](function(_0x3b1d34){if(!_0x3e709b[_0x3d52('0x34')][_0x3d52('0x53')]||!utils['isValidChannel'](_0x3e709b[_0x3d52('0x34')][_0x3d52('0x53')])){throw new db[(_0x3d52('0x54'))][(_0x3d52('0x55'))]('Unknown\x20channel');}var _0x1d6594={};var _0x327a3f={};_0x327a3f[_0x3d52('0x33')]=_[_0x3d52('0x35')](db[_[_0x3d52('0x56')](_0x3e709b['query'][_0x3d52('0x53')]['toLowerCase']())+_0x3d52('0x57')]['rawAttributes']);_0x327a3f[_0x3d52('0x34')]=_[_0x3d52('0x35')](_0x3e709b['query']);_0x327a3f['filters']=_['intersection'](_0x327a3f[_0x3d52('0x33')],_0x327a3f['query']);_0x1d6594[_0x3d52('0x37')]=_[_0x3d52('0x38')](_0x327a3f['model'],qs[_0x3d52('0x39')](_0x3e709b[_0x3d52('0x34')][_0x3d52('0x39')]));_0x1d6594['attributes']=_0x1d6594[_0x3d52('0x37')][_0x3d52('0x3a')]?_0x1d6594[_0x3d52('0x37')]:_0x327a3f[_0x3d52('0x33')];_0x1d6594[_0x3d52('0x3c')]=qs[_0x3d52('0x3c')](_0x3e709b[_0x3d52('0x34')][_0x3d52('0x3c')]);_0x1d6594[_0x3d52('0x22')]=qs[_0x3d52('0x22')](_0x3e709b[_0x3d52('0x34')][_0x3d52('0x22')]);_0x1d6594[_0x3d52('0x58')]=qs[_0x3d52('0x3d')](_0x3e709b[_0x3d52('0x34')][_0x3d52('0x3d')]);_0x1d6594[_0x3d52('0x3e')]=qs[_0x3d52('0x36')](_[_0x3d52('0x3f')](_0x3e709b['query'],_0x327a3f[_0x3d52('0x36')]));_0x1d6594=_['merge']({},_0x1d6594,_0x3e709b[_0x3d52('0x42')]);return _0x3b1d34[_0x3d52('0x2a')+_[_0x3d52('0x56')](_0x3e709b[_0x3d52('0x34')]['channel'][_0x3d52('0x59')]())+_0x3d52('0x5a')](_0x1d6594);})[_0x3d52('0x28')](respondWithResult(_0x2f425f,null))[_0x3d52('0x45')](handleError(_0x2f425f,null));};exports[_0x3d52('0x5b')]=function(_0x439f50,_0x118b68,_0xb1e4df){return db[_0x3d52('0x43')][_0x3d52('0x5c')]({'where':{'id':_0x439f50[_0x3d52('0x47')]['id']}})[_0x3d52('0x28')](function(_0x46274a){if(_0x46274a){if(!_0x439f50[_0x3d52('0x4b')][_0x3d52('0x53')]||!utils[_0x3d52('0x5d')](_0x439f50[_0x3d52('0x4b')]['channel'])){throw new db[(_0x3d52('0x54'))][(_0x3d52('0x55'))](_0x3d52('0x5e'));}return _0x46274a[_0x3d52('0x5f')+_[_0x3d52('0x56')](_0x439f50['body'][_0x3d52('0x53')][_0x3d52('0x59')]())+_0x3d52('0x5a')](_0x439f50[_0x3d52('0x4b')][_0x3d52('0x60')]);}return null;})[_0x3d52('0x28')](handleEntityNotFound(_0x118b68,null))['then'](respondWithStatusCode(_0x118b68,null))[_0x3d52('0x45')](handleError(_0x118b68,null));};exports[_0x3d52('0x61')]=function(_0x51f87b,_0x45dc5f,_0x5ae68e){return db[_0x3d52('0x43')][_0x3d52('0x5c')]({'where':{'id':_0x51f87b[_0x3d52('0x47')]['id']}})['then'](function(_0x423e34){if(_0x423e34){if(!_0x51f87b['query'][_0x3d52('0x53')]||!utils['isValidChannel'](_0x51f87b[_0x3d52('0x34')][_0x3d52('0x53')])){throw new db['Sequelize'][(_0x3d52('0x55'))](_0x3d52('0x5e'));}return _0x423e34['remove'+_['capitalize'](_0x51f87b[_0x3d52('0x34')][_0x3d52('0x53')][_0x3d52('0x59')]())+_0x3d52('0x5a')](_0x51f87b[_0x3d52('0x34')]['ids']);}return null;})[_0x3d52('0x28')](handleEntityNotFound(_0x45dc5f,null))[_0x3d52('0x28')](respondWithStatusCode(_0x45dc5f,null))['catch'](handleError(_0x45dc5f,null));};exports[_0x3d52('0x62')]=function(_0x260fe3,_0x4c03d5){return db[_0x3d52('0x43')][_0x3d52('0x49')]({'where':{'id':_0x260fe3['params']['id']}})[_0x3d52('0x28')](handleEntityNotFound(_0x4c03d5,null))['then'](function(_0x518923){if(_0x518923){var _0x43b015=[_0x3d52('0x63'),'Chat',_0x3d52('0x64'),'Sms','Fax',_0x3d52('0x65'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x48a18b){var _0x2e5f67=_[_0x3d52('0x2f')](_0x43b015,function(_0x26c99d){var _0x3e46f9={'attributes':['id',_0x3d52('0x2d')]};if(_0x26c99d===_0x3d52('0x63')){_0x3e46f9[_0x3d52('0x66')]={'attributes':[_0x3d52('0x67')]};}return _0x518923[_0x3d52('0x2a')+_0x26c99d+_0x3d52('0x5a')](_0x3e46f9)['then'](function(_0x27ce20){var _0x4d74ef=_[_0x3d52('0x2f')](_0x27ce20,function(_0x418574){var _0xe4ee95=_[_0x3d52('0x2f')](_0x260fe3['body'][_0x3d52('0x60')],function(_0x2c6c44){var _0x4f0426={'where':{'UserId':_0x2c6c44,[_0x26c99d+_0x3d52('0x68')]:_0x418574['id']},'transaction':_0x48a18b};if(_0x26c99d==='Voice'){_0x4f0426['defaults']={'penalty':_0x418574[_0x3d52('0x69')][_0x3d52('0x67')]};}return db['User'+_0x26c99d+_0x3d52('0x57')][_0x3d52('0x6a')](_0x4f0426)[_0x3d52('0x28')](function(){socket['emit'](_0x3d52('0x4c')+_0x26c99d+_0x3d52('0x6b'),{'UserId':_0x2c6c44,[_0x26c99d+_0x3d52('0x68')]:_0x418574['id']});if(_0x26c99d!=='Voice')return;return db['User']['findAll']({'where':{'id':_0x260fe3['body'][_0x3d52('0x60')],'online':0x1},'attributes':['id',_0x3d52('0x2d'),_0x3d52('0x6c'),'voicePause',_0x3d52('0x6d')],'raw':!![]})['then'](function(_0xea608b){var _0x5ebd8c=_[_0x3d52('0x2f')](_0xea608b,function(_0x5b6c4d){return db[_0x3d52('0x6e')][_0x3d52('0x6f')]({'membername':_0x5b6c4d[_0x3d52('0x2d')],'UserId':_0x5b6c4d['id'],'queue_name':_0x418574[_0x3d52('0x2d')],'VoiceQueueId':_0x418574['id'],'interface':_[_0x3d52('0x70')](_0x5b6c4d[_0x3d52('0x6d')])?util[_0x3d52('0x71')]('SIP/%s',_0x5b6c4d[_0x3d52('0x2d')]):_0x5b6c4d[_0x3d52('0x6d')],'paused':_0x5b6c4d[_0x3d52('0x72')]||![],'penalty':_0x418574['TeamVoiceQueue'][_0x3d52('0x67')]},{'transaction':_0x48a18b});});return Promise[_0x3d52('0x73')](_0x5ebd8c);});});});return Promise[_0x3d52('0x73')](_0xe4ee95);});return Promise[_0x3d52('0x73')](_0x4d74ef);});});return Promise[_0x3d52('0x73')](_0x2e5f67)[_0x3d52('0x28')](function(){return _0x518923[_0x3d52('0x62')](_0x260fe3[_0x3d52('0x4b')]['ids'],{'transaction':_0x48a18b})[_0x3d52('0x74')](function(_0x5d65a1){return _0x5d65a1;});});});}})[_0x3d52('0x28')](respondWithResult(_0x4c03d5,null))[_0x3d52('0x45')](handleError(_0x4c03d5,null));};exports[_0x3d52('0x75')]=function(_0x4c2606,_0x58d1db){return db[_0x3d52('0x43')]['find']({'where':{'id':_0x4c2606[_0x3d52('0x47')]['id']}})[_0x3d52('0x28')](handleEntityNotFound(_0x58d1db,null))[_0x3d52('0x28')](function(_0x492045){if(_0x492045){var _0x18d3f9=[_0x3d52('0x63'),_0x3d52('0x76'),_0x3d52('0x64'),_0x3d52('0x77'),_0x3d52('0x78'),'Openchannel',_0x3d52('0x79')];return db[_0x3d52('0x7a')][_0x3d52('0x7b')](function(_0x4fc2f8){var _0x1b1269=_['map'](_0x18d3f9,function(_0x300fab){var _0x28259a={'attributes':['id',_0x3d52('0x2d')]};return _0x492045['get'+_0x300fab+_0x3d52('0x5a')](_0x28259a)['then'](function(_0x297720){var _0x365997=_['map'](_0x297720,function(_0xab4963){return _0xab4963[_0x3d52('0x75')](_0x4c2606[_0x3d52('0x34')][_0x3d52('0x60')],{'transaction':_0x4fc2f8})[_0x3d52('0x28')](function(){var _0x4f811c=JSON['parse']('['+_0x4c2606[_0x3d52('0x34')][_0x3d52('0x60')]+']');var _0x19263b=_['map'](_0x4f811c,function(_0x41c843){socket['emit']('user'+_0x300fab+'Queue:remove',{'UserId':Number(_0x41c843),[_0x300fab+_0x3d52('0x68')]:_0xab4963['id']});if(_0x300fab!==_0x3d52('0x63'))return;return db[_0x3d52('0x6e')]['destroy']({'where':{'VoiceQueueId':_0xab4963['id'],'UserId':_0x41c843},'transaction':_0x4fc2f8});});return Promise[_0x3d52('0x73')](_0x19263b);});});return Promise[_0x3d52('0x73')](_0x365997);});});return Promise['all'](_0x1b1269)['then'](function(){return _0x492045[_0x3d52('0x75')](_0x4c2606[_0x3d52('0x34')][_0x3d52('0x60')],{'transaction':_0x4fc2f8});});});}})[_0x3d52('0x28')](respondWithStatusCode(_0x58d1db,null))[_0x3d52('0x45')](handleError(_0x58d1db,null));};exports[_0x3d52('0x7c')]=function(_0x3223f7,_0x34f996,_0x3c51de){var _0x1ac089={};var _0x3f14ac={};var _0x5d37d1;var _0x2b3e01;return db[_0x3d52('0x43')][_0x3d52('0x5c')]({'where':{'id':_0x3223f7[_0x3d52('0x47')]['id']}})['then'](handleEntityNotFound(_0x34f996,null))[_0x3d52('0x28')](function(_0x3c8685){if(_0x3c8685){_0x5d37d1=_0x3c8685;_0x3f14ac[_0x3d52('0x33')]=_[_0x3d52('0x35')](db[_0x3d52('0x7d')]['rawAttributes']);_0x3f14ac[_0x3d52('0x34')]=_['keys'](_0x3223f7['query']);_0x3f14ac[_0x3d52('0x36')]=_[_0x3d52('0x38')](_0x3f14ac[_0x3d52('0x33')],_0x3f14ac[_0x3d52('0x34')]);_0x1ac089[_0x3d52('0x37')]=_[_0x3d52('0x38')](_0x3f14ac[_0x3d52('0x33')],qs[_0x3d52('0x39')](_0x3223f7[_0x3d52('0x34')]['fields']));_0x1ac089[_0x3d52('0x37')]=_0x1ac089['attributes']['length']?_0x1ac089[_0x3d52('0x37')]:_0x3f14ac[_0x3d52('0x33')];_0x1ac089[_0x3d52('0x58')]=qs['sort'](_0x3223f7[_0x3d52('0x34')][_0x3d52('0x3d')]);_0x1ac089[_0x3d52('0x3e')]=qs[_0x3d52('0x36')](_[_0x3d52('0x3f')](_0x3223f7['query'],_0x3f14ac['filters']));if(_0x3223f7['query'][_0x3d52('0x7e')]){_0x1ac089['where']=_['merge'](_0x1ac089['where'],{'$or':_[_0x3d52('0x2f')](_0x1ac089[_0x3d52('0x37')],function(_0x3b95eb){var _0x46583a={};_0x46583a[_0x3b95eb]={'$like':'%'+_0x3223f7[_0x3d52('0x34')][_0x3d52('0x7e')]+'%'};return _0x46583a;})});}_0x1ac089=_[_0x3d52('0x41')]({},_0x1ac089,_0x3223f7[_0x3d52('0x42')]);return _0x5d37d1[_0x3d52('0x7c')](_0x1ac089);}})[_0x3d52('0x28')](function(_0x154ef1){if(_0x154ef1){_0x2b3e01=_0x154ef1[_0x3d52('0x3a')];if(!_0x3223f7['query']['hasOwnProperty'](_0x3d52('0x7f'))){_0x1ac089['limit']=qs[_0x3d52('0x3c')](_0x3223f7[_0x3d52('0x34')]['limit']);_0x1ac089['offset']=qs[_0x3d52('0x22')](_0x3223f7[_0x3d52('0x34')][_0x3d52('0x22')]);}return _0x5d37d1[_0x3d52('0x7c')](_0x1ac089);}})[_0x3d52('0x28')](function(_0x58e52a){if(_0x58e52a){return _0x58e52a?{'count':_0x2b3e01,'rows':_0x58e52a}:null;}})[_0x3d52('0x28')](respondWithResult(_0x34f996,null))['catch'](handleError(_0x34f996,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 61df4da..b906564 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 _0x0fa6=['setMaxListeners','save','update','remove','hook','exports','events','../../mysqldb'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x0fa6,0x1a6));var _0x60fa=function(_0x2dcc5a,_0x2da0f9){_0x2dcc5a=_0x2dcc5a-0x0;var _0x40169e=_0x0fa6[_0x2dcc5a];return _0x40169e;};'use strict';var EventEmitter=require(_0x60fa('0x0'));var Team=require(_0x60fa('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x60fa('0x2')](0x0);var events={'afterCreate':_0x60fa('0x3'),'afterUpdate':_0x60fa('0x4'),'afterDestroy':_0x60fa('0x5')};function emitEvent(_0x463e40){return function(_0x3fa9c9,_0x5ac710,_0x1f9011){TeamEvents['emit'](_0x463e40+':'+_0x3fa9c9['id'],_0x3fa9c9);TeamEvents['emit'](_0x463e40,_0x3fa9c9);_0x1f9011(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x60fa('0x6')](e,emitEvent(event));}}module[_0x60fa('0x7')]=TeamEvents; \ No newline at end of file +var _0xa925=['../../mysqldb','Team','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2c5609,_0x3b5713){var _0x2e6329=function(_0x1c8af6){while(--_0x1c8af6){_0x2c5609['push'](_0x2c5609['shift']());}};_0x2e6329(++_0x3b5713);}(_0xa925,0x70));var _0x5a92=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa925[_0x298ed3];return _0x5aad28;};'use strict';var EventEmitter=require('events');var Team=require(_0x5a92('0x0'))['db'][_0x5a92('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5a92('0x2'),'afterUpdate':'update','afterDestroy':_0x5a92('0x3')};function emitEvent(_0x2b13e1){return function(_0x4582bf,_0x44b372,_0x2f1c31){TeamEvents[_0x5a92('0x4')](_0x2b13e1+':'+_0x4582bf['id'],_0x4582bf);TeamEvents[_0x5a92('0x4')](_0x2b13e1,_0x4582bf);_0x2f1c31(null);};}for(var e in events){if(events[_0x5a92('0x5')](e)){var event=events[e];Team[_0x5a92('0x6')](e,emitEvent(event));}}module[_0x5a92('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4f8dfa6..fb03a70 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 _0x5b63=['../../config/environment','./team.attributes','define','Team','teams','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47c1e9,_0x5026c9){var _0x2227c0=function(_0x2053a2){while(--_0x2053a2){_0x47c1e9['push'](_0x47c1e9['shift']());}};_0x2227c0(++_0x5026c9);}(_0x5b63,0x191));var _0x35b6=function(_0x3a9c78,_0x1184ca){_0x3a9c78=_0x3a9c78-0x0;var _0x5d6dd9=_0x5b63[_0x3a9c78];return _0x5d6dd9;};'use strict';var _=require(_0x35b6('0x0'));var util=require('util');var logger=require(_0x35b6('0x1'))(_0x35b6('0x2'));var moment=require(_0x35b6('0x3'));var BPromise=require(_0x35b6('0x4'));var rp=require(_0x35b6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x35b6('0x6'));var attributes=require(_0x35b6('0x7'));module['exports']=function(_0x380397,_0x38ae67){return _0x380397[_0x35b6('0x8')](_0x35b6('0x9'),attributes,{'tableName':_0x35b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5826=['./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5826,0x171));var _0x6582=function(_0x1d2e37,_0x1102ac){_0x1d2e37=_0x1d2e37-0x0;var _0x555730=_0x5826[_0x1d2e37];return _0x555730;};'use strict';var _=require(_0x6582('0x0'));var util=require(_0x6582('0x1'));var logger=require(_0x6582('0x2'))(_0x6582('0x3'));var moment=require(_0x6582('0x4'));var BPromise=require(_0x6582('0x5'));var rp=require(_0x6582('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6582('0x7'));var config=require(_0x6582('0x8'));var attributes=require(_0x6582('0x9'));module[_0x6582('0xa')]=function(_0x100dff,_0x1812a3){return _0x100dff[_0x6582('0xb')](_0x6582('0xc'),attributes,{'tableName':_0x6582('0xd'),'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 d8b7692..9da2966 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 _0x8fe0=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','request','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x8fe0,0x123));var _0x08fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fe0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08fe('0x0'));var BPromise=require('bluebird');var rs=require(_0x08fe('0x1'));var fs=require('fs');var Redis=require(_0x08fe('0x2'));var db=require(_0x08fe('0x3'))['db'];var utils=require(_0x08fe('0x4'));var logger=require(_0x08fe('0x5'))(_0x08fe('0x6'));var config=require(_0x08fe('0x7'));var jayson=require(_0x08fe('0x8'));var client=jayson[_0x08fe('0x9')][_0x08fe('0xa')]({'port':0x232a});config[_0x08fe('0xb')]=_[_0x08fe('0xc')](config[_0x08fe('0xb')],{'host':_0x08fe('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08fe('0xb')]));require(_0x08fe('0xe'))['register'](socket);function respondWithRpcPromise(_0x15a883,_0x348f78,_0x4d5671){return new BPromise(function(_0x21944d,_0x476a6d){return client[_0x08fe('0xf')](_0x15a883,_0x4d5671)['then'](function(_0x33cfdd){logger[_0x08fe('0x10')]('Team,\x20%s,\x20%s',_0x348f78,_0x08fe('0x11'));logger[_0x08fe('0x12')](_0x08fe('0x13'),_0x348f78,_0x08fe('0x11'),JSON[_0x08fe('0x14')](_0x33cfdd));if(_0x33cfdd['error']){if(_0x33cfdd[_0x08fe('0x15')][_0x08fe('0x16')]===0x1f4){logger[_0x08fe('0x15')](_0x08fe('0x17'),_0x348f78,_0x33cfdd[_0x08fe('0x15')]['message']);return _0x476a6d(_0x33cfdd[_0x08fe('0x15')]['message']);}logger[_0x08fe('0x15')]('Team,\x20%s,\x20%s',_0x348f78,_0x33cfdd[_0x08fe('0x15')][_0x08fe('0x18')]);return _0x21944d(_0x33cfdd[_0x08fe('0x15')]['message']);}else{logger[_0x08fe('0x10')](_0x08fe('0x17'),_0x348f78,_0x08fe('0x11'));_0x21944d(_0x33cfdd[_0x08fe('0x19')][_0x08fe('0x18')]);}})[_0x08fe('0x1a')](function(_0x24892a){logger[_0x08fe('0x15')](_0x08fe('0x17'),_0x348f78,_0x24892a);_0x476a6d(_0x24892a);});});} \ No newline at end of file +var _0x6634=['../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x13663d,_0x4f1bd6){var _0x43ec0f=function(_0x20d3f0){while(--_0x20d3f0){_0x13663d['push'](_0x13663d['shift']());}};_0x43ec0f(++_0x4f1bd6);}(_0x6634,0xbb));var _0x4663=function(_0x208c54,_0x120a70){_0x208c54=_0x208c54-0x0;var _0x4b0116=_0x6634[_0x208c54];return _0x4b0116;};'use strict';var _=require(_0x4663('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4663('0x1'));var rs=require(_0x4663('0x2'));var fs=require('fs');var Redis=require(_0x4663('0x3'));var db=require(_0x4663('0x4'))['db'];var utils=require(_0x4663('0x5'));var logger=require('../../config/logger')(_0x4663('0x6'));var config=require(_0x4663('0x7'));var jayson=require(_0x4663('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x4663('0x9')]=_[_0x4663('0xa')](config[_0x4663('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4663('0x9')]));require(_0x4663('0xb'))[_0x4663('0xc')](socket);function respondWithRpcPromise(_0x10eeff,_0xcbe6b2,_0x4a2e9b){return new BPromise(function(_0x113be0,_0x1c338e){return client[_0x4663('0xd')](_0x10eeff,_0x4a2e9b)['then'](function(_0x194148){logger[_0x4663('0xe')](_0x4663('0xf'),_0xcbe6b2,_0x4663('0x10'));logger[_0x4663('0x11')](_0x4663('0x12'),_0xcbe6b2,'request\x20sent',JSON[_0x4663('0x13')](_0x194148));if(_0x194148['error']){if(_0x194148[_0x4663('0x14')][_0x4663('0x15')]===0x1f4){logger[_0x4663('0x14')]('Team,\x20%s,\x20%s',_0xcbe6b2,_0x194148[_0x4663('0x14')][_0x4663('0x16')]);return _0x1c338e(_0x194148[_0x4663('0x14')][_0x4663('0x16')]);}logger[_0x4663('0x14')]('Team,\x20%s,\x20%s',_0xcbe6b2,_0x194148[_0x4663('0x14')][_0x4663('0x16')]);return _0x113be0(_0x194148[_0x4663('0x14')]['message']);}else{logger[_0x4663('0xe')](_0x4663('0xf'),_0xcbe6b2,_0x4663('0x10'));_0x113be0(_0x194148[_0x4663('0x17')][_0x4663('0x16')]);}})['catch'](function(_0x2098d7){logger['error'](_0x4663('0xf'),_0xcbe6b2,_0x2098d7);_0x1c338e(_0x2098d7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 637723c..99f4c1c 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 _0x41fe=['length','team:','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x41fe,0xd1));var _0xe41f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x41fe[_0x2c91e9];return _0x13f0ff;};'use strict';var TeamEvents=require(_0xe41f('0x0'));var events=[_0xe41f('0x1'),_0xe41f('0x2'),_0xe41f('0x3')];function createListener(_0x850827,_0x26d278){return function(_0x3afc14){_0x26d278[_0xe41f('0x4')](_0x850827,_0x3afc14);};}function removeListener(_0x2e580b,_0x1c9625){return function(){TeamEvents[_0xe41f('0x5')](_0x2e580b,_0x1c9625);};}exports[_0xe41f('0x6')]=function(_0xd3c763){for(var _0x370385=0x0,_0x32a410=events[_0xe41f('0x7')];_0x370385<_0x32a410;_0x370385++){var _0x23fdc9=events[_0x370385];var _0x519361=createListener(_0xe41f('0x8')+_0x23fdc9,_0xd3c763);TeamEvents['on'](_0x23fdc9,_0x519361);}}; \ No newline at end of file +var _0x6931=['length','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0x6931,0x1a9));var _0x1693=function(_0x23a7d3,_0x1b09e3){_0x23a7d3=_0x23a7d3-0x0;var _0x2662b1=_0x6931[_0x23a7d3];return _0x2662b1;};'use strict';var TeamEvents=require(_0x1693('0x0'));var events=[_0x1693('0x1'),_0x1693('0x2'),_0x1693('0x3')];function createListener(_0x369854,_0x2d8e81){return function(_0xf5a05b){_0x2d8e81[_0x1693('0x4')](_0x369854,_0xf5a05b);};}function removeListener(_0x59d148,_0x19ff1c){return function(){TeamEvents[_0x1693('0x5')](_0x59d148,_0x19ff1c);};}exports[_0x1693('0x6')]=function(_0x455646){for(var _0x379d6c=0x0,_0x5de567=events[_0x1693('0x7')];_0x379d6c<_0x5de567;_0x379d6c++){var _0x2ec499=events[_0x379d6c];var _0x18e32e=createListener('team:'+_0x2ec499,_0x455646);TeamEvents['on'](_0x2ec499,_0x18e32e);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 12b7f8b..5b29dbd 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 _0xb90f=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x188e18,_0xd3ff47){var _0x54f848=function(_0x44e4c1){while(--_0x44e4c1){_0x188e18['push'](_0x188e18['shift']());}};_0x54f848(++_0xd3ff47);}(_0xb90f,0x19d));var _0xfb90=function(_0x5d19cc,_0x5fe822){_0x5d19cc=_0x5d19cc-0x0;var _0x5f4249=_0xb90f[_0x5d19cc];return _0x5f4249;};'use strict';var multer=require(_0xfb90('0x0'));var util=require(_0xfb90('0x1'));var path=require(_0xfb90('0x2'));var timeout=require(_0xfb90('0x3'));var express=require(_0xfb90('0x4'));var router=express[_0xfb90('0x5')]();var auth=require(_0xfb90('0x6'));var interaction=require(_0xfb90('0x7'));var config=require(_0xfb90('0x8'));module[_0xfb90('0x9')]=router; \ No newline at end of file +var _0x573b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x573b,0x1e2));var _0xb573=function(_0x21fbde,_0x593b01){_0x21fbde=_0x21fbde-0x0;var _0x2803cd=_0x573b[_0x21fbde];return _0x2803cd;};'use strict';var multer=require(_0xb573('0x0'));var util=require(_0xb573('0x1'));var path=require(_0xb573('0x2'));var timeout=require(_0xb573('0x3'));var express=require(_0xb573('0x4'));var router=express[_0xb573('0x5')]();var auth=require(_0xb573('0x6'));var interaction=require(_0xb573('0x7'));var config=require(_0xb573('0x8'));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 606cf1d..fdc651c 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1b98f7,_0x5348ac){var _0x538854=function(_0x5848df){while(--_0x5848df){_0x1b98f7['push'](_0x1b98f7['shift']());}};_0x538854(++_0x5348ac);}(_0xe706,0xa3));var _0x6e70=function(_0x5abe5a,_0x5747c0){_0x5abe5a=_0x5abe5a-0x0;var _0x5abba2=_0xe706[_0x5abe5a];return _0x5abba2;};'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(_0x54b648,_0x5648f0){var _0x4f7c5b=function(_0x22537d){while(--_0x22537d){_0x54b648['push'](_0x54b648['shift']());}};_0x4f7c5b(++_0x5648f0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index f7002a7..2394b79 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 _0x539b=['lodash','api','moment','bluebird','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x539b,0x19a));var _0xb539=function(_0x26b60e,_0x1d60fa){_0x26b60e=_0x26b60e-0x0;var _0x41d7d5=_0x539b[_0x26b60e];return _0x41d7d5;};'use strict';var _=require(_0xb539('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb539('0x1'));var moment=require(_0xb539('0x2'));var BPromise=require(_0xb539('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb539('0x4'));var config=require('../../config/environment');var attributes=require(_0xb539('0x5'));module[_0xb539('0x6')]=function(_0x474eee,_0x57d4e8){return _0x474eee[_0xb539('0x7')](_0xb539('0x8'),attributes,{'tableName':_0xb539('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f6c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','team_has_voice_queues','util','../../config/logger','api'];(function(_0x34e285,_0x460be3){var _0x407612=function(_0xc692a2){while(--_0xc692a2){_0x34e285['push'](_0x34e285['shift']());}};_0x407612(++_0x460be3);}(_0x0f6c,0xbd));var _0xc0f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0f6c[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xc0f6('0x0'));var logger=require(_0xc0f6('0x1'))(_0xc0f6('0x2'));var moment=require(_0xc0f6('0x3'));var BPromise=require(_0xc0f6('0x4'));var rp=require(_0xc0f6('0x5'));var fs=require('fs');var path=require(_0xc0f6('0x6'));var rimraf=require(_0xc0f6('0x7'));var config=require(_0xc0f6('0x8'));var attributes=require(_0xc0f6('0x9'));module[_0xc0f6('0xa')]=function(_0x2f9a40,_0x4aa64b){return _0x2f9a40['define']('TeamVoiceQueue',attributes,{'tableName':_0xc0f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 4ce13c0..1ea1037 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 _0x6a0d=['client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x490eba,_0x518ea9){var _0x37ac7b=function(_0xb0e9ab){while(--_0xb0e9ab){_0x490eba['push'](_0x490eba['shift']());}};_0x37ac7b(++_0x518ea9);}(_0x6a0d,0x6d));var _0xd6a0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6a0d[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xd6a0('0x0'));var moment=require(_0xd6a0('0x1'));var BPromise=require(_0xd6a0('0x2'));var rs=require(_0xd6a0('0x3'));var fs=require('fs');var Redis=require(_0xd6a0('0x4'));var db=require(_0xd6a0('0x5'))['db'];var utils=require(_0xd6a0('0x6'));var logger=require(_0xd6a0('0x7'))(_0xd6a0('0x8'));var config=require(_0xd6a0('0x9'));var jayson=require(_0xd6a0('0xa'));var client=jayson[_0xd6a0('0xb')][_0xd6a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x83a9c9,_0x1b0c77,_0x98235){return new BPromise(function(_0x3f5908,_0xaea262){return client[_0xd6a0('0xd')](_0x83a9c9,_0x98235)[_0xd6a0('0xe')](function(_0xf73572){logger['info'](_0xd6a0('0xf'),_0x1b0c77,'request\x20sent');logger[_0xd6a0('0x10')](_0xd6a0('0x11'),_0x1b0c77,'request\x20sent',JSON[_0xd6a0('0x12')](_0xf73572));if(_0xf73572[_0xd6a0('0x13')]){if(_0xf73572[_0xd6a0('0x13')][_0xd6a0('0x14')]===0x1f4){logger[_0xd6a0('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1b0c77,_0xf73572[_0xd6a0('0x13')]['message']);return _0xaea262(_0xf73572['error'][_0xd6a0('0x15')]);}logger[_0xd6a0('0x13')](_0xd6a0('0xf'),_0x1b0c77,_0xf73572['error'][_0xd6a0('0x15')]);return _0x3f5908(_0xf73572[_0xd6a0('0x13')]['message']);}else{logger[_0xd6a0('0x16')](_0xd6a0('0xf'),_0x1b0c77,_0xd6a0('0x17'));_0x3f5908(_0xf73572['result'][_0xd6a0('0x15')]);}})['catch'](function(_0x49022a){logger[_0xd6a0('0x13')](_0xd6a0('0xf'),_0x1b0c77,_0x49022a);_0xaea262(_0x49022a);});});} \ No newline at end of file +var _0xfa94=['../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0xfa94,0x124));var _0x4fa9=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xfa94[_0x17a32f];return _0x15a293;};'use strict';var _=require(_0x4fa9('0x0'));var util=require(_0x4fa9('0x1'));var moment=require(_0x4fa9('0x2'));var BPromise=require(_0x4fa9('0x3'));var rs=require(_0x4fa9('0x4'));var fs=require('fs');var Redis=require(_0x4fa9('0x5'));var db=require(_0x4fa9('0x6'))['db'];var utils=require(_0x4fa9('0x7'));var logger=require(_0x4fa9('0x8'))(_0x4fa9('0x9'));var config=require(_0x4fa9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4fa9('0xb')][_0x4fa9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18aeb2,_0x499565,_0x12dcef){return new BPromise(function(_0x3dd3a9,_0x2cdfef){return client['request'](_0x18aeb2,_0x12dcef)[_0x4fa9('0xd')](function(_0x26ea7b){logger[_0x4fa9('0xe')](_0x4fa9('0xf'),_0x499565,_0x4fa9('0x10'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x499565,_0x4fa9('0x10'),JSON[_0x4fa9('0x11')](_0x26ea7b));if(_0x26ea7b[_0x4fa9('0x12')]){if(_0x26ea7b[_0x4fa9('0x12')]['code']===0x1f4){logger[_0x4fa9('0x12')](_0x4fa9('0xf'),_0x499565,_0x26ea7b[_0x4fa9('0x12')][_0x4fa9('0x13')]);return _0x2cdfef(_0x26ea7b['error']['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x499565,_0x26ea7b[_0x4fa9('0x12')][_0x4fa9('0x13')]);return _0x3dd3a9(_0x26ea7b['error']['message']);}else{logger[_0x4fa9('0xe')](_0x4fa9('0xf'),_0x499565,_0x4fa9('0x10'));_0x3dd3a9(_0x26ea7b['result'][_0x4fa9('0x13')]);}})['catch'](function(_0x40ed61){logger[_0x4fa9('0x12')](_0x4fa9('0xf'),_0x499565,_0x40ed61);_0x2cdfef(_0x40ed61);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c2a1f6c..eafdb6a 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 _0xd92f=['path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x4ccd7d,_0x4d6fe4){var _0x54011a=function(_0x1d400a){while(--_0x1d400a){_0x4ccd7d['push'](_0x4ccd7d['shift']());}};_0x54011a(++_0x4d6fe4);}(_0xd92f,0x10f));var _0xfd92=function(_0x114e73,_0x1ccb13){_0x114e73=_0x114e73-0x0;var _0x673e28=_0xd92f[_0x114e73];return _0x673e28;};'use strict';var multer=require(_0xfd92('0x0'));var util=require('util');var path=require(_0xfd92('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd92('0x2'));var router=express[_0xfd92('0x3')]();var auth=require(_0xfd92('0x4'));var interaction=require(_0xfd92('0x5'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0xfd92('0x6')]('/',auth[_0xfd92('0x7')](),controller[_0xfd92('0x8')]);router[_0xfd92('0x6')]('/:id',auth[_0xfd92('0x7')](),controller[_0xfd92('0x9')]);router[_0xfd92('0xa')]('/',auth[_0xfd92('0x7')](),controller[_0xfd92('0xb')]);router[_0xfd92('0xc')](_0xfd92('0xd'),auth[_0xfd92('0x7')](),controller[_0xfd92('0xe')]);router[_0xfd92('0xf')]('/:id',auth[_0xfd92('0x7')](),controller['destroy']);module[_0xfd92('0x10')]=router; \ No newline at end of file +var _0xffd7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x55cf52,_0x2cf5c8){var _0x3a56de=function(_0x8ee79d){while(--_0x8ee79d){_0x55cf52['push'](_0x55cf52['shift']());}};_0x3a56de(++_0x2cf5c8);}(_0xffd7,0x73));var _0x7ffd=function(_0x536340,_0x19a348){_0x536340=_0x536340-0x0;var _0x28ef32=_0xffd7[_0x536340];return _0x28ef32;};'use strict';var multer=require(_0x7ffd('0x0'));var util=require(_0x7ffd('0x1'));var path=require(_0x7ffd('0x2'));var timeout=require(_0x7ffd('0x3'));var express=require(_0x7ffd('0x4'));var router=express['Router']();var auth=require(_0x7ffd('0x5'));var interaction=require(_0x7ffd('0x6'));var config=require(_0x7ffd('0x7'));var controller=require(_0x7ffd('0x8'));router[_0x7ffd('0x9')]('/',auth[_0x7ffd('0xa')](),controller['index']);router['get'](_0x7ffd('0xb'),auth[_0x7ffd('0xa')](),controller[_0x7ffd('0xc')]);router[_0x7ffd('0xd')]('/',auth[_0x7ffd('0xa')](),controller[_0x7ffd('0xe')]);router[_0x7ffd('0xf')](_0x7ffd('0xb'),auth[_0x7ffd('0xa')](),controller[_0x7ffd('0x10')]);router[_0x7ffd('0x11')](_0x7ffd('0xb'),auth[_0x7ffd('0xa')](),controller[_0x7ffd('0x12')]);module[_0x7ffd('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 406bd1a..d8a5a61 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 _0x43af=['exports','STRING'];(function(_0x43a954,_0x1d73d7){var _0x1973f6=function(_0x3de96c){while(--_0x3de96c){_0x43a954['push'](_0x43a954['shift']());}};_0x1973f6(++_0x1d73d7);}(_0x43af,0x162));var _0xf43a=function(_0x1f148f,_0x217c7d){_0x1f148f=_0x1f148f-0x0;var _0x97f306=_0x43af[_0x1f148f];return _0x97f306;};'use strict';var Sequelize=require('sequelize');module[_0xf43a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf43a('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x88cc=['TEXT','sequelize','exports','STRING'];(function(_0x3d4b7a,_0x5c8003){var _0x217338=function(_0x1d8c45){while(--_0x1d8c45){_0x3d4b7a['push'](_0x3d4b7a['shift']());}};_0x217338(++_0x5c8003);}(_0x88cc,0xc1));var _0xc88c=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x88cc[_0x3c504b];return _0x2e5354;};'use strict';var Sequelize=require(_0xc88c('0x0'));module[_0xc88c('0x1')]={'name':{'type':Sequelize[_0xc88c('0x2')]},'description':{'type':Sequelize[_0xc88c('0x2')]},'html':{'type':Sequelize[_0xc88c('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 428b76f..55e4349 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 _0x7a54=['fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','type','key','model','map','keys','query','intersection'];(function(_0xa9386b,_0x22b29c){var _0x4e0231=function(_0x12840e){while(--_0x12840e){_0xa9386b['push'](_0xa9386b['shift']());}};_0x4e0231(++_0x22b29c);}(_0x7a54,0x106));var _0x47a5=function(_0x5cec8a,_0x230590){_0x5cec8a=_0x5cec8a-0x0;var _0x4cbbe9=_0x7a54[_0x5cec8a];return _0x4cbbe9;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='Templates';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filters']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));}; \ No newline at end of file +var _0x814b=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','Template','includeAll','include','rows','catch','keys','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query'];(function(_0x7ff54b,_0x5533f6){var _0x126081=function(_0x587c01){while(--_0x587c01){_0x7ff54b['push'](_0x7ff54b['shift']());}};_0x126081(++_0x5533f6);}(_0x814b,0x1a2));var _0xb814=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0x814b[_0x44606e];return _0xe68388;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){var _0x594470=_0x27352e[_0xb814('0x26')]({'plain':!![]});var _0x52b7a3=_0xb814('0x27');return db[_0xb814('0x28')][_0xb814('0x25')]({'where':{'type':_0x52b7a3,'resourceId':_0x594470['id']}})[_0xb814('0x24')](function(){return _0x27352e;});})[_0xb814('0x24')](function(){_0x3b267e[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x5755ea,_0x392222){return function(_0xc0ef66){if(!_0xc0ef66){_0x5755ea[_0xb814('0x1b')](0x194);}return _0xc0ef66;};}function handleError(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0x1f4;return function(_0x1d5965){logger[_0xb814('0x29')](_0x1d5965[_0xb814('0x2a')]);if(_0x1d5965['name']){delete _0x1d5965[_0xb814('0x2b')];}_0x349394[_0xb814('0x1c')](_0x32ed56)['send'](_0x1d5965);};}exports[_0xb814('0x2c')]=function(_0x37d24d,_0x530744){var _0x499f22={},_0x20577b={},_0x2051d0={'count':0x0,'rows':[]};var _0x58c3ca=_[_0xb814('0x2d')](db['Template'][_0xb814('0x2e')],function(_0x5f3e9b){return{'name':_0x5f3e9b['fieldName'],'type':_0x5f3e9b[_0xb814('0x2f')]['key']};});_0x20577b[_0xb814('0x30')]=_[_0xb814('0x2d')](_0x58c3ca,_0xb814('0x2b'));_0x20577b['query']=_['keys'](_0x37d24d[_0xb814('0x31')]);_0x20577b[_0xb814('0x32')]=_['intersection'](_0x20577b[_0xb814('0x30')],_0x20577b[_0xb814('0x31')]);_0x499f22[_0xb814('0x33')]=_[_0xb814('0x34')](_0x20577b[_0xb814('0x30')],qs[_0xb814('0x35')](_0x37d24d[_0xb814('0x31')]['fields']));_0x499f22[_0xb814('0x33')]=_0x499f22[_0xb814('0x33')][_0xb814('0x36')]?_0x499f22[_0xb814('0x33')]:_0x20577b[_0xb814('0x30')];if(!_0x37d24d['query'][_0xb814('0x37')]('nolimit')){_0x499f22[_0xb814('0x38')]=qs[_0xb814('0x38')](_0x37d24d[_0xb814('0x31')]['limit']);_0x499f22[_0xb814('0x20')]=qs[_0xb814('0x20')](_0x37d24d['query'][_0xb814('0x20')]);}_0x499f22[_0xb814('0x39')]=qs[_0xb814('0x3a')](_0x37d24d[_0xb814('0x31')][_0xb814('0x3a')]);_0x499f22[_0xb814('0x3b')]=qs['filters'](_[_0xb814('0x3c')](_0x37d24d['query'],_0x20577b[_0xb814('0x32')]),_0x58c3ca);if(_0x37d24d['query'][_0xb814('0x3d')]){_0x499f22['where']=_[_0xb814('0x3e')](_0x499f22[_0xb814('0x3b')],{'$or':_['map'](_0x58c3ca,function(_0x4d308a){if(_0x4d308a['type']!=='VIRTUAL'){var _0x17549e={};_0x17549e[_0x4d308a[_0xb814('0x2b')]]={'$like':'%'+_0x37d24d[_0xb814('0x31')][_0xb814('0x3d')]+'%'};return _0x17549e;}})});}_0x499f22=_['merge']({},_0x499f22,_0x37d24d['options']);var _0x6f15d3={'where':_0x499f22['where']};return db[_0xb814('0x3f')][_0xb814('0x1f')](_0x6f15d3)[_0xb814('0x24')](function(_0x3063bf){_0x2051d0[_0xb814('0x1f')]=_0x3063bf;if(_0x37d24d[_0xb814('0x31')][_0xb814('0x40')]){_0x499f22[_0xb814('0x41')]=[{'all':!![]}];}return db[_0xb814('0x3f')]['findAll'](_0x499f22);})['then'](function(_0x5d26be){_0x2051d0[_0xb814('0x42')]=_0x5d26be;return _0x2051d0;})['then'](respondWithFilteredResult(_0x530744,_0x499f22))[_0xb814('0x43')](handleError(_0x530744,null));};exports['show']=function(_0x411723,_0x44ff56){var _0x9ef639={'raw':!![],'where':{'id':_0x411723['params']['id']}},_0x2e97cc={};_0x2e97cc[_0xb814('0x30')]=_[_0xb814('0x44')](db[_0xb814('0x3f')][_0xb814('0x2e')]);_0x2e97cc[_0xb814('0x31')]=_[_0xb814('0x44')](_0x411723['query']);_0x2e97cc[_0xb814('0x32')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],_0x2e97cc[_0xb814('0x31')]);_0x9ef639[_0xb814('0x33')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],qs['fields'](_0x411723['query'][_0xb814('0x35')]));_0x9ef639[_0xb814('0x33')]=_0x9ef639[_0xb814('0x33')][_0xb814('0x36')]?_0x9ef639[_0xb814('0x33')]:_0x2e97cc[_0xb814('0x30')];if(_0x411723[_0xb814('0x31')][_0xb814('0x40')]){_0x9ef639[_0xb814('0x41')]=[{'all':!![]}];}_0x9ef639=_[_0xb814('0x3e')]({},_0x9ef639,_0x411723[_0xb814('0x45')]);return db['Template'][_0xb814('0x46')](_0x9ef639)[_0xb814('0x24')](handleEntityNotFound(_0x44ff56,null))['then'](respondWithResult(_0x44ff56,null))[_0xb814('0x43')](handleError(_0x44ff56,null));};exports['create']=function(_0x2fb0f7,_0x37866f){return db[_0xb814('0x3f')][_0xb814('0x47')](_0x2fb0f7[_0xb814('0x48')],{})[_0xb814('0x24')](function(_0x2cc806){var _0x45480e=_0x2fb0f7[_0xb814('0x49')][_0xb814('0x26')]({'plain':!![]});if(!_0x45480e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45480e['role']===_0xb814('0x49')){var _0x30f07b=_0x2cc806[_0xb814('0x26')]({'plain':!![]});var _0x3f8e29=_0xb814('0x27');return db[_0xb814('0x4a')][_0xb814('0x46')]({'where':{'name':_0x3f8e29,'userProfileId':_0x45480e['userProfileId']},'raw':!![]})[_0xb814('0x24')](function(_0x388324){if(_0x388324&&_0x388324[_0xb814('0x4b')]===0x0){return db['UserProfileResource'][_0xb814('0x47')]({'name':_0x30f07b['name'],'resourceId':_0x30f07b['id'],'type':_0x388324[_0xb814('0x2b')],'sectionId':_0x388324['id']},{})['then'](function(){return _0x2cc806;});}else{return _0x2cc806;}})[_0xb814('0x43')](function(_0x3cf8f8){logger['error'](_0xb814('0x4c'),_0x3cf8f8);throw _0x3cf8f8;});}return _0x2cc806;})[_0xb814('0x24')](respondWithResult(_0x37866f,0xc9))[_0xb814('0x43')](handleError(_0x37866f,null));};exports['update']=function(_0x3da050,_0x5f0e58){if(_0x3da050[_0xb814('0x48')]['id']){delete _0x3da050[_0xb814('0x48')]['id'];}return db['Template'][_0xb814('0x46')]({'where':{'id':_0x3da050['params']['id']}})['then'](handleEntityNotFound(_0x5f0e58,null))[_0xb814('0x24')](saveUpdates(_0x3da050[_0xb814('0x48')],null))[_0xb814('0x24')](respondWithResult(_0x5f0e58,null))['catch'](handleError(_0x5f0e58,null));};exports[_0xb814('0x25')]=function(_0x538b0f,_0xf88d23){return db[_0xb814('0x3f')]['find']({'where':{'id':_0x538b0f[_0xb814('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf88d23,null))[_0xb814('0x24')](removeEntity(_0xf88d23,null))[_0xb814('0x43')](handleError(_0xf88d23,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index bbf0878..4111a4d 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 _0x8cb6=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x43f3ef,_0x5d975d){var _0x1c021f=function(_0x340d30){while(--_0x340d30){_0x43f3ef['push'](_0x43f3ef['shift']());}};_0x1c021f(++_0x5d975d);}(_0x8cb6,0xcd));var _0x68cb=function(_0x567312,_0x33020e){_0x567312=_0x567312-0x0;var _0xea4df1=_0x8cb6[_0x567312];return _0xea4df1;};'use strict';var _=require(_0x68cb('0x0'));var util=require(_0x68cb('0x1'));var logger=require(_0x68cb('0x2'))(_0x68cb('0x3'));var moment=require(_0x68cb('0x4'));var BPromise=require(_0x68cb('0x5'));var rp=require(_0x68cb('0x6'));var fs=require('fs');var path=require(_0x68cb('0x7'));var rimraf=require(_0x68cb('0x8'));var config=require(_0x68cb('0x9'));var attributes=require(_0x68cb('0xa'));module[_0x68cb('0xb')]=function(_0x15dbeb,_0x3d85d6){return _0x15dbeb[_0x68cb('0xc')](_0x68cb('0xd'),attributes,{'tableName':_0x68cb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ed6=['rimraf','../../config/environment','define','lodash','util','api','moment','bluebird'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x6ed6,0x1d3));var _0x66ed=function(_0x49f2a1,_0x2623e0){_0x49f2a1=_0x49f2a1-0x0;var _0x1d0ad3=_0x6ed6[_0x49f2a1];return _0x1d0ad3;};'use strict';var _=require(_0x66ed('0x0'));var util=require(_0x66ed('0x1'));var logger=require('../../config/logger')(_0x66ed('0x2'));var moment=require(_0x66ed('0x3'));var BPromise=require(_0x66ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66ed('0x5'));var config=require(_0x66ed('0x6'));var attributes=require('./template.attributes');module['exports']=function(_0x3235cb,_0x49f5fe){return _0x3235cb[_0x66ed('0x7')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index c9da808..2df9997 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 _0x1197=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','findAll','options','where','attributes','limit','include','model','map','then','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x1197,0x7e));var _0x7119=function(_0x33162c,_0x57d614){_0x33162c=_0x33162c-0x0;var _0x908db8=_0x1197[_0x33162c];return _0x908db8;};'use strict';var _=require(_0x7119('0x0'));var util=require(_0x7119('0x1'));var moment=require(_0x7119('0x2'));var BPromise=require(_0x7119('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7119('0x4'))['db'];var utils=require(_0x7119('0x5'));var logger=require(_0x7119('0x6'))(_0x7119('0x7'));var config=require(_0x7119('0x8'));var jayson=require(_0x7119('0x9'));var client=jayson['client'][_0x7119('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0a82,_0x518390,_0x1a7e13){return new BPromise(function(_0x17a81a,_0x4085cd){return client[_0x7119('0xb')](_0x2a0a82,_0x1a7e13)['then'](function(_0x3b42fb){logger[_0x7119('0xc')](_0x7119('0xd'),_0x518390,'request\x20sent');logger['debug'](_0x7119('0xe'),_0x518390,_0x7119('0xf'),JSON[_0x7119('0x10')](_0x3b42fb));if(_0x3b42fb[_0x7119('0x11')]){if(_0x3b42fb[_0x7119('0x11')][_0x7119('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x518390,_0x3b42fb[_0x7119('0x11')]['message']);return _0x4085cd(_0x3b42fb[_0x7119('0x11')]['message']);}logger[_0x7119('0x11')]('Template,\x20%s,\x20%s',_0x518390,_0x3b42fb['error'][_0x7119('0x13')]);return _0x17a81a(_0x3b42fb['error'][_0x7119('0x13')]);}else{logger[_0x7119('0xc')](_0x7119('0xd'),_0x518390,_0x7119('0xf'));_0x17a81a(_0x3b42fb[_0x7119('0x14')]['message']);}})[_0x7119('0x15')](function(_0xc4808c){logger[_0x7119('0x11')](_0x7119('0xd'),_0x518390,_0xc4808c);_0x4085cd(_0xc4808c);});});}exports[_0x7119('0x16')]=function(_0x1ad2cf){var _0x572c45=this;return new Promise(function(_0x1f314f,_0x30ed52){return db['Template'][_0x7119('0x17')]({'raw':_0x1ad2cf[_0x7119('0x18')]?_0x1ad2cf[_0x7119('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1ad2cf[_0x7119('0x18')]?_0x1ad2cf[_0x7119('0x18')][_0x7119('0x19')]||null:null,'attributes':_0x1ad2cf[_0x7119('0x18')]?_0x1ad2cf['options'][_0x7119('0x1a')]||null:null,'limit':_0x1ad2cf['options']?_0x1ad2cf[_0x7119('0x18')][_0x7119('0x1b')]||null:null,'include':_0x1ad2cf[_0x7119('0x18')]?_0x1ad2cf[_0x7119('0x18')][_0x7119('0x1c')]?_['map'](_0x1ad2cf['options'][_0x7119('0x1c')],function(_0x3f7617){return{'model':db[_0x3f7617[_0x7119('0x1d')]],'as':_0x3f7617['as'],'attributes':_0x3f7617[_0x7119('0x1a')],'include':_0x3f7617['include']?_[_0x7119('0x1e')](_0x3f7617[_0x7119('0x1c')],function(_0x27a6cd){return{'model':db[_0x27a6cd['model']],'as':_0x27a6cd['as'],'attributes':_0x27a6cd[_0x7119('0x1a')],'include':_0x27a6cd[_0x7119('0x1c')]?_[_0x7119('0x1e')](_0x27a6cd[_0x7119('0x1c')],function(_0x22271e){return{'model':db[_0x22271e[_0x7119('0x1d')]],'as':_0x22271e['as'],'attributes':_0x22271e[_0x7119('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7119('0x1f')](function(_0x12c360){logger[_0x7119('0xc')]('GetTemplate',_0x1ad2cf);logger[_0x7119('0x20')]('GetTemplate',_0x1ad2cf,JSON['stringify'](_0x12c360));_0x1f314f(_0x12c360);})[_0x7119('0x15')](function(_0x234b2b){logger[_0x7119('0x11')](_0x7119('0x16'),_0x234b2b['message'],_0x1ad2cf);_0x30ed52(_0x572c45['error'](0x1f4,_0x234b2b[_0x7119('0x13')]));});});}; \ No newline at end of file +var _0x1ada=['options','raw','where','attributes','include','map','model','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','catch','GetTemplate','Template'];(function(_0x455b4e,_0x556818){var _0x4d0e47=function(_0x5daae1){while(--_0x5daae1){_0x455b4e['push'](_0x455b4e['shift']());}};_0x4d0e47(++_0x556818);}(_0x1ada,0x19b));var _0xa1ad=function(_0x2b3261,_0x593754){_0x2b3261=_0x2b3261-0x0;var _0x55bbea=_0x1ada[_0x2b3261];return _0x55bbea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa1ad('0x0'));var BPromise=require('bluebird');var rs=require(_0xa1ad('0x1'));var fs=require('fs');var Redis=require(_0xa1ad('0x2'));var db=require(_0xa1ad('0x3'))['db'];var utils=require(_0xa1ad('0x4'));var logger=require(_0xa1ad('0x5'))(_0xa1ad('0x6'));var config=require('../../config/environment');var jayson=require(_0xa1ad('0x7'));var client=jayson[_0xa1ad('0x8')][_0xa1ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f317e,_0x5a5882,_0x562373){return new BPromise(function(_0x580de2,_0x43e442){return client[_0xa1ad('0xa')](_0x4f317e,_0x562373)[_0xa1ad('0xb')](function(_0xdffa1a){logger[_0xa1ad('0xc')]('Template,\x20%s,\x20%s',_0x5a5882,_0xa1ad('0xd'));logger[_0xa1ad('0xe')](_0xa1ad('0xf'),_0x5a5882,_0xa1ad('0xd'),JSON['stringify'](_0xdffa1a));if(_0xdffa1a[_0xa1ad('0x10')]){if(_0xdffa1a[_0xa1ad('0x10')][_0xa1ad('0x11')]===0x1f4){logger[_0xa1ad('0x10')](_0xa1ad('0x12'),_0x5a5882,_0xdffa1a[_0xa1ad('0x10')]['message']);return _0x43e442(_0xdffa1a[_0xa1ad('0x10')][_0xa1ad('0x13')]);}logger['error'](_0xa1ad('0x12'),_0x5a5882,_0xdffa1a[_0xa1ad('0x10')]['message']);return _0x580de2(_0xdffa1a[_0xa1ad('0x10')][_0xa1ad('0x13')]);}else{logger[_0xa1ad('0xc')](_0xa1ad('0x12'),_0x5a5882,'request\x20sent');_0x580de2(_0xdffa1a['result'][_0xa1ad('0x13')]);}})[_0xa1ad('0x14')](function(_0x1383cb){logger[_0xa1ad('0x10')](_0xa1ad('0x12'),_0x5a5882,_0x1383cb);_0x43e442(_0x1383cb);});});}exports[_0xa1ad('0x15')]=function(_0x21ae37){var _0x781727=this;return new Promise(function(_0x4af16d,_0x138432){return db[_0xa1ad('0x16')]['findAll']({'raw':_0x21ae37[_0xa1ad('0x17')]?_0x21ae37[_0xa1ad('0x17')][_0xa1ad('0x18')]===undefined?!![]:![]:!![],'where':_0x21ae37[_0xa1ad('0x17')]?_0x21ae37[_0xa1ad('0x17')][_0xa1ad('0x19')]||null:null,'attributes':_0x21ae37[_0xa1ad('0x17')]?_0x21ae37[_0xa1ad('0x17')][_0xa1ad('0x1a')]||null:null,'limit':_0x21ae37['options']?_0x21ae37[_0xa1ad('0x17')]['limit']||null:null,'include':_0x21ae37[_0xa1ad('0x17')]?_0x21ae37[_0xa1ad('0x17')][_0xa1ad('0x1b')]?_[_0xa1ad('0x1c')](_0x21ae37[_0xa1ad('0x17')][_0xa1ad('0x1b')],function(_0x2c62f1){return{'model':db[_0x2c62f1[_0xa1ad('0x1d')]],'as':_0x2c62f1['as'],'attributes':_0x2c62f1[_0xa1ad('0x1a')],'include':_0x2c62f1['include']?_[_0xa1ad('0x1c')](_0x2c62f1[_0xa1ad('0x1b')],function(_0x4baf92){return{'model':db[_0x4baf92['model']],'as':_0x4baf92['as'],'attributes':_0x4baf92[_0xa1ad('0x1a')],'include':_0x4baf92[_0xa1ad('0x1b')]?_[_0xa1ad('0x1c')](_0x4baf92[_0xa1ad('0x1b')],function(_0x4d94b9){return{'model':db[_0x4d94b9[_0xa1ad('0x1d')]],'as':_0x4d94b9['as'],'attributes':_0x4d94b9[_0xa1ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1ad('0xb')](function(_0x5179df){logger['info']('GetTemplate',_0x21ae37);logger[_0xa1ad('0xe')]('GetTemplate',_0x21ae37,JSON[_0xa1ad('0x1e')](_0x5179df));_0x4af16d(_0x5179df);})['catch'](function(_0x278745){logger['error'](_0xa1ad('0x15'),_0x278745[_0xa1ad('0x13')],_0x21ae37);_0x138432(_0x781727[_0xa1ad('0x10')](0x1f4,_0x278745[_0xa1ad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index aded6d7..aca9c63 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 _0xc5c5=['../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x20f028,_0x57753a){var _0xd3da6d=function(_0x4b3c84){while(--_0x4b3c84){_0x20f028['push'](_0x20f028['shift']());}};_0xd3da6d(++_0x57753a);}(_0xc5c5,0x8a));var _0x5c5c=function(_0x4b3c07,_0x5b3eb9){_0x4b3c07=_0x4b3c07-0x0;var _0x2ee895=_0xc5c5[_0x4b3c07];return _0x2ee895;};'use strict';var multer=require(_0x5c5c('0x0'));var util=require(_0x5c5c('0x1'));var path=require(_0x5c5c('0x2'));var timeout=require(_0x5c5c('0x3'));var express=require(_0x5c5c('0x4'));var router=express['Router']();var auth=require(_0x5c5c('0x5'));var interaction=require(_0x5c5c('0x6'));var config=require('../../config/environment');var controller=require(_0x5c5c('0x7'));router[_0x5c5c('0x8')]('/',auth[_0x5c5c('0x9')](),controller[_0x5c5c('0xa')]);router['get'](_0x5c5c('0xb'),auth[_0x5c5c('0x9')](),controller[_0x5c5c('0xc')]);router[_0x5c5c('0x8')]('/:id/all_conditions',auth[_0x5c5c('0x9')](),controller['getAllConditions']);router[_0x5c5c('0x8')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x5c5c('0xd')]);router[_0x5c5c('0x8')]('/:id/actions',auth[_0x5c5c('0x9')](),controller[_0x5c5c('0xe')]);router[_0x5c5c('0xf')]('/',auth['isAuthenticated'](),controller[_0x5c5c('0x10')]);router[_0x5c5c('0xf')](_0x5c5c('0x11'),auth[_0x5c5c('0x9')](),controller[_0x5c5c('0x12')]);router['post']('/:id/any_conditions',auth[_0x5c5c('0x9')](),controller[_0x5c5c('0x13')]);router[_0x5c5c('0xf')]('/:id/actions',auth[_0x5c5c('0x9')](),controller[_0x5c5c('0x14')]);router['put']('/:id',auth[_0x5c5c('0x9')](),controller['update']);router[_0x5c5c('0x15')]('/:id',auth[_0x5c5c('0x9')](),controller[_0x5c5c('0x16')]);module[_0x5c5c('0x17')]=router; \ No newline at end of file +var _0x76c6=['/:id/all_conditions','addAllCondition','/:id/any_conditions','addAction','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','show','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x76c6,0x9f));var _0x676c=function(_0x27a8d3,_0x36b711){_0x27a8d3=_0x27a8d3-0x0;var _0x7aff99=_0x76c6[_0x27a8d3];return _0x7aff99;};'use strict';var multer=require(_0x676c('0x0'));var util=require(_0x676c('0x1'));var path=require('path');var timeout=require(_0x676c('0x2'));var express=require(_0x676c('0x3'));var router=express[_0x676c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x676c('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x676c('0x6')]('/',auth[_0x676c('0x7')](),controller[_0x676c('0x8')]);router[_0x676c('0x6')]('/:id',auth[_0x676c('0x7')](),controller[_0x676c('0x9')]);router['get']('/:id/all_conditions',auth[_0x676c('0x7')](),controller[_0x676c('0xa')]);router[_0x676c('0x6')]('/:id/any_conditions',auth[_0x676c('0x7')](),controller[_0x676c('0xb')]);router[_0x676c('0x6')](_0x676c('0xc'),auth[_0x676c('0x7')](),controller[_0x676c('0xd')]);router[_0x676c('0xe')]('/',auth[_0x676c('0x7')](),controller[_0x676c('0xf')]);router[_0x676c('0xe')](_0x676c('0x10'),auth[_0x676c('0x7')](),controller[_0x676c('0x11')]);router[_0x676c('0xe')](_0x676c('0x12'),auth[_0x676c('0x7')](),controller['addAnyCondition']);router[_0x676c('0xe')]('/:id/actions',auth[_0x676c('0x7')](),controller[_0x676c('0x13')]);router['put'](_0x676c('0x14'),auth[_0x676c('0x7')](),controller[_0x676c('0x15')]);router[_0x676c('0x16')](_0x676c('0x14'),auth[_0x676c('0x7')](),controller[_0x676c('0x17')]);module[_0x676c('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6b2e9d0..66ac5d0 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 _0xea55=['sequelize','exports','STRING','BOOLEAN'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xea55,0x100));var _0x5ea5=function(_0x1cdbd5,_0x49b01a){_0x1cdbd5=_0x1cdbd5-0x0;var _0x1299b2=_0xea55[_0x1cdbd5];return _0x1299b2;};'use strict';var Sequelize=require(_0x5ea5('0x0'));module[_0x5ea5('0x1')]={'name':{'type':Sequelize[_0x5ea5('0x2')]},'channel':{'type':Sequelize[_0x5ea5('0x2')]},'description':{'type':Sequelize[_0x5ea5('0x2')]},'status':{'type':Sequelize[_0x5ea5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d37=['sequelize','exports','STRING','BOOLEAN'];(function(_0xa03344,_0x581292){var _0x38acfd=function(_0x1b1e8c){while(--_0x1b1e8c){_0xa03344['push'](_0xa03344['shift']());}};_0x38acfd(++_0x581292);}(_0x8d37,0x178));var _0x78d3=function(_0x4a8148,_0x4aaaab){_0x4a8148=_0x4a8148-0x0;var _0x175499=_0x8d37[_0x4a8148];return _0x175499;};'use strict';var Sequelize=require(_0x78d3('0x0'));module[_0x78d3('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x78d3('0x2')]},'description':{'type':Sequelize[_0x78d3('0x2')]},'status':{'type':Sequelize[_0x78d3('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 f6e9e63..6ad2748 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 _0x3d6d=['../../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','Triggers','UserProfileResource','end','error','stack','name','send','index','Trigger','rawAttributes','fieldName','type','key','model','query','keys','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','intersection','fields','length','includeAll','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','pick','map','getAllConditions','getAnyConditions','TriggerId','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x121195,_0x2cd8b8){var _0x363aea=function(_0xa148f9){while(--_0xa148f9){_0x121195['push'](_0x121195['shift']());}};_0x363aea(++_0x2cd8b8);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x1d0458,_0x4ed6d4){_0x1d0458=_0x1d0458-0x0;var _0x2fad3c=_0x3d6d[_0x1d0458];return _0x2fad3c;};'use strict';var pdf=require(_0xd3d6('0x0'));var emlformat=require(_0xd3d6('0x1'));var rimraf=require(_0xd3d6('0x2'));var zipdir=require(_0xd3d6('0x3'));var jsonpatch=require(_0xd3d6('0x4'));var rp=require(_0xd3d6('0x5'));var moment=require(_0xd3d6('0x6'));var BPromise=require(_0xd3d6('0x7'));var Mustache=require(_0xd3d6('0x8'));var util=require(_0xd3d6('0x9'));var path=require(_0xd3d6('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd3d6('0xb'));var fs=require('fs');var _=require(_0xd3d6('0xc'));var squel=require(_0xd3d6('0xd'));var crypto=require(_0xd3d6('0xe'));var jsforce=require(_0xd3d6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd3d6('0x10'));var querystring=require(_0xd3d6('0x11'));var Papa=require(_0xd3d6('0x12'));var Redis=require(_0xd3d6('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd3d6('0x14'));var hardwareService=require(_0xd3d6('0x15'));var logger=require(_0xd3d6('0x16'))(_0xd3d6('0x17'));var utils=require(_0xd3d6('0x18'));var config=require(_0xd3d6('0x19'));var licenseUtil=require(_0xd3d6('0x1a'));var db=require(_0xd3d6('0x1b'))['db'];function respondWithStatusCode(_0x3fb2c9,_0x526492){_0x526492=_0x526492||0xcc;return function(_0x191f05){if(_0x191f05){return _0x3fb2c9[_0xd3d6('0x1c')](_0x526492);}return _0x3fb2c9[_0xd3d6('0x1d')](_0x526492)['end']();};}function respondWithResult(_0x1f0667,_0x43a7a4){_0x43a7a4=_0x43a7a4||0xc8;return function(_0x18e24f){if(_0x18e24f){return _0x1f0667['status'](_0x43a7a4)[_0xd3d6('0x1e')](_0x18e24f);}};}function respondWithFilteredResult(_0x33c82c,_0xb4faca){return function(_0xaf933a){if(_0xaf933a){var _0x3c8f89=_0xaf933a[_0xd3d6('0x1f')],_0x38e42f=_0xb4faca['offset'],_0x128bec=_0xb4faca[_0xd3d6('0x20')]+_0xb4faca[_0xd3d6('0x21')],_0x31d4f0;if(_0x128bec>=_0x3c8f89){_0x128bec=_0x3c8f89;_0x31d4f0=0xc8;}else{_0x31d4f0=0xce;}_0x33c82c[_0xd3d6('0x1d')](_0x31d4f0);return _0x33c82c[_0xd3d6('0x22')](_0xd3d6('0x23'),_0x38e42f+'-'+_0x128bec+'/'+_0x3c8f89)[_0xd3d6('0x1e')](_0xaf933a);}return null;};}function patchUpdates(_0x15fd8d){return function(_0x1f82d6){try{jsonpatch['apply'](_0x1f82d6,_0x15fd8d,!![]);}catch(_0x3932ad){return BPromise[_0xd3d6('0x24')](_0x3932ad);}return _0x1f82d6[_0xd3d6('0x25')]();};}function saveUpdates(_0x4e7fa3,_0x2ede96){return function(_0x3d5317){if(_0x3d5317){return _0x3d5317[_0xd3d6('0x26')](_0x4e7fa3)[_0xd3d6('0x27')](function(_0x5a3b62){return _0x5a3b62;});}return null;};}function removeEntity(_0xc2b466,_0x794484){return function(_0x5b5413){if(_0x5b5413){return _0x5b5413[_0xd3d6('0x28')]()[_0xd3d6('0x27')](function(){var _0x468d09=_0x5b5413['get']({'plain':!![]});var _0x4fdaa9=_0xd3d6('0x29');return db[_0xd3d6('0x2a')][_0xd3d6('0x28')]({'where':{'type':_0x4fdaa9,'resourceId':_0x468d09['id']}})[_0xd3d6('0x27')](function(){return _0x5b5413;});})['then'](function(){_0xc2b466[_0xd3d6('0x1d')](0xcc)[_0xd3d6('0x2b')]();});}};}function handleEntityNotFound(_0x2ea04a,_0x87e591){return function(_0x4108c2){if(!_0x4108c2){_0x2ea04a[_0xd3d6('0x1c')](0x194);}return _0x4108c2;};}function handleError(_0x35cde7,_0x26d343){_0x26d343=_0x26d343||0x1f4;return function(_0x571dd6){logger[_0xd3d6('0x2c')](_0x571dd6[_0xd3d6('0x2d')]);if(_0x571dd6['name']){delete _0x571dd6[_0xd3d6('0x2e')];}_0x35cde7[_0xd3d6('0x1d')](_0x26d343)[_0xd3d6('0x2f')](_0x571dd6);};}exports[_0xd3d6('0x30')]=function(_0x261673,_0xcb0b0e){var _0x4eacaf={},_0x27e6ed={},_0x444313={'count':0x0,'rows':[]};var _0x20c4e9=_['map'](db[_0xd3d6('0x31')][_0xd3d6('0x32')],function(_0xe25c7d){return{'name':_0xe25c7d[_0xd3d6('0x33')],'type':_0xe25c7d[_0xd3d6('0x34')][_0xd3d6('0x35')]};});_0x27e6ed[_0xd3d6('0x36')]=_['map'](_0x20c4e9,'name');_0x27e6ed[_0xd3d6('0x37')]=_[_0xd3d6('0x38')](_0x261673[_0xd3d6('0x37')]);_0x27e6ed['filters']=_['intersection'](_0x27e6ed['model'],_0x27e6ed['query']);_0x4eacaf[_0xd3d6('0x39')]=_['intersection'](_0x27e6ed['model'],qs['fields'](_0x261673[_0xd3d6('0x37')]['fields']));_0x4eacaf['attributes']=_0x4eacaf[_0xd3d6('0x39')]['length']?_0x4eacaf[_0xd3d6('0x39')]:_0x27e6ed[_0xd3d6('0x36')];if(!_0x261673[_0xd3d6('0x37')][_0xd3d6('0x3a')](_0xd3d6('0x3b'))){_0x4eacaf[_0xd3d6('0x21')]=qs[_0xd3d6('0x21')](_0x261673['query'][_0xd3d6('0x21')]);_0x4eacaf[_0xd3d6('0x20')]=qs['offset'](_0x261673[_0xd3d6('0x37')][_0xd3d6('0x20')]);}_0x4eacaf[_0xd3d6('0x3c')]=qs[_0xd3d6('0x3d')](_0x261673['query'][_0xd3d6('0x3d')]);_0x4eacaf[_0xd3d6('0x3e')]=qs['filters'](_['pick'](_0x261673[_0xd3d6('0x37')],_0x27e6ed[_0xd3d6('0x3f')]),_0x20c4e9);if(_0x261673[_0xd3d6('0x37')][_0xd3d6('0x40')]){_0x4eacaf[_0xd3d6('0x3e')]=_[_0xd3d6('0x41')](_0x4eacaf[_0xd3d6('0x3e')],{'$or':_['map'](_0x20c4e9,function(_0x3ea3a4){if(_0x3ea3a4[_0xd3d6('0x34')]!==_0xd3d6('0x42')){var _0x1fa67b={};_0x1fa67b[_0x3ea3a4['name']]={'$like':'%'+_0x261673[_0xd3d6('0x37')][_0xd3d6('0x40')]+'%'};return _0x1fa67b;}})});}_0x4eacaf=_[_0xd3d6('0x41')]({},_0x4eacaf,_0x261673[_0xd3d6('0x43')]);var _0x5286d5={'where':_0x4eacaf[_0xd3d6('0x3e')]};return db[_0xd3d6('0x31')][_0xd3d6('0x1f')](_0x5286d5)[_0xd3d6('0x27')](function(_0x1c1cd5){_0x444313[_0xd3d6('0x1f')]=_0x1c1cd5;if(_0x261673[_0xd3d6('0x37')]['includeAll']){_0x4eacaf[_0xd3d6('0x44')]=[{'all':!![]}];}return db[_0xd3d6('0x31')][_0xd3d6('0x45')](_0x4eacaf);})[_0xd3d6('0x27')](function(_0x3043c4){_0x444313[_0xd3d6('0x46')]=_0x3043c4;return _0x444313;})[_0xd3d6('0x27')](respondWithFilteredResult(_0xcb0b0e,_0x4eacaf))['catch'](handleError(_0xcb0b0e,null));};exports[_0xd3d6('0x47')]=function(_0x4502fa,_0x48c1fe){var _0x461aa0={'raw':![],'where':{'id':_0x4502fa['params']['id']}},_0x3411b3={};_0x3411b3[_0xd3d6('0x36')]=_[_0xd3d6('0x38')](db[_0xd3d6('0x31')][_0xd3d6('0x32')]);_0x3411b3[_0xd3d6('0x37')]=_[_0xd3d6('0x38')](_0x4502fa[_0xd3d6('0x37')]);_0x3411b3[_0xd3d6('0x3f')]=_[_0xd3d6('0x48')](_0x3411b3[_0xd3d6('0x36')],_0x3411b3['query']);_0x461aa0[_0xd3d6('0x39')]=_[_0xd3d6('0x48')](_0x3411b3['model'],qs[_0xd3d6('0x49')](_0x4502fa[_0xd3d6('0x37')][_0xd3d6('0x49')]));_0x461aa0['attributes']=_0x461aa0[_0xd3d6('0x39')][_0xd3d6('0x4a')]?_0x461aa0[_0xd3d6('0x39')]:_0x3411b3[_0xd3d6('0x36')];if(_0x4502fa[_0xd3d6('0x37')][_0xd3d6('0x4b')]){_0x461aa0['include']=[{'all':!![]}];}_0x461aa0=_[_0xd3d6('0x41')]({},_0x461aa0,_0x4502fa[_0xd3d6('0x43')]);return db[_0xd3d6('0x31')][_0xd3d6('0x4c')](_0x461aa0)[_0xd3d6('0x27')](handleEntityNotFound(_0x48c1fe,null))[_0xd3d6('0x27')](respondWithResult(_0x48c1fe,null))[_0xd3d6('0x4d')](handleError(_0x48c1fe,null));};exports[_0xd3d6('0x4e')]=function(_0x272878,_0x1cfb5f){return db['Trigger']['create'](_0x272878[_0xd3d6('0x4f')],{})[_0xd3d6('0x27')](function(_0xcdc848){var _0x15abb3=_0x272878[_0xd3d6('0x50')][_0xd3d6('0x51')]({'plain':!![]});if(!_0x15abb3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15abb3[_0xd3d6('0x52')]===_0xd3d6('0x50')){var _0x202771=_0xcdc848[_0xd3d6('0x51')]({'plain':!![]});var _0x55a14c=_0xd3d6('0x29');return db[_0xd3d6('0x53')][_0xd3d6('0x4c')]({'where':{'name':_0x55a14c,'userProfileId':_0x15abb3[_0xd3d6('0x54')]},'raw':!![]})[_0xd3d6('0x27')](function(_0x605b56){if(_0x605b56&&_0x605b56[_0xd3d6('0x55')]===0x0){return db[_0xd3d6('0x2a')][_0xd3d6('0x4e')]({'name':_0x202771[_0xd3d6('0x2e')],'resourceId':_0x202771['id'],'type':_0x605b56[_0xd3d6('0x2e')],'sectionId':_0x605b56['id']},{})[_0xd3d6('0x27')](function(){return _0xcdc848;});}else{return _0xcdc848;}})[_0xd3d6('0x4d')](function(_0x471ece){logger['error'](_0xd3d6('0x56'),_0x471ece);throw _0x471ece;});}return _0xcdc848;})[_0xd3d6('0x27')](respondWithResult(_0x1cfb5f,0xc9))['catch'](handleError(_0x1cfb5f,null));};exports[_0xd3d6('0x26')]=function(_0x4bdf60,_0x27043c){if(_0x4bdf60[_0xd3d6('0x4f')]['id']){delete _0x4bdf60['body']['id'];}return db[_0xd3d6('0x31')]['find']({'where':{'id':_0x4bdf60[_0xd3d6('0x57')]['id']}})[_0xd3d6('0x27')](handleEntityNotFound(_0x27043c,null))['then'](saveUpdates(_0x4bdf60[_0xd3d6('0x4f')],null))[_0xd3d6('0x27')](respondWithResult(_0x27043c,null))['catch'](handleError(_0x27043c,null));};exports[_0xd3d6('0x28')]=function(_0x301bd9,_0x23d7be){return db['Trigger']['find']({'where':{'id':_0x301bd9[_0xd3d6('0x57')]['id']}})['then'](handleEntityNotFound(_0x23d7be,null))[_0xd3d6('0x27')](removeEntity(_0x23d7be,null))[_0xd3d6('0x4d')](handleError(_0x23d7be,null));};exports[_0xd3d6('0x58')]=function(_0x5e8cd1,_0x310788,_0x4bd69c){if(_0x5e8cd1[_0xd3d6('0x4f')]['id']){delete _0x5e8cd1[_0xd3d6('0x4f')]['id'];}return db[_0xd3d6('0x31')][_0xd3d6('0x4c')]({'where':{'id':_0x5e8cd1[_0xd3d6('0x57')]['id']}})[_0xd3d6('0x27')](handleEntityNotFound(_0x310788,null))['then'](function(_0x1a6a1a){if(_0x1a6a1a){_0x5e8cd1[_0xd3d6('0x4f')][_0xd3d6('0x59')]=_0x1a6a1a['id'];return db[_0xd3d6('0x5a')]['create'](_0x5e8cd1[_0xd3d6('0x4f')]);}})[_0xd3d6('0x27')](respondWithResult(_0x310788,null))['catch'](handleError(_0x310788,null));};exports[_0xd3d6('0x5b')]=function(_0x36b8ab,_0xec004,_0x271b78){if(_0x36b8ab['body']['id']){delete _0x36b8ab[_0xd3d6('0x4f')]['id'];}return db[_0xd3d6('0x31')][_0xd3d6('0x4c')]({'where':{'id':_0x36b8ab[_0xd3d6('0x57')]['id']}})[_0xd3d6('0x27')](handleEntityNotFound(_0xec004,null))['then'](function(_0x21405f){if(_0x21405f){_0x36b8ab[_0xd3d6('0x4f')][_0xd3d6('0x5c')]=_0x21405f['id'];return db['Condition'][_0xd3d6('0x4e')](_0x36b8ab[_0xd3d6('0x4f')]);}})[_0xd3d6('0x27')](respondWithResult(_0xec004,null))[_0xd3d6('0x4d')](handleError(_0xec004,null));};exports['getAllConditions']=function(_0x2d1143,_0x36a32c,_0x50304c){var _0x3dd858={};var _0x1bd6d8={};var _0x243aa0;var _0x25d538;return db['Trigger'][_0xd3d6('0x5d')]({'where':{'id':_0x2d1143[_0xd3d6('0x57')]['id']}})['then'](handleEntityNotFound(_0x36a32c,null))['then'](function(_0x52c15a){if(_0x52c15a){_0x243aa0=_0x52c15a;_0x1bd6d8[_0xd3d6('0x36')]=_[_0xd3d6('0x38')](db[_0xd3d6('0x5a')]['rawAttributes']);_0x1bd6d8[_0xd3d6('0x37')]=_[_0xd3d6('0x38')](_0x2d1143[_0xd3d6('0x37')]);_0x1bd6d8[_0xd3d6('0x3f')]=_[_0xd3d6('0x48')](_0x1bd6d8[_0xd3d6('0x36')],_0x1bd6d8[_0xd3d6('0x37')]);_0x3dd858[_0xd3d6('0x39')]=_[_0xd3d6('0x48')](_0x1bd6d8[_0xd3d6('0x36')],qs['fields'](_0x2d1143['query'][_0xd3d6('0x49')]));_0x3dd858[_0xd3d6('0x39')]=_0x3dd858['attributes'][_0xd3d6('0x4a')]?_0x3dd858[_0xd3d6('0x39')]:_0x1bd6d8[_0xd3d6('0x36')];_0x3dd858[_0xd3d6('0x3c')]=qs[_0xd3d6('0x3d')](_0x2d1143[_0xd3d6('0x37')][_0xd3d6('0x3d')]);_0x3dd858['where']=qs[_0xd3d6('0x3f')](_[_0xd3d6('0x5e')](_0x2d1143[_0xd3d6('0x37')],_0x1bd6d8[_0xd3d6('0x3f')]));if(_0x2d1143[_0xd3d6('0x37')][_0xd3d6('0x40')]){_0x3dd858[_0xd3d6('0x3e')]=_[_0xd3d6('0x41')](_0x3dd858['where'],{'$or':_[_0xd3d6('0x5f')](_0x3dd858[_0xd3d6('0x39')],function(_0x50f629){var _0x2989ae={};_0x2989ae[_0x50f629]={'$like':'%'+_0x2d1143['query']['filter']+'%'};return _0x2989ae;})});}_0x3dd858=_[_0xd3d6('0x41')]({},_0x3dd858,_0x2d1143['options']);return _0x243aa0[_0xd3d6('0x60')](_0x3dd858);}})['then'](function(_0x35f4cf){if(_0x35f4cf){_0x25d538=_0x35f4cf[_0xd3d6('0x4a')];if(!_0x2d1143[_0xd3d6('0x37')]['hasOwnProperty']('nolimit')){_0x3dd858['limit']=qs[_0xd3d6('0x21')](_0x2d1143[_0xd3d6('0x37')][_0xd3d6('0x21')]);_0x3dd858[_0xd3d6('0x20')]=qs[_0xd3d6('0x20')](_0x2d1143[_0xd3d6('0x37')][_0xd3d6('0x20')]);}return _0x243aa0['getAllConditions'](_0x3dd858);}})['then'](function(_0x1dd54b){if(_0x1dd54b){return _0x1dd54b?{'count':_0x25d538,'rows':_0x1dd54b}:null;}})[_0xd3d6('0x27')](respondWithResult(_0x36a32c,null))[_0xd3d6('0x4d')](handleError(_0x36a32c,null));};exports[_0xd3d6('0x61')]=function(_0xb92587,_0x2894fb,_0x236fe2){var _0x6639df={};var _0x5213bd={};var _0x1adf2a;var _0x22819e;return db[_0xd3d6('0x31')][_0xd3d6('0x5d')]({'where':{'id':_0xb92587[_0xd3d6('0x57')]['id']}})[_0xd3d6('0x27')](handleEntityNotFound(_0x2894fb,null))[_0xd3d6('0x27')](function(_0x417231){if(_0x417231){_0x1adf2a=_0x417231;_0x5213bd[_0xd3d6('0x36')]=_[_0xd3d6('0x38')](db[_0xd3d6('0x5a')][_0xd3d6('0x32')]);_0x5213bd['query']=_[_0xd3d6('0x38')](_0xb92587[_0xd3d6('0x37')]);_0x5213bd['filters']=_[_0xd3d6('0x48')](_0x5213bd[_0xd3d6('0x36')],_0x5213bd['query']);_0x6639df[_0xd3d6('0x39')]=_[_0xd3d6('0x48')](_0x5213bd[_0xd3d6('0x36')],qs['fields'](_0xb92587[_0xd3d6('0x37')][_0xd3d6('0x49')]));_0x6639df['attributes']=_0x6639df[_0xd3d6('0x39')][_0xd3d6('0x4a')]?_0x6639df[_0xd3d6('0x39')]:_0x5213bd['model'];_0x6639df[_0xd3d6('0x3c')]=qs[_0xd3d6('0x3d')](_0xb92587[_0xd3d6('0x37')][_0xd3d6('0x3d')]);_0x6639df[_0xd3d6('0x3e')]=qs[_0xd3d6('0x3f')](_['pick'](_0xb92587['query'],_0x5213bd[_0xd3d6('0x3f')]));if(_0xb92587[_0xd3d6('0x37')]['filter']){_0x6639df[_0xd3d6('0x3e')]=_[_0xd3d6('0x41')](_0x6639df[_0xd3d6('0x3e')],{'$or':_[_0xd3d6('0x5f')](_0x6639df[_0xd3d6('0x39')],function(_0x35181e){var _0x2c4350={};_0x2c4350[_0x35181e]={'$like':'%'+_0xb92587[_0xd3d6('0x37')][_0xd3d6('0x40')]+'%'};return _0x2c4350;})});}_0x6639df=_[_0xd3d6('0x41')]({},_0x6639df,_0xb92587['options']);return _0x1adf2a['getAnyConditions'](_0x6639df);}})[_0xd3d6('0x27')](function(_0x271b6f){if(_0x271b6f){_0x22819e=_0x271b6f[_0xd3d6('0x4a')];if(!_0xb92587[_0xd3d6('0x37')][_0xd3d6('0x3a')](_0xd3d6('0x3b'))){_0x6639df[_0xd3d6('0x21')]=qs[_0xd3d6('0x21')](_0xb92587[_0xd3d6('0x37')]['limit']);_0x6639df[_0xd3d6('0x20')]=qs['offset'](_0xb92587[_0xd3d6('0x37')]['offset']);}return _0x1adf2a[_0xd3d6('0x61')](_0x6639df);}})['then'](function(_0x4f749a){if(_0x4f749a){return _0x4f749a?{'count':_0x22819e,'rows':_0x4f749a}:null;}})[_0xd3d6('0x27')](respondWithResult(_0x2894fb,null))[_0xd3d6('0x4d')](handleError(_0x2894fb,null));};exports['addAction']=function(_0x38f759,_0x415c18,_0x4f3b6d){if(_0x38f759[_0xd3d6('0x4f')]['id']){delete _0x38f759[_0xd3d6('0x4f')]['id'];}return db['Trigger'][_0xd3d6('0x4c')]({'where':{'id':_0x38f759[_0xd3d6('0x57')]['id']}})[_0xd3d6('0x27')](handleEntityNotFound(_0x415c18,null))[_0xd3d6('0x27')](function(_0x7cfe11){if(_0x7cfe11){_0x38f759[_0xd3d6('0x4f')][_0xd3d6('0x62')]=_0x7cfe11['id'];return db['Action'][_0xd3d6('0x4e')](_0x38f759[_0xd3d6('0x4f')]);}})[_0xd3d6('0x27')](respondWithResult(_0x415c18,null))[_0xd3d6('0x4d')](handleError(_0x415c18,null));};exports['getActions']=function(_0x5cb894,_0x3c43e0,_0x418bdb){var _0x4cede1={};var _0x5066bd={};var _0x45f92f;var _0x28b2dc;return db['Trigger'][_0xd3d6('0x5d')]({'where':{'id':_0x5cb894[_0xd3d6('0x57')]['id']}})[_0xd3d6('0x27')](handleEntityNotFound(_0x3c43e0,null))[_0xd3d6('0x27')](function(_0x1cb7c4){if(_0x1cb7c4){_0x45f92f=_0x1cb7c4;_0x5066bd[_0xd3d6('0x36')]=_[_0xd3d6('0x38')](db['Action']['rawAttributes']);_0x5066bd['query']=_[_0xd3d6('0x38')](_0x5cb894[_0xd3d6('0x37')]);_0x5066bd[_0xd3d6('0x3f')]=_['intersection'](_0x5066bd[_0xd3d6('0x36')],_0x5066bd[_0xd3d6('0x37')]);_0x4cede1['attributes']=_[_0xd3d6('0x48')](_0x5066bd['model'],qs[_0xd3d6('0x49')](_0x5cb894[_0xd3d6('0x37')][_0xd3d6('0x49')]));_0x4cede1[_0xd3d6('0x39')]=_0x4cede1[_0xd3d6('0x39')][_0xd3d6('0x4a')]?_0x4cede1['attributes']:_0x5066bd[_0xd3d6('0x36')];_0x4cede1[_0xd3d6('0x3c')]=qs['sort'](_0x5cb894[_0xd3d6('0x37')][_0xd3d6('0x3d')]);_0x4cede1[_0xd3d6('0x3e')]=qs[_0xd3d6('0x3f')](_[_0xd3d6('0x5e')](_0x5cb894[_0xd3d6('0x37')],_0x5066bd[_0xd3d6('0x3f')]));if(_0x5cb894[_0xd3d6('0x37')][_0xd3d6('0x40')]){_0x4cede1[_0xd3d6('0x3e')]=_[_0xd3d6('0x41')](_0x4cede1[_0xd3d6('0x3e')],{'$or':_[_0xd3d6('0x5f')](_0x4cede1[_0xd3d6('0x39')],function(_0x404937){var _0x455c94={};_0x455c94[_0x404937]={'$like':'%'+_0x5cb894[_0xd3d6('0x37')][_0xd3d6('0x40')]+'%'};return _0x455c94;})});}_0x4cede1=_[_0xd3d6('0x41')]({},_0x4cede1,_0x5cb894[_0xd3d6('0x43')]);return _0x45f92f[_0xd3d6('0x63')](_0x4cede1);}})[_0xd3d6('0x27')](function(_0x46b8a5){if(_0x46b8a5){_0x28b2dc=_0x46b8a5[_0xd3d6('0x4a')];if(!_0x5cb894[_0xd3d6('0x37')][_0xd3d6('0x3a')](_0xd3d6('0x3b'))){_0x4cede1[_0xd3d6('0x21')]=qs[_0xd3d6('0x21')](_0x5cb894['query'][_0xd3d6('0x21')]);_0x4cede1[_0xd3d6('0x20')]=qs[_0xd3d6('0x20')](_0x5cb894[_0xd3d6('0x37')][_0xd3d6('0x20')]);}return _0x45f92f[_0xd3d6('0x63')](_0x4cede1);}})['then'](function(_0x301212){if(_0x301212){return _0x301212?{'count':_0x28b2dc,'rows':_0x301212}:null;}})[_0xd3d6('0x27')](respondWithResult(_0x3c43e0,null))[_0xd3d6('0x4d')](handleError(_0x3c43e0,null));}; \ No newline at end of file +var _0x99fb=['stack','name','send','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','VIRTUAL','options','count','includeAll','include','findAll','catch','params','rawAttributes','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','order','pick','getAnyConditions','nolimit','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x99fb,0x92));var _0xb99f=function(_0x32d3b8,_0x3f2f99){_0x32d3b8=_0x32d3b8-0x0;var _0x272525=_0x99fb[_0x32d3b8];return _0x272525;};'use strict';var pdf=require(_0xb99f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb99f('0x1'));var zipdir=require(_0xb99f('0x2'));var jsonpatch=require(_0xb99f('0x3'));var rp=require(_0xb99f('0x4'));var moment=require(_0xb99f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb99f('0x6'));var util=require(_0xb99f('0x7'));var path=require('path');var sox=require(_0xb99f('0x8'));var csv=require(_0xb99f('0x9'));var ejs=require(_0xb99f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb99f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb99f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb99f('0x9'));var querystring=require(_0xb99f('0xd'));var Papa=require('papaparse');var Redis=require(_0xb99f('0xe'));var authService=require(_0xb99f('0xf'));var qs=require(_0xb99f('0x10'));var as=require(_0xb99f('0x11'));var hardwareService=require(_0xb99f('0x12'));var logger=require(_0xb99f('0x13'))(_0xb99f('0x14'));var utils=require('../../config/utils');var config=require(_0xb99f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e1e6e,_0x130bc8){_0x130bc8=_0x130bc8||0xcc;return function(_0x2ede66){if(_0x2ede66){return _0x1e1e6e[_0xb99f('0x16')](_0x130bc8);}return _0x1e1e6e[_0xb99f('0x17')](_0x130bc8)['end']();};}function respondWithResult(_0x15a7de,_0x57ac59){_0x57ac59=_0x57ac59||0xc8;return function(_0x1086d7){if(_0x1086d7){return _0x15a7de[_0xb99f('0x17')](_0x57ac59)['json'](_0x1086d7);}};}function respondWithFilteredResult(_0x3743bf,_0x4b5b61){return function(_0x1504de){if(_0x1504de){var _0x58db95=_0x1504de['count'],_0x383d9d=_0x4b5b61[_0xb99f('0x18')],_0x56f0b9=_0x4b5b61[_0xb99f('0x18')]+_0x4b5b61[_0xb99f('0x19')],_0x37a14c;if(_0x56f0b9>=_0x58db95){_0x56f0b9=_0x58db95;_0x37a14c=0xc8;}else{_0x37a14c=0xce;}_0x3743bf[_0xb99f('0x17')](_0x37a14c);return _0x3743bf[_0xb99f('0x1a')](_0xb99f('0x1b'),_0x383d9d+'-'+_0x56f0b9+'/'+_0x58db95)[_0xb99f('0x1c')](_0x1504de);}return null;};}function patchUpdates(_0x1692d7){return function(_0x29c5ff){try{jsonpatch[_0xb99f('0x1d')](_0x29c5ff,_0x1692d7,!![]);}catch(_0x46a283){return BPromise[_0xb99f('0x1e')](_0x46a283);}return _0x29c5ff[_0xb99f('0x1f')]();};}function saveUpdates(_0x3273f6,_0x5ac27e){return function(_0x542ba8){if(_0x542ba8){return _0x542ba8[_0xb99f('0x20')](_0x3273f6)[_0xb99f('0x21')](function(_0x1dcd3e){return _0x1dcd3e;});}return null;};}function removeEntity(_0x38b49b,_0x1faec2){return function(_0x36a8d9){if(_0x36a8d9){return _0x36a8d9[_0xb99f('0x22')]()[_0xb99f('0x21')](function(){var _0x1572ff=_0x36a8d9[_0xb99f('0x23')]({'plain':!![]});var _0x1a90ad='Triggers';return db[_0xb99f('0x24')][_0xb99f('0x22')]({'where':{'type':_0x1a90ad,'resourceId':_0x1572ff['id']}})[_0xb99f('0x21')](function(){return _0x36a8d9;});})[_0xb99f('0x21')](function(){_0x38b49b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2b1a,_0x3f66fd){return function(_0x4c5731){if(!_0x4c5731){_0x5c2b1a[_0xb99f('0x16')](0x194);}return _0x4c5731;};}function handleError(_0x3f77cb,_0x1369ac){_0x1369ac=_0x1369ac||0x1f4;return function(_0x3c4f27){logger[_0xb99f('0x25')](_0x3c4f27[_0xb99f('0x26')]);if(_0x3c4f27[_0xb99f('0x27')]){delete _0x3c4f27[_0xb99f('0x27')];}_0x3f77cb['status'](_0x1369ac)[_0xb99f('0x28')](_0x3c4f27);};}exports['index']=function(_0x311456,_0x154acb){var _0x29c96c={},_0x2b74c5={},_0x1a1993={'count':0x0,'rows':[]};var _0x318c70=_[_0xb99f('0x29')](db[_0xb99f('0x2a')]['rawAttributes'],function(_0x4d447b){return{'name':_0x4d447b[_0xb99f('0x2b')],'type':_0x4d447b[_0xb99f('0x2c')][_0xb99f('0x2d')]};});_0x2b74c5[_0xb99f('0x2e')]=_['map'](_0x318c70,_0xb99f('0x27'));_0x2b74c5[_0xb99f('0x2f')]=_[_0xb99f('0x30')](_0x311456['query']);_0x2b74c5[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x2b74c5[_0xb99f('0x2e')],_0x2b74c5[_0xb99f('0x2f')]);_0x29c96c[_0xb99f('0x33')]=_[_0xb99f('0x32')](_0x2b74c5['model'],qs[_0xb99f('0x34')](_0x311456[_0xb99f('0x2f')][_0xb99f('0x34')]));_0x29c96c[_0xb99f('0x33')]=_0x29c96c[_0xb99f('0x33')]['length']?_0x29c96c[_0xb99f('0x33')]:_0x2b74c5['model'];if(!_0x311456[_0xb99f('0x2f')][_0xb99f('0x35')]('nolimit')){_0x29c96c[_0xb99f('0x19')]=qs[_0xb99f('0x19')](_0x311456[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x29c96c[_0xb99f('0x18')]=qs[_0xb99f('0x18')](_0x311456[_0xb99f('0x2f')]['offset']);}_0x29c96c['order']=qs['sort'](_0x311456['query'][_0xb99f('0x36')]);_0x29c96c[_0xb99f('0x37')]=qs[_0xb99f('0x31')](_['pick'](_0x311456[_0xb99f('0x2f')],_0x2b74c5['filters']),_0x318c70);if(_0x311456[_0xb99f('0x2f')][_0xb99f('0x38')]){_0x29c96c[_0xb99f('0x37')]=_['merge'](_0x29c96c[_0xb99f('0x37')],{'$or':_[_0xb99f('0x29')](_0x318c70,function(_0x7bf04a){if(_0x7bf04a[_0xb99f('0x2c')]!==_0xb99f('0x39')){var _0x16227b={};_0x16227b[_0x7bf04a[_0xb99f('0x27')]]={'$like':'%'+_0x311456[_0xb99f('0x2f')][_0xb99f('0x38')]+'%'};return _0x16227b;}})});}_0x29c96c=_['merge']({},_0x29c96c,_0x311456[_0xb99f('0x3a')]);var _0x18b812={'where':_0x29c96c[_0xb99f('0x37')]};return db[_0xb99f('0x2a')][_0xb99f('0x3b')](_0x18b812)[_0xb99f('0x21')](function(_0x1d12ed){_0x1a1993[_0xb99f('0x3b')]=_0x1d12ed;if(_0x311456[_0xb99f('0x2f')][_0xb99f('0x3c')]){_0x29c96c[_0xb99f('0x3d')]=[{'all':!![]}];}return db[_0xb99f('0x2a')][_0xb99f('0x3e')](_0x29c96c);})[_0xb99f('0x21')](function(_0x566b61){_0x1a1993['rows']=_0x566b61;return _0x1a1993;})[_0xb99f('0x21')](respondWithFilteredResult(_0x154acb,_0x29c96c))[_0xb99f('0x3f')](handleError(_0x154acb,null));};exports['show']=function(_0x259202,_0x61e6d){var _0x517589={'raw':![],'where':{'id':_0x259202[_0xb99f('0x40')]['id']}},_0x3bcb53={};_0x3bcb53[_0xb99f('0x2e')]=_[_0xb99f('0x30')](db['Trigger'][_0xb99f('0x41')]);_0x3bcb53[_0xb99f('0x2f')]=_['keys'](_0x259202[_0xb99f('0x2f')]);_0x3bcb53[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x3bcb53[_0xb99f('0x2e')],_0x3bcb53[_0xb99f('0x2f')]);_0x517589['attributes']=_[_0xb99f('0x32')](_0x3bcb53[_0xb99f('0x2e')],qs[_0xb99f('0x34')](_0x259202[_0xb99f('0x2f')][_0xb99f('0x34')]));_0x517589[_0xb99f('0x33')]=_0x517589[_0xb99f('0x33')]['length']?_0x517589['attributes']:_0x3bcb53[_0xb99f('0x2e')];if(_0x259202[_0xb99f('0x2f')][_0xb99f('0x3c')]){_0x517589['include']=[{'all':!![]}];}_0x517589=_[_0xb99f('0x42')]({},_0x517589,_0x259202['options']);return db[_0xb99f('0x2a')][_0xb99f('0x43')](_0x517589)[_0xb99f('0x21')](handleEntityNotFound(_0x61e6d,null))[_0xb99f('0x21')](respondWithResult(_0x61e6d,null))[_0xb99f('0x3f')](handleError(_0x61e6d,null));};exports[_0xb99f('0x44')]=function(_0x50e339,_0x1b4de9){return db[_0xb99f('0x2a')][_0xb99f('0x44')](_0x50e339[_0xb99f('0x45')],{})[_0xb99f('0x21')](function(_0x1025be){var _0x5eda52=_0x50e339[_0xb99f('0x46')][_0xb99f('0x23')]({'plain':!![]});if(!_0x5eda52)throw new Error(_0xb99f('0x47'));if(_0x5eda52[_0xb99f('0x48')]==='user'){var _0x516c8e=_0x1025be[_0xb99f('0x23')]({'plain':!![]});var _0x331205=_0xb99f('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x331205,'userProfileId':_0x5eda52[_0xb99f('0x4a')]},'raw':!![]})[_0xb99f('0x21')](function(_0x30f0c4){if(_0x30f0c4&&_0x30f0c4['autoAssociation']===0x0){return db[_0xb99f('0x24')][_0xb99f('0x44')]({'name':_0x516c8e['name'],'resourceId':_0x516c8e['id'],'type':_0x30f0c4[_0xb99f('0x27')],'sectionId':_0x30f0c4['id']},{})[_0xb99f('0x21')](function(){return _0x1025be;});}else{return _0x1025be;}})['catch'](function(_0x3ed882){logger[_0xb99f('0x25')](_0xb99f('0x4b'),_0x3ed882);throw _0x3ed882;});}return _0x1025be;})['then'](respondWithResult(_0x1b4de9,0xc9))['catch'](handleError(_0x1b4de9,null));};exports[_0xb99f('0x20')]=function(_0x4213da,_0x490959){if(_0x4213da[_0xb99f('0x45')]['id']){delete _0x4213da[_0xb99f('0x45')]['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x4213da[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x490959,null))[_0xb99f('0x21')](saveUpdates(_0x4213da[_0xb99f('0x45')],null))['then'](respondWithResult(_0x490959,null))[_0xb99f('0x3f')](handleError(_0x490959,null));};exports['destroy']=function(_0x4f2c50,_0x2cd200){return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x4f2c50[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x2cd200,null))[_0xb99f('0x21')](removeEntity(_0x2cd200,null))['catch'](handleError(_0x2cd200,null));};exports[_0xb99f('0x4c')]=function(_0x1a144a,_0x434238,_0x52328a){if(_0x1a144a[_0xb99f('0x45')]['id']){delete _0x1a144a[_0xb99f('0x45')]['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x1a144a[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x434238,null))[_0xb99f('0x21')](function(_0x21f9db){if(_0x21f9db){_0x1a144a[_0xb99f('0x45')][_0xb99f('0x4d')]=_0x21f9db['id'];return db[_0xb99f('0x4e')][_0xb99f('0x44')](_0x1a144a['body']);}})[_0xb99f('0x21')](respondWithResult(_0x434238,null))['catch'](handleError(_0x434238,null));};exports[_0xb99f('0x4f')]=function(_0x3bf89e,_0x425664,_0x48335a){if(_0x3bf89e[_0xb99f('0x45')]['id']){delete _0x3bf89e['body']['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x3bf89e[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x425664,null))['then'](function(_0x5732d0){if(_0x5732d0){_0x3bf89e[_0xb99f('0x45')][_0xb99f('0x50')]=_0x5732d0['id'];return db[_0xb99f('0x4e')][_0xb99f('0x44')](_0x3bf89e[_0xb99f('0x45')]);}})[_0xb99f('0x21')](respondWithResult(_0x425664,null))['catch'](handleError(_0x425664,null));};exports[_0xb99f('0x51')]=function(_0x122f71,_0x10c95d,_0x160226){var _0x990beb={};var _0xd2b849={};var _0x3565ff;var _0x150a6e;return db[_0xb99f('0x2a')][_0xb99f('0x52')]({'where':{'id':_0x122f71['params']['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x10c95d,null))[_0xb99f('0x21')](function(_0x4ee91f){if(_0x4ee91f){_0x3565ff=_0x4ee91f;_0xd2b849[_0xb99f('0x2e')]=_[_0xb99f('0x30')](db[_0xb99f('0x4e')]['rawAttributes']);_0xd2b849[_0xb99f('0x2f')]=_[_0xb99f('0x30')](_0x122f71[_0xb99f('0x2f')]);_0xd2b849[_0xb99f('0x31')]=_['intersection'](_0xd2b849['model'],_0xd2b849[_0xb99f('0x2f')]);_0x990beb['attributes']=_[_0xb99f('0x32')](_0xd2b849['model'],qs['fields'](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x34')]));_0x990beb['attributes']=_0x990beb[_0xb99f('0x33')][_0xb99f('0x53')]?_0x990beb[_0xb99f('0x33')]:_0xd2b849['model'];_0x990beb[_0xb99f('0x54')]=qs[_0xb99f('0x36')](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x36')]);_0x990beb[_0xb99f('0x37')]=qs['filters'](_['pick'](_0x122f71['query'],_0xd2b849[_0xb99f('0x31')]));if(_0x122f71[_0xb99f('0x2f')]['filter']){_0x990beb[_0xb99f('0x37')]=_[_0xb99f('0x42')](_0x990beb[_0xb99f('0x37')],{'$or':_[_0xb99f('0x29')](_0x990beb[_0xb99f('0x33')],function(_0x599ce3){var _0x308b8c={};_0x308b8c[_0x599ce3]={'$like':'%'+_0x122f71['query']['filter']+'%'};return _0x308b8c;})});}_0x990beb=_['merge']({},_0x990beb,_0x122f71[_0xb99f('0x3a')]);return _0x3565ff[_0xb99f('0x51')](_0x990beb);}})[_0xb99f('0x21')](function(_0x440469){if(_0x440469){_0x150a6e=_0x440469['length'];if(!_0x122f71['query']['hasOwnProperty']('nolimit')){_0x990beb[_0xb99f('0x19')]=qs[_0xb99f('0x19')](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x990beb[_0xb99f('0x18')]=qs['offset'](_0x122f71[_0xb99f('0x2f')][_0xb99f('0x18')]);}return _0x3565ff[_0xb99f('0x51')](_0x990beb);}})[_0xb99f('0x21')](function(_0x411297){if(_0x411297){return _0x411297?{'count':_0x150a6e,'rows':_0x411297}:null;}})['then'](respondWithResult(_0x10c95d,null))['catch'](handleError(_0x10c95d,null));};exports['getAnyConditions']=function(_0x1801b5,_0x413436,_0x28317d){var _0x47656c={};var _0x2002d9={};var _0x5bcf63;var _0x562d31;return db['Trigger'][_0xb99f('0x52')]({'where':{'id':_0x1801b5['params']['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x413436,null))[_0xb99f('0x21')](function(_0x2e272e){if(_0x2e272e){_0x5bcf63=_0x2e272e;_0x2002d9['model']=_[_0xb99f('0x30')](db[_0xb99f('0x4e')][_0xb99f('0x41')]);_0x2002d9['query']=_[_0xb99f('0x30')](_0x1801b5[_0xb99f('0x2f')]);_0x2002d9[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x2002d9[_0xb99f('0x2e')],_0x2002d9['query']);_0x47656c[_0xb99f('0x33')]=_[_0xb99f('0x32')](_0x2002d9[_0xb99f('0x2e')],qs[_0xb99f('0x34')](_0x1801b5['query'][_0xb99f('0x34')]));_0x47656c[_0xb99f('0x33')]=_0x47656c[_0xb99f('0x33')][_0xb99f('0x53')]?_0x47656c['attributes']:_0x2002d9[_0xb99f('0x2e')];_0x47656c['order']=qs[_0xb99f('0x36')](_0x1801b5[_0xb99f('0x2f')]['sort']);_0x47656c['where']=qs['filters'](_[_0xb99f('0x55')](_0x1801b5['query'],_0x2002d9['filters']));if(_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x38')]){_0x47656c[_0xb99f('0x37')]=_[_0xb99f('0x42')](_0x47656c[_0xb99f('0x37')],{'$or':_[_0xb99f('0x29')](_0x47656c['attributes'],function(_0x9dc29e){var _0x41f128={};_0x41f128[_0x9dc29e]={'$like':'%'+_0x1801b5['query'][_0xb99f('0x38')]+'%'};return _0x41f128;})});}_0x47656c=_[_0xb99f('0x42')]({},_0x47656c,_0x1801b5[_0xb99f('0x3a')]);return _0x5bcf63[_0xb99f('0x56')](_0x47656c);}})[_0xb99f('0x21')](function(_0x3b9bab){if(_0x3b9bab){_0x562d31=_0x3b9bab[_0xb99f('0x53')];if(!_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x35')](_0xb99f('0x57'))){_0x47656c['limit']=qs[_0xb99f('0x19')](_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x47656c['offset']=qs[_0xb99f('0x18')](_0x1801b5[_0xb99f('0x2f')][_0xb99f('0x18')]);}return _0x5bcf63[_0xb99f('0x56')](_0x47656c);}})['then'](function(_0x315d13){if(_0x315d13){return _0x315d13?{'count':_0x562d31,'rows':_0x315d13}:null;}})[_0xb99f('0x21')](respondWithResult(_0x413436,null))[_0xb99f('0x3f')](handleError(_0x413436,null));};exports[_0xb99f('0x58')]=function(_0x5d947e,_0x48f61d,_0x5a87a8){if(_0x5d947e['body']['id']){delete _0x5d947e[_0xb99f('0x45')]['id'];}return db[_0xb99f('0x2a')][_0xb99f('0x43')]({'where':{'id':_0x5d947e[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x48f61d,null))[_0xb99f('0x21')](function(_0x3fa180){if(_0x3fa180){_0x5d947e[_0xb99f('0x45')][_0xb99f('0x59')]=_0x3fa180['id'];return db[_0xb99f('0x5a')]['create'](_0x5d947e[_0xb99f('0x45')]);}})[_0xb99f('0x21')](respondWithResult(_0x48f61d,null))[_0xb99f('0x3f')](handleError(_0x48f61d,null));};exports[_0xb99f('0x5b')]=function(_0x395da2,_0x29760a,_0x57a3a9){var _0x29acf9={};var _0x19c0c8={};var _0x424f5e;var _0xa9e3e8;return db[_0xb99f('0x2a')]['findOne']({'where':{'id':_0x395da2[_0xb99f('0x40')]['id']}})[_0xb99f('0x21')](handleEntityNotFound(_0x29760a,null))[_0xb99f('0x21')](function(_0xe8524d){if(_0xe8524d){_0x424f5e=_0xe8524d;_0x19c0c8[_0xb99f('0x2e')]=_[_0xb99f('0x30')](db[_0xb99f('0x5a')][_0xb99f('0x41')]);_0x19c0c8[_0xb99f('0x2f')]=_[_0xb99f('0x30')](_0x395da2['query']);_0x19c0c8[_0xb99f('0x31')]=_[_0xb99f('0x32')](_0x19c0c8[_0xb99f('0x2e')],_0x19c0c8['query']);_0x29acf9[_0xb99f('0x33')]=_[_0xb99f('0x32')](_0x19c0c8[_0xb99f('0x2e')],qs[_0xb99f('0x34')](_0x395da2['query'][_0xb99f('0x34')]));_0x29acf9[_0xb99f('0x33')]=_0x29acf9[_0xb99f('0x33')][_0xb99f('0x53')]?_0x29acf9[_0xb99f('0x33')]:_0x19c0c8[_0xb99f('0x2e')];_0x29acf9['order']=qs[_0xb99f('0x36')](_0x395da2[_0xb99f('0x2f')]['sort']);_0x29acf9['where']=qs['filters'](_['pick'](_0x395da2[_0xb99f('0x2f')],_0x19c0c8[_0xb99f('0x31')]));if(_0x395da2[_0xb99f('0x2f')]['filter']){_0x29acf9['where']=_[_0xb99f('0x42')](_0x29acf9[_0xb99f('0x37')],{'$or':_['map'](_0x29acf9[_0xb99f('0x33')],function(_0xbe3b99){var _0x19b30a={};_0x19b30a[_0xbe3b99]={'$like':'%'+_0x395da2['query'][_0xb99f('0x38')]+'%'};return _0x19b30a;})});}_0x29acf9=_[_0xb99f('0x42')]({},_0x29acf9,_0x395da2[_0xb99f('0x3a')]);return _0x424f5e['getActions'](_0x29acf9);}})[_0xb99f('0x21')](function(_0x1f5a7d){if(_0x1f5a7d){_0xa9e3e8=_0x1f5a7d[_0xb99f('0x53')];if(!_0x395da2[_0xb99f('0x2f')][_0xb99f('0x35')](_0xb99f('0x57'))){_0x29acf9[_0xb99f('0x19')]=qs[_0xb99f('0x19')](_0x395da2[_0xb99f('0x2f')][_0xb99f('0x19')]);_0x29acf9['offset']=qs[_0xb99f('0x18')](_0x395da2[_0xb99f('0x2f')]['offset']);}return _0x424f5e[_0xb99f('0x5b')](_0x29acf9);}})['then'](function(_0x2a7ca3){if(_0x2a7ca3){return _0x2a7ca3?{'count':_0xa9e3e8,'rows':_0x2a7ca3}:null;}})[_0xb99f('0x21')](respondWithResult(_0x29760a,null))['catch'](handleError(_0x29760a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9a6302f..9642f69 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 _0x1273=['rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x53a3cf,_0x2a4394){var _0x6199fc=function(_0x55422a){while(--_0x55422a){_0x53a3cf['push'](_0x53a3cf['shift']());}};_0x6199fc(++_0x2a4394);}(_0x1273,0xeb));var _0x3127=function(_0x55f185,_0x382ec3){_0x55f185=_0x55f185-0x0;var _0x5bd81c=_0x1273[_0x55f185];return _0x5bd81c;};'use strict';var _=require(_0x3127('0x0'));var util=require(_0x3127('0x1'));var logger=require(_0x3127('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3127('0x3'));var rp=require(_0x3127('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3127('0x5'));var config=require(_0x3127('0x6'));var attributes=require(_0x3127('0x7'));module[_0x3127('0x8')]=function(_0x4f81a0,_0xe78c1c){return _0x4f81a0[_0x3127('0x9')](_0x3127('0xa'),attributes,{'tableName':_0x3127('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15ff=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2f3daf,_0x296006){var _0x51b2fb=function(_0x16ac38){while(--_0x16ac38){_0x2f3daf['push'](_0x2f3daf['shift']());}};_0x51b2fb(++_0x296006);}(_0x15ff,0xcd));var _0xf15f=function(_0x32bbaa,_0x2bc8f3){_0x32bbaa=_0x32bbaa-0x0;var _0x34077b=_0x15ff[_0x32bbaa];return _0x34077b;};'use strict';var _=require(_0xf15f('0x0'));var util=require(_0xf15f('0x1'));var logger=require(_0xf15f('0x2'))(_0xf15f('0x3'));var moment=require(_0xf15f('0x4'));var BPromise=require(_0xf15f('0x5'));var rp=require(_0xf15f('0x6'));var fs=require('fs');var path=require(_0xf15f('0x7'));var rimraf=require(_0xf15f('0x8'));var config=require(_0xf15f('0x9'));var attributes=require('./trigger.attributes');module[_0xf15f('0xa')]=function(_0x3eda86,_0x44e541){return _0x3eda86['define']('Trigger',attributes,{'tableName':_0xf15f('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 539d8c4..1618b13 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 _0x6b20=['../../config/environment','jayson/promise','client','http','request','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetTrigger','Trigger','findAll','options','raw','where','limit','map','attributes','include','model','then','debug','stringify','catch','ShowTrigger','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6b20,0xd1));var _0x06b2=function(_0x288089,_0x4bc434){_0x288089=_0x288089-0x0;var _0x153b4b=_0x6b20[_0x288089];return _0x153b4b;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('Trigger,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});}exports[_0x06b2('0x14')]=function(_0x594b48){var _0x4c9cae=this;return new Promise(function(_0x192270,_0x1b4ab0){return db[_0x06b2('0x15')][_0x06b2('0x16')]({'raw':_0x594b48['options']?_0x594b48[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')]['attributes']||null:null,'limit':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x1a')]||null:null,'include':_0x594b48[_0x06b2('0x17')]?_0x594b48['options']['include']?_[_0x06b2('0x1b')](_0x594b48[_0x06b2('0x17')]['include'],function(_0x39659f){return{'model':db[_0x39659f['model']],'as':_0x39659f['as'],'attributes':_0x39659f[_0x06b2('0x1c')],'include':_0x39659f[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x39659f['include'],function(_0x4382ce){return{'model':db[_0x4382ce[_0x06b2('0x1e')]],'as':_0x4382ce['as'],'attributes':_0x4382ce[_0x06b2('0x1c')],'include':_0x4382ce[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x4382ce['include'],function(_0xbb00ea){return{'model':db[_0xbb00ea[_0x06b2('0x1e')]],'as':_0xbb00ea['as'],'attributes':_0xbb00ea[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x1976ac){logger[_0x06b2('0x12')]('GetTrigger',_0x594b48);logger[_0x06b2('0x20')](_0x06b2('0x14'),_0x594b48,JSON[_0x06b2('0x21')](_0x1976ac));_0x192270(_0x1976ac);})[_0x06b2('0x22')](function(_0x1f02d8){logger[_0x06b2('0xf')](_0x06b2('0x14'),_0x1f02d8['message'],_0x594b48);_0x1b4ab0(_0x4c9cae[_0x06b2('0xf')](0x1f4,_0x1f02d8[_0x06b2('0x11')]));});});};exports[_0x06b2('0x23')]=function(_0x15a78b){var _0x1cc725=this;return new Promise(function(_0x37d391,_0x401551){return db[_0x06b2('0x15')]['find']({'raw':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x15a78b[_0x06b2('0x17')]?_0x15a78b['options']['attributes']||null:null,'include':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')]?_['map'](_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')],function(_0x37bfb5){return{'model':db[_0x37bfb5[_0x06b2('0x1e')]],'as':_0x37bfb5['as'],'attributes':_0x37bfb5[_0x06b2('0x1c')],'include':_0x37bfb5[_0x06b2('0x1d')]?_['map'](_0x37bfb5[_0x06b2('0x1d')],function(_0x1e66f1){return{'model':db[_0x1e66f1[_0x06b2('0x1e')]],'as':_0x1e66f1['as'],'attributes':_0x1e66f1['attributes'],'include':_0x1e66f1[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x1e66f1['include'],function(_0x45ea67){return{'model':db[_0x45ea67[_0x06b2('0x1e')]],'as':_0x45ea67['as'],'attributes':_0x45ea67[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x2e49df){logger[_0x06b2('0x12')](_0x06b2('0x23'),_0x15a78b);logger[_0x06b2('0x20')](_0x06b2('0x23'),_0x15a78b,JSON[_0x06b2('0x21')](_0x2e49df));_0x37d391(_0x2e49df);})[_0x06b2('0x22')](function(_0x1cc7b6){logger['error'](_0x06b2('0x23'),_0x1cc7b6['message'],_0x15a78b);_0x401551(_0x1cc725['error'](0x1f4,_0x1cc7b6[_0x06b2('0x11')]));});});}; \ No newline at end of file +var _0x3de3=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','findAll','options','raw','where','include','map','model','attributes','ShowTrigger','Trigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x438584,_0x4189ae){var _0x24b20b=function(_0x3eeeb2){while(--_0x3eeeb2){_0x438584['push'](_0x438584['shift']());}};_0x24b20b(++_0x4189ae);}(_0x3de3,0x1ce));var _0x33de=function(_0x38bbef,_0x721026){_0x38bbef=_0x38bbef-0x0;var _0x4970be=_0x3de3[_0x38bbef];return _0x4970be;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['Trigger'][_0x33de('0x17')]({'raw':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x1a')]||null:null,'attributes':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')]['attributes']||null:null,'limit':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')]['limit']||null:null,'include':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0['options'][_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x52cfa0['options'][_0x33de('0x1b')],function(_0x5cd77e){return{'model':db[_0x5cd77e[_0x33de('0x1d')]],'as':_0x5cd77e['as'],'attributes':_0x5cd77e['attributes'],'include':_0x5cd77e[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x5cd77e[_0x33de('0x1b')],function(_0x5b79d7){return{'model':db[_0x5b79d7[_0x33de('0x1d')]],'as':_0x5b79d7['as'],'attributes':_0x5b79d7[_0x33de('0x1e')],'include':_0x5b79d7[_0x33de('0x1b')]?_['map'](_0x5b79d7[_0x33de('0x1b')],function(_0x5585a2){return{'model':db[_0x5585a2['model']],'as':_0x5585a2['as'],'attributes':_0x5585a2[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x1a870a){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger[_0x33de('0xe')](_0x33de('0x16'),_0x52cfa0,JSON[_0x33de('0x10')](_0x1a870a));_0x201ff3(_0x1a870a);})['catch'](function(_0x5ae0e8){logger[_0x33de('0x11')](_0x33de('0x16'),_0x5ae0e8[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7[_0x33de('0x11')](0x1f4,_0x5ae0e8[_0x33de('0x13')]));});});};exports[_0x33de('0x1f')]=function(_0x427e82){var _0x4e1898=this;return new Promise(function(_0x282158,_0x1cee91){return db[_0x33de('0x20')][_0x33de('0x21')]({'raw':_0x427e82['options']?_0x427e82[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x427e82['options']?_0x427e82['options']['where']||null:null,'attributes':_0x427e82[_0x33de('0x18')]?_0x427e82[_0x33de('0x18')]['attributes']||null:null,'include':_0x427e82[_0x33de('0x18')]?_0x427e82['options']['include']?_[_0x33de('0x1c')](_0x427e82[_0x33de('0x18')][_0x33de('0x1b')],function(_0x335794){return{'model':db[_0x335794[_0x33de('0x1d')]],'as':_0x335794['as'],'attributes':_0x335794[_0x33de('0x1e')],'include':_0x335794[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x335794['include'],function(_0x26d2a5){return{'model':db[_0x26d2a5['model']],'as':_0x26d2a5['as'],'attributes':_0x26d2a5[_0x33de('0x1e')],'include':_0x26d2a5['include']?_['map'](_0x26d2a5[_0x33de('0x1b')],function(_0x3614e0){return{'model':db[_0x3614e0[_0x33de('0x1d')]],'as':_0x3614e0['as'],'attributes':_0x3614e0[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x173ae6){logger['info'](_0x33de('0x1f'),_0x427e82);logger[_0x33de('0xe')](_0x33de('0x1f'),_0x427e82,JSON[_0x33de('0x10')](_0x173ae6));_0x282158(_0x173ae6);})[_0x33de('0x15')](function(_0x9f5688){logger[_0x33de('0x11')]('ShowTrigger',_0x9f5688[_0x33de('0x13')],_0x427e82);_0x1cee91(_0x4e1898[_0x33de('0x11')](0x1f4,_0x9f5688[_0x33de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 69246c5..20cee71 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 _0x4bc3=['post','/:id/clone','clone','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x3828a9,_0x1147c1){var _0xe7ef37=function(_0x59419e){while(--_0x59419e){_0x3828a9['push'](_0x3828a9['shift']());}};_0xe7ef37(++_0x1147c1);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x4bc3[_0x2283dc];return _0x16db90;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var auth=require(_0x34bc('0x4'));var interaction=require(_0x34bc('0x5'));var config=require(_0x34bc('0x6'));var controller=require(_0x34bc('0x7'));router[_0x34bc('0x8')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xa')]);router['get'](_0x34bc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x34bc('0xc')](_0x34bc('0xd'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xe')]);router[_0x34bc('0xc')]('/',auth[_0x34bc('0x9')](),controller['create']);router['put'](_0x34bc('0xb'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xf')]);router['delete'](_0x34bc('0xb'),auth['isAuthenticated'](),controller[_0x34bc('0x10')]);module[_0x34bc('0x11')]=router; \ No newline at end of file +var _0xd0bb=['express','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','/:id','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path'];(function(_0xbdfd91,_0x222e83){var _0x4e49e2=function(_0x3b2d79){while(--_0x3b2d79){_0xbdfd91['push'](_0xbdfd91['shift']());}};_0x4e49e2(++_0x222e83);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5d8076,_0x2b476a){_0x5d8076=_0x5d8076-0x0;var _0x26811a=_0xd0bb[_0x5d8076];return _0x26811a;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var auth=require(_0xbd0b('0x4'));var interaction=require(_0xbd0b('0x5'));var config=require('../../config/environment');var controller=require(_0xbd0b('0x6'));router['get']('/',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x8')]);router[_0xbd0b('0x9')](_0xbd0b('0xa'),auth[_0xbd0b('0x7')](),controller['show']);router[_0xbd0b('0xb')](_0xbd0b('0xc'),auth[_0xbd0b('0x7')](),controller[_0xbd0b('0xd')]);router[_0xbd0b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd0b('0xe')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xf')]);router[_0xbd0b('0x10')]('/:id',auth[_0xbd0b('0x7')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index a4d41c1..d64e9b3 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 _0x691a=['friend','from-voip-provider','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','all','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','always','accept','originate','uas','pai','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','ENUM'];(function(_0x340f57,_0x4ab1a8){var _0xf2244a=function(_0x3b9dd0){while(--_0x3b9dd0){_0x340f57['push'](_0x340f57['shift']());}};_0xf2244a(++_0x4ab1a8);}(_0x691a,0x12a));var _0xa691=function(_0x16d935,_0x54919f){_0x16d935=_0x16d935-0x0;var _0x12e9a7=_0x691a[_0x16d935];return _0x12e9a7;};'use strict';var Sequelize=require(_0xa691('0x0'));module['exports']={'name':{'type':Sequelize[_0xa691('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x3'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa691('0x4')},'callingpres':{'type':Sequelize[_0xa691('0x2')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xa691('0x5'),'ALLOWED',_0xa691('0x6'),_0xa691('0x7'),_0xa691('0x8'),_0xa691('0x9'))},'deny':{'type':Sequelize[_0xa691('0x1')]},'permit':{'type':Sequelize[_0xa691('0x1')]},'secret':{'type':Sequelize[_0xa691('0x1')]},'md5secret':{'type':Sequelize[_0xa691('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xa691('0x1')],'defaultValue':'udp','set':function(_0x5284e3){this[_0xa691('0xa')]('transport',_0x5284e3?_0x5284e3[_0xa691('0xb')](','):null);},'get':function(){return this['getDataValue'](_0xa691('0xc'))?this[_0xa691('0xd')](_0xa691('0xc'))[_0xa691('0xe')](','):null;},'comment':_0xa691('0xf')},'dtmfmode':{'type':Sequelize['ENUM'](_0xa691('0x10'),_0xa691('0x11'),_0xa691('0x12'),_0xa691('0x13'),_0xa691('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no','nonat',_0xa691('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xa691('0x1')],'defaultValue':_0xa691('0x17'),'set':function(_0x4e5817){this[_0xa691('0xa')](_0xa691('0x18'),_0x4e5817?_0x4e5817[_0xa691('0xb')](','):null);},'get':function(){return this[_0xa691('0xd')](_0xa691('0x18'))?this[_0xa691('0xd')]('nat')[_0xa691('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa691('0x1')]},'namedcallgroup':{'type':Sequelize[_0xa691('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa691('0x1')]},'language':{'type':Sequelize[_0xa691('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa691('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa691('0x1')],'defaultValue':_0xa691('0x19')},'allow':{'type':Sequelize[_0xa691('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2fe273){this['setDataValue'](_0xa691('0x1a'),_0x2fe273?_0x2fe273[_0xa691('0xb')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xa691('0xd')](_0xa691('0x1a'))?this[_0xa691('0xd')]('allow')[_0xa691('0xe')](';'):null;},'comment':_0xa691('0x1b')},'autoframing':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x528fc7){this[_0xa691('0xa')](_0xa691('0x1c'),_0x528fc7?_0x528fc7[_0xa691('0xb')](','):null);},'get':function(){return this[_0xa691('0xd')]('insecure')?this[_0xa691('0xd')](_0xa691('0x1c'))[_0xa691('0xe')](','):null;},'comment':_0xa691('0x1d')},'trustrpid':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xa691('0x1e'))},'promiscredir':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa691('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no'),'defaultValue':_0xa691('0x15')},'busylevel':{'type':Sequelize[_0xa691('0x1f')](0xb)},'allowoverlap':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no',_0xa691('0x20')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa691('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no')},'mailbox':{'type':Sequelize[_0xa691('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0xa691('0x21'),'refuse',_0xa691('0x22'))},'session_expires':{'type':Sequelize[_0xa691('0x1f')](0xb)},'session_minse':{'type':Sequelize[_0xa691('0x1f')](0xb)},'session_refresher':{'type':Sequelize[_0xa691('0x2')]('uac',_0xa691('0x23')),'defaultValue':_0xa691('0x23')},'t38pt_usertpsource':{'type':Sequelize[_0xa691('0x1')]},'regexten':{'type':Sequelize[_0xa691('0x1')]},'fromdomain':{'type':Sequelize[_0xa691('0x1')]},'fromuser':{'type':Sequelize[_0xa691('0x1')]},'port':{'type':Sequelize[_0xa691('0x1f')](0x5)},'qualify':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no'),'defaultValue':_0xa691('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xa691('0x1')]},'defaultuser':{'type':Sequelize[_0xa691('0x1')]},'rtptimeout':{'type':Sequelize[_0xa691('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa691('0x1f')](0xb)},'sendrpid':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no',_0xa691('0x24')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa691('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xa691('0x1f')](0xb)},'timerb':{'type':Sequelize[_0xa691('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa691('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0xa691('0x1')]},'contactdeny':{'type':Sequelize[_0xa691('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xa691('0x1')]},'maxforwards':{'type':Sequelize[_0xa691('0x1f')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'force_avp':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'icesupport':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0xa691('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xa691('0x15'),'no','fingerprint',_0xa691('0x25'))},'dtlsrekey':{'type':Sequelize[_0xa691('0x1f')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa691('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xa691('0x1')]},'dtlscafile':{'type':Sequelize[_0xa691('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xa691('0x2')]('active',_0xa691('0x26'),_0xa691('0x27')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa691('0x1')]},'usereqphone':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa691('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa691('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x15'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa691('0x1')]},'host':{'type':Sequelize[_0xa691('0x1')],'defaultValue':_0xa691('0x28')},'canreinvite':{'type':Sequelize[_0xa691('0x2')]('yes','no','nonat',_0xa691('0x16'),_0xa691('0x29')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa691('0x1')]},'otherFields':{'type':Sequelize[_0xa691('0x1')]},'active':{'type':Sequelize[_0xa691('0x2a')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa691('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xda6c=['certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','ENUM','info','inband','auto','rfc2833','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint'];(function(_0x3b8b6f,_0x508f80){var _0x23c1ea=function(_0x13c821){while(--_0x13c821){_0x3b8b6f['push'](_0x3b8b6f['shift']());}};_0x23c1ea(++_0x508f80);}(_0xda6c,0x1b8));var _0xcda6=function(_0x57b70d,_0x44e343){_0x57b70d=_0x57b70d-0x0;var _0xa7c57e=_0xda6c[_0x57b70d];return _0xa7c57e;};'use strict';var Sequelize=require(_0xcda6('0x0'));module[_0xcda6('0x1')]={'name':{'type':Sequelize[_0xcda6('0x2')],'allowNull':![],'unique':_0xcda6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcda6('0x4'),_0xcda6('0x5'),_0xcda6('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcda6('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xcda6('0x8'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xcda6('0x9'),'PROHIB_PASSED_SCREEN',_0xcda6('0xa'),_0xcda6('0xb'))},'deny':{'type':Sequelize[_0xcda6('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xcda6('0x2')]},'remotesecret':{'type':Sequelize[_0xcda6('0x2')]},'transport':{'type':Sequelize[_0xcda6('0x2')],'defaultValue':_0xcda6('0xc'),'set':function(_0x305c38){this[_0xcda6('0xd')](_0xcda6('0xe'),_0x305c38?_0x305c38[_0xcda6('0xf')](','):null);},'get':function(){return this[_0xcda6('0x10')](_0xcda6('0xe'))?this['getDataValue'](_0xcda6('0xe'))[_0xcda6('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xcda6('0x12')]('rfc2833',_0xcda6('0x13'),'shortinfo',_0xcda6('0x14'),_0xcda6('0x15')),'defaultValue':_0xcda6('0x16')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xcda6('0x17'),'update',_0xcda6('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcda6('0x2')]},'directmediadeny':{'type':Sequelize[_0xcda6('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xcda6('0x1a'),'set':function(_0x11bce1){this[_0xcda6('0xd')](_0xcda6('0x1b'),_0x11bce1?_0x11bce1['join'](','):null);},'get':function(){return this[_0xcda6('0x10')](_0xcda6('0x1b'))?this[_0xcda6('0x10')]('nat')[_0xcda6('0x11')](','):null;},'comment':_0xcda6('0x1c')},'callgroup':{'type':Sequelize[_0xcda6('0x2')]},'namedcallgroup':{'type':Sequelize[_0xcda6('0x2')]},'pickupgroup':{'type':Sequelize[_0xcda6('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xcda6('0x2')]},'language':{'type':Sequelize[_0xcda6('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcda6('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcda6('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xcda6('0x2')],'allowNull':![],'defaultValue':_0xcda6('0x1d'),'set':function(_0x189c58){this['setDataValue'](_0xcda6('0x1e'),_0x189c58?_0x189c58[_0xcda6('0xf')](';'):_0xcda6('0x1d'));},'get':function(){return this[_0xcda6('0x10')]('allow')?this[_0xcda6('0x10')](_0xcda6('0x1e'))['split'](';'):null;},'comment':_0xcda6('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xcda6('0x20'),'set':function(_0x2df4c9){this['setDataValue'](_0xcda6('0x21'),_0x2df4c9?_0x2df4c9[_0xcda6('0xf')](','):null);},'get':function(){return this[_0xcda6('0x10')](_0xcda6('0x21'))?this[_0xcda6('0x10')](_0xcda6('0x21'))[_0xcda6('0x11')](','):null;},'comment':_0xcda6('0x22')},'trustrpid':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcda6('0x12')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no',_0xcda6('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no')},'accountcode':{'type':Sequelize[_0xcda6('0x24')](0xb)},'setvar':{'type':Sequelize[_0xcda6('0x2')]},'callerid':{'type':Sequelize[_0xcda6('0x2')],'defaultValue':_0xcda6('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xcda6('0x12')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xcda6('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xcda6('0x12')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xcda6('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no',_0xcda6('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcda6('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcda6('0x12')]('yes','no')},'mailbox':{'type':Sequelize[_0xcda6('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xcda6('0x27'),_0xcda6('0x28'),_0xcda6('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xcda6('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x2a'),'uas'),'defaultValue':_0xcda6('0x2b')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xcda6('0x2')]},'fromdomain':{'type':Sequelize[_0xcda6('0x2')]},'fromuser':{'type':Sequelize[_0xcda6('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xcda6('0x12')]('yes','no'),'defaultValue':_0xcda6('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xcda6('0x2')]},'rtptimeout':{'type':Sequelize[_0xcda6('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcda6('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcda6('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no',_0xcda6('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcda6('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xcda6('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xcda6('0x2')]},'contactdeny':{'type':Sequelize[_0xcda6('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xcda6('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no')},'force_avp':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xcda6('0x12')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no',_0xcda6('0x2d'),_0xcda6('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xcda6('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xcda6('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xcda6('0x2')]},'dtlscipher':{'type':Sequelize[_0xcda6('0x2')]},'dtlscafile':{'type':Sequelize[_0xcda6('0x2')]},'dtlscapath':{'type':Sequelize[_0xcda6('0x2')]},'dtlssetup':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x2f'),_0xcda6('0x30'),_0xcda6('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xcda6('0x2')]},'call_limit':{'type':Sequelize[_0xcda6('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xcda6('0x19'),'no')},'vmexten':{'type':Sequelize[_0xcda6('0x2')]},'mohinterpret':{'type':Sequelize[_0xcda6('0x2')]},'mohsuggest':{'type':Sequelize[_0xcda6('0x2')]},'parkinglot':{'type':Sequelize[_0xcda6('0x2')]},'description':{'type':Sequelize[_0xcda6('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xcda6('0x32')},'canreinvite':{'type':Sequelize[_0xcda6('0x12')](_0xcda6('0x19'),'no',_0xcda6('0x17'),_0xcda6('0x33'),_0xcda6('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xcda6('0x2')]},'active':{'type':Sequelize[_0xcda6('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcda6('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 31fd369..a25f492 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 _0xa24f=['/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','get','Trunks','UserProfileResource','destroy','stack','name','send','index','rawAttributes','key','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','Trunk','include','findAll','rows','params','keys','length','includeAll','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry'];(function(_0x3684a4,_0x147876){var _0x2b1ae8=function(_0x41bc3d){while(--_0x41bc3d){_0x3684a4['push'](_0x3684a4['shift']());}};_0x2b1ae8(++_0x147876);}(_0xa24f,0x1d5));var _0xfa24=function(_0x107df9,_0x4d1825){_0x107df9=_0x107df9-0x0;var _0x2df84a=_0xa24f[_0x107df9];return _0x2df84a;};'use strict';var pdf=require(_0xfa24('0x0'));var emlformat=require(_0xfa24('0x1'));var rimraf=require(_0xfa24('0x2'));var zipdir=require(_0xfa24('0x3'));var jsonpatch=require(_0xfa24('0x4'));var rp=require('request-promise');var moment=require(_0xfa24('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfa24('0x6'));var path=require(_0xfa24('0x7'));var sox=require(_0xfa24('0x8'));var csv=require(_0xfa24('0x9'));var ejs=require(_0xfa24('0xa'));var fs=require('fs');var _=require(_0xfa24('0xb'));var squel=require(_0xfa24('0xc'));var crypto=require('crypto');var jsforce=require(_0xfa24('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfa24('0x9'));var querystring=require(_0xfa24('0xe'));var Papa=require(_0xfa24('0xf'));var Redis=require(_0xfa24('0x10'));var authService=require(_0xfa24('0x11'));var qs=require(_0xfa24('0x12'));var as=require(_0xfa24('0x13'));var hardwareService=require(_0xfa24('0x14'));var logger=require(_0xfa24('0x15'))('api');var utils=require(_0xfa24('0x16'));var config=require(_0xfa24('0x17'));var licenseUtil=require(_0xfa24('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfa24('0x19'));var client=jayson[_0xfa24('0x1a')][_0xfa24('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b7f6e,_0xb1ccd7,_0x177a96,_0x1489f2){return new BPromise(function(_0x324a32,_0x4c67a4){var _0x55ab9f=_0x1489f2||client;return _0x55ab9f[_0xfa24('0x1c')](_0x2b7f6e,_0x177a96)[_0xfa24('0x1d')](function(_0x5074b4){logger[_0xfa24('0x1e')](_0xfa24('0x1f'),_0xb1ccd7,_0xfa24('0x20'));logger[_0xfa24('0x21')](_0xfa24('0x22'),_0xb1ccd7,_0xfa24('0x20'),JSON[_0xfa24('0x23')](_0x5074b4));if(_0x5074b4[_0xfa24('0x24')]){if(_0x5074b4[_0xfa24('0x24')][_0xfa24('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0xb1ccd7,_0x5074b4['error'][_0xfa24('0x26')]);return _0x4c67a4(_0x5074b4[_0xfa24('0x24')]['message']);}logger[_0xfa24('0x24')](_0xfa24('0x1f'),_0xb1ccd7,_0x5074b4['error'][_0xfa24('0x26')]);return _0x324a32(_0x5074b4[_0xfa24('0x24')][_0xfa24('0x26')]);}else{logger[_0xfa24('0x1e')](_0xfa24('0x1f'),_0xb1ccd7,_0xfa24('0x20'));_0x324a32(_0x5074b4[_0xfa24('0x27')][_0xfa24('0x26')]);}})[_0xfa24('0x28')](function(_0x474a08){logger[_0xfa24('0x24')](_0xfa24('0x1f'),_0xb1ccd7,_0x474a08);_0x4c67a4(_0x474a08);});});}function respondWithStatusCode(_0x3859b9,_0xd5eed7){_0xd5eed7=_0xd5eed7||0xcc;return function(_0x1f65ab){if(_0x1f65ab){return _0x3859b9[_0xfa24('0x29')](_0xd5eed7);}return _0x3859b9[_0xfa24('0x2a')](_0xd5eed7)[_0xfa24('0x2b')]();};}function respondWithResult(_0x5cddc6,_0x3435fd){_0x3435fd=_0x3435fd||0xc8;return function(_0x43956d){if(_0x43956d){return _0x5cddc6[_0xfa24('0x2a')](_0x3435fd)[_0xfa24('0x2c')](_0x43956d);}};}function respondWithFilteredResult(_0x35efcb,_0x582ad2){return function(_0x33f697){if(_0x33f697){var _0x12af8b=_0x33f697[_0xfa24('0x2d')],_0x1b15d0=_0x582ad2[_0xfa24('0x2e')],_0x4cd043=_0x582ad2[_0xfa24('0x2e')]+_0x582ad2['limit'],_0x3c54bf;if(_0x4cd043>=_0x12af8b){_0x4cd043=_0x12af8b;_0x3c54bf=0xc8;}else{_0x3c54bf=0xce;}_0x35efcb[_0xfa24('0x2a')](_0x3c54bf);return _0x35efcb[_0xfa24('0x2f')](_0xfa24('0x30'),_0x1b15d0+'-'+_0x4cd043+'/'+_0x12af8b)[_0xfa24('0x2c')](_0x33f697);}return null;};}function patchUpdates(_0x5636c3){return function(_0x5c90df){try{jsonpatch[_0xfa24('0x31')](_0x5c90df,_0x5636c3,!![]);}catch(_0x1c3f32){return BPromise[_0xfa24('0x32')](_0x1c3f32);}return _0x5c90df[_0xfa24('0x33')]();};}function saveUpdates(_0x162396,_0x598c4d){return function(_0x33702c){if(_0x33702c){return _0x33702c['update'](_0x162396)[_0xfa24('0x1d')](function(_0xd0fb8c){return _0xd0fb8c;});}return null;};}function removeEntity(_0x32deaa,_0x2a09a8){return function(_0x1c5975){if(_0x1c5975){return _0x1c5975['destroy']()['then'](function(){var _0x104ed5=_0x1c5975[_0xfa24('0x34')]({'plain':!![]});var _0x12a3e3=_0xfa24('0x35');return db[_0xfa24('0x36')][_0xfa24('0x37')]({'where':{'type':_0x12a3e3,'resourceId':_0x104ed5['id']}})[_0xfa24('0x1d')](function(){return _0x1c5975;});})[_0xfa24('0x1d')](function(){_0x32deaa[_0xfa24('0x2a')](0xcc)[_0xfa24('0x2b')]();});}};}function handleEntityNotFound(_0x5e3c80,_0x2ac31f){return function(_0x2858d4){if(!_0x2858d4){_0x5e3c80['sendStatus'](0x194);}return _0x2858d4;};}function handleError(_0x1591a5,_0x74e5e4){_0x74e5e4=_0x74e5e4||0x1f4;return function(_0xdda8ea){logger[_0xfa24('0x24')](_0xdda8ea[_0xfa24('0x38')]);if(_0xdda8ea[_0xfa24('0x39')]){delete _0xdda8ea[_0xfa24('0x39')];}_0x1591a5[_0xfa24('0x2a')](_0x74e5e4)[_0xfa24('0x3a')](_0xdda8ea);};}exports[_0xfa24('0x3b')]=function(_0x5d816a,_0x376c46){var _0x44d4aa={},_0x4e3b72={},_0x596031={'count':0x0,'rows':[]};var _0xda8594=_['map'](db['Trunk'][_0xfa24('0x3c')],function(_0x392c33){return{'name':_0x392c33['fieldName'],'type':_0x392c33['type'][_0xfa24('0x3d')]};});_0x4e3b72[_0xfa24('0x3e')]=_['map'](_0xda8594,_0xfa24('0x39'));_0x4e3b72[_0xfa24('0x3f')]=_['keys'](_0x5d816a[_0xfa24('0x3f')]);_0x4e3b72[_0xfa24('0x40')]=_[_0xfa24('0x41')](_0x4e3b72[_0xfa24('0x3e')],_0x4e3b72[_0xfa24('0x3f')]);_0x44d4aa[_0xfa24('0x42')]=_['intersection'](_0x4e3b72[_0xfa24('0x3e')],qs[_0xfa24('0x43')](_0x5d816a[_0xfa24('0x3f')][_0xfa24('0x43')]));_0x44d4aa['attributes']=_0x44d4aa['attributes']['length']?_0x44d4aa[_0xfa24('0x42')]:_0x4e3b72[_0xfa24('0x3e')];if(!_0x5d816a[_0xfa24('0x3f')]['hasOwnProperty'](_0xfa24('0x44'))){_0x44d4aa['limit']=qs[_0xfa24('0x45')](_0x5d816a[_0xfa24('0x3f')]['limit']);_0x44d4aa[_0xfa24('0x2e')]=qs[_0xfa24('0x2e')](_0x5d816a[_0xfa24('0x3f')]['offset']);}_0x44d4aa[_0xfa24('0x46')]=qs[_0xfa24('0x47')](_0x5d816a['query'][_0xfa24('0x47')]);_0x44d4aa[_0xfa24('0x48')]=qs[_0xfa24('0x40')](_[_0xfa24('0x49')](_0x5d816a[_0xfa24('0x3f')],_0x4e3b72[_0xfa24('0x40')]),_0xda8594);if(_0x5d816a['query'][_0xfa24('0x4a')]){_0x44d4aa[_0xfa24('0x48')]=_[_0xfa24('0x4b')](_0x44d4aa['where'],{'$or':_[_0xfa24('0x4c')](_0xda8594,function(_0x3f54c8){if(_0x3f54c8[_0xfa24('0x4d')]!==_0xfa24('0x4e')){var _0x14b272={};_0x14b272[_0x3f54c8[_0xfa24('0x39')]]={'$like':'%'+_0x5d816a[_0xfa24('0x3f')]['filter']+'%'};return _0x14b272;}})});}_0x44d4aa=_[_0xfa24('0x4b')]({},_0x44d4aa,_0x5d816a[_0xfa24('0x4f')]);var _0x49c371={'where':_0x44d4aa[_0xfa24('0x48')]};return db[_0xfa24('0x50')]['count'](_0x49c371)[_0xfa24('0x1d')](function(_0x5ddf51){_0x596031[_0xfa24('0x2d')]=_0x5ddf51;if(_0x5d816a[_0xfa24('0x3f')]['includeAll']){_0x44d4aa[_0xfa24('0x51')]=[{'all':!![]}];}return db[_0xfa24('0x50')][_0xfa24('0x52')](_0x44d4aa);})['then'](function(_0x2528f5){_0x596031[_0xfa24('0x53')]=_0x2528f5;return _0x596031;})[_0xfa24('0x1d')](respondWithFilteredResult(_0x376c46,_0x44d4aa))[_0xfa24('0x28')](handleError(_0x376c46,null));};exports['show']=function(_0x404b52,_0x273816){var _0x2d3a11={'raw':![],'where':{'id':_0x404b52[_0xfa24('0x54')]['id']}},_0x15ab70={};_0x15ab70[_0xfa24('0x3e')]=_[_0xfa24('0x55')](db[_0xfa24('0x50')][_0xfa24('0x3c')]);_0x15ab70[_0xfa24('0x3f')]=_['keys'](_0x404b52[_0xfa24('0x3f')]);_0x15ab70['filters']=_['intersection'](_0x15ab70[_0xfa24('0x3e')],_0x15ab70['query']);_0x2d3a11['attributes']=_[_0xfa24('0x41')](_0x15ab70['model'],qs[_0xfa24('0x43')](_0x404b52['query'][_0xfa24('0x43')]));_0x2d3a11[_0xfa24('0x42')]=_0x2d3a11[_0xfa24('0x42')][_0xfa24('0x56')]?_0x2d3a11[_0xfa24('0x42')]:_0x15ab70['model'];if(_0x404b52[_0xfa24('0x3f')][_0xfa24('0x57')]){_0x2d3a11[_0xfa24('0x51')]=[{'all':!![]}];}_0x2d3a11=_[_0xfa24('0x4b')]({},_0x2d3a11,_0x404b52[_0xfa24('0x4f')]);return db['Trunk'][_0xfa24('0x58')](_0x2d3a11)['then'](handleEntityNotFound(_0x273816,null))[_0xfa24('0x1d')](respondWithResult(_0x273816,null))[_0xfa24('0x28')](handleError(_0x273816,null));};exports[_0xfa24('0x59')]=function(_0x179475,_0x27d9f6){var _0x47441b={'where':{'id':_0x179475['params']['id']}},_0x6ac4db={};_0x6ac4db[_0xfa24('0x3e')]=_['keys'](db[_0xfa24('0x50')][_0xfa24('0x3c')]);_0x47441b['attributes']=_['intersection'](_0x6ac4db[_0xfa24('0x3e')],qs[_0xfa24('0x43')](_0x179475[_0xfa24('0x3f')][_0xfa24('0x43')]));_0x47441b[_0xfa24('0x42')]=_0x47441b[_0xfa24('0x42')][_0xfa24('0x56')]?_0x47441b[_0xfa24('0x42')]:_0x6ac4db[_0xfa24('0x3e')];if(_0x179475[_0xfa24('0x3f')]['includeAll']){_0x47441b[_0xfa24('0x51')]=[{'all':!![]}];}_0x47441b=_[_0xfa24('0x4b')]({},_0x47441b,_0x179475['options']);return db[_0xfa24('0x50')]['find'](_0x47441b)[_0xfa24('0x1d')](handleEntityNotFound(_0x27d9f6,null))[_0xfa24('0x1d')](function(_0x58d717){if(_0x58d717){var _0x52510f=_0x58d717[_0xfa24('0x34')]({'plain':!![]});_0x52510f=qs[_0xfa24('0x5a')](_0x52510f,['id','createdAt',_0xfa24('0x5b')]);_0x179475[_0xfa24('0x5c')]=_[_0xfa24('0x5a')](_0x179475[_0xfa24('0x5c')],['id',_0xfa24('0x5d'),'updatedAt']);return db[_0xfa24('0x50')]['create'](_['merge'](_0x52510f,_0x179475[_0xfa24('0x5c')]),{'include':_0x179475['query'][_0xfa24('0x57')]?[{'all':!![]}]:undefined})[_0xfa24('0x1d')](function(_0x11af68){var _0x513b81=_0x179475[_0xfa24('0x5e')]['get']({'plain':!![]});if(!_0x513b81)throw new Error(_0xfa24('0x5f'));if(_0x513b81[_0xfa24('0x60')]==='user'){var _0x298fde=_0x11af68[_0xfa24('0x34')]({'plain':!![]});var _0x3edcfc='Trunks';return db[_0xfa24('0x61')][_0xfa24('0x58')]({'where':{'name':_0x3edcfc,'userProfileId':_0x513b81[_0xfa24('0x62')]},'raw':!![]})['then'](function(_0x3c555e){if(_0x3c555e&&_0x3c555e[_0xfa24('0x63')]===0x0){return db[_0xfa24('0x36')][_0xfa24('0x64')]({'name':_0x298fde['name'],'resourceId':_0x298fde['id'],'type':_0x3c555e[_0xfa24('0x39')],'sectionId':_0x3c555e['id']},{})[_0xfa24('0x1d')](function(){return _0x11af68;});}else{return _0x11af68;}})[_0xfa24('0x28')](function(_0x404178){logger[_0xfa24('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x404178);throw _0x404178;});}return _0x11af68;});}})[_0xfa24('0x1d')](respondWithResult(_0x27d9f6,0xc9))[_0xfa24('0x28')](handleError(_0x27d9f6,null));};exports[_0xfa24('0x64')]=function(_0x3b98e7,_0x33c2ca,_0x2a8b00){var _0x3f787e;return db[_0xfa24('0x50')][_0xfa24('0x64')](_0x3b98e7[_0xfa24('0x5c')],{'raw':!![]})[_0xfa24('0x1d')](function(_0x5e2fb5){_0x3f787e=_0x5e2fb5;return db[_0xfa24('0x50')][_0xfa24('0x52')]({'raw':!![]});})[_0xfa24('0x1d')](function(_0x30592e){var _0x5b298d=fs['readFileSync'](path[_0xfa24('0x65')](config['root'],_0xfa24('0x66')),_0xfa24('0x67'));var _0x33bd95=fs[_0xfa24('0x68')](path['join'](config[_0xfa24('0x69')],_0xfa24('0x6a')),_0xfa24('0x67'));var _0x3a8e6e=ejs[_0xfa24('0x6b')](_0x5b298d,{'trunks':_0x30592e||[]});fs[_0xfa24('0x6c')](_0xfa24('0x6d'),_0x3a8e6e);if(_0x3f787e[_0xfa24('0x6e')]){var _0x61518a=ejs[_0xfa24('0x6b')](_0x33bd95,{'trunks':_0x30592e||[]});fs[_0xfa24('0x6c')](_0xfa24('0x6f'),_0x61518a);}})['then'](function(){return respondWithRpcPromise(_0xfa24('0x70'),_0xfa24('0x64'),{'module':_0xfa24('0x71')});})[_0xfa24('0x1d')](function(){var _0x597bef=_0x3b98e7[_0xfa24('0x5e')]['get']({'plain':!![]});if(!_0x597bef)throw new Error(_0xfa24('0x5f'));if(_0x597bef[_0xfa24('0x60')]===_0xfa24('0x5e')){var _0x2dc893=_0x3f787e[_0xfa24('0x34')]({'plain':!![]});return db['UserProfileSection'][_0xfa24('0x58')]({'where':{'name':_0xfa24('0x35'),'userProfileId':_0x597bef[_0xfa24('0x62')]},'raw':!![]})[_0xfa24('0x1d')](function(_0x33220a){if(_0x33220a&&_0x33220a[_0xfa24('0x63')]===0x0){return db[_0xfa24('0x36')][_0xfa24('0x64')]({'name':_0x2dc893['name'],'resourceId':_0x2dc893['id'],'type':_0x33220a['name'],'sectionId':_0x33220a['id']},{})[_0xfa24('0x1d')](function(){return _0x3f787e;});}else{return _0x3f787e;}})[_0xfa24('0x28')](function(_0x133d70){logger['error'](_0xfa24('0x72'),_0x133d70);throw _0x133d70;});}return _0x3f787e;})[_0xfa24('0x1d')](respondWithResult(_0x33c2ca,0xc9))[_0xfa24('0x28')](handleError(_0x33c2ca,null));};exports[_0xfa24('0x73')]=function(_0x275d36,_0x5733ea,_0x4c80b2){var _0x4b066c;return db[_0xfa24('0x50')][_0xfa24('0x58')]({'where':{'id':_0x275d36[_0xfa24('0x54')]['id']}})[_0xfa24('0x1d')](handleEntityNotFound(_0x5733ea,null))[_0xfa24('0x1d')](saveUpdates(_0x275d36[_0xfa24('0x5c')],null))[_0xfa24('0x1d')](function(_0x2c0850){if(_0x2c0850){_0x4b066c=_0x2c0850;return db[_0xfa24('0x50')][_0xfa24('0x52')]({'raw':!![]});}})[_0xfa24('0x1d')](function(_0x1c82e0){if(_0x1c82e0){var _0x52f9c8=fs[_0xfa24('0x68')](path[_0xfa24('0x65')](config[_0xfa24('0x69')],_0xfa24('0x66')),_0xfa24('0x67'));var _0x36b6e1=fs[_0xfa24('0x68')](path['join'](config[_0xfa24('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0x10d478=ejs[_0xfa24('0x6b')](_0x52f9c8,{'trunks':_0x1c82e0||[]});fs[_0xfa24('0x6c')](_0xfa24('0x6d'),_0x10d478);var _0xaafa8b=ejs[_0xfa24('0x6b')](_0x36b6e1,{'trunks':_0x1c82e0||[]});fs[_0xfa24('0x6c')](_0xfa24('0x6f'),_0xaafa8b);return respondWithRpcPromise(_0xfa24('0x70'),_0xfa24('0x73'),{'module':_0xfa24('0x71')});}return null;})[_0xfa24('0x1d')](function(_0x19522c){if(_0x19522c){return _0x4b066c;}})[_0xfa24('0x1d')](respondWithResult(_0x5733ea,null))[_0xfa24('0x28')](handleError(_0x5733ea,null));};exports[_0xfa24('0x37')]=function(_0x1d4a78,_0xc3382b,_0x5bf034){var _0x3d4a9f;return db[_0xfa24('0x50')]['find']({'where':{'id':_0x1d4a78[_0xfa24('0x54')]['id']}})[_0xfa24('0x1d')](handleEntityNotFound(_0xc3382b,null))['then'](removeEntity(_0xc3382b,null))['then'](function(){return db[_0xfa24('0x50')][_0xfa24('0x52')]({'raw':!![]});})[_0xfa24('0x1d')](function(_0xdb24d3){var _0x228635=fs['readFileSync'](path['join'](config[_0xfa24('0x69')],_0xfa24('0x66')),_0xfa24('0x67'));var _0x4edd87=fs[_0xfa24('0x68')](path[_0xfa24('0x65')](config[_0xfa24('0x69')],_0xfa24('0x6a')),_0xfa24('0x67'));var _0x24e783=ejs[_0xfa24('0x6b')](_0x228635,{'trunks':_0xdb24d3});var _0x40db90=ejs['render'](_0x4edd87,{'trunks':_0xdb24d3});fs[_0xfa24('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x24e783);fs[_0xfa24('0x6c')](_0xfa24('0x6f'),_0x40db90);return respondWithRpcPromise(_0xfa24('0x70'),_0xfa24('0x37'),{'module':_0xfa24('0x71')});})['catch'](handleError(_0xc3382b,null));}; \ No newline at end of file +var _0x39f4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Trunks','UserProfileResource','end','stack','send','index','map','Trunk','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring'];(function(_0xc0af3,_0x7f5baf){var _0x1a3f58=function(_0x23782d){while(--_0x23782d){_0xc0af3['push'](_0xc0af3['shift']());}};_0x1a3f58(++_0x7f5baf);}(_0x39f4,0x133));var _0x439f=function(_0x34fc4c,_0x3b2575){_0x34fc4c=_0x34fc4c-0x0;var _0x42aa15=_0x39f4[_0x34fc4c];return _0x42aa15;};'use strict';var pdf=require(_0x439f('0x0'));var emlformat=require(_0x439f('0x1'));var rimraf=require(_0x439f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x439f('0x3'));var rp=require(_0x439f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x439f('0x5'));var util=require(_0x439f('0x6'));var path=require(_0x439f('0x7'));var sox=require('sox');var csv=require(_0x439f('0x8'));var ejs=require(_0x439f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x439f('0xa'));var crypto=require(_0x439f('0xb'));var jsforce=require(_0x439f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x439f('0x8'));var querystring=require(_0x439f('0xd'));var Papa=require('papaparse');var Redis=require(_0x439f('0xe'));var authService=require(_0x439f('0xf'));var qs=require(_0x439f('0x10'));var as=require(_0x439f('0x11'));var hardwareService=require(_0x439f('0x12'));var logger=require('../../config/logger')(_0x439f('0x13'));var utils=require(_0x439f('0x14'));var config=require(_0x439f('0x15'));var licenseUtil=require(_0x439f('0x16'));var db=require(_0x439f('0x17'))['db'];var jayson=require(_0x439f('0x18'));var client=jayson['client'][_0x439f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x34da97,_0x4fc15b,_0x3303bd,_0x10d4d6){return new BPromise(function(_0x4ccb7f,_0x255ae3){var _0x479662=_0x10d4d6||client;return _0x479662[_0x439f('0x1a')](_0x34da97,_0x3303bd)['then'](function(_0x477f95){logger[_0x439f('0x1b')](_0x439f('0x1c'),_0x4fc15b,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x4fc15b,'request\x20sent',JSON['stringify'](_0x477f95));if(_0x477f95[_0x439f('0x1d')]){if(_0x477f95['error'][_0x439f('0x1e')]===0x1f4){logger['error'](_0x439f('0x1c'),_0x4fc15b,_0x477f95['error'][_0x439f('0x1f')]);return _0x255ae3(_0x477f95[_0x439f('0x1d')][_0x439f('0x1f')]);}logger[_0x439f('0x1d')](_0x439f('0x1c'),_0x4fc15b,_0x477f95['error'][_0x439f('0x1f')]);return _0x4ccb7f(_0x477f95[_0x439f('0x1d')][_0x439f('0x1f')]);}else{logger[_0x439f('0x1b')](_0x439f('0x1c'),_0x4fc15b,'request\x20sent');_0x4ccb7f(_0x477f95[_0x439f('0x20')][_0x439f('0x1f')]);}})[_0x439f('0x21')](function(_0x1b84cb){logger[_0x439f('0x1d')](_0x439f('0x1c'),_0x4fc15b,_0x1b84cb);_0x255ae3(_0x1b84cb);});});}function respondWithStatusCode(_0x38afcf,_0x3e1437){_0x3e1437=_0x3e1437||0xcc;return function(_0x9a0c46){if(_0x9a0c46){return _0x38afcf[_0x439f('0x22')](_0x3e1437);}return _0x38afcf[_0x439f('0x23')](_0x3e1437)['end']();};}function respondWithResult(_0x3e519a,_0x23dbbc){_0x23dbbc=_0x23dbbc||0xc8;return function(_0x28d048){if(_0x28d048){return _0x3e519a[_0x439f('0x23')](_0x23dbbc)[_0x439f('0x24')](_0x28d048);}};}function respondWithFilteredResult(_0x5742b,_0x453a96){return function(_0x17802c){if(_0x17802c){var _0x4b35d3=_0x17802c[_0x439f('0x25')],_0x3c2d70=_0x453a96[_0x439f('0x26')],_0x38195a=_0x453a96[_0x439f('0x26')]+_0x453a96[_0x439f('0x27')],_0x3480a7;if(_0x38195a>=_0x4b35d3){_0x38195a=_0x4b35d3;_0x3480a7=0xc8;}else{_0x3480a7=0xce;}_0x5742b[_0x439f('0x23')](_0x3480a7);return _0x5742b['set'](_0x439f('0x28'),_0x3c2d70+'-'+_0x38195a+'/'+_0x4b35d3)[_0x439f('0x24')](_0x17802c);}return null;};}function patchUpdates(_0x4f8aea){return function(_0x2be87a){try{jsonpatch[_0x439f('0x29')](_0x2be87a,_0x4f8aea,!![]);}catch(_0x55fa55){return BPromise[_0x439f('0x2a')](_0x55fa55);}return _0x2be87a[_0x439f('0x2b')]();};}function saveUpdates(_0x16ca70,_0x8ce3a8){return function(_0x442f48){if(_0x442f48){return _0x442f48[_0x439f('0x2c')](_0x16ca70)[_0x439f('0x2d')](function(_0x5c4f3e){return _0x5c4f3e;});}return null;};}function removeEntity(_0x23b659,_0x46e7e2){return function(_0x2d4222){if(_0x2d4222){return _0x2d4222[_0x439f('0x2e')]()[_0x439f('0x2d')](function(){var _0xdb107d=_0x2d4222[_0x439f('0x2f')]({'plain':!![]});var _0x176438=_0x439f('0x30');return db[_0x439f('0x31')]['destroy']({'where':{'type':_0x176438,'resourceId':_0xdb107d['id']}})[_0x439f('0x2d')](function(){return _0x2d4222;});})[_0x439f('0x2d')](function(){_0x23b659['status'](0xcc)[_0x439f('0x32')]();});}};}function handleEntityNotFound(_0x13e20b,_0x3214ad){return function(_0x5dc559){if(!_0x5dc559){_0x13e20b[_0x439f('0x22')](0x194);}return _0x5dc559;};}function handleError(_0xb5a7b6,_0x1a5182){_0x1a5182=_0x1a5182||0x1f4;return function(_0x297ab5){logger[_0x439f('0x1d')](_0x297ab5[_0x439f('0x33')]);if(_0x297ab5['name']){delete _0x297ab5['name'];}_0xb5a7b6[_0x439f('0x23')](_0x1a5182)[_0x439f('0x34')](_0x297ab5);};}exports[_0x439f('0x35')]=function(_0x3f632f,_0x1ddb3d){var _0x2ae6e8={},_0x2d9ca0={},_0xcd8364={'count':0x0,'rows':[]};var _0x1e52db=_[_0x439f('0x36')](db[_0x439f('0x37')][_0x439f('0x38')],function(_0x46faf1){return{'name':_0x46faf1[_0x439f('0x39')],'type':_0x46faf1[_0x439f('0x3a')]['key']};});_0x2d9ca0[_0x439f('0x3b')]=_[_0x439f('0x36')](_0x1e52db,_0x439f('0x3c'));_0x2d9ca0[_0x439f('0x3d')]=_[_0x439f('0x3e')](_0x3f632f[_0x439f('0x3d')]);_0x2d9ca0[_0x439f('0x3f')]=_['intersection'](_0x2d9ca0[_0x439f('0x3b')],_0x2d9ca0[_0x439f('0x3d')]);_0x2ae6e8[_0x439f('0x40')]=_[_0x439f('0x41')](_0x2d9ca0[_0x439f('0x3b')],qs[_0x439f('0x42')](_0x3f632f[_0x439f('0x3d')][_0x439f('0x42')]));_0x2ae6e8[_0x439f('0x40')]=_0x2ae6e8['attributes']['length']?_0x2ae6e8[_0x439f('0x40')]:_0x2d9ca0[_0x439f('0x3b')];if(!_0x3f632f[_0x439f('0x3d')][_0x439f('0x43')](_0x439f('0x44'))){_0x2ae6e8[_0x439f('0x27')]=qs[_0x439f('0x27')](_0x3f632f[_0x439f('0x3d')][_0x439f('0x27')]);_0x2ae6e8['offset']=qs['offset'](_0x3f632f[_0x439f('0x3d')][_0x439f('0x26')]);}_0x2ae6e8[_0x439f('0x45')]=qs['sort'](_0x3f632f[_0x439f('0x3d')][_0x439f('0x46')]);_0x2ae6e8[_0x439f('0x47')]=qs['filters'](_['pick'](_0x3f632f['query'],_0x2d9ca0[_0x439f('0x3f')]),_0x1e52db);if(_0x3f632f[_0x439f('0x3d')][_0x439f('0x48')]){_0x2ae6e8[_0x439f('0x47')]=_[_0x439f('0x49')](_0x2ae6e8[_0x439f('0x47')],{'$or':_[_0x439f('0x36')](_0x1e52db,function(_0x393dc1){if(_0x393dc1[_0x439f('0x3a')]!==_0x439f('0x4a')){var _0xd42081={};_0xd42081[_0x393dc1[_0x439f('0x3c')]]={'$like':'%'+_0x3f632f[_0x439f('0x3d')]['filter']+'%'};return _0xd42081;}})});}_0x2ae6e8=_['merge']({},_0x2ae6e8,_0x3f632f[_0x439f('0x4b')]);var _0x7c4ab9={'where':_0x2ae6e8[_0x439f('0x47')]};return db[_0x439f('0x37')][_0x439f('0x25')](_0x7c4ab9)[_0x439f('0x2d')](function(_0x48cde8){_0xcd8364[_0x439f('0x25')]=_0x48cde8;if(_0x3f632f[_0x439f('0x3d')][_0x439f('0x4c')]){_0x2ae6e8[_0x439f('0x4d')]=[{'all':!![]}];}return db['Trunk'][_0x439f('0x4e')](_0x2ae6e8);})[_0x439f('0x2d')](function(_0x197019){_0xcd8364['rows']=_0x197019;return _0xcd8364;})[_0x439f('0x2d')](respondWithFilteredResult(_0x1ddb3d,_0x2ae6e8))[_0x439f('0x21')](handleError(_0x1ddb3d,null));};exports['show']=function(_0xcfadc,_0x10281a){var _0x4000c9={'raw':![],'where':{'id':_0xcfadc[_0x439f('0x4f')]['id']}},_0x2243bc={};_0x2243bc[_0x439f('0x3b')]=_[_0x439f('0x3e')](db['Trunk'][_0x439f('0x38')]);_0x2243bc['query']=_[_0x439f('0x3e')](_0xcfadc[_0x439f('0x3d')]);_0x2243bc['filters']=_[_0x439f('0x41')](_0x2243bc[_0x439f('0x3b')],_0x2243bc[_0x439f('0x3d')]);_0x4000c9[_0x439f('0x40')]=_['intersection'](_0x2243bc[_0x439f('0x3b')],qs[_0x439f('0x42')](_0xcfadc[_0x439f('0x3d')][_0x439f('0x42')]));_0x4000c9[_0x439f('0x40')]=_0x4000c9[_0x439f('0x40')][_0x439f('0x50')]?_0x4000c9['attributes']:_0x2243bc[_0x439f('0x3b')];if(_0xcfadc['query'][_0x439f('0x4c')]){_0x4000c9['include']=[{'all':!![]}];}_0x4000c9=_[_0x439f('0x49')]({},_0x4000c9,_0xcfadc[_0x439f('0x4b')]);return db['Trunk'][_0x439f('0x51')](_0x4000c9)[_0x439f('0x2d')](handleEntityNotFound(_0x10281a,null))[_0x439f('0x2d')](respondWithResult(_0x10281a,null))[_0x439f('0x21')](handleError(_0x10281a,null));};exports[_0x439f('0x52')]=function(_0x18d2ec,_0x524660){var _0x2af1f2={'where':{'id':_0x18d2ec['params']['id']}},_0x3fed9d={};_0x3fed9d[_0x439f('0x3b')]=_[_0x439f('0x3e')](db['Trunk'][_0x439f('0x38')]);_0x2af1f2[_0x439f('0x40')]=_[_0x439f('0x41')](_0x3fed9d[_0x439f('0x3b')],qs[_0x439f('0x42')](_0x18d2ec[_0x439f('0x3d')][_0x439f('0x42')]));_0x2af1f2['attributes']=_0x2af1f2[_0x439f('0x40')]['length']?_0x2af1f2[_0x439f('0x40')]:_0x3fed9d[_0x439f('0x3b')];if(_0x18d2ec['query']['includeAll']){_0x2af1f2[_0x439f('0x4d')]=[{'all':!![]}];}_0x2af1f2=_['merge']({},_0x2af1f2,_0x18d2ec[_0x439f('0x4b')]);return db[_0x439f('0x37')]['find'](_0x2af1f2)[_0x439f('0x2d')](handleEntityNotFound(_0x524660,null))[_0x439f('0x2d')](function(_0x337877){if(_0x337877){var _0xd37a8f=_0x337877['get']({'plain':!![]});_0xd37a8f=qs[_0x439f('0x53')](_0xd37a8f,['id',_0x439f('0x54'),_0x439f('0x55')]);_0x18d2ec[_0x439f('0x56')]=_[_0x439f('0x53')](_0x18d2ec[_0x439f('0x56')],['id','createdAt',_0x439f('0x55')]);return db[_0x439f('0x37')][_0x439f('0x57')](_[_0x439f('0x49')](_0xd37a8f,_0x18d2ec[_0x439f('0x56')]),{'include':_0x18d2ec[_0x439f('0x3d')][_0x439f('0x4c')]?[{'all':!![]}]:undefined})[_0x439f('0x2d')](function(_0x11fd80){var _0x26493b=_0x18d2ec[_0x439f('0x58')]['get']({'plain':!![]});if(!_0x26493b)throw new Error(_0x439f('0x59'));if(_0x26493b[_0x439f('0x5a')]==='user'){var _0xb621e7=_0x11fd80[_0x439f('0x2f')]({'plain':!![]});var _0x5b318d=_0x439f('0x30');return db[_0x439f('0x5b')][_0x439f('0x51')]({'where':{'name':_0x5b318d,'userProfileId':_0x26493b[_0x439f('0x5c')]},'raw':!![]})[_0x439f('0x2d')](function(_0x356471){if(_0x356471&&_0x356471[_0x439f('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0xb621e7[_0x439f('0x3c')],'resourceId':_0xb621e7['id'],'type':_0x356471[_0x439f('0x3c')],'sectionId':_0x356471['id']},{})['then'](function(){return _0x11fd80;});}else{return _0x11fd80;}})[_0x439f('0x21')](function(_0x26a464){logger[_0x439f('0x1d')](_0x439f('0x5e'),_0x26a464);throw _0x26a464;});}return _0x11fd80;});}})[_0x439f('0x2d')](respondWithResult(_0x524660,0xc9))[_0x439f('0x21')](handleError(_0x524660,null));};exports[_0x439f('0x57')]=function(_0x5a7714,_0x307c08,_0x3af47d){var _0x1405d1;return db[_0x439f('0x37')]['create'](_0x5a7714[_0x439f('0x56')],{'raw':!![]})[_0x439f('0x2d')](function(_0x1c0005){_0x1405d1=_0x1c0005;return db[_0x439f('0x37')][_0x439f('0x4e')]({'raw':!![]});})[_0x439f('0x2d')](function(_0x1fe6b7){var _0x117e8e=fs[_0x439f('0x5f')](path[_0x439f('0x60')](config['root'],_0x439f('0x61')),_0x439f('0x62'));var _0x21b789=fs[_0x439f('0x5f')](path['join'](config[_0x439f('0x63')],_0x439f('0x64')),'utf8');var _0x411ea7=ejs[_0x439f('0x65')](_0x117e8e,{'trunks':_0x1fe6b7||[]});fs[_0x439f('0x66')](_0x439f('0x67'),_0x411ea7);if(_0x1405d1[_0x439f('0x68')]){var _0x5742af=ejs[_0x439f('0x65')](_0x21b789,{'trunks':_0x1fe6b7||[]});fs[_0x439f('0x66')](_0x439f('0x69'),_0x5742af);}})[_0x439f('0x2d')](function(){return respondWithRpcPromise(_0x439f('0x6a'),'create',{'module':'chan_sip.so'});})[_0x439f('0x2d')](function(){var _0x183e78=_0x5a7714['user'][_0x439f('0x2f')]({'plain':!![]});if(!_0x183e78)throw new Error(_0x439f('0x59'));if(_0x183e78[_0x439f('0x5a')]===_0x439f('0x58')){var _0x599d25=_0x1405d1['get']({'plain':!![]});return db[_0x439f('0x5b')][_0x439f('0x51')]({'where':{'name':'Trunks','userProfileId':_0x183e78[_0x439f('0x5c')]},'raw':!![]})[_0x439f('0x2d')](function(_0x291807){if(_0x291807&&_0x291807[_0x439f('0x5d')]===0x0){return db[_0x439f('0x31')][_0x439f('0x57')]({'name':_0x599d25['name'],'resourceId':_0x599d25['id'],'type':_0x291807[_0x439f('0x3c')],'sectionId':_0x291807['id']},{})['then'](function(){return _0x1405d1;});}else{return _0x1405d1;}})[_0x439f('0x21')](function(_0x28bef5){logger['error'](_0x439f('0x5e'),_0x28bef5);throw _0x28bef5;});}return _0x1405d1;})[_0x439f('0x2d')](respondWithResult(_0x307c08,0xc9))[_0x439f('0x21')](handleError(_0x307c08,null));};exports[_0x439f('0x2c')]=function(_0x5b1667,_0x3950f4,_0x76192e){var _0x2cd080;return db[_0x439f('0x37')][_0x439f('0x51')]({'where':{'id':_0x5b1667['params']['id']}})['then'](handleEntityNotFound(_0x3950f4,null))[_0x439f('0x2d')](saveUpdates(_0x5b1667[_0x439f('0x56')],null))[_0x439f('0x2d')](function(_0xe22ffc){if(_0xe22ffc){_0x2cd080=_0xe22ffc;return db['Trunk']['findAll']({'raw':!![]});}})[_0x439f('0x2d')](function(_0x151e71){if(_0x151e71){var _0x3f66ea=fs[_0x439f('0x5f')](path[_0x439f('0x60')](config[_0x439f('0x63')],_0x439f('0x61')),_0x439f('0x62'));var _0x9e12e7=fs[_0x439f('0x5f')](path[_0x439f('0x60')](config[_0x439f('0x63')],'server/files/templates/registry.ejs'),'utf8');var _0x1e60a3=ejs[_0x439f('0x65')](_0x3f66ea,{'trunks':_0x151e71||[]});fs[_0x439f('0x66')](_0x439f('0x67'),_0x1e60a3);var _0x358322=ejs[_0x439f('0x65')](_0x9e12e7,{'trunks':_0x151e71||[]});fs['writeFileSync'](_0x439f('0x69'),_0x358322);return respondWithRpcPromise(_0x439f('0x6a'),'update',{'module':'chan_sip.so'});}return null;})[_0x439f('0x2d')](function(_0x466f68){if(_0x466f68){return _0x2cd080;}})[_0x439f('0x2d')](respondWithResult(_0x3950f4,null))['catch'](handleError(_0x3950f4,null));};exports[_0x439f('0x2e')]=function(_0x41316d,_0x336447,_0x176603){var _0x40a789;return db[_0x439f('0x37')][_0x439f('0x51')]({'where':{'id':_0x41316d[_0x439f('0x4f')]['id']}})[_0x439f('0x2d')](handleEntityNotFound(_0x336447,null))[_0x439f('0x2d')](removeEntity(_0x336447,null))[_0x439f('0x2d')](function(){return db[_0x439f('0x37')][_0x439f('0x4e')]({'raw':!![]});})['then'](function(_0x5b7a7e){var _0x39efdb=fs[_0x439f('0x5f')](path[_0x439f('0x60')](config['root'],_0x439f('0x61')),'utf8');var _0x57eef7=fs[_0x439f('0x5f')](path[_0x439f('0x60')](config[_0x439f('0x63')],_0x439f('0x64')),_0x439f('0x62'));var _0x39a3ab=ejs[_0x439f('0x65')](_0x39efdb,{'trunks':_0x5b7a7e});var _0x4b8294=ejs[_0x439f('0x65')](_0x57eef7,{'trunks':_0x5b7a7e});fs[_0x439f('0x66')](_0x439f('0x67'),_0x39a3ab);fs[_0x439f('0x66')](_0x439f('0x69'),_0x4b8294);return respondWithRpcPromise(_0x439f('0x6a'),_0x439f('0x2e'),{'module':'chan_sip.so'});})[_0x439f('0x21')](handleError(_0x336447,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b04735e..0d237d4 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 _0xcc36=['rimraf','../../config/environment','./trunk.attributes','exports','Trunk','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x402b53,_0x3e578b){var _0x575025=function(_0x52621e){while(--_0x52621e){_0x402b53['push'](_0x402b53['shift']());}};_0x575025(++_0x3e578b);}(_0xcc36,0x101));var _0x6cc3=function(_0x514b08,_0x35b311){_0x514b08=_0x514b08-0x0;var _0x337f7c=_0xcc36[_0x514b08];return _0x337f7c;};'use strict';var _=require(_0x6cc3('0x0'));var util=require(_0x6cc3('0x1'));var logger=require('../../config/logger')(_0x6cc3('0x2'));var moment=require(_0x6cc3('0x3'));var BPromise=require(_0x6cc3('0x4'));var rp=require(_0x6cc3('0x5'));var fs=require('fs');var path=require(_0x6cc3('0x6'));var rimraf=require(_0x6cc3('0x7'));var config=require(_0x6cc3('0x8'));var attributes=require(_0x6cc3('0x9'));module[_0x6cc3('0xa')]=function(_0x28b9b6,_0x497d0b){return _0x28b9b6['define'](_0x6cc3('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8637=['exports','Trunk','tools_trunks','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x4ba380,_0x259bee){var _0x4b111b=function(_0x2bf227){while(--_0x2bf227){_0x4ba380['push'](_0x4ba380['shift']());}};_0x4b111b(++_0x259bee);}(_0x8637,0x111));var _0x7863=function(_0x28d25a,_0x16f1d0){_0x28d25a=_0x28d25a-0x0;var _0x2644f5=_0x8637[_0x28d25a];return _0x2644f5;};'use strict';var _=require('lodash');var util=require(_0x7863('0x0'));var logger=require(_0x7863('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7863('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7863('0x3'));var rimraf=require(_0x7863('0x4'));var config=require(_0x7863('0x5'));var attributes=require('./trunk.attributes');module[_0x7863('0x6')]=function(_0x24e189,_0x5df8d1){return _0x24e189['define'](_0x7863('0x7'),attributes,{'tableName':_0x7863('0x8'),'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 7839f7d..addaca0 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 _0x0b0e=['model','GetTrunk','Trunk','find','where','include','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','raw','options','attributes','map'];(function(_0x3ed8ae,_0x481771){var _0xd55254=function(_0x31dea8){while(--_0x31dea8){_0x3ed8ae['push'](_0x3ed8ae['shift']());}};_0xd55254(++_0x481771);}(_0x0b0e,0x187));var _0xe0b0=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0x0b0e[_0x402c8f];return _0x11e809;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Trunk,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['GetTrunk']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['Trunk'][_0xe0b0('0x18')]({'raw':_0x54a3eb['options']?_0x54a3eb['options'][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['where']||null:null,'attributes':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')]['limit']||null:null,'include':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['include']?_[_0xe0b0('0x1c')](_0x54a3eb[_0xe0b0('0x1a')]['include'],function(_0x170ad8){return{'model':db[_0x170ad8['model']],'as':_0x170ad8['as'],'attributes':_0x170ad8[_0xe0b0('0x1b')],'include':_0x170ad8['include']?_[_0xe0b0('0x1c')](_0x170ad8['include'],function(_0x3e5c88){return{'model':db[_0x3e5c88['model']],'as':_0x3e5c88['as'],'attributes':_0x3e5c88[_0xe0b0('0x1b')],'include':_0x3e5c88['include']?_[_0xe0b0('0x1c')](_0x3e5c88['include'],function(_0x362aba){return{'model':db[_0x362aba[_0xe0b0('0x1d')]],'as':_0x362aba['as'],'attributes':_0x362aba[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x3ec2){logger[_0xe0b0('0xe')]('GetTrunk',_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1e'),_0x54a3eb,JSON['stringify'](_0x3ec2));_0x50a441(_0x3ec2);})[_0xe0b0('0x17')](function(_0x419b1f){logger[_0xe0b0('0x13')](_0xe0b0('0x1e'),_0x419b1f[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x419b1f[_0xe0b0('0x14')]));});});};exports['ShowTrunk']=function(_0x1854b8){var _0x3c0109=this;return new Promise(function(_0x48a9b5,_0x4fe400){return db[_0xe0b0('0x1f')][_0xe0b0('0x20')]({'raw':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x21')]||null:null,'attributes':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'include':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')],function(_0x12eeb8){return{'model':db[_0x12eeb8[_0xe0b0('0x1d')]],'as':_0x12eeb8['as'],'attributes':_0x12eeb8[_0xe0b0('0x1b')],'include':_0x12eeb8[_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x12eeb8[_0xe0b0('0x22')],function(_0x1a0c90){return{'model':db[_0x1a0c90[_0xe0b0('0x1d')]],'as':_0x1a0c90['as'],'attributes':_0x1a0c90[_0xe0b0('0x1b')],'include':_0x1a0c90[_0xe0b0('0x22')]?_['map'](_0x1a0c90[_0xe0b0('0x22')],function(_0x135be5){return{'model':db[_0x135be5[_0xe0b0('0x1d')]],'as':_0x135be5['as'],'attributes':_0x135be5[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x2c6e60){logger[_0xe0b0('0xe')]('ShowTrunk',_0x1854b8);logger['debug']('ShowTrunk',_0x1854b8,JSON['stringify'](_0x2c6e60));_0x48a9b5(_0x2c6e60);})[_0xe0b0('0x17')](function(_0xc3d967){logger[_0xe0b0('0x13')]('ShowTrunk',_0xc3d967[_0xe0b0('0x14')],_0x1854b8);_0x4fe400(_0x3c0109[_0xe0b0('0x13')](0x1f4,_0xc3d967[_0xe0b0('0x14')]));});});}; \ No newline at end of file +var _0x8603=['result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x550f8f,_0x1567ee){var _0xdba234=function(_0x5cce68){while(--_0x5cce68){_0x550f8f['push'](_0x550f8f['shift']());}};_0xdba234(++_0x1567ee);}(_0x8603,0x190));var _0x3860=function(_0x3aa59d,_0x551895){_0x3aa59d=_0x3aa59d-0x0;var _0xacea82=_0x8603[_0x3aa59d];return _0xacea82;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrunk',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrunk']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 054dfd4..2251fae 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 _0xbc56=['/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeSmsAccounts','removeSquareProjects','removeApiKey','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/presence','getPresence','/:id','show','getAvatar','getContacts','/:id/queues','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','create','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','single','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions'];(function(_0x5eed96,_0x14c53c){var _0x1200cf=function(_0x1bcdc8){while(--_0x1bcdc8){_0x5eed96['push'](_0x5eed96['shift']());}};_0x1200cf(++_0x14c53c);}(_0xbc56,0x100));var _0x6bc5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbc56[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x6bc5('0x0'));var util=require(_0x6bc5('0x1'));var path=require(_0x6bc5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6bc5('0x3')]();var auth=require(_0x6bc5('0x4'));var interaction=require(_0x6bc5('0x5'));var config=require(_0x6bc5('0x6'));var controller=require(_0x6bc5('0x7'));router[_0x6bc5('0x8')]('/',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0xa')]);router['get']('/describe',auth[_0x6bc5('0x9')](),controller['describe']);router[_0x6bc5('0x8')]('/whoami',auth['isAuthenticated'](),controller['whoami']);router[_0x6bc5('0x8')](_0x6bc5('0xb'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0xc')]);router[_0x6bc5('0x8')](_0x6bc5('0xd'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0xe')]);router['get']('/:id/avatar',controller[_0x6bc5('0xf')]);router['get']('/:id/contacts',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x10')]);router['get'](_0x6bc5('0x11'),auth[_0x6bc5('0x9')](),controller['getQueues']);router[_0x6bc5('0x8')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x6bc5('0x12')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0x6bc5('0x13')]);router[_0x6bc5('0x8')](_0x6bc5('0x14'),auth[_0x6bc5('0x9')](),controller['getRecordings']);router[_0x6bc5('0x8')](_0x6bc5('0x15'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x16')]);router[_0x6bc5('0x8')](_0x6bc5('0x17'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x18')]);router[_0x6bc5('0x8')](_0x6bc5('0x19'),auth['isAuthenticated'](),controller[_0x6bc5('0x1a')]);router[_0x6bc5('0x8')](_0x6bc5('0x1b'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x1c')]);router[_0x6bc5('0x8')](_0x6bc5('0x1d'),auth['isAuthenticated'](),controller[_0x6bc5('0x1e')]);router[_0x6bc5('0x8')](_0x6bc5('0x1f'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x20')]);router['get'](_0x6bc5('0x21'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x22')]);router[_0x6bc5('0x8')]('/:id/teams',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x23')]);router[_0x6bc5('0x8')](_0x6bc5('0x24'),auth['isAuthenticated'](),controller[_0x6bc5('0x25')]);router[_0x6bc5('0x8')](_0x6bc5('0x26'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x27')]);router['get'](_0x6bc5('0x28'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x29')]);router['get'](_0x6bc5('0x2a'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x2b')]);router['get']('/:id/mail_accounts',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x2c')]);router[_0x6bc5('0x8')](_0x6bc5('0x2d'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x2e')]);router['get'](_0x6bc5('0x2f'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x30')]);router['get'](_0x6bc5('0x31'),auth['isAuthenticated'](),controller[_0x6bc5('0x32')]);router['get']('/:id/whatsapp_accounts',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x33')]);router['get'](_0x6bc5('0x34'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x35')]);router[_0x6bc5('0x8')](_0x6bc5('0x36'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x37')]);router[_0x6bc5('0x8')](_0x6bc5('0x38'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x39')]);router[_0x6bc5('0x3a')](_0x6bc5('0x3b'),auth[_0x6bc5('0x9')](),controller['addContacts']);router[_0x6bc5('0x3a')]('/',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x3c')]);router[_0x6bc5('0x3a')](_0x6bc5('0x3d'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x3e')]);router[_0x6bc5('0x3a')](_0x6bc5('0x11'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x3f')]);var upload=multer({'storage':multer[_0x6bc5('0x40')]({'destination':function(_0x1246e9,_0x303d3e,_0x5e664d){_0x5e664d(null,path['join'](config[_0x6bc5('0x41')],_0x6bc5('0x42')));},'filename':function(_0x4c90bd,_0xa129fc,_0x23704b){_0x23704b(null,util[_0x6bc5('0x43')](_0x6bc5('0x44'),Date['now'](),_0xa129fc[_0x6bc5('0x45')]));}})});router[_0x6bc5('0x3a')](_0x6bc5('0x46'),upload[_0x6bc5('0x47')]('file'),controller[_0x6bc5('0x48')]);router[_0x6bc5('0x3a')]('/:id/login',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x49')]);router[_0x6bc5('0x3a')](_0x6bc5('0x4a'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x4b')]);router['post']('/:id/pause',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x4c')]);router[_0x6bc5('0x3a')](_0x6bc5('0x4d'),auth[_0x6bc5('0x9')](),controller['unpause']);router[_0x6bc5('0x3a')](_0x6bc5('0x4e'),auth[_0x6bc5('0x9')](),controller['addTeams']);router['post'](_0x6bc5('0x4f'),auth['isAuthenticated'](),controller[_0x6bc5('0x50')]);router[_0x6bc5('0x3a')](_0x6bc5('0x51'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x52')]);router[_0x6bc5('0x3a')](_0x6bc5('0x53'),auth[_0x6bc5('0x9')](),controller['addFaxInteractions']);router['post']('/:id/sms_interactions',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x54')]);router['post'](_0x6bc5('0x55'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x56')]);router[_0x6bc5('0x3a')](_0x6bc5('0x57'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x58')]);router[_0x6bc5('0x3a')](_0x6bc5('0x2a'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x59')]);router[_0x6bc5('0x3a')](_0x6bc5('0x5a'),auth[_0x6bc5('0x9')](),controller['addMailAccounts']);router[_0x6bc5('0x3a')]('/:id/openchannel_accounts',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x5b')]);router[_0x6bc5('0x3a')]('/:id/sms_accounts',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x5c')]);router[_0x6bc5('0x3a')]('/:id/chat_websites',auth[_0x6bc5('0x9')](),controller['addChatWebsites']);router[_0x6bc5('0x3a')](_0x6bc5('0x5d'),auth['isAuthenticated'](),controller[_0x6bc5('0x5e')]);router[_0x6bc5('0x3a')](_0x6bc5('0x34'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x6bc5('0x3a')](_0x6bc5('0x38'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x5f')]);router[_0x6bc5('0x60')](_0x6bc5('0xd'),auth[_0x6bc5('0x9')](),controller['update']);router[_0x6bc5('0x60')]('/:id/password',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x61')]);router[_0x6bc5('0x62')](_0x6bc5('0x11'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x63')]);router['delete']('/:id/teams',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x64')]);router[_0x6bc5('0x62')]('/:id',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x65')]);router['delete'](_0x6bc5('0x4f'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x66')]);router[_0x6bc5('0x62')]('/:id/mail_interactions',auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x67')]);router[_0x6bc5('0x62')](_0x6bc5('0x53'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x68')]);router[_0x6bc5('0x62')](_0x6bc5('0x69'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x6a')]);router['delete'](_0x6bc5('0x55'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x6b')]);router['delete']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x6bc5('0x6c')]);router[_0x6bc5('0x62')](_0x6bc5('0x2a'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x6bc5('0x5a'),auth['isAuthenticated'](),controller[_0x6bc5('0x6d')]);router['delete'](_0x6bc5('0x2d'),auth[_0x6bc5('0x9')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6bc5('0x6e')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x6bc5('0x62')](_0x6bc5('0x5d'),auth[_0x6bc5('0x9')](),controller['removeWhatsappAccounts']);router['delete']('/:id/square_projects',auth['isAuthenticated'](),controller[_0x6bc5('0x6f')]);router[_0x6bc5('0x62')](_0x6bc5('0x38'),auth[_0x6bc5('0x9')](),controller[_0x6bc5('0x70')]);module['exports']=router; \ No newline at end of file +var _0x3011=['removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','/:id/agents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','server/files/images/','format','now','originalname','addAvatar','/:id/login','/:id/logout','logout','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','addSquareProjects','put','/:id','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions'];(function(_0x475467,_0x1d78f3){var _0x54af40=function(_0x383460){while(--_0x383460){_0x475467['push'](_0x475467['shift']());}};_0x54af40(++_0x1d78f3);}(_0x3011,0xda));var _0x1301=function(_0xe299f1,_0xb36771){_0xe299f1=_0xe299f1-0x0;var _0x5ea8f4=_0x3011[_0xe299f1];return _0x5ea8f4;};'use strict';var multer=require(_0x1301('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1301('0x1')]();var auth=require(_0x1301('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1301('0x3'));var controller=require(_0x1301('0x4'));router[_0x1301('0x5')]('/',auth[_0x1301('0x6')](),controller[_0x1301('0x7')]);router[_0x1301('0x5')](_0x1301('0x8'),auth[_0x1301('0x6')](),controller[_0x1301('0x9')]);router[_0x1301('0x5')](_0x1301('0xa'),auth[_0x1301('0x6')](),controller['whoami']);router[_0x1301('0x5')](_0x1301('0xb'),auth[_0x1301('0x6')](),controller['getPresence']);router[_0x1301('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x1301('0xc')]);router[_0x1301('0x5')](_0x1301('0xd'),controller['getAvatar']);router['get'](_0x1301('0xe'),auth[_0x1301('0x6')](),controller[_0x1301('0xf')]);router[_0x1301('0x5')](_0x1301('0x10'),auth[_0x1301('0x6')](),controller[_0x1301('0x11')]);router[_0x1301('0x5')](_0x1301('0x12'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x1301('0x5')](_0x1301('0x13'),auth[_0x1301('0x6')](),controller[_0x1301('0x14')]);router[_0x1301('0x5')](_0x1301('0x15'),auth[_0x1301('0x6')](),controller[_0x1301('0x16')]);router[_0x1301('0x5')](_0x1301('0x17'),auth[_0x1301('0x6')](),controller[_0x1301('0x18')]);router[_0x1301('0x5')](_0x1301('0x19'),auth[_0x1301('0x6')](),controller['getChatInteractions']);router[_0x1301('0x5')](_0x1301('0x1a'),auth['isAuthenticated'](),controller[_0x1301('0x1b')]);router[_0x1301('0x5')](_0x1301('0x1c'),auth[_0x1301('0x6')](),controller['getMailInteractions']);router[_0x1301('0x5')](_0x1301('0x1d'),auth['isAuthenticated'](),controller[_0x1301('0x1e')]);router[_0x1301('0x5')]('/:id/fax/interactions',auth[_0x1301('0x6')](),controller[_0x1301('0x1f')]);router['get'](_0x1301('0x20'),auth[_0x1301('0x6')](),controller['getWhatsappInteractions']);router[_0x1301('0x5')](_0x1301('0x21'),auth[_0x1301('0x6')](),controller[_0x1301('0x22')]);router[_0x1301('0x5')]('/:id/lists',auth[_0x1301('0x6')](),controller[_0x1301('0x23')]);router[_0x1301('0x5')](_0x1301('0x24'),auth['isAuthenticated'](),controller['getAgents']);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x1301('0x5')](_0x1301('0x25'),auth[_0x1301('0x6')](),controller[_0x1301('0x26')]);router[_0x1301('0x5')](_0x1301('0x27'),auth[_0x1301('0x6')](),controller[_0x1301('0x28')]);router['get']('/:id/openchannel_accounts',auth[_0x1301('0x6')](),controller[_0x1301('0x29')]);router[_0x1301('0x5')](_0x1301('0x2a'),auth[_0x1301('0x6')](),controller['getSmsAccounts']);router[_0x1301('0x5')]('/:id/chat_websites',auth[_0x1301('0x6')](),controller[_0x1301('0x2b')]);router[_0x1301('0x5')](_0x1301('0x2c'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x1301('0x5')](_0x1301('0x2d'),auth[_0x1301('0x6')](),controller['getSquareProjects']);router[_0x1301('0x5')](_0x1301('0x2e'),auth['isAuthenticated'](),controller[_0x1301('0x2f')]);router[_0x1301('0x5')](_0x1301('0x30'),auth[_0x1301('0x6')](),controller[_0x1301('0x31')]);router[_0x1301('0x32')](_0x1301('0xe'),auth[_0x1301('0x6')](),controller[_0x1301('0x33')]);router[_0x1301('0x32')]('/',auth[_0x1301('0x6')](),controller[_0x1301('0x34')]);router[_0x1301('0x32')](_0x1301('0x35'),auth[_0x1301('0x6')](),controller[_0x1301('0x36')]);router[_0x1301('0x32')](_0x1301('0x10'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x1301('0x37')]({'destination':function(_0x2ec17a,_0x147e37,_0x208cf4){_0x208cf4(null,path['join'](config['root'],_0x1301('0x38')));},'filename':function(_0x376d83,_0x297685,_0x14f431){_0x14f431(null,util[_0x1301('0x39')]('%s-%s',Date[_0x1301('0x3a')](),_0x297685[_0x1301('0x3b')]));}})});router['post'](_0x1301('0xd'),upload['single']('file'),controller[_0x1301('0x3c')]);router['post'](_0x1301('0x3d'),auth[_0x1301('0x6')](),controller['login']);router[_0x1301('0x32')](_0x1301('0x3e'),auth[_0x1301('0x6')](),controller[_0x1301('0x3f')]);router[_0x1301('0x32')]('/:id/pause',auth[_0x1301('0x6')](),controller['pause']);router[_0x1301('0x32')](_0x1301('0x40'),auth['isAuthenticated'](),controller[_0x1301('0x41')]);router[_0x1301('0x32')](_0x1301('0x21'),auth[_0x1301('0x6')](),controller['addTeams']);router[_0x1301('0x32')](_0x1301('0x42'),auth[_0x1301('0x6')](),controller[_0x1301('0x43')]);router[_0x1301('0x32')](_0x1301('0x44'),auth[_0x1301('0x6')](),controller[_0x1301('0x45')]);router['post']('/:id/fax_interactions',auth[_0x1301('0x6')](),controller[_0x1301('0x46')]);router[_0x1301('0x32')](_0x1301('0x47'),auth[_0x1301('0x6')](),controller[_0x1301('0x48')]);router['post'](_0x1301('0x49'),auth[_0x1301('0x6')](),controller[_0x1301('0x4a')]);router[_0x1301('0x32')](_0x1301('0x4b'),auth[_0x1301('0x6')](),controller['addWhatsappInteractions']);router[_0x1301('0x32')](_0x1301('0x25'),auth[_0x1301('0x6')](),controller[_0x1301('0x4c')]);router[_0x1301('0x32')]('/:id/mail_accounts',auth[_0x1301('0x6')](),controller[_0x1301('0x4d')]);router[_0x1301('0x32')](_0x1301('0x4e'),auth[_0x1301('0x6')](),controller[_0x1301('0x4f')]);router[_0x1301('0x32')]('/:id/sms_accounts',auth[_0x1301('0x6')](),controller[_0x1301('0x50')]);router[_0x1301('0x32')](_0x1301('0x51'),auth[_0x1301('0x6')](),controller['addChatWebsites']);router[_0x1301('0x32')]('/:id/whatsapp_accounts',auth[_0x1301('0x6')](),controller[_0x1301('0x52')]);router[_0x1301('0x32')](_0x1301('0x2d'),auth[_0x1301('0x6')](),controller[_0x1301('0x53')]);router[_0x1301('0x32')]('/:id/api_key',auth[_0x1301('0x6')](),controller['createApiKey']);router[_0x1301('0x54')](_0x1301('0x55'),auth[_0x1301('0x6')](),controller[_0x1301('0x56')]);router['put'](_0x1301('0x57'),auth[_0x1301('0x6')](),controller[_0x1301('0x58')]);router[_0x1301('0x59')]('/:id/queues',auth[_0x1301('0x6')](),controller[_0x1301('0x5a')]);router[_0x1301('0x59')](_0x1301('0x21'),auth[_0x1301('0x6')](),controller['removeTeams']);router[_0x1301('0x59')]('/:id',auth[_0x1301('0x6')](),controller[_0x1301('0x5b')]);router['delete'](_0x1301('0x42'),auth['isAuthenticated'](),controller[_0x1301('0x5c')]);router['delete'](_0x1301('0x44'),auth[_0x1301('0x6')](),controller[_0x1301('0x5d')]);router[_0x1301('0x59')]('/:id/fax_interactions',auth[_0x1301('0x6')](),controller[_0x1301('0x5e')]);router['delete']('/:id/sms_interactions',auth[_0x1301('0x6')](),controller[_0x1301('0x5f')]);router[_0x1301('0x59')](_0x1301('0x49'),auth['isAuthenticated'](),controller[_0x1301('0x60')]);router['delete'](_0x1301('0x4b'),auth[_0x1301('0x6')](),controller[_0x1301('0x61')]);router[_0x1301('0x59')](_0x1301('0x25'),auth[_0x1301('0x6')](),controller[_0x1301('0x62')]);router[_0x1301('0x59')](_0x1301('0x27'),auth[_0x1301('0x6')](),controller[_0x1301('0x63')]);router[_0x1301('0x59')](_0x1301('0x4e'),auth[_0x1301('0x6')](),controller[_0x1301('0x64')]);router[_0x1301('0x59')](_0x1301('0x2a'),auth[_0x1301('0x6')](),controller[_0x1301('0x65')]);router['delete'](_0x1301('0x51'),auth[_0x1301('0x6')](),controller[_0x1301('0x66')]);router[_0x1301('0x59')](_0x1301('0x2c'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x1301('0x59')](_0x1301('0x2d'),auth[_0x1301('0x6')](),controller[_0x1301('0x67')]);router[_0x1301('0x59')](_0x1301('0x30'),auth[_0x1301('0x6')](),controller['removeApiKey']);module[_0x1301('0x68')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5a0d5e0..2c7cd08 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 _0x58f3=['yes','never','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','active','actpass','update,nonat','showWebBar','udp','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','toLowerCase','ENUM','agent','telephone','INTEGER','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','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]'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x58f3,0x7b));var _0x358f=function(_0x12c64d,_0xba8f77){_0x12c64d=_0x12c64d-0x0;var _0x3a4c74=_0x58f3[_0x12c64d];return _0x3a4c74;};'use strict';var Sequelize=require(_0x358f('0x0'));var moment=require(_0x358f('0x1'));var util=require(_0x358f('0x2'));var _=require(_0x358f('0x3'));module[_0x358f('0x4')]={'name':{'type':Sequelize[_0x358f('0x5')],'allowNull':![],'unique':_0x358f('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x15db11){this[_0x358f('0x7')](_0x358f('0x6'),_0x15db11);this[_0x358f('0x7')]('defaultuser',_0x15db11);},'comment':_0x358f('0x8')},'fullname':{'type':Sequelize[_0x358f('0x5')],'allowNull':![],'set':function(_0x354d13){this[_0x358f('0x7')](_0x358f('0x9'),_0x354d13);this[_0x358f('0x7')](_0x358f('0xa'),util[_0x358f('0xb')]('\x22%s\x22\x20<%s>',_0x354d13,this['getDataValue'](_0x358f('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x358f('0x5')],'allowNull':![],'unique':_0x358f('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2961df){if(_0x2961df){this['setDataValue'](_0x358f('0xd'),_0x2961df[_0x358f('0xe')]());}}},'role':{'type':Sequelize[_0x358f('0xf')]('admin','user',_0x358f('0x10'),_0x358f('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x358f('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x358f('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':![],'unique':_0x358f('0xc'),'set':function(_0x31baf4){this[_0x358f('0x7')]('internal',_0x31baf4);this[_0x358f('0x7')]('accountcode',_0x31baf4);this['setDataValue'](_0x358f('0xa'),util[_0x358f('0xb')](_0x358f('0x13'),this[_0x358f('0x14')]('fullname'),_0x31baf4));}},'salt':{'type':Sequelize[_0x358f('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x358f('0x5')]},'zipcode':{'type':Sequelize[_0x358f('0x5')]},'userpic':{'type':Sequelize[_0x358f('0x5')]},'city':{'type':Sequelize[_0x358f('0x5')]},'country':{'type':Sequelize[_0x358f('0x5')]},'online':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x358f('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x358f('0x17')},'lastPauseAt':{'type':Sequelize[_0x358f('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x358f('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x358f('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x358f('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x358f('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x358f('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x358f('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![],'defaultValue':_0x358f('0x18')},'ipaddr':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x19'),'user','peer'),'allowNull':!![],'defaultValue':_0x358f('0x19')},'context':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![],'defaultValue':_0x358f('0x1a')},'callingpres':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x1b'),'ALLOWED_PASSED_SCREEN',_0x358f('0x1c'),_0x358f('0x1d'),_0x358f('0x1e'),_0x358f('0x1f'),_0x358f('0x20'),_0x358f('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x453735){this[_0x358f('0x7')](_0x358f('0x22'),_0x453735?_0x453735[_0x358f('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x358f('0x14')](_0x358f('0x22'))[_0x358f('0x24')](','):null;},'comment':_0x358f('0x25')},'dtmfmode':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x26'),_0x358f('0x27'),_0x358f('0x28'),_0x358f('0x29'),_0x358f('0x2a')),'allowNull':!![],'defaultValue':_0x358f('0x26')},'directmedia':{'type':Sequelize[_0x358f('0xf')]('yes','no',_0x358f('0x2b'),_0x358f('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x358f('0x2d'),'set':function(_0xbfe1a4){this[_0x358f('0x7')](_0x358f('0x2e'),_0xbfe1a4?_0xbfe1a4[_0x358f('0x23')](','):null);},'get':function(){return this[_0x358f('0x14')](_0x358f('0x2e'))?this['getDataValue'](_0x358f('0x2e'))[_0x358f('0x24')](','):null;},'comment':_0x358f('0x2f')},'callgroup':{'type':Sequelize[_0x358f('0x5')]},'namedcallgroup':{'type':Sequelize[_0x358f('0x5')]},'pickupgroup':{'type':Sequelize[_0x358f('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x358f('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x358f('0x5')]},'disallow':{'type':Sequelize[_0x358f('0x5')],'allowNull':![],'defaultValue':_0x358f('0x30')},'allow':{'type':Sequelize[_0x358f('0x5')],'allowNull':![],'defaultValue':_0x358f('0x31'),'set':function(_0xe4f8fa){this['setDataValue'](_0x358f('0x32'),_0xe4f8fa?_0xe4f8fa[_0x358f('0x23')](';'):_0x358f('0x31'));},'get':function(){return this[_0x358f('0x14')](_0x358f('0x32'))?this[_0x358f('0x14')](_0x358f('0x32'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x358f('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![],'set':function(_0xa3547c){this[_0x358f('0x7')](_0x358f('0x33'),_0xa3547c?_0xa3547c['join'](','):null);},'get':function(){return this[_0x358f('0x14')](_0x358f('0x33'))?this[_0x358f('0x14')](_0x358f('0x33'))[_0x358f('0x24')](','):null;},'comment':_0x358f('0x34')},'trustrpid':{'type':Sequelize[_0x358f('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x358f('0xf')]('yes','no',_0x358f('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x358f('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x358f('0x35'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x358f('0x35'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x358f('0x35'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no',_0x358f('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x39'),'refuse',_0x358f('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x3b'),_0x358f('0x3c')),'allowNull':!![],'defaultValue':_0x358f('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x358f('0x35'),'no'),'allowNull':!![],'defaultValue':_0x358f('0x35')},'keepalive':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x358f('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x358f('0x35'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x358f('0xf')]('yes','no',_0x358f('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x3e'),'passive',_0x358f('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x358f('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x358f('0x35'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no',_0x358f('0x2b'),_0x358f('0x2c'),_0x358f('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x358f('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x358f('0x5')]},'showWebBar':{'type':Sequelize[_0x358f('0x12')],'defaultValue':0x0,'set':function(_0x4a04b7){this[_0x358f('0x7')](_0x358f('0x41'),_0x4a04b7);var _0x533716=this['get']({'plain':!![]});switch(_0x4a04b7){case 0x0:case 0x1:var _0x2b5023=_0x533716['transport']?_['isArray'](_0x533716[_0x358f('0x22')])?_0x533716[_0x358f('0x22')][_0x358f('0x23')]():_0x533716[_0x358f('0x22')]:_0x358f('0x42');if(_0x2b5023===_0x358f('0x43')){_0x2b5023=_0x358f('0x42');}this[_0x358f('0x7')](_0x358f('0x22'),_0x2b5023);this['setDataValue']('encryption','no');this[_0x358f('0x7')](_0x358f('0x44'),null);this['setDataValue'](_0x358f('0x45'),null);this[_0x358f('0x7')](_0x358f('0x46'),null);this[_0x358f('0x7')](_0x358f('0x47'),null);this[_0x358f('0x7')](_0x358f('0x48'),null);this[_0x358f('0x7')](_0x358f('0x49'),null);this[_0x358f('0x7')](_0x358f('0x4a'),null);this[_0x358f('0x7')](_0x358f('0x4b'),null);this[_0x358f('0x7')](_0x358f('0x4c'),'no');break;case 0x2:this['setDataValue']('transport','wss');this[_0x358f('0x7')](_0x358f('0x4d'),_0x358f('0x35'));this[_0x358f('0x7')]('avpf',_0x358f('0x35'));this['setDataValue'](_0x358f('0x45'),_0x358f('0x35'));this[_0x358f('0x7')](_0x358f('0x46'),_0x358f('0x35'));this[_0x358f('0x7')](_0x358f('0x47'),_0x358f('0x35'));this['setDataValue'](_0x358f('0x48'),'no');this[_0x358f('0x7')](_0x358f('0x49'),'actpass');this[_0x358f('0x7')]('dtlscertfile',_0x533716[_0x358f('0x4a')]||'/etc/pki/tls/certs/motion.crt');this[_0x358f('0x7')](_0x358f('0x4b'),_0x533716[_0x358f('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x358f('0x7')](_0x358f('0x4c'),_0x358f('0x35'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x39770c){this[_0x358f('0x7')]('permissions',_0x39770c?_0x39770c['join'](','):[]);},'get':function(){return this[_0x358f('0x14')]('permissions')?_['map'](this['getDataValue'](_0x358f('0x4e'))[_0x358f('0x24')](','),function(_0x8e9e62){return parseInt(_0x8e9e62,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x358f('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x358f('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x358f('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x358f('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x358f('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x358f('0xf')](_0x358f('0x35'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x358f('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x358f('0x4f')],'get':function(){return this['getDataValue'](_0x358f('0x50'))?this[_0x358f('0x14')](_0x358f('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x358f('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x358f('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![],'set':function(_0x2270c5){if(typeof _0x2270c5===_0x358f('0x51')){var _0x3ed244=_0x2270c5==='1'?!![]:_0x2270c5==='0'?![]:_0x2270c5===_0x358f('0x52')?!![]:_0x2270c5===_0x358f('0x53')?![]:![];this[_0x358f('0x7')](_0x358f('0x54'),_0x3ed244);}else{this[_0x358f('0x7')](_0x358f('0x54'),_0x2270c5);}}},'blocked':{'type':Sequelize[_0x358f('0x15')],'defaultValue':![],'set':function(_0x63a35){this[_0x358f('0x7')](_0x358f('0x55'),_0x63a35);if(_0x63a35===!![]){this[_0x358f('0x7')](_0x358f('0x56'),moment());this[_0x358f('0x7')](_0x358f('0x57'),0x0);}else{this['setDataValue'](_0x358f('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x358f('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x358f('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x358f('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4cff=['ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','outgoing','force_rport,comedia','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','showWebBar','get','isArray','wss','force_avp','icesupport','dtlsenable','dtlsverify','encryption','avpf','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','accountcode','format','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED'];(function(_0x41cde6,_0x59af59){var _0x23937a=function(_0x2f0e66){while(--_0x2f0e66){_0x41cde6['push'](_0x41cde6['shift']());}};_0x23937a(++_0x59af59);}(_0x4cff,0x159));var _0xf4cf=function(_0x2eba7c,_0x8a46d2){_0x2eba7c=_0x2eba7c-0x0;var _0x20e5fc=_0x4cff[_0x2eba7c];return _0x20e5fc;};'use strict';var Sequelize=require(_0xf4cf('0x0'));var moment=require(_0xf4cf('0x1'));var util=require(_0xf4cf('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':![],'unique':_0xf4cf('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1750be){this[_0xf4cf('0x5')](_0xf4cf('0x4'),_0x1750be);this[_0xf4cf('0x5')](_0xf4cf('0x6'),_0x1750be);},'comment':_0xf4cf('0x7')},'fullname':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':![],'set':function(_0x1126a9){this['setDataValue']('fullname',_0x1126a9);this['setDataValue'](_0xf4cf('0x8'),util['format'](_0xf4cf('0x9'),_0x1126a9,this[_0xf4cf('0xa')](_0xf4cf('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':![],'unique':_0xf4cf('0xc'),'validate':{'isEmail':!![]},'set':function(_0x21045b){if(_0x21045b){this[_0xf4cf('0x5')](_0xf4cf('0xc'),_0x21045b[_0xf4cf('0xd')]());}}},'role':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0xf'),_0xf4cf('0x10'),_0xf4cf('0x11'),_0xf4cf('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xf4cf('0x3')],'defaultValue':_0xf4cf('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xf4cf('0xb'),'set':function(_0x44a596){this[_0xf4cf('0x5')](_0xf4cf('0xb'),_0x44a596);this['setDataValue'](_0xf4cf('0x14'),_0x44a596);this[_0xf4cf('0x5')](_0xf4cf('0x8'),util[_0xf4cf('0x15')](_0xf4cf('0x9'),this[_0xf4cf('0xa')](_0xf4cf('0x16')),_0x44a596));}},'salt':{'type':Sequelize[_0xf4cf('0x3')]},'phone':{'type':Sequelize[_0xf4cf('0x3')]},'mobile':{'type':Sequelize[_0xf4cf('0x3')]},'address':{'type':Sequelize[_0xf4cf('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf4cf('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf4cf('0x17')]},'voicePause':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xf4cf('0x19')},'lastPauseAt':{'type':Sequelize[_0xf4cf('0x17')]},'chatCapacity':{'type':Sequelize[_0xf4cf('0x1a')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xf4cf('0x1a')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf4cf('0x1a')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf4cf('0x1a')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf4cf('0x1a')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![],'defaultValue':_0xf4cf('0x1b')},'ipaddr':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xf4cf('0x1a')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf4cf('0xe')]('friend',_0xf4cf('0x10'),'peer'),'allowNull':!![],'defaultValue':_0xf4cf('0x1c')},'context':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![],'defaultValue':_0xf4cf('0x1d')},'callingpres':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x1e'),_0xf4cf('0x1f'),_0xf4cf('0x20'),_0xf4cf('0x21'),_0xf4cf('0x22'),_0xf4cf('0x23'),_0xf4cf('0x24'),_0xf4cf('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf4cf('0x26'),'set':function(_0x41d010){this[_0xf4cf('0x5')]('transport',_0x41d010?_0x41d010['join'](','):null);},'get':function(){return this[_0xf4cf('0xa')](_0xf4cf('0x27'))?this[_0xf4cf('0xa')]('transport')['split'](','):null;},'comment':_0xf4cf('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf4cf('0x29'),_0xf4cf('0x2a'),'shortinfo',_0xf4cf('0x2b'),_0xf4cf('0x2c')),'allowNull':!![],'defaultValue':_0xf4cf('0x29')},'directmedia':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no',_0xf4cf('0x2e'),'update',_0xf4cf('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![],'defaultValue':_0xf4cf('0x30'),'set':function(_0x33d3ed){this[_0xf4cf('0x5')]('nat',_0x33d3ed?_0x33d3ed[_0xf4cf('0x31')](','):null);},'get':function(){return this[_0xf4cf('0xa')](_0xf4cf('0x32'))?this[_0xf4cf('0xa')](_0xf4cf('0x32'))[_0xf4cf('0x33')](','):null;},'comment':_0xf4cf('0x34')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf4cf('0x3')]},'pickupgroup':{'type':Sequelize[_0xf4cf('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xf4cf('0x3')]},'language':{'type':Sequelize[_0xf4cf('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf4cf('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':![],'defaultValue':_0xf4cf('0x35'),'set':function(_0x341b37){this['setDataValue'](_0xf4cf('0x36'),_0x341b37?_0x341b37['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf4cf('0xa')](_0xf4cf('0x36'))?this[_0xf4cf('0xa')](_0xf4cf('0x36'))[_0xf4cf('0x33')](';'):null;},'comment':_0xf4cf('0x37')},'autoframing':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![],'set':function(_0x52ba01){this[_0xf4cf('0x5')](_0xf4cf('0x38'),_0x52ba01?_0x52ba01[_0xf4cf('0x31')](','):null);},'get':function(){return this[_0xf4cf('0xa')](_0xf4cf('0x38'))?this[_0xf4cf('0xa')]('insecure')['split'](','):null;},'comment':_0xf4cf('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0xf4cf('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf4cf('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no',_0xf4cf('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![],'defaultValue':_0xf4cf('0x3b')},'amaflags':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xf4cf('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf4cf('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf4cf('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no',_0xf4cf('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xf4cf('0x3d'),_0xf4cf('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x3f'),_0xf4cf('0x40')),'allowNull':!![],'defaultValue':_0xf4cf('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xf4cf('0x2d')},'keepalive':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf4cf('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xf4cf('0x2d'),'no','fingerprint',_0xf4cf('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf4cf('0x1a')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xf4cf('0x42'),_0xf4cf('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xf4cf('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no','nonat','update',_0xf4cf('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xf4cf('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xf4cf('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x485605){this[_0xf4cf('0x5')](_0xf4cf('0x45'),_0x485605);var _0x509882=this[_0xf4cf('0x46')]({'plain':!![]});switch(_0x485605){case 0x0:case 0x1:var _0x102ffb=_0x509882[_0xf4cf('0x27')]?_[_0xf4cf('0x47')](_0x509882[_0xf4cf('0x27')])?_0x509882[_0xf4cf('0x27')][_0xf4cf('0x31')]():_0x509882[_0xf4cf('0x27')]:'udp';if(_0x102ffb===_0xf4cf('0x48')){_0x102ffb=_0xf4cf('0x26');}this['setDataValue'](_0xf4cf('0x27'),_0x102ffb);this['setDataValue']('encryption','no');this[_0xf4cf('0x5')]('avpf',null);this[_0xf4cf('0x5')](_0xf4cf('0x49'),null);this[_0xf4cf('0x5')](_0xf4cf('0x4a'),null);this['setDataValue'](_0xf4cf('0x4b'),null);this['setDataValue'](_0xf4cf('0x4c'),null);this[_0xf4cf('0x5')]('dtlssetup',null);this[_0xf4cf('0x5')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xf4cf('0x5')](_0xf4cf('0x27'),'wss');this[_0xf4cf('0x5')](_0xf4cf('0x4d'),'yes');this['setDataValue'](_0xf4cf('0x4e'),_0xf4cf('0x2d'));this[_0xf4cf('0x5')]('force_avp',_0xf4cf('0x2d'));this[_0xf4cf('0x5')]('icesupport','yes');this['setDataValue'](_0xf4cf('0x4b'),_0xf4cf('0x2d'));this[_0xf4cf('0x5')](_0xf4cf('0x4c'),'no');this['setDataValue'](_0xf4cf('0x4f'),'actpass');this['setDataValue'](_0xf4cf('0x50'),_0x509882[_0xf4cf('0x50')]||_0xf4cf('0x51'));this[_0xf4cf('0x5')](_0xf4cf('0x52'),_0x509882[_0xf4cf('0x52')]||_0xf4cf('0x53'));this[_0xf4cf('0x5')]('rtcp_mux',_0xf4cf('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xf4cf('0x54')],'set':function(_0x50aa6b){this['setDataValue']('permissions',_0x50aa6b?_0x50aa6b[_0xf4cf('0x31')](','):[]);},'get':function(){return this['getDataValue'](_0xf4cf('0x55'))?_[_0xf4cf('0x56')](this['getDataValue'](_0xf4cf('0x55'))[_0xf4cf('0x33')](','),function(_0x2bfdce){return parseInt(_0x2bfdce,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf4cf('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf4cf('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xf4cf('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf4cf('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf4cf('0x1a')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf4cf('0xe')](_0xf4cf('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf4cf('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf4cf('0x57')],'get':function(){return this[_0xf4cf('0xa')](_0xf4cf('0x58'))?this[_0xf4cf('0xa')](_0xf4cf('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf4cf('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf4cf('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![],'set':function(_0x5be91a){if(typeof _0x5be91a==='string'){var _0x1ea0ad=_0x5be91a==='1'?!![]:_0x5be91a==='0'?![]:_0x5be91a==='true'?!![]:_0x5be91a===_0xf4cf('0x59')?![]:![];this['setDataValue'](_0xf4cf('0x5a'),_0x1ea0ad);}else{this[_0xf4cf('0x5')](_0xf4cf('0x5a'),_0x5be91a);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1c696b){this[_0xf4cf('0x5')](_0xf4cf('0x5b'),_0x1c696b);if(_0x1c696b===!![]){this['setDataValue'](_0xf4cf('0x5c'),moment());this[_0xf4cf('0x5')](_0xf4cf('0x5d'),0x0);}else{this[_0xf4cf('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xf4cf('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf4cf('0x1a')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xf4cf('0x18')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 3a691e2..c235a14 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 _0xdeb2=['socket.io-emitter','./user.socket','register','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','admin','Users','Agents','Telephones','ignore','map','value','includes','find','role','name','UserProfileResource','sendStatus','stack','send','User','rawAttributes','fieldName','key','model','password','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','sequelize','lower','col','includeAll','include','findAll','rows','show','differenceBy','salt','options','body','describe','addContacts','params','omit','ids','internal','findById','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','102','103','113','110','106','107','108','111','114','user','Unauthorized','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','autoAssociation','telephone','compact','changePassword','oldPassword','newPassword','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Sequelize','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','securePassword','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','add','toLowerCase','Queues','penalty','spread','emit','capitalize','Queue:save','voice','SIP/%s','upsert','removeQueues','channel','QueueId','Queue:remove','UserVoiceQueueRt','addAvatar','file','filename','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getContacts','CmContact','order','CmList','List','Tag','Tags','color','tag','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','getVoiceQueues','MemberReport','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','device','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','QueuePause','pause','PAUSE','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','Unknown\x20channel','manual','mail','fax','sms','whatsapp','openchannel','set','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','removeTeams','Sms','getFaxQueues','flatten','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','phone','dialActive','VoiceQueue','retrieveApiKey','token','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','isEmpty','inbound','getAgents','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','slice','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x3f6d68,_0x3cc024){var _0x245f61=function(_0x139f67){while(--_0x139f67){_0x3f6d68['push'](_0x3f6d68['shift']());}};_0x245f61(++_0x3cc024);}(_0xdeb2,0x17f));var _0x2deb=function(_0x5ea9f7,_0x3872eb){_0x5ea9f7=_0x5ea9f7-0x0;var _0x43ca0b=_0xdeb2[_0x5ea9f7];return _0x43ca0b;};'use strict';var pdf=require(_0x2deb('0x0'));var emlformat=require(_0x2deb('0x1'));var rimraf=require(_0x2deb('0x2'));var zipdir=require(_0x2deb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2deb('0x4'));var moment=require(_0x2deb('0x5'));var BPromise=require(_0x2deb('0x6'));var Mustache=require(_0x2deb('0x7'));var util=require('util');var path=require(_0x2deb('0x8'));var sox=require(_0x2deb('0x9'));var csv=require(_0x2deb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2deb('0xb'));var squel=require(_0x2deb('0xc'));var crypto=require(_0x2deb('0xd'));var jsforce=require(_0x2deb('0xe'));var deskjs=require(_0x2deb('0xf'));var toCsv=require(_0x2deb('0xa'));var querystring=require(_0x2deb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2deb('0x11'));var qs=require(_0x2deb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2deb('0x13'))(_0x2deb('0x14'));var utils=require(_0x2deb('0x15'));var config=require(_0x2deb('0x16'));var licenseUtil=require(_0x2deb('0x17'));var db=require(_0x2deb('0x18'))['db'];config[_0x2deb('0x19')]=_[_0x2deb('0x1a')](config[_0x2deb('0x19')],{'host':_0x2deb('0x1b'),'port':0x18eb});var socket=require(_0x2deb('0x1c'))(new Redis(config[_0x2deb('0x19')]));require(_0x2deb('0x1d'))[_0x2deb('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2deb('0x1f')][_0x2deb('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x567f33,_0x3fb76c,_0x28719e,_0x46d2c7){return new BPromise(function(_0x2b1bae,_0x4dfd1b){var _0x3064a0=_0x46d2c7||client;return _0x3064a0[_0x2deb('0x21')](_0x567f33,_0x28719e)[_0x2deb('0x22')](function(_0x48a3ba){logger[_0x2deb('0x23')](_0x2deb('0x24'),_0x3fb76c,_0x2deb('0x25'));logger[_0x2deb('0x26')]('User,\x20%s,\x20%s,\x20%s',_0x3fb76c,_0x2deb('0x25'),JSON[_0x2deb('0x27')](_0x48a3ba));if(_0x48a3ba[_0x2deb('0x28')]){if(_0x48a3ba[_0x2deb('0x28')][_0x2deb('0x29')]===0x1f4){logger['error'](_0x2deb('0x24'),_0x3fb76c,_0x48a3ba[_0x2deb('0x28')][_0x2deb('0x2a')]);return _0x4dfd1b(_0x48a3ba[_0x2deb('0x28')]['message']);}logger[_0x2deb('0x28')](_0x2deb('0x24'),_0x3fb76c,_0x48a3ba[_0x2deb('0x28')][_0x2deb('0x2a')]);return _0x2b1bae(_0x48a3ba[_0x2deb('0x28')]['message']);}else{logger[_0x2deb('0x23')](_0x2deb('0x24'),_0x3fb76c,_0x2deb('0x25'));_0x2b1bae(_0x48a3ba[_0x2deb('0x2b')]['message']);}})[_0x2deb('0x2c')](function(_0x20cc75){logger[_0x2deb('0x28')](_0x2deb('0x24'),_0x3fb76c,_0x20cc75);_0x4dfd1b(_0x20cc75);});});}function respondWithStatusCode(_0x5b5155,_0x12abe0){_0x12abe0=_0x12abe0||0xcc;return function(_0x5162fe){if(_0x5162fe){return _0x5b5155['sendStatus'](_0x12abe0);}return _0x5b5155[_0x2deb('0x2d')](_0x12abe0)[_0x2deb('0x2e')]();};}function respondWithResult(_0x2ae92d,_0x51baa2){_0x51baa2=_0x51baa2||0xc8;return function(_0x356e86){if(_0x356e86){return _0x2ae92d[_0x2deb('0x2d')](_0x51baa2)[_0x2deb('0x2f')](_0x356e86);}};}function respondWithFilteredResult(_0x2730fa,_0x3e5157){return function(_0x363049){if(_0x363049){var _0x3df92c=_0x363049[_0x2deb('0x30')],_0xd828f7=_0x3e5157[_0x2deb('0x31')],_0x2549e2=_0x3e5157[_0x2deb('0x31')]+_0x3e5157[_0x2deb('0x32')],_0x2cc680;if(_0x2549e2>=_0x3df92c){_0x2549e2=_0x3df92c;_0x2cc680=0xc8;}else{_0x2cc680=0xce;}_0x2730fa[_0x2deb('0x2d')](_0x2cc680);return _0x2730fa['set'](_0x2deb('0x33'),_0xd828f7+'-'+_0x2549e2+'/'+_0x3df92c)['json'](_0x363049);}return null;};}function patchUpdates(_0x1b20e7){return function(_0x5758bb){try{jsonpatch[_0x2deb('0x34')](_0x5758bb,_0x1b20e7,!![]);}catch(_0xc363e7){return BPromise['reject'](_0xc363e7);}return _0x5758bb[_0x2deb('0x35')]();};}function saveUpdates(_0x5a6cbf,_0x80352c){return function(_0x19c7cd){if(_0x19c7cd){return _0x19c7cd[_0x2deb('0x36')](_0x5a6cbf)[_0x2deb('0x22')](function(_0x1453e4){return _0x1453e4;});}return null;};}function removeEntity(_0x54a5a2,_0x257125){return function(_0x4ca95b){if(_0x4ca95b){return _0x4ca95b[_0x2deb('0x37')]()['then'](function(){var _0x60f1c0=_0x4ca95b[_0x2deb('0x38')]({'plain':!![]});if(_0x60f1c0['role']===_0x2deb('0x39'))return;var _0x4286f6=[{'name':_0x2deb('0x3a'),'value':'user','ignore':!![]},{'name':_0x2deb('0x3b'),'value':'agent','ignore':![]},{'name':_0x2deb('0x3c'),'value':'telephone','ignore':![]}];var _0x192fde=_(_0x4286f6)['filter'](_0x2deb('0x3d'))[_0x2deb('0x3e')](_0x2deb('0x3f'))[_0x2deb('0x3f')]();if(_[_0x2deb('0x40')](_0x192fde,_0x60f1c0['role'])){return;}var _0x271040=_[_0x2deb('0x41')](_0x4286f6,[_0x2deb('0x3f'),_0x60f1c0[_0x2deb('0x42')]])[_0x2deb('0x43')];return db[_0x2deb('0x44')][_0x2deb('0x37')]({'where':{'type':_0x271040,'resourceId':_0x60f1c0['id']}})[_0x2deb('0x22')](function(){return _0x4ca95b;});})[_0x2deb('0x22')](function(){_0x54a5a2[_0x2deb('0x2d')](0xcc)[_0x2deb('0x2e')]();});}};}function handleEntityNotFound(_0x34984a,_0x4dcc0d){return function(_0x427298){if(!_0x427298){_0x34984a[_0x2deb('0x45')](0x194);}return _0x427298;};}function handleError(_0x6c5625,_0x5384ce){_0x5384ce=_0x5384ce||0x1f4;return function(_0x4076bc){logger['error'](_0x4076bc[_0x2deb('0x46')]);if(_0x4076bc[_0x2deb('0x43')]){delete _0x4076bc[_0x2deb('0x43')];}_0x6c5625[_0x2deb('0x2d')](_0x5384ce)[_0x2deb('0x47')](_0x4076bc);};}exports['index']=function(_0x3e5a22,_0x37d912){var _0x105265={},_0x3e352c={},_0x17125f={'count':0x0,'rows':[]};var _0x2a73f5=_[_0x2deb('0x3e')](db[_0x2deb('0x48')][_0x2deb('0x49')],function(_0x1e128a){return{'name':_0x1e128a[_0x2deb('0x4a')],'type':_0x1e128a['type'][_0x2deb('0x4b')]};});_0x3e352c[_0x2deb('0x4c')]=_['differenceBy'](_[_0x2deb('0x3e')](_0x2a73f5,_0x2deb('0x43')),[_0x2deb('0x4d'),'salt']);_0x3e352c[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x3e5a22[_0x2deb('0x4e')]);_0x3e352c[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x3e352c[_0x2deb('0x4c')],_0x3e352c[_0x2deb('0x4e')]);_0x105265[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0x3e352c[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x3e5a22[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x105265[_0x2deb('0x52')]=_0x105265[_0x2deb('0x52')][_0x2deb('0x54')]?_0x105265[_0x2deb('0x52')]:_0x3e352c['model'];if(!_0x3e5a22[_0x2deb('0x4e')][_0x2deb('0x55')](_0x2deb('0x56'))){_0x105265[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x3e5a22[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x105265['offset']=qs[_0x2deb('0x31')](_0x3e5a22['query'][_0x2deb('0x31')]);}_0x105265['order']=qs[_0x2deb('0x57')](_0x3e5a22['query']['sort']);_0x105265[_0x2deb('0x58')]=qs['filters'](_[_0x2deb('0x59')](_0x3e5a22['query'],_0x3e352c['filters']),_0x2a73f5);if(_0x3e5a22[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x105265[_0x2deb('0x58')]=_[_0x2deb('0x5b')](_0x105265[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x2a73f5,function(_0x42c080){if(_0x42c080[_0x2deb('0x5c')]!==_0x2deb('0x5d')){return db[_0x2deb('0x5e')][_0x2deb('0x58')](db['sequelize']['fn'](_0x2deb('0x5f'),db[_0x2deb('0x5e')][_0x2deb('0x60')](_0x42c080[_0x2deb('0x43')])),{'$like':db['sequelize']['fn']('lower','%'+_0x3e5a22[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%')});}})});}_0x105265=_['merge']({},_0x105265,_0x3e5a22['options']);var _0x37a2db={'where':_0x105265[_0x2deb('0x58')]};return db[_0x2deb('0x48')][_0x2deb('0x30')](_0x37a2db)[_0x2deb('0x22')](function(_0x51f750){_0x17125f['count']=_0x51f750;if(_0x3e5a22[_0x2deb('0x4e')][_0x2deb('0x61')]){_0x105265[_0x2deb('0x62')]=[{'all':!![]}];}return db['User'][_0x2deb('0x63')](_0x105265);})[_0x2deb('0x22')](function(_0x309e83){_0x17125f[_0x2deb('0x64')]=_0x309e83;return _0x17125f;})['then'](respondWithFilteredResult(_0x37d912,_0x105265))['catch'](handleError(_0x37d912,null));};exports[_0x2deb('0x65')]=function(_0x5b126e,_0x585c6f){var _0x4cf26e={'raw':![],'where':{'id':_0x5b126e['params']['id']}},_0x57db5e={};_0x57db5e[_0x2deb('0x4c')]=_[_0x2deb('0x66')](_[_0x2deb('0x4f')](db[_0x2deb('0x48')]['rawAttributes']),['password',_0x2deb('0x67')]);_0x57db5e[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x5b126e[_0x2deb('0x4e')]);_0x57db5e[_0x2deb('0x50')]=_['intersection'](_0x57db5e[_0x2deb('0x4c')],_0x57db5e[_0x2deb('0x4e')]);_0x4cf26e[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0x57db5e['model'],qs[_0x2deb('0x53')](_0x5b126e[_0x2deb('0x4e')]['fields']));_0x4cf26e[_0x2deb('0x52')]=_0x4cf26e['attributes'][_0x2deb('0x54')]?_0x4cf26e[_0x2deb('0x52')]:_0x57db5e[_0x2deb('0x4c')];if(_0x5b126e[_0x2deb('0x4e')][_0x2deb('0x61')]){_0x4cf26e[_0x2deb('0x62')]=[{'all':!![]}];}_0x4cf26e=_[_0x2deb('0x5b')]({},_0x4cf26e,_0x5b126e[_0x2deb('0x68')]);return db[_0x2deb('0x48')][_0x2deb('0x41')](_0x4cf26e)[_0x2deb('0x22')](handleEntityNotFound(_0x585c6f,null))['then'](respondWithResult(_0x585c6f,null))[_0x2deb('0x2c')](handleError(_0x585c6f,null));};exports[_0x2deb('0x36')]=function(_0x47c3ec,_0x19ca38){if(_0x47c3ec[_0x2deb('0x69')]['id']){delete _0x47c3ec[_0x2deb('0x69')]['id'];}delete _0x47c3ec['body'][_0x2deb('0x42')];return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0x47c3ec['params']['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x19ca38,null))[_0x2deb('0x22')](saveUpdates(_0x47c3ec[_0x2deb('0x69')],null))[_0x2deb('0x22')](respondWithResult(_0x19ca38,null))[_0x2deb('0x2c')](handleError(_0x19ca38,null));};exports['describe']=function(_0x426134,_0x35b231){return db[_0x2deb('0x48')][_0x2deb('0x6a')]()[_0x2deb('0x22')](respondWithResult(_0x35b231,null))[_0x2deb('0x2c')](handleError(_0x35b231,null));};exports[_0x2deb('0x6b')]=function(_0x1bfd10,_0x3e538c,_0x5057cf){return db['User']['find']({'where':{'id':_0x1bfd10[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x3e538c,null))[_0x2deb('0x22')](function(_0x448868){if(_0x448868){return _0x448868[_0x2deb('0x6b')](_0x1bfd10[_0x2deb('0x69')]['ids'],_[_0x2deb('0x6d')](_0x1bfd10['body'],[_0x2deb('0x6e'),'id'])||{});}})[_0x2deb('0x22')](respondWithResult(_0x3e538c,null))[_0x2deb('0x2c')](handleError(_0x3e538c,null));};function validateUser(_0x28cf6b){return new BPromise(function(_0x2e3915,_0x7ece15){if(_0x28cf6b[_0x2deb('0x6f')])return _0x2e3915(_0x28cf6b);return db['Setting'][_0x2deb('0x70')](0x1)[_0x2deb('0x22')](function(_0x3763a8){if(_0x3763a8['securePassword'])authService['validatePasswordPattern'](_0x28cf6b[_0x2deb('0x4d')]);db[_0x2deb('0x48')]['max']('internal')['then'](function(_0x8a2443){if(_['isNil'](_0x8a2443)){_0x28cf6b[_0x2deb('0x6f')]=_0x3763a8['min_internal']||0x1;return;}if(_[_0x2deb('0x71')](_0x3763a8[_0x2deb('0x72')])||_0x3763a8[_0x2deb('0x72')]===_0x8a2443){_0x28cf6b[_0x2deb('0x6f')]=_0x8a2443+0x1;return;}if(_0x3763a8[_0x2deb('0x72')]>_0x8a2443){_0x28cf6b[_0x2deb('0x6f')]=_0x3763a8[_0x2deb('0x72')];return;}return db[_0x2deb('0x5e')][_0x2deb('0x4e')](_0x2deb('0x73'),{'type':db[_0x2deb('0x5e')][_0x2deb('0x74')][_0x2deb('0x75')]})[_0x2deb('0x22')](function(_0x3d9cf7){if(_0x3d9cf7&&_0x3d9cf7['length']){for(var _0x4abb54=0x0,_0xafade=_0x3d9cf7[_0x2deb('0x54')];_0x4abb54<_0xafade&&_['isNil'](_0x28cf6b['internal']);_0x4abb54++){if(_0x3763a8[_0x2deb('0x72')]<=_0x3d9cf7[_0x4abb54][_0x2deb('0x76')]){_0x28cf6b[_0x2deb('0x6f')]=_0x3d9cf7[_0x4abb54][_0x2deb('0x76')];}else if(_0x3763a8[_0x2deb('0x72')]>_0x3d9cf7[_0x4abb54]['from']&&_0x3763a8[_0x2deb('0x72')]<=_0x3d9cf7[_0x4abb54]['to']){_0x28cf6b[_0x2deb('0x6f')]=_0x3763a8[_0x2deb('0x72')];}}}if(_[_0x2deb('0x71')](_0x28cf6b[_0x2deb('0x6f')])){_0x28cf6b[_0x2deb('0x6f')]=_0x8a2443+0x1;}return _0x2e3915(_0x28cf6b);});});})[_0x2deb('0x2c')](function(_0x152094){_0x7ece15(_0x152094);});});}function updateUser(_0x5399ec){return new BPromise(function(_0x5b014e,_0x474636){try{if(_0x5399ec[_0x2deb('0x77')]){_0x5399ec[_0x2deb('0x78')]=_0x5399ec['internal'];_0x5399ec[_0x2deb('0x79')]={'mailbox':_0x5399ec[_0x2deb('0x6f')],'password':_0x5399ec['password'],'fullname':_0x5399ec[_0x2deb('0x7a')],'email':_0x5399ec['email']};}if(_0x5399ec[_0x2deb('0x42')]===_0x2deb('0x7b')){if(!_0x5399ec[_0x2deb('0x7c')])_0x5399ec[_0x2deb('0x7c')]=[_0x2deb('0x7d'),_0x2deb('0x7e'),_0x2deb('0x7f'),_0x2deb('0x80'),_0x2deb('0x81'),'104','105',_0x2deb('0x82'),_0x2deb('0x83'),_0x2deb('0x84'),'109','100',_0x2deb('0x85'),_0x2deb('0x86'),'115'];}_0x5b014e(_0x5399ec);}catch(_0x4a0303){_0x474636(_0x4a0303);}});}exports['create']=function(_0x339e92,_0x372053){if(_0x339e92[_0x2deb('0x87')][_0x2deb('0x42')]==='agent')throw new Error(_0x2deb('0x88'));if(_0x339e92['body'][_0x2deb('0x42')]==='user'&&_0x339e92[_0x2deb('0x87')]['role']!==_0x2deb('0x39')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x339e92[_0x2deb('0x69')][_0x2deb('0x42')]==='admin'&&_0x339e92[_0x2deb('0x87')][_0x2deb('0x42')]!==_0x2deb('0x39')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x2deb('0x89')]([_0x339e92[_0x2deb('0x69')]])[_0x2deb('0x22')](function(){return validateUser(_0x339e92['body']);})[_0x2deb('0x22')](function(_0x2bfbd2){return updateUser(_0x2bfbd2)[_0x2deb('0x22')](function(_0x14e745){if(_0x14e745[_0x2deb('0x42')]===_0x2deb('0x39')){_0x14e745[_0x2deb('0x8a')]=_0x339e92['user'][_0x2deb('0x8a')];delete _0x14e745[_0x2deb('0x8b')];}return _0x14e745;});})[_0x2deb('0x22')](function(_0x196c16){return db[_0x2deb('0x48')][_0x2deb('0x8c')](_0x196c16,{'include':[{'model':db['VoiceMail'],'as':_0x2deb('0x79')}]});})['then'](function(_0xdd88ee){if(_0x339e92[_0x2deb('0x69')]['role']===_0x2deb('0x87'))return _0xdd88ee;if(_0x339e92[_0x2deb('0x87')][_0x2deb('0x42')]!==_0x2deb('0x87'))return _0xdd88ee;return db[_0x2deb('0x8d')]['find']({'where':{'name':_0xdd88ee['role']==='agent'?_0x2deb('0x3b'):_0x2deb('0x3c'),'userProfileId':_0x339e92[_0x2deb('0x87')][_0x2deb('0x8b')]},'raw':!![]})[_0x2deb('0x22')](function(_0x51ed1f){if(!_0x51ed1f||_0x51ed1f['autoAssociation']!=0x0)return _0xdd88ee;return db[_0x2deb('0x44')][_0x2deb('0x8c')]({'name':_0xdd88ee[_0x2deb('0x43')],'resourceId':_0xdd88ee['id'],'type':_0x51ed1f['name'],'sectionId':_0x51ed1f['id']},{})[_0x2deb('0x22')](function(){return _0xdd88ee;});})[_0x2deb('0x2c')](function(_0x4add16){logger[_0x2deb('0x28')](_0x2deb('0x8e'),_0x4add16);throw _0x4add16;});})[_0x2deb('0x22')](respondWithResult(_0x372053,0xc9))[_0x2deb('0x2c')](handleError(_0x372053,null));};exports['bulkCreate']=function(_0x16ba6e,_0x23e273){var _0x291043=_0x16ba6e[_0x2deb('0x69')];var _0x5a6499=[];if(_0x16ba6e['user']['role']===_0x2deb('0x7b'))throw new Error(_0x2deb('0x88'));if(_['some'](_0x291043,['role',_0x2deb('0x87')])&&_0x16ba6e[_0x2deb('0x87')][_0x2deb('0x42')]!==_0x2deb('0x39')){throw new Error(_0x2deb('0x8f'));}if(_[_0x2deb('0x90')](_0x291043,[_0x2deb('0x42'),'admin'])&&_0x16ba6e[_0x2deb('0x87')][_0x2deb('0x42')]!==_0x2deb('0x39')){throw new Error(_0x2deb('0x91'));}return licenseUtil[_0x2deb('0x89')](_0x291043)['then'](function(){return validateUser(_0x291043[0x0]);})[_0x2deb('0x22')](function(){for(var _0x280718=0x1;_0x280718<_0x291043['length'];_0x280718++){var _0x475851=_0x291043[_0x280718-0x1][_0x2deb('0x6f')];if(!_0x291043[_0x280718][_0x2deb('0x6f')])_0x291043[_0x280718][_0x2deb('0x6f')]=_0x475851+0x1;_0x5a6499[_0x2deb('0x92')](validateUser(_0x291043[_0x280718]));}return BPromise['all'](_0x5a6499);})[_0x2deb('0x22')](function(){_0x5a6499=[];for(var _0x2ab1f1=0x0;_0x2ab1f1<_0x291043[_0x2deb('0x54')];_0x2ab1f1++){_0x5a6499[_0x2deb('0x92')](updateUser(_0x291043[_0x2ab1f1]));}return BPromise[_0x2deb('0x93')](_0x5a6499);})[_0x2deb('0x22')](function(){return BPromise[_0x2deb('0x94')](_0x291043,function(_0x31dc42){return db[_0x2deb('0x48')][_0x2deb('0x8c')](_0x31dc42,{'include':[{'model':db[_0x2deb('0x79')],'as':_0x2deb('0x79')}]})['then'](function(_0x187cb4){_0x31dc42['id']=_0x187cb4['id'];return _0x31dc42;});});})[_0x2deb('0x22')](function(_0x47accd){if(_0x16ba6e['body'][_0x2deb('0x42')]===_0x2deb('0x87'))return _0x47accd;if(_0x16ba6e['user'][_0x2deb('0x42')]!==_0x2deb('0x87'))return _0x47accd;var _0x8f74a7=_['some'](_0x47accd,function(_0x47a637){return _0x47a637['role']==='agent'||_0x47a637[_0x2deb('0x42')]==='telephone';});if(!_0x8f74a7)return _0x47accd;return db[_0x2deb('0x8d')]['findAll']({'where':{'name':{'$or':[_0x2deb('0x3b'),_0x2deb('0x3c')]},'userProfileId':_0x16ba6e[_0x2deb('0x87')][_0x2deb('0x8b')]},'raw':!![]})[_0x2deb('0x22')](function(_0x4f9dd9){if(_['isEmpty'](_0x4f9dd9)||!_[_0x2deb('0x90')](_0x4f9dd9,[_0x2deb('0x95'),0x0]))return _0x47accd;_0x5a6499=[];var _0x2886f3=_(_0x4f9dd9)['map'](function(_0x14d920){if(_0x14d920[_0x2deb('0x95')]===0x1)return;return _0x14d920[_0x2deb('0x43')]==='Agents'?_0x2deb('0x7b'):_0x2deb('0x96');})[_0x2deb('0x97')]()[_0x2deb('0x3f')]();for(var _0xcf19e=0x0;_0xcf19e<_0x47accd[_0x2deb('0x54')];_0xcf19e++){if(!_[_0x2deb('0x40')](_0x2886f3,_0x47accd[_0xcf19e]['role']))return;var _0x38c2ab=_0x47accd[_0xcf19e][_0x2deb('0x42')]===_0x2deb('0x7b')?_0x2deb('0x3b'):'Telephones';_0x5a6499[_0x2deb('0x92')](db[_0x2deb('0x44')][_0x2deb('0x8c')]({'name':_0x47accd[_0xcf19e][_0x2deb('0x43')],'resourceId':_0x47accd[_0xcf19e]['id'],'type':_0x38c2ab,'sectionId':_['find'](_0x4f9dd9,[_0x2deb('0x43'),_0x38c2ab])['id']},{}));}return BPromise[_0x2deb('0x93')](_0x5a6499);});})[_0x2deb('0x22')](respondWithResult(_0x23e273,0xc9))[_0x2deb('0x2c')](handleError(_0x23e273,null));};exports[_0x2deb('0x98')]=function(_0x4a424a,_0x52fae2,_0x464f96){if(_0x4a424a[_0x2deb('0x69')]['id']){delete _0x4a424a[_0x2deb('0x69')]['id'];}return db['User'][_0x2deb('0x41')]({'where':{'id':_0x4a424a[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](function(_0x15aac4){if(!_0x15aac4)return null;if(_0x15aac4['id']===_0x4a424a[_0x2deb('0x87')]['id']){if(!_0x4a424a[_0x2deb('0x69')][_0x2deb('0x99')]||!_0x4a424a[_0x2deb('0x69')][_0x2deb('0x9a')]){throw new db['Sequelize'][(_0x2deb('0x9b'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x15aac4[_0x2deb('0x9c')](_0x4a424a['body'][_0x2deb('0x99')])){throw new db['Sequelize']['ValidationError'](_0x2deb('0x9d'));}if(_0x4a424a[_0x2deb('0x69')][_0x2deb('0x99')]===_0x4a424a[_0x2deb('0x69')][_0x2deb('0x9a')]){throw new db['Sequelize'][(_0x2deb('0x9b'))](_0x2deb('0x9e'));}}else if(_0x4a424a[_0x2deb('0x87')][_0x2deb('0x42')]===_0x2deb('0x39')){if(!_0x4a424a['body'][_0x2deb('0x9a')]){throw new db[(_0x2deb('0x9f'))][(_0x2deb('0x9b'))](_0x2deb('0xa0'));}}else if(_0x4a424a[_0x2deb('0x87')][_0x2deb('0x42')]===_0x2deb('0x87')){if(!_0x4a424a[_0x2deb('0x69')][_0x2deb('0x9a')]){throw new db[(_0x2deb('0x9f'))][(_0x2deb('0x9b'))](_0x2deb('0xa0'));}if(_0x15aac4[_0x2deb('0x42')]!==_0x2deb('0x7b')){throw new db['Sequelize']['ValidationError']('Unauthorized');}}else{throw new db[(_0x2deb('0x9f'))]['ValidationError'](_0x2deb('0x88'));}return _0x15aac4;})[_0x2deb('0x22')](handleEntityNotFound(_0x52fae2,null))[_0x2deb('0x22')](function(_0x3822de){return db[_0x2deb('0xa1')][_0x2deb('0xa2')]({'attributes':['id','securePassword',_0x2deb('0xa3'),'passwordHistoryLimit']})['then'](function(_0x4f4e7c){if(_0x4f4e7c[_0x2deb('0xa4')])authService['validatePasswordPattern'](_0x4a424a[_0x2deb('0x69')]['newPassword']);if(!_0x4f4e7c[_0x2deb('0xa3')]||!_0x3822de[_0x2deb('0xa5')])return _0x3822de;authService[_0x2deb('0xa6')](_0x4a424a['body'][_0x2deb('0x9a')],_0x3822de[_0x2deb('0xa5')],_0x4f4e7c[_0x2deb('0xa7')]);return _0x3822de;})[_0x2deb('0x22')](saveUpdates({'password':_0x4a424a[_0x2deb('0x69')]['newPassword'],'passwordResetAt':_0x4a424a[_0x2deb('0x87')]['id']==_0x4a424a[_0x2deb('0x6c')]['id']?moment():null,'previousPasswords':authService[_0x2deb('0xa8')](_0x4a424a[_0x2deb('0x69')][_0x2deb('0x9a')],_0x3822de[_0x2deb('0xa5')])},null));})[_0x2deb('0x22')](respondWithResult(_0x52fae2,null))[_0x2deb('0x2c')](handleError(_0x52fae2,null));};exports[_0x2deb('0xa9')]=function(_0x1257cd,_0x327f76,_0x212a35){var _0x367135=_0x1257cd['body']['channel'];return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0x1257cd[_0x2deb('0x6c')]['id']},'attributes':['id',_0x2deb('0x43'),_0x2deb('0x42'),_0x2deb('0xaa'),_0x2deb('0xab'),_0x2deb('0xac'),_0x2deb('0xad')]})['then'](handleEntityNotFound(_0x327f76,null))[_0x2deb('0x22')](function(_0x573e13){if(_0x573e13){if(!utils[_0x2deb('0xae')](_0x367135)){throw new db[(_0x2deb('0x9f'))][(_0x2deb('0x9b'))]('Unknown\x20channel');}return _0x573e13[_0x2deb('0xaf')+_['capitalize'](_0x367135[_0x2deb('0xb0')]())+_0x2deb('0xb1')](_0x1257cd[_0x2deb('0x69')][_0x2deb('0x6e')],{'penalty':_0x1257cd[_0x2deb('0x69')][_0x2deb('0xb2')]||0x0})[_0x2deb('0xb3')](function(_0x583572){for(var _0x2fe1b3=0x0;_0x2fe1b3<_0x1257cd['body']['ids'][_0x2deb('0x54')];_0x2fe1b3+=0x1){var _0x53f373={'UserId':_0x1257cd[_0x2deb('0x6c')]['id']};_0x53f373[_['capitalize'](_0x367135[_0x2deb('0xb0')]())+'QueueId']=_0x1257cd[_0x2deb('0x69')][_0x2deb('0x6e')][_0x2fe1b3];socket[_0x2deb('0xb4')](_0x2deb('0x87')+_[_0x2deb('0xb5')](_0x367135[_0x2deb('0xb0')]())+_0x2deb('0xb6'),_0x53f373);}return _0x583572;})[_0x2deb('0x22')](function(){if(_0x367135===_0x2deb('0xb7')){return db['VoiceQueue'][_0x2deb('0x63')]({'where':{'id':_0x1257cd[_0x2deb('0x69')][_0x2deb('0x6e')]||[]},'raw':!![],'attributes':['id',_0x2deb('0x43')]});}})[_0x2deb('0x22')](function(_0x4692a8){var _0x1b3bfb=_0x573e13['get']({'plain':!![]});var _0x1fe677=[];if(_0x367135==='voice'&&_0x1b3bfb['role']===_0x2deb('0x7b')&&_0x1b3bfb[_0x2deb('0xaa')]){for(var _0x56f061=0x0;_0x56f061<_0x4692a8['length'];_0x56f061+=0x1){_0x1fe677[_0x2deb('0x92')]({'membername':_0x1b3bfb['name'],'UserId':_0x1b3bfb['id'],'queue_name':_0x4692a8[_0x56f061][_0x2deb('0x43')],'VoiceQueueId':_0x4692a8[_0x56f061]['id'],'interface':_[_0x2deb('0x71')](_0x1b3bfb['interface'])?util['format'](_0x2deb('0xb8'),_0x1b3bfb['name']):_0x1b3bfb['interface'],'paused':_0x1b3bfb[_0x2deb('0xac')]||![],'penalty':_0x1257cd[_0x2deb('0x69')][_0x2deb('0xb2')]||0x0});}return BPromise[_0x2deb('0x94')](_0x1fe677,function(_0x827fea){return db['UserVoiceQueueRt'][_0x2deb('0xb9')](_0x827fea);});}return _0x573e13;});}})[_0x2deb('0x22')](respondWithStatusCode(_0x327f76,null))[_0x2deb('0x2c')](handleError(_0x327f76,null));};exports[_0x2deb('0xba')]=function(_0xe8e6a5,_0x97f6d7,_0x81a47d){var _0x23b8db;return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0xe8e6a5[_0x2deb('0x6c')]['id']},'attributes':['id',_0x2deb('0x43'),'role']})[_0x2deb('0x22')](handleEntityNotFound(_0x97f6d7,null))[_0x2deb('0x22')](function(_0x560753){if(_0x560753){_0x23b8db=_0x560753;if(!_0xe8e6a5[_0x2deb('0x4e')][_0x2deb('0xbb')]||!utils['isValidChannel'](_0xe8e6a5['query'][_0x2deb('0xbb')])){throw new db[(_0x2deb('0x9f'))]['ValidationError']('Unknown\x20channel');}return _0x560753['remove'+_[_0x2deb('0xb5')](_0xe8e6a5[_0x2deb('0x4e')][_0x2deb('0xbb')][_0x2deb('0xb0')]())+'Queues'](_0xe8e6a5[_0x2deb('0x4e')][_0x2deb('0x6e')]);}})[_0x2deb('0x22')](function(_0x3fe71e){for(var _0x58dfea=0x0;_0x58dfea<_0xe8e6a5[_0x2deb('0x4e')]['ids'][_0x2deb('0x54')];_0x58dfea+=0x1){var _0x6a7f3f={'UserId':_0xe8e6a5[_0x2deb('0x6c')]['id']};_0x6a7f3f[_[_0x2deb('0xb5')](_0xe8e6a5[_0x2deb('0x4e')]['channel'][_0x2deb('0xb0')]())+_0x2deb('0xbc')]=_0xe8e6a5[_0x2deb('0x4e')][_0x2deb('0x6e')][_0x58dfea];socket[_0x2deb('0xb4')](_0x2deb('0x87')+_['capitalize'](_0xe8e6a5['query'][_0x2deb('0xbb')][_0x2deb('0xb0')]())+_0x2deb('0xbd'),_0x6a7f3f);}return _0x3fe71e;})[_0x2deb('0x22')](function(){if(_0xe8e6a5[_0x2deb('0x4e')]['channel']===_0x2deb('0xb7')){return db[_0x2deb('0xbe')][_0x2deb('0x37')]({'where':{'UserId':_0xe8e6a5[_0x2deb('0x6c')]['id'],'VoiceQueueId':_0xe8e6a5['query'][_0x2deb('0x6e')]},'individualHooks':!![]})[_0x2deb('0x22')](function(){return _0x23b8db;});}return _0x23b8db;})[_0x2deb('0x22')](respondWithStatusCode(_0x97f6d7,null))[_0x2deb('0x2c')](handleError(_0x97f6d7,null));};exports[_0x2deb('0xbf')]=function(_0x54f01f,_0x7a514,_0x457a7e){_0x54f01f['body']['userpic']=_0x54f01f[_0x2deb('0xc0')][_0x2deb('0xc1')];return db['User']['find']({'where':{'id':_0x54f01f[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x7a514,null))[_0x2deb('0x22')](saveUpdates(_0x54f01f[_0x2deb('0x69')],null))[_0x2deb('0x22')](respondWithResult(_0x7a514,null))[_0x2deb('0x2c')](handleError(_0x7a514,null));};exports['getAvatar']=function(_0x56ac16,_0xa0f207,_0xa9faf){var _0xefe2e7=path[_0x2deb('0xc2')](config[_0x2deb('0xc3')],_0x2deb('0xc4'));return db['User'][_0x2deb('0x41')]({'where':{'id':_0x56ac16[_0x2deb('0x6c')]['id']},'attributes':['id',_0x2deb('0xc5')],'raw':!![]})[_0x2deb('0x22')](handleEntityNotFound(_0xa0f207,null))['then'](function(_0x402f64){if(_0x402f64){if(_[_0x2deb('0x71')](_0x402f64[_0x2deb('0xc5')])){return _0xa0f207[_0x2deb('0xc6')](_0xefe2e7);}else{if(!fs[_0x2deb('0xc7')](path[_0x2deb('0xc2')](config[_0x2deb('0xc3')],_0x2deb('0xc8'),_0x402f64[_0x2deb('0xc5')]))){return _0xa0f207[_0x2deb('0xc6')](_0xefe2e7);}return _0xa0f207[_0x2deb('0xc6')](path[_0x2deb('0xc2')](config[_0x2deb('0xc3')],'server/files/images/',_0x402f64[_0x2deb('0xc5')]));}}})[_0x2deb('0x2c')](handleError(_0xa0f207,null));};exports[_0x2deb('0xc9')]=function(_0x5b2c54,_0x2cf95f,_0x3f61d7){var _0x298b1b={};var _0x3f3ec0={};var _0x4dff6f;var _0x6459f8;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x5b2c54[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x2cf95f,null))[_0x2deb('0x22')](function(_0x70c072){if(_0x70c072){_0x4dff6f=_0x70c072;_0x3f3ec0[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xca')]['rawAttributes']);_0x3f3ec0[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x5b2c54[_0x2deb('0x4e')]);_0x3f3ec0[_0x2deb('0x50')]=_['intersection'](_0x3f3ec0[_0x2deb('0x4c')],_0x3f3ec0['query']);_0x298b1b[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0x3f3ec0[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x5b2c54[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x298b1b[_0x2deb('0x52')]=_0x298b1b[_0x2deb('0x52')][_0x2deb('0x54')]?_0x298b1b['attributes']:_0x3f3ec0[_0x2deb('0x4c')];_0x298b1b[_0x2deb('0xcb')]=qs[_0x2deb('0x57')](_0x5b2c54['query']['sort']);_0x298b1b[_0x2deb('0x58')]=qs['filters'](_['pick'](_0x5b2c54[_0x2deb('0x4e')],_0x3f3ec0[_0x2deb('0x50')]));if(_0x5b2c54[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x298b1b[_0x2deb('0x58')]=_[_0x2deb('0x5b')](_0x298b1b[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x298b1b[_0x2deb('0x52')],function(_0x214575){var _0x56ebee={};_0x56ebee[_0x214575]={'$like':'%'+_0x5b2c54['query'][_0x2deb('0x5a')]+'%'};return _0x56ebee;})});}_0x298b1b=_[_0x2deb('0x5b')]({},_0x298b1b,_0x5b2c54[_0x2deb('0x68')]);return _0x4dff6f[_0x2deb('0xc9')](_0x298b1b);}})[_0x2deb('0x22')](function(_0x485113){if(_0x485113){_0x6459f8=_0x485113[_0x2deb('0x54')];if(_0x5b2c54[_0x2deb('0x4e')]['hasOwnProperty'](_0x2deb('0x61'))){_0x298b1b[_0x2deb('0x62')]=[{'model':db[_0x2deb('0xcc')],'as':_0x2deb('0xcd'),'required':![]},{'model':db[_0x2deb('0xce')],'as':_0x2deb('0xcf'),'attributes':['id',_0x2deb('0x43'),_0x2deb('0xd0')],'where':_0x5b2c54[_0x2deb('0x4e')][_0x2deb('0xd1')]?{'id':_0x5b2c54[_0x2deb('0x4e')][_0x2deb('0xd1')]}:undefined,'required':_0x5b2c54[_0x2deb('0x4e')][_0x2deb('0xd1')]?!![]:![]}];}if(!_0x5b2c54['query'][_0x2deb('0x55')](_0x2deb('0x56'))){_0x298b1b[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x5b2c54[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x298b1b[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x5b2c54['query']['offset']);}return _0x4dff6f[_0x2deb('0xc9')](_0x298b1b);}})[_0x2deb('0x22')](function(_0x4d5eca){if(_0x4d5eca){return _0x4d5eca?{'count':_0x6459f8,'rows':_0x4d5eca}:null;}})[_0x2deb('0x22')](respondWithResult(_0x2cf95f,null))['catch'](handleError(_0x2cf95f,null));};exports['getQueues']=function(_0x4e5551,_0x58c969,_0x53cc6e){var _0x120be6;var _0x4fab6f;var _0x1c8f43={};var _0x14af59;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x4e5551[_0x2deb('0x6c')]['id']},'attributes':['id',_0x2deb('0x43'),_0x2deb('0x42')]})[_0x2deb('0x22')](handleEntityNotFound(_0x58c969,null))[_0x2deb('0x22')](function(_0x42e17e){if(!utils[_0x2deb('0xae')](_0x4e5551['query'][_0x2deb('0xbb')])){throw new db[(_0x2deb('0x9f'))]['ValidationError']('Unknown\x20channel');}_0x120be6=_0x42e17e;var _0xaa7ffd={};_0xaa7ffd['model']=_[_0x2deb('0x4f')](db[_[_0x2deb('0xb5')](_0x4e5551[_0x2deb('0x4e')][_0x2deb('0xbb')])+_0x2deb('0xd2')]['rawAttributes']);_0xaa7ffd[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x4e5551['query']);_0xaa7ffd[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0xaa7ffd['model'],_0xaa7ffd[_0x2deb('0x4e')]);_0x1c8f43[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0xaa7ffd[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x4e5551[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x1c8f43['attributes']=_0x1c8f43[_0x2deb('0x52')][_0x2deb('0x54')]?_0x1c8f43['attributes']:_0xaa7ffd[_0x2deb('0x4c')];_0x1c8f43[_0x2deb('0xcb')]=qs[_0x2deb('0x57')](_0x4e5551['query'][_0x2deb('0x57')]);_0x1c8f43['where']=qs['filters'](_['pick'](_0x4e5551['query'],_0xaa7ffd[_0x2deb('0x50')]));if(_0x4e5551[_0x2deb('0x4e')]['filter']){_0x1c8f43['where']=_[_0x2deb('0x5b')](_0x1c8f43[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x1c8f43[_0x2deb('0x52')],function(_0x1820aa){var _0xe32198={};_0xe32198[_0x1820aa]={'$like':'%'+_0x4e5551[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0xe32198;})});}_0x1c8f43=_[_0x2deb('0x5b')]({},_0x1c8f43,_0x4e5551[_0x2deb('0x68')]);switch(_0x120be6['role']){case _0x2deb('0x39'):return db[_[_0x2deb('0xb5')](_0x4e5551[_0x2deb('0x4e')][_0x2deb('0xbb')])+'Queue'][_0x2deb('0x63')](_0x1c8f43);case _0x2deb('0x87'):case _0x2deb('0x7b'):return _0x120be6['get'+_[_0x2deb('0xb5')](_0x4e5551['query'][_0x2deb('0xbb')])+_0x2deb('0xb1')](_0x1c8f43);default:throw new db['Sequelize'][(_0x2deb('0x9b'))](_0x2deb('0xd3'));}})[_0x2deb('0x22')](function(_0x398001){_0x14af59=_0x398001[_0x2deb('0x54')];if(!_0x4e5551[_0x2deb('0x4e')][_0x2deb('0x55')]('nolimit')){_0x1c8f43[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x4e5551[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x1c8f43[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x4e5551[_0x2deb('0x4e')]['offset']);}switch(_0x120be6['role']){case _0x2deb('0x39'):return db[_['capitalize'](_0x4e5551[_0x2deb('0x4e')][_0x2deb('0xbb')])+_0x2deb('0xd2')]['findAll'](_0x1c8f43);case _0x2deb('0x87'):case'agent':return _0x120be6[_0x2deb('0x38')+_['capitalize'](_0x4e5551[_0x2deb('0x4e')]['channel'])+_0x2deb('0xb1')](_0x1c8f43);}})[_0x2deb('0x22')](function(_0x331490){return{'count':_0x14af59,'rows':_0x331490};})[_0x2deb('0x22')](respondWithResult(_0x58c969,null))[_0x2deb('0x2c')](handleError(_0x58c969,null));};exports[_0x2deb('0xd4')]=function(_0x40a3a1,_0x43531e,_0x5a7365){var _0x2e9068={};var _0x85f197={};var _0x26d2c3;var _0x2a7a7c;return db['User'][_0x2deb('0xa2')]({'where':{'id':_0x40a3a1[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x43531e,null))[_0x2deb('0x22')](function(_0x31b98f){if(_0x31b98f){_0x26d2c3=_0x31b98f;_0x85f197[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xbe')][_0x2deb('0x49')]);_0x85f197[_0x2deb('0x4e')]=_['keys'](_0x40a3a1[_0x2deb('0x4e')]);_0x85f197[_0x2deb('0x50')]=_['intersection'](_0x85f197[_0x2deb('0x4c')],_0x85f197['query']);_0x2e9068[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0x85f197[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x40a3a1[_0x2deb('0x4e')]['fields']));_0x2e9068[_0x2deb('0x52')]=_0x2e9068[_0x2deb('0x52')][_0x2deb('0x54')]?_0x2e9068['attributes']:_0x85f197[_0x2deb('0x4c')];_0x2e9068[_0x2deb('0xcb')]=qs['sort'](_0x40a3a1[_0x2deb('0x4e')][_0x2deb('0x57')]);_0x2e9068[_0x2deb('0x58')]=qs['filters'](_[_0x2deb('0x59')](_0x40a3a1['query'],_0x85f197[_0x2deb('0x50')]));if(_0x40a3a1[_0x2deb('0x4e')]['filter']){_0x2e9068['where']=_[_0x2deb('0x5b')](_0x2e9068[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x2e9068[_0x2deb('0x52')],function(_0x17d204){var _0x2afbd7={};_0x2afbd7[_0x17d204]={'$like':'%'+_0x40a3a1[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x2afbd7;})});}_0x2e9068=_[_0x2deb('0x5b')]({},_0x2e9068,_0x40a3a1[_0x2deb('0x68')]);return _0x26d2c3[_0x2deb('0xd4')](_0x2e9068);}})['then'](function(_0x3d3ae4){if(_0x3d3ae4){_0x2a7a7c=_0x3d3ae4[_0x2deb('0x54')];if(!_0x40a3a1['query']['hasOwnProperty']('nolimit')){_0x2e9068['limit']=qs['limit'](_0x40a3a1[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x2e9068['offset']=qs[_0x2deb('0x31')](_0x40a3a1[_0x2deb('0x4e')]['offset']);}return _0x26d2c3['getVoiceQueuesRt'](_0x2e9068);}})[_0x2deb('0x22')](function(_0xc00386){if(_0xc00386){return _0xc00386?{'count':_0x2a7a7c,'rows':_0xc00386}:null;}})[_0x2deb('0x22')](respondWithResult(_0x43531e,null))[_0x2deb('0x2c')](handleError(_0x43531e,null));};exports[_0x2deb('0xd5')]=function(_0x553704,_0x1e4d8b,_0x510c34){var _0x32cadf={};var _0x1961e6={};var _0x4dcb36;var _0x39ef7f;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x553704[_0x2deb('0x6c')]['id']}})['then'](handleEntityNotFound(_0x1e4d8b,null))[_0x2deb('0x22')](function(_0x11e926){if(_0x11e926){_0x4dcb36=_0x11e926;_0x1961e6[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xd6')]['rawAttributes']);_0x1961e6[_0x2deb('0x4e')]=_['keys'](_0x553704[_0x2deb('0x4e')]);_0x1961e6[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x1961e6[_0x2deb('0x4c')],_0x1961e6[_0x2deb('0x4e')]);_0x32cadf[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0x1961e6[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x553704['query'][_0x2deb('0x53')]));_0x32cadf[_0x2deb('0x52')]=_0x32cadf[_0x2deb('0x52')][_0x2deb('0x54')]?_0x32cadf[_0x2deb('0x52')]:_0x1961e6[_0x2deb('0x4c')];_0x32cadf[_0x2deb('0xcb')]=qs[_0x2deb('0x57')](_0x553704[_0x2deb('0x4e')][_0x2deb('0x57')]);_0x32cadf[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_['pick'](_0x553704[_0x2deb('0x4e')],_0x1961e6[_0x2deb('0x50')]));if(_0x553704[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x32cadf[_0x2deb('0x58')]=_[_0x2deb('0x5b')](_0x32cadf[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x32cadf[_0x2deb('0x52')],function(_0x3dd927){var _0x2b84f8={};_0x2b84f8[_0x3dd927]={'$like':'%'+_0x553704[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x2b84f8;})});}_0x32cadf=_[_0x2deb('0x5b')]({},_0x32cadf,_0x553704['options']);return _0x4dcb36[_0x2deb('0xd5')](_0x32cadf);}})[_0x2deb('0x22')](function(_0x5442cf){if(_0x5442cf){_0x39ef7f=_0x5442cf[_0x2deb('0x54')];if(!_0x553704['query'][_0x2deb('0x55')]('nolimit')){_0x32cadf[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x553704['query'][_0x2deb('0x32')]);_0x32cadf[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x553704[_0x2deb('0x4e')][_0x2deb('0x31')]);}return _0x4dcb36['getGroups'](_0x32cadf);}})[_0x2deb('0x22')](function(_0x5b8cc2){if(_0x5b8cc2){return _0x5b8cc2?{'count':_0x39ef7f,'rows':_0x5b8cc2}:null;}})[_0x2deb('0x22')](respondWithResult(_0x1e4d8b,null))[_0x2deb('0x2c')](handleError(_0x1e4d8b,null));};exports[_0x2deb('0xd7')]=function(_0x5630ea,_0x10e17f,_0x59905c){var _0x4e8827={'raw':!![],'where':{}};var _0x26614b={};var _0x2dbc01={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x5630ea[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x10e17f,null))['then'](function(_0x17de6d){if(_0x17de6d){_0x26614b['model']=_[_0x2deb('0x4f')](db[_0x2deb('0xd8')][_0x2deb('0x49')]);_0x26614b[_0x2deb('0x4e')]=_['keys'](_0x5630ea[_0x2deb('0x4e')]);_0x26614b[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x26614b[_0x2deb('0x4c')],_0x26614b[_0x2deb('0x4e')]);_0x4e8827[_0x2deb('0x52')]=_['intersection'](_0x26614b[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x5630ea[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x4e8827[_0x2deb('0x52')]=_0x4e8827[_0x2deb('0x52')][_0x2deb('0x54')]?_0x4e8827[_0x2deb('0x52')]:_0x26614b[_0x2deb('0x4c')];if(!_0x5630ea[_0x2deb('0x4e')][_0x2deb('0x55')](_0x2deb('0x56'))){_0x4e8827[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x5630ea[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x4e8827['offset']=qs[_0x2deb('0x31')](_0x5630ea[_0x2deb('0x4e')][_0x2deb('0x31')]);}_0x4e8827[_0x2deb('0xcb')]=qs[_0x2deb('0x57')](_0x5630ea['query'][_0x2deb('0x57')]);_0x4e8827[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_['pick'](_0x5630ea[_0x2deb('0x4e')],_0x26614b[_0x2deb('0x50')]));_0x4e8827[_0x2deb('0x58')][_0x2deb('0xd9')]=_0x17de6d['id'];if(_0x5630ea[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x4e8827['where']=_[_0x2deb('0x5b')](_0x4e8827[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x4e8827[_0x2deb('0x52')],function(_0x1a23fe){var _0x4b65b6={};_0x4b65b6[_0x1a23fe]={'$like':'%'+_0x5630ea[_0x2deb('0x4e')]['filter']+'%'};return _0x4b65b6;})});}_0x4e8827=_[_0x2deb('0x5b')]({},_0x4e8827,_0x5630ea[_0x2deb('0x68')]);return db[_0x2deb('0xd8')][_0x2deb('0x30')]({'where':_0x4e8827[_0x2deb('0x58')]})[_0x2deb('0x22')](function(_0x25fc32){_0x2dbc01['count']=_0x25fc32;if(_0x5630ea['query']['includeAll']){_0x4e8827[_0x2deb('0x62')]=[{'all':!![]}];}return db[_0x2deb('0xd8')][_0x2deb('0x63')](_0x4e8827);})['then'](function(_0x4bb64e){_0x2dbc01['rows']=_0x4bb64e;return _0x2dbc01;});}})[_0x2deb('0x22')](respondWithFilteredResult(_0x10e17f,_0x4e8827))[_0x2deb('0x2c')](handleError(_0x10e17f,null));};exports[_0x2deb('0xda')]=function(_0x16b1c9,_0x22bcaf,_0x2c6333){var _0x5968c5={'raw':!![],'where':{}};var _0x580264={};var _0x2d5faa={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x16b1c9[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x22bcaf,null))['then'](function(_0x5c13ae){if(_0x5c13ae){_0x580264[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xdb')]['rawAttributes']);_0x580264['query']=_['keys'](_0x16b1c9[_0x2deb('0x4e')]);_0x580264[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x580264['model'],_0x580264[_0x2deb('0x4e')]);_0x5968c5['attributes']=_[_0x2deb('0x51')](_0x580264[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x16b1c9[_0x2deb('0x4e')]['fields']));_0x5968c5['attributes']=_0x5968c5[_0x2deb('0x52')][_0x2deb('0x54')]?_0x5968c5[_0x2deb('0x52')]:_0x580264['model'];if(!_0x16b1c9['query'][_0x2deb('0x55')](_0x2deb('0x56'))){_0x5968c5[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x16b1c9[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x5968c5[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x16b1c9['query'][_0x2deb('0x31')]);}_0x5968c5['order']=qs[_0x2deb('0x57')](_0x16b1c9[_0x2deb('0x4e')]['sort']);_0x5968c5[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_[_0x2deb('0x59')](_0x16b1c9[_0x2deb('0x4e')],_0x580264[_0x2deb('0x50')]));_0x5968c5[_0x2deb('0x58')][_0x2deb('0xd9')]=_0x5c13ae['id'];if(_0x16b1c9[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x5968c5['where']=_[_0x2deb('0x5b')](_0x5968c5[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x5968c5[_0x2deb('0x52')],function(_0x349554){var _0xe06b16={};_0xe06b16[_0x349554]={'$like':'%'+_0x16b1c9['query'][_0x2deb('0x5a')]+'%'};return _0xe06b16;})});}_0x5968c5=_[_0x2deb('0x5b')]({},_0x5968c5,_0x16b1c9[_0x2deb('0x68')]);return db[_0x2deb('0xdb')]['count']({'where':_0x5968c5['where']})[_0x2deb('0x22')](function(_0x4eda04){_0x2d5faa[_0x2deb('0x30')]=_0x4eda04;if(_0x16b1c9[_0x2deb('0x4e')][_0x2deb('0x61')]){_0x5968c5[_0x2deb('0x62')]=[{'all':!![]}];}return db[_0x2deb('0xdb')]['findAll'](_0x5968c5);})[_0x2deb('0x22')](function(_0x2267a1){_0x2d5faa[_0x2deb('0x64')]=_0x2267a1;return _0x2d5faa;});}})[_0x2deb('0x22')](respondWithFilteredResult(_0x22bcaf,_0x5968c5))[_0x2deb('0x2c')](handleError(_0x22bcaf,null));};exports[_0x2deb('0xdc')]=function(_0x45a28f,_0x273c2a,_0x1be56b){var _0x299def={};var _0x1f5af6={};var _0x27bc73;var _0x2f04de;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x45a28f[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x273c2a,null))[_0x2deb('0x22')](function(_0x464a29){if(_0x464a29){_0x27bc73=_0x464a29;_0x1f5af6[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xdd')][_0x2deb('0x49')]);_0x1f5af6[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x45a28f[_0x2deb('0x4e')]);_0x1f5af6['filters']=_[_0x2deb('0x51')](_0x1f5af6[_0x2deb('0x4c')],_0x1f5af6[_0x2deb('0x4e')]);_0x299def[_0x2deb('0x52')]=_['intersection'](_0x1f5af6[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x45a28f[_0x2deb('0x4e')]['fields']));_0x299def[_0x2deb('0x52')]=_0x299def['attributes'][_0x2deb('0x54')]?_0x299def[_0x2deb('0x52')]:_0x1f5af6[_0x2deb('0x4c')];_0x299def['order']=qs[_0x2deb('0x57')](_0x45a28f[_0x2deb('0x4e')][_0x2deb('0x57')]);_0x299def[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_[_0x2deb('0x59')](_0x45a28f['query'],_0x1f5af6[_0x2deb('0x50')]));if(_0x45a28f[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x299def[_0x2deb('0x58')]=_[_0x2deb('0x5b')](_0x299def[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x299def['attributes'],function(_0x229cac){var _0x2383b4={};_0x2383b4[_0x229cac]={'$like':'%'+_0x45a28f[_0x2deb('0x4e')]['filter']+'%'};return _0x2383b4;})});}_0x299def=_[_0x2deb('0x5b')]({},_0x299def,_0x45a28f[_0x2deb('0x68')]);return _0x27bc73[_0x2deb('0xdc')](_0x299def);}})[_0x2deb('0x22')](function(_0x34507a){if(_0x34507a){_0x2f04de=_0x34507a[_0x2deb('0x54')];if(!_0x45a28f[_0x2deb('0x4e')]['hasOwnProperty']('nolimit')){_0x299def['limit']=qs[_0x2deb('0x32')](_0x45a28f[_0x2deb('0x4e')]['limit']);_0x299def[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x45a28f[_0x2deb('0x4e')][_0x2deb('0x31')]);}return _0x27bc73['getChatInteractions'](_0x299def);}})['then'](function(_0x375299){if(_0x375299){return _0x375299?{'count':_0x2f04de,'rows':_0x375299}:null;}})[_0x2deb('0x22')](respondWithResult(_0x273c2a,null))[_0x2deb('0x2c')](handleError(_0x273c2a,null));};exports[_0x2deb('0xde')]=function(_0x1bb253,_0x50ef09,_0x1b0050){var _0x5ca316={};var _0x56be6c={};var _0x50afee;var _0x47d499;return db[_0x2deb('0x48')]['findOne']({'where':{'id':_0x1bb253[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x50ef09,null))[_0x2deb('0x22')](function(_0x32db9c){if(_0x32db9c){_0x50afee=_0x32db9c;_0x56be6c[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xdf')][_0x2deb('0x49')]);_0x56be6c[_0x2deb('0x4e')]=_['keys'](_0x1bb253[_0x2deb('0x4e')]);_0x56be6c[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x56be6c['model'],_0x56be6c['query']);_0x5ca316['attributes']=_[_0x2deb('0x51')](_0x56be6c['model'],qs['fields'](_0x1bb253['query']['fields']));_0x5ca316['attributes']=_0x5ca316[_0x2deb('0x52')][_0x2deb('0x54')]?_0x5ca316['attributes']:_0x56be6c[_0x2deb('0x4c')];_0x5ca316[_0x2deb('0xcb')]=qs[_0x2deb('0x57')](_0x1bb253[_0x2deb('0x4e')]['sort']);_0x5ca316[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_[_0x2deb('0x59')](_0x1bb253[_0x2deb('0x4e')],_0x56be6c[_0x2deb('0x50')]));if(_0x1bb253[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x5ca316['where']=_['merge'](_0x5ca316[_0x2deb('0x58')],{'$or':_['map'](_0x5ca316[_0x2deb('0x52')],function(_0x45a24f){var _0x2ecadc={};_0x2ecadc[_0x45a24f]={'$like':'%'+_0x1bb253[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x2ecadc;})});}_0x5ca316=_[_0x2deb('0x5b')]({},_0x5ca316,_0x1bb253['options']);return _0x50afee[_0x2deb('0xde')](_0x5ca316);}})[_0x2deb('0x22')](function(_0x564a8d){if(_0x564a8d){_0x47d499=_0x564a8d['length'];if(!_0x1bb253[_0x2deb('0x4e')]['hasOwnProperty'](_0x2deb('0x56'))){_0x5ca316['limit']=qs[_0x2deb('0x32')](_0x1bb253[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x5ca316[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x1bb253[_0x2deb('0x4e')]['offset']);}return _0x50afee[_0x2deb('0xde')](_0x5ca316);}})[_0x2deb('0x22')](function(_0x5e6cde){if(_0x5e6cde){return _0x5e6cde?{'count':_0x47d499,'rows':_0x5e6cde}:null;}})['then'](respondWithResult(_0x50ef09,null))[_0x2deb('0x2c')](handleError(_0x50ef09,null));};exports[_0x2deb('0xe0')]=function(_0x57e0a8,_0x293807,_0x5c20ec){var _0x4a3014={'raw':!![],'where':{}};var _0x243bfc={};var _0x152d52={'count':0x0,'rows':[]};return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x57e0a8[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x293807,null))[_0x2deb('0x22')](function(_0x5c4083){if(_0x5c4083){_0x243bfc[_0x2deb('0x4c')]=_['keys'](db['MailInteraction'][_0x2deb('0x49')]);_0x243bfc['query']=_[_0x2deb('0x4f')](_0x57e0a8[_0x2deb('0x4e')]);_0x243bfc['filters']=_[_0x2deb('0x51')](_0x243bfc['model'],_0x243bfc[_0x2deb('0x4e')]);_0x4a3014[_0x2deb('0x52')]=_['intersection'](_0x243bfc[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x57e0a8[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x4a3014[_0x2deb('0x52')]=_0x4a3014[_0x2deb('0x52')][_0x2deb('0x54')]?_0x4a3014[_0x2deb('0x52')]:_0x243bfc['model'];if(!_0x57e0a8['query'][_0x2deb('0x55')](_0x2deb('0x56'))){_0x4a3014[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x57e0a8[_0x2deb('0x4e')][_0x2deb('0x32')]);_0x4a3014[_0x2deb('0x31')]=qs['offset'](_0x57e0a8['query'][_0x2deb('0x31')]);}_0x4a3014['order']=qs[_0x2deb('0x57')](_0x57e0a8['query'][_0x2deb('0x57')]);_0x4a3014[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_['pick'](_0x57e0a8[_0x2deb('0x4e')],_0x243bfc['filters']));_0x4a3014['where'][_0x2deb('0xd9')]=_0x5c4083['id'];if(_0x57e0a8[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x4a3014[_0x2deb('0x58')]=_[_0x2deb('0x5b')](_0x4a3014[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x4a3014[_0x2deb('0x52')],function(_0x4fecc5){var _0x5d4851={};_0x5d4851[_0x4fecc5]={'$like':'%'+_0x57e0a8[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x5d4851;})});}_0x4a3014=_[_0x2deb('0x5b')]({},_0x4a3014,_0x57e0a8[_0x2deb('0x68')]);return db[_0x2deb('0xe1')]['count']({'where':_0x4a3014['where']})[_0x2deb('0x22')](function(_0x37d294){_0x152d52[_0x2deb('0x30')]=_0x37d294;if(_0x57e0a8[_0x2deb('0x4e')][_0x2deb('0x61')]){_0x4a3014[_0x2deb('0x62')]=[{'all':!![]}];}return db[_0x2deb('0xe1')][_0x2deb('0x63')](_0x4a3014);})[_0x2deb('0x22')](function(_0x1d67ea){_0x152d52['rows']=_0x1d67ea;return _0x152d52;});}})['then'](respondWithFilteredResult(_0x293807,_0x4a3014))['catch'](handleError(_0x293807,null));};exports[_0x2deb('0xe2')]=function(_0x3c68a2,_0x2d2466,_0x21d6a7){var _0x15a096={};var _0x3af195={};var _0x44ef76;var _0x23a1e1;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x3c68a2['params']['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x2d2466,null))[_0x2deb('0x22')](function(_0x4e61d9){if(_0x4e61d9){_0x44ef76=_0x4e61d9;_0x3af195['model']=_[_0x2deb('0x4f')](db[_0x2deb('0xe3')][_0x2deb('0x49')]);_0x3af195[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x3c68a2[_0x2deb('0x4e')]);_0x3af195[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x3af195[_0x2deb('0x4c')],_0x3af195[_0x2deb('0x4e')]);_0x15a096['attributes']=_[_0x2deb('0x51')](_0x3af195['model'],qs['fields'](_0x3c68a2['query'][_0x2deb('0x53')]));_0x15a096['attributes']=_0x15a096[_0x2deb('0x52')][_0x2deb('0x54')]?_0x15a096[_0x2deb('0x52')]:_0x3af195[_0x2deb('0x4c')];_0x15a096[_0x2deb('0xcb')]=qs['sort'](_0x3c68a2[_0x2deb('0x4e')][_0x2deb('0x57')]);_0x15a096[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_[_0x2deb('0x59')](_0x3c68a2[_0x2deb('0x4e')],_0x3af195[_0x2deb('0x50')]));if(_0x3c68a2[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x15a096['where']=_[_0x2deb('0x5b')](_0x15a096[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x15a096[_0x2deb('0x52')],function(_0x3171ea){var _0x2e3516={};_0x2e3516[_0x3171ea]={'$like':'%'+_0x3c68a2[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x2e3516;})});}_0x15a096=_[_0x2deb('0x5b')]({},_0x15a096,_0x3c68a2[_0x2deb('0x68')]);return _0x44ef76[_0x2deb('0xe2')](_0x15a096);}})[_0x2deb('0x22')](function(_0x40a164){if(_0x40a164){_0x23a1e1=_0x40a164['length'];if(!_0x3c68a2[_0x2deb('0x4e')][_0x2deb('0x55')](_0x2deb('0x56'))){_0x15a096[_0x2deb('0x32')]=qs['limit'](_0x3c68a2[_0x2deb('0x4e')]['limit']);_0x15a096[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x3c68a2[_0x2deb('0x4e')][_0x2deb('0x31')]);}return _0x44ef76[_0x2deb('0xe2')](_0x15a096);}})[_0x2deb('0x22')](function(_0x5e9076){if(_0x5e9076){return _0x5e9076?{'count':_0x23a1e1,'rows':_0x5e9076}:null;}})[_0x2deb('0x22')](respondWithResult(_0x2d2466,null))[_0x2deb('0x2c')](handleError(_0x2d2466,null));};exports['getFaxInteractions']=function(_0x40cd1b,_0x396130,_0x46844c){var _0x8b00cf={};var _0x479ae9={};var _0x562411;var _0x1a0540;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x40cd1b[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x396130,null))['then'](function(_0x49773b){if(_0x49773b){_0x562411=_0x49773b;_0x479ae9[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xe4')]['rawAttributes']);_0x479ae9['query']=_['keys'](_0x40cd1b[_0x2deb('0x4e')]);_0x479ae9[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x479ae9[_0x2deb('0x4c')],_0x479ae9[_0x2deb('0x4e')]);_0x8b00cf[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0x479ae9[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x40cd1b[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x8b00cf[_0x2deb('0x52')]=_0x8b00cf[_0x2deb('0x52')][_0x2deb('0x54')]?_0x8b00cf[_0x2deb('0x52')]:_0x479ae9['model'];_0x8b00cf[_0x2deb('0xcb')]=qs[_0x2deb('0x57')](_0x40cd1b[_0x2deb('0x4e')][_0x2deb('0x57')]);_0x8b00cf['where']=qs[_0x2deb('0x50')](_[_0x2deb('0x59')](_0x40cd1b['query'],_0x479ae9['filters']));if(_0x40cd1b[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x8b00cf[_0x2deb('0x58')]=_['merge'](_0x8b00cf['where'],{'$or':_[_0x2deb('0x3e')](_0x8b00cf['attributes'],function(_0x27e922){var _0xed1448={};_0xed1448[_0x27e922]={'$like':'%'+_0x40cd1b[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0xed1448;})});}_0x8b00cf=_[_0x2deb('0x5b')]({},_0x8b00cf,_0x40cd1b[_0x2deb('0x68')]);return _0x562411[_0x2deb('0xe5')](_0x8b00cf);}})[_0x2deb('0x22')](function(_0x2d34e1){if(_0x2d34e1){_0x1a0540=_0x2d34e1[_0x2deb('0x54')];if(!_0x40cd1b[_0x2deb('0x4e')][_0x2deb('0x55')](_0x2deb('0x56'))){_0x8b00cf[_0x2deb('0x32')]=qs['limit'](_0x40cd1b['query'][_0x2deb('0x32')]);_0x8b00cf[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x40cd1b[_0x2deb('0x4e')][_0x2deb('0x31')]);}return _0x562411[_0x2deb('0xe5')](_0x8b00cf);}})[_0x2deb('0x22')](function(_0x4c0f86){if(_0x4c0f86){return _0x4c0f86?{'count':_0x1a0540,'rows':_0x4c0f86}:null;}})['then'](respondWithResult(_0x396130,null))[_0x2deb('0x2c')](handleError(_0x396130,null));};exports[_0x2deb('0xe6')]=function(_0x3dbc32,_0x349705,_0x3bf94a){var _0x142f41={};var _0x2b8adb={};var _0x18fb84;var _0x308ddb;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x3dbc32['params']['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x349705,null))['then'](function(_0x29dd12){if(_0x29dd12){_0x18fb84=_0x29dd12;_0x2b8adb[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0xe7')]['rawAttributes']);_0x2b8adb[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x3dbc32['query']);_0x2b8adb['filters']=_[_0x2deb('0x51')](_0x2b8adb[_0x2deb('0x4c')],_0x2b8adb[_0x2deb('0x4e')]);_0x142f41['attributes']=_[_0x2deb('0x51')](_0x2b8adb[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x3dbc32['query'][_0x2deb('0x53')]));_0x142f41[_0x2deb('0x52')]=_0x142f41[_0x2deb('0x52')][_0x2deb('0x54')]?_0x142f41[_0x2deb('0x52')]:_0x2b8adb['model'];_0x142f41[_0x2deb('0xcb')]=qs['sort'](_0x3dbc32['query'][_0x2deb('0x57')]);_0x142f41[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_['pick'](_0x3dbc32[_0x2deb('0x4e')],_0x2b8adb['filters']));if(_0x3dbc32[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x142f41['where']=_[_0x2deb('0x5b')](_0x142f41[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x142f41['attributes'],function(_0x4b4bbe){var _0x30ca25={};_0x30ca25[_0x4b4bbe]={'$like':'%'+_0x3dbc32[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x30ca25;})});}_0x142f41=_[_0x2deb('0x5b')]({},_0x142f41,_0x3dbc32['options']);return _0x18fb84['getWhatsappInteractions'](_0x142f41);}})[_0x2deb('0x22')](function(_0x4e2308){if(_0x4e2308){_0x308ddb=_0x4e2308[_0x2deb('0x54')];if(!_0x3dbc32[_0x2deb('0x4e')][_0x2deb('0x55')]('nolimit')){_0x142f41[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x3dbc32['query'][_0x2deb('0x32')]);_0x142f41[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x3dbc32[_0x2deb('0x4e')][_0x2deb('0x31')]);}return _0x18fb84[_0x2deb('0xe6')](_0x142f41);}})['then'](function(_0x1dff52){if(_0x1dff52){return _0x1dff52?{'count':_0x308ddb,'rows':_0x1dff52}:null;}})[_0x2deb('0x22')](respondWithResult(_0x349705,null))[_0x2deb('0x2c')](handleError(_0x349705,null));};exports['login']=function(_0x39218e,_0x39a2fd,_0xb96df8){var _0x1e3734;var _0x30a80c;var _0x28be11;var _0x1b0b4b=!_[_0x2deb('0x71')](_0x39218e[_0x2deb('0x6c')]['id'])?_0x39218e[_0x2deb('0x6c')]['id']:!_['isNil'](_0x39218e[_0x2deb('0x87')]['id'])?_0x39218e[_0x2deb('0x87')]['id']:null;return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0x1b0b4b,'role':{'$or':[_0x2deb('0x39'),'user','agent']}},'attributes':['id',_0x2deb('0x43'),'phone',_0x2deb('0xe8'),'role','internal',_0x2deb('0xab')]})['then'](function(_0x19ba51){if(_0x19ba51){if(_0x19ba51['role']==='agent'){_0x1e3734=_0x19ba51;if(_0x39218e[_0x2deb('0x69')]['interface']){_0x28be11=util[_0x2deb('0xe9')](_0x2deb('0xea'),_0x1e3734[_0x39218e[_0x2deb('0x69')][_0x2deb('0xad')]]);}else if(_0x39218e[_0x2deb('0x69')][_0x2deb('0xeb')]){_0x28be11=util[_0x2deb('0xe9')](_0x2deb('0xb8'),_0x39218e[_0x2deb('0x69')][_0x2deb('0xeb')]);}else{_0x28be11=util[_0x2deb('0xe9')](_0x2deb('0xb8'),_0x1e3734[_0x2deb('0x43')]);}socket['to'](util[_0x2deb('0xe9')](_0x2deb('0xec'),_0x1e3734[_0x2deb('0x43')]))[_0x2deb('0xb4')](_0x2deb('0xed'),{'user':{'id':_0x1e3734['id'],'name':_0x1e3734['name']},'ip':_0x39218e[_0x2deb('0xee')][_0x2deb('0xef')]||_0x39218e['connection'][_0x2deb('0xf0')]||_0x39218e[_0x2deb('0xf1')][_0x2deb('0xf0')]||_0x39218e[_0x2deb('0xf2')][_0x2deb('0xf1')]['remoteAddress']});return db[_0x2deb('0xbe')][_0x2deb('0x37')]({'where':{'membername':_0x1e3734[_0x2deb('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x2deb('0x9f'))][(_0x2deb('0x9b'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x1e3734){return _0x1e3734[_0x2deb('0xf3')]({'raw':!![]});}})['then'](function(_0x320bc3){if(_0x1e3734){var _0x2d4cc8=[];if(_0x320bc3){_0x30a80c=_0x320bc3;if(_0x30a80c[_0x2deb('0x54')]){for(var _0x2bc8e2=0x0;_0x2bc8e2<_0x30a80c[_0x2deb('0x54')];_0x2bc8e2++){_0x2d4cc8['push']({'membername':_0x1e3734[_0x2deb('0x43')],'UserId':_0x1e3734['id'],'queue_name':_0x30a80c[_0x2bc8e2][_0x2deb('0x43')],'VoiceQueueId':_0x30a80c[_0x2bc8e2]['id'],'interface':_0x28be11,'paused':_0x1e3734[_0x2deb('0xab')]||![],'penalty':_0x30a80c[_0x2bc8e2]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x2d4cc8,function(_0x1f4fd4){return db[_0x2deb('0xbe')]['upsert'](_0x1f4fd4);});}}}})[_0x2deb('0x22')](function(){if(_0x1e3734){return db[_0x2deb('0xf4')][_0x2deb('0x63')]({'where':{'membername':_0x1e3734[_0x2deb('0x43')],'exitAt':null}});}})['then'](function(_0x5ced1f){if(_0x1e3734){var _0x34821b=[];_0x5ced1f['forEach'](function(_0x494db6){_0x34821b[_0x2deb('0x92')](_0x494db6['update']({'exitAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5'))}));});return BPromise[_0x2deb('0x93')](_0x34821b);}})[_0x2deb('0x22')](function(){if(_0x1e3734){var _0x5e1c5e=[];var _0x173027=[];var _0x5df69e=utils['getChannels']();var _0x4f1fe6={'membername':_0x1e3734['name'],'interface':_0x28be11,'enterAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5')),'role':_0x1e3734['role'],'internal':_0x1e3734['internal']};_0x5df69e[_0x2deb('0xf6')](function(_0x32fa05){_0x5e1c5e[_0x2deb('0x92')](_[_0x2deb('0x5b')]({'channel':_0x32fa05,'type':_0x2deb('0xf7'),'data1':_0x39218e['body'][_0x2deb('0xf8')],'data2':_0x28be11},_0x4f1fe6));if(_0x1e3734[_0x2deb('0xab')]){_0x173027[_0x2deb('0x92')](_[_0x2deb('0x5b')]({'channel':_0x32fa05,'type':'PAUSE','data1':_0x2deb('0xf9')},_0x4f1fe6));}});return db['MemberReport'][_0x2deb('0xfa')](_0x5e1c5e[_0x2deb('0xfb')](_0x173027),{'individualHooks':!![]});}})[_0x2deb('0x22')](function(){if(_0x1e3734){return _0x1e3734[_0x2deb('0x36')]({'online':!![],'lastLoginAt':moment()[_0x2deb('0xe9')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1e3734[_0x2deb('0xab')]||![],'mailPause':_0x1e3734['loginInPause']||![],'chatPause':_0x1e3734[_0x2deb('0xab')]||![],'faxPause':_0x1e3734[_0x2deb('0xab')]||![],'smsPause':_0x1e3734[_0x2deb('0xab')]||![],'openchannelPause':_0x1e3734[_0x2deb('0xab')]||![],'whatsappPause':_0x1e3734[_0x2deb('0xab')]||![],'pauseType':_0x1e3734['loginInPause']?'LOGININPAUSE':null,'interface':_0x28be11,'lastPauseAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5'))});}})[_0x2deb('0x22')](function(_0x182490){if(_0x39218e[_0x2deb('0xfc')]){return _0xb96df8();}else{return BPromise[_0x2deb('0xfd')](_0x182490)[_0x2deb('0x22')](respondWithResult(_0x39a2fd,null));}})[_0x2deb('0x2c')](handleError(_0x39a2fd,null));};exports[_0x2deb('0xfe')]=function(_0x1c01b9,_0xcbea8d,_0x50c1db){var _0x5793bf;return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0x1c01b9[_0x2deb('0x6c')]['id'],'role':_0x2deb('0x7b')},'attributes':['id',_0x2deb('0x43'),_0x2deb('0x42')]})[_0x2deb('0x22')](handleEntityNotFound(_0xcbea8d,null))[_0x2deb('0x22')](function(_0x5f10c8){if(_0x5f10c8){_0x5793bf=_0x5f10c8;return db[_0x2deb('0xbe')][_0x2deb('0x37')]({'where':{'membername':_0x5793bf[_0x2deb('0x43')]},'individualHooks':!![]});}})[_0x2deb('0x22')](function(){return db[_0x2deb('0xf4')]['findAll']({'where':{'membername':_0x5793bf['name'],'exitAt':null}});})[_0x2deb('0x22')](function(_0x3dcb2e){var _0x11110a=[];_0x3dcb2e[_0x2deb('0xf6')](function(_0x15602d){_0x11110a['push'](_0x15602d[_0x2deb('0x36')]({'exitAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5'))}));});return BPromise[_0x2deb('0x93')](_0x11110a);})['then'](function(){return _0x5793bf[_0x2deb('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2deb('0x22')](respondWithResult(_0xcbea8d,null))[_0x2deb('0x2c')](handleError(_0xcbea8d,null));};exports['pause']=function(_0x5163c0,_0xf68e1c,_0x8258f4){var _0x4f5935;return db[_0x2deb('0xbe')][_0x2deb('0x36')]({'paused':0x1},{'where':{'UserId':_0x5163c0[_0x2deb('0x6c')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0x5163c0['params']['id'],'role':_0x2deb('0x7b')},'attributes':['id',_0x2deb('0x43'),_0x2deb('0x42'),_0x2deb('0x6f'),'interface']});})[_0x2deb('0x22')](handleEntityNotFound(_0xf68e1c,null))[_0x2deb('0x22')](function(_0x122922){if(_0x122922){_0x4f5935=_0x122922;return respondWithRpcPromise(_0x2deb('0xff'),_0x2deb('0x100'),{'id':_0x4f5935['id'],'name':_0x4f5935['name'],'pause':!![]});}})[_0x2deb('0x22')](function(){if(_0x4f5935){return db[_0x2deb('0xf4')][_0x2deb('0x63')]({'where':{'membername':_0x4f5935[_0x2deb('0x43')],'type':_0x2deb('0x101'),'exitAt':null}});}})['then'](function(_0x6fc5f3){if(_0x6fc5f3[_0x2deb('0x54')]){var _0x53c09b=moment()[_0x2deb('0xe9')](_0x2deb('0xf5'));for(var _0x47c7a4=0x0,_0x4d840f=_0x6fc5f3['length'];_0x47c7a4<_0x4d840f;_0x47c7a4++){_0x6fc5f3[_0x47c7a4][_0x2deb('0x102')]({'exitAt':_0x53c09b});}}})['then'](function(){var _0x5cf439=[];var _0x82a61f=utils[_0x2deb('0x103')]();_0x82a61f['forEach'](function(_0x499ddb){_0x5cf439[_0x2deb('0x92')]({'channel':_0x499ddb,'membername':_0x4f5935['name'],'interface':_[_0x2deb('0x71')](_0x4f5935[_0x2deb('0xad')])?util['format'](_0x2deb('0xb8'),_0x4f5935['name']):_0x4f5935[_0x2deb('0xad')],'type':'PAUSE','enterAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5')),'data1':_0x5163c0[_0x2deb('0x69')][_0x2deb('0x5c')]||_0x2deb('0x104'),'role':_0x4f5935[_0x2deb('0x42')],'internal':_0x4f5935[_0x2deb('0x6f')]});});return db[_0x2deb('0xf4')][_0x2deb('0xfa')](_0x5cf439,{'individualHooks':!![]});})[_0x2deb('0x22')](function(){return _0x4f5935[_0x2deb('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5163c0[_0x2deb('0x69')]['type']||_0x2deb('0x104'),'lastPauseAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5'))});})[_0x2deb('0x22')](respondWithResult(_0xf68e1c,null))[_0x2deb('0x2c')](handleError(_0xf68e1c,null));};exports[_0x2deb('0x105')]=function(_0x1516a3,_0x27e6ac,_0x157cb6){var _0x6e7ff8;return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0x1516a3[_0x2deb('0x6c')]['id']},'attributes':['id',_0x2deb('0x43'),_0x2deb('0x42'),_0x2deb('0xac'),'mailPause',_0x2deb('0x106'),_0x2deb('0x107'),_0x2deb('0x108'),_0x2deb('0x109'),_0x2deb('0x10a'),_0x2deb('0x10b'),_0x2deb('0x10c')]})['then'](handleEntityNotFound(_0x27e6ac,null))['then'](function(_0x1902b2){if(_0x1902b2){_0x6e7ff8=_0x1902b2;if(_0x1516a3[_0x2deb('0x69')][_0x2deb('0xbb')]&&!utils[_0x2deb('0xae')](_0x1516a3['body']['channel'])){throw new db[(_0x2deb('0x9f'))]['ValidationError'](_0x2deb('0x10d'));}switch(_0x1516a3['body'][_0x2deb('0xbb')]){case _0x2deb('0xb7'):return respondWithRpcPromise(_0x2deb('0xff'),'unpause',{'id':_0x6e7ff8['id'],'name':_0x6e7ff8[_0x2deb('0x43')],'pause':![]})[_0x2deb('0x22')](function(){return db[_0x2deb('0xbe')][_0x2deb('0x36')]({'paused':0x0},{'where':{'UserId':_0x6e7ff8['id']},'individualHooks':!![]});})[_0x2deb('0x22')](function(){return db[_0x2deb('0xf4')]['find']({'where':{'channel':_0x1516a3['body'][_0x2deb('0xbb')],'membername':_0x6e7ff8[_0x2deb('0x43')],'type':_0x2deb('0x101'),'exitAt':null}});})[_0x2deb('0x22')](function(_0x3bc55d){if(_0x3bc55d){return _0x3bc55d['update']({'exitAt':moment()['format'](_0x2deb('0xf5')),'data2':_0x2deb('0x10e')},{'individualHooks':!![]});}return null;})[_0x2deb('0x22')](function(){return _0x6e7ff8[_0x2deb('0x36')]({'voicePause':![]});});case _0x2deb('0x10f'):case'chat':case _0x2deb('0x110'):case _0x2deb('0x111'):case _0x2deb('0x112'):case _0x2deb('0x113'):return db[_0x2deb('0xf4')][_0x2deb('0x41')]({'where':{'channel':_0x1516a3[_0x2deb('0x69')][_0x2deb('0xbb')],'membername':_0x6e7ff8['name'],'type':'PAUSE','exitAt':null}})['then'](function(_0x311bbd){if(_0x311bbd){return _0x311bbd[_0x2deb('0x36')]({'exitAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5')),'data2':_0x2deb('0x10e')},{'individualHooks':!![]});}return null;})[_0x2deb('0x22')](function(){var _0x234151={};_[_0x2deb('0x114')](_0x234151,util['format'](_0x2deb('0x115'),_0x1516a3[_0x2deb('0x69')][_0x2deb('0xbb')],_0x2deb('0x116')),![]);return _0x6e7ff8[_0x2deb('0x36')](_0x234151);});default:return respondWithRpcPromise(_0x2deb('0xff'),'unpause',{'id':_0x6e7ff8['id'],'name':_0x6e7ff8[_0x2deb('0x43')],'pause':![]})[_0x2deb('0x22')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x6e7ff8['id']}});})['then'](function(){return db[_0x2deb('0xf4')]['findAll']({'where':{'membername':_0x6e7ff8['name'],'type':_0x2deb('0x101'),'exitAt':null}});})['then'](function(_0x4b4a52){var _0x2bc2a4=[];_0x4b4a52[_0x2deb('0xf6')](function(_0x21112a){_0x2bc2a4['push'](_0x21112a['update']({'exitAt':moment()[_0x2deb('0xe9')](_0x2deb('0xf5')),'data2':_0x2deb('0x10e')}));});return BPromise[_0x2deb('0x93')](_0x2bc2a4);})[_0x2deb('0x22')](function(){return _0x6e7ff8[_0x2deb('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2deb('0x22')](respondWithResult(_0x27e6ac,null))[_0x2deb('0x2c')](handleError(_0x27e6ac,null));};exports[_0x2deb('0x117')]=function(_0x5c53af,_0x50f01e,_0x41aee3){var _0x18d0fb={};var _0x2aab4b={};var _0x3420d3;var _0x1418f8;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x5c53af[_0x2deb('0x6c')]['id']}})['then'](handleEntityNotFound(_0x50f01e,null))[_0x2deb('0x22')](function(_0x517c67){if(_0x517c67){_0x3420d3=_0x517c67;_0x2aab4b[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db[_0x2deb('0x118')]['rawAttributes']);_0x2aab4b['query']=_['keys'](_0x5c53af[_0x2deb('0x4e')]);_0x2aab4b['filters']=_[_0x2deb('0x51')](_0x2aab4b[_0x2deb('0x4c')],_0x2aab4b[_0x2deb('0x4e')]);_0x18d0fb['attributes']=_[_0x2deb('0x51')](_0x2aab4b['model'],qs[_0x2deb('0x53')](_0x5c53af[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x18d0fb[_0x2deb('0x52')]=_0x18d0fb[_0x2deb('0x52')]['length']?_0x18d0fb['attributes']:_0x2aab4b[_0x2deb('0x4c')];_0x18d0fb['order']=qs[_0x2deb('0x57')](_0x5c53af[_0x2deb('0x4e')][_0x2deb('0x57')]);_0x18d0fb[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_['pick'](_0x5c53af[_0x2deb('0x4e')],_0x2aab4b['filters']));if(_0x5c53af[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x18d0fb[_0x2deb('0x58')]=_[_0x2deb('0x5b')](_0x18d0fb[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x18d0fb['attributes'],function(_0x431991){var _0x2e0ac4={};_0x2e0ac4[_0x431991]={'$like':'%'+_0x5c53af[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x2e0ac4;})});}_0x18d0fb=_[_0x2deb('0x5b')]({},_0x18d0fb,_0x5c53af[_0x2deb('0x68')]);return _0x3420d3[_0x2deb('0x117')](_0x18d0fb);}})['then'](function(_0x3c74c5){if(_0x3c74c5){_0x1418f8=_0x3c74c5[_0x2deb('0x54')];if(!_0x5c53af[_0x2deb('0x4e')][_0x2deb('0x55')](_0x2deb('0x56'))){_0x18d0fb[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x5c53af['query'][_0x2deb('0x32')]);_0x18d0fb[_0x2deb('0x31')]=qs['offset'](_0x5c53af['query'][_0x2deb('0x31')]);}return _0x3420d3[_0x2deb('0x117')](_0x18d0fb);}})['then'](function(_0x25a966){if(_0x25a966){return _0x25a966?{'count':_0x1418f8,'rows':_0x25a966}:null;}})[_0x2deb('0x22')](respondWithResult(_0x50f01e,null))[_0x2deb('0x2c')](handleError(_0x50f01e,null));};exports[_0x2deb('0x119')]=function(_0x496039,_0x279882){return db[_0x2deb('0x48')][_0x2deb('0x41')]({'where':{'id':_0x496039[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x279882,null))[_0x2deb('0x22')](function(_0x3c9fa7){if(_0x3c9fa7){var _0x1ce32f=_0x3c9fa7[_0x2deb('0x38')]({'plain':!![]});return _0x3c9fa7[_0x2deb('0x119')](_0x496039[_0x2deb('0x69')][_0x2deb('0x6e')],_['omit'](_0x496039['body'],['ids','id'])||{})['then'](function(){for(var _0x4650f8=0x0;_0x4650f8<_0x496039[_0x2deb('0x69')][_0x2deb('0x6e')][_0x2deb('0x54')];_0x4650f8++){var _0x8889d5=[];db[_0x2deb('0x118')][_0x2deb('0xa2')]({'where':{'id':_0x496039['body'][_0x2deb('0x6e')][_0x4650f8]}})['then'](function(_0x2e176c){_0x8889d5['push'](_0x2e176c[_0x2deb('0xf3')]()['then'](function(_0x14d780){for(var _0x487a95=0x0;_0x487a95<_0x14d780[_0x2deb('0x54')];_0x487a95++){_0x14d780[_0x487a95][_0x2deb('0x11a')]('channel',_0x2deb('0x11b'));}return _0x14d780;}));_0x8889d5[_0x2deb('0x92')](_0x2e176c[_0x2deb('0x11c')]()[_0x2deb('0x22')](function(_0x396e1b){for(var _0x13977f=0x0;_0x13977f<_0x396e1b[_0x2deb('0x54')];_0x13977f++){_0x396e1b[_0x13977f]['setDataValue'](_0x2deb('0xbb'),_0x2deb('0x11d'));}return _0x396e1b;}));_0x8889d5['push'](_0x2e176c[_0x2deb('0x11e')]()[_0x2deb('0x22')](function(_0x106b1c){for(var _0x297f59=0x0;_0x297f59<_0x106b1c[_0x2deb('0x54')];_0x297f59++){_0x106b1c[_0x297f59][_0x2deb('0x11a')](_0x2deb('0xbb'),_0x2deb('0x11f'));}return _0x106b1c;}));_0x8889d5[_0x2deb('0x92')](_0x2e176c['getSmsQueues']()['then'](function(_0x5c41bc){for(var _0x2f07af=0x0;_0x2f07af<_0x5c41bc['length'];_0x2f07af++){_0x5c41bc[_0x2f07af][_0x2deb('0x11a')](_0x2deb('0xbb'),'Sms');}return _0x5c41bc;}));_0x8889d5['push'](_0x2e176c[_0x2deb('0x120')]()[_0x2deb('0x22')](function(_0x1336a4){for(var _0xb63dbf=0x0;_0xb63dbf<_0x1336a4[_0x2deb('0x54')];_0xb63dbf++){_0x1336a4[_0xb63dbf][_0x2deb('0x11a')]('channel',_0x2deb('0x121'));}return _0x1336a4;}));_0x8889d5[_0x2deb('0x92')](_0x2e176c['getFaxQueues']()['then'](function(_0xb8a985){for(var _0x3abc36=0x0;_0x3abc36<_0xb8a985[_0x2deb('0x54')];_0x3abc36++){_0xb8a985[_0x3abc36][_0x2deb('0x11a')](_0x2deb('0xbb'),_0x2deb('0x122'));}return _0xb8a985;}));_0x8889d5[_0x2deb('0x92')](_0x2e176c[_0x2deb('0x123')]()[_0x2deb('0x22')](function(_0x471d0c){for(var _0x281b57=0x0;_0x281b57<_0x471d0c['length'];_0x281b57++){_0x471d0c[_0x281b57][_0x2deb('0x11a')](_0x2deb('0xbb'),_0x2deb('0x124'));}return _0x471d0c;}));return BPromise[_0x2deb('0x93')](_0x8889d5);})['then'](function(_0x37faf1){var _0x245f8f=_['flatten'](_0x37faf1);_0x8889d5=[];return db[_0x2deb('0x5e')][_0x2deb('0x125')](function(_0x3333e6){for(var _0x54a07b=0x0;_0x54a07b<_0x245f8f[_0x2deb('0x54')];_0x54a07b++){_0x8889d5[_0x2deb('0x92')](_0x245f8f[_0x54a07b][_0x2deb('0x126')](_0x1ce32f['id']),{'transaction':_0x3333e6});}return BPromise[_0x2deb('0x93')](_0x8889d5)[_0x2deb('0x22')](function(){if(_0x1ce32f[_0x2deb('0xaa')]){return BPromise['each'](_[_0x2deb('0x5a')](_0x245f8f,function(_0x764aca){return _0x764aca[_0x2deb('0x127')](_0x2deb('0xbb'))===_0x2deb('0x11b');}),function(_0x3cf6ef){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1ce32f[_0x2deb('0x43')],'UserId':_0x1ce32f['id'],'queue_name':_0x3cf6ef['name'],'VoiceQueueId':_0x3cf6ef['id'],'interface':_[_0x2deb('0x71')](_0x1ce32f[_0x2deb('0xad')])?util[_0x2deb('0xe9')](_0x2deb('0xb8'),_0x1ce32f[_0x2deb('0x43')]):_0x1ce32f[_0x2deb('0xad')],'paused':_0x1ce32f['voicePause']||![],'penalty':_0x1ce32f[_0x2deb('0xb2')]},{'transaction':_0x3333e6});});}else{return;}})['then'](function(){for(var _0x47a7da=0x0;_0x47a7da<_0x245f8f[_0x2deb('0x54')];_0x47a7da++){var _0x1fbe66=_0x245f8f[_0x47a7da][_0x2deb('0x127')](_0x2deb('0xbb'));var _0x237959=_0x1fbe66+_0x2deb('0xbc');socket[_0x2deb('0xb4')](_0x2deb('0x87')+_0x1fbe66+_0x2deb('0xb6'),{'UserId':_0x1ce32f['id'],['queueField']:_0x245f8f[_0x47a7da]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x279882,null))['catch'](handleError(_0x279882,null));};exports['removeTeams']=function(_0x25669f,_0x27b81c){return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x25669f[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x27b81c,null))[_0x2deb('0x22')](function(_0x16cff7){if(_0x16cff7){var _0x4c9342=_0x16cff7['get']({'plain':!![]});var _0x46b734=_0x25669f[_0x2deb('0x4e')][_0x2deb('0x6e')];return _0x16cff7[_0x2deb('0x128')](_0x46b734)[_0x2deb('0x22')](function(){for(var _0x25f890=0x0;_0x25f890<_0x46b734[_0x2deb('0x54')];_0x25f890++){var _0x3a8f2d=[];db['Team'][_0x2deb('0xa2')]({'where':{'id':_0x46b734[_0x25f890]}})[_0x2deb('0x22')](function(_0x47674b){_0x3a8f2d[_0x2deb('0x92')](_0x47674b['getVoiceQueues']()[_0x2deb('0x22')](function(_0x52478a){for(var _0x54c0b9=0x0;_0x54c0b9<_0x52478a[_0x2deb('0x54')];_0x54c0b9++){_0x52478a[_0x54c0b9][_0x2deb('0x11a')](_0x2deb('0xbb'),_0x2deb('0x11b'));}return _0x52478a;}));_0x3a8f2d[_0x2deb('0x92')](_0x47674b[_0x2deb('0x11c')]()[_0x2deb('0x22')](function(_0x2e2b1c){for(var _0x292675=0x0;_0x292675<_0x2e2b1c[_0x2deb('0x54')];_0x292675++){_0x2e2b1c[_0x292675]['setDataValue']('channel',_0x2deb('0x11d'));}return _0x2e2b1c;}));_0x3a8f2d[_0x2deb('0x92')](_0x47674b['getMailQueues']()[_0x2deb('0x22')](function(_0x3c05c9){for(var _0x5ca1bf=0x0;_0x5ca1bf<_0x3c05c9['length'];_0x5ca1bf++){_0x3c05c9[_0x5ca1bf]['setDataValue'](_0x2deb('0xbb'),_0x2deb('0x11f'));}return _0x3c05c9;}));_0x3a8f2d[_0x2deb('0x92')](_0x47674b['getSmsQueues']()[_0x2deb('0x22')](function(_0x183e27){for(var _0x46929b=0x0;_0x46929b<_0x183e27[_0x2deb('0x54')];_0x46929b++){_0x183e27[_0x46929b][_0x2deb('0x11a')](_0x2deb('0xbb'),_0x2deb('0x129'));}return _0x183e27;}));_0x3a8f2d[_0x2deb('0x92')](_0x47674b[_0x2deb('0x120')]()[_0x2deb('0x22')](function(_0x1af947){for(var _0x17bfa8=0x0;_0x17bfa8<_0x1af947[_0x2deb('0x54')];_0x17bfa8++){_0x1af947[_0x17bfa8][_0x2deb('0x11a')](_0x2deb('0xbb'),'Whatsapp');}return _0x1af947;}));_0x3a8f2d[_0x2deb('0x92')](_0x47674b[_0x2deb('0x12a')]()['then'](function(_0x515285){for(var _0x4f217b=0x0;_0x4f217b<_0x515285[_0x2deb('0x54')];_0x4f217b++){_0x515285[_0x4f217b][_0x2deb('0x11a')](_0x2deb('0xbb'),_0x2deb('0x122'));}return _0x515285;}));_0x3a8f2d[_0x2deb('0x92')](_0x47674b[_0x2deb('0x123')]()[_0x2deb('0x22')](function(_0x502a2a){for(var _0x3264d2=0x0;_0x3264d2<_0x502a2a[_0x2deb('0x54')];_0x3264d2++){_0x502a2a[_0x3264d2][_0x2deb('0x11a')](_0x2deb('0xbb'),_0x2deb('0x124'));}return _0x502a2a;}));return BPromise[_0x2deb('0x93')](_0x3a8f2d);})[_0x2deb('0x22')](function(_0x4591ea){var _0x2664c6=_[_0x2deb('0x12b')](_0x4591ea);_0x3a8f2d=[];return db['sequelize']['transaction'](function(_0x173887){for(var _0x57ea6c=0x0;_0x57ea6c<_0x2664c6['length'];_0x57ea6c++){_0x3a8f2d['push'](_0x2664c6[_0x57ea6c][_0x2deb('0x12c')](_0x4c9342['id']),{'transaction':_0x173887});}return BPromise[_0x2deb('0x93')](_0x3a8f2d)['then'](function(){if(_0x4c9342[_0x2deb('0xaa')]){return BPromise['each'](_[_0x2deb('0x5a')](_0x2664c6,function(_0xce16e4){return _0xce16e4[_0x2deb('0x127')](_0x2deb('0xbb'))===_0x2deb('0x11b');}),function(_0xbcf706){return db[_0x2deb('0xbe')][_0x2deb('0x37')]({'where':{'VoiceQueueId':_0xbcf706['id'],'UserId':_0x4c9342['id']},'transaction':_0x173887});});}else{return;}})[_0x2deb('0x22')](function(){for(var _0x470e73=0x0;_0x470e73<_0x2664c6[_0x2deb('0x54')];_0x470e73++){var _0x2f3428=_0x2664c6[_0x470e73][_0x2deb('0x127')](_0x2deb('0xbb'));var _0x2e14d5=_0x2f3428+_0x2deb('0xbc');socket[_0x2deb('0xb4')]('user'+_0x2f3428+_0x2deb('0xbd'),{'UserId':_0x4c9342['id'],['queueField']:_0x2664c6[_0x470e73]['id']});}});});});}});}})[_0x2deb('0x22')](respondWithStatusCode(_0x27b81c,null))['catch'](handleError(_0x27b81c,null));};exports[_0x2deb('0x12d')]=function(_0x47269a,_0x819f97,_0x2f300d){var _0x30ac70={};var _0x2ec32a={};var _0x38aeaa;var _0x5b68cb;return db[_0x2deb('0x48')]['findOne']({'where':{'id':_0x47269a[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x819f97,null))['then'](function(_0x6e68c){if(_0x6e68c){_0x38aeaa=_0x6e68c;_0x2ec32a[_0x2deb('0x4c')]=_[_0x2deb('0x4f')](db['CmList'][_0x2deb('0x49')]);_0x2ec32a[_0x2deb('0x4e')]=_[_0x2deb('0x4f')](_0x47269a['query']);_0x2ec32a[_0x2deb('0x50')]=_[_0x2deb('0x51')](_0x2ec32a['model'],_0x2ec32a[_0x2deb('0x4e')]);_0x30ac70[_0x2deb('0x52')]=_['intersection'](_0x2ec32a[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x47269a[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x30ac70[_0x2deb('0x52')]=_0x30ac70['attributes'][_0x2deb('0x54')]?_0x30ac70[_0x2deb('0x52')]:_0x2ec32a['model'];_0x30ac70['order']=qs['sort'](_0x47269a['query'][_0x2deb('0x57')]);_0x30ac70[_0x2deb('0x58')]=qs['filters'](_[_0x2deb('0x59')](_0x47269a['query'],_0x2ec32a[_0x2deb('0x50')]));if(_0x47269a[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x30ac70[_0x2deb('0x58')]=_[_0x2deb('0x5b')](_0x30ac70['where'],{'$or':_[_0x2deb('0x3e')](_0x30ac70[_0x2deb('0x52')],function(_0xee9ef2){var _0x3373e8={};_0x3373e8[_0xee9ef2]={'$like':'%'+_0x47269a['query']['filter']+'%'};return _0x3373e8;})});}_0x30ac70=_[_0x2deb('0x5b')]({},_0x30ac70,_0x47269a[_0x2deb('0x68')]);return _0x38aeaa['getLists'](_0x30ac70);}})['then'](function(_0x5c052e){if(_0x5c052e){_0x5b68cb=_0x5c052e[_0x2deb('0x54')];if(!_0x47269a[_0x2deb('0x4e')][_0x2deb('0x55')](_0x2deb('0x56'))){_0x30ac70[_0x2deb('0x32')]=qs[_0x2deb('0x32')](_0x47269a[_0x2deb('0x4e')]['limit']);_0x30ac70[_0x2deb('0x31')]=qs[_0x2deb('0x31')](_0x47269a['query'][_0x2deb('0x31')]);}return _0x38aeaa[_0x2deb('0x12d')](_0x30ac70);}})[_0x2deb('0x22')](function(_0x324188){if(_0x324188){return _0x324188?{'count':_0x5b68cb,'rows':_0x324188}:null;}})[_0x2deb('0x22')](respondWithResult(_0x819f97,null))[_0x2deb('0x2c')](handleError(_0x819f97,null));};exports['getAgents']=function(_0x445fa7,_0x219a87,_0x10b502){var _0x461e1a={};var _0xc28bd5={};var _0x1c1a34;var _0x27e071;return db[_0x2deb('0x48')][_0x2deb('0xa2')]({'where':{'id':_0x445fa7[_0x2deb('0x6c')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x219a87,null))[_0x2deb('0x22')](function(_0x21d284){if(_0x21d284){_0x1c1a34=_0x21d284;_0xc28bd5['model']=_[_0x2deb('0x4f')](db[_0x2deb('0x48')][_0x2deb('0x49')]);_0xc28bd5['query']=_[_0x2deb('0x4f')](_0x445fa7['query']);_0xc28bd5[_0x2deb('0x50')]=_['intersection'](_0xc28bd5[_0x2deb('0x4c')],_0xc28bd5['query']);_0x461e1a[_0x2deb('0x52')]=_[_0x2deb('0x51')](_0xc28bd5[_0x2deb('0x4c')],qs[_0x2deb('0x53')](_0x445fa7[_0x2deb('0x4e')][_0x2deb('0x53')]));_0x461e1a[_0x2deb('0x52')]=_0x461e1a[_0x2deb('0x52')]['length']?_0x461e1a[_0x2deb('0x52')]:_0xc28bd5[_0x2deb('0x4c')];_0x461e1a[_0x2deb('0xcb')]=qs[_0x2deb('0x57')](_0x445fa7['query'][_0x2deb('0x57')]);_0x461e1a[_0x2deb('0x58')]=qs[_0x2deb('0x50')](_[_0x2deb('0x59')](_0x445fa7[_0x2deb('0x4e')],_0xc28bd5[_0x2deb('0x50')]));if(_0x445fa7[_0x2deb('0x4e')][_0x2deb('0x5a')]){_0x461e1a['where']=_[_0x2deb('0x5b')](_0x461e1a[_0x2deb('0x58')],{'$or':_[_0x2deb('0x3e')](_0x461e1a['attributes'],function(_0x11200e){var _0x1d0f53={};_0x1d0f53[_0x11200e]={'$like':'%'+_0x445fa7[_0x2deb('0x4e')][_0x2deb('0x5a')]+'%'};return _0x1d0f53;})});}_0x461e1a[_0x2deb('0x4c')]=db['User'];_0x461e1a['as']='Agents';_0x461e1a=_[_0x2deb('0x5b')]({},_0x461e1a,_0x445fa7[_0x2deb('0x68')]);return _0x1c1a34['getVoiceQueues']({'include':[_0x461e1a]});}})['then'](function(_0x37d241){if(_0x37d241){var _0x5c5432={},_0x2a3903=[],_0x46a184=0x0;for(var _0x76163=0x0;_0x76163<_0x37d241['length'];_0x76163+=0x1){for(var _0x16fdec=0x0,_0x334c70;_0x16fdec<_0x37d241[_0x76163][_0x2deb('0x3b')][_0x2deb('0x54')];_0x16fdec+=0x1){_0x334c70=_0x37d241[_0x76163][_0x2deb('0x3b')][_0x16fdec]['get']({'plain':!![]});_0x5c5432[_0x334c70['id']]=_0x334c70;}}_0x5c5432=_[_0x2deb('0x12e')](_0x5c5432);for(var _0x4f24a8=qs[_0x2deb('0x31')](_0x445fa7[_0x2deb('0x4e')][_0x2deb('0x31')]);_0x4f24a8<_0x5c5432['length']&&_0x2a3903[_0x2deb('0x54')]=_0x189c9a){_0x1a3981=_0x189c9a;_0x3e3673=0xc8;}else{_0x3e3673=0xce;}_0x3c6766['status'](_0x3e3673);return _0x3c6766[_0x34ff('0x2f')]('Content-Range',_0x263168+'-'+_0x1a3981+'/'+_0x189c9a)[_0x34ff('0x30')](_0x58d575);}return null;};}function patchUpdates(_0x1fba1e){return function(_0xaed5b0){try{jsonpatch[_0x34ff('0x31')](_0xaed5b0,_0x1fba1e,!![]);}catch(_0x26ea45){return BPromise[_0x34ff('0x32')](_0x26ea45);}return _0xaed5b0[_0x34ff('0x33')]();};}function saveUpdates(_0x106377,_0x3f2cde){return function(_0x43dac0){if(_0x43dac0){return _0x43dac0[_0x34ff('0x34')](_0x106377)[_0x34ff('0x35')](function(_0x2d4a03){return _0x2d4a03;});}return null;};}function removeEntity(_0x951e7b,_0x246168){return function(_0x13fa61){if(_0x13fa61){return _0x13fa61[_0x34ff('0x36')]()[_0x34ff('0x35')](function(){var _0x3eb0f1=_0x13fa61[_0x34ff('0x37')]({'plain':!![]});if(_0x3eb0f1['role']===_0x34ff('0x38'))return;var _0x316799=[{'name':_0x34ff('0x39'),'value':_0x34ff('0x3a'),'ignore':!![]},{'name':_0x34ff('0x3b'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x34ff('0x3c'),'ignore':![]}];var _0x166d26=_(_0x316799)[_0x34ff('0x3d')](_0x34ff('0x3e'))[_0x34ff('0x3f')](_0x34ff('0x40'))[_0x34ff('0x40')]();if(_['includes'](_0x166d26,_0x3eb0f1['role'])){return;}var _0x965989=_[_0x34ff('0x41')](_0x316799,[_0x34ff('0x40'),_0x3eb0f1[_0x34ff('0x42')]])[_0x34ff('0x43')];return db[_0x34ff('0x44')][_0x34ff('0x36')]({'where':{'type':_0x965989,'resourceId':_0x3eb0f1['id']}})[_0x34ff('0x35')](function(){return _0x13fa61;});})[_0x34ff('0x35')](function(){_0x951e7b[_0x34ff('0x2a')](0xcc)[_0x34ff('0x2b')]();});}};}function handleEntityNotFound(_0x2e9762,_0x15038c){return function(_0x5bc8db){if(!_0x5bc8db){_0x2e9762[_0x34ff('0x29')](0x194);}return _0x5bc8db;};}function handleError(_0x132710,_0x538591){_0x538591=_0x538591||0x1f4;return function(_0x293719){logger['error'](_0x293719[_0x34ff('0x45')]);if(_0x293719[_0x34ff('0x43')]){delete _0x293719[_0x34ff('0x43')];}_0x132710[_0x34ff('0x2a')](_0x538591)[_0x34ff('0x46')](_0x293719);};}exports[_0x34ff('0x47')]=function(_0xd4ed6b,_0x1ddcc8){var _0x4340c5={},_0xaec066={},_0x25ebb5={'count':0x0,'rows':[]};var _0x564c5e=_[_0x34ff('0x3f')](db[_0x34ff('0x48')][_0x34ff('0x49')],function(_0x566b46){return{'name':_0x566b46[_0x34ff('0x4a')],'type':_0x566b46[_0x34ff('0x4b')]['key']};});_0xaec066[_0x34ff('0x4c')]=_[_0x34ff('0x4d')](_[_0x34ff('0x3f')](_0x564c5e,'name'),['password','salt']);_0xaec066[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0xd4ed6b[_0x34ff('0x4e')]);_0xaec066['filters']=_[_0x34ff('0x50')](_0xaec066['model'],_0xaec066['query']);_0x4340c5[_0x34ff('0x51')]=_[_0x34ff('0x50')](_0xaec066[_0x34ff('0x4c')],qs[_0x34ff('0x52')](_0xd4ed6b[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x4340c5[_0x34ff('0x51')]=_0x4340c5['attributes'][_0x34ff('0x53')]?_0x4340c5['attributes']:_0xaec066[_0x34ff('0x4c')];if(!_0xd4ed6b[_0x34ff('0x4e')][_0x34ff('0x54')](_0x34ff('0x55'))){_0x4340c5['limit']=qs[_0x34ff('0x2e')](_0xd4ed6b[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x4340c5[_0x34ff('0x2d')]=qs['offset'](_0xd4ed6b[_0x34ff('0x4e')][_0x34ff('0x2d')]);}_0x4340c5[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0xd4ed6b['query'][_0x34ff('0x57')]);_0x4340c5[_0x34ff('0x58')]=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0xd4ed6b['query'],_0xaec066[_0x34ff('0x59')]),_0x564c5e);if(_0xd4ed6b[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x4340c5[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x4340c5[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x564c5e,function(_0x288238){if(_0x288238[_0x34ff('0x4b')]!=='VIRTUAL'){return db[_0x34ff('0x5c')]['where'](db[_0x34ff('0x5c')]['fn'](_0x34ff('0x5d'),db[_0x34ff('0x5c')][_0x34ff('0x5e')](_0x288238['name'])),{'$like':db[_0x34ff('0x5c')]['fn'](_0x34ff('0x5d'),'%'+_0xd4ed6b[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%')});}})});}_0x4340c5=_[_0x34ff('0x5b')]({},_0x4340c5,_0xd4ed6b[_0x34ff('0x5f')]);var _0x4da062={'where':_0x4340c5['where']};return db[_0x34ff('0x48')][_0x34ff('0x2c')](_0x4da062)[_0x34ff('0x35')](function(_0x12fe98){_0x25ebb5[_0x34ff('0x2c')]=_0x12fe98;if(_0xd4ed6b[_0x34ff('0x4e')][_0x34ff('0x60')]){_0x4340c5[_0x34ff('0x61')]=[{'all':!![]}];}return db[_0x34ff('0x48')][_0x34ff('0x62')](_0x4340c5);})['then'](function(_0x5c044d){_0x25ebb5[_0x34ff('0x63')]=_0x5c044d;return _0x25ebb5;})[_0x34ff('0x35')](respondWithFilteredResult(_0x1ddcc8,_0x4340c5))[_0x34ff('0x28')](handleError(_0x1ddcc8,null));};exports[_0x34ff('0x64')]=function(_0x55c004,_0x890674){var _0x503604={'raw':![],'where':{'id':_0x55c004['params']['id']}},_0x1a7184={};_0x1a7184['model']=_['differenceBy'](_['keys'](db[_0x34ff('0x48')][_0x34ff('0x49')]),[_0x34ff('0x65'),'salt']);_0x1a7184[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x55c004[_0x34ff('0x4e')]);_0x1a7184[_0x34ff('0x59')]=_['intersection'](_0x1a7184[_0x34ff('0x4c')],_0x1a7184['query']);_0x503604[_0x34ff('0x51')]=_['intersection'](_0x1a7184['model'],qs['fields'](_0x55c004[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x503604[_0x34ff('0x51')]=_0x503604['attributes']['length']?_0x503604[_0x34ff('0x51')]:_0x1a7184[_0x34ff('0x4c')];if(_0x55c004[_0x34ff('0x4e')][_0x34ff('0x60')]){_0x503604['include']=[{'all':!![]}];}_0x503604=_[_0x34ff('0x5b')]({},_0x503604,_0x55c004[_0x34ff('0x5f')]);return db[_0x34ff('0x48')][_0x34ff('0x41')](_0x503604)[_0x34ff('0x35')](handleEntityNotFound(_0x890674,null))[_0x34ff('0x35')](respondWithResult(_0x890674,null))[_0x34ff('0x28')](handleError(_0x890674,null));};exports['update']=function(_0x6ab254,_0x406f16){if(_0x6ab254[_0x34ff('0x66')]['id']){delete _0x6ab254[_0x34ff('0x66')]['id'];}delete _0x6ab254[_0x34ff('0x66')]['role'];return db[_0x34ff('0x48')]['find']({'where':{'id':_0x6ab254[_0x34ff('0x67')]['id']}})['then'](handleEntityNotFound(_0x406f16,null))['then'](saveUpdates(_0x6ab254[_0x34ff('0x66')],null))[_0x34ff('0x35')](respondWithResult(_0x406f16,null))[_0x34ff('0x28')](handleError(_0x406f16,null));};exports[_0x34ff('0x68')]=function(_0x5ae056,_0x44a5ca){return db[_0x34ff('0x48')][_0x34ff('0x68')]()[_0x34ff('0x35')](respondWithResult(_0x44a5ca,null))[_0x34ff('0x28')](handleError(_0x44a5ca,null));};exports['addContacts']=function(_0x5266b8,_0x5d652a,_0x526834){return db[_0x34ff('0x48')][_0x34ff('0x41')]({'where':{'id':_0x5266b8[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x5d652a,null))[_0x34ff('0x35')](function(_0x9f7d77){if(_0x9f7d77){return _0x9f7d77['addContacts'](_0x5266b8[_0x34ff('0x66')][_0x34ff('0x69')],_[_0x34ff('0x6a')](_0x5266b8[_0x34ff('0x66')],[_0x34ff('0x69'),'id'])||{});}})[_0x34ff('0x35')](respondWithResult(_0x5d652a,null))[_0x34ff('0x28')](handleError(_0x5d652a,null));};function validateUser(_0x2b3e09){return new BPromise(function(_0x1840d0,_0xb8496b){if(_0x2b3e09[_0x34ff('0x6b')])return _0x1840d0(_0x2b3e09);return db[_0x34ff('0x6c')][_0x34ff('0x6d')](0x1)['then'](function(_0x4e7ad8){if(_0x4e7ad8[_0x34ff('0x6e')])authService[_0x34ff('0x6f')](_0x2b3e09[_0x34ff('0x65')]);db[_0x34ff('0x48')]['max'](_0x34ff('0x6b'))[_0x34ff('0x35')](function(_0x322a4e){if(_[_0x34ff('0x70')](_0x322a4e)){_0x2b3e09[_0x34ff('0x6b')]=_0x4e7ad8[_0x34ff('0x71')]||0x1;return;}if(_[_0x34ff('0x70')](_0x4e7ad8[_0x34ff('0x71')])||_0x4e7ad8[_0x34ff('0x71')]===_0x322a4e){_0x2b3e09[_0x34ff('0x6b')]=_0x322a4e+0x1;return;}if(_0x4e7ad8[_0x34ff('0x71')]>_0x322a4e){_0x2b3e09['internal']=_0x4e7ad8[_0x34ff('0x71')];return;}return db[_0x34ff('0x5c')]['query'](_0x34ff('0x72'),{'type':db[_0x34ff('0x5c')]['QueryTypes'][_0x34ff('0x73')]})[_0x34ff('0x35')](function(_0x257480){if(_0x257480&&_0x257480[_0x34ff('0x53')]){for(var _0x25a509=0x0,_0x5a122c=_0x257480['length'];_0x25a509<_0x5a122c&&_[_0x34ff('0x70')](_0x2b3e09['internal']);_0x25a509++){if(_0x4e7ad8[_0x34ff('0x71')]<=_0x257480[_0x25a509][_0x34ff('0x74')]){_0x2b3e09['internal']=_0x257480[_0x25a509][_0x34ff('0x74')];}else if(_0x4e7ad8[_0x34ff('0x71')]>_0x257480[_0x25a509][_0x34ff('0x74')]&&_0x4e7ad8['min_internal']<=_0x257480[_0x25a509]['to']){_0x2b3e09[_0x34ff('0x6b')]=_0x4e7ad8['min_internal'];}}}if(_['isNil'](_0x2b3e09['internal'])){_0x2b3e09['internal']=_0x322a4e+0x1;}return _0x1840d0(_0x2b3e09);});});})[_0x34ff('0x28')](function(_0x1ba212){_0xb8496b(_0x1ba212);});});}function updateUser(_0x5a8733){return new BPromise(function(_0x1720ed,_0xda2f77){try{if(_0x5a8733[_0x34ff('0x75')]){_0x5a8733[_0x34ff('0x76')]=_0x5a8733['internal'];_0x5a8733[_0x34ff('0x77')]={'mailbox':_0x5a8733[_0x34ff('0x6b')],'password':_0x5a8733[_0x34ff('0x65')],'fullname':_0x5a8733[_0x34ff('0x78')],'email':_0x5a8733[_0x34ff('0x79')]};}if(_0x5a8733['role']===_0x34ff('0x7a')){if(!_0x5a8733[_0x34ff('0x7b')])_0x5a8733[_0x34ff('0x7b')]=['101',_0x34ff('0x7c'),_0x34ff('0x7d'),'113',_0x34ff('0x7e'),_0x34ff('0x7f'),_0x34ff('0x80'),_0x34ff('0x81'),_0x34ff('0x82'),_0x34ff('0x83'),_0x34ff('0x84'),'100',_0x34ff('0x85'),_0x34ff('0x86'),_0x34ff('0x87')];}_0x1720ed(_0x5a8733);}catch(_0x34492f){_0xda2f77(_0x34492f);}});}exports['create']=function(_0x2dcb8f,_0x20cff2){if(_0x2dcb8f[_0x34ff('0x3a')]['role']===_0x34ff('0x7a'))throw new Error(_0x34ff('0x88'));if(_0x2dcb8f['body']['role']===_0x34ff('0x3a')&&_0x2dcb8f[_0x34ff('0x3a')]['role']!=='admin'){throw new Error(_0x34ff('0x89'));}if(_0x2dcb8f['body']['role']==='admin'&&_0x2dcb8f['user'][_0x34ff('0x42')]!==_0x34ff('0x38')){throw new Error(_0x34ff('0x8a'));}return licenseUtil[_0x34ff('0x8b')]([_0x2dcb8f[_0x34ff('0x66')]])[_0x34ff('0x35')](function(){return validateUser(_0x2dcb8f['body']);})[_0x34ff('0x35')](function(_0x1093c7){return updateUser(_0x1093c7)[_0x34ff('0x35')](function(_0x2844e2){if(_0x2844e2['role']===_0x34ff('0x38')){_0x2844e2[_0x34ff('0x8c')]=_0x2dcb8f['user'][_0x34ff('0x8c')];delete _0x2844e2['userProfileId'];}return _0x2844e2;});})[_0x34ff('0x35')](function(_0x564474){return db[_0x34ff('0x48')][_0x34ff('0x8d')](_0x564474,{'include':[{'model':db[_0x34ff('0x77')],'as':_0x34ff('0x77')}]});})[_0x34ff('0x35')](function(_0x1e6ad4){if(_0x2dcb8f[_0x34ff('0x66')][_0x34ff('0x42')]===_0x34ff('0x3a'))return _0x1e6ad4;if(_0x2dcb8f[_0x34ff('0x3a')]['role']!==_0x34ff('0x3a'))return _0x1e6ad4;return db['UserProfileSection'][_0x34ff('0x41')]({'where':{'name':_0x1e6ad4['role']===_0x34ff('0x7a')?_0x34ff('0x3b'):'Telephones','userProfileId':_0x2dcb8f['user'][_0x34ff('0x8e')]},'raw':!![]})[_0x34ff('0x35')](function(_0x32276f){if(!_0x32276f||_0x32276f[_0x34ff('0x8f')]!=0x0)return _0x1e6ad4;return db[_0x34ff('0x44')]['create']({'name':_0x1e6ad4[_0x34ff('0x43')],'resourceId':_0x1e6ad4['id'],'type':_0x32276f[_0x34ff('0x43')],'sectionId':_0x32276f['id']},{})[_0x34ff('0x35')](function(){return _0x1e6ad4;});})['catch'](function(_0x2d327e){logger[_0x34ff('0x24')](_0x34ff('0x90'),_0x2d327e);throw _0x2d327e;});})[_0x34ff('0x35')](respondWithResult(_0x20cff2,0xc9))[_0x34ff('0x28')](handleError(_0x20cff2,null));};exports[_0x34ff('0x91')]=function(_0x2e9c9b,_0x781180){var _0x2c5c33=_0x2e9c9b[_0x34ff('0x66')];var _0x4220e1=[];if(_0x2e9c9b['user']['role']===_0x34ff('0x7a'))throw new Error(_0x34ff('0x88'));if(_[_0x34ff('0x92')](_0x2c5c33,[_0x34ff('0x42'),'user'])&&_0x2e9c9b[_0x34ff('0x3a')]['role']!==_0x34ff('0x38')){throw new Error(_0x34ff('0x89'));}if(_[_0x34ff('0x92')](_0x2c5c33,[_0x34ff('0x42'),_0x34ff('0x38')])&&_0x2e9c9b['user'][_0x34ff('0x42')]!=='admin'){throw new Error(_0x34ff('0x93'));}return licenseUtil[_0x34ff('0x8b')](_0x2c5c33)[_0x34ff('0x35')](function(){return validateUser(_0x2c5c33[0x0]);})[_0x34ff('0x35')](function(){for(var _0x563159=0x1;_0x563159<_0x2c5c33[_0x34ff('0x53')];_0x563159++){var _0x56f26f=_0x2c5c33[_0x563159-0x1][_0x34ff('0x6b')];if(!_0x2c5c33[_0x563159][_0x34ff('0x6b')])_0x2c5c33[_0x563159][_0x34ff('0x6b')]=_0x56f26f+0x1;_0x4220e1['push'](validateUser(_0x2c5c33[_0x563159]));}return BPromise[_0x34ff('0x94')](_0x4220e1);})[_0x34ff('0x35')](function(){_0x4220e1=[];for(var _0x27841a=0x0;_0x27841a<_0x2c5c33[_0x34ff('0x53')];_0x27841a++){_0x4220e1[_0x34ff('0x95')](updateUser(_0x2c5c33[_0x27841a]));}return BPromise[_0x34ff('0x94')](_0x4220e1);})[_0x34ff('0x35')](function(){return BPromise[_0x34ff('0x96')](_0x2c5c33,function(_0x608996){return db[_0x34ff('0x48')][_0x34ff('0x8d')](_0x608996,{'include':[{'model':db[_0x34ff('0x77')],'as':'VoiceMail'}]})[_0x34ff('0x35')](function(_0x120b3b){_0x608996['id']=_0x120b3b['id'];return _0x608996;});});})['then'](function(_0x4912e3){if(_0x2e9c9b[_0x34ff('0x66')][_0x34ff('0x42')]==='user')return _0x4912e3;if(_0x2e9c9b[_0x34ff('0x3a')]['role']!==_0x34ff('0x3a'))return _0x4912e3;var _0x10b2a5=_[_0x34ff('0x92')](_0x4912e3,function(_0x22009b){return _0x22009b[_0x34ff('0x42')]==='agent'||_0x22009b[_0x34ff('0x42')]===_0x34ff('0x3c');});if(!_0x10b2a5)return _0x4912e3;return db[_0x34ff('0x97')][_0x34ff('0x62')]({'where':{'name':{'$or':['Agents',_0x34ff('0x98')]},'userProfileId':_0x2e9c9b[_0x34ff('0x3a')][_0x34ff('0x8e')]},'raw':!![]})[_0x34ff('0x35')](function(_0x1fb7f5){if(_[_0x34ff('0x99')](_0x1fb7f5)||!_['some'](_0x1fb7f5,['autoAssociation',0x0]))return _0x4912e3;_0x4220e1=[];var _0x15c905=_(_0x1fb7f5)['map'](function(_0x59dfdb){if(_0x59dfdb['autoAssociation']===0x1)return;return _0x59dfdb[_0x34ff('0x43')]==='Agents'?_0x34ff('0x7a'):'telephone';})[_0x34ff('0x9a')]()[_0x34ff('0x40')]();for(var _0x1848e2=0x0;_0x1848e2<_0x4912e3['length'];_0x1848e2++){if(!_[_0x34ff('0x9b')](_0x15c905,_0x4912e3[_0x1848e2][_0x34ff('0x42')]))return;var _0x54c074=_0x4912e3[_0x1848e2][_0x34ff('0x42')]===_0x34ff('0x7a')?_0x34ff('0x3b'):_0x34ff('0x98');_0x4220e1[_0x34ff('0x95')](db[_0x34ff('0x44')][_0x34ff('0x8d')]({'name':_0x4912e3[_0x1848e2][_0x34ff('0x43')],'resourceId':_0x4912e3[_0x1848e2]['id'],'type':_0x54c074,'sectionId':_[_0x34ff('0x41')](_0x1fb7f5,[_0x34ff('0x43'),_0x54c074])['id']},{}));}return BPromise['all'](_0x4220e1);});})[_0x34ff('0x35')](respondWithResult(_0x781180,0xc9))[_0x34ff('0x28')](handleError(_0x781180,null));};exports[_0x34ff('0x9c')]=function(_0x52aa74,_0x3713b4,_0x4a1c90){if(_0x52aa74['body']['id']){delete _0x52aa74[_0x34ff('0x66')]['id'];}return db['User'][_0x34ff('0x41')]({'where':{'id':_0x52aa74['params']['id']}})[_0x34ff('0x35')](function(_0x3d2984){if(!_0x3d2984)return null;if(_0x3d2984['id']===_0x52aa74[_0x34ff('0x3a')]['id']){if(!_0x52aa74[_0x34ff('0x66')][_0x34ff('0x9d')]||!_0x52aa74['body'][_0x34ff('0x9e')]){throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))](_0x34ff('0xa1'));}if(!_0x3d2984[_0x34ff('0xa2')](_0x52aa74[_0x34ff('0x66')]['oldPassword'])){throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))](_0x34ff('0xa3'));}if(_0x52aa74[_0x34ff('0x66')]['oldPassword']===_0x52aa74[_0x34ff('0x66')]['newPassword']){throw new db['Sequelize'][(_0x34ff('0xa0'))](_0x34ff('0xa4'));}}else if(_0x52aa74['user'][_0x34ff('0x42')]===_0x34ff('0x38')){if(!_0x52aa74[_0x34ff('0x66')][_0x34ff('0x9e')]){throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))](_0x34ff('0xa5'));}}else if(_0x52aa74[_0x34ff('0x3a')][_0x34ff('0x42')]===_0x34ff('0x3a')){if(!_0x52aa74[_0x34ff('0x66')][_0x34ff('0x9e')]){throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))](_0x34ff('0xa5'));}if(_0x3d2984[_0x34ff('0x42')]!==_0x34ff('0x7a')){throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))](_0x34ff('0x88'));}}else{throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))](_0x34ff('0x88'));}return _0x3d2984;})[_0x34ff('0x35')](handleEntityNotFound(_0x3713b4,null))[_0x34ff('0x35')](function(_0xa5422a){return db[_0x34ff('0x6c')]['findOne']({'attributes':['id',_0x34ff('0x6e'),_0x34ff('0xa6'),_0x34ff('0xa7')]})[_0x34ff('0x35')](function(_0x516052){if(_0x516052[_0x34ff('0x6e')])authService[_0x34ff('0x6f')](_0x52aa74['body'][_0x34ff('0x9e')]);if(!_0x516052[_0x34ff('0xa6')]||!_0xa5422a[_0x34ff('0xa8')])return _0xa5422a;authService['validatePasswordHistory'](_0x52aa74[_0x34ff('0x66')][_0x34ff('0x9e')],_0xa5422a[_0x34ff('0xa8')],_0x516052[_0x34ff('0xa7')]);return _0xa5422a;})['then'](saveUpdates({'password':_0x52aa74[_0x34ff('0x66')][_0x34ff('0x9e')],'passwordResetAt':_0x52aa74[_0x34ff('0x3a')]['id']==_0x52aa74['params']['id']?moment():null,'previousPasswords':authService[_0x34ff('0xa9')](_0x52aa74[_0x34ff('0x66')][_0x34ff('0x9e')],_0xa5422a['previousPasswords'])},null));})[_0x34ff('0x35')](respondWithResult(_0x3713b4,null))[_0x34ff('0x28')](handleError(_0x3713b4,null));};exports[_0x34ff('0xaa')]=function(_0x467089,_0x54ae89,_0x528ca6){var _0xfe4aa3=_0x467089['body'][_0x34ff('0xab')];return db[_0x34ff('0x48')][_0x34ff('0x41')]({'where':{'id':_0x467089[_0x34ff('0x67')]['id']},'attributes':['id',_0x34ff('0x43'),_0x34ff('0x42'),_0x34ff('0xac'),_0x34ff('0xad'),_0x34ff('0xae'),_0x34ff('0xaf')]})['then'](handleEntityNotFound(_0x54ae89,null))['then'](function(_0x3b0c78){if(_0x3b0c78){if(!utils[_0x34ff('0xb0')](_0xfe4aa3)){throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))]('Unknown\x20channel');}return _0x3b0c78[_0x34ff('0xb1')+_[_0x34ff('0xb2')](_0xfe4aa3[_0x34ff('0xb3')]())+_0x34ff('0xb4')](_0x467089['body'][_0x34ff('0x69')],{'penalty':_0x467089[_0x34ff('0x66')][_0x34ff('0xb5')]||0x0})[_0x34ff('0xb6')](function(_0x5c9cc2){for(var _0x139163=0x0;_0x139163<_0x467089[_0x34ff('0x66')][_0x34ff('0x69')][_0x34ff('0x53')];_0x139163+=0x1){var _0x1d1a6e={'UserId':_0x467089[_0x34ff('0x67')]['id']};_0x1d1a6e[_['capitalize'](_0xfe4aa3['toLowerCase']())+'QueueId']=_0x467089[_0x34ff('0x66')][_0x34ff('0x69')][_0x139163];socket[_0x34ff('0xb7')](_0x34ff('0x3a')+_[_0x34ff('0xb2')](_0xfe4aa3[_0x34ff('0xb3')]())+_0x34ff('0xb8'),_0x1d1a6e);}return _0x5c9cc2;})[_0x34ff('0x35')](function(){if(_0xfe4aa3===_0x34ff('0xb9')){return db[_0x34ff('0xba')][_0x34ff('0x62')]({'where':{'id':_0x467089[_0x34ff('0x66')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x34ff('0x35')](function(_0x47eaca){var _0x354ed3=_0x3b0c78[_0x34ff('0x37')]({'plain':!![]});var _0x5c8cb7=[];if(_0xfe4aa3===_0x34ff('0xb9')&&_0x354ed3[_0x34ff('0x42')]===_0x34ff('0x7a')&&_0x354ed3[_0x34ff('0xac')]){for(var _0x16323a=0x0;_0x16323a<_0x47eaca[_0x34ff('0x53')];_0x16323a+=0x1){_0x5c8cb7['push']({'membername':_0x354ed3[_0x34ff('0x43')],'UserId':_0x354ed3['id'],'queue_name':_0x47eaca[_0x16323a][_0x34ff('0x43')],'VoiceQueueId':_0x47eaca[_0x16323a]['id'],'interface':_[_0x34ff('0x70')](_0x354ed3[_0x34ff('0xaf')])?util[_0x34ff('0xbb')]('SIP/%s',_0x354ed3[_0x34ff('0x43')]):_0x354ed3[_0x34ff('0xaf')],'paused':_0x354ed3[_0x34ff('0xae')]||![],'penalty':_0x467089[_0x34ff('0x66')]['penalty']||0x0});}return BPromise[_0x34ff('0x96')](_0x5c8cb7,function(_0x570e32){return db[_0x34ff('0xbc')][_0x34ff('0xbd')](_0x570e32);});}return _0x3b0c78;});}})[_0x34ff('0x35')](respondWithStatusCode(_0x54ae89,null))[_0x34ff('0x28')](handleError(_0x54ae89,null));};exports[_0x34ff('0xbe')]=function(_0x492506,_0x564e41,_0x737948){var _0x34b6a4;return db[_0x34ff('0x48')][_0x34ff('0x41')]({'where':{'id':_0x492506[_0x34ff('0x67')]['id']},'attributes':['id',_0x34ff('0x43'),_0x34ff('0x42')]})[_0x34ff('0x35')](handleEntityNotFound(_0x564e41,null))[_0x34ff('0x35')](function(_0x4f1aa1){if(_0x4f1aa1){_0x34b6a4=_0x4f1aa1;if(!_0x492506['query'][_0x34ff('0xab')]||!utils[_0x34ff('0xb0')](_0x492506[_0x34ff('0x4e')][_0x34ff('0xab')])){throw new db[(_0x34ff('0x9f'))]['ValidationError'](_0x34ff('0xbf'));}return _0x4f1aa1[_0x34ff('0xc0')+_[_0x34ff('0xb2')](_0x492506[_0x34ff('0x4e')][_0x34ff('0xab')][_0x34ff('0xb3')]())+'Queues'](_0x492506[_0x34ff('0x4e')][_0x34ff('0x69')]);}})[_0x34ff('0x35')](function(_0x518579){for(var _0x19a45d=0x0;_0x19a45d<_0x492506[_0x34ff('0x4e')]['ids'][_0x34ff('0x53')];_0x19a45d+=0x1){var _0x143b86={'UserId':_0x492506['params']['id']};_0x143b86[_[_0x34ff('0xb2')](_0x492506[_0x34ff('0x4e')][_0x34ff('0xab')][_0x34ff('0xb3')]())+_0x34ff('0xc1')]=_0x492506['query']['ids'][_0x19a45d];socket[_0x34ff('0xb7')](_0x34ff('0x3a')+_['capitalize'](_0x492506[_0x34ff('0x4e')][_0x34ff('0xab')][_0x34ff('0xb3')]())+_0x34ff('0xc2'),_0x143b86);}return _0x518579;})[_0x34ff('0x35')](function(){if(_0x492506[_0x34ff('0x4e')][_0x34ff('0xab')]==='voice'){return db[_0x34ff('0xbc')][_0x34ff('0x36')]({'where':{'UserId':_0x492506[_0x34ff('0x67')]['id'],'VoiceQueueId':_0x492506[_0x34ff('0x4e')][_0x34ff('0x69')]},'individualHooks':!![]})['then'](function(){return _0x34b6a4;});}return _0x34b6a4;})['then'](respondWithStatusCode(_0x564e41,null))[_0x34ff('0x28')](handleError(_0x564e41,null));};exports['addAvatar']=function(_0x1bfbea,_0x2820da,_0x285919){_0x1bfbea[_0x34ff('0x66')][_0x34ff('0xc3')]=_0x1bfbea[_0x34ff('0xc4')][_0x34ff('0xc5')];return db[_0x34ff('0x48')][_0x34ff('0x41')]({'where':{'id':_0x1bfbea['params']['id']}})['then'](handleEntityNotFound(_0x2820da,null))[_0x34ff('0x35')](saveUpdates(_0x1bfbea['body'],null))[_0x34ff('0x35')](respondWithResult(_0x2820da,null))[_0x34ff('0x28')](handleError(_0x2820da,null));};exports[_0x34ff('0xc6')]=function(_0x22d44b,_0x5a7300,_0x36bb35){var _0x510f5a=path[_0x34ff('0xc7')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x34ff('0x48')][_0x34ff('0x41')]({'where':{'id':_0x22d44b[_0x34ff('0x67')]['id']},'attributes':['id',_0x34ff('0xc3')],'raw':!![]})[_0x34ff('0x35')](handleEntityNotFound(_0x5a7300,null))[_0x34ff('0x35')](function(_0x1d4769){if(_0x1d4769){if(_[_0x34ff('0x70')](_0x1d4769['userpic'])){return _0x5a7300[_0x34ff('0xc8')](_0x510f5a);}else{if(!fs[_0x34ff('0xc9')](path['join'](config[_0x34ff('0xca')],_0x34ff('0xcb'),_0x1d4769[_0x34ff('0xc3')]))){return _0x5a7300['download'](_0x510f5a);}return _0x5a7300[_0x34ff('0xc8')](path[_0x34ff('0xc7')](config[_0x34ff('0xca')],_0x34ff('0xcb'),_0x1d4769[_0x34ff('0xc3')]));}}})[_0x34ff('0x28')](handleError(_0x5a7300,null));};exports[_0x34ff('0xcc')]=function(_0x2ab64b,_0x5eb8c2,_0x3e52cd){var _0x570bbc={};var _0xe48f16={};var _0x55bd14;var _0x567bab;return db[_0x34ff('0x48')][_0x34ff('0xcd')]({'where':{'id':_0x2ab64b[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x5eb8c2,null))[_0x34ff('0x35')](function(_0x4ab3ed){if(_0x4ab3ed){_0x55bd14=_0x4ab3ed;_0xe48f16[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db[_0x34ff('0xce')][_0x34ff('0x49')]);_0xe48f16[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x2ab64b[_0x34ff('0x4e')]);_0xe48f16['filters']=_[_0x34ff('0x50')](_0xe48f16[_0x34ff('0x4c')],_0xe48f16[_0x34ff('0x4e')]);_0x570bbc['attributes']=_[_0x34ff('0x50')](_0xe48f16[_0x34ff('0x4c')],qs[_0x34ff('0x52')](_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x570bbc['attributes']=_0x570bbc[_0x34ff('0x51')][_0x34ff('0x53')]?_0x570bbc[_0x34ff('0x51')]:_0xe48f16[_0x34ff('0x4c')];_0x570bbc[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x2ab64b[_0x34ff('0x4e')]['sort']);_0x570bbc['where']=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x2ab64b[_0x34ff('0x4e')],_0xe48f16[_0x34ff('0x59')]));if(_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x570bbc[_0x34ff('0x58')]=_['merge'](_0x570bbc[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x570bbc[_0x34ff('0x51')],function(_0x2d6e65){var _0x2480df={};_0x2480df[_0x2d6e65]={'$like':'%'+_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%'};return _0x2480df;})});}_0x570bbc=_[_0x34ff('0x5b')]({},_0x570bbc,_0x2ab64b[_0x34ff('0x5f')]);return _0x55bd14[_0x34ff('0xcc')](_0x570bbc);}})[_0x34ff('0x35')](function(_0xc98a84){if(_0xc98a84){_0x567bab=_0xc98a84[_0x34ff('0x53')];if(_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0x54')]('includeAll')){_0x570bbc[_0x34ff('0x61')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x34ff('0xcf')],'as':_0x34ff('0xd0'),'attributes':['id',_0x34ff('0x43'),_0x34ff('0xd1')],'where':_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0xd2')]?{'id':_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0xd2')]}:undefined,'required':_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0xd2')]?!![]:![]}];}if(!_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0x54')](_0x34ff('0x55'))){_0x570bbc[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x2ab64b['query'][_0x34ff('0x2e')]);_0x570bbc[_0x34ff('0x2d')]=qs['offset'](_0x2ab64b[_0x34ff('0x4e')][_0x34ff('0x2d')]);}return _0x55bd14[_0x34ff('0xcc')](_0x570bbc);}})['then'](function(_0x1744cc){if(_0x1744cc){return _0x1744cc?{'count':_0x567bab,'rows':_0x1744cc}:null;}})['then'](respondWithResult(_0x5eb8c2,null))[_0x34ff('0x28')](handleError(_0x5eb8c2,null));};exports[_0x34ff('0xd3')]=function(_0x22f596,_0x4e7cdc,_0x5aa339){var _0x3ecf65;var _0x5cd6b2;var _0x5987c6={};var _0xd7679b;return db[_0x34ff('0x48')][_0x34ff('0xcd')]({'where':{'id':_0x22f596[_0x34ff('0x67')]['id']},'attributes':['id',_0x34ff('0x43'),_0x34ff('0x42')]})['then'](handleEntityNotFound(_0x4e7cdc,null))[_0x34ff('0x35')](function(_0x3fde6d){if(!utils[_0x34ff('0xb0')](_0x22f596['query']['channel'])){throw new db[(_0x34ff('0x9f'))]['ValidationError']('Unknown\x20channel');}_0x3ecf65=_0x3fde6d;var _0x26ee21={};_0x26ee21['model']=_[_0x34ff('0x4f')](db[_[_0x34ff('0xb2')](_0x22f596[_0x34ff('0x4e')][_0x34ff('0xab')])+_0x34ff('0xd4')]['rawAttributes']);_0x26ee21[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x22f596['query']);_0x26ee21['filters']=_[_0x34ff('0x50')](_0x26ee21['model'],_0x26ee21[_0x34ff('0x4e')]);_0x5987c6[_0x34ff('0x51')]=_[_0x34ff('0x50')](_0x26ee21[_0x34ff('0x4c')],qs['fields'](_0x22f596[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x5987c6[_0x34ff('0x51')]=_0x5987c6[_0x34ff('0x51')][_0x34ff('0x53')]?_0x5987c6[_0x34ff('0x51')]:_0x26ee21[_0x34ff('0x4c')];_0x5987c6[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x22f596['query']['sort']);_0x5987c6['where']=qs['filters'](_[_0x34ff('0x5a')](_0x22f596['query'],_0x26ee21[_0x34ff('0x59')]));if(_0x22f596[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x5987c6[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x5987c6[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x5987c6[_0x34ff('0x51')],function(_0x1aa2dd){var _0x5252f4={};_0x5252f4[_0x1aa2dd]={'$like':'%'+_0x22f596['query'][_0x34ff('0x3d')]+'%'};return _0x5252f4;})});}_0x5987c6=_[_0x34ff('0x5b')]({},_0x5987c6,_0x22f596['options']);switch(_0x3ecf65[_0x34ff('0x42')]){case _0x34ff('0x38'):return db[_[_0x34ff('0xb2')](_0x22f596[_0x34ff('0x4e')][_0x34ff('0xab')])+_0x34ff('0xd4')][_0x34ff('0x62')](_0x5987c6);case _0x34ff('0x3a'):case'agent':return _0x3ecf65['get'+_['capitalize'](_0x22f596[_0x34ff('0x4e')][_0x34ff('0xab')])+_0x34ff('0xb4')](_0x5987c6);default:throw new db['Sequelize'][(_0x34ff('0xa0'))](_0x34ff('0xd5'));}})['then'](function(_0x341be2){_0xd7679b=_0x341be2['length'];if(!_0x22f596[_0x34ff('0x4e')][_0x34ff('0x54')](_0x34ff('0x55'))){_0x5987c6['limit']=qs[_0x34ff('0x2e')](_0x22f596[_0x34ff('0x4e')]['limit']);_0x5987c6['offset']=qs[_0x34ff('0x2d')](_0x22f596[_0x34ff('0x4e')][_0x34ff('0x2d')]);}switch(_0x3ecf65['role']){case'admin':return db[_['capitalize'](_0x22f596[_0x34ff('0x4e')][_0x34ff('0xab')])+_0x34ff('0xd4')][_0x34ff('0x62')](_0x5987c6);case _0x34ff('0x3a'):case _0x34ff('0x7a'):return _0x3ecf65[_0x34ff('0x37')+_[_0x34ff('0xb2')](_0x22f596[_0x34ff('0x4e')]['channel'])+'Queues'](_0x5987c6);}})[_0x34ff('0x35')](function(_0x1753a8){return{'count':_0xd7679b,'rows':_0x1753a8};})[_0x34ff('0x35')](respondWithResult(_0x4e7cdc,null))[_0x34ff('0x28')](handleError(_0x4e7cdc,null));};exports[_0x34ff('0xd6')]=function(_0x2bd4f3,_0x368064,_0xe267b9){var _0x31fd93={};var _0x241a6f={};var _0x3941aa;var _0x367fdb;return db[_0x34ff('0x48')][_0x34ff('0xcd')]({'where':{'id':_0x2bd4f3[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x368064,null))[_0x34ff('0x35')](function(_0x34269c){if(_0x34269c){_0x3941aa=_0x34269c;_0x241a6f['model']=_[_0x34ff('0x4f')](db['UserVoiceQueueRt'][_0x34ff('0x49')]);_0x241a6f[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x2bd4f3[_0x34ff('0x4e')]);_0x241a6f[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0x241a6f[_0x34ff('0x4c')],_0x241a6f[_0x34ff('0x4e')]);_0x31fd93['attributes']=_[_0x34ff('0x50')](_0x241a6f[_0x34ff('0x4c')],qs[_0x34ff('0x52')](_0x2bd4f3[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x31fd93[_0x34ff('0x51')]=_0x31fd93[_0x34ff('0x51')][_0x34ff('0x53')]?_0x31fd93['attributes']:_0x241a6f[_0x34ff('0x4c')];_0x31fd93[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x2bd4f3['query'][_0x34ff('0x57')]);_0x31fd93[_0x34ff('0x58')]=qs[_0x34ff('0x59')](_['pick'](_0x2bd4f3[_0x34ff('0x4e')],_0x241a6f[_0x34ff('0x59')]));if(_0x2bd4f3[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x31fd93[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x31fd93[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x31fd93[_0x34ff('0x51')],function(_0x3e9ee3){var _0xea28eb={};_0xea28eb[_0x3e9ee3]={'$like':'%'+_0x2bd4f3[_0x34ff('0x4e')]['filter']+'%'};return _0xea28eb;})});}_0x31fd93=_[_0x34ff('0x5b')]({},_0x31fd93,_0x2bd4f3[_0x34ff('0x5f')]);return _0x3941aa[_0x34ff('0xd6')](_0x31fd93);}})[_0x34ff('0x35')](function(_0x2ae04a){if(_0x2ae04a){_0x367fdb=_0x2ae04a[_0x34ff('0x53')];if(!_0x2bd4f3[_0x34ff('0x4e')]['hasOwnProperty'](_0x34ff('0x55'))){_0x31fd93[_0x34ff('0x2e')]=qs['limit'](_0x2bd4f3[_0x34ff('0x4e')]['limit']);_0x31fd93[_0x34ff('0x2d')]=qs['offset'](_0x2bd4f3[_0x34ff('0x4e')][_0x34ff('0x2d')]);}return _0x3941aa[_0x34ff('0xd6')](_0x31fd93);}})[_0x34ff('0x35')](function(_0x35fab0){if(_0x35fab0){return _0x35fab0?{'count':_0x367fdb,'rows':_0x35fab0}:null;}})[_0x34ff('0x35')](respondWithResult(_0x368064,null))['catch'](handleError(_0x368064,null));};exports[_0x34ff('0xd7')]=function(_0x2c0361,_0x1cc35c,_0x441449){var _0x17c055={};var _0x2537a4={};var _0x18166d;var _0xbd709a;return db[_0x34ff('0x48')][_0x34ff('0xcd')]({'where':{'id':_0x2c0361['params']['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x1cc35c,null))[_0x34ff('0x35')](function(_0x2116a1){if(_0x2116a1){_0x18166d=_0x2116a1;_0x2537a4[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db[_0x34ff('0xd8')][_0x34ff('0x49')]);_0x2537a4[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x2c0361[_0x34ff('0x4e')]);_0x2537a4['filters']=_['intersection'](_0x2537a4[_0x34ff('0x4c')],_0x2537a4[_0x34ff('0x4e')]);_0x17c055[_0x34ff('0x51')]=_['intersection'](_0x2537a4[_0x34ff('0x4c')],qs['fields'](_0x2c0361[_0x34ff('0x4e')]['fields']));_0x17c055[_0x34ff('0x51')]=_0x17c055[_0x34ff('0x51')][_0x34ff('0x53')]?_0x17c055[_0x34ff('0x51')]:_0x2537a4[_0x34ff('0x4c')];_0x17c055[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x2c0361[_0x34ff('0x4e')][_0x34ff('0x57')]);_0x17c055['where']=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x2c0361[_0x34ff('0x4e')],_0x2537a4[_0x34ff('0x59')]));if(_0x2c0361['query']['filter']){_0x17c055[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x17c055[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x17c055[_0x34ff('0x51')],function(_0x4f1f4d){var _0x3cdb83={};_0x3cdb83[_0x4f1f4d]={'$like':'%'+_0x2c0361[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%'};return _0x3cdb83;})});}_0x17c055=_[_0x34ff('0x5b')]({},_0x17c055,_0x2c0361[_0x34ff('0x5f')]);return _0x18166d[_0x34ff('0xd7')](_0x17c055);}})[_0x34ff('0x35')](function(_0x494373){if(_0x494373){_0xbd709a=_0x494373[_0x34ff('0x53')];if(!_0x2c0361['query']['hasOwnProperty'](_0x34ff('0x55'))){_0x17c055[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x2c0361[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x17c055['offset']=qs[_0x34ff('0x2d')](_0x2c0361[_0x34ff('0x4e')][_0x34ff('0x2d')]);}return _0x18166d['getGroups'](_0x17c055);}})[_0x34ff('0x35')](function(_0xb5e46f){if(_0xb5e46f){return _0xb5e46f?{'count':_0xbd709a,'rows':_0xb5e46f}:null;}})[_0x34ff('0x35')](respondWithResult(_0x1cc35c,null))[_0x34ff('0x28')](handleError(_0x1cc35c,null));};exports[_0x34ff('0xd9')]=function(_0x552e3c,_0x25e620,_0x3b476a){var _0x239abe={'raw':!![],'where':{}};var _0x4ea330={};var _0x151e8b={'count':0x0,'rows':[]};return db['User'][_0x34ff('0xcd')]({'where':{'id':_0x552e3c[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x25e620,null))['then'](function(_0x168240){if(_0x168240){_0x4ea330[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db[_0x34ff('0xda')][_0x34ff('0x49')]);_0x4ea330[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x552e3c['query']);_0x4ea330[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0x4ea330[_0x34ff('0x4c')],_0x4ea330[_0x34ff('0x4e')]);_0x239abe[_0x34ff('0x51')]=_[_0x34ff('0x50')](_0x4ea330[_0x34ff('0x4c')],qs[_0x34ff('0x52')](_0x552e3c[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x239abe[_0x34ff('0x51')]=_0x239abe[_0x34ff('0x51')][_0x34ff('0x53')]?_0x239abe[_0x34ff('0x51')]:_0x4ea330['model'];if(!_0x552e3c[_0x34ff('0x4e')][_0x34ff('0x54')](_0x34ff('0x55'))){_0x239abe[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x552e3c[_0x34ff('0x4e')]['limit']);_0x239abe[_0x34ff('0x2d')]=qs[_0x34ff('0x2d')](_0x552e3c['query'][_0x34ff('0x2d')]);}_0x239abe[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x552e3c[_0x34ff('0x4e')][_0x34ff('0x57')]);_0x239abe[_0x34ff('0x58')]=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x552e3c['query'],_0x4ea330[_0x34ff('0x59')]));_0x239abe[_0x34ff('0x58')][_0x34ff('0xdb')]=_0x168240['id'];if(_0x552e3c[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x239abe[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x239abe[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x239abe[_0x34ff('0x51')],function(_0x2c4eba){var _0x280776={};_0x280776[_0x2c4eba]={'$like':'%'+_0x552e3c[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%'};return _0x280776;})});}_0x239abe=_['merge']({},_0x239abe,_0x552e3c[_0x34ff('0x5f')]);return db[_0x34ff('0xda')][_0x34ff('0x2c')]({'where':_0x239abe['where']})[_0x34ff('0x35')](function(_0x56f23e){_0x151e8b[_0x34ff('0x2c')]=_0x56f23e;if(_0x552e3c['query'][_0x34ff('0x60')]){_0x239abe['include']=[{'all':!![]}];}return db[_0x34ff('0xda')]['findAll'](_0x239abe);})['then'](function(_0xe46cb8){_0x151e8b[_0x34ff('0x63')]=_0xe46cb8;return _0x151e8b;});}})[_0x34ff('0x35')](respondWithFilteredResult(_0x25e620,_0x239abe))[_0x34ff('0x28')](handleError(_0x25e620,null));};exports[_0x34ff('0xdc')]=function(_0x22756a,_0x4fe225,_0x1f7092){var _0x397f1a={'raw':!![],'where':{}};var _0x454b31={};var _0x41a04b={'count':0x0,'rows':[]};return db[_0x34ff('0x48')]['findOne']({'where':{'id':_0x22756a[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x4fe225,null))[_0x34ff('0x35')](function(_0x3c1a3a){if(_0x3c1a3a){_0x454b31['model']=_[_0x34ff('0x4f')](db[_0x34ff('0xdd')][_0x34ff('0x49')]);_0x454b31['query']=_[_0x34ff('0x4f')](_0x22756a['query']);_0x454b31['filters']=_['intersection'](_0x454b31[_0x34ff('0x4c')],_0x454b31[_0x34ff('0x4e')]);_0x397f1a[_0x34ff('0x51')]=_['intersection'](_0x454b31['model'],qs['fields'](_0x22756a[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x397f1a[_0x34ff('0x51')]=_0x397f1a['attributes'][_0x34ff('0x53')]?_0x397f1a[_0x34ff('0x51')]:_0x454b31[_0x34ff('0x4c')];if(!_0x22756a[_0x34ff('0x4e')]['hasOwnProperty']('nolimit')){_0x397f1a[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x22756a[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x397f1a['offset']=qs[_0x34ff('0x2d')](_0x22756a[_0x34ff('0x4e')][_0x34ff('0x2d')]);}_0x397f1a[_0x34ff('0x56')]=qs['sort'](_0x22756a[_0x34ff('0x4e')]['sort']);_0x397f1a[_0x34ff('0x58')]=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x22756a[_0x34ff('0x4e')],_0x454b31[_0x34ff('0x59')]));_0x397f1a['where']['UserId']=_0x3c1a3a['id'];if(_0x22756a[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x397f1a[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x397f1a[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x397f1a[_0x34ff('0x51')],function(_0x2fa9c5){var _0x201bc3={};_0x201bc3[_0x2fa9c5]={'$like':'%'+_0x22756a[_0x34ff('0x4e')]['filter']+'%'};return _0x201bc3;})});}_0x397f1a=_[_0x34ff('0x5b')]({},_0x397f1a,_0x22756a['options']);return db[_0x34ff('0xdd')][_0x34ff('0x2c')]({'where':_0x397f1a[_0x34ff('0x58')]})[_0x34ff('0x35')](function(_0x168028){_0x41a04b[_0x34ff('0x2c')]=_0x168028;if(_0x22756a['query'][_0x34ff('0x60')]){_0x397f1a['include']=[{'all':!![]}];}return db[_0x34ff('0xdd')][_0x34ff('0x62')](_0x397f1a);})[_0x34ff('0x35')](function(_0x5f4895){_0x41a04b[_0x34ff('0x63')]=_0x5f4895;return _0x41a04b;});}})[_0x34ff('0x35')](respondWithFilteredResult(_0x4fe225,_0x397f1a))[_0x34ff('0x28')](handleError(_0x4fe225,null));};exports['getChatInteractions']=function(_0x378367,_0xedd66b,_0x2fc5e4){var _0x5d8337={};var _0x428214={};var _0x125677;var _0x65b502;return db[_0x34ff('0x48')][_0x34ff('0xcd')]({'where':{'id':_0x378367[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0xedd66b,null))[_0x34ff('0x35')](function(_0x3986fe){if(_0x3986fe){_0x125677=_0x3986fe;_0x428214[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db[_0x34ff('0xde')][_0x34ff('0x49')]);_0x428214[_0x34ff('0x4e')]=_['keys'](_0x378367[_0x34ff('0x4e')]);_0x428214[_0x34ff('0x59')]=_['intersection'](_0x428214[_0x34ff('0x4c')],_0x428214['query']);_0x5d8337[_0x34ff('0x51')]=_[_0x34ff('0x50')](_0x428214[_0x34ff('0x4c')],qs[_0x34ff('0x52')](_0x378367[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x5d8337[_0x34ff('0x51')]=_0x5d8337[_0x34ff('0x51')][_0x34ff('0x53')]?_0x5d8337[_0x34ff('0x51')]:_0x428214[_0x34ff('0x4c')];_0x5d8337[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x378367[_0x34ff('0x4e')]['sort']);_0x5d8337['where']=qs[_0x34ff('0x59')](_['pick'](_0x378367['query'],_0x428214[_0x34ff('0x59')]));if(_0x378367['query'][_0x34ff('0x3d')]){_0x5d8337[_0x34ff('0x58')]=_['merge'](_0x5d8337['where'],{'$or':_[_0x34ff('0x3f')](_0x5d8337['attributes'],function(_0x464a3e){var _0x34dfe5={};_0x34dfe5[_0x464a3e]={'$like':'%'+_0x378367['query']['filter']+'%'};return _0x34dfe5;})});}_0x5d8337=_['merge']({},_0x5d8337,_0x378367[_0x34ff('0x5f')]);return _0x125677[_0x34ff('0xdf')](_0x5d8337);}})[_0x34ff('0x35')](function(_0x17293e){if(_0x17293e){_0x65b502=_0x17293e[_0x34ff('0x53')];if(!_0x378367['query'][_0x34ff('0x54')](_0x34ff('0x55'))){_0x5d8337[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x378367[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x5d8337['offset']=qs['offset'](_0x378367['query'][_0x34ff('0x2d')]);}return _0x125677[_0x34ff('0xdf')](_0x5d8337);}})[_0x34ff('0x35')](function(_0x3ac4d1){if(_0x3ac4d1){return _0x3ac4d1?{'count':_0x65b502,'rows':_0x3ac4d1}:null;}})[_0x34ff('0x35')](respondWithResult(_0xedd66b,null))[_0x34ff('0x28')](handleError(_0xedd66b,null));};exports[_0x34ff('0xe0')]=function(_0x266193,_0x59dfa2,_0x15ec0d){var _0x13509c={};var _0xee9d1f={};var _0x226e48;var _0x2315d3;return db[_0x34ff('0x48')]['findOne']({'where':{'id':_0x266193[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x59dfa2,null))[_0x34ff('0x35')](function(_0x37f707){if(_0x37f707){_0x226e48=_0x37f707;_0xee9d1f[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db[_0x34ff('0xe1')][_0x34ff('0x49')]);_0xee9d1f[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x266193[_0x34ff('0x4e')]);_0xee9d1f[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0xee9d1f['model'],_0xee9d1f[_0x34ff('0x4e')]);_0x13509c['attributes']=_[_0x34ff('0x50')](_0xee9d1f[_0x34ff('0x4c')],qs[_0x34ff('0x52')](_0x266193[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x13509c[_0x34ff('0x51')]=_0x13509c[_0x34ff('0x51')][_0x34ff('0x53')]?_0x13509c[_0x34ff('0x51')]:_0xee9d1f[_0x34ff('0x4c')];_0x13509c['order']=qs['sort'](_0x266193['query'][_0x34ff('0x57')]);_0x13509c['where']=qs[_0x34ff('0x59')](_['pick'](_0x266193[_0x34ff('0x4e')],_0xee9d1f[_0x34ff('0x59')]));if(_0x266193[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x13509c[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x13509c[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x13509c['attributes'],function(_0x4d8df0){var _0x1d5b23={};_0x1d5b23[_0x4d8df0]={'$like':'%'+_0x266193[_0x34ff('0x4e')]['filter']+'%'};return _0x1d5b23;})});}_0x13509c=_[_0x34ff('0x5b')]({},_0x13509c,_0x266193[_0x34ff('0x5f')]);return _0x226e48[_0x34ff('0xe0')](_0x13509c);}})[_0x34ff('0x35')](function(_0x179959){if(_0x179959){_0x2315d3=_0x179959[_0x34ff('0x53')];if(!_0x266193[_0x34ff('0x4e')]['hasOwnProperty']('nolimit')){_0x13509c['limit']=qs[_0x34ff('0x2e')](_0x266193[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x13509c[_0x34ff('0x2d')]=qs['offset'](_0x266193[_0x34ff('0x4e')][_0x34ff('0x2d')]);}return _0x226e48[_0x34ff('0xe0')](_0x13509c);}})['then'](function(_0x385847){if(_0x385847){return _0x385847?{'count':_0x2315d3,'rows':_0x385847}:null;}})[_0x34ff('0x35')](respondWithResult(_0x59dfa2,null))[_0x34ff('0x28')](handleError(_0x59dfa2,null));};exports[_0x34ff('0xe2')]=function(_0x5a6de4,_0x230431,_0x450bdd){var _0x317809={'raw':!![],'where':{}};var _0x3c088d={};var _0x45ab9f={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x5a6de4[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x230431,null))[_0x34ff('0x35')](function(_0x534070){if(_0x534070){_0x3c088d[_0x34ff('0x4c')]=_['keys'](db['MailInteraction'][_0x34ff('0x49')]);_0x3c088d[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x5a6de4['query']);_0x3c088d[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0x3c088d['model'],_0x3c088d[_0x34ff('0x4e')]);_0x317809[_0x34ff('0x51')]=_[_0x34ff('0x50')](_0x3c088d['model'],qs[_0x34ff('0x52')](_0x5a6de4[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x317809['attributes']=_0x317809[_0x34ff('0x51')][_0x34ff('0x53')]?_0x317809[_0x34ff('0x51')]:_0x3c088d[_0x34ff('0x4c')];if(!_0x5a6de4[_0x34ff('0x4e')][_0x34ff('0x54')](_0x34ff('0x55'))){_0x317809[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x5a6de4[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x317809['offset']=qs[_0x34ff('0x2d')](_0x5a6de4[_0x34ff('0x4e')][_0x34ff('0x2d')]);}_0x317809['order']=qs[_0x34ff('0x57')](_0x5a6de4['query'][_0x34ff('0x57')]);_0x317809['where']=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x5a6de4[_0x34ff('0x4e')],_0x3c088d[_0x34ff('0x59')]));_0x317809['where']['UserId']=_0x534070['id'];if(_0x5a6de4[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x317809[_0x34ff('0x58')]=_['merge'](_0x317809[_0x34ff('0x58')],{'$or':_['map'](_0x317809['attributes'],function(_0x3e685e){var _0x27116d={};_0x27116d[_0x3e685e]={'$like':'%'+_0x5a6de4[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%'};return _0x27116d;})});}_0x317809=_[_0x34ff('0x5b')]({},_0x317809,_0x5a6de4[_0x34ff('0x5f')]);return db[_0x34ff('0xe3')][_0x34ff('0x2c')]({'where':_0x317809[_0x34ff('0x58')]})['then'](function(_0x103fd7){_0x45ab9f[_0x34ff('0x2c')]=_0x103fd7;if(_0x5a6de4['query'][_0x34ff('0x60')]){_0x317809[_0x34ff('0x61')]=[{'all':!![]}];}return db[_0x34ff('0xe3')]['findAll'](_0x317809);})[_0x34ff('0x35')](function(_0x34dee2){_0x45ab9f[_0x34ff('0x63')]=_0x34dee2;return _0x45ab9f;});}})[_0x34ff('0x35')](respondWithFilteredResult(_0x230431,_0x317809))[_0x34ff('0x28')](handleError(_0x230431,null));};exports[_0x34ff('0xe4')]=function(_0x15cff5,_0x31ce4e,_0xf90997){var _0x369474={};var _0x49c8ec={};var _0xf56b7d;var _0x512ef5;return db[_0x34ff('0x48')]['findOne']({'where':{'id':_0x15cff5['params']['id']}})['then'](handleEntityNotFound(_0x31ce4e,null))['then'](function(_0x58320e){if(_0x58320e){_0xf56b7d=_0x58320e;_0x49c8ec['model']=_[_0x34ff('0x4f')](db['SmsInteraction'][_0x34ff('0x49')]);_0x49c8ec[_0x34ff('0x4e')]=_['keys'](_0x15cff5[_0x34ff('0x4e')]);_0x49c8ec[_0x34ff('0x59')]=_['intersection'](_0x49c8ec[_0x34ff('0x4c')],_0x49c8ec[_0x34ff('0x4e')]);_0x369474['attributes']=_[_0x34ff('0x50')](_0x49c8ec['model'],qs[_0x34ff('0x52')](_0x15cff5[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x369474['attributes']=_0x369474[_0x34ff('0x51')][_0x34ff('0x53')]?_0x369474['attributes']:_0x49c8ec[_0x34ff('0x4c')];_0x369474[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x15cff5[_0x34ff('0x4e')][_0x34ff('0x57')]);_0x369474['where']=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x15cff5[_0x34ff('0x4e')],_0x49c8ec[_0x34ff('0x59')]));if(_0x15cff5[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x369474[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x369474['where'],{'$or':_['map'](_0x369474[_0x34ff('0x51')],function(_0x3041f3){var _0x556000={};_0x556000[_0x3041f3]={'$like':'%'+_0x15cff5[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%'};return _0x556000;})});}_0x369474=_['merge']({},_0x369474,_0x15cff5[_0x34ff('0x5f')]);return _0xf56b7d[_0x34ff('0xe4')](_0x369474);}})[_0x34ff('0x35')](function(_0x3cee04){if(_0x3cee04){_0x512ef5=_0x3cee04[_0x34ff('0x53')];if(!_0x15cff5['query'][_0x34ff('0x54')](_0x34ff('0x55'))){_0x369474[_0x34ff('0x2e')]=qs['limit'](_0x15cff5[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x369474[_0x34ff('0x2d')]=qs[_0x34ff('0x2d')](_0x15cff5[_0x34ff('0x4e')][_0x34ff('0x2d')]);}return _0xf56b7d['getSmsInteractions'](_0x369474);}})[_0x34ff('0x35')](function(_0x54da52){if(_0x54da52){return _0x54da52?{'count':_0x512ef5,'rows':_0x54da52}:null;}})[_0x34ff('0x35')](respondWithResult(_0x31ce4e,null))[_0x34ff('0x28')](handleError(_0x31ce4e,null));};exports[_0x34ff('0xe5')]=function(_0x4be364,_0x1fe894,_0x4b5978){var _0xc4936e={};var _0x237a8f={};var _0x5abe3b;var _0x229c68;return db[_0x34ff('0x48')]['findOne']({'where':{'id':_0x4be364['params']['id']}})['then'](handleEntityNotFound(_0x1fe894,null))[_0x34ff('0x35')](function(_0x1df12f){if(_0x1df12f){_0x5abe3b=_0x1df12f;_0x237a8f[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db[_0x34ff('0xe6')]['rawAttributes']);_0x237a8f[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x4be364[_0x34ff('0x4e')]);_0x237a8f[_0x34ff('0x59')]=_['intersection'](_0x237a8f[_0x34ff('0x4c')],_0x237a8f[_0x34ff('0x4e')]);_0xc4936e[_0x34ff('0x51')]=_[_0x34ff('0x50')](_0x237a8f['model'],qs[_0x34ff('0x52')](_0x4be364['query']['fields']));_0xc4936e[_0x34ff('0x51')]=_0xc4936e[_0x34ff('0x51')]['length']?_0xc4936e[_0x34ff('0x51')]:_0x237a8f[_0x34ff('0x4c')];_0xc4936e['order']=qs[_0x34ff('0x57')](_0x4be364[_0x34ff('0x4e')]['sort']);_0xc4936e[_0x34ff('0x58')]=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x4be364[_0x34ff('0x4e')],_0x237a8f[_0x34ff('0x59')]));if(_0x4be364['query'][_0x34ff('0x3d')]){_0xc4936e[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0xc4936e[_0x34ff('0x58')],{'$or':_['map'](_0xc4936e['attributes'],function(_0x58aa2e){var _0x3f2b8f={};_0x3f2b8f[_0x58aa2e]={'$like':'%'+_0x4be364[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%'};return _0x3f2b8f;})});}_0xc4936e=_[_0x34ff('0x5b')]({},_0xc4936e,_0x4be364[_0x34ff('0x5f')]);return _0x5abe3b[_0x34ff('0xe5')](_0xc4936e);}})[_0x34ff('0x35')](function(_0x17e86c){if(_0x17e86c){_0x229c68=_0x17e86c[_0x34ff('0x53')];if(!_0x4be364[_0x34ff('0x4e')]['hasOwnProperty'](_0x34ff('0x55'))){_0xc4936e['limit']=qs[_0x34ff('0x2e')](_0x4be364[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0xc4936e[_0x34ff('0x2d')]=qs[_0x34ff('0x2d')](_0x4be364['query'][_0x34ff('0x2d')]);}return _0x5abe3b[_0x34ff('0xe5')](_0xc4936e);}})['then'](function(_0x5ab3f7){if(_0x5ab3f7){return _0x5ab3f7?{'count':_0x229c68,'rows':_0x5ab3f7}:null;}})[_0x34ff('0x35')](respondWithResult(_0x1fe894,null))[_0x34ff('0x28')](handleError(_0x1fe894,null));};exports[_0x34ff('0xe7')]=function(_0x9381b4,_0x4dc64f,_0x4f756d){var _0x8df001={};var _0x202edd={};var _0x440d2e;var _0x32494c;return db[_0x34ff('0x48')]['findOne']({'where':{'id':_0x9381b4[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x4dc64f,null))['then'](function(_0x5abd50){if(_0x5abd50){_0x440d2e=_0x5abd50;_0x202edd[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db['WhatsappInteraction'][_0x34ff('0x49')]);_0x202edd[_0x34ff('0x4e')]=_['keys'](_0x9381b4[_0x34ff('0x4e')]);_0x202edd[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0x202edd[_0x34ff('0x4c')],_0x202edd[_0x34ff('0x4e')]);_0x8df001[_0x34ff('0x51')]=_['intersection'](_0x202edd['model'],qs[_0x34ff('0x52')](_0x9381b4[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x8df001[_0x34ff('0x51')]=_0x8df001[_0x34ff('0x51')][_0x34ff('0x53')]?_0x8df001[_0x34ff('0x51')]:_0x202edd['model'];_0x8df001[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x9381b4[_0x34ff('0x4e')][_0x34ff('0x57')]);_0x8df001[_0x34ff('0x58')]=qs['filters'](_['pick'](_0x9381b4[_0x34ff('0x4e')],_0x202edd['filters']));if(_0x9381b4[_0x34ff('0x4e')]['filter']){_0x8df001['where']=_['merge'](_0x8df001[_0x34ff('0x58')],{'$or':_[_0x34ff('0x3f')](_0x8df001['attributes'],function(_0x4dee89){var _0x2862f1={};_0x2862f1[_0x4dee89]={'$like':'%'+_0x9381b4['query'][_0x34ff('0x3d')]+'%'};return _0x2862f1;})});}_0x8df001=_[_0x34ff('0x5b')]({},_0x8df001,_0x9381b4[_0x34ff('0x5f')]);return _0x440d2e['getWhatsappInteractions'](_0x8df001);}})[_0x34ff('0x35')](function(_0x2a4060){if(_0x2a4060){_0x32494c=_0x2a4060[_0x34ff('0x53')];if(!_0x9381b4['query']['hasOwnProperty'](_0x34ff('0x55'))){_0x8df001[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x9381b4[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x8df001[_0x34ff('0x2d')]=qs[_0x34ff('0x2d')](_0x9381b4[_0x34ff('0x4e')][_0x34ff('0x2d')]);}return _0x440d2e[_0x34ff('0xe7')](_0x8df001);}})[_0x34ff('0x35')](function(_0x5b969c){if(_0x5b969c){return _0x5b969c?{'count':_0x32494c,'rows':_0x5b969c}:null;}})[_0x34ff('0x35')](respondWithResult(_0x4dc64f,null))['catch'](handleError(_0x4dc64f,null));};exports['login']=function(_0x236ef0,_0x34fc4b,_0xee6ab4){var _0x5ae568;var _0x433134;var _0x1eff77;var _0x2b8955=!_[_0x34ff('0x70')](_0x236ef0['params']['id'])?_0x236ef0['params']['id']:!_['isNil'](_0x236ef0[_0x34ff('0x3a')]['id'])?_0x236ef0[_0x34ff('0x3a')]['id']:null;return db[_0x34ff('0x48')][_0x34ff('0x41')]({'where':{'id':_0x2b8955,'role':{'$or':[_0x34ff('0x38'),'user',_0x34ff('0x7a')]}},'attributes':['id',_0x34ff('0x43'),_0x34ff('0xe8'),_0x34ff('0xe9'),'role',_0x34ff('0x6b'),_0x34ff('0xad')]})[_0x34ff('0x35')](function(_0x57cdd6){if(_0x57cdd6){if(_0x57cdd6['role']===_0x34ff('0x7a')){_0x5ae568=_0x57cdd6;if(_0x236ef0[_0x34ff('0x66')][_0x34ff('0xaf')]){_0x1eff77=util[_0x34ff('0xbb')]('LOCAL/%s@from-sip/n',_0x5ae568[_0x236ef0[_0x34ff('0x66')][_0x34ff('0xaf')]]);}else if(_0x236ef0['body'][_0x34ff('0xea')]){_0x1eff77=util[_0x34ff('0xbb')](_0x34ff('0xeb'),_0x236ef0[_0x34ff('0x66')][_0x34ff('0xea')]);}else{_0x1eff77=util[_0x34ff('0xbb')](_0x34ff('0xeb'),_0x5ae568['name']);}socket['to'](util['format'](_0x34ff('0xec'),_0x5ae568[_0x34ff('0x43')]))[_0x34ff('0xb7')](_0x34ff('0xed'),{'user':{'id':_0x5ae568['id'],'name':_0x5ae568['name']},'ip':_0x236ef0[_0x34ff('0xee')][_0x34ff('0xef')]||_0x236ef0['connection'][_0x34ff('0xf0')]||_0x236ef0[_0x34ff('0xf1')]['remoteAddress']||_0x236ef0[_0x34ff('0xf2')][_0x34ff('0xf1')][_0x34ff('0xf0')]});return db[_0x34ff('0xbc')][_0x34ff('0x36')]({'where':{'membername':_0x5ae568[_0x34ff('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x34ff('0x35')](function(){if(_0x5ae568){return _0x5ae568['getVoiceQueues']({'raw':!![]});}})[_0x34ff('0x35')](function(_0x54d60c){if(_0x5ae568){var _0x5b8927=[];if(_0x54d60c){_0x433134=_0x54d60c;if(_0x433134['length']){for(var _0x412d83=0x0;_0x412d83<_0x433134[_0x34ff('0x53')];_0x412d83++){_0x5b8927[_0x34ff('0x95')]({'membername':_0x5ae568['name'],'UserId':_0x5ae568['id'],'queue_name':_0x433134[_0x412d83]['name'],'VoiceQueueId':_0x433134[_0x412d83]['id'],'interface':_0x1eff77,'paused':_0x5ae568[_0x34ff('0xad')]||![],'penalty':_0x433134[_0x412d83][_0x34ff('0xf3')]||0x0});}return BPromise[_0x34ff('0x96')](_0x5b8927,function(_0x4310ea){return db[_0x34ff('0xbc')][_0x34ff('0xbd')](_0x4310ea);});}}}})[_0x34ff('0x35')](function(){if(_0x5ae568){return db[_0x34ff('0xf4')][_0x34ff('0x62')]({'where':{'membername':_0x5ae568[_0x34ff('0x43')],'exitAt':null}});}})[_0x34ff('0x35')](function(_0x150193){if(_0x5ae568){var _0x2ba416=[];_0x150193['forEach'](function(_0x37c228){_0x2ba416[_0x34ff('0x95')](_0x37c228[_0x34ff('0x34')]({'exitAt':moment()[_0x34ff('0xbb')](_0x34ff('0xf5'))}));});return BPromise[_0x34ff('0x94')](_0x2ba416);}})[_0x34ff('0x35')](function(){if(_0x5ae568){var _0x589938=[];var _0x453287=[];var _0x46c2ed=utils[_0x34ff('0xf6')]();var _0x5d3af6={'membername':_0x5ae568[_0x34ff('0x43')],'interface':_0x1eff77,'enterAt':moment()[_0x34ff('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5ae568['role'],'internal':_0x5ae568['internal']};_0x46c2ed['forEach'](function(_0x3e2ab5){_0x589938['push'](_[_0x34ff('0x5b')]({'channel':_0x3e2ab5,'type':_0x34ff('0xf7'),'data1':_0x236ef0[_0x34ff('0x66')][_0x34ff('0xf8')],'data2':_0x1eff77},_0x5d3af6));if(_0x5ae568[_0x34ff('0xad')]){_0x453287[_0x34ff('0x95')](_[_0x34ff('0x5b')]({'channel':_0x3e2ab5,'type':_0x34ff('0xf9'),'data1':_0x34ff('0xfa')},_0x5d3af6));}});return db[_0x34ff('0xf4')][_0x34ff('0x91')](_0x589938[_0x34ff('0xfb')](_0x453287),{'individualHooks':!![]});}})[_0x34ff('0x35')](function(){if(_0x5ae568){return _0x5ae568['update']({'online':!![],'lastLoginAt':moment()[_0x34ff('0xbb')](_0x34ff('0xf5')),'voicePause':_0x5ae568['loginInPause']||![],'mailPause':_0x5ae568[_0x34ff('0xad')]||![],'chatPause':_0x5ae568[_0x34ff('0xad')]||![],'faxPause':_0x5ae568['loginInPause']||![],'smsPause':_0x5ae568[_0x34ff('0xad')]||![],'openchannelPause':_0x5ae568[_0x34ff('0xad')]||![],'whatsappPause':_0x5ae568[_0x34ff('0xad')]||![],'pauseType':_0x5ae568[_0x34ff('0xad')]?_0x34ff('0xfa'):null,'interface':_0x1eff77,'lastPauseAt':moment()['format'](_0x34ff('0xf5'))});}})['then'](function(_0x55f1e9){if(_0x236ef0['isMiddleware']){return _0xee6ab4();}else{return BPromise[_0x34ff('0xfc')](_0x55f1e9)['then'](respondWithResult(_0x34fc4b,null));}})['catch'](handleError(_0x34fc4b,null));};exports['logout']=function(_0x30a12b,_0x4e76d3,_0x39fa41){var _0xc490f2;return db[_0x34ff('0x48')]['find']({'where':{'id':_0x30a12b[_0x34ff('0x67')]['id'],'role':_0x34ff('0x7a')},'attributes':['id','name',_0x34ff('0x42')]})[_0x34ff('0x35')](handleEntityNotFound(_0x4e76d3,null))[_0x34ff('0x35')](function(_0x1584e9){if(_0x1584e9){_0xc490f2=_0x1584e9;return db[_0x34ff('0xbc')]['destroy']({'where':{'membername':_0xc490f2[_0x34ff('0x43')]},'individualHooks':!![]});}})['then'](function(){return db[_0x34ff('0xf4')][_0x34ff('0x62')]({'where':{'membername':_0xc490f2[_0x34ff('0x43')],'exitAt':null}});})[_0x34ff('0x35')](function(_0x1d5f17){var _0x300200=[];_0x1d5f17[_0x34ff('0xfd')](function(_0xb84122){_0x300200[_0x34ff('0x95')](_0xb84122[_0x34ff('0x34')]({'exitAt':moment()[_0x34ff('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x34ff('0x94')](_0x300200);})['then'](function(){return _0xc490f2[_0x34ff('0x34')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x4e76d3,null))[_0x34ff('0x28')](handleError(_0x4e76d3,null));};exports[_0x34ff('0xfe')]=function(_0x1276f2,_0x133122,_0x672b0f){var _0xc5cf1b;return db[_0x34ff('0xbc')]['update']({'paused':0x1},{'where':{'UserId':_0x1276f2[_0x34ff('0x67')]['id']},'individualHooks':!![]})[_0x34ff('0x35')](function(){return db['User'][_0x34ff('0x41')]({'where':{'id':_0x1276f2[_0x34ff('0x67')]['id'],'role':_0x34ff('0x7a')},'attributes':['id',_0x34ff('0x43'),_0x34ff('0x42'),_0x34ff('0x6b'),'interface']});})[_0x34ff('0x35')](handleEntityNotFound(_0x133122,null))[_0x34ff('0x35')](function(_0x249217){if(_0x249217){_0xc5cf1b=_0x249217;return respondWithRpcPromise('QueuePause','pause',{'id':_0xc5cf1b['id'],'name':_0xc5cf1b[_0x34ff('0x43')],'pause':!![]});}})[_0x34ff('0x35')](function(){if(_0xc5cf1b){return db[_0x34ff('0xf4')][_0x34ff('0x62')]({'where':{'membername':_0xc5cf1b[_0x34ff('0x43')],'type':_0x34ff('0xf9'),'exitAt':null}});}})[_0x34ff('0x35')](function(_0x475762){if(_0x475762[_0x34ff('0x53')]){var _0x238b57=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x19b507=0x0,_0x234afe=_0x475762['length'];_0x19b507<_0x234afe;_0x19b507++){_0x475762[_0x19b507]['updateAttributes']({'exitAt':_0x238b57});}}})[_0x34ff('0x35')](function(){var _0x7a5624=[];var _0x54800c=utils[_0x34ff('0xf6')]();_0x54800c[_0x34ff('0xfd')](function(_0x13a08f){_0x7a5624['push']({'channel':_0x13a08f,'membername':_0xc5cf1b[_0x34ff('0x43')],'interface':_[_0x34ff('0x70')](_0xc5cf1b['interface'])?util[_0x34ff('0xbb')]('SIP/%s',_0xc5cf1b[_0x34ff('0x43')]):_0xc5cf1b[_0x34ff('0xaf')],'type':_0x34ff('0xf9'),'enterAt':moment()[_0x34ff('0xbb')](_0x34ff('0xf5')),'data1':_0x1276f2[_0x34ff('0x66')][_0x34ff('0x4b')]||'DEFAULT\x20PAUSE','role':_0xc5cf1b[_0x34ff('0x42')],'internal':_0xc5cf1b[_0x34ff('0x6b')]});});return db[_0x34ff('0xf4')][_0x34ff('0x91')](_0x7a5624,{'individualHooks':!![]});})[_0x34ff('0x35')](function(){return _0xc5cf1b[_0x34ff('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1276f2[_0x34ff('0x66')]['type']||_0x34ff('0xff'),'lastPauseAt':moment()['format'](_0x34ff('0xf5'))});})[_0x34ff('0x35')](respondWithResult(_0x133122,null))['catch'](handleError(_0x133122,null));};exports[_0x34ff('0x100')]=function(_0xb01827,_0x140b0c,_0x22eca4){var _0x2dff30;return db['User'][_0x34ff('0x41')]({'where':{'id':_0xb01827['params']['id']},'attributes':['id',_0x34ff('0x43'),_0x34ff('0x42'),_0x34ff('0xae'),_0x34ff('0x101'),_0x34ff('0x102'),'faxPause',_0x34ff('0x103'),'smsPause',_0x34ff('0x104'),_0x34ff('0x105'),_0x34ff('0x106')]})[_0x34ff('0x35')](handleEntityNotFound(_0x140b0c,null))[_0x34ff('0x35')](function(_0x17d73c){if(_0x17d73c){_0x2dff30=_0x17d73c;if(_0xb01827[_0x34ff('0x66')][_0x34ff('0xab')]&&!utils[_0x34ff('0xb0')](_0xb01827[_0x34ff('0x66')]['channel'])){throw new db[(_0x34ff('0x9f'))][(_0x34ff('0xa0'))]('Unknown\x20channel');}switch(_0xb01827[_0x34ff('0x66')][_0x34ff('0xab')]){case _0x34ff('0xb9'):return respondWithRpcPromise(_0x34ff('0x107'),'unpause',{'id':_0x2dff30['id'],'name':_0x2dff30[_0x34ff('0x43')],'pause':![]})[_0x34ff('0x35')](function(){return db[_0x34ff('0xbc')][_0x34ff('0x34')]({'paused':0x0},{'where':{'UserId':_0x2dff30['id']},'individualHooks':!![]});})[_0x34ff('0x35')](function(){return db['MemberReport'][_0x34ff('0x41')]({'where':{'channel':_0xb01827['body'][_0x34ff('0xab')],'membername':_0x2dff30[_0x34ff('0x43')],'type':_0x34ff('0xf9'),'exitAt':null}});})['then'](function(_0x9c8283){if(_0x9c8283){return _0x9c8283[_0x34ff('0x34')]({'exitAt':moment()[_0x34ff('0xbb')](_0x34ff('0xf5')),'data2':_0x34ff('0x108')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2dff30[_0x34ff('0x34')]({'voicePause':![]});});case _0x34ff('0x109'):case _0x34ff('0x10a'):case _0x34ff('0x10b'):case _0x34ff('0x10c'):case _0x34ff('0x10d'):case _0x34ff('0x10e'):return db['MemberReport'][_0x34ff('0x41')]({'where':{'channel':_0xb01827[_0x34ff('0x66')][_0x34ff('0xab')],'membername':_0x2dff30[_0x34ff('0x43')],'type':_0x34ff('0xf9'),'exitAt':null}})[_0x34ff('0x35')](function(_0x2b66a3){if(_0x2b66a3){return _0x2b66a3['update']({'exitAt':moment()[_0x34ff('0xbb')](_0x34ff('0xf5')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x34ff('0x35')](function(){var _0x274758={};_[_0x34ff('0x2f')](_0x274758,util['format'](_0x34ff('0x10f'),_0xb01827[_0x34ff('0x66')][_0x34ff('0xab')],'Pause'),![]);return _0x2dff30[_0x34ff('0x34')](_0x274758);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x2dff30['id'],'name':_0x2dff30[_0x34ff('0x43')],'pause':![]})['then'](function(){return db[_0x34ff('0xbc')][_0x34ff('0x34')]({'paused':0x0},{'where':{'UserId':_0x2dff30['id']}});})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x2dff30[_0x34ff('0x43')],'type':_0x34ff('0xf9'),'exitAt':null}});})['then'](function(_0x201625){var _0x57f2e0=[];_0x201625[_0x34ff('0xfd')](function(_0x432a40){_0x57f2e0[_0x34ff('0x95')](_0x432a40[_0x34ff('0x34')]({'exitAt':moment()[_0x34ff('0xbb')](_0x34ff('0xf5')),'data2':_0x34ff('0x108')}));});return BPromise['all'](_0x57f2e0);})['then'](function(){return _0x2dff30['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x34ff('0x35')](respondWithResult(_0x140b0c,null))[_0x34ff('0x28')](handleError(_0x140b0c,null));};exports[_0x34ff('0x110')]=function(_0x50ba34,_0x2bc848,_0x5ecdc8){var _0x30c2cd={};var _0x1b8517={};var _0x3758e0;var _0x2cadfb;return db[_0x34ff('0x48')][_0x34ff('0xcd')]({'where':{'id':_0x50ba34['params']['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x2bc848,null))[_0x34ff('0x35')](function(_0x267d53){if(_0x267d53){_0x3758e0=_0x267d53;_0x1b8517[_0x34ff('0x4c')]=_[_0x34ff('0x4f')](db['Team'][_0x34ff('0x49')]);_0x1b8517[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x50ba34['query']);_0x1b8517[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0x1b8517[_0x34ff('0x4c')],_0x1b8517[_0x34ff('0x4e')]);_0x30c2cd[_0x34ff('0x51')]=_[_0x34ff('0x50')](_0x1b8517['model'],qs[_0x34ff('0x52')](_0x50ba34['query']['fields']));_0x30c2cd[_0x34ff('0x51')]=_0x30c2cd[_0x34ff('0x51')][_0x34ff('0x53')]?_0x30c2cd[_0x34ff('0x51')]:_0x1b8517[_0x34ff('0x4c')];_0x30c2cd[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x50ba34[_0x34ff('0x4e')][_0x34ff('0x57')]);_0x30c2cd[_0x34ff('0x58')]=qs['filters'](_['pick'](_0x50ba34[_0x34ff('0x4e')],_0x1b8517['filters']));if(_0x50ba34[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x30c2cd[_0x34ff('0x58')]=_['merge'](_0x30c2cd[_0x34ff('0x58')],{'$or':_['map'](_0x30c2cd['attributes'],function(_0x2ab659){var _0x487bab={};_0x487bab[_0x2ab659]={'$like':'%'+_0x50ba34[_0x34ff('0x4e')]['filter']+'%'};return _0x487bab;})});}_0x30c2cd=_[_0x34ff('0x5b')]({},_0x30c2cd,_0x50ba34[_0x34ff('0x5f')]);return _0x3758e0['getTeams'](_0x30c2cd);}})[_0x34ff('0x35')](function(_0x61bcaf){if(_0x61bcaf){_0x2cadfb=_0x61bcaf['length'];if(!_0x50ba34[_0x34ff('0x4e')][_0x34ff('0x54')](_0x34ff('0x55'))){_0x30c2cd[_0x34ff('0x2e')]=qs['limit'](_0x50ba34[_0x34ff('0x4e')][_0x34ff('0x2e')]);_0x30c2cd[_0x34ff('0x2d')]=qs[_0x34ff('0x2d')](_0x50ba34[_0x34ff('0x4e')][_0x34ff('0x2d')]);}return _0x3758e0[_0x34ff('0x110')](_0x30c2cd);}})[_0x34ff('0x35')](function(_0x22fc3a){if(_0x22fc3a){return _0x22fc3a?{'count':_0x2cadfb,'rows':_0x22fc3a}:null;}})[_0x34ff('0x35')](respondWithResult(_0x2bc848,null))[_0x34ff('0x28')](handleError(_0x2bc848,null));};exports[_0x34ff('0x111')]=function(_0x406518,_0x5ce8d8){return db[_0x34ff('0x48')][_0x34ff('0x41')]({'where':{'id':_0x406518[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x5ce8d8,null))[_0x34ff('0x35')](function(_0xc7db96){if(_0xc7db96){var _0x57f789=_0xc7db96['get']({'plain':!![]});return _0xc7db96['addTeams'](_0x406518['body'][_0x34ff('0x69')],_['omit'](_0x406518[_0x34ff('0x66')],[_0x34ff('0x69'),'id'])||{})[_0x34ff('0x35')](function(){for(var _0x33ef6d=0x0;_0x33ef6d<_0x406518[_0x34ff('0x66')][_0x34ff('0x69')][_0x34ff('0x53')];_0x33ef6d++){var _0x45e527=[];db[_0x34ff('0x112')][_0x34ff('0xcd')]({'where':{'id':_0x406518[_0x34ff('0x66')]['ids'][_0x33ef6d]}})[_0x34ff('0x35')](function(_0xd53943){_0x45e527[_0x34ff('0x95')](_0xd53943[_0x34ff('0x113')]()[_0x34ff('0x35')](function(_0x1a4dee){for(var _0x5e1408=0x0;_0x5e1408<_0x1a4dee[_0x34ff('0x53')];_0x5e1408++){_0x1a4dee[_0x5e1408][_0x34ff('0x114')](_0x34ff('0xab'),_0x34ff('0x115'));}return _0x1a4dee;}));_0x45e527[_0x34ff('0x95')](_0xd53943[_0x34ff('0x116')]()['then'](function(_0xd084ab){for(var _0x2c731a=0x0;_0x2c731a<_0xd084ab[_0x34ff('0x53')];_0x2c731a++){_0xd084ab[_0x2c731a]['setDataValue']('channel',_0x34ff('0x117'));}return _0xd084ab;}));_0x45e527['push'](_0xd53943[_0x34ff('0x118')]()[_0x34ff('0x35')](function(_0x26bc2f){for(var _0x4412f6=0x0;_0x4412f6<_0x26bc2f[_0x34ff('0x53')];_0x4412f6++){_0x26bc2f[_0x4412f6][_0x34ff('0x114')](_0x34ff('0xab'),_0x34ff('0x119'));}return _0x26bc2f;}));_0x45e527[_0x34ff('0x95')](_0xd53943['getSmsQueues']()[_0x34ff('0x35')](function(_0x3f0951){for(var _0x140a01=0x0;_0x140a01<_0x3f0951[_0x34ff('0x53')];_0x140a01++){_0x3f0951[_0x140a01]['setDataValue']('channel','Sms');}return _0x3f0951;}));_0x45e527[_0x34ff('0x95')](_0xd53943['getWhatsappQueues']()[_0x34ff('0x35')](function(_0x536839){for(var _0x31dc59=0x0;_0x31dc59<_0x536839['length'];_0x31dc59++){_0x536839[_0x31dc59][_0x34ff('0x114')](_0x34ff('0xab'),_0x34ff('0x11a'));}return _0x536839;}));_0x45e527['push'](_0xd53943[_0x34ff('0x11b')]()[_0x34ff('0x35')](function(_0x56a5e0){for(var _0x4dfb8a=0x0;_0x4dfb8a<_0x56a5e0[_0x34ff('0x53')];_0x4dfb8a++){_0x56a5e0[_0x4dfb8a][_0x34ff('0x114')]('channel','Fax');}return _0x56a5e0;}));_0x45e527[_0x34ff('0x95')](_0xd53943[_0x34ff('0x11c')]()[_0x34ff('0x35')](function(_0x41bf39){for(var _0x4dd06f=0x0;_0x4dd06f<_0x41bf39[_0x34ff('0x53')];_0x4dd06f++){_0x41bf39[_0x4dd06f]['setDataValue']('channel',_0x34ff('0x11d'));}return _0x41bf39;}));return BPromise[_0x34ff('0x94')](_0x45e527);})[_0x34ff('0x35')](function(_0x435821){var _0xb43183=_[_0x34ff('0x11e')](_0x435821);_0x45e527=[];return db['sequelize'][_0x34ff('0x11f')](function(_0x59a51a){for(var _0x5edfdc=0x0;_0x5edfdc<_0xb43183[_0x34ff('0x53')];_0x5edfdc++){_0x45e527[_0x34ff('0x95')](_0xb43183[_0x5edfdc][_0x34ff('0x120')](_0x57f789['id']),{'transaction':_0x59a51a});}return BPromise[_0x34ff('0x94')](_0x45e527)['then'](function(){if(_0x57f789[_0x34ff('0xac')]){return BPromise[_0x34ff('0x96')](_[_0x34ff('0x3d')](_0xb43183,function(_0x27a15b){return _0x27a15b[_0x34ff('0x121')]('channel')===_0x34ff('0x115');}),function(_0x30b947){return db['UserVoiceQueueRt'][_0x34ff('0xbd')]({'membername':_0x57f789['name'],'UserId':_0x57f789['id'],'queue_name':_0x30b947[_0x34ff('0x43')],'VoiceQueueId':_0x30b947['id'],'interface':_[_0x34ff('0x70')](_0x57f789[_0x34ff('0xaf')])?util['format'](_0x34ff('0xeb'),_0x57f789['name']):_0x57f789[_0x34ff('0xaf')],'paused':_0x57f789[_0x34ff('0xae')]||![],'penalty':_0x57f789['penalty']},{'transaction':_0x59a51a});});}else{return;}})[_0x34ff('0x35')](function(){for(var _0x51b2ca=0x0;_0x51b2ca<_0xb43183['length'];_0x51b2ca++){var _0x138515=_0xb43183[_0x51b2ca]['getDataValue'](_0x34ff('0xab'));var _0x1bfe47=_0x138515+_0x34ff('0xc1');socket['emit'](_0x34ff('0x3a')+_0x138515+'Queue:save',{'UserId':_0x57f789['id'],['queueField']:_0xb43183[_0x51b2ca]['id']});}});});});}});}})[_0x34ff('0x35')](respondWithStatusCode(_0x5ce8d8,null))[_0x34ff('0x28')](handleError(_0x5ce8d8,null));};exports['removeTeams']=function(_0x36efbc,_0x1cbe99){return db[_0x34ff('0x48')][_0x34ff('0xcd')]({'where':{'id':_0x36efbc[_0x34ff('0x67')]['id']}})['then'](handleEntityNotFound(_0x1cbe99,null))[_0x34ff('0x35')](function(_0x1c33b1){if(_0x1c33b1){var _0x1fbdba=_0x1c33b1[_0x34ff('0x37')]({'plain':!![]});var _0x5805ac=_0x36efbc[_0x34ff('0x4e')]['ids'];return _0x1c33b1[_0x34ff('0x122')](_0x5805ac)[_0x34ff('0x35')](function(){for(var _0x1729c5=0x0;_0x1729c5<_0x5805ac[_0x34ff('0x53')];_0x1729c5++){var _0x5e2fb6=[];db[_0x34ff('0x112')][_0x34ff('0xcd')]({'where':{'id':_0x5805ac[_0x1729c5]}})['then'](function(_0x55ccc5){_0x5e2fb6[_0x34ff('0x95')](_0x55ccc5[_0x34ff('0x113')]()['then'](function(_0x4577b0){for(var _0x32baa3=0x0;_0x32baa3<_0x4577b0[_0x34ff('0x53')];_0x32baa3++){_0x4577b0[_0x32baa3][_0x34ff('0x114')](_0x34ff('0xab'),_0x34ff('0x115'));}return _0x4577b0;}));_0x5e2fb6[_0x34ff('0x95')](_0x55ccc5[_0x34ff('0x116')]()[_0x34ff('0x35')](function(_0x4c2143){for(var _0x76636f=0x0;_0x76636f<_0x4c2143[_0x34ff('0x53')];_0x76636f++){_0x4c2143[_0x76636f][_0x34ff('0x114')](_0x34ff('0xab'),_0x34ff('0x117'));}return _0x4c2143;}));_0x5e2fb6[_0x34ff('0x95')](_0x55ccc5[_0x34ff('0x118')]()[_0x34ff('0x35')](function(_0x20ed0a){for(var _0x6e718b=0x0;_0x6e718b<_0x20ed0a['length'];_0x6e718b++){_0x20ed0a[_0x6e718b]['setDataValue'](_0x34ff('0xab'),_0x34ff('0x119'));}return _0x20ed0a;}));_0x5e2fb6[_0x34ff('0x95')](_0x55ccc5[_0x34ff('0x123')]()[_0x34ff('0x35')](function(_0x1051bf){for(var _0x3288b9=0x0;_0x3288b9<_0x1051bf[_0x34ff('0x53')];_0x3288b9++){_0x1051bf[_0x3288b9][_0x34ff('0x114')](_0x34ff('0xab'),'Sms');}return _0x1051bf;}));_0x5e2fb6[_0x34ff('0x95')](_0x55ccc5[_0x34ff('0x124')]()[_0x34ff('0x35')](function(_0x17faef){for(var _0x3281d0=0x0;_0x3281d0<_0x17faef['length'];_0x3281d0++){_0x17faef[_0x3281d0][_0x34ff('0x114')]('channel',_0x34ff('0x11a'));}return _0x17faef;}));_0x5e2fb6[_0x34ff('0x95')](_0x55ccc5[_0x34ff('0x11b')]()[_0x34ff('0x35')](function(_0xf1ccff){for(var _0x33be08=0x0;_0x33be08<_0xf1ccff[_0x34ff('0x53')];_0x33be08++){_0xf1ccff[_0x33be08][_0x34ff('0x114')](_0x34ff('0xab'),_0x34ff('0x125'));}return _0xf1ccff;}));_0x5e2fb6[_0x34ff('0x95')](_0x55ccc5['getOpenchannelQueues']()['then'](function(_0x4776b5){for(var _0x539c83=0x0;_0x539c83<_0x4776b5['length'];_0x539c83++){_0x4776b5[_0x539c83][_0x34ff('0x114')](_0x34ff('0xab'),_0x34ff('0x11d'));}return _0x4776b5;}));return BPromise['all'](_0x5e2fb6);})[_0x34ff('0x35')](function(_0x22e645){var _0x25f34c=_[_0x34ff('0x11e')](_0x22e645);_0x5e2fb6=[];return db[_0x34ff('0x5c')]['transaction'](function(_0x28f0dd){for(var _0x179746=0x0;_0x179746<_0x25f34c[_0x34ff('0x53')];_0x179746++){_0x5e2fb6[_0x34ff('0x95')](_0x25f34c[_0x179746][_0x34ff('0x126')](_0x1fbdba['id']),{'transaction':_0x28f0dd});}return BPromise[_0x34ff('0x94')](_0x5e2fb6)[_0x34ff('0x35')](function(){if(_0x1fbdba[_0x34ff('0xac')]){return BPromise['each'](_[_0x34ff('0x3d')](_0x25f34c,function(_0x56aec8){return _0x56aec8[_0x34ff('0x121')]('channel')==='Voice';}),function(_0x3cf827){return db[_0x34ff('0xbc')][_0x34ff('0x36')]({'where':{'VoiceQueueId':_0x3cf827['id'],'UserId':_0x1fbdba['id']},'transaction':_0x28f0dd});});}else{return;}})['then'](function(){for(var _0x3084e0=0x0;_0x3084e0<_0x25f34c[_0x34ff('0x53')];_0x3084e0++){var _0x174fe0=_0x25f34c[_0x3084e0][_0x34ff('0x121')](_0x34ff('0xab'));var _0x3ba446=_0x174fe0+'QueueId';socket['emit'](_0x34ff('0x3a')+_0x174fe0+'Queue:remove',{'UserId':_0x1fbdba['id'],['queueField']:_0x25f34c[_0x3084e0]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x1cbe99,null))[_0x34ff('0x28')](handleError(_0x1cbe99,null));};exports[_0x34ff('0x127')]=function(_0x5fb111,_0x4311dc,_0x6d8a86){var _0x49c564={};var _0x39f705={};var _0x588874;var _0xee094f;return db[_0x34ff('0x48')]['findOne']({'where':{'id':_0x5fb111[_0x34ff('0x67')]['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x4311dc,null))[_0x34ff('0x35')](function(_0x51e413){if(_0x51e413){_0x588874=_0x51e413;_0x39f705[_0x34ff('0x4c')]=_['keys'](db[_0x34ff('0x128')]['rawAttributes']);_0x39f705['query']=_[_0x34ff('0x4f')](_0x5fb111[_0x34ff('0x4e')]);_0x39f705[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0x39f705['model'],_0x39f705[_0x34ff('0x4e')]);_0x49c564['attributes']=_['intersection'](_0x39f705['model'],qs[_0x34ff('0x52')](_0x5fb111[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x49c564[_0x34ff('0x51')]=_0x49c564[_0x34ff('0x51')][_0x34ff('0x53')]?_0x49c564[_0x34ff('0x51')]:_0x39f705['model'];_0x49c564[_0x34ff('0x56')]=qs['sort'](_0x5fb111[_0x34ff('0x4e')][_0x34ff('0x57')]);_0x49c564[_0x34ff('0x58')]=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x5fb111[_0x34ff('0x4e')],_0x39f705[_0x34ff('0x59')]));if(_0x5fb111[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x49c564[_0x34ff('0x58')]=_[_0x34ff('0x5b')](_0x49c564[_0x34ff('0x58')],{'$or':_['map'](_0x49c564[_0x34ff('0x51')],function(_0x4e34ca){var _0x2ddef1={};_0x2ddef1[_0x4e34ca]={'$like':'%'+_0x5fb111['query'][_0x34ff('0x3d')]+'%'};return _0x2ddef1;})});}_0x49c564=_[_0x34ff('0x5b')]({},_0x49c564,_0x5fb111[_0x34ff('0x5f')]);return _0x588874[_0x34ff('0x127')](_0x49c564);}})[_0x34ff('0x35')](function(_0x36af8f){if(_0x36af8f){_0xee094f=_0x36af8f[_0x34ff('0x53')];if(!_0x5fb111[_0x34ff('0x4e')][_0x34ff('0x54')]('nolimit')){_0x49c564[_0x34ff('0x2e')]=qs[_0x34ff('0x2e')](_0x5fb111['query'][_0x34ff('0x2e')]);_0x49c564[_0x34ff('0x2d')]=qs[_0x34ff('0x2d')](_0x5fb111['query'][_0x34ff('0x2d')]);}return _0x588874[_0x34ff('0x127')](_0x49c564);}})[_0x34ff('0x35')](function(_0x19b07d){if(_0x19b07d){return _0x19b07d?{'count':_0xee094f,'rows':_0x19b07d}:null;}})[_0x34ff('0x35')](respondWithResult(_0x4311dc,null))[_0x34ff('0x28')](handleError(_0x4311dc,null));};exports['getAgents']=function(_0x317617,_0x14a558,_0xac90b1){var _0x360725={};var _0x25a11c={};var _0x1b11d7;var _0x3d6eb8;return db[_0x34ff('0x48')]['findOne']({'where':{'id':_0x317617['params']['id']}})[_0x34ff('0x35')](handleEntityNotFound(_0x14a558,null))['then'](function(_0x461221){if(_0x461221){_0x1b11d7=_0x461221;_0x25a11c['model']=_[_0x34ff('0x4f')](db['User']['rawAttributes']);_0x25a11c[_0x34ff('0x4e')]=_[_0x34ff('0x4f')](_0x317617[_0x34ff('0x4e')]);_0x25a11c[_0x34ff('0x59')]=_[_0x34ff('0x50')](_0x25a11c['model'],_0x25a11c[_0x34ff('0x4e')]);_0x360725['attributes']=_[_0x34ff('0x50')](_0x25a11c[_0x34ff('0x4c')],qs['fields'](_0x317617[_0x34ff('0x4e')][_0x34ff('0x52')]));_0x360725[_0x34ff('0x51')]=_0x360725['attributes'][_0x34ff('0x53')]?_0x360725[_0x34ff('0x51')]:_0x25a11c['model'];_0x360725[_0x34ff('0x56')]=qs[_0x34ff('0x57')](_0x317617[_0x34ff('0x4e')]['sort']);_0x360725['where']=qs[_0x34ff('0x59')](_[_0x34ff('0x5a')](_0x317617['query'],_0x25a11c[_0x34ff('0x59')]));if(_0x317617[_0x34ff('0x4e')][_0x34ff('0x3d')]){_0x360725['where']=_[_0x34ff('0x5b')](_0x360725[_0x34ff('0x58')],{'$or':_['map'](_0x360725['attributes'],function(_0x805435){var _0x11e692={};_0x11e692[_0x805435]={'$like':'%'+_0x317617[_0x34ff('0x4e')][_0x34ff('0x3d')]+'%'};return _0x11e692;})});}_0x360725[_0x34ff('0x4c')]=db[_0x34ff('0x48')];_0x360725['as']='Agents';_0x360725=_[_0x34ff('0x5b')]({},_0x360725,_0x317617[_0x34ff('0x5f')]);return _0x1b11d7[_0x34ff('0x113')]({'include':[_0x360725]});}})['then'](function(_0xf7174d){if(_0xf7174d){var _0x1d0b81={},_0xfbaaf4=[],_0xb7e83c=0x0;for(var _0x13b1ed=0x0;_0x13b1ed<_0xf7174d[_0x34ff('0x53')];_0x13b1ed+=0x1){for(var _0x503fa2=0x0,_0x1e7fad;_0x503fa2<_0xf7174d[_0x13b1ed][_0x34ff('0x3b')][_0x34ff('0x53')];_0x503fa2+=0x1){_0x1e7fad=_0xf7174d[_0x13b1ed]['Agents'][_0x503fa2][_0x34ff('0x37')]({'plain':!![]});_0x1d0b81[_0x1e7fad['id']]=_0x1e7fad;}}_0x1d0b81=_[_0x34ff('0x129')](_0x1d0b81);for(var _0x5342a2=qs[_0x34ff('0x2d')](_0x317617[_0x34ff('0x4e')][_0x34ff('0x2d')]);_0x5342a2<_0x1d0b81['length']&&_0xfbaaf4[_0x34ff('0x53')]=_0x46ef06[_0xcbbb('0x54')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xcbbb('0x24')](function(){if(_0x2f0db8){return db[_0xcbbb('0x2d')][_0xcbbb('0x4c')]({'where':{'membername':_0x2f0db8[_0xcbbb('0x37')]},'individualHooks':!![]});}})['then'](function(){if(_0x2f0db8){return _0x2f0db8[_0xcbbb('0x55')]({'raw':!![]});}})[_0xcbbb('0x24')](function(_0x38c56d){if(_0x2f0db8){if(_0x38c56d){var _0x54442e=[];_0x498e47=_0x38c56d;if(_0x498e47['length']){for(var _0x1a7dd6=0x0;_0x1a7dd6<_0x498e47[_0xcbbb('0x31')];_0x1a7dd6++){_0x54442e[_0xcbbb('0x36')](db[_0xcbbb('0x2d')]['upsert']({'membername':_0x2f0db8[_0xcbbb('0x37')],'UserId':_0x2f0db8['id'],'queue_name':_0x498e47[_0x1a7dd6][_0xcbbb('0x37')],'VoiceQueueId':_0x498e47[_0x1a7dd6]['id'],'interface':_0x3509cd,'paused':_0x2f0db8[_0xcbbb('0x50')]||![],'penalty':_0x498e47[_0x1a7dd6][_0xcbbb('0x56')]||0x0}));}return BPromise[_0xcbbb('0x4d')](_0x54442e);}}}})['then'](function(){if(_0x2f0db8){return db['MemberReport'][_0xcbbb('0x1c')]({'where':{'membername':_0x2f0db8[_0xcbbb('0x37')],'exitAt':null}});}})[_0xcbbb('0x24')](function(_0x24396b){if(_0x2f0db8){if(_0x24396b&&_0x24396b[_0xcbbb('0x31')]){var _0x460995=[];_0x24396b['forEach'](function(_0x3745af){_0x460995[_0xcbbb('0x36')](_0x3745af[_0xcbbb('0x2e')]({'exitAt':moment()[_0xcbbb('0x39')](_0xcbbb('0x32'))}));});return BPromise[_0xcbbb('0x4d')](_0x460995);}}})[_0xcbbb('0x24')](function(_0x52242c){if(_0x2f0db8){var _0x561f4d=[];var _0x3cad22=[];var _0x49031d=utils['getChannels']();var _0x1f3ec1={'membername':_0x2f0db8['name'],'interface':_0x3509cd,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2f0db8[_0xcbbb('0x2a')],'internal':_0x2f0db8['internal']};_0x49031d[_0xcbbb('0x35')](function(_0x5f01f9){_0x561f4d['push'](_['merge']({'channel':_0x5f01f9,'type':'LOGIN','data1':_0xcbbb('0x57'),'data2':_0x3509cd},_0x1f3ec1));if(_0x2f0db8[_0xcbbb('0x50')]){_0x3cad22['push'](_['merge']({'channel':_0x5f01f9,'type':_0xcbbb('0x30'),'data1':_0xcbbb('0x58')},_0x1f3ec1));}});return db['MemberReport'][_0xcbbb('0x3d')](_0x561f4d[_0xcbbb('0x59')](_0x3cad22),{'individualHooks':!![]});}})[_0xcbbb('0x24')](function(){if(_0x2f0db8){return _0x2f0db8[_0xcbbb('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xcbbb('0x39')](_0xcbbb('0x32')),'voicePause':_0x2f0db8[_0xcbbb('0x50')]||![],'mailPause':_0x2f0db8['loginInPause']||![],'chatPause':_0x2f0db8[_0xcbbb('0x50')]||![],'faxPause':_0x2f0db8[_0xcbbb('0x50')]||![],'smsPause':_0x2f0db8['loginInPause']||![],'openchannelPause':_0x2f0db8[_0xcbbb('0x50')]||![],'pauseType':_0x2f0db8[_0xcbbb('0x50')]?_0xcbbb('0x58'):null,'lastPauseAt':moment()[_0xcbbb('0x39')](_0xcbbb('0x32')),'interface':_0x3509cd});}})[_0xcbbb('0x24')](function(_0x59d24b){_0x590fc6(_0x59d24b);})['catch'](function(_0x2d7838){_0x6060d(_0x583c33[_0xcbbb('0x16')](0x1f4,_0x2d7838[_0xcbbb('0x18')]));});});}; \ No newline at end of file +var _0x2d93=['attributes','limit','include','map','model','GetUser','ShowUser','User','raw','where','find','role','internal','UserVoiceQueueRt','update','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','push','interface','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','mail','chat','fax','sms','openchannel','system','set','Pause','forEach','all','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options'];(function(_0x4ff876,_0x293d17){var _0x118ef3=function(_0x327708){while(--_0x327708){_0x4ff876['push'](_0x4ff876['shift']());}};_0x118ef3(++_0x293d17);}(_0x2d93,0xf3));var _0x32d9=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0x2d93[_0xba1760];return _0x1f3143;};'use strict';var _=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var moment=require(_0x32d9('0x2'));var BPromise=require(_0x32d9('0x3'));var rs=require(_0x32d9('0x4'));var fs=require('fs');var Redis=require(_0x32d9('0x5'));var db=require(_0x32d9('0x6'))['db'];var utils=require(_0x32d9('0x7'));var logger=require(_0x32d9('0x8'))(_0x32d9('0x9'));var config=require(_0x32d9('0xa'));var jayson=require(_0x32d9('0xb'));var client=jayson[_0x32d9('0xc')][_0x32d9('0xd')]({'port':0x232a});config['redis']=_[_0x32d9('0xe')](config[_0x32d9('0xf')],{'host':_0x32d9('0x10'),'port':0x18eb});var socket=require(_0x32d9('0x11'))(new Redis(config[_0x32d9('0xf')]));require('./user.socket')[_0x32d9('0x12')](socket);function respondWithRpcPromise(_0x46603b,_0x1d5f25,_0x3bb144){return new BPromise(function(_0x2babbf,_0x312988){return client[_0x32d9('0x13')](_0x46603b,_0x3bb144)[_0x32d9('0x14')](function(_0x2875cf){logger[_0x32d9('0x15')](_0x32d9('0x16'),_0x1d5f25,'request\x20sent');logger['debug'](_0x32d9('0x17'),_0x1d5f25,_0x32d9('0x18'),JSON[_0x32d9('0x19')](_0x2875cf));if(_0x2875cf[_0x32d9('0x1a')]){if(_0x2875cf[_0x32d9('0x1a')][_0x32d9('0x1b')]===0x1f4){logger[_0x32d9('0x1a')](_0x32d9('0x16'),_0x1d5f25,_0x2875cf[_0x32d9('0x1a')][_0x32d9('0x1c')]);return _0x312988(_0x2875cf[_0x32d9('0x1a')][_0x32d9('0x1c')]);}logger['error'](_0x32d9('0x16'),_0x1d5f25,_0x2875cf[_0x32d9('0x1a')]['message']);return _0x2babbf(_0x2875cf[_0x32d9('0x1a')][_0x32d9('0x1c')]);}else{logger[_0x32d9('0x15')](_0x32d9('0x16'),_0x1d5f25,_0x32d9('0x18'));_0x2babbf(_0x2875cf[_0x32d9('0x1d')][_0x32d9('0x1c')]);}})[_0x32d9('0x1e')](function(_0x1b006a){logger[_0x32d9('0x1a')]('User,\x20%s,\x20%s',_0x1d5f25,_0x1b006a);_0x312988(_0x1b006a);});});}exports['GetUser']=function(_0x43e296){var _0x34d483=this;return new Promise(function(_0x54e4ef,_0x13f8b0){return db['User'][_0x32d9('0x1f')]({'raw':_0x43e296[_0x32d9('0x20')]?_0x43e296['options']['raw']===undefined?!![]:![]:!![],'where':_0x43e296[_0x32d9('0x20')]?_0x43e296[_0x32d9('0x20')]['where']||null:null,'attributes':_0x43e296['options']?_0x43e296[_0x32d9('0x20')][_0x32d9('0x21')]||null:null,'limit':_0x43e296[_0x32d9('0x20')]?_0x43e296[_0x32d9('0x20')][_0x32d9('0x22')]||null:null,'include':_0x43e296['options']?_0x43e296[_0x32d9('0x20')][_0x32d9('0x23')]?_[_0x32d9('0x24')](_0x43e296[_0x32d9('0x20')]['include'],function(_0x27d6e0){return{'model':db[_0x27d6e0[_0x32d9('0x25')]],'as':_0x27d6e0['as'],'attributes':_0x27d6e0[_0x32d9('0x21')],'include':_0x27d6e0['include']?_[_0x32d9('0x24')](_0x27d6e0[_0x32d9('0x23')],function(_0x2dbc8c){return{'model':db[_0x2dbc8c[_0x32d9('0x25')]],'as':_0x2dbc8c['as'],'attributes':_0x2dbc8c['attributes'],'include':_0x2dbc8c[_0x32d9('0x23')]?_[_0x32d9('0x24')](_0x2dbc8c[_0x32d9('0x23')],function(_0x7e7582){return{'model':db[_0x7e7582['model']],'as':_0x7e7582['as'],'attributes':_0x7e7582['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x86269c){logger[_0x32d9('0x15')](_0x32d9('0x26'),_0x43e296);logger['debug'](_0x32d9('0x26'),_0x43e296,JSON[_0x32d9('0x19')](_0x86269c));_0x54e4ef(_0x86269c);})['catch'](function(_0x28dc4){logger[_0x32d9('0x1a')](_0x32d9('0x26'),_0x28dc4[_0x32d9('0x1c')],_0x43e296);_0x13f8b0(_0x34d483[_0x32d9('0x1a')](0x1f4,_0x28dc4['message']));});});};exports[_0x32d9('0x27')]=function(_0xf73fc5){var _0x28f5c6=this;return new Promise(function(_0x1dc799,_0x4e7fcb){return db[_0x32d9('0x28')]['find']({'raw':_0xf73fc5[_0x32d9('0x20')]?_0xf73fc5[_0x32d9('0x20')][_0x32d9('0x29')]===undefined?!![]:![]:!![],'where':_0xf73fc5[_0x32d9('0x20')]?_0xf73fc5[_0x32d9('0x20')][_0x32d9('0x2a')]||null:null,'attributes':_0xf73fc5[_0x32d9('0x20')]?_0xf73fc5[_0x32d9('0x20')][_0x32d9('0x21')]||null:null,'include':_0xf73fc5['options']?_0xf73fc5[_0x32d9('0x20')][_0x32d9('0x23')]?_[_0x32d9('0x24')](_0xf73fc5[_0x32d9('0x20')][_0x32d9('0x23')],function(_0x237afb){return{'model':db[_0x237afb[_0x32d9('0x25')]],'as':_0x237afb['as'],'attributes':_0x237afb[_0x32d9('0x21')],'include':_0x237afb[_0x32d9('0x23')]?_[_0x32d9('0x24')](_0x237afb['include'],function(_0x5f5291){return{'model':db[_0x5f5291[_0x32d9('0x25')]],'as':_0x5f5291['as'],'attributes':_0x5f5291[_0x32d9('0x21')],'include':_0x5f5291[_0x32d9('0x23')]?_[_0x32d9('0x24')](_0x5f5291[_0x32d9('0x23')],function(_0x2bfa2a){return{'model':db[_0x2bfa2a[_0x32d9('0x25')]],'as':_0x2bfa2a['as'],'attributes':_0x2bfa2a[_0x32d9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x32d9('0x14')](function(_0x129264){logger['info'](_0x32d9('0x27'),_0xf73fc5);logger['debug']('ShowUser',_0xf73fc5,JSON[_0x32d9('0x19')](_0x129264));_0x1dc799(_0x129264);})[_0x32d9('0x1e')](function(_0x532195){logger[_0x32d9('0x1a')]('ShowUser',_0x532195[_0x32d9('0x1c')],_0xf73fc5);_0x4e7fcb(_0x28f5c6[_0x32d9('0x1a')](0x1f4,_0x532195[_0x32d9('0x1c')]));});});};exports['PauseUser']=function(_0x2271a8){var _0x4175b5=this;return new Promise(function(_0x2649d8,_0x39ff59){var _0x474e27;return db[_0x32d9('0x28')][_0x32d9('0x2b')]({'where':_0x2271a8[_0x32d9('0x20')]['where']||{},'attributes':['id','name',_0x32d9('0x2c'),_0x32d9('0x2d'),'interface']})[_0x32d9('0x14')](function(_0x2e10ab){if(_0x2e10ab){_0x474e27=_0x2e10ab;return db[_0x32d9('0x2e')][_0x32d9('0x2f')]({'paused':0x1},{'where':{'UserId':_0x474e27['id']},'individualHooks':!![]});}})['then'](function(){if(_0x474e27){return db['MemberReport'][_0x32d9('0x1f')]({'where':{'membername':_0x474e27[_0x32d9('0x30')],'type':_0x32d9('0x31'),'exitAt':null}});}})[_0x32d9('0x14')](function(_0x3ec2fd){if(_0x474e27){if(_0x3ec2fd&&_0x3ec2fd[_0x32d9('0x32')]){var _0x2090e0=moment()[_0x32d9('0x33')](_0x32d9('0x34'));for(var _0x4344dc=0x0,_0x56c419=_0x3ec2fd[_0x32d9('0x32')];_0x4344dc<_0x56c419;_0x4344dc++){_0x3ec2fd[_0x4344dc]['updateAttributes']({'exitAt':_0x2090e0});}}}})[_0x32d9('0x14')](function(){if(_0x474e27){var _0x376d46=[];var _0x209a05=utils['getChannels']();_0x209a05['forEach'](function(_0x4f6139){_0x376d46[_0x32d9('0x35')]({'channel':_0x4f6139,'membername':_0x474e27[_0x32d9('0x30')],'interface':_['isNil'](_0x474e27[_0x32d9('0x36')])?util['format'](_0x32d9('0x37'),_0x474e27['name']):_0x474e27[_0x32d9('0x36')],'type':_0x32d9('0x31'),'enterAt':moment()[_0x32d9('0x33')](_0x32d9('0x34')),'data1':_0x2271a8[_0x32d9('0x38')]['type']||_0x32d9('0x39'),'role':_0x474e27[_0x32d9('0x2c')],'internal':_0x474e27[_0x32d9('0x2d')],'uniqueid':_0x2271a8['body'][_0x32d9('0x3a')]||null});});return db[_0x32d9('0x3b')][_0x32d9('0x3c')](_0x376d46,{'individualHooks':!![]});}})[_0x32d9('0x14')](function(){if(_0x474e27){return _0x474e27[_0x32d9('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2271a8['body'][_0x32d9('0x3d')]||_0x32d9('0x39'),'lastPauseAt':moment()[_0x32d9('0x33')](_0x32d9('0x34'))});}})['then'](function(_0x506c22){_0x2649d8(_0x506c22);})[_0x32d9('0x1e')](function(_0x9d223){_0x39ff59(_0x4175b5[_0x32d9('0x1a')](0x1f4,_0x9d223[_0x32d9('0x1c')]));});});};exports[_0x32d9('0x3e')]=function(_0x2af548){var _0x474090=this;return new Promise(function(_0x32aa5d,_0x4d468e){var _0x465192;return db[_0x32d9('0x28')][_0x32d9('0x3f')]({'where':_0x2af548['options']['where']||{},'attributes':['id',_0x32d9('0x30')]})[_0x32d9('0x14')](function(_0x3706b9){if(_0x3706b9){_0x465192=_0x3706b9;if(_0x2af548[_0x32d9('0x38')][_0x32d9('0x40')]&&!utils[_0x32d9('0x41')](_0x2af548['body']['channel'])){throw new Error(_0x32d9('0x42'));}switch(_0x2af548[_0x32d9('0x38')]['channel']){case _0x32d9('0x43'):return db[_0x32d9('0x2e')]['update']({'paused':0x0},{'where':{'UserId':_0x465192['id']}})[_0x32d9('0x14')](function(){return db[_0x32d9('0x3b')][_0x32d9('0x2b')]({'where':{'channel':_0x2af548[_0x32d9('0x38')][_0x32d9('0x40')],'membername':_0x465192[_0x32d9('0x30')],'type':'PAUSE','exitAt':null}});})[_0x32d9('0x14')](function(_0x29ec37){if(_0x29ec37){return _0x29ec37[_0x32d9('0x2f')]({'exitAt':moment()[_0x32d9('0x33')](_0x32d9('0x34')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x32d9('0x14')](function(){return _0x465192[_0x32d9('0x2f')]({'voicePause':![]});});case _0x32d9('0x44'):case _0x32d9('0x45'):case _0x32d9('0x46'):case _0x32d9('0x47'):case _0x32d9('0x48'):case'whatsapp':return db[_0x32d9('0x3b')][_0x32d9('0x2b')]({'where':{'channel':_0x2af548[_0x32d9('0x38')][_0x32d9('0x40')],'membername':_0x465192['name'],'type':'PAUSE','exitAt':null}})[_0x32d9('0x14')](function(_0x18d580){return _0x18d580[_0x32d9('0x2f')]({'exitAt':moment()[_0x32d9('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x32d9('0x49')},{'individualHooks':!![]});})[_0x32d9('0x14')](function(){var _0x5930dd={};_[_0x32d9('0x4a')](_0x5930dd,util['format']('%s%s',_0x2af548[_0x32d9('0x38')][_0x32d9('0x40')],_0x32d9('0x4b')),![]);return _0x465192[_0x32d9('0x2f')](_0x5930dd);});default:return db['UserVoiceQueueRt'][_0x32d9('0x2f')]({'paused':0x0},{'where':{'UserId':_0x465192['id']}})[_0x32d9('0x14')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x465192[_0x32d9('0x30')],'type':_0x32d9('0x31'),'exitAt':null}});})[_0x32d9('0x14')](function(_0x4e32a6){var _0x29f194=[];_0x4e32a6[_0x32d9('0x4c')](function(_0x3be14a){_0x29f194[_0x32d9('0x35')](_0x3be14a[_0x32d9('0x2f')]({'exitAt':moment()[_0x32d9('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x32d9('0x49')}));});return BPromise[_0x32d9('0x4d')](_0x29f194);})['then'](function(){return _0x465192['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x32d9('0x14')](function(_0x19c616){_0x32aa5d(_0x19c616);})[_0x32d9('0x1e')](function(_0x87165a){_0x4d468e(_0x474090[_0x32d9('0x1a')](0x1f4,_0x87165a[_0x32d9('0x1c')]));});});};exports['LogoutUser']=function(_0x437e19){var _0x1baeff=this;return new Promise(function(_0xdc3e50,_0x3e137){var _0x4ff60e;return db[_0x32d9('0x28')][_0x32d9('0x3f')]({'where':_0x437e19['options']['where']||{},'attributes':['id',_0x32d9('0x30')]})[_0x32d9('0x14')](function(_0x2e0601){if(_0x2e0601){_0x4ff60e=_0x2e0601;return db[_0x32d9('0x2e')]['destroy']({'where':{'membername':_0x4ff60e['name']},'individualHooks':!![]});}})[_0x32d9('0x14')](function(){if(_0x4ff60e){return db[_0x32d9('0x3b')][_0x32d9('0x1f')]({'where':{'membername':_0x4ff60e[_0x32d9('0x30')],'exitAt':null}});}})[_0x32d9('0x14')](function(_0x675286){if(_0x4ff60e){if(_0x675286&&_0x675286[_0x32d9('0x32')]){var _0x4848e4=[];_0x675286[_0x32d9('0x4c')](function(_0x4a2dfe){_0x4848e4[_0x32d9('0x35')](_0x4a2dfe[_0x32d9('0x2f')]({'exitAt':moment()[_0x32d9('0x33')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4848e4);}}})[_0x32d9('0x14')](function(){if(_0x4ff60e){return _0x4ff60e[_0x32d9('0x2f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x12fbc3){_0xdc3e50(_0x12fbc3);})[_0x32d9('0x1e')](function(_0x17e95e){_0x3e137(_0x1baeff['error'](0x1f4,_0x17e95e[_0x32d9('0x1c')]));});});};exports['LoginUser']=function(_0x250bea){var _0x53113b=this;return new Promise(function(_0x21f3ef,_0x2382c5){var _0x53ca35;var _0x510ffc;var _0x38dbb0;var _0xb2b170;return db[_0x32d9('0x28')][_0x32d9('0x3f')]({'where':_0x250bea[_0x32d9('0x20')][_0x32d9('0x2a')]||{},'attributes':['id',_0x32d9('0x30'),_0x32d9('0x2c'),_0x32d9('0x4e'),'phone','internal',_0x32d9('0x4f'),_0x32d9('0x36')]})[_0x32d9('0x14')](function(_0x3bc3f9){if(_0x3bc3f9){_0x53ca35=_0x3bc3f9;_0xb2b170=_0x250bea[_0x32d9('0x38')][_0x32d9('0x36')]?_0x250bea[_0x32d9('0x38')]['interface']:util[_0x32d9('0x33')](_0x32d9('0x37'),_0x53ca35[_0x32d9('0x30')]);return db[_0x32d9('0x28')][_0x32d9('0x50')]({'where':{'role':_0x32d9('0x51'),'online':!![],'id':{'$ne':_0x53ca35['id']}}});}})[_0x32d9('0x14')](function(_0xee492f){if(_0xee492f){_0x38dbb0=_0xee492f;return require('../../config/license/util')[_0x32d9('0x52')]();}})['then'](function(_0x4b7588){if(_0x4b7588&&_0x4b7588[_0x32d9('0x53')]&&_0x38dbb0>=_0x4b7588['agents']){throw new Error(_0x32d9('0x54'));}})[_0x32d9('0x14')](function(){if(_0x53ca35){return db[_0x32d9('0x2e')][_0x32d9('0x55')]({'where':{'membername':_0x53ca35[_0x32d9('0x30')]},'individualHooks':!![]});}})[_0x32d9('0x14')](function(){if(_0x53ca35){return _0x53ca35[_0x32d9('0x56')]({'raw':!![]});}})[_0x32d9('0x14')](function(_0x5b5d22){if(_0x53ca35){if(_0x5b5d22){var _0x193dee=[];_0x510ffc=_0x5b5d22;if(_0x510ffc['length']){for(var _0x4726dd=0x0;_0x4726dd<_0x510ffc[_0x32d9('0x32')];_0x4726dd++){_0x193dee['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x53ca35[_0x32d9('0x30')],'UserId':_0x53ca35['id'],'queue_name':_0x510ffc[_0x4726dd]['name'],'VoiceQueueId':_0x510ffc[_0x4726dd]['id'],'interface':_0xb2b170,'paused':_0x53ca35[_0x32d9('0x4f')]||![],'penalty':_0x510ffc[_0x4726dd]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x32d9('0x4d')](_0x193dee);}}}})['then'](function(){if(_0x53ca35){return db['MemberReport']['findAll']({'where':{'membername':_0x53ca35[_0x32d9('0x30')],'exitAt':null}});}})[_0x32d9('0x14')](function(_0x5e99b5){if(_0x53ca35){if(_0x5e99b5&&_0x5e99b5[_0x32d9('0x32')]){var _0xd3fd19=[];_0x5e99b5['forEach'](function(_0x25def4){_0xd3fd19[_0x32d9('0x35')](_0x25def4[_0x32d9('0x2f')]({'exitAt':moment()[_0x32d9('0x33')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x32d9('0x4d')](_0xd3fd19);}}})[_0x32d9('0x14')](function(_0x519c8d){if(_0x53ca35){var _0x3df4e1=[];var _0x2b97f6=[];var _0x1aaaf5=utils[_0x32d9('0x57')]();var _0x157cbf={'membername':_0x53ca35['name'],'interface':_0xb2b170,'enterAt':moment()[_0x32d9('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x53ca35['role'],'internal':_0x53ca35['internal']};_0x1aaaf5['forEach'](function(_0x1c133d){_0x3df4e1['push'](_[_0x32d9('0x58')]({'channel':_0x1c133d,'type':_0x32d9('0x59'),'data1':_0x32d9('0x5a'),'data2':_0xb2b170},_0x157cbf));if(_0x53ca35[_0x32d9('0x4f')]){_0x2b97f6[_0x32d9('0x35')](_[_0x32d9('0x58')]({'channel':_0x1c133d,'type':_0x32d9('0x31'),'data1':_0x32d9('0x5b')},_0x157cbf));}});return db['MemberReport'][_0x32d9('0x3c')](_0x3df4e1['concat'](_0x2b97f6),{'individualHooks':!![]});}})[_0x32d9('0x14')](function(){if(_0x53ca35){return _0x53ca35[_0x32d9('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x32d9('0x33')](_0x32d9('0x34')),'voicePause':_0x53ca35[_0x32d9('0x4f')]||![],'mailPause':_0x53ca35['loginInPause']||![],'chatPause':_0x53ca35[_0x32d9('0x4f')]||![],'faxPause':_0x53ca35[_0x32d9('0x4f')]||![],'smsPause':_0x53ca35[_0x32d9('0x4f')]||![],'openchannelPause':_0x53ca35[_0x32d9('0x4f')]||![],'pauseType':_0x53ca35[_0x32d9('0x4f')]?_0x32d9('0x5b'):null,'lastPauseAt':moment()[_0x32d9('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xb2b170});}})[_0x32d9('0x14')](function(_0x2ab86d){_0x21f3ef(_0x2ab86d);})[_0x32d9('0x1e')](function(_0x3bbf8a){_0x2382c5(_0x53113b[_0x32d9('0x1a')](0x1f4,_0x3bbf8a[_0x32d9('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5139edc..bbf02ba 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 _0x53b0=['user:','./user.events','save','remove','update','emit','removeListener'];(function(_0x44009c,_0x9a37f7){var _0x5a836e=function(_0x2e3501){while(--_0x2e3501){_0x44009c['push'](_0x44009c['shift']());}};_0x5a836e(++_0x9a37f7);}(_0x53b0,0x174));var _0x053b=function(_0x19ec5d,_0x24d899){_0x19ec5d=_0x19ec5d-0x0;var _0x2ae628=_0x53b0[_0x19ec5d];return _0x2ae628;};'use strict';var UserEvents=require(_0x053b('0x0'));var events=[_0x053b('0x1'),_0x053b('0x2'),_0x053b('0x3')];function createListener(_0x1a0a51,_0x215508){return function(_0x19ebc4){_0x215508[_0x053b('0x4')](_0x1a0a51,_0x19ebc4);};}function removeListener(_0x1959c8,_0x30b426){return function(){UserEvents[_0x053b('0x5')](_0x1959c8,_0x30b426);};}exports['register']=function(_0x11c886){for(var _0x25c9bf=0x0,_0x43a169=events['length'];_0x25c9bf<_0x43a169;_0x25c9bf++){var _0x311041=events[_0x25c9bf];var _0x505332=createListener(_0x053b('0x6')+_0x311041,_0x11c886);UserEvents['on'](_0x311041,_0x505332);}}; \ No newline at end of file +var _0xa303=['remove','update','emit','length','./user.events'];(function(_0x192292,_0xb85af5){var _0x3cd326=function(_0x4f1048){while(--_0x4f1048){_0x192292['push'](_0x192292['shift']());}};_0x3cd326(++_0xb85af5);}(_0xa303,0xe0));var _0x3a30=function(_0x3c8bd8,_0x92990a){_0x3c8bd8=_0x3c8bd8-0x0;var _0x592870=_0xa303[_0x3c8bd8];return _0x592870;};'use strict';var UserEvents=require(_0x3a30('0x0'));var events=['save',_0x3a30('0x1'),_0x3a30('0x2')];function createListener(_0x139a67,_0x1411ce){return function(_0x386743){_0x1411ce[_0x3a30('0x3')](_0x139a67,_0x386743);};}function removeListener(_0x54863f,_0x1e3df1){return function(){UserEvents['removeListener'](_0x54863f,_0x1e3df1);};}exports['register']=function(_0x10e1c9){for(var _0x1bd16d=0x0,_0x584882=events[_0x3a30('0x4')];_0x1bd16d<_0x584882;_0x1bd16d++){var _0x5706dc=events[_0x1bd16d];var _0x206139=createListener('user:'+_0x5706dc,_0x10e1c9);UserEvents['on'](_0x5706dc,_0x206139);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 8934466..146c069 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 _0xfc32=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','connect-timeout','express'];(function(_0x2ffe6a,_0x4ed06d){var _0xce60b0=function(_0x3b0bfc){while(--_0x3b0bfc){_0x2ffe6a['push'](_0x2ffe6a['shift']());}};_0xce60b0(++_0x4ed06d);}(_0xfc32,0x10e));var _0x2fc3=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfc32[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require('multer');var util=require(_0x2fc3('0x0'));var path=require('path');var timeout=require(_0x2fc3('0x1'));var express=require(_0x2fc3('0x2'));var router=express[_0x2fc3('0x3')]();var auth=require(_0x2fc3('0x4'));var interaction=require(_0x2fc3('0x5'));var config=require(_0x2fc3('0x6'));module['exports']=router; \ No newline at end of file +var _0x7050=['connect-timeout','express','../../components/auth/service','../../config/environment','multer','util','path'];(function(_0x5ea2b1,_0x50f848){var _0x1773c0=function(_0x47bc96){while(--_0x47bc96){_0x5ea2b1['push'](_0x5ea2b1['shift']());}};_0x1773c0(++_0x50f848);}(_0x7050,0x74));var _0x0705=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0x7050[_0x43aee5];return _0x76d1d0;};'use strict';var multer=require(_0x0705('0x0'));var util=require(_0x0705('0x1'));var path=require(_0x0705('0x2'));var timeout=require(_0x0705('0x3'));var express=require(_0x0705('0x4'));var router=express['Router']();var auth=require(_0x0705('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0705('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d3deb9e..c1d8679 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 _0xd8b0=['exports','sequelize'];(function(_0x4d1ce8,_0x1a778e){var _0x129384=function(_0x15e43b){while(--_0x15e43b){_0x4d1ce8['push'](_0x4d1ce8['shift']());}};_0x129384(++_0x1a778e);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x3de7ef,_0xd1063e){var _0x62a6b7=function(_0x1c18b8){while(--_0x1c18b8){_0x3de7ef['push'](_0x3de7ef['shift']());}};_0x62a6b7(++_0xd1063e);}(_0xe706,0xa3));var _0x6e70=function(_0x5e76c6,_0xf16290){_0x5e76c6=_0x5e76c6-0x0;var _0x43fb22=_0xe706[_0x5e76c6];return _0x43fb22;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index ccc952a..382fe1b 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 _0x1fa9=['define','UserChatQueue','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0xd03707,_0x347e7c){var _0x5642b3=function(_0x114f19){while(--_0x114f19){_0xd03707['push'](_0xd03707['shift']());}};_0x5642b3(++_0x347e7c);}(_0x1fa9,0x136));var _0x91fa=function(_0x4cacb5,_0x1ecc42){_0x4cacb5=_0x4cacb5-0x0;var _0x90e05c=_0x1fa9[_0x4cacb5];return _0x90e05c;};'use strict';var _=require(_0x91fa('0x0'));var util=require('util');var logger=require(_0x91fa('0x1'))('api');var moment=require(_0x91fa('0x2'));var BPromise=require(_0x91fa('0x3'));var rp=require(_0x91fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91fa('0x5'));var config=require(_0x91fa('0x6'));var attributes=require(_0x91fa('0x7'));module[_0x91fa('0x8')]=function(_0xd050dc,_0x50f800){return _0xd050dc[_0x91fa('0x9')](_0x91fa('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb495=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util'];(function(_0x47fb98,_0x51132d){var _0x5b98de=function(_0x1a593a){while(--_0x1a593a){_0x47fb98['push'](_0x47fb98['shift']());}};_0x5b98de(++_0x51132d);}(_0xb495,0xc1));var _0x5b49=function(_0x632ded,_0x509e59){_0x632ded=_0x632ded-0x0;var _0x17a2e7=_0xb495[_0x632ded];return _0x17a2e7;};'use strict';var _=require(_0x5b49('0x0'));var util=require(_0x5b49('0x1'));var logger=require(_0x5b49('0x2'))(_0x5b49('0x3'));var moment=require(_0x5b49('0x4'));var BPromise=require(_0x5b49('0x5'));var rp=require(_0x5b49('0x6'));var fs=require('fs');var path=require(_0x5b49('0x7'));var rimraf=require(_0x5b49('0x8'));var config=require('../../config/environment');var attributes=require(_0x5b49('0x9'));module[_0x5b49('0xa')]=function(_0x5a76af,_0x15c9fc){return _0x5a76af[_0x5b49('0xb')]('UserChatQueue',attributes,{'tableName':_0x5b49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 202c9ec..dae8685 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 _0xf9f3=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x38eb86,_0x247e47){var _0x1f2581=function(_0x4d614e){while(--_0x4d614e){_0x38eb86['push'](_0x38eb86['shift']());}};_0x1f2581(++_0x247e47);}(_0xf9f3,0x172));var _0x3f9f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf9f3[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3f9f('0x0'));var util=require(_0x3f9f('0x1'));var moment=require(_0x3f9f('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f9f('0x3'));var fs=require('fs');var Redis=require(_0x3f9f('0x4'));var db=require(_0x3f9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f9f('0x6'))(_0x3f9f('0x7'));var config=require(_0x3f9f('0x8'));var jayson=require(_0x3f9f('0x9'));var client=jayson[_0x3f9f('0xa')][_0x3f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e994,_0x27e761,_0x17496a){return new BPromise(function(_0x1e6bc6,_0x3a91c1){return client[_0x3f9f('0xc')](_0x30e994,_0x17496a)[_0x3f9f('0xd')](function(_0x862649){logger[_0x3f9f('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x27e761,_0x3f9f('0xf'));logger[_0x3f9f('0x10')](_0x3f9f('0x11'),_0x27e761,'request\x20sent',JSON[_0x3f9f('0x12')](_0x862649));if(_0x862649[_0x3f9f('0x13')]){if(_0x862649[_0x3f9f('0x13')][_0x3f9f('0x14')]===0x1f4){logger[_0x3f9f('0x13')](_0x3f9f('0x15'),_0x27e761,_0x862649[_0x3f9f('0x13')][_0x3f9f('0x16')]);return _0x3a91c1(_0x862649[_0x3f9f('0x13')][_0x3f9f('0x16')]);}logger[_0x3f9f('0x13')](_0x3f9f('0x15'),_0x27e761,_0x862649[_0x3f9f('0x13')][_0x3f9f('0x16')]);return _0x1e6bc6(_0x862649['error'][_0x3f9f('0x16')]);}else{logger[_0x3f9f('0xe')](_0x3f9f('0x15'),_0x27e761,_0x3f9f('0xf'));_0x1e6bc6(_0x862649[_0x3f9f('0x17')][_0x3f9f('0x16')]);}})[_0x3f9f('0x18')](function(_0x1f8726){logger[_0x3f9f('0x13')](_0x3f9f('0x15'),_0x27e761,_0x1f8726);_0x3a91c1(_0x1f8726);});});} \ No newline at end of file +var _0x20b4=['http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x13d7e3,_0x39bbc0){var _0xd079f5=function(_0xdcf129){while(--_0xdcf129){_0x13d7e3['push'](_0x13d7e3['shift']());}};_0xd079f5(++_0x39bbc0);}(_0x20b4,0x136));var _0x420b=function(_0x39580c,_0x22425c){_0x39580c=_0x39580c-0x0;var _0x1a4cd8=_0x20b4[_0x39580c];return _0x1a4cd8;};'use strict';var _=require(_0x420b('0x0'));var util=require(_0x420b('0x1'));var moment=require(_0x420b('0x2'));var BPromise=require(_0x420b('0x3'));var rs=require(_0x420b('0x4'));var fs=require('fs');var Redis=require(_0x420b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x420b('0x6'))(_0x420b('0x7'));var config=require('../../config/environment');var jayson=require(_0x420b('0x8'));var client=jayson[_0x420b('0x9')][_0x420b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dee54,_0x2c4f94,_0x5220b4){return new BPromise(function(_0x148bbf,_0x52c062){return client['request'](_0x1dee54,_0x5220b4)[_0x420b('0xb')](function(_0x112272){logger[_0x420b('0xc')](_0x420b('0xd'),_0x2c4f94,_0x420b('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2c4f94,_0x420b('0xe'),JSON['stringify'](_0x112272));if(_0x112272[_0x420b('0xf')]){if(_0x112272[_0x420b('0xf')][_0x420b('0x10')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2c4f94,_0x112272[_0x420b('0xf')]['message']);return _0x52c062(_0x112272[_0x420b('0xf')][_0x420b('0x11')]);}logger[_0x420b('0xf')](_0x420b('0xd'),_0x2c4f94,_0x112272[_0x420b('0xf')][_0x420b('0x11')]);return _0x148bbf(_0x112272[_0x420b('0xf')][_0x420b('0x11')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2c4f94,_0x420b('0xe'));_0x148bbf(_0x112272[_0x420b('0x12')][_0x420b('0x11')]);}})[_0x420b('0x13')](function(_0x1d99f3){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2c4f94,_0x1d99f3);_0x52c062(_0x1d99f3);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index be820cb..e345e23 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 _0x3872=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x13ee0f,_0x9a616d){var _0x33f202=function(_0x4ceaed){while(--_0x4ceaed){_0x13ee0f['push'](_0x13ee0f['shift']());}};_0x33f202(++_0x9a616d);}(_0x3872,0x1d0));var _0x2387=function(_0xbc3b38,_0x35474e){_0xbc3b38=_0xbc3b38-0x0;var _0x5f7167=_0x3872[_0xbc3b38];return _0x5f7167;};'use strict';var multer=require(_0x2387('0x0'));var util=require(_0x2387('0x1'));var path=require(_0x2387('0x2'));var timeout=require(_0x2387('0x3'));var express=require(_0x2387('0x4'));var router=express['Router']();var auth=require(_0x2387('0x5'));var interaction=require(_0x2387('0x6'));var config=require(_0x2387('0x7'));module[_0x2387('0x8')]=router; \ No newline at end of file +var _0x11cb=['util','path','connect-timeout','express','Router','../../components/interaction/service','exports','multer'];(function(_0x1e9893,_0x3e1dd0){var _0x281922=function(_0x5f0150){while(--_0x5f0150){_0x1e9893['push'](_0x1e9893['shift']());}};_0x281922(++_0x3e1dd0);}(_0x11cb,0x167));var _0xb11c=function(_0x22b649,_0x2080ea){_0x22b649=_0x22b649-0x0;var _0x3215d3=_0x11cb[_0x22b649];return _0x3215d3;};'use strict';var multer=require(_0xb11c('0x0'));var util=require(_0xb11c('0x1'));var path=require(_0xb11c('0x2'));var timeout=require(_0xb11c('0x3'));var express=require(_0xb11c('0x4'));var router=express[_0xb11c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb11c('0x6'));var config=require('../../config/environment');module[_0xb11c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index f94210c..dc8829b 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 _0x8e3f=['STRING','sequelize','exports','INTEGER'];(function(_0x4079a2,_0x55b0c7){var _0x4fc99b=function(_0x383e6f){while(--_0x383e6f){_0x4079a2['push'](_0x4079a2['shift']());}};_0x4fc99b(++_0x55b0c7);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'penalty':{'type':Sequelize[_0xf8e3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf8e3('0x3')]}}; \ No newline at end of file +var _0x9c00=['exports','STRING','sequelize'];(function(_0x58abc9,_0xf56dce){var _0x42cd2b=function(_0x5d563b){while(--_0x5d563b){_0x58abc9['push'](_0x58abc9['shift']());}};_0x42cd2b(++_0xf56dce);}(_0x9c00,0x1a0));var _0x09c0=function(_0xaca348,_0x4d3993){_0xaca348=_0xaca348-0x0;var _0x560057=_0x9c00[_0xaca348];return _0x560057;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x09c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 22037dd..ea38a6e 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 _0x97b5=['user_has_fax_queues','util','api','bluebird','request-promise','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x2385ff,_0x3c6cd9){var _0x351166=function(_0x44b57d){while(--_0x44b57d){_0x2385ff['push'](_0x2385ff['shift']());}};_0x351166(++_0x3c6cd9);}(_0x97b5,0x137));var _0x597b=function(_0x5e3e02,_0x197125){_0x5e3e02=_0x5e3e02-0x0;var _0x5c0f2f=_0x97b5[_0x5e3e02];return _0x5c0f2f;};'use strict';var _=require('lodash');var util=require(_0x597b('0x0'));var logger=require('../../config/logger')(_0x597b('0x1'));var moment=require('moment');var BPromise=require(_0x597b('0x2'));var rp=require(_0x597b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x597b('0x4'));var config=require('../../config/environment');var attributes=require(_0x597b('0x5'));module[_0x597b('0x6')]=function(_0xa0e390,_0x1383d8){return _0xa0e390[_0x597b('0x7')](_0x597b('0x8'),attributes,{'tableName':_0x597b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde4d=['../../config/logger','api','moment','bluebird','exports','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xde4d,0xf1));var _0xdde4=function(_0x5dacdc,_0x360c9b){_0x5dacdc=_0x5dacdc-0x0;var _0x40d00a=_0xde4d[_0x5dacdc];return _0x40d00a;};'use strict';var _=require(_0xdde4('0x0'));var util=require(_0xdde4('0x1'));var logger=require(_0xdde4('0x2'))(_0xdde4('0x3'));var moment=require(_0xdde4('0x4'));var BPromise=require(_0xdde4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xdde4('0x6')]=function(_0x4b8cbd,_0x3d7216){return _0x4b8cbd['define'](_0xdde4('0x7'),attributes,{'tableName':_0xdde4('0x8'),'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 c3af36d..743d1ec 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 _0x366b=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x31aee4,_0xef6769){var _0x34db51=function(_0x47403f){while(--_0x47403f){_0x31aee4['push'](_0x31aee4['shift']());}};_0x34db51(++_0xef6769);}(_0x366b,0x14f));var _0xb366=function(_0x21c31c,_0x10347b){_0x21c31c=_0x21c31c-0x0;var _0x5d282a=_0x366b[_0x21c31c];return _0x5d282a;};'use strict';var _=require('lodash');var util=require(_0xb366('0x0'));var moment=require(_0xb366('0x1'));var BPromise=require(_0xb366('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb366('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb366('0x4'))(_0xb366('0x5'));var config=require(_0xb366('0x6'));var jayson=require(_0xb366('0x7'));var client=jayson['client'][_0xb366('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f63da,_0x414e5b,_0x54b579){return new BPromise(function(_0x59eb0d,_0x4a3618){return client[_0xb366('0x9')](_0x4f63da,_0x54b579)[_0xb366('0xa')](function(_0x319307){logger[_0xb366('0xb')](_0xb366('0xc'),_0x414e5b,_0xb366('0xd'));logger[_0xb366('0xe')](_0xb366('0xf'),_0x414e5b,_0xb366('0xd'),JSON[_0xb366('0x10')](_0x319307));if(_0x319307[_0xb366('0x11')]){if(_0x319307[_0xb366('0x11')][_0xb366('0x12')]===0x1f4){logger[_0xb366('0x11')](_0xb366('0xc'),_0x414e5b,_0x319307['error']['message']);return _0x4a3618(_0x319307[_0xb366('0x11')][_0xb366('0x13')]);}logger[_0xb366('0x11')](_0xb366('0xc'),_0x414e5b,_0x319307[_0xb366('0x11')][_0xb366('0x13')]);return _0x59eb0d(_0x319307['error'][_0xb366('0x13')]);}else{logger[_0xb366('0xb')](_0xb366('0xc'),_0x414e5b,'request\x20sent');_0x59eb0d(_0x319307['result'][_0xb366('0x13')]);}})['catch'](function(_0x29f147){logger[_0xb366('0x11')](_0xb366('0xc'),_0x414e5b,_0x29f147);_0x4a3618(_0x29f147);});});} \ No newline at end of file +var _0x8a2c=['UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s','debug'];(function(_0x30741f,_0x88d373){var _0x478a46=function(_0x4d55a7){while(--_0x4d55a7){_0x30741f['push'](_0x30741f['shift']());}};_0x478a46(++_0x88d373);}(_0x8a2c,0xb8));var _0xc8a2=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x8a2c[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xc8a2('0x0'));var util=require('util');var moment=require(_0xc8a2('0x1'));var BPromise=require(_0xc8a2('0x2'));var rs=require(_0xc8a2('0x3'));var fs=require('fs');var Redis=require(_0xc8a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8a2('0x5'));var logger=require(_0xc8a2('0x6'))(_0xc8a2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc8a2('0x8'));var client=jayson[_0xc8a2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc329cb,_0x40d6e6,_0x413ae3){return new BPromise(function(_0x5744ba,_0xa82b15){return client[_0xc8a2('0xa')](_0xc329cb,_0x413ae3)['then'](function(_0x5d6dc7){logger[_0xc8a2('0xb')](_0xc8a2('0xc'),_0x40d6e6,'request\x20sent');logger[_0xc8a2('0xd')](_0xc8a2('0xe'),_0x40d6e6,_0xc8a2('0xf'),JSON[_0xc8a2('0x10')](_0x5d6dc7));if(_0x5d6dc7['error']){if(_0x5d6dc7[_0xc8a2('0x11')][_0xc8a2('0x12')]===0x1f4){logger[_0xc8a2('0x11')](_0xc8a2('0xc'),_0x40d6e6,_0x5d6dc7['error'][_0xc8a2('0x13')]);return _0xa82b15(_0x5d6dc7[_0xc8a2('0x11')][_0xc8a2('0x13')]);}logger['error'](_0xc8a2('0xc'),_0x40d6e6,_0x5d6dc7[_0xc8a2('0x11')][_0xc8a2('0x13')]);return _0x5744ba(_0x5d6dc7[_0xc8a2('0x11')]['message']);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x40d6e6,_0xc8a2('0xf'));_0x5744ba(_0x5d6dc7[_0xc8a2('0x14')][_0xc8a2('0x13')]);}})[_0xc8a2('0x15')](function(_0x4f93ac){logger[_0xc8a2('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x40d6e6,_0x4f93ac);_0xa82b15(_0x4f93ac);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ef7b6f5..1d54651 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 _0xda5e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','multer','util','path'];(function(_0x25825b,_0xf6fd5f){var _0x5e9b99=function(_0x59bd03){while(--_0x59bd03){_0x25825b['push'](_0x25825b['shift']());}};_0x5e9b99(++_0xf6fd5f);}(_0xda5e,0xfd));var _0xeda5=function(_0x162dea,_0x418e88){_0x162dea=_0x162dea-0x0;var _0x418872=_0xda5e[_0x162dea];return _0x418872;};'use strict';var multer=require(_0xeda5('0x0'));var util=require(_0xeda5('0x1'));var path=require(_0xeda5('0x2'));var timeout=require(_0xeda5('0x3'));var express=require(_0xeda5('0x4'));var router=express[_0xeda5('0x5')]();var auth=require(_0xeda5('0x6'));var interaction=require(_0xeda5('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x7db4=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x47aa9f,_0x50a0d2){var _0x36e3f1=function(_0x542a56){while(--_0x542a56){_0x47aa9f['push'](_0x47aa9f['shift']());}};_0x36e3f1(++_0x50a0d2);}(_0x7db4,0x127));var _0x47db=function(_0x1c80bd,_0x356976){_0x1c80bd=_0x1c80bd-0x0;var _0x15b7fc=_0x7db4[_0x1c80bd];return _0x15b7fc;};'use strict';var multer=require(_0x47db('0x0'));var util=require(_0x47db('0x1'));var path=require(_0x47db('0x2'));var timeout=require(_0x47db('0x3'));var express=require(_0x47db('0x4'));var router=express[_0x47db('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x47db('0x6'));var config=require(_0x47db('0x7'));module[_0x47db('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0957ed3..7822fc5 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0xee7762,_0x2c5dc3){var _0x378222=function(_0x26b423){while(--_0x26b423){_0xee7762['push'](_0xee7762['shift']());}};_0x378222(++_0x2c5dc3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x234318,_0xf22f31){var _0x1ab719=function(_0x10a0b1){while(--_0x10a0b1){_0x234318['push'](_0x234318['shift']());}};_0x1ab719(++_0xf22f31);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 57669d3..acdb1db 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 _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x5bce33,_0x4a4b06){var _0x15bc20=function(_0x56c711){while(--_0x56c711){_0x5bce33['push'](_0x5bce33['shift']());}};_0x15bc20(++_0x4a4b06);}(_0x757a,0xde));var _0xa757=function(_0x1c3548,_0x244906){_0x1c3548=_0x1c3548-0x0;var _0x1a327c=_0x757a[_0x1c3548];return _0x1a327c;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x542312,_0x259755){var _0x45d809=function(_0x48354b){while(--_0x48354b){_0x542312['push'](_0x542312['shift']());}};_0x45d809(++_0x259755);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 373ae71..3c5aea9 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 _0xd47c=['debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1a2a6d,_0x5eecf1){var _0x1e6d29=function(_0x292859){while(--_0x292859){_0x1a2a6d['push'](_0x1a2a6d['shift']());}};_0x1e6d29(++_0x5eecf1);}(_0xd47c,0x195));var _0xcd47=function(_0x35f6af,_0x505074){_0x35f6af=_0x35f6af-0x0;var _0x4ae86a=_0xd47c[_0x35f6af];return _0x4ae86a;};'use strict';var _=require('lodash');var util=require(_0xcd47('0x0'));var moment=require(_0xcd47('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd47('0x2'));var fs=require('fs');var Redis=require(_0xcd47('0x3'));var db=require(_0xcd47('0x4'))['db'];var utils=require(_0xcd47('0x5'));var logger=require(_0xcd47('0x6'))(_0xcd47('0x7'));var config=require(_0xcd47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcd47('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e87bc,_0x2b6e16,_0x2b34d9){return new BPromise(function(_0x488d42,_0x3983ae){return client[_0xcd47('0xa')](_0x2e87bc,_0x2b34d9)[_0xcd47('0xb')](function(_0xe5ad05){logger[_0xcd47('0xc')](_0xcd47('0xd'),_0x2b6e16,_0xcd47('0xe'));logger[_0xcd47('0xf')](_0xcd47('0x10'),_0x2b6e16,'request\x20sent',JSON[_0xcd47('0x11')](_0xe5ad05));if(_0xe5ad05['error']){if(_0xe5ad05['error']['code']===0x1f4){logger[_0xcd47('0x12')](_0xcd47('0xd'),_0x2b6e16,_0xe5ad05[_0xcd47('0x12')][_0xcd47('0x13')]);return _0x3983ae(_0xe5ad05[_0xcd47('0x12')][_0xcd47('0x13')]);}logger[_0xcd47('0x12')](_0xcd47('0xd'),_0x2b6e16,_0xe5ad05[_0xcd47('0x12')][_0xcd47('0x13')]);return _0x488d42(_0xe5ad05[_0xcd47('0x12')][_0xcd47('0x13')]);}else{logger[_0xcd47('0xc')](_0xcd47('0xd'),_0x2b6e16,'request\x20sent');_0x488d42(_0xe5ad05['result'][_0xcd47('0x13')]);}})[_0xcd47('0x14')](function(_0x370e0c){logger[_0xcd47('0x12')](_0xcd47('0xd'),_0x2b6e16,_0x370e0c);_0x3983ae(_0x370e0c);});});} \ No newline at end of file +var _0xcff4=['then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4fd91b,_0x319b40){var _0x380180=function(_0x14f4f0){while(--_0x14f4f0){_0x4fd91b['push'](_0x4fd91b['shift']());}};_0x380180(++_0x319b40);}(_0xcff4,0x11e));var _0x4cff=function(_0xc03c92,_0x770fd){_0xc03c92=_0xc03c92-0x0;var _0x369c39=_0xcff4[_0xc03c92];return _0x369c39;};'use strict';var _=require(_0x4cff('0x0'));var util=require(_0x4cff('0x1'));var moment=require(_0x4cff('0x2'));var BPromise=require(_0x4cff('0x3'));var rs=require(_0x4cff('0x4'));var fs=require('fs');var Redis=require(_0x4cff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cff('0x6'));var logger=require('../../config/logger')(_0x4cff('0x7'));var config=require(_0x4cff('0x8'));var jayson=require(_0x4cff('0x9'));var client=jayson[_0x4cff('0xa')][_0x4cff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c486a,_0x4b4880,_0x1af778){return new BPromise(function(_0x85a634,_0xca531f){return client[_0x4cff('0xc')](_0x3c486a,_0x1af778)[_0x4cff('0xd')](function(_0x126da4){logger[_0x4cff('0xe')](_0x4cff('0xf'),_0x4b4880,_0x4cff('0x10'));logger[_0x4cff('0x11')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4b4880,'request\x20sent',JSON[_0x4cff('0x12')](_0x126da4));if(_0x126da4[_0x4cff('0x13')]){if(_0x126da4[_0x4cff('0x13')]['code']===0x1f4){logger[_0x4cff('0x13')](_0x4cff('0xf'),_0x4b4880,_0x126da4[_0x4cff('0x13')][_0x4cff('0x14')]);return _0xca531f(_0x126da4[_0x4cff('0x13')][_0x4cff('0x14')]);}logger[_0x4cff('0x13')](_0x4cff('0xf'),_0x4b4880,_0x126da4[_0x4cff('0x13')][_0x4cff('0x14')]);return _0x85a634(_0x126da4[_0x4cff('0x13')][_0x4cff('0x14')]);}else{logger['info'](_0x4cff('0xf'),_0x4b4880,'request\x20sent');_0x85a634(_0x126da4[_0x4cff('0x15')][_0x4cff('0x14')]);}})[_0x4cff('0x16')](function(_0x3507fe){logger[_0x4cff('0x13')](_0x4cff('0xf'),_0x4b4880,_0x3507fe);_0xca531f(_0x3507fe);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3fc53af..3127128 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 _0x17f0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x5ebec3,_0x4dae51){var _0x506812=function(_0x5d02ba){while(--_0x5d02ba){_0x5ebec3['push'](_0x5ebec3['shift']());}};_0x506812(++_0x4dae51);}(_0x17f0,0x1dc));var _0x017f=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x17f0[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x017f('0x0'));var util=require(_0x017f('0x1'));var path=require(_0x017f('0x2'));var timeout=require(_0x017f('0x3'));var express=require(_0x017f('0x4'));var router=express[_0x017f('0x5')]();var auth=require(_0x017f('0x6'));var interaction=require(_0x017f('0x7'));var config=require(_0x017f('0x8'));var controller=require(_0x017f('0x9'));router[_0x017f('0xa')]('/',auth[_0x017f('0xb')](),controller[_0x017f('0xc')]);module[_0x017f('0xd')]=router; \ No newline at end of file +var _0x6b34=['../../components/auth/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6b34,0x8a));var _0x46b3=function(_0x4dfd71,_0x33a01a){_0x4dfd71=_0x4dfd71-0x0;var _0x10c939=_0x6b34[_0x4dfd71];return _0x10c939;};'use strict';var multer=require(_0x46b3('0x0'));var util=require(_0x46b3('0x1'));var path=require(_0x46b3('0x2'));var timeout=require(_0x46b3('0x3'));var express=require(_0x46b3('0x4'));var router=express[_0x46b3('0x5')]();var auth=require(_0x46b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x46b3('0x7'));var controller=require(_0x46b3('0x8'));router[_0x46b3('0x9')]('/',auth['isAuthenticated'](),controller[_0x46b3('0xa')]);module[_0x46b3('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2262c48..a7e76a4 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 _0x1be5=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x1be5,0x1a0));var _0x51be=function(_0x1f2022,_0x142fa2){_0x1f2022=_0x1f2022-0x0;var _0x12672e=_0x1be5[_0x1f2022];return _0x12672e;};'use strict';var Sequelize=require(_0x51be('0x0'));module[_0x51be('0x1')]={'body':{'type':Sequelize[_0x51be('0x2')]},'senderName':{'type':Sequelize[_0x51be('0x3')]},'recipientsId':{'type':Sequelize[_0x51be('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x51be('0x4')]}}; \ No newline at end of file +var _0x3ee8=['TEXT','STRING','BOOLEAN'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0x3ee8,0xab));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x83ee('0x0')]},'senderName':{'type':Sequelize[_0x83ee('0x1')]},'recipientsId':{'type':Sequelize[_0x83ee('0x0')]},'recipientsDescription':{'type':Sequelize[_0x83ee('0x1')]},'beep':{'type':Sequelize[_0x83ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9f8306c..c53c0d7 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 _0x1cea=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','view','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','transaction','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','ids','queue','Queue','push','all','union','flatten','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0xb5e669,_0x4af46b){var _0x12d514=function(_0x6ac7ef){while(--_0x6ac7ef){_0xb5e669['push'](_0xb5e669['shift']());}};_0x12d514(++_0x4af46b);}(_0x1cea,0x128));var _0xa1ce=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x1cea[_0x3ff685];return _0x2046c9;};'use strict';var pdf=require(_0xa1ce('0x0'));var emlformat=require(_0xa1ce('0x1'));var rimraf=require(_0xa1ce('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1ce('0x3'));var rp=require(_0xa1ce('0x4'));var moment=require(_0xa1ce('0x5'));var BPromise=require(_0xa1ce('0x6'));var Mustache=require(_0xa1ce('0x7'));var util=require(_0xa1ce('0x8'));var path=require(_0xa1ce('0x9'));var sox=require('sox');var csv=require(_0xa1ce('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa1ce('0xb'));var squel=require(_0xa1ce('0xc'));var crypto=require(_0xa1ce('0xd'));var jsforce=require(_0xa1ce('0xe'));var deskjs=require(_0xa1ce('0xf'));var toCsv=require(_0xa1ce('0xa'));var querystring=require(_0xa1ce('0x10'));var Papa=require(_0xa1ce('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1ce('0x12'));var as=require(_0xa1ce('0x13'));var hardwareService=require(_0xa1ce('0x14'));var logger=require('../../config/logger')(_0xa1ce('0x15'));var utils=require(_0xa1ce('0x16'));var config=require(_0xa1ce('0x17'));var licenseUtil=require(_0xa1ce('0x18'));var db=require(_0xa1ce('0x19'))['db'];config[_0xa1ce('0x1a')]=_[_0xa1ce('0x1b')](config[_0xa1ce('0x1a')],{'host':_0xa1ce('0x1c'),'port':0x18eb});var socket=require(_0xa1ce('0x1d'))(new Redis(config[_0xa1ce('0x1a')]));require(_0xa1ce('0x1e'))[_0xa1ce('0x1f')](socket);function respondWithStatusCode(_0x52d436,_0x1d8a93){_0x1d8a93=_0x1d8a93||0xcc;return function(_0x47829f){if(_0x47829f){return _0x52d436[_0xa1ce('0x20')](_0x1d8a93);}return _0x52d436[_0xa1ce('0x21')](_0x1d8a93)['end']();};}function respondWithResult(_0x382fb0,_0x4d8110){_0x4d8110=_0x4d8110||0xc8;return function(_0x46efde){if(_0x46efde){return _0x382fb0[_0xa1ce('0x21')](_0x4d8110)[_0xa1ce('0x22')](_0x46efde);}};}function respondWithFilteredResult(_0x5e1e89,_0x5d86b3){return function(_0x166979){if(_0x166979){var _0x3fffd9=_0x166979['count'],_0x2527bf=_0x5d86b3[_0xa1ce('0x23')],_0x226a4a=_0x5d86b3['offset']+_0x5d86b3['limit'],_0x1c29cd;if(_0x226a4a>=_0x3fffd9){_0x226a4a=_0x3fffd9;_0x1c29cd=0xc8;}else{_0x1c29cd=0xce;}_0x5e1e89['status'](_0x1c29cd);return _0x5e1e89[_0xa1ce('0x24')](_0xa1ce('0x25'),_0x2527bf+'-'+_0x226a4a+'/'+_0x3fffd9)['json'](_0x166979);}return null;};}function patchUpdates(_0x26eecf){return function(_0x25adc9){try{jsonpatch[_0xa1ce('0x26')](_0x25adc9,_0x26eecf,!![]);}catch(_0x395d09){return BPromise[_0xa1ce('0x27')](_0x395d09);}return _0x25adc9[_0xa1ce('0x28')]();};}function saveUpdates(_0x4dda97,_0x19513c){return function(_0x1cb896){if(_0x1cb896){return _0x1cb896[_0xa1ce('0x29')](_0x4dda97)['then'](function(_0x5bae6d){return _0x5bae6d;});}return null;};}function removeEntity(_0x20b411,_0x580eaf){return function(_0x3d396b){if(_0x3d396b){return _0x3d396b[_0xa1ce('0x2a')]()['then'](function(){_0x20b411[_0xa1ce('0x21')](0xcc)[_0xa1ce('0x2b')]();});}};}function handleEntityNotFound(_0x2b9929,_0x17a9f2){return function(_0x1dfdb2){if(!_0x1dfdb2){_0x2b9929[_0xa1ce('0x20')](0x194);}return _0x1dfdb2;};}function handleError(_0x3718ce,_0x539c1e){_0x539c1e=_0x539c1e||0x1f4;return function(_0x274dc4){logger[_0xa1ce('0x2c')](_0x274dc4[_0xa1ce('0x2d')]);if(_0x274dc4[_0xa1ce('0x2e')]){delete _0x274dc4[_0xa1ce('0x2e')];}_0x3718ce['status'](_0x539c1e)['send'](_0x274dc4);};}exports[_0xa1ce('0x2f')]=function(_0x249605,_0x54a61b,_0x967315){if(!_0x249605[_0xa1ce('0x30')][_0xa1ce('0x31')](_0xa1ce('0x32'))&&!_0x249605[_0xa1ce('0x30')][_0xa1ce('0x31')](_0xa1ce('0x33'))){throw new db[(_0xa1ce('0x34'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x249605[_0xa1ce('0x30')][_0xa1ce('0x31')](_0xa1ce('0x33'))&&!_0x249605[_0xa1ce('0x30')][_0xa1ce('0x31')](_0xa1ce('0x35'))){throw new db[(_0xa1ce('0x34'))][(_0xa1ce('0x36'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x249605[_0xa1ce('0x30')]['hasOwnProperty']('recipients')){throw new db['Sequelize']['ValidationError'](_0xa1ce('0x37'));}else{try{var _0x2a8878=JSON[_0xa1ce('0x38')](_0x249605[_0xa1ce('0x30')][_0xa1ce('0x39')]);}catch(_0x2ebef9){logger[_0xa1ce('0x2c')](_0x2ebef9);throw new db[(_0xa1ce('0x34'))][(_0xa1ce('0x36'))](_0xa1ce('0x3a'));}var _0x1d4b8c=['chatqueue','faxqueue',_0xa1ce('0x3b'),_0xa1ce('0x3c'),_0xa1ce('0x3d'),_0xa1ce('0x3e'),_0xa1ce('0x3f'),_0xa1ce('0x40'),_0xa1ce('0x41')];if(_[_0xa1ce('0x42')](_0x2a8878,function(_0x59d115){return!_[_0xa1ce('0x43')](_0x1d4b8c,_0x59d115[_0xa1ce('0x44')][_0xa1ce('0x45')]());})){throw new db['Sequelize']['ValidationError'](_0xa1ce('0x46'));}}}var _0x5382fd={};_0x5382fd[_0xa1ce('0x47')]=_0x249605[_0xa1ce('0x30')]['hasOwnProperty']('senderName')?_0x249605[_0xa1ce('0x30')][_0xa1ce('0x47')]:_0x249605['user'][_0xa1ce('0x48')];_0x5382fd[_0xa1ce('0x49')]=_[_0xa1ce('0x4a')](_0x249605[_0xa1ce('0x30')][_0xa1ce('0x49')])?null:_0x249605[_0xa1ce('0x30')][_0xa1ce('0x49')];_0x5382fd[_0xa1ce('0x4b')]=_0x249605[_0xa1ce('0x30')][_0xa1ce('0x4b')]||![];_0x5382fd[_0xa1ce('0x4c')]=_0x249605[_0xa1ce('0x41')]['id'];return getContent(_0x249605[_0xa1ce('0x30')])[_0xa1ce('0x4d')](function(_0x54fc6a){_0x5382fd['body']=_0x54fc6a;return getRecipients(_0x2a8878);})[_0xa1ce('0x4d')](function(_0x47dffd){_0x5382fd[_0xa1ce('0x4e')]=_[_0xa1ce('0x4f')](_0x47dffd)[_0xa1ce('0x50')](',');return db[_0xa1ce('0x51')][_0xa1ce('0x52')](function(_0xe60f7f){return db['UserNotification'][_0xa1ce('0x53')](_0x5382fd,{'raw':!![],'transaction':_0xe60f7f})[_0xa1ce('0x4d')](function(_0x37fe04){var _0x1ca542={'sender':_0x5382fd[_0xa1ce('0x47')],'description':_0x5382fd[_0xa1ce('0x49')],'content':_0x5382fd['body'],'beep':_0x5382fd['beep']};_0x47dffd['forEach'](function(_0x4d542a){_0x1ca542[_0xa1ce('0x54')]=_0x4d542a;socket[_0xa1ce('0x55')](_0xa1ce('0x56'),_0x1ca542);});return _0x37fe04;});});})[_0xa1ce('0x4d')](respondWithResult(_0x54a61b,0xc9))[_0xa1ce('0x57')](handleError(_0x54a61b,null));};function getContent(_0x59f133){return new BPromise(function(_0x162288,_0x1886d9){if(_0x59f133[_0xa1ce('0x32')]){_0x162288(_0x59f133[_0xa1ce('0x32')]);return;}return db[_0xa1ce('0x58')][_0xa1ce('0x59')]({'attributes':[_0xa1ce('0x5a')],'where':{'id':_0x59f133['TemplateId']},'raw':!![]})[_0xa1ce('0x4d')](function(_0x5c42af){if(!_0x5c42af)throw new db[(_0xa1ce('0x34'))][(_0xa1ce('0x36'))](_0xa1ce('0x5b'));var _0x1a0eeb=Mustache[_0xa1ce('0x5c')](_0x5c42af[_0xa1ce('0x5a')],_0x59f133[_0xa1ce('0x35')]);_0x162288(_0x1a0eeb);})['catch'](function(_0x233551){_0x1886d9(_0x233551);});});}function getRecipients(_0x5a529d){return new BPromise(function(_0x297ab0,_0x5888d2){var _0xc1439e=[];var _0x23aedb=[];_0x5a529d[_0xa1ce('0x5d')](function(_0x364067){var _0x251cb9=_['startCase'](_0x364067[_0xa1ce('0x44')][_0xa1ce('0x45')]());if(_0x251cb9==='User'){_0xc1439e=_['union'](_0xc1439e,_0x364067[_0xa1ce('0x5e')]);}else{if(_[_0xa1ce('0x43')](_0x251cb9,_0xa1ce('0x5f')))_0x251cb9=_0x251cb9['replace'](_0xa1ce('0x5f'),_0xa1ce('0x60'));_0x364067[_0xa1ce('0x5e')][_0xa1ce('0x5d')](function(_0x14e788){_0x23aedb[_0xa1ce('0x61')](getAgents(_0x251cb9,_0x14e788));});}});return BPromise[_0xa1ce('0x62')](_0x23aedb)['then'](function(_0x2abd3b){_0xc1439e=_[_0xa1ce('0x63')](_0xc1439e,_[_0xa1ce('0x64')](_0x2abd3b));_0x297ab0(_0xc1439e);})[_0xa1ce('0x57')](function(_0x345313){_0x5888d2(_0x345313);});});}function getAgents(_0x4be6df,_0x3486bb){return new BPromise(function(_0x1ecfac,_0x5d4629){return db[_0x4be6df][_0xa1ce('0x59')]({'where':{'id':_0x3486bb}})['then'](function(_0xa697d3){return _0xa697d3['getAgents']({'attributes':['id'],'raw':!![]})[_0xa1ce('0x4d')](function(_0x29f6c){var _0x43be70=_[_0xa1ce('0x65')](_0x29f6c,'id');_0x1ecfac(_0x43be70);});})[_0xa1ce('0x57')](function(_0x1a739f){_0x5d4629(_0x1a739f);});});} \ No newline at end of file +var _0x8fd9=['includes','queue','replace','Queue','flatten','getAgents','map','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','team','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','recipient','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x8fd9,0xc1));var _0x98fd=function(_0x554a48,_0x3b0b29){_0x554a48=_0x554a48-0x0;var _0x4cd1dc=_0x8fd9[_0x554a48];return _0x4cd1dc;};'use strict';var pdf=require(_0x98fd('0x0'));var emlformat=require(_0x98fd('0x1'));var rimraf=require(_0x98fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98fd('0x3'));var moment=require('moment');var BPromise=require(_0x98fd('0x4'));var Mustache=require(_0x98fd('0x5'));var util=require(_0x98fd('0x6'));var path=require('path');var sox=require(_0x98fd('0x7'));var csv=require(_0x98fd('0x8'));var ejs=require(_0x98fd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x98fd('0xa'));var jsforce=require(_0x98fd('0xb'));var deskjs=require(_0x98fd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x98fd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98fd('0xe'));var qs=require(_0x98fd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x98fd('0x10'))(_0x98fd('0x11'));var utils=require(_0x98fd('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x98fd('0x13'));var db=require('../../mysqldb')['db'];config[_0x98fd('0x14')]=_[_0x98fd('0x15')](config[_0x98fd('0x14')],{'host':_0x98fd('0x16'),'port':0x18eb});var socket=require(_0x98fd('0x17'))(new Redis(config[_0x98fd('0x14')]));require('./userNotification.socket')[_0x98fd('0x18')](socket);function respondWithStatusCode(_0x531774,_0x524d07){_0x524d07=_0x524d07||0xcc;return function(_0x1c22e7){if(_0x1c22e7){return _0x531774[_0x98fd('0x19')](_0x524d07);}return _0x531774[_0x98fd('0x1a')](_0x524d07)[_0x98fd('0x1b')]();};}function respondWithResult(_0x26f63b,_0x583bc9){_0x583bc9=_0x583bc9||0xc8;return function(_0x46ab34){if(_0x46ab34){return _0x26f63b[_0x98fd('0x1a')](_0x583bc9)[_0x98fd('0x1c')](_0x46ab34);}};}function respondWithFilteredResult(_0x4ce147,_0x75ce9f){return function(_0x34eb78){if(_0x34eb78){var _0x2c4914=_0x34eb78['count'],_0x3997df=_0x75ce9f['offset'],_0x56231e=_0x75ce9f[_0x98fd('0x1d')]+_0x75ce9f[_0x98fd('0x1e')],_0x4b8582;if(_0x56231e>=_0x2c4914){_0x56231e=_0x2c4914;_0x4b8582=0xc8;}else{_0x4b8582=0xce;}_0x4ce147['status'](_0x4b8582);return _0x4ce147['set'](_0x98fd('0x1f'),_0x3997df+'-'+_0x56231e+'/'+_0x2c4914)[_0x98fd('0x1c')](_0x34eb78);}return null;};}function patchUpdates(_0x433b3a){return function(_0xff0dca){try{jsonpatch['apply'](_0xff0dca,_0x433b3a,!![]);}catch(_0x4e7235){return BPromise[_0x98fd('0x20')](_0x4e7235);}return _0xff0dca[_0x98fd('0x21')]();};}function saveUpdates(_0x1d13cd,_0x1138f4){return function(_0x1c8108){if(_0x1c8108){return _0x1c8108[_0x98fd('0x22')](_0x1d13cd)[_0x98fd('0x23')](function(_0x43526d){return _0x43526d;});}return null;};}function removeEntity(_0x41ccf2,_0x4971b1){return function(_0x2f9f6f){if(_0x2f9f6f){return _0x2f9f6f[_0x98fd('0x24')]()[_0x98fd('0x23')](function(){_0x41ccf2[_0x98fd('0x1a')](0xcc)[_0x98fd('0x1b')]();});}};}function handleEntityNotFound(_0x1a010f,_0x561bda){return function(_0x3d6dd1){if(!_0x3d6dd1){_0x1a010f['sendStatus'](0x194);}return _0x3d6dd1;};}function handleError(_0x327f57,_0x5a9946){_0x5a9946=_0x5a9946||0x1f4;return function(_0x4ab471){logger[_0x98fd('0x25')](_0x4ab471[_0x98fd('0x26')]);if(_0x4ab471[_0x98fd('0x27')]){delete _0x4ab471[_0x98fd('0x27')];}_0x327f57[_0x98fd('0x1a')](_0x5a9946)[_0x98fd('0x28')](_0x4ab471);};}exports[_0x98fd('0x29')]=function(_0x3c0f7b,_0x333377,_0x44a43c){if(!_0x3c0f7b[_0x98fd('0x2a')][_0x98fd('0x2b')](_0x98fd('0x2c'))&&!_0x3c0f7b[_0x98fd('0x2a')]['hasOwnProperty']('TemplateId')){throw new db[(_0x98fd('0x2d'))]['ValidationError'](_0x98fd('0x2e'));}else{if(_0x3c0f7b[_0x98fd('0x2a')][_0x98fd('0x2b')](_0x98fd('0x2f'))&&!_0x3c0f7b['body'][_0x98fd('0x2b')]('view')){throw new db[(_0x98fd('0x2d'))][(_0x98fd('0x30'))](_0x98fd('0x31'));}if(!_0x3c0f7b[_0x98fd('0x2a')][_0x98fd('0x2b')](_0x98fd('0x32'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x8e8df7=JSON[_0x98fd('0x33')](_0x3c0f7b[_0x98fd('0x2a')]['recipients']);}catch(_0x4cbe82){logger[_0x98fd('0x25')](_0x4cbe82);throw new db[(_0x98fd('0x2d'))][(_0x98fd('0x30'))](_0x98fd('0x34'));}var _0x4d94c6=[_0x98fd('0x35'),_0x98fd('0x36'),_0x98fd('0x37'),_0x98fd('0x38'),'smsqueue','voicequeue','whatsappqueue',_0x98fd('0x39'),'user'];if(_['some'](_0x8e8df7,function(_0x3b19c3){return!_['includes'](_0x4d94c6,_0x3b19c3[_0x98fd('0x3a')][_0x98fd('0x3b')]());})){throw new db[(_0x98fd('0x2d'))][(_0x98fd('0x30'))](_0x98fd('0x3c'));}}}var _0xbcd4d4={};_0xbcd4d4[_0x98fd('0x3d')]=_0x3c0f7b['body']['hasOwnProperty'](_0x98fd('0x3d'))?_0x3c0f7b[_0x98fd('0x2a')]['senderName']:_0x3c0f7b[_0x98fd('0x3e')][_0x98fd('0x3f')];_0xbcd4d4['recipientsDescription']=_[_0x98fd('0x40')](_0x3c0f7b[_0x98fd('0x2a')][_0x98fd('0x41')])?null:_0x3c0f7b[_0x98fd('0x2a')]['recipientsDescription'];_0xbcd4d4[_0x98fd('0x42')]=_0x3c0f7b[_0x98fd('0x2a')][_0x98fd('0x42')]||![];_0xbcd4d4[_0x98fd('0x43')]=_0x3c0f7b[_0x98fd('0x3e')]['id'];return getContent(_0x3c0f7b[_0x98fd('0x2a')])[_0x98fd('0x23')](function(_0x1cb43a){_0xbcd4d4[_0x98fd('0x2a')]=_0x1cb43a;return getRecipients(_0x8e8df7);})[_0x98fd('0x23')](function(_0x11a18e){_0xbcd4d4[_0x98fd('0x44')]=_['sortBy'](_0x11a18e)[_0x98fd('0x45')](',');return db[_0x98fd('0x46')][_0x98fd('0x47')](function(_0x54abef){return db['UserNotification'][_0x98fd('0x48')](_0xbcd4d4,{'raw':!![],'transaction':_0x54abef})[_0x98fd('0x23')](function(_0x23e2b2){var _0x38ff81={'sender':_0xbcd4d4[_0x98fd('0x3d')],'description':_0xbcd4d4['recipientsDescription'],'content':_0xbcd4d4['body'],'beep':_0xbcd4d4[_0x98fd('0x42')]};_0x11a18e[_0x98fd('0x49')](function(_0x45a917){_0x38ff81[_0x98fd('0x4a')]=_0x45a917;socket['emit'](_0x98fd('0x4b'),_0x38ff81);});return _0x23e2b2;});});})['then'](respondWithResult(_0x333377,0xc9))[_0x98fd('0x4c')](handleError(_0x333377,null));};function getContent(_0x2b70ec){return new BPromise(function(_0x347928,_0x3c4b0a){if(_0x2b70ec[_0x98fd('0x2c')]){_0x347928(_0x2b70ec[_0x98fd('0x2c')]);return;}return db['Template'][_0x98fd('0x4d')]({'attributes':[_0x98fd('0x4e')],'where':{'id':_0x2b70ec['TemplateId']},'raw':!![]})[_0x98fd('0x23')](function(_0x5f45b1){if(!_0x5f45b1)throw new db[(_0x98fd('0x2d'))][(_0x98fd('0x30'))](_0x98fd('0x4f'));var _0x6a8d76=Mustache[_0x98fd('0x50')](_0x5f45b1['html'],_0x2b70ec[_0x98fd('0x51')]);_0x347928(_0x6a8d76);})['catch'](function(_0x53fe20){_0x3c4b0a(_0x53fe20);});});}function getRecipients(_0x4ac1a3){return new BPromise(function(_0x27ad35,_0x358d2c){var _0x7c4e9a=[];var _0xde0e0=[];_0x4ac1a3['forEach'](function(_0x191d6a){var _0x4a66db=_[_0x98fd('0x52')](_0x191d6a[_0x98fd('0x3a')]['toLowerCase']());if(_0x4a66db===_0x98fd('0x53')){_0x7c4e9a=_[_0x98fd('0x54')](_0x7c4e9a,_0x191d6a[_0x98fd('0x55')]);}else{if(_[_0x98fd('0x56')](_0x4a66db,_0x98fd('0x57')))_0x4a66db=_0x4a66db[_0x98fd('0x58')](_0x98fd('0x57'),_0x98fd('0x59'));_0x191d6a['ids'][_0x98fd('0x49')](function(_0x19023c){_0xde0e0['push'](getAgents(_0x4a66db,_0x19023c));});}});return BPromise['all'](_0xde0e0)[_0x98fd('0x23')](function(_0x23a899){_0x7c4e9a=_[_0x98fd('0x54')](_0x7c4e9a,_[_0x98fd('0x5a')](_0x23a899));_0x27ad35(_0x7c4e9a);})[_0x98fd('0x4c')](function(_0x477925){_0x358d2c(_0x477925);});});}function getAgents(_0x1e6f7e,_0x2a6abb){return new BPromise(function(_0x4bcdb1,_0x107e8b){return db[_0x1e6f7e][_0x98fd('0x4d')]({'where':{'id':_0x2a6abb}})[_0x98fd('0x23')](function(_0x1c8294){return _0x1c8294[_0x98fd('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32db6f){var _0xf5e0a1=_[_0x98fd('0x5c')](_0x32db6f,'id');_0x4bcdb1(_0xf5e0a1);});})['catch'](function(_0x135382){_0x107e8b(_0x135382);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 07f8ca7..152451d 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x119bab,_0x43b1fd){var _0x5641ec=function(_0x3a1f6f){while(--_0x3a1f6f){_0x119bab['push'](_0x119bab['shift']());}};_0x5641ec(++_0x43b1fd);}(_0x008c,0x188));var _0xc008=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0x008c[_0x1fcf1b];return _0x5d2952;};'use strict';var EventEmitter=require(_0xc008('0x0'));var UserNotification=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){UserNotificationEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);UserNotificationEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];UserNotification[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x17ba=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2fb3f2,_0x2ef09d){var _0x931c03=function(_0x499b5c){while(--_0x499b5c){_0x2fb3f2['push'](_0x2fb3f2['shift']());}};_0x931c03(++_0x2ef09d);}(_0x17ba,0xab));var _0xa17b=function(_0x215ac1,_0x15a16b){_0x215ac1=_0x215ac1-0x0;var _0x28ed1e=_0x17ba[_0x215ac1];return _0x28ed1e;};'use strict';var EventEmitter=require(_0xa17b('0x0'));var UserNotification=require(_0xa17b('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa17b('0x2')](0x0);var events={'afterCreate':_0xa17b('0x3'),'afterUpdate':_0xa17b('0x4'),'afterDestroy':_0xa17b('0x5')};function emitEvent(_0x106b5b){return function(_0x38c13c,_0x11d7b7,_0x2f64d0){UserNotificationEvents[_0xa17b('0x6')](_0x106b5b+':'+_0x38c13c['id'],_0x38c13c);UserNotificationEvents[_0xa17b('0x6')](_0x106b5b,_0x38c13c);_0x2f64d0(null);};}for(var e in events){if(events[_0xa17b('0x7')](e)){var event=events[e];UserNotification[_0xa17b('0x8')](e,emitEvent(event));}}module[_0xa17b('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f30b1f0..99c7a91 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 _0x13f6=['rimraf','../../config/environment','./userNotification.attributes','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise'];(function(_0x3c119d,_0x3a9657){var _0x40581d=function(_0x250459){while(--_0x250459){_0x3c119d['push'](_0x3c119d['shift']());}};_0x40581d(++_0x3a9657);}(_0x13f6,0x124));var _0x613f=function(_0x489037,_0x33b120){_0x489037=_0x489037-0x0;var _0x380d49=_0x13f6[_0x489037];return _0x380d49;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x613f('0x2'));var BPromise=require(_0x613f('0x3'));var rp=require(_0x613f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var attributes=require(_0x613f('0x7'));module['exports']=function(_0x3f3525,_0x2367b3){return _0x3f3525['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x613f('0x8')});}; \ No newline at end of file +var _0xc343=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xc343,0x173));var _0x3c34=function(_0x5be13f,_0x47901a){_0x5be13f=_0x5be13f-0x0;var _0x2ab65c=_0xc343[_0x5be13f];return _0x2ab65c;};'use strict';var _=require(_0x3c34('0x0'));var util=require('util');var logger=require(_0x3c34('0x1'))(_0x3c34('0x2'));var moment=require(_0x3c34('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c34('0x4'));var rimraf=require(_0x3c34('0x5'));var config=require(_0x3c34('0x6'));var attributes=require(_0x3c34('0x7'));module[_0x3c34('0x8')]=function(_0x37ddf8,_0x401457){return _0x37ddf8[_0x3c34('0x9')](_0x3c34('0xa'),attributes,{'tableName':_0x3c34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c34('0xc'),'collate':_0x3c34('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7f27b31..5baf9b3 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 _0x8023=['http','redis','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x1d4f38,_0x359839){var _0x51681c=function(_0x19a700){while(--_0x19a700){_0x1d4f38['push'](_0x1d4f38['shift']());}};_0x51681c(++_0x359839);}(_0x8023,0x172));var _0x3802=function(_0x2a61c0,_0x31400d){_0x2a61c0=_0x2a61c0-0x0;var _0x142f3e=_0x8023[_0x2a61c0];return _0x142f3e;};'use strict';var _=require(_0x3802('0x0'));var util=require(_0x3802('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3802('0x2'));var fs=require('fs');var Redis=require(_0x3802('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3802('0x4'));var logger=require('../../config/logger')(_0x3802('0x5'));var config=require('../../config/environment');var jayson=require(_0x3802('0x6'));var client=jayson[_0x3802('0x7')][_0x3802('0x8')]({'port':0x232a});config[_0x3802('0x9')]=_['defaults'](config[_0x3802('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3802('0xa'))(new Redis(config[_0x3802('0x9')]));require(_0x3802('0xb'))[_0x3802('0xc')](socket);function respondWithRpcPromise(_0x24cb82,_0x29acc3,_0x524180){return new BPromise(function(_0xbf7e7d,_0x4960b8){return client['request'](_0x24cb82,_0x524180)[_0x3802('0xd')](function(_0x28c555){logger[_0x3802('0xe')](_0x3802('0xf'),_0x29acc3,'request\x20sent');logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x29acc3,_0x3802('0x10'),JSON['stringify'](_0x28c555));if(_0x28c555[_0x3802('0x11')]){if(_0x28c555[_0x3802('0x11')][_0x3802('0x12')]===0x1f4){logger['error'](_0x3802('0xf'),_0x29acc3,_0x28c555[_0x3802('0x11')][_0x3802('0x13')]);return _0x4960b8(_0x28c555[_0x3802('0x11')][_0x3802('0x13')]);}logger['error'](_0x3802('0xf'),_0x29acc3,_0x28c555['error'][_0x3802('0x13')]);return _0xbf7e7d(_0x28c555[_0x3802('0x11')][_0x3802('0x13')]);}else{logger[_0x3802('0xe')]('UserNotification,\x20%s,\x20%s',_0x29acc3,'request\x20sent');_0xbf7e7d(_0x28c555['result']['message']);}})[_0x3802('0x14')](function(_0x2feb97){logger[_0x3802('0x11')](_0x3802('0xf'),_0x29acc3,_0x2feb97);_0x4960b8(_0x2feb97);});});} \ No newline at end of file +var _0x60f3=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x60f3,0xf5));var _0x360f=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0x60f3[_0x1265fa];return _0x1fe35e;};'use strict';var _=require(_0x360f('0x0'));var util=require(_0x360f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x360f('0x2'));var fs=require('fs');var Redis=require(_0x360f('0x3'));var db=require(_0x360f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x360f('0x5'))('rpc');var config=require(_0x360f('0x6'));var jayson=require(_0x360f('0x7'));var client=jayson[_0x360f('0x8')][_0x360f('0x9')]({'port':0x232a});config[_0x360f('0xa')]=_['defaults'](config[_0x360f('0xa')],{'host':_0x360f('0xb'),'port':0x18eb});var socket=require(_0x360f('0xc'))(new Redis(config['redis']));require(_0x360f('0xd'))[_0x360f('0xe')](socket);function respondWithRpcPromise(_0x18b105,_0x528cb8,_0x2d1c84){return new BPromise(function(_0x4b58f9,_0xd5f6b1){return client[_0x360f('0xf')](_0x18b105,_0x2d1c84)[_0x360f('0x10')](function(_0x584fc9){logger[_0x360f('0x11')](_0x360f('0x12'),_0x528cb8,_0x360f('0x13'));logger['debug'](_0x360f('0x14'),_0x528cb8,_0x360f('0x13'),JSON['stringify'](_0x584fc9));if(_0x584fc9['error']){if(_0x584fc9[_0x360f('0x15')]['code']===0x1f4){logger['error'](_0x360f('0x12'),_0x528cb8,_0x584fc9[_0x360f('0x15')][_0x360f('0x16')]);return _0xd5f6b1(_0x584fc9[_0x360f('0x15')][_0x360f('0x16')]);}logger[_0x360f('0x15')](_0x360f('0x12'),_0x528cb8,_0x584fc9['error']['message']);return _0x4b58f9(_0x584fc9[_0x360f('0x15')][_0x360f('0x16')]);}else{logger[_0x360f('0x11')](_0x360f('0x12'),_0x528cb8,_0x360f('0x13'));_0x4b58f9(_0x584fc9[_0x360f('0x17')]['message']);}})[_0x360f('0x18')](function(_0x198167){logger[_0x360f('0x15')]('UserNotification,\x20%s,\x20%s',_0x528cb8,_0x198167);_0xd5f6b1(_0x198167);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0f2fdac..d979a55 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 _0x1db9=['remove','update','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x38e0ea,_0x102ab5){var _0x5c184d=function(_0x5fd006){while(--_0x5fd006){_0x38e0ea['push'](_0x38e0ea['shift']());}};_0x5c184d(++_0x102ab5);}(_0x1db9,0x176));var _0x91db=function(_0x4f5569,_0x7a7957){_0x4f5569=_0x4f5569-0x0;var _0x506dc0=_0x1db9[_0x4f5569];return _0x506dc0;};'use strict';var UserNotificationEvents=require(_0x91db('0x0'));var events=[_0x91db('0x1'),_0x91db('0x2'),_0x91db('0x3')];function createListener(_0xcdfaed,_0xb6de0b){return function(_0x49b8c5){_0xb6de0b[_0x91db('0x4')](_0xcdfaed,_0x49b8c5);};}function removeListener(_0x42ae75,_0x59c944){return function(){UserNotificationEvents['removeListener'](_0x42ae75,_0x59c944);};}exports[_0x91db('0x5')]=function(_0x4b3f5c){for(var _0x5e69d9=0x0,_0x433c75=events[_0x91db('0x6')];_0x5e69d9<_0x433c75;_0x5e69d9++){var _0x45fea0=events[_0x5e69d9];var _0x2330c2=createListener(_0x91db('0x7')+_0x45fea0,_0x4b3f5c);UserNotificationEvents['on'](_0x45fea0,_0x2330c2);}}; \ No newline at end of file +var _0x1134=['save','update','emit','register','length','userNotification:','./userNotification.events'];(function(_0x399719,_0x232b0f){var _0x1bd3e9=function(_0x2fad56){while(--_0x2fad56){_0x399719['push'](_0x399719['shift']());}};_0x1bd3e9(++_0x232b0f);}(_0x1134,0x19c));var _0x4113=function(_0x46be51,_0x2545aa){_0x46be51=_0x46be51-0x0;var _0x4c2ec1=_0x1134[_0x46be51];return _0x4c2ec1;};'use strict';var UserNotificationEvents=require(_0x4113('0x0'));var events=[_0x4113('0x1'),'remove',_0x4113('0x2')];function createListener(_0x2dc4fb,_0x498230){return function(_0x26ce2e){_0x498230[_0x4113('0x3')](_0x2dc4fb,_0x26ce2e);};}function removeListener(_0x4acb7a,_0x3f7a19){return function(){UserNotificationEvents['removeListener'](_0x4acb7a,_0x3f7a19);};}exports[_0x4113('0x4')]=function(_0x499091){for(var _0x39ca01=0x0,_0x493b42=events[_0x4113('0x5')];_0x39ca01<_0x493b42;_0x39ca01++){var _0x28520f=events[_0x39ca01];var _0x3b6cc4=createListener(_0x4113('0x6')+_0x28520f,_0x499091);UserNotificationEvents['on'](_0x28520f,_0x3b6cc4);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cb622b7..2f50202 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 _0xe1f7=['util','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x5acfd1,_0x1ba303){var _0x4ca751=function(_0x2430c1){while(--_0x2430c1){_0x5acfd1['push'](_0x5acfd1['shift']());}};_0x4ca751(++_0x1ba303);}(_0xe1f7,0x103));var _0x7e1f=function(_0x2e986d,_0x4b6b63){_0x2e986d=_0x2e986d-0x0;var _0x351c79=_0xe1f7[_0x2e986d];return _0x351c79;};'use strict';var multer=require(_0x7e1f('0x0'));var util=require(_0x7e1f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7e1f('0x2'));var config=require(_0x7e1f('0x3'));module[_0x7e1f('0x4')]=router; \ No newline at end of file +var _0x7fdf=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f2e8c,_0x18992c){var _0xcf2ca8=function(_0xda53dd){while(--_0xda53dd){_0x1f2e8c['push'](_0x1f2e8c['shift']());}};_0xcf2ca8(++_0x18992c);}(_0x7fdf,0x13c));var _0xf7fd=function(_0x431979,_0x2b3eb6){_0x431979=_0x431979-0x0;var _0x731032=_0x7fdf[_0x431979];return _0x731032;};'use strict';var multer=require(_0xf7fd('0x0'));var util=require(_0xf7fd('0x1'));var path=require('path');var timeout=require(_0xf7fd('0x2'));var express=require(_0xf7fd('0x3'));var router=express[_0xf7fd('0x4')]();var auth=require(_0xf7fd('0x5'));var interaction=require(_0xf7fd('0x6'));var config=require(_0xf7fd('0x7'));module[_0xf7fd('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 6712108..640b5cc 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 _0xd8b0=['exports','sequelize'];(function(_0x182094,_0x269200){var _0x2e74ff=function(_0x41b982){while(--_0x41b982){_0x182094['push'](_0x182094['shift']());}};_0x2e74ff(++_0x269200);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_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 8bb553b..e1b8d65 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 _0x372e=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x372e,0x89));var _0xe372=function(_0x21c63d,_0x15c447){_0x21c63d=_0x21c63d-0x0;var _0x1a514e=_0x372e[_0x21c63d];return _0x1a514e;};'use strict';var _=require(_0xe372('0x0'));var util=require(_0xe372('0x1'));var logger=require(_0xe372('0x2'))(_0xe372('0x3'));var moment=require(_0xe372('0x4'));var BPromise=require(_0xe372('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe372('0x6'));var rimraf=require('rimraf');var config=require(_0xe372('0x7'));var attributes=require(_0xe372('0x8'));module[_0xe372('0x9')]=function(_0x23c512,_0x500fc6){return _0x23c512[_0xe372('0xa')](_0xe372('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x443d=['../../config/environment','exports','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x443d,0x1dc));var _0xd443=function(_0x252bcd,_0xcb2e36){_0x252bcd=_0x252bcd-0x0;var _0xc71aac=_0x443d[_0x252bcd];return _0xc71aac;};'use strict';var _=require(_0xd443('0x0'));var util=require(_0xd443('0x1'));var logger=require(_0xd443('0x2'))(_0xd443('0x3'));var moment=require(_0xd443('0x4'));var BPromise=require(_0xd443('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd443('0x6'));var rimraf=require(_0xd443('0x7'));var config=require(_0xd443('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xd443('0x9')]=function(_0xd7fc0c,_0x4965ab){return _0xd7fc0c['define']('UserOpenchannelQueue',attributes,{'tableName':_0xd443('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 7fa81aa..4591bd7 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 _0xe3cb=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xaf6452,_0x1a6158){var _0x283b81=function(_0x425ca7){while(--_0x425ca7){_0xaf6452['push'](_0xaf6452['shift']());}};_0x283b81(++_0x1a6158);}(_0xe3cb,0xaf));var _0xbe3c=function(_0x5947f8,_0x340b0a){_0x5947f8=_0x5947f8-0x0;var _0x59522c=_0xe3cb[_0x5947f8];return _0x59522c;};'use strict';var _=require(_0xbe3c('0x0'));var util=require(_0xbe3c('0x1'));var moment=require(_0xbe3c('0x2'));var BPromise=require(_0xbe3c('0x3'));var rs=require(_0xbe3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe3c('0x5'))['db'];var utils=require(_0xbe3c('0x6'));var logger=require(_0xbe3c('0x7'))(_0xbe3c('0x8'));var config=require(_0xbe3c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe3c('0xa')][_0xbe3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e4db5,_0x14acb0,_0x4036b8){return new BPromise(function(_0x4800c3,_0xcd4c85){return client[_0xbe3c('0xc')](_0x4e4db5,_0x4036b8)[_0xbe3c('0xd')](function(_0x4d2555){logger[_0xbe3c('0xe')](_0xbe3c('0xf'),_0x14acb0,_0xbe3c('0x10'));logger[_0xbe3c('0x11')](_0xbe3c('0x12'),_0x14acb0,_0xbe3c('0x10'),JSON[_0xbe3c('0x13')](_0x4d2555));if(_0x4d2555[_0xbe3c('0x14')]){if(_0x4d2555['error'][_0xbe3c('0x15')]===0x1f4){logger[_0xbe3c('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x14acb0,_0x4d2555['error'][_0xbe3c('0x16')]);return _0xcd4c85(_0x4d2555[_0xbe3c('0x14')][_0xbe3c('0x16')]);}logger[_0xbe3c('0x14')](_0xbe3c('0xf'),_0x14acb0,_0x4d2555['error'][_0xbe3c('0x16')]);return _0x4800c3(_0x4d2555[_0xbe3c('0x14')][_0xbe3c('0x16')]);}else{logger[_0xbe3c('0xe')](_0xbe3c('0xf'),_0x14acb0,_0xbe3c('0x10'));_0x4800c3(_0x4d2555['result'][_0xbe3c('0x16')]);}})[_0xbe3c('0x17')](function(_0x50d9c2){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x14acb0,_0x50d9c2);_0xcd4c85(_0x50d9c2);});});} \ No newline at end of file +var _0x1234=['client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x187f88,_0x3a9177){var _0x26c9dd=function(_0x21ba83){while(--_0x21ba83){_0x187f88['push'](_0x187f88['shift']());}};_0x26c9dd(++_0x3a9177);}(_0x1234,0xfd));var _0x4123=function(_0x130eb0,_0x2bf026){_0x130eb0=_0x130eb0-0x0;var _0x217d99=_0x1234[_0x130eb0];return _0x217d99;};'use strict';var _=require(_0x4123('0x0'));var util=require('util');var moment=require(_0x4123('0x1'));var BPromise=require(_0x4123('0x2'));var rs=require(_0x4123('0x3'));var fs=require('fs');var Redis=require(_0x4123('0x4'));var db=require(_0x4123('0x5'))['db'];var utils=require(_0x4123('0x6'));var logger=require(_0x4123('0x7'))(_0x4123('0x8'));var config=require(_0x4123('0x9'));var jayson=require(_0x4123('0xa'));var client=jayson[_0x4123('0xb')][_0x4123('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12fce3,_0x35209e,_0x2e5525){return new BPromise(function(_0x39ee52,_0x322c65){return client['request'](_0x12fce3,_0x2e5525)[_0x4123('0xd')](function(_0x18668e){logger[_0x4123('0xe')](_0x4123('0xf'),_0x35209e,_0x4123('0x10'));logger['debug'](_0x4123('0x11'),_0x35209e,_0x4123('0x10'),JSON[_0x4123('0x12')](_0x18668e));if(_0x18668e[_0x4123('0x13')]){if(_0x18668e[_0x4123('0x13')][_0x4123('0x14')]===0x1f4){logger[_0x4123('0x13')](_0x4123('0xf'),_0x35209e,_0x18668e['error'][_0x4123('0x15')]);return _0x322c65(_0x18668e['error'][_0x4123('0x15')]);}logger[_0x4123('0x13')](_0x4123('0xf'),_0x35209e,_0x18668e[_0x4123('0x13')][_0x4123('0x15')]);return _0x39ee52(_0x18668e[_0x4123('0x13')][_0x4123('0x15')]);}else{logger[_0x4123('0xe')](_0x4123('0xf'),_0x35209e,'request\x20sent');_0x39ee52(_0x18668e[_0x4123('0x16')]['message']);}})[_0x4123('0x17')](function(_0x210195){logger[_0x4123('0x13')](_0x4123('0xf'),_0x35209e,_0x210195);_0x322c65(_0x210195);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ce72447..22ae54c 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 _0x3233=['clone','/:id/sections','addSections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','describe','getSections','/:id/resources','post','create','/:id/clone'];(function(_0x2f818d,_0xe49496){var _0x4105d5=function(_0x1fa463){while(--_0x1fa463){_0x2f818d['push'](_0x2f818d['shift']());}};_0x4105d5(++_0xe49496);}(_0x3233,0x15d));var _0x3323=function(_0x11f3f8,_0x41def2){_0x11f3f8=_0x11f3f8-0x0;var _0x2b5086=_0x3233[_0x11f3f8];return _0x2b5086;};'use strict';var multer=require(_0x3323('0x0'));var util=require(_0x3323('0x1'));var path=require(_0x3323('0x2'));var timeout=require(_0x3323('0x3'));var express=require(_0x3323('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3323('0x5'));var controller=require('./userProfile.controller');router[_0x3323('0x6')]('/',auth[_0x3323('0x7')](),controller[_0x3323('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3323('0x9')]);router[_0x3323('0x6')]('/:id',auth[_0x3323('0x7')](),controller['show']);router[_0x3323('0x6')]('/:id/sections',auth[_0x3323('0x7')](),controller[_0x3323('0xa')]);router[_0x3323('0x6')](_0x3323('0xb'),auth[_0x3323('0x7')](),controller['getResources']);router[_0x3323('0xc')]('/',auth[_0x3323('0x7')](),controller[_0x3323('0xd')]);router[_0x3323('0xc')](_0x3323('0xe'),auth[_0x3323('0x7')](),controller[_0x3323('0xf')]);router[_0x3323('0xc')](_0x3323('0x10'),auth[_0x3323('0x7')](),controller[_0x3323('0x11')]);router['post']('/:id/resources',auth[_0x3323('0x7')](),controller[_0x3323('0x12')]);router[_0x3323('0x13')](_0x3323('0x14'),auth[_0x3323('0x7')](),controller[_0x3323('0x15')]);router[_0x3323('0x16')](_0x3323('0x14'),auth[_0x3323('0x7')](),controller[_0x3323('0x17')]);router[_0x3323('0x16')](_0x3323('0x10'),auth['isAuthenticated'](),controller[_0x3323('0x18')]);router['delete'](_0x3323('0xb'),auth[_0x3323('0x7')](),controller[_0x3323('0x19')]);module['exports']=router; \ No newline at end of file +var _0x541a=['delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','Router','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x541a,0x1d5));var _0xa541=function(_0xf5f512,_0x131ec0){_0xf5f512=_0xf5f512-0x0;var _0x1940c9=_0x541a[_0xf5f512];return _0x1940c9;};'use strict';var multer=require(_0xa541('0x0'));var util=require(_0xa541('0x1'));var path=require('path');var timeout=require(_0xa541('0x2'));var express=require('express');var router=express[_0xa541('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa541('0x4'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xa541('0x5')](),controller[_0xa541('0x6')]);router[_0xa541('0x7')](_0xa541('0x8'),auth[_0xa541('0x5')](),controller[_0xa541('0x9')]);router['get'](_0xa541('0xa'),auth[_0xa541('0x5')](),controller[_0xa541('0xb')]);router[_0xa541('0x7')](_0xa541('0xc'),auth[_0xa541('0x5')](),controller[_0xa541('0xd')]);router['get'](_0xa541('0xe'),auth[_0xa541('0x5')](),controller[_0xa541('0xf')]);router[_0xa541('0x10')]('/',auth[_0xa541('0x5')](),controller[_0xa541('0x11')]);router[_0xa541('0x10')](_0xa541('0x12'),auth['isAuthenticated'](),controller[_0xa541('0x13')]);router[_0xa541('0x10')](_0xa541('0xc'),auth['isAuthenticated'](),controller[_0xa541('0x14')]);router['post'](_0xa541('0xe'),auth[_0xa541('0x5')](),controller[_0xa541('0x15')]);router[_0xa541('0x16')](_0xa541('0xa'),auth[_0xa541('0x5')](),controller[_0xa541('0x17')]);router[_0xa541('0x18')](_0xa541('0xa'),auth[_0xa541('0x5')](),controller[_0xa541('0x19')]);router[_0xa541('0x18')](_0xa541('0xc'),auth['isAuthenticated'](),controller[_0xa541('0x1a')]);router[_0xa541('0x18')]('/:id/resources',auth['isAuthenticated'](),controller[_0xa541('0x1b')]);module[_0xa541('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b437d46..8f54697 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 _0x61d0=['STRING','name','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x375095,_0x4ad7fe){var _0x148a8d=function(_0x5c11cc){while(--_0x5c11cc){_0x375095['push'](_0x375095['shift']());}};_0x148a8d(++_0x4ad7fe);}(_0x61d0,0x187));var _0x061d=function(_0x34f7bb,_0x547eb3){_0x34f7bb=_0x34f7bb-0x0;var _0x2efee3=_0x61d0[_0x34f7bb];return _0x2efee3;};'use strict';var Sequelize=require(_0x061d('0x0'));module['exports']={'name':{'type':Sequelize[_0x061d('0x1')],'allowNull':![],'unique':_0x061d('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x15bbda){this['setDataValue'](_0x061d('0x3'),_0x15bbda?_0x15bbda[_0x061d('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x061d('0x3'))?this[_0x061d('0x5')](_0x061d('0x3'))[_0x061d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x061d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x42d5=['getDataValue','sequelize','exports','STRING','name','setDataValue','crudPermissions','join'];(function(_0x56f219,_0x30e29f){var _0x3ee411=function(_0x3b51d9){while(--_0x3b51d9){_0x56f219['push'](_0x56f219['shift']());}};_0x3ee411(++_0x30e29f);}(_0x42d5,0xc9));var _0x542d=function(_0x12b3fd,_0xc4c49a){_0x12b3fd=_0x12b3fd-0x0;var _0x60174e=_0x42d5[_0x12b3fd];return _0x60174e;};'use strict';var Sequelize=require(_0x542d('0x0'));module[_0x542d('0x1')]={'name':{'type':Sequelize[_0x542d('0x2')],'allowNull':![],'unique':_0x542d('0x3')},'crudPermissions':{'type':Sequelize[_0x542d('0x2')],'set':function(_0x2fc413){this[_0x542d('0x4')](_0x542d('0x5'),_0x2fc413?_0x2fc413[_0x542d('0x6')](''):[]);},'get':function(){return this[_0x542d('0x7')](_0x542d('0x5'))?this[_0x542d('0x7')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x542d('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2530f18..ac679d4 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 _0x29a3=['JscriptyProject','contacts','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','users','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Trigger','trunks','Variable','plugins','Reports','metrics','AnalyticMetric','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','count','offset','set','Content-Range','save','update','then','sendStatus','stack','name','send','index','map','UserProfile','rawAttributes','model','query','keys','intersection','attributes','fields','limit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','catch','show','params','length','include','create','body','find','get','omit','createdAt','updatedAt','transaction','UserProfileSection','each','UserProfileResource','findAll','sectionId','userProfileId','Resources','destroy','addSections','sequelize','removeSections','ids','getSections','enabled','includes','subsections','push','autoAssociation','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','isEmpty','union','hasOwnProperty','nolimit','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','projectName','projects'];(function(_0x5bdb83,_0x3605de){var _0x1986bb=function(_0x2d6e94){while(--_0x2d6e94){_0x5bdb83['push'](_0x5bdb83['shift']());}};_0x1986bb(++_0x3605de);}(_0x29a3,0x141));var _0x329a=function(_0x3753cb,_0x514352){_0x3753cb=_0x3753cb-0x0;var _0x12297c=_0x29a3[_0x3753cb];return _0x12297c;};'use strict';var pdf=require(_0x329a('0x0'));var emlformat=require(_0x329a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x329a('0x2'));var jsonpatch=require(_0x329a('0x3'));var rp=require(_0x329a('0x4'));var moment=require('moment');var BPromise=require(_0x329a('0x5'));var Mustache=require(_0x329a('0x6'));var util=require(_0x329a('0x7'));var path=require(_0x329a('0x8'));var sox=require(_0x329a('0x9'));var csv=require(_0x329a('0xa'));var ejs=require(_0x329a('0xb'));var fs=require('fs');var _=require(_0x329a('0xc'));var squel=require(_0x329a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x329a('0xe'));var toCsv=require(_0x329a('0xa'));var querystring=require(_0x329a('0xf'));var Papa=require(_0x329a('0x10'));var Redis=require(_0x329a('0x11'));var authService=require(_0x329a('0x12'));var qs=require(_0x329a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x329a('0x14'));var logger=require(_0x329a('0x15'))(_0x329a('0x16'));var utils=require(_0x329a('0x17'));var config=require(_0x329a('0x18'));var licenseUtil=require(_0x329a('0x19'));var db=require(_0x329a('0x1a'))['db'];config[_0x329a('0x1b')]=_[_0x329a('0x1c')](config[_0x329a('0x1b')],{'host':_0x329a('0x1d'),'port':0x18eb});var socket=require(_0x329a('0x1e'))(new Redis(config[_0x329a('0x1b')]));require(_0x329a('0x1f'))[_0x329a('0x20')](socket);function respondWithStatusCode(_0x19971b,_0x59540d){_0x59540d=_0x59540d||0xcc;return function(_0x5b530c){if(_0x5b530c){return _0x19971b['sendStatus'](_0x59540d);}return _0x19971b[_0x329a('0x21')](_0x59540d)[_0x329a('0x22')]();};}function respondWithResult(_0x342e0c,_0x29a07d){_0x29a07d=_0x29a07d||0xc8;return function(_0x5686e5){if(_0x5686e5){return _0x342e0c[_0x329a('0x21')](_0x29a07d)[_0x329a('0x23')](_0x5686e5);}};}function respondWithFilteredResult(_0x3d238d,_0x42b7c1){return function(_0x285545){if(_0x285545){var _0x1e717a=_0x285545[_0x329a('0x24')],_0x2a9be2=_0x42b7c1[_0x329a('0x25')],_0x30bd89=_0x42b7c1['offset']+_0x42b7c1['limit'],_0x51e278;if(_0x30bd89>=_0x1e717a){_0x30bd89=_0x1e717a;_0x51e278=0xc8;}else{_0x51e278=0xce;}_0x3d238d['status'](_0x51e278);return _0x3d238d[_0x329a('0x26')](_0x329a('0x27'),_0x2a9be2+'-'+_0x30bd89+'/'+_0x1e717a)['json'](_0x285545);}return null;};}function patchUpdates(_0x50fcfd){return function(_0x17dcd1){try{jsonpatch['apply'](_0x17dcd1,_0x50fcfd,!![]);}catch(_0x2cd343){return BPromise['reject'](_0x2cd343);}return _0x17dcd1[_0x329a('0x28')]();};}function saveUpdates(_0x34bb02,_0x1fa051){return function(_0x168004){if(_0x168004){return _0x168004[_0x329a('0x29')](_0x34bb02)[_0x329a('0x2a')](function(_0x426fe3){return _0x426fe3;});}return null;};}function removeEntity(_0x19025b,_0x1cd155){return function(_0x1d301d){if(_0x1d301d){return _0x1d301d['destroy']()['then'](function(){_0x19025b[_0x329a('0x21')](0xcc)[_0x329a('0x22')]();});}};}function handleEntityNotFound(_0x46c32e,_0x5ed239){return function(_0x2a63c2){if(!_0x2a63c2){_0x46c32e[_0x329a('0x2b')](0x194);}return _0x2a63c2;};}function handleError(_0x1cda47,_0x3a4f73){_0x3a4f73=_0x3a4f73||0x1f4;return function(_0x4cbeab){logger['error'](_0x4cbeab[_0x329a('0x2c')]);if(_0x4cbeab[_0x329a('0x2d')]){delete _0x4cbeab[_0x329a('0x2d')];}_0x1cda47['status'](_0x3a4f73)[_0x329a('0x2e')](_0x4cbeab);};}exports[_0x329a('0x2f')]=function(_0x26373b,_0x4108a3){var _0x3953d2={},_0x51717a={},_0x16bc91={'count':0x0,'rows':[]};var _0x372149=_[_0x329a('0x30')](db[_0x329a('0x31')][_0x329a('0x32')],function(_0x1986ec){return{'name':_0x1986ec['fieldName'],'type':_0x1986ec['type']['key']};});_0x51717a[_0x329a('0x33')]=_[_0x329a('0x30')](_0x372149,_0x329a('0x2d'));_0x51717a[_0x329a('0x34')]=_[_0x329a('0x35')](_0x26373b['query']);_0x51717a['filters']=_[_0x329a('0x36')](_0x51717a[_0x329a('0x33')],_0x51717a[_0x329a('0x34')]);_0x3953d2[_0x329a('0x37')]=_[_0x329a('0x36')](_0x51717a[_0x329a('0x33')],qs[_0x329a('0x38')](_0x26373b[_0x329a('0x34')][_0x329a('0x38')]));_0x3953d2['attributes']=_0x3953d2[_0x329a('0x37')]['length']?_0x3953d2[_0x329a('0x37')]:_0x51717a[_0x329a('0x33')];if(!_0x26373b[_0x329a('0x34')]['hasOwnProperty']('nolimit')){_0x3953d2[_0x329a('0x39')]=qs[_0x329a('0x39')](_0x26373b[_0x329a('0x34')][_0x329a('0x39')]);_0x3953d2[_0x329a('0x25')]=qs[_0x329a('0x25')](_0x26373b[_0x329a('0x34')][_0x329a('0x25')]);}_0x3953d2[_0x329a('0x3a')]=qs[_0x329a('0x3b')](_0x26373b[_0x329a('0x34')][_0x329a('0x3b')]);_0x3953d2[_0x329a('0x3c')]=qs['filters'](_[_0x329a('0x3d')](_0x26373b[_0x329a('0x34')],_0x51717a[_0x329a('0x3e')]),_0x372149);if(_0x26373b[_0x329a('0x34')]['filter']){_0x3953d2['where']=_[_0x329a('0x3f')](_0x3953d2[_0x329a('0x3c')],{'$or':_[_0x329a('0x30')](_0x372149,function(_0x59f04f){if(_0x59f04f[_0x329a('0x40')]!==_0x329a('0x41')){var _0x45d659={};_0x45d659[_0x59f04f['name']]={'$like':'%'+_0x26373b[_0x329a('0x34')][_0x329a('0x42')]+'%'};return _0x45d659;}})});}_0x3953d2=_[_0x329a('0x3f')]({},_0x3953d2,_0x26373b[_0x329a('0x43')]);var _0x5d17c7={'where':_0x3953d2[_0x329a('0x3c')]};return db[_0x329a('0x31')][_0x329a('0x24')](_0x5d17c7)[_0x329a('0x2a')](function(_0x5bb6e0){_0x16bc91[_0x329a('0x24')]=_0x5bb6e0;if(_0x26373b[_0x329a('0x34')][_0x329a('0x44')]){_0x3953d2['include']=[{'all':!![]}];}return db[_0x329a('0x31')]['findAll'](_0x3953d2);})[_0x329a('0x2a')](function(_0x3f17bf){_0x16bc91['rows']=_0x3f17bf;return _0x16bc91;})[_0x329a('0x2a')](respondWithFilteredResult(_0x4108a3,_0x3953d2))[_0x329a('0x45')](handleError(_0x4108a3,null));};exports[_0x329a('0x46')]=function(_0x12bef6,_0x2430b2){var _0x4e06bf={'raw':![],'where':{'id':_0x12bef6[_0x329a('0x47')]['id']}},_0x4946d0={};_0x4946d0['model']=_['keys'](db[_0x329a('0x31')][_0x329a('0x32')]);_0x4946d0[_0x329a('0x34')]=_[_0x329a('0x35')](_0x12bef6['query']);_0x4946d0[_0x329a('0x3e')]=_[_0x329a('0x36')](_0x4946d0[_0x329a('0x33')],_0x4946d0[_0x329a('0x34')]);_0x4e06bf[_0x329a('0x37')]=_[_0x329a('0x36')](_0x4946d0[_0x329a('0x33')],qs[_0x329a('0x38')](_0x12bef6[_0x329a('0x34')]['fields']));_0x4e06bf[_0x329a('0x37')]=_0x4e06bf['attributes'][_0x329a('0x48')]?_0x4e06bf[_0x329a('0x37')]:_0x4946d0[_0x329a('0x33')];if(_0x12bef6[_0x329a('0x34')][_0x329a('0x44')]){_0x4e06bf[_0x329a('0x49')]=[{'all':!![]}];}_0x4e06bf=_[_0x329a('0x3f')]({},_0x4e06bf,_0x12bef6['options']);return db[_0x329a('0x31')]['find'](_0x4e06bf)['then'](handleEntityNotFound(_0x2430b2,null))[_0x329a('0x2a')](respondWithResult(_0x2430b2,null))['catch'](handleError(_0x2430b2,null));};exports[_0x329a('0x4a')]=function(_0xc4535,_0x8e7b4f){return db[_0x329a('0x31')]['create'](_0xc4535[_0x329a('0x4b')],{})[_0x329a('0x2a')](respondWithResult(_0x8e7b4f,0xc9))[_0x329a('0x45')](handleError(_0x8e7b4f,null));};exports['clone']=function(_0x5f027b,_0x138273){var _0x4c149f={'where':{'id':_0x5f027b['params']['id']}},_0x3b59a3={};_0x3b59a3[_0x329a('0x33')]=_[_0x329a('0x35')](db[_0x329a('0x31')][_0x329a('0x32')]);_0x4c149f[_0x329a('0x37')]=_[_0x329a('0x36')](_0x3b59a3[_0x329a('0x33')],qs[_0x329a('0x38')](_0x5f027b[_0x329a('0x34')][_0x329a('0x38')]));_0x4c149f[_0x329a('0x37')]=_0x4c149f[_0x329a('0x37')][_0x329a('0x48')]?_0x4c149f[_0x329a('0x37')]:_0x3b59a3['model'];if(_0x5f027b[_0x329a('0x34')][_0x329a('0x44')]){_0x4c149f[_0x329a('0x49')]=[{'all':!![]}];}_0x4c149f=_[_0x329a('0x3f')]({},_0x4c149f,_0x5f027b[_0x329a('0x43')]);return db[_0x329a('0x31')][_0x329a('0x4c')](_0x4c149f)[_0x329a('0x2a')](handleEntityNotFound(_0x138273,null))[_0x329a('0x2a')](function(_0x575062){if(_0x575062){var _0x47e94e=_0x575062[_0x329a('0x4d')]({'plain':!![]});_0x47e94e=qs[_0x329a('0x4e')](_0x47e94e,['id',_0x329a('0x4f'),_0x329a('0x50'),'crudPermissions']);_0x5f027b[_0x329a('0x4b')]=_[_0x329a('0x4e')](_0x5f027b['body'],['id',_0x329a('0x4f'),'updatedAt']);return db['sequelize'][_0x329a('0x51')](function(_0x4d0ddb){return db['UserProfile'][_0x329a('0x4a')](_[_0x329a('0x3f')](_0x47e94e,_0x5f027b[_0x329a('0x4b')]),{'include':_0x5f027b['query'][_0x329a('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x4d0ddb})[_0x329a('0x2a')](function(_0xe56d85){var _0x563559=_0xe56d85['get']({'plain':!![]});return db[_0x329a('0x52')]['findAll']({'where':{'userProfileId':_0x5f027b[_0x329a('0x47')]['id']},'raw':!![]})[_0x329a('0x2a')](function(_0x5e4ae2){if(_0x5e4ae2){return BPromise[_0x329a('0x53')](_0x5e4ae2,function(_0xd63b26){return new BPromise(function(_0x1566e6,_0x6c1a44){if(_0xd63b26['autoAssociation']===null||_0xd63b26['autoAssociation']===0x1)_0x1566e6(null);return db[_0x329a('0x54')][_0x329a('0x55')]({'where':{'sectionId':_0xd63b26['id']},'raw':!![]})['then'](function(_0x1d4531){var _0x28b6e4=_[_0x329a('0x30')](_0x1d4531,function(_0x8881f1){return qs['omit'](_0x8881f1,['id',_0x329a('0x4f'),_0x329a('0x50'),_0x329a('0x56')]);});_0x1566e6(_0x28b6e4);})[_0x329a('0x45')](function(_0x15fcf2){_0x6c1a44(_0x15fcf2);});})[_0x329a('0x2a')](function(_0x1ab051){var _0x310dc6=qs[_0x329a('0x4e')](_0xd63b26,['id',_0x329a('0x4f'),_0x329a('0x50')]);_0x310dc6[_0x329a('0x57')]=_0x563559['id'];if(_0x1ab051)_0x310dc6[_0x329a('0x58')]=_0x1ab051;return _0x310dc6;})[_0x329a('0x2a')](function(_0x2d226e){return db['UserProfileSection'][_0x329a('0x4a')](_0x2d226e,{'include':[{'model':db[_0x329a('0x54')],'as':_0x329a('0x58')}],'raw':!![],'transaction':_0x4d0ddb});});})[_0x329a('0x2a')](function(){return _0x563559;});}});});});}})['then'](respondWithResult(_0x138273,0xc9))['catch'](handleError(_0x138273,null));};exports['update']=function(_0x18da2b,_0x5db12f){if(_0x18da2b[_0x329a('0x4b')]['id']){delete _0x18da2b[_0x329a('0x4b')]['id'];}return db[_0x329a('0x31')]['find']({'where':{'id':_0x18da2b[_0x329a('0x47')]['id']}})[_0x329a('0x2a')](handleEntityNotFound(_0x5db12f,null))[_0x329a('0x2a')](saveUpdates(_0x18da2b[_0x329a('0x4b')],null))['then'](respondWithResult(_0x5db12f,null))[_0x329a('0x45')](handleError(_0x5db12f,null));};exports[_0x329a('0x59')]=function(_0x1f14a4,_0x17e846){return db[_0x329a('0x31')]['find']({'where':{'id':_0x1f14a4[_0x329a('0x47')]['id']}})[_0x329a('0x2a')](handleEntityNotFound(_0x17e846,null))[_0x329a('0x2a')](removeEntity(_0x17e846,null))[_0x329a('0x45')](handleError(_0x17e846,null));};exports['describe']=function(_0x331c25,_0xa1349c){return db[_0x329a('0x31')]['describe']()[_0x329a('0x2a')](respondWithResult(_0xa1349c,null))[_0x329a('0x45')](handleError(_0xa1349c,null));};exports[_0x329a('0x5a')]=function(_0x2a9620,_0x1bc904){var _0x25b38b=_0x2a9620[_0x329a('0x4b')];return db['UserProfile'][_0x329a('0x4c')]({'where':{'id':_0x2a9620[_0x329a('0x47')]['id']}})[_0x329a('0x2a')](handleEntityNotFound(_0x1bc904,null))[_0x329a('0x2a')](function(_0x15209d){if(_0x15209d){return db[_0x329a('0x5b')]['transaction'](function(_0x30b376){return db[_0x329a('0x52')][_0x329a('0x59')]({'where':{'userProfileId':_0x2a9620[_0x329a('0x47')]['id'],'sectionId':_[_0x329a('0x30')](_0x25b38b,function(_0x128015){return _0x128015[_0x329a('0x56')];})},'transaction':_0x30b376})[_0x329a('0x2a')](function(){var _0x2fb5dc=_[_0x329a('0x30')](_0x25b38b,function(_0x3d43c5){_0x3d43c5[_0x329a('0x57')]=_0x2a9620[_0x329a('0x47')]['id'];return _0x3d43c5;});var _0x54f741=[];return BPromise['each'](_0x2fb5dc,function(_0x351da1){return db[_0x329a('0x52')][_0x329a('0x4a')](_0x351da1,{'include':[{'model':db[_0x329a('0x54')],'as':_0x329a('0x58')}],'raw':!![],'transaction':_0x30b376})[_0x329a('0x2a')](function(_0x1f5026){_0x54f741['push'](_0x1f5026[_0x329a('0x4d')]({'plain':!![]}));});})[_0x329a('0x2a')](function(){return _0x54f741;});});});}})[_0x329a('0x2a')](function(_0x3d6090){return _0x3d6090;})[_0x329a('0x2a')](respondWithResult(_0x1bc904,null))['catch'](handleError(_0x1bc904,null));};exports[_0x329a('0x5c')]=function(_0x45f74c,_0x2aad4b){var _0x44cd5b;return db['UserProfile'][_0x329a('0x4c')]({'where':{'id':_0x45f74c[_0x329a('0x47')]['id']},'attributes':['id',_0x329a('0x2d')]})['then'](handleEntityNotFound(_0x2aad4b,null))['then'](function(_0x337e1a){if(_0x337e1a){_0x44cd5b=_0x337e1a;return db[_0x329a('0x52')][_0x329a('0x59')]({'where':{'userProfileId':_0x45f74c[_0x329a('0x47')]['id'],'sectionId':_0x45f74c['query'][_0x329a('0x5d')]}});}})[_0x329a('0x2a')](function(){return _0x44cd5b;})['then'](respondWithStatusCode(_0x2aad4b,null))[_0x329a('0x45')](handleError(_0x2aad4b,null));};exports[_0x329a('0x5e')]=function(_0x28ed10,_0x2301d7){var _0x4bfd17=[];var _0x36bcc2=[];return db[_0x329a('0x52')][_0x329a('0x55')]({'where':{'userProfileId':_0x28ed10[_0x329a('0x47')]['id']},'raw':!![]})[_0x329a('0x2a')](function(_0x4d48d1){_0x4bfd17=_[_0x329a('0x42')](_0x4d48d1,function(_0x47681c){return _0x47681c[_0x329a('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x47681c[_0x329a('0x56')]);});if(!_['isEmpty'](_0x4bfd17)){return _[_0x329a('0x30')](_0x4bfd17,function(_0x1acd91){return _0x1acd91['sectionId'];});}else{return;}})['then'](function(_0x50d275){if(_0x50d275)_0x36bcc2=_0x50d275;if(_[_0x329a('0x60')](_0x36bcc2,0x64)){var _0x4e27ba=_[_0x329a('0x4c')](_0x4bfd17,{'sectionId':0x64});return hasDefaultDashboard(_0x4e27ba)[_0x329a('0x2a')](function(_0x3f4609){return _[_0x329a('0x30')](_0x4bfd17,function(_0x5c9810){if(_0x5c9810[_0x329a('0x56')]===0x64){_0x5c9810[_0x329a('0x61')]=_0x3f4609;}return _0x5c9810;});});}else{return;}})['then'](function(_0x175656){if(_0x175656)_0x4bfd17=_0x175656;if(_[_0x329a('0x60')](_0x36bcc2,0x3eb)){var _0x25d79e=_[_0x329a('0x4c')](_0x4bfd17,{'sectionId':0x3eb});return getCustomDashboards(_0x25d79e)[_0x329a('0x2a')](function(_0x20ea4c){return _['map'](_0x4bfd17,function(_0x57a630){if(_0x25d79e['enabled']){if(_0x57a630[_0x329a('0x56')]===0x3eb){_0x57a630[_0x329a('0x61')]=_0x20ea4c;}}else{if(_0x57a630[_0x329a('0x56')]===0x64){_0x57a630['subsections']=_0x20ea4c;}}return _0x57a630;});});}else{return;}})['then'](function(_0x47761d){if(_0x47761d)_0x4bfd17=_0x47761d;if(_[_0x329a('0x60')](_0x36bcc2,0x709)){var _0x2faa58=_['find'](_0x4bfd17,{'sectionId':0x709});return getPlugins(_0x2faa58)['then'](function(_0x23c238){if(_0x2faa58[_0x329a('0x5f')]){return _[_0x329a('0x30')](_0x4bfd17,function(_0x3fba58){if(_0x3fba58[_0x329a('0x56')]===0x709){_0x3fba58[_0x329a('0x61')]=_0x23c238;}return _0x3fba58;});}else{var _0x23238d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x23c238};var _0x37e37e=_[_0x329a('0x30')](_0x4bfd17);_0x37e37e[_0x329a('0x62')](_0x23238d);return _0x37e37e;}});}else{return;}})[_0x329a('0x2a')](function(_0x113f5a){if(_0x113f5a)_0x4bfd17=_0x113f5a;return _[_0x329a('0x42')](_0x4bfd17,['enabled',0x1]);})['then'](respondWithResult(_0x2301d7,null))[_0x329a('0x45')](handleError(_0x2301d7,null));};function hasDefaultDashboard(_0x4f385b){var _0x162d8f=[0x65];return new BPromise(function(_0x67cc90,_0x4b6662){try{if(_0x4f385b[_0x329a('0x63')]){_0x67cc90(_0x162d8f);}else{return db[_0x329a('0x54')][_0x329a('0x64')]({'where':{'sectionId':_0x4f385b['id']},'raw':!![]})[_0x329a('0x2a')](function(_0x185da8){_0x185da8?_0x67cc90(_0x162d8f):_0x67cc90();});}}catch(_0x29a144){_0x4b6662(_0x29a144);}});}function getCustomDashboards(_0x29d4f3){var _0x2e282f=[];return new BPromise(function(_0xd739ff,_0x126c04){try{if(_0x29d4f3[_0x329a('0x63')]){return db[_0x329a('0x65')]['findAll']({'raw':!![]})[_0x329a('0x2a')](function(_0x4c3e27){_0x4c3e27[_0x329a('0x66')](function(_0x2e4796){_0x2e282f[_0x329a('0x62')](_0x2e4796['id']+0x1869f);});_0xd739ff(_0x2e282f);});}else{return db[_0x329a('0x54')][_0x329a('0x55')]({'where':{'sectionId':_0x29d4f3['id']},'raw':!![]})[_0x329a('0x2a')](function(_0x19c95d){_0x19c95d[_0x329a('0x66')](function(_0x3de0d3){_0x2e282f[_0x329a('0x62')](_0x3de0d3[_0x329a('0x67')]+0x1869f);});_0xd739ff(_0x2e282f);});}}catch(_0x1f6e96){_0x126c04(_0x1f6e96);}});}function getPlugins(_0x429481){var _0x418f80=[];return new BPromise(function(_0x5b6580,_0x4da973){try{if(_0x429481['autoAssociation']){return db[_0x329a('0x68')][_0x329a('0x55')]({'raw':!![]})[_0x329a('0x2a')](function(_0x1ee9b7){_0x1ee9b7['forEach'](function(_0x12b251){_0x418f80[_0x329a('0x62')](_0x12b251['id']+0x15b38);});_0x5b6580(_0x418f80);});}else{return db[_0x329a('0x54')][_0x329a('0x55')]({'where':{'sectionId':_0x429481['id']},'raw':!![]})[_0x329a('0x2a')](function(_0x361278){_0x361278[_0x329a('0x66')](function(_0x51dcbe){_0x418f80[_0x329a('0x62')](_0x51dcbe['resourceId']+0x15b38);});_0x5b6580(_0x418f80);});}}catch(_0xef9175){_0x4da973(_0xef9175);}});}exports[_0x329a('0x69')]=function(_0xf5c423,_0x6ba3d8){return db['UserProfile'][_0x329a('0x4c')]({'where':{'id':_0xf5c423[_0x329a('0x47')]['id']}})[_0x329a('0x2a')](handleEntityNotFound(_0x6ba3d8,null))[_0x329a('0x2a')](function(_0x29e09b){if(_0x29e09b){return db[_0x329a('0x5b')][_0x329a('0x51')](function(_0x19fd24){return db[_0x329a('0x52')]['findAll']({'where':{'userProfileId':_0xf5c423[_0x329a('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2d389e){if(_0x2d389e){return db[_0x329a('0x52')][_0x329a('0x59')]({'where':{'userProfileId':_0xf5c423[_0x329a('0x47')]['id'],'id':_[_0x329a('0x30')](_0x2d389e,function(_0x2fa729){return _0x2fa729['id'];})},'transaction':_0x19fd24});}})[_0x329a('0x2a')](function(_0x2b27bb){var _0x25e4ea=_['map'](_0xf5c423[_0x329a('0x4b')],function(_0x14cdce){_0x14cdce[_0x329a('0x57')]=_0xf5c423['params']['id'];return _0x14cdce;});return db[_0x329a('0x52')]['bulkCreate'](_0x25e4ea,{'raw':!![],'transaction':_0x19fd24});})[_0x329a('0x2a')](function(_0x21f287){var _0x18fc58=_[_0x329a('0x42')](_[_0x329a('0x30')](_0x21f287,function(_0x2daa2f){return _0x2daa2f['get']({'plain':!![]});}),{'includeAll':![]});if(_0x18fc58){return db[_0x329a('0x52')][_0x329a('0x55')]({'where':{'userProfileId':_0xf5c423[_0x329a('0x47')]['id'],'sectionId':_[_0x329a('0x30')](_0x18fc58,function(_0x2e8c77){return _0x2e8c77[_0x329a('0x56')];})},'attributes':['id',_0x329a('0x56')],'raw':!![]})[_0x329a('0x2a')](function(_0x23bbde){var _0x1caaca=_['map'](_0xf5c423[_0x329a('0x4b')],function(_0x234f5f){_0x234f5f['userProfileId']=_0xf5c423[_0x329a('0x47')]['id'];return _0x234f5f;});return db[_0x329a('0x54')][_0x329a('0x6a')](_0x1caaca,{'raw':!![],'transaction':_0x19fd24});});}})[_0x329a('0x45')](handleError(_0x6ba3d8,null));});}})[_0x329a('0x2a')](function(_0x5f3d7a){var _0x78560a=_[_0x329a('0x30')](_0x5f3d7a,function(_0x3315cf){return _0x3315cf[_0x329a('0x4d')]({'plain':!![]});});})[_0x329a('0x2a')](respondWithResult(_0x6ba3d8,null))[_0x329a('0x45')](handleError(_0x6ba3d8,null));};exports[_0x329a('0x6b')]=function(_0x32ef54,_0x42eae5,_0x5bb0f5){return db[_0x329a('0x31')][_0x329a('0x4c')]({'where':{'id':_0x32ef54[_0x329a('0x47')]['id']}})[_0x329a('0x2a')](handleEntityNotFound(_0x42eae5,null))[_0x329a('0x2a')](function(_0x3466a2){if(_0x3466a2){return _0x3466a2[_0x329a('0x6b')](_0x32ef54[_0x329a('0x34')][_0x329a('0x5d')]);}})[_0x329a('0x2a')](respondWithStatusCode(_0x42eae5,null))[_0x329a('0x45')](handleError(_0x42eae5,null));};exports[_0x329a('0x6c')]=function(_0xa35daf,_0x4ed0d3){var _0x2997b={'raw':![],'where':{}};var _0x4a7269={};var _0x1770e8={'count':0x0,'rows':[]};var _0x124572=_0xa35daf[_0x329a('0x34')][_0x329a('0x6d')];if(typeof _0x124572===_0x329a('0x6e')){throw new db[(_0x329a('0x6f'))][(_0x329a('0x70'))](_0x329a('0x71'));}var _0x3d826a=_0xa35daf['query'][_0x329a('0x72')]||![];var _0x508df7=getQueryModels(_0x124572,_0x3d826a);if(typeof _0x508df7[_0x329a('0x73')]==='undefined'){throw new db['Sequelize'][(_0x329a('0x70'))](_0x329a('0x74')+_0x124572+'\x27');}var _0x4f7989=[];if(!_['isEmpty'](_0x508df7[_0x329a('0x75')])){_0x4f7989=_0x508df7[_0x329a('0x75')];}else{_0x4f7989=[{'name':_0x124572}];}return db[_0x329a('0x31')][_0x329a('0x64')]({'where':{'id':_0xa35daf['params']['id']}})[_0x329a('0x2a')](handleEntityNotFound(_0x4ed0d3,null))['then'](function(_0x3fd70e){if(_0x3fd70e){var _0x577951=[];for(var _0xe7a3e5=0x0;_0xe7a3e5<_0x4f7989[_0x329a('0x48')];_0xe7a3e5++){_0x577951['push'](db[_0x329a('0x52')][_0x329a('0x64')]({'where':{'userProfileId':_0x3fd70e['id'],'name':_0x4f7989[_0xe7a3e5]['name']},'raw':!![]}));}return BPromise[_0x329a('0x76')](_0x577951);}})[_0x329a('0x2a')](function(_0x535d6f){var _0x20ed4e=_['filter'](_0x535d6f,function(_0x143530){return _0x143530?_0x143530:undefined;});var _0x1fc70c=_[_0x329a('0x42')](_0x4f7989,['ignore',!![]]);var _0x2cb417=_[_0x329a('0x77')](_0x20ed4e)&&_[_0x329a('0x77')](_0x1fc70c)?null:_[_0x329a('0x78')](_0x1fc70c,_0x20ed4e);if(_0x2cb417){var _0x277186=[];for(var _0x2d55d2=0x0;_0x2d55d2<_0x2cb417[_0x329a('0x48')];_0x2d55d2++){var _0x34b3f4=_[_0x329a('0x4c')](_0x4f7989,function(_0x4d1f8d){return _0x2cb417[_0x2d55d2]?_0x4d1f8d[_0x329a('0x2d')]===_0x2cb417[_0x2d55d2][_0x329a('0x2d')]:null;});if(_0x34b3f4){if(_0x2cb417[_0x2d55d2]['ignore']){_0x277186[_0x329a('0x62')](getAllResources(_0x508df7[_0x329a('0x73')],_0x2cb417[_0x2d55d2]));}else{if(!_0x2cb417[_0x2d55d2][_0x329a('0x63')]){_0x277186[_0x329a('0x62')](getAllowedResources(_0x34b3f4,_0x2cb417[_0x2d55d2],_0x508df7[_0x329a('0x73')]));}else{if(_0x34b3f4[_0x329a('0x33')]){_0x277186[_0x329a('0x62')](getAllFilteredResources(_0x34b3f4,_0x2cb417[_0x2d55d2]));}}}}}return BPromise[_0x329a('0x76')](_0x277186);}else{return null;}})['then'](function(_0x20a4b5){var _0x52968a=_0x20a4b5;var _0x4b7d7d=null;if(_0x52968a){_0x4b7d7d=_0x52968a[_0x329a('0x48')]===0x1?_0x52968a[0x0]:null;}if(_0x4b7d7d||_0x52968a){var _0x5ed5d2=db[_0x508df7[_0x329a('0x73')]][_0x329a('0x32')];_0x4a7269[_0x329a('0x33')]=_['keys'](_0x5ed5d2);_0x4a7269[_0x329a('0x34')]=_[_0x329a('0x35')](_0xa35daf[_0x329a('0x34')]);_0x4a7269['filters']=_[_0x329a('0x36')](_0x4a7269[_0x329a('0x33')],_0x4a7269[_0x329a('0x34')]);_0x2997b[_0x329a('0x37')]=_[_0x329a('0x36')](_0x4a7269['model'],qs['fields'](_0xa35daf['query']['fields']));_0x2997b['attributes']=_0x2997b[_0x329a('0x37')]['length']?_0x2997b[_0x329a('0x37')]:_0x4a7269[_0x329a('0x33')];if(!_0xa35daf['query'][_0x329a('0x79')](_0x329a('0x7a'))){_0x2997b[_0x329a('0x39')]=qs['limit'](_0xa35daf[_0x329a('0x34')][_0x329a('0x39')]);_0x2997b['offset']=qs[_0x329a('0x25')](_0xa35daf[_0x329a('0x34')][_0x329a('0x25')]);}_0x2997b[_0x329a('0x3a')]=qs['sort'](_0xa35daf[_0x329a('0x34')][_0x329a('0x3b')]);_0x2997b['where']=qs[_0x329a('0x3e')](_[_0x329a('0x3d')](_0xa35daf[_0x329a('0x34')],_0x4a7269[_0x329a('0x3e')]));if(_0xa35daf['query']['filter']){_0x2997b[_0x329a('0x3c')]=_[_0x329a('0x3f')](_0x2997b['where'],{'$or':_[_0x329a('0x30')](_0x5ed5d2,function(_0x2b5e8d){if(_0x2b5e8d['type'][_0x329a('0x7b')]!=='VIRTUAL'){var _0x81d2f7={};_0x81d2f7[_0x2b5e8d[_0x329a('0x7c')]]={'$like':'%'+_0xa35daf[_0x329a('0x34')][_0x329a('0x42')]+'%'};return _0x81d2f7;}})});}var _0x336428=[];if(_0x4b7d7d){var _0x35ee9f=_[_0x329a('0x4c')](_0x4f7989,['name',_0x4b7d7d[_0x329a('0x2d')]]);if(_0x35ee9f[_0x329a('0x7c')]){var _0x38b31b={};if(_0x508df7[_0x329a('0x73')]===_0x329a('0x7d')){_0x38b31b[_0x35ee9f[_0x329a('0x7e')]]=_[_0x329a('0x30')](_0x4b7d7d[_0x329a('0x7f')],'id');}else{_0x38b31b[_0x35ee9f[_0x329a('0x7e')]]=_0x4b7d7d['associatedResources'];}_0x336428[_0x329a('0x62')](_0x38b31b);}else{_0x2997b[_0x329a('0x3c')]['id']=_0x4b7d7d[_0x329a('0x7f')];}}else{for(var _0x3aa838=0x0;_0x3aa838<_0x52968a['length'];_0x3aa838++){var _0x35ee9f=_[_0x329a('0x4c')](_0x4f7989,[_0x329a('0x2d'),_0x52968a[_0x3aa838][_0x329a('0x2d')]]);if(_0x35ee9f[_0x329a('0x7c')]){var _0x38b31b={};_0x38b31b[_0x35ee9f[_0x329a('0x7e')]]=_0x52968a[_0x3aa838][_0x329a('0x7f')];_0x336428[_0x329a('0x62')](_0x38b31b);}else{if(!_0x2997b['where']['id'])_0x2997b[_0x329a('0x3c')]['id']=[];_0x52968a[_0x3aa838][_0x329a('0x7f')][_0x329a('0x66')](function(_0x16b3d1){_0x2997b[_0x329a('0x3c')]['id']['push'](_0x16b3d1);});}}}if(!_[_0x329a('0x77')](_0x336428)){_0x2997b['where']=_[_0x329a('0x3f')](_0x2997b[_0x329a('0x3c')],{'$and':{'$or':_0x336428}});}_0x2997b=_[_0x329a('0x3f')]({},_0x2997b,_0xa35daf['options']);if(_0x4b7d7d&&!_0x4b7d7d[_0x329a('0x63')]&&_0x508df7[_0x329a('0x73')]===_0x329a('0x7d')){if(_0xa35daf[_0x329a('0x34')][_0x329a('0x44')]){_0x2997b['include']=[{'all':!![]}];}return db[_0x508df7['childModel']]['findAll'](_0x2997b)[_0x329a('0x2a')](function(_0x54d6c7){var _0x588d18=[];_0x54d6c7[_0x329a('0x66')](function(_0xc97f02){var _0x4bf156;switch(_0xc97f02[_0x329a('0x80')]){case _0x329a('0x81'):_0x4bf156=_[_0x329a('0x4c')](_0x4b7d7d[_0x329a('0x7f')],function(_0x87ed4b){return _0x87ed4b['id']===_0xc97f02['reportId']&&_0x87ed4b[_0x329a('0x40')]===_0x329a('0x82');});break;case _0x329a('0x83'):_0x4bf156=_[_0x329a('0x4c')](_0x4b7d7d[_0x329a('0x7f')],function(_0x16513e){return _0x16513e['id']===_0xc97f02[_0x329a('0x84')]&&_0x16513e[_0x329a('0x40')]==='CustomReports';});break;}if(_0x4bf156)_0x588d18[_0x329a('0x62')](_0xc97f02);});_0x1770e8['count']=_0x588d18[_0x329a('0x48')];_0x1770e8[_0x329a('0x85')]=_0x588d18;return _0x1770e8;});}else{return db[_0x508df7[_0x329a('0x73')]]['count']({'where':_0x2997b[_0x329a('0x3c')]})['then'](function(_0x12309e){_0x1770e8[_0x329a('0x24')]=_0x12309e;if(_0xa35daf['query'][_0x329a('0x44')]){if(_0x508df7['childModel']===_0x329a('0x86')){_0x2997b['include']=[{'model':db[_0x329a('0x87')],'as':_0x329a('0x88'),'attributes':['id',_0x329a('0x2d'),_0x329a('0x89')],'required':_0xa35daf['query'][_0x329a('0x8a')]?!![]:![]},{'model':db[_0x329a('0x87')],'as':_0x329a('0x8b'),'attributes':['id',_0x329a('0x2d'),'color'],'through':_0xa35daf[_0x329a('0x34')]['tag']?{'attributes':[],'where':{'TagId':_0xa35daf[_0x329a('0x34')]['tag']||undefined}}:{},'required':_0xa35daf[_0x329a('0x34')][_0x329a('0x8a')]?!![]:![]}];}else{_0x2997b['include']=[{'all':!![]}];}}return db[_0x508df7[_0x329a('0x73')]][_0x329a('0x55')](_0x2997b);})[_0x329a('0x2a')](function(_0x3b8110){_0x1770e8['rows']=_0x3b8110;return _0x1770e8;});}}else{return _0x1770e8;}})[_0x329a('0x2a')](respondWithFilteredResult(_0x4ed0d3,_0x2997b))[_0x329a('0x45')](handleError(_0x4ed0d3,null));};function getAllResources(_0x3608e8,_0x11e579){return new BPromise(function(_0xad27b4,_0x381f02){if(_0x11e579){var _0x49ee68=_0x11e579[_0x329a('0x42')]?{[_0x11e579[_0x329a('0x42')][_0x329a('0x7c')]]:_0x11e579[_0x329a('0x42')][_0x329a('0x8c')]}:undefined;return db[_0x3608e8][_0x329a('0x55')]({'where':_0x49ee68,'raw':!![]})['then'](function(_0x55a690){_0x11e579[_0x329a('0x7f')]=_['map'](_0x55a690,'id');_0xad27b4(_0x11e579);})[_0x329a('0x45')](function(_0x1ce522){_0x381f02(_0x1ce522);});}else{_0xad27b4(null);}});}function getAllFilteredResources(_0x5275b3,_0x44e9a8){return new BPromise(function(_0x47310c,_0x212756){var _0x5d4844=_0x5275b3[_0x329a('0x42')]?{[_0x5275b3[_0x329a('0x42')][_0x329a('0x7c')]]:_0x5275b3['filter'][_0x329a('0x8c')]}:undefined;return db[_0x5275b3[_0x329a('0x33')]]['findAll']({'where':_0x5d4844,'raw':!![]})['then'](function(_0x430ea7){_0x44e9a8[_0x329a('0x7f')]=_[_0x329a('0x30')](_0x430ea7,function(_0x252ef5){return _0x252ef5[_0x329a('0x2d')];});_0x47310c(_0x44e9a8);})[_0x329a('0x45')](function(_0x21584f){_0x212756(_0x21584f);});});}function getAllowedResources(_0x118630,_0x1f10f4,_0x8ea3ae){return new BPromise(function(_0x201de8,_0x2b3961){if(_0x1f10f4){return db[_0x329a('0x54')]['findAll']({'where':{'sectionId':_0x1f10f4['id']},'raw':!![]})[_0x329a('0x2a')](function(_0x1e518a){if(_0x118630[_0x329a('0x7c')]&&_0x118630[_0x329a('0x7c')]!=='id'){_0x1f10f4[_0x329a('0x7f')]=_[_0x329a('0x30')](_0x1e518a,function(_0x349450){return _0x349450[_0x118630[_0x329a('0x7c')]];});}else{if(_0x8ea3ae===_0x329a('0x7d')){_0x1f10f4[_0x329a('0x7f')]=_['map'](_0x1e518a,function(_0xfe2920){return{'id':_0xfe2920[_0x329a('0x67')],'type':_0xfe2920[_0x329a('0x40')]};});}else{_0x1f10f4[_0x329a('0x7f')]=_[_0x329a('0x30')](_0x1e518a,function(_0x4e65f8){return _0x4e65f8[_0x329a('0x67')];});}}_0x201de8(_0x1f10f4);})[_0x329a('0x45')](function(_0x2c4cb1){_0x2b3961(_0x2c4cb1);});}else{_0x201de8(null);}});}function getQueryModels(_0x5cb83b,_0x3cd41b){var _0x16b054=_0x5cb83b[_0x329a('0x8d')]();var _0x14328e={'childModel':undefined,'parentSections':[]};switch(_0x16b054){case _0x329a('0x8e'):_0x14328e[_0x329a('0x73')]=_0x329a('0x8f');break;case _0x329a('0x90'):_0x14328e[_0x329a('0x73')]=_0x329a('0x91');break;case'squarerecordings':_0x14328e[_0x329a('0x73')]=_0x329a('0x92');_0x14328e['parentSections']=[{'name':'SquareProjects','field':_0x329a('0x2d'),'foreignKey':_0x329a('0x93')}];break;case _0x329a('0x94'):_0x14328e['childModel']=_0x329a('0x95');break;case _0x329a('0x96'):_0x14328e['childModel']=_0x329a('0x86');_0x14328e[_0x329a('0x75')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x14328e['childModel']='CmList';break;case _0x329a('0x97'):_0x14328e[_0x329a('0x73')]=_0x329a('0x98');break;case'globalcustomfields':_0x14328e['childModel']=_0x329a('0x99');break;case _0x329a('0x9a'):_0x14328e['childModel']=_0x329a('0x9b');break;case'chatwebsites':_0x14328e[_0x329a('0x73')]=_0x329a('0x9c');break;case'faxqueues':_0x14328e[_0x329a('0x73')]=_0x329a('0x9d');break;case _0x329a('0x9e'):_0x14328e[_0x329a('0x73')]=_0x329a('0x9f');break;case _0x329a('0xa0'):case _0x329a('0xa1'):case _0x329a('0xa2'):_0x14328e[_0x329a('0x73')]='VoiceExtension';break;case'contexts':_0x14328e['childModel']='VoiceContext';break;case _0x329a('0xa3'):_0x14328e[_0x329a('0x73')]=_0x329a('0xa4');break;case _0x329a('0xa5'):_0x14328e[_0x329a('0x73')]=_0x329a('0xa6');_0x14328e[_0x329a('0x75')]=[{'name':_0x329a('0xa7'),'field':'name','foreignKey':_0x329a('0xa8'),'model':_0x329a('0xa9'),'filter':{'field':_0x329a('0xaa'),'value':['agent']}},{'name':_0x329a('0xab'),'field':_0x329a('0x2d'),'foreignKey':_0x329a('0xa8'),'model':_0x329a('0xa9'),'filter':{'field':_0x329a('0xaa'),'value':[_0x329a('0xac')]}},{'name':_0x329a('0xad'),'field':_0x329a('0x2d'),'foreignKey':_0x329a('0xae'),'model':_0x329a('0xaf'),'filter':{'field':_0x329a('0x40'),'value':[_0x329a('0xb0')]}},{'name':_0x329a('0xb1'),'field':_0x329a('0x2d'),'foreignKey':'queue','model':_0x329a('0xaf'),'filter':{'field':'type','value':[_0x329a('0xb2')]}}];break;case'musiconholds':_0x14328e[_0x329a('0x73')]=_0x329a('0xb3');break;case _0x329a('0xb4'):_0x14328e[_0x329a('0x73')]='VoiceChanSpy';break;case _0x329a('0xb5'):_0x14328e[_0x329a('0x73')]=_0x329a('0xb6');break;case'ivrcampaigns':_0x14328e[_0x329a('0x73')]=_0x329a('0xb7');break;case _0x329a('0xb8'):_0x14328e['childModel']=_0x329a('0xb9');break;case _0x329a('0xba'):_0x14328e['childModel']=_0x329a('0xbb');break;case _0x329a('0xbc'):_0x14328e[_0x329a('0x73')]='MailSubstatus';break;case _0x329a('0xbd'):_0x14328e[_0x329a('0x73')]=_0x329a('0xbe');break;case _0x329a('0xbf'):_0x14328e[_0x329a('0x73')]='OpenchannelAccount';break;case _0x329a('0xc0'):_0x14328e[_0x329a('0x73')]=_0x329a('0xc1');break;case _0x329a('0xc2'):_0x14328e[_0x329a('0x73')]=_0x329a('0xc3');break;case _0x329a('0xc4'):_0x14328e[_0x329a('0x73')]=_0x329a('0xc5');break;case _0x329a('0xc6'):_0x14328e[_0x329a('0x73')]=_0x329a('0xc7');break;case _0x329a('0xc8'):_0x14328e[_0x329a('0x73')]=_0x329a('0xc9');break;case'voicequeues':case'queuecampaigns':_0x14328e[_0x329a('0x73')]='VoiceQueue';if(_0x3cd41b){_0x14328e[_0x329a('0x75')]=[{'name':_0x329a('0xad')},{'name':_0x329a('0xb1')}];}break;case _0x329a('0xca'):case'agents':case _0x329a('0xcb'):_0x14328e[_0x329a('0x73')]=_0x329a('0xa9');if(_0x3cd41b){_0x14328e[_0x329a('0x75')]=[{'name':_0x329a('0xcc'),'filter':{'field':_0x329a('0xaa'),'value':[_0x329a('0xcd'),'user']},'ignore':!![]},{'name':_0x329a('0xa7')},{'name':'Telephones'}];}break;case _0x329a('0xce'):_0x14328e['childModel']=_0x329a('0xcf');break;case _0x329a('0xd0'):_0x14328e[_0x329a('0x73')]=_0x329a('0xd1');break;case _0x329a('0xd2'):_0x14328e[_0x329a('0x73')]='FreshdeskAccount';break;case _0x329a('0xd3'):_0x14328e['childModel']=_0x329a('0xd4');break;case _0x329a('0xd5'):_0x14328e['childModel']=_0x329a('0xd6');break;case'zohoaccounts':_0x14328e[_0x329a('0x73')]='ZohoAccount';break;case _0x329a('0xd7'):_0x14328e['childModel']=_0x329a('0xa9');break;case _0x329a('0xd8'):_0x14328e['childModel']=_0x329a('0xd9');break;case'dispositions':_0x14328e['childModel']='Disposition';break;case'customdashboards':_0x14328e[_0x329a('0x73')]='Dashboard';break;case _0x329a('0xda'):_0x14328e[_0x329a('0x73')]=_0x329a('0xdb');break;case _0x329a('0xdc'):_0x14328e[_0x329a('0x73')]=_0x329a('0xdd');break;case _0x329a('0xde'):_0x14328e[_0x329a('0x73')]=_0x329a('0xdf');break;case _0x329a('0xe0'):_0x14328e[_0x329a('0x73')]=_0x329a('0xe1');break;case _0x329a('0xe2'):_0x14328e[_0x329a('0x73')]=_0x329a('0x87');break;case _0x329a('0xe3'):_0x14328e['childModel']='Template';break;case'triggers':_0x14328e['childModel']=_0x329a('0xe4');break;case _0x329a('0xe5'):_0x14328e[_0x329a('0x73')]='Trunk';break;case'variables':_0x14328e[_0x329a('0x73')]=_0x329a('0xe6');break;case _0x329a('0xe7'):_0x14328e[_0x329a('0x73')]='Plugin';break;case'extractedreports':_0x14328e[_0x329a('0x73')]=_0x329a('0x7d');_0x14328e[_0x329a('0x75')]=[{'name':_0x329a('0xe8'),'field':'id','foreignKey':_0x329a('0x84')}];break;case _0x329a('0xe9'):_0x14328e[_0x329a('0x73')]=_0x329a('0xea');break;case _0x329a('0xc6'):_0x14328e[_0x329a('0x73')]=_0x329a('0xc7');break;default:return _0x14328e;}return _0x14328e;} \ No newline at end of file +var _0xbe49=['VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','inbound','QueueCampaigns','queue','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','scheduler','Schedule','sounds','Template','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','Reports','metrics','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','clone','omit','updatedAt','crudPermissions','createdAt','transaction','each','autoAssociation','UserProfileResource','userProfileId','Resources','UserProfileSection','find','describe','addSections','sequelize','destroy','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','forEach','Plugin','resourceId','bulkCreate','get','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','findOne','ignore','union','all','nolimit','field','associatedResources','foreignKey','AnalyticExtractedReport','DefaultReports','reportId','CustomReports','CmContact','Tag','color','tag','ThroughTags','value','toLowerCase','squareprojects','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','lists','CmList','CmCompany','CmCustomField','chatqueues','chatwebsites','FaxQueue','faxaccounts','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings'];(function(_0x3eaa44,_0x4167a4){var _0xfc66fc=function(_0x4884f8){while(--_0x4884f8){_0x3eaa44['push'](_0x3eaa44['shift']());}};_0xfc66fc(++_0x4167a4);}(_0xbe49,0x135));var _0x9be4=function(_0x5eaa3c,_0x99c412){_0x5eaa3c=_0x5eaa3c-0x0;var _0x5152d3=_0xbe49[_0x5eaa3c];return _0x5152d3;};'use strict';var pdf=require(_0x9be4('0x0'));var emlformat=require(_0x9be4('0x1'));var rimraf=require(_0x9be4('0x2'));var zipdir=require(_0x9be4('0x3'));var jsonpatch=require(_0x9be4('0x4'));var rp=require('request-promise');var moment=require(_0x9be4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9be4('0x6'));var path=require(_0x9be4('0x7'));var sox=require('sox');var csv=require(_0x9be4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9be4('0x9'));var squel=require(_0x9be4('0xa'));var crypto=require(_0x9be4('0xb'));var jsforce=require(_0x9be4('0xc'));var deskjs=require(_0x9be4('0xd'));var toCsv=require(_0x9be4('0x8'));var querystring=require('querystring');var Papa=require(_0x9be4('0xe'));var Redis=require(_0x9be4('0xf'));var authService=require(_0x9be4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9be4('0x11'));var hardwareService=require(_0x9be4('0x12'));var logger=require(_0x9be4('0x13'))(_0x9be4('0x14'));var utils=require(_0x9be4('0x15'));var config=require(_0x9be4('0x16'));var licenseUtil=require(_0x9be4('0x17'));var db=require('../../mysqldb')['db'];config[_0x9be4('0x18')]=_[_0x9be4('0x19')](config[_0x9be4('0x18')],{'host':_0x9be4('0x1a'),'port':0x18eb});var socket=require(_0x9be4('0x1b'))(new Redis(config[_0x9be4('0x18')]));require('./userProfile.socket')[_0x9be4('0x1c')](socket);function respondWithStatusCode(_0x51c97c,_0x3b2681){_0x3b2681=_0x3b2681||0xcc;return function(_0x10f4fd){if(_0x10f4fd){return _0x51c97c['sendStatus'](_0x3b2681);}return _0x51c97c[_0x9be4('0x1d')](_0x3b2681)[_0x9be4('0x1e')]();};}function respondWithResult(_0x2c9c52,_0x53e510){_0x53e510=_0x53e510||0xc8;return function(_0x29ae9e){if(_0x29ae9e){return _0x2c9c52['status'](_0x53e510)[_0x9be4('0x1f')](_0x29ae9e);}};}function respondWithFilteredResult(_0x26d93e,_0x4be2f6){return function(_0x4a1444){if(_0x4a1444){var _0x28ea48=_0x4a1444['count'],_0x19c94a=_0x4be2f6[_0x9be4('0x20')],_0xc3ec20=_0x4be2f6[_0x9be4('0x20')]+_0x4be2f6[_0x9be4('0x21')],_0x563382;if(_0xc3ec20>=_0x28ea48){_0xc3ec20=_0x28ea48;_0x563382=0xc8;}else{_0x563382=0xce;}_0x26d93e[_0x9be4('0x1d')](_0x563382);return _0x26d93e[_0x9be4('0x22')](_0x9be4('0x23'),_0x19c94a+'-'+_0xc3ec20+'/'+_0x28ea48)[_0x9be4('0x1f')](_0x4a1444);}return null;};}function patchUpdates(_0x5af896){return function(_0x26cbe6){try{jsonpatch[_0x9be4('0x24')](_0x26cbe6,_0x5af896,!![]);}catch(_0x38d2d4){return BPromise['reject'](_0x38d2d4);}return _0x26cbe6[_0x9be4('0x25')]();};}function saveUpdates(_0x44116b,_0x540501){return function(_0x308285){if(_0x308285){return _0x308285[_0x9be4('0x26')](_0x44116b)[_0x9be4('0x27')](function(_0x13fa39){return _0x13fa39;});}return null;};}function removeEntity(_0x396f23,_0x4a9e9d){return function(_0x395f3e){if(_0x395f3e){return _0x395f3e['destroy']()['then'](function(){_0x396f23[_0x9be4('0x1d')](0xcc)[_0x9be4('0x1e')]();});}};}function handleEntityNotFound(_0x565341,_0x2b5ceb){return function(_0x244396){if(!_0x244396){_0x565341['sendStatus'](0x194);}return _0x244396;};}function handleError(_0x20eba8,_0x34718e){_0x34718e=_0x34718e||0x1f4;return function(_0x869a41){logger[_0x9be4('0x28')](_0x869a41[_0x9be4('0x29')]);if(_0x869a41[_0x9be4('0x2a')]){delete _0x869a41[_0x9be4('0x2a')];}_0x20eba8[_0x9be4('0x1d')](_0x34718e)[_0x9be4('0x2b')](_0x869a41);};}exports[_0x9be4('0x2c')]=function(_0x1117ad,_0x230446){var _0x3b8dbc={},_0x29a5ae={},_0x296e1d={'count':0x0,'rows':[]};var _0x515b81=_[_0x9be4('0x2d')](db[_0x9be4('0x2e')][_0x9be4('0x2f')],function(_0x3433ad){return{'name':_0x3433ad[_0x9be4('0x30')],'type':_0x3433ad['type'][_0x9be4('0x31')]};});_0x29a5ae[_0x9be4('0x32')]=_[_0x9be4('0x2d')](_0x515b81,_0x9be4('0x2a'));_0x29a5ae[_0x9be4('0x33')]=_[_0x9be4('0x34')](_0x1117ad[_0x9be4('0x33')]);_0x29a5ae[_0x9be4('0x35')]=_[_0x9be4('0x36')](_0x29a5ae[_0x9be4('0x32')],_0x29a5ae[_0x9be4('0x33')]);_0x3b8dbc[_0x9be4('0x37')]=_[_0x9be4('0x36')](_0x29a5ae[_0x9be4('0x32')],qs[_0x9be4('0x38')](_0x1117ad[_0x9be4('0x33')][_0x9be4('0x38')]));_0x3b8dbc[_0x9be4('0x37')]=_0x3b8dbc['attributes'][_0x9be4('0x39')]?_0x3b8dbc[_0x9be4('0x37')]:_0x29a5ae[_0x9be4('0x32')];if(!_0x1117ad['query'][_0x9be4('0x3a')]('nolimit')){_0x3b8dbc[_0x9be4('0x21')]=qs[_0x9be4('0x21')](_0x1117ad['query'][_0x9be4('0x21')]);_0x3b8dbc['offset']=qs[_0x9be4('0x20')](_0x1117ad[_0x9be4('0x33')][_0x9be4('0x20')]);}_0x3b8dbc[_0x9be4('0x3b')]=qs[_0x9be4('0x3c')](_0x1117ad[_0x9be4('0x33')]['sort']);_0x3b8dbc['where']=qs['filters'](_[_0x9be4('0x3d')](_0x1117ad[_0x9be4('0x33')],_0x29a5ae[_0x9be4('0x35')]),_0x515b81);if(_0x1117ad[_0x9be4('0x33')][_0x9be4('0x3e')]){_0x3b8dbc[_0x9be4('0x3f')]=_[_0x9be4('0x40')](_0x3b8dbc['where'],{'$or':_[_0x9be4('0x2d')](_0x515b81,function(_0x44b666){if(_0x44b666[_0x9be4('0x41')]!==_0x9be4('0x42')){var _0x1cae1b={};_0x1cae1b[_0x44b666[_0x9be4('0x2a')]]={'$like':'%'+_0x1117ad[_0x9be4('0x33')][_0x9be4('0x3e')]+'%'};return _0x1cae1b;}})});}_0x3b8dbc=_[_0x9be4('0x40')]({},_0x3b8dbc,_0x1117ad['options']);var _0x3be5b2={'where':_0x3b8dbc[_0x9be4('0x3f')]};return db[_0x9be4('0x2e')][_0x9be4('0x43')](_0x3be5b2)[_0x9be4('0x27')](function(_0x2c34e1){_0x296e1d[_0x9be4('0x43')]=_0x2c34e1;if(_0x1117ad[_0x9be4('0x33')][_0x9be4('0x44')]){_0x3b8dbc[_0x9be4('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x9be4('0x46')](_0x3b8dbc);})[_0x9be4('0x27')](function(_0x4a2462){_0x296e1d[_0x9be4('0x47')]=_0x4a2462;return _0x296e1d;})[_0x9be4('0x27')](respondWithFilteredResult(_0x230446,_0x3b8dbc))[_0x9be4('0x48')](handleError(_0x230446,null));};exports[_0x9be4('0x49')]=function(_0x591f38,_0x1b98ba){var _0x3c7edd={'raw':![],'where':{'id':_0x591f38[_0x9be4('0x4a')]['id']}},_0xf10386={};_0xf10386[_0x9be4('0x32')]=_[_0x9be4('0x34')](db[_0x9be4('0x2e')][_0x9be4('0x2f')]);_0xf10386[_0x9be4('0x33')]=_[_0x9be4('0x34')](_0x591f38['query']);_0xf10386['filters']=_[_0x9be4('0x36')](_0xf10386[_0x9be4('0x32')],_0xf10386[_0x9be4('0x33')]);_0x3c7edd[_0x9be4('0x37')]=_[_0x9be4('0x36')](_0xf10386['model'],qs[_0x9be4('0x38')](_0x591f38[_0x9be4('0x33')][_0x9be4('0x38')]));_0x3c7edd[_0x9be4('0x37')]=_0x3c7edd['attributes'][_0x9be4('0x39')]?_0x3c7edd['attributes']:_0xf10386[_0x9be4('0x32')];if(_0x591f38[_0x9be4('0x33')][_0x9be4('0x44')]){_0x3c7edd['include']=[{'all':!![]}];}_0x3c7edd=_['merge']({},_0x3c7edd,_0x591f38[_0x9be4('0x4b')]);return db[_0x9be4('0x2e')]['find'](_0x3c7edd)[_0x9be4('0x27')](handleEntityNotFound(_0x1b98ba,null))['then'](respondWithResult(_0x1b98ba,null))[_0x9be4('0x48')](handleError(_0x1b98ba,null));};exports[_0x9be4('0x4c')]=function(_0x134721,_0x28c2bd){return db[_0x9be4('0x2e')][_0x9be4('0x4c')](_0x134721[_0x9be4('0x4d')],{})[_0x9be4('0x27')](respondWithResult(_0x28c2bd,0xc9))['catch'](handleError(_0x28c2bd,null));};exports[_0x9be4('0x4e')]=function(_0x451e2a,_0x395de8){var _0x3062e3={'where':{'id':_0x451e2a[_0x9be4('0x4a')]['id']}},_0x4c0616={};_0x4c0616[_0x9be4('0x32')]=_['keys'](db[_0x9be4('0x2e')][_0x9be4('0x2f')]);_0x3062e3['attributes']=_[_0x9be4('0x36')](_0x4c0616['model'],qs[_0x9be4('0x38')](_0x451e2a[_0x9be4('0x33')]['fields']));_0x3062e3[_0x9be4('0x37')]=_0x3062e3['attributes'][_0x9be4('0x39')]?_0x3062e3[_0x9be4('0x37')]:_0x4c0616[_0x9be4('0x32')];if(_0x451e2a[_0x9be4('0x33')][_0x9be4('0x44')]){_0x3062e3['include']=[{'all':!![]}];}_0x3062e3=_[_0x9be4('0x40')]({},_0x3062e3,_0x451e2a[_0x9be4('0x4b')]);return db[_0x9be4('0x2e')]['find'](_0x3062e3)[_0x9be4('0x27')](handleEntityNotFound(_0x395de8,null))[_0x9be4('0x27')](function(_0x3edea7){if(_0x3edea7){var _0x13474e=_0x3edea7['get']({'plain':!![]});_0x13474e=qs[_0x9be4('0x4f')](_0x13474e,['id','createdAt',_0x9be4('0x50'),_0x9be4('0x51')]);_0x451e2a[_0x9be4('0x4d')]=_[_0x9be4('0x4f')](_0x451e2a[_0x9be4('0x4d')],['id',_0x9be4('0x52'),_0x9be4('0x50')]);return db['sequelize'][_0x9be4('0x53')](function(_0x361b48){return db[_0x9be4('0x2e')][_0x9be4('0x4c')](_[_0x9be4('0x40')](_0x13474e,_0x451e2a[_0x9be4('0x4d')]),{'include':_0x451e2a[_0x9be4('0x33')][_0x9be4('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x361b48})[_0x9be4('0x27')](function(_0x22c247){var _0x25d90b=_0x22c247['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x451e2a[_0x9be4('0x4a')]['id']},'raw':!![]})[_0x9be4('0x27')](function(_0x18b25e){if(_0x18b25e){return BPromise[_0x9be4('0x54')](_0x18b25e,function(_0x307f82){return new BPromise(function(_0x50bdcf,_0x2a5d11){if(_0x307f82[_0x9be4('0x55')]===null||_0x307f82['autoAssociation']===0x1)_0x50bdcf(null);return db[_0x9be4('0x56')][_0x9be4('0x46')]({'where':{'sectionId':_0x307f82['id']},'raw':!![]})[_0x9be4('0x27')](function(_0x14219e){var _0x242c5a=_[_0x9be4('0x2d')](_0x14219e,function(_0x4bf263){return qs[_0x9be4('0x4f')](_0x4bf263,['id',_0x9be4('0x52'),_0x9be4('0x50'),'sectionId']);});_0x50bdcf(_0x242c5a);})[_0x9be4('0x48')](function(_0x4157c4){_0x2a5d11(_0x4157c4);});})[_0x9be4('0x27')](function(_0x3a7fe4){var _0x2ac76e=qs[_0x9be4('0x4f')](_0x307f82,['id','createdAt','updatedAt']);_0x2ac76e[_0x9be4('0x57')]=_0x25d90b['id'];if(_0x3a7fe4)_0x2ac76e[_0x9be4('0x58')]=_0x3a7fe4;return _0x2ac76e;})['then'](function(_0x2d9458){return db[_0x9be4('0x59')][_0x9be4('0x4c')](_0x2d9458,{'include':[{'model':db[_0x9be4('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x361b48});});})[_0x9be4('0x27')](function(){return _0x25d90b;});}});});});}})[_0x9be4('0x27')](respondWithResult(_0x395de8,0xc9))[_0x9be4('0x48')](handleError(_0x395de8,null));};exports[_0x9be4('0x26')]=function(_0x347cdd,_0x5bcef0){if(_0x347cdd[_0x9be4('0x4d')]['id']){delete _0x347cdd[_0x9be4('0x4d')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x347cdd[_0x9be4('0x4a')]['id']}})[_0x9be4('0x27')](handleEntityNotFound(_0x5bcef0,null))[_0x9be4('0x27')](saveUpdates(_0x347cdd[_0x9be4('0x4d')],null))[_0x9be4('0x27')](respondWithResult(_0x5bcef0,null))[_0x9be4('0x48')](handleError(_0x5bcef0,null));};exports['destroy']=function(_0x5ccee4,_0x31de1a){return db[_0x9be4('0x2e')][_0x9be4('0x5a')]({'where':{'id':_0x5ccee4['params']['id']}})['then'](handleEntityNotFound(_0x31de1a,null))[_0x9be4('0x27')](removeEntity(_0x31de1a,null))[_0x9be4('0x48')](handleError(_0x31de1a,null));};exports['describe']=function(_0x232e9d,_0x386381){return db[_0x9be4('0x2e')][_0x9be4('0x5b')]()[_0x9be4('0x27')](respondWithResult(_0x386381,null))[_0x9be4('0x48')](handleError(_0x386381,null));};exports[_0x9be4('0x5c')]=function(_0x31f6fd,_0x32f981){var _0x24a7d8=_0x31f6fd[_0x9be4('0x4d')];return db[_0x9be4('0x2e')][_0x9be4('0x5a')]({'where':{'id':_0x31f6fd['params']['id']}})[_0x9be4('0x27')](handleEntityNotFound(_0x32f981,null))[_0x9be4('0x27')](function(_0x1f4122){if(_0x1f4122){return db[_0x9be4('0x5d')][_0x9be4('0x53')](function(_0x1ae8c6){return db['UserProfileSection'][_0x9be4('0x5e')]({'where':{'userProfileId':_0x31f6fd[_0x9be4('0x4a')]['id'],'sectionId':_['map'](_0x24a7d8,function(_0x23ebc1){return _0x23ebc1[_0x9be4('0x5f')];})},'transaction':_0x1ae8c6})['then'](function(){var _0x70f181=_[_0x9be4('0x2d')](_0x24a7d8,function(_0x34c197){_0x34c197[_0x9be4('0x57')]=_0x31f6fd['params']['id'];return _0x34c197;});var _0x39acfa=[];return BPromise[_0x9be4('0x54')](_0x70f181,function(_0x3808cc){return db[_0x9be4('0x59')][_0x9be4('0x4c')](_0x3808cc,{'include':[{'model':db[_0x9be4('0x56')],'as':_0x9be4('0x58')}],'raw':!![],'transaction':_0x1ae8c6})[_0x9be4('0x27')](function(_0x2c9d5b){_0x39acfa[_0x9be4('0x60')](_0x2c9d5b['get']({'plain':!![]}));});})['then'](function(){return _0x39acfa;});});});}})[_0x9be4('0x27')](function(_0x102ac3){return _0x102ac3;})[_0x9be4('0x27')](respondWithResult(_0x32f981,null))['catch'](handleError(_0x32f981,null));};exports[_0x9be4('0x61')]=function(_0x2daf8b,_0x2e6f11){var _0x33b1e6;return db[_0x9be4('0x2e')][_0x9be4('0x5a')]({'where':{'id':_0x2daf8b[_0x9be4('0x4a')]['id']},'attributes':['id',_0x9be4('0x2a')]})['then'](handleEntityNotFound(_0x2e6f11,null))[_0x9be4('0x27')](function(_0x11efdd){if(_0x11efdd){_0x33b1e6=_0x11efdd;return db[_0x9be4('0x59')][_0x9be4('0x5e')]({'where':{'userProfileId':_0x2daf8b['params']['id'],'sectionId':_0x2daf8b[_0x9be4('0x33')][_0x9be4('0x62')]}});}})[_0x9be4('0x27')](function(){return _0x33b1e6;})[_0x9be4('0x27')](respondWithStatusCode(_0x2e6f11,null))[_0x9be4('0x48')](handleError(_0x2e6f11,null));};exports[_0x9be4('0x63')]=function(_0x862f7,_0xa93d52){var _0x193637=[];var _0x47fa7d=[];return db[_0x9be4('0x59')][_0x9be4('0x46')]({'where':{'userProfileId':_0x862f7[_0x9be4('0x4a')]['id']},'raw':!![]})[_0x9be4('0x27')](function(_0x3bae09){_0x193637=_[_0x9be4('0x3e')](_0x3bae09,function(_0x1b4ecb){return _0x1b4ecb[_0x9be4('0x64')]===0x1||_[_0x9be4('0x65')]([0x3eb,0x709],_0x1b4ecb['sectionId']);});if(!_[_0x9be4('0x66')](_0x193637)){return _[_0x9be4('0x2d')](_0x193637,function(_0x5f4246){return _0x5f4246['sectionId'];});}else{return;}})[_0x9be4('0x27')](function(_0x47a572){if(_0x47a572)_0x47fa7d=_0x47a572;if(_[_0x9be4('0x65')](_0x47fa7d,0x64)){var _0x5ae5aa=_[_0x9be4('0x5a')](_0x193637,{'sectionId':0x64});return hasDefaultDashboard(_0x5ae5aa)[_0x9be4('0x27')](function(_0x1f85ed){return _[_0x9be4('0x2d')](_0x193637,function(_0x10674a){if(_0x10674a[_0x9be4('0x5f')]===0x64){_0x10674a['subsections']=_0x1f85ed;}return _0x10674a;});});}else{return;}})[_0x9be4('0x27')](function(_0x1a32d8){if(_0x1a32d8)_0x193637=_0x1a32d8;if(_[_0x9be4('0x65')](_0x47fa7d,0x3eb)){var _0x3051ed=_['find'](_0x193637,{'sectionId':0x3eb});return getCustomDashboards(_0x3051ed)[_0x9be4('0x27')](function(_0x2bcd3e){return _[_0x9be4('0x2d')](_0x193637,function(_0x9475ea){if(_0x3051ed[_0x9be4('0x64')]){if(_0x9475ea['sectionId']===0x3eb){_0x9475ea[_0x9be4('0x67')]=_0x2bcd3e;}}else{if(_0x9475ea[_0x9be4('0x5f')]===0x64){_0x9475ea[_0x9be4('0x67')]=_0x2bcd3e;}}return _0x9475ea;});});}else{return;}})[_0x9be4('0x27')](function(_0x17bb02){if(_0x17bb02)_0x193637=_0x17bb02;if(_[_0x9be4('0x65')](_0x47fa7d,0x709)){var _0x4e0044=_['find'](_0x193637,{'sectionId':0x709});return getPlugins(_0x4e0044)['then'](function(_0x162715){if(_0x4e0044[_0x9be4('0x64')]){return _[_0x9be4('0x2d')](_0x193637,function(_0x7f7cad){if(_0x7f7cad['sectionId']===0x709){_0x7f7cad[_0x9be4('0x67')]=_0x162715;}return _0x7f7cad;});}else{var _0x423c51={'sectionId':0x76c,'enabled':0x1,'subsections':_0x162715};var _0x4d37c5=_[_0x9be4('0x2d')](_0x193637);_0x4d37c5[_0x9be4('0x60')](_0x423c51);return _0x4d37c5;}});}else{return;}})[_0x9be4('0x27')](function(_0x263cfd){if(_0x263cfd)_0x193637=_0x263cfd;return _[_0x9be4('0x3e')](_0x193637,['enabled',0x1]);})[_0x9be4('0x27')](respondWithResult(_0xa93d52,null))[_0x9be4('0x48')](handleError(_0xa93d52,null));};function hasDefaultDashboard(_0x41fce4){var _0x548d48=[0x65];return new BPromise(function(_0x5357fd,_0x26ea23){try{if(_0x41fce4[_0x9be4('0x55')]){_0x5357fd(_0x548d48);}else{return db[_0x9be4('0x56')]['findOne']({'where':{'sectionId':_0x41fce4['id']},'raw':!![]})[_0x9be4('0x27')](function(_0x3493d5){_0x3493d5?_0x5357fd(_0x548d48):_0x5357fd();});}}catch(_0x278677){_0x26ea23(_0x278677);}});}function getCustomDashboards(_0x4e0ccb){var _0x3c4c73=[];return new BPromise(function(_0x5098db,_0x579a7a){try{if(_0x4e0ccb[_0x9be4('0x55')]){return db['Dashboard']['findAll']({'raw':!![]})[_0x9be4('0x27')](function(_0x1db6e5){_0x1db6e5['forEach'](function(_0x549b25){_0x3c4c73[_0x9be4('0x60')](_0x549b25['id']+0x1869f);});_0x5098db(_0x3c4c73);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4e0ccb['id']},'raw':!![]})[_0x9be4('0x27')](function(_0x36f108){_0x36f108[_0x9be4('0x68')](function(_0x247ed0){_0x3c4c73['push'](_0x247ed0['resourceId']+0x1869f);});_0x5098db(_0x3c4c73);});}}catch(_0x32a8ae){_0x579a7a(_0x32a8ae);}});}function getPlugins(_0x405899){var _0x567c53=[];return new BPromise(function(_0x2f6a20,_0x37e2d9){try{if(_0x405899[_0x9be4('0x55')]){return db[_0x9be4('0x69')][_0x9be4('0x46')]({'raw':!![]})[_0x9be4('0x27')](function(_0x56d2b2){_0x56d2b2[_0x9be4('0x68')](function(_0x504e0b){_0x567c53[_0x9be4('0x60')](_0x504e0b['id']+0x15b38);});_0x2f6a20(_0x567c53);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x405899['id']},'raw':!![]})[_0x9be4('0x27')](function(_0x408e74){_0x408e74[_0x9be4('0x68')](function(_0x1d37f4){_0x567c53[_0x9be4('0x60')](_0x1d37f4[_0x9be4('0x6a')]+0x15b38);});_0x2f6a20(_0x567c53);});}}catch(_0x385929){_0x37e2d9(_0x385929);}});}exports['addResources']=function(_0x20a62f,_0x135532){return db[_0x9be4('0x2e')][_0x9be4('0x5a')]({'where':{'id':_0x20a62f[_0x9be4('0x4a')]['id']}})[_0x9be4('0x27')](handleEntityNotFound(_0x135532,null))[_0x9be4('0x27')](function(_0x137c39){if(_0x137c39){return db[_0x9be4('0x5d')]['transaction'](function(_0x19bc95){return db[_0x9be4('0x59')][_0x9be4('0x46')]({'where':{'userProfileId':_0x20a62f[_0x9be4('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x9be4('0x27')](function(_0x5f99b){if(_0x5f99b){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x20a62f[_0x9be4('0x4a')]['id'],'id':_['map'](_0x5f99b,function(_0x238900){return _0x238900['id'];})},'transaction':_0x19bc95});}})['then'](function(_0x4b441f){var _0xcc0708=_['map'](_0x20a62f[_0x9be4('0x4d')],function(_0x53ea49){_0x53ea49[_0x9be4('0x57')]=_0x20a62f[_0x9be4('0x4a')]['id'];return _0x53ea49;});return db[_0x9be4('0x59')][_0x9be4('0x6b')](_0xcc0708,{'raw':!![],'transaction':_0x19bc95});})[_0x9be4('0x27')](function(_0x2ce086){var _0x56b541=_[_0x9be4('0x3e')](_[_0x9be4('0x2d')](_0x2ce086,function(_0x4e56eb){return _0x4e56eb[_0x9be4('0x6c')]({'plain':!![]});}),{'includeAll':![]});if(_0x56b541){return db[_0x9be4('0x59')][_0x9be4('0x46')]({'where':{'userProfileId':_0x20a62f[_0x9be4('0x4a')]['id'],'sectionId':_[_0x9be4('0x2d')](_0x56b541,function(_0x19bd7d){return _0x19bd7d['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9be4('0x27')](function(_0x7853a7){var _0x4a3ce9=_['map'](_0x20a62f[_0x9be4('0x4d')],function(_0x5329a3){_0x5329a3[_0x9be4('0x57')]=_0x20a62f[_0x9be4('0x4a')]['id'];return _0x5329a3;});return db['UserProfileResource']['bulkCreate'](_0x4a3ce9,{'raw':!![],'transaction':_0x19bc95});});}})[_0x9be4('0x48')](handleError(_0x135532,null));});}})[_0x9be4('0x27')](function(_0x1132f3){var _0x2cc9a4=_[_0x9be4('0x2d')](_0x1132f3,function(_0x3cc113){return _0x3cc113[_0x9be4('0x6c')]({'plain':!![]});});})['then'](respondWithResult(_0x135532,null))['catch'](handleError(_0x135532,null));};exports[_0x9be4('0x6d')]=function(_0x2a1977,_0x23cbca,_0x311ca5){return db[_0x9be4('0x2e')][_0x9be4('0x5a')]({'where':{'id':_0x2a1977[_0x9be4('0x4a')]['id']}})[_0x9be4('0x27')](handleEntityNotFound(_0x23cbca,null))[_0x9be4('0x27')](function(_0x33de85){if(_0x33de85){return _0x33de85[_0x9be4('0x6d')](_0x2a1977['query']['ids']);}})[_0x9be4('0x27')](respondWithStatusCode(_0x23cbca,null))[_0x9be4('0x48')](handleError(_0x23cbca,null));};exports[_0x9be4('0x6e')]=function(_0x20e8fa,_0x211d19){var _0xf40e6b={'raw':![],'where':{}};var _0x416572={};var _0x575258={'count':0x0,'rows':[]};var _0x1d620c=_0x20e8fa[_0x9be4('0x33')]['section'];if(typeof _0x1d620c===_0x9be4('0x6f')){throw new db[(_0x9be4('0x70'))][(_0x9be4('0x71'))](_0x9be4('0x72'));}var _0x3dee00=_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x73')]||![];var _0x1f01d8=getQueryModels(_0x1d620c,_0x3dee00);if(typeof _0x1f01d8[_0x9be4('0x74')]===_0x9be4('0x6f')){throw new db['Sequelize'][(_0x9be4('0x71'))](_0x9be4('0x75')+_0x1d620c+'\x27');}var _0x3ae623=[];if(!_[_0x9be4('0x66')](_0x1f01d8[_0x9be4('0x76')])){_0x3ae623=_0x1f01d8[_0x9be4('0x76')];}else{_0x3ae623=[{'name':_0x1d620c}];}return db['UserProfile'][_0x9be4('0x77')]({'where':{'id':_0x20e8fa[_0x9be4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x211d19,null))[_0x9be4('0x27')](function(_0xe4915e){if(_0xe4915e){var _0x22098e=[];for(var _0x3260fe=0x0;_0x3260fe<_0x3ae623[_0x9be4('0x39')];_0x3260fe++){_0x22098e[_0x9be4('0x60')](db[_0x9be4('0x59')][_0x9be4('0x77')]({'where':{'userProfileId':_0xe4915e['id'],'name':_0x3ae623[_0x3260fe][_0x9be4('0x2a')]},'raw':!![]}));}return BPromise['all'](_0x22098e);}})[_0x9be4('0x27')](function(_0x1f220e){var _0x5e0474=_[_0x9be4('0x3e')](_0x1f220e,function(_0x48bb9f){return _0x48bb9f?_0x48bb9f:undefined;});var _0x3d1110=_[_0x9be4('0x3e')](_0x3ae623,[_0x9be4('0x78'),!![]]);var _0x8ddcd4=_[_0x9be4('0x66')](_0x5e0474)&&_[_0x9be4('0x66')](_0x3d1110)?null:_[_0x9be4('0x79')](_0x3d1110,_0x5e0474);if(_0x8ddcd4){var _0x17ddba=[];for(var _0x3ad701=0x0;_0x3ad701<_0x8ddcd4[_0x9be4('0x39')];_0x3ad701++){var _0x33d166=_[_0x9be4('0x5a')](_0x3ae623,function(_0x2092a9){return _0x8ddcd4[_0x3ad701]?_0x2092a9[_0x9be4('0x2a')]===_0x8ddcd4[_0x3ad701][_0x9be4('0x2a')]:null;});if(_0x33d166){if(_0x8ddcd4[_0x3ad701][_0x9be4('0x78')]){_0x17ddba[_0x9be4('0x60')](getAllResources(_0x1f01d8[_0x9be4('0x74')],_0x8ddcd4[_0x3ad701]));}else{if(!_0x8ddcd4[_0x3ad701][_0x9be4('0x55')]){_0x17ddba[_0x9be4('0x60')](getAllowedResources(_0x33d166,_0x8ddcd4[_0x3ad701],_0x1f01d8[_0x9be4('0x74')]));}else{if(_0x33d166[_0x9be4('0x32')]){_0x17ddba['push'](getAllFilteredResources(_0x33d166,_0x8ddcd4[_0x3ad701]));}}}}}return BPromise[_0x9be4('0x7a')](_0x17ddba);}else{return null;}})[_0x9be4('0x27')](function(_0x55ec39){var _0x498cf6=_0x55ec39;var _0x42d802=null;if(_0x498cf6){_0x42d802=_0x498cf6['length']===0x1?_0x498cf6[0x0]:null;}if(_0x42d802||_0x498cf6){var _0x3932a6=db[_0x1f01d8['childModel']][_0x9be4('0x2f')];_0x416572[_0x9be4('0x32')]=_[_0x9be4('0x34')](_0x3932a6);_0x416572[_0x9be4('0x33')]=_[_0x9be4('0x34')](_0x20e8fa[_0x9be4('0x33')]);_0x416572[_0x9be4('0x35')]=_[_0x9be4('0x36')](_0x416572[_0x9be4('0x32')],_0x416572[_0x9be4('0x33')]);_0xf40e6b[_0x9be4('0x37')]=_['intersection'](_0x416572['model'],qs['fields'](_0x20e8fa[_0x9be4('0x33')]['fields']));_0xf40e6b[_0x9be4('0x37')]=_0xf40e6b['attributes']['length']?_0xf40e6b[_0x9be4('0x37')]:_0x416572['model'];if(!_0x20e8fa[_0x9be4('0x33')]['hasOwnProperty'](_0x9be4('0x7b'))){_0xf40e6b[_0x9be4('0x21')]=qs[_0x9be4('0x21')](_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x21')]);_0xf40e6b[_0x9be4('0x20')]=qs[_0x9be4('0x20')](_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x20')]);}_0xf40e6b[_0x9be4('0x3b')]=qs[_0x9be4('0x3c')](_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x3c')]);_0xf40e6b[_0x9be4('0x3f')]=qs['filters'](_[_0x9be4('0x3d')](_0x20e8fa[_0x9be4('0x33')],_0x416572[_0x9be4('0x35')]));if(_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x3e')]){_0xf40e6b[_0x9be4('0x3f')]=_[_0x9be4('0x40')](_0xf40e6b['where'],{'$or':_[_0x9be4('0x2d')](_0x3932a6,function(_0x3450b5){if(_0x3450b5['type'][_0x9be4('0x31')]!==_0x9be4('0x42')){var _0x4bacc0={};_0x4bacc0[_0x3450b5[_0x9be4('0x7c')]]={'$like':'%'+_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x3e')]+'%'};return _0x4bacc0;}})});}var _0x427776=[];if(_0x42d802){var _0x277b2d=_['find'](_0x3ae623,['name',_0x42d802[_0x9be4('0x2a')]]);if(_0x277b2d['field']){var _0x524751={};if(_0x1f01d8[_0x9be4('0x74')]==='AnalyticExtractedReport'){_0x524751[_0x277b2d['foreignKey']]=_[_0x9be4('0x2d')](_0x42d802[_0x9be4('0x7d')],'id');}else{_0x524751[_0x277b2d[_0x9be4('0x7e')]]=_0x42d802['associatedResources'];}_0x427776[_0x9be4('0x60')](_0x524751);}else{_0xf40e6b[_0x9be4('0x3f')]['id']=_0x42d802[_0x9be4('0x7d')];}}else{for(var _0x4eafb9=0x0;_0x4eafb9<_0x498cf6[_0x9be4('0x39')];_0x4eafb9++){var _0x277b2d=_[_0x9be4('0x5a')](_0x3ae623,[_0x9be4('0x2a'),_0x498cf6[_0x4eafb9]['name']]);if(_0x277b2d[_0x9be4('0x7c')]){var _0x524751={};_0x524751[_0x277b2d[_0x9be4('0x7e')]]=_0x498cf6[_0x4eafb9][_0x9be4('0x7d')];_0x427776[_0x9be4('0x60')](_0x524751);}else{if(!_0xf40e6b[_0x9be4('0x3f')]['id'])_0xf40e6b['where']['id']=[];_0x498cf6[_0x4eafb9][_0x9be4('0x7d')][_0x9be4('0x68')](function(_0x4559de){_0xf40e6b[_0x9be4('0x3f')]['id'][_0x9be4('0x60')](_0x4559de);});}}}if(!_['isEmpty'](_0x427776)){_0xf40e6b[_0x9be4('0x3f')]=_['merge'](_0xf40e6b['where'],{'$and':{'$or':_0x427776}});}_0xf40e6b=_['merge']({},_0xf40e6b,_0x20e8fa[_0x9be4('0x4b')]);if(_0x42d802&&!_0x42d802[_0x9be4('0x55')]&&_0x1f01d8[_0x9be4('0x74')]===_0x9be4('0x7f')){if(_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x44')]){_0xf40e6b[_0x9be4('0x45')]=[{'all':!![]}];}return db[_0x1f01d8[_0x9be4('0x74')]]['findAll'](_0xf40e6b)[_0x9be4('0x27')](function(_0x12a713){var _0x24b325=[];_0x12a713[_0x9be4('0x68')](function(_0x547738){var _0x501dd5;switch(_0x547738['reportType']){case'default':_0x501dd5=_[_0x9be4('0x5a')](_0x42d802[_0x9be4('0x7d')],function(_0x3d5f5d){return _0x3d5f5d['id']===_0x547738['reportId']&&_0x3d5f5d['type']===_0x9be4('0x80');});break;case'custom':_0x501dd5=_[_0x9be4('0x5a')](_0x42d802['associatedResources'],function(_0x398262){return _0x398262['id']===_0x547738[_0x9be4('0x81')]&&_0x398262[_0x9be4('0x41')]===_0x9be4('0x82');});break;}if(_0x501dd5)_0x24b325[_0x9be4('0x60')](_0x547738);});_0x575258['count']=_0x24b325[_0x9be4('0x39')];_0x575258[_0x9be4('0x47')]=_0x24b325;return _0x575258;});}else{return db[_0x1f01d8[_0x9be4('0x74')]][_0x9be4('0x43')]({'where':_0xf40e6b['where']})[_0x9be4('0x27')](function(_0x2fef17){_0x575258[_0x9be4('0x43')]=_0x2fef17;if(_0x20e8fa[_0x9be4('0x33')]['includeAll']){if(_0x1f01d8[_0x9be4('0x74')]===_0x9be4('0x83')){_0xf40e6b[_0x9be4('0x45')]=[{'model':db[_0x9be4('0x84')],'as':'Tags','attributes':['id',_0x9be4('0x2a'),_0x9be4('0x85')],'required':_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x86')]?!![]:![]},{'model':db[_0x9be4('0x84')],'as':_0x9be4('0x87'),'attributes':['id','name',_0x9be4('0x85')],'through':_0x20e8fa['query'][_0x9be4('0x86')]?{'attributes':[],'where':{'TagId':_0x20e8fa[_0x9be4('0x33')][_0x9be4('0x86')]||undefined}}:{},'required':_0x20e8fa['query'][_0x9be4('0x86')]?!![]:![]}];}else{_0xf40e6b[_0x9be4('0x45')]=[{'all':!![]}];}}return db[_0x1f01d8[_0x9be4('0x74')]][_0x9be4('0x46')](_0xf40e6b);})[_0x9be4('0x27')](function(_0x309d5c){_0x575258['rows']=_0x309d5c;return _0x575258;});}}else{return _0x575258;}})[_0x9be4('0x27')](respondWithFilteredResult(_0x211d19,_0xf40e6b))[_0x9be4('0x48')](handleError(_0x211d19,null));};function getAllResources(_0x2d7d3b,_0x51c948){return new BPromise(function(_0x4b3b86,_0x187b48){if(_0x51c948){var _0x25ae96=_0x51c948['filter']?{[_0x51c948[_0x9be4('0x3e')][_0x9be4('0x7c')]]:_0x51c948['filter']['value']}:undefined;return db[_0x2d7d3b]['findAll']({'where':_0x25ae96,'raw':!![]})[_0x9be4('0x27')](function(_0x4975b8){_0x51c948[_0x9be4('0x7d')]=_[_0x9be4('0x2d')](_0x4975b8,'id');_0x4b3b86(_0x51c948);})[_0x9be4('0x48')](function(_0xe9db49){_0x187b48(_0xe9db49);});}else{_0x4b3b86(null);}});}function getAllFilteredResources(_0x3a4c66,_0x22dd20){return new BPromise(function(_0xf6c13d,_0x1d176e){var _0x51a030=_0x3a4c66[_0x9be4('0x3e')]?{[_0x3a4c66[_0x9be4('0x3e')]['field']]:_0x3a4c66['filter'][_0x9be4('0x88')]}:undefined;return db[_0x3a4c66['model']][_0x9be4('0x46')]({'where':_0x51a030,'raw':!![]})['then'](function(_0x3a557d){_0x22dd20[_0x9be4('0x7d')]=_['map'](_0x3a557d,function(_0x502f03){return _0x502f03[_0x9be4('0x2a')];});_0xf6c13d(_0x22dd20);})['catch'](function(_0x4119e6){_0x1d176e(_0x4119e6);});});}function getAllowedResources(_0x1459ed,_0x514ee3,_0x397f18){return new BPromise(function(_0x10bd4e,_0x12d76a){if(_0x514ee3){return db[_0x9be4('0x56')][_0x9be4('0x46')]({'where':{'sectionId':_0x514ee3['id']},'raw':!![]})[_0x9be4('0x27')](function(_0x709cb8){if(_0x1459ed[_0x9be4('0x7c')]&&_0x1459ed['field']!=='id'){_0x514ee3['associatedResources']=_[_0x9be4('0x2d')](_0x709cb8,function(_0x42f6b5){return _0x42f6b5[_0x1459ed['field']];});}else{if(_0x397f18==='AnalyticExtractedReport'){_0x514ee3[_0x9be4('0x7d')]=_[_0x9be4('0x2d')](_0x709cb8,function(_0x5e35ff){return{'id':_0x5e35ff[_0x9be4('0x6a')],'type':_0x5e35ff['type']};});}else{_0x514ee3[_0x9be4('0x7d')]=_[_0x9be4('0x2d')](_0x709cb8,function(_0x4964e2){return _0x4964e2['resourceId'];});}}_0x10bd4e(_0x514ee3);})['catch'](function(_0x3f0bf4){_0x12d76a(_0x3f0bf4);});}else{_0x10bd4e(null);}});}function getQueryModels(_0x225ebb,_0x42e051){var _0x2547f6=_0x225ebb[_0x9be4('0x89')]();var _0x4cec3c={'childModel':undefined,'parentSections':[]};switch(_0x2547f6){case _0x9be4('0x8a'):_0x4cec3c['childModel']='SquareProject';break;case _0x9be4('0x8b'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x8c');break;case _0x9be4('0x8d'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x8e');_0x4cec3c['parentSections']=[{'name':_0x9be4('0x8f'),'field':_0x9be4('0x2a'),'foreignKey':'projectName'}];break;case _0x9be4('0x90'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x91');break;case _0x9be4('0x92'):_0x4cec3c[_0x9be4('0x74')]='CmContact';_0x4cec3c[_0x9be4('0x76')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x9be4('0x93'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x94');break;case'companies':_0x4cec3c['childModel']=_0x9be4('0x95');break;case'globalcustomfields':_0x4cec3c['childModel']=_0x9be4('0x96');break;case _0x9be4('0x97'):_0x4cec3c[_0x9be4('0x74')]='ChatQueue';break;case _0x9be4('0x98'):_0x4cec3c[_0x9be4('0x74')]='ChatWebsite';break;case'faxqueues':_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x99');break;case _0x9be4('0x9a'):_0x4cec3c[_0x9be4('0x74')]='FaxAccount';break;case'inboundroutes':case _0x9be4('0x9b'):case'outboundroutes':_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x9c');break;case _0x9be4('0x9d'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x9e');break;case _0x9be4('0x9f'):_0x4cec3c['childModel']='VoiceMail';break;case _0x9be4('0xa0'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xa1');_0x4cec3c[_0x9be4('0x76')]=[{'name':_0x9be4('0xa2'),'field':'name','foreignKey':_0x9be4('0xa3'),'model':'User','filter':{'field':_0x9be4('0xa4'),'value':[_0x9be4('0xa5')]}},{'name':_0x9be4('0xa6'),'field':_0x9be4('0x2a'),'foreignKey':'membername','model':_0x9be4('0xa7'),'filter':{'field':_0x9be4('0xa4'),'value':[_0x9be4('0xa8')]}},{'name':_0x9be4('0xa9'),'field':_0x9be4('0x2a'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0x9be4('0xaa')]}},{'name':_0x9be4('0xab'),'field':_0x9be4('0x2a'),'foreignKey':_0x9be4('0xac'),'model':_0x9be4('0xad'),'filter':{'field':_0x9be4('0x41'),'value':['outbound']}}];break;case _0x9be4('0xae'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xaf');break;case _0x9be4('0xb0'):_0x4cec3c['childModel']=_0x9be4('0xb1');break;case _0x9be4('0xb2'):_0x4cec3c['childModel']=_0x9be4('0xb3');break;case _0x9be4('0xb4'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xb5');break;case _0x9be4('0xb6'):_0x4cec3c['childModel']='MailQueue';break;case _0x9be4('0xb7'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xb8');break;case'mailsubstatuses':_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xb9');break;case _0x9be4('0xba'):_0x4cec3c['childModel']=_0x9be4('0xbb');break;case _0x9be4('0xbc'):_0x4cec3c['childModel']='OpenchannelAccount';break;case _0x9be4('0xbd'):_0x4cec3c[_0x9be4('0x74')]='SmsQueue';break;case'smsaccounts':_0x4cec3c['childModel']=_0x9be4('0xbe');break;case _0x9be4('0xbf'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xc0');break;case _0x9be4('0xc1'):_0x4cec3c['childModel']=_0x9be4('0xc2');break;case _0x9be4('0xc3'):_0x4cec3c['childModel']=_0x9be4('0xc4');break;case _0x9be4('0xc5'):case _0x9be4('0xc6'):_0x4cec3c['childModel']=_0x9be4('0xad');if(_0x42e051){_0x4cec3c[_0x9be4('0x76')]=[{'name':_0x9be4('0xa9')},{'name':_0x9be4('0xab')}];}break;case _0x9be4('0xc7'):case _0x9be4('0xc8'):case'telephones':_0x4cec3c[_0x9be4('0x74')]='User';if(_0x42e051){_0x4cec3c[_0x9be4('0x76')]=[{'name':_0x9be4('0xc9'),'filter':{'field':_0x9be4('0xa4'),'value':[_0x9be4('0xca'),_0x9be4('0xcb')]},'ignore':!![]},{'name':_0x9be4('0xa2')},{'name':_0x9be4('0xa6')}];}break;case _0x9be4('0xcc'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xcd');break;case _0x9be4('0xce'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xcf');break;case _0x9be4('0xd0'):_0x4cec3c[_0x9be4('0x74')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xd1');break;case _0x9be4('0xd2'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xd3');break;case _0x9be4('0xd4'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xd5');break;case _0x9be4('0xd6'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xa7');break;case'cannedanswers':_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xd7');break;case _0x9be4('0xd8'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xd9');break;case _0x9be4('0xda'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xdb');break;case _0x9be4('0xdc'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xdd');break;case'pauses':_0x4cec3c[_0x9be4('0x74')]='Pause';break;case _0x9be4('0xde'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xdf');break;case _0x9be4('0xe0'):_0x4cec3c['childModel']='Sound';break;case'tags':_0x4cec3c[_0x9be4('0x74')]='Tag';break;case'templates':_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xe1');break;case _0x9be4('0xe2'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xe3');break;case _0x9be4('0xe4'):_0x4cec3c['childModel']=_0x9be4('0xe5');break;case _0x9be4('0xe6'):_0x4cec3c['childModel']='Variable';break;case _0x9be4('0xe7'):_0x4cec3c[_0x9be4('0x74')]='Plugin';break;case _0x9be4('0xe8'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0x7f');_0x4cec3c[_0x9be4('0x76')]=[{'name':_0x9be4('0xe9'),'field':'id','foreignKey':_0x9be4('0x81')}];break;case _0x9be4('0xea'):_0x4cec3c[_0x9be4('0x74')]='AnalyticMetric';break;case _0x9be4('0xc1'):_0x4cec3c[_0x9be4('0x74')]=_0x9be4('0xc2');break;default:return _0x4cec3c;}return _0x4cec3c;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5fffc9e..5f0b025 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 _0x27e2=['emit','hook','exports','events','../../mysqldb','UserProfile','save','update'];(function(_0x52c7d1,_0x52de12){var _0x38c4a4=function(_0x3775f5){while(--_0x3775f5){_0x52c7d1['push'](_0x52c7d1['shift']());}};_0x38c4a4(++_0x52de12);}(_0x27e2,0x17b));var _0x227e=function(_0x5ee379,_0x3bc2fb){_0x5ee379=_0x5ee379-0x0;var _0x366e30=_0x27e2[_0x5ee379];return _0x366e30;};'use strict';var EventEmitter=require(_0x227e('0x0'));var UserProfile=require(_0x227e('0x1'))['db'][_0x227e('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x227e('0x3'),'afterUpdate':_0x227e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e724a){return function(_0x3d5aa8,_0x33e037,_0x105ccb){UserProfileEvents[_0x227e('0x5')](_0x2e724a+':'+_0x3d5aa8['id'],_0x3d5aa8);UserProfileEvents[_0x227e('0x5')](_0x2e724a,_0x3d5aa8);_0x105ccb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x227e('0x6')](e,emitEvent(event));}}module[_0x227e('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xfdb3=['../../mysqldb','save','update','emit','hasOwnProperty','hook','events'];(function(_0x2c0b5c,_0x2de2b0){var _0x331c54=function(_0x25251b){while(--_0x25251b){_0x2c0b5c['push'](_0x2c0b5c['shift']());}};_0x331c54(++_0x2de2b0);}(_0xfdb3,0x13a));var _0x3fdb=function(_0x5c8fba,_0x5b53c3){_0x5c8fba=_0x5c8fba-0x0;var _0x4d8e47=_0xfdb3[_0x5c8fba];return _0x4d8e47;};'use strict';var EventEmitter=require(_0x3fdb('0x0'));var UserProfile=require(_0x3fdb('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3fdb('0x2'),'afterUpdate':_0x3fdb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x23b68e){return function(_0x429257,_0x563644,_0x6841b6){UserProfileEvents[_0x3fdb('0x4')](_0x23b68e+':'+_0x429257['id'],_0x429257);UserProfileEvents['emit'](_0x23b68e,_0x429257);_0x6841b6(null);};}for(var e in events){if(events[_0x3fdb('0x5')](e)){var event=events[e];UserProfile[_0x3fdb('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0519f25..c3c93a1 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 _0x99b4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserProfile','util','api'];(function(_0x22fb64,_0x4726c3){var _0x22ba57=function(_0x9f4e7f){while(--_0x9f4e7f){_0x22fb64['push'](_0x22fb64['shift']());}};_0x22ba57(++_0x4726c3);}(_0x99b4,0xa8));var _0x499b=function(_0x41451f,_0x1c5b9c){_0x41451f=_0x41451f-0x0;var _0x2b288f=_0x99b4[_0x41451f];return _0x2b288f;};'use strict';var _=require('lodash');var util=require(_0x499b('0x0'));var logger=require('../../config/logger')(_0x499b('0x1'));var moment=require(_0x499b('0x2'));var BPromise=require(_0x499b('0x3'));var rp=require(_0x499b('0x4'));var fs=require('fs');var path=require(_0x499b('0x5'));var rimraf=require(_0x499b('0x6'));var config=require(_0x499b('0x7'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x4a44a5,_0x5ebf63){return _0x4a44a5[_0x499b('0x8')](_0x499b('0x9'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['./userProfile.attributes','exports','define','UserProfile','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x358883,_0x427605){var _0x776b01=function(_0x1e2b81){while(--_0x1e2b81){_0x358883['push'](_0x358883['shift']());}};_0x776b01(++_0x427605);}(_0xc4aa,0x164));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xac4a('0x2'));var rp=require(_0xac4a('0x3'));var fs=require('fs');var path=require(_0xac4a('0x4'));var rimraf=require(_0xac4a('0x5'));var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x4b6dd0,_0x2f927f){return _0x4b6dd0[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 34638f9..476c382 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 _0xd8fb=['http','defaults','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xf4b94a,_0x4929a9){var _0x2bf1ec=function(_0x13ac58){while(--_0x13ac58){_0xf4b94a['push'](_0xf4b94a['shift']());}};_0x2bf1ec(++_0x4929a9);}(_0xd8fb,0x99));var _0xbd8f=function(_0x53a3d8,_0x24079a){_0x53a3d8=_0x53a3d8-0x0;var _0x263b48=_0xd8fb[_0x53a3d8];return _0x263b48;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});config['redis']=_[_0xbd8f('0x9')](config['redis'],{'host':_0xbd8f('0xa'),'port':0x18eb});var socket=require(_0xbd8f('0xb'))(new Redis(config['redis']));require('./userProfile.socket')[_0xbd8f('0xc')](socket);function respondWithRpcPromise(_0x2393a9,_0x2a55b5,_0x53a2c6){return new BPromise(function(_0x255af3,_0x42ae20){return client['request'](_0x2393a9,_0x53a2c6)['then'](function(_0x342bcb){logger[_0xbd8f('0xd')](_0xbd8f('0xe'),_0x2a55b5,'request\x20sent');logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x2a55b5,_0xbd8f('0x11'),JSON[_0xbd8f('0x12')](_0x342bcb));if(_0x342bcb[_0xbd8f('0x13')]){if(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x14')]===0x1f4){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x2a55b5,_0x342bcb['error'][_0xbd8f('0x15')]);return _0x42ae20(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);}logger[_0xbd8f('0x13')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);return _0x255af3(_0x342bcb['error'][_0xbd8f('0x15')]);}else{logger[_0xbd8f('0xd')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0xbd8f('0x11'));_0x255af3(_0x342bcb[_0xbd8f('0x16')]['message']);}})['catch'](function(_0x33f77c){logger['error']('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x33f77c);_0x42ae20(_0x33f77c);});});} \ No newline at end of file +var _0x71ab=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','stringify','error','message','UserProfile,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3f9977,_0x5e0507){var _0x101965=function(_0x292340){while(--_0x292340){_0x3f9977['push'](_0x3f9977['shift']());}};_0x101965(++_0x5e0507);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});config[_0xb71a('0xb')]=_[_0xb71a('0xc')](config[_0xb71a('0xb')],{'host':_0xb71a('0xd'),'port':0x18eb});var socket=require(_0xb71a('0xe'))(new Redis(config[_0xb71a('0xb')]));require(_0xb71a('0xf'))[_0xb71a('0x10')](socket);function respondWithRpcPromise(_0x2e8883,_0x517eed,_0xfec897){return new BPromise(function(_0x58956d,_0x3d7bd7){return client[_0xb71a('0x11')](_0x2e8883,_0xfec897)[_0xb71a('0x12')](function(_0x591311){logger[_0xb71a('0x13')]('UserProfile,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'),JSON[_0xb71a('0x15')](_0x591311));if(_0x591311[_0xb71a('0x16')]){if(_0x591311[_0xb71a('0x16')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x3d7bd7(_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);}logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x58956d(_0x591311[_0xb71a('0x16')]['message']);}else{logger[_0xb71a('0x13')](_0xb71a('0x18'),_0x517eed,_0xb71a('0x14'));_0x58956d(_0x591311[_0xb71a('0x19')][_0xb71a('0x17')]);}})[_0xb71a('0x1a')](function(_0x349de1){logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x349de1);_0x3d7bd7(_0x349de1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9f4fb6d..bb08809 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 _0x0b64=['register','./userProfile.events','remove','removeListener'];(function(_0x187eae,_0x4680c7){var _0x455f40=function(_0x577553){while(--_0x577553){_0x187eae['push'](_0x187eae['shift']());}};_0x455f40(++_0x4680c7);}(_0x0b64,0x1b5));var _0x40b6=function(_0x24ce58,_0x5d8311){_0x24ce58=_0x24ce58-0x0;var _0x206d11=_0x0b64[_0x24ce58];return _0x206d11;};'use strict';var UserProfileEvents=require(_0x40b6('0x0'));var events=['save',_0x40b6('0x1'),'update'];function createListener(_0x1425c5,_0x3947ba){return function(_0x567dd5){_0x3947ba['emit'](_0x1425c5,_0x567dd5);};}function removeListener(_0x2d0ab1,_0xa797c2){return function(){UserProfileEvents[_0x40b6('0x2')](_0x2d0ab1,_0xa797c2);};}exports[_0x40b6('0x3')]=function(_0x5765bd){for(var _0x2fe593=0x0,_0x5c72f1=events['length'];_0x2fe593<_0x5c72f1;_0x2fe593++){var _0x48b742=events[_0x2fe593];var _0x5c6a1c=createListener('userProfile:'+_0x48b742,_0x5765bd);UserProfileEvents['on'](_0x48b742,_0x5c6a1c);}}; \ No newline at end of file +var _0xc1f6=['./userProfile.events','save','update','emit','removeListener','length'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc1f6,0xae));var _0x6c1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1f6[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0x6c1f('0x0'));var events=[_0x6c1f('0x1'),'remove',_0x6c1f('0x2')];function createListener(_0xa80c75,_0x4211d6){return function(_0xc04b51){_0x4211d6[_0x6c1f('0x3')](_0xa80c75,_0xc04b51);};}function removeListener(_0x4d7d0c,_0x50b845){return function(){UserProfileEvents[_0x6c1f('0x4')](_0x4d7d0c,_0x50b845);};}exports['register']=function(_0x531749){for(var _0x22071e=0x0,_0x4cec78=events[_0x6c1f('0x5')];_0x22071e<_0x4cec78;_0x22071e++){var _0x1ee33b=events[_0x22071e];var _0x4626ee=createListener('userProfile:'+_0x1ee33b,_0x531749);UserProfileEvents['on'](_0x1ee33b,_0x4626ee);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1011c04..ba8c349 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 _0x88b6=['create','put','isAuthenticated','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./userProfileResource.controller','get','/describe','describe','show','post'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x88b6,0x196));var _0x688b=function(_0x3c8744,_0x4e3b5b){_0x3c8744=_0x3c8744-0x0;var _0x50affd=_0x88b6[_0x3c8744];return _0x50affd;};'use strict';var multer=require(_0x688b('0x0'));var util=require(_0x688b('0x1'));var path=require(_0x688b('0x2'));var timeout=require('connect-timeout');var express=require(_0x688b('0x3'));var router=express[_0x688b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x688b('0x5'));var config=require('../../config/environment');var controller=require(_0x688b('0x6'));router[_0x688b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x688b('0x7')](_0x688b('0x8'),auth['isAuthenticated'](),controller[_0x688b('0x9')]);router[_0x688b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x688b('0xa')]);router[_0x688b('0xb')]('/',auth['isAuthenticated'](),controller[_0x688b('0xc')]);router[_0x688b('0xd')]('/:id',auth[_0x688b('0xe')](),controller['update']);router[_0x688b('0xf')](_0x688b('0x10'),auth[_0x688b('0xe')](),controller[_0x688b('0x11')]);module[_0x688b('0x12')]=router; \ No newline at end of file +var _0x60aa=['../../components/interaction/service','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x17b23c,_0x423472){var _0x3af1b4=function(_0x34e307){while(--_0x34e307){_0x17b23c['push'](_0x17b23c['shift']());}};_0x3af1b4(++_0x423472);}(_0x60aa,0x13e));var _0xa60a=function(_0x31d4c3,_0x26b370){_0x31d4c3=_0x31d4c3-0x0;var _0x5dcfe1=_0x60aa[_0x31d4c3];return _0x5dcfe1;};'use strict';var multer=require('multer');var util=require(_0xa60a('0x0'));var path=require('path');var timeout=require(_0xa60a('0x1'));var express=require(_0xa60a('0x2'));var router=express[_0xa60a('0x3')]();var auth=require(_0xa60a('0x4'));var interaction=require(_0xa60a('0x5'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xa60a('0x6')]('/',auth[_0xa60a('0x7')](),controller[_0xa60a('0x8')]);router[_0xa60a('0x6')]('/describe',auth[_0xa60a('0x7')](),controller[_0xa60a('0x9')]);router['get']('/:id',auth[_0xa60a('0x7')](),controller[_0xa60a('0xa')]);router[_0xa60a('0xb')]('/',auth[_0xa60a('0x7')](),controller[_0xa60a('0xc')]);router[_0xa60a('0xd')](_0xa60a('0xe'),auth[_0xa60a('0x7')](),controller[_0xa60a('0xf')]);router[_0xa60a('0x10')](_0xa60a('0xe'),auth['isAuthenticated'](),controller[_0xa60a('0x11')]);module[_0xa60a('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3fa7dfe..ac1509c 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 _0xd967=['INTEGER','sequelize','exports','STRING'];(function(_0x3c325d,_0x318e45){var _0x1b77da=function(_0x57c52b){while(--_0x57c52b){_0x3c325d['push'](_0x3c325d['shift']());}};_0x1b77da(++_0x318e45);}(_0xd967,0xc9));var _0x7d96=function(_0x4ccf7f,_0x161ffd){_0x4ccf7f=_0x4ccf7f-0x0;var _0x1953f0=_0xd967[_0x4ccf7f];return _0x1953f0;};'use strict';var Sequelize=require(_0x7d96('0x0'));module[_0x7d96('0x1')]={'name':{'type':Sequelize[_0x7d96('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7d96('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7d96('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7bbe=['INTEGER','sequelize','exports','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x7bbe,0x89));var _0xe7bb=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x7bbe[_0xdd82b4];return _0x549bb2;};'use strict';var Sequelize=require(_0xe7bb('0x0'));module[_0xe7bb('0x1')]={'name':{'type':Sequelize[_0xe7bb('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe7bb('0x3')],'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 6670d53..605d518 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 _0xf2ca=['util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','type','filter','options','UserProfileResource','count','includeAll','include','rows','catch','show','params','length','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3e27ba,_0x46b120){_0x3e27ba=_0x3e27ba-0x0;var _0x10b3f2=_0xf2ca[_0x3e27ba];return _0x10b3f2;};'use strict';var pdf=require(_0xaf2c('0x0'));var emlformat=require(_0xaf2c('0x1'));var rimraf=require(_0xaf2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2c('0x3'));var rp=require(_0xaf2c('0x4'));var moment=require(_0xaf2c('0x5'));var BPromise=require(_0xaf2c('0x6'));var Mustache=require(_0xaf2c('0x7'));var util=require(_0xaf2c('0x8'));var path=require('path');var sox=require(_0xaf2c('0x9'));var csv=require(_0xaf2c('0xa'));var ejs=require(_0xaf2c('0xb'));var fs=require('fs');var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0xa'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=_0x6ac8e['count'],_0x26bf7b=_0x1d0633[_0xaf2c('0x1c')],_0x3432e4=_0x1d0633['offset']+_0x1d0633[_0xaf2c('0x1d')],_0x705d09;if(_0x3432e4>=_0x2b4d13){_0x3432e4=_0x2b4d13;_0x705d09=0xc8;}else{_0x705d09=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x705d09);return _0x2119c8[_0xaf2c('0x1e')]('Content-Range',_0x26bf7b+'-'+_0x3432e4+'/'+_0x2b4d13)[_0xaf2c('0x1b')](_0x6ac8e);}return null;};}function patchUpdates(_0x297bcd){return function(_0x1fec4c){try{jsonpatch[_0xaf2c('0x1f')](_0x1fec4c,_0x297bcd,!![]);}catch(_0x3f977c){return BPromise[_0xaf2c('0x20')](_0x3f977c);}return _0x1fec4c['save']();};}function saveUpdates(_0x35e712,_0x164bcb){return function(_0x8ffe13){if(_0x8ffe13){return _0x8ffe13[_0xaf2c('0x21')](_0x35e712)[_0xaf2c('0x22')](function(_0x486de2){return _0x486de2;});}return null;};}function removeEntity(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['destroy']()['then'](function(){_0x396646[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x1cafad,_0x99f78d){return function(_0x591aff){if(!_0x591aff){_0x1cafad[_0xaf2c('0x18')](0x194);}return _0x591aff;};}function handleError(_0xf1a7cf,_0x3a0145){_0x3a0145=_0x3a0145||0x1f4;return function(_0x3c1ae6){logger[_0xaf2c('0x23')](_0x3c1ae6[_0xaf2c('0x24')]);if(_0x3c1ae6[_0xaf2c('0x25')]){delete _0x3c1ae6['name'];}_0xf1a7cf[_0xaf2c('0x19')](_0x3a0145)[_0xaf2c('0x26')](_0x3c1ae6);};}exports[_0xaf2c('0x27')]=function(_0x410536,_0x4b7cf2){var _0x3fb190={},_0x589d47={},_0x38db1b={'count':0x0,'rows':[]};var _0x42f980=_[_0xaf2c('0x28')](db['UserProfileResource'][_0xaf2c('0x29')],function(_0x2ea490){return{'name':_0x2ea490[_0xaf2c('0x2a')],'type':_0x2ea490['type'][_0xaf2c('0x2b')]};});_0x589d47[_0xaf2c('0x2c')]=_[_0xaf2c('0x28')](_0x42f980,_0xaf2c('0x25'));_0x589d47['query']=_[_0xaf2c('0x2d')](_0x410536[_0xaf2c('0x2e')]);_0x589d47[_0xaf2c('0x2f')]=_['intersection'](_0x589d47['model'],_0x589d47[_0xaf2c('0x2e')]);_0x3fb190['attributes']=_[_0xaf2c('0x30')](_0x589d47['model'],qs[_0xaf2c('0x31')](_0x410536[_0xaf2c('0x2e')]['fields']));_0x3fb190[_0xaf2c('0x32')]=_0x3fb190[_0xaf2c('0x32')]['length']?_0x3fb190[_0xaf2c('0x32')]:_0x589d47[_0xaf2c('0x2c')];if(!_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x33')](_0xaf2c('0x34'))){_0x3fb190[_0xaf2c('0x1d')]=qs['limit'](_0x410536[_0xaf2c('0x2e')]['limit']);_0x3fb190[_0xaf2c('0x1c')]=qs['offset'](_0x410536[_0xaf2c('0x2e')]['offset']);}_0x3fb190[_0xaf2c('0x35')]=qs['sort'](_0x410536[_0xaf2c('0x2e')]['sort']);_0x3fb190[_0xaf2c('0x36')]=qs[_0xaf2c('0x2f')](_[_0xaf2c('0x37')](_0x410536[_0xaf2c('0x2e')],_0x589d47[_0xaf2c('0x2f')]),_0x42f980);if(_0x410536['query']['filter']){_0x3fb190[_0xaf2c('0x36')]=_[_0xaf2c('0x38')](_0x3fb190[_0xaf2c('0x36')],{'$or':_[_0xaf2c('0x28')](_0x42f980,function(_0x4eeecf){if(_0x4eeecf[_0xaf2c('0x39')]!=='VIRTUAL'){var _0xa1248e={};_0xa1248e[_0x4eeecf[_0xaf2c('0x25')]]={'$like':'%'+_0x410536['query'][_0xaf2c('0x3a')]+'%'};return _0xa1248e;}})});}_0x3fb190=_[_0xaf2c('0x38')]({},_0x3fb190,_0x410536[_0xaf2c('0x3b')]);var _0x71c597={'where':_0x3fb190[_0xaf2c('0x36')]};return db[_0xaf2c('0x3c')][_0xaf2c('0x3d')](_0x71c597)[_0xaf2c('0x22')](function(_0x296ca8){_0x38db1b[_0xaf2c('0x3d')]=_0x296ca8;if(_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x3fb190[_0xaf2c('0x3f')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x3fb190);})['then'](function(_0x189809){_0x38db1b[_0xaf2c('0x40')]=_0x189809;return _0x38db1b;})[_0xaf2c('0x22')](respondWithFilteredResult(_0x4b7cf2,_0x3fb190))[_0xaf2c('0x41')](handleError(_0x4b7cf2,null));};exports[_0xaf2c('0x42')]=function(_0x29460c,_0x51c441){var _0x1d58bd={'raw':![],'where':{'id':_0x29460c[_0xaf2c('0x43')]['id']}},_0x78632a={};_0x78632a['model']=_['keys'](db[_0xaf2c('0x3c')]['rawAttributes']);_0x78632a[_0xaf2c('0x2e')]=_[_0xaf2c('0x2d')](_0x29460c[_0xaf2c('0x2e')]);_0x78632a[_0xaf2c('0x2f')]=_['intersection'](_0x78632a[_0xaf2c('0x2c')],_0x78632a['query']);_0x1d58bd[_0xaf2c('0x32')]=_[_0xaf2c('0x30')](_0x78632a['model'],qs[_0xaf2c('0x31')](_0x29460c['query'][_0xaf2c('0x31')]));_0x1d58bd[_0xaf2c('0x32')]=_0x1d58bd[_0xaf2c('0x32')][_0xaf2c('0x44')]?_0x1d58bd[_0xaf2c('0x32')]:_0x78632a[_0xaf2c('0x2c')];if(_0x29460c[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x1d58bd[_0xaf2c('0x3f')]=[{'all':!![]}];}_0x1d58bd=_['merge']({},_0x1d58bd,_0x29460c['options']);return db[_0xaf2c('0x3c')]['find'](_0x1d58bd)['then'](handleEntityNotFound(_0x51c441,null))['then'](respondWithResult(_0x51c441,null))[_0xaf2c('0x41')](handleError(_0x51c441,null));};exports[_0xaf2c('0x45')]=function(_0x3cabd4,_0x35315e){return db['UserProfileResource'][_0xaf2c('0x45')](_0x3cabd4['body'],{})[_0xaf2c('0x22')](respondWithResult(_0x35315e,0xc9))['catch'](handleError(_0x35315e,null));};exports[_0xaf2c('0x21')]=function(_0x133e8c,_0x2d01b7){if(_0x133e8c[_0xaf2c('0x46')]['id']){delete _0x133e8c[_0xaf2c('0x46')]['id'];}return db['UserProfileResource'][_0xaf2c('0x47')]({'where':{'id':_0x133e8c[_0xaf2c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d01b7,null))['then'](saveUpdates(_0x133e8c[_0xaf2c('0x46')],null))['then'](respondWithResult(_0x2d01b7,null))[_0xaf2c('0x41')](handleError(_0x2d01b7,null));};exports[_0xaf2c('0x48')]=function(_0x17b9ec,_0x315b9f){return db[_0xaf2c('0x3c')][_0xaf2c('0x47')]({'where':{'id':_0x17b9ec[_0xaf2c('0x43')]['id']}})[_0xaf2c('0x22')](handleEntityNotFound(_0x315b9f,null))[_0xaf2c('0x22')](removeEntity(_0x315b9f,null))[_0xaf2c('0x41')](handleError(_0x315b9f,null));};exports[_0xaf2c('0x49')]=function(_0x5bf349,_0x22919a){return db[_0xaf2c('0x3c')]['describe']()['then'](respondWithResult(_0x22919a,null))['catch'](handleError(_0x22919a,null));}; \ No newline at end of file +var _0x7217=['reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','count','includeAll','include','rows','catch','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x33711e,_0x57999f){var _0x5816e3=function(_0x209f5e){while(--_0x209f5e){_0x33711e['push'](_0x33711e['shift']());}};_0x5816e3(++_0x57999f);}(_0x7217,0x19e));var _0x7721=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7217[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=_0x4b183e['count'],_0x25a628=_0x4e199a[_0x7721('0x1f')],_0x3cc909=_0x4e199a['offset']+_0x4e199a[_0x7721('0x20')],_0x32550d;if(_0x3cc909>=_0x5ed54){_0x3cc909=_0x5ed54;_0x32550d=0xc8;}else{_0x32550d=0xce;}_0x534f1b['status'](_0x32550d);return _0x534f1b[_0x7721('0x21')](_0x7721('0x22'),_0x25a628+'-'+_0x3cc909+'/'+_0x5ed54)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0x3e140d){return function(_0x2286e5){try{jsonpatch[_0x7721('0x23')](_0x2286e5,_0x3e140d,!![]);}catch(_0x402820){return BPromise[_0x7721('0x24')](_0x402820);}return _0x2286e5[_0x7721('0x25')]();};}function saveUpdates(_0xaeccc4,_0x4ce1db){return function(_0x288f7e){if(_0x288f7e){return _0x288f7e[_0x7721('0x26')](_0xaeccc4)[_0x7721('0x27')](function(_0xd8ad3c){return _0xd8ad3c;});}return null;};}function removeEntity(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')]()[_0x7721('0x27')](function(){_0x57140c[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x121cc4,_0x395b15){return function(_0x2c6b7b){if(!_0x2c6b7b){_0x121cc4['sendStatus'](0x194);}return _0x2c6b7b;};}function handleError(_0x216f20,_0x1abedb){_0x1abedb=_0x1abedb||0x1f4;return function(_0x125564){logger[_0x7721('0x29')](_0x125564[_0x7721('0x2a')]);if(_0x125564[_0x7721('0x2b')]){delete _0x125564[_0x7721('0x2b')];}_0x216f20[_0x7721('0x1c')](_0x1abedb)[_0x7721('0x2c')](_0x125564);};}exports['index']=function(_0x258ddf,_0x5b0551){var _0x499b87={},_0x315202={},_0x343c19={'count':0x0,'rows':[]};var _0x53c904=_[_0x7721('0x2d')](db[_0x7721('0x2e')][_0x7721('0x2f')],function(_0xd7d703){return{'name':_0xd7d703[_0x7721('0x30')],'type':_0xd7d703['type'][_0x7721('0x31')]};});_0x315202[_0x7721('0x32')]=_['map'](_0x53c904,'name');_0x315202[_0x7721('0x33')]=_[_0x7721('0x34')](_0x258ddf['query']);_0x315202[_0x7721('0x35')]=_[_0x7721('0x36')](_0x315202[_0x7721('0x32')],_0x315202['query']);_0x499b87[_0x7721('0x37')]=_[_0x7721('0x36')](_0x315202[_0x7721('0x32')],qs[_0x7721('0x38')](_0x258ddf[_0x7721('0x33')]['fields']));_0x499b87[_0x7721('0x37')]=_0x499b87[_0x7721('0x37')][_0x7721('0x39')]?_0x499b87['attributes']:_0x315202[_0x7721('0x32')];if(!_0x258ddf[_0x7721('0x33')]['hasOwnProperty'](_0x7721('0x3a'))){_0x499b87['limit']=qs[_0x7721('0x20')](_0x258ddf[_0x7721('0x33')][_0x7721('0x20')]);_0x499b87[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x258ddf[_0x7721('0x33')][_0x7721('0x1f')]);}_0x499b87[_0x7721('0x3b')]=qs[_0x7721('0x3c')](_0x258ddf[_0x7721('0x33')][_0x7721('0x3c')]);_0x499b87['where']=qs[_0x7721('0x35')](_['pick'](_0x258ddf[_0x7721('0x33')],_0x315202[_0x7721('0x35')]),_0x53c904);if(_0x258ddf[_0x7721('0x33')][_0x7721('0x3d')]){_0x499b87[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0x499b87['where'],{'$or':_['map'](_0x53c904,function(_0x4cadef){if(_0x4cadef['type']!==_0x7721('0x40')){var _0x1b3f8d={};_0x1b3f8d[_0x4cadef[_0x7721('0x2b')]]={'$like':'%'+_0x258ddf[_0x7721('0x33')]['filter']+'%'};return _0x1b3f8d;}})});}_0x499b87=_[_0x7721('0x3f')]({},_0x499b87,_0x258ddf['options']);var _0xfab37b={'where':_0x499b87[_0x7721('0x3e')]};return db['UserProfileResource'][_0x7721('0x41')](_0xfab37b)[_0x7721('0x27')](function(_0x4e77ff){_0x343c19['count']=_0x4e77ff;if(_0x258ddf[_0x7721('0x33')][_0x7721('0x42')]){_0x499b87[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x2e')]['findAll'](_0x499b87);})[_0x7721('0x27')](function(_0x120de9){_0x343c19[_0x7721('0x44')]=_0x120de9;return _0x343c19;})[_0x7721('0x27')](respondWithFilteredResult(_0x5b0551,_0x499b87))[_0x7721('0x45')](handleError(_0x5b0551,null));};exports['show']=function(_0x490d4,_0x4a2c28){var _0xaa3216={'raw':![],'where':{'id':_0x490d4[_0x7721('0x46')]['id']}},_0x4a5b59={};_0x4a5b59[_0x7721('0x32')]=_[_0x7721('0x34')](db['UserProfileResource'][_0x7721('0x2f')]);_0x4a5b59[_0x7721('0x33')]=_[_0x7721('0x34')](_0x490d4['query']);_0x4a5b59[_0x7721('0x35')]=_[_0x7721('0x36')](_0x4a5b59[_0x7721('0x32')],_0x4a5b59[_0x7721('0x33')]);_0xaa3216[_0x7721('0x37')]=_[_0x7721('0x36')](_0x4a5b59[_0x7721('0x32')],qs['fields'](_0x490d4['query'][_0x7721('0x38')]));_0xaa3216[_0x7721('0x37')]=_0xaa3216[_0x7721('0x37')][_0x7721('0x39')]?_0xaa3216[_0x7721('0x37')]:_0x4a5b59[_0x7721('0x32')];if(_0x490d4[_0x7721('0x33')][_0x7721('0x42')]){_0xaa3216[_0x7721('0x43')]=[{'all':!![]}];}_0xaa3216=_[_0x7721('0x3f')]({},_0xaa3216,_0x490d4['options']);return db['UserProfileResource'][_0x7721('0x47')](_0xaa3216)[_0x7721('0x27')](handleEntityNotFound(_0x4a2c28,null))[_0x7721('0x27')](respondWithResult(_0x4a2c28,null))[_0x7721('0x45')](handleError(_0x4a2c28,null));};exports['create']=function(_0x30107e,_0x2d5a88){return db['UserProfileResource'][_0x7721('0x48')](_0x30107e['body'],{})[_0x7721('0x27')](respondWithResult(_0x2d5a88,0xc9))['catch'](handleError(_0x2d5a88,null));};exports[_0x7721('0x26')]=function(_0x196be4,_0xf17c40){if(_0x196be4['body']['id']){delete _0x196be4[_0x7721('0x49')]['id'];}return db[_0x7721('0x2e')]['find']({'where':{'id':_0x196be4[_0x7721('0x46')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0xf17c40,null))[_0x7721('0x27')](saveUpdates(_0x196be4['body'],null))[_0x7721('0x27')](respondWithResult(_0xf17c40,null))['catch'](handleError(_0xf17c40,null));};exports[_0x7721('0x28')]=function(_0x310549,_0x4738ef){return db[_0x7721('0x2e')][_0x7721('0x47')]({'where':{'id':_0x310549[_0x7721('0x46')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0x4738ef,null))[_0x7721('0x27')](removeEntity(_0x4738ef,null))[_0x7721('0x45')](handleError(_0x4738ef,null));};exports[_0x7721('0x4a')]=function(_0x31770e,_0x1e2ef6){return db[_0x7721('0x2e')][_0x7721('0x4a')]()[_0x7721('0x27')](respondWithResult(_0x1e2ef6,null))['catch'](handleError(_0x1e2ef6,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1071d78..b3bc865 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 _0x1c03=['UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','define'];(function(_0x2fb84a,_0x172d92){var _0x1e4eb2=function(_0x289a4a){while(--_0x289a4a){_0x2fb84a['push'](_0x2fb84a['shift']());}};_0x1e4eb2(++_0x172d92);}(_0x1c03,0x171));var _0x31c0=function(_0x21481c,_0x1b51ba){_0x21481c=_0x21481c-0x0;var _0x5dd77a=_0x1c03[_0x21481c];return _0x5dd77a;};'use strict';var _=require(_0x31c0('0x0'));var util=require(_0x31c0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x31c0('0x2'));var rp=require(_0x31c0('0x3'));var fs=require('fs');var path=require(_0x31c0('0x4'));var rimraf=require('rimraf');var config=require(_0x31c0('0x5'));var attributes=require(_0x31c0('0x6'));module['exports']=function(_0x311471,_0x2209a1){return _0x311471[_0x31c0('0x7')](_0x31c0('0x8'),attributes,{'tableName':_0x31c0('0x9'),'paranoid':![],'indexes':[{'name':_0x31c0('0xa'),'fields':[_0x31c0('0xb'),_0x31c0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x388f=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId','sectionId'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x388f,0x179));var _0xf388=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x388f[_0x4b0290];return _0x4bd9f4;};'use strict';var _=require(_0xf388('0x0'));var util=require(_0xf388('0x1'));var logger=require(_0xf388('0x2'))(_0xf388('0x3'));var moment=require(_0xf388('0x4'));var BPromise=require('bluebird');var rp=require(_0xf388('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf388('0x6'));var config=require('../../config/environment');var attributes=require(_0xf388('0x7'));module[_0xf388('0x8')]=function(_0x5124cf,_0x377385){return _0x5124cf[_0xf388('0x9')]('UserProfileResource',attributes,{'tableName':_0xf388('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf388('0xb'),_0xf388('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e997d68..136e98f 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 _0x54a2=['request','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x13c655,_0x884e4d){var _0x2f4973=function(_0x5076e6){while(--_0x5076e6){_0x13c655['push'](_0x13c655['shift']());}};_0x2f4973(++_0x884e4d);}(_0x54a2,0x1ef));var _0x254a=function(_0x2c271b,_0x5e1728){_0x2c271b=_0x2c271b-0x0;var _0x423d7b=_0x54a2[_0x2c271b];return _0x423d7b;};'use strict';var _=require('lodash');var util=require(_0x254a('0x0'));var moment=require(_0x254a('0x1'));var BPromise=require(_0x254a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x254a('0x3'))['db'];var utils=require(_0x254a('0x4'));var logger=require(_0x254a('0x5'))(_0x254a('0x6'));var config=require(_0x254a('0x7'));var jayson=require(_0x254a('0x8'));var client=jayson[_0x254a('0x9')][_0x254a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47c317,_0x3565b6,_0x5ae1de){return new BPromise(function(_0x4dd3d6,_0x4a049b){return client[_0x254a('0xb')](_0x47c317,_0x5ae1de)['then'](function(_0x23e2a6){logger[_0x254a('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x3565b6,_0x254a('0xd'));logger[_0x254a('0xe')](_0x254a('0xf'),_0x3565b6,_0x254a('0xd'),JSON['stringify'](_0x23e2a6));if(_0x23e2a6[_0x254a('0x10')]){if(_0x23e2a6['error'][_0x254a('0x11')]===0x1f4){logger['error'](_0x254a('0x12'),_0x3565b6,_0x23e2a6['error']['message']);return _0x4a049b(_0x23e2a6[_0x254a('0x10')][_0x254a('0x13')]);}logger[_0x254a('0x10')](_0x254a('0x12'),_0x3565b6,_0x23e2a6[_0x254a('0x10')][_0x254a('0x13')]);return _0x4dd3d6(_0x23e2a6['error'][_0x254a('0x13')]);}else{logger['info'](_0x254a('0x12'),_0x3565b6,_0x254a('0xd'));_0x4dd3d6(_0x23e2a6[_0x254a('0x14')][_0x254a('0x13')]);}})[_0x254a('0x15')](function(_0x5241e4){logger[_0x254a('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x3565b6,_0x5241e4);_0x4a049b(_0x5241e4);});});} \ No newline at end of file +var _0xe7ba=['then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request'];(function(_0x592d37,_0x5b2b69){var _0x5bfbbd=function(_0x4dd3b3){while(--_0x4dd3b3){_0x592d37['push'](_0x592d37['shift']());}};_0x5bfbbd(++_0x5b2b69);}(_0xe7ba,0x1ea));var _0xae7b=function(_0xc42b35,_0x4f749c){_0xc42b35=_0xc42b35-0x0;var _0xe89d1f=_0xe7ba[_0xc42b35];return _0xe89d1f;};'use strict';var _=require(_0xae7b('0x0'));var util=require(_0xae7b('0x1'));var moment=require('moment');var BPromise=require(_0xae7b('0x2'));var rs=require(_0xae7b('0x3'));var fs=require('fs');var Redis=require(_0xae7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae7b('0x5'));var config=require(_0xae7b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xae7b('0x7')][_0xae7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x355403,_0x3a4167,_0x536d09){return new BPromise(function(_0x4a5b4b,_0x27443d){return client[_0xae7b('0x9')](_0x355403,_0x536d09)[_0xae7b('0xa')](function(_0x3e3ea3){logger['info'](_0xae7b('0xb'),_0x3a4167,_0xae7b('0xc'));logger['debug'](_0xae7b('0xd'),_0x3a4167,_0xae7b('0xc'),JSON['stringify'](_0x3e3ea3));if(_0x3e3ea3[_0xae7b('0xe')]){if(_0x3e3ea3['error'][_0xae7b('0xf')]===0x1f4){logger[_0xae7b('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x3a4167,_0x3e3ea3[_0xae7b('0xe')][_0xae7b('0x10')]);return _0x27443d(_0x3e3ea3[_0xae7b('0xe')][_0xae7b('0x10')]);}logger[_0xae7b('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x3a4167,_0x3e3ea3['error']['message']);return _0x4a5b4b(_0x3e3ea3[_0xae7b('0xe')]['message']);}else{logger[_0xae7b('0x11')](_0xae7b('0xb'),_0x3a4167,_0xae7b('0xc'));_0x4a5b4b(_0x3e3ea3[_0xae7b('0x12')][_0xae7b('0x10')]);}})[_0xae7b('0x13')](function(_0x513eb6){logger['error'](_0xae7b('0xb'),_0x3a4167,_0x513eb6);_0x27443d(_0x513eb6);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b4ad6cc..b0beca8 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 _0x0748=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','/:id','destroy','multer'];(function(_0x2b8578,_0xee10f0){var _0x1bcc66=function(_0x5690b7){while(--_0x5690b7){_0x2b8578['push'](_0x2b8578['shift']());}};_0x1bcc66(++_0xee10f0);}(_0x0748,0xc7));var _0x8074=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x0748[_0x397cfb];return _0x15fed9;};'use strict';var multer=require(_0x8074('0x0'));var util=require(_0x8074('0x1'));var path=require('path');var timeout=require(_0x8074('0x2'));var express=require(_0x8074('0x3'));var router=express[_0x8074('0x4')]();var auth=require(_0x8074('0x5'));var interaction=require(_0x8074('0x6'));var config=require('../../config/environment');var controller=require(_0x8074('0x7'));router[_0x8074('0x8')]('/',auth[_0x8074('0x9')](),controller['index']);router[_0x8074('0x8')](_0x8074('0xa'),auth['isAuthenticated'](),controller[_0x8074('0xb')]);router['get']('/:id',auth[_0x8074('0x9')](),controller[_0x8074('0xc')]);router[_0x8074('0xd')]('/',auth[_0x8074('0x9')](),controller[_0x8074('0xe')]);router[_0x8074('0xf')]('/:id',auth[_0x8074('0x9')](),controller[_0x8074('0x10')]);router[_0x8074('0x11')](_0x8074('0x12'),auth[_0x8074('0x9')](),controller[_0x8074('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0a34=['../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0x0a34,0x12a));var _0x40a3=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x0a34[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0x40a3('0x0'));var util=require(_0x40a3('0x1'));var path=require('path');var timeout=require(_0x40a3('0x2'));var express=require(_0x40a3('0x3'));var router=express[_0x40a3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x40a3('0x5'));var config=require(_0x40a3('0x6'));var controller=require(_0x40a3('0x7'));router['get']('/',auth[_0x40a3('0x8')](),controller[_0x40a3('0x9')]);router[_0x40a3('0xa')](_0x40a3('0xb'),auth[_0x40a3('0x8')](),controller[_0x40a3('0xc')]);router['get'](_0x40a3('0xd'),auth[_0x40a3('0x8')](),controller[_0x40a3('0xe')]);router[_0x40a3('0xf')]('/',auth[_0x40a3('0x8')](),controller[_0x40a3('0x10')]);router['put'](_0x40a3('0xd'),auth[_0x40a3('0x8')](),controller[_0x40a3('0x11')]);router['delete'](_0x40a3('0xd'),auth[_0x40a3('0x8')](),controller['destroy']);module[_0x40a3('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 6e1db37..2180912 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 _0xf0cc=['STRING','BOOLEAN','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x31f783,_0x1cc575){var _0x240e72=function(_0x35f84f){while(--_0x35f84f){_0x31f783['push'](_0x31f783['shift']());}};_0x240e72(++_0x1cc575);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x241cbe,_0x179a60){_0x241cbe=_0x241cbe-0x0;var _0xd5b4ad=_0xf0cc[_0x241cbe];return _0xd5b4ad;};'use strict';var Sequelize=require(_0xcf0c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xcf0c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xcf0c('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xcf0c('0x1')],'set':function(_0x4e56db){this['setDataValue'](_0xcf0c('0x3'),_0x4e56db?_0x4e56db[_0xcf0c('0x4')](''):[]);},'get':function(){return this[_0xcf0c('0x5')]('crudPermissions')?this[_0xcf0c('0x5')](_0xcf0c('0x3'))[_0xcf0c('0x6')](''):[];}}}; \ No newline at end of file +var _0x34c6=['BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x5e602f,_0x32ceb4){var _0x3060e9=function(_0x192331){while(--_0x192331){_0x5e602f['push'](_0x5e602f['shift']());}};_0x3060e9(++_0x32ceb4);}(_0x34c6,0x1cd));var _0x634c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x34c6[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x634c('0x0'));module['exports']={'name':{'type':Sequelize[_0x634c('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x634c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x634c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x634c('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2fcac2){this[_0x634c('0x4')](_0x634c('0x5'),_0x2fcac2?_0x2fcac2['join'](''):[]);},'get':function(){return this[_0x634c('0x6')]('crudPermissions')?this[_0x634c('0x6')](_0x634c('0x5'))[_0x634c('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9901760..fd121ee 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 _0x6700=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','count','then','includeAll','show','params','keys','include','catch','create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6700,0x1d4));var _0x0670=function(_0x1a5e0b,_0x212f16){_0x1a5e0b=_0x1a5e0b-0x0;var _0x20bf30=_0x6700[_0x1a5e0b];return _0x20bf30;};'use strict';var pdf=require(_0x0670('0x0'));var emlformat=require(_0x0670('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0670('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0670('0x3'));var moment=require(_0x0670('0x4'));var BPromise=require(_0x0670('0x5'));var Mustache=require(_0x0670('0x6'));var util=require(_0x0670('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0670('0x8'));var ejs=require(_0x0670('0x9'));var fs=require('fs');var _=require(_0x0670('0xa'));var squel=require(_0x0670('0xb'));var crypto=require(_0x0670('0xc'));var jsforce=require(_0x0670('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0670('0x8'));var querystring=require(_0x0670('0xe'));var Papa=require('papaparse');var Redis=require(_0x0670('0xf'));var authService=require(_0x0670('0x10'));var qs=require(_0x0670('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0670('0x12'));var logger=require(_0x0670('0x13'))(_0x0670('0x14'));var utils=require('../../config/utils');var config=require(_0x0670('0x15'));var licenseUtil=require(_0x0670('0x16'));var db=require(_0x0670('0x17'))['db'];function respondWithStatusCode(_0x5ec070,_0x4e2e27){_0x4e2e27=_0x4e2e27||0xcc;return function(_0x4b37a1){if(_0x4b37a1){return _0x5ec070[_0x0670('0x18')](_0x4e2e27);}return _0x5ec070[_0x0670('0x19')](_0x4e2e27)[_0x0670('0x1a')]();};}function respondWithResult(_0x17ace2,_0x917609){_0x917609=_0x917609||0xc8;return function(_0x2486a1){if(_0x2486a1){return _0x17ace2[_0x0670('0x19')](_0x917609)[_0x0670('0x1b')](_0x2486a1);}};}function respondWithFilteredResult(_0x48a41a,_0x3984aa){return function(_0x513656){if(_0x513656){var _0x4934b6=_0x513656['count'],_0x3977b2=_0x3984aa['offset'],_0x484867=_0x3984aa[_0x0670('0x1c')]+_0x3984aa[_0x0670('0x1d')],_0xd5bdde;if(_0x484867>=_0x4934b6){_0x484867=_0x4934b6;_0xd5bdde=0xc8;}else{_0xd5bdde=0xce;}_0x48a41a['status'](_0xd5bdde);return _0x48a41a[_0x0670('0x1e')](_0x0670('0x1f'),_0x3977b2+'-'+_0x484867+'/'+_0x4934b6)[_0x0670('0x1b')](_0x513656);}return null;};}function patchUpdates(_0x4b38aa){return function(_0x45c6af){try{jsonpatch[_0x0670('0x20')](_0x45c6af,_0x4b38aa,!![]);}catch(_0x38a79d){return BPromise[_0x0670('0x21')](_0x38a79d);}return _0x45c6af['save']();};}function saveUpdates(_0x46f861,_0x27a67b){return function(_0x65d03b){if(_0x65d03b){return _0x65d03b[_0x0670('0x22')](_0x46f861)['then'](function(_0x4774e7){return _0x4774e7;});}return null;};}function removeEntity(_0x37905f,_0x4eef6f){return function(_0x3d6927){if(_0x3d6927){return _0x3d6927['destroy']()['then'](function(){_0x37905f[_0x0670('0x19')](0xcc)[_0x0670('0x1a')]();});}};}function handleEntityNotFound(_0xa6c187,_0x342846){return function(_0x13c7a5){if(!_0x13c7a5){_0xa6c187[_0x0670('0x18')](0x194);}return _0x13c7a5;};}function handleError(_0x4ca399,_0xffaa60){_0xffaa60=_0xffaa60||0x1f4;return function(_0x389ea3){logger['error'](_0x389ea3[_0x0670('0x23')]);if(_0x389ea3['name']){delete _0x389ea3[_0x0670('0x24')];}_0x4ca399['status'](_0xffaa60)[_0x0670('0x25')](_0x389ea3);};}exports[_0x0670('0x26')]=function(_0x4e3447,_0x40bce3){var _0x558d7e={},_0x2d1aee={},_0x41c2b1={'count':0x0,'rows':[]};var _0x1a6df3=_['map'](db[_0x0670('0x27')][_0x0670('0x28')],function(_0x4ddca6){return{'name':_0x4ddca6[_0x0670('0x29')],'type':_0x4ddca6[_0x0670('0x2a')][_0x0670('0x2b')]};});_0x2d1aee[_0x0670('0x2c')]=_[_0x0670('0x2d')](_0x1a6df3,'name');_0x2d1aee[_0x0670('0x2e')]=_['keys'](_0x4e3447['query']);_0x2d1aee[_0x0670('0x2f')]=_[_0x0670('0x30')](_0x2d1aee[_0x0670('0x2c')],_0x2d1aee[_0x0670('0x2e')]);_0x558d7e[_0x0670('0x31')]=_[_0x0670('0x30')](_0x2d1aee[_0x0670('0x2c')],qs[_0x0670('0x32')](_0x4e3447[_0x0670('0x2e')][_0x0670('0x32')]));_0x558d7e[_0x0670('0x31')]=_0x558d7e[_0x0670('0x31')][_0x0670('0x33')]?_0x558d7e[_0x0670('0x31')]:_0x2d1aee[_0x0670('0x2c')];if(!_0x4e3447[_0x0670('0x2e')][_0x0670('0x34')]('nolimit')){_0x558d7e[_0x0670('0x1d')]=qs[_0x0670('0x1d')](_0x4e3447[_0x0670('0x2e')][_0x0670('0x1d')]);_0x558d7e['offset']=qs['offset'](_0x4e3447['query'][_0x0670('0x1c')]);}_0x558d7e['order']=qs[_0x0670('0x35')](_0x4e3447[_0x0670('0x2e')][_0x0670('0x35')]);_0x558d7e['where']=qs[_0x0670('0x2f')](_[_0x0670('0x36')](_0x4e3447['query'],_0x2d1aee[_0x0670('0x2f')]),_0x1a6df3);if(_0x4e3447[_0x0670('0x2e')][_0x0670('0x37')]){_0x558d7e[_0x0670('0x38')]=_[_0x0670('0x39')](_0x558d7e[_0x0670('0x38')],{'$or':_[_0x0670('0x2d')](_0x1a6df3,function(_0x436d0d){if(_0x436d0d[_0x0670('0x2a')]!==_0x0670('0x3a')){var _0x558826={};_0x558826[_0x436d0d[_0x0670('0x24')]]={'$like':'%'+_0x4e3447[_0x0670('0x2e')][_0x0670('0x37')]+'%'};return _0x558826;}})});}_0x558d7e=_[_0x0670('0x39')]({},_0x558d7e,_0x4e3447[_0x0670('0x3b')]);var _0x15eb95={'where':_0x558d7e[_0x0670('0x38')]};return db['UserProfileSection'][_0x0670('0x3c')](_0x15eb95)[_0x0670('0x3d')](function(_0x596b5b){_0x41c2b1['count']=_0x596b5b;if(_0x4e3447[_0x0670('0x2e')][_0x0670('0x3e')]){_0x558d7e['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x558d7e);})[_0x0670('0x3d')](function(_0x47c282){_0x41c2b1['rows']=_0x47c282;return _0x41c2b1;})[_0x0670('0x3d')](respondWithFilteredResult(_0x40bce3,_0x558d7e))['catch'](handleError(_0x40bce3,null));};exports[_0x0670('0x3f')]=function(_0x55ec46,_0x236f8b){var _0x34d8cf={'raw':![],'where':{'id':_0x55ec46[_0x0670('0x40')]['id']}},_0x3b2f77={};_0x3b2f77[_0x0670('0x2c')]=_[_0x0670('0x41')](db[_0x0670('0x27')][_0x0670('0x28')]);_0x3b2f77[_0x0670('0x2e')]=_[_0x0670('0x41')](_0x55ec46['query']);_0x3b2f77[_0x0670('0x2f')]=_[_0x0670('0x30')](_0x3b2f77[_0x0670('0x2c')],_0x3b2f77['query']);_0x34d8cf[_0x0670('0x31')]=_[_0x0670('0x30')](_0x3b2f77[_0x0670('0x2c')],qs[_0x0670('0x32')](_0x55ec46[_0x0670('0x2e')][_0x0670('0x32')]));_0x34d8cf[_0x0670('0x31')]=_0x34d8cf['attributes'][_0x0670('0x33')]?_0x34d8cf[_0x0670('0x31')]:_0x3b2f77['model'];if(_0x55ec46[_0x0670('0x2e')][_0x0670('0x3e')]){_0x34d8cf[_0x0670('0x42')]=[{'all':!![]}];}_0x34d8cf=_[_0x0670('0x39')]({},_0x34d8cf,_0x55ec46['options']);return db[_0x0670('0x27')]['find'](_0x34d8cf)[_0x0670('0x3d')](handleEntityNotFound(_0x236f8b,null))[_0x0670('0x3d')](respondWithResult(_0x236f8b,null))[_0x0670('0x43')](handleError(_0x236f8b,null));};exports['create']=function(_0x428111,_0x251a83){return db['UserProfileSection'][_0x0670('0x44')](_0x428111[_0x0670('0x45')],{})[_0x0670('0x3d')](respondWithResult(_0x251a83,0xc9))[_0x0670('0x43')](handleError(_0x251a83,null));};exports[_0x0670('0x22')]=function(_0x1311d8,_0x5060f4){if(_0x1311d8[_0x0670('0x45')]['id']){delete _0x1311d8['body']['id'];}return db[_0x0670('0x27')][_0x0670('0x46')]({'where':{'id':_0x1311d8[_0x0670('0x40')]['id']}})[_0x0670('0x3d')](handleEntityNotFound(_0x5060f4,null))[_0x0670('0x3d')](saveUpdates(_0x1311d8['body'],null))['then'](respondWithResult(_0x5060f4,null))[_0x0670('0x43')](handleError(_0x5060f4,null));};exports[_0x0670('0x47')]=function(_0x1d0b00,_0x11710d){return db['UserProfileSection'][_0x0670('0x46')]({'where':{'id':_0x1d0b00[_0x0670('0x40')]['id']}})['then'](handleEntityNotFound(_0x11710d,null))[_0x0670('0x3d')](removeEntity(_0x11710d,null))[_0x0670('0x43')](handleError(_0x11710d,null));};exports['describe']=function(_0x1e79d6,_0x26e2dd){return db[_0x0670('0x27')][_0x0670('0x48')]()['then'](respondWithResult(_0x26e2dd,null))['catch'](handleError(_0x26e2dd,null));}; \ No newline at end of file +var _0xe752=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','stack','name','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','filters','pick','where','VIRTUAL','filter','merge'];(function(_0xfb820a,_0x5bed2c){var _0x351481=function(_0x3e1bca){while(--_0x3e1bca){_0xfb820a['push'](_0xfb820a['shift']());}};_0x351481(++_0x5bed2c);}(_0xe752,0x1e0));var _0x2e75=function(_0x48855e,_0x11bfe2){_0x48855e=_0x48855e-0x0;var _0x282312=_0xe752[_0x48855e];return _0x282312;};'use strict';var pdf=require(_0x2e75('0x0'));var emlformat=require(_0x2e75('0x1'));var rimraf=require(_0x2e75('0x2'));var zipdir=require(_0x2e75('0x3'));var jsonpatch=require(_0x2e75('0x4'));var rp=require(_0x2e75('0x5'));var moment=require(_0x2e75('0x6'));var BPromise=require(_0x2e75('0x7'));var Mustache=require(_0x2e75('0x8'));var util=require(_0x2e75('0x9'));var path=require('path');var sox=require(_0x2e75('0xa'));var csv=require(_0x2e75('0xb'));var ejs=require(_0x2e75('0xc'));var fs=require('fs');var _=require(_0x2e75('0xd'));var squel=require(_0x2e75('0xe'));var crypto=require(_0x2e75('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2e75('0x10'));var toCsv=require(_0x2e75('0xb'));var querystring=require(_0x2e75('0x11'));var Papa=require('papaparse');var Redis=require(_0x2e75('0x12'));var authService=require(_0x2e75('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2e75('0x14'));var hardwareService=require(_0x2e75('0x15'));var logger=require(_0x2e75('0x16'))(_0x2e75('0x17'));var utils=require(_0x2e75('0x18'));var config=require(_0x2e75('0x19'));var licenseUtil=require(_0x2e75('0x1a'));var db=require(_0x2e75('0x1b'))['db'];function respondWithStatusCode(_0x2437b7,_0x157afa){_0x157afa=_0x157afa||0xcc;return function(_0xaac183){if(_0xaac183){return _0x2437b7[_0x2e75('0x1c')](_0x157afa);}return _0x2437b7[_0x2e75('0x1d')](_0x157afa)[_0x2e75('0x1e')]();};}function respondWithResult(_0x36a44b,_0x4758f0){_0x4758f0=_0x4758f0||0xc8;return function(_0x4c1948){if(_0x4c1948){return _0x36a44b[_0x2e75('0x1d')](_0x4758f0)[_0x2e75('0x1f')](_0x4c1948);}};}function respondWithFilteredResult(_0xd33159,_0x2a793b){return function(_0x34974e){if(_0x34974e){var _0x5df43b=_0x34974e[_0x2e75('0x20')],_0x1e7e6f=_0x2a793b['offset'],_0x533c99=_0x2a793b[_0x2e75('0x21')]+_0x2a793b['limit'],_0x4c6cf0;if(_0x533c99>=_0x5df43b){_0x533c99=_0x5df43b;_0x4c6cf0=0xc8;}else{_0x4c6cf0=0xce;}_0xd33159['status'](_0x4c6cf0);return _0xd33159[_0x2e75('0x22')]('Content-Range',_0x1e7e6f+'-'+_0x533c99+'/'+_0x5df43b)[_0x2e75('0x1f')](_0x34974e);}return null;};}function patchUpdates(_0x400407){return function(_0x2b60aa){try{jsonpatch[_0x2e75('0x23')](_0x2b60aa,_0x400407,!![]);}catch(_0x656490){return BPromise[_0x2e75('0x24')](_0x656490);}return _0x2b60aa[_0x2e75('0x25')]();};}function saveUpdates(_0x1ad3d7,_0xfaef9d){return function(_0x4b5de7){if(_0x4b5de7){return _0x4b5de7[_0x2e75('0x26')](_0x1ad3d7)[_0x2e75('0x27')](function(_0x3200f4){return _0x3200f4;});}return null;};}function removeEntity(_0x50e3c8,_0x5a7726){return function(_0x34b7f5){if(_0x34b7f5){return _0x34b7f5[_0x2e75('0x28')]()[_0x2e75('0x27')](function(){_0x50e3c8[_0x2e75('0x1d')](0xcc)[_0x2e75('0x1e')]();});}};}function handleEntityNotFound(_0x125323,_0xcc676d){return function(_0x3ad81d){if(!_0x3ad81d){_0x125323[_0x2e75('0x1c')](0x194);}return _0x3ad81d;};}function handleError(_0x22550c,_0x52573f){_0x52573f=_0x52573f||0x1f4;return function(_0xc90445){logger['error'](_0xc90445[_0x2e75('0x29')]);if(_0xc90445[_0x2e75('0x2a')]){delete _0xc90445[_0x2e75('0x2a')];}_0x22550c[_0x2e75('0x1d')](_0x52573f)['send'](_0xc90445);};}exports['index']=function(_0x415473,_0xac11f7){var _0x4c1b6b={},_0x48e6c4={},_0x49dee9={'count':0x0,'rows':[]};var _0x4a7bd3=_[_0x2e75('0x2b')](db[_0x2e75('0x2c')][_0x2e75('0x2d')],function(_0x5a99d0){return{'name':_0x5a99d0[_0x2e75('0x2e')],'type':_0x5a99d0[_0x2e75('0x2f')][_0x2e75('0x30')]};});_0x48e6c4[_0x2e75('0x31')]=_[_0x2e75('0x2b')](_0x4a7bd3,_0x2e75('0x2a'));_0x48e6c4[_0x2e75('0x32')]=_[_0x2e75('0x33')](_0x415473['query']);_0x48e6c4['filters']=_[_0x2e75('0x34')](_0x48e6c4[_0x2e75('0x31')],_0x48e6c4[_0x2e75('0x32')]);_0x4c1b6b['attributes']=_['intersection'](_0x48e6c4[_0x2e75('0x31')],qs[_0x2e75('0x35')](_0x415473['query'][_0x2e75('0x35')]));_0x4c1b6b[_0x2e75('0x36')]=_0x4c1b6b[_0x2e75('0x36')][_0x2e75('0x37')]?_0x4c1b6b[_0x2e75('0x36')]:_0x48e6c4[_0x2e75('0x31')];if(!_0x415473[_0x2e75('0x32')]['hasOwnProperty'](_0x2e75('0x38'))){_0x4c1b6b[_0x2e75('0x39')]=qs['limit'](_0x415473['query'][_0x2e75('0x39')]);_0x4c1b6b['offset']=qs[_0x2e75('0x21')](_0x415473[_0x2e75('0x32')]['offset']);}_0x4c1b6b[_0x2e75('0x3a')]=qs[_0x2e75('0x3b')](_0x415473[_0x2e75('0x32')][_0x2e75('0x3b')]);_0x4c1b6b['where']=qs[_0x2e75('0x3c')](_[_0x2e75('0x3d')](_0x415473['query'],_0x48e6c4[_0x2e75('0x3c')]),_0x4a7bd3);if(_0x415473['query']['filter']){_0x4c1b6b[_0x2e75('0x3e')]=_['merge'](_0x4c1b6b[_0x2e75('0x3e')],{'$or':_[_0x2e75('0x2b')](_0x4a7bd3,function(_0x4c657b){if(_0x4c657b[_0x2e75('0x2f')]!==_0x2e75('0x3f')){var _0x5e286e={};_0x5e286e[_0x4c657b[_0x2e75('0x2a')]]={'$like':'%'+_0x415473[_0x2e75('0x32')][_0x2e75('0x40')]+'%'};return _0x5e286e;}})});}_0x4c1b6b=_[_0x2e75('0x41')]({},_0x4c1b6b,_0x415473[_0x2e75('0x42')]);var _0x2f9323={'where':_0x4c1b6b[_0x2e75('0x3e')]};return db[_0x2e75('0x2c')]['count'](_0x2f9323)[_0x2e75('0x27')](function(_0x4bc3a2){_0x49dee9[_0x2e75('0x20')]=_0x4bc3a2;if(_0x415473[_0x2e75('0x32')][_0x2e75('0x43')]){_0x4c1b6b[_0x2e75('0x44')]=[{'all':!![]}];}return db[_0x2e75('0x2c')][_0x2e75('0x45')](_0x4c1b6b);})['then'](function(_0x2548a5){_0x49dee9[_0x2e75('0x46')]=_0x2548a5;return _0x49dee9;})['then'](respondWithFilteredResult(_0xac11f7,_0x4c1b6b))[_0x2e75('0x47')](handleError(_0xac11f7,null));};exports[_0x2e75('0x48')]=function(_0x3d013b,_0x99f12b){var _0x53d8e5={'raw':![],'where':{'id':_0x3d013b[_0x2e75('0x49')]['id']}},_0x5f47cd={};_0x5f47cd[_0x2e75('0x31')]=_[_0x2e75('0x33')](db[_0x2e75('0x2c')][_0x2e75('0x2d')]);_0x5f47cd[_0x2e75('0x32')]=_[_0x2e75('0x33')](_0x3d013b['query']);_0x5f47cd[_0x2e75('0x3c')]=_[_0x2e75('0x34')](_0x5f47cd[_0x2e75('0x31')],_0x5f47cd[_0x2e75('0x32')]);_0x53d8e5['attributes']=_[_0x2e75('0x34')](_0x5f47cd[_0x2e75('0x31')],qs['fields'](_0x3d013b['query'][_0x2e75('0x35')]));_0x53d8e5[_0x2e75('0x36')]=_0x53d8e5[_0x2e75('0x36')]['length']?_0x53d8e5['attributes']:_0x5f47cd[_0x2e75('0x31')];if(_0x3d013b['query'][_0x2e75('0x43')]){_0x53d8e5['include']=[{'all':!![]}];}_0x53d8e5=_['merge']({},_0x53d8e5,_0x3d013b[_0x2e75('0x42')]);return db[_0x2e75('0x2c')][_0x2e75('0x4a')](_0x53d8e5)[_0x2e75('0x27')](handleEntityNotFound(_0x99f12b,null))[_0x2e75('0x27')](respondWithResult(_0x99f12b,null))[_0x2e75('0x47')](handleError(_0x99f12b,null));};exports[_0x2e75('0x4b')]=function(_0x164d05,_0x143f06){return db[_0x2e75('0x2c')][_0x2e75('0x4b')](_0x164d05[_0x2e75('0x4c')],{})[_0x2e75('0x27')](respondWithResult(_0x143f06,0xc9))[_0x2e75('0x47')](handleError(_0x143f06,null));};exports[_0x2e75('0x26')]=function(_0x5b8704,_0x1d278f){if(_0x5b8704[_0x2e75('0x4c')]['id']){delete _0x5b8704['body']['id'];}return db[_0x2e75('0x2c')][_0x2e75('0x4a')]({'where':{'id':_0x5b8704[_0x2e75('0x49')]['id']}})[_0x2e75('0x27')](handleEntityNotFound(_0x1d278f,null))[_0x2e75('0x27')](saveUpdates(_0x5b8704['body'],null))['then'](respondWithResult(_0x1d278f,null))[_0x2e75('0x47')](handleError(_0x1d278f,null));};exports['destroy']=function(_0x152c2a,_0x1e4465){return db['UserProfileSection'][_0x2e75('0x4a')]({'where':{'id':_0x152c2a[_0x2e75('0x49')]['id']}})[_0x2e75('0x27')](handleEntityNotFound(_0x1e4465,null))[_0x2e75('0x27')](removeEntity(_0x1e4465,null))[_0x2e75('0x47')](handleError(_0x1e4465,null));};exports[_0x2e75('0x4d')]=function(_0x1e6af5,_0x48ce95){return db[_0x2e75('0x2c')][_0x2e75('0x4d')]()[_0x2e75('0x27')](respondWithResult(_0x48ce95,null))[_0x2e75('0x47')](handleError(_0x48ce95,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6f423a8..5cf94d9 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 _0x128d=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId'];(function(_0x4c5232,_0x270c3e){var _0x47ade2=function(_0xf67096){while(--_0xf67096){_0x4c5232['push'](_0x4c5232['shift']());}};_0x47ade2(++_0x270c3e);}(_0x128d,0x179));var _0xd128=function(_0x53c95f,_0x273cb9){_0x53c95f=_0x53c95f-0x0;var _0xeba542=_0x128d[_0x53c95f];return _0xeba542;};'use strict';var _=require(_0xd128('0x0'));var util=require(_0xd128('0x1'));var logger=require(_0xd128('0x2'))(_0xd128('0x3'));var moment=require(_0xd128('0x4'));var BPromise=require(_0xd128('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd128('0x6'));var rimraf=require('rimraf');var config=require(_0xd128('0x7'));var attributes=require(_0xd128('0x8'));module['exports']=function(_0x327360,_0x6f2cd6){return _0x327360[_0xd128('0x9')]('UserProfileSection',attributes,{'tableName':_0xd128('0xa'),'paranoid':![],'indexes':[{'name':_0xd128('0xb'),'fields':[_0xd128('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d6e=['api','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','user_profile_has_sections','compositeIndex','lodash','util','../../config/logger'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0d6e,0xc3));var _0xe0d6=function(_0x3086cf,_0x13a69b){_0x3086cf=_0x3086cf-0x0;var _0x10f8c4=_0x0d6e[_0x3086cf];return _0x10f8c4;};'use strict';var _=require(_0xe0d6('0x0'));var util=require(_0xe0d6('0x1'));var logger=require(_0xe0d6('0x2'))(_0xe0d6('0x3'));var moment=require('moment');var BPromise=require(_0xe0d6('0x4'));var rp=require(_0xe0d6('0x5'));var fs=require('fs');var path=require(_0xe0d6('0x6'));var rimraf=require(_0xe0d6('0x7'));var config=require('../../config/environment');var attributes=require(_0xe0d6('0x8'));module['exports']=function(_0x1c4dbe,_0x40f626){return _0x1c4dbe['define']('UserProfileSection',attributes,{'tableName':_0xe0d6('0x9'),'paranoid':![],'indexes':[{'name':_0xe0d6('0xa'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0237ae7..7b848d9 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 _0xaa7d=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x57cf14,_0x2736dc){var _0x22d10f=function(_0x2a1ca9){while(--_0x2a1ca9){_0x57cf14['push'](_0x57cf14['shift']());}};_0x22d10f(++_0x2736dc);}(_0xaa7d,0x16c));var _0xdaa7=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xaa7d[_0x2f48cd];return _0x193ae2;};'use strict';var _=require('lodash');var util=require(_0xdaa7('0x0'));var moment=require(_0xdaa7('0x1'));var BPromise=require(_0xdaa7('0x2'));var rs=require(_0xdaa7('0x3'));var fs=require('fs');var Redis=require(_0xdaa7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdaa7('0x5'));var logger=require(_0xdaa7('0x6'))(_0xdaa7('0x7'));var config=require(_0xdaa7('0x8'));var jayson=require(_0xdaa7('0x9'));var client=jayson[_0xdaa7('0xa')][_0xdaa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d6bb8,_0x162076,_0x45f956){return new BPromise(function(_0x44c508,_0x5b2c3a){return client[_0xdaa7('0xc')](_0x5d6bb8,_0x45f956)['then'](function(_0x22c643){logger[_0xdaa7('0xd')](_0xdaa7('0xe'),_0x162076,_0xdaa7('0xf'));logger[_0xdaa7('0x10')](_0xdaa7('0x11'),_0x162076,_0xdaa7('0xf'),JSON['stringify'](_0x22c643));if(_0x22c643['error']){if(_0x22c643[_0xdaa7('0x12')][_0xdaa7('0x13')]===0x1f4){logger[_0xdaa7('0x12')](_0xdaa7('0xe'),_0x162076,_0x22c643['error'][_0xdaa7('0x14')]);return _0x5b2c3a(_0x22c643['error'][_0xdaa7('0x14')]);}logger[_0xdaa7('0x12')](_0xdaa7('0xe'),_0x162076,_0x22c643['error']['message']);return _0x44c508(_0x22c643['error'][_0xdaa7('0x14')]);}else{logger['info'](_0xdaa7('0xe'),_0x162076,_0xdaa7('0xf'));_0x44c508(_0x22c643[_0xdaa7('0x15')][_0xdaa7('0x14')]);}})[_0xdaa7('0x16')](function(_0x4a8004){logger['error'](_0xdaa7('0xe'),_0x162076,_0x4a8004);_0x5b2c3a(_0x4a8004);});});} \ No newline at end of file +var _0x4e13=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x296980,_0x5b9544){var _0x5a64ef=function(_0x1d0b2c){while(--_0x1d0b2c){_0x296980['push'](_0x296980['shift']());}};_0x5a64ef(++_0x5b9544);}(_0x4e13,0xe6));var _0x34e1=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x4e13[_0x3a607e];return _0x37b106;};'use strict';var _=require(_0x34e1('0x0'));var util=require('util');var moment=require(_0x34e1('0x1'));var BPromise=require(_0x34e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34e1('0x3'));var db=require(_0x34e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34e1('0x5'));var config=require(_0x34e1('0x6'));var jayson=require(_0x34e1('0x7'));var client=jayson[_0x34e1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3695bf,_0x497910,_0x16d61e){return new BPromise(function(_0x3d7f28,_0x5b5f66){return client[_0x34e1('0x9')](_0x3695bf,_0x16d61e)[_0x34e1('0xa')](function(_0x502723){logger[_0x34e1('0xb')](_0x34e1('0xc'),_0x497910,_0x34e1('0xd'));logger['debug'](_0x34e1('0xe'),_0x497910,_0x34e1('0xd'),JSON[_0x34e1('0xf')](_0x502723));if(_0x502723[_0x34e1('0x10')]){if(_0x502723[_0x34e1('0x10')][_0x34e1('0x11')]===0x1f4){logger[_0x34e1('0x10')](_0x34e1('0xc'),_0x497910,_0x502723[_0x34e1('0x10')][_0x34e1('0x12')]);return _0x5b5f66(_0x502723[_0x34e1('0x10')][_0x34e1('0x12')]);}logger[_0x34e1('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x497910,_0x502723[_0x34e1('0x10')]['message']);return _0x3d7f28(_0x502723[_0x34e1('0x10')]['message']);}else{logger['info'](_0x34e1('0xc'),_0x497910,'request\x20sent');_0x3d7f28(_0x502723['result'][_0x34e1('0x12')]);}})[_0x34e1('0x13')](function(_0x52406c){logger[_0x34e1('0x10')](_0x34e1('0xc'),_0x497910,_0x52406c);_0x5b5f66(_0x52406c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 0fb55c1..8c03e59 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 _0xd324=['util','path','express','Router','../../config/environment','multer'];(function(_0x4d201a,_0x56634c){var _0x46ee34=function(_0x3fb07e){while(--_0x3fb07e){_0x4d201a['push'](_0x4d201a['shift']());}};_0x46ee34(++_0x56634c);}(_0xd324,0x137));var _0x4d32=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xd324[_0x3b150c];return _0x5cd414;};'use strict';var multer=require(_0x4d32('0x0'));var util=require(_0x4d32('0x1'));var path=require(_0x4d32('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d32('0x3'));var router=express[_0x4d32('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d32('0x5'));module['exports']=router; \ No newline at end of file +var _0xc52f=['../../config/environment','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc52f,0x151));var _0xfc52=function(_0x4d8c69,_0x4d3103){_0x4d8c69=_0x4d8c69-0x0;var _0x79ffa0=_0xc52f[_0x4d8c69];return _0x79ffa0;};'use strict';var multer=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var path=require(_0xfc52('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfc52('0x3')]();var auth=require(_0xfc52('0x4'));var interaction=require(_0xfc52('0x5'));var config=require(_0xfc52('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b5eaf35..f040e85 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x43ebc4,_0x18c953){var _0x25e6eb=function(_0xb07626){while(--_0xb07626){_0x43ebc4['push'](_0x43ebc4['shift']());}};_0x25e6eb(++_0x18c953);}(_0xe706,0xa3));var _0x6e70=function(_0x21d1eb,_0x56f664){_0x21d1eb=_0x21d1eb-0x0;var _0x4cb8cd=_0xe706[_0x21d1eb];return _0x4cb8cd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1a1847,_0x1f03d4){var _0x2a5c2b=function(_0xffe339){while(--_0xffe339){_0x1a1847['push'](_0x1a1847['shift']());}};_0x2a5c2b(++_0x1f03d4);}(_0xe706,0xa3));var _0x6e70=function(_0x19ff50,_0x4ec334){_0x19ff50=_0x19ff50-0x0;var _0x33b996=_0xe706[_0x19ff50];return _0x33b996;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index abb4d27..dbb7555 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 _0x960d=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x4195ff,_0x21e279){var _0x28aa13=function(_0x508dea){while(--_0x508dea){_0x4195ff['push'](_0x4195ff['shift']());}};_0x28aa13(++_0x21e279);}(_0x960d,0x172));var _0xd960=function(_0x4b1753,_0x5b814c){_0x4b1753=_0x4b1753-0x0;var _0x3434f9=_0x960d[_0x4b1753];return _0x3434f9;};'use strict';var _=require(_0xd960('0x0'));var util=require(_0xd960('0x1'));var logger=require(_0xd960('0x2'))(_0xd960('0x3'));var moment=require(_0xd960('0x4'));var BPromise=require(_0xd960('0x5'));var rp=require(_0xd960('0x6'));var fs=require('fs');var path=require(_0xd960('0x7'));var rimraf=require(_0xd960('0x8'));var config=require(_0xd960('0x9'));var attributes=require(_0xd960('0xa'));module[_0xd960('0xb')]=function(_0x85501e,_0x31f150){return _0x85501e[_0xd960('0xc')](_0xd960('0xd'),attributes,{'tableName':_0xd960('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc58b=['./userSmsQueue.attributes','exports','define','UserSmsQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e0126,_0x528c99){var _0x1a65c0=function(_0x29d754){while(--_0x29d754){_0x1e0126['push'](_0x1e0126['shift']());}};_0x1a65c0(++_0x528c99);}(_0xc58b,0x149));var _0xbc58=function(_0x31bc72,_0x2aef23){_0x31bc72=_0x31bc72-0x0;var _0x20cb43=_0xc58b[_0x31bc72];return _0x20cb43;};'use strict';var _=require('lodash');var util=require(_0xbc58('0x0'));var logger=require(_0xbc58('0x1'))(_0xbc58('0x2'));var moment=require(_0xbc58('0x3'));var BPromise=require(_0xbc58('0x4'));var rp=require(_0xbc58('0x5'));var fs=require('fs');var path=require(_0xbc58('0x6'));var rimraf=require(_0xbc58('0x7'));var config=require(_0xbc58('0x8'));var attributes=require(_0xbc58('0x9'));module[_0xbc58('0xa')]=function(_0x11d23f,_0x1b0959){return _0x11d23f[_0xbc58('0xb')](_0xbc58('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 441a432..351a0a7 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 _0x7e17=['request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xb0fd3d,_0x536160){var _0x4add3b=function(_0x4a78a6){while(--_0x4a78a6){_0xb0fd3d['push'](_0xb0fd3d['shift']());}};_0x4add3b(++_0x536160);}(_0x7e17,0x109));var _0x77e1=function(_0x40ca0c,_0x1d3ce0){_0x40ca0c=_0x40ca0c-0x0;var _0x5a1c45=_0x7e17[_0x40ca0c];return _0x5a1c45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x77e1('0x0'));var BPromise=require(_0x77e1('0x1'));var rs=require(_0x77e1('0x2'));var fs=require('fs');var Redis=require(_0x77e1('0x3'));var db=require(_0x77e1('0x4'))['db'];var utils=require(_0x77e1('0x5'));var logger=require(_0x77e1('0x6'))(_0x77e1('0x7'));var config=require(_0x77e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77e1('0x9')][_0x77e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25b84d,_0x181717,_0x5c4348){return new BPromise(function(_0x9b512f,_0x1e40e1){return client[_0x77e1('0xb')](_0x25b84d,_0x5c4348)[_0x77e1('0xc')](function(_0x33974f){logger[_0x77e1('0xd')](_0x77e1('0xe'),_0x181717,_0x77e1('0xf'));logger[_0x77e1('0x10')](_0x77e1('0x11'),_0x181717,_0x77e1('0xf'),JSON[_0x77e1('0x12')](_0x33974f));if(_0x33974f[_0x77e1('0x13')]){if(_0x33974f['error'][_0x77e1('0x14')]===0x1f4){logger[_0x77e1('0x13')](_0x77e1('0xe'),_0x181717,_0x33974f[_0x77e1('0x13')][_0x77e1('0x15')]);return _0x1e40e1(_0x33974f[_0x77e1('0x13')][_0x77e1('0x15')]);}logger['error'](_0x77e1('0xe'),_0x181717,_0x33974f['error'][_0x77e1('0x15')]);return _0x9b512f(_0x33974f[_0x77e1('0x13')][_0x77e1('0x15')]);}else{logger[_0x77e1('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x181717,_0x77e1('0xf'));_0x9b512f(_0x33974f['result'][_0x77e1('0x15')]);}})[_0x77e1('0x16')](function(_0x4cf839){logger[_0x77e1('0x13')](_0x77e1('0xe'),_0x181717,_0x4cf839);_0x1e40e1(_0x4cf839);});});} \ No newline at end of file +var _0x3a99=['UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x3a99,0x127));var _0x93a9=function(_0xc1100f,_0x5e636b){_0xc1100f=_0xc1100f-0x0;var _0x110e21=_0x3a99[_0xc1100f];return _0x110e21;};'use strict';var _=require(_0x93a9('0x0'));var util=require('util');var moment=require(_0x93a9('0x1'));var BPromise=require(_0x93a9('0x2'));var rs=require(_0x93a9('0x3'));var fs=require('fs');var Redis=require(_0x93a9('0x4'));var db=require(_0x93a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93a9('0x6'))('rpc');var config=require(_0x93a9('0x7'));var jayson=require(_0x93a9('0x8'));var client=jayson[_0x93a9('0x9')][_0x93a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b3327,_0x34f480,_0xadab50){return new BPromise(function(_0x5b1c96,_0x2312f5){return client[_0x93a9('0xb')](_0x3b3327,_0xadab50)['then'](function(_0x393cc0){logger[_0x93a9('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x34f480,'request\x20sent');logger['debug'](_0x93a9('0xd'),_0x34f480,_0x93a9('0xe'),JSON[_0x93a9('0xf')](_0x393cc0));if(_0x393cc0[_0x93a9('0x10')]){if(_0x393cc0[_0x93a9('0x10')][_0x93a9('0x11')]===0x1f4){logger[_0x93a9('0x10')](_0x93a9('0x12'),_0x34f480,_0x393cc0['error'][_0x93a9('0x13')]);return _0x2312f5(_0x393cc0[_0x93a9('0x10')][_0x93a9('0x13')]);}logger[_0x93a9('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x34f480,_0x393cc0[_0x93a9('0x10')][_0x93a9('0x13')]);return _0x5b1c96(_0x393cc0['error'][_0x93a9('0x13')]);}else{logger[_0x93a9('0xc')](_0x93a9('0x12'),_0x34f480,'request\x20sent');_0x5b1c96(_0x393cc0[_0x93a9('0x14')]['message']);}})[_0x93a9('0x15')](function(_0x4194be){logger[_0x93a9('0x10')](_0x93a9('0x12'),_0x34f480,_0x4194be);_0x2312f5(_0x4194be);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9748a61..0596c1e 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 _0x08a9=['express','Router','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0x48b438,_0xe68c69){var _0x1eee5f=function(_0x3f88df){while(--_0x3f88df){_0x48b438['push'](_0x48b438['shift']());}};_0x1eee5f(++_0xe68c69);}(_0x08a9,0x147));var _0x908a=function(_0x53a29d,_0x3a040a){_0x53a29d=_0x53a29d-0x0;var _0x281d2e=_0x08a9[_0x53a29d];return _0x281d2e;};'use strict';var multer=require('multer');var util=require(_0x908a('0x0'));var path=require('path');var timeout=require(_0x908a('0x1'));var express=require(_0x908a('0x2'));var router=express[_0x908a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x908a('0x4'));var config=require(_0x908a('0x5'));module[_0x908a('0x6')]=router; \ No newline at end of file +var _0x6198=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3d1304,_0x10370a){var _0xca6d48=function(_0x27de79){while(--_0x27de79){_0x3d1304['push'](_0x3d1304['shift']());}};_0xca6d48(++_0x10370a);}(_0x6198,0x122));var _0x8619=function(_0x1b8efc,_0x1543a1){_0x1b8efc=_0x1b8efc-0x0;var _0x10496a=_0x6198[_0x1b8efc];return _0x10496a;};'use strict';var multer=require(_0x8619('0x0'));var util=require(_0x8619('0x1'));var path=require(_0x8619('0x2'));var timeout=require(_0x8619('0x3'));var express=require(_0x8619('0x4'));var router=express[_0x8619('0x5')]();var auth=require(_0x8619('0x6'));var interaction=require(_0x8619('0x7'));var config=require('../../config/environment');module[_0x8619('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e7ab14a..810f1fd 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3fc31d,_0x432bc9){var _0x31bb91=function(_0x1c1640){while(--_0x1c1640){_0x3fc31d['push'](_0x3fc31d['shift']());}};_0x31bb91(++_0x432bc9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xb65f0c,_0xe60c57){var _0x2ff246=function(_0x7d191c){while(--_0x7d191c){_0xb65f0c['push'](_0xb65f0c['shift']());}};_0x2ff246(++_0xe60c57);}(_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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 5c00848..5f9b076 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 _0x4b19=['api','moment','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','../../config/logger'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4b19,0x195));var _0x94b1=function(_0x12b977,_0x36571d){_0x12b977=_0x12b977-0x0;var _0x653c0=_0x4b19[_0x12b977];return _0x653c0;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('UserVoiceQueue',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae24=['../../config/logger','moment','bluebird','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash'];(function(_0x428871,_0x427e80){var _0x1277d5=function(_0x6b7edf){while(--_0x6b7edf){_0x428871['push'](_0x428871['shift']());}};_0x1277d5(++_0x427e80);}(_0xae24,0x182));var _0x4ae2=function(_0x1fa8a1,_0x57c057){_0x1fa8a1=_0x1fa8a1-0x0;var _0x28397c=_0xae24[_0x1fa8a1];return _0x28397c;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));module[_0x4ae2('0x6')]=function(_0x20c85c,_0x3e6055){return _0x20c85c[_0x4ae2('0x7')](_0x4ae2('0x8'),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 679f9a0..5d9a3b6 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 _0x76fa=['info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x76fa,0x73));var _0xa76f=function(_0xd791ec,_0x20ad07){_0xd791ec=_0xd791ec-0x0;var _0x485c78=_0x76fa[_0xd791ec];return _0x485c78;};'use strict';var _=require(_0xa76f('0x0'));var util=require(_0xa76f('0x1'));var moment=require(_0xa76f('0x2'));var BPromise=require(_0xa76f('0x3'));var rs=require(_0xa76f('0x4'));var fs=require('fs');var Redis=require(_0xa76f('0x5'));var db=require(_0xa76f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa76f('0x7'));var config=require('../../config/environment');var jayson=require(_0xa76f('0x8'));var client=jayson[_0xa76f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x141e32,_0x3880f8,_0xccf5ed){return new BPromise(function(_0x5c3367,_0xbeafb3){return client[_0xa76f('0xa')](_0x141e32,_0xccf5ed)['then'](function(_0x46c374){logger[_0xa76f('0xb')](_0xa76f('0xc'),_0x3880f8,'request\x20sent');logger[_0xa76f('0xd')](_0xa76f('0xe'),_0x3880f8,_0xa76f('0xf'),JSON[_0xa76f('0x10')](_0x46c374));if(_0x46c374['error']){if(_0x46c374[_0xa76f('0x11')]['code']===0x1f4){logger[_0xa76f('0x11')](_0xa76f('0xc'),_0x3880f8,_0x46c374[_0xa76f('0x11')][_0xa76f('0x12')]);return _0xbeafb3(_0x46c374[_0xa76f('0x11')][_0xa76f('0x12')]);}logger[_0xa76f('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3880f8,_0x46c374[_0xa76f('0x11')][_0xa76f('0x12')]);return _0x5c3367(_0x46c374['error'][_0xa76f('0x12')]);}else{logger[_0xa76f('0xb')](_0xa76f('0xc'),_0x3880f8,_0xa76f('0xf'));_0x5c3367(_0x46c374[_0xa76f('0x13')][_0xa76f('0x12')]);}})[_0xa76f('0x14')](function(_0x489ca0){logger[_0xa76f('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3880f8,_0x489ca0);_0xbeafb3(_0x489ca0);});});} \ No newline at end of file +var _0xf0bb=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then'];(function(_0x2258e8,_0x396f17){var _0x539892=function(_0x5cd308){while(--_0x5cd308){_0x2258e8['push'](_0x2258e8['shift']());}};_0x539892(++_0x396f17);}(_0xf0bb,0x128));var _0xbf0b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf0bb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbf0b('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(_0xbf0b('0x1'))['db'];var utils=require(_0xbf0b('0x2'));var logger=require('../../config/logger')(_0xbf0b('0x3'));var config=require('../../config/environment');var jayson=require(_0xbf0b('0x4'));var client=jayson['client'][_0xbf0b('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5e33f2,_0x4a3ed9,_0x5a27c8){return new BPromise(function(_0x45a0b8,_0x276806){return client[_0xbf0b('0x6')](_0x5e33f2,_0x5a27c8)[_0xbf0b('0x7')](function(_0x34d295){logger['info'](_0xbf0b('0x8'),_0x4a3ed9,_0xbf0b('0x9'));logger[_0xbf0b('0xa')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4a3ed9,_0xbf0b('0x9'),JSON[_0xbf0b('0xb')](_0x34d295));if(_0x34d295[_0xbf0b('0xc')]){if(_0x34d295[_0xbf0b('0xc')]['code']===0x1f4){logger['error'](_0xbf0b('0x8'),_0x4a3ed9,_0x34d295[_0xbf0b('0xc')]['message']);return _0x276806(_0x34d295[_0xbf0b('0xc')][_0xbf0b('0xd')]);}logger[_0xbf0b('0xc')](_0xbf0b('0x8'),_0x4a3ed9,_0x34d295['error'][_0xbf0b('0xd')]);return _0x45a0b8(_0x34d295['error'][_0xbf0b('0xd')]);}else{logger[_0xbf0b('0xe')](_0xbf0b('0x8'),_0x4a3ed9,_0xbf0b('0x9'));_0x45a0b8(_0x34d295[_0xbf0b('0xf')][_0xbf0b('0xd')]);}})['catch'](function(_0x3cca86){logger[_0xbf0b('0xc')](_0xbf0b('0x8'),_0x4a3ed9,_0x3cca86);_0x276806(_0x3cca86);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9ac1e2f..444c97a 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 _0xfd1d=['util','path','../../components/interaction/service','../../config/environment','exports'];(function(_0x2fb3ef,_0xa1e5af){var _0x3215fc=function(_0x43bdee){while(--_0x43bdee){_0x2fb3ef['push'](_0x2fb3ef['shift']());}};_0x3215fc(++_0xa1e5af);}(_0xfd1d,0x127));var _0xdfd1=function(_0x347b1c,_0x3de68b){_0x347b1c=_0x347b1c-0x0;var _0x435cd2=_0xfd1d[_0x347b1c];return _0x435cd2;};'use strict';var multer=require('multer');var util=require(_0xdfd1('0x0'));var path=require(_0xdfd1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdfd1('0x2'));var config=require(_0xdfd1('0x3'));module[_0xdfd1('0x4')]=router; \ No newline at end of file +var _0x16d8=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x16d8,0xa3));var _0x816d=function(_0x59b2cb,_0x37c12d){_0x59b2cb=_0x59b2cb-0x0;var _0x25c36d=_0x16d8[_0x59b2cb];return _0x25c36d;};'use strict';var multer=require('multer');var util=require(_0x816d('0x0'));var path=require(_0x816d('0x1'));var timeout=require(_0x816d('0x2'));var express=require(_0x816d('0x3'));var router=express[_0x816d('0x4')]();var auth=require(_0x816d('0x5'));var interaction=require(_0x816d('0x6'));var config=require(_0x816d('0x7'));module[_0x816d('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6ebdbe4..86b3e7e 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 _0x2685=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x22990a,_0x4751c1){var _0x4ce2e3=function(_0x202c58){while(--_0x202c58){_0x22990a['push'](_0x22990a['shift']());}};_0x4ce2e3(++_0x4751c1);}(_0x2685,0xdb));var _0x5268=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0x2685[_0x1e9e56];return _0x5d5e2e;};'use strict';var Sequelize=require(_0x5268('0x0'));module[_0x5268('0x1')]={'uniqueid':{'type':Sequelize[_0x5268('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5268('0x3')},'membername':{'type':Sequelize[_0x5268('0x4')],'allowNull':![],'comment':_0x5268('0x3')},'UserId':{'type':Sequelize[_0x5268('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5268('0x4')],'allowNull':![],'unique':_0x5268('0x5'),'comment':_0x5268('0x3')},'VoiceQueueId':{'type':Sequelize[_0x5268('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5268('0x4')],'allowNull':![],'unique':_0x5268('0x5'),'comment':_0x5268('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x5268('0x3')},'paused':{'type':Sequelize[_0x5268('0x2')](0xb),'defaultValue':0x0,'comment':_0x5268('0x3')}}; \ No newline at end of file +var _0x3048=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x3048,0x173));var _0x8304=function(_0x5288c1,_0x3fc67a){_0x5288c1=_0x5288c1-0x0;var _0x37dd76=_0x3048[_0x5288c1];return _0x37dd76;};'use strict';var Sequelize=require('sequelize');module[_0x8304('0x0')]={'uniqueid':{'type':Sequelize[_0x8304('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8304('0x2')},'membername':{'type':Sequelize[_0x8304('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x8304('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8304('0x4'),'comment':_0x8304('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8304('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x8304('0x3')],'allowNull':![],'unique':_0x8304('0x4'),'comment':_0x8304('0x2')},'penalty':{'type':Sequelize[_0x8304('0x1')](0xb),'defaultValue':0x0,'comment':_0x8304('0x2')},'paused':{'type':Sequelize[_0x8304('0x1')](0xb),'defaultValue':0x0,'comment':_0x8304('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 8b32f74..eb138e3 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 _0xaf99=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x5ea825,_0x2cb2bb){var _0x180af3=function(_0x5632b7){while(--_0x5632b7){_0x5ea825['push'](_0x5ea825['shift']());}};_0x180af3(++_0x2cb2bb);}(_0xaf99,0x95));var _0x9af9=function(_0x13ea77,_0x395d11){_0x13ea77=_0x13ea77-0x0;var _0x15298c=_0xaf99[_0x13ea77];return _0x15298c;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x9af9('0x0'))['db'][_0x9af9('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9af9('0x2')](0x0);var events={'afterCreate':_0x9af9('0x3'),'afterUpdate':_0x9af9('0x4'),'afterDestroy':_0x9af9('0x5')};function emitEvent(_0x22269d){return function(_0xef370d,_0x50135b,_0x22db3f){UserVoiceQueueRtEvents[_0x9af9('0x6')](_0x22269d+':'+_0xef370d['id'],_0xef370d);UserVoiceQueueRtEvents[_0x9af9('0x6')](_0x22269d,_0xef370d);_0x22db3f(null);};}for(var e in events){if(events[_0x9af9('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x9af9('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5239=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3a9cfd,_0x4755a8){var _0x3248cc=function(_0x959046){while(--_0x959046){_0x3a9cfd['push'](_0x3a9cfd['shift']());}};_0x3248cc(++_0x4755a8);}(_0x5239,0x91));var _0x9523=function(_0x486a8f,_0x86825a){_0x486a8f=_0x486a8f-0x0;var _0x5640fe=_0x5239[_0x486a8f];return _0x5640fe;};'use strict';var EventEmitter=require(_0x9523('0x0'));var UserVoiceQueueRt=require(_0x9523('0x1'))['db'][_0x9523('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9523('0x3')](0x0);var events={'afterCreate':_0x9523('0x4'),'afterUpdate':_0x9523('0x5'),'afterDestroy':_0x9523('0x6')};function emitEvent(_0x344f2b){return function(_0x3f0540,_0x3157fc,_0x5037f7){UserVoiceQueueRtEvents[_0x9523('0x7')](_0x344f2b+':'+_0x3f0540['id'],_0x3f0540);UserVoiceQueueRtEvents['emit'](_0x344f2b,_0x3f0540);_0x5037f7(null);};}for(var e in events){if(events[_0x9523('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9523('0x9')](e,emitEvent(event));}}module[_0x9523('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 574268c..165c96e 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 _0xf725=['request-promise','path','rimraf','./userVoiceQueueRt.attributes','UserVoiceQueueRt','lodash','util','../../config/logger','api','bluebird'];(function(_0x3bf2c2,_0x13a048){var _0x34780b=function(_0x491ff2){while(--_0x491ff2){_0x3bf2c2['push'](_0x3bf2c2['shift']());}};_0x34780b(++_0x13a048);}(_0xf725,0xf5));var _0x5f72=function(_0x43d85f,_0x34bc93){_0x43d85f=_0x43d85f-0x0;var _0x2f45b4=_0xf725[_0x43d85f];return _0x2f45b4;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var logger=require(_0x5f72('0x2'))(_0x5f72('0x3'));var moment=require('moment');var BPromise=require(_0x5f72('0x4'));var rp=require(_0x5f72('0x5'));var fs=require('fs');var path=require(_0x5f72('0x6'));var rimraf=require(_0x5f72('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f72('0x8'));module['exports']=function(_0x562aed,_0x247c76){return _0x562aed['define'](_0x5f72('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f8c=['exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userVoiceQueueRt.attributes'];(function(_0x2f4ba0,_0x4ba722){var _0x40c1a9=function(_0x5745d9){while(--_0x5745d9){_0x2f4ba0['push'](_0x2f4ba0['shift']());}};_0x40c1a9(++_0x4ba722);}(_0x9f8c,0x18f));var _0xc9f8=function(_0x3fcebf,_0x4facc8){_0x3fcebf=_0x3fcebf-0x0;var _0x5793b9=_0x9f8c[_0x3fcebf];return _0x5793b9;};'use strict';var _=require(_0xc9f8('0x0'));var util=require(_0xc9f8('0x1'));var logger=require(_0xc9f8('0x2'))(_0xc9f8('0x3'));var moment=require(_0xc9f8('0x4'));var BPromise=require(_0xc9f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9f8('0x6'));var rimraf=require(_0xc9f8('0x7'));var config=require('../../config/environment');var attributes=require(_0xc9f8('0x8'));module[_0xc9f8('0x9')]=function(_0x3f8bb9,_0x361a22){return _0x3f8bb9[_0xc9f8('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0xc9f8('0xb'),'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 23acb22..ccd1e33 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 _0xc4e8=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','outboundQueuePauses','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x314fba,_0x4ee8c0){var _0x1b8a76=function(_0xeb6d66){while(--_0xeb6d66){_0x314fba['push'](_0x314fba['shift']());}};_0x1b8a76(++_0x4ee8c0);}(_0xc4e8,0xcb));var _0x8c4e=function(_0x1acf4a,_0x3bda51){_0x1acf4a=_0x1acf4a-0x0;var _0x5c0b70=_0xc4e8[_0x1acf4a];return _0x5c0b70;};'use strict';var _=require(_0x8c4e('0x0'));var util=require(_0x8c4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c4e('0x2'));var fs=require('fs');var Redis=require(_0x8c4e('0x3'));var db=require(_0x8c4e('0x4'))['db'];var utils=require(_0x8c4e('0x5'));var logger=require(_0x8c4e('0x6'))(_0x8c4e('0x7'));var config=require(_0x8c4e('0x8'));var jayson=require(_0x8c4e('0x9'));var client=jayson['client'][_0x8c4e('0xa')]({'port':0x232a});config[_0x8c4e('0xb')]=_[_0x8c4e('0xc')](config[_0x8c4e('0xb')],{'host':_0x8c4e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c4e('0xb')]));require(_0x8c4e('0xe'))['register'](socket);function respondWithRpcPromise(_0x263ca6,_0xabae1e,_0x26ed15){return new BPromise(function(_0x4756fe,_0x3de1a3){return client[_0x8c4e('0xf')](_0x263ca6,_0x26ed15)[_0x8c4e('0x10')](function(_0x10227f){logger[_0x8c4e('0x11')](_0x8c4e('0x12'),_0xabae1e,_0x8c4e('0x13'));logger[_0x8c4e('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xabae1e,'request\x20sent',JSON['stringify'](_0x10227f));if(_0x10227f['error']){if(_0x10227f[_0x8c4e('0x15')][_0x8c4e('0x16')]===0x1f4){logger[_0x8c4e('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xabae1e,_0x10227f[_0x8c4e('0x15')]['message']);return _0x3de1a3(_0x10227f[_0x8c4e('0x15')][_0x8c4e('0x17')]);}logger[_0x8c4e('0x15')](_0x8c4e('0x12'),_0xabae1e,_0x10227f[_0x8c4e('0x15')][_0x8c4e('0x17')]);return _0x4756fe(_0x10227f[_0x8c4e('0x15')][_0x8c4e('0x17')]);}else{logger[_0x8c4e('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xabae1e,_0x8c4e('0x13'));_0x4756fe(_0x10227f[_0x8c4e('0x18')][_0x8c4e('0x17')]);}})[_0x8c4e('0x19')](function(_0x289fdb){logger[_0x8c4e('0x15')](_0x8c4e('0x12'),_0xabae1e,_0x289fdb);_0x3de1a3(_0x289fdb);});});}exports[_0x8c4e('0x1a')]=function(_0x2e23b2){var _0x115025=this;return new Promise(function(_0x4bacae,_0x5ac991){return db[_0x8c4e('0x1b')][_0x8c4e('0x1c')]({'raw':_0x2e23b2[_0x8c4e('0x1d')]?_0x2e23b2[_0x8c4e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2e23b2[_0x8c4e('0x1d')]?_0x2e23b2[_0x8c4e('0x1d')][_0x8c4e('0x1e')]||null:null,'attributes':[[db[_0x8c4e('0x1f')]['fn'](_0x8c4e('0x20'),db['sequelize']['fn']('IF',db[_0x8c4e('0x1f')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x8c4e('0x21')]]})[_0x8c4e('0x10')](function(_0x406254){logger['info'](_0x8c4e('0x1a'),_0x2e23b2);logger[_0x8c4e('0x14')]('GetVoiceQueueRtPauses',_0x2e23b2,JSON[_0x8c4e('0x22')](_0x406254));_0x4bacae(_0x406254);})[_0x8c4e('0x19')](function(_0x5d26bc){logger[_0x8c4e('0x15')]('GetVoiceQueueRtPauses',_0x5d26bc[_0x8c4e('0x17')],_0x2e23b2);_0x5ac991(_0x115025['error'](0x1f4,_0x5d26bc[_0x8c4e('0x17')]));});});}; \ No newline at end of file +var _0x39b7=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./userVoiceQueueRt.socket','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','randomstring'];(function(_0x361e9c,_0x47bdbf){var _0x13c601=function(_0x28a5f8){while(--_0x28a5f8){_0x361e9c['push'](_0x361e9c['shift']());}};_0x13c601(++_0x47bdbf);}(_0x39b7,0x12e));var _0x739b=function(_0x2642eb,_0x38d2ef){_0x2642eb=_0x2642eb-0x0;var _0x2758ed=_0x39b7[_0x2642eb];return _0x2758ed;};'use strict';var _=require(_0x739b('0x0'));var util=require(_0x739b('0x1'));var moment=require(_0x739b('0x2'));var BPromise=require('bluebird');var rs=require(_0x739b('0x3'));var fs=require('fs');var Redis=require(_0x739b('0x4'));var db=require(_0x739b('0x5'))['db'];var utils=require(_0x739b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x739b('0x7'));var jayson=require(_0x739b('0x8'));var client=jayson[_0x739b('0x9')][_0x739b('0xa')]({'port':0x232a});config[_0x739b('0xb')]=_[_0x739b('0xc')](config[_0x739b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x739b('0xb')]));require(_0x739b('0xd'))['register'](socket);function respondWithRpcPromise(_0x2cfacb,_0x48a4d7,_0x5dae44){return new BPromise(function(_0x387d95,_0x60033a){return client[_0x739b('0xe')](_0x2cfacb,_0x5dae44)[_0x739b('0xf')](function(_0x494b2c){logger[_0x739b('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x48a4d7,_0x739b('0x11'));logger[_0x739b('0x12')](_0x739b('0x13'),_0x48a4d7,_0x739b('0x11'),JSON[_0x739b('0x14')](_0x494b2c));if(_0x494b2c[_0x739b('0x15')]){if(_0x494b2c[_0x739b('0x15')]['code']===0x1f4){logger[_0x739b('0x15')](_0x739b('0x16'),_0x48a4d7,_0x494b2c['error'][_0x739b('0x17')]);return _0x60033a(_0x494b2c[_0x739b('0x15')][_0x739b('0x17')]);}logger[_0x739b('0x15')](_0x739b('0x16'),_0x48a4d7,_0x494b2c[_0x739b('0x15')][_0x739b('0x17')]);return _0x387d95(_0x494b2c[_0x739b('0x15')][_0x739b('0x17')]);}else{logger[_0x739b('0x10')](_0x739b('0x16'),_0x48a4d7,'request\x20sent');_0x387d95(_0x494b2c[_0x739b('0x18')][_0x739b('0x17')]);}})[_0x739b('0x19')](function(_0x57890b){logger[_0x739b('0x15')](_0x739b('0x16'),_0x48a4d7,_0x57890b);_0x60033a(_0x57890b);});});}exports[_0x739b('0x1a')]=function(_0x34a56b){var _0x40590f=this;return new Promise(function(_0x5e9c0d,_0x6014f6){return db[_0x739b('0x1b')][_0x739b('0x1c')]({'raw':_0x34a56b[_0x739b('0x1d')]?_0x34a56b[_0x739b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x34a56b[_0x739b('0x1d')]?_0x34a56b[_0x739b('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x739b('0x1e'),db[_0x739b('0x1f')]['fn']('IF',db[_0x739b('0x1f')][_0x739b('0x20')](_0x739b('0x21')))),'outboundQueuePauses']]})[_0x739b('0xf')](function(_0x502160){logger[_0x739b('0x10')](_0x739b('0x1a'),_0x34a56b);logger[_0x739b('0x12')](_0x739b('0x1a'),_0x34a56b,JSON[_0x739b('0x14')](_0x502160));_0x5e9c0d(_0x502160);})[_0x739b('0x19')](function(_0x279958){logger[_0x739b('0x15')](_0x739b('0x1a'),_0x279958['message'],_0x34a56b);_0x6014f6(_0x40590f[_0x739b('0x15')](0x1f4,_0x279958[_0x739b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a804c6f..40feda2 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 _0x176c=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit','removeListener'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x176c,0x14b));var _0xc176=function(_0x1b7bfe,_0x542c18){_0x1b7bfe=_0x1b7bfe-0x0;var _0x89e986=_0x176c[_0x1b7bfe];return _0x89e986;};'use strict';var UserVoiceQueueRtEvents=require(_0xc176('0x0'));var events=[_0xc176('0x1'),'remove',_0xc176('0x2')];function createListener(_0x560541,_0x49ca51){return function(_0x15ac8d){_0x49ca51[_0xc176('0x3')](_0x560541,_0x15ac8d);};}function removeListener(_0x3dc9be,_0x1ba179){return function(){UserVoiceQueueRtEvents[_0xc176('0x4')](_0x3dc9be,_0x1ba179);};}exports[_0xc176('0x5')]=function(_0x9eacd8){for(var _0x2e6c33=0x0,_0x2c8568=events[_0xc176('0x6')];_0x2e6c33<_0x2c8568;_0x2e6c33++){var _0x394801=events[_0x2e6c33];var _0x4982b2=createListener(_0xc176('0x7')+_0x394801,_0x9eacd8);UserVoiceQueueRtEvents['on'](_0x394801,_0x4982b2);}}; \ No newline at end of file +var _0x0f4e=['update','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x0f4e,0x1b9));var _0xe0f4=function(_0x308a1d,_0x3d379d){_0x308a1d=_0x308a1d-0x0;var _0x5eb875=_0x0f4e[_0x308a1d];return _0x5eb875;};'use strict';var UserVoiceQueueRtEvents=require(_0xe0f4('0x0'));var events=[_0xe0f4('0x1'),_0xe0f4('0x2'),_0xe0f4('0x3')];function createListener(_0x39f267,_0x2dae45){return function(_0x320e0f){_0x2dae45['emit'](_0x39f267,_0x320e0f);};}function removeListener(_0x5cf980,_0x1780c6){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5cf980,_0x1780c6);};}exports['register']=function(_0x3502dd){for(var _0x390ff2=0x0,_0x5f26fc=events[_0xe0f4('0x4')];_0x390ff2<_0x5f26fc;_0x390ff2++){var _0x3db8c2=events[_0x390ff2];var _0x2d63dc=createListener(_0xe0f4('0x5')+_0x3db8c2,_0x3502dd);UserVoiceQueueRtEvents['on'](_0x3db8c2,_0x2d63dc);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ba8e981..7840b9f 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 _0xbc0c=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path','express'];(function(_0x162339,_0x15ea5a){var _0x30cddc=function(_0x41e20c){while(--_0x41e20c){_0x162339['push'](_0x162339['shift']());}};_0x30cddc(++_0x15ea5a);}(_0xbc0c,0x1f4));var _0xcbc0=function(_0x149dc8,_0x2e1e99){_0x149dc8=_0x149dc8-0x0;var _0x4be5fc=_0xbc0c[_0x149dc8];return _0x4be5fc;};'use strict';var multer=require(_0xcbc0('0x0'));var util=require(_0xcbc0('0x1'));var path=require(_0xcbc0('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbc0('0x3'));var router=express[_0xcbc0('0x4')]();var auth=require(_0xcbc0('0x5'));var interaction=require(_0xcbc0('0x6'));var config=require('../../config/environment');module[_0xcbc0('0x7')]=router; \ No newline at end of file +var _0xfb49=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x1e4aa1,_0x458f0d){var _0x2aed6f=function(_0x2d6501){while(--_0x2d6501){_0x1e4aa1['push'](_0x1e4aa1['shift']());}};_0x2aed6f(++_0x458f0d);}(_0xfb49,0x1ac));var _0x9fb4=function(_0x20a137,_0x4d9549){_0x20a137=_0x20a137-0x0;var _0x3dc414=_0xfb49[_0x20a137];return _0x3dc414;};'use strict';var multer=require(_0x9fb4('0x0'));var util=require(_0x9fb4('0x1'));var path=require(_0x9fb4('0x2'));var timeout=require(_0x9fb4('0x3'));var express=require('express');var router=express[_0x9fb4('0x4')]();var auth=require(_0x9fb4('0x5'));var interaction=require(_0x9fb4('0x6'));var config=require(_0x9fb4('0x7'));module[_0x9fb4('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 ac840e8..2549e97 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0xb408f1,_0x27ab44){var _0x17dc0f=function(_0x5549cf){while(--_0x5549cf){_0xb408f1['push'](_0xb408f1['shift']());}};_0x17dc0f(++_0x27ab44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x467721,_0x2412ab){var _0x2c1b4b=function(_0x5c9653){while(--_0x5c9653){_0x467721['push'](_0x467721['shift']());}};_0x2c1b4b(++_0x2412ab);}(_0xb10b,0x12a));var _0xbb10=function(_0x257268,_0x2d5655){_0x257268=_0x257268-0x0;var _0x5a7a98=_0xb10b[_0x257268];return _0x5a7a98;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index fad92de..8459cbb 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 _0x3f8c=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api','moment','bluebird'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x3f8c,0x104));var _0xc3f8=function(_0x6e5d07,_0xf1fdb9){_0x6e5d07=_0x6e5d07-0x0;var _0x64439=_0x3f8c[_0x6e5d07];return _0x64439;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xc3f8('0x4')]=function(_0x1a6976,_0x3a4e2f){return _0x1a6976[_0xc3f8('0x5')](_0xc3f8('0x6'),attributes,{'tableName':_0xc3f8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ce=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','lodash'];(function(_0x4c731b,_0x596815){var _0x96072c=function(_0x52be7b){while(--_0x52be7b){_0x4c731b['push'](_0x4c731b['shift']());}};_0x96072c(++_0x596815);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3e9747,_0x4787f5){_0x3e9747=_0x3e9747-0x0;var _0x2966bf=_0x02ce[_0x3e9747];return _0x2966bf;};'use strict';var _=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var logger=require(_0xe02c('0x2'))('api');var moment=require(_0xe02c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe02c('0x4'));var fs=require('fs');var path=require(_0xe02c('0x5'));var rimraf=require(_0xe02c('0x6'));var config=require(_0xe02c('0x7'));var attributes=require(_0xe02c('0x8'));module[_0xe02c('0x9')]=function(_0x3f7436,_0x2b804f){return _0x3f7436[_0xe02c('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','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 9475caf..7a44972 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(_0x372042,_0x5e3475){var _0x5a0ceb=function(_0xe7e1ef){while(--_0xe7e1ef){_0x372042['push'](_0x372042['shift']());}};_0x5a0ceb(++_0x5e3475);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x1e7ce1,_0x235538){var _0x514525=function(_0x285652){while(--_0x285652){_0x1e7ce1['push'](_0x1e7ce1['shift']());}};_0x514525(++_0x235538);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a77ae14..a5f1b1e 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 _0x6986=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0x6986,0x148));var _0x6698=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x6986[_0x179c4a];return _0x5d1879;};'use strict';var multer=require(_0x6698('0x0'));var util=require(_0x6698('0x1'));var path=require('path');var timeout=require(_0x6698('0x2'));var express=require(_0x6698('0x3'));var router=express[_0x6698('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6698('0x5'));var config=require(_0x6698('0x6'));var controller=require(_0x6698('0x7'));router[_0x6698('0x8')]('/',auth[_0x6698('0x9')](),controller[_0x6698('0xa')]);router[_0x6698('0x8')](_0x6698('0xb'),auth['isAuthenticated'](),controller[_0x6698('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6698('0xd')]);router[_0x6698('0xe')](_0x6698('0xb'),auth[_0x6698('0x9')](),controller[_0x6698('0xf')]);router[_0x6698('0x10')](_0x6698('0xb'),auth[_0x6698('0x9')](),controller[_0x6698('0x11')]);module[_0x6698('0x12')]=router; \ No newline at end of file +var _0x6891=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','put','update'];(function(_0x2823ac,_0x598d44){var _0x2ae033=function(_0x2bbf25){while(--_0x2bbf25){_0x2823ac['push'](_0x2823ac['shift']());}};_0x2ae033(++_0x598d44);}(_0x6891,0x122));var _0x1689=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0x6891[_0x4d0d85];return _0x290a74;};'use strict';var multer=require(_0x1689('0x0'));var util=require('util');var path=require(_0x1689('0x1'));var timeout=require(_0x1689('0x2'));var express=require(_0x1689('0x3'));var router=express[_0x1689('0x4')]();var auth=require(_0x1689('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1689('0x6'));var controller=require(_0x1689('0x7'));router[_0x1689('0x8')]('/',auth[_0x1689('0x9')](),controller['index']);router[_0x1689('0x8')](_0x1689('0xa'),auth[_0x1689('0x9')](),controller[_0x1689('0xb')]);router['post']('/',auth[_0x1689('0x9')](),controller['create']);router[_0x1689('0xc')](_0x1689('0xa'),auth[_0x1689('0x9')](),controller[_0x1689('0xd')]);router[_0x1689('0xe')](_0x1689('0xa'),auth[_0x1689('0x9')](),controller[_0x1689('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index af9bf1c..b2494c5 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 _0xa112=['STRING','exports'];(function(_0x27d8e2,_0x20c049){var _0x5bfe65=function(_0x2f8b61){while(--_0x2f8b61){_0x27d8e2['push'](_0x27d8e2['shift']());}};_0x5bfe65(++_0x20c049);}(_0xa112,0x1ad));var _0x2a11=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa112[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require('sequelize');module[_0x2a11('0x0')]={'name':{'type':Sequelize[_0x2a11('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2a11('0x1')]}}; \ No newline at end of file +var _0xefa7=['STRING','name','sequelize','exports'];(function(_0x158f5a,_0xaacc25){var _0xb3722e=function(_0x1659bd){while(--_0x1659bd){_0x158f5a['push'](_0x158f5a['shift']());}};_0xb3722e(++_0xaacc25);}(_0xefa7,0xba));var _0x7efa=function(_0x2ec9bf,_0x669ba8){_0x2ec9bf=_0x2ec9bf-0x0;var _0x4ad219=_0xefa7[_0x2ec9bf];return _0x4ad219;};'use strict';var Sequelize=require(_0x7efa('0x0'));module[_0x7efa('0x1')]={'name':{'type':Sequelize[_0x7efa('0x2')],'unique':_0x7efa('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 0d45b03..4b3255d 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 _0x46cf=['error','stack','name','send','Variable','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','type','VIRTUAL','filter','where','count','includeAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','status','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource'];(function(_0x428e6f,_0x265edf){var _0x4c6fa0=function(_0x17a4d1){while(--_0x17a4d1){_0x428e6f['push'](_0x428e6f['shift']());}};_0x4c6fa0(++_0x265edf);}(_0x46cf,0x14e));var _0xf46c=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x46cf[_0x1deb03];return _0x189fe7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf46c('0x0'));var zipdir=require(_0xf46c('0x1'));var jsonpatch=require(_0xf46c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf46c('0x3'));var util=require('util');var path=require(_0xf46c('0x4'));var sox=require(_0xf46c('0x5'));var csv=require(_0xf46c('0x6'));var ejs=require(_0xf46c('0x7'));var fs=require('fs');var _=require(_0xf46c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf46c('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf46c('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf46c('0xa'));var qs=require(_0xf46c('0xb'));var as=require(_0xf46c('0xc'));var hardwareService=require(_0xf46c('0xd'));var logger=require('../../config/logger')(_0xf46c('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf46c('0xf'));var db=require(_0xf46c('0x10'))['db'];function respondWithStatusCode(_0x173ac4,_0x52cca2){_0x52cca2=_0x52cca2||0xcc;return function(_0x32a1ce){if(_0x32a1ce){return _0x173ac4['sendStatus'](_0x52cca2);}return _0x173ac4['status'](_0x52cca2)[_0xf46c('0x11')]();};}function respondWithResult(_0x237e36,_0x226e43){_0x226e43=_0x226e43||0xc8;return function(_0x19070a){if(_0x19070a){return _0x237e36[_0xf46c('0x12')](_0x226e43)['json'](_0x19070a);}};}function respondWithFilteredResult(_0x4450a5,_0x20b56f){return function(_0xf61863){if(_0xf61863){var _0x1e4ab6=_0xf61863['count'],_0x17f345=_0x20b56f[_0xf46c('0x13')],_0x4d1f6d=_0x20b56f[_0xf46c('0x13')]+_0x20b56f[_0xf46c('0x14')],_0x3da8d7;if(_0x4d1f6d>=_0x1e4ab6){_0x4d1f6d=_0x1e4ab6;_0x3da8d7=0xc8;}else{_0x3da8d7=0xce;}_0x4450a5[_0xf46c('0x12')](_0x3da8d7);return _0x4450a5[_0xf46c('0x15')](_0xf46c('0x16'),_0x17f345+'-'+_0x4d1f6d+'/'+_0x1e4ab6)['json'](_0xf61863);}return null;};}function patchUpdates(_0x4f01f7){return function(_0x5e9faf){try{jsonpatch[_0xf46c('0x17')](_0x5e9faf,_0x4f01f7,!![]);}catch(_0x5bcce6){return BPromise[_0xf46c('0x18')](_0x5bcce6);}return _0x5e9faf[_0xf46c('0x19')]();};}function saveUpdates(_0x4d9a31,_0x112fac){return function(_0x18cfce){if(_0x18cfce){return _0x18cfce[_0xf46c('0x1a')](_0x4d9a31)['then'](function(_0x269573){return _0x269573;});}return null;};}function removeEntity(_0x1e7764,_0x688109){return function(_0x9f71b7){if(_0x9f71b7){return _0x9f71b7[_0xf46c('0x1b')]()[_0xf46c('0x1c')](function(){var _0x32e285=_0x9f71b7[_0xf46c('0x1d')]({'plain':!![]});var _0x26ac3d='Variables';return db[_0xf46c('0x1e')][_0xf46c('0x1b')]({'where':{'type':_0x26ac3d,'resourceId':_0x32e285['id']}})[_0xf46c('0x1c')](function(){return _0x9f71b7;});})[_0xf46c('0x1c')](function(){_0x1e7764['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x365041,_0x5c987d){return function(_0x4d62d0){if(!_0x4d62d0){_0x365041['sendStatus'](0x194);}return _0x4d62d0;};}function handleError(_0xb283b5,_0x152621){_0x152621=_0x152621||0x1f4;return function(_0x1d42d3){logger[_0xf46c('0x1f')](_0x1d42d3[_0xf46c('0x20')]);if(_0x1d42d3[_0xf46c('0x21')]){delete _0x1d42d3[_0xf46c('0x21')];}_0xb283b5[_0xf46c('0x12')](_0x152621)[_0xf46c('0x22')](_0x1d42d3);};}exports['index']=function(_0x57421b,_0x3b4852){var _0x388628={},_0x3e6e22={},_0xedccda={'count':0x0,'rows':[]};var _0x559b81=_['map'](db[_0xf46c('0x23')][_0xf46c('0x24')],function(_0x32a13a){return{'name':_0x32a13a[_0xf46c('0x25')],'type':_0x32a13a['type'][_0xf46c('0x26')]};});_0x3e6e22[_0xf46c('0x27')]=_['map'](_0x559b81,'name');_0x3e6e22['query']=_[_0xf46c('0x28')](_0x57421b[_0xf46c('0x29')]);_0x3e6e22[_0xf46c('0x2a')]=_[_0xf46c('0x2b')](_0x3e6e22[_0xf46c('0x27')],_0x3e6e22[_0xf46c('0x29')]);_0x388628[_0xf46c('0x2c')]=_[_0xf46c('0x2b')](_0x3e6e22['model'],qs[_0xf46c('0x2d')](_0x57421b['query'][_0xf46c('0x2d')]));_0x388628[_0xf46c('0x2c')]=_0x388628['attributes'][_0xf46c('0x2e')]?_0x388628[_0xf46c('0x2c')]:_0x3e6e22[_0xf46c('0x27')];if(!_0x57421b[_0xf46c('0x29')][_0xf46c('0x2f')]('nolimit')){_0x388628[_0xf46c('0x14')]=qs['limit'](_0x57421b['query']['limit']);_0x388628[_0xf46c('0x13')]=qs['offset'](_0x57421b[_0xf46c('0x29')][_0xf46c('0x13')]);}_0x388628[_0xf46c('0x30')]=qs['sort'](_0x57421b['query'][_0xf46c('0x31')]);_0x388628['where']=qs[_0xf46c('0x2a')](_[_0xf46c('0x32')](_0x57421b[_0xf46c('0x29')],_0x3e6e22[_0xf46c('0x2a')]),_0x559b81);if(_0x57421b[_0xf46c('0x29')]['filter']){_0x388628['where']=_[_0xf46c('0x33')](_0x388628['where'],{'$or':_['map'](_0x559b81,function(_0x4478c9){if(_0x4478c9[_0xf46c('0x34')]!==_0xf46c('0x35')){var _0x5c63e9={};_0x5c63e9[_0x4478c9[_0xf46c('0x21')]]={'$like':'%'+_0x57421b[_0xf46c('0x29')][_0xf46c('0x36')]+'%'};return _0x5c63e9;}})});}_0x388628=_[_0xf46c('0x33')]({},_0x388628,_0x57421b['options']);var _0x8e16e1={'where':_0x388628[_0xf46c('0x37')]};return db['Variable'][_0xf46c('0x38')](_0x8e16e1)['then'](function(_0x200f84){_0xedccda['count']=_0x200f84;if(_0x57421b[_0xf46c('0x29')][_0xf46c('0x39')]){_0x388628['include']=[{'all':!![]}];}return db[_0xf46c('0x23')]['findAll'](_0x388628);})['then'](function(_0x3a7bb8){_0xedccda[_0xf46c('0x3a')]=_0x3a7bb8;return _0xedccda;})[_0xf46c('0x1c')](respondWithFilteredResult(_0x3b4852,_0x388628))[_0xf46c('0x3b')](handleError(_0x3b4852,null));};exports[_0xf46c('0x3c')]=function(_0x4f327e,_0x1892a8){var _0x5541d4={'raw':!![],'where':{'id':_0x4f327e[_0xf46c('0x3d')]['id']}},_0x175218={};_0x175218[_0xf46c('0x27')]=_[_0xf46c('0x28')](db[_0xf46c('0x23')][_0xf46c('0x24')]);_0x175218[_0xf46c('0x29')]=_[_0xf46c('0x28')](_0x4f327e[_0xf46c('0x29')]);_0x175218[_0xf46c('0x2a')]=_[_0xf46c('0x2b')](_0x175218['model'],_0x175218[_0xf46c('0x29')]);_0x5541d4[_0xf46c('0x2c')]=_[_0xf46c('0x2b')](_0x175218['model'],qs[_0xf46c('0x2d')](_0x4f327e[_0xf46c('0x29')][_0xf46c('0x2d')]));_0x5541d4[_0xf46c('0x2c')]=_0x5541d4[_0xf46c('0x2c')]['length']?_0x5541d4[_0xf46c('0x2c')]:_0x175218[_0xf46c('0x27')];if(_0x4f327e[_0xf46c('0x29')][_0xf46c('0x39')]){_0x5541d4[_0xf46c('0x3e')]=[{'all':!![]}];}_0x5541d4=_[_0xf46c('0x33')]({},_0x5541d4,_0x4f327e[_0xf46c('0x3f')]);return db[_0xf46c('0x23')][_0xf46c('0x40')](_0x5541d4)[_0xf46c('0x1c')](handleEntityNotFound(_0x1892a8,null))['then'](respondWithResult(_0x1892a8,null))['catch'](handleError(_0x1892a8,null));};exports['create']=function(_0x827687,_0x14233d){return db['Variable'][_0xf46c('0x41')](_0x827687[_0xf46c('0x42')],{})['then'](function(_0x5a9042){var _0x5894e5=_0x827687[_0xf46c('0x43')][_0xf46c('0x1d')]({'plain':!![]});if(!_0x5894e5)throw new Error(_0xf46c('0x44'));if(_0x5894e5[_0xf46c('0x45')]===_0xf46c('0x43')){var _0x158490=_0x5a9042[_0xf46c('0x1d')]({'plain':!![]});var _0x2f3e6e='Variables';return db[_0xf46c('0x46')][_0xf46c('0x40')]({'where':{'name':_0x2f3e6e,'userProfileId':_0x5894e5['userProfileId']},'raw':!![]})['then'](function(_0x4bb5ed){if(_0x4bb5ed&&_0x4bb5ed[_0xf46c('0x47')]===0x0){return db[_0xf46c('0x1e')][_0xf46c('0x41')]({'name':_0x158490[_0xf46c('0x21')],'resourceId':_0x158490['id'],'type':_0x4bb5ed[_0xf46c('0x21')],'sectionId':_0x4bb5ed['id']},{})[_0xf46c('0x1c')](function(){return _0x5a9042;});}else{return _0x5a9042;}})['catch'](function(_0x20ddc5){logger[_0xf46c('0x1f')](_0xf46c('0x48'),_0x20ddc5);throw _0x20ddc5;});}return _0x5a9042;})[_0xf46c('0x1c')](respondWithResult(_0x14233d,0xc9))['catch'](handleError(_0x14233d,null));};exports[_0xf46c('0x1a')]=function(_0x575aa8,_0x1b4210){if(_0x575aa8[_0xf46c('0x42')]['id']){delete _0x575aa8[_0xf46c('0x42')]['id'];}return db[_0xf46c('0x23')]['find']({'where':{'id':_0x575aa8[_0xf46c('0x3d')]['id']}})[_0xf46c('0x1c')](handleEntityNotFound(_0x1b4210,null))[_0xf46c('0x1c')](saveUpdates(_0x575aa8['body'],null))[_0xf46c('0x1c')](respondWithResult(_0x1b4210,null))[_0xf46c('0x3b')](handleError(_0x1b4210,null));};exports[_0xf46c('0x1b')]=function(_0x5d12d3,_0x5c97f6){return db[_0xf46c('0x23')][_0xf46c('0x40')]({'where':{'id':_0x5d12d3['params']['id']}})[_0xf46c('0x1c')](handleEntityNotFound(_0x5c97f6,null))[_0xf46c('0x1c')](removeEntity(_0x5c97f6,null))[_0xf46c('0x3b')](handleError(_0x5c97f6,null));}; \ No newline at end of file +var _0x134d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','params','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0x134d,0xe2));var _0xd134=function(_0x4311b4,_0x12894a){_0x4311b4=_0x4311b4-0x0;var _0x3c08ef=_0x134d[_0x4311b4];return _0x3c08ef;};'use strict';var pdf=require(_0xd134('0x0'));var emlformat=require(_0xd134('0x1'));var rimraf=require(_0xd134('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd134('0x3'));var rp=require(_0xd134('0x4'));var moment=require(_0xd134('0x5'));var BPromise=require(_0xd134('0x6'));var Mustache=require(_0xd134('0x7'));var util=require(_0xd134('0x8'));var path=require(_0xd134('0x9'));var sox=require(_0xd134('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd134('0xb'));var squel=require(_0xd134('0xc'));var crypto=require(_0xd134('0xd'));var jsforce=require(_0xd134('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd134('0xf'));var querystring=require(_0xd134('0x10'));var Papa=require(_0xd134('0x11'));var Redis=require(_0xd134('0x12'));var authService=require(_0xd134('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd134('0x14'));var hardwareService=require(_0xd134('0x15'));var logger=require('../../config/logger')(_0xd134('0x16'));var utils=require('../../config/utils');var config=require(_0xd134('0x17'));var licenseUtil=require(_0xd134('0x18'));var db=require(_0xd134('0x19'))['db'];function respondWithStatusCode(_0xbe81c7,_0x48c030){_0x48c030=_0x48c030||0xcc;return function(_0x18cc91){if(_0x18cc91){return _0xbe81c7[_0xd134('0x1a')](_0x48c030);}return _0xbe81c7[_0xd134('0x1b')](_0x48c030)['end']();};}function respondWithResult(_0x19cd56,_0x318d23){_0x318d23=_0x318d23||0xc8;return function(_0x58d8f4){if(_0x58d8f4){return _0x19cd56[_0xd134('0x1b')](_0x318d23)[_0xd134('0x1c')](_0x58d8f4);}};}function respondWithFilteredResult(_0x9cef13,_0x1cb960){return function(_0x5b32f8){if(_0x5b32f8){var _0x474dc1=_0x5b32f8[_0xd134('0x1d')],_0x2bc2=_0x1cb960['offset'],_0x8c046c=_0x1cb960[_0xd134('0x1e')]+_0x1cb960['limit'],_0x36fa5a;if(_0x8c046c>=_0x474dc1){_0x8c046c=_0x474dc1;_0x36fa5a=0xc8;}else{_0x36fa5a=0xce;}_0x9cef13[_0xd134('0x1b')](_0x36fa5a);return _0x9cef13[_0xd134('0x1f')]('Content-Range',_0x2bc2+'-'+_0x8c046c+'/'+_0x474dc1)[_0xd134('0x1c')](_0x5b32f8);}return null;};}function patchUpdates(_0x3e86c3){return function(_0x2fbb2d){try{jsonpatch[_0xd134('0x20')](_0x2fbb2d,_0x3e86c3,!![]);}catch(_0x15fe66){return BPromise[_0xd134('0x21')](_0x15fe66);}return _0x2fbb2d[_0xd134('0x22')]();};}function saveUpdates(_0x239467,_0x109371){return function(_0x26e560){if(_0x26e560){return _0x26e560[_0xd134('0x23')](_0x239467)[_0xd134('0x24')](function(_0x2906c7){return _0x2906c7;});}return null;};}function removeEntity(_0x29f121,_0x396fb4){return function(_0x141983){if(_0x141983){return _0x141983[_0xd134('0x25')]()[_0xd134('0x24')](function(){var _0x5467eb=_0x141983[_0xd134('0x26')]({'plain':!![]});var _0x58091c=_0xd134('0x27');return db[_0xd134('0x28')][_0xd134('0x25')]({'where':{'type':_0x58091c,'resourceId':_0x5467eb['id']}})[_0xd134('0x24')](function(){return _0x141983;});})['then'](function(){_0x29f121[_0xd134('0x1b')](0xcc)[_0xd134('0x29')]();});}};}function handleEntityNotFound(_0x505c29,_0x47dfe3){return function(_0x435744){if(!_0x435744){_0x505c29[_0xd134('0x1a')](0x194);}return _0x435744;};}function handleError(_0x280a70,_0xebbb50){_0xebbb50=_0xebbb50||0x1f4;return function(_0x29f42d){logger[_0xd134('0x2a')](_0x29f42d[_0xd134('0x2b')]);if(_0x29f42d[_0xd134('0x2c')]){delete _0x29f42d[_0xd134('0x2c')];}_0x280a70[_0xd134('0x1b')](_0xebbb50)[_0xd134('0x2d')](_0x29f42d);};}exports[_0xd134('0x2e')]=function(_0x43846a,_0x1e44e5){var _0x42dc57={},_0x329284={},_0x58a534={'count':0x0,'rows':[]};var _0x15119c=_[_0xd134('0x2f')](db[_0xd134('0x30')][_0xd134('0x31')],function(_0x24d597){return{'name':_0x24d597[_0xd134('0x32')],'type':_0x24d597['type']['key']};});_0x329284['model']=_[_0xd134('0x2f')](_0x15119c,_0xd134('0x2c'));_0x329284[_0xd134('0x33')]=_[_0xd134('0x34')](_0x43846a[_0xd134('0x33')]);_0x329284[_0xd134('0x35')]=_[_0xd134('0x36')](_0x329284[_0xd134('0x37')],_0x329284[_0xd134('0x33')]);_0x42dc57['attributes']=_[_0xd134('0x36')](_0x329284['model'],qs[_0xd134('0x38')](_0x43846a['query'][_0xd134('0x38')]));_0x42dc57[_0xd134('0x39')]=_0x42dc57['attributes']['length']?_0x42dc57[_0xd134('0x39')]:_0x329284[_0xd134('0x37')];if(!_0x43846a[_0xd134('0x33')]['hasOwnProperty'](_0xd134('0x3a'))){_0x42dc57['limit']=qs[_0xd134('0x3b')](_0x43846a[_0xd134('0x33')]['limit']);_0x42dc57[_0xd134('0x1e')]=qs[_0xd134('0x1e')](_0x43846a['query'][_0xd134('0x1e')]);}_0x42dc57['order']=qs[_0xd134('0x3c')](_0x43846a[_0xd134('0x33')][_0xd134('0x3c')]);_0x42dc57[_0xd134('0x3d')]=qs[_0xd134('0x35')](_[_0xd134('0x3e')](_0x43846a['query'],_0x329284[_0xd134('0x35')]),_0x15119c);if(_0x43846a[_0xd134('0x33')][_0xd134('0x3f')]){_0x42dc57[_0xd134('0x3d')]=_['merge'](_0x42dc57[_0xd134('0x3d')],{'$or':_[_0xd134('0x2f')](_0x15119c,function(_0xe92bd4){if(_0xe92bd4[_0xd134('0x40')]!==_0xd134('0x41')){var _0x21c532={};_0x21c532[_0xe92bd4['name']]={'$like':'%'+_0x43846a[_0xd134('0x33')]['filter']+'%'};return _0x21c532;}})});}_0x42dc57=_[_0xd134('0x42')]({},_0x42dc57,_0x43846a[_0xd134('0x43')]);var _0x263e5b={'where':_0x42dc57['where']};return db[_0xd134('0x30')][_0xd134('0x1d')](_0x263e5b)[_0xd134('0x24')](function(_0x3d0f68){_0x58a534[_0xd134('0x1d')]=_0x3d0f68;if(_0x43846a[_0xd134('0x33')][_0xd134('0x44')]){_0x42dc57['include']=[{'all':!![]}];}return db[_0xd134('0x30')]['findAll'](_0x42dc57);})[_0xd134('0x24')](function(_0x35e57f){_0x58a534[_0xd134('0x45')]=_0x35e57f;return _0x58a534;})[_0xd134('0x24')](respondWithFilteredResult(_0x1e44e5,_0x42dc57))[_0xd134('0x46')](handleError(_0x1e44e5,null));};exports['show']=function(_0x27ebc9,_0x39ede7){var _0x1f93da={'raw':!![],'where':{'id':_0x27ebc9[_0xd134('0x47')]['id']}},_0x51f994={};_0x51f994[_0xd134('0x37')]=_['keys'](db['Variable']['rawAttributes']);_0x51f994[_0xd134('0x33')]=_['keys'](_0x27ebc9['query']);_0x51f994[_0xd134('0x35')]=_[_0xd134('0x36')](_0x51f994[_0xd134('0x37')],_0x51f994[_0xd134('0x33')]);_0x1f93da[_0xd134('0x39')]=_[_0xd134('0x36')](_0x51f994[_0xd134('0x37')],qs[_0xd134('0x38')](_0x27ebc9[_0xd134('0x33')]['fields']));_0x1f93da[_0xd134('0x39')]=_0x1f93da['attributes'][_0xd134('0x48')]?_0x1f93da[_0xd134('0x39')]:_0x51f994[_0xd134('0x37')];if(_0x27ebc9[_0xd134('0x33')][_0xd134('0x44')]){_0x1f93da[_0xd134('0x49')]=[{'all':!![]}];}_0x1f93da=_['merge']({},_0x1f93da,_0x27ebc9[_0xd134('0x43')]);return db['Variable']['find'](_0x1f93da)[_0xd134('0x24')](handleEntityNotFound(_0x39ede7,null))[_0xd134('0x24')](respondWithResult(_0x39ede7,null))['catch'](handleError(_0x39ede7,null));};exports[_0xd134('0x4a')]=function(_0x5e051b,_0xbc03a1){return db['Variable'][_0xd134('0x4a')](_0x5e051b[_0xd134('0x4b')],{})[_0xd134('0x24')](function(_0xee3a05){var _0x4da843=_0x5e051b['user']['get']({'plain':!![]});if(!_0x4da843)throw new Error(_0xd134('0x4c'));if(_0x4da843[_0xd134('0x4d')]===_0xd134('0x4e')){var _0x10279e=_0xee3a05['get']({'plain':!![]});var _0x813d85='Variables';return db[_0xd134('0x4f')][_0xd134('0x50')]({'where':{'name':_0x813d85,'userProfileId':_0x4da843[_0xd134('0x51')]},'raw':!![]})['then'](function(_0x308f5b){if(_0x308f5b&&_0x308f5b[_0xd134('0x52')]===0x0){return db[_0xd134('0x28')][_0xd134('0x4a')]({'name':_0x10279e[_0xd134('0x2c')],'resourceId':_0x10279e['id'],'type':_0x308f5b['name'],'sectionId':_0x308f5b['id']},{})['then'](function(){return _0xee3a05;});}else{return _0xee3a05;}})['catch'](function(_0x527995){logger[_0xd134('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x527995);throw _0x527995;});}return _0xee3a05;})[_0xd134('0x24')](respondWithResult(_0xbc03a1,0xc9))[_0xd134('0x46')](handleError(_0xbc03a1,null));};exports[_0xd134('0x23')]=function(_0x48fca5,_0x1bd59a){if(_0x48fca5[_0xd134('0x4b')]['id']){delete _0x48fca5[_0xd134('0x4b')]['id'];}return db[_0xd134('0x30')]['find']({'where':{'id':_0x48fca5[_0xd134('0x47')]['id']}})[_0xd134('0x24')](handleEntityNotFound(_0x1bd59a,null))[_0xd134('0x24')](saveUpdates(_0x48fca5[_0xd134('0x4b')],null))[_0xd134('0x24')](respondWithResult(_0x1bd59a,null))[_0xd134('0x46')](handleError(_0x1bd59a,null));};exports[_0xd134('0x25')]=function(_0x36475d,_0x5bc719){return db['Variable']['find']({'where':{'id':_0x36475d['params']['id']}})['then'](handleEntityNotFound(_0x5bc719,null))[_0xd134('0x24')](removeEntity(_0x5bc719,null))[_0xd134('0x46')](handleError(_0x5bc719,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 46236a5..3f58174 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 _0x7868=['../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5e7692,_0x1caa40){var _0x120367=function(_0x3dec6a){while(--_0x3dec6a){_0x5e7692['push'](_0x5e7692['shift']());}};_0x120367(++_0x1caa40);}(_0x7868,0x1c0));var _0x8786=function(_0x2dbc56,_0x4fb188){_0x2dbc56=_0x2dbc56-0x0;var _0x341325=_0x7868[_0x2dbc56];return _0x341325;};'use strict';var _=require(_0x8786('0x0'));var util=require('util');var logger=require(_0x8786('0x1'))(_0x8786('0x2'));var moment=require(_0x8786('0x3'));var BPromise=require(_0x8786('0x4'));var rp=require(_0x8786('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8786('0x6'));var config=require(_0x8786('0x7'));var attributes=require(_0x8786('0x8'));module[_0x8786('0x9')]=function(_0x121ac4,_0x2c786d){return _0x121ac4[_0x8786('0xa')](_0x8786('0xb'),attributes,{'tableName':_0x8786('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x481a=['./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x525254,_0x2e24e3){var _0x17d9d2=function(_0x10c2b8){while(--_0x10c2b8){_0x525254['push'](_0x525254['shift']());}};_0x17d9d2(++_0x2e24e3);}(_0x481a,0xbb));var _0xa481=function(_0x438777,_0xc19fd1){_0x438777=_0x438777-0x0;var _0x57fe22=_0x481a[_0x438777];return _0x57fe22;};'use strict';var _=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var logger=require(_0xa481('0x2'))(_0xa481('0x3'));var moment=require(_0xa481('0x4'));var BPromise=require('bluebird');var rp=require(_0xa481('0x5'));var fs=require('fs');var path=require(_0xa481('0x6'));var rimraf=require(_0xa481('0x7'));var config=require(_0xa481('0x8'));var attributes=require(_0xa481('0x9'));module[_0xa481('0xa')]=function(_0x558735,_0x27763b){return _0x558735[_0xa481('0xb')](_0xa481('0xc'),attributes,{'tableName':_0xa481('0xd'),'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 201287f..77844a3 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 _0x1540=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','debug','lodash'];(function(_0x18ce0f,_0x46fc29){var _0x2c038c=function(_0x3431d7){while(--_0x3431d7){_0x18ce0f['push'](_0x18ce0f['shift']());}};_0x2c038c(++_0x46fc29);}(_0x1540,0x175));var _0x0154=function(_0x4e2664,_0x3f8e91){_0x4e2664=_0x4e2664-0x0;var _0x54c728=_0x1540[_0x4e2664];return _0x54c728;};'use strict';var _=require(_0x0154('0x0'));var util=require(_0x0154('0x1'));var moment=require(_0x0154('0x2'));var BPromise=require(_0x0154('0x3'));var rs=require(_0x0154('0x4'));var fs=require('fs');var Redis=require(_0x0154('0x5'));var db=require(_0x0154('0x6'))['db'];var utils=require(_0x0154('0x7'));var logger=require(_0x0154('0x8'))(_0x0154('0x9'));var config=require(_0x0154('0xa'));var jayson=require(_0x0154('0xb'));var client=jayson[_0x0154('0xc')][_0x0154('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3fde11,_0x22d092,_0x4b4355){return new BPromise(function(_0x3f6d09,_0x805359){return client['request'](_0x3fde11,_0x4b4355)[_0x0154('0xe')](function(_0x18cdfa){logger[_0x0154('0xf')](_0x0154('0x10'),_0x22d092,_0x0154('0x11'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x22d092,_0x0154('0x11'),JSON[_0x0154('0x12')](_0x18cdfa));if(_0x18cdfa['error']){if(_0x18cdfa[_0x0154('0x13')]['code']===0x1f4){logger[_0x0154('0x13')]('Variable,\x20%s,\x20%s',_0x22d092,_0x18cdfa[_0x0154('0x13')][_0x0154('0x14')]);return _0x805359(_0x18cdfa[_0x0154('0x13')][_0x0154('0x14')]);}logger[_0x0154('0x13')](_0x0154('0x10'),_0x22d092,_0x18cdfa[_0x0154('0x13')][_0x0154('0x14')]);return _0x3f6d09(_0x18cdfa[_0x0154('0x13')][_0x0154('0x14')]);}else{logger[_0x0154('0xf')](_0x0154('0x10'),_0x22d092,_0x0154('0x11'));_0x3f6d09(_0x18cdfa[_0x0154('0x15')]['message']);}})[_0x0154('0x16')](function(_0x54263e){logger[_0x0154('0x13')](_0x0154('0x10'),_0x22d092,_0x54263e);_0x805359(_0x54263e);});});}exports[_0x0154('0x17')]=function(_0x38c001){var _0x8b145a=this;return new Promise(function(_0x2b1b9c,_0x5b7ff1){return db[_0x0154('0x18')][_0x0154('0x19')]({'raw':_0x38c001[_0x0154('0x1a')]?_0x38c001[_0x0154('0x1a')][_0x0154('0x1b')]===undefined?!![]:![]:!![],'where':_0x38c001[_0x0154('0x1a')]?_0x38c001['options'][_0x0154('0x1c')]||null:null,'attributes':_0x38c001[_0x0154('0x1a')]?_0x38c001[_0x0154('0x1a')][_0x0154('0x1d')]||null:null,'include':_0x38c001[_0x0154('0x1a')]?_0x38c001[_0x0154('0x1a')]['include']?_[_0x0154('0x1e')](_0x38c001[_0x0154('0x1a')][_0x0154('0x1f')],function(_0x173377){return{'model':db[_0x173377['model']],'as':_0x173377['as'],'attributes':_0x173377['attributes'],'include':_0x173377[_0x0154('0x1f')]?_['map'](_0x173377['include'],function(_0x1af41f){return{'model':db[_0x1af41f[_0x0154('0x20')]],'as':_0x1af41f['as'],'attributes':_0x1af41f[_0x0154('0x1d')],'include':_0x1af41f[_0x0154('0x1f')]?_['map'](_0x1af41f['include'],function(_0x2e400a){return{'model':db[_0x2e400a[_0x0154('0x20')]],'as':_0x2e400a['as'],'attributes':_0x2e400a[_0x0154('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0154('0xe')](function(_0x525b66){logger['info'](_0x0154('0x17'),_0x38c001);logger[_0x0154('0x21')](_0x0154('0x17'),_0x38c001,JSON[_0x0154('0x12')](_0x525b66));_0x2b1b9c(_0x525b66);})[_0x0154('0x16')](function(_0x57698d){logger[_0x0154('0x13')](_0x0154('0x17'),_0x57698d['message'],_0x38c001);_0x5b7ff1(_0x8b145a[_0x0154('0x13')](0x1f4,_0x57698d[_0x0154('0x14')]));});});}; \ No newline at end of file +var _0xa39d=['attributes','model','info','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','request\x20sent','result','catch','Variable','find','options','raw','where','map','include'];(function(_0x28074d,_0x1aee41){var _0x2c144b=function(_0x39b74e){while(--_0x39b74e){_0x28074d['push'](_0x28074d['shift']());}};_0x2c144b(++_0x1aee41);}(_0xa39d,0x162));var _0xda39=function(_0x572a36,_0x4dc936){_0x572a36=_0x572a36-0x0;var _0x25b955=_0xa39d[_0x572a36];return _0x25b955;};'use strict';var _=require(_0xda39('0x0'));var util=require(_0xda39('0x1'));var moment=require(_0xda39('0x2'));var BPromise=require(_0xda39('0x3'));var rs=require(_0xda39('0x4'));var fs=require('fs');var Redis=require(_0xda39('0x5'));var db=require(_0xda39('0x6'))['db'];var utils=require(_0xda39('0x7'));var logger=require(_0xda39('0x8'))('rpc');var config=require(_0xda39('0x9'));var jayson=require(_0xda39('0xa'));var client=jayson[_0xda39('0xb')][_0xda39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315377,_0x28d40e,_0x4ec854){return new BPromise(function(_0x54b890,_0x13dbd1){return client[_0xda39('0xd')](_0x315377,_0x4ec854)[_0xda39('0xe')](function(_0x177dd0){logger['info']('Variable,\x20%s,\x20%s',_0x28d40e,'request\x20sent');logger[_0xda39('0xf')](_0xda39('0x10'),_0x28d40e,'request\x20sent',JSON[_0xda39('0x11')](_0x177dd0));if(_0x177dd0[_0xda39('0x12')]){if(_0x177dd0[_0xda39('0x12')]['code']===0x1f4){logger[_0xda39('0x12')](_0xda39('0x13'),_0x28d40e,_0x177dd0[_0xda39('0x12')][_0xda39('0x14')]);return _0x13dbd1(_0x177dd0[_0xda39('0x12')][_0xda39('0x14')]);}logger[_0xda39('0x12')](_0xda39('0x13'),_0x28d40e,_0x177dd0[_0xda39('0x12')][_0xda39('0x14')]);return _0x54b890(_0x177dd0[_0xda39('0x12')][_0xda39('0x14')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x28d40e,_0xda39('0x15'));_0x54b890(_0x177dd0[_0xda39('0x16')][_0xda39('0x14')]);}})[_0xda39('0x17')](function(_0x3e7f94){logger['error']('Variable,\x20%s,\x20%s',_0x28d40e,_0x3e7f94);_0x13dbd1(_0x3e7f94);});});}exports['ShowVariable']=function(_0x368c4b){var _0x4c6db8=this;return new Promise(function(_0xcfe2e7,_0x188478){return db[_0xda39('0x18')][_0xda39('0x19')]({'raw':_0x368c4b[_0xda39('0x1a')]?_0x368c4b[_0xda39('0x1a')][_0xda39('0x1b')]===undefined?!![]:![]:!![],'where':_0x368c4b['options']?_0x368c4b[_0xda39('0x1a')][_0xda39('0x1c')]||null:null,'attributes':_0x368c4b[_0xda39('0x1a')]?_0x368c4b['options']['attributes']||null:null,'include':_0x368c4b[_0xda39('0x1a')]?_0x368c4b[_0xda39('0x1a')]['include']?_[_0xda39('0x1d')](_0x368c4b[_0xda39('0x1a')][_0xda39('0x1e')],function(_0x589150){return{'model':db[_0x589150['model']],'as':_0x589150['as'],'attributes':_0x589150[_0xda39('0x1f')],'include':_0x589150[_0xda39('0x1e')]?_[_0xda39('0x1d')](_0x589150['include'],function(_0x3a4990){return{'model':db[_0x3a4990[_0xda39('0x20')]],'as':_0x3a4990['as'],'attributes':_0x3a4990['attributes'],'include':_0x3a4990['include']?_[_0xda39('0x1d')](_0x3a4990[_0xda39('0x1e')],function(_0x404b27){return{'model':db[_0x404b27[_0xda39('0x20')]],'as':_0x404b27['as'],'attributes':_0x404b27[_0xda39('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xda39('0xe')](function(_0x5ce877){logger[_0xda39('0x21')](_0xda39('0x22'),_0x368c4b);logger['debug'](_0xda39('0x22'),_0x368c4b,JSON[_0xda39('0x11')](_0x5ce877));_0xcfe2e7(_0x5ce877);})['catch'](function(_0x20f9fa){logger[_0xda39('0x12')](_0xda39('0x22'),_0x20f9fa[_0xda39('0x14')],_0x368c4b);_0x188478(_0x4c6db8[_0xda39('0x12')](0x1f4,_0x20f9fa[_0xda39('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4ae54a4..7090f0a 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 _0x25c5=['/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x25c5,0x1f2));var _0x525c=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0x25c5[_0x24a88e];return _0x232cbb;};'use strict';var express=require(_0x525c('0x0'));var router=express[_0x525c('0x1')]();var auth=require(_0x525c('0x2'));var controller=require('./version.controller');router[_0x525c('0x3')]('/',controller[_0x525c('0x4')]);router['get'](_0x525c('0x5'),auth[_0x525c('0x6')](),auth[_0x525c('0x7')](),controller['fetch']);router[_0x525c('0x3')](_0x525c('0x8'),auth[_0x525c('0x6')](),auth[_0x525c('0x7')](),controller[_0x525c('0x9')]);router['get'](_0x525c('0xa'),auth[_0x525c('0x6')](),auth['canUpdate'](),controller[_0x525c('0xb')]);router[_0x525c('0x3')](_0x525c('0xc'),auth[_0x525c('0x6')](),controller[_0x525c('0xd')]);router[_0x525c('0x3')](_0x525c('0xe'),controller[_0x525c('0xf')]);module[_0x525c('0x10')]=router; \ No newline at end of file +var _0x6da3=['/reset','isAuthenticated','reset','/pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get','index','canUpdate'];(function(_0xa1cfa8,_0x252403){var _0x158a5f=function(_0x14c809){while(--_0x14c809){_0xa1cfa8['push'](_0xa1cfa8['shift']());}};_0x158a5f(++_0x252403);}(_0x6da3,0xf9));var _0x36da=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6da3[_0x4565bf];return _0x5610ba;};'use strict';var express=require(_0x36da('0x0'));var router=express[_0x36da('0x1')]();var auth=require(_0x36da('0x2'));var controller=require('./version.controller');router[_0x36da('0x3')]('/',controller[_0x36da('0x4')]);router[_0x36da('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0x36da('0x5')](),controller['fetch']);router[_0x36da('0x3')](_0x36da('0x6'),auth[_0x36da('0x7')](),auth[_0x36da('0x5')](),controller[_0x36da('0x8')]);router[_0x36da('0x3')](_0x36da('0x9'),auth[_0x36da('0x7')](),auth[_0x36da('0x5')](),controller['pull']);router[_0x36da('0x3')](_0x36da('0xa'),auth[_0x36da('0x7')](),controller[_0x36da('0xb')]);router[_0x36da('0x3')](_0x36da('0xc'),controller[_0x36da('0xd')]);module[_0x36da('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 0e2f9c6..bcd19f3 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 _0xdf94=['.js','push','sort','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','replace'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xdf94,0xad));var _0x4df9=function(_0x1d0bba,_0x3888f4){_0x1d0bba=_0x1d0bba-0x0;var _0x4cf7a7=_0xdf94[_0x1d0bba];return _0x4cf7a7;};'use strict';var Umzug=require('umzug');var path=require(_0x4df9('0x0'));var fs=require('fs');var _=require(_0x4df9('0x1'));var pkginfo=require(_0x4df9('0x2'))(module,_0x4df9('0x3'));var compareVersions=require(_0x4df9('0x4'));var exec=require(_0x4df9('0x5'))[_0x4df9('0x6')];var db=require(_0x4df9('0x7'))['db'];var config=require(_0x4df9('0x8'));var pm2=require(_0x4df9('0x9'));var logger=require(_0x4df9('0xa'))(_0x4df9('0xb'));var git=require(_0x4df9('0xc'))(config[_0x4df9('0xd')]);exports[_0x4df9('0xe')]=function(_0x2fac37,_0x39ebc3){var _0xf808f0={'current':module['exports'][_0x4df9('0x3')],'phonebar':0x2};if(_0x2fac37[_0x4df9('0xf')]&&_0x2fac37[_0x4df9('0xf')][_0x4df9('0x10')]){return git[_0x4df9('0x11')]()[_0x4df9('0x12')](function(_0x2bf116,_0x4ae21e){_0xf808f0['latest']=(_0x2bf116?module[_0x4df9('0x13')]['version']:_0x4ae21e[_0x4df9('0x10')])||_0x4df9('0x14');return _0x39ebc3[_0x4df9('0x15')](0xc8)[_0x4df9('0x16')](_0xf808f0);});}else{return _0x39ebc3['status'](0xc8)[_0x4df9('0x16')](_0xf808f0);}};exports[_0x4df9('0x11')]=function(_0x2d7cf2,_0x5aa2c1){return git[_0x4df9('0x11')]([_0x4df9('0x17'),_0x4df9('0x18')],function(_0x4fe068){if(_0x4fe068){logger[_0x4df9('0x19')](_0x4fe068);return _0x5aa2c1['status'](0x1f4)[_0x4df9('0x16')](_0x4fe068);}logger[_0x4df9('0x1a')](_0x4df9('0x1b'));return _0x5aa2c1[_0x4df9('0x15')](0xc8)['json']({'output':_0x4df9('0x1c')});});};exports[_0x4df9('0x1d')]=function(_0x10852a,_0x59d4e9){return git[_0x4df9('0x1d')](['--hard',_0x4df9('0x1e')],function(_0x352ad1){if(_0x352ad1){logger[_0x4df9('0x19')](_0x352ad1);return _0x59d4e9[_0x4df9('0x15')](0x1f4)[_0x4df9('0x16')](_0x352ad1);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x59d4e9['status'](0xc8)[_0x4df9('0x16')]({'output':_0x4df9('0x1f')});});};exports[_0x4df9('0x20')]=function(_0x434afe,_0x1d3f83){exec(_0x4df9('0x21'),function(_0x2294ad,_0x5f5326,_0xc03aea){logger[_0x4df9('0x1a')](_0x5f5326);logger[_0x4df9('0x1a')](_0xc03aea);if(_0x2294ad){logger[_0x4df9('0x19')](_0x2294ad);return _0x1d3f83[_0x4df9('0x15')](0x1f4)['json'](_0x2294ad);}return _0x1d3f83[_0x4df9('0x15')](0xc8)[_0x4df9('0x16')]({'output':_0x5f5326});});};exports['restart']=function(_0x4b4808,_0x3b9b35){return pm2[_0x4df9('0x22')]('motion2')[_0x4df9('0x23')](function(_0x427c43){logger[_0x4df9('0x1a')](_0x4df9('0x24'),_0x427c43);return _0x3b9b35[_0x4df9('0x15')](0xc8)[_0x4df9('0x16')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x4df9('0x25')](function(_0x38c7a9){logger['error'](_0x38c7a9);return _0x3b9b35[_0x4df9('0x15')](0x1f4)[_0x4df9('0x16')](_0x38c7a9);});};exports[_0x4df9('0x26')]=function(_0x2a99c9,_0x4c2fbd){var _0x441f30=fs[_0x4df9('0x27')](path[_0x4df9('0x28')](config[_0x4df9('0xd')],_0x4df9('0x29'),_0x4df9('0x26')));var _0x3ee40a=[];for(var _0x42aa30=0x0;_0x42aa30<_0x441f30['length'];_0x42aa30++){var _0x150b6a=_0x441f30[_0x42aa30][_0x4df9('0x2a')](_0x4df9('0x2b'),'');if(compareVersions(module[_0x4df9('0x13')]['version'],_0x150b6a)===-0x1){_0x3ee40a[_0x4df9('0x2c')](_0x150b6a);}}if(_0x3ee40a['length']){var _0x20c2fd=_0x3ee40a[_0x4df9('0x2d')](compareVersions);var _0x2f0e2b=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x4df9('0x2e')][_0x4df9('0x2f')](),db['sequelize']['constructor'],function(){throw new Error(_0x4df9('0x30'));}],'path':path['join'](config[_0x4df9('0xd')],'server',_0x4df9('0x26')),'pattern':/\.js$/}});_0x2f0e2b['up']({'migrations':_[_0x4df9('0x31')](_0x20c2fd,function(_0x48102f){return _0x48102f+'.js';})})[_0x4df9('0x23')](function(){return _0x4c2fbd[_0x4df9('0x15')](0xc8)[_0x4df9('0x16')]({'output':_0x4df9('0x32')+module[_0x4df9('0x13')]['version']+'\x20to\x20'+_[_0x4df9('0x33')](_0x20c2fd),'migrations':_[_0x4df9('0x28')](_0x20c2fd)});})[_0x4df9('0x25')](function(_0x18545b){if(_0x18545b instanceof db[_0x4df9('0x2e')][_0x4df9('0x34')]){return _0x4c2fbd[_0x4df9('0x15')](0xc8)[_0x4df9('0x16')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4c2fbd[_0x4df9('0x15')](0x1f4)[_0x4df9('0x16')](_0x18545b);}});}else{return _0x4c2fbd[_0x4df9('0x15')](0xc8)[_0x4df9('0x16')]({'output':_0x4df9('0x35')});}}; \ No newline at end of file +var _0x75dd=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','migrations','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0x75dd,0x1c9));var _0xd75d=function(_0x8986fa,_0x48e0b6){_0x8986fa=_0x8986fa-0x0;var _0x44ce7e=_0x75dd[_0x8986fa];return _0x44ce7e;};'use strict';var Umzug=require(_0xd75d('0x0'));var path=require(_0xd75d('0x1'));var fs=require('fs');var _=require(_0xd75d('0x2'));var pkginfo=require(_0xd75d('0x3'))(module,_0xd75d('0x4'));var compareVersions=require(_0xd75d('0x5'));var exec=require('child_process')[_0xd75d('0x6')];var db=require(_0xd75d('0x7'))['db'];var config=require(_0xd75d('0x8'));var pm2=require(_0xd75d('0x9'));var logger=require(_0xd75d('0xa'))(_0xd75d('0xb'));var git=require(_0xd75d('0xc'))(config[_0xd75d('0xd')]);exports['index']=function(_0x7ad4a3,_0x216ea5){var _0x22b9f1={'current':module[_0xd75d('0xe')]['version'],'phonebar':0x2};if(_0x7ad4a3[_0xd75d('0xf')]&&_0x7ad4a3[_0xd75d('0xf')][_0xd75d('0x10')]){return git[_0xd75d('0x11')]()[_0xd75d('0x12')](function(_0x34db4e,_0x1afd2c){_0x22b9f1[_0xd75d('0x10')]=(_0x34db4e?module['exports'][_0xd75d('0x4')]:_0x1afd2c[_0xd75d('0x10')])||'2.0.0';return _0x216ea5[_0xd75d('0x13')](0xc8)[_0xd75d('0x14')](_0x22b9f1);});}else{return _0x216ea5['status'](0xc8)[_0xd75d('0x14')](_0x22b9f1);}};exports[_0xd75d('0x11')]=function(_0x4aa031,_0x5d9e8c){return git[_0xd75d('0x11')]([_0xd75d('0x15'),_0xd75d('0x16')],function(_0x49bcf8){if(_0x49bcf8){logger[_0xd75d('0x17')](_0x49bcf8);return _0x5d9e8c['status'](0x1f4)['json'](_0x49bcf8);}logger['info'](_0xd75d('0x18'));return _0x5d9e8c[_0xd75d('0x13')](0xc8)[_0xd75d('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xd75d('0x19')]=function(_0x3d4d89,_0xb86bbf){return git['reset']([_0xd75d('0x1a'),'FETCH_HEAD'],function(_0x82823b){if(_0x82823b){logger[_0xd75d('0x17')](_0x82823b);return _0xb86bbf[_0xd75d('0x13')](0x1f4)[_0xd75d('0x14')](_0x82823b);}logger[_0xd75d('0x1b')](_0xd75d('0x1c'));return _0xb86bbf['status'](0xc8)[_0xd75d('0x14')]({'output':_0xd75d('0x1d')});});};exports[_0xd75d('0x1e')]=function(_0x42a68e,_0x2cc214){exec(_0xd75d('0x1f'),function(_0x3d2c10,_0x5e1e36,_0x67f1b5){logger[_0xd75d('0x1b')](_0x5e1e36);logger['info'](_0x67f1b5);if(_0x3d2c10){logger[_0xd75d('0x17')](_0x3d2c10);return _0x2cc214[_0xd75d('0x13')](0x1f4)[_0xd75d('0x14')](_0x3d2c10);}return _0x2cc214[_0xd75d('0x13')](0xc8)['json']({'output':_0x5e1e36});});};exports['restart']=function(_0x475ae4,_0xbc4bd4){return pm2[_0xd75d('0x20')]('motion2')[_0xd75d('0x21')](function(_0x4619a){logger[_0xd75d('0x1b')](_0xd75d('0x22'),_0x4619a);return _0xbc4bd4[_0xd75d('0x13')](0xc8)[_0xd75d('0x14')]({'output':_0xd75d('0x23')});})['catch'](function(_0xd1c0ae){logger['error'](_0xd1c0ae);return _0xbc4bd4[_0xd75d('0x13')](0x1f4)['json'](_0xd1c0ae);});};exports['migrations']=function(_0x151cb1,_0x4baa60){var _0x565c9b=fs[_0xd75d('0x24')](path[_0xd75d('0x25')](config[_0xd75d('0xd')],'server',_0xd75d('0x26')));var _0x11eac3=[];for(var _0x39d434=0x0;_0x39d434<_0x565c9b[_0xd75d('0x27')];_0x39d434++){var _0x57654b=_0x565c9b[_0x39d434][_0xd75d('0x28')](_0xd75d('0x29'),'');if(compareVersions(module[_0xd75d('0xe')]['version'],_0x57654b)===-0x1){_0x11eac3[_0xd75d('0x2a')](_0x57654b);}}if(_0x11eac3['length']){var _0x2456dc=_0x11eac3[_0xd75d('0x2b')](compareVersions);var _0x259495=new Umzug({'storage':_0xd75d('0x2c'),'storageOptions':{'model':db[_0xd75d('0x2d')],'modelName':_0xd75d('0x2d'),'columnName':_0xd75d('0x4')},'migrations':{'params':[db[_0xd75d('0x2c')]['getQueryInterface'](),db[_0xd75d('0x2c')][_0xd75d('0x2e')],function(){throw new Error(_0xd75d('0x2f'));}],'path':path[_0xd75d('0x25')](config[_0xd75d('0xd')],'server',_0xd75d('0x26')),'pattern':/\.js$/}});_0x259495['up']({'migrations':_[_0xd75d('0x30')](_0x2456dc,function(_0xb0564){return _0xb0564+_0xd75d('0x29');})})['then'](function(){return _0x4baa60[_0xd75d('0x13')](0xc8)[_0xd75d('0x14')]({'output':_0xd75d('0x31')+module[_0xd75d('0xe')]['version']+_0xd75d('0x32')+_[_0xd75d('0x33')](_0x2456dc),'migrations':_['join'](_0x2456dc)});})['catch'](function(_0x12b9c7){if(_0x12b9c7 instanceof db['sequelize'][_0xd75d('0x34')]){return _0x4baa60[_0xd75d('0x13')](0xc8)[_0xd75d('0x14')]({'output':_0xd75d('0x35')});}else{return _0x4baa60[_0xd75d('0x13')](0x1f4)[_0xd75d('0x14')](_0x12b9c7);}});}else{return _0x4baa60[_0xd75d('0x13')](0xc8)[_0xd75d('0x14')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 17040be..78230f8 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 _0x2ffe=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x2021ea,_0x5a0c73){var _0x46d417=function(_0x1b9ffc){while(--_0x1b9ffc){_0x2021ea['push'](_0x2021ea['shift']());}};_0x46d417(++_0x5a0c73);}(_0x2ffe,0xea));var _0xe2ff=function(_0x144b38,_0xd00215){_0x144b38=_0x144b38-0x0;var _0x416a52=_0x2ffe[_0x144b38];return _0x416a52;};'use strict';var multer=require(_0xe2ff('0x0'));var util=require(_0xe2ff('0x1'));var path=require(_0xe2ff('0x2'));var timeout=require(_0xe2ff('0x3'));var express=require(_0xe2ff('0x4'));var router=express['Router']();var auth=require(_0xe2ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe2ff('0x6'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xe2ff('0x7')](),controller['index']);router[_0xe2ff('0x8')](_0xe2ff('0x9'),auth[_0xe2ff('0x7')](),controller[_0xe2ff('0xa')]);router[_0xe2ff('0x8')](_0xe2ff('0xb'),auth[_0xe2ff('0x7')](),controller['show']);router[_0xe2ff('0xc')]('/',auth[_0xe2ff('0x7')](),controller[_0xe2ff('0xd')]);router[_0xe2ff('0xe')](_0xe2ff('0xb'),auth['isAuthenticated'](),controller[_0xe2ff('0xf')]);router['delete'](_0xe2ff('0xb'),auth['isAuthenticated'](),controller[_0xe2ff('0x10')]);module[_0xe2ff('0x11')]=router; \ No newline at end of file +var _0x8502=['post','put','update','destroy','exports','multer','util','path','express','Router','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x1035ad,_0x18a82a){var _0x70d5c4=function(_0x19e008){while(--_0x19e008){_0x1035ad['push'](_0x1035ad['shift']());}};_0x70d5c4(++_0x18a82a);}(_0x8502,0x125));var _0x2850=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x8502[_0x3fb030];return _0xd6899b;};'use strict';var multer=require(_0x2850('0x0'));var util=require(_0x2850('0x1'));var path=require(_0x2850('0x2'));var timeout=require('connect-timeout');var express=require(_0x2850('0x3'));var router=express[_0x2850('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2850('0x5'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x2850('0x6')](),controller[_0x2850('0x7')]);router[_0x2850('0x8')](_0x2850('0x9'),auth[_0x2850('0x6')](),controller[_0x2850('0xa')]);router[_0x2850('0x8')](_0x2850('0xb'),auth[_0x2850('0x6')](),controller[_0x2850('0xc')]);router[_0x2850('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2850('0xe')](_0x2850('0xb'),auth[_0x2850('0x6')](),controller[_0x2850('0xf')]);router['delete'](_0x2850('0xb'),auth[_0x2850('0x6')](),controller[_0x2850('0x10')]);module[_0x2850('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 2ec57f7..4470431 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 _0xdbf5=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x486ace,_0x2acf99){var _0x236c9b=function(_0x344ea8){while(--_0x344ea8){_0x486ace['push'](_0x486ace['shift']());}};_0x236c9b(++_0x2acf99);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5237ba,_0x1a10a2){_0x5237ba=_0x5237ba-0x0;var _0x51f376=_0xdbf5[_0x5237ba];return _0x51f376;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'queue':{'type':Sequelize[_0x5dbf('0x1')]},'interface':{'type':Sequelize[_0x5dbf('0x1')]},'membername':{'type':Sequelize[_0x5dbf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentconnectAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5dbf('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5dbf('0x2')]},'holdtime':{'type':Sequelize[_0x5dbf('0x3')]},'agentcomplete':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5dbf('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5dbf('0x3')]},'reason':{'type':Sequelize[_0x5dbf('0x1')]},'lastevent':{'type':Sequelize[_0x5dbf('0x1')]},'channel':{'type':Sequelize[_0x5dbf('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5dbf('0x1')]},'destchannelstate':{'type':Sequelize[_0x5dbf('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5dbf('0x1')]},'destcalleridname':{'type':Sequelize[_0x5dbf('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5dbf('0x1')]},'destaccountcode':{'type':Sequelize[_0x5dbf('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5dbf('0x1')]},'destpriority':{'type':Sequelize[_0x5dbf('0x1')]},'destuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x5dbf('0x1')]},'transfer':{'type':Sequelize[_0x5dbf('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5dbf('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x5dbf('0x1')]},'agententerreason':{'type':Sequelize[_0x5dbf('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeda8=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xeda8,0x104));var _0x8eda=function(_0x366b00,_0x43db98){_0x366b00=_0x366b00-0x0;var _0x3cee3b=_0xeda8[_0x366b00];return _0x3cee3b;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eda('0x2')]},'calleridnum':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'queue':{'type':Sequelize[_0x8eda('0x2')]},'interface':{'type':Sequelize[_0x8eda('0x2')]},'membername':{'type':Sequelize[_0x8eda('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eda('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eda('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8eda('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8eda('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eda('0x3')]},'holdtime':{'type':Sequelize[_0x8eda('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eda('0x4')]},'agentacw':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x8eda('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eda('0x2')]},'exten':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'destchannel':{'type':Sequelize[_0x8eda('0x2')]},'destchannelstate':{'type':Sequelize[_0x8eda('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eda('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eda('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eda('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8eda('0x2')]},'destpriority':{'type':Sequelize[_0x8eda('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eda('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8eda('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eda('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x8eda('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x8eda('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 1495548..9008ec8 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 _0xff64=['../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','VoiceAgentReport','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','catch','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x30f308,_0x2aa75c){var _0x31517f=function(_0x590f6f){while(--_0x590f6f){_0x30f308['push'](_0x30f308['shift']());}};_0x31517f(++_0x2aa75c);}(_0xff64,0x7e));var _0x4ff6=function(_0x2be3b1,_0x58685a){_0x2be3b1=_0x2be3b1-0x0;var _0x54dc5b=_0xff64[_0x2be3b1];return _0x54dc5b;};'use strict';var pdf=require(_0x4ff6('0x0'));var emlformat=require(_0x4ff6('0x1'));var rimraf=require(_0x4ff6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ff6('0x3'));var rp=require(_0x4ff6('0x4'));var moment=require(_0x4ff6('0x5'));var BPromise=require(_0x4ff6('0x6'));var Mustache=require('mustache');var util=require(_0x4ff6('0x7'));var path=require(_0x4ff6('0x8'));var sox=require(_0x4ff6('0x9'));var csv=require('to-csv');var ejs=require(_0x4ff6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4ff6('0xb'));var crypto=require(_0x4ff6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4ff6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4ff6('0xe'));var Papa=require('papaparse');var Redis=require(_0x4ff6('0xf'));var authService=require(_0x4ff6('0x10'));var qs=require(_0x4ff6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ff6('0x12'));var logger=require(_0x4ff6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ff6('0x14'));var db=require(_0x4ff6('0x15'))['db'];function respondWithStatusCode(_0x218027,_0x11f904){_0x11f904=_0x11f904||0xcc;return function(_0x1682e2){if(_0x1682e2){return _0x218027[_0x4ff6('0x16')](_0x11f904);}return _0x218027['status'](_0x11f904)[_0x4ff6('0x17')]();};}function respondWithResult(_0x4b7882,_0x55b403){_0x55b403=_0x55b403||0xc8;return function(_0x15aa9f){if(_0x15aa9f){return _0x4b7882[_0x4ff6('0x18')](_0x55b403)['json'](_0x15aa9f);}};}function respondWithFilteredResult(_0x5722ac,_0x5ca3c2){return function(_0x447f0c){if(_0x447f0c){var _0x303029=_0x447f0c[_0x4ff6('0x19')],_0x1d667e=_0x5ca3c2['offset'],_0x2cf98c=_0x5ca3c2[_0x4ff6('0x1a')]+_0x5ca3c2['limit'],_0x227592;if(_0x2cf98c>=_0x303029){_0x2cf98c=_0x303029;_0x227592=0xc8;}else{_0x227592=0xce;}_0x5722ac[_0x4ff6('0x18')](_0x227592);return _0x5722ac['set'](_0x4ff6('0x1b'),_0x1d667e+'-'+_0x2cf98c+'/'+_0x303029)[_0x4ff6('0x1c')](_0x447f0c);}return null;};}function patchUpdates(_0x547a95){return function(_0x1e2782){try{jsonpatch[_0x4ff6('0x1d')](_0x1e2782,_0x547a95,!![]);}catch(_0x47cab8){return BPromise[_0x4ff6('0x1e')](_0x47cab8);}return _0x1e2782[_0x4ff6('0x1f')]();};}function saveUpdates(_0xe9124b,_0x167ddf){return function(_0xf6b85a){if(_0xf6b85a){return _0xf6b85a[_0x4ff6('0x20')](_0xe9124b)[_0x4ff6('0x21')](function(_0x356845){return _0x356845;});}return null;};}function removeEntity(_0x4cc831,_0x136972){return function(_0x998ea9){if(_0x998ea9){return _0x998ea9[_0x4ff6('0x22')]()[_0x4ff6('0x21')](function(){_0x4cc831['status'](0xcc)[_0x4ff6('0x17')]();});}};}function handleEntityNotFound(_0xdc23cd,_0x1a94a2){return function(_0x23a082){if(!_0x23a082){_0xdc23cd['sendStatus'](0x194);}return _0x23a082;};}function handleError(_0x3b944e,_0x4c23a3){_0x4c23a3=_0x4c23a3||0x1f4;return function(_0x2cd06c){logger[_0x4ff6('0x23')](_0x2cd06c['stack']);if(_0x2cd06c['name']){delete _0x2cd06c[_0x4ff6('0x24')];}_0x3b944e[_0x4ff6('0x18')](_0x4c23a3)[_0x4ff6('0x25')](_0x2cd06c);};}exports[_0x4ff6('0x26')]=function(_0x3ee388,_0x4007f0){var _0x50f8aa={},_0x4949d0={},_0x12dcf1={'count':0x0,'rows':[]};var _0x1b6d0b=_['map'](db[_0x4ff6('0x27')]['rawAttributes'],function(_0x53e376){return{'name':_0x53e376[_0x4ff6('0x28')],'type':_0x53e376[_0x4ff6('0x29')][_0x4ff6('0x2a')]};});_0x4949d0['model']=_['map'](_0x1b6d0b,_0x4ff6('0x24'));_0x4949d0[_0x4ff6('0x2b')]=_['keys'](_0x3ee388[_0x4ff6('0x2b')]);_0x4949d0[_0x4ff6('0x2c')]=_[_0x4ff6('0x2d')](_0x4949d0['model'],_0x4949d0[_0x4ff6('0x2b')]);_0x50f8aa['attributes']=_['intersection'](_0x4949d0[_0x4ff6('0x2e')],qs['fields'](_0x3ee388[_0x4ff6('0x2b')][_0x4ff6('0x2f')]));_0x50f8aa[_0x4ff6('0x30')]=_0x50f8aa[_0x4ff6('0x30')][_0x4ff6('0x31')]?_0x50f8aa[_0x4ff6('0x30')]:_0x4949d0['model'];if(!_0x3ee388[_0x4ff6('0x2b')][_0x4ff6('0x32')](_0x4ff6('0x33'))){_0x50f8aa['limit']=qs[_0x4ff6('0x34')](_0x3ee388[_0x4ff6('0x2b')][_0x4ff6('0x34')]);_0x50f8aa['offset']=qs[_0x4ff6('0x1a')](_0x3ee388[_0x4ff6('0x2b')][_0x4ff6('0x1a')]);}_0x50f8aa['order']=qs[_0x4ff6('0x35')](_0x3ee388[_0x4ff6('0x2b')][_0x4ff6('0x35')]);_0x50f8aa[_0x4ff6('0x36')]=qs[_0x4ff6('0x2c')](_['pick'](_0x3ee388['query'],_0x4949d0[_0x4ff6('0x2c')]),_0x1b6d0b);if(_0x3ee388[_0x4ff6('0x2b')]['filter']){_0x50f8aa[_0x4ff6('0x36')]=_[_0x4ff6('0x37')](_0x50f8aa[_0x4ff6('0x36')],{'$or':_[_0x4ff6('0x38')](_0x1b6d0b,function(_0x38aa7c){if(_0x38aa7c[_0x4ff6('0x29')]!==_0x4ff6('0x39')){var _0x5bf197={};_0x5bf197[_0x38aa7c[_0x4ff6('0x24')]]={'$like':'%'+_0x3ee388[_0x4ff6('0x2b')][_0x4ff6('0x3a')]+'%'};return _0x5bf197;}})});}_0x50f8aa=_[_0x4ff6('0x37')]({},_0x50f8aa,_0x3ee388[_0x4ff6('0x3b')]);var _0x280b10={'where':_0x50f8aa['where']};return db['VoiceAgentReport'][_0x4ff6('0x19')](_0x280b10)[_0x4ff6('0x21')](function(_0x5326a7){_0x12dcf1[_0x4ff6('0x19')]=_0x5326a7;if(_0x3ee388[_0x4ff6('0x2b')][_0x4ff6('0x3c')]){_0x50f8aa['include']=[{'all':!![]}];}return db[_0x4ff6('0x27')][_0x4ff6('0x3d')](_0x50f8aa);})[_0x4ff6('0x21')](function(_0x95eedc){_0x12dcf1[_0x4ff6('0x3e')]=_0x95eedc;return _0x12dcf1;})[_0x4ff6('0x21')](respondWithFilteredResult(_0x4007f0,_0x50f8aa))['catch'](handleError(_0x4007f0,null));};exports[_0x4ff6('0x3f')]=function(_0x1a9aa6,_0x5e1de1){var _0x433496={'raw':![],'where':{'id':_0x1a9aa6[_0x4ff6('0x40')]['id']}},_0x25677c={};_0x25677c[_0x4ff6('0x2e')]=_[_0x4ff6('0x41')](db[_0x4ff6('0x27')][_0x4ff6('0x42')]);_0x25677c[_0x4ff6('0x2b')]=_['keys'](_0x1a9aa6[_0x4ff6('0x2b')]);_0x25677c['filters']=_[_0x4ff6('0x2d')](_0x25677c[_0x4ff6('0x2e')],_0x25677c['query']);_0x433496[_0x4ff6('0x30')]=_[_0x4ff6('0x2d')](_0x25677c['model'],qs[_0x4ff6('0x2f')](_0x1a9aa6[_0x4ff6('0x2b')][_0x4ff6('0x2f')]));_0x433496[_0x4ff6('0x30')]=_0x433496[_0x4ff6('0x30')][_0x4ff6('0x31')]?_0x433496[_0x4ff6('0x30')]:_0x25677c[_0x4ff6('0x2e')];if(_0x1a9aa6[_0x4ff6('0x2b')][_0x4ff6('0x3c')]){_0x433496[_0x4ff6('0x43')]=[{'all':!![]}];}_0x433496=_['merge']({},_0x433496,_0x1a9aa6[_0x4ff6('0x3b')]);return db[_0x4ff6('0x27')]['find'](_0x433496)[_0x4ff6('0x21')](handleEntityNotFound(_0x5e1de1,null))['then'](respondWithResult(_0x5e1de1,null))[_0x4ff6('0x44')](handleError(_0x5e1de1,null));};exports['create']=function(_0x21ddd6,_0x40d2c5){return db['VoiceAgentReport'][_0x4ff6('0x45')](_0x21ddd6[_0x4ff6('0x46')],{})['then'](respondWithResult(_0x40d2c5,0xc9))[_0x4ff6('0x44')](handleError(_0x40d2c5,null));};exports['update']=function(_0xed5f3e,_0x438625){if(_0xed5f3e[_0x4ff6('0x46')]['id']){delete _0xed5f3e[_0x4ff6('0x46')]['id'];}return db[_0x4ff6('0x27')][_0x4ff6('0x47')]({'where':{'id':_0xed5f3e[_0x4ff6('0x40')]['id']}})[_0x4ff6('0x21')](handleEntityNotFound(_0x438625,null))[_0x4ff6('0x21')](saveUpdates(_0xed5f3e[_0x4ff6('0x46')],null))[_0x4ff6('0x21')](respondWithResult(_0x438625,null))[_0x4ff6('0x44')](handleError(_0x438625,null));};exports[_0x4ff6('0x22')]=function(_0x4c2161,_0x429089){return db[_0x4ff6('0x27')][_0x4ff6('0x47')]({'where':{'id':_0x4c2161[_0x4ff6('0x40')]['id']}})[_0x4ff6('0x21')](handleEntityNotFound(_0x429089,null))['then'](removeEntity(_0x429089,null))[_0x4ff6('0x44')](handleError(_0x429089,null));};exports[_0x4ff6('0x48')]=function(_0x57fc8f,_0x5bb92a){return db[_0x4ff6('0x27')]['describe']()[_0x4ff6('0x21')](respondWithResult(_0x5bb92a,null))[_0x4ff6('0x44')](handleError(_0x5bb92a,null));}; \ No newline at end of file +var _0x3204=['save','update','then','destroy','name','send','map','VoiceAgentReport','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply'];(function(_0x528a90,_0x3e377c){var _0x51feee=function(_0xea4b44){while(--_0xea4b44){_0x528a90['push'](_0x528a90['shift']());}};_0x51feee(++_0x3e377c);}(_0x3204,0x15c));var _0x4320=function(_0x49f62d,_0x3a0e44){_0x49f62d=_0x49f62d-0x0;var _0x24756f=_0x3204[_0x49f62d];return _0x24756f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4320('0x0'));var rimraf=require(_0x4320('0x1'));var zipdir=require(_0x4320('0x2'));var jsonpatch=require(_0x4320('0x3'));var rp=require(_0x4320('0x4'));var moment=require(_0x4320('0x5'));var BPromise=require(_0x4320('0x6'));var Mustache=require(_0x4320('0x7'));var util=require(_0x4320('0x8'));var path=require('path');var sox=require(_0x4320('0x9'));var csv=require(_0x4320('0xa'));var ejs=require(_0x4320('0xb'));var fs=require('fs');var _=require(_0x4320('0xc'));var squel=require(_0x4320('0xd'));var crypto=require(_0x4320('0xe'));var jsforce=require(_0x4320('0xf'));var deskjs=require(_0x4320('0x10'));var toCsv=require(_0x4320('0xa'));var querystring=require(_0x4320('0x11'));var Papa=require(_0x4320('0x12'));var Redis=require(_0x4320('0x13'));var authService=require(_0x4320('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4320('0x15'));var hardwareService=require(_0x4320('0x16'));var logger=require(_0x4320('0x17'))(_0x4320('0x18'));var utils=require(_0x4320('0x19'));var config=require(_0x4320('0x1a'));var licenseUtil=require(_0x4320('0x1b'));var db=require(_0x4320('0x1c'))['db'];function respondWithStatusCode(_0x3dc523,_0x46dccd){_0x46dccd=_0x46dccd||0xcc;return function(_0x418d0b){if(_0x418d0b){return _0x3dc523[_0x4320('0x1d')](_0x46dccd);}return _0x3dc523[_0x4320('0x1e')](_0x46dccd)[_0x4320('0x1f')]();};}function respondWithResult(_0x430b09,_0x294dc4){_0x294dc4=_0x294dc4||0xc8;return function(_0xe48696){if(_0xe48696){return _0x430b09[_0x4320('0x1e')](_0x294dc4)[_0x4320('0x20')](_0xe48696);}};}function respondWithFilteredResult(_0x16b674,_0x34b5ee){return function(_0x1ce3c3){if(_0x1ce3c3){var _0x20b69c=_0x1ce3c3['count'],_0x54ce16=_0x34b5ee[_0x4320('0x21')],_0xa9e91e=_0x34b5ee[_0x4320('0x21')]+_0x34b5ee[_0x4320('0x22')],_0x6710f4;if(_0xa9e91e>=_0x20b69c){_0xa9e91e=_0x20b69c;_0x6710f4=0xc8;}else{_0x6710f4=0xce;}_0x16b674[_0x4320('0x1e')](_0x6710f4);return _0x16b674[_0x4320('0x23')]('Content-Range',_0x54ce16+'-'+_0xa9e91e+'/'+_0x20b69c)[_0x4320('0x20')](_0x1ce3c3);}return null;};}function patchUpdates(_0x2f5e09){return function(_0x1c32c){try{jsonpatch[_0x4320('0x24')](_0x1c32c,_0x2f5e09,!![]);}catch(_0x23e576){return BPromise['reject'](_0x23e576);}return _0x1c32c[_0x4320('0x25')]();};}function saveUpdates(_0x2c1c14,_0x20754c){return function(_0x466713){if(_0x466713){return _0x466713[_0x4320('0x26')](_0x2c1c14)[_0x4320('0x27')](function(_0x5ad64e){return _0x5ad64e;});}return null;};}function removeEntity(_0x11ebb8,_0x49b84b){return function(_0x26d09b){if(_0x26d09b){return _0x26d09b[_0x4320('0x28')]()[_0x4320('0x27')](function(){_0x11ebb8[_0x4320('0x1e')](0xcc)[_0x4320('0x1f')]();});}};}function handleEntityNotFound(_0x5d0d7a,_0x5d6660){return function(_0x200182){if(!_0x200182){_0x5d0d7a['sendStatus'](0x194);}return _0x200182;};}function handleError(_0x59abf1,_0x12101d){_0x12101d=_0x12101d||0x1f4;return function(_0x14e60e){logger['error'](_0x14e60e['stack']);if(_0x14e60e[_0x4320('0x29')]){delete _0x14e60e[_0x4320('0x29')];}_0x59abf1[_0x4320('0x1e')](_0x12101d)[_0x4320('0x2a')](_0x14e60e);};}exports['index']=function(_0x401f5d,_0x28eb19){var _0x4fcdeb={},_0x288001={},_0x24aafd={'count':0x0,'rows':[]};var _0x4e440c=_[_0x4320('0x2b')](db[_0x4320('0x2c')]['rawAttributes'],function(_0x30d4cc){return{'name':_0x30d4cc[_0x4320('0x2d')],'type':_0x30d4cc[_0x4320('0x2e')][_0x4320('0x2f')]};});_0x288001[_0x4320('0x30')]=_['map'](_0x4e440c,_0x4320('0x29'));_0x288001['query']=_[_0x4320('0x31')](_0x401f5d['query']);_0x288001[_0x4320('0x32')]=_[_0x4320('0x33')](_0x288001['model'],_0x288001[_0x4320('0x34')]);_0x4fcdeb['attributes']=_[_0x4320('0x33')](_0x288001[_0x4320('0x30')],qs[_0x4320('0x35')](_0x401f5d[_0x4320('0x34')][_0x4320('0x35')]));_0x4fcdeb[_0x4320('0x36')]=_0x4fcdeb[_0x4320('0x36')]['length']?_0x4fcdeb[_0x4320('0x36')]:_0x288001[_0x4320('0x30')];if(!_0x401f5d[_0x4320('0x34')][_0x4320('0x37')](_0x4320('0x38'))){_0x4fcdeb[_0x4320('0x22')]=qs[_0x4320('0x22')](_0x401f5d[_0x4320('0x34')]['limit']);_0x4fcdeb[_0x4320('0x21')]=qs[_0x4320('0x21')](_0x401f5d[_0x4320('0x34')][_0x4320('0x21')]);}_0x4fcdeb[_0x4320('0x39')]=qs[_0x4320('0x3a')](_0x401f5d[_0x4320('0x34')][_0x4320('0x3a')]);_0x4fcdeb[_0x4320('0x3b')]=qs['filters'](_[_0x4320('0x3c')](_0x401f5d[_0x4320('0x34')],_0x288001[_0x4320('0x32')]),_0x4e440c);if(_0x401f5d[_0x4320('0x34')][_0x4320('0x3d')]){_0x4fcdeb['where']=_['merge'](_0x4fcdeb['where'],{'$or':_[_0x4320('0x2b')](_0x4e440c,function(_0x26efc4){if(_0x26efc4[_0x4320('0x2e')]!==_0x4320('0x3e')){var _0x4564a3={};_0x4564a3[_0x26efc4[_0x4320('0x29')]]={'$like':'%'+_0x401f5d[_0x4320('0x34')]['filter']+'%'};return _0x4564a3;}})});}_0x4fcdeb=_[_0x4320('0x3f')]({},_0x4fcdeb,_0x401f5d['options']);var _0x5991b8={'where':_0x4fcdeb['where']};return db[_0x4320('0x2c')][_0x4320('0x40')](_0x5991b8)[_0x4320('0x27')](function(_0x201ec6){_0x24aafd['count']=_0x201ec6;if(_0x401f5d[_0x4320('0x34')][_0x4320('0x41')]){_0x4fcdeb['include']=[{'all':!![]}];}return db[_0x4320('0x2c')][_0x4320('0x42')](_0x4fcdeb);})[_0x4320('0x27')](function(_0xfb01aa){_0x24aafd[_0x4320('0x43')]=_0xfb01aa;return _0x24aafd;})[_0x4320('0x27')](respondWithFilteredResult(_0x28eb19,_0x4fcdeb))[_0x4320('0x44')](handleError(_0x28eb19,null));};exports[_0x4320('0x45')]=function(_0x39e5c5,_0x15bfc7){var _0x24cbb4={'raw':![],'where':{'id':_0x39e5c5[_0x4320('0x46')]['id']}},_0x15e295={};_0x15e295[_0x4320('0x30')]=_[_0x4320('0x31')](db[_0x4320('0x2c')][_0x4320('0x47')]);_0x15e295[_0x4320('0x34')]=_[_0x4320('0x31')](_0x39e5c5[_0x4320('0x34')]);_0x15e295[_0x4320('0x32')]=_['intersection'](_0x15e295['model'],_0x15e295['query']);_0x24cbb4[_0x4320('0x36')]=_[_0x4320('0x33')](_0x15e295['model'],qs['fields'](_0x39e5c5[_0x4320('0x34')][_0x4320('0x35')]));_0x24cbb4[_0x4320('0x36')]=_0x24cbb4['attributes'][_0x4320('0x48')]?_0x24cbb4['attributes']:_0x15e295[_0x4320('0x30')];if(_0x39e5c5[_0x4320('0x34')]['includeAll']){_0x24cbb4['include']=[{'all':!![]}];}_0x24cbb4=_[_0x4320('0x3f')]({},_0x24cbb4,_0x39e5c5['options']);return db[_0x4320('0x2c')][_0x4320('0x49')](_0x24cbb4)[_0x4320('0x27')](handleEntityNotFound(_0x15bfc7,null))['then'](respondWithResult(_0x15bfc7,null))[_0x4320('0x44')](handleError(_0x15bfc7,null));};exports['create']=function(_0x450ef0,_0x23f9c9){return db[_0x4320('0x2c')][_0x4320('0x4a')](_0x450ef0[_0x4320('0x4b')],{})[_0x4320('0x27')](respondWithResult(_0x23f9c9,0xc9))[_0x4320('0x44')](handleError(_0x23f9c9,null));};exports[_0x4320('0x26')]=function(_0x14ba1f,_0x3f3772){if(_0x14ba1f[_0x4320('0x4b')]['id']){delete _0x14ba1f[_0x4320('0x4b')]['id'];}return db[_0x4320('0x2c')][_0x4320('0x49')]({'where':{'id':_0x14ba1f[_0x4320('0x46')]['id']}})[_0x4320('0x27')](handleEntityNotFound(_0x3f3772,null))[_0x4320('0x27')](saveUpdates(_0x14ba1f[_0x4320('0x4b')],null))[_0x4320('0x27')](respondWithResult(_0x3f3772,null))[_0x4320('0x44')](handleError(_0x3f3772,null));};exports[_0x4320('0x28')]=function(_0x20baad,_0x3df2d1){return db[_0x4320('0x2c')]['find']({'where':{'id':_0x20baad[_0x4320('0x46')]['id']}})['then'](handleEntityNotFound(_0x3df2d1,null))[_0x4320('0x27')](removeEntity(_0x3df2d1,null))[_0x4320('0x44')](handleError(_0x3df2d1,null));};exports[_0x4320('0x4c')]=function(_0x3bdb9e,_0x51e0c4){return db['VoiceAgentReport']['describe']()['then'](respondWithResult(_0x51e0c4,null))[_0x4320('0x44')](handleError(_0x51e0c4,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index f6e67dd..6e42560 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 _0x7801=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','report_agent','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3fab43,_0x2132c8){var _0x1041a8=function(_0x4040eb){while(--_0x4040eb){_0x3fab43['push'](_0x3fab43['shift']());}};_0x1041a8(++_0x2132c8);}(_0x7801,0x11a));var _0x1780=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x7801[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0x1780('0x0'));var logger=require(_0x1780('0x1'))(_0x1780('0x2'));var moment=require(_0x1780('0x3'));var BPromise=require(_0x1780('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1780('0x5'));var rimraf=require(_0x1780('0x6'));var config=require(_0x1780('0x7'));var attributes=require(_0x1780('0x8'));module[_0x1780('0x9')]=function(_0x2772f3,_0xab0594){return _0x2772f3['define']('VoiceAgentReport',attributes,{'tableName':_0x1780('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1780('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x30f0=['uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x4864ea,_0x7764ed){var _0x12e74f=function(_0x3fe41d){while(--_0x3fe41d){_0x4864ea['push'](_0x4864ea['shift']());}};_0x12e74f(++_0x7764ed);}(_0x30f0,0x179));var _0x030f=function(_0x45dea7,_0x228708){_0x45dea7=_0x45dea7-0x0;var _0x4245c4=_0x30f0[_0x45dea7];return _0x4245c4;};'use strict';var _=require(_0x030f('0x0'));var util=require(_0x030f('0x1'));var logger=require(_0x030f('0x2'))(_0x030f('0x3'));var moment=require(_0x030f('0x4'));var BPromise=require(_0x030f('0x5'));var rp=require(_0x030f('0x6'));var fs=require('fs');var path=require(_0x030f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x030f('0x8'));module[_0x030f('0x9')]=function(_0x16f6c0,_0x410c60){return _0x16f6c0[_0x030f('0xa')](_0x030f('0xb'),attributes,{'tableName':_0x030f('0xc'),'paranoid':![],'indexes':[{'fields':[_0x030f('0xd'),_0x030f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 8edd5e0..8e7c797 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 _0xaf4d=['UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','update','where','limit'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xaf4d,0x169));var _0xdaf4=function(_0x1eb7cd,_0x3259bf){_0x1eb7cd=_0x1eb7cd-0x0;var _0x209f39=_0xaf4d[_0x1eb7cd];return _0x209f39;};'use strict';var _=require(_0xdaf4('0x0'));var util=require('util');var moment=require(_0xdaf4('0x1'));var BPromise=require(_0xdaf4('0x2'));var rs=require(_0xdaf4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaf4('0x4'))['db'];var utils=require(_0xdaf4('0x5'));var logger=require(_0xdaf4('0x6'))('rpc');var config=require(_0xdaf4('0x7'));var jayson=require(_0xdaf4('0x8'));var client=jayson[_0xdaf4('0x9')][_0xdaf4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c9c49,_0x8b50f3,_0x286a5f){return new BPromise(function(_0x1c69e1,_0x2ec551){return client['request'](_0x5c9c49,_0x286a5f)[_0xdaf4('0xb')](function(_0x2a31b8){logger[_0xdaf4('0xc')](_0xdaf4('0xd'),_0x8b50f3,'request\x20sent');logger[_0xdaf4('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x8b50f3,_0xdaf4('0xf'),JSON[_0xdaf4('0x10')](_0x2a31b8));if(_0x2a31b8[_0xdaf4('0x11')]){if(_0x2a31b8[_0xdaf4('0x11')][_0xdaf4('0x12')]===0x1f4){logger[_0xdaf4('0x11')](_0xdaf4('0xd'),_0x8b50f3,_0x2a31b8[_0xdaf4('0x11')][_0xdaf4('0x13')]);return _0x2ec551(_0x2a31b8[_0xdaf4('0x11')][_0xdaf4('0x13')]);}logger[_0xdaf4('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x8b50f3,_0x2a31b8[_0xdaf4('0x11')]['message']);return _0x1c69e1(_0x2a31b8[_0xdaf4('0x11')][_0xdaf4('0x13')]);}else{logger[_0xdaf4('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x8b50f3,'request\x20sent');_0x1c69e1(_0x2a31b8['result'][_0xdaf4('0x13')]);}})[_0xdaf4('0x14')](function(_0x4f7d8b){logger[_0xdaf4('0x11')](_0xdaf4('0xd'),_0x8b50f3,_0x4f7d8b);_0x2ec551(_0x4f7d8b);});});}exports[_0xdaf4('0x15')]=function(_0x2ed4f8){var _0x41df9a=this;return new Promise(function(_0x1fe636,_0x9d682d){return db[_0xdaf4('0x16')][_0xdaf4('0x17')](_0x2ed4f8['body'],{'raw':_0x2ed4f8[_0xdaf4('0x18')]?_0x2ed4f8['options'][_0xdaf4('0x19')]===undefined?!![]:![]:!![]})[_0xdaf4('0xb')](function(_0x5bf98c){logger['info'](_0xdaf4('0x15'),_0x2ed4f8);logger[_0xdaf4('0xe')]('CreateVoiceAgentReport',_0x2ed4f8,JSON['stringify'](_0x5bf98c));_0x1fe636(_0x5bf98c);})[_0xdaf4('0x14')](function(_0x5ee369){logger[_0xdaf4('0x11')]('CreateVoiceAgentReport',_0x5ee369[_0xdaf4('0x13')],_0x2ed4f8);_0x9d682d(_0x41df9a[_0xdaf4('0x11')](0x1f4,_0x5ee369[_0xdaf4('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x14b3a5){var _0x305c84=this;return new Promise(function(_0x27820a,_0x46b534){return db[_0xdaf4('0x16')][_0xdaf4('0x1a')](_0x14b3a5['body'],{'raw':_0x14b3a5[_0xdaf4('0x18')]?_0x14b3a5['options'][_0xdaf4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14b3a5[_0xdaf4('0x18')]?_0x14b3a5['options'][_0xdaf4('0x1b')]||null:null,'attributes':_0x14b3a5[_0xdaf4('0x18')]?_0x14b3a5['options']['attributes']||null:null,'limit':_0x14b3a5['options']?_0x14b3a5[_0xdaf4('0x18')][_0xdaf4('0x1c')]||null:null})[_0xdaf4('0xb')](function(_0x21af5d){logger['info'](_0xdaf4('0x1d'),_0x14b3a5);logger[_0xdaf4('0xe')]('UpdateVoiceAgentReport',_0x14b3a5,JSON[_0xdaf4('0x10')](_0x21af5d));_0x27820a(_0x21af5d);})[_0xdaf4('0x14')](function(_0x3508ce){logger['error'](_0xdaf4('0x1d'),_0x3508ce['message'],_0x14b3a5);_0x46b534(_0x305c84[_0xdaf4('0x11')](0x1f4,_0x3508ce['message']));});});}; \ No newline at end of file +var _0xcdc3=['UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','then','catch','update','raw','where','attributes','limit'];(function(_0x208628,_0x461459){var _0x40f96e=function(_0x509f22){while(--_0x509f22){_0x208628['push'](_0x208628['shift']());}};_0x40f96e(++_0x461459);}(_0xcdc3,0x1cf));var _0x3cdc=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcdc3[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x3cdc('0x0'));var util=require(_0x3cdc('0x1'));var moment=require(_0x3cdc('0x2'));var BPromise=require(_0x3cdc('0x3'));var rs=require(_0x3cdc('0x4'));var fs=require('fs');var Redis=require(_0x3cdc('0x5'));var db=require(_0x3cdc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3cdc('0x7'));var config=require('../../config/environment');var jayson=require(_0x3cdc('0x8'));var client=jayson[_0x3cdc('0x9')][_0x3cdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e4c8e,_0x5c0a7a,_0x48f076){return new BPromise(function(_0x52a956,_0x3b5ffb){return client['request'](_0x3e4c8e,_0x48f076)['then'](function(_0x5993fe){logger['info'](_0x3cdc('0xb'),_0x5c0a7a,_0x3cdc('0xc'));logger[_0x3cdc('0xd')](_0x3cdc('0xe'),_0x5c0a7a,_0x3cdc('0xc'),JSON[_0x3cdc('0xf')](_0x5993fe));if(_0x5993fe[_0x3cdc('0x10')]){if(_0x5993fe[_0x3cdc('0x10')][_0x3cdc('0x11')]===0x1f4){logger[_0x3cdc('0x10')](_0x3cdc('0xb'),_0x5c0a7a,_0x5993fe['error'][_0x3cdc('0x12')]);return _0x3b5ffb(_0x5993fe[_0x3cdc('0x10')]['message']);}logger[_0x3cdc('0x10')](_0x3cdc('0xb'),_0x5c0a7a,_0x5993fe[_0x3cdc('0x10')]['message']);return _0x52a956(_0x5993fe[_0x3cdc('0x10')][_0x3cdc('0x12')]);}else{logger[_0x3cdc('0x13')](_0x3cdc('0xb'),_0x5c0a7a,_0x3cdc('0xc'));_0x52a956(_0x5993fe['result'][_0x3cdc('0x12')]);}})['catch'](function(_0x3d4e77){logger['error'](_0x3cdc('0xb'),_0x5c0a7a,_0x3d4e77);_0x3b5ffb(_0x3d4e77);});});}exports[_0x3cdc('0x14')]=function(_0x224c49){var _0x4c1a4d=this;return new Promise(function(_0x364bae,_0x2ed4cf){return db[_0x3cdc('0x15')][_0x3cdc('0x16')](_0x224c49[_0x3cdc('0x17')],{'raw':_0x224c49[_0x3cdc('0x18')]?_0x224c49[_0x3cdc('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3cdc('0x19')](function(_0x156dbe){logger['info']('CreateVoiceAgentReport',_0x224c49);logger[_0x3cdc('0xd')](_0x3cdc('0x14'),_0x224c49,JSON['stringify'](_0x156dbe));_0x364bae(_0x156dbe);})[_0x3cdc('0x1a')](function(_0x1b5866){logger[_0x3cdc('0x10')](_0x3cdc('0x14'),_0x1b5866[_0x3cdc('0x12')],_0x224c49);_0x2ed4cf(_0x4c1a4d[_0x3cdc('0x10')](0x1f4,_0x1b5866[_0x3cdc('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x109632){var _0x568cbc=this;return new Promise(function(_0x10f2fc,_0x3203d8){return db[_0x3cdc('0x15')][_0x3cdc('0x1b')](_0x109632[_0x3cdc('0x17')],{'raw':_0x109632['options']?_0x109632[_0x3cdc('0x18')][_0x3cdc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109632[_0x3cdc('0x18')]?_0x109632[_0x3cdc('0x18')][_0x3cdc('0x1d')]||null:null,'attributes':_0x109632[_0x3cdc('0x18')]?_0x109632[_0x3cdc('0x18')][_0x3cdc('0x1e')]||null:null,'limit':_0x109632[_0x3cdc('0x18')]?_0x109632[_0x3cdc('0x18')][_0x3cdc('0x1f')]||null:null})['then'](function(_0x524b07){logger[_0x3cdc('0x13')]('UpdateVoiceAgentReport',_0x109632);logger[_0x3cdc('0xd')](_0x3cdc('0x20'),_0x109632,JSON[_0x3cdc('0xf')](_0x524b07));_0x10f2fc(_0x524b07);})[_0x3cdc('0x1a')](function(_0x16be14){logger[_0x3cdc('0x10')](_0x3cdc('0x20'),_0x16be14[_0x3cdc('0x12')],_0x109632);_0x3203d8(_0x568cbc[_0x3cdc('0x10')](0x1f4,_0x16be14[_0x3cdc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6ff2cc5..d5115f0 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 _0x325f=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','delete','destroy'];(function(_0x1a572b,_0x2948d9){var _0x59d819=function(_0x3b6ba5){while(--_0x3b6ba5){_0x1a572b['push'](_0x1a572b['shift']());}};_0x59d819(++_0x2948d9);}(_0x325f,0x1ef));var _0xf325=function(_0x58e339,_0x7faad8){_0x58e339=_0x58e339-0x0;var _0xefb0af=_0x325f[_0x58e339];return _0xefb0af;};'use strict';var multer=require(_0xf325('0x0'));var util=require(_0xf325('0x1'));var path=require('path');var timeout=require(_0xf325('0x2'));var express=require('express');var router=express[_0xf325('0x3')]();var auth=require(_0xf325('0x4'));var interaction=require(_0xf325('0x5'));var config=require(_0xf325('0x6'));var controller=require(_0xf325('0x7'));router[_0xf325('0x8')]('/',auth[_0xf325('0x9')](),controller[_0xf325('0xa')]);router['get']('/describe',auth[_0xf325('0x9')](),controller[_0xf325('0xb')]);router[_0xf325('0x8')](_0xf325('0xc'),auth[_0xf325('0x9')](),controller[_0xf325('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf325('0xe')]);router[_0xf325('0xf')](_0xf325('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf325('0x10')](_0xf325('0xc'),auth[_0xf325('0x9')](),controller[_0xf325('0x11')]);module[_0xf325('0x12')]=router; \ No newline at end of file +var _0x5654=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','isAuthenticated','get','/describe','describe','show','create','/:id'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x5654,0x1b9));var _0x4565=function(_0x8f5320,_0x31ad5d){_0x8f5320=_0x8f5320-0x0;var _0x1c957a=_0x5654[_0x8f5320];return _0x1c957a;};'use strict';var multer=require(_0x4565('0x0'));var util=require(_0x4565('0x1'));var path=require(_0x4565('0x2'));var timeout=require('connect-timeout');var express=require(_0x4565('0x3'));var router=express[_0x4565('0x4')]();var auth=require(_0x4565('0x5'));var interaction=require(_0x4565('0x6'));var config=require('../../config/environment');var controller=require(_0x4565('0x7'));router['get']('/',auth[_0x4565('0x8')](),controller['index']);router[_0x4565('0x9')](_0x4565('0xa'),auth[_0x4565('0x8')](),controller[_0x4565('0xb')]);router[_0x4565('0x9')]('/:id',auth[_0x4565('0x8')](),controller[_0x4565('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4565('0xd')]);router['put'](_0x4565('0xe'),auth[_0x4565('0x8')](),controller[_0x4565('0xf')]);router[_0x4565('0x10')](_0x4565('0xe'),auth[_0x4565('0x8')](),controller[_0x4565('0x11')]);module[_0x4565('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 e1ab443..6c7cad8 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 _0x98a8=['sequelize','exports','STRING','ENUM','inbound','internal','outbound','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x18b421,_0x36a4b1){var _0x28f517=function(_0x5696d9){while(--_0x5696d9){_0x18b421['push'](_0x18b421['shift']());}};_0x28f517(++_0x36a4b1);}(_0x98a8,0x12c));var _0x898a=function(_0x1be825,_0x13e08d){_0x1be825=_0x1be825-0x0;var _0x4a04d9=_0x98a8[_0x1be825];return _0x4a04d9;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'uniqueid':{'type':Sequelize[_0x898a('0x2')]},'type':{'type':Sequelize[_0x898a('0x3')](_0x898a('0x4'),_0x898a('0x5'),_0x898a('0x6'),'inbound-fax',_0x898a('0x7'),_0x898a('0x8'))},'tag':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'source':{'type':Sequelize[_0x898a('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x898a('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x898a('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x898a('0x2')]},'lastdata':{'type':Sequelize[_0x898a('0x9')]},'starttime':{'type':Sequelize[_0x898a('0xa')]},'systemanswertime':{'type':Sequelize[_0x898a('0xa')]},'answertime':{'type':Sequelize[_0x898a('0xa')]},'endtime':{'type':Sequelize[_0x898a('0xa')]},'duration':{'type':Sequelize[_0x898a('0xb')]},'billableseconds':{'type':Sequelize[_0x898a('0xb')]},'mohtime':{'type':Sequelize[_0x898a('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x898a('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x898a('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x898a('0x2')]},'note':{'type':Sequelize[_0x898a('0x2')]},'prefix':{'type':Sequelize[_0x898a('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2123=['ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x12e650,_0x33f29f){var _0x5b56b1=function(_0xa7f3d8){while(--_0xa7f3d8){_0x12e650['push'](_0x12e650['shift']());}};_0x5b56b1(++_0x33f29f);}(_0x2123,0x190));var _0x3212=function(_0x5ce8de,_0x3dbd81){_0x5ce8de=_0x5ce8de-0x0;var _0x7fcf0e=_0x2123[_0x5ce8de];return _0x7fcf0e;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'uniqueid':{'type':Sequelize[_0x3212('0x2')]},'type':{'type':Sequelize[_0x3212('0x3')](_0x3212('0x4'),_0x3212('0x5'),_0x3212('0x6'),_0x3212('0x7'),_0x3212('0x8'),_0x3212('0x9'))},'tag':{'type':Sequelize[_0x3212('0x2')]},'accountcode':{'type':Sequelize[_0x3212('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x3212('0x2')]},'destinationcontext':{'type':Sequelize[_0x3212('0x2')]},'callerid':{'type':Sequelize[_0x3212('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x3212('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x3212('0xa')]},'starttime':{'type':Sequelize[_0x3212('0xb')]},'systemanswertime':{'type':Sequelize[_0x3212('0xb')]},'answertime':{'type':Sequelize[_0x3212('0xb')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x3212('0xc')]},'mohtime':{'type':Sequelize[_0x3212('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3212('0x2')]},'amaflags':{'type':Sequelize[_0x3212('0x2')]},'userfield':{'type':Sequelize[_0x3212('0x2')]},'userDisposition':{'type':Sequelize[_0x3212('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x3212('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x3212('0x2')]},'note':{'type':Sequelize[_0x3212('0x2')]},'prefix':{'type':Sequelize[_0x3212('0x2')]},'routeid':{'type':Sequelize[_0x3212('0xc')]},'sipcallid':{'type':Sequelize[_0x3212('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5d8b958..e562319 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c53b9d5..75a0f9a 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 _0xf6ba=['path','rimraf','../../config/environment','VoiceCallReport','uniqueid','api','moment','bluebird'];(function(_0x2d0dc2,_0xad0c8a){var _0xc16d94=function(_0xb5c836){while(--_0xb5c836){_0x2d0dc2['push'](_0x2d0dc2['shift']());}};_0xc16d94(++_0xad0c8a);}(_0xf6ba,0xad));var _0xaf6b=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xf6ba[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xaf6b('0x0'));var moment=require(_0xaf6b('0x1'));var BPromise=require(_0xaf6b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf6b('0x3'));var rimraf=require(_0xaf6b('0x4'));var config=require(_0xaf6b('0x5'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x2fe30c,_0x11c034){return _0x2fe30c['define'](_0xaf6b('0x6'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xaf6b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0eeb=['path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3d0b38,_0x5b4bda){var _0x5f19fb=function(_0xb9cbdb){while(--_0xb9cbdb){_0x3d0b38['push'](_0x3d0b38['shift']());}};_0x5f19fb(++_0x5b4bda);}(_0x0eeb,0x166));var _0xb0ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0eeb[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require('moment');var BPromise=require(_0xb0ee('0x4'));var rp=require(_0xb0ee('0x5'));var fs=require('fs');var path=require(_0xb0ee('0x6'));var rimraf=require(_0xb0ee('0x7'));var config=require('../../config/environment');var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x2ddcee,_0x15592b){return _0x2ddcee[_0xb0ee('0xa')](_0xb0ee('0xb'),attributes,{'tableName':_0xb0ee('0xc'),'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 a897573..15180c8 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 _0x8590=['where','attributes','limit','include','model','map','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','info','catch','GetVoiceCallReport','findAll','options','raw'];(function(_0x494288,_0x974238){var _0x2f3751=function(_0x1c1c5a){while(--_0x1c1c5a){_0x494288['push'](_0x494288['shift']());}};_0x2f3751(++_0x974238);}(_0x8590,0x135));var _0x0859=function(_0xb98bdb,_0x2d9ff8){_0xb98bdb=_0xb98bdb-0x0;var _0x2f8679=_0x8590[_0xb98bdb];return _0x2f8679;};'use strict';var _=require(_0x0859('0x0'));var util=require(_0x0859('0x1'));var moment=require(_0x0859('0x2'));var BPromise=require(_0x0859('0x3'));var rs=require(_0x0859('0x4'));var fs=require('fs');var Redis=require(_0x0859('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0859('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0859('0x7'));var jayson=require(_0x0859('0x8'));var client=jayson[_0x0859('0x9')][_0x0859('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2becb7,_0x40c8fd,_0x4b481c){return new BPromise(function(_0x9ac372,_0x45814b){return client[_0x0859('0xb')](_0x2becb7,_0x4b481c)[_0x0859('0xc')](function(_0x21d4c7){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x40c8fd,_0x0859('0xd'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x40c8fd,_0x0859('0xd'),JSON[_0x0859('0xe')](_0x21d4c7));if(_0x21d4c7['error']){if(_0x21d4c7[_0x0859('0xf')]['code']===0x1f4){logger[_0x0859('0xf')](_0x0859('0x10'),_0x40c8fd,_0x21d4c7[_0x0859('0xf')][_0x0859('0x11')]);return _0x45814b(_0x21d4c7['error'][_0x0859('0x11')]);}logger[_0x0859('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x40c8fd,_0x21d4c7[_0x0859('0xf')][_0x0859('0x11')]);return _0x9ac372(_0x21d4c7[_0x0859('0xf')][_0x0859('0x11')]);}else{logger[_0x0859('0x12')](_0x0859('0x10'),_0x40c8fd,'request\x20sent');_0x9ac372(_0x21d4c7['result']['message']);}})[_0x0859('0x13')](function(_0x445ba9){logger[_0x0859('0xf')](_0x0859('0x10'),_0x40c8fd,_0x445ba9);_0x45814b(_0x445ba9);});});}exports[_0x0859('0x14')]=function(_0x569ea){var _0x3a1ad7=this;return new Promise(function(_0x139806,_0x202f78){return db['VoiceCallReport'][_0x0859('0x15')]({'raw':_0x569ea[_0x0859('0x16')]?_0x569ea[_0x0859('0x16')][_0x0859('0x17')]===undefined?!![]:![]:!![],'where':_0x569ea[_0x0859('0x16')]?_0x569ea[_0x0859('0x16')][_0x0859('0x18')]||null:null,'attributes':_0x569ea['options']?_0x569ea[_0x0859('0x16')][_0x0859('0x19')]||null:null,'limit':_0x569ea['options']?_0x569ea['options'][_0x0859('0x1a')]||null:null,'include':_0x569ea[_0x0859('0x16')]?_0x569ea[_0x0859('0x16')][_0x0859('0x1b')]?_['map'](_0x569ea[_0x0859('0x16')][_0x0859('0x1b')],function(_0x585134){return{'model':db[_0x585134[_0x0859('0x1c')]],'as':_0x585134['as'],'attributes':_0x585134[_0x0859('0x19')],'include':_0x585134[_0x0859('0x1b')]?_['map'](_0x585134[_0x0859('0x1b')],function(_0x5f2404){return{'model':db[_0x5f2404[_0x0859('0x1c')]],'as':_0x5f2404['as'],'attributes':_0x5f2404[_0x0859('0x19')],'include':_0x5f2404[_0x0859('0x1b')]?_[_0x0859('0x1d')](_0x5f2404[_0x0859('0x1b')],function(_0x5d9fa8){return{'model':db[_0x5d9fa8[_0x0859('0x1c')]],'as':_0x5d9fa8['as'],'attributes':_0x5d9fa8['attributes']};}):[]};}):[]};}):[]:[]})[_0x0859('0xc')](function(_0x37da32){logger[_0x0859('0x12')](_0x0859('0x14'),_0x569ea);logger['debug'](_0x0859('0x14'),_0x569ea,JSON[_0x0859('0xe')](_0x37da32));_0x139806(_0x37da32);})['catch'](function(_0x2deee6){logger['error'](_0x0859('0x14'),_0x2deee6[_0x0859('0x11')],_0x569ea);_0x202f78(_0x3a1ad7[_0x0859('0xf')](0x1f4,_0x2deee6[_0x0859('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x1a7b8b){var _0x1099ec=this;return new Promise(function(_0x1f4e16,_0x1225f0){return db[_0x0859('0x1e')][_0x0859('0x1f')](_0x1a7b8b[_0x0859('0x20')],{'raw':_0x1a7b8b[_0x0859('0x16')]?_0x1a7b8b['options'][_0x0859('0x17')]===undefined?!![]:![]:!![]})[_0x0859('0xc')](function(_0x279dd8){logger[_0x0859('0x12')](_0x0859('0x21'),_0x1a7b8b);logger['debug'](_0x0859('0x21'),_0x1a7b8b,JSON[_0x0859('0xe')](_0x279dd8));_0x1f4e16(_0x279dd8);})[_0x0859('0x13')](function(_0x5c5f44){logger[_0x0859('0xf')](_0x0859('0x21'),_0x5c5f44[_0x0859('0x11')],_0x1a7b8b);_0x1225f0(_0x1099ec[_0x0859('0xf')](0x1f4,_0x5c5f44[_0x0859('0x11')]));});});};exports[_0x0859('0x22')]=function(_0x233d11){var _0x10a61a=this;return new Promise(function(_0x1bb920,_0x2e3e0e){return db[_0x0859('0x1e')][_0x0859('0x23')](_0x233d11[_0x0859('0x20')],{'raw':_0x233d11[_0x0859('0x16')]?_0x233d11[_0x0859('0x16')][_0x0859('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x233d11[_0x0859('0x16')]?_0x233d11[_0x0859('0x16')][_0x0859('0x18')]||null:null,'attributes':_0x233d11[_0x0859('0x16')]?_0x233d11[_0x0859('0x16')][_0x0859('0x19')]||null:null,'limit':_0x233d11[_0x0859('0x16')]?_0x233d11[_0x0859('0x16')][_0x0859('0x1a')]||null:null})[_0x0859('0xc')](function(_0xb81577){logger[_0x0859('0x12')]('UpdateVoiceCallReport',_0x233d11);logger[_0x0859('0x24')]('UpdateVoiceCallReport',_0x233d11,JSON[_0x0859('0xe')](_0xb81577));_0x1bb920(_0xb81577);})[_0x0859('0x13')](function(_0x9ea88d){logger[_0x0859('0xf')](_0x0859('0x22'),_0x9ea88d['message'],_0x233d11);_0x2e3e0e(_0x10a61a['error'](0x1f4,_0x9ea88d[_0x0859('0x11')]));});});}; \ No newline at end of file +var _0xdb63=['catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x5265bf,_0x510fae){var _0x387b8e=function(_0x2df535){while(--_0x2df535){_0x5265bf['push'](_0x5265bf['shift']());}};_0x387b8e(++_0x510fae);}(_0xdb63,0x1f1));var _0x3db6=function(_0x5226a5,_0x148416){_0x5226a5=_0x5226a5-0x0;var _0x2b3fc2=_0xdb63[_0x5226a5];return _0x2b3fc2;};'use strict';var _=require(_0x3db6('0x0'));var util=require(_0x3db6('0x1'));var moment=require(_0x3db6('0x2'));var BPromise=require(_0x3db6('0x3'));var rs=require(_0x3db6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3db6('0x5'))['db'];var utils=require(_0x3db6('0x6'));var logger=require(_0x3db6('0x7'))(_0x3db6('0x8'));var config=require(_0x3db6('0x9'));var jayson=require(_0x3db6('0xa'));var client=jayson[_0x3db6('0xb')][_0x3db6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21a471,_0x540cc1,_0x4f7692){return new BPromise(function(_0x51ea21,_0x368515){return client[_0x3db6('0xd')](_0x21a471,_0x4f7692)[_0x3db6('0xe')](function(_0xbc546){logger[_0x3db6('0xf')](_0x3db6('0x10'),_0x540cc1,'request\x20sent');logger[_0x3db6('0x11')](_0x3db6('0x12'),_0x540cc1,_0x3db6('0x13'),JSON[_0x3db6('0x14')](_0xbc546));if(_0xbc546[_0x3db6('0x15')]){if(_0xbc546[_0x3db6('0x15')]['code']===0x1f4){logger[_0x3db6('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x540cc1,_0xbc546[_0x3db6('0x15')][_0x3db6('0x16')]);return _0x368515(_0xbc546[_0x3db6('0x15')][_0x3db6('0x16')]);}logger[_0x3db6('0x15')](_0x3db6('0x10'),_0x540cc1,_0xbc546['error'][_0x3db6('0x16')]);return _0x51ea21(_0xbc546[_0x3db6('0x15')][_0x3db6('0x16')]);}else{logger[_0x3db6('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x540cc1,_0x3db6('0x13'));_0x51ea21(_0xbc546['result'][_0x3db6('0x16')]);}})[_0x3db6('0x17')](function(_0x1f8efb){logger[_0x3db6('0x15')](_0x3db6('0x10'),_0x540cc1,_0x1f8efb);_0x368515(_0x1f8efb);});});}exports[_0x3db6('0x18')]=function(_0x10c70c){var _0x4952ad=this;return new Promise(function(_0x38df03,_0x1fcfaa){return db[_0x3db6('0x19')][_0x3db6('0x1a')]({'raw':_0x10c70c['options']?_0x10c70c[_0x3db6('0x1b')][_0x3db6('0x1c')]===undefined?!![]:![]:!![],'where':_0x10c70c[_0x3db6('0x1b')]?_0x10c70c[_0x3db6('0x1b')][_0x3db6('0x1d')]||null:null,'attributes':_0x10c70c[_0x3db6('0x1b')]?_0x10c70c[_0x3db6('0x1b')][_0x3db6('0x1e')]||null:null,'limit':_0x10c70c[_0x3db6('0x1b')]?_0x10c70c['options'][_0x3db6('0x1f')]||null:null,'include':_0x10c70c[_0x3db6('0x1b')]?_0x10c70c[_0x3db6('0x1b')][_0x3db6('0x20')]?_[_0x3db6('0x21')](_0x10c70c['options'][_0x3db6('0x20')],function(_0x57684b){return{'model':db[_0x57684b[_0x3db6('0x22')]],'as':_0x57684b['as'],'attributes':_0x57684b[_0x3db6('0x1e')],'include':_0x57684b[_0x3db6('0x20')]?_[_0x3db6('0x21')](_0x57684b[_0x3db6('0x20')],function(_0x3f7987){return{'model':db[_0x3f7987[_0x3db6('0x22')]],'as':_0x3f7987['as'],'attributes':_0x3f7987[_0x3db6('0x1e')],'include':_0x3f7987['include']?_[_0x3db6('0x21')](_0x3f7987[_0x3db6('0x20')],function(_0x5d4a6a){return{'model':db[_0x5d4a6a[_0x3db6('0x22')]],'as':_0x5d4a6a['as'],'attributes':_0x5d4a6a[_0x3db6('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30d99c){logger[_0x3db6('0xf')](_0x3db6('0x18'),_0x10c70c);logger[_0x3db6('0x11')](_0x3db6('0x18'),_0x10c70c,JSON[_0x3db6('0x14')](_0x30d99c));_0x38df03(_0x30d99c);})['catch'](function(_0x960cc7){logger[_0x3db6('0x15')](_0x3db6('0x18'),_0x960cc7['message'],_0x10c70c);_0x1fcfaa(_0x4952ad[_0x3db6('0x15')](0x1f4,_0x960cc7[_0x3db6('0x16')]));});});};exports[_0x3db6('0x23')]=function(_0x3e9591){var _0x440140=this;return new Promise(function(_0x271d0c,_0x173e87){return db[_0x3db6('0x19')][_0x3db6('0x24')](_0x3e9591[_0x3db6('0x25')],{'raw':_0x3e9591[_0x3db6('0x1b')]?_0x3e9591[_0x3db6('0x1b')][_0x3db6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x32417f){logger[_0x3db6('0xf')](_0x3db6('0x23'),_0x3e9591);logger[_0x3db6('0x11')](_0x3db6('0x23'),_0x3e9591,JSON['stringify'](_0x32417f));_0x271d0c(_0x32417f);})[_0x3db6('0x17')](function(_0x1a58c9){logger['error'](_0x3db6('0x23'),_0x1a58c9[_0x3db6('0x16')],_0x3e9591);_0x173e87(_0x440140[_0x3db6('0x15')](0x1f4,_0x1a58c9[_0x3db6('0x16')]));});});};exports[_0x3db6('0x26')]=function(_0x2a4d4f){var _0x16b411=this;return new Promise(function(_0xcdb4b9,_0x440953){return db['VoiceCallReport'][_0x3db6('0x27')](_0x2a4d4f['body'],{'raw':_0x2a4d4f[_0x3db6('0x1b')]?_0x2a4d4f[_0x3db6('0x1b')][_0x3db6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4d4f['options']?_0x2a4d4f[_0x3db6('0x1b')][_0x3db6('0x1d')]||null:null,'attributes':_0x2a4d4f[_0x3db6('0x1b')]?_0x2a4d4f['options'][_0x3db6('0x1e')]||null:null,'limit':_0x2a4d4f[_0x3db6('0x1b')]?_0x2a4d4f['options'][_0x3db6('0x1f')]||null:null})['then'](function(_0x97407b){logger[_0x3db6('0xf')](_0x3db6('0x26'),_0x2a4d4f);logger['debug'](_0x3db6('0x26'),_0x2a4d4f,JSON[_0x3db6('0x14')](_0x97407b));_0xcdb4b9(_0x97407b);})[_0x3db6('0x17')](function(_0xae6dac){logger[_0x3db6('0x15')](_0x3db6('0x26'),_0xae6dac[_0x3db6('0x16')],_0x2a4d4f);_0x440953(_0x16b411['error'](0x1f4,_0xae6dac[_0x3db6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ee8b75e..b8a2c43 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 _0x53f5=['create','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0x53f5,0x198));var _0x553f=function(_0x2de10a,_0x5bdac2){_0x2de10a=_0x2de10a-0x0;var _0x342dec=_0x53f5[_0x2de10a];return _0x342dec;};'use strict';var multer=require(_0x553f('0x0'));var util=require(_0x553f('0x1'));var path=require('path');var timeout=require(_0x553f('0x2'));var express=require(_0x553f('0x3'));var router=express['Router']();var auth=require(_0x553f('0x4'));var interaction=require(_0x553f('0x5'));var config=require(_0x553f('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x553f('0x7')]('/',auth[_0x553f('0x8')](),controller[_0x553f('0x9')]);router[_0x553f('0x7')](_0x553f('0xa'),auth[_0x553f('0x8')](),controller[_0x553f('0xb')]);router['post']('/',auth[_0x553f('0x8')](),controller[_0x553f('0xc')]);router['put']('/:id',auth[_0x553f('0x8')](),controller['update']);router[_0x553f('0xd')](_0x553f('0xa'),auth[_0x553f('0x8')](),controller['destroy']);module[_0x553f('0xe')]=router; \ No newline at end of file +var _0xe740=['delete','multer','path','connect-timeout','Router','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0xe740,0x14b));var _0x0e74=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe740[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x0e74('0x0'));var util=require('util');var path=require(_0x0e74('0x1'));var timeout=require(_0x0e74('0x2'));var express=require('express');var router=express[_0x0e74('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0e74('0x4'));var config=require('../../config/environment');var controller=require(_0x0e74('0x5'));router[_0x0e74('0x6')]('/',auth['isAuthenticated'](),controller[_0x0e74('0x7')]);router['get'](_0x0e74('0x8'),auth[_0x0e74('0x9')](),controller[_0x0e74('0xa')]);router[_0x0e74('0xb')]('/',auth['isAuthenticated'](),controller[_0x0e74('0xc')]);router[_0x0e74('0xd')](_0x0e74('0x8'),auth[_0x0e74('0x9')](),controller['update']);router[_0x0e74('0xe')]('/:id',auth[_0x0e74('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index d312a16..378c1e4 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 _0xd6b3=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x484e1c,_0xb18bed){var _0x481adc=function(_0x585f4e){while(--_0x585f4e){_0x484e1c['push'](_0x484e1c['shift']());}};_0x481adc(++_0xb18bed);}(_0xd6b3,0x168));var _0x3d6b=function(_0x251d99,_0x5b9a00){_0x251d99=_0x251d99-0x0;var _0x69bb8b=_0xd6b3[_0x251d99];return _0x69bb8b;};'use strict';var Sequelize=require(_0x3d6b('0x0'));module[_0x3d6b('0x1')]={'name':{'type':Sequelize[_0x3d6b('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x3d6b('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x404377){this[_0x3d6b('0x4')](_0x3d6b('0x5'),_0x404377?_0x404377[_0x3d6b('0x6')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x3d6b('0x7')](_0x3d6b('0x5'))[_0x3d6b('0x8')](''):[];}},'auth':{'type':Sequelize[_0x3d6b('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x3d6b('0x2')]},'record':{'type':Sequelize[_0x3d6b('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d6b('0x2')]}}; \ No newline at end of file +var _0x4995=['getDataValue','BOOLEAN','sequelize','STRING','name'];(function(_0x5325f4,_0x12af32){var _0x3ec9be=function(_0x379988){while(--_0x379988){_0x5325f4['push'](_0x5325f4['shift']());}};_0x3ec9be(++_0x12af32);}(_0x4995,0x15b));var _0x5499=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4995[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5499('0x0'));module['exports']={'name':{'type':Sequelize[_0x5499('0x1')]},'prefix':{'type':Sequelize[_0x5499('0x1')],'unique':_0x5499('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x5499('0x1')],'set':function(_0x1bc153){this['setDataValue']('options',_0x1bc153?_0x1bc153['join'](''):[]);},'get':function(){return this[_0x5499('0x3')]('options')?this[_0x5499('0x3')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x5499('0x4')],'defaultValue':![]},'password':{'type':Sequelize[_0x5499('0x1')]},'record':{'type':Sequelize[_0x5499('0x4')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5499('0x1')]},'description':{'type':Sequelize[_0x5499('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9c2731b..4efe36d 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 _0x2c13=['fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceChanSpy','includeAll','findAll','show','params','rawAttributes','length','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','userProfileId','autoAssociation','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index'];(function(_0x3a4dbe,_0x40b9b0){var _0xef8af1=function(_0x44e67a){while(--_0x44e67a){_0x3a4dbe['push'](_0x3a4dbe['shift']());}};_0xef8af1(++_0x40b9b0);}(_0x2c13,0x77));var _0x32c1=function(_0x4bedff,_0x30c036){_0x4bedff=_0x4bedff-0x0;var _0x107d64=_0x2c13[_0x4bedff];return _0x107d64;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32c1('0x1'));var jsonpatch=require(_0x32c1('0x2'));var rp=require(_0x32c1('0x3'));var moment=require(_0x32c1('0x4'));var BPromise=require(_0x32c1('0x5'));var Mustache=require(_0x32c1('0x6'));var util=require(_0x32c1('0x7'));var path=require(_0x32c1('0x8'));var sox=require(_0x32c1('0x9'));var csv=require(_0x32c1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x32c1('0xb'));var crypto=require('crypto');var jsforce=require(_0x32c1('0xc'));var deskjs=require(_0x32c1('0xd'));var toCsv=require(_0x32c1('0xa'));var querystring=require(_0x32c1('0xe'));var Papa=require(_0x32c1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x32c1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32c1('0x11'));var logger=require(_0x32c1('0x12'))(_0x32c1('0x13'));var utils=require(_0x32c1('0x14'));var config=require(_0x32c1('0x15'));var licenseUtil=require(_0x32c1('0x16'));var db=require(_0x32c1('0x17'))['db'];function respondWithStatusCode(_0x1089d7,_0x464c8b){_0x464c8b=_0x464c8b||0xcc;return function(_0x93002c){if(_0x93002c){return _0x1089d7[_0x32c1('0x18')](_0x464c8b);}return _0x1089d7['status'](_0x464c8b)[_0x32c1('0x19')]();};}function respondWithResult(_0x2b69cf,_0xcf81bd){_0xcf81bd=_0xcf81bd||0xc8;return function(_0xbd9552){if(_0xbd9552){return _0x2b69cf[_0x32c1('0x1a')](_0xcf81bd)[_0x32c1('0x1b')](_0xbd9552);}};}function respondWithFilteredResult(_0x48c8fa,_0x2aecda){return function(_0x5928ef){if(_0x5928ef){var _0x45b21f=_0x5928ef[_0x32c1('0x1c')],_0xce3c2c=_0x2aecda[_0x32c1('0x1d')],_0x4ef337=_0x2aecda[_0x32c1('0x1d')]+_0x2aecda[_0x32c1('0x1e')],_0x87e520;if(_0x4ef337>=_0x45b21f){_0x4ef337=_0x45b21f;_0x87e520=0xc8;}else{_0x87e520=0xce;}_0x48c8fa[_0x32c1('0x1a')](_0x87e520);return _0x48c8fa['set'](_0x32c1('0x1f'),_0xce3c2c+'-'+_0x4ef337+'/'+_0x45b21f)[_0x32c1('0x1b')](_0x5928ef);}return null;};}function patchUpdates(_0x3314ce){return function(_0x532b8e){try{jsonpatch[_0x32c1('0x20')](_0x532b8e,_0x3314ce,!![]);}catch(_0x34da93){return BPromise[_0x32c1('0x21')](_0x34da93);}return _0x532b8e[_0x32c1('0x22')]();};}function saveUpdates(_0xb1cd3f,_0x2d7607){return function(_0x143b72){if(_0x143b72){return _0x143b72['update'](_0xb1cd3f)[_0x32c1('0x23')](function(_0x48e2ae){return _0x48e2ae;});}return null;};}function removeEntity(_0x2517e3,_0x2ed437){return function(_0x2a5a9b){if(_0x2a5a9b){return _0x2a5a9b[_0x32c1('0x24')]()['then'](function(){var _0x154e47=_0x2a5a9b[_0x32c1('0x25')]({'plain':!![]});var _0x1a44a1='ChanSpies';return db[_0x32c1('0x26')][_0x32c1('0x24')]({'where':{'type':_0x1a44a1,'resourceId':_0x154e47['id']}})['then'](function(){return _0x2a5a9b;});})[_0x32c1('0x23')](function(){_0x2517e3[_0x32c1('0x1a')](0xcc)[_0x32c1('0x19')]();});}};}function handleEntityNotFound(_0x55dbd0,_0x23655d){return function(_0x238c02){if(!_0x238c02){_0x55dbd0[_0x32c1('0x18')](0x194);}return _0x238c02;};}function handleError(_0x910070,_0x2c9481){_0x2c9481=_0x2c9481||0x1f4;return function(_0x193d0e){logger[_0x32c1('0x27')](_0x193d0e[_0x32c1('0x28')]);if(_0x193d0e[_0x32c1('0x29')]){delete _0x193d0e[_0x32c1('0x29')];}_0x910070['status'](_0x2c9481)['send'](_0x193d0e);};}exports[_0x32c1('0x2a')]=function(_0x480b3b,_0x1c607e){var _0x5a18d1={},_0x176282={},_0x29e4b1={'count':0x0,'rows':[]};var _0x70ba64=_['map'](db['VoiceChanSpy']['rawAttributes'],function(_0x51419d){return{'name':_0x51419d[_0x32c1('0x2b')],'type':_0x51419d[_0x32c1('0x2c')][_0x32c1('0x2d')]};});_0x176282[_0x32c1('0x2e')]=_['map'](_0x70ba64,_0x32c1('0x29'));_0x176282['query']=_[_0x32c1('0x2f')](_0x480b3b[_0x32c1('0x30')]);_0x176282['filters']=_[_0x32c1('0x31')](_0x176282[_0x32c1('0x2e')],_0x176282[_0x32c1('0x30')]);_0x5a18d1[_0x32c1('0x32')]=_['intersection'](_0x176282['model'],qs[_0x32c1('0x33')](_0x480b3b[_0x32c1('0x30')][_0x32c1('0x33')]));_0x5a18d1[_0x32c1('0x32')]=_0x5a18d1['attributes']['length']?_0x5a18d1[_0x32c1('0x32')]:_0x176282[_0x32c1('0x2e')];if(!_0x480b3b[_0x32c1('0x30')][_0x32c1('0x34')](_0x32c1('0x35'))){_0x5a18d1[_0x32c1('0x1e')]=qs[_0x32c1('0x1e')](_0x480b3b[_0x32c1('0x30')]['limit']);_0x5a18d1[_0x32c1('0x1d')]=qs['offset'](_0x480b3b[_0x32c1('0x30')][_0x32c1('0x1d')]);}_0x5a18d1[_0x32c1('0x36')]=qs[_0x32c1('0x37')](_0x480b3b[_0x32c1('0x30')][_0x32c1('0x37')]);_0x5a18d1[_0x32c1('0x38')]=qs[_0x32c1('0x39')](_[_0x32c1('0x3a')](_0x480b3b['query'],_0x176282[_0x32c1('0x39')]),_0x70ba64);if(_0x480b3b[_0x32c1('0x30')]['filter']){_0x5a18d1[_0x32c1('0x38')]=_[_0x32c1('0x3b')](_0x5a18d1[_0x32c1('0x38')],{'$or':_['map'](_0x70ba64,function(_0x1ac6e3){if(_0x1ac6e3[_0x32c1('0x2c')]!=='VIRTUAL'){var _0x43d79f={};_0x43d79f[_0x1ac6e3['name']]={'$like':'%'+_0x480b3b[_0x32c1('0x30')][_0x32c1('0x3c')]+'%'};return _0x43d79f;}})});}_0x5a18d1=_[_0x32c1('0x3b')]({},_0x5a18d1,_0x480b3b[_0x32c1('0x3d')]);var _0x37ac40={'where':_0x5a18d1[_0x32c1('0x38')]};return db[_0x32c1('0x3e')][_0x32c1('0x1c')](_0x37ac40)[_0x32c1('0x23')](function(_0x164229){_0x29e4b1[_0x32c1('0x1c')]=_0x164229;if(_0x480b3b[_0x32c1('0x30')][_0x32c1('0x3f')]){_0x5a18d1['include']=[{'all':!![]}];}return db[_0x32c1('0x3e')][_0x32c1('0x40')](_0x5a18d1);})[_0x32c1('0x23')](function(_0x409970){_0x29e4b1['rows']=_0x409970;return _0x29e4b1;})[_0x32c1('0x23')](respondWithFilteredResult(_0x1c607e,_0x5a18d1))['catch'](handleError(_0x1c607e,null));};exports[_0x32c1('0x41')]=function(_0x723c22,_0x1bd57e){var _0x14e0db={'raw':![],'where':{'id':_0x723c22[_0x32c1('0x42')]['id']}},_0x267cfb={};_0x267cfb[_0x32c1('0x2e')]=_[_0x32c1('0x2f')](db[_0x32c1('0x3e')][_0x32c1('0x43')]);_0x267cfb[_0x32c1('0x30')]=_[_0x32c1('0x2f')](_0x723c22[_0x32c1('0x30')]);_0x267cfb['filters']=_[_0x32c1('0x31')](_0x267cfb[_0x32c1('0x2e')],_0x267cfb['query']);_0x14e0db['attributes']=_[_0x32c1('0x31')](_0x267cfb[_0x32c1('0x2e')],qs[_0x32c1('0x33')](_0x723c22[_0x32c1('0x30')][_0x32c1('0x33')]));_0x14e0db[_0x32c1('0x32')]=_0x14e0db[_0x32c1('0x32')][_0x32c1('0x44')]?_0x14e0db['attributes']:_0x267cfb['model'];if(_0x723c22[_0x32c1('0x30')][_0x32c1('0x3f')]){_0x14e0db[_0x32c1('0x45')]=[{'all':!![]}];}_0x14e0db=_[_0x32c1('0x3b')]({},_0x14e0db,_0x723c22['options']);return db[_0x32c1('0x3e')][_0x32c1('0x46')](_0x14e0db)['then'](handleEntityNotFound(_0x1bd57e,null))[_0x32c1('0x23')](respondWithResult(_0x1bd57e,null))[_0x32c1('0x47')](handleError(_0x1bd57e,null));};exports[_0x32c1('0x48')]=function(_0x6dba30,_0x486bbc){return db[_0x32c1('0x3e')]['create'](_0x6dba30[_0x32c1('0x49')],{})[_0x32c1('0x23')](function(_0x3e4fc2){var _0x46525c=_0x6dba30['user'][_0x32c1('0x25')]({'plain':!![]});if(!_0x46525c)throw new Error(_0x32c1('0x4a'));if(_0x46525c[_0x32c1('0x4b')]===_0x32c1('0x4c')){var _0x1ccc7c=_0x3e4fc2[_0x32c1('0x25')]({'plain':!![]});var _0x5d9c47=_0x32c1('0x4d');return db['UserProfileSection'][_0x32c1('0x46')]({'where':{'name':_0x5d9c47,'userProfileId':_0x46525c[_0x32c1('0x4e')]},'raw':!![]})[_0x32c1('0x23')](function(_0x52e999){if(_0x52e999&&_0x52e999[_0x32c1('0x4f')]===0x0){return db[_0x32c1('0x26')]['create']({'name':_0x1ccc7c[_0x32c1('0x29')],'resourceId':_0x1ccc7c['id'],'type':_0x52e999[_0x32c1('0x29')],'sectionId':_0x52e999['id']},{})['then'](function(){return _0x3e4fc2;});}else{return _0x3e4fc2;}})[_0x32c1('0x47')](function(_0x48f408){logger[_0x32c1('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48f408);throw _0x48f408;});}return _0x3e4fc2;})[_0x32c1('0x23')](respondWithResult(_0x486bbc,0xc9))[_0x32c1('0x47')](handleError(_0x486bbc,null));};exports[_0x32c1('0x50')]=function(_0xc9f393,_0x400a4c){if(_0xc9f393[_0x32c1('0x49')]['id']){delete _0xc9f393[_0x32c1('0x49')]['id'];}return db[_0x32c1('0x3e')][_0x32c1('0x46')]({'where':{'id':_0xc9f393[_0x32c1('0x42')]['id']}})[_0x32c1('0x23')](handleEntityNotFound(_0x400a4c,null))['then'](saveUpdates(_0xc9f393['body'],null))[_0x32c1('0x23')](respondWithResult(_0x400a4c,null))[_0x32c1('0x47')](handleError(_0x400a4c,null));};exports['destroy']=function(_0x38b5dd,_0x282927){return db['VoiceChanSpy']['find']({'where':{'id':_0x38b5dd[_0x32c1('0x42')]['id']}})[_0x32c1('0x23')](handleEntityNotFound(_0x282927,null))['then'](removeEntity(_0x282927,null))[_0x32c1('0x47')](handleError(_0x282927,null));}; \ No newline at end of file +var _0x3051=['map','VoiceChanSpy','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','type','VIRTUAL','filter','count','includeAll','findAll','rows','params','keys','include','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','limit','status','set','Content-Range','apply','save','update','get','UserProfileResource','destroy','then','sendStatus','error','stack','name','index'];(function(_0x447730,_0x151c13){var _0x2f8683=function(_0x2ccc74){while(--_0x2ccc74){_0x447730['push'](_0x447730['shift']());}};_0x2f8683(++_0x151c13);}(_0x3051,0xcd));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x1305('0x0'));var emlformat=require(_0x1305('0x1'));var rimraf=require(_0x1305('0x2'));var zipdir=require(_0x1305('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1305('0x4'));var moment=require('moment');var BPromise=require(_0x1305('0x5'));var Mustache=require(_0x1305('0x6'));var util=require(_0x1305('0x7'));var path=require('path');var sox=require(_0x1305('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1305('0x9'));var squel=require(_0x1305('0xa'));var crypto=require(_0x1305('0xb'));var jsforce=require(_0x1305('0xc'));var deskjs=require(_0x1305('0xd'));var toCsv=require(_0x1305('0xe'));var querystring=require('querystring');var Papa=require(_0x1305('0xf'));var Redis=require(_0x1305('0x10'));var authService=require(_0x1305('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1305('0x12'));var hardwareService=require(_0x1305('0x13'));var logger=require(_0x1305('0x14'))(_0x1305('0x15'));var utils=require(_0x1305('0x16'));var config=require(_0x1305('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1305('0x18'))['db'];function respondWithStatusCode(_0x34a17b,_0x4a051d){_0x4a051d=_0x4a051d||0xcc;return function(_0x176db1){if(_0x176db1){return _0x34a17b['sendStatus'](_0x4a051d);}return _0x34a17b['status'](_0x4a051d)[_0x1305('0x19')]();};}function respondWithResult(_0x12df8e,_0x598d69){_0x598d69=_0x598d69||0xc8;return function(_0x5b5bb4){if(_0x5b5bb4){return _0x12df8e['status'](_0x598d69)[_0x1305('0x1a')](_0x5b5bb4);}};}function respondWithFilteredResult(_0x4dbf84,_0x41a149){return function(_0x1fad5b){if(_0x1fad5b){var _0xa60050=_0x1fad5b['count'],_0xea1d53=_0x41a149['offset'],_0x845273=_0x41a149[_0x1305('0x1b')]+_0x41a149[_0x1305('0x1c')],_0xd7ccdc;if(_0x845273>=_0xa60050){_0x845273=_0xa60050;_0xd7ccdc=0xc8;}else{_0xd7ccdc=0xce;}_0x4dbf84[_0x1305('0x1d')](_0xd7ccdc);return _0x4dbf84[_0x1305('0x1e')](_0x1305('0x1f'),_0xea1d53+'-'+_0x845273+'/'+_0xa60050)[_0x1305('0x1a')](_0x1fad5b);}return null;};}function patchUpdates(_0x12d717){return function(_0x56b560){try{jsonpatch[_0x1305('0x20')](_0x56b560,_0x12d717,!![]);}catch(_0x1fdd30){return BPromise['reject'](_0x1fdd30);}return _0x56b560[_0x1305('0x21')]();};}function saveUpdates(_0x3e2276,_0x5c02f6){return function(_0x422992){if(_0x422992){return _0x422992[_0x1305('0x22')](_0x3e2276)['then'](function(_0x18e005){return _0x18e005;});}return null;};}function removeEntity(_0x2bf2a3,_0xed475c){return function(_0x53bfee){if(_0x53bfee){return _0x53bfee['destroy']()['then'](function(){var _0x37543e=_0x53bfee[_0x1305('0x23')]({'plain':!![]});var _0x4eb5d2='ChanSpies';return db[_0x1305('0x24')][_0x1305('0x25')]({'where':{'type':_0x4eb5d2,'resourceId':_0x37543e['id']}})[_0x1305('0x26')](function(){return _0x53bfee;});})[_0x1305('0x26')](function(){_0x2bf2a3['status'](0xcc)[_0x1305('0x19')]();});}};}function handleEntityNotFound(_0x50c7fb,_0x1580e6){return function(_0x3c369e){if(!_0x3c369e){_0x50c7fb[_0x1305('0x27')](0x194);}return _0x3c369e;};}function handleError(_0x1709b1,_0x55a786){_0x55a786=_0x55a786||0x1f4;return function(_0x19a42e){logger[_0x1305('0x28')](_0x19a42e[_0x1305('0x29')]);if(_0x19a42e[_0x1305('0x2a')]){delete _0x19a42e[_0x1305('0x2a')];}_0x1709b1[_0x1305('0x1d')](_0x55a786)['send'](_0x19a42e);};}exports[_0x1305('0x2b')]=function(_0x11831a,_0x3a9bbd){var _0x4fac24={},_0x29327f={},_0xd982a7={'count':0x0,'rows':[]};var _0x59d42e=_[_0x1305('0x2c')](db[_0x1305('0x2d')][_0x1305('0x2e')],function(_0x704237){return{'name':_0x704237[_0x1305('0x2f')],'type':_0x704237['type'][_0x1305('0x30')]};});_0x29327f[_0x1305('0x31')]=_[_0x1305('0x2c')](_0x59d42e,'name');_0x29327f['query']=_['keys'](_0x11831a['query']);_0x29327f[_0x1305('0x32')]=_[_0x1305('0x33')](_0x29327f[_0x1305('0x31')],_0x29327f[_0x1305('0x34')]);_0x4fac24[_0x1305('0x35')]=_[_0x1305('0x33')](_0x29327f[_0x1305('0x31')],qs[_0x1305('0x36')](_0x11831a[_0x1305('0x34')][_0x1305('0x36')]));_0x4fac24['attributes']=_0x4fac24[_0x1305('0x35')]['length']?_0x4fac24[_0x1305('0x35')]:_0x29327f['model'];if(!_0x11831a[_0x1305('0x34')][_0x1305('0x37')](_0x1305('0x38'))){_0x4fac24[_0x1305('0x1c')]=qs['limit'](_0x11831a[_0x1305('0x34')][_0x1305('0x1c')]);_0x4fac24[_0x1305('0x1b')]=qs[_0x1305('0x1b')](_0x11831a[_0x1305('0x34')]['offset']);}_0x4fac24['order']=qs['sort'](_0x11831a[_0x1305('0x34')][_0x1305('0x39')]);_0x4fac24['where']=qs[_0x1305('0x32')](_[_0x1305('0x3a')](_0x11831a[_0x1305('0x34')],_0x29327f[_0x1305('0x32')]),_0x59d42e);if(_0x11831a[_0x1305('0x34')]['filter']){_0x4fac24['where']=_[_0x1305('0x3b')](_0x4fac24[_0x1305('0x3c')],{'$or':_[_0x1305('0x2c')](_0x59d42e,function(_0x599282){if(_0x599282[_0x1305('0x3d')]!==_0x1305('0x3e')){var _0x4e4983={};_0x4e4983[_0x599282[_0x1305('0x2a')]]={'$like':'%'+_0x11831a['query'][_0x1305('0x3f')]+'%'};return _0x4e4983;}})});}_0x4fac24=_[_0x1305('0x3b')]({},_0x4fac24,_0x11831a['options']);var _0x1534b2={'where':_0x4fac24[_0x1305('0x3c')]};return db['VoiceChanSpy'][_0x1305('0x40')](_0x1534b2)['then'](function(_0x392b42){_0xd982a7[_0x1305('0x40')]=_0x392b42;if(_0x11831a[_0x1305('0x34')][_0x1305('0x41')]){_0x4fac24['include']=[{'all':!![]}];}return db[_0x1305('0x2d')][_0x1305('0x42')](_0x4fac24);})[_0x1305('0x26')](function(_0x219427){_0xd982a7[_0x1305('0x43')]=_0x219427;return _0xd982a7;})['then'](respondWithFilteredResult(_0x3a9bbd,_0x4fac24))['catch'](handleError(_0x3a9bbd,null));};exports['show']=function(_0x444ad3,_0x4bb03c){var _0x59d6ce={'raw':![],'where':{'id':_0x444ad3[_0x1305('0x44')]['id']}},_0x4fc514={};_0x4fc514[_0x1305('0x31')]=_[_0x1305('0x45')](db[_0x1305('0x2d')][_0x1305('0x2e')]);_0x4fc514[_0x1305('0x34')]=_[_0x1305('0x45')](_0x444ad3[_0x1305('0x34')]);_0x4fc514[_0x1305('0x32')]=_[_0x1305('0x33')](_0x4fc514[_0x1305('0x31')],_0x4fc514['query']);_0x59d6ce[_0x1305('0x35')]=_[_0x1305('0x33')](_0x4fc514[_0x1305('0x31')],qs[_0x1305('0x36')](_0x444ad3[_0x1305('0x34')][_0x1305('0x36')]));_0x59d6ce[_0x1305('0x35')]=_0x59d6ce[_0x1305('0x35')]['length']?_0x59d6ce[_0x1305('0x35')]:_0x4fc514[_0x1305('0x31')];if(_0x444ad3[_0x1305('0x34')]['includeAll']){_0x59d6ce[_0x1305('0x46')]=[{'all':!![]}];}_0x59d6ce=_[_0x1305('0x3b')]({},_0x59d6ce,_0x444ad3[_0x1305('0x47')]);return db[_0x1305('0x2d')][_0x1305('0x48')](_0x59d6ce)[_0x1305('0x26')](handleEntityNotFound(_0x4bb03c,null))[_0x1305('0x26')](respondWithResult(_0x4bb03c,null))[_0x1305('0x49')](handleError(_0x4bb03c,null));};exports[_0x1305('0x4a')]=function(_0x533001,_0x4a0736){return db[_0x1305('0x2d')][_0x1305('0x4a')](_0x533001['body'],{})[_0x1305('0x26')](function(_0xa32019){var _0x47ba21=_0x533001[_0x1305('0x4b')][_0x1305('0x23')]({'plain':!![]});if(!_0x47ba21)throw new Error(_0x1305('0x4c'));if(_0x47ba21[_0x1305('0x4d')]===_0x1305('0x4b')){var _0x4d86c6=_0xa32019[_0x1305('0x23')]({'plain':!![]});var _0x792f64=_0x1305('0x4e');return db['UserProfileSection'][_0x1305('0x48')]({'where':{'name':_0x792f64,'userProfileId':_0x47ba21[_0x1305('0x4f')]},'raw':!![]})[_0x1305('0x26')](function(_0x2127b5){if(_0x2127b5&&_0x2127b5[_0x1305('0x50')]===0x0){return db[_0x1305('0x24')][_0x1305('0x4a')]({'name':_0x4d86c6[_0x1305('0x2a')],'resourceId':_0x4d86c6['id'],'type':_0x2127b5[_0x1305('0x2a')],'sectionId':_0x2127b5['id']},{})['then'](function(){return _0xa32019;});}else{return _0xa32019;}})[_0x1305('0x49')](function(_0x42c895){logger[_0x1305('0x28')](_0x1305('0x51'),_0x42c895);throw _0x42c895;});}return _0xa32019;})[_0x1305('0x26')](respondWithResult(_0x4a0736,0xc9))[_0x1305('0x49')](handleError(_0x4a0736,null));};exports[_0x1305('0x22')]=function(_0x3f2e2d,_0x3fc4b1){if(_0x3f2e2d[_0x1305('0x52')]['id']){delete _0x3f2e2d[_0x1305('0x52')]['id'];}return db[_0x1305('0x2d')][_0x1305('0x48')]({'where':{'id':_0x3f2e2d[_0x1305('0x44')]['id']}})[_0x1305('0x26')](handleEntityNotFound(_0x3fc4b1,null))['then'](saveUpdates(_0x3f2e2d[_0x1305('0x52')],null))[_0x1305('0x26')](respondWithResult(_0x3fc4b1,null))['catch'](handleError(_0x3fc4b1,null));};exports[_0x1305('0x25')]=function(_0x29061e,_0x2c42c4){return db[_0x1305('0x2d')]['find']({'where':{'id':_0x29061e[_0x1305('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c42c4,null))[_0x1305('0x26')](removeEntity(_0x2c42c4,null))['catch'](handleError(_0x2c42c4,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 2dab4f5..a750665 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 _0x10dc=['define','bulkCreate','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','Set','CDR(type)=%s','MixMonitor','format','${UNIQUEID}.%s,a','auth','merge','password','SIP/%s,%s','name','options','record','StopMixMonitor','length','internal','concat','findAll','agent','then','catch','models'];(function(_0x133278,_0xa61d59){var _0x5d9f92=function(_0x13bbf9){while(--_0x13bbf9){_0x133278['push'](_0x133278['shift']());}};_0x5d9f92(++_0xa61d59);}(_0x10dc,0x13f));var _0xc10d=function(_0x277415,_0x38968b){_0x277415=_0x277415-0x0;var _0x376342=_0x10dc[_0x277415];return _0x376342;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var BPromise=require(_0xc10d('0x2'));var attributes=require(_0xc10d('0x3'));var getUserApplications=function(_0x5ec69e,_0x5dccb1,_0x504767){var _0x550206=0x1;var _0x3d82a3=[];var _0x263324={'context':_0x5dccb1[_0xc10d('0x4')]||_0xc10d('0x5'),'exten':util['format'](_0xc10d('0x6'),_0x5ec69e[_0xc10d('0x7')],_0x504767),'type':_0xc10d('0x8'),'isApp':![],'ChanSpyId':_0x5ec69e['id'],'UserId':_0x5dccb1['id']};_0x3d82a3[_0xc10d('0x9')](_['merge']({'app':_0xc10d('0xa'),'appdata':util['format'](_0xc10d('0xb'),'chanspy'),'priority':_0x550206++},_0x263324));if(_0x5ec69e['record']){_0x3d82a3[_0xc10d('0x9')](_['merge']({'app':_0xc10d('0xc'),'appdata':util[_0xc10d('0xd')](_0xc10d('0xe'),_0x5ec69e['recordingFormat']),'priority':_0x550206++},_0x263324));}if(_0x5ec69e[_0xc10d('0xf')]){_0x3d82a3[_0xc10d('0x9')](_[_0xc10d('0x10')]({'app':'Authenticate','appdata':_0x5ec69e[_0xc10d('0x11')],'priority':_0x550206++},_0x263324));}_0x3d82a3[_0xc10d('0x9')](_[_0xc10d('0x10')]({'app':'ChanSpy','appdata':util[_0xc10d('0xd')](_0xc10d('0x12'),_0x5dccb1[_0xc10d('0x13')],_0x5ec69e[_0xc10d('0x14')]?_0x5ec69e['options']['join'](''):''),'priority':_0x550206++},_0x263324));if(_0x5ec69e[_0xc10d('0x15')]){_0x3d82a3[_0xc10d('0x9')](_[_0xc10d('0x10')]({'app':_0xc10d('0x16'),'priority':_0x550206++},_0x263324));}return _0x3d82a3;};var getChanSpyApplications=function(_0x3ebfe4,_0x43b562){var _0x174f48=[];for(var _0x1bfa30=0x0,_0xd343b=0x1;_0x1bfa30<_0x43b562[_0xc10d('0x17')];_0x1bfa30++,_0xd343b=0x1){_0x174f48=_0x174f48['concat'](getUserApplications(_0x3ebfe4,_0x43b562[_0x1bfa30],_0x43b562[_0x1bfa30][_0xc10d('0x18')]));if(_0x43b562[_0x1bfa30][_0xc10d('0x18')]!=_0x43b562[_0x1bfa30][_0xc10d('0x13')]){_0x174f48=_0x174f48[_0xc10d('0x19')](getUserApplications(_0x3ebfe4,_0x43b562[_0x1bfa30],_0x43b562[_0x1bfa30]['name']));}}return _0x174f48;};var getChanSpyPromise=function(_0x161e30,_0x5a6995){return new BPromise(function(_0xe3020f,_0xcb88c6){return _0x161e30['User'][_0xc10d('0x1a')]({'attributes':['id',_0xc10d('0x13'),_0xc10d('0x18')],'where':{'role':_0xc10d('0x1b'),'chanspy':!![]},'raw':!![]})[_0xc10d('0x1c')](function(_0x91bcdc){if(_0x91bcdc){return _0xe3020f(getChanSpyApplications(_0x5a6995,_0x91bcdc));}return _0xe3020f([]);})[_0xc10d('0x1d')](function(_0x13b0f8){_0xcb88c6(_0x13b0f8);});});};module['exports']=function(_0x4616b2,_0x3ccdd5){var _0x40ead5=_0x4616b2[_0xc10d('0x1e')];return _0x4616b2[_0xc10d('0x1f')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x428a57,_0x4106d9,_0x2d39cc){return getChanSpyPromise(_0x40ead5,_0x428a57)[_0xc10d('0x1c')](function(_0x1a7d9a){if(_0x1a7d9a&&_0x1a7d9a['length']){return _0x40ead5['VoiceExtension'][_0xc10d('0x20')](_0x1a7d9a);}})['then'](function(){_0x2d39cc();})[_0xc10d('0x1d')](function(_0x48d054){_0x2d39cc(_0x48d054);});},'afterUpdate':function(_0x188af5,_0xa7b67f,_0x239c5a){return _0x40ead5[_0xc10d('0x21')]['destroy']({'where':{'ChanSpyId':_0x188af5['id']}})['then'](function(){return getChanSpyPromise(_0x40ead5,_0x188af5);})['then'](function(_0x3d9d65){if(_0x3d9d65&&_0x3d9d65[_0xc10d('0x17')]){return _0x40ead5[_0xc10d('0x21')][_0xc10d('0x20')](_0x3d9d65);}})[_0xc10d('0x1c')](function(){_0x239c5a();})[_0xc10d('0x1d')](function(_0x593279){_0x239c5a(_0x593279);});},'afterDestroy':function(_0x521ee6,_0xb73c03,_0x292460){return _0x40ead5['VoiceExtension'][_0xc10d('0x22')]({'where':{'ChanSpyId':_0x521ee6['id']}})[_0xc10d('0x1c')](function(){_0x292460();})[_0xc10d('0x1d')](function(_0x5774d0){_0x292460(_0x5774d0);});}}});}; \ No newline at end of file +var _0x5c58=['auth','Authenticate','ChanSpy','SIP/%s,%s','options','join','record','StopMixMonitor','length','concat','internal','name','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','util','bluebird','format','prefix','Set','chanspy','push','merge','MixMonitor','recordingFormat'];(function(_0x924190,_0x2e82dd){var _0x436643=function(_0x3d32c8){while(--_0x3d32c8){_0x924190['push'](_0x924190['shift']());}};_0x436643(++_0x2e82dd);}(_0x5c58,0x154));var _0x85c5=function(_0x583a96,_0x1f4809){_0x583a96=_0x583a96-0x0;var _0x5222ea=_0x5c58[_0x583a96];return _0x5222ea;};'use strict';var _=require('lodash');var util=require(_0x85c5('0x0'));var BPromise=require(_0x85c5('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5b75be,_0x782ec6,_0x419805){var _0x369229=0x1;var _0x5a3459=[];var _0x3198fa={'context':_0x782ec6['context']||'from-sip','exten':util[_0x85c5('0x2')]('%s%s',_0x5b75be[_0x85c5('0x3')],_0x419805),'type':'system','isApp':![],'ChanSpyId':_0x5b75be['id'],'UserId':_0x782ec6['id']};_0x5a3459['push'](_['merge']({'app':_0x85c5('0x4'),'appdata':util[_0x85c5('0x2')]('CDR(type)=%s',_0x85c5('0x5')),'priority':_0x369229++},_0x3198fa));if(_0x5b75be['record']){_0x5a3459[_0x85c5('0x6')](_[_0x85c5('0x7')]({'app':_0x85c5('0x8'),'appdata':util[_0x85c5('0x2')]('${UNIQUEID}.%s,a',_0x5b75be[_0x85c5('0x9')]),'priority':_0x369229++},_0x3198fa));}if(_0x5b75be[_0x85c5('0xa')]){_0x5a3459[_0x85c5('0x6')](_[_0x85c5('0x7')]({'app':_0x85c5('0xb'),'appdata':_0x5b75be['password'],'priority':_0x369229++},_0x3198fa));}_0x5a3459[_0x85c5('0x6')](_[_0x85c5('0x7')]({'app':_0x85c5('0xc'),'appdata':util[_0x85c5('0x2')](_0x85c5('0xd'),_0x782ec6['name'],_0x5b75be[_0x85c5('0xe')]?_0x5b75be['options'][_0x85c5('0xf')](''):''),'priority':_0x369229++},_0x3198fa));if(_0x5b75be[_0x85c5('0x10')]){_0x5a3459['push'](_[_0x85c5('0x7')]({'app':_0x85c5('0x11'),'priority':_0x369229++},_0x3198fa));}return _0x5a3459;};var getChanSpyApplications=function(_0x4d4b4e,_0x542622){var _0x1bfd11=[];for(var _0x506756=0x0,_0x1bd95a=0x1;_0x506756<_0x542622[_0x85c5('0x12')];_0x506756++,_0x1bd95a=0x1){_0x1bfd11=_0x1bfd11[_0x85c5('0x13')](getUserApplications(_0x4d4b4e,_0x542622[_0x506756],_0x542622[_0x506756][_0x85c5('0x14')]));if(_0x542622[_0x506756]['internal']!=_0x542622[_0x506756][_0x85c5('0x15')]){_0x1bfd11=_0x1bfd11[_0x85c5('0x13')](getUserApplications(_0x4d4b4e,_0x542622[_0x506756],_0x542622[_0x506756][_0x85c5('0x15')]));}}return _0x1bfd11;};var getChanSpyPromise=function(_0x103025,_0x468753){return new BPromise(function(_0x196f57,_0x57e87e){return _0x103025[_0x85c5('0x16')][_0x85c5('0x17')]({'attributes':['id',_0x85c5('0x15'),'internal'],'where':{'role':_0x85c5('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1f67fb){if(_0x1f67fb){return _0x196f57(getChanSpyApplications(_0x468753,_0x1f67fb));}return _0x196f57([]);})[_0x85c5('0x19')](function(_0x2c43a8){_0x57e87e(_0x2c43a8);});});};module[_0x85c5('0x1a')]=function(_0x1a58c8,_0x5a3dc5){var _0x5639d8=_0x1a58c8[_0x85c5('0x1b')];return _0x1a58c8[_0x85c5('0x1c')](_0x85c5('0x1d'),attributes,{'tableName':_0x85c5('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x558276,_0x296613,_0xc62b2){return getChanSpyPromise(_0x5639d8,_0x558276)[_0x85c5('0x1f')](function(_0x19fb1b){if(_0x19fb1b&&_0x19fb1b[_0x85c5('0x12')]){return _0x5639d8[_0x85c5('0x20')][_0x85c5('0x21')](_0x19fb1b);}})['then'](function(){_0xc62b2();})['catch'](function(_0x3fa2db){_0xc62b2(_0x3fa2db);});},'afterUpdate':function(_0x428855,_0xe42bd4,_0x13465a){return _0x5639d8[_0x85c5('0x20')][_0x85c5('0x22')]({'where':{'ChanSpyId':_0x428855['id']}})[_0x85c5('0x1f')](function(){return getChanSpyPromise(_0x5639d8,_0x428855);})[_0x85c5('0x1f')](function(_0x10f65b){if(_0x10f65b&&_0x10f65b[_0x85c5('0x12')]){return _0x5639d8['VoiceExtension'][_0x85c5('0x21')](_0x10f65b);}})['then'](function(){_0x13465a();})['catch'](function(_0x2ba1a6){_0x13465a(_0x2ba1a6);});},'afterDestroy':function(_0x3697ea,_0x2ac686,_0xa9b422){return _0x5639d8[_0x85c5('0x20')]['destroy']({'where':{'ChanSpyId':_0x3697ea['id']}})[_0x85c5('0x1f')](function(){_0xa9b422();})[_0x85c5('0x19')](function(_0x1108ce){_0xa9b422(_0x1108ce);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index fa645b4..6157830 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 _0xf5e8=['then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x25ac5e,_0x19a672){var _0x41be74=function(_0x478d8b){while(--_0x478d8b){_0x25ac5e['push'](_0x25ac5e['shift']());}};_0x41be74(++_0x19a672);}(_0xf5e8,0xfc));var _0x8f5e=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xf5e8[_0x36d203];return _0x2f9e62;};'use strict';var _=require(_0x8f5e('0x0'));var util=require(_0x8f5e('0x1'));var moment=require('moment');var BPromise=require(_0x8f5e('0x2'));var rs=require(_0x8f5e('0x3'));var fs=require('fs');var Redis=require(_0x8f5e('0x4'));var db=require(_0x8f5e('0x5'))['db'];var utils=require(_0x8f5e('0x6'));var logger=require('../../config/logger')(_0x8f5e('0x7'));var config=require(_0x8f5e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f5e('0x9')][_0x8f5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6ee5,_0x3d3687,_0x846c22){return new BPromise(function(_0x5072a7,_0x4da323){return client[_0x8f5e('0xb')](_0x1f6ee5,_0x846c22)[_0x8f5e('0xc')](function(_0x5ef6e9){logger[_0x8f5e('0xd')](_0x8f5e('0xe'),_0x3d3687,_0x8f5e('0xf'));logger[_0x8f5e('0x10')](_0x8f5e('0x11'),_0x3d3687,_0x8f5e('0xf'),JSON[_0x8f5e('0x12')](_0x5ef6e9));if(_0x5ef6e9[_0x8f5e('0x13')]){if(_0x5ef6e9[_0x8f5e('0x13')][_0x8f5e('0x14')]===0x1f4){logger['error'](_0x8f5e('0xe'),_0x3d3687,_0x5ef6e9['error'][_0x8f5e('0x15')]);return _0x4da323(_0x5ef6e9['error'][_0x8f5e('0x15')]);}logger[_0x8f5e('0x13')](_0x8f5e('0xe'),_0x3d3687,_0x5ef6e9[_0x8f5e('0x13')][_0x8f5e('0x15')]);return _0x5072a7(_0x5ef6e9[_0x8f5e('0x13')][_0x8f5e('0x15')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x3d3687,_0x8f5e('0xf'));_0x5072a7(_0x5ef6e9['result'][_0x8f5e('0x15')]);}})['catch'](function(_0x1af375){logger[_0x8f5e('0x13')](_0x8f5e('0xe'),_0x3d3687,_0x1af375);_0x4da323(_0x1af375);});});} \ No newline at end of file +var _0xff31=['rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0xff31,0x1f1));var _0x1ff3=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xff31[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x1ff3('0x0'));var util=require(_0x1ff3('0x1'));var moment=require('moment');var BPromise=require(_0x1ff3('0x2'));var rs=require(_0x1ff3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ff3('0x4'))['db'];var utils=require(_0x1ff3('0x5'));var logger=require(_0x1ff3('0x6'))(_0x1ff3('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ff3('0x8'));var client=jayson[_0x1ff3('0x9')][_0x1ff3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34e790,_0x489b80,_0x6fdd2e){return new BPromise(function(_0x253836,_0x4310c2){return client[_0x1ff3('0xb')](_0x34e790,_0x6fdd2e)['then'](function(_0x466865){logger[_0x1ff3('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x489b80,_0x1ff3('0xd'));logger[_0x1ff3('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x489b80,_0x1ff3('0xd'),JSON[_0x1ff3('0xf')](_0x466865));if(_0x466865[_0x1ff3('0x10')]){if(_0x466865[_0x1ff3('0x10')][_0x1ff3('0x11')]===0x1f4){logger[_0x1ff3('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x489b80,_0x466865[_0x1ff3('0x10')][_0x1ff3('0x12')]);return _0x4310c2(_0x466865[_0x1ff3('0x10')][_0x1ff3('0x12')]);}logger['error'](_0x1ff3('0x13'),_0x489b80,_0x466865[_0x1ff3('0x10')]['message']);return _0x253836(_0x466865['error']['message']);}else{logger[_0x1ff3('0xc')](_0x1ff3('0x13'),_0x489b80,_0x1ff3('0xd'));_0x253836(_0x466865['result'][_0x1ff3('0x12')]);}})[_0x1ff3('0x14')](function(_0x457ee3){logger['error'](_0x1ff3('0x13'),_0x489b80,_0x457ee3);_0x4310c2(_0x457ee3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6192b2b..f6a6b3e 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 _0x764e=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util'];(function(_0x377810,_0x213126){var _0x495e12=function(_0x5392ae){while(--_0x5392ae){_0x377810['push'](_0x377810['shift']());}};_0x495e12(++_0x213126);}(_0x764e,0x1ed));var _0xe764=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x764e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe764('0x0'));var path=require(_0xe764('0x1'));var timeout=require(_0xe764('0x2'));var express=require(_0xe764('0x3'));var router=express[_0xe764('0x4')]();var auth=require(_0xe764('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe764('0x6'));var controller=require(_0xe764('0x7'));router[_0xe764('0x8')]('/',auth[_0xe764('0x9')](),controller[_0xe764('0xa')]);router[_0xe764('0x8')](_0xe764('0xb'),auth[_0xe764('0x9')](),controller[_0xe764('0xc')]);router[_0xe764('0xd')]('/',auth[_0xe764('0x9')](),controller[_0xe764('0xe')]);router['put']('/:id',auth[_0xe764('0x9')](),controller[_0xe764('0xf')]);router[_0xe764('0x10')](_0xe764('0xb'),auth[_0xe764('0x9')](),controller[_0xe764('0x11')]);module[_0xe764('0x12')]=router; \ No newline at end of file +var _0xf2cd=['delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','update'];(function(_0x10f981,_0x24824c){var _0x299ee8=function(_0x7d91ec){while(--_0x7d91ec){_0x10f981['push'](_0x10f981['shift']());}};_0x299ee8(++_0x24824c);}(_0xf2cd,0x102));var _0xdf2c=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xf2cd[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require('multer');var util=require(_0xdf2c('0x0'));var path=require(_0xdf2c('0x1'));var timeout=require(_0xdf2c('0x2'));var express=require('express');var router=express[_0xdf2c('0x3')]();var auth=require(_0xdf2c('0x4'));var interaction=require(_0xdf2c('0x5'));var config=require(_0xdf2c('0x6'));var controller=require('./voiceContext.controller');router[_0xdf2c('0x7')]('/',auth[_0xdf2c('0x8')](),controller[_0xdf2c('0x9')]);router[_0xdf2c('0x7')]('/:id',auth[_0xdf2c('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdf2c('0xa')]);router[_0xdf2c('0xb')](_0xdf2c('0xc'),auth[_0xdf2c('0x8')](),controller[_0xdf2c('0xd')]);router[_0xdf2c('0xe')](_0xdf2c('0xc'),auth[_0xdf2c('0x8')](),controller['destroy']);module[_0xdf2c('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8618f7f..ba3838a 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x3de680,_0x15e09f){var _0x31efa5=function(_0x2e9799){while(--_0x2e9799){_0x3de680['push'](_0x3de680['shift']());}};_0x31efa5(++_0x15e09f);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x18b9ed,_0x202956){var _0x930a87=function(_0x984cfc){while(--_0x984cfc){_0x18b9ed['push'](_0x18b9ed['shift']());}};_0x930a87(++_0x202956);}(_0x3e74,0x175));var _0x43e7=function(_0x443b61,_0x59be04){_0x443b61=_0x443b61-0x0;var _0x3f33a0=_0x3e74[_0x443b61];return _0x3f33a0;};'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 83ff15c..b91a28f 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 _0x18e0=['message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','pick','merge','type','filter','options','include','findAll','params','includeAll','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18e0,0xa2));var _0x018e=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x18e0[_0xe73080];return _0x12cbc4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x018e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x018e('0x1'));var jsonpatch=require(_0x018e('0x2'));var rp=require(_0x018e('0x3'));var moment=require('moment');var BPromise=require(_0x018e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x018e('0x5'));var sox=require(_0x018e('0x6'));var csv=require(_0x018e('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x018e('0x8'));var crypto=require(_0x018e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x018e('0xa'));var toCsv=require(_0x018e('0x7'));var querystring=require(_0x018e('0xb'));var Papa=require(_0x018e('0xc'));var Redis=require(_0x018e('0xd'));var authService=require(_0x018e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x018e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x018e('0x10'));var config=require(_0x018e('0x11'));var licenseUtil=require(_0x018e('0x12'));var db=require(_0x018e('0x13'))['db'];var jayson=require(_0x018e('0x14'));var client=jayson[_0x018e('0x15')][_0x018e('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x23d2e7,_0x39898a,_0x52e2fd,_0xec531a){return new BPromise(function(_0x3b1e5e,_0x2d6aa0){var _0x423f58=_0xec531a||client;return _0x423f58[_0x018e('0x17')](_0x23d2e7,_0x52e2fd)['then'](function(_0x275c21){logger[_0x018e('0x18')](_0x018e('0x19'),_0x39898a,_0x018e('0x1a'));logger['debug'](_0x018e('0x1b'),_0x39898a,_0x018e('0x1a'),JSON['stringify'](_0x275c21));if(_0x275c21[_0x018e('0x1c')]){if(_0x275c21[_0x018e('0x1c')][_0x018e('0x1d')]===0x1f4){logger[_0x018e('0x1c')](_0x018e('0x19'),_0x39898a,_0x275c21['error'][_0x018e('0x1e')]);return _0x2d6aa0(_0x275c21[_0x018e('0x1c')][_0x018e('0x1e')]);}logger[_0x018e('0x1c')](_0x018e('0x19'),_0x39898a,_0x275c21[_0x018e('0x1c')][_0x018e('0x1e')]);return _0x3b1e5e(_0x275c21['error'][_0x018e('0x1e')]);}else{logger[_0x018e('0x18')](_0x018e('0x19'),_0x39898a,_0x018e('0x1a'));_0x3b1e5e(_0x275c21[_0x018e('0x1f')]['message']);}})['catch'](function(_0x74dd70){logger[_0x018e('0x1c')](_0x018e('0x19'),_0x39898a,_0x74dd70);_0x2d6aa0(_0x74dd70);});});}function respondWithStatusCode(_0x1e3106,_0x2ef801){_0x2ef801=_0x2ef801||0xcc;return function(_0x198b0b){if(_0x198b0b){return _0x1e3106[_0x018e('0x20')](_0x2ef801);}return _0x1e3106[_0x018e('0x21')](_0x2ef801)[_0x018e('0x22')]();};}function respondWithResult(_0x1d0baa,_0x35f9a3){_0x35f9a3=_0x35f9a3||0xc8;return function(_0x7596f4){if(_0x7596f4){return _0x1d0baa['status'](_0x35f9a3)[_0x018e('0x23')](_0x7596f4);}};}function respondWithFilteredResult(_0x289931,_0x176822){return function(_0x344e2b){if(_0x344e2b){var _0x2167e6=_0x344e2b[_0x018e('0x24')],_0x184990=_0x176822[_0x018e('0x25')],_0x407fda=_0x176822['offset']+_0x176822[_0x018e('0x26')],_0x3724ed;if(_0x407fda>=_0x2167e6){_0x407fda=_0x2167e6;_0x3724ed=0xc8;}else{_0x3724ed=0xce;}_0x289931[_0x018e('0x21')](_0x3724ed);return _0x289931['set'](_0x018e('0x27'),_0x184990+'-'+_0x407fda+'/'+_0x2167e6)[_0x018e('0x23')](_0x344e2b);}return null;};}function patchUpdates(_0x471e30){return function(_0x2836b1){try{jsonpatch[_0x018e('0x28')](_0x2836b1,_0x471e30,!![]);}catch(_0x42da91){return BPromise['reject'](_0x42da91);}return _0x2836b1[_0x018e('0x29')]();};}function saveUpdates(_0x1e35d9,_0x5903d6){return function(_0x12a7e5){if(_0x12a7e5){return _0x12a7e5[_0x018e('0x2a')](_0x1e35d9)[_0x018e('0x2b')](function(_0xfc64dd){return _0xfc64dd;});}return null;};}function removeEntity(_0x2e160d,_0x4e23ef){return function(_0xafd399){if(_0xafd399){return _0xafd399[_0x018e('0x2c')]()[_0x018e('0x2b')](function(){var _0x502763=_0xafd399[_0x018e('0x2d')]({'plain':!![]});var _0x4d0ed8=_0x018e('0x2e');return db[_0x018e('0x2f')]['destroy']({'where':{'type':_0x4d0ed8,'resourceId':_0x502763['id']}})['then'](function(){return _0xafd399;});})[_0x018e('0x2b')](function(){_0x2e160d[_0x018e('0x21')](0xcc)[_0x018e('0x22')]();});}};}function handleEntityNotFound(_0x37f8f6,_0x3b52f7){return function(_0x4a5cca){if(!_0x4a5cca){_0x37f8f6[_0x018e('0x20')](0x194);}return _0x4a5cca;};}function handleError(_0x39d210,_0x450ba5){_0x450ba5=_0x450ba5||0x1f4;return function(_0x55dbda){logger['error'](_0x55dbda[_0x018e('0x30')]);if(_0x55dbda[_0x018e('0x31')]){delete _0x55dbda[_0x018e('0x31')];}_0x39d210[_0x018e('0x21')](_0x450ba5)[_0x018e('0x32')](_0x55dbda);};}exports[_0x018e('0x33')]=function(_0x581a9e,_0x158f8d){var _0x1f3e7e={},_0x4fd059={},_0x4cb785={'count':0x0,'rows':[]};var _0x5c34c9=_[_0x018e('0x34')](db[_0x018e('0x35')][_0x018e('0x36')],function(_0x1705b7){return{'name':_0x1705b7[_0x018e('0x37')],'type':_0x1705b7['type'][_0x018e('0x38')]};});_0x4fd059['model']=_[_0x018e('0x34')](_0x5c34c9,_0x018e('0x31'));_0x4fd059[_0x018e('0x39')]=_[_0x018e('0x3a')](_0x581a9e['query']);_0x4fd059[_0x018e('0x3b')]=_[_0x018e('0x3c')](_0x4fd059['model'],_0x4fd059['query']);_0x1f3e7e[_0x018e('0x3d')]=_['intersection'](_0x4fd059[_0x018e('0x3e')],qs[_0x018e('0x3f')](_0x581a9e['query'][_0x018e('0x3f')]));_0x1f3e7e[_0x018e('0x3d')]=_0x1f3e7e[_0x018e('0x3d')][_0x018e('0x40')]?_0x1f3e7e[_0x018e('0x3d')]:_0x4fd059[_0x018e('0x3e')];if(!_0x581a9e[_0x018e('0x39')][_0x018e('0x41')]('nolimit')){_0x1f3e7e[_0x018e('0x26')]=qs[_0x018e('0x26')](_0x581a9e['query'][_0x018e('0x26')]);_0x1f3e7e[_0x018e('0x25')]=qs[_0x018e('0x25')](_0x581a9e[_0x018e('0x39')][_0x018e('0x25')]);}_0x1f3e7e['order']=qs[_0x018e('0x42')](_0x581a9e['query'][_0x018e('0x42')]);_0x1f3e7e[_0x018e('0x43')]=qs[_0x018e('0x3b')](_[_0x018e('0x44')](_0x581a9e['query'],_0x4fd059[_0x018e('0x3b')]),_0x5c34c9);if(_0x581a9e[_0x018e('0x39')]['filter']){_0x1f3e7e[_0x018e('0x43')]=_[_0x018e('0x45')](_0x1f3e7e[_0x018e('0x43')],{'$or':_[_0x018e('0x34')](_0x5c34c9,function(_0x17a0ae){if(_0x17a0ae[_0x018e('0x46')]!=='VIRTUAL'){var _0x292e32={};_0x292e32[_0x17a0ae[_0x018e('0x31')]]={'$like':'%'+_0x581a9e['query'][_0x018e('0x47')]+'%'};return _0x292e32;}})});}_0x1f3e7e=_[_0x018e('0x45')]({},_0x1f3e7e,_0x581a9e[_0x018e('0x48')]);var _0x417829={'where':_0x1f3e7e[_0x018e('0x43')]};return db[_0x018e('0x35')][_0x018e('0x24')](_0x417829)[_0x018e('0x2b')](function(_0x1f0f3b){_0x4cb785[_0x018e('0x24')]=_0x1f0f3b;if(_0x581a9e[_0x018e('0x39')]['includeAll']){_0x1f3e7e[_0x018e('0x49')]=[{'all':!![]}];}return db['VoiceContext'][_0x018e('0x4a')](_0x1f3e7e);})[_0x018e('0x2b')](function(_0x530fd2){_0x4cb785['rows']=_0x530fd2;return _0x4cb785;})[_0x018e('0x2b')](respondWithFilteredResult(_0x158f8d,_0x1f3e7e))['catch'](handleError(_0x158f8d,null));};exports['show']=function(_0x4f1df6,_0x3e26b1){var _0x16e8b0={'raw':![],'where':{'id':_0x4f1df6[_0x018e('0x4b')]['id']}},_0x22f1d4={};_0x22f1d4['model']=_[_0x018e('0x3a')](db[_0x018e('0x35')][_0x018e('0x36')]);_0x22f1d4[_0x018e('0x39')]=_[_0x018e('0x3a')](_0x4f1df6[_0x018e('0x39')]);_0x22f1d4[_0x018e('0x3b')]=_[_0x018e('0x3c')](_0x22f1d4['model'],_0x22f1d4[_0x018e('0x39')]);_0x16e8b0[_0x018e('0x3d')]=_[_0x018e('0x3c')](_0x22f1d4[_0x018e('0x3e')],qs['fields'](_0x4f1df6[_0x018e('0x39')][_0x018e('0x3f')]));_0x16e8b0[_0x018e('0x3d')]=_0x16e8b0['attributes'][_0x018e('0x40')]?_0x16e8b0[_0x018e('0x3d')]:_0x22f1d4['model'];if(_0x4f1df6[_0x018e('0x39')][_0x018e('0x4c')]){_0x16e8b0[_0x018e('0x49')]=[{'all':!![]}];}_0x16e8b0=_[_0x018e('0x45')]({},_0x16e8b0,_0x4f1df6[_0x018e('0x48')]);return db[_0x018e('0x35')]['find'](_0x16e8b0)['then'](handleEntityNotFound(_0x3e26b1,null))[_0x018e('0x2b')](respondWithResult(_0x3e26b1,null))[_0x018e('0x4d')](handleError(_0x3e26b1,null));};exports[_0x018e('0x4e')]=function(_0x53439a,_0x45bdc3,_0x586dcc){var _0x573013;return db[_0x018e('0x35')][_0x018e('0x4e')](_0x53439a[_0x018e('0x4f')],{'raw':!![]})['then'](function(_0x3e238e){_0x573013=_0x3e238e;return db[_0x018e('0x35')][_0x018e('0x4a')]({'raw':!![]});})[_0x018e('0x2b')](function(_0x1ef430){var _0x59e5f3=fs[_0x018e('0x50')](path[_0x018e('0x51')](config[_0x018e('0x52')],_0x018e('0x53')),_0x018e('0x54'));var _0x264d26=ejs[_0x018e('0x55')](_0x59e5f3,{'contexts':_0x1ef430||[]});fs[_0x018e('0x56')](_0x018e('0x57'),_0x264d26);})[_0x018e('0x2b')](function(){return respondWithRpcPromise(_0x018e('0x58'),_0x018e('0x4e'),{'module':_0x018e('0x59')});})['then'](function(){var _0x372394=_0x53439a[_0x018e('0x5a')][_0x018e('0x2d')]({'plain':!![]});if(!_0x372394)throw new Error(_0x018e('0x5b'));if(_0x372394[_0x018e('0x5c')]==='user'){var _0x290cef=_0x573013[_0x018e('0x2d')]({'plain':!![]});return db[_0x018e('0x5d')][_0x018e('0x5e')]({'where':{'name':'Contexts','userProfileId':_0x372394['userProfileId']},'raw':!![]})[_0x018e('0x2b')](function(_0xfe23d2){if(_0xfe23d2&&_0xfe23d2['autoAssociation']===0x0){return db[_0x018e('0x2f')][_0x018e('0x4e')]({'name':_0x290cef[_0x018e('0x31')],'resourceId':_0x290cef['id'],'type':_0xfe23d2['name'],'sectionId':_0xfe23d2['id']},{})['then'](function(){return _0x573013;});}else{return _0x573013;}})['catch'](function(_0x172b6a){logger['error'](_0x018e('0x5f'),_0x172b6a);throw _0x172b6a;});}return _0x573013;})[_0x018e('0x2b')](respondWithResult(_0x45bdc3,0xc9))[_0x018e('0x4d')](handleError(_0x45bdc3,null));};exports[_0x018e('0x2a')]=function(_0x445c30,_0x39e8d1,_0x53a928){var _0x24f1c2;return db[_0x018e('0x35')][_0x018e('0x5e')]({'where':{'id':_0x445c30['params']['id']}})[_0x018e('0x2b')](handleEntityNotFound(_0x39e8d1,null))[_0x018e('0x2b')](saveUpdates(_0x445c30[_0x018e('0x4f')],null))[_0x018e('0x2b')](function(_0x24819e){if(_0x24819e){_0x24f1c2=_0x24819e;return db[_0x018e('0x35')][_0x018e('0x4a')]({'raw':!![]});}})[_0x018e('0x2b')](function(_0x17c032){var _0x2700bc=fs[_0x018e('0x50')](path[_0x018e('0x51')](config[_0x018e('0x52')],'server/files/templates/context.ejs'),'utf8');var _0x4f7b95=ejs[_0x018e('0x55')](_0x2700bc,{'contexts':_0x17c032||[]});fs[_0x018e('0x56')](_0x018e('0x57'),_0x4f7b95);})['then'](function(){return respondWithRpcPromise(_0x018e('0x58'),_0x018e('0x2a'),{'module':'chan_sip.so'});})[_0x018e('0x2b')](function(){return _0x24f1c2;})[_0x018e('0x2b')](respondWithResult(_0x39e8d1,null))[_0x018e('0x4d')](handleError(_0x39e8d1,null));};exports[_0x018e('0x2c')]=function(_0x1f73d7,_0x56afdc,_0x546a36){var _0x23c102;return db[_0x018e('0x35')][_0x018e('0x5e')]({'where':{'id':_0x1f73d7['params']['id']}})[_0x018e('0x2b')](handleEntityNotFound(_0x56afdc,null))['then'](removeEntity(_0x56afdc,null))[_0x018e('0x2b')](function(){return db[_0x018e('0x35')][_0x018e('0x4a')]({'raw':!![]});})[_0x018e('0x2b')](function(_0x427691){var _0x57b47b=fs['readFileSync'](path[_0x018e('0x51')](config[_0x018e('0x52')],'server/files/templates/context.ejs'),_0x018e('0x54'));var _0x40776a=ejs[_0x018e('0x55')](_0x57b47b,{'contexts':_0x427691});fs[_0x018e('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x40776a);return respondWithRpcPromise(_0x018e('0x58'),_0x018e('0x2c'),{'module':_0x018e('0x59')});})['catch'](handleError(_0x56afdc,null));}; \ No newline at end of file +var _0x3b59=['reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','map','VoiceContext','rawAttributes','fieldName','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','includeAll','find','create','body','readFileSync','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/context.ejs','Reload','writeFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x3b59,0x9c));var _0x93b5=function(_0x2971ba,_0x230706){_0x2971ba=_0x2971ba-0x0;var _0x4a7bb0=_0x3b59[_0x2971ba];return _0x4a7bb0;};'use strict';var pdf=require(_0x93b5('0x0'));var emlformat=require(_0x93b5('0x1'));var rimraf=require(_0x93b5('0x2'));var zipdir=require(_0x93b5('0x3'));var jsonpatch=require(_0x93b5('0x4'));var rp=require(_0x93b5('0x5'));var moment=require('moment');var BPromise=require(_0x93b5('0x6'));var Mustache=require('mustache');var util=require(_0x93b5('0x7'));var path=require(_0x93b5('0x8'));var sox=require(_0x93b5('0x9'));var csv=require(_0x93b5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x93b5('0xb'));var squel=require(_0x93b5('0xc'));var crypto=require(_0x93b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x93b5('0xe'));var toCsv=require(_0x93b5('0xa'));var querystring=require(_0x93b5('0xf'));var Papa=require(_0x93b5('0x10'));var Redis=require(_0x93b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x93b5('0x12'));var as=require(_0x93b5('0x13'));var hardwareService=require(_0x93b5('0x14'));var logger=require(_0x93b5('0x15'))(_0x93b5('0x16'));var utils=require('../../config/utils');var config=require(_0x93b5('0x17'));var licenseUtil=require(_0x93b5('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x93b5('0x19'));var client=jayson[_0x93b5('0x1a')][_0x93b5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3dad37,_0x2e1bf7,_0x5b3906,_0xfb95a6){return new BPromise(function(_0x151e45,_0x4e9b23){var _0x15ffe2=_0xfb95a6||client;return _0x15ffe2[_0x93b5('0x1c')](_0x3dad37,_0x5b3906)[_0x93b5('0x1d')](function(_0x4c3d28){logger[_0x93b5('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x2e1bf7,'request\x20sent');logger[_0x93b5('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2e1bf7,_0x93b5('0x20'),JSON[_0x93b5('0x21')](_0x4c3d28));if(_0x4c3d28[_0x93b5('0x22')]){if(_0x4c3d28['error']['code']===0x1f4){logger['error'](_0x93b5('0x23'),_0x2e1bf7,_0x4c3d28[_0x93b5('0x22')][_0x93b5('0x24')]);return _0x4e9b23(_0x4c3d28[_0x93b5('0x22')][_0x93b5('0x24')]);}logger[_0x93b5('0x22')](_0x93b5('0x23'),_0x2e1bf7,_0x4c3d28[_0x93b5('0x22')][_0x93b5('0x24')]);return _0x151e45(_0x4c3d28[_0x93b5('0x22')]['message']);}else{logger['info'](_0x93b5('0x23'),_0x2e1bf7,_0x93b5('0x20'));_0x151e45(_0x4c3d28['result'][_0x93b5('0x24')]);}})[_0x93b5('0x25')](function(_0x2e9e75){logger[_0x93b5('0x22')](_0x93b5('0x23'),_0x2e1bf7,_0x2e9e75);_0x4e9b23(_0x2e9e75);});});}function respondWithStatusCode(_0x194ae3,_0x45c8ee){_0x45c8ee=_0x45c8ee||0xcc;return function(_0x7f6df6){if(_0x7f6df6){return _0x194ae3[_0x93b5('0x26')](_0x45c8ee);}return _0x194ae3[_0x93b5('0x27')](_0x45c8ee)[_0x93b5('0x28')]();};}function respondWithResult(_0x126746,_0x2a2417){_0x2a2417=_0x2a2417||0xc8;return function(_0x3a31db){if(_0x3a31db){return _0x126746[_0x93b5('0x27')](_0x2a2417)[_0x93b5('0x29')](_0x3a31db);}};}function respondWithFilteredResult(_0x14a23d,_0x11add6){return function(_0x4977df){if(_0x4977df){var _0xc6c370=_0x4977df[_0x93b5('0x2a')],_0x2ed60b=_0x11add6[_0x93b5('0x2b')],_0x264c64=_0x11add6[_0x93b5('0x2b')]+_0x11add6[_0x93b5('0x2c')],_0x124101;if(_0x264c64>=_0xc6c370){_0x264c64=_0xc6c370;_0x124101=0xc8;}else{_0x124101=0xce;}_0x14a23d['status'](_0x124101);return _0x14a23d[_0x93b5('0x2d')](_0x93b5('0x2e'),_0x2ed60b+'-'+_0x264c64+'/'+_0xc6c370)['json'](_0x4977df);}return null;};}function patchUpdates(_0xf7fc9c){return function(_0x4e4212){try{jsonpatch[_0x93b5('0x2f')](_0x4e4212,_0xf7fc9c,!![]);}catch(_0x10b080){return BPromise[_0x93b5('0x30')](_0x10b080);}return _0x4e4212[_0x93b5('0x31')]();};}function saveUpdates(_0x207b04,_0x404249){return function(_0x13cc1a){if(_0x13cc1a){return _0x13cc1a[_0x93b5('0x32')](_0x207b04)[_0x93b5('0x1d')](function(_0x130596){return _0x130596;});}return null;};}function removeEntity(_0x5a5fa7,_0x5c2c92){return function(_0x4e1818){if(_0x4e1818){return _0x4e1818['destroy']()['then'](function(){var _0x5af234=_0x4e1818[_0x93b5('0x33')]({'plain':!![]});var _0xfae558=_0x93b5('0x34');return db[_0x93b5('0x35')][_0x93b5('0x36')]({'where':{'type':_0xfae558,'resourceId':_0x5af234['id']}})[_0x93b5('0x1d')](function(){return _0x4e1818;});})[_0x93b5('0x1d')](function(){_0x5a5fa7[_0x93b5('0x27')](0xcc)[_0x93b5('0x28')]();});}};}function handleEntityNotFound(_0x37c7f8,_0x5b970b){return function(_0x51a825){if(!_0x51a825){_0x37c7f8['sendStatus'](0x194);}return _0x51a825;};}function handleError(_0x1f652b,_0x17348c){_0x17348c=_0x17348c||0x1f4;return function(_0x25cf0b){logger[_0x93b5('0x22')](_0x25cf0b[_0x93b5('0x37')]);if(_0x25cf0b[_0x93b5('0x38')]){delete _0x25cf0b['name'];}_0x1f652b['status'](_0x17348c)['send'](_0x25cf0b);};}exports['index']=function(_0x505cd7,_0x223904){var _0x2b3a85={},_0x437c00={},_0x123ff9={'count':0x0,'rows':[]};var _0x34896a=_[_0x93b5('0x39')](db[_0x93b5('0x3a')][_0x93b5('0x3b')],function(_0x1f71dc){return{'name':_0x1f71dc[_0x93b5('0x3c')],'type':_0x1f71dc['type']['key']};});_0x437c00['model']=_[_0x93b5('0x39')](_0x34896a,_0x93b5('0x38'));_0x437c00[_0x93b5('0x3d')]=_[_0x93b5('0x3e')](_0x505cd7[_0x93b5('0x3d')]);_0x437c00[_0x93b5('0x3f')]=_['intersection'](_0x437c00[_0x93b5('0x40')],_0x437c00[_0x93b5('0x3d')]);_0x2b3a85[_0x93b5('0x41')]=_['intersection'](_0x437c00[_0x93b5('0x40')],qs[_0x93b5('0x42')](_0x505cd7['query']['fields']));_0x2b3a85[_0x93b5('0x41')]=_0x2b3a85[_0x93b5('0x41')][_0x93b5('0x43')]?_0x2b3a85[_0x93b5('0x41')]:_0x437c00['model'];if(!_0x505cd7[_0x93b5('0x3d')][_0x93b5('0x44')](_0x93b5('0x45'))){_0x2b3a85[_0x93b5('0x2c')]=qs[_0x93b5('0x2c')](_0x505cd7[_0x93b5('0x3d')][_0x93b5('0x2c')]);_0x2b3a85[_0x93b5('0x2b')]=qs['offset'](_0x505cd7['query'][_0x93b5('0x2b')]);}_0x2b3a85[_0x93b5('0x46')]=qs[_0x93b5('0x47')](_0x505cd7[_0x93b5('0x3d')][_0x93b5('0x47')]);_0x2b3a85[_0x93b5('0x48')]=qs[_0x93b5('0x3f')](_[_0x93b5('0x49')](_0x505cd7[_0x93b5('0x3d')],_0x437c00[_0x93b5('0x3f')]),_0x34896a);if(_0x505cd7['query'][_0x93b5('0x4a')]){_0x2b3a85['where']=_[_0x93b5('0x4b')](_0x2b3a85[_0x93b5('0x48')],{'$or':_[_0x93b5('0x39')](_0x34896a,function(_0x4b34d8){if(_0x4b34d8[_0x93b5('0x4c')]!==_0x93b5('0x4d')){var _0x290d74={};_0x290d74[_0x4b34d8[_0x93b5('0x38')]]={'$like':'%'+_0x505cd7[_0x93b5('0x3d')][_0x93b5('0x4a')]+'%'};return _0x290d74;}})});}_0x2b3a85=_[_0x93b5('0x4b')]({},_0x2b3a85,_0x505cd7['options']);var _0x28adc6={'where':_0x2b3a85[_0x93b5('0x48')]};return db[_0x93b5('0x3a')][_0x93b5('0x2a')](_0x28adc6)['then'](function(_0x2a794e){_0x123ff9['count']=_0x2a794e;if(_0x505cd7['query']['includeAll']){_0x2b3a85[_0x93b5('0x4e')]=[{'all':!![]}];}return db[_0x93b5('0x3a')][_0x93b5('0x4f')](_0x2b3a85);})[_0x93b5('0x1d')](function(_0x41d8bb){_0x123ff9[_0x93b5('0x50')]=_0x41d8bb;return _0x123ff9;})[_0x93b5('0x1d')](respondWithFilteredResult(_0x223904,_0x2b3a85))['catch'](handleError(_0x223904,null));};exports[_0x93b5('0x51')]=function(_0x152187,_0x488c3c){var _0x505217={'raw':![],'where':{'id':_0x152187[_0x93b5('0x52')]['id']}},_0x351e82={};_0x351e82[_0x93b5('0x40')]=_['keys'](db['VoiceContext']['rawAttributes']);_0x351e82[_0x93b5('0x3d')]=_['keys'](_0x152187['query']);_0x351e82[_0x93b5('0x3f')]=_['intersection'](_0x351e82[_0x93b5('0x40')],_0x351e82['query']);_0x505217[_0x93b5('0x41')]=_['intersection'](_0x351e82['model'],qs[_0x93b5('0x42')](_0x152187[_0x93b5('0x3d')][_0x93b5('0x42')]));_0x505217[_0x93b5('0x41')]=_0x505217[_0x93b5('0x41')]['length']?_0x505217['attributes']:_0x351e82['model'];if(_0x152187[_0x93b5('0x3d')][_0x93b5('0x53')]){_0x505217[_0x93b5('0x4e')]=[{'all':!![]}];}_0x505217=_[_0x93b5('0x4b')]({},_0x505217,_0x152187['options']);return db['VoiceContext'][_0x93b5('0x54')](_0x505217)['then'](handleEntityNotFound(_0x488c3c,null))[_0x93b5('0x1d')](respondWithResult(_0x488c3c,null))[_0x93b5('0x25')](handleError(_0x488c3c,null));};exports[_0x93b5('0x55')]=function(_0x5b9b76,_0x1c97bb,_0x523554){var _0x145795;return db[_0x93b5('0x3a')][_0x93b5('0x55')](_0x5b9b76[_0x93b5('0x56')],{'raw':!![]})[_0x93b5('0x1d')](function(_0x4c5372){_0x145795=_0x4c5372;return db['VoiceContext'][_0x93b5('0x4f')]({'raw':!![]});})['then'](function(_0x48f796){var _0x7bef2a=fs[_0x93b5('0x57')](path['join'](config[_0x93b5('0x58')],'server/files/templates/context.ejs'),_0x93b5('0x59'));var _0x565ea1=ejs[_0x93b5('0x5a')](_0x7bef2a,{'contexts':_0x48f796||[]});fs['writeFileSync'](_0x93b5('0x5b'),_0x565ea1);})[_0x93b5('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x93b5('0x5c')});})[_0x93b5('0x1d')](function(){var _0x22bb3e=_0x5b9b76['user'][_0x93b5('0x33')]({'plain':!![]});if(!_0x22bb3e)throw new Error(_0x93b5('0x5d'));if(_0x22bb3e[_0x93b5('0x5e')]===_0x93b5('0x5f')){var _0xb7eec6=_0x145795[_0x93b5('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x93b5('0x54')]({'where':{'name':_0x93b5('0x34'),'userProfileId':_0x22bb3e['userProfileId']},'raw':!![]})[_0x93b5('0x1d')](function(_0x3294e0){if(_0x3294e0&&_0x3294e0[_0x93b5('0x60')]===0x0){return db[_0x93b5('0x35')][_0x93b5('0x55')]({'name':_0xb7eec6[_0x93b5('0x38')],'resourceId':_0xb7eec6['id'],'type':_0x3294e0[_0x93b5('0x38')],'sectionId':_0x3294e0['id']},{})[_0x93b5('0x1d')](function(){return _0x145795;});}else{return _0x145795;}})[_0x93b5('0x25')](function(_0x172c14){logger[_0x93b5('0x22')](_0x93b5('0x61'),_0x172c14);throw _0x172c14;});}return _0x145795;})['then'](respondWithResult(_0x1c97bb,0xc9))[_0x93b5('0x25')](handleError(_0x1c97bb,null));};exports['update']=function(_0x1bf281,_0x311936,_0x147a31){var _0x356d31;return db['VoiceContext']['find']({'where':{'id':_0x1bf281[_0x93b5('0x52')]['id']}})[_0x93b5('0x1d')](handleEntityNotFound(_0x311936,null))[_0x93b5('0x1d')](saveUpdates(_0x1bf281[_0x93b5('0x56')],null))[_0x93b5('0x1d')](function(_0x12c94a){if(_0x12c94a){_0x356d31=_0x12c94a;return db[_0x93b5('0x3a')]['findAll']({'raw':!![]});}})[_0x93b5('0x1d')](function(_0x55607b){var _0x15a852=fs[_0x93b5('0x57')](path[_0x93b5('0x62')](config['root'],_0x93b5('0x63')),_0x93b5('0x59'));var _0x2e5f78=ejs[_0x93b5('0x5a')](_0x15a852,{'contexts':_0x55607b||[]});fs['writeFileSync'](_0x93b5('0x5b'),_0x2e5f78);})['then'](function(){return respondWithRpcPromise(_0x93b5('0x64'),'update',{'module':_0x93b5('0x5c')});})[_0x93b5('0x1d')](function(){return _0x356d31;})[_0x93b5('0x1d')](respondWithResult(_0x311936,null))['catch'](handleError(_0x311936,null));};exports[_0x93b5('0x36')]=function(_0x5a34ff,_0x4cf8ca,_0x1f0089){var _0x3cb79e;return db['VoiceContext'][_0x93b5('0x54')]({'where':{'id':_0x5a34ff['params']['id']}})[_0x93b5('0x1d')](handleEntityNotFound(_0x4cf8ca,null))['then'](removeEntity(_0x4cf8ca,null))[_0x93b5('0x1d')](function(){return db[_0x93b5('0x3a')]['findAll']({'raw':!![]});})[_0x93b5('0x1d')](function(_0x8db8db){var _0x2ad932=fs[_0x93b5('0x57')](path[_0x93b5('0x62')](config[_0x93b5('0x58')],_0x93b5('0x63')),'utf8');var _0x252666=ejs[_0x93b5('0x5a')](_0x2ad932,{'contexts':_0x8db8db});fs[_0x93b5('0x65')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x252666);return respondWithRpcPromise(_0x93b5('0x64'),_0x93b5('0x36'),{'module':_0x93b5('0x5c')});})['catch'](handleError(_0x4cf8ca,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3996557..2890963 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 _0x81e2=['../../config/environment','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x81e2,0x7c));var _0x281e=function(_0x2deea2,_0x2cfde3){_0x2deea2=_0x2deea2-0x0;var _0x4d3284=_0x81e2[_0x2deea2];return _0x4d3284;};'use strict';var _=require(_0x281e('0x0'));var util=require(_0x281e('0x1'));var logger=require(_0x281e('0x2'))(_0x281e('0x3'));var moment=require(_0x281e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x281e('0x5'));var config=require(_0x281e('0x6'));var attributes=require('./voiceContext.attributes');module[_0x281e('0x7')]=function(_0x5b00f2,_0x1d6f2a){return _0x5b00f2[_0x281e('0x8')]('VoiceContext',attributes,{'tableName':_0x281e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0d0=['VoiceContext','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define'];(function(_0x231f6f,_0xf231e0){var _0xc621c4=function(_0x5c8549){while(--_0x5c8549){_0x231f6f['push'](_0x231f6f['shift']());}};_0xc621c4(++_0xf231e0);}(_0xe0d0,0x85));var _0x0e0d=function(_0x555e2b,_0x4e5d28){_0x555e2b=_0x555e2b-0x0;var _0x2542f5=_0xe0d0[_0x555e2b];return _0x2542f5;};'use strict';var _=require('lodash');var util=require(_0x0e0d('0x0'));var logger=require('../../config/logger')(_0x0e0d('0x1'));var moment=require(_0x0e0d('0x2'));var BPromise=require(_0x0e0d('0x3'));var rp=require(_0x0e0d('0x4'));var fs=require('fs');var path=require(_0x0e0d('0x5'));var rimraf=require(_0x0e0d('0x6'));var config=require(_0x0e0d('0x7'));var attributes=require(_0x0e0d('0x8'));module['exports']=function(_0x98ed99,_0x38057d){return _0x98ed99[_0x0e0d('0x9')](_0x0e0d('0xa'),attributes,{'tableName':'voice_contexts','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 e0911fb..ecb081f 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 _0x6e81=['ioredis','../../config/utils','../../config/logger','jayson/promise','client','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird'];(function(_0x524154,_0x1dd347){var _0x21dcd1=function(_0x381766){while(--_0x381766){_0x524154['push'](_0x524154['shift']());}};_0x21dcd1(++_0x1dd347);}(_0x6e81,0x19a));var _0x16e8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e81[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x16e8('0x0'));var util=require(_0x16e8('0x1'));var moment=require(_0x16e8('0x2'));var BPromise=require(_0x16e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x16e8('0x5'));var logger=require(_0x16e8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x16e8('0x7'));var client=jayson[_0x16e8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20d343,_0x3ef0f7,_0x32501b){return new BPromise(function(_0x554bf0,_0x469517){return client['request'](_0x20d343,_0x32501b)['then'](function(_0x3ebcec){logger[_0x16e8('0x9')](_0x16e8('0xa'),_0x3ef0f7,'request\x20sent');logger[_0x16e8('0xb')](_0x16e8('0xc'),_0x3ef0f7,'request\x20sent',JSON[_0x16e8('0xd')](_0x3ebcec));if(_0x3ebcec[_0x16e8('0xe')]){if(_0x3ebcec['error'][_0x16e8('0xf')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3ef0f7,_0x3ebcec['error'][_0x16e8('0x10')]);return _0x469517(_0x3ebcec[_0x16e8('0xe')]['message']);}logger[_0x16e8('0xe')](_0x16e8('0xa'),_0x3ef0f7,_0x3ebcec[_0x16e8('0xe')][_0x16e8('0x10')]);return _0x554bf0(_0x3ebcec[_0x16e8('0xe')][_0x16e8('0x10')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3ef0f7,_0x16e8('0x11'));_0x554bf0(_0x3ebcec['result'][_0x16e8('0x10')]);}})['catch'](function(_0x43bb1b){logger[_0x16e8('0xe')](_0x16e8('0xa'),_0x3ef0f7,_0x43bb1b);_0x469517(_0x43bb1b);});});} \ No newline at end of file +var _0x3064=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3683d9,_0x3f443c){var _0xd71462=function(_0x537c9f){while(--_0x537c9f){_0x3683d9['push'](_0x3683d9['shift']());}};_0xd71462(++_0x3f443c);}(_0x3064,0x73));var _0x4306=function(_0x5c8752,_0x14a3b1){_0x5c8752=_0x5c8752-0x0;var _0x280bf7=_0x3064[_0x5c8752];return _0x280bf7;};'use strict';var _=require(_0x4306('0x0'));var util=require(_0x4306('0x1'));var moment=require(_0x4306('0x2'));var BPromise=require(_0x4306('0x3'));var rs=require(_0x4306('0x4'));var fs=require('fs');var Redis=require(_0x4306('0x5'));var db=require(_0x4306('0x6'))['db'];var utils=require(_0x4306('0x7'));var logger=require(_0x4306('0x8'))(_0x4306('0x9'));var config=require(_0x4306('0xa'));var jayson=require(_0x4306('0xb'));var client=jayson[_0x4306('0xc')][_0x4306('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2531cd,_0x18230c,_0x260a38){return new BPromise(function(_0x536da8,_0x45d6bc){return client['request'](_0x2531cd,_0x260a38)[_0x4306('0xe')](function(_0x4be1d9){logger[_0x4306('0xf')](_0x4306('0x10'),_0x18230c,_0x4306('0x11'));logger[_0x4306('0x12')](_0x4306('0x13'),_0x18230c,_0x4306('0x11'),JSON[_0x4306('0x14')](_0x4be1d9));if(_0x4be1d9[_0x4306('0x15')]){if(_0x4be1d9['error']['code']===0x1f4){logger['error'](_0x4306('0x10'),_0x18230c,_0x4be1d9[_0x4306('0x15')][_0x4306('0x16')]);return _0x45d6bc(_0x4be1d9[_0x4306('0x15')]['message']);}logger[_0x4306('0x15')](_0x4306('0x10'),_0x18230c,_0x4be1d9['error'][_0x4306('0x16')]);return _0x536da8(_0x4be1d9[_0x4306('0x15')][_0x4306('0x16')]);}else{logger[_0x4306('0xf')](_0x4306('0x10'),_0x18230c,_0x4306('0x11'));_0x536da8(_0x4be1d9['result']['message']);}})[_0x4306('0x17')](function(_0xb698be){logger[_0x4306('0x15')](_0x4306('0x10'),_0x18230c,_0xb698be);_0x45d6bc(_0xb698be);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6957107..08a97dd 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 _0xd90e=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xd90e,0xf0));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed90('0x0'));var util=require(_0xed90('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed90('0x2'));var router=express[_0xed90('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xed90('0x4'));var config=require(_0xed90('0x5'));var controller=require(_0xed90('0x6'));router[_0xed90('0x7')]('/',auth[_0xed90('0x8')](),controller[_0xed90('0x9')]);router[_0xed90('0x7')](_0xed90('0xa'),auth[_0xed90('0x8')](),controller[_0xed90('0xb')]);router['get'](_0xed90('0xc'),auth[_0xed90('0x8')](),controller[_0xed90('0xd')]);router[_0xed90('0xe')]('/',auth[_0xed90('0x8')](),controller[_0xed90('0xf')]);router['put'](_0xed90('0xc'),auth[_0xed90('0x8')](),controller[_0xed90('0x10')]);router[_0xed90('0x11')](_0xed90('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xed90('0x12')]=router; \ No newline at end of file +var _0xb5de=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','path'];(function(_0x3aacbc,_0x154dba){var _0x2eef0b=function(_0x8b754){while(--_0x8b754){_0x3aacbc['push'](_0x3aacbc['shift']());}};_0x2eef0b(++_0x154dba);}(_0xb5de,0x1ec));var _0xeb5d=function(_0x5a4530,_0x363d74){_0x5a4530=_0x5a4530-0x0;var _0xed526f=_0xb5de[_0x5a4530];return _0xed526f;};'use strict';var multer=require(_0xeb5d('0x0'));var util=require('util');var path=require(_0xeb5d('0x1'));var timeout=require(_0xeb5d('0x2'));var express=require('express');var router=express[_0xeb5d('0x3')]();var auth=require(_0xeb5d('0x4'));var interaction=require(_0xeb5d('0x5'));var config=require(_0xeb5d('0x6'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xeb5d('0x7')](),controller[_0xeb5d('0x8')]);router[_0xeb5d('0x9')](_0xeb5d('0xa'),auth[_0xeb5d('0x7')](),controller[_0xeb5d('0xb')]);router[_0xeb5d('0x9')](_0xeb5d('0xc'),auth[_0xeb5d('0x7')](),controller[_0xeb5d('0xd')]);router[_0xeb5d('0xe')]('/',auth['isAuthenticated'](),controller[_0xeb5d('0xf')]);router['put'](_0xeb5d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xeb5d('0x10')](_0xeb5d('0xc'),auth[_0xeb5d('0x7')](),controller[_0xeb5d('0x11')]);module[_0xeb5d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 19214bc..e4cd791 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 _0xe380=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x5b5856,_0x5e353c){var _0x4325a3=function(_0x1f39f0){while(--_0x1f39f0){_0x5b5856['push'](_0x5b5856['shift']());}};_0x4325a3(++_0x5e353c);}(_0xe380,0x88));var _0x0e38=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xe380[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x0e38('0x0'));module[_0x0e38('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0e38('0x2')]},'channelstate':{'type':Sequelize[_0x0e38('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0e38('0x2')]},'calleridnum':{'type':Sequelize[_0x0e38('0x2')]},'calleridname':{'type':Sequelize[_0x0e38('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0e38('0x2')]},'language':{'type':Sequelize[_0x0e38('0x2')]},'accountcode':{'type':Sequelize[_0x0e38('0x2')]},'context':{'type':Sequelize[_0x0e38('0x2')]},'exten':{'type':Sequelize[_0x0e38('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x0e38('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0e38('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x0e38('0x2')]},'destcalleridnum':{'type':Sequelize[_0x0e38('0x2')]},'destcalleridname':{'type':Sequelize[_0x0e38('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x0e38('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x0e38('0x2')]},'destlanguage':{'type':Sequelize[_0x0e38('0x2')]},'destaccountcode':{'type':Sequelize[_0x0e38('0x2')]},'destcontext':{'type':Sequelize[_0x0e38('0x2')]},'destexten':{'type':Sequelize[_0x0e38('0x2')]},'destpriority':{'type':Sequelize[_0x0e38('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x0e38('0x2')]},'dialstring':{'type':Sequelize[_0x0e38('0x2')]},'dialstatus':{'type':Sequelize[_0x0e38('0x2')]},'starttime':{'type':Sequelize[_0x0e38('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0e38('0x4')]},'lastevent':{'type':Sequelize[_0x0e38('0x2')],'comment':_0x0e38('0x5')},'routeId':{'type':Sequelize[_0x0e38('0x3')]},'duration':{'type':Sequelize[_0x0e38('0x3')]},'holdtime':{'type':Sequelize[_0x0e38('0x3')]},'billableseconds':{'type':Sequelize[_0x0e38('0x3')]}}; \ No newline at end of file +var _0x81dc=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x5b68fb,_0x33c51a){var _0x339476=function(_0x252afd){while(--_0x252afd){_0x5b68fb['push'](_0x5b68fb['shift']());}};_0x339476(++_0x33c51a);}(_0x81dc,0x13e));var _0xc81d=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x81dc[_0x4bf96c];return _0x281d09;};'use strict';var Sequelize=require(_0xc81d('0x0'));module[_0xc81d('0x1')]={'privilege':{'type':Sequelize[_0xc81d('0x2')]},'channel':{'type':Sequelize[_0xc81d('0x2')]},'channelstate':{'type':Sequelize[_0xc81d('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc81d('0x2')]},'calleridnum':{'type':Sequelize[_0xc81d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc81d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc81d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc81d('0x2')]},'exten':{'type':Sequelize[_0xc81d('0x2')]},'priority':{'type':Sequelize[_0xc81d('0x3')]},'uniqueid':{'type':Sequelize[_0xc81d('0x2')]},'linkedid':{'type':Sequelize[_0xc81d('0x2')]},'destchannel':{'type':Sequelize[_0xc81d('0x2')]},'destchannelstate':{'type':Sequelize[_0xc81d('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc81d('0x2')]},'destcalleridname':{'type':Sequelize[_0xc81d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc81d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc81d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc81d('0x2')]},'destcontext':{'type':Sequelize[_0xc81d('0x2')]},'destexten':{'type':Sequelize[_0xc81d('0x2')]},'destpriority':{'type':Sequelize[_0xc81d('0x3')]},'destuniqueid':{'type':Sequelize[_0xc81d('0x2')]},'destlinkedid':{'type':Sequelize[_0xc81d('0x2')]},'dialstring':{'type':Sequelize[_0xc81d('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc81d('0x4')]},'answertime':{'type':Sequelize[_0xc81d('0x4')]},'endtime':{'type':Sequelize[_0xc81d('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xc81d('0x5')},'routeId':{'type':Sequelize[_0xc81d('0x3')]},'duration':{'type':Sequelize[_0xc81d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xc81d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2bf361e..7152aeb 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 _0x0578=['catch','show','params','rawAttributes','includeAll','find','create','body','update','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','then','destroy','stack','send','index','VoiceDialReport','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','name','options','count','include','findAll'];(function(_0x1fddf1,_0x37267e){var _0x2dcae7=function(_0x5ecab4){while(--_0x5ecab4){_0x1fddf1['push'](_0x1fddf1['shift']());}};_0x2dcae7(++_0x37267e);}(_0x0578,0xa4));var _0x8057=function(_0x464adc,_0x1d3154){_0x464adc=_0x464adc-0x0;var _0x3fe7c3=_0x0578[_0x464adc];return _0x3fe7c3;};'use strict';var pdf=require(_0x8057('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8057('0x1'));var jsonpatch=require(_0x8057('0x2'));var rp=require(_0x8057('0x3'));var moment=require(_0x8057('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8057('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8057('0x6'));var csv=require(_0x8057('0x7'));var ejs=require(_0x8057('0x8'));var fs=require('fs');var _=require(_0x8057('0x9'));var squel=require(_0x8057('0xa'));var crypto=require(_0x8057('0xb'));var jsforce=require(_0x8057('0xc'));var deskjs=require(_0x8057('0xd'));var toCsv=require(_0x8057('0x7'));var querystring=require(_0x8057('0xe'));var Papa=require(_0x8057('0xf'));var Redis=require(_0x8057('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8057('0x11'));var as=require(_0x8057('0x12'));var hardwareService=require(_0x8057('0x13'));var logger=require(_0x8057('0x14'))(_0x8057('0x15'));var utils=require(_0x8057('0x16'));var config=require(_0x8057('0x17'));var licenseUtil=require(_0x8057('0x18'));var db=require(_0x8057('0x19'))['db'];function respondWithStatusCode(_0x4820f3,_0x29f42c){_0x29f42c=_0x29f42c||0xcc;return function(_0x28f262){if(_0x28f262){return _0x4820f3[_0x8057('0x1a')](_0x29f42c);}return _0x4820f3[_0x8057('0x1b')](_0x29f42c)[_0x8057('0x1c')]();};}function respondWithResult(_0x5a4ccd,_0x41c3ac){_0x41c3ac=_0x41c3ac||0xc8;return function(_0x376e51){if(_0x376e51){return _0x5a4ccd['status'](_0x41c3ac)['json'](_0x376e51);}};}function respondWithFilteredResult(_0x4af149,_0x5bb442){return function(_0x39cfea){if(_0x39cfea){var _0x26c241=_0x39cfea['count'],_0x14debc=_0x5bb442[_0x8057('0x1d')],_0x202284=_0x5bb442[_0x8057('0x1d')]+_0x5bb442[_0x8057('0x1e')],_0x1c38e9;if(_0x202284>=_0x26c241){_0x202284=_0x26c241;_0x1c38e9=0xc8;}else{_0x1c38e9=0xce;}_0x4af149[_0x8057('0x1b')](_0x1c38e9);return _0x4af149[_0x8057('0x1f')](_0x8057('0x20'),_0x14debc+'-'+_0x202284+'/'+_0x26c241)[_0x8057('0x21')](_0x39cfea);}return null;};}function patchUpdates(_0x5b0c14){return function(_0x1fd449){try{jsonpatch[_0x8057('0x22')](_0x1fd449,_0x5b0c14,!![]);}catch(_0x4d0de4){return BPromise[_0x8057('0x23')](_0x4d0de4);}return _0x1fd449['save']();};}function saveUpdates(_0x5727ca,_0x57c4d0){return function(_0x41541e){if(_0x41541e){return _0x41541e['update'](_0x5727ca)[_0x8057('0x24')](function(_0x21442f){return _0x21442f;});}return null;};}function removeEntity(_0x5e5a88,_0x40428e){return function(_0xeeab9c){if(_0xeeab9c){return _0xeeab9c[_0x8057('0x25')]()[_0x8057('0x24')](function(){_0x5e5a88['status'](0xcc)[_0x8057('0x1c')]();});}};}function handleEntityNotFound(_0xb16502,_0xbd6602){return function(_0x23e07b){if(!_0x23e07b){_0xb16502['sendStatus'](0x194);}return _0x23e07b;};}function handleError(_0x5c14d4,_0x5c7293){_0x5c7293=_0x5c7293||0x1f4;return function(_0x62fe18){logger['error'](_0x62fe18[_0x8057('0x26')]);if(_0x62fe18['name']){delete _0x62fe18['name'];}_0x5c14d4[_0x8057('0x1b')](_0x5c7293)[_0x8057('0x27')](_0x62fe18);};}exports[_0x8057('0x28')]=function(_0xa3a730,_0xf41ece){var _0x299eea={},_0xeb4ca6={},_0x1b93e3={'count':0x0,'rows':[]};var _0x294c69=_['map'](db[_0x8057('0x29')]['rawAttributes'],function(_0x42f0ee){return{'name':_0x42f0ee[_0x8057('0x2a')],'type':_0x42f0ee[_0x8057('0x2b')][_0x8057('0x2c')]};});_0xeb4ca6['model']=_['map'](_0x294c69,'name');_0xeb4ca6['query']=_[_0x8057('0x2d')](_0xa3a730['query']);_0xeb4ca6[_0x8057('0x2e')]=_[_0x8057('0x2f')](_0xeb4ca6[_0x8057('0x30')],_0xeb4ca6[_0x8057('0x31')]);_0x299eea[_0x8057('0x32')]=_['intersection'](_0xeb4ca6[_0x8057('0x30')],qs[_0x8057('0x33')](_0xa3a730[_0x8057('0x31')][_0x8057('0x33')]));_0x299eea[_0x8057('0x32')]=_0x299eea[_0x8057('0x32')][_0x8057('0x34')]?_0x299eea[_0x8057('0x32')]:_0xeb4ca6[_0x8057('0x30')];if(!_0xa3a730[_0x8057('0x31')][_0x8057('0x35')](_0x8057('0x36'))){_0x299eea['limit']=qs[_0x8057('0x1e')](_0xa3a730[_0x8057('0x31')][_0x8057('0x1e')]);_0x299eea['offset']=qs[_0x8057('0x1d')](_0xa3a730[_0x8057('0x31')]['offset']);}_0x299eea[_0x8057('0x37')]=qs[_0x8057('0x38')](_0xa3a730[_0x8057('0x31')]['sort']);_0x299eea[_0x8057('0x39')]=qs[_0x8057('0x2e')](_[_0x8057('0x3a')](_0xa3a730['query'],_0xeb4ca6[_0x8057('0x2e')]),_0x294c69);if(_0xa3a730[_0x8057('0x31')][_0x8057('0x3b')]){_0x299eea[_0x8057('0x39')]=_[_0x8057('0x3c')](_0x299eea[_0x8057('0x39')],{'$or':_[_0x8057('0x3d')](_0x294c69,function(_0x2a4a34){if(_0x2a4a34[_0x8057('0x2b')]!=='VIRTUAL'){var _0x27a580={};_0x27a580[_0x2a4a34[_0x8057('0x3e')]]={'$like':'%'+_0xa3a730[_0x8057('0x31')][_0x8057('0x3b')]+'%'};return _0x27a580;}})});}_0x299eea=_[_0x8057('0x3c')]({},_0x299eea,_0xa3a730[_0x8057('0x3f')]);var _0x289f88={'where':_0x299eea[_0x8057('0x39')]};return db['VoiceDialReport']['count'](_0x289f88)[_0x8057('0x24')](function(_0x59fafc){_0x1b93e3[_0x8057('0x40')]=_0x59fafc;if(_0xa3a730['query']['includeAll']){_0x299eea[_0x8057('0x41')]=[{'all':!![]}];}return db[_0x8057('0x29')][_0x8057('0x42')](_0x299eea);})[_0x8057('0x24')](function(_0x522bad){_0x1b93e3['rows']=_0x522bad;return _0x1b93e3;})[_0x8057('0x24')](respondWithFilteredResult(_0xf41ece,_0x299eea))[_0x8057('0x43')](handleError(_0xf41ece,null));};exports[_0x8057('0x44')]=function(_0xb77c13,_0x1e1537){var _0x1a17c8={'raw':!![],'where':{'id':_0xb77c13[_0x8057('0x45')]['id']}},_0x277d72={};_0x277d72[_0x8057('0x30')]=_[_0x8057('0x2d')](db[_0x8057('0x29')][_0x8057('0x46')]);_0x277d72[_0x8057('0x31')]=_['keys'](_0xb77c13[_0x8057('0x31')]);_0x277d72[_0x8057('0x2e')]=_[_0x8057('0x2f')](_0x277d72[_0x8057('0x30')],_0x277d72[_0x8057('0x31')]);_0x1a17c8['attributes']=_[_0x8057('0x2f')](_0x277d72[_0x8057('0x30')],qs[_0x8057('0x33')](_0xb77c13[_0x8057('0x31')]['fields']));_0x1a17c8[_0x8057('0x32')]=_0x1a17c8[_0x8057('0x32')]['length']?_0x1a17c8[_0x8057('0x32')]:_0x277d72[_0x8057('0x30')];if(_0xb77c13['query'][_0x8057('0x47')]){_0x1a17c8['include']=[{'all':!![]}];}_0x1a17c8=_['merge']({},_0x1a17c8,_0xb77c13[_0x8057('0x3f')]);return db['VoiceDialReport'][_0x8057('0x48')](_0x1a17c8)[_0x8057('0x24')](handleEntityNotFound(_0x1e1537,null))[_0x8057('0x24')](respondWithResult(_0x1e1537,null))[_0x8057('0x43')](handleError(_0x1e1537,null));};exports[_0x8057('0x49')]=function(_0x16b565,_0x253bf3){return db[_0x8057('0x29')][_0x8057('0x49')](_0x16b565[_0x8057('0x4a')],{})['then'](respondWithResult(_0x253bf3,0xc9))[_0x8057('0x43')](handleError(_0x253bf3,null));};exports[_0x8057('0x4b')]=function(_0x17a136,_0x390d37){if(_0x17a136[_0x8057('0x4a')]['id']){delete _0x17a136[_0x8057('0x4a')]['id'];}return db[_0x8057('0x29')][_0x8057('0x48')]({'where':{'id':_0x17a136[_0x8057('0x45')]['id']}})[_0x8057('0x24')](handleEntityNotFound(_0x390d37,null))[_0x8057('0x24')](saveUpdates(_0x17a136[_0x8057('0x4a')],null))[_0x8057('0x24')](respondWithResult(_0x390d37,null))[_0x8057('0x43')](handleError(_0x390d37,null));};exports[_0x8057('0x25')]=function(_0x4f09bd,_0x5a46dd){return db['VoiceDialReport'][_0x8057('0x48')]({'where':{'id':_0x4f09bd[_0x8057('0x45')]['id']}})[_0x8057('0x24')](handleEntityNotFound(_0x5a46dd,null))[_0x8057('0x24')](removeEntity(_0x5a46dd,null))[_0x8057('0x43')](handleError(_0x5a46dd,null));};exports['describe']=function(_0x401459,_0x31920c){return db[_0x8057('0x29')][_0x8057('0x4c')]()[_0x8057('0x24')](respondWithResult(_0x31920c,null))[_0x8057('0x43')](handleError(_0x31920c,null));}; \ No newline at end of file +var _0x4dcb=['mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','destroy','then','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4dcb,0x1ab));var _0xb4dc=function(_0x4edefd,_0x2a774b){_0x4edefd=_0x4edefd-0x0;var _0x250a64=_0x4dcb[_0x4edefd];return _0x250a64;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb4dc('0x0'));var rimraf=require(_0xb4dc('0x1'));var zipdir=require(_0xb4dc('0x2'));var jsonpatch=require(_0xb4dc('0x3'));var rp=require(_0xb4dc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb4dc('0x5'));var util=require('util');var path=require(_0xb4dc('0x6'));var sox=require('sox');var csv=require(_0xb4dc('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb4dc('0x8'));var jsforce=require(_0xb4dc('0x9'));var deskjs=require(_0xb4dc('0xa'));var toCsv=require(_0xb4dc('0x7'));var querystring=require(_0xb4dc('0xb'));var Papa=require(_0xb4dc('0xc'));var Redis=require(_0xb4dc('0xd'));var authService=require(_0xb4dc('0xe'));var qs=require(_0xb4dc('0xf'));var as=require(_0xb4dc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb4dc('0x11'));var utils=require(_0xb4dc('0x12'));var config=require(_0xb4dc('0x13'));var licenseUtil=require(_0xb4dc('0x14'));var db=require(_0xb4dc('0x15'))['db'];function respondWithStatusCode(_0x339194,_0xdd6d51){_0xdd6d51=_0xdd6d51||0xcc;return function(_0x40e21c){if(_0x40e21c){return _0x339194[_0xb4dc('0x16')](_0xdd6d51);}return _0x339194[_0xb4dc('0x17')](_0xdd6d51)[_0xb4dc('0x18')]();};}function respondWithResult(_0x4800dd,_0x2fe45e){_0x2fe45e=_0x2fe45e||0xc8;return function(_0x1b373f){if(_0x1b373f){return _0x4800dd[_0xb4dc('0x17')](_0x2fe45e)['json'](_0x1b373f);}};}function respondWithFilteredResult(_0x52b3c4,_0x51d71f){return function(_0x530405){if(_0x530405){var _0x29eba2=_0x530405[_0xb4dc('0x19')],_0x568cc4=_0x51d71f[_0xb4dc('0x1a')],_0x5a70c5=_0x51d71f[_0xb4dc('0x1a')]+_0x51d71f['limit'],_0x33ad5c;if(_0x5a70c5>=_0x29eba2){_0x5a70c5=_0x29eba2;_0x33ad5c=0xc8;}else{_0x33ad5c=0xce;}_0x52b3c4[_0xb4dc('0x17')](_0x33ad5c);return _0x52b3c4['set'](_0xb4dc('0x1b'),_0x568cc4+'-'+_0x5a70c5+'/'+_0x29eba2)[_0xb4dc('0x1c')](_0x530405);}return null;};}function patchUpdates(_0x471b2d){return function(_0x1c5714){try{jsonpatch[_0xb4dc('0x1d')](_0x1c5714,_0x471b2d,!![]);}catch(_0x4ba653){return BPromise[_0xb4dc('0x1e')](_0x4ba653);}return _0x1c5714[_0xb4dc('0x1f')]();};}function saveUpdates(_0xa9d03b,_0x5ec6d5){return function(_0x7d56ad){if(_0x7d56ad){return _0x7d56ad['update'](_0xa9d03b)['then'](function(_0x3b98b8){return _0x3b98b8;});}return null;};}function removeEntity(_0x4d60c8,_0x19dd3b){return function(_0x238f27){if(_0x238f27){return _0x238f27[_0xb4dc('0x20')]()[_0xb4dc('0x21')](function(){_0x4d60c8[_0xb4dc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b804,_0x352499){return function(_0x43694d){if(!_0x43694d){_0x48b804['sendStatus'](0x194);}return _0x43694d;};}function handleError(_0x45f151,_0x54d1c5){_0x54d1c5=_0x54d1c5||0x1f4;return function(_0x35a291){logger[_0xb4dc('0x22')](_0x35a291['stack']);if(_0x35a291[_0xb4dc('0x23')]){delete _0x35a291[_0xb4dc('0x23')];}_0x45f151[_0xb4dc('0x17')](_0x54d1c5)[_0xb4dc('0x24')](_0x35a291);};}exports[_0xb4dc('0x25')]=function(_0x5079c9,_0x5e2a81){var _0x233590={},_0x5ddfc7={},_0xfbe27={'count':0x0,'rows':[]};var _0x2f0ce1=_[_0xb4dc('0x26')](db[_0xb4dc('0x27')][_0xb4dc('0x28')],function(_0x1079d5){return{'name':_0x1079d5[_0xb4dc('0x29')],'type':_0x1079d5['type']['key']};});_0x5ddfc7[_0xb4dc('0x2a')]=_['map'](_0x2f0ce1,_0xb4dc('0x23'));_0x5ddfc7[_0xb4dc('0x2b')]=_['keys'](_0x5079c9['query']);_0x5ddfc7[_0xb4dc('0x2c')]=_[_0xb4dc('0x2d')](_0x5ddfc7[_0xb4dc('0x2a')],_0x5ddfc7[_0xb4dc('0x2b')]);_0x233590['attributes']=_[_0xb4dc('0x2d')](_0x5ddfc7['model'],qs['fields'](_0x5079c9['query'][_0xb4dc('0x2e')]));_0x233590[_0xb4dc('0x2f')]=_0x233590['attributes'][_0xb4dc('0x30')]?_0x233590[_0xb4dc('0x2f')]:_0x5ddfc7[_0xb4dc('0x2a')];if(!_0x5079c9[_0xb4dc('0x2b')][_0xb4dc('0x31')](_0xb4dc('0x32'))){_0x233590['limit']=qs[_0xb4dc('0x33')](_0x5079c9['query']['limit']);_0x233590[_0xb4dc('0x1a')]=qs['offset'](_0x5079c9['query'][_0xb4dc('0x1a')]);}_0x233590[_0xb4dc('0x34')]=qs[_0xb4dc('0x35')](_0x5079c9['query']['sort']);_0x233590[_0xb4dc('0x36')]=qs['filters'](_[_0xb4dc('0x37')](_0x5079c9['query'],_0x5ddfc7['filters']),_0x2f0ce1);if(_0x5079c9[_0xb4dc('0x2b')][_0xb4dc('0x38')]){_0x233590[_0xb4dc('0x36')]=_[_0xb4dc('0x39')](_0x233590[_0xb4dc('0x36')],{'$or':_[_0xb4dc('0x26')](_0x2f0ce1,function(_0x180abf){if(_0x180abf['type']!==_0xb4dc('0x3a')){var _0x37ec84={};_0x37ec84[_0x180abf[_0xb4dc('0x23')]]={'$like':'%'+_0x5079c9['query']['filter']+'%'};return _0x37ec84;}})});}_0x233590=_[_0xb4dc('0x39')]({},_0x233590,_0x5079c9[_0xb4dc('0x3b')]);var _0x462d81={'where':_0x233590[_0xb4dc('0x36')]};return db['VoiceDialReport'][_0xb4dc('0x19')](_0x462d81)[_0xb4dc('0x21')](function(_0x4a151b){_0xfbe27[_0xb4dc('0x19')]=_0x4a151b;if(_0x5079c9[_0xb4dc('0x2b')][_0xb4dc('0x3c')]){_0x233590[_0xb4dc('0x3d')]=[{'all':!![]}];}return db[_0xb4dc('0x27')][_0xb4dc('0x3e')](_0x233590);})[_0xb4dc('0x21')](function(_0x36421d){_0xfbe27[_0xb4dc('0x3f')]=_0x36421d;return _0xfbe27;})[_0xb4dc('0x21')](respondWithFilteredResult(_0x5e2a81,_0x233590))[_0xb4dc('0x40')](handleError(_0x5e2a81,null));};exports[_0xb4dc('0x41')]=function(_0x5ee618,_0x150a8c){var _0x4d05c5={'raw':!![],'where':{'id':_0x5ee618[_0xb4dc('0x42')]['id']}},_0x371fea={};_0x371fea['model']=_[_0xb4dc('0x43')](db['VoiceDialReport'][_0xb4dc('0x28')]);_0x371fea[_0xb4dc('0x2b')]=_[_0xb4dc('0x43')](_0x5ee618[_0xb4dc('0x2b')]);_0x371fea[_0xb4dc('0x2c')]=_[_0xb4dc('0x2d')](_0x371fea[_0xb4dc('0x2a')],_0x371fea[_0xb4dc('0x2b')]);_0x4d05c5[_0xb4dc('0x2f')]=_[_0xb4dc('0x2d')](_0x371fea[_0xb4dc('0x2a')],qs[_0xb4dc('0x2e')](_0x5ee618[_0xb4dc('0x2b')][_0xb4dc('0x2e')]));_0x4d05c5[_0xb4dc('0x2f')]=_0x4d05c5['attributes']['length']?_0x4d05c5['attributes']:_0x371fea['model'];if(_0x5ee618[_0xb4dc('0x2b')][_0xb4dc('0x3c')]){_0x4d05c5[_0xb4dc('0x3d')]=[{'all':!![]}];}_0x4d05c5=_['merge']({},_0x4d05c5,_0x5ee618[_0xb4dc('0x3b')]);return db[_0xb4dc('0x27')][_0xb4dc('0x44')](_0x4d05c5)[_0xb4dc('0x21')](handleEntityNotFound(_0x150a8c,null))[_0xb4dc('0x21')](respondWithResult(_0x150a8c,null))[_0xb4dc('0x40')](handleError(_0x150a8c,null));};exports[_0xb4dc('0x45')]=function(_0x56e135,_0x4225aa){return db['VoiceDialReport'][_0xb4dc('0x45')](_0x56e135[_0xb4dc('0x46')],{})[_0xb4dc('0x21')](respondWithResult(_0x4225aa,0xc9))[_0xb4dc('0x40')](handleError(_0x4225aa,null));};exports['update']=function(_0x5c03fa,_0x3617fe){if(_0x5c03fa[_0xb4dc('0x46')]['id']){delete _0x5c03fa['body']['id'];}return db[_0xb4dc('0x27')]['find']({'where':{'id':_0x5c03fa[_0xb4dc('0x42')]['id']}})['then'](handleEntityNotFound(_0x3617fe,null))[_0xb4dc('0x21')](saveUpdates(_0x5c03fa[_0xb4dc('0x46')],null))[_0xb4dc('0x21')](respondWithResult(_0x3617fe,null))[_0xb4dc('0x40')](handleError(_0x3617fe,null));};exports[_0xb4dc('0x20')]=function(_0x386c6b,_0x4386df){return db['VoiceDialReport'][_0xb4dc('0x44')]({'where':{'id':_0x386c6b['params']['id']}})[_0xb4dc('0x21')](handleEntityNotFound(_0x4386df,null))[_0xb4dc('0x21')](removeEntity(_0x4386df,null))[_0xb4dc('0x40')](handleError(_0x4386df,null));};exports['describe']=function(_0x221803,_0x5d398e){return db['VoiceDialReport'][_0xb4dc('0x47')]()[_0xb4dc('0x21')](respondWithResult(_0x5d398e,null))[_0xb4dc('0x40')](handleError(_0x5d398e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a29fc3f..e36f9f5 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 _0x038b=['report_dial','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x5aa07c,_0x1723bc){var _0x38a475=function(_0x230c87){while(--_0x230c87){_0x5aa07c['push'](_0x5aa07c['shift']());}};_0x38a475(++_0x1723bc);}(_0x038b,0x156));var _0xb038=function(_0x33e537,_0x49ed6a){_0x33e537=_0x33e537-0x0;var _0x513902=_0x038b[_0x33e537];return _0x513902;};'use strict';var _=require(_0xb038('0x0'));var util=require(_0xb038('0x1'));var logger=require(_0xb038('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require(_0xb038('0x4'));var fs=require('fs');var path=require(_0xb038('0x5'));var rimraf=require(_0xb038('0x6'));var config=require(_0xb038('0x7'));var attributes=require(_0xb038('0x8'));module[_0xb038('0x9')]=function(_0x1e77c1,_0x2412b0){return _0x1e77c1['define']('VoiceDialReport',attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xeef922,_0x253e16){var _0xf1492c=function(_0x50cd35){while(--_0x50cd35){_0xeef922['push'](_0xeef922['shift']());}};_0xf1492c(++_0x253e16);}(_0x9957,0x1b8));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var rp=require(_0x7995('0x6'));var fs=require('fs');var path=require(_0x7995('0x7'));var rimraf=require(_0x7995('0x8'));var config=require(_0x7995('0x9'));var attributes=require(_0x7995('0xa'));module[_0x7995('0xb')]=function(_0x25d179,_0x585e28){return _0x25d179[_0x7995('0xc')](_0x7995('0xd'),attributes,{'tableName':_0x7995('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 23784db..b77cb25 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 _0x2cd9=['create','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','where','stringify','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateVoiceDialReport'];(function(_0x567b64,_0x32ff3b){var _0x35c391=function(_0x3908c0){while(--_0x3908c0){_0x567b64['push'](_0x567b64['shift']());}};_0x35c391(++_0x32ff3b);}(_0x2cd9,0x153));var _0x92cd=function(_0x34ed00,_0x114526){_0x34ed00=_0x34ed00-0x0;var _0x4fabf1=_0x2cd9[_0x34ed00];return _0x4fabf1;};'use strict';var _=require(_0x92cd('0x0'));var util=require(_0x92cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92cd('0x2'))['db'];var utils=require(_0x92cd('0x3'));var logger=require(_0x92cd('0x4'))(_0x92cd('0x5'));var config=require('../../config/environment');var jayson=require(_0x92cd('0x6'));var client=jayson[_0x92cd('0x7')][_0x92cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516407,_0x523467,_0x4ea46f){return new BPromise(function(_0xe11a5a,_0x400d65){return client[_0x92cd('0x9')](_0x516407,_0x4ea46f)[_0x92cd('0xa')](function(_0x2e9d7a){logger[_0x92cd('0xb')](_0x92cd('0xc'),_0x523467,'request\x20sent');logger[_0x92cd('0xd')](_0x92cd('0xe'),_0x523467,_0x92cd('0xf'),JSON['stringify'](_0x2e9d7a));if(_0x2e9d7a['error']){if(_0x2e9d7a[_0x92cd('0x10')][_0x92cd('0x11')]===0x1f4){logger[_0x92cd('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x523467,_0x2e9d7a['error']['message']);return _0x400d65(_0x2e9d7a[_0x92cd('0x10')][_0x92cd('0x12')]);}logger[_0x92cd('0x10')](_0x92cd('0xc'),_0x523467,_0x2e9d7a[_0x92cd('0x10')]['message']);return _0xe11a5a(_0x2e9d7a[_0x92cd('0x10')][_0x92cd('0x12')]);}else{logger[_0x92cd('0xb')](_0x92cd('0xc'),_0x523467,_0x92cd('0xf'));_0xe11a5a(_0x2e9d7a['result'][_0x92cd('0x12')]);}})[_0x92cd('0x13')](function(_0x44687d){logger[_0x92cd('0x10')](_0x92cd('0xc'),_0x523467,_0x44687d);_0x400d65(_0x44687d);});});}exports[_0x92cd('0x14')]=function(_0x217e66){var _0x5e0531=this;return new Promise(function(_0x17e5ca,_0x205bfb){return db['VoiceDialReport'][_0x92cd('0x15')](_0x217e66[_0x92cd('0x16')],{'raw':_0x217e66['options']?_0x217e66[_0x92cd('0x17')][_0x92cd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xa7745f){logger[_0x92cd('0xb')](_0x92cd('0x14'),_0x217e66);logger[_0x92cd('0xd')]('CreateVoiceDialReport',_0x217e66,JSON['stringify'](_0xa7745f));_0x17e5ca(_0xa7745f);})[_0x92cd('0x13')](function(_0xcdbdf5){logger[_0x92cd('0x10')]('CreateVoiceDialReport',_0xcdbdf5[_0x92cd('0x12')],_0x217e66);_0x205bfb(_0x5e0531[_0x92cd('0x10')](0x1f4,_0xcdbdf5[_0x92cd('0x12')]));});});};exports[_0x92cd('0x19')]=function(_0x3831c6){var _0x5465a3=this;return new Promise(function(_0x5f30b1,_0x13c429){return db[_0x92cd('0x1a')][_0x92cd('0x1b')](_0x3831c6[_0x92cd('0x16')],{'raw':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')][_0x92cd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')][_0x92cd('0x1c')]||null:null,'attributes':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')]['attributes']||null:null,'limit':_0x3831c6[_0x92cd('0x17')]?_0x3831c6[_0x92cd('0x17')]['limit']||null:null})[_0x92cd('0xa')](function(_0x3996be){logger['info'](_0x92cd('0x19'),_0x3831c6);logger[_0x92cd('0xd')](_0x92cd('0x19'),_0x3831c6,JSON[_0x92cd('0x1d')](_0x3996be));_0x5f30b1(_0x3996be);})[_0x92cd('0x13')](function(_0x359c06){logger['error'](_0x92cd('0x19'),_0x359c06[_0x92cd('0x12')],_0x3831c6);_0x13c429(_0x5465a3[_0x92cd('0x10')](0x1f4,_0x359c06[_0x92cd('0x12')]));});});}; \ No newline at end of file +var _0x1f40=['then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','catch','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x578c66,_0x3e090f){var _0x586aa2=function(_0x33291a){while(--_0x33291a){_0x578c66['push'](_0x578c66['shift']());}};_0x586aa2(++_0x3e090f);}(_0x1f40,0xe9));var _0x01f4=function(_0x322003,_0x516f0c){_0x322003=_0x322003-0x0;var _0x1ddab5=_0x1f40[_0x322003];return _0x1ddab5;};'use strict';var _=require(_0x01f4('0x0'));var util=require(_0x01f4('0x1'));var moment=require('moment');var BPromise=require(_0x01f4('0x2'));var rs=require(_0x01f4('0x3'));var fs=require('fs');var Redis=require(_0x01f4('0x4'));var db=require(_0x01f4('0x5'))['db'];var utils=require(_0x01f4('0x6'));var logger=require(_0x01f4('0x7'))(_0x01f4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x01f4('0x9')][_0x01f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16bba0,_0x214b66,_0x62aabf){return new BPromise(function(_0x1ebaff,_0xf2ea69){return client[_0x01f4('0xb')](_0x16bba0,_0x62aabf)[_0x01f4('0xc')](function(_0x3c3c38){logger['info'](_0x01f4('0xd'),_0x214b66,_0x01f4('0xe'));logger[_0x01f4('0xf')](_0x01f4('0x10'),_0x214b66,_0x01f4('0xe'),JSON['stringify'](_0x3c3c38));if(_0x3c3c38[_0x01f4('0x11')]){if(_0x3c3c38[_0x01f4('0x11')][_0x01f4('0x12')]===0x1f4){logger[_0x01f4('0x11')](_0x01f4('0xd'),_0x214b66,_0x3c3c38[_0x01f4('0x11')][_0x01f4('0x13')]);return _0xf2ea69(_0x3c3c38[_0x01f4('0x11')][_0x01f4('0x13')]);}logger[_0x01f4('0x11')](_0x01f4('0xd'),_0x214b66,_0x3c3c38[_0x01f4('0x11')]['message']);return _0x1ebaff(_0x3c3c38['error']['message']);}else{logger[_0x01f4('0x14')](_0x01f4('0xd'),_0x214b66,'request\x20sent');_0x1ebaff(_0x3c3c38[_0x01f4('0x15')][_0x01f4('0x13')]);}})['catch'](function(_0x1f9fc1){logger[_0x01f4('0x11')](_0x01f4('0xd'),_0x214b66,_0x1f9fc1);_0xf2ea69(_0x1f9fc1);});});}exports['CreateVoiceDialReport']=function(_0x2528d2){var _0x594176=this;return new Promise(function(_0x463db3,_0x3641b9){return db[_0x01f4('0x16')][_0x01f4('0x17')](_0x2528d2[_0x01f4('0x18')],{'raw':_0x2528d2[_0x01f4('0x19')]?_0x2528d2[_0x01f4('0x19')][_0x01f4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x385398){logger[_0x01f4('0x14')](_0x01f4('0x1b'),_0x2528d2);logger[_0x01f4('0xf')](_0x01f4('0x1b'),_0x2528d2,JSON[_0x01f4('0x1c')](_0x385398));_0x463db3(_0x385398);})[_0x01f4('0x1d')](function(_0xe480f3){logger[_0x01f4('0x11')]('CreateVoiceDialReport',_0xe480f3['message'],_0x2528d2);_0x3641b9(_0x594176['error'](0x1f4,_0xe480f3[_0x01f4('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x19beae){var _0x3c7674=this;return new Promise(function(_0x2f6c79,_0x17aab1){return db[_0x01f4('0x16')][_0x01f4('0x1e')](_0x19beae[_0x01f4('0x18')],{'raw':_0x19beae[_0x01f4('0x19')]?_0x19beae[_0x01f4('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19beae['options']?_0x19beae[_0x01f4('0x19')][_0x01f4('0x1f')]||null:null,'attributes':_0x19beae[_0x01f4('0x19')]?_0x19beae[_0x01f4('0x19')][_0x01f4('0x20')]||null:null,'limit':_0x19beae[_0x01f4('0x19')]?_0x19beae[_0x01f4('0x19')][_0x01f4('0x21')]||null:null})[_0x01f4('0xc')](function(_0x10ded6){logger['info'](_0x01f4('0x22'),_0x19beae);logger[_0x01f4('0xf')](_0x01f4('0x22'),_0x19beae,JSON['stringify'](_0x10ded6));_0x2f6c79(_0x10ded6);})[_0x01f4('0x1d')](function(_0x24c96e){logger[_0x01f4('0x11')](_0x01f4('0x22'),_0x24c96e['message'],_0x19beae);_0x17aab1(_0x3c7674[_0x01f4('0x11')](0x1f4,_0x24c96e[_0x01f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5b690c6..bf88c4e 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 _0xfb21=['Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','/:id','show','post','create','/:id/applications','put','delete','destroy','multer','util','express'];(function(_0x459631,_0x17227c){var _0x79a1c=function(_0x59c3cd){while(--_0x59c3cd){_0x459631['push'](_0x459631['shift']());}};_0x79a1c(++_0x17227c);}(_0xfb21,0xeb));var _0x1fb2=function(_0x37847f,_0x4f247a){_0x37847f=_0x37847f-0x0;var _0x4588c8=_0xfb21[_0x37847f];return _0x4588c8;};'use strict';var multer=require(_0x1fb2('0x0'));var util=require(_0x1fb2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1fb2('0x2'));var router=express[_0x1fb2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1fb2('0x4'));var config=require(_0x1fb2('0x5'));var controller=require(_0x1fb2('0x6'));router['get']('/',auth[_0x1fb2('0x7')](),controller['index']);router[_0x1fb2('0x8')](_0x1fb2('0x9'),auth['isAuthenticated'](),controller[_0x1fb2('0xa')]);router[_0x1fb2('0xb')]('/',auth[_0x1fb2('0x7')](),controller[_0x1fb2('0xc')]);router['post'](_0x1fb2('0xd'),auth[_0x1fb2('0x7')](),controller['addApplications']);router[_0x1fb2('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1fb2('0xf')](_0x1fb2('0x9'),auth['isAuthenticated'](),controller[_0x1fb2('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa938=['update','exports','multer','util','connect-timeout','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications','put'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa938,0x172));var _0x8a93=function(_0x35d376,_0x2dd421){_0x35d376=_0x35d376-0x0;var _0x9ac300=_0xa938[_0x35d376];return _0x9ac300;};'use strict';var multer=require(_0x8a93('0x0'));var util=require(_0x8a93('0x1'));var path=require('path');var timeout=require(_0x8a93('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a93('0x3'));var controller=require(_0x8a93('0x4'));router[_0x8a93('0x5')]('/',auth[_0x8a93('0x6')](),controller[_0x8a93('0x7')]);router['get'](_0x8a93('0x8'),auth['isAuthenticated'](),controller[_0x8a93('0x9')]);router[_0x8a93('0xa')]('/',auth['isAuthenticated'](),controller[_0x8a93('0xb')]);router['post']('/:id/applications',auth[_0x8a93('0x6')](),controller[_0x8a93('0xc')]);router[_0x8a93('0xd')]('/:id',auth[_0x8a93('0x6')](),controller[_0x8a93('0xe')]);router['delete'](_0x8a93('0x8'),auth[_0x8a93('0x6')](),controller['destroy']);module[_0x8a93('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ab85708..29165de 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(_0x3c4cf2,_0x11a4c5){var _0x57f90d=function(_0x2addc4){while(--_0x2addc4){_0x3c4cf2['push'](_0x3c4cf2['shift']());}};_0x57f90d(++_0x11a4c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x4f8922,_0x48c595){var _0x5f3038=function(_0x979b98){while(--_0x979b98){_0x4f8922['push'](_0x4f8922['shift']());}};_0x5f3038(++_0x48c595);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 96ebe1b..0894c4b 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 _0x9a7f=['bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','InboundRoutes','inbound','OutboundRoutes','outbound','internal','ignore','map','value','includes','type','find','name','destroy','error','stack','index','VoiceExtension','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','params','includeAll','include','startsWith','body','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','userProfileId','UserProfileResource','description','recordingFormat','mandatoryDisposition','context','addApplications','findOne','transaction','VoiceExtensionId'];(function(_0x3597d8,_0x543bbf){var _0x1f8924=function(_0x5dc7ef){while(--_0x5dc7ef){_0x3597d8['push'](_0x3597d8['shift']());}};_0x1f8924(++_0x543bbf);}(_0x9a7f,0x1a6));var _0xf9a7=function(_0x53ece1,_0x284ef0){_0x53ece1=_0x53ece1-0x0;var _0x22196c=_0x9a7f[_0x53ece1];return _0x22196c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf9a7('0x0'));var rimraf=require(_0xf9a7('0x1'));var zipdir=require(_0xf9a7('0x2'));var jsonpatch=require(_0xf9a7('0x3'));var rp=require('request-promise');var moment=require(_0xf9a7('0x4'));var BPromise=require(_0xf9a7('0x5'));var Mustache=require(_0xf9a7('0x6'));var util=require('util');var path=require(_0xf9a7('0x7'));var sox=require(_0xf9a7('0x8'));var csv=require(_0xf9a7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf9a7('0xa'));var squel=require(_0xf9a7('0xb'));var crypto=require(_0xf9a7('0xc'));var jsforce=require(_0xf9a7('0xd'));var deskjs=require(_0xf9a7('0xe'));var toCsv=require(_0xf9a7('0x9'));var querystring=require(_0xf9a7('0xf'));var Papa=require(_0xf9a7('0x10'));var Redis=require(_0xf9a7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9a7('0x12'));var hardwareService=require(_0xf9a7('0x13'));var logger=require(_0xf9a7('0x14'))('api');var utils=require(_0xf9a7('0x15'));var config=require(_0xf9a7('0x16'));var licenseUtil=require(_0xf9a7('0x17'));var db=require(_0xf9a7('0x18'))['db'];config['redis']=_['defaults'](config[_0xf9a7('0x19')],{'host':_0xf9a7('0x1a'),'port':0x18eb});var socket=require(_0xf9a7('0x1b'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xf9a7('0x1c')](socket);function respondWithStatusCode(_0x1bdfbe,_0x244115){_0x244115=_0x244115||0xcc;return function(_0x5cf264){if(_0x5cf264){return _0x1bdfbe[_0xf9a7('0x1d')](_0x244115);}return _0x1bdfbe['status'](_0x244115)['end']();};}function respondWithResult(_0x432da0,_0x188d9c){_0x188d9c=_0x188d9c||0xc8;return function(_0x463e10){if(_0x463e10){return _0x432da0[_0xf9a7('0x1e')](_0x188d9c)[_0xf9a7('0x1f')](_0x463e10);}};}function respondWithFilteredResult(_0x5d027a,_0x1fd162){return function(_0x5364c8){if(_0x5364c8){var _0x54b1d1=_0x5364c8[_0xf9a7('0x20')],_0x3f9a3f=_0x1fd162[_0xf9a7('0x21')],_0x5e4b57=_0x1fd162[_0xf9a7('0x21')]+_0x1fd162[_0xf9a7('0x22')],_0x4a24f5;if(_0x5e4b57>=_0x54b1d1){_0x5e4b57=_0x54b1d1;_0x4a24f5=0xc8;}else{_0x4a24f5=0xce;}_0x5d027a[_0xf9a7('0x1e')](_0x4a24f5);return _0x5d027a[_0xf9a7('0x23')](_0xf9a7('0x24'),_0x3f9a3f+'-'+_0x5e4b57+'/'+_0x54b1d1)[_0xf9a7('0x1f')](_0x5364c8);}return null;};}function patchUpdates(_0x2da36e){return function(_0x33f24c){try{jsonpatch[_0xf9a7('0x25')](_0x33f24c,_0x2da36e,!![]);}catch(_0x4ffadc){return BPromise[_0xf9a7('0x26')](_0x4ffadc);}return _0x33f24c[_0xf9a7('0x27')]();};}function saveUpdates(_0x20e14d,_0xea8211){return function(_0x215e57){if(_0x215e57){return _0x215e57[_0xf9a7('0x28')](_0x20e14d)[_0xf9a7('0x29')](function(_0x2a5c6a){return _0x2a5c6a;});}return null;};}function removeEntity(_0x4e4cfa,_0x5e2160){return function(_0x19c825){if(_0x19c825){return _0x19c825['destroy']()[_0xf9a7('0x29')](function(){var _0x3b9548=_0x19c825['get']({'plain':!![]});var _0x4ae90b=[{'name':_0xf9a7('0x2a'),'value':_0xf9a7('0x2b'),'ignore':![]},{'name':_0xf9a7('0x2c'),'value':_0xf9a7('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':_0xf9a7('0x2e'),'ignore':![]}];var _0x3a9613=_(_0x4ae90b)['filter'](_0xf9a7('0x2f'))[_0xf9a7('0x30')](_0xf9a7('0x31'))[_0xf9a7('0x31')]();if(_[_0xf9a7('0x32')](_0x3a9613,_0x3b9548[_0xf9a7('0x33')])){return;}var _0x49386c=_[_0xf9a7('0x34')](_0x4ae90b,[_0xf9a7('0x31'),_0x3b9548[_0xf9a7('0x33')]])[_0xf9a7('0x35')];return db['UserProfileResource'][_0xf9a7('0x36')]({'where':{'type':_0x49386c,'resourceId':_0x3b9548['id']}})[_0xf9a7('0x29')](function(){return _0x19c825;});})['then'](function(){_0x4e4cfa[_0xf9a7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x211d02,_0x39c3d7){return function(_0x497ac0){if(!_0x497ac0){_0x211d02['sendStatus'](0x194);}return _0x497ac0;};}function handleError(_0x5c280e,_0x3f0c02){_0x3f0c02=_0x3f0c02||0x1f4;return function(_0x3aac1f){logger[_0xf9a7('0x37')](_0x3aac1f[_0xf9a7('0x38')]);if(_0x3aac1f[_0xf9a7('0x35')]){delete _0x3aac1f['name'];}_0x5c280e[_0xf9a7('0x1e')](_0x3f0c02)['send'](_0x3aac1f);};}exports[_0xf9a7('0x39')]=function(_0x1ba72a,_0x1ce137){var _0x5f16ef={},_0x22f284={},_0x1b0c0c={'count':0x0,'rows':[]};var _0x58c997=_[_0xf9a7('0x30')](db[_0xf9a7('0x3a')][_0xf9a7('0x3b')],function(_0x1b7d61){return{'name':_0x1b7d61[_0xf9a7('0x3c')],'type':_0x1b7d61['type']['key']};});_0x22f284['model']=_[_0xf9a7('0x30')](_0x58c997,_0xf9a7('0x35'));_0x22f284[_0xf9a7('0x3d')]=_[_0xf9a7('0x3e')](_0x1ba72a[_0xf9a7('0x3d')]);_0x22f284[_0xf9a7('0x3f')]=_[_0xf9a7('0x40')](_0x22f284[_0xf9a7('0x41')],_0x22f284[_0xf9a7('0x3d')]);_0x5f16ef[_0xf9a7('0x42')]=_[_0xf9a7('0x40')](_0x22f284[_0xf9a7('0x41')],qs[_0xf9a7('0x43')](_0x1ba72a[_0xf9a7('0x3d')][_0xf9a7('0x43')]));_0x5f16ef[_0xf9a7('0x42')]=_0x5f16ef[_0xf9a7('0x42')][_0xf9a7('0x44')]?_0x5f16ef['attributes']:_0x22f284['model'];if(!_0x1ba72a[_0xf9a7('0x3d')][_0xf9a7('0x45')](_0xf9a7('0x46'))){_0x5f16ef[_0xf9a7('0x22')]=qs[_0xf9a7('0x22')](_0x1ba72a[_0xf9a7('0x3d')][_0xf9a7('0x22')]);_0x5f16ef[_0xf9a7('0x21')]=qs[_0xf9a7('0x21')](_0x1ba72a[_0xf9a7('0x3d')][_0xf9a7('0x21')]);}_0x5f16ef[_0xf9a7('0x47')]=qs[_0xf9a7('0x48')](_0x1ba72a[_0xf9a7('0x3d')]['sort']);_0x5f16ef[_0xf9a7('0x49')]=qs[_0xf9a7('0x3f')](_[_0xf9a7('0x4a')](_0x1ba72a['query'],_0x22f284[_0xf9a7('0x3f')]),_0x58c997);if(_0x1ba72a['query'][_0xf9a7('0x4b')]){_0x5f16ef[_0xf9a7('0x49')]=_['merge'](_0x5f16ef['where'],{'$or':_['map'](_0x58c997,function(_0x24f453){if(_0x24f453[_0xf9a7('0x33')]!=='VIRTUAL'){var _0x2794d4={};_0x2794d4[_0x24f453[_0xf9a7('0x35')]]={'$like':'%'+_0x1ba72a[_0xf9a7('0x3d')][_0xf9a7('0x4b')]+'%'};return _0x2794d4;}})});}_0x5f16ef=_[_0xf9a7('0x4c')]({},_0x5f16ef,_0x1ba72a[_0xf9a7('0x4d')]);var _0x34bbb8={'where':_0x5f16ef['where']};return db[_0xf9a7('0x3a')][_0xf9a7('0x20')](_0x34bbb8)['then'](function(_0x431b16){_0x1b0c0c[_0xf9a7('0x20')]=_0x431b16;if(_0x1ba72a[_0xf9a7('0x3d')]['includeAll']){_0x5f16ef['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xf9a7('0x4e')](_0x5f16ef);})[_0xf9a7('0x29')](function(_0x34388a){_0x1b0c0c[_0xf9a7('0x4f')]=_0x34388a;return _0x1b0c0c;})[_0xf9a7('0x29')](respondWithFilteredResult(_0x1ce137,_0x5f16ef))[_0xf9a7('0x50')](handleError(_0x1ce137,null));};exports['show']=function(_0x46df45,_0x3b8d8b){var _0x2208c9={'raw':![],'where':{'id':_0x46df45[_0xf9a7('0x51')]['id']}},_0x16d9ba={};_0x16d9ba[_0xf9a7('0x41')]=_[_0xf9a7('0x3e')](db[_0xf9a7('0x3a')]['rawAttributes']);_0x16d9ba['query']=_[_0xf9a7('0x3e')](_0x46df45[_0xf9a7('0x3d')]);_0x16d9ba[_0xf9a7('0x3f')]=_['intersection'](_0x16d9ba['model'],_0x16d9ba['query']);_0x2208c9[_0xf9a7('0x42')]=_[_0xf9a7('0x40')](_0x16d9ba[_0xf9a7('0x41')],qs[_0xf9a7('0x43')](_0x46df45[_0xf9a7('0x3d')][_0xf9a7('0x43')]));_0x2208c9[_0xf9a7('0x42')]=_0x2208c9['attributes'][_0xf9a7('0x44')]?_0x2208c9['attributes']:_0x16d9ba[_0xf9a7('0x41')];if(_0x46df45[_0xf9a7('0x3d')][_0xf9a7('0x52')]){_0x2208c9[_0xf9a7('0x53')]=[{'all':!![]}];}_0x2208c9=_[_0xf9a7('0x4c')]({},_0x2208c9,_0x46df45[_0xf9a7('0x4d')]);return db[_0xf9a7('0x3a')][_0xf9a7('0x34')](_0x2208c9)['then'](handleEntityNotFound(_0x3b8d8b,null))[_0xf9a7('0x29')](respondWithResult(_0x3b8d8b,null))['catch'](handleError(_0x3b8d8b,null));};exports[_0xf9a7('0x36')]=function(_0x11948a,_0xbbdaa6){return db[_0xf9a7('0x3a')][_0xf9a7('0x34')]({'where':{'id':_0x11948a[_0xf9a7('0x51')]['id']}})[_0xf9a7('0x29')](handleEntityNotFound(_0xbbdaa6,null))[_0xf9a7('0x29')](removeEntity(_0xbbdaa6,null))[_0xf9a7('0x50')](handleError(_0xbbdaa6,null));};exports['create']=function(_0x252459,_0x40a21e){if(_0x252459['body'][_0xf9a7('0x33')]===_0xf9a7('0x2d')&&!_[_0xf9a7('0x54')](_0x252459[_0xf9a7('0x55')][_0xf9a7('0x56')],'_')){_0x252459[_0xf9a7('0x55')][_0xf9a7('0x56')]='_'[_0xf9a7('0x57')](_0x252459[_0xf9a7('0x55')]['exten']);}return db['VoiceExtension'][_0xf9a7('0x58')](_0x252459['body'],{'raw':![]})[_0xf9a7('0x29')](function(_0x56852c){var _0x45efea=_0x252459[_0xf9a7('0x59')]['get']({'plain':!![]});if(!_0x45efea)throw new Error(_0xf9a7('0x5a'));if(_0x45efea[_0xf9a7('0x5b')]==='user'){var _0xa55d87=_0x56852c['get']({'plain':!![]});var _0x49fb5e=[{'name':_0xf9a7('0x2a'),'value':_0xf9a7('0x2b')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xf9a7('0x5c'),'value':_0xf9a7('0x2e')}];var _0x4b6ad6=_[_0xf9a7('0x34')](_0x49fb5e,['value',_0xa55d87[_0xf9a7('0x33')]])[_0xf9a7('0x35')];return db['UserProfileSection']['find']({'where':{'name':_0x4b6ad6,'userProfileId':_0x45efea[_0xf9a7('0x5d')]},'raw':!![]})['then'](function(_0x35b819){if(_0x35b819&&_0x35b819['autoAssociation']===0x0){return db[_0xf9a7('0x5e')][_0xf9a7('0x58')]({'name':_0xa55d87[_0xf9a7('0x35')],'resourceId':_0xa55d87['id'],'type':_0x35b819[_0xf9a7('0x35')],'sectionId':_0x35b819['id']},{})[_0xf9a7('0x29')](function(){return _0x56852c;});}else{return _0x56852c;}})[_0xf9a7('0x50')](function(_0x3e3b30){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e3b30);throw _0x3e3b30;});}return _0x56852c;})[_0xf9a7('0x29')](respondWithResult(_0x40a21e,0xc9))[_0xf9a7('0x50')](handleError(_0x40a21e,null));};exports[_0xf9a7('0x28')]=function(_0x23964f,_0x40b097){if(_0x23964f[_0xf9a7('0x55')]['id']){delete _0x23964f[_0xf9a7('0x55')]['id'];}return db[_0xf9a7('0x3a')][_0xf9a7('0x34')]({'where':{'id':_0x23964f[_0xf9a7('0x51')]['id']}})[_0xf9a7('0x29')](handleEntityNotFound(_0x40b097,null))[_0xf9a7('0x29')](function(_0x5281ac){if(_0x5281ac){return db[_0xf9a7('0x3a')]['update'](_[_0xf9a7('0x4a')](_0x23964f['body'],[_0xf9a7('0x56'),'context',_0xf9a7('0x5f'),_0xf9a7('0x60'),'cutdigits',_0xf9a7('0x61')]),{'where':{'context':_0x5281ac[_0xf9a7('0x62')],'exten':_0x5281ac[_0xf9a7('0x56')]},'individualHooks':!![]})[_0xf9a7('0x29')](function(_0x74bd2f){return _0x74bd2f;});}return null;})[_0xf9a7('0x29')](respondWithStatusCode(_0x40b097,null))[_0xf9a7('0x50')](handleError(_0x40b097,null));};exports[_0xf9a7('0x63')]=function(_0x1e0db5,_0x18ce10,_0x1dd134){return db['VoiceExtension'][_0xf9a7('0x64')]({'where':{'id':_0x1e0db5[_0xf9a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x18ce10,null))[_0xf9a7('0x29')](function(_0x969fed){if(_0x969fed){return db['sequelize'][_0xf9a7('0x65')](function(_0x547c10){return db[_0xf9a7('0x3a')][_0xf9a7('0x36')]({'where':{'VoiceExtensionId':_0x1e0db5[_0xf9a7('0x51')]['id']},'transaction':_0x547c10})[_0xf9a7('0x29')](function(_0x7a15b2){var _0x2e1ce6=_[_0xf9a7('0x30')](_0x1e0db5[_0xf9a7('0x55')],function(_0x5b79a7){_0x5b79a7[_0xf9a7('0x66')]=_0x1e0db5[_0xf9a7('0x51')]['id'];return _0x5b79a7;});return db[_0xf9a7('0x3a')][_0xf9a7('0x67')](_0x2e1ce6,{'transaction':_0x547c10});});})[_0xf9a7('0x29')](function(){return db[_0xf9a7('0x3a')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1e0db5[_0xf9a7('0x51')]['id']},'order':_0xf9a7('0x68')});});}})[_0xf9a7('0x29')](respondWithResult(_0x18ce10,null))[_0xf9a7('0x50')](handleError(_0x18ce10,null));}; \ No newline at end of file +var _0xe5ca=['sequelize','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','count','offset','set','json','save','update','then','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','error','stack','send','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','merge','options','VoiceExtension','include','findAll','rows','catch','show','params','includeAll','create','body','startsWith','exten','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','mandatoryDisposition','context','findOne'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xe5ca,0xd2));var _0xae5c=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0xe5ca[_0x1667df];return _0x341abf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae5c('0x0'));var rimraf=require(_0xae5c('0x1'));var zipdir=require(_0xae5c('0x2'));var jsonpatch=require(_0xae5c('0x3'));var rp=require('request-promise');var moment=require(_0xae5c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xae5c('0x5'));var util=require(_0xae5c('0x6'));var path=require(_0xae5c('0x7'));var sox=require(_0xae5c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xae5c('0x9'));var squel=require(_0xae5c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xae5c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xae5c('0xc'));var Papa=require(_0xae5c('0xd'));var Redis=require(_0xae5c('0xe'));var authService=require(_0xae5c('0xf'));var qs=require(_0xae5c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae5c('0x11'));var logger=require('../../config/logger')(_0xae5c('0x12'));var utils=require(_0xae5c('0x13'));var config=require(_0xae5c('0x14'));var licenseUtil=require(_0xae5c('0x15'));var db=require(_0xae5c('0x16'))['db'];config[_0xae5c('0x17')]=_['defaults'](config[_0xae5c('0x17')],{'host':_0xae5c('0x18'),'port':0x18eb});var socket=require(_0xae5c('0x19'))(new Redis(config['redis']));require(_0xae5c('0x1a'))[_0xae5c('0x1b')](socket);function respondWithStatusCode(_0x41506b,_0x3c2afe){_0x3c2afe=_0x3c2afe||0xcc;return function(_0xc3b076){if(_0xc3b076){return _0x41506b[_0xae5c('0x1c')](_0x3c2afe);}return _0x41506b[_0xae5c('0x1d')](_0x3c2afe)[_0xae5c('0x1e')]();};}function respondWithResult(_0x19f717,_0x17edca){_0x17edca=_0x17edca||0xc8;return function(_0x854db1){if(_0x854db1){return _0x19f717['status'](_0x17edca)['json'](_0x854db1);}};}function respondWithFilteredResult(_0x15aa7c,_0x3addc6){return function(_0x16a10){if(_0x16a10){var _0x7be7ef=_0x16a10[_0xae5c('0x1f')],_0x18e019=_0x3addc6[_0xae5c('0x20')],_0x1f779d=_0x3addc6['offset']+_0x3addc6['limit'],_0x1eca56;if(_0x1f779d>=_0x7be7ef){_0x1f779d=_0x7be7ef;_0x1eca56=0xc8;}else{_0x1eca56=0xce;}_0x15aa7c['status'](_0x1eca56);return _0x15aa7c[_0xae5c('0x21')]('Content-Range',_0x18e019+'-'+_0x1f779d+'/'+_0x7be7ef)[_0xae5c('0x22')](_0x16a10);}return null;};}function patchUpdates(_0x580dac){return function(_0x4e7ca2){try{jsonpatch['apply'](_0x4e7ca2,_0x580dac,!![]);}catch(_0x9144d6){return BPromise['reject'](_0x9144d6);}return _0x4e7ca2[_0xae5c('0x23')]();};}function saveUpdates(_0x361242,_0x339a53){return function(_0x15fd7e){if(_0x15fd7e){return _0x15fd7e[_0xae5c('0x24')](_0x361242)[_0xae5c('0x25')](function(_0x4f362f){return _0x4f362f;});}return null;};}function removeEntity(_0xe482e1,_0x46d107){return function(_0x29011d){if(_0x29011d){return _0x29011d[_0xae5c('0x26')]()[_0xae5c('0x25')](function(){var _0xfb715=_0x29011d['get']({'plain':!![]});var _0x498357=[{'name':_0xae5c('0x27'),'value':_0xae5c('0x28'),'ignore':![]},{'name':_0xae5c('0x29'),'value':_0xae5c('0x2a'),'ignore':![]},{'name':_0xae5c('0x2b'),'value':_0xae5c('0x2c'),'ignore':![]}];var _0x5775ba=_(_0x498357)[_0xae5c('0x2d')](_0xae5c('0x2e'))[_0xae5c('0x2f')](_0xae5c('0x30'))['value']();if(_[_0xae5c('0x31')](_0x5775ba,_0xfb715[_0xae5c('0x32')])){return;}var _0x2e9e97=_[_0xae5c('0x33')](_0x498357,[_0xae5c('0x30'),_0xfb715['type']])[_0xae5c('0x34')];return db['UserProfileResource'][_0xae5c('0x26')]({'where':{'type':_0x2e9e97,'resourceId':_0xfb715['id']}})['then'](function(){return _0x29011d;});})[_0xae5c('0x25')](function(){_0xe482e1['status'](0xcc)[_0xae5c('0x1e')]();});}};}function handleEntityNotFound(_0x59fb1,_0x158ce1){return function(_0x33e74d){if(!_0x33e74d){_0x59fb1[_0xae5c('0x1c')](0x194);}return _0x33e74d;};}function handleError(_0x2fa650,_0x1472f0){_0x1472f0=_0x1472f0||0x1f4;return function(_0x1da02d){logger[_0xae5c('0x35')](_0x1da02d[_0xae5c('0x36')]);if(_0x1da02d[_0xae5c('0x34')]){delete _0x1da02d['name'];}_0x2fa650['status'](_0x1472f0)[_0xae5c('0x37')](_0x1da02d);};}exports['index']=function(_0x197202,_0x2a91ef){var _0x43abd0={},_0x2297c8={},_0x26897d={'count':0x0,'rows':[]};var _0x159d43=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x1426ba){return{'name':_0x1426ba[_0xae5c('0x38')],'type':_0x1426ba[_0xae5c('0x32')][_0xae5c('0x39')]};});_0x2297c8[_0xae5c('0x3a')]=_[_0xae5c('0x2f')](_0x159d43,'name');_0x2297c8[_0xae5c('0x3b')]=_[_0xae5c('0x3c')](_0x197202[_0xae5c('0x3b')]);_0x2297c8[_0xae5c('0x3d')]=_[_0xae5c('0x3e')](_0x2297c8['model'],_0x2297c8[_0xae5c('0x3b')]);_0x43abd0[_0xae5c('0x3f')]=_['intersection'](_0x2297c8[_0xae5c('0x3a')],qs[_0xae5c('0x40')](_0x197202[_0xae5c('0x3b')][_0xae5c('0x40')]));_0x43abd0[_0xae5c('0x3f')]=_0x43abd0[_0xae5c('0x3f')][_0xae5c('0x41')]?_0x43abd0[_0xae5c('0x3f')]:_0x2297c8['model'];if(!_0x197202[_0xae5c('0x3b')][_0xae5c('0x42')](_0xae5c('0x43'))){_0x43abd0[_0xae5c('0x44')]=qs['limit'](_0x197202[_0xae5c('0x3b')]['limit']);_0x43abd0[_0xae5c('0x20')]=qs[_0xae5c('0x20')](_0x197202[_0xae5c('0x3b')][_0xae5c('0x20')]);}_0x43abd0['order']=qs[_0xae5c('0x45')](_0x197202[_0xae5c('0x3b')][_0xae5c('0x45')]);_0x43abd0[_0xae5c('0x46')]=qs[_0xae5c('0x3d')](_[_0xae5c('0x47')](_0x197202[_0xae5c('0x3b')],_0x2297c8[_0xae5c('0x3d')]),_0x159d43);if(_0x197202[_0xae5c('0x3b')][_0xae5c('0x2d')]){_0x43abd0[_0xae5c('0x46')]=_['merge'](_0x43abd0['where'],{'$or':_[_0xae5c('0x2f')](_0x159d43,function(_0x37ff9a){if(_0x37ff9a[_0xae5c('0x32')]!==_0xae5c('0x48')){var _0x23e576={};_0x23e576[_0x37ff9a['name']]={'$like':'%'+_0x197202[_0xae5c('0x3b')]['filter']+'%'};return _0x23e576;}})});}_0x43abd0=_[_0xae5c('0x49')]({},_0x43abd0,_0x197202[_0xae5c('0x4a')]);var _0x749cfe={'where':_0x43abd0['where']};return db[_0xae5c('0x4b')]['count'](_0x749cfe)[_0xae5c('0x25')](function(_0x4a6c79){_0x26897d['count']=_0x4a6c79;if(_0x197202[_0xae5c('0x3b')]['includeAll']){_0x43abd0[_0xae5c('0x4c')]=[{'all':!![]}];}return db[_0xae5c('0x4b')][_0xae5c('0x4d')](_0x43abd0);})[_0xae5c('0x25')](function(_0x1ec4ff){_0x26897d[_0xae5c('0x4e')]=_0x1ec4ff;return _0x26897d;})[_0xae5c('0x25')](respondWithFilteredResult(_0x2a91ef,_0x43abd0))[_0xae5c('0x4f')](handleError(_0x2a91ef,null));};exports[_0xae5c('0x50')]=function(_0xad65ae,_0x13cbff){var _0x355c3e={'raw':![],'where':{'id':_0xad65ae[_0xae5c('0x51')]['id']}},_0x57e75e={};_0x57e75e[_0xae5c('0x3a')]=_[_0xae5c('0x3c')](db[_0xae5c('0x4b')]['rawAttributes']);_0x57e75e[_0xae5c('0x3b')]=_[_0xae5c('0x3c')](_0xad65ae[_0xae5c('0x3b')]);_0x57e75e['filters']=_[_0xae5c('0x3e')](_0x57e75e[_0xae5c('0x3a')],_0x57e75e[_0xae5c('0x3b')]);_0x355c3e[_0xae5c('0x3f')]=_[_0xae5c('0x3e')](_0x57e75e['model'],qs[_0xae5c('0x40')](_0xad65ae[_0xae5c('0x3b')][_0xae5c('0x40')]));_0x355c3e[_0xae5c('0x3f')]=_0x355c3e[_0xae5c('0x3f')]['length']?_0x355c3e['attributes']:_0x57e75e[_0xae5c('0x3a')];if(_0xad65ae[_0xae5c('0x3b')][_0xae5c('0x52')]){_0x355c3e['include']=[{'all':!![]}];}_0x355c3e=_['merge']({},_0x355c3e,_0xad65ae[_0xae5c('0x4a')]);return db[_0xae5c('0x4b')][_0xae5c('0x33')](_0x355c3e)['then'](handleEntityNotFound(_0x13cbff,null))[_0xae5c('0x25')](respondWithResult(_0x13cbff,null))['catch'](handleError(_0x13cbff,null));};exports[_0xae5c('0x26')]=function(_0x334aee,_0x352201){return db[_0xae5c('0x4b')][_0xae5c('0x33')]({'where':{'id':_0x334aee[_0xae5c('0x51')]['id']}})[_0xae5c('0x25')](handleEntityNotFound(_0x352201,null))[_0xae5c('0x25')](removeEntity(_0x352201,null))[_0xae5c('0x4f')](handleError(_0x352201,null));};exports[_0xae5c('0x53')]=function(_0x3aef0f,_0x34656a){if(_0x3aef0f[_0xae5c('0x54')][_0xae5c('0x32')]===_0xae5c('0x2a')&&!_[_0xae5c('0x55')](_0x3aef0f['body'][_0xae5c('0x56')],'_')){_0x3aef0f['body']['exten']='_'['concat'](_0x3aef0f[_0xae5c('0x54')]['exten']);}return db['VoiceExtension']['create'](_0x3aef0f['body'],{'raw':![]})[_0xae5c('0x25')](function(_0x24dd4b){var _0x4b755f=_0x3aef0f[_0xae5c('0x57')][_0xae5c('0x58')]({'plain':!![]});if(!_0x4b755f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b755f['role']===_0xae5c('0x57')){var _0x40db78=_0x24dd4b[_0xae5c('0x58')]({'plain':!![]});var _0x17876b=[{'name':_0xae5c('0x27'),'value':_0xae5c('0x28')},{'name':'OutboundRoutes','value':_0xae5c('0x2a')},{'name':_0xae5c('0x2b'),'value':_0xae5c('0x2c')}];var _0xc169b4=_['find'](_0x17876b,['value',_0x40db78['type']])['name'];return db[_0xae5c('0x59')]['find']({'where':{'name':_0xc169b4,'userProfileId':_0x4b755f[_0xae5c('0x5a')]},'raw':!![]})[_0xae5c('0x25')](function(_0x48891b){if(_0x48891b&&_0x48891b['autoAssociation']===0x0){return db[_0xae5c('0x5b')][_0xae5c('0x53')]({'name':_0x40db78[_0xae5c('0x34')],'resourceId':_0x40db78['id'],'type':_0x48891b[_0xae5c('0x34')],'sectionId':_0x48891b['id']},{})[_0xae5c('0x25')](function(){return _0x24dd4b;});}else{return _0x24dd4b;}})['catch'](function(_0x23d126){logger[_0xae5c('0x35')](_0xae5c('0x5c'),_0x23d126);throw _0x23d126;});}return _0x24dd4b;})[_0xae5c('0x25')](respondWithResult(_0x34656a,0xc9))['catch'](handleError(_0x34656a,null));};exports[_0xae5c('0x24')]=function(_0x18f9f5,_0x5ef01a){if(_0x18f9f5[_0xae5c('0x54')]['id']){delete _0x18f9f5[_0xae5c('0x54')]['id'];}return db[_0xae5c('0x4b')][_0xae5c('0x33')]({'where':{'id':_0x18f9f5['params']['id']}})['then'](handleEntityNotFound(_0x5ef01a,null))[_0xae5c('0x25')](function(_0x372718){if(_0x372718){return db['VoiceExtension'][_0xae5c('0x24')](_[_0xae5c('0x47')](_0x18f9f5[_0xae5c('0x54')],[_0xae5c('0x56'),'context',_0xae5c('0x5d'),_0xae5c('0x5e'),_0xae5c('0x5f'),_0xae5c('0x60')]),{'where':{'context':_0x372718[_0xae5c('0x61')],'exten':_0x372718[_0xae5c('0x56')]},'individualHooks':!![]})['then'](function(_0x45ce82){return _0x45ce82;});}return null;})[_0xae5c('0x25')](respondWithStatusCode(_0x5ef01a,null))[_0xae5c('0x4f')](handleError(_0x5ef01a,null));};exports['addApplications']=function(_0x1adaae,_0x5747ae,_0x46efc1){return db['VoiceExtension'][_0xae5c('0x62')]({'where':{'id':_0x1adaae[_0xae5c('0x51')]['id']}})['then'](handleEntityNotFound(_0x5747ae,null))[_0xae5c('0x25')](function(_0x1ce2d5){if(_0x1ce2d5){return db[_0xae5c('0x63')]['transaction'](function(_0xec1dd3){return db[_0xae5c('0x4b')][_0xae5c('0x26')]({'where':{'VoiceExtensionId':_0x1adaae['params']['id']},'transaction':_0xec1dd3})[_0xae5c('0x25')](function(_0xd10e4){var _0x39c315=_[_0xae5c('0x2f')](_0x1adaae[_0xae5c('0x54')],function(_0x344fe7){_0x344fe7[_0xae5c('0x64')]=_0x1adaae[_0xae5c('0x51')]['id'];return _0x344fe7;});return db['VoiceExtension']['bulkCreate'](_0x39c315,{'transaction':_0xec1dd3});});})[_0xae5c('0x25')](function(){return db['VoiceExtension'][_0xae5c('0x65')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1adaae[_0xae5c('0x51')]['id']},'order':_0xae5c('0x66')});});}})['then'](respondWithResult(_0x5747ae,null))[_0xae5c('0x4f')](handleError(_0x5747ae,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e91f00e..a515bd4 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 _0x5ca2=['exports','../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x17792a,_0x41df2f){var _0xe7344=function(_0x3554d9){while(--_0x3554d9){_0x17792a['push'](_0x17792a['shift']());}};_0xe7344(++_0x41df2f);}(_0x5ca2,0xc7));var _0x25ca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5ca2[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x25ca('0x0'))['db'][_0x25ca('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x25ca('0x2')](0x0);var events={'afterCreate':_0x25ca('0x3'),'afterUpdate':'update','afterDestroy':_0x25ca('0x4')};function emitEvent(_0x29d6e3){return function(_0x9e3529,_0xa35a23,_0x2759c9){VoiceExtensionEvents[_0x25ca('0x5')](_0x29d6e3+':'+_0x9e3529['id'],_0x9e3529);VoiceExtensionEvents[_0x25ca('0x5')](_0x29d6e3,_0x9e3529);_0x2759c9(null);};}for(var e in events){if(events[_0x25ca('0x6')](e)){var event=events[e];VoiceExtension[_0x25ca('0x7')](e,emitEvent(event));}}module[_0x25ca('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3391=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x3391,0x13f));var _0x1339=function(_0x126a48,_0x146573){_0x126a48=_0x126a48-0x0;var _0x54e91b=_0x3391[_0x126a48];return _0x54e91b;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x1339('0x0'))['db'][_0x1339('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1339('0x2')](0x0);var events={'afterCreate':_0x1339('0x3'),'afterUpdate':_0x1339('0x4'),'afterDestroy':_0x1339('0x5')};function emitEvent(_0x3ef186){return function(_0x525964,_0x1f0b94,_0x3b7b0a){VoiceExtensionEvents['emit'](_0x3ef186+':'+_0x525964['id'],_0x525964);VoiceExtensionEvents[_0x1339('0x6')](_0x3ef186,_0x525964);_0x3b7b0a(null);};}for(var e in events){if(events[_0x1339('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b783fa7..6d0875f 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 _0xa298=['api','moment','rimraf','../../config/environment','./voiceExtension.attributes','define','VoiceExtension','util','../../config/logger'];(function(_0x53760a,_0x261b0a){var _0x235036=function(_0x3003f5){while(--_0x3003f5){_0x53760a['push'](_0x53760a['shift']());}};_0x235036(++_0x261b0a);}(_0xa298,0x1db));var _0x8a29=function(_0x3d6745,_0x591e49){_0x3d6745=_0x3d6745-0x0;var _0x1a28e1=_0xa298[_0x3d6745];return _0x1a28e1;};'use strict';var _=require('lodash');var util=require(_0x8a29('0x0'));var logger=require(_0x8a29('0x1'))(_0x8a29('0x2'));var moment=require(_0x8a29('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a29('0x4'));var config=require(_0x8a29('0x5'));var attributes=require(_0x8a29('0x6'));module['exports']=function(_0x110566,_0x4823b3){return _0x110566[_0x8a29('0x7')](_0x8a29('0x8'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x428b=['bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','voice_extensions','lodash','api'];(function(_0x356a36,_0x1999c8){var _0x3d9a0e=function(_0x1fe50e){while(--_0x1fe50e){_0x356a36['push'](_0x356a36['shift']());}};_0x3d9a0e(++_0x1999c8);}(_0x428b,0x11e));var _0xb428=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x428b[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xb428('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb428('0x1'));var moment=require('moment');var BPromise=require(_0xb428('0x2'));var rp=require(_0xb428('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb428('0x4'));var config=require(_0xb428('0x5'));var attributes=require(_0xb428('0x6'));module[_0xb428('0x7')]=function(_0x4cac59,_0x6cf838){return _0x4cac59['define']('VoiceExtension',attributes,{'tableName':_0xb428('0x8'),'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 3b4a4c7..bf64094 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 _0xceaf=['localhost','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x48b324,_0x52ce06){var _0x4b337f=function(_0x136cbb){while(--_0x136cbb){_0x48b324['push'](_0x48b324['shift']());}};_0x4b337f(++_0x52ce06);}(_0xceaf,0x174));var _0xfcea=function(_0x181389,_0x26225d){_0x181389=_0x181389-0x0;var _0x5ec6d4=_0xceaf[_0x181389];return _0x5ec6d4;};'use strict';var _=require('lodash');var util=require(_0xfcea('0x0'));var moment=require(_0xfcea('0x1'));var BPromise=require(_0xfcea('0x2'));var rs=require(_0xfcea('0x3'));var fs=require('fs');var Redis=require(_0xfcea('0x4'));var db=require(_0xfcea('0x5'))['db'];var utils=require(_0xfcea('0x6'));var logger=require(_0xfcea('0x7'))('rpc');var config=require(_0xfcea('0x8'));var jayson=require(_0xfcea('0x9'));var client=jayson['client'][_0xfcea('0xa')]({'port':0x232a});config[_0xfcea('0xb')]=_[_0xfcea('0xc')](config['redis'],{'host':_0xfcea('0xd'),'port':0x18eb});var socket=require(_0xfcea('0xe'))(new Redis(config[_0xfcea('0xb')]));require('./voiceExtension.socket')[_0xfcea('0xf')](socket);function respondWithRpcPromise(_0x314406,_0x17144c,_0x5f2763){return new BPromise(function(_0x311cfc,_0x5ce07d){return client['request'](_0x314406,_0x5f2763)[_0xfcea('0x10')](function(_0x3e4102){logger[_0xfcea('0x11')](_0xfcea('0x12'),_0x17144c,'request\x20sent');logger[_0xfcea('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x17144c,_0xfcea('0x14'),JSON[_0xfcea('0x15')](_0x3e4102));if(_0x3e4102['error']){if(_0x3e4102[_0xfcea('0x16')]['code']===0x1f4){logger['error'](_0xfcea('0x12'),_0x17144c,_0x3e4102[_0xfcea('0x16')][_0xfcea('0x17')]);return _0x5ce07d(_0x3e4102[_0xfcea('0x16')][_0xfcea('0x17')]);}logger[_0xfcea('0x16')](_0xfcea('0x12'),_0x17144c,_0x3e4102['error'][_0xfcea('0x17')]);return _0x311cfc(_0x3e4102['error'][_0xfcea('0x17')]);}else{logger['info'](_0xfcea('0x12'),_0x17144c,'request\x20sent');_0x311cfc(_0x3e4102[_0xfcea('0x18')]['message']);}})[_0xfcea('0x19')](function(_0x911a8f){logger['error'](_0xfcea('0x12'),_0x17144c,_0x911a8f);_0x5ce07d(_0x911a8f);});});}exports[_0xfcea('0x1a')]=function(_0x485a70){var _0x183ce3=this;return new Promise(function(_0x4496c1,_0xd498b9){return db[_0xfcea('0x1b')]['findAll']({'raw':_0x485a70[_0xfcea('0x1c')]?_0x485a70[_0xfcea('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x485a70[_0xfcea('0x1c')]?_0x485a70['options'][_0xfcea('0x1d')]||null:null,'attributes':_0x485a70['options']?_0x485a70[_0xfcea('0x1c')][_0xfcea('0x1e')]||null:null,'limit':_0x485a70[_0xfcea('0x1c')]?_0x485a70['options'][_0xfcea('0x1f')]||null:null,'include':_0x485a70[_0xfcea('0x1c')]?_0x485a70[_0xfcea('0x1c')][_0xfcea('0x20')]?_[_0xfcea('0x21')](_0x485a70[_0xfcea('0x1c')][_0xfcea('0x20')],function(_0x187e7c){return{'model':db[_0x187e7c['model']],'as':_0x187e7c['as'],'attributes':_0x187e7c['attributes'],'include':_0x187e7c[_0xfcea('0x20')]?_[_0xfcea('0x21')](_0x187e7c['include'],function(_0x454c6e){return{'model':db[_0x454c6e[_0xfcea('0x22')]],'as':_0x454c6e['as'],'attributes':_0x454c6e[_0xfcea('0x1e')],'include':_0x454c6e['include']?_[_0xfcea('0x21')](_0x454c6e['include'],function(_0x2340c1){return{'model':db[_0x2340c1['model']],'as':_0x2340c1['as'],'attributes':_0x2340c1['attributes']};}):[]};}):[]};}):[]:[]})[_0xfcea('0x10')](function(_0x2c0519){logger[_0xfcea('0x11')](_0xfcea('0x1a'),_0x485a70);logger[_0xfcea('0x13')](_0xfcea('0x1a'),_0x485a70,JSON['stringify'](_0x2c0519));_0x4496c1(_0x2c0519);})[_0xfcea('0x19')](function(_0x1c9e19){logger[_0xfcea('0x16')](_0xfcea('0x1a'),_0x1c9e19[_0xfcea('0x17')],_0x485a70);_0xd498b9(_0x183ce3['error'](0x1f4,_0x1c9e19[_0xfcea('0x17')]));});});}; \ No newline at end of file +var _0x1a79=['stringify','error','code','message','result','catch','GetVoiceExtension','options','raw','attributes','include','model','map','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x136886,_0x592234){var _0x1ae2e5=function(_0x2acc60){while(--_0x2acc60){_0x136886['push'](_0x136886['shift']());}};_0x1ae2e5(++_0x592234);}(_0x1a79,0x161));var _0x91a7=function(_0x255a99,_0x13476a){_0x255a99=_0x255a99-0x0;var _0x1a2ac7=_0x1a79[_0x255a99];return _0x1a2ac7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x91a7('0x0'));var BPromise=require('bluebird');var rs=require(_0x91a7('0x1'));var fs=require('fs');var Redis=require(_0x91a7('0x2'));var db=require(_0x91a7('0x3'))['db'];var utils=require(_0x91a7('0x4'));var logger=require(_0x91a7('0x5'))('rpc');var config=require(_0x91a7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x91a7('0x7')][_0x91a7('0x8')]({'port':0x232a});config[_0x91a7('0x9')]=_[_0x91a7('0xa')](config[_0x91a7('0x9')],{'host':_0x91a7('0xb'),'port':0x18eb});var socket=require(_0x91a7('0xc'))(new Redis(config[_0x91a7('0x9')]));require('./voiceExtension.socket')[_0x91a7('0xd')](socket);function respondWithRpcPromise(_0x5dbba5,_0x33ffa4,_0x29fd2f){return new BPromise(function(_0x39f195,_0x565cf1){return client[_0x91a7('0xe')](_0x5dbba5,_0x29fd2f)[_0x91a7('0xf')](function(_0x5cd025){logger[_0x91a7('0x10')](_0x91a7('0x11'),_0x33ffa4,_0x91a7('0x12'));logger[_0x91a7('0x13')](_0x91a7('0x14'),_0x33ffa4,_0x91a7('0x12'),JSON[_0x91a7('0x15')](_0x5cd025));if(_0x5cd025['error']){if(_0x5cd025[_0x91a7('0x16')][_0x91a7('0x17')]===0x1f4){logger[_0x91a7('0x16')](_0x91a7('0x11'),_0x33ffa4,_0x5cd025[_0x91a7('0x16')][_0x91a7('0x18')]);return _0x565cf1(_0x5cd025['error']['message']);}logger[_0x91a7('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x33ffa4,_0x5cd025['error'][_0x91a7('0x18')]);return _0x39f195(_0x5cd025[_0x91a7('0x16')][_0x91a7('0x18')]);}else{logger[_0x91a7('0x10')](_0x91a7('0x11'),_0x33ffa4,'request\x20sent');_0x39f195(_0x5cd025[_0x91a7('0x19')][_0x91a7('0x18')]);}})[_0x91a7('0x1a')](function(_0x310b70){logger[_0x91a7('0x16')](_0x91a7('0x11'),_0x33ffa4,_0x310b70);_0x565cf1(_0x310b70);});});}exports[_0x91a7('0x1b')]=function(_0x22a05b){var _0x2a545a=this;return new Promise(function(_0x4b4f7b,_0x5386c9){return db['VoiceExtension']['findAll']({'raw':_0x22a05b[_0x91a7('0x1c')]?_0x22a05b[_0x91a7('0x1c')][_0x91a7('0x1d')]===undefined?!![]:![]:!![],'where':_0x22a05b[_0x91a7('0x1c')]?_0x22a05b['options']['where']||null:null,'attributes':_0x22a05b[_0x91a7('0x1c')]?_0x22a05b[_0x91a7('0x1c')][_0x91a7('0x1e')]||null:null,'limit':_0x22a05b['options']?_0x22a05b[_0x91a7('0x1c')]['limit']||null:null,'include':_0x22a05b[_0x91a7('0x1c')]?_0x22a05b['options'][_0x91a7('0x1f')]?_['map'](_0x22a05b['options'][_0x91a7('0x1f')],function(_0x2b6ba5){return{'model':db[_0x2b6ba5[_0x91a7('0x20')]],'as':_0x2b6ba5['as'],'attributes':_0x2b6ba5[_0x91a7('0x1e')],'include':_0x2b6ba5[_0x91a7('0x1f')]?_[_0x91a7('0x21')](_0x2b6ba5[_0x91a7('0x1f')],function(_0x48e4f5){return{'model':db[_0x48e4f5[_0x91a7('0x20')]],'as':_0x48e4f5['as'],'attributes':_0x48e4f5['attributes'],'include':_0x48e4f5[_0x91a7('0x1f')]?_[_0x91a7('0x21')](_0x48e4f5[_0x91a7('0x1f')],function(_0x645bfd){return{'model':db[_0x645bfd['model']],'as':_0x645bfd['as'],'attributes':_0x645bfd[_0x91a7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x91a7('0xf')](function(_0xe7a6dd){logger['info'](_0x91a7('0x1b'),_0x22a05b);logger[_0x91a7('0x13')](_0x91a7('0x1b'),_0x22a05b,JSON[_0x91a7('0x15')](_0xe7a6dd));_0x4b4f7b(_0xe7a6dd);})['catch'](function(_0x546e71){logger['error'](_0x91a7('0x1b'),_0x546e71[_0x91a7('0x18')],_0x22a05b);_0x5386c9(_0x2a545a[_0x91a7('0x16')](0x1f4,_0x546e71[_0x91a7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 381c0ba..7f383b3 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 _0x0148=['voiceExtension:','./voiceExtension.events','remove','update','emit','removeListener','length'];(function(_0x972b32,_0x56ea80){var _0x6e8e75=function(_0x488ed9){while(--_0x488ed9){_0x972b32['push'](_0x972b32['shift']());}};_0x6e8e75(++_0x56ea80);}(_0x0148,0xf6));var _0x8014=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0148[_0x17d9e3];return _0x14192d;};'use strict';var VoiceExtensionEvents=require(_0x8014('0x0'));var events=['save',_0x8014('0x1'),_0x8014('0x2')];function createListener(_0x2d0915,_0x420ac5){return function(_0x3bfd9f){_0x420ac5[_0x8014('0x3')](_0x2d0915,_0x3bfd9f);};}function removeListener(_0x2c928d,_0x3b0236){return function(){VoiceExtensionEvents[_0x8014('0x4')](_0x2c928d,_0x3b0236);};}exports['register']=function(_0x47d1c1){for(var _0x50e161=0x0,_0x3ac29e=events[_0x8014('0x5')];_0x50e161<_0x3ac29e;_0x50e161++){var _0x4bb16d=events[_0x50e161];var _0x53f30b=createListener(_0x8014('0x6')+_0x4bb16d,_0x47d1c1);VoiceExtensionEvents['on'](_0x4bb16d,_0x53f30b);}}; \ No newline at end of file +var _0x55b4=['./voiceExtension.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1ccd6d,_0x35d11c){var _0x207826=function(_0x38e169){while(--_0x38e169){_0x1ccd6d['push'](_0x1ccd6d['shift']());}};_0x207826(++_0x35d11c);}(_0x55b4,0x110));var _0x455b=function(_0x309e79,_0x515084){_0x309e79=_0x309e79-0x0;var _0x37dc14=_0x55b4[_0x309e79];return _0x37dc14;};'use strict';var VoiceExtensionEvents=require(_0x455b('0x0'));var events=[_0x455b('0x1'),_0x455b('0x2'),_0x455b('0x3')];function createListener(_0xeb20e4,_0x4a9a7d){return function(_0x2f219c){_0x4a9a7d[_0x455b('0x4')](_0xeb20e4,_0x2f219c);};}function removeListener(_0x511ad5,_0x52f365){return function(){VoiceExtensionEvents[_0x455b('0x5')](_0x511ad5,_0x52f365);};}exports[_0x455b('0x6')]=function(_0x10adf9){for(var _0x18572c=0x0,_0x2c1de9=events[_0x455b('0x7')];_0x18572c<_0x2c1de9;_0x18572c++){var _0x24741c=events[_0x18572c];var _0x11dd86=createListener('voiceExtension:'+_0x24741c,_0x10adf9);VoiceExtensionEvents['on'](_0x24741c,_0x11dd86);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index edf739e..54b2eb8 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 _0x90d3=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4f9600,_0x1dab31){var _0x55a023=function(_0x4eeb23){while(--_0x4eeb23){_0x4f9600['push'](_0x4f9600['shift']());}};_0x55a023(++_0x1dab31);}(_0x90d3,0x18a));var _0x390d=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x90d3[_0x2675da];return _0x5e6153;};'use strict';var multer=require(_0x390d('0x0'));var util=require('util');var path=require(_0x390d('0x1'));var timeout=require(_0x390d('0x2'));var express=require(_0x390d('0x3'));var router=express['Router']();var auth=require(_0x390d('0x4'));var interaction=require(_0x390d('0x5'));var config=require(_0x390d('0x6'));var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x390d('0x7')]);router[_0x390d('0x8')](_0x390d('0x9'),auth[_0x390d('0xa')](),controller['show']);router[_0x390d('0x8')](_0x390d('0xb'),auth[_0x390d('0xa')](),controller[_0x390d('0xc')]);router[_0x390d('0xd')]('/',auth[_0x390d('0xa')](),controller[_0x390d('0xe')]);router[_0x390d('0xf')](_0x390d('0x9'),auth[_0x390d('0xa')](),controller[_0x390d('0x10')]);router[_0x390d('0x11')]('/:id',auth[_0x390d('0xa')](),controller[_0x390d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x22d9=['exports','multer','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','show','getMessages','post','put','/:id','update','delete'];(function(_0x2fd285,_0x5e6f64){var _0x50fe1a=function(_0x4a8558){while(--_0x4a8558){_0x2fd285['push'](_0x2fd285['shift']());}};_0x50fe1a(++_0x5e6f64);}(_0x22d9,0xf1));var _0x922d=function(_0x14f87a,_0x299602){_0x14f87a=_0x14f87a-0x0;var _0x4361f8=_0x22d9[_0x14f87a];return _0x4361f8;};'use strict';var multer=require(_0x922d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x922d('0x1')]();var auth=require(_0x922d('0x2'));var interaction=require(_0x922d('0x3'));var config=require('../../config/environment');var controller=require(_0x922d('0x4'));router[_0x922d('0x5')]('/',auth[_0x922d('0x6')](),controller['index']);router['get']('/:id',auth[_0x922d('0x6')](),controller[_0x922d('0x7')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x922d('0x8')]);router[_0x922d('0x9')]('/',auth[_0x922d('0x6')](),controller['create']);router[_0x922d('0xa')](_0x922d('0xb'),auth[_0x922d('0x6')](),controller[_0x922d('0xc')]);router[_0x922d('0xd')](_0x922d('0xb'),auth[_0x922d('0x6')](),controller['destroy']);module[_0x922d('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 86581ed..d693bb2 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(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6324,0x142));var _0x4632=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x6324[_0x50aea5];return _0x4657f1;};'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 _0xa571=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string'];(function(_0x3c751f,_0x1f07b7){var _0x43f7c8=function(_0x45dd79){while(--_0x45dd79){_0x3c751f['push'](_0x3c751f['shift']());}};_0x43f7c8(++_0x1f07b7);}(_0xa571,0x107));var _0x1a57=function(_0x13d93b,_0x577f4b){_0x13d93b=_0x13d93b-0x0;var _0x2aa740=_0xa571[_0x13d93b];return _0x2aa740;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'customer_id':{'type':Sequelize[_0x1a57('0x2')]},'context':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':'from-voicemail','unique':_0x1a57('0x3')},'mailbox':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x1a57('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xa58922){this[_0x1a57('0x4')](_0x1a57('0x5'),typeof _0xa58922===_0x1a57('0x6')&&_0xa58922[_0x1a57('0x7')]()?_0xa58922[_0x1a57('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x1a57('0x2')],'defaultValue':_0x1a57('0x8')},'attach':{'type':Sequelize[_0x1a57('0x9')]('yes','no'),'defaultValue':_0x1a57('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1a57('0x9')](_0x1a57('0xa'),'no'),'defaultValue':_0x1a57('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1a57('0x2')]},'callback':{'type':Sequelize[_0x1a57('0x2')]},'review':{'type':Sequelize[_0x1a57('0x9')](_0x1a57('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1a57('0x9')](_0x1a57('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1a57('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1a57('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1a57('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1a57('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1a57('0x9')](_0x1a57('0xa'),'no'),'defaultValue':_0x1a57('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1a57('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1a57('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x1a57('0xa'),'no'),'defaultValue':_0x1a57('0xa'),'allowNull':![]},'stamp':{'type':_0x1a57('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x1a57('0x2')]},'maxsecs':{'type':Sequelize[_0x1a57('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1a57('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1a57('0xe')](_0x1a57('0xf'))+_0x1a57('0x10')+this[_0x1a57('0xe')](_0x1a57('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 8dc569c..b98c4b6 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 _0x3419=['getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','count','offset','limit','set','reject','save','then','Voicemails','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','VoiceMail','findAll','rows','catch','show','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy'];(function(_0x3f7146,_0x824eba){var _0x316350=function(_0x57d1c5){while(--_0x57d1c5){_0x3f7146['push'](_0x3f7146['shift']());}};_0x316350(++_0x824eba);}(_0x3419,0xb3));var _0x9341=function(_0x48245e,_0x178e51){_0x48245e=_0x48245e-0x0;var _0x4e5e30=_0x3419[_0x48245e];return _0x4e5e30;};'use strict';var pdf=require(_0x9341('0x0'));var emlformat=require(_0x9341('0x1'));var rimraf=require(_0x9341('0x2'));var zipdir=require(_0x9341('0x3'));var jsonpatch=require(_0x9341('0x4'));var rp=require('request-promise');var moment=require(_0x9341('0x5'));var BPromise=require(_0x9341('0x6'));var Mustache=require(_0x9341('0x7'));var util=require(_0x9341('0x8'));var path=require(_0x9341('0x9'));var sox=require('sox');var csv=require(_0x9341('0xa'));var ejs=require(_0x9341('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9341('0xc'));var crypto=require(_0x9341('0xd'));var jsforce=require(_0x9341('0xe'));var deskjs=require(_0x9341('0xf'));var toCsv=require(_0x9341('0xa'));var querystring=require(_0x9341('0x10'));var Papa=require('papaparse');var Redis=require(_0x9341('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9341('0x12'));var as=require(_0x9341('0x13'));var hardwareService=require(_0x9341('0x14'));var logger=require('../../config/logger')(_0x9341('0x15'));var utils=require('../../config/utils');var config=require(_0x9341('0x16'));var licenseUtil=require(_0x9341('0x17'));var db=require(_0x9341('0x18'))['db'];function respondWithStatusCode(_0x277ddb,_0x4e239a){_0x4e239a=_0x4e239a||0xcc;return function(_0x3dbc07){if(_0x3dbc07){return _0x277ddb['sendStatus'](_0x4e239a);}return _0x277ddb['status'](_0x4e239a)[_0x9341('0x19')]();};}function respondWithResult(_0x4c430,_0x485ccb){_0x485ccb=_0x485ccb||0xc8;return function(_0xb9218a){if(_0xb9218a){return _0x4c430[_0x9341('0x1a')](_0x485ccb)['json'](_0xb9218a);}};}function respondWithFilteredResult(_0xe4a706,_0x451ba7){return function(_0xc69234){if(_0xc69234){var _0x4cea41=_0xc69234[_0x9341('0x1b')],_0x32a03a=_0x451ba7[_0x9341('0x1c')],_0x55dcac=_0x451ba7[_0x9341('0x1c')]+_0x451ba7[_0x9341('0x1d')],_0x256b0f;if(_0x55dcac>=_0x4cea41){_0x55dcac=_0x4cea41;_0x256b0f=0xc8;}else{_0x256b0f=0xce;}_0xe4a706[_0x9341('0x1a')](_0x256b0f);return _0xe4a706[_0x9341('0x1e')]('Content-Range',_0x32a03a+'-'+_0x55dcac+'/'+_0x4cea41)['json'](_0xc69234);}return null;};}function patchUpdates(_0x5ba251){return function(_0x26593a){try{jsonpatch['apply'](_0x26593a,_0x5ba251,!![]);}catch(_0x5ee3f3){return BPromise[_0x9341('0x1f')](_0x5ee3f3);}return _0x26593a[_0x9341('0x20')]();};}function saveUpdates(_0xfeb8d8,_0x47ad4c){return function(_0x5a615f){if(_0x5a615f){return _0x5a615f['update'](_0xfeb8d8)['then'](function(_0x4d7ed8){return _0x4d7ed8;});}return null;};}function removeEntity(_0x15d06f,_0x4e9ded){return function(_0x58817f){if(_0x58817f){return _0x58817f['destroy']()[_0x9341('0x21')](function(){var _0x2501d6=_0x58817f['get']({'plain':!![]});var _0x48271f=_0x9341('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x48271f,'resourceId':_0x2501d6['id']}})[_0x9341('0x21')](function(){return _0x58817f;});})[_0x9341('0x21')](function(){_0x15d06f['status'](0xcc)[_0x9341('0x19')]();});}};}function handleEntityNotFound(_0x3761a1,_0x35b6d5){return function(_0x557d48){if(!_0x557d48){_0x3761a1[_0x9341('0x23')](0x194);}return _0x557d48;};}function handleError(_0x183707,_0x4698b3){_0x4698b3=_0x4698b3||0x1f4;return function(_0x51fe17){logger[_0x9341('0x24')](_0x51fe17[_0x9341('0x25')]);if(_0x51fe17['name']){delete _0x51fe17[_0x9341('0x26')];}_0x183707[_0x9341('0x1a')](_0x4698b3)[_0x9341('0x27')](_0x51fe17);};}exports['index']=function(_0x5b719e,_0x9c128b){var _0x7f3112={},_0x4d14f8={},_0x295780={'count':0x0,'rows':[]};var _0x31f15b=_['map'](db['VoiceMail'][_0x9341('0x28')],function(_0x367b90){return{'name':_0x367b90[_0x9341('0x29')],'type':_0x367b90[_0x9341('0x2a')][_0x9341('0x2b')]};});_0x4d14f8[_0x9341('0x2c')]=_[_0x9341('0x2d')](_0x31f15b,_0x9341('0x26'));_0x4d14f8[_0x9341('0x2e')]=_[_0x9341('0x2f')](_0x5b719e[_0x9341('0x2e')]);_0x4d14f8[_0x9341('0x30')]=_[_0x9341('0x31')](_0x4d14f8[_0x9341('0x2c')],_0x4d14f8[_0x9341('0x2e')]);_0x7f3112[_0x9341('0x32')]=_['intersection'](_0x4d14f8[_0x9341('0x2c')],qs[_0x9341('0x33')](_0x5b719e[_0x9341('0x2e')][_0x9341('0x33')]));_0x7f3112['attributes']=_0x7f3112[_0x9341('0x32')][_0x9341('0x34')]?_0x7f3112[_0x9341('0x32')]:_0x4d14f8[_0x9341('0x2c')];if(!_0x5b719e['query'][_0x9341('0x35')](_0x9341('0x36'))){_0x7f3112[_0x9341('0x1d')]=qs[_0x9341('0x1d')](_0x5b719e['query'][_0x9341('0x1d')]);_0x7f3112[_0x9341('0x1c')]=qs[_0x9341('0x1c')](_0x5b719e['query'][_0x9341('0x1c')]);}_0x7f3112[_0x9341('0x37')]=qs[_0x9341('0x38')](_0x5b719e[_0x9341('0x2e')][_0x9341('0x38')]);_0x7f3112[_0x9341('0x39')]=qs[_0x9341('0x30')](_[_0x9341('0x3a')](_0x5b719e[_0x9341('0x2e')],_0x4d14f8[_0x9341('0x30')]),_0x31f15b);if(_0x5b719e[_0x9341('0x2e')][_0x9341('0x3b')]){_0x7f3112[_0x9341('0x39')]=_[_0x9341('0x3c')](_0x7f3112[_0x9341('0x39')],{'$or':_[_0x9341('0x2d')](_0x31f15b,function(_0x64773b){if(_0x64773b[_0x9341('0x2a')]!==_0x9341('0x3d')){var _0x15fde9={};_0x15fde9[_0x64773b['name']]={'$like':'%'+_0x5b719e['query'][_0x9341('0x3b')]+'%'};return _0x15fde9;}})});}_0x7f3112=_[_0x9341('0x3c')]({},_0x7f3112,_0x5b719e['options']);var _0x56e448={'where':_0x7f3112[_0x9341('0x39')]};return db['VoiceMail'][_0x9341('0x1b')](_0x56e448)['then'](function(_0x1db86a){_0x295780[_0x9341('0x1b')]=_0x1db86a;if(_0x5b719e[_0x9341('0x2e')][_0x9341('0x3e')]){_0x7f3112['include']=[{'all':!![]}];}return db[_0x9341('0x3f')][_0x9341('0x40')](_0x7f3112);})['then'](function(_0x27319c){_0x295780[_0x9341('0x41')]=_0x27319c;return _0x295780;})[_0x9341('0x21')](respondWithFilteredResult(_0x9c128b,_0x7f3112))[_0x9341('0x42')](handleError(_0x9c128b,null));};exports[_0x9341('0x43')]=function(_0x22b5e2,_0x6958c7){var _0x22a31d={'raw':!![],'where':{'id':_0x22b5e2['params']['id']}},_0x47197e={};_0x47197e[_0x9341('0x2c')]=_[_0x9341('0x2f')](db[_0x9341('0x3f')][_0x9341('0x28')]);_0x47197e[_0x9341('0x2e')]=_[_0x9341('0x2f')](_0x22b5e2[_0x9341('0x2e')]);_0x47197e['filters']=_[_0x9341('0x31')](_0x47197e[_0x9341('0x2c')],_0x47197e[_0x9341('0x2e')]);_0x22a31d['attributes']=_[_0x9341('0x31')](_0x47197e[_0x9341('0x2c')],qs['fields'](_0x22b5e2[_0x9341('0x2e')][_0x9341('0x33')]));_0x22a31d['attributes']=_0x22a31d[_0x9341('0x32')][_0x9341('0x34')]?_0x22a31d[_0x9341('0x32')]:_0x47197e['model'];if(_0x22b5e2[_0x9341('0x2e')]['includeAll']){_0x22a31d[_0x9341('0x44')]=[{'all':!![]}];}_0x22a31d=_[_0x9341('0x3c')]({},_0x22a31d,_0x22b5e2[_0x9341('0x45')]);return db['VoiceMail'][_0x9341('0x46')](_0x22a31d)[_0x9341('0x21')](handleEntityNotFound(_0x6958c7,null))[_0x9341('0x21')](respondWithResult(_0x6958c7,null))[_0x9341('0x42')](handleError(_0x6958c7,null));};exports[_0x9341('0x47')]=function(_0x456f2c,_0x1b272c){return db[_0x9341('0x3f')][_0x9341('0x47')](_0x456f2c['body'],{})[_0x9341('0x21')](function(_0x53bf00){var _0x27f6e5=_0x456f2c[_0x9341('0x48')]['get']({'plain':!![]});if(!_0x27f6e5)throw new Error(_0x9341('0x49'));if(_0x27f6e5['role']===_0x9341('0x48')){var _0x28186f=_0x53bf00[_0x9341('0x4a')]({'plain':!![]});var _0x59c9b4=_0x9341('0x22');return db[_0x9341('0x4b')][_0x9341('0x46')]({'where':{'name':_0x59c9b4,'userProfileId':_0x27f6e5['userProfileId']},'raw':!![]})[_0x9341('0x21')](function(_0x326dbc){if(_0x326dbc&&_0x326dbc[_0x9341('0x4c')]===0x0){return db[_0x9341('0x4d')][_0x9341('0x47')]({'name':_0x28186f[_0x9341('0x26')],'resourceId':_0x28186f['id'],'type':_0x326dbc[_0x9341('0x26')],'sectionId':_0x326dbc['id']},{})[_0x9341('0x21')](function(){return _0x53bf00;});}else{return _0x53bf00;}})[_0x9341('0x42')](function(_0x53a735){logger['error'](_0x9341('0x4e'),_0x53a735);throw _0x53a735;});}return _0x53bf00;})[_0x9341('0x21')](respondWithResult(_0x1b272c,0xc9))[_0x9341('0x42')](handleError(_0x1b272c,null));};exports['update']=function(_0x303747,_0x16c1be){if(_0x303747['body']['id']){delete _0x303747[_0x9341('0x4f')]['id'];}return db[_0x9341('0x3f')][_0x9341('0x46')]({'where':{'id':_0x303747[_0x9341('0x50')]['id']}})['then'](handleEntityNotFound(_0x16c1be,null))[_0x9341('0x21')](saveUpdates(_0x303747['body'],null))[_0x9341('0x21')](respondWithResult(_0x16c1be,null))[_0x9341('0x42')](handleError(_0x16c1be,null));};exports[_0x9341('0x51')]=function(_0xc529f6,_0x93ef9d){return db[_0x9341('0x3f')]['find']({'where':{'id':_0xc529f6[_0x9341('0x50')]['id']}})['then'](handleEntityNotFound(_0x93ef9d,null))[_0x9341('0x21')](removeEntity(_0x93ef9d,null))[_0x9341('0x42')](handleError(_0x93ef9d,null));};exports[_0x9341('0x52')]=function(_0x535375,_0x1c5dbc,_0x3f6995){return db[_0x9341('0x3f')][_0x9341('0x53')]({'where':{'id':_0x535375['params']['id']}})[_0x9341('0x21')](handleEntityNotFound(_0x1c5dbc,null))[_0x9341('0x21')](function(_0x2898cc){var _0x38ec1a;var _0x1e998e={},_0x5a305f={};_0x5a305f['model']=_[_0x9341('0x2f')](db['VoiceMailMessage'][_0x9341('0x28')]);_0x5a305f[_0x9341('0x2e')]=_[_0x9341('0x2f')](_0x535375[_0x9341('0x2e')]);_0x5a305f[_0x9341('0x30')]=_['intersection'](_0x5a305f[_0x9341('0x2c')],_0x5a305f[_0x9341('0x2e')]);_0x1e998e[_0x9341('0x32')]=_[_0x9341('0x31')](_0x5a305f[_0x9341('0x2c')],qs[_0x9341('0x33')](_0x535375['query']['fields']));_0x1e998e[_0x9341('0x32')]=_0x1e998e['attributes'][_0x9341('0x34')]?_0x1e998e[_0x9341('0x32')]:_0x5a305f[_0x9341('0x2c')];if(!_0x535375[_0x9341('0x2e')][_0x9341('0x35')](_0x9341('0x36'))){_0x1e998e['limit']=qs[_0x9341('0x1d')](_0x535375[_0x9341('0x2e')][_0x9341('0x1d')]);_0x1e998e['offset']=qs[_0x9341('0x1c')](_0x535375[_0x9341('0x2e')][_0x9341('0x1c')]);}_0x1e998e[_0x9341('0x37')]=qs[_0x9341('0x38')](_0x535375['query'][_0x9341('0x38')]);_0x1e998e[_0x9341('0x39')]=qs[_0x9341('0x30')](_[_0x9341('0x3a')](_0x535375[_0x9341('0x2e')],_0x5a305f['filters']));if(_0x535375[_0x9341('0x2e')][_0x9341('0x3b')]){_0x1e998e[_0x9341('0x39')]=_['merge'](_0x1e998e[_0x9341('0x39')],{'$or':_[_0x9341('0x2d')](_0x1e998e[_0x9341('0x32')],function(_0x4f51c3){var _0x344ded={};_0x344ded[_0x4f51c3]={'$like':'%'+_0x535375[_0x9341('0x2e')][_0x9341('0x3b')]+'%'};return _0x344ded;})});}_0x1e998e[_0x9341('0x39')]=_[_0x9341('0x3c')](_0x1e998e[_0x9341('0x39')],{'mailboxuser':_0x2898cc[_0x9341('0x54')]});_0x1e998e=_[_0x9341('0x3c')]({},_0x1e998e,_0x535375['options']);return db[_0x9341('0x55')][_0x9341('0x56')](_0x1e998e)['then'](respondWithFilteredResult(_0x1c5dbc,_0x1e998e));})[_0x9341('0x42')](handleError(_0x1c5dbc,null));}; \ No newline at end of file +var _0x40ac=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','Content-Range','apply','save','destroy','then','UserProfileResource','error','stack','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','VoiceMailMessage','length','pick','mailbox','findAndCountAll','html-pdf','rimraf'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x40ac,0x1de));var _0xc40a=function(_0x24984a,_0x10fb2d){_0x24984a=_0x24984a-0x0;var _0x405c82=_0x40ac[_0x24984a];return _0x405c82;};'use strict';var pdf=require(_0xc40a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc40a('0x1'));var zipdir=require(_0xc40a('0x2'));var jsonpatch=require(_0xc40a('0x3'));var rp=require(_0xc40a('0x4'));var moment=require(_0xc40a('0x5'));var BPromise=require(_0xc40a('0x6'));var Mustache=require(_0xc40a('0x7'));var util=require('util');var path=require(_0xc40a('0x8'));var sox=require(_0xc40a('0x9'));var csv=require(_0xc40a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc40a('0xb'));var crypto=require(_0xc40a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc40a('0xd'));var toCsv=require(_0xc40a('0xa'));var querystring=require(_0xc40a('0xe'));var Papa=require(_0xc40a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc40a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc40a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc40a('0x12'));var licenseUtil=require(_0xc40a('0x13'));var db=require(_0xc40a('0x14'))['db'];function respondWithStatusCode(_0xc379e1,_0x1e2676){_0x1e2676=_0x1e2676||0xcc;return function(_0x290e7b){if(_0x290e7b){return _0xc379e1[_0xc40a('0x15')](_0x1e2676);}return _0xc379e1[_0xc40a('0x16')](_0x1e2676)['end']();};}function respondWithResult(_0x3f8c9d,_0x3ba8e8){_0x3ba8e8=_0x3ba8e8||0xc8;return function(_0x4a360c){if(_0x4a360c){return _0x3f8c9d[_0xc40a('0x16')](_0x3ba8e8)['json'](_0x4a360c);}};}function respondWithFilteredResult(_0x33cd18,_0x5e65ce){return function(_0x1a8654){if(_0x1a8654){var _0x3eeeb8=_0x1a8654[_0xc40a('0x17')],_0x15131d=_0x5e65ce[_0xc40a('0x18')],_0x4bc038=_0x5e65ce['offset']+_0x5e65ce['limit'],_0x3d1502;if(_0x4bc038>=_0x3eeeb8){_0x4bc038=_0x3eeeb8;_0x3d1502=0xc8;}else{_0x3d1502=0xce;}_0x33cd18[_0xc40a('0x16')](_0x3d1502);return _0x33cd18['set'](_0xc40a('0x19'),_0x15131d+'-'+_0x4bc038+'/'+_0x3eeeb8)['json'](_0x1a8654);}return null;};}function patchUpdates(_0x4e2d37){return function(_0x294339){try{jsonpatch[_0xc40a('0x1a')](_0x294339,_0x4e2d37,!![]);}catch(_0x1fc2e4){return BPromise['reject'](_0x1fc2e4);}return _0x294339[_0xc40a('0x1b')]();};}function saveUpdates(_0x125e1b,_0x4ce4ed){return function(_0x104683){if(_0x104683){return _0x104683['update'](_0x125e1b)['then'](function(_0x120fb9){return _0x120fb9;});}return null;};}function removeEntity(_0x1ea9f9,_0x4233fc){return function(_0x2d9eaf){if(_0x2d9eaf){return _0x2d9eaf[_0xc40a('0x1c')]()[_0xc40a('0x1d')](function(){var _0x149754=_0x2d9eaf['get']({'plain':!![]});var _0xae5a35='Voicemails';return db[_0xc40a('0x1e')]['destroy']({'where':{'type':_0xae5a35,'resourceId':_0x149754['id']}})[_0xc40a('0x1d')](function(){return _0x2d9eaf;});})['then'](function(){_0x1ea9f9[_0xc40a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa78f,_0x10a8a3){return function(_0x27346e){if(!_0x27346e){_0x3aa78f['sendStatus'](0x194);}return _0x27346e;};}function handleError(_0x4eed6a,_0x3c1d96){_0x3c1d96=_0x3c1d96||0x1f4;return function(_0x4a639a){logger[_0xc40a('0x1f')](_0x4a639a[_0xc40a('0x20')]);if(_0x4a639a['name']){delete _0x4a639a['name'];}_0x4eed6a['status'](_0x3c1d96)[_0xc40a('0x21')](_0x4a639a);};}exports[_0xc40a('0x22')]=function(_0x7769dd,_0x2f3c49){var _0x473b2a={},_0x468b6d={},_0x4631bb={'count':0x0,'rows':[]};var _0x152835=_['map'](db[_0xc40a('0x23')][_0xc40a('0x24')],function(_0x423b16){return{'name':_0x423b16[_0xc40a('0x25')],'type':_0x423b16[_0xc40a('0x26')][_0xc40a('0x27')]};});_0x468b6d[_0xc40a('0x28')]=_[_0xc40a('0x29')](_0x152835,_0xc40a('0x2a'));_0x468b6d[_0xc40a('0x2b')]=_['keys'](_0x7769dd[_0xc40a('0x2b')]);_0x468b6d[_0xc40a('0x2c')]=_[_0xc40a('0x2d')](_0x468b6d[_0xc40a('0x28')],_0x468b6d[_0xc40a('0x2b')]);_0x473b2a[_0xc40a('0x2e')]=_['intersection'](_0x468b6d['model'],qs[_0xc40a('0x2f')](_0x7769dd[_0xc40a('0x2b')][_0xc40a('0x2f')]));_0x473b2a[_0xc40a('0x2e')]=_0x473b2a[_0xc40a('0x2e')]['length']?_0x473b2a[_0xc40a('0x2e')]:_0x468b6d[_0xc40a('0x28')];if(!_0x7769dd[_0xc40a('0x2b')][_0xc40a('0x30')](_0xc40a('0x31'))){_0x473b2a[_0xc40a('0x32')]=qs[_0xc40a('0x32')](_0x7769dd[_0xc40a('0x2b')]['limit']);_0x473b2a[_0xc40a('0x18')]=qs[_0xc40a('0x18')](_0x7769dd[_0xc40a('0x2b')][_0xc40a('0x18')]);}_0x473b2a[_0xc40a('0x33')]=qs[_0xc40a('0x34')](_0x7769dd['query']['sort']);_0x473b2a[_0xc40a('0x35')]=qs[_0xc40a('0x2c')](_['pick'](_0x7769dd[_0xc40a('0x2b')],_0x468b6d[_0xc40a('0x2c')]),_0x152835);if(_0x7769dd[_0xc40a('0x2b')][_0xc40a('0x36')]){_0x473b2a[_0xc40a('0x35')]=_[_0xc40a('0x37')](_0x473b2a[_0xc40a('0x35')],{'$or':_[_0xc40a('0x29')](_0x152835,function(_0x1c26d6){if(_0x1c26d6['type']!==_0xc40a('0x38')){var _0x2aaa16={};_0x2aaa16[_0x1c26d6[_0xc40a('0x2a')]]={'$like':'%'+_0x7769dd[_0xc40a('0x2b')]['filter']+'%'};return _0x2aaa16;}})});}_0x473b2a=_[_0xc40a('0x37')]({},_0x473b2a,_0x7769dd[_0xc40a('0x39')]);var _0x318748={'where':_0x473b2a[_0xc40a('0x35')]};return db[_0xc40a('0x23')][_0xc40a('0x17')](_0x318748)[_0xc40a('0x1d')](function(_0x2e1764){_0x4631bb[_0xc40a('0x17')]=_0x2e1764;if(_0x7769dd['query'][_0xc40a('0x3a')]){_0x473b2a['include']=[{'all':!![]}];}return db[_0xc40a('0x23')][_0xc40a('0x3b')](_0x473b2a);})['then'](function(_0x3173b4){_0x4631bb[_0xc40a('0x3c')]=_0x3173b4;return _0x4631bb;})[_0xc40a('0x1d')](respondWithFilteredResult(_0x2f3c49,_0x473b2a))[_0xc40a('0x3d')](handleError(_0x2f3c49,null));};exports['show']=function(_0x27494d,_0x3bc1fa){var _0xfec402={'raw':!![],'where':{'id':_0x27494d['params']['id']}},_0x51a9fc={};_0x51a9fc[_0xc40a('0x28')]=_[_0xc40a('0x3e')](db[_0xc40a('0x23')][_0xc40a('0x24')]);_0x51a9fc[_0xc40a('0x2b')]=_['keys'](_0x27494d[_0xc40a('0x2b')]);_0x51a9fc[_0xc40a('0x2c')]=_[_0xc40a('0x2d')](_0x51a9fc[_0xc40a('0x28')],_0x51a9fc['query']);_0xfec402[_0xc40a('0x2e')]=_[_0xc40a('0x2d')](_0x51a9fc[_0xc40a('0x28')],qs[_0xc40a('0x2f')](_0x27494d[_0xc40a('0x2b')]['fields']));_0xfec402[_0xc40a('0x2e')]=_0xfec402[_0xc40a('0x2e')]['length']?_0xfec402[_0xc40a('0x2e')]:_0x51a9fc[_0xc40a('0x28')];if(_0x27494d['query']['includeAll']){_0xfec402[_0xc40a('0x3f')]=[{'all':!![]}];}_0xfec402=_[_0xc40a('0x37')]({},_0xfec402,_0x27494d['options']);return db['VoiceMail']['find'](_0xfec402)[_0xc40a('0x1d')](handleEntityNotFound(_0x3bc1fa,null))[_0xc40a('0x1d')](respondWithResult(_0x3bc1fa,null))['catch'](handleError(_0x3bc1fa,null));};exports[_0xc40a('0x40')]=function(_0x3601d6,_0x97085e){return db[_0xc40a('0x23')][_0xc40a('0x40')](_0x3601d6[_0xc40a('0x41')],{})['then'](function(_0x23cd85){var _0x2380c9=_0x3601d6[_0xc40a('0x42')][_0xc40a('0x43')]({'plain':!![]});if(!_0x2380c9)throw new Error(_0xc40a('0x44'));if(_0x2380c9[_0xc40a('0x45')]==='user'){var _0x1a096a=_0x23cd85[_0xc40a('0x43')]({'plain':!![]});var _0x100cfd=_0xc40a('0x46');return db['UserProfileSection'][_0xc40a('0x47')]({'where':{'name':_0x100cfd,'userProfileId':_0x2380c9['userProfileId']},'raw':!![]})['then'](function(_0x46b5ed){if(_0x46b5ed&&_0x46b5ed['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1a096a[_0xc40a('0x2a')],'resourceId':_0x1a096a['id'],'type':_0x46b5ed[_0xc40a('0x2a')],'sectionId':_0x46b5ed['id']},{})[_0xc40a('0x1d')](function(){return _0x23cd85;});}else{return _0x23cd85;}})[_0xc40a('0x3d')](function(_0x31d836){logger[_0xc40a('0x1f')](_0xc40a('0x48'),_0x31d836);throw _0x31d836;});}return _0x23cd85;})['then'](respondWithResult(_0x97085e,0xc9))[_0xc40a('0x3d')](handleError(_0x97085e,null));};exports[_0xc40a('0x49')]=function(_0xb9fa61,_0x105103){if(_0xb9fa61[_0xc40a('0x41')]['id']){delete _0xb9fa61[_0xc40a('0x41')]['id'];}return db[_0xc40a('0x23')][_0xc40a('0x47')]({'where':{'id':_0xb9fa61[_0xc40a('0x4a')]['id']}})[_0xc40a('0x1d')](handleEntityNotFound(_0x105103,null))[_0xc40a('0x1d')](saveUpdates(_0xb9fa61['body'],null))[_0xc40a('0x1d')](respondWithResult(_0x105103,null))[_0xc40a('0x3d')](handleError(_0x105103,null));};exports[_0xc40a('0x1c')]=function(_0x3acb25,_0x8f106a){return db['VoiceMail'][_0xc40a('0x47')]({'where':{'id':_0x3acb25[_0xc40a('0x4a')]['id']}})[_0xc40a('0x1d')](handleEntityNotFound(_0x8f106a,null))[_0xc40a('0x1d')](removeEntity(_0x8f106a,null))['catch'](handleError(_0x8f106a,null));};exports['getMessages']=function(_0xd514fa,_0x232f44,_0x7cab2){return db[_0xc40a('0x23')]['findOne']({'where':{'id':_0xd514fa['params']['id']}})[_0xc40a('0x1d')](handleEntityNotFound(_0x232f44,null))[_0xc40a('0x1d')](function(_0x23cfc8){var _0x2abbb1;var _0x2c1495={},_0x3712e9={};_0x3712e9[_0xc40a('0x28')]=_[_0xc40a('0x3e')](db[_0xc40a('0x4b')][_0xc40a('0x24')]);_0x3712e9[_0xc40a('0x2b')]=_['keys'](_0xd514fa[_0xc40a('0x2b')]);_0x3712e9[_0xc40a('0x2c')]=_[_0xc40a('0x2d')](_0x3712e9[_0xc40a('0x28')],_0x3712e9['query']);_0x2c1495[_0xc40a('0x2e')]=_['intersection'](_0x3712e9[_0xc40a('0x28')],qs[_0xc40a('0x2f')](_0xd514fa[_0xc40a('0x2b')]['fields']));_0x2c1495[_0xc40a('0x2e')]=_0x2c1495['attributes'][_0xc40a('0x4c')]?_0x2c1495[_0xc40a('0x2e')]:_0x3712e9[_0xc40a('0x28')];if(!_0xd514fa['query'][_0xc40a('0x30')](_0xc40a('0x31'))){_0x2c1495[_0xc40a('0x32')]=qs[_0xc40a('0x32')](_0xd514fa[_0xc40a('0x2b')][_0xc40a('0x32')]);_0x2c1495[_0xc40a('0x18')]=qs[_0xc40a('0x18')](_0xd514fa['query'][_0xc40a('0x18')]);}_0x2c1495[_0xc40a('0x33')]=qs[_0xc40a('0x34')](_0xd514fa['query'][_0xc40a('0x34')]);_0x2c1495[_0xc40a('0x35')]=qs['filters'](_[_0xc40a('0x4d')](_0xd514fa[_0xc40a('0x2b')],_0x3712e9[_0xc40a('0x2c')]));if(_0xd514fa[_0xc40a('0x2b')][_0xc40a('0x36')]){_0x2c1495['where']=_[_0xc40a('0x37')](_0x2c1495[_0xc40a('0x35')],{'$or':_['map'](_0x2c1495[_0xc40a('0x2e')],function(_0x459b71){var _0x9bd497={};_0x9bd497[_0x459b71]={'$like':'%'+_0xd514fa[_0xc40a('0x2b')]['filter']+'%'};return _0x9bd497;})});}_0x2c1495[_0xc40a('0x35')]=_[_0xc40a('0x37')](_0x2c1495[_0xc40a('0x35')],{'mailboxuser':_0x23cfc8[_0xc40a('0x4e')]});_0x2c1495=_['merge']({},_0x2c1495,_0xd514fa['options']);return db[_0xc40a('0x4b')][_0xc40a('0x4f')](_0x2c1495)['then'](respondWithFilteredResult(_0x232f44,_0x2c1495));})['catch'](handleError(_0x232f44,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index cc963f0..ea4c30d 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 _0x287f=['./voiceMail.attributes','exports','voice_voicemail','mailbox_context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x531795,_0x275b70){var _0x2df3ea=function(_0x3e810f){while(--_0x3e810f){_0x531795['push'](_0x531795['shift']());}};_0x2df3ea(++_0x275b70);}(_0x287f,0xc7));var _0xf287=function(_0x41c1f2,_0x381843){_0x41c1f2=_0x41c1f2-0x0;var _0xf3e1f5=_0x287f[_0x41c1f2];return _0xf3e1f5;};'use strict';var _=require(_0xf287('0x0'));var util=require(_0xf287('0x1'));var logger=require(_0xf287('0x2'))(_0xf287('0x3'));var moment=require(_0xf287('0x4'));var BPromise=require(_0xf287('0x5'));var rp=require(_0xf287('0x6'));var fs=require('fs');var path=require(_0xf287('0x7'));var rimraf=require('rimraf');var config=require(_0xf287('0x8'));var attributes=require(_0xf287('0x9'));module[_0xf287('0xa')]=function(_0x32bfaf,_0x2d358a){return _0x32bfaf['define']('VoiceMail',attributes,{'tableName':_0xf287('0xb'),'paranoid':![],'indexes':[{'name':_0xf287('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8da0=['mailbox','lodash','util','../../config/logger','moment','path','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0x8da0,0x135));var _0x08da=function(_0x46a56b,_0x4c466c){_0x46a56b=_0x46a56b-0x0;var _0xbb364e=_0x8da0[_0x46a56b];return _0xbb364e;};'use strict';var _=require(_0x08da('0x0'));var util=require(_0x08da('0x1'));var logger=require(_0x08da('0x2'))('api');var moment=require(_0x08da('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08da('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x08da('0x5')]=function(_0x8fd120,_0x7fecda){return _0x8fd120[_0x08da('0x6')](_0x08da('0x7'),attributes,{'tableName':_0x08da('0x8'),'paranoid':![],'indexes':[{'name':_0x08da('0x9'),'fields':[_0x08da('0xa'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index eefe04b..14081dd 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 _0xa8ca=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceMail,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis'];(function(_0x4d50e9,_0x4f95d9){var _0x282f60=function(_0x463b3c){while(--_0x463b3c){_0x4d50e9['push'](_0x4d50e9['shift']());}};_0x282f60(++_0x4f95d9);}(_0xa8ca,0x1e0));var _0xaa8c=function(_0x4cbdd9,_0x42087b){_0x4cbdd9=_0x4cbdd9-0x0;var _0x4ac743=_0xa8ca[_0x4cbdd9];return _0x4ac743;};'use strict';var _=require('lodash');var util=require(_0xaa8c('0x0'));var moment=require(_0xaa8c('0x1'));var BPromise=require('bluebird');var rs=require(_0xaa8c('0x2'));var fs=require('fs');var Redis=require(_0xaa8c('0x3'));var db=require(_0xaa8c('0x4'))['db'];var utils=require(_0xaa8c('0x5'));var logger=require(_0xaa8c('0x6'))(_0xaa8c('0x7'));var config=require(_0xaa8c('0x8'));var jayson=require(_0xaa8c('0x9'));var client=jayson[_0xaa8c('0xa')][_0xaa8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19da80,_0x94e7da,_0x54de6b){return new BPromise(function(_0x21bdfe,_0x15693d){return client['request'](_0x19da80,_0x54de6b)[_0xaa8c('0xc')](function(_0x4ae9c2){logger[_0xaa8c('0xd')]('VoiceMail,\x20%s,\x20%s',_0x94e7da,'request\x20sent');logger[_0xaa8c('0xe')](_0xaa8c('0xf'),_0x94e7da,_0xaa8c('0x10'),JSON[_0xaa8c('0x11')](_0x4ae9c2));if(_0x4ae9c2['error']){if(_0x4ae9c2['error']['code']===0x1f4){logger[_0xaa8c('0x12')]('VoiceMail,\x20%s,\x20%s',_0x94e7da,_0x4ae9c2['error'][_0xaa8c('0x13')]);return _0x15693d(_0x4ae9c2['error'][_0xaa8c('0x13')]);}logger['error'](_0xaa8c('0x14'),_0x94e7da,_0x4ae9c2[_0xaa8c('0x12')]['message']);return _0x21bdfe(_0x4ae9c2[_0xaa8c('0x12')][_0xaa8c('0x13')]);}else{logger[_0xaa8c('0xd')](_0xaa8c('0x14'),_0x94e7da,_0xaa8c('0x10'));_0x21bdfe(_0x4ae9c2['result'][_0xaa8c('0x13')]);}})[_0xaa8c('0x15')](function(_0x7456f3){logger[_0xaa8c('0x12')](_0xaa8c('0x14'),_0x94e7da,_0x7456f3);_0x15693d(_0x7456f3);});});} \ No newline at end of file +var _0x64c4=['request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x64c4,0xdd));var _0x464c=function(_0x4386e1,_0xf1b15d){_0x4386e1=_0x4386e1-0x0;var _0xd3ce47=_0x64c4[_0x4386e1];return _0xd3ce47;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var moment=require(_0x464c('0x2'));var BPromise=require(_0x464c('0x3'));var rs=require(_0x464c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x464c('0x5'));var logger=require(_0x464c('0x6'))(_0x464c('0x7'));var config=require(_0x464c('0x8'));var jayson=require(_0x464c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26e18b,_0x2d5e98,_0x2aa80c){return new BPromise(function(_0x18db51,_0x222b54){return client[_0x464c('0xa')](_0x26e18b,_0x2aa80c)['then'](function(_0x270d89){logger[_0x464c('0xb')](_0x464c('0xc'),_0x2d5e98,_0x464c('0xd'));logger[_0x464c('0xe')](_0x464c('0xf'),_0x2d5e98,_0x464c('0xd'),JSON[_0x464c('0x10')](_0x270d89));if(_0x270d89[_0x464c('0x11')]){if(_0x270d89['error'][_0x464c('0x12')]===0x1f4){logger['error'](_0x464c('0xc'),_0x2d5e98,_0x270d89[_0x464c('0x11')][_0x464c('0x13')]);return _0x222b54(_0x270d89[_0x464c('0x11')][_0x464c('0x13')]);}logger[_0x464c('0x11')](_0x464c('0xc'),_0x2d5e98,_0x270d89[_0x464c('0x11')][_0x464c('0x13')]);return _0x18db51(_0x270d89[_0x464c('0x11')][_0x464c('0x13')]);}else{logger[_0x464c('0xb')](_0x464c('0xc'),_0x2d5e98,_0x464c('0xd'));_0x18db51(_0x270d89['result'][_0x464c('0x13')]);}})[_0x464c('0x14')](function(_0x102ba1){logger[_0x464c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2d5e98,_0x102ba1);_0x222b54(_0x102ba1);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a170afb..9323922 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 _0xedbb=['../../config/environment','get','/:id','isAuthenticated','show','/:id/download','post','create','update','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xedbb,0x8c));var _0xbedb=function(_0x19ae3c,_0x36ef3a){_0x19ae3c=_0x19ae3c-0x0;var _0x5e155a=_0xedbb[_0x19ae3c];return _0x5e155a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbedb('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbedb('0x1')]();var auth=require(_0xbedb('0x2'));var interaction=require(_0xbedb('0x3'));var config=require(_0xbedb('0x4'));var controller=require('./voiceMailMessage.controller');router[_0xbedb('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbedb('0x6'),auth[_0xbedb('0x7')](),controller[_0xbedb('0x8')]);router['get'](_0xbedb('0x9'),auth[_0xbedb('0x7')](),controller['download']);router[_0xbedb('0xa')]('/',auth[_0xbedb('0x7')](),controller[_0xbedb('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbedb('0xc')]);router[_0xbedb('0xd')](_0xbedb('0x6'),auth[_0xbedb('0x7')](),controller[_0xbedb('0xe')]);module[_0xbedb('0xf')]=router; \ No newline at end of file +var _0x0a0a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','post','create','/:id','delete','destroy','multer','util','path'];(function(_0x437ff3,_0x99cc1d){var _0xaf8047=function(_0x3b6693){while(--_0x3b6693){_0x437ff3['push'](_0x437ff3['shift']());}};_0xaf8047(++_0x99cc1d);}(_0x0a0a,0xb1));var _0xa0a0=function(_0x4da7f9,_0x452d6f){_0x4da7f9=_0x4da7f9-0x0;var _0xa8a42a=_0x0a0a[_0x4da7f9];return _0xa8a42a;};'use strict';var multer=require(_0xa0a0('0x0'));var util=require(_0xa0a0('0x1'));var path=require(_0xa0a0('0x2'));var timeout=require(_0xa0a0('0x3'));var express=require(_0xa0a0('0x4'));var router=express[_0xa0a0('0x5')]();var auth=require(_0xa0a0('0x6'));var interaction=require(_0xa0a0('0x7'));var config=require('../../config/environment');var controller=require(_0xa0a0('0x8'));router[_0xa0a0('0x9')]('/',auth[_0xa0a0('0xa')](),controller[_0xa0a0('0xb')]);router[_0xa0a0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xa0a0('0xc'),auth[_0xa0a0('0xa')](),controller['download']);router[_0xa0a0('0xd')]('/',auth['isAuthenticated'](),controller[_0xa0a0('0xe')]);router['put'](_0xa0a0('0xf'),auth[_0xa0a0('0xa')](),controller['update']);router[_0xa0a0('0x10')](_0xa0a0('0xf'),auth['isAuthenticated'](),controller[_0xa0a0('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 37c8a67..69b5a87 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 _0x3d9c=['STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x205a9d,_0x1cd184){var _0x4bea74=function(_0x496ba9){while(--_0x496ba9){_0x205a9d['push'](_0x205a9d['shift']());}};_0x4bea74(++_0x1cd184);}(_0x3d9c,0xb8));var _0xc3d9=function(_0x89c6d9,_0x520f9c){_0x89c6d9=_0x89c6d9-0x0;var _0xb7b163=_0x3d9c[_0x89c6d9];return _0xb7b163;};'use strict';var Sequelize=require(_0xc3d9('0x0'));module[_0xc3d9('0x1')]={'name':{'type':Sequelize[_0xc3d9('0x2')],'get':function(_0x2318c2){return this[_0xc3d9('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xc3d9('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xc3d9('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc3d9('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xc3d9('0x7')](_0xc3d9('0x8'))}}; \ No newline at end of file +var _0x8352=['STRING','long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x360025,_0xe09262){var _0x3f4bb8=function(_0x27ab40){while(--_0x27ab40){_0x360025['push'](_0x360025['shift']());}};_0x3f4bb8(++_0xe09262);}(_0x8352,0x1d1));var _0x2835=function(_0x4dff02,_0x4281c7){_0x4dff02=_0x4dff02-0x0;var _0x358a5b=_0x8352[_0x4dff02];return _0x358a5b;};'use strict';var Sequelize=require(_0x2835('0x0'));module['exports']={'name':{'type':Sequelize[_0x2835('0x1')],'get':function(_0x317648){return this[_0x2835('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x2835('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x2835('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x2835('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x2835('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a203bda..ca2a75b 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 _0x597f=['ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','index','VoiceMailMessage','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','keys','rawAttributes','options','find','catch','body','download','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv'];(function(_0x53ba69,_0x287485){var _0x41debc=function(_0x2abd36){while(--_0x2abd36){_0x53ba69['push'](_0x53ba69['shift']());}};_0x41debc(++_0x287485);}(_0x597f,0x177));var _0xf597=function(_0x48ce56,_0x213bea){_0x48ce56=_0x48ce56-0x0;var _0x25e8a1=_0x597f[_0x48ce56];return _0x25e8a1;};'use strict';var pdf=require(_0xf597('0x0'));var emlformat=require(_0xf597('0x1'));var rimraf=require(_0xf597('0x2'));var zipdir=require(_0xf597('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf597('0x4'));var moment=require(_0xf597('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf597('0x6'));var util=require('util');var path=require(_0xf597('0x7'));var sox=require(_0xf597('0x8'));var csv=require(_0xf597('0x9'));var ejs=require(_0xf597('0xa'));var fs=require('fs');var _=require(_0xf597('0xb'));var squel=require(_0xf597('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf597('0x9'));var querystring=require(_0xf597('0xd'));var Papa=require(_0xf597('0xe'));var Redis=require(_0xf597('0xf'));var authService=require(_0xf597('0x10'));var qs=require(_0xf597('0x11'));var as=require(_0xf597('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf597('0x13'))(_0xf597('0x14'));var utils=require('../../config/utils');var config=require(_0xf597('0x15'));var licenseUtil=require(_0xf597('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa99f9b,_0x526b66){_0x526b66=_0x526b66||0xcc;return function(_0x3194f2){if(_0x3194f2){return _0xa99f9b['sendStatus'](_0x526b66);}return _0xa99f9b[_0xf597('0x17')](_0x526b66)[_0xf597('0x18')]();};}function respondWithResult(_0x2eacdc,_0x5ec11e){_0x5ec11e=_0x5ec11e||0xc8;return function(_0x1486a0){if(_0x1486a0){return _0x2eacdc['status'](_0x5ec11e)[_0xf597('0x19')](_0x1486a0);}};}function respondWithFilteredResult(_0x55a6ee,_0x4489ff){return function(_0x3001cd){if(_0x3001cd){var _0x1ebd03=_0x3001cd[_0xf597('0x1a')],_0x40ff20=_0x4489ff[_0xf597('0x1b')],_0x2df7f7=_0x4489ff['offset']+_0x4489ff[_0xf597('0x1c')],_0x126961;if(_0x2df7f7>=_0x1ebd03){_0x2df7f7=_0x1ebd03;_0x126961=0xc8;}else{_0x126961=0xce;}_0x55a6ee[_0xf597('0x17')](_0x126961);return _0x55a6ee[_0xf597('0x1d')](_0xf597('0x1e'),_0x40ff20+'-'+_0x2df7f7+'/'+_0x1ebd03)['json'](_0x3001cd);}return null;};}function patchUpdates(_0x1aa2fc){return function(_0x18f3d9){try{jsonpatch[_0xf597('0x1f')](_0x18f3d9,_0x1aa2fc,!![]);}catch(_0x277e42){return BPromise[_0xf597('0x20')](_0x277e42);}return _0x18f3d9[_0xf597('0x21')]();};}function saveUpdates(_0x3d1ee3,_0x595f51){return function(_0x58fd03){if(_0x58fd03){return _0x58fd03[_0xf597('0x22')](_0x3d1ee3)['then'](function(_0x2fd51b){return _0x2fd51b;});}return null;};}function removeEntity(_0x3d0d7e,_0x11fbb7){return function(_0x354c99){if(_0x354c99){return _0x354c99[_0xf597('0x23')]()[_0xf597('0x24')](function(){_0x3d0d7e[_0xf597('0x17')](0xcc)[_0xf597('0x18')]();});}};}function handleEntityNotFound(_0x3e0c03,_0x7f914c){return function(_0x3823f2){if(!_0x3823f2){_0x3e0c03[_0xf597('0x25')](0x194);}return _0x3823f2;};}function handleError(_0x5335e4,_0x59f332){_0x59f332=_0x59f332||0x1f4;return function(_0x2bdcc6){logger['error'](_0x2bdcc6['stack']);if(_0x2bdcc6[_0xf597('0x26')]){delete _0x2bdcc6[_0xf597('0x26')];}_0x5335e4[_0xf597('0x17')](_0x59f332)[_0xf597('0x27')](_0x2bdcc6);};}exports[_0xf597('0x28')]=function(_0x4fe31e,_0x368ab0){var _0x24b016={},_0x31bcc7={},_0x13a12a={'count':0x0,'rows':[]};var _0x1c9b68=_['map'](db[_0xf597('0x29')]['rawAttributes'],function(_0x585cac){return{'name':_0x585cac['fieldName'],'type':_0x585cac[_0xf597('0x2a')][_0xf597('0x2b')]};});_0x31bcc7[_0xf597('0x2c')]=_['differenceBy'](_[_0xf597('0x2d')](_0x1c9b68,'name'),[_0xf597('0x26')]);_0x31bcc7[_0xf597('0x2e')]=_['keys'](_0x4fe31e['query']);_0x31bcc7[_0xf597('0x2f')]=_[_0xf597('0x30')](_0x31bcc7[_0xf597('0x2c')],_0x31bcc7['query']);_0x24b016[_0xf597('0x31')]=_[_0xf597('0x30')](_0x31bcc7[_0xf597('0x2c')],qs[_0xf597('0x32')](_0x4fe31e[_0xf597('0x2e')][_0xf597('0x32')]));_0x24b016[_0xf597('0x31')]=_0x24b016['attributes'][_0xf597('0x33')]?_0x24b016['attributes']:_0x31bcc7['model'];if(!_0x4fe31e[_0xf597('0x2e')]['hasOwnProperty']('nolimit')){_0x24b016[_0xf597('0x1c')]=qs[_0xf597('0x1c')](_0x4fe31e['query'][_0xf597('0x1c')]);_0x24b016['offset']=qs['offset'](_0x4fe31e[_0xf597('0x2e')][_0xf597('0x1b')]);}_0x24b016[_0xf597('0x34')]=qs[_0xf597('0x35')](_0x4fe31e[_0xf597('0x2e')][_0xf597('0x35')]);_0x24b016[_0xf597('0x36')]=qs[_0xf597('0x2f')](_[_0xf597('0x37')](_0x4fe31e[_0xf597('0x2e')],_0x31bcc7[_0xf597('0x2f')]),_0x1c9b68);if(_0x4fe31e[_0xf597('0x2e')][_0xf597('0x38')]){_0x24b016[_0xf597('0x36')]=_[_0xf597('0x39')](_0x24b016[_0xf597('0x36')],{'$or':_[_0xf597('0x2d')](_0x1c9b68,function(_0xb9988a){if(_0xb9988a['type']!==_0xf597('0x3a')){var _0x58e62f={};_0x58e62f[_0xb9988a['name']]={'$like':'%'+_0x4fe31e[_0xf597('0x2e')]['filter']+'%'};return _0x58e62f;}})});}_0x24b016=_[_0xf597('0x39')]({},_0x24b016,_0x4fe31e['options']);var _0xef9244={'where':_0x24b016[_0xf597('0x36')]};return db[_0xf597('0x29')]['count'](_0xef9244)[_0xf597('0x24')](function(_0x694c48){_0x13a12a[_0xf597('0x1a')]=_0x694c48;if(_0x4fe31e['query'][_0xf597('0x3b')]){_0x24b016['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf597('0x3c')](_0x24b016);})[_0xf597('0x24')](function(_0x299bbd){_0x13a12a[_0xf597('0x3d')]=_0x299bbd;return _0x13a12a;})[_0xf597('0x24')](respondWithFilteredResult(_0x368ab0,_0x24b016))['catch'](handleError(_0x368ab0,null));};exports['show']=function(_0xe93078,_0x9e5a77){var _0x2caf7a={'raw':!![],'where':{'id':_0xe93078[_0xf597('0x3e')]['id']}},_0x47a449={};_0x47a449[_0xf597('0x2c')]=_[_0xf597('0x3f')](db[_0xf597('0x29')][_0xf597('0x40')]);_0x47a449[_0xf597('0x2e')]=_[_0xf597('0x3f')](_0xe93078['query']);_0x47a449['filters']=_[_0xf597('0x30')](_0x47a449['model'],_0x47a449['query']);_0x2caf7a[_0xf597('0x31')]=_[_0xf597('0x30')](_0x47a449[_0xf597('0x2c')],qs[_0xf597('0x32')](_0xe93078[_0xf597('0x2e')][_0xf597('0x32')]));_0x2caf7a[_0xf597('0x31')]=_0x2caf7a[_0xf597('0x31')][_0xf597('0x33')]?_0x2caf7a[_0xf597('0x31')]:_0x47a449['model'];if(_0xe93078[_0xf597('0x2e')][_0xf597('0x3b')]){_0x2caf7a['include']=[{'all':!![]}];}_0x2caf7a=_[_0xf597('0x39')]({},_0x2caf7a,_0xe93078[_0xf597('0x41')]);return db[_0xf597('0x29')][_0xf597('0x42')](_0x2caf7a)['then'](handleEntityNotFound(_0x9e5a77,null))['then'](respondWithResult(_0x9e5a77,null))[_0xf597('0x43')](handleError(_0x9e5a77,null));};exports['create']=function(_0x2becd7,_0x1c49f2){return db[_0xf597('0x29')]['create'](_0x2becd7[_0xf597('0x44')],{})['then'](respondWithResult(_0x1c49f2,0xc9))['catch'](handleError(_0x1c49f2,null));};exports[_0xf597('0x22')]=function(_0x3e3cb2,_0x5ecba2){if(_0x3e3cb2[_0xf597('0x44')]['id']){delete _0x3e3cb2[_0xf597('0x44')]['id'];}return db['VoiceMailMessage'][_0xf597('0x42')]({'where':{'id':_0x3e3cb2['params']['id']}})[_0xf597('0x24')](handleEntityNotFound(_0x5ecba2,null))[_0xf597('0x24')](saveUpdates(_0x3e3cb2['body'],null))[_0xf597('0x24')](respondWithResult(_0x5ecba2,null))['catch'](handleError(_0x5ecba2,null));};exports['destroy']=function(_0x27a286,_0x1be4f0){return db[_0xf597('0x29')][_0xf597('0x42')]({'where':{'id':_0x27a286[_0xf597('0x3e')]['id']}})[_0xf597('0x24')](handleEntityNotFound(_0x1be4f0,null))[_0xf597('0x24')](removeEntity(_0x1be4f0,null))[_0xf597('0x43')](handleError(_0x1be4f0,null));};exports[_0xf597('0x45')]=function(_0x5b57ec,_0xbbba0f,_0x5d9548){return db[_0xf597('0x29')]['find']({'where':{'id':_0x5b57ec['params']['id']},'attributes':['id','recording',_0xf597('0x46')]})[_0xf597('0x24')](handleEntityNotFound(_0xbbba0f,null))[_0xf597('0x24')](function(_0x3b0195){if(_0x3b0195){if(!_0x3b0195['recording']){throw new db[(_0xf597('0x47'))]['ValidationError'](_0xf597('0x48'));}var _0x5e950f={'Content-Type':_0xf597('0x49'),'Content-Disposition':_0xf597('0x4a')};if(_0x3b0195[_0xf597('0x46')]){_0x5e950f[_0xf597('0x4b')]=_0xf597('0x4c')+_0x3b0195['msg_id']+'.wav\x22';}_0xbbba0f[_0xf597('0x1d')](_0x5e950f);return _0xbbba0f[_0xf597('0x27')](new Buffer(_0x3b0195['recording']));}})[_0xf597('0x43')](handleError(_0xbbba0f,null));}; \ No newline at end of file +var _0xc53a=['crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','send','index','map','fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','VoiceMailMessage','then','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','find','create','body','recording','Sequelize','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x6b658b,_0xd739c){var _0x546719=function(_0x20dd83){while(--_0x20dd83){_0x6b658b['push'](_0x6b658b['shift']());}};_0x546719(++_0xd739c);}(_0xc53a,0xf4));var _0xac53=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc53a[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0xac53('0x0'));var emlformat=require(_0xac53('0x1'));var rimraf=require(_0xac53('0x2'));var zipdir=require(_0xac53('0x3'));var jsonpatch=require(_0xac53('0x4'));var rp=require(_0xac53('0x5'));var moment=require(_0xac53('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac53('0x7'));var path=require(_0xac53('0x8'));var sox=require(_0xac53('0x9'));var csv=require(_0xac53('0xa'));var ejs=require(_0xac53('0xb'));var fs=require('fs');var _=require(_0xac53('0xc'));var squel=require(_0xac53('0xd'));var crypto=require(_0xac53('0xe'));var jsforce=require(_0xac53('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac53('0x10'));var Papa=require('papaparse');var Redis=require(_0xac53('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xac53('0x12'));var as=require(_0xac53('0x13'));var hardwareService=require(_0xac53('0x14'));var logger=require(_0xac53('0x15'))(_0xac53('0x16'));var utils=require(_0xac53('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xac53('0x18'));var db=require(_0xac53('0x19'))['db'];function respondWithStatusCode(_0x2cfdbf,_0x55463b){_0x55463b=_0x55463b||0xcc;return function(_0x163ec0){if(_0x163ec0){return _0x2cfdbf[_0xac53('0x1a')](_0x55463b);}return _0x2cfdbf[_0xac53('0x1b')](_0x55463b)['end']();};}function respondWithResult(_0x254173,_0x56c6cc){_0x56c6cc=_0x56c6cc||0xc8;return function(_0x13eb0a){if(_0x13eb0a){return _0x254173[_0xac53('0x1b')](_0x56c6cc)[_0xac53('0x1c')](_0x13eb0a);}};}function respondWithFilteredResult(_0x536388,_0x249252){return function(_0x231a13){if(_0x231a13){var _0x428c20=_0x231a13['count'],_0x328bdf=_0x249252[_0xac53('0x1d')],_0x160a0c=_0x249252[_0xac53('0x1d')]+_0x249252[_0xac53('0x1e')],_0x467447;if(_0x160a0c>=_0x428c20){_0x160a0c=_0x428c20;_0x467447=0xc8;}else{_0x467447=0xce;}_0x536388[_0xac53('0x1b')](_0x467447);return _0x536388[_0xac53('0x1f')](_0xac53('0x20'),_0x328bdf+'-'+_0x160a0c+'/'+_0x428c20)['json'](_0x231a13);}return null;};}function patchUpdates(_0x4a49ec){return function(_0x5e698f){try{jsonpatch[_0xac53('0x21')](_0x5e698f,_0x4a49ec,!![]);}catch(_0x16c48b){return BPromise[_0xac53('0x22')](_0x16c48b);}return _0x5e698f[_0xac53('0x23')]();};}function saveUpdates(_0x12081c,_0x30ba9c){return function(_0x421784){if(_0x421784){return _0x421784[_0xac53('0x24')](_0x12081c)['then'](function(_0x36e2a3){return _0x36e2a3;});}return null;};}function removeEntity(_0x281f8c,_0x2bb253){return function(_0x2dac50){if(_0x2dac50){return _0x2dac50[_0xac53('0x25')]()['then'](function(){_0x281f8c[_0xac53('0x1b')](0xcc)[_0xac53('0x26')]();});}};}function handleEntityNotFound(_0x38d97e,_0x347b7f){return function(_0x2295a3){if(!_0x2295a3){_0x38d97e['sendStatus'](0x194);}return _0x2295a3;};}function handleError(_0x9f135c,_0x277c25){_0x277c25=_0x277c25||0x1f4;return function(_0x5beb38){logger[_0xac53('0x27')](_0x5beb38[_0xac53('0x28')]);if(_0x5beb38['name']){delete _0x5beb38['name'];}_0x9f135c[_0xac53('0x1b')](_0x277c25)[_0xac53('0x29')](_0x5beb38);};}exports[_0xac53('0x2a')]=function(_0x589346,_0xb2ae47){var _0x2d4931={},_0x40dd46={},_0x43e932={'count':0x0,'rows':[]};var _0x1c1d61=_[_0xac53('0x2b')](db['VoiceMailMessage']['rawAttributes'],function(_0xf03f6f){return{'name':_0xf03f6f[_0xac53('0x2c')],'type':_0xf03f6f[_0xac53('0x2d')][_0xac53('0x2e')]};});_0x40dd46['model']=_['differenceBy'](_[_0xac53('0x2b')](_0x1c1d61,_0xac53('0x2f')),[_0xac53('0x2f')]);_0x40dd46[_0xac53('0x30')]=_['keys'](_0x589346[_0xac53('0x30')]);_0x40dd46['filters']=_[_0xac53('0x31')](_0x40dd46[_0xac53('0x32')],_0x40dd46['query']);_0x2d4931[_0xac53('0x33')]=_['intersection'](_0x40dd46[_0xac53('0x32')],qs[_0xac53('0x34')](_0x589346[_0xac53('0x30')][_0xac53('0x34')]));_0x2d4931[_0xac53('0x33')]=_0x2d4931[_0xac53('0x33')][_0xac53('0x35')]?_0x2d4931[_0xac53('0x33')]:_0x40dd46['model'];if(!_0x589346['query'][_0xac53('0x36')](_0xac53('0x37'))){_0x2d4931[_0xac53('0x1e')]=qs[_0xac53('0x1e')](_0x589346[_0xac53('0x30')][_0xac53('0x1e')]);_0x2d4931[_0xac53('0x1d')]=qs[_0xac53('0x1d')](_0x589346[_0xac53('0x30')]['offset']);}_0x2d4931['order']=qs[_0xac53('0x38')](_0x589346[_0xac53('0x30')][_0xac53('0x38')]);_0x2d4931[_0xac53('0x39')]=qs['filters'](_[_0xac53('0x3a')](_0x589346[_0xac53('0x30')],_0x40dd46[_0xac53('0x3b')]),_0x1c1d61);if(_0x589346[_0xac53('0x30')][_0xac53('0x3c')]){_0x2d4931[_0xac53('0x39')]=_[_0xac53('0x3d')](_0x2d4931[_0xac53('0x39')],{'$or':_[_0xac53('0x2b')](_0x1c1d61,function(_0xa20baf){if(_0xa20baf[_0xac53('0x2d')]!==_0xac53('0x3e')){var _0x3d8ad3={};_0x3d8ad3[_0xa20baf[_0xac53('0x2f')]]={'$like':'%'+_0x589346[_0xac53('0x30')][_0xac53('0x3c')]+'%'};return _0x3d8ad3;}})});}_0x2d4931=_['merge']({},_0x2d4931,_0x589346['options']);var _0x46b796={'where':_0x2d4931[_0xac53('0x39')]};return db[_0xac53('0x3f')]['count'](_0x46b796)[_0xac53('0x40')](function(_0xe67a11){_0x43e932[_0xac53('0x41')]=_0xe67a11;if(_0x589346[_0xac53('0x30')][_0xac53('0x42')]){_0x2d4931[_0xac53('0x43')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xac53('0x44')](_0x2d4931);})[_0xac53('0x40')](function(_0x1dd17f){_0x43e932[_0xac53('0x45')]=_0x1dd17f;return _0x43e932;})[_0xac53('0x40')](respondWithFilteredResult(_0xb2ae47,_0x2d4931))[_0xac53('0x46')](handleError(_0xb2ae47,null));};exports[_0xac53('0x47')]=function(_0x113a1d,_0x1b5448){var _0x20407c={'raw':!![],'where':{'id':_0x113a1d[_0xac53('0x48')]['id']}},_0x2f106d={};_0x2f106d[_0xac53('0x32')]=_['keys'](db['VoiceMailMessage'][_0xac53('0x49')]);_0x2f106d[_0xac53('0x30')]=_[_0xac53('0x4a')](_0x113a1d[_0xac53('0x30')]);_0x2f106d['filters']=_[_0xac53('0x31')](_0x2f106d[_0xac53('0x32')],_0x2f106d[_0xac53('0x30')]);_0x20407c['attributes']=_[_0xac53('0x31')](_0x2f106d[_0xac53('0x32')],qs[_0xac53('0x34')](_0x113a1d[_0xac53('0x30')][_0xac53('0x34')]));_0x20407c[_0xac53('0x33')]=_0x20407c[_0xac53('0x33')]['length']?_0x20407c[_0xac53('0x33')]:_0x2f106d[_0xac53('0x32')];if(_0x113a1d[_0xac53('0x30')][_0xac53('0x42')]){_0x20407c['include']=[{'all':!![]}];}_0x20407c=_[_0xac53('0x3d')]({},_0x20407c,_0x113a1d[_0xac53('0x4b')]);return db['VoiceMailMessage'][_0xac53('0x4c')](_0x20407c)[_0xac53('0x40')](handleEntityNotFound(_0x1b5448,null))[_0xac53('0x40')](respondWithResult(_0x1b5448,null))['catch'](handleError(_0x1b5448,null));};exports['create']=function(_0x180e97,_0x1faf41){return db[_0xac53('0x3f')][_0xac53('0x4d')](_0x180e97[_0xac53('0x4e')],{})[_0xac53('0x40')](respondWithResult(_0x1faf41,0xc9))[_0xac53('0x46')](handleError(_0x1faf41,null));};exports['update']=function(_0x31c76f,_0x1fa397){if(_0x31c76f['body']['id']){delete _0x31c76f[_0xac53('0x4e')]['id'];}return db[_0xac53('0x3f')][_0xac53('0x4c')]({'where':{'id':_0x31c76f[_0xac53('0x48')]['id']}})[_0xac53('0x40')](handleEntityNotFound(_0x1fa397,null))['then'](saveUpdates(_0x31c76f[_0xac53('0x4e')],null))[_0xac53('0x40')](respondWithResult(_0x1fa397,null))[_0xac53('0x46')](handleError(_0x1fa397,null));};exports[_0xac53('0x25')]=function(_0x2fe793,_0x5926a0){return db[_0xac53('0x3f')]['find']({'where':{'id':_0x2fe793[_0xac53('0x48')]['id']}})[_0xac53('0x40')](handleEntityNotFound(_0x5926a0,null))[_0xac53('0x40')](removeEntity(_0x5926a0,null))['catch'](handleError(_0x5926a0,null));};exports['download']=function(_0x125be3,_0x1f153c,_0x563c8a){return db[_0xac53('0x3f')][_0xac53('0x4c')]({'where':{'id':_0x125be3[_0xac53('0x48')]['id']},'attributes':['id',_0xac53('0x4f'),'msg_id']})[_0xac53('0x40')](handleEntityNotFound(_0x1f153c,null))[_0xac53('0x40')](function(_0x37116f){if(_0x37116f){if(!_0x37116f[_0xac53('0x4f')]){throw new db[(_0xac53('0x50'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x4e8a28={'Content-Type':_0xac53('0x51'),'Content-Disposition':'attachment'};if(_0x37116f[_0xac53('0x52')]){_0x4e8a28[_0xac53('0x53')]=_0xac53('0x54')+_0x37116f[_0xac53('0x52')]+_0xac53('0x55');}_0x1f153c['set'](_0x4e8a28);return _0x1f153c[_0xac53('0x29')](new Buffer(_0x37116f[_0xac53('0x4f')]));}})[_0xac53('0x46')](handleError(_0x1f153c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ebc7ab3..9840142 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 _0x9172=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0xabbf83,_0xcf64a7){var _0x3c0a05=function(_0x108d49){while(--_0x108d49){_0xabbf83['push'](_0xabbf83['shift']());}};_0x3c0a05(++_0xcf64a7);}(_0x9172,0x1e3));var _0x2917=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x9172[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x2917('0x0'));var util=require(_0x2917('0x1'));var logger=require(_0x2917('0x2'))(_0x2917('0x3'));var moment=require(_0x2917('0x4'));var BPromise=require(_0x2917('0x5'));var rp=require(_0x2917('0x6'));var fs=require('fs');var path=require(_0x2917('0x7'));var rimraf=require(_0x2917('0x8'));var config=require(_0x2917('0x9'));var attributes=require(_0x2917('0xa'));module[_0x2917('0xb')]=function(_0x7bc226,_0x1d21c8){return _0x7bc226[_0x2917('0xc')](_0x2917('0xd'),attributes,{'tableName':_0x2917('0xe'),'paranoid':![],'indexes':[{'name':_0x2917('0xf'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x857d=['dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x857d,0x1a5));var _0xd857=function(_0x872bfe,_0x5e16c5){_0x872bfe=_0x872bfe-0x0;var _0x135dff=_0x857d[_0x872bfe];return _0x135dff;};'use strict';var _=require(_0xd857('0x0'));var util=require(_0xd857('0x1'));var logger=require(_0xd857('0x2'))(_0xd857('0x3'));var moment=require(_0xd857('0x4'));var BPromise=require(_0xd857('0x5'));var rp=require(_0xd857('0x6'));var fs=require('fs');var path=require(_0xd857('0x7'));var rimraf=require('rimraf');var config=require(_0xd857('0x8'));var attributes=require(_0xd857('0x9'));module[_0xd857('0xa')]=function(_0xd5d68,_0x1d219c){return _0xd5d68['define'](_0xd857('0xb'),attributes,{'tableName':_0xd857('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xd857('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index e4fb52c..5e9bf95 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 _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xbce33b,_0x3e6df4){var _0xba0652=function(_0x19657e){while(--_0x19657e){_0xbce33b['push'](_0xbce33b['shift']());}};_0xba0652(++_0x3e6df4);}(_0x57ca,0x108));var _0xa57c=function(_0x5a4b70,_0x48f165){_0x5a4b70=_0x5a4b70-0x0;var _0x19225f=_0x57ca[_0x5a4b70];return _0x19225f;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0xad0b7a,_0x13f2d8){var _0x5bd99c=function(_0x1397a1){while(--_0x1397a1){_0xad0b7a['push'](_0xad0b7a['shift']());}};_0x5bd99c(++_0x13f2d8);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5420cd3..ec9b460 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 _0x9a79=['index','/:id','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x480f88,_0xfd1384){var _0x84fabd=function(_0x3e73dc){while(--_0x3e73dc){_0x480f88['push'](_0x480f88['shift']());}};_0x84fabd(++_0xfd1384);}(_0x9a79,0x198));var _0x99a7=function(_0x2c9cf9,_0x2bed45){_0x2c9cf9=_0x2c9cf9-0x0;var _0x560d6d=_0x9a79[_0x2c9cf9];return _0x560d6d;};'use strict';var multer=require(_0x99a7('0x0'));var util=require(_0x99a7('0x1'));var path=require(_0x99a7('0x2'));var timeout=require(_0x99a7('0x3'));var express=require(_0x99a7('0x4'));var router=express[_0x99a7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x99a7('0x6'));var config=require(_0x99a7('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x99a7('0x8')]('/',auth[_0x99a7('0x9')](),controller[_0x99a7('0xa')]);router[_0x99a7('0x8')](_0x99a7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x99a7('0x8')](_0x99a7('0xc'),auth[_0x99a7('0x9')](),controller[_0x99a7('0xd')]);router[_0x99a7('0xe')]('/',auth[_0x99a7('0x9')](),controller['create']);router['post'](_0x99a7('0xc'),auth[_0x99a7('0x9')](),controller[_0x99a7('0xf')]);router[_0x99a7('0x10')](_0x99a7('0xb'),auth[_0x99a7('0x9')](),controller[_0x99a7('0x11')]);router[_0x99a7('0x12')](_0x99a7('0xb'),auth[_0x99a7('0x9')](),controller[_0x99a7('0x13')]);router[_0x99a7('0x12')](_0x99a7('0x14'),auth[_0x99a7('0x9')](),controller['removeSound']);module[_0x99a7('0x15')]=router; \ No newline at end of file +var _0xe688=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x34d9c2,_0x36db48){var _0x3f702f=function(_0x2bd3cd){while(--_0x2bd3cd){_0x34d9c2['push'](_0x34d9c2['shift']());}};_0x3f702f(++_0x36db48);}(_0xe688,0x1f4));var _0x8e68=function(_0x2353c8,_0x333806){_0x2353c8=_0x2353c8-0x0;var _0x2caa2d=_0xe688[_0x2353c8];return _0x2caa2d;};'use strict';var multer=require(_0x8e68('0x0'));var util=require(_0x8e68('0x1'));var path=require(_0x8e68('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e68('0x3'));var router=express[_0x8e68('0x4')]();var auth=require(_0x8e68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e68('0x6'));var controller=require(_0x8e68('0x7'));router[_0x8e68('0x8')]('/',auth[_0x8e68('0x9')](),controller[_0x8e68('0xa')]);router['get'](_0x8e68('0xb'),auth[_0x8e68('0x9')](),controller[_0x8e68('0xc')]);router[_0x8e68('0x8')](_0x8e68('0xd'),auth[_0x8e68('0x9')](),controller[_0x8e68('0xe')]);router[_0x8e68('0xf')]('/',auth['isAuthenticated'](),controller[_0x8e68('0x10')]);router[_0x8e68('0xf')](_0x8e68('0xd'),auth[_0x8e68('0x9')](),controller[_0x8e68('0x11')]);router[_0x8e68('0x12')](_0x8e68('0xb'),auth[_0x8e68('0x9')](),controller['update']);router['delete']('/:id',auth[_0x8e68('0x9')](),controller['destroy']);router[_0x8e68('0x13')](_0x8e68('0x14'),auth[_0x8e68('0x9')](),controller[_0x8e68('0x15')]);module[_0x8e68('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 46a1601..872f74c 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 _0xe054=['files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','exports','name','ENUM'];(function(_0x46a158,_0x13e95a){var _0x239032=function(_0x2ba2cf){while(--_0x2ba2cf){_0x46a158['push'](_0x46a158['shift']());}};_0x239032(++_0x13e95a);}(_0xe054,0xe4));var _0x4e05=function(_0x3690de,_0xaad404){_0x3690de=_0x3690de-0x0;var _0x9737de=_0xe054[_0x3690de];return _0x9737de;};'use strict';var Sequelize=require('sequelize');module[_0x4e05('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4e05('0x1')},'mode':{'type':Sequelize[_0x4e05('0x2')]('custom',_0x4e05('0x3'),'mp3nb',_0x4e05('0x4'),_0x4e05('0x5'),_0x4e05('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x4e05('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x4e05('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4e05('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4e05('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x4e05('0x9')},'defaultEntry':{'type':Sequelize[_0x4e05('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8879=['exports','STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3','alpha','sequelize'];(function(_0x5716b9,_0x479332){var _0x138422=function(_0x40ad8c){while(--_0x40ad8c){_0x5716b9['push'](_0x5716b9['shift']());}};_0x138422(++_0x479332);}(_0x8879,0x154));var _0x9887=function(_0x45c5fc,_0x8c4774){_0x45c5fc=_0x45c5fc-0x0;var _0x234920=_0x8879[_0x45c5fc];return _0x234920;};'use strict';var Sequelize=require(_0x9887('0x0'));module[_0x9887('0x1')]={'name':{'type':Sequelize[_0x9887('0x2')],'allowNull':![],'unique':_0x9887('0x3')},'mode':{'type':Sequelize[_0x9887('0x4')](_0x9887('0x5'),_0x9887('0x6'),'mp3nb',_0x9887('0x7'),_0x9887('0x8'),_0x9887('0x9')),'allowNull':!![],'defaultValue':_0x9887('0x6')},'directory':{'type':Sequelize[_0x9887('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9887('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9887('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9887('0x2')],'allowNull':!![],'defaultValue':_0x9887('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'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 c0ec867..e93f9c9 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 _0xda5e=['length','nolimit','offset','order','sort','pick','where','merge','type','VIRTUAL','includeAll','include','catch','show','rawAttributes','find','body','params','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','role','user','UserProfileSection','userProfileId','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','createdAt','%s.%s','save_name','format','converted_format','symlinkSync','removeSound','id2','Sound','getSounds','filter','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','limit','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0x507155,_0x3a51e5){var _0x18859f=function(_0x2dae57){while(--_0x2dae57){_0x507155['push'](_0x507155['shift']());}};_0x18859f(++_0x3a51e5);}(_0xda5e,0xa0));var _0xeda5=function(_0x300c90,_0x4f6cbf){_0x300c90=_0x300c90-0x0;var _0x1db7d2=_0xda5e[_0x300c90];return _0x1db7d2;};'use strict';var pdf=require(_0xeda5('0x0'));var emlformat=require(_0xeda5('0x1'));var rimraf=require(_0xeda5('0x2'));var zipdir=require(_0xeda5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeda5('0x4'));var util=require(_0xeda5('0x5'));var path=require(_0xeda5('0x6'));var sox=require(_0xeda5('0x7'));var csv=require(_0xeda5('0x8'));var ejs=require(_0xeda5('0x9'));var fs=require('fs');var _=require(_0xeda5('0xa'));var squel=require('squel');var crypto=require(_0xeda5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeda5('0xc'));var toCsv=require(_0xeda5('0x8'));var querystring=require(_0xeda5('0xd'));var Papa=require(_0xeda5('0xe'));var Redis=require(_0xeda5('0xf'));var authService=require(_0xeda5('0x10'));var qs=require(_0xeda5('0x11'));var as=require(_0xeda5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeda5('0x13'))(_0xeda5('0x14'));var utils=require('../../config/utils');var config=require(_0xeda5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeda5('0x16'))['db'];function respondWithStatusCode(_0x5b40b6,_0x3b05c4){_0x3b05c4=_0x3b05c4||0xcc;return function(_0x26b550){if(_0x26b550){return _0x5b40b6[_0xeda5('0x17')](_0x3b05c4);}return _0x5b40b6[_0xeda5('0x18')](_0x3b05c4)['end']();};}function respondWithResult(_0x30fe21,_0x45cde9){_0x45cde9=_0x45cde9||0xc8;return function(_0x421fa0){if(_0x421fa0){return _0x30fe21['status'](_0x45cde9)['json'](_0x421fa0);}};}function respondWithFilteredResult(_0x55f0de,_0xbba332){return function(_0x15a5a5){if(_0x15a5a5){var _0x208bb9=_0x15a5a5[_0xeda5('0x19')],_0x10eeb5=_0xbba332['offset'],_0x5c635f=_0xbba332['offset']+_0xbba332[_0xeda5('0x1a')],_0x1ceee6;if(_0x5c635f>=_0x208bb9){_0x5c635f=_0x208bb9;_0x1ceee6=0xc8;}else{_0x1ceee6=0xce;}_0x55f0de[_0xeda5('0x18')](_0x1ceee6);return _0x55f0de['set'](_0xeda5('0x1b'),_0x10eeb5+'-'+_0x5c635f+'/'+_0x208bb9)['json'](_0x15a5a5);}return null;};}function patchUpdates(_0x2c0da3){return function(_0x23099b){try{jsonpatch[_0xeda5('0x1c')](_0x23099b,_0x2c0da3,!![]);}catch(_0x1ff8fc){return BPromise['reject'](_0x1ff8fc);}return _0x23099b[_0xeda5('0x1d')]();};}function saveUpdates(_0x46ff39,_0x5e99ab){return function(_0x223f21){if(_0x223f21){return _0x223f21[_0xeda5('0x1e')](_0x46ff39)[_0xeda5('0x1f')](function(_0xe3cd67){return _0xe3cd67;});}return null;};}function removeEntity(_0x4f1c25,_0x211e9c){return function(_0x18417f){if(_0x18417f){return _0x18417f[_0xeda5('0x20')]()[_0xeda5('0x1f')](function(){var _0x5ee90f=_0x18417f[_0xeda5('0x21')]({'plain':!![]});var _0x4212fe=_0xeda5('0x22');return db[_0xeda5('0x23')]['destroy']({'where':{'type':_0x4212fe,'resourceId':_0x5ee90f['id']}})[_0xeda5('0x1f')](function(){return _0x18417f;});})['then'](function(){_0x4f1c25[_0xeda5('0x18')](0xcc)[_0xeda5('0x24')]();});}};}function handleEntityNotFound(_0x5a174d,_0xe33025){return function(_0x5d4a14){if(!_0x5d4a14){_0x5a174d['sendStatus'](0x194);}return _0x5d4a14;};}function handleError(_0x3ad616,_0x3e8b0c){_0x3e8b0c=_0x3e8b0c||0x1f4;return function(_0x3879b2){logger[_0xeda5('0x25')](_0x3879b2[_0xeda5('0x26')]);if(_0x3879b2[_0xeda5('0x27')]){delete _0x3879b2['name'];}_0x3ad616[_0xeda5('0x18')](_0x3e8b0c)[_0xeda5('0x28')](_0x3879b2);};}exports[_0xeda5('0x29')]=function(_0x2a0e3a,_0x4c6859){var _0x36582e={},_0x22a845={},_0x1e3b75={'count':0x0,'rows':[]};var _0x2f99f2=_[_0xeda5('0x2a')](db[_0xeda5('0x2b')]['rawAttributes'],function(_0x4b1f4d){return{'name':_0x4b1f4d['fieldName'],'type':_0x4b1f4d['type'][_0xeda5('0x2c')]};});_0x22a845['model']=_[_0xeda5('0x2a')](_0x2f99f2,'name');_0x22a845[_0xeda5('0x2d')]=_[_0xeda5('0x2e')](_0x2a0e3a[_0xeda5('0x2d')]);_0x22a845[_0xeda5('0x2f')]=_['intersection'](_0x22a845[_0xeda5('0x30')],_0x22a845[_0xeda5('0x2d')]);_0x36582e[_0xeda5('0x31')]=_[_0xeda5('0x32')](_0x22a845['model'],qs[_0xeda5('0x33')](_0x2a0e3a[_0xeda5('0x2d')]['fields']));_0x36582e[_0xeda5('0x31')]=_0x36582e[_0xeda5('0x31')][_0xeda5('0x34')]?_0x36582e[_0xeda5('0x31')]:_0x22a845['model'];if(!_0x2a0e3a['query']['hasOwnProperty'](_0xeda5('0x35'))){_0x36582e['limit']=qs[_0xeda5('0x1a')](_0x2a0e3a[_0xeda5('0x2d')]['limit']);_0x36582e[_0xeda5('0x36')]=qs[_0xeda5('0x36')](_0x2a0e3a[_0xeda5('0x2d')]['offset']);}_0x36582e[_0xeda5('0x37')]=qs[_0xeda5('0x38')](_0x2a0e3a['query'][_0xeda5('0x38')]);_0x36582e['where']=qs[_0xeda5('0x2f')](_[_0xeda5('0x39')](_0x2a0e3a[_0xeda5('0x2d')],_0x22a845[_0xeda5('0x2f')]),_0x2f99f2);if(_0x2a0e3a[_0xeda5('0x2d')]['filter']){_0x36582e[_0xeda5('0x3a')]=_[_0xeda5('0x3b')](_0x36582e[_0xeda5('0x3a')],{'$or':_['map'](_0x2f99f2,function(_0x5e61c3){if(_0x5e61c3[_0xeda5('0x3c')]!==_0xeda5('0x3d')){var _0x5e2bf0={};_0x5e2bf0[_0x5e61c3[_0xeda5('0x27')]]={'$like':'%'+_0x2a0e3a['query']['filter']+'%'};return _0x5e2bf0;}})});}_0x36582e=_[_0xeda5('0x3b')]({},_0x36582e,_0x2a0e3a['options']);var _0x33a6ac={'where':_0x36582e[_0xeda5('0x3a')]};return db[_0xeda5('0x2b')][_0xeda5('0x19')](_0x33a6ac)[_0xeda5('0x1f')](function(_0x1c632e){_0x1e3b75[_0xeda5('0x19')]=_0x1c632e;if(_0x2a0e3a['query'][_0xeda5('0x3e')]){_0x36582e[_0xeda5('0x3f')]=[{'all':!![]}];}return db[_0xeda5('0x2b')]['findAll'](_0x36582e);})['then'](function(_0x4b3134){_0x1e3b75['rows']=_0x4b3134;return _0x1e3b75;})[_0xeda5('0x1f')](respondWithFilteredResult(_0x4c6859,_0x36582e))[_0xeda5('0x40')](handleError(_0x4c6859,null));};exports[_0xeda5('0x41')]=function(_0x350515,_0x3ab269){var _0x124aac={'raw':![],'where':{'id':_0x350515['params']['id']}},_0x32f87d={};_0x32f87d[_0xeda5('0x30')]=_[_0xeda5('0x2e')](db['VoiceMusicOnHold'][_0xeda5('0x42')]);_0x32f87d['query']=_[_0xeda5('0x2e')](_0x350515[_0xeda5('0x2d')]);_0x32f87d['filters']=_[_0xeda5('0x32')](_0x32f87d[_0xeda5('0x30')],_0x32f87d['query']);_0x124aac[_0xeda5('0x31')]=_[_0xeda5('0x32')](_0x32f87d['model'],qs[_0xeda5('0x33')](_0x350515[_0xeda5('0x2d')][_0xeda5('0x33')]));_0x124aac[_0xeda5('0x31')]=_0x124aac[_0xeda5('0x31')][_0xeda5('0x34')]?_0x124aac['attributes']:_0x32f87d[_0xeda5('0x30')];if(_0x350515['query'][_0xeda5('0x3e')]){_0x124aac['include']=[{'all':!![]}];}_0x124aac=_[_0xeda5('0x3b')]({},_0x124aac,_0x350515['options']);return db[_0xeda5('0x2b')][_0xeda5('0x43')](_0x124aac)[_0xeda5('0x1f')](handleEntityNotFound(_0x3ab269,null))[_0xeda5('0x1f')](respondWithResult(_0x3ab269,null))[_0xeda5('0x40')](handleError(_0x3ab269,null));};exports[_0xeda5('0x1e')]=function(_0x5b1d87,_0x2122fb){if(_0x5b1d87[_0xeda5('0x44')]['id']){delete _0x5b1d87[_0xeda5('0x44')]['id'];}return db[_0xeda5('0x2b')]['find']({'where':{'id':_0x5b1d87[_0xeda5('0x45')]['id']}})[_0xeda5('0x1f')](handleEntityNotFound(_0x2122fb,null))['then'](saveUpdates(_0x5b1d87[_0xeda5('0x44')],null))[_0xeda5('0x1f')](respondWithResult(_0x2122fb,null))['catch'](handleError(_0x2122fb,null));};exports[_0xeda5('0x46')]=function(_0xc76d23,_0x13aa4e,_0x505c01){return db[_0xeda5('0x47')][_0xeda5('0x48')](function(_0x5d0297){if(_0xc76d23[_0xeda5('0x44')]['mode']===_0xeda5('0x49')){_0xc76d23['body'][_0xeda5('0x4a')]=path[_0xeda5('0x4b')](config[_0xeda5('0x4c')],_0xeda5('0x4d'),_0xc76d23[_0xeda5('0x44')][_0xeda5('0x27')]);}return db[_0xeda5('0x2b')][_0xeda5('0x46')](_0xc76d23[_0xeda5('0x44')],{'transaction':_0x5d0297})[_0xeda5('0x1f')](function(_0x23f2d3){if(_0xc76d23['body'][_0xeda5('0x4e')]===_0xeda5('0x49')){fs[_0xeda5('0x4f')](_0x23f2d3[_0xeda5('0x4a')],parseInt(_0xeda5('0x50'),0x8));}var _0x471466=_0xc76d23['user'][_0xeda5('0x21')]({'plain':!![]});if(!_0x471466)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x471466[_0xeda5('0x51')]===_0xeda5('0x52')){var _0x3fe0a4=_0x23f2d3[_0xeda5('0x21')]({'plain':!![]});return db[_0xeda5('0x53')][_0xeda5('0x43')]({'where':{'name':_0xeda5('0x22'),'userProfileId':_0x471466[_0xeda5('0x54')]},'raw':!![]})[_0xeda5('0x1f')](function(_0x1c5162){if(_0x1c5162&&_0x1c5162[_0xeda5('0x55')]===0x0){return db[_0xeda5('0x23')][_0xeda5('0x46')]({'name':_0x3fe0a4[_0xeda5('0x27')],'resourceId':_0x3fe0a4['id'],'type':_0x1c5162[_0xeda5('0x27')],'sectionId':_0x1c5162['id']},{})[_0xeda5('0x1f')](function(){return _0x23f2d3;});}else{return _0x23f2d3;}})[_0xeda5('0x40')](function(_0x828faf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x828faf);});}return _0x23f2d3;});})[_0xeda5('0x1f')](respondWithResult(_0x13aa4e,0xc9))['catch'](handleError(_0x13aa4e,null));};exports[_0xeda5('0x20')]=function(_0x125672,_0x5c5762,_0x2de9ee){var _0x5abd57;return db[_0xeda5('0x2b')]['find']({'where':{'id':_0x125672[_0xeda5('0x45')]['id']}})[_0xeda5('0x1f')](function(_0x4d24a7){if(_0x4d24a7){return db[_0xeda5('0x47')][_0xeda5('0x48')](function(_0x4f6a97){return _0x4d24a7[_0xeda5('0x20')]({'transaction':_0x4f6a97,'raw':!![]})[_0xeda5('0x1f')](function(_0x1944c4){if(_0x1944c4['directory']){fs['readdirSync'](_0x1944c4[_0xeda5('0x4a')])[_0xeda5('0x56')](function(_0xfd4cbd){fs[_0xeda5('0x57')](path[_0xeda5('0x4b')](_0x1944c4[_0xeda5('0x4a')],_0xfd4cbd));});fs[_0xeda5('0x58')](_0x1944c4[_0xeda5('0x4a')]);}return _0x1944c4;});})[_0xeda5('0x40')](function(_0x26cef1){throw new db[(_0xeda5('0x59'))][(_0xeda5('0x5a'))](_0x26cef1[_0xeda5('0x5b')]);});}})[_0xeda5('0x1f')](handleEntityNotFound(_0x5c5762,null))['then'](removeEntity(_0x5c5762,null))[_0xeda5('0x40')](handleError(_0x5c5762,null));};exports[_0xeda5('0x5c')]=function(_0xbc53d3,_0x22e8d3,_0x1e5b04){return db['sequelize'][_0xeda5('0x48')](function(_0x4aae39){var _0x1a2a1d;return db[_0xeda5('0x2b')][_0xeda5('0x43')]({'where':{'id':_0xbc53d3[_0xeda5('0x45')]['id']}})['then'](function(_0x2a7b22){if(_0x2a7b22){_0x1a2a1d=_0x2a7b22;return _0x2a7b22[_0xeda5('0x5c')](_0xbc53d3[_0xeda5('0x44')]['id'],{'transaction':_0x4aae39});}})[_0xeda5('0x1f')](function(_0x14b605){if(_0x14b605){return db['Sound'][_0xeda5('0x5d')]({'where':{'id':_0xbc53d3['body']['id']},'attributes':['id',_0xeda5('0x27'),'save_name','converted_format',_0xeda5('0x5e')],'raw':!![]});}})[_0xeda5('0x1f')](function(_0x43b289){if(_0x43b289){var _0x3e1f5c=path['join'](config[_0xeda5('0x4c')],'server/files/sounds/converted',util['format'](_0xeda5('0x5f'),path['basename'](_0x43b289[_0xeda5('0x60')],path['extname'](_0x43b289[_0xeda5('0x60')])),_0x43b289['converted_format']));var _0xe45e00=path[_0xeda5('0x4b')](config['root'],_0xeda5('0x4d'),_0x1a2a1d['name'],util[_0xeda5('0x61')](_0xeda5('0x5f'),_0x43b289[_0xeda5('0x27')],_0x43b289[_0xeda5('0x62')]));fs[_0xeda5('0x63')](_0x3e1f5c,_0xe45e00);return _0x43b289;}})[_0xeda5('0x40')](function(_0x3d141a){throw new db[(_0xeda5('0x59'))]['ValidationError'](_0x3d141a[_0xeda5('0x5b')]);});})['then'](handleEntityNotFound(_0x22e8d3,null))[_0xeda5('0x1f')](respondWithResult(_0x22e8d3,0xc9))[_0xeda5('0x40')](handleError(_0x22e8d3,null));};exports[_0xeda5('0x64')]=function(_0x3803b2,_0xa1190e,_0x233abc){return db[_0xeda5('0x47')]['transaction'](function(_0xd76046){var _0x230292;return db[_0xeda5('0x2b')][_0xeda5('0x5d')]({'where':{'id':_0x3803b2['params']['id']}})[_0xeda5('0x1f')](handleEntityNotFound(_0xa1190e,null))['then'](function(_0x308cd1){if(_0x308cd1){_0x230292=_0x308cd1;return _0x308cd1['removeSound'](_0x3803b2[_0xeda5('0x45')][_0xeda5('0x65')]);}})[_0xeda5('0x1f')](function(_0x4cf616){if(_0x4cf616){return db[_0xeda5('0x66')]['findOne']({'where':{'id':_0x3803b2[_0xeda5('0x45')][_0xeda5('0x65')]},'attributes':['id',_0xeda5('0x27'),_0xeda5('0x60'),_0xeda5('0x62'),_0xeda5('0x5e')],'raw':!![]});}})[_0xeda5('0x1f')](function(_0x2c339e){if(_0x2c339e){fs['unlinkSync'](path['join'](_0x230292[_0xeda5('0x4a')],util[_0xeda5('0x61')]('%s.%s',_0x2c339e['name'],_0x2c339e[_0xeda5('0x62')])));return _0x2c339e;}})[_0xeda5('0x40')](function(_0x1bb4c6){throw new db[(_0xeda5('0x59'))][(_0xeda5('0x5a'))](_0x1bb4c6['message']);});})['then'](handleEntityNotFound(_0xa1190e,null))[_0xeda5('0x1f')](respondWithStatusCode(_0xa1190e,0xcc))[_0xeda5('0x40')](handleError(_0xa1190e,null));};exports[_0xeda5('0x67')]=function(_0x27f207,_0xcb796,_0x33f392){var _0xd3dc3e={};var _0x25fe2a={};var _0xb7e148;var _0x49a027;return db[_0xeda5('0x2b')][_0xeda5('0x5d')]({'where':{'id':_0x27f207['params']['id']}})['then'](handleEntityNotFound(_0xcb796,null))[_0xeda5('0x1f')](function(_0x20ab3f){if(_0x20ab3f){_0xb7e148=_0x20ab3f;_0x25fe2a[_0xeda5('0x30')]=_[_0xeda5('0x2e')](db[_0xeda5('0x66')]['rawAttributes']);_0x25fe2a['query']=_[_0xeda5('0x2e')](_0x27f207[_0xeda5('0x2d')]);_0x25fe2a[_0xeda5('0x2f')]=_[_0xeda5('0x32')](_0x25fe2a[_0xeda5('0x30')],_0x25fe2a[_0xeda5('0x2d')]);_0xd3dc3e[_0xeda5('0x31')]=_[_0xeda5('0x32')](_0x25fe2a[_0xeda5('0x30')],qs['fields'](_0x27f207['query'][_0xeda5('0x33')]));_0xd3dc3e[_0xeda5('0x31')]=_0xd3dc3e[_0xeda5('0x31')][_0xeda5('0x34')]?_0xd3dc3e[_0xeda5('0x31')]:_0x25fe2a[_0xeda5('0x30')];_0xd3dc3e['order']=qs[_0xeda5('0x38')](_0x27f207[_0xeda5('0x2d')][_0xeda5('0x38')]);_0xd3dc3e['where']=qs[_0xeda5('0x2f')](_['pick'](_0x27f207[_0xeda5('0x2d')],_0x25fe2a[_0xeda5('0x2f')]));if(_0x27f207['query'][_0xeda5('0x68')]){_0xd3dc3e[_0xeda5('0x3a')]=_['merge'](_0xd3dc3e['where'],{'$or':_['map'](_0xd3dc3e[_0xeda5('0x31')],function(_0x5ebe70){var _0x3be25d={};_0x3be25d[_0x5ebe70]={'$like':'%'+_0x27f207[_0xeda5('0x2d')]['filter']+'%'};return _0x3be25d;})});}_0xd3dc3e=_[_0xeda5('0x3b')]({},_0xd3dc3e,_0x27f207['options']);return _0xb7e148[_0xeda5('0x67')](_0xd3dc3e);}})['then'](function(_0x4aa887){if(_0x4aa887){_0x49a027=_0x4aa887['length'];if(!_0x27f207[_0xeda5('0x2d')][_0xeda5('0x69')](_0xeda5('0x35'))){_0xd3dc3e['limit']=qs[_0xeda5('0x1a')](_0x27f207[_0xeda5('0x2d')][_0xeda5('0x1a')]);_0xd3dc3e['offset']=qs[_0xeda5('0x36')](_0x27f207[_0xeda5('0x2d')]['offset']);}return _0xb7e148['getSounds'](_0xd3dc3e);}})[_0xeda5('0x1f')](function(_0x734210){if(_0x734210){return _0x734210?{'count':_0x49a027,'rows':_0x734210}:null;}})[_0xeda5('0x1f')](respondWithResult(_0xcb796,null))[_0xeda5('0x40')](handleError(_0xcb796,null));}; \ No newline at end of file +var _0x1b8f=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','body','params','create','transaction','mode','directory','join','root','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','unlinkSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','getSounds','Sound','pick','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel'];(function(_0x5c6289,_0x4a6832){var _0x33fa33=function(_0x247d05){while(--_0x247d05){_0x5c6289['push'](_0x5c6289['shift']());}};_0x33fa33(++_0x4a6832);}(_0x1b8f,0x13c));var _0xf1b8=function(_0x21aa7f,_0x4c6c75){_0x21aa7f=_0x21aa7f-0x0;var _0x54830b=_0x1b8f[_0x21aa7f];return _0x54830b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf1b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1b8('0x1'));var rp=require(_0xf1b8('0x2'));var moment=require(_0xf1b8('0x3'));var BPromise=require(_0xf1b8('0x4'));var Mustache=require('mustache');var util=require(_0xf1b8('0x5'));var path=require(_0xf1b8('0x6'));var sox=require(_0xf1b8('0x7'));var csv=require(_0xf1b8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf1b8('0x9'));var squel=require(_0xf1b8('0xa'));var crypto=require(_0xf1b8('0xb'));var jsforce=require(_0xf1b8('0xc'));var deskjs=require(_0xf1b8('0xd'));var toCsv=require(_0xf1b8('0x8'));var querystring=require(_0xf1b8('0xe'));var Papa=require('papaparse');var Redis=require(_0xf1b8('0xf'));var authService=require(_0xf1b8('0x10'));var qs=require(_0xf1b8('0x11'));var as=require(_0xf1b8('0x12'));var hardwareService=require(_0xf1b8('0x13'));var logger=require('../../config/logger')(_0xf1b8('0x14'));var utils=require(_0xf1b8('0x15'));var config=require(_0xf1b8('0x16'));var licenseUtil=require(_0xf1b8('0x17'));var db=require(_0xf1b8('0x18'))['db'];function respondWithStatusCode(_0x3d81f1,_0x693c41){_0x693c41=_0x693c41||0xcc;return function(_0x8327b8){if(_0x8327b8){return _0x3d81f1['sendStatus'](_0x693c41);}return _0x3d81f1['status'](_0x693c41)[_0xf1b8('0x19')]();};}function respondWithResult(_0x44e515,_0x42083d){_0x42083d=_0x42083d||0xc8;return function(_0x5c7457){if(_0x5c7457){return _0x44e515[_0xf1b8('0x1a')](_0x42083d)[_0xf1b8('0x1b')](_0x5c7457);}};}function respondWithFilteredResult(_0x3cc417,_0x5d6ada){return function(_0x3529c8){if(_0x3529c8){var _0x27f3c1=_0x3529c8[_0xf1b8('0x1c')],_0x5bdcba=_0x5d6ada[_0xf1b8('0x1d')],_0x5c56aa=_0x5d6ada['offset']+_0x5d6ada[_0xf1b8('0x1e')],_0xa99255;if(_0x5c56aa>=_0x27f3c1){_0x5c56aa=_0x27f3c1;_0xa99255=0xc8;}else{_0xa99255=0xce;}_0x3cc417[_0xf1b8('0x1a')](_0xa99255);return _0x3cc417[_0xf1b8('0x1f')](_0xf1b8('0x20'),_0x5bdcba+'-'+_0x5c56aa+'/'+_0x27f3c1)['json'](_0x3529c8);}return null;};}function patchUpdates(_0x79d601){return function(_0x39f385){try{jsonpatch[_0xf1b8('0x21')](_0x39f385,_0x79d601,!![]);}catch(_0x467795){return BPromise['reject'](_0x467795);}return _0x39f385[_0xf1b8('0x22')]();};}function saveUpdates(_0x42bda9,_0x79155){return function(_0x34b006){if(_0x34b006){return _0x34b006[_0xf1b8('0x23')](_0x42bda9)[_0xf1b8('0x24')](function(_0x1fc214){return _0x1fc214;});}return null;};}function removeEntity(_0x28e82e,_0x5f20b2){return function(_0x18f309){if(_0x18f309){return _0x18f309[_0xf1b8('0x25')]()[_0xf1b8('0x24')](function(){var _0x45fe60=_0x18f309[_0xf1b8('0x26')]({'plain':!![]});var _0x470cf9=_0xf1b8('0x27');return db[_0xf1b8('0x28')]['destroy']({'where':{'type':_0x470cf9,'resourceId':_0x45fe60['id']}})[_0xf1b8('0x24')](function(){return _0x18f309;});})[_0xf1b8('0x24')](function(){_0x28e82e['status'](0xcc)[_0xf1b8('0x19')]();});}};}function handleEntityNotFound(_0x3535c7,_0x32f127){return function(_0x2f2c9c){if(!_0x2f2c9c){_0x3535c7[_0xf1b8('0x29')](0x194);}return _0x2f2c9c;};}function handleError(_0x33080e,_0x300ed3){_0x300ed3=_0x300ed3||0x1f4;return function(_0x62ba46){logger[_0xf1b8('0x2a')](_0x62ba46[_0xf1b8('0x2b')]);if(_0x62ba46['name']){delete _0x62ba46[_0xf1b8('0x2c')];}_0x33080e[_0xf1b8('0x1a')](_0x300ed3)[_0xf1b8('0x2d')](_0x62ba46);};}exports[_0xf1b8('0x2e')]=function(_0x58fab2,_0x9902a5){var _0x454b9d={},_0x178fc4={},_0x33efe7={'count':0x0,'rows':[]};var _0x3c13d7=_[_0xf1b8('0x2f')](db[_0xf1b8('0x30')][_0xf1b8('0x31')],function(_0x293dd6){return{'name':_0x293dd6['fieldName'],'type':_0x293dd6[_0xf1b8('0x32')]['key']};});_0x178fc4[_0xf1b8('0x33')]=_['map'](_0x3c13d7,_0xf1b8('0x2c'));_0x178fc4[_0xf1b8('0x34')]=_['keys'](_0x58fab2[_0xf1b8('0x34')]);_0x178fc4[_0xf1b8('0x35')]=_[_0xf1b8('0x36')](_0x178fc4['model'],_0x178fc4[_0xf1b8('0x34')]);_0x454b9d['attributes']=_[_0xf1b8('0x36')](_0x178fc4[_0xf1b8('0x33')],qs[_0xf1b8('0x37')](_0x58fab2['query'][_0xf1b8('0x37')]));_0x454b9d[_0xf1b8('0x38')]=_0x454b9d[_0xf1b8('0x38')][_0xf1b8('0x39')]?_0x454b9d['attributes']:_0x178fc4[_0xf1b8('0x33')];if(!_0x58fab2['query'][_0xf1b8('0x3a')]('nolimit')){_0x454b9d[_0xf1b8('0x1e')]=qs[_0xf1b8('0x1e')](_0x58fab2[_0xf1b8('0x34')][_0xf1b8('0x1e')]);_0x454b9d[_0xf1b8('0x1d')]=qs[_0xf1b8('0x1d')](_0x58fab2[_0xf1b8('0x34')][_0xf1b8('0x1d')]);}_0x454b9d[_0xf1b8('0x3b')]=qs[_0xf1b8('0x3c')](_0x58fab2[_0xf1b8('0x34')][_0xf1b8('0x3c')]);_0x454b9d[_0xf1b8('0x3d')]=qs[_0xf1b8('0x35')](_['pick'](_0x58fab2['query'],_0x178fc4[_0xf1b8('0x35')]),_0x3c13d7);if(_0x58fab2[_0xf1b8('0x34')][_0xf1b8('0x3e')]){_0x454b9d[_0xf1b8('0x3d')]=_[_0xf1b8('0x3f')](_0x454b9d[_0xf1b8('0x3d')],{'$or':_[_0xf1b8('0x2f')](_0x3c13d7,function(_0x8d2e77){if(_0x8d2e77[_0xf1b8('0x32')]!==_0xf1b8('0x40')){var _0x1a4ecb={};_0x1a4ecb[_0x8d2e77[_0xf1b8('0x2c')]]={'$like':'%'+_0x58fab2[_0xf1b8('0x34')]['filter']+'%'};return _0x1a4ecb;}})});}_0x454b9d=_[_0xf1b8('0x3f')]({},_0x454b9d,_0x58fab2[_0xf1b8('0x41')]);var _0x777ae1={'where':_0x454b9d[_0xf1b8('0x3d')]};return db[_0xf1b8('0x30')][_0xf1b8('0x1c')](_0x777ae1)[_0xf1b8('0x24')](function(_0x598801){_0x33efe7[_0xf1b8('0x1c')]=_0x598801;if(_0x58fab2[_0xf1b8('0x34')][_0xf1b8('0x42')]){_0x454b9d[_0xf1b8('0x43')]=[{'all':!![]}];}return db[_0xf1b8('0x30')][_0xf1b8('0x44')](_0x454b9d);})[_0xf1b8('0x24')](function(_0x454099){_0x33efe7['rows']=_0x454099;return _0x33efe7;})[_0xf1b8('0x24')](respondWithFilteredResult(_0x9902a5,_0x454b9d))[_0xf1b8('0x45')](handleError(_0x9902a5,null));};exports[_0xf1b8('0x46')]=function(_0x597cf9,_0x222075){var _0x30444e={'raw':![],'where':{'id':_0x597cf9['params']['id']}},_0x4a04e6={};_0x4a04e6[_0xf1b8('0x33')]=_[_0xf1b8('0x47')](db['VoiceMusicOnHold'][_0xf1b8('0x31')]);_0x4a04e6['query']=_[_0xf1b8('0x47')](_0x597cf9[_0xf1b8('0x34')]);_0x4a04e6[_0xf1b8('0x35')]=_[_0xf1b8('0x36')](_0x4a04e6['model'],_0x4a04e6['query']);_0x30444e[_0xf1b8('0x38')]=_[_0xf1b8('0x36')](_0x4a04e6[_0xf1b8('0x33')],qs[_0xf1b8('0x37')](_0x597cf9[_0xf1b8('0x34')][_0xf1b8('0x37')]));_0x30444e[_0xf1b8('0x38')]=_0x30444e[_0xf1b8('0x38')][_0xf1b8('0x39')]?_0x30444e[_0xf1b8('0x38')]:_0x4a04e6[_0xf1b8('0x33')];if(_0x597cf9['query'][_0xf1b8('0x42')]){_0x30444e[_0xf1b8('0x43')]=[{'all':!![]}];}_0x30444e=_['merge']({},_0x30444e,_0x597cf9[_0xf1b8('0x41')]);return db['VoiceMusicOnHold'][_0xf1b8('0x48')](_0x30444e)[_0xf1b8('0x24')](handleEntityNotFound(_0x222075,null))['then'](respondWithResult(_0x222075,null))[_0xf1b8('0x45')](handleError(_0x222075,null));};exports['update']=function(_0x283e3f,_0x4ee9f9){if(_0x283e3f[_0xf1b8('0x49')]['id']){delete _0x283e3f[_0xf1b8('0x49')]['id'];}return db[_0xf1b8('0x30')][_0xf1b8('0x48')]({'where':{'id':_0x283e3f[_0xf1b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ee9f9,null))['then'](saveUpdates(_0x283e3f['body'],null))['then'](respondWithResult(_0x4ee9f9,null))[_0xf1b8('0x45')](handleError(_0x4ee9f9,null));};exports[_0xf1b8('0x4b')]=function(_0x2bc0a9,_0x11ef87,_0x5877bc){return db['sequelize'][_0xf1b8('0x4c')](function(_0x1ea809){if(_0x2bc0a9['body'][_0xf1b8('0x4d')]==='files'){_0x2bc0a9['body'][_0xf1b8('0x4e')]=path[_0xf1b8('0x4f')](config[_0xf1b8('0x50')],'server/files/moh',_0x2bc0a9[_0xf1b8('0x49')][_0xf1b8('0x2c')]);}return db[_0xf1b8('0x30')]['create'](_0x2bc0a9[_0xf1b8('0x49')],{'transaction':_0x1ea809})[_0xf1b8('0x24')](function(_0x389c21){if(_0x2bc0a9[_0xf1b8('0x49')][_0xf1b8('0x4d')]===_0xf1b8('0x51')){fs['mkdirSync'](_0x389c21[_0xf1b8('0x4e')],parseInt(_0xf1b8('0x52'),0x8));}var _0x4bd7db=_0x2bc0a9[_0xf1b8('0x53')][_0xf1b8('0x26')]({'plain':!![]});if(!_0x4bd7db)throw new Error(_0xf1b8('0x54'));if(_0x4bd7db['role']==='user'){var _0x3911e7=_0x389c21[_0xf1b8('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xf1b8('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4bd7db['userProfileId']},'raw':!![]})[_0xf1b8('0x24')](function(_0x140add){if(_0x140add&&_0x140add['autoAssociation']===0x0){return db['UserProfileResource'][_0xf1b8('0x4b')]({'name':_0x3911e7[_0xf1b8('0x2c')],'resourceId':_0x3911e7['id'],'type':_0x140add[_0xf1b8('0x2c')],'sectionId':_0x140add['id']},{})[_0xf1b8('0x24')](function(){return _0x389c21;});}else{return _0x389c21;}})[_0xf1b8('0x45')](function(_0x49f998){logger[_0xf1b8('0x2a')](_0xf1b8('0x55'),_0x49f998);});}return _0x389c21;});})[_0xf1b8('0x24')](respondWithResult(_0x11ef87,0xc9))[_0xf1b8('0x45')](handleError(_0x11ef87,null));};exports[_0xf1b8('0x25')]=function(_0xcd4cb0,_0x5480e4,_0x2693e8){var _0x19f0cc;return db[_0xf1b8('0x30')][_0xf1b8('0x48')]({'where':{'id':_0xcd4cb0[_0xf1b8('0x4a')]['id']}})[_0xf1b8('0x24')](function(_0x23ac59){if(_0x23ac59){return db[_0xf1b8('0x56')][_0xf1b8('0x4c')](function(_0x5c1e16){return _0x23ac59[_0xf1b8('0x25')]({'transaction':_0x5c1e16,'raw':!![]})[_0xf1b8('0x24')](function(_0x29cd04){if(_0x29cd04[_0xf1b8('0x4e')]){fs[_0xf1b8('0x57')](_0x29cd04['directory'])['forEach'](function(_0x478f15){fs[_0xf1b8('0x58')](path['join'](_0x29cd04[_0xf1b8('0x4e')],_0x478f15));});fs['rmdirSync'](_0x29cd04[_0xf1b8('0x4e')]);}return _0x29cd04;});})['catch'](function(_0x3e18eb){throw new db[(_0xf1b8('0x59'))][(_0xf1b8('0x5a'))](_0x3e18eb['message']);});}})[_0xf1b8('0x24')](handleEntityNotFound(_0x5480e4,null))['then'](removeEntity(_0x5480e4,null))['catch'](handleError(_0x5480e4,null));};exports[_0xf1b8('0x5b')]=function(_0x2b49d0,_0x55bda0,_0x476e74){return db[_0xf1b8('0x56')][_0xf1b8('0x4c')](function(_0x1936d0){var _0x1ac508;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2b49d0['params']['id']}})[_0xf1b8('0x24')](function(_0x5027f0){if(_0x5027f0){_0x1ac508=_0x5027f0;return _0x5027f0['addSound'](_0x2b49d0[_0xf1b8('0x49')]['id'],{'transaction':_0x1936d0});}})[_0xf1b8('0x24')](function(_0x2385a8){if(_0x2385a8){return db['Sound'][_0xf1b8('0x5c')]({'where':{'id':_0x2b49d0[_0xf1b8('0x49')]['id']},'attributes':['id',_0xf1b8('0x2c'),_0xf1b8('0x5d'),_0xf1b8('0x5e'),_0xf1b8('0x5f')],'raw':!![]});}})[_0xf1b8('0x24')](function(_0x2ac06c){if(_0x2ac06c){var _0x2485b2=path[_0xf1b8('0x4f')](config[_0xf1b8('0x50')],_0xf1b8('0x60'),util[_0xf1b8('0x61')](_0xf1b8('0x62'),path[_0xf1b8('0x63')](_0x2ac06c[_0xf1b8('0x5d')],path[_0xf1b8('0x64')](_0x2ac06c[_0xf1b8('0x5d')])),_0x2ac06c['converted_format']));var _0x1df0e5=path[_0xf1b8('0x4f')](config[_0xf1b8('0x50')],'server/files/moh',_0x1ac508[_0xf1b8('0x2c')],util[_0xf1b8('0x61')]('%s.%s',_0x2ac06c[_0xf1b8('0x2c')],_0x2ac06c[_0xf1b8('0x5e')]));fs[_0xf1b8('0x65')](_0x2485b2,_0x1df0e5);return _0x2ac06c;}})[_0xf1b8('0x45')](function(_0x38bc40){throw new db[(_0xf1b8('0x59'))][(_0xf1b8('0x5a'))](_0x38bc40[_0xf1b8('0x66')]);});})['then'](handleEntityNotFound(_0x55bda0,null))[_0xf1b8('0x24')](respondWithResult(_0x55bda0,0xc9))[_0xf1b8('0x45')](handleError(_0x55bda0,null));};exports[_0xf1b8('0x67')]=function(_0x1dbf86,_0x5b1b47,_0x3c9b83){return db[_0xf1b8('0x56')][_0xf1b8('0x4c')](function(_0x1aea6d){var _0x3bf074;return db[_0xf1b8('0x30')][_0xf1b8('0x5c')]({'where':{'id':_0x1dbf86[_0xf1b8('0x4a')]['id']}})[_0xf1b8('0x24')](handleEntityNotFound(_0x5b1b47,null))['then'](function(_0x2ec379){if(_0x2ec379){_0x3bf074=_0x2ec379;return _0x2ec379['removeSound'](_0x1dbf86[_0xf1b8('0x4a')][_0xf1b8('0x68')]);}})[_0xf1b8('0x24')](function(_0xe3db28){if(_0xe3db28){return db['Sound'][_0xf1b8('0x5c')]({'where':{'id':_0x1dbf86[_0xf1b8('0x4a')]['id2']},'attributes':['id',_0xf1b8('0x2c'),_0xf1b8('0x5d'),_0xf1b8('0x5e'),'createdAt'],'raw':!![]});}})[_0xf1b8('0x24')](function(_0x8a715){if(_0x8a715){fs[_0xf1b8('0x58')](path['join'](_0x3bf074[_0xf1b8('0x4e')],util[_0xf1b8('0x61')](_0xf1b8('0x62'),_0x8a715['name'],_0x8a715[_0xf1b8('0x5e')])));return _0x8a715;}})['catch'](function(_0x4467f6){throw new db[(_0xf1b8('0x59'))][(_0xf1b8('0x5a'))](_0x4467f6[_0xf1b8('0x66')]);});})[_0xf1b8('0x24')](handleEntityNotFound(_0x5b1b47,null))[_0xf1b8('0x24')](respondWithStatusCode(_0x5b1b47,0xcc))[_0xf1b8('0x45')](handleError(_0x5b1b47,null));};exports[_0xf1b8('0x69')]=function(_0x4f1ebc,_0x41d55d,_0x32f0d6){var _0x4a3366={};var _0x373047={};var _0x26b371;var _0x22f360;return db[_0xf1b8('0x30')][_0xf1b8('0x5c')]({'where':{'id':_0x4f1ebc[_0xf1b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x41d55d,null))[_0xf1b8('0x24')](function(_0x53d748){if(_0x53d748){_0x26b371=_0x53d748;_0x373047[_0xf1b8('0x33')]=_[_0xf1b8('0x47')](db[_0xf1b8('0x6a')][_0xf1b8('0x31')]);_0x373047['query']=_[_0xf1b8('0x47')](_0x4f1ebc['query']);_0x373047[_0xf1b8('0x35')]=_[_0xf1b8('0x36')](_0x373047['model'],_0x373047['query']);_0x4a3366['attributes']=_[_0xf1b8('0x36')](_0x373047[_0xf1b8('0x33')],qs['fields'](_0x4f1ebc[_0xf1b8('0x34')][_0xf1b8('0x37')]));_0x4a3366['attributes']=_0x4a3366[_0xf1b8('0x38')][_0xf1b8('0x39')]?_0x4a3366[_0xf1b8('0x38')]:_0x373047[_0xf1b8('0x33')];_0x4a3366['order']=qs[_0xf1b8('0x3c')](_0x4f1ebc['query'][_0xf1b8('0x3c')]);_0x4a3366[_0xf1b8('0x3d')]=qs[_0xf1b8('0x35')](_[_0xf1b8('0x6b')](_0x4f1ebc[_0xf1b8('0x34')],_0x373047[_0xf1b8('0x35')]));if(_0x4f1ebc['query'][_0xf1b8('0x3e')]){_0x4a3366[_0xf1b8('0x3d')]=_['merge'](_0x4a3366['where'],{'$or':_['map'](_0x4a3366[_0xf1b8('0x38')],function(_0x4b695f){var _0x301574={};_0x301574[_0x4b695f]={'$like':'%'+_0x4f1ebc[_0xf1b8('0x34')][_0xf1b8('0x3e')]+'%'};return _0x301574;})});}_0x4a3366=_[_0xf1b8('0x3f')]({},_0x4a3366,_0x4f1ebc[_0xf1b8('0x41')]);return _0x26b371[_0xf1b8('0x69')](_0x4a3366);}})[_0xf1b8('0x24')](function(_0x2c6b69){if(_0x2c6b69){_0x22f360=_0x2c6b69[_0xf1b8('0x39')];if(!_0x4f1ebc['query'][_0xf1b8('0x3a')](_0xf1b8('0x6c'))){_0x4a3366[_0xf1b8('0x1e')]=qs['limit'](_0x4f1ebc[_0xf1b8('0x34')]['limit']);_0x4a3366[_0xf1b8('0x1d')]=qs['offset'](_0x4f1ebc[_0xf1b8('0x34')][_0xf1b8('0x1d')]);}return _0x26b371[_0xf1b8('0x69')](_0x4a3366);}})[_0xf1b8('0x24')](function(_0x367240){if(_0x367240){return _0x367240?{'count':_0x22f360,'rows':_0x367240}:null;}})[_0xf1b8('0x24')](respondWithResult(_0x41d55d,null))[_0xf1b8('0x45')](handleError(_0x41d55d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index e5eb4b9..2e0ea09 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 _0x241f=['VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','path','rimraf','../../config/environment','define'];(function(_0x2ea7b5,_0x4b7583){var _0x5ca96d=function(_0x335d93){while(--_0x335d93){_0x2ea7b5['push'](_0x2ea7b5['shift']());}};_0x5ca96d(++_0x4b7583);}(_0x241f,0x13d));var _0xf241=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x241f[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0xf241('0x0'));var util=require('util');var logger=require(_0xf241('0x1'))(_0xf241('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf241('0x3'));var rimraf=require(_0xf241('0x4'));var config=require(_0xf241('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x18e794,_0x39c184){return _0x18e794[_0xf241('0x6')](_0xf241('0x7'),attributes,{'tableName':_0xf241('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4763=['request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','bluebird'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x4763,0x1ca));var _0x3476=function(_0x4a45ff,_0x1ec823){_0x4a45ff=_0x4a45ff-0x0;var _0x18694b=_0x4763[_0x4a45ff];return _0x18694b;};'use strict';var _=require(_0x3476('0x0'));var util=require('util');var logger=require(_0x3476('0x1'))(_0x3476('0x2'));var moment=require('moment');var BPromise=require(_0x3476('0x3'));var rp=require(_0x3476('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3476('0x5'));var config=require(_0x3476('0x6'));var attributes=require(_0x3476('0x7'));module[_0x3476('0x8')]=function(_0x3783e0,_0x469029){return _0x3783e0['define'](_0x3476('0x9'),attributes,{'tableName':_0x3476('0xa'),'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 7b08d12..35045d3 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 _0xdadb=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x9ba307,_0x570631){var _0x335d04=function(_0x3125d0){while(--_0x3125d0){_0x9ba307['push'](_0x9ba307['shift']());}};_0x335d04(++_0x570631);}(_0xdadb,0x1cf));var _0xbdad=function(_0x2c3245,_0x540b38){_0x2c3245=_0x2c3245-0x0;var _0x4e1b17=_0xdadb[_0x2c3245];return _0x4e1b17;};'use strict';var _=require(_0xbdad('0x0'));var util=require('util');var moment=require(_0xbdad('0x1'));var BPromise=require(_0xbdad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdad('0x3'));var db=require(_0xbdad('0x4'))['db'];var utils=require(_0xbdad('0x5'));var logger=require(_0xbdad('0x6'))(_0xbdad('0x7'));var config=require(_0xbdad('0x8'));var jayson=require(_0xbdad('0x9'));var client=jayson['client'][_0xbdad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x166c38,_0x2b10bd,_0xd211b4){return new BPromise(function(_0x4a142a,_0x421d59){return client['request'](_0x166c38,_0xd211b4)['then'](function(_0x5b73cb){logger['info'](_0xbdad('0xb'),_0x2b10bd,_0xbdad('0xc'));logger['debug'](_0xbdad('0xd'),_0x2b10bd,_0xbdad('0xc'),JSON[_0xbdad('0xe')](_0x5b73cb));if(_0x5b73cb[_0xbdad('0xf')]){if(_0x5b73cb[_0xbdad('0xf')][_0xbdad('0x10')]===0x1f4){logger['error'](_0xbdad('0xb'),_0x2b10bd,_0x5b73cb[_0xbdad('0xf')]['message']);return _0x421d59(_0x5b73cb[_0xbdad('0xf')][_0xbdad('0x11')]);}logger[_0xbdad('0xf')](_0xbdad('0xb'),_0x2b10bd,_0x5b73cb['error'][_0xbdad('0x11')]);return _0x4a142a(_0x5b73cb[_0xbdad('0xf')][_0xbdad('0x11')]);}else{logger[_0xbdad('0x12')](_0xbdad('0xb'),_0x2b10bd,'request\x20sent');_0x4a142a(_0x5b73cb[_0xbdad('0x13')][_0xbdad('0x11')]);}})[_0xbdad('0x14')](function(_0x3384fd){logger['error'](_0xbdad('0xb'),_0x2b10bd,_0x3384fd);_0x421d59(_0x3384fd);});});} \ No newline at end of file +var _0x5ee7=['../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23f564,_0x48d2ba){var _0x47582b=function(_0x3a8876){while(--_0x3a8876){_0x23f564['push'](_0x23f564['shift']());}};_0x47582b(++_0x48d2ba);}(_0x5ee7,0x12a));var _0x75ee=function(_0x206895,_0x380af6){_0x206895=_0x206895-0x0;var _0x4477a2=_0x5ee7[_0x206895];return _0x4477a2;};'use strict';var _=require('lodash');var util=require(_0x75ee('0x0'));var moment=require('moment');var BPromise=require(_0x75ee('0x1'));var rs=require(_0x75ee('0x2'));var fs=require('fs');var Redis=require(_0x75ee('0x3'));var db=require(_0x75ee('0x4'))['db'];var utils=require(_0x75ee('0x5'));var logger=require(_0x75ee('0x6'))(_0x75ee('0x7'));var config=require('../../config/environment');var jayson=require(_0x75ee('0x8'));var client=jayson[_0x75ee('0x9')][_0x75ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fd352,_0x5c0e35,_0x36513b){return new BPromise(function(_0x25f422,_0x35b9f5){return client['request'](_0x3fd352,_0x36513b)[_0x75ee('0xb')](function(_0x9b1208){logger[_0x75ee('0xc')](_0x75ee('0xd'),_0x5c0e35,_0x75ee('0xe'));logger['debug'](_0x75ee('0xf'),_0x5c0e35,'request\x20sent',JSON['stringify'](_0x9b1208));if(_0x9b1208[_0x75ee('0x10')]){if(_0x9b1208[_0x75ee('0x10')]['code']===0x1f4){logger[_0x75ee('0x10')](_0x75ee('0xd'),_0x5c0e35,_0x9b1208[_0x75ee('0x10')]['message']);return _0x35b9f5(_0x9b1208['error'][_0x75ee('0x11')]);}logger[_0x75ee('0x10')](_0x75ee('0xd'),_0x5c0e35,_0x9b1208[_0x75ee('0x10')][_0x75ee('0x11')]);return _0x25f422(_0x9b1208[_0x75ee('0x10')]['message']);}else{logger[_0x75ee('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5c0e35,_0x75ee('0xe'));_0x25f422(_0x9b1208['result'][_0x75ee('0x11')]);}})[_0x75ee('0x12')](function(_0x48adef){logger[_0x75ee('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5c0e35,_0x48adef);_0x35b9f5(_0x48adef);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8ea88d2..bd3e8af 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 _0xb447=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','create','addAgents','put','update','delete','destroy'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xb447,0x122));var _0x7b44=function(_0x28eb1b,_0x3ef151){_0x28eb1b=_0x28eb1b-0x0;var _0x4dfbe5=_0xb447[_0x28eb1b];return _0x4dfbe5;};'use strict';var multer=require(_0x7b44('0x0'));var util=require(_0x7b44('0x1'));var path=require(_0x7b44('0x2'));var timeout=require(_0x7b44('0x3'));var express=require(_0x7b44('0x4'));var router=express[_0x7b44('0x5')]();var auth=require(_0x7b44('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7b44('0x7'));var controller=require(_0x7b44('0x8'));router[_0x7b44('0x9')]('/',auth[_0x7b44('0xa')](),controller[_0x7b44('0xb')]);router[_0x7b44('0x9')](_0x7b44('0xc'),auth[_0x7b44('0xa')](),controller['describe']);router['get'](_0x7b44('0xd'),auth[_0x7b44('0xa')](),controller[_0x7b44('0xe')]);router[_0x7b44('0x9')](_0x7b44('0xf'),auth[_0x7b44('0xa')](),controller['getAgents']);router['post']('/',auth[_0x7b44('0xa')](),controller[_0x7b44('0x10')]);router['post'](_0x7b44('0xf'),auth[_0x7b44('0xa')](),controller[_0x7b44('0x11')]);router[_0x7b44('0x12')](_0x7b44('0xd'),auth[_0x7b44('0xa')](),controller[_0x7b44('0x13')]);router[_0x7b44('0x14')](_0x7b44('0xd'),auth['isAuthenticated'](),controller[_0x7b44('0x15')]);router[_0x7b44('0x14')](_0x7b44('0xf'),auth[_0x7b44('0xa')](),controller[_0x7b44('0x16')]);module[_0x7b44('0x17')]=router; \ No newline at end of file +var _0x178e=['post','addAgents','put','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./voicePrefix.controller','get','index','/describe','/:id','show','/:id/users','isAuthenticated','getAgents'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x178e,0x16b));var _0xe178=function(_0x3feb8a,_0x47c784){_0x3feb8a=_0x3feb8a-0x0;var _0x4523ca=_0x178e[_0x3feb8a];return _0x4523ca;};'use strict';var multer=require(_0xe178('0x0'));var util=require(_0xe178('0x1'));var path=require(_0xe178('0x2'));var timeout=require(_0xe178('0x3'));var express=require('express');var router=express[_0xe178('0x4')]();var auth=require(_0xe178('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe178('0x6'));router[_0xe178('0x7')]('/',auth['isAuthenticated'](),controller[_0xe178('0x8')]);router[_0xe178('0x7')](_0xe178('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xe178('0x7')](_0xe178('0xa'),auth['isAuthenticated'](),controller[_0xe178('0xb')]);router[_0xe178('0x7')](_0xe178('0xc'),auth[_0xe178('0xd')](),controller[_0xe178('0xe')]);router['post']('/',auth[_0xe178('0xd')](),controller['create']);router[_0xe178('0xf')](_0xe178('0xc'),auth[_0xe178('0xd')](),controller[_0xe178('0x10')]);router[_0xe178('0x11')](_0xe178('0xa'),auth[_0xe178('0xd')](),controller['update']);router['delete'](_0xe178('0xa'),auth[_0xe178('0xd')](),controller['destroy']);router[_0xe178('0x12')]('/:id/users',auth[_0xe178('0xd')](),controller[_0xe178('0x13')]);module[_0xe178('0x14')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7e5fa21..9c9645f 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 _0xa7d7=['exports','STRING','name','VIRTUAL','system-','getDataValue','sequelize'];(function(_0x25a041,_0x5228a9){var _0x564c0c=function(_0x90f425){while(--_0x90f425){_0x25a041['push'](_0x25a041['shift']());}};_0x564c0c(++_0x5228a9);}(_0xa7d7,0x179));var _0x7a7d=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xa7d7[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require(_0x7a7d('0x0'));module[_0x7a7d('0x1')]={'name':{'type':Sequelize[_0x7a7d('0x2')],'allowNull':![],'unique':_0x7a7d('0x3')},'prefix':{'type':Sequelize[_0x7a7d('0x4')],'get':function(_0x4a7661){return _0x7a7d('0x5')+this[_0x7a7d('0x6')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x7a7d('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7ee4=['VIRTUAL','getDataValue','name','INTEGER','exports','STRING'];(function(_0x5a8857,_0x30235c){var _0x15d8b6=function(_0x4a5a85){while(--_0x4a5a85){_0x5a8857['push'](_0x5a8857['shift']());}};_0x15d8b6(++_0x30235c);}(_0x7ee4,0xac));var _0x47ee=function(_0x7d3039,_0x63151b){_0x7d3039=_0x7d3039-0x0;var _0x24031e=_0x7ee4[_0x7d3039];return _0x24031e;};'use strict';var Sequelize=require('sequelize');module[_0x47ee('0x0')]={'name':{'type':Sequelize[_0x47ee('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x47ee('0x2')],'get':function(_0x5e5290){return'system-'+this[_0x47ee('0x3')](_0x47ee('0x4'))+'-';}},'description':{'type':Sequelize[_0x47ee('0x1')]},'callerIdAll':{'type':Sequelize[_0x47ee('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x47ee('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 853b95e..c0e3374 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 _0x5a99=['then','destroy','get','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','rows','catch','show','params','includeAll','find','describe','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','Voice\x20Prefix\x20Extension','appdata','prefix','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','addAgents','ids','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x1562ea,_0x36cfe9){var _0x14d334=function(_0xbac5ba){while(--_0xbac5ba){_0x1562ea['push'](_0x1562ea['shift']());}};_0x14d334(++_0x36cfe9);}(_0x5a99,0xc9));var _0x95a9=function(_0x4d83d1,_0x44c46f){_0x4d83d1=_0x4d83d1-0x0;var _0x2ae53f=_0x5a99[_0x4d83d1];return _0x2ae53f;};'use strict';var pdf=require(_0x95a9('0x0'));var emlformat=require(_0x95a9('0x1'));var rimraf=require(_0x95a9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95a9('0x3'));var rp=require(_0x95a9('0x4'));var moment=require(_0x95a9('0x5'));var BPromise=require(_0x95a9('0x6'));var Mustache=require('mustache');var util=require(_0x95a9('0x7'));var path=require(_0x95a9('0x8'));var sox=require(_0x95a9('0x9'));var csv=require(_0x95a9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x95a9('0xb'));var squel=require(_0x95a9('0xc'));var crypto=require(_0x95a9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x95a9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95a9('0xf'));var Papa=require(_0x95a9('0x10'));var Redis=require(_0x95a9('0x11'));var authService=require(_0x95a9('0x12'));var qs=require(_0x95a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x95a9('0x14'))(_0x95a9('0x15'));var utils=require('../../config/utils');var config=require(_0x95a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x95a9('0x17'))['db'];config[_0x95a9('0x18')]=_[_0x95a9('0x19')](config[_0x95a9('0x18')],{'host':_0x95a9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0x95a9('0x1b')](socket);function respondWithStatusCode(_0x537c35,_0xccaf69){_0xccaf69=_0xccaf69||0xcc;return function(_0x45f48e){if(_0x45f48e){return _0x537c35[_0x95a9('0x1c')](_0xccaf69);}return _0x537c35['status'](_0xccaf69)[_0x95a9('0x1d')]();};}function respondWithResult(_0x4900b3,_0x37ccf1){_0x37ccf1=_0x37ccf1||0xc8;return function(_0x43768a){if(_0x43768a){return _0x4900b3[_0x95a9('0x1e')](_0x37ccf1)['json'](_0x43768a);}};}function respondWithFilteredResult(_0x45d1d2,_0x4b1efc){return function(_0x4bcec6){if(_0x4bcec6){var _0x3ee15f=_0x4bcec6[_0x95a9('0x1f')],_0x3b6d30=_0x4b1efc[_0x95a9('0x20')],_0x2cd19a=_0x4b1efc[_0x95a9('0x20')]+_0x4b1efc[_0x95a9('0x21')],_0x183a64;if(_0x2cd19a>=_0x3ee15f){_0x2cd19a=_0x3ee15f;_0x183a64=0xc8;}else{_0x183a64=0xce;}_0x45d1d2[_0x95a9('0x1e')](_0x183a64);return _0x45d1d2[_0x95a9('0x22')](_0x95a9('0x23'),_0x3b6d30+'-'+_0x2cd19a+'/'+_0x3ee15f)['json'](_0x4bcec6);}return null;};}function patchUpdates(_0x15293e){return function(_0x261f2b){try{jsonpatch[_0x95a9('0x24')](_0x261f2b,_0x15293e,!![]);}catch(_0x2e61d1){return BPromise['reject'](_0x2e61d1);}return _0x261f2b[_0x95a9('0x25')]();};}function saveUpdates(_0x21b556,_0xc4520e){return function(_0x321b04){if(_0x321b04){return _0x321b04[_0x95a9('0x26')](_0x21b556)[_0x95a9('0x27')](function(_0x203c51){return _0x203c51;});}return null;};}function removeEntity(_0x48de16,_0x345cef){return function(_0x19e8f0){if(_0x19e8f0){return _0x19e8f0[_0x95a9('0x28')]()['then'](function(){var _0x493acf=_0x19e8f0[_0x95a9('0x29')]({'plain':!![]});var _0x49413f='VoicePrefixes';return db[_0x95a9('0x2a')]['destroy']({'where':{'type':_0x49413f,'resourceId':_0x493acf['id']}})[_0x95a9('0x27')](function(){return _0x19e8f0;});})[_0x95a9('0x27')](function(){_0x48de16[_0x95a9('0x1e')](0xcc)[_0x95a9('0x1d')]();});}};}function handleEntityNotFound(_0x2951f4,_0x8b85bb){return function(_0x22bcb5){if(!_0x22bcb5){_0x2951f4[_0x95a9('0x1c')](0x194);}return _0x22bcb5;};}function handleError(_0x381672,_0x4de407){_0x4de407=_0x4de407||0x1f4;return function(_0x17fcb1){logger[_0x95a9('0x2b')](_0x17fcb1[_0x95a9('0x2c')]);if(_0x17fcb1[_0x95a9('0x2d')]){delete _0x17fcb1[_0x95a9('0x2d')];}_0x381672[_0x95a9('0x1e')](_0x4de407)[_0x95a9('0x2e')](_0x17fcb1);};}exports['index']=function(_0x5edbf1,_0x59087c){var _0x462993={},_0x1d4ab3={},_0x8ff6ef={'count':0x0,'rows':[]};var _0x54a057=_[_0x95a9('0x2f')](db[_0x95a9('0x30')][_0x95a9('0x31')],function(_0x3df461){return{'name':_0x3df461[_0x95a9('0x32')],'type':_0x3df461[_0x95a9('0x33')][_0x95a9('0x34')]};});_0x1d4ab3[_0x95a9('0x35')]=_['map'](_0x54a057,'name');_0x1d4ab3['query']=_[_0x95a9('0x36')](_0x5edbf1[_0x95a9('0x37')]);_0x1d4ab3[_0x95a9('0x38')]=_[_0x95a9('0x39')](_0x1d4ab3['model'],_0x1d4ab3[_0x95a9('0x37')]);_0x462993[_0x95a9('0x3a')]=_[_0x95a9('0x39')](_0x1d4ab3[_0x95a9('0x35')],qs[_0x95a9('0x3b')](_0x5edbf1[_0x95a9('0x37')][_0x95a9('0x3b')]));_0x462993[_0x95a9('0x3a')]=_0x462993[_0x95a9('0x3a')][_0x95a9('0x3c')]?_0x462993[_0x95a9('0x3a')]:_0x1d4ab3['model'];if(!_0x5edbf1[_0x95a9('0x37')][_0x95a9('0x3d')](_0x95a9('0x3e'))){_0x462993[_0x95a9('0x21')]=qs[_0x95a9('0x21')](_0x5edbf1[_0x95a9('0x37')]['limit']);_0x462993[_0x95a9('0x20')]=qs[_0x95a9('0x20')](_0x5edbf1[_0x95a9('0x37')][_0x95a9('0x20')]);}_0x462993[_0x95a9('0x3f')]=qs['sort'](_0x5edbf1[_0x95a9('0x37')][_0x95a9('0x40')]);_0x462993['where']=qs[_0x95a9('0x38')](_[_0x95a9('0x41')](_0x5edbf1['query'],_0x1d4ab3['filters']),_0x54a057);if(_0x5edbf1[_0x95a9('0x37')][_0x95a9('0x42')]){_0x462993[_0x95a9('0x43')]=_[_0x95a9('0x44')](_0x462993[_0x95a9('0x43')],{'$or':_[_0x95a9('0x2f')](_0x54a057,function(_0x355638){if(_0x355638[_0x95a9('0x33')]!=='VIRTUAL'){var _0x1b7a9f={};_0x1b7a9f[_0x355638[_0x95a9('0x2d')]]={'$like':'%'+_0x5edbf1[_0x95a9('0x37')][_0x95a9('0x42')]+'%'};return _0x1b7a9f;}})});}_0x462993=_[_0x95a9('0x44')]({},_0x462993,_0x5edbf1[_0x95a9('0x45')]);var _0x3778c5={'where':_0x462993[_0x95a9('0x43')]};return db[_0x95a9('0x30')][_0x95a9('0x1f')](_0x3778c5)[_0x95a9('0x27')](function(_0x14ac89){_0x8ff6ef['count']=_0x14ac89;if(_0x5edbf1[_0x95a9('0x37')]['includeAll']){_0x462993[_0x95a9('0x46')]=[{'all':!![]}];}return db[_0x95a9('0x30')]['findAll'](_0x462993);})[_0x95a9('0x27')](function(_0x1edb3e){_0x8ff6ef[_0x95a9('0x47')]=_0x1edb3e;return _0x8ff6ef;})[_0x95a9('0x27')](respondWithFilteredResult(_0x59087c,_0x462993))[_0x95a9('0x48')](handleError(_0x59087c,null));};exports[_0x95a9('0x49')]=function(_0x222a87,_0x1734ed){var _0x2d7bfb={'raw':![],'where':{'id':_0x222a87[_0x95a9('0x4a')]['id']}},_0x4a204d={};_0x4a204d[_0x95a9('0x35')]=_[_0x95a9('0x36')](db[_0x95a9('0x30')][_0x95a9('0x31')]);_0x4a204d[_0x95a9('0x37')]=_['keys'](_0x222a87['query']);_0x4a204d[_0x95a9('0x38')]=_[_0x95a9('0x39')](_0x4a204d[_0x95a9('0x35')],_0x4a204d[_0x95a9('0x37')]);_0x2d7bfb[_0x95a9('0x3a')]=_[_0x95a9('0x39')](_0x4a204d[_0x95a9('0x35')],qs[_0x95a9('0x3b')](_0x222a87[_0x95a9('0x37')][_0x95a9('0x3b')]));_0x2d7bfb[_0x95a9('0x3a')]=_0x2d7bfb['attributes'][_0x95a9('0x3c')]?_0x2d7bfb[_0x95a9('0x3a')]:_0x4a204d['model'];if(_0x222a87[_0x95a9('0x37')][_0x95a9('0x4b')]){_0x2d7bfb[_0x95a9('0x46')]=[{'all':!![]}];}_0x2d7bfb=_[_0x95a9('0x44')]({},_0x2d7bfb,_0x222a87[_0x95a9('0x45')]);return db[_0x95a9('0x30')][_0x95a9('0x4c')](_0x2d7bfb)[_0x95a9('0x27')](handleEntityNotFound(_0x1734ed,null))['then'](respondWithResult(_0x1734ed,null))[_0x95a9('0x48')](handleError(_0x1734ed,null));};exports[_0x95a9('0x28')]=function(_0x20f7b0,_0x30184b){return db[_0x95a9('0x30')][_0x95a9('0x4c')]({'where':{'id':_0x20f7b0[_0x95a9('0x4a')]['id']}})[_0x95a9('0x27')](handleEntityNotFound(_0x30184b,null))[_0x95a9('0x27')](removeEntity(_0x30184b,null))[_0x95a9('0x48')](handleError(_0x30184b,null));};exports[_0x95a9('0x4d')]=function(_0x499e51,_0x54a2f8){return db[_0x95a9('0x30')][_0x95a9('0x4d')]()['then'](respondWithResult(_0x54a2f8,null))[_0x95a9('0x48')](handleError(_0x54a2f8,null));};exports['create']=function(_0x2c8715,_0x3598ad){var _0x2ff374;return db['sequelize'][_0x95a9('0x4e')](function(_0x325b02){return db[_0x95a9('0x30')]['create'](_0x2c8715[_0x95a9('0x4f')],{'transaction':_0x325b02})[_0x95a9('0x27')](function(_0x139630){_0x2ff374=_0x139630[_0x95a9('0x29')]({'plain':!![]});return db[_0x95a9('0x50')][_0x95a9('0x4c')]({'where':{'id':_0x2ff374[_0x95a9('0x51')]},'raw':!![]})[_0x95a9('0x27')](function(_0xeb69ae){return createVoicePrefixExtensions(_0x2ff374,_0xeb69ae,_0x325b02);});});})[_0x95a9('0x27')](function(){var _0x338033=_0x2c8715[_0x95a9('0x52')][_0x95a9('0x29')]({'plain':!![]});if(!_0x338033)throw new Error(_0x95a9('0x53'));if(_0x338033[_0x95a9('0x54')]==='user'){var _0x1e2dcf=_0x2ff374;return db[_0x95a9('0x55')][_0x95a9('0x4c')]({'where':{'name':_0x95a9('0x56'),'userProfileId':_0x338033[_0x95a9('0x57')]},'raw':!![]})[_0x95a9('0x27')](function(_0x173ad7){if(_0x173ad7&&_0x173ad7[_0x95a9('0x58')]===0x0){return db[_0x95a9('0x2a')][_0x95a9('0x59')]({'name':_0x1e2dcf[_0x95a9('0x2d')],'resourceId':_0x1e2dcf['id'],'type':_0x173ad7[_0x95a9('0x2d')],'sectionId':_0x173ad7['id']},{})[_0x95a9('0x27')](function(){return _0x2ff374;});}else{return _0x2ff374;}})[_0x95a9('0x48')](function(_0x2893f7){logger[_0x95a9('0x2b')](_0x95a9('0x5a'),_0x2893f7);throw _0x2893f7;});}return _0x2ff374;})[_0x95a9('0x27')](respondWithResult(_0x3598ad,null))[_0x95a9('0x48')](handleError(_0x3598ad,null));};function Extension(_0x29436f,_0x3131b8,_0x3d7c7f,_0x5655e2){this['context']=_0x95a9('0x5b');this[_0x95a9('0x5c')]=_0x29436f;this['app']=_0x3d7c7f;this[_0x95a9('0x33')]='system';this['description']=_0x95a9('0x5d');this['priority']=_0x3131b8;this[_0x95a9('0x5e')]=_0x5655e2;}function createVoicePrefixExtensions(_0x1f2844,_0x48a6f6,_0x3b1022){return new BPromise(function(_0x1eb82e,_0x56f37c){var _0x36952f=new Extension(formatPrefixName(_0x1f2844[_0x95a9('0x5f')]),0x1,'NoOp',_0x95a9('0x60'));_0x36952f[_0x95a9('0x61')]=_0x1f2844['id'];return db[_0x95a9('0x50')][_0x95a9('0x59')](_0x36952f,{'transaction':_0x3b1022})['then'](function(_0x5e75ef){var _0x2307f8=_0x5e75ef[_0x95a9('0x29')]({'plain':!![]});var _0x13d9ed=_[_0x95a9('0x2f')](addVoicePrefixExtensions(_0x1f2844,_0x48a6f6),function(_0x38c689){_0x38c689[_0x95a9('0x51')]=_0x2307f8['id'];_0x38c689[_0x95a9('0x61')]=_0x1f2844['id'];return _0x38c689;});return db['VoiceExtension']['bulkCreate'](_0x13d9ed,{'transaction':_0x3b1022})['then'](function(_0xde306){if(!_0xde306){return _0x56f37c(_0x95a9('0x62'));}else{return _0x1eb82e(_0xde306);}})[_0x95a9('0x48')](function(_0xcb12aa){return _0x56f37c(_0xcb12aa);});});;});};function addVoicePrefixExtensions(_0x5dddbd,_0x2f37c1){var _0x321879=[];var _0x545002=formatPrefixName(_0x5dddbd[_0x95a9('0x5f')]);_0x321879[_0x95a9('0x63')](new Extension(_0x545002,0x2,_0x95a9('0x64'),_0x95a9('0x65')+_0x5dddbd[_0x95a9('0x2d')]));if(_0x5dddbd[_0x95a9('0x66')]){_0x321879[_0x95a9('0x63')](new Extension(_0x545002,0x3,_0x95a9('0x64'),_0x95a9('0x67')+_0x5dddbd[_0x95a9('0x66')]));}else{_0x321879['push'](new Extension(_0x545002,0x3,_0x95a9('0x68'),_0x95a9('0x69')));}_0x321879['push'](new Extension(_0x545002,0x4,_0x95a9('0x6a'),_0x2f37c1[_0x95a9('0x6b')]+','+_0x95a9('0x6c')+(0x8+_0x5dddbd['name']['length'])+'}'+','+0x1));return _0x321879;}function formatPrefixName(_0x29e3e5){var _0x4a79d0='_';for(var _0xc6fbbe=0x0;_0xc6fbbe<_0x29e3e5['length'];_0xc6fbbe++){if(_0x29e3e5[_0x95a9('0x6d')](_0xc6fbbe)=='-'){_0x4a79d0+=_0x29e3e5[_0x95a9('0x6d')](_0xc6fbbe);}else{_0x4a79d0+='['+_0x29e3e5[_0x95a9('0x6d')](_0xc6fbbe)+']';}}_0x4a79d0+='.';return _0x4a79d0;}exports['update']=function(_0x398ed0,_0x447f23,_0x4717b9){var _0x2ef144=_0x398ed0[_0x95a9('0x4f')];_0x2ef144['prefix']=_0x95a9('0x6e')+_0x2ef144[_0x95a9('0x2d')]+'-';return db['sequelize'][_0x95a9('0x4e')](function(_0x36b5f1){return db[_0x95a9('0x30')][_0x95a9('0x26')](_0x2ef144,{'where':{'id':_0x2ef144['id']},'transaction':_0x36b5f1})[_0x95a9('0x27')](function(){return db[_0x95a9('0x50')]['destroy']({'where':{'VoicePrefixId':_0x2ef144['id']},'transaction':_0x36b5f1})[_0x95a9('0x27')](function(){return db[_0x95a9('0x50')][_0x95a9('0x4c')]({'where':{'id':_0x2ef144[_0x95a9('0x51')]},'raw':!![]})[_0x95a9('0x27')](function(_0x373c0b){return createVoicePrefixExtensions(_0x2ef144,_0x373c0b,_0x36b5f1);});});});})[_0x95a9('0x27')](function(){return db[_0x95a9('0x30')]['findById'](_0x2ef144['id']);})['then'](respondWithResult(_0x447f23,null))[_0x95a9('0x48')](handleError(_0x447f23,null));};exports['addAgents']=function(_0x11302a,_0x273aa4,_0x4f2251){return db[_0x95a9('0x30')][_0x95a9('0x4c')]({'where':{'id':_0x11302a[_0x95a9('0x4a')]['id']}})[_0x95a9('0x27')](handleEntityNotFound(_0x273aa4,null))['then'](function(_0x216bff){if(_0x216bff){return _0x216bff[_0x95a9('0x6f')](_0x11302a[_0x95a9('0x4f')][_0x95a9('0x70')],_['omit'](_0x11302a[_0x95a9('0x4f')],[_0x95a9('0x70'),'id'])||{})['spread'](function(_0x5372a4){for(var _0x22ec4d=0x0;_0x22ec4d<_0x11302a['body'][_0x95a9('0x70')][_0x95a9('0x3c')];_0x22ec4d+=0x1){socket[_0x95a9('0x71')](_0x95a9('0x72'),{'UserId':_0x11302a[_0x95a9('0x4f')]['ids'][_0x22ec4d],'VoicePrefixId':_0x11302a['params']['id']});}return _0x5372a4;});}})['then'](respondWithResult(_0x273aa4,null))[_0x95a9('0x48')](handleError(_0x273aa4,null));};exports[_0x95a9('0x73')]=function(_0x45f25a,_0x23905f,_0xcfd784){return db[_0x95a9('0x30')][_0x95a9('0x4c')]({'where':{'id':_0x45f25a[_0x95a9('0x4a')]['id']}})[_0x95a9('0x27')](handleEntityNotFound(_0x23905f,null))[_0x95a9('0x27')](function(_0x58bed){if(_0x58bed){return _0x58bed[_0x95a9('0x73')](_0x45f25a[_0x95a9('0x37')][_0x95a9('0x70')])[_0x95a9('0x27')](function(){if(_['isArray'](_0x45f25a[_0x95a9('0x37')][_0x95a9('0x70')])){for(var _0x67ed5b=0x0;_0x67ed5b<_0x45f25a[_0x95a9('0x37')][_0x95a9('0x70')]['length'];_0x67ed5b+=0x1){socket[_0x95a9('0x71')](_0x95a9('0x74'),{'UserId':Number(_0x45f25a['query'][_0x95a9('0x70')][_0x67ed5b]),'VoicePrefixId':Number(_0x45f25a[_0x95a9('0x4a')]['id'])});}}else{socket[_0x95a9('0x71')](_0x95a9('0x74'),{'UserId':Number(_0x45f25a[_0x95a9('0x37')][_0x95a9('0x70')]),'VoicePrefixId':Number(_0x45f25a['params']['id'])});}});}})[_0x95a9('0x27')](respondWithStatusCode(_0x23905f,null))['catch'](handleError(_0x23905f,null));};exports[_0x95a9('0x75')]=function(_0x10d292,_0x492337,_0x4f4d9d){var _0x3bc42f={};var _0x270576={};var _0x4d47ac;var _0x4fe142;return db[_0x95a9('0x30')][_0x95a9('0x76')]({'where':{'id':_0x10d292[_0x95a9('0x4a')]['id']}})[_0x95a9('0x27')](handleEntityNotFound(_0x492337,null))[_0x95a9('0x27')](function(_0x4db8a1){if(_0x4db8a1){_0x4d47ac=_0x4db8a1;_0x270576[_0x95a9('0x35')]=_['keys'](db[_0x95a9('0x77')][_0x95a9('0x31')]);_0x270576[_0x95a9('0x37')]=_[_0x95a9('0x36')](_0x10d292[_0x95a9('0x37')]);_0x270576[_0x95a9('0x38')]=_[_0x95a9('0x39')](_0x270576[_0x95a9('0x35')],_0x270576[_0x95a9('0x37')]);_0x3bc42f[_0x95a9('0x3a')]=_['intersection'](_0x270576[_0x95a9('0x35')],qs['fields'](_0x10d292['query'][_0x95a9('0x3b')]));_0x3bc42f[_0x95a9('0x3a')]=_0x3bc42f['attributes'][_0x95a9('0x3c')]?_0x3bc42f[_0x95a9('0x3a')]:_0x270576[_0x95a9('0x35')];_0x3bc42f[_0x95a9('0x3f')]=qs[_0x95a9('0x40')](_0x10d292['query']['sort']);_0x3bc42f[_0x95a9('0x43')]=qs[_0x95a9('0x38')](_[_0x95a9('0x41')](_0x10d292[_0x95a9('0x37')],_0x270576[_0x95a9('0x38')]));if(_0x10d292[_0x95a9('0x37')][_0x95a9('0x42')]){_0x3bc42f[_0x95a9('0x43')]=_[_0x95a9('0x44')](_0x3bc42f[_0x95a9('0x43')],{'$or':_[_0x95a9('0x2f')](_0x3bc42f['attributes'],function(_0xd5ea51){var _0x3ad41b={};_0x3ad41b[_0xd5ea51]={'$like':'%'+_0x10d292['query']['filter']+'%'};return _0x3ad41b;})});}_0x3bc42f=_['merge']({},_0x3bc42f,_0x10d292['options']);return _0x4d47ac['getAgents'](_0x3bc42f);}})[_0x95a9('0x27')](function(_0x1a4ace){if(_0x1a4ace){_0x4fe142=_0x1a4ace[_0x95a9('0x3c')];if(!_0x10d292[_0x95a9('0x37')]['hasOwnProperty'](_0x95a9('0x3e'))){_0x3bc42f[_0x95a9('0x21')]=qs[_0x95a9('0x21')](_0x10d292[_0x95a9('0x37')][_0x95a9('0x21')]);_0x3bc42f[_0x95a9('0x20')]=qs[_0x95a9('0x20')](_0x10d292[_0x95a9('0x37')]['offset']);}return _0x4d47ac['getAgents'](_0x3bc42f);}})['then'](function(_0x22eba6){if(_0x22eba6){return _0x22eba6?{'count':_0x4fe142,'rows':_0x22eba6}:null;}})['then'](respondWithResult(_0x492337,null))['catch'](handleError(_0x492337,null));}; \ No newline at end of file +var _0x15b2=['status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','model','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','params','describe','create','sequelize','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','from-sip','app','type','system','description','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','update','system-','transaction','findById','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x19ac2f,_0x5cd631){var _0x2b9d9a=function(_0x2eef32){while(--_0x2eef32){_0x19ac2f['push'](_0x19ac2f['shift']());}};_0x2b9d9a(++_0x5cd631);}(_0x15b2,0x145));var _0x215b=function(_0x41fe72,_0xaa8f97){_0x41fe72=_0x41fe72-0x0;var _0x717fdf=_0x15b2[_0x41fe72];return _0x717fdf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x215b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x215b('0x1'));var jsonpatch=require(_0x215b('0x2'));var rp=require('request-promise');var moment=require(_0x215b('0x3'));var BPromise=require(_0x215b('0x4'));var Mustache=require(_0x215b('0x5'));var util=require(_0x215b('0x6'));var path=require('path');var sox=require(_0x215b('0x7'));var csv=require('to-csv');var ejs=require(_0x215b('0x8'));var fs=require('fs');var _=require(_0x215b('0x9'));var squel=require(_0x215b('0xa'));var crypto=require(_0x215b('0xb'));var jsforce=require(_0x215b('0xc'));var deskjs=require(_0x215b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x215b('0xe'));var Papa=require(_0x215b('0xf'));var Redis=require('ioredis');var authService=require(_0x215b('0x10'));var qs=require(_0x215b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x215b('0x12'))('api');var utils=require(_0x215b('0x13'));var config=require(_0x215b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x215b('0x15'))['db'];config['redis']=_['defaults'](config[_0x215b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x215b('0x17'))(new Redis(config['redis']));require(_0x215b('0x18'))[_0x215b('0x19')](socket);function respondWithStatusCode(_0x38d765,_0x4ed24c){_0x4ed24c=_0x4ed24c||0xcc;return function(_0x495178){if(_0x495178){return _0x38d765['sendStatus'](_0x4ed24c);}return _0x38d765[_0x215b('0x1a')](_0x4ed24c)[_0x215b('0x1b')]();};}function respondWithResult(_0x2d04cb,_0x2e96f5){_0x2e96f5=_0x2e96f5||0xc8;return function(_0x35508e){if(_0x35508e){return _0x2d04cb[_0x215b('0x1a')](_0x2e96f5)[_0x215b('0x1c')](_0x35508e);}};}function respondWithFilteredResult(_0x4a27aa,_0x31d565){return function(_0x2ca496){if(_0x2ca496){var _0x2fd65=_0x2ca496[_0x215b('0x1d')],_0x37248f=_0x31d565[_0x215b('0x1e')],_0x3f18e4=_0x31d565['offset']+_0x31d565['limit'],_0x4492da;if(_0x3f18e4>=_0x2fd65){_0x3f18e4=_0x2fd65;_0x4492da=0xc8;}else{_0x4492da=0xce;}_0x4a27aa[_0x215b('0x1a')](_0x4492da);return _0x4a27aa['set'](_0x215b('0x1f'),_0x37248f+'-'+_0x3f18e4+'/'+_0x2fd65)[_0x215b('0x1c')](_0x2ca496);}return null;};}function patchUpdates(_0x2f9ed2){return function(_0x303c89){try{jsonpatch[_0x215b('0x20')](_0x303c89,_0x2f9ed2,!![]);}catch(_0x1a40a5){return BPromise[_0x215b('0x21')](_0x1a40a5);}return _0x303c89[_0x215b('0x22')]();};}function saveUpdates(_0x5cce5d,_0x4b31c3){return function(_0x33ef47){if(_0x33ef47){return _0x33ef47['update'](_0x5cce5d)[_0x215b('0x23')](function(_0x267af9){return _0x267af9;});}return null;};}function removeEntity(_0x48568a,_0x91587a){return function(_0x55efe7){if(_0x55efe7){return _0x55efe7[_0x215b('0x24')]()[_0x215b('0x23')](function(){var _0x1b7c12=_0x55efe7[_0x215b('0x25')]({'plain':!![]});var _0x1f30b1=_0x215b('0x26');return db[_0x215b('0x27')][_0x215b('0x24')]({'where':{'type':_0x1f30b1,'resourceId':_0x1b7c12['id']}})['then'](function(){return _0x55efe7;});})[_0x215b('0x23')](function(){_0x48568a[_0x215b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40eb6e,_0x191c50){return function(_0x1470ac){if(!_0x1470ac){_0x40eb6e['sendStatus'](0x194);}return _0x1470ac;};}function handleError(_0x23ffca,_0x41b373){_0x41b373=_0x41b373||0x1f4;return function(_0x1471a9){logger[_0x215b('0x28')](_0x1471a9[_0x215b('0x29')]);if(_0x1471a9[_0x215b('0x2a')]){delete _0x1471a9['name'];}_0x23ffca[_0x215b('0x1a')](_0x41b373)[_0x215b('0x2b')](_0x1471a9);};}exports[_0x215b('0x2c')]=function(_0x1d449b,_0x5eb42b){var _0x59f802={},_0x581256={},_0x4f83a2={'count':0x0,'rows':[]};var _0x48f0d6=_[_0x215b('0x2d')](db[_0x215b('0x2e')][_0x215b('0x2f')],function(_0xd25833){return{'name':_0xd25833['fieldName'],'type':_0xd25833['type']['key']};});_0x581256[_0x215b('0x30')]=_['map'](_0x48f0d6,'name');_0x581256[_0x215b('0x31')]=_[_0x215b('0x32')](_0x1d449b[_0x215b('0x31')]);_0x581256['filters']=_[_0x215b('0x33')](_0x581256[_0x215b('0x30')],_0x581256['query']);_0x59f802['attributes']=_[_0x215b('0x33')](_0x581256['model'],qs[_0x215b('0x34')](_0x1d449b['query']['fields']));_0x59f802[_0x215b('0x35')]=_0x59f802[_0x215b('0x35')][_0x215b('0x36')]?_0x59f802['attributes']:_0x581256[_0x215b('0x30')];if(!_0x1d449b['query']['hasOwnProperty'](_0x215b('0x37'))){_0x59f802[_0x215b('0x38')]=qs[_0x215b('0x38')](_0x1d449b[_0x215b('0x31')][_0x215b('0x38')]);_0x59f802[_0x215b('0x1e')]=qs['offset'](_0x1d449b[_0x215b('0x31')][_0x215b('0x1e')]);}_0x59f802['order']=qs[_0x215b('0x39')](_0x1d449b[_0x215b('0x31')][_0x215b('0x39')]);_0x59f802[_0x215b('0x3a')]=qs['filters'](_[_0x215b('0x3b')](_0x1d449b[_0x215b('0x31')],_0x581256[_0x215b('0x3c')]),_0x48f0d6);if(_0x1d449b[_0x215b('0x31')][_0x215b('0x3d')]){_0x59f802[_0x215b('0x3a')]=_['merge'](_0x59f802['where'],{'$or':_[_0x215b('0x2d')](_0x48f0d6,function(_0x41ecf6){if(_0x41ecf6['type']!==_0x215b('0x3e')){var _0x9e73cc={};_0x9e73cc[_0x41ecf6[_0x215b('0x2a')]]={'$like':'%'+_0x1d449b['query'][_0x215b('0x3d')]+'%'};return _0x9e73cc;}})});}_0x59f802=_[_0x215b('0x3f')]({},_0x59f802,_0x1d449b[_0x215b('0x40')]);var _0x5ee11b={'where':_0x59f802[_0x215b('0x3a')]};return db['VoicePrefix']['count'](_0x5ee11b)[_0x215b('0x23')](function(_0x44e38d){_0x4f83a2[_0x215b('0x1d')]=_0x44e38d;if(_0x1d449b['query'][_0x215b('0x41')]){_0x59f802[_0x215b('0x42')]=[{'all':!![]}];}return db[_0x215b('0x2e')][_0x215b('0x43')](_0x59f802);})['then'](function(_0x3cb153){_0x4f83a2[_0x215b('0x44')]=_0x3cb153;return _0x4f83a2;})[_0x215b('0x23')](respondWithFilteredResult(_0x5eb42b,_0x59f802))[_0x215b('0x45')](handleError(_0x5eb42b,null));};exports[_0x215b('0x46')]=function(_0x52a475,_0x48aef5){var _0x520d5d={'raw':![],'where':{'id':_0x52a475['params']['id']}},_0x2a269c={};_0x2a269c[_0x215b('0x30')]=_[_0x215b('0x32')](db[_0x215b('0x2e')][_0x215b('0x2f')]);_0x2a269c[_0x215b('0x31')]=_['keys'](_0x52a475['query']);_0x2a269c[_0x215b('0x3c')]=_['intersection'](_0x2a269c[_0x215b('0x30')],_0x2a269c[_0x215b('0x31')]);_0x520d5d[_0x215b('0x35')]=_[_0x215b('0x33')](_0x2a269c['model'],qs[_0x215b('0x34')](_0x52a475[_0x215b('0x31')][_0x215b('0x34')]));_0x520d5d['attributes']=_0x520d5d[_0x215b('0x35')][_0x215b('0x36')]?_0x520d5d[_0x215b('0x35')]:_0x2a269c[_0x215b('0x30')];if(_0x52a475['query'][_0x215b('0x41')]){_0x520d5d['include']=[{'all':!![]}];}_0x520d5d=_[_0x215b('0x3f')]({},_0x520d5d,_0x52a475[_0x215b('0x40')]);return db['VoicePrefix'][_0x215b('0x47')](_0x520d5d)[_0x215b('0x23')](handleEntityNotFound(_0x48aef5,null))['then'](respondWithResult(_0x48aef5,null))['catch'](handleError(_0x48aef5,null));};exports[_0x215b('0x24')]=function(_0x42f8a9,_0x33a520){return db['VoicePrefix'][_0x215b('0x47')]({'where':{'id':_0x42f8a9[_0x215b('0x48')]['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x33a520,null))[_0x215b('0x23')](removeEntity(_0x33a520,null))['catch'](handleError(_0x33a520,null));};exports[_0x215b('0x49')]=function(_0x5ece9b,_0x2b3960){return db[_0x215b('0x2e')][_0x215b('0x49')]()['then'](respondWithResult(_0x2b3960,null))[_0x215b('0x45')](handleError(_0x2b3960,null));};exports[_0x215b('0x4a')]=function(_0x570581,_0x535f37){var _0x2f93f9;return db[_0x215b('0x4b')]['transaction'](function(_0x389f34){return db[_0x215b('0x2e')][_0x215b('0x4a')](_0x570581[_0x215b('0x4c')],{'transaction':_0x389f34})[_0x215b('0x23')](function(_0x2bcbd3){_0x2f93f9=_0x2bcbd3[_0x215b('0x25')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x2f93f9[_0x215b('0x4d')]},'raw':!![]})[_0x215b('0x23')](function(_0x521c82){return createVoicePrefixExtensions(_0x2f93f9,_0x521c82,_0x389f34);});});})[_0x215b('0x23')](function(){var _0x1cfef3=_0x570581[_0x215b('0x4e')][_0x215b('0x25')]({'plain':!![]});if(!_0x1cfef3)throw new Error(_0x215b('0x4f'));if(_0x1cfef3['role']===_0x215b('0x4e')){var _0x30bc07=_0x2f93f9;return db[_0x215b('0x50')]['find']({'where':{'name':_0x215b('0x26'),'userProfileId':_0x1cfef3[_0x215b('0x51')]},'raw':!![]})[_0x215b('0x23')](function(_0x56688f){if(_0x56688f&&_0x56688f['autoAssociation']===0x0){return db[_0x215b('0x27')]['create']({'name':_0x30bc07[_0x215b('0x2a')],'resourceId':_0x30bc07['id'],'type':_0x56688f['name'],'sectionId':_0x56688f['id']},{})[_0x215b('0x23')](function(){return _0x2f93f9;});}else{return _0x2f93f9;}})['catch'](function(_0x41b139){logger[_0x215b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41b139);throw _0x41b139;});}return _0x2f93f9;})[_0x215b('0x23')](respondWithResult(_0x535f37,null))['catch'](handleError(_0x535f37,null));};function Extension(_0x2e2a5e,_0x35b870,_0xe10156,_0x6b9c12){this['context']=_0x215b('0x52');this['exten']=_0x2e2a5e;this[_0x215b('0x53')]=_0xe10156;this[_0x215b('0x54')]=_0x215b('0x55');this[_0x215b('0x56')]='Voice\x20Prefix\x20Extension';this['priority']=_0x35b870;this[_0x215b('0x57')]=_0x6b9c12;}function createVoicePrefixExtensions(_0x474020,_0x3bb3c5,_0x1b9aa5){return new BPromise(function(_0x18ad3e,_0x2a66d3){var _0x3aa26e=new Extension(formatPrefixName(_0x474020[_0x215b('0x58')]),0x1,_0x215b('0x59'),'Voice\x20Prefix');_0x3aa26e[_0x215b('0x5a')]=_0x474020['id'];return db[_0x215b('0x5b')][_0x215b('0x4a')](_0x3aa26e,{'transaction':_0x1b9aa5})[_0x215b('0x23')](function(_0x279b42){var _0x2c5a23=_0x279b42[_0x215b('0x25')]({'plain':!![]});var _0x19c629=_[_0x215b('0x2d')](addVoicePrefixExtensions(_0x474020,_0x3bb3c5),function(_0x13192c){_0x13192c[_0x215b('0x4d')]=_0x2c5a23['id'];_0x13192c[_0x215b('0x5a')]=_0x474020['id'];return _0x13192c;});return db[_0x215b('0x5b')][_0x215b('0x5c')](_0x19c629,{'transaction':_0x1b9aa5})['then'](function(_0x319b8d){if(!_0x319b8d){return _0x2a66d3(_0x215b('0x5d'));}else{return _0x18ad3e(_0x319b8d);}})[_0x215b('0x45')](function(_0x820a9b){return _0x2a66d3(_0x820a9b);});});;});};function addVoicePrefixExtensions(_0x4e13f8,_0x5e5c4e){var _0x173ff3=[];var _0x16a4de=formatPrefixName(_0x4e13f8[_0x215b('0x58')]);_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x2,'Set',_0x215b('0x5f')+_0x4e13f8['name']));if(_0x4e13f8[_0x215b('0x60')]){_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x3,_0x215b('0x61'),_0x215b('0x62')+_0x4e13f8[_0x215b('0x60')]));}else{_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x3,'NoOp',_0x215b('0x63')));}_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x4,_0x215b('0x64'),_0x5e5c4e[_0x215b('0x65')]+','+_0x215b('0x66')+(0x8+_0x4e13f8[_0x215b('0x2a')]['length'])+'}'+','+0x1));return _0x173ff3;}function formatPrefixName(_0xe026c4){var _0x3ff49d='_';for(var _0x106595=0x0;_0x106595<_0xe026c4['length'];_0x106595++){if(_0xe026c4[_0x215b('0x67')](_0x106595)=='-'){_0x3ff49d+=_0xe026c4[_0x215b('0x67')](_0x106595);}else{_0x3ff49d+='['+_0xe026c4['charAt'](_0x106595)+']';}}_0x3ff49d+='.';return _0x3ff49d;}exports[_0x215b('0x68')]=function(_0x2275b7,_0x5cc8cc,_0x350e42){var _0x1ce54d=_0x2275b7['body'];_0x1ce54d['prefix']=_0x215b('0x69')+_0x1ce54d[_0x215b('0x2a')]+'-';return db['sequelize'][_0x215b('0x6a')](function(_0x4c7092){return db[_0x215b('0x2e')]['update'](_0x1ce54d,{'where':{'id':_0x1ce54d['id']},'transaction':_0x4c7092})[_0x215b('0x23')](function(){return db[_0x215b('0x5b')]['destroy']({'where':{'VoicePrefixId':_0x1ce54d['id']},'transaction':_0x4c7092})[_0x215b('0x23')](function(){return db['VoiceExtension'][_0x215b('0x47')]({'where':{'id':_0x1ce54d[_0x215b('0x4d')]},'raw':!![]})[_0x215b('0x23')](function(_0x278578){return createVoicePrefixExtensions(_0x1ce54d,_0x278578,_0x4c7092);});});});})[_0x215b('0x23')](function(){return db[_0x215b('0x2e')][_0x215b('0x6b')](_0x1ce54d['id']);})[_0x215b('0x23')](respondWithResult(_0x5cc8cc,null))[_0x215b('0x45')](handleError(_0x5cc8cc,null));};exports['addAgents']=function(_0x1a0989,_0x588b17,_0x2f8c13){return db[_0x215b('0x2e')][_0x215b('0x47')]({'where':{'id':_0x1a0989[_0x215b('0x48')]['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x588b17,null))[_0x215b('0x23')](function(_0x1276ef){if(_0x1276ef){return _0x1276ef['addAgents'](_0x1a0989['body'][_0x215b('0x6c')],_['omit'](_0x1a0989[_0x215b('0x4c')],[_0x215b('0x6c'),'id'])||{})[_0x215b('0x6d')](function(_0x109711){for(var _0x499699=0x0;_0x499699<_0x1a0989[_0x215b('0x4c')][_0x215b('0x6c')]['length'];_0x499699+=0x1){socket['emit'](_0x215b('0x6e'),{'UserId':_0x1a0989[_0x215b('0x4c')]['ids'][_0x499699],'VoicePrefixId':_0x1a0989[_0x215b('0x48')]['id']});}return _0x109711;});}})[_0x215b('0x23')](respondWithResult(_0x588b17,null))[_0x215b('0x45')](handleError(_0x588b17,null));};exports['removeAgents']=function(_0x2e8a49,_0x3ba7ab,_0x4b40a8){return db[_0x215b('0x2e')][_0x215b('0x47')]({'where':{'id':_0x2e8a49[_0x215b('0x48')]['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x3ba7ab,null))[_0x215b('0x23')](function(_0x473b8d){if(_0x473b8d){return _0x473b8d[_0x215b('0x6f')](_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')])[_0x215b('0x23')](function(){if(_['isArray'](_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')])){for(var _0x3a0249=0x0;_0x3a0249<_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')][_0x215b('0x36')];_0x3a0249+=0x1){socket[_0x215b('0x70')](_0x215b('0x71'),{'UserId':Number(_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')][_0x3a0249]),'VoicePrefixId':Number(_0x2e8a49['params']['id'])});}}else{socket[_0x215b('0x70')](_0x215b('0x71'),{'UserId':Number(_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')]),'VoicePrefixId':Number(_0x2e8a49[_0x215b('0x48')]['id'])});}});}})[_0x215b('0x23')](respondWithStatusCode(_0x3ba7ab,null))[_0x215b('0x45')](handleError(_0x3ba7ab,null));};exports[_0x215b('0x72')]=function(_0x53efe9,_0x426095,_0x58d61c){var _0x2f5654={};var _0x4ee4a1={};var _0x114ce3;var _0x4546c5;return db[_0x215b('0x2e')][_0x215b('0x73')]({'where':{'id':_0x53efe9['params']['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x426095,null))['then'](function(_0x1ecf50){if(_0x1ecf50){_0x114ce3=_0x1ecf50;_0x4ee4a1['model']=_[_0x215b('0x32')](db[_0x215b('0x74')][_0x215b('0x2f')]);_0x4ee4a1[_0x215b('0x31')]=_[_0x215b('0x32')](_0x53efe9['query']);_0x4ee4a1['filters']=_[_0x215b('0x33')](_0x4ee4a1[_0x215b('0x30')],_0x4ee4a1['query']);_0x2f5654[_0x215b('0x35')]=_['intersection'](_0x4ee4a1[_0x215b('0x30')],qs[_0x215b('0x34')](_0x53efe9[_0x215b('0x31')][_0x215b('0x34')]));_0x2f5654[_0x215b('0x35')]=_0x2f5654[_0x215b('0x35')][_0x215b('0x36')]?_0x2f5654[_0x215b('0x35')]:_0x4ee4a1[_0x215b('0x30')];_0x2f5654['order']=qs[_0x215b('0x39')](_0x53efe9[_0x215b('0x31')][_0x215b('0x39')]);_0x2f5654[_0x215b('0x3a')]=qs[_0x215b('0x3c')](_[_0x215b('0x3b')](_0x53efe9[_0x215b('0x31')],_0x4ee4a1[_0x215b('0x3c')]));if(_0x53efe9[_0x215b('0x31')]['filter']){_0x2f5654[_0x215b('0x3a')]=_['merge'](_0x2f5654['where'],{'$or':_[_0x215b('0x2d')](_0x2f5654[_0x215b('0x35')],function(_0x2f3746){var _0x2fea28={};_0x2fea28[_0x2f3746]={'$like':'%'+_0x53efe9[_0x215b('0x31')][_0x215b('0x3d')]+'%'};return _0x2fea28;})});}_0x2f5654=_[_0x215b('0x3f')]({},_0x2f5654,_0x53efe9[_0x215b('0x40')]);return _0x114ce3['getAgents'](_0x2f5654);}})['then'](function(_0x3b8c16){if(_0x3b8c16){_0x4546c5=_0x3b8c16[_0x215b('0x36')];if(!_0x53efe9[_0x215b('0x31')]['hasOwnProperty'](_0x215b('0x37'))){_0x2f5654[_0x215b('0x38')]=qs[_0x215b('0x38')](_0x53efe9['query'][_0x215b('0x38')]);_0x2f5654['offset']=qs[_0x215b('0x1e')](_0x53efe9['query']['offset']);}return _0x114ce3[_0x215b('0x72')](_0x2f5654);}})['then'](function(_0x3dbac2){if(_0x3dbac2){return _0x3dbac2?{'count':_0x4546c5,'rows':_0x3dbac2}:null;}})['then'](respondWithResult(_0x426095,null))[_0x215b('0x45')](handleError(_0x426095,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 83cc839..57bb357 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x58e01b,_0x3fabdb){var _0x51d2a3=function(_0x108a05){while(--_0x108a05){_0x58e01b['push'](_0x58e01b['shift']());}};_0x51d2a3(++_0x3fabdb);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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 +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x3ec028,_0x42cf91){var _0x15f2b9=function(_0x409159){while(--_0x409159){_0x3ec028['push'](_0x3ec028['shift']());}};_0x15f2b9(++_0x42cf91);}(_0x008c,0x188));var _0xc008=function(_0x45dfde,_0x597ea9){_0x45dfde=_0x45dfde-0x0;var _0x26ca3b=_0x008c[_0x45dfde];return _0x26ca3b;};'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 diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6d7cab6..8d45f0f 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 _0x0e20=['util','../../config/logger','api','moment','request-promise','path','rimraf','./voicePrefix.attributes','exports','VoicePrefix','lodash'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0x0e20,0x99));var _0x00e2=function(_0x326e1b,_0x1ce100){_0x326e1b=_0x326e1b-0x0;var _0x178f67=_0x0e20[_0x326e1b];return _0x178f67;};'use strict';var _=require(_0x00e2('0x0'));var util=require(_0x00e2('0x1'));var logger=require(_0x00e2('0x2'))(_0x00e2('0x3'));var moment=require(_0x00e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x00e2('0x5'));var fs=require('fs');var path=require(_0x00e2('0x6'));var rimraf=require(_0x00e2('0x7'));var config=require('../../config/environment');var attributes=require(_0x00e2('0x8'));module[_0x00e2('0x9')]=function(_0x511379,_0xa28b7e){return _0x511379['define'](_0x00e2('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x570e=['request-promise','rimraf','../../config/environment','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x570e,0xc3));var _0xe570=function(_0x5583f,_0x36b976){_0x5583f=_0x5583f-0x0;var _0x196941=_0x570e[_0x5583f];return _0x196941;};'use strict';var _=require(_0xe570('0x0'));var util=require('util');var logger=require(_0xe570('0x1'))('api');var moment=require(_0xe570('0x2'));var BPromise=require('bluebird');var rp=require(_0xe570('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe570('0x4'));var config=require(_0xe570('0x5'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x2f2089,_0x362b2c){return _0x2f2089[_0xe570('0x6')](_0xe570('0x7'),attributes,{'tableName':_0xe570('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index b3497f2..f6978c4 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 _0x76a6=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xe66daa,_0x35c239){var _0x35d538=function(_0x4dd0cd){while(--_0x4dd0cd){_0xe66daa['push'](_0xe66daa['shift']());}};_0x35d538(++_0x35c239);}(_0x76a6,0x18b));var _0x676a=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x76a6[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0x676a('0x0'));var util=require(_0x676a('0x1'));var moment=require('moment');var BPromise=require(_0x676a('0x2'));var rs=require(_0x676a('0x3'));var fs=require('fs');var Redis=require(_0x676a('0x4'));var db=require(_0x676a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x676a('0x6'))(_0x676a('0x7'));var config=require(_0x676a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x676a('0x9')][_0x676a('0xa')]({'port':0x232a});config[_0x676a('0xb')]=_[_0x676a('0xc')](config['redis'],{'host':_0x676a('0xd'),'port':0x18eb});var socket=require(_0x676a('0xe'))(new Redis(config[_0x676a('0xb')]));require(_0x676a('0xf'))[_0x676a('0x10')](socket);function respondWithRpcPromise(_0x435062,_0x403c64,_0x1779f8){return new BPromise(function(_0x373024,_0x1d517b){return client[_0x676a('0x11')](_0x435062,_0x1779f8)[_0x676a('0x12')](function(_0x52a6e2){logger['info'](_0x676a('0x13'),_0x403c64,_0x676a('0x14'));logger[_0x676a('0x15')](_0x676a('0x16'),_0x403c64,_0x676a('0x14'),JSON[_0x676a('0x17')](_0x52a6e2));if(_0x52a6e2[_0x676a('0x18')]){if(_0x52a6e2[_0x676a('0x18')][_0x676a('0x19')]===0x1f4){logger[_0x676a('0x18')](_0x676a('0x13'),_0x403c64,_0x52a6e2[_0x676a('0x18')]['message']);return _0x1d517b(_0x52a6e2[_0x676a('0x18')][_0x676a('0x1a')]);}logger[_0x676a('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x403c64,_0x52a6e2[_0x676a('0x18')]['message']);return _0x373024(_0x52a6e2[_0x676a('0x18')][_0x676a('0x1a')]);}else{logger[_0x676a('0x1b')](_0x676a('0x13'),_0x403c64,_0x676a('0x14'));_0x373024(_0x52a6e2['result']['message']);}})[_0x676a('0x1c')](function(_0x37baeb){logger[_0x676a('0x18')](_0x676a('0x13'),_0x403c64,_0x37baeb);_0x1d517b(_0x37baeb);});});} \ No newline at end of file +var _0x2754=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x234e1a,_0x500d79){var _0x55aad2=function(_0x272396){while(--_0x272396){_0x234e1a['push'](_0x234e1a['shift']());}};_0x55aad2(++_0x500d79);}(_0x2754,0x173));var _0x4275=function(_0x15fdff,_0x40d5b2){_0x15fdff=_0x15fdff-0x0;var _0x5450ed=_0x2754[_0x15fdff];return _0x5450ed;};'use strict';var _=require('lodash');var util=require(_0x4275('0x0'));var moment=require(_0x4275('0x1'));var BPromise=require(_0x4275('0x2'));var rs=require(_0x4275('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4275('0x4'))['db'];var utils=require(_0x4275('0x5'));var logger=require(_0x4275('0x6'))(_0x4275('0x7'));var config=require(_0x4275('0x8'));var jayson=require(_0x4275('0x9'));var client=jayson[_0x4275('0xa')][_0x4275('0xb')]({'port':0x232a});config[_0x4275('0xc')]=_[_0x4275('0xd')](config[_0x4275('0xc')],{'host':_0x4275('0xe'),'port':0x18eb});var socket=require(_0x4275('0xf'))(new Redis(config['redis']));require(_0x4275('0x10'))['register'](socket);function respondWithRpcPromise(_0x24d311,_0x562ece,_0x404eb6){return new BPromise(function(_0x1b8fc3,_0x186df0){return client['request'](_0x24d311,_0x404eb6)[_0x4275('0x11')](function(_0x63a281){logger[_0x4275('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x562ece,_0x4275('0x13'));logger[_0x4275('0x14')](_0x4275('0x15'),_0x562ece,'request\x20sent',JSON[_0x4275('0x16')](_0x63a281));if(_0x63a281[_0x4275('0x17')]){if(_0x63a281['error']['code']===0x1f4){logger['error'](_0x4275('0x18'),_0x562ece,_0x63a281[_0x4275('0x17')]['message']);return _0x186df0(_0x63a281[_0x4275('0x17')][_0x4275('0x19')]);}logger[_0x4275('0x17')](_0x4275('0x18'),_0x562ece,_0x63a281[_0x4275('0x17')][_0x4275('0x19')]);return _0x1b8fc3(_0x63a281[_0x4275('0x17')]['message']);}else{logger[_0x4275('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x562ece,_0x4275('0x13'));_0x1b8fc3(_0x63a281['result'][_0x4275('0x19')]);}})[_0x4275('0x1a')](function(_0x21793d){logger[_0x4275('0x17')](_0x4275('0x18'),_0x562ece,_0x21793d);_0x186df0(_0x21793d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3d689f1..2210211 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 _0xb02f=['./voicePrefix.events','update','emit','removeListener','length'];(function(_0x54a1e4,_0x982c15){var _0x14d04f=function(_0xcb0d87){while(--_0xcb0d87){_0x54a1e4['push'](_0x54a1e4['shift']());}};_0x14d04f(++_0x982c15);}(_0xb02f,0xe1));var _0xfb02=function(_0x5bd49c,_0x5f4de2){_0x5bd49c=_0x5bd49c-0x0;var _0xb323fc=_0xb02f[_0x5bd49c];return _0xb323fc;};'use strict';var VoicePrefixEvents=require(_0xfb02('0x0'));var events=['save','remove',_0xfb02('0x1')];function createListener(_0x2f7527,_0x373137){return function(_0x2c8de2){_0x373137[_0xfb02('0x2')](_0x2f7527,_0x2c8de2);};}function removeListener(_0x305e65,_0x46ef0f){return function(){VoicePrefixEvents[_0xfb02('0x3')](_0x305e65,_0x46ef0f);};}exports['register']=function(_0x40015e){for(var _0x5c2e46=0x0,_0x1a4bb6=events[_0xfb02('0x4')];_0x5c2e46<_0x1a4bb6;_0x5c2e46++){var _0x511a81=events[_0x5c2e46];var _0x34cc90=createListener('voicePrefix:'+_0x511a81,_0x40015e);VoicePrefixEvents['on'](_0x511a81,_0x34cc90);}}; \ No newline at end of file +var _0xb9a6=['remove','update','emit','removeListener','register','./voicePrefix.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb9a6,0xa6));var _0x6b9a=function(_0x319bdb,_0x524c65){_0x319bdb=_0x319bdb-0x0;var _0xe033f6=_0xb9a6[_0x319bdb];return _0xe033f6;};'use strict';var VoicePrefixEvents=require(_0x6b9a('0x0'));var events=[_0x6b9a('0x1'),_0x6b9a('0x2'),_0x6b9a('0x3')];function createListener(_0x378e3d,_0x496d18){return function(_0x7f5472){_0x496d18[_0x6b9a('0x4')](_0x378e3d,_0x7f5472);};}function removeListener(_0x472d65,_0x5b1507){return function(){VoicePrefixEvents[_0x6b9a('0x5')](_0x472d65,_0x5b1507);};}exports[_0x6b9a('0x6')]=function(_0x3b07db){for(var _0x215347=0x0,_0x559a31=events['length'];_0x215347<_0x559a31;_0x215347++){var _0x21b697=events[_0x215347];var _0x1da35d=createListener('voicePrefix:'+_0x21b697,_0x3b07db);VoicePrefixEvents['on'](_0x21b697,_0x1da35d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c1cf6f5..a897d64 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 _0xcc3e=['/:id/teams','addTeams','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','removeLists','removeBlackLists','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getTeams','getAgents','getMembers','/:id/lists','getLists','getBlackLists','post','create','clone'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcc3e,0x1c5));var _0xecc3=function(_0x183cb0,_0x456e68){_0x183cb0=_0x183cb0-0x0;var _0x366963=_0xcc3e[_0x183cb0];return _0x366963;};'use strict';var multer=require(_0xecc3('0x0'));var util=require(_0xecc3('0x1'));var path=require(_0xecc3('0x2'));var timeout=require('connect-timeout');var express=require(_0xecc3('0x3'));var router=express[_0xecc3('0x4')]();var auth=require(_0xecc3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xecc3('0x6'));var controller=require(_0xecc3('0x7'));router[_0xecc3('0x8')]('/',auth[_0xecc3('0x9')](),controller[_0xecc3('0xa')]);router['get'](_0xecc3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xecc3('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xecc3('0xc')]);router[_0xecc3('0x8')](_0xecc3('0xd'),auth[_0xecc3('0x9')](),controller[_0xecc3('0xe')]);router[_0xecc3('0x8')](_0xecc3('0xf'),auth[_0xecc3('0x9')](),controller['getHopperFinals']);router[_0xecc3('0x8')](_0xecc3('0x10'),auth[_0xecc3('0x9')](),controller[_0xecc3('0x11')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xecc3('0x12')]);router[_0xecc3('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xecc3('0x13')]);router['get']('/:id/members',auth[_0xecc3('0x9')](),controller[_0xecc3('0x14')]);router[_0xecc3('0x8')](_0xecc3('0x15'),auth[_0xecc3('0x9')](),controller[_0xecc3('0x16')]);router['get']('/:id/blacklists',auth[_0xecc3('0x9')](),controller[_0xecc3('0x17')]);router[_0xecc3('0x18')]('/',auth['isAuthenticated'](),controller[_0xecc3('0x19')]);router[_0xecc3('0x18')]('/:id/clone',auth[_0xecc3('0x9')](),controller[_0xecc3('0x1a')]);router[_0xecc3('0x18')](_0xecc3('0x1b'),auth[_0xecc3('0x9')](),controller[_0xecc3('0x1c')]);router[_0xecc3('0x18')]('/:id/users',auth[_0xecc3('0x9')](),controller['addAgents']);router[_0xecc3('0x18')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0xecc3('0x18')](_0xecc3('0x1d'),auth['isAuthenticated'](),controller[_0xecc3('0x1e')]);router[_0xecc3('0x1f')](_0xecc3('0xb'),auth[_0xecc3('0x9')](),controller[_0xecc3('0x20')]);router[_0xecc3('0x21')]('/:id',auth[_0xecc3('0x9')](),controller[_0xecc3('0x22')]);router['delete'](_0xecc3('0x1b'),auth[_0xecc3('0x9')](),controller[_0xecc3('0x23')]);router[_0xecc3('0x21')](_0xecc3('0x24'),auth[_0xecc3('0x9')](),controller[_0xecc3('0x25')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0xecc3('0x26')]);router['delete'](_0xecc3('0x1d'),auth[_0xecc3('0x9')](),controller[_0xecc3('0x27')]);module['exports']=router; \ No newline at end of file +var _0x916c=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','getBlackLists','post','create','/:id/clone','addAgents','/:id/lists','addBlackLists','put','update','delete','removeAgents','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','express'];(function(_0x13b70f,_0x5c1116){var _0x51427c=function(_0x54bb0b){while(--_0x54bb0b){_0x13b70f['push'](_0x13b70f['shift']());}};_0x51427c(++_0x5c1116);}(_0x916c,0x163));var _0xc916=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x916c[_0x205e5a];return _0x10da58;};'use strict';var multer=require(_0xc916('0x0'));var util=require(_0xc916('0x1'));var path=require(_0xc916('0x2'));var timeout=require(_0xc916('0x3'));var express=require(_0xc916('0x4'));var router=express[_0xc916('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc916('0x6'));var config=require(_0xc916('0x7'));var controller=require('./voiceQueue.controller');router[_0xc916('0x8')]('/',auth[_0xc916('0x9')](),controller[_0xc916('0xa')]);router[_0xc916('0x8')](_0xc916('0xb'),auth[_0xc916('0x9')](),controller['show']);router[_0xc916('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xc916('0xc')]);router[_0xc916('0x8')](_0xc916('0xd'),auth[_0xc916('0x9')](),controller['getHopperHistories']);router[_0xc916('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xc916('0xe')]);router[_0xc916('0x8')](_0xc916('0xf'),auth[_0xc916('0x9')](),controller[_0xc916('0x10')]);router['get'](_0xc916('0x11'),auth[_0xc916('0x9')](),controller['getTeams']);router[_0xc916('0x8')](_0xc916('0x12'),auth[_0xc916('0x9')](),controller[_0xc916('0x13')]);router[_0xc916('0x8')](_0xc916('0x14'),auth[_0xc916('0x9')](),controller[_0xc916('0x15')]);router['get']('/:id/lists',auth[_0xc916('0x9')](),controller['getLists']);router[_0xc916('0x8')]('/:id/blacklists',auth[_0xc916('0x9')](),controller[_0xc916('0x16')]);router[_0xc916('0x17')]('/',auth[_0xc916('0x9')](),controller[_0xc916('0x18')]);router[_0xc916('0x17')](_0xc916('0x19'),auth['isAuthenticated'](),controller['clone']);router[_0xc916('0x17')](_0xc916('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc916('0x17')](_0xc916('0x12'),auth['isAuthenticated'](),controller[_0xc916('0x1a')]);router['post'](_0xc916('0x1b'),auth['isAuthenticated'](),controller['addLists']);router['post']('/:id/blacklists',auth[_0xc916('0x9')](),controller[_0xc916('0x1c')]);router[_0xc916('0x1d')](_0xc916('0xb'),auth[_0xc916('0x9')](),controller[_0xc916('0x1e')]);router[_0xc916('0x1f')](_0xc916('0xb'),auth[_0xc916('0x9')](),controller['destroy']);router['delete'](_0xc916('0x11'),auth[_0xc916('0x9')](),controller['removeTeams']);router['delete'](_0xc916('0x12'),auth[_0xc916('0x9')](),controller[_0xc916('0x20')]);router[_0xc916('0x1f')](_0xc916('0x1b'),auth[_0xc916('0x9')](),controller['removeLists']);router[_0xc916('0x1f')](_0xc916('0x21'),auth[_0xc916('0x9')](),controller[_0xc916('0x22')]);module[_0xc916('0x23')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9f0116d..a3c65b7 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(_0x32c961,_0x170cc7){var _0x5779e7=function(_0x43dc17){while(--_0x43dc17){_0x32c961['push'](_0x32c961['shift']());}};_0x5779e7(++_0x170cc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x1d895d,_0x3e5c93){var _0x2dae23=function(_0x443cd0){while(--_0x443cd0){_0x1d895d['push'](_0x1d895d['shift']());}};_0x2dae23(++_0x3e5c93);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 40a512f..550129e 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 _0x4990=['options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','user','UserProfileSection','userProfileId','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','Team','getTeams','teams','User','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','TeamVoiceQueue','upsert','each','findOrCreate','UserVoiceQueueRt','isNil','format','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper','onlyIfOpen','insert','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','count','set','Content-Range','apply','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','send','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','VIRTUAL','VoiceQueue','includeAll','findAll','rows','catch','show','params','include'];(function(_0x19a087,_0xb1ff28){var _0x1785f6=function(_0x23725b){while(--_0x23725b){_0x19a087['push'](_0x19a087['shift']());}};_0x1785f6(++_0xb1ff28);}(_0x4990,0x11a));var _0x0499=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0x4990[_0x5be8cc];return _0x5f1b7e;};'use strict';var pdf=require(_0x0499('0x0'));var emlformat=require(_0x0499('0x1'));var rimraf=require(_0x0499('0x2'));var zipdir=require(_0x0499('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0499('0x4'));var moment=require('moment');var BPromise=require(_0x0499('0x5'));var Mustache=require(_0x0499('0x6'));var util=require(_0x0499('0x7'));var path=require(_0x0499('0x8'));var sox=require(_0x0499('0x9'));var csv=require(_0x0499('0xa'));var ejs=require(_0x0499('0xb'));var fs=require('fs');var _=require(_0x0499('0xc'));var squel=require('squel');var crypto=require(_0x0499('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0499('0xe'));var toCsv=require(_0x0499('0xa'));var querystring=require('querystring');var Papa=require(_0x0499('0xf'));var Redis=require(_0x0499('0x10'));var authService=require(_0x0499('0x11'));var qs=require(_0x0499('0x12'));var as=require(_0x0499('0x13'));var hardwareService=require(_0x0499('0x14'));var logger=require('../../config/logger')(_0x0499('0x15'));var utils=require(_0x0499('0x16'));var config=require(_0x0499('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x0499('0x18')](config['redis'],{'host':_0x0499('0x19'),'port':0x18eb});var socket=require(_0x0499('0x1a'))(new Redis(config['redis']));require(_0x0499('0x1b'))[_0x0499('0x1c')](socket);function respondWithStatusCode(_0x1c6a4a,_0x1f555a){_0x1f555a=_0x1f555a||0xcc;return function(_0x58ef44){if(_0x58ef44){return _0x1c6a4a[_0x0499('0x1d')](_0x1f555a);}return _0x1c6a4a['status'](_0x1f555a)[_0x0499('0x1e')]();};}function respondWithResult(_0x23fef6,_0x29762c){_0x29762c=_0x29762c||0xc8;return function(_0x1c1420){if(_0x1c1420){return _0x23fef6[_0x0499('0x1f')](_0x29762c)['json'](_0x1c1420);}};}function respondWithFilteredResult(_0x3c0bd2,_0x5343e7){return function(_0x460dae){if(_0x460dae){var _0x5b3c17=_0x460dae[_0x0499('0x20')],_0x3b8e86=_0x5343e7['offset'],_0x59f44e=_0x5343e7['offset']+_0x5343e7['limit'],_0x5dab37;if(_0x59f44e>=_0x5b3c17){_0x59f44e=_0x5b3c17;_0x5dab37=0xc8;}else{_0x5dab37=0xce;}_0x3c0bd2[_0x0499('0x1f')](_0x5dab37);return _0x3c0bd2[_0x0499('0x21')](_0x0499('0x22'),_0x3b8e86+'-'+_0x59f44e+'/'+_0x5b3c17)['json'](_0x460dae);}return null;};}function patchUpdates(_0x3166df){return function(_0x3cab4e){try{jsonpatch[_0x0499('0x23')](_0x3cab4e,_0x3166df,!![]);}catch(_0x34a6aa){return BPromise['reject'](_0x34a6aa);}return _0x3cab4e['save']();};}function saveUpdates(_0x2d1bd7,_0x51b1dd){return function(_0x53ed02){if(_0x53ed02){return _0x53ed02[_0x0499('0x24')](_0x2d1bd7)['then'](function(_0x1da232){return _0x1da232;});}return null;};}function removeEntity(_0x95e4ab,_0x396bdb){return function(_0x3ed348){if(_0x3ed348){return _0x3ed348[_0x0499('0x25')]()[_0x0499('0x26')](function(){var _0x4cbe9d=_0x3ed348[_0x0499('0x27')]({'plain':!![]});var _0x117b1d=[{'name':_0x0499('0x28'),'value':_0x0499('0x29'),'ignore':![]},{'name':_0x0499('0x2a'),'value':_0x0499('0x2b'),'ignore':![]}];var _0x389898=_(_0x117b1d)[_0x0499('0x2c')](_0x0499('0x2d'))[_0x0499('0x2e')](_0x0499('0x2f'))[_0x0499('0x2f')]();if(_['includes'](_0x389898,_0x4cbe9d[_0x0499('0x30')])){return;}var _0x3be255=_[_0x0499('0x31')](_0x117b1d,[_0x0499('0x2f'),_0x4cbe9d[_0x0499('0x30')]])[_0x0499('0x32')];return db[_0x0499('0x33')][_0x0499('0x25')]({'where':{'type':_0x3be255,'resourceId':_0x4cbe9d['id']}})[_0x0499('0x26')](function(){return _0x3ed348;});})[_0x0499('0x26')](function(){_0x95e4ab['status'](0xcc)[_0x0499('0x1e')]();});}};}function handleEntityNotFound(_0x11c8c6,_0x6be50e){return function(_0x23e430){if(!_0x23e430){_0x11c8c6[_0x0499('0x1d')](0x194);}return _0x23e430;};}function handleError(_0x47231d,_0x6cd2db){_0x6cd2db=_0x6cd2db||0x1f4;return function(_0x1d9972){logger[_0x0499('0x34')](_0x1d9972['stack']);if(_0x1d9972[_0x0499('0x32')]){delete _0x1d9972[_0x0499('0x32')];}_0x47231d['status'](_0x6cd2db)[_0x0499('0x35')](_0x1d9972);};}exports['index']=function(_0x1b2bc2,_0x4f815c){var _0x37dcc1={},_0x12a550={},_0xcd483e={'count':0x0,'rows':[]};var _0x1ca34e=_['map'](db['VoiceQueue'][_0x0499('0x36')],function(_0x48f080){return{'name':_0x48f080[_0x0499('0x37')],'type':_0x48f080[_0x0499('0x30')]['key']};});_0x12a550[_0x0499('0x38')]=_[_0x0499('0x2e')](_0x1ca34e,_0x0499('0x32'));_0x12a550['query']=_[_0x0499('0x39')](_0x1b2bc2[_0x0499('0x3a')]);_0x12a550[_0x0499('0x3b')]=_['intersection'](_0x12a550['model'],_0x12a550[_0x0499('0x3a')]);_0x37dcc1['attributes']=_[_0x0499('0x3c')](_0x12a550['model'],qs[_0x0499('0x3d')](_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x3d')]));_0x37dcc1[_0x0499('0x3e')]=_0x37dcc1['attributes'][_0x0499('0x3f')]?_0x37dcc1['attributes']:_0x12a550['model'];if(!_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x37dcc1[_0x0499('0x42')]=qs['limit'](_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x42')]);_0x37dcc1['offset']=qs[_0x0499('0x43')](_0x1b2bc2['query']['offset']);}_0x37dcc1[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x45')]);_0x37dcc1[_0x0499('0x46')]=qs['filters'](_[_0x0499('0x47')](_0x1b2bc2[_0x0499('0x3a')],_0x12a550['filters']),_0x1ca34e);if(_0x1b2bc2[_0x0499('0x3a')]['filter']){_0x37dcc1['where']=_[_0x0499('0x48')](_0x37dcc1[_0x0499('0x46')],{'$or':_['map'](_0x1ca34e,function(_0xab14a4){if(_0xab14a4['type']!==_0x0499('0x49')){var _0x61bdc6={};_0x61bdc6[_0xab14a4[_0x0499('0x32')]]={'$like':'%'+_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x61bdc6;}})});}_0x37dcc1=_[_0x0499('0x48')]({},_0x37dcc1,_0x1b2bc2['options']);var _0x13d4de={'where':_0x37dcc1[_0x0499('0x46')]};return db[_0x0499('0x4a')][_0x0499('0x20')](_0x13d4de)[_0x0499('0x26')](function(_0x4530d0){_0xcd483e[_0x0499('0x20')]=_0x4530d0;if(_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x4b')]){_0x37dcc1['include']=[{'all':!![]}];}return db[_0x0499('0x4a')][_0x0499('0x4c')](_0x37dcc1);})[_0x0499('0x26')](function(_0x171874){_0xcd483e[_0x0499('0x4d')]=_0x171874;return _0xcd483e;})['then'](respondWithFilteredResult(_0x4f815c,_0x37dcc1))[_0x0499('0x4e')](handleError(_0x4f815c,null));};exports[_0x0499('0x4f')]=function(_0x2b3cf8,_0x5cf2a6){var _0x3f4688={'raw':![],'where':{'id':_0x2b3cf8[_0x0499('0x50')]['id']}},_0x36c81c={};_0x36c81c[_0x0499('0x38')]=_[_0x0499('0x39')](db['VoiceQueue'][_0x0499('0x36')]);_0x36c81c[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x2b3cf8[_0x0499('0x3a')]);_0x36c81c['filters']=_[_0x0499('0x3c')](_0x36c81c[_0x0499('0x38')],_0x36c81c[_0x0499('0x3a')]);_0x3f4688[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x36c81c[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x2b3cf8[_0x0499('0x3a')][_0x0499('0x3d')]));_0x3f4688[_0x0499('0x3e')]=_0x3f4688[_0x0499('0x3e')]['length']?_0x3f4688['attributes']:_0x36c81c[_0x0499('0x38')];if(_0x2b3cf8[_0x0499('0x3a')][_0x0499('0x4b')]){_0x3f4688[_0x0499('0x51')]=[{'all':!![]}];}_0x3f4688=_['merge']({},_0x3f4688,_0x2b3cf8[_0x0499('0x52')]);return db[_0x0499('0x4a')][_0x0499('0x31')](_0x3f4688)[_0x0499('0x26')](handleEntityNotFound(_0x5cf2a6,null))['then'](respondWithResult(_0x5cf2a6,null))[_0x0499('0x4e')](handleError(_0x5cf2a6,null));};exports[_0x0499('0x53')]=function(_0x2b33b4,_0x1f93cb){return db[_0x0499('0x4a')][_0x0499('0x53')](_0x2b33b4[_0x0499('0x54')],{})[_0x0499('0x26')](function(_0x262432){var _0x1822ac=_0x2b33b4['user'][_0x0499('0x27')]({'plain':!![]});if(!_0x1822ac)throw new Error(_0x0499('0x55'));if(_0x1822ac[_0x0499('0x56')]==='user'){var _0x1b9c38=_0x262432[_0x0499('0x27')]({'plain':!![]});var _0x432de1=[{'name':'VoiceQueues','value':_0x0499('0x29')},{'name':_0x0499('0x2a'),'value':_0x0499('0x2b')}];var _0x20826b=_[_0x0499('0x31')](_0x432de1,[_0x0499('0x2f'),_0x1b9c38[_0x0499('0x30')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x20826b,'userProfileId':_0x1822ac['userProfileId']},'raw':!![]})[_0x0499('0x26')](function(_0x3cd4d3){if(_0x3cd4d3&&_0x3cd4d3[_0x0499('0x57')]===0x0){return db[_0x0499('0x33')][_0x0499('0x53')]({'name':_0x1b9c38['name'],'resourceId':_0x1b9c38['id'],'type':_0x3cd4d3[_0x0499('0x32')],'sectionId':_0x3cd4d3['id']},{})[_0x0499('0x26')](function(){return _0x262432;});}else{return _0x262432;}})[_0x0499('0x4e')](function(_0x397392){logger[_0x0499('0x34')](_0x0499('0x58'),_0x397392);throw _0x397392;});}return _0x262432;})[_0x0499('0x26')](respondWithResult(_0x1f93cb,0xc9))['catch'](handleError(_0x1f93cb,null));};exports['clone']=function(_0x2d10f6,_0xcb4448){var _0x2ba045={'where':{'id':_0x2d10f6[_0x0499('0x50')]['id']}},_0x8f4f40={};_0x8f4f40[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x4a')][_0x0499('0x36')]);_0x2ba045[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x8f4f40['model'],qs[_0x0499('0x3d')](_0x2d10f6[_0x0499('0x3a')][_0x0499('0x3d')]));_0x2ba045[_0x0499('0x3e')]=_0x2ba045[_0x0499('0x3e')][_0x0499('0x3f')]?_0x2ba045[_0x0499('0x3e')]:_0x8f4f40['model'];if(_0x2d10f6['query']['includeAll']){_0x2ba045[_0x0499('0x51')]=[{'all':!![]}];}_0x2ba045=_[_0x0499('0x48')]({},_0x2ba045,_0x2d10f6[_0x0499('0x52')]);return db[_0x0499('0x4a')][_0x0499('0x31')](_0x2ba045)[_0x0499('0x26')](handleEntityNotFound(_0xcb4448,null))[_0x0499('0x26')](function(_0x575124){if(_0x575124){var _0x38a6e4=_0x575124['get']({'plain':!![]});_0x38a6e4=qs[_0x0499('0x59')](_0x38a6e4,['id',_0x0499('0x5a'),_0x0499('0x5b')]);_0x2d10f6[_0x0499('0x54')]=_[_0x0499('0x59')](_0x2d10f6[_0x0499('0x54')],['id',_0x0499('0x5a'),_0x0499('0x5b')]);return db['VoiceQueue'][_0x0499('0x53')](_['merge'](_0x38a6e4,_0x2d10f6[_0x0499('0x54')]),{'include':_0x2d10f6[_0x0499('0x3a')][_0x0499('0x4b')]?[{'all':!![]}]:undefined})[_0x0499('0x26')](function(_0x2e549b){var _0x563eae=_0x2d10f6['user']['get']({'plain':!![]});if(!_0x563eae)throw new Error(_0x0499('0x55'));if(_0x563eae['role']===_0x0499('0x5c')){var _0x3c15dd=_0x2e549b[_0x0499('0x27')]({'plain':!![]});var _0x51048f=[{'name':'VoiceQueues','value':_0x0499('0x29')},{'name':_0x0499('0x2a'),'value':_0x0499('0x2b')}];var _0xd6f199=_['find'](_0x51048f,['value',_0x3c15dd[_0x0499('0x30')]])[_0x0499('0x32')];return db[_0x0499('0x5d')][_0x0499('0x31')]({'where':{'name':_0xd6f199,'userProfileId':_0x563eae[_0x0499('0x5e')]},'raw':!![]})['then'](function(_0x22203a){if(_0x22203a&&_0x22203a[_0x0499('0x57')]===0x0){return db['UserProfileResource'][_0x0499('0x53')]({'name':_0x3c15dd['name'],'resourceId':_0x3c15dd['id'],'type':_0x22203a['name'],'sectionId':_0x22203a['id']},{})[_0x0499('0x26')](function(){return _0x2e549b;});}else{return _0x2e549b;}})[_0x0499('0x4e')](function(_0x498279){logger[_0x0499('0x34')](_0x0499('0x58'),_0x498279);throw _0x498279;});}return _0x2e549b;});}})[_0x0499('0x26')](respondWithResult(_0xcb4448,0xc9))[_0x0499('0x4e')](handleError(_0xcb4448,null));};exports[_0x0499('0x24')]=function(_0x441bde,_0x2438b6){if(_0x441bde[_0x0499('0x54')]['id']){delete _0x441bde[_0x0499('0x54')]['id'];}return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x441bde[_0x0499('0x50')]['id']}})['then'](handleEntityNotFound(_0x2438b6,null))[_0x0499('0x26')](saveUpdates(_0x441bde[_0x0499('0x54')],null))['then'](respondWithResult(_0x2438b6,null))['catch'](handleError(_0x2438b6,null));};exports['destroy']=function(_0x2fa114,_0x28d7b6){return db['VoiceQueue'][_0x0499('0x31')]({'where':{'id':_0x2fa114[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x28d7b6,null))['then'](removeEntity(_0x28d7b6,null))[_0x0499('0x4e')](handleError(_0x28d7b6,null));};exports[_0x0499('0x5f')]=function(_0x5ecf60,_0x196f30,_0x349b47){var _0x936ea={'raw':![],'where':{}};var _0x1ff364={};var _0x1a75f8={'count':0x0,'rows':[]};return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x5ecf60['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x196f30,null))[_0x0499('0x26')](function(_0xf75e4f){if(_0xf75e4f){_0x1ff364['model']=_[_0x0499('0x39')](db[_0x0499('0x61')][_0x0499('0x36')]);_0x1ff364[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x5ecf60[_0x0499('0x3a')]);_0x1ff364[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x1ff364['model'],_0x1ff364[_0x0499('0x3a')]);_0x936ea[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x1ff364[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x5ecf60['query'][_0x0499('0x3d')]));_0x936ea[_0x0499('0x3e')]=_0x936ea[_0x0499('0x3e')][_0x0499('0x3f')]?_0x936ea[_0x0499('0x3e')]:_0x1ff364[_0x0499('0x38')];if(!_0x5ecf60['query'][_0x0499('0x40')]('nolimit')){_0x936ea['limit']=qs[_0x0499('0x42')](_0x5ecf60[_0x0499('0x3a')]['limit']);_0x936ea[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x5ecf60[_0x0499('0x3a')]['offset']);}_0x936ea['order']=qs[_0x0499('0x45')](_0x5ecf60[_0x0499('0x3a')][_0x0499('0x45')]);_0x936ea['where']=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x5ecf60['query'],_0x1ff364['filters']));_0x936ea[_0x0499('0x46')][_0x0499('0x62')]=_0xf75e4f['id'];if(_0x5ecf60['query'][_0x0499('0x2c')]){_0x936ea[_0x0499('0x46')]=_[_0x0499('0x48')](_0x936ea[_0x0499('0x46')],{'$or':_['map'](_0x936ea[_0x0499('0x3e')],function(_0x486197){var _0x27c174={};_0x27c174[_0x486197]={'$like':'%'+_0x5ecf60['query'][_0x0499('0x2c')]+'%'};return _0x27c174;})});}_0x936ea=_[_0x0499('0x48')]({},_0x936ea,_0x5ecf60[_0x0499('0x52')]);return db[_0x0499('0x61')][_0x0499('0x20')]({'where':_0x936ea[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x10d33e){_0x1a75f8['count']=_0x10d33e;if(_0x5ecf60[_0x0499('0x3a')][_0x0499('0x4b')]){_0x936ea[_0x0499('0x51')]=[{'all':!![]}];}return db[_0x0499('0x61')][_0x0499('0x4c')](_0x936ea);})[_0x0499('0x26')](function(_0x238866){_0x1a75f8[_0x0499('0x4d')]=_0x238866;return _0x1a75f8;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x196f30,_0x936ea))[_0x0499('0x4e')](handleError(_0x196f30,null));};exports[_0x0499('0x63')]=function(_0x3e7f7,_0x42b2e9,_0x246b8e){var _0x419035={'raw':!![],'where':{}};var _0x450d5e={};var _0x2ce792={'count':0x0,'rows':[]};return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x3e7f7[_0x0499('0x50')]['id']}})['then'](handleEntityNotFound(_0x42b2e9,null))[_0x0499('0x26')](function(_0x298b82){if(_0x298b82){_0x450d5e[_0x0499('0x38')]=_['keys'](db[_0x0499('0x64')]['rawAttributes']);_0x450d5e['query']=_[_0x0499('0x39')](_0x3e7f7[_0x0499('0x3a')]);_0x450d5e[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x450d5e[_0x0499('0x38')],_0x450d5e['query']);_0x419035[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x450d5e[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x3d')]));_0x419035[_0x0499('0x3e')]=_0x419035[_0x0499('0x3e')][_0x0499('0x3f')]?_0x419035[_0x0499('0x3e')]:_0x450d5e[_0x0499('0x38')];if(!_0x3e7f7['query'][_0x0499('0x40')](_0x0499('0x41'))){_0x419035['limit']=qs[_0x0499('0x42')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x42')]);_0x419035[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x43')]);}_0x419035[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x45')]);_0x419035[_0x0499('0x46')]=qs[_0x0499('0x3b')](_['pick'](_0x3e7f7[_0x0499('0x3a')],_0x450d5e[_0x0499('0x3b')]));_0x419035[_0x0499('0x46')][_0x0499('0x62')]=_0x298b82['id'];if(_0x3e7f7[_0x0499('0x3a')][_0x0499('0x2c')]){_0x419035[_0x0499('0x46')]=_[_0x0499('0x48')](_0x419035['where'],{'$or':_['map'](_0x419035['attributes'],function(_0x4e0fe1){var _0x3a5263={};_0x3a5263[_0x4e0fe1]={'$like':'%'+_0x3e7f7[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x3a5263;})});}_0x419035=_[_0x0499('0x48')]({},_0x419035,_0x3e7f7[_0x0499('0x52')]);return db[_0x0499('0x64')][_0x0499('0x20')]({'where':_0x419035[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x4e9b95){_0x2ce792[_0x0499('0x20')]=_0x4e9b95;if(_0x3e7f7['query'][_0x0499('0x4b')]){_0x419035[_0x0499('0x51')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0499('0x4c')](_0x419035);})[_0x0499('0x26')](function(_0x43523b){_0x2ce792[_0x0499('0x4d')]=_0x43523b;return _0x2ce792;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x42b2e9,_0x419035))[_0x0499('0x4e')](handleError(_0x42b2e9,null));};exports['getHopperFinals']=function(_0x49e90f,_0x219eeb,_0x3c25a3){var _0x19f2d3={'raw':!![],'where':{}};var _0x2369b7={};var _0x151508={'count':0x0,'rows':[]};return db[_0x0499('0x4a')]['findOne']({'where':{'id':_0x49e90f[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x219eeb,null))[_0x0499('0x26')](function(_0x167a04){if(_0x167a04){_0x2369b7[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x65')][_0x0499('0x36')]);_0x2369b7[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x49e90f[_0x0499('0x3a')]);_0x2369b7[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x2369b7['model'],_0x2369b7[_0x0499('0x3a')]);_0x19f2d3['attributes']=_['intersection'](_0x2369b7[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x49e90f[_0x0499('0x3a')][_0x0499('0x3d')]));_0x19f2d3[_0x0499('0x3e')]=_0x19f2d3['attributes'][_0x0499('0x3f')]?_0x19f2d3['attributes']:_0x2369b7[_0x0499('0x38')];if(!_0x49e90f['query']['hasOwnProperty'](_0x0499('0x41'))){_0x19f2d3[_0x0499('0x42')]=qs[_0x0499('0x42')](_0x49e90f[_0x0499('0x3a')][_0x0499('0x42')]);_0x19f2d3['offset']=qs[_0x0499('0x43')](_0x49e90f['query']['offset']);}_0x19f2d3[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x49e90f['query']['sort']);_0x19f2d3[_0x0499('0x46')]=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x49e90f[_0x0499('0x3a')],_0x2369b7['filters']));_0x19f2d3['where'][_0x0499('0x62')]=_0x167a04['id'];if(_0x49e90f['query']['filter']){_0x19f2d3['where']=_[_0x0499('0x48')](_0x19f2d3[_0x0499('0x46')],{'$or':_['map'](_0x19f2d3[_0x0499('0x3e')],function(_0x28ade8){var _0x3f1e08={};_0x3f1e08[_0x28ade8]={'$like':'%'+_0x49e90f['query'][_0x0499('0x2c')]+'%'};return _0x3f1e08;})});}_0x19f2d3=_[_0x0499('0x48')]({},_0x19f2d3,_0x49e90f[_0x0499('0x52')]);return db[_0x0499('0x65')][_0x0499('0x20')]({'where':_0x19f2d3[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x29b8b9){_0x151508[_0x0499('0x20')]=_0x29b8b9;if(_0x49e90f[_0x0499('0x3a')][_0x0499('0x4b')]){_0x19f2d3[_0x0499('0x51')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x19f2d3);})[_0x0499('0x26')](function(_0x360bb7){_0x151508[_0x0499('0x4d')]=_0x360bb7;return _0x151508;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x219eeb,_0x19f2d3))[_0x0499('0x4e')](handleError(_0x219eeb,null));};exports['getHopperBlacks']=function(_0x3e886e,_0x250b7c,_0x3264fc){var _0x370283={'raw':!![],'where':{}};var _0x426154={};var _0x5f3f35={'count':0x0,'rows':[]};return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x3e886e[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x250b7c,null))[_0x0499('0x26')](function(_0x26fde2){if(_0x26fde2){_0x426154[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x66')]['rawAttributes']);_0x426154[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x3e886e['query']);_0x426154[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x426154[_0x0499('0x38')],_0x426154[_0x0499('0x3a')]);_0x370283[_0x0499('0x3e')]=_['intersection'](_0x426154[_0x0499('0x38')],qs['fields'](_0x3e886e['query'][_0x0499('0x3d')]));_0x370283[_0x0499('0x3e')]=_0x370283[_0x0499('0x3e')][_0x0499('0x3f')]?_0x370283[_0x0499('0x3e')]:_0x426154[_0x0499('0x38')];if(!_0x3e886e['query'][_0x0499('0x40')](_0x0499('0x41'))){_0x370283[_0x0499('0x42')]=qs[_0x0499('0x42')](_0x3e886e[_0x0499('0x3a')][_0x0499('0x42')]);_0x370283[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x3e886e[_0x0499('0x3a')]['offset']);}_0x370283[_0x0499('0x44')]=qs['sort'](_0x3e886e['query'][_0x0499('0x45')]);_0x370283[_0x0499('0x46')]=qs['filters'](_[_0x0499('0x47')](_0x3e886e[_0x0499('0x3a')],_0x426154[_0x0499('0x3b')]));_0x370283[_0x0499('0x46')][_0x0499('0x62')]=_0x26fde2['id'];if(_0x3e886e['query']['filter']){_0x370283[_0x0499('0x46')]=_[_0x0499('0x48')](_0x370283[_0x0499('0x46')],{'$or':_[_0x0499('0x2e')](_0x370283[_0x0499('0x3e')],function(_0x4db38a){var _0x1626b0={};_0x1626b0[_0x4db38a]={'$like':'%'+_0x3e886e[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x1626b0;})});}_0x370283=_[_0x0499('0x48')]({},_0x370283,_0x3e886e[_0x0499('0x52')]);return db[_0x0499('0x66')]['count']({'where':_0x370283[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x1d2f4c){_0x5f3f35[_0x0499('0x20')]=_0x1d2f4c;if(_0x3e886e[_0x0499('0x3a')][_0x0499('0x4b')]){_0x370283[_0x0499('0x51')]=[{'all':!![]}];}return db[_0x0499('0x66')]['findAll'](_0x370283);})[_0x0499('0x26')](function(_0x5d7830){_0x5f3f35[_0x0499('0x4d')]=_0x5d7830;return _0x5f3f35;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x250b7c,_0x370283))[_0x0499('0x4e')](handleError(_0x250b7c,null));};exports['getTeams']=function(_0x2493b2,_0x1222c3,_0x5248d8){var _0x56acce={};var _0x352e48={};var _0x4e62d7;var _0x36b3e8;return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x2493b2['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x1222c3,null))[_0x0499('0x26')](function(_0x32d204){if(_0x32d204){_0x4e62d7=_0x32d204;_0x352e48[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x67')][_0x0499('0x36')]);_0x352e48['query']=_[_0x0499('0x39')](_0x2493b2['query']);_0x352e48[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x352e48['model'],_0x352e48[_0x0499('0x3a')]);_0x56acce[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x352e48['model'],qs[_0x0499('0x3d')](_0x2493b2[_0x0499('0x3a')][_0x0499('0x3d')]));_0x56acce[_0x0499('0x3e')]=_0x56acce[_0x0499('0x3e')]['length']?_0x56acce[_0x0499('0x3e')]:_0x352e48['model'];_0x56acce['order']=qs[_0x0499('0x45')](_0x2493b2['query'][_0x0499('0x45')]);_0x56acce['where']=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x2493b2[_0x0499('0x3a')],_0x352e48[_0x0499('0x3b')]));if(_0x2493b2[_0x0499('0x3a')][_0x0499('0x2c')]){_0x56acce[_0x0499('0x46')]=_[_0x0499('0x48')](_0x56acce['where'],{'$or':_[_0x0499('0x2e')](_0x56acce[_0x0499('0x3e')],function(_0x141fb3){var _0x5f1cdd={};_0x5f1cdd[_0x141fb3]={'$like':'%'+_0x2493b2['query'][_0x0499('0x2c')]+'%'};return _0x5f1cdd;})});}_0x56acce=_[_0x0499('0x48')]({},_0x56acce,_0x2493b2['options']);return _0x4e62d7[_0x0499('0x68')](_0x56acce);}})[_0x0499('0x26')](function(_0x407630){if(_0x407630){_0x36b3e8=_0x407630[_0x0499('0x3f')];if(!_0x2493b2[_0x0499('0x3a')]['hasOwnProperty']('nolimit')){_0x56acce[_0x0499('0x42')]=qs[_0x0499('0x42')](_0x2493b2[_0x0499('0x3a')][_0x0499('0x42')]);_0x56acce[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x2493b2['query']['offset']);}return _0x4e62d7['getTeams'](_0x56acce);}})[_0x0499('0x26')](function(_0x3d8d53){if(_0x3d8d53){return _0x3d8d53?{'count':_0x36b3e8,'rows':_0x3d8d53}:null;}})[_0x0499('0x26')](respondWithResult(_0x1222c3,null))[_0x0499('0x4e')](handleError(_0x1222c3,null));};exports['addTeams']=function(_0x5550ce,_0x17f760,_0x2d8544){var _0x6772c1=_0x5550ce[_0x0499('0x54')][_0x0499('0x69')];var _0x1ee815=_['map'](_0x6772c1,'id');return db[_0x0499('0x67')]['findAll']({'where':{'id':_0x1ee815},'attributes':['id'],'include':[{'model':db[_0x0499('0x6a')],'as':_0x0499('0x6b'),'attributes':['id',_0x0499('0x32'),'online','voicePause',_0x0499('0x6c')],'raw':!![]}]})[_0x0499('0x26')](function(_0x5a9a6a){if(_0x5a9a6a){var _0x1ea363=_[_0x0499('0x6d')](_0x5a9a6a,function(_0x4b3459){var _0x448d5e=_0x4b3459[_0x0499('0x27')]({'plain':!![]});_0x448d5e[_0x0499('0x6b')][_0x0499('0x6e')](function(_0x4f3e1a){_0x4f3e1a['penalty']=_['find'](_0x6772c1,{'id':_0x448d5e['id']})[_0x0499('0x6f')];});return _0x448d5e[_0x0499('0x6b')];});return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x5550ce[_0x0499('0x50')]['id']}})[_0x0499('0x26')](function(_0x56207a){return db[_0x0499('0x70')][_0x0499('0x71')](function(_0x9f1fe3){return _0x56207a[_0x0499('0x72')](_0x1ee815,{'transaction':_0x9f1fe3})[_0x0499('0x26')](function(){return BPromise['each'](_0x6772c1,function(_0x138b7b){return db[_0x0499('0x73')][_0x0499('0x74')]({'TeamId':_0x138b7b['id'],'VoiceQueueId':_0x5550ce[_0x0499('0x50')]['id'],'penalty':_0x138b7b[_0x0499('0x6f')]},{'transaction':_0x9f1fe3});});})[_0x0499('0x26')](function(){return BPromise[_0x0499('0x75')](_0x1ea363,function(_0x520e52){return db['UserVoiceQueue'][_0x0499('0x76')]({'where':{'UserId':_0x520e52['id'],'VoiceQueueId':_0x5550ce[_0x0499('0x50')]['id']},'defaults':{'penalty':_0x520e52[_0x0499('0x6f')]},'transaction':_0x9f1fe3});});})[_0x0499('0x26')](function(){return BPromise['each'](_[_0x0499('0x2c')](_0x1ea363,{'online':!![]}),function(_0x8d0bfb){return db[_0x0499('0x77')][_0x0499('0x74')]({'membername':_0x8d0bfb[_0x0499('0x32')],'UserId':_0x8d0bfb['id'],'queue_name':_0x56207a[_0x0499('0x32')],'VoiceQueueId':_0x56207a['id'],'interface':_[_0x0499('0x78')](_0x8d0bfb[_0x0499('0x6c')])?util[_0x0499('0x79')]('SIP/%s',_0x8d0bfb[_0x0499('0x32')]):_0x8d0bfb['interface'],'paused':_0x8d0bfb['voicePause']||![],'penalty':_0x8d0bfb[_0x0499('0x6f')]},{'transaction':_0x9f1fe3});});})[_0x0499('0x26')](function(){_0x1ea363[_0x0499('0x6e')](function(_0x54807f){socket[_0x0499('0x7a')](_0x0499('0x7b'),{'UserId':_0x54807f['id'],'VoiceQueueId':_0x56207a['id']});});});});});}})[_0x0499('0x26')](respondWithStatusCode(_0x17f760,null))[_0x0499('0x4e')](handleError(_0x17f760,null));};exports[_0x0499('0x7c')]=function(_0x415819,_0x4a8721,_0x450d45){return db[_0x0499('0x67')][_0x0499('0x4c')]({'where':{'id':_0x415819[_0x0499('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0499('0x6a')],'as':_0x0499('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4a8721,null))[_0x0499('0x26')](function(_0x5e95c7){var _0x586662=_[_0x0499('0x2e')](_0x5e95c7,'id');var _0x131991=[];var _0x218efc=[];var _0x302b81=squel[_0x0499('0x7d')]();_0x302b81[_0x0499('0x7e')](_0x0499('0x7f'))[_0x0499('0x80')](_0x0499('0x81'),'tq')['join'](_0x0499('0x82'),'ut',_0x0499('0x83'))['where'](_0x0499('0x84'),_0x415819[_0x0499('0x50')]['id']);for(var _0x51e90c=0x0;_0x51e90c<_0x5e95c7[_0x0499('0x3f')];_0x51e90c+=0x1){let _0x3adf79=_0x5e95c7[_0x51e90c];for(var _0x30474c=0x0;_0x30474c<_0x3adf79['Agents'][_0x0499('0x3f')];_0x30474c+=0x1){let _0x24f44c=_0x3adf79[_0x0499('0x6b')][_0x30474c];var _0xf24a46=_0x302b81[_0x0499('0x85')]();_0xf24a46['where'](_0x0499('0x86'),_0x24f44c['id']);_0x218efc[_0x0499('0x87')](db[_0x0499('0x70')]['query'](_0xf24a46[_0x0499('0x88')](),{'type':db[_0x0499('0x70')][_0x0499('0x89')][_0x0499('0x8a')]})[_0x0499('0x26')](function(_0x3ac1a0){if(_0x3ac1a0['length']===0x1){return _0x24f44c['id'];}else{var _0x39e65f=_[_0x0499('0x8b')](_[_0x0499('0x2e')](_0x3ac1a0,_0x0499('0x8c')),function(_0x229138){return _[_0x0499('0x8d')](_0x586662,_0x229138);});if(_0x39e65f){return _0x24f44c['id'];}}}));}}return BPromise[_0x0499('0x8e')](_0x218efc)[_0x0499('0x26')](function(_0xfe1edd){_0x131991=_(_0x131991)[_0x0499('0x8f')](_0xfe1edd)[_0x0499('0x90')]()[_0x0499('0x2f')]();return db['VoiceQueue']['find']({'where':{'id':_0x415819[_0x0499('0x50')]['id']}})[_0x0499('0x26')](function(_0x292a81){return db[_0x0499('0x70')]['transaction'](function(_0x2b2d5f){return _0x292a81[_0x0499('0x7c')](_0x415819[_0x0499('0x3a')][_0x0499('0x91')],{'transaction':_0x2b2d5f})['then'](function(){if(!_[_0x0499('0x92')](_0x131991)){return _0x292a81[_0x0499('0x93')](_0x131991,{'transaction':_0x2b2d5f})['then'](function(){return db[_0x0499('0x77')][_0x0499('0x25')]({'where':{'VoiceQueueId':_0x415819['params']['id'],'UserId':_0x131991},'transaction':_0x2b2d5f});});}})[_0x0499('0x26')](function(){_0x131991[_0x0499('0x6e')](function(_0xf37b65){socket[_0x0499('0x7a')](_0x0499('0x94'),{'UserId':_0xf37b65,'VoiceQueueId':_0x292a81['id']});});});});});});})[_0x0499('0x26')](respondWithStatusCode(_0x4a8721,null))[_0x0499('0x4e')](handleError(_0x4a8721,null));};exports[_0x0499('0x95')]=function(_0x4d1eaf,_0x2cc21f,_0x51ba59){var _0x5c4052,_0x143722;return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x4d1eaf[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x2cc21f,null))[_0x0499('0x26')](function(_0x5b924e){if(_0x5b924e){_0x143722=_0x5b924e;return _0x5b924e['addAgents'](_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')],_[_0x0499('0x59')](_0x4d1eaf[_0x0499('0x54')],['ids','id'])||{})[_0x0499('0x96')](function(_0x37d450){for(var _0x45cc16=0x0;_0x45cc16<_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')][_0x0499('0x3f')];_0x45cc16+=0x1){socket['emit'](_0x0499('0x7b'),{'UserId':_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')][_0x45cc16],'VoiceQueueId':_0x4d1eaf[_0x0499('0x50')]['id']});}return _0x37d450;});}})[_0x0499('0x26')](function(_0x370642){_0x5c4052=_0x370642||[];if(_0x143722){return db['User']['findAll']({'where':{'id':_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')]},'attributes':['id',_0x0499('0x32'),'online','voicePause',_0x0499('0x6c')],'raw':!![]});}})[_0x0499('0x26')](function(_0x57fe5a){if(!_[_0x0499('0x92')](_0x57fe5a)){var _0x224407=[];for(var _0x5d83da=0x0;_0x5d83da<_0x57fe5a[_0x0499('0x3f')];_0x5d83da++){if(_0x57fe5a[_0x5d83da]['online']){_0x224407[_0x0499('0x87')](db[_0x0499('0x77')]['upsert']({'membername':_0x57fe5a[_0x5d83da][_0x0499('0x32')],'UserId':_0x57fe5a[_0x5d83da]['id'],'queue_name':_0x143722['name'],'VoiceQueueId':_0x143722['id'],'interface':_[_0x0499('0x78')](_0x57fe5a[_0x5d83da][_0x0499('0x6c')])?util['format']('SIP/%s',_0x57fe5a[_0x5d83da][_0x0499('0x32')]):_0x57fe5a[_0x5d83da][_0x0499('0x6c')],'paused':_0x57fe5a[_0x5d83da][_0x0499('0x97')]||![],'penalty':_0x4d1eaf['body'][_0x0499('0x6f')]||0x0}));}}return BPromise[_0x0499('0x8e')](_0x224407);}})[_0x0499('0x26')](function(){return _0x5c4052;})[_0x0499('0x26')](respondWithResult(_0x2cc21f,null))[_0x0499('0x4e')](handleError(_0x2cc21f,null));};exports[_0x0499('0x93')]=function(_0x10ab62,_0x35b939,_0x2ae991){return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x10ab62['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x35b939,null))['then'](function(_0x4590a4){if(_0x4590a4){return _0x4590a4[_0x0499('0x93')](_0x10ab62['query']['ids'])[_0x0499('0x26')](function(){if(_[_0x0499('0x98')](_0x10ab62['query'][_0x0499('0x91')])){for(var _0x5d481a=0x0;_0x5d481a<_0x10ab62[_0x0499('0x3a')][_0x0499('0x91')]['length'];_0x5d481a+=0x1){socket[_0x0499('0x7a')](_0x0499('0x94'),{'UserId':Number(_0x10ab62[_0x0499('0x3a')]['ids'][_0x5d481a]),'VoiceQueueId':Number(_0x10ab62[_0x0499('0x50')]['id'])});}}else{socket[_0x0499('0x7a')]('userVoiceQueue:remove',{'UserId':Number(_0x10ab62[_0x0499('0x3a')][_0x0499('0x91')]),'VoiceQueueId':Number(_0x10ab62['params']['id'])});}});}})[_0x0499('0x26')](function(_0x3ccede){return db[_0x0499('0x77')][_0x0499('0x25')]({'where':{'VoiceQueueId':_0x10ab62[_0x0499('0x50')]['id'],'UserId':_0x10ab62['query'][_0x0499('0x91')]}})[_0x0499('0x26')](function(){return _0x3ccede;});})[_0x0499('0x26')](respondWithStatusCode(_0x35b939,null))[_0x0499('0x4e')](handleError(_0x35b939,null));};exports[_0x0499('0x99')]=function(_0xa44d0e,_0x29735f,_0x849a52){var _0x41c2a2={};var _0x39ff64={};var _0x2e4e50;var _0x1a4a14;return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0xa44d0e[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x29735f,null))[_0x0499('0x26')](function(_0x15dd1b){if(_0x15dd1b){_0x2e4e50=_0x15dd1b;_0x39ff64[_0x0499('0x38')]=_['keys'](db[_0x0499('0x6a')][_0x0499('0x36')]);_0x39ff64['query']=_['keys'](_0xa44d0e[_0x0499('0x3a')]);_0x39ff64[_0x0499('0x3b')]=_['intersection'](_0x39ff64[_0x0499('0x38')],_0x39ff64[_0x0499('0x3a')]);_0x41c2a2[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x39ff64['model'],qs[_0x0499('0x3d')](_0xa44d0e[_0x0499('0x3a')]['fields']));_0x41c2a2[_0x0499('0x3e')]=_0x41c2a2[_0x0499('0x3e')][_0x0499('0x3f')]?_0x41c2a2[_0x0499('0x3e')]:_0x39ff64[_0x0499('0x38')];_0x41c2a2[_0x0499('0x44')]=qs[_0x0499('0x45')](_0xa44d0e[_0x0499('0x3a')]['sort']);_0x41c2a2['where']=qs['filters'](_[_0x0499('0x47')](_0xa44d0e[_0x0499('0x3a')],_0x39ff64[_0x0499('0x3b')]));if(_0xa44d0e['query']['filter']){_0x41c2a2['where']=_[_0x0499('0x48')](_0x41c2a2[_0x0499('0x46')],{'$or':_['map'](_0x41c2a2['attributes'],function(_0x1a3dfd){var _0x13a072={};_0x13a072[_0x1a3dfd]={'$like':'%'+_0xa44d0e[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x13a072;})});}_0x41c2a2=_[_0x0499('0x48')]({},_0x41c2a2,_0xa44d0e[_0x0499('0x52')]);return _0x2e4e50[_0x0499('0x99')](_0x41c2a2);}})[_0x0499('0x26')](function(_0x51eba1){if(_0x51eba1){_0x1a4a14=_0x51eba1['length'];if(!_0xa44d0e[_0x0499('0x3a')][_0x0499('0x40')]('nolimit')){_0x41c2a2['limit']=qs[_0x0499('0x42')](_0xa44d0e[_0x0499('0x3a')][_0x0499('0x42')]);_0x41c2a2[_0x0499('0x43')]=qs[_0x0499('0x43')](_0xa44d0e[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x2e4e50['getAgents'](_0x41c2a2);}})[_0x0499('0x26')](function(_0x3cfd29){if(_0x3cfd29){return _0x3cfd29?{'count':_0x1a4a14,'rows':_0x3cfd29}:null;}})[_0x0499('0x26')](respondWithResult(_0x29735f,null))[_0x0499('0x4e')](handleError(_0x29735f,null));};exports[_0x0499('0x9a')]=function(_0x52816a,_0x473cf3,_0x293ded){var _0x542fb5={};var _0x266aab={};var _0x2e3680;var _0x5d9b61;return db['VoiceQueue'][_0x0499('0x60')]({'where':{'id':_0x52816a[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x473cf3,null))[_0x0499('0x26')](function(_0x961448){if(_0x961448){_0x2e3680=_0x961448;_0x266aab['model']=_[_0x0499('0x39')](db['UserVoiceQueueRt'][_0x0499('0x36')]);_0x266aab[_0x0499('0x3a')]=_['keys'](_0x52816a[_0x0499('0x3a')]);_0x266aab[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x266aab['model'],_0x266aab[_0x0499('0x3a')]);_0x542fb5[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x266aab[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x52816a[_0x0499('0x3a')][_0x0499('0x3d')]));_0x542fb5[_0x0499('0x3e')]=_0x542fb5[_0x0499('0x3e')]['length']?_0x542fb5['attributes']:_0x266aab['model'];_0x542fb5[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x52816a['query'][_0x0499('0x45')]);_0x542fb5[_0x0499('0x46')]=qs['filters'](_[_0x0499('0x47')](_0x52816a['query'],_0x266aab['filters']));if(_0x52816a[_0x0499('0x3a')]['filter']){_0x542fb5['where']=_[_0x0499('0x48')](_0x542fb5[_0x0499('0x46')],{'$or':_[_0x0499('0x2e')](_0x542fb5[_0x0499('0x3e')],function(_0x113063){var _0x46066f={};_0x46066f[_0x113063]={'$like':'%'+_0x52816a[_0x0499('0x3a')]['filter']+'%'};return _0x46066f;})});}_0x542fb5=_[_0x0499('0x48')]({},_0x542fb5,_0x52816a[_0x0499('0x52')]);return _0x2e3680[_0x0499('0x9a')](_0x542fb5);}})[_0x0499('0x26')](function(_0x58b51e){if(_0x58b51e){_0x5d9b61=_0x58b51e[_0x0499('0x3f')];if(!_0x52816a[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x542fb5[_0x0499('0x42')]=qs['limit'](_0x52816a[_0x0499('0x3a')][_0x0499('0x42')]);_0x542fb5[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x52816a[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x2e3680[_0x0499('0x9a')](_0x542fb5);}})[_0x0499('0x26')](function(_0xeb3e16){return _0xeb3e16?{'count':_0x5d9b61,'rows':_0xeb3e16}:null;})['then'](respondWithResult(_0x473cf3,null))['catch'](handleError(_0x473cf3,null));};exports[_0x0499('0x9b')]=function(_0xa64028,_0x1a560c,_0xd6af9d){var _0x469478={};var _0x42ee3f={};var _0x2125c4;var _0x2d98f0;return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0xa64028[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x1a560c,null))['then'](function(_0x1aff74){if(_0x1aff74){_0x2125c4=_0x1aff74;_0x42ee3f[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x9c')][_0x0499('0x36')]);_0x42ee3f[_0x0499('0x3a')]=_['keys'](_0xa64028[_0x0499('0x3a')]);_0x42ee3f[_0x0499('0x3b')]=_['intersection'](_0x42ee3f[_0x0499('0x38')],_0x42ee3f[_0x0499('0x3a')]);_0x469478[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x42ee3f[_0x0499('0x38')],qs[_0x0499('0x3d')](_0xa64028[_0x0499('0x3a')][_0x0499('0x3d')]));_0x469478[_0x0499('0x3e')]=_0x469478[_0x0499('0x3e')][_0x0499('0x3f')]?_0x469478[_0x0499('0x3e')]:_0x42ee3f[_0x0499('0x38')];_0x469478['order']=qs['sort'](_0xa64028['query']['sort']);_0x469478['where']=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0xa64028[_0x0499('0x3a')],_0x42ee3f[_0x0499('0x3b')]));if(_0xa64028[_0x0499('0x3a')][_0x0499('0x2c')]){_0x469478[_0x0499('0x46')]=_[_0x0499('0x48')](_0x469478['where'],{'$or':_[_0x0499('0x2e')](_0x469478[_0x0499('0x3e')],function(_0x397dab){var _0x4aa6ac={};_0x4aa6ac[_0x397dab]={'$like':'%'+_0xa64028[_0x0499('0x3a')]['filter']+'%'};return _0x4aa6ac;})});}_0x469478=_[_0x0499('0x48')]({},_0x469478,_0xa64028[_0x0499('0x52')]);return _0x2125c4[_0x0499('0x9b')](_0x469478);}})[_0x0499('0x26')](function(_0x2e07a9){if(_0x2e07a9){_0x2d98f0=_0x2e07a9[_0x0499('0x3f')];if(!_0xa64028[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x469478[_0x0499('0x42')]=qs[_0x0499('0x42')](_0xa64028[_0x0499('0x3a')][_0x0499('0x42')]);_0x469478[_0x0499('0x43')]=qs[_0x0499('0x43')](_0xa64028[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x2125c4['getLists'](_0x469478);}})[_0x0499('0x26')](function(_0x1ba578){if(_0x1ba578){return _0x1ba578?{'count':_0x2d98f0,'rows':_0x1ba578}:null;}})['then'](respondWithResult(_0x1a560c,null))[_0x0499('0x4e')](handleError(_0x1a560c,null));};exports[_0x0499('0x9d')]=function(_0x56e968,_0xad1109,_0x5c502c){var _0x132557,_0x5792b5;return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x56e968[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0xad1109,null))['then'](function(_0x5b0ba5){if(_0x5b0ba5){_0x5792b5=_0x5b0ba5;return _0x5b0ba5[_0x0499('0x9d')](_0x56e968['body'][_0x0499('0x91')],_[_0x0499('0x59')](_0x56e968['body'],[_0x0499('0x91'),'id'])||{});}return null;})[_0x0499('0x96')](function(_0x649509){var _0x454f0c;_0x132557=_0x649509||[];var _0x3c87de=[];if(_0x649509){for(var _0x24f44f=0x0;_0x24f44f<_0x649509['length'];_0x24f44f+=0x1){var _0x4d9dbf=_0x649509[_0x24f44f][_0x0499('0x27')]({'plain':!![]});_0x5792b5[_0x0499('0x9e')]=_0x56e968[_0x0499('0x54')][_0x0499('0x9e')]?_0x56e968[_0x0499('0x54')][_0x0499('0x9e')]:_0x5792b5[_0x0499('0x9e')];switch(_0x5792b5[_0x0499('0x9e')]){case'always':_0x454f0c=squel['insert']()['into']('cm_hopper')[_0x0499('0x9f')]([_0x0499('0xa0'),_0x0499('0xa1'),'ContactId',_0x0499('0xa2'),_0x0499('0x62'),_0x0499('0x5a'),_0x0499('0x5b')],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),'phone')['field'](_0x0499('0xa3'),_0x0499('0xa1'))['field']('id',_0x0499('0xa4'))['field'](_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')](),_0x0499('0xa2'))[_0x0499('0x7e')](_0x56e968[_0x0499('0x50')]['id'][_0x0499('0x88')](),'VoiceQueueId')['field']('NOW()',_0x0499('0x5a'))[_0x0499('0x7e')]('NOW()',_0x0499('0x5b'))[_0x0499('0x80')]('cm_contacts')['where'](_0x0499('0xa6'))[_0x0499('0x46')](_0x0499('0xa7'),_0x4d9dbf[_0x0499('0xa5')]['toString']())[_0x0499('0x46')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x0499('0xa8'),squel[_0x0499('0x7d')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x0499('0xa9'))[_0x0499('0x46')](_0x0499('0x84'),_0x56e968['params']['id'][_0x0499('0x88')]()))[_0x0499('0x46')](_0x0499('0xa8'),squel[_0x0499('0x7d')]()[_0x0499('0x7e')]('COALESCE(phone,\x27\x27)')['from'](_0x0499('0xaa'))[_0x0499('0x46')](_0x0499('0x84'),_0x56e968['params']['id'][_0x0499('0x88')]())))[_0x0499('0x88')]();break;case _0x0499('0xab'):_0x454f0c=squel[_0x0499('0xac')]()[_0x0499('0xad')](_0x0499('0xaa'))[_0x0499('0x9f')]([_0x0499('0xa0'),_0x0499('0xa1'),_0x0499('0xa4'),_0x0499('0xa2'),_0x0499('0x62'),'createdAt','updatedAt'],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),'phone')[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0xa1'))[_0x0499('0x7e')]('id',_0x0499('0xa4'))['field'](_0x4d9dbf['CmListId'][_0x0499('0x88')](),_0x0499('0xa2'))[_0x0499('0x7e')](_0x56e968['params']['id']['toString'](),_0x0499('0x62'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5a'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5b'))[_0x0499('0x80')](_0x0499('0xae'))['where'](_0x0499('0xa6'))[_0x0499('0x46')](_0x0499('0xa7'),_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')]())[_0x0499('0x46')](_0x0499('0xaf'))[_0x0499('0x46')](_0x0499('0xa8'),squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xb0'))[_0x0499('0x80')](_0x0499('0xaa'))[_0x0499('0x46')](_0x0499('0x84'),_0x56e968[_0x0499('0x50')]['id']['toString']())))[_0x0499('0x88')]();break;default:_0x454f0c=squel[_0x0499('0xac')]()[_0x0499('0xad')]('cm_hopper')[_0x0499('0x9f')]([_0x0499('0xa0'),_0x0499('0xa1'),_0x0499('0xa4'),'ListId','VoiceQueueId',_0x0499('0x5a'),_0x0499('0x5b')],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),_0x0499('0xa0'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0xa1'))[_0x0499('0x7e')]('id',_0x0499('0xa4'))[_0x0499('0x7e')](_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')](),'ListId')[_0x0499('0x7e')](_0x56e968[_0x0499('0x50')]['id'][_0x0499('0x88')](),_0x0499('0x62'))['field']('NOW()','createdAt')[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5b'))[_0x0499('0x80')]('cm_contacts')[_0x0499('0x46')](_0x0499('0xa6'))[_0x0499('0x46')](_0x0499('0xa7'),_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')]())[_0x0499('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x0499('0x88')]();}_0x3c87de[_0x0499('0x87')](db[_0x0499('0x70')]['query'](_0x454f0c));}return BPromise['all'](_0x3c87de);}})[_0x0499('0x26')](function(){return _0x132557;})[_0x0499('0x26')](respondWithResult(_0xad1109,null))['catch'](handleError(_0xad1109,null));};exports[_0x0499('0xb1')]=function(_0x18c67a,_0x2d797b,_0x1bc708){return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x18c67a[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x2d797b,null))[_0x0499('0x26')](function(_0x882f0d){if(_0x882f0d){return _0x882f0d[_0x0499('0xb1')](_0x18c67a['query'][_0x0499('0x91')]);}})['then'](function(_0x33ecd7){if(_0x33ecd7){return db[_0x0499('0x61')]['destroy']({'where':{'ListId':_0x18c67a['query'][_0x0499('0x91')],'VoiceQueueId':_0x18c67a[_0x0499('0x50')]['id']}})[_0x0499('0x26')](function(){return _0x33ecd7;});}})['then'](respondWithStatusCode(_0x2d797b,null))['catch'](handleError(_0x2d797b,null));};exports[_0x0499('0xb2')]=function(_0x4bec1a,_0x203019,_0x3c6d22){var _0x49809f={};var _0x426f87={};var _0x55e54c;var _0x4de74e;return db[_0x0499('0x4a')]['findOne']({'where':{'id':_0x4bec1a[_0x0499('0x50')]['id']}})['then'](handleEntityNotFound(_0x203019,null))[_0x0499('0x26')](function(_0x50d878){if(_0x50d878){_0x55e54c=_0x50d878;_0x426f87[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x9c')][_0x0499('0x36')]);_0x426f87['query']=_['keys'](_0x4bec1a[_0x0499('0x3a')]);_0x426f87[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x426f87[_0x0499('0x38')],_0x426f87[_0x0499('0x3a')]);_0x49809f[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x426f87[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x4bec1a['query'][_0x0499('0x3d')]));_0x49809f[_0x0499('0x3e')]=_0x49809f['attributes'][_0x0499('0x3f')]?_0x49809f[_0x0499('0x3e')]:_0x426f87[_0x0499('0x38')];_0x49809f[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x4bec1a['query'][_0x0499('0x45')]);_0x49809f[_0x0499('0x46')]=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x4bec1a[_0x0499('0x3a')],_0x426f87[_0x0499('0x3b')]));if(_0x4bec1a[_0x0499('0x3a')][_0x0499('0x2c')]){_0x49809f[_0x0499('0x46')]=_[_0x0499('0x48')](_0x49809f[_0x0499('0x46')],{'$or':_[_0x0499('0x2e')](_0x49809f[_0x0499('0x3e')],function(_0x542164){var _0x5b3099={};_0x5b3099[_0x542164]={'$like':'%'+_0x4bec1a[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x5b3099;})});}_0x49809f=_[_0x0499('0x48')]({},_0x49809f,_0x4bec1a[_0x0499('0x52')]);return _0x55e54c[_0x0499('0xb2')](_0x49809f);}})[_0x0499('0x26')](function(_0x344697){if(_0x344697){_0x4de74e=_0x344697[_0x0499('0x3f')];if(!_0x4bec1a[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x49809f[_0x0499('0x42')]=qs['limit'](_0x4bec1a[_0x0499('0x3a')][_0x0499('0x42')]);_0x49809f[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x4bec1a[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x55e54c[_0x0499('0xb2')](_0x49809f);}})['then'](function(_0x5c6217){if(_0x5c6217){return _0x5c6217?{'count':_0x4de74e,'rows':_0x5c6217}:null;}})['then'](respondWithResult(_0x203019,null))[_0x0499('0x4e')](handleError(_0x203019,null));};exports[_0x0499('0xb3')]=function(_0x2fce7d,_0x441b0c,_0x1d2e43){var _0x31734,_0x228d94;return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x2fce7d[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x441b0c,null))[_0x0499('0x26')](function(_0x5b5c33){if(_0x5b5c33){_0x228d94=_0x5b5c33;return _0x5b5c33['addBlackLists'](_0x2fce7d['body']['ids'],_[_0x0499('0x59')](_0x2fce7d[_0x0499('0x54')],[_0x0499('0x91'),'id'])||{});}return null;})[_0x0499('0x96')](function(_0x5b0644){var _0x819386;_0x31734=_0x5b0644||[];var _0x3c5eb4=[];if(_0x5b0644){for(var _0x183f4b=0x0;_0x183f4b<_0x5b0644['length'];_0x183f4b+=0x1){var _0x3f7fd6=_0x5b0644[_0x183f4b][_0x0499('0x27')]({'plain':!![]});_0x819386=squel['insert']()['into'](_0x0499('0xb4'))['fromQuery']([_0x0499('0xa0'),_0x0499('0xa4'),_0x0499('0xa2'),_0x0499('0x62'),_0x0499('0x5a'),_0x0499('0x5b')],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),_0x0499('0xa0'))[_0x0499('0x7e')]('id','ContactId')['field'](_0x3f7fd6[_0x0499('0xa5')][_0x0499('0x88')](),'ListId')[_0x0499('0x7e')](_0x2fce7d[_0x0499('0x50')]['id'][_0x0499('0x88')](),_0x0499('0x62'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5a'))[_0x0499('0x7e')]('NOW()','updatedAt')[_0x0499('0x80')]('cm_contacts')[_0x0499('0x46')](_0x0499('0xa6'))['where'](_0x0499('0xa7'),_0x3f7fd6[_0x0499('0xa5')][_0x0499('0x88')]())[_0x0499('0x46')](_0x0499('0xaf')))[_0x0499('0x88')]();_0x3c5eb4[_0x0499('0x87')](db['sequelize']['query'](_0x819386));}return BPromise[_0x0499('0x8e')](_0x3c5eb4);}})[_0x0499('0x26')](function(){return _0x31734;})['then'](respondWithResult(_0x441b0c,null))[_0x0499('0x4e')](handleError(_0x441b0c,null));};exports['removeBlackLists']=function(_0x168395,_0x2fbbec,_0x1a2048){return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x168395['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x2fbbec,null))[_0x0499('0x26')](function(_0x33a041){if(_0x33a041){return _0x33a041[_0x0499('0xb5')](_0x168395[_0x0499('0x3a')][_0x0499('0x91')]);}})[_0x0499('0x26')](function(_0x5ea9d4){if(_0x5ea9d4){return db['CmHopperBlack'][_0x0499('0x25')]({'where':{'ListId':_0x168395[_0x0499('0x3a')][_0x0499('0x91')],'VoiceQueueId':_0x168395['params']['id']}})[_0x0499('0x26')](function(){return _0x5ea9d4;});}})[_0x0499('0x26')](respondWithStatusCode(_0x2fbbec,null))['catch'](handleError(_0x2fbbec,null));}; \ No newline at end of file +var _0x393b=['json','count','offset','limit','set','apply','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceQueue','includeAll','findAll','catch','show','rawAttributes','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','clone','omit','createdAt','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','order','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','rows','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','emit','userVoiceQueue:save','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?','toString','SELECT','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','push','format','SIP/%s','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status'];(function(_0x4b07d8,_0x379f7c){var _0x2eada4=function(_0x2387bf){while(--_0x2387bf){_0x4b07d8['push'](_0x4b07d8['shift']());}};_0x2eada4(++_0x379f7c);}(_0x393b,0x97));var _0xb393=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x393b[_0x44c768];return _0x55daf5;};'use strict';var pdf=require(_0xb393('0x0'));var emlformat=require(_0xb393('0x1'));var rimraf=require(_0xb393('0x2'));var zipdir=require(_0xb393('0x3'));var jsonpatch=require(_0xb393('0x4'));var rp=require(_0xb393('0x5'));var moment=require(_0xb393('0x6'));var BPromise=require(_0xb393('0x7'));var Mustache=require(_0xb393('0x8'));var util=require(_0xb393('0x9'));var path=require(_0xb393('0xa'));var sox=require(_0xb393('0xb'));var csv=require(_0xb393('0xc'));var ejs=require(_0xb393('0xd'));var fs=require('fs');var _=require(_0xb393('0xe'));var squel=require(_0xb393('0xf'));var crypto=require(_0xb393('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb393('0xc'));var querystring=require(_0xb393('0x11'));var Papa=require('papaparse');var Redis=require(_0xb393('0x12'));var authService=require(_0xb393('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb393('0x14'))(_0xb393('0x15'));var utils=require(_0xb393('0x16'));var config=require(_0xb393('0x17'));var licenseUtil=require(_0xb393('0x18'));var db=require(_0xb393('0x19'))['db'];config[_0xb393('0x1a')]=_['defaults'](config[_0xb393('0x1a')],{'host':_0xb393('0x1b'),'port':0x18eb});var socket=require(_0xb393('0x1c'))(new Redis(config[_0xb393('0x1a')]));require(_0xb393('0x1d'))['register'](socket);function respondWithStatusCode(_0xcaa308,_0x413afb){_0x413afb=_0x413afb||0xcc;return function(_0x22a62e){if(_0x22a62e){return _0xcaa308[_0xb393('0x1e')](_0x413afb);}return _0xcaa308['status'](_0x413afb)['end']();};}function respondWithResult(_0x33d449,_0x290565){_0x290565=_0x290565||0xc8;return function(_0x4180c3){if(_0x4180c3){return _0x33d449[_0xb393('0x1f')](_0x290565)[_0xb393('0x20')](_0x4180c3);}};}function respondWithFilteredResult(_0x2ddd78,_0x31ddc6){return function(_0x34544){if(_0x34544){var _0xc0fa9=_0x34544[_0xb393('0x21')],_0x376ee5=_0x31ddc6[_0xb393('0x22')],_0xf55450=_0x31ddc6[_0xb393('0x22')]+_0x31ddc6[_0xb393('0x23')],_0x3770db;if(_0xf55450>=_0xc0fa9){_0xf55450=_0xc0fa9;_0x3770db=0xc8;}else{_0x3770db=0xce;}_0x2ddd78['status'](_0x3770db);return _0x2ddd78[_0xb393('0x24')]('Content-Range',_0x376ee5+'-'+_0xf55450+'/'+_0xc0fa9)[_0xb393('0x20')](_0x34544);}return null;};}function patchUpdates(_0x331ebd){return function(_0x5198ab){try{jsonpatch[_0xb393('0x25')](_0x5198ab,_0x331ebd,!![]);}catch(_0x197149){return BPromise['reject'](_0x197149);}return _0x5198ab[_0xb393('0x26')]();};}function saveUpdates(_0x20d86e,_0x466d8a){return function(_0x13861d){if(_0x13861d){return _0x13861d[_0xb393('0x27')](_0x20d86e)[_0xb393('0x28')](function(_0x5403a1){return _0x5403a1;});}return null;};}function removeEntity(_0x1b3611,_0x2f26f4){return function(_0x25ee07){if(_0x25ee07){return _0x25ee07[_0xb393('0x29')]()[_0xb393('0x28')](function(){var _0x252d83=_0x25ee07['get']({'plain':!![]});var _0x1ece79=[{'name':_0xb393('0x2a'),'value':_0xb393('0x2b'),'ignore':![]},{'name':_0xb393('0x2c'),'value':'outbound','ignore':![]}];var _0x32d6bd=_(_0x1ece79)['filter'](_0xb393('0x2d'))[_0xb393('0x2e')](_0xb393('0x2f'))[_0xb393('0x2f')]();if(_[_0xb393('0x30')](_0x32d6bd,_0x252d83[_0xb393('0x31')])){return;}var _0x31a7bd=_['find'](_0x1ece79,[_0xb393('0x2f'),_0x252d83[_0xb393('0x31')]])['name'];return db[_0xb393('0x32')][_0xb393('0x29')]({'where':{'type':_0x31a7bd,'resourceId':_0x252d83['id']}})[_0xb393('0x28')](function(){return _0x25ee07;});})[_0xb393('0x28')](function(){_0x1b3611[_0xb393('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32bf1f,_0x57071b){return function(_0x31dbc9){if(!_0x31dbc9){_0x32bf1f[_0xb393('0x1e')](0x194);}return _0x31dbc9;};}function handleError(_0x51d4eb,_0x218de3){_0x218de3=_0x218de3||0x1f4;return function(_0x3ddd81){logger[_0xb393('0x33')](_0x3ddd81[_0xb393('0x34')]);if(_0x3ddd81[_0xb393('0x35')]){delete _0x3ddd81[_0xb393('0x35')];}_0x51d4eb[_0xb393('0x1f')](_0x218de3)[_0xb393('0x36')](_0x3ddd81);};}exports['index']=function(_0x3d284a,_0x438a15){var _0x41c178={},_0x4dfcbb={},_0x2a4395={'count':0x0,'rows':[]};var _0x480e22=_[_0xb393('0x2e')](db['VoiceQueue']['rawAttributes'],function(_0x3460fe){return{'name':_0x3460fe[_0xb393('0x37')],'type':_0x3460fe['type'][_0xb393('0x38')]};});_0x4dfcbb['model']=_[_0xb393('0x2e')](_0x480e22,_0xb393('0x35'));_0x4dfcbb[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x3d284a['query']);_0x4dfcbb[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0x4dfcbb[_0xb393('0x3d')],_0x4dfcbb[_0xb393('0x39')]);_0x41c178[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x4dfcbb[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x3d284a[_0xb393('0x39')]['fields']));_0x41c178[_0xb393('0x3e')]=_0x41c178[_0xb393('0x3e')][_0xb393('0x40')]?_0x41c178[_0xb393('0x3e')]:_0x4dfcbb[_0xb393('0x3d')];if(!_0x3d284a[_0xb393('0x39')][_0xb393('0x41')](_0xb393('0x42'))){_0x41c178[_0xb393('0x23')]=qs['limit'](_0x3d284a[_0xb393('0x39')]['limit']);_0x41c178[_0xb393('0x22')]=qs[_0xb393('0x22')](_0x3d284a[_0xb393('0x39')]['offset']);}_0x41c178['order']=qs['sort'](_0x3d284a[_0xb393('0x39')][_0xb393('0x43')]);_0x41c178[_0xb393('0x44')]=qs['filters'](_['pick'](_0x3d284a[_0xb393('0x39')],_0x4dfcbb['filters']),_0x480e22);if(_0x3d284a[_0xb393('0x39')][_0xb393('0x45')]){_0x41c178[_0xb393('0x44')]=_[_0xb393('0x46')](_0x41c178[_0xb393('0x44')],{'$or':_[_0xb393('0x2e')](_0x480e22,function(_0x222f39){if(_0x222f39['type']!==_0xb393('0x47')){var _0x2b882e={};_0x2b882e[_0x222f39['name']]={'$like':'%'+_0x3d284a[_0xb393('0x39')][_0xb393('0x45')]+'%'};return _0x2b882e;}})});}_0x41c178=_[_0xb393('0x46')]({},_0x41c178,_0x3d284a[_0xb393('0x48')]);var _0x5f5048={'where':_0x41c178[_0xb393('0x44')]};return db[_0xb393('0x49')]['count'](_0x5f5048)[_0xb393('0x28')](function(_0x5568cf){_0x2a4395[_0xb393('0x21')]=_0x5568cf;if(_0x3d284a[_0xb393('0x39')][_0xb393('0x4a')]){_0x41c178['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xb393('0x4b')](_0x41c178);})[_0xb393('0x28')](function(_0x559482){_0x2a4395['rows']=_0x559482;return _0x2a4395;})[_0xb393('0x28')](respondWithFilteredResult(_0x438a15,_0x41c178))[_0xb393('0x4c')](handleError(_0x438a15,null));};exports[_0xb393('0x4d')]=function(_0x50afdb,_0x2e8064){var _0x171b88={'raw':![],'where':{'id':_0x50afdb['params']['id']}},_0x1e8e27={};_0x1e8e27[_0xb393('0x3d')]=_[_0xb393('0x3a')](db[_0xb393('0x49')][_0xb393('0x4e')]);_0x1e8e27[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x50afdb[_0xb393('0x39')]);_0x1e8e27[_0xb393('0x3b')]=_['intersection'](_0x1e8e27[_0xb393('0x3d')],_0x1e8e27[_0xb393('0x39')]);_0x171b88['attributes']=_['intersection'](_0x1e8e27[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x50afdb[_0xb393('0x39')][_0xb393('0x3f')]));_0x171b88[_0xb393('0x3e')]=_0x171b88[_0xb393('0x3e')][_0xb393('0x40')]?_0x171b88[_0xb393('0x3e')]:_0x1e8e27[_0xb393('0x3d')];if(_0x50afdb[_0xb393('0x39')][_0xb393('0x4a')]){_0x171b88[_0xb393('0x4f')]=[{'all':!![]}];}_0x171b88=_['merge']({},_0x171b88,_0x50afdb['options']);return db[_0xb393('0x49')]['find'](_0x171b88)[_0xb393('0x28')](handleEntityNotFound(_0x2e8064,null))[_0xb393('0x28')](respondWithResult(_0x2e8064,null))[_0xb393('0x4c')](handleError(_0x2e8064,null));};exports[_0xb393('0x50')]=function(_0x166aa3,_0x150be9){return db['VoiceQueue'][_0xb393('0x50')](_0x166aa3[_0xb393('0x51')],{})[_0xb393('0x28')](function(_0x360cf1){var _0x194677=_0x166aa3['user'][_0xb393('0x52')]({'plain':!![]});if(!_0x194677)throw new Error(_0xb393('0x53'));if(_0x194677[_0xb393('0x54')]===_0xb393('0x55')){var _0x4db6a0=_0x360cf1['get']({'plain':!![]});var _0x56fdd5=[{'name':_0xb393('0x2a'),'value':_0xb393('0x2b')},{'name':_0xb393('0x2c'),'value':'outbound'}];var _0x3f0fa5=_['find'](_0x56fdd5,[_0xb393('0x2f'),_0x4db6a0[_0xb393('0x31')]])[_0xb393('0x35')];return db[_0xb393('0x56')][_0xb393('0x57')]({'where':{'name':_0x3f0fa5,'userProfileId':_0x194677['userProfileId']},'raw':!![]})[_0xb393('0x28')](function(_0x3f510e){if(_0x3f510e&&_0x3f510e[_0xb393('0x58')]===0x0){return db[_0xb393('0x32')][_0xb393('0x50')]({'name':_0x4db6a0[_0xb393('0x35')],'resourceId':_0x4db6a0['id'],'type':_0x3f510e[_0xb393('0x35')],'sectionId':_0x3f510e['id']},{})[_0xb393('0x28')](function(){return _0x360cf1;});}else{return _0x360cf1;}})[_0xb393('0x4c')](function(_0x38f5c3){logger[_0xb393('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38f5c3);throw _0x38f5c3;});}return _0x360cf1;})[_0xb393('0x28')](respondWithResult(_0x150be9,0xc9))[_0xb393('0x4c')](handleError(_0x150be9,null));};exports[_0xb393('0x59')]=function(_0x540df2,_0x2cdd4a){var _0x3e3742={'where':{'id':_0x540df2['params']['id']}},_0x52ded4={};_0x52ded4[_0xb393('0x3d')]=_[_0xb393('0x3a')](db['VoiceQueue']['rawAttributes']);_0x3e3742[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x52ded4[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x540df2['query']['fields']));_0x3e3742[_0xb393('0x3e')]=_0x3e3742[_0xb393('0x3e')][_0xb393('0x40')]?_0x3e3742[_0xb393('0x3e')]:_0x52ded4[_0xb393('0x3d')];if(_0x540df2[_0xb393('0x39')]['includeAll']){_0x3e3742['include']=[{'all':!![]}];}_0x3e3742=_[_0xb393('0x46')]({},_0x3e3742,_0x540df2[_0xb393('0x48')]);return db[_0xb393('0x49')]['find'](_0x3e3742)['then'](handleEntityNotFound(_0x2cdd4a,null))['then'](function(_0x38a7ad){if(_0x38a7ad){var _0x33dbfe=_0x38a7ad[_0xb393('0x52')]({'plain':!![]});_0x33dbfe=qs[_0xb393('0x5a')](_0x33dbfe,['id',_0xb393('0x5b'),'updatedAt']);_0x540df2[_0xb393('0x51')]=_[_0xb393('0x5a')](_0x540df2['body'],['id',_0xb393('0x5b'),'updatedAt']);return db['VoiceQueue'][_0xb393('0x50')](_['merge'](_0x33dbfe,_0x540df2[_0xb393('0x51')]),{'include':_0x540df2[_0xb393('0x39')]['includeAll']?[{'all':!![]}]:undefined})[_0xb393('0x28')](function(_0x56f883){var _0x16c4b1=_0x540df2['user'][_0xb393('0x52')]({'plain':!![]});if(!_0x16c4b1)throw new Error(_0xb393('0x53'));if(_0x16c4b1[_0xb393('0x54')]===_0xb393('0x55')){var _0x5c2183=_0x56f883[_0xb393('0x52')]({'plain':!![]});var _0x3c817d=[{'name':_0xb393('0x2a'),'value':_0xb393('0x2b')},{'name':_0xb393('0x2c'),'value':_0xb393('0x5c')}];var _0x36c102=_[_0xb393('0x57')](_0x3c817d,[_0xb393('0x2f'),_0x5c2183[_0xb393('0x31')]])[_0xb393('0x35')];return db[_0xb393('0x56')][_0xb393('0x57')]({'where':{'name':_0x36c102,'userProfileId':_0x16c4b1['userProfileId']},'raw':!![]})['then'](function(_0x2f4667){if(_0x2f4667&&_0x2f4667[_0xb393('0x58')]===0x0){return db[_0xb393('0x32')][_0xb393('0x50')]({'name':_0x5c2183[_0xb393('0x35')],'resourceId':_0x5c2183['id'],'type':_0x2f4667[_0xb393('0x35')],'sectionId':_0x2f4667['id']},{})[_0xb393('0x28')](function(){return _0x56f883;});}else{return _0x56f883;}})['catch'](function(_0x158960){logger[_0xb393('0x33')](_0xb393('0x5d'),_0x158960);throw _0x158960;});}return _0x56f883;});}})[_0xb393('0x28')](respondWithResult(_0x2cdd4a,0xc9))[_0xb393('0x4c')](handleError(_0x2cdd4a,null));};exports[_0xb393('0x27')]=function(_0x29c195,_0x11d944){if(_0x29c195[_0xb393('0x51')]['id']){delete _0x29c195[_0xb393('0x51')]['id'];}return db['VoiceQueue'][_0xb393('0x57')]({'where':{'id':_0x29c195['params']['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x11d944,null))['then'](saveUpdates(_0x29c195[_0xb393('0x51')],null))[_0xb393('0x28')](respondWithResult(_0x11d944,null))[_0xb393('0x4c')](handleError(_0x11d944,null));};exports[_0xb393('0x29')]=function(_0x12506e,_0x16d780){return db['VoiceQueue']['find']({'where':{'id':_0x12506e[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0x16d780,null))[_0xb393('0x28')](removeEntity(_0x16d780,null))[_0xb393('0x4c')](handleError(_0x16d780,null));};exports[_0xb393('0x5f')]=function(_0x10ed9b,_0x38e920,_0x37c2b5){var _0x3cb28d={'raw':![],'where':{}};var _0x12684b={};var _0x527ea1={'count':0x0,'rows':[]};return db[_0xb393('0x49')]['findOne']({'where':{'id':_0x10ed9b['params']['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x38e920,null))[_0xb393('0x28')](function(_0x4ae395){if(_0x4ae395){_0x12684b[_0xb393('0x3d')]=_[_0xb393('0x3a')](db['CmHopper'][_0xb393('0x4e')]);_0x12684b[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x10ed9b['query']);_0x12684b[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0x12684b['model'],_0x12684b['query']);_0x3cb28d[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x12684b[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x10ed9b[_0xb393('0x39')][_0xb393('0x3f')]));_0x3cb28d[_0xb393('0x3e')]=_0x3cb28d[_0xb393('0x3e')][_0xb393('0x40')]?_0x3cb28d['attributes']:_0x12684b['model'];if(!_0x10ed9b[_0xb393('0x39')]['hasOwnProperty'](_0xb393('0x42'))){_0x3cb28d[_0xb393('0x23')]=qs[_0xb393('0x23')](_0x10ed9b['query'][_0xb393('0x23')]);_0x3cb28d[_0xb393('0x22')]=qs[_0xb393('0x22')](_0x10ed9b['query'][_0xb393('0x22')]);}_0x3cb28d[_0xb393('0x60')]=qs[_0xb393('0x43')](_0x10ed9b[_0xb393('0x39')]['sort']);_0x3cb28d[_0xb393('0x44')]=qs[_0xb393('0x3b')](_[_0xb393('0x61')](_0x10ed9b[_0xb393('0x39')],_0x12684b[_0xb393('0x3b')]));_0x3cb28d[_0xb393('0x44')][_0xb393('0x62')]=_0x4ae395['id'];if(_0x10ed9b[_0xb393('0x39')][_0xb393('0x45')]){_0x3cb28d['where']=_['merge'](_0x3cb28d['where'],{'$or':_[_0xb393('0x2e')](_0x3cb28d[_0xb393('0x3e')],function(_0x5e2aa2){var _0x3f62e4={};_0x3f62e4[_0x5e2aa2]={'$like':'%'+_0x10ed9b[_0xb393('0x39')][_0xb393('0x45')]+'%'};return _0x3f62e4;})});}_0x3cb28d=_[_0xb393('0x46')]({},_0x3cb28d,_0x10ed9b[_0xb393('0x48')]);return db[_0xb393('0x63')]['count']({'where':_0x3cb28d[_0xb393('0x44')]})[_0xb393('0x28')](function(_0x3c4dc9){_0x527ea1['count']=_0x3c4dc9;if(_0x10ed9b[_0xb393('0x39')][_0xb393('0x4a')]){_0x3cb28d['include']=[{'all':!![]}];}return db[_0xb393('0x63')][_0xb393('0x4b')](_0x3cb28d);})[_0xb393('0x28')](function(_0x5e47fa){_0x527ea1['rows']=_0x5e47fa;return _0x527ea1;});}})[_0xb393('0x28')](respondWithFilteredResult(_0x38e920,_0x3cb28d))[_0xb393('0x4c')](handleError(_0x38e920,null));};exports[_0xb393('0x64')]=function(_0x1323a0,_0x411d0a,_0x7adaf3){var _0x1d6889={'raw':!![],'where':{}};var _0x55ab15={};var _0x1d7b9f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1323a0[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0x411d0a,null))['then'](function(_0x3ea8af){if(_0x3ea8af){_0x55ab15['model']=_['keys'](db[_0xb393('0x65')][_0xb393('0x4e')]);_0x55ab15['query']=_[_0xb393('0x3a')](_0x1323a0['query']);_0x55ab15[_0xb393('0x3b')]=_['intersection'](_0x55ab15[_0xb393('0x3d')],_0x55ab15[_0xb393('0x39')]);_0x1d6889[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x55ab15[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x1323a0[_0xb393('0x39')][_0xb393('0x3f')]));_0x1d6889[_0xb393('0x3e')]=_0x1d6889[_0xb393('0x3e')][_0xb393('0x40')]?_0x1d6889[_0xb393('0x3e')]:_0x55ab15[_0xb393('0x3d')];if(!_0x1323a0[_0xb393('0x39')][_0xb393('0x41')](_0xb393('0x42'))){_0x1d6889[_0xb393('0x23')]=qs['limit'](_0x1323a0[_0xb393('0x39')][_0xb393('0x23')]);_0x1d6889['offset']=qs[_0xb393('0x22')](_0x1323a0[_0xb393('0x39')]['offset']);}_0x1d6889[_0xb393('0x60')]=qs[_0xb393('0x43')](_0x1323a0[_0xb393('0x39')][_0xb393('0x43')]);_0x1d6889['where']=qs[_0xb393('0x3b')](_[_0xb393('0x61')](_0x1323a0[_0xb393('0x39')],_0x55ab15[_0xb393('0x3b')]));_0x1d6889['where'][_0xb393('0x62')]=_0x3ea8af['id'];if(_0x1323a0[_0xb393('0x39')][_0xb393('0x45')]){_0x1d6889[_0xb393('0x44')]=_[_0xb393('0x46')](_0x1d6889[_0xb393('0x44')],{'$or':_[_0xb393('0x2e')](_0x1d6889['attributes'],function(_0x3ebf4f){var _0x24e788={};_0x24e788[_0x3ebf4f]={'$like':'%'+_0x1323a0[_0xb393('0x39')][_0xb393('0x45')]+'%'};return _0x24e788;})});}_0x1d6889=_[_0xb393('0x46')]({},_0x1d6889,_0x1323a0['options']);return db[_0xb393('0x65')][_0xb393('0x21')]({'where':_0x1d6889[_0xb393('0x44')]})[_0xb393('0x28')](function(_0x3be61d){_0x1d7b9f[_0xb393('0x21')]=_0x3be61d;if(_0x1323a0[_0xb393('0x39')][_0xb393('0x4a')]){_0x1d6889[_0xb393('0x4f')]=[{'all':!![]}];}return db[_0xb393('0x65')]['findAll'](_0x1d6889);})[_0xb393('0x28')](function(_0x28c00b){_0x1d7b9f[_0xb393('0x66')]=_0x28c00b;return _0x1d7b9f;});}})[_0xb393('0x28')](respondWithFilteredResult(_0x411d0a,_0x1d6889))[_0xb393('0x4c')](handleError(_0x411d0a,null));};exports['getHopperFinals']=function(_0x332005,_0x47ecc2,_0x41bac3){var _0x231c9b={'raw':!![],'where':{}};var _0x434c0b={};var _0xb4c029={'count':0x0,'rows':[]};return db[_0xb393('0x49')][_0xb393('0x67')]({'where':{'id':_0x332005[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x47ecc2,null))['then'](function(_0x3db029){if(_0x3db029){_0x434c0b[_0xb393('0x3d')]=_[_0xb393('0x3a')](db['CmHopperFinal'][_0xb393('0x4e')]);_0x434c0b['query']=_[_0xb393('0x3a')](_0x332005[_0xb393('0x39')]);_0x434c0b[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0x434c0b['model'],_0x434c0b['query']);_0x231c9b[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x434c0b[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x332005['query'][_0xb393('0x3f')]));_0x231c9b[_0xb393('0x3e')]=_0x231c9b[_0xb393('0x3e')]['length']?_0x231c9b[_0xb393('0x3e')]:_0x434c0b[_0xb393('0x3d')];if(!_0x332005['query'][_0xb393('0x41')](_0xb393('0x42'))){_0x231c9b[_0xb393('0x23')]=qs[_0xb393('0x23')](_0x332005[_0xb393('0x39')][_0xb393('0x23')]);_0x231c9b[_0xb393('0x22')]=qs[_0xb393('0x22')](_0x332005['query'][_0xb393('0x22')]);}_0x231c9b[_0xb393('0x60')]=qs[_0xb393('0x43')](_0x332005[_0xb393('0x39')][_0xb393('0x43')]);_0x231c9b[_0xb393('0x44')]=qs['filters'](_['pick'](_0x332005[_0xb393('0x39')],_0x434c0b[_0xb393('0x3b')]));_0x231c9b[_0xb393('0x44')][_0xb393('0x62')]=_0x3db029['id'];if(_0x332005[_0xb393('0x39')]['filter']){_0x231c9b[_0xb393('0x44')]=_[_0xb393('0x46')](_0x231c9b['where'],{'$or':_[_0xb393('0x2e')](_0x231c9b['attributes'],function(_0x55328c){var _0x1ca382={};_0x1ca382[_0x55328c]={'$like':'%'+_0x332005[_0xb393('0x39')][_0xb393('0x45')]+'%'};return _0x1ca382;})});}_0x231c9b=_[_0xb393('0x46')]({},_0x231c9b,_0x332005[_0xb393('0x48')]);return db['CmHopperFinal'][_0xb393('0x21')]({'where':_0x231c9b[_0xb393('0x44')]})[_0xb393('0x28')](function(_0x571cb2){_0xb4c029['count']=_0x571cb2;if(_0x332005['query'][_0xb393('0x4a')]){_0x231c9b[_0xb393('0x4f')]=[{'all':!![]}];}return db[_0xb393('0x68')][_0xb393('0x4b')](_0x231c9b);})['then'](function(_0x75ae24){_0xb4c029[_0xb393('0x66')]=_0x75ae24;return _0xb4c029;});}})[_0xb393('0x28')](respondWithFilteredResult(_0x47ecc2,_0x231c9b))[_0xb393('0x4c')](handleError(_0x47ecc2,null));};exports[_0xb393('0x69')]=function(_0x7ebf69,_0x368bc9,_0x514588){var _0x1f3ff0={'raw':!![],'where':{}};var _0x51a715={};var _0x34756a={'count':0x0,'rows':[]};return db[_0xb393('0x49')][_0xb393('0x67')]({'where':{'id':_0x7ebf69[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0x368bc9,null))[_0xb393('0x28')](function(_0x3afe2c){if(_0x3afe2c){_0x51a715[_0xb393('0x3d')]=_[_0xb393('0x3a')](db[_0xb393('0x6a')][_0xb393('0x4e')]);_0x51a715[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x7ebf69['query']);_0x51a715[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0x51a715[_0xb393('0x3d')],_0x51a715['query']);_0x1f3ff0[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x51a715[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x7ebf69[_0xb393('0x39')]['fields']));_0x1f3ff0[_0xb393('0x3e')]=_0x1f3ff0[_0xb393('0x3e')][_0xb393('0x40')]?_0x1f3ff0['attributes']:_0x51a715[_0xb393('0x3d')];if(!_0x7ebf69[_0xb393('0x39')]['hasOwnProperty'](_0xb393('0x42'))){_0x1f3ff0[_0xb393('0x23')]=qs[_0xb393('0x23')](_0x7ebf69[_0xb393('0x39')][_0xb393('0x23')]);_0x1f3ff0[_0xb393('0x22')]=qs[_0xb393('0x22')](_0x7ebf69[_0xb393('0x39')][_0xb393('0x22')]);}_0x1f3ff0['order']=qs['sort'](_0x7ebf69[_0xb393('0x39')][_0xb393('0x43')]);_0x1f3ff0['where']=qs[_0xb393('0x3b')](_[_0xb393('0x61')](_0x7ebf69[_0xb393('0x39')],_0x51a715[_0xb393('0x3b')]));_0x1f3ff0[_0xb393('0x44')][_0xb393('0x62')]=_0x3afe2c['id'];if(_0x7ebf69[_0xb393('0x39')][_0xb393('0x45')]){_0x1f3ff0['where']=_[_0xb393('0x46')](_0x1f3ff0['where'],{'$or':_[_0xb393('0x2e')](_0x1f3ff0['attributes'],function(_0x5052ef){var _0x35a2a0={};_0x35a2a0[_0x5052ef]={'$like':'%'+_0x7ebf69[_0xb393('0x39')]['filter']+'%'};return _0x35a2a0;})});}_0x1f3ff0=_['merge']({},_0x1f3ff0,_0x7ebf69[_0xb393('0x48')]);return db[_0xb393('0x6a')][_0xb393('0x21')]({'where':_0x1f3ff0['where']})[_0xb393('0x28')](function(_0x1e9252){_0x34756a[_0xb393('0x21')]=_0x1e9252;if(_0x7ebf69[_0xb393('0x39')][_0xb393('0x4a')]){_0x1f3ff0[_0xb393('0x4f')]=[{'all':!![]}];}return db[_0xb393('0x6a')][_0xb393('0x4b')](_0x1f3ff0);})[_0xb393('0x28')](function(_0x5b8748){_0x34756a[_0xb393('0x66')]=_0x5b8748;return _0x34756a;});}})[_0xb393('0x28')](respondWithFilteredResult(_0x368bc9,_0x1f3ff0))[_0xb393('0x4c')](handleError(_0x368bc9,null));};exports[_0xb393('0x6b')]=function(_0x30dba2,_0x50b5f1,_0x4e42ae){var _0x41986d={};var _0x12c5dc={};var _0x1b5020;var _0x5a6636;return db[_0xb393('0x49')][_0xb393('0x67')]({'where':{'id':_0x30dba2[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0x50b5f1,null))['then'](function(_0x592033){if(_0x592033){_0x1b5020=_0x592033;_0x12c5dc[_0xb393('0x3d')]=_[_0xb393('0x3a')](db['Team'][_0xb393('0x4e')]);_0x12c5dc['query']=_[_0xb393('0x3a')](_0x30dba2[_0xb393('0x39')]);_0x12c5dc[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0x12c5dc['model'],_0x12c5dc['query']);_0x41986d[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x12c5dc['model'],qs[_0xb393('0x3f')](_0x30dba2[_0xb393('0x39')][_0xb393('0x3f')]));_0x41986d['attributes']=_0x41986d['attributes']['length']?_0x41986d[_0xb393('0x3e')]:_0x12c5dc['model'];_0x41986d[_0xb393('0x60')]=qs[_0xb393('0x43')](_0x30dba2[_0xb393('0x39')][_0xb393('0x43')]);_0x41986d[_0xb393('0x44')]=qs[_0xb393('0x3b')](_[_0xb393('0x61')](_0x30dba2[_0xb393('0x39')],_0x12c5dc[_0xb393('0x3b')]));if(_0x30dba2[_0xb393('0x39')][_0xb393('0x45')]){_0x41986d[_0xb393('0x44')]=_[_0xb393('0x46')](_0x41986d[_0xb393('0x44')],{'$or':_[_0xb393('0x2e')](_0x41986d[_0xb393('0x3e')],function(_0x37b388){var _0x2890fb={};_0x2890fb[_0x37b388]={'$like':'%'+_0x30dba2['query'][_0xb393('0x45')]+'%'};return _0x2890fb;})});}_0x41986d=_[_0xb393('0x46')]({},_0x41986d,_0x30dba2['options']);return _0x1b5020[_0xb393('0x6b')](_0x41986d);}})[_0xb393('0x28')](function(_0x14b50f){if(_0x14b50f){_0x5a6636=_0x14b50f['length'];if(!_0x30dba2[_0xb393('0x39')]['hasOwnProperty'](_0xb393('0x42'))){_0x41986d[_0xb393('0x23')]=qs['limit'](_0x30dba2[_0xb393('0x39')]['limit']);_0x41986d['offset']=qs[_0xb393('0x22')](_0x30dba2[_0xb393('0x39')][_0xb393('0x22')]);}return _0x1b5020[_0xb393('0x6b')](_0x41986d);}})[_0xb393('0x28')](function(_0x66ae05){if(_0x66ae05){return _0x66ae05?{'count':_0x5a6636,'rows':_0x66ae05}:null;}})[_0xb393('0x28')](respondWithResult(_0x50b5f1,null))['catch'](handleError(_0x50b5f1,null));};exports[_0xb393('0x6c')]=function(_0x2a70e3,_0x481d7c,_0x46709f){var _0x48da15=_0x2a70e3['body'][_0xb393('0x6d')];var _0x4e5419=_[_0xb393('0x2e')](_0x48da15,'id');return db[_0xb393('0x6e')][_0xb393('0x4b')]({'where':{'id':_0x4e5419},'attributes':['id'],'include':[{'model':db[_0xb393('0x6f')],'as':_0xb393('0x70'),'attributes':['id',_0xb393('0x35'),_0xb393('0x71'),_0xb393('0x72'),_0xb393('0x73')],'raw':!![]}]})[_0xb393('0x28')](function(_0x1b1b2b){if(_0x1b1b2b){var _0x32829d=_['flatMap'](_0x1b1b2b,function(_0x230016){var _0x260335=_0x230016['get']({'plain':!![]});_0x260335[_0xb393('0x70')][_0xb393('0x74')](function(_0x5ca6cd){_0x5ca6cd[_0xb393('0x75')]=_[_0xb393('0x57')](_0x48da15,{'id':_0x260335['id']})['penalty'];});return _0x260335[_0xb393('0x70')];});return db[_0xb393('0x49')][_0xb393('0x57')]({'where':{'id':_0x2a70e3[_0xb393('0x5e')]['id']}})['then'](function(_0x28f71d){return db[_0xb393('0x76')][_0xb393('0x77')](function(_0x317399){return _0x28f71d[_0xb393('0x6c')](_0x4e5419,{'transaction':_0x317399})['then'](function(){return BPromise[_0xb393('0x78')](_0x48da15,function(_0x2f3aa1){return db['TeamVoiceQueue'][_0xb393('0x79')]({'TeamId':_0x2f3aa1['id'],'VoiceQueueId':_0x2a70e3[_0xb393('0x5e')]['id'],'penalty':_0x2f3aa1[_0xb393('0x75')]},{'transaction':_0x317399});});})[_0xb393('0x28')](function(){return BPromise[_0xb393('0x78')](_0x32829d,function(_0x55d50e){return db[_0xb393('0x7a')][_0xb393('0x7b')]({'where':{'UserId':_0x55d50e['id'],'VoiceQueueId':_0x2a70e3[_0xb393('0x5e')]['id']},'defaults':{'penalty':_0x55d50e[_0xb393('0x75')]},'transaction':_0x317399});});})[_0xb393('0x28')](function(){return BPromise['each'](_[_0xb393('0x45')](_0x32829d,{'online':!![]}),function(_0xda2c91){return db[_0xb393('0x7c')][_0xb393('0x79')]({'membername':_0xda2c91[_0xb393('0x35')],'UserId':_0xda2c91['id'],'queue_name':_0x28f71d[_0xb393('0x35')],'VoiceQueueId':_0x28f71d['id'],'interface':_[_0xb393('0x7d')](_0xda2c91[_0xb393('0x73')])?util['format']('SIP/%s',_0xda2c91['name']):_0xda2c91['interface'],'paused':_0xda2c91[_0xb393('0x72')]||![],'penalty':_0xda2c91[_0xb393('0x75')]},{'transaction':_0x317399});});})[_0xb393('0x28')](function(){_0x32829d[_0xb393('0x74')](function(_0x3fdb4f){socket[_0xb393('0x7e')](_0xb393('0x7f'),{'UserId':_0x3fdb4f['id'],'VoiceQueueId':_0x28f71d['id']});});});});});}})[_0xb393('0x28')](respondWithStatusCode(_0x481d7c,null))[_0xb393('0x4c')](handleError(_0x481d7c,null));};exports['removeTeams']=function(_0x301c46,_0x5e2d5b,_0x291451){return db['Team'][_0xb393('0x4b')]({'where':{'id':_0x301c46[_0xb393('0x39')][_0xb393('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb393('0x70'),'attributes':['id'],'raw':!![]}]})[_0xb393('0x28')](handleEntityNotFound(_0x5e2d5b,null))[_0xb393('0x28')](function(_0x42c26c){var _0x48be64=_[_0xb393('0x2e')](_0x42c26c,'id');var _0x55afe6=[];var _0x2a0243=[];var _0x4412ec=squel[_0xb393('0x81')]();_0x4412ec[_0xb393('0x82')](_0xb393('0x83'))['from'](_0xb393('0x84'),'tq')[_0xb393('0x85')](_0xb393('0x86'),'ut',_0xb393('0x87'))['where'](_0xb393('0x88'),_0x301c46[_0xb393('0x5e')]['id']);for(var _0x3aa9b4=0x0;_0x3aa9b4<_0x42c26c[_0xb393('0x40')];_0x3aa9b4+=0x1){let _0x1dd99d=_0x42c26c[_0x3aa9b4];for(var _0x59dc2f=0x0;_0x59dc2f<_0x1dd99d[_0xb393('0x70')][_0xb393('0x40')];_0x59dc2f+=0x1){let _0x15eb3b=_0x1dd99d[_0xb393('0x70')][_0x59dc2f];var _0x43ecd0=_0x4412ec[_0xb393('0x59')]();_0x43ecd0[_0xb393('0x44')](_0xb393('0x89'),_0x15eb3b['id']);_0x2a0243['push'](db[_0xb393('0x76')]['query'](_0x43ecd0[_0xb393('0x8a')](),{'type':db[_0xb393('0x76')]['QueryTypes'][_0xb393('0x8b')]})[_0xb393('0x28')](function(_0x3c43bd){if(_0x3c43bd[_0xb393('0x40')]===0x1){return _0x15eb3b['id'];}else{var _0xee6ecd=_['every'](_['map'](_0x3c43bd,_0xb393('0x8c')),function(_0x104fcd){return _['includes'](_0x48be64,_0x104fcd);});if(_0xee6ecd){return _0x15eb3b['id'];}}}));}}return BPromise[_0xb393('0x8d')](_0x2a0243)['then'](function(_0x597730){_0x55afe6=_(_0x55afe6)[_0xb393('0x8e')](_0x597730)[_0xb393('0x8f')]()[_0xb393('0x2f')]();return db[_0xb393('0x49')][_0xb393('0x57')]({'where':{'id':_0x301c46[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](function(_0x39f85b){return db[_0xb393('0x76')][_0xb393('0x77')](function(_0x4de0fb){return _0x39f85b[_0xb393('0x90')](_0x301c46['query']['ids'],{'transaction':_0x4de0fb})[_0xb393('0x28')](function(){if(!_[_0xb393('0x91')](_0x55afe6)){return _0x39f85b[_0xb393('0x92')](_0x55afe6,{'transaction':_0x4de0fb})[_0xb393('0x28')](function(){return db['UserVoiceQueueRt'][_0xb393('0x29')]({'where':{'VoiceQueueId':_0x301c46['params']['id'],'UserId':_0x55afe6},'transaction':_0x4de0fb});});}})[_0xb393('0x28')](function(){_0x55afe6[_0xb393('0x74')](function(_0x3dc43e){socket[_0xb393('0x7e')]('userVoiceQueue:remove',{'UserId':_0x3dc43e,'VoiceQueueId':_0x39f85b['id']});});});});});});})[_0xb393('0x28')](respondWithStatusCode(_0x5e2d5b,null))['catch'](handleError(_0x5e2d5b,null));};exports[_0xb393('0x93')]=function(_0x511e18,_0x471df3,_0x87bc9){var _0x13aae1,_0xfd024b;return db[_0xb393('0x49')]['find']({'where':{'id':_0x511e18[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0x471df3,null))['then'](function(_0x1122e8){if(_0x1122e8){_0xfd024b=_0x1122e8;return _0x1122e8[_0xb393('0x93')](_0x511e18[_0xb393('0x51')][_0xb393('0x80')],_[_0xb393('0x5a')](_0x511e18[_0xb393('0x51')],[_0xb393('0x80'),'id'])||{})[_0xb393('0x94')](function(_0x5a7dc8){for(var _0x4e08be=0x0;_0x4e08be<_0x511e18[_0xb393('0x51')][_0xb393('0x80')]['length'];_0x4e08be+=0x1){socket[_0xb393('0x7e')](_0xb393('0x7f'),{'UserId':_0x511e18[_0xb393('0x51')]['ids'][_0x4e08be],'VoiceQueueId':_0x511e18['params']['id']});}return _0x5a7dc8;});}})[_0xb393('0x28')](function(_0x505e3c){_0x13aae1=_0x505e3c||[];if(_0xfd024b){return db[_0xb393('0x6f')][_0xb393('0x4b')]({'where':{'id':_0x511e18['body'][_0xb393('0x80')]},'attributes':['id','name',_0xb393('0x71'),_0xb393('0x72'),'interface'],'raw':!![]});}})[_0xb393('0x28')](function(_0xc5be2b){if(!_[_0xb393('0x91')](_0xc5be2b)){var _0x3ef40e=[];for(var _0x838a65=0x0;_0x838a65<_0xc5be2b[_0xb393('0x40')];_0x838a65++){if(_0xc5be2b[_0x838a65]['online']){_0x3ef40e[_0xb393('0x95')](db[_0xb393('0x7c')]['upsert']({'membername':_0xc5be2b[_0x838a65]['name'],'UserId':_0xc5be2b[_0x838a65]['id'],'queue_name':_0xfd024b['name'],'VoiceQueueId':_0xfd024b['id'],'interface':_[_0xb393('0x7d')](_0xc5be2b[_0x838a65]['interface'])?util[_0xb393('0x96')](_0xb393('0x97'),_0xc5be2b[_0x838a65]['name']):_0xc5be2b[_0x838a65][_0xb393('0x73')],'paused':_0xc5be2b[_0x838a65][_0xb393('0x72')]||![],'penalty':_0x511e18[_0xb393('0x51')][_0xb393('0x75')]||0x0}));}}return BPromise[_0xb393('0x8d')](_0x3ef40e);}})[_0xb393('0x28')](function(){return _0x13aae1;})['then'](respondWithResult(_0x471df3,null))[_0xb393('0x4c')](handleError(_0x471df3,null));};exports[_0xb393('0x92')]=function(_0xa8b888,_0x3836b2,_0x6b1f59){return db[_0xb393('0x49')][_0xb393('0x57')]({'where':{'id':_0xa8b888[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x3836b2,null))[_0xb393('0x28')](function(_0x4492ae){if(_0x4492ae){return _0x4492ae['removeAgents'](_0xa8b888[_0xb393('0x39')]['ids'])[_0xb393('0x28')](function(){if(_[_0xb393('0x98')](_0xa8b888[_0xb393('0x39')]['ids'])){for(var _0x4ec18e=0x0;_0x4ec18e<_0xa8b888[_0xb393('0x39')]['ids']['length'];_0x4ec18e+=0x1){socket['emit'](_0xb393('0x99'),{'UserId':Number(_0xa8b888['query'][_0xb393('0x80')][_0x4ec18e]),'VoiceQueueId':Number(_0xa8b888['params']['id'])});}}else{socket[_0xb393('0x7e')](_0xb393('0x99'),{'UserId':Number(_0xa8b888['query'][_0xb393('0x80')]),'VoiceQueueId':Number(_0xa8b888[_0xb393('0x5e')]['id'])});}});}})[_0xb393('0x28')](function(_0x43d7dc){return db[_0xb393('0x7c')][_0xb393('0x29')]({'where':{'VoiceQueueId':_0xa8b888[_0xb393('0x5e')]['id'],'UserId':_0xa8b888[_0xb393('0x39')][_0xb393('0x80')]}})[_0xb393('0x28')](function(){return _0x43d7dc;});})[_0xb393('0x28')](respondWithStatusCode(_0x3836b2,null))[_0xb393('0x4c')](handleError(_0x3836b2,null));};exports[_0xb393('0x9a')]=function(_0x2214f9,_0x3f7802,_0x1e9330){var _0x2e67dc={};var _0x2f88a2={};var _0x322d6f;var _0x1e65b7;return db[_0xb393('0x49')]['findOne']({'where':{'id':_0x2214f9[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x3f7802,null))[_0xb393('0x28')](function(_0xa9e40f){if(_0xa9e40f){_0x322d6f=_0xa9e40f;_0x2f88a2[_0xb393('0x3d')]=_['keys'](db[_0xb393('0x6f')][_0xb393('0x4e')]);_0x2f88a2[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x2214f9['query']);_0x2f88a2[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0x2f88a2[_0xb393('0x3d')],_0x2f88a2[_0xb393('0x39')]);_0x2e67dc[_0xb393('0x3e')]=_['intersection'](_0x2f88a2[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x2214f9[_0xb393('0x39')][_0xb393('0x3f')]));_0x2e67dc[_0xb393('0x3e')]=_0x2e67dc['attributes'][_0xb393('0x40')]?_0x2e67dc[_0xb393('0x3e')]:_0x2f88a2['model'];_0x2e67dc[_0xb393('0x60')]=qs[_0xb393('0x43')](_0x2214f9[_0xb393('0x39')][_0xb393('0x43')]);_0x2e67dc[_0xb393('0x44')]=qs[_0xb393('0x3b')](_[_0xb393('0x61')](_0x2214f9[_0xb393('0x39')],_0x2f88a2[_0xb393('0x3b')]));if(_0x2214f9['query'][_0xb393('0x45')]){_0x2e67dc['where']=_[_0xb393('0x46')](_0x2e67dc[_0xb393('0x44')],{'$or':_[_0xb393('0x2e')](_0x2e67dc[_0xb393('0x3e')],function(_0x2d2ca7){var _0x47c6da={};_0x47c6da[_0x2d2ca7]={'$like':'%'+_0x2214f9[_0xb393('0x39')][_0xb393('0x45')]+'%'};return _0x47c6da;})});}_0x2e67dc=_['merge']({},_0x2e67dc,_0x2214f9[_0xb393('0x48')]);return _0x322d6f[_0xb393('0x9a')](_0x2e67dc);}})[_0xb393('0x28')](function(_0x25425e){if(_0x25425e){_0x1e65b7=_0x25425e[_0xb393('0x40')];if(!_0x2214f9[_0xb393('0x39')][_0xb393('0x41')](_0xb393('0x42'))){_0x2e67dc[_0xb393('0x23')]=qs[_0xb393('0x23')](_0x2214f9['query'][_0xb393('0x23')]);_0x2e67dc[_0xb393('0x22')]=qs[_0xb393('0x22')](_0x2214f9['query'][_0xb393('0x22')]);}return _0x322d6f[_0xb393('0x9a')](_0x2e67dc);}})[_0xb393('0x28')](function(_0x50acb2){if(_0x50acb2){return _0x50acb2?{'count':_0x1e65b7,'rows':_0x50acb2}:null;}})[_0xb393('0x28')](respondWithResult(_0x3f7802,null))[_0xb393('0x4c')](handleError(_0x3f7802,null));};exports[_0xb393('0x9b')]=function(_0x5802a0,_0x4fd994,_0x270804){var _0x37d882={};var _0x42221f={};var _0x4cd0ca;var _0x31e419;return db[_0xb393('0x49')][_0xb393('0x67')]({'where':{'id':_0x5802a0[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x4fd994,null))[_0xb393('0x28')](function(_0x4286a1){if(_0x4286a1){_0x4cd0ca=_0x4286a1;_0x42221f[_0xb393('0x3d')]=_[_0xb393('0x3a')](db['UserVoiceQueueRt'][_0xb393('0x4e')]);_0x42221f[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x5802a0[_0xb393('0x39')]);_0x42221f[_0xb393('0x3b')]=_['intersection'](_0x42221f[_0xb393('0x3d')],_0x42221f[_0xb393('0x39')]);_0x37d882['attributes']=_[_0xb393('0x3c')](_0x42221f[_0xb393('0x3d')],qs['fields'](_0x5802a0['query'][_0xb393('0x3f')]));_0x37d882['attributes']=_0x37d882[_0xb393('0x3e')][_0xb393('0x40')]?_0x37d882[_0xb393('0x3e')]:_0x42221f[_0xb393('0x3d')];_0x37d882[_0xb393('0x60')]=qs['sort'](_0x5802a0[_0xb393('0x39')][_0xb393('0x43')]);_0x37d882['where']=qs['filters'](_['pick'](_0x5802a0[_0xb393('0x39')],_0x42221f[_0xb393('0x3b')]));if(_0x5802a0['query'][_0xb393('0x45')]){_0x37d882[_0xb393('0x44')]=_[_0xb393('0x46')](_0x37d882['where'],{'$or':_[_0xb393('0x2e')](_0x37d882['attributes'],function(_0x343b03){var _0x4ac4e9={};_0x4ac4e9[_0x343b03]={'$like':'%'+_0x5802a0[_0xb393('0x39')]['filter']+'%'};return _0x4ac4e9;})});}_0x37d882=_[_0xb393('0x46')]({},_0x37d882,_0x5802a0[_0xb393('0x48')]);return _0x4cd0ca[_0xb393('0x9b')](_0x37d882);}})[_0xb393('0x28')](function(_0x4ca685){if(_0x4ca685){_0x31e419=_0x4ca685['length'];if(!_0x5802a0[_0xb393('0x39')]['hasOwnProperty']('nolimit')){_0x37d882[_0xb393('0x23')]=qs[_0xb393('0x23')](_0x5802a0['query'][_0xb393('0x23')]);_0x37d882[_0xb393('0x22')]=qs[_0xb393('0x22')](_0x5802a0[_0xb393('0x39')]['offset']);}return _0x4cd0ca[_0xb393('0x9b')](_0x37d882);}})[_0xb393('0x28')](function(_0x563685){return _0x563685?{'count':_0x31e419,'rows':_0x563685}:null;})[_0xb393('0x28')](respondWithResult(_0x4fd994,null))[_0xb393('0x4c')](handleError(_0x4fd994,null));};exports['getLists']=function(_0x532190,_0x39c559,_0x4eaf15){var _0x2b330d={};var _0xd67292={};var _0x5ead19;var _0x2f93db;return db[_0xb393('0x49')][_0xb393('0x67')]({'where':{'id':_0x532190[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x39c559,null))[_0xb393('0x28')](function(_0x2fe39d){if(_0x2fe39d){_0x5ead19=_0x2fe39d;_0xd67292['model']=_['keys'](db[_0xb393('0x9c')][_0xb393('0x4e')]);_0xd67292[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x532190[_0xb393('0x39')]);_0xd67292[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0xd67292[_0xb393('0x3d')],_0xd67292[_0xb393('0x39')]);_0x2b330d[_0xb393('0x3e')]=_['intersection'](_0xd67292[_0xb393('0x3d')],qs['fields'](_0x532190[_0xb393('0x39')]['fields']));_0x2b330d[_0xb393('0x3e')]=_0x2b330d[_0xb393('0x3e')]['length']?_0x2b330d[_0xb393('0x3e')]:_0xd67292['model'];_0x2b330d[_0xb393('0x60')]=qs[_0xb393('0x43')](_0x532190[_0xb393('0x39')][_0xb393('0x43')]);_0x2b330d[_0xb393('0x44')]=qs[_0xb393('0x3b')](_[_0xb393('0x61')](_0x532190[_0xb393('0x39')],_0xd67292[_0xb393('0x3b')]));if(_0x532190[_0xb393('0x39')]['filter']){_0x2b330d['where']=_['merge'](_0x2b330d[_0xb393('0x44')],{'$or':_['map'](_0x2b330d[_0xb393('0x3e')],function(_0x23d1f9){var _0x17756d={};_0x17756d[_0x23d1f9]={'$like':'%'+_0x532190[_0xb393('0x39')]['filter']+'%'};return _0x17756d;})});}_0x2b330d=_[_0xb393('0x46')]({},_0x2b330d,_0x532190[_0xb393('0x48')]);return _0x5ead19[_0xb393('0x9d')](_0x2b330d);}})[_0xb393('0x28')](function(_0x529296){if(_0x529296){_0x2f93db=_0x529296[_0xb393('0x40')];if(!_0x532190['query'][_0xb393('0x41')](_0xb393('0x42'))){_0x2b330d[_0xb393('0x23')]=qs[_0xb393('0x23')](_0x532190[_0xb393('0x39')][_0xb393('0x23')]);_0x2b330d['offset']=qs[_0xb393('0x22')](_0x532190['query']['offset']);}return _0x5ead19[_0xb393('0x9d')](_0x2b330d);}})[_0xb393('0x28')](function(_0x1730a9){if(_0x1730a9){return _0x1730a9?{'count':_0x2f93db,'rows':_0x1730a9}:null;}})['then'](respondWithResult(_0x39c559,null))['catch'](handleError(_0x39c559,null));};exports[_0xb393('0x9e')]=function(_0x520585,_0x1e1479,_0x3d52d0){var _0x435feb,_0x3d8091;return db[_0xb393('0x49')][_0xb393('0x57')]({'where':{'id':_0x520585[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x1e1479,null))[_0xb393('0x28')](function(_0x205059){if(_0x205059){_0x3d8091=_0x205059;return _0x205059[_0xb393('0x9e')](_0x520585[_0xb393('0x51')][_0xb393('0x80')],_[_0xb393('0x5a')](_0x520585[_0xb393('0x51')],['ids','id'])||{});}return null;})[_0xb393('0x94')](function(_0x1df4d5){var _0x24b255;_0x435feb=_0x1df4d5||[];var _0x448923=[];if(_0x1df4d5){for(var _0x21764e=0x0;_0x21764e<_0x1df4d5[_0xb393('0x40')];_0x21764e+=0x1){var _0x4212a5=_0x1df4d5[_0x21764e][_0xb393('0x52')]({'plain':!![]});_0x3d8091[_0xb393('0x9f')]=_0x520585['body'][_0xb393('0x9f')]?_0x520585['body']['dialCheckDuplicateType']:_0x3d8091[_0xb393('0x9f')];switch(_0x3d8091[_0xb393('0x9f')]){case'always':_0x24b255=squel[_0xb393('0xa0')]()[_0xb393('0xa1')](_0xb393('0xa2'))[_0xb393('0xa3')]([_0xb393('0xa4'),_0xb393('0xa5'),_0xb393('0xa6'),'ListId','VoiceQueueId',_0xb393('0x5b'),'updatedAt'],squel[_0xb393('0x81')]()[_0xb393('0x82')](_0xb393('0xa4'),'phone')[_0xb393('0x82')](_0xb393('0xa7'),_0xb393('0xa5'))[_0xb393('0x82')]('id',_0xb393('0xa6'))[_0xb393('0x82')](_0x4212a5[_0xb393('0xa8')][_0xb393('0x8a')](),_0xb393('0xa9'))[_0xb393('0x82')](_0x520585[_0xb393('0x5e')]['id'][_0xb393('0x8a')](),_0xb393('0x62'))['field'](_0xb393('0xa7'),'createdAt')[_0xb393('0x82')](_0xb393('0xa7'),_0xb393('0xaa'))[_0xb393('0xab')](_0xb393('0xac'))[_0xb393('0x44')](_0xb393('0xad'))[_0xb393('0x44')]('ListId\x20=\x20?',_0x4212a5['CmListId'][_0xb393('0x8a')]())[_0xb393('0x44')](_0xb393('0xae'))[_0xb393('0x44')](_0xb393('0xaf'),squel[_0xb393('0x81')]()[_0xb393('0x82')](_0xb393('0xb0'))[_0xb393('0xab')]('cm_hopper_final')[_0xb393('0x44')](_0xb393('0x88'),_0x520585[_0xb393('0x5e')]['id'][_0xb393('0x8a')]()))[_0xb393('0x44')](_0xb393('0xaf'),squel['select']()[_0xb393('0x82')]('COALESCE(phone,\x27\x27)')['from'](_0xb393('0xa2'))[_0xb393('0x44')]('VoiceQueueId\x20=\x20?',_0x520585[_0xb393('0x5e')]['id'][_0xb393('0x8a')]())))[_0xb393('0x8a')]();break;case _0xb393('0xb1'):_0x24b255=squel[_0xb393('0xa0')]()[_0xb393('0xa1')](_0xb393('0xa2'))['fromQuery']([_0xb393('0xa4'),_0xb393('0xa5'),_0xb393('0xa6'),'ListId',_0xb393('0x62'),'createdAt',_0xb393('0xaa')],squel[_0xb393('0x81')]()[_0xb393('0x82')](_0xb393('0xa4'),_0xb393('0xa4'))['field'](_0xb393('0xa7'),_0xb393('0xa5'))[_0xb393('0x82')]('id',_0xb393('0xa6'))['field'](_0x4212a5[_0xb393('0xa8')]['toString'](),_0xb393('0xa9'))[_0xb393('0x82')](_0x520585[_0xb393('0x5e')]['id']['toString'](),_0xb393('0x62'))[_0xb393('0x82')](_0xb393('0xa7'),_0xb393('0x5b'))[_0xb393('0x82')]('NOW()',_0xb393('0xaa'))[_0xb393('0xab')](_0xb393('0xac'))[_0xb393('0x44')](_0xb393('0xad'))['where']('ListId\x20=\x20?',_0x4212a5['CmListId']['toString']())['where'](_0xb393('0xae'))[_0xb393('0x44')](_0xb393('0xaf'),squel[_0xb393('0x81')]()[_0xb393('0x82')]('COALESCE(phone,\x27\x27)')['from'](_0xb393('0xa2'))[_0xb393('0x44')](_0xb393('0x88'),_0x520585[_0xb393('0x5e')]['id'][_0xb393('0x8a')]())))[_0xb393('0x8a')]();break;default:_0x24b255=squel[_0xb393('0xa0')]()[_0xb393('0xa1')](_0xb393('0xa2'))[_0xb393('0xa3')]([_0xb393('0xa4'),_0xb393('0xa5'),_0xb393('0xa6'),_0xb393('0xa9'),'VoiceQueueId','createdAt','updatedAt'],squel['select']()[_0xb393('0x82')](_0xb393('0xa4'),_0xb393('0xa4'))['field'](_0xb393('0xa7'),_0xb393('0xa5'))[_0xb393('0x82')]('id',_0xb393('0xa6'))[_0xb393('0x82')](_0x4212a5[_0xb393('0xa8')][_0xb393('0x8a')](),'ListId')[_0xb393('0x82')](_0x520585[_0xb393('0x5e')]['id'][_0xb393('0x8a')](),_0xb393('0x62'))[_0xb393('0x82')](_0xb393('0xa7'),_0xb393('0x5b'))['field'](_0xb393('0xa7'),_0xb393('0xaa'))[_0xb393('0xab')]('cm_contacts')[_0xb393('0x44')](_0xb393('0xad'))['where'](_0xb393('0xb2'),_0x4212a5[_0xb393('0xa8')][_0xb393('0x8a')]())[_0xb393('0x44')](_0xb393('0xae')))[_0xb393('0x8a')]();}_0x448923[_0xb393('0x95')](db[_0xb393('0x76')][_0xb393('0x39')](_0x24b255));}return BPromise[_0xb393('0x8d')](_0x448923);}})[_0xb393('0x28')](function(){return _0x435feb;})[_0xb393('0x28')](respondWithResult(_0x1e1479,null))[_0xb393('0x4c')](handleError(_0x1e1479,null));};exports['removeLists']=function(_0x45d3ed,_0x340221,_0x25656b){return db[_0xb393('0x49')][_0xb393('0x57')]({'where':{'id':_0x45d3ed[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](handleEntityNotFound(_0x340221,null))['then'](function(_0x3e8090){if(_0x3e8090){return _0x3e8090[_0xb393('0xb3')](_0x45d3ed['query']['ids']);}})[_0xb393('0x28')](function(_0x23b66f){if(_0x23b66f){return db[_0xb393('0x63')]['destroy']({'where':{'ListId':_0x45d3ed[_0xb393('0x39')][_0xb393('0x80')],'VoiceQueueId':_0x45d3ed[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](function(){return _0x23b66f;});}})['then'](respondWithStatusCode(_0x340221,null))[_0xb393('0x4c')](handleError(_0x340221,null));};exports[_0xb393('0xb4')]=function(_0x5f1658,_0x25150f,_0x4ecbb4){var _0x7a6dc2={};var _0x1c0965={};var _0x571f40;var _0x127cab;return db['VoiceQueue']['findOne']({'where':{'id':_0x5f1658[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0x25150f,null))['then'](function(_0x1d6e37){if(_0x1d6e37){_0x571f40=_0x1d6e37;_0x1c0965[_0xb393('0x3d')]=_[_0xb393('0x3a')](db[_0xb393('0x9c')][_0xb393('0x4e')]);_0x1c0965[_0xb393('0x39')]=_[_0xb393('0x3a')](_0x5f1658[_0xb393('0x39')]);_0x1c0965[_0xb393('0x3b')]=_[_0xb393('0x3c')](_0x1c0965[_0xb393('0x3d')],_0x1c0965['query']);_0x7a6dc2[_0xb393('0x3e')]=_[_0xb393('0x3c')](_0x1c0965[_0xb393('0x3d')],qs[_0xb393('0x3f')](_0x5f1658['query'][_0xb393('0x3f')]));_0x7a6dc2[_0xb393('0x3e')]=_0x7a6dc2[_0xb393('0x3e')][_0xb393('0x40')]?_0x7a6dc2[_0xb393('0x3e')]:_0x1c0965[_0xb393('0x3d')];_0x7a6dc2[_0xb393('0x60')]=qs[_0xb393('0x43')](_0x5f1658[_0xb393('0x39')]['sort']);_0x7a6dc2[_0xb393('0x44')]=qs[_0xb393('0x3b')](_[_0xb393('0x61')](_0x5f1658[_0xb393('0x39')],_0x1c0965[_0xb393('0x3b')]));if(_0x5f1658[_0xb393('0x39')]['filter']){_0x7a6dc2['where']=_[_0xb393('0x46')](_0x7a6dc2[_0xb393('0x44')],{'$or':_[_0xb393('0x2e')](_0x7a6dc2[_0xb393('0x3e')],function(_0x3bb622){var _0x160497={};_0x160497[_0x3bb622]={'$like':'%'+_0x5f1658[_0xb393('0x39')][_0xb393('0x45')]+'%'};return _0x160497;})});}_0x7a6dc2=_['merge']({},_0x7a6dc2,_0x5f1658[_0xb393('0x48')]);return _0x571f40[_0xb393('0xb4')](_0x7a6dc2);}})[_0xb393('0x28')](function(_0x405908){if(_0x405908){_0x127cab=_0x405908[_0xb393('0x40')];if(!_0x5f1658['query'][_0xb393('0x41')](_0xb393('0x42'))){_0x7a6dc2[_0xb393('0x23')]=qs[_0xb393('0x23')](_0x5f1658[_0xb393('0x39')][_0xb393('0x23')]);_0x7a6dc2[_0xb393('0x22')]=qs[_0xb393('0x22')](_0x5f1658[_0xb393('0x39')][_0xb393('0x22')]);}return _0x571f40['getBlackLists'](_0x7a6dc2);}})[_0xb393('0x28')](function(_0x567cc1){if(_0x567cc1){return _0x567cc1?{'count':_0x127cab,'rows':_0x567cc1}:null;}})[_0xb393('0x28')](respondWithResult(_0x25150f,null))[_0xb393('0x4c')](handleError(_0x25150f,null));};exports[_0xb393('0xb5')]=function(_0x4a4ca6,_0xbc7e4a,_0x169ecf){var _0x4e2f72,_0x1aa2b2;return db['VoiceQueue'][_0xb393('0x57')]({'where':{'id':_0x4a4ca6[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0xbc7e4a,null))[_0xb393('0x28')](function(_0x18b230){if(_0x18b230){_0x1aa2b2=_0x18b230;return _0x18b230[_0xb393('0xb5')](_0x4a4ca6[_0xb393('0x51')]['ids'],_['omit'](_0x4a4ca6[_0xb393('0x51')],[_0xb393('0x80'),'id'])||{});}return null;})[_0xb393('0x94')](function(_0x5c898b){var _0x58381e;_0x4e2f72=_0x5c898b||[];var _0x3a39f6=[];if(_0x5c898b){for(var _0x30335b=0x0;_0x30335b<_0x5c898b[_0xb393('0x40')];_0x30335b+=0x1){var _0x3d9fc7=_0x5c898b[_0x30335b][_0xb393('0x52')]({'plain':!![]});_0x58381e=squel['insert']()[_0xb393('0xa1')]('cm_hopper_black')[_0xb393('0xa3')](['phone',_0xb393('0xa6'),_0xb393('0xa9'),_0xb393('0x62'),'createdAt',_0xb393('0xaa')],squel[_0xb393('0x81')]()['field'](_0xb393('0xa4'),_0xb393('0xa4'))['field']('id',_0xb393('0xa6'))['field'](_0x3d9fc7[_0xb393('0xa8')]['toString'](),_0xb393('0xa9'))['field'](_0x4a4ca6[_0xb393('0x5e')]['id']['toString'](),_0xb393('0x62'))[_0xb393('0x82')]('NOW()',_0xb393('0x5b'))[_0xb393('0x82')](_0xb393('0xa7'),_0xb393('0xaa'))['from'](_0xb393('0xac'))[_0xb393('0x44')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x3d9fc7[_0xb393('0xa8')][_0xb393('0x8a')]())['where'](_0xb393('0xae')))[_0xb393('0x8a')]();_0x3a39f6[_0xb393('0x95')](db[_0xb393('0x76')]['query'](_0x58381e));}return BPromise[_0xb393('0x8d')](_0x3a39f6);}})[_0xb393('0x28')](function(){return _0x4e2f72;})[_0xb393('0x28')](respondWithResult(_0xbc7e4a,null))[_0xb393('0x4c')](handleError(_0xbc7e4a,null));};exports['removeBlackLists']=function(_0xd9d963,_0x174ad0,_0x401aaa){return db['VoiceQueue'][_0xb393('0x57')]({'where':{'id':_0xd9d963[_0xb393('0x5e')]['id']}})['then'](handleEntityNotFound(_0x174ad0,null))['then'](function(_0x540ef7){if(_0x540ef7){return _0x540ef7[_0xb393('0xb6')](_0xd9d963[_0xb393('0x39')][_0xb393('0x80')]);}})[_0xb393('0x28')](function(_0x498f17){if(_0x498f17){return db[_0xb393('0x6a')][_0xb393('0x29')]({'where':{'ListId':_0xd9d963[_0xb393('0x39')][_0xb393('0x80')],'VoiceQueueId':_0xd9d963[_0xb393('0x5e')]['id']}})[_0xb393('0x28')](function(){return _0x498f17;});}})['then'](respondWithStatusCode(_0x174ad0,null))[_0xb393('0x4c')](handleError(_0x174ad0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 728df7d..4ad062b 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 _0x57f9=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x1fe6fc,_0x214940){var _0x51fd82=function(_0x879a60){while(--_0x879a60){_0x1fe6fc['push'](_0x1fe6fc['shift']());}};_0x51fd82(++_0x214940);}(_0x57f9,0x10c));var _0x957f=function(_0x540b37,_0x3c7417){_0x540b37=_0x540b37-0x0;var _0x12ad90=_0x57f9[_0x540b37];return _0x12ad90;};'use strict';var EventEmitter=require(_0x957f('0x0'));var VoiceQueue=require(_0x957f('0x1'))['db'][_0x957f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x957f('0x3')](0x0);var events={'afterCreate':_0x957f('0x4'),'afterUpdate':_0x957f('0x5'),'afterDestroy':_0x957f('0x6')};function emitEvent(_0x1abf6f){return function(_0x166697,_0xa74db9,_0xdb2ad1){VoiceQueueEvents[_0x957f('0x7')](_0x1abf6f+':'+_0x166697['id'],_0x166697);VoiceQueueEvents[_0x957f('0x7')](_0x1abf6f,_0x166697);_0xdb2ad1(null);};}for(var e in events){if(events[_0x957f('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x6362=['../../mysqldb','setMaxListeners','update','emit','hook','exports','events'];(function(_0x8572ff,_0x5ad666){var _0x13738e=function(_0x57246e){while(--_0x57246e){_0x8572ff['push'](_0x8572ff['shift']());}};_0x13738e(++_0x5ad666);}(_0x6362,0xfb));var _0x2636=function(_0x38a8b,_0x51c7b2){_0x38a8b=_0x38a8b-0x0;var _0x2294f6=_0x6362[_0x38a8b];return _0x2294f6;};'use strict';var EventEmitter=require(_0x2636('0x0'));var VoiceQueue=require(_0x2636('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2636('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2636('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4936f9){return function(_0x4a9a7a,_0x338fcb,_0x296098){VoiceQueueEvents[_0x2636('0x4')](_0x4936f9+':'+_0x4a9a7a['id'],_0x4a9a7a);VoiceQueueEvents[_0x2636('0x4')](_0x4936f9,_0x4a9a7a);_0x296098(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2636('0x5')](e,emitEvent(event));}}module[_0x2636('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 5f75fc9..897239d 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 _0x5a55=['api','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','../../config/logger'];(function(_0x184f0a,_0x140ae8){var _0x58c8eb=function(_0xc92eac){while(--_0xc92eac){_0x184f0a['push'](_0x184f0a['shift']());}};_0x58c8eb(++_0x140ae8);}(_0x5a55,0x128));var _0x55a5=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x5a55[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x55a5('0x0'))(_0x55a5('0x1'));var moment=require('moment');var BPromise=require(_0x55a5('0x2'));var rp=require(_0x55a5('0x3'));var fs=require('fs');var path=require(_0x55a5('0x4'));var rimraf=require(_0x55a5('0x5'));var config=require('../../config/environment');var attributes=require(_0x55a5('0x6'));module[_0x55a5('0x7')]=function(_0x5a53f4,_0x3d7907){return _0x5a53f4[_0x55a5('0x8')](_0x55a5('0x9'),attributes,{'tableName':_0x55a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26b2=['path','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x525873,_0x3c5e26){var _0x22e7d7=function(_0x2d4cd1){while(--_0x2d4cd1){_0x525873['push'](_0x525873['shift']());}};_0x22e7d7(++_0x3c5e26);}(_0x26b2,0xda));var _0x226b=function(_0xd8ce7,_0x30b018){_0xd8ce7=_0xd8ce7-0x0;var _0x1f2943=_0x26b2[_0xd8ce7];return _0x1f2943;};'use strict';var _=require(_0x226b('0x0'));var util=require(_0x226b('0x1'));var logger=require(_0x226b('0x2'))(_0x226b('0x3'));var moment=require(_0x226b('0x4'));var BPromise=require(_0x226b('0x5'));var rp=require(_0x226b('0x6'));var fs=require('fs');var path=require(_0x226b('0x7'));var rimraf=require(_0x226b('0x8'));var config=require(_0x226b('0x9'));var attributes=require(_0x226b('0xa'));module[_0x226b('0xb')]=function(_0x126690,_0x53b851){return _0x126690[_0x226b('0xc')](_0x226b('0xd'),attributes,{'tableName':_0x226b('0xe'),'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 0b84f05..3c5ae51 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 _0xcf94=['stringify','error','code','message','result','catch','GetVoiceQueue','raw','options','where','map','include','attributes','ShowVoiceQueue','VoiceQueue','find','model','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1fde42,_0x43a9f1){var _0x3107d7=function(_0x104d0d){while(--_0x104d0d){_0x1fde42['push'](_0x1fde42['shift']());}};_0x3107d7(++_0x43a9f1);}(_0xcf94,0x1e5));var _0x4cf9=function(_0x539eff,_0x349edf){_0x539eff=_0x539eff-0x0;var _0x412095=_0xcf94[_0x539eff];return _0x412095;};'use strict';var _=require(_0x4cf9('0x0'));var util=require(_0x4cf9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cf9('0x2'));var db=require(_0x4cf9('0x3'))['db'];var utils=require(_0x4cf9('0x4'));var logger=require(_0x4cf9('0x5'))('rpc');var config=require(_0x4cf9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4cf9('0x7')]['http']({'port':0x232a});config[_0x4cf9('0x8')]=_[_0x4cf9('0x9')](config[_0x4cf9('0x8')],{'host':_0x4cf9('0xa'),'port':0x18eb});var socket=require(_0x4cf9('0xb'))(new Redis(config[_0x4cf9('0x8')]));require(_0x4cf9('0xc'))['register'](socket);function respondWithRpcPromise(_0x2904c7,_0x16ec38,_0x541157){return new BPromise(function(_0x430acf,_0x405572){return client['request'](_0x2904c7,_0x541157)[_0x4cf9('0xd')](function(_0x1d1127){logger[_0x4cf9('0xe')](_0x4cf9('0xf'),_0x16ec38,_0x4cf9('0x10'));logger[_0x4cf9('0x11')](_0x4cf9('0x12'),_0x16ec38,_0x4cf9('0x10'),JSON[_0x4cf9('0x13')](_0x1d1127));if(_0x1d1127[_0x4cf9('0x14')]){if(_0x1d1127[_0x4cf9('0x14')][_0x4cf9('0x15')]===0x1f4){logger[_0x4cf9('0x14')](_0x4cf9('0xf'),_0x16ec38,_0x1d1127[_0x4cf9('0x14')][_0x4cf9('0x16')]);return _0x405572(_0x1d1127['error']['message']);}logger[_0x4cf9('0x14')](_0x4cf9('0xf'),_0x16ec38,_0x1d1127[_0x4cf9('0x14')][_0x4cf9('0x16')]);return _0x430acf(_0x1d1127['error'][_0x4cf9('0x16')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x16ec38,_0x4cf9('0x10'));_0x430acf(_0x1d1127[_0x4cf9('0x17')][_0x4cf9('0x16')]);}})[_0x4cf9('0x18')](function(_0xf02706){logger[_0x4cf9('0x14')](_0x4cf9('0xf'),_0x16ec38,_0xf02706);_0x405572(_0xf02706);});});}exports[_0x4cf9('0x19')]=function(_0x2e8d8b){var _0x5d4588=this;return new Promise(function(_0x415324,_0x58d28a){return db['VoiceQueue']['findAll']({'raw':_0x2e8d8b['options']?_0x2e8d8b['options'][_0x4cf9('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e8d8b[_0x4cf9('0x1b')]?_0x2e8d8b[_0x4cf9('0x1b')][_0x4cf9('0x1c')]||null:null,'attributes':_0x2e8d8b[_0x4cf9('0x1b')]?_0x2e8d8b[_0x4cf9('0x1b')]['attributes']||null:null,'limit':_0x2e8d8b[_0x4cf9('0x1b')]?_0x2e8d8b[_0x4cf9('0x1b')]['limit']||null:null,'include':_0x2e8d8b[_0x4cf9('0x1b')]?_0x2e8d8b[_0x4cf9('0x1b')]['include']?_[_0x4cf9('0x1d')](_0x2e8d8b['options'][_0x4cf9('0x1e')],function(_0x349d83){return{'model':db[_0x349d83['model']],'as':_0x349d83['as'],'attributes':_0x349d83[_0x4cf9('0x1f')],'include':_0x349d83[_0x4cf9('0x1e')]?_[_0x4cf9('0x1d')](_0x349d83['include'],function(_0x4c4794){return{'model':db[_0x4c4794['model']],'as':_0x4c4794['as'],'attributes':_0x4c4794[_0x4cf9('0x1f')],'include':_0x4c4794[_0x4cf9('0x1e')]?_[_0x4cf9('0x1d')](_0x4c4794[_0x4cf9('0x1e')],function(_0x65125c){return{'model':db[_0x65125c['model']],'as':_0x65125c['as'],'attributes':_0x65125c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4cf9('0xd')](function(_0x511b36){logger[_0x4cf9('0xe')]('GetVoiceQueue',_0x2e8d8b);logger['debug'](_0x4cf9('0x19'),_0x2e8d8b,JSON[_0x4cf9('0x13')](_0x511b36));_0x415324(_0x511b36);})[_0x4cf9('0x18')](function(_0x58cb13){logger['error'](_0x4cf9('0x19'),_0x58cb13[_0x4cf9('0x16')],_0x2e8d8b);_0x58d28a(_0x5d4588[_0x4cf9('0x14')](0x1f4,_0x58cb13['message']));});});};exports[_0x4cf9('0x20')]=function(_0x5b614c){var _0x13eb5b=this;return new Promise(function(_0x353701,_0x8c3bfe){return db[_0x4cf9('0x21')][_0x4cf9('0x22')]({'raw':_0x5b614c[_0x4cf9('0x1b')]?_0x5b614c[_0x4cf9('0x1b')][_0x4cf9('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b614c[_0x4cf9('0x1b')]?_0x5b614c[_0x4cf9('0x1b')]['where']||null:null,'attributes':_0x5b614c['options']?_0x5b614c['options']['attributes']||null:null,'include':_0x5b614c[_0x4cf9('0x1b')]?_0x5b614c['options'][_0x4cf9('0x1e')]?_[_0x4cf9('0x1d')](_0x5b614c[_0x4cf9('0x1b')][_0x4cf9('0x1e')],function(_0xf2fbbb){return{'model':db[_0xf2fbbb[_0x4cf9('0x23')]],'as':_0xf2fbbb['as'],'attributes':_0xf2fbbb[_0x4cf9('0x1f')],'include':_0xf2fbbb['include']?_[_0x4cf9('0x1d')](_0xf2fbbb[_0x4cf9('0x1e')],function(_0x8df1e1){return{'model':db[_0x8df1e1[_0x4cf9('0x23')]],'as':_0x8df1e1['as'],'attributes':_0x8df1e1[_0x4cf9('0x1f')],'include':_0x8df1e1['include']?_[_0x4cf9('0x1d')](_0x8df1e1['include'],function(_0x392d85){return{'model':db[_0x392d85[_0x4cf9('0x23')]],'as':_0x392d85['as'],'attributes':_0x392d85[_0x4cf9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4cf9('0xd')](function(_0x27f1b4){logger['info'](_0x4cf9('0x20'),_0x5b614c);logger[_0x4cf9('0x11')](_0x4cf9('0x20'),_0x5b614c,JSON[_0x4cf9('0x13')](_0x27f1b4));_0x353701(_0x27f1b4);})[_0x4cf9('0x18')](function(_0x344f2e){logger['error'](_0x4cf9('0x20'),_0x344f2e['message'],_0x5b614c);_0x8c3bfe(_0x13eb5b[_0x4cf9('0x14')](0x1f4,_0x344f2e[_0x4cf9('0x16')]));});});}; \ No newline at end of file +var _0x1968=['client','defaults','socket.io-emitter','redis','./voiceQueue.socket','register','request','then','request\x20sent','stringify','error','VoiceQueue,\x20%s,\x20%s','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','catch','ShowVoiceQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x15f1f8,_0x15e5c8){var _0x53215d=function(_0x5bae68){while(--_0x5bae68){_0x15f1f8['push'](_0x15f1f8['shift']());}};_0x53215d(++_0x15e5c8);}(_0x1968,0x69));var _0x8196=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1968[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x8196('0x0'));var util=require(_0x8196('0x1'));var moment=require(_0x8196('0x2'));var BPromise=require('bluebird');var rs=require(_0x8196('0x3'));var fs=require('fs');var Redis=require(_0x8196('0x4'));var db=require(_0x8196('0x5'))['db'];var utils=require(_0x8196('0x6'));var logger=require(_0x8196('0x7'))('rpc');var config=require(_0x8196('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8196('0x9')]['http']({'port':0x232a});config['redis']=_[_0x8196('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8196('0xb'))(new Redis(config[_0x8196('0xc')]));require(_0x8196('0xd'))[_0x8196('0xe')](socket);function respondWithRpcPromise(_0x26ff44,_0x4602ed,_0x56ed6f){return new BPromise(function(_0x92af81,_0x55b2bd){return client[_0x8196('0xf')](_0x26ff44,_0x56ed6f)[_0x8196('0x10')](function(_0x18d151){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4602ed,_0x8196('0x11'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4602ed,_0x8196('0x11'),JSON[_0x8196('0x12')](_0x18d151));if(_0x18d151[_0x8196('0x13')]){if(_0x18d151[_0x8196('0x13')]['code']===0x1f4){logger[_0x8196('0x13')](_0x8196('0x14'),_0x4602ed,_0x18d151['error'][_0x8196('0x15')]);return _0x55b2bd(_0x18d151[_0x8196('0x13')][_0x8196('0x15')]);}logger[_0x8196('0x13')](_0x8196('0x14'),_0x4602ed,_0x18d151[_0x8196('0x13')][_0x8196('0x15')]);return _0x92af81(_0x18d151[_0x8196('0x13')][_0x8196('0x15')]);}else{logger[_0x8196('0x16')](_0x8196('0x14'),_0x4602ed,_0x8196('0x11'));_0x92af81(_0x18d151[_0x8196('0x17')][_0x8196('0x15')]);}})['catch'](function(_0x3453f8){logger[_0x8196('0x13')](_0x8196('0x14'),_0x4602ed,_0x3453f8);_0x55b2bd(_0x3453f8);});});}exports[_0x8196('0x18')]=function(_0x24ea13){var _0x53cd72=this;return new Promise(function(_0x5784d3,_0x30456e){return db[_0x8196('0x19')][_0x8196('0x1a')]({'raw':_0x24ea13[_0x8196('0x1b')]?_0x24ea13[_0x8196('0x1b')][_0x8196('0x1c')]===undefined?!![]:![]:!![],'where':_0x24ea13['options']?_0x24ea13['options'][_0x8196('0x1d')]||null:null,'attributes':_0x24ea13[_0x8196('0x1b')]?_0x24ea13[_0x8196('0x1b')][_0x8196('0x1e')]||null:null,'limit':_0x24ea13['options']?_0x24ea13[_0x8196('0x1b')][_0x8196('0x1f')]||null:null,'include':_0x24ea13[_0x8196('0x1b')]?_0x24ea13[_0x8196('0x1b')][_0x8196('0x20')]?_['map'](_0x24ea13[_0x8196('0x1b')][_0x8196('0x20')],function(_0x2528dc){return{'model':db[_0x2528dc[_0x8196('0x21')]],'as':_0x2528dc['as'],'attributes':_0x2528dc['attributes'],'include':_0x2528dc[_0x8196('0x20')]?_[_0x8196('0x22')](_0x2528dc['include'],function(_0x5d8d89){return{'model':db[_0x5d8d89[_0x8196('0x21')]],'as':_0x5d8d89['as'],'attributes':_0x5d8d89[_0x8196('0x1e')],'include':_0x5d8d89[_0x8196('0x20')]?_['map'](_0x5d8d89[_0x8196('0x20')],function(_0x1f94f0){return{'model':db[_0x1f94f0[_0x8196('0x21')]],'as':_0x1f94f0['as'],'attributes':_0x1f94f0[_0x8196('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22487b){logger['info'](_0x8196('0x18'),_0x24ea13);logger[_0x8196('0x23')]('GetVoiceQueue',_0x24ea13,JSON[_0x8196('0x12')](_0x22487b));_0x5784d3(_0x22487b);})[_0x8196('0x24')](function(_0x299207){logger['error']('GetVoiceQueue',_0x299207['message'],_0x24ea13);_0x30456e(_0x53cd72['error'](0x1f4,_0x299207['message']));});});};exports['ShowVoiceQueue']=function(_0x2622db){var _0x18b08a=this;return new Promise(function(_0x4b8cab,_0x1841ce){return db['VoiceQueue']['find']({'raw':_0x2622db[_0x8196('0x1b')]?_0x2622db['options'][_0x8196('0x1c')]===undefined?!![]:![]:!![],'where':_0x2622db[_0x8196('0x1b')]?_0x2622db[_0x8196('0x1b')]['where']||null:null,'attributes':_0x2622db['options']?_0x2622db[_0x8196('0x1b')]['attributes']||null:null,'include':_0x2622db[_0x8196('0x1b')]?_0x2622db['options'][_0x8196('0x20')]?_['map'](_0x2622db[_0x8196('0x1b')][_0x8196('0x20')],function(_0x54c18c){return{'model':db[_0x54c18c[_0x8196('0x21')]],'as':_0x54c18c['as'],'attributes':_0x54c18c[_0x8196('0x1e')],'include':_0x54c18c[_0x8196('0x20')]?_[_0x8196('0x22')](_0x54c18c[_0x8196('0x20')],function(_0xc5d3bf){return{'model':db[_0xc5d3bf[_0x8196('0x21')]],'as':_0xc5d3bf['as'],'attributes':_0xc5d3bf['attributes'],'include':_0xc5d3bf['include']?_[_0x8196('0x22')](_0xc5d3bf['include'],function(_0x7243e1){return{'model':db[_0x7243e1['model']],'as':_0x7243e1['as'],'attributes':_0x7243e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8196('0x10')](function(_0x2bdf03){logger['info'](_0x8196('0x25'),_0x2622db);logger[_0x8196('0x23')](_0x8196('0x25'),_0x2622db,JSON[_0x8196('0x12')](_0x2bdf03));_0x4b8cab(_0x2bdf03);})[_0x8196('0x24')](function(_0x1c5119){logger['error'](_0x8196('0x25'),_0x1c5119[_0x8196('0x15')],_0x2622db);_0x1841ce(_0x18b08a[_0x8196('0x13')](0x1f4,_0x1c5119['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f826472..3609545 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 _0xe7e8=['remove','update','removeListener','register','length','save'];(function(_0x5e2124,_0x118c8c){var _0x366dee=function(_0x307a4d){while(--_0x307a4d){_0x5e2124['push'](_0x5e2124['shift']());}};_0x366dee(++_0x118c8c);}(_0xe7e8,0xe3));var _0x8e7e=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xe7e8[_0x3d4ef1];return _0x409423;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x8e7e('0x0'),_0x8e7e('0x1'),_0x8e7e('0x2')];function createListener(_0x4e5f9b,_0x484e89){return function(_0x41affe){_0x484e89['emit'](_0x4e5f9b,_0x41affe);};}function removeListener(_0x2313de,_0x22edb0){return function(){VoiceQueueEvents[_0x8e7e('0x3')](_0x2313de,_0x22edb0);};}exports[_0x8e7e('0x4')]=function(_0x2ff8db){for(var _0x11183f=0x0,_0x11cdd0=events[_0x8e7e('0x5')];_0x11183f<_0x11cdd0;_0x11183f++){var _0x505978=events[_0x11183f];var _0x2b134f=createListener('voiceQueue:'+_0x505978,_0x2ff8db);VoiceQueueEvents['on'](_0x505978,_0x2b134f);}}; \ No newline at end of file +var _0xfea4=['emit','removeListener','length','voiceQueue:','save','update'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xfea4,0x1a8));var _0x4fea=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xfea4[_0x2c1dcd];return _0x158ce5;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x4fea('0x0'),'remove',_0x4fea('0x1')];function createListener(_0x519c7e,_0x4bf5a6){return function(_0x5ed3db){_0x4bf5a6[_0x4fea('0x2')](_0x519c7e,_0x5ed3db);};}function removeListener(_0x2711f3,_0x92fd2c){return function(){VoiceQueueEvents[_0x4fea('0x3')](_0x2711f3,_0x92fd2c);};}exports['register']=function(_0xcb4409){for(var _0x3f100b=0x0,_0xe07c13=events[_0x4fea('0x4')];_0x3f100b<_0xe07c13;_0x3f100b++){var _0x549e7a=events[_0x3f100b];var _0x15235e=createListener(_0x4fea('0x5')+_0x549e7a,_0xcb4409);VoiceQueueEvents['on'](_0x549e7a,_0x15235e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d46c4ae..4af7e36 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 _0x50a5=['getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','exports','multer','util','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x50a5,0xd1));var _0x550a=function(_0x347fee,_0x3d84c1){_0x347fee=_0x347fee-0x0;var _0x2ccd3e=_0x50a5[_0x347fee];return _0x2ccd3e;};'use strict';var multer=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x550a('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x550a('0x3'));var controller=require(_0x550a('0x4'));router[_0x550a('0x5')]('/',auth[_0x550a('0x6')](),controller[_0x550a('0x7')]);router[_0x550a('0x5')](_0x550a('0x8'),auth[_0x550a('0x6')](),controller[_0x550a('0x9')]);router[_0x550a('0x5')](_0x550a('0xa'),auth[_0x550a('0x6')](),controller[_0x550a('0xb')]);router['get'](_0x550a('0xc'),auth[_0x550a('0x6')](),controller[_0x550a('0xd')]);router[_0x550a('0xe')]('/',auth[_0x550a('0x6')](),controller[_0x550a('0xf')]);router['put'](_0x550a('0xc'),auth[_0x550a('0x6')](),controller[_0x550a('0x10')]);router[_0x550a('0x11')](_0x550a('0xc'),auth[_0x550a('0x6')](),controller[_0x550a('0x12')]);module[_0x550a('0x13')]=router; \ No newline at end of file +var _0x6a55=['express','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x6a55,0xdb));var _0x56a5=function(_0x8bf471,_0x2e9da0){_0x8bf471=_0x8bf471-0x0;var _0x3d93d7=_0x6a55[_0x8bf471];return _0x3d93d7;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x56a5('0x2'));var config=require('../../config/environment');var controller=require(_0x56a5('0x3'));router['get']('/',auth[_0x56a5('0x4')](),controller[_0x56a5('0x5')]);router[_0x56a5('0x6')](_0x56a5('0x7'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x6')](_0x56a5('0x9'),auth['isAuthenticated'](),controller[_0x56a5('0xa')]);router[_0x56a5('0x6')](_0x56a5('0xb'),auth[_0x56a5('0x4')](),controller[_0x56a5('0xc')]);router[_0x56a5('0xd')]('/',auth[_0x56a5('0x4')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x56a5('0x10')]);router[_0x56a5('0x11')](_0x56a5('0xb'),auth[_0x56a5('0x4')](),controller[_0x56a5('0x12')]);module[_0x56a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 9786d9a..00e87a1 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 _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xcb91[_0x1ee62e];return _0x27c6c8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0x8aa78f,_0x306ec5){var _0x3fc7c7=function(_0x589e12){while(--_0x589e12){_0x8aa78f['push'](_0x8aa78f['shift']());}};_0x3fc7c7(++_0x306ec5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a9e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a9e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0a9e('0x4')],'set':function(_0x991246){var _0x981158=moment(_0x991246);var _0x57b080=moment(this[_0x0a9e('0x5')](_0x0a9e('0x6')))[_0x0a9e('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x503809=_0x981158[_0x0a9e('0x8')](_0x57b080,'seconds');this['setDataValue'](_0x0a9e('0x9'),_0x991246);this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x503809||null);}},'position':{'type':Sequelize[_0x0a9e('0xc')]},'count':{'type':Sequelize[_0x0a9e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x0a9e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0a9e('0x3')],'comment':_0x0a9e('0xe')},'originalposition':{'type':Sequelize[_0x0a9e('0xc')]},'channel':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a9e('0x3')]},'context':{'type':Sequelize[_0x0a9e('0x3')]},'exten':{'type':Sequelize[_0x0a9e('0x3')]},'priority':{'type':Sequelize[_0x0a9e('0x3')]},'holdtime':{'type':Sequelize[_0x0a9e('0xc')]},'mohtime':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0a9e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0a9e('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0a9e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0a9e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0a9e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 3aa3a2f..65d83ed 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x49677a,_0x197e86){var _0x115408=function(_0xc88918){while(--_0xc88918){_0x49677a['push'](_0x49677a['shift']());}};_0x115408(++_0x197e86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x38a26c,_0x3af7e2){var _0x235318=function(_0x54a6ab){while(--_0x54a6ab){_0x38a26c['push'](_0x38a26c['shift']());}};_0x235318(++_0x3af7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 5e01826..baa0614 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 _0x3bfe=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0xdaf096,_0x3e6567){var _0x1a08ba=function(_0x57d340){while(--_0x57d340){_0xdaf096['push'](_0xdaf096['shift']());}};_0x1a08ba(++_0x3e6567);}(_0x3bfe,0x155));var _0xe3bf=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x3bfe[_0xeff2c3];return _0x2cade6;};'use strict';var EventEmitter=require(_0xe3bf('0x0'));var VoiceQueueReport=require(_0xe3bf('0x1'))['db'][_0xe3bf('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe3bf('0x3')](0x0);var events={'afterCreate':_0xe3bf('0x4'),'afterUpdate':_0xe3bf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1bd835){return function(_0x4d7c60,_0x1f72d7,_0x1949a8){VoiceQueueReportEvents[_0xe3bf('0x6')](_0x1bd835+':'+_0x4d7c60['id'],_0x4d7c60);VoiceQueueReportEvents[_0xe3bf('0x6')](_0x1bd835,_0x4d7c60);_0x1949a8(null);};}for(var e in events){if(events[_0xe3bf('0x7')](e)){var event=events[e];VoiceQueueReport[_0xe3bf('0x8')](e,emitEvent(event));}}module[_0xe3bf('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x12d3=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x4f09cf,_0x2f5ed5){var _0x5d2c01=function(_0x23d719){while(--_0x23d719){_0x4f09cf['push'](_0x4f09cf['shift']());}};_0x5d2c01(++_0x2f5ed5);}(_0x12d3,0xab));var _0x312d=function(_0xf82eb9,_0x18b78f){_0xf82eb9=_0xf82eb9-0x0;var _0x1d9e15=_0x12d3[_0xf82eb9];return _0x1d9e15;};'use strict';var EventEmitter=require(_0x312d('0x0'));var VoiceQueueReport=require(_0x312d('0x1'))['db'][_0x312d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x312d('0x3')](0x0);var events={'afterCreate':_0x312d('0x4'),'afterUpdate':'update','afterDestroy':_0x312d('0x5')};function emitEvent(_0x187357){return function(_0x225c12,_0x522b95,_0x4c8963){VoiceQueueReportEvents[_0x312d('0x6')](_0x187357+':'+_0x225c12['id'],_0x225c12);VoiceQueueReportEvents['emit'](_0x187357,_0x225c12);_0x4c8963(null);};}for(var e in events){if(events[_0x312d('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x312d('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 7d9c78b..0f200b3 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(_0x27f88b,_0x526bad){var _0x2114f4=function(_0x341508){while(--_0x341508){_0x27f88b['push'](_0x27f88b['shift']());}};_0x2114f4(++_0x526bad);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12f99d,_0x4c8add){_0x12f99d=_0x12f99d-0x0;var _0x3953db=_0x5f2f[_0x12f99d];return _0x3953db;};'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 _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x16eb61,_0x43dfa2){var _0x46905c=function(_0x55c53d){while(--_0x55c53d){_0x16eb61['push'](_0x16eb61['shift']());}};_0x46905c(++_0x43dfa2);}(_0xdb28,0x106));var _0x8db2=function(_0x434744,_0x3b9d67){_0x434744=_0x434744-0x0;var _0x584295=_0xdb28[_0x434744];return _0x584295;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('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 b789ae8..3a75194 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 _0x28df=['catch','UpdateVoiceQueueReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','VoiceQueueReport','findAll','options','where','attributes','model','include','map','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','raw','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28df,0xca));var _0xf28d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x28df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf28d('0x0'));var util=require(_0xf28d('0x1'));var moment=require(_0xf28d('0x2'));var BPromise=require('bluebird');var rs=require(_0xf28d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf28d('0x4'));var logger=require(_0xf28d('0x5'))(_0xf28d('0x6'));var config=require(_0xf28d('0x7'));var jayson=require(_0xf28d('0x8'));var client=jayson[_0xf28d('0x9')][_0xf28d('0xa')]({'port':0x232a});config[_0xf28d('0xb')]=_[_0xf28d('0xc')](config['redis'],{'host':_0xf28d('0xd'),'port':0x18eb});var socket=require(_0xf28d('0xe'))(new Redis(config[_0xf28d('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x28cbef,_0x1da597,_0x1f9765){return new BPromise(function(_0x625c5f,_0x5a6b58){return client[_0xf28d('0xf')](_0x28cbef,_0x1f9765)['then'](function(_0x369bc8){logger[_0xf28d('0x10')](_0xf28d('0x11'),_0x1da597,'request\x20sent');logger[_0xf28d('0x12')](_0xf28d('0x13'),_0x1da597,'request\x20sent',JSON[_0xf28d('0x14')](_0x369bc8));if(_0x369bc8[_0xf28d('0x15')]){if(_0x369bc8[_0xf28d('0x15')]['code']===0x1f4){logger[_0xf28d('0x15')](_0xf28d('0x11'),_0x1da597,_0x369bc8[_0xf28d('0x15')][_0xf28d('0x16')]);return _0x5a6b58(_0x369bc8['error'][_0xf28d('0x16')]);}logger['error'](_0xf28d('0x11'),_0x1da597,_0x369bc8[_0xf28d('0x15')]['message']);return _0x625c5f(_0x369bc8[_0xf28d('0x15')][_0xf28d('0x16')]);}else{logger['info'](_0xf28d('0x11'),_0x1da597,_0xf28d('0x17'));_0x625c5f(_0x369bc8['result'][_0xf28d('0x16')]);}})['catch'](function(_0x4f8eff){logger[_0xf28d('0x15')](_0xf28d('0x11'),_0x1da597,_0x4f8eff);_0x5a6b58(_0x4f8eff);});});}exports['GetVoiceQueueReport']=function(_0x58aa8d){var _0x32c27c=this;return new Promise(function(_0xb64bca,_0x21b1c4){return db[_0xf28d('0x18')][_0xf28d('0x19')]({'raw':_0x58aa8d[_0xf28d('0x1a')]?_0x58aa8d[_0xf28d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x58aa8d[_0xf28d('0x1a')]?_0x58aa8d['options'][_0xf28d('0x1b')]||null:null,'attributes':_0x58aa8d[_0xf28d('0x1a')]?_0x58aa8d[_0xf28d('0x1a')][_0xf28d('0x1c')]||null:null,'limit':_0x58aa8d[_0xf28d('0x1a')]?_0x58aa8d[_0xf28d('0x1a')]['limit']||null:null,'include':_0x58aa8d[_0xf28d('0x1a')]?_0x58aa8d[_0xf28d('0x1a')]['include']?_['map'](_0x58aa8d[_0xf28d('0x1a')]['include'],function(_0x483cd6){return{'model':db[_0x483cd6[_0xf28d('0x1d')]],'as':_0x483cd6['as'],'attributes':_0x483cd6['attributes'],'include':_0x483cd6[_0xf28d('0x1e')]?_[_0xf28d('0x1f')](_0x483cd6['include'],function(_0x10f701){return{'model':db[_0x10f701['model']],'as':_0x10f701['as'],'attributes':_0x10f701['attributes'],'include':_0x10f701[_0xf28d('0x1e')]?_[_0xf28d('0x1f')](_0x10f701[_0xf28d('0x1e')],function(_0x44c146){return{'model':db[_0x44c146[_0xf28d('0x1d')]],'as':_0x44c146['as'],'attributes':_0x44c146['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b487e){logger['info'](_0xf28d('0x20'),_0x58aa8d);logger[_0xf28d('0x12')](_0xf28d('0x20'),_0x58aa8d,JSON[_0xf28d('0x14')](_0x1b487e));_0xb64bca(_0x1b487e);})['catch'](function(_0x197009){logger[_0xf28d('0x15')](_0xf28d('0x20'),_0x197009[_0xf28d('0x16')],_0x58aa8d);_0x21b1c4(_0x32c27c[_0xf28d('0x15')](0x1f4,_0x197009['message']));});});};exports[_0xf28d('0x21')]=function(_0x316dbc){var _0x25227e=this;return new Promise(function(_0x3aa323,_0x185596){return db['VoiceQueueReport'][_0xf28d('0x22')](_0x316dbc[_0xf28d('0x23')],{'raw':_0x316dbc[_0xf28d('0x1a')]?_0x316dbc['options'][_0xf28d('0x24')]===undefined?!![]:![]:!![]})[_0xf28d('0x25')](function(_0x352e2d){logger['info'](_0xf28d('0x21'),_0x316dbc);logger[_0xf28d('0x12')]('CreateVoiceQueueReport',_0x316dbc,JSON[_0xf28d('0x14')](_0x352e2d));_0x3aa323(_0x352e2d);})[_0xf28d('0x26')](function(_0x9b7a80){logger['error'](_0xf28d('0x21'),_0x9b7a80[_0xf28d('0x16')],_0x316dbc);_0x185596(_0x25227e['error'](0x1f4,_0x9b7a80['message']));});});};exports[_0xf28d('0x27')]=function(_0x42582a){var _0x368c9c=this;return new Promise(function(_0x715dd7,_0x5be027){return db[_0xf28d('0x18')]['update'](_0x42582a['body'],{'raw':_0x42582a['options']?_0x42582a[_0xf28d('0x1a')][_0xf28d('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42582a[_0xf28d('0x1a')]?_0x42582a[_0xf28d('0x1a')]['where']||null:null,'attributes':_0x42582a[_0xf28d('0x1a')]?_0x42582a[_0xf28d('0x1a')][_0xf28d('0x1c')]||null:null,'limit':_0x42582a[_0xf28d('0x1a')]?_0x42582a['options']['limit']||null:null})[_0xf28d('0x25')](function(_0x1d251f){logger['info']('UpdateVoiceQueueReport',_0x42582a);logger['debug']('UpdateVoiceQueueReport',_0x42582a,JSON[_0xf28d('0x14')](_0x1d251f));_0x715dd7(_0x1d251f);})['catch'](function(_0x22e055){logger[_0xf28d('0x15')](_0xf28d('0x27'),_0x22e055[_0xf28d('0x16')],_0x42582a);_0x5be027(_0x368c9c[_0xf28d('0x15')](0x1f4,_0x22e055[_0xf28d('0x16')]));});});}; \ No newline at end of file +var _0x64e5=['ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','limit','lodash','util','moment','bluebird'];(function(_0x10e870,_0x4c4324){var _0x29b93d=function(_0x11943e){while(--_0x11943e){_0x10e870['push'](_0x10e870['shift']());}};_0x29b93d(++_0x4c4324);}(_0x64e5,0x10a));var _0x564e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x64e5[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x564e('0x0'));var util=require(_0x564e('0x1'));var moment=require(_0x564e('0x2'));var BPromise=require(_0x564e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x564e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x564e('0x5'));var config=require(_0x564e('0x6'));var jayson=require(_0x564e('0x7'));var client=jayson[_0x564e('0x8')][_0x564e('0x9')]({'port':0x232a});config[_0x564e('0xa')]=_[_0x564e('0xb')](config['redis'],{'host':_0x564e('0xc'),'port':0x18eb});var socket=require(_0x564e('0xd'))(new Redis(config[_0x564e('0xa')]));require(_0x564e('0xe'))[_0x564e('0xf')](socket);function respondWithRpcPromise(_0x2d3e1d,_0x41a465,_0x36d486){return new BPromise(function(_0x14c8a5,_0x2421d7){return client[_0x564e('0x10')](_0x2d3e1d,_0x36d486)['then'](function(_0x2e8c10){logger[_0x564e('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x41a465,'request\x20sent');logger[_0x564e('0x12')](_0x564e('0x13'),_0x41a465,_0x564e('0x14'),JSON[_0x564e('0x15')](_0x2e8c10));if(_0x2e8c10[_0x564e('0x16')]){if(_0x2e8c10[_0x564e('0x16')][_0x564e('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x41a465,_0x2e8c10[_0x564e('0x16')][_0x564e('0x18')]);return _0x2421d7(_0x2e8c10[_0x564e('0x16')][_0x564e('0x18')]);}logger[_0x564e('0x16')](_0x564e('0x19'),_0x41a465,_0x2e8c10[_0x564e('0x16')][_0x564e('0x18')]);return _0x14c8a5(_0x2e8c10[_0x564e('0x16')][_0x564e('0x18')]);}else{logger[_0x564e('0x11')](_0x564e('0x19'),_0x41a465,_0x564e('0x14'));_0x14c8a5(_0x2e8c10[_0x564e('0x1a')]['message']);}})[_0x564e('0x1b')](function(_0x1a3afe){logger[_0x564e('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x41a465,_0x1a3afe);_0x2421d7(_0x1a3afe);});});}exports[_0x564e('0x1c')]=function(_0x527112){var _0x46d19f=this;return new Promise(function(_0x3671b9,_0x33e75c){return db[_0x564e('0x1d')][_0x564e('0x1e')]({'raw':_0x527112[_0x564e('0x1f')]?_0x527112[_0x564e('0x1f')][_0x564e('0x20')]===undefined?!![]:![]:!![],'where':_0x527112['options']?_0x527112[_0x564e('0x1f')]['where']||null:null,'attributes':_0x527112[_0x564e('0x1f')]?_0x527112['options'][_0x564e('0x21')]||null:null,'limit':_0x527112[_0x564e('0x1f')]?_0x527112[_0x564e('0x1f')]['limit']||null:null,'include':_0x527112[_0x564e('0x1f')]?_0x527112[_0x564e('0x1f')][_0x564e('0x22')]?_[_0x564e('0x23')](_0x527112[_0x564e('0x1f')][_0x564e('0x22')],function(_0x55e403){return{'model':db[_0x55e403[_0x564e('0x24')]],'as':_0x55e403['as'],'attributes':_0x55e403['attributes'],'include':_0x55e403[_0x564e('0x22')]?_[_0x564e('0x23')](_0x55e403[_0x564e('0x22')],function(_0x50a570){return{'model':db[_0x50a570[_0x564e('0x24')]],'as':_0x50a570['as'],'attributes':_0x50a570[_0x564e('0x21')],'include':_0x50a570[_0x564e('0x22')]?_[_0x564e('0x23')](_0x50a570['include'],function(_0x439a15){return{'model':db[_0x439a15[_0x564e('0x24')]],'as':_0x439a15['as'],'attributes':_0x439a15['attributes']};}):[]};}):[]};}):[]:[]})[_0x564e('0x25')](function(_0x11e8ca){logger[_0x564e('0x11')](_0x564e('0x1c'),_0x527112);logger[_0x564e('0x12')]('GetVoiceQueueReport',_0x527112,JSON[_0x564e('0x15')](_0x11e8ca));_0x3671b9(_0x11e8ca);})['catch'](function(_0x2a26ef){logger[_0x564e('0x16')](_0x564e('0x1c'),_0x2a26ef[_0x564e('0x18')],_0x527112);_0x33e75c(_0x46d19f[_0x564e('0x16')](0x1f4,_0x2a26ef[_0x564e('0x18')]));});});};exports[_0x564e('0x26')]=function(_0x1844f6){var _0xacff8e=this;return new Promise(function(_0x5116cf,_0x22a8df){return db[_0x564e('0x1d')][_0x564e('0x27')](_0x1844f6[_0x564e('0x28')],{'raw':_0x1844f6['options']?_0x1844f6[_0x564e('0x1f')][_0x564e('0x20')]===undefined?!![]:![]:!![]})[_0x564e('0x25')](function(_0x28fff8){logger[_0x564e('0x11')](_0x564e('0x26'),_0x1844f6);logger[_0x564e('0x12')]('CreateVoiceQueueReport',_0x1844f6,JSON[_0x564e('0x15')](_0x28fff8));_0x5116cf(_0x28fff8);})['catch'](function(_0x6744d7){logger[_0x564e('0x16')](_0x564e('0x26'),_0x6744d7['message'],_0x1844f6);_0x22a8df(_0xacff8e[_0x564e('0x16')](0x1f4,_0x6744d7[_0x564e('0x18')]));});});};exports[_0x564e('0x29')]=function(_0x4175f0){var _0x1dc10d=this;return new Promise(function(_0x17a6f0,_0x88e40c){return db[_0x564e('0x1d')][_0x564e('0x2a')](_0x4175f0[_0x564e('0x28')],{'raw':_0x4175f0['options']?_0x4175f0[_0x564e('0x1f')][_0x564e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4175f0[_0x564e('0x1f')]?_0x4175f0[_0x564e('0x1f')][_0x564e('0x2b')]||null:null,'attributes':_0x4175f0['options']?_0x4175f0[_0x564e('0x1f')]['attributes']||null:null,'limit':_0x4175f0['options']?_0x4175f0[_0x564e('0x1f')][_0x564e('0x2c')]||null:null})['then'](function(_0x7f79da){logger[_0x564e('0x11')]('UpdateVoiceQueueReport',_0x4175f0);logger['debug']('UpdateVoiceQueueReport',_0x4175f0,JSON[_0x564e('0x15')](_0x7f79da));_0x17a6f0(_0x7f79da);})['catch'](function(_0x1860b9){logger['error'](_0x564e('0x29'),_0x1860b9[_0x564e('0x18')],_0x4175f0);_0x88e40c(_0x1dc10d[_0x564e('0x16')](0x1f4,_0x1860b9[_0x564e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index bac51fa..e45334c 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 _0x3800=['voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','register','length'];(function(_0x9b1166,_0x384402){var _0x2ad057=function(_0x2b854d){while(--_0x2b854d){_0x9b1166['push'](_0x9b1166['shift']());}};_0x2ad057(++_0x384402);}(_0x3800,0x10b));var _0x0380=function(_0x526aef,_0x4084eb){_0x526aef=_0x526aef-0x0;var _0x4719a8=_0x3800[_0x526aef];return _0x4719a8;};'use strict';var VoiceQueueReportEvents=require(_0x0380('0x0'));var events=['save',_0x0380('0x1'),_0x0380('0x2')];function createListener(_0x43e5ad,_0x4b0183){return function(_0x13345e){_0x4b0183[_0x0380('0x3')](_0x43e5ad,_0x13345e);};}function removeListener(_0x5a8169,_0x55ce6c){return function(){VoiceQueueReportEvents['removeListener'](_0x5a8169,_0x55ce6c);};}exports[_0x0380('0x4')]=function(_0x4b16d0){for(var _0x1c23f6=0x0,_0x11deff=events[_0x0380('0x5')];_0x1c23f6<_0x11deff;_0x1c23f6++){var _0x3d3efd=events[_0x1c23f6];var _0x1cb0c3=createListener(_0x0380('0x6')+_0x3d3efd,_0x4b16d0);VoiceQueueReportEvents['on'](_0x3d3efd,_0x1cb0c3);}}; \ No newline at end of file +var _0x0cb5=['removeListener','register','voiceQueueReport:','save','remove','update','emit'];(function(_0x1ccdc9,_0x2c9894){var _0x3f1331=function(_0x33a2c8){while(--_0x33a2c8){_0x1ccdc9['push'](_0x1ccdc9['shift']());}};_0x3f1331(++_0x2c9894);}(_0x0cb5,0x18b));var _0x50cb=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x0cb5[_0xbe200f];return _0x192597;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x50cb('0x0'),_0x50cb('0x1'),_0x50cb('0x2')];function createListener(_0x1a7021,_0x2e2805){return function(_0x580b02){_0x2e2805[_0x50cb('0x3')](_0x1a7021,_0x580b02);};}function removeListener(_0x597450,_0x57b0e1){return function(){VoiceQueueReportEvents[_0x50cb('0x4')](_0x597450,_0x57b0e1);};}exports[_0x50cb('0x5')]=function(_0x5db2dd){for(var _0x83f51c=0x0,_0x4e5dfa=events['length'];_0x83f51c<_0x4e5dfa;_0x83f51c++){var _0x429151=events[_0x83f51c];var _0x589931=createListener(_0x50cb('0x6')+_0x429151,_0x5db2dd);VoiceQueueReportEvents['on'](_0x429151,_0x589931);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 30fe31c..2d18ff7 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 _0x43c2=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','delete','destroy'];(function(_0x3bcc3f,_0x56eb31){var _0x147932=function(_0x354576){while(--_0x354576){_0x3bcc3f['push'](_0x3bcc3f['shift']());}};_0x147932(++_0x56eb31);}(_0x43c2,0x1a4));var _0x243c=function(_0x3f91fd,_0x272c55){_0x3f91fd=_0x3f91fd-0x0;var _0x845c95=_0x43c2[_0x3f91fd];return _0x845c95;};'use strict';var multer=require(_0x243c('0x0'));var util=require(_0x243c('0x1'));var path=require(_0x243c('0x2'));var timeout=require('connect-timeout');var express=require(_0x243c('0x3'));var router=express[_0x243c('0x4')]();var auth=require(_0x243c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x243c('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x243c('0x7')]('/',auth[_0x243c('0x8')](),controller[_0x243c('0x9')]);router['get'](_0x243c('0xa'),auth['isAuthenticated'](),controller[_0x243c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x243c('0xc')](_0x243c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x243c('0xd')](_0x243c('0xa'),auth[_0x243c('0x8')](),controller[_0x243c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd174=['/:id','isAuthenticated','show','post','create','put','delete','util','connect-timeout','express','../../components/interaction/service','./voiceQueuesLog.controller','get','index'];(function(_0x4e267d,_0x289a2f){var _0x507a59=function(_0x36d6b9){while(--_0x36d6b9){_0x4e267d['push'](_0x4e267d['shift']());}};_0x507a59(++_0x289a2f);}(_0xd174,0xd9));var _0x4d17=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd174[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x4d17('0x0'));var path=require('path');var timeout=require(_0x4d17('0x1'));var express=require(_0x4d17('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4d17('0x3'));var config=require('../../config/environment');var controller=require(_0x4d17('0x4'));router[_0x4d17('0x5')]('/',auth['isAuthenticated'](),controller[_0x4d17('0x6')]);router[_0x4d17('0x5')](_0x4d17('0x7'),auth[_0x4d17('0x8')](),controller[_0x4d17('0x9')]);router[_0x4d17('0xa')]('/',auth[_0x4d17('0x8')](),controller[_0x4d17('0xb')]);router[_0x4d17('0xc')]('/:id',auth[_0x4d17('0x8')](),controller['update']);router[_0x4d17('0xd')](_0x4d17('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index fe8d211..71c043d 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 _0x917a=['YYYY-MM-DD\x20HH:mm:ss','exports','STRING','DATE','format'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x917a,0x173));var _0xa917=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x917a[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xa917('0x0')]={'time':{'type':Sequelize[_0xa917('0x1')]},'callid':{'type':Sequelize[_0xa917('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa917('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa917('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa917('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa917('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa917('0x2')],'allowNull':![],'defaultValue':moment()[_0xa917('0x3')](_0xa917('0x4'))}}; \ No newline at end of file +var _0xae1f=['exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x4b66bb,_0x397857){var _0x563d27=function(_0x2c5635){while(--_0x2c5635){_0x4b66bb['push'](_0x4b66bb['shift']());}};_0x563d27(++_0x397857);}(_0xae1f,0x178));var _0xfae1=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xae1f[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require(_0xfae1('0x0'));var moment=require(_0xfae1('0x1'));module[_0xfae1('0x2')]={'time':{'type':Sequelize[_0xfae1('0x3')]},'callid':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfae1('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xfae1('0x4')](_0xfae1('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 813b3c0..3efae62 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 _0x404f=['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','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x404f,0x116));var _0xf404=function(_0x3b1f56,_0x1ddd65){_0x3b1f56=_0x3b1f56-0x0;var _0xe8288c=_0x404f[_0x3b1f56];return _0xe8288c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf404('0x0'));var rp=require(_0xf404('0x1'));var moment=require(_0xf404('0x2'));var BPromise=require(_0xf404('0x3'));var Mustache=require('mustache');var util=require(_0xf404('0x4'));var path=require(_0xf404('0x5'));var sox=require(_0xf404('0x6'));var csv=require(_0xf404('0x7'));var ejs=require(_0xf404('0x8'));var fs=require('fs');var _=require(_0xf404('0x9'));var squel=require(_0xf404('0xa'));var crypto=require('crypto');var jsforce=require(_0xf404('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf404('0x7'));var querystring=require(_0xf404('0xc'));var Papa=require(_0xf404('0xd'));var Redis=require(_0xf404('0xe'));var authService=require(_0xf404('0xf'));var qs=require(_0xf404('0x10'));var as=require(_0xf404('0x11'));var hardwareService=require(_0xf404('0x12'));var logger=require('../../config/logger')(_0xf404('0x13'));var utils=require(_0xf404('0x14'));var config=require(_0xf404('0x15'));var licenseUtil=require(_0xf404('0x16'));var db=require(_0xf404('0x17'))['db'];function respondWithStatusCode(_0x1a3366,_0x17639c){_0x17639c=_0x17639c||0xcc;return function(_0x1a0358){if(_0x1a0358){return _0x1a3366[_0xf404('0x18')](_0x17639c);}return _0x1a3366[_0xf404('0x19')](_0x17639c)[_0xf404('0x1a')]();};}function respondWithResult(_0x4e78bc,_0x32ef8e){_0x32ef8e=_0x32ef8e||0xc8;return function(_0x45a9e6){if(_0x45a9e6){return _0x4e78bc[_0xf404('0x19')](_0x32ef8e)[_0xf404('0x1b')](_0x45a9e6);}};}function respondWithFilteredResult(_0x35b453,_0x1bc880){return function(_0x2b6635){if(_0x2b6635){var _0x2ba55a=_0x2b6635[_0xf404('0x1c')],_0x397f5f=_0x1bc880['offset'],_0x2c04bd=_0x1bc880[_0xf404('0x1d')]+_0x1bc880['limit'],_0x1827b5;if(_0x2c04bd>=_0x2ba55a){_0x2c04bd=_0x2ba55a;_0x1827b5=0xc8;}else{_0x1827b5=0xce;}_0x35b453['status'](_0x1827b5);return _0x35b453[_0xf404('0x1e')](_0xf404('0x1f'),_0x397f5f+'-'+_0x2c04bd+'/'+_0x2ba55a)[_0xf404('0x1b')](_0x2b6635);}return null;};}function patchUpdates(_0x2d0a83){return function(_0x30372e){try{jsonpatch[_0xf404('0x20')](_0x30372e,_0x2d0a83,!![]);}catch(_0x41c32e){return BPromise['reject'](_0x41c32e);}return _0x30372e[_0xf404('0x21')]();};}function saveUpdates(_0x2ea46e,_0x211bfa){return function(_0xee579c){if(_0xee579c){return _0xee579c[_0xf404('0x22')](_0x2ea46e)[_0xf404('0x23')](function(_0x456600){return _0x456600;});}return null;};}function removeEntity(_0x20eb2b,_0x5e3d4b){return function(_0x4a209c){if(_0x4a209c){return _0x4a209c[_0xf404('0x24')]()['then'](function(){_0x20eb2b[_0xf404('0x19')](0xcc)[_0xf404('0x1a')]();});}};}function handleEntityNotFound(_0x1d5e2c,_0x192897){return function(_0x44d2a7){if(!_0x44d2a7){_0x1d5e2c[_0xf404('0x18')](0x194);}return _0x44d2a7;};}function handleError(_0x27e3a6,_0x31a1c1){_0x31a1c1=_0x31a1c1||0x1f4;return function(_0x41335d){logger[_0xf404('0x25')](_0x41335d[_0xf404('0x26')]);if(_0x41335d[_0xf404('0x27')]){delete _0x41335d[_0xf404('0x27')];}_0x27e3a6['status'](_0x31a1c1)[_0xf404('0x28')](_0x41335d);};}exports[_0xf404('0x29')]=function(_0x239fc2,_0x5b3d61){var _0xc1da2e={},_0x213cef={},_0x3ccc0b={'count':0x0,'rows':[]};var _0x389643=_[_0xf404('0x2a')](db[_0xf404('0x2b')][_0xf404('0x2c')],function(_0x33e371){return{'name':_0x33e371['fieldName'],'type':_0x33e371['type']['key']};});_0x213cef[_0xf404('0x2d')]=_[_0xf404('0x2a')](_0x389643,_0xf404('0x27'));_0x213cef[_0xf404('0x2e')]=_[_0xf404('0x2f')](_0x239fc2[_0xf404('0x2e')]);_0x213cef[_0xf404('0x30')]=_[_0xf404('0x31')](_0x213cef[_0xf404('0x2d')],_0x213cef[_0xf404('0x2e')]);_0xc1da2e[_0xf404('0x32')]=_['intersection'](_0x213cef['model'],qs[_0xf404('0x33')](_0x239fc2[_0xf404('0x2e')][_0xf404('0x33')]));_0xc1da2e[_0xf404('0x32')]=_0xc1da2e[_0xf404('0x32')][_0xf404('0x34')]?_0xc1da2e['attributes']:_0x213cef['model'];if(!_0x239fc2[_0xf404('0x2e')][_0xf404('0x35')](_0xf404('0x36'))){_0xc1da2e[_0xf404('0x37')]=qs[_0xf404('0x37')](_0x239fc2[_0xf404('0x2e')][_0xf404('0x37')]);_0xc1da2e[_0xf404('0x1d')]=qs[_0xf404('0x1d')](_0x239fc2[_0xf404('0x2e')][_0xf404('0x1d')]);}_0xc1da2e['order']=qs[_0xf404('0x38')](_0x239fc2[_0xf404('0x2e')][_0xf404('0x38')]);_0xc1da2e[_0xf404('0x39')]=qs[_0xf404('0x30')](_[_0xf404('0x3a')](_0x239fc2['query'],_0x213cef[_0xf404('0x30')]),_0x389643);if(_0x239fc2['query'][_0xf404('0x3b')]){_0xc1da2e[_0xf404('0x39')]=_[_0xf404('0x3c')](_0xc1da2e['where'],{'$or':_[_0xf404('0x2a')](_0x389643,function(_0x521fe7){if(_0x521fe7['type']!==_0xf404('0x3d')){var _0x2a389d={};_0x2a389d[_0x521fe7[_0xf404('0x27')]]={'$like':'%'+_0x239fc2[_0xf404('0x2e')][_0xf404('0x3b')]+'%'};return _0x2a389d;}})});}_0xc1da2e=_[_0xf404('0x3c')]({},_0xc1da2e,_0x239fc2[_0xf404('0x3e')]);var _0x4eeced={'where':_0xc1da2e[_0xf404('0x39')]};return db[_0xf404('0x2b')][_0xf404('0x1c')](_0x4eeced)[_0xf404('0x23')](function(_0x24aa11){_0x3ccc0b[_0xf404('0x1c')]=_0x24aa11;if(_0x239fc2[_0xf404('0x2e')][_0xf404('0x3f')]){_0xc1da2e[_0xf404('0x40')]=[{'all':!![]}];}return db[_0xf404('0x2b')][_0xf404('0x41')](_0xc1da2e);})[_0xf404('0x23')](function(_0x23d343){_0x3ccc0b[_0xf404('0x42')]=_0x23d343;return _0x3ccc0b;})[_0xf404('0x23')](respondWithFilteredResult(_0x5b3d61,_0xc1da2e))[_0xf404('0x43')](handleError(_0x5b3d61,null));};exports[_0xf404('0x44')]=function(_0xc589fb,_0x387e34){var _0x34a6cf={'raw':!![],'where':{'id':_0xc589fb[_0xf404('0x45')]['id']}},_0x5e6fd1={};_0x5e6fd1['model']=_['keys'](db[_0xf404('0x2b')][_0xf404('0x2c')]);_0x5e6fd1[_0xf404('0x2e')]=_['keys'](_0xc589fb[_0xf404('0x2e')]);_0x5e6fd1[_0xf404('0x30')]=_[_0xf404('0x31')](_0x5e6fd1[_0xf404('0x2d')],_0x5e6fd1[_0xf404('0x2e')]);_0x34a6cf['attributes']=_[_0xf404('0x31')](_0x5e6fd1[_0xf404('0x2d')],qs[_0xf404('0x33')](_0xc589fb['query'][_0xf404('0x33')]));_0x34a6cf[_0xf404('0x32')]=_0x34a6cf['attributes']['length']?_0x34a6cf[_0xf404('0x32')]:_0x5e6fd1[_0xf404('0x2d')];if(_0xc589fb[_0xf404('0x2e')]['includeAll']){_0x34a6cf[_0xf404('0x40')]=[{'all':!![]}];}_0x34a6cf=_[_0xf404('0x3c')]({},_0x34a6cf,_0xc589fb[_0xf404('0x3e')]);return db[_0xf404('0x2b')][_0xf404('0x46')](_0x34a6cf)[_0xf404('0x23')](handleEntityNotFound(_0x387e34,null))[_0xf404('0x23')](respondWithResult(_0x387e34,null))['catch'](handleError(_0x387e34,null));};exports[_0xf404('0x47')]=function(_0x4bc613,_0x218cc2){return db['VoiceQueuesLog']['create'](_0x4bc613['body'],{})[_0xf404('0x23')](respondWithResult(_0x218cc2,0xc9))[_0xf404('0x43')](handleError(_0x218cc2,null));};exports[_0xf404('0x22')]=function(_0x324fd2,_0xf236af){if(_0x324fd2[_0xf404('0x48')]['id']){delete _0x324fd2[_0xf404('0x48')]['id'];}return db[_0xf404('0x2b')]['find']({'where':{'id':_0x324fd2[_0xf404('0x45')]['id']}})['then'](handleEntityNotFound(_0xf236af,null))[_0xf404('0x23')](saveUpdates(_0x324fd2[_0xf404('0x48')],null))[_0xf404('0x23')](respondWithResult(_0xf236af,null))[_0xf404('0x43')](handleError(_0xf236af,null));};exports[_0xf404('0x24')]=function(_0x2b341a,_0x3e5c1b){return db['VoiceQueuesLog'][_0xf404('0x46')]({'where':{'id':_0x2b341a[_0xf404('0x45')]['id']}})[_0xf404('0x23')](handleEntityNotFound(_0x3e5c1b,null))['then'](removeEntity(_0x3e5c1b,null))[_0xf404('0x43')](handleError(_0x3e5c1b,null));}; \ No newline at end of file +var _0x2569=['where','pick','filter','merge','type','VIRTUAL','count','include','findAll','catch','params','rawAttributes','filters','length','includeAll','find','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','map','VoiceQueuesLog','fieldName','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x5db0ef,_0x5a6459){var _0x514e1e=function(_0x3da188){while(--_0x3da188){_0x5db0ef['push'](_0x5db0ef['shift']());}};_0x514e1e(++_0x5a6459);}(_0x2569,0x99));var _0x9256=function(_0x29228b,_0x4801be){_0x29228b=_0x29228b-0x0;var _0x2acdce=_0x2569[_0x29228b];return _0x2acdce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9256('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9256('0x1'));var rp=require(_0x9256('0x2'));var moment=require(_0x9256('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9256('0x4'));var util=require(_0x9256('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9256('0x6'));var ejs=require(_0x9256('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9256('0x8'));var crypto=require(_0x9256('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9256('0x6'));var querystring=require('querystring');var Papa=require(_0x9256('0xa'));var Redis=require(_0x9256('0xb'));var authService=require(_0x9256('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x9256('0xd'));var hardwareService=require(_0x9256('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x9256('0xf'));var config=require(_0x9256('0x10'));var licenseUtil=require(_0x9256('0x11'));var db=require(_0x9256('0x12'))['db'];function respondWithStatusCode(_0xbbec1f,_0x343083){_0x343083=_0x343083||0xcc;return function(_0xa8a426){if(_0xa8a426){return _0xbbec1f[_0x9256('0x13')](_0x343083);}return _0xbbec1f[_0x9256('0x14')](_0x343083)[_0x9256('0x15')]();};}function respondWithResult(_0x1a57fe,_0x25b7c2){_0x25b7c2=_0x25b7c2||0xc8;return function(_0x27c56f){if(_0x27c56f){return _0x1a57fe[_0x9256('0x14')](_0x25b7c2)[_0x9256('0x16')](_0x27c56f);}};}function respondWithFilteredResult(_0x529ac9,_0x471cf9){return function(_0x2df6fb){if(_0x2df6fb){var _0x44821b=_0x2df6fb['count'],_0x36c442=_0x471cf9[_0x9256('0x17')],_0x2e4203=_0x471cf9['offset']+_0x471cf9[_0x9256('0x18')],_0x36ec4b;if(_0x2e4203>=_0x44821b){_0x2e4203=_0x44821b;_0x36ec4b=0xc8;}else{_0x36ec4b=0xce;}_0x529ac9[_0x9256('0x14')](_0x36ec4b);return _0x529ac9[_0x9256('0x19')](_0x9256('0x1a'),_0x36c442+'-'+_0x2e4203+'/'+_0x44821b)[_0x9256('0x16')](_0x2df6fb);}return null;};}function patchUpdates(_0x3f87be){return function(_0x26a601){try{jsonpatch['apply'](_0x26a601,_0x3f87be,!![]);}catch(_0x22c0e3){return BPromise[_0x9256('0x1b')](_0x22c0e3);}return _0x26a601[_0x9256('0x1c')]();};}function saveUpdates(_0x2ac4e0,_0x2aa996){return function(_0x51e6b2){if(_0x51e6b2){return _0x51e6b2[_0x9256('0x1d')](_0x2ac4e0)[_0x9256('0x1e')](function(_0x2e15ee){return _0x2e15ee;});}return null;};}function removeEntity(_0x23c491,_0x40bf6e){return function(_0x1b8a42){if(_0x1b8a42){return _0x1b8a42['destroy']()['then'](function(){_0x23c491[_0x9256('0x14')](0xcc)[_0x9256('0x15')]();});}};}function handleEntityNotFound(_0x30d854,_0x31526e){return function(_0x586c8d){if(!_0x586c8d){_0x30d854[_0x9256('0x13')](0x194);}return _0x586c8d;};}function handleError(_0xf740df,_0x5db28a){_0x5db28a=_0x5db28a||0x1f4;return function(_0x3c9552){logger['error'](_0x3c9552[_0x9256('0x1f')]);if(_0x3c9552[_0x9256('0x20')]){delete _0x3c9552[_0x9256('0x20')];}_0xf740df[_0x9256('0x14')](_0x5db28a)[_0x9256('0x21')](_0x3c9552);};}exports[_0x9256('0x22')]=function(_0x20a0db,_0x4fdc44){var _0x10004f={},_0x4bdd6b={},_0x1a1997={'count':0x0,'rows':[]};var _0x3f075e=_[_0x9256('0x23')](db[_0x9256('0x24')]['rawAttributes'],function(_0x550b15){return{'name':_0x550b15[_0x9256('0x25')],'type':_0x550b15['type'][_0x9256('0x26')]};});_0x4bdd6b[_0x9256('0x27')]=_[_0x9256('0x23')](_0x3f075e,_0x9256('0x20'));_0x4bdd6b['query']=_[_0x9256('0x28')](_0x20a0db[_0x9256('0x29')]);_0x4bdd6b['filters']=_['intersection'](_0x4bdd6b[_0x9256('0x27')],_0x4bdd6b[_0x9256('0x29')]);_0x10004f[_0x9256('0x2a')]=_[_0x9256('0x2b')](_0x4bdd6b[_0x9256('0x27')],qs[_0x9256('0x2c')](_0x20a0db['query'][_0x9256('0x2c')]));_0x10004f[_0x9256('0x2a')]=_0x10004f['attributes']['length']?_0x10004f[_0x9256('0x2a')]:_0x4bdd6b[_0x9256('0x27')];if(!_0x20a0db['query'][_0x9256('0x2d')](_0x9256('0x2e'))){_0x10004f[_0x9256('0x18')]=qs[_0x9256('0x18')](_0x20a0db[_0x9256('0x29')][_0x9256('0x18')]);_0x10004f['offset']=qs[_0x9256('0x17')](_0x20a0db[_0x9256('0x29')][_0x9256('0x17')]);}_0x10004f[_0x9256('0x2f')]=qs['sort'](_0x20a0db['query']['sort']);_0x10004f[_0x9256('0x30')]=qs['filters'](_[_0x9256('0x31')](_0x20a0db[_0x9256('0x29')],_0x4bdd6b['filters']),_0x3f075e);if(_0x20a0db[_0x9256('0x29')][_0x9256('0x32')]){_0x10004f[_0x9256('0x30')]=_[_0x9256('0x33')](_0x10004f[_0x9256('0x30')],{'$or':_[_0x9256('0x23')](_0x3f075e,function(_0x16f896){if(_0x16f896[_0x9256('0x34')]!==_0x9256('0x35')){var _0x29270a={};_0x29270a[_0x16f896[_0x9256('0x20')]]={'$like':'%'+_0x20a0db['query'][_0x9256('0x32')]+'%'};return _0x29270a;}})});}_0x10004f=_['merge']({},_0x10004f,_0x20a0db['options']);var _0x525461={'where':_0x10004f[_0x9256('0x30')]};return db[_0x9256('0x24')][_0x9256('0x36')](_0x525461)[_0x9256('0x1e')](function(_0x6a0d40){_0x1a1997[_0x9256('0x36')]=_0x6a0d40;if(_0x20a0db[_0x9256('0x29')]['includeAll']){_0x10004f[_0x9256('0x37')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9256('0x38')](_0x10004f);})[_0x9256('0x1e')](function(_0x4e8a59){_0x1a1997['rows']=_0x4e8a59;return _0x1a1997;})['then'](respondWithFilteredResult(_0x4fdc44,_0x10004f))[_0x9256('0x39')](handleError(_0x4fdc44,null));};exports['show']=function(_0x503885,_0x302da4){var _0x48f9a9={'raw':!![],'where':{'id':_0x503885[_0x9256('0x3a')]['id']}},_0x542056={};_0x542056[_0x9256('0x27')]=_[_0x9256('0x28')](db[_0x9256('0x24')][_0x9256('0x3b')]);_0x542056['query']=_[_0x9256('0x28')](_0x503885['query']);_0x542056[_0x9256('0x3c')]=_[_0x9256('0x2b')](_0x542056['model'],_0x542056['query']);_0x48f9a9['attributes']=_[_0x9256('0x2b')](_0x542056[_0x9256('0x27')],qs[_0x9256('0x2c')](_0x503885[_0x9256('0x29')][_0x9256('0x2c')]));_0x48f9a9[_0x9256('0x2a')]=_0x48f9a9[_0x9256('0x2a')][_0x9256('0x3d')]?_0x48f9a9['attributes']:_0x542056[_0x9256('0x27')];if(_0x503885[_0x9256('0x29')][_0x9256('0x3e')]){_0x48f9a9[_0x9256('0x37')]=[{'all':!![]}];}_0x48f9a9=_[_0x9256('0x33')]({},_0x48f9a9,_0x503885['options']);return db['VoiceQueuesLog'][_0x9256('0x3f')](_0x48f9a9)['then'](handleEntityNotFound(_0x302da4,null))[_0x9256('0x1e')](respondWithResult(_0x302da4,null))[_0x9256('0x39')](handleError(_0x302da4,null));};exports[_0x9256('0x40')]=function(_0x227b2a,_0x116925){return db[_0x9256('0x24')][_0x9256('0x40')](_0x227b2a[_0x9256('0x41')],{})[_0x9256('0x1e')](respondWithResult(_0x116925,0xc9))[_0x9256('0x39')](handleError(_0x116925,null));};exports[_0x9256('0x1d')]=function(_0x1b54fb,_0x3aecb5){if(_0x1b54fb[_0x9256('0x41')]['id']){delete _0x1b54fb[_0x9256('0x41')]['id'];}return db[_0x9256('0x24')][_0x9256('0x3f')]({'where':{'id':_0x1b54fb[_0x9256('0x3a')]['id']}})[_0x9256('0x1e')](handleEntityNotFound(_0x3aecb5,null))['then'](saveUpdates(_0x1b54fb['body'],null))[_0x9256('0x1e')](respondWithResult(_0x3aecb5,null))[_0x9256('0x39')](handleError(_0x3aecb5,null));};exports[_0x9256('0x42')]=function(_0x5c0e4a,_0x3130d4){return db[_0x9256('0x24')]['find']({'where':{'id':_0x5c0e4a['params']['id']}})[_0x9256('0x1e')](handleEntityNotFound(_0x3130d4,null))[_0x9256('0x1e')](removeEntity(_0x3130d4,null))[_0x9256('0x39')](handleError(_0x3130d4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2a2bee4..afb091a 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 _0x6925=['moment','bluebird','path','rimraf','../../config/environment','exports','define','voice_queues_log','event','dtm','lodash','../../config/logger','api'];(function(_0x244520,_0x1b8380){var _0x348e09=function(_0x41ac31){while(--_0x41ac31){_0x244520['push'](_0x244520['shift']());}};_0x348e09(++_0x1b8380);}(_0x6925,0xb3));var _0x5692=function(_0x399af4,_0x3c847c){_0x399af4=_0x399af4-0x0;var _0x5115ea=_0x6925[_0x399af4];return _0x5115ea;};'use strict';var _=require(_0x5692('0x0'));var util=require('util');var logger=require(_0x5692('0x1'))(_0x5692('0x2'));var moment=require(_0x5692('0x3'));var BPromise=require(_0x5692('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5692('0x5'));var rimraf=require(_0x5692('0x6'));var config=require(_0x5692('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x5692('0x8')]=function(_0x53cb73,_0x2de65e){return _0x53cb73[_0x5692('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x5692('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x5692('0xb'),_0x5692('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5aa8=['path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5aa8,0x15a));var _0x85aa=function(_0x551884,_0x477a52){_0x551884=_0x551884-0x0;var _0x50b4b0=_0x5aa8[_0x551884];return _0x50b4b0;};'use strict';var _=require(_0x85aa('0x0'));var util=require('util');var logger=require(_0x85aa('0x1'))(_0x85aa('0x2'));var moment=require(_0x85aa('0x3'));var BPromise=require(_0x85aa('0x4'));var rp=require(_0x85aa('0x5'));var fs=require('fs');var path=require(_0x85aa('0x6'));var rimraf=require(_0x85aa('0x7'));var config=require(_0x85aa('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x85aa('0x9')]=function(_0xa399a5,_0x325345){return _0xa399a5[_0x85aa('0xa')](_0x85aa('0xb'),attributes,{'tableName':_0x85aa('0xc'),'paranoid':![],'indexes':[{'name':_0x85aa('0xd'),'fields':[_0x85aa('0xe'),_0x85aa('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e8d1982..806dfd1 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 _0x2f3a=['http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x5a58ee,_0x199e4f){var _0x3ff64a=function(_0x35c35d){while(--_0x35c35d){_0x5a58ee['push'](_0x5a58ee['shift']());}};_0x3ff64a(++_0x199e4f);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x4776bf,_0x1fa921){_0x4776bf=_0x4776bf-0x0;var _0x4c51e6=_0x2f3a[_0x4776bf];return _0x4c51e6;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db21d,_0x521ddf,_0x2faf36){return new BPromise(function(_0x3944a0,_0x4405a2){return client[_0xa2f3('0xa')](_0x4db21d,_0x2faf36)['then'](function(_0x358263){logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));logger[_0xa2f3('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x521ddf,_0xa2f3('0xd'),JSON[_0xa2f3('0xf')](_0x358263));if(_0x358263['error']){if(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x11')]===0x1f4){logger[_0xa2f3('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x4405a2(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);}logger[_0xa2f3('0x10')](_0xa2f3('0xc'),_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x3944a0(_0x358263[_0xa2f3('0x10')]['message']);}else{logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));_0x3944a0(_0x358263['result'][_0xa2f3('0x12')]);}})[_0xa2f3('0x13')](function(_0x4b138b){logger['error'](_0xa2f3('0xc'),_0x521ddf,_0x4b138b);_0x4405a2(_0x4b138b);});});} \ No newline at end of file +var _0x6582=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6582,0x108));var _0x2658=function(_0x3ed0ec,_0x44ece7){_0x3ed0ec=_0x3ed0ec-0x0;var _0x4b32f4=_0x6582[_0x3ed0ec];return _0x4b32f4;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb94f,_0x3f53e7,_0x443df){return new BPromise(function(_0x412a9f,_0x52ef38){return client[_0x2658('0xa')](_0x2cb94f,_0x443df)[_0x2658('0xb')](function(_0x426744){logger[_0x2658('0xc')](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));logger[_0x2658('0xf')](_0x2658('0x10'),_0x3f53e7,_0x2658('0xe'),JSON['stringify'](_0x426744));if(_0x426744[_0x2658('0x11')]){if(_0x426744['error'][_0x2658('0x12')]===0x1f4){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x52ef38(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}logger['error'](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x412a9f(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}else{logger['info'](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));_0x412a9f(_0x426744[_0x2658('0x14')]['message']);}})[_0x2658('0x15')](function(_0x44c6d2){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x44c6d2);_0x52ef38(_0x44c6d2);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 2846a55..b547272 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 _0x3654=['post','create','/:id/transcribe','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','/describe','describe','show','get','/:id/download','download','downloads'];(function(_0x42f2f9,_0x5d1cfb){var _0x306b0a=function(_0xccfce){while(--_0xccfce){_0x42f2f9['push'](_0x42f2f9['shift']());}};_0x306b0a(++_0x5d1cfb);}(_0x3654,0xaa));var _0x4365=function(_0x233aa3,_0x3312d1){_0x233aa3=_0x233aa3-0x0;var _0x1eee51=_0x3654[_0x233aa3];return _0x1eee51;};'use strict';var multer=require('multer');var util=require(_0x4365('0x0'));var path=require(_0x4365('0x1'));var timeout=require(_0x4365('0x2'));var express=require(_0x4365('0x3'));var router=express[_0x4365('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4365('0x5'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x4365('0x6')](),controller['index']);router['get'](_0x4365('0x7'),auth[_0x4365('0x6')](),controller[_0x4365('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4365('0x9')]);router[_0x4365('0xa')](_0x4365('0xb'),auth[_0x4365('0x6')](),controller[_0x4365('0xc')]);router['get']('/:id/downloads',controller[_0x4365('0xd')]);router[_0x4365('0xa')]('/:id/transcribe',auth[_0x4365('0x6')](),controller['downloadTranscribe']);router[_0x4365('0xe')]('/',auth[_0x4365('0x6')](),controller[_0x4365('0xf')]);router[_0x4365('0xe')](_0x4365('0x10'),auth[_0x4365('0x6')](),controller['runTranscribe']);router[_0x4365('0x11')]('/:id',auth[_0x4365('0x6')](),controller[_0x4365('0x12')]);router[_0x4365('0x13')](_0x4365('0x14'),auth['isAuthenticated'](),controller[_0x4365('0x15')]);module[_0x4365('0x16')]=router; \ No newline at end of file +var _0x7487=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','runTranscribe','update','delete'];(function(_0xbe96bf,_0x5f07d5){var _0xa80a06=function(_0x5dc3be){while(--_0x5dc3be){_0xbe96bf['push'](_0xbe96bf['shift']());}};_0xa80a06(++_0x5f07d5);}(_0x7487,0x1b7));var _0x7748=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7487[_0x4154a6];return _0x3b2786;};'use strict';var multer=require('multer');var util=require(_0x7748('0x0'));var path=require(_0x7748('0x1'));var timeout=require(_0x7748('0x2'));var express=require(_0x7748('0x3'));var router=express['Router']();var auth=require(_0x7748('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7748('0x5'));router[_0x7748('0x6')]('/',auth[_0x7748('0x7')](),controller[_0x7748('0x8')]);router[_0x7748('0x6')](_0x7748('0x9'),auth[_0x7748('0x7')](),controller[_0x7748('0xa')]);router[_0x7748('0x6')](_0x7748('0xb'),auth[_0x7748('0x7')](),controller[_0x7748('0xc')]);router[_0x7748('0x6')](_0x7748('0xd'),auth[_0x7748('0x7')](),controller[_0x7748('0xe')]);router[_0x7748('0x6')]('/:id/downloads',controller[_0x7748('0xf')]);router[_0x7748('0x6')](_0x7748('0x10'),auth[_0x7748('0x7')](),controller[_0x7748('0x11')]);router['post']('/',auth[_0x7748('0x7')](),controller['create']);router['post'](_0x7748('0x10'),auth[_0x7748('0x7')](),controller[_0x7748('0x12')]);router['put'](_0x7748('0xb'),auth['isAuthenticated'](),controller[_0x7748('0x13')]);router[_0x7748('0x14')]('/:id',auth[_0x7748('0x7')](),controller[_0x7748('0x15')]);module[_0x7748('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5735e95..a9bc76d 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 _0xcb3d=['MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','exports','extname','getDataValue','value','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xcb3d,0xd5));var _0xdcb3=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0xcb3d[_0x1895b7];return _0x1aecdc;};'use strict';var Sequelize=require(_0xdcb3('0x0'));var moment=require('moment');var path=require('path');module[_0xdcb3('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0xdcb3('0x2')](this[_0xdcb3('0x3')](_0xdcb3('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0xdcb3('0x5')]},'channel':{'type':Sequelize[_0xdcb3('0x5')],'set':function(_0x1017d8){if(_0x1017d8){this[_0xdcb3('0x6')](_0xdcb3('0x7'),_0x1017d8);this[_0xdcb3('0x6')](_0xdcb3('0x8'),_0x1017d8[_0xdcb3('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xdcb3('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdcb3('0x5')]},'connectedlinenum':{'type':Sequelize[_0xdcb3('0x5')]},'connectedlinename':{'type':Sequelize[_0xdcb3('0x5')]},'accountcode':{'type':Sequelize[_0xdcb3('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xdcb3('0x5')]},'value':{'type':Sequelize[_0xdcb3('0x5')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xdcb3('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xdcb3('0x5')]},'userDisposition':{'type':Sequelize[_0xdcb3('0x5')]},'userSecondDisposition':{'type':Sequelize[_0xdcb3('0x5')]},'userThirdDisposition':{'type':Sequelize[_0xdcb3('0x5')]},'location':{'type':Sequelize[_0xdcb3('0xb')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0xdcb3('0x5')],'defaultValue':_0xdcb3('0xc')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xdcb3('0xb')]},'failureReason':{'type':Sequelize[_0xdcb3('0xb')]},'sentiment':{'type':Sequelize[_0xdcb3('0x5')]},'sPositive':{'type':Sequelize[_0xdcb3('0xd')]},'sNegative':{'type':Sequelize[_0xdcb3('0xd')]},'sNeutral':{'type':Sequelize[_0xdcb3('0xd')]},'sMixed':{'type':Sequelize[_0xdcb3('0xd')]},'tempSentiment':{'type':Sequelize[_0xdcb3('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xdcb3('0xf')],'get':function(){return moment(this[_0xdcb3('0x3')](_0xdcb3('0x10')))[_0xdcb3('0x11')](_0xdcb3('0x12'))[_0xdcb3('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xdcb3('0x14')))[_0xdcb3('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xcdf6=['value','STRING','setDataValue','channel','split','INTEGER','NEW','TEXT','FLOAT','BOOLEAN','DATE','getDataValue','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','path','exports','VIRTUAL','extname'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0xcdf6,0x1df));var _0x6cdf=function(_0x1b5f4d,_0x5899b3){_0x1b5f4d=_0x1b5f4d-0x0;var _0x5d17ce=_0xcdf6[_0x1b5f4d];return _0x5d17ce;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x6cdf('0x0'));module[_0x6cdf('0x1')]={'format':{'type':Sequelize[_0x6cdf('0x2')],'get':function(){return this['getDataValue']('value')?path[_0x6cdf('0x3')](this['getDataValue'](_0x6cdf('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x6cdf('0x5')]},'channel':{'type':Sequelize[_0x6cdf('0x5')],'set':function(_0x23188e){if(_0x23188e){this[_0x6cdf('0x6')](_0x6cdf('0x7'),_0x23188e);this[_0x6cdf('0x6')]('membername',_0x23188e[_0x6cdf('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x6cdf('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6cdf('0x5')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6cdf('0x5')]},'accountcode':{'type':Sequelize[_0x6cdf('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6cdf('0x5')]},'rating':{'type':Sequelize[_0x6cdf('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x6cdf('0x5')]},'userDisposition':{'type':Sequelize[_0x6cdf('0x5')]},'userSecondDisposition':{'type':Sequelize[_0x6cdf('0x5')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x6cdf('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x6cdf('0xb')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0x6cdf('0xc')]},'sNegative':{'type':Sequelize[_0x6cdf('0xc')]},'sNeutral':{'type':Sequelize[_0x6cdf('0xc')]},'sMixed':{'type':Sequelize[_0x6cdf('0xc')]},'tempSentiment':{'type':Sequelize[_0x6cdf('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x6cdf('0xe')],'get':function(){return moment(this[_0x6cdf('0xf')](_0x6cdf('0x10')))[_0x6cdf('0x11')](_0x6cdf('0x12'))[_0x6cdf('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6cdf('0xf')](_0x6cdf('0x14')))[_0x6cdf('0x11')](_0x6cdf('0x12'))[_0x6cdf('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index c8f97ee..8f322a4 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 _0x68ff=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','name','VoiceRecording','rawAttributes','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','secrets','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','send','Not\x20found','MD5','col','token','$and','push','decryptFile','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeRegion','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','language','IN_PROGRESS','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x68ff,0x10c));var _0xf68f=function(_0x5b3507,_0x3541ec){_0x5b3507=_0x5b3507-0x0;var _0x4cd24e=_0x68ff[_0x5b3507];return _0x4cd24e;};'use strict';var pdf=require(_0xf68f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf68f('0x1'));var jsonpatch=require(_0xf68f('0x2'));var rp=require('request-promise');var moment=require(_0xf68f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf68f('0x4'));var util=require(_0xf68f('0x5'));var path=require(_0xf68f('0x6'));var sox=require(_0xf68f('0x7'));var csv=require('to-csv');var ejs=require(_0xf68f('0x8'));var fs=require('fs');var _=require(_0xf68f('0x9'));var squel=require('squel');var crypto=require(_0xf68f('0xa'));var jsforce=require(_0xf68f('0xb'));var deskjs=require(_0xf68f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf68f('0xd'));var Papa=require(_0xf68f('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xf68f('0xf'));var Redis=require('ioredis');var authService=require(_0xf68f('0x10'));var qs=require(_0xf68f('0x11'));var as=require(_0xf68f('0x12'));var hardwareService=require(_0xf68f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf68f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf68f('0x15'))['db'];function respondWithStatusCode(_0x574e79,_0x16d6c5){_0x16d6c5=_0x16d6c5||0xcc;return function(_0x77b5ce){if(_0x77b5ce){return _0x574e79[_0xf68f('0x16')](_0x16d6c5);}return _0x574e79[_0xf68f('0x17')](_0x16d6c5)['end']();};}function respondWithResult(_0x19539d,_0x3a2352){_0x3a2352=_0x3a2352||0xc8;return function(_0x2c083a){if(_0x2c083a){return _0x19539d[_0xf68f('0x17')](_0x3a2352)[_0xf68f('0x18')](_0x2c083a);}};}function respondWithFilteredResult(_0x4dd17c,_0x38ee52){return function(_0x528ba0){if(_0x528ba0){var _0x3f19a6=_0x528ba0[_0xf68f('0x19')],_0x5bd388=_0x38ee52[_0xf68f('0x1a')],_0x50eb13=_0x38ee52[_0xf68f('0x1a')]+_0x38ee52[_0xf68f('0x1b')],_0x4bda68;if(_0x50eb13>=_0x3f19a6){_0x50eb13=_0x3f19a6;_0x4bda68=0xc8;}else{_0x4bda68=0xce;}_0x4dd17c[_0xf68f('0x17')](_0x4bda68);return _0x4dd17c['set'](_0xf68f('0x1c'),_0x5bd388+'-'+_0x50eb13+'/'+_0x3f19a6)['json'](_0x528ba0);}return null;};}function patchUpdates(_0x238000){return function(_0x368107){try{jsonpatch[_0xf68f('0x1d')](_0x368107,_0x238000,!![]);}catch(_0x3b751d){return BPromise[_0xf68f('0x1e')](_0x3b751d);}return _0x368107['save']();};}function saveUpdates(_0xfdefa9,_0x5173b1){return function(_0x3d9eb5){if(_0x3d9eb5){return _0x3d9eb5[_0xf68f('0x1f')](_0xfdefa9)['then'](function(_0x18438b){return _0x18438b;});}return null;};}function removeEntity(_0x39c29d,_0x5a6a36){return function(_0x4f79ed){if(_0x4f79ed){return _0x4f79ed[_0xf68f('0x20')]()[_0xf68f('0x21')](function(){_0x39c29d[_0xf68f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe78c6,_0x2180e1){return function(_0x37b170){if(!_0x37b170){_0xfe78c6[_0xf68f('0x16')](0x194);}return _0x37b170;};}function handleError(_0xbae0b8,_0x58d1d5){_0x58d1d5=_0x58d1d5||0x1f4;return function(_0x59b79c){logger[_0xf68f('0x22')](_0x59b79c['stack']);if(_0x59b79c['name']){delete _0x59b79c[_0xf68f('0x23')];}_0xbae0b8[_0xf68f('0x17')](_0x58d1d5)['send'](_0x59b79c);};}exports['index']=function(_0x498935,_0x2311c6){var _0x12050c={},_0x32839d={},_0x171091={'count':0x0,'rows':[]};var _0x106f51=_['map'](db[_0xf68f('0x24')][_0xf68f('0x25')],function(_0x2b8c63){return{'name':_0x2b8c63['fieldName'],'type':_0x2b8c63[_0xf68f('0x26')][_0xf68f('0x27')]};});_0x32839d[_0xf68f('0x28')]=_[_0xf68f('0x29')](_[_0xf68f('0x2a')](_0x106f51,'name'),['format']);_0x32839d[_0xf68f('0x2b')]=_[_0xf68f('0x2c')](_0x498935[_0xf68f('0x2b')]);_0x32839d[_0xf68f('0x2d')]=_[_0xf68f('0x2e')](_0x32839d['model'],_0x32839d[_0xf68f('0x2b')]);_0x12050c[_0xf68f('0x2f')]=_[_0xf68f('0x2e')](_0x32839d[_0xf68f('0x28')],qs[_0xf68f('0x30')](_0x498935[_0xf68f('0x2b')]['fields']));_0x12050c[_0xf68f('0x2f')]=_0x12050c['attributes'][_0xf68f('0x31')]?_0x12050c[_0xf68f('0x2f')]:_0x32839d[_0xf68f('0x28')];if(!_0x498935['query'][_0xf68f('0x32')](_0xf68f('0x33'))){_0x12050c['limit']=qs[_0xf68f('0x1b')](_0x498935[_0xf68f('0x2b')]['limit']);_0x12050c['offset']=qs[_0xf68f('0x1a')](_0x498935[_0xf68f('0x2b')]['offset']);}_0x12050c[_0xf68f('0x34')]=qs[_0xf68f('0x35')](_0x498935[_0xf68f('0x2b')][_0xf68f('0x35')]);_0x12050c[_0xf68f('0x36')]=qs[_0xf68f('0x2d')](_[_0xf68f('0x37')](_0x498935['query'],_0x32839d[_0xf68f('0x2d')]),_0x106f51);if(_0x498935[_0xf68f('0x2b')][_0xf68f('0x38')]){_0x12050c['where']=_[_0xf68f('0x39')](_0x12050c[_0xf68f('0x36')],{'$or':_[_0xf68f('0x2a')](_0x106f51,function(_0x195c1d){if(_0x195c1d[_0xf68f('0x26')]!==_0xf68f('0x3a')){var _0x229ce0={};_0x229ce0[_0x195c1d[_0xf68f('0x23')]]={'$like':'%'+_0x498935['query'][_0xf68f('0x38')]+'%'};return _0x229ce0;}})});}_0x12050c=_['merge']({},_0x12050c,_0x498935[_0xf68f('0x3b')]);var _0x9de7fc={'where':_0x12050c[_0xf68f('0x36')]};return db[_0xf68f('0x24')][_0xf68f('0x19')](_0x9de7fc)[_0xf68f('0x21')](function(_0x36061a){_0x171091[_0xf68f('0x19')]=_0x36061a;if(_0x498935[_0xf68f('0x2b')]['includeAll']){_0x12050c['include']=[{'all':!![]}];}return db[_0xf68f('0x24')][_0xf68f('0x3c')](_0x12050c);})[_0xf68f('0x21')](function(_0x250439){_0x171091[_0xf68f('0x3d')]=_0x250439;return _0x171091;})['then'](respondWithFilteredResult(_0x2311c6,_0x12050c))[_0xf68f('0x3e')](handleError(_0x2311c6,null));};exports[_0xf68f('0x3f')]=function(_0x84545,_0x4addc1){var _0x2ded2a={'raw':![],'where':{'id':_0x84545[_0xf68f('0x40')]['id']}},_0x5e12fd={};_0x5e12fd[_0xf68f('0x28')]=_[_0xf68f('0x2c')](db['VoiceRecording'][_0xf68f('0x25')]);_0x5e12fd[_0xf68f('0x2b')]=_[_0xf68f('0x2c')](_0x84545['query']);_0x5e12fd[_0xf68f('0x2d')]=_[_0xf68f('0x2e')](_0x5e12fd[_0xf68f('0x28')],_0x5e12fd[_0xf68f('0x2b')]);_0x2ded2a[_0xf68f('0x2f')]=_[_0xf68f('0x2e')](_0x5e12fd[_0xf68f('0x28')],qs['fields'](_0x84545[_0xf68f('0x2b')]['fields']));_0x2ded2a[_0xf68f('0x2f')]=_0x2ded2a[_0xf68f('0x2f')][_0xf68f('0x31')]?_0x2ded2a[_0xf68f('0x2f')]:_0x5e12fd[_0xf68f('0x28')];if(_0x84545[_0xf68f('0x2b')][_0xf68f('0x41')]){_0x2ded2a[_0xf68f('0x42')]=[{'all':!![]}];}_0x2ded2a=_[_0xf68f('0x39')]({},_0x2ded2a,_0x84545[_0xf68f('0x3b')]);return db['VoiceRecording']['find'](_0x2ded2a)['then'](handleEntityNotFound(_0x4addc1,null))[_0xf68f('0x21')](respondWithResult(_0x4addc1,null))[_0xf68f('0x3e')](handleError(_0x4addc1,null));};exports[_0xf68f('0x43')]=function(_0x57def2,_0x3905ff){return db['VoiceRecording'][_0xf68f('0x43')](_0x57def2[_0xf68f('0x44')],{})[_0xf68f('0x21')](respondWithResult(_0x3905ff,0xc9))[_0xf68f('0x3e')](handleError(_0x3905ff,null));};exports[_0xf68f('0x1f')]=function(_0x13d1ad,_0x125707){if(_0x13d1ad['body']['id']){delete _0x13d1ad['body']['id'];}return db[_0xf68f('0x24')][_0xf68f('0x45')]({'where':{'id':_0x13d1ad['params']['id']}})['then'](handleEntityNotFound(_0x125707,null))[_0xf68f('0x21')](saveUpdates(_0x13d1ad['body'],null))['then'](respondWithResult(_0x125707,null))[_0xf68f('0x3e')](handleError(_0x125707,null));};exports['describe']=function(_0x589189,_0x1de881){return db[_0xf68f('0x24')][_0xf68f('0x46')]()[_0xf68f('0x21')](respondWithResult(_0x1de881,null))[_0xf68f('0x3e')](handleError(_0x1de881,null));};exports['download']=function(_0x48e703,_0x2eae7a,_0xf0696b){var _0x1d9180=require(_0xf68f('0x47'));var _0x379cbd=![];var _0x954a0d={};if(_0x48e703[_0xf68f('0x2b')][_0xf68f('0x26')]&&_0x48e703[_0xf68f('0x2b')]['type']===_0xf68f('0x48')){_0x954a0d[_0xf68f('0x48')]=_0x48e703[_0xf68f('0x40')]['id'];}else{_0x954a0d['id']=_0x48e703[_0xf68f('0x40')]['id'];}return db[_0xf68f('0x24')][_0xf68f('0x45')]({'where':_0x954a0d,'attributes':['id',_0xf68f('0x49')],'raw':!![]})[_0xf68f('0x21')](handleEntityNotFound(_0x2eae7a,null))[_0xf68f('0x21')](function(_0x14585e){if(_0x14585e){var _0x5c3bc3=_0x14585e['value'];var _0x5235b8=util[_0xf68f('0x4a')](_0xf68f('0x4b'),_0x5c3bc3);if(fs['existsSync'](_0x5235b8)){_0x379cbd=!![];return _0x1d9180['decryptFile'](_0x5235b8,_0x5c3bc3,config[_0xf68f('0x4c')][_0xf68f('0x4d')])[_0xf68f('0x21')](function(){return _0x14585e;});}return _0x14585e;}})[_0xf68f('0x21')](function(_0xe2f88a){if(_0xe2f88a){var _0x9c534b=_0xe2f88a[_0xf68f('0x49')];if(!fs[_0xf68f('0x4e')](_0x9c534b)){throw new db[(_0xf68f('0x4f'))]['ValidationError'](_0xf68f('0x50'));}if(_0xe2f88a[_0xf68f('0x51')]){return _0x2eae7a['download'](_0x9c534b,_0xe2f88a[_0xf68f('0x51')]+path[_0xf68f('0x52')](_0x9c534b),function(){if(_0x379cbd){fs[_0xf68f('0x53')](_0x9c534b);}});}else{return _0x2eae7a[_0xf68f('0x54')](_0x9c534b,function(_0x387df9){if(_0x379cbd){fs['unlink'](_0x9c534b);}});}}})[_0xf68f('0x3e')](function(_0x49c2f7){if(_0x49c2f7[_0xf68f('0x55')]===_0xf68f('0x50')){_0x2eae7a[_0xf68f('0x17')](0x194)[_0xf68f('0x56')](_0xf68f('0x57'));}else{return handleError(_0x2eae7a,null);}});};exports['downloads']=function(_0x1a3f14,_0x4a61d3,_0x1786f7){var _0x42f860=require(_0xf68f('0x47'));var _0x55c2d3=![];var _0x3f3e58={'$and':[db['sequelize'][_0xf68f('0x36')](db['sequelize']['fn'](_0xf68f('0x58'),db['sequelize'][_0xf68f('0x59')](_0xf68f('0x48'))),_0x1a3f14[_0xf68f('0x2b')][_0xf68f('0x5a')])]};if(_0x1a3f14[_0xf68f('0x2b')][_0xf68f('0x26')]&&_0x1a3f14[_0xf68f('0x2b')][_0xf68f('0x26')]===_0xf68f('0x48')){_0x3f3e58[_0xf68f('0x5b')][_0xf68f('0x5c')]({'uniqueid':_0x1a3f14[_0xf68f('0x40')]['id']});}else{_0x3f3e58[_0xf68f('0x5b')][_0xf68f('0x5c')]({'id':_0x1a3f14[_0xf68f('0x40')]['id']});}return db['VoiceRecording'][_0xf68f('0x45')]({'where':_0x3f3e58,'attributes':['id','value'],'raw':!![]})[_0xf68f('0x21')](handleEntityNotFound(_0x4a61d3,null))['then'](function(_0x23fcaa){if(_0x23fcaa){var _0xa72dc9=util[_0xf68f('0x4a')](_0xf68f('0x4b'),_0x23fcaa[_0xf68f('0x49')]);if(fs[_0xf68f('0x4e')](_0xa72dc9)){_0x55c2d3=!![];return _0x42f860[_0xf68f('0x5d')](_0xa72dc9,_0x23fcaa[_0xf68f('0x49')],config[_0xf68f('0x4c')][_0xf68f('0x4d')])['then'](function(){return _0x23fcaa;});}return _0x23fcaa;}})[_0xf68f('0x21')](function(_0x3c66d9){if(_0x3c66d9){if(!fs[_0xf68f('0x4e')](_0x3c66d9['value'])){throw new db['Sequelize'][(_0xf68f('0x5e'))](_0xf68f('0x50'));}if(_0x3c66d9[_0xf68f('0x51')]){return _0x4a61d3['download'](_0x3c66d9[_0xf68f('0x49')],_0x3c66d9[_0xf68f('0x51')]+path[_0xf68f('0x52')](_0x3c66d9[_0xf68f('0x49')]),function(){if(_0x55c2d3){fs['unlink'](_0x3c66d9[_0xf68f('0x49')]);}});}else{return _0x4a61d3['download'](_0x3c66d9[_0xf68f('0x49')],function(_0x486d83){if(_0x55c2d3){fs[_0xf68f('0x53')](_0x3c66d9['value']);}});}}})[_0xf68f('0x3e')](handleError(_0x4a61d3,null));};exports[_0xf68f('0x20')]=function(_0x4dc6cf,_0x1eb7f3){return db[_0xf68f('0x24')][_0xf68f('0x45')]({'where':{'id':_0x4dc6cf[_0xf68f('0x40')]['id']}})['then'](function(_0x4bf155){if(!_0x4bf155)throw new ReferenceError(_0xf68f('0x5f'));return _0x4bf155;})[_0xf68f('0x21')](function(_0x512bf4){var _0x55e929=_0x512bf4[_0xf68f('0x49')];logger[_0xf68f('0x60')](_0xf68f('0x61'),_0x55e929);if(!_[_0xf68f('0x62')](_0x512bf4[_0xf68f('0x49')])&&fs[_0xf68f('0x4e')](_0x55e929)){logger['info'](_0xf68f('0x63')+_0x55e929+_0xf68f('0x64'));fs[_0xf68f('0x65')](_0x55e929);}_0x55e929=_0x55e929+_0xf68f('0x66');if(!_[_0xf68f('0x62')](_0x512bf4['value'])&&fs[_0xf68f('0x4e')](_0x55e929)){logger[_0xf68f('0x60')](_0xf68f('0x63')+_0x55e929+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf68f('0x65')](_0x55e929);}return _0x512bf4;})['then'](function(_0xa63a5){if(!_0xa63a5)throw new InternalError();return _0xa63a5[_0xf68f('0x20')]();})[_0xf68f('0x21')](function(){_0x1eb7f3['status'](0xcc)['end']();})[_0xf68f('0x3e')](handleError(_0x1eb7f3,null));};function getBucketslist(_0x502d4a,_0x29f1a8,_0x313968){return new Promise(function(_0x41c935,_0x5e0dae){var _0x2ae84f=new AWS['S3']({'accessKeyId':_0x29f1a8,'secretAccessKey':_0x502d4a,'region':_0x313968});_0x2ae84f[_0xf68f('0x67')]({},function(_0x1d21b2,_0x6a5f6f){if(_0x1d21b2){return _0x5e0dae(_0x1d21b2);}else{return _0x41c935(_0x6a5f6f);}});});}function createBucket(_0x51ab51,_0x487b21,_0x466538,_0x57778b){return new Promise(function(_0x2fda7f,_0x1df0fa){var _0x2c2efa=new AWS['S3']({'accessKeyId':_0x487b21,'secretAccessKey':_0x51ab51,'region':_0x466538});_0x2c2efa['createBucket']({'Bucket':_0x57778b},function(_0x3f29f4,_0x3b3ed7){if(_0x3f29f4){return _0x1df0fa(_0x3f29f4);}else{return _0x2fda7f(_0x3b3ed7);}});});}function uploadFile(_0x50ee34,_0x377032,_0x2d3710,_0x202238,_0x2cca00,_0x240d33){return new Promise(function(_0x18134a,_0x35df5c){var _0x255778=new AWS['S3']({'accessKeyId':_0x377032,'secretAccessKey':_0x50ee34,'region':_0x2d3710});_0x255778[_0xf68f('0x68')]({'Bucket':_0x202238,'Key':_0x2cca00,'Body':_0x240d33},function(_0x483053,_0x25aba5){if(_0x483053){return _0x35df5c(_0x483053);}else{return _0x18134a(_0x25aba5);}});});}function startTranscribe(_0x12d398,_0x5e2a88,_0x34cc16,_0x39798b,_0x5ec5aa,_0x23df15){return new Promise(function(_0x4467c2,_0x538968){var _0x478dcb=new AWS[(_0xf68f('0x69'))]({'accessKeyId':_0x5e2a88,'secretAccessKey':_0x12d398,'region':_0x34cc16});_0x478dcb['startTranscriptionJob']({'TranscriptionJobName':_0x39798b,'LanguageCode':_0x5ec5aa,'Media':{'MediaFileUri':_0x23df15}},function(_0x218946,_0xa32c37){if(_0x218946){return _0x538968(_0x218946);}else{return _0x4467c2(_0xa32c37);}});});}function transcribe(_0x16b4f4,_0x20938e,_0x28ac5b,_0x42b9c5,_0x408ffa,_0x3dbfa1,_0x38e462){return new Promise(function(_0x22a8bc,_0x15d8b6){var _0x23d2f3={};logger[_0xf68f('0x60')](util[_0xf68f('0x4a')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x16b4f4,_0x408ffa));return uploadFile(_0x20938e,_0x28ac5b,_0x42b9c5,_0x408ffa,path[_0xf68f('0x6a')](_0x3dbfa1),fs[_0xf68f('0x6b')](_0x3dbfa1))['then'](function(_0xd21e03){logger['info'](util['format'](_0xf68f('0x6c'),_0x16b4f4,_0x408ffa,_0xd21e03[_0xf68f('0x6d')]));_0x23d2f3[_0xf68f('0x6e')]=_0xd21e03['Bucket'];_0x23d2f3['location']=_0xd21e03[_0xf68f('0x6d')];logger[_0xf68f('0x60')](util[_0xf68f('0x4a')](_0xf68f('0x6f'),_0x16b4f4));return startTranscribe(_0x20938e,_0x28ac5b,_0x42b9c5,uuidv4(),_0x38e462,_0xd21e03[_0xf68f('0x6d')]);})[_0xf68f('0x21')](function(_0x18fd13){logger['info'](util[_0xf68f('0x4a')](_0xf68f('0x70'),_0x16b4f4,_0x18fd13[_0xf68f('0x71')][_0xf68f('0x72')]));_0x23d2f3['transcribeName']=_0x18fd13['TranscriptionJob'][_0xf68f('0x72')];_0x23d2f3[_0xf68f('0x73')]=_0x18fd13[_0xf68f('0x71')][_0xf68f('0x74')];return _0x22a8bc(_0x23d2f3);})['catch'](function(_0x142a46){return _0x15d8b6(_0x142a46);});});}exports[_0xf68f('0x75')]=function(_0x2a8e3a,_0x47fd8c,_0x206f7a){var _0x4e7aff;var _0x5bd49a;var _0x1dbab8;var _0x5c8e7b=require(_0xf68f('0x47'));return db[_0xf68f('0x24')][_0xf68f('0x76')]({'where':{'id':_0x2a8e3a['params']['id']}})['then'](function(_0x2d77f5){if(_0x2d77f5){var _0x1c9074=util[_0xf68f('0x4a')](_0xf68f('0x4b'),_0x2d77f5[_0xf68f('0x49')]);if(fs[_0xf68f('0x4e')](_0x1c9074)){cypher=!![];return _0x5c8e7b[_0xf68f('0x5d')](_0x1c9074,_0x2d77f5[_0xf68f('0x49')],config[_0xf68f('0x4c')][_0xf68f('0x4d')])['then'](function(){return _0x2d77f5;});}return _0x2d77f5;}})[_0xf68f('0x21')](function(_0x18fcc0){if(!_0x18fcc0){throw new db['Sequelize'][(_0xf68f('0x5e'))]('Voice\x20Recording\x20not\x20found');}_0x5bd49a=_0x18fcc0;return db[_0xf68f('0x77')][_0xf68f('0x76')]({'where':{'id':0x1}});})[_0xf68f('0x21')](handleEntityNotFound(_0x47fd8c,null))[_0xf68f('0x21')](function(_0x362289){if(_0x362289){_0x4e7aff=_0x362289;if(!_0x4e7aff[_0xf68f('0x78')]||!_0x4e7aff['transcribeAccountId']||!_0x4e7aff[_0xf68f('0x79')]||!_0x4e7aff['language']||!_0x4e7aff[_0xf68f('0x6e')]){throw new db['Sequelize'][(_0xf68f('0x5e'))]('Transcribe\x20not\x20configured');}if(_0x2a8e3a[_0xf68f('0x44')][_0xf68f('0x7a')]&&(!_0x4e7aff[_0xf68f('0x7b')]||!_0x4e7aff[_0xf68f('0x7c')]||!_0x4e7aff['sentimentRegion']||!_0x4e7aff['language']||!_0x4e7aff[_0xf68f('0x6e')])){throw new db['Sequelize'][(_0xf68f('0x5e'))](_0xf68f('0x7d'));}return db[_0xf68f('0x7e')][_0xf68f('0x76')]({'where':{'id':_0x4e7aff[_0xf68f('0x7f')]}});}})[_0xf68f('0x21')](function(_0x1750bc){if(!_0x1750bc){throw new db[(_0xf68f('0x4f'))][(_0xf68f('0x5e'))](_0xf68f('0x80'));}if(!_0x1750bc['data1']||!_0x1750bc[_0xf68f('0x81')]){throw new db['Sequelize']['ValidationError'](_0xf68f('0x82'));}_0x1dbab8=_0x1750bc;return getBucketslist(_0x1dbab8['data1'],_0x1dbab8[_0xf68f('0x81')],_0x4e7aff[_0xf68f('0x79')]);})[_0xf68f('0x21')](function(_0x6ed2ce){if(_0x6ed2ce&&_0x6ed2ce[_0xf68f('0x83')]){var _0x361ab5=_['find'](_0x6ed2ce[_0xf68f('0x83')],function(_0x33ab76){return _0x33ab76[_0xf68f('0x84')]===_0x4e7aff[_0xf68f('0x6e')];});if(!_0x361ab5){logger[_0xf68f('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x2a8e3a[_0xf68f('0x40')]['id'],_0x4e7aff[_0xf68f('0x6e')]));return createBucket(_0x1dbab8[_0xf68f('0x85')],_0x1dbab8[_0xf68f('0x81')],_0x4e7aff[_0xf68f('0x79')],_0x4e7aff[_0xf68f('0x6e')]);}logger[_0xf68f('0x60')](util[_0xf68f('0x4a')](_0xf68f('0x86'),_0x2a8e3a[_0xf68f('0x40')]['id'],_0x4e7aff[_0xf68f('0x6e')]));return;}})['then'](function(_0x2b5da6){if(_0x5bd49a[_0xf68f('0x73')]==='NEW'){return transcribe(_0x2a8e3a[_0xf68f('0x40')]['id'],_0x1dbab8[_0xf68f('0x85')],_0x1dbab8[_0xf68f('0x81')],_0x4e7aff[_0xf68f('0x79')],_0x4e7aff[_0xf68f('0x6e')],_0x5bd49a[_0xf68f('0x49')],_0x4e7aff[_0xf68f('0x87')]);}else{logger[_0xf68f('0x60')](util[_0xf68f('0x4a')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x2a8e3a[_0xf68f('0x40')]['id']));return{'transcribeStatus':_0xf68f('0x88')};}})[_0xf68f('0x21')](function(_0x58d5df){if(_0x58d5df){_0x58d5df['tempSentiment']=_0x2a8e3a[_0xf68f('0x44')][_0xf68f('0x7a')];return _0x5bd49a['updateAttributes'](_0x58d5df);}})['then'](respondWithResult(_0x47fd8c,null))[_0xf68f('0x3e')](handleError(_0x47fd8c,null));};function writeFile(_0x3edc11,_0x31a4ab){return new Promise(function(_0x315917,_0x2ca6c4){fs['writeFile'](_0x31a4ab,_0x3edc11,function(_0x52a1ea,_0x26acfa){if(_0x52a1ea){return _0x2ca6c4(_0x52a1ea);}else{return _0x315917(_0x26acfa);}});});}exports[_0xf68f('0x89')]=function(_0x54948d,_0x17bb36,_0x2d4535){return db[_0xf68f('0x24')][_0xf68f('0x76')]({'where':{'id':_0x54948d[_0xf68f('0x40')]['id']}})['then'](handleEntityNotFound(_0x17bb36))[_0xf68f('0x21')](function(_0xcd3cad){if(_0xcd3cad&&_0xcd3cad[_0xf68f('0x8a')]){var _0xd484ee=_0xcd3cad['fileText'];var _0x1d4024=config[_0xf68f('0x8b')]+_0xf68f('0x8c')+_0xcd3cad['id']+_0xf68f('0x8d');if(fs['existsSync'](_0x1d4024)){return _0x1d4024;}return writeFile(_0xd484ee,_0x1d4024)[_0xf68f('0x21')](function(){return _0x1d4024;});}else{throw new db['Sequelize'][(_0xf68f('0x5e'))](_0xf68f('0x8e'));}})['then'](function(_0x52e5bb){return _0x17bb36['download'](_0x52e5bb);})[_0xf68f('0x3e')](handleError(_0x17bb36));}; \ No newline at end of file +var _0xa2f8=['rawAttributes','key','model','differenceBy','format','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','pick','filter','merge','type','VIRTUAL','options','where','VoiceRecording','then','include','findAll','rows','catch','keys','create','body','update','find','params','describe','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','col','$and','push','%s.cypher','filename','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','bucket','Transcribe\x20not\x20configured','sentimentRegion','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','transcribeRegion','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','map'];(function(_0x5e8568,_0x2627e6){var _0x536ecf=function(_0x40691c){while(--_0x40691c){_0x5e8568['push'](_0x5e8568['shift']());}};_0x536ecf(++_0x2627e6);}(_0xa2f8,0x100));var _0x8a2f=function(_0x29db88,_0xa4efdd){_0x29db88=_0x29db88-0x0;var _0x54e570=_0xa2f8[_0x29db88];return _0x54e570;};'use strict';var pdf=require(_0x8a2f('0x0'));var emlformat=require(_0x8a2f('0x1'));var rimraf=require(_0x8a2f('0x2'));var zipdir=require(_0x8a2f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a2f('0x4'));var Mustache=require(_0x8a2f('0x5'));var util=require('util');var path=require(_0x8a2f('0x6'));var sox=require('sox');var csv=require(_0x8a2f('0x7'));var ejs=require(_0x8a2f('0x8'));var fs=require('fs');var _=require(_0x8a2f('0x9'));var squel=require(_0x8a2f('0xa'));var crypto=require(_0x8a2f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8a2f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0x8a2f('0xd'));var uuidv4=require(_0x8a2f('0xe'));var Redis=require(_0x8a2f('0xf'));var authService=require(_0x8a2f('0x10'));var qs=require(_0x8a2f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a2f('0x12'));var logger=require('../../config/logger')(_0x8a2f('0x13'));var utils=require('../../config/utils');var config=require(_0x8a2f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a2f('0x15'))['db'];function respondWithStatusCode(_0x50d767,_0x15f26a){_0x15f26a=_0x15f26a||0xcc;return function(_0x443a84){if(_0x443a84){return _0x50d767[_0x8a2f('0x16')](_0x15f26a);}return _0x50d767[_0x8a2f('0x17')](_0x15f26a)[_0x8a2f('0x18')]();};}function respondWithResult(_0x50f50a,_0xe42a77){_0xe42a77=_0xe42a77||0xc8;return function(_0x1529be){if(_0x1529be){return _0x50f50a[_0x8a2f('0x17')](_0xe42a77)[_0x8a2f('0x19')](_0x1529be);}};}function respondWithFilteredResult(_0x281222,_0x5f5bac){return function(_0x2a18ba){if(_0x2a18ba){var _0x4800ba=_0x2a18ba[_0x8a2f('0x1a')],_0x3280ef=_0x5f5bac[_0x8a2f('0x1b')],_0x5bdd29=_0x5f5bac[_0x8a2f('0x1b')]+_0x5f5bac[_0x8a2f('0x1c')],_0x518f43;if(_0x5bdd29>=_0x4800ba){_0x5bdd29=_0x4800ba;_0x518f43=0xc8;}else{_0x518f43=0xce;}_0x281222[_0x8a2f('0x17')](_0x518f43);return _0x281222[_0x8a2f('0x1d')](_0x8a2f('0x1e'),_0x3280ef+'-'+_0x5bdd29+'/'+_0x4800ba)['json'](_0x2a18ba);}return null;};}function patchUpdates(_0x1674ac){return function(_0x3c2cec){try{jsonpatch[_0x8a2f('0x1f')](_0x3c2cec,_0x1674ac,!![]);}catch(_0x62a467){return BPromise[_0x8a2f('0x20')](_0x62a467);}return _0x3c2cec[_0x8a2f('0x21')]();};}function saveUpdates(_0x4be7bc,_0x325906){return function(_0x4abeaf){if(_0x4abeaf){return _0x4abeaf['update'](_0x4be7bc)['then'](function(_0x176245){return _0x176245;});}return null;};}function removeEntity(_0x2f0d77,_0x275ee6){return function(_0x2d3c9d){if(_0x2d3c9d){return _0x2d3c9d[_0x8a2f('0x22')]()['then'](function(){_0x2f0d77['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56e400,_0x45ff1b){return function(_0x3d9f2c){if(!_0x3d9f2c){_0x56e400['sendStatus'](0x194);}return _0x3d9f2c;};}function handleError(_0x582f2f,_0x5dad30){_0x5dad30=_0x5dad30||0x1f4;return function(_0x1d6a38){logger['error'](_0x1d6a38[_0x8a2f('0x23')]);if(_0x1d6a38['name']){delete _0x1d6a38[_0x8a2f('0x24')];}_0x582f2f['status'](_0x5dad30)['send'](_0x1d6a38);};}exports['index']=function(_0x57af7e,_0x4d1d79){var _0x52ea4c={},_0xf6f7d7={},_0x5007ba={'count':0x0,'rows':[]};var _0x5c0e99=_[_0x8a2f('0x25')](db['VoiceRecording'][_0x8a2f('0x26')],function(_0x4bacce){return{'name':_0x4bacce['fieldName'],'type':_0x4bacce['type'][_0x8a2f('0x27')]};});_0xf6f7d7[_0x8a2f('0x28')]=_[_0x8a2f('0x29')](_['map'](_0x5c0e99,_0x8a2f('0x24')),[_0x8a2f('0x2a')]);_0xf6f7d7['query']=_['keys'](_0x57af7e['query']);_0xf6f7d7[_0x8a2f('0x2b')]=_[_0x8a2f('0x2c')](_0xf6f7d7['model'],_0xf6f7d7[_0x8a2f('0x2d')]);_0x52ea4c[_0x8a2f('0x2e')]=_[_0x8a2f('0x2c')](_0xf6f7d7[_0x8a2f('0x28')],qs['fields'](_0x57af7e['query'][_0x8a2f('0x2f')]));_0x52ea4c[_0x8a2f('0x2e')]=_0x52ea4c[_0x8a2f('0x2e')][_0x8a2f('0x30')]?_0x52ea4c[_0x8a2f('0x2e')]:_0xf6f7d7[_0x8a2f('0x28')];if(!_0x57af7e[_0x8a2f('0x2d')][_0x8a2f('0x31')]('nolimit')){_0x52ea4c[_0x8a2f('0x1c')]=qs[_0x8a2f('0x1c')](_0x57af7e['query'][_0x8a2f('0x1c')]);_0x52ea4c[_0x8a2f('0x1b')]=qs[_0x8a2f('0x1b')](_0x57af7e[_0x8a2f('0x2d')][_0x8a2f('0x1b')]);}_0x52ea4c[_0x8a2f('0x32')]=qs['sort'](_0x57af7e[_0x8a2f('0x2d')]['sort']);_0x52ea4c['where']=qs[_0x8a2f('0x2b')](_[_0x8a2f('0x33')](_0x57af7e['query'],_0xf6f7d7[_0x8a2f('0x2b')]),_0x5c0e99);if(_0x57af7e['query'][_0x8a2f('0x34')]){_0x52ea4c['where']=_[_0x8a2f('0x35')](_0x52ea4c['where'],{'$or':_[_0x8a2f('0x25')](_0x5c0e99,function(_0x5d8f23){if(_0x5d8f23[_0x8a2f('0x36')]!==_0x8a2f('0x37')){var _0x2cf258={};_0x2cf258[_0x5d8f23['name']]={'$like':'%'+_0x57af7e[_0x8a2f('0x2d')][_0x8a2f('0x34')]+'%'};return _0x2cf258;}})});}_0x52ea4c=_[_0x8a2f('0x35')]({},_0x52ea4c,_0x57af7e[_0x8a2f('0x38')]);var _0x32605b={'where':_0x52ea4c[_0x8a2f('0x39')]};return db[_0x8a2f('0x3a')][_0x8a2f('0x1a')](_0x32605b)[_0x8a2f('0x3b')](function(_0x380bda){_0x5007ba[_0x8a2f('0x1a')]=_0x380bda;if(_0x57af7e[_0x8a2f('0x2d')]['includeAll']){_0x52ea4c[_0x8a2f('0x3c')]=[{'all':!![]}];}return db[_0x8a2f('0x3a')][_0x8a2f('0x3d')](_0x52ea4c);})[_0x8a2f('0x3b')](function(_0x158763){_0x5007ba[_0x8a2f('0x3e')]=_0x158763;return _0x5007ba;})['then'](respondWithFilteredResult(_0x4d1d79,_0x52ea4c))[_0x8a2f('0x3f')](handleError(_0x4d1d79,null));};exports['show']=function(_0x54f4cc,_0x37455b){var _0x447c7d={'raw':![],'where':{'id':_0x54f4cc['params']['id']}},_0x259bbf={};_0x259bbf[_0x8a2f('0x28')]=_[_0x8a2f('0x40')](db[_0x8a2f('0x3a')]['rawAttributes']);_0x259bbf[_0x8a2f('0x2d')]=_['keys'](_0x54f4cc[_0x8a2f('0x2d')]);_0x259bbf['filters']=_[_0x8a2f('0x2c')](_0x259bbf[_0x8a2f('0x28')],_0x259bbf[_0x8a2f('0x2d')]);_0x447c7d[_0x8a2f('0x2e')]=_[_0x8a2f('0x2c')](_0x259bbf[_0x8a2f('0x28')],qs[_0x8a2f('0x2f')](_0x54f4cc[_0x8a2f('0x2d')][_0x8a2f('0x2f')]));_0x447c7d[_0x8a2f('0x2e')]=_0x447c7d['attributes']['length']?_0x447c7d[_0x8a2f('0x2e')]:_0x259bbf[_0x8a2f('0x28')];if(_0x54f4cc[_0x8a2f('0x2d')]['includeAll']){_0x447c7d[_0x8a2f('0x3c')]=[{'all':!![]}];}_0x447c7d=_['merge']({},_0x447c7d,_0x54f4cc['options']);return db[_0x8a2f('0x3a')]['find'](_0x447c7d)[_0x8a2f('0x3b')](handleEntityNotFound(_0x37455b,null))['then'](respondWithResult(_0x37455b,null))[_0x8a2f('0x3f')](handleError(_0x37455b,null));};exports[_0x8a2f('0x41')]=function(_0x57936c,_0x160870){return db['VoiceRecording']['create'](_0x57936c[_0x8a2f('0x42')],{})['then'](respondWithResult(_0x160870,0xc9))[_0x8a2f('0x3f')](handleError(_0x160870,null));};exports[_0x8a2f('0x43')]=function(_0x258c1d,_0x943b6a){if(_0x258c1d[_0x8a2f('0x42')]['id']){delete _0x258c1d[_0x8a2f('0x42')]['id'];}return db[_0x8a2f('0x3a')][_0x8a2f('0x44')]({'where':{'id':_0x258c1d[_0x8a2f('0x45')]['id']}})[_0x8a2f('0x3b')](handleEntityNotFound(_0x943b6a,null))[_0x8a2f('0x3b')](saveUpdates(_0x258c1d[_0x8a2f('0x42')],null))[_0x8a2f('0x3b')](respondWithResult(_0x943b6a,null))['catch'](handleError(_0x943b6a,null));};exports[_0x8a2f('0x46')]=function(_0x3cab16,_0x59da6d){return db[_0x8a2f('0x3a')][_0x8a2f('0x46')]()[_0x8a2f('0x3b')](respondWithResult(_0x59da6d,null))[_0x8a2f('0x3f')](handleError(_0x59da6d,null));};exports['download']=function(_0x4308ee,_0x480fd4,_0x3d1075){var _0x4699cf=require(_0x8a2f('0x47'));var _0x2b41c4=![];var _0x3c5f78={};if(_0x4308ee[_0x8a2f('0x2d')][_0x8a2f('0x36')]&&_0x4308ee[_0x8a2f('0x2d')][_0x8a2f('0x36')]===_0x8a2f('0x48')){_0x3c5f78[_0x8a2f('0x48')]=_0x4308ee[_0x8a2f('0x45')]['id'];}else{_0x3c5f78['id']=_0x4308ee['params']['id'];}return db[_0x8a2f('0x3a')][_0x8a2f('0x44')]({'where':_0x3c5f78,'attributes':['id',_0x8a2f('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x480fd4,null))[_0x8a2f('0x3b')](function(_0x1e5c1d){if(_0x1e5c1d){var _0x106f73=_0x1e5c1d['value'];var _0xbb4a6d=util[_0x8a2f('0x2a')]('%s.cypher',_0x106f73);if(fs[_0x8a2f('0x4a')](_0xbb4a6d)){_0x2b41c4=!![];return _0x4699cf[_0x8a2f('0x4b')](_0xbb4a6d,_0x106f73,config[_0x8a2f('0x4c')][_0x8a2f('0x4d')])[_0x8a2f('0x3b')](function(){return _0x1e5c1d;});}return _0x1e5c1d;}})['then'](function(_0x5b034f){if(_0x5b034f){var _0xd98183=_0x5b034f[_0x8a2f('0x49')];if(!fs[_0x8a2f('0x4a')](_0xd98183)){throw new db[(_0x8a2f('0x4e'))][(_0x8a2f('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x5b034f['filename']){return _0x480fd4[_0x8a2f('0x50')](_0xd98183,_0x5b034f['filename']+path[_0x8a2f('0x51')](_0xd98183),function(){if(_0x2b41c4){fs[_0x8a2f('0x52')](_0xd98183);}});}else{return _0x480fd4[_0x8a2f('0x50')](_0xd98183,function(_0x142dbe){if(_0x2b41c4){fs[_0x8a2f('0x52')](_0xd98183);}});}}})[_0x8a2f('0x3f')](function(_0x56e089){if(_0x56e089[_0x8a2f('0x53')]===_0x8a2f('0x54')){_0x480fd4['status'](0x194)[_0x8a2f('0x55')](_0x8a2f('0x56'));}else{return handleError(_0x480fd4,null);}});};exports[_0x8a2f('0x57')]=function(_0x39d81f,_0x1ab84d,_0x26405f){var _0x493107=require(_0x8a2f('0x47'));var _0x13971b=![];var _0x4bb832={'$and':[db['sequelize'][_0x8a2f('0x39')](db[_0x8a2f('0x58')]['fn'](_0x8a2f('0x59'),db[_0x8a2f('0x58')][_0x8a2f('0x5a')](_0x8a2f('0x48'))),_0x39d81f[_0x8a2f('0x2d')]['token'])]};if(_0x39d81f[_0x8a2f('0x2d')][_0x8a2f('0x36')]&&_0x39d81f[_0x8a2f('0x2d')][_0x8a2f('0x36')]===_0x8a2f('0x48')){_0x4bb832[_0x8a2f('0x5b')]['push']({'uniqueid':_0x39d81f[_0x8a2f('0x45')]['id']});}else{_0x4bb832['$and'][_0x8a2f('0x5c')]({'id':_0x39d81f[_0x8a2f('0x45')]['id']});}return db['VoiceRecording'][_0x8a2f('0x44')]({'where':_0x4bb832,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1ab84d,null))['then'](function(_0x26b17b){if(_0x26b17b){var _0x2b357b=util[_0x8a2f('0x2a')](_0x8a2f('0x5d'),_0x26b17b[_0x8a2f('0x49')]);if(fs['existsSync'](_0x2b357b)){_0x13971b=!![];return _0x493107[_0x8a2f('0x4b')](_0x2b357b,_0x26b17b[_0x8a2f('0x49')],config[_0x8a2f('0x4c')][_0x8a2f('0x4d')])[_0x8a2f('0x3b')](function(){return _0x26b17b;});}return _0x26b17b;}})[_0x8a2f('0x3b')](function(_0x1b155b){if(_0x1b155b){if(!fs[_0x8a2f('0x4a')](_0x1b155b[_0x8a2f('0x49')])){throw new db[(_0x8a2f('0x4e'))]['ValidationError'](_0x8a2f('0x54'));}if(_0x1b155b['filename']){return _0x1ab84d['download'](_0x1b155b['value'],_0x1b155b[_0x8a2f('0x5e')]+path[_0x8a2f('0x51')](_0x1b155b['value']),function(){if(_0x13971b){fs[_0x8a2f('0x52')](_0x1b155b['value']);}});}else{return _0x1ab84d['download'](_0x1b155b[_0x8a2f('0x49')],function(_0x42fbfa){if(_0x13971b){fs[_0x8a2f('0x52')](_0x1b155b['value']);}});}}})[_0x8a2f('0x3f')](handleError(_0x1ab84d,null));};exports['destroy']=function(_0x2e6a37,_0x12bc66){return db[_0x8a2f('0x3a')][_0x8a2f('0x44')]({'where':{'id':_0x2e6a37[_0x8a2f('0x45')]['id']}})[_0x8a2f('0x3b')](function(_0xa53977){if(!_0xa53977)throw new ReferenceError(_0x8a2f('0x5f'));return _0xa53977;})[_0x8a2f('0x3b')](function(_0x4afb2f){var _0x41efe3=_0x4afb2f['value'];logger[_0x8a2f('0x60')](_0x8a2f('0x61'),_0x41efe3);if(!_[_0x8a2f('0x62')](_0x4afb2f[_0x8a2f('0x49')])&&fs['existsSync'](_0x41efe3)){logger[_0x8a2f('0x60')](_0x8a2f('0x63')+_0x41efe3+_0x8a2f('0x64'));fs[_0x8a2f('0x65')](_0x41efe3);}_0x41efe3=_0x41efe3+'.cypher';if(!_[_0x8a2f('0x62')](_0x4afb2f[_0x8a2f('0x49')])&&fs[_0x8a2f('0x4a')](_0x41efe3)){logger['info'](_0x8a2f('0x63')+_0x41efe3+_0x8a2f('0x64'));fs[_0x8a2f('0x65')](_0x41efe3);}return _0x4afb2f;})[_0x8a2f('0x3b')](function(_0x2b5580){if(!_0x2b5580)throw new InternalError();return _0x2b5580[_0x8a2f('0x22')]();})[_0x8a2f('0x3b')](function(){_0x12bc66['status'](0xcc)[_0x8a2f('0x18')]();})[_0x8a2f('0x3f')](handleError(_0x12bc66,null));};function getBucketslist(_0x48ac95,_0x28d987,_0x5bcf50){return new Promise(function(_0x3c1a5f,_0x54bf0){var _0x212e46=new AWS['S3']({'accessKeyId':_0x28d987,'secretAccessKey':_0x48ac95,'region':_0x5bcf50});_0x212e46[_0x8a2f('0x66')]({},function(_0x55247c,_0x16f3f4){if(_0x55247c){return _0x54bf0(_0x55247c);}else{return _0x3c1a5f(_0x16f3f4);}});});}function createBucket(_0x123988,_0xbde632,_0x3af62d,_0x4b275b){return new Promise(function(_0x414b2b,_0x3f8110){var _0x46cca1=new AWS['S3']({'accessKeyId':_0xbde632,'secretAccessKey':_0x123988,'region':_0x3af62d});_0x46cca1[_0x8a2f('0x67')]({'Bucket':_0x4b275b},function(_0xf0a2fa,_0x411c8a){if(_0xf0a2fa){return _0x3f8110(_0xf0a2fa);}else{return _0x414b2b(_0x411c8a);}});});}function uploadFile(_0x31a998,_0x34ff19,_0x253f81,_0x1b37f9,_0x494561,_0x5ad7e7){return new Promise(function(_0x294769,_0x203aa7){var _0x322ec7=new AWS['S3']({'accessKeyId':_0x34ff19,'secretAccessKey':_0x31a998,'region':_0x253f81});_0x322ec7[_0x8a2f('0x68')]({'Bucket':_0x1b37f9,'Key':_0x494561,'Body':_0x5ad7e7},function(_0x24dcef,_0x28479a){if(_0x24dcef){return _0x203aa7(_0x24dcef);}else{return _0x294769(_0x28479a);}});});}function startTranscribe(_0x4ad930,_0x7f699d,_0x1f979b,_0x2df20a,_0x3ca93a,_0x1a3922){return new Promise(function(_0xaadf22,_0x355500){var _0x5e5cce=new AWS['TranscribeService']({'accessKeyId':_0x7f699d,'secretAccessKey':_0x4ad930,'region':_0x1f979b});_0x5e5cce[_0x8a2f('0x69')]({'TranscriptionJobName':_0x2df20a,'LanguageCode':_0x3ca93a,'Media':{'MediaFileUri':_0x1a3922}},function(_0x24734a,_0x26f74f){if(_0x24734a){return _0x355500(_0x24734a);}else{return _0xaadf22(_0x26f74f);}});});}function transcribe(_0x325872,_0x44588a,_0x24205f,_0x146e68,_0x499c69,_0x521c2c,_0x3a5f07){return new Promise(function(_0x48d651,_0xdd9f49){var _0x4a56e0={};logger['info'](util[_0x8a2f('0x2a')](_0x8a2f('0x6a'),_0x325872,_0x499c69));return uploadFile(_0x44588a,_0x24205f,_0x146e68,_0x499c69,path[_0x8a2f('0x6b')](_0x521c2c),fs[_0x8a2f('0x6c')](_0x521c2c))[_0x8a2f('0x3b')](function(_0x3ba897){logger[_0x8a2f('0x60')](util[_0x8a2f('0x2a')](_0x8a2f('0x6d'),_0x325872,_0x499c69,_0x3ba897[_0x8a2f('0x6e')]));_0x4a56e0['bucket']=_0x3ba897['Bucket'];_0x4a56e0[_0x8a2f('0x6f')]=_0x3ba897[_0x8a2f('0x6e')];logger['info'](util[_0x8a2f('0x2a')](_0x8a2f('0x70'),_0x325872));return startTranscribe(_0x44588a,_0x24205f,_0x146e68,uuidv4(),_0x3a5f07,_0x3ba897[_0x8a2f('0x6e')]);})['then'](function(_0x1b6b53){logger[_0x8a2f('0x60')](util[_0x8a2f('0x2a')](_0x8a2f('0x71'),_0x325872,_0x1b6b53['TranscriptionJob'][_0x8a2f('0x72')]));_0x4a56e0[_0x8a2f('0x73')]=_0x1b6b53[_0x8a2f('0x74')][_0x8a2f('0x72')];_0x4a56e0[_0x8a2f('0x75')]=_0x1b6b53[_0x8a2f('0x74')][_0x8a2f('0x76')];return _0x48d651(_0x4a56e0);})[_0x8a2f('0x3f')](function(_0x1d9fd7){return _0xdd9f49(_0x1d9fd7);});});}exports[_0x8a2f('0x77')]=function(_0x1f248d,_0x35d8db,_0x3566ba){var _0x3b43ca;var _0x2560ab;var _0x5525b6;var _0x1d6f96=require('../../components/encryptor');return db[_0x8a2f('0x3a')]['findOne']({'where':{'id':_0x1f248d[_0x8a2f('0x45')]['id']}})[_0x8a2f('0x3b')](function(_0x22f3a1){if(_0x22f3a1){var _0x45d974=util['format'](_0x8a2f('0x5d'),_0x22f3a1['value']);if(fs[_0x8a2f('0x4a')](_0x45d974)){cypher=!![];return _0x1d6f96['decryptFile'](_0x45d974,_0x22f3a1[_0x8a2f('0x49')],config[_0x8a2f('0x4c')][_0x8a2f('0x4d')])[_0x8a2f('0x3b')](function(){return _0x22f3a1;});}return _0x22f3a1;}})[_0x8a2f('0x3b')](function(_0x1ffe8a){if(!_0x1ffe8a){throw new db[(_0x8a2f('0x4e'))][(_0x8a2f('0x4f'))](_0x8a2f('0x78'));}_0x2560ab=_0x1ffe8a;return db[_0x8a2f('0x79')]['findOne']({'where':{'id':0x1}});})[_0x8a2f('0x3b')](handleEntityNotFound(_0x35d8db,null))[_0x8a2f('0x3b')](function(_0x3ce0c7){if(_0x3ce0c7){_0x3b43ca=_0x3ce0c7;if(!_0x3b43ca[_0x8a2f('0x7a')]||!_0x3b43ca[_0x8a2f('0x7b')]||!_0x3b43ca['transcribeRegion']||!_0x3b43ca[_0x8a2f('0x7c')]||!_0x3b43ca[_0x8a2f('0x7d')]){throw new db['Sequelize'][(_0x8a2f('0x4f'))](_0x8a2f('0x7e'));}if(_0x1f248d[_0x8a2f('0x42')]['runSentiment']&&(!_0x3b43ca['sentiment']||!_0x3b43ca['sentimentAccountId']||!_0x3b43ca[_0x8a2f('0x7f')]||!_0x3b43ca[_0x8a2f('0x7c')]||!_0x3b43ca['bucket'])){throw new db[(_0x8a2f('0x4e'))][(_0x8a2f('0x4f'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x8a2f('0x80')]({'where':{'id':_0x3b43ca[_0x8a2f('0x7b')]}});}})['then'](function(_0xa66f6d){if(!_0xa66f6d){throw new db[(_0x8a2f('0x4e'))][(_0x8a2f('0x4f'))](_0x8a2f('0x81'));}if(!_0xa66f6d[_0x8a2f('0x82')]||!_0xa66f6d[_0x8a2f('0x83')]){throw new db[(_0x8a2f('0x4e'))][(_0x8a2f('0x4f'))](_0x8a2f('0x84'));}_0x5525b6=_0xa66f6d;return getBucketslist(_0x5525b6[_0x8a2f('0x82')],_0x5525b6[_0x8a2f('0x83')],_0x3b43ca['transcribeRegion']);})[_0x8a2f('0x3b')](function(_0x3ef31e){if(_0x3ef31e&&_0x3ef31e[_0x8a2f('0x85')]){var _0x2c401f=_[_0x8a2f('0x44')](_0x3ef31e[_0x8a2f('0x85')],function(_0x365188){return _0x365188[_0x8a2f('0x86')]===_0x3b43ca[_0x8a2f('0x7d')];});if(!_0x2c401f){logger[_0x8a2f('0x60')](util[_0x8a2f('0x2a')](_0x8a2f('0x87'),_0x1f248d['params']['id'],_0x3b43ca[_0x8a2f('0x7d')]));return createBucket(_0x5525b6['data1'],_0x5525b6['data2'],_0x3b43ca['transcribeRegion'],_0x3b43ca[_0x8a2f('0x7d')]);}logger[_0x8a2f('0x60')](util[_0x8a2f('0x2a')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1f248d[_0x8a2f('0x45')]['id'],_0x3b43ca['bucket']));return;}})['then'](function(_0x2b43ec){if(_0x2560ab['transcribeStatus']===_0x8a2f('0x88')){return transcribe(_0x1f248d[_0x8a2f('0x45')]['id'],_0x5525b6['data1'],_0x5525b6[_0x8a2f('0x83')],_0x3b43ca[_0x8a2f('0x89')],_0x3b43ca['bucket'],_0x2560ab['value'],_0x3b43ca[_0x8a2f('0x7c')]);}else{logger[_0x8a2f('0x60')](util[_0x8a2f('0x2a')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1f248d['params']['id']));return{'transcribeStatus':_0x8a2f('0x8a')};}})[_0x8a2f('0x3b')](function(_0xc1c6ae){if(_0xc1c6ae){_0xc1c6ae['tempSentiment']=_0x1f248d[_0x8a2f('0x42')][_0x8a2f('0x8b')];return _0x2560ab[_0x8a2f('0x8c')](_0xc1c6ae);}})[_0x8a2f('0x3b')](respondWithResult(_0x35d8db,null))[_0x8a2f('0x3f')](handleError(_0x35d8db,null));};function writeFile(_0x2516d8,_0x4292ad){return new Promise(function(_0x56936b,_0xe26183){fs[_0x8a2f('0x8d')](_0x4292ad,_0x2516d8,function(_0x4411d6,_0x4e4458){if(_0x4411d6){return _0xe26183(_0x4411d6);}else{return _0x56936b(_0x4e4458);}});});}exports[_0x8a2f('0x8e')]=function(_0x3f6aeb,_0x578e9f,_0x192e31){return db[_0x8a2f('0x3a')][_0x8a2f('0x80')]({'where':{'id':_0x3f6aeb['params']['id']}})[_0x8a2f('0x3b')](handleEntityNotFound(_0x578e9f))[_0x8a2f('0x3b')](function(_0xba8815){if(_0xba8815&&_0xba8815[_0x8a2f('0x8f')]){var _0x22a2c9=_0xba8815['fileText'];var _0x463eac=config[_0x8a2f('0x90')]+_0x8a2f('0x91')+_0xba8815['id']+_0x8a2f('0x92');if(fs['existsSync'](_0x463eac)){return _0x463eac;}return writeFile(_0x22a2c9,_0x463eac)[_0x8a2f('0x3b')](function(){return _0x463eac;});}else{throw new db[(_0x8a2f('0x4e'))][(_0x8a2f('0x4f'))]('Transcript\x20not\x20available');}})[_0x8a2f('0x3b')](function(_0x523a16){return _0x578e9f[_0x8a2f('0x50')](_0x523a16);})[_0x8a2f('0x3f')](handleError(_0x578e9f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0577034..30c9044 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 _0x3e4c=['define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x171c0e,_0x32d9ee){var _0x616a05=function(_0x3a93b4){while(--_0x3a93b4){_0x171c0e['push'](_0x171c0e['shift']());}};_0x616a05(++_0x32d9ee);}(_0x3e4c,0x1d8));var _0xc3e4=function(_0x4a93a0,_0x3e3f64){_0x4a93a0=_0x4a93a0-0x0;var _0x584313=_0x3e4c[_0x4a93a0];return _0x584313;};'use strict';var _=require('lodash');var util=require(_0xc3e4('0x0'));var logger=require(_0xc3e4('0x1'))(_0xc3e4('0x2'));var moment=require('moment');var BPromise=require(_0xc3e4('0x3'));var rp=require(_0xc3e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3e4('0x5'));var config=require(_0xc3e4('0x6'));var attributes=require(_0xc3e4('0x7'));module[_0xc3e4('0x8')]=function(_0x2bf001,_0x7ecd5f){return _0x2bf001[_0xc3e4('0x9')](_0xc3e4('0xa'),attributes,{'tableName':_0xc3e4('0xb'),'paranoid':![],'indexes':[{'name':_0xc3e4('0xc'),'fields':[_0xc3e4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d8f=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','lodash','util','request-promise','path','rimraf','../../config/environment'];(function(_0x6185a6,_0x18288c){var _0x221a68=function(_0x37dee4){while(--_0x37dee4){_0x6185a6['push'](_0x6185a6['shift']());}};_0x221a68(++_0x18288c);}(_0x5d8f,0x73));var _0xf5d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d8f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5d8('0x0'));var util=require(_0xf5d8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf5d8('0x2'));var fs=require('fs');var path=require(_0xf5d8('0x3'));var rimraf=require(_0xf5d8('0x4'));var config=require(_0xf5d8('0x5'));var attributes=require(_0xf5d8('0x6'));module[_0xf5d8('0x7')]=function(_0x34ffcf,_0x30738e){return _0x34ffcf[_0xf5d8('0x8')](_0xf5d8('0x9'),attributes,{'tableName':_0xf5d8('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','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 866495b..065d3d7 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(_0x17f145,_0x3422bb){var _0x2d5420=function(_0x3eb38b){while(--_0x3eb38b){_0x17f145['push'](_0x17f145['shift']());}};_0x2d5420(++_0x3422bb);}(_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['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(_0x56ccd2,_0x1fbef1){var _0x341819=function(_0x5b0bc1){while(--_0x5b0bc1){_0x56ccd2['push'](_0x56ccd2['shift']());}};_0x341819(++_0x1fbef1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 608a0a2..1ead995 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 _0xf3cf=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util'];(function(_0x18ca6f,_0x529afc){var _0x33bfae=function(_0x445cb7){while(--_0x445cb7){_0x18ca6f['push'](_0x18ca6f['shift']());}};_0x33bfae(++_0x529afc);}(_0xf3cf,0x1ca));var _0xff3c=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xf3cf[_0x212bf5];return _0xfcad21;};'use strict';var multer=require(_0xff3c('0x0'));var util=require(_0xff3c('0x1'));var path=require(_0xff3c('0x2'));var timeout=require('connect-timeout');var express=require(_0xff3c('0x3'));var router=express[_0xff3c('0x4')]();var auth=require(_0xff3c('0x5'));var interaction=require(_0xff3c('0x6'));var config=require(_0xff3c('0x7'));var controller=require('./voiceTransferReport.controller');router[_0xff3c('0x8')]('/',auth[_0xff3c('0x9')](),controller[_0xff3c('0xa')]);router[_0xff3c('0x8')](_0xff3c('0xb'),auth[_0xff3c('0x9')](),controller[_0xff3c('0xc')]);router[_0xff3c('0x8')](_0xff3c('0xd'),auth[_0xff3c('0x9')](),controller[_0xff3c('0xe')]);router[_0xff3c('0xf')]('/',auth[_0xff3c('0x9')](),controller[_0xff3c('0x10')]);router['put'](_0xff3c('0xd'),auth['isAuthenticated'](),controller[_0xff3c('0x11')]);router[_0xff3c('0x12')](_0xff3c('0xd'),auth[_0xff3c('0x9')](),controller[_0xff3c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8f14=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5f4241,_0x4cbefe){var _0x1c225d=function(_0x26e504){while(--_0x26e504){_0x5f4241['push'](_0x5f4241['shift']());}};_0x1c225d(++_0x4cbefe);}(_0x8f14,0x187));var _0x48f1=function(_0x330cf4,_0x266f1a){_0x330cf4=_0x330cf4-0x0;var _0x1681e1=_0x8f14[_0x330cf4];return _0x1681e1;};'use strict';var multer=require(_0x48f1('0x0'));var util=require(_0x48f1('0x1'));var path=require(_0x48f1('0x2'));var timeout=require(_0x48f1('0x3'));var express=require(_0x48f1('0x4'));var router=express[_0x48f1('0x5')]();var auth=require(_0x48f1('0x6'));var interaction=require(_0x48f1('0x7'));var config=require(_0x48f1('0x8'));var controller=require(_0x48f1('0x9'));router[_0x48f1('0xa')]('/',auth[_0x48f1('0xb')](),controller[_0x48f1('0xc')]);router[_0x48f1('0xa')](_0x48f1('0xd'),auth[_0x48f1('0xb')](),controller[_0x48f1('0xe')]);router[_0x48f1('0xa')](_0x48f1('0xf'),auth['isAuthenticated'](),controller[_0x48f1('0x10')]);router[_0x48f1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x48f1('0x12')](_0x48f1('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x48f1('0xf'),auth[_0x48f1('0xb')](),controller[_0x48f1('0x13')]);module[_0x48f1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4cbda55..719b85b 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 _0x24fd=['moment','exports','ENUM','blind','attended','STRING','sequelize'];(function(_0xd0bdde,_0x26947c){var _0x2466f0=function(_0x373676){while(--_0x373676){_0xd0bdde['push'](_0xd0bdde['shift']());}};_0x2466f0(++_0x26947c);}(_0x24fd,0xae));var _0xd24f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x24fd[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0xd24f('0x0'));var moment=require(_0xd24f('0x1'));module[_0xd24f('0x2')]={'type':{'type':Sequelize[_0xd24f('0x3')](_0xd24f('0x4'),_0xd24f('0x5'))},'result':{'type':Sequelize[_0xd24f('0x6')]},'transfererchannel':{'type':Sequelize[_0xd24f('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xd24f('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xd24f('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xd24f('0x6')]},'transferercontext':{'type':Sequelize[_0xd24f('0x6')]},'transfererexten':{'type':Sequelize[_0xd24f('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xd24f('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xd24f('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd24f('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xd24f('0x6')]},'transfereecontext':{'type':Sequelize[_0xd24f('0x6')]},'transfereeexten':{'type':Sequelize[_0xd24f('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xd24f('0x6')]},'isexternal':{'type':Sequelize[_0xd24f('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xd24f('0x6')]},'extension':{'type':Sequelize[_0xd24f('0x6')]}}; \ No newline at end of file +var _0xb254=['sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x434fce,_0x13f8c0){var _0x5d3083=function(_0x165232){while(--_0x165232){_0x434fce['push'](_0x434fce['shift']());}};_0x5d3083(++_0x13f8c0);}(_0xb254,0x173));var _0x4b25=function(_0x62fdee,_0x5291db){_0x62fdee=_0x62fdee-0x0;var _0x466ed1=_0xb254[_0x62fdee];return _0x466ed1;};'use strict';var Sequelize=require(_0x4b25('0x0'));var moment=require(_0x4b25('0x1'));module[_0x4b25('0x2')]={'type':{'type':Sequelize[_0x4b25('0x3')](_0x4b25('0x4'),_0x4b25('0x5'))},'result':{'type':Sequelize[_0x4b25('0x6')]},'transfererchannel':{'type':Sequelize[_0x4b25('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x4b25('0x6')]},'transferercalleridname':{'type':Sequelize[_0x4b25('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4b25('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x4b25('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x4b25('0x6')]},'transferercontext':{'type':Sequelize[_0x4b25('0x6')]},'transfererexten':{'type':Sequelize[_0x4b25('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x4b25('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x4b25('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x4b25('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x4b25('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x4b25('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x4b25('0x6')]},'isexternal':{'type':Sequelize[_0x4b25('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4b25('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 6d3c247..3a3b161 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 _0x55e2=['then','catch','show','length','includeAll','merge','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','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','VIRTUAL','options','VoiceTransferReport','include'];(function(_0x355a93,_0x20cd45){var _0x29343d=function(_0x3ecfbc){while(--_0x3ecfbc){_0x355a93['push'](_0x355a93['shift']());}};_0x29343d(++_0x20cd45);}(_0x55e2,0xd8));var _0x255e=function(_0x251a0e,_0x162bbe){_0x251a0e=_0x251a0e-0x0;var _0x4b23aa=_0x55e2[_0x251a0e];return _0x4b23aa;};'use strict';var pdf=require(_0x255e('0x0'));var emlformat=require(_0x255e('0x1'));var rimraf=require(_0x255e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x255e('0x3'));var moment=require(_0x255e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x255e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x255e('0x6'));var csv=require(_0x255e('0x7'));var ejs=require(_0x255e('0x8'));var fs=require('fs');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('0x7'));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['VoiceTransferReport'][_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['VoiceTransferReport'][_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['VoiceTransferReport']['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));};exports[_0x255e('0x43')]=function(_0x7cab34,_0x5450d0){return db['VoiceTransferReport']['describe']()[_0x255e('0x38')](respondWithResult(_0x5450d0,null))['catch'](handleError(_0x5450d0,null));}; \ No newline at end of file +var _0x189b=['intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','VoiceTransferReport','rawAttributes','type','key','map','query','keys','filters'];(function(_0x2d4377,_0x55e178){var _0x28dbb8=function(_0x3289da){while(--_0x3289da){_0x2d4377['push'](_0x2d4377['shift']());}};_0x28dbb8(++_0x55e178);}(_0x189b,0x15d));var _0xb189=function(_0x1b24eb,_0x39029e){_0x1b24eb=_0x1b24eb-0x0;var _0x157b17=_0x189b[_0x1b24eb];return _0x157b17;};'use strict';var pdf=require(_0xb189('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb189('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb189('0x2'));var rp=require(_0xb189('0x3'));var moment=require(_0xb189('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb189('0x5'));var util=require(_0xb189('0x6'));var path=require('path');var sox=require(_0xb189('0x7'));var csv=require(_0xb189('0x8'));var ejs=require(_0xb189('0x9'));var fs=require('fs');var _=require(_0xb189('0xa'));var squel=require('squel');var crypto=require(_0xb189('0xb'));var jsforce=require(_0xb189('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb189('0x8'));var querystring=require(_0xb189('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb189('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb189('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb189('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb189('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24f1e5,_0x29047a){_0x29047a=_0x29047a||0xcc;return function(_0x4a8a21){if(_0x4a8a21){return _0x24f1e5[_0xb189('0x12')](_0x29047a);}return _0x24f1e5[_0xb189('0x13')](_0x29047a)[_0xb189('0x14')]();};}function respondWithResult(_0x44b08e,_0x3fd773){_0x3fd773=_0x3fd773||0xc8;return function(_0x1f6b1d){if(_0x1f6b1d){return _0x44b08e[_0xb189('0x13')](_0x3fd773)[_0xb189('0x15')](_0x1f6b1d);}};}function respondWithFilteredResult(_0x3c2e53,_0x48c66e){return function(_0x2a339d){if(_0x2a339d){var _0x465c62=_0x2a339d['count'],_0x27ec69=_0x48c66e[_0xb189('0x16')],_0x75db06=_0x48c66e[_0xb189('0x16')]+_0x48c66e[_0xb189('0x17')],_0x1b960a;if(_0x75db06>=_0x465c62){_0x75db06=_0x465c62;_0x1b960a=0xc8;}else{_0x1b960a=0xce;}_0x3c2e53['status'](_0x1b960a);return _0x3c2e53[_0xb189('0x18')]('Content-Range',_0x27ec69+'-'+_0x75db06+'/'+_0x465c62)[_0xb189('0x15')](_0x2a339d);}return null;};}function patchUpdates(_0x3a02b6){return function(_0x3147d8){try{jsonpatch[_0xb189('0x19')](_0x3147d8,_0x3a02b6,!![]);}catch(_0x2877b4){return BPromise[_0xb189('0x1a')](_0x2877b4);}return _0x3147d8['save']();};}function saveUpdates(_0x3b0739,_0x2baff8){return function(_0x648c80){if(_0x648c80){return _0x648c80[_0xb189('0x1b')](_0x3b0739)[_0xb189('0x1c')](function(_0x247185){return _0x247185;});}return null;};}function removeEntity(_0x319460,_0x242847){return function(_0x431128){if(_0x431128){return _0x431128[_0xb189('0x1d')]()[_0xb189('0x1c')](function(){_0x319460[_0xb189('0x13')](0xcc)[_0xb189('0x14')]();});}};}function handleEntityNotFound(_0x471e60,_0x561f39){return function(_0x344b96){if(!_0x344b96){_0x471e60[_0xb189('0x12')](0x194);}return _0x344b96;};}function handleError(_0x200754,_0x2bb9e1){_0x2bb9e1=_0x2bb9e1||0x1f4;return function(_0x131c35){logger[_0xb189('0x1e')](_0x131c35[_0xb189('0x1f')]);if(_0x131c35[_0xb189('0x20')]){delete _0x131c35[_0xb189('0x20')];}_0x200754[_0xb189('0x13')](_0x2bb9e1)['send'](_0x131c35);};}exports['index']=function(_0x574cf0,_0x1abd09){var _0x28a780={},_0x397520={},_0x2fac5b={'count':0x0,'rows':[]};var _0x4e8963=_['map'](db[_0xb189('0x21')][_0xb189('0x22')],function(_0x3d9f76){return{'name':_0x3d9f76['fieldName'],'type':_0x3d9f76[_0xb189('0x23')][_0xb189('0x24')]};});_0x397520['model']=_[_0xb189('0x25')](_0x4e8963,_0xb189('0x20'));_0x397520[_0xb189('0x26')]=_[_0xb189('0x27')](_0x574cf0[_0xb189('0x26')]);_0x397520[_0xb189('0x28')]=_[_0xb189('0x29')](_0x397520[_0xb189('0x2a')],_0x397520[_0xb189('0x26')]);_0x28a780['attributes']=_['intersection'](_0x397520[_0xb189('0x2a')],qs[_0xb189('0x2b')](_0x574cf0['query'][_0xb189('0x2b')]));_0x28a780[_0xb189('0x2c')]=_0x28a780[_0xb189('0x2c')]['length']?_0x28a780['attributes']:_0x397520[_0xb189('0x2a')];if(!_0x574cf0[_0xb189('0x26')][_0xb189('0x2d')](_0xb189('0x2e'))){_0x28a780['limit']=qs[_0xb189('0x17')](_0x574cf0[_0xb189('0x26')][_0xb189('0x17')]);_0x28a780[_0xb189('0x16')]=qs[_0xb189('0x16')](_0x574cf0[_0xb189('0x26')][_0xb189('0x16')]);}_0x28a780['order']=qs[_0xb189('0x2f')](_0x574cf0[_0xb189('0x26')][_0xb189('0x2f')]);_0x28a780['where']=qs['filters'](_[_0xb189('0x30')](_0x574cf0[_0xb189('0x26')],_0x397520[_0xb189('0x28')]),_0x4e8963);if(_0x574cf0[_0xb189('0x26')][_0xb189('0x31')]){_0x28a780[_0xb189('0x32')]=_[_0xb189('0x33')](_0x28a780[_0xb189('0x32')],{'$or':_[_0xb189('0x25')](_0x4e8963,function(_0x8aaac0){if(_0x8aaac0[_0xb189('0x23')]!==_0xb189('0x34')){var _0x18beaf={};_0x18beaf[_0x8aaac0[_0xb189('0x20')]]={'$like':'%'+_0x574cf0[_0xb189('0x26')]['filter']+'%'};return _0x18beaf;}})});}_0x28a780=_[_0xb189('0x33')]({},_0x28a780,_0x574cf0[_0xb189('0x35')]);var _0x57e8ac={'where':_0x28a780[_0xb189('0x32')]};return db[_0xb189('0x21')][_0xb189('0x36')](_0x57e8ac)[_0xb189('0x1c')](function(_0x515be2){_0x2fac5b[_0xb189('0x36')]=_0x515be2;if(_0x574cf0['query'][_0xb189('0x37')]){_0x28a780[_0xb189('0x38')]=[{'all':!![]}];}return db[_0xb189('0x21')][_0xb189('0x39')](_0x28a780);})[_0xb189('0x1c')](function(_0x2124f4){_0x2fac5b[_0xb189('0x3a')]=_0x2124f4;return _0x2fac5b;})[_0xb189('0x1c')](respondWithFilteredResult(_0x1abd09,_0x28a780))[_0xb189('0x3b')](handleError(_0x1abd09,null));};exports['show']=function(_0x43ef3e,_0x245952){var _0xe85af3={'raw':!![],'where':{'id':_0x43ef3e[_0xb189('0x3c')]['id']}},_0x5638e8={};_0x5638e8[_0xb189('0x2a')]=_[_0xb189('0x27')](db[_0xb189('0x21')]['rawAttributes']);_0x5638e8[_0xb189('0x26')]=_[_0xb189('0x27')](_0x43ef3e[_0xb189('0x26')]);_0x5638e8[_0xb189('0x28')]=_['intersection'](_0x5638e8[_0xb189('0x2a')],_0x5638e8['query']);_0xe85af3['attributes']=_[_0xb189('0x29')](_0x5638e8[_0xb189('0x2a')],qs['fields'](_0x43ef3e[_0xb189('0x26')]['fields']));_0xe85af3[_0xb189('0x2c')]=_0xe85af3[_0xb189('0x2c')]['length']?_0xe85af3[_0xb189('0x2c')]:_0x5638e8['model'];if(_0x43ef3e[_0xb189('0x26')][_0xb189('0x37')]){_0xe85af3['include']=[{'all':!![]}];}_0xe85af3=_[_0xb189('0x33')]({},_0xe85af3,_0x43ef3e['options']);return db[_0xb189('0x21')][_0xb189('0x3d')](_0xe85af3)[_0xb189('0x1c')](handleEntityNotFound(_0x245952,null))[_0xb189('0x1c')](respondWithResult(_0x245952,null))[_0xb189('0x3b')](handleError(_0x245952,null));};exports[_0xb189('0x3e')]=function(_0x471845,_0x16beeb){return db['VoiceTransferReport'][_0xb189('0x3e')](_0x471845['body'],{})[_0xb189('0x1c')](respondWithResult(_0x16beeb,0xc9))[_0xb189('0x3b')](handleError(_0x16beeb,null));};exports[_0xb189('0x1b')]=function(_0x2b7077,_0x3f1d06){if(_0x2b7077[_0xb189('0x3f')]['id']){delete _0x2b7077['body']['id'];}return db[_0xb189('0x21')]['find']({'where':{'id':_0x2b7077['params']['id']}})['then'](handleEntityNotFound(_0x3f1d06,null))[_0xb189('0x1c')](saveUpdates(_0x2b7077[_0xb189('0x3f')],null))[_0xb189('0x1c')](respondWithResult(_0x3f1d06,null))[_0xb189('0x3b')](handleError(_0x3f1d06,null));};exports[_0xb189('0x1d')]=function(_0xc712b1,_0x4b36b2){return db['VoiceTransferReport'][_0xb189('0x3d')]({'where':{'id':_0xc712b1[_0xb189('0x3c')]['id']}})[_0xb189('0x1c')](handleEntityNotFound(_0x4b36b2,null))[_0xb189('0x1c')](removeEntity(_0x4b36b2,null))[_0xb189('0x3b')](handleError(_0x4b36b2,null));};exports[_0xb189('0x40')]=function(_0x369aa4,_0x4ba644){return db['VoiceTransferReport']['describe']()[_0xb189('0x1c')](respondWithResult(_0x4ba644,null))[_0xb189('0x3b')](handleError(_0x4ba644,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 45b3339..0c30c7e 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 _0x1a95=['../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x7633c,_0x1e45bf){var _0x1b77e2=function(_0x4c3e7f){while(--_0x4c3e7f){_0x7633c['push'](_0x7633c['shift']());}};_0x1b77e2(++_0x1e45bf);}(_0x1a95,0x130));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x51a9('0x0'));var util=require('util');var logger=require(_0x51a9('0x1'))('api');var moment=require(_0x51a9('0x2'));var BPromise=require(_0x51a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a9('0x4'));var rimraf=require(_0x51a9('0x5'));var config=require(_0x51a9('0x6'));var attributes=require(_0x51a9('0x7'));module[_0x51a9('0x8')]=function(_0x207e40,_0x432df4){return _0x207e40['define']('VoiceTransferReport',attributes,{'tableName':_0x51a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc35f=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','report_call_transfer','lodash'];(function(_0x3221d7,_0x1ac2e8){var _0x2aba70=function(_0x2795c4){while(--_0x2795c4){_0x3221d7['push'](_0x3221d7['shift']());}};_0x2aba70(++_0x1ac2e8);}(_0xc35f,0x1ca));var _0xfc35=function(_0x4b978a,_0x472e65){_0x4b978a=_0x4b978a-0x0;var _0x2dbd2c=_0xc35f[_0x4b978a];return _0x2dbd2c;};'use strict';var _=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var logger=require(_0xfc35('0x2'))(_0xfc35('0x3'));var moment=require('moment');var BPromise=require(_0xfc35('0x4'));var rp=require(_0xfc35('0x5'));var fs=require('fs');var path=require(_0xfc35('0x6'));var rimraf=require('rimraf');var config=require(_0xfc35('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x6d47a0,_0x1991a5){return _0x6d47a0['define']('VoiceTransferReport',attributes,{'tableName':_0xfc35('0x8'),'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 59bb884..42a1e6b 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 _0x1c0a=['catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x38a792,_0x5a21a5){var _0x2cee7b=function(_0x3e9555){while(--_0x3e9555){_0x38a792['push'](_0x38a792['shift']());}};_0x2cee7b(++_0x5a21a5);}(_0x1c0a,0x14a));var _0xa1c0=function(_0x534b5a,_0x2ed076){_0x534b5a=_0x534b5a-0x0;var _0x311184=_0x1c0a[_0x534b5a];return _0x311184;};'use strict';var _=require('lodash');var util=require(_0xa1c0('0x0'));var moment=require(_0xa1c0('0x1'));var BPromise=require(_0xa1c0('0x2'));var rs=require(_0xa1c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1c0('0x4'))['db'];var utils=require(_0xa1c0('0x5'));var logger=require(_0xa1c0('0x6'))('rpc');var config=require(_0xa1c0('0x7'));var jayson=require(_0xa1c0('0x8'));var client=jayson[_0xa1c0('0x9')][_0xa1c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50f5cf,_0x38a9d4,_0xff6c60){return new BPromise(function(_0x2818a4,_0x5e7146){return client['request'](_0x50f5cf,_0xff6c60)['then'](function(_0x5d386c){logger[_0xa1c0('0xb')](_0xa1c0('0xc'),_0x38a9d4,'request\x20sent');logger[_0xa1c0('0xd')](_0xa1c0('0xe'),_0x38a9d4,'request\x20sent',JSON[_0xa1c0('0xf')](_0x5d386c));if(_0x5d386c['error']){if(_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x11')]===0x1f4){logger[_0xa1c0('0x10')](_0xa1c0('0xc'),_0x38a9d4,_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x12')]);return _0x5e7146(_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x12')]);}logger[_0xa1c0('0x10')](_0xa1c0('0xc'),_0x38a9d4,_0x5d386c[_0xa1c0('0x10')]['message']);return _0x2818a4(_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x12')]);}else{logger[_0xa1c0('0xb')](_0xa1c0('0xc'),_0x38a9d4,_0xa1c0('0x13'));_0x2818a4(_0x5d386c[_0xa1c0('0x14')][_0xa1c0('0x12')]);}})[_0xa1c0('0x15')](function(_0x5c74ba){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x38a9d4,_0x5c74ba);_0x5e7146(_0x5c74ba);});});}exports[_0xa1c0('0x16')]=function(_0x8e871b){var _0x4215c1=this;return new Promise(function(_0x1de2b1,_0x49da8b){return db[_0xa1c0('0x17')]['create'](_0x8e871b['body'],{'raw':_0x8e871b['options']?_0x8e871b[_0xa1c0('0x18')][_0xa1c0('0x19')]===undefined?!![]:![]:!![]})[_0xa1c0('0x1a')](function(_0x122915){logger[_0xa1c0('0xb')](_0xa1c0('0x16'),_0x8e871b);logger[_0xa1c0('0xd')](_0xa1c0('0x16'),_0x8e871b,JSON[_0xa1c0('0xf')](_0x122915));_0x1de2b1(_0x122915);})['catch'](function(_0x51625b){logger[_0xa1c0('0x10')]('CreateVoiceTransferReport',_0x51625b[_0xa1c0('0x12')],_0x8e871b);_0x49da8b(_0x4215c1[_0xa1c0('0x10')](0x1f4,_0x51625b[_0xa1c0('0x12')]));});});}; \ No newline at end of file +var _0x306d=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','randomstring'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x306d,0x176));var _0xd306=function(_0x50e8b6,_0x1bd6c8){_0x50e8b6=_0x50e8b6-0x0;var _0x1d309d=_0x306d[_0x50e8b6];return _0x1d309d;};'use strict';var _=require(_0xd306('0x0'));var util=require(_0xd306('0x1'));var moment=require(_0xd306('0x2'));var BPromise=require('bluebird');var rs=require(_0xd306('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd306('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd306('0x5'))(_0xd306('0x6'));var config=require(_0xd306('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd306('0x8')][_0xd306('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x485485,_0x3778f4,_0x5d6508){return new BPromise(function(_0x37c538,_0x3d5c1c){return client['request'](_0x485485,_0x5d6508)[_0xd306('0xa')](function(_0x1c2018){logger[_0xd306('0xb')](_0xd306('0xc'),_0x3778f4,'request\x20sent');logger[_0xd306('0xd')](_0xd306('0xe'),_0x3778f4,_0xd306('0xf'),JSON[_0xd306('0x10')](_0x1c2018));if(_0x1c2018[_0xd306('0x11')]){if(_0x1c2018[_0xd306('0x11')][_0xd306('0x12')]===0x1f4){logger[_0xd306('0x11')](_0xd306('0xc'),_0x3778f4,_0x1c2018['error'][_0xd306('0x13')]);return _0x3d5c1c(_0x1c2018[_0xd306('0x11')][_0xd306('0x13')]);}logger['error'](_0xd306('0xc'),_0x3778f4,_0x1c2018['error']['message']);return _0x37c538(_0x1c2018['error'][_0xd306('0x13')]);}else{logger[_0xd306('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x3778f4,_0xd306('0xf'));_0x37c538(_0x1c2018[_0xd306('0x14')][_0xd306('0x13')]);}})[_0xd306('0x15')](function(_0x4a5a70){logger['error'](_0xd306('0xc'),_0x3778f4,_0x4a5a70);_0x3d5c1c(_0x4a5a70);});});}exports[_0xd306('0x16')]=function(_0xa1c86f){var _0x4a784e=this;return new Promise(function(_0x5add89,_0x8a66fc){return db[_0xd306('0x17')][_0xd306('0x18')](_0xa1c86f[_0xd306('0x19')],{'raw':_0xa1c86f[_0xd306('0x1a')]?_0xa1c86f['options']['raw']===undefined?!![]:![]:!![]})[_0xd306('0xa')](function(_0x3d44a1){logger['info']('CreateVoiceTransferReport',_0xa1c86f);logger['debug'](_0xd306('0x16'),_0xa1c86f,JSON['stringify'](_0x3d44a1));_0x5add89(_0x3d44a1);})[_0xd306('0x15')](function(_0x5c5811){logger['error'](_0xd306('0x16'),_0x5c5811[_0xd306('0x13')],_0xa1c86f);_0x8a66fc(_0x4a784e['error'](0x1f4,_0x5c5811[_0xd306('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0f6fa95..6514576 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 _0xb32d=['originate','/hangup','isAuthenticated','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate'];(function(_0x29f6cd,_0x4f0f88){var _0xb25b30=function(_0x2f9c72){while(--_0x2f9c72){_0x29f6cd['push'](_0x29f6cd['shift']());}};_0xb25b30(++_0x4f0f88);}(_0xb32d,0x1da));var _0xdb32=function(_0x2ccd5e,_0x3deb44){_0x2ccd5e=_0x2ccd5e-0x0;var _0x1a758e=_0xb32d[_0x2ccd5e];return _0x1a758e;};'use strict';var express=require(_0xdb32('0x0'));var router=express[_0xdb32('0x1')]();var auth=require(_0xdb32('0x2'));var controller=require(_0xdb32('0x3'));router[_0xdb32('0x4')]('/originate',auth['isAuthenticated'](),auth[_0xdb32('0x5')](),controller[_0xdb32('0x6')]);router['post'](_0xdb32('0x7'),auth[_0xdb32('0x8')](),auth[_0xdb32('0x5')](),controller[_0xdb32('0x9')]);router[_0xdb32('0x4')](_0xdb32('0xa'),auth['isAuthenticated'](),auth[_0xdb32('0x5')](),controller[_0xdb32('0xb')]);router[_0xdb32('0x4')](_0xdb32('0xc'),auth[_0xdb32('0x8')](),auth[_0xdb32('0x5')](),controller[_0xdb32('0xd')]);router[_0xdb32('0x4')](_0xdb32('0xe'),auth[_0xdb32('0x8')](),auth[_0xdb32('0x5')](),controller[_0xdb32('0xf')]);router[_0xdb32('0x4')](_0xdb32('0x10'),auth[_0xdb32('0x8')](),auth[_0xdb32('0x5')](),controller[_0xdb32('0x11')]);router[_0xdb32('0x4')](_0xdb32('0x12'),auth[_0xdb32('0x8')](),auth[_0xdb32('0x5')](),controller['transfer']);module[_0xdb32('0x13')]=router; \ No newline at end of file +var _0x5645=['express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','answer','/hold','hold','unhold','/calls','calls','/transfer','transfer'];(function(_0x9c3c0a,_0x5bfee4){var _0x216206=function(_0x198aec){while(--_0x198aec){_0x9c3c0a['push'](_0x9c3c0a['shift']());}};_0x216206(++_0x5bfee4);}(_0x5645,0x19e));var _0x5564=function(_0x3ba25e,_0x39a731){_0x3ba25e=_0x3ba25e-0x0;var _0x13e0d8=_0x5645[_0x3ba25e];return _0x13e0d8;};'use strict';var express=require(_0x5564('0x0'));var router=express[_0x5564('0x1')]();var auth=require(_0x5564('0x2'));var controller=require(_0x5564('0x3'));router[_0x5564('0x4')]('/originate',auth[_0x5564('0x5')](),auth[_0x5564('0x6')](),controller[_0x5564('0x7')]);router[_0x5564('0x4')](_0x5564('0x8'),auth[_0x5564('0x5')](),auth[_0x5564('0x6')](),controller[_0x5564('0x9')]);router[_0x5564('0x4')]('/answer',auth['isAuthenticated'](),auth[_0x5564('0x6')](),controller[_0x5564('0xa')]);router[_0x5564('0x4')](_0x5564('0xb'),auth[_0x5564('0x5')](),auth['canUpdate'](),controller[_0x5564('0xc')]);router[_0x5564('0x4')]('/unhold',auth[_0x5564('0x5')](),auth[_0x5564('0x6')](),controller[_0x5564('0xd')]);router[_0x5564('0x4')](_0x5564('0xe'),auth[_0x5564('0x5')](),auth[_0x5564('0x6')](),controller[_0x5564('0xf')]);router['post'](_0x5564('0x10'),auth['isAuthenticated'](),auth[_0x5564('0x6')](),controller[_0x5564('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 7295acd..8ec227f 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 _0x6f0d=['log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','User','findOne','agent','then','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','userId','callNumber','callbackUrl','format','json','originate\x20executed!','catch','hangup','entityFound:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','all','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit'];(function(_0x54bcd8,_0x56fb44){var _0x421707=function(_0x5980b1){while(--_0x5980b1){_0x54bcd8['push'](_0x54bcd8['shift']());}};_0x421707(++_0x56fb44);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x57108b,_0x4aa61b){_0x57108b=_0x57108b-0x0;var _0xe15f4=_0x6f0d[_0x57108b];return _0xe15f4;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xd6f0('0x0'));var db=require(_0xd6f0('0x1'))['db'];var config=require(_0xd6f0('0x2'));var util=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var jayson=require(_0xd6f0('0x4'));var amiClient=jayson[_0xd6f0('0x5')][_0xd6f0('0x6')]({'port':0x232a});var logger=require(_0xd6f0('0x7'))(_0xd6f0('0x8'));var Redis=require('ioredis');config[_0xd6f0('0x9')]=_['defaults'](config[_0xd6f0('0x9')],{'host':_0xd6f0('0xa'),'port':0x18eb});var io=require(_0xd6f0('0xb'))(new Redis(config[_0xd6f0('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd6f0('0xc')]},'callNumber':{'type':_0xd6f0('0xd'),'required':[!![],_0xd6f0('0xe')]},'callerId':{'type':_0xd6f0('0xd')},'callbackUrl':{'type':_0xd6f0('0xd')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd6f0('0xc')]},'sessionId':{'type':_0xd6f0('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd6f0('0xf'),'required':[!![],_0xd6f0('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd6f0('0xf'),'required':[!![],_0xd6f0('0xc')]},'sessionId':{'type':_0xd6f0('0xd'),'required':[!![],_0xd6f0('0x10')]},'transferNumber':{'type':_0xd6f0('0xd'),'required':[!![],_0xd6f0('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xd6f0('0xf'),'required':[!![],_0xd6f0('0xc')]},'sessionId':{'type':_0xd6f0('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd6f0('0xc')]},'sessionId':{'type':_0xd6f0('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd6f0('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd6f0('0xc')]}});function emit(_0x154e3e,_0x41bd99,_0x472156){logger[_0xd6f0('0x12')](_0x154e3e,_0x41bd99,JSON[_0xd6f0('0x13')](_0x472156));io['to'](_0x154e3e)[_0xd6f0('0x14')](_0x41bd99,_0x472156);}function handleError(_0x29fbb9){return function(_0x2e71bd){console[_0xd6f0('0x15')](_0xd6f0('0x16'),_0x2e71bd,_0x2e71bd instanceof RangeError);logger[_0xd6f0('0x17')](_0x2e71bd[_0xd6f0('0x18')]);if(_0x2e71bd instanceof RangeError){if(_0x2e71bd[_0xd6f0('0x19')]){delete _0x2e71bd[_0xd6f0('0x19')];}_0x29fbb9[_0xd6f0('0x1a')](0x194)['send'](_0x2e71bd);}else{if(_0x2e71bd['name']){delete _0x2e71bd[_0xd6f0('0x19')];}_0x29fbb9[_0xd6f0('0x1a')](0x1f4)[_0xd6f0('0x1b')](_0x2e71bd);}};}function checkError(){return function(_0x54300d){if(!_0x54300d){throw new RangeError(_0xd6f0('0x1c'));}return _0x54300d;};}function respondWithRpcPromise(_0x19a545,_0x557c9b){return new BPromise(function(_0x86dde0,_0x515687){var _0x1ee584=amiClient;return _0x1ee584[_0xd6f0('0x1d')](_0x19a545,_0x557c9b)['then'](function(_0xb9e820){if(_0xb9e820[_0xd6f0('0x17')]){if(_0xb9e820['error'][_0xd6f0('0x1e')]===0x1f4){return _0x515687(_0xb9e820[_0xd6f0('0x17')][_0xd6f0('0x1f')]);}return _0x86dde0(_0xb9e820['error'][_0xd6f0('0x1f')]);}else{_0x86dde0(_0xb9e820[_0xd6f0('0x20')]);}})['catch'](function(_0xcea0ae){_0x515687(_0xcea0ae);});});}function getAgent(_0x551be8){return db[_0xd6f0('0x21')][_0xd6f0('0x22')]({'where':{'id':_0x551be8,'role':_0xd6f0('0x23')}})[_0xd6f0('0x24')](checkError());}function getAgentCheckSession(_0x4101bd,_0x715aab){return new BPromise(function(_0x12d6ec,_0x26799c){var _0x48975d=respondWithRpcPromise(_0xd6f0('0x25'));var _0x1982d3=getAgent(_0x4101bd);Promise['all']([_0x48975d,_0x1982d3])[_0xd6f0('0x24')](function(_0x385947){var _0x27db5e=_0x385947[0x0];var _0xb61222=_0x385947[0x1];var _0x1a3967=_[_0xd6f0('0x26')](_0x27db5e[_0xd6f0('0x27')],function(_0x3151f8){return _0x3151f8[_0xd6f0('0x28')]==_0xb61222['id']&&_0x3151f8[_0xd6f0('0x29')]==_0x715aab;});if(_0x1a3967[_0xd6f0('0x2a')]==0x1){_0x12d6ec(_0xb61222);}else{_0x26799c(new RangeError(_0xd6f0('0x2b')+_0x715aab+_0xd6f0('0x2c')));}});});}exports[_0xd6f0('0x2d')]=function(_0xbdd223,_0x2d7c90){logger[_0xd6f0('0x12')](_0xd6f0('0x2e'),_0xbdd223[_0xd6f0('0x2f')]);var _0x180e5f=originateValidation[_0xd6f0('0x30')](_0xbdd223[_0xd6f0('0x2f')]);if(_0x180e5f['length']>0x0){return _0x2d7c90[_0xd6f0('0x1a')](0x190)['json'](_0x180e5f);}var _0x58d2c5=_0xbdd223[_0xd6f0('0x2f')][_0xd6f0('0x31')];var _0x12a6fa=_0xbdd223[_0xd6f0('0x2f')][_0xd6f0('0x32')];var _0x5c482f=_0xbdd223[_0xd6f0('0x2f')]['callerId'];var _0x27b5b0=_0xbdd223[_0xd6f0('0x2f')][_0xd6f0('0x33')];return getAgent(_0x58d2c5)[_0xd6f0('0x24')](function(_0x518751){logger['info']('entityFound:',_0x518751[_0xd6f0('0x19')]);emit(util[_0xd6f0('0x34')]('user:%s',_0x518751[_0xd6f0('0x19')]),'webbar:originate',{'callNumber':_0x12a6fa,'callerId':_0x5c482f,'callbackUrl':_0x27b5b0});return _0x2d7c90[_0xd6f0('0x1a')](0xc8)[_0xd6f0('0x35')]({'error':![],'message':_0xd6f0('0x36')});})[_0xd6f0('0x37')](handleError(_0x2d7c90));};exports[_0xd6f0('0x38')]=function(_0x3d1280,_0x6b44fa){logger['info']('hangup\x20fired:',_0x3d1280[_0xd6f0('0x2f')]);var _0xf879a6=hangupValidation[_0xd6f0('0x30')](_0x3d1280['body']);if(_0xf879a6['length']>0x0){return _0x6b44fa[_0xd6f0('0x1a')](0x190)[_0xd6f0('0x35')](_0xf879a6);}var _0x39fd07=_0x3d1280[_0xd6f0('0x2f')][_0xd6f0('0x31')];var _0x2b5df5=_0x3d1280[_0xd6f0('0x2f')][_0xd6f0('0x29')];return getAgent(_0x39fd07)['then'](function(_0x1af620){logger[_0xd6f0('0x12')](_0xd6f0('0x39'),_0x1af620[_0xd6f0('0x19')]);emit(util['format'](_0xd6f0('0x3a'),_0x1af620[_0xd6f0('0x19')]),_0xd6f0('0x3b'),{'sessionId':_0x2b5df5});return _0x6b44fa[_0xd6f0('0x1a')](0xc8)[_0xd6f0('0x35')]({'error':![],'message':'hangup\x20executed!'});})[_0xd6f0('0x37')](handleError(_0x6b44fa));};exports[_0xd6f0('0x3c')]=function(_0x412f55,_0x5848dc){logger[_0xd6f0('0x12')](_0xd6f0('0x3d'),_0x412f55['body']);var _0x516ffd=answerValidation[_0xd6f0('0x30')](_0x412f55[_0xd6f0('0x2f')]);if(_0x516ffd[_0xd6f0('0x2a')]>0x0){return _0x5848dc['status'](0x190)[_0xd6f0('0x35')](_0x516ffd);}var _0x2d32f0=_0x412f55['body'][_0xd6f0('0x31')];var _0x3080eb=_0x412f55[_0xd6f0('0x2f')][_0xd6f0('0x29')];return getAgent(_0x2d32f0)['then'](function(_0x664096){logger[_0xd6f0('0x12')](_0xd6f0('0x39'),_0x664096[_0xd6f0('0x19')]);emit(util[_0xd6f0('0x34')](_0xd6f0('0x3a'),_0x664096[_0xd6f0('0x19')]),_0xd6f0('0x3e'),{'sessionId':_0x3080eb});return _0x5848dc['status'](0xc8)[_0xd6f0('0x35')]({'error':![],'message':_0xd6f0('0x3f')});})['catch'](handleError(_0x5848dc));};exports[_0xd6f0('0x40')]=function(_0x39ca69,_0x1bcb36){logger[_0xd6f0('0x12')]('hold\x20fired:',_0x39ca69[_0xd6f0('0x2f')]);var _0xe5fd11=holdValidation['validate'](_0x39ca69['body']);if(_0xe5fd11[_0xd6f0('0x2a')]>0x0){return _0x1bcb36['status'](0x190)[_0xd6f0('0x35')](_0xe5fd11);}var _0x61b354=_0x39ca69[_0xd6f0('0x2f')]['userId'];var _0x1ddce2=_0x39ca69[_0xd6f0('0x2f')][_0xd6f0('0x29')];return getAgent(_0x61b354)[_0xd6f0('0x24')](function(_0xc4147e){logger['info'](_0xd6f0('0x39'),_0xc4147e['name']);emit(util[_0xd6f0('0x34')](_0xd6f0('0x3a'),_0xc4147e[_0xd6f0('0x19')]),_0xd6f0('0x41'),{'sessionId':_0x1ddce2});return _0x1bcb36['status'](0xc8)['json']({'error':![],'message':_0xd6f0('0x42')});})[_0xd6f0('0x37')](handleError(_0x1bcb36));};exports['unhold']=function(_0xa68b18,_0x56c448){logger[_0xd6f0('0x12')](_0xd6f0('0x43'),_0xa68b18[_0xd6f0('0x2f')]);var _0x41d115=unholdValidation[_0xd6f0('0x30')](_0xa68b18['body']);if(_0x41d115[_0xd6f0('0x2a')]>0x0){return _0x56c448[_0xd6f0('0x1a')](0x190)[_0xd6f0('0x35')](_0x41d115);}var _0x25d0a9=_0xa68b18[_0xd6f0('0x2f')][_0xd6f0('0x31')];var _0x211773=_0xa68b18[_0xd6f0('0x2f')]['sessionId'];return getAgent(_0x25d0a9)[_0xd6f0('0x24')](function(_0x3eb4dc){logger[_0xd6f0('0x12')](_0xd6f0('0x39'),_0x3eb4dc[_0xd6f0('0x19')]);emit(util[_0xd6f0('0x34')](_0xd6f0('0x3a'),_0x3eb4dc[_0xd6f0('0x19')]),_0xd6f0('0x44'),{'sessionId':_0x211773});return _0x56c448['status'](0xc8)[_0xd6f0('0x35')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x56c448));};exports[_0xd6f0('0x45')]=function(_0x55fd25,_0x539ef1){logger[_0xd6f0('0x12')](_0xd6f0('0x46'),_0x539ef1[_0xd6f0('0x2f')]);var _0x47a159=callsValidation[_0xd6f0('0x30')](_0x55fd25[_0xd6f0('0x2f')]);if(_0x47a159[_0xd6f0('0x2a')]>0x0){return _0x539ef1['status'](0x190)[_0xd6f0('0x35')](_0x47a159);}var _0x357193=_0x55fd25['body'][_0xd6f0('0x31')];var _0x328e0a=respondWithRpcPromise('VoiceChannels');var _0x3558ac=getAgent(_0x357193);return Promise[_0xd6f0('0x47')]([_0x328e0a,_0x3558ac])[_0xd6f0('0x24')](function(_0x1d9972){var _0x3e6533=_0x1d9972[0x0];var _0x48bfb3=_0x1d9972[0x1];var _0x291e7b=_[_0xd6f0('0x26')](_0x3e6533['rows'],function(_0x26d728){return _0x26d728[_0xd6f0('0x28')]==_0x48bfb3['id'];});return _0x539ef1[_0xd6f0('0x1a')](0xc8)['json']({'count':_0x291e7b[_0xd6f0('0x2a')],'rows':_0x291e7b});})['catch'](handleError(_0x539ef1));};exports['conference']=function(_0x4bdedd,_0x5c5aa4){logger[_0xd6f0('0x12')](_0xd6f0('0x48'),_0x4bdedd[_0xd6f0('0x2f')]);var _0x1febb7=conferenceValidation['validate'](_0x4bdedd[_0xd6f0('0x2f')]);if(_0x1febb7['length']>0x0){return _0x5c5aa4[_0xd6f0('0x1a')](0x190)[_0xd6f0('0x35')](_0x1febb7);}var _0x2ba889=_0x4bdedd['body'][_0xd6f0('0x31')];return getAgent(_0x2ba889)[_0xd6f0('0x24')](function(_0x269dd7){logger[_0xd6f0('0x12')]('entityFound:',_0x269dd7[_0xd6f0('0x19')]);emit(util[_0xd6f0('0x34')](_0xd6f0('0x3a'),_0x269dd7['name']),_0xd6f0('0x49'));return _0x5c5aa4[_0xd6f0('0x1a')](0xc8)[_0xd6f0('0x35')]({'error':![],'message':_0xd6f0('0x4a')});})['catch'](handleError(_0x5c5aa4));};exports[_0xd6f0('0x4b')]=function(_0x2082b5,_0x1096e0){logger[_0xd6f0('0x12')]('transfer\x20fired:',_0x2082b5['body']);var _0x490bc4=transferValidation['validate'](_0x2082b5[_0xd6f0('0x2f')]);if(_0x490bc4[_0xd6f0('0x2a')]>0x0){return _0x1096e0[_0xd6f0('0x1a')](0x190)[_0xd6f0('0x35')](_0x490bc4);}var _0x318a64=_0x2082b5[_0xd6f0('0x2f')][_0xd6f0('0x31')];var _0x1b298a=_0x2082b5[_0xd6f0('0x2f')]['sessionId'];var _0x55f96e=_0x2082b5[_0xd6f0('0x2f')]['transferNumber'];return getAgent(_0x318a64)[_0xd6f0('0x24')](function(_0x3a85bd){logger[_0xd6f0('0x12')](_0xd6f0('0x39'),_0x3a85bd[_0xd6f0('0x19')]);emit(util[_0xd6f0('0x34')](_0xd6f0('0x3a'),_0x3a85bd['name']),_0xd6f0('0x4c'),{'sessionId':_0x1b298a,'transferNumber':_0x55f96e});return _0x1096e0[_0xd6f0('0x1a')](0xc8)[_0xd6f0('0x35')]({'error':![],'message':'transfer\x20executed!'});})[_0xd6f0('0x37')](handleError(_0x1096e0));}; \ No newline at end of file +var _0xb661=['conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','VoiceChannels','then','filter','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','userId','sessionId','webbar:hangup','answer','answer\x20fired:','webbar:answer','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','all'];(function(_0x1ff347,_0x2f7546){var _0x10128d=function(_0x4522c3){while(--_0x4522c3){_0x1ff347['push'](_0x1ff347['shift']());}};_0x10128d(++_0x2f7546);}(_0xb661,0x1d0));var _0x1b66=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb661[_0x501510];return _0x1e6ee5;};'use strict';var path=require(_0x1b66('0x0'));var fs=require('fs');var _=require(_0x1b66('0x1'));var db=require(_0x1b66('0x2'))['db'];var config=require(_0x1b66('0x3'));var util=require(_0x1b66('0x4'));var BPromise=require(_0x1b66('0x5'));var jayson=require(_0x1b66('0x6'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x1b66('0x7'));config[_0x1b66('0x8')]=_['defaults'](config[_0x1b66('0x8')],{'host':_0x1b66('0x9'),'port':0x18eb});var io=require(_0x1b66('0xa'))(new Redis(config[_0x1b66('0x8')]));var Schema=require(_0x1b66('0xb'));var originateValidation=new Schema({'userId':{'type':_0x1b66('0xc'),'required':[!![],_0x1b66('0xd')]},'callNumber':{'type':_0x1b66('0xe'),'required':[!![],_0x1b66('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x1b66('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1b66('0xc'),'required':[!![],_0x1b66('0xd')]},'sessionId':{'type':_0x1b66('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1b66('0xc'),'required':[!![],_0x1b66('0xd')]},'sessionId':{'type':_0x1b66('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1b66('0xc'),'required':[!![],_0x1b66('0xd')]},'sessionId':{'type':_0x1b66('0xe'),'required':[!![],_0x1b66('0x10')]},'transferNumber':{'type':_0x1b66('0xe'),'required':[!![],_0x1b66('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1b66('0xc'),'required':[!![],_0x1b66('0xd')]},'sessionId':{'type':_0x1b66('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1b66('0xc'),'required':[!![],_0x1b66('0xd')]},'sessionId':{'type':_0x1b66('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x1b66('0xc'),'required':[!![],_0x1b66('0xd')]}});function emit(_0x354086,_0x4af411,_0x2cdfef){logger[_0x1b66('0x12')](_0x354086,_0x4af411,JSON[_0x1b66('0x13')](_0x2cdfef));io['to'](_0x354086)[_0x1b66('0x14')](_0x4af411,_0x2cdfef);}function handleError(_0x4dff7a){return function(_0x535925){console[_0x1b66('0x15')](_0x1b66('0x16'),_0x535925,_0x535925 instanceof RangeError);logger[_0x1b66('0x17')](_0x535925[_0x1b66('0x18')]);if(_0x535925 instanceof RangeError){if(_0x535925[_0x1b66('0x19')]){delete _0x535925[_0x1b66('0x19')];}_0x4dff7a[_0x1b66('0x1a')](0x194)[_0x1b66('0x1b')](_0x535925);}else{if(_0x535925['name']){delete _0x535925['name'];}_0x4dff7a[_0x1b66('0x1a')](0x1f4)[_0x1b66('0x1b')](_0x535925);}};}function checkError(){return function(_0x182684){if(!_0x182684){throw new RangeError(_0x1b66('0x1c'));}return _0x182684;};}function respondWithRpcPromise(_0x491f5c,_0x760da){return new BPromise(function(_0x5c5479,_0x2fe9a0){var _0x141b17=amiClient;return _0x141b17[_0x1b66('0x1d')](_0x491f5c,_0x760da)['then'](function(_0x47c94e){if(_0x47c94e[_0x1b66('0x17')]){if(_0x47c94e[_0x1b66('0x17')][_0x1b66('0x1e')]===0x1f4){return _0x2fe9a0(_0x47c94e[_0x1b66('0x17')][_0x1b66('0x1f')]);}return _0x5c5479(_0x47c94e[_0x1b66('0x17')]['message']);}else{_0x5c5479(_0x47c94e[_0x1b66('0x20')]);}})[_0x1b66('0x21')](function(_0xc65f78){_0x2fe9a0(_0xc65f78);});});}function getAgent(_0x432f99){return db[_0x1b66('0x22')][_0x1b66('0x23')]({'where':{'id':_0x432f99,'role':_0x1b66('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x18aec8,_0x3529b6){return new BPromise(function(_0x43d336,_0x2b7412){var _0x1b3fd5=respondWithRpcPromise(_0x1b66('0x25'));var _0x24f00e=getAgent(_0x18aec8);Promise['all']([_0x1b3fd5,_0x24f00e])[_0x1b66('0x26')](function(_0x26c6a4){var _0x76bd46=_0x26c6a4[0x0];var _0xd875bd=_0x26c6a4[0x1];var _0x58b086=_[_0x1b66('0x27')](_0x76bd46['rows'],function(_0xe76bd0){return _0xe76bd0[_0x1b66('0x28')]==_0xd875bd['id']&&_0xe76bd0['sessionId']==_0x3529b6;});if(_0x58b086[_0x1b66('0x29')]==0x1){_0x43d336(_0xd875bd);}else{_0x2b7412(new RangeError('sessionId\x20'+_0x3529b6+_0x1b66('0x2a')));}});});}exports[_0x1b66('0x2b')]=function(_0x4f2398,_0x14d0e2){logger[_0x1b66('0x12')](_0x1b66('0x2c'),_0x4f2398[_0x1b66('0x2d')]);var _0x12458b=originateValidation[_0x1b66('0xb')](_0x4f2398[_0x1b66('0x2d')]);if(_0x12458b[_0x1b66('0x29')]>0x0){return _0x14d0e2[_0x1b66('0x1a')](0x190)[_0x1b66('0x2e')](_0x12458b);}var _0x334eca=_0x4f2398[_0x1b66('0x2d')]['userId'];var _0x5e7ad7=_0x4f2398[_0x1b66('0x2d')][_0x1b66('0x2f')];var _0x1484ff=_0x4f2398[_0x1b66('0x2d')][_0x1b66('0x30')];var _0x421300=_0x4f2398[_0x1b66('0x2d')]['callbackUrl'];return getAgent(_0x334eca)[_0x1b66('0x26')](function(_0x38b0f6){logger[_0x1b66('0x12')](_0x1b66('0x31'),_0x38b0f6[_0x1b66('0x19')]);emit(util[_0x1b66('0x32')](_0x1b66('0x33'),_0x38b0f6[_0x1b66('0x19')]),_0x1b66('0x34'),{'callNumber':_0x5e7ad7,'callerId':_0x1484ff,'callbackUrl':_0x421300});return _0x14d0e2[_0x1b66('0x1a')](0xc8)[_0x1b66('0x2e')]({'error':![],'message':_0x1b66('0x35')});})[_0x1b66('0x21')](handleError(_0x14d0e2));};exports['hangup']=function(_0x353be1,_0x3f0a07){logger[_0x1b66('0x12')](_0x1b66('0x36'),_0x353be1['body']);var _0x2a20d3=hangupValidation['validate'](_0x353be1[_0x1b66('0x2d')]);if(_0x2a20d3[_0x1b66('0x29')]>0x0){return _0x3f0a07['status'](0x190)[_0x1b66('0x2e')](_0x2a20d3);}var _0x5d4c37=_0x353be1[_0x1b66('0x2d')][_0x1b66('0x37')];var _0x1154e3=_0x353be1['body'][_0x1b66('0x38')];return getAgent(_0x5d4c37)[_0x1b66('0x26')](function(_0x2feae3){logger[_0x1b66('0x12')]('entityFound:',_0x2feae3[_0x1b66('0x19')]);emit(util[_0x1b66('0x32')](_0x1b66('0x33'),_0x2feae3['name']),_0x1b66('0x39'),{'sessionId':_0x1154e3});return _0x3f0a07[_0x1b66('0x1a')](0xc8)[_0x1b66('0x2e')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x3f0a07));};exports[_0x1b66('0x3a')]=function(_0x2126b4,_0x5c1a93){logger[_0x1b66('0x12')](_0x1b66('0x3b'),_0x2126b4[_0x1b66('0x2d')]);var _0x619d94=answerValidation[_0x1b66('0xb')](_0x2126b4[_0x1b66('0x2d')]);if(_0x619d94[_0x1b66('0x29')]>0x0){return _0x5c1a93['status'](0x190)['json'](_0x619d94);}var _0x2c8abf=_0x2126b4[_0x1b66('0x2d')][_0x1b66('0x37')];var _0x56156c=_0x2126b4['body'][_0x1b66('0x38')];return getAgent(_0x2c8abf)['then'](function(_0xcc7656){logger['info'](_0x1b66('0x31'),_0xcc7656['name']);emit(util[_0x1b66('0x32')](_0x1b66('0x33'),_0xcc7656[_0x1b66('0x19')]),_0x1b66('0x3c'),{'sessionId':_0x56156c});return _0x5c1a93[_0x1b66('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x1b66('0x21')](handleError(_0x5c1a93));};exports['hold']=function(_0x7e53aa,_0x333a87){logger[_0x1b66('0x12')]('hold\x20fired:',_0x7e53aa[_0x1b66('0x2d')]);var _0x4b11aa=holdValidation[_0x1b66('0xb')](_0x7e53aa['body']);if(_0x4b11aa[_0x1b66('0x29')]>0x0){return _0x333a87['status'](0x190)[_0x1b66('0x2e')](_0x4b11aa);}var _0x4ca6c1=_0x7e53aa[_0x1b66('0x2d')]['userId'];var _0xd033f3=_0x7e53aa[_0x1b66('0x2d')][_0x1b66('0x38')];return getAgent(_0x4ca6c1)[_0x1b66('0x26')](function(_0xbc42c3){logger[_0x1b66('0x12')](_0x1b66('0x31'),_0xbc42c3[_0x1b66('0x19')]);emit(util['format']('user:%s',_0xbc42c3[_0x1b66('0x19')]),_0x1b66('0x3d'),{'sessionId':_0xd033f3});return _0x333a87[_0x1b66('0x1a')](0xc8)[_0x1b66('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0x1b66('0x21')](handleError(_0x333a87));};exports[_0x1b66('0x3e')]=function(_0x4a5bfc,_0x2d5370){logger[_0x1b66('0x12')](_0x1b66('0x3f'),_0x4a5bfc['body']);var _0x3fdca9=unholdValidation[_0x1b66('0xb')](_0x4a5bfc['body']);if(_0x3fdca9['length']>0x0){return _0x2d5370['status'](0x190)[_0x1b66('0x2e')](_0x3fdca9);}var _0x5e0fa6=_0x4a5bfc['body'][_0x1b66('0x37')];var _0x48c843=_0x4a5bfc[_0x1b66('0x2d')]['sessionId'];return getAgent(_0x5e0fa6)[_0x1b66('0x26')](function(_0x5c4951){logger[_0x1b66('0x12')]('entityFound:',_0x5c4951[_0x1b66('0x19')]);emit(util['format'](_0x1b66('0x33'),_0x5c4951[_0x1b66('0x19')]),_0x1b66('0x40'),{'sessionId':_0x48c843});return _0x2d5370[_0x1b66('0x1a')](0xc8)[_0x1b66('0x2e')]({'error':![],'message':'unhold\x20executed!'});})[_0x1b66('0x21')](handleError(_0x2d5370));};exports[_0x1b66('0x41')]=function(_0x41b01d,_0x1b4511){logger['info'](_0x1b66('0x42'),_0x1b4511[_0x1b66('0x2d')]);var _0x1504e5=callsValidation[_0x1b66('0xb')](_0x41b01d[_0x1b66('0x2d')]);if(_0x1504e5[_0x1b66('0x29')]>0x0){return _0x1b4511[_0x1b66('0x1a')](0x190)[_0x1b66('0x2e')](_0x1504e5);}var _0x2282b9=_0x41b01d[_0x1b66('0x2d')]['userId'];var _0x5c2156=respondWithRpcPromise(_0x1b66('0x25'));var _0x513bde=getAgent(_0x2282b9);return Promise[_0x1b66('0x43')]([_0x5c2156,_0x513bde])[_0x1b66('0x26')](function(_0x5ad5fd){var _0x480e9c=_0x5ad5fd[0x0];var _0x3d7b2e=_0x5ad5fd[0x1];var _0x53138f=_['filter'](_0x480e9c['rows'],function(_0x3fdd59){return _0x3fdd59[_0x1b66('0x28')]==_0x3d7b2e['id'];});return _0x1b4511[_0x1b66('0x1a')](0xc8)[_0x1b66('0x2e')]({'count':_0x53138f['length'],'rows':_0x53138f});})[_0x1b66('0x21')](handleError(_0x1b4511));};exports[_0x1b66('0x44')]=function(_0x498e62,_0x4f765b){logger[_0x1b66('0x12')](_0x1b66('0x45'),_0x498e62[_0x1b66('0x2d')]);var _0x239635=conferenceValidation[_0x1b66('0xb')](_0x498e62['body']);if(_0x239635[_0x1b66('0x29')]>0x0){return _0x4f765b[_0x1b66('0x1a')](0x190)[_0x1b66('0x2e')](_0x239635);}var _0x5a5019=_0x498e62['body'][_0x1b66('0x37')];return getAgent(_0x5a5019)[_0x1b66('0x26')](function(_0x495309){logger[_0x1b66('0x12')](_0x1b66('0x31'),_0x495309[_0x1b66('0x19')]);emit(util['format'](_0x1b66('0x33'),_0x495309['name']),_0x1b66('0x46'));return _0x4f765b[_0x1b66('0x1a')](0xc8)[_0x1b66('0x2e')]({'error':![],'message':_0x1b66('0x47')});})[_0x1b66('0x21')](handleError(_0x4f765b));};exports[_0x1b66('0x48')]=function(_0x4f1e0a,_0x47bf7a){logger['info'](_0x1b66('0x49'),_0x4f1e0a[_0x1b66('0x2d')]);var _0x4011a6=transferValidation[_0x1b66('0xb')](_0x4f1e0a[_0x1b66('0x2d')]);if(_0x4011a6[_0x1b66('0x29')]>0x0){return _0x47bf7a[_0x1b66('0x1a')](0x190)[_0x1b66('0x2e')](_0x4011a6);}var _0x3e4806=_0x4f1e0a[_0x1b66('0x2d')][_0x1b66('0x37')];var _0x4cf5d3=_0x4f1e0a[_0x1b66('0x2d')]['sessionId'];var _0x419af5=_0x4f1e0a[_0x1b66('0x2d')][_0x1b66('0x4a')];return getAgent(_0x3e4806)[_0x1b66('0x26')](function(_0x190ad3){logger[_0x1b66('0x12')](_0x1b66('0x31'),_0x190ad3[_0x1b66('0x19')]);emit(util[_0x1b66('0x32')](_0x1b66('0x33'),_0x190ad3[_0x1b66('0x19')]),'webbar:transfer',{'sessionId':_0x4cf5d3,'transferNumber':_0x419af5});return _0x47bf7a[_0x1b66('0x1a')](0xc8)[_0x1b66('0x2e')]({'error':![],'message':_0x1b66('0x4b')});})[_0x1b66('0x21')](handleError(_0x47bf7a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5481faf..864fee5 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 _0x36ee=['./whatsappAccount.controller','get','isAuthenticated','index','/describe','show','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','notify','send','put','update','delete','/:id','destroy','/:id/dispositions','removeDispositions','removeAgents','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d2e55,_0x41f2da){var _0x529ba4=function(_0x296dbe){while(--_0x296dbe){_0x1d2e55['push'](_0x1d2e55['shift']());}};_0x529ba4(++_0x41f2da);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var auth=require(_0xe36e('0x3'));var interaction=require(_0xe36e('0x4'));var config=require(_0xe36e('0x5'));var controller=require(_0xe36e('0x6'));router[_0xe36e('0x7')]('/',auth[_0xe36e('0x8')](),controller[_0xe36e('0x9')]);router[_0xe36e('0x7')](_0xe36e('0xa'),auth[_0xe36e('0x8')](),controller['describe']);router[_0xe36e('0x7')]('/:id',auth[_0xe36e('0x8')](),controller[_0xe36e('0xb')]);router[_0xe36e('0x7')]('/:id/dispositions',auth[_0xe36e('0x8')](),controller['getDispositions']);router[_0xe36e('0x7')](_0xe36e('0xc'),auth[_0xe36e('0x8')](),controller[_0xe36e('0xd')]);router[_0xe36e('0x7')](_0xe36e('0xe'),auth[_0xe36e('0x8')](),controller[_0xe36e('0xf')]);router['get'](_0xe36e('0x10'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x11')]);router[_0xe36e('0x12')]('/',auth['isAuthenticated'](),controller[_0xe36e('0x13')]);router['post']('/:id/dispositions',auth[_0xe36e('0x8')](),controller[_0xe36e('0x14')]);router[_0xe36e('0x12')](_0xe36e('0xc'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x12')](_0xe36e('0xe'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x16')]);router['post'](_0xe36e('0x10'),auth[_0xe36e('0x8')](),controller['addApplications']);router[_0xe36e('0x12')]('/:id/notify',controller[_0xe36e('0x17')]);router[_0xe36e('0x12')]('/:id/send',auth[_0xe36e('0x8')](),controller[_0xe36e('0x18')]);router[_0xe36e('0x19')]('/:id',auth[_0xe36e('0x8')](),controller[_0xe36e('0x1a')]);router[_0xe36e('0x1b')](_0xe36e('0x1c'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x1d')]);router['delete'](_0xe36e('0x1e'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x1f')]);router[_0xe36e('0x1b')](_0xe36e('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xe36e('0x1b')](_0xe36e('0xe'),auth[_0xe36e('0x8')](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file +var _0xf4f4=['/:id/notify','notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','create','addAgents','addApplications'];(function(_0x548aea,_0x24ed9b){var _0x4f504d=function(_0x28aca7){while(--_0x28aca7){_0x548aea['push'](_0x548aea['shift']());}};_0x4f504d(++_0x24ed9b);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x31e631,_0x2dadf7){_0x31e631=_0x31e631-0x0;var _0x1e278b=_0xf4f4[_0x31e631];return _0x1e278b;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xa')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0xa')](_0x4f4f('0x11'),auth[_0x4f4f('0x8')](),controller['getAnswers']);router['get'](_0x4f4f('0x12'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);router[_0x4f4f('0xa')](_0x4f4f('0x14'),auth[_0x4f4f('0x8')](),controller['getApplications']);router[_0x4f4f('0x15')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0x16')]);router[_0x4f4f('0x15')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller['addDisposition']);router[_0x4f4f('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x4f4f('0x15')](_0x4f4f('0x12'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x17')]);router[_0x4f4f('0x15')](_0x4f4f('0x14'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x15')](_0x4f4f('0x19'),controller[_0x4f4f('0x1a')]);router[_0x4f4f('0x15')]('/:id/send',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1b')]);router[_0x4f4f('0x1c')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1d')]);router[_0x4f4f('0x1e')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1f')]);router[_0x4f4f('0x1e')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x20')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4f4f('0x21')]);router[_0x4f4f('0x1e')]('/:id/users',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x22')]);module[_0x4f4f('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1ea6c79..b4b2eee 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 _0x6a5e=['exports','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6a5e,0x1c0));var _0xe6a5=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6a5e[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0xe6a5('0x0'));var rs=require(_0xe6a5('0x1'));module[_0xe6a5('0x2')]={'name':{'type':Sequelize[_0xe6a5('0x3')],'unique':_0xe6a5('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe6a5('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe6a5('0x5')]();}},'phone':{'type':Sequelize[_0xe6a5('0x3')]},'type':{'type':Sequelize['ENUM'](_0xe6a5('0x6'))},'accountSid':{'type':Sequelize[_0xe6a5('0x3')]},'authToken':{'type':Sequelize[_0xe6a5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xe6a5('0x7')],'defaultValue':function(){return _0xe6a5('0x8');}},'notificationSound':{'type':Sequelize[_0xe6a5('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe6a5('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe6a5('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe6a5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe6a5('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe6a5('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe6a5('0xa')],'comment':_0xe6a5('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe6a5('0xc'),'set':function(_0x13f59c){if(!_0x13f59c){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xe6a5('0xd')](_0xe6a5('0xe'),_0x13f59c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf746=['randomstring','STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf746,0x108));var _0x6f74=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xf746[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6f74('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f74('0x1')],'unique':_0x6f74('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6f74('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x6f74('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x6f74('0x1')],'defaultValue':function(){return rs[_0x6f74('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6f74('0x4')](_0x6f74('0x5'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6f74('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6f74('0x6');}},'notificationSound':{'type':Sequelize[_0x6f74('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6f74('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6f74('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6f74('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6f74('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6f74('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6f74('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xc5ab9b){if(!_0xc5ab9b){this[_0x6f74('0x9')](_0x6f74('0xa'),null);}this[_0x6f74('0x9')](_0x6f74('0xb'),_0xc5ab9b);}},'description':{'type':Sequelize[_0x6f74('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 9a2ea2f..2732fdf 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 _0xa715=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','count','offset','set','Content-Range','reject','save','destroy','get','UserProfileResource','end','sendStatus','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','show','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','merge','findAll','removeDispositions','ids','getAnswers','CannedAnswer','nolimit','options','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','Body','messageId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','Contacts','contact','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','dataValues','Messages','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4b1e9e,_0x2e2adc){var _0x2bd1a2=function(_0x1b4e1b){while(--_0x1b4e1b){_0x4b1e9e['push'](_0x4b1e9e['shift']());}};_0x2bd1a2(++_0x2e2adc);}(_0xa715,0xa8));var _0x5a71=function(_0x71b554,_0x1c0396){_0x71b554=_0x71b554-0x0;var _0x13bc21=_0xa715[_0x71b554];return _0x13bc21;};'use strict';var pdf=require(_0x5a71('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5a71('0x1'));var zipdir=require(_0x5a71('0x2'));var jsonpatch=require(_0x5a71('0x3'));var rp=require(_0x5a71('0x4'));var moment=require(_0x5a71('0x5'));var BPromise=require(_0x5a71('0x6'));var Mustache=require(_0x5a71('0x7'));var util=require(_0x5a71('0x8'));var path=require(_0x5a71('0x9'));var sox=require(_0x5a71('0xa'));var csv=require(_0x5a71('0xb'));var ejs=require(_0x5a71('0xc'));var fs=require('fs');var _=require(_0x5a71('0xd'));var squel=require(_0x5a71('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5a71('0xb'));var querystring=require(_0x5a71('0xf'));var Papa=require('papaparse');var Redis=require(_0x5a71('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5a71('0x11'));var as=require(_0x5a71('0x12'));var hardwareService=require(_0x5a71('0x13'));var logger=require(_0x5a71('0x14'))(_0x5a71('0x15'));var utils=require(_0x5a71('0x16'));var config=require(_0x5a71('0x17'));var licenseUtil=require(_0x5a71('0x18'));var db=require(_0x5a71('0x19'))['db'];config[_0x5a71('0x1a')]=_[_0x5a71('0x1b')](config[_0x5a71('0x1a')],{'host':_0x5a71('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a71('0x1a')]));require(_0x5a71('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5a71('0x1e')][_0x5a71('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x43f9c9,_0xf243a0,_0x1ee47d,_0x4f03ed){return new BPromise(function(_0x51e528,_0x5b5386){var _0xfc2be3=_0x4f03ed||client;return _0xfc2be3[_0x5a71('0x20')](_0x43f9c9,_0x1ee47d)[_0x5a71('0x21')](function(_0x4a55c4){logger[_0x5a71('0x22')](_0x5a71('0x23'),_0xf243a0,_0x5a71('0x24'));logger[_0x5a71('0x25')](_0x5a71('0x26'),_0xf243a0,_0x5a71('0x24'),JSON[_0x5a71('0x27')](_0x4a55c4));if(_0x4a55c4['error']){if(_0x4a55c4[_0x5a71('0x28')]['code']===0x1f4){logger['error'](_0x5a71('0x23'),_0xf243a0,_0x4a55c4['error']['message']);return _0x5b5386(_0x4a55c4[_0x5a71('0x28')][_0x5a71('0x29')]);}logger[_0x5a71('0x28')](_0x5a71('0x23'),_0xf243a0,_0x4a55c4['error']['message']);return _0x51e528(_0x4a55c4[_0x5a71('0x28')][_0x5a71('0x29')]);}else{logger[_0x5a71('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0xf243a0,'request\x20sent');_0x51e528(_0x4a55c4['result']['message']);}})[_0x5a71('0x2a')](function(_0x216f18){logger[_0x5a71('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0xf243a0,_0x216f18);_0x5b5386(_0x216f18);});});}function respondWithStatusCode(_0x26b02,_0x258dd3){_0x258dd3=_0x258dd3||0xcc;return function(_0x2ae4d5){if(_0x2ae4d5){return _0x26b02['sendStatus'](_0x258dd3);}return _0x26b02[_0x5a71('0x2b')](_0x258dd3)['end']();};}function respondWithResult(_0x19b22e,_0x13e909){_0x13e909=_0x13e909||0xc8;return function(_0x29c62d){if(_0x29c62d){return _0x19b22e[_0x5a71('0x2b')](_0x13e909)[_0x5a71('0x2c')](_0x29c62d);}};}function respondWithFilteredResult(_0x4783aa,_0x4a3e6d){return function(_0x189ca8){if(_0x189ca8){var _0x120898=_0x189ca8[_0x5a71('0x2d')],_0x134590=_0x4a3e6d['offset'],_0xe2bb07=_0x4a3e6d[_0x5a71('0x2e')]+_0x4a3e6d['limit'],_0x1af0dc;if(_0xe2bb07>=_0x120898){_0xe2bb07=_0x120898;_0x1af0dc=0xc8;}else{_0x1af0dc=0xce;}_0x4783aa[_0x5a71('0x2b')](_0x1af0dc);return _0x4783aa[_0x5a71('0x2f')](_0x5a71('0x30'),_0x134590+'-'+_0xe2bb07+'/'+_0x120898)[_0x5a71('0x2c')](_0x189ca8);}return null;};}function patchUpdates(_0x21296f){return function(_0x1a8be7){try{jsonpatch['apply'](_0x1a8be7,_0x21296f,!![]);}catch(_0x36a08a){return BPromise[_0x5a71('0x31')](_0x36a08a);}return _0x1a8be7[_0x5a71('0x32')]();};}function saveUpdates(_0x4c60c6,_0x3e1908){return function(_0x65e6d7){if(_0x65e6d7){return _0x65e6d7['update'](_0x4c60c6)[_0x5a71('0x21')](function(_0x5d6bce){return _0x5d6bce;});}return null;};}function removeEntity(_0xeb69a,_0x5dc117){return function(_0x36904b){if(_0x36904b){return _0x36904b[_0x5a71('0x33')]()[_0x5a71('0x21')](function(){var _0x157ade=_0x36904b[_0x5a71('0x34')]({'plain':!![]});var _0x5ce286='WhatsappAccounts';return db[_0x5a71('0x35')]['destroy']({'where':{'type':_0x5ce286,'resourceId':_0x157ade['id']}})[_0x5a71('0x21')](function(){return _0x36904b;});})[_0x5a71('0x21')](function(){_0xeb69a['status'](0xcc)[_0x5a71('0x36')]();});}};}function handleEntityNotFound(_0x18d379,_0x840fe5){return function(_0x5c9a1d){if(!_0x5c9a1d){_0x18d379[_0x5a71('0x37')](0x194);}return _0x5c9a1d;};}function handleError(_0x173c56,_0x5862b5){_0x5862b5=_0x5862b5||0x1f4;return function(_0x4feb2d){logger[_0x5a71('0x28')](_0x4feb2d['stack']);if(_0x4feb2d[_0x5a71('0x38')]){delete _0x4feb2d[_0x5a71('0x38')];}_0x173c56['status'](_0x5862b5)[_0x5a71('0x39')](_0x4feb2d);};}exports[_0x5a71('0x3a')]=function(_0xb4c079,_0x313960){var _0x23ffc9={'include':[{'model':db[_0x5a71('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4357f5={},_0x3f471a={'count':0x0,'rows':[]};var _0x3d9033=_[_0x5a71('0x3c')](db[_0x5a71('0x3d')][_0x5a71('0x3e')],function(_0x1cc624){return{'name':_0x1cc624[_0x5a71('0x3f')],'type':_0x1cc624[_0x5a71('0x40')][_0x5a71('0x41')]};});_0x4357f5['model']=_[_0x5a71('0x3c')](_0x3d9033,_0x5a71('0x38'));_0x4357f5[_0x5a71('0x42')]=_[_0x5a71('0x43')](_0xb4c079[_0x5a71('0x42')]);_0x4357f5[_0x5a71('0x44')]=_[_0x5a71('0x45')](_0x4357f5[_0x5a71('0x46')],_0x4357f5[_0x5a71('0x42')]);_0x23ffc9[_0x5a71('0x47')]=_[_0x5a71('0x45')](_0x4357f5[_0x5a71('0x46')],qs[_0x5a71('0x48')](_0xb4c079[_0x5a71('0x42')]['fields']));_0x23ffc9[_0x5a71('0x47')]=_0x23ffc9['attributes'][_0x5a71('0x49')]?_0x23ffc9[_0x5a71('0x47')]:_0x4357f5[_0x5a71('0x46')];if(!_0xb4c079[_0x5a71('0x42')][_0x5a71('0x4a')]('nolimit')){_0x23ffc9[_0x5a71('0x4b')]=qs[_0x5a71('0x4b')](_0xb4c079[_0x5a71('0x42')][_0x5a71('0x4b')]);_0x23ffc9[_0x5a71('0x2e')]=qs['offset'](_0xb4c079[_0x5a71('0x42')][_0x5a71('0x2e')]);}_0x23ffc9[_0x5a71('0x4c')]=qs['sort'](_0xb4c079[_0x5a71('0x42')][_0x5a71('0x4d')]);_0x23ffc9[_0x5a71('0x4e')]=qs['filters'](_[_0x5a71('0x4f')](_0xb4c079[_0x5a71('0x42')],_0x4357f5['filters']),_0x3d9033);if(_0xb4c079[_0x5a71('0x42')][_0x5a71('0x50')]){_0x23ffc9[_0x5a71('0x4e')]=_['merge'](_0x23ffc9[_0x5a71('0x4e')],{'$or':_[_0x5a71('0x3c')](_0x3d9033,function(_0x3abcc1){if(_0x3abcc1[_0x5a71('0x40')]!==_0x5a71('0x51')){var _0x2bce6f={};_0x2bce6f[_0x3abcc1['name']]={'$like':'%'+_0xb4c079['query'][_0x5a71('0x50')]+'%'};return _0x2bce6f;}})});}_0x23ffc9=_['merge']({},_0x23ffc9,_0xb4c079['options']);var _0x2c0e86={'where':_0x23ffc9[_0x5a71('0x4e')]};return db[_0x5a71('0x3d')]['count'](_0x2c0e86)[_0x5a71('0x21')](function(_0x33d7a7){_0x3f471a['count']=_0x33d7a7;if(_0xb4c079[_0x5a71('0x42')][_0x5a71('0x52')]){_0x23ffc9[_0x5a71('0x53')]=[{'all':!![]}];}return db[_0x5a71('0x3d')]['findAll'](_0x23ffc9);})['then'](function(_0x1d9c8d){_0x3f471a[_0x5a71('0x54')]=_0x1d9c8d;return _0x3f471a;})[_0x5a71('0x21')](respondWithFilteredResult(_0x313960,_0x23ffc9))[_0x5a71('0x2a')](handleError(_0x313960,null));};exports[_0x5a71('0x55')]=function(_0x210b9f,_0x2c0d3e){var _0x3e8691={'raw':![],'where':{'id':_0x210b9f['params']['id']},'include':[{'model':db[_0x5a71('0x3b')],'as':_0x5a71('0x56')}]},_0x33b5fb={};_0x33b5fb[_0x5a71('0x46')]=_['keys'](db[_0x5a71('0x3d')]['rawAttributes']);_0x33b5fb[_0x5a71('0x42')]=_[_0x5a71('0x43')](_0x210b9f['query']);_0x33b5fb[_0x5a71('0x44')]=_[_0x5a71('0x45')](_0x33b5fb[_0x5a71('0x46')],_0x33b5fb[_0x5a71('0x42')]);_0x3e8691[_0x5a71('0x47')]=_[_0x5a71('0x45')](_0x33b5fb[_0x5a71('0x46')],qs[_0x5a71('0x48')](_0x210b9f[_0x5a71('0x42')]['fields']));_0x3e8691[_0x5a71('0x47')]=_0x3e8691[_0x5a71('0x47')][_0x5a71('0x49')]?_0x3e8691[_0x5a71('0x47')]:_0x33b5fb['model'];if(_0x210b9f[_0x5a71('0x42')][_0x5a71('0x52')]){_0x3e8691[_0x5a71('0x53')]=[{'all':!![]}];}_0x3e8691=_['merge']({},_0x3e8691,_0x210b9f['options']);return db[_0x5a71('0x3d')][_0x5a71('0x57')](_0x3e8691)[_0x5a71('0x21')](handleEntityNotFound(_0x2c0d3e,null))[_0x5a71('0x21')](respondWithResult(_0x2c0d3e,null))[_0x5a71('0x2a')](handleError(_0x2c0d3e,null));};exports['create']=function(_0x2861e3,_0x2d2fe1){return db['WhatsappAccount'][_0x5a71('0x58')](_0x2861e3[_0x5a71('0x59')],{})[_0x5a71('0x21')](function(_0x1c0c0f){var _0x22ef55=_0x2861e3[_0x5a71('0x5a')][_0x5a71('0x34')]({'plain':!![]});if(!_0x22ef55)throw new Error(_0x5a71('0x5b'));if(_0x22ef55['role']===_0x5a71('0x5a')){var _0x59752a=_0x1c0c0f[_0x5a71('0x34')]({'plain':!![]});var _0xb1537=_0x5a71('0x5c');return db[_0x5a71('0x5d')]['find']({'where':{'name':_0xb1537,'userProfileId':_0x22ef55[_0x5a71('0x5e')]},'raw':!![]})[_0x5a71('0x21')](function(_0x417aa1){if(_0x417aa1&&_0x417aa1[_0x5a71('0x5f')]===0x0){return db['UserProfileResource'][_0x5a71('0x58')]({'name':_0x59752a['name'],'resourceId':_0x59752a['id'],'type':_0x417aa1[_0x5a71('0x38')],'sectionId':_0x417aa1['id']},{})['then'](function(){return _0x1c0c0f;});}else{return _0x1c0c0f;}})['catch'](function(_0x2587b0){logger['error'](_0x5a71('0x60'),_0x2587b0);throw _0x2587b0;});}return _0x1c0c0f;})[_0x5a71('0x21')](respondWithResult(_0x2d2fe1,0xc9))['catch'](handleError(_0x2d2fe1,null));};exports[_0x5a71('0x61')]=function(_0x55fda7,_0x2c765f){if(_0x55fda7[_0x5a71('0x59')]['id']){delete _0x55fda7['body']['id'];}return db[_0x5a71('0x3d')][_0x5a71('0x57')]({'where':{'id':_0x55fda7[_0x5a71('0x62')]['id']},'include':[{'model':db[_0x5a71('0x3b')],'as':_0x5a71('0x56')}]})[_0x5a71('0x21')](handleEntityNotFound(_0x2c765f,null))[_0x5a71('0x21')](saveUpdates(_0x55fda7[_0x5a71('0x59')],null))[_0x5a71('0x21')](respondWithResult(_0x2c765f,null))[_0x5a71('0x2a')](handleError(_0x2c765f,null));};exports[_0x5a71('0x33')]=function(_0x35b4eb,_0xd0e962){return db[_0x5a71('0x3d')][_0x5a71('0x57')]({'where':{'id':_0x35b4eb[_0x5a71('0x62')]['id']}})['then'](handleEntityNotFound(_0xd0e962,null))[_0x5a71('0x21')](removeEntity(_0xd0e962,null))[_0x5a71('0x2a')](handleError(_0xd0e962,null));};exports[_0x5a71('0x63')]=function(_0x192658,_0x2bff68){return db[_0x5a71('0x3d')][_0x5a71('0x63')]()[_0x5a71('0x21')](respondWithResult(_0x2bff68,null))['catch'](handleError(_0x2bff68,null));};exports[_0x5a71('0x64')]=function(_0x1da254,_0x250747,_0x172366){if(_0x1da254[_0x5a71('0x59')]['id']){delete _0x1da254[_0x5a71('0x59')]['id'];}return db['WhatsappAccount'][_0x5a71('0x57')]({'where':{'id':_0x1da254[_0x5a71('0x62')]['id']}})['then'](handleEntityNotFound(_0x250747,null))[_0x5a71('0x21')](function(_0x59e7d1){if(_0x59e7d1){_0x1da254[_0x5a71('0x59')][_0x5a71('0x65')]=_0x59e7d1['id'];return db[_0x5a71('0x66')][_0x5a71('0x58')](_0x1da254[_0x5a71('0x59')]);}})['then'](respondWithResult(_0x250747,null))['catch'](handleError(_0x250747,null));};exports[_0x5a71('0x67')]=function(_0x4fe3c8,_0x42d015,_0x27d026){var _0x3e1258={'raw':![],'where':{}};var _0x577c9d={};var _0x5f3f3d={'count':0x0,'rows':[]};return db[_0x5a71('0x3d')][_0x5a71('0x68')]({'where':{'id':_0x4fe3c8[_0x5a71('0x62')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x42d015,null))['then'](function(_0x4c224b){if(_0x4c224b){_0x577c9d[_0x5a71('0x46')]=_['keys'](db['Disposition'][_0x5a71('0x3e')]);_0x577c9d[_0x5a71('0x42')]=_[_0x5a71('0x43')](_0x4fe3c8[_0x5a71('0x42')]);_0x577c9d[_0x5a71('0x44')]=_[_0x5a71('0x45')](_0x577c9d[_0x5a71('0x46')],_0x577c9d[_0x5a71('0x42')]);_0x3e1258[_0x5a71('0x47')]=_['intersection'](_0x577c9d[_0x5a71('0x46')],qs[_0x5a71('0x48')](_0x4fe3c8[_0x5a71('0x42')][_0x5a71('0x48')]));_0x3e1258[_0x5a71('0x47')]=_0x3e1258[_0x5a71('0x47')][_0x5a71('0x49')]?_0x3e1258[_0x5a71('0x47')]:_0x577c9d[_0x5a71('0x46')];if(!_0x4fe3c8['query']['hasOwnProperty']('nolimit')){_0x3e1258[_0x5a71('0x4b')]=qs[_0x5a71('0x4b')](_0x4fe3c8[_0x5a71('0x42')][_0x5a71('0x4b')]);_0x3e1258[_0x5a71('0x2e')]=qs[_0x5a71('0x2e')](_0x4fe3c8[_0x5a71('0x42')][_0x5a71('0x2e')]);}_0x3e1258['order']=qs[_0x5a71('0x4d')](_0x4fe3c8[_0x5a71('0x42')]['sort']);_0x3e1258[_0x5a71('0x4e')]=qs[_0x5a71('0x44')](_['pick'](_0x4fe3c8[_0x5a71('0x42')],_0x577c9d['filters']));_0x3e1258[_0x5a71('0x4e')][_0x5a71('0x65')]=_0x4c224b['id'];if(_0x4fe3c8[_0x5a71('0x42')][_0x5a71('0x50')]){_0x3e1258[_0x5a71('0x4e')]=_[_0x5a71('0x69')](_0x3e1258['where'],{'$or':_[_0x5a71('0x3c')](_0x3e1258[_0x5a71('0x47')],function(_0x2ca822){var _0x560bbb={};_0x560bbb[_0x2ca822]={'$like':'%'+_0x4fe3c8[_0x5a71('0x42')][_0x5a71('0x50')]+'%'};return _0x560bbb;})});}_0x3e1258=_[_0x5a71('0x69')]({},_0x3e1258,_0x4fe3c8['options']);return db[_0x5a71('0x66')][_0x5a71('0x2d')]({'where':_0x3e1258['where']})[_0x5a71('0x21')](function(_0x582e36){_0x5f3f3d['count']=_0x582e36;if(_0x4fe3c8['query'][_0x5a71('0x52')]){_0x3e1258[_0x5a71('0x53')]=[{'all':!![]}];}return db[_0x5a71('0x66')][_0x5a71('0x6a')](_0x3e1258);})[_0x5a71('0x21')](function(_0x3b04e8){_0x5f3f3d[_0x5a71('0x54')]=_0x3b04e8;return _0x5f3f3d;});}})[_0x5a71('0x21')](respondWithFilteredResult(_0x42d015,_0x3e1258))[_0x5a71('0x2a')](handleError(_0x42d015,null));};exports[_0x5a71('0x6b')]=function(_0x40a522,_0x2c5d9b,_0x43ac19){return db['WhatsappAccount'][_0x5a71('0x57')]({'where':{'id':_0x40a522[_0x5a71('0x62')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x2c5d9b,null))[_0x5a71('0x21')](function(_0x6f215b){if(_0x6f215b){return _0x6f215b[_0x5a71('0x6b')](_0x40a522['query'][_0x5a71('0x6c')]);}})['then'](respondWithStatusCode(_0x2c5d9b,null))[_0x5a71('0x2a')](handleError(_0x2c5d9b,null));};exports['addAnswer']=function(_0x321c47,_0x252f7d,_0x2c4944){if(_0x321c47[_0x5a71('0x59')]['id']){delete _0x321c47[_0x5a71('0x59')]['id'];}return db[_0x5a71('0x3d')]['find']({'where':{'id':_0x321c47[_0x5a71('0x62')]['id']}})['then'](handleEntityNotFound(_0x252f7d,null))['then'](function(_0x47b0dc){if(_0x47b0dc){_0x321c47[_0x5a71('0x59')][_0x5a71('0x65')]=_0x47b0dc['id'];return db['CannedAnswer'][_0x5a71('0x58')](_0x321c47[_0x5a71('0x59')]);}})[_0x5a71('0x21')](respondWithResult(_0x252f7d,null))['catch'](handleError(_0x252f7d,null));};exports[_0x5a71('0x6d')]=function(_0x38c188,_0x128d0b,_0x1880a9){var _0x40d04f={'raw':![],'where':{}};var _0x1bf6fc={};var _0x252f89={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x38c188[_0x5a71('0x62')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x128d0b,null))['then'](function(_0x452532){if(_0x452532){_0x1bf6fc[_0x5a71('0x46')]=_[_0x5a71('0x43')](db[_0x5a71('0x6e')][_0x5a71('0x3e')]);_0x1bf6fc[_0x5a71('0x42')]=_[_0x5a71('0x43')](_0x38c188[_0x5a71('0x42')]);_0x1bf6fc['filters']=_[_0x5a71('0x45')](_0x1bf6fc['model'],_0x1bf6fc[_0x5a71('0x42')]);_0x40d04f[_0x5a71('0x47')]=_[_0x5a71('0x45')](_0x1bf6fc['model'],qs[_0x5a71('0x48')](_0x38c188[_0x5a71('0x42')]['fields']));_0x40d04f[_0x5a71('0x47')]=_0x40d04f[_0x5a71('0x47')][_0x5a71('0x49')]?_0x40d04f[_0x5a71('0x47')]:_0x1bf6fc[_0x5a71('0x46')];if(!_0x38c188[_0x5a71('0x42')][_0x5a71('0x4a')](_0x5a71('0x6f'))){_0x40d04f['limit']=qs[_0x5a71('0x4b')](_0x38c188[_0x5a71('0x42')]['limit']);_0x40d04f[_0x5a71('0x2e')]=qs[_0x5a71('0x2e')](_0x38c188[_0x5a71('0x42')]['offset']);}_0x40d04f['order']=qs['sort'](_0x38c188['query']['sort']);_0x40d04f['where']=qs['filters'](_[_0x5a71('0x4f')](_0x38c188[_0x5a71('0x42')],_0x1bf6fc['filters']));_0x40d04f[_0x5a71('0x4e')][_0x5a71('0x65')]=_0x452532['id'];if(_0x38c188[_0x5a71('0x42')][_0x5a71('0x50')]){_0x40d04f['where']=_[_0x5a71('0x69')](_0x40d04f['where'],{'$or':_[_0x5a71('0x3c')](_0x40d04f['attributes'],function(_0x37a199){var _0x407bc9={};_0x407bc9[_0x37a199]={'$like':'%'+_0x38c188[_0x5a71('0x42')][_0x5a71('0x50')]+'%'};return _0x407bc9;})});}_0x40d04f=_[_0x5a71('0x69')]({},_0x40d04f,_0x38c188[_0x5a71('0x70')]);return db['CannedAnswer'][_0x5a71('0x2d')]({'where':_0x40d04f['where']})['then'](function(_0x1add71){_0x252f89[_0x5a71('0x2d')]=_0x1add71;if(_0x38c188['query']['includeAll']){_0x40d04f[_0x5a71('0x53')]=[{'all':!![]}];}return db[_0x5a71('0x6e')][_0x5a71('0x6a')](_0x40d04f);})[_0x5a71('0x21')](function(_0x3f28bb){_0x252f89['rows']=_0x3f28bb;return _0x252f89;});}})[_0x5a71('0x21')](respondWithFilteredResult(_0x128d0b,_0x40d04f))[_0x5a71('0x2a')](handleError(_0x128d0b,null));};exports[_0x5a71('0x71')]=function(_0xce4080,_0x43e221,_0x41ff40){return db[_0x5a71('0x3d')][_0x5a71('0x57')]({'where':{'id':_0xce4080[_0x5a71('0x62')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x43e221,null))[_0x5a71('0x21')](function(_0x29c7ad){if(_0x29c7ad){return _0x29c7ad['removeAnswers'](_0xce4080[_0x5a71('0x42')][_0x5a71('0x6c')]);}})[_0x5a71('0x21')](respondWithStatusCode(_0x43e221,null))[_0x5a71('0x2a')](handleError(_0x43e221,null));};exports['addAgents']=function(_0x17b02e,_0xd55ec1,_0x16dace){return db[_0x5a71('0x3d')][_0x5a71('0x57')]({'where':{'id':_0x17b02e[_0x5a71('0x62')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0xd55ec1,null))['then'](function(_0x56ef5f){if(_0x56ef5f){return _0x56ef5f[_0x5a71('0x72')](_0x17b02e[_0x5a71('0x59')][_0x5a71('0x6c')],_[_0x5a71('0x73')](_0x17b02e[_0x5a71('0x59')],[_0x5a71('0x6c'),'id'])||{})[_0x5a71('0x74')](function(_0x49b8cf){for(var _0x504bb7=0x0;_0x504bb7<_0x17b02e[_0x5a71('0x59')][_0x5a71('0x6c')][_0x5a71('0x49')];_0x504bb7+=0x1){socket[_0x5a71('0x75')](_0x5a71('0x76'),{'UserId':_0x17b02e[_0x5a71('0x59')][_0x5a71('0x6c')][_0x504bb7],'WhatsappAccountId':_0x17b02e[_0x5a71('0x62')]['id']});}return _0x49b8cf;});}})[_0x5a71('0x21')](respondWithResult(_0xd55ec1,null))[_0x5a71('0x2a')](handleError(_0xd55ec1,null));};exports[_0x5a71('0x77')]=function(_0x59e129,_0x2d9736,_0x800eb0){return db[_0x5a71('0x3d')][_0x5a71('0x57')]({'where':{'id':_0x59e129[_0x5a71('0x62')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x2d9736,null))[_0x5a71('0x21')](function(_0x11434e){if(_0x11434e){return _0x11434e[_0x5a71('0x77')](_0x59e129[_0x5a71('0x42')][_0x5a71('0x6c')])['then'](function(){if(_[_0x5a71('0x78')](_0x59e129[_0x5a71('0x42')][_0x5a71('0x6c')])){for(var _0x3fe529=0x0;_0x3fe529<_0x59e129[_0x5a71('0x42')]['ids'][_0x5a71('0x49')];_0x3fe529+=0x1){socket[_0x5a71('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x59e129[_0x5a71('0x42')][_0x5a71('0x6c')][_0x3fe529]),'WhatsappAccountId':Number(_0x59e129['params']['id'])});}}else{socket[_0x5a71('0x75')](_0x5a71('0x79'),{'UserId':Number(_0x59e129[_0x5a71('0x42')]['ids']),'WhatsappAccountId':Number(_0x59e129[_0x5a71('0x62')]['id'])});}});}})[_0x5a71('0x21')](respondWithStatusCode(_0x2d9736,null))[_0x5a71('0x2a')](handleError(_0x2d9736,null));};exports[_0x5a71('0x7a')]=function(_0x585a0d,_0x2d47d0,_0x52bb6d){var _0x1d29ef={};var _0x5d1412={};var _0x1d710d;var _0x2a0f5c;return db[_0x5a71('0x3d')][_0x5a71('0x68')]({'where':{'id':_0x585a0d['params']['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x2d47d0,null))[_0x5a71('0x21')](function(_0x639294){if(_0x639294){_0x1d710d=_0x639294;_0x5d1412['model']=_[_0x5a71('0x43')](db[_0x5a71('0x7b')]['rawAttributes']);_0x5d1412[_0x5a71('0x42')]=_['keys'](_0x585a0d[_0x5a71('0x42')]);_0x5d1412[_0x5a71('0x44')]=_[_0x5a71('0x45')](_0x5d1412[_0x5a71('0x46')],_0x5d1412[_0x5a71('0x42')]);_0x1d29ef[_0x5a71('0x47')]=_[_0x5a71('0x45')](_0x5d1412[_0x5a71('0x46')],qs[_0x5a71('0x48')](_0x585a0d[_0x5a71('0x42')]['fields']));_0x1d29ef['attributes']=_0x1d29ef[_0x5a71('0x47')][_0x5a71('0x49')]?_0x1d29ef[_0x5a71('0x47')]:_0x5d1412[_0x5a71('0x46')];_0x1d29ef[_0x5a71('0x4c')]=qs['sort'](_0x585a0d[_0x5a71('0x42')][_0x5a71('0x4d')]);_0x1d29ef['where']=qs[_0x5a71('0x44')](_[_0x5a71('0x4f')](_0x585a0d['query'],_0x5d1412[_0x5a71('0x44')]));if(_0x585a0d[_0x5a71('0x42')]['filter']){_0x1d29ef[_0x5a71('0x4e')]=_[_0x5a71('0x69')](_0x1d29ef['where'],{'$or':_['map'](_0x1d29ef[_0x5a71('0x47')],function(_0x2f674c){var _0x1052c3={};_0x1052c3[_0x2f674c]={'$like':'%'+_0x585a0d[_0x5a71('0x42')][_0x5a71('0x50')]+'%'};return _0x1052c3;})});}_0x1d29ef=_[_0x5a71('0x69')]({},_0x1d29ef,_0x585a0d['options']);return _0x1d710d[_0x5a71('0x7a')](_0x1d29ef);}})[_0x5a71('0x21')](function(_0x46aca8){if(_0x46aca8){_0x2a0f5c=_0x46aca8['length'];if(!_0x585a0d[_0x5a71('0x42')]['hasOwnProperty'](_0x5a71('0x6f'))){_0x1d29ef['limit']=qs[_0x5a71('0x4b')](_0x585a0d[_0x5a71('0x42')][_0x5a71('0x4b')]);_0x1d29ef[_0x5a71('0x2e')]=qs[_0x5a71('0x2e')](_0x585a0d[_0x5a71('0x42')][_0x5a71('0x2e')]);}return _0x1d710d[_0x5a71('0x7a')](_0x1d29ef);}})[_0x5a71('0x21')](function(_0x2d57a4){if(_0x2d57a4){return _0x2d57a4?{'count':_0x2a0f5c,'rows':_0x2d57a4}:null;}})[_0x5a71('0x21')](respondWithResult(_0x2d47d0,null))[_0x5a71('0x2a')](handleError(_0x2d47d0,null));};exports[_0x5a71('0x7c')]=function(_0xd2b11f,_0x569fb5,_0x5e0ce5){return db['WhatsappAccount'][_0x5a71('0x68')]({'where':{'id':_0xd2b11f[_0x5a71('0x62')]['id']}})[_0x5a71('0x21')](handleEntityNotFound(_0x569fb5,null))[_0x5a71('0x21')](function(_0x517ba7){if(_0x517ba7){return db[_0x5a71('0x7d')][_0x5a71('0x7e')](function(_0x32e979){return db[_0x5a71('0x7f')][_0x5a71('0x33')]({'where':{'WhatsappAccountId':_0xd2b11f['params']['id']},'transaction':_0x32e979})[_0x5a71('0x21')](function(_0x2013b2){var _0x5a8083=_[_0x5a71('0x3c')](_0xd2b11f[_0x5a71('0x59')],function(_0x2cf18e){_0x2cf18e[_0x5a71('0x65')]=_0xd2b11f['params']['id'];return _0x2cf18e;});return db[_0x5a71('0x7f')][_0x5a71('0x80')](_0x5a8083,{'transaction':_0x32e979});});})['then'](function(){return db[_0x5a71('0x7f')][_0x5a71('0x81')]({'where':{'WhatsappAccountId':_0xd2b11f[_0x5a71('0x62')]['id']},'order':_0x5a71('0x82')});});}})[_0x5a71('0x21')](respondWithResult(_0x569fb5,null))[_0x5a71('0x2a')](handleError(_0x569fb5,null));};exports[_0x5a71('0x83')]=function(_0x5268a5,_0x18d0ed,_0x242b3e){var _0xfe8d19={};var _0x318f94={};var _0x169cd7;var _0x49457f;return db['WhatsappAccount']['findOne']({'where':{'id':_0x5268a5[_0x5a71('0x62')]['id']}})['then'](handleEntityNotFound(_0x18d0ed,null))['then'](function(_0x2951af){if(_0x2951af){_0x169cd7=_0x2951af;_0x318f94[_0x5a71('0x46')]=_[_0x5a71('0x43')](db['WhatsappApplication'][_0x5a71('0x3e')]);_0x318f94['query']=_[_0x5a71('0x43')](_0x5268a5[_0x5a71('0x42')]);_0x318f94[_0x5a71('0x44')]=_[_0x5a71('0x45')](_0x318f94['model'],_0x318f94[_0x5a71('0x42')]);_0xfe8d19[_0x5a71('0x47')]=_[_0x5a71('0x45')](_0x318f94['model'],qs[_0x5a71('0x48')](_0x5268a5[_0x5a71('0x42')]['fields']));_0xfe8d19['attributes']=_0xfe8d19[_0x5a71('0x47')][_0x5a71('0x49')]?_0xfe8d19[_0x5a71('0x47')]:_0x318f94[_0x5a71('0x46')];_0xfe8d19[_0x5a71('0x4c')]=qs[_0x5a71('0x4d')](_0x5268a5['query']['sort']);_0xfe8d19[_0x5a71('0x4e')]=qs['filters'](_['pick'](_0x5268a5['query'],_0x318f94['filters']));if(_0x5268a5[_0x5a71('0x42')][_0x5a71('0x50')]){_0xfe8d19['where']=_['merge'](_0xfe8d19[_0x5a71('0x4e')],{'$or':_['map'](_0xfe8d19[_0x5a71('0x47')],function(_0x5303dd){var _0x550351={};_0x550351[_0x5303dd]={'$like':'%'+_0x5268a5[_0x5a71('0x42')][_0x5a71('0x50')]+'%'};return _0x550351;})});}_0xfe8d19=_[_0x5a71('0x69')]({},_0xfe8d19,_0x5268a5[_0x5a71('0x70')]);return _0x169cd7[_0x5a71('0x83')](_0xfe8d19);}})[_0x5a71('0x21')](function(_0x2e3b18){if(_0x2e3b18){_0x49457f=_0x2e3b18['length'];if(!_0x5268a5[_0x5a71('0x42')][_0x5a71('0x4a')](_0x5a71('0x6f'))){_0xfe8d19[_0x5a71('0x4b')]=qs[_0x5a71('0x4b')](_0x5268a5['query'][_0x5a71('0x4b')]);_0xfe8d19[_0x5a71('0x2e')]=qs[_0x5a71('0x2e')](_0x5268a5[_0x5a71('0x42')][_0x5a71('0x2e')]);}return _0x169cd7[_0x5a71('0x83')](_0xfe8d19);}})[_0x5a71('0x21')](function(_0x191f75){if(_0x191f75){return _0x191f75?{'count':_0x49457f,'rows':_0x191f75}:null;}})[_0x5a71('0x21')](respondWithResult(_0x18d0ed,null))['catch'](handleError(_0x18d0ed,null));};exports[_0x5a71('0x84')]=function(_0x21a22d,_0xb6cc4,_0x338482){var _0x470ea2={'channel':_0x5a71('0x85')};var _0x3bd10f=[];var _0x1e4aed=[];var _0x4d4ac0={};return db[_0x5a71('0x3d')]['find']({'where':{'id':_0x21a22d['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x5a71('0x21')](handleEntityNotFound(_0xb6cc4,null))[_0x5a71('0x21')](function(_0x3990cc){_0x470ea2[_0x5a71('0x86')]=_0x3990cc;_0x470ea2['applications']=_[_0x5a71('0x87')](_0x3990cc[_0x5a71('0x88')],[_0x5a71('0x82')],[_0x5a71('0x89')]);if(_0x470ea2[_0x5a71('0x86')]['Applications']){delete _0x470ea2[_0x5a71('0x86')][_0x5a71('0x88')];}return db[_0x5a71('0x8a')][_0x5a71('0x63')]();})[_0x5a71('0x21')](function(_0x36cb96){if(!_0x36cb96){throw new db[(_0x5a71('0x8b'))]['ValidationError'](_0x5a71('0x8c'));}_0x3bd10f=_[_0x5a71('0x8d')](_[_0x5a71('0x43')](_0x36cb96),[_0x5a71('0x8e'),_0x5a71('0x8f')]);_0x1e4aed=_[_0x5a71('0x8d')](_['keys'](_0x36cb96),[_0x5a71('0x8e'),_0x5a71('0x8f'),_0x5a71('0x90'),'ListId']);_0x470ea2[_0x5a71('0x59')]={'mapKey':'mobile'};if(_0x470ea2[_0x5a71('0x86')][_0x5a71('0x40')]&&_0x470ea2[_0x5a71('0x86')]['type']===_0x5a71('0x91')){_0x470ea2[_0x5a71('0x59')][_0x5a71('0x92')]=_0x21a22d[_0x5a71('0x59')]['From']['replace']('whatsapp:','');_0x470ea2[_0x5a71('0x59')][_0x5a71('0x59')]=_0x21a22d[_0x5a71('0x59')][_0x5a71('0x93')];_0x470ea2['body'][_0x5a71('0x94')]=_0x21a22d[_0x5a71('0x59')]['MessageSid'];}if(_0x470ea2[_0x5a71('0x59')]['id']){delete _0x470ea2[_0x5a71('0x59')]['id'];}if(_[_0x5a71('0x95')](_0x470ea2[_0x5a71('0x59')]['from'])){throw new db[(_0x5a71('0x8b'))][(_0x5a71('0x96'))](_0x5a71('0x97'));}if(_[_0x5a71('0x95')](_0x470ea2['body'][_0x5a71('0x59')])||_0x470ea2[_0x5a71('0x59')][_0x5a71('0x59')]===''){throw new db['Sequelize']['ValidationError'](_0x5a71('0x98'));}if(_[_0x5a71('0x95')](_0x470ea2[_0x5a71('0x59')][_0x5a71('0x99')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e4aed);}if(!_[_0x5a71('0x9a')](_0x1e4aed,_0x470ea2[_0x5a71('0x59')][_0x5a71('0x99')])){throw new db[(_0x5a71('0x8b'))][(_0x5a71('0x96'))](_0x5a71('0x9b')+_0x1e4aed);}_0x4d4ac0[_0x470ea2[_0x5a71('0x59')][_0x5a71('0x99')]]=_0x470ea2['body'][_0x5a71('0x92')];return db[_0x5a71('0x9c')][_0x5a71('0x57')]({'where':{'id':_0x470ea2[_0x5a71('0x86')][_0x5a71('0x9d')]},'include':[{'model':db[_0x5a71('0x8a')],'as':'Contacts','where':_0x4d4ac0,'limit':0x1,'order':[[_0x5a71('0x8f'),_0x5a71('0x9e')]]}]});})['then'](handleEntityNotFound(_0xb6cc4,null))[_0x5a71('0x21')](function(_0xe1e771){if(_0xe1e771){_0x470ea2[_0x5a71('0x9f')]=_[_0x5a71('0x73')](_0xe1e771,[_0x5a71('0xa0')]);if(_0xe1e771['Contacts'][_0x5a71('0x49')]){return _0xe1e771[_0x5a71('0xa0')][0x0];}var _0x1fdadb=_[_0x5a71('0x1b')](_0x470ea2[_0x5a71('0x59')],{'firstName':_0x470ea2[_0x5a71('0x59')][_0x5a71('0x92')],'ListId':_0xe1e771['id']});_0x1fdadb[_0x470ea2[_0x5a71('0x59')][_0x5a71('0x99')]]=_0x470ea2[_0x5a71('0x59')][_0x5a71('0x92')];return db[_0x5a71('0x8a')][_0x5a71('0x58')](_0x1fdadb,{'fields':_0x3bd10f,'raw':!![]});}})[_0x5a71('0x21')](handleEntityNotFound(_0xb6cc4,null))['then'](function(_0x36eabf){if(_0x36eabf){_0x470ea2[_0x5a71('0xa1')]=_0x36eabf;var _0x5e083c={'ContactId':_0x36eabf['id'],'phone':_0x470ea2[_0x5a71('0x59')][_0x5a71('0x92')],'WhatsappAccountId':_0x21a22d[_0x5a71('0x62')]['id']};var _0x1d1e53={'ContactId':_0x36eabf['id'],'WhatsappAccountId':_0x21a22d['params']['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x1d1e53})['then'](function(_0x4af885){if(_0x4af885){return[_0x4af885,![]];}return db['WhatsappInteraction']['create'](_0x5e083c)['then'](function(_0x5df367){return[_0x5df367,!![]];});});}})[_0x5a71('0x74')](function(_0x3a4c9b,_0x34f1fd){_0x470ea2[_0x5a71('0xa2')]=_0x3a4c9b[_0x5a71('0x34')]({'plain':!![]});_0x470ea2['interaction'][_0x5a71('0xa3')]=![];if(_0x34f1fd){if(_0x470ea2[_0x5a71('0x86')][_0x5a71('0xa4')]){_0x470ea2[_0x5a71('0xa5')][_0x5a71('0xa6')]({'id':0x0,'priority':_0x470ea2[_0x5a71('0xa5')][_0x5a71('0x49')]+0x1,'app':_0x5a71('0xa7'),'appdata':_0x5a71('0xa8'),'interval':_0x5a71('0xa9')});}_0x470ea2[_0x5a71('0xa2')]['created']=!![];}return db[_0x5a71('0xaa')][_0x5a71('0x58')]({'phone':_0x470ea2[_0x5a71('0x59')][_0x5a71('0x92')],'messageId':_0x470ea2[_0x5a71('0x59')][_0x5a71('0x94')],'body':_0x470ea2[_0x5a71('0x59')][_0x5a71('0x59')],'WhatsappAccountId':_0x21a22d[_0x5a71('0x62')]['id'],'WhatsappInteractionId':_0x3a4c9b['id'],'direction':'in','ContactId':_0x3a4c9b[_0x5a71('0xab')],'AttachmentId':_0x470ea2['body'][_0x5a71('0xac')]});})[_0x5a71('0x21')](function(_0x73fae0){_0x470ea2[_0x5a71('0x29')]=_0x73fae0;if(_0x470ea2[_0x5a71('0xa2')][_0x5a71('0xad')]){return db['User'][_0x5a71('0x57')]({'attributes':['id',_0x5a71('0x38')],'where':{'id':_0x470ea2[_0x5a71('0xa2')][_0x5a71('0xad')]}})[_0x5a71('0x21')](function(_0x2b37a4){if(_0x2b37a4){_0x470ea2[_0x5a71('0xa5')][_0x5a71('0xae')]({'id':0x0,'priority':0x0,'app':_0x5a71('0xaf'),'appdata':_0x2b37a4[_0x5a71('0x38')]+','+(_0x470ea2[_0x5a71('0x86')][_0x5a71('0xb0')]||0xa),'interval':_0x5a71('0xa9')});}return respondWithRpcPromise(_0x5a71('0xb1'),_0x5a71('0xb2'),_0x470ea2);});}return respondWithRpcPromise(_0x5a71('0xb1'),'startRouting',_0x470ea2);})[_0x5a71('0x21')](function(_0x2d18eb){if(_0x2d18eb){var _0x47a931=0xc8;var _0x53368e=_0x5a71('0xb3');logger[_0x5a71('0x22')](_0x5a71('0x26'),_0x53368e,_0x47a931,'entity\x20found');logger[_0x5a71('0x25')](_0x5a71('0xb4'),_0x53368e,_0x47a931,'entity\x20found',JSON[_0x5a71('0x27')](_0x2d18eb));if(_0x470ea2[_0x5a71('0x86')][_0x5a71('0x40')]===_0x5a71('0x91')){return _0xb6cc4[_0x5a71('0x2b')](_0x47a931)[_0x5a71('0x2f')]('Content-Type','text/xml')[_0x5a71('0x39')](_0x5a71('0xb5'));}else{return _0xb6cc4[_0x5a71('0x2b')](_0x47a931)[_0x5a71('0x2c')](_0x2d18eb);}}})[_0x5a71('0x2a')](handleError(_0xb6cc4,null));};exports['send']=function(_0xc49135,_0x54df15,_0x45a152){var _0x28717d,_0x154256,_0x24024f;if(_[_0x5a71('0x95')](_0xc49135[_0x5a71('0x59')]['body'])||_0xc49135[_0x5a71('0x59')][_0x5a71('0x59')]===''){throw new db['Sequelize'][(_0x5a71('0x96'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5a71('0x95')](_0xc49135[_0x5a71('0x59')]['to'])){throw new db[(_0x5a71('0x8b'))][(_0x5a71('0x96'))](_0x5a71('0xb6'));}_0x28717d=_0xc49135['body']['to'];return db[_0x5a71('0x3d')][_0x5a71('0x57')]({'where':{'id':_0xc49135['params']['id']},'include':[{'model':db[_0x5a71('0x9c')],'as':'List','include':[{'model':db[_0x5a71('0x8a')],'as':_0x5a71('0xa0'),'where':{'mobile':_0x28717d},'limit':0x1,'order':[[_0x5a71('0x8f'),_0x5a71('0x9e')]]}]}]})[_0x5a71('0x21')](handleEntityNotFound(_0x54df15,null))[_0x5a71('0x21')](function(_0x192395){if(_0x192395&&_0x192395[_0x5a71('0xb7')]){_0x154256=_0x192395[_0x5a71('0x34')]({'plain':!![]});if(_0x154256['List']&&_0x154256[_0x5a71('0xb7')][_0x5a71('0xa0')][_0x5a71('0x49')]){return _0x154256[_0x5a71('0xb7')][_0x5a71('0xa0')][0x0];}return db[_0x5a71('0x8a')]['create'](_[_0x5a71('0x1b')](_0xc49135[_0x5a71('0x59')],{'firstName':_0x28717d,'mobile':_0x28717d,'phone':_0x28717d,'ListId':_0x154256[_0x5a71('0x9d')]}));}})[_0x5a71('0x21')](handleEntityNotFound(_0x54df15,null))[_0x5a71('0x21')](function(_0x36d766){if(_0x36d766){_0x24024f=_0x36d766;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x24024f['id'],'closed':![],'WhatsappAccountId':_0x154256['id']}})[_0x5a71('0x21')](function(_0xe763e2){if(_0xe763e2){return[_0xe763e2,![]];}return db[_0x5a71('0xb8')]['create']({'UserId':_0xc49135['user']['id'],'ContactId':_0x24024f['id'],'WhatsappAccountId':_0x154256['id'],'phone':_0x28717d,'firstMsgDirection':_0x5a71('0xb9'),'Messages':[_[_0x5a71('0x69')](_0xc49135[_0x5a71('0x59')],{'read':![],'body':_0xc49135[_0x5a71('0x59')][_0x5a71('0x59')],'phone':_0x28717d,'WhatsappAccountId':_0x154256['id'],'UserId':_0xc49135[_0x5a71('0x5a')]['id'],'ContactId':_0x24024f['id']})]},{'include':[{'model':db[_0x5a71('0xaa')],'as':'Messages'}]})[_0x5a71('0x21')](function(_0x5a7c4c){return[_0x5a7c4c,!![]];});});}})['spread'](function(_0x1b98e7,_0x451b99){if(_0x451b99){return _0x1b98e7;}return db[_0x5a71('0xaa')][_0x5a71('0x58')](_['merge'](_0xc49135[_0x5a71('0x59')],{'read':![],'body':_0xc49135[_0x5a71('0x59')][_0x5a71('0x59')],'phone':_0x28717d,'WhatsappAccountId':_0x154256['id'],'WhatsappInteractionId':_0x1b98e7['id'],'UserId':_0xc49135[_0x5a71('0x5a')]['id'],'ContactId':_0x24024f['id']}))['then'](function(_0x5ee96a){_0x1b98e7['dataValues']['Messages']=[];_0x1b98e7[_0x5a71('0xba')][_0x5a71('0xbb')]['push'](_0x5ee96a[_0x5a71('0xba')]);return _0x1b98e7;});})[_0x5a71('0x21')](respondWithResult(_0x54df15,null))['catch'](handleError(_0x54df15,null));}; \ No newline at end of file +var _0x365f=['merge','options','count','includeAll','include','findAll','rows','show','mandatoryDispositionPause','keys','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','params','WhatsappAccountId','getDispositions','findOne','hasOwnProperty','order','pick','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','Applications','applications','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','defaults','contact','WhatsappInteraction','interaction','created','close','unmanaged','*,*,*,*','messageId','ContactId','AttachmentId','UserId','agent','startRouting','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','out','WhatsappMessage','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','save','then','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','sort','where','filters','filter'];(function(_0x19f716,_0x498681){var _0xfaa946=function(_0x304f16){while(--_0x304f16){_0x19f716['push'](_0x19f716['shift']());}};_0xfaa946(++_0x498681);}(_0x365f,0x11f));var _0xf365=function(_0x198df6,_0x3b710a){_0x198df6=_0x198df6-0x0;var _0x59f6a4=_0x365f[_0x198df6];return _0x59f6a4;};'use strict';var pdf=require(_0xf365('0x0'));var emlformat=require(_0xf365('0x1'));var rimraf=require(_0xf365('0x2'));var zipdir=require(_0xf365('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf365('0x4'));var moment=require('moment');var BPromise=require(_0xf365('0x5'));var Mustache=require(_0xf365('0x6'));var util=require('util');var path=require(_0xf365('0x7'));var sox=require('sox');var csv=require(_0xf365('0x8'));var ejs=require(_0xf365('0x9'));var fs=require('fs');var _=require(_0xf365('0xa'));var squel=require(_0xf365('0xb'));var crypto=require(_0xf365('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf365('0xd'));var toCsv=require(_0xf365('0x8'));var querystring=require('querystring');var Papa=require(_0xf365('0xe'));var Redis=require(_0xf365('0xf'));var authService=require(_0xf365('0x10'));var qs=require(_0xf365('0x11'));var as=require(_0xf365('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf365('0x13'))(_0xf365('0x14'));var utils=require(_0xf365('0x15'));var config=require(_0xf365('0x16'));var licenseUtil=require(_0xf365('0x17'));var db=require(_0xf365('0x18'))['db'];config[_0xf365('0x19')]=_['defaults'](config[_0xf365('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf365('0x1a'))(new Redis(config[_0xf365('0x19')]));require(_0xf365('0x1b'))[_0xf365('0x1c')](socket);var jayson=require(_0xf365('0x1d'));var client=jayson['client'][_0xf365('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3d860f,_0x5dcfd9,_0x2b73fb,_0x411b53){return new BPromise(function(_0x68c6e8,_0x4ebafa){var _0x9dac31=_0x411b53||client;return _0x9dac31['request'](_0x3d860f,_0x2b73fb)['then'](function(_0x5f2112){logger[_0xf365('0x1f')](_0xf365('0x20'),_0x5dcfd9,_0xf365('0x21'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5dcfd9,_0xf365('0x21'),JSON['stringify'](_0x5f2112));if(_0x5f2112[_0xf365('0x22')]){if(_0x5f2112[_0xf365('0x22')][_0xf365('0x23')]===0x1f4){logger['error'](_0xf365('0x20'),_0x5dcfd9,_0x5f2112[_0xf365('0x22')][_0xf365('0x24')]);return _0x4ebafa(_0x5f2112[_0xf365('0x22')]['message']);}logger[_0xf365('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x5dcfd9,_0x5f2112['error']['message']);return _0x68c6e8(_0x5f2112['error'][_0xf365('0x24')]);}else{logger[_0xf365('0x1f')](_0xf365('0x20'),_0x5dcfd9,_0xf365('0x21'));_0x68c6e8(_0x5f2112['result'][_0xf365('0x24')]);}})[_0xf365('0x25')](function(_0x3eee7a){logger['error'](_0xf365('0x20'),_0x5dcfd9,_0x3eee7a);_0x4ebafa(_0x3eee7a);});});}function respondWithStatusCode(_0x52ad08,_0x39c9c2){_0x39c9c2=_0x39c9c2||0xcc;return function(_0x19ce25){if(_0x19ce25){return _0x52ad08[_0xf365('0x26')](_0x39c9c2);}return _0x52ad08[_0xf365('0x27')](_0x39c9c2)[_0xf365('0x28')]();};}function respondWithResult(_0x5394b7,_0x516b0d){_0x516b0d=_0x516b0d||0xc8;return function(_0x51e9cd){if(_0x51e9cd){return _0x5394b7['status'](_0x516b0d)[_0xf365('0x29')](_0x51e9cd);}};}function respondWithFilteredResult(_0x59f107,_0x494edd){return function(_0x3a3659){if(_0x3a3659){var _0x3cd01e=_0x3a3659['count'],_0x14ac22=_0x494edd[_0xf365('0x2a')],_0x56d3cb=_0x494edd['offset']+_0x494edd['limit'],_0x744dbc;if(_0x56d3cb>=_0x3cd01e){_0x56d3cb=_0x3cd01e;_0x744dbc=0xc8;}else{_0x744dbc=0xce;}_0x59f107[_0xf365('0x27')](_0x744dbc);return _0x59f107[_0xf365('0x2b')](_0xf365('0x2c'),_0x14ac22+'-'+_0x56d3cb+'/'+_0x3cd01e)[_0xf365('0x29')](_0x3a3659);}return null;};}function patchUpdates(_0x1e2ba1){return function(_0x3d99fb){try{jsonpatch[_0xf365('0x2d')](_0x3d99fb,_0x1e2ba1,!![]);}catch(_0x5ab9db){return BPromise['reject'](_0x5ab9db);}return _0x3d99fb[_0xf365('0x2e')]();};}function saveUpdates(_0x3030da,_0x3c4808){return function(_0xd2ce37){if(_0xd2ce37){return _0xd2ce37['update'](_0x3030da)[_0xf365('0x2f')](function(_0x1fbe7a){return _0x1fbe7a;});}return null;};}function removeEntity(_0x38fa7d,_0x47c4d1){return function(_0x1bfaae){if(_0x1bfaae){return _0x1bfaae['destroy']()[_0xf365('0x2f')](function(){var _0x31b718=_0x1bfaae[_0xf365('0x30')]({'plain':!![]});var _0x3f4828=_0xf365('0x31');return db[_0xf365('0x32')][_0xf365('0x33')]({'where':{'type':_0x3f4828,'resourceId':_0x31b718['id']}})[_0xf365('0x2f')](function(){return _0x1bfaae;});})[_0xf365('0x2f')](function(){_0x38fa7d[_0xf365('0x27')](0xcc)[_0xf365('0x28')]();});}};}function handleEntityNotFound(_0x19baf4,_0x2a06e5){return function(_0x47ee56){if(!_0x47ee56){_0x19baf4[_0xf365('0x26')](0x194);}return _0x47ee56;};}function handleError(_0x4d67cf,_0x40569e){_0x40569e=_0x40569e||0x1f4;return function(_0xd7fed4){logger[_0xf365('0x22')](_0xd7fed4[_0xf365('0x34')]);if(_0xd7fed4[_0xf365('0x35')]){delete _0xd7fed4[_0xf365('0x35')];}_0x4d67cf[_0xf365('0x27')](_0x40569e)[_0xf365('0x36')](_0xd7fed4);};}exports[_0xf365('0x37')]=function(_0x2efd86,_0x27c5fd){var _0x251f38={'include':[{'model':db[_0xf365('0x38')],'as':'mandatoryDispositionPause'}]},_0x15356d={},_0xd44b78={'count':0x0,'rows':[]};var _0x2f0e07=_[_0xf365('0x39')](db[_0xf365('0x3a')][_0xf365('0x3b')],function(_0x432af7){return{'name':_0x432af7['fieldName'],'type':_0x432af7[_0xf365('0x3c')][_0xf365('0x3d')]};});_0x15356d[_0xf365('0x3e')]=_[_0xf365('0x39')](_0x2f0e07,'name');_0x15356d[_0xf365('0x3f')]=_['keys'](_0x2efd86['query']);_0x15356d['filters']=_[_0xf365('0x40')](_0x15356d[_0xf365('0x3e')],_0x15356d[_0xf365('0x3f')]);_0x251f38[_0xf365('0x41')]=_[_0xf365('0x40')](_0x15356d['model'],qs['fields'](_0x2efd86[_0xf365('0x3f')]['fields']));_0x251f38[_0xf365('0x41')]=_0x251f38['attributes'][_0xf365('0x42')]?_0x251f38[_0xf365('0x41')]:_0x15356d[_0xf365('0x3e')];if(!_0x2efd86['query']['hasOwnProperty'](_0xf365('0x43'))){_0x251f38['limit']=qs[_0xf365('0x44')](_0x2efd86[_0xf365('0x3f')][_0xf365('0x44')]);_0x251f38[_0xf365('0x2a')]=qs[_0xf365('0x2a')](_0x2efd86[_0xf365('0x3f')][_0xf365('0x2a')]);}_0x251f38['order']=qs['sort'](_0x2efd86[_0xf365('0x3f')][_0xf365('0x45')]);_0x251f38[_0xf365('0x46')]=qs[_0xf365('0x47')](_['pick'](_0x2efd86[_0xf365('0x3f')],_0x15356d['filters']),_0x2f0e07);if(_0x2efd86[_0xf365('0x3f')][_0xf365('0x48')]){_0x251f38[_0xf365('0x46')]=_[_0xf365('0x49')](_0x251f38[_0xf365('0x46')],{'$or':_[_0xf365('0x39')](_0x2f0e07,function(_0x53a13e){if(_0x53a13e[_0xf365('0x3c')]!=='VIRTUAL'){var _0x335988={};_0x335988[_0x53a13e['name']]={'$like':'%'+_0x2efd86[_0xf365('0x3f')][_0xf365('0x48')]+'%'};return _0x335988;}})});}_0x251f38=_['merge']({},_0x251f38,_0x2efd86[_0xf365('0x4a')]);var _0x24d45c={'where':_0x251f38[_0xf365('0x46')]};return db[_0xf365('0x3a')][_0xf365('0x4b')](_0x24d45c)[_0xf365('0x2f')](function(_0x5539c8){_0xd44b78[_0xf365('0x4b')]=_0x5539c8;if(_0x2efd86['query'][_0xf365('0x4c')]){_0x251f38[_0xf365('0x4d')]=[{'all':!![]}];}return db[_0xf365('0x3a')][_0xf365('0x4e')](_0x251f38);})['then'](function(_0x2616d6){_0xd44b78[_0xf365('0x4f')]=_0x2616d6;return _0xd44b78;})[_0xf365('0x2f')](respondWithFilteredResult(_0x27c5fd,_0x251f38))[_0xf365('0x25')](handleError(_0x27c5fd,null));};exports[_0xf365('0x50')]=function(_0x40f9c4,_0xd0d22d){var _0x3c895b={'raw':![],'where':{'id':_0x40f9c4['params']['id']},'include':[{'model':db[_0xf365('0x38')],'as':_0xf365('0x51')}]},_0x38b69a={};_0x38b69a[_0xf365('0x3e')]=_[_0xf365('0x52')](db[_0xf365('0x3a')]['rawAttributes']);_0x38b69a['query']=_[_0xf365('0x52')](_0x40f9c4['query']);_0x38b69a[_0xf365('0x47')]=_['intersection'](_0x38b69a[_0xf365('0x3e')],_0x38b69a[_0xf365('0x3f')]);_0x3c895b[_0xf365('0x41')]=_[_0xf365('0x40')](_0x38b69a[_0xf365('0x3e')],qs[_0xf365('0x53')](_0x40f9c4[_0xf365('0x3f')][_0xf365('0x53')]));_0x3c895b[_0xf365('0x41')]=_0x3c895b['attributes'][_0xf365('0x42')]?_0x3c895b[_0xf365('0x41')]:_0x38b69a[_0xf365('0x3e')];if(_0x40f9c4[_0xf365('0x3f')][_0xf365('0x4c')]){_0x3c895b[_0xf365('0x4d')]=[{'all':!![]}];}_0x3c895b=_[_0xf365('0x49')]({},_0x3c895b,_0x40f9c4[_0xf365('0x4a')]);return db[_0xf365('0x3a')][_0xf365('0x54')](_0x3c895b)[_0xf365('0x2f')](handleEntityNotFound(_0xd0d22d,null))[_0xf365('0x2f')](respondWithResult(_0xd0d22d,null))[_0xf365('0x25')](handleError(_0xd0d22d,null));};exports[_0xf365('0x55')]=function(_0x17063c,_0xcf0df8){return db['WhatsappAccount'][_0xf365('0x55')](_0x17063c[_0xf365('0x56')],{})['then'](function(_0x2e4491){var _0x5794da=_0x17063c['user'][_0xf365('0x30')]({'plain':!![]});if(!_0x5794da)throw new Error(_0xf365('0x57'));if(_0x5794da[_0xf365('0x58')]===_0xf365('0x59')){var _0x1df0b1=_0x2e4491[_0xf365('0x30')]({'plain':!![]});var _0x359373=_0xf365('0x31');return db['UserProfileSection'][_0xf365('0x54')]({'where':{'name':_0x359373,'userProfileId':_0x5794da['userProfileId']},'raw':!![]})[_0xf365('0x2f')](function(_0x34dd8a){if(_0x34dd8a&&_0x34dd8a[_0xf365('0x5a')]===0x0){return db[_0xf365('0x32')][_0xf365('0x55')]({'name':_0x1df0b1['name'],'resourceId':_0x1df0b1['id'],'type':_0x34dd8a[_0xf365('0x35')],'sectionId':_0x34dd8a['id']},{})[_0xf365('0x2f')](function(){return _0x2e4491;});}else{return _0x2e4491;}})[_0xf365('0x25')](function(_0x7b43d1){logger[_0xf365('0x22')](_0xf365('0x5b'),_0x7b43d1);throw _0x7b43d1;});}return _0x2e4491;})[_0xf365('0x2f')](respondWithResult(_0xcf0df8,0xc9))[_0xf365('0x25')](handleError(_0xcf0df8,null));};exports['update']=function(_0x3a3a9a,_0x59857f){if(_0x3a3a9a['body']['id']){delete _0x3a3a9a[_0xf365('0x56')]['id'];}return db[_0xf365('0x3a')]['find']({'where':{'id':_0x3a3a9a['params']['id']},'include':[{'model':db[_0xf365('0x38')],'as':_0xf365('0x51')}]})[_0xf365('0x2f')](handleEntityNotFound(_0x59857f,null))[_0xf365('0x2f')](saveUpdates(_0x3a3a9a[_0xf365('0x56')],null))['then'](respondWithResult(_0x59857f,null))[_0xf365('0x25')](handleError(_0x59857f,null));};exports[_0xf365('0x33')]=function(_0x3efc14,_0x41dc08){return db[_0xf365('0x3a')][_0xf365('0x54')]({'where':{'id':_0x3efc14['params']['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x41dc08,null))[_0xf365('0x2f')](removeEntity(_0x41dc08,null))['catch'](handleError(_0x41dc08,null));};exports[_0xf365('0x5c')]=function(_0x585cee,_0x54d50b){return db[_0xf365('0x3a')]['describe']()[_0xf365('0x2f')](respondWithResult(_0x54d50b,null))[_0xf365('0x25')](handleError(_0x54d50b,null));};exports['addDisposition']=function(_0x2470b2,_0x5aa354,_0x4ef46a){if(_0x2470b2[_0xf365('0x56')]['id']){delete _0x2470b2[_0xf365('0x56')]['id'];}return db[_0xf365('0x3a')][_0xf365('0x54')]({'where':{'id':_0x2470b2[_0xf365('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5aa354,null))[_0xf365('0x2f')](function(_0x15cc27){if(_0x15cc27){_0x2470b2[_0xf365('0x56')][_0xf365('0x5e')]=_0x15cc27['id'];return db['Disposition'][_0xf365('0x55')](_0x2470b2[_0xf365('0x56')]);}})['then'](respondWithResult(_0x5aa354,null))[_0xf365('0x25')](handleError(_0x5aa354,null));};exports[_0xf365('0x5f')]=function(_0x5e6161,_0x5aec53,_0x364dac){var _0x8a7aa8={'raw':![],'where':{}};var _0x1df2c0={};var _0x16a2c2={'count':0x0,'rows':[]};return db[_0xf365('0x3a')][_0xf365('0x60')]({'where':{'id':_0x5e6161['params']['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x5aec53,null))[_0xf365('0x2f')](function(_0x3288b1){if(_0x3288b1){_0x1df2c0[_0xf365('0x3e')]=_[_0xf365('0x52')](db['Disposition'][_0xf365('0x3b')]);_0x1df2c0['query']=_[_0xf365('0x52')](_0x5e6161[_0xf365('0x3f')]);_0x1df2c0['filters']=_[_0xf365('0x40')](_0x1df2c0[_0xf365('0x3e')],_0x1df2c0[_0xf365('0x3f')]);_0x8a7aa8[_0xf365('0x41')]=_['intersection'](_0x1df2c0[_0xf365('0x3e')],qs[_0xf365('0x53')](_0x5e6161[_0xf365('0x3f')][_0xf365('0x53')]));_0x8a7aa8[_0xf365('0x41')]=_0x8a7aa8[_0xf365('0x41')][_0xf365('0x42')]?_0x8a7aa8[_0xf365('0x41')]:_0x1df2c0[_0xf365('0x3e')];if(!_0x5e6161[_0xf365('0x3f')][_0xf365('0x61')](_0xf365('0x43'))){_0x8a7aa8[_0xf365('0x44')]=qs[_0xf365('0x44')](_0x5e6161['query']['limit']);_0x8a7aa8['offset']=qs[_0xf365('0x2a')](_0x5e6161[_0xf365('0x3f')][_0xf365('0x2a')]);}_0x8a7aa8[_0xf365('0x62')]=qs[_0xf365('0x45')](_0x5e6161[_0xf365('0x3f')][_0xf365('0x45')]);_0x8a7aa8[_0xf365('0x46')]=qs[_0xf365('0x47')](_[_0xf365('0x63')](_0x5e6161[_0xf365('0x3f')],_0x1df2c0['filters']));_0x8a7aa8[_0xf365('0x46')][_0xf365('0x5e')]=_0x3288b1['id'];if(_0x5e6161[_0xf365('0x3f')][_0xf365('0x48')]){_0x8a7aa8[_0xf365('0x46')]=_[_0xf365('0x49')](_0x8a7aa8['where'],{'$or':_['map'](_0x8a7aa8[_0xf365('0x41')],function(_0x4146b4){var _0xc11098={};_0xc11098[_0x4146b4]={'$like':'%'+_0x5e6161['query']['filter']+'%'};return _0xc11098;})});}_0x8a7aa8=_[_0xf365('0x49')]({},_0x8a7aa8,_0x5e6161[_0xf365('0x4a')]);return db[_0xf365('0x64')][_0xf365('0x4b')]({'where':_0x8a7aa8[_0xf365('0x46')]})[_0xf365('0x2f')](function(_0xf6ae55){_0x16a2c2[_0xf365('0x4b')]=_0xf6ae55;if(_0x5e6161[_0xf365('0x3f')][_0xf365('0x4c')]){_0x8a7aa8[_0xf365('0x4d')]=[{'all':!![]}];}return db[_0xf365('0x64')][_0xf365('0x4e')](_0x8a7aa8);})[_0xf365('0x2f')](function(_0x36b957){_0x16a2c2[_0xf365('0x4f')]=_0x36b957;return _0x16a2c2;});}})[_0xf365('0x2f')](respondWithFilteredResult(_0x5aec53,_0x8a7aa8))[_0xf365('0x25')](handleError(_0x5aec53,null));};exports[_0xf365('0x65')]=function(_0x2aebf1,_0x1e5565,_0x2557a4){return db['WhatsappAccount'][_0xf365('0x54')]({'where':{'id':_0x2aebf1[_0xf365('0x5d')]['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x1e5565,null))[_0xf365('0x2f')](function(_0x53d6e1){if(_0x53d6e1){return _0x53d6e1[_0xf365('0x65')](_0x2aebf1[_0xf365('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x1e5565,null))[_0xf365('0x25')](handleError(_0x1e5565,null));};exports[_0xf365('0x66')]=function(_0x4fd0f5,_0x27c1f8,_0x1d4a4c){if(_0x4fd0f5[_0xf365('0x56')]['id']){delete _0x4fd0f5[_0xf365('0x56')]['id'];}return db[_0xf365('0x3a')]['find']({'where':{'id':_0x4fd0f5[_0xf365('0x5d')]['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x27c1f8,null))['then'](function(_0x46f06e){if(_0x46f06e){_0x4fd0f5[_0xf365('0x56')][_0xf365('0x5e')]=_0x46f06e['id'];return db[_0xf365('0x67')][_0xf365('0x55')](_0x4fd0f5['body']);}})[_0xf365('0x2f')](respondWithResult(_0x27c1f8,null))[_0xf365('0x25')](handleError(_0x27c1f8,null));};exports[_0xf365('0x68')]=function(_0x3b6e63,_0xada025,_0x44a75a){var _0x1b4b94={'raw':![],'where':{}};var _0x568306={};var _0x1f119c={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xf365('0x60')]({'where':{'id':_0x3b6e63[_0xf365('0x5d')]['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0xada025,null))[_0xf365('0x2f')](function(_0x214cd8){if(_0x214cd8){_0x568306[_0xf365('0x3e')]=_[_0xf365('0x52')](db[_0xf365('0x67')][_0xf365('0x3b')]);_0x568306[_0xf365('0x3f')]=_['keys'](_0x3b6e63['query']);_0x568306[_0xf365('0x47')]=_[_0xf365('0x40')](_0x568306[_0xf365('0x3e')],_0x568306[_0xf365('0x3f')]);_0x1b4b94[_0xf365('0x41')]=_[_0xf365('0x40')](_0x568306[_0xf365('0x3e')],qs['fields'](_0x3b6e63[_0xf365('0x3f')][_0xf365('0x53')]));_0x1b4b94['attributes']=_0x1b4b94[_0xf365('0x41')]['length']?_0x1b4b94[_0xf365('0x41')]:_0x568306['model'];if(!_0x3b6e63[_0xf365('0x3f')][_0xf365('0x61')]('nolimit')){_0x1b4b94[_0xf365('0x44')]=qs[_0xf365('0x44')](_0x3b6e63[_0xf365('0x3f')][_0xf365('0x44')]);_0x1b4b94[_0xf365('0x2a')]=qs['offset'](_0x3b6e63['query'][_0xf365('0x2a')]);}_0x1b4b94['order']=qs[_0xf365('0x45')](_0x3b6e63[_0xf365('0x3f')][_0xf365('0x45')]);_0x1b4b94[_0xf365('0x46')]=qs['filters'](_[_0xf365('0x63')](_0x3b6e63[_0xf365('0x3f')],_0x568306[_0xf365('0x47')]));_0x1b4b94[_0xf365('0x46')][_0xf365('0x5e')]=_0x214cd8['id'];if(_0x3b6e63[_0xf365('0x3f')][_0xf365('0x48')]){_0x1b4b94[_0xf365('0x46')]=_['merge'](_0x1b4b94[_0xf365('0x46')],{'$or':_['map'](_0x1b4b94[_0xf365('0x41')],function(_0x45bb42){var _0x4f1eb9={};_0x4f1eb9[_0x45bb42]={'$like':'%'+_0x3b6e63[_0xf365('0x3f')]['filter']+'%'};return _0x4f1eb9;})});}_0x1b4b94=_['merge']({},_0x1b4b94,_0x3b6e63[_0xf365('0x4a')]);return db[_0xf365('0x67')][_0xf365('0x4b')]({'where':_0x1b4b94[_0xf365('0x46')]})[_0xf365('0x2f')](function(_0x537bb9){_0x1f119c[_0xf365('0x4b')]=_0x537bb9;if(_0x3b6e63[_0xf365('0x3f')]['includeAll']){_0x1b4b94[_0xf365('0x4d')]=[{'all':!![]}];}return db[_0xf365('0x67')][_0xf365('0x4e')](_0x1b4b94);})[_0xf365('0x2f')](function(_0x40ea95){_0x1f119c[_0xf365('0x4f')]=_0x40ea95;return _0x1f119c;});}})[_0xf365('0x2f')](respondWithFilteredResult(_0xada025,_0x1b4b94))[_0xf365('0x25')](handleError(_0xada025,null));};exports[_0xf365('0x69')]=function(_0x499fa8,_0x5d7a54,_0x32ac9f){return db['WhatsappAccount'][_0xf365('0x54')]({'where':{'id':_0x499fa8[_0xf365('0x5d')]['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x5d7a54,null))[_0xf365('0x2f')](function(_0x43883f){if(_0x43883f){return _0x43883f[_0xf365('0x69')](_0x499fa8[_0xf365('0x3f')][_0xf365('0x6a')]);}})['then'](respondWithStatusCode(_0x5d7a54,null))[_0xf365('0x25')](handleError(_0x5d7a54,null));};exports[_0xf365('0x6b')]=function(_0xa666e7,_0x101f48,_0x2300ff){return db[_0xf365('0x3a')]['find']({'where':{'id':_0xa666e7[_0xf365('0x5d')]['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x101f48,null))[_0xf365('0x2f')](function(_0x1c8df4){if(_0x1c8df4){return _0x1c8df4[_0xf365('0x6b')](_0xa666e7[_0xf365('0x56')][_0xf365('0x6a')],_[_0xf365('0x6c')](_0xa666e7[_0xf365('0x56')],[_0xf365('0x6a'),'id'])||{})[_0xf365('0x6d')](function(_0xaf4e9f){for(var _0x40d7ea=0x0;_0x40d7ea<_0xa666e7['body']['ids']['length'];_0x40d7ea+=0x1){socket[_0xf365('0x6e')]('userWhatsappAccount:save',{'UserId':_0xa666e7[_0xf365('0x56')][_0xf365('0x6a')][_0x40d7ea],'WhatsappAccountId':_0xa666e7['params']['id']});}return _0xaf4e9f;});}})['then'](respondWithResult(_0x101f48,null))[_0xf365('0x25')](handleError(_0x101f48,null));};exports[_0xf365('0x6f')]=function(_0x68612e,_0x438bee,_0x4a2228){return db['WhatsappAccount'][_0xf365('0x54')]({'where':{'id':_0x68612e['params']['id']}})['then'](handleEntityNotFound(_0x438bee,null))[_0xf365('0x2f')](function(_0x3d6b04){if(_0x3d6b04){return _0x3d6b04[_0xf365('0x6f')](_0x68612e[_0xf365('0x3f')][_0xf365('0x6a')])['then'](function(){if(_['isArray'](_0x68612e[_0xf365('0x3f')][_0xf365('0x6a')])){for(var _0x25a2e3=0x0;_0x25a2e3<_0x68612e[_0xf365('0x3f')][_0xf365('0x6a')][_0xf365('0x42')];_0x25a2e3+=0x1){socket[_0xf365('0x6e')]('userWhatsappAccount:remove',{'UserId':Number(_0x68612e[_0xf365('0x3f')][_0xf365('0x6a')][_0x25a2e3]),'WhatsappAccountId':Number(_0x68612e[_0xf365('0x5d')]['id'])});}}else{socket[_0xf365('0x6e')](_0xf365('0x70'),{'UserId':Number(_0x68612e[_0xf365('0x3f')][_0xf365('0x6a')]),'WhatsappAccountId':Number(_0x68612e[_0xf365('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x438bee,null))[_0xf365('0x25')](handleError(_0x438bee,null));};exports[_0xf365('0x71')]=function(_0x80bad9,_0x72bed2,_0x2cab4b){var _0x5a6374={};var _0x9dbc76={};var _0x2d5055;var _0x52fd99;return db[_0xf365('0x3a')][_0xf365('0x60')]({'where':{'id':_0x80bad9['params']['id']}})['then'](handleEntityNotFound(_0x72bed2,null))[_0xf365('0x2f')](function(_0x4cab10){if(_0x4cab10){_0x2d5055=_0x4cab10;_0x9dbc76['model']=_[_0xf365('0x52')](db[_0xf365('0x72')][_0xf365('0x3b')]);_0x9dbc76[_0xf365('0x3f')]=_['keys'](_0x80bad9[_0xf365('0x3f')]);_0x9dbc76['filters']=_['intersection'](_0x9dbc76[_0xf365('0x3e')],_0x9dbc76[_0xf365('0x3f')]);_0x5a6374[_0xf365('0x41')]=_[_0xf365('0x40')](_0x9dbc76[_0xf365('0x3e')],qs['fields'](_0x80bad9[_0xf365('0x3f')][_0xf365('0x53')]));_0x5a6374[_0xf365('0x41')]=_0x5a6374[_0xf365('0x41')]['length']?_0x5a6374[_0xf365('0x41')]:_0x9dbc76[_0xf365('0x3e')];_0x5a6374[_0xf365('0x62')]=qs['sort'](_0x80bad9[_0xf365('0x3f')][_0xf365('0x45')]);_0x5a6374[_0xf365('0x46')]=qs[_0xf365('0x47')](_[_0xf365('0x63')](_0x80bad9[_0xf365('0x3f')],_0x9dbc76[_0xf365('0x47')]));if(_0x80bad9[_0xf365('0x3f')]['filter']){_0x5a6374['where']=_['merge'](_0x5a6374[_0xf365('0x46')],{'$or':_[_0xf365('0x39')](_0x5a6374[_0xf365('0x41')],function(_0x2f7b9e){var _0x52e166={};_0x52e166[_0x2f7b9e]={'$like':'%'+_0x80bad9[_0xf365('0x3f')]['filter']+'%'};return _0x52e166;})});}_0x5a6374=_['merge']({},_0x5a6374,_0x80bad9['options']);return _0x2d5055[_0xf365('0x71')](_0x5a6374);}})['then'](function(_0x38cffb){if(_0x38cffb){_0x52fd99=_0x38cffb['length'];if(!_0x80bad9['query']['hasOwnProperty']('nolimit')){_0x5a6374[_0xf365('0x44')]=qs[_0xf365('0x44')](_0x80bad9['query'][_0xf365('0x44')]);_0x5a6374[_0xf365('0x2a')]=qs[_0xf365('0x2a')](_0x80bad9['query']['offset']);}return _0x2d5055[_0xf365('0x71')](_0x5a6374);}})['then'](function(_0x3c7d4a){if(_0x3c7d4a){return _0x3c7d4a?{'count':_0x52fd99,'rows':_0x3c7d4a}:null;}})[_0xf365('0x2f')](respondWithResult(_0x72bed2,null))[_0xf365('0x25')](handleError(_0x72bed2,null));};exports['addApplications']=function(_0x44b278,_0x34131c,_0x4eec46){return db[_0xf365('0x3a')][_0xf365('0x60')]({'where':{'id':_0x44b278[_0xf365('0x5d')]['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x34131c,null))[_0xf365('0x2f')](function(_0x2578f4){if(_0x2578f4){return db[_0xf365('0x73')][_0xf365('0x74')](function(_0x103b8f){return db[_0xf365('0x75')][_0xf365('0x33')]({'where':{'WhatsappAccountId':_0x44b278[_0xf365('0x5d')]['id']},'transaction':_0x103b8f})[_0xf365('0x2f')](function(_0x5e51d4){var _0x3fee23=_[_0xf365('0x39')](_0x44b278['body'],function(_0x2b0da6){_0x2b0da6['WhatsappAccountId']=_0x44b278[_0xf365('0x5d')]['id'];return _0x2b0da6;});return db['WhatsappApplication'][_0xf365('0x76')](_0x3fee23,{'transaction':_0x103b8f});});})[_0xf365('0x2f')](function(){return db['WhatsappApplication'][_0xf365('0x77')]({'where':{'WhatsappAccountId':_0x44b278[_0xf365('0x5d')]['id']},'order':_0xf365('0x78')});});}})[_0xf365('0x2f')](respondWithResult(_0x34131c,null))[_0xf365('0x25')](handleError(_0x34131c,null));};exports['getApplications']=function(_0x53da28,_0x20eb53,_0x1646e2){var _0x1381e1={};var _0x3ca310={};var _0x4b50d7;var _0x51d700;return db[_0xf365('0x3a')][_0xf365('0x60')]({'where':{'id':_0x53da28['params']['id']}})[_0xf365('0x2f')](handleEntityNotFound(_0x20eb53,null))[_0xf365('0x2f')](function(_0x5cf8bd){if(_0x5cf8bd){_0x4b50d7=_0x5cf8bd;_0x3ca310[_0xf365('0x3e')]=_[_0xf365('0x52')](db['WhatsappApplication']['rawAttributes']);_0x3ca310[_0xf365('0x3f')]=_[_0xf365('0x52')](_0x53da28[_0xf365('0x3f')]);_0x3ca310['filters']=_[_0xf365('0x40')](_0x3ca310['model'],_0x3ca310['query']);_0x1381e1[_0xf365('0x41')]=_['intersection'](_0x3ca310[_0xf365('0x3e')],qs['fields'](_0x53da28[_0xf365('0x3f')]['fields']));_0x1381e1['attributes']=_0x1381e1[_0xf365('0x41')][_0xf365('0x42')]?_0x1381e1[_0xf365('0x41')]:_0x3ca310[_0xf365('0x3e')];_0x1381e1['order']=qs[_0xf365('0x45')](_0x53da28[_0xf365('0x3f')][_0xf365('0x45')]);_0x1381e1[_0xf365('0x46')]=qs[_0xf365('0x47')](_[_0xf365('0x63')](_0x53da28[_0xf365('0x3f')],_0x3ca310[_0xf365('0x47')]));if(_0x53da28[_0xf365('0x3f')]['filter']){_0x1381e1[_0xf365('0x46')]=_['merge'](_0x1381e1['where'],{'$or':_['map'](_0x1381e1[_0xf365('0x41')],function(_0x4e41bd){var _0x248744={};_0x248744[_0x4e41bd]={'$like':'%'+_0x53da28[_0xf365('0x3f')][_0xf365('0x48')]+'%'};return _0x248744;})});}_0x1381e1=_[_0xf365('0x49')]({},_0x1381e1,_0x53da28[_0xf365('0x4a')]);return _0x4b50d7[_0xf365('0x79')](_0x1381e1);}})[_0xf365('0x2f')](function(_0x5c9b18){if(_0x5c9b18){_0x51d700=_0x5c9b18[_0xf365('0x42')];if(!_0x53da28[_0xf365('0x3f')]['hasOwnProperty']('nolimit')){_0x1381e1[_0xf365('0x44')]=qs[_0xf365('0x44')](_0x53da28[_0xf365('0x3f')]['limit']);_0x1381e1[_0xf365('0x2a')]=qs['offset'](_0x53da28[_0xf365('0x3f')]['offset']);}return _0x4b50d7['getApplications'](_0x1381e1);}})[_0xf365('0x2f')](function(_0x4e74c3){if(_0x4e74c3){return _0x4e74c3?{'count':_0x51d700,'rows':_0x4e74c3}:null;}})[_0xf365('0x2f')](respondWithResult(_0x20eb53,null))[_0xf365('0x25')](handleError(_0x20eb53,null));};exports['notify']=function(_0x3a1cc2,_0x4d108c,_0x1c71fa){var _0x1afd48={'channel':'whatsapp'};var _0x554e1d=[];var _0x248709=[];var _0x44bd75={};return db[_0xf365('0x3a')][_0xf365('0x54')]({'where':{'id':_0x3a1cc2[_0xf365('0x5d')]['id']},'include':[{'model':db[_0xf365('0x75')],'as':_0xf365('0x7a')}]})[_0xf365('0x2f')](handleEntityNotFound(_0x4d108c,null))[_0xf365('0x2f')](function(_0x345ff0){_0x1afd48['account']=_0x345ff0;_0x1afd48[_0xf365('0x7b')]=_['orderBy'](_0x345ff0[_0xf365('0x7a')],[_0xf365('0x78')],[_0xf365('0x7c')]);if(_0x1afd48[_0xf365('0x7d')][_0xf365('0x7a')]){delete _0x1afd48['account']['Applications'];}return db[_0xf365('0x7e')][_0xf365('0x5c')]();})[_0xf365('0x2f')](function(_0x6c32fd){if(!_0x6c32fd){throw new db[(_0xf365('0x7f'))][(_0xf365('0x80'))](_0xf365('0x81'));}_0x554e1d=_[_0xf365('0x82')](_[_0xf365('0x52')](_0x6c32fd),['createdAt',_0xf365('0x83')]);_0x248709=_[_0xf365('0x82')](_['keys'](_0x6c32fd),[_0xf365('0x84'),_0xf365('0x83'),_0xf365('0x85'),_0xf365('0x86')]);_0x1afd48['body']={'mapKey':_0xf365('0x87')};if(_0x1afd48[_0xf365('0x7d')][_0xf365('0x3c')]&&_0x1afd48[_0xf365('0x7d')][_0xf365('0x3c')]===_0xf365('0x88')){_0x1afd48[_0xf365('0x56')][_0xf365('0x89')]=_0x3a1cc2[_0xf365('0x56')][_0xf365('0x8a')][_0xf365('0x8b')]('whatsapp:','');_0x1afd48[_0xf365('0x56')][_0xf365('0x56')]=_0x3a1cc2[_0xf365('0x56')][_0xf365('0x8c')];_0x1afd48[_0xf365('0x56')]['messageId']=_0x3a1cc2['body'][_0xf365('0x8d')];}if(_0x1afd48[_0xf365('0x56')]['id']){delete _0x1afd48[_0xf365('0x56')]['id'];}if(_[_0xf365('0x8e')](_0x1afd48[_0xf365('0x56')][_0xf365('0x89')])){throw new db['Sequelize'][(_0xf365('0x80'))](_0xf365('0x8f'));}if(_[_0xf365('0x8e')](_0x1afd48['body'][_0xf365('0x56')])||_0x1afd48[_0xf365('0x56')][_0xf365('0x56')]===''){throw new db[(_0xf365('0x7f'))][(_0xf365('0x80'))](_0xf365('0x90'));}if(_[_0xf365('0x8e')](_0x1afd48['body']['mapKey'])){throw new db[(_0xf365('0x7f'))][(_0xf365('0x80'))](_0xf365('0x91')+_0x248709);}if(!_[_0xf365('0x92')](_0x248709,_0x1afd48[_0xf365('0x56')][_0xf365('0x93')])){throw new db[(_0xf365('0x7f'))][(_0xf365('0x80'))](_0xf365('0x94')+_0x248709);}_0x44bd75[_0x1afd48[_0xf365('0x56')][_0xf365('0x93')]]=_0x1afd48[_0xf365('0x56')][_0xf365('0x89')];return db[_0xf365('0x95')][_0xf365('0x54')]({'where':{'id':_0x1afd48[_0xf365('0x7d')][_0xf365('0x86')]},'include':[{'model':db[_0xf365('0x7e')],'as':'Contacts','where':_0x44bd75,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xf365('0x2f')](handleEntityNotFound(_0x4d108c,null))[_0xf365('0x2f')](function(_0x26728a){if(_0x26728a){_0x1afd48['list']=_[_0xf365('0x6c')](_0x26728a,[_0xf365('0x96')]);if(_0x26728a[_0xf365('0x96')]['length']){return _0x26728a[_0xf365('0x96')][0x0];}var _0x2d1e7f=_[_0xf365('0x97')](_0x1afd48[_0xf365('0x56')],{'firstName':_0x1afd48[_0xf365('0x56')][_0xf365('0x89')],'ListId':_0x26728a['id']});_0x2d1e7f[_0x1afd48[_0xf365('0x56')][_0xf365('0x93')]]=_0x1afd48[_0xf365('0x56')][_0xf365('0x89')];return db[_0xf365('0x7e')][_0xf365('0x55')](_0x2d1e7f,{'fields':_0x554e1d,'raw':!![]});}})[_0xf365('0x2f')](handleEntityNotFound(_0x4d108c,null))[_0xf365('0x2f')](function(_0xe162f6){if(_0xe162f6){_0x1afd48[_0xf365('0x98')]=_0xe162f6;var _0x15e348={'ContactId':_0xe162f6['id'],'phone':_0x1afd48[_0xf365('0x56')][_0xf365('0x89')],'WhatsappAccountId':_0x3a1cc2[_0xf365('0x5d')]['id']};var _0x1ce41f={'ContactId':_0xe162f6['id'],'WhatsappAccountId':_0x3a1cc2[_0xf365('0x5d')]['id'],'closed':![]};return db[_0xf365('0x99')][_0xf365('0x54')]({'where':_0x1ce41f})[_0xf365('0x2f')](function(_0x452959){if(_0x452959){return[_0x452959,![]];}return db[_0xf365('0x99')]['create'](_0x15e348)[_0xf365('0x2f')](function(_0x54da93){return[_0x54da93,!![]];});});}})['spread'](function(_0x19d039,_0x398e09){_0x1afd48[_0xf365('0x9a')]=_0x19d039['get']({'plain':!![]});_0x1afd48[_0xf365('0x9a')][_0xf365('0x9b')]=![];if(_0x398e09){if(_0x1afd48[_0xf365('0x7d')]['autoclose']){_0x1afd48[_0xf365('0x7b')]['push']({'id':0x0,'priority':_0x1afd48['applications']['length']+0x1,'app':_0xf365('0x9c'),'appdata':_0xf365('0x9d'),'interval':_0xf365('0x9e')});}_0x1afd48[_0xf365('0x9a')][_0xf365('0x9b')]=!![];}return db['WhatsappMessage'][_0xf365('0x55')]({'phone':_0x1afd48[_0xf365('0x56')][_0xf365('0x89')],'messageId':_0x1afd48[_0xf365('0x56')][_0xf365('0x9f')],'body':_0x1afd48[_0xf365('0x56')][_0xf365('0x56')],'WhatsappAccountId':_0x3a1cc2['params']['id'],'WhatsappInteractionId':_0x19d039['id'],'direction':'in','ContactId':_0x19d039[_0xf365('0xa0')],'AttachmentId':_0x1afd48[_0xf365('0x56')][_0xf365('0xa1')]});})[_0xf365('0x2f')](function(_0xcb1571){_0x1afd48['message']=_0xcb1571;if(_0x1afd48[_0xf365('0x9a')]['UserId']){return db[_0xf365('0x72')][_0xf365('0x54')]({'attributes':['id','name'],'where':{'id':_0x1afd48['interaction'][_0xf365('0xa2')]}})['then'](function(_0x2c16c2){if(_0x2c16c2){_0x1afd48['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf365('0xa3'),'appdata':_0x2c16c2[_0xf365('0x35')]+','+(_0x1afd48[_0xf365('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':_0xf365('0x9e')});}return respondWithRpcPromise('Start',_0xf365('0xa4'),_0x1afd48);});}return respondWithRpcPromise(_0xf365('0xa5'),_0xf365('0xa4'),_0x1afd48);})[_0xf365('0x2f')](function(_0x13196c){if(_0x13196c){var _0x3433e8=0xc8;var _0x70afe2='receiveMessage';logger[_0xf365('0x1f')](_0xf365('0xa6'),_0x70afe2,_0x3433e8,_0xf365('0xa7'));logger[_0xf365('0xa8')](_0xf365('0xa9'),_0x70afe2,_0x3433e8,_0xf365('0xa7'),JSON['stringify'](_0x13196c));if(_0x1afd48[_0xf365('0x7d')][_0xf365('0x3c')]===_0xf365('0x88')){return _0x4d108c[_0xf365('0x27')](_0x3433e8)[_0xf365('0x2b')](_0xf365('0xaa'),_0xf365('0xab'))[_0xf365('0x36')](_0xf365('0xac'));}else{return _0x4d108c['status'](_0x3433e8)[_0xf365('0x29')](_0x13196c);}}})[_0xf365('0x25')](handleError(_0x4d108c,null));};exports['send']=function(_0x49725f,_0x5a1745,_0x4a5ed1){var _0x3a069d,_0x292a99,_0x14de2a;if(_[_0xf365('0x8e')](_0x49725f[_0xf365('0x56')][_0xf365('0x56')])||_0x49725f[_0xf365('0x56')][_0xf365('0x56')]===''){throw new db[(_0xf365('0x7f'))][(_0xf365('0x80'))](_0xf365('0x90'));}if(_['isNil'](_0x49725f[_0xf365('0x56')]['to'])){throw new db['Sequelize'][(_0xf365('0x80'))](_0xf365('0xad'));}_0x3a069d=_0x49725f[_0xf365('0x56')]['to'];return db[_0xf365('0x3a')][_0xf365('0x54')]({'where':{'id':_0x49725f['params']['id']},'include':[{'model':db[_0xf365('0x95')],'as':'List','include':[{'model':db[_0xf365('0x7e')],'as':_0xf365('0x96'),'where':{'mobile':_0x3a069d},'limit':0x1,'order':[[_0xf365('0x83'),_0xf365('0xae')]]}]}]})[_0xf365('0x2f')](handleEntityNotFound(_0x5a1745,null))[_0xf365('0x2f')](function(_0xa6d071){if(_0xa6d071&&_0xa6d071['List']){_0x292a99=_0xa6d071[_0xf365('0x30')]({'plain':!![]});if(_0x292a99[_0xf365('0xaf')]&&_0x292a99[_0xf365('0xaf')][_0xf365('0x96')][_0xf365('0x42')]){return _0x292a99[_0xf365('0xaf')]['Contacts'][0x0];}return db[_0xf365('0x7e')]['create'](_[_0xf365('0x97')](_0x49725f[_0xf365('0x56')],{'firstName':_0x3a069d,'mobile':_0x3a069d,'phone':_0x3a069d,'ListId':_0x292a99[_0xf365('0x86')]}));}})[_0xf365('0x2f')](handleEntityNotFound(_0x5a1745,null))[_0xf365('0x2f')](function(_0x15b5d1){if(_0x15b5d1){_0x14de2a=_0x15b5d1;return db[_0xf365('0x99')][_0xf365('0x54')]({'where':{'ContactId':_0x14de2a['id'],'closed':![],'WhatsappAccountId':_0x292a99['id']}})[_0xf365('0x2f')](function(_0x390ee8){if(_0x390ee8){return[_0x390ee8,![]];}return db['WhatsappInteraction'][_0xf365('0x55')]({'UserId':_0x49725f[_0xf365('0x59')]['id'],'ContactId':_0x14de2a['id'],'WhatsappAccountId':_0x292a99['id'],'phone':_0x3a069d,'firstMsgDirection':_0xf365('0xb0'),'Messages':[_[_0xf365('0x49')](_0x49725f['body'],{'read':![],'body':_0x49725f['body'][_0xf365('0x56')],'phone':_0x3a069d,'WhatsappAccountId':_0x292a99['id'],'UserId':_0x49725f['user']['id'],'ContactId':_0x14de2a['id']})]},{'include':[{'model':db[_0xf365('0xb1')],'as':'Messages'}]})[_0xf365('0x2f')](function(_0x3be878){return[_0x3be878,!![]];});});}})['spread'](function(_0x3dd2f9,_0x442270){if(_0x442270){return _0x3dd2f9;}return db[_0xf365('0xb1')]['create'](_[_0xf365('0x49')](_0x49725f[_0xf365('0x56')],{'read':![],'body':_0x49725f[_0xf365('0x56')][_0xf365('0x56')],'phone':_0x3a069d,'WhatsappAccountId':_0x292a99['id'],'WhatsappInteractionId':_0x3dd2f9['id'],'UserId':_0x49725f[_0xf365('0x59')]['id'],'ContactId':_0x14de2a['id']}))[_0xf365('0x2f')](function(_0x4c0924){_0x3dd2f9[_0xf365('0xb2')][_0xf365('0xb3')]=[];_0x3dd2f9['dataValues']['Messages']['push'](_0x4c0924[_0xf365('0xb2')]);return _0x3dd2f9;});})[_0xf365('0x2f')](respondWithResult(_0x5a1745,null))[_0xf365('0x25')](handleError(_0x5a1745,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index bb2170f..76a471a 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 _0xee3c=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xee3c,0x14a));var _0xcee3=function(_0x22f69d,_0x29d12d){_0x22f69d=_0x22f69d-0x0;var _0x2b73dd=_0xee3c[_0x22f69d];return _0x2b73dd;};'use strict';var EventEmitter=require(_0xcee3('0x0'));var WhatsappAccount=require(_0xcee3('0x1'))['db'][_0xcee3('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xcee3('0x3')](0x0);var events={'afterCreate':_0xcee3('0x4'),'afterUpdate':_0xcee3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a7681){return function(_0x435892,_0x4cd398,_0x39d2a8){WhatsappAccountEvents[_0xcee3('0x6')](_0x4a7681+':'+_0x435892['id'],_0x435892);WhatsappAccountEvents[_0xcee3('0x6')](_0x4a7681,_0x435892);_0x39d2a8(null);};}for(var e in events){if(events[_0xcee3('0x7')](e)){var event=events[e];WhatsappAccount[_0xcee3('0x8')](e,emitEvent(event));}}module[_0xcee3('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc1c6=['../../mysqldb','WhatsappAccount','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x3e3d3c,_0x18a556){var _0x580889=function(_0xa53e17){while(--_0xa53e17){_0x3e3d3c['push'](_0x3e3d3c['shift']());}};_0x580889(++_0x18a556);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4ba537,_0x1e9e6f){_0x4ba537=_0x4ba537-0x0;var _0x418836=_0xc1c6[_0x4ba537];return _0x418836;};'use strict';var EventEmitter=require(_0x6c1c('0x0'));var WhatsappAccount=require(_0x6c1c('0x1'))['db'][_0x6c1c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c1c('0x3'),'afterUpdate':'update','afterDestroy':_0x6c1c('0x4')};function emitEvent(_0x40ff59){return function(_0x265d2c,_0x59f799,_0x56ed6f){WhatsappAccountEvents[_0x6c1c('0x5')](_0x40ff59+':'+_0x265d2c['id'],_0x265d2c);WhatsappAccountEvents['emit'](_0x40ff59,_0x265d2c);_0x56ed6f(null);};}for(var e in events){if(events[_0x6c1c('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x6c1c('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index caf606e..250e101 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 _0xb876=['request-promise','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x388f3c,_0x41a582){var _0x53f2bd=function(_0x44ab18){while(--_0x44ab18){_0x388f3c['push'](_0x388f3c['shift']());}};_0x53f2bd(++_0x41a582);}(_0xb876,0x115));var _0x6b87=function(_0x5c247a,_0x5e506f){_0x5c247a=_0x5c247a-0x0;var _0x325656=_0xb876[_0x5c247a];return _0x325656;};'use strict';var _=require(_0x6b87('0x0'));var util=require(_0x6b87('0x1'));var logger=require(_0x6b87('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b87('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b87('0x4'));var attributes=require(_0x6b87('0x5'));module['exports']=function(_0x34173c,_0x48f4dc){return _0x34173c['define'](_0x6b87('0x6'),attributes,{'tableName':_0x6b87('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcda=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports','define'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xdcda,0x178));var _0xadcd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdcda[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var logger=require(_0xadcd('0x2'))(_0xadcd('0x3'));var moment=require(_0xadcd('0x4'));var BPromise=require('bluebird');var rp=require(_0xadcd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadcd('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0xadcd('0x7')]=function(_0x5d7c59,_0x1882c1){return _0x5d7c59[_0xadcd('0x8')](_0xadcd('0x9'),attributes,{'tableName':_0xadcd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index c8c9b66..a4b3115 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 _0xee5b=['WhatsappAccount','find','raw','options','where','attributes','include','map','model','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowWhatsappAccount'];(function(_0x20ee11,_0x2972e9){var _0x408a73=function(_0x557afd){while(--_0x557afd){_0x20ee11['push'](_0x20ee11['shift']());}};_0x408a73(++_0x2972e9);}(_0xee5b,0x1f4));var _0xbee5=function(_0x147e9e,_0xf2d7b6){_0x147e9e=_0x147e9e-0x0;var _0x355a6f=_0xee5b[_0x147e9e];return _0x355a6f;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});config[_0xbee5('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbee5('0xb'))[_0xbee5('0xc')](socket);function respondWithRpcPromise(_0x45c2c7,_0x20f717,_0x4a15bf){return new BPromise(function(_0x143bd6,_0x305921){return client[_0xbee5('0xd')](_0x45c2c7,_0x4a15bf)[_0xbee5('0xe')](function(_0x16377d){logger[_0xbee5('0xf')](_0xbee5('0x10'),_0x20f717,_0xbee5('0x11'));logger[_0xbee5('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x20f717,_0xbee5('0x11'),JSON['stringify'](_0x16377d));if(_0x16377d[_0xbee5('0x13')]){if(_0x16377d[_0xbee5('0x13')][_0xbee5('0x14')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x20f717,_0x16377d[_0xbee5('0x13')]['message']);return _0x305921(_0x16377d[_0xbee5('0x13')]['message']);}logger[_0xbee5('0x13')](_0xbee5('0x10'),_0x20f717,_0x16377d[_0xbee5('0x13')]['message']);return _0x143bd6(_0x16377d[_0xbee5('0x13')][_0xbee5('0x15')]);}else{logger['info'](_0xbee5('0x10'),_0x20f717,_0xbee5('0x11'));_0x143bd6(_0x16377d[_0xbee5('0x16')][_0xbee5('0x15')]);}})[_0xbee5('0x17')](function(_0xac51f5){logger[_0xbee5('0x13')](_0xbee5('0x10'),_0x20f717,_0xac51f5);_0x305921(_0xac51f5);});});}exports[_0xbee5('0x18')]=function(_0x3f7286){var _0x3d49b0=this;return new Promise(function(_0x117f10,_0x35d7d3){return db[_0xbee5('0x19')][_0xbee5('0x1a')]({'raw':_0x3f7286['options']?_0x3f7286['options'][_0xbee5('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f7286['options']?_0x3f7286[_0xbee5('0x1c')][_0xbee5('0x1d')]||null:null,'attributes':_0x3f7286[_0xbee5('0x1c')]?_0x3f7286[_0xbee5('0x1c')][_0xbee5('0x1e')]||null:null,'include':_0x3f7286[_0xbee5('0x1c')]?_0x3f7286[_0xbee5('0x1c')][_0xbee5('0x1f')]?_[_0xbee5('0x20')](_0x3f7286['options']['include'],function(_0x5d9195){return{'model':db[_0x5d9195['model']],'as':_0x5d9195['as'],'attributes':_0x5d9195['attributes'],'include':_0x5d9195[_0xbee5('0x1f')]?_[_0xbee5('0x20')](_0x5d9195[_0xbee5('0x1f')],function(_0x28c74d){return{'model':db[_0x28c74d[_0xbee5('0x21')]],'as':_0x28c74d['as'],'attributes':_0x28c74d[_0xbee5('0x1e')],'include':_0x28c74d[_0xbee5('0x1f')]?_['map'](_0x28c74d[_0xbee5('0x1f')],function(_0x402bc4){return{'model':db[_0x402bc4[_0xbee5('0x21')]],'as':_0x402bc4['as'],'attributes':_0x402bc4[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbee5('0xe')](function(_0x5f0419){logger[_0xbee5('0xf')](_0xbee5('0x18'),_0x3f7286);logger[_0xbee5('0x12')](_0xbee5('0x18'),_0x3f7286,JSON[_0xbee5('0x22')](_0x5f0419));_0x117f10(_0x5f0419);})[_0xbee5('0x17')](function(_0x34b7df){logger[_0xbee5('0x13')](_0xbee5('0x18'),_0x34b7df['message'],_0x3f7286);_0x35d7d3(_0x3d49b0[_0xbee5('0x13')](0x1f4,_0x34b7df['message']));});});}; \ No newline at end of file +var _0x5566=['error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','model','map','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf9ea10,_0x4ed7c1){var _0x5075e1=function(_0x3a5916){while(--_0x3a5916){_0xf9ea10['push'](_0xf9ea10['shift']());}};_0x5075e1(++_0x4ed7c1);}(_0x5566,0x179));var _0x6556=function(_0x822939,_0x34bc67){_0x822939=_0x822939-0x0;var _0x476773=_0x5566[_0x822939];return _0x476773;};'use strict';var _=require(_0x6556('0x0'));var util=require('util');var moment=require(_0x6556('0x1'));var BPromise=require(_0x6556('0x2'));var rs=require(_0x6556('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6556('0x4'))['db'];var utils=require(_0x6556('0x5'));var logger=require('../../config/logger')(_0x6556('0x6'));var config=require(_0x6556('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6556('0x8')][_0x6556('0x9')]({'port':0x232a});config[_0x6556('0xa')]=_['defaults'](config[_0x6556('0xa')],{'host':_0x6556('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6556('0xa')]));require(_0x6556('0xc'))['register'](socket);function respondWithRpcPromise(_0x4c7fef,_0xd35046,_0xd3184f){return new BPromise(function(_0x455b01,_0x227924){return client[_0x6556('0xd')](_0x4c7fef,_0xd3184f)[_0x6556('0xe')](function(_0x9703d0){logger[_0x6556('0xf')](_0x6556('0x10'),_0xd35046,_0x6556('0x11'));logger[_0x6556('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xd35046,_0x6556('0x11'),JSON['stringify'](_0x9703d0));if(_0x9703d0[_0x6556('0x13')]){if(_0x9703d0[_0x6556('0x13')][_0x6556('0x14')]===0x1f4){logger[_0x6556('0x13')](_0x6556('0x10'),_0xd35046,_0x9703d0['error'][_0x6556('0x15')]);return _0x227924(_0x9703d0[_0x6556('0x13')][_0x6556('0x15')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xd35046,_0x9703d0[_0x6556('0x13')][_0x6556('0x15')]);return _0x455b01(_0x9703d0[_0x6556('0x13')][_0x6556('0x15')]);}else{logger[_0x6556('0xf')](_0x6556('0x10'),_0xd35046,_0x6556('0x11'));_0x455b01(_0x9703d0['result'][_0x6556('0x15')]);}})[_0x6556('0x16')](function(_0x31b919){logger[_0x6556('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xd35046,_0x31b919);_0x227924(_0x31b919);});});}exports[_0x6556('0x17')]=function(_0x43623c){var _0x574cef=this;return new Promise(function(_0x110b13,_0x3438aa){return db[_0x6556('0x18')][_0x6556('0x19')]({'raw':_0x43623c[_0x6556('0x1a')]?_0x43623c[_0x6556('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x43623c['options']?_0x43623c[_0x6556('0x1a')][_0x6556('0x1b')]||null:null,'attributes':_0x43623c[_0x6556('0x1a')]?_0x43623c['options'][_0x6556('0x1c')]||null:null,'include':_0x43623c['options']?_0x43623c[_0x6556('0x1a')][_0x6556('0x1d')]?_['map'](_0x43623c[_0x6556('0x1a')][_0x6556('0x1d')],function(_0x206dd4){return{'model':db[_0x206dd4[_0x6556('0x1e')]],'as':_0x206dd4['as'],'attributes':_0x206dd4[_0x6556('0x1c')],'include':_0x206dd4[_0x6556('0x1d')]?_[_0x6556('0x1f')](_0x206dd4[_0x6556('0x1d')],function(_0x112071){return{'model':db[_0x112071['model']],'as':_0x112071['as'],'attributes':_0x112071[_0x6556('0x1c')],'include':_0x112071[_0x6556('0x1d')]?_[_0x6556('0x1f')](_0x112071[_0x6556('0x1d')],function(_0xe393cc){return{'model':db[_0xe393cc['model']],'as':_0xe393cc['as'],'attributes':_0xe393cc[_0x6556('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6556('0xe')](function(_0x26d360){logger[_0x6556('0xf')](_0x6556('0x17'),_0x43623c);logger[_0x6556('0x12')](_0x6556('0x17'),_0x43623c,JSON[_0x6556('0x20')](_0x26d360));_0x110b13(_0x26d360);})[_0x6556('0x16')](function(_0x296794){logger[_0x6556('0x13')](_0x6556('0x17'),_0x296794[_0x6556('0x15')],_0x43623c);_0x3438aa(_0x574cef['error'](0x1f4,_0x296794['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index da53a80..443574b 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 _0xeb86=['removeListener','register','whatsappAccount:','save','update','emit'];(function(_0x23a16b,_0x272dce){var _0x4aa838=function(_0x5a8220){while(--_0x5a8220){_0x23a16b['push'](_0x23a16b['shift']());}};_0x4aa838(++_0x272dce);}(_0xeb86,0x159));var _0x6eb8=function(_0x4117e0,_0x49da08){_0x4117e0=_0x4117e0-0x0;var _0x28ab26=_0xeb86[_0x4117e0];return _0x28ab26;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x6eb8('0x0'),'remove',_0x6eb8('0x1')];function createListener(_0x4f5d31,_0x4db5af){return function(_0x457efc){_0x4db5af[_0x6eb8('0x2')](_0x4f5d31,_0x457efc);};}function removeListener(_0x3be2be,_0x1b72dd){return function(){WhatsappAccountEvents[_0x6eb8('0x3')](_0x3be2be,_0x1b72dd);};}exports[_0x6eb8('0x4')]=function(_0x19b073){for(var _0x2502f0=0x0,_0x249646=events['length'];_0x2502f0<_0x249646;_0x2502f0++){var _0x3cb36f=events[_0x2502f0];var _0x1012db=createListener(_0x6eb8('0x5')+_0x3cb36f,_0x19b073);WhatsappAccountEvents['on'](_0x3cb36f,_0x1012db);}}; \ No newline at end of file +var _0x9928=['./whatsappAccount.events','update','emit','removeListener','register'];(function(_0x3b4374,_0x5ad6d2){var _0x30eec7=function(_0x5a1943){while(--_0x5a1943){_0x3b4374['push'](_0x3b4374['shift']());}};_0x30eec7(++_0x5ad6d2);}(_0x9928,0x14f));var _0x8992=function(_0x24a711,_0x2c44e7){_0x24a711=_0x24a711-0x0;var _0x24dad5=_0x9928[_0x24a711];return _0x24dad5;};'use strict';var WhatsappAccountEvents=require(_0x8992('0x0'));var events=['save','remove',_0x8992('0x1')];function createListener(_0x42d570,_0x2b4af2){return function(_0x7f8b8a){_0x2b4af2[_0x8992('0x2')](_0x42d570,_0x7f8b8a);};}function removeListener(_0x53f13d,_0x462e7f){return function(){WhatsappAccountEvents[_0x8992('0x3')](_0x53f13d,_0x462e7f);};}exports[_0x8992('0x4')]=function(_0x5afe38){for(var _0x12b126=0x0,_0x151113=events['length'];_0x12b126<_0x151113;_0x12b126++){var _0x3291e3=events[_0x12b126];var _0xf8ba94=createListener('whatsappAccount:'+_0x3291e3,_0x5afe38);WhatsappAccountEvents['on'](_0x3291e3,_0xf8ba94);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0320ac1..5b6b980 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 _0x1c8a=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','create','put','/:id'];(function(_0x57ed4d,_0x5b6fda){var _0xc3b78d=function(_0x4346cd){while(--_0x4346cd){_0x57ed4d['push'](_0x57ed4d['shift']());}};_0xc3b78d(++_0x5b6fda);}(_0x1c8a,0x1a5));var _0xa1c8=function(_0x1a4a30,_0x106a2e){_0x1a4a30=_0x1a4a30-0x0;var _0x387267=_0x1c8a[_0x1a4a30];return _0x387267;};'use strict';var multer=require(_0xa1c8('0x0'));var util=require(_0xa1c8('0x1'));var path=require(_0xa1c8('0x2'));var timeout=require(_0xa1c8('0x3'));var express=require(_0xa1c8('0x4'));var router=express[_0xa1c8('0x5')]();var auth=require(_0xa1c8('0x6'));var interaction=require(_0xa1c8('0x7'));var config=require(_0xa1c8('0x8'));var controller=require('./whatsappApplication.controller');router[_0xa1c8('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1c8('0xa')]);router[_0xa1c8('0x9')]('/:id',auth[_0xa1c8('0xb')](),controller['show']);router[_0xa1c8('0xc')]('/',auth[_0xa1c8('0xb')](),controller[_0xa1c8('0xd')]);router[_0xa1c8('0xe')](_0xa1c8('0xf'),auth[_0xa1c8('0xb')](),controller['update']);router[_0xa1c8('0x10')](_0xa1c8('0xf'),auth[_0xa1c8('0xb')](),controller[_0xa1c8('0x11')]);module[_0xa1c8('0x12')]=router; \ No newline at end of file +var _0xac6c=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0xac6c,0x143));var _0xcac6=function(_0x1fec67,_0x1e1297){_0x1fec67=_0x1fec67-0x0;var _0x4661b6=_0xac6c[_0x1fec67];return _0x4661b6;};'use strict';var multer=require(_0xcac6('0x0'));var util=require(_0xcac6('0x1'));var path=require('path');var timeout=require(_0xcac6('0x2'));var express=require(_0xcac6('0x3'));var router=express['Router']();var auth=require(_0xcac6('0x4'));var interaction=require(_0xcac6('0x5'));var config=require(_0xcac6('0x6'));var controller=require('./whatsappApplication.controller');router[_0xcac6('0x7')]('/',auth[_0xcac6('0x8')](),controller[_0xcac6('0x9')]);router[_0xcac6('0x7')](_0xcac6('0xa'),auth[_0xcac6('0x8')](),controller[_0xcac6('0xb')]);router[_0xcac6('0xc')]('/',auth[_0xcac6('0x8')](),controller[_0xcac6('0xd')]);router[_0xcac6('0xe')](_0xcac6('0xa'),auth[_0xcac6('0x8')](),controller['update']);router[_0xcac6('0xf')](_0xcac6('0xa'),auth[_0xcac6('0x8')](),controller[_0xcac6('0x10')]);module[_0xcac6('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 e9aa0af..2fff5f1 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 _0xafc9=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x358205,_0x3d6a2a){var _0x3b4ef4=function(_0x5492a1){while(--_0x5492a1){_0x358205['push'](_0x358205['shift']());}};_0x3b4ef4(++_0x3d6a2a);}(_0xafc9,0xa1));var _0x9afc=function(_0xfc2238,_0x1d2ea0){_0xfc2238=_0xfc2238-0x0;var _0x1972e2=_0xafc9[_0xfc2238];return _0x1972e2;};'use strict';var Sequelize=require(_0x9afc('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9afc('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9afc('0x2')},'appdata':{'type':Sequelize[_0x9afc('0x3')]()},'description':{'type':Sequelize[_0x9afc('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9afc('0x5')}}; \ No newline at end of file +var _0x58fa=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4752e0,_0x32291e){var _0x586fbc=function(_0x14a2da){while(--_0x14a2da){_0x4752e0['push'](_0x4752e0['shift']());}};_0x586fbc(++_0x32291e);}(_0x58fa,0x129));var _0xa58f=function(_0x1f0b33,_0x108113){_0x1f0b33=_0x1f0b33-0x0;var _0x53ebd8=_0x58fa[_0x1f0b33];return _0x53ebd8;};'use strict';var Sequelize=require(_0xa58f('0x0'));module[_0xa58f('0x1')]={'priority':{'type':Sequelize[_0xa58f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa58f('0x3')],'allowNull':![],'defaultValue':_0xa58f('0x4')},'appdata':{'type':Sequelize[_0xa58f('0x5')]()},'description':{'type':Sequelize[_0xa58f('0x3')]},'interval':{'type':Sequelize[_0xa58f('0x3')],'defaultValue':_0xa58f('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 91503f9..54beb44 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 _0xe1f2=['sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','error','stack','name','index','map','WhatsappApplication','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','then','include','findAll','rows','show','length','find','catch','create','body','params','destroy','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0xe1f2,0x1a3));var _0x2e1f=function(_0x2498b5,_0x514ddb){_0x2498b5=_0x2498b5-0x0;var _0x5c48d8=_0xe1f2[_0x2498b5];return _0x5c48d8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2e1f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e1f('0x1'));var rp=require(_0x2e1f('0x2'));var moment=require('moment');var BPromise=require(_0x2e1f('0x3'));var Mustache=require(_0x2e1f('0x4'));var util=require(_0x2e1f('0x5'));var path=require(_0x2e1f('0x6'));var sox=require(_0x2e1f('0x7'));var csv=require(_0x2e1f('0x8'));var ejs=require(_0x2e1f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2e1f('0xa'));var crypto=require(_0x2e1f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2e1f('0x8'));var querystring=require(_0x2e1f('0xc'));var Papa=require(_0x2e1f('0xd'));var Redis=require(_0x2e1f('0xe'));var authService=require(_0x2e1f('0xf'));var qs=require(_0x2e1f('0x10'));var as=require(_0x2e1f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e1f('0x12'))('api');var utils=require(_0x2e1f('0x13'));var config=require(_0x2e1f('0x14'));var licenseUtil=require(_0x2e1f('0x15'));var db=require(_0x2e1f('0x16'))['db'];function respondWithStatusCode(_0x39d387,_0x6ba396){_0x6ba396=_0x6ba396||0xcc;return function(_0x2f9891){if(_0x2f9891){return _0x39d387[_0x2e1f('0x17')](_0x6ba396);}return _0x39d387[_0x2e1f('0x18')](_0x6ba396)[_0x2e1f('0x19')]();};}function respondWithResult(_0x4c2102,_0x4fb134){_0x4fb134=_0x4fb134||0xc8;return function(_0x47b7db){if(_0x47b7db){return _0x4c2102['status'](_0x4fb134)[_0x2e1f('0x1a')](_0x47b7db);}};}function respondWithFilteredResult(_0x22a881,_0x4ce80a){return function(_0x2c16d9){if(_0x2c16d9){var _0x47e62c=_0x2c16d9[_0x2e1f('0x1b')],_0x11bd23=_0x4ce80a[_0x2e1f('0x1c')],_0x1e134c=_0x4ce80a['offset']+_0x4ce80a[_0x2e1f('0x1d')],_0xc31bf9;if(_0x1e134c>=_0x47e62c){_0x1e134c=_0x47e62c;_0xc31bf9=0xc8;}else{_0xc31bf9=0xce;}_0x22a881[_0x2e1f('0x18')](_0xc31bf9);return _0x22a881[_0x2e1f('0x1e')](_0x2e1f('0x1f'),_0x11bd23+'-'+_0x1e134c+'/'+_0x47e62c)[_0x2e1f('0x1a')](_0x2c16d9);}return null;};}function patchUpdates(_0x741a97){return function(_0x40f917){try{jsonpatch[_0x2e1f('0x20')](_0x40f917,_0x741a97,!![]);}catch(_0x37ccb1){return BPromise[_0x2e1f('0x21')](_0x37ccb1);}return _0x40f917[_0x2e1f('0x22')]();};}function saveUpdates(_0x37c01a,_0x3512c8){return function(_0x4af1e4){if(_0x4af1e4){return _0x4af1e4[_0x2e1f('0x23')](_0x37c01a)['then'](function(_0x23b8ed){return _0x23b8ed;});}return null;};}function removeEntity(_0x4f91bb,_0x259fba){return function(_0x251adc){if(_0x251adc){return _0x251adc['destroy']()['then'](function(){_0x4f91bb[_0x2e1f('0x18')](0xcc)[_0x2e1f('0x19')]();});}};}function handleEntityNotFound(_0x5064e3,_0x3f7b7d){return function(_0x33ce04){if(!_0x33ce04){_0x5064e3[_0x2e1f('0x17')](0x194);}return _0x33ce04;};}function handleError(_0x3ac9ec,_0x1795ff){_0x1795ff=_0x1795ff||0x1f4;return function(_0x42c1bb){logger[_0x2e1f('0x24')](_0x42c1bb[_0x2e1f('0x25')]);if(_0x42c1bb[_0x2e1f('0x26')]){delete _0x42c1bb[_0x2e1f('0x26')];}_0x3ac9ec[_0x2e1f('0x18')](_0x1795ff)['send'](_0x42c1bb);};}exports[_0x2e1f('0x27')]=function(_0x454362,_0x416c0c){var _0x520a6f={},_0x4d5485={},_0x5ef3df={'count':0x0,'rows':[]};var _0x1fbf15=_[_0x2e1f('0x28')](db[_0x2e1f('0x29')][_0x2e1f('0x2a')],function(_0x1bfff5){return{'name':_0x1bfff5['fieldName'],'type':_0x1bfff5['type']['key']};});_0x4d5485[_0x2e1f('0x2b')]=_['map'](_0x1fbf15,_0x2e1f('0x26'));_0x4d5485[_0x2e1f('0x2c')]=_[_0x2e1f('0x2d')](_0x454362['query']);_0x4d5485[_0x2e1f('0x2e')]=_[_0x2e1f('0x2f')](_0x4d5485[_0x2e1f('0x2b')],_0x4d5485[_0x2e1f('0x2c')]);_0x520a6f[_0x2e1f('0x30')]=_[_0x2e1f('0x2f')](_0x4d5485[_0x2e1f('0x2b')],qs[_0x2e1f('0x31')](_0x454362['query'][_0x2e1f('0x31')]));_0x520a6f[_0x2e1f('0x30')]=_0x520a6f['attributes']['length']?_0x520a6f['attributes']:_0x4d5485[_0x2e1f('0x2b')];if(!_0x454362[_0x2e1f('0x2c')][_0x2e1f('0x32')](_0x2e1f('0x33'))){_0x520a6f[_0x2e1f('0x1d')]=qs['limit'](_0x454362[_0x2e1f('0x2c')][_0x2e1f('0x1d')]);_0x520a6f[_0x2e1f('0x1c')]=qs[_0x2e1f('0x1c')](_0x454362[_0x2e1f('0x2c')][_0x2e1f('0x1c')]);}_0x520a6f[_0x2e1f('0x34')]=qs['sort'](_0x454362['query']['sort']);_0x520a6f[_0x2e1f('0x35')]=qs[_0x2e1f('0x2e')](_[_0x2e1f('0x36')](_0x454362['query'],_0x4d5485['filters']),_0x1fbf15);if(_0x454362[_0x2e1f('0x2c')][_0x2e1f('0x37')]){_0x520a6f[_0x2e1f('0x35')]=_[_0x2e1f('0x38')](_0x520a6f[_0x2e1f('0x35')],{'$or':_[_0x2e1f('0x28')](_0x1fbf15,function(_0x37ab20){if(_0x37ab20[_0x2e1f('0x39')]!=='VIRTUAL'){var _0x29069b={};_0x29069b[_0x37ab20[_0x2e1f('0x26')]]={'$like':'%'+_0x454362[_0x2e1f('0x2c')][_0x2e1f('0x37')]+'%'};return _0x29069b;}})});}_0x520a6f=_[_0x2e1f('0x38')]({},_0x520a6f,_0x454362[_0x2e1f('0x3a')]);var _0x12b73e={'where':_0x520a6f['where']};return db[_0x2e1f('0x29')][_0x2e1f('0x1b')](_0x12b73e)[_0x2e1f('0x3b')](function(_0xf3adfe){_0x5ef3df[_0x2e1f('0x1b')]=_0xf3adfe;if(_0x454362[_0x2e1f('0x2c')]['includeAll']){_0x520a6f[_0x2e1f('0x3c')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2e1f('0x3d')](_0x520a6f);})[_0x2e1f('0x3b')](function(_0x1bf560){_0x5ef3df[_0x2e1f('0x3e')]=_0x1bf560;return _0x5ef3df;})[_0x2e1f('0x3b')](respondWithFilteredResult(_0x416c0c,_0x520a6f))['catch'](handleError(_0x416c0c,null));};exports[_0x2e1f('0x3f')]=function(_0x51c1fa,_0x509944){var _0x324cb8={'raw':!![],'where':{'id':_0x51c1fa['params']['id']}},_0x2d3945={};_0x2d3945[_0x2e1f('0x2b')]=_[_0x2e1f('0x2d')](db['WhatsappApplication'][_0x2e1f('0x2a')]);_0x2d3945[_0x2e1f('0x2c')]=_[_0x2e1f('0x2d')](_0x51c1fa[_0x2e1f('0x2c')]);_0x2d3945[_0x2e1f('0x2e')]=_[_0x2e1f('0x2f')](_0x2d3945['model'],_0x2d3945[_0x2e1f('0x2c')]);_0x324cb8['attributes']=_['intersection'](_0x2d3945[_0x2e1f('0x2b')],qs['fields'](_0x51c1fa[_0x2e1f('0x2c')][_0x2e1f('0x31')]));_0x324cb8['attributes']=_0x324cb8['attributes'][_0x2e1f('0x40')]?_0x324cb8[_0x2e1f('0x30')]:_0x2d3945[_0x2e1f('0x2b')];if(_0x51c1fa['query']['includeAll']){_0x324cb8['include']=[{'all':!![]}];}_0x324cb8=_['merge']({},_0x324cb8,_0x51c1fa[_0x2e1f('0x3a')]);return db[_0x2e1f('0x29')][_0x2e1f('0x41')](_0x324cb8)['then'](handleEntityNotFound(_0x509944,null))[_0x2e1f('0x3b')](respondWithResult(_0x509944,null))[_0x2e1f('0x42')](handleError(_0x509944,null));};exports['create']=function(_0x3997dc,_0x5bb6eb){return db[_0x2e1f('0x29')][_0x2e1f('0x43')](_0x3997dc[_0x2e1f('0x44')],{})[_0x2e1f('0x3b')](respondWithResult(_0x5bb6eb,0xc9))[_0x2e1f('0x42')](handleError(_0x5bb6eb,null));};exports[_0x2e1f('0x23')]=function(_0x5b1da6,_0x37e6ab){if(_0x5b1da6['body']['id']){delete _0x5b1da6[_0x2e1f('0x44')]['id'];}return db[_0x2e1f('0x29')][_0x2e1f('0x41')]({'where':{'id':_0x5b1da6[_0x2e1f('0x45')]['id']}})[_0x2e1f('0x3b')](handleEntityNotFound(_0x37e6ab,null))['then'](saveUpdates(_0x5b1da6['body'],null))['then'](respondWithResult(_0x37e6ab,null))[_0x2e1f('0x42')](handleError(_0x37e6ab,null));};exports[_0x2e1f('0x46')]=function(_0x54127d,_0x479d32){return db[_0x2e1f('0x29')][_0x2e1f('0x41')]({'where':{'id':_0x54127d[_0x2e1f('0x45')]['id']}})['then'](handleEntityNotFound(_0x479d32,null))[_0x2e1f('0x3b')](removeEntity(_0x479d32,null))[_0x2e1f('0x42')](handleError(_0x479d32,null));}; \ No newline at end of file +var _0x2cf8=['offset','limit','status','set','Content-Range','json','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','WhatsappApplication','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x2516ba,_0x13577f){var _0x5bacf8=function(_0x198f9c){while(--_0x198f9c){_0x2516ba['push'](_0x2516ba['shift']());}};_0x5bacf8(++_0x13577f);}(_0x2cf8,0x7b));var _0x82cf=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x2cf8[_0x3d4876];return _0x58ca9d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x82cf('0x0'));var zipdir=require(_0x82cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82cf('0x2'));var moment=require('moment');var BPromise=require(_0x82cf('0x3'));var Mustache=require(_0x82cf('0x4'));var util=require(_0x82cf('0x5'));var path=require(_0x82cf('0x6'));var sox=require(_0x82cf('0x7'));var csv=require('to-csv');var ejs=require(_0x82cf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x82cf('0x9'));var crypto=require(_0x82cf('0xa'));var jsforce=require(_0x82cf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x82cf('0xc'));var Papa=require(_0x82cf('0xd'));var Redis=require(_0x82cf('0xe'));var authService=require(_0x82cf('0xf'));var qs=require(_0x82cf('0x10'));var as=require(_0x82cf('0x11'));var hardwareService=require(_0x82cf('0x12'));var logger=require('../../config/logger')(_0x82cf('0x13'));var utils=require(_0x82cf('0x14'));var config=require(_0x82cf('0x15'));var licenseUtil=require(_0x82cf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d5a42,_0x4e047f){_0x4e047f=_0x4e047f||0xcc;return function(_0x23502a){if(_0x23502a){return _0x5d5a42[_0x82cf('0x17')](_0x4e047f);}return _0x5d5a42['status'](_0x4e047f)[_0x82cf('0x18')]();};}function respondWithResult(_0x3fdc41,_0x4204a5){_0x4204a5=_0x4204a5||0xc8;return function(_0x48be16){if(_0x48be16){return _0x3fdc41['status'](_0x4204a5)['json'](_0x48be16);}};}function respondWithFilteredResult(_0x42339e,_0x200efa){return function(_0x4eb816){if(_0x4eb816){var _0x1efd50=_0x4eb816['count'],_0x30e6d5=_0x200efa['offset'],_0x2ac2e4=_0x200efa[_0x82cf('0x19')]+_0x200efa[_0x82cf('0x1a')],_0x28378d;if(_0x2ac2e4>=_0x1efd50){_0x2ac2e4=_0x1efd50;_0x28378d=0xc8;}else{_0x28378d=0xce;}_0x42339e[_0x82cf('0x1b')](_0x28378d);return _0x42339e[_0x82cf('0x1c')](_0x82cf('0x1d'),_0x30e6d5+'-'+_0x2ac2e4+'/'+_0x1efd50)[_0x82cf('0x1e')](_0x4eb816);}return null;};}function patchUpdates(_0x53ca23){return function(_0x4b8d36){try{jsonpatch[_0x82cf('0x1f')](_0x4b8d36,_0x53ca23,!![]);}catch(_0x27b703){return BPromise[_0x82cf('0x20')](_0x27b703);}return _0x4b8d36[_0x82cf('0x21')]();};}function saveUpdates(_0x7910a9,_0x3ce295){return function(_0x295cbc){if(_0x295cbc){return _0x295cbc['update'](_0x7910a9)[_0x82cf('0x22')](function(_0x224757){return _0x224757;});}return null;};}function removeEntity(_0x5739aa,_0x1bc1e1){return function(_0x1399c6){if(_0x1399c6){return _0x1399c6['destroy']()[_0x82cf('0x22')](function(){_0x5739aa[_0x82cf('0x1b')](0xcc)[_0x82cf('0x18')]();});}};}function handleEntityNotFound(_0x23c61d,_0xf31c0d){return function(_0x37f2b2){if(!_0x37f2b2){_0x23c61d[_0x82cf('0x17')](0x194);}return _0x37f2b2;};}function handleError(_0x1991d6,_0x4b3647){_0x4b3647=_0x4b3647||0x1f4;return function(_0x438fbb){logger['error'](_0x438fbb[_0x82cf('0x23')]);if(_0x438fbb[_0x82cf('0x24')]){delete _0x438fbb[_0x82cf('0x24')];}_0x1991d6[_0x82cf('0x1b')](_0x4b3647)[_0x82cf('0x25')](_0x438fbb);};}exports[_0x82cf('0x26')]=function(_0x1ea17c,_0xe76321){var _0x41fe5d={},_0x800edd={},_0x580bff={'count':0x0,'rows':[]};var _0x172f70=_[_0x82cf('0x27')](db['WhatsappApplication'][_0x82cf('0x28')],function(_0x553d10){return{'name':_0x553d10[_0x82cf('0x29')],'type':_0x553d10['type'][_0x82cf('0x2a')]};});_0x800edd[_0x82cf('0x2b')]=_['map'](_0x172f70,_0x82cf('0x24'));_0x800edd[_0x82cf('0x2c')]=_[_0x82cf('0x2d')](_0x1ea17c[_0x82cf('0x2c')]);_0x800edd['filters']=_[_0x82cf('0x2e')](_0x800edd[_0x82cf('0x2b')],_0x800edd[_0x82cf('0x2c')]);_0x41fe5d[_0x82cf('0x2f')]=_[_0x82cf('0x2e')](_0x800edd[_0x82cf('0x2b')],qs['fields'](_0x1ea17c['query'][_0x82cf('0x30')]));_0x41fe5d[_0x82cf('0x2f')]=_0x41fe5d[_0x82cf('0x2f')][_0x82cf('0x31')]?_0x41fe5d['attributes']:_0x800edd[_0x82cf('0x2b')];if(!_0x1ea17c[_0x82cf('0x2c')][_0x82cf('0x32')](_0x82cf('0x33'))){_0x41fe5d['limit']=qs['limit'](_0x1ea17c[_0x82cf('0x2c')][_0x82cf('0x1a')]);_0x41fe5d['offset']=qs[_0x82cf('0x19')](_0x1ea17c[_0x82cf('0x2c')][_0x82cf('0x19')]);}_0x41fe5d[_0x82cf('0x34')]=qs[_0x82cf('0x35')](_0x1ea17c[_0x82cf('0x2c')][_0x82cf('0x35')]);_0x41fe5d[_0x82cf('0x36')]=qs[_0x82cf('0x37')](_[_0x82cf('0x38')](_0x1ea17c['query'],_0x800edd[_0x82cf('0x37')]),_0x172f70);if(_0x1ea17c[_0x82cf('0x2c')]['filter']){_0x41fe5d[_0x82cf('0x36')]=_['merge'](_0x41fe5d['where'],{'$or':_[_0x82cf('0x27')](_0x172f70,function(_0x553cee){if(_0x553cee[_0x82cf('0x39')]!==_0x82cf('0x3a')){var _0x50ba21={};_0x50ba21[_0x553cee[_0x82cf('0x24')]]={'$like':'%'+_0x1ea17c['query'][_0x82cf('0x3b')]+'%'};return _0x50ba21;}})});}_0x41fe5d=_[_0x82cf('0x3c')]({},_0x41fe5d,_0x1ea17c[_0x82cf('0x3d')]);var _0x61eb2d={'where':_0x41fe5d[_0x82cf('0x36')]};return db[_0x82cf('0x3e')][_0x82cf('0x3f')](_0x61eb2d)[_0x82cf('0x22')](function(_0x25fac6){_0x580bff[_0x82cf('0x3f')]=_0x25fac6;if(_0x1ea17c[_0x82cf('0x2c')][_0x82cf('0x40')]){_0x41fe5d[_0x82cf('0x41')]=[{'all':!![]}];}return db[_0x82cf('0x3e')][_0x82cf('0x42')](_0x41fe5d);})[_0x82cf('0x22')](function(_0x2a4a95){_0x580bff[_0x82cf('0x43')]=_0x2a4a95;return _0x580bff;})[_0x82cf('0x22')](respondWithFilteredResult(_0xe76321,_0x41fe5d))[_0x82cf('0x44')](handleError(_0xe76321,null));};exports['show']=function(_0x56e8d9,_0x5a4f4a){var _0xc28c54={'raw':!![],'where':{'id':_0x56e8d9[_0x82cf('0x45')]['id']}},_0x27baa3={};_0x27baa3[_0x82cf('0x2b')]=_[_0x82cf('0x2d')](db[_0x82cf('0x3e')]['rawAttributes']);_0x27baa3['query']=_[_0x82cf('0x2d')](_0x56e8d9[_0x82cf('0x2c')]);_0x27baa3['filters']=_[_0x82cf('0x2e')](_0x27baa3['model'],_0x27baa3['query']);_0xc28c54['attributes']=_[_0x82cf('0x2e')](_0x27baa3[_0x82cf('0x2b')],qs[_0x82cf('0x30')](_0x56e8d9['query']['fields']));_0xc28c54[_0x82cf('0x2f')]=_0xc28c54[_0x82cf('0x2f')][_0x82cf('0x31')]?_0xc28c54[_0x82cf('0x2f')]:_0x27baa3[_0x82cf('0x2b')];if(_0x56e8d9[_0x82cf('0x2c')]['includeAll']){_0xc28c54[_0x82cf('0x41')]=[{'all':!![]}];}_0xc28c54=_[_0x82cf('0x3c')]({},_0xc28c54,_0x56e8d9['options']);return db[_0x82cf('0x3e')][_0x82cf('0x46')](_0xc28c54)[_0x82cf('0x22')](handleEntityNotFound(_0x5a4f4a,null))[_0x82cf('0x22')](respondWithResult(_0x5a4f4a,null))['catch'](handleError(_0x5a4f4a,null));};exports[_0x82cf('0x47')]=function(_0x5e6d30,_0x254878){return db['WhatsappApplication'][_0x82cf('0x47')](_0x5e6d30[_0x82cf('0x48')],{})[_0x82cf('0x22')](respondWithResult(_0x254878,0xc9))[_0x82cf('0x44')](handleError(_0x254878,null));};exports['update']=function(_0x1e01e3,_0x3b490c){if(_0x1e01e3[_0x82cf('0x48')]['id']){delete _0x1e01e3['body']['id'];}return db[_0x82cf('0x3e')][_0x82cf('0x46')]({'where':{'id':_0x1e01e3[_0x82cf('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b490c,null))[_0x82cf('0x22')](saveUpdates(_0x1e01e3['body'],null))[_0x82cf('0x22')](respondWithResult(_0x3b490c,null))[_0x82cf('0x44')](handleError(_0x3b490c,null));};exports[_0x82cf('0x49')]=function(_0x50fa69,_0x41ffb9){return db[_0x82cf('0x3e')][_0x82cf('0x46')]({'where':{'id':_0x50fa69['params']['id']}})['then'](handleEntityNotFound(_0x41ffb9,null))[_0x82cf('0x22')](removeEntity(_0x41ffb9,null))[_0x82cf('0x44')](handleError(_0x41ffb9,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d9af91f..e159847 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 _0x55a9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5bf000,_0x968b73){var _0x18414f=function(_0x1a99a4){while(--_0x1a99a4){_0x5bf000['push'](_0x5bf000['shift']());}};_0x18414f(++_0x968b73);}(_0x55a9,0x13b));var _0x955a=function(_0x241f95,_0xa356f9){_0x241f95=_0x241f95-0x0;var _0x491124=_0x55a9[_0x241f95];return _0x491124;};'use strict';var _=require(_0x955a('0x0'));var util=require(_0x955a('0x1'));var logger=require(_0x955a('0x2'))(_0x955a('0x3'));var moment=require(_0x955a('0x4'));var BPromise=require(_0x955a('0x5'));var rp=require(_0x955a('0x6'));var fs=require('fs');var path=require(_0x955a('0x7'));var rimraf=require(_0x955a('0x8'));var config=require('../../config/environment');var attributes=require(_0x955a('0x9'));module[_0x955a('0xa')]=function(_0x7d2a9,_0xee264c){return _0x7d2a9[_0x955a('0xb')](_0x955a('0xc'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x955a('0xd'),'collate':_0x955a('0xe')});}; \ No newline at end of file +var _0x3545=['exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path'];(function(_0xbddddb,_0x548ee8){var _0x17bea1=function(_0x30ba9e){while(--_0x30ba9e){_0xbddddb['push'](_0xbddddb['shift']());}};_0x17bea1(++_0x548ee8);}(_0x3545,0x1bd));var _0x5354=function(_0xa46b86,_0x5c1465){_0xa46b86=_0xa46b86-0x0;var _0x417360=_0x3545[_0xa46b86];return _0x417360;};'use strict';var _=require(_0x5354('0x0'));var util=require(_0x5354('0x1'));var logger=require(_0x5354('0x2'))(_0x5354('0x3'));var moment=require(_0x5354('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5354('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0x5354('0x6')]=function(_0x7f7f34,_0x1ae5b3){return _0x7f7f34[_0x5354('0x7')]('WhatsappApplication',attributes,{'tableName':_0x5354('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5354('0x9'),'collate':_0x5354('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f552748..bb41a28 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 _0x37a7=['../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis'];(function(_0x1e85dc,_0x34902c){var _0x41c366=function(_0x31227a){while(--_0x31227a){_0x1e85dc['push'](_0x1e85dc['shift']());}};_0x41c366(++_0x34902c);}(_0x37a7,0x6f));var _0x737a=function(_0x381246,_0x14abc3){_0x381246=_0x381246-0x0;var _0x48c74b=_0x37a7[_0x381246];return _0x48c74b;};'use strict';var _=require(_0x737a('0x0'));var util=require(_0x737a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x737a('0x2'));var db=require(_0x737a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x737a('0x4'));var jayson=require(_0x737a('0x5'));var client=jayson[_0x737a('0x6')][_0x737a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f6800,_0x5cc52c,_0x244850){return new BPromise(function(_0x249898,_0x17c76d){return client[_0x737a('0x8')](_0x2f6800,_0x244850)['then'](function(_0x303f55){logger[_0x737a('0x9')]('WhatsappApplication,\x20%s,\x20%s',_0x5cc52c,_0x737a('0xa'));logger[_0x737a('0xb')](_0x737a('0xc'),_0x5cc52c,_0x737a('0xa'),JSON[_0x737a('0xd')](_0x303f55));if(_0x303f55[_0x737a('0xe')]){if(_0x303f55[_0x737a('0xe')]['code']===0x1f4){logger[_0x737a('0xe')](_0x737a('0xf'),_0x5cc52c,_0x303f55[_0x737a('0xe')][_0x737a('0x10')]);return _0x17c76d(_0x303f55[_0x737a('0xe')][_0x737a('0x10')]);}logger[_0x737a('0xe')](_0x737a('0xf'),_0x5cc52c,_0x303f55['error'][_0x737a('0x10')]);return _0x249898(_0x303f55[_0x737a('0xe')]['message']);}else{logger['info'](_0x737a('0xf'),_0x5cc52c,_0x737a('0xa'));_0x249898(_0x303f55[_0x737a('0x11')][_0x737a('0x10')]);}})[_0x737a('0x12')](function(_0x195749){logger['error'](_0x737a('0xf'),_0x5cc52c,_0x195749);_0x17c76d(_0x195749);});});} \ No newline at end of file +var _0xcf71=['then','WhatsappApplication,\x20%s,\x20%s','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x9365e5,_0x536bd9){var _0x48b631=function(_0x11ad54){while(--_0x11ad54){_0x9365e5['push'](_0x9365e5['shift']());}};_0x48b631(++_0x536bd9);}(_0xcf71,0xba));var _0x1cf7=function(_0x7762d6,_0x1934b7){_0x7762d6=_0x7762d6-0x0;var _0x2627c3=_0xcf71[_0x7762d6];return _0x2627c3;};'use strict';var _=require(_0x1cf7('0x0'));var util=require(_0x1cf7('0x1'));var moment=require(_0x1cf7('0x2'));var BPromise=require(_0x1cf7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cf7('0x4'));var db=require(_0x1cf7('0x5'))['db'];var utils=require(_0x1cf7('0x6'));var logger=require(_0x1cf7('0x7'))(_0x1cf7('0x8'));var config=require(_0x1cf7('0x9'));var jayson=require(_0x1cf7('0xa'));var client=jayson[_0x1cf7('0xb')][_0x1cf7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45ee6b,_0x2de84d,_0x19b626){return new BPromise(function(_0x4f908a,_0x52c8c8){return client[_0x1cf7('0xd')](_0x45ee6b,_0x19b626)[_0x1cf7('0xe')](function(_0x406ba0){logger['info'](_0x1cf7('0xf'),_0x2de84d,'request\x20sent');logger['debug'](_0x1cf7('0x10'),_0x2de84d,_0x1cf7('0x11'),JSON[_0x1cf7('0x12')](_0x406ba0));if(_0x406ba0[_0x1cf7('0x13')]){if(_0x406ba0[_0x1cf7('0x13')][_0x1cf7('0x14')]===0x1f4){logger['error'](_0x1cf7('0xf'),_0x2de84d,_0x406ba0['error'][_0x1cf7('0x15')]);return _0x52c8c8(_0x406ba0['error'][_0x1cf7('0x15')]);}logger[_0x1cf7('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x2de84d,_0x406ba0[_0x1cf7('0x13')][_0x1cf7('0x15')]);return _0x4f908a(_0x406ba0[_0x1cf7('0x13')][_0x1cf7('0x15')]);}else{logger[_0x1cf7('0x16')](_0x1cf7('0xf'),_0x2de84d,_0x1cf7('0x11'));_0x4f908a(_0x406ba0[_0x1cf7('0x17')][_0x1cf7('0x15')]);}})[_0x1cf7('0x18')](function(_0x2a3671){logger[_0x1cf7('0x13')](_0x1cf7('0xf'),_0x2de84d,_0x2a3671);_0x52c8c8(_0x2a3671);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e040e4e..c51a9f0 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 _0xc496=['index','describe','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xc496,0x1d6));var _0x6c49=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0xc496[_0x5aef17];return _0x43f9d0;};'use strict';var multer=require(_0x6c49('0x0'));var util=require(_0x6c49('0x1'));var path=require(_0x6c49('0x2'));var timeout=require(_0x6c49('0x3'));var express=require(_0x6c49('0x4'));var router=express[_0x6c49('0x5')]();var auth=require(_0x6c49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6c49('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x6c49('0x8')]('/',auth[_0x6c49('0x9')](),controller[_0x6c49('0xa')]);router[_0x6c49('0x8')]('/describe',auth[_0x6c49('0x9')](),controller[_0x6c49('0xb')]);router[_0x6c49('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6c49('0xc')]);router[_0x6c49('0x8')](_0x6c49('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x6c49('0x8')](_0x6c49('0xe'),auth[_0x6c49('0x9')](),controller[_0x6c49('0xf')]);router[_0x6c49('0x10')]('/',auth[_0x6c49('0x9')](),controller[_0x6c49('0x11')]);router[_0x6c49('0x10')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x6c49('0x12'),auth[_0x6c49('0x9')](),interaction[_0x6c49('0x13')]('whatsapp',_0x6c49('0x14')),controller[_0x6c49('0x15')]);router[_0x6c49('0x16')](_0x6c49('0x17'),auth[_0x6c49('0x9')](),interaction[_0x6c49('0x13')]('whatsapp','whatsappinteraction:update'),controller[_0x6c49('0x18')]);router[_0x6c49('0x19')]('/:id',auth[_0x6c49('0x9')](),interaction[_0x6c49('0x13')]('whatsapp',_0x6c49('0x1a')),controller[_0x6c49('0x1b')]);router[_0x6c49('0x19')](_0x6c49('0x12'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x1c')]);module[_0x6c49('0x1d')]=router; \ No newline at end of file +var _0x47c2=['whatsapp','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x47c2,0x151));var _0x247c=function(_0x3c4719,_0x3f131e){_0x3c4719=_0x3c4719-0x0;var _0x5611d9=_0x47c2[_0x3c4719];return _0x5611d9;};'use strict';var multer=require('multer');var util=require(_0x247c('0x0'));var path=require(_0x247c('0x1'));var timeout=require(_0x247c('0x2'));var express=require(_0x247c('0x3'));var router=express[_0x247c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x247c('0x5'));var config=require(_0x247c('0x6'));var controller=require(_0x247c('0x7'));router[_0x247c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x247c('0x8')](_0x247c('0x9'),auth[_0x247c('0xa')](),controller[_0x247c('0xb')]);router[_0x247c('0x8')](_0x247c('0xc'),auth[_0x247c('0xa')](),controller[_0x247c('0xd')]);router['get']('/:id/messages',auth[_0x247c('0xa')](),controller[_0x247c('0xe')]);router[_0x247c('0x8')](_0x247c('0xf'),auth[_0x247c('0xa')](),controller[_0x247c('0x10')]);router[_0x247c('0x11')]('/',auth['isAuthenticated'](),controller[_0x247c('0x12')]);router[_0x247c('0x11')](_0x247c('0x13'),auth[_0x247c('0xa')](),controller[_0x247c('0x14')]);router[_0x247c('0x11')](_0x247c('0x15'),auth[_0x247c('0xa')](),interaction[_0x247c('0x16')]('whatsapp',_0x247c('0x17')),controller[_0x247c('0x18')]);router[_0x247c('0x19')](_0x247c('0xc'),auth['isAuthenticated'](),interaction[_0x247c('0x16')](_0x247c('0x1a'),'whatsappinteraction:update'),controller[_0x247c('0x1b')]);router[_0x247c('0x1c')](_0x247c('0xc'),auth[_0x247c('0xa')](),interaction[_0x247c('0x16')](_0x247c('0x1a'),_0x247c('0x1d')),controller[_0x247c('0x1e')]);router[_0x247c('0x1c')]('/:id/tags',auth[_0x247c('0xa')](),controller[_0x247c('0x1f')]);module[_0x247c('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 21bab1e..a87aa42 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 _0x3da4=['STRING','ENUM','out','sequelize','moment','BOOLEAN','DATE'];(function(_0x40eb63,_0x202350){var _0x370c82=function(_0x3a54c6){while(--_0x3a54c6){_0x40eb63['push'](_0x40eb63['shift']());}};_0x370c82(++_0x202350);}(_0x3da4,0xce));var _0x43da=function(_0x21bf4b,_0x1f57d0){_0x21bf4b=_0x21bf4b-0x0;var _0x5964aa=_0x3da4[_0x21bf4b];return _0x5964aa;};'use strict';var Sequelize=require(_0x43da('0x0'));var moment=require(_0x43da('0x1'));module['exports']={'closed':{'type':Sequelize[_0x43da('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x43da('0x3')]},'disposition':{'type':Sequelize[_0x43da('0x4')]},'secondDisposition':{'type':Sequelize[_0x43da('0x4')]},'thirdDisposition':{'type':Sequelize[_0x43da('0x4')]},'note':{'type':Sequelize[_0x43da('0x4')]},'phone':{'type':Sequelize[_0x43da('0x4')]},'read1stAt':{'type':Sequelize[_0x43da('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x43da('0x5')]('in',_0x43da('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x43da('0x5')]('in',_0x43da('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5e24=['STRING','DATE','ENUM','out','moment','BOOLEAN'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x5e24,0xb2));var _0x45e2=function(_0x3d69c1,_0x4be30a){_0x3d69c1=_0x3d69c1-0x0;var _0x31e45c=_0x5e24[_0x3d69c1];return _0x31e45c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x45e2('0x0'));module['exports']={'closed':{'type':Sequelize[_0x45e2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x45e2('0x2')]},'secondDisposition':{'type':Sequelize[_0x45e2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x45e2('0x2')]},'note':{'type':Sequelize[_0x45e2('0x2')]},'phone':{'type':Sequelize[_0x45e2('0x2')]},'read1stAt':{'type':Sequelize[_0x45e2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x45e2('0x4')]('in',_0x45e2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x45e2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x45e2('0x4')]('in','out'),'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 3db490f..3b936fc 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 _0xc2c7=['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','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','show','includeAll','options','create','body','params','describe','addMessage','WhatsappMessage','ids','format','include','findAll','addTags','setTags','omit','spread','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','direction','secret','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','Owner','closedAt','disposition','Messages','basename','existsSync','createReadStream','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','System','renderFile','views','toFile','transcript-','.pdf','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','count','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','then','catch','index','WhatsappInteraction','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.fullname','from','user_has_whatsapp_interactions','users','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','parseSearch','conditions','find','unreadMessages','having','`\x20>\x200','operator','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','Account.key'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3aca76,_0x440d2e){_0x3aca76=_0x3aca76-0x0;var _0x36273a=_0xc2c7[_0x3aca76];return _0x36273a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c2c('0x0'));var rimraf=require(_0x7c2c('0x1'));var zipdir=require(_0x7c2c('0x2'));var jsonpatch=require(_0x7c2c('0x3'));var rp=require(_0x7c2c('0x4'));var moment=require(_0x7c2c('0x5'));var BPromise=require(_0x7c2c('0x6'));var Mustache=require(_0x7c2c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7c2c('0x8'));var csv=require(_0x7c2c('0x9'));var ejs=require(_0x7c2c('0xa'));var fs=require('fs');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('0x9'));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'];config[_0x7c2c('0x19')]=_[_0x7c2c('0x1a')](config[_0x7c2c('0x19')],{'host':_0x7c2c('0x1b'),'port':0x18eb});var socket=require(_0x7c2c('0x1c'))(new Redis(config[_0x7c2c('0x19')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x102778,_0xd1a3db){_0xd1a3db=_0xd1a3db||0xcc;return function(_0x4678a8){if(_0x4678a8){return _0x102778['sendStatus'](_0xd1a3db);}return _0x102778[_0x7c2c('0x1d')](_0xd1a3db)[_0x7c2c('0x1e')]();};}function respondWithResult(_0x5e55e0,_0x88f54b){_0x88f54b=_0x88f54b||0xc8;return function(_0x5a5fe2){if(_0x5a5fe2){return _0x5e55e0[_0x7c2c('0x1d')](_0x88f54b)['json'](_0x5a5fe2);}};}function respondWithFilteredResult(_0x342ea2,_0x3c948a){return function(_0x14453f){if(_0x14453f){var _0x2a9539=_0x14453f[_0x7c2c('0x1f')],_0x17df4a=_0x3c948a[_0x7c2c('0x20')],_0x26be0f=_0x3c948a[_0x7c2c('0x20')]+_0x3c948a[_0x7c2c('0x21')],_0x2c1378;if(_0x26be0f>=_0x2a9539){_0x26be0f=_0x2a9539;_0x2c1378=0xc8;}else{_0x2c1378=0xce;}_0x342ea2[_0x7c2c('0x1d')](_0x2c1378);return _0x342ea2['set'](_0x7c2c('0x22'),_0x17df4a+'-'+_0x26be0f+'/'+_0x2a9539)['json'](_0x14453f);}return null;};}function patchUpdates(_0x506d47){return function(_0x15ae33){try{jsonpatch[_0x7c2c('0x23')](_0x15ae33,_0x506d47,!![]);}catch(_0x2a9ae2){return BPromise[_0x7c2c('0x24')](_0x2a9ae2);}return _0x15ae33[_0x7c2c('0x25')]();};}function saveUpdates(_0x1883b5,_0xa84620){return function(_0x541368){if(_0x541368){return _0x541368[_0x7c2c('0x26')](_0x1883b5)['then'](function(_0x302c93){return _0x302c93;});}return null;};}function removeEntity(_0x57f510,_0x3d4387){return function(_0x274c3b){if(_0x274c3b){return _0x274c3b[_0x7c2c('0x27')]()['then'](function(){_0x57f510['status'](0xcc)[_0x7c2c('0x1e')]();});}};}function handleEntityNotFound(_0x30c53e,_0x3d2b8d){return function(_0x150690){if(!_0x150690){_0x30c53e[_0x7c2c('0x28')](0x194);}return _0x150690;};}function handleError(_0xa8e145,_0x3f4618){_0x3f4618=_0x3f4618||0x1f4;return function(_0x4b1dd0){logger[_0x7c2c('0x29')](_0x4b1dd0[_0x7c2c('0x2a')]);if(_0x4b1dd0[_0x7c2c('0x2b')]){delete _0x4b1dd0[_0x7c2c('0x2b')];}_0xa8e145[_0x7c2c('0x1d')](_0x3f4618)[_0x7c2c('0x2c')](_0x4b1dd0);};}function getInteractionUsers(_0xf2bfd1,_0x26f472){return new BPromise(function(_0xa040ff,_0x5769ec){try{if(_0x26f472[_0xf2bfd1['id']]){_0xf2bfd1[_0x7c2c('0x2d')]=_[_0x7c2c('0x2e')](_0x26f472[_0xf2bfd1['id']],function(_0x2343f4){return{'id':_0x2343f4['id'],'fullname':_0x2343f4[_0x7c2c('0x2f')]};});}}catch(_0x53ad23){_0x5769ec(_0x53ad23);}_0xa040ff(_0xf2bfd1);});}function getInteractionTags(_0xcb98ba,_0x30dd1c){return new BPromise(function(_0x4192c8,_0x1ef88b){try{if(_0xcb98ba[_0x7c2c('0x30')]){_0xcb98ba[_0x7c2c('0x31')]=[];_0xcb98ba[_0x7c2c('0x30')]['split'](',')[_0x7c2c('0x32')](function(_0x1acf75){_0xcb98ba[_0x7c2c('0x31')][_0x7c2c('0x33')](_0x30dd1c[_0x1acf75]);});}delete _0xcb98ba[_0x7c2c('0x30')];}catch(_0x5147c1){_0x1ef88b(_0x5147c1);}_0x4192c8(_0xcb98ba);});}function updateWhatsappInteraction(_0x47ef3c,_0x7f0e97,_0x5f302e){return new BPromise(function(_0x4b97bb,_0x15ee13){return getInteractionUsers(_0x47ef3c,_0x5f302e)[_0x7c2c('0x34')](function(_0x199b13){return getInteractionTags(_0x199b13,_0x7f0e97);})[_0x7c2c('0x34')](function(_0x536dcf){_0x4b97bb(_0x536dcf);})[_0x7c2c('0x35')](function(_0x38a937){_0x15ee13(_0x38a937);});});}exports[_0x7c2c('0x36')]=function(_0x19783d,_0x204968){var _0x6ef8c4={},_0x18795b={},_0xab5072={'count':0x0,'rows':[]};var _0x5c248e=_[_0x7c2c('0x2e')](db[_0x7c2c('0x37')][_0x7c2c('0x38')],function(_0x2b6a7d){return{'name':_0x2b6a7d['fieldName'],'type':_0x2b6a7d['type'][_0x7c2c('0x39')]};});_0x18795b['model']=_['map'](_0x5c248e,'name');_0x18795b[_0x7c2c('0x3a')]=_[_0x7c2c('0x3b')](_0x19783d[_0x7c2c('0x3a')]);_0x18795b[_0x7c2c('0x3c')]=_[_0x7c2c('0x3d')](_0x18795b[_0x7c2c('0x3e')],_0x18795b[_0x7c2c('0x3a')]);_0x6ef8c4[_0x7c2c('0x3f')]=_[_0x7c2c('0x3d')](_0x18795b[_0x7c2c('0x3e')],qs[_0x7c2c('0x40')](_0x19783d['query']['fields']));_0x6ef8c4[_0x7c2c('0x3f')]=_0x6ef8c4[_0x7c2c('0x3f')][_0x7c2c('0x41')]?_0x6ef8c4[_0x7c2c('0x3f')]:_0x18795b['model'];if(!_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x42')](_0x7c2c('0x43'))){_0x6ef8c4[_0x7c2c('0x21')]=qs[_0x7c2c('0x21')](_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x21')]);_0x6ef8c4[_0x7c2c('0x20')]=qs[_0x7c2c('0x20')](_0x19783d['query'][_0x7c2c('0x20')]);}_0x6ef8c4['order']=qs[_0x7c2c('0x44')](_0x19783d[_0x7c2c('0x3a')]['sort']);_0x6ef8c4[_0x7c2c('0x45')]=qs['filters'](_[_0x7c2c('0x46')](_0x19783d[_0x7c2c('0x3a')],_0x18795b[_0x7c2c('0x3c')]),_0x5c248e);var _0x26351e=[];var _0x4f3948=squel[_0x7c2c('0x47')]()['field']('id')['field'](_0x7c2c('0x2b'))[_0x7c2c('0x48')](_0x7c2c('0x49'))['from'](_0x7c2c('0x4a'));var _0x75c0ab=squel['select']()[_0x7c2c('0x48')]('u.id')[_0x7c2c('0x48')](_0x7c2c('0x4b'))['field']('ui.WhatsappInteractionId')[_0x7c2c('0x4c')](_0x7c2c('0x4d'),'ui')['left_join'](_0x7c2c('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x51e3b7=squel[_0x7c2c('0x47')]()[_0x7c2c('0x4c')](_0x7c2c('0x4f'),'i')[_0x7c2c('0x50')](_0x7c2c('0x51'),'c',_0x7c2c('0x52'))[_0x7c2c('0x50')](_0x7c2c('0x4e'),'o',_0x7c2c('0x53'))['left_join']('whatsapp_accounts','a',_0x7c2c('0x54'))[_0x7c2c('0x50')](_0x7c2c('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x7c2c('0x56'),'it',_0x7c2c('0x57'))[_0x7c2c('0x50')](_0x7c2c('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x4f958d=squel['expr']();var _0xd71ef8=[];var _0x36184a=squel[_0x7c2c('0x58')]();var _0x27a096;if(_0x19783d[_0x7c2c('0x3a')]['search']){_0x27a096=as[_0x7c2c('0x59')](_0x19783d[_0x7c2c('0x3a')]['search']);var _0x19621a=_0x27a096['sqlOperator'];for(var _0xfba6a7=0x0;_0xfba6a7<_0x27a096[_0x7c2c('0x5a')][_0x7c2c('0x41')];_0xfba6a7++){var _0x55e123=_0x27a096['conditions'][_0xfba6a7];var _0x327f3a='i';var _0x5e4bc3=_[_0x7c2c('0x5b')](_0x5c248e,[_0x7c2c('0x2b'),_0x55e123['field']]);if(!_0x5e4bc3){switch(_0x55e123[_0x7c2c('0x48')]){case _0x7c2c('0x5c'):if(_0x55e123['value']==0x1){_0x51e3b7[_0x7c2c('0x5d')]('`'+_0x55e123[_0x7c2c('0x48')]+'`\x20=\x200');}else{_0x51e3b7[_0x7c2c('0x5d')]('`'+_0x55e123[_0x7c2c('0x48')]+_0x7c2c('0x5e'));}break;case'Contact':if(_0x55e123[_0x7c2c('0x5f')]==='$substring'){if(_0x55e123[_0x7c2c('0x60')][_0x7c2c('0x61')]('\x20')['length']>0x1){_0x4f958d[_0x19621a](_0x7c2c('0x62'),qs[_0x7c2c('0x63')](_0x55e123[_0x7c2c('0x60')]),null);}else{var _0x33681b='%'+_0x55e123['value']+'%';_0x4f958d[_0x19621a](_0x7c2c('0x64'),_0x33681b,_0x33681b,_0x33681b);}}else{_0x5e4bc3=_[_0x7c2c('0x5b')](_0x5c248e,['name',_0x7c2c('0x65')]);_0x55e123['field']=_0x7c2c('0x65');_0xb1d1ad=as[_0x7c2c('0x66')](_0x327f3a,_0x5e4bc3[_0x7c2c('0x67')],_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad[_0x7c2c('0x60')]['start'],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x1e')]);}break;case'Tag':var _0x53025a=_0x55e123['value'][_0x7c2c('0x61')](',')['map'](function(_0x1e61fe){return Number(_0x1e61fe);});_0x53025a['forEach'](function(_0x469515){_0x36184a['or'](_0x7c2c('0x69'),'%,'+_0x469515+',%');});_0xd71ef8=_[_0x7c2c('0x6a')](_0xd71ef8,_0x53025a);break;case _0x7c2c('0x6b'):if(_0x55e123[_0x7c2c('0x5f')]===_0x7c2c('0x6c')){_0x4f958d[_0x19621a](_0x7c2c('0x6d'),'%'+_0x55e123[_0x7c2c('0x60')]+'%',null);}else{_0x5e4bc3=_['find'](_0x5c248e,['name','UserId']);_0x55e123[_0x7c2c('0x48')]=_0x7c2c('0x6e');_0xb1d1ad=as[_0x7c2c('0x66')](_0x327f3a,_0x5e4bc3[_0x7c2c('0x67')],_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x6f')],_0xb1d1ad[_0x7c2c('0x60')]['end']);}break;case'body':_0xb1d1ad=as[_0x7c2c('0x66')]('me',null,_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad['value'][_0x7c2c('0x6f')],_0xb1d1ad['value']['end']);break;}}else{var _0xb1d1ad=as[_0x7c2c('0x66')](_0x327f3a,_0x5e4bc3[_0x7c2c('0x67')],_0x55e123);_0x4f958d[_0x19621a](_0xb1d1ad[_0x7c2c('0x68')],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x6f')],_0xb1d1ad[_0x7c2c('0x60')][_0x7c2c('0x1e')]);}}}else{var _0xf06cd1=_(_0x19783d[_0x7c2c('0x3a')])[_0x7c2c('0x3b')]()[_0x7c2c('0x2e')](function(_0xbe0568){return _[_0x7c2c('0x70')](_0x5c248e,['name',_0xbe0568])?_0xbe0568:undefined;})[_0x7c2c('0x71')]()['value']();if(!_['isEmpty'](_0xf06cd1)){_0xf06cd1['forEach'](function(_0x4c0d0f){if(_0x4c0d0f===_0x7c2c('0x72')){_0x51e3b7[_0x7c2c('0x45')](_0x7c2c('0x73'),[][_0x7c2c('0x74')](_0x19783d[_0x7c2c('0x3a')][_0x4c0d0f]));}else if(_0x4c0d0f===_0x7c2c('0x75')){var _0x59e46d=JSON[_0x7c2c('0x76')](_0x19783d[_0x7c2c('0x3a')][_0x4c0d0f])[_0x7c2c('0x77')];var _0x21c5ff=JSON[_0x7c2c('0x76')](_0x19783d[_0x7c2c('0x3a')][_0x4c0d0f])['$lte'];_0x51e3b7[_0x7c2c('0x45')](_0x7c2c('0x78'),_0x59e46d,_0x21c5ff);}else{if(_0x19783d['query'][_0x4c0d0f]===_0x7c2c('0x79')){_0x51e3b7[_0x7c2c('0x45')]('i.'+_0x4c0d0f+'\x20IS\x20NULL');}else{_0x51e3b7[_0x7c2c('0x45')]('i.'+_0x4c0d0f+_0x7c2c('0x7a'),_0x19783d['query'][_0x4c0d0f]);}}});}if(_0x19783d['query'][_0x7c2c('0x7b')]){if(_0x19783d['query'][_0x7c2c('0x7b')]==0x1){_0x51e3b7['having'](_0x7c2c('0x7c'));}else{_0x51e3b7[_0x7c2c('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x19783d[_0x7c2c('0x3a')]['tag']){_0xd71ef8=_[_0x7c2c('0x7d')](_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7e')])?_0x19783d['query'][_0x7c2c('0x7e')]:new Array(_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7e')]);_0xd71ef8[_0x7c2c('0x32')](function(_0x5a636c){_0x36184a['or'](_0x7c2c('0x69'),'%,'+_0x5a636c+',%');});}if(_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7f')]){var _0x1d75ba=_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x7f')][_0x7c2c('0x80')]('\x5c','\x5c\x5c')[_0x7c2c('0x80')](/'/g,'\x27\x27');if(qs[_0x7c2c('0x81')](_0x1d75ba)){_0x4f958d['or']('i.id\x20LIKE\x20?',_0x1d75ba+'%')['or'](_0x7c2c('0x82'),_0x1d75ba+'%');}else{_0x4f958d['or'](_0x7c2c('0x83'),qs['getFullTextValue'](_0x1d75ba))['or'](_0x7c2c('0x84'),_0x1d75ba+'%');}}}_0x51e3b7['where'](_0x4f958d);_0x51e3b7['group'](_0x7c2c('0x85'));var _0x40fc73={'type':db[_0x7c2c('0x86')]['QueryTypes'][_0x7c2c('0x87')],'raw':!![]};var _0x4e672=_0x51e3b7[_0x7c2c('0x88')]();_0x4e672['field'](_0x7c2c('0x85'));_0x4e672[_0x7c2c('0x48')](_0x7c2c('0x89'),_0x7c2c('0x5c'));if(_0x6ef8c4['order']){_0x6ef8c4[_0x7c2c('0x8a')]['forEach'](function(_0x412ad9){var _0x4ee339=_0x412ad9[0x0]===_0x7c2c('0x8b')?_0x412ad9[0x0]:'i.'+_0x412ad9[0x0];_0x51e3b7[_0x7c2c('0x8a')](_0x4ee339,_0x412ad9[0x1]===_0x7c2c('0x8c')?![]:!![]);});}if(!_[_0x7c2c('0x8d')](_0xd71ef8)){_0x51e3b7[_0x7c2c('0x5d')](_0x36184a);_0x4e672[_0x7c2c('0x45')](_0x7c2c('0x8e'),_0xd71ef8);}BPromise['resolve']()[_0x7c2c('0x34')](function(){if(!_0x27a096){if(_0x19783d[_0x7c2c('0x3a')][_0x7c2c('0x72')])return;_0x4e672[_0x7c2c('0x45')](_0x7c2c('0x8f'));_0x51e3b7[_0x7c2c('0x45')](_0x7c2c('0x8f'));return;}if(_0x19783d[_0x7c2c('0x90')]['role']!==_0x7c2c('0x91'))return;return _0x19783d[_0x7c2c('0x90')][_0x7c2c('0x92')]({'attributes':['id'],'raw':!![]})[_0x7c2c('0x34')](function(_0x11e00d){if(_['isEmpty'](_0x11e00d)){_0x4e672[_0x7c2c('0x45')](_0x7c2c('0x93'));_0x51e3b7['where'](_0x7c2c('0x93'));}else{_0x4e672[_0x7c2c('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0x7c2c('0x2e')](_0x11e00d,'id'));_0x51e3b7['where'](_0x7c2c('0x73'),_[_0x7c2c('0x2e')](_0x11e00d,'id'));}});})[_0x7c2c('0x34')](function(){if(_0x19783d[_0x7c2c('0x90')][_0x7c2c('0x94')]===_0x7c2c('0x91')&&!_0x27a096&&!_0x19783d[_0x7c2c('0x3a')]['WhatsappAccountId'])return[];return db[_0x7c2c('0x95')][_0x7c2c('0x3a')](_0x4e672['toString'](),_0x40fc73);})[_0x7c2c('0x34')](function(_0x333a76){_0xab5072[_0x7c2c('0x1f')]=_0x333a76[_0x7c2c('0x41')];if(_0xab5072[_0x7c2c('0x1f')]===0x0)return[];return db[_0x7c2c('0x95')][_0x7c2c('0x3a')](_0x4f3948[_0x7c2c('0x96')](),_0x40fc73)[_0x7c2c('0x34')](function(_0x2f5cb0){_0x26351e=_[_0x7c2c('0x97')](_0x2f5cb0,'id');_0x40fc73=_[_0x7c2c('0x98')](_0x40fc73,{'model':db[_0x7c2c('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19783d[_0x7c2c('0x3a')]['fields']){_0x6ef8c4[_0x7c2c('0x3f')][_0x7c2c('0x32')](function(_0x551c44){_0x51e3b7[_0x7c2c('0x48')]('i.'+_0x551c44);});}else{_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0x89'),_0x7c2c('0x5c'));_0x51e3b7[_0x7c2c('0x48')]('a.key',_0x7c2c('0x99'));_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0x9a'),'Account.mandatoryDisposition');_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0x9b'),_0x7c2c('0x8b'));_0x51e3b7['field'](_0x7c2c('0x9c'));_0x51e3b7['field'](_0x7c2c('0x9d'),'Contact.firstName');_0x51e3b7['field'](_0x7c2c('0x9e'),_0x7c2c('0x9f'));_0x51e3b7[_0x7c2c('0x48')]('c.email',_0x7c2c('0xa0'));_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0xa1'),_0x7c2c('0xa2'));_0x51e3b7['field'](_0x7c2c('0xa3'),'Contact.mobile');_0x51e3b7['field']('c.fax','Contact.fax');_0x51e3b7['field'](_0x7c2c('0xa4'),_0x7c2c('0xa5'));_0x51e3b7[_0x7c2c('0x48')](_0x7c2c('0xa6'),_0x7c2c('0xa7'));_0x51e3b7['field'](_0x7c2c('0xa8'),_0x7c2c('0x30'));}if(_0x6ef8c4[_0x7c2c('0x21')])_0x51e3b7[_0x7c2c('0x21')](_0x6ef8c4[_0x7c2c('0x21')]);if(_0x6ef8c4[_0x7c2c('0x20')])_0x51e3b7['offset'](_0x6ef8c4['offset']);return db[_0x7c2c('0x95')][_0x7c2c('0x3a')](_0x51e3b7[_0x7c2c('0x96')](),_0x40fc73);})[_0x7c2c('0x34')](function(_0x587e5a){_0x75c0ab[_0x7c2c('0x45')](_0x7c2c('0xa9'),_[_0x7c2c('0x2e')](_0x587e5a,'id'));return db[_0x7c2c('0x95')][_0x7c2c('0x3a')](_0x75c0ab[_0x7c2c('0x96')](),_0x40fc73)[_0x7c2c('0x34')](function(_0x11057b){var _0x490f01=_['groupBy'](_0x11057b,_0x7c2c('0xaa'));var _0x1abb54=[];_0x587e5a['forEach'](function(_0x34ed53){_0x1abb54['push'](updateWhatsappInteraction(_0x34ed53,_0x26351e,_0x490f01));});return BPromise[_0x7c2c('0xab')](_0x1abb54);});});})['then'](function(_0x40a620){_0xab5072[_0x7c2c('0xac')]=_0x40a620;return _0xab5072;})[_0x7c2c('0x34')](respondWithFilteredResult(_0x204968,_0x6ef8c4))[_0x7c2c('0x35')](handleError(_0x204968,null));};exports[_0x7c2c('0xad')]=function(_0x309051,_0x3f8683){var _0x1eeb00={'raw':![],'where':{'id':_0x309051['params']['id']}},_0x3fd718={};_0x3fd718[_0x7c2c('0x3e')]=_[_0x7c2c('0x3b')](db[_0x7c2c('0x37')]['rawAttributes']);_0x3fd718[_0x7c2c('0x3a')]=_[_0x7c2c('0x3b')](_0x309051['query']);_0x3fd718[_0x7c2c('0x3c')]=_['intersection'](_0x3fd718[_0x7c2c('0x3e')],_0x3fd718['query']);_0x1eeb00[_0x7c2c('0x3f')]=_[_0x7c2c('0x3d')](_0x3fd718[_0x7c2c('0x3e')],qs[_0x7c2c('0x40')](_0x309051['query'][_0x7c2c('0x40')]));_0x1eeb00[_0x7c2c('0x3f')]=_0x1eeb00[_0x7c2c('0x3f')][_0x7c2c('0x41')]?_0x1eeb00[_0x7c2c('0x3f')]:_0x3fd718[_0x7c2c('0x3e')];if(_0x309051['query'][_0x7c2c('0xae')]){_0x1eeb00['include']=[{'all':!![]}];}_0x1eeb00=_[_0x7c2c('0x98')]({},_0x1eeb00,_0x309051[_0x7c2c('0xaf')]);return db['WhatsappInteraction'][_0x7c2c('0x5b')](_0x1eeb00)[_0x7c2c('0x34')](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x34')](respondWithResult(_0x3f8683,null))[_0x7c2c('0x35')](handleError(_0x3f8683,null));};exports[_0x7c2c('0xb0')]=function(_0x3f1cff,_0x5768c3){return db['WhatsappInteraction'][_0x7c2c('0xb0')](_0x3f1cff[_0x7c2c('0xb1')],{})[_0x7c2c('0x34')](respondWithResult(_0x5768c3,0xc9))[_0x7c2c('0x35')](handleError(_0x5768c3,null));};exports[_0x7c2c('0x26')]=function(_0x35b914,_0xa3a57e){if(_0x35b914['body']['id']){delete _0x35b914[_0x7c2c('0xb1')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x35b914[_0x7c2c('0xb2')]['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0xa3a57e,null))[_0x7c2c('0x34')](saveUpdates(_0x35b914[_0x7c2c('0xb1')],null))['then'](respondWithResult(_0xa3a57e,null))['catch'](handleError(_0xa3a57e,null));};exports[_0x7c2c('0x27')]=function(_0x45a60f,_0x4a0cfb){return db[_0x7c2c('0x37')]['find']({'where':{'id':_0x45a60f['params']['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x4a0cfb,null))[_0x7c2c('0x34')](removeEntity(_0x4a0cfb,null))['catch'](handleError(_0x4a0cfb,null));};exports[_0x7c2c('0xb3')]=function(_0xa485db,_0x4ba74c){return db[_0x7c2c('0x37')]['describe']()[_0x7c2c('0x34')](respondWithResult(_0x4ba74c,null))[_0x7c2c('0x35')](handleError(_0x4ba74c,null));};exports[_0x7c2c('0xb4')]=function(_0x2bf94e,_0xa285d5,_0xd97e2){return db[_0x7c2c('0xb5')]['find']({'where':{'id':_0x2bf94e[_0x7c2c('0xb2')]['id']}})['then'](handleEntityNotFound(_0xa285d5,null))[_0x7c2c('0x34')](function(_0x36bf36){if(_0x36bf36){return _0x36bf36[_0x7c2c('0xb4')](_0x2bf94e[_0x7c2c('0xb1')][_0x7c2c('0xb6')],_['omit'](_0x2bf94e[_0x7c2c('0xb1')],[_0x7c2c('0xb6'),'id'])||{});}})['then'](respondWithResult(_0xa285d5,null))[_0x7c2c('0x35')](handleError(_0xa285d5,null));};exports['getMessages']=function(_0x332795,_0x2bcb0c,_0x255d31){var _0x5d03e4={'raw':![],'where':{}};var _0x1732c8={};var _0x33f85d={'count':0x0,'rows':[]};return db[_0x7c2c('0x37')]['findOne']({'where':{'id':_0x332795[_0x7c2c('0xb2')]['id']}})['then'](handleEntityNotFound(_0x2bcb0c,null))[_0x7c2c('0x34')](function(_0x334736){if(_0x334736){_0x1732c8[_0x7c2c('0x3e')]=_[_0x7c2c('0x3b')](db[_0x7c2c('0xb5')][_0x7c2c('0x38')]);_0x1732c8['query']=_[_0x7c2c('0x3b')](_0x332795[_0x7c2c('0x3a')]);_0x1732c8['filters']=_[_0x7c2c('0x3d')](_0x1732c8[_0x7c2c('0x3e')],_0x1732c8[_0x7c2c('0x3a')]);_0x5d03e4[_0x7c2c('0x3f')]=_['intersection'](_0x1732c8['model'],qs[_0x7c2c('0x40')](_0x332795['query']['fields']));_0x5d03e4[_0x7c2c('0x3f')]=_0x5d03e4[_0x7c2c('0x3f')]['length']?_0x5d03e4['attributes']:_0x1732c8['model'];if(!_0x332795[_0x7c2c('0x3a')]['hasOwnProperty']('nolimit')){_0x5d03e4[_0x7c2c('0x21')]=qs['limit'](_0x332795[_0x7c2c('0x3a')][_0x7c2c('0x21')]);_0x5d03e4[_0x7c2c('0x20')]=qs[_0x7c2c('0x20')](_0x332795[_0x7c2c('0x3a')]['offset']);}_0x5d03e4[_0x7c2c('0x8a')]=qs['sort'](_0x332795[_0x7c2c('0x3a')][_0x7c2c('0x44')]);_0x5d03e4[_0x7c2c('0x45')]=qs[_0x7c2c('0x3c')](_[_0x7c2c('0x46')](_0x332795['query'],_0x1732c8['filters']));_0x5d03e4['where']['WhatsappInteractionId']=_0x334736['id'];if(_0x332795[_0x7c2c('0x3a')][_0x7c2c('0x7f')]){_0x5d03e4[_0x7c2c('0x45')]=_[_0x7c2c('0x98')](_0x5d03e4[_0x7c2c('0x45')],{'$or':_[_0x7c2c('0x2e')](_0x5d03e4[_0x7c2c('0x3f')],function(_0x3cae39){var _0x44f523={};_0x44f523[_0x3cae39]={'$like':'%'+_0x332795['query'][_0x7c2c('0x7f')]+'%'};return _0x44f523;})});}if(_0x332795[_0x7c2c('0x3a')][_0x7c2c('0x77')]){var _0x27f1df=_0x332795[_0x7c2c('0x3a')][_0x7c2c('0x77')][_0x7c2c('0x61')](',');var _0x4b8433={};_0x4b8433[_0x27f1df[0x0]]={'$gte':moment(_0x27f1df[0x1])[_0x7c2c('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5d03e4['where']=_[_0x7c2c('0x98')](_0x5d03e4[_0x7c2c('0x45')],_0x4b8433);}_0x5d03e4=_['merge']({},_0x5d03e4,_0x332795[_0x7c2c('0xaf')]);return db[_0x7c2c('0xb5')][_0x7c2c('0x1f')]({'where':_0x5d03e4[_0x7c2c('0x45')]})[_0x7c2c('0x34')](function(_0xb76478){_0x33f85d['count']=_0xb76478;if(_0x332795[_0x7c2c('0x3a')][_0x7c2c('0xae')]){_0x5d03e4[_0x7c2c('0xb8')]=[{'all':!![]}];}return db[_0x7c2c('0xb5')][_0x7c2c('0xb9')](_0x5d03e4);})[_0x7c2c('0x34')](function(_0x46448b){_0x33f85d['rows']=_0x46448b;return _0x33f85d;});}})[_0x7c2c('0x34')](respondWithFilteredResult(_0x2bcb0c,_0x5d03e4))[_0x7c2c('0x35')](handleError(_0x2bcb0c,null));};exports[_0x7c2c('0xba')]=function(_0x5ad538,_0x316b34,_0xbf45fe){return db[_0x7c2c('0x37')][_0x7c2c('0x5b')]({'where':{'id':_0x5ad538[_0x7c2c('0xb2')]['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x316b34,null))[_0x7c2c('0x34')](function(_0x450016){if(_0x450016){return _0x450016[_0x7c2c('0xbb')](_0x5ad538[_0x7c2c('0xb1')][_0x7c2c('0xb6')],_[_0x7c2c('0xbc')](_0x5ad538[_0x7c2c('0xb1')],[_0x7c2c('0xb6'),'id'])||{})[_0x7c2c('0xbd')](function(){return db['Tag'][_0x7c2c('0xb9')]({'attributes':['id','name',_0x7c2c('0x49')],'where':{'id':_0x5ad538[_0x7c2c('0xb1')]['ids']}});})[_0x7c2c('0x34')](function(_0x14acec){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x5ad538[_0x7c2c('0xb2')]['id']),'tags':_0x14acec||[]});return{'id':Number(_0x5ad538[_0x7c2c('0xb2')]['id']),'tags':_0x14acec||[]};});}})[_0x7c2c('0x34')](respondWithResult(_0x316b34,null))[_0x7c2c('0x35')](handleError(_0x316b34,null));};exports['removeTags']=function(_0x5749a6,_0x2d813f,_0x168bd1){return db[_0x7c2c('0x37')][_0x7c2c('0x5b')]({'where':{'id':_0x5749a6['params']['id']}})[_0x7c2c('0x34')](handleEntityNotFound(_0x2d813f,null))[_0x7c2c('0x34')](function(_0x317445){if(_0x317445){return _0x317445[_0x7c2c('0xbe')](_0x5749a6[_0x7c2c('0x3a')]['ids']);}})[_0x7c2c('0x34')](respondWithStatusCode(_0x2d813f,null))[_0x7c2c('0x35')](handleError(_0x2d813f,null));};exports[_0x7c2c('0xbf')]=function(_0x2b1004,_0x53acb1){var _0x34d54b=moment()[_0x7c2c('0xc0')]()[_0x7c2c('0x96')]();var _0x54033a=path['join'](config[_0x7c2c('0xc1')],_0x7c2c('0xc2'),'files',_0x7c2c('0xc3'));var _0x3e23a2=path[_0x7c2c('0xc4')](config[_0x7c2c('0xc1')],'server',_0x7c2c('0xc5'),_0x7c2c('0xc6'));var _0x3af921=path[_0x7c2c('0xc4')](_0x54033a,_0x34d54b);var _0xf5234a=util[_0x7c2c('0xb7')](_0x7c2c('0xc7'),_0x2b1004[_0x7c2c('0xb2')]['id'],_0x34d54b);var _0x4af0eb=path[_0x7c2c('0xc4')](_0x54033a,_0xf5234a);var _0x3ab89b=[];_0x3ab89b[_0x7c2c('0x33')]({'model':db[_0x7c2c('0x6b')],'as':_0x7c2c('0x6b'),'attributes':['id',_0x7c2c('0x2f')],'raw':!![]});_0x3ab89b[_0x7c2c('0x33')]({'model':db['CmContact'],'as':_0x7c2c('0xc8'),'attributes':['id',_0x7c2c('0xc9'),_0x7c2c('0xca')],'raw':!![]});if(_0x2b1004['query'][_0x7c2c('0xc6')]){_0x3ab89b[_0x7c2c('0x33')]({'model':db[_0x7c2c('0xcb')],'as':_0x7c2c('0xcb'),'raw':!![]});}var _0x5325fc=[{'model':db[_0x7c2c('0xb5')],'as':'Messages','attributes':['id',_0x7c2c('0xb1'),'createdAt',_0x7c2c('0xcc'),_0x7c2c('0xcd'),_0x7c2c('0x7b')],'include':_0x3ab89b}];_0x5325fc[_0x7c2c('0x33')]({'model':db['WhatsappAccount'],'as':_0x7c2c('0xce'),'attributes':['id','name']});_0x5325fc[_0x7c2c('0x33')]({'model':db[_0x7c2c('0x6b')],'as':'Owner','attributes':['id',_0x7c2c('0x2f')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x2b1004[_0x7c2c('0xb2')]['id']},'include':_0x5325fc})['then'](handleEntityNotFound(_0x53acb1,null))[_0x7c2c('0x34')](function(_0xec14ba){if(_0xec14ba){var _0x431b31=_0xec14ba[_0x7c2c('0xcf')]({'plain':!![]});fs[_0x7c2c('0xd0')](_0x3af921);var _0x5db9cb={'format':'A4','border':_0x7c2c('0xd1'),'header':{'height':_0x7c2c('0xd2'),'contents':{'first':_0x7c2c('0xd3')}},'footer':{'height':'30px','contents':{'default':util[_0x7c2c('0xb7')](_0x7c2c('0xd4'),util[_0x7c2c('0xb7')]('%s\x20#%d',_0x7c2c('0xd5'),_0x431b31['id']),moment()[_0x7c2c('0xb7')]('YYYY-MM-DD')[_0x7c2c('0x96')]())}}};var _0x2f140c={'channel':_0x7c2c('0xd5'),'account':_0x431b31[_0x7c2c('0xce')]['name'],'agent':_0x431b31[_0x7c2c('0xd6')]?_0x431b31[_0x7c2c('0xd6')][_0x7c2c('0x2f')]:'N.A.','createdAt':moment(_0x431b31[_0x7c2c('0x75')])[_0x7c2c('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7c2c('0x96')](),'closedAt':_0x431b31['closed']?moment(_0x431b31[_0x7c2c('0xd7')])[_0x7c2c('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7c2c('0x96')]():'','disposition':_0x431b31[_0x7c2c('0xd8')],'messages':_(_0x431b31[_0x7c2c('0xd9')])[_0x7c2c('0x7f')]({'secret':![]})[_0x7c2c('0x2e')](function(_0x1396e1){if(_0x1396e1['Attachment']){var _0x152022=path[_0x7c2c('0xc4')](_0x3e23a2,_0x1396e1[_0x7c2c('0xcb')][_0x7c2c('0xda')]);if(fs[_0x7c2c('0xdb')](_0x152022)){fs[_0x7c2c('0xdc')](_0x152022)['pipe'](fs[_0x7c2c('0xdd')](path[_0x7c2c('0xc4')](_0x3af921,_0x1396e1[_0x7c2c('0xcb')][_0x7c2c('0xda')])));}}return{'date':moment(_0x1396e1[_0x7c2c('0x75')])[_0x7c2c('0xb7')](_0x7c2c('0xde'))['toString'](),'sender':_0x1396e1[_0x7c2c('0xcc')]===_0x7c2c('0xdf')?_0x1396e1[_0x7c2c('0x6b')]?_0x1396e1['User'][_0x7c2c('0x2f')]:_0x7c2c('0xe0'):_0x1396e1[_0x7c2c('0xc8')][_0x7c2c('0xc9')]+(_0x1396e1[_0x7c2c('0xc8')][_0x7c2c('0xca')]?'\x20'+_0x1396e1[_0x7c2c('0xc8')][_0x7c2c('0xca')]:''),'body':_0x1396e1[_0x7c2c('0xcb')]?_0x1396e1[_0x7c2c('0xcb')][_0x7c2c('0xda')]:_0x1396e1[_0x7c2c('0xb1')],'direction':_0x1396e1[_0x7c2c('0xcc')]===_0x7c2c('0xdf')?'A':'C','secret':_0x1396e1['secret'],'read':_0x1396e1[_0x7c2c('0x7b')],'attachment':_0x1396e1[_0x7c2c('0xcb')]};})[_0x7c2c('0x60')]()};return ejs[_0x7c2c('0xe1')](path[_0x7c2c('0xc4')](config[_0x7c2c('0xc1')],_0x7c2c('0xc2'),_0x7c2c('0xe2'),'downloadInteraction.html'),{'interaction':_0x2f140c})[_0x7c2c('0x34')](function(_0x545199){return new BPromise(function(_0xbeb3b,_0x22c26b){pdf[_0x7c2c('0xb0')](_0x545199,_0x5db9cb)[_0x7c2c('0xe3')](path['join'](_0x3af921,_0x7c2c('0xe4')+_0x431b31['id']+'-'+_0x34d54b+_0x7c2c('0xe5')),function(_0x1d9da5,_0x230eaa){if(_0x1d9da5)return _0x22c26b(_0x1d9da5);_0xbeb3b(_0x230eaa);});});})[_0x7c2c('0x34')](function(){return new BPromise(function(_0x4a4a2f,_0x2354e9){zipdir(_0x3af921,{'saveTo':_0x4af0eb},function(_0xf60ff2,_0x46a52b){if(_0xf60ff2)return _0x2354e9(_0xf60ff2);return _0x4a4a2f(_0x46a52b);});})[_0x7c2c('0x34')](function(){return new BPromise(function(_0xc21fb5,_0x49fdcd){rimraf(_0x3af921,function(_0x2c88b5){if(_0x2c88b5)_0x49fdcd(_0x2c88b5);return _0xc21fb5();});});})[_0x7c2c('0x34')](function(){return _0x53acb1[_0x7c2c('0xbf')](_0x4af0eb,_0xf5234a,function(_0xe63c5c){if(_0xe63c5c){console['log'](_0x7c2c('0xe6'),_0xe63c5c);}else{fs['unlinkSync'](_0x4af0eb);}});});});}else{return _0x53acb1[_0x7c2c('0x28')](0xc8);}})[_0x7c2c('0x35')](handleError(_0x53acb1,null));}; \ No newline at end of file +var _0xe2fe=['WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','group','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','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','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','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','toString','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','show','includeAll','include','options','create','update','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','createReadStream','pipe','createWriteStream','basename','out','direction','renderFile','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','Users','map','fullname','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','where','field','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','a.id\x20=\x20i.WhatsappAccountId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty'];(function(_0x58a6b3,_0x52ced1){var _0x2973b0=function(_0x496702){while(--_0x496702){_0x58a6b3['push'](_0x58a6b3['shift']());}};_0x2973b0(++_0x52ced1);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];config[_0xee2f('0x11')]=_[_0xee2f('0x12')](config[_0xee2f('0x11')],{'host':_0xee2f('0x13'),'port':0x18eb});var socket=require(_0xee2f('0x14'))(new Redis(config['redis']));require(_0xee2f('0x15'))['register'](socket);function respondWithStatusCode(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xcc;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x16')](_0x271c1d);}return _0x36db10[_0xee2f('0x17')](_0x271c1d)[_0xee2f('0x18')]();};}function respondWithResult(_0x1bbf7d,_0x390c2c){_0x390c2c=_0x390c2c||0xc8;return function(_0x58f42a){if(_0x58f42a){return _0x1bbf7d[_0xee2f('0x17')](_0x390c2c)['json'](_0x58f42a);}};}function respondWithFilteredResult(_0x17d288,_0x3359ff){return function(_0x502eb6){if(_0x502eb6){var _0x550da7=_0x502eb6[_0xee2f('0x19')],_0x40b5bc=_0x3359ff[_0xee2f('0x1a')],_0x5a5078=_0x3359ff['offset']+_0x3359ff[_0xee2f('0x1b')],_0x69db88;if(_0x5a5078>=_0x550da7){_0x5a5078=_0x550da7;_0x69db88=0xc8;}else{_0x69db88=0xce;}_0x17d288[_0xee2f('0x17')](_0x69db88);return _0x17d288[_0xee2f('0x1c')](_0xee2f('0x1d'),_0x40b5bc+'-'+_0x5a5078+'/'+_0x550da7)[_0xee2f('0x1e')](_0x502eb6);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1f')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x20')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x21')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x22')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x23')]()[_0xee2f('0x22')](function(){_0x15ceda[_0xee2f('0x17')](0xcc)[_0xee2f('0x18')]();});}};}function handleEntityNotFound(_0x1e394f,_0x11edc8){return function(_0x168adc){if(!_0x168adc){_0x1e394f[_0xee2f('0x16')](0x194);}return _0x168adc;};}function handleError(_0x45c4a0,_0x53f6ed){_0x53f6ed=_0x53f6ed||0x1f4;return function(_0x4ef690){logger['error'](_0x4ef690[_0xee2f('0x24')]);if(_0x4ef690[_0xee2f('0x25')]){delete _0x4ef690[_0xee2f('0x25')];}_0x45c4a0[_0xee2f('0x17')](_0x53f6ed)[_0xee2f('0x26')](_0x4ef690);};}function getInteractionUsers(_0x3737fd,_0x4d8398){return new BPromise(function(_0x3d3806,_0x52e1fa){try{if(_0x4d8398[_0x3737fd['id']]){_0x3737fd[_0xee2f('0x27')]=_[_0xee2f('0x28')](_0x4d8398[_0x3737fd['id']],function(_0x25ee9c){return{'id':_0x25ee9c['id'],'fullname':_0x25ee9c[_0xee2f('0x29')]};});}}catch(_0x3ddbe3){_0x52e1fa(_0x3ddbe3);}_0x3d3806(_0x3737fd);});}function getInteractionTags(_0x47d5a6,_0x310c0b){return new BPromise(function(_0xd16e35,_0x56706e){try{if(_0x47d5a6['TagIds']){_0x47d5a6[_0xee2f('0x2a')]=[];_0x47d5a6['TagIds'][_0xee2f('0x2b')](',')[_0xee2f('0x2c')](function(_0x53d9b7){_0x47d5a6[_0xee2f('0x2a')]['push'](_0x310c0b[_0x53d9b7]);});}delete _0x47d5a6['TagIds'];}catch(_0x5b3ef0){_0x56706e(_0x5b3ef0);}_0xd16e35(_0x47d5a6);});}function updateWhatsappInteraction(_0x3f1fe8,_0x433d64,_0x5c15bb){return new BPromise(function(_0x39f224,_0x1b70cc){return getInteractionUsers(_0x3f1fe8,_0x5c15bb)[_0xee2f('0x22')](function(_0x32cadb){return getInteractionTags(_0x32cadb,_0x433d64);})[_0xee2f('0x22')](function(_0x4e682d){_0x39f224(_0x4e682d);})[_0xee2f('0x2d')](function(_0x5b427c){_0x1b70cc(_0x5b427c);});});}exports[_0xee2f('0x2e')]=function(_0x86cad4,_0x3dcb9e){var _0x4a5047={},_0x169c75={},_0x5ed71e={'count':0x0,'rows':[]};var _0xd3aaa9=_['map'](db[_0xee2f('0x2f')][_0xee2f('0x30')],function(_0x13149e){return{'name':_0x13149e[_0xee2f('0x31')],'type':_0x13149e[_0xee2f('0x32')][_0xee2f('0x33')]};});_0x169c75[_0xee2f('0x34')]=_[_0xee2f('0x28')](_0xd3aaa9,_0xee2f('0x25'));_0x169c75[_0xee2f('0x35')]=_[_0xee2f('0x36')](_0x86cad4['query']);_0x169c75[_0xee2f('0x37')]=_['intersection'](_0x169c75[_0xee2f('0x34')],_0x169c75[_0xee2f('0x35')]);_0x4a5047[_0xee2f('0x38')]=_[_0xee2f('0x39')](_0x169c75[_0xee2f('0x34')],qs[_0xee2f('0x3a')](_0x86cad4[_0xee2f('0x35')][_0xee2f('0x3a')]));_0x4a5047['attributes']=_0x4a5047['attributes']['length']?_0x4a5047[_0xee2f('0x38')]:_0x169c75['model'];if(!_0x86cad4[_0xee2f('0x35')]['hasOwnProperty']('nolimit')){_0x4a5047['limit']=qs['limit'](_0x86cad4[_0xee2f('0x35')][_0xee2f('0x1b')]);_0x4a5047[_0xee2f('0x1a')]=qs[_0xee2f('0x1a')](_0x86cad4['query']['offset']);}_0x4a5047[_0xee2f('0x3b')]=qs['sort'](_0x86cad4['query'][_0xee2f('0x3c')]);_0x4a5047[_0xee2f('0x3d')]=qs[_0xee2f('0x37')](_['pick'](_0x86cad4[_0xee2f('0x35')],_0x169c75[_0xee2f('0x37')]),_0xd3aaa9);var _0x19bd4d=[];var _0x4cb3fd=squel['select']()[_0xee2f('0x3e')]('id')[_0xee2f('0x3e')](_0xee2f('0x25'))[_0xee2f('0x3e')]('color')[_0xee2f('0x3f')](_0xee2f('0x40'));var _0x242e91=squel[_0xee2f('0x41')]()[_0xee2f('0x3e')](_0xee2f('0x42'))[_0xee2f('0x3e')](_0xee2f('0x43'))[_0xee2f('0x3e')](_0xee2f('0x44'))['from']('user_has_whatsapp_interactions','ui')['left_join']('users','u',_0xee2f('0x45'));var _0x3e0d7b=squel[_0xee2f('0x41')]()[_0xee2f('0x3f')](_0xee2f('0x46'),'i')['left_join'](_0xee2f('0x47'),'c',_0xee2f('0x48'))[_0xee2f('0x49')](_0xee2f('0x4a'),'o','o.id\x20=\x20i.UserId')['left_join']('whatsapp_accounts','a',_0xee2f('0x4b'))['left_join']('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xee2f('0x4c'),'it',_0xee2f('0x4d'))[_0xee2f('0x49')]('tools_tags','t',_0xee2f('0x4e'));var _0x57f65d=squel[_0xee2f('0x4f')]();var _0x35d738=[];var _0x4497ba=squel[_0xee2f('0x4f')]();var _0x3d86b4;if(_0x86cad4['query']['search']){_0x3d86b4=as[_0xee2f('0x50')](_0x86cad4['query'][_0xee2f('0x51')]);var _0x282e89=_0x3d86b4[_0xee2f('0x52')];for(var _0x88e683=0x0;_0x88e683<_0x3d86b4['conditions']['length'];_0x88e683++){var _0x1f5a7a=_0x3d86b4[_0xee2f('0x53')][_0x88e683];var _0x1b00a8='i';var _0x2189ff=_[_0xee2f('0x54')](_0xd3aaa9,[_0xee2f('0x25'),_0x1f5a7a[_0xee2f('0x3e')]]);if(!_0x2189ff){switch(_0x1f5a7a[_0xee2f('0x3e')]){case _0xee2f('0x55'):if(_0x1f5a7a[_0xee2f('0x56')]==0x1){_0x3e0d7b[_0xee2f('0x57')]('`'+_0x1f5a7a[_0xee2f('0x3e')]+'`\x20=\x200');}else{_0x3e0d7b[_0xee2f('0x57')]('`'+_0x1f5a7a[_0xee2f('0x3e')]+_0xee2f('0x58'));}break;case _0xee2f('0x59'):if(_0x1f5a7a['operator']===_0xee2f('0x5a')){if(_0x1f5a7a[_0xee2f('0x56')][_0xee2f('0x2b')]('\x20')[_0xee2f('0x5b')]>0x1){_0x57f65d[_0x282e89](_0xee2f('0x5c'),qs['getFullTextValue'](_0x1f5a7a[_0xee2f('0x56')]),null);}else{var _0x5f456e='%'+_0x1f5a7a['value']+'%';_0x57f65d[_0x282e89](_0xee2f('0x5d'),_0x5f456e,_0x5f456e,_0x5f456e);}}else{_0x2189ff=_[_0xee2f('0x54')](_0xd3aaa9,[_0xee2f('0x25'),_0xee2f('0x5e')]);_0x1f5a7a[_0xee2f('0x3e')]=_0xee2f('0x5e');_0x1dea2a=as[_0xee2f('0x5f')](_0x1b00a8,_0x2189ff['type'],_0x1f5a7a);_0x57f65d[_0x282e89](_0x1dea2a[_0xee2f('0x60')],_0x1dea2a[_0xee2f('0x56')][_0xee2f('0x61')],_0x1dea2a[_0xee2f('0x56')][_0xee2f('0x18')]);}break;case _0xee2f('0x62'):var _0xcba6fc=_0x1f5a7a[_0xee2f('0x56')][_0xee2f('0x2b')](',')['map'](function(_0x12373b){return Number(_0x12373b);});_0xcba6fc['forEach'](function(_0x1b4ee6){_0x4497ba['or'](_0xee2f('0x63'),'%,'+_0x1b4ee6+',%');});_0x35d738=_[_0xee2f('0x64')](_0x35d738,_0xcba6fc);break;case _0xee2f('0x65'):if(_0x1f5a7a[_0xee2f('0x66')]==='$substring'){_0x57f65d[_0x282e89](_0xee2f('0x67'),'%'+_0x1f5a7a[_0xee2f('0x56')]+'%',null);}else{_0x2189ff=_[_0xee2f('0x54')](_0xd3aaa9,[_0xee2f('0x25'),'UserId']);_0x1f5a7a['field']='UserId';_0x1dea2a=as['buildExpression'](_0x1b00a8,_0x2189ff['type'],_0x1f5a7a);_0x57f65d[_0x282e89](_0x1dea2a[_0xee2f('0x60')],_0x1dea2a['value'][_0xee2f('0x61')],_0x1dea2a[_0xee2f('0x56')][_0xee2f('0x18')]);}break;case _0xee2f('0x68'):_0x1dea2a=as[_0xee2f('0x5f')]('me',null,_0x1f5a7a);_0x57f65d[_0x282e89](_0x1dea2a[_0xee2f('0x60')],_0x1dea2a['value']['start'],_0x1dea2a[_0xee2f('0x56')]['end']);break;}}else{var _0x1dea2a=as['buildExpression'](_0x1b00a8,_0x2189ff[_0xee2f('0x32')],_0x1f5a7a);_0x57f65d[_0x282e89](_0x1dea2a['text'],_0x1dea2a[_0xee2f('0x56')][_0xee2f('0x61')],_0x1dea2a[_0xee2f('0x56')]['end']);}}}else{var _0x3cc477=_(_0x86cad4[_0xee2f('0x35')])[_0xee2f('0x36')]()[_0xee2f('0x28')](function(_0xfeddec){return _[_0xee2f('0x69')](_0xd3aaa9,[_0xee2f('0x25'),_0xfeddec])?_0xfeddec:undefined;})['compact']()[_0xee2f('0x56')]();if(!_[_0xee2f('0x6a')](_0x3cc477)){_0x3cc477[_0xee2f('0x2c')](function(_0x353bd9){if(_0x353bd9===_0xee2f('0x6b')){_0x3e0d7b[_0xee2f('0x3d')](_0xee2f('0x6c'),[][_0xee2f('0x6d')](_0x86cad4[_0xee2f('0x35')][_0x353bd9]));}else if(_0x353bd9===_0xee2f('0x6e')){var _0x2717a0=JSON['parse'](_0x86cad4[_0xee2f('0x35')][_0x353bd9])[_0xee2f('0x6f')];var _0x54b9fb=JSON[_0xee2f('0x70')](_0x86cad4['query'][_0x353bd9])[_0xee2f('0x71')];_0x3e0d7b['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2717a0,_0x54b9fb);}else{if(_0x86cad4[_0xee2f('0x35')][_0x353bd9]===_0xee2f('0x72')){_0x3e0d7b[_0xee2f('0x3d')]('i.'+_0x353bd9+_0xee2f('0x73'));}else{_0x3e0d7b[_0xee2f('0x3d')]('i.'+_0x353bd9+'\x20=\x20?',_0x86cad4[_0xee2f('0x35')][_0x353bd9]);}}});}if(_0x86cad4[_0xee2f('0x35')][_0xee2f('0x74')]){if(_0x86cad4['query'][_0xee2f('0x74')]==0x1){_0x3e0d7b[_0xee2f('0x57')]('`unreadMessages`\x20=\x200');}else{_0x3e0d7b[_0xee2f('0x57')](_0xee2f('0x75'));}}if(_0x86cad4[_0xee2f('0x35')][_0xee2f('0x76')]){_0x35d738=_[_0xee2f('0x77')](_0x86cad4[_0xee2f('0x35')][_0xee2f('0x76')])?_0x86cad4[_0xee2f('0x35')][_0xee2f('0x76')]:new Array(_0x86cad4['query']['tag']);_0x35d738['forEach'](function(_0x3dfd43){_0x4497ba['or'](_0xee2f('0x63'),'%,'+_0x3dfd43+',%');});}if(_0x86cad4[_0xee2f('0x35')][_0xee2f('0x78')]){var _0x139c7a=_0x86cad4['query'][_0xee2f('0x78')][_0xee2f('0x79')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xee2f('0x7a')](_0x139c7a)){_0x57f65d['or'](_0xee2f('0x7b'),_0x139c7a+'%')['or'](_0xee2f('0x7c'),_0x139c7a+'%');}else{_0x57f65d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee2f('0x7d')](_0x139c7a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x139c7a+'%');}}}_0x3e0d7b[_0xee2f('0x3d')](_0x57f65d);_0x3e0d7b[_0xee2f('0x7e')]('i.id');var _0x179774={'type':db[_0xee2f('0x7f')]['QueryTypes']['SELECT'],'raw':!![]};var _0x48f0ff=_0x3e0d7b[_0xee2f('0x80')]();_0x48f0ff['field']('i.id');_0x48f0ff[_0xee2f('0x3e')](_0xee2f('0x81'),'unreadMessages');if(_0x4a5047[_0xee2f('0x3b')]){_0x4a5047['order'][_0xee2f('0x2c')](function(_0x10d5f2){var _0x2c4c90=_0x10d5f2[0x0]===_0xee2f('0x82')?_0x10d5f2[0x0]:'i.'+_0x10d5f2[0x0];_0x3e0d7b[_0xee2f('0x3b')](_0x2c4c90,_0x10d5f2[0x1]===_0xee2f('0x83')?![]:!![]);});}if(!_[_0xee2f('0x6a')](_0x35d738)){_0x3e0d7b['having'](_0x4497ba);_0x48f0ff[_0xee2f('0x3d')](_0xee2f('0x84'),_0x35d738);}BPromise[_0xee2f('0x85')]()[_0xee2f('0x22')](function(){if(!_0x3d86b4){if(_0x86cad4[_0xee2f('0x35')]['WhatsappAccountId'])return;_0x48f0ff[_0xee2f('0x3d')](_0xee2f('0x86'));_0x3e0d7b[_0xee2f('0x3d')](_0xee2f('0x86'));return;}if(_0x86cad4[_0xee2f('0x87')][_0xee2f('0x88')]!=='agent')return;return _0x86cad4['user'][_0xee2f('0x89')]({'attributes':['id'],'raw':!![]})[_0xee2f('0x22')](function(_0x3691b3){if(_[_0xee2f('0x6a')](_0x3691b3)){_0x48f0ff[_0xee2f('0x3d')](_0xee2f('0x8a'));_0x3e0d7b[_0xee2f('0x3d')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x48f0ff['where'](_0xee2f('0x6c'),_[_0xee2f('0x28')](_0x3691b3,'id'));_0x3e0d7b[_0xee2f('0x3d')](_0xee2f('0x6c'),_[_0xee2f('0x28')](_0x3691b3,'id'));}});})[_0xee2f('0x22')](function(){if(_0x86cad4[_0xee2f('0x87')][_0xee2f('0x88')]===_0xee2f('0x8b')&&!_0x3d86b4&&!_0x86cad4[_0xee2f('0x35')][_0xee2f('0x6b')])return[];return db[_0xee2f('0x8c')]['query'](_0x48f0ff['toString'](),_0x179774);})[_0xee2f('0x22')](function(_0x5bd7c8){_0x5ed71e['count']=_0x5bd7c8['length'];if(_0x5ed71e['count']===0x0)return[];return db[_0xee2f('0x8c')][_0xee2f('0x35')](_0x4cb3fd['toString'](),_0x179774)['then'](function(_0x9c89a3){_0x19bd4d=_[_0xee2f('0x8d')](_0x9c89a3,'id');_0x179774=_[_0xee2f('0x8e')](_0x179774,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x86cad4['query'][_0xee2f('0x3a')]){_0x4a5047[_0xee2f('0x38')][_0xee2f('0x2c')](function(_0x58eb98){_0x3e0d7b[_0xee2f('0x3e')]('i.'+_0x58eb98);});}else{_0x3e0d7b['field'](_0xee2f('0x81'),'unreadMessages');_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x8f'),_0xee2f('0x90'));_0x3e0d7b['field']('a.mandatoryDisposition',_0xee2f('0x91'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x92'),'contactName');_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x93'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x94'),_0xee2f('0x95'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x96'),_0xee2f('0x97'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x98'),_0xee2f('0x99'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x9a'),_0xee2f('0x9b'));_0x3e0d7b['field'](_0xee2f('0x9c'),_0xee2f('0x9d'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0x9e'),_0xee2f('0x9f'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0xa0'),_0xee2f('0xa1'));_0x3e0d7b[_0xee2f('0x3e')](_0xee2f('0xa2'),_0xee2f('0xa3'));_0x3e0d7b['field'](_0xee2f('0xa4'),_0xee2f('0xa5'));}if(_0x4a5047[_0xee2f('0x1b')])_0x3e0d7b[_0xee2f('0x1b')](_0x4a5047['limit']);if(_0x4a5047[_0xee2f('0x1a')])_0x3e0d7b[_0xee2f('0x1a')](_0x4a5047[_0xee2f('0x1a')]);return db['sequelize']['query'](_0x3e0d7b[_0xee2f('0xa6')](),_0x179774);})['then'](function(_0x487a74){_0x242e91['where'](_0xee2f('0xa7'),_[_0xee2f('0x28')](_0x487a74,'id'));return db[_0xee2f('0x8c')][_0xee2f('0x35')](_0x242e91['toString'](),_0x179774)[_0xee2f('0x22')](function(_0x39d66f){var _0x245af5=_['groupBy'](_0x39d66f,_0xee2f('0xa8'));var _0x481e16=[];_0x487a74[_0xee2f('0x2c')](function(_0x4a06ab){_0x481e16['push'](updateWhatsappInteraction(_0x4a06ab,_0x19bd4d,_0x245af5));});return BPromise[_0xee2f('0xa9')](_0x481e16);});});})['then'](function(_0x152b39){_0x5ed71e['rows']=_0x152b39;return _0x5ed71e;})['then'](respondWithFilteredResult(_0x3dcb9e,_0x4a5047))[_0xee2f('0x2d')](handleError(_0x3dcb9e,null));};exports[_0xee2f('0xaa')]=function(_0x4fed80,_0x2685ed){var _0x34f882={'raw':![],'where':{'id':_0x4fed80['params']['id']}},_0x4fe164={};_0x4fe164[_0xee2f('0x34')]=_[_0xee2f('0x36')](db['WhatsappInteraction'][_0xee2f('0x30')]);_0x4fe164[_0xee2f('0x35')]=_[_0xee2f('0x36')](_0x4fed80[_0xee2f('0x35')]);_0x4fe164[_0xee2f('0x37')]=_['intersection'](_0x4fe164['model'],_0x4fe164['query']);_0x34f882[_0xee2f('0x38')]=_[_0xee2f('0x39')](_0x4fe164[_0xee2f('0x34')],qs[_0xee2f('0x3a')](_0x4fed80[_0xee2f('0x35')][_0xee2f('0x3a')]));_0x34f882[_0xee2f('0x38')]=_0x34f882[_0xee2f('0x38')][_0xee2f('0x5b')]?_0x34f882[_0xee2f('0x38')]:_0x4fe164[_0xee2f('0x34')];if(_0x4fed80[_0xee2f('0x35')][_0xee2f('0xab')]){_0x34f882[_0xee2f('0xac')]=[{'all':!![]}];}_0x34f882=_[_0xee2f('0x8e')]({},_0x34f882,_0x4fed80[_0xee2f('0xad')]);return db['WhatsappInteraction']['find'](_0x34f882)[_0xee2f('0x22')](handleEntityNotFound(_0x2685ed,null))[_0xee2f('0x22')](respondWithResult(_0x2685ed,null))['catch'](handleError(_0x2685ed,null));};exports[_0xee2f('0xae')]=function(_0x444c39,_0xef212c){return db['WhatsappInteraction'][_0xee2f('0xae')](_0x444c39[_0xee2f('0x68')],{})[_0xee2f('0x22')](respondWithResult(_0xef212c,0xc9))[_0xee2f('0x2d')](handleError(_0xef212c,null));};exports[_0xee2f('0xaf')]=function(_0x34bd13,_0x25d36b){if(_0x34bd13[_0xee2f('0x68')]['id']){delete _0x34bd13[_0xee2f('0x68')]['id'];}return db['WhatsappInteraction'][_0xee2f('0x54')]({'where':{'id':_0x34bd13[_0xee2f('0xb0')]['id']}})[_0xee2f('0x22')](handleEntityNotFound(_0x25d36b,null))[_0xee2f('0x22')](saveUpdates(_0x34bd13[_0xee2f('0x68')],null))[_0xee2f('0x22')](respondWithResult(_0x25d36b,null))[_0xee2f('0x2d')](handleError(_0x25d36b,null));};exports[_0xee2f('0x23')]=function(_0x5155ea,_0xdb9f23){return db[_0xee2f('0x2f')]['find']({'where':{'id':_0x5155ea[_0xee2f('0xb0')]['id']}})['then'](handleEntityNotFound(_0xdb9f23,null))['then'](removeEntity(_0xdb9f23,null))[_0xee2f('0x2d')](handleError(_0xdb9f23,null));};exports[_0xee2f('0xb1')]=function(_0x17b81f,_0x40da59){return db[_0xee2f('0x2f')][_0xee2f('0xb1')]()['then'](respondWithResult(_0x40da59,null))[_0xee2f('0x2d')](handleError(_0x40da59,null));};exports[_0xee2f('0xb2')]=function(_0x5987bc,_0x371278,_0x1d6ec6){return db['WhatsappMessage'][_0xee2f('0x54')]({'where':{'id':_0x5987bc[_0xee2f('0xb0')]['id']}})[_0xee2f('0x22')](handleEntityNotFound(_0x371278,null))[_0xee2f('0x22')](function(_0x1bc9d5){if(_0x1bc9d5){return _0x1bc9d5[_0xee2f('0xb2')](_0x5987bc[_0xee2f('0x68')][_0xee2f('0xb3')],_[_0xee2f('0xb4')](_0x5987bc[_0xee2f('0x68')],[_0xee2f('0xb3'),'id'])||{});}})[_0xee2f('0x22')](respondWithResult(_0x371278,null))['catch'](handleError(_0x371278,null));};exports[_0xee2f('0xb5')]=function(_0x4cd14a,_0x4ba89d,_0x5b52ba){var _0x3e5ed8={'raw':![],'where':{}};var _0x5ca93a={};var _0x209894={'count':0x0,'rows':[]};return db[_0xee2f('0x2f')][_0xee2f('0xb6')]({'where':{'id':_0x4cd14a['params']['id']}})[_0xee2f('0x22')](handleEntityNotFound(_0x4ba89d,null))[_0xee2f('0x22')](function(_0x582dc9){if(_0x582dc9){_0x5ca93a[_0xee2f('0x34')]=_[_0xee2f('0x36')](db[_0xee2f('0xb7')][_0xee2f('0x30')]);_0x5ca93a[_0xee2f('0x35')]=_[_0xee2f('0x36')](_0x4cd14a[_0xee2f('0x35')]);_0x5ca93a['filters']=_[_0xee2f('0x39')](_0x5ca93a[_0xee2f('0x34')],_0x5ca93a['query']);_0x3e5ed8[_0xee2f('0x38')]=_[_0xee2f('0x39')](_0x5ca93a[_0xee2f('0x34')],qs['fields'](_0x4cd14a[_0xee2f('0x35')][_0xee2f('0x3a')]));_0x3e5ed8[_0xee2f('0x38')]=_0x3e5ed8[_0xee2f('0x38')][_0xee2f('0x5b')]?_0x3e5ed8[_0xee2f('0x38')]:_0x5ca93a['model'];if(!_0x4cd14a[_0xee2f('0x35')][_0xee2f('0xb8')](_0xee2f('0xb9'))){_0x3e5ed8['limit']=qs['limit'](_0x4cd14a[_0xee2f('0x35')]['limit']);_0x3e5ed8[_0xee2f('0x1a')]=qs[_0xee2f('0x1a')](_0x4cd14a['query'][_0xee2f('0x1a')]);}_0x3e5ed8[_0xee2f('0x3b')]=qs['sort'](_0x4cd14a['query'][_0xee2f('0x3c')]);_0x3e5ed8[_0xee2f('0x3d')]=qs['filters'](_[_0xee2f('0xba')](_0x4cd14a[_0xee2f('0x35')],_0x5ca93a[_0xee2f('0x37')]));_0x3e5ed8[_0xee2f('0x3d')]['WhatsappInteractionId']=_0x582dc9['id'];if(_0x4cd14a[_0xee2f('0x35')][_0xee2f('0x78')]){_0x3e5ed8[_0xee2f('0x3d')]=_['merge'](_0x3e5ed8[_0xee2f('0x3d')],{'$or':_[_0xee2f('0x28')](_0x3e5ed8[_0xee2f('0x38')],function(_0x2def5c){var _0x5c0f96={};_0x5c0f96[_0x2def5c]={'$like':'%'+_0x4cd14a['query'][_0xee2f('0x78')]+'%'};return _0x5c0f96;})});}if(_0x4cd14a[_0xee2f('0x35')][_0xee2f('0x6f')]){var _0x56abfb=_0x4cd14a[_0xee2f('0x35')][_0xee2f('0x6f')]['split'](',');var _0x969efe={};_0x969efe[_0x56abfb[0x0]]={'$gte':moment(_0x56abfb[0x1])[_0xee2f('0xbb')](_0xee2f('0xbc'))};_0x3e5ed8[_0xee2f('0x3d')]=_[_0xee2f('0x8e')](_0x3e5ed8[_0xee2f('0x3d')],_0x969efe);}_0x3e5ed8=_[_0xee2f('0x8e')]({},_0x3e5ed8,_0x4cd14a[_0xee2f('0xad')]);return db['WhatsappMessage'][_0xee2f('0x19')]({'where':_0x3e5ed8[_0xee2f('0x3d')]})[_0xee2f('0x22')](function(_0x54708b){_0x209894[_0xee2f('0x19')]=_0x54708b;if(_0x4cd14a[_0xee2f('0x35')][_0xee2f('0xab')]){_0x3e5ed8[_0xee2f('0xac')]=[{'all':!![]}];}return db[_0xee2f('0xb7')][_0xee2f('0xbd')](_0x3e5ed8);})[_0xee2f('0x22')](function(_0x3a71fa){_0x209894[_0xee2f('0xbe')]=_0x3a71fa;return _0x209894;});}})[_0xee2f('0x22')](respondWithFilteredResult(_0x4ba89d,_0x3e5ed8))[_0xee2f('0x2d')](handleError(_0x4ba89d,null));};exports[_0xee2f('0xbf')]=function(_0x587c51,_0x354918,_0x59a1ad){return db[_0xee2f('0x2f')][_0xee2f('0x54')]({'where':{'id':_0x587c51['params']['id']}})[_0xee2f('0x22')](handleEntityNotFound(_0x354918,null))[_0xee2f('0x22')](function(_0xe4959b){if(_0xe4959b){return _0xe4959b[_0xee2f('0xc0')](_0x587c51[_0xee2f('0x68')][_0xee2f('0xb3')],_['omit'](_0x587c51[_0xee2f('0x68')],[_0xee2f('0xb3'),'id'])||{})[_0xee2f('0xc1')](function(){return db[_0xee2f('0x62')][_0xee2f('0xbd')]({'attributes':['id',_0xee2f('0x25'),_0xee2f('0xc2')],'where':{'id':_0x587c51[_0xee2f('0x68')][_0xee2f('0xb3')]}});})[_0xee2f('0x22')](function(_0x5b2bcc){socket[_0xee2f('0xc3')](_0xee2f('0xc4'),{'id':Number(_0x587c51[_0xee2f('0xb0')]['id']),'tags':_0x5b2bcc||[]});return{'id':Number(_0x587c51['params']['id']),'tags':_0x5b2bcc||[]};});}})['then'](respondWithResult(_0x354918,null))[_0xee2f('0x2d')](handleError(_0x354918,null));};exports[_0xee2f('0xc5')]=function(_0x46bc74,_0x22e94,_0x24a2f1){return db['WhatsappInteraction'][_0xee2f('0x54')]({'where':{'id':_0x46bc74[_0xee2f('0xb0')]['id']}})['then'](handleEntityNotFound(_0x22e94,null))[_0xee2f('0x22')](function(_0x34c62e){if(_0x34c62e){return _0x34c62e[_0xee2f('0xc5')](_0x46bc74[_0xee2f('0x35')][_0xee2f('0xb3')]);}})[_0xee2f('0x22')](respondWithStatusCode(_0x22e94,null))['catch'](handleError(_0x22e94,null));};exports[_0xee2f('0xc6')]=function(_0x3f7f22,_0x8818db){var _0x2c9f99=moment()[_0xee2f('0xc7')]()[_0xee2f('0xa6')]();var _0xc5a674=path[_0xee2f('0xc8')](config[_0xee2f('0xc9')],_0xee2f('0xca'),_0xee2f('0xcb'),'tmp');var _0x35b763=path[_0xee2f('0xc8')](config[_0xee2f('0xc9')],_0xee2f('0xca'),_0xee2f('0xcb'),_0xee2f('0xcc'));var _0x591334=path[_0xee2f('0xc8')](_0xc5a674,_0x2c9f99);var _0x1d4220=util[_0xee2f('0xbb')](_0xee2f('0xcd'),_0x3f7f22['params']['id'],_0x2c9f99);var _0x45ed8e=path[_0xee2f('0xc8')](_0xc5a674,_0x1d4220);var _0x310943=[];_0x310943[_0xee2f('0xce')]({'model':db[_0xee2f('0x65')],'as':_0xee2f('0x65'),'attributes':['id',_0xee2f('0x29')],'raw':!![]});_0x310943[_0xee2f('0xce')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xee2f('0xcf'),_0xee2f('0xd0')],'raw':!![]});if(_0x3f7f22[_0xee2f('0x35')]['attachments']){_0x310943[_0xee2f('0xce')]({'model':db['Attachment'],'as':_0xee2f('0xd1'),'raw':!![]});}var _0x511520=[{'model':db[_0xee2f('0xb7')],'as':_0xee2f('0xd2'),'attributes':['id','body',_0xee2f('0x6e'),'direction',_0xee2f('0xd3'),'read'],'include':_0x310943}];_0x511520[_0xee2f('0xce')]({'model':db[_0xee2f('0xd4')],'as':_0xee2f('0xd5'),'attributes':['id',_0xee2f('0x25')]});_0x511520[_0xee2f('0xce')]({'model':db['User'],'as':_0xee2f('0xd6'),'attributes':['id',_0xee2f('0x29')]});return db[_0xee2f('0x2f')][_0xee2f('0x54')]({'where':{'id':_0x3f7f22[_0xee2f('0xb0')]['id']},'include':_0x511520})[_0xee2f('0x22')](handleEntityNotFound(_0x8818db,null))['then'](function(_0x58ea7d){if(_0x58ea7d){var _0x215928=_0x58ea7d[_0xee2f('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x591334);var _0x1756b7={'format':'A4','border':_0xee2f('0xd8'),'header':{'height':_0xee2f('0xd9'),'contents':{'first':_0xee2f('0xda')}},'footer':{'height':_0xee2f('0xdb'),'contents':{'default':util[_0xee2f('0xbb')](_0xee2f('0xdc'),util[_0xee2f('0xbb')](_0xee2f('0xdd'),_0xee2f('0xde'),_0x215928['id']),moment()[_0xee2f('0xbb')](_0xee2f('0xdf'))['toString']())}}};var _0x3966f0={'channel':'Whatsapp','account':_0x215928[_0xee2f('0xd5')][_0xee2f('0x25')],'agent':_0x215928['Owner']?_0x215928[_0xee2f('0xd6')]['fullname']:_0xee2f('0xe0'),'createdAt':moment(_0x215928[_0xee2f('0x6e')])[_0xee2f('0xbb')](_0xee2f('0xbc'))['toString'](),'closedAt':_0x215928[_0xee2f('0xe1')]?moment(_0x215928[_0xee2f('0xe2')])[_0xee2f('0xbb')](_0xee2f('0xbc'))[_0xee2f('0xa6')]():'','disposition':_0x215928[_0xee2f('0xe3')],'messages':_(_0x215928['Messages'])[_0xee2f('0x78')]({'secret':![]})['map'](function(_0x2266da){if(_0x2266da[_0xee2f('0xd1')]){var _0x5e2072=path[_0xee2f('0xc8')](_0x35b763,_0x2266da[_0xee2f('0xd1')]['basename']);if(fs['existsSync'](_0x5e2072)){fs[_0xee2f('0xe4')](_0x5e2072)[_0xee2f('0xe5')](fs[_0xee2f('0xe6')](path[_0xee2f('0xc8')](_0x591334,_0x2266da[_0xee2f('0xd1')][_0xee2f('0xe7')])));}}return{'date':moment(_0x2266da['createdAt'])[_0xee2f('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2266da['direction']===_0xee2f('0xe8')?_0x2266da['User']?_0x2266da[_0xee2f('0x65')][_0xee2f('0x29')]:'System':_0x2266da[_0xee2f('0x59')][_0xee2f('0xcf')]+(_0x2266da[_0xee2f('0x59')][_0xee2f('0xd0')]?'\x20'+_0x2266da[_0xee2f('0x59')]['lastName']:''),'body':_0x2266da[_0xee2f('0xd1')]?_0x2266da[_0xee2f('0xd1')][_0xee2f('0xe7')]:_0x2266da[_0xee2f('0x68')],'direction':_0x2266da[_0xee2f('0xe9')]===_0xee2f('0xe8')?'A':'C','secret':_0x2266da[_0xee2f('0xd3')],'read':_0x2266da['read'],'attachment':_0x2266da[_0xee2f('0xd1')]};})[_0xee2f('0x56')]()};return ejs[_0xee2f('0xea')](path[_0xee2f('0xc8')](config[_0xee2f('0xc9')],_0xee2f('0xca'),'views',_0xee2f('0xeb')),{'interaction':_0x3966f0})['then'](function(_0x1a6427){return new BPromise(function(_0x25bd22,_0x5b6668){pdf[_0xee2f('0xae')](_0x1a6427,_0x1756b7)[_0xee2f('0xec')](path['join'](_0x591334,_0xee2f('0xed')+_0x215928['id']+'-'+_0x2c9f99+'.pdf'),function(_0x5f0dcc,_0x2c6b4c){if(_0x5f0dcc)return _0x5b6668(_0x5f0dcc);_0x25bd22(_0x2c6b4c);});});})['then'](function(){return new BPromise(function(_0xf5c03a,_0x59e124){zipdir(_0x591334,{'saveTo':_0x45ed8e},function(_0x1ab0f7,_0x543cfa){if(_0x1ab0f7)return _0x59e124(_0x1ab0f7);return _0xf5c03a(_0x543cfa);});})[_0xee2f('0x22')](function(){return new BPromise(function(_0xca3687,_0x289aa1){rimraf(_0x591334,function(_0xc9a40e){if(_0xc9a40e)_0x289aa1(_0xc9a40e);return _0xca3687();});});})[_0xee2f('0x22')](function(){return _0x8818db[_0xee2f('0xc6')](_0x45ed8e,_0x1d4220,function(_0x2940a0){if(_0x2940a0){console[_0xee2f('0xee')](_0xee2f('0xef'),_0x2940a0);}else{fs[_0xee2f('0xf0')](_0x45ed8e);}});});});}else{return _0x8818db['sendStatus'](0xc8);}})[_0xee2f('0x2d')](handleError(_0x8818db,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ea889a4..46511c3 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 _0x6649=['WhatsappMessage','setMaxListeners','update','remove','getUsers','then','Users','map','findAll','setDataValue','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3996b2,_0x4b4c45){var _0x5bb3f2=function(_0x5c620f){while(--_0x5c620f){_0x3996b2['push'](_0x3996b2['shift']());}};_0x5bb3f2(++_0x4b4c45);}(_0x6649,0x141));var _0x9664=function(_0x58752,_0x193459){_0x58752=_0x58752-0x0;var _0x120949=_0x6649[_0x58752];return _0x120949;};'use strict';var EventEmitter=require(_0x9664('0x0'));var WhatsappInteraction=require(_0x9664('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x9664('0x1'))['db'][_0x9664('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9664('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9664('0x4'),'afterDestroy':_0x9664('0x5')};function emitEvent(_0x587e29){return function(_0x983b3e,_0x3ae99d,_0x34b855){_0x983b3e[_0x9664('0x6')]({'attributes':['id'],'raw':!![]})[_0x9664('0x7')](function(_0x4732a4){_0x983b3e['setDataValue'](_0x9664('0x8'),_0x4732a4[_0x9664('0x9')](function(_0x51ad91){return{'id':_0x51ad91['id']};}));return WhatsappMessage[_0x9664('0xa')]({'where':{'WhatsappInteractionId':_0x983b3e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2d1fe1){_0x983b3e[_0x9664('0xb')]('unreadMessages',_0x2d1fe1[_0x9664('0xc')]);WhatsappInteractionEvents['emit'](_0x587e29+':'+_0x983b3e['id'],_0x983b3e);WhatsappInteractionEvents['emit'](_0x587e29,_0x983b3e);_0x34b855(null);})[_0x9664('0xd')](_0x34b855(null));};}for(var e in events){if(events[_0x9664('0xe')](e)){var event=events[e];WhatsappInteraction[_0x9664('0xf')](e,emitEvent(event));}}module[_0x9664('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x7d1a=['catch','hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x7d1a,0x7a));var _0xa7d1=function(_0x4e1953,_0x5cf205){_0x4e1953=_0x4e1953-0x0;var _0x524406=_0x7d1a[_0x4e1953];return _0x524406;};'use strict';var EventEmitter=require(_0xa7d1('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0xa7d1('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa7d1('0x2')](0x0);var events={'afterCreate':_0xa7d1('0x3'),'afterUpdate':_0xa7d1('0x4'),'afterDestroy':_0xa7d1('0x5')};function emitEvent(_0x1dab9c){return function(_0x43e687,_0x3308d4,_0x2579c2){_0x43e687[_0xa7d1('0x6')]({'attributes':['id'],'raw':!![]})[_0xa7d1('0x7')](function(_0x3cb8e9){_0x43e687['setDataValue'](_0xa7d1('0x8'),_0x3cb8e9[_0xa7d1('0x9')](function(_0x282682){return{'id':_0x282682['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x43e687['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa7d1('0x7')](function(_0x556dca){_0x43e687[_0xa7d1('0xa')](_0xa7d1('0xb'),_0x556dca[_0xa7d1('0xc')]);WhatsappInteractionEvents[_0xa7d1('0xd')](_0x1dab9c+':'+_0x43e687['id'],_0x43e687);WhatsappInteractionEvents[_0xa7d1('0xd')](_0x1dab9c,_0x43e687);_0x2579c2(null);})[_0xa7d1('0xe')](_0x2579c2(null));};}for(var e in events){if(events[_0xa7d1('0xf')](e)){var event=events[e];WhatsappInteraction[_0xa7d1('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3fad6d4..372b923 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 _0x612f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xb6c3a7,_0x5a3390){var _0x311f0f=function(_0x49101b){while(--_0x49101b){_0xb6c3a7['push'](_0xb6c3a7['shift']());}};_0x311f0f(++_0x5a3390);}(_0x612f,0xab));var _0xf612=function(_0xa0f0fe,_0x147d88){_0xa0f0fe=_0xa0f0fe-0x0;var _0x824abf=_0x612f[_0xa0f0fe];return _0x824abf;};'use strict';var _=require(_0xf612('0x0'));var util=require(_0xf612('0x1'));var logger=require(_0xf612('0x2'))(_0xf612('0x3'));var moment=require(_0xf612('0x4'));var BPromise=require(_0xf612('0x5'));var rp=require(_0xf612('0x6'));var fs=require('fs');var path=require(_0xf612('0x7'));var rimraf=require('rimraf');var config=require(_0xf612('0x8'));var attributes=require(_0xf612('0x9'));module[_0xf612('0xa')]=function(_0x4ce88c,_0xe0459c){return _0x4ce88c[_0xf612('0xb')](_0xf612('0xc'),attributes,{'tableName':_0xf612('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x425a62,_0x9276e8,_0x400606){if(_0x425a62[_0xf612('0xe')](_0xf612('0xf'))){_0x425a62[_0xf612('0x10')]=moment()[_0xf612('0x11')](_0xf612('0x12'));}_0x400606(null,_0x425a62);}}});}; \ No newline at end of file +var _0x2496=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappInteraction','changed','closed','closedAt'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x2496,0xa7));var _0x6249=function(_0x3af2a6,_0x407540){_0x3af2a6=_0x3af2a6-0x0;var _0x4eaa15=_0x2496[_0x3af2a6];return _0x4eaa15;};'use strict';var _=require(_0x6249('0x0'));var util=require('util');var logger=require(_0x6249('0x1'))(_0x6249('0x2'));var moment=require(_0x6249('0x3'));var BPromise=require(_0x6249('0x4'));var rp=require(_0x6249('0x5'));var fs=require('fs');var path=require(_0x6249('0x6'));var rimraf=require(_0x6249('0x7'));var config=require(_0x6249('0x8'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x5e90a6,_0x26096a){return _0x5e90a6['define'](_0x6249('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x523d56,_0x3a9260,_0x342fa0){if(_0x523d56[_0x6249('0xa')](_0x6249('0xb'))){_0x523d56[_0x6249('0xc')]=moment()[_0x6249('0xd')](_0x6249('0xe'));}_0x342fa0(null,_0x523d56);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 656d918..a2762a2 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 _0x1ea7=['localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','body','omit','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ea7,0x9a));var _0x71ea=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x1ea7[_0x4c7935];return _0x30651d;};'use strict';var _=require('lodash');var util=require(_0x71ea('0x0'));var moment=require('moment');var BPromise=require(_0x71ea('0x1'));var rs=require(_0x71ea('0x2'));var fs=require('fs');var Redis=require(_0x71ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x71ea('0x4'));var logger=require(_0x71ea('0x5'))('rpc');var config=require(_0x71ea('0x6'));var jayson=require(_0x71ea('0x7'));var client=jayson['client'][_0x71ea('0x8')]({'port':0x232a});config[_0x71ea('0x9')]=_['defaults'](config[_0x71ea('0x9')],{'host':_0x71ea('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71ea('0x9')]));require(_0x71ea('0xb'))[_0x71ea('0xc')](socket);function respondWithRpcPromise(_0x2607c9,_0x20241d,_0x5b6efc){return new BPromise(function(_0x47cb1a,_0x376aa0){return client[_0x71ea('0xd')](_0x2607c9,_0x5b6efc)[_0x71ea('0xe')](function(_0x227dc7){logger[_0x71ea('0xf')](_0x71ea('0x10'),_0x20241d,_0x71ea('0x11'));logger[_0x71ea('0x12')](_0x71ea('0x13'),_0x20241d,_0x71ea('0x11'),JSON[_0x71ea('0x14')](_0x227dc7));if(_0x227dc7[_0x71ea('0x15')]){if(_0x227dc7[_0x71ea('0x15')][_0x71ea('0x16')]===0x1f4){logger[_0x71ea('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x20241d,_0x227dc7['error'][_0x71ea('0x17')]);return _0x376aa0(_0x227dc7['error'][_0x71ea('0x17')]);}logger['error'](_0x71ea('0x10'),_0x20241d,_0x227dc7[_0x71ea('0x15')][_0x71ea('0x17')]);return _0x47cb1a(_0x227dc7[_0x71ea('0x15')][_0x71ea('0x17')]);}else{logger[_0x71ea('0xf')](_0x71ea('0x10'),_0x20241d,_0x71ea('0x11'));_0x47cb1a(_0x227dc7[_0x71ea('0x18')][_0x71ea('0x17')]);}})[_0x71ea('0x19')](function(_0x317424){logger[_0x71ea('0x15')](_0x71ea('0x10'),_0x20241d,_0x317424);_0x376aa0(_0x317424);});});}exports['UpdateWhatsappInteraction']=function(_0x3034c4){var _0x2e6545=this;return new Promise(function(_0x683a0,_0x307153){return db[_0x71ea('0x1a')]['update'](_0x3034c4['body'],{'raw':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1d')]||null:null,'attributes':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1e')]||null:null,'limit':_0x3034c4[_0x71ea('0x1b')]?_0x3034c4[_0x71ea('0x1b')][_0x71ea('0x1f')]||null:null})[_0x71ea('0xe')](function(_0x48631f){logger[_0x71ea('0xf')](_0x71ea('0x20'),_0x3034c4);logger[_0x71ea('0x12')](_0x71ea('0x20'),_0x3034c4,JSON[_0x71ea('0x14')](_0x48631f));_0x683a0(_0x48631f);})[_0x71ea('0x19')](function(_0x1a1882){logger[_0x71ea('0x15')](_0x71ea('0x20'),_0x1a1882[_0x71ea('0x17')],_0x3034c4);_0x307153(_0x2e6545[_0x71ea('0x15')](0x1f4,_0x1a1882[_0x71ea('0x17')]));});});};exports[_0x71ea('0x21')]=function(_0x36a340){return new Promise(function(_0x1c5abf,_0x4e5cf2){return db[_0x71ea('0x1a')][_0x71ea('0x22')]({'where':_0x36a340[_0x71ea('0x1b')]?_0x36a340[_0x71ea('0x1b')][_0x71ea('0x1d')]||null:null})[_0x71ea('0xe')](function(_0xd61495){if(_0xd61495){return _0xd61495[_0x71ea('0x23')](_0x36a340[_0x71ea('0x24')]['ids'],_[_0x71ea('0x25')](_0x36a340[_0x71ea('0x24')],[_0x71ea('0x26'),'id'])||{});}})[_0x71ea('0x27')](function(_0x15aab7){logger[_0x71ea('0xf')](_0x71ea('0x28'),_0x36a340);logger[_0x71ea('0x12')](_0x71ea('0x28'),_0x36a340,JSON[_0x71ea('0x14')](_0x15aab7));_0x1c5abf(_0x15aab7);})['catch'](function(_0x1e574e){logger['error'](_0x71ea('0x28'),_0x1e574e[_0x71ea('0x17')],_0x36a340);_0x4e5cf2(_this[_0x71ea('0x15')](0x1f4,_0x1e574e[_0x71ea('0x17')]));});});}; \ No newline at end of file +var _0x4fc7=['register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction','WhatsappInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket'];(function(_0x2b8388,_0x246b8f){var _0x3ba12a=function(_0x848995){while(--_0x848995){_0x2b8388['push'](_0x2b8388['shift']());}};_0x3ba12a(++_0x246b8f);}(_0x4fc7,0x164));var _0x74fc=function(_0x4e3696,_0x373ca2){_0x4e3696=_0x4e3696-0x0;var _0x43ab70=_0x4fc7[_0x4e3696];return _0x43ab70;};'use strict';var _=require(_0x74fc('0x0'));var util=require(_0x74fc('0x1'));var moment=require(_0x74fc('0x2'));var BPromise=require(_0x74fc('0x3'));var rs=require(_0x74fc('0x4'));var fs=require('fs');var Redis=require(_0x74fc('0x5'));var db=require(_0x74fc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x74fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x74fc('0x8')]['http']({'port':0x232a});config[_0x74fc('0x9')]=_[_0x74fc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x74fc('0xb'))(new Redis(config['redis']));require(_0x74fc('0xc'))[_0x74fc('0xd')](socket);function respondWithRpcPromise(_0x18e745,_0x26041e,_0x15b841){return new BPromise(function(_0x2498ab,_0x53c594){return client[_0x74fc('0xe')](_0x18e745,_0x15b841)['then'](function(_0x21fc0f){logger[_0x74fc('0xf')](_0x74fc('0x10'),_0x26041e,_0x74fc('0x11'));logger[_0x74fc('0x12')](_0x74fc('0x13'),_0x26041e,_0x74fc('0x11'),JSON[_0x74fc('0x14')](_0x21fc0f));if(_0x21fc0f['error']){if(_0x21fc0f['error'][_0x74fc('0x15')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x26041e,_0x21fc0f[_0x74fc('0x16')][_0x74fc('0x17')]);return _0x53c594(_0x21fc0f[_0x74fc('0x16')][_0x74fc('0x17')]);}logger[_0x74fc('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x26041e,_0x21fc0f['error']['message']);return _0x2498ab(_0x21fc0f[_0x74fc('0x16')]['message']);}else{logger[_0x74fc('0xf')](_0x74fc('0x10'),_0x26041e,_0x74fc('0x11'));_0x2498ab(_0x21fc0f[_0x74fc('0x18')][_0x74fc('0x17')]);}})[_0x74fc('0x19')](function(_0x55f317){logger['error'](_0x74fc('0x10'),_0x26041e,_0x55f317);_0x53c594(_0x55f317);});});}exports[_0x74fc('0x1a')]=function(_0x3c34e0){var _0x114b5c=this;return new Promise(function(_0x4638f2,_0x4dcb12){return db['WhatsappInteraction'][_0x74fc('0x1b')](_0x3c34e0[_0x74fc('0x1c')],{'raw':_0x3c34e0[_0x74fc('0x1d')]?_0x3c34e0[_0x74fc('0x1d')][_0x74fc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c34e0[_0x74fc('0x1d')]?_0x3c34e0[_0x74fc('0x1d')][_0x74fc('0x1f')]||null:null,'attributes':_0x3c34e0[_0x74fc('0x1d')]?_0x3c34e0[_0x74fc('0x1d')][_0x74fc('0x20')]||null:null,'limit':_0x3c34e0[_0x74fc('0x1d')]?_0x3c34e0[_0x74fc('0x1d')][_0x74fc('0x21')]||null:null})[_0x74fc('0x22')](function(_0x262a49){logger[_0x74fc('0xf')]('UpdateWhatsappInteraction',_0x3c34e0);logger[_0x74fc('0x12')](_0x74fc('0x1a'),_0x3c34e0,JSON['stringify'](_0x262a49));_0x4638f2(_0x262a49);})[_0x74fc('0x19')](function(_0x25a527){logger['error']('UpdateWhatsappInteraction',_0x25a527[_0x74fc('0x17')],_0x3c34e0);_0x4dcb12(_0x114b5c[_0x74fc('0x16')](0x1f4,_0x25a527[_0x74fc('0x17')]));});});};exports[_0x74fc('0x23')]=function(_0x322bc6){return new Promise(function(_0x53b1c2,_0x4e590d){return db[_0x74fc('0x24')]['find']({'where':_0x322bc6[_0x74fc('0x1d')]?_0x322bc6['options'][_0x74fc('0x1f')]||null:null})['then'](function(_0x12bd0c){if(_0x12bd0c){return _0x12bd0c[_0x74fc('0x25')](_0x322bc6[_0x74fc('0x1c')][_0x74fc('0x26')],_[_0x74fc('0x27')](_0x322bc6[_0x74fc('0x1c')],['ids','id'])||{});}})['spread'](function(_0x453e9e){logger['info'](_0x74fc('0x28'),_0x322bc6);logger['debug'](_0x74fc('0x28'),_0x322bc6,JSON[_0x74fc('0x14')](_0x453e9e));_0x53b1c2(_0x453e9e);})[_0x74fc('0x19')](function(_0x74c273){logger['error']('AddTags',_0x74c273[_0x74fc('0x17')],_0x322bc6);_0x4e590d(_this[_0x74fc('0x16')](0x1f4,_0x74c273[_0x74fc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 392b3a0..f38b73d 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 _0xcd1d=['./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x2ac9cf,_0x5824ce){var _0x587aa0=function(_0x18369e){while(--_0x18369e){_0x2ac9cf['push'](_0x2ac9cf['shift']());}};_0x587aa0(++_0x5824ce);}(_0xcd1d,0x132));var _0xdcd1=function(_0xdba8c2,_0x5c9660){_0xdba8c2=_0xdba8c2-0x0;var _0x124afe=_0xcd1d[_0xdba8c2];return _0x124afe;};'use strict';var WhatsappInteractionEvents=require(_0xdcd1('0x0'));var events=[_0xdcd1('0x1'),_0xdcd1('0x2'),_0xdcd1('0x3')];function createListener(_0xcd4b0c,_0x48b074){return function(_0x391a0b){_0x48b074[_0xdcd1('0x4')](_0xcd4b0c,_0x391a0b);};}function removeListener(_0x4689e7,_0x366449){return function(){WhatsappInteractionEvents[_0xdcd1('0x5')](_0x4689e7,_0x366449);};}exports[_0xdcd1('0x6')]=function(_0x101ea8){for(var _0xa803c5=0x0,_0x4785a7=events[_0xdcd1('0x7')];_0xa803c5<_0x4785a7;_0xa803c5++){var _0x1af018=events[_0xa803c5];var _0x6a7515=createListener(_0xdcd1('0x8')+_0x1af018,_0x101ea8);WhatsappInteractionEvents['on'](_0x1af018,_0x6a7515);}}; \ No newline at end of file +var _0xc374=['whatsappInteraction:','./whatsappInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x30680a,_0x4b6e66){var _0x3c689e=function(_0x2c10b2){while(--_0x2c10b2){_0x30680a['push'](_0x30680a['shift']());}};_0x3c689e(++_0x4b6e66);}(_0xc374,0x119));var _0x4c37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc374[_0x321bb2];return _0x9c12ed;};'use strict';var WhatsappInteractionEvents=require(_0x4c37('0x0'));var events=[_0x4c37('0x1'),'remove',_0x4c37('0x2')];function createListener(_0x190ef1,_0x3ab32d){return function(_0x1e5e3c){_0x3ab32d[_0x4c37('0x3')](_0x190ef1,_0x1e5e3c);};}function removeListener(_0x4f71a5,_0x56df6f){return function(){WhatsappInteractionEvents[_0x4c37('0x4')](_0x4f71a5,_0x56df6f);};}exports[_0x4c37('0x5')]=function(_0x3aada8){for(var _0x3ff70c=0x0,_0x49341f=events[_0x4c37('0x6')];_0x3ff70c<_0x49341f;_0x3ff70c++){var _0x444112=events[_0x3ff70c];var _0x4b9f38=createListener(_0x4c37('0x7')+_0x444112,_0x3aada8);WhatsappInteractionEvents['on'](_0x444112,_0x4b9f38);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index bd31c33..8d15a99 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 _0x4ea5=['/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','post','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x1a162b,_0x38599d){var _0x4cdc7d=function(_0x30ea26){while(--_0x30ea26){_0x1a162b['push'](_0x1a162b['shift']());}};_0x4cdc7d(++_0x38599d);}(_0x4ea5,0x1b3));var _0x54ea=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x4ea5[_0x11f249];return _0x5c3656;};'use strict';var multer=require(_0x54ea('0x0'));var util=require(_0x54ea('0x1'));var path=require(_0x54ea('0x2'));var timeout=require(_0x54ea('0x3'));var express=require(_0x54ea('0x4'));var router=express[_0x54ea('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x54ea('0x6'));var config=require('../../config/environment');var controller=require(_0x54ea('0x7'));router[_0x54ea('0x8')]('/',auth[_0x54ea('0x9')](),controller['index']);router[_0x54ea('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x54ea('0xa')]);router['get'](_0x54ea('0xb'),auth[_0x54ea('0x9')](),controller['show']);router[_0x54ea('0xc')]('/',auth[_0x54ea('0x9')](),interaction['tracked']('whatsapp',_0x54ea('0xd')),controller[_0x54ea('0xe')]);router[_0x54ea('0xc')](_0x54ea('0xf'),controller[_0x54ea('0x10')]);router[_0x54ea('0x11')](_0x54ea('0xb'),auth[_0x54ea('0x9')](),controller[_0x54ea('0x12')]);router[_0x54ea('0x11')](_0x54ea('0x13'),auth[_0x54ea('0x9')](),controller[_0x54ea('0x14')]);router[_0x54ea('0x11')](_0x54ea('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x54ea('0x16')](_0x54ea('0xb'),auth[_0x54ea('0x9')](),controller[_0x54ea('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0bba=['/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0x0bba,0xe9));var _0xa0bb=function(_0x5cc476,_0x5cb983){_0x5cc476=_0x5cc476-0x0;var _0x3ab3b5=_0x0bba[_0x5cc476];return _0x3ab3b5;};'use strict';var multer=require(_0xa0bb('0x0'));var util=require(_0xa0bb('0x1'));var path=require(_0xa0bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xa0bb('0x3'));var router=express['Router']();var auth=require(_0xa0bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0bb('0x5'));var controller=require('./whatsappMessage.controller');router[_0xa0bb('0x6')]('/',auth[_0xa0bb('0x7')](),controller[_0xa0bb('0x8')]);router[_0xa0bb('0x6')](_0xa0bb('0x9'),auth[_0xa0bb('0x7')](),controller['describe']);router[_0xa0bb('0x6')](_0xa0bb('0xa'),auth[_0xa0bb('0x7')](),controller[_0xa0bb('0xb')]);router[_0xa0bb('0xc')]('/',auth[_0xa0bb('0x7')](),interaction[_0xa0bb('0xd')](_0xa0bb('0xe'),_0xa0bb('0xf')),controller[_0xa0bb('0x10')]);router[_0xa0bb('0xc')](_0xa0bb('0x11'),controller[_0xa0bb('0x12')]);router[_0xa0bb('0x13')](_0xa0bb('0xa'),auth['isAuthenticated'](),controller[_0xa0bb('0x14')]);router[_0xa0bb('0x13')](_0xa0bb('0x15'),auth[_0xa0bb('0x7')](),controller[_0xa0bb('0x16')]);router[_0xa0bb('0x13')](_0xa0bb('0x17'),auth[_0xa0bb('0x7')](),controller['reject']);router[_0xa0bb('0x18')](_0xa0bb('0xa'),auth[_0xa0bb('0x7')](),controller[_0xa0bb('0x19')]);module[_0xa0bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3044b70..3d1d0cc 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 _0xd619=['exports','TEXT','medium','out','DATE','BOOLEAN','STRING','sequelize'];(function(_0x2f27f7,_0x3d9477){var _0x2ee282=function(_0x27e884){while(--_0x27e884){_0x2f27f7['push'](_0x2f27f7['shift']());}};_0x2ee282(++_0x3d9477);}(_0xd619,0x1df));var _0x9d61=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xd619[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x9d61('0x0'));module[_0x9d61('0x1')]={'body':{'type':Sequelize[_0x9d61('0x2')](_0x9d61('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9d61('0x4')),'defaultValue':_0x9d61('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x9d61('0x5')]},'secret':{'type':Sequelize[_0x9d61('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9d61('0x7')]},'providerResponse':{'type':Sequelize[_0x9d61('0x2')]}}; \ No newline at end of file +var _0x6954=['exports','TEXT','ENUM','out','STRING'];(function(_0x1b4881,_0xb3e82c){var _0x11a4cd=function(_0x2a3ab7){while(--_0x2a3ab7){_0x1b4881['push'](_0x1b4881['shift']());}};_0x11a4cd(++_0xb3e82c);}(_0x6954,0x118));var _0x4695=function(_0x400c15,_0x40e31d){_0x400c15=_0x400c15-0x0;var _0x1f521e=_0x6954[_0x400c15];return _0x1f521e;};'use strict';var Sequelize=require('sequelize');module[_0x4695('0x0')]={'body':{'type':Sequelize[_0x4695('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4695('0x2')]('in','out'),'defaultValue':_0x4695('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x4695('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4695('0x4')]},'providerResponse':{'type':Sequelize[_0x4695('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index abdf9c5..c7fc2e0 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 _0x16a2=['error','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','catch','show','params','keys','options','find','create','body','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','role','rejectMessage','event','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappMessage.socket','jayson/promise','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x34aacf,_0x517157){var _0x27fa56=function(_0x4b0c30){while(--_0x4b0c30){_0x34aacf['push'](_0x34aacf['shift']());}};_0x27fa56(++_0x517157);}(_0x16a2,0x1d0));var _0x216a=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x16a2[_0x48c4ef];return _0x435715;};'use strict';var pdf=require(_0x216a('0x0'));var emlformat=require(_0x216a('0x1'));var rimraf=require(_0x216a('0x2'));var zipdir=require(_0x216a('0x3'));var jsonpatch=require(_0x216a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x216a('0x5'));var Mustache=require(_0x216a('0x6'));var util=require(_0x216a('0x7'));var path=require(_0x216a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x216a('0x9'));var fs=require('fs');var _=require(_0x216a('0xa'));var squel=require(_0x216a('0xb'));var crypto=require('crypto');var jsforce=require(_0x216a('0xc'));var deskjs=require(_0x216a('0xd'));var toCsv=require(_0x216a('0xe'));var querystring=require(_0x216a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x216a('0x10'));var qs=require(_0x216a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216a('0x12'));var logger=require(_0x216a('0x13'))(_0x216a('0x14'));var utils=require(_0x216a('0x15'));var config=require(_0x216a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x216a('0x17'))['db'];config[_0x216a('0x18')]=_['defaults'](config[_0x216a('0x18')],{'host':_0x216a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x216a('0x18')]));require(_0x216a('0x1a'))['register'](socket);var jayson=require(_0x216a('0x1b'));var client=jayson['client'][_0x216a('0x1c')]({'port':0x232c});var client9002=jayson[_0x216a('0x1d')][_0x216a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x10de53,_0x4dedd0,_0x46f19d,_0x263c8e){return new BPromise(function(_0x4c1a4d,_0x167e71){var _0x56debf=_0x263c8e||client;return _0x56debf[_0x216a('0x1e')](_0x10de53,_0x46f19d)['then'](function(_0x35f178){logger[_0x216a('0x1f')](_0x216a('0x20'),_0x4dedd0,_0x216a('0x21'));logger[_0x216a('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4dedd0,_0x216a('0x21'),JSON[_0x216a('0x23')](_0x35f178));if(_0x35f178[_0x216a('0x24')]){if(_0x35f178[_0x216a('0x24')]['code']===0x1f4){logger[_0x216a('0x24')](_0x216a('0x20'),_0x4dedd0,_0x35f178[_0x216a('0x24')][_0x216a('0x25')]);return _0x167e71(_0x35f178[_0x216a('0x24')][_0x216a('0x25')]);}logger[_0x216a('0x24')](_0x216a('0x20'),_0x4dedd0,_0x35f178[_0x216a('0x24')][_0x216a('0x25')]);return _0x4c1a4d(_0x35f178[_0x216a('0x24')]['message']);}else{logger[_0x216a('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x4dedd0,_0x216a('0x21'));_0x4c1a4d(_0x35f178[_0x216a('0x26')][_0x216a('0x25')]);}})['catch'](function(_0x23b673){logger['error'](_0x216a('0x20'),_0x4dedd0,_0x23b673);_0x167e71(_0x23b673);});});}function respondWithStatusCode(_0x495422,_0x36aa14){_0x36aa14=_0x36aa14||0xcc;return function(_0x5f0257){if(_0x5f0257){return _0x495422[_0x216a('0x27')](_0x36aa14);}return _0x495422[_0x216a('0x28')](_0x36aa14)['end']();};}function respondWithResult(_0x23fe29,_0x16004b){_0x16004b=_0x16004b||0xc8;return function(_0xba4220){if(_0xba4220){return _0x23fe29[_0x216a('0x28')](_0x16004b)[_0x216a('0x29')](_0xba4220);}};}function respondWithFilteredResult(_0x530c76,_0x4bde64){return function(_0x689e71){if(_0x689e71){var _0x56a81c=_0x689e71[_0x216a('0x2a')],_0x32f3b1=_0x4bde64[_0x216a('0x2b')],_0x4e10a8=_0x4bde64[_0x216a('0x2b')]+_0x4bde64[_0x216a('0x2c')],_0x4eca2a;if(_0x4e10a8>=_0x56a81c){_0x4e10a8=_0x56a81c;_0x4eca2a=0xc8;}else{_0x4eca2a=0xce;}_0x530c76['status'](_0x4eca2a);return _0x530c76[_0x216a('0x2d')](_0x216a('0x2e'),_0x32f3b1+'-'+_0x4e10a8+'/'+_0x56a81c)[_0x216a('0x29')](_0x689e71);}return null;};}function patchUpdates(_0x4f63e0){return function(_0x4f1776){try{jsonpatch['apply'](_0x4f1776,_0x4f63e0,!![]);}catch(_0x1b967c){return BPromise[_0x216a('0x2f')](_0x1b967c);}return _0x4f1776[_0x216a('0x30')]();};}function saveUpdates(_0x1881a8,_0x393568){return function(_0x4d123b){if(_0x4d123b){return _0x4d123b[_0x216a('0x31')](_0x1881a8)[_0x216a('0x32')](function(_0x2ffddb){return _0x2ffddb;});}return null;};}function removeEntity(_0x4d1ffc,_0x41a1b3){return function(_0x46cc50){if(_0x46cc50){return _0x46cc50[_0x216a('0x33')]()[_0x216a('0x32')](function(){_0x4d1ffc['status'](0xcc)[_0x216a('0x34')]();});}};}function handleEntityNotFound(_0x1774ce,_0x73aef4){return function(_0x376ac7){if(!_0x376ac7){_0x1774ce[_0x216a('0x27')](0x194);}return _0x376ac7;};}function handleError(_0x27b03b,_0x459891){_0x459891=_0x459891||0x1f4;return function(_0x5b760c){logger[_0x216a('0x24')](_0x5b760c[_0x216a('0x35')]);if(_0x5b760c['name']){delete _0x5b760c[_0x216a('0x36')];}_0x27b03b[_0x216a('0x28')](_0x459891)['send'](_0x5b760c);};}exports[_0x216a('0x37')]=function(_0x40a50f,_0x428790){var _0x3d5fdb={},_0x3d708f={},_0x5360f5={'count':0x0,'rows':[]};var _0x520873=_[_0x216a('0x38')](db[_0x216a('0x39')][_0x216a('0x3a')],function(_0xdcc1a){return{'name':_0xdcc1a[_0x216a('0x3b')],'type':_0xdcc1a[_0x216a('0x3c')]['key']};});_0x3d708f[_0x216a('0x3d')]=_['map'](_0x520873,_0x216a('0x36'));_0x3d708f[_0x216a('0x3e')]=_['keys'](_0x40a50f[_0x216a('0x3e')]);_0x3d708f[_0x216a('0x3f')]=_[_0x216a('0x40')](_0x3d708f[_0x216a('0x3d')],_0x3d708f[_0x216a('0x3e')]);_0x3d5fdb['attributes']=_[_0x216a('0x40')](_0x3d708f[_0x216a('0x3d')],qs[_0x216a('0x41')](_0x40a50f[_0x216a('0x3e')][_0x216a('0x41')]));_0x3d5fdb['attributes']=_0x3d5fdb[_0x216a('0x42')][_0x216a('0x43')]?_0x3d5fdb['attributes']:_0x3d708f[_0x216a('0x3d')];if(!_0x40a50f['query']['hasOwnProperty'](_0x216a('0x44'))){_0x3d5fdb[_0x216a('0x2c')]=qs[_0x216a('0x2c')](_0x40a50f['query']['limit']);_0x3d5fdb[_0x216a('0x2b')]=qs[_0x216a('0x2b')](_0x40a50f[_0x216a('0x3e')][_0x216a('0x2b')]);}_0x3d5fdb[_0x216a('0x45')]=qs[_0x216a('0x46')](_0x40a50f[_0x216a('0x3e')][_0x216a('0x46')]);_0x3d5fdb[_0x216a('0x47')]=qs[_0x216a('0x3f')](_[_0x216a('0x48')](_0x40a50f['query'],_0x3d708f[_0x216a('0x3f')]),_0x520873);if(_0x40a50f[_0x216a('0x3e')]['filter']){_0x3d5fdb[_0x216a('0x47')]=_[_0x216a('0x49')](_0x3d5fdb['where'],{'$or':_[_0x216a('0x38')](_0x520873,function(_0x222e08){if(_0x222e08[_0x216a('0x3c')]!==_0x216a('0x4a')){var _0x7ff1c8={};_0x7ff1c8[_0x222e08[_0x216a('0x36')]]={'$like':'%'+_0x40a50f[_0x216a('0x3e')][_0x216a('0x4b')]+'%'};return _0x7ff1c8;}})});}_0x3d5fdb=_[_0x216a('0x49')]({},_0x3d5fdb,_0x40a50f['options']);var _0x2efc7e={'where':_0x3d5fdb[_0x216a('0x47')]};return db[_0x216a('0x39')][_0x216a('0x2a')](_0x2efc7e)[_0x216a('0x32')](function(_0x4208fb){_0x5360f5[_0x216a('0x2a')]=_0x4208fb;if(_0x40a50f[_0x216a('0x3e')]['includeAll']){_0x3d5fdb['include']=[{'all':!![]}];}return db[_0x216a('0x39')][_0x216a('0x4c')](_0x3d5fdb);})[_0x216a('0x32')](function(_0x55204f){_0x5360f5['rows']=_0x55204f;return _0x5360f5;})[_0x216a('0x32')](respondWithFilteredResult(_0x428790,_0x3d5fdb))[_0x216a('0x4d')](handleError(_0x428790,null));};exports[_0x216a('0x4e')]=function(_0x3f3ae8,_0x4153e6){var _0xb0578b={'raw':!![],'where':{'id':_0x3f3ae8[_0x216a('0x4f')]['id']}},_0x707850={};_0x707850['model']=_['keys'](db[_0x216a('0x39')][_0x216a('0x3a')]);_0x707850['query']=_[_0x216a('0x50')](_0x3f3ae8[_0x216a('0x3e')]);_0x707850['filters']=_[_0x216a('0x40')](_0x707850[_0x216a('0x3d')],_0x707850['query']);_0xb0578b[_0x216a('0x42')]=_[_0x216a('0x40')](_0x707850[_0x216a('0x3d')],qs[_0x216a('0x41')](_0x3f3ae8[_0x216a('0x3e')][_0x216a('0x41')]));_0xb0578b[_0x216a('0x42')]=_0xb0578b[_0x216a('0x42')][_0x216a('0x43')]?_0xb0578b[_0x216a('0x42')]:_0x707850[_0x216a('0x3d')];if(_0x3f3ae8[_0x216a('0x3e')]['includeAll']){_0xb0578b['include']=[{'all':!![]}];}_0xb0578b=_[_0x216a('0x49')]({},_0xb0578b,_0x3f3ae8[_0x216a('0x51')]);return db[_0x216a('0x39')][_0x216a('0x52')](_0xb0578b)['then'](handleEntityNotFound(_0x4153e6,null))[_0x216a('0x32')](respondWithResult(_0x4153e6,null))['catch'](handleError(_0x4153e6,null));};exports[_0x216a('0x53')]=function(_0x5c407f,_0x4d2c16){return db[_0x216a('0x39')][_0x216a('0x53')](_0x5c407f[_0x216a('0x54')],{})[_0x216a('0x32')](respondWithResult(_0x4d2c16,0xc9))[_0x216a('0x4d')](handleError(_0x4d2c16,null));};exports[_0x216a('0x31')]=function(_0x46b152,_0x2d1af5){if(_0x46b152[_0x216a('0x54')]['id']){delete _0x46b152[_0x216a('0x54')]['id'];}return db[_0x216a('0x39')][_0x216a('0x52')]({'where':{'id':_0x46b152[_0x216a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d1af5,null))[_0x216a('0x32')](saveUpdates(_0x46b152[_0x216a('0x54')],null))['then'](respondWithResult(_0x2d1af5,null))['catch'](handleError(_0x2d1af5,null));};exports['destroy']=function(_0x559a55,_0x373e02){return db[_0x216a('0x39')][_0x216a('0x52')]({'where':{'id':_0x559a55[_0x216a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x373e02,null))[_0x216a('0x32')](removeEntity(_0x373e02,null))[_0x216a('0x4d')](handleError(_0x373e02,null));};exports[_0x216a('0x55')]=function(_0x4c76fa,_0x221087){return db[_0x216a('0x39')][_0x216a('0x55')]()[_0x216a('0x32')](respondWithResult(_0x221087,null))[_0x216a('0x4d')](handleError(_0x221087,null));};var interaction_log=require(_0x216a('0x13'))(_0x216a('0x56'));exports['accept']=function(_0x5dec32,_0x3f6e4a,_0x5089f6){var _0x569552={'agent':{},'channel':_0x216a('0x57')};if(_0x5dec32[_0x216a('0x54')]['id']){delete _0x5dec32[_0x216a('0x54')]['id'];}_0x5dec32[_0x216a('0x54')]['read']=!![];_0x5dec32[_0x216a('0x54')][_0x216a('0x58')]=moment()[_0x216a('0x59')](_0x216a('0x5a'));_0x5dec32[_0x216a('0x54')]['UserId']=_0x5dec32[_0x216a('0x54')][_0x216a('0x5b')]||_0x5dec32[_0x216a('0x5c')]['id'];_0x569552[_0x216a('0x5d')]['id']=_0x5dec32[_0x216a('0x54')][_0x216a('0x5b')];return db['WhatsappMessage'][_0x216a('0x52')]({'where':{'id':_0x5dec32['params']['id'],'UserId':null},'include':[{'model':db[_0x216a('0x5e')],'as':_0x216a('0x5f')}]})['then'](handleEntityNotFound(_0x3f6e4a,null))[_0x216a('0x32')](saveUpdates(_0x5dec32['body'],null))[_0x216a('0x32')](function(_0x1c0855){if(_0x1c0855){_0x569552[_0x216a('0x25')]=_0x1c0855['get']({'plain':!![]});return db[_0x216a('0x60')][_0x216a('0x52')]({'where':{'id':_0x1c0855[_0x216a('0x61')]}});}return null;})[_0x216a('0x32')](handleEntityNotFound(_0x3f6e4a,null))['then'](function(_0x5b3842){if(_0x5b3842){return _0x5b3842[_0x216a('0x31')]({'UserId':_0x5dec32['body'][_0x216a('0x5b')],'read1stAt':_[_0x216a('0x62')](_0x5b3842[_0x216a('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5c109b){if(_0x5c109b){_0x569552[_0x216a('0x64')]=_0x5c109b[_0x216a('0x65')]({'plain':!![]});interaction_log[_0x216a('0x1f')](_0x216a('0x66'),_0x5dec32[_0x216a('0x5c')]['id'],_0x5dec32[_0x216a('0x5c')][_0x216a('0x36')],_0x5dec32[_0x216a('0x5c')]['role'],_0x569552['interaction']['id'],_0x5dec32['body']?JSON[_0x216a('0x23')](_0x5dec32[_0x216a('0x54')]):_0x216a('0x67'));return respondWithRpcPromise(_0x216a('0x68'),_0x216a('0x69'),_0x569552);}return null;})[_0x216a('0x32')](function(_0x113e9b){if(_0x113e9b){if(_0x5dec32['body'][_0x216a('0x6a')]){_0x569552[_0x216a('0x25')][_0x216a('0x6b')]=util[_0x216a('0x59')](_0x216a('0x6c'),_0x5dec32[_0x216a('0x5c')][_0x216a('0x36')]);_0x569552[_0x216a('0x25')][_0x216a('0x6d')]=_0x569552[_0x216a('0x6d')];_0x569552[_0x216a('0x25')]['event']='accept';return respondWithRpcPromise(_0x216a('0x6e'),'EventManager',{'event':_0x216a('0x6f'),'message':_0x569552[_0x216a('0x25')]},client9002)[_0x216a('0x32')](function(){return _0x569552;});}return _0x569552;}return null;})[_0x216a('0x32')](respondWithResult(_0x3f6e4a,null))[_0x216a('0x4d')](handleError(_0x3f6e4a,null));};var interaction_log=require(_0x216a('0x13'))(_0x216a('0x56'));exports[_0x216a('0x2f')]=function(_0x264ea6,_0x5d6ce8,_0x553f2b){var _0x2a5235={'agent':{},'channel':_0x216a('0x57')};if(_0x264ea6[_0x216a('0x54')]['id']){delete _0x264ea6[_0x216a('0x54')]['id'];}_0x264ea6['body'][_0x216a('0x5b')]=_0x264ea6[_0x216a('0x54')][_0x216a('0x5b')]||_0x264ea6[_0x216a('0x5c')]['id'];_0x2a5235[_0x216a('0x5d')]['id']=_0x264ea6[_0x216a('0x54')]['UserId'];return db[_0x216a('0x39')]['find']({'where':{'id':_0x264ea6['params']['id'],'UserId':null}})[_0x216a('0x32')](handleEntityNotFound(_0x5d6ce8,null))['then'](function(_0x34f9c5){if(_0x34f9c5){_0x2a5235[_0x216a('0x25')]=_0x34f9c5[_0x216a('0x65')]({'plain':!![]});return db[_0x216a('0x60')][_0x216a('0x52')]({'where':{'id':_0x34f9c5[_0x216a('0x61')]}});}return null;})[_0x216a('0x32')](handleEntityNotFound(_0x5d6ce8,null))[_0x216a('0x32')](function(_0x44eb51){if(_0x44eb51){_0x2a5235['interaction']=_0x44eb51[_0x216a('0x65')]({'plain':!![]});interaction_log[_0x216a('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x264ea6[_0x216a('0x5c')]['id'],_0x264ea6[_0x216a('0x5c')][_0x216a('0x36')],_0x264ea6[_0x216a('0x5c')][_0x216a('0x70')],_0x2a5235[_0x216a('0x64')]['id'],_0x264ea6[_0x216a('0x54')]?JSON['stringify'](_0x264ea6[_0x216a('0x54')]):_0x216a('0x67'));return respondWithRpcPromise('RejectMessage',_0x216a('0x71'),_0x2a5235);}return null;})[_0x216a('0x32')](function(_0x5c4cb1){if(_0x5c4cb1){_0x5c4cb1[_0x216a('0x25')][_0x216a('0x6b')]=util[_0x216a('0x59')](_0x216a('0x6c'),_0x264ea6[_0x216a('0x5c')][_0x216a('0x36')]);_0x5c4cb1['message'][_0x216a('0x6d')]=_0x2a5235[_0x216a('0x6d')];_0x5c4cb1[_0x216a('0x25')][_0x216a('0x72')]='reject';respondWithRpcPromise(_0x216a('0x6e'),_0x216a('0x6e'),{'event':_0x216a('0x73'),'message':_0x5c4cb1[_0x216a('0x25')]},client9002);return _0x2a5235;}return null;})[_0x216a('0x32')](respondWithResult(_0x5d6ce8,null))[_0x216a('0x4d')](handleError(_0x5d6ce8,null));};exports[_0x216a('0x28')]=function(_0xa21bbb,_0x336522,_0x65db07){if(_0xa21bbb[_0x216a('0x54')]['id']){delete _0xa21bbb[_0x216a('0x54')]['id'];}var _0xb73be7;return db[_0x216a('0x39')]['find']({'where':{'id':_0xa21bbb[_0x216a('0x4f')]['id']}})[_0x216a('0x32')](handleEntityNotFound(_0x336522,null))[_0x216a('0x32')](function(_0x207127){if(_0x207127){_0xb73be7=_0x207127;return db[_0x216a('0x74')][_0x216a('0x52')]({'where':{'id':_0x207127[_0x216a('0x75')]}});}})[_0x216a('0x32')](handleEntityNotFound(_0x336522,null))[_0x216a('0x32')](function(_0x50f218){if(_0x50f218){logger[_0x216a('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x216a('0x28'),_0x216a('0x76'),_0x50f218[_0x216a('0x3c')],util[_0x216a('0x77')](_0xa21bbb[_0x216a('0x54')],{'showHidden':![],'depth':null}));switch(_0x50f218['type']){case'twilio':if(_0xa21bbb[_0x216a('0x54')][_0x216a('0x78')]&&_0xa21bbb[_0x216a('0x54')]['MessageSid']===_0xb73be7[_0x216a('0x79')]&&_0xa21bbb['body'][_0x216a('0x7a')]&&_0xa21bbb[_0x216a('0x54')]['MessageStatus']==='read'){return _0xb73be7[_0x216a('0x31')]({'read':!![]});}else{logger[_0x216a('0x24')](_0x216a('0x7b'),_0x216a('0x28'),_0x216a('0x7c'),util['inspect'](_0xa21bbb[_0x216a('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xb73be7;}})['then'](respondWithResult(_0x336522,null))[_0x216a('0x4d')](handleError(_0x336522,null));}; \ No newline at end of file +var _0xb91a=['redis','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','destroy','stack','send','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','include','findAll','rows','show','params','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','AcceptMessage','manual','interface','channel','event','EventManager','acceptmessage','whatsapp','agent','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','WhatsappAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb91a,0xe5));var _0xab91=function(_0x1d027a,_0x56171a){_0x1d027a=_0x1d027a-0x0;var _0x4a47e0=_0xb91a[_0x1d027a];return _0x4a47e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xab91('0x0'));var rimraf=require(_0xab91('0x1'));var zipdir=require(_0xab91('0x2'));var jsonpatch=require(_0xab91('0x3'));var rp=require('request-promise');var moment=require(_0xab91('0x4'));var BPromise=require(_0xab91('0x5'));var Mustache=require('mustache');var util=require(_0xab91('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xab91('0x7'));var ejs=require(_0xab91('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab91('0x9'));var crypto=require(_0xab91('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xab91('0xb'));var toCsv=require(_0xab91('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab91('0xc'));var qs=require(_0xab91('0xd'));var as=require(_0xab91('0xe'));var hardwareService=require(_0xab91('0xf'));var logger=require('../../config/logger')(_0xab91('0x10'));var utils=require(_0xab91('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xab91('0x12'));var db=require('../../mysqldb')['db'];config[_0xab91('0x13')]=_['defaults'](config['redis'],{'host':_0xab91('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab91('0x13')]));require(_0xab91('0x15'))[_0xab91('0x16')](socket);var jayson=require(_0xab91('0x17'));var client=jayson[_0xab91('0x18')][_0xab91('0x19')]({'port':0x232c});var client9002=jayson['client'][_0xab91('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x52614f,_0x23c3d8,_0xbf0ed8,_0x312a4e){return new BPromise(function(_0x32df88,_0x4e464c){var _0x434dcd=_0x312a4e||client;return _0x434dcd[_0xab91('0x1a')](_0x52614f,_0xbf0ed8)[_0xab91('0x1b')](function(_0x5835e1){logger['info'](_0xab91('0x1c'),_0x23c3d8,_0xab91('0x1d'));logger[_0xab91('0x1e')](_0xab91('0x1f'),_0x23c3d8,_0xab91('0x1d'),JSON[_0xab91('0x20')](_0x5835e1));if(_0x5835e1[_0xab91('0x21')]){if(_0x5835e1[_0xab91('0x21')][_0xab91('0x22')]===0x1f4){logger[_0xab91('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x23c3d8,_0x5835e1[_0xab91('0x21')][_0xab91('0x23')]);return _0x4e464c(_0x5835e1[_0xab91('0x21')]['message']);}logger['error'](_0xab91('0x1c'),_0x23c3d8,_0x5835e1[_0xab91('0x21')][_0xab91('0x23')]);return _0x32df88(_0x5835e1['error']['message']);}else{logger[_0xab91('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x23c3d8,_0xab91('0x1d'));_0x32df88(_0x5835e1['result']['message']);}})[_0xab91('0x25')](function(_0x43f334){logger[_0xab91('0x21')](_0xab91('0x1c'),_0x23c3d8,_0x43f334);_0x4e464c(_0x43f334);});});}function respondWithStatusCode(_0x239542,_0x70e00e){_0x70e00e=_0x70e00e||0xcc;return function(_0x26c96f){if(_0x26c96f){return _0x239542[_0xab91('0x26')](_0x70e00e);}return _0x239542['status'](_0x70e00e)[_0xab91('0x27')]();};}function respondWithResult(_0x364b84,_0x1a3f68){_0x1a3f68=_0x1a3f68||0xc8;return function(_0x235713){if(_0x235713){return _0x364b84['status'](_0x1a3f68)[_0xab91('0x28')](_0x235713);}};}function respondWithFilteredResult(_0x284270,_0x5ec525){return function(_0x59e66a){if(_0x59e66a){var _0x3e3a94=_0x59e66a[_0xab91('0x29')],_0x2d45c8=_0x5ec525[_0xab91('0x2a')],_0x223df1=_0x5ec525[_0xab91('0x2a')]+_0x5ec525[_0xab91('0x2b')],_0x353040;if(_0x223df1>=_0x3e3a94){_0x223df1=_0x3e3a94;_0x353040=0xc8;}else{_0x353040=0xce;}_0x284270[_0xab91('0x2c')](_0x353040);return _0x284270[_0xab91('0x2d')](_0xab91('0x2e'),_0x2d45c8+'-'+_0x223df1+'/'+_0x3e3a94)['json'](_0x59e66a);}return null;};}function patchUpdates(_0x146c64){return function(_0x3db5c2){try{jsonpatch['apply'](_0x3db5c2,_0x146c64,!![]);}catch(_0x419de9){return BPromise[_0xab91('0x2f')](_0x419de9);}return _0x3db5c2[_0xab91('0x30')]();};}function saveUpdates(_0x564cda,_0x111d70){return function(_0x4f6818){if(_0x4f6818){return _0x4f6818[_0xab91('0x31')](_0x564cda)[_0xab91('0x1b')](function(_0x4a254a){return _0x4a254a;});}return null;};}function removeEntity(_0x189983,_0x27cfb7){return function(_0x5dca20){if(_0x5dca20){return _0x5dca20[_0xab91('0x32')]()[_0xab91('0x1b')](function(){_0x189983[_0xab91('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2394,_0x7b63a4){return function(_0x48481f){if(!_0x48481f){_0x1c2394[_0xab91('0x26')](0x194);}return _0x48481f;};}function handleError(_0x2c52e1,_0x6142c0){_0x6142c0=_0x6142c0||0x1f4;return function(_0x54fa99){logger['error'](_0x54fa99[_0xab91('0x33')]);if(_0x54fa99['name']){delete _0x54fa99['name'];}_0x2c52e1[_0xab91('0x2c')](_0x6142c0)[_0xab91('0x34')](_0x54fa99);};}exports['index']=function(_0x619730,_0x2a6b57){var _0x43833a={},_0x11615e={},_0x1f48dc={'count':0x0,'rows':[]};var _0x72c16d=_['map'](db[_0xab91('0x35')][_0xab91('0x36')],function(_0x3d1618){return{'name':_0x3d1618[_0xab91('0x37')],'type':_0x3d1618[_0xab91('0x38')][_0xab91('0x39')]};});_0x11615e[_0xab91('0x3a')]=_['map'](_0x72c16d,'name');_0x11615e[_0xab91('0x3b')]=_[_0xab91('0x3c')](_0x619730['query']);_0x11615e['filters']=_[_0xab91('0x3d')](_0x11615e['model'],_0x11615e[_0xab91('0x3b')]);_0x43833a['attributes']=_[_0xab91('0x3d')](_0x11615e[_0xab91('0x3a')],qs['fields'](_0x619730['query'][_0xab91('0x3e')]));_0x43833a[_0xab91('0x3f')]=_0x43833a['attributes']['length']?_0x43833a['attributes']:_0x11615e[_0xab91('0x3a')];if(!_0x619730[_0xab91('0x3b')][_0xab91('0x40')]('nolimit')){_0x43833a[_0xab91('0x2b')]=qs[_0xab91('0x2b')](_0x619730[_0xab91('0x3b')][_0xab91('0x2b')]);_0x43833a[_0xab91('0x2a')]=qs[_0xab91('0x2a')](_0x619730[_0xab91('0x3b')][_0xab91('0x2a')]);}_0x43833a[_0xab91('0x41')]=qs[_0xab91('0x42')](_0x619730[_0xab91('0x3b')]['sort']);_0x43833a[_0xab91('0x43')]=qs[_0xab91('0x44')](_[_0xab91('0x45')](_0x619730[_0xab91('0x3b')],_0x11615e[_0xab91('0x44')]),_0x72c16d);if(_0x619730[_0xab91('0x3b')][_0xab91('0x46')]){_0x43833a[_0xab91('0x43')]=_[_0xab91('0x47')](_0x43833a[_0xab91('0x43')],{'$or':_[_0xab91('0x48')](_0x72c16d,function(_0x41be98){if(_0x41be98[_0xab91('0x38')]!=='VIRTUAL'){var _0x38aadb={};_0x38aadb[_0x41be98['name']]={'$like':'%'+_0x619730['query'][_0xab91('0x46')]+'%'};return _0x38aadb;}})});}_0x43833a=_['merge']({},_0x43833a,_0x619730[_0xab91('0x49')]);var _0xd63fb4={'where':_0x43833a[_0xab91('0x43')]};return db[_0xab91('0x35')][_0xab91('0x29')](_0xd63fb4)[_0xab91('0x1b')](function(_0x575266){_0x1f48dc[_0xab91('0x29')]=_0x575266;if(_0x619730[_0xab91('0x3b')]['includeAll']){_0x43833a[_0xab91('0x4a')]=[{'all':!![]}];}return db[_0xab91('0x35')][_0xab91('0x4b')](_0x43833a);})[_0xab91('0x1b')](function(_0x4feb03){_0x1f48dc[_0xab91('0x4c')]=_0x4feb03;return _0x1f48dc;})['then'](respondWithFilteredResult(_0x2a6b57,_0x43833a))['catch'](handleError(_0x2a6b57,null));};exports[_0xab91('0x4d')]=function(_0x2f0619,_0x540a72){var _0x2393e4={'raw':!![],'where':{'id':_0x2f0619[_0xab91('0x4e')]['id']}},_0x5b2e15={};_0x5b2e15['model']=_[_0xab91('0x3c')](db[_0xab91('0x35')][_0xab91('0x36')]);_0x5b2e15[_0xab91('0x3b')]=_[_0xab91('0x3c')](_0x2f0619[_0xab91('0x3b')]);_0x5b2e15[_0xab91('0x44')]=_[_0xab91('0x3d')](_0x5b2e15['model'],_0x5b2e15[_0xab91('0x3b')]);_0x2393e4[_0xab91('0x3f')]=_[_0xab91('0x3d')](_0x5b2e15['model'],qs[_0xab91('0x3e')](_0x2f0619[_0xab91('0x3b')][_0xab91('0x3e')]));_0x2393e4[_0xab91('0x3f')]=_0x2393e4[_0xab91('0x3f')]['length']?_0x2393e4['attributes']:_0x5b2e15[_0xab91('0x3a')];if(_0x2f0619[_0xab91('0x3b')]['includeAll']){_0x2393e4[_0xab91('0x4a')]=[{'all':!![]}];}_0x2393e4=_[_0xab91('0x47')]({},_0x2393e4,_0x2f0619[_0xab91('0x49')]);return db[_0xab91('0x35')][_0xab91('0x4f')](_0x2393e4)[_0xab91('0x1b')](handleEntityNotFound(_0x540a72,null))['then'](respondWithResult(_0x540a72,null))[_0xab91('0x25')](handleError(_0x540a72,null));};exports[_0xab91('0x50')]=function(_0x4cafb3,_0x404b66){return db[_0xab91('0x35')][_0xab91('0x50')](_0x4cafb3[_0xab91('0x51')],{})[_0xab91('0x1b')](respondWithResult(_0x404b66,0xc9))[_0xab91('0x25')](handleError(_0x404b66,null));};exports[_0xab91('0x31')]=function(_0x52e3c9,_0x4aaeb9){if(_0x52e3c9[_0xab91('0x51')]['id']){delete _0x52e3c9[_0xab91('0x51')]['id'];}return db['WhatsappMessage'][_0xab91('0x4f')]({'where':{'id':_0x52e3c9[_0xab91('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4aaeb9,null))[_0xab91('0x1b')](saveUpdates(_0x52e3c9['body'],null))['then'](respondWithResult(_0x4aaeb9,null))[_0xab91('0x25')](handleError(_0x4aaeb9,null));};exports[_0xab91('0x32')]=function(_0x4aa7e5,_0x550159){return db[_0xab91('0x35')][_0xab91('0x4f')]({'where':{'id':_0x4aa7e5[_0xab91('0x4e')]['id']}})['then'](handleEntityNotFound(_0x550159,null))[_0xab91('0x1b')](removeEntity(_0x550159,null))[_0xab91('0x25')](handleError(_0x550159,null));};exports[_0xab91('0x52')]=function(_0x1628f8,_0x3b0276){return db[_0xab91('0x35')]['describe']()[_0xab91('0x1b')](respondWithResult(_0x3b0276,null))['catch'](handleError(_0x3b0276,null));};var interaction_log=require(_0xab91('0x53'))(_0xab91('0x54'));exports[_0xab91('0x55')]=function(_0xc90d7b,_0x2c5c4c,_0x40f172){var _0x2049b9={'agent':{},'channel':'whatsapp'};if(_0xc90d7b[_0xab91('0x51')]['id']){delete _0xc90d7b['body']['id'];}_0xc90d7b[_0xab91('0x51')][_0xab91('0x56')]=!![];_0xc90d7b[_0xab91('0x51')]['readAt']=moment()['format'](_0xab91('0x57'));_0xc90d7b[_0xab91('0x51')][_0xab91('0x58')]=_0xc90d7b[_0xab91('0x51')]['UserId']||_0xc90d7b[_0xab91('0x59')]['id'];_0x2049b9['agent']['id']=_0xc90d7b[_0xab91('0x51')][_0xab91('0x58')];return db['WhatsappMessage'][_0xab91('0x4f')]({'where':{'id':_0xc90d7b[_0xab91('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0xab91('0x5a')],'as':_0xab91('0x5b')}]})[_0xab91('0x1b')](handleEntityNotFound(_0x2c5c4c,null))[_0xab91('0x1b')](saveUpdates(_0xc90d7b[_0xab91('0x51')],null))[_0xab91('0x1b')](function(_0xc5ae9){if(_0xc5ae9){_0x2049b9[_0xab91('0x23')]=_0xc5ae9[_0xab91('0x5c')]({'plain':!![]});return db['WhatsappInteraction'][_0xab91('0x4f')]({'where':{'id':_0xc5ae9[_0xab91('0x5d')]}});}return null;})[_0xab91('0x1b')](handleEntityNotFound(_0x2c5c4c,null))[_0xab91('0x1b')](function(_0x5eb7b7){if(_0x5eb7b7){return _0x5eb7b7[_0xab91('0x31')]({'UserId':_0xc90d7b[_0xab91('0x51')]['UserId'],'read1stAt':_[_0xab91('0x5e')](_0x5eb7b7[_0xab91('0x5f')])?moment()[_0xab91('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xab91('0x1b')](function(_0x9eab34){if(_0x9eab34){_0x2049b9[_0xab91('0x61')]=_0x9eab34[_0xab91('0x5c')]({'plain':!![]});interaction_log[_0xab91('0x24')](_0xab91('0x62'),_0xc90d7b[_0xab91('0x59')]['id'],_0xc90d7b['user'][_0xab91('0x63')],_0xc90d7b['user'][_0xab91('0x64')],_0x2049b9['interaction']['id'],_0xc90d7b[_0xab91('0x51')]?JSON['stringify'](_0xc90d7b[_0xab91('0x51')]):_0xab91('0x65'));return respondWithRpcPromise(_0xab91('0x66'),'acceptMessage',_0x2049b9);}return null;})['then'](function(_0x295aaa){if(_0x295aaa){if(_0xc90d7b[_0xab91('0x51')][_0xab91('0x67')]){_0x2049b9[_0xab91('0x23')][_0xab91('0x68')]=util[_0xab91('0x60')]('SIP/%s',_0xc90d7b['user'][_0xab91('0x63')]);_0x2049b9[_0xab91('0x23')][_0xab91('0x69')]=_0x2049b9['channel'];_0x2049b9[_0xab91('0x23')][_0xab91('0x6a')]=_0xab91('0x55');return respondWithRpcPromise(_0xab91('0x6b'),_0xab91('0x6b'),{'event':_0xab91('0x6c'),'message':_0x2049b9['message']},client9002)['then'](function(){return _0x2049b9;});}return _0x2049b9;}return null;})[_0xab91('0x1b')](respondWithResult(_0x2c5c4c,null))['catch'](handleError(_0x2c5c4c,null));};var interaction_log=require(_0xab91('0x53'))(_0xab91('0x54'));exports[_0xab91('0x2f')]=function(_0x426af6,_0x5b360f,_0x59fe78){var _0x5a81c5={'agent':{},'channel':_0xab91('0x6d')};if(_0x426af6[_0xab91('0x51')]['id']){delete _0x426af6[_0xab91('0x51')]['id'];}_0x426af6[_0xab91('0x51')][_0xab91('0x58')]=_0x426af6['body'][_0xab91('0x58')]||_0x426af6[_0xab91('0x59')]['id'];_0x5a81c5[_0xab91('0x6e')]['id']=_0x426af6[_0xab91('0x51')][_0xab91('0x58')];return db[_0xab91('0x35')][_0xab91('0x4f')]({'where':{'id':_0x426af6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b360f,null))[_0xab91('0x1b')](function(_0xa5ec3f){if(_0xa5ec3f){_0x5a81c5[_0xab91('0x23')]=_0xa5ec3f['get']({'plain':!![]});return db[_0xab91('0x6f')][_0xab91('0x4f')]({'where':{'id':_0xa5ec3f[_0xab91('0x5d')]}});}return null;})[_0xab91('0x1b')](handleEntityNotFound(_0x5b360f,null))[_0xab91('0x1b')](function(_0x48edc7){if(_0x48edc7){_0x5a81c5[_0xab91('0x61')]=_0x48edc7[_0xab91('0x5c')]({'plain':!![]});interaction_log['info'](_0xab91('0x70'),_0x426af6[_0xab91('0x59')]['id'],_0x426af6[_0xab91('0x59')][_0xab91('0x63')],_0x426af6['user']['role'],_0x5a81c5[_0xab91('0x61')]['id'],_0x426af6[_0xab91('0x51')]?JSON['stringify'](_0x426af6[_0xab91('0x51')]):_0xab91('0x65'));return respondWithRpcPromise('RejectMessage',_0xab91('0x71'),_0x5a81c5);}return null;})['then'](function(_0x11760f){if(_0x11760f){_0x11760f[_0xab91('0x23')][_0xab91('0x68')]=util[_0xab91('0x60')](_0xab91('0x72'),_0x426af6['user'][_0xab91('0x63')]);_0x11760f[_0xab91('0x23')][_0xab91('0x69')]=_0x5a81c5[_0xab91('0x69')];_0x11760f[_0xab91('0x23')][_0xab91('0x6a')]='reject';respondWithRpcPromise(_0xab91('0x6b'),'EventManager',{'event':_0xab91('0x73'),'message':_0x11760f[_0xab91('0x23')]},client9002);return _0x5a81c5;}return null;})['then'](respondWithResult(_0x5b360f,null))['catch'](handleError(_0x5b360f,null));};exports[_0xab91('0x2c')]=function(_0xa91efd,_0x13cbfc,_0x1f8102){if(_0xa91efd['body']['id']){delete _0xa91efd[_0xab91('0x51')]['id'];}var _0x15601b;return db[_0xab91('0x35')][_0xab91('0x4f')]({'where':{'id':_0xa91efd[_0xab91('0x4e')]['id']}})[_0xab91('0x1b')](handleEntityNotFound(_0x13cbfc,null))[_0xab91('0x1b')](function(_0x50f27a){if(_0x50f27a){_0x15601b=_0x50f27a;return db[_0xab91('0x74')]['find']({'where':{'id':_0x50f27a['WhatsappAccountId']}});}})[_0xab91('0x1b')](handleEntityNotFound(_0x13cbfc,null))['then'](function(_0x3f849b){if(_0x3f849b){logger[_0xab91('0x1e')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xab91('0x2c'),_0xab91('0x75'),_0x3f849b[_0xab91('0x38')],util[_0xab91('0x76')](_0xa91efd[_0xab91('0x51')],{'showHidden':![],'depth':null}));switch(_0x3f849b[_0xab91('0x38')]){case _0xab91('0x77'):if(_0xa91efd[_0xab91('0x51')][_0xab91('0x78')]&&_0xa91efd['body']['MessageSid']===_0x15601b[_0xab91('0x79')]&&_0xa91efd[_0xab91('0x51')][_0xab91('0x7a')]&&_0xa91efd[_0xab91('0x51')][_0xab91('0x7a')]===_0xab91('0x56')){return _0x15601b['update']({'read':!![]});}else{logger[_0xab91('0x21')](_0xab91('0x7b'),_0xab91('0x2c'),_0xab91('0x77'),util['inspect'](_0xa91efd[_0xab91('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x15601b;}})['then'](respondWithResult(_0x13cbfc,null))['catch'](handleError(_0x13cbfc,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c220acb..c8d65f2 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 _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x3a4a22,_0x217aff){var _0xec204=function(_0x125c6c){while(--_0x125c6c){_0x3a4a22['push'](_0x3a4a22['shift']());}};_0xec204(++_0x217aff);}(_0xb10b,0x12a));var _0xbb10=function(_0x699049,_0x51d7d6){_0x699049=_0x699049-0x0;var _0x5e25e4=_0xb10b[_0x699049];return _0x5e25e4;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x58cd98,_0x1bd39b){var _0x3e5a50=function(_0x395918){while(--_0x395918){_0x58cd98['push'](_0x58cd98['shift']());}};_0x3e5a50(++_0x1bd39b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d610f,_0x39c24f){_0x4d610f=_0x4d610f-0x0;var _0x440478=_0x5f2f[_0x4d610f];return _0x440478;};'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 diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 139d7b1..bd58db0 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 _0x4a70=['bluebird','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','update','catch','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x2f5b27,_0x423ec8){var _0x535af5=function(_0x1e8c96){while(--_0x1e8c96){_0x2f5b27['push'](_0x2f5b27['shift']());}};_0x535af5(++_0x423ec8);}(_0x4a70,0xbc));var _0x04a7=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x4a70[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x04a7('0x0'));var util=require(_0x04a7('0x1'));var logger=require(_0x04a7('0x2'))('api');var moment=require(_0x04a7('0x3'));var BPromise=require(_0x04a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04a7('0x5'));var rimraf=require(_0x04a7('0x6'));var config=require('../../config/environment');var attributes=require(_0x04a7('0x7'));module[_0x04a7('0x8')]=function(_0x34d04c,_0x5a43f6){return _0x34d04c[_0x04a7('0x9')](_0x04a7('0xa'),attributes,{'tableName':_0x04a7('0xb'),'paranoid':![],'indexes':[{'name':_0x04a7('0xc'),'fields':[_0x04a7('0xc')]},{'name':_0x04a7('0xd'),'fields':[_0x04a7('0xe')],'type':_0x04a7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4abb93,_0x553521,_0x4f7fd3){var _0x4ac06b=_0x34d04c[_0x04a7('0x10')];var _0x300005=_0x4abb93[_0x04a7('0x11')]({'plain':!![]});if(_0x300005[_0x04a7('0x12')][_0x04a7('0x13')]()==='in'||_0x300005[_0x04a7('0x12')]['toLowerCase']()===_0x04a7('0x14')&&!_0x300005[_0x04a7('0x15')]&&!_[_0x04a7('0x16')](_0x300005[_0x04a7('0x17')])){_0x4ac06b[_0x04a7('0x18')]['findOne']({'where':{'id':_0x300005['WhatsappInteractionId']}})['then'](function(_0x150cd3){if(_0x150cd3){_0x150cd3[_0x04a7('0x19')]({'lastMsgAt':_0x300005['createdAt'],'lastMsgDirection':_0x300005['direction']['toLowerCase']()});}})[_0x04a7('0x1a')](function(_0x141182){console[_0x04a7('0x1b')](_0x141182);});}if(_0x300005[_0x04a7('0x12')]==='out'&&!_0x300005['secret']){var _0x5cc28c;_0x4ac06b[_0x04a7('0x1c')][_0x04a7('0x1d')]({'where':{'id':_0x300005['WhatsappAccountId']},'raw':!![]})[_0x04a7('0x1e')](function(_0x4eb4ee){_0x5cc28c=_0x4eb4ee;if(_0x5cc28c&&_0x5cc28c['type']){switch(_0x5cc28c[_0x04a7('0x1f')]){case _0x04a7('0x20'):var _0x477015=require(_0x04a7('0x20'));if(_0x5cc28c[_0x04a7('0x21')]&&_0x5cc28c[_0x04a7('0x22')]&&_0x5cc28c[_0x04a7('0x23')]){var _0x275edc=new _0x477015(_0x5cc28c['accountSid'],_0x5cc28c[_0x04a7('0x22')]);_0x275edc['messages']['create']({'body':_0x300005[_0x04a7('0xe')],'to':'whatsapp:'+_0x300005[_0x04a7('0x23')],'from':_0x04a7('0x24')+_0x5cc28c[_0x04a7('0x23')],'statusCallback':_0x5cc28c[_0x04a7('0x25')]+_0x04a7('0x26')+_0x300005['id']+_0x04a7('0x27')+_0x5cc28c[_0x04a7('0x28')]})[_0x04a7('0x1e')](function(_0x58e8dc){if(_0x58e8dc[_0x04a7('0x29')]){return _0x4abb93[_0x04a7('0x19')]({'messageId':_0x58e8dc[_0x04a7('0x29')]});}})['catch'](function(_0x414353){logger['error'](_0x04a7('0x2a'),'afterCreate',_0x04a7('0x20'),util[_0x04a7('0x2b')](_0x414353,{'showHidden':![],'depth':null}));});}else{logger[_0x04a7('0x1b')](_0x04a7('0x2a'),_0x04a7('0x2c'),_0x04a7('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x04a7('0x2d')](function(){_0x4f7fd3();});}else{_0x4f7fd3();}}},'charset':_0x04a7('0x2e'),'collate':_0x04a7('0x2f')});}; \ No newline at end of file +var _0x4bc0=['sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','update'];(function(_0x2cfe0c,_0x32fe20){var _0x21d694=function(_0x8fabf0){while(--_0x8fabf0){_0x2cfe0c['push'](_0x2cfe0c['shift']());}};_0x21d694(++_0x32fe20);}(_0x4bc0,0xf5));var _0x04bc=function(_0x240c8a,_0x48a74b){_0x240c8a=_0x240c8a-0x0;var _0x20ae1d=_0x4bc0[_0x240c8a];return _0x20ae1d;};'use strict';var _=require(_0x04bc('0x0'));var util=require('util');var logger=require(_0x04bc('0x1'))(_0x04bc('0x2'));var moment=require(_0x04bc('0x3'));var BPromise=require(_0x04bc('0x4'));var rp=require(_0x04bc('0x5'));var fs=require('fs');var path=require(_0x04bc('0x6'));var rimraf=require(_0x04bc('0x7'));var config=require(_0x04bc('0x8'));var attributes=require(_0x04bc('0x9'));module['exports']=function(_0x3e3517,_0x9eda6){return _0x3e3517[_0x04bc('0xa')]('WhatsappMessage',attributes,{'tableName':_0x04bc('0xb'),'paranoid':![],'indexes':[{'name':_0x04bc('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x04bc('0xd')],'type':_0x04bc('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12aa7e,_0x1b9a16,_0x965198){var _0x5e3214=_0x3e3517[_0x04bc('0xf')];var _0x566bb1=_0x12aa7e[_0x04bc('0x10')]({'plain':!![]});if(_0x566bb1[_0x04bc('0x11')][_0x04bc('0x12')]()==='in'||_0x566bb1[_0x04bc('0x11')][_0x04bc('0x12')]()===_0x04bc('0x13')&&!_0x566bb1[_0x04bc('0x14')]&&!_[_0x04bc('0x15')](_0x566bb1[_0x04bc('0x16')])){_0x5e3214[_0x04bc('0x17')]['findOne']({'where':{'id':_0x566bb1[_0x04bc('0x18')]}})[_0x04bc('0x19')](function(_0x1ca55d){if(_0x1ca55d){_0x1ca55d['update']({'lastMsgAt':_0x566bb1[_0x04bc('0x1a')],'lastMsgDirection':_0x566bb1['direction'][_0x04bc('0x12')]()});}})[_0x04bc('0x1b')](function(_0x3eba3e){console[_0x04bc('0x1c')](_0x3eba3e);});}if(_0x566bb1[_0x04bc('0x11')]==='out'&&!_0x566bb1[_0x04bc('0x14')]){var _0x360d68;_0x5e3214[_0x04bc('0x1d')][_0x04bc('0x1e')]({'where':{'id':_0x566bb1[_0x04bc('0x1f')]},'raw':!![]})[_0x04bc('0x19')](function(_0x24f123){_0x360d68=_0x24f123;if(_0x360d68&&_0x360d68[_0x04bc('0x20')]){switch(_0x360d68[_0x04bc('0x20')]){case _0x04bc('0x21'):var _0x5f4256=require('twilio');if(_0x360d68[_0x04bc('0x22')]&&_0x360d68[_0x04bc('0x23')]&&_0x360d68[_0x04bc('0x24')]){var _0x3733be=new _0x5f4256(_0x360d68[_0x04bc('0x22')],_0x360d68[_0x04bc('0x23')]);_0x3733be[_0x04bc('0x25')][_0x04bc('0x26')]({'body':_0x566bb1[_0x04bc('0xd')],'to':_0x04bc('0x27')+_0x566bb1[_0x04bc('0x24')],'from':_0x04bc('0x27')+_0x360d68[_0x04bc('0x24')],'statusCallback':_0x360d68[_0x04bc('0x28')]+'/api/whatsapp/messages/'+_0x566bb1['id']+_0x04bc('0x29')+_0x360d68['token']})[_0x04bc('0x19')](function(_0x1584bc){if(_0x1584bc['sid']){return _0x12aa7e[_0x04bc('0x2a')]({'messageId':_0x1584bc[_0x04bc('0x2b')]});}})['catch'](function(_0x25d086){logger[_0x04bc('0x1c')](_0x04bc('0x2c'),_0x04bc('0x2d'),_0x04bc('0x21'),util['inspect'](_0x25d086,{'showHidden':![],'depth':null}));});}else{logger[_0x04bc('0x1c')](_0x04bc('0x2c'),_0x04bc('0x2d'),_0x04bc('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x04bc('0x2e')](function(){_0x965198();});}else{_0x965198();}}},'charset':'utf8mb4','collate':_0x04bc('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index dbf76b1..c5ab9f3 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 _0x1c42=['stringify','error','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x409f2f,_0x2db552){var _0x46ba7a=function(_0x18a206){while(--_0x18a206){_0x409f2f['push'](_0x409f2f['shift']());}};_0x46ba7a(++_0x2db552);}(_0x1c42,0xad));var _0x21c4=function(_0x2ea791,_0x22b18a){_0x2ea791=_0x2ea791-0x0;var _0x1be678=_0x1c42[_0x2ea791];return _0x1be678;};'use strict';var _=require(_0x21c4('0x0'));var util=require(_0x21c4('0x1'));var moment=require(_0x21c4('0x2'));var BPromise=require(_0x21c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x21c4('0x5'))(_0x21c4('0x6'));var config=require(_0x21c4('0x7'));var jayson=require(_0x21c4('0x8'));var client=jayson[_0x21c4('0x9')][_0x21c4('0xa')]({'port':0x232a});config['redis']=_[_0x21c4('0xb')](config[_0x21c4('0xc')],{'host':_0x21c4('0xd'),'port':0x18eb});var socket=require(_0x21c4('0xe'))(new Redis(config[_0x21c4('0xc')]));require('./whatsappMessage.socket')[_0x21c4('0xf')](socket);function respondWithRpcPromise(_0x17231f,_0x53e97e,_0x193cf8){return new BPromise(function(_0x50ae17,_0x148dbe){return client['request'](_0x17231f,_0x193cf8)['then'](function(_0x2adc6c){logger['info'](_0x21c4('0x10'),_0x53e97e,_0x21c4('0x11'));logger[_0x21c4('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x53e97e,_0x21c4('0x11'),JSON[_0x21c4('0x13')](_0x2adc6c));if(_0x2adc6c[_0x21c4('0x14')]){if(_0x2adc6c[_0x21c4('0x14')]['code']===0x1f4){logger[_0x21c4('0x14')](_0x21c4('0x10'),_0x53e97e,_0x2adc6c[_0x21c4('0x14')][_0x21c4('0x15')]);return _0x148dbe(_0x2adc6c['error'][_0x21c4('0x15')]);}logger[_0x21c4('0x14')](_0x21c4('0x10'),_0x53e97e,_0x2adc6c['error'][_0x21c4('0x15')]);return _0x50ae17(_0x2adc6c['error'][_0x21c4('0x15')]);}else{logger[_0x21c4('0x16')](_0x21c4('0x10'),_0x53e97e,_0x21c4('0x11'));_0x50ae17(_0x2adc6c[_0x21c4('0x17')]['message']);}})[_0x21c4('0x18')](function(_0x2799b7){logger[_0x21c4('0x14')](_0x21c4('0x10'),_0x53e97e,_0x2799b7);_0x148dbe(_0x2799b7);});});}exports[_0x21c4('0x19')]=function(_0x87205d){var _0x22cfe7=this;return new Promise(function(_0x1de534,_0x180223){return db[_0x21c4('0x1a')][_0x21c4('0x1b')](_0x87205d[_0x21c4('0x1c')],{'raw':_0x87205d[_0x21c4('0x1d')]?_0x87205d[_0x21c4('0x1d')][_0x21c4('0x1e')]===undefined?!![]:![]:!![]})[_0x21c4('0x1f')](function(_0x67ccad){logger[_0x21c4('0x16')]('CreateWhatsappMessage',_0x87205d);logger['debug'](_0x21c4('0x19'),_0x87205d,JSON[_0x21c4('0x13')](_0x67ccad));_0x1de534(_0x67ccad);})['catch'](function(_0x3dd597){logger[_0x21c4('0x14')](_0x21c4('0x19'),_0x3dd597[_0x21c4('0x15')],_0x87205d);_0x180223(_0x22cfe7['error'](0x1f4,_0x3dd597[_0x21c4('0x15')]));});});}; \ No newline at end of file +var _0xa66f=['create','body','options','raw','CreateWhatsappMessage','debug','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','WhatsappMessage'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0xa66f,0xd4));var _0xfa66=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0xa66f[_0x33975c];return _0x1c15ab;};'use strict';var _=require(_0xfa66('0x0'));var util=require(_0xfa66('0x1'));var moment=require('moment');var BPromise=require(_0xfa66('0x2'));var rs=require(_0xfa66('0x3'));var fs=require('fs');var Redis=require(_0xfa66('0x4'));var db=require(_0xfa66('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa66('0x6'))(_0xfa66('0x7'));var config=require(_0xfa66('0x8'));var jayson=require(_0xfa66('0x9'));var client=jayson[_0xfa66('0xa')][_0xfa66('0xb')]({'port':0x232a});config[_0xfa66('0xc')]=_[_0xfa66('0xd')](config[_0xfa66('0xc')],{'host':_0xfa66('0xe'),'port':0x18eb});var socket=require(_0xfa66('0xf'))(new Redis(config[_0xfa66('0xc')]));require('./whatsappMessage.socket')[_0xfa66('0x10')](socket);function respondWithRpcPromise(_0x2c3d4e,_0x24098c,_0x3cc3bd){return new BPromise(function(_0x3c424a,_0x3263bc){return client['request'](_0x2c3d4e,_0x3cc3bd)[_0xfa66('0x11')](function(_0x59e288){logger[_0xfa66('0x12')](_0xfa66('0x13'),_0x24098c,'request\x20sent');logger['debug'](_0xfa66('0x14'),_0x24098c,_0xfa66('0x15'),JSON['stringify'](_0x59e288));if(_0x59e288[_0xfa66('0x16')]){if(_0x59e288[_0xfa66('0x16')]['code']===0x1f4){logger[_0xfa66('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x24098c,_0x59e288['error'][_0xfa66('0x17')]);return _0x3263bc(_0x59e288['error'][_0xfa66('0x17')]);}logger[_0xfa66('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x24098c,_0x59e288[_0xfa66('0x16')]['message']);return _0x3c424a(_0x59e288[_0xfa66('0x16')][_0xfa66('0x17')]);}else{logger[_0xfa66('0x12')](_0xfa66('0x13'),_0x24098c,'request\x20sent');_0x3c424a(_0x59e288[_0xfa66('0x18')]['message']);}})['catch'](function(_0x5c8edf){logger[_0xfa66('0x16')](_0xfa66('0x13'),_0x24098c,_0x5c8edf);_0x3263bc(_0x5c8edf);});});}exports['CreateWhatsappMessage']=function(_0x57a066){var _0x53e495=this;return new Promise(function(_0x15c449,_0xdc5c01){return db[_0xfa66('0x19')][_0xfa66('0x1a')](_0x57a066[_0xfa66('0x1b')],{'raw':_0x57a066[_0xfa66('0x1c')]?_0x57a066[_0xfa66('0x1c')][_0xfa66('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4293c9){logger[_0xfa66('0x12')](_0xfa66('0x1e'),_0x57a066);logger[_0xfa66('0x1f')](_0xfa66('0x1e'),_0x57a066,JSON[_0xfa66('0x20')](_0x4293c9));_0x15c449(_0x4293c9);})[_0xfa66('0x21')](function(_0x22d718){logger[_0xfa66('0x16')](_0xfa66('0x1e'),_0x22d718[_0xfa66('0x17')],_0x57a066);_0xdc5c01(_0x53e495[_0xfa66('0x16')](0x1f4,_0x22d718[_0xfa66('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index a590b73..31e0d11 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 _0x0135=['removeListener','register','length','whatsappMessage:','save','remove','emit'];(function(_0x3dee25,_0x24f89d){var _0x44f495=function(_0x411d91){while(--_0x411d91){_0x3dee25['push'](_0x3dee25['shift']());}};_0x44f495(++_0x24f89d);}(_0x0135,0xc1));var _0x5013=function(_0x3ce3d4,_0x19b187){_0x3ce3d4=_0x3ce3d4-0x0;var _0xe01cee=_0x0135[_0x3ce3d4];return _0xe01cee;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x5013('0x0'),_0x5013('0x1'),'update'];function createListener(_0x1dcfdb,_0x29b07d){return function(_0x5b38e8){_0x29b07d[_0x5013('0x2')](_0x1dcfdb,_0x5b38e8);};}function removeListener(_0x16424a,_0x199c98){return function(){WhatsappMessageEvents[_0x5013('0x3')](_0x16424a,_0x199c98);};}exports[_0x5013('0x4')]=function(_0x223e69){for(var _0x111eed=0x0,_0x203e89=events[_0x5013('0x5')];_0x111eed<_0x203e89;_0x111eed++){var _0x13bd1d=events[_0x111eed];var _0x1e100b=createListener(_0x5013('0x6')+_0x13bd1d,_0x223e69);WhatsappMessageEvents['on'](_0x13bd1d,_0x1e100b);}}; \ No newline at end of file +var _0x01d4=['remove','update','emit','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x01d4,0x6e));var _0x401d=function(_0x572afe,_0x1b1b2d){_0x572afe=_0x572afe-0x0;var _0x4996ce=_0x01d4[_0x572afe];return _0x4996ce;};'use strict';var WhatsappMessageEvents=require(_0x401d('0x0'));var events=[_0x401d('0x1'),_0x401d('0x2'),_0x401d('0x3')];function createListener(_0x3c40b2,_0x58aa3e){return function(_0x17f76d){_0x58aa3e[_0x401d('0x4')](_0x3c40b2,_0x17f76d);};}function removeListener(_0x134670,_0x94f6a7){return function(){WhatsappMessageEvents['removeListener'](_0x134670,_0x94f6a7);};}exports['register']=function(_0x335e18){for(var _0x2bf760=0x0,_0x25659f=events[_0x401d('0x5')];_0x2bf760<_0x25659f;_0x2bf760++){var _0x5761d2=events[_0x2bf760];var _0x4012f9=createListener(_0x401d('0x6')+_0x5761d2,_0x335e18);WhatsappMessageEvents['on'](_0x5761d2,_0x4012f9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e510a87..58d0c90 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 _0x193d=['destroy','removeTeams','removeAgents','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x193d,0xdc));var _0xd193=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x193d[_0x36ed48];return _0x51c63a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd193('0x0'));var timeout=require(_0xd193('0x1'));var express=require('express');var router=express[_0xd193('0x2')]();var auth=require(_0xd193('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd193('0x4'));var controller=require(_0xd193('0x5'));router['get']('/',auth[_0xd193('0x6')](),controller[_0xd193('0x7')]);router[_0xd193('0x8')](_0xd193('0x9'),auth[_0xd193('0x6')](),controller[_0xd193('0xa')]);router[_0xd193('0x8')](_0xd193('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd193('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xd193('0xc')]);router[_0xd193('0x8')](_0xd193('0xd'),auth[_0xd193('0x6')](),controller[_0xd193('0xe')]);router[_0xd193('0x8')](_0xd193('0xf'),auth[_0xd193('0x6')](),controller[_0xd193('0x10')]);router[_0xd193('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd193('0x11')](_0xd193('0xd'),auth[_0xd193('0x6')](),controller[_0xd193('0x12')]);router[_0xd193('0x11')](_0xd193('0xf'),auth[_0xd193('0x6')](),controller[_0xd193('0x13')]);router[_0xd193('0x14')]('/:id',auth[_0xd193('0x6')](),controller[_0xd193('0x15')]);router[_0xd193('0x16')](_0xd193('0xb'),auth[_0xd193('0x6')](),controller[_0xd193('0x17')]);router['delete'](_0xd193('0xd'),auth[_0xd193('0x6')](),controller[_0xd193('0x18')]);router[_0xd193('0x16')](_0xd193('0xf'),auth[_0xd193('0x6')](),controller[_0xd193('0x19')]);module[_0xd193('0x1a')]=router; \ No newline at end of file +var _0x2816=['removeTeams','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x2816,0x88));var _0x6281=function(_0xe8346a,_0x2e16e2){_0xe8346a=_0xe8346a-0x0;var _0x3fd041=_0x2816[_0xe8346a];return _0x3fd041;};'use strict';var multer=require(_0x6281('0x0'));var util=require(_0x6281('0x1'));var path=require('path');var timeout=require(_0x6281('0x2'));var express=require(_0x6281('0x3'));var router=express[_0x6281('0x4')]();var auth=require(_0x6281('0x5'));var interaction=require(_0x6281('0x6'));var config=require(_0x6281('0x7'));var controller=require(_0x6281('0x8'));router['get']('/',auth[_0x6281('0x9')](),controller[_0x6281('0xa')]);router['get'](_0x6281('0xb'),auth['isAuthenticated'](),controller[_0x6281('0xc')]);router[_0x6281('0xd')](_0x6281('0xe'),auth[_0x6281('0x9')](),controller['show']);router[_0x6281('0xd')]('/:id/members',auth[_0x6281('0x9')](),controller[_0x6281('0xf')]);router[_0x6281('0xd')](_0x6281('0x10'),auth['isAuthenticated'](),controller[_0x6281('0x11')]);router[_0x6281('0xd')](_0x6281('0x12'),auth[_0x6281('0x9')](),controller[_0x6281('0x13')]);router[_0x6281('0x14')]('/',auth['isAuthenticated'](),controller[_0x6281('0x15')]);router[_0x6281('0x14')](_0x6281('0x10'),auth[_0x6281('0x9')](),controller[_0x6281('0x16')]);router[_0x6281('0x14')](_0x6281('0x12'),auth[_0x6281('0x9')](),controller[_0x6281('0x17')]);router[_0x6281('0x18')](_0x6281('0xe'),auth[_0x6281('0x9')](),controller['update']);router[_0x6281('0x19')](_0x6281('0xe'),auth[_0x6281('0x9')](),controller['destroy']);router[_0x6281('0x19')](_0x6281('0x10'),auth[_0x6281('0x9')](),controller[_0x6281('0x1a')]);router[_0x6281('0x19')](_0x6281('0x12'),auth[_0x6281('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2cd043b..3a387db 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 _0x3456=['beepall','roundrobin','STRING','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x2199f7,_0x4f6410){var _0x6efa6a=function(_0x1d2362){while(--_0x1d2362){_0x2199f7['push'](_0x2199f7['shift']());}};_0x6efa6a(++_0x4f6410);}(_0x3456,0x193));var _0x6345=function(_0x2813fa,_0x3211d4){_0x2813fa=_0x2813fa-0x0;var _0x8a2acb=_0x3456[_0x2813fa];return _0x8a2acb;};'use strict';var Sequelize=require('sequelize');module[_0x6345('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6345('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6345('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6345('0x3')](_0x6345('0x4'),_0x6345('0x5'),_0x6345('0x6'))},'description':{'type':Sequelize[_0x6345('0x7')]}}; \ No newline at end of file +var _0xe17c=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING','exports'];(function(_0x4b9618,_0x593f5b){var _0x1f3c43=function(_0xa2159e){while(--_0xa2159e){_0x4b9618['push'](_0x4b9618['shift']());}};_0x1f3c43(++_0x593f5b);}(_0xe17c,0x8f));var _0xce17=function(_0x1609f3,_0x11d1dc){_0x1609f3=_0x1609f3-0x0;var _0x314427=_0xe17c[_0x1609f3];return _0x314427;};'use strict';var Sequelize=require('sequelize');module[_0xce17('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xce17('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xce17('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xce17('0x3')](_0xce17('0x4'),_0xce17('0x5'),_0xce17('0x6'))},'description':{'type':Sequelize[_0xce17('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0793cf9..7d96e77 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 _0x018c=['field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','compact','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','merge','include','catch','show','params','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','filter','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','rows','%s/%s','SIP','Team','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select'];(function(_0x4550c8,_0x5cc828){var _0x42c499=function(_0xd2c11d){while(--_0xd2c11d){_0x4550c8['push'](_0x4550c8['shift']());}};_0x42c499(++_0x5cc828);}(_0x018c,0x9f));var _0xc018=function(_0x41644b,_0x3aa6b0){_0x41644b=_0x41644b-0x0;var _0x3ee9ab=_0x018c[_0x41644b];return _0x3ee9ab;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc018('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc018('0x1'));var rp=require(_0xc018('0x2'));var moment=require('moment');var BPromise=require(_0xc018('0x3'));var Mustache=require(_0xc018('0x4'));var util=require(_0xc018('0x5'));var path=require(_0xc018('0x6'));var sox=require(_0xc018('0x7'));var csv=require(_0xc018('0x8'));var ejs=require(_0xc018('0x9'));var fs=require('fs');var _=require(_0xc018('0xa'));var squel=require(_0xc018('0xb'));var crypto=require(_0xc018('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc018('0xd'));var toCsv=require(_0xc018('0x8'));var querystring=require(_0xc018('0xe'));var Papa=require(_0xc018('0xf'));var Redis=require(_0xc018('0x10'));var authService=require(_0xc018('0x11'));var qs=require(_0xc018('0x12'));var as=require(_0xc018('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc018('0x14'))(_0xc018('0x15'));var utils=require(_0xc018('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc018('0x17'));var db=require(_0xc018('0x18'))['db'];config[_0xc018('0x19')]=_[_0xc018('0x1a')](config[_0xc018('0x19')],{'host':_0xc018('0x1b'),'port':0x18eb});var socket=require(_0xc018('0x1c'))(new Redis(config[_0xc018('0x19')]));require(_0xc018('0x1d'))[_0xc018('0x1e')](socket);function respondWithStatusCode(_0x2f3839,_0x521677){_0x521677=_0x521677||0xcc;return function(_0xe7647c){if(_0xe7647c){return _0x2f3839['sendStatus'](_0x521677);}return _0x2f3839[_0xc018('0x1f')](_0x521677)[_0xc018('0x20')]();};}function respondWithResult(_0x3f5cf1,_0x3eba1d){_0x3eba1d=_0x3eba1d||0xc8;return function(_0x4217ce){if(_0x4217ce){return _0x3f5cf1[_0xc018('0x1f')](_0x3eba1d)[_0xc018('0x21')](_0x4217ce);}};}function respondWithFilteredResult(_0xb75067,_0x53a19f){return function(_0x3418a1){if(_0x3418a1){var _0x2cb421=_0x3418a1[_0xc018('0x22')],_0x4bf1d9=_0x53a19f['offset'],_0x49208e=_0x53a19f[_0xc018('0x23')]+_0x53a19f['limit'],_0x376bc2;if(_0x49208e>=_0x2cb421){_0x49208e=_0x2cb421;_0x376bc2=0xc8;}else{_0x376bc2=0xce;}_0xb75067['status'](_0x376bc2);return _0xb75067[_0xc018('0x24')](_0xc018('0x25'),_0x4bf1d9+'-'+_0x49208e+'/'+_0x2cb421)[_0xc018('0x21')](_0x3418a1);}return null;};}function patchUpdates(_0x4e0175){return function(_0x36a610){try{jsonpatch[_0xc018('0x26')](_0x36a610,_0x4e0175,!![]);}catch(_0x3a0a43){return BPromise[_0xc018('0x27')](_0x3a0a43);}return _0x36a610[_0xc018('0x28')]();};}function saveUpdates(_0xbaabcb,_0xf549ab){return function(_0x4af8a3){if(_0x4af8a3){return _0x4af8a3[_0xc018('0x29')](_0xbaabcb)[_0xc018('0x2a')](function(_0x4b25cd){return _0x4b25cd;});}return null;};}function removeEntity(_0x579fd5,_0xc37ed5){return function(_0x1a0058){if(_0x1a0058){return _0x1a0058[_0xc018('0x2b')]()[_0xc018('0x2a')](function(){var _0x54b304=_0x1a0058[_0xc018('0x2c')]({'plain':!![]});var _0x1ec889=_0xc018('0x2d');return db['UserProfileResource'][_0xc018('0x2b')]({'where':{'type':_0x1ec889,'resourceId':_0x54b304['id']}})[_0xc018('0x2a')](function(){return _0x1a0058;});})['then'](function(){_0x579fd5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9991,_0x51dd91){return function(_0x2e7129){if(!_0x2e7129){_0x2b9991['sendStatus'](0x194);}return _0x2e7129;};}function handleError(_0x20b668,_0x13e5b6){_0x13e5b6=_0x13e5b6||0x1f4;return function(_0x1b06b1){logger[_0xc018('0x2e')](_0x1b06b1[_0xc018('0x2f')]);if(_0x1b06b1['name']){delete _0x1b06b1[_0xc018('0x30')];}_0x20b668['status'](_0x13e5b6)['send'](_0x1b06b1);};}exports[_0xc018('0x31')]=function(_0x131da9,_0x43d631){var _0x418b1f={},_0x511f24={},_0x47dfd9={'count':0x0,'rows':[]};var _0x5ccf82=_[_0xc018('0x32')](db[_0xc018('0x33')][_0xc018('0x34')],function(_0xad29ee){return{'name':_0xad29ee[_0xc018('0x35')],'type':_0xad29ee[_0xc018('0x36')]['key']};});_0x511f24[_0xc018('0x37')]=_[_0xc018('0x32')](_0x5ccf82,_0xc018('0x30'));_0x511f24[_0xc018('0x38')]=_['keys'](_0x131da9['query']);_0x511f24[_0xc018('0x39')]=_[_0xc018('0x3a')](_0x511f24[_0xc018('0x37')],_0x511f24['query']);_0x418b1f[_0xc018('0x3b')]=_[_0xc018('0x3a')](_0x511f24[_0xc018('0x37')],qs[_0xc018('0x3c')](_0x131da9[_0xc018('0x38')][_0xc018('0x3c')]));_0x418b1f['attributes']=_0x418b1f[_0xc018('0x3b')][_0xc018('0x3d')]?_0x418b1f['attributes']:_0x511f24[_0xc018('0x37')];if(!_0x131da9[_0xc018('0x38')][_0xc018('0x3e')](_0xc018('0x3f'))){_0x418b1f[_0xc018('0x40')]=qs[_0xc018('0x40')](_0x131da9[_0xc018('0x38')]['limit']);_0x418b1f[_0xc018('0x23')]=qs['offset'](_0x131da9[_0xc018('0x38')][_0xc018('0x23')]);}_0x418b1f['order']=qs[_0xc018('0x41')](_0x131da9[_0xc018('0x38')][_0xc018('0x41')]);_0x418b1f[_0xc018('0x42')]=qs[_0xc018('0x39')](_[_0xc018('0x43')](_0x131da9[_0xc018('0x38')],_0x511f24['filters']),_0x5ccf82);if(_0x131da9[_0xc018('0x38')]['filter']){_0x418b1f[_0xc018('0x42')]=_['merge'](_0x418b1f['where'],{'$or':_[_0xc018('0x32')](_0x5ccf82,function(_0x2f2a1c){if(_0x2f2a1c[_0xc018('0x36')]!==_0xc018('0x44')){var _0x5597db={};_0x5597db[_0x2f2a1c[_0xc018('0x30')]]={'$like':'%'+_0x131da9[_0xc018('0x38')]['filter']+'%'};return _0x5597db;}})});}_0x418b1f=_[_0xc018('0x45')]({},_0x418b1f,_0x131da9['options']);var _0xba7e21={'where':_0x418b1f['where']};return db[_0xc018('0x33')]['count'](_0xba7e21)['then'](function(_0x3f2f15){_0x47dfd9[_0xc018('0x22')]=_0x3f2f15;if(_0x131da9['query']['includeAll']){_0x418b1f[_0xc018('0x46')]=[{'all':!![]}];}return db[_0xc018('0x33')]['findAll'](_0x418b1f);})[_0xc018('0x2a')](function(_0x1630b6){_0x47dfd9['rows']=_0x1630b6;return _0x47dfd9;})[_0xc018('0x2a')](respondWithFilteredResult(_0x43d631,_0x418b1f))[_0xc018('0x47')](handleError(_0x43d631,null));};exports[_0xc018('0x48')]=function(_0x110dea,_0x4551b2){var _0x4af8e4={'raw':!![],'where':{'id':_0x110dea[_0xc018('0x49')]['id']}},_0x4e7856={};_0x4e7856[_0xc018('0x37')]=_[_0xc018('0x4a')](db[_0xc018('0x33')][_0xc018('0x34')]);_0x4e7856[_0xc018('0x38')]=_['keys'](_0x110dea[_0xc018('0x38')]);_0x4e7856['filters']=_[_0xc018('0x3a')](_0x4e7856[_0xc018('0x37')],_0x4e7856[_0xc018('0x38')]);_0x4af8e4[_0xc018('0x3b')]=_['intersection'](_0x4e7856['model'],qs[_0xc018('0x3c')](_0x110dea[_0xc018('0x38')]['fields']));_0x4af8e4[_0xc018('0x3b')]=_0x4af8e4['attributes'][_0xc018('0x3d')]?_0x4af8e4[_0xc018('0x3b')]:_0x4e7856[_0xc018('0x37')];if(_0x110dea[_0xc018('0x38')][_0xc018('0x4b')]){_0x4af8e4[_0xc018('0x46')]=[{'all':!![]}];}_0x4af8e4=_[_0xc018('0x45')]({},_0x4af8e4,_0x110dea[_0xc018('0x4c')]);return db[_0xc018('0x33')][_0xc018('0x4d')](_0x4af8e4)['then'](handleEntityNotFound(_0x4551b2,null))[_0xc018('0x2a')](respondWithResult(_0x4551b2,null))['catch'](handleError(_0x4551b2,null));};exports['create']=function(_0x20ce9a,_0x384ee1){return db[_0xc018('0x33')][_0xc018('0x4e')](_0x20ce9a[_0xc018('0x4f')],{})[_0xc018('0x2a')](function(_0x588925){var _0x293143=_0x20ce9a['user'][_0xc018('0x2c')]({'plain':!![]});if(!_0x293143)throw new Error(_0xc018('0x50'));if(_0x293143[_0xc018('0x51')]===_0xc018('0x52')){var _0x438103=_0x588925[_0xc018('0x2c')]({'plain':!![]});var _0x3842db=_0xc018('0x2d');return db[_0xc018('0x53')][_0xc018('0x4d')]({'where':{'name':_0x3842db,'userProfileId':_0x293143['userProfileId']},'raw':!![]})[_0xc018('0x2a')](function(_0x5f5c32){if(_0x5f5c32&&_0x5f5c32['autoAssociation']===0x0){return db['UserProfileResource'][_0xc018('0x4e')]({'name':_0x438103[_0xc018('0x30')],'resourceId':_0x438103['id'],'type':_0x5f5c32[_0xc018('0x30')],'sectionId':_0x5f5c32['id']},{})[_0xc018('0x2a')](function(){return _0x588925;});}else{return _0x588925;}})['catch'](function(_0x2b57e5){logger['error'](_0xc018('0x54'),_0x2b57e5);throw _0x2b57e5;});}return _0x588925;})[_0xc018('0x2a')](respondWithResult(_0x384ee1,0xc9))[_0xc018('0x47')](handleError(_0x384ee1,null));};exports['update']=function(_0x1d7cb1,_0x3bbc9b){if(_0x1d7cb1['body']['id']){delete _0x1d7cb1[_0xc018('0x4f')]['id'];}return db[_0xc018('0x33')]['find']({'where':{'id':_0x1d7cb1[_0xc018('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bbc9b,null))[_0xc018('0x2a')](saveUpdates(_0x1d7cb1[_0xc018('0x4f')],null))[_0xc018('0x2a')](respondWithResult(_0x3bbc9b,null))['catch'](handleError(_0x3bbc9b,null));};exports[_0xc018('0x2b')]=function(_0x24d77d,_0x102903){return db[_0xc018('0x33')]['find']({'where':{'id':_0x24d77d['params']['id']}})['then'](handleEntityNotFound(_0x102903,null))[_0xc018('0x2a')](removeEntity(_0x102903,null))[_0xc018('0x47')](handleError(_0x102903,null));};exports[_0xc018('0x55')]=function(_0x53acb0,_0x50c28c){return db[_0xc018('0x33')][_0xc018('0x55')]()[_0xc018('0x2a')](respondWithResult(_0x50c28c,null))['catch'](handleError(_0x50c28c,null));};exports[_0xc018('0x56')]=function(_0x4df540,_0x4dc3cd,_0x55d3b4){var _0x387798={'raw':!![],'where':{}},_0x1dba8e={},_0x568925;return db[_0xc018('0x33')][_0xc018('0x57')]({'where':{'id':_0x4df540[_0xc018('0x49')]['id']}})[_0xc018('0x2a')](handleEntityNotFound(_0x4dc3cd,null))[_0xc018('0x2a')](function(_0x41f8ce){if(_0x41f8ce){_0x568925=_0x41f8ce[_0xc018('0x2c')]({'plain':!![]});_0x1dba8e[_0xc018('0x37')]=_['keys'](db[_0xc018('0x58')][_0xc018('0x34')]);_0x1dba8e['query']=_['keys'](_0x4df540[_0xc018('0x38')]);_0x1dba8e[_0xc018('0x39')]=_[_0xc018('0x3a')](_0x1dba8e[_0xc018('0x37')],_0x1dba8e[_0xc018('0x38')]);_0x387798[_0xc018('0x3b')]=_['intersection'](_0x1dba8e[_0xc018('0x37')],qs[_0xc018('0x3c')](_0x4df540[_0xc018('0x38')][_0xc018('0x3c')]));_0x387798[_0xc018('0x3b')]=_0x387798[_0xc018('0x3b')][_0xc018('0x3d')]?_0x387798[_0xc018('0x3b')]:_0x1dba8e['model'];if(!_0x4df540[_0xc018('0x38')][_0xc018('0x3e')](_0xc018('0x3f'))){_0x387798['limit']=qs[_0xc018('0x40')](_0x4df540[_0xc018('0x38')][_0xc018('0x40')]);_0x387798[_0xc018('0x23')]=qs['offset'](_0x4df540['query'][_0xc018('0x23')]);}_0x387798[_0xc018('0x59')]=qs[_0xc018('0x41')](_0x4df540[_0xc018('0x38')]['sort']);_0x387798[_0xc018('0x42')]=qs['filters'](_[_0xc018('0x43')](_0x4df540[_0xc018('0x38')],_0x1dba8e[_0xc018('0x39')]));_0x387798['where'][_0xc018('0x5a')]=_0x41f8ce['id'];if(_0x4df540[_0xc018('0x38')][_0xc018('0x5b')]){_0x387798['where']=_[_0xc018('0x45')](_0x387798[_0xc018('0x42')],{'$or':_['map'](_0x387798[_0xc018('0x3b')],function(_0x5d54b1){var _0x51cb4b={};_0x51cb4b[_0x5d54b1]={'$like':'%'+_0x4df540[_0xc018('0x38')][_0xc018('0x5b')]+'%'};return _0x51cb4b;})});}_0x387798=_['merge']({},_0x387798,_0x4df540[_0xc018('0x4c')]);return db[_0xc018('0x58')]['findAll'](_0x387798);}})[_0xc018('0x2a')](function(_0x8fefdc){if(_0x8fefdc){return db[_0xc018('0x5c')][_0xc018('0x5d')]({'where':{'id':_[_0xc018('0x32')](_0x8fefdc,'UserId'),'role':_0xc018('0x5e')},'attributes':['id',_0xc018('0x30'),_0xc018('0x5f'),_0xc018('0x60'),_0xc018('0x61')]});}})[_0xc018('0x2a')](function(_0x2daabf){if(_0x2daabf){return{'count':_0x2daabf['count'],'rows':_['map'](_0x2daabf[_0xc018('0x62')],function(_0x294070){return{'membername':_0x294070[_0xc018('0x30')],'UserId':_0x294070['id'],'queue_name':_0x568925[_0xc018('0x30')],'WhatsappQueueId':_0x568925['id'],'interface':util['format'](_0xc018('0x63'),_0xc018('0x64'),_0x294070[_0xc018('0x30')]),'penalty':0x0,'paused':_0x294070[_0xc018('0x5f')],'createdAt':_0x294070['createdAt'],'updatedAt':_0x294070[_0xc018('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc018('0x2a')](respondWithFilteredResult(_0x4dc3cd,_0x387798))[_0xc018('0x47')](handleError(_0x4dc3cd,null));};exports['getTeams']=function(_0x1d48f0,_0x23767f,_0x401f14){var _0x2f9ae9={};var _0x1db2b2={};var _0x39c361;var _0x5bda3e;return db[_0xc018('0x33')][_0xc018('0x57')]({'where':{'id':_0x1d48f0['params']['id']}})[_0xc018('0x2a')](handleEntityNotFound(_0x23767f,null))[_0xc018('0x2a')](function(_0x46ac8c){if(_0x46ac8c){_0x39c361=_0x46ac8c;_0x1db2b2['model']=_[_0xc018('0x4a')](db[_0xc018('0x65')][_0xc018('0x34')]);_0x1db2b2['query']=_[_0xc018('0x4a')](_0x1d48f0[_0xc018('0x38')]);_0x1db2b2[_0xc018('0x39')]=_['intersection'](_0x1db2b2[_0xc018('0x37')],_0x1db2b2[_0xc018('0x38')]);_0x2f9ae9[_0xc018('0x3b')]=_[_0xc018('0x3a')](_0x1db2b2[_0xc018('0x37')],qs[_0xc018('0x3c')](_0x1d48f0['query']['fields']));_0x2f9ae9[_0xc018('0x3b')]=_0x2f9ae9[_0xc018('0x3b')][_0xc018('0x3d')]?_0x2f9ae9[_0xc018('0x3b')]:_0x1db2b2[_0xc018('0x37')];_0x2f9ae9['order']=qs[_0xc018('0x41')](_0x1d48f0['query'][_0xc018('0x41')]);_0x2f9ae9[_0xc018('0x42')]=qs[_0xc018('0x39')](_[_0xc018('0x43')](_0x1d48f0[_0xc018('0x38')],_0x1db2b2[_0xc018('0x39')]));if(_0x1d48f0[_0xc018('0x38')][_0xc018('0x5b')]){_0x2f9ae9['where']=_[_0xc018('0x45')](_0x2f9ae9['where'],{'$or':_[_0xc018('0x32')](_0x2f9ae9['attributes'],function(_0x35622b){var _0x5e6fe7={};_0x5e6fe7[_0x35622b]={'$like':'%'+_0x1d48f0['query']['filter']+'%'};return _0x5e6fe7;})});}_0x2f9ae9=_[_0xc018('0x45')]({},_0x2f9ae9,_0x1d48f0[_0xc018('0x4c')]);return _0x39c361[_0xc018('0x66')](_0x2f9ae9);}})[_0xc018('0x2a')](function(_0x99a1a4){if(_0x99a1a4){_0x5bda3e=_0x99a1a4[_0xc018('0x3d')];if(!_0x1d48f0[_0xc018('0x38')][_0xc018('0x3e')](_0xc018('0x3f'))){_0x2f9ae9[_0xc018('0x40')]=qs['limit'](_0x1d48f0[_0xc018('0x38')][_0xc018('0x40')]);_0x2f9ae9[_0xc018('0x23')]=qs[_0xc018('0x23')](_0x1d48f0['query'][_0xc018('0x23')]);}return _0x39c361[_0xc018('0x66')](_0x2f9ae9);}})[_0xc018('0x2a')](function(_0x414a9a){if(_0x414a9a){return _0x414a9a?{'count':_0x5bda3e,'rows':_0x414a9a}:null;}})[_0xc018('0x2a')](respondWithResult(_0x23767f,null))['catch'](handleError(_0x23767f,null));};exports[_0xc018('0x67')]=function(_0x50431b,_0x55f7f5,_0x277b96){var _0x176e42=_0x50431b['body'][_0xc018('0x68')];return db[_0xc018('0x65')]['findAll']({'where':{'id':_0x176e42},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xc018('0x30'),'online',_0xc018('0x69'),_0xc018('0x6a')],'raw':!![]}]})['then'](function(_0x548019){if(_0x548019){var _0x133b27=_[_0xc018('0x6b')](_0x548019,function(_0xbaf5c8){var _0x3db103=_0xbaf5c8[_0xc018('0x2c')]({'plain':!![]});return _0x3db103[_0xc018('0x6c')];});return db[_0xc018('0x33')][_0xc018('0x4d')]({'where':{'id':_0x50431b['params']['id']}})[_0xc018('0x2a')](function(_0x38edb3){return db[_0xc018('0x6d')]['transaction'](function(_0x64abd5){return _0x38edb3[_0xc018('0x67')](_0x176e42,{'transaction':_0x64abd5})['then'](function(){return BPromise[_0xc018('0x6e')](_0x133b27,function(_0x2dae94){return db[_0xc018('0x58')][_0xc018('0x6f')]({'where':{'UserId':_0x2dae94['id'],'WhatsappQueueId':_0x50431b[_0xc018('0x49')]['id']},'transaction':_0x64abd5});});})[_0xc018('0x2a')](function(){_0x133b27[_0xc018('0x70')](function(_0x37020d){socket[_0xc018('0x71')](_0xc018('0x72'),{'UserId':_0x37020d['id'],'WhatsappQueueId':_0x38edb3['id']});});});});});}})[_0xc018('0x2a')](respondWithStatusCode(_0x55f7f5,null))[_0xc018('0x47')](handleError(_0x55f7f5,null));};exports[_0xc018('0x73')]=function(_0x2f1968,_0x4497c0,_0x5cb4d8){return db['Team']['findAll']({'where':{'id':_0x2f1968[_0xc018('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc018('0x5c')],'as':_0xc018('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xc018('0x2a')](handleEntityNotFound(_0x4497c0,null))[_0xc018('0x2a')](function(_0x5b38b7){var _0x177aa0=_[_0xc018('0x32')](_0x5b38b7,'id');var _0x398449=[];var _0x19c4b8=[];var _0x140814=squel[_0xc018('0x74')]();_0x140814[_0xc018('0x75')](_0xc018('0x76'))['from'](_0xc018('0x77'),'tq')[_0xc018('0x78')]('user_has_teams','ut',_0xc018('0x79'))['where'](_0xc018('0x7a'),_0x2f1968[_0xc018('0x49')]['id']);for(var _0x6bae83=0x0;_0x6bae83<_0x5b38b7['length'];_0x6bae83+=0x1){let _0x1feda1=_0x5b38b7[_0x6bae83];for(var _0x1fe672=0x0;_0x1fe672<_0x1feda1[_0xc018('0x6c')][_0xc018('0x3d')];_0x1fe672+=0x1){let _0x399780=_0x1feda1['Agents'][_0x1fe672];var _0x312aa7=_0x140814[_0xc018('0x7b')]();_0x312aa7[_0xc018('0x42')](_0xc018('0x7c'),_0x399780['id']);_0x19c4b8['push'](db['sequelize'][_0xc018('0x38')](_0x312aa7[_0xc018('0x7d')](),{'type':db[_0xc018('0x6d')][_0xc018('0x7e')]['SELECT']})[_0xc018('0x2a')](function(_0x1c8d03){if(_0x1c8d03[_0xc018('0x3d')]===0x1){return _0x399780['id'];}else{var _0xce99da=_['every'](_[_0xc018('0x32')](_0x1c8d03,_0xc018('0x7f')),function(_0x3b75ab){return _[_0xc018('0x80')](_0x177aa0,_0x3b75ab);});if(_0xce99da){return _0x399780['id'];}}}));}}return BPromise[_0xc018('0x81')](_0x19c4b8)[_0xc018('0x2a')](function(_0x1eb1eb){_0x398449=_(_0x398449)['union'](_0x1eb1eb)[_0xc018('0x82')]()['value']();return db[_0xc018('0x33')][_0xc018('0x4d')]({'where':{'id':_0x2f1968['params']['id']}})[_0xc018('0x2a')](function(_0x1f4129){return db[_0xc018('0x6d')][_0xc018('0x83')](function(_0x55d443){return _0x1f4129[_0xc018('0x73')](_0x2f1968[_0xc018('0x38')]['ids'],{'transaction':_0x55d443})[_0xc018('0x2a')](function(){if(!_[_0xc018('0x84')](_0x398449)){return _0x1f4129[_0xc018('0x85')](_0x398449,{'transaction':_0x55d443});}})[_0xc018('0x2a')](function(){_0x398449[_0xc018('0x70')](function(_0x553569){socket[_0xc018('0x71')](_0xc018('0x86'),{'UserId':_0x553569,'WhatsappQueueId':_0x1f4129['id']});});});});});});})[_0xc018('0x2a')](respondWithStatusCode(_0x4497c0,null))[_0xc018('0x47')](handleError(_0x4497c0,null));};exports[_0xc018('0x87')]=function(_0x13cc72,_0x41d7b2,_0x534a23){return db[_0xc018('0x33')][_0xc018('0x4d')]({'where':{'id':_0x13cc72[_0xc018('0x49')]['id']}})[_0xc018('0x2a')](handleEntityNotFound(_0x41d7b2,null))[_0xc018('0x2a')](function(_0x3ccd6f){if(_0x3ccd6f){return _0x3ccd6f[_0xc018('0x87')](_0x13cc72[_0xc018('0x4f')][_0xc018('0x68')],_['omit'](_0x13cc72[_0xc018('0x4f')],[_0xc018('0x68'),'id'])||{})['spread'](function(_0x4435e6){for(var _0x12bf19=0x0;_0x12bf19<_0x13cc72[_0xc018('0x4f')][_0xc018('0x68')][_0xc018('0x3d')];_0x12bf19+=0x1){socket[_0xc018('0x71')]('userWhatsappQueue:save',{'UserId':_0x13cc72[_0xc018('0x4f')]['ids'][_0x12bf19],'WhatsappQueueId':_0x13cc72[_0xc018('0x49')]['id']});}return _0x4435e6;});}})[_0xc018('0x2a')](respondWithResult(_0x41d7b2,null))[_0xc018('0x47')](handleError(_0x41d7b2,null));};exports[_0xc018('0x85')]=function(_0xa2c66a,_0x27bde2,_0x3e04b1){return db[_0xc018('0x33')][_0xc018('0x4d')]({'where':{'id':_0xa2c66a['params']['id']}})[_0xc018('0x2a')](handleEntityNotFound(_0x27bde2,null))[_0xc018('0x2a')](function(_0x437742){if(_0x437742){return _0x437742['removeAgents'](_0xa2c66a[_0xc018('0x38')][_0xc018('0x68')])[_0xc018('0x2a')](function(){if(_[_0xc018('0x88')](_0xa2c66a[_0xc018('0x38')][_0xc018('0x68')])){for(var _0x1f4951=0x0;_0x1f4951<_0xa2c66a['query'][_0xc018('0x68')][_0xc018('0x3d')];_0x1f4951+=0x1){socket[_0xc018('0x71')](_0xc018('0x86'),{'UserId':Number(_0xa2c66a[_0xc018('0x38')]['ids'][_0x1f4951]),'WhatsappQueueId':Number(_0xa2c66a[_0xc018('0x49')]['id'])});}}else{socket[_0xc018('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0xa2c66a[_0xc018('0x38')][_0xc018('0x68')]),'WhatsappQueueId':Number(_0xa2c66a[_0xc018('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x27bde2,null))[_0xc018('0x47')](handleError(_0x27bde2,null));};exports[_0xc018('0x89')]=function(_0x96d052,_0x4ae437,_0x43e10c){var _0x41fa13={};var _0x283ef9={};var _0x82587;var _0x214b20;return db[_0xc018('0x33')][_0xc018('0x57')]({'where':{'id':_0x96d052['params']['id']}})[_0xc018('0x2a')](handleEntityNotFound(_0x4ae437,null))[_0xc018('0x2a')](function(_0x145218){if(_0x145218){_0x82587=_0x145218;_0x283ef9['model']=_[_0xc018('0x4a')](db[_0xc018('0x5c')][_0xc018('0x34')]);_0x283ef9[_0xc018('0x38')]=_[_0xc018('0x4a')](_0x96d052[_0xc018('0x38')]);_0x283ef9[_0xc018('0x39')]=_[_0xc018('0x3a')](_0x283ef9[_0xc018('0x37')],_0x283ef9[_0xc018('0x38')]);_0x41fa13['attributes']=_[_0xc018('0x3a')](_0x283ef9[_0xc018('0x37')],qs['fields'](_0x96d052['query']['fields']));_0x41fa13['attributes']=_0x41fa13[_0xc018('0x3b')]['length']?_0x41fa13[_0xc018('0x3b')]:_0x283ef9[_0xc018('0x37')];_0x41fa13[_0xc018('0x59')]=qs[_0xc018('0x41')](_0x96d052[_0xc018('0x38')][_0xc018('0x41')]);_0x41fa13[_0xc018('0x42')]=qs[_0xc018('0x39')](_[_0xc018('0x43')](_0x96d052[_0xc018('0x38')],_0x283ef9[_0xc018('0x39')]));if(_0x96d052['query'][_0xc018('0x5b')]){_0x41fa13['where']=_[_0xc018('0x45')](_0x41fa13[_0xc018('0x42')],{'$or':_['map'](_0x41fa13[_0xc018('0x3b')],function(_0x127e35){var _0x389f25={};_0x389f25[_0x127e35]={'$like':'%'+_0x96d052['query'][_0xc018('0x5b')]+'%'};return _0x389f25;})});}_0x41fa13=_[_0xc018('0x45')]({},_0x41fa13,_0x96d052[_0xc018('0x4c')]);return _0x82587['getAgents'](_0x41fa13);}})[_0xc018('0x2a')](function(_0x3cd25c){if(_0x3cd25c){_0x214b20=_0x3cd25c[_0xc018('0x3d')];if(!_0x96d052['query'][_0xc018('0x3e')]('nolimit')){_0x41fa13['limit']=qs['limit'](_0x96d052[_0xc018('0x38')][_0xc018('0x40')]);_0x41fa13[_0xc018('0x23')]=qs[_0xc018('0x23')](_0x96d052[_0xc018('0x38')][_0xc018('0x23')]);}return _0x82587[_0xc018('0x89')](_0x41fa13);}})[_0xc018('0x2a')](function(_0x3c05d1){if(_0x3c05d1){return _0x3c05d1?{'count':_0x214b20,'rows':_0x3c05d1}:null;}})[_0xc018('0x2a')](respondWithResult(_0x4ae437,null))[_0xc018('0x47')](handleError(_0x4ae437,null));}; \ No newline at end of file +var _0xbd1b=['removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','format','SIP','createdAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','removeTeams','isEmpty'];(function(_0x49e11c,_0x13a573){var _0x4c6ef3=function(_0x151e95){while(--_0x151e95){_0x49e11c['push'](_0x49e11c['shift']());}};_0x4c6ef3(++_0x13a573);}(_0xbd1b,0x125));var _0xbbd1=function(_0x3475a6,_0xf36f21){_0x3475a6=_0x3475a6-0x0;var _0x556b92=_0xbd1b[_0x3475a6];return _0x556b92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbd1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbd1('0x1'));var jsonpatch=require(_0xbbd1('0x2'));var rp=require(_0xbbd1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbd1('0x4'));var util=require(_0xbbd1('0x5'));var path=require('path');var sox=require(_0xbbd1('0x6'));var csv=require(_0xbbd1('0x7'));var ejs=require(_0xbbd1('0x8'));var fs=require('fs');var _=require(_0xbbd1('0x9'));var squel=require(_0xbbd1('0xa'));var crypto=require(_0xbbd1('0xb'));var jsforce=require(_0xbbd1('0xc'));var deskjs=require(_0xbbd1('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbbd1('0xe'));var Papa=require(_0xbbd1('0xf'));var Redis=require(_0xbbd1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbbd1('0x11'));var as=require(_0xbbd1('0x12'));var hardwareService=require(_0xbbd1('0x13'));var logger=require('../../config/logger')(_0xbbd1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbbd1('0x15'));var db=require(_0xbbd1('0x16'))['db'];config[_0xbbd1('0x17')]=_[_0xbbd1('0x18')](config[_0xbbd1('0x17')],{'host':_0xbbd1('0x19'),'port':0x18eb});var socket=require(_0xbbd1('0x1a'))(new Redis(config['redis']));require(_0xbbd1('0x1b'))[_0xbbd1('0x1c')](socket);function respondWithStatusCode(_0x17edda,_0x122fbf){_0x122fbf=_0x122fbf||0xcc;return function(_0x2ea67d){if(_0x2ea67d){return _0x17edda[_0xbbd1('0x1d')](_0x122fbf);}return _0x17edda[_0xbbd1('0x1e')](_0x122fbf)[_0xbbd1('0x1f')]();};}function respondWithResult(_0x19fcf8,_0x4b680a){_0x4b680a=_0x4b680a||0xc8;return function(_0x2df861){if(_0x2df861){return _0x19fcf8[_0xbbd1('0x1e')](_0x4b680a)['json'](_0x2df861);}};}function respondWithFilteredResult(_0x287c35,_0x5bd7ea){return function(_0x1fc670){if(_0x1fc670){var _0x5622f6=_0x1fc670[_0xbbd1('0x20')],_0x49fd9c=_0x5bd7ea[_0xbbd1('0x21')],_0x3f0749=_0x5bd7ea[_0xbbd1('0x21')]+_0x5bd7ea[_0xbbd1('0x22')],_0x369ba5;if(_0x3f0749>=_0x5622f6){_0x3f0749=_0x5622f6;_0x369ba5=0xc8;}else{_0x369ba5=0xce;}_0x287c35['status'](_0x369ba5);return _0x287c35[_0xbbd1('0x23')](_0xbbd1('0x24'),_0x49fd9c+'-'+_0x3f0749+'/'+_0x5622f6)[_0xbbd1('0x25')](_0x1fc670);}return null;};}function patchUpdates(_0x3c46fd){return function(_0x4fa20a){try{jsonpatch[_0xbbd1('0x26')](_0x4fa20a,_0x3c46fd,!![]);}catch(_0x168af7){return BPromise['reject'](_0x168af7);}return _0x4fa20a[_0xbbd1('0x27')]();};}function saveUpdates(_0x49a36e,_0x30f12c){return function(_0x1b7fa1){if(_0x1b7fa1){return _0x1b7fa1[_0xbbd1('0x28')](_0x49a36e)['then'](function(_0x453186){return _0x453186;});}return null;};}function removeEntity(_0x10c155,_0x3cd5d0){return function(_0x3d9a32){if(_0x3d9a32){return _0x3d9a32[_0xbbd1('0x29')]()[_0xbbd1('0x2a')](function(){var _0x4b11b2=_0x3d9a32['get']({'plain':!![]});var _0x2f9370=_0xbbd1('0x2b');return db[_0xbbd1('0x2c')][_0xbbd1('0x29')]({'where':{'type':_0x2f9370,'resourceId':_0x4b11b2['id']}})['then'](function(){return _0x3d9a32;});})[_0xbbd1('0x2a')](function(){_0x10c155[_0xbbd1('0x1e')](0xcc)[_0xbbd1('0x1f')]();});}};}function handleEntityNotFound(_0x1a3b85,_0x37d14d){return function(_0x15172a){if(!_0x15172a){_0x1a3b85[_0xbbd1('0x1d')](0x194);}return _0x15172a;};}function handleError(_0x52b24e,_0x5c608e){_0x5c608e=_0x5c608e||0x1f4;return function(_0x5c9325){logger[_0xbbd1('0x2d')](_0x5c9325[_0xbbd1('0x2e')]);if(_0x5c9325[_0xbbd1('0x2f')]){delete _0x5c9325[_0xbbd1('0x2f')];}_0x52b24e[_0xbbd1('0x1e')](_0x5c608e)[_0xbbd1('0x30')](_0x5c9325);};}exports[_0xbbd1('0x31')]=function(_0x47db1b,_0x1f2a3f){var _0x5694a5={},_0x2b5597={},_0x1729d6={'count':0x0,'rows':[]};var _0x474b83=_['map'](db[_0xbbd1('0x32')]['rawAttributes'],function(_0x3a7de0){return{'name':_0x3a7de0[_0xbbd1('0x33')],'type':_0x3a7de0['type'][_0xbbd1('0x34')]};});_0x2b5597[_0xbbd1('0x35')]=_['map'](_0x474b83,_0xbbd1('0x2f'));_0x2b5597[_0xbbd1('0x36')]=_[_0xbbd1('0x37')](_0x47db1b[_0xbbd1('0x36')]);_0x2b5597[_0xbbd1('0x38')]=_['intersection'](_0x2b5597[_0xbbd1('0x35')],_0x2b5597[_0xbbd1('0x36')]);_0x5694a5[_0xbbd1('0x39')]=_[_0xbbd1('0x3a')](_0x2b5597['model'],qs['fields'](_0x47db1b[_0xbbd1('0x36')][_0xbbd1('0x3b')]));_0x5694a5[_0xbbd1('0x39')]=_0x5694a5[_0xbbd1('0x39')]['length']?_0x5694a5[_0xbbd1('0x39')]:_0x2b5597[_0xbbd1('0x35')];if(!_0x47db1b['query'][_0xbbd1('0x3c')](_0xbbd1('0x3d'))){_0x5694a5[_0xbbd1('0x22')]=qs['limit'](_0x47db1b[_0xbbd1('0x36')][_0xbbd1('0x22')]);_0x5694a5[_0xbbd1('0x21')]=qs[_0xbbd1('0x21')](_0x47db1b[_0xbbd1('0x36')][_0xbbd1('0x21')]);}_0x5694a5[_0xbbd1('0x3e')]=qs[_0xbbd1('0x3f')](_0x47db1b['query'][_0xbbd1('0x3f')]);_0x5694a5[_0xbbd1('0x40')]=qs['filters'](_[_0xbbd1('0x41')](_0x47db1b[_0xbbd1('0x36')],_0x2b5597['filters']),_0x474b83);if(_0x47db1b[_0xbbd1('0x36')][_0xbbd1('0x42')]){_0x5694a5[_0xbbd1('0x40')]=_[_0xbbd1('0x43')](_0x5694a5[_0xbbd1('0x40')],{'$or':_[_0xbbd1('0x44')](_0x474b83,function(_0x3d2d71){if(_0x3d2d71[_0xbbd1('0x45')]!==_0xbbd1('0x46')){var _0x5c2c1b={};_0x5c2c1b[_0x3d2d71[_0xbbd1('0x2f')]]={'$like':'%'+_0x47db1b[_0xbbd1('0x36')][_0xbbd1('0x42')]+'%'};return _0x5c2c1b;}})});}_0x5694a5=_['merge']({},_0x5694a5,_0x47db1b['options']);var _0x56f83b={'where':_0x5694a5['where']};return db[_0xbbd1('0x32')][_0xbbd1('0x20')](_0x56f83b)['then'](function(_0x195a62){_0x1729d6['count']=_0x195a62;if(_0x47db1b[_0xbbd1('0x36')]['includeAll']){_0x5694a5[_0xbbd1('0x47')]=[{'all':!![]}];}return db[_0xbbd1('0x32')][_0xbbd1('0x48')](_0x5694a5);})['then'](function(_0x473162){_0x1729d6[_0xbbd1('0x49')]=_0x473162;return _0x1729d6;})[_0xbbd1('0x2a')](respondWithFilteredResult(_0x1f2a3f,_0x5694a5))[_0xbbd1('0x4a')](handleError(_0x1f2a3f,null));};exports[_0xbbd1('0x4b')]=function(_0x16a0e8,_0x2ee878){var _0x20ac8e={'raw':!![],'where':{'id':_0x16a0e8[_0xbbd1('0x4c')]['id']}},_0x526a47={};_0x526a47['model']=_[_0xbbd1('0x37')](db['WhatsappQueue'][_0xbbd1('0x4d')]);_0x526a47['query']=_[_0xbbd1('0x37')](_0x16a0e8[_0xbbd1('0x36')]);_0x526a47[_0xbbd1('0x38')]=_[_0xbbd1('0x3a')](_0x526a47[_0xbbd1('0x35')],_0x526a47[_0xbbd1('0x36')]);_0x20ac8e[_0xbbd1('0x39')]=_[_0xbbd1('0x3a')](_0x526a47[_0xbbd1('0x35')],qs[_0xbbd1('0x3b')](_0x16a0e8[_0xbbd1('0x36')][_0xbbd1('0x3b')]));_0x20ac8e['attributes']=_0x20ac8e[_0xbbd1('0x39')][_0xbbd1('0x4e')]?_0x20ac8e[_0xbbd1('0x39')]:_0x526a47[_0xbbd1('0x35')];if(_0x16a0e8[_0xbbd1('0x36')]['includeAll']){_0x20ac8e[_0xbbd1('0x47')]=[{'all':!![]}];}_0x20ac8e=_['merge']({},_0x20ac8e,_0x16a0e8[_0xbbd1('0x4f')]);return db[_0xbbd1('0x32')][_0xbbd1('0x50')](_0x20ac8e)['then'](handleEntityNotFound(_0x2ee878,null))['then'](respondWithResult(_0x2ee878,null))[_0xbbd1('0x4a')](handleError(_0x2ee878,null));};exports['create']=function(_0x1e3189,_0x2dccf0){return db[_0xbbd1('0x32')][_0xbbd1('0x51')](_0x1e3189[_0xbbd1('0x52')],{})[_0xbbd1('0x2a')](function(_0xb87d7){var _0x36bbbc=_0x1e3189[_0xbbd1('0x53')][_0xbbd1('0x54')]({'plain':!![]});if(!_0x36bbbc)throw new Error(_0xbbd1('0x55'));if(_0x36bbbc[_0xbbd1('0x56')]==='user'){var _0x275387=_0xb87d7[_0xbbd1('0x54')]({'plain':!![]});var _0x3483ee=_0xbbd1('0x2b');return db['UserProfileSection'][_0xbbd1('0x50')]({'where':{'name':_0x3483ee,'userProfileId':_0x36bbbc['userProfileId']},'raw':!![]})['then'](function(_0x391008){if(_0x391008&&_0x391008['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x275387[_0xbbd1('0x2f')],'resourceId':_0x275387['id'],'type':_0x391008[_0xbbd1('0x2f')],'sectionId':_0x391008['id']},{})[_0xbbd1('0x2a')](function(){return _0xb87d7;});}else{return _0xb87d7;}})[_0xbbd1('0x4a')](function(_0x3db5a2){logger[_0xbbd1('0x2d')](_0xbbd1('0x57'),_0x3db5a2);throw _0x3db5a2;});}return _0xb87d7;})[_0xbbd1('0x2a')](respondWithResult(_0x2dccf0,0xc9))['catch'](handleError(_0x2dccf0,null));};exports['update']=function(_0x5e069e,_0x19e9d8){if(_0x5e069e['body']['id']){delete _0x5e069e['body']['id'];}return db['WhatsappQueue'][_0xbbd1('0x50')]({'where':{'id':_0x5e069e[_0xbbd1('0x4c')]['id']}})[_0xbbd1('0x2a')](handleEntityNotFound(_0x19e9d8,null))[_0xbbd1('0x2a')](saveUpdates(_0x5e069e['body'],null))['then'](respondWithResult(_0x19e9d8,null))[_0xbbd1('0x4a')](handleError(_0x19e9d8,null));};exports[_0xbbd1('0x29')]=function(_0x4f87ab,_0x19d92f){return db[_0xbbd1('0x32')]['find']({'where':{'id':_0x4f87ab[_0xbbd1('0x4c')]['id']}})[_0xbbd1('0x2a')](handleEntityNotFound(_0x19d92f,null))[_0xbbd1('0x2a')](removeEntity(_0x19d92f,null))[_0xbbd1('0x4a')](handleError(_0x19d92f,null));};exports['describe']=function(_0x5079d7,_0x281e67){return db[_0xbbd1('0x32')][_0xbbd1('0x58')]()[_0xbbd1('0x2a')](respondWithResult(_0x281e67,null))['catch'](handleError(_0x281e67,null));};exports[_0xbbd1('0x59')]=function(_0x220e02,_0x1aedfc,_0x18dc05){var _0x5b969d={'raw':!![],'where':{}},_0x2d3c25={},_0x216e21;return db[_0xbbd1('0x32')][_0xbbd1('0x5a')]({'where':{'id':_0x220e02[_0xbbd1('0x4c')]['id']}})[_0xbbd1('0x2a')](handleEntityNotFound(_0x1aedfc,null))[_0xbbd1('0x2a')](function(_0x302c8c){if(_0x302c8c){_0x216e21=_0x302c8c[_0xbbd1('0x54')]({'plain':!![]});_0x2d3c25[_0xbbd1('0x35')]=_[_0xbbd1('0x37')](db[_0xbbd1('0x5b')]['rawAttributes']);_0x2d3c25[_0xbbd1('0x36')]=_['keys'](_0x220e02[_0xbbd1('0x36')]);_0x2d3c25[_0xbbd1('0x38')]=_[_0xbbd1('0x3a')](_0x2d3c25[_0xbbd1('0x35')],_0x2d3c25[_0xbbd1('0x36')]);_0x5b969d[_0xbbd1('0x39')]=_[_0xbbd1('0x3a')](_0x2d3c25[_0xbbd1('0x35')],qs[_0xbbd1('0x3b')](_0x220e02[_0xbbd1('0x36')][_0xbbd1('0x3b')]));_0x5b969d[_0xbbd1('0x39')]=_0x5b969d[_0xbbd1('0x39')][_0xbbd1('0x4e')]?_0x5b969d['attributes']:_0x2d3c25[_0xbbd1('0x35')];if(!_0x220e02[_0xbbd1('0x36')][_0xbbd1('0x3c')](_0xbbd1('0x3d'))){_0x5b969d[_0xbbd1('0x22')]=qs[_0xbbd1('0x22')](_0x220e02[_0xbbd1('0x36')][_0xbbd1('0x22')]);_0x5b969d[_0xbbd1('0x21')]=qs[_0xbbd1('0x21')](_0x220e02[_0xbbd1('0x36')]['offset']);}_0x5b969d[_0xbbd1('0x3e')]=qs['sort'](_0x220e02[_0xbbd1('0x36')][_0xbbd1('0x3f')]);_0x5b969d['where']=qs[_0xbbd1('0x38')](_[_0xbbd1('0x41')](_0x220e02['query'],_0x2d3c25[_0xbbd1('0x38')]));_0x5b969d[_0xbbd1('0x40')][_0xbbd1('0x5c')]=_0x302c8c['id'];if(_0x220e02[_0xbbd1('0x36')][_0xbbd1('0x42')]){_0x5b969d[_0xbbd1('0x40')]=_[_0xbbd1('0x43')](_0x5b969d['where'],{'$or':_[_0xbbd1('0x44')](_0x5b969d[_0xbbd1('0x39')],function(_0x15cf45){var _0x3b6b9f={};_0x3b6b9f[_0x15cf45]={'$like':'%'+_0x220e02['query'][_0xbbd1('0x42')]+'%'};return _0x3b6b9f;})});}_0x5b969d=_[_0xbbd1('0x43')]({},_0x5b969d,_0x220e02[_0xbbd1('0x4f')]);return db[_0xbbd1('0x5b')][_0xbbd1('0x48')](_0x5b969d);}})[_0xbbd1('0x2a')](function(_0x2abe8a){if(_0x2abe8a){return db[_0xbbd1('0x5d')][_0xbbd1('0x5e')]({'where':{'id':_[_0xbbd1('0x44')](_0x2abe8a,'UserId'),'role':_0xbbd1('0x5f')},'attributes':['id',_0xbbd1('0x2f'),_0xbbd1('0x60'),_0xbbd1('0x61'),'createdAt']});}})[_0xbbd1('0x2a')](function(_0x20d2ab){if(_0x20d2ab){return{'count':_0x20d2ab[_0xbbd1('0x20')],'rows':_['map'](_0x20d2ab[_0xbbd1('0x49')],function(_0x1452be){return{'membername':_0x1452be['name'],'UserId':_0x1452be['id'],'queue_name':_0x216e21[_0xbbd1('0x2f')],'WhatsappQueueId':_0x216e21['id'],'interface':util[_0xbbd1('0x62')]('%s/%s',_0xbbd1('0x63'),_0x1452be[_0xbbd1('0x2f')]),'penalty':0x0,'paused':_0x1452be[_0xbbd1('0x60')],'createdAt':_0x1452be[_0xbbd1('0x64')],'updatedAt':_0x1452be['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbbd1('0x2a')](respondWithFilteredResult(_0x1aedfc,_0x5b969d))['catch'](handleError(_0x1aedfc,null));};exports['getTeams']=function(_0x587b03,_0x162d47,_0xfa4ba7){var _0x4d4339={};var _0x135494={};var _0x184e1b;var _0x29e92e;return db[_0xbbd1('0x32')][_0xbbd1('0x5a')]({'where':{'id':_0x587b03[_0xbbd1('0x4c')]['id']}})[_0xbbd1('0x2a')](handleEntityNotFound(_0x162d47,null))[_0xbbd1('0x2a')](function(_0xf054ec){if(_0xf054ec){_0x184e1b=_0xf054ec;_0x135494[_0xbbd1('0x35')]=_['keys'](db[_0xbbd1('0x65')][_0xbbd1('0x4d')]);_0x135494[_0xbbd1('0x36')]=_[_0xbbd1('0x37')](_0x587b03[_0xbbd1('0x36')]);_0x135494[_0xbbd1('0x38')]=_['intersection'](_0x135494[_0xbbd1('0x35')],_0x135494[_0xbbd1('0x36')]);_0x4d4339['attributes']=_[_0xbbd1('0x3a')](_0x135494[_0xbbd1('0x35')],qs[_0xbbd1('0x3b')](_0x587b03['query'][_0xbbd1('0x3b')]));_0x4d4339[_0xbbd1('0x39')]=_0x4d4339['attributes'][_0xbbd1('0x4e')]?_0x4d4339['attributes']:_0x135494[_0xbbd1('0x35')];_0x4d4339[_0xbbd1('0x3e')]=qs[_0xbbd1('0x3f')](_0x587b03[_0xbbd1('0x36')][_0xbbd1('0x3f')]);_0x4d4339[_0xbbd1('0x40')]=qs['filters'](_[_0xbbd1('0x41')](_0x587b03['query'],_0x135494[_0xbbd1('0x38')]));if(_0x587b03[_0xbbd1('0x36')][_0xbbd1('0x42')]){_0x4d4339[_0xbbd1('0x40')]=_['merge'](_0x4d4339[_0xbbd1('0x40')],{'$or':_[_0xbbd1('0x44')](_0x4d4339[_0xbbd1('0x39')],function(_0x2ad570){var _0x342ba6={};_0x342ba6[_0x2ad570]={'$like':'%'+_0x587b03[_0xbbd1('0x36')][_0xbbd1('0x42')]+'%'};return _0x342ba6;})});}_0x4d4339=_[_0xbbd1('0x43')]({},_0x4d4339,_0x587b03[_0xbbd1('0x4f')]);return _0x184e1b[_0xbbd1('0x66')](_0x4d4339);}})[_0xbbd1('0x2a')](function(_0x464cfd){if(_0x464cfd){_0x29e92e=_0x464cfd[_0xbbd1('0x4e')];if(!_0x587b03['query'][_0xbbd1('0x3c')]('nolimit')){_0x4d4339[_0xbbd1('0x22')]=qs[_0xbbd1('0x22')](_0x587b03[_0xbbd1('0x36')][_0xbbd1('0x22')]);_0x4d4339[_0xbbd1('0x21')]=qs[_0xbbd1('0x21')](_0x587b03['query'][_0xbbd1('0x21')]);}return _0x184e1b['getTeams'](_0x4d4339);}})['then'](function(_0x4d2665){if(_0x4d2665){return _0x4d2665?{'count':_0x29e92e,'rows':_0x4d2665}:null;}})[_0xbbd1('0x2a')](respondWithResult(_0x162d47,null))[_0xbbd1('0x4a')](handleError(_0x162d47,null));};exports[_0xbbd1('0x67')]=function(_0xa012b2,_0x18b791,_0x345009){var _0x25960b=_0xa012b2[_0xbbd1('0x52')][_0xbbd1('0x68')];return db[_0xbbd1('0x65')][_0xbbd1('0x48')]({'where':{'id':_0x25960b},'attributes':['id'],'include':[{'model':db[_0xbbd1('0x5d')],'as':_0xbbd1('0x69'),'attributes':['id',_0xbbd1('0x2f'),'online',_0xbbd1('0x6a'),_0xbbd1('0x6b')],'raw':!![]}]})[_0xbbd1('0x2a')](function(_0x5d39be){if(_0x5d39be){var _0x211f26=_[_0xbbd1('0x6c')](_0x5d39be,function(_0x4ea4e4){var _0x2a64f8=_0x4ea4e4[_0xbbd1('0x54')]({'plain':!![]});return _0x2a64f8[_0xbbd1('0x69')];});return db[_0xbbd1('0x32')][_0xbbd1('0x50')]({'where':{'id':_0xa012b2[_0xbbd1('0x4c')]['id']}})[_0xbbd1('0x2a')](function(_0x4e86fe){return db[_0xbbd1('0x6d')]['transaction'](function(_0x33e52a){return _0x4e86fe[_0xbbd1('0x67')](_0x25960b,{'transaction':_0x33e52a})['then'](function(){return BPromise[_0xbbd1('0x6e')](_0x211f26,function(_0x46af33){return db[_0xbbd1('0x5b')][_0xbbd1('0x6f')]({'where':{'UserId':_0x46af33['id'],'WhatsappQueueId':_0xa012b2[_0xbbd1('0x4c')]['id']},'transaction':_0x33e52a});});})['then'](function(){_0x211f26['forEach'](function(_0x19c016){socket[_0xbbd1('0x70')](_0xbbd1('0x71'),{'UserId':_0x19c016['id'],'WhatsappQueueId':_0x4e86fe['id']});});});});});}})['then'](respondWithStatusCode(_0x18b791,null))['catch'](handleError(_0x18b791,null));};exports['removeTeams']=function(_0x3858f4,_0x5122c8,_0x5ded7b){return db['Team']['findAll']({'where':{'id':_0x3858f4[_0xbbd1('0x36')][_0xbbd1('0x68')]},'attributes':['id'],'include':[{'model':db[_0xbbd1('0x5d')],'as':_0xbbd1('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5122c8,null))[_0xbbd1('0x2a')](function(_0x3cc6fe){var _0x423648=_[_0xbbd1('0x44')](_0x3cc6fe,'id');var _0x405068=[];var _0x1cd7b1=[];var _0x169275=squel[_0xbbd1('0x72')]();_0x169275[_0xbbd1('0x73')](_0xbbd1('0x74'))[_0xbbd1('0x75')]('team_has_whatsapp_queues','tq')[_0xbbd1('0x76')](_0xbbd1('0x77'),'ut',_0xbbd1('0x78'))[_0xbbd1('0x40')]('WhatsappQueueId\x20=\x20?',_0x3858f4[_0xbbd1('0x4c')]['id']);for(var _0x34eca6=0x0;_0x34eca6<_0x3cc6fe['length'];_0x34eca6+=0x1){let _0x4c2a6f=_0x3cc6fe[_0x34eca6];for(var _0x12efc7=0x0;_0x12efc7<_0x4c2a6f[_0xbbd1('0x69')][_0xbbd1('0x4e')];_0x12efc7+=0x1){let _0x523a88=_0x4c2a6f[_0xbbd1('0x69')][_0x12efc7];var _0x5c4746=_0x169275[_0xbbd1('0x79')]();_0x5c4746[_0xbbd1('0x40')](_0xbbd1('0x7a'),_0x523a88['id']);_0x1cd7b1[_0xbbd1('0x7b')](db[_0xbbd1('0x6d')][_0xbbd1('0x36')](_0x5c4746[_0xbbd1('0x7c')](),{'type':db['sequelize'][_0xbbd1('0x7d')][_0xbbd1('0x7e')]})[_0xbbd1('0x2a')](function(_0x2f4f74){if(_0x2f4f74[_0xbbd1('0x4e')]===0x1){return _0x523a88['id'];}else{var _0x193f97=_[_0xbbd1('0x7f')](_[_0xbbd1('0x44')](_0x2f4f74,_0xbbd1('0x80')),function(_0x466f69){return _[_0xbbd1('0x81')](_0x423648,_0x466f69);});if(_0x193f97){return _0x523a88['id'];}}}));}}return BPromise[_0xbbd1('0x82')](_0x1cd7b1)[_0xbbd1('0x2a')](function(_0x2a6ec4){_0x405068=_(_0x405068)[_0xbbd1('0x83')](_0x2a6ec4)['compact']()[_0xbbd1('0x84')]();return db[_0xbbd1('0x32')][_0xbbd1('0x50')]({'where':{'id':_0x3858f4[_0xbbd1('0x4c')]['id']}})['then'](function(_0x55b4a8){return db[_0xbbd1('0x6d')][_0xbbd1('0x85')](function(_0x526fac){return _0x55b4a8[_0xbbd1('0x86')](_0x3858f4['query'][_0xbbd1('0x68')],{'transaction':_0x526fac})[_0xbbd1('0x2a')](function(){if(!_[_0xbbd1('0x87')](_0x405068)){return _0x55b4a8[_0xbbd1('0x88')](_0x405068,{'transaction':_0x526fac});}})['then'](function(){_0x405068[_0xbbd1('0x89')](function(_0x24061e){socket[_0xbbd1('0x70')](_0xbbd1('0x8a'),{'UserId':_0x24061e,'WhatsappQueueId':_0x55b4a8['id']});});});});});});})[_0xbbd1('0x2a')](respondWithStatusCode(_0x5122c8,null))[_0xbbd1('0x4a')](handleError(_0x5122c8,null));};exports[_0xbbd1('0x8b')]=function(_0xaab2a3,_0x589dd2,_0x12fcaf){return db[_0xbbd1('0x32')][_0xbbd1('0x50')]({'where':{'id':_0xaab2a3[_0xbbd1('0x4c')]['id']}})[_0xbbd1('0x2a')](handleEntityNotFound(_0x589dd2,null))[_0xbbd1('0x2a')](function(_0x491c1b){if(_0x491c1b){return _0x491c1b['addAgents'](_0xaab2a3[_0xbbd1('0x52')][_0xbbd1('0x68')],_[_0xbbd1('0x8c')](_0xaab2a3[_0xbbd1('0x52')],['ids','id'])||{})[_0xbbd1('0x8d')](function(_0x279edb){for(var _0x11b32a=0x0;_0x11b32a<_0xaab2a3[_0xbbd1('0x52')][_0xbbd1('0x68')][_0xbbd1('0x4e')];_0x11b32a+=0x1){socket['emit'](_0xbbd1('0x71'),{'UserId':_0xaab2a3[_0xbbd1('0x52')]['ids'][_0x11b32a],'WhatsappQueueId':_0xaab2a3[_0xbbd1('0x4c')]['id']});}return _0x279edb;});}})['then'](respondWithResult(_0x589dd2,null))['catch'](handleError(_0x589dd2,null));};exports['removeAgents']=function(_0x4cbe58,_0x411eba,_0x1ee267){return db['WhatsappQueue']['find']({'where':{'id':_0x4cbe58[_0xbbd1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x411eba,null))['then'](function(_0x375d11){if(_0x375d11){return _0x375d11[_0xbbd1('0x88')](_0x4cbe58['query'][_0xbbd1('0x68')])[_0xbbd1('0x2a')](function(){if(_[_0xbbd1('0x8e')](_0x4cbe58['query'][_0xbbd1('0x68')])){for(var _0x221af4=0x0;_0x221af4<_0x4cbe58['query'][_0xbbd1('0x68')]['length'];_0x221af4+=0x1){socket[_0xbbd1('0x70')](_0xbbd1('0x8a'),{'UserId':Number(_0x4cbe58[_0xbbd1('0x36')]['ids'][_0x221af4]),'WhatsappQueueId':Number(_0x4cbe58['params']['id'])});}}else{socket['emit'](_0xbbd1('0x8a'),{'UserId':Number(_0x4cbe58[_0xbbd1('0x36')]['ids']),'WhatsappQueueId':Number(_0x4cbe58[_0xbbd1('0x4c')]['id'])});}});}})[_0xbbd1('0x2a')](respondWithStatusCode(_0x411eba,null))[_0xbbd1('0x4a')](handleError(_0x411eba,null));};exports['getAgents']=function(_0x403d3e,_0x229eee,_0x447e7a){var _0x259067={};var _0x4f985b={};var _0x4112ee;var _0x5231a4;return db['WhatsappQueue'][_0xbbd1('0x5a')]({'where':{'id':_0x403d3e['params']['id']}})['then'](handleEntityNotFound(_0x229eee,null))[_0xbbd1('0x2a')](function(_0x3b3926){if(_0x3b3926){_0x4112ee=_0x3b3926;_0x4f985b['model']=_[_0xbbd1('0x37')](db[_0xbbd1('0x5d')][_0xbbd1('0x4d')]);_0x4f985b[_0xbbd1('0x36')]=_['keys'](_0x403d3e[_0xbbd1('0x36')]);_0x4f985b[_0xbbd1('0x38')]=_[_0xbbd1('0x3a')](_0x4f985b[_0xbbd1('0x35')],_0x4f985b[_0xbbd1('0x36')]);_0x259067[_0xbbd1('0x39')]=_[_0xbbd1('0x3a')](_0x4f985b['model'],qs['fields'](_0x403d3e[_0xbbd1('0x36')][_0xbbd1('0x3b')]));_0x259067[_0xbbd1('0x39')]=_0x259067[_0xbbd1('0x39')][_0xbbd1('0x4e')]?_0x259067[_0xbbd1('0x39')]:_0x4f985b['model'];_0x259067[_0xbbd1('0x3e')]=qs['sort'](_0x403d3e[_0xbbd1('0x36')]['sort']);_0x259067[_0xbbd1('0x40')]=qs['filters'](_[_0xbbd1('0x41')](_0x403d3e[_0xbbd1('0x36')],_0x4f985b['filters']));if(_0x403d3e[_0xbbd1('0x36')][_0xbbd1('0x42')]){_0x259067[_0xbbd1('0x40')]=_['merge'](_0x259067[_0xbbd1('0x40')],{'$or':_[_0xbbd1('0x44')](_0x259067[_0xbbd1('0x39')],function(_0x144be9){var _0x3d70b8={};_0x3d70b8[_0x144be9]={'$like':'%'+_0x403d3e['query']['filter']+'%'};return _0x3d70b8;})});}_0x259067=_['merge']({},_0x259067,_0x403d3e[_0xbbd1('0x4f')]);return _0x4112ee['getAgents'](_0x259067);}})['then'](function(_0x14193b){if(_0x14193b){_0x5231a4=_0x14193b[_0xbbd1('0x4e')];if(!_0x403d3e[_0xbbd1('0x36')][_0xbbd1('0x3c')](_0xbbd1('0x3d'))){_0x259067[_0xbbd1('0x22')]=qs[_0xbbd1('0x22')](_0x403d3e[_0xbbd1('0x36')][_0xbbd1('0x22')]);_0x259067[_0xbbd1('0x21')]=qs['offset'](_0x403d3e['query'][_0xbbd1('0x21')]);}return _0x4112ee['getAgents'](_0x259067);}})[_0xbbd1('0x2a')](function(_0x376472){if(_0x376472){return _0x376472?{'count':_0x5231a4,'rows':_0x376472}:null;}})['then'](respondWithResult(_0x229eee,null))['catch'](handleError(_0x229eee,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4fc99ab..48a174b 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 _0xba30=['../../mysqldb','WhatsappQueue','save','remove','emit','hook','exports','events'];(function(_0x37d0f2,_0x1c041a){var _0x1c5e8f=function(_0x432bbb){while(--_0x432bbb){_0x37d0f2['push'](_0x37d0f2['shift']());}};_0x1c5e8f(++_0x1c041a);}(_0xba30,0xff));var _0x0ba3=function(_0x10d341,_0x57ff35){_0x10d341=_0x10d341-0x0;var _0xddc36d=_0xba30[_0x10d341];return _0xddc36d;};'use strict';var EventEmitter=require(_0x0ba3('0x0'));var WhatsappQueue=require(_0x0ba3('0x1'))['db'][_0x0ba3('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ba3('0x3'),'afterUpdate':'update','afterDestroy':_0x0ba3('0x4')};function emitEvent(_0x468fea){return function(_0xaa824d,_0x2a3589,_0x57f11d){WhatsappQueueEvents[_0x0ba3('0x5')](_0x468fea+':'+_0xaa824d['id'],_0xaa824d);WhatsappQueueEvents[_0x0ba3('0x5')](_0x468fea,_0xaa824d);_0x57f11d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x0ba3('0x6')](e,emitEvent(event));}}module[_0x0ba3('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xd217=['exports','WhatsappQueue','save','update','emit'];(function(_0x121c6a,_0x58b434){var _0x4e3702=function(_0x18e030){while(--_0x18e030){_0x121c6a['push'](_0x121c6a['shift']());}};_0x4e3702(++_0x58b434);}(_0xd217,0x146));var _0x7d21=function(_0x1f4eff,_0x3de99c){_0x1f4eff=_0x1f4eff-0x0;var _0x2334e8=_0xd217[_0x1f4eff];return _0x2334e8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x7d21('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d21('0x1'),'afterUpdate':_0x7d21('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1c7231){return function(_0x9a4420,_0x11c394,_0x532047){WhatsappQueueEvents[_0x7d21('0x3')](_0x1c7231+':'+_0x9a4420['id'],_0x9a4420);WhatsappQueueEvents[_0x7d21('0x3')](_0x1c7231,_0x9a4420);_0x532047(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7d21('0x4')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ce45c88..695006f 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 _0x3ee8=['rimraf','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ab63b,_0x1c8bd7){var _0x381f56=function(_0xe5eeb4){while(--_0xe5eeb4){_0x4ab63b['push'](_0x4ab63b['shift']());}};_0x381f56(++_0x1c8bd7);}(_0x3ee8,0x65));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x83ee('0x0'));var logger=require(_0x83ee('0x1'))(_0x83ee('0x2'));var moment=require(_0x83ee('0x3'));var BPromise=require(_0x83ee('0x4'));var rp=require(_0x83ee('0x5'));var fs=require('fs');var path=require(_0x83ee('0x6'));var rimraf=require(_0x83ee('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x83ee('0x8')]=function(_0x5dbb62,_0xa686c){return _0x5dbb62[_0x83ee('0x9')](_0x83ee('0xa'),attributes,{'tableName':_0x83ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x779d=['lodash','util','api','moment','bluebird','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x7e9fba,_0x5cf75c){var _0x1f0a02=function(_0x197ecc){while(--_0x197ecc){_0x7e9fba['push'](_0x7e9fba['shift']());}};_0x1f0a02(++_0x5cf75c);}(_0x779d,0x120));var _0xd779=function(_0x16089c,_0x504c31){_0x16089c=_0x16089c-0x0;var _0x5e3b83=_0x779d[_0x16089c];return _0x5e3b83;};'use strict';var _=require(_0xd779('0x0'));var util=require(_0xd779('0x1'));var logger=require('../../config/logger')(_0xd779('0x2'));var moment=require(_0xd779('0x3'));var BPromise=require(_0xd779('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd779('0x5'));var rimraf=require('rimraf');var config=require(_0xd779('0x6'));var attributes=require(_0xd779('0x7'));module[_0xd779('0x8')]=function(_0x5c9b5a,_0x4c398f){return _0x5c9b5a[_0xd779('0x9')](_0xd779('0xa'),attributes,{'tableName':_0xd779('0xb'),'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 f2a9fbe..36688c1 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 _0x5a21=['request\x20sent','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','raw','ShowWhatsappQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a21,0x8a));var _0x15a2=function(_0x857c02,_0x3cc0b3){_0x857c02=_0x857c02-0x0;var _0x5bbbab=_0x5a21[_0x857c02];return _0x5bbbab;};'use strict';var _=require(_0x15a2('0x0'));var util=require(_0x15a2('0x1'));var moment=require(_0x15a2('0x2'));var BPromise=require('bluebird');var rs=require(_0x15a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15a2('0x4'))['db'];var utils=require(_0x15a2('0x5'));var logger=require(_0x15a2('0x6'))(_0x15a2('0x7'));var config=require(_0x15a2('0x8'));var jayson=require(_0x15a2('0x9'));var client=jayson[_0x15a2('0xa')][_0x15a2('0xb')]({'port':0x232a});config['redis']=_[_0x15a2('0xc')](config[_0x15a2('0xd')],{'host':_0x15a2('0xe'),'port':0x18eb});var socket=require(_0x15a2('0xf'))(new Redis(config[_0x15a2('0xd')]));require('./whatsappQueue.socket')[_0x15a2('0x10')](socket);function respondWithRpcPromise(_0x24f3df,_0x229f5c,_0x17fd0b){return new BPromise(function(_0x4a1bcc,_0x38afd1){return client['request'](_0x24f3df,_0x17fd0b)[_0x15a2('0x11')](function(_0x52c7d0){logger['info'](_0x15a2('0x12'),_0x229f5c,'request\x20sent');logger[_0x15a2('0x13')](_0x15a2('0x14'),_0x229f5c,'request\x20sent',JSON[_0x15a2('0x15')](_0x52c7d0));if(_0x52c7d0[_0x15a2('0x16')]){if(_0x52c7d0[_0x15a2('0x16')][_0x15a2('0x17')]===0x1f4){logger[_0x15a2('0x16')](_0x15a2('0x12'),_0x229f5c,_0x52c7d0['error'][_0x15a2('0x18')]);return _0x38afd1(_0x52c7d0[_0x15a2('0x16')][_0x15a2('0x18')]);}logger['error'](_0x15a2('0x12'),_0x229f5c,_0x52c7d0[_0x15a2('0x16')][_0x15a2('0x18')]);return _0x4a1bcc(_0x52c7d0[_0x15a2('0x16')][_0x15a2('0x18')]);}else{logger[_0x15a2('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x229f5c,_0x15a2('0x1a'));_0x4a1bcc(_0x52c7d0[_0x15a2('0x1b')]['message']);}})[_0x15a2('0x1c')](function(_0x91345a){logger[_0x15a2('0x16')](_0x15a2('0x12'),_0x229f5c,_0x91345a);_0x38afd1(_0x91345a);});});}exports[_0x15a2('0x1d')]=function(_0x1f92da){var _0x140084=this;return new Promise(function(_0x559283,_0x28d6e8){return db[_0x15a2('0x1e')][_0x15a2('0x1f')]({'raw':_0x1f92da[_0x15a2('0x20')]?_0x1f92da['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f92da[_0x15a2('0x20')]?_0x1f92da['options'][_0x15a2('0x21')]||null:null,'attributes':_0x1f92da[_0x15a2('0x20')]?_0x1f92da['options']['attributes']||null:null,'limit':_0x1f92da[_0x15a2('0x20')]?_0x1f92da[_0x15a2('0x20')][_0x15a2('0x22')]||null:null,'include':_0x1f92da['options']?_0x1f92da[_0x15a2('0x20')][_0x15a2('0x23')]?_[_0x15a2('0x24')](_0x1f92da[_0x15a2('0x20')][_0x15a2('0x23')],function(_0x2e0b6d){return{'model':db[_0x2e0b6d[_0x15a2('0x25')]],'as':_0x2e0b6d['as'],'attributes':_0x2e0b6d['attributes'],'include':_0x2e0b6d[_0x15a2('0x23')]?_[_0x15a2('0x24')](_0x2e0b6d['include'],function(_0x3b8918){return{'model':db[_0x3b8918[_0x15a2('0x25')]],'as':_0x3b8918['as'],'attributes':_0x3b8918[_0x15a2('0x26')],'include':_0x3b8918['include']?_[_0x15a2('0x24')](_0x3b8918[_0x15a2('0x23')],function(_0x17bc70){return{'model':db[_0x17bc70[_0x15a2('0x25')]],'as':_0x17bc70['as'],'attributes':_0x17bc70[_0x15a2('0x26')]};}):[]};}):[]};}):[]:[]})[_0x15a2('0x11')](function(_0x2d1c6e){logger[_0x15a2('0x19')]('GetWhatsappQueue',_0x1f92da);logger[_0x15a2('0x13')](_0x15a2('0x1d'),_0x1f92da,JSON[_0x15a2('0x15')](_0x2d1c6e));_0x559283(_0x2d1c6e);})[_0x15a2('0x1c')](function(_0x3f3905){logger[_0x15a2('0x16')](_0x15a2('0x1d'),_0x3f3905['message'],_0x1f92da);_0x28d6e8(_0x140084['error'](0x1f4,_0x3f3905[_0x15a2('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x535054){var _0x41166e=this;return new Promise(function(_0x225b15,_0x318adb){return db['WhatsappQueue']['find']({'raw':_0x535054['options']?_0x535054[_0x15a2('0x20')][_0x15a2('0x27')]===undefined?!![]:![]:!![],'where':_0x535054[_0x15a2('0x20')]?_0x535054[_0x15a2('0x20')]['where']||null:null,'attributes':_0x535054[_0x15a2('0x20')]?_0x535054['options'][_0x15a2('0x26')]||null:null,'include':_0x535054[_0x15a2('0x20')]?_0x535054[_0x15a2('0x20')][_0x15a2('0x23')]?_[_0x15a2('0x24')](_0x535054[_0x15a2('0x20')][_0x15a2('0x23')],function(_0x3b1358){return{'model':db[_0x3b1358[_0x15a2('0x25')]],'as':_0x3b1358['as'],'attributes':_0x3b1358['attributes'],'include':_0x3b1358[_0x15a2('0x23')]?_[_0x15a2('0x24')](_0x3b1358[_0x15a2('0x23')],function(_0x3989ef){return{'model':db[_0x3989ef['model']],'as':_0x3989ef['as'],'attributes':_0x3989ef[_0x15a2('0x26')],'include':_0x3989ef[_0x15a2('0x23')]?_['map'](_0x3989ef[_0x15a2('0x23')],function(_0x27b23b){return{'model':db[_0x27b23b[_0x15a2('0x25')]],'as':_0x27b23b['as'],'attributes':_0x27b23b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22693e){logger[_0x15a2('0x19')](_0x15a2('0x28'),_0x535054);logger[_0x15a2('0x13')]('ShowWhatsappQueue',_0x535054,JSON['stringify'](_0x22693e));_0x225b15(_0x22693e);})[_0x15a2('0x1c')](function(_0xf25992){logger['error'](_0x15a2('0x28'),_0xf25992[_0x15a2('0x18')],_0x535054);_0x318adb(_0x41166e[_0x15a2('0x16')](0x1f4,_0xf25992[_0x15a2('0x18')]));});});}; \ No newline at end of file +var _0xc16b=['register','request','then','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','info','request\x20sent','result','catch','GetWhatsappQueue','raw','options','attributes','limit','include','map','model','ShowWhatsappQueue','WhatsappQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket'];(function(_0x3f4568,_0x9eb0ee){var _0xee2340=function(_0xdefabb){while(--_0xdefabb){_0x3f4568['push'](_0x3f4568['shift']());}};_0xee2340(++_0x9eb0ee);}(_0xc16b,0x194));var _0xbc16=function(_0x379dfb,_0x59eeb3){_0x379dfb=_0x379dfb-0x0;var _0x50fc6e=_0xc16b[_0x379dfb];return _0x50fc6e;};'use strict';var _=require('lodash');var util=require(_0xbc16('0x0'));var moment=require(_0xbc16('0x1'));var BPromise=require(_0xbc16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc16('0x3'));var db=require(_0xbc16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc16('0x5'))('rpc');var config=require(_0xbc16('0x6'));var jayson=require(_0xbc16('0x7'));var client=jayson[_0xbc16('0x8')]['http']({'port':0x232a});config[_0xbc16('0x9')]=_[_0xbc16('0xa')](config[_0xbc16('0x9')],{'host':_0xbc16('0xb'),'port':0x18eb});var socket=require(_0xbc16('0xc'))(new Redis(config[_0xbc16('0x9')]));require(_0xbc16('0xd'))[_0xbc16('0xe')](socket);function respondWithRpcPromise(_0x41496e,_0x564aa5,_0x37107c){return new BPromise(function(_0x2225af,_0x2d4482){return client[_0xbc16('0xf')](_0x41496e,_0x37107c)[_0xbc16('0x10')](function(_0xd62d80){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x564aa5,'request\x20sent');logger[_0xbc16('0x11')](_0xbc16('0x12'),_0x564aa5,'request\x20sent',JSON[_0xbc16('0x13')](_0xd62d80));if(_0xd62d80['error']){if(_0xd62d80['error'][_0xbc16('0x14')]===0x1f4){logger[_0xbc16('0x15')](_0xbc16('0x16'),_0x564aa5,_0xd62d80['error'][_0xbc16('0x17')]);return _0x2d4482(_0xd62d80[_0xbc16('0x15')]['message']);}logger[_0xbc16('0x15')](_0xbc16('0x16'),_0x564aa5,_0xd62d80[_0xbc16('0x15')]['message']);return _0x2225af(_0xd62d80[_0xbc16('0x15')][_0xbc16('0x17')]);}else{logger[_0xbc16('0x18')](_0xbc16('0x16'),_0x564aa5,_0xbc16('0x19'));_0x2225af(_0xd62d80[_0xbc16('0x1a')]['message']);}})[_0xbc16('0x1b')](function(_0x654ed1){logger[_0xbc16('0x15')](_0xbc16('0x16'),_0x564aa5,_0x654ed1);_0x2d4482(_0x654ed1);});});}exports[_0xbc16('0x1c')]=function(_0x51efb8){var _0x151a8d=this;return new Promise(function(_0x5a83cf,_0x25cda3){return db['WhatsappQueue']['findAll']({'raw':_0x51efb8['options']?_0x51efb8['options'][_0xbc16('0x1d')]===undefined?!![]:![]:!![],'where':_0x51efb8[_0xbc16('0x1e')]?_0x51efb8[_0xbc16('0x1e')]['where']||null:null,'attributes':_0x51efb8[_0xbc16('0x1e')]?_0x51efb8[_0xbc16('0x1e')][_0xbc16('0x1f')]||null:null,'limit':_0x51efb8['options']?_0x51efb8[_0xbc16('0x1e')][_0xbc16('0x20')]||null:null,'include':_0x51efb8[_0xbc16('0x1e')]?_0x51efb8['options'][_0xbc16('0x21')]?_[_0xbc16('0x22')](_0x51efb8[_0xbc16('0x1e')]['include'],function(_0x12ccec){return{'model':db[_0x12ccec['model']],'as':_0x12ccec['as'],'attributes':_0x12ccec[_0xbc16('0x1f')],'include':_0x12ccec[_0xbc16('0x21')]?_[_0xbc16('0x22')](_0x12ccec['include'],function(_0x29db00){return{'model':db[_0x29db00['model']],'as':_0x29db00['as'],'attributes':_0x29db00[_0xbc16('0x1f')],'include':_0x29db00[_0xbc16('0x21')]?_[_0xbc16('0x22')](_0x29db00['include'],function(_0x457ab6){return{'model':db[_0x457ab6[_0xbc16('0x23')]],'as':_0x457ab6['as'],'attributes':_0x457ab6['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc16('0x10')](function(_0x16a5ea){logger[_0xbc16('0x18')](_0xbc16('0x1c'),_0x51efb8);logger[_0xbc16('0x11')](_0xbc16('0x1c'),_0x51efb8,JSON[_0xbc16('0x13')](_0x16a5ea));_0x5a83cf(_0x16a5ea);})['catch'](function(_0x3a6250){logger[_0xbc16('0x15')](_0xbc16('0x1c'),_0x3a6250[_0xbc16('0x17')],_0x51efb8);_0x25cda3(_0x151a8d[_0xbc16('0x15')](0x1f4,_0x3a6250[_0xbc16('0x17')]));});});};exports[_0xbc16('0x24')]=function(_0x47755f){var _0x350544=this;return new Promise(function(_0x3de5c4,_0x4a907e){return db[_0xbc16('0x25')]['find']({'raw':_0x47755f['options']?_0x47755f[_0xbc16('0x1e')][_0xbc16('0x1d')]===undefined?!![]:![]:!![],'where':_0x47755f[_0xbc16('0x1e')]?_0x47755f[_0xbc16('0x1e')]['where']||null:null,'attributes':_0x47755f[_0xbc16('0x1e')]?_0x47755f[_0xbc16('0x1e')][_0xbc16('0x1f')]||null:null,'include':_0x47755f[_0xbc16('0x1e')]?_0x47755f[_0xbc16('0x1e')][_0xbc16('0x21')]?_['map'](_0x47755f[_0xbc16('0x1e')][_0xbc16('0x21')],function(_0x190ac6){return{'model':db[_0x190ac6[_0xbc16('0x23')]],'as':_0x190ac6['as'],'attributes':_0x190ac6['attributes'],'include':_0x190ac6[_0xbc16('0x21')]?_[_0xbc16('0x22')](_0x190ac6[_0xbc16('0x21')],function(_0x5a76a8){return{'model':db[_0x5a76a8[_0xbc16('0x23')]],'as':_0x5a76a8['as'],'attributes':_0x5a76a8[_0xbc16('0x1f')],'include':_0x5a76a8[_0xbc16('0x21')]?_['map'](_0x5a76a8[_0xbc16('0x21')],function(_0x36cabe){return{'model':db[_0x36cabe['model']],'as':_0x36cabe['as'],'attributes':_0x36cabe['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc16('0x10')](function(_0x59c5f5){logger['info'](_0xbc16('0x24'),_0x47755f);logger[_0xbc16('0x11')](_0xbc16('0x24'),_0x47755f,JSON[_0xbc16('0x13')](_0x59c5f5));_0x3de5c4(_0x59c5f5);})[_0xbc16('0x1b')](function(_0x2a9dde){logger[_0xbc16('0x15')](_0xbc16('0x24'),_0x2a9dde['message'],_0x47755f);_0x4a907e(_0x350544['error'](0x1f4,_0x2a9dde['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 85aa84b..e8d1d57 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 _0xd9dc=['save','remove','update','emit','length','./whatsappQueue.events'];(function(_0x24d102,_0x4471e6){var _0x5450c8=function(_0x21d336){while(--_0x21d336){_0x24d102['push'](_0x24d102['shift']());}};_0x5450c8(++_0x4471e6);}(_0xd9dc,0xa1));var _0xcd9d=function(_0x15718b,_0x20f12e){_0x15718b=_0x15718b-0x0;var _0x2ca779=_0xd9dc[_0x15718b];return _0x2ca779;};'use strict';var WhatsappQueueEvents=require(_0xcd9d('0x0'));var events=[_0xcd9d('0x1'),_0xcd9d('0x2'),_0xcd9d('0x3')];function createListener(_0x3a20ad,_0x18b4fe){return function(_0x279799){_0x18b4fe[_0xcd9d('0x4')](_0x3a20ad,_0x279799);};}function removeListener(_0x5c4cc3,_0x496964){return function(){WhatsappQueueEvents['removeListener'](_0x5c4cc3,_0x496964);};}exports['register']=function(_0x3e8166){for(var _0x1b4006=0x0,_0x10edff=events[_0xcd9d('0x5')];_0x1b4006<_0x10edff;_0x1b4006++){var _0x2a48b4=events[_0x1b4006];var _0x129d77=createListener('whatsappQueue:'+_0x2a48b4,_0x3e8166);WhatsappQueueEvents['on'](_0x2a48b4,_0x129d77);}}; \ No newline at end of file +var _0xf357=['save','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x2697ab,_0x53fcb6){var _0x1a9a11=function(_0x2d9884){while(--_0x2d9884){_0x2697ab['push'](_0x2697ab['shift']());}};_0x1a9a11(++_0x53fcb6);}(_0xf357,0x77));var _0x7f35=function(_0x2e344e,_0x292d58){_0x2e344e=_0x2e344e-0x0;var _0x552bb3=_0xf357[_0x2e344e];return _0x552bb3;};'use strict';var WhatsappQueueEvents=require(_0x7f35('0x0'));var events=[_0x7f35('0x1'),'remove','update'];function createListener(_0x1c1bc6,_0x232067){return function(_0x1d5275){_0x232067[_0x7f35('0x2')](_0x1c1bc6,_0x1d5275);};}function removeListener(_0x5961d4,_0x20713e){return function(){WhatsappQueueEvents[_0x7f35('0x3')](_0x5961d4,_0x20713e);};}exports[_0x7f35('0x4')]=function(_0x11962b){for(var _0x504088=0x0,_0x47e8d8=events['length'];_0x504088<_0x47e8d8;_0x504088++){var _0xf193ae=events[_0x504088];var _0x215ebf=createListener(_0x7f35('0x5')+_0xf193ae,_0x11962b);WhatsappQueueEvents['on'](_0xf193ae,_0x215ebf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d19459e..8edc2a7 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 _0xfe93=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','create','put','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x248a56,_0x5bfa53){var _0x46075d=function(_0x531a9e){while(--_0x531a9e){_0x248a56['push'](_0x248a56['shift']());}};_0x46075d(++_0x5bfa53);}(_0xfe93,0xf4));var _0x3fe9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfe93[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x3fe9('0x0'));var util=require(_0x3fe9('0x1'));var path=require('path');var timeout=require(_0x3fe9('0x2'));var express=require(_0x3fe9('0x3'));var router=express[_0x3fe9('0x4')]();var auth=require(_0x3fe9('0x5'));var interaction=require(_0x3fe9('0x6'));var config=require(_0x3fe9('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x3fe9('0x8')](),controller[_0x3fe9('0x9')]);router[_0x3fe9('0xa')](_0x3fe9('0xb'),auth['isAuthenticated'](),controller[_0x3fe9('0xc')]);router[_0x3fe9('0xa')]('/:id',auth[_0x3fe9('0x8')](),controller['show']);router['post']('/',auth[_0x3fe9('0x8')](),controller[_0x3fe9('0xd')]);router[_0x3fe9('0xe')](_0x3fe9('0xf'),auth['isAuthenticated'](),controller[_0x3fe9('0x10')]);router['delete'](_0x3fe9('0xf'),auth[_0x3fe9('0x8')](),controller[_0x3fe9('0x11')]);module[_0x3fe9('0x12')]=router; \ No newline at end of file +var _0xdf5d=['Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xdf5d,0x126));var _0xddf5=function(_0x1da6ae,_0x42fec5){_0x1da6ae=_0x1da6ae-0x0;var _0x1a1f6c=_0xdf5d[_0x1da6ae];return _0x1a1f6c;};'use strict';var multer=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var timeout=require(_0xddf5('0x3'));var express=require(_0xddf5('0x4'));var router=express[_0xddf5('0x5')]();var auth=require(_0xddf5('0x6'));var interaction=require(_0xddf5('0x7'));var config=require('../../config/environment');var controller=require(_0xddf5('0x8'));router[_0xddf5('0x9')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xb')]);router[_0xddf5('0x9')](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xd')]);router[_0xddf5('0x9')](_0xddf5('0xe'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xf')]);router[_0xddf5('0x10')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0x11')]);router[_0xddf5('0x12')]('/:id',auth[_0xddf5('0xa')](),controller[_0xddf5('0x13')]);router[_0xddf5('0x14')](_0xddf5('0xe'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x15')]);module[_0xddf5('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e71605f..1b61f59 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0xf3cd[_0x3932eb];return _0x5316e5;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file +var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xf3cd[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 1dbcdab..b15d8a4 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 _0x80e8=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80e8,0x1ab));var _0x880e=function(_0x8ec792,_0x496d26){_0x8ec792=_0x8ec792-0x0;var _0x4c5c9d=_0x80e8[_0x8ec792];return _0x4c5c9d;};'use strict';var pdf=require(_0x880e('0x0'));var emlformat=require(_0x880e('0x1'));var rimraf=require(_0x880e('0x2'));var zipdir=require(_0x880e('0x3'));var jsonpatch=require(_0x880e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x880e('0x5'));var Mustache=require(_0x880e('0x6'));var util=require('util');var path=require(_0x880e('0x7'));var sox=require(_0x880e('0x8'));var csv=require('to-csv');var ejs=require(_0x880e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x880e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x880e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x880e('0xc'));var Papa=require(_0x880e('0xd'));var Redis=require(_0x880e('0xe'));var authService=require(_0x880e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x880e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x880e('0x11'))(_0x880e('0x12'));var utils=require('../../config/utils');var config=require(_0x880e('0x13'));var licenseUtil=require(_0x880e('0x14'));var db=require(_0x880e('0x15'))['db'];function respondWithStatusCode(_0x39b489,_0x30113a){_0x30113a=_0x30113a||0xcc;return function(_0xe7641f){if(_0xe7641f){return _0x39b489[_0x880e('0x16')](_0x30113a);}return _0x39b489[_0x880e('0x17')](_0x30113a)['end']();};}function respondWithResult(_0x15704e,_0x20ea43){_0x20ea43=_0x20ea43||0xc8;return function(_0x229ff3){if(_0x229ff3){return _0x15704e[_0x880e('0x17')](_0x20ea43)[_0x880e('0x18')](_0x229ff3);}};}function respondWithFilteredResult(_0x28381d,_0x3943b9){return function(_0xb2364a){if(_0xb2364a){var _0x95a993=_0xb2364a['count'],_0x36d210=_0x3943b9[_0x880e('0x19')],_0x4f9cda=_0x3943b9['offset']+_0x3943b9[_0x880e('0x1a')],_0x1bed8b;if(_0x4f9cda>=_0x95a993){_0x4f9cda=_0x95a993;_0x1bed8b=0xc8;}else{_0x1bed8b=0xce;}_0x28381d[_0x880e('0x17')](_0x1bed8b);return _0x28381d[_0x880e('0x1b')](_0x880e('0x1c'),_0x36d210+'-'+_0x4f9cda+'/'+_0x95a993)[_0x880e('0x18')](_0xb2364a);}return null;};}function patchUpdates(_0x4ce0d8){return function(_0x4dc40d){try{jsonpatch[_0x880e('0x1d')](_0x4dc40d,_0x4ce0d8,!![]);}catch(_0x4ba0d9){return BPromise[_0x880e('0x1e')](_0x4ba0d9);}return _0x4dc40d[_0x880e('0x1f')]();};}function saveUpdates(_0x548f83,_0x12519e){return function(_0x9d95fb){if(_0x9d95fb){return _0x9d95fb[_0x880e('0x20')](_0x548f83)[_0x880e('0x21')](function(_0x2454d0){return _0x2454d0;});}return null;};}function removeEntity(_0x6d5201,_0x4cae3f){return function(_0x57774c){if(_0x57774c){return _0x57774c['destroy']()['then'](function(){_0x6d5201['status'](0xcc)[_0x880e('0x22')]();});}};}function handleEntityNotFound(_0x257612,_0x4169f5){return function(_0x1f811a){if(!_0x1f811a){_0x257612[_0x880e('0x16')](0x194);}return _0x1f811a;};}function handleError(_0x1e55c7,_0x30401f){_0x30401f=_0x30401f||0x1f4;return function(_0x402508){logger[_0x880e('0x23')](_0x402508[_0x880e('0x24')]);if(_0x402508['name']){delete _0x402508['name'];}_0x1e55c7[_0x880e('0x17')](_0x30401f)['send'](_0x402508);};}exports[_0x880e('0x25')]=function(_0x5ba9a9,_0x395022){var _0x172230={},_0x26eb37={},_0x4e939e={'count':0x0,'rows':[]};var _0x1608a1=_[_0x880e('0x26')](db[_0x880e('0x27')][_0x880e('0x28')],function(_0x46a37a){return{'name':_0x46a37a[_0x880e('0x29')],'type':_0x46a37a[_0x880e('0x2a')][_0x880e('0x2b')]};});_0x26eb37['model']=_[_0x880e('0x26')](_0x1608a1,_0x880e('0x2c'));_0x26eb37[_0x880e('0x2d')]=_[_0x880e('0x2e')](_0x5ba9a9[_0x880e('0x2d')]);_0x26eb37[_0x880e('0x2f')]=_[_0x880e('0x30')](_0x26eb37[_0x880e('0x31')],_0x26eb37[_0x880e('0x2d')]);_0x172230['attributes']=_[_0x880e('0x30')](_0x26eb37['model'],qs[_0x880e('0x32')](_0x5ba9a9[_0x880e('0x2d')]['fields']));_0x172230[_0x880e('0x33')]=_0x172230[_0x880e('0x33')][_0x880e('0x34')]?_0x172230[_0x880e('0x33')]:_0x26eb37['model'];if(!_0x5ba9a9[_0x880e('0x2d')][_0x880e('0x35')]('nolimit')){_0x172230['limit']=qs['limit'](_0x5ba9a9[_0x880e('0x2d')][_0x880e('0x1a')]);_0x172230[_0x880e('0x19')]=qs['offset'](_0x5ba9a9[_0x880e('0x2d')][_0x880e('0x19')]);}_0x172230[_0x880e('0x36')]=qs[_0x880e('0x37')](_0x5ba9a9[_0x880e('0x2d')][_0x880e('0x37')]);_0x172230[_0x880e('0x38')]=qs[_0x880e('0x2f')](_[_0x880e('0x39')](_0x5ba9a9[_0x880e('0x2d')],_0x26eb37[_0x880e('0x2f')]),_0x1608a1);if(_0x5ba9a9[_0x880e('0x2d')][_0x880e('0x3a')]){_0x172230[_0x880e('0x38')]=_['merge'](_0x172230['where'],{'$or':_[_0x880e('0x26')](_0x1608a1,function(_0x1e830c){if(_0x1e830c[_0x880e('0x2a')]!=='VIRTUAL'){var _0x1fa1b3={};_0x1fa1b3[_0x1e830c[_0x880e('0x2c')]]={'$like':'%'+_0x5ba9a9[_0x880e('0x2d')]['filter']+'%'};return _0x1fa1b3;}})});}_0x172230=_[_0x880e('0x3b')]({},_0x172230,_0x5ba9a9[_0x880e('0x3c')]);var _0x5ac3ee={'where':_0x172230[_0x880e('0x38')]};return db[_0x880e('0x27')][_0x880e('0x3d')](_0x5ac3ee)[_0x880e('0x21')](function(_0x1e029a){_0x4e939e[_0x880e('0x3d')]=_0x1e029a;if(_0x5ba9a9[_0x880e('0x2d')][_0x880e('0x3e')]){_0x172230[_0x880e('0x3f')]=[{'all':!![]}];}return db[_0x880e('0x27')]['findAll'](_0x172230);})['then'](function(_0x3e3da1){_0x4e939e[_0x880e('0x40')]=_0x3e3da1;return _0x4e939e;})[_0x880e('0x21')](respondWithFilteredResult(_0x395022,_0x172230))[_0x880e('0x41')](handleError(_0x395022,null));};exports[_0x880e('0x42')]=function(_0x46afca,_0xb2372f){var _0x2df005={'raw':!![],'where':{'id':_0x46afca[_0x880e('0x43')]['id']}},_0x5385fe={};_0x5385fe[_0x880e('0x31')]=_['keys'](db[_0x880e('0x27')]['rawAttributes']);_0x5385fe['query']=_[_0x880e('0x2e')](_0x46afca['query']);_0x5385fe[_0x880e('0x2f')]=_[_0x880e('0x30')](_0x5385fe['model'],_0x5385fe[_0x880e('0x2d')]);_0x2df005[_0x880e('0x33')]=_[_0x880e('0x30')](_0x5385fe[_0x880e('0x31')],qs[_0x880e('0x32')](_0x46afca[_0x880e('0x2d')]['fields']));_0x2df005['attributes']=_0x2df005[_0x880e('0x33')][_0x880e('0x34')]?_0x2df005[_0x880e('0x33')]:_0x5385fe[_0x880e('0x31')];if(_0x46afca[_0x880e('0x2d')][_0x880e('0x3e')]){_0x2df005[_0x880e('0x3f')]=[{'all':!![]}];}_0x2df005=_[_0x880e('0x3b')]({},_0x2df005,_0x46afca['options']);return db[_0x880e('0x27')]['find'](_0x2df005)[_0x880e('0x21')](handleEntityNotFound(_0xb2372f,null))[_0x880e('0x21')](respondWithResult(_0xb2372f,null))[_0x880e('0x41')](handleError(_0xb2372f,null));};exports[_0x880e('0x44')]=function(_0x5ebc07,_0x7e7bee){return db[_0x880e('0x27')][_0x880e('0x44')](_0x5ebc07[_0x880e('0x45')],{})['then'](respondWithResult(_0x7e7bee,0xc9))[_0x880e('0x41')](handleError(_0x7e7bee,null));};exports[_0x880e('0x20')]=function(_0x3b9d12,_0x36f21b){if(_0x3b9d12['body']['id']){delete _0x3b9d12[_0x880e('0x45')]['id'];}return db[_0x880e('0x27')][_0x880e('0x46')]({'where':{'id':_0x3b9d12[_0x880e('0x43')]['id']}})['then'](handleEntityNotFound(_0x36f21b,null))[_0x880e('0x21')](saveUpdates(_0x3b9d12[_0x880e('0x45')],null))[_0x880e('0x21')](respondWithResult(_0x36f21b,null))[_0x880e('0x41')](handleError(_0x36f21b,null));};exports[_0x880e('0x47')]=function(_0x2b4bf4,_0x1f11d7){return db[_0x880e('0x27')]['find']({'where':{'id':_0x2b4bf4[_0x880e('0x43')]['id']}})[_0x880e('0x21')](handleEntityNotFound(_0x1f11d7,null))[_0x880e('0x21')](removeEntity(_0x1f11d7,null))['catch'](handleError(_0x1f11d7,null));};exports[_0x880e('0x48')]=function(_0x543d8b,_0x1aedce){return db[_0x880e('0x27')][_0x880e('0x48')]()[_0x880e('0x21')](respondWithResult(_0x1aedce,null))[_0x880e('0x41')](handleError(_0x1aedce,null));}; \ No newline at end of file +var _0xf0f2=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','WhatsappQueueReport','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x23edcf,_0x714da5){var _0x2f2cd7=function(_0x574a42){while(--_0x574a42){_0x23edcf['push'](_0x23edcf['shift']());}};_0x2f2cd7(++_0x714da5);}(_0xf0f2,0xc9));var _0x2f0f=function(_0x59c05e,_0x5e7c42){_0x59c05e=_0x59c05e-0x0;var _0x5366a2=_0xf0f2[_0x59c05e];return _0x5366a2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2f0f('0x0'));var zipdir=require(_0x2f0f('0x1'));var jsonpatch=require(_0x2f0f('0x2'));var rp=require(_0x2f0f('0x3'));var moment=require('moment');var BPromise=require(_0x2f0f('0x4'));var Mustache=require(_0x2f0f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2f0f('0x6'));var csv=require(_0x2f0f('0x7'));var ejs=require(_0x2f0f('0x8'));var fs=require('fs');var _=require(_0x2f0f('0x9'));var squel=require(_0x2f0f('0xa'));var crypto=require(_0x2f0f('0xb'));var jsforce=require(_0x2f0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2f0f('0x7'));var querystring=require(_0x2f0f('0xd'));var Papa=require('papaparse');var Redis=require(_0x2f0f('0xe'));var authService=require(_0x2f0f('0xf'));var qs=require(_0x2f0f('0x10'));var as=require(_0x2f0f('0x11'));var hardwareService=require(_0x2f0f('0x12'));var logger=require(_0x2f0f('0x13'))(_0x2f0f('0x14'));var utils=require('../../config/utils');var config=require(_0x2f0f('0x15'));var licenseUtil=require(_0x2f0f('0x16'));var db=require(_0x2f0f('0x17'))['db'];function respondWithStatusCode(_0x19975b,_0x2aaa0d){_0x2aaa0d=_0x2aaa0d||0xcc;return function(_0x43650d){if(_0x43650d){return _0x19975b[_0x2f0f('0x18')](_0x2aaa0d);}return _0x19975b[_0x2f0f('0x19')](_0x2aaa0d)[_0x2f0f('0x1a')]();};}function respondWithResult(_0x2225e6,_0x141fc7){_0x141fc7=_0x141fc7||0xc8;return function(_0x58f5d5){if(_0x58f5d5){return _0x2225e6[_0x2f0f('0x19')](_0x141fc7)[_0x2f0f('0x1b')](_0x58f5d5);}};}function respondWithFilteredResult(_0x422c65,_0x28ee4b){return function(_0xcff54a){if(_0xcff54a){var _0x1dd29a=_0xcff54a[_0x2f0f('0x1c')],_0x19bd25=_0x28ee4b[_0x2f0f('0x1d')],_0x1350a7=_0x28ee4b[_0x2f0f('0x1d')]+_0x28ee4b['limit'],_0x453731;if(_0x1350a7>=_0x1dd29a){_0x1350a7=_0x1dd29a;_0x453731=0xc8;}else{_0x453731=0xce;}_0x422c65['status'](_0x453731);return _0x422c65[_0x2f0f('0x1e')](_0x2f0f('0x1f'),_0x19bd25+'-'+_0x1350a7+'/'+_0x1dd29a)[_0x2f0f('0x1b')](_0xcff54a);}return null;};}function patchUpdates(_0x17067c){return function(_0x4c6c54){try{jsonpatch[_0x2f0f('0x20')](_0x4c6c54,_0x17067c,!![]);}catch(_0x53da0a){return BPromise[_0x2f0f('0x21')](_0x53da0a);}return _0x4c6c54['save']();};}function saveUpdates(_0x650cee,_0x4b516d){return function(_0x2d6e53){if(_0x2d6e53){return _0x2d6e53[_0x2f0f('0x22')](_0x650cee)[_0x2f0f('0x23')](function(_0x2e4b12){return _0x2e4b12;});}return null;};}function removeEntity(_0x77113a,_0xf3fed4){return function(_0x402aa2){if(_0x402aa2){return _0x402aa2[_0x2f0f('0x24')]()[_0x2f0f('0x23')](function(){_0x77113a[_0x2f0f('0x19')](0xcc)[_0x2f0f('0x1a')]();});}};}function handleEntityNotFound(_0x2642fc,_0x497df5){return function(_0x3b213b){if(!_0x3b213b){_0x2642fc[_0x2f0f('0x18')](0x194);}return _0x3b213b;};}function handleError(_0x24e6cc,_0xce95a8){_0xce95a8=_0xce95a8||0x1f4;return function(_0x27e112){logger[_0x2f0f('0x25')](_0x27e112[_0x2f0f('0x26')]);if(_0x27e112[_0x2f0f('0x27')]){delete _0x27e112[_0x2f0f('0x27')];}_0x24e6cc[_0x2f0f('0x19')](_0xce95a8)[_0x2f0f('0x28')](_0x27e112);};}exports[_0x2f0f('0x29')]=function(_0x3a8a5f,_0x4e1642){var _0x358ec3={},_0x34c5e0={},_0x58dcb6={'count':0x0,'rows':[]};var _0x224bde=_[_0x2f0f('0x2a')](db['WhatsappQueueReport'][_0x2f0f('0x2b')],function(_0x3b48a7){return{'name':_0x3b48a7['fieldName'],'type':_0x3b48a7['type'][_0x2f0f('0x2c')]};});_0x34c5e0[_0x2f0f('0x2d')]=_['map'](_0x224bde,_0x2f0f('0x27'));_0x34c5e0[_0x2f0f('0x2e')]=_['keys'](_0x3a8a5f['query']);_0x34c5e0[_0x2f0f('0x2f')]=_['intersection'](_0x34c5e0[_0x2f0f('0x2d')],_0x34c5e0[_0x2f0f('0x2e')]);_0x358ec3['attributes']=_[_0x2f0f('0x30')](_0x34c5e0['model'],qs[_0x2f0f('0x31')](_0x3a8a5f['query'][_0x2f0f('0x31')]));_0x358ec3[_0x2f0f('0x32')]=_0x358ec3[_0x2f0f('0x32')][_0x2f0f('0x33')]?_0x358ec3[_0x2f0f('0x32')]:_0x34c5e0[_0x2f0f('0x2d')];if(!_0x3a8a5f[_0x2f0f('0x2e')]['hasOwnProperty'](_0x2f0f('0x34'))){_0x358ec3[_0x2f0f('0x35')]=qs[_0x2f0f('0x35')](_0x3a8a5f[_0x2f0f('0x2e')][_0x2f0f('0x35')]);_0x358ec3[_0x2f0f('0x1d')]=qs[_0x2f0f('0x1d')](_0x3a8a5f[_0x2f0f('0x2e')]['offset']);}_0x358ec3[_0x2f0f('0x36')]=qs[_0x2f0f('0x37')](_0x3a8a5f[_0x2f0f('0x2e')][_0x2f0f('0x37')]);_0x358ec3[_0x2f0f('0x38')]=qs[_0x2f0f('0x2f')](_[_0x2f0f('0x39')](_0x3a8a5f['query'],_0x34c5e0[_0x2f0f('0x2f')]),_0x224bde);if(_0x3a8a5f[_0x2f0f('0x2e')][_0x2f0f('0x3a')]){_0x358ec3[_0x2f0f('0x38')]=_['merge'](_0x358ec3[_0x2f0f('0x38')],{'$or':_[_0x2f0f('0x2a')](_0x224bde,function(_0x40e4bb){if(_0x40e4bb[_0x2f0f('0x3b')]!==_0x2f0f('0x3c')){var _0x37a4fd={};_0x37a4fd[_0x40e4bb['name']]={'$like':'%'+_0x3a8a5f[_0x2f0f('0x2e')][_0x2f0f('0x3a')]+'%'};return _0x37a4fd;}})});}_0x358ec3=_[_0x2f0f('0x3d')]({},_0x358ec3,_0x3a8a5f[_0x2f0f('0x3e')]);var _0x305946={'where':_0x358ec3[_0x2f0f('0x38')]};return db[_0x2f0f('0x3f')]['count'](_0x305946)[_0x2f0f('0x23')](function(_0x3af4a6){_0x58dcb6[_0x2f0f('0x1c')]=_0x3af4a6;if(_0x3a8a5f[_0x2f0f('0x2e')][_0x2f0f('0x40')]){_0x358ec3[_0x2f0f('0x41')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x358ec3);})[_0x2f0f('0x23')](function(_0x119af8){_0x58dcb6[_0x2f0f('0x42')]=_0x119af8;return _0x58dcb6;})['then'](respondWithFilteredResult(_0x4e1642,_0x358ec3))[_0x2f0f('0x43')](handleError(_0x4e1642,null));};exports[_0x2f0f('0x44')]=function(_0x386468,_0x229008){var _0x3f5156={'raw':!![],'where':{'id':_0x386468[_0x2f0f('0x45')]['id']}},_0x8db16a={};_0x8db16a[_0x2f0f('0x2d')]=_[_0x2f0f('0x46')](db[_0x2f0f('0x3f')]['rawAttributes']);_0x8db16a[_0x2f0f('0x2e')]=_[_0x2f0f('0x46')](_0x386468[_0x2f0f('0x2e')]);_0x8db16a['filters']=_[_0x2f0f('0x30')](_0x8db16a[_0x2f0f('0x2d')],_0x8db16a['query']);_0x3f5156['attributes']=_['intersection'](_0x8db16a[_0x2f0f('0x2d')],qs[_0x2f0f('0x31')](_0x386468[_0x2f0f('0x2e')]['fields']));_0x3f5156[_0x2f0f('0x32')]=_0x3f5156[_0x2f0f('0x32')][_0x2f0f('0x33')]?_0x3f5156['attributes']:_0x8db16a[_0x2f0f('0x2d')];if(_0x386468['query'][_0x2f0f('0x40')]){_0x3f5156[_0x2f0f('0x41')]=[{'all':!![]}];}_0x3f5156=_[_0x2f0f('0x3d')]({},_0x3f5156,_0x386468[_0x2f0f('0x3e')]);return db[_0x2f0f('0x3f')]['find'](_0x3f5156)[_0x2f0f('0x23')](handleEntityNotFound(_0x229008,null))[_0x2f0f('0x23')](respondWithResult(_0x229008,null))[_0x2f0f('0x43')](handleError(_0x229008,null));};exports['create']=function(_0x96fdc6,_0xec6eb4){return db[_0x2f0f('0x3f')][_0x2f0f('0x47')](_0x96fdc6['body'],{})['then'](respondWithResult(_0xec6eb4,0xc9))[_0x2f0f('0x43')](handleError(_0xec6eb4,null));};exports[_0x2f0f('0x22')]=function(_0x3955d1,_0x4a08a4){if(_0x3955d1[_0x2f0f('0x48')]['id']){delete _0x3955d1[_0x2f0f('0x48')]['id'];}return db[_0x2f0f('0x3f')][_0x2f0f('0x49')]({'where':{'id':_0x3955d1[_0x2f0f('0x45')]['id']}})[_0x2f0f('0x23')](handleEntityNotFound(_0x4a08a4,null))['then'](saveUpdates(_0x3955d1[_0x2f0f('0x48')],null))[_0x2f0f('0x23')](respondWithResult(_0x4a08a4,null))[_0x2f0f('0x43')](handleError(_0x4a08a4,null));};exports[_0x2f0f('0x24')]=function(_0x441c43,_0x339372){return db[_0x2f0f('0x3f')][_0x2f0f('0x49')]({'where':{'id':_0x441c43[_0x2f0f('0x45')]['id']}})[_0x2f0f('0x23')](handleEntityNotFound(_0x339372,null))[_0x2f0f('0x23')](removeEntity(_0x339372,null))[_0x2f0f('0x43')](handleError(_0x339372,null));};exports[_0x2f0f('0x4a')]=function(_0x551eb9,_0x3d504c){return db['WhatsappQueueReport'][_0x2f0f('0x4a')]()['then'](respondWithResult(_0x3d504c,null))[_0x2f0f('0x43')](handleError(_0x3d504c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0cf6cc1..f828847 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 _0xf3c8=['WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define'];(function(_0x111165,_0x4f9303){var _0x64f7b6=function(_0x400882){while(--_0x400882){_0x111165['push'](_0x111165['shift']());}};_0x64f7b6(++_0x4f9303);}(_0xf3c8,0x160));var _0x8f3c=function(_0x5d0192,_0x1fd6c0){_0x5d0192=_0x5d0192-0x0;var _0x210c03=_0xf3c8[_0x5d0192];return _0x210c03;};'use strict';var _=require(_0x8f3c('0x0'));var util=require(_0x8f3c('0x1'));var logger=require(_0x8f3c('0x2'))(_0x8f3c('0x3'));var moment=require(_0x8f3c('0x4'));var BPromise=require(_0x8f3c('0x5'));var rp=require(_0x8f3c('0x6'));var fs=require('fs');var path=require(_0x8f3c('0x7'));var rimraf=require(_0x8f3c('0x8'));var config=require('../../config/environment');var attributes=require(_0x8f3c('0x9'));module[_0x8f3c('0xa')]=function(_0x55bbc1,_0x5d878e){return _0x55bbc1[_0x8f3c('0xb')](_0x8f3c('0xc'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x8f3c('0xd'),'fields':[_0x8f3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf073=['moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x291ffa,_0x4d7e70){var _0x3e3066=function(_0x1ee903){while(--_0x1ee903){_0x291ffa['push'](_0x291ffa['shift']());}};_0x3e3066(++_0x4d7e70);}(_0xf073,0x1e8));var _0x3f07=function(_0x515255,_0x1ce61e){_0x515255=_0x515255-0x0;var _0x36fd54=_0xf073[_0x515255];return _0x36fd54;};'use strict';var _=require(_0x3f07('0x0'));var util=require(_0x3f07('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f07('0x2'));var BPromise=require(_0x3f07('0x3'));var rp=require(_0x3f07('0x4'));var fs=require('fs');var path=require(_0x3f07('0x5'));var rimraf=require(_0x3f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f07('0x7'));module['exports']=function(_0xff35c,_0x2b25cd){return _0xff35c['define']('WhatsappQueueReport',attributes,{'tableName':_0x3f07('0x8'),'paranoid':![],'indexes':[{'name':_0x3f07('0x9'),'fields':[_0x3f07('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f772d44..4472ce5 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 _0x27c4=['where','attributes','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','body'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x27c4,0xc8));var _0x427c=function(_0x14acf4,_0x268519){_0x14acf4=_0x14acf4-0x0;var _0x1aedf6=_0x27c4[_0x14acf4];return _0x1aedf6;};'use strict';var _=require(_0x427c('0x0'));var util=require(_0x427c('0x1'));var moment=require(_0x427c('0x2'));var BPromise=require('bluebird');var rs=require(_0x427c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x427c('0x4'));var logger=require(_0x427c('0x5'))(_0x427c('0x6'));var config=require(_0x427c('0x7'));var jayson=require(_0x427c('0x8'));var client=jayson[_0x427c('0x9')][_0x427c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa5ad37,_0x1ad442,_0x329475){return new BPromise(function(_0x1f771f,_0x392be6){return client['request'](_0xa5ad37,_0x329475)[_0x427c('0xb')](function(_0x1f1fac){logger[_0x427c('0xc')](_0x427c('0xd'),_0x1ad442,_0x427c('0xe'));logger[_0x427c('0xf')](_0x427c('0x10'),_0x1ad442,_0x427c('0xe'),JSON[_0x427c('0x11')](_0x1f1fac));if(_0x1f1fac[_0x427c('0x12')]){if(_0x1f1fac['error'][_0x427c('0x13')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x1ad442,_0x1f1fac['error']['message']);return _0x392be6(_0x1f1fac['error']['message']);}logger[_0x427c('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1ad442,_0x1f1fac[_0x427c('0x12')][_0x427c('0x14')]);return _0x1f771f(_0x1f1fac[_0x427c('0x12')][_0x427c('0x14')]);}else{logger[_0x427c('0xc')](_0x427c('0xd'),_0x1ad442,'request\x20sent');_0x1f771f(_0x1f1fac[_0x427c('0x15')][_0x427c('0x14')]);}})[_0x427c('0x16')](function(_0x3eb9d6){logger[_0x427c('0x12')](_0x427c('0xd'),_0x1ad442,_0x3eb9d6);_0x392be6(_0x3eb9d6);});});}exports[_0x427c('0x17')]=function(_0x44d977){var _0x21fdcd=this;return new Promise(function(_0x9dce9f,_0x4412b0){return db['WhatsappQueueReport'][_0x427c('0x18')](_0x44d977['body'],{'raw':_0x44d977[_0x427c('0x19')]?_0x44d977[_0x427c('0x19')][_0x427c('0x1a')]===undefined?!![]:![]:!![]})[_0x427c('0xb')](function(_0x399381){logger[_0x427c('0xc')](_0x427c('0x17'),_0x44d977);logger['debug'](_0x427c('0x17'),_0x44d977,JSON['stringify'](_0x399381));_0x9dce9f(_0x399381);})[_0x427c('0x16')](function(_0x58fd9a){logger['error']('CreateWhatsappQueueReport',_0x58fd9a[_0x427c('0x14')],_0x44d977);_0x4412b0(_0x21fdcd[_0x427c('0x12')](0x1f4,_0x58fd9a['message']));});});};exports[_0x427c('0x1b')]=function(_0x18cea9){var _0x42886e=this;return new Promise(function(_0xeac2b8,_0x57d05e){return db[_0x427c('0x1c')][_0x427c('0x1d')](_0x18cea9[_0x427c('0x1e')],{'raw':_0x18cea9['options']?_0x18cea9[_0x427c('0x19')][_0x427c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18cea9[_0x427c('0x19')]?_0x18cea9[_0x427c('0x19')][_0x427c('0x1f')]||null:null,'attributes':_0x18cea9[_0x427c('0x19')]?_0x18cea9['options'][_0x427c('0x20')]||null:null,'limit':_0x18cea9[_0x427c('0x19')]?_0x18cea9['options']['limit']||null:null})[_0x427c('0xb')](function(_0x951493){logger['info']('UpdateWhatsappQueueReport',_0x18cea9);logger[_0x427c('0xf')](_0x427c('0x1b'),_0x18cea9,JSON['stringify'](_0x951493));_0xeac2b8(_0x951493);})['catch'](function(_0x2f164b){logger['error'](_0x427c('0x1b'),_0x2f164b[_0x427c('0x14')],_0x18cea9);_0x57d05e(_0x42886e['error'](0x1f4,_0x2f164b[_0x427c('0x14')]));});});}; \ No newline at end of file +var _0x5e48=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird'];(function(_0x456624,_0x11a6cd){var _0x14b320=function(_0x440500){while(--_0x440500){_0x456624['push'](_0x456624['shift']());}};_0x14b320(++_0x11a6cd);}(_0x5e48,0xc2));var _0x85e4=function(_0x26dfa5,_0x2ed3e9){_0x26dfa5=_0x26dfa5-0x0;var _0x408dd2=_0x5e48[_0x26dfa5];return _0x408dd2;};'use strict';var _=require(_0x85e4('0x0'));var util=require(_0x85e4('0x1'));var moment=require(_0x85e4('0x2'));var BPromise=require(_0x85e4('0x3'));var rs=require(_0x85e4('0x4'));var fs=require('fs');var Redis=require(_0x85e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x85e4('0x6'));var logger=require(_0x85e4('0x7'))('rpc');var config=require(_0x85e4('0x8'));var jayson=require(_0x85e4('0x9'));var client=jayson[_0x85e4('0xa')][_0x85e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x680643,_0x3fc294,_0x5920b2){return new BPromise(function(_0x324ee1,_0x4d244b){return client['request'](_0x680643,_0x5920b2)[_0x85e4('0xc')](function(_0x1aa4bd){logger[_0x85e4('0xd')](_0x85e4('0xe'),_0x3fc294,_0x85e4('0xf'));logger[_0x85e4('0x10')](_0x85e4('0x11'),_0x3fc294,'request\x20sent',JSON[_0x85e4('0x12')](_0x1aa4bd));if(_0x1aa4bd[_0x85e4('0x13')]){if(_0x1aa4bd['error'][_0x85e4('0x14')]===0x1f4){logger[_0x85e4('0x13')](_0x85e4('0xe'),_0x3fc294,_0x1aa4bd[_0x85e4('0x13')]['message']);return _0x4d244b(_0x1aa4bd[_0x85e4('0x13')][_0x85e4('0x15')]);}logger[_0x85e4('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3fc294,_0x1aa4bd[_0x85e4('0x13')][_0x85e4('0x15')]);return _0x324ee1(_0x1aa4bd[_0x85e4('0x13')][_0x85e4('0x15')]);}else{logger['info'](_0x85e4('0xe'),_0x3fc294,_0x85e4('0xf'));_0x324ee1(_0x1aa4bd[_0x85e4('0x16')][_0x85e4('0x15')]);}})[_0x85e4('0x17')](function(_0x253458){logger[_0x85e4('0x13')](_0x85e4('0xe'),_0x3fc294,_0x253458);_0x4d244b(_0x253458);});});}exports['CreateWhatsappQueueReport']=function(_0x320f74){var _0x3d93ee=this;return new Promise(function(_0x274c3b,_0x6091e2){return db[_0x85e4('0x18')]['create'](_0x320f74[_0x85e4('0x19')],{'raw':_0x320f74[_0x85e4('0x1a')]?_0x320f74[_0x85e4('0x1a')][_0x85e4('0x1b')]===undefined?!![]:![]:!![]})[_0x85e4('0xc')](function(_0x2ee48f){logger[_0x85e4('0xd')](_0x85e4('0x1c'),_0x320f74);logger[_0x85e4('0x10')](_0x85e4('0x1c'),_0x320f74,JSON[_0x85e4('0x12')](_0x2ee48f));_0x274c3b(_0x2ee48f);})[_0x85e4('0x17')](function(_0xef5f91){logger[_0x85e4('0x13')]('CreateWhatsappQueueReport',_0xef5f91[_0x85e4('0x15')],_0x320f74);_0x6091e2(_0x3d93ee[_0x85e4('0x13')](0x1f4,_0xef5f91[_0x85e4('0x15')]));});});};exports[_0x85e4('0x1d')]=function(_0x117ad6){var _0x348b98=this;return new Promise(function(_0x16f0ab,_0x5abeb7){return db[_0x85e4('0x18')][_0x85e4('0x1e')](_0x117ad6['body'],{'raw':_0x117ad6['options']?_0x117ad6['options'][_0x85e4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x117ad6['options']?_0x117ad6['options'][_0x85e4('0x1f')]||null:null,'attributes':_0x117ad6[_0x85e4('0x1a')]?_0x117ad6['options'][_0x85e4('0x20')]||null:null,'limit':_0x117ad6[_0x85e4('0x1a')]?_0x117ad6[_0x85e4('0x1a')]['limit']||null:null})[_0x85e4('0xc')](function(_0x27da4d){logger[_0x85e4('0xd')](_0x85e4('0x1d'),_0x117ad6);logger[_0x85e4('0x10')](_0x85e4('0x1d'),_0x117ad6,JSON[_0x85e4('0x12')](_0x27da4d));_0x16f0ab(_0x27da4d);})[_0x85e4('0x17')](function(_0x4f140f){logger[_0x85e4('0x13')](_0x85e4('0x1d'),_0x4f140f['message'],_0x117ad6);_0x5abeb7(_0x348b98[_0x85e4('0x13')](0x1f4,_0x4f140f[_0x85e4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9cd59b4..00ce2af 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 _0x1396=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','path','Router'];(function(_0x33e97b,_0x522329){var _0x3004e8=function(_0x5d18cf){while(--_0x5d18cf){_0x33e97b['push'](_0x33e97b['shift']());}};_0x3004e8(++_0x522329);}(_0x1396,0x1ea));var _0x6139=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x1396[_0x1a21ff];return _0x25afc1;};'use strict';var multer=require(_0x6139('0x0'));var util=require('util');var path=require(_0x6139('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6139('0x2')]();var auth=require(_0x6139('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6139('0x4'));var controller=require('./whatsappTransferReport.controller');router[_0x6139('0x5')]('/',auth[_0x6139('0x6')](),controller[_0x6139('0x7')]);router[_0x6139('0x5')](_0x6139('0x8'),auth[_0x6139('0x6')](),controller[_0x6139('0x9')]);router['get'](_0x6139('0xa'),auth['isAuthenticated'](),controller[_0x6139('0xb')]);router[_0x6139('0xc')]('/',auth[_0x6139('0x6')](),controller['create']);router[_0x6139('0xd')](_0x6139('0xa'),auth[_0x6139('0x6')](),controller[_0x6139('0xe')]);router[_0x6139('0xf')](_0x6139('0xa'),auth[_0x6139('0x6')](),controller[_0x6139('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa3c4=['show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa3c4,0xba));var _0x4a3c=function(_0x5e0983,_0x242c6d){_0x5e0983=_0x5e0983-0x0;var _0x5c1803=_0xa3c4[_0x5e0983];return _0x5c1803;};'use strict';var multer=require(_0x4a3c('0x0'));var util=require(_0x4a3c('0x1'));var path=require('path');var timeout=require(_0x4a3c('0x2'));var express=require(_0x4a3c('0x3'));var router=express[_0x4a3c('0x4')]();var auth=require(_0x4a3c('0x5'));var interaction=require(_0x4a3c('0x6'));var config=require(_0x4a3c('0x7'));var controller=require(_0x4a3c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4a3c('0x9')](_0x4a3c('0xa'),auth[_0x4a3c('0xb')](),controller[_0x4a3c('0xc')]);router[_0x4a3c('0x9')](_0x4a3c('0xd'),auth['isAuthenticated'](),controller[_0x4a3c('0xe')]);router[_0x4a3c('0xf')]('/',auth[_0x4a3c('0xb')](),controller['create']);router[_0x4a3c('0x10')]('/:id',auth[_0x4a3c('0xb')](),controller[_0x4a3c('0x11')]);router['delete'](_0x4a3c('0xd'),auth[_0x4a3c('0xb')](),controller[_0x4a3c('0x12')]);module[_0x4a3c('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 359f421..266fe86 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(_0x409864,_0x70758f){var _0x817486=function(_0x5c06a7){while(--_0x5c06a7){_0x409864['push'](_0x409864['shift']());}};_0x817486(++_0x70758f);}(_0x2032,0xd9));var _0x2203=function(_0x2a108c,_0x456c02){_0x2a108c=_0x2a108c-0x0;var _0x246f9d=_0x2032[_0x2a108c];return _0x246f9d;};'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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0bdb83b..1759245 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 _0x2fb3=['to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','destroy','then','error','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fb3,0x1a6));var _0x32fb=function(_0x36bc5a,_0x31ee57){_0x36bc5a=_0x36bc5a-0x0;var _0x38b771=_0x2fb3[_0x36bc5a];return _0x38b771;};'use strict';var pdf=require(_0x32fb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x32fb('0x1'));var jsonpatch=require(_0x32fb('0x2'));var rp=require(_0x32fb('0x3'));var moment=require(_0x32fb('0x4'));var BPromise=require(_0x32fb('0x5'));var Mustache=require(_0x32fb('0x6'));var util=require(_0x32fb('0x7'));var path=require(_0x32fb('0x8'));var sox=require(_0x32fb('0x9'));var csv=require(_0x32fb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x32fb('0xb'));var crypto=require(_0x32fb('0xc'));var jsforce=require(_0x32fb('0xd'));var deskjs=require(_0x32fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x32fb('0xf'));var Papa=require(_0x32fb('0x10'));var Redis=require('ioredis');var authService=require(_0x32fb('0x11'));var qs=require(_0x32fb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32fb('0x13'));var logger=require(_0x32fb('0x14'))(_0x32fb('0x15'));var utils=require('../../config/utils');var config=require(_0x32fb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x32fb('0x17'))['db'];function respondWithStatusCode(_0x50ed5f,_0x12a6c4){_0x12a6c4=_0x12a6c4||0xcc;return function(_0x34afcc){if(_0x34afcc){return _0x50ed5f[_0x32fb('0x18')](_0x12a6c4);}return _0x50ed5f[_0x32fb('0x19')](_0x12a6c4)[_0x32fb('0x1a')]();};}function respondWithResult(_0x452ada,_0x216ba8){_0x216ba8=_0x216ba8||0xc8;return function(_0x27e207){if(_0x27e207){return _0x452ada[_0x32fb('0x19')](_0x216ba8)[_0x32fb('0x1b')](_0x27e207);}};}function respondWithFilteredResult(_0x160d09,_0x49c729){return function(_0x1b737b){if(_0x1b737b){var _0x4b170c=_0x1b737b['count'],_0x4110fc=_0x49c729[_0x32fb('0x1c')],_0x3f58f3=_0x49c729['offset']+_0x49c729[_0x32fb('0x1d')],_0x24085c;if(_0x3f58f3>=_0x4b170c){_0x3f58f3=_0x4b170c;_0x24085c=0xc8;}else{_0x24085c=0xce;}_0x160d09[_0x32fb('0x19')](_0x24085c);return _0x160d09[_0x32fb('0x1e')](_0x32fb('0x1f'),_0x4110fc+'-'+_0x3f58f3+'/'+_0x4b170c)[_0x32fb('0x1b')](_0x1b737b);}return null;};}function patchUpdates(_0x222923){return function(_0x12e0f7){try{jsonpatch[_0x32fb('0x20')](_0x12e0f7,_0x222923,!![]);}catch(_0x3f359a){return BPromise['reject'](_0x3f359a);}return _0x12e0f7['save']();};}function saveUpdates(_0xd5670,_0x3d24fa){return function(_0x5bdb46){if(_0x5bdb46){return _0x5bdb46[_0x32fb('0x21')](_0xd5670)['then'](function(_0x454dda){return _0x454dda;});}return null;};}function removeEntity(_0x325597,_0x1b5050){return function(_0x33ed39){if(_0x33ed39){return _0x33ed39[_0x32fb('0x22')]()[_0x32fb('0x23')](function(){_0x325597[_0x32fb('0x19')](0xcc)[_0x32fb('0x1a')]();});}};}function handleEntityNotFound(_0x38dcbd,_0x1c8680){return function(_0x3a2ce1){if(!_0x3a2ce1){_0x38dcbd[_0x32fb('0x18')](0x194);}return _0x3a2ce1;};}function handleError(_0x30bfef,_0x5432eb){_0x5432eb=_0x5432eb||0x1f4;return function(_0x40bd97){logger[_0x32fb('0x24')](_0x40bd97['stack']);if(_0x40bd97[_0x32fb('0x25')]){delete _0x40bd97[_0x32fb('0x25')];}_0x30bfef[_0x32fb('0x19')](_0x5432eb)['send'](_0x40bd97);};}exports[_0x32fb('0x26')]=function(_0x386cbc,_0x4e4df7){var _0x26b0b5={},_0x5243f8={},_0x540db7={'count':0x0,'rows':[]};var _0x560236=_[_0x32fb('0x27')](db[_0x32fb('0x28')][_0x32fb('0x29')],function(_0x3b3a75){return{'name':_0x3b3a75[_0x32fb('0x2a')],'type':_0x3b3a75[_0x32fb('0x2b')][_0x32fb('0x2c')]};});_0x5243f8[_0x32fb('0x2d')]=_[_0x32fb('0x27')](_0x560236,'name');_0x5243f8[_0x32fb('0x2e')]=_[_0x32fb('0x2f')](_0x386cbc[_0x32fb('0x2e')]);_0x5243f8[_0x32fb('0x30')]=_[_0x32fb('0x31')](_0x5243f8['model'],_0x5243f8[_0x32fb('0x2e')]);_0x26b0b5['attributes']=_[_0x32fb('0x31')](_0x5243f8[_0x32fb('0x2d')],qs[_0x32fb('0x32')](_0x386cbc[_0x32fb('0x2e')][_0x32fb('0x32')]));_0x26b0b5[_0x32fb('0x33')]=_0x26b0b5[_0x32fb('0x33')][_0x32fb('0x34')]?_0x26b0b5[_0x32fb('0x33')]:_0x5243f8[_0x32fb('0x2d')];if(!_0x386cbc[_0x32fb('0x2e')][_0x32fb('0x35')]('nolimit')){_0x26b0b5[_0x32fb('0x1d')]=qs[_0x32fb('0x1d')](_0x386cbc[_0x32fb('0x2e')][_0x32fb('0x1d')]);_0x26b0b5[_0x32fb('0x1c')]=qs[_0x32fb('0x1c')](_0x386cbc[_0x32fb('0x2e')][_0x32fb('0x1c')]);}_0x26b0b5['order']=qs[_0x32fb('0x36')](_0x386cbc['query'][_0x32fb('0x36')]);_0x26b0b5['where']=qs[_0x32fb('0x30')](_[_0x32fb('0x37')](_0x386cbc['query'],_0x5243f8[_0x32fb('0x30')]),_0x560236);if(_0x386cbc[_0x32fb('0x2e')][_0x32fb('0x38')]){_0x26b0b5['where']=_[_0x32fb('0x39')](_0x26b0b5[_0x32fb('0x3a')],{'$or':_['map'](_0x560236,function(_0x2b0a57){if(_0x2b0a57['type']!==_0x32fb('0x3b')){var _0x469f71={};_0x469f71[_0x2b0a57[_0x32fb('0x25')]]={'$like':'%'+_0x386cbc[_0x32fb('0x2e')][_0x32fb('0x38')]+'%'};return _0x469f71;}})});}_0x26b0b5=_[_0x32fb('0x39')]({},_0x26b0b5,_0x386cbc['options']);var _0x20abc5={'where':_0x26b0b5[_0x32fb('0x3a')]};return db[_0x32fb('0x28')][_0x32fb('0x3c')](_0x20abc5)[_0x32fb('0x23')](function(_0x4fd36e){_0x540db7['count']=_0x4fd36e;if(_0x386cbc[_0x32fb('0x2e')][_0x32fb('0x3d')]){_0x26b0b5['include']=[{'all':!![]}];}return db[_0x32fb('0x28')][_0x32fb('0x3e')](_0x26b0b5);})['then'](function(_0x34d27b){_0x540db7['rows']=_0x34d27b;return _0x540db7;})[_0x32fb('0x23')](respondWithFilteredResult(_0x4e4df7,_0x26b0b5))[_0x32fb('0x3f')](handleError(_0x4e4df7,null));};exports[_0x32fb('0x40')]=function(_0x58bbf4,_0x4fabc1){var _0x42da4c={'raw':!![],'where':{'id':_0x58bbf4[_0x32fb('0x41')]['id']}},_0x591e0b={};_0x591e0b[_0x32fb('0x2d')]=_[_0x32fb('0x2f')](db[_0x32fb('0x28')][_0x32fb('0x29')]);_0x591e0b[_0x32fb('0x2e')]=_[_0x32fb('0x2f')](_0x58bbf4[_0x32fb('0x2e')]);_0x591e0b[_0x32fb('0x30')]=_[_0x32fb('0x31')](_0x591e0b[_0x32fb('0x2d')],_0x591e0b[_0x32fb('0x2e')]);_0x42da4c['attributes']=_[_0x32fb('0x31')](_0x591e0b[_0x32fb('0x2d')],qs[_0x32fb('0x32')](_0x58bbf4['query'][_0x32fb('0x32')]));_0x42da4c[_0x32fb('0x33')]=_0x42da4c['attributes'][_0x32fb('0x34')]?_0x42da4c[_0x32fb('0x33')]:_0x591e0b[_0x32fb('0x2d')];if(_0x58bbf4[_0x32fb('0x2e')]['includeAll']){_0x42da4c[_0x32fb('0x42')]=[{'all':!![]}];}_0x42da4c=_[_0x32fb('0x39')]({},_0x42da4c,_0x58bbf4[_0x32fb('0x43')]);return db['WhatsappTransferReport'][_0x32fb('0x44')](_0x42da4c)[_0x32fb('0x23')](handleEntityNotFound(_0x4fabc1,null))[_0x32fb('0x23')](respondWithResult(_0x4fabc1,null))[_0x32fb('0x3f')](handleError(_0x4fabc1,null));};exports['create']=function(_0x399731,_0x1abea0){return db[_0x32fb('0x28')][_0x32fb('0x45')](_0x399731[_0x32fb('0x46')],{})['then'](respondWithResult(_0x1abea0,0xc9))[_0x32fb('0x3f')](handleError(_0x1abea0,null));};exports[_0x32fb('0x21')]=function(_0x21c005,_0x2d925e){if(_0x21c005[_0x32fb('0x46')]['id']){delete _0x21c005[_0x32fb('0x46')]['id'];}return db['WhatsappTransferReport'][_0x32fb('0x44')]({'where':{'id':_0x21c005[_0x32fb('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d925e,null))[_0x32fb('0x23')](saveUpdates(_0x21c005['body'],null))[_0x32fb('0x23')](respondWithResult(_0x2d925e,null))[_0x32fb('0x3f')](handleError(_0x2d925e,null));};exports['destroy']=function(_0x56c0f1,_0x35f959){return db[_0x32fb('0x28')][_0x32fb('0x44')]({'where':{'id':_0x56c0f1[_0x32fb('0x41')]['id']}})[_0x32fb('0x23')](handleEntityNotFound(_0x35f959,null))['then'](removeEntity(_0x35f959,null))[_0x32fb('0x3f')](handleError(_0x35f959,null));};exports[_0x32fb('0x47')]=function(_0x2fab9b,_0x117963){return db[_0x32fb('0x28')][_0x32fb('0x47')]()[_0x32fb('0x23')](respondWithResult(_0x117963,null))[_0x32fb('0x3f')](handleError(_0x117963,null));}; \ No newline at end of file +var _0xdacf=['map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save','then','destroy','end','error','name','send'];(function(_0xe2a9bf,_0x2a95c9){var _0x57577b=function(_0x566485){while(--_0x566485){_0xe2a9bf['push'](_0xe2a9bf['shift']());}};_0x57577b(++_0x2a95c9);}(_0xdacf,0x72));var _0xfdac=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdacf[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xfdac('0x0'));var emlformat=require(_0xfdac('0x1'));var rimraf=require(_0xfdac('0x2'));var zipdir=require(_0xfdac('0x3'));var jsonpatch=require(_0xfdac('0x4'));var rp=require(_0xfdac('0x5'));var moment=require(_0xfdac('0x6'));var BPromise=require(_0xfdac('0x7'));var Mustache=require(_0xfdac('0x8'));var util=require(_0xfdac('0x9'));var path=require('path');var sox=require(_0xfdac('0xa'));var csv=require(_0xfdac('0xb'));var ejs=require(_0xfdac('0xc'));var fs=require('fs');var _=require(_0xfdac('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfdac('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfdac('0xb'));var querystring=require(_0xfdac('0xf'));var Papa=require(_0xfdac('0x10'));var Redis=require(_0xfdac('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfdac('0x12'));var as=require(_0xfdac('0x13'));var hardwareService=require(_0xfdac('0x14'));var logger=require(_0xfdac('0x15'))(_0xfdac('0x16'));var utils=require(_0xfdac('0x17'));var config=require(_0xfdac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfdac('0x19'))['db'];function respondWithStatusCode(_0xb2d655,_0xf2d9e4){_0xf2d9e4=_0xf2d9e4||0xcc;return function(_0x9eb257){if(_0x9eb257){return _0xb2d655[_0xfdac('0x1a')](_0xf2d9e4);}return _0xb2d655[_0xfdac('0x1b')](_0xf2d9e4)['end']();};}function respondWithResult(_0x325e56,_0x4b8e06){_0x4b8e06=_0x4b8e06||0xc8;return function(_0x5f5206){if(_0x5f5206){return _0x325e56[_0xfdac('0x1b')](_0x4b8e06)['json'](_0x5f5206);}};}function respondWithFilteredResult(_0x75ae3a,_0x4374ce){return function(_0x38fc83){if(_0x38fc83){var _0x3fce47=_0x38fc83[_0xfdac('0x1c')],_0x38d225=_0x4374ce[_0xfdac('0x1d')],_0x2b78aa=_0x4374ce[_0xfdac('0x1d')]+_0x4374ce[_0xfdac('0x1e')],_0x5c266e;if(_0x2b78aa>=_0x3fce47){_0x2b78aa=_0x3fce47;_0x5c266e=0xc8;}else{_0x5c266e=0xce;}_0x75ae3a['status'](_0x5c266e);return _0x75ae3a[_0xfdac('0x1f')]('Content-Range',_0x38d225+'-'+_0x2b78aa+'/'+_0x3fce47)[_0xfdac('0x20')](_0x38fc83);}return null;};}function patchUpdates(_0xbbbd70){return function(_0x3e62e5){try{jsonpatch[_0xfdac('0x21')](_0x3e62e5,_0xbbbd70,!![]);}catch(_0x59c2ba){return BPromise[_0xfdac('0x22')](_0x59c2ba);}return _0x3e62e5[_0xfdac('0x23')]();};}function saveUpdates(_0x50a273,_0x8ad0ab){return function(_0x3b416d){if(_0x3b416d){return _0x3b416d['update'](_0x50a273)[_0xfdac('0x24')](function(_0x2cbde1){return _0x2cbde1;});}return null;};}function removeEntity(_0x5cd671,_0x402c86){return function(_0xbcc9c0){if(_0xbcc9c0){return _0xbcc9c0[_0xfdac('0x25')]()[_0xfdac('0x24')](function(){_0x5cd671[_0xfdac('0x1b')](0xcc)[_0xfdac('0x26')]();});}};}function handleEntityNotFound(_0x11f40f,_0x46b07b){return function(_0x226331){if(!_0x226331){_0x11f40f[_0xfdac('0x1a')](0x194);}return _0x226331;};}function handleError(_0x4aa954,_0x148a3f){_0x148a3f=_0x148a3f||0x1f4;return function(_0x50e1e8){logger[_0xfdac('0x27')](_0x50e1e8['stack']);if(_0x50e1e8[_0xfdac('0x28')]){delete _0x50e1e8[_0xfdac('0x28')];}_0x4aa954[_0xfdac('0x1b')](_0x148a3f)[_0xfdac('0x29')](_0x50e1e8);};}exports['index']=function(_0x3bc601,_0x1c52d1){var _0x53eb59={},_0x3232d9={},_0x127452={'count':0x0,'rows':[]};var _0x8dbe57=_[_0xfdac('0x2a')](db[_0xfdac('0x2b')][_0xfdac('0x2c')],function(_0x204d88){return{'name':_0x204d88[_0xfdac('0x2d')],'type':_0x204d88[_0xfdac('0x2e')][_0xfdac('0x2f')]};});_0x3232d9[_0xfdac('0x30')]=_[_0xfdac('0x2a')](_0x8dbe57,_0xfdac('0x28'));_0x3232d9[_0xfdac('0x31')]=_[_0xfdac('0x32')](_0x3bc601[_0xfdac('0x31')]);_0x3232d9[_0xfdac('0x33')]=_[_0xfdac('0x34')](_0x3232d9[_0xfdac('0x30')],_0x3232d9[_0xfdac('0x31')]);_0x53eb59[_0xfdac('0x35')]=_[_0xfdac('0x34')](_0x3232d9[_0xfdac('0x30')],qs[_0xfdac('0x36')](_0x3bc601[_0xfdac('0x31')][_0xfdac('0x36')]));_0x53eb59[_0xfdac('0x35')]=_0x53eb59[_0xfdac('0x35')][_0xfdac('0x37')]?_0x53eb59[_0xfdac('0x35')]:_0x3232d9[_0xfdac('0x30')];if(!_0x3bc601[_0xfdac('0x31')][_0xfdac('0x38')](_0xfdac('0x39'))){_0x53eb59['limit']=qs['limit'](_0x3bc601[_0xfdac('0x31')][_0xfdac('0x1e')]);_0x53eb59[_0xfdac('0x1d')]=qs['offset'](_0x3bc601[_0xfdac('0x31')]['offset']);}_0x53eb59[_0xfdac('0x3a')]=qs[_0xfdac('0x3b')](_0x3bc601[_0xfdac('0x31')][_0xfdac('0x3b')]);_0x53eb59[_0xfdac('0x3c')]=qs['filters'](_[_0xfdac('0x3d')](_0x3bc601[_0xfdac('0x31')],_0x3232d9['filters']),_0x8dbe57);if(_0x3bc601[_0xfdac('0x31')][_0xfdac('0x3e')]){_0x53eb59['where']=_[_0xfdac('0x3f')](_0x53eb59['where'],{'$or':_[_0xfdac('0x2a')](_0x8dbe57,function(_0x476572){if(_0x476572[_0xfdac('0x2e')]!==_0xfdac('0x40')){var _0xed4253={};_0xed4253[_0x476572[_0xfdac('0x28')]]={'$like':'%'+_0x3bc601[_0xfdac('0x31')][_0xfdac('0x3e')]+'%'};return _0xed4253;}})});}_0x53eb59=_[_0xfdac('0x3f')]({},_0x53eb59,_0x3bc601[_0xfdac('0x41')]);var _0x4b9e86={'where':_0x53eb59[_0xfdac('0x3c')]};return db[_0xfdac('0x2b')]['count'](_0x4b9e86)[_0xfdac('0x24')](function(_0x48b4cd){_0x127452[_0xfdac('0x1c')]=_0x48b4cd;if(_0x3bc601[_0xfdac('0x31')]['includeAll']){_0x53eb59[_0xfdac('0x42')]=[{'all':!![]}];}return db[_0xfdac('0x2b')][_0xfdac('0x43')](_0x53eb59);})['then'](function(_0xf3a8d8){_0x127452[_0xfdac('0x44')]=_0xf3a8d8;return _0x127452;})[_0xfdac('0x24')](respondWithFilteredResult(_0x1c52d1,_0x53eb59))[_0xfdac('0x45')](handleError(_0x1c52d1,null));};exports[_0xfdac('0x46')]=function(_0x262b21,_0x3e7873){var _0x12e9ab={'raw':!![],'where':{'id':_0x262b21[_0xfdac('0x47')]['id']}},_0x1bc017={};_0x1bc017[_0xfdac('0x30')]=_['keys'](db[_0xfdac('0x2b')][_0xfdac('0x2c')]);_0x1bc017['query']=_[_0xfdac('0x32')](_0x262b21[_0xfdac('0x31')]);_0x1bc017[_0xfdac('0x33')]=_['intersection'](_0x1bc017[_0xfdac('0x30')],_0x1bc017['query']);_0x12e9ab[_0xfdac('0x35')]=_[_0xfdac('0x34')](_0x1bc017[_0xfdac('0x30')],qs['fields'](_0x262b21[_0xfdac('0x31')][_0xfdac('0x36')]));_0x12e9ab[_0xfdac('0x35')]=_0x12e9ab[_0xfdac('0x35')][_0xfdac('0x37')]?_0x12e9ab[_0xfdac('0x35')]:_0x1bc017[_0xfdac('0x30')];if(_0x262b21[_0xfdac('0x31')][_0xfdac('0x48')]){_0x12e9ab[_0xfdac('0x42')]=[{'all':!![]}];}_0x12e9ab=_[_0xfdac('0x3f')]({},_0x12e9ab,_0x262b21['options']);return db['WhatsappTransferReport']['find'](_0x12e9ab)[_0xfdac('0x24')](handleEntityNotFound(_0x3e7873,null))[_0xfdac('0x24')](respondWithResult(_0x3e7873,null))[_0xfdac('0x45')](handleError(_0x3e7873,null));};exports[_0xfdac('0x49')]=function(_0x5f0393,_0x5ebab9){return db['WhatsappTransferReport']['create'](_0x5f0393[_0xfdac('0x4a')],{})['then'](respondWithResult(_0x5ebab9,0xc9))[_0xfdac('0x45')](handleError(_0x5ebab9,null));};exports[_0xfdac('0x4b')]=function(_0x4a8e2a,_0x49e27e){if(_0x4a8e2a[_0xfdac('0x4a')]['id']){delete _0x4a8e2a[_0xfdac('0x4a')]['id'];}return db['WhatsappTransferReport'][_0xfdac('0x4c')]({'where':{'id':_0x4a8e2a[_0xfdac('0x47')]['id']}})[_0xfdac('0x24')](handleEntityNotFound(_0x49e27e,null))[_0xfdac('0x24')](saveUpdates(_0x4a8e2a[_0xfdac('0x4a')],null))[_0xfdac('0x24')](respondWithResult(_0x49e27e,null))[_0xfdac('0x45')](handleError(_0x49e27e,null));};exports[_0xfdac('0x25')]=function(_0x3f684b,_0x45a764){return db['WhatsappTransferReport'][_0xfdac('0x4c')]({'where':{'id':_0x3f684b['params']['id']}})['then'](handleEntityNotFound(_0x45a764,null))[_0xfdac('0x24')](removeEntity(_0x45a764,null))[_0xfdac('0x45')](handleError(_0x45a764,null));};exports['describe']=function(_0x59b21e,_0x491e86){return db[_0xfdac('0x2b')][_0xfdac('0x4d')]()[_0xfdac('0x24')](respondWithResult(_0x491e86,null))[_0xfdac('0x45')](handleError(_0x491e86,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5a856d3..cc086d8 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 _0xb1dc=['define','WhatsappTransferReport','report_whatsapp_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./whatsappTransferReport.attributes','exports'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xb1dc,0x147));var _0xcb1d=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xb1dc[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xcb1d('0x0'));var util=require(_0xcb1d('0x1'));var logger=require(_0xcb1d('0x2'))('api');var moment=require(_0xcb1d('0x3'));var BPromise=require(_0xcb1d('0x4'));var rp=require(_0xcb1d('0x5'));var fs=require('fs');var path=require(_0xcb1d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb1d('0x7'));module[_0xcb1d('0x8')]=function(_0x37a963,_0x5113e3){return _0x37a963[_0xcb1d('0x9')](_0xcb1d('0xa'),attributes,{'tableName':_0xcb1d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6df5=['exports','define','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x536539,_0x177246){var _0x3c2f29=function(_0x4f0efa){while(--_0x4f0efa){_0x536539['push'](_0x536539['shift']());}};_0x3c2f29(++_0x177246);}(_0x6df5,0x12a));var _0x56df=function(_0x4139b8,_0x554564){_0x4139b8=_0x4139b8-0x0;var _0x40c6d6=_0x6df5[_0x4139b8];return _0x40c6d6;};'use strict';var _=require('lodash');var util=require(_0x56df('0x0'));var logger=require(_0x56df('0x1'))(_0x56df('0x2'));var moment=require(_0x56df('0x3'));var BPromise=require(_0x56df('0x4'));var rp=require(_0x56df('0x5'));var fs=require('fs');var path=require(_0x56df('0x6'));var rimraf=require(_0x56df('0x7'));var config=require(_0x56df('0x8'));var attributes=require(_0x56df('0x9'));module[_0x56df('0xa')]=function(_0x21dc17,_0x5ec3b2){return _0x21dc17[_0x56df('0xb')]('WhatsappTransferReport',attributes,{'tableName':_0x56df('0xc'),'paranoid':![],'indexes':[{'name':_0x56df('0xd'),'fields':[_0x56df('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 3251461..e1655e1 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(_0x411907,_0x501469){var _0x370382=function(_0x49d969){while(--_0x49d969){_0x411907['push'](_0x411907['shift']());}};_0x370382(++_0x501469);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x2a7825,_0x4c67f6){var _0x163da1=function(_0x4f1abd){while(--_0x4f1abd){_0x2a7825['push'](_0x2a7825['shift']());}};_0x163da1(++_0x4c67f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 95ea5b8..9b4400d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x585e=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map','filter','online','join','Offline\x20apps:','status','None','./config/seedDB','default','catch','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x585e,0x1c2));var _0xe585=function(_0x4341a5,_0x1c7f06){_0x4341a5=_0x4341a5-0x0;var _0x2af155=_0x585e[_0x4341a5];return _0x2af155;};'use strict';var _=require(_0xe585('0x0'));var mysqldb=require(_0xe585('0x1'));var rpc=require(_0xe585('0x2'));var config=require(_0xe585('0x3'));var logger=require(_0xe585('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xe585('0x5'));var schedule=require(_0xe585('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xe585('0x7'));var transcribe=require(_0xe585('0x8'));function main(){return mysqldb['db'][_0xe585('0x9')][_0xe585('0xa')]()[_0xe585('0xb')](function(){return rpc[_0xe585('0xc')]();})[_0xe585('0xb')](function(_0x19d1ec){logger[_0xe585('0xd')](_0x19d1ec);return chat[_0xe585('0xe')]();})[_0xe585('0xb')](function(){return whatsapp[_0xe585('0xe')]();})[_0xe585('0xb')](function(){return schedule['start']();})[_0xe585('0xb')](function(){return transcribe[_0xe585('0xe')]();})['then'](function(_0x2002af){logger['info'](_0x2002af);return pm2[_0xe585('0xe')](pm2Config);})[_0xe585('0xb')](function(_0x3946d2){logger[_0xe585('0xd')]('Online\x20apps:',_[_0xe585('0xf')](_[_0xe585('0x10')](_0x3946d2,{'status':_0xe585('0x11')}),'name')[_0xe585('0x12')]());logger[_0xe585('0xd')](_0xe585('0x13'),_[_0xe585('0xf')](_[_0xe585('0x10')](_0x3946d2,function(_0x491820){return _0x491820[_0xe585('0x14')]!=='online';}),'name')[_0xe585('0x12')]()||_0xe585('0x15'));config['seedDB']&&require(_0xe585('0x16'))[_0xe585('0x17')]();require('./config/license')[_0xe585('0x17')]();})[_0xe585('0x18')](function(_0x1bc3df){logger[_0xe585('0x19')](_0xe585('0x1a'),_0x1bc3df);process[_0xe585('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x27fb=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','status','join','seedDB','./config/seedDB','default','./config/license','catch'];(function(_0x2e4c3f,_0x5a8619){var _0x23f310=function(_0x21583b){while(--_0x21583b){_0x2e4c3f['push'](_0x2e4c3f['shift']());}};_0x23f310(++_0x5a8619);}(_0x27fb,0x1de));var _0xb27f=function(_0xaa344e,_0x1928a1){_0xaa344e=_0xaa344e-0x0;var _0x5dfd27=_0x27fb[_0xaa344e];return _0x5dfd27;};'use strict';var _=require(_0xb27f('0x0'));var mysqldb=require(_0xb27f('0x1'));var rpc=require(_0xb27f('0x2'));var config=require('./config/environment');var logger=require(_0xb27f('0x3'))('app');var pm2=require(_0xb27f('0x4'));var pm2Config=require(_0xb27f('0x5'));var schedule=require(_0xb27f('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xb27f('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xb27f('0x8')][_0xb27f('0x9')]()[_0xb27f('0xa')](function(){return rpc[_0xb27f('0xb')]();})[_0xb27f('0xa')](function(_0x4da129){logger[_0xb27f('0xc')](_0x4da129);return chat[_0xb27f('0xd')]();})['then'](function(){return whatsapp[_0xb27f('0xd')]();})[_0xb27f('0xa')](function(){return schedule[_0xb27f('0xd')]();})[_0xb27f('0xa')](function(){return transcribe['start']();})[_0xb27f('0xa')](function(_0x300422){logger['info'](_0x300422);return pm2[_0xb27f('0xd')](pm2Config);})[_0xb27f('0xa')](function(_0x5e5453){logger[_0xb27f('0xc')](_0xb27f('0xe'),_[_0xb27f('0xf')](_[_0xb27f('0x10')](_0x5e5453,{'status':_0xb27f('0x11')}),_0xb27f('0x12'))['join']());logger[_0xb27f('0xc')]('Offline\x20apps:',_[_0xb27f('0xf')](_['filter'](_0x5e5453,function(_0x35cb70){return _0x35cb70[_0xb27f('0x13')]!==_0xb27f('0x11');}),_0xb27f('0x12'))[_0xb27f('0x14')]()||'None');config[_0xb27f('0x15')]&&require(_0xb27f('0x16'))[_0xb27f('0x17')]();require(_0xb27f('0x18'))[_0xb27f('0x17')]();})[_0xb27f('0x19')](function(_0x428a86){logger['error'](_0xb27f('0x1a'),_0x428a86);process[_0xb27f('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index bac00c6..8696bff 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 _0xd095=['moment','secrets','session','role','fullname','name','internal','email','permissions','md5secret','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','authenticate','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','Setting','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blockedAt','canUpdate','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','promisify','secret','payload','options','randomBytes','toString','hex','floor','apiKeyIat','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xd095,0x1b5));var _0x5d09=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xd095[_0x346737];return _0x1ade2e;};'use strict';var db=require(_0x5d09('0x0'))['db'];var config=require(_0x5d09('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5d09('0x2'));var encryptor=require(_0x5d09('0x3'));var _=require('lodash');var jwt=require(_0x5d09('0x4'));var expressJwt=require(_0x5d09('0x5'));var compose=require(_0x5d09('0x6'));var basicAuth=require(_0x5d09('0x7'));var crypto=require(_0x5d09('0x8'));var BPromise=require(_0x5d09('0x9'));var util=require(_0x5d09('0xa'));var moment=require(_0x5d09('0xb'));var validateJwt=expressJwt({'secret':config[_0x5d09('0xc')][_0x5d09('0xd')]});var userAttributes=['id',_0x5d09('0xe'),_0x5d09('0xf'),_0x5d09('0x10'),_0x5d09('0x11'),_0x5d09('0x12'),'userpic',_0x5d09('0x13'),_0x5d09('0x14'),'voicePause',_0x5d09('0x15'),'mailPause',_0x5d09('0x16'),'smsPause',_0x5d09('0x17'),_0x5d09('0x18'),_0x5d09('0x19'),_0x5d09('0x1a'),_0x5d09('0x1b'),_0x5d09('0x1c'),_0x5d09('0x1d'),'passwordResetAt',_0x5d09('0x1e'),'phoneBarAutoAnswer',_0x5d09('0x1f'),'phoneBarDnd','phoneBarEnableRecording',_0x5d09('0x20'),'phoneBarEnableSettings',_0x5d09('0x21'),_0x5d09('0x22'),_0x5d09('0x23'),_0x5d09('0x24'),_0x5d09('0x25'),_0x5d09('0x26'),_0x5d09('0x27'),_0x5d09('0x28')];exports[_0x5d09('0x29')]=function(){return this[_0x5d09('0x2a')](!![])[_0x5d09('0x2b')](function(_0x3965d8,_0x559c4f,_0xb8cb4b){if(_0x3965d8[_0x5d09('0x2c')]){_0xb8cb4b();}else{return db['ChatInteraction'][_0x5d09('0x2d')]({'where':{'id':_0x3965d8[_0x5d09('0x2e')]['id']},'attributes':['id',_0x5d09('0x2f'),_0x5d09('0x30')],'raw':!![]})[_0x5d09('0x31')](function(_0x3f276a){if(_0x3f276a&&_0x3f276a['closed']){return _0x559c4f[_0x5d09('0x32')](_0x3f276a['disposition']===_0x5d09('0x33')?0x195:0x193)[_0x5d09('0x34')]({'message':_0x3f276a[_0x5d09('0x30')]==='unmanaged'?_0x5d09('0x35'):'Forbidden.'});}else{_0xb8cb4b();}})[_0x5d09('0x36')](function(_0x531e54){_0xb8cb4b(_0x531e54);});}});};exports[_0x5d09('0x2a')]=function isAuthenticated(_0xc28318){return compose()[_0x5d09('0x2b')](function(_0x4361dd,_0x3c9c3b,_0x2e4446){var _0x2f6a0e;if(_0x4361dd[_0x5d09('0x37')][_0x5d09('0x38')]){if(_['startsWith'](_0x4361dd[_0x5d09('0x37')][_0x5d09('0x38')],'Basic')){var _0x411f7f=basicAuth(_0x4361dd);db['User']['find']({'where':{'name':_0x411f7f[_0x5d09('0x10')]}})['then'](function(_0x49c1d4){if(!_0x49c1d4||!_0x49c1d4[_0x5d09('0x39')](_0x411f7f['pass'])){return _0x3c9c3b[_0x5d09('0x32')](0x191)['json']({'message':_0x5d09('0x3a')});}_0x4361dd['user']={'id':_0x49c1d4['id']};_0x2e4446();})[_0x5d09('0x36')](function(_0x2a9bcb){_0x2e4446(_0x2a9bcb);});}else if(_[_0x5d09('0x3b')](_0x4361dd[_0x5d09('0x37')][_0x5d09('0x38')],_0x5d09('0x3c'))){validateJwt(_0x4361dd,_0x3c9c3b,_0x2e4446);}else{if(_0xc28318){_0x2e4446();}else{return _0x3c9c3b['status'](0x193)['json']({'message':_0x5d09('0x3d')});}}}else if(_0x4361dd[_0x5d09('0x3e')][_0x5d09('0x3f')]){try{var _0x39c1ba={'audience':hardwareConf[_0x5d09('0x40')](),'issuer':hardwareConf[_0x5d09('0x40')]()};verifyJwt(_0x4361dd['query'][_0x5d09('0x3f')],_0x39c1ba)[_0x5d09('0x31')](function(_0x423167){return db[_0x5d09('0x41')][_0x5d09('0x42')]({'where':{'id':_0x423167['sub']}})[_0x5d09('0x31')](function(_0x46c453){_0x2f6a0e=_0x46c453;return db[_0x5d09('0x43')][_0x5d09('0x2d')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})['then'](function(_0x360ee7){if(!_0x2f6a0e||!_[_0x5d09('0x44')](_0x2f6a0e[_0x5d09('0x45')],_0x423167[_0x5d09('0x46')])){return _0x3c9c3b[_0x5d09('0x32')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2f6a0e[_0x5d09('0x47')]){return _0x3c9c3b[_0x5d09('0x32')](0x191)[_0x5d09('0x34')]({'message':_0x5d09('0x48')});}if(_0x2f6a0e['blocked']){if(_0x360ee7['blockDuration']>0x0){if(moment(_0x2f6a0e[_0x5d09('0x49')])['add'](_0x360ee7['blockDuration'],'minutes')>moment()){return _0x3c9c3b[_0x5d09('0x32')](0x191)['json']({'message':_0x5d09('0x48')});}}else{return _0x3c9c3b[_0x5d09('0x32')](0x191)[_0x5d09('0x34')]({'message':_0x5d09('0x48')});}}_0x4361dd[_0x5d09('0x2c')]={'id':_0x2f6a0e['id']};_0x2e4446();});})['catch'](function(){return _0x3c9c3b[_0x5d09('0x32')](0x191)[_0x5d09('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x19d1a7){_0x2e4446(_0x19d1a7);}}else if(_0xc28318){_0x2e4446();}else{return _0x3c9c3b['status'](0x193)[_0x5d09('0x34')]({'message':_0x5d09('0x3d')});}})['use'](function(_0x53f25a,_0xe43843,_0x332346){if(_0x53f25a[_0x5d09('0x2c')]){db[_0x5d09('0x41')]['find']({'where':{'id':_0x53f25a['user']['id']},'attributes':userAttributes})[_0x5d09('0x31')](function(_0x4b5172){if(!_0x4b5172){return _0xe43843[_0x5d09('0x32')](0x194)[_0x5d09('0x34')]({'message':'User\x20not\x20found.'});}_0x53f25a[_0x5d09('0x2c')]=_0x4b5172;_0x332346();})[_0x5d09('0x36')](function(_0x129f89){_0x332346(_0x129f89);});}else if(_0xc28318){_0x332346();}else{return _0xe43843[_0x5d09('0x32')](0x194)[_0x5d09('0x34')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5d09('0x4a')]=function canUpdate(){return compose()['use'](function(_0x5479d7,_0x256f05,_0x12918e){return licenseUtil['getLicense']()['then'](function(_0x11bd2c){if(_0x11bd2c[_0x5d09('0x4b')]){_0x12918e();}else{return _0x256f05[_0x5d09('0x32')](0x193)[_0x5d09('0x34')]({'message':_0x5d09('0x4c')});}})[_0x5d09('0x36')](function(_0x2eb4b6){_0x12918e(_0x2eb4b6);});});};exports[_0x5d09('0x4d')]=function(_0x2ddb9a,_0x4744ef,_0x3ffb3c){_0x2ddb9a[_0x5d09('0x4d')]=!![];return _0x3ffb3c();};exports[_0x5d09('0x4e')]=function signToken(_0x1ebba1){return signJwt(_0x1ebba1);};exports['setTokenCookie']=function(_0x425916,_0x3156e3){if(!_0x425916[_0x5d09('0x2c')]){return _0x3156e3['status'](0x194)[_0x5d09('0x34')]({'message':_0x5d09('0x4f')});}var _0x512642={'payload':{'id':_0x425916[_0x5d09('0x2c')]['id'],'role':_0x425916[_0x5d09('0x2c')][_0x5d09('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x512642)[_0x5d09('0x31')](function(_0x4d92af){_0x3156e3[_0x5d09('0x50')](_0x5d09('0x51'),_0x4d92af);_0x3156e3[_0x5d09('0x52')](_0x5d09('0x53'));})['catch'](function(_0x2c5ac9){return _0x3156e3[_0x5d09('0x32')](0x1f4)[_0x5d09('0x54')](_0x2c5ac9);});};exports[_0x5d09('0x55')]=function(_0x10587a){if(_[_0x5d09('0x56')](_0x10587a[_0x5d09('0x45')])||_[_0x5d09('0x56')](_0x10587a['apiKeyIat'])){return null;}else{return createJwt(_0x10587a);}};exports[_0x5d09('0x57')]=function(_0x2334f2){_0x2334f2[_0x5d09('0x45')]=generateNonce();_0x2334f2['apiKeyIat']=generateIssuedAt();return createJwt(_0x2334f2);};exports[_0x5d09('0x58')]=function(_0x57984e,_0x2f2db9){var _0x6486f0=_0x57984e[_0x5d09('0x3e')][_0x5d09('0x3f')];if(_0x6486f0){var _0x4592ba={'nonce':_0x2f2db9[_0x5d09('0x45')],'iat':_0x2f2db9['apiKeyIat'],'audience':hardwareConf[_0x5d09('0x40')](),'issuer':hardwareConf[_0x5d09('0x40')]()};return verifyJwt(_0x6486f0,_0x4592ba)['then'](function(){return generateApiKey(_0x2f2db9);});}else{throw{'message':_0x5d09('0x59')};}};exports[_0x5d09('0x5a')]=function(_0x1cf974){var _0x2d8a35=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2d8a35[_0x5d09('0x5b')](_0x1cf974))throw new db['Sequelize'][(_0x5d09('0x5c'))](_0x5d09('0x5d'));return;};exports[_0x5d09('0x5e')]=function(_0x277a14,_0x3a9bbe,_0x5df985){var _0x29514b=encryptor[_0x5d09('0x5f')](_0x3a9bbe)[_0x5d09('0x60')](',');for(var _0x211475=0x0;_0x211475<_0x5df985;_0x211475++){if(!_0x29514b[_0x211475])break;if(_0x277a14['toLowerCase']()===_0x29514b[_0x211475][_0x5d09('0x61')]()){var _0x5d522b=util[_0x5d09('0x62')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5df985);if(_0x5df985===0x1){_0x5d522b=_0x5d09('0x63');}throw new db['Sequelize'][(_0x5d09('0x5c'))](_0x5d522b);}}return;};exports[_0x5d09('0x64')]=function(_0x56c31c,_0x561541){var _0x485f2b=_0x561541?encryptor[_0x5d09('0x5f')](_0x561541)[_0x5d09('0x60')](','):[];if(_0x485f2b[_0x5d09('0x65')]===0x5){_0x485f2b[_0x5d09('0x66')](-0x1,0x1);}_0x485f2b['unshift'](_0x56c31c);return encryptor['encryptString'](_0x485f2b['join'](','));};function signJwt(_0x43c773){var _0x1dc282=BPromise[_0x5d09('0x67')](jwt['sign'],{'context':jwt});var _0x33380c=_0x43c773[_0x5d09('0x68')]||config[_0x5d09('0xc')][_0x5d09('0xd')];return new BPromise(function(_0x854a73,_0x416868){_0x1dc282(_0x43c773[_0x5d09('0x69')],_0x33380c,_0x43c773[_0x5d09('0x6a')])[_0x5d09('0x31')](function(_0x3ab587){_0x854a73(_0x3ab587);})[_0x5d09('0x36')](function(_0x309200){_0x416868(_0x309200);});});}function verifyJwt(_0x55d15f,_0x1d756d,_0x21ef7d){var _0x39acd1=BPromise[_0x5d09('0x67')](jwt['verify'],{'context':jwt});var _0x4d0f4d=_0x21ef7d||config[_0x5d09('0xc')][_0x5d09('0xd')];return new BPromise(function(_0x126630,_0xa6aede){_0x39acd1(_0x55d15f,_0x4d0f4d,_0x1d756d)[_0x5d09('0x31')](function(_0x36f419){_0x126630(_0x36f419);})['catch'](function(_0x2f761f){_0xa6aede(_0x2f761f);});});}function generateNonce(){return crypto[_0x5d09('0x6b')](0x10)[_0x5d09('0x6c')](_0x5d09('0x6d'));}function generateIssuedAt(){return Math[_0x5d09('0x6e')](Date['now']()/0x3e8)[_0x5d09('0x6c')]();}function createJwt(_0xffe04d){var _0x26c81a={'payload':{'iat':_0xffe04d[_0x5d09('0x6f')],'nonce':_0xffe04d[_0x5d09('0x45')]},'options':{'algorithm':'HS512','subject':_0xffe04d['id']['toString'](),'issuer':hardwareConf[_0x5d09('0x40')](),'audience':hardwareConf[_0x5d09('0x40')]()}};return signJwt(_0x26c81a)[_0x5d09('0x31')](function(_0x3517ae){return{'iat':_0xffe04d[_0x5d09('0x6f')],'nonce':_0xffe04d[_0x5d09('0x45')],'token':_0x3517ae};});} \ No newline at end of file +var _0x46d5=['now','HS512','toString','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','find','pass','json','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','user','User\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','signToken','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','encryptString','join','promisify','secrets','payload','verify','randomBytes','hex','floor'];(function(_0x564db2,_0xeab590){var _0x506c6b=function(_0x4c60dc){while(--_0x4c60dc){_0x564db2['push'](_0x564db2['shift']());}};_0x506c6b(++_0xeab590);}(_0x46d5,0x168));var _0x546d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x46d5[_0x4b369d];return _0x571a98;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x546d('0x0'));var hardwareConf=require(_0x546d('0x1'));var licenseUtil=require(_0x546d('0x2'));var encryptor=require(_0x546d('0x3'));var _=require('lodash');var jwt=require(_0x546d('0x4'));var expressJwt=require(_0x546d('0x5'));var compose=require(_0x546d('0x6'));var basicAuth=require(_0x546d('0x7'));var crypto=require(_0x546d('0x8'));var BPromise=require(_0x546d('0x9'));var util=require('util');var moment=require(_0x546d('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0x546d('0xb')]});var userAttributes=['id',_0x546d('0xc'),_0x546d('0xd'),_0x546d('0xe'),_0x546d('0xf'),_0x546d('0x10'),_0x546d('0x11'),_0x546d('0x12'),_0x546d('0x13'),_0x546d('0x14'),'chatPause','mailPause',_0x546d('0x15'),_0x546d('0x16'),_0x546d('0x17'),_0x546d('0x18'),'showWebBar',_0x546d('0x19'),'lastPauseAt','crudPermissions',_0x546d('0x1a'),_0x546d('0x1b'),_0x546d('0x1c'),_0x546d('0x1d'),_0x546d('0x1e'),'phoneBarDnd',_0x546d('0x1f'),_0x546d('0x20'),_0x546d('0x21'),_0x546d('0x22'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x546d('0x23'),_0x546d('0x24'),'interface',_0x546d('0x25'),_0x546d('0x26')];exports[_0x546d('0x27')]=function(){return this[_0x546d('0x28')](!![])[_0x546d('0x29')](function(_0x2c36f8,_0x41d0d7,_0x50527b){if(_0x2c36f8['user']){_0x50527b();}else{return db[_0x546d('0x2a')][_0x546d('0x2b')]({'where':{'id':_0x2c36f8[_0x546d('0x2c')]['id']},'attributes':['id',_0x546d('0x2d'),_0x546d('0x2e')],'raw':!![]})[_0x546d('0x2f')](function(_0x1718eb){if(_0x1718eb&&_0x1718eb[_0x546d('0x2d')]){return _0x41d0d7[_0x546d('0x30')](_0x1718eb[_0x546d('0x2e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x1718eb[_0x546d('0x2e')]===_0x546d('0x31')?_0x546d('0x32'):'Forbidden.'});}else{_0x50527b();}})[_0x546d('0x33')](function(_0x41c1c6){_0x50527b(_0x41c1c6);});}});};exports['isAuthenticated']=function isAuthenticated(_0x272ab2){return compose()['use'](function(_0x42bb95,_0x3d3fb0,_0x46b99c){var _0x1fccdc;if(_0x42bb95[_0x546d('0x34')][_0x546d('0x35')]){if(_[_0x546d('0x36')](_0x42bb95[_0x546d('0x34')]['authorization'],_0x546d('0x37'))){var _0x118be6=basicAuth(_0x42bb95);db[_0x546d('0x38')][_0x546d('0x39')]({'where':{'name':_0x118be6[_0x546d('0xe')]}})['then'](function(_0x19a0e7){if(!_0x19a0e7||!_0x19a0e7['authenticate'](_0x118be6[_0x546d('0x3a')])){return _0x3d3fb0[_0x546d('0x30')](0x191)[_0x546d('0x3b')]({'message':'Wrong\x20credentials.'});}_0x42bb95['user']={'id':_0x19a0e7['id']};_0x46b99c();})[_0x546d('0x33')](function(_0xb0f666){_0x46b99c(_0xb0f666);});}else if(_['startsWith'](_0x42bb95[_0x546d('0x34')][_0x546d('0x35')],_0x546d('0x3c'))){validateJwt(_0x42bb95,_0x3d3fb0,_0x46b99c);}else{if(_0x272ab2){_0x46b99c();}else{return _0x3d3fb0[_0x546d('0x30')](0x193)[_0x546d('0x3b')]({'message':_0x546d('0x3d')});}}}else if(_0x42bb95[_0x546d('0x3e')]['apikey']){try{var _0xcbe0b1={'audience':hardwareConf[_0x546d('0x3f')](),'issuer':hardwareConf[_0x546d('0x3f')]()};verifyJwt(_0x42bb95[_0x546d('0x3e')][_0x546d('0x40')],_0xcbe0b1)[_0x546d('0x2f')](function(_0xa5597b){return db['User'][_0x546d('0x39')]({'where':{'id':_0xa5597b[_0x546d('0x41')]}})[_0x546d('0x2f')](function(_0xdbbdf3){_0x1fccdc=_0xdbbdf3;return db[_0x546d('0x42')][_0x546d('0x2b')]({'where':{'id':0x1},'attributes':[_0x546d('0x43'),_0x546d('0x44')],'raw':!![]});})[_0x546d('0x2f')](function(_0x1c6e5e){if(!_0x1fccdc||!_[_0x546d('0x45')](_0x1fccdc[_0x546d('0x46')],_0xa5597b[_0x546d('0x47')])){return _0x3d3fb0[_0x546d('0x30')](0x191)[_0x546d('0x3b')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1fccdc['disabled']){return _0x3d3fb0['status'](0x191)[_0x546d('0x3b')]({'message':_0x546d('0x48')});}if(_0x1fccdc[_0x546d('0x49')]){if(_0x1c6e5e['blockDuration']>0x0){if(moment(_0x1fccdc[_0x546d('0x4a')])[_0x546d('0x4b')](_0x1c6e5e[_0x546d('0x44')],'minutes')>moment()){return _0x3d3fb0[_0x546d('0x30')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3d3fb0['status'](0x191)[_0x546d('0x3b')]({'message':_0x546d('0x48')});}}_0x42bb95[_0x546d('0x4c')]={'id':_0x1fccdc['id']};_0x46b99c();});})['catch'](function(){return _0x3d3fb0[_0x546d('0x30')](0x191)[_0x546d('0x3b')]({'message':_0x546d('0x48')});});}catch(_0xfe956b){_0x46b99c(_0xfe956b);}}else if(_0x272ab2){_0x46b99c();}else{return _0x3d3fb0[_0x546d('0x30')](0x193)[_0x546d('0x3b')]({'message':_0x546d('0x3d')});}})[_0x546d('0x29')](function(_0x526bb7,_0x248004,_0x70ed7a){if(_0x526bb7[_0x546d('0x4c')]){db[_0x546d('0x38')]['find']({'where':{'id':_0x526bb7[_0x546d('0x4c')]['id']},'attributes':userAttributes})[_0x546d('0x2f')](function(_0x309adf){if(!_0x309adf){return _0x248004['status'](0x194)[_0x546d('0x3b')]({'message':_0x546d('0x4d')});}_0x526bb7[_0x546d('0x4c')]=_0x309adf;_0x70ed7a();})[_0x546d('0x33')](function(_0xd6adb3){_0x70ed7a(_0xd6adb3);});}else if(_0x272ab2){_0x70ed7a();}else{return _0x248004[_0x546d('0x30')](0x194)[_0x546d('0x3b')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x546d('0x4e')]=function canUpdate(){return compose()[_0x546d('0x29')](function(_0x56f473,_0x58e0ae,_0x5e5e5a){return licenseUtil[_0x546d('0x4f')]()[_0x546d('0x2f')](function(_0x2cd329){if(_0x2cd329[_0x546d('0x50')]){_0x5e5e5a();}else{return _0x58e0ae[_0x546d('0x30')](0x193)[_0x546d('0x3b')]({'message':'Forbidden'});}})[_0x546d('0x33')](function(_0x491a20){_0x5e5e5a(_0x491a20);});});};exports[_0x546d('0x51')]=function(_0x3caebc,_0x1edf8a,_0x59ef89){_0x3caebc[_0x546d('0x51')]=!![];return _0x59ef89();};exports[_0x546d('0x52')]=function signToken(_0xffe99d){return signJwt(_0xffe99d);};exports['setTokenCookie']=function(_0x1f8913,_0x2cbd20){if(!_0x1f8913[_0x546d('0x4c')]){return _0x2cbd20['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4ae6a2={'payload':{'id':_0x1f8913['user']['id'],'role':_0x1f8913['user'][_0x546d('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4ae6a2)['then'](function(_0x351a00){_0x2cbd20[_0x546d('0x53')](_0x546d('0x54'),_0x351a00);_0x2cbd20[_0x546d('0x55')](_0x546d('0x56'));})[_0x546d('0x33')](function(_0x382458){return _0x2cbd20[_0x546d('0x30')](0x1f4)['send'](_0x382458);});};exports[_0x546d('0x57')]=function(_0x4825e0){if(_[_0x546d('0x58')](_0x4825e0[_0x546d('0x46')])||_[_0x546d('0x58')](_0x4825e0[_0x546d('0x59')])){return null;}else{return createJwt(_0x4825e0);}};exports[_0x546d('0x5a')]=function(_0x1e56e1){_0x1e56e1[_0x546d('0x46')]=generateNonce();_0x1e56e1[_0x546d('0x59')]=generateIssuedAt();return createJwt(_0x1e56e1);};exports[_0x546d('0x5b')]=function(_0x347981,_0x231541){var _0x2bddd2=_0x347981[_0x546d('0x3e')][_0x546d('0x40')];if(_0x2bddd2){var _0x388d48={'nonce':_0x231541[_0x546d('0x46')],'iat':_0x231541[_0x546d('0x59')],'audience':hardwareConf[_0x546d('0x3f')](),'issuer':hardwareConf[_0x546d('0x3f')]()};return verifyJwt(_0x2bddd2,_0x388d48)[_0x546d('0x2f')](function(){return generateApiKey(_0x231541);});}else{throw{'message':_0x546d('0x5c')};}};exports[_0x546d('0x5d')]=function(_0x34827e){var _0x5005ae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5005ae[_0x546d('0x5e')](_0x34827e))throw new db['Sequelize'][(_0x546d('0x5f'))](_0x546d('0x60'));return;};exports[_0x546d('0x61')]=function(_0xd150fc,_0x55a5be,_0x78df1a){var _0x354efa=encryptor[_0x546d('0x62')](_0x55a5be)[_0x546d('0x63')](',');for(var _0x3555e0=0x0;_0x3555e0<_0x78df1a;_0x3555e0++){if(!_0x354efa[_0x3555e0])break;if(_0xd150fc[_0x546d('0x64')]()===_0x354efa[_0x3555e0]['toLowerCase']()){var _0x486612=util[_0x546d('0x65')](_0x546d('0x66'),_0x78df1a);if(_0x78df1a===0x1){_0x486612='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x546d('0x67'))]['ValidationError'](_0x486612);}}return;};exports[_0x546d('0x68')]=function(_0xc0e4c7,_0x5b0d9d){var _0x9b1fcf=_0x5b0d9d?encryptor['decryptString'](_0x5b0d9d)['split'](','):[];if(_0x9b1fcf[_0x546d('0x69')]===0x5){_0x9b1fcf[_0x546d('0x6a')](-0x1,0x1);}_0x9b1fcf['unshift'](_0xc0e4c7);return encryptor[_0x546d('0x6b')](_0x9b1fcf[_0x546d('0x6c')](','));};function signJwt(_0x5811bd){var _0xaed96c=BPromise[_0x546d('0x6d')](jwt['sign'],{'context':jwt});var _0x2232c7=_0x5811bd['secret']||config[_0x546d('0x6e')]['session'];return new BPromise(function(_0x593635,_0x48e506){_0xaed96c(_0x5811bd[_0x546d('0x6f')],_0x2232c7,_0x5811bd['options'])['then'](function(_0x39c325){_0x593635(_0x39c325);})[_0x546d('0x33')](function(_0x30475b){_0x48e506(_0x30475b);});});}function verifyJwt(_0x26717b,_0x4068f4,_0x199622){var _0x56fd5d=BPromise['promisify'](jwt[_0x546d('0x70')],{'context':jwt});var _0x4bcf0d=_0x199622||config[_0x546d('0x6e')][_0x546d('0xb')];return new BPromise(function(_0x54b081,_0x9f333e){_0x56fd5d(_0x26717b,_0x4bcf0d,_0x4068f4)[_0x546d('0x2f')](function(_0x3d4e80){_0x54b081(_0x3d4e80);})[_0x546d('0x33')](function(_0x2d8498){_0x9f333e(_0x2d8498);});});}function generateNonce(){return crypto[_0x546d('0x71')](0x10)['toString'](_0x546d('0x72'));}function generateIssuedAt(){return Math[_0x546d('0x73')](Date[_0x546d('0x74')]()/0x3e8)['toString']();}function createJwt(_0x4301e6){var _0x2c8757={'payload':{'iat':_0x4301e6[_0x546d('0x59')],'nonce':_0x4301e6[_0x546d('0x46')]},'options':{'algorithm':_0x546d('0x75'),'subject':_0x4301e6['id'][_0x546d('0x76')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2c8757)[_0x546d('0x2f')](function(_0x1134cc){return{'iat':_0x4301e6[_0x546d('0x59')],'nonce':_0x4301e6[_0x546d('0x46')],'token':_0x1134cc};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 637781e..7132015 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 _0x44e8=['data','update','write','end','final','binary','close','unlink','decryptFile','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm'];(function(_0x35d291,_0x1a131b){var _0x370b86=function(_0x52fa2a){while(--_0x52fa2a){_0x35d291['push'](_0x35d291['shift']());}};_0x370b86(++_0x1a131b);}(_0x44e8,0xd7));var _0x844e=function(_0x3bc631,_0x1b6725){_0x3bc631=_0x3bc631-0x0;var _0x4a8b23=_0x44e8[_0x3bc631];return _0x4a8b23;};'use strict';var crypto=require(_0x844e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config[_0x844e('0x1')][_0x844e('0x2')],'algorithm':_0x844e('0x3')};const fileOptions={'algorithm':_0x844e('0x4')};function combineOptions(_0x49ce1b){var _0x3a8b3c={};for(var _0x167368 in fileOptions){if(fileOptions[_0x844e('0x5')](_0x167368)){_0x3a8b3c[_0x167368]=fileOptions[_0x167368];}}if(_0x49ce1b){for(var _0x446f47 in _0x49ce1b){if(_0x49ce1b['hasOwnProperty'](_0x446f47)){_0x3a8b3c[_0x446f47]=_0x49ce1b[_0x446f47];}}}return _0x3a8b3c;}exports[_0x844e('0x6')]=function(_0x238796,_0x1706b3,_0x11cbd6,_0x571b91){return new BPromise(function(_0x31ab50,_0x7dff16){_0x571b91=combineOptions(_0x571b91);var _0x336881=new Buffer(_0x11cbd6);var _0x134672=fs[_0x844e('0x7')](_0x238796);var _0x1f9921=fs['createWriteStream'](_0x1706b3);var _0x39ef28=crypto[_0x844e('0x8')](_0x571b91[_0x844e('0x9')],_0x336881);_0x134672['on'](_0x844e('0xa'),function(_0x14909f){var _0x37b2a3=new Buffer(_0x39ef28[_0x844e('0xb')](_0x14909f),'binary');_0x1f9921[_0x844e('0xc')](_0x37b2a3);});_0x134672['on'](_0x844e('0xd'),function(){try{var _0x52ac76=new Buffer(_0x39ef28[_0x844e('0xe')](_0x844e('0xf')),'binary');_0x1f9921[_0x844e('0xc')](_0x52ac76);_0x1f9921[_0x844e('0xd')]();_0x1f9921['on'](_0x844e('0x10'),function(){return _0x31ab50(_0x1706b3);});}catch(_0x4ed3a4){fs[_0x844e('0x11')](_0x1706b3);return _0x7dff16(_0x4ed3a4);}});});};exports[_0x844e('0x12')]=function(_0x380eb4,_0x935134,_0x2588a3,_0x353be9){return new BPromise(function(_0x2227c6,_0x5506ef){_0x353be9=combineOptions(_0x353be9);var _0x4f14e9=new Buffer(_0x2588a3);var _0x36286c=fs['createReadStream'](_0x380eb4);var _0x3c307f=fs['createWriteStream'](_0x935134);var _0x315c50=crypto['createDecipher'](_0x353be9[_0x844e('0x9')],_0x4f14e9);_0x36286c['on'](_0x844e('0xa'),function(_0x2d6ba8){var _0x410325=new Buffer(_0x315c50[_0x844e('0xb')](_0x2d6ba8),_0x844e('0xf'));_0x3c307f[_0x844e('0xc')](_0x410325);});_0x36286c['on'](_0x844e('0xd'),function(){try{var _0x4ffb86=new Buffer(_0x315c50[_0x844e('0xe')]('binary'),'binary');_0x3c307f[_0x844e('0xc')](_0x4ffb86);_0x3c307f[_0x844e('0xd')]();_0x3c307f['on'](_0x844e('0x10'),function(){return _0x2227c6(_0x935134);});}catch(_0x286fdd){fs['unlink'](_0x935134);return _0x5506ef(_0x286fdd);}});});};exports[_0x844e('0x13')]=function(_0x3dde07,_0x571498,_0x2520f8){var _0x13489b=_0x2520f8||stringOptions[_0x844e('0x9')];var _0xdba48d=_0x571498||stringOptions[_0x844e('0x14')];var _0x3a65fc=crypto['createCipher'](_0x13489b,_0xdba48d);var _0x399a81=_0x3a65fc[_0x844e('0xb')](_0x3dde07,_0x844e('0x15'),_0x844e('0x16'));_0x399a81+=_0x3a65fc[_0x844e('0xe')]('base64');return _0x399a81;};exports[_0x844e('0x17')]=function(_0x5080c1,_0x57b2ef,_0x431a9c){var _0x130d87=_0x431a9c||stringOptions[_0x844e('0x9')];var _0x587613=_0x57b2ef||stringOptions[_0x844e('0x14')];var _0x2d4acd=crypto[_0x844e('0x18')](_0x130d87,_0x587613);var _0x54fd73=_0x2d4acd[_0x844e('0xb')](_0x5080c1,_0x844e('0x16'),_0x844e('0x15'));_0x54fd73+=_0x2d4acd[_0x844e('0xe')](_0x844e('0x15'));return _0x54fd73;}; \ No newline at end of file +var _0xafb9=['encryptString','secret','utf8','base64','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','aes192','encryptFile','createReadStream','createWriteStream','algorithm','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher'];(function(_0x3b2338,_0xeda656){var _0x1b6703=function(_0x4f90c5){while(--_0x4f90c5){_0x3b2338['push'](_0x3b2338['shift']());}};_0x1b6703(++_0xeda656);}(_0xafb9,0x68));var _0x9afb=function(_0x2eb288,_0x13d09b){_0x2eb288=_0x2eb288-0x0;var _0x2f3906=_0xafb9[_0x2eb288];return _0x2f3906;};'use strict';var crypto=require(_0x9afb('0x0'));var fs=require('fs');var BPromise=require(_0x9afb('0x1'));var config=require(_0x9afb('0x2'));const stringOptions={'secret':config[_0x9afb('0x3')][_0x9afb('0x4')],'algorithm':_0x9afb('0x5')};const fileOptions={'algorithm':_0x9afb('0x6')};function combineOptions(_0x44892f){var _0xdaf0c6={};for(var _0x4e983d in fileOptions){if(fileOptions['hasOwnProperty'](_0x4e983d)){_0xdaf0c6[_0x4e983d]=fileOptions[_0x4e983d];}}if(_0x44892f){for(var _0x91ffa0 in _0x44892f){if(_0x44892f['hasOwnProperty'](_0x91ffa0)){_0xdaf0c6[_0x91ffa0]=_0x44892f[_0x91ffa0];}}}return _0xdaf0c6;}exports[_0x9afb('0x7')]=function(_0x548b24,_0x556880,_0x4c0e9d,_0x1edf77){return new BPromise(function(_0x20b8c1,_0x51dc88){_0x1edf77=combineOptions(_0x1edf77);var _0x3ef362=new Buffer(_0x4c0e9d);var _0x3e0264=fs[_0x9afb('0x8')](_0x548b24);var _0x27fa71=fs[_0x9afb('0x9')](_0x556880);var _0x56f477=crypto['createCipher'](_0x1edf77[_0x9afb('0xa')],_0x3ef362);_0x3e0264['on'](_0x9afb('0xb'),function(_0x3e6a29){var _0x31b574=new Buffer(_0x56f477[_0x9afb('0xc')](_0x3e6a29),_0x9afb('0xd'));_0x27fa71[_0x9afb('0xe')](_0x31b574);});_0x3e0264['on'](_0x9afb('0xf'),function(){try{var _0x464462=new Buffer(_0x56f477[_0x9afb('0x10')]('binary'),_0x9afb('0xd'));_0x27fa71['write'](_0x464462);_0x27fa71['end']();_0x27fa71['on'](_0x9afb('0x11'),function(){return _0x20b8c1(_0x556880);});}catch(_0x3e40c1){fs[_0x9afb('0x12')](_0x556880);return _0x51dc88(_0x3e40c1);}});});};exports[_0x9afb('0x13')]=function(_0x46b16f,_0x39cdf1,_0xd111f1,_0x4d31e3){return new BPromise(function(_0x18505a,_0x2145c2){_0x4d31e3=combineOptions(_0x4d31e3);var _0x23b906=new Buffer(_0xd111f1);var _0x190cb8=fs[_0x9afb('0x8')](_0x46b16f);var _0x508433=fs[_0x9afb('0x9')](_0x39cdf1);var _0x50a7e4=crypto[_0x9afb('0x14')](_0x4d31e3[_0x9afb('0xa')],_0x23b906);_0x190cb8['on']('data',function(_0x4a1c74){var _0x3ac42f=new Buffer(_0x50a7e4[_0x9afb('0xc')](_0x4a1c74),_0x9afb('0xd'));_0x508433[_0x9afb('0xe')](_0x3ac42f);});_0x190cb8['on'](_0x9afb('0xf'),function(){try{var _0x57b4e2=new Buffer(_0x50a7e4[_0x9afb('0x10')]('binary'),'binary');_0x508433[_0x9afb('0xe')](_0x57b4e2);_0x508433[_0x9afb('0xf')]();_0x508433['on'](_0x9afb('0x11'),function(){return _0x18505a(_0x39cdf1);});}catch(_0x2d3938){fs['unlink'](_0x39cdf1);return _0x2145c2(_0x2d3938);}});});};exports[_0x9afb('0x15')]=function(_0x725a04,_0x49ba5f,_0x571bd9){var _0x5b5dab=_0x571bd9||stringOptions[_0x9afb('0xa')];var _0x4fbe61=_0x49ba5f||stringOptions[_0x9afb('0x16')];var _0x123510=crypto['createCipher'](_0x5b5dab,_0x4fbe61);var _0x324293=_0x123510[_0x9afb('0xc')](_0x725a04,_0x9afb('0x17'),_0x9afb('0x18'));_0x324293+=_0x123510['final'](_0x9afb('0x18'));return _0x324293;};exports['decryptString']=function(_0x29e092,_0x4ad975,_0x5692fa){var _0x1e6100=_0x5692fa||stringOptions[_0x9afb('0xa')];var _0x30af1b=_0x4ad975||stringOptions[_0x9afb('0x16')];var _0x119e04=crypto[_0x9afb('0x14')](_0x1e6100,_0x30af1b);var _0x46673d=_0x119e04['update'](_0x29e092,'base64',_0x9afb('0x17'));_0x46673d+=_0x119e04[_0x9afb('0x10')]('utf8');return _0x46673d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1475095..3593264 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e6=['splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','CSV','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find'];(function(_0x38d7fe,_0x283ce3){var _0x33d4a7=function(_0xc3d4de){while(--_0xc3d4de){_0x38d7fe['push'](_0x38d7fe['shift']());}};_0x33d4a7(++_0x283ce3);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xb4e6[_0x350aeb];return _0x3c5273;};'use strict';var util=require(_0x6b4e('0x0'));var path=require('path');var _=require(_0x6b4e('0x1'));var csv=require(_0x6b4e('0x2'));var fs=require('fs');var BPromise=require(_0x6b4e('0x3'));var zipdir=require(_0x6b4e('0x4'));var rimraf=require(_0x6b4e('0x5'));var db=require(_0x6b4e('0x6'))['db'];var dbH=require(_0x6b4e('0x6'))['dbH'];var logger=require(_0x6b4e('0x7'))(_0x6b4e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6b4e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6b4e('0x9')][0x4];function analyticExtractedReport(_0x570346,_0x4f00be){var _0x2311d9={'status':_0x570346};var _0x48c870={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f00be){_0x2311d9['savename']=_0x4f00be;}return db[_0x6b4e('0xa')][_0x6b4e('0xb')](_0x2311d9,_0x48c870);}function main(){var _0x1e3bf6=0x1388;var _0x39ed74;logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x6b4e('0xf')][_0x6b4e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6b4e('0x11')]})[_0x6b4e('0x12')](function(_0x432399){if(_0x432399){_0x39ed74=_0x432399;_0x1e3bf6=_0x39ed74[_0x6b4e('0x11')]||0x1388;}})[_0x6b4e('0x12')](function(){return dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util['format'](_0x6b4e('0x15'),QUERY),{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]});})['then'](function(_0x355f10){if(!_0x355f10[0x0][_0x6b4e('0x17')]){return analyticExtractedReport(_0x6b4e('0x18'));}var _0x42e265=[];var _0x28c3ba=0x0;var _0x135568=!![];if(_0x355f10&&_0x355f10['length']){var _0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6);if(_0x39ed74[_0x6b4e('0x19')]){for(;_0x135568;_0x28c3ba+=_0x1e3bf6,_0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6)){if(_0x5775f4==0x0||_0x5775f4==_0x355f10[0x0][_0x6b4e('0x17')]){_0x135568=![];}_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util[_0x6b4e('0xd')](_0x6b4e('0x1b'),QUERY,_0x1e3bf6,_0x28c3ba),{'type':dbH[_0x6b4e('0x13')][_0x6b4e('0x1c')]['SELECT']}));}}else{_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](QUERY,{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]}));}}var _0x507703=path[_0x6b4e('0x1d')](PATH);var _0x163dea=path[_0x6b4e('0x1e')](PATH,_0x6b4e('0x1f'));var _0xa06ccd=_0x39ed74[_0x6b4e('0x19')]&&_0x42e265[_0x6b4e('0x20')]>0x1;var _0x5c33be=[];if(!fs[_0x6b4e('0x21')](path['join'](_0x507703,_0x163dea))&&_0xa06ccd){fs[_0x6b4e('0x22')](path[_0x6b4e('0x23')](_0x507703,_0x163dea));}return BPromise[_0x6b4e('0x24')](_0x42e265,function(_0xdba4fe){_0x5c33be['push'](_0xdba4fe);})[_0x6b4e('0x12')](function(){for(var _0x3f72d7=0x0;_0x3f72d7<_0x5c33be['length'];_0x3f72d7+=0x1){var _0x32102f;var _0x381ff0=_0x5c33be[_0x3f72d7];if(_0xa06ccd){_0x32102f=path[_0x6b4e('0x23')](_0x507703,_0x163dea,util[_0x6b4e('0xd')]('%s%d.%s',_0x163dea,_0x3f72d7,_0x6b4e('0x25')));}else{_0x32102f=path[_0x6b4e('0x23')](_0x507703,util['format'](_0x6b4e('0x26'),_0x163dea,_0x6b4e('0x25')));}fs[_0x6b4e('0x27')](_0x32102f,csv(_0x381ff0));}})[_0x6b4e('0x12')](function(){if(_0xa06ccd){zipdir(path['join'](_0x507703,_0x163dea),{'saveTo':path[_0x6b4e('0x23')](_0x507703,util[_0x6b4e('0xd')]('%s.%s',_0x163dea,_0x6b4e('0x28')))},function(_0x3f9868,_0x37b636){});rimraf(path['join'](_0x507703,_0x163dea),function(){});}})['then'](function(){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6b4e('0x2a'),_0xa06ccd?util[_0x6b4e('0xd')](_0x6b4e('0x26'),_0x163dea,_0xa06ccd?'zip':'csv'):null);});})[_0x6b4e('0x2b')](function(_0x4952ef){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6b4e('0x2c')),util[_0x6b4e('0x2d')](_0x4952ef,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6b4e('0x2e'));});}main(); \ No newline at end of file +var _0x22fb=['savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','dirname','basename','.csv','split','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','lodash','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv'];(function(_0x2c4d11,_0xebb391){var _0x5e7a07=function(_0x44af67){while(--_0x44af67){_0x2c4d11['push'](_0x2c4d11['shift']());}};_0x5e7a07(++_0xebb391);}(_0x22fb,0x192));var _0xb22f=function(_0xc81ea9,_0x359ca8){_0xc81ea9=_0xc81ea9-0x0;var _0xce0a44=_0x22fb[_0xc81ea9];return _0xce0a44;};'use strict';var util=require('util');var path=require('path');var _=require(_0xb22f('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb22f('0x1'));var zipdir=require(_0xb22f('0x2'));var rimraf=require(_0xb22f('0x3'));var db=require(_0xb22f('0x4'))['db'];var dbH=require(_0xb22f('0x4'))['dbH'];var logger=require(_0xb22f('0x5'))(_0xb22f('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xb22f('0x7')][0x2]);var QUERY=process[_0xb22f('0x7')][0x3];var PATH=process[_0xb22f('0x7')][0x4];function analyticExtractedReport(_0x367d4b,_0x47f61a){var _0x34433b={'status':_0x367d4b};var _0x22c509={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47f61a){_0x34433b[_0xb22f('0x8')]=_0x47f61a;}return db[_0xb22f('0x9')][_0xb22f('0xa')](_0x34433b,_0x22c509);}function main(){var _0x3593fb=0x1388;var _0x188cea;logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0xd'),EXTRACTED_REPORT_ID,_0xb22f('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb22f('0xf')]})['then'](function(_0x4bb02a){if(_0x4bb02a){_0x188cea=_0x4bb02a;_0x3593fb=_0x188cea['splitSizeCsv']||0x1388;}})[_0xb22f('0x10')](function(){return dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')](_0xb22f('0x13'),QUERY),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]});})['then'](function(_0x36e2a8){if(!_0x36e2a8[0x0]['num']){return analyticExtractedReport(_0xb22f('0x15'));}var _0x514a8f=[];var _0x160417=0x0;var _0xc36af4=!![];if(_0x36e2a8&&_0x36e2a8[_0xb22f('0x16')]){var _0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb);if(_0x188cea['split']){for(;_0xc36af4;_0x160417+=_0x3593fb,_0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb)){if(_0x538da0==0x0||_0x538da0==_0x36e2a8[0x0][_0xb22f('0x17')]){_0xc36af4=![];}_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3593fb,_0x160417),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]}));}}else{_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](QUERY,{'type':dbH[_0xb22f('0x11')]['QueryTypes']['SELECT']}));}}var _0x3da442=path[_0xb22f('0x19')](PATH);var _0xf34e0d=path[_0xb22f('0x1a')](PATH,_0xb22f('0x1b'));var _0xcb9a74=_0x188cea[_0xb22f('0x1c')]&&_0x514a8f[_0xb22f('0x16')]>0x1;var _0x583fbe=[];if(!fs['existsSync'](path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d))&&_0xcb9a74){fs[_0xb22f('0x1e')](path['join'](_0x3da442,_0xf34e0d));}return BPromise[_0xb22f('0x1f')](_0x514a8f,function(_0x4364f5){_0x583fbe['push'](_0x4364f5);})[_0xb22f('0x10')](function(){for(var _0x2918be=0x0;_0x2918be<_0x583fbe['length'];_0x2918be+=0x1){var _0x3e471f;var _0x2c4a9e=_0x583fbe[_0x2918be];if(_0xcb9a74){_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d,util[_0xb22f('0xc')](_0xb22f('0x20'),_0xf34e0d,_0x2918be,_0xb22f('0x21')));}else{_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,'csv'));}fs['writeFileSync'](_0x3e471f,csv(_0x2c4a9e));}})[_0xb22f('0x10')](function(){if(_0xcb9a74){zipdir(path['join'](_0x3da442,_0xf34e0d),{'saveTo':path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')](_0xb22f('0x22'),_0xf34e0d,_0xb22f('0x23')))},function(_0x3bf636,_0x5b2a42){});rimraf(path['join'](_0x3da442,_0xf34e0d),function(){});}})[_0xb22f('0x10')](function(){logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb22f('0x25'),_0xcb9a74?util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,_0xcb9a74?_0xb22f('0x23'):_0xb22f('0x21')):null);});})[_0xb22f('0x26')](function(_0x225194){logger[_0xb22f('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb22f('0xe')),util[_0xb22f('0x27')](_0x225194,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb22f('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8f4af28..fc54d47 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x9c7557,_0xa5044a){var _0x10dc8b=function(_0x1be578){while(--_0x1be578){_0x9c7557['push'](_0x9c7557['shift']());}};_0x10dc8b(++_0xa5044a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','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','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x1c8501,_0x324825){var _0x5cc9ad=function(_0x4b33b4){while(--_0x4b33b4){_0x1c8501['push'](_0x1c8501['shift']());}};_0x5cc9ad(++_0x324825);}(_0x5f2f,0x73));var _0xf5f2=function(_0x289d68,_0x13350d){_0x289d68=_0x289d68-0x0;var _0x2d58c2=_0x5f2f[_0x289d68];return _0x2d58c2;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 918390b..7738470 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 _0x6635=['splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split'];(function(_0x50a2f9,_0x19277a){var _0x3e240d=function(_0x3baf5c){while(--_0x3baf5c){_0x50a2f9['push'](_0x50a2f9['shift']());}};_0x3e240d(++_0x19277a);}(_0x6635,0x10d));var _0x5663=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x6635[_0x87b0ff];return _0x3bc0b2;};'use strict';var util=require('util');var path=require('path');var _=require(_0x5663('0x0'));var fs=require('fs');var json2xls=require(_0x5663('0x1'));var BPromise=require(_0x5663('0x2'));var zipdir=require(_0x5663('0x3'));var rimraf=require(_0x5663('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5663('0x5'))[_0x5663('0x6')];var logger=require(_0x5663('0x7'))(_0x5663('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5663('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x5663('0x9')][0x4];function analyticExtractedReport(_0x5382a2,_0xcaac89){var _0x23fce5={'status':_0x5382a2};var _0x4351dd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xcaac89){_0x23fce5[_0x5663('0xa')]=_0xcaac89;}return db[_0x5663('0xb')][_0x5663('0xc')](_0x23fce5,_0x4351dd);}function main(){var _0x1333a0=0x1388;var _0x434214;logger['info'](util[_0x5663('0xd')](_0x5663('0xe'),EXTRACTED_REPORT_ID,_0x5663('0xf')));return db[_0x5663('0x10')][_0x5663('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5663('0x12'),_0x5663('0x13')]})[_0x5663('0x14')](function(_0x295cf8){if(_0x295cf8){_0x434214=_0x295cf8;_0x1333a0=_0x434214[_0x5663('0x13')]||0x1388;}})[_0x5663('0x14')](function(){return dbH[_0x5663('0x15')][_0x5663('0x16')](util[_0x5663('0xd')](_0x5663('0x17'),QUERY),{'type':dbH[_0x5663('0x15')][_0x5663('0x18')][_0x5663('0x19')]});})['then'](function(_0x2514e0){if(!_0x2514e0[0x0]['num']){return analyticExtractedReport(_0x5663('0x1a'));}var _0x2b8e77=[];var _0x24e888=0x0;var _0xa2fbec=!![];if(_0x434214[_0x5663('0x12')]){if(_0x2514e0&&_0x2514e0['length']){var _0x2c7b70=_0x2514e0[0x0][_0x5663('0x1b')]%(_0x24e888+_0x1333a0);for(;_0xa2fbec;_0x24e888+=_0x1333a0,_0x2c7b70=_0x2514e0[0x0][_0x5663('0x1b')]%(_0x24e888+_0x1333a0)){if(_0x2c7b70==0x0||_0x2c7b70==_0x2514e0[0x0]['num']){_0xa2fbec=![];}_0x2b8e77[_0x5663('0x1c')](dbH[_0x5663('0x15')][_0x5663('0x16')](util['format'](_0x5663('0x1d'),QUERY,_0x1333a0,_0x24e888),{'type':dbH[_0x5663('0x15')][_0x5663('0x18')][_0x5663('0x19')]}));}}}else{_0x2b8e77[_0x5663('0x1c')](dbH[_0x5663('0x15')][_0x5663('0x16')](QUERY,{'type':dbH['sequelize'][_0x5663('0x18')][_0x5663('0x19')]}));}var _0x1d503f=path[_0x5663('0x1e')](PATH);var _0x5772b8=path[_0x5663('0x1f')](PATH,_0x5663('0x20'));var _0xe133dc=_0x434214[_0x5663('0x12')]&&_0x2b8e77[_0x5663('0x21')]>0x1;var _0xabba00=[];if(!fs[_0x5663('0x22')](path[_0x5663('0x23')](_0x1d503f,_0x5772b8))&&_0xe133dc){fs[_0x5663('0x24')](path[_0x5663('0x23')](_0x1d503f,_0x5772b8));}return BPromise[_0x5663('0x25')](_0x2b8e77,function(_0x19f382){_0xabba00['push'](_0x19f382);})[_0x5663('0x14')](function(){for(var _0x29df9e=0x0;_0x29df9e<_0xabba00[_0x5663('0x21')];_0x29df9e+=0x1){var _0x305781;var _0xdbed91=_0xabba00[_0x29df9e];if(_0xe133dc){_0x305781=path[_0x5663('0x23')](_0x1d503f,_0x5772b8,util['format'](_0x5663('0x26'),_0x5772b8,_0x29df9e,_0x5663('0x27')));}else{_0x305781=path[_0x5663('0x23')](_0x1d503f,util[_0x5663('0xd')](_0x5663('0x28'),_0x5772b8,_0x5663('0x27')));}fs['writeFileSync'](_0x305781,json2xls(_0xdbed91),_0x5663('0x29'));}})[_0x5663('0x14')](function(){if(_0xe133dc){zipdir(path[_0x5663('0x23')](_0x1d503f,_0x5772b8),{'saveTo':path['join'](_0x1d503f,util[_0x5663('0xd')]('%s.%s',_0x5772b8,_0x5663('0x2a')))},function(_0x17831e,_0x1d0479){});rimraf(path[_0x5663('0x23')](_0x1d503f,_0x5772b8),function(){});}})['then'](function(){logger['info'](util[_0x5663('0xd')](_0x5663('0x2b'),EXTRACTED_REPORT_ID,_0x5663('0xf')));return analyticExtractedReport(_0x5663('0x2c'),_0xe133dc?util['format'](_0x5663('0x28'),_0x5772b8,_0xe133dc?'zip':_0x5663('0x27')):null);});})[_0x5663('0x2d')](function(_0x43e938){logger[_0x5663('0x2e')](util[_0x5663('0xd')](_0x5663('0x2f'),EXTRACTED_REPORT_ID,_0x5663('0xf')),util['inspect'](_0x43e938,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x37a5=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','then','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','split','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','info'];(function(_0x4b13eb,_0x4f2e3d){var _0x2e7ae0=function(_0x25e126){while(--_0x25e126){_0x4b13eb['push'](_0x4b13eb['shift']());}};_0x2e7ae0(++_0x4f2e3d);}(_0x37a5,0x107));var _0x537a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x37a5[_0x1969a7];return _0x3d665f;};'use strict';var util=require(_0x537a('0x0'));var path=require(_0x537a('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x537a('0x2'));var BPromise=require(_0x537a('0x3'));var zipdir=require(_0x537a('0x4'));var rimraf=require(_0x537a('0x5'));var db=require(_0x537a('0x6'))['db'];var dbH=require(_0x537a('0x6'))[_0x537a('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x537a('0x8')][0x2]);var QUERY=process[_0x537a('0x8')][0x3];var PATH=process[_0x537a('0x8')][0x4];function analyticExtractedReport(_0x1ddd9d,_0x50d48c){var _0x539908={'status':_0x1ddd9d};var _0x4396b7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50d48c){_0x539908['savename']=_0x50d48c;}return db['AnalyticExtractedReport'][_0x537a('0x9')](_0x539908,_0x4396b7);}function main(){var _0x2b5917=0x1388;var _0x333122;logger['info'](util[_0x537a('0xa')](_0x537a('0xb'),EXTRACTED_REPORT_ID,_0x537a('0xc')));return db[_0x537a('0xd')][_0x537a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x390162){if(_0x390162){_0x333122=_0x390162;_0x2b5917=_0x333122['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x537a('0xf')]['query'](util[_0x537a('0xa')](_0x537a('0x10'),QUERY),{'type':dbH[_0x537a('0xf')][_0x537a('0x11')]['SELECT']});})[_0x537a('0x12')](function(_0x53f4f4){if(!_0x53f4f4[0x0][_0x537a('0x13')]){return analyticExtractedReport(_0x537a('0x14'));}var _0x5e03de=[];var _0x109fca=0x0;var _0x5d7ce2=!![];if(_0x333122['split']){if(_0x53f4f4&&_0x53f4f4[_0x537a('0x15')]){var _0x3a4c2f=_0x53f4f4[0x0][_0x537a('0x13')]%(_0x109fca+_0x2b5917);for(;_0x5d7ce2;_0x109fca+=_0x2b5917,_0x3a4c2f=_0x53f4f4[0x0][_0x537a('0x13')]%(_0x109fca+_0x2b5917)){if(_0x3a4c2f==0x0||_0x3a4c2f==_0x53f4f4[0x0][_0x537a('0x13')]){_0x5d7ce2=![];}_0x5e03de[_0x537a('0x16')](dbH[_0x537a('0xf')]['query'](util[_0x537a('0xa')](_0x537a('0x17'),QUERY,_0x2b5917,_0x109fca),{'type':dbH[_0x537a('0xf')]['QueryTypes'][_0x537a('0x18')]}));}}}else{_0x5e03de[_0x537a('0x16')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x46c3b9=path['dirname'](PATH);var _0x3713b4=path[_0x537a('0x19')](PATH,'.xlsx');var _0x316c58=_0x333122[_0x537a('0x1a')]&&_0x5e03de[_0x537a('0x15')]>0x1;var _0x262f86=[];if(!fs[_0x537a('0x1b')](path[_0x537a('0x1c')](_0x46c3b9,_0x3713b4))&&_0x316c58){fs[_0x537a('0x1d')](path['join'](_0x46c3b9,_0x3713b4));}return BPromise[_0x537a('0x1e')](_0x5e03de,function(_0x387396){_0x262f86[_0x537a('0x16')](_0x387396);})[_0x537a('0x12')](function(){for(var _0x2aa1fc=0x0;_0x2aa1fc<_0x262f86['length'];_0x2aa1fc+=0x1){var _0x5c815c;var _0xba0650=_0x262f86[_0x2aa1fc];if(_0x316c58){_0x5c815c=path[_0x537a('0x1c')](_0x46c3b9,_0x3713b4,util['format'](_0x537a('0x1f'),_0x3713b4,_0x2aa1fc,_0x537a('0x20')));}else{_0x5c815c=path[_0x537a('0x1c')](_0x46c3b9,util[_0x537a('0xa')](_0x537a('0x21'),_0x3713b4,_0x537a('0x20')));}fs[_0x537a('0x22')](_0x5c815c,json2xls(_0xba0650),_0x537a('0x23'));}})[_0x537a('0x12')](function(){if(_0x316c58){zipdir(path[_0x537a('0x1c')](_0x46c3b9,_0x3713b4),{'saveTo':path[_0x537a('0x1c')](_0x46c3b9,util['format']('%s.%s',_0x3713b4,_0x537a('0x24')))},function(_0x1d5e15,_0x5be5aa){});rimraf(path[_0x537a('0x1c')](_0x46c3b9,_0x3713b4),function(){});}})[_0x537a('0x12')](function(){logger[_0x537a('0x25')](util[_0x537a('0xa')](_0x537a('0x26'),EXTRACTED_REPORT_ID,_0x537a('0xc')));return analyticExtractedReport(_0x537a('0x27'),_0x316c58?util[_0x537a('0xa')](_0x537a('0x21'),_0x3713b4,_0x316c58?_0x537a('0x24'):_0x537a('0x20')):null);});})[_0x537a('0x28')](function(_0x2c6268){logger[_0x537a('0x25')](util[_0x537a('0xa')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x537a('0xc')),util[_0x537a('0x29')](_0x2c6268,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x537a('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index efb6ec8..044eda0 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 _0x71f4=['format','CDR(type)=%s','context','VoiceExtensionId','outbound','cutdigits','extension','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','priority','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','filter','groupBy','exten','queue','playback','hasOwnProperty','extensions','find','push','type','Set'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x71f4,0xf9));var _0x471f=function(_0x4aae6b,_0x5b4ad8){_0x4aae6b=_0x4aae6b-0x0;var _0x5ee006=_0x71f4[_0x4aae6b];return _0x5ee006;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x30e070,_0x223514){var _0x2f97b=this;return _0x30e070[_0x471f('0x0')][_0x471f('0x1')]['findAll']({'raw':!![]})[_0x471f('0x2')](function(_0x57bbfa){_0x2f97b[_0x471f('0x3')]=_0x57bbfa;return _0x30e070['models'][_0x471f('0x4')][_0x471f('0x5')]({'where':{'IntervalId':_0x223514[_0x471f('0x6')]},'raw':!![]});})[_0x471f('0x2')](function(_0x3c63fb){return _0x30e070[_0x471f('0x0')][_0x471f('0x4')][_0x471f('0x5')]({'where':{'exten':{'$in':_[_0x471f('0x7')](_['map'](_0x3c63fb,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x471f('0x2')](function(_0x22ea73){var _0x55042a=_[_0x471f('0x8')](_0x22ea73,{'priority':'1'});var _0x137b84=_[_0x471f('0x8')](_0x22ea73,{'isApp':0x1});var _0x4d7364=_[_0x471f('0x9')](_0x137b84,_0x471f('0xa'));var _0x9f73ca=[_0x471f('0xb'),_0x471f('0xc')];var _0x4151c1=[];var _0xdc7747=[];for(var _0x1de7fa in _0x4d7364){if(_0x4d7364[_0x471f('0xd')](_0x1de7fa)){_0x2f97b['priority']=0x2;_0x2f97b[_0x471f('0xe')]=[];_0x2f97b['extension']=_[_0x471f('0xf')](_0x55042a,{'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')]});_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':_0x471f('0x12'),'appdata':util[_0x471f('0x13')](_0x471f('0x14'),_0x4d7364[_0x1de7fa][0x0]['type']),'context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x2f97b['priority']++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});if(_0x4d7364[_0x1de7fa][0x0]['type']===_0x471f('0x17')){if(_0x2f97b['extension']){_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':_0x471f('0x12'),'appdata':'CDR(destination)='+(_0x2f97b['extension'][_0x471f('0x18')]?'${EXTEN:'+_0x2f97b[_0x471f('0x19')]['cutdigits']+'}':'${EXTEN}'),'context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x2f97b['priority']++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});}_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0]['type'],'app':_0x471f('0x12'),'appdata':_0x471f('0x1a')+_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')],'context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x2f97b['priority']++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});var _0x30f3fb=_0x2f97b['priority']++;_0x2f97b['extensions'][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':_0x471f('0x1b'),'appdata':_0x471f('0x1c')+(_0x30f3fb+0x2)+_0x471f('0x1d')+(_0x30f3fb+0x1)+')','context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x30f3fb,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});if(_0x2f97b['extension']){_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0]['type'],'app':_0x471f('0x12'),'appdata':_0x2f97b[_0x471f('0x19')][_0x471f('0x18')]?_0x471f('0x1e')+_0x2f97b[_0x471f('0x19')]['cutdigits']+'}':_0x471f('0x1f'),'context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0]['exten'],'priority':_0x2f97b[_0x471f('0x20')]++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});}_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':_0x471f('0x12'),'appdata':_0x471f('0x21')+_0x4d7364[_0x1de7fa][0x0]['VoiceExtensionId'],'context':_0x4d7364[_0x1de7fa][0x0]['context'],'exten':_0x4d7364[_0x1de7fa][0x0]['exten'],'priority':_0x2f97b['priority']++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});if(_0x2f97b[_0x471f('0x19')]&&_0x2f97b['extension'][_0x471f('0xd')]('recordingFormat')&&_0x2f97b[_0x471f('0x19')][_0x471f('0x22')]!==_0x471f('0x23')){_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':'Set','appdata':_0x471f('0x24'),'context':_0x4d7364[_0x1de7fa][0x0]['context'],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x2f97b[_0x471f('0x20')]++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});_0x2f97b['extensions']['push']({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':_0x471f('0x12'),'appdata':_0x471f('0x25')+_0x2f97b[_0x471f('0x19')][_0x471f('0x22')]||'wav','context':_0x4d7364[_0x1de7fa][0x0]['context'],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x2f97b[_0x471f('0x20')]++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});}}_0x2f97b['extensions'][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x2f97b[_0x471f('0x20')]++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});_0x2f97b[_0x471f('0xe')]['push']({'type':_0x4d7364[_0x1de7fa][0x0]['type'],'app':_0x471f('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0]['exten'],'priority':_0x2f97b[_0x471f('0x20')]++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':_0x471f('0x12'),'appdata':_0x471f('0x26'),'context':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x15')],'exten':_0x4d7364[_0x1de7fa][0x0][_0x471f('0xa')],'priority':_0x2f97b[_0x471f('0x20')]++,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0]['VoiceExtensionId']});for(var _0x4d189a=0x0,_0x11e3a0=0x0;_0x4d189a<_0x4d7364[_0x1de7fa][_0x471f('0x27')];_0x4d189a+=0x1,_0x11e3a0=0x0){var _0x518654=_0x4d7364[_0x1de7fa][_0x4d189a];if(_0x518654['type']){_0x518654[_0x471f('0x11')]=_0x518654[_0x471f('0x11')][_0x471f('0x28')]();}var _0x4e37b7=[];var _0x55028a=[];delete _0x518654['id'];delete _0x518654['createdAt'];delete _0x518654[_0x471f('0x29')];var _0x1d6fa9=_0x518654['interval']!==_0x471f('0x2a')?[_0x518654[_0x471f('0x2b')]]:_0x518654[_0x471f('0x6')]?_[_0x471f('0x2c')](_[_0x471f('0x8')](_0x2f97b[_0x471f('0x3')],{'IntervalId':_0x518654[_0x471f('0x6')]}),'interval'):[];if(_0x518654['hasOwnProperty'](_0x471f('0x2d'))){if(_0x518654[_0x471f('0x2d')]&&_0x518654[_0x471f('0x2d')]!=='--'){_0x4e37b7[_0x471f('0x10')]({'type':_0x518654['type'],'app':_0x471f('0x12'),'appdata':_0x471f('0x2e')+_0x518654[_0x471f('0x2d')],'context':_0x518654[_0x471f('0x15')],'exten':_0x518654['exten'],'priority':_0x1d6fa9[_0x471f('0x27')]+_0x2f97b[_0x471f('0x20')]+_0x11e3a0++,'VoiceExtensionId':_0x518654[_0x471f('0x16')]});}}if(_0x518654[_0x471f('0x11')]==='outbound'&&_0x518654['hasOwnProperty']('callerID')){if(_0x518654[_0x471f('0x2f')]){_0x4e37b7[_0x471f('0x10')]({'type':_0x518654[_0x471f('0x11')],'app':_0x471f('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x518654[_0x471f('0x2f')]+')','context':_0x518654[_0x471f('0x15')],'exten':_0x518654[_0x471f('0xa')],'priority':_0x1d6fa9[_0x471f('0x27')]+_0x2f97b['priority']+_0x11e3a0++,'VoiceExtensionId':_0x518654['VoiceExtensionId']});}else{_0x4e37b7['push']({'type':_0x518654[_0x471f('0x11')],'app':'ExecIf','appdata':_0x471f('0x30'),'context':_0x518654[_0x471f('0x15')],'exten':_0x518654[_0x471f('0xa')],'priority':_0x1d6fa9[_0x471f('0x27')]+_0x2f97b[_0x471f('0x20')]+_0x11e3a0++,'VoiceExtensionId':_0x518654[_0x471f('0x16')]});}}if(_0x518654[_0x471f('0xd')](_0x471f('0x31'))){if(_0x9f73ca[_0x471f('0x32')](_0x518654[_0x471f('0x33')][_0x471f('0x28')]())>=0x0&&_0x518654['appType']!==_0x471f('0x34')){if(_0x518654[_0x471f('0x31')]){_0x4e37b7[_0x471f('0x10')]({'type':_0x518654[_0x471f('0x11')],'app':_0x471f('0x1b'),'appdata':_0x471f('0x35'),'context':_0x518654[_0x471f('0x15')],'exten':_0x518654[_0x471f('0xa')],'priority':_0x1d6fa9[_0x471f('0x27')]+_0x2f97b['priority']+_0x11e3a0++,'VoiceExtensionId':_0x518654['VoiceExtensionId']});_0x4e37b7[_0x471f('0x10')]({'type':_0x518654['type'],'app':_0x471f('0x12'),'appdata':_0x471f('0x36'),'context':_0x518654['context'],'exten':_0x518654['exten'],'priority':_0x1d6fa9[_0x471f('0x27')]+_0x2f97b[_0x471f('0x20')]+_0x11e3a0++,'VoiceExtensionId':_0x518654[_0x471f('0x16')]});}else{_0x4e37b7['push']({'type':_0x518654[_0x471f('0x11')],'app':_0x471f('0x1b'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x518654['context'],'exten':_0x518654['exten'],'priority':_0x1d6fa9['length']+_0x2f97b[_0x471f('0x20')]+_0x11e3a0++,'VoiceExtensionId':_0x518654[_0x471f('0x16')]});_0x4e37b7[_0x471f('0x10')]({'type':_0x518654[_0x471f('0x11')],'app':'Set','appdata':_0x471f('0x37'),'context':_0x518654[_0x471f('0x15')],'exten':_0x518654[_0x471f('0xa')],'priority':_0x1d6fa9['length']+_0x2f97b[_0x471f('0x20')]+_0x11e3a0++,'VoiceExtensionId':_0x518654[_0x471f('0x16')]});}}}for(var _0x1ef186=0x0;_0x1ef186<_0x1d6fa9[_0x471f('0x27')];_0x1ef186+=0x1){var _0x5d16e9=_0x2f97b['priority']+_0x1d6fa9['length'];var _0x552d0a=_0x1ef186===_0x1d6fa9['length']-0x1?_0x2f97b[_0x471f('0x20')]+_0x4e37b7[_0x471f('0x27')]+_0x55028a[_0x471f('0x27')]+0x2:_0x2f97b[_0x471f('0x20')]+_0x1ef186+0x1;_0x4e37b7['splice'](_0x1ef186,0x0,{'type':_0x518654[_0x471f('0x11')],'app':_0x471f('0x38'),'appdata':_0x1d6fa9[_0x1ef186]+'?'+_0x518654['context']+',${EXTEN},'+_0x5d16e9+':'+_0x518654[_0x471f('0x15')]+_0x471f('0x39')+_0x552d0a,'exten':_0x518654[_0x471f('0xa')],'context':_0x518654[_0x471f('0x15')],'priority':_0x2f97b['priority']+_0x1ef186,'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0]['VoiceExtensionId']});}_0x518654['priority']=_0x4e37b7[_0x471f('0x27')]?_[_0x471f('0x3a')](_0x4e37b7)[_0x471f('0x20')]+0x1:_0x2f97b[_0x471f('0x20')];_0x2f97b[_0x471f('0x20')]=(_0x55028a[_0x471f('0x27')]?_[_0x471f('0x3a')](_0x55028a)[_0x471f('0x20')]:_0x518654[_0x471f('0x20')])+0x1;_0x2f97b[_0x471f('0xe')]=_[_0x471f('0x3b')](_0x2f97b['extensions'],_0x4e37b7,[_0x518654],_0x55028a);}_0x2f97b[_0x471f('0xe')][_0x471f('0x10')]({'type':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x11')],'app':_0x471f('0x3c'),'exten':_0x4d7364[_0x1de7fa][0x0]['exten'],'context':_0x4d7364[_0x1de7fa][0x0]['context'],'priority':_0x2f97b[_0x471f('0x20')],'VoiceExtensionId':_0x4d7364[_0x1de7fa][0x0][_0x471f('0x16')]});_0x4151c1['push'](_0x4d7364[_0x1de7fa][0x0]['VoiceExtensionId']);_0xdc7747=_[_0x471f('0x3b')](_0xdc7747,_0x2f97b[_0x471f('0xe')]);}}return _0x30e070['transaction'](function(_0x2a3a5c){return _0x30e070[_0x471f('0x0')][_0x471f('0x4')][_0x471f('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x4151c1}},'transaction':_0x2a3a5c})['then'](function(_0x169d4a){return _0x30e070[_0x471f('0x0')][_0x471f('0x4')][_0x471f('0x3e')](_[_0x471f('0x3f')](_0xdc7747,'priority'),{'transaction':_0x2a3a5c});});});})[_0x471f('0x40')](function(_0x485427){console[_0x471f('0x41')](_0x485427);});}exports[_0x471f('0x42')]=rewrite; \ No newline at end of file +var _0x4977=['CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','VoiceExtension','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','Interval','findAll','then','intervals','models','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extensions','find','push','type','format','CDR(type)=%s','context','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','priority','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','Set','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag'];(function(_0x1450f1,_0x3b997a){var _0xfaf198=function(_0xe784b6){while(--_0xe784b6){_0x1450f1['push'](_0x1450f1['shift']());}};_0xfaf198(++_0x3b997a);}(_0x4977,0x1cd));var _0x7497=function(_0x587dd6,_0x51cf21){_0x587dd6=_0x587dd6-0x0;var _0x21ef36=_0x4977[_0x587dd6];return _0x21ef36;};'use strict';var _=require(_0x7497('0x0'));var util=require(_0x7497('0x1'));function rewrite(_0x150f72,_0x392350){var _0x2e7bc1=this;return _0x150f72['models'][_0x7497('0x2')][_0x7497('0x3')]({'raw':!![]})[_0x7497('0x4')](function(_0x43c339){_0x2e7bc1[_0x7497('0x5')]=_0x43c339;return _0x150f72[_0x7497('0x6')]['VoiceExtension'][_0x7497('0x3')]({'where':{'IntervalId':_0x392350[_0x7497('0x7')]},'raw':!![]});})[_0x7497('0x4')](function(_0x15c322){return _0x150f72[_0x7497('0x6')]['VoiceExtension'][_0x7497('0x3')]({'where':{'exten':{'$in':_[_0x7497('0x8')](_['map'](_0x15c322,_0x7497('0x9')))}},'order':[{'raw':_0x7497('0xa')}],'raw':!![]});})[_0x7497('0x4')](function(_0x1d316d){var _0x336d87=_[_0x7497('0xb')](_0x1d316d,{'priority':'1'});var _0x5f5052=_[_0x7497('0xb')](_0x1d316d,{'isApp':0x1});var _0x5dabe9=_[_0x7497('0xc')](_0x5f5052,_0x7497('0x9'));var _0x5e327f=['queue',_0x7497('0xd')];var _0x3bccea=[];var _0x3d4e1f=[];for(var _0x442cbd in _0x5dabe9){if(_0x5dabe9[_0x7497('0xe')](_0x442cbd)){_0x2e7bc1['priority']=0x2;_0x2e7bc1[_0x7497('0xf')]=[];_0x2e7bc1['extension']=_[_0x7497('0x10')](_0x336d87,{'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')]});_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':'Set','appdata':util[_0x7497('0x13')](_0x7497('0x14'),_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')]),'context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x2e7bc1['priority']++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0]['VoiceExtensionId']});if(_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')]===_0x7497('0x16')){if(_0x2e7bc1[_0x7497('0x17')]){_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':'Set','appdata':_0x7497('0x18')+(_0x2e7bc1[_0x7497('0x17')][_0x7497('0x19')]?_0x7497('0x1a')+_0x2e7bc1['extension'][_0x7497('0x19')]+'}':_0x7497('0x1b')),'context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x2e7bc1[_0x7497('0x1c')]++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});}_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':'Set','appdata':_0x7497('0x1e')+_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')],'context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x2e7bc1[_0x7497('0x1c')]++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});var _0x17b9ad=_0x2e7bc1['priority']++;_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':_0x7497('0x1f'),'appdata':_0x7497('0x20')+(_0x17b9ad+0x2)+'):Goto('+(_0x17b9ad+0x1)+')','context':_0x5dabe9[_0x442cbd][0x0]['context'],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x17b9ad,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});if(_0x2e7bc1[_0x7497('0x17')]){_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':_0x7497('0x21'),'appdata':_0x2e7bc1[_0x7497('0x17')]['cutdigits']?_0x7497('0x22')+_0x2e7bc1['extension'][_0x7497('0x19')]+'}':_0x7497('0x23'),'context':_0x5dabe9[_0x442cbd][0x0]['context'],'exten':_0x5dabe9[_0x442cbd][0x0]['exten'],'priority':_0x2e7bc1[_0x7497('0x1c')]++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});}_0x2e7bc1['extensions'][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0]['type'],'app':_0x7497('0x21'),'appdata':_0x7497('0x24')+_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')],'context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x2e7bc1[_0x7497('0x1c')]++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});if(_0x2e7bc1['extension']&&_0x2e7bc1[_0x7497('0x17')][_0x7497('0xe')](_0x7497('0x25'))&&_0x2e7bc1['extension'][_0x7497('0x25')]!==_0x7497('0x26')){_0x2e7bc1['extensions']['push']({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':_0x7497('0x21'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0]['exten'],'priority':_0x2e7bc1['priority']++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':'Set','appdata':_0x7497('0x27')+_0x2e7bc1['extension'][_0x7497('0x25')]||_0x7497('0x28'),'context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x2e7bc1[_0x7497('0x1c')]++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});}}_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':_0x7497('0x21'),'appdata':_0x7497('0x29'),'context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x2e7bc1['priority']++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0]['exten'],'priority':_0x2e7bc1[_0x7497('0x1c')]++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});_0x2e7bc1[_0x7497('0xf')][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x12')],'app':_0x7497('0x21'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'priority':_0x2e7bc1[_0x7497('0x1c')]++,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});for(var _0x2dfe58=0x0,_0x236b9f=0x0;_0x2dfe58<_0x5dabe9[_0x442cbd][_0x7497('0x2a')];_0x2dfe58+=0x1,_0x236b9f=0x0){var _0xa0d2fc=_0x5dabe9[_0x442cbd][_0x2dfe58];if(_0xa0d2fc[_0x7497('0x12')]){_0xa0d2fc['type']=_0xa0d2fc[_0x7497('0x12')][_0x7497('0x2b')]();}var _0x27b98f=[];var _0x363f09=[];delete _0xa0d2fc['id'];delete _0xa0d2fc[_0x7497('0x2c')];delete _0xa0d2fc[_0x7497('0x2d')];var _0x4b0b89=_0xa0d2fc[_0x7497('0x2e')]!==_0x7497('0x2f')?[_0xa0d2fc['interval']]:_0xa0d2fc[_0x7497('0x7')]?_[_0x7497('0x30')](_[_0x7497('0xb')](_0x2e7bc1[_0x7497('0x5')],{'IntervalId':_0xa0d2fc[_0x7497('0x7')]}),_0x7497('0x2e')):[];if(_0xa0d2fc['hasOwnProperty'](_0x7497('0x31'))){if(_0xa0d2fc['tag']&&_0xa0d2fc[_0x7497('0x31')]!=='--'){_0x27b98f[_0x7497('0x11')]({'type':_0xa0d2fc[_0x7497('0x12')],'app':'Set','appdata':_0x7497('0x32')+_0xa0d2fc['tag'],'context':_0xa0d2fc['context'],'exten':_0xa0d2fc[_0x7497('0x9')],'priority':_0x4b0b89[_0x7497('0x2a')]+_0x2e7bc1['priority']+_0x236b9f++,'VoiceExtensionId':_0xa0d2fc[_0x7497('0x1d')]});}}if(_0xa0d2fc[_0x7497('0x12')]===_0x7497('0x16')&&_0xa0d2fc[_0x7497('0xe')](_0x7497('0x33'))){if(_0xa0d2fc['callerID']){_0x27b98f[_0x7497('0x11')]({'type':_0xa0d2fc[_0x7497('0x12')],'app':_0x7497('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0xa0d2fc['callerID']+')','context':_0xa0d2fc['context'],'exten':_0xa0d2fc[_0x7497('0x9')],'priority':_0x4b0b89[_0x7497('0x2a')]+_0x2e7bc1[_0x7497('0x1c')]+_0x236b9f++,'VoiceExtensionId':_0xa0d2fc[_0x7497('0x1d')]});}else{_0x27b98f[_0x7497('0x11')]({'type':_0xa0d2fc[_0x7497('0x12')],'app':_0x7497('0x1f'),'appdata':_0x7497('0x34'),'context':_0xa0d2fc[_0x7497('0x15')],'exten':_0xa0d2fc[_0x7497('0x9')],'priority':_0x4b0b89[_0x7497('0x2a')]+_0x2e7bc1[_0x7497('0x1c')]+_0x236b9f++,'VoiceExtensionId':_0xa0d2fc[_0x7497('0x1d')]});}}if(_0xa0d2fc[_0x7497('0xe')]('answer')){if(_0x5e327f['indexOf'](_0xa0d2fc[_0x7497('0x35')][_0x7497('0x2b')]())>=0x0&&_0xa0d2fc[_0x7497('0x36')]!==_0x7497('0x37')){if(_0xa0d2fc['answer']){_0x27b98f[_0x7497('0x11')]({'type':_0xa0d2fc[_0x7497('0x12')],'app':'ExecIf','appdata':_0x7497('0x38'),'context':_0xa0d2fc[_0x7497('0x15')],'exten':_0xa0d2fc['exten'],'priority':_0x4b0b89[_0x7497('0x2a')]+_0x2e7bc1[_0x7497('0x1c')]+_0x236b9f++,'VoiceExtensionId':_0xa0d2fc[_0x7497('0x1d')]});_0x27b98f[_0x7497('0x11')]({'type':_0xa0d2fc[_0x7497('0x12')],'app':'Set','appdata':_0x7497('0x39'),'context':_0xa0d2fc['context'],'exten':_0xa0d2fc[_0x7497('0x9')],'priority':_0x4b0b89[_0x7497('0x2a')]+_0x2e7bc1['priority']+_0x236b9f++,'VoiceExtensionId':_0xa0d2fc[_0x7497('0x1d')]});}else{_0x27b98f['push']({'type':_0xa0d2fc[_0x7497('0x12')],'app':'ExecIf','appdata':_0x7497('0x3a'),'context':_0xa0d2fc[_0x7497('0x15')],'exten':_0xa0d2fc[_0x7497('0x9')],'priority':_0x4b0b89[_0x7497('0x2a')]+_0x2e7bc1[_0x7497('0x1c')]+_0x236b9f++,'VoiceExtensionId':_0xa0d2fc[_0x7497('0x1d')]});_0x27b98f[_0x7497('0x11')]({'type':_0xa0d2fc[_0x7497('0x12')],'app':_0x7497('0x21'),'appdata':_0x7497('0x3b'),'context':_0xa0d2fc[_0x7497('0x15')],'exten':_0xa0d2fc[_0x7497('0x9')],'priority':_0x4b0b89[_0x7497('0x2a')]+_0x2e7bc1[_0x7497('0x1c')]+_0x236b9f++,'VoiceExtensionId':_0xa0d2fc[_0x7497('0x1d')]});}}}for(var _0x4db579=0x0;_0x4db579<_0x4b0b89[_0x7497('0x2a')];_0x4db579+=0x1){var _0x1a5f2e=_0x2e7bc1[_0x7497('0x1c')]+_0x4b0b89[_0x7497('0x2a')];var _0x43b71f=_0x4db579===_0x4b0b89[_0x7497('0x2a')]-0x1?_0x2e7bc1['priority']+_0x27b98f['length']+_0x363f09[_0x7497('0x2a')]+0x2:_0x2e7bc1[_0x7497('0x1c')]+_0x4db579+0x1;_0x27b98f[_0x7497('0x3c')](_0x4db579,0x0,{'type':_0xa0d2fc[_0x7497('0x12')],'app':_0x7497('0x3d'),'appdata':_0x4b0b89[_0x4db579]+'?'+_0xa0d2fc[_0x7497('0x15')]+_0x7497('0x3e')+_0x1a5f2e+':'+_0xa0d2fc[_0x7497('0x15')]+',${EXTEN},'+_0x43b71f,'exten':_0xa0d2fc[_0x7497('0x9')],'context':_0xa0d2fc['context'],'priority':_0x2e7bc1[_0x7497('0x1c')]+_0x4db579,'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});}_0xa0d2fc[_0x7497('0x1c')]=_0x27b98f['length']?_[_0x7497('0x3f')](_0x27b98f)[_0x7497('0x1c')]+0x1:_0x2e7bc1[_0x7497('0x1c')];_0x2e7bc1['priority']=(_0x363f09[_0x7497('0x2a')]?_[_0x7497('0x3f')](_0x363f09)['priority']:_0xa0d2fc[_0x7497('0x1c')])+0x1;_0x2e7bc1[_0x7497('0xf')]=_['concat'](_0x2e7bc1['extensions'],_0x27b98f,[_0xa0d2fc],_0x363f09);}_0x2e7bc1['extensions'][_0x7497('0x11')]({'type':_0x5dabe9[_0x442cbd][0x0]['type'],'app':_0x7497('0x40'),'exten':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x9')],'context':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x15')],'priority':_0x2e7bc1[_0x7497('0x1c')],'VoiceExtensionId':_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]});_0x3bccea['push'](_0x5dabe9[_0x442cbd][0x0][_0x7497('0x1d')]);_0x3d4e1f=_[_0x7497('0x41')](_0x3d4e1f,_0x2e7bc1[_0x7497('0xf')]);}}return _0x150f72[_0x7497('0x42')](function(_0x4a7294){return _0x150f72[_0x7497('0x6')][_0x7497('0x43')][_0x7497('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x3bccea}},'transaction':_0x4a7294})[_0x7497('0x4')](function(_0x51f864){return _0x150f72[_0x7497('0x6')][_0x7497('0x43')][_0x7497('0x45')](_[_0x7497('0x46')](_0x3d4e1f,_0x7497('0x1c')),{'transaction':_0x4a7294});});});})[_0x7497('0x47')](function(_0x96713b){console['error'](_0x96713b);});}exports[_0x7497('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 38d941b..3e99ca2 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 _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x289d3b,_0x1803ed){var _0x32fc13=function(_0x1d6dc0){while(--_0x1d6dc0){_0x289d3b['push'](_0x289d3b['shift']());}};_0x32fc13(++_0x1803ed);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);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(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){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'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x2003fb,_0x27f296){var _0x5828c4=function(_0x3189d7){while(--_0x3189d7){_0x2003fb['push'](_0x2003fb['shift']());}};_0x5828c4(++_0x27f296);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 39e5c26..cde4209 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 _0xb60f=['cm_hopper_black','ContactId','fields','from','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','Received\x20SIGINT','exit','errors','push','code','message','info','sequelize','query','spread','catch','error','main','stringify','send','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','length','rows','hasOwnProperty','data','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','complete','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','argv','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString'];(function(_0x5888e6,_0x2c4094){var _0xfc0047=function(_0x172241){while(--_0x172241){_0x5888e6['push'](_0x5888e6['shift']());}};_0xfc0047(++_0x2c4094);}(_0xb60f,0xe1));var _0xfb60=function(_0x414532,_0x499545){_0x414532=_0x414532-0x0;var _0x1fac01=_0xb60f[_0x414532];return _0x1fac01;};'use strict';var fs=require('fs');var path=require(_0xfb60('0x0'));var _=require('lodash');var Papa=require(_0xfb60('0x1'));var util=require(_0xfb60('0x2'));var BPromise=require('bluebird');var moment=require(_0xfb60('0x3'));var squel=require(_0xfb60('0x4'));var Redis=require(_0xfb60('0x5'));var db=require(_0xfb60('0x6'))['db'];var config=require(_0xfb60('0x7'));var logger=require(_0xfb60('0x8'))(_0xfb60('0x9'));config[_0xfb60('0xa')]=_[_0xfb60('0xb')](config[_0xfb60('0xa')],{'host':_0xfb60('0xc'),'port':0x18eb});var socket=require(_0xfb60('0xd'))(new Redis(config[_0xfb60('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xfb60('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1dbe4e){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))*$/[_0xfb60('0xf')](_0x1dbe4e);}function selectNotIn(_0x4455a4,_0x30d5ea,_0x9103fa,_0x4e6657,_0x5e79b2){return squel[_0xfb60('0x10')]()[_0xfb60('0x11')](_0xfb60('0x12'))['from'](_0x4e6657)[_0xfb60('0x13')](_0x30d5ea,null,_0x30d5ea+_0xfb60('0x14')+_0x4e6657+'.'+_0x9103fa)[_0xfb60('0x15')](_0x4e6657+'.'+_0x9103fa+'\x20=\x20'+_0x4455a4+'.'+_0x9103fa)[_0xfb60('0x15')](_0x30d5ea+_0xfb60('0x16')+_0x5e79b2[_0xfb60('0x13')]()+')');}function insertCmHopper(_0x275f4f,_0x129741,_0x520474,_0x5d5b8c,_0x4e1c31){var _0x25989e=['cm_contacts.phone',_0xfb60('0x17'),_0xfb60('0x18'),_0xfb60('0x19'),_0x129741+'.'+_0x5d5b8c,_0xfb60('0x1a'),_0xfb60('0x1b'),_0xfb60('0x1c'),_0xfb60('0x1d'),'\x22'+_0x4e1c31+'\x22'];return squel[_0xfb60('0x1e')]()[_0xfb60('0x1f')]('cm_hopper')[_0xfb60('0x20')]([_0xfb60('0x12'),_0xfb60('0x21'),'ContactId',_0xfb60('0x22'),_0x5d5b8c,_0xfb60('0x23'),_0xfb60('0x24'),_0xfb60('0x25'),_0xfb60('0x26'),_0xfb60('0x27')],squel[_0xfb60('0x10')]()['fields'](_0x25989e)['from'](_0x129741)[_0xfb60('0x13')](_0xfb60('0x28'),null,_0xfb60('0x29')+_0x129741+_0xfb60('0x2a'))[_0xfb60('0x13')](_0x520474,null,_0x520474+'.id\x20=\x20'+_0x129741+'.'+_0x5d5b8c)['where'](_0x129741+_0xfb60('0x2b'),_0x275f4f)[_0xfb60('0x15')](_0xfb60('0x2c'),NOW)['where'](_0xfb60('0x2d'),selectNotIn(_0x129741,_0x520474,_0x5d5b8c,_0xfb60('0x2e'),[_0xfb60('0x2f'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x129741,_0x520474,_0x5d5b8c,'cm_hopper',[_0xfb60('0x2f')])))[_0xfb60('0x30')]();}function insertCmHopperBlack(_0x2d9d07,_0x20a1b5,_0x3850e4,_0x277752){var _0x2df140=['cm_contacts.phone',_0xfb60('0x18'),'cm_contacts.ListId',_0x20a1b5+'.'+_0x277752,_0xfb60('0x1a'),_0xfb60('0x1b')];return squel[_0xfb60('0x1e')]()[_0xfb60('0x1f')](_0xfb60('0x31'))[_0xfb60('0x20')]([_0xfb60('0x12'),_0xfb60('0x32'),_0xfb60('0x22'),_0x277752,_0xfb60('0x23'),_0xfb60('0x24')],squel[_0xfb60('0x10')]()[_0xfb60('0x33')](_0x2df140)[_0xfb60('0x34')](_0x20a1b5)[_0xfb60('0x13')](_0xfb60('0x28'),null,_0xfb60('0x29')+_0x20a1b5+'.CmListId')[_0xfb60('0x13')](_0x3850e4,null,_0x3850e4+_0xfb60('0x14')+_0x20a1b5+'.'+_0x277752)[_0xfb60('0x15')](_0x20a1b5+_0xfb60('0x2b'),_0x2d9d07)[_0xfb60('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfb60('0x15')](_0xfb60('0x2d'),squel['select']()[_0xfb60('0x11')](_0xfb60('0x12'))[_0xfb60('0x34')](_0xfb60('0x31'))[_0xfb60('0x15')](_0xfb60('0x35'),_0x2d9d07)[_0xfb60('0x15')](_0x277752+'\x20=\x20?',_0x20a1b5+'.'+_0x277752)))[_0xfb60('0x30')]();}function insertCmContact(_0x1ac0d2,_0x307d7f,_0xc6a248,_0x415975){var _0x312c24=_[_0xfb60('0x36')](_[_0xfb60('0x37')](_0x415975),[_0xfb60('0x22'),_0xfb60('0x38'),_0xfb60('0x23'),_0xfb60('0x24')]);return squel[_0xfb60('0x1e')]()[_0xfb60('0x1f')](_0xfb60('0x28'))['fromQuery'](_0x312c24,squel[_0xfb60('0x10')]()[_0xfb60('0x33')](_0x312c24)[_0xfb60('0x34')](_0x307d7f)[_0xfb60('0x15')]('('+_0xc6a248[_0xfb60('0x13')](',')+_0xfb60('0x39'),squel[_0xfb60('0x10')]()[_0xfb60('0x33')](_0xc6a248)[_0xfb60('0x34')]('cm_contacts')[_0xfb60('0x15')](_0xfb60('0x35'),_0x1ac0d2)[_0xfb60('0x15')](_0xfb60('0x3a')))[_0xfb60('0x15')](_0xfb60('0x3b'),squel[_0xfb60('0x10')]()[_0xfb60('0x11')]('MIN(id)',_0xfb60('0x3c'))[_0xfb60('0x34')](_0x307d7f)[_0xfb60('0x3d')](_0xc6a248[_0xfb60('0x13')](','))))[_0xfb60('0x30')]();}function handleStop(){logger['info'](_0xfb60('0x3e'));stopped=!![];}function handleUncaughtException(_0x587ed9){logger['error'](_0x587ed9['message']);process[_0xfb60('0x3f')](0x1);}function handleError(_0x1723ac,_0x201de0){stats[_0xfb60('0x40')][_0xfb60('0x41')]({'name':_0x201de0[_0xfb60('0x42')],'message':_0x201de0[_0xfb60('0x43')],'row':_0x1723ac});}function handleQuery(_0x130057){logger[_0xfb60('0x44')](_0x130057);return db[_0xfb60('0x45')][_0xfb60('0x46')](_0x130057)[_0xfb60('0x47')](function(_0x4b6e88){results[_0xfb60('0x41')](_0x4b6e88);})[_0xfb60('0x48')](function(_0xec8b5c){logger[_0xfb60('0x49')](_0xec8b5c[_0xfb60('0x43')]);});}function main(_0x537db8,_0x4bd3cd,_0x46d920,_0x2b9a2b){logger['info'](_0xfb60('0x4a'),_0x537db8,JSON[_0xfb60('0x4b')](_0x4bd3cd));process[_0xfb60('0x4c')]('start');var _0x467b55=_0x4bd3cd['binding'];var _0x254e3b=_0x4bd3cd[_0xfb60('0x4d')];var _0x231125=path['join'](config[_0xfb60('0x4e')],_0xfb60('0x4f'),_0x254e3b+_0xfb60('0x50'));var _0x13297a=_[_0xfb60('0x37')](_0x467b55)[_0xfb60('0x13')]();logger[_0xfb60('0x44')](_0xfb60('0x51'),_0x13297a);fs[_0xfb60('0x52')](_0x231125,_0x13297a+'\x0a');Papa[_0xfb60('0x53')](fs['createReadStream'](_0x537db8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x439015,_0x16b212){try{for(var _0x1579ef=0x0,_0x117595=[];_0x1579ef<_0x439015['data'][_0xfb60('0x54')];_0x1579ef++){stats[_0xfb60('0x55')]+=0x1;if(_0x439015[_0xfb60('0x40')][_0x1579ef]){handleError(_0x439015['data'][_0x1579ef],_0x439015['errors'][_0x1579ef]);}else{var _0x288ac8=[];for(var _0x2190a1 in _0x467b55){if(_0x467b55[_0xfb60('0x56')](_0x2190a1)){if(_0x439015[_0xfb60('0x57')][_0x1579ef][_0x467b55[_0x2190a1]]){var _0x3dd10d=_[_0xfb60('0x58')](_0x439015[_0xfb60('0x57')][_0x1579ef][_0x467b55[_0x2190a1]][_0xfb60('0x59')](/"/g,'\x27'));switch(_0x2190a1){case _0xfb60('0x21'):var _0x5d2e0c=moment(_0x3dd10d,_0xfb60('0x5a'),!![]);if(_0x5d2e0c['isValid']()){_0x117595[_0xfb60('0x41')]('\x22'+_0x3dd10d+'\x22');}else{_0x288ac8[_0xfb60('0x41')](_0xfb60('0x5b'));}break;case _0xfb60('0x25'):var _0x1375ef=parseInt(_0x3dd10d);_0x3dd10d=_[_0xfb60('0x5c')](_0x1375ef)||_0x1375ef<0x0||_0x1375ef>0x4?_0x2b9a2b?0x3:0x2:_0x1375ef;_0x117595['push']('\x22'+_0x3dd10d+'\x22');break;case _0xfb60('0x26'):var _0xb9c755=parseInt(_0x3dd10d);if(_[_0xfb60('0x5d')](_0xb9c755)&&_['includes'](_0x46d920,_0xb9c755)){_0x117595[_0xfb60('0x41')]('\x22'+_0xb9c755+'\x22');}else{_0x288ac8['push'](_0xfb60('0x5e'));}break;case _0xfb60('0x5f'):if(isEmail(_0x3dd10d)){_0x117595[_0xfb60('0x41')]('\x22'+_0x3dd10d+'\x22');}else{_0x288ac8[_0xfb60('0x41')](_0xfb60('0x60'));}break;case _0xfb60('0x61'):var _0x4c26aa=moment(_0x3dd10d,_0xfb60('0x62'),!![]);if(_0x4c26aa[_0xfb60('0x63')]()){_0x117595[_0xfb60('0x41')]('\x22'+_0x3dd10d+'\x22');}else{_0x288ac8[_0xfb60('0x41')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x117595[_0xfb60('0x41')]('\x22'+_0x3dd10d+'\x22');}}else{switch(_0x2190a1){case'firstName':case'phone':_0x288ac8[_0xfb60('0x41')](_0x2190a1+'\x20not\x20specified');break;default:_0x117595['push']('\x22\x22');}}}}if(_0x288ac8['length']){handleError(_0x439015[_0xfb60('0x57')][_0x1579ef],{'code':_0xfb60('0x64'),'message':_0x288ac8['join']()});}else{fs[_0xfb60('0x65')](_0x231125,_0x117595[_0xfb60('0x13')]()+'\x0a');}_0x117595=[];}if(!(stats[_0xfb60('0x55')]%0xc8)){socket['emit'](_0xfb60('0x66')+_0x254e3b,stats);stats[_0xfb60('0x40')]=[];}}if(stopped){logger[_0xfb60('0x44')](_0xfb60('0x67'));_0x16b212[_0xfb60('0x68')]();}}catch(_0x233cfe){handleError(_0x439015[_0xfb60('0x57')][_0x1579ef],{'code':_0xfb60('0x69'),'message':_0x233cfe[_0xfb60('0x43')]});logger[_0xfb60('0x49')](_0xfb60('0x6a'),_0x233cfe['message']);}},'complete':function(){try{var _0x2b5e94=[];var _0xf67594=_0xfb60('0x28');if(_0x4bd3cd[_0xfb60('0x6b')]&&_0x4bd3cd[_0xfb60('0x6b')][_0xfb60('0x54')]){_0xf67594=_0xfb60('0x6c')+_0x254e3b;_0x2b5e94[_0xfb60('0x41')](_0xfb60('0x6d')+_0xf67594+_0xfb60('0x6e'));}var _0x2a18b1=util[_0xfb60('0xe')](_0xfb60('0x6f'),_0x231125,_0xf67594,_0x13297a,_0x4bd3cd[_0xfb60('0x22')],_0x4bd3cd[_0xfb60('0x38')]||null,NOW,NOW);if(_['isNil'](_0x467b55[_0xfb60('0x21')])){_0x2a18b1+=_0xfb60('0x70');}_0x2b5e94['push'](_0x2a18b1);if(_0x4bd3cd[_0xfb60('0x6b')]&&_0x4bd3cd[_0xfb60('0x6b')][_0xfb60('0x54')]){_0x2b5e94['push'](insertCmContact(_0x4bd3cd['ListId'],_0xf67594,_0x4bd3cd[_0xfb60('0x6b')],_0x467b55));_0x2b5e94['push'](_0xfb60('0x71')+_0xf67594+';');}_0x2b5e94['push'](insertCmHopper(_0x4bd3cd[_0xfb60('0x22')],_0xfb60('0x72'),'voice_queues',_0xfb60('0x73'),_0x2b9a2b));_0x2b5e94[_0xfb60('0x41')](insertCmHopperBlack(_0x4bd3cd[_0xfb60('0x22')],_0xfb60('0x74'),_0xfb60('0x75'),_0xfb60('0x73')));_0x2b5e94[_0xfb60('0x41')](insertCmHopper(_0x4bd3cd[_0xfb60('0x22')],_0xfb60('0x76'),'campaigns',_0xfb60('0x77'),_0x2b9a2b));_0x2b5e94[_0xfb60('0x41')](insertCmHopperBlack(_0x4bd3cd[_0xfb60('0x22')],_0xfb60('0x78'),_0xfb60('0x79'),_0xfb60('0x77')));BPromise['each'](_0x2b5e94,handleQuery)['then'](function(_0x171594){stats[_0xfb60('0x7a')]=!![];stats[_0xfb60('0x7b')]=_0x4bd3cd[_0xfb60('0x6b')]&&_0x4bd3cd[_0xfb60('0x6b')][_0xfb60('0x54')]?results[0x2]['affectedRows']:results[0x0][_0xfb60('0x7b')];socket['emit'](_0xfb60('0x66')+_0x254e3b,stats);fs['unlink'](_0x537db8);fs[_0xfb60('0x7c')](_0x231125);process['exit'](0x0);})[_0xfb60('0x48')](function(_0x560053){logger[_0xfb60('0x49')](_0x560053[_0xfb60('0x43')]);process['exit'](0x1);});}catch(_0x467fc1){logger[_0xfb60('0x49')](_0xfb60('0x7d'),_0x467fc1[_0xfb60('0x43')]);process[_0xfb60('0x3f')](0x1);}},'error':function(_0x5d455c,_0x928da3,_0x397075,_0x3d81ce){throw new Error(_0x3d81ce);}});}function validate(){if(process['argv']&&process['argv'][_0xfb60('0x54')]<0x4){throw new Error(_0xfb60('0x7e'));}var _0x5cb066=path[_0xfb60('0x13')](config['root'],'server/files/tmp',process['argv'][0x2]);if(!fs[_0xfb60('0x7f')](_0x5cb066)){throw new Error(_0xfb60('0x80'));}var _0x3e05ba={};try{_0x3e05ba=JSON[_0xfb60('0x53')](process[_0xfb60('0x81')][0x3]);if(!_0x3e05ba[_0xfb60('0x82')]){throw new Error(_0xfb60('0x83'));}if(!_0x3e05ba[_0xfb60('0x82')][_0xfb60('0x12')]){throw new Error(_0xfb60('0x84'));}if(!_0x3e05ba[_0xfb60('0x82')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x3c03fa=0x0;if(_0x3e05ba[_0xfb60('0x82')][_0xfb60('0x26')]){_0x3c03fa=0x1;}if(!_0x3e05ba[_0xfb60('0x22')]){throw new Error(_0xfb60('0x85'));}}catch(_0x480a0f){throw new Error('body\x20id\x20mandatory');}var _0x504897=[];try{_0x504897=_[_0xfb60('0x86')](JSON[_0xfb60('0x53')](process[_0xfb60('0x81')][0x4]),'id');}catch(_0x3b59fc){logger['info']('No\x20agent\x20available');}main(_0x5cb066,_0x3e05ba,_0x504897,_0x3c03fa);}validate();process['on'](_0xfb60('0x87'),handleStop);process['on'](_0xfb60('0x88'),handleUncaughtException); \ No newline at end of file +var _0x075b=['trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','emit','contact:import:','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','select','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','errors','push','code','message','sequelize','query','spread','catch','error','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','data','length','rows','hasOwnProperty'];(function(_0x314397,_0x550526){var _0x1ec45e=function(_0x111722){while(--_0x111722){_0x314397['push'](_0x314397['shift']());}};_0x1ec45e(++_0x550526);}(_0x075b,0x138));var _0xb075=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x075b[_0x21a9d9];return _0x46adce;};'use strict';var fs=require('fs');var path=require(_0xb075('0x0'));var _=require('lodash');var Papa=require(_0xb075('0x1'));var util=require('util');var BPromise=require(_0xb075('0x2'));var moment=require(_0xb075('0x3'));var squel=require(_0xb075('0x4'));var Redis=require(_0xb075('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xb075('0x6'));var logger=require('../../../config/logger')(_0xb075('0x7'));config[_0xb075('0x8')]=_[_0xb075('0x9')](config[_0xb075('0x8')],{'host':_0xb075('0xa'),'port':0x18eb});var socket=require(_0xb075('0xb'))(new Redis(config[_0xb075('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb075('0xc')](_0xb075('0xd'));function isEmail(_0x1ec749){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))*$/[_0xb075('0xe')](_0x1ec749);}function selectNotIn(_0x22944a,_0x8a000e,_0x18ee1d,_0x30c13c,_0x57410c){return squel['select']()[_0xb075('0xf')]('phone')['from'](_0x30c13c)[_0xb075('0x10')](_0x8a000e,null,_0x8a000e+_0xb075('0x11')+_0x30c13c+'.'+_0x18ee1d)[_0xb075('0x12')](_0x30c13c+'.'+_0x18ee1d+_0xb075('0x13')+_0x22944a+'.'+_0x18ee1d)[_0xb075('0x12')](_0x8a000e+'.dialCheckDuplicateType\x20IN\x20('+_0x57410c[_0xb075('0x10')]()+')');}function insertCmHopper(_0x128e30,_0xf90453,_0x53f9e4,_0x2af07f,_0x953f9a){var _0x4e6a3b=[_0xb075('0x14'),_0xb075('0x15'),_0xb075('0x16'),_0xb075('0x17'),_0xf90453+'.'+_0x2af07f,_0xb075('0x18'),_0xb075('0x19'),'cm_contacts.priority',_0xb075('0x1a'),'\x22'+_0x953f9a+'\x22'];return squel[_0xb075('0x1b')]()[_0xb075('0x1c')](_0xb075('0x1d'))[_0xb075('0x1e')]([_0xb075('0x1f'),_0xb075('0x20'),_0xb075('0x21'),_0xb075('0x22'),_0x2af07f,_0xb075('0x23'),_0xb075('0x24'),_0xb075('0x25'),'UserId',_0xb075('0x26')],squel[_0xb075('0x27')]()['fields'](_0x4e6a3b)[_0xb075('0x28')](_0xf90453)['join'](_0xb075('0x29'),null,_0xb075('0x2a')+_0xf90453+_0xb075('0x2b'))[_0xb075('0x10')](_0x53f9e4,null,_0x53f9e4+'.id\x20=\x20'+_0xf90453+'.'+_0x2af07f)['where'](_0xf90453+_0xb075('0x2c'),_0x128e30)[_0xb075('0x12')](_0xb075('0x2d'),NOW)['where'](_0xb075('0x2e'),selectNotIn(_0xf90453,_0x53f9e4,_0x2af07f,_0xb075('0x1d'),[_0xb075('0x2f'),_0xb075('0x30')]))[_0xb075('0x12')](_0xb075('0x2e'),selectNotIn(_0xf90453,_0x53f9e4,_0x2af07f,_0xb075('0x1d'),['\x22always\x22'])))[_0xb075('0x31')]();}function insertCmHopperBlack(_0x4998da,_0x40d1a6,_0x16b180,_0x4a2ba3){var _0x1894e8=['cm_contacts.phone',_0xb075('0x16'),_0xb075('0x17'),_0x40d1a6+'.'+_0x4a2ba3,_0xb075('0x18'),_0xb075('0x19')];return squel[_0xb075('0x1b')]()[_0xb075('0x1c')](_0xb075('0x32'))[_0xb075('0x1e')]([_0xb075('0x1f'),_0xb075('0x21'),_0xb075('0x22'),_0x4a2ba3,_0xb075('0x23'),'updatedAt'],squel[_0xb075('0x27')]()[_0xb075('0x33')](_0x1894e8)['from'](_0x40d1a6)[_0xb075('0x10')](_0xb075('0x29'),null,_0xb075('0x2a')+_0x40d1a6+_0xb075('0x2b'))[_0xb075('0x10')](_0x16b180,null,_0x16b180+_0xb075('0x11')+_0x40d1a6+'.'+_0x4a2ba3)['where'](_0x40d1a6+_0xb075('0x2c'),_0x4998da)[_0xb075('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb075('0x12')](_0xb075('0x2e'),squel['select']()['field']('phone')[_0xb075('0x28')](_0xb075('0x32'))[_0xb075('0x12')](_0xb075('0x34'),_0x4998da)[_0xb075('0x12')](_0x4a2ba3+_0xb075('0x35'),_0x40d1a6+'.'+_0x4a2ba3)))['toString']();}function insertCmContact(_0x4e78b1,_0x246273,_0x1ca846,_0x1706dd){var _0x408cdc=_['concat'](_[_0xb075('0x36')](_0x1706dd),[_0xb075('0x22'),_0xb075('0x37'),_0xb075('0x23'),_0xb075('0x24')]);return squel[_0xb075('0x1b')]()[_0xb075('0x1c')](_0xb075('0x29'))[_0xb075('0x1e')](_0x408cdc,squel[_0xb075('0x27')]()[_0xb075('0x33')](_0x408cdc)[_0xb075('0x28')](_0x246273)[_0xb075('0x12')]('('+_0x1ca846[_0xb075('0x10')](',')+')\x20NOT\x20IN\x20?',squel[_0xb075('0x27')]()['fields'](_0x1ca846)['from']('cm_contacts')[_0xb075('0x12')]('ListId\x20=\x20?',_0x4e78b1)[_0xb075('0x12')](_0xb075('0x38')))[_0xb075('0x12')](_0xb075('0x39'),squel[_0xb075('0x27')]()[_0xb075('0xf')]('MIN(id)',_0xb075('0x3a'))[_0xb075('0x28')](_0x246273)[_0xb075('0x3b')](_0x1ca846['join'](','))))[_0xb075('0x31')]();}function handleStop(){logger[_0xb075('0x3c')](_0xb075('0x3d'));stopped=!![];}function handleUncaughtException(_0x39f2f4){logger['error'](_0x39f2f4['message']);process[_0xb075('0x3e')](0x1);}function handleError(_0x87e594,_0x3ba156){stats[_0xb075('0x3f')][_0xb075('0x40')]({'name':_0x3ba156[_0xb075('0x41')],'message':_0x3ba156[_0xb075('0x42')],'row':_0x87e594});}function handleQuery(_0x18f814){logger['info'](_0x18f814);return db[_0xb075('0x43')][_0xb075('0x44')](_0x18f814)[_0xb075('0x45')](function(_0x29b51e){results['push'](_0x29b51e);})[_0xb075('0x46')](function(_0x408f45){logger[_0xb075('0x47')](_0x408f45[_0xb075('0x42')]);});}function main(_0x290f6f,_0x290ced,_0x276e30,_0x11267a){logger[_0xb075('0x3c')]('main',_0x290f6f,JSON['stringify'](_0x290ced));process[_0xb075('0x48')](_0xb075('0x49'));var _0x277ad9=_0x290ced[_0xb075('0x4a')];var _0xd2ae1c=_0x290ced[_0xb075('0x4b')];var _0x1cee36=path[_0xb075('0x10')](config[_0xb075('0x4c')],_0xb075('0x4d'),_0xd2ae1c+_0xb075('0x4e'));var _0x4b45d2=_['keys'](_0x277ad9)['join']();logger[_0xb075('0x3c')](_0xb075('0x4f'),_0x4b45d2);fs['writeFileSync'](_0x1cee36,_0x4b45d2+'\x0a');Papa['parse'](fs['createReadStream'](_0x290f6f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x458a1b,_0x5310b9){try{for(var _0x159a13=0x0,_0x519dba=[];_0x159a13<_0x458a1b[_0xb075('0x50')][_0xb075('0x51')];_0x159a13++){stats[_0xb075('0x52')]+=0x1;if(_0x458a1b['errors'][_0x159a13]){handleError(_0x458a1b['data'][_0x159a13],_0x458a1b[_0xb075('0x3f')][_0x159a13]);}else{var _0x436ef7=[];for(var _0x45835e in _0x277ad9){if(_0x277ad9[_0xb075('0x53')](_0x45835e)){if(_0x458a1b[_0xb075('0x50')][_0x159a13][_0x277ad9[_0x45835e]]){var _0x5311d6=_[_0xb075('0x54')](_0x458a1b[_0xb075('0x50')][_0x159a13][_0x277ad9[_0x45835e]][_0xb075('0x55')](/"/g,'\x27'));switch(_0x45835e){case _0xb075('0x20'):var _0x2d5631=moment(_0x5311d6,_0xb075('0xd'),!![]);if(_0x2d5631['isValid']()){_0x519dba[_0xb075('0x40')]('\x22'+_0x5311d6+'\x22');}else{_0x436ef7[_0xb075('0x40')](_0xb075('0x56'));}break;case'priority':var _0x32761b=parseInt(_0x5311d6);_0x5311d6=_[_0xb075('0x57')](_0x32761b)||_0x32761b<0x0||_0x32761b>0x4?_0x11267a?0x3:0x2:_0x32761b;_0x519dba[_0xb075('0x40')]('\x22'+_0x5311d6+'\x22');break;case _0xb075('0x58'):var _0x15c5b4=parseInt(_0x5311d6);if(_[_0xb075('0x59')](_0x15c5b4)&&_[_0xb075('0x5a')](_0x276e30,_0x15c5b4)){_0x519dba['push']('\x22'+_0x15c5b4+'\x22');}else{_0x436ef7[_0xb075('0x40')](_0xb075('0x5b'));}break;case _0xb075('0x5c'):if(isEmail(_0x5311d6)){_0x519dba[_0xb075('0x40')]('\x22'+_0x5311d6+'\x22');}else{_0x436ef7[_0xb075('0x40')]('email\x20wrong\x20format');}break;case _0xb075('0x5d'):var _0x462f39=moment(_0x5311d6,_0xb075('0x5e'),!![]);if(_0x462f39[_0xb075('0x5f')]()){_0x519dba[_0xb075('0x40')]('\x22'+_0x5311d6+'\x22');}else{_0x436ef7['push'](_0xb075('0x60'));}break;default:_0x519dba[_0xb075('0x40')]('\x22'+_0x5311d6+'\x22');}}else{switch(_0x45835e){case _0xb075('0x61'):case _0xb075('0x1f'):_0x436ef7['push'](_0x45835e+'\x20not\x20specified');break;default:_0x519dba[_0xb075('0x40')]('\x22\x22');}}}}if(_0x436ef7[_0xb075('0x51')]){handleError(_0x458a1b[_0xb075('0x50')][_0x159a13],{'code':_0xb075('0x62'),'message':_0x436ef7['join']()});}else{fs['appendFileSync'](_0x1cee36,_0x519dba[_0xb075('0x10')]()+'\x0a');}_0x519dba=[];}if(!(stats['rows']%0xc8)){socket[_0xb075('0x63')](_0xb075('0x64')+_0xd2ae1c,stats);stats[_0xb075('0x3f')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x5310b9['abort']();}}catch(_0x55bf2f){handleError(_0x458a1b[_0xb075('0x50')][_0x159a13],{'code':'SystemError','message':_0x55bf2f['message']});logger[_0xb075('0x47')](_0xb075('0x65'),_0x55bf2f[_0xb075('0x42')]);}},'complete':function(){try{var _0x44c304=[];var _0x4048f0=_0xb075('0x29');if(_0x290ced[_0xb075('0x66')]&&_0x290ced[_0xb075('0x66')]['length']){_0x4048f0='cm_contacts_'+_0xd2ae1c;_0x44c304[_0xb075('0x40')](_0xb075('0x67')+_0x4048f0+_0xb075('0x68'));}var _0x424dcd=util[_0xb075('0xc')](_0xb075('0x69'),_0x1cee36,_0x4048f0,_0x4b45d2,_0x290ced[_0xb075('0x22')],_0x290ced['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x277ad9[_0xb075('0x20')])){_0x424dcd+=_0xb075('0x6a');}_0x44c304[_0xb075('0x40')](_0x424dcd);if(_0x290ced['duplicates']&&_0x290ced[_0xb075('0x66')]['length']){_0x44c304[_0xb075('0x40')](insertCmContact(_0x290ced[_0xb075('0x22')],_0x4048f0,_0x290ced['duplicates'],_0x277ad9));_0x44c304[_0xb075('0x40')](_0xb075('0x6b')+_0x4048f0+';');}_0x44c304['push'](insertCmHopper(_0x290ced[_0xb075('0x22')],'voice_queues_has_cm_lists',_0xb075('0x6c'),_0xb075('0x6d'),_0x11267a));_0x44c304[_0xb075('0x40')](insertCmHopperBlack(_0x290ced[_0xb075('0x22')],_0xb075('0x6e'),_0xb075('0x6c'),_0xb075('0x6d')));_0x44c304[_0xb075('0x40')](insertCmHopper(_0x290ced[_0xb075('0x22')],_0xb075('0x6f'),_0xb075('0x70'),_0xb075('0x71'),_0x11267a));_0x44c304[_0xb075('0x40')](insertCmHopperBlack(_0x290ced[_0xb075('0x22')],_0xb075('0x72'),_0xb075('0x70'),_0xb075('0x71')));BPromise['each'](_0x44c304,handleQuery)[_0xb075('0x73')](function(_0x3de7cd){stats[_0xb075('0x74')]=!![];stats[_0xb075('0x75')]=_0x290ced[_0xb075('0x66')]&&_0x290ced[_0xb075('0x66')][_0xb075('0x51')]?results[0x2][_0xb075('0x75')]:results[0x0][_0xb075('0x75')];socket[_0xb075('0x63')](_0xb075('0x64')+_0xd2ae1c,stats);fs[_0xb075('0x76')](_0x290f6f);fs[_0xb075('0x76')](_0x1cee36);process[_0xb075('0x3e')](0x0);})[_0xb075('0x46')](function(_0x39d253){logger[_0xb075('0x47')](_0x39d253['message']);process['exit'](0x1);});}catch(_0xa162a2){logger['error'](_0xb075('0x77'),_0xa162a2[_0xb075('0x42')]);process[_0xb075('0x3e')](0x1);}},'error':function(_0x294bda,_0x5481a8,_0x2768db,_0x355ead){throw new Error(_0x355ead);}});}function validate(){if(process['argv']&&process[_0xb075('0x78')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x3b21d2=path[_0xb075('0x10')](config[_0xb075('0x4c')],'server/files/tmp',process[_0xb075('0x78')][0x2]);if(!fs[_0xb075('0x79')](_0x3b21d2)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x522d9f={};try{_0x522d9f=JSON['parse'](process[_0xb075('0x78')][0x3]);if(!_0x522d9f[_0xb075('0x4a')]){throw new Error(_0xb075('0x7a'));}if(!_0x522d9f[_0xb075('0x4a')]['phone']){throw new Error(_0xb075('0x7b'));}if(!_0x522d9f['binding']['firstName']){throw new Error(_0xb075('0x7c'));}var _0x4140b6=0x0;if(_0x522d9f['binding'][_0xb075('0x58')]){_0x4140b6=0x1;}if(!_0x522d9f[_0xb075('0x22')]){throw new Error(_0xb075('0x7d'));}}catch(_0x5ee190){throw new Error(_0xb075('0x7e'));}var _0x42e483=[];try{_0x42e483=_[_0xb075('0x7f')](JSON[_0xb075('0x80')](process[_0xb075('0x78')][0x4]),'id');}catch(_0x2d3069){logger[_0xb075('0x3c')](_0xb075('0x81'));}main(_0x3b21d2,_0x522d9f,_0x42e483,_0x4140b6);}validate();process['on'](_0xb075('0x82'),handleStop);process['on'](_0xb075('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 7607d4e..399c4ce 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 _0xe1e3=['***\x20Time\x20Info\x20***','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','destcalleridnum','Member\x20Name','membername','answertime','Complete\x20Time','endtime','Billable\x20Time','billableseconds','getSubjects','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','string','Outbound\x20Call','voice','calleridname','keyValue','destexten','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname'];(function(_0x34950b,_0x266ce7){var _0x1b2b95=function(_0x286011){while(--_0x286011){_0x34950b['push'](_0x34950b['shift']());}};_0x1b2b95(++_0x266ce7);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4ed360,_0x9f6344){_0x4ed360=_0x4ed360-0x0;var _0x151d30=_0xe1e3[_0x4ed360];return _0x151d30;};'use strict';exports[_0x3e1e('0x0')]=function(_0x12da55,_0x55659f){var _0xdbdabb=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x12da55[_0x3e1e('0x1')]()){case'voice':switch(_0x55659f[_0x3e1e('0x1')]()){case _0x3e1e('0x2'):_0xdbdabb[_0x3e1e('0x3')]({'type':_0x3e1e('0x4'),'content':'','variableName':_0x3e1e('0x5')});_0xdbdabb[_0x3e1e('0x3')]({'type':'variable','content':'','variableName':_0x3e1e('0x6')});break;case _0x3e1e('0x7'):_0xdbdabb[_0x3e1e('0x3')]({'type':_0x3e1e('0x8'),'content':_0x3e1e('0x9'),'variableName':null});_0xdbdabb[_0x3e1e('0x3')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0xdbdabb;};exports['getDescriptions']=function(_0x31d205,_0x5b0df8){var _0x349460=[];switch(_0x31d205[_0x3e1e('0x1')]()){case _0x3e1e('0xa'):switch(_0x5b0df8['toLowerCase']()){case _0x3e1e('0x2'):_0x349460=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x3e1e('0x6')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x3e1e('0x4'),'variableName':_0x3e1e('0xb')},{'type':_0x3e1e('0xc'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x3e1e('0xd')},{'type':_0x3e1e('0xc'),'content':'','key':'Queue','keyType':_0x3e1e('0x4'),'variableName':_0x3e1e('0x5')},{'type':'keyValue','content':'','key':_0x3e1e('0xe'),'keyType':'variable','variableName':_0x3e1e('0xf')},{'type':_0x3e1e('0xc'),'content':'','key':_0x3e1e('0x10'),'keyType':_0x3e1e('0x4'),'variableName':_0x3e1e('0x11')},{'type':_0x3e1e('0x8'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0x3e1e('0x4'),'variableName':_0x3e1e('0x12')},{'type':_0x3e1e('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x3e1e('0x4'),'variableName':'destcalleridnum'},{'type':_0x3e1e('0x8'),'content':_0x3e1e('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x3e1e('0xc'),'content':'','key':'Agent\x20Ring','keyType':_0x3e1e('0x4'),'variableName':_0x3e1e('0x11')},{'type':_0x3e1e('0xc'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x3e1e('0x14')},{'type':_0x3e1e('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0x3e1e('0x4'),'variableName':_0x3e1e('0x15')},{'type':_0x3e1e('0xc'),'content':'','key':_0x3e1e('0x16'),'keyType':_0x3e1e('0x4'),'variableName':_0x3e1e('0x17')},{'type':_0x3e1e('0xc'),'content':'','key':_0x3e1e('0x18'),'keyType':'variable','variableName':'talktime'}];break;case _0x3e1e('0x7'):_0x349460=[{'type':_0x3e1e('0x8'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x3e1e('0x4'),'keyContent':'','variableName':_0x3e1e('0x19')},{'type':'keyValue','content':'','key':_0x3e1e('0x1a'),'keyType':'variable','keyContent':'','variableName':_0x3e1e('0x1b')},{'type':_0x3e1e('0xc'),'content':'','key':'UniqueId','keyType':_0x3e1e('0x4'),'keyContent':'','variableName':_0x3e1e('0xf')},{'type':_0x3e1e('0xc'),'content':'','key':'Date','keyType':_0x3e1e('0x4'),'keyContent':'','variableName':'starttime'},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x3e1e('0xc'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x3e1e('0x1c')},{'type':_0x3e1e('0xc'),'content':'','key':_0x3e1e('0x1d'),'keyType':_0x3e1e('0x4'),'keyContent':'','variableName':_0x3e1e('0x1e')},{'type':'keyValue','content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x3e1e('0xc'),'content':'','key':_0x3e1e('0x1f'),'keyType':_0x3e1e('0x4'),'keyContent':'','variableName':_0x3e1e('0x20')}];break;}}return _0x349460;}; \ No newline at end of file +var _0x373d=['Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','queue','push','variable','calleridnum','destcalleridnum','Caller\x20Name','calleridname','keyValue','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***'];(function(_0x1b65a5,_0x1d17a2){var _0x39667a=function(_0x41405e){while(--_0x41405e){_0x1b65a5['push'](_0x1b65a5['shift']());}};_0x39667a(++_0x1d17a2);}(_0x373d,0x1e2));var _0xd373=function(_0x2b35ca,_0x4943ce){_0x2b35ca=_0x2b35ca-0x0;var _0x68389e=_0x373d[_0x2b35ca];return _0x68389e;};'use strict';exports[_0xd373('0x0')]=function(_0x48421b,_0x3d3d31){var _0x53f3b7=[{'type':_0xd373('0x1'),'content':_0xd373('0x2'),'variableName':null}];switch(_0x48421b['toLowerCase']()){case _0xd373('0x3'):switch(_0x3d3d31[_0xd373('0x4')]()){case _0xd373('0x5'):_0x53f3b7['push']({'type':'variable','content':'','variableName':_0xd373('0x6')});_0x53f3b7[_0xd373('0x7')]({'type':_0xd373('0x8'),'content':'','variableName':_0xd373('0x9')});break;case'outbound':_0x53f3b7[_0xd373('0x7')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x53f3b7['push']({'type':_0xd373('0x8'),'content':'','variableName':_0xd373('0xa')});break;}}return _0x53f3b7;};exports['getDescriptions']=function(_0x27a522,_0x234247){var _0x5c899d=[];switch(_0x27a522['toLowerCase']()){case _0xd373('0x3'):switch(_0x234247[_0xd373('0x4')]()){case _0xd373('0x5'):_0x5c899d=[{'type':_0xd373('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0xd373('0x8'),'variableName':_0xd373('0x9')},{'type':'keyValue','content':'','key':_0xd373('0xb'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0xc')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0xe'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0xf')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x10'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0x6')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x11'),'keyType':'variable','variableName':_0xd373('0x12')},{'type':'keyValue','content':'','key':_0xd373('0x13'),'keyType':_0xd373('0x8'),'variableName':'agentcalledAt'},{'type':_0xd373('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xd373('0x14'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0x15')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x16'),'keyType':_0xd373('0x8'),'variableName':'destcalleridnum'},{'type':_0xd373('0x1'),'content':_0xd373('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x18'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0x19')},{'type':'keyValue','content':'','key':_0xd373('0x1a'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0x1b')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x1c'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0x1d')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x1e'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0x1f')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x20'),'keyType':_0xd373('0x8'),'variableName':_0xd373('0x21')}];break;case _0xd373('0x22'):_0x5c899d=[{'type':_0xd373('0x1'),'content':_0xd373('0x23'),'variableName':null},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x24'),'keyType':_0xd373('0x8'),'keyContent':'','variableName':_0xd373('0xa')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x25'),'keyType':_0xd373('0x8'),'keyContent':'','variableName':_0xd373('0x26')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x11'),'keyType':_0xd373('0x8'),'keyContent':'','variableName':_0xd373('0x12')},{'type':'keyValue','content':'','key':_0xd373('0x13'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0xd373('0x1'),'content':_0xd373('0x17')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x27'),'keyType':_0xd373('0x8'),'keyContent':'','variableName':'answertime'},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x28'),'keyType':'variable','keyContent':'','variableName':_0xd373('0x29')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x2a'),'keyType':_0xd373('0x8'),'keyContent':'','variableName':_0xd373('0x2b')},{'type':_0xd373('0xd'),'content':'','key':_0xd373('0x2c'),'keyType':_0xd373('0x8'),'keyContent':'','variableName':_0xd373('0x2d')}];break;}}return _0x5c899d;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 521ef9e..f00034c 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 _0xb3c2=['../../config/logger','mail-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','update','then','catch','error','tracked','user','query','clone','omit','body','html','fax','mobile','lodash','../../mysqldb','openchannel-interactions'];(function(_0x4f84c3,_0x6d094d){var _0x460f9f=function(_0x5af5bd){while(--_0x5af5bd){_0x4f84c3['push'](_0x4f84c3['shift']());}};_0x460f9f(++_0x6d094d);}(_0xb3c2,0x152));var _0x2b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2b3c('0x0'));var db=require(_0x2b3c('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x2b3c('0x2')),'mail':require(_0x2b3c('0x3'))(_0x2b3c('0x4')),'fax':require(_0x2b3c('0x3'))('fax-interactions'),'sms':require(_0x2b3c('0x3'))(_0x2b3c('0x5')),'chat':require(_0x2b3c('0x3'))(_0x2b3c('0x6')),'whatsapp':require(_0x2b3c('0x3'))('whatsapp-interactions')};function getInteractionId(_0xb477eb,_0x44266d,_0x2362a9){if(_0xb477eb&&_0xb477eb[_[_0x2b3c('0x7')](_0x2362a9)+'InteractionId']){return _0xb477eb[_['upperFirst'](_0x2362a9)+_0x2b3c('0x8')];}else if(_0xb477eb&&_0xb477eb['id']){return _0xb477eb['id'];}else if(_0x44266d&&_0x44266d['id']){return _0x44266d['id'];}else{return _0x2b3c('0x9');}}function log(_0x3fea73,_0x535546,_0x149a3a,_0x1a8e9d,_0x32209a,_0x2465e2){loggers[_0x32209a[_0x2b3c('0xa')]()][_0x3fea73](_0x2b3c('0xb'),_0x2465e2[_0x2b3c('0xc')](),_0x535546?_0x535546['id']:null,_0x535546?_0x535546[_0x2b3c('0xd')]:null,_0x535546?_0x535546[_0x2b3c('0xe')]:null,getInteractionId(_0x149a3a,_0x1a8e9d,_0x32209a),_0x149a3a?JSON[_0x2b3c('0xf')](_0x149a3a):'null');}function updateUser(_0x194c22,_0x5b5518,_0x37fce5,_0x3604f2,_0x539c4a){db[_[_0x2b3c('0x7')](_0x3604f2)+_0x2b3c('0x10')][_0x2b3c('0x11')]({'where':{'id':getInteractionId(_0x5b5518,_0x37fce5,_0x3604f2)}})['then'](function(_0x3238a9){if(_0x3238a9){return _0x3238a9[_0x2b3c('0x12')]({'UserId':_0x194c22?_0x194c22['id']:null});}})[_0x2b3c('0x13')](function(_0x392c19){if(_0x392c19){log('info',_0x194c22,_0x5b5518,_0x37fce5,_0x3604f2,_0x539c4a);}})[_0x2b3c('0x14')](function(){log(_0x2b3c('0x15'),_0x194c22,_0x5b5518,_0x37fce5,_0x3604f2,_0x539c4a);});}exports[_0x2b3c('0x16')]=function(_0x38b053,_0x149d59){return function(_0x696908,_0x2b1703,_0x18864c){var _0x433ce6=_0x696908[_0x2b3c('0x17')];var _0x5ad3d9={};var _0x14fb01=_0x696908[_0x2b3c('0x18')];if(_0x5ad3d9){_0x5ad3d9=_[_0x2b3c('0x19')](_0x696908['body']);_0x5ad3d9=_[_0x2b3c('0x1a')](_0x5ad3d9,[_0x2b3c('0x1b'),_0x2b3c('0x1c'),'phone',_0x2b3c('0x1d'),_0x2b3c('0x1e')]);}updateUser(_0x433ce6,_0x5ad3d9,_0x14fb01,_0x38b053,_0x149d59);_0x18864c(null);};}; \ No newline at end of file +var _0x6f72=['whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','then','update','info','error','tracked','user','query','clone','body','omit','html','phone','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions'];(function(_0x4f7c87,_0x3f526e){var _0x4021b6=function(_0x8e7304){while(--_0x8e7304){_0x4f7c87['push'](_0x4f7c87['shift']());}};_0x4021b6(++_0x3f526e);}(_0x6f72,0xae));var _0x26f7=function(_0x25ead1,_0x53c173){_0x25ead1=_0x25ead1-0x0;var _0x4d899d=_0x6f72[_0x25ead1];return _0x4d899d;};'use strict';var _=require('lodash');var db=require(_0x26f7('0x0'))['db'];var loggers={'openchannel':require(_0x26f7('0x1'))(_0x26f7('0x2')),'mail':require('../../config/logger')(_0x26f7('0x3')),'fax':require(_0x26f7('0x1'))('fax-interactions'),'sms':require(_0x26f7('0x1'))(_0x26f7('0x4')),'chat':require('../../config/logger')(_0x26f7('0x5')),'whatsapp':require('../../config/logger')(_0x26f7('0x6'))};function getInteractionId(_0x529e3f,_0x36ea93,_0x21de0c){if(_0x529e3f&&_0x529e3f[_['upperFirst'](_0x21de0c)+'InteractionId']){return _0x529e3f[_[_0x26f7('0x7')](_0x21de0c)+_0x26f7('0x8')];}else if(_0x529e3f&&_0x529e3f['id']){return _0x529e3f['id'];}else if(_0x36ea93&&_0x36ea93['id']){return _0x36ea93['id'];}else{return _0x26f7('0x9');}}function log(_0x2ffa31,_0x31cec1,_0x10f761,_0x1ade91,_0x212ec7,_0x47cecb){loggers[_0x212ec7[_0x26f7('0xa')]()][_0x2ffa31]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47cecb[_0x26f7('0xb')](),_0x31cec1?_0x31cec1['id']:null,_0x31cec1?_0x31cec1[_0x26f7('0xc')]:null,_0x31cec1?_0x31cec1[_0x26f7('0xd')]:null,getInteractionId(_0x10f761,_0x1ade91,_0x212ec7),_0x10f761?JSON[_0x26f7('0xe')](_0x10f761):_0x26f7('0xf'));}function updateUser(_0x2e1300,_0x157bcc,_0x64b65a,_0x3e3fab,_0x263e02){db[_[_0x26f7('0x7')](_0x3e3fab)+_0x26f7('0x10')]['findOne']({'where':{'id':getInteractionId(_0x157bcc,_0x64b65a,_0x3e3fab)}})[_0x26f7('0x11')](function(_0xe6ba20){if(_0xe6ba20){return _0xe6ba20[_0x26f7('0x12')]({'UserId':_0x2e1300?_0x2e1300['id']:null});}})[_0x26f7('0x11')](function(_0x5014b2){if(_0x5014b2){log(_0x26f7('0x13'),_0x2e1300,_0x157bcc,_0x64b65a,_0x3e3fab,_0x263e02);}})['catch'](function(){log(_0x26f7('0x14'),_0x2e1300,_0x157bcc,_0x64b65a,_0x3e3fab,_0x263e02);});}exports[_0x26f7('0x15')]=function(_0x27d28f,_0x230f21){return function(_0x528786,_0x491518,_0x3b48b6){var _0x49b3de=_0x528786[_0x26f7('0x16')];var _0x3f24f6={};var _0x14f5b0=_0x528786[_0x26f7('0x17')];if(_0x3f24f6){_0x3f24f6=_[_0x26f7('0x18')](_0x528786[_0x26f7('0x19')]);_0x3f24f6=_[_0x26f7('0x1a')](_0x3f24f6,[_0x26f7('0x19'),_0x26f7('0x1b'),_0x26f7('0x1c'),'fax',_0x26f7('0x1d')]);}updateUser(_0x49b3de,_0x3f24f6,_0x14f5b0,_0x27d28f,_0x230f21);_0x3b48b6(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 92804eb..de8349b 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 _0x3f93=['aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','split','createDecipher'];(function(_0x6b0731,_0x4ff682){var _0x462a9e=function(_0x168ae3){while(--_0x168ae3){_0x6b0731['push'](_0x6b0731['shift']());}};_0x462a9e(++_0x4ff682);}(_0x3f93,0xac));var _0x33f9=function(_0x2f4755,_0x72c913){_0x2f4755=_0x2f4755-0x0;var _0x375bd0=_0x3f93[_0x2f4755];return _0x375bd0;};'use strict';var crypto=require(_0x33f9('0x0'));var util=require(_0x33f9('0x1'));var compose=require(_0x33f9('0x2'));var db=require(_0x33f9('0x3'))['db'];var config=require(_0x33f9('0x4'));function getValueFromLicense(_0x2f4998,_0x7d945c){if(_0x2f4998&&_0x7d945c){if(_0x7d945c[_0x33f9('0x5')]&&_0x7d945c['license']){var _0x2cf7be=_0x7d945c[_0x33f9('0x5')];var _0x577163=_0x7d945c['license'];var _0x18c271=_0x2cf7be[_0x33f9('0x6')]('-')[0x4];var _0x26cc20=_0x2cf7be[_0x33f9('0x6')]('-')[0x0];var _0x452631=crypto[_0x33f9('0x7')](_0x33f9('0x8'),util[_0x33f9('0x9')](_0x33f9('0xa'),_0x18c271,_0x2cf7be,_0x26cc20));var _0x1747da=_0x452631[_0x33f9('0xb')](_0x577163,_0x33f9('0xc'),_0x33f9('0xd'));_0x1747da+=_0x452631[_0x33f9('0xe')]('utf8');var _0x12061e=JSON[_0x33f9('0xf')](_0x1747da);return _0x12061e[_0x33f9('0x10')](_0x2f4998)?_0x12061e[_0x2f4998]:null;}}return null;}function isLimit(_0xb78d10,_0x773313,_0x92e6da,_0x273981){var _0x4d8071=_0x773313;return compose()[_0x33f9('0x11')](function(_0xaf9874,_0x3d3f13,_0x5c6046){return db[_0x33f9('0x12')][_0x33f9('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x33f9('0x14')](function(_0x10ec70){var _0xd85528=getValueFromLicense(_0xb78d10,_0x10ec70);return _0xd85528?_0xd85528:_0x4d8071;})['then'](function(_0x5952ac){_0x4d8071=_0x5952ac;return _0x92e6da[_0x33f9('0x15')](_0x273981);})['then'](function(_0x31205c){if(_0x31205c>=_0x4d8071){return _0x3d3f13[_0x33f9('0x16')](0x193)[_0x33f9('0x17')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xb78d10)});}_0x5c6046();})[_0x33f9('0x18')](function(_0x43ab30){_0x5c6046(_0x43ab30);});});}function isUserLimit(){return isLimit(_0x33f9('0x19'),0x1,db[_0x33f9('0x1a')],{'where':{'$or':[{'role':_0x33f9('0x1b')},{'role':_0x33f9('0x1c')}]}});}exports[_0x33f9('0x1d')]=isUserLimit; \ No newline at end of file +var _0x1319=['then','count','status','json','catch','User','admin','user','crypto','util','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty'];(function(_0x551bc4,_0x330316){var _0x5af907=function(_0x41d277){while(--_0x41d277){_0x551bc4['push'](_0x551bc4['shift']());}};_0x5af907(++_0x330316);}(_0x1319,0x1a0));var _0x9131=function(_0x26d353,_0x1623f9){_0x26d353=_0x26d353-0x0;var _0x40847a=_0x1319[_0x26d353];return _0x40847a;};'use strict';var crypto=require(_0x9131('0x0'));var util=require(_0x9131('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x9131('0x2'));function getValueFromLicense(_0xb735d0,_0x18dbe9){if(_0xb735d0&&_0x18dbe9){if(_0x18dbe9[_0x9131('0x3')]&&_0x18dbe9[_0x9131('0x4')]){var _0x5ba21c=_0x18dbe9[_0x9131('0x3')];var _0x21a034=_0x18dbe9[_0x9131('0x4')];var _0x41c493=_0x5ba21c[_0x9131('0x5')]('-')[0x4];var _0x4620dc=_0x5ba21c[_0x9131('0x5')]('-')[0x0];var _0x495586=crypto[_0x9131('0x6')](_0x9131('0x7'),util[_0x9131('0x8')](_0x9131('0x9'),_0x41c493,_0x5ba21c,_0x4620dc));var _0xda808c=_0x495586[_0x9131('0xa')](_0x21a034,_0x9131('0xb'),_0x9131('0xc'));_0xda808c+=_0x495586[_0x9131('0xd')](_0x9131('0xc'));var _0x5d9f1c=JSON[_0x9131('0xe')](_0xda808c);return _0x5d9f1c[_0x9131('0xf')](_0xb735d0)?_0x5d9f1c[_0xb735d0]:null;}}return null;}function isLimit(_0x17d11b,_0x58928f,_0x2bc02b,_0x5305be){var _0x3aaf70=_0x58928f;return compose()['use'](function(_0x445447,_0x80b1ca,_0x52af9f){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x9131('0x10')](function(_0x5d8149){var _0x36b6d8=getValueFromLicense(_0x17d11b,_0x5d8149);return _0x36b6d8?_0x36b6d8:_0x3aaf70;})[_0x9131('0x10')](function(_0xf66a92){_0x3aaf70=_0xf66a92;return _0x2bc02b[_0x9131('0x11')](_0x5305be);})[_0x9131('0x10')](function(_0x4900a9){if(_0x4900a9>=_0x3aaf70){return _0x80b1ca[_0x9131('0x12')](0x193)[_0x9131('0x13')]({'message':util[_0x9131('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x17d11b)});}_0x52af9f();})[_0x9131('0x14')](function(_0x3c4821){_0x52af9f(_0x3c4821);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x9131('0x15')],{'where':{'$or':[{'role':_0x9131('0x16')},{'role':_0x9131('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4413c79..d2273f2 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 _0xbe30=['$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift','match','filter','indexOf','push','$eq','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','<>\x20?','$substring'];(function(_0x47312f,_0x1e87b8){var _0x4566a5=function(_0x2ccbc4){while(--_0x2ccbc4){_0x47312f['push'](_0x47312f['shift']());}};_0x4566a5(++_0x1e87b8);}(_0xbe30,0x79));var _0x0be3=function(_0x192f58,_0x79b210){_0x192f58=_0x192f58-0x0;var _0x86ebf5=_0xbe30[_0x192f58];return _0x86ebf5;};'use strict';var _=require(_0x0be3('0x0'));var moment=require(_0x0be3('0x1'));exports[_0x0be3('0x2')]=function(_0x393b4d){var _0x58193b={'conditions':[]};_0x58193b[_0x0be3('0x3')]=_[_0x0be3('0x4')](_0x393b4d,_0x0be3('0x5'))?'or':_0x0be3('0x6');var _0x40713e=_0x393b4d[_0x0be3('0x7')](_0x0be3('0x8'),'')[_0x0be3('0x7')](_0x0be3('0x5'),'')['split']('||');for(var _0x36e015=0x0;_0x36e015<_0x40713e[_0x0be3('0x9')];_0x36e015++){var _0x37ec1e=_0x40713e[_0x36e015][_0x0be3('0xa')](':=');var _0x1c8b25=_0x37ec1e[0x0];var _0x4f0fd4=_0x37ec1e[_0x0be3('0xb')](0x1);_0x4f0fd4[_0x0be3('0xc')](function(_0x590863){var _0xe8778b=_0x590863['split']('[')[_0x0be3('0xd')]();var _0x2b5a34=_0x590863[_0x0be3('0xe')](/\[(.*?)\]/g);_0x2b5a34['forEach'](function(_0x262b06){var _0x160d80=_0x262b06[_0x0be3('0xa')]('[')[_0x0be3('0xf')](function(_0xc8f659){return _0xc8f659[_0x0be3('0x10')](']')>-0x1;})['map'](function(_0x5d8130){return _0x5d8130[_0x0be3('0xa')](']')[0x0];})[0x0];_0x58193b['conditions'][_0x0be3('0x11')]({'field':_0x1c8b25,'operator':_0xe8778b,'value':_0x160d80});});});}return _0x58193b;};exports['buildExpression']=function(_0x4f5463,_0x1fd6f8,_0x1ba821){var _0x453395={};if(_0x1fd6f8==='DATE'){if(_0x1ba821['operator']===_0x0be3('0x12')){_0x1ba821[_0x0be3('0x13')]=_0x0be3('0x14');_0x1ba821[_0x0be3('0x15')]+=','+_0x1ba821[_0x0be3('0x15')];}else if(_['includes']([_0x0be3('0x16'),_0x0be3('0x17')],_0x1ba821[_0x0be3('0x13')])){_0x1ba821[_0x0be3('0x15')]=moment(_0x1ba821[_0x0be3('0x15')])[_0x0be3('0x18')](0x1,_0x0be3('0x19'))[_0x0be3('0x1a')](_0x0be3('0x1b'));}}if(_0x1ba821['castTo']){_0x1fd6f8=_0x1ba821[_0x0be3('0x1c')];_0x453395[_0x0be3('0x1d')]=_0x0be3('0x1e')+_0x4f5463+'.'+_0x1ba821['field']+'\x20AS\x20'+_0x1ba821[_0x0be3('0x1c')]+')\x20'+parseOperator(_0x1ba821['operator']);}else{_0x453395[_0x0be3('0x1d')]=_0x4f5463+'.'+_0x1ba821[_0x0be3('0x1f')]+'\x20'+parseOperator(_0x1ba821[_0x0be3('0x13')]);}if(_[_0x0be3('0x20')]([_0x0be3('0x21'),_0x0be3('0x22')],_0x1ba821[_0x0be3('0x13')]))_0x453395[_0x0be3('0x1d')]='('+_0x453395[_0x0be3('0x1d')]+_0x0be3('0x23')+_0x4f5463+'.'+_0x1ba821[_0x0be3('0x1f')]+_0x0be3('0x24');_0x453395['value']=parseValue(_0x1fd6f8,_0x1ba821[_0x0be3('0x13')],_0x1ba821[_0x0be3('0x15')]);return _0x453395;};function parseOperator(_0x241753){var _0x424268;switch(_0x241753){case _0x0be3('0x25'):_0x424268='IN\x20?';break;case _0x0be3('0x22'):_0x424268=_0x0be3('0x26');break;case _0x0be3('0x12'):_0x424268='=\x20?';break;case _0x0be3('0x21'):_0x424268=_0x0be3('0x27');break;case _0x0be3('0x28'):case _0x0be3('0x29'):case _0x0be3('0x2a'):_0x424268=_0x0be3('0x2b');break;case _0x0be3('0x2c'):_0x424268='<\x20?';break;case _0x0be3('0x16'):_0x424268=_0x0be3('0x2d');break;case _0x0be3('0x17'):_0x424268='<=\x20?';break;case'$gte':_0x424268=_0x0be3('0x2e');break;case _0x0be3('0x14'):_0x424268=_0x0be3('0x2f');break;}return _0x424268;}function parseValue(_0x46b57a,_0x177789,_0x230e20){var _0x59e1e4={'start':undefined,'end':undefined};switch(_0x177789){case _0x0be3('0x25'):case _0x0be3('0x22'):_0x59e1e4[_0x0be3('0x30')]=_0x230e20[_0x0be3('0xa')](',');break;case _0x0be3('0x28'):_0x59e1e4['start']='%'+_0x230e20+'%';break;case _0x0be3('0x29'):_0x59e1e4[_0x0be3('0x30')]=_0x230e20+'%';break;case _0x0be3('0x2a'):_0x59e1e4[_0x0be3('0x30')]='%'+_0x230e20;break;case _0x0be3('0x14'):var _0x7ad610=_0x230e20[_0x0be3('0xa')](',');var _0x230e20=_0x7ad610['shift']();var _0x149b4c=_0x7ad610[_0x0be3('0x31')]();if(_0x46b57a===_0x0be3('0x32')){_0x230e20=moment(_0x230e20)['utcOffset'](0x0,!![])['format']();_0x149b4c=moment(_0x149b4c)['utcOffset'](0x0,!![])[_0x0be3('0x18')](0x17,_0x0be3('0x33'))[_0x0be3('0x18')](0x3b,_0x0be3('0x34'))['add'](0x3b,_0x0be3('0x35'))['format']();}_0x59e1e4={'start':_0x230e20,'end':_0x149b4c};break;default:_0x59e1e4[_0x0be3('0x30')]=_0x230e20;break;}return _0x59e1e4;} \ No newline at end of file +var _0xa13e=['lodash','parseSearch','sqlOperator','[$or]','and','split','length','slice','forEach','shift','match','filter','map','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','\x20AS\x20','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','add','hours','minutes','seconds'];(function(_0x51985e,_0x2f65f8){var _0x3f8bff=function(_0x3e6639){while(--_0x3e6639){_0x51985e['push'](_0x51985e['shift']());}};_0x3f8bff(++_0x2f65f8);}(_0xa13e,0x138));var _0xea13=function(_0x1f9de7,_0x20d567){_0x1f9de7=_0x1f9de7-0x0;var _0x3e4588=_0xa13e[_0x1f9de7];return _0x3e4588;};'use strict';var _=require(_0xea13('0x0'));var moment=require('moment');exports[_0xea13('0x1')]=function(_0x54fa66){var _0x245a5b={'conditions':[]};_0x245a5b[_0xea13('0x2')]=_['startsWith'](_0x54fa66,_0xea13('0x3'))?'or':_0xea13('0x4');var _0x3a3da6=_0x54fa66['replace']('[$and]','')['replace']('[$or]','')[_0xea13('0x5')]('||');for(var _0x421a84=0x0;_0x421a84<_0x3a3da6[_0xea13('0x6')];_0x421a84++){var _0x229597=_0x3a3da6[_0x421a84][_0xea13('0x5')](':=');var _0x12b8fc=_0x229597[0x0];var _0x38849d=_0x229597[_0xea13('0x7')](0x1);_0x38849d[_0xea13('0x8')](function(_0x3207d6){var _0x3355a3=_0x3207d6[_0xea13('0x5')]('[')[_0xea13('0x9')]();var _0xd50c50=_0x3207d6[_0xea13('0xa')](/\[(.*?)\]/g);_0xd50c50[_0xea13('0x8')](function(_0x4419df){var _0x4d235c=_0x4419df[_0xea13('0x5')]('[')[_0xea13('0xb')](function(_0x1745e8){return _0x1745e8['indexOf'](']')>-0x1;})[_0xea13('0xc')](function(_0x52fa4b){return _0x52fa4b[_0xea13('0x5')](']')[0x0];})[0x0];_0x245a5b['conditions']['push']({'field':_0x12b8fc,'operator':_0x3355a3,'value':_0x4d235c});});});}return _0x245a5b;};exports[_0xea13('0xd')]=function(_0x55da0b,_0x3bea3d,_0x1390c8){var _0x22cf2a={};if(_0x3bea3d===_0xea13('0xe')){if(_0x1390c8['operator']===_0xea13('0xf')){_0x1390c8[_0xea13('0x10')]=_0xea13('0x11');_0x1390c8['value']+=','+_0x1390c8[_0xea13('0x12')];}else if(_[_0xea13('0x13')]([_0xea13('0x14'),_0xea13('0x15')],_0x1390c8[_0xea13('0x10')])){_0x1390c8['value']=moment(_0x1390c8['value'])['add'](0x1,_0xea13('0x16'))[_0xea13('0x17')](_0xea13('0x18'));}}if(_0x1390c8[_0xea13('0x19')]){_0x3bea3d=_0x1390c8[_0xea13('0x19')];_0x22cf2a['text']='CAST('+_0x55da0b+'.'+_0x1390c8['field']+_0xea13('0x1a')+_0x1390c8[_0xea13('0x19')]+')\x20'+parseOperator(_0x1390c8[_0xea13('0x10')]);}else{_0x22cf2a[_0xea13('0x1b')]=_0x55da0b+'.'+_0x1390c8[_0xea13('0x1c')]+'\x20'+parseOperator(_0x1390c8[_0xea13('0x10')]);}if(_[_0xea13('0x13')]([_0xea13('0x1d'),_0xea13('0x1e')],_0x1390c8[_0xea13('0x10')]))_0x22cf2a[_0xea13('0x1b')]='('+_0x22cf2a['text']+_0xea13('0x1f')+_0x55da0b+'.'+_0x1390c8[_0xea13('0x1c')]+_0xea13('0x20');_0x22cf2a[_0xea13('0x12')]=parseValue(_0x3bea3d,_0x1390c8[_0xea13('0x10')],_0x1390c8['value']);return _0x22cf2a;};function parseOperator(_0xdc3b23){var _0x468ee4;switch(_0xdc3b23){case _0xea13('0x21'):_0x468ee4=_0xea13('0x22');break;case _0xea13('0x1e'):_0x468ee4='NOT\x20IN\x20?';break;case'$eq':_0x468ee4=_0xea13('0x23');break;case _0xea13('0x1d'):_0x468ee4=_0xea13('0x24');break;case _0xea13('0x25'):case _0xea13('0x26'):case _0xea13('0x27'):_0x468ee4='LIKE\x20?';break;case'$lt':_0x468ee4=_0xea13('0x28');break;case _0xea13('0x14'):_0x468ee4=_0xea13('0x29');break;case _0xea13('0x15'):_0x468ee4=_0xea13('0x2a');break;case _0xea13('0x2b'):_0x468ee4=_0xea13('0x2c');break;case _0xea13('0x11'):_0x468ee4=_0xea13('0x2d');break;}return _0x468ee4;}function parseValue(_0x55ec8b,_0x29ea6f,_0x5b9984){var _0x49d906={'start':undefined,'end':undefined};switch(_0x29ea6f){case'$in':case _0xea13('0x1e'):_0x49d906['start']=_0x5b9984['split'](',');break;case _0xea13('0x25'):_0x49d906['start']='%'+_0x5b9984+'%';break;case'$startsWith':_0x49d906[_0xea13('0x2e')]=_0x5b9984+'%';break;case _0xea13('0x27'):_0x49d906[_0xea13('0x2e')]='%'+_0x5b9984;break;case _0xea13('0x11'):var _0x8d6e6d=_0x5b9984[_0xea13('0x5')](',');var _0x5b9984=_0x8d6e6d['shift']();var _0x2b009a=_0x8d6e6d['pop']();if(_0x55ec8b===_0xea13('0xe')){_0x5b9984=moment(_0x5b9984)[_0xea13('0x2f')](0x0,!![])[_0xea13('0x17')]();_0x2b009a=moment(_0x2b009a)[_0xea13('0x2f')](0x0,!![])[_0xea13('0x30')](0x17,_0xea13('0x31'))[_0xea13('0x30')](0x3b,_0xea13('0x32'))[_0xea13('0x30')](0x3b,_0xea13('0x33'))[_0xea13('0x17')]();}_0x49d906={'start':_0x5b9984,'end':_0x2b009a};break;default:_0x49d906[_0xea13('0x2e')]=_0x5b9984;break;}return _0x49d906;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6453df3..610e352 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 _0x9836=['isEmpty','type','parse','format','YYYY-MM-DD','utc','subtract','name','isArray','limit','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','push','join','lodash','sequelize','moment','split','filters'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0x9836,0x148));var _0x6983=function(_0x40a4ee,_0x515400){_0x40a4ee=_0x40a4ee-0x0;var _0x57c3cc=_0x9836[_0x40a4ee];return _0x57c3cc;};'use strict';var _=require(_0x6983('0x0'));var sequelize=require(_0x6983('0x1'));var moment=require(_0x6983('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x9df38c){var _0x39dc7d=null;if(_0x9df38c){_0x39dc7d=_0x9df38c[_0x6983('0x3')](',');}return _0x39dc7d;};exports[_0x6983('0x4')]=function(_0x3d0fb4,_0x35c5bb){var _0x8ec6da={};if(!_[_0x6983('0x5')](_0x3d0fb4)){_['forOwn'](_0x3d0fb4,function(_0x4e2c5f,_0x3fba19){try{if(_0x35c5bb){var _0xcc67fe=_['find'](_0x35c5bb,{'name':_0x3fba19})||{};if(_0xcc67fe[_0x6983('0x6')]==='DATE'&&_['isPlainObject'](_0x4e2c5f)){var _0x1e6762=JSON[_0x6983('0x7')](_0x4e2c5f);var _0x4bf690={'$gte':moment(moment(_0x1e6762['$gte'])[_0x6983('0x8')](_0x6983('0x9')))[_0x6983('0xa')]()['format'](),'$lte':moment(moment(_0x1e6762['$lte'])[_0x6983('0x8')](_0x6983('0x9')))[_0x6983('0xa')]()[_0x6983('0xb')](0x1,'s')['format']()};_0x8ec6da[_0x3fba19]=_0x4bf690;}else if(_0xcc67fe[_0x6983('0xc')]==='uniqueid'){_0x8ec6da[_0x3fba19]=_0x4e2c5f;}else{_0x8ec6da[_0x3fba19]=_['isArray'](_0x4e2c5f)?_0x4e2c5f:JSON[_0x6983('0x7')](_0x4e2c5f);}}else{_0x8ec6da[_0x3fba19]=_[_0x6983('0xd')](_0x4e2c5f)?_0x4e2c5f:JSON[_0x6983('0x7')](_0x4e2c5f);}}catch(_0x5e4fdc){_0x8ec6da[_0x3fba19]=_0x4e2c5f[_0x6983('0x3')](',');}});}return _0x8ec6da;};exports[_0x6983('0xe')]=function(_0x3edea8){_0x3edea8=parseInt(_0x3edea8,0xa);if(!_0x3edea8||_0x3edea8<0x0){_0x3edea8=LIMIT_VALUE;}return _0x3edea8;};exports[_0x6983('0xf')]=function(_0x43f4b9){_0x43f4b9=parseInt(_0x43f4b9,0xa);if(!_0x43f4b9||_0x43f4b9<0x0){_0x43f4b9=0x0;}return _0x43f4b9;};exports[_0x6983('0x10')]=function(_0x5e6822){var _0xc59601,_0x499c95=null;if(_0x5e6822){_0xc59601=_0x5e6822[_0x6983('0x3')](',');_0x499c95=_[_0x6983('0x11')](_0xc59601,function(_0x369b39){if(_0x369b39[_0x6983('0x12')]('-')===0x0){return[_0x369b39==='priority'?sequelize[_0x6983('0x13')](sequelize[_0x6983('0x14')](_0x6983('0x15')),_0x6983('0x16')):_0x369b39[_0x6983('0x17')](0x1),'DESC'];}else{return[_0x369b39===_0x6983('0x15')?sequelize[_0x6983('0x13')](sequelize[_0x6983('0x14')](_0x6983('0x15')),'unsigned'):_0x369b39,_0x6983('0x18')];}});}return _0x499c95;};exports[_0x6983('0x19')]=function(_0x37a52d,_0x132c21){if(_[_0x6983('0x5')](_0x37a52d)){return _0x37a52d;}if(_[_0x6983('0xd')](_0x37a52d)){for(var _0x166ff7=0x0;_0x166ff7<_0x37a52d[_0x6983('0x1a')];_0x166ff7+=0x1){_0x37a52d[_0x166ff7]=this[_0x6983('0x19')](_0x37a52d[_0x166ff7],_0x132c21);}return _0x37a52d;}if(!_[_0x6983('0x1b')](_0x37a52d)){return _0x37a52d;}if(_[_0x6983('0x1c')](_0x132c21)){_0x132c21=[_0x132c21];}if(!_[_0x6983('0xd')](_0x132c21)){return _0x37a52d;}for(var _0x74763=0x0;_0x74763<_0x132c21[_0x6983('0x1a')];_0x74763+=0x1){_[_0x6983('0x1d')](_0x37a52d,_0x132c21[_0x74763]);}for(var _0x1ba170 in _0x37a52d){if(_0x37a52d[_0x6983('0x1e')](_0x1ba170)){_0x37a52d[_0x1ba170]=this[_0x6983('0x19')](_0x37a52d[_0x1ba170],_0x132c21);}}return _0x37a52d;};exports['isNumeric']=function(_0x202e1f){return _0x202e1f[_0x6983('0x1f')](RegExp(_0x6983('0x20')))?!![]:![];};exports['isEmail']=function(_0x24f5ad){return _0x24f5ad[_0x6983('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0x6983('0x21')]=function(_0x88f4a0){var _0x4e291d=[];_0x88f4a0[_0x6983('0x3')](/[ ,]+/)[_0x6983('0x22')](function(_0x940d1f){_0x940d1f=_0x940d1f['replace'](/([^:]")"+/g,'$1');_0x940d1f='+'+_0x940d1f+'*';if(_0x940d1f['includes']('@'))_0x940d1f='\x22'+_0x940d1f+'\x22';_0x4e291d[_0x6983('0x23')](_0x940d1f);});return _0x4e291d[_0x6983('0x24')]('\x20');}; \ No newline at end of file +var _0xb304=['hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','lodash','sequelize','filters','forOwn','find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','map','priority','unsigned','substr','DESC','ASC','isEmpty','length','omit','isObject','isString','unset'];(function(_0x1c94e9,_0x3164a3){var _0x1eb100=function(_0x3d52e9){while(--_0x3d52e9){_0x1c94e9['push'](_0x1c94e9['shift']());}};_0x1eb100(++_0x3164a3);}(_0xb304,0xf9));var _0x4b30=function(_0x315b01,_0x583ac1){_0x315b01=_0x315b01-0x0;var _0x37c9c4=_0xb304[_0x315b01];return _0x37c9c4;};'use strict';var _=require(_0x4b30('0x0'));var sequelize=require(_0x4b30('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x333672){var _0x347f93=null;if(_0x333672){_0x347f93=_0x333672['split'](',');}return _0x347f93;};exports[_0x4b30('0x2')]=function(_0x5ae492,_0x2a60ee){var _0x41e0f6={};if(!_['isEmpty'](_0x5ae492)){_[_0x4b30('0x3')](_0x5ae492,function(_0x385caf,_0x14b992){try{if(_0x2a60ee){var _0x5a73f8=_[_0x4b30('0x4')](_0x2a60ee,{'name':_0x14b992})||{};if(_0x5a73f8[_0x4b30('0x5')]===_0x4b30('0x6')&&_[_0x4b30('0x7')](_0x385caf)){var _0x3366fd=JSON[_0x4b30('0x8')](_0x385caf);var _0x452d51={'$gte':moment(moment(_0x3366fd['$gte'])[_0x4b30('0x9')](_0x4b30('0xa')))[_0x4b30('0xb')]()[_0x4b30('0x9')](),'$lte':moment(moment(_0x3366fd[_0x4b30('0xc')])[_0x4b30('0x9')](_0x4b30('0xa')))['utc']()[_0x4b30('0xd')](0x1,'s')[_0x4b30('0x9')]()};_0x41e0f6[_0x14b992]=_0x452d51;}else if(_0x5a73f8[_0x4b30('0xe')]===_0x4b30('0xf')){_0x41e0f6[_0x14b992]=_0x385caf;}else{_0x41e0f6[_0x14b992]=_['isArray'](_0x385caf)?_0x385caf:JSON[_0x4b30('0x8')](_0x385caf);}}else{_0x41e0f6[_0x14b992]=_[_0x4b30('0x10')](_0x385caf)?_0x385caf:JSON['parse'](_0x385caf);}}catch(_0x36481f){_0x41e0f6[_0x14b992]=_0x385caf[_0x4b30('0x11')](',');}});}return _0x41e0f6;};exports[_0x4b30('0x12')]=function(_0x354d5a){_0x354d5a=parseInt(_0x354d5a,0xa);if(!_0x354d5a||_0x354d5a<0x0){_0x354d5a=LIMIT_VALUE;}return _0x354d5a;};exports['offset']=function(_0x50d560){_0x50d560=parseInt(_0x50d560,0xa);if(!_0x50d560||_0x50d560<0x0){_0x50d560=0x0;}return _0x50d560;};exports['sort']=function(_0x6bd925){var _0x313d05,_0x586d05=null;if(_0x6bd925){_0x313d05=_0x6bd925['split'](',');_0x586d05=_[_0x4b30('0x13')](_0x313d05,function(_0x371987){if(_0x371987['indexOf']('-')===0x0){return[_0x371987===_0x4b30('0x14')?sequelize['cast'](sequelize['col'](_0x4b30('0x14')),_0x4b30('0x15')):_0x371987[_0x4b30('0x16')](0x1),_0x4b30('0x17')];}else{return[_0x371987===_0x4b30('0x14')?sequelize['cast'](sequelize['col'](_0x4b30('0x14')),_0x4b30('0x15')):_0x371987,_0x4b30('0x18')];}});}return _0x586d05;};exports['omit']=function(_0xc951d9,_0x2f01b7){if(_[_0x4b30('0x19')](_0xc951d9)){return _0xc951d9;}if(_[_0x4b30('0x10')](_0xc951d9)){for(var _0x3c66aa=0x0;_0x3c66aa<_0xc951d9[_0x4b30('0x1a')];_0x3c66aa+=0x1){_0xc951d9[_0x3c66aa]=this[_0x4b30('0x1b')](_0xc951d9[_0x3c66aa],_0x2f01b7);}return _0xc951d9;}if(!_[_0x4b30('0x1c')](_0xc951d9)){return _0xc951d9;}if(_[_0x4b30('0x1d')](_0x2f01b7)){_0x2f01b7=[_0x2f01b7];}if(!_[_0x4b30('0x10')](_0x2f01b7)){return _0xc951d9;}for(var _0x3992ab=0x0;_0x3992ab<_0x2f01b7['length'];_0x3992ab+=0x1){_[_0x4b30('0x1e')](_0xc951d9,_0x2f01b7[_0x3992ab]);}for(var _0x41cc87 in _0xc951d9){if(_0xc951d9[_0x4b30('0x1f')](_0x41cc87)){_0xc951d9[_0x41cc87]=this[_0x4b30('0x1b')](_0xc951d9[_0x41cc87],_0x2f01b7);}}return _0xc951d9;};exports[_0x4b30('0x20')]=function(_0x2dd886){return _0x2dd886[_0x4b30('0x21')](RegExp(_0x4b30('0x22')))?!![]:![];};exports[_0x4b30('0x23')]=function(_0xeb77cc){return _0xeb77cc[_0x4b30('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x4b30('0x24')]=function(_0x4e52d8){var _0x791473=[];_0x4e52d8[_0x4b30('0x11')](/[ ,]+/)[_0x4b30('0x25')](function(_0x2737c3){_0x2737c3=_0x2737c3['replace'](/([^:]")"+/g,'$1');_0x2737c3='+'+_0x2737c3+'*';if(_0x2737c3[_0x4b30('0x26')]('@'))_0x2737c3='\x22'+_0x2737c3+'\x22';_0x791473[_0x4b30('0x27')](_0x2737c3);});return _0x791473['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 3b80b57..6194cb2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e68=['development','test','use','json\x20replacer','toISOString','split','static','get','views','html','ejs','view\x20engine','urlencoded','json','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','default','env','production','set','appPath','join','root'];(function(_0x193fb1,_0x306bbd){var _0x33a32c=function(_0x517436){while(--_0x517436){_0x193fb1['push'](_0x193fb1['shift']());}};_0x33a32c(++_0x306bbd);}(_0x4e68,0xf7));var _0x84e6=function(_0x423916,_0x1d41cb){_0x423916=_0x423916-0x0;var _0x1b9782=_0x4e68[_0x423916];return _0x1b9782;};'use strict';var express=require(_0x84e6('0x0'));var favicon=require(_0x84e6('0x1'));var bodyParser=require(_0x84e6('0x2'));var methodOverride=require(_0x84e6('0x3'));var cookieParser=require(_0x84e6('0x4'));var errorHandler=require(_0x84e6('0x5'));var path=require(_0x84e6('0x6'));var passport=require(_0x84e6('0x7'));var cors=require(_0x84e6('0x8'));var moment=require(_0x84e6('0x9'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x84e6('0xa')]=function(_0x4e9742){var _0x46d917=_0x4e9742['get'](_0x84e6('0xb'));if(_0x46d917===_0x84e6('0xc')){_0x4e9742[_0x84e6('0xd')](_0x84e6('0xe'),path[_0x84e6('0xf')](config[_0x84e6('0x10')],'public'));}if(_0x46d917===_0x84e6('0x11')||_0x46d917===_0x84e6('0x12')){_0x4e9742[_0x84e6('0xd')](_0x84e6('0xe'),path[_0x84e6('0xf')](config[_0x84e6('0x10')],'client'));_0x4e9742[_0x84e6('0x13')](errorHandler());}_0x4e9742['set'](_0x84e6('0x14'),function(_0x746007,_0x186039){if(this[_0x746007]instanceof Date){_0x186039=this[_0x746007][_0x84e6('0x15')]()[_0x84e6('0x16')]('.')[0x0]+'Z';}return _0x186039;});_0x4e9742[_0x84e6('0x13')](express[_0x84e6('0x17')](_0x4e9742[_0x84e6('0x18')](_0x84e6('0xe'))));_0x4e9742['set'](_0x84e6('0x19'),config[_0x84e6('0x10')]+'/server/views');_0x4e9742['engine'](_0x84e6('0x1a'),require(_0x84e6('0x1b'))['renderFile']);_0x4e9742[_0x84e6('0xd')](_0x84e6('0x1c'),_0x84e6('0x1a'));_0x4e9742['use'](bodyParser[_0x84e6('0x1d')]({'limit':'50mb','extended':!![]}));_0x4e9742['use'](bodyParser[_0x84e6('0x1e')]({'limit':_0x84e6('0x1f')}));_0x4e9742[_0x84e6('0x13')](cors());_0x4e9742[_0x84e6('0x13')](methodOverride());_0x4e9742[_0x84e6('0x13')](cookieParser());_0x4e9742[_0x84e6('0x13')](passport[_0x84e6('0x20')]());}; \ No newline at end of file +var _0xd2d7=['ejs','urlencoded','50mb','json','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','set','appPath','join','public','root','client','use','json\x20replacer','split','html'];(function(_0x46c149,_0xf02baf){var _0x265d91=function(_0x141b87){while(--_0x141b87){_0x46c149['push'](_0x46c149['shift']());}};_0x265d91(++_0xf02baf);}(_0xd2d7,0x1b8));var _0x7d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d7[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x7d2d('0x0'));var favicon=require(_0x7d2d('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x7d2d('0x2'));var cookieParser=require(_0x7d2d('0x3'));var errorHandler=require(_0x7d2d('0x4'));var path=require(_0x7d2d('0x5'));var passport=require(_0x7d2d('0x6'));var cors=require(_0x7d2d('0x7'));var moment=require(_0x7d2d('0x8'));var config=require(_0x7d2d('0x9'));var db=require(_0x7d2d('0xa'))['db'];exports[_0x7d2d('0xb')]=function(_0x3eb30d){var _0x13f7bb=_0x3eb30d[_0x7d2d('0xc')](_0x7d2d('0xd'));if(_0x13f7bb==='production'){_0x3eb30d[_0x7d2d('0xe')](_0x7d2d('0xf'),path[_0x7d2d('0x10')](config['root'],_0x7d2d('0x11')));}if(_0x13f7bb==='development'||_0x13f7bb==='test'){_0x3eb30d['set']('appPath',path[_0x7d2d('0x10')](config[_0x7d2d('0x12')],_0x7d2d('0x13')));_0x3eb30d[_0x7d2d('0x14')](errorHandler());}_0x3eb30d[_0x7d2d('0xe')](_0x7d2d('0x15'),function(_0xe26b23,_0x147488){if(this[_0xe26b23]instanceof Date){_0x147488=this[_0xe26b23]['toISOString']()[_0x7d2d('0x16')]('.')[0x0]+'Z';}return _0x147488;});_0x3eb30d[_0x7d2d('0x14')](express['static'](_0x3eb30d[_0x7d2d('0xc')](_0x7d2d('0xf'))));_0x3eb30d['set']('views',config[_0x7d2d('0x12')]+'/server/views');_0x3eb30d['engine'](_0x7d2d('0x17'),require(_0x7d2d('0x18'))['renderFile']);_0x3eb30d[_0x7d2d('0xe')]('view\x20engine',_0x7d2d('0x17'));_0x3eb30d[_0x7d2d('0x14')](bodyParser[_0x7d2d('0x19')]({'limit':_0x7d2d('0x1a'),'extended':!![]}));_0x3eb30d['use'](bodyParser[_0x7d2d('0x1b')]({'limit':'50mb'}));_0x3eb30d[_0x7d2d('0x14')](cors());_0x3eb30d[_0x7d2d('0x14')](methodOverride());_0x3eb30d['use'](cookieParser());_0x3eb30d['use'](passport[_0x7d2d('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 1b1334d..d322a38 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 _0xaf1b=['hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','createHash','md5','update','digest','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x531037,_0x3aa504){var _0x1e6564=function(_0xa35fa8){while(--_0xa35fa8){_0x531037['push'](_0x531037['shift']());}};_0x1e6564(++_0x3aa504);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x4fce7e,_0x1e23e1){_0x4fce7e=_0x4fce7e-0x0;var _0x2b2aa1=_0xaf1b[_0x4fce7e];return _0x2b2aa1;};'use strict';var _=require(_0xbaf1('0x0'));var os=require('os');var crypto=require(_0xbaf1('0x1'));var machine=require(_0xbaf1('0x2'));var exec=require(_0xbaf1('0x3'))[_0xbaf1('0x4')];function getInterfaces(){var _0x132c6a=[];var _0x3631fb=os[_0xbaf1('0x5')]();var _0x461ffb=_[_0xbaf1('0x6')](_[_0xbaf1('0x7')](_0x3631fb));for(var _0x97aab=0x0;_0x97aab<_0x461ffb[_0xbaf1('0x8')];_0x97aab++){var _0x2f05ad=_0x3631fb[_0x461ffb[_0x97aab]]['filter'](function(_0x2e05b5){return _0x2e05b5['family']===_0xbaf1('0x9')&&_0x2e05b5['internal']===![];});_0x132c6a=_0x132c6a[_0xbaf1('0xa')](_0x2f05ad);}return _0x132c6a;}function getFirstInterface(){var _0x3723ae=_[_0xbaf1('0xb')](getInterfaces());return{'macAddress':_0x3723ae&&_0x3723ae['mac']?_0x3723ae[_0xbaf1('0xc')]:_0xbaf1('0xd'),'ipAddress':_0x3723ae&&_0x3723ae['address']?_0x3723ae[_0xbaf1('0xe')]:'127.0.0.1'};}exports[_0xbaf1('0xf')]=getFirstInterface;function getCPUhash(){var _0x418d09=_[_0xbaf1('0x6')](os[_0xbaf1('0x10')]()[_0xbaf1('0x11')](function(_0x36ec1c){return _0x36ec1c['model'];}))['join'](':');return crypto[_0xbaf1('0x12')](_0xbaf1('0x13'))[_0xbaf1('0x14')](_0x418d09)[_0xbaf1('0x15')](_0xbaf1('0x16'));}exports[_0xbaf1('0x17')]=function(){switch(os[_0xbaf1('0x18')]()){case'win32':return exec(_0xbaf1('0x19'),{'encoding':_0xbaf1('0x1a')})[_0xbaf1('0x1b')]('\x0d\x0a','');default:var _0x342c11=getFirstInterface();var _0x305c91=getCPUhash();var _0x25458f=_0x305c91+'|'+os[_0xbaf1('0x1c')]()+'|'+_0x342c11[_0xbaf1('0x1d')]+'|'+_0x342c11['ipAddress'];var _0x33c23b=crypto['createHash'](_0xbaf1('0x13'))[_0xbaf1('0x14')](_0x25458f)[_0xbaf1('0x15')](_0xbaf1('0x16'));return _0x33c23b['substring'](0x0,0x8)+'-'+_0x33c23b[_0xbaf1('0x1e')](0x8,0xc)+'-'+_0x33c23b['substring'](0xc,0x10)+'-'+_0x33c23b[_0xbaf1('0x1e')](0x10,0x14)+'-'+_0x33c23b[_0xbaf1('0x1e')](0x14);}}; \ No newline at end of file +var _0x6d19=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring'];(function(_0x225074,_0x1abb16){var _0x3fb50c=function(_0xf22c61){while(--_0xf22c61){_0x225074['push'](_0x225074['shift']());}};_0x3fb50c(++_0x1abb16);}(_0x6d19,0x160));var _0x96d1=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x6d19[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x96d1('0x0'));var os=require('os');var crypto=require(_0x96d1('0x1'));var machine=require(_0x96d1('0x2'));var exec=require(_0x96d1('0x3'))[_0x96d1('0x4')];function getInterfaces(){var _0x31518c=[];var _0x36405d=os['networkInterfaces']();var _0x186315=_[_0x96d1('0x5')](_[_0x96d1('0x6')](_0x36405d));for(var _0x4704b3=0x0;_0x4704b3<_0x186315['length'];_0x4704b3++){var _0x32b7d9=_0x36405d[_0x186315[_0x4704b3]][_0x96d1('0x7')](function(_0x61e0f5){return _0x61e0f5['family']===_0x96d1('0x8')&&_0x61e0f5[_0x96d1('0x9')]===![];});_0x31518c=_0x31518c[_0x96d1('0xa')](_0x32b7d9);}return _0x31518c;}function getFirstInterface(){var _0x4e1e7a=_[_0x96d1('0xb')](getInterfaces());return{'macAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xc')]?_0x4e1e7a['mac']:'00:00:00:00:00:00','ipAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xd')]?_0x4e1e7a[_0x96d1('0xd')]:'127.0.0.1'};}exports[_0x96d1('0xe')]=getFirstInterface;function getCPUhash(){var _0x51b089=_[_0x96d1('0x5')](os[_0x96d1('0xf')]()[_0x96d1('0x10')](function(_0xb019fb){return _0xb019fb[_0x96d1('0x11')];}))[_0x96d1('0x12')](':');return crypto['createHash'](_0x96d1('0x13'))[_0x96d1('0x14')](_0x51b089)[_0x96d1('0x15')](_0x96d1('0x16'));}exports[_0x96d1('0x17')]=function(){switch(os['platform']()){case'win32':return exec(_0x96d1('0x18'),{'encoding':_0x96d1('0x19')})[_0x96d1('0x1a')]('\x0d\x0a','');default:var _0x9eb2c4=getFirstInterface();var _0x2d521d=getCPUhash();var _0x3e9a0=_0x2d521d+'|'+os[_0x96d1('0x1b')]()+'|'+_0x9eb2c4[_0x96d1('0x1c')]+'|'+_0x9eb2c4[_0x96d1('0x1d')];var _0x5853f0=crypto[_0x96d1('0x1e')](_0x96d1('0x13'))[_0x96d1('0x14')](_0x3e9a0)[_0x96d1('0x15')](_0x96d1('0x16'));return _0x5853f0['substring'](0x0,0x8)+'-'+_0x5853f0[_0x96d1('0x1f')](0x8,0xc)+'-'+_0x5853f0[_0x96d1('0x1f')](0xc,0x10)+'-'+_0x5853f0[_0x96d1('0x1f')](0x10,0x14)+'-'+_0x5853f0[_0x96d1('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 5b44b5d..2a62d36 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 _0x4da9=['request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x4da9,0xe9));var _0x94da=function(_0x5ae756,_0x332119){_0x5ae756=_0x5ae756-0x0;var _0x4f2331=_0x4da9[_0x5ae756];return _0x4f2331;};'use strict';var util=require('util');var moment=require(_0x94da('0x0'));var rp=require(_0x94da('0x1'));var BPromise=require(_0x94da('0x2'));var pkginfo=require(_0x94da('0x3'))(module,_0x94da('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x94da('0x5'));var hardware=require('./hardware');var logger=require(_0x94da('0x6'))(_0x94da('0x7'));var HOST=_0x94da('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3f93b1){return new BPromise(function(_0x5bfdf9,_0x4d3346){var _0x12bd6d=util[_0x94da('0x9')](_0x94da('0xa'),HOST,_0x3f93b1,module[_0x94da('0xb')][_0x94da('0x4')]);if(oldToken){_0x12bd6d=util['format'](_0x94da('0xc'),HOST,_0x3f93b1,module[_0x94da('0xb')][_0x94da('0x4')],oldToken);}var _0x2f57aa={'uri':_0x12bd6d,'method':_0x94da('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2f57aa)[_0x94da('0xe')](function(_0x22dc1c){_0x5bfdf9(_0x22dc1c);})[_0x94da('0xf')](function(_0x1be160){_0x4d3346(_0x1be160);});});}function manageLicense(_0x1ae074,_0x1bda09){var _0x1c6144=_0x1bda09[_0x94da('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x1c6144[_0x94da('0x11')]!==_0x1ae074&&!_0x1c6144[_0x94da('0x12')]){oldToken=_0x1c6144[_0x94da('0x11')];}httpRequest(_0x1ae074)['then'](function(_0x3c666f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3c666f[_0x94da('0x13')]){isOldTokenSent=![];if(!_0x1c6144[_0x94da('0x7')]&&_0x1c6144[_0x94da('0x7')]!=_0x3c666f[_0x94da('0x7')]||_0x1c6144[_0x94da('0x7')]&&_0x1c6144[_0x94da('0x12')]){logger[_0x94da('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1c6144[_0x94da('0x7')]&&!_0x1c6144[_0x94da('0x12')]&&_0x1c6144[_0x94da('0x7')]!=_0x3c666f[_0x94da('0x7')]){logger['info'](_0x94da('0x15'));}if(_0x1c6144[_0x94da('0x7')]&&!_0x1c6144[_0x94da('0x12')]&&_0x1c6144[_0x94da('0x7')]==_0x3c666f['license']){return _0x1bda09;}return _0x1bda09['update']({'data1':_0x1ae074,'data2':null,'license':_0x3c666f['license']});}else{if(_0x3c666f['license']||_0x1c6144[_0x94da('0x7')]){if(!_0x1c6144[_0x94da('0x12')]){if(_0x1c6144['data1']==_0x1ae074){GRAY_PERIOD_REASON=_0x94da('0x16');logger[_0x94da('0x14')](_0x94da('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x94da('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1c6144[_0x94da('0x11')],_0x1ae074);}logger['info'](_0x94da('0x18'),GRAY_PERIOD_REASON[_0x94da('0x19')](),moment()[_0x94da('0x9')](_0x94da('0x1a')));return _0x1bda09[_0x94da('0x1b')]({'data2':encryptor[_0x94da('0x1c')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x94da('0x1d')](encryptor[_0x94da('0x1e')](_0x1c6144['data2']),_0x94da('0x1f'))>DAYS){logger[_0x94da('0x14')](_0x94da('0x20'),moment()[_0x94da('0x9')](_0x94da('0x1a')));isOldTokenSent=![];return _0x1bda09[_0x94da('0x1b')]({'data1':_0x1ae074,'data2':null,'license':null});}}}else{if(_0x1c6144['data1']!=_0x1ae074){logger[_0x94da('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1c6144['data1'],_0x1ae074);return _0x1bda09[_0x94da('0x1b')]({'data1':_0x1ae074,'data2':null,'license':null});}}}return _0x1bda09;})[_0x94da('0xe')](function(_0x3d2c07){_0x1bda09=_0x3d2c07;})[_0x94da('0xf')](function(_0xf124f5){logger['error'](_0xf124f5[_0x94da('0x21')]);})[_0x94da('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x94da('0x23')](),_0x1bda09);},TIME);});}function defaultLicense(){var _0x2c1655=hardware[_0x94da('0x23')]();if(_0x2c1655){return db['License'][_0x94da('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x2c1655}})['spread'](function(_0xa54c85,_0x43be55){logger[_0x94da('0x14')](_0x94da('0x25'),_0x2c1655);manageLicense(_0x2c1655,_0xa54c85);})[_0x94da('0xf')](function(_0x27aa7b){logger['error'](_0x27aa7b[_0x94da('0x21')]);});}}exports[_0x94da('0x26')]=defaultLicense; \ No newline at end of file +var _0x4b65=['moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x4b65,0xf0));var _0x54b6=function(_0x2385a5,_0x4512ea){_0x2385a5=_0x2385a5-0x0;var _0x22622c=_0x4b65[_0x2385a5];return _0x22622c;};'use strict';var util=require('util');var moment=require(_0x54b6('0x0'));var rp=require(_0x54b6('0x1'));var BPromise=require(_0x54b6('0x2'));var pkginfo=require(_0x54b6('0x3'))(module,'version');var db=require(_0x54b6('0x4'))['db'];var encryptor=require(_0x54b6('0x5'));var hardware=require(_0x54b6('0x6'));var logger=require('../logger')(_0x54b6('0x7'));var HOST=_0x54b6('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x48b06c){return new BPromise(function(_0x41706c,_0x248fe7){var _0x50e1dc=util['format'](_0x54b6('0x9'),HOST,_0x48b06c,module[_0x54b6('0xa')]['version']);if(oldToken){_0x50e1dc=util[_0x54b6('0xb')](_0x54b6('0xc'),HOST,_0x48b06c,module[_0x54b6('0xa')]['version'],oldToken);}var _0x15e554={'uri':_0x50e1dc,'method':_0x54b6('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x15e554)[_0x54b6('0xe')](function(_0x13d9c1){_0x41706c(_0x13d9c1);})[_0x54b6('0xf')](function(_0x5dd9b0){_0x248fe7(_0x5dd9b0);});});}function manageLicense(_0x22caf5,_0x44cb4e){var _0x3e8179=_0x44cb4e[_0x54b6('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x3e8179[_0x54b6('0x11')]!==_0x22caf5&&!_0x3e8179[_0x54b6('0x12')]){oldToken=_0x3e8179['data1'];}httpRequest(_0x22caf5)[_0x54b6('0xe')](function(_0x138655){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x138655[_0x54b6('0x13')]){isOldTokenSent=![];if(!_0x3e8179[_0x54b6('0x7')]&&_0x3e8179[_0x54b6('0x7')]!=_0x138655[_0x54b6('0x7')]||_0x3e8179['license']&&_0x3e8179[_0x54b6('0x12')]){logger[_0x54b6('0x14')](_0x54b6('0x15'));}if(_0x3e8179[_0x54b6('0x7')]&&!_0x3e8179['data2']&&_0x3e8179['license']!=_0x138655['license']){logger[_0x54b6('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3e8179[_0x54b6('0x7')]&&!_0x3e8179[_0x54b6('0x12')]&&_0x3e8179[_0x54b6('0x7')]==_0x138655[_0x54b6('0x7')]){return _0x44cb4e;}return _0x44cb4e[_0x54b6('0x16')]({'data1':_0x22caf5,'data2':null,'license':_0x138655[_0x54b6('0x7')]});}else{if(_0x138655[_0x54b6('0x7')]||_0x3e8179[_0x54b6('0x7')]){if(!_0x3e8179['data2']){if(_0x3e8179[_0x54b6('0x11')]==_0x22caf5){GRAY_PERIOD_REASON=_0x54b6('0x17');logger[_0x54b6('0x14')](_0x54b6('0x18'));}else{GRAY_PERIOD_REASON=_0x54b6('0x19');logger[_0x54b6('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3e8179[_0x54b6('0x11')],_0x22caf5);}logger[_0x54b6('0x14')](_0x54b6('0x1a'),GRAY_PERIOD_REASON[_0x54b6('0x1b')](),moment()[_0x54b6('0xb')](_0x54b6('0x1c')));return _0x44cb4e[_0x54b6('0x16')]({'data2':encryptor[_0x54b6('0x1d')](moment()[_0x54b6('0xb')](_0x54b6('0x1c')))});}else{if(moment()[_0x54b6('0x1e')](encryptor['decryptString'](_0x3e8179['data2']),_0x54b6('0x1f'))>DAYS){logger[_0x54b6('0x14')](_0x54b6('0x20'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x44cb4e[_0x54b6('0x16')]({'data1':_0x22caf5,'data2':null,'license':null});}}}else{if(_0x3e8179['data1']!=_0x22caf5){logger[_0x54b6('0x14')](_0x54b6('0x21'),_0x3e8179[_0x54b6('0x11')],_0x22caf5);return _0x44cb4e[_0x54b6('0x16')]({'data1':_0x22caf5,'data2':null,'license':null});}}}return _0x44cb4e;})[_0x54b6('0xe')](function(_0xc911b){_0x44cb4e=_0xc911b;})[_0x54b6('0xf')](function(_0x3bcfbf){logger['error'](_0x3bcfbf[_0x54b6('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x54b6('0x23')](),_0x44cb4e);},TIME);});}function defaultLicense(){var _0x5b038f=hardware[_0x54b6('0x23')]();if(_0x5b038f){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x5b038f}})[_0x54b6('0x24')](function(_0x1690bb,_0xacabe7){logger['info'](_0x54b6('0x25'),_0x5b038f);manageLicense(_0x5b038f,_0x1690bb);})['catch'](function(_0x1e5f0b){logger[_0x54b6('0x26')](_0x1e5f0b[_0x54b6('0x22')]);});}}exports[_0x54b6('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index efbb86d..803ddbe 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 _0x3963=['countBy','telephone','user','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','defaults','data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','demo','uuid','machineUuid','gray','deadline','days','grayReason','changed','disabled','message','then','findAll','role','sequelize','COUNT','col','forEach','admin','count','catch'];(function(_0x1c24e9,_0x2e038a){var _0x5460e1=function(_0x10322e){while(--_0x10322e){_0x1c24e9['push'](_0x1c24e9['shift']());}};_0x5460e1(++_0x2e038a);}(_0x3963,0xcc));var _0x3396=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x3963[_0xbd08b4];return _0x314f1e;};'use strict';var util=require(_0x3396('0x0'));var _=require(_0x3396('0x1'));var moment=require(_0x3396('0x2'));var BPromise=require(_0x3396('0x3'));var hardware=require(_0x3396('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x3396('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3396('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x3396('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3396('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x3396('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3f84f3){return new BPromise(function(_0x1f97a9,_0x468223){return db['License']['find'](_[_0x3396('0x8')](_0x3f84f3,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4a7369){return checkLicense(_0x4a7369,null);})['then'](function(_0x430cd5){_0x1f97a9(_0x430cd5);return;})['catch'](function(_0x4fa11c){_0x468223(_0x4fa11c);});});}function checkLicense(_0x4c8cb1,_0x5a099c){if(!_0x4c8cb1){demoLicense['uuid']=_0x4c8cb1[_0x3396('0x9')];return demoLicense;}try{var _0x13e16e=_0x5a099c||_0x4c8cb1[_0x3396('0xa')];if(_['isEmpty'](_0x13e16e)){throw new Error(_0x3396('0xb'));}var _0x350ed6=_0x4c8cb1[_0x3396('0x9')];var _0x2c8193=_0x4c8cb1['data2'];var _0x269505=_0x350ed6[_0x3396('0xc')]('-')[0x4];var _0x2132b8=_0x350ed6[_0x3396('0xc')]('-')[0x0];var _0x1f2081=encryptor[_0x3396('0xd')](_0x13e16e,util[_0x3396('0xe')](_0x3396('0xf'),_0x269505,_0x350ed6,_0x2132b8));var _0x31cd99=JSON['parse'](_0x1f2081);_0x31cd99[_0x3396('0x10')]=![];_0x31cd99[_0x3396('0x11')]=_0x350ed6;_0x31cd99[_0x3396('0x12')]=hardware[_0x3396('0x7')]();if(_0x2c8193){var _0x40ce93=encryptor[_0x3396('0xd')](_0x2c8193);_0x31cd99[_0x3396('0x13')]=_0x40ce93;_0x31cd99[_0x3396('0x14')]=moment(_0x40ce93)['add'](0x7,_0x3396('0x15'))['format']();_0x31cd99[_0x3396('0x16')]=_0x31cd99[_0x3396('0x11')]!=_0x31cd99[_0x3396('0x12')]?_0x3396('0x17'):_0x3396('0x18');}return _0x31cd99;}catch(_0x329178){breakingLicense[_0x3396('0x11')]=_0x4c8cb1[_0x3396('0x9')];breakingLicense['message']=_0x329178[_0x3396('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x167a06,_0x5eefea){getLicense()[_0x3396('0x1a')](function(_0x4f201d){return db['User'][_0x3396('0x1b')]({'attributes':[_0x3396('0x1c'),[db[_0x3396('0x1d')]['fn'](_0x3396('0x1e'),db['sequelize'][_0x3396('0x1f')](_0x3396('0x1c'))),'count']],'group':_0x3396('0x1c'),'where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})[_0x3396('0x1a')](function(_0x5061cc){var _0x617a0c={'user':_0x4f201d['users']||0x0,'telephone':_0x4f201d['telephones']||0x0};_0x5061cc[_0x3396('0x20')](function(_0x5ecf10){var _0x83ca27=_0x5ecf10['role']===_0x3396('0x21')?'user':_0x5ecf10[_0x3396('0x1c')];_0x617a0c[_0x83ca27]-=_0x5ecf10[_0x3396('0x22')];if(_0x617a0c[_0x83ca27]<0x0)_0x617a0c[_0x83ca27]=0x0;});_0x167a06(_0x617a0c);return;});})[_0x3396('0x23')](function(_0x27a8cb){_0x5eefea(_0x27a8cb);});});}function checkUserLimits(_0x2ac0ad){return new BPromise(function(_0x417544,_0x12bdb8){getLimits()[_0x3396('0x1a')](function(_0x5223f7){var _0x2fe0a6=_['pick'](_[_0x3396('0x24')](_0x2ac0ad,_0x3396('0x1c')),[_0x3396('0x21'),'user',_0x3396('0x25')]);var _0x544ac3=(_0x2fe0a6[_0x3396('0x21')]||0x0)+(_0x2fe0a6[_0x3396('0x26')]||0x0);var _0x2e0b18=_0x2fe0a6[_0x3396('0x25')]||0x0;if(_0x544ac3>_0x5223f7[_0x3396('0x26')])return _0x12bdb8('License\x20limit\x20reached\x20for\x20users');if(_0x2e0b18>_0x5223f7[_0x3396('0x25')])return _0x12bdb8(_0x3396('0x27'));return _0x417544();})[_0x3396('0x23')](function(_0x4932a6){_0x12bdb8(_0x4932a6);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x212b=['message','findAll','sequelize','COUNT','col','count','role','admin','telephone','users','telephones','forEach','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','find','then','catch','uuid','license','data1','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','add','days','grayReason','changed'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x212b,0x19e));var _0xb212=function(_0x16a80d,_0x3d17cb){_0x16a80d=_0x16a80d-0x0;var _0x4bdad8=_0x212b[_0x16a80d];return _0x4bdad8;};'use strict';var util=require(_0xb212('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xb212('0x1'));var hardware=require(_0xb212('0x2'));var encryptor=require(_0xb212('0x3'));var db=require(_0xb212('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xb212('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb212('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb212('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x153bb6){return new BPromise(function(_0x5b8c34,_0xac6608){return db['License'][_0xb212('0x8')](_['defaults'](_0x153bb6,{'raw':!![],'where':{'id':0x1}}))[_0xb212('0x9')](function(_0x31444d){return checkLicense(_0x31444d,null);})[_0xb212('0x9')](function(_0x242690){_0x5b8c34(_0x242690);return;})[_0xb212('0xa')](function(_0x29e281){_0xac6608(_0x29e281);});});}function checkLicense(_0x3f1558,_0x1f1764){if(!_0x3f1558){demoLicense[_0xb212('0xb')]=_0x3f1558['data1'];return demoLicense;}try{var _0x155cd2=_0x1f1764||_0x3f1558[_0xb212('0xc')];if(_['isEmpty'](_0x155cd2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x350bd0=_0x3f1558[_0xb212('0xd')];var _0x303210=_0x3f1558[_0xb212('0xe')];var _0x8797a1=_0x350bd0[_0xb212('0xf')]('-')[0x4];var _0x3c5b7d=_0x350bd0[_0xb212('0xf')]('-')[0x0];var _0x545822=encryptor[_0xb212('0x10')](_0x155cd2,util['format'](_0xb212('0x11'),_0x8797a1,_0x350bd0,_0x3c5b7d));var _0x35d660=JSON[_0xb212('0x12')](_0x545822);_0x35d660[_0xb212('0x13')]=![];_0x35d660[_0xb212('0xb')]=_0x350bd0;_0x35d660[_0xb212('0x14')]=hardware[_0xb212('0x5')]();if(_0x303210){var _0x1f44aa=encryptor[_0xb212('0x10')](_0x303210);_0x35d660[_0xb212('0x15')]=_0x1f44aa;_0x35d660['deadline']=moment(_0x1f44aa)[_0xb212('0x16')](0x7,_0xb212('0x17'))['format']();_0x35d660[_0xb212('0x18')]=_0x35d660['uuid']!=_0x35d660[_0xb212('0x14')]?_0xb212('0x19'):'disabled';}return _0x35d660;}catch(_0x4429e4){breakingLicense['uuid']=_0x3f1558[_0xb212('0xd')];breakingLicense[_0xb212('0x1a')]=_0x4429e4[_0xb212('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4a319e,_0x1ec38d){getLicense()[_0xb212('0x9')](function(_0x52cd7a){return db['User'][_0xb212('0x1b')]({'attributes':['role',[db[_0xb212('0x1c')]['fn'](_0xb212('0x1d'),db[_0xb212('0x1c')][_0xb212('0x1e')]('role')),_0xb212('0x1f')]],'group':_0xb212('0x20'),'where':{'role':{'$or':[_0xb212('0x21'),'user',_0xb212('0x22')]}},'raw':!![]})[_0xb212('0x9')](function(_0x1c8d18){var _0x1f7032={'user':_0x52cd7a[_0xb212('0x23')]||0x0,'telephone':_0x52cd7a[_0xb212('0x24')]||0x0};_0x1c8d18[_0xb212('0x25')](function(_0x4f4dce){var _0x2fea20=_0x4f4dce['role']==='admin'?'user':_0x4f4dce['role'];_0x1f7032[_0x2fea20]-=_0x4f4dce[_0xb212('0x1f')];if(_0x1f7032[_0x2fea20]<0x0)_0x1f7032[_0x2fea20]=0x0;});_0x4a319e(_0x1f7032);return;});})[_0xb212('0xa')](function(_0x5473d5){_0x1ec38d(_0x5473d5);});});}function checkUserLimits(_0x17cab4){return new BPromise(function(_0x21a32a,_0x1ea2c7){getLimits()[_0xb212('0x9')](function(_0x2f54e8){var _0x26f3aa=_[_0xb212('0x26')](_[_0xb212('0x27')](_0x17cab4,'role'),[_0xb212('0x21'),_0xb212('0x28'),_0xb212('0x22')]);var _0x3a7bd6=(_0x26f3aa['admin']||0x0)+(_0x26f3aa[_0xb212('0x28')]||0x0);var _0x4df015=_0x26f3aa[_0xb212('0x22')]||0x0;if(_0x3a7bd6>_0x2f54e8[_0xb212('0x28')])return _0x1ea2c7(_0xb212('0x29'));if(_0x4df015>_0x2f54e8[_0xb212('0x22')])return _0x1ea2c7(_0xb212('0x2a'));return _0x21a32a();})[_0xb212('0xa')](function(_0x5ddfa1){_0x1ea2c7(_0x5ddfa1);});});}module[_0xb212('0x2b')]={'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 0b200b0..4ec05d9 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 _0xf688=['secret','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0xf688,0xc9));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';module['exports']={'DOMAIN':_0x8f68('0x0'),'SESSION_SECRET':_0x8f68('0x1'),'GOOGLE_ID':_0x8f68('0x2'),'GOOGLE_SECRET':_0x8f68('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x339d=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x3d233f,_0x410e10){var _0x292235=function(_0x5c849c){while(--_0x5c849c){_0x3d233f['push'](_0x3d233f['shift']());}};_0x292235(++_0x410e10);}(_0x339d,0xb2));var _0xd339=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x339d[_0x44d9ab];return _0x31485e;};'use strict';module['exports']={'DOMAIN':_0xd339('0x0'),'SESSION_SECRET':_0xd339('0x1'),'GOOGLE_ID':_0xd339('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3666b4e..3bea8dd 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1797=['replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','File','%s-%s','error','transports','info','env','debugLevel','moment','util','join','/var','log','xcally','format','message'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x1797,0x19c));var _0x7179=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x1797[_0x49ca18];return _0x145d54;};'use strict';var moment=require(_0x7179('0x0'));var winston=require('winston');var util=require(_0x7179('0x1'));var path=require('path');var debugLevel='INFO';function filename(_0x4475a0,_0x3f63fa){return path[_0x7179('0x2')](_0x7179('0x3'),_0x7179('0x4'),_0x7179('0x5'),util[_0x7179('0x6')]('%s-%s.log',_0x4475a0,_0x3f63fa));}function formatter(_0x3f5cc2,_0x33b509){_0x33b509[_0x7179('0x7')]=_0x33b509['message'][_0x7179('0x8')](/@@{/g,_0x7179('0x9'))[_0x7179('0x8')](/}@@/g,'}}}')[_0x7179('0x8')](/@{/g,'{{')[_0x7179('0x8')](/}@/g,'}}');return util[_0x7179('0x6')](_0x7179('0xa'),moment()[_0x7179('0x6')](_0x7179('0xb')),_0x33b509['level'][_0x7179('0xc')](),_0x3f5cc2,_0x33b509[_0x7179('0x7')]);}module['exports']=function(_0x37be2b){return new winston['Logger']({'transports':[new winston['transports'][(_0x7179('0xd'))]({'name':util[_0x7179('0x6')](_0x7179('0xe'),_0x37be2b,_0x7179('0xf')),'filename':filename(_0x37be2b,_0x7179('0xf')),'level':_0x7179('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b4f66){return formatter(_0x37be2b,_0x3b4f66);}}),new winston[(_0x7179('0x10'))][(_0x7179('0xd'))]({'name':util[_0x7179('0x6')](_0x7179('0xe'),_0x37be2b,_0x7179('0x11')),'filename':filename(_0x37be2b,_0x7179('0x11')),'level':_0x7179('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x17cd69){return formatter(_0x37be2b,_0x17cd69);}}),new winston[(_0x7179('0x10'))]['Console']({'level':process[_0x7179('0x12')][_0x7179('0x13')]||debugLevel,'json':![],'formatter':function(_0x14efc2){return formatter(_0x37be2b,_0x14efc2);}})]});}; \ No newline at end of file +var _0xd07c=['INFO','/var','xcally','format','%s-%s.log','message','{{{','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','path'];(function(_0x38d39a,_0x593a06){var _0x7ac00d=function(_0x9fe1ac){while(--_0x9fe1ac){_0x38d39a['push'](_0x38d39a['shift']());}};_0x7ac00d(++_0x593a06);}(_0xd07c,0x112));var _0xcd07=function(_0x400b64,_0x5eb1bf){_0x400b64=_0x400b64-0x0;var _0x1d615d=_0xd07c[_0x400b64];return _0x1d615d;};'use strict';var moment=require(_0xcd07('0x0'));var winston=require('winston');var util=require('util');var path=require(_0xcd07('0x1'));var debugLevel=_0xcd07('0x2');function filename(_0x15ec0,_0x30977f){return path['join'](_0xcd07('0x3'),'log',_0xcd07('0x4'),util[_0xcd07('0x5')](_0xcd07('0x6'),_0x15ec0,_0x30977f));}function formatter(_0x2aa4b7,_0x4b7b15){_0x4b7b15[_0xcd07('0x7')]=_0x4b7b15[_0xcd07('0x7')]['replace'](/@@{/g,_0xcd07('0x8'))[_0xcd07('0x9')](/}@@/g,_0xcd07('0xa'))[_0xcd07('0x9')](/@{/g,'{{')[_0xcd07('0x9')](/}@/g,'}}');return util[_0xcd07('0x5')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xcd07('0x5')](_0xcd07('0xb')),_0x4b7b15[_0xcd07('0xc')][_0xcd07('0xd')](),_0x2aa4b7,_0x4b7b15['message']);}module['exports']=function(_0x42e39c){return new winston[(_0xcd07('0xe'))]({'transports':[new winston[(_0xcd07('0xf'))][(_0xcd07('0x10'))]({'name':util['format'](_0xcd07('0x11'),_0x42e39c,_0xcd07('0x12')),'filename':filename(_0x42e39c,_0xcd07('0x12')),'level':_0xcd07('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5cbccd){return formatter(_0x42e39c,_0x5cbccd);}}),new winston[(_0xcd07('0xf'))][(_0xcd07('0x10'))]({'name':util[_0xcd07('0x5')](_0xcd07('0x11'),_0x42e39c,_0xcd07('0x13')),'filename':filename(_0x42e39c,_0xcd07('0x13')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b1f6c){return formatter(_0x42e39c,_0x2b1f6c);}}),new winston['transports'][(_0xcd07('0x14'))]({'level':process[_0xcd07('0x15')][_0xcd07('0x16')]||debugLevel,'json':![],'formatter':function(_0x55c751){return formatter(_0x42e39c,_0x55c751);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 819817e..0f5ac3b 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 _0x25b0=['join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x1cfc39,_0x1d3913){var _0x957a28=function(_0x2be930){while(--_0x2be930){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x957a28(++_0x1d3913);}(_0x25b0,0x140));var _0x025b=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x25b0[_0x3e32a8];return _0x2997b0;};'use strict';var path=require(_0x025b('0x0'));var os=require('os');var config={'apps':[{'name':_0x025b('0x1'),'script':path[_0x025b('0x2')](__dirname,_0x025b('0x3'))},{'name':_0x025b('0x4'),'script':path[_0x025b('0x2')](__dirname,_0x025b('0x5'))},{'name':_0x025b('0x6'),'script':path[_0x025b('0x2')](__dirname,_0x025b('0x7'))},{'name':'email','script':path[_0x025b('0x2')](__dirname,_0x025b('0x8'))},{'name':_0x025b('0x9'),'script':path['join'](__dirname,_0x025b('0xa'))},{'name':_0x025b('0xb'),'script':path[_0x025b('0x2')](__dirname,_0x025b('0xc'))}]};module[_0x025b('0xd')]=config; \ No newline at end of file +var _0xedca=['../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','xdr','../../services/xdr/index.js','join','ami'];(function(_0xbd827f,_0x4d2fea){var _0x3ccb2b=function(_0x1dd7bb){while(--_0x1dd7bb){_0xbd827f['push'](_0xbd827f['shift']());}};_0x3ccb2b(++_0x4d2fea);}(_0xedca,0xb2));var _0xaedc=function(_0x1786f0,_0x1e03e0){_0x1786f0=_0x1786f0-0x0;var _0x1a5d3d=_0xedca[_0x1786f0];return _0x1a5d3d;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0xaedc('0x0')](__dirname,'../../services/express/index.js')},{'name':_0xaedc('0x1'),'script':path[_0xaedc('0x0')](__dirname,_0xaedc('0x2'))},{'name':_0xaedc('0x3'),'script':path[_0xaedc('0x0')](__dirname,_0xaedc('0x4'))},{'name':_0xaedc('0x5'),'script':path[_0xaedc('0x0')](__dirname,'../../services/email/index.js')},{'name':_0xaedc('0x6'),'script':path[_0xaedc('0x0')](__dirname,'../../services/routing/index.js')},{'name':_0xaedc('0x7'),'script':path[_0xaedc('0x0')](__dirname,_0xaedc('0x8'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e738baa..c243ec1 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 _0x49fe=['list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then','stop','disconnect','restart'];(function(_0x61d1f3,_0x5198a6){var _0x5fb775=function(_0x15449c){while(--_0x15449c){_0x61d1f3['push'](_0x61d1f3['shift']());}};_0x5fb775(++_0x5198a6);}(_0x49fe,0x100));var _0xe49f=function(_0x827b3c,_0x1ee781){_0x827b3c=_0x827b3c-0x0;var _0x2aa30b=_0x49fe[_0x827b3c];return _0x2aa30b;};'use strict';var pm2=require(_0xe49f('0x0'));var BPromise=require(_0xe49f('0x1'));var config=require(_0xe49f('0x2'));function connect(){return new BPromise(function(_0x56f3e0,_0x4d17b1){return pm2[_0xe49f('0x3')](function(_0x595aeb){if(_0x595aeb){return _0x4d17b1(_0x595aeb);}return _0x56f3e0(_0xe49f('0x4'));});});};exports[_0xe49f('0x5')]=function(_0xb0e197){return connect()[_0xe49f('0x6')](function(){return new BPromise(function(_0x4f22cc,_0x20633a){return pm2[_0xe49f('0x5')](_0xb0e197,function(_0xbef6f5,_0x26eac9){if(_0xbef6f5){return _0x20633a(_0xbef6f5);}pm2['disconnect']();return _0x4f22cc(_0x26eac9);});});});};exports[_0xe49f('0x7')]=function(_0x18f791){return connect()[_0xe49f('0x6')](function(){return new BPromise(function(_0x36e95a,_0x826f00){return pm2['stop'](_0x18f791,function(_0x581b52,_0x4137fe){if(_0x581b52){return _0x826f00(_0x581b52);}pm2[_0xe49f('0x8')]();return _0x36e95a(_0x4137fe);});});});};exports['restart']=function(_0x51be71){return connect()[_0xe49f('0x6')](function(){return new BPromise(function(_0x12541f,_0x118a05){return pm2[_0xe49f('0x9')](_0x51be71,function(_0x37742c,_0x1d5ecc){if(_0x37742c){return _0x118a05(_0x37742c);}pm2['disconnect']();return _0x12541f(_0x1d5ecc);});});});};exports['list']=function(){return connect()[_0xe49f('0x6')](function(){return new BPromise(function(_0x3d7cbe,_0x7406){return pm2[_0xe49f('0xa')](function(_0x1cd9b4,_0x517e43){if(_0x1cd9b4){return _0x7406(_0x1cd9b4);}pm2[_0xe49f('0x8')]();return _0x3d7cbe(_0x517e43);});});});};exports[_0xe49f('0xb')]=function(_0x2cff19){return connect()['then'](function(){return new BPromise(function(_0x1b9291,_0x4268b3){return pm2[_0xe49f('0xb')](_0x2cff19,function(_0x5096a8,_0xcb0d16){if(_0x5096a8){return _0x4268b3(_0x5096a8);}pm2[_0xe49f('0x8')]();return _0x1b9291(_0xcb0d16);});});});};exports[_0xe49f('0xc')]=function(_0x18d2ec){return connect()[_0xe49f('0x6')](function(){return new BPromise(function(_0x7b1b0a,_0xdec8d){return pm2[_0xe49f('0xc')](_0x18d2ec,function(_0x57fe47,_0xc6c762){if(_0x57fe47){return _0xdec8d(_0x57fe47);}pm2['disconnect']();return _0x7b1b0a(_0xc6c762);});});});};exports[_0xe49f('0xd')]=function(){return connect()[_0xe49f('0x6')](function(){return new BPromise(function(_0x364b50,_0x236c19){return pm2[_0xe49f('0xd')](function(_0xfe4d5d){if(_0xfe4d5d){return _0x236c19(_0xfe4d5d);}return _0x364b50('saved');});});});}; \ No newline at end of file +var _0xf8db=['./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x2e08cb,_0x3987c8){var _0x223e9d=function(_0x16b5d0){while(--_0x16b5d0){_0x2e08cb['push'](_0x2e08cb['shift']());}};_0x223e9d(++_0x3987c8);}(_0xf8db,0x16b));var _0xbf8d=function(_0x4d928b,_0xfcda3e){_0x4d928b=_0x4d928b-0x0;var _0x24464e=_0xf8db[_0x4d928b];return _0x24464e;};'use strict';var pm2=require(_0xbf8d('0x0'));var BPromise=require('bluebird');var config=require(_0xbf8d('0x1'));function connect(){return new BPromise(function(_0x295342,_0xfb4d27){return pm2[_0xbf8d('0x2')](function(_0xc6e9d6){if(_0xc6e9d6){return _0xfb4d27(_0xc6e9d6);}return _0x295342(_0xbf8d('0x3'));});});};exports['start']=function(_0x8c17d1){return connect()[_0xbf8d('0x4')](function(){return new BPromise(function(_0x2f3bf2,_0x44c765){return pm2[_0xbf8d('0x5')](_0x8c17d1,function(_0x12f40d,_0x5065ad){if(_0x12f40d){return _0x44c765(_0x12f40d);}pm2[_0xbf8d('0x6')]();return _0x2f3bf2(_0x5065ad);});});});};exports['stop']=function(_0x55e16a){return connect()[_0xbf8d('0x4')](function(){return new BPromise(function(_0x2dd165,_0x391657){return pm2[_0xbf8d('0x7')](_0x55e16a,function(_0x257aba,_0x1952c5){if(_0x257aba){return _0x391657(_0x257aba);}pm2[_0xbf8d('0x6')]();return _0x2dd165(_0x1952c5);});});});};exports[_0xbf8d('0x8')]=function(_0x2cc7a8){return connect()[_0xbf8d('0x4')](function(){return new BPromise(function(_0x2a853b,_0x31c83a){return pm2[_0xbf8d('0x8')](_0x2cc7a8,function(_0x26d761,_0x2acb8b){if(_0x26d761){return _0x31c83a(_0x26d761);}pm2[_0xbf8d('0x6')]();return _0x2a853b(_0x2acb8b);});});});};exports[_0xbf8d('0x9')]=function(){return connect()[_0xbf8d('0x4')](function(){return new BPromise(function(_0x354777,_0x45b018){return pm2[_0xbf8d('0x9')](function(_0xe25c13,_0x257cb1){if(_0xe25c13){return _0x45b018(_0xe25c13);}pm2[_0xbf8d('0x6')]();return _0x354777(_0x257cb1);});});});};exports[_0xbf8d('0xa')]=function(_0x3f195a){return connect()[_0xbf8d('0x4')](function(){return new BPromise(function(_0x38b42b,_0x144931){return pm2[_0xbf8d('0xa')](_0x3f195a,function(_0x3ec13b,_0x1460f1){if(_0x3ec13b){return _0x144931(_0x3ec13b);}pm2[_0xbf8d('0x6')]();return _0x38b42b(_0x1460f1);});});});};exports['delete']=function(_0x191c47){return connect()[_0xbf8d('0x4')](function(){return new BPromise(function(_0x3e42e4,_0x23f336){return pm2[_0xbf8d('0xb')](_0x191c47,function(_0x10b06e,_0x1a5a7f){if(_0x10b06e){return _0x23f336(_0x10b06e);}pm2[_0xbf8d('0x6')]();return _0x3e42e4(_0x1a5a7f);});});});};exports[_0xbf8d('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x37c2d6,_0x401fd8){return pm2[_0xbf8d('0xc')](function(_0x552d51){if(_0x552d51){return _0x401fd8(_0x552d51);}return _0x37c2d6(_0xbf8d('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b814a96..970dd4c 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 _0xb064=['findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0x9d77b5,_0x4fcdb3){var _0x4b26d0=function(_0xcb79d4){while(--_0xcb79d4){_0x9d77b5['push'](_0x9d77b5['shift']());}};_0x4b26d0(++_0x4fcdb3);}(_0xb064,0x1ad));var _0x4b06=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb064[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x4b06('0x0'));var moment=require(_0x4b06('0x1'));var Redis=require(_0x4b06('0x2'));var util=require('util');var config=require(_0x4b06('0x3'));var db=require(_0x4b06('0x4'))['db'];var logger=require(_0x4b06('0x5'))('schedule');config[_0x4b06('0x6')]=_[_0x4b06('0x7')](config[_0x4b06('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4b06('0x8'))(new Redis(config[_0x4b06('0x6')]));function closeInteractions(){var _0x3341dc=0x0;var _0x4868d1=[];return db[_0x4b06('0x9')][_0x4b06('0xa')]({'raw':!![],'attributes':['id',_0x4b06('0xb')],'where':{'id':0x1}})[_0x4b06('0xc')](function(_0x20e169){_0x3341dc=_0x20e169[_0x4b06('0xb')];if(_0x3341dc){return db['ChatInteraction'][_0x4b06('0xd')]({'raw':!![],'attributes':['id',_0x4b06('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4b06('0xf')](_0x20e169[_0x4b06('0xb')],_0x4b06('0x10'))}}});}else{return[];}})[_0x4b06('0xc')](function(_0x465efd){if(_0x465efd&&_0x465efd[_0x4b06('0x11')]){_0x4868d1=_[_0x4b06('0x12')](_0x465efd||[],'id');logger[_0x4b06('0x13')](_0x4b06('0x14'),_0x4868d1[_0x4b06('0x15')]());return db[_0x4b06('0x16')]['update']({'closeReason':_0x4b06('0x17'),'disposition':_0x4b06('0x18'),'closed':!![],'closedAt':moment()['format'](_0x4b06('0x19'))},{'where':{'id':_0x4868d1}});}})[_0x4b06('0xc')](function(){if(_0x4868d1&&_0x4868d1[_0x4b06('0x11')]){logger[_0x4b06('0x13')](_0x4b06('0x1a'),_0x4868d1[_0x4b06('0x15')]());for(var _0x3b95ba=0x0;_0x3b95ba<_0x4868d1[_0x4b06('0x11')];_0x3b95ba++){io[_0x4b06('0x1b')](_0x4b06('0x1c'),{'id':_0x4868d1[_0x3b95ba],'closed':!![]});}}})[_0x4b06('0x1d')](function(_0x38f0c6){logger[_0x4b06('0x1e')](_0x4b06('0x1f'),_0x38f0c6?util[_0x4b06('0x20')](_0x38f0c6,{'showHidden':![],'depth':null}):'');});}exports[_0x4b06('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfe6a=['info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe6a,0x10b));var _0xafe6=function(_0x45084f,_0x570d80){_0x45084f=_0x45084f-0x0;var _0x5d5fd2=_0xfe6a[_0x45084f];return _0x5d5fd2;};'use strict';var _=require(_0xafe6('0x0'));var moment=require(_0xafe6('0x1'));var Redis=require(_0xafe6('0x2'));var util=require(_0xafe6('0x3'));var config=require(_0xafe6('0x4'));var db=require(_0xafe6('0x5'))['db'];var logger=require(_0xafe6('0x6'))(_0xafe6('0x7'));config[_0xafe6('0x8')]=_[_0xafe6('0x9')](config[_0xafe6('0x8')],{'host':_0xafe6('0xa'),'port':0x18eb});var io=require(_0xafe6('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0x446c3c=0x0;var _0xf965e7=[];return db['Setting'][_0xafe6('0xc')]({'raw':!![],'attributes':['id',_0xafe6('0xd')],'where':{'id':0x1}})[_0xafe6('0xe')](function(_0x3beb59){_0x446c3c=_0x3beb59[_0xafe6('0xd')];if(_0x446c3c){return db[_0xafe6('0xf')][_0xafe6('0x10')]({'raw':!![],'attributes':['id',_0xafe6('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xafe6('0x12')](_0x3beb59[_0xafe6('0xd')],_0xafe6('0x13'))}}});}else{return[];}})[_0xafe6('0xe')](function(_0x48ffeb){if(_0x48ffeb&&_0x48ffeb['length']){_0xf965e7=_[_0xafe6('0x14')](_0x48ffeb||[],'id');logger[_0xafe6('0x15')](_0xafe6('0x16'),_0xf965e7[_0xafe6('0x17')]());return db[_0xafe6('0xf')][_0xafe6('0x18')]({'closeReason':_0xafe6('0x19'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xafe6('0x1a')](_0xafe6('0x1b'))},{'where':{'id':_0xf965e7}});}})[_0xafe6('0xe')](function(){if(_0xf965e7&&_0xf965e7[_0xafe6('0x1c')]){logger[_0xafe6('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xf965e7['join']());for(var _0x260324=0x0;_0x260324<_0xf965e7[_0xafe6('0x1c')];_0x260324++){io[_0xafe6('0x1d')](_0xafe6('0x1e'),{'id':_0xf965e7[_0x260324],'closed':!![]});}}})[_0xafe6('0x1f')](function(_0x5f532d){logger[_0xafe6('0x20')](_0xafe6('0x21'),_0x5f532d?util[_0xafe6('0x22')](_0x5f532d,{'showHidden':![],'depth':null}):'');});}exports[_0xafe6('0x23')]=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 a81b0bc..49eaeca 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 _0x3332=['index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','active','update','stop\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','email','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','zip','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','findAll','MailServerOut','keys','jobs','toString','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','toRun'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x3332,0x114));var _0x2333=function(_0x5a2162,_0x5a90a3){_0x5a2162=_0x5a2162-0x0;var _0x4561a7=_0x3332[_0x5a2162];return _0x4561a7;};'use strict';var fs=require('fs');var util=require(_0x2333('0x0'));var path=require(_0x2333('0x1'));var _=require(_0x2333('0x2'));var moment=require('moment');var CronJobManager=require(_0x2333('0x3'));var jayson=require(_0x2333('0x4'));var BPromise=require(_0x2333('0x5'));var logger=require(_0x2333('0x6'))(_0x2333('0x7'));var db=require(_0x2333('0x8'))['db'];var analyticCustomReportController=require(_0x2333('0x9'));var analyticDefaultReportController=require(_0x2333('0xa'));var client=jayson[_0x2333('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2b43ac,_0x4d1613){return function(){logger[_0x2333('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x2b43ac['email']);var _0x2641ea=!![];var _0x3f2d7d={'tls':{'rejectUnauthorized':![]}};if(_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')][_0x2333('0xf')]){_0x3f2d7d[_0x2333('0xf')]=_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')][_0x2333('0xf')];}else{_0x3f2d7d[_0x2333('0x10')]=_0x2b43ac[_0x2333('0xd')]['Smtp'][_0x2333('0x10')];_0x3f2d7d['port']=_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')][_0x2333('0x11')];_0x3f2d7d[_0x2333('0x12')]=_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')]['secure'];}if(_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')][_0x2333('0x13')]){_0x3f2d7d['auth']={'user':_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')][_0x2333('0x14')],'pass':_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')][_0x2333('0x15')]};}var _0x1d7dc7={'account':_0x3f2d7d,'message':{'from':util[_0x2333('0x16')](_0x2333('0x17'),_0x2b43ac[_0x2333('0xd')][_0x2333('0x18')],_0x2b43ac[_0x2333('0xd')][_0x2333('0x19')]||_0x2b43ac[_0x2333('0xd')][_0x2333('0xe')][_0x2333('0x14')]),'to':_0x2b43ac[_0x2333('0x19')],'cc':_0x2b43ac['cc'],'bcc':_0x2b43ac['bcc'],'subject':util[_0x2333('0x16')](_0x2333('0x1a'),_0x4d1613[_0x2333('0x18')],_0x2b43ac[_0x2333('0x1b')],_0x2b43ac[_0x2333('0x1c')])}};var _0x43f52f=path[_0x2333('0x1d')](__dirname,_0x2333('0x1e'));var _0x42ca22=_0x4d1613[_0x2333('0x1f')];var _0x42ca00=util[_0x2333('0x16')](_0x2333('0x20'),path['basename'](_0x4d1613[_0x2333('0x1f')],path['extname'](_0x4d1613[_0x2333('0x1f')])),_0x2333('0x21'));var _0x597cd2=path[_0x2333('0x1d')](_0x43f52f,_0x42ca22);var _0x5d98b6=path[_0x2333('0x1d')](_0x43f52f,_0x42ca00);if(fs['existsSync'](_0x597cd2)){_0x4d1613[_0x2333('0x22')]=_0x2333('0x23');_0x1d7dc7[_0x2333('0x24')][_0x2333('0x25')]=[{'filename':_0x42ca22,'path':_0x597cd2}];_0x1d7dc7[_0x2333('0x24')]['text']=util[_0x2333('0x16')](_0x2333('0x26'),JSON[_0x2333('0x27')](_0x4d1613,null,0x2));}else if(fs[_0x2333('0x28')](_0x5d98b6)){_0x4d1613[_0x2333('0x22')]=_0x2333('0x23');_0x1d7dc7['message']['attachments']=[{'filename':_0x42ca00,'path':_0x5d98b6}];}else{_0x1d7dc7['message'][_0x2333('0x29')]=_0x2333('0x2a');if(!_0x2b43ac['sendIfEmpty']){_0x2641ea=![];logger[_0x2333('0xc')](_0x2333('0x2b'));}}if(_0x2641ea){return client[_0x2333('0x2c')](_0x2333('0x2d'),_0x1d7dc7)[_0x2333('0x2e')](function(_0x2cd7d5){if(_0x2cd7d5[_0x2333('0x2f')]){return logger[_0x2333('0x2f')](_0x2333('0x30'),JSON[_0x2333('0x27')](_0x2cd7d5));}return logger[_0x2333('0xc')](_0x2333('0x31'));})[_0x2333('0x32')](function(_0x396909){return logger[_0x2333('0x2f')](_0x2333('0x30'),JSON['stringify'](_0x396909));});}};}function handleError(){return function(_0x3c248e){return logger[_0x2333('0x2f')](JSON['stringify'](_0x3c248e));};}function handleResult(_0x37b0b6){return function(_0x28f51f){logger[_0x2333('0xc')]('data',JSON['stringify'](_0x28f51f));if(_0x37b0b6[_0x2333('0xd')]&&_0x37b0b6[_0x2333('0xd')]['Smtp']&&!_['isNil'](_0x37b0b6[_0x2333('0x19')])){setTimeout(handleSendEmail(_0x37b0b6,_0x28f51f),0x3c*0x3e8);}};}function handleJob(_0x57cf63){return function(){try{if(_[_0x2333('0x33')](_0x57cf63[_0x2333('0x1b')])){return logger[_0x2333('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x57cf63['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x1d36d2={'startDate':moment()[_0x2333('0x34')](_0x57cf63[_0x2333('0x1b')],_0x57cf63[_0x2333('0x1c')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x2333('0x16')](_0x2333('0x35')),'type':'scheduled','output':_0x57cf63['output'],'name':_0x57cf63['name']};if(!_['isNil'](_0x57cf63[_0x2333('0x36')])){logger[_0x2333('0xc')](_0x2333('0x37'),_0x57cf63[_0x2333('0x36')]);return analyticDefaultReportController[_0x2333('0x38')]({'id':_0x57cf63[_0x2333('0x36')]},_0x1d36d2)[_0x2333('0x2e')](handleResult(_0x57cf63))[_0x2333('0x32')](handleError());}if(!_[_0x2333('0x33')](_0x57cf63[_0x2333('0x39')])){logger[_0x2333('0xc')]('exec\x20custom\x20report\x20id:%s',_0x57cf63['CustomReportId']);return analyticCustomReportController[_0x2333('0x38')]({'id':_0x57cf63[_0x2333('0x39')]},_0x1d36d2)['then'](handleResult(_0x57cf63))[_0x2333('0x32')](handleError());}}catch(_0x2a12c0){logger[_0x2333('0x2f')](JSON[_0x2333('0x27')](_0x2a12c0));}return logger[_0x2333('0xc')](_0x2333('0x3a'));};}function getJobs(_0x2a6073){var _0x5bc7a0={};if(_0x2a6073){_0x5bc7a0['id']=_0x2a6073;}return db['Schedule'][_0x2333('0x3b')]({'where':_0x5bc7a0,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x2333('0x19')],'include':[{'model':db[_0x2333('0x3c')],'as':_0x2333('0xe')}]}]})[_0x2333('0x2e')](function(_0x835918){var _0x3989d0=_[_0x2333('0x3d')](manager[_0x2333('0x3e')]);var _0x50d3de=_['map'](_0x835918,function(_0x1cf61a){return _0x1cf61a['id']['toString']();});var _0x460b04=_['keyBy'](_0x835918,function(_0x3ae3ff){return _0x3ae3ff['id'][_0x2333('0x3f')]();});var _0x5a2795=_0x2a6073?_0x50d3de:_['difference'](_0x50d3de,_0x3989d0);var _0x3a80f1=_[_0x2333('0x40')](_0x50d3de,_0x3989d0);var _0x1b7c1a=_[_0x2333('0x41')](_0x3989d0,_0x50d3de);var _0x5d6a72;var _0x1dfc34;for(_0x5d6a72=0x0;_0x5d6a72<_0x1b7c1a[_0x2333('0x42')]&&!_0x2a6073;_0x5d6a72+=0x1){_0x1dfc34=_0x1b7c1a[_0x5d6a72]['toString']();if(manager[_0x2333('0x43')](_0x1dfc34)){manager[_0x2333('0x44')](_0x1dfc34);manager[_0x2333('0x45')](_0x1dfc34);logger[_0x2333('0xc')](_0x2333('0x46'),_0x1dfc34);}}logger['info'](_0x2333('0x47'),JSON['stringify'](_0x5a2795));for(_0x5d6a72=0x0;_0x5d6a72<_0x5a2795[_0x2333('0x42')];_0x5d6a72+=0x1){_0x1dfc34=_0x5a2795[_0x5d6a72][_0x2333('0x3f')]();logger[_0x2333('0xc')](_0x2333('0x48'),_0x1dfc34);if(_0x2a6073){logger['info'](_0x2333('0x49'),_0x2a6073);logger[_0x2333('0xc')](JSON[_0x2333('0x27')](_0x460b04[_0x1dfc34]));BPromise[_0x2333('0x4a')]()['then'](handleJob(_0x460b04[_0x1dfc34]));logger[_0x2333('0xc')](_0x2333('0x4b'),_0x460b04[_0x1dfc34][_0x2333('0x18')],_0x460b04[_0x1dfc34]['cron']);}else if(_0x460b04[_0x1dfc34][_0x2333('0x4c')]&&_0x460b04[_0x1dfc34]['active']&&moment()[_0x2333('0x4d')](_0x460b04[_0x1dfc34][_0x2333('0x4e')],_0x460b04[_0x1dfc34][_0x2333('0x4f')])){manager[_0x2333('0x50')](_0x1dfc34,_0x460b04[_0x1dfc34][_0x2333('0x4c')],handleJob(_0x460b04[_0x1dfc34]));manager[_0x2333('0x51')](_0x1dfc34);logger[_0x2333('0xc')](_0x2333('0x52'),_0x460b04[_0x1dfc34][_0x2333('0x18')],_0x460b04[_0x1dfc34][_0x2333('0x4c')]);}else if(manager[_0x2333('0x43')](_0x1dfc34)){manager[_0x2333('0x44')](_0x1dfc34);manager['deleteJob'](_0x1dfc34);logger['info']('stop\x20cron',_0x460b04[_0x1dfc34][_0x2333('0x18')],_0x460b04[_0x1dfc34][_0x2333('0x4c')]);}}for(_0x5d6a72=0x0,_0x1dfc34;_0x5d6a72<_0x3a80f1[_0x2333('0x42')]&&!_0x2a6073;_0x5d6a72+=0x1){_0x1dfc34=_0x3a80f1[_0x5d6a72][_0x2333('0x3f')]();if(manager[_0x2333('0x43')](_0x1dfc34)){if(_0x460b04[_0x1dfc34][_0x2333('0x4c')]&&_0x460b04[_0x1dfc34][_0x2333('0x53')]&&moment()[_0x2333('0x4d')](_0x460b04[_0x1dfc34][_0x2333('0x4e')],_0x460b04[_0x1dfc34][_0x2333('0x4f')])){manager[_0x2333('0x54')](_0x1dfc34,_0x460b04[_0x1dfc34][_0x2333('0x4c')],handleJob(_0x460b04[_0x1dfc34]));logger['info']('update\x20cron',_0x460b04[_0x1dfc34][_0x2333('0x18')],_0x460b04[_0x1dfc34]['cron']);}else{manager[_0x2333('0x44')](_0x1dfc34);manager[_0x2333('0x45')](_0x1dfc34);logger[_0x2333('0xc')](_0x2333('0x55'),_0x460b04[_0x1dfc34]['name'],_0x460b04[_0x1dfc34][_0x2333('0x4c')]);}}}})['catch'](function(_0x3d33cf){logger[_0x2333('0x2f')](JSON[_0x2333('0x27')](_0x3d33cf));});}exports[_0x2333('0x56')]=function(_0x1927b9){return getJobs(_0x1927b9);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2f73=['message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','stringify','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','toRun','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','stop\x20cron','isBetween','update','update\x20cron','run','lodash','moment','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','zip','join','existsSync','status','Sent'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x2f73,0x18e));var _0x32f7=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0x2f73[_0x2fa457];return _0x4f250a;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x32f7('0x0'));var moment=require(_0x32f7('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x32f7('0x2'));var logger=require(_0x32f7('0x3'))('schedule');var db=require(_0x32f7('0x4'))['db'];var analyticCustomReportController=require(_0x32f7('0x5'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x32f7('0x6')][_0x32f7('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x458bf4,_0x44f891){return function(){logger['info'](_0x32f7('0x8'),_0x458bf4[_0x32f7('0x9')]);var _0x275b2f=!![];var _0x210b92={'tls':{'rejectUnauthorized':![]}};if(_0x458bf4[_0x32f7('0xa')]['Smtp']['service']){_0x210b92['service']=_0x458bf4[_0x32f7('0xa')][_0x32f7('0xb')]['service'];}else{_0x210b92[_0x32f7('0xc')]=_0x458bf4[_0x32f7('0xa')][_0x32f7('0xb')]['host'];_0x210b92[_0x32f7('0xd')]=_0x458bf4[_0x32f7('0xa')][_0x32f7('0xb')][_0x32f7('0xd')];_0x210b92[_0x32f7('0xe')]=_0x458bf4[_0x32f7('0xa')][_0x32f7('0xb')]['secure'];}if(_0x458bf4[_0x32f7('0xa')]['Smtp']['authentication']){_0x210b92[_0x32f7('0xf')]={'user':_0x458bf4[_0x32f7('0xa')][_0x32f7('0xb')][_0x32f7('0x10')],'pass':_0x458bf4[_0x32f7('0xa')][_0x32f7('0xb')][_0x32f7('0x11')]};}var _0x31b2f0={'account':_0x210b92,'message':{'from':util[_0x32f7('0x12')](_0x32f7('0x13'),_0x458bf4[_0x32f7('0xa')][_0x32f7('0x14')],_0x458bf4[_0x32f7('0xa')][_0x32f7('0x9')]||_0x458bf4[_0x32f7('0xa')]['Smtp'][_0x32f7('0x10')]),'to':_0x458bf4['email'],'cc':_0x458bf4['cc'],'bcc':_0x458bf4[_0x32f7('0x15')],'subject':util[_0x32f7('0x12')]('Report\x20%s\x20last\x20%s\x20%s',_0x44f891[_0x32f7('0x14')],_0x458bf4[_0x32f7('0x16')],_0x458bf4[_0x32f7('0x17')])}};var _0x56bbff=path['join'](__dirname,_0x32f7('0x18'));var _0x238cd0=_0x44f891[_0x32f7('0x19')];var _0xb07d11=util[_0x32f7('0x12')](_0x32f7('0x1a'),path['basename'](_0x44f891['savename'],path['extname'](_0x44f891[_0x32f7('0x19')])),_0x32f7('0x1b'));var _0x10b795=path[_0x32f7('0x1c')](_0x56bbff,_0x238cd0);var _0x4a6ef4=path[_0x32f7('0x1c')](_0x56bbff,_0xb07d11);if(fs[_0x32f7('0x1d')](_0x10b795)){_0x44f891[_0x32f7('0x1e')]=_0x32f7('0x1f');_0x31b2f0[_0x32f7('0x20')][_0x32f7('0x21')]=[{'filename':_0x238cd0,'path':_0x10b795}];_0x31b2f0[_0x32f7('0x20')][_0x32f7('0x22')]=util[_0x32f7('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x44f891,null,0x2));}else if(fs['existsSync'](_0x4a6ef4)){_0x44f891[_0x32f7('0x1e')]=_0x32f7('0x1f');_0x31b2f0['message']['attachments']=[{'filename':_0xb07d11,'path':_0x4a6ef4}];}else{_0x31b2f0[_0x32f7('0x20')]['text']=_0x32f7('0x23');if(!_0x458bf4[_0x32f7('0x24')]){_0x275b2f=![];logger[_0x32f7('0x25')](_0x32f7('0x26'));}}if(_0x275b2f){return client[_0x32f7('0x27')](_0x32f7('0x28'),_0x31b2f0)[_0x32f7('0x29')](function(_0x1df565){if(_0x1df565[_0x32f7('0x2a')]){return logger[_0x32f7('0x2a')](_0x32f7('0x2b'),JSON['stringify'](_0x1df565));}return logger[_0x32f7('0x25')](_0x32f7('0x2c'));})['catch'](function(_0x3f63a9){return logger[_0x32f7('0x2a')](_0x32f7('0x2b'),JSON[_0x32f7('0x2d')](_0x3f63a9));});}};}function handleError(){return function(_0x46850b){return logger[_0x32f7('0x2a')](JSON[_0x32f7('0x2d')](_0x46850b));};}function handleResult(_0x69742){return function(_0x3a8409){logger[_0x32f7('0x25')]('data',JSON[_0x32f7('0x2d')](_0x3a8409));if(_0x69742['MailAccount']&&_0x69742['MailAccount'][_0x32f7('0xb')]&&!_['isNil'](_0x69742[_0x32f7('0x9')])){setTimeout(handleSendEmail(_0x69742,_0x3a8409),0x3c*0x3e8);}};}function handleJob(_0x50487d){return function(){try{if(_[_0x32f7('0x2e')](_0x50487d[_0x32f7('0x16')])){return logger[_0x32f7('0x25')](_0x32f7('0x2f'));}if(_[_0x32f7('0x2e')](_0x50487d[_0x32f7('0x17')])){return logger[_0x32f7('0x25')](_0x32f7('0x30'));}var _0x48a97d={'startDate':moment()[_0x32f7('0x31')](_0x50487d['subtractNumber'],_0x50487d[_0x32f7('0x17')])[_0x32f7('0x12')](_0x32f7('0x32')),'endDate':moment()[_0x32f7('0x12')](_0x32f7('0x32')),'type':_0x32f7('0x33'),'output':_0x50487d[_0x32f7('0x34')],'name':_0x50487d[_0x32f7('0x14')]};if(!_[_0x32f7('0x2e')](_0x50487d[_0x32f7('0x35')])){logger[_0x32f7('0x25')]('exec\x20defaul\x20report\x20id:%s',_0x50487d[_0x32f7('0x35')]);return analyticDefaultReportController[_0x32f7('0x36')]({'id':_0x50487d[_0x32f7('0x35')]},_0x48a97d)[_0x32f7('0x29')](handleResult(_0x50487d))[_0x32f7('0x37')](handleError());}if(!_[_0x32f7('0x2e')](_0x50487d[_0x32f7('0x38')])){logger[_0x32f7('0x25')](_0x32f7('0x39'),_0x50487d['CustomReportId']);return analyticCustomReportController[_0x32f7('0x36')]({'id':_0x50487d[_0x32f7('0x38')]},_0x48a97d)[_0x32f7('0x29')](handleResult(_0x50487d))[_0x32f7('0x37')](handleError());}}catch(_0x40b002){logger['error'](JSON[_0x32f7('0x2d')](_0x40b002));}return logger[_0x32f7('0x25')](_0x32f7('0x3a'));};}function getJobs(_0x4095df){var _0x34cd70={};if(_0x4095df){_0x34cd70['id']=_0x4095df;}return db[_0x32f7('0x3b')]['findAll']({'where':_0x34cd70,'include':[{'model':db['MailAccount'],'attributes':['id',_0x32f7('0x14'),_0x32f7('0x9')],'include':[{'model':db[_0x32f7('0x3c')],'as':_0x32f7('0xb')}]}]})[_0x32f7('0x29')](function(_0x130b30){var _0x59832f=_['keys'](manager[_0x32f7('0x3d')]);var _0xbe817a=_[_0x32f7('0x3e')](_0x130b30,function(_0x31b0f5){return _0x31b0f5['id']['toString']();});var _0x5f9200=_[_0x32f7('0x3f')](_0x130b30,function(_0x329a17){return _0x329a17['id'][_0x32f7('0x40')]();});var _0x50ac0a=_0x4095df?_0xbe817a:_[_0x32f7('0x41')](_0xbe817a,_0x59832f);var _0x113a1b=_[_0x32f7('0x42')](_0xbe817a,_0x59832f);var _0x12eb1f=_[_0x32f7('0x41')](_0x59832f,_0xbe817a);var _0x4ebfcf;var _0x306a6d;for(_0x4ebfcf=0x0;_0x4ebfcf<_0x12eb1f[_0x32f7('0x43')]&&!_0x4095df;_0x4ebfcf+=0x1){_0x306a6d=_0x12eb1f[_0x4ebfcf][_0x32f7('0x40')]();if(manager[_0x32f7('0x44')](_0x306a6d)){manager[_0x32f7('0x45')](_0x306a6d);manager[_0x32f7('0x46')](_0x306a6d);logger[_0x32f7('0x25')]('delete\x20cron',_0x306a6d);}}logger[_0x32f7('0x25')](_0x32f7('0x47'),JSON[_0x32f7('0x2d')](_0x50ac0a));for(_0x4ebfcf=0x0;_0x4ebfcf<_0x50ac0a[_0x32f7('0x43')];_0x4ebfcf+=0x1){_0x306a6d=_0x50ac0a[_0x4ebfcf][_0x32f7('0x40')]();logger[_0x32f7('0x25')]('index',_0x306a6d);if(_0x4095df){logger[_0x32f7('0x25')](_0x32f7('0x48'),_0x4095df);logger[_0x32f7('0x25')](JSON[_0x32f7('0x2d')](_0x5f9200[_0x306a6d]));BPromise[_0x32f7('0x49')]()[_0x32f7('0x29')](handleJob(_0x5f9200[_0x306a6d]));logger[_0x32f7('0x25')](_0x32f7('0x4a'),_0x5f9200[_0x306a6d]['name'],_0x5f9200[_0x306a6d][_0x32f7('0x4b')]);}else if(_0x5f9200[_0x306a6d][_0x32f7('0x4b')]&&_0x5f9200[_0x306a6d][_0x32f7('0x4c')]&&moment()['isBetween'](_0x5f9200[_0x306a6d][_0x32f7('0x4d')],_0x5f9200[_0x306a6d][_0x32f7('0x4e')])){manager[_0x32f7('0x4f')](_0x306a6d,_0x5f9200[_0x306a6d][_0x32f7('0x4b')],handleJob(_0x5f9200[_0x306a6d]));manager[_0x32f7('0x50')](_0x306a6d);logger[_0x32f7('0x25')]('add\x20cron',_0x5f9200[_0x306a6d][_0x32f7('0x14')],_0x5f9200[_0x306a6d][_0x32f7('0x4b')]);}else if(manager['exists'](_0x306a6d)){manager['stop'](_0x306a6d);manager[_0x32f7('0x46')](_0x306a6d);logger[_0x32f7('0x25')](_0x32f7('0x51'),_0x5f9200[_0x306a6d][_0x32f7('0x14')],_0x5f9200[_0x306a6d]['cron']);}}for(_0x4ebfcf=0x0,_0x306a6d;_0x4ebfcf<_0x113a1b['length']&&!_0x4095df;_0x4ebfcf+=0x1){_0x306a6d=_0x113a1b[_0x4ebfcf][_0x32f7('0x40')]();if(manager[_0x32f7('0x44')](_0x306a6d)){if(_0x5f9200[_0x306a6d][_0x32f7('0x4b')]&&_0x5f9200[_0x306a6d][_0x32f7('0x4c')]&&moment()[_0x32f7('0x52')](_0x5f9200[_0x306a6d][_0x32f7('0x4d')],_0x5f9200[_0x306a6d][_0x32f7('0x4e')])){manager[_0x32f7('0x53')](_0x306a6d,_0x5f9200[_0x306a6d][_0x32f7('0x4b')],handleJob(_0x5f9200[_0x306a6d]));logger[_0x32f7('0x25')](_0x32f7('0x54'),_0x5f9200[_0x306a6d][_0x32f7('0x14')],_0x5f9200[_0x306a6d][_0x32f7('0x4b')]);}else{manager[_0x32f7('0x45')](_0x306a6d);manager[_0x32f7('0x46')](_0x306a6d);logger[_0x32f7('0x25')](_0x32f7('0x51'),_0x5f9200[_0x306a6d][_0x32f7('0x14')],_0x5f9200[_0x306a6d][_0x32f7('0x4b')]);}}}})[_0x32f7('0x37')](function(_0x324219){logger[_0x32f7('0x2a')](JSON[_0x32f7('0x2d')](_0x324219));});}exports[_0x32f7('0x55')]=function(_0x42668d){return getJobs(_0x42668d);};exports[_0x32f7('0x50')]=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 d9c23d4..218c83a 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 _0xdc8d=['bucket','ValidationError','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','Mixed','COMPLETED','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','error','start','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','info','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language'];(function(_0x14408a,_0xf2dc56){var _0x28f986=function(_0x32eb43){while(--_0x32eb43){_0x14408a['push'](_0x14408a['shift']());}};_0x28f986(++_0xf2dc56);}(_0xdc8d,0xb2));var _0xddc8=function(_0x2676cd,_0x84a3ba){_0x2676cd=_0x2676cd-0x0;var _0x2e5daa=_0xdc8d[_0x2676cd];return _0x2e5daa;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xddc8('0x0'));var BPromise=require(_0xddc8('0x1'));var db=require(_0xddc8('0x2'))['db'];var logger=require(_0xddc8('0x3'))('transcribe');function getTranscriptionJob(_0x1fbb32,_0x31e337,_0x3e84aa,_0x16adac){return new Promise(function(_0x1bd296,_0x45c9dc){var _0xd58a90=new AWS[(_0xddc8('0x4'))]({'accessKeyId':_0x31e337,'secretAccessKey':_0x1fbb32,'region':_0x3e84aa});_0xd58a90[_0xddc8('0x5')]({'TranscriptionJobName':_0x16adac},function(_0x1d076a,_0x6c62be){if(_0x1d076a){return _0x45c9dc(_0x1d076a);}else{return _0x1bd296(_0x6c62be);}});});}function sentiment(_0x210576,_0x395f41,_0x585640,_0x3726a6,_0x503fbb){return new Promise(function(_0x5a4081,_0x452f49){var _0x4075e3=new AWS[(_0xddc8('0x6'))]({'accessKeyId':_0x395f41,'secretAccessKey':_0x210576,'region':_0x585640});_0x4075e3['detectSentiment']({'Text':_0x3726a6,'LanguageCode':_0x503fbb['substring'](0x0,0x2)},function(_0x15d405,_0x5dd4f0){if(_0x15d405){return _0x452f49(_0x15d405);}else{return _0x5a4081(_0x5dd4f0);}});});}function checkTranscribeJob(_0x2e0a09,_0x4ec880,_0x20c95c){var _0x25c776;return new BPromise(function(_0x3ad79d,_0x30e95e){logger['info'](util[_0xddc8('0x7')](_0xddc8('0x8'),_0x2e0a09['id'],_0x2e0a09[_0xddc8('0x9')]));return getTranscriptionJob(_0x20c95c[_0xddc8('0xa')],_0x20c95c[_0xddc8('0xb')],_0x4ec880['transcribeRegion'],_0x2e0a09[_0xddc8('0x9')])[_0xddc8('0xc')](function(_0x546d86){logger[_0xddc8('0xd')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2e0a09['id'],_0x2e0a09[_0xddc8('0x9')],_0x546d86[_0xddc8('0xe')][_0xddc8('0xf')]));if(!_0x2e0a09[_0xddc8('0x10')]){switch(_0x546d86['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x41ee9b={'transcribeStatus':_0x546d86[_0xddc8('0xe')][_0xddc8('0xf')],'fileUri':_0x546d86[_0xddc8('0xe')][_0xddc8('0x11')]['TranscriptFileUri']};logger['info'](util[_0xddc8('0x7')](_0xddc8('0x12'),_0x2e0a09['id']));return rp({'uri':_0x546d86['TranscriptionJob'][_0xddc8('0x11')][_0xddc8('0x13')],'json':!![]})[_0xddc8('0xc')](function(_0x2321ae){logger['info'](util[_0xddc8('0x7')](_0xddc8('0x14'),_0x2e0a09['id']));if(_0x2321ae&&_0x2321ae['results']&&_0x2321ae[_0xddc8('0x15')]['transcripts']&&_0x2321ae[_0xddc8('0x15')][_0xddc8('0x16')][_0xddc8('0x17')]){_0x41ee9b['fileText']='';for(var _0x2505ed=0x0;_0x2505ed<_0x2321ae[_0xddc8('0x15')][_0xddc8('0x16')][_0xddc8('0x17')];_0x2505ed++){_0x41ee9b[_0xddc8('0x10')]+=_0x2321ae[_0xddc8('0x15')][_0xddc8('0x16')][_0x2505ed]['transcript']+'';}}return _0x2e0a09[_0xddc8('0x18')](_0x41ee9b);})[_0xddc8('0xc')](function(){logger[_0xddc8('0xd')](util[_0xddc8('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2e0a09['id']));if(!_0x2e0a09[_0xddc8('0x19')]){throw new db[(_0xddc8('0x1a'))]['ValidationError'](_0xddc8('0x1b'));}if(!_0x4ec880[_0xddc8('0x1c')]||!_0x4ec880[_0xddc8('0x1d')]||!_0x4ec880[_0xddc8('0x1e')]||!_0x4ec880[_0xddc8('0x1f')]||!_0x4ec880[_0xddc8('0x20')]){throw new db['Sequelize'][(_0xddc8('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x41ee9b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x4ec880[_0xddc8('0x1d')]===_0x20c95c['id']){return _0x20c95c;}else{return db[_0xddc8('0x22')][_0xddc8('0x23')]({'where':{'id':_settings[_0xddc8('0x1d')]}});}})[_0xddc8('0xc')](function(_0x13fc2e){if(!_0x13fc2e){throw new db[(_0xddc8('0x1a'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x13fc2e[_0xddc8('0xa')]||!_0x13fc2e[_0xddc8('0xb')]){throw new db[(_0xddc8('0x1a'))][(_0xddc8('0x21'))](_0xddc8('0x24'));}_0x25c776=_0x13fc2e;logger[_0xddc8('0xd')](util[_0xddc8('0x7')](_0xddc8('0x25'),_0x2e0a09['id']));return sentiment(_0x25c776[_0xddc8('0xa')],_0x25c776['data2'],_0x4ec880[_0xddc8('0x1e')],_0x41ee9b[_0xddc8('0x10')],_0x4ec880[_0xddc8('0x1f')]);})['then'](function(_0x31965a){logger['info'](util[_0xddc8('0x7')](_0xddc8('0x26'),_0x2e0a09['id']));return _0x2e0a09[_0xddc8('0x18')]({'sentiment':_0x31965a[_0xddc8('0x27')],'sPositive':_0x31965a[_0xddc8('0x28')][_0xddc8('0x29')],'sNegative':_0x31965a['SentimentScore'][_0xddc8('0x2a')],'sMixed':_0x31965a[_0xddc8('0x28')]['Mixed'],'sNeutral':_0x31965a[_0xddc8('0x28')][_0xddc8('0x2b')]});})['then'](function(){logger[_0xddc8('0xd')](util[_0xddc8('0x7')](_0xddc8('0x2c'),_0x2e0a09['id']));_0x3ad79d();});case _0xddc8('0x2d'):return _0x2e0a09[_0xddc8('0x18')]({'transcribeStatus':_0xddc8('0x2d'),'failureReason':_0x546d86[_0xddc8('0xe')]['FailureReason']})['then'](function(){logger[_0xddc8('0xd')](util['format'](_0xddc8('0x2c'),_0x2e0a09['id']));_0x3ad79d();});default:logger[_0xddc8('0xd')](util[_0xddc8('0x7')](_0xddc8('0x2e'),_0x2e0a09['id']));break;}}else{return BPromise[_0xddc8('0x2f')]()[_0xddc8('0xc')](function(){if(!_0x2e0a09['tempSentiment']){throw new db['Sequelize'][(_0xddc8('0x21'))](_0xddc8('0x1b'));}if(!_0x4ec880[_0xddc8('0x1c')]||!_0x4ec880[_0xddc8('0x1d')]||!_0x4ec880[_0xddc8('0x1e')]||!_0x4ec880['language']||!_0x4ec880[_0xddc8('0x20')]){throw new db[(_0xddc8('0x1a'))][(_0xddc8('0x21'))](_0xddc8('0x30'));}if(!_0x2e0a09['fileText']){throw new Error(_0xddc8('0x31'));}if(_0x4ec880['sentimentAccountId']===_0x20c95c['id']){return _0x20c95c;}else{return db[_0xddc8('0x22')]['findOne']({'where':{'id':_settings[_0xddc8('0x1d')]}});}})[_0xddc8('0xc')](function(_0x3643e5){if(!_0x3643e5){throw new db['Sequelize'][(_0xddc8('0x21'))](_0xddc8('0x32'));}if(!_0x3643e5[_0xddc8('0xa')]||!_0x3643e5[_0xddc8('0xb')]){throw new db[(_0xddc8('0x1a'))][(_0xddc8('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x25c776=_0x3643e5;logger['info'](util[_0xddc8('0x7')](_0xddc8('0x25'),_0x2e0a09['id']));return sentiment(_0x25c776[_0xddc8('0xa')],_0x25c776[_0xddc8('0xb')],_0x4ec880['sentimentRegion'],_0x2e0a09['fileText'],_0x4ec880[_0xddc8('0x1f')]);})[_0xddc8('0xc')](function(_0x2435e0){logger['info'](util[_0xddc8('0x7')](_0xddc8('0x26'),_0x2e0a09['id']));return _0x2e0a09[_0xddc8('0x18')]({'sentiment':_0x2435e0['Sentiment'],'sPositive':_0x2435e0['SentimentScore']['Positive'],'sNegative':_0x2435e0[_0xddc8('0x28')][_0xddc8('0x2a')],'sMixed':_0x2435e0[_0xddc8('0x28')][_0xddc8('0x33')],'sNeutral':_0x2435e0[_0xddc8('0x28')][_0xddc8('0x2b')],'transcribeStatus':_0xddc8('0x34')});})[_0xddc8('0xc')](function(){logger['info'](util[_0xddc8('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2e0a09['id']));_0x3ad79d();});}})[_0xddc8('0x35')](function(_0x5d44d9){if(_0x5d44d9){if(!_0x5d44d9['name']||_0x5d44d9[_0xddc8('0x36')]!=='SequelizeValidationError'){logger['error'](util[_0xddc8('0x7')](_0xddc8('0x37'),_0x2e0a09['id']),util[_0xddc8('0x38')](_0x5d44d9,{'showHidden':![],'depth':null}));}}_0x3ad79d();});});}function checkTranscribe(){var _0x51551d;var _0x22aef9;var _0x37799c;return db[_0xddc8('0x39')]['findAll']({'where':{'transcribeStatus':_0xddc8('0x3a')}})[_0xddc8('0xc')](function(_0x1761a2){if(!_0x1761a2||!_0x1761a2['length']){throw new db['Sequelize'][(_0xddc8('0x21'))](_0xddc8('0x3b'));}_0x51551d=_0x1761a2;return db['Setting'][_0xddc8('0x23')]({'where':{'id':0x1}});})[_0xddc8('0xc')](function(_0x25f77f){if(!_0x25f77f){throw new db[(_0xddc8('0x1a'))][(_0xddc8('0x21'))](_0xddc8('0x3c'));}_0x22aef9=_0x25f77f;if(!_0x22aef9['transcribe']||!_0x22aef9[_0xddc8('0x3d')]||!_0x22aef9[_0xddc8('0x3e')]||!_0x22aef9[_0xddc8('0x1f')]||!_0x22aef9[_0xddc8('0x20')]){throw new db[(_0xddc8('0x1a'))][(_0xddc8('0x21'))](_0xddc8('0x3f'));}return db[_0xddc8('0x22')]['findOne']({'where':{'id':_0x22aef9[_0xddc8('0x3d')]}});})[_0xddc8('0xc')](function(_0x3b1c56){if(!_0x3b1c56){throw new db[(_0xddc8('0x1a'))]['ValidationError'](_0xddc8('0x32'));}if(!_0x3b1c56[_0xddc8('0xa')]||!_0x3b1c56[_0xddc8('0xb')]){throw new db['Sequelize'][(_0xddc8('0x21'))](_0xddc8('0x24'));}_0x37799c=_0x3b1c56;var _0x22e9fa=[];_0x51551d[_0xddc8('0x40')](function(_0x3974eb){_0x22e9fa[_0xddc8('0x41')](checkTranscribeJob(_0x3974eb,_0x22aef9,_0x37799c));});return BPromise[_0xddc8('0x42')](_0x22e9fa);})[_0xddc8('0x35')](function(_0xc6c439){if(_0xc6c439){if(!_0xc6c439[_0xddc8('0x36')]||_0xc6c439[_0xddc8('0x36')]!==_0xddc8('0x43')){logger[_0xddc8('0x44')](util['inspect'](_0xc6c439,{'showHidden':![],'depth':null}));}}});}exports[_0xddc8('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xddb2=['transcribeRegion','then','format','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','ValidationError','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Negative','Mixed','Neutral','catch','name','SequelizeValidationError','inspect','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','error','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2'];(function(_0x40cb7a,_0x505484){var _0x246f9c=function(_0x3bd730){while(--_0x3bd730){_0x40cb7a['push'](_0x40cb7a['shift']());}};_0x246f9c(++_0x505484);}(_0xddb2,0x111));var _0x2ddb=function(_0x32defb,_0x527e2c){_0x32defb=_0x32defb-0x0;var _0x2364ce=_0xddb2[_0x32defb];return _0x2364ce;};var _=require(_0x2ddb('0x0'));var AWS=require(_0x2ddb('0x1'));var rp=require(_0x2ddb('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x2ddb('0x3'))['db'];var logger=require(_0x2ddb('0x4'))(_0x2ddb('0x5'));function getTranscriptionJob(_0x429792,_0x2bf2a6,_0x5a86ef,_0x39294a){return new Promise(function(_0x5641ec,_0x520d01){var _0x3ad284=new AWS[(_0x2ddb('0x6'))]({'accessKeyId':_0x2bf2a6,'secretAccessKey':_0x429792,'region':_0x5a86ef});_0x3ad284['getTranscriptionJob']({'TranscriptionJobName':_0x39294a},function(_0x1d8811,_0x5e0961){if(_0x1d8811){return _0x520d01(_0x1d8811);}else{return _0x5641ec(_0x5e0961);}});});}function sentiment(_0x5e7c26,_0x4d29e7,_0x39a1cc,_0x55fefa,_0x1535f8){return new Promise(function(_0x13d8c4,_0x470667){var _0x19e34f=new AWS[(_0x2ddb('0x7'))]({'accessKeyId':_0x4d29e7,'secretAccessKey':_0x5e7c26,'region':_0x39a1cc});_0x19e34f[_0x2ddb('0x8')]({'Text':_0x55fefa,'LanguageCode':_0x1535f8[_0x2ddb('0x9')](0x0,0x2)},function(_0x4bce32,_0x167a1f){if(_0x4bce32){return _0x470667(_0x4bce32);}else{return _0x13d8c4(_0x167a1f);}});});}function checkTranscribeJob(_0x12413c,_0x251d8a,_0x370c7d){var _0x265e71;return new BPromise(function(_0x32535e,_0x358391){logger[_0x2ddb('0xa')](util['format'](_0x2ddb('0xb'),_0x12413c['id'],_0x12413c[_0x2ddb('0xc')]));return getTranscriptionJob(_0x370c7d[_0x2ddb('0xd')],_0x370c7d[_0x2ddb('0xe')],_0x251d8a[_0x2ddb('0xf')],_0x12413c[_0x2ddb('0xc')])[_0x2ddb('0x10')](function(_0x3f9917){logger[_0x2ddb('0xa')](util[_0x2ddb('0x11')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x12413c['id'],_0x12413c[_0x2ddb('0xc')],_0x3f9917['TranscriptionJob'][_0x2ddb('0x12')]));if(!_0x12413c[_0x2ddb('0x13')]){switch(_0x3f9917[_0x2ddb('0x14')][_0x2ddb('0x12')]){case _0x2ddb('0x15'):var _0x4d97d5={'transcribeStatus':_0x3f9917[_0x2ddb('0x14')]['TranscriptionJobStatus'],'fileUri':_0x3f9917['TranscriptionJob'][_0x2ddb('0x16')]['TranscriptFileUri']};logger[_0x2ddb('0xa')](util[_0x2ddb('0x11')](_0x2ddb('0x17'),_0x12413c['id']));return rp({'uri':_0x3f9917[_0x2ddb('0x14')][_0x2ddb('0x16')][_0x2ddb('0x18')],'json':!![]})[_0x2ddb('0x10')](function(_0x5b2a68){logger[_0x2ddb('0xa')](util[_0x2ddb('0x11')](_0x2ddb('0x19'),_0x12413c['id']));if(_0x5b2a68&&_0x5b2a68[_0x2ddb('0x1a')]&&_0x5b2a68[_0x2ddb('0x1a')][_0x2ddb('0x1b')]&&_0x5b2a68[_0x2ddb('0x1a')][_0x2ddb('0x1b')][_0x2ddb('0x1c')]){_0x4d97d5[_0x2ddb('0x13')]='';for(var _0x22abcb=0x0;_0x22abcb<_0x5b2a68[_0x2ddb('0x1a')][_0x2ddb('0x1b')]['length'];_0x22abcb++){_0x4d97d5[_0x2ddb('0x13')]+=_0x5b2a68[_0x2ddb('0x1a')][_0x2ddb('0x1b')][_0x22abcb][_0x2ddb('0x1d')]+'';}}return _0x12413c['update'](_0x4d97d5);})[_0x2ddb('0x10')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x12413c['id']));if(!_0x12413c[_0x2ddb('0x1e')]){throw new db['Sequelize'][(_0x2ddb('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x251d8a['sentiment']||!_0x251d8a[_0x2ddb('0x20')]||!_0x251d8a[_0x2ddb('0x21')]||!_0x251d8a['language']||!_0x251d8a[_0x2ddb('0x22')]){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))](_0x2ddb('0x24'));}if(!_0x4d97d5[_0x2ddb('0x13')]){throw new Error(_0x2ddb('0x25'));}if(_0x251d8a[_0x2ddb('0x20')]===_0x370c7d['id']){return _0x370c7d;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x2ddb('0x20')]}});}})[_0x2ddb('0x10')](function(_0x483ccd){if(!_0x483ccd){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x483ccd[_0x2ddb('0xd')]||!_0x483ccd[_0x2ddb('0xe')]){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x265e71=_0x483ccd;logger[_0x2ddb('0xa')](util[_0x2ddb('0x11')](_0x2ddb('0x26'),_0x12413c['id']));return sentiment(_0x265e71[_0x2ddb('0xd')],_0x265e71['data2'],_0x251d8a[_0x2ddb('0x21')],_0x4d97d5['fileText'],_0x251d8a[_0x2ddb('0x27')]);})['then'](function(_0x35d9e4){logger['info'](util[_0x2ddb('0x11')](_0x2ddb('0x28'),_0x12413c['id']));return _0x12413c[_0x2ddb('0x29')]({'sentiment':_0x35d9e4[_0x2ddb('0x2a')],'sPositive':_0x35d9e4[_0x2ddb('0x2b')][_0x2ddb('0x2c')],'sNegative':_0x35d9e4['SentimentScore']['Negative'],'sMixed':_0x35d9e4[_0x2ddb('0x2b')]['Mixed'],'sNeutral':_0x35d9e4[_0x2ddb('0x2b')]['Neutral']});})['then'](function(){logger['info'](util[_0x2ddb('0x11')](_0x2ddb('0x2d'),_0x12413c['id']));_0x32535e();});case _0x2ddb('0x2e'):return _0x12413c[_0x2ddb('0x29')]({'transcribeStatus':_0x2ddb('0x2e'),'failureReason':_0x3f9917[_0x2ddb('0x14')][_0x2ddb('0x2f')]})[_0x2ddb('0x10')](function(){logger[_0x2ddb('0xa')](util[_0x2ddb('0x11')](_0x2ddb('0x2d'),_0x12413c['id']));_0x32535e();});default:logger[_0x2ddb('0xa')](util[_0x2ddb('0x11')](_0x2ddb('0x30'),_0x12413c['id']));break;}}else{return BPromise[_0x2ddb('0x31')]()['then'](function(){if(!_0x12413c[_0x2ddb('0x1e')]){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))](_0x2ddb('0x32'));}if(!_0x251d8a[_0x2ddb('0x33')]||!_0x251d8a[_0x2ddb('0x20')]||!_0x251d8a[_0x2ddb('0x21')]||!_0x251d8a[_0x2ddb('0x27')]||!_0x251d8a[_0x2ddb('0x22')]){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))](_0x2ddb('0x24'));}if(!_0x12413c[_0x2ddb('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x251d8a[_0x2ddb('0x20')]===_0x370c7d['id']){return _0x370c7d;}else{return db[_0x2ddb('0x34')][_0x2ddb('0x35')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2ddb('0x10')](function(_0x901900){if(!_0x901900){throw new db[(_0x2ddb('0x23'))]['ValidationError'](_0x2ddb('0x36'));}if(!_0x901900[_0x2ddb('0xd')]||!_0x901900[_0x2ddb('0xe')]){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))](_0x2ddb('0x37'));}_0x265e71=_0x901900;logger[_0x2ddb('0xa')](util[_0x2ddb('0x11')](_0x2ddb('0x26'),_0x12413c['id']));return sentiment(_0x265e71[_0x2ddb('0xd')],_0x265e71[_0x2ddb('0xe')],_0x251d8a['sentimentRegion'],_0x12413c[_0x2ddb('0x13')],_0x251d8a[_0x2ddb('0x27')]);})[_0x2ddb('0x10')](function(_0x3cd4ba){logger[_0x2ddb('0xa')](util['format'](_0x2ddb('0x28'),_0x12413c['id']));return _0x12413c['update']({'sentiment':_0x3cd4ba[_0x2ddb('0x2a')],'sPositive':_0x3cd4ba['SentimentScore'][_0x2ddb('0x2c')],'sNegative':_0x3cd4ba['SentimentScore'][_0x2ddb('0x38')],'sMixed':_0x3cd4ba['SentimentScore'][_0x2ddb('0x39')],'sNeutral':_0x3cd4ba[_0x2ddb('0x2b')][_0x2ddb('0x3a')],'transcribeStatus':_0x2ddb('0x15')});})[_0x2ddb('0x10')](function(){logger[_0x2ddb('0xa')](util['format'](_0x2ddb('0x2d'),_0x12413c['id']));_0x32535e();});}})[_0x2ddb('0x3b')](function(_0x414147){if(_0x414147){if(!_0x414147['name']||_0x414147[_0x2ddb('0x3c')]!==_0x2ddb('0x3d')){logger['error'](util[_0x2ddb('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x12413c['id']),util[_0x2ddb('0x3e')](_0x414147,{'showHidden':![],'depth':null}));}}_0x32535e();});});}function checkTranscribe(){var _0x1da19e;var _0x58f060;var _0x5c1182;return db['VoiceRecording'][_0x2ddb('0x3f')]({'where':{'transcribeStatus':_0x2ddb('0x40')}})[_0x2ddb('0x10')](function(_0x327bb7){if(!_0x327bb7||!_0x327bb7[_0x2ddb('0x1c')]){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1da19e=_0x327bb7;return db[_0x2ddb('0x41')][_0x2ddb('0x35')]({'where':{'id':0x1}});})[_0x2ddb('0x10')](function(_0x186d2e){if(!_0x186d2e){throw new db['Sequelize'][(_0x2ddb('0x1f'))](_0x2ddb('0x42'));}_0x58f060=_0x186d2e;if(!_0x58f060['transcribe']||!_0x58f060[_0x2ddb('0x43')]||!_0x58f060[_0x2ddb('0xf')]||!_0x58f060[_0x2ddb('0x27')]||!_0x58f060[_0x2ddb('0x22')]){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))](_0x2ddb('0x44'));}return db[_0x2ddb('0x34')][_0x2ddb('0x35')]({'where':{'id':_0x58f060[_0x2ddb('0x43')]}});})[_0x2ddb('0x10')](function(_0x4f2fbf){if(!_0x4f2fbf){throw new db[(_0x2ddb('0x23'))][(_0x2ddb('0x1f'))](_0x2ddb('0x36'));}if(!_0x4f2fbf[_0x2ddb('0xd')]||!_0x4f2fbf[_0x2ddb('0xe')]){throw new db[(_0x2ddb('0x23'))]['ValidationError'](_0x2ddb('0x37'));}_0x5c1182=_0x4f2fbf;var _0x4372bf=[];_0x1da19e[_0x2ddb('0x45')](function(_0x1d2d3b){_0x4372bf['push'](checkTranscribeJob(_0x1d2d3b,_0x58f060,_0x5c1182));});return BPromise['all'](_0x4372bf);})['catch'](function(_0x46e339){if(_0x46e339){if(!_0x46e339['name']||_0x46e339[_0x2ddb('0x3c')]!=='SequelizeValidationError'){logger[_0x2ddb('0x46')](util[_0x2ddb('0x3e')](_0x46e339,{'showHidden':![],'depth':null}));}}});}exports[_0x2ddb('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 6ffa443..020dfde 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 _0x1c38=['moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','redis','lastMsgAt','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash'];(function(_0xf94872,_0x22adc9){var _0x4d9c72=function(_0x55aa26){while(--_0x55aa26){_0xf94872['push'](_0xf94872['shift']());}};_0x4d9c72(++_0x22adc9);}(_0x1c38,0x15e));var _0x81c3=function(_0x334570,_0x23d405){_0x334570=_0x334570-0x0;var _0x45c6dc=_0x1c38[_0x334570];return _0x45c6dc;};'use strict';var _=require(_0x81c3('0x0'));var moment=require(_0x81c3('0x1'));var Redis=require(_0x81c3('0x2'));var util=require(_0x81c3('0x3'));var config=require(_0x81c3('0x4'));var db=require(_0x81c3('0x5'))['db'];var logger=require(_0x81c3('0x6'))(_0x81c3('0x7'));config['redis']=_[_0x81c3('0x8')](config['redis'],{'host':_0x81c3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x81c3('0xa')]));function closeInteractions(){var _0x400621=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x81c3('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x81c3('0xc'))}}})['then'](function(_0xee9b5c){if(_0xee9b5c&&_0xee9b5c[_0x81c3('0xd')]){_0x400621=_[_0x81c3('0xe')](_0xee9b5c||[],'id');logger[_0x81c3('0xf')](_0x81c3('0x10'),_0x400621['join']());return db['WhatsappInteraction'][_0x81c3('0x11')]({'closeReason':_0x81c3('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x81c3('0x13'))},{'where':{'id':_0x400621}});}})[_0x81c3('0x14')](function(){if(_0x400621&&_0x400621['length']){logger[_0x81c3('0xf')](_0x81c3('0x15'),_0x400621['join']());for(var _0x20a200=0x0;_0x20a200<_0x400621['length'];_0x20a200++){io['emit'](_0x81c3('0x16'),{'id':_0x400621[_0x20a200],'closed':!![]});}}})[_0x81c3('0x17')](function(_0x221e0e){logger[_0x81c3('0x18')](_0x81c3('0x19'),_0x221e0e?util[_0x81c3('0x1a')](_0x221e0e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x58c2=['WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','catch','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','defaults','localhost','socket.io-emitter','redis'];(function(_0xf92339,_0x5dd706){var _0x236a18=function(_0x19c10b){while(--_0x19c10b){_0xf92339['push'](_0xf92339['shift']());}};_0x236a18(++_0x5dd706);}(_0x58c2,0x69));var _0x258c=function(_0x3130b5,_0x23faf7){_0x3130b5=_0x3130b5-0x0;var _0xa6d8a3=_0x58c2[_0x3130b5];return _0xa6d8a3;};'use strict';var _=require(_0x258c('0x0'));var moment=require(_0x258c('0x1'));var Redis=require(_0x258c('0x2'));var util=require(_0x258c('0x3'));var config=require(_0x258c('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x258c('0x5'))(_0x258c('0x6'));config['redis']=_[_0x258c('0x7')](config['redis'],{'host':_0x258c('0x8'),'port':0x18eb});var io=require(_0x258c('0x9'))(new Redis(config[_0x258c('0xa')]));function closeInteractions(){var _0x4847ef=[];return db[_0x258c('0xb')][_0x258c('0xc')]({'raw':!![],'attributes':['id',_0x258c('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x258c('0xe'))}}})[_0x258c('0xf')](function(_0x4fb3e8){if(_0x4fb3e8&&_0x4fb3e8[_0x258c('0x10')]){_0x4847ef=_[_0x258c('0x11')](_0x4fb3e8||[],'id');logger['info'](_0x258c('0x12'),_0x4847ef[_0x258c('0x13')]());return db[_0x258c('0xb')]['update']({'closeReason':_0x258c('0x14'),'disposition':_0x258c('0x15'),'closed':!![],'closedAt':moment()[_0x258c('0x16')](_0x258c('0x17'))},{'where':{'id':_0x4847ef}});}})[_0x258c('0xf')](function(){if(_0x4847ef&&_0x4847ef[_0x258c('0x10')]){logger[_0x258c('0x18')](_0x258c('0x19'),_0x4847ef[_0x258c('0x13')]());for(var _0x415f38=0x0;_0x415f38<_0x4847ef[_0x258c('0x10')];_0x415f38++){io['emit']('whatsappInteraction:update',{'id':_0x4847ef[_0x415f38],'closed':!![]});}}})[_0x258c('0x1a')](function(_0xb73547){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xb73547?util[_0x258c('0x1b')](_0xb73547,{'showHidden':![],'depth':null}):'');});}exports[_0x258c('0x1c')]=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 3852d91..e37c64a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc448=['bulkCreate','finished\x20populating','contacts1','CmHopper','destroy','log','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','push','then','CmContact'];(function(_0x3c255a,_0x29cb96){var _0x12930d=function(_0x3ef1ca){while(--_0x3ef1ca){_0x3c255a['push'](_0x3c255a['shift']());}};_0x12930d(++_0x29cb96);}(_0xc448,0x1b9));var _0x8c44=function(_0x4fe3eb,_0x49d94e){_0x4fe3eb=_0x4fe3eb-0x0;var _0x27a8ff=_0xc448[_0x4fe3eb];return _0x27a8ff;};'use strict';var util=require(_0x8c44('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x8c44('0x1')+i,'lastName':_0x8c44('0x2')+i,'phone':0xf879fb460+i,'email':_0x8c44('0x3')+i+_0x8c44('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x8c44('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8c44('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8c44('0x1')+i,'lastName':_0x8c44('0x2')+i,'phone':0xf879fb460+i,'email':_0x8c44('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8c44('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8c44('0x5')](),'updatedAt':Date['now']()});}db['CmContact']['destroy']({'where':{}})[_0x8c44('0x7')](function(){return db[_0x8c44('0x8')][_0x8c44('0x9')](contacts);})[_0x8c44('0x7')](function(){console['log'](_0x8c44('0xa'),_0x8c44('0xb'));return db[_0x8c44('0xc')][_0x8c44('0xd')]({'where':{}});})[_0x8c44('0x7')](function(){return db[_0x8c44('0xc')][_0x8c44('0x9')](hopper);})[_0x8c44('0x7')](function(){console[_0x8c44('0xe')]('finished\x20populating','hopper1');return db[_0x8c44('0x8')][_0x8c44('0x9')](contacts2);})[_0x8c44('0x7')](function(){console[_0x8c44('0xe')](_0x8c44('0xa'),'contacts2');return db[_0x8c44('0xc')]['bulkCreate'](hopper2);})[_0x8c44('0x7')](function(){console[_0x8c44('0xe')](_0x8c44('0xa'),'hopper2');})['catch'](function(_0x2826c0){console[_0x8c44('0xe')](_0x2826c0);}); \ No newline at end of file +var _0x6200=['@xcally.com','now','push','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x5bea44,_0x2a7eaa){var _0x50509e=function(_0x53f0fe){while(--_0x53f0fe){_0x5bea44['push'](_0x5bea44['shift']());}};_0x50509e(++_0x2a7eaa);}(_0x6200,0xf2));var _0x0620=function(_0x517e67,_0x46d63c){_0x517e67=_0x517e67-0x0;var _0x4d7215=_0x6200[_0x517e67];return _0x4d7215;};'use strict';var util=require(_0x0620('0x0'));var db=require(_0x0620('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0620('0x2')+i,'lastName':_0x0620('0x3')+i,'phone':0xf879fb460+i,'email':_0x0620('0x4')+i+_0x0620('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0620('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0620('0x7')]({'id':i,'firstName':_0x0620('0x2')+i,'lastName':_0x0620('0x3')+i,'phone':0xf879fb460+i,'email':_0x0620('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0620('0x7')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0620('0x6')]()});}db[_0x0620('0x8')][_0x0620('0x9')]({'where':{}})[_0x0620('0xa')](function(){return db[_0x0620('0x8')][_0x0620('0xb')](contacts);})[_0x0620('0xa')](function(){console['log'](_0x0620('0xc'),_0x0620('0xd'));return db[_0x0620('0xe')]['destroy']({'where':{}});})['then'](function(){return db[_0x0620('0xe')]['bulkCreate'](hopper);})[_0x0620('0xa')](function(){console[_0x0620('0xf')](_0x0620('0xc'),_0x0620('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0x0620('0xa')](function(){console[_0x0620('0xf')]('finished\x20populating',_0x0620('0x11'));return db[_0x0620('0xe')][_0x0620('0xb')](hopper2);})[_0x0620('0xa')](function(){console[_0x0620('0xf')]('finished\x20populating','hopper2');})[_0x0620('0x12')](function(_0x4ad0d8){console['log'](_0x4ad0d8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5d440e4..e397ecf 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d82=['friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0d82,0x66));var _0x20d8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0d82[_0x1035c1];return _0x308d67;};'use strict';var util=require(_0x20d8('0x0'));var db=require(_0x20d8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x20d8('0x2')]({'name':util[_0x20d8('0x3')](_0x20d8('0x4'),'agent',i),'fullname':util[_0x20d8('0x3')](_0x20d8('0x4'),_0x20d8('0x5'),i),'email':util['format'](_0x20d8('0x6'),_0x20d8('0x5'),i),'role':_0x20d8('0x5'),'password':_0x20d8('0x7'),'internal':0xfa0+i,'type':_0x20d8('0x8'),'transport':[_0x20d8('0x9'),'ws',_0x20d8('0xa')],'disallow':[_0x20d8('0xb')],'allow':[_0x20d8('0xc')],'defaultuser':util['format']('%s%s',_0x20d8('0x5'),i),'encryption':_0x20d8('0xd'),'avpf':_0x20d8('0xd'),'force_avp':_0x20d8('0xd'),'icesupport':'yes','dtlsenable':_0x20d8('0xd'),'dtlsverify':'no','dtlscertfile':_0x20d8('0xe'),'dtlsprivatekey':_0x20d8('0xf'),'dtlssetup':_0x20d8('0x10'),'callerid':util[_0x20d8('0x3')](_0x20d8('0x11'),util['format'](_0x20d8('0x4'),_0x20d8('0x5'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x20d8('0x12')](function(){console[_0x20d8('0x13')](_0x20d8('0x14'));})[_0x20d8('0x15')](function(_0x33d448){console[_0x20d8('0x13')](_0x33d448);}); \ No newline at end of file +var _0x9a43=['User','bulkCreate','log','catch','util','../mysqldb','push','format','%s%s','%s%s@xcally.com','agent','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9a43,0x193));var _0x39a4=function(_0x450d4e,_0xcacc3){_0x450d4e=_0x450d4e-0x0;var _0x300304=_0x9a43[_0x450d4e];return _0x300304;};'use strict';var util=require(_0x39a4('0x0'));var db=require(_0x39a4('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x39a4('0x2')]({'name':util[_0x39a4('0x3')]('%s%s','agent',i),'fullname':util[_0x39a4('0x3')](_0x39a4('0x4'),'agent',i),'email':util[_0x39a4('0x3')](_0x39a4('0x5'),_0x39a4('0x6'),i),'role':_0x39a4('0x6'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x39a4('0x7'),'ws',_0x39a4('0x8')],'disallow':['all'],'allow':[_0x39a4('0x9')],'defaultuser':util[_0x39a4('0x3')](_0x39a4('0x4'),_0x39a4('0x6'),i),'encryption':_0x39a4('0xa'),'avpf':_0x39a4('0xa'),'force_avp':_0x39a4('0xa'),'icesupport':_0x39a4('0xa'),'dtlsenable':_0x39a4('0xa'),'dtlsverify':'no','dtlscertfile':_0x39a4('0xb'),'dtlsprivatekey':_0x39a4('0xc'),'dtlssetup':_0x39a4('0xd'),'callerid':util[_0x39a4('0x3')](_0x39a4('0xe'),util['format'](_0x39a4('0x4'),_0x39a4('0x6'),i),0xfa0+i)});}db[_0x39a4('0xf')][_0x39a4('0x10')](users)['then'](function(){console[_0x39a4('0x11')]('add\x20user');})[_0x39a4('0x12')](function(_0x5d6fd8){console[_0x39a4('0x11')](_0x5d6fd8);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index e5d1382..fa7200c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fdb=['ChatQueue','FaxQueues','MailQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','all','chat','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','type','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','then','format','%s:queue:%s','length','user:%s','query','find','userProfileId','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user'];(function(_0x3129fc,_0x58b191){var _0x4af3d7=function(_0x11c915){while(--_0x11c915){_0x3129fc['push'](_0x3129fc['shift']());}};_0x4af3d7(++_0x58b191);}(_0x5fdb,0x1b0));var _0xb5fd=function(_0x1283df,_0xe39897){_0x1283df=_0x1283df-0x0;var _0x3d299b=_0x5fdb[_0x1283df];return _0x3d299b;};'use strict';var _=require(_0xb5fd('0x0'));var util=require('util');var BPromise=require(_0xb5fd('0x1'));var db=require(_0xb5fd('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb5fd('0x3')],'include':[{'as':_0xb5fd('0x4'),'model':db[_0xb5fd('0x5')],'attributes':['id',_0xb5fd('0x3'),_0xb5fd('0x6')],'raw':!![],'where':{'role':_0xb5fd('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb5fd('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xb5fd('0x3')],'where':{'role':_0xb5fd('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb5fd('0x3'),_0xb5fd('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2a352a,_0x5d9f9f,_0x47d97f){return db['UserProfileSection'][_0xb5fd('0xa')]({'where':{'name':_0x2a352a,'userProfileId':_0x5d9f9f},'raw':!![]})['then'](function(_0x3022b){if(_0x3022b){if(_0x3022b[_0xb5fd('0xb')]){switch(_0x2a352a){case _0xb5fd('0xc'):case _0xb5fd('0xd'):case'FaxQueues':case _0xb5fd('0xe'):case _0xb5fd('0xf'):case _0xb5fd('0x10'):case _0xb5fd('0x11'):return db[_0x47d97f][_0xb5fd('0x12')](queryQueues);case _0xb5fd('0x13'):return db[_0x47d97f]['findAll'](queryTelephones);case _0xb5fd('0x14'):return db[_0x47d97f][_0xb5fd('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x47d97f]['findAll'](queryCampaigns);}}else{return db[_0xb5fd('0x15')][_0xb5fd('0x12')]({'attributes':[_0xb5fd('0x16')],'where':{'sectionId':_0x3022b['id']},'raw':!![]})['then'](function(_0x34d24f){if(_0x34d24f){var _0x324038={'where':{'id':_[_0xb5fd('0x17')](_0x34d24f,_0xb5fd('0x16'))},'raw':!![]};switch(_0x47d97f){case _0xb5fd('0x5'):_0x324038['where'][_0xb5fd('0x6')]='telephone';break;case'Campaign':_0x324038[_0xb5fd('0x18')][_0xb5fd('0x9')]='ivr';break;}return db[_0x47d97f][_0xb5fd('0x12')](_0x324038);}else{return[];}});}}else{return[];}})[_0xb5fd('0x19')](function(_0x1f8465){return _0x1f8465;});}function joinOrLeaveQueues(_0x32cd5c,_0x597bd7,_0xc518e4,_0x402778){_0x32cd5c[_0x597bd7](util[_0xb5fd('0x1a')](_0xb5fd('0x1b'),_0xc518e4,_0x402778[_0xb5fd('0x3')]));if(_0x402778['Agents']){for(var _0x4d4e92=0x0;_0x4d4e92<_0x402778[_0xb5fd('0x4')][_0xb5fd('0x1c')];_0x4d4e92+=0x1){_0x32cd5c[_0x597bd7](util[_0xb5fd('0x1a')](_0xb5fd('0x1d'),_0x402778[_0xb5fd('0x4')][_0x4d4e92][_0xb5fd('0x3')]));}}}function joinOrLeave(_0x56f31b,_0x229a6d,_0x32edd6){var _0x2ffd43;if(_0x56f31b['handshake'][_0xb5fd('0x1e')]['id']){db[_0xb5fd('0x5')][_0xb5fd('0x1f')]({'attributes':['id',_0xb5fd('0x3'),'role',_0xb5fd('0x20')],'where':{'id':_0x56f31b['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb5fd('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xb5fd('0x22')],'as':_0xb5fd('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb5fd('0x24')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb5fd('0x25')],'as':_0xb5fd('0x26'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb5fd('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x515ad9){if(_0x515ad9){_0x2ffd43=_0x515ad9;_0x56f31b[_0x229a6d](util[_0xb5fd('0x1a')](_0xb5fd('0x1d'),_0x515ad9[_0xb5fd('0x3')]));var _0x2d7202=[];switch(_0x515ad9[_0xb5fd('0x6')]){case'admin':_0x56f31b[_0x229a6d](_0xb5fd('0x28'));_0x56f31b[_0x229a6d](_0xb5fd('0x29'));if(queryQueues[_0xb5fd('0x2a')](_0xb5fd('0x2b'))){delete queryQueues[_0xb5fd('0x2b')];}_0x2d7202[_0xb5fd('0x2c')](db[_0xb5fd('0x2d')][_0xb5fd('0x12')](queryQueues));_0x2d7202[_0xb5fd('0x2c')](db['ChatQueue'][_0xb5fd('0x12')](queryQueues));_0x2d7202['push'](db[_0xb5fd('0x2e')]['findAll'](queryQueues));_0x2d7202['push'](db[_0xb5fd('0x2f')][_0xb5fd('0x12')](queryQueues));_0x2d7202['push'](db['MailQueue'][_0xb5fd('0x12')](queryQueues));_0x2d7202[_0xb5fd('0x2c')](db[_0xb5fd('0x30')][_0xb5fd('0x12')](queryQueues));_0x2d7202[_0xb5fd('0x2c')](db[_0xb5fd('0x31')][_0xb5fd('0x12')](queryQueues));_0x2d7202['push'](db['User']['findAll'](queryTelephones));_0x2d7202[_0xb5fd('0x2c')](db[_0xb5fd('0x32')][_0xb5fd('0x12')](queryTrunks));_0x2d7202[_0xb5fd('0x2c')](db[_0xb5fd('0x33')][_0xb5fd('0x12')](queryCampaigns));_0x2d7202[_0xb5fd('0x2c')](db[_0xb5fd('0x5')]['findAll'](queryAgents));break;case _0xb5fd('0x34'):_0x56f31b[_0x229a6d](_0xb5fd('0x28'));_0x56f31b[_0x229a6d]('voice:outbound');_0x2d7202['push'](getAssociatedResources(_0xb5fd('0xc'),_0x515ad9[_0xb5fd('0x20')],_0xb5fd('0x2d')));_0x2d7202['push'](getAssociatedResources('ChatQueues',_0x515ad9[_0xb5fd('0x20')],_0xb5fd('0x35')));_0x2d7202[_0xb5fd('0x2c')](getAssociatedResources(_0xb5fd('0x36'),_0x515ad9[_0xb5fd('0x20')],'FaxQueue'));_0x2d7202[_0xb5fd('0x2c')](getAssociatedResources('SmsQueues',_0x515ad9['userProfileId'],_0xb5fd('0x2f')));_0x2d7202[_0xb5fd('0x2c')](getAssociatedResources(_0xb5fd('0xf'),_0x515ad9[_0xb5fd('0x20')],_0xb5fd('0x37')));_0x2d7202[_0xb5fd('0x2c')](getAssociatedResources(_0xb5fd('0x10'),_0x515ad9[_0xb5fd('0x20')],_0xb5fd('0x30')));_0x2d7202[_0xb5fd('0x2c')](getAssociatedResources(_0xb5fd('0x11'),_0x515ad9[_0xb5fd('0x20')],_0xb5fd('0x31')));_0x2d7202[_0xb5fd('0x2c')](getAssociatedResources(_0xb5fd('0x13'),_0x515ad9[_0xb5fd('0x20')],_0xb5fd('0x5')));_0x2d7202[_0xb5fd('0x2c')](getAssociatedResources(_0xb5fd('0x14'),_0x515ad9[_0xb5fd('0x20')],_0xb5fd('0x32')));_0x2d7202['push'](getAssociatedResources(_0xb5fd('0x38'),_0x515ad9[_0xb5fd('0x20')],'Campaign'));_0x2d7202[_0xb5fd('0x2c')](db['User']['findAll'](queryAgents));break;case _0xb5fd('0x7'):_0x56f31b[_0x229a6d]('voice:inbound');_0x56f31b[_0x229a6d](_0xb5fd('0x29'));_0x2d7202[_0xb5fd('0x2c')](_0x515ad9[_0xb5fd('0x39')]({'attributes':['id',_0xb5fd('0x3')]}));_0x2d7202['push'](_0x515ad9[_0xb5fd('0x3a')]({'attributes':['id',_0xb5fd('0x3')]}));_0x2d7202[_0xb5fd('0x2c')](_0x515ad9['getFaxQueues']({'attributes':['id','name']}));_0x2d7202[_0xb5fd('0x2c')](_0x515ad9[_0xb5fd('0x3b')]({'attributes':['id',_0xb5fd('0x3')]}));_0x2d7202[_0xb5fd('0x2c')](_0x515ad9[_0xb5fd('0x3c')]({'attributes':['id',_0xb5fd('0x3')]}));_0x2d7202[_0xb5fd('0x2c')](_0x515ad9['getOpenchannelQueues']({'attributes':['id',_0xb5fd('0x3')]}));_0x2d7202['push'](_0x515ad9['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xb5fd('0x3d')](_0x2d7202);}})[_0xb5fd('0x19')](function(_0x33a175){if(_0x33a175&&_0x33a175[_0xb5fd('0x1c')]){for(var _0x5bdebb=0x0;_0x5bdebb<_0x33a175[_0xb5fd('0x1c')];_0x5bdebb+=0x1){for(var _0x4ab4a1=0x0;_0x4ab4a1<_0x33a175[_0x5bdebb]['length'];_0x4ab4a1+=0x1){switch(_0x5bdebb){case 0x0:joinOrLeaveQueues(_0x56f31b,_0x229a6d,'voice',_0x33a175[_0x5bdebb][_0x4ab4a1]);break;case 0x1:joinOrLeaveQueues(_0x56f31b,_0x229a6d,_0xb5fd('0x3e'),_0x33a175[_0x5bdebb][_0x4ab4a1]);break;case 0x2:joinOrLeaveQueues(_0x56f31b,_0x229a6d,'fax',_0x33a175[_0x5bdebb][_0x4ab4a1]);break;case 0x3:joinOrLeaveQueues(_0x56f31b,_0x229a6d,_0xb5fd('0x3f'),_0x33a175[_0x5bdebb][_0x4ab4a1]);break;case 0x4:joinOrLeaveQueues(_0x56f31b,_0x229a6d,_0xb5fd('0x40'),_0x33a175[_0x5bdebb][_0x4ab4a1]);break;case 0x5:joinOrLeaveQueues(_0x56f31b,_0x229a6d,'openchannel',_0x33a175[_0x5bdebb][_0x4ab4a1]);break;case 0x6:joinOrLeaveQueues(_0x56f31b,_0x229a6d,_0xb5fd('0x41'),_0x33a175[_0x5bdebb][_0x4ab4a1]);break;case 0x7:if(_0x2ffd43[_0xb5fd('0x6')]!=='agent')_0x56f31b[_0x229a6d](util['format'](_0xb5fd('0x42'),_0x33a175[_0x5bdebb][_0x4ab4a1]['name']));break;case 0x8:if(_0x2ffd43[_0xb5fd('0x6')]!==_0xb5fd('0x7'))_0x56f31b[_0x229a6d](util['format'](_0xb5fd('0x43'),_0x33a175[_0x5bdebb][_0x4ab4a1][_0xb5fd('0x3')]));break;case 0x9:if(_0x2ffd43[_0xb5fd('0x6')]!==_0xb5fd('0x7'))_0x56f31b[_0x229a6d](util[_0xb5fd('0x1a')](_0xb5fd('0x44'),_0x33a175[_0x5bdebb][_0x4ab4a1][_0xb5fd('0x9')],_0x33a175[_0x5bdebb][_0x4ab4a1][_0xb5fd('0x3')]));break;case 0xa:_0x56f31b[_0x229a6d](util[_0xb5fd('0x1a')](_0xb5fd('0x1d'),_0x33a175[_0x5bdebb][_0x4ab4a1][_0xb5fd('0x3')]));break;}}}}})[_0xb5fd('0x19')](function(){if(_0x229a6d===_0xb5fd('0x45')){var _0x5f5064=_['map'](_0x2ffd43[_0xb5fd('0x46')],'id');return _0x2ffd43[_0xb5fd('0x47')](_0x5f5064)[_0xb5fd('0x19')](function(){for(var _0x28c8c8=0x0;_0x28c8c8<_0x5f5064[_0xb5fd('0x1c')];_0x28c8c8+=0x1){_0x32edd6[_0xb5fd('0x48')](_0xb5fd('0x49'),{'ChatInteractionId':Number(_0x5f5064[_0x28c8c8]),'UserId':Number(_0x2ffd43['id'])});}});}})['then'](function(){if(_0x229a6d==='leave'){var _0x555a96=_[_0xb5fd('0x17')](_0x2ffd43['MailInteractions'],'id');return _0x2ffd43[_0xb5fd('0x4a')](_0x555a96)[_0xb5fd('0x19')](function(){for(var _0x1f6d64=0x0;_0x1f6d64<_0x555a96[_0xb5fd('0x1c')];_0x1f6d64+=0x1){_0x32edd6[_0xb5fd('0x48')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x555a96[_0x1f6d64]),'UserId':Number(_0x2ffd43['id'])});}});}})[_0xb5fd('0x19')](function(){if(_0x229a6d===_0xb5fd('0x45')){var _0x3ade5e=_[_0xb5fd('0x17')](_0x2ffd43['FaxInteractions'],'id');return _0x2ffd43[_0xb5fd('0x4b')](_0x3ade5e)[_0xb5fd('0x19')](function(){for(var _0x3894b2=0x0;_0x3894b2<_0x3ade5e['length'];_0x3894b2+=0x1){_0x32edd6[_0xb5fd('0x48')](_0xb5fd('0x4c'),{'FaxInteractionId':Number(_0x3ade5e[_0x3894b2]),'UserId':Number(_0x2ffd43['id'])});}});}})[_0xb5fd('0x19')](function(){if(_0x229a6d==='leave'){var _0x32b85c=_[_0xb5fd('0x17')](_0x2ffd43[_0xb5fd('0x4d')],'id');return _0x2ffd43[_0xb5fd('0x4e')](_0x32b85c)['then'](function(){for(var _0x3bb214=0x0;_0x3bb214<_0x32b85c['length'];_0x3bb214+=0x1){_0x32edd6[_0xb5fd('0x48')](_0xb5fd('0x4f'),{'SmsInteractionId':Number(_0x32b85c[_0x3bb214]),'UserId':Number(_0x2ffd43['id'])});}});}})[_0xb5fd('0x19')](function(){if(_0x229a6d===_0xb5fd('0x45')){var _0xd50617=_[_0xb5fd('0x17')](_0x2ffd43[_0xb5fd('0x26')],'id');return _0x2ffd43[_0xb5fd('0x50')](_0xd50617)[_0xb5fd('0x19')](function(){for(var _0x131645=0x0;_0x131645<_0xd50617[_0xb5fd('0x1c')];_0x131645+=0x1){_0x32edd6[_0xb5fd('0x48')](_0xb5fd('0x51'),{'OpenchannelInteractionId':Number(_0xd50617[_0x131645]),'UserId':Number(_0x2ffd43['id'])});}});}})[_0xb5fd('0x19')](function(){if(_0x229a6d==='leave'){var _0x2e9869=_[_0xb5fd('0x17')](_0x2ffd43[_0xb5fd('0x27')],'id');return _0x2ffd43['removeWhatsappInteractions'](_0x2e9869)[_0xb5fd('0x19')](function(){for(var _0x4d9c11=0x0;_0x4d9c11<_0x2e9869[_0xb5fd('0x1c')];_0x4d9c11+=0x1){_0x32edd6['emit'](_0xb5fd('0x52'),{'WhatsappInteractionId':Number(_0x2e9869[_0x4d9c11]),'UserId':Number(_0x2ffd43['id'])});}});}})['catch'](function(_0x4b64c8){_0x56f31b[_0xb5fd('0x53')](_0x4b64c8);});}}function onDisconnect(_0x845f48,_0x5a28b1){joinOrLeave(_0x845f48,_0xb5fd('0x45'),_0x5a28b1);}function onConnect(_0x5b661c){joinOrLeave(_0x5b661c,_0xb5fd('0x54'));}exports[_0xb5fd('0x55')]=function(_0xe9853a){_0xe9853a['on'](_0xb5fd('0x56'),function(_0x4ff072){_0x4ff072[_0xb5fd('0x57')](0x0);_0x4ff072['address']=_0x4ff072[_0xb5fd('0x58')][_0xb5fd('0x56')][_0xb5fd('0x59')]+':'+_0x4ff072[_0xb5fd('0x58')][_0xb5fd('0x56')][_0xb5fd('0x5a')];_0x4ff072[_0xb5fd('0x5b')]=new Date();_0x4ff072[_0xb5fd('0x53')]=function(_0x5e00ab){console[_0xb5fd('0x53')](_0xb5fd('0x5c')+_0x4ff072[_0xb5fd('0x5d')][_0xb5fd('0x3')]+'['+_0x4ff072[_0xb5fd('0x5e')]+']',_0x5e00ab);};_0x4ff072['on'](_0xb5fd('0x5f'),function(){onDisconnect(_0x4ff072,_0xe9853a);_0x4ff072[_0xb5fd('0x53')](_0xb5fd('0x60'));});onConnect(_0x4ff072);_0x4ff072[_0xb5fd('0x53')]('CONNECTED');});}; \ No newline at end of file +var _0x9a6d=['SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','userProfileId','OpenchannelQueues','Trunks','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','format','user:%s','handshake','query','find','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction'];(function(_0x1dae31,_0xb467ef){var _0x3827f4=function(_0x1dc606){while(--_0x1dc606){_0x1dae31['push'](_0x1dae31['shift']());}};_0x3827f4(++_0xb467ef);}(_0x9a6d,0x10b));var _0xd9a6=function(_0x4043cf,_0x505cf9){_0x4043cf=_0x4043cf-0x0;var _0x4a6d0d=_0x9a6d[_0x4043cf];return _0x4a6d0d;};'use strict';var _=require(_0xd9a6('0x0'));var util=require(_0xd9a6('0x1'));var BPromise=require('bluebird');var db=require(_0xd9a6('0x2'))['db'];var config=require(_0xd9a6('0x3'));var queryQueues={'attributes':['id',_0xd9a6('0x4')],'include':[{'as':_0xd9a6('0x5'),'model':db[_0xd9a6('0x6')],'attributes':['id','name',_0xd9a6('0x7')],'raw':!![],'where':{'role':_0xd9a6('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd9a6('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xd9a6('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xd9a6('0x4')],'where':{'role':_0xd9a6('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xd9a6('0x9')],'where':{'type':_0xd9a6('0xa')}};function getAssociatedResources(_0x3b9443,_0x271c48,_0x16f656){return db['UserProfileSection'][_0xd9a6('0xb')]({'where':{'name':_0x3b9443,'userProfileId':_0x271c48},'raw':!![]})[_0xd9a6('0xc')](function(_0x261b31){if(_0x261b31){if(_0x261b31[_0xd9a6('0xd')]){switch(_0x3b9443){case _0xd9a6('0xe'):case _0xd9a6('0xf'):case _0xd9a6('0x10'):case _0xd9a6('0x11'):case _0xd9a6('0x12'):case'OpenchannelQueues':case _0xd9a6('0x13'):return db[_0x16f656][_0xd9a6('0x14')](queryQueues);case _0xd9a6('0x15'):return db[_0x16f656]['findAll'](queryTelephones);case'Trunks':return db[_0x16f656][_0xd9a6('0x14')](queryTrunks);case _0xd9a6('0x16'):return db[_0x16f656]['findAll'](queryCampaigns);}}else{return db[_0xd9a6('0x17')][_0xd9a6('0x14')]({'attributes':[_0xd9a6('0x18')],'where':{'sectionId':_0x261b31['id']},'raw':!![]})[_0xd9a6('0xc')](function(_0x2ec958){if(_0x2ec958){var _0xef2e8a={'where':{'id':_[_0xd9a6('0x19')](_0x2ec958,_0xd9a6('0x18'))},'raw':!![]};switch(_0x16f656){case'User':_0xef2e8a[_0xd9a6('0x1a')][_0xd9a6('0x7')]=_0xd9a6('0x1b');break;case _0xd9a6('0x1c'):_0xef2e8a[_0xd9a6('0x1a')][_0xd9a6('0x9')]=_0xd9a6('0xa');break;}return db[_0x16f656]['findAll'](_0xef2e8a);}else{return[];}});}}else{return[];}})[_0xd9a6('0xc')](function(_0xbabe69){return _0xbabe69;});}function joinOrLeaveQueues(_0x4beb16,_0x3a68d8,_0x1613b3,_0x36252f){_0x4beb16[_0x3a68d8](util[_0xd9a6('0x1d')]('%s:queue:%s',_0x1613b3,_0x36252f[_0xd9a6('0x4')]));if(_0x36252f[_0xd9a6('0x5')]){for(var _0x48f346=0x0;_0x48f346<_0x36252f[_0xd9a6('0x5')]['length'];_0x48f346+=0x1){_0x4beb16[_0x3a68d8](util[_0xd9a6('0x1d')](_0xd9a6('0x1e'),_0x36252f[_0xd9a6('0x5')][_0x48f346]['name']));}}}function joinOrLeave(_0xda6448,_0x458ac6,_0x2e1c26){var _0x443a3c;if(_0xda6448[_0xd9a6('0x1f')][_0xd9a6('0x20')]['id']){db[_0xd9a6('0x6')][_0xd9a6('0x21')]({'attributes':['id',_0xd9a6('0x4'),_0xd9a6('0x7'),'userProfileId'],'where':{'id':_0xda6448[_0xd9a6('0x1f')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xd9a6('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9a6('0x23')],'as':_0xd9a6('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xd9a6('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9a6('0x26')],'as':_0xd9a6('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9a6('0x28')],'as':_0xd9a6('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9a6('0x2a')],'as':_0xd9a6('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xd9a6('0xc')](function(_0x17e3e3){if(_0x17e3e3){_0x443a3c=_0x17e3e3;_0xda6448[_0x458ac6](util[_0xd9a6('0x1d')]('user:%s',_0x17e3e3['name']));var _0x599e4a=[];switch(_0x17e3e3[_0xd9a6('0x7')]){case'admin':_0xda6448[_0x458ac6]('voice:inbound');_0xda6448[_0x458ac6]('voice:outbound');if(queryQueues[_0xd9a6('0x2c')]('include')){delete queryQueues[_0xd9a6('0x2d')];}_0x599e4a['push'](db[_0xd9a6('0x2e')][_0xd9a6('0x14')](queryQueues));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x30')]['findAll'](queryQueues));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x31')][_0xd9a6('0x14')](queryQueues));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x32')][_0xd9a6('0x14')](queryQueues));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x33')]['findAll'](queryQueues));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x34')][_0xd9a6('0x14')](queryQueues));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x35')][_0xd9a6('0x14')](queryQueues));_0x599e4a['push'](db[_0xd9a6('0x6')][_0xd9a6('0x14')](queryTelephones));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x36')][_0xd9a6('0x14')](queryTrunks));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x1c')][_0xd9a6('0x14')](queryCampaigns));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x6')]['findAll'](queryAgents));break;case'user':_0xda6448[_0x458ac6]('voice:inbound');_0xda6448[_0x458ac6](_0xd9a6('0x37'));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0xe'),_0x17e3e3['userProfileId'],'VoiceQueue'));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0xf'),_0x17e3e3[_0xd9a6('0x38')],_0xd9a6('0x30')));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0x10'),_0x17e3e3['userProfileId'],_0xd9a6('0x31')));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0x11'),_0x17e3e3[_0xd9a6('0x38')],_0xd9a6('0x32')));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0x12'),_0x17e3e3[_0xd9a6('0x38')],_0xd9a6('0x33')));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0x39'),_0x17e3e3['userProfileId'],_0xd9a6('0x34')));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources('WhatsappQueues',_0x17e3e3[_0xd9a6('0x38')],'WhatsappQueue'));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources('Telephones',_0x17e3e3['userProfileId'],_0xd9a6('0x6')));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0x3a'),_0x17e3e3[_0xd9a6('0x38')],'Trunk'));_0x599e4a[_0xd9a6('0x2f')](getAssociatedResources(_0xd9a6('0x16'),_0x17e3e3[_0xd9a6('0x38')],_0xd9a6('0x1c')));_0x599e4a[_0xd9a6('0x2f')](db[_0xd9a6('0x6')][_0xd9a6('0x14')](queryAgents));break;case _0xd9a6('0x8'):_0xda6448[_0x458ac6](_0xd9a6('0x3b'));_0xda6448[_0x458ac6](_0xd9a6('0x37'));_0x599e4a[_0xd9a6('0x2f')](_0x17e3e3[_0xd9a6('0x3c')]({'attributes':['id','name']}));_0x599e4a[_0xd9a6('0x2f')](_0x17e3e3[_0xd9a6('0x3d')]({'attributes':['id','name']}));_0x599e4a['push'](_0x17e3e3[_0xd9a6('0x3e')]({'attributes':['id',_0xd9a6('0x4')]}));_0x599e4a['push'](_0x17e3e3[_0xd9a6('0x3f')]({'attributes':['id',_0xd9a6('0x4')]}));_0x599e4a[_0xd9a6('0x2f')](_0x17e3e3[_0xd9a6('0x40')]({'attributes':['id',_0xd9a6('0x4')]}));_0x599e4a[_0xd9a6('0x2f')](_0x17e3e3[_0xd9a6('0x41')]({'attributes':['id',_0xd9a6('0x4')]}));_0x599e4a[_0xd9a6('0x2f')](_0x17e3e3[_0xd9a6('0x42')]({'attributes':['id',_0xd9a6('0x4')]}));break;}return BPromise[_0xd9a6('0x43')](_0x599e4a);}})['then'](function(_0x20acd5){if(_0x20acd5&&_0x20acd5[_0xd9a6('0x44')]){for(var _0x7a5adf=0x0;_0x7a5adf<_0x20acd5[_0xd9a6('0x44')];_0x7a5adf+=0x1){for(var _0x25ffef=0x0;_0x25ffef<_0x20acd5[_0x7a5adf][_0xd9a6('0x44')];_0x25ffef+=0x1){switch(_0x7a5adf){case 0x0:joinOrLeaveQueues(_0xda6448,_0x458ac6,_0xd9a6('0x45'),_0x20acd5[_0x7a5adf][_0x25ffef]);break;case 0x1:joinOrLeaveQueues(_0xda6448,_0x458ac6,_0xd9a6('0x46'),_0x20acd5[_0x7a5adf][_0x25ffef]);break;case 0x2:joinOrLeaveQueues(_0xda6448,_0x458ac6,_0xd9a6('0x47'),_0x20acd5[_0x7a5adf][_0x25ffef]);break;case 0x3:joinOrLeaveQueues(_0xda6448,_0x458ac6,_0xd9a6('0x48'),_0x20acd5[_0x7a5adf][_0x25ffef]);break;case 0x4:joinOrLeaveQueues(_0xda6448,_0x458ac6,_0xd9a6('0x49'),_0x20acd5[_0x7a5adf][_0x25ffef]);break;case 0x5:joinOrLeaveQueues(_0xda6448,_0x458ac6,_0xd9a6('0x4a'),_0x20acd5[_0x7a5adf][_0x25ffef]);break;case 0x6:joinOrLeaveQueues(_0xda6448,_0x458ac6,_0xd9a6('0x4b'),_0x20acd5[_0x7a5adf][_0x25ffef]);break;case 0x7:if(_0x443a3c[_0xd9a6('0x7')]!==_0xd9a6('0x8'))_0xda6448[_0x458ac6](util['format']('telephone:%s',_0x20acd5[_0x7a5adf][_0x25ffef][_0xd9a6('0x4')]));break;case 0x8:if(_0x443a3c[_0xd9a6('0x7')]!=='agent')_0xda6448[_0x458ac6](util[_0xd9a6('0x1d')]('trunk:%s',_0x20acd5[_0x7a5adf][_0x25ffef][_0xd9a6('0x4')]));break;case 0x9:if(_0x443a3c[_0xd9a6('0x7')]!==_0xd9a6('0x8'))_0xda6448[_0x458ac6](util[_0xd9a6('0x1d')](_0xd9a6('0x4c'),_0x20acd5[_0x7a5adf][_0x25ffef][_0xd9a6('0x9')],_0x20acd5[_0x7a5adf][_0x25ffef][_0xd9a6('0x4')]));break;case 0xa:_0xda6448[_0x458ac6](util[_0xd9a6('0x1d')]('user:%s',_0x20acd5[_0x7a5adf][_0x25ffef][_0xd9a6('0x4')]));break;}}}}})[_0xd9a6('0xc')](function(){if(_0x458ac6===_0xd9a6('0x4d')){var _0x3114d0=_[_0xd9a6('0x19')](_0x443a3c[_0xd9a6('0x22')],'id');return _0x443a3c[_0xd9a6('0x4e')](_0x3114d0)[_0xd9a6('0xc')](function(){for(var _0x32c9ae=0x0;_0x32c9ae<_0x3114d0[_0xd9a6('0x44')];_0x32c9ae+=0x1){_0x2e1c26[_0xd9a6('0x4f')](_0xd9a6('0x50'),{'ChatInteractionId':Number(_0x3114d0[_0x32c9ae]),'UserId':Number(_0x443a3c['id'])});}});}})[_0xd9a6('0xc')](function(){if(_0x458ac6===_0xd9a6('0x4d')){var _0x2c4ebf=_['map'](_0x443a3c[_0xd9a6('0x24')],'id');return _0x443a3c[_0xd9a6('0x51')](_0x2c4ebf)[_0xd9a6('0xc')](function(){for(var _0x57a706=0x0;_0x57a706<_0x2c4ebf['length'];_0x57a706+=0x1){_0x2e1c26[_0xd9a6('0x4f')](_0xd9a6('0x52'),{'MailInteractionId':Number(_0x2c4ebf[_0x57a706]),'UserId':Number(_0x443a3c['id'])});}});}})[_0xd9a6('0xc')](function(){if(_0x458ac6===_0xd9a6('0x4d')){var _0xc9079d=_['map'](_0x443a3c[_0xd9a6('0x25')],'id');return _0x443a3c['removeFaxInteractions'](_0xc9079d)[_0xd9a6('0xc')](function(){for(var _0x2e8c04=0x0;_0x2e8c04<_0xc9079d[_0xd9a6('0x44')];_0x2e8c04+=0x1){_0x2e1c26[_0xd9a6('0x4f')](_0xd9a6('0x53'),{'FaxInteractionId':Number(_0xc9079d[_0x2e8c04]),'UserId':Number(_0x443a3c['id'])});}});}})[_0xd9a6('0xc')](function(){if(_0x458ac6==='leave'){var _0x30f8e3=_[_0xd9a6('0x19')](_0x443a3c[_0xd9a6('0x27')],'id');return _0x443a3c[_0xd9a6('0x54')](_0x30f8e3)[_0xd9a6('0xc')](function(){for(var _0x138515=0x0;_0x138515<_0x30f8e3['length'];_0x138515+=0x1){_0x2e1c26[_0xd9a6('0x4f')](_0xd9a6('0x55'),{'SmsInteractionId':Number(_0x30f8e3[_0x138515]),'UserId':Number(_0x443a3c['id'])});}});}})['then'](function(){if(_0x458ac6===_0xd9a6('0x4d')){var _0x18355b=_[_0xd9a6('0x19')](_0x443a3c[_0xd9a6('0x29')],'id');return _0x443a3c['removeOpenchannelInteractions'](_0x18355b)[_0xd9a6('0xc')](function(){for(var _0x2ab979=0x0;_0x2ab979<_0x18355b['length'];_0x2ab979+=0x1){_0x2e1c26['emit'](_0xd9a6('0x56'),{'OpenchannelInteractionId':Number(_0x18355b[_0x2ab979]),'UserId':Number(_0x443a3c['id'])});}});}})[_0xd9a6('0xc')](function(){if(_0x458ac6===_0xd9a6('0x4d')){var _0x4b665a=_[_0xd9a6('0x19')](_0x443a3c[_0xd9a6('0x2b')],'id');return _0x443a3c[_0xd9a6('0x57')](_0x4b665a)[_0xd9a6('0xc')](function(){for(var _0x91a68a=0x0;_0x91a68a<_0x4b665a[_0xd9a6('0x44')];_0x91a68a+=0x1){_0x2e1c26['emit'](_0xd9a6('0x58'),{'WhatsappInteractionId':Number(_0x4b665a[_0x91a68a]),'UserId':Number(_0x443a3c['id'])});}});}})[_0xd9a6('0x59')](function(_0x58f7d8){_0xda6448[_0xd9a6('0x5a')](_0x58f7d8);});}}function onDisconnect(_0x3e42b8,_0x40b16b){joinOrLeave(_0x3e42b8,_0xd9a6('0x4d'),_0x40b16b);}function onConnect(_0x4ab5ab){joinOrLeave(_0x4ab5ab,'join');}exports[_0xd9a6('0x5b')]=function(_0x46f6b5){_0x46f6b5['on'](_0xd9a6('0x5c'),function(_0x4b07f3){_0x4b07f3[_0xd9a6('0x5d')](0x0);_0x4b07f3['address']=_0x4b07f3['request'][_0xd9a6('0x5c')][_0xd9a6('0x5e')]+':'+_0x4b07f3[_0xd9a6('0x5f')][_0xd9a6('0x5c')][_0xd9a6('0x60')];_0x4b07f3[_0xd9a6('0x61')]=new Date();_0x4b07f3[_0xd9a6('0x5a')]=function(_0x2fe37f){console[_0xd9a6('0x5a')](_0xd9a6('0x62')+_0x4b07f3[_0xd9a6('0x63')]['name']+'['+_0x4b07f3['address']+']',_0x2fe37f);};_0x4b07f3['on'](_0xd9a6('0x64'),function(){onDisconnect(_0x4b07f3,_0x46f6b5);_0x4b07f3[_0xd9a6('0x5a')](_0xd9a6('0x65'));});onConnect(_0x4b07f3);_0x4b07f3[_0xd9a6('0x5a')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b5571c6..4d373a3 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 _0x5c06=['OpenchannelMessage','newmessage','request','then','info','EventManager','error','code','Trigger,\x20%s','catch','channel','User','find','UserId','format','SIP/%s','name','incomingmessage','outgoingmessage','get','changed','closed','default','length','hasOwnProperty','model','event','callback','toLowerCase','condition','util','../../mysqldb','../logger','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction'];(function(_0x118f34,_0x487a33){var _0x291c6f=function(_0x4b4299){while(--_0x4b4299){_0x118f34['push'](_0x118f34['shift']());}};_0x291c6f(++_0x487a33);}(_0x5c06,0x162));var _0x65c0=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5c06[_0x618414];return _0x21c19a;};'use strict';var util=require(_0x65c0('0x0'));var db=require(_0x65c0('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x65c0('0x2'))('triggers');var client=jayson['client'][_0x65c0('0x3')]({'port':0x232a});var triggers=[{'channel':_0x65c0('0x4'),'model':_0x65c0('0x5'),'event':'afterCreate','condition':_0x65c0('0x6'),'callback':afterCreate},{'channel':_0x65c0('0x4'),'model':_0x65c0('0x5'),'event':_0x65c0('0x7'),'condition':_0x65c0('0x8'),'callback':afterUpdate},{'channel':_0x65c0('0x4'),'model':_0x65c0('0x9'),'event':_0x65c0('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x65c0('0xb'),'model':_0x65c0('0xc'),'event':_0x65c0('0xa'),'condition':_0x65c0('0x6'),'callback':afterCreate},{'channel':_0x65c0('0xb'),'model':_0x65c0('0xc'),'event':_0x65c0('0x7'),'condition':_0x65c0('0x8'),'callback':afterUpdate},{'channel':'Sms','model':_0x65c0('0xd'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x65c0('0xe'),'model':_0x65c0('0xf'),'event':_0x65c0('0xa'),'condition':_0x65c0('0x6'),'callback':afterCreate},{'channel':_0x65c0('0xe'),'model':_0x65c0('0xf'),'event':_0x65c0('0x7'),'condition':_0x65c0('0x8'),'callback':afterUpdate},{'channel':_0x65c0('0xe'),'model':_0x65c0('0x10'),'event':_0x65c0('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0x65c0('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x65c0('0x11'),'model':_0x65c0('0x12'),'event':'afterUpdate','condition':_0x65c0('0x8'),'callback':afterUpdate},{'channel':_0x65c0('0x11'),'model':'FaxMessage','event':_0x65c0('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x65c0('0x13'),'event':_0x65c0('0xa'),'condition':_0x65c0('0x6'),'callback':afterCreate},{'channel':_0x65c0('0x14'),'model':'MailInteraction','event':_0x65c0('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x65c0('0x15'),'event':_0x65c0('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x65c0('0x16'),'model':_0x65c0('0x17'),'event':_0x65c0('0xa'),'condition':_0x65c0('0x6'),'callback':afterCreate},{'channel':_0x65c0('0x16'),'model':_0x65c0('0x17'),'event':_0x65c0('0x7'),'condition':_0x65c0('0x8'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x65c0('0x18'),'event':_0x65c0('0xa'),'condition':_0x65c0('0x19'),'callback':afterCreateMessage}];function request(_0x18d99d){return client[_0x65c0('0x1a')]('EventManager',_0x18d99d)[_0x65c0('0x1b')](function(_0x371b5f){logger[_0x65c0('0x1c')]('Trigger,\x20%s',_0x65c0('0x1d'),_0x371b5f);if(_0x371b5f['error']){if(_0x371b5f[_0x65c0('0x1e')][_0x65c0('0x1f')]===0x1f4){logger[_0x65c0('0x1e')](_0x65c0('0x20'),'EventManager',_0x371b5f[_0x65c0('0x1e')]);}}})[_0x65c0('0x21')](function(_0x47f5dc){logger['error']('Trigger,\x20%s',_0x65c0('0x1d'),_0x47f5dc);});}function afterCreateMessage(_0x594a5d,_0x338e65){return function(_0x3a25b9,_0x4876a5){_0x3a25b9=_0x3a25b9['get']({'plain':!![]});_0x3a25b9[_0x65c0('0x22')]=_0x594a5d;_0x3a25b9['event']=_0x3a25b9['direction'];if(_0x3a25b9['UserId']){return db[_0x65c0('0x23')][_0x65c0('0x24')]({'where':{'id':_0x3a25b9[_0x65c0('0x25')]},'attributes':['id','name'],'raw':!![]})[_0x65c0('0x1b')](function(_0x3c269c){_0x3a25b9['interface']=util[_0x65c0('0x26')](_0x65c0('0x27'),_0x3c269c[_0x65c0('0x28')]);_0x3a25b9[_0x65c0('0x22')]=_0x594a5d;return request({'event':_0x65c0('0x29'),'message':_0x3a25b9});})[_0x65c0('0x21')](function(_0xaf929a){console['error'](_0xaf929a);});}else{return request({'event':_0x65c0('0x2a'),'message':_0x3a25b9});}};}function afterCreate(_0xd98135,_0x5d8e2b){return function(_0x4d4040,_0x5c1f1d){_0x4d4040=_0x4d4040[_0x65c0('0x2b')]({'plain':!![]});_0x4d4040[_0x65c0('0x22')]=_0xd98135;_0x4d4040['event']='opened';return request({'event':_0x5d8e2b,'message':_0x4d4040});};}function afterUpdate(_0x30cf34,_0x1d6e7f){return function(_0x2ccdb2,_0x2a63f7){if(_0x2ccdb2[_0x65c0('0x2c')](_0x65c0('0x2d'))&&_0x2ccdb2[_0x65c0('0x2d')]){_0x2ccdb2=_0x2ccdb2[_0x65c0('0x2b')]({'plain':!![]});_0x2ccdb2[_0x65c0('0x22')]=_0x30cf34;_0x2ccdb2['event']=_0x65c0('0x2d');if(_0x2ccdb2[_0x65c0('0x25')]){return db[_0x65c0('0x23')][_0x65c0('0x24')]({'where':{'id':_0x2ccdb2[_0x65c0('0x25')]},'attributes':['id',_0x65c0('0x28')],'raw':!![]})[_0x65c0('0x1b')](function(_0xf07fdf){_0x2ccdb2['interface']=util[_0x65c0('0x26')](_0x65c0('0x27'),_0xf07fdf['name']);return request({'event':_0x1d6e7f,'message':_0x2ccdb2});})[_0x65c0('0x21')](function(_0x8b86be){console['error'](_0x8b86be);});}else{return request({'event':_0x1d6e7f,'message':_0x2ccdb2});}}};}exports[_0x65c0('0x2e')]=function(){for(var _0x1e99d8=0x0;_0x1e99d8=_0x4df81a['agents']){throw Error(_0x725a('0x12'));}_0x57de7c(_0x567e3a);})['catch'](function(_0xa02839){_0x3718e9(_0xa02839);});});}; \ No newline at end of file +var _0xa543=['updateAttributes','getLicense','role','User','count','agent','then','agents','lodash','./license/util','voice','chat','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0xff3c13,_0x2f8c00){var _0x15360b=function(_0x113a01){while(--_0x113a01){_0xff3c13['push'](_0xff3c13['shift']());}};_0x15360b(++_0x2f8c00);}(_0xa543,0x6c));var _0x3a54=function(_0x28bffd,_0xcbd12d){_0x28bffd=_0x28bffd-0x0;var _0x348961=_0xa543[_0x28bffd];return _0x348961;};'use strict';var _=require(_0x3a54('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x3a54('0x1'));var channels=[_0x3a54('0x2'),'mail',_0x3a54('0x3'),_0x3a54('0x4'),_0x3a54('0x5'),_0x3a54('0x6'),'openchannel'];exports[_0x3a54('0x7')]=function(){return channels;};exports[_0x3a54('0x8')]=function(_0x3f4f58){_0x3f4f58=_0x3f4f58[_0x3a54('0x9')]();return _[_0x3a54('0xa')](channels,_0x3f4f58);};exports[_0x3a54('0xb')]=function(_0x247052,_0x31f9bb,_0x56eb35,_0xb910bc){var _0x17fc19={'loginAttempts':_0x31f9bb,'blocked':_0x56eb35};if(!_['isUndefined'](_0xb910bc)){_0x17fc19['blockedAt']=_0xb910bc;}return _0x247052[_0x3a54('0xc')](_0x17fc19);};exports[_0x3a54('0xd')]=function(_0x212f31){return new BPromise(function(_0x3e6b27,_0x379482){var _0x1797e4=0x0;if(_0x212f31[_0x3a54('0xe')]!=='agent'){_0x3e6b27(_0x212f31);}db[_0x3a54('0xf')][_0x3a54('0x10')]({'where':{'role':_0x3a54('0x11'),'online':!![],'id':{'$ne':_0x212f31['id']}}})['then'](function(_0x5c5df0){_0x1797e4=_0x5c5df0;return util['getLicense']();})[_0x3a54('0x12')](function(_0x6f9241){if(_0x6f9241&&_0x6f9241[_0x3a54('0x13')]&&_0x1797e4>=_0x6f9241[_0x3a54('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3e6b27(_0x212f31);})['catch'](function(_0x50b17c){_0x379482(_0x50b17c);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 58fa3bf..fd5b3a9 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fbf=['exports','404','status','render','json','send'];(function(_0x3a835d,_0x53eab8){var _0x4b3c64=function(_0x3e0228){while(--_0x3e0228){_0x3a835d['push'](_0x3a835d['shift']());}};_0x4b3c64(++_0x53eab8);}(_0x4fbf,0xea));var _0xf4fb=function(_0x3a2d38,_0x126807){_0x3a2d38=_0x3a2d38-0x0;var _0xd4aaa4=_0x4fbf[_0x3a2d38];return _0xd4aaa4;};'use strict';module[_0xf4fb('0x0')][0x194]=function pageNotFound(_0x381573,_0x3fb08f){var _0x5254fb=_0xf4fb('0x1');var _0x3d6734=0x194;var _0x261f15={'status':_0x3d6734};_0x3fb08f[_0xf4fb('0x2')](_0x261f15['status']);_0x3fb08f[_0xf4fb('0x3')](_0x5254fb,{},function(_0x3fba73,_0x367797){if(_0x3fba73){return _0x3fb08f[_0xf4fb('0x2')](_0x261f15[_0xf4fb('0x2')])[_0xf4fb('0x4')](_0x261f15);}_0x3fb08f[_0xf4fb('0x5')](_0x367797);});}; \ No newline at end of file +var _0xe023=['send','exports','404','status','render'];(function(_0x6f17a5,_0x5c1085){var _0x43f0f9=function(_0x1234ae){while(--_0x1234ae){_0x6f17a5['push'](_0x6f17a5['shift']());}};_0x43f0f9(++_0x5c1085);}(_0xe023,0xab));var _0x3e02=function(_0x1e6304,_0x380f1b){_0x1e6304=_0x1e6304-0x0;var _0x2e759f=_0xe023[_0x1e6304];return _0x2e759f;};'use strict';module[_0x3e02('0x0')][0x194]=function pageNotFound(_0x5baef0,_0x198975){var _0x65a93d=_0x3e02('0x1');var _0x47f501=0x194;var _0x3b5f5c={'status':_0x47f501};_0x198975[_0x3e02('0x2')](_0x3b5f5c['status']);_0x198975[_0x3e02('0x3')](_0x65a93d,{},function(_0x17f129,_0x3a93c9){if(_0x17f129){return _0x198975[_0x3e02('0x2')](_0x3b5f5c[_0x3e02('0x2')])['json'](_0x3b5f5c);}_0x198975[_0x3e02('0x4')](_0x3a93c9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3542b12..a40c227 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49c1=['WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','cascade','hasMany','Recordings','VoiceQueuesRt','UserId','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','moh_has_sounds','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessionReport','belongsTo','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPauseId','Agents','TeamVoiceQueue','BlackLists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','hasOne','Imap','Smtp','Disposition','Answers','Interactions','ListId','team_has_mail_queues','Teams','MailMessage','Owner','mail_interaction_has_tags','Users','MailInteractionId','Attachments','Interaction','Account','restrict','TagId','MailQueueReport','List','Items','FaxAccountId','Exntensions','mandatoryDispositionPause','fax_interaction_has_tags','Tags','ThroughTags','user_has_fax_interactions','FaxInteractionId','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','Dispositions','OpenchannelAccountId','OpenchannelMessage','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','CmCompany','CmHopper','HopperFinals','HopperHistories','JscriptySessions','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','OneAll','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','SugarcrmField','FieldId','Variable','VariableId','DeskAccount','DeskConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskConfiguration','VtigerField','ServicenowAccount','ChatQueueReport','FromId','ToId','JscriptyProject','ProjectId','MailQueues','ChatQueues','TrunkBackup','SquareProject','SquareProjectId','campaigns_has_cm_lists','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ChatTransferReport','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','CustomFields','HopperHistory','Queues','userProfileId','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappMessage','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','exports','path','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','name','utf8_general_ci','sequelizeHistory','xC@LL1234','mysql','utf8','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappQueueReport'];(function(_0x4b02f8,_0x342985){var _0x585b22=function(_0x16ddc3){while(--_0x16ddc3){_0x4b02f8['push'](_0x4b02f8['shift']());}};_0x585b22(++_0x342985);}(_0x49c1,0xef));var _0x149c=function(_0x2a6910,_0x3cfc85){_0x2a6910=_0x2a6910-0x0;var _0x38d0e4=_0x49c1[_0x2a6910];return _0x38d0e4;};'use strict';var path=require(_0x149c('0x0'));var config=require('../config/environment');var Sequelize=require(_0x149c('0x1'));var _=require(_0x149c('0x2'));var jstz=require(_0x149c('0x3'));var timezone=jstz['determine']();config[_0x149c('0x1')]=_[_0x149c('0x4')](config['sequelize'],{'database':_0x149c('0x5'),'username':_0x149c('0x6'),'password':'xC@LL1234','options':{'host':_0x149c('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x149c('0x8')},'logging':![],'timezone':timezone[_0x149c('0x9')](),'define':{'charset':'utf8','collate':_0x149c('0xa')}}});config[_0x149c('0xb')]=_['defaultsDeep'](config[_0x149c('0xb')],{'database':_0x149c('0x5'),'username':'xcall','password':_0x149c('0xc'),'options':{'host':_0x149c('0x7'),'port':0xcea,'dialect':_0x149c('0xd'),'dialectOptions':{'charset':_0x149c('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x149c('0xe'),'collate':_0x149c('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x149c('0x1')][_0x149c('0xf')],config[_0x149c('0x1')][_0x149c('0x10')],config[_0x149c('0x1')][_0x149c('0x11')],config['sequelize'][_0x149c('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x149c('0xb')]['database'],config[_0x149c('0xb')]['username'],config[_0x149c('0xb')][_0x149c('0x11')],config[_0x149c('0xb')][_0x149c('0x12')])};db[_0x149c('0x13')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x15'));db[_0x149c('0x16')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x17'));db[_0x149c('0x18')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x19'));db[_0x149c('0x1a')]=db[_0x149c('0x1')]['import'](_0x149c('0x1b'));db['VoiceMusicOnHold']=db['sequelize']['import'](_0x149c('0x1c'));db[_0x149c('0x1d')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x1e'));db[_0x149c('0x1f')]=db[_0x149c('0x1')]['import'](_0x149c('0x20'));db[_0x149c('0x21')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x22'));db[_0x149c('0x23')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/voiceMail/voiceMail.model');db[_0x149c('0x24')]=db[_0x149c('0x1')]['import'](_0x149c('0x25'));db[_0x149c('0x26')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x149c('0x27')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x28'));db[_0x149c('0x29')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x2a'));db['MemberReport']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x2b'));db[_0x149c('0x2c')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x2d'));db[_0x149c('0x2e')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x149c('0x2f')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x30'));db[_0x149c('0x31')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x32'));db[_0x149c('0x33')]=db['sequelize'][_0x149c('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x149c('0x34')]=db['sequelize'][_0x149c('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x149c('0x35')]=db[_0x149c('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x149c('0x36')]=db[_0x149c('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x149c('0x37')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x38'));db[_0x149c('0x39')]=db[_0x149c('0x1')]['import'](_0x149c('0x3a'));db[_0x149c('0x3b')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x149c('0x3c')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x3d'));db['MailAccount']=db['sequelize'][_0x149c('0x14')](_0x149c('0x3e'));db['MailQueue']=db[_0x149c('0x1')]['import'](_0x149c('0x3f'));db[_0x149c('0x40')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x41'));db['MailInteraction']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/mailMessage/mailMessage.model');db[_0x149c('0x42')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x43'));db['Dashboard']=db[_0x149c('0x1')]['import']('../api/dashboard/dashboard.model');db[_0x149c('0x44')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x45'));db[_0x149c('0x46')]=db[_0x149c('0x1')]['import'](_0x149c('0x47'));db[_0x149c('0x48')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x49'));db[_0x149c('0x4a')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x4b'));db[_0x149c('0x4c')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x4d'));db[_0x149c('0x4e')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x149c('0x1')]['import'](_0x149c('0x4f'));db[_0x149c('0x50')]=db['sequelize']['import'](_0x149c('0x51'));db[_0x149c('0x52')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db['sequelize'][_0x149c('0x14')](_0x149c('0x53'));db[_0x149c('0x54')]=db[_0x149c('0x1')]['import'](_0x149c('0x55'));db[_0x149c('0x56')]=db[_0x149c('0x1')]['import'](_0x149c('0x57'));db[_0x149c('0x58')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x59'));db['OpenchannelMessage']=db[_0x149c('0x1')]['import'](_0x149c('0x5a'));db['OpenchannelQueue']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x5b'));db[_0x149c('0x5c')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x149c('0x5d')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x149c('0x5e')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x5f'));db[_0x149c('0x60')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x61'));db[_0x149c('0x62')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x63'));db[_0x149c('0x64')]=db['sequelize']['import'](_0x149c('0x65'));db[_0x149c('0x66')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x67'));db[_0x149c('0x68')]=db[_0x149c('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0x149c('0x69')]=db['sequelize']['import'](_0x149c('0x6a'));db['CmCompany']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x149c('0x1')]['import'](_0x149c('0x6b'));db['CmHopper']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/cmHopper/cmHopper.model');db[_0x149c('0x6c')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x149c('0x6d')]=db[_0x149c('0x1')]['import'](_0x149c('0x6e'));db[_0x149c('0x6f')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x70'));db[_0x149c('0x71')]=db[_0x149c('0x1')]['import'](_0x149c('0x72'));db['CmCustomField']=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db[_0x149c('0x73')]=db[_0x149c('0x1')]['import'](_0x149c('0x74'));db[_0x149c('0x75')]=db['sequelize']['import'](_0x149c('0x76'));db[_0x149c('0x77')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x78'));db['Disposition']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/disposition/disposition.model');db['Condition']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x79'));db[_0x149c('0x7a')]=db[_0x149c('0x1')]['import'](_0x149c('0x7b'));db['Pause']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x7c'));db[_0x149c('0x7d')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x7e'));db['VoiceQueuesLog']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x7f'));db[_0x149c('0x80')]=db['sequelize'][_0x149c('0x14')]('../api/schedule/schedule.model');db[_0x149c('0x81')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x82'));db[_0x149c('0x83')]=db['sequelize']['import'](_0x149c('0x84'));db[_0x149c('0x85')]=db[_0x149c('0x1')]['import']('../api/template/template.model');db[_0x149c('0x86')]=db[_0x149c('0x1')]['import'](_0x149c('0x87'));db['Variable']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x88'));db['Integration']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x89'));db[_0x149c('0x8a')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/integrationReport/integrationReport.model');db[_0x149c('0x8b')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x8c'));db[_0x149c('0x8d')]=db['sequelize'][_0x149c('0x14')](_0x149c('0x8e'));db[_0x149c('0x8f')]=db[_0x149c('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x149c('0x90')]=db[_0x149c('0x1')]['import'](_0x149c('0x91'));db[_0x149c('0x92')]=db[_0x149c('0x1')]['import'](_0x149c('0x93'));db[_0x149c('0x94')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x95'));db['SalesforceAccount']=db['sequelize'][_0x149c('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x149c('0x96')]=db[_0x149c('0x1')]['import'](_0x149c('0x97'));db['SalesforceField']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x98'));db[_0x149c('0x99')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x9a'));db[_0x149c('0x9b')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x9c'));db['DeskAccount']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x9d'));db['DeskConfiguration']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x9e'));db[_0x149c('0x9f')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xa0'));db[_0x149c('0xa1')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xa2'));db[_0x149c('0xa3')]=db['sequelize'][_0x149c('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x149c('0xa4')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/intZohoField/intZohoField.model');db[_0x149c('0xa5')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x149c('0xa6')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xa7'));db[_0x149c('0xa8')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xa9'));db[_0x149c('0xaa')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xab'));db['FreshdeskConfiguration']=db[_0x149c('0x1')]['import'](_0x149c('0xac'));db[_0x149c('0xad')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xae'));db[_0x149c('0xaf')]=db[_0x149c('0x1')]['import'](_0x149c('0xb0'));db[_0x149c('0xb1')]=db[_0x149c('0x1')]['import'](_0x149c('0xb2'));db['VtigerField']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xb3'));db['ServicenowAccount']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xb4'));db[_0x149c('0xb5')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x149c('0xb6')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x149c('0xb7')]=db[_0x149c('0x1')]['import'](_0x149c('0xb8'));db[_0x149c('0xb9')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xba'));db[_0x149c('0xbb')]=db['sequelize']['import'](_0x149c('0xbc'));db[_0x149c('0xbd')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xbe'));db[_0x149c('0xbf')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xc0'));db[_0x149c('0xc1')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xc2'));db['Integration']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0x89'));db[_0x149c('0xc3')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xc4'));db['ChatQueueReport']=db[_0x149c('0x1')]['import'](_0x149c('0xc5'));db[_0x149c('0xc6')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xc7'));db[_0x149c('0xc8')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xc9'));db[_0x149c('0xca')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xcb'));db['JscriptySessionReport']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xcc'));db[_0x149c('0xcd')]=db[_0x149c('0x1')]['import'](_0x149c('0xce'));db[_0x149c('0xcf')]=db[_0x149c('0x1')]['import']('../api/squareReport/squareReport.model');db[_0x149c('0xd0')]=db['sequelize'][_0x149c('0x14')](_0x149c('0xd1'));db['JscriptyProject']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xd2'));db['Setting']=db['sequelize']['import']('../api/setting/setting.model');db['SquareOdbc']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xd3'));db['SquareProject']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/squareProject/squareProject.model');db[_0x149c('0xd4')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xd5'));db[_0x149c('0xd6')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xd7'));db[_0x149c('0xd8')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xd9'));db[_0x149c('0xda')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xdb'));db[_0x149c('0xdc')]=db['sequelize']['import']('../api/campaign/campaign.model');db[_0x149c('0xdd')]=db['sequelize'][_0x149c('0x14')](_0x149c('0xde'));db[_0x149c('0xdf')]=db['sequelize'][_0x149c('0x14')](_0x149c('0xe0'));db[_0x149c('0xe1')]=db[_0x149c('0x1')][_0x149c('0x14')]('../api/plugin/plugin.model');db[_0x149c('0xe2')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xe3'));db['ChatTransferReport']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xe4'));db[_0x149c('0xe5')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xe6'));db[_0x149c('0xe7')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xe8'));db[_0x149c('0xe9')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xea'));db[_0x149c('0xeb')]=db['sequelize'][_0x149c('0x14')](_0x149c('0xec'));db['VoicePrefix']=db[_0x149c('0x1')]['import'](_0x149c('0xed'));db[_0x149c('0xee')]=db['sequelize'][_0x149c('0x14')](_0x149c('0xef'));db[_0x149c('0xf0')]=db[_0x149c('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x149c('0x1')]['import'](_0x149c('0xf1'));db['UserNotification']=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xf2'));db[_0x149c('0xf3')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xf4'));db[_0x149c('0xf5')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xf6'));db[_0x149c('0xf7')]=db['sequelize'][_0x149c('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x149c('0x1')][_0x149c('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x149c('0xf8')]=db['sequelize'][_0x149c('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x149c('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x149c('0xf9')]=db[_0x149c('0x1')][_0x149c('0x14')](_0x149c('0xfa'));db[_0x149c('0xfb')]=db['sequelize']['import'](_0x149c('0xfc'));db['TeamVoiceQueue']=db['sequelize'][_0x149c('0x14')](_0x149c('0xfd'));db[_0x149c('0x13')]['hasOne'](db[_0x149c('0x23')],{'as':_0x149c('0x23'),'onDelete':_0x149c('0xfe'),'foreignKey':'UserId'});db[_0x149c('0x13')][_0x149c('0xff')](db[_0x149c('0x1f')],{'as':_0x149c('0x100'),'foreignKey':'UserId'});db[_0x149c('0x13')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x149c('0x101'),'foreignKey':'UserId'});db['User'][_0x149c('0xff')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x149c('0xfe'),'hooks':!![]});db[_0x149c('0x13')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x149c('0x102')});db['User'][_0x149c('0xff')](db[_0x149c('0x6f')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x149c('0x13')][_0x149c('0xff')](db[_0x149c('0x71')],{'as':_0x149c('0x71'),'foreignKey':'UserId'});db[_0x149c('0x13')][_0x149c('0xff')](db['OpenchannelInteraction'],{'as':_0x149c('0x103'),'foreignKey':_0x149c('0x102')});db['User']['hasMany'](db[_0x149c('0x60')],{'as':_0x149c('0x104'),'foreignKey':_0x149c('0x102')});db[_0x149c('0x13')][_0x149c('0xff')](db[_0x149c('0x105')],{'as':_0x149c('0x106'),'foreignKey':_0x149c('0x102')});db['User'][_0x149c('0xff')](db[_0x149c('0x4a')],{'as':_0x149c('0x107'),'foreignKey':_0x149c('0x102')});db[_0x149c('0x13')][_0x149c('0xff')](db[_0x149c('0x108')],{'as':_0x149c('0x109'),'foreignKey':_0x149c('0x102')});db[_0x149c('0x13')][_0x149c('0xff')](db['WhatsappInteraction'],{'as':_0x149c('0x10a'),'foreignKey':'UserId'});db[_0x149c('0x13')][_0x149c('0xff')](db[_0x149c('0x10b')],{'as':_0x149c('0x10c'),'foreignKey':'SenderId'});db['User']['belongsTo'](db['UserProfile'],{'as':_0x149c('0xee'),'foreignKey':'userProfileId'});db['User']['belongsToMany'](db[_0x149c('0x68')],{'as':_0x149c('0x10d'),'through':_0x149c('0x10e')});db[_0x149c('0x13')]['belongsToMany'](db['CmContact'],{'as':_0x149c('0x10f'),'through':_0x149c('0x110')});db[_0x149c('0x13')][_0x149c('0x111')](db['CmList'],{'as':_0x149c('0x112'),'through':_0x149c('0x113')});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0xd8')],{'through':_0x149c('0x114')});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x108')],{'as':'MailInteractions','through':_0x149c('0x115')});db[_0x149c('0x13')][_0x149c('0x111')](db['ChatInteraction'],{'as':_0x149c('0x104'),'through':_0x149c('0x116')});db[_0x149c('0x13')][_0x149c('0x111')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x149c('0x13')][_0x149c('0x111')](db['SmsInteraction'],{'as':_0x149c('0x106'),'through':_0x149c('0x117')});db['User']['belongsToMany'](db[_0x149c('0x118')],{'as':_0x149c('0x103'),'through':_0x149c('0x119')});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0xf7')],{'as':'WhatsappInteractions','through':_0x149c('0x11a')});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x1d')],{'as':_0x149c('0x11b'),'through':'UserVoiceQueue','required':![]});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x11c')],{'as':'MailQueues','through':_0x149c('0x34'),'required':![]});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x66')],{'as':'ChatQueues','through':_0x149c('0x33'),'required':![],'hooks':!![]});db['User'][_0x149c('0x111')](db['FaxQueue'],{'as':_0x149c('0x11d'),'through':_0x149c('0x35'),'required':![]});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x54')],{'as':_0x149c('0x11e'),'through':_0x149c('0x36'),'required':![]});db[_0x149c('0x13')]['belongsToMany'](db[_0x149c('0x11f')],{'as':_0x149c('0x120'),'through':_0x149c('0x37'),'required':![]});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0xf9')],{'as':_0x149c('0x121'),'through':_0x149c('0x39'),'required':![]});db[_0x149c('0x13')]['belongsToMany'](db[_0x149c('0xeb')],{'through':'cm_user_has_lists'});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x122')],{'as':_0x149c('0x123'),'through':_0x149c('0x124'),'required':![]});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x5c')],{'as':'ChatWebsites','through':_0x149c('0x125')});db['User'][_0x149c('0x111')](db['FaxAccount'],{'as':'FaxAccounts','through':_0x149c('0x126')});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x127')],{'as':_0x149c('0x128'),'through':_0x149c('0x129')});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x56')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x149c('0x13')][_0x149c('0x111')](db[_0x149c('0x50')],{'as':_0x149c('0x12a'),'through':_0x149c('0x12b')});db[_0x149c('0x13')][_0x149c('0x111')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x149c('0x12c')});db['User']['belongsToMany'](db['SquareProject'],{'as':_0x149c('0x12d'),'through':_0x149c('0x12e')});db[_0x149c('0x16')]['hasMany'](db[_0x149c('0x1a')],{'as':'SpiedAgents','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x12f')});db[_0x149c('0x18')]['hasMany'](db[_0x149c('0x1a')],{'onDelete':_0x149c('0xfe')});db[_0x149c('0x1a')][_0x149c('0xff')](db['VoiceExtension'],{'as':_0x149c('0x130'),'onDelete':_0x149c('0xfe')});db['VoiceMusicOnHold'][_0x149c('0x111')](db['Sound'],{'as':'Sounds','through':_0x149c('0x131')});db[_0x149c('0x1d')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x149c('0x132')});db[_0x149c('0x1d')]['hasMany'](db['CmHopper'],{'as':_0x149c('0x133'),'foreignKey':'VoiceQueueId'});db[_0x149c('0x1d')]['hasMany'](db[_0x149c('0x6d')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x149c('0x1d')][_0x149c('0xff')](db[_0x149c('0x6f')],{'as':'HopperHistories','foreignKey':_0x149c('0x132')});db[_0x149c('0x1d')]['hasMany'](db[_0x149c('0x71')],{'as':_0x149c('0x71'),'foreignKey':'VoiceQueueId'});db[_0x149c('0x1d')]['hasMany'](db['CmHopperBlack'],{'as':_0x149c('0x134'),'foreignKey':'VoiceQueueId'});db[_0x149c('0x1d')][_0x149c('0xff')](db[_0x149c('0x135')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x149c('0x1d')][_0x149c('0x136')](db[_0x149c('0x2c')],{'as':_0x149c('0x2c'),'foreignKey':_0x149c('0x137')});db['VoiceQueue'][_0x149c('0x136')](db[_0x149c('0x2c')],{'as':'TrunkBackup','foreignKey':_0x149c('0x138')});db['VoiceQueue']['belongsTo'](db[_0x149c('0x7a')],{'as':'Interval','foreignKey':_0x149c('0x139')});db[_0x149c('0x1d')][_0x149c('0x136')](db[_0x149c('0x13a')],{'as':'mandatoryDispositionPause','foreignKey':_0x149c('0x13b')});db[_0x149c('0x1d')]['belongsToMany'](db[_0x149c('0xeb')],{'as':_0x149c('0x112'),'through':'voice_queues_has_cm_lists'});db[_0x149c('0x1d')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':_0x149c('0x31')});db['VoiceQueue'][_0x149c('0x111')](db['Team'],{'as':'Teams','through':_0x149c('0x13d')});db[_0x149c('0x1d')][_0x149c('0x111')](db[_0x149c('0xeb')],{'as':_0x149c('0x13e'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x149c('0x136')](db['User'],{'as':'User','foreignKey':_0x149c('0x102')});db['ScreenRecording'][_0x149c('0x136')](db[_0x149c('0x13')],{'as':_0x149c('0x13'),'foreignKey':_0x149c('0x102')});db[_0x149c('0x23')][_0x149c('0xff')](db['VoiceMailMessage'],{'as':_0x149c('0x13f'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x140'),'sourceKey':_0x149c('0x141')});db[_0x149c('0x24')][_0x149c('0x136')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x149c('0x141')});db[_0x149c('0x26')][_0x149c('0xff')](db[_0x149c('0x142')],{'as':_0x149c('0x143'),'foreignKey':_0x149c('0x144'),'constraints':![]});db['VoiceCallReport'][_0x149c('0xff')](db[_0x149c('0x29')],{'as':_0x149c('0x145'),'foreignKey':_0x149c('0x144'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x149c('0x13')],{'as':_0x149c('0x13'),'foreignKey':_0x149c('0x102')});db['VoiceCallReport']['belongsTo'](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x3b')][_0x149c('0x136')](db[_0x149c('0x127')],{'as':_0x149c('0x127'),'foreignKey':_0x149c('0x149')});db[_0x149c('0x3c')][_0x149c('0x136')](db[_0x149c('0x127')],{'as':_0x149c('0x127'),'foreignKey':_0x149c('0x149')});db[_0x149c('0x127')][_0x149c('0x14a')](db[_0x149c('0x3b')],{'as':_0x149c('0x14b'),'onDelete':_0x149c('0xfe')});db['MailAccount']['hasOne'](db[_0x149c('0x3c')],{'as':_0x149c('0x14c'),'onDelete':_0x149c('0xfe')});db['MailAccount'][_0x149c('0xff')](db[_0x149c('0x14d')],{'as':'Dispositions','foreignKey':_0x149c('0x149')});db['MailAccount'][_0x149c('0xff')](db['CannedAnswer'],{'as':_0x149c('0x14e'),'foreignKey':_0x149c('0x149')});db[_0x149c('0x127')]['hasMany'](db['MailMessage'],{'as':_0x149c('0x13f'),'foreignKey':_0x149c('0x149')});db[_0x149c('0x127')][_0x149c('0xff')](db['MailInteraction'],{'as':_0x149c('0x14f')});db['MailAccount'][_0x149c('0xff')](db[_0x149c('0x42')],{'as':_0x149c('0x130')});db[_0x149c('0x127')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':'List','foreignKey':_0x149c('0x150')});db[_0x149c('0x127')][_0x149c('0x136')](db[_0x149c('0x85')],{'as':'Template','foreignKey':'TemplateId'});db[_0x149c('0x127')]['belongsTo'](db[_0x149c('0x13a')],{'as':'mandatoryDispositionPause','foreignKey':_0x149c('0x13b')});db[_0x149c('0x127')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':_0x149c('0x129')});db[_0x149c('0x11c')][_0x149c('0x111')](db['User'],{'as':_0x149c('0x13c'),'through':_0x149c('0x34')});db[_0x149c('0x11c')][_0x149c('0x111')](db['Team'],{'through':_0x149c('0x151'),'as':_0x149c('0x152')});db[_0x149c('0x108')][_0x149c('0xff')](db[_0x149c('0x153')],{'as':'Messages','onDelete':_0x149c('0xfe'),'foreignKey':'MailInteractionId'});db[_0x149c('0x108')][_0x149c('0x136')](db[_0x149c('0x127')],{'as':'Account','foreignKey':_0x149c('0x149')});db['MailInteraction'][_0x149c('0x136')](db['CmContact'],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x108')][_0x149c('0x136')](db[_0x149c('0x13')],{'as':_0x149c('0x154'),'foreignKey':_0x149c('0x102')});db['MailInteraction'][_0x149c('0x111')](db[_0x149c('0x83')],{'through':_0x149c('0x155'),'as':'Tags'});db[_0x149c('0x108')][_0x149c('0x111')](db[_0x149c('0x83')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x149c('0x108')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x156'),'through':_0x149c('0x115'),'foreignKey':_0x149c('0x157')});db['MailMessage'][_0x149c('0xff')](db[_0x149c('0xdf')],{'as':_0x149c('0x158'),'onDelete':_0x149c('0xfe')});db[_0x149c('0x153')][_0x149c('0x136')](db[_0x149c('0x13')],{'as':_0x149c('0x13')});db[_0x149c('0x153')][_0x149c('0x136')](db[_0x149c('0x146')],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x147')});db[_0x149c('0x153')][_0x149c('0x136')](db[_0x149c('0x108')],{'as':_0x149c('0x159'),'foreignKey':_0x149c('0x157')});db['MailMessage']['belongsTo'](db[_0x149c('0x127')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x149')});db[_0x149c('0x153')][_0x149c('0x136')](db[_0x149c('0x5c')],{'as':_0x149c('0x5c'),'foreignKey':'ChatWebsiteId'});db[_0x149c('0x153')][_0x149c('0x136')](db[_0x149c('0x64')],{'as':_0x149c('0x64'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication']['belongsTo'](db['User'],{'onDelete':_0x149c('0x15b')});db[_0x149c('0x42')]['belongsTo'](db[_0x149c('0x11c')],{'onDelete':'restrict'});db[_0x149c('0x42')]['belongsTo'](db[_0x149c('0x127')],{'onDelete':_0x149c('0x15b')});db[_0x149c('0x42')][_0x149c('0x136')](db[_0x149c('0x7a')],{'onDelete':_0x149c('0x15b'),'foreignKey':_0x149c('0x139')});db[_0x149c('0x42')][_0x149c('0x136')](db[_0x149c('0x83')],{'onDelete':_0x149c('0x15b'),'foreignKey':_0x149c('0x15c')});db[_0x149c('0x15d')][_0x149c('0x136')](db[_0x149c('0x127')],{});db['MailQueueReport'][_0x149c('0x136')](db['CmList'],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db[_0x149c('0x15d')]['belongsTo'](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x15d')][_0x149c('0x136')](db[_0x149c('0x108')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db[_0x149c('0x15d')]['belongsTo'](db[_0x149c('0x13')],{});db['MailQueueReport'][_0x149c('0x136')](db[_0x149c('0x11c')],{});db['Dashboard'][_0x149c('0xff')](db[_0x149c('0x44')],{'as':_0x149c('0x15f'),'onDelete':'cascade'});db[_0x149c('0x46')][_0x149c('0xff')](db[_0x149c('0x14d')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x149c('0x46')][_0x149c('0xff')](db[_0x149c('0x77')],{'as':_0x149c('0x14e'),'foreignKey':_0x149c('0x160')});db['FaxAccount'][_0x149c('0xff')](db[_0x149c('0x4a')],{'as':_0x149c('0x14f')});db[_0x149c('0x46')][_0x149c('0xff')](db['FaxApplication'],{'as':_0x149c('0x130')});db[_0x149c('0x46')][_0x149c('0xff')](db['VoiceExtension'],{'as':_0x149c('0x161'),'onDelete':_0x149c('0xfe')});db[_0x149c('0x46')][_0x149c('0xff')](db[_0x149c('0x4c')],{'as':'Messages'});db[_0x149c('0x46')]['belongsTo'](db[_0x149c('0x2c')],{'as':_0x149c('0x2c')});db[_0x149c('0x46')][_0x149c('0x136')](db['CmList'],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db[_0x149c('0x46')][_0x149c('0x136')](db[_0x149c('0x13a')],{'as':_0x149c('0x162'),'foreignKey':_0x149c('0x13b')});db['FaxAccount'][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':'user_has_fax_accounts'});db[_0x149c('0x48')][_0x149c('0x136')](db[_0x149c('0x13')],{'onDelete':_0x149c('0x15b')});db[_0x149c('0x48')][_0x149c('0x136')](db[_0x149c('0x4e')],{'onDelete':_0x149c('0x15b')});db['FaxApplication'][_0x149c('0x136')](db['FaxAccount'],{'onDelete':_0x149c('0x15b')});db[_0x149c('0x48')][_0x149c('0x136')](db['Tag'],{'onDelete':_0x149c('0x15b'),'foreignKey':_0x149c('0x15c')});db[_0x149c('0x4a')][_0x149c('0xff')](db[_0x149c('0x4c')],{'as':_0x149c('0x13f'),'onDelete':_0x149c('0xfe'),'foreignKey':'FaxInteractionId'});db[_0x149c('0x4a')][_0x149c('0x136')](db['FaxAccount'],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x160')});db[_0x149c('0x4a')]['belongsTo'](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':'ContactId'});db[_0x149c('0x4a')][_0x149c('0x136')](db['User'],{'as':_0x149c('0x154'),'foreignKey':_0x149c('0x102')});db[_0x149c('0x4a')][_0x149c('0x111')](db['Tag'],{'through':_0x149c('0x163'),'as':_0x149c('0x164')});db[_0x149c('0x4a')][_0x149c('0x111')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x149c('0x165')});db[_0x149c('0x4a')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x156'),'through':_0x149c('0x166'),'foreignKey':_0x149c('0x167')});db[_0x149c('0x4c')][_0x149c('0x136')](db[_0x149c('0x13')],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x13')});db[_0x149c('0x4c')][_0x149c('0x136')](db[_0x149c('0x4a')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x149c('0x4c')][_0x149c('0x136')](db[_0x149c('0x146')],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x147')});db[_0x149c('0x4c')][_0x149c('0x136')](db['Attachment'],{'as':_0x149c('0xdf'),'foreignKey':'AttachmentId'});db[_0x149c('0x4c')][_0x149c('0x136')](db['FaxAccount'],{'as':'Account','foreignKey':_0x149c('0x160')});db['FaxQueue'][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':'UserFaxQueue'});db[_0x149c('0x4e')][_0x149c('0x111')](db[_0x149c('0xd8')],{'through':'team_has_fax_queues','as':_0x149c('0x152')});db[_0x149c('0x168')]['belongsTo'](db[_0x149c('0x46')],{});db[_0x149c('0x168')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':'ListId'});db['FaxQueueReport']['belongsTo'](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x168')]['belongsTo'](db[_0x149c('0x4a')],{});db['FaxQueueReport'][_0x149c('0x136')](db[_0x149c('0x4c')],{});db['FaxQueueReport']['belongsTo'](db[_0x149c('0x13')],{});db[_0x149c('0x168')][_0x149c('0x136')](db[_0x149c('0x4e')],{});db[_0x149c('0x50')][_0x149c('0xff')](db[_0x149c('0x14d')],{'as':'Dispositions','foreignKey':_0x149c('0x169')});db['SmsAccount'][_0x149c('0xff')](db[_0x149c('0x77')],{'as':_0x149c('0x14e'),'foreignKey':_0x149c('0x169')});db[_0x149c('0x50')]['hasMany'](db[_0x149c('0x16a')],{'as':_0x149c('0x13f'),'foreignKey':_0x149c('0x169')});db['SmsAccount']['hasMany'](db[_0x149c('0x105')],{'as':_0x149c('0x14f')});db[_0x149c('0x50')]['hasMany'](db[_0x149c('0x52')],{'as':'Applications'});db[_0x149c('0x50')]['belongsTo'](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db[_0x149c('0x50')][_0x149c('0x136')](db[_0x149c('0x13a')],{'as':'mandatoryDispositionPause','foreignKey':_0x149c('0x13b')});db[_0x149c('0x50')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':_0x149c('0x12b')});db[_0x149c('0x52')][_0x149c('0x136')](db[_0x149c('0x13')],{'onDelete':_0x149c('0x15b')});db[_0x149c('0x52')][_0x149c('0x136')](db[_0x149c('0x54')],{'onDelete':'restrict'});db['SmsApplication'][_0x149c('0x136')](db[_0x149c('0x50')],{'onDelete':_0x149c('0x15b')});db[_0x149c('0x52')][_0x149c('0x136')](db[_0x149c('0x7a')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x149c('0x52')][_0x149c('0x136')](db[_0x149c('0x83')],{'onDelete':_0x149c('0x15b'),'foreignKey':_0x149c('0x15c')});db[_0x149c('0x105')][_0x149c('0xff')](db[_0x149c('0x16a')],{'as':_0x149c('0x13f'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x16b')});db['SmsInteraction']['belongsTo'](db[_0x149c('0x50')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x169')});db[_0x149c('0x105')][_0x149c('0x136')](db[_0x149c('0x146')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction'][_0x149c('0x136')](db[_0x149c('0x13')],{'as':_0x149c('0x154'),'foreignKey':_0x149c('0x102')});db['SmsInteraction'][_0x149c('0x111')](db['Tag'],{'through':_0x149c('0x16c'),'as':_0x149c('0x164')});db['SmsInteraction'][_0x149c('0x111')](db[_0x149c('0x83')],{'through':_0x149c('0x16c'),'as':_0x149c('0x165')});db[_0x149c('0x105')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x156'),'through':_0x149c('0x117'),'foreignKey':_0x149c('0x16b')});db[_0x149c('0x16a')][_0x149c('0x136')](db[_0x149c('0x13')],{'as':'User'});db[_0x149c('0x16a')][_0x149c('0x136')](db[_0x149c('0x146')],{'onDelete':'cascade','as':_0x149c('0x147')});db[_0x149c('0x16a')][_0x149c('0x136')](db['SmsInteraction'],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x159'),'foreignKey':_0x149c('0x16b')});db['SmsMessage'][_0x149c('0x136')](db[_0x149c('0x50')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x169')});db['SmsQueue'][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':_0x149c('0x36'),'foreignKey':_0x149c('0x16d')});db['SmsQueue']['belongsToMany'](db[_0x149c('0xd8')],{'through':_0x149c('0x16e'),'as':_0x149c('0x152')});db[_0x149c('0x56')]['hasMany'](db[_0x149c('0x14d')],{'as':_0x149c('0x16f'),'foreignKey':_0x149c('0x170')});db[_0x149c('0x56')][_0x149c('0xff')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x149c('0x170')});db[_0x149c('0x56')][_0x149c('0xff')](db['OpenchannelInteraction'],{'as':_0x149c('0x14f'),'foreignKey':_0x149c('0x170')});db[_0x149c('0x56')]['hasMany'](db[_0x149c('0x171')],{'as':'Messages','foreignKey':_0x149c('0x170')});db[_0x149c('0x56')]['hasMany'](db[_0x149c('0x58')],{'as':_0x149c('0x130'),'foreignKey':'OpenchannelAccountId'});db[_0x149c('0x56')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db[_0x149c('0x56')][_0x149c('0x136')](db[_0x149c('0x13a')],{'as':'mandatoryDispositionPause','foreignKey':_0x149c('0x13b')});db[_0x149c('0x56')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x149c('0x172')});db[_0x149c('0x58')]['belongsTo'](db['User'],{'onDelete':_0x149c('0x15b')});db[_0x149c('0x58')][_0x149c('0x136')](db[_0x149c('0x11f')],{'onDelete':'restrict','foreignKey':_0x149c('0x173')});db[_0x149c('0x58')]['belongsTo'](db[_0x149c('0x56')],{'onDelete':_0x149c('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x149c('0x58')][_0x149c('0x136')](db[_0x149c('0x7a')],{'onDelete':_0x149c('0x15b'),'foreignKey':_0x149c('0x139')});db[_0x149c('0x58')][_0x149c('0x136')](db['Tag'],{'onDelete':_0x149c('0x15b'),'foreignKey':'TagId'});db[_0x149c('0x118')][_0x149c('0xff')](db['OpenchannelMessage'],{'as':_0x149c('0x13f'),'onDelete':_0x149c('0xfe'),'foreignKey':'OpenchannelInteractionId'});db[_0x149c('0x118')]['belongsTo'](db[_0x149c('0x56')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x170')});db[_0x149c('0x118')][_0x149c('0x136')](db['CmContact'],{'as':_0x149c('0x147'),'foreignKey':'ContactId'});db[_0x149c('0x118')][_0x149c('0x136')](db['User'],{'as':_0x149c('0x154'),'foreignKey':'UserId'});db[_0x149c('0x118')]['belongsToMany'](db['Tag'],{'through':_0x149c('0x174'),'as':'Tags'});db[_0x149c('0x118')][_0x149c('0x111')](db[_0x149c('0x83')],{'through':_0x149c('0x174'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x156'),'through':_0x149c('0x119'),'foreignKey':_0x149c('0x175')});db[_0x149c('0x171')][_0x149c('0x136')](db[_0x149c('0x13')],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x13')});db[_0x149c('0x171')]['belongsTo'](db[_0x149c('0x146')],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x147')});db[_0x149c('0x171')][_0x149c('0x136')](db[_0x149c('0x118')],{'onDelete':'cascade','as':_0x149c('0x159'),'foreignKey':_0x149c('0x175')});db['OpenchannelMessage']['belongsTo'](db['Attachment'],{'as':_0x149c('0xdf'),'foreignKey':_0x149c('0x176')});db[_0x149c('0x171')]['belongsTo'](db[_0x149c('0x56')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x170')});db['OpenchannelQueue'][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':_0x149c('0x37'),'foreignKey':_0x149c('0x173')});db['OpenchannelQueue'][_0x149c('0x111')](db[_0x149c('0xd8')],{'through':_0x149c('0x177'),'as':'Teams'});db[_0x149c('0x5c')][_0x149c('0xff')](db[_0x149c('0x14d')],{'as':_0x149c('0x16f'),'foreignKey':_0x149c('0x178')});db['ChatWebsite'][_0x149c('0xff')](db[_0x149c('0x77')],{'as':'Answers','foreignKey':_0x149c('0x178')});db[_0x149c('0x5c')][_0x149c('0xff')](db[_0x149c('0x69')],{'as':_0x149c('0x179')});db['ChatWebsite'][_0x149c('0xff')](db[_0x149c('0x60')],{'as':'Interactions'});db[_0x149c('0x5c')][_0x149c('0xff')](db['ChatApplication'],{'as':_0x149c('0x130')});db[_0x149c('0x5c')]['hasMany'](db[_0x149c('0x62')],{'as':_0x149c('0x13f')});db[_0x149c('0x5c')]['belongsTo'](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db[_0x149c('0x5c')][_0x149c('0x136')](db[_0x149c('0x7a')],{'as':_0x149c('0x7a'),'foreignKey':_0x149c('0x139')});db[_0x149c('0x5c')][_0x149c('0x136')](db[_0x149c('0x127')],{'as':_0x149c('0x127'),'foreignKey':_0x149c('0x149')});db['ChatWebsite'][_0x149c('0x136')](db[_0x149c('0x13a')],{'as':'mandatoryDispositionPause','foreignKey':_0x149c('0x13b')});db[_0x149c('0x5c')][_0x149c('0x111')](db['User'],{'as':_0x149c('0x13c'),'through':_0x149c('0x125')});db['OpenchannelQueueReport'][_0x149c('0x136')](db['OpenchannelAccount'],{});db[_0x149c('0x5d')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db['OpenchannelQueueReport'][_0x149c('0x136')](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db['OpenchannelQueueReport'][_0x149c('0x136')](db[_0x149c('0x118')],{});db[_0x149c('0x5d')][_0x149c('0x136')](db[_0x149c('0x171')],{});db[_0x149c('0x5d')][_0x149c('0x136')](db['User'],{});db[_0x149c('0x5d')][_0x149c('0x136')](db['OpenchannelQueue'],{});db[_0x149c('0x5e')][_0x149c('0x136')](db[_0x149c('0x13')],{'as':_0x149c('0x17a'),'foreignKey':_0x149c('0x102'),'onDelete':'restrict'});db[_0x149c('0x5e')][_0x149c('0x136')](db[_0x149c('0x66')],{'as':_0x149c('0x17b'),'foreignKey':_0x149c('0x17c'),'onDelete':'restrict'});db[_0x149c('0x5e')][_0x149c('0x136')](db[_0x149c('0x5c')],{'as':_0x149c('0x17d'),'foreignKey':'ChatWebsiteId','onDelete':_0x149c('0x15b')});db[_0x149c('0x5e')][_0x149c('0x136')](db[_0x149c('0x83')],{'onDelete':_0x149c('0x15b'),'foreignKey':_0x149c('0x15c')});db[_0x149c('0x60')][_0x149c('0xff')](db[_0x149c('0x62')],{'as':'Messages','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x17e')});db[_0x149c('0x60')][_0x149c('0x136')](db[_0x149c('0x5c')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x178')});db[_0x149c('0x60')][_0x149c('0x136')](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x60')][_0x149c('0x136')](db['User'],{'as':'Owner','foreignKey':_0x149c('0x102')});db[_0x149c('0x60')][_0x149c('0x111')](db[_0x149c('0x83')],{'through':_0x149c('0x17f'),'as':_0x149c('0x164')});db[_0x149c('0x60')]['belongsToMany'](db[_0x149c('0x83')],{'through':_0x149c('0x17f'),'as':'ThroughTags'});db[_0x149c('0x60')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':'Users','through':_0x149c('0x116'),'foreignKey':'ChatInteractionId'});db[_0x149c('0x62')]['belongsTo'](db['User'],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x13')});db[_0x149c('0x62')][_0x149c('0x136')](db['CmContact'],{'onDelete':_0x149c('0xfe'),'as':'Contact','foreignKey':'ContactId'});db['ChatMessage'][_0x149c('0x136')](db[_0x149c('0x60')],{'onDelete':_0x149c('0xfe'),'as':'Interaction','foreignKey':_0x149c('0x17e')});db[_0x149c('0x62')]['belongsTo'](db[_0x149c('0xdf')],{'as':'Attachment','foreignKey':_0x149c('0x176')});db[_0x149c('0x62')][_0x149c('0x136')](db[_0x149c('0x5c')],{'as':_0x149c('0x15a'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage']['belongsTo'](db[_0x149c('0x146')],{'onDelete':'cascade','as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x64')][_0x149c('0x136')](db[_0x149c('0x5c')],{'as':'Account','foreignKey':_0x149c('0x178')});db[_0x149c('0x66')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':'UserChatQueue','hooks':!![]});db[_0x149c('0x66')][_0x149c('0x111')](db[_0x149c('0xd8')],{'through':_0x149c('0x180'),'as':_0x149c('0x152')});db[_0x149c('0x68')][_0x149c('0xff')](db['ChatInternalMessage'],{'as':_0x149c('0x13f'),'foreignKey':_0x149c('0x181'),'onDelete':_0x149c('0xfe')});db[_0x149c('0x68')]['belongsToMany'](db[_0x149c('0x13')],{'as':_0x149c('0x182'),'through':'chat_group_has_users'});db[_0x149c('0x69')]['belongsTo'](db['ChatWebsite'],{'as':_0x149c('0x17d'),'foreignKey':_0x149c('0x178')});db[_0x149c('0x183')]['hasMany'](db[_0x149c('0x146')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x184')],{'as':_0x149c('0x133'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x6d')],{'as':_0x149c('0x185'),'foreignKey':'ContactId'});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x6f')],{'as':_0x149c('0x186'),'foreignKey':'ContactId'});db['CmContact'][_0x149c('0xff')](db[_0x149c('0x71')],{'as':_0x149c('0x71'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x135')],{'as':_0x149c('0x187'),'foreignKey':_0x149c('0x148')});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x118')],{'as':_0x149c('0x103'),'foreignKey':'ContactId','onDelete':_0x149c('0x15b')});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x60')],{'as':_0x149c('0x104'),'foreignKey':_0x149c('0x148'),'onDelete':_0x149c('0x15b')});db[_0x149c('0x146')]['hasMany'](db[_0x149c('0x105')],{'as':_0x149c('0x106'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x4a')],{'as':_0x149c('0x107'),'foreignKey':_0x149c('0x148'),'onDelete':_0x149c('0x15b')});db[_0x149c('0x146')][_0x149c('0xff')](db[_0x149c('0x108')],{'as':_0x149c('0x109'),'foreignKey':_0x149c('0x148'),'onDelete':_0x149c('0x15b')});db[_0x149c('0x146')][_0x149c('0x136')](db[_0x149c('0x183')],{'as':_0x149c('0x188'),'foreignKey':_0x149c('0x189')});db[_0x149c('0x146')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':'List','foreignKey':_0x149c('0x150'),'onDelete':_0x149c('0xfe')});db[_0x149c('0x146')]['belongsToMany'](db[_0x149c('0x13')],{'as':_0x149c('0x156'),'through':_0x149c('0x110')});db[_0x149c('0x146')]['belongsToMany'](db[_0x149c('0x83')],{'as':_0x149c('0x164'),'through':'cm_contact_has_tags'});db['CmContact'][_0x149c('0x111')](db[_0x149c('0x83')],{'through':_0x149c('0x18a'),'as':_0x149c('0x165')});db['CmHopper']['belongsTo'](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':'ContactId','onDelete':_0x149c('0xfe')});db[_0x149c('0x184')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150'),'onDelete':'cascade'});db[_0x149c('0x184')]['belongsTo'](db[_0x149c('0x13')],{'as':_0x149c('0x17a'),'foreignKey':_0x149c('0x102')});db['CmHopper']['belongsTo'](db[_0x149c('0x1d')],{'as':_0x149c('0x17b'),'foreignKey':_0x149c('0x132'),'onDelete':'cascade'});db[_0x149c('0x184')][_0x149c('0x136')](db[_0x149c('0xdc')],{'as':'Campaign','foreignKey':_0x149c('0x18b'),'onDelete':_0x149c('0xfe')});db[_0x149c('0x184')][_0x149c('0x136')](db['User'],{'as':'Owner','foreignKey':_0x149c('0x18c')});db['CmHopperBlack'][_0x149c('0x136')](db['CmContact'],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148'),'onDelete':'cascade'});db[_0x149c('0x6c')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150'),'onDelete':_0x149c('0xfe')});db['CmHopperBlack']['belongsTo'](db[_0x149c('0x1d')],{'as':'Queue','foreignKey':_0x149c('0x132'),'onDelete':_0x149c('0xfe')});db[_0x149c('0x6c')][_0x149c('0x136')](db[_0x149c('0xdc')],{'as':'Campaign','foreignKey':_0x149c('0x18b'),'onDelete':'cascade'});db[_0x149c('0x75')][_0x149c('0xff')](db[_0x149c('0x18d')],{'as':{'plural':_0x149c('0x18e'),'singular':_0x149c('0x18f')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x149c('0x75')][_0x149c('0xff')](db[_0x149c('0x18d')],{'as':{'plural':'Any','singular':_0x149c('0x190')},'foreignKey':_0x149c('0x191'),'onDelete':_0x149c('0xfe'),'hooks':!![]});db[_0x149c('0x75')][_0x149c('0xff')](db['Action'],{'as':_0x149c('0x192'),'foreignKey':_0x149c('0x193'),'onDelete':'cascade','hooks':!![]});db[_0x149c('0x14d')][_0x149c('0xff')](db[_0x149c('0x14d')],{'as':_0x149c('0x16f'),'foreignKey':_0x149c('0x194'),'onDelete':_0x149c('0xfe')});db[_0x149c('0x7a')][_0x149c('0xff')](db['Interval'],{'as':_0x149c('0x195'),'foreignKey':_0x149c('0x139'),'onDelete':_0x149c('0xfe'),'hooks':!![],'required':![]});db['Interval'][_0x149c('0xff')](db[_0x149c('0x1a')],{'as':_0x149c('0x196'),'foreignKey':_0x149c('0x139'),'onDelete':_0x149c('0x15b')});db[_0x149c('0x7a')][_0x149c('0xff')](db[_0x149c('0x42')],{'as':_0x149c('0x197'),'foreignKey':'IntervalId'});db['Interval'][_0x149c('0xff')](db[_0x149c('0x5e')],{'as':_0x149c('0x198'),'foreignKey':_0x149c('0x139')});db[_0x149c('0x7a')][_0x149c('0xff')](db[_0x149c('0x48')],{'as':'FaxApplications','foreignKey':_0x149c('0x139')});db[_0x149c('0x7a')][_0x149c('0xff')](db['SmsApplication'],{'as':_0x149c('0x199'),'foreignKey':'IntervalId'});db['Schedule'][_0x149c('0x136')](db['MailAccount'],{});db['Schedule'][_0x149c('0x136')](db[_0x149c('0x8d')],{'foreignKey':_0x149c('0x19a')});db[_0x149c('0x80')][_0x149c('0x136')](db[_0x149c('0x8b')],{'foreignKey':_0x149c('0x19b')});db[_0x149c('0x81')]['belongsToMany'](db[_0x149c('0x19c')],{'as':_0x149c('0x19d'),'through':'moh_has_sounds','onDelete':_0x149c('0x15b')});db['Tag']['belongsToMany'](db[_0x149c('0x146')],{'through':_0x149c('0x18a')});db[_0x149c('0x83')][_0x149c('0x111')](db['ChatInteraction'],{'through':_0x149c('0x17f')});db[_0x149c('0x83')][_0x149c('0x111')](db[_0x149c('0x108')],{'through':_0x149c('0x155')});db[_0x149c('0x83')]['belongsToMany'](db[_0x149c('0x105')],{'through':_0x149c('0x16c')});db[_0x149c('0x83')][_0x149c('0x111')](db['FaxInteraction'],{'through':_0x149c('0x163')});db[_0x149c('0x83')][_0x149c('0x111')](db[_0x149c('0x118')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x149c('0x111')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db['Trigger']['hasMany'](db[_0x149c('0x18d')],{'as':{'plural':_0x149c('0x19e'),'singular':'AllCondition'},'foreignKey':_0x149c('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0x149c('0x86')][_0x149c('0xff')](db[_0x149c('0x18d')],{'as':{'plural':_0x149c('0x1a0'),'singular':_0x149c('0x1a1')},'foreignKey':'TriggerAnyId','onDelete':_0x149c('0xfe'),'hooks':!![]});db[_0x149c('0x86')][_0x149c('0xff')](db['Action'],{'as':_0x149c('0x192'),'foreignKey':_0x149c('0x1a2'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x149c('0xff')](db[_0x149c('0x92')],{'as':_0x149c('0x1a3'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x19b'),'hooks':!![]});db['AnalyticDefaultReport'][_0x149c('0xff')](db[_0x149c('0x92')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x149c('0x19a')});db['AnalyticMetric'][_0x149c('0xff')](db['AnalyticFieldReport'],{'as':_0x149c('0x1a3'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1a4')});db[_0x149c('0x92')]['belongsTo'](db[_0x149c('0x90')],{'foreignKey':_0x149c('0x1a4')});db[_0x149c('0x1a5')][_0x149c('0xff')](db[_0x149c('0x96')],{'as':_0x149c('0x1a6'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0x96')][_0x149c('0xff')](db[_0x149c('0x1a8')],{'as':_0x149c('0x1a9'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1aa')});db['SalesforceConfiguration'][_0x149c('0xff')](db[_0x149c('0x1a8')],{'as':_0x149c('0x1ab'),'onDelete':'cascade','foreignKey':_0x149c('0x1ac')});db[_0x149c('0x96')]['hasMany'](db[_0x149c('0x1a8')],{'as':'Fields','onDelete':_0x149c('0xfe'),'foreignKey':'FieldId'});db[_0x149c('0x96')][_0x149c('0x136')](db[_0x149c('0x1a5')],{'as':'Account','foreignKey':_0x149c('0x1a7')});db[_0x149c('0x1a8')][_0x149c('0xff')](db['SalesforceField'],{'as':_0x149c('0x1ad'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0x1a8')][_0x149c('0xff')](db[_0x149c('0x1a8')],{'as':_0x149c('0x1ae'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0x1a8')]['hasMany'](db[_0x149c('0x1a8')],{'as':_0x149c('0x1af'),'foreignKey':'FieldId'});db[_0x149c('0x1a8')][_0x149c('0x136')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x149c('0x99')]['hasMany'](db[_0x149c('0x9b')],{'as':_0x149c('0x1a6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x149c('0x9b')][_0x149c('0xff')](db['SugarcrmField'],{'as':_0x149c('0x1a9'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0x9b')][_0x149c('0xff')](db[_0x149c('0x1b0')],{'as':'Descriptions','onDelete':_0x149c('0xfe'),'foreignKey':'DescriptionId'});db[_0x149c('0x9b')][_0x149c('0xff')](db[_0x149c('0x1b0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x149c('0x1b1')});db[_0x149c('0x9b')][_0x149c('0x136')](db[_0x149c('0x99')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0x1b0')]['hasMany'](db[_0x149c('0x1b0')],{'as':_0x149c('0x1ad'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0x1b0')]['hasMany'](db[_0x149c('0x1b0')],{'as':_0x149c('0x1ae'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0x1b0')]['hasMany'](db[_0x149c('0x1b0')],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0x1b0')][_0x149c('0x136')](db[_0x149c('0x1b2')],{'as':_0x149c('0x1b2'),'foreignKey':_0x149c('0x1b3')});db[_0x149c('0x1b4')]['hasMany'](db[_0x149c('0x1b5')],{'as':_0x149c('0x1a6'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0x1b5')][_0x149c('0xff')](db['DeskField'],{'as':'Subjects','onDelete':_0x149c('0xfe'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x149c('0xff')](db[_0x149c('0x9f')],{'as':_0x149c('0x1ab'),'onDelete':'cascade','foreignKey':_0x149c('0x1ac')});db[_0x149c('0x1b5')][_0x149c('0xff')](db['DeskField'],{'as':_0x149c('0x1a3'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0x1b5')][_0x149c('0x136')](db[_0x149c('0x1b4')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0x1b5')]['belongsToMany'](db[_0x149c('0x83')],{'through':_0x149c('0x1b6')});db[_0x149c('0x9f')][_0x149c('0xff')](db['DeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x149c('0x9f')][_0x149c('0xff')](db[_0x149c('0x9f')],{'as':_0x149c('0x1ae'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0x9f')][_0x149c('0xff')](db[_0x149c('0x9f')],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0x9f')]['belongsTo'](db[_0x149c('0x1b2')],{'as':_0x149c('0x1b2'),'foreignKey':_0x149c('0x1b3')});db[_0x149c('0xa1')][_0x149c('0xff')](db[_0x149c('0xa3')],{'as':_0x149c('0x1a6'),'onDelete':'cascade','foreignKey':_0x149c('0x1a7')});db[_0x149c('0xa3')][_0x149c('0xff')](db[_0x149c('0xa4')],{'as':'Subjects','onDelete':_0x149c('0xfe'),'foreignKey':'SubjectId'});db[_0x149c('0xa3')][_0x149c('0xff')](db['ZohoField'],{'as':_0x149c('0x1ab'),'onDelete':'cascade','foreignKey':_0x149c('0x1ac')});db[_0x149c('0xa3')][_0x149c('0xff')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x149c('0x1b1')});db[_0x149c('0xa3')]['belongsTo'](db[_0x149c('0xa1')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0xa4')]['hasMany'](db[_0x149c('0xa4')],{'as':_0x149c('0x1ad'),'foreignKey':'SubjectId'});db[_0x149c('0xa4')]['hasMany'](db['ZohoField'],{'as':_0x149c('0x1ae'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x149c('0xff')](db[_0x149c('0xa4')],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xa4')][_0x149c('0x136')](db[_0x149c('0x1b2')],{'as':'Variable','foreignKey':'VariableId'});db[_0x149c('0xa5')]['hasMany'](db[_0x149c('0xa6')],{'as':_0x149c('0x1a6'),'onDelete':'cascade','foreignKey':_0x149c('0x1a7')});db[_0x149c('0xa6')][_0x149c('0xff')](db[_0x149c('0xa8')],{'as':'Subjects','foreignKey':_0x149c('0x1aa')});db[_0x149c('0xa6')][_0x149c('0xff')](db[_0x149c('0xa8')],{'as':_0x149c('0x1ab'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0xa6')]['hasMany'](db['ZendeskField'],{'as':_0x149c('0x1a3'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xa6')][_0x149c('0x136')](db[_0x149c('0xa5')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db['ZendeskConfiguration']['belongsToMany'](db[_0x149c('0x83')],{'through':_0x149c('0x1b7')});db[_0x149c('0xa8')][_0x149c('0xff')](db[_0x149c('0xa8')],{'as':'Subject','foreignKey':_0x149c('0x1aa')});db[_0x149c('0xa8')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0x149c('0x1ac')});db[_0x149c('0xa8')]['hasMany'](db[_0x149c('0xa8')],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xa8')][_0x149c('0x136')](db[_0x149c('0x1b2')],{'as':_0x149c('0x1b2'),'foreignKey':_0x149c('0x1b3')});db[_0x149c('0xaa')]['hasMany'](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0x1b8')][_0x149c('0xff')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0x1b8')][_0x149c('0xff')](db['FreshdeskField'],{'as':_0x149c('0x1ab'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0x1b8')]['hasMany'](db[_0x149c('0xad')],{'as':_0x149c('0x1a3'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0x1b8')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0x1b8')][_0x149c('0x111')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField']['hasMany'](db[_0x149c('0xad')],{'as':_0x149c('0x1ad'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0xad')]['hasMany'](db['FreshdeskField'],{'as':_0x149c('0x1ae'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0xad')]['hasMany'](db[_0x149c('0xad')],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xad')][_0x149c('0x136')](db[_0x149c('0x1b2')],{'as':'Variable','foreignKey':'VariableId'});db[_0x149c('0xaf')][_0x149c('0xff')](db[_0x149c('0xb1')],{'as':_0x149c('0x1a6'),'onDelete':'cascade','foreignKey':_0x149c('0x1a7')});db['VtigerConfiguration'][_0x149c('0xff')](db[_0x149c('0x1b9')],{'as':_0x149c('0x1a9'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0xb1')][_0x149c('0xff')](db[_0x149c('0x1b9')],{'as':_0x149c('0x1ab'),'foreignKey':_0x149c('0x1ac')});db['VtigerConfiguration'][_0x149c('0xff')](db[_0x149c('0x1b9')],{'as':_0x149c('0x1a3'),'foreignKey':_0x149c('0x1b1')});db['VtigerConfiguration'][_0x149c('0x136')](db[_0x149c('0xaf')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0x1b9')][_0x149c('0xff')](db[_0x149c('0x1b9')],{'as':'Subject','foreignKey':_0x149c('0x1aa')});db[_0x149c('0x1b9')][_0x149c('0xff')](db['VtigerField'],{'as':_0x149c('0x1ae'),'foreignKey':_0x149c('0x1ac')});db['VtigerField'][_0x149c('0xff')](db[_0x149c('0x1b9')],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0x1b9')][_0x149c('0x136')](db[_0x149c('0x1b2')],{'as':_0x149c('0x1b2'),'foreignKey':_0x149c('0x1b3')});db[_0x149c('0x1ba')][_0x149c('0xff')](db[_0x149c('0xb5')],{'as':'Configurations','onDelete':_0x149c('0xfe'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x149c('0xff')](db[_0x149c('0xb6')],{'as':_0x149c('0x1a9'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0xb5')][_0x149c('0xff')](db[_0x149c('0xb6')],{'as':_0x149c('0x1ab'),'foreignKey':'DescriptionId'});db[_0x149c('0xb5')][_0x149c('0xff')](db[_0x149c('0xb6')],{'as':_0x149c('0x1a3'),'foreignKey':'FieldId'});db[_0x149c('0xb5')][_0x149c('0x136')](db[_0x149c('0x1ba')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db['ServicenowField']['hasMany'](db[_0x149c('0xb6')],{'as':_0x149c('0x1ad'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x149c('0xff')](db['ServicenowField'],{'as':_0x149c('0x1ae'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0xb6')][_0x149c('0xff')](db['ServicenowField'],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xb6')]['belongsTo'](db[_0x149c('0x1b2')],{'as':'Variable','foreignKey':'VariableId'});db[_0x149c('0xb7')][_0x149c('0xff')](db[_0x149c('0xb9')],{'as':'Configurations','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0xb9')][_0x149c('0xff')](db[_0x149c('0xbb')],{'as':_0x149c('0x1a9'),'onDelete':'cascade','foreignKey':_0x149c('0x1aa')});db[_0x149c('0xb9')]['hasMany'](db[_0x149c('0xbb')],{'as':'Descriptions','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1ac')});db[_0x149c('0xb9')][_0x149c('0xff')](db[_0x149c('0xbb')],{'as':_0x149c('0x1a3'),'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xb9')][_0x149c('0x136')](db[_0x149c('0xb7')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0xbb')][_0x149c('0xff')](db[_0x149c('0xbb')],{'as':'Subject','foreignKey':_0x149c('0x1aa')});db[_0x149c('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x149c('0x1ac')});db[_0x149c('0xbb')]['hasMany'](db[_0x149c('0xbb')],{'as':_0x149c('0x1af'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xbb')]['belongsTo'](db['Variable'],{'as':_0x149c('0x1b2'),'foreignKey':_0x149c('0x1b3')});db[_0x149c('0xbd')]['hasMany'](db[_0x149c('0xbf')],{'as':'Configurations','onDelete':_0x149c('0xfe'),'foreignKey':'AccountId'});db[_0x149c('0xbf')]['hasMany'](db[_0x149c('0xc1')],{'as':_0x149c('0x1a9'),'foreignKey':_0x149c('0x1aa')});db[_0x149c('0xbf')][_0x149c('0xff')](db[_0x149c('0xc1')],{'as':_0x149c('0x1ab'),'foreignKey':_0x149c('0x1ac')});db['FreshsalesConfiguration']['hasMany'](db[_0x149c('0xc1')],{'as':_0x149c('0x1a3'),'foreignKey':_0x149c('0x1b1')});db[_0x149c('0xbf')][_0x149c('0x136')](db[_0x149c('0xbd')],{'as':_0x149c('0x15a'),'foreignKey':_0x149c('0x1a7')});db[_0x149c('0xc1')]['hasMany'](db[_0x149c('0xc1')],{'as':_0x149c('0x1ad'),'foreignKey':'SubjectId'});db['FreshsalesField']['hasMany'](db[_0x149c('0xc1')],{'as':_0x149c('0x1ae'),'foreignKey':'DescriptionId'});db[_0x149c('0xc1')]['hasMany'](db[_0x149c('0xc1')],{'as':_0x149c('0x1af'),'foreignKey':'FieldId'});db[_0x149c('0xc1')][_0x149c('0x136')](db[_0x149c('0x1b2')],{'as':_0x149c('0x1b2'),'foreignKey':'VariableId'});db[_0x149c('0x1bb')][_0x149c('0x136')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db[_0x149c('0x1bb')]['belongsTo'](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':'ContactId'});db[_0x149c('0x1bb')][_0x149c('0x136')](db[_0x149c('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x149c('0x62')],{});db[_0x149c('0x1bb')][_0x149c('0x136')](db[_0x149c('0x13')],{});db[_0x149c('0x1bb')]['belongsTo'](db[_0x149c('0x66')],{});db['ChatInternalMessage']['belongsTo'](db[_0x149c('0x13')],{'onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1bc')});db['ChatInternalMessage'][_0x149c('0x136')](db[_0x149c('0x13')],{'onDelete':'cascade','foreignKey':_0x149c('0x1bd')});db[_0x149c('0x135')][_0x149c('0xff')](db[_0x149c('0xca')],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport']['hasMany'](db[_0x149c('0xc8')],{'foreignKey':'SessionId','onDelete':_0x149c('0xfe')});db[_0x149c('0xcd')]['belongsTo'](db['SmsAccount'],{});db[_0x149c('0xcd')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':'ListId'});db[_0x149c('0xcd')]['belongsTo'](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':_0x149c('0x148')});db[_0x149c('0xcd')][_0x149c('0x136')](db[_0x149c('0x105')],{});db[_0x149c('0xcd')]['belongsTo'](db['SmsMessage'],{});db[_0x149c('0xcd')]['belongsTo'](db['User'],{});db['SmsQueueReport'][_0x149c('0x136')](db[_0x149c('0x54')],{});db[_0x149c('0x1be')][_0x149c('0xff')](db[_0x149c('0x135')],{'foreignKey':_0x149c('0x1bf')});db[_0x149c('0x1be')]['hasMany'](db[_0x149c('0xca')],{'foreignKey':_0x149c('0x1bf')});db['JscriptyProject'][_0x149c('0xff')](db[_0x149c('0xc8')],{'foreignKey':'ProjectId'});db['SquareProject'][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x156'),'through':_0x149c('0x12e')});db[_0x149c('0xd8')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':'Agents','through':_0x149c('0x114')});db[_0x149c('0xd8')]['belongsToMany'](db[_0x149c('0x1d')],{'through':_0x149c('0x13d'),'as':_0x149c('0x11b')});db['Team'][_0x149c('0x111')](db[_0x149c('0x11c')],{'through':_0x149c('0x151'),'as':_0x149c('0x1c0')});db[_0x149c('0xd8')][_0x149c('0x111')](db[_0x149c('0x66')],{'through':_0x149c('0x180'),'as':_0x149c('0x1c1')});db['Team'][_0x149c('0x111')](db[_0x149c('0x4e')],{'through':'team_has_fax_queues','as':_0x149c('0x11d')});db[_0x149c('0xd8')]['belongsToMany'](db[_0x149c('0x54')],{'through':_0x149c('0x16e'),'as':'SmsQueues'});db[_0x149c('0xd8')]['belongsToMany'](db[_0x149c('0x11f')],{'through':_0x149c('0x177'),'as':_0x149c('0x120')});db[_0x149c('0xd8')]['belongsToMany'](db[_0x149c('0xf9')],{'through':'team_has_whatsapp_queues','as':_0x149c('0x121')});db[_0x149c('0xdc')][_0x149c('0xff')](db[_0x149c('0x184')],{'as':'Hoppers','foreignKey':_0x149c('0x18b')});db[_0x149c('0xdc')][_0x149c('0xff')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x149c('0x18b')});db[_0x149c('0xdc')]['hasMany'](db[_0x149c('0x6f')],{'as':_0x149c('0x186'),'foreignKey':_0x149c('0x18b')});db[_0x149c('0xdc')]['hasMany'](db[_0x149c('0x6c')],{'as':_0x149c('0x134'),'foreignKey':_0x149c('0x18b')});db['Campaign'][_0x149c('0x136')](db[_0x149c('0x2c')],{'as':_0x149c('0x2c'),'foreignKey':_0x149c('0x137')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x149c('0x1c2'),'foreignKey':_0x149c('0x138')});db[_0x149c('0xdc')][_0x149c('0x136')](db[_0x149c('0x7a')],{'as':_0x149c('0x7a'),'foreignKey':'IntervalId'});db['Campaign'][_0x149c('0x136')](db[_0x149c('0x1c3')],{'as':_0x149c('0x1c3'),'foreignKey':_0x149c('0x1c4')});db['Campaign']['belongsToMany'](db[_0x149c('0xeb')],{'as':'Lists','through':_0x149c('0x1c5')});db[_0x149c('0xdc')][_0x149c('0x111')](db[_0x149c('0xeb')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x149c('0xe2')][_0x149c('0x136')](db[_0x149c('0x153')],{});db['MailTransferReport'][_0x149c('0x136')](db[_0x149c('0x108')],{});db['MailTransferReport']['belongsTo'](db[_0x149c('0x127')],{'foreignKey':'FromMailAccountId','as':_0x149c('0x1c6')});db['MailTransferReport'][_0x149c('0x136')](db[_0x149c('0x13')],{'foreignKey':_0x149c('0x1c7'),'as':_0x149c('0x1c8')});db[_0x149c('0xe2')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x149c('0x1c9')});db['MailTransferReport'][_0x149c('0x136')](db[_0x149c('0x11c')],{'foreignKey':_0x149c('0x1ca'),'as':_0x149c('0x1cb')});db['MailTransferReport']['belongsTo'](db[_0x149c('0x127')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x149c('0x1cc')]['belongsTo'](db[_0x149c('0x62')],{});db[_0x149c('0x1cc')]['belongsTo'](db[_0x149c('0x60')],{});db[_0x149c('0x1cc')]['belongsTo'](db[_0x149c('0x5c')],{'foreignKey':_0x149c('0x1cd'),'as':_0x149c('0x1c6')});db[_0x149c('0x1cc')][_0x149c('0x136')](db[_0x149c('0x13')],{'foreignKey':_0x149c('0x1c7'),'as':_0x149c('0x1c8')});db['ChatTransferReport'][_0x149c('0x136')](db[_0x149c('0x13')],{'foreignKey':_0x149c('0x1ce'),'as':_0x149c('0x1c9')});db[_0x149c('0x1cc')][_0x149c('0x136')](db[_0x149c('0x66')],{'foreignKey':_0x149c('0x1cf'),'as':'ToQueue'});db[_0x149c('0x1cc')][_0x149c('0x136')](db[_0x149c('0x5c')],{'foreignKey':_0x149c('0x1d0'),'as':_0x149c('0x1d1')});db[_0x149c('0xe5')][_0x149c('0x136')](db[_0x149c('0x4c')],{});db[_0x149c('0xe5')][_0x149c('0x136')](db[_0x149c('0x4a')],{});db[_0x149c('0xe5')][_0x149c('0x136')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x149c('0xe5')][_0x149c('0x136')](db[_0x149c('0x13')],{'foreignKey':_0x149c('0x1c7'),'as':_0x149c('0x1c8')});db[_0x149c('0xe5')][_0x149c('0x136')](db[_0x149c('0x13')],{'foreignKey':_0x149c('0x1ce'),'as':_0x149c('0x1c9')});db[_0x149c('0xe5')][_0x149c('0x136')](db[_0x149c('0x4e')],{'foreignKey':_0x149c('0x1d2'),'as':_0x149c('0x1cb')});db[_0x149c('0xe5')][_0x149c('0x136')](db[_0x149c('0x46')],{'foreignKey':_0x149c('0x1d3'),'as':_0x149c('0x1d1')});db[_0x149c('0xe7')][_0x149c('0x136')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x149c('0x136')](db[_0x149c('0x118')],{});db['OpenchannelTransferReport'][_0x149c('0x136')](db['OpenchannelAccount'],{'foreignKey':_0x149c('0x1d4'),'as':'FromAccount'});db[_0x149c('0xe7')]['belongsTo'](db[_0x149c('0x13')],{'foreignKey':'FromUserId','as':_0x149c('0x1c8')});db[_0x149c('0xe7')][_0x149c('0x136')](db['User'],{'foreignKey':_0x149c('0x1ce'),'as':_0x149c('0x1c9')});db['OpenchannelTransferReport'][_0x149c('0x136')](db[_0x149c('0x11f')],{'foreignKey':_0x149c('0x1d5'),'as':_0x149c('0x1cb')});db[_0x149c('0xe7')][_0x149c('0x136')](db[_0x149c('0x56')],{'foreignKey':_0x149c('0x1d6'),'as':'ToAccount'});db[_0x149c('0xe9')][_0x149c('0x136')](db[_0x149c('0x16a')],{});db[_0x149c('0xe9')][_0x149c('0x136')](db[_0x149c('0x105')],{});db[_0x149c('0xe9')][_0x149c('0x136')](db[_0x149c('0x50')],{'foreignKey':_0x149c('0x1d7'),'as':_0x149c('0x1c6')});db[_0x149c('0xe9')][_0x149c('0x136')](db[_0x149c('0x13')],{'foreignKey':'FromUserId','as':_0x149c('0x1c8')});db[_0x149c('0xe9')]['belongsTo'](db[_0x149c('0x13')],{'foreignKey':_0x149c('0x1ce'),'as':_0x149c('0x1c9')});db['SmsTransferReport'][_0x149c('0x136')](db[_0x149c('0x54')],{'foreignKey':_0x149c('0x1d8'),'as':_0x149c('0x1cb')});db[_0x149c('0xe9')]['belongsTo'](db[_0x149c('0x50')],{'foreignKey':'ToSmsAccountId','as':_0x149c('0x1d1')});db['CmList']['hasMany'](db[_0x149c('0x14d')],{'as':_0x149c('0x16f'),'foreignKey':'ListId'});db[_0x149c('0xeb')][_0x149c('0xff')](db[_0x149c('0x1d9')],{'as':_0x149c('0x1da'),'foreignKey':_0x149c('0x150')});db['CmList'][_0x149c('0xff')](db[_0x149c('0x146')],{'as':'Contacts','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x150')});db[_0x149c('0xeb')][_0x149c('0xff')](db[_0x149c('0x6d')],{'as':_0x149c('0x185'),'foreignKey':'ListId'});db[_0x149c('0xeb')][_0x149c('0xff')](db[_0x149c('0x6f')],{'as':_0x149c('0x1db'),'foreignKey':_0x149c('0x150')});db['CmList'][_0x149c('0xff')](db[_0x149c('0x71')],{'as':_0x149c('0x71'),'foreignKey':_0x149c('0x150')});db['CmList'][_0x149c('0x111')](db[_0x149c('0x1d')],{'as':_0x149c('0x1dc'),'through':'voice_queues_has_cm_lists'});db[_0x149c('0xeb')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':'Agents','through':_0x149c('0x113')});db[_0x149c('0x122')][_0x149c('0xff')](db['VoiceExtension'],{'as':_0x149c('0x196'),'onDelete':_0x149c('0xfe')});db['VoicePrefix']['belongsToMany'](db[_0x149c('0x13')],{'as':'Agents','through':_0x149c('0x124')});db[_0x149c('0xee')][_0x149c('0xff')](db[_0x149c('0x13')],{'as':'Users','foreignKey':_0x149c('0x1dd')});db[_0x149c('0xee')]['hasMany'](db[_0x149c('0xf0')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x149c('0xfe')});db[_0x149c('0xf0')][_0x149c('0xff')](db['UserProfileResource'],{'as':_0x149c('0x1de'),'foreignKey':'sectionId','onDelete':_0x149c('0xfe')});db[_0x149c('0xf3')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x149c('0x1df')});db['WhatsappAccount'][_0x149c('0xff')](db[_0x149c('0x77')],{'as':'Answers','foreignKey':_0x149c('0x1df')});db[_0x149c('0xf3')]['hasMany'](db['WhatsappMessage'],{'as':_0x149c('0x13f'),'foreignKey':'WhatsappAccountId'});db[_0x149c('0xf3')]['hasMany'](db['WhatsappInteraction'],{'as':_0x149c('0x14f')});db[_0x149c('0xf3')][_0x149c('0xff')](db[_0x149c('0xf5')],{'as':'Applications'});db[_0x149c('0xf3')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x149c('0x136')](db[_0x149c('0x13a')],{'as':_0x149c('0x162'),'foreignKey':_0x149c('0x13b')});db[_0x149c('0xf3')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':_0x149c('0x12c')});db[_0x149c('0xf5')][_0x149c('0x136')](db['User'],{'onDelete':_0x149c('0x15b')});db[_0x149c('0xf5')][_0x149c('0x136')](db[_0x149c('0xf9')],{'onDelete':_0x149c('0x15b')});db['WhatsappApplication'][_0x149c('0x136')](db[_0x149c('0xf3')],{'onDelete':_0x149c('0x15b')});db[_0x149c('0xf5')][_0x149c('0x136')](db[_0x149c('0x7a')],{'onDelete':_0x149c('0x15b'),'foreignKey':_0x149c('0x139')});db['WhatsappApplication']['belongsTo'](db[_0x149c('0x83')],{'onDelete':'restrict','foreignKey':_0x149c('0x15c')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x149c('0xfe'),'foreignKey':_0x149c('0x1e0')});db[_0x149c('0xf7')]['belongsTo'](db[_0x149c('0xf3')],{'as':_0x149c('0x15a'),'foreignKey':'WhatsappAccountId'});db[_0x149c('0xf7')][_0x149c('0x136')](db[_0x149c('0x146')],{'as':'Contact','foreignKey':'ContactId'});db[_0x149c('0xf7')][_0x149c('0x136')](db[_0x149c('0x13')],{'as':'Owner','foreignKey':_0x149c('0x102')});db[_0x149c('0xf7')][_0x149c('0x111')](db[_0x149c('0x83')],{'through':_0x149c('0x1e1'),'as':_0x149c('0x164')});db[_0x149c('0xf7')][_0x149c('0x111')](db[_0x149c('0x83')],{'through':'whatsapp_interaction_has_tags','as':_0x149c('0x165')});db[_0x149c('0xf7')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x156'),'through':_0x149c('0x11a'),'foreignKey':_0x149c('0x1e0')});db[_0x149c('0x1e2')][_0x149c('0x136')](db[_0x149c('0x13')],{'as':_0x149c('0x13')});db[_0x149c('0x1e2')][_0x149c('0x136')](db[_0x149c('0x146')],{'onDelete':_0x149c('0xfe'),'as':_0x149c('0x147')});db[_0x149c('0x1e2')]['belongsTo'](db[_0x149c('0xf7')],{'onDelete':_0x149c('0xfe'),'as':'Interaction','foreignKey':_0x149c('0x1e0')});db[_0x149c('0x1e2')][_0x149c('0x136')](db['WhatsappAccount'],{'as':_0x149c('0x15a'),'foreignKey':'WhatsappAccountId'});db[_0x149c('0xf8')][_0x149c('0x136')](db['WhatsappAccount'],{});db[_0x149c('0xf8')][_0x149c('0x136')](db[_0x149c('0xeb')],{'as':_0x149c('0x15e'),'foreignKey':_0x149c('0x150')});db[_0x149c('0xf8')][_0x149c('0x136')](db[_0x149c('0x146')],{'as':_0x149c('0x147'),'foreignKey':'ContactId'});db[_0x149c('0xf8')][_0x149c('0x136')](db['WhatsappInteraction'],{});db[_0x149c('0xf8')][_0x149c('0x136')](db[_0x149c('0xf9')],{});db[_0x149c('0xf8')][_0x149c('0x136')](db[_0x149c('0x1e2')],{});db[_0x149c('0xf8')][_0x149c('0x136')](db[_0x149c('0x13')],{});db[_0x149c('0x1e3')][_0x149c('0x136')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x149c('0xf7')],{});db[_0x149c('0x1e3')][_0x149c('0x136')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x149c('0x1c6')});db[_0x149c('0x1e3')][_0x149c('0x136')](db['WhatsappAccount'],{'foreignKey':_0x149c('0x1e4'),'as':_0x149c('0x1d1')});db[_0x149c('0x1e3')][_0x149c('0x136')](db[_0x149c('0xf9')],{'foreignKey':_0x149c('0x1e5'),'as':_0x149c('0x1cb')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x149c('0x1c7'),'as':_0x149c('0x1c8')});db[_0x149c('0x1e3')][_0x149c('0x136')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x149c('0xf9')][_0x149c('0x111')](db[_0x149c('0x13')],{'as':_0x149c('0x13c'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db['WhatsappQueue']['belongsToMany'](db['Team'],{'through':_0x149c('0x1e6'),'as':_0x149c('0x152')});module[_0x149c('0x1e7')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3396=['Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../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/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../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','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','User','cascade','UserId','hasMany','VoiceRecording','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceExtension','SpiedAgents','Applications','Sound','moh_has_sounds','Members','VoiceQueueId','CmHopper','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','MailServerOut','hasOne','Imap','Smtp','Dispositions','Answers','TemplateId','team_has_mail_queues','MailInteraction','Contact','Owner','Tags','ThroughTags','Users','MailInteractionId','Attachment','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','Interval','TagId','MailQueueReport','List','ListId','Disposition','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueue','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelMessage','team_has_openchannel_queues','ProactiveActions','ChatApplication','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','Hoppers','HopperHistories','ChatInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','mail_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmAccount','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','ZendeskField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','ChatQueueReport','SessionId','SmsQueueReport','ProjectId','MailQueues','FaxQueues','team_has_whatsapp_queues','SquareProject','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','lodash','jstz','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','database','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.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','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3396,0x17d));var _0x6339=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3396[_0x3bf83f];return _0x22c4a9;};'use strict';var path=require(_0x6339('0x0'));var config=require(_0x6339('0x1'));var Sequelize=require('sequelize');var _=require(_0x6339('0x2'));var jstz=require(_0x6339('0x3'));var timezone=jstz['determine']();config[_0x6339('0x4')]=_[_0x6339('0x5')](config[_0x6339('0x4')],{'database':_0x6339('0x6'),'username':_0x6339('0x7'),'password':_0x6339('0x8'),'options':{'host':_0x6339('0x9'),'port':0xcea,'dialect':_0x6339('0xa'),'dialectOptions':{'charset':_0x6339('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x6339('0xc'),'collate':_0x6339('0xd')}}});config[_0x6339('0xe')]=_[_0x6339('0x5')](config[_0x6339('0xe')],{'database':'motion2','username':'xcall','password':_0x6339('0x8'),'options':{'host':_0x6339('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6339('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x6339('0xc'),'collate':_0x6339('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x6339('0xf')],config[_0x6339('0x4')]['username'],config[_0x6339('0x4')][_0x6339('0x10')],config[_0x6339('0x4')][_0x6339('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6339('0xe')][_0x6339('0xf')],config[_0x6339('0xe')]['username'],config[_0x6339('0xe')]['password'],config[_0x6339('0xe')][_0x6339('0x11')])};db['User']=db['sequelize'][_0x6339('0x12')](_0x6339('0x13'));db[_0x6339('0x14')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x6339('0x15')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize'][_0x6339('0x12')](_0x6339('0x16'));db[_0x6339('0x17')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x18'));db[_0x6339('0x19')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x1a'));db['VoiceRecording']=db[_0x6339('0x4')]['import'](_0x6339('0x1b'));db[_0x6339('0x1c')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x1d'));db[_0x6339('0x1e')]=db['sequelize'][_0x6339('0x12')]('../api/voiceMail/voiceMail.model');db[_0x6339('0x1f')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x6339('0x20')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x21'));db['VoiceDialReport']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x22'));db[_0x6339('0x23')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x24'));db['VoiceQueueReport']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x25'));db[_0x6339('0x26')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x27'));db[_0x6339('0x28')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x29'));db['VoiceTransferReport']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x6339('0x2a')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x2b'));db[_0x6339('0x2c')]=db[_0x6339('0x4')]['import'](_0x6339('0x2d'));db[_0x6339('0x2e')]=db[_0x6339('0x4')]['import'](_0x6339('0x2f'));db[_0x6339('0x30')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x31'));db[_0x6339('0x32')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x33'));db['UserSmsQueue']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x6339('0x34')]=db[_0x6339('0x4')]['import'](_0x6339('0x35'));db[_0x6339('0x36')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x37'));db[_0x6339('0x38')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x39'));db[_0x6339('0x3a')]=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db[_0x6339('0x3b')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x3c'));db['MailSubstatus']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x3d'));db['MailInteraction']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x3e'));db[_0x6339('0x3f')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/mailMessage/mailMessage.model');db[_0x6339('0x40')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x41'));db['MailQueueReport']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/mailQueueReport/mailQueueReport.model');db[_0x6339('0x42')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x43'));db[_0x6339('0x44')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x45'));db['FaxAccount']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x46'));db[_0x6339('0x47')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x48'));db[_0x6339('0x49')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x4a'));db[_0x6339('0x4b')]=db[_0x6339('0x4')]['import']('../api/faxMessage/faxMessage.model');db[_0x6339('0x4c')]=db[_0x6339('0x4')]['import'](_0x6339('0x4d'));db[_0x6339('0x4e')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0x6339('0x4f')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x50'));db[_0x6339('0x51')]=db['sequelize']['import'](_0x6339('0x52'));db[_0x6339('0x53')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x54'));db['SmsMessage']=db[_0x6339('0x4')]['import'](_0x6339('0x55'));db[_0x6339('0x56')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db['sequelize']['import'](_0x6339('0x57'));db['OpenchannelApplication']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x58'));db['OpenchannelMessage']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x6339('0x59')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x5a'));db[_0x6339('0x5b')]=db[_0x6339('0x4')]['import'](_0x6339('0x5c'));db['ChatApplication']=db['sequelize'][_0x6339('0x12')]('../api/chatApplication/chatApplication.model');db[_0x6339('0x5d')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x5e'));db[_0x6339('0x5f')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x60'));db[_0x6339('0x61')]=db[_0x6339('0x4')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x6339('0x62')]=db['sequelize'][_0x6339('0x12')]('../api/chatQueue/chatQueue.model');db[_0x6339('0x63')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x64'));db[_0x6339('0x65')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x66'));db[_0x6339('0x67')]=db['sequelize']['import'](_0x6339('0x68'));db[_0x6339('0x69')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x6a'));db['CmHopper']=db['sequelize'][_0x6339('0x12')](_0x6339('0x6b'));db['CmHopperBlack']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x6c'));db[_0x6339('0x6d')]=db[_0x6339('0x4')]['import'](_0x6339('0x6e'));db[_0x6339('0x6f')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x70'));db[_0x6339('0x71')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x72'));db[_0x6339('0x73')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x74'));db[_0x6339('0x75')]=db[_0x6339('0x4')]['import']('../api/action/action.model');db[_0x6339('0x76')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x77'));db[_0x6339('0x78')]=db[_0x6339('0x4')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/disposition/disposition.model');db[_0x6339('0x79')]=db['sequelize']['import'](_0x6339('0x7a'));db['Interval']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x7b'));db[_0x6339('0x7c')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x7d'));db[_0x6339('0x7e')]=db['sequelize'][_0x6339('0x12')]('../api/cdr/cdr.model');db[_0x6339('0x7f')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x6339('0x80')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x81'));db['Sound']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x82'));db[_0x6339('0x83')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/tag/tag.model');db[_0x6339('0x84')]=db['sequelize']['import'](_0x6339('0x85'));db[_0x6339('0x86')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x87'));db[_0x6339('0x88')]=db[_0x6339('0x4')]['import']('../api/variable/variable.model');db[_0x6339('0x89')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x8a'));db[_0x6339('0x8b')]=db[_0x6339('0x4')]['import'](_0x6339('0x8c'));db[_0x6339('0x8d')]=db[_0x6339('0x4')]['import'](_0x6339('0x8e'));db[_0x6339('0x8f')]=db[_0x6339('0x4')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x90'));db[_0x6339('0x91')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x92'));db[_0x6339('0x93')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x94'));db[_0x6339('0x95')]=db['sequelize'][_0x6339('0x12')](_0x6339('0x96'));db[_0x6339('0x97')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6339('0x98')]=db[_0x6339('0x4')]['import'](_0x6339('0x99'));db['SalesforceField']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x6339('0x4')]['import'](_0x6339('0x9a'));db[_0x6339('0x9b')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x6339('0x9c')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x9d'));db[_0x6339('0x9e')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x9f'));db[_0x6339('0xa0')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xa1'));db[_0x6339('0xa2')]=db[_0x6339('0x4')]['import']('../api/intDeskField/intDeskField.model');db[_0x6339('0xa3')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xa4'));db[_0x6339('0xa5')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xa6'));db['ZohoField']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xa7'));db['ZendeskAccount']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xa8'));db['ZendeskConfiguration']=db[_0x6339('0x4')]['import'](_0x6339('0xa9'));db['ZendeskField']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xaa'));db[_0x6339('0xab')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xac'));db['FreshdeskConfiguration']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xad'));db['FreshdeskField']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x6339('0xae')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xaf'));db[_0x6339('0xb0')]=db[_0x6339('0x4')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x6339('0xb1')]=db[_0x6339('0x4')]['import'](_0x6339('0xb2'));db[_0x6339('0xb3')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xb4'));db['ServicenowConfiguration']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xb5'));db[_0x6339('0xb6')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xb7'));db[_0x6339('0xb8')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x6339('0xb9')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xba'));db[_0x6339('0xbb')]=db[_0x6339('0x4')]['import'](_0x6339('0xbc'));db[_0x6339('0xbd')]=db[_0x6339('0x4')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x6339('0xbe')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xbf'));db[_0x6339('0xc0')]=db['sequelize'][_0x6339('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x6339('0x4')]['import'](_0x6339('0x8a'));db[_0x6339('0xc1')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xc2'));db['ChatQueueReport']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/chatQueueReport/chatQueueReport.model');db[_0x6339('0xc3')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xc4'));db[_0x6339('0xc5')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xc6'));db[_0x6339('0xc7')]=db['sequelize'][_0x6339('0x12')](_0x6339('0xc8'));db[_0x6339('0xc9')]=db['sequelize']['import'](_0x6339('0xca'));db['SmsQueueReport']=db[_0x6339('0x4')][_0x6339('0x12')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xcb'));db[_0x6339('0xcc')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xcd'));db[_0x6339('0xce')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xcf'));db['Setting']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xd0'));db[_0x6339('0xd1')]=db[_0x6339('0x4')]['import'](_0x6339('0xd2'));db['SquareProject']=db[_0x6339('0x4')]['import'](_0x6339('0xd3'));db[_0x6339('0xd4')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xd5'));db[_0x6339('0xd6')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xd7'));db[_0x6339('0xd8')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/team/team.model');db[_0x6339('0xd9')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xda'));db[_0x6339('0xdb')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/campaign/campaign.model');db[_0x6339('0xdc')]=db['sequelize']['import'](_0x6339('0xdd'));db['Attachment']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xde'));db[_0x6339('0xdf')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xe0'));db[_0x6339('0xe1')]=db['sequelize'][_0x6339('0x12')](_0x6339('0xe2'));db[_0x6339('0xe3')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x6339('0xe4')]=db['sequelize'][_0x6339('0x12')](_0x6339('0xe5'));db['OpenchannelTransferReport']=db['sequelize']['import'](_0x6339('0xe6'));db[_0x6339('0xe7')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xe8'));db[_0x6339('0xe9')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xea'));db[_0x6339('0xeb')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xec'));db[_0x6339('0xed')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xee'));db[_0x6339('0xef')]=db[_0x6339('0x4')][_0x6339('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x6339('0xf0')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xf1'));db[_0x6339('0xf2')]=db['sequelize'][_0x6339('0x12')](_0x6339('0xf3'));db[_0x6339('0xf4')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xf5'));db['WhatsappApplication']=db[_0x6339('0x4')]['import'](_0x6339('0xf6'));db[_0x6339('0xf7')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xf8'));db[_0x6339('0xf9')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xfa'));db[_0x6339('0xfb')]=db[_0x6339('0x4')]['import'](_0x6339('0xfc'));db[_0x6339('0xfd')]=db['sequelize'][_0x6339('0x12')](_0x6339('0xfe'));db['WhatsappQueue']=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0xff'));db[_0x6339('0x100')]=db[_0x6339('0x4')][_0x6339('0x12')](_0x6339('0x101'));db['TeamVoiceQueue']=db['sequelize']['import'](_0x6339('0x102'));db[_0x6339('0x103')]['hasOne'](db[_0x6339('0x1e')],{'as':_0x6339('0x1e'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x105')});db[_0x6339('0x103')][_0x6339('0x106')](db[_0x6339('0x107')],{'as':'Recordings','foreignKey':_0x6339('0x105')});db['User'][_0x6339('0x106')](db['UserVoiceQueueRt'],{'as':_0x6339('0x108'),'foreignKey':_0x6339('0x105')});db['User']['hasMany'](db['VoiceExtension'],{'as':_0x6339('0x109'),'onDelete':_0x6339('0x104'),'hooks':!![]});db[_0x6339('0x103')]['hasMany'](db['CmHopperFinal'],{'as':_0x6339('0x10a'),'foreignKey':_0x6339('0x105')});db[_0x6339('0x103')]['hasMany'](db[_0x6339('0x6f')],{'as':_0x6339('0x10b'),'foreignKey':_0x6339('0x105')});db['User'][_0x6339('0x106')](db[_0x6339('0x71')],{'as':_0x6339('0x71'),'foreignKey':'UserId'});db[_0x6339('0x103')][_0x6339('0x106')](db[_0x6339('0x10c')],{'as':_0x6339('0x10d'),'foreignKey':_0x6339('0x105')});db[_0x6339('0x103')]['hasMany'](db[_0x6339('0x5d')],{'as':'ChatInteractions','foreignKey':_0x6339('0x105')});db[_0x6339('0x103')][_0x6339('0x106')](db[_0x6339('0x53')],{'as':_0x6339('0x10e'),'foreignKey':_0x6339('0x105')});db[_0x6339('0x103')]['hasMany'](db['FaxInteraction'],{'as':_0x6339('0x10f'),'foreignKey':'UserId'});db['User'][_0x6339('0x106')](db['MailInteraction'],{'as':_0x6339('0x110'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x6339('0xf7')],{'as':_0x6339('0x111'),'foreignKey':_0x6339('0x105')});db['User'][_0x6339('0x106')](db[_0x6339('0xf2')],{'as':_0x6339('0x112'),'foreignKey':_0x6339('0x113')});db[_0x6339('0x103')][_0x6339('0x114')](db['UserProfile'],{'as':_0x6339('0xed'),'foreignKey':_0x6339('0x115')});db[_0x6339('0x103')]['belongsToMany'](db[_0x6339('0x63')],{'as':_0x6339('0x116'),'through':_0x6339('0x117')});db['User']['belongsToMany'](db[_0x6339('0x69')],{'as':_0x6339('0x118'),'through':_0x6339('0x119')});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0xe9')],{'as':'Lists','through':_0x6339('0x11b')});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0xd8')],{'through':_0x6339('0x11c')});db[_0x6339('0x103')][_0x6339('0x11a')](db['MailInteraction'],{'as':_0x6339('0x110'),'through':_0x6339('0x11d')});db[_0x6339('0x103')][_0x6339('0x11a')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x6339('0x11e')});db['User'][_0x6339('0x11a')](db[_0x6339('0x49')],{'as':_0x6339('0x10f'),'through':'user_has_fax_interactions'});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0x53')],{'as':_0x6339('0x10e'),'through':_0x6339('0x11f')});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0x10c')],{'as':_0x6339('0x10d'),'through':_0x6339('0x120')});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0xf7')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User'][_0x6339('0x11a')](db[_0x6339('0x19')],{'as':_0x6339('0x121'),'through':_0x6339('0x2c'),'required':![]});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0x3b')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db['User'][_0x6339('0x11a')](db[_0x6339('0x62')],{'as':_0x6339('0x122'),'through':_0x6339('0x2e'),'required':![],'hooks':!![]});db[_0x6339('0x103')]['belongsToMany'](db[_0x6339('0x4c')],{'as':'FaxQueues','through':_0x6339('0x32'),'required':![]});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0x56')],{'as':_0x6339('0x123'),'through':_0x6339('0x124'),'required':![]});db[_0x6339('0x103')][_0x6339('0x11a')](db['OpenchannelQueue'],{'as':_0x6339('0x125'),'through':_0x6339('0x34'),'required':![]});db['User'][_0x6339('0x11a')](db[_0x6339('0x126')],{'as':_0x6339('0x127'),'through':_0x6339('0x36'),'required':![]});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0xe9')],{'through':_0x6339('0x11b')});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0xeb')],{'as':_0x6339('0x128'),'through':_0x6339('0x129'),'required':![]});db[_0x6339('0x103')]['belongsToMany'](db[_0x6339('0x59')],{'as':_0x6339('0x12a'),'through':_0x6339('0x12b')});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0x12c')],{'as':'FaxAccounts','through':_0x6339('0x12d')});db[_0x6339('0x103')][_0x6339('0x11a')](db['MailAccount'],{'as':_0x6339('0x12e'),'through':_0x6339('0x12f')});db[_0x6339('0x103')][_0x6339('0x11a')](db['OpenchannelAccount'],{'as':_0x6339('0x130'),'through':_0x6339('0x131')});db['User']['belongsToMany'](db[_0x6339('0x4f')],{'as':'SmsAccounts','through':_0x6339('0x132')});db[_0x6339('0x103')][_0x6339('0x11a')](db[_0x6339('0xf4')],{'as':_0x6339('0x133'),'through':_0x6339('0x134')});db[_0x6339('0x103')][_0x6339('0x11a')](db['SquareProject'],{'as':_0x6339('0x135'),'through':_0x6339('0x136')});db[_0x6339('0x14')][_0x6339('0x106')](db[_0x6339('0x137')],{'as':_0x6339('0x138'),'onDelete':_0x6339('0x104'),'foreignKey':'ChanSpyId'});db[_0x6339('0x15')][_0x6339('0x106')](db['VoiceExtension'],{'onDelete':_0x6339('0x104')});db[_0x6339('0x137')][_0x6339('0x106')](db['VoiceExtension'],{'as':_0x6339('0x139'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0x6339('0x11a')](db[_0x6339('0x13a')],{'as':'Sounds','through':_0x6339('0x13b')});db[_0x6339('0x19')][_0x6339('0x106')](db[_0x6339('0x2a')],{'as':_0x6339('0x13c'),'foreignKey':_0x6339('0x13d')});db[_0x6339('0x19')]['hasMany'](db[_0x6339('0x13e')],{'as':'Hoppers','foreignKey':_0x6339('0x13d')});db['VoiceQueue'][_0x6339('0x106')](db[_0x6339('0x6d')],{'as':_0x6339('0x10a'),'foreignKey':_0x6339('0x13d')});db['VoiceQueue'][_0x6339('0x106')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x6339('0x13d')});db[_0x6339('0x19')][_0x6339('0x106')](db[_0x6339('0x71')],{'as':_0x6339('0x71'),'foreignKey':_0x6339('0x13d')});db[_0x6339('0x19')]['hasMany'](db[_0x6339('0x13f')],{'as':_0x6339('0x140'),'foreignKey':'VoiceQueueId'});db[_0x6339('0x19')][_0x6339('0x106')](db['JscriptySessionReport'],{'as':_0x6339('0x141'),'foreignKey':'VoiceQueueId'});db[_0x6339('0x19')]['belongsTo'](db[_0x6339('0x28')],{'as':_0x6339('0x28'),'foreignKey':_0x6339('0x142')});db[_0x6339('0x19')][_0x6339('0x114')](db[_0x6339('0x28')],{'as':_0x6339('0x143'),'foreignKey':_0x6339('0x144')});db[_0x6339('0x19')][_0x6339('0x114')](db['Interval'],{'as':'Interval','foreignKey':_0x6339('0x145')});db[_0x6339('0x19')][_0x6339('0x114')](db['Pause'],{'as':_0x6339('0x146'),'foreignKey':_0x6339('0x147')});db['VoiceQueue']['belongsToMany'](db[_0x6339('0xe9')],{'as':_0x6339('0x148'),'through':_0x6339('0x149')});db[_0x6339('0x19')][_0x6339('0x11a')](db['User'],{'as':_0x6339('0x14a'),'through':_0x6339('0x2c')});db[_0x6339('0x19')]['belongsToMany'](db[_0x6339('0xd8')],{'as':_0x6339('0x14b'),'through':_0x6339('0x14c')});db[_0x6339('0x19')][_0x6339('0x11a')](db[_0x6339('0xe9')],{'as':'BlackLists','through':_0x6339('0x14d')});db[_0x6339('0x107')]['belongsTo'](db[_0x6339('0x103')],{'as':_0x6339('0x103'),'foreignKey':'UserId'});db[_0x6339('0x1c')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x103'),'foreignKey':_0x6339('0x105')});db['VoiceMail'][_0x6339('0x106')](db[_0x6339('0x1f')],{'as':_0x6339('0x14e'),'onDelete':_0x6339('0x104'),'foreignKey':'mailboxuser','sourceKey':_0x6339('0x14f')});db[_0x6339('0x1f')][_0x6339('0x114')](db['VoiceMail'],{'foreignKey':_0x6339('0x150'),'targetKey':_0x6339('0x14f')});db[_0x6339('0x20')][_0x6339('0x106')](db[_0x6339('0x151')],{'as':_0x6339('0x152'),'foreignKey':_0x6339('0x153'),'constraints':![]});db[_0x6339('0x20')][_0x6339('0x106')](db[_0x6339('0x23')],{'as':_0x6339('0x154'),'foreignKey':'uniqueid','constraints':![]});db[_0x6339('0x20')]['belongsTo'](db[_0x6339('0x103')],{'as':_0x6339('0x103'),'foreignKey':'UserId'});db[_0x6339('0x20')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':'Contact','foreignKey':_0x6339('0x155')});db[_0x6339('0x38')][_0x6339('0x114')](db['MailAccount'],{'as':_0x6339('0x3a'),'foreignKey':_0x6339('0x156')});db[_0x6339('0x157')][_0x6339('0x114')](db[_0x6339('0x3a')],{'as':_0x6339('0x3a'),'foreignKey':'MailAccountId'});db[_0x6339('0x3a')][_0x6339('0x158')](db[_0x6339('0x38')],{'as':_0x6339('0x159'),'onDelete':_0x6339('0x104')});db[_0x6339('0x3a')][_0x6339('0x158')](db[_0x6339('0x157')],{'as':_0x6339('0x15a'),'onDelete':'cascade'});db[_0x6339('0x3a')][_0x6339('0x106')](db['Disposition'],{'as':_0x6339('0x15b'),'foreignKey':'MailAccountId'});db[_0x6339('0x3a')][_0x6339('0x106')](db[_0x6339('0x78')],{'as':_0x6339('0x15c'),'foreignKey':'MailAccountId'});db[_0x6339('0x3a')][_0x6339('0x106')](db[_0x6339('0x3f')],{'as':_0x6339('0x14e'),'foreignKey':_0x6339('0x156')});db[_0x6339('0x3a')][_0x6339('0x106')](db['MailInteraction'],{'as':'Interactions'});db[_0x6339('0x3a')][_0x6339('0x106')](db['MailApplication'],{'as':_0x6339('0x139')});db[_0x6339('0x3a')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':'List','foreignKey':'ListId'});db[_0x6339('0x3a')][_0x6339('0x114')](db[_0x6339('0x84')],{'as':'Template','foreignKey':_0x6339('0x15d')});db['MailAccount'][_0x6339('0x114')](db[_0x6339('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0x6339('0x147')});db[_0x6339('0x3a')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x12f')});db[_0x6339('0x3b')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x30')});db[_0x6339('0x3b')][_0x6339('0x11a')](db[_0x6339('0xd8')],{'through':_0x6339('0x15e'),'as':'Teams'});db[_0x6339('0x15f')][_0x6339('0x106')](db[_0x6339('0x3f')],{'as':_0x6339('0x14e'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction'][_0x6339('0x114')](db[_0x6339('0x3a')],{'as':'Account','foreignKey':_0x6339('0x156')});db[_0x6339('0x15f')]['belongsTo'](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':'ContactId'});db['MailInteraction'][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x161'),'foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0x6339('0x83')],{'through':'mail_interaction_has_tags','as':_0x6339('0x162')});db[_0x6339('0x15f')][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':'mail_interaction_has_tags','as':_0x6339('0x163')});db['MailInteraction'][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x164'),'through':_0x6339('0x11d'),'foreignKey':_0x6339('0x165')});db[_0x6339('0x3f')]['hasMany'](db[_0x6339('0x166')],{'as':'Attachments','onDelete':_0x6339('0x104')});db['MailMessage'][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x103')});db[_0x6339('0x3f')]['belongsTo'](db['CmContact'],{'onDelete':_0x6339('0x104'),'as':'Contact'});db['MailMessage'][_0x6339('0x114')](db['MailInteraction'],{'as':_0x6339('0x167'),'foreignKey':'MailInteractionId'});db[_0x6339('0x3f')][_0x6339('0x114')](db[_0x6339('0x3a')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x156')});db[_0x6339('0x3f')][_0x6339('0x114')](db[_0x6339('0x59')],{'as':_0x6339('0x59'),'foreignKey':_0x6339('0x169')});db[_0x6339('0x3f')][_0x6339('0x114')](db['ChatOfflineMessage'],{'as':_0x6339('0x61'),'foreignKey':_0x6339('0x16a')});db[_0x6339('0x40')]['belongsTo'](db[_0x6339('0x103')],{'onDelete':_0x6339('0x16b')});db['MailApplication'][_0x6339('0x114')](db[_0x6339('0x3b')],{'onDelete':_0x6339('0x16b')});db[_0x6339('0x40')]['belongsTo'](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0x6339('0x114')](db[_0x6339('0x16c')],{'onDelete':_0x6339('0x16b'),'foreignKey':'IntervalId'});db[_0x6339('0x40')]['belongsTo'](db[_0x6339('0x83')],{'onDelete':_0x6339('0x16b'),'foreignKey':_0x6339('0x16d')});db[_0x6339('0x16e')][_0x6339('0x114')](db['MailAccount'],{});db[_0x6339('0x16e')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170')});db[_0x6339('0x16e')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':'ContactId'});db[_0x6339('0x16e')]['belongsTo'](db[_0x6339('0x15f')],{});db[_0x6339('0x16e')][_0x6339('0x114')](db[_0x6339('0x3f')],{});db[_0x6339('0x16e')][_0x6339('0x114')](db[_0x6339('0x103')],{});db[_0x6339('0x16e')][_0x6339('0x114')](db[_0x6339('0x3b')],{});db[_0x6339('0x42')]['hasMany'](db[_0x6339('0x44')],{'as':'Items','onDelete':_0x6339('0x104')});db[_0x6339('0x12c')][_0x6339('0x106')](db[_0x6339('0x171')],{'as':_0x6339('0x15b'),'foreignKey':_0x6339('0x172')});db[_0x6339('0x12c')][_0x6339('0x106')](db[_0x6339('0x78')],{'as':_0x6339('0x15c'),'foreignKey':_0x6339('0x172')});db[_0x6339('0x12c')][_0x6339('0x106')](db[_0x6339('0x49')],{'as':_0x6339('0x173')});db[_0x6339('0x12c')][_0x6339('0x106')](db[_0x6339('0x47')],{'as':_0x6339('0x139')});db[_0x6339('0x12c')][_0x6339('0x106')](db[_0x6339('0x137')],{'as':_0x6339('0x174'),'onDelete':_0x6339('0x104')});db[_0x6339('0x12c')][_0x6339('0x106')](db[_0x6339('0x4b')],{'as':'Messages'});db[_0x6339('0x12c')]['belongsTo'](db['Trunk'],{'as':_0x6339('0x28')});db[_0x6339('0x12c')]['belongsTo'](db[_0x6339('0xe9')],{'as':'List','foreignKey':_0x6339('0x170')});db[_0x6339('0x12c')][_0x6339('0x114')](db[_0x6339('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0x6339('0x147')});db[_0x6339('0x12c')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':'user_has_fax_accounts'});db[_0x6339('0x47')][_0x6339('0x114')](db[_0x6339('0x103')],{'onDelete':_0x6339('0x16b')});db[_0x6339('0x47')][_0x6339('0x114')](db['FaxQueue'],{'onDelete':_0x6339('0x16b')});db['FaxApplication'][_0x6339('0x114')](db[_0x6339('0x12c')],{'onDelete':'restrict'});db[_0x6339('0x47')]['belongsTo'](db[_0x6339('0x83')],{'onDelete':'restrict','foreignKey':_0x6339('0x16d')});db['FaxInteraction'][_0x6339('0x106')](db['FaxMessage'],{'as':_0x6339('0x14e'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x175')});db[_0x6339('0x49')][_0x6339('0x114')](db[_0x6339('0x12c')],{'as':_0x6339('0x168'),'foreignKey':'FaxAccountId'});db[_0x6339('0x49')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db[_0x6339('0x49')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x161'),'foreignKey':_0x6339('0x105')});db[_0x6339('0x49')]['belongsToMany'](db[_0x6339('0x83')],{'through':_0x6339('0x176'),'as':_0x6339('0x162')});db[_0x6339('0x49')]['belongsToMany'](db[_0x6339('0x83')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x6339('0x49')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':'Users','through':_0x6339('0x177'),'foreignKey':'FaxInteractionId'});db[_0x6339('0x4b')]['belongsTo'](db['User'],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x103')});db[_0x6339('0x4b')][_0x6339('0x114')](db[_0x6339('0x49')],{'as':'Interaction','foreignKey':_0x6339('0x175')});db[_0x6339('0x4b')][_0x6339('0x114')](db[_0x6339('0x69')],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x160')});db[_0x6339('0x4b')]['belongsTo'](db[_0x6339('0x166')],{'as':_0x6339('0x166'),'foreignKey':_0x6339('0x178')});db[_0x6339('0x4b')][_0x6339('0x114')](db[_0x6339('0x12c')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x172')});db[_0x6339('0x4c')]['belongsToMany'](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x32')});db['FaxQueue'][_0x6339('0x11a')](db['Team'],{'through':_0x6339('0x179'),'as':'Teams'});db[_0x6339('0x4e')][_0x6339('0x114')](db['FaxAccount'],{});db[_0x6339('0x4e')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170')});db[_0x6339('0x4e')]['belongsTo'](db['CmContact'],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db['FaxQueueReport'][_0x6339('0x114')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x6339('0x114')](db['FaxMessage'],{});db[_0x6339('0x4e')]['belongsTo'](db['User'],{});db[_0x6339('0x4e')]['belongsTo'](db[_0x6339('0x4c')],{});db[_0x6339('0x4f')][_0x6339('0x106')](db[_0x6339('0x171')],{'as':_0x6339('0x15b'),'foreignKey':_0x6339('0x17a')});db[_0x6339('0x4f')]['hasMany'](db[_0x6339('0x78')],{'as':'Answers','foreignKey':_0x6339('0x17a')});db[_0x6339('0x4f')][_0x6339('0x106')](db['SmsMessage'],{'as':_0x6339('0x14e'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x6339('0x106')](db[_0x6339('0x53')],{'as':_0x6339('0x173')});db['SmsAccount'][_0x6339('0x106')](db[_0x6339('0x51')],{'as':'Applications'});db[_0x6339('0x4f')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':'ListId'});db['SmsAccount'][_0x6339('0x114')](db[_0x6339('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0x6339('0x147')});db[_0x6339('0x4f')][_0x6339('0x11a')](db['User'],{'as':_0x6339('0x14a'),'through':_0x6339('0x132')});db[_0x6339('0x51')][_0x6339('0x114')](db[_0x6339('0x103')],{'onDelete':_0x6339('0x16b')});db[_0x6339('0x51')][_0x6339('0x114')](db[_0x6339('0x56')],{'onDelete':_0x6339('0x16b')});db['SmsApplication'][_0x6339('0x114')](db['SmsAccount'],{'onDelete':_0x6339('0x16b')});db[_0x6339('0x51')][_0x6339('0x114')](db['Interval'],{'onDelete':_0x6339('0x16b'),'foreignKey':'IntervalId'});db[_0x6339('0x51')][_0x6339('0x114')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6339('0x16d')});db['SmsInteraction']['hasMany'](db[_0x6339('0x17b')],{'as':_0x6339('0x14e'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x17c')});db[_0x6339('0x53')][_0x6339('0x114')](db[_0x6339('0x4f')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x17a')});db[_0x6339('0x53')]['belongsTo'](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db[_0x6339('0x53')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x161'),'foreignKey':_0x6339('0x105')});db['SmsInteraction'][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':_0x6339('0x17d'),'as':_0x6339('0x162')});db[_0x6339('0x53')][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':_0x6339('0x17d'),'as':_0x6339('0x163')});db[_0x6339('0x53')]['belongsToMany'](db['User'],{'as':_0x6339('0x164'),'through':_0x6339('0x11f'),'foreignKey':_0x6339('0x17c')});db[_0x6339('0x17b')]['belongsTo'](db[_0x6339('0x103')],{'as':_0x6339('0x103')});db['SmsMessage'][_0x6339('0x114')](db[_0x6339('0x69')],{'onDelete':'cascade','as':_0x6339('0x160')});db[_0x6339('0x17b')]['belongsTo'](db[_0x6339('0x53')],{'onDelete':'cascade','as':_0x6339('0x167'),'foreignKey':_0x6339('0x17c')});db['SmsMessage'][_0x6339('0x114')](db['SmsAccount'],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x17a')});db[_0x6339('0x56')]['belongsToMany'](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x124'),'foreignKey':_0x6339('0x17e')});db[_0x6339('0x56')]['belongsToMany'](db[_0x6339('0xd8')],{'through':_0x6339('0x17f'),'as':'Teams'});db[_0x6339('0x180')]['hasMany'](db[_0x6339('0x171')],{'as':_0x6339('0x15b'),'foreignKey':_0x6339('0x181')});db[_0x6339('0x180')][_0x6339('0x106')](db[_0x6339('0x78')],{'as':_0x6339('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x6339('0x180')]['hasMany'](db[_0x6339('0x10c')],{'as':_0x6339('0x173'),'foreignKey':_0x6339('0x181')});db[_0x6339('0x180')][_0x6339('0x106')](db['OpenchannelMessage'],{'as':_0x6339('0x14e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x6339('0x106')](db['OpenchannelApplication'],{'as':_0x6339('0x139'),'foreignKey':_0x6339('0x181')});db[_0x6339('0x180')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170')});db['OpenchannelAccount'][_0x6339('0x114')](db[_0x6339('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0x6339('0x147')});db[_0x6339('0x180')][_0x6339('0x11a')](db['User'],{'as':_0x6339('0x14a'),'through':_0x6339('0x131')});db[_0x6339('0x182')]['belongsTo'](db[_0x6339('0x103')],{'onDelete':_0x6339('0x16b')});db[_0x6339('0x182')][_0x6339('0x114')](db[_0x6339('0x183')],{'onDelete':'restrict','foreignKey':_0x6339('0x184')});db['OpenchannelApplication']['belongsTo'](db[_0x6339('0x180')],{'onDelete':_0x6339('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0x6339('0x182')]['belongsTo'](db[_0x6339('0x16c')],{'onDelete':'restrict','foreignKey':_0x6339('0x145')});db[_0x6339('0x182')][_0x6339('0x114')](db['Tag'],{'onDelete':_0x6339('0x16b'),'foreignKey':'TagId'});db[_0x6339('0x10c')][_0x6339('0x106')](db['OpenchannelMessage'],{'as':_0x6339('0x14e'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x185')});db[_0x6339('0x10c')][_0x6339('0x114')](db[_0x6339('0x180')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x6339('0x155')});db['OpenchannelInteraction'][_0x6339('0x114')](db['User'],{'as':_0x6339('0x161'),'foreignKey':_0x6339('0x105')});db[_0x6339('0x10c')][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':_0x6339('0x186'),'as':_0x6339('0x162')});db['OpenchannelInteraction'][_0x6339('0x11a')](db['Tag'],{'through':_0x6339('0x186'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x6339('0x185')});db[_0x6339('0x187')][_0x6339('0x114')](db[_0x6339('0x103')],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x103')});db['OpenchannelMessage'][_0x6339('0x114')](db[_0x6339('0x69')],{'onDelete':_0x6339('0x104'),'as':'Contact'});db['OpenchannelMessage'][_0x6339('0x114')](db[_0x6339('0x10c')],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x167'),'foreignKey':'OpenchannelInteractionId'});db[_0x6339('0x187')][_0x6339('0x114')](db['Attachment'],{'as':_0x6339('0x166'),'foreignKey':_0x6339('0x178')});db[_0x6339('0x187')][_0x6339('0x114')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x6339('0x183')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':'Agents','through':_0x6339('0x34'),'foreignKey':_0x6339('0x184')});db['OpenchannelQueue'][_0x6339('0x11a')](db['Team'],{'through':_0x6339('0x188'),'as':_0x6339('0x14b')});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0x6339('0x15b'),'foreignKey':_0x6339('0x169')});db['ChatWebsite'][_0x6339('0x106')](db['CannedAnswer'],{'as':_0x6339('0x15c'),'foreignKey':_0x6339('0x169')});db[_0x6339('0x59')][_0x6339('0x106')](db[_0x6339('0x65')],{'as':_0x6339('0x189')});db[_0x6339('0x59')][_0x6339('0x106')](db[_0x6339('0x5d')],{'as':_0x6339('0x173')});db[_0x6339('0x59')][_0x6339('0x106')](db[_0x6339('0x18a')],{'as':_0x6339('0x139')});db['ChatWebsite']['hasMany'](db[_0x6339('0x5f')],{'as':_0x6339('0x14e')});db[_0x6339('0x59')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170')});db[_0x6339('0x59')][_0x6339('0x114')](db['Interval'],{'as':_0x6339('0x16c'),'foreignKey':_0x6339('0x145')});db[_0x6339('0x59')]['belongsTo'](db[_0x6339('0x3a')],{'as':'MailAccount','foreignKey':_0x6339('0x156')});db[_0x6339('0x59')][_0x6339('0x114')](db[_0x6339('0x7c')],{'as':_0x6339('0x146'),'foreignKey':_0x6339('0x147')});db['ChatWebsite'][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x12b')});db[_0x6339('0x5b')][_0x6339('0x114')](db[_0x6339('0x180')],{});db[_0x6339('0x5b')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':'ListId'});db[_0x6339('0x5b')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db[_0x6339('0x5b')][_0x6339('0x114')](db[_0x6339('0x10c')],{});db[_0x6339('0x5b')][_0x6339('0x114')](db[_0x6339('0x187')],{});db[_0x6339('0x5b')]['belongsTo'](db[_0x6339('0x103')],{});db[_0x6339('0x5b')][_0x6339('0x114')](db[_0x6339('0x183')],{});db[_0x6339('0x18a')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':'Agent','foreignKey':_0x6339('0x105'),'onDelete':'restrict'});db[_0x6339('0x18a')][_0x6339('0x114')](db[_0x6339('0x62')],{'as':_0x6339('0x18b'),'foreignKey':_0x6339('0x18c'),'onDelete':_0x6339('0x16b')});db[_0x6339('0x18a')][_0x6339('0x114')](db[_0x6339('0x59')],{'as':_0x6339('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':_0x6339('0x16b')});db['ChatApplication'][_0x6339('0x114')](db[_0x6339('0x83')],{'onDelete':_0x6339('0x16b'),'foreignKey':_0x6339('0x16d')});db[_0x6339('0x5d')][_0x6339('0x106')](db[_0x6339('0x5f')],{'as':_0x6339('0x14e'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x18e')});db[_0x6339('0x5d')][_0x6339('0x114')](db['ChatWebsite'],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x169')});db[_0x6339('0x5d')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':'Contact','foreignKey':_0x6339('0x155')});db[_0x6339('0x5d')]['belongsTo'](db[_0x6339('0x103')],{'as':_0x6339('0x161'),'foreignKey':_0x6339('0x105')});db[_0x6339('0x5d')][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':'chat_interaction_has_tags','as':_0x6339('0x162')});db[_0x6339('0x5d')][_0x6339('0x11a')](db['Tag'],{'through':_0x6339('0x18f'),'as':'ThroughTags'});db[_0x6339('0x5d')]['belongsToMany'](db['User'],{'as':_0x6339('0x164'),'through':'user_has_chat_interactions','foreignKey':_0x6339('0x18e')});db[_0x6339('0x5f')][_0x6339('0x114')](db['User'],{'onDelete':_0x6339('0x104'),'as':'User'});db[_0x6339('0x5f')][_0x6339('0x114')](db['CmContact'],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x160'),'foreignKey':'ContactId'});db[_0x6339('0x5f')][_0x6339('0x114')](db[_0x6339('0x5d')],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x167'),'foreignKey':_0x6339('0x18e')});db[_0x6339('0x5f')]['belongsTo'](db[_0x6339('0x166')],{'as':_0x6339('0x166'),'foreignKey':'AttachmentId'});db[_0x6339('0x5f')][_0x6339('0x114')](db[_0x6339('0x59')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x169')});db[_0x6339('0x61')][_0x6339('0x114')](db[_0x6339('0x69')],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db[_0x6339('0x61')][_0x6339('0x114')](db[_0x6339('0x59')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x169')});db['ChatQueue'][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':'UserChatQueue','hooks':!![]});db[_0x6339('0x62')][_0x6339('0x11a')](db[_0x6339('0xd8')],{'through':_0x6339('0x190'),'as':_0x6339('0x14b')});db[_0x6339('0x63')][_0x6339('0x106')](db[_0x6339('0xc3')],{'as':_0x6339('0x14e'),'foreignKey':_0x6339('0x191'),'onDelete':_0x6339('0x104')});db[_0x6339('0x63')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x13c'),'through':_0x6339('0x117')});db[_0x6339('0x65')][_0x6339('0x114')](db['ChatWebsite'],{'as':_0x6339('0x18d'),'foreignKey':_0x6339('0x169')});db[_0x6339('0x67')][_0x6339('0x106')](db[_0x6339('0x69')],{'as':_0x6339('0x118'),'foreignKey':_0x6339('0x192')});db[_0x6339('0x69')][_0x6339('0x106')](db[_0x6339('0x13e')],{'as':_0x6339('0x193'),'foreignKey':_0x6339('0x155')});db['CmContact'][_0x6339('0x106')](db[_0x6339('0x6d')],{'as':'HopperFinals','foreignKey':_0x6339('0x155')});db[_0x6339('0x69')]['hasMany'](db[_0x6339('0x6f')],{'as':_0x6339('0x194'),'foreignKey':_0x6339('0x155')});db[_0x6339('0x69')][_0x6339('0x106')](db[_0x6339('0x71')],{'as':_0x6339('0x71'),'foreignKey':_0x6339('0x155')});db[_0x6339('0x69')]['hasMany'](db[_0x6339('0xc9')],{'as':'JscriptySessions','foreignKey':_0x6339('0x155')});db['CmContact'][_0x6339('0x106')](db[_0x6339('0x10c')],{'as':_0x6339('0x10d'),'foreignKey':_0x6339('0x155'),'onDelete':'restrict'});db[_0x6339('0x69')]['hasMany'](db[_0x6339('0x5d')],{'as':_0x6339('0x195'),'foreignKey':_0x6339('0x155'),'onDelete':_0x6339('0x16b')});db['CmContact']['hasMany'](db[_0x6339('0x53')],{'as':_0x6339('0x10e'),'foreignKey':_0x6339('0x155'),'onDelete':_0x6339('0x16b')});db[_0x6339('0x69')][_0x6339('0x106')](db[_0x6339('0x49')],{'as':_0x6339('0x10f'),'foreignKey':_0x6339('0x155'),'onDelete':_0x6339('0x16b')});db[_0x6339('0x69')][_0x6339('0x106')](db['MailInteraction'],{'as':_0x6339('0x110'),'foreignKey':_0x6339('0x155'),'onDelete':'restrict'});db[_0x6339('0x69')][_0x6339('0x114')](db['CmCompany'],{'as':_0x6339('0x196'),'foreignKey':_0x6339('0x192')});db[_0x6339('0x69')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170'),'onDelete':'cascade'});db['CmContact']['belongsToMany'](db[_0x6339('0x103')],{'as':_0x6339('0x164'),'through':_0x6339('0x119')});db[_0x6339('0x69')][_0x6339('0x11a')](db[_0x6339('0x83')],{'as':_0x6339('0x162'),'through':'cm_contact_has_tags'});db[_0x6339('0x69')][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':_0x6339('0x197'),'as':_0x6339('0x163')});db['CmHopper'][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155'),'onDelete':'cascade'});db[_0x6339('0x13e')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170'),'onDelete':_0x6339('0x104')});db[_0x6339('0x13e')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':'Agent','foreignKey':_0x6339('0x105')});db[_0x6339('0x13e')][_0x6339('0x114')](db[_0x6339('0x19')],{'as':_0x6339('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0x6339('0x104')});db[_0x6339('0x13e')][_0x6339('0x114')](db[_0x6339('0xdb')],{'as':_0x6339('0xdb'),'foreignKey':_0x6339('0x198'),'onDelete':_0x6339('0x104')});db[_0x6339('0x13e')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x161'),'foreignKey':_0x6339('0x199')});db[_0x6339('0x13f')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155'),'onDelete':_0x6339('0x104')});db[_0x6339('0x13f')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':'List','foreignKey':_0x6339('0x170'),'onDelete':_0x6339('0x104')});db[_0x6339('0x13f')][_0x6339('0x114')](db[_0x6339('0x19')],{'as':'Queue','foreignKey':_0x6339('0x13d'),'onDelete':_0x6339('0x104')});db[_0x6339('0x13f')]['belongsTo'](db[_0x6339('0xdb')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db['Automation'][_0x6339('0x106')](db['Condition'],{'as':{'plural':_0x6339('0x19a'),'singular':_0x6339('0x19b')},'foreignKey':_0x6339('0x19c'),'onDelete':_0x6339('0x104'),'hooks':!![]});db[_0x6339('0x76')][_0x6339('0x106')](db[_0x6339('0x79')],{'as':{'plural':_0x6339('0x19d'),'singular':_0x6339('0x19e')},'foreignKey':_0x6339('0x19f'),'onDelete':_0x6339('0x104'),'hooks':!![]});db[_0x6339('0x76')]['hasMany'](db[_0x6339('0x75')],{'as':_0x6339('0x1a0'),'foreignKey':_0x6339('0x1a1'),'onDelete':_0x6339('0x104'),'hooks':!![]});db[_0x6339('0x171')]['hasMany'](db['Disposition'],{'as':_0x6339('0x15b'),'foreignKey':_0x6339('0x1a2'),'onDelete':_0x6339('0x104')});db[_0x6339('0x16c')][_0x6339('0x106')](db['Interval'],{'as':_0x6339('0x1a3'),'foreignKey':'IntervalId','onDelete':_0x6339('0x104'),'hooks':!![],'required':![]});db[_0x6339('0x16c')]['hasMany'](db[_0x6339('0x137')],{'as':_0x6339('0x109'),'foreignKey':_0x6339('0x145'),'onDelete':'restrict'});db[_0x6339('0x16c')][_0x6339('0x106')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x6339('0x145')});db[_0x6339('0x16c')][_0x6339('0x106')](db['ChatApplication'],{'as':_0x6339('0x1a4'),'foreignKey':_0x6339('0x145')});db[_0x6339('0x16c')]['hasMany'](db[_0x6339('0x47')],{'as':_0x6339('0x1a5'),'foreignKey':_0x6339('0x145')});db[_0x6339('0x16c')][_0x6339('0x106')](db[_0x6339('0x51')],{'as':_0x6339('0x1a6'),'foreignKey':_0x6339('0x145')});db[_0x6339('0x80')][_0x6339('0x114')](db[_0x6339('0x3a')],{});db['Schedule'][_0x6339('0x114')](db['AnalyticDefaultReport'],{'foreignKey':_0x6339('0x1a7')});db[_0x6339('0x80')]['belongsTo'](db[_0x6339('0x8d')],{'foreignKey':_0x6339('0x1a8')});db[_0x6339('0x13a')][_0x6339('0x11a')](db[_0x6339('0x17')],{'as':'Mohs','through':_0x6339('0x13b'),'onDelete':_0x6339('0x16b')});db['Tag'][_0x6339('0x11a')](db[_0x6339('0x69')],{'through':_0x6339('0x197')});db[_0x6339('0x83')][_0x6339('0x11a')](db[_0x6339('0x5d')],{'through':_0x6339('0x18f')});db[_0x6339('0x83')][_0x6339('0x11a')](db['MailInteraction'],{'through':_0x6339('0x1a9')});db[_0x6339('0x83')][_0x6339('0x11a')](db[_0x6339('0x53')],{'through':_0x6339('0x17d')});db[_0x6339('0x83')][_0x6339('0x11a')](db[_0x6339('0x49')],{'through':_0x6339('0x176')});db[_0x6339('0x83')]['belongsToMany'](db[_0x6339('0x10c')],{'through':'openchannel_interaction_has_tags'});db[_0x6339('0x83')][_0x6339('0x11a')](db['WhatsappInteraction'],{'through':_0x6339('0x1aa')});db[_0x6339('0x86')][_0x6339('0x106')](db[_0x6339('0x79')],{'as':{'plural':_0x6339('0x1ab'),'singular':_0x6339('0x1ac')},'foreignKey':_0x6339('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0x6339('0x86')][_0x6339('0x106')](db['Condition'],{'as':{'plural':_0x6339('0x1ae'),'singular':'AnyCondition'},'foreignKey':_0x6339('0x1af'),'onDelete':_0x6339('0x104'),'hooks':!![]});db[_0x6339('0x86')][_0x6339('0x106')](db[_0x6339('0x75')],{'as':'Actions','foreignKey':_0x6339('0x1b0'),'onDelete':_0x6339('0x104'),'hooks':!![]});db[_0x6339('0x8d')][_0x6339('0x106')](db[_0x6339('0x93')],{'as':_0x6339('0x1b1'),'onDelete':_0x6339('0x104'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x6339('0x8f')][_0x6339('0x106')](db[_0x6339('0x93')],{'as':_0x6339('0x1b1'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1a7')});db['AnalyticMetric'][_0x6339('0x106')](db['AnalyticFieldReport'],{'as':_0x6339('0x1b1'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b2')});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x6339('0x97')][_0x6339('0x106')](db[_0x6339('0x98')],{'as':_0x6339('0x1b3'),'onDelete':'cascade','foreignKey':_0x6339('0x1b4')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x6339('0x1b5'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0x98')][_0x6339('0x106')](db[_0x6339('0x1b7')],{'as':_0x6339('0x1b8'),'onDelete':_0x6339('0x104'),'foreignKey':'DescriptionId'});db[_0x6339('0x98')][_0x6339('0x106')](db['SalesforceField'],{'as':_0x6339('0x1b1'),'onDelete':'cascade','foreignKey':_0x6339('0x1b9')});db[_0x6339('0x98')][_0x6339('0x114')](db[_0x6339('0x97')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x1b4')});db['SalesforceField'][_0x6339('0x106')](db['SalesforceField'],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0x1b7')]['hasMany'](db[_0x6339('0x1b7')],{'as':_0x6339('0x1bb'),'foreignKey':_0x6339('0x1bc')});db['SalesforceField'][_0x6339('0x106')](db['SalesforceField'],{'as':_0x6339('0x1bd'),'foreignKey':_0x6339('0x1b9')});db['SalesforceField'][_0x6339('0x114')](db['Variable'],{'as':_0x6339('0x88'),'foreignKey':_0x6339('0x1be')});db[_0x6339('0x1bf')]['hasMany'](db[_0x6339('0x9b')],{'as':_0x6339('0x1b3'),'onDelete':'cascade','foreignKey':_0x6339('0x1b4')});db['SugarcrmConfiguration'][_0x6339('0x106')](db[_0x6339('0x9c')],{'as':_0x6339('0x1b5'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b6')});db['SugarcrmConfiguration'][_0x6339('0x106')](db[_0x6339('0x9c')],{'as':_0x6339('0x1b8'),'onDelete':_0x6339('0x104'),'foreignKey':'DescriptionId'});db[_0x6339('0x9b')][_0x6339('0x106')](db[_0x6339('0x9c')],{'as':_0x6339('0x1b1'),'onDelete':_0x6339('0x104'),'foreignKey':'FieldId'});db[_0x6339('0x9b')][_0x6339('0x114')](db[_0x6339('0x1bf')],{'as':'Account','foreignKey':_0x6339('0x1b4')});db[_0x6339('0x9c')]['hasMany'](db[_0x6339('0x9c')],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0x9c')][_0x6339('0x106')](db[_0x6339('0x9c')],{'as':_0x6339('0x1bb'),'foreignKey':_0x6339('0x1bc')});db[_0x6339('0x9c')][_0x6339('0x106')](db['SugarcrmField'],{'as':_0x6339('0x1bd'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x6339('0x114')](db[_0x6339('0x88')],{'as':_0x6339('0x88'),'foreignKey':'VariableId'});db['DeskAccount']['hasMany'](db[_0x6339('0xa0')],{'as':_0x6339('0x1b3'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b4')});db[_0x6339('0xa0')][_0x6339('0x106')](db[_0x6339('0xa2')],{'as':_0x6339('0x1b5'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration'][_0x6339('0x106')](db[_0x6339('0xa2')],{'as':'Descriptions','onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1bc')});db[_0x6339('0xa0')][_0x6339('0x106')](db[_0x6339('0xa2')],{'as':_0x6339('0x1b1'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b9')});db[_0x6339('0xa0')][_0x6339('0x114')](db[_0x6339('0x9e')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x1b4')});db[_0x6339('0xa0')]['belongsToMany'](db[_0x6339('0x83')],{'through':_0x6339('0x1c0')});db['DeskField'][_0x6339('0x106')](db[_0x6339('0xa2')],{'as':'Subject','foreignKey':_0x6339('0x1b6')});db[_0x6339('0xa2')]['hasMany'](db['DeskField'],{'as':_0x6339('0x1bb'),'foreignKey':_0x6339('0x1bc')});db[_0x6339('0xa2')][_0x6339('0x106')](db[_0x6339('0xa2')],{'as':_0x6339('0x1bd'),'foreignKey':_0x6339('0x1b9')});db[_0x6339('0xa2')]['belongsTo'](db[_0x6339('0x88')],{'as':_0x6339('0x88'),'foreignKey':_0x6339('0x1be')});db[_0x6339('0xa3')]['hasMany'](db[_0x6339('0xa5')],{'as':_0x6339('0x1b3'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b4')});db[_0x6339('0xa5')]['hasMany'](db['ZohoField'],{'as':_0x6339('0x1b5'),'onDelete':'cascade','foreignKey':_0x6339('0x1b6')});db[_0x6339('0xa5')][_0x6339('0x106')](db[_0x6339('0x1c1')],{'as':'Descriptions','onDelete':_0x6339('0x104'),'foreignKey':'DescriptionId'});db[_0x6339('0xa5')][_0x6339('0x106')](db[_0x6339('0x1c1')],{'as':_0x6339('0x1b1'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b9')});db['ZohoConfiguration'][_0x6339('0x114')](db[_0x6339('0xa3')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x1b4')});db[_0x6339('0x1c1')][_0x6339('0x106')](db['ZohoField'],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db['ZohoField'][_0x6339('0x106')](db[_0x6339('0x1c1')],{'as':_0x6339('0x1bb'),'foreignKey':'DescriptionId'});db[_0x6339('0x1c1')][_0x6339('0x106')](db[_0x6339('0x1c1')],{'as':_0x6339('0x1bd'),'foreignKey':_0x6339('0x1b9')});db[_0x6339('0x1c1')]['belongsTo'](db[_0x6339('0x88')],{'as':'Variable','foreignKey':_0x6339('0x1be')});db['ZendeskAccount'][_0x6339('0x106')](db[_0x6339('0x1c2')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x6339('0x1c2')]['hasMany'](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x6339('0x1b6')});db[_0x6339('0x1c2')][_0x6339('0x106')](db['ZendeskField'],{'as':_0x6339('0x1b8'),'foreignKey':_0x6339('0x1bc')});db[_0x6339('0x1c2')][_0x6339('0x106')](db[_0x6339('0x1c3')],{'as':_0x6339('0x1b1'),'foreignKey':_0x6339('0x1b9')});db[_0x6339('0x1c2')][_0x6339('0x114')](db[_0x6339('0x1c4')],{'as':'Account','foreignKey':_0x6339('0x1b4')});db['ZendeskConfiguration'][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':_0x6339('0x1c5')});db['ZendeskField'][_0x6339('0x106')](db[_0x6339('0x1c3')],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0x1c3')][_0x6339('0x106')](db['ZendeskField'],{'as':_0x6339('0x1bb'),'foreignKey':_0x6339('0x1bc')});db[_0x6339('0x1c3')][_0x6339('0x106')](db['ZendeskField'],{'as':_0x6339('0x1bd'),'foreignKey':'FieldId'});db[_0x6339('0x1c3')]['belongsTo'](db[_0x6339('0x88')],{'as':'Variable','foreignKey':_0x6339('0x1be')});db[_0x6339('0xab')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x6339('0x1b3'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b4')});db[_0x6339('0x1c6')][_0x6339('0x106')](db[_0x6339('0x1c7')],{'as':_0x6339('0x1b5'),'onDelete':_0x6339('0x104'),'foreignKey':'SubjectId'});db[_0x6339('0x1c6')][_0x6339('0x106')](db[_0x6339('0x1c7')],{'as':_0x6339('0x1b8'),'onDelete':'cascade','foreignKey':_0x6339('0x1bc')});db[_0x6339('0x1c6')][_0x6339('0x106')](db[_0x6339('0x1c7')],{'as':_0x6339('0x1b1'),'onDelete':'cascade','foreignKey':_0x6339('0x1b9')});db[_0x6339('0x1c6')][_0x6339('0x114')](db[_0x6339('0xab')],{'as':_0x6339('0x168'),'foreignKey':'AccountId'});db[_0x6339('0x1c6')][_0x6339('0x11a')](db[_0x6339('0x83')],{'through':_0x6339('0x1c8')});db[_0x6339('0x1c7')][_0x6339('0x106')](db[_0x6339('0x1c7')],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0x1c7')]['hasMany'](db[_0x6339('0x1c7')],{'as':'Description','foreignKey':_0x6339('0x1bc')});db[_0x6339('0x1c7')]['hasMany'](db[_0x6339('0x1c7')],{'as':_0x6339('0x1bd'),'foreignKey':_0x6339('0x1b9')});db['FreshdeskField'][_0x6339('0x114')](db['Variable'],{'as':_0x6339('0x88'),'foreignKey':_0x6339('0x1be')});db[_0x6339('0xae')][_0x6339('0x106')](db['VtigerConfiguration'],{'as':_0x6339('0x1b3'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b4')});db['VtigerConfiguration'][_0x6339('0x106')](db[_0x6339('0xb1')],{'as':_0x6339('0x1b5'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x6339('0x106')](db['VtigerField'],{'as':_0x6339('0x1b8'),'foreignKey':_0x6339('0x1bc')});db[_0x6339('0xb0')][_0x6339('0x106')](db[_0x6339('0xb1')],{'as':_0x6339('0x1b1'),'foreignKey':_0x6339('0x1b9')});db['VtigerConfiguration'][_0x6339('0x114')](db[_0x6339('0xae')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x1b4')});db['VtigerField'][_0x6339('0x106')](db[_0x6339('0xb1')],{'as':_0x6339('0x1ba'),'foreignKey':'SubjectId'});db[_0x6339('0xb1')][_0x6339('0x106')](db['VtigerField'],{'as':_0x6339('0x1bb'),'foreignKey':_0x6339('0x1bc')});db[_0x6339('0xb1')][_0x6339('0x106')](db[_0x6339('0xb1')],{'as':'Field','foreignKey':_0x6339('0x1b9')});db[_0x6339('0xb1')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x6339('0xb3')][_0x6339('0x106')](db[_0x6339('0x1c9')],{'as':'Configurations','onDelete':_0x6339('0x104'),'foreignKey':'AccountId'});db[_0x6339('0x1c9')]['hasMany'](db[_0x6339('0xb6')],{'as':_0x6339('0x1b5'),'foreignKey':'SubjectId'});db[_0x6339('0x1c9')][_0x6339('0x106')](db[_0x6339('0xb6')],{'as':_0x6339('0x1b8'),'foreignKey':'DescriptionId'});db[_0x6339('0x1c9')]['hasMany'](db[_0x6339('0xb6')],{'as':_0x6339('0x1b1'),'foreignKey':_0x6339('0x1b9')});db[_0x6339('0x1c9')][_0x6339('0x114')](db['ServicenowAccount'],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x1b4')});db['ServicenowField'][_0x6339('0x106')](db[_0x6339('0xb6')],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0xb6')]['hasMany'](db['ServicenowField'],{'as':_0x6339('0x1bb'),'foreignKey':'DescriptionId'});db[_0x6339('0xb6')][_0x6339('0x106')](db[_0x6339('0xb6')],{'as':'Field','foreignKey':_0x6339('0x1b9')});db[_0x6339('0xb6')]['belongsTo'](db[_0x6339('0x88')],{'as':_0x6339('0x88'),'foreignKey':_0x6339('0x1be')});db['Dynamics365Account'][_0x6339('0x106')](db[_0x6339('0xb9')],{'as':'Configurations','onDelete':_0x6339('0x104'),'foreignKey':'AccountId'});db[_0x6339('0xb9')][_0x6339('0x106')](db[_0x6339('0xbb')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x6339('0x1b6')});db['Dynamics365Configuration'][_0x6339('0x106')](db[_0x6339('0xbb')],{'as':_0x6339('0x1b8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6339('0xb9')][_0x6339('0x106')](db[_0x6339('0xbb')],{'as':_0x6339('0x1b1'),'onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1b9')});db[_0x6339('0xb9')][_0x6339('0x114')](db[_0x6339('0xb8')],{'as':_0x6339('0x168'),'foreignKey':'AccountId'});db[_0x6339('0xbb')][_0x6339('0x106')](db[_0x6339('0xbb')],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0xbb')][_0x6339('0x106')](db[_0x6339('0xbb')],{'as':'Description','foreignKey':_0x6339('0x1bc')});db['Dynamics365Field']['hasMany'](db[_0x6339('0xbb')],{'as':'Field','foreignKey':_0x6339('0x1b9')});db[_0x6339('0xbb')][_0x6339('0x114')](db['Variable'],{'as':_0x6339('0x88'),'foreignKey':_0x6339('0x1be')});db[_0x6339('0xbd')][_0x6339('0x106')](db[_0x6339('0xbe')],{'as':_0x6339('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db[_0x6339('0xc0')],{'as':_0x6339('0x1b5'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0xbe')][_0x6339('0x106')](db[_0x6339('0xc0')],{'as':_0x6339('0x1b8'),'foreignKey':_0x6339('0x1bc')});db['FreshsalesConfiguration'][_0x6339('0x106')](db['FreshsalesField'],{'as':_0x6339('0x1b1'),'foreignKey':_0x6339('0x1b9')});db[_0x6339('0xbe')]['belongsTo'](db[_0x6339('0xbd')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x1b4')});db[_0x6339('0xc0')][_0x6339('0x106')](db['FreshsalesField'],{'as':_0x6339('0x1ba'),'foreignKey':_0x6339('0x1b6')});db[_0x6339('0xc0')][_0x6339('0x106')](db['FreshsalesField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x6339('0xc0')],{'as':_0x6339('0x1bd'),'foreignKey':_0x6339('0x1b9')});db['FreshsalesField'][_0x6339('0x114')](db[_0x6339('0x88')],{'as':'Variable','foreignKey':_0x6339('0x1be')});db[_0x6339('0x1ca')][_0x6339('0x114')](db[_0x6339('0x59')],{});db['ChatQueueReport'][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':'List','foreignKey':_0x6339('0x170')});db['ChatQueueReport'][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db['ChatQueueReport']['belongsTo'](db['ChatInteraction'],{});db[_0x6339('0x1ca')][_0x6339('0x114')](db['ChatMessage'],{});db['ChatQueueReport'][_0x6339('0x114')](db['User'],{});db[_0x6339('0x1ca')]['belongsTo'](db[_0x6339('0x62')],{});db[_0x6339('0xc3')][_0x6339('0x114')](db[_0x6339('0x103')],{'onDelete':_0x6339('0x104'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x6339('0x114')](db[_0x6339('0x103')],{'onDelete':_0x6339('0x104'),'foreignKey':'ToId'});db[_0x6339('0xc9')][_0x6339('0x106')](db[_0x6339('0xc7')],{'foreignKey':_0x6339('0x1cb'),'onDelete':_0x6339('0x104')});db[_0x6339('0xc9')][_0x6339('0x106')](db['JscriptyAnswerReport'],{'foreignKey':_0x6339('0x1cb'),'onDelete':_0x6339('0x104')});db[_0x6339('0x1cc')][_0x6339('0x114')](db['SmsAccount'],{});db[_0x6339('0x1cc')]['belongsTo'](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':'ListId'});db[_0x6339('0x1cc')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':'ContactId'});db[_0x6339('0x1cc')][_0x6339('0x114')](db[_0x6339('0x53')],{});db['SmsQueueReport'][_0x6339('0x114')](db['SmsMessage'],{});db[_0x6339('0x1cc')]['belongsTo'](db['User'],{});db[_0x6339('0x1cc')]['belongsTo'](db['SmsQueue'],{});db[_0x6339('0xce')][_0x6339('0x106')](db[_0x6339('0xc9')],{'foreignKey':_0x6339('0x1cd')});db['JscriptyProject'][_0x6339('0x106')](db[_0x6339('0xc7')],{'foreignKey':_0x6339('0x1cd')});db[_0x6339('0xce')]['hasMany'](db[_0x6339('0xc5')],{'foreignKey':_0x6339('0x1cd')});db['SquareProject']['belongsToMany'](db[_0x6339('0x103')],{'as':'Users','through':_0x6339('0x136')});db[_0x6339('0xd8')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x11c')});db[_0x6339('0xd8')]['belongsToMany'](db[_0x6339('0x19')],{'through':_0x6339('0x14c'),'as':'VoiceQueues'});db[_0x6339('0xd8')][_0x6339('0x11a')](db[_0x6339('0x3b')],{'through':_0x6339('0x15e'),'as':_0x6339('0x1ce')});db[_0x6339('0xd8')][_0x6339('0x11a')](db['ChatQueue'],{'through':_0x6339('0x190'),'as':_0x6339('0x122')});db['Team'][_0x6339('0x11a')](db[_0x6339('0x4c')],{'through':'team_has_fax_queues','as':_0x6339('0x1cf')});db['Team'][_0x6339('0x11a')](db[_0x6339('0x56')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x6339('0xd8')]['belongsToMany'](db[_0x6339('0x183')],{'through':_0x6339('0x188'),'as':_0x6339('0x125')});db[_0x6339('0xd8')][_0x6339('0x11a')](db[_0x6339('0x126')],{'through':_0x6339('0x1d0'),'as':_0x6339('0x127')});db[_0x6339('0xdb')]['hasMany'](db[_0x6339('0x13e')],{'as':_0x6339('0x193'),'foreignKey':_0x6339('0x198')});db['Campaign'][_0x6339('0x106')](db[_0x6339('0x6d')],{'as':_0x6339('0x10a'),'foreignKey':_0x6339('0x198')});db[_0x6339('0xdb')][_0x6339('0x106')](db[_0x6339('0x6f')],{'as':_0x6339('0x194'),'foreignKey':_0x6339('0x198')});db[_0x6339('0xdb')][_0x6339('0x106')](db[_0x6339('0x13f')],{'as':_0x6339('0x140'),'foreignKey':'CampaignId'});db['Campaign'][_0x6339('0x114')](db[_0x6339('0x28')],{'as':_0x6339('0x28'),'foreignKey':_0x6339('0x142')});db[_0x6339('0xdb')][_0x6339('0x114')](db['Trunk'],{'as':_0x6339('0x143'),'foreignKey':_0x6339('0x144')});db[_0x6339('0xdb')][_0x6339('0x114')](db[_0x6339('0x16c')],{'as':_0x6339('0x16c'),'foreignKey':_0x6339('0x145')});db[_0x6339('0xdb')][_0x6339('0x114')](db[_0x6339('0x1d1')],{'as':_0x6339('0x1d1'),'foreignKey':_0x6339('0x1d2')});db[_0x6339('0xdb')][_0x6339('0x11a')](db[_0x6339('0xe9')],{'as':_0x6339('0x148'),'through':_0x6339('0x1d3')});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0x6339('0x1d4'),'through':'campaigns_has_cm_blacklists'});db[_0x6339('0xe1')][_0x6339('0x114')](db[_0x6339('0x3f')],{});db['MailTransferReport'][_0x6339('0x114')](db[_0x6339('0x15f')],{});db[_0x6339('0xe1')][_0x6339('0x114')](db[_0x6339('0x3a')],{'foreignKey':_0x6339('0x1d5'),'as':_0x6339('0x1d6')});db[_0x6339('0xe1')][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':_0x6339('0x1d7'),'as':_0x6339('0x1d8')});db[_0x6339('0xe1')][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':_0x6339('0x1d9'),'as':_0x6339('0x1da')});db[_0x6339('0xe1')][_0x6339('0x114')](db[_0x6339('0x3b')],{'foreignKey':_0x6339('0x1db'),'as':'ToQueue'});db['MailTransferReport'][_0x6339('0x114')](db[_0x6339('0x3a')],{'foreignKey':_0x6339('0x1dc'),'as':_0x6339('0x1dd')});db[_0x6339('0xe3')][_0x6339('0x114')](db['ChatMessage'],{});db[_0x6339('0xe3')][_0x6339('0x114')](db[_0x6339('0x5d')],{});db[_0x6339('0xe3')][_0x6339('0x114')](db[_0x6339('0x59')],{'foreignKey':_0x6339('0x1de'),'as':_0x6339('0x1d6')});db['ChatTransferReport'][_0x6339('0x114')](db['User'],{'foreignKey':'FromUserId','as':_0x6339('0x1d8')});db[_0x6339('0xe3')][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':'ToUserId','as':_0x6339('0x1da')});db[_0x6339('0xe3')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x6339('0x1df'),'as':_0x6339('0x1e0')});db[_0x6339('0xe3')][_0x6339('0x114')](db[_0x6339('0x59')],{'foreignKey':_0x6339('0x1e1'),'as':'ToAccount'});db[_0x6339('0xe4')][_0x6339('0x114')](db['FaxMessage'],{});db['FaxTransferReport'][_0x6339('0x114')](db[_0x6339('0x49')],{});db[_0x6339('0xe4')][_0x6339('0x114')](db[_0x6339('0x12c')],{'foreignKey':_0x6339('0x1e2'),'as':'FromAccount'});db['FaxTransferReport'][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':_0x6339('0x1d7'),'as':'FromAgent'});db['FaxTransferReport'][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':_0x6339('0x1d9'),'as':_0x6339('0x1da')});db['FaxTransferReport'][_0x6339('0x114')](db['FaxQueue'],{'foreignKey':_0x6339('0x1e3'),'as':_0x6339('0x1e0')});db[_0x6339('0xe4')][_0x6339('0x114')](db[_0x6339('0x12c')],{'foreignKey':_0x6339('0x1e4'),'as':_0x6339('0x1dd')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6339('0x187')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x6339('0x10c')],{});db[_0x6339('0x1e5')][_0x6339('0x114')](db[_0x6339('0x180')],{'foreignKey':_0x6339('0x1e6'),'as':_0x6339('0x1d6')});db[_0x6339('0x1e5')][_0x6339('0x114')](db['User'],{'foreignKey':_0x6339('0x1d7'),'as':'FromAgent'});db[_0x6339('0x1e5')][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':_0x6339('0x1d9'),'as':_0x6339('0x1da')});db[_0x6339('0x1e5')][_0x6339('0x114')](db[_0x6339('0x183')],{'foreignKey':_0x6339('0x1e7'),'as':_0x6339('0x1e0')});db[_0x6339('0x1e5')][_0x6339('0x114')](db[_0x6339('0x180')],{'foreignKey':'ToOpenchannelAccountId','as':_0x6339('0x1dd')});db['SmsTransferReport'][_0x6339('0x114')](db[_0x6339('0x17b')],{});db[_0x6339('0xe7')][_0x6339('0x114')](db[_0x6339('0x53')],{});db[_0x6339('0xe7')][_0x6339('0x114')](db[_0x6339('0x4f')],{'foreignKey':'FromSmsAccountId','as':_0x6339('0x1d6')});db[_0x6339('0xe7')][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':_0x6339('0x1d7'),'as':_0x6339('0x1d8')});db['SmsTransferReport'][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':'ToUserId','as':_0x6339('0x1da')});db[_0x6339('0xe7')][_0x6339('0x114')](db['SmsQueue'],{'foreignKey':_0x6339('0x1e8'),'as':_0x6339('0x1e0')});db[_0x6339('0xe7')][_0x6339('0x114')](db[_0x6339('0x4f')],{'foreignKey':'ToSmsAccountId','as':_0x6339('0x1dd')});db['CmList'][_0x6339('0x106')](db[_0x6339('0x171')],{'as':_0x6339('0x15b'),'foreignKey':_0x6339('0x170')});db[_0x6339('0xe9')][_0x6339('0x106')](db['CmCustomField'],{'as':_0x6339('0x1e9'),'foreignKey':'ListId'});db[_0x6339('0xe9')][_0x6339('0x106')](db['CmContact'],{'as':_0x6339('0x118'),'onDelete':'cascade','foreignKey':_0x6339('0x170')});db[_0x6339('0xe9')][_0x6339('0x106')](db[_0x6339('0x6d')],{'as':_0x6339('0x10a'),'foreignKey':'ListId'});db[_0x6339('0xe9')][_0x6339('0x106')](db[_0x6339('0x6f')],{'as':_0x6339('0x10b'),'foreignKey':'ListId'});db[_0x6339('0xe9')][_0x6339('0x106')](db[_0x6339('0x71')],{'as':_0x6339('0x71'),'foreignKey':'ListId'});db[_0x6339('0xe9')][_0x6339('0x11a')](db['VoiceQueue'],{'as':_0x6339('0x1ea'),'through':_0x6339('0x149')});db[_0x6339('0xe9')]['belongsToMany'](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x11b')});db[_0x6339('0xeb')]['hasMany'](db[_0x6339('0x137')],{'as':_0x6339('0x109'),'onDelete':_0x6339('0x104')});db[_0x6339('0xeb')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x129')});db[_0x6339('0xed')]['hasMany'](db[_0x6339('0x103')],{'as':_0x6339('0x164'),'foreignKey':_0x6339('0x115')});db[_0x6339('0xed')][_0x6339('0x106')](db[_0x6339('0xef')],{'as':_0x6339('0x1eb'),'foreignKey':_0x6339('0x115'),'onDelete':_0x6339('0x104')});db[_0x6339('0xef')]['hasMany'](db[_0x6339('0xf0')],{'as':_0x6339('0x1ec'),'foreignKey':_0x6339('0x1ed'),'onDelete':_0x6339('0x104')});db['WhatsappAccount'][_0x6339('0x106')](db[_0x6339('0x171')],{'as':_0x6339('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0x6339('0xf4')][_0x6339('0x106')](db['CannedAnswer'],{'as':_0x6339('0x15c'),'foreignKey':_0x6339('0x1ee')});db[_0x6339('0xf4')][_0x6339('0x106')](db['WhatsappMessage'],{'as':_0x6339('0x14e'),'foreignKey':_0x6339('0x1ee')});db['WhatsappAccount'][_0x6339('0x106')](db[_0x6339('0xf7')],{'as':'Interactions'});db[_0x6339('0xf4')][_0x6339('0x106')](db[_0x6339('0x1ef')],{'as':_0x6339('0x139')});db[_0x6339('0xf4')][_0x6339('0x114')](db[_0x6339('0xe9')],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170')});db[_0x6339('0xf4')][_0x6339('0x114')](db[_0x6339('0x7c')],{'as':_0x6339('0x146'),'foreignKey':_0x6339('0x147')});db[_0x6339('0xf4')]['belongsToMany'](db['User'],{'as':_0x6339('0x14a'),'through':'user_has_whatsapp_accounts'});db[_0x6339('0x1ef')][_0x6339('0x114')](db['User'],{'onDelete':_0x6339('0x16b')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x6339('0x16b')});db[_0x6339('0x1ef')][_0x6339('0x114')](db[_0x6339('0xf4')],{'onDelete':_0x6339('0x16b')});db[_0x6339('0x1ef')][_0x6339('0x114')](db[_0x6339('0x16c')],{'onDelete':_0x6339('0x16b'),'foreignKey':'IntervalId'});db[_0x6339('0x1ef')][_0x6339('0x114')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x6339('0xf7')]['hasMany'](db[_0x6339('0xf9')],{'as':'Messages','onDelete':_0x6339('0x104'),'foreignKey':_0x6339('0x1f0')});db[_0x6339('0xf7')][_0x6339('0x114')](db[_0x6339('0xf4')],{'as':_0x6339('0x168'),'foreignKey':_0x6339('0x1ee')});db[_0x6339('0xf7')]['belongsTo'](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db[_0x6339('0xf7')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x161'),'foreignKey':_0x6339('0x105')});db[_0x6339('0xf7')][_0x6339('0x11a')](db['Tag'],{'through':_0x6339('0x1aa'),'as':_0x6339('0x162')});db[_0x6339('0xf7')]['belongsToMany'](db[_0x6339('0x83')],{'through':_0x6339('0x1aa'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':'Users','through':_0x6339('0x1f1'),'foreignKey':'WhatsappInteractionId'});db[_0x6339('0xf9')][_0x6339('0x114')](db[_0x6339('0x103')],{'as':_0x6339('0x103')});db[_0x6339('0xf9')][_0x6339('0x114')](db['CmContact'],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x160')});db[_0x6339('0xf9')][_0x6339('0x114')](db[_0x6339('0xf7')],{'onDelete':_0x6339('0x104'),'as':_0x6339('0x167'),'foreignKey':_0x6339('0x1f0')});db['WhatsappMessage'][_0x6339('0x114')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x6339('0x1ee')});db[_0x6339('0xfb')]['belongsTo'](db[_0x6339('0xf4')],{});db[_0x6339('0xfb')][_0x6339('0x114')](db['CmList'],{'as':_0x6339('0x16f'),'foreignKey':_0x6339('0x170')});db[_0x6339('0xfb')][_0x6339('0x114')](db[_0x6339('0x69')],{'as':_0x6339('0x160'),'foreignKey':_0x6339('0x155')});db['WhatsappQueueReport'][_0x6339('0x114')](db[_0x6339('0xf7')],{});db['WhatsappQueueReport'][_0x6339('0x114')](db['WhatsappQueue'],{});db[_0x6339('0xfb')][_0x6339('0x114')](db[_0x6339('0xf9')],{});db[_0x6339('0xfb')][_0x6339('0x114')](db[_0x6339('0x103')],{});db[_0x6339('0xfd')][_0x6339('0x114')](db[_0x6339('0xf9')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x6339('0xf7')],{});db[_0x6339('0xfd')][_0x6339('0x114')](db[_0x6339('0xf4')],{'foreignKey':_0x6339('0x1f2'),'as':_0x6339('0x1d6')});db[_0x6339('0xfd')][_0x6339('0x114')](db[_0x6339('0xf4')],{'foreignKey':'ToWhatsappAccountId','as':_0x6339('0x1dd')});db[_0x6339('0xfd')][_0x6339('0x114')](db[_0x6339('0x126')],{'foreignKey':_0x6339('0x1f3'),'as':_0x6339('0x1e0')});db[_0x6339('0xfd')][_0x6339('0x114')](db['User'],{'foreignKey':_0x6339('0x1d7'),'as':_0x6339('0x1d8')});db[_0x6339('0xfd')][_0x6339('0x114')](db[_0x6339('0x103')],{'foreignKey':_0x6339('0x1d9'),'as':_0x6339('0x1da')});db[_0x6339('0x126')][_0x6339('0x11a')](db[_0x6339('0x103')],{'as':_0x6339('0x14a'),'through':_0x6339('0x36'),'foreignKey':_0x6339('0x1f4')});db[_0x6339('0x126')][_0x6339('0x11a')](db[_0x6339('0xd8')],{'through':_0x6339('0x1d0'),'as':_0x6339('0x14b')});module[_0x6339('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ac030a2..b03fa35 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x237b=['/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','./api/webbar','/apidoc','root','/www','join','/demo','static','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','username','password','newPassword','apiKey','firstName','phone','mobile','fax','clientSecret','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','oldPassword','isPlainObject','isArray','length','replace','@@{','}@@','lodash','path','express','express-winston','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','./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'];(function(_0x1d2a1d,_0x49fbea){var _0x19c046=function(_0x2c9cd0){while(--_0x2c9cd0){_0x1d2a1d['push'](_0x1d2a1d['shift']());}};_0x19c046(++_0x49fbea);}(_0x237b,0x1a7));var _0xb237=function(_0x5ba54f,_0x4ffa21){_0x5ba54f=_0x5ba54f-0x0;var _0x403820=_0x237b[_0x5ba54f];return _0x403820;};'use strict';var _=require(_0xb237('0x0'));var path=require(_0xb237('0x1'));var express=require(_0xb237('0x2'));var ewinston=require(_0xb237('0x3'));var util=require('util');var errors=require(_0xb237('0x4'));var config=require(_0xb237('0x5'));var logger=require('./config/logger')(_0xb237('0x6'));var authLogger=require(_0xb237('0x7'))(_0xb237('0x8'));exports[_0xb237('0x9')]=function(_0x5539f1){_0x5539f1[_0xb237('0xa')](ewinston[_0xb237('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x547910,_0x1b1184){var _0x4a3065=_0xb237('0xc');if(!_[_0xb237('0xd')](_0x547910[_0xb237('0xe')])){_0x4a3065+=_0xb237('0xf');var _0x21116e=_0x547910[_0xb237('0xe')];maskSensitiveData(_0x21116e);}return util[_0xb237('0x10')](_0x4a3065,_0x547910['method'],_0x547910[_0xb237('0x11')][_0xb237('0x12')]?_0x547910[_0xb237('0x11')][_0xb237('0x12')]:_0x547910[_0xb237('0x13')][_0xb237('0x14')]||_0x547910['ip'],_0x547910[_0xb237('0x15')],_0x1b1184[_0xb237('0x16')],_0x1b1184[_0xb237('0x17')],_0x547910[_0xb237('0x18')]?_0x547910[_0xb237('0x18')]['id']:null,_0x547910[_0xb237('0x18')]?_0x547910['user'][_0xb237('0x19')]:null,_0x547910[_0xb237('0x18')]?_0x547910[_0xb237('0x18')][_0xb237('0x1a')]:null,_0x21116e?util['inspect'](_0x21116e,![],null):'');}}));_0x5539f1[_0xb237('0xa')](ewinston[_0xb237('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1e8ab5,_0x17a71a){var _0x465c5c=_0xb237('0x1b');if(_0x1e8ab5[_0xb237('0xe')]&&_0x1e8ab5[_0xb237('0xe')][_0xb237('0x1c')]&&_0x1e8ab5[_0xb237('0xe')][_0xb237('0x1d')]){_0x465c5c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xb237('0x10')](_0x465c5c,_0x1e8ab5[_0xb237('0x1e')],_0x1e8ab5['headers'][_0xb237('0x12')]?_0x1e8ab5['headers'][_0xb237('0x12')]:_0x1e8ab5[_0xb237('0x13')][_0xb237('0x14')]||_0x1e8ab5['ip'],_0x1e8ab5[_0xb237('0x15')],_0x17a71a[_0xb237('0x16')],_0x17a71a[_0xb237('0x17')],_0x1e8ab5[_0xb237('0x18')]?_0x1e8ab5[_0xb237('0x18')]['id']:null,_0x1e8ab5[_0xb237('0x18')]?_0x1e8ab5['user']['name']:null,_0x1e8ab5[_0xb237('0x18')]?_0x1e8ab5['user']['role']:null,_0x1e8ab5['body']&&_0x1e8ab5[_0xb237('0xe')][_0xb237('0x1c')]?_0x1e8ab5[_0xb237('0xe')][_0xb237('0x1c')]:'other',_0x1e8ab5[_0xb237('0xe')]&&_0x1e8ab5['body'][_0xb237('0x1d')]?_0x1e8ab5['body'][_0xb237('0x1d')]:'',_0x1e8ab5[_0xb237('0xe')]&&_0x1e8ab5['body'][_0xb237('0x1f')]?_0x1e8ab5[_0xb237('0xe')][_0xb237('0x1f')]:'');},'ignoreRoute':function(_0x1ffdae){var _0x15a902=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x15a902[_0xb237('0x20')](_0x1ffdae[_0xb237('0x15')]);}}));_0x5539f1['use'](_0xb237('0x21'),require(_0xb237('0x22')));_0x5539f1['use'](_0xb237('0x23'),require('./api/voiceChanSpy'));_0x5539f1['use']('/api/voice/contexts',require(_0xb237('0x24')));_0x5539f1['use'](_0xb237('0x25'),require(_0xb237('0x26')));_0x5539f1[_0xb237('0xa')]('/api/voice/mohs',require(_0xb237('0x27')));_0x5539f1[_0xb237('0xa')](_0xb237('0x28'),require(_0xb237('0x29')));_0x5539f1[_0xb237('0xa')](_0xb237('0x2a'),require(_0xb237('0x2b')));_0x5539f1['use'](_0xb237('0x2c'),require(_0xb237('0x2d')));_0x5539f1['use'](_0xb237('0x2e'),require(_0xb237('0x2f')));_0x5539f1[_0xb237('0xa')](_0xb237('0x30'),require('./api/voiceMailMessage'));_0x5539f1['use']('/api/voice/calls/reports',require(_0xb237('0x31')));_0x5539f1[_0xb237('0xa')](_0xb237('0x32'),require(_0xb237('0x33')));_0x5539f1[_0xb237('0xa')](_0xb237('0x34'),require(_0xb237('0x35')));_0x5539f1['use'](_0xb237('0x36'),require(_0xb237('0x37')));_0x5539f1[_0xb237('0xa')](_0xb237('0x38'),require(_0xb237('0x39')));_0x5539f1[_0xb237('0xa')](_0xb237('0x3a'),require(_0xb237('0x3b')));_0x5539f1[_0xb237('0xa')]('/api/voice/transfers/reports',require(_0xb237('0x3c')));_0x5539f1[_0xb237('0xa')](_0xb237('0x3d'),require(_0xb237('0x3e')));_0x5539f1[_0xb237('0xa')](_0xb237('0x3f'),require(_0xb237('0x40')));_0x5539f1[_0xb237('0xa')](_0xb237('0x41'),require(_0xb237('0x42')));_0x5539f1[_0xb237('0xa')](_0xb237('0x43'),require(_0xb237('0x44')));_0x5539f1[_0xb237('0xa')]('/api/mail/interactions',require(_0xb237('0x45')));_0x5539f1[_0xb237('0xa')](_0xb237('0x46'),require(_0xb237('0x47')));_0x5539f1['use'](_0xb237('0x48'),require(_0xb237('0x49')));_0x5539f1[_0xb237('0xa')](_0xb237('0x4a'),require(_0xb237('0x4b')));_0x5539f1[_0xb237('0xa')](_0xb237('0x4c'),require(_0xb237('0x4d')));_0x5539f1[_0xb237('0xa')](_0xb237('0x4e'),require(_0xb237('0x4f')));_0x5539f1[_0xb237('0xa')](_0xb237('0x50'),require(_0xb237('0x51')));_0x5539f1[_0xb237('0xa')](_0xb237('0x52'),require(_0xb237('0x53')));_0x5539f1[_0xb237('0xa')]('/api/fax/interactions',require('./api/faxInteraction'));_0x5539f1[_0xb237('0xa')](_0xb237('0x54'),require(_0xb237('0x55')));_0x5539f1['use'](_0xb237('0x56'),require(_0xb237('0x57')));_0x5539f1[_0xb237('0xa')](_0xb237('0x58'),require(_0xb237('0x59')));_0x5539f1[_0xb237('0xa')]('/api/sms/accounts',require('./api/smsAccount'));_0x5539f1[_0xb237('0xa')](_0xb237('0x5a'),require(_0xb237('0x5b')));_0x5539f1[_0xb237('0xa')]('/api/sms/interactions',require(_0xb237('0x5c')));_0x5539f1[_0xb237('0xa')](_0xb237('0x5d'),require('./api/smsMessage'));_0x5539f1[_0xb237('0xa')](_0xb237('0x5e'),require(_0xb237('0x5f')));_0x5539f1[_0xb237('0xa')](_0xb237('0x60'),require('./api/openchannelAccount'));_0x5539f1['use']('/api/openchannel/applications',require(_0xb237('0x61')));_0x5539f1[_0xb237('0xa')](_0xb237('0x62'),require(_0xb237('0x63')));_0x5539f1['use'](_0xb237('0x64'),require(_0xb237('0x65')));_0x5539f1[_0xb237('0xa')]('/api/openchannel/queues',require(_0xb237('0x66')));_0x5539f1[_0xb237('0xa')]('/api/chat/websites',require(_0xb237('0x67')));_0x5539f1[_0xb237('0xa')](_0xb237('0x68'),require(_0xb237('0x69')));_0x5539f1['use'](_0xb237('0x6a'),require('./api/chatApplication'));_0x5539f1['use'](_0xb237('0x6b'),require(_0xb237('0x6c')));_0x5539f1[_0xb237('0xa')](_0xb237('0x6d'),require(_0xb237('0x6e')));_0x5539f1[_0xb237('0xa')]('/api/chat/offline_messages',require(_0xb237('0x6f')));_0x5539f1[_0xb237('0xa')](_0xb237('0x70'),require(_0xb237('0x71')));_0x5539f1[_0xb237('0xa')](_0xb237('0x72'),require(_0xb237('0x73')));_0x5539f1[_0xb237('0xa')](_0xb237('0x74'),require('./api/chatProactiveAction'));_0x5539f1['use'](_0xb237('0x75'),require(_0xb237('0x76')));_0x5539f1[_0xb237('0xa')](_0xb237('0x77'),require(_0xb237('0x78')));_0x5539f1[_0xb237('0xa')]('/api/cm/hopper',require(_0xb237('0x79')));_0x5539f1[_0xb237('0xa')](_0xb237('0x7a'),require('./api/cmHopperBlack'));_0x5539f1[_0xb237('0xa')](_0xb237('0x7b'),require('./api/cmHopperFinal'));_0x5539f1[_0xb237('0xa')](_0xb237('0x7c'),require(_0xb237('0x7d')));_0x5539f1[_0xb237('0xa')](_0xb237('0x7e'),require(_0xb237('0x7f')));_0x5539f1['use'](_0xb237('0x80'),require(_0xb237('0x81')));_0x5539f1['use']('/api/automations',require(_0xb237('0x82')));_0x5539f1['use'](_0xb237('0x83'),require(_0xb237('0x84')));_0x5539f1[_0xb237('0xa')](_0xb237('0x85'),require('./api/disposition'));_0x5539f1[_0xb237('0xa')](_0xb237('0x86'),require(_0xb237('0x87')));_0x5539f1[_0xb237('0xa')]('/api/intervals',require(_0xb237('0x88')));_0x5539f1[_0xb237('0xa')](_0xb237('0x89'),require(_0xb237('0x8a')));_0x5539f1[_0xb237('0xa')]('/api/cdr',require(_0xb237('0x8b')));_0x5539f1[_0xb237('0xa')](_0xb237('0x8c'),require(_0xb237('0x8d')));_0x5539f1[_0xb237('0xa')](_0xb237('0x8e'),require(_0xb237('0x8f')));_0x5539f1[_0xb237('0xa')](_0xb237('0x90'),require(_0xb237('0x91')));_0x5539f1['use'](_0xb237('0x92'),require(_0xb237('0x93')));_0x5539f1[_0xb237('0xa')]('/api/templates',require(_0xb237('0x94')));_0x5539f1[_0xb237('0xa')]('/api/triggers',require('./api/trigger'));_0x5539f1['use'](_0xb237('0x95'),require(_0xb237('0x96')));_0x5539f1[_0xb237('0xa')](_0xb237('0x97'),require('./api/integration'));_0x5539f1[_0xb237('0xa')](_0xb237('0x98'),require(_0xb237('0x99')));_0x5539f1['use'](_0xb237('0x9a'),require(_0xb237('0x9b')));_0x5539f1['use']('/api/analytics/default_reports',require(_0xb237('0x9c')));_0x5539f1[_0xb237('0xa')]('/api/analytics/extracted_reports',require(_0xb237('0x9d')));_0x5539f1[_0xb237('0xa')]('/api/analytics/metrics',require(_0xb237('0x9e')));_0x5539f1[_0xb237('0xa')](_0xb237('0x9f'),require(_0xb237('0xa0')));_0x5539f1[_0xb237('0xa')]('/api/analytics/tree_reports',require(_0xb237('0xa1')));_0x5539f1[_0xb237('0xa')](_0xb237('0xa2'),require(_0xb237('0xa3')));_0x5539f1[_0xb237('0xa')](_0xb237('0xa4'),require(_0xb237('0xa5')));_0x5539f1[_0xb237('0xa')](_0xb237('0xa6'),require(_0xb237('0xa7')));_0x5539f1[_0xb237('0xa')](_0xb237('0xa8'),require(_0xb237('0xa9')));_0x5539f1[_0xb237('0xa')](_0xb237('0xaa'),require(_0xb237('0xab')));_0x5539f1[_0xb237('0xa')]('/api/integrations/sugarcrm/fields',require(_0xb237('0xac')));_0x5539f1[_0xb237('0xa')]('/api/integrations/desk/accounts',require(_0xb237('0xad')));_0x5539f1[_0xb237('0xa')](_0xb237('0xae'),require(_0xb237('0xaf')));_0x5539f1[_0xb237('0xa')](_0xb237('0xb0'),require(_0xb237('0xb1')));_0x5539f1[_0xb237('0xa')]('/api/integrations/zoho/accounts',require(_0xb237('0xb2')));_0x5539f1['use'](_0xb237('0xb3'),require('./api/intZohoConfiguration'));_0x5539f1['use'](_0xb237('0xb4'),require(_0xb237('0xb5')));_0x5539f1['use'](_0xb237('0xb6'),require(_0xb237('0xb7')));_0x5539f1[_0xb237('0xa')](_0xb237('0xb8'),require(_0xb237('0xb9')));_0x5539f1[_0xb237('0xa')](_0xb237('0xba'),require('./api/intZendeskField'));_0x5539f1[_0xb237('0xa')](_0xb237('0xbb'),require(_0xb237('0xbc')));_0x5539f1['use']('/api/integrations/freshdesk/configurations',require(_0xb237('0xbd')));_0x5539f1['use'](_0xb237('0xbe'),require(_0xb237('0xbf')));_0x5539f1[_0xb237('0xa')]('/api/integrations/vtiger/accounts',require(_0xb237('0xc0')));_0x5539f1['use'](_0xb237('0xc1'),require(_0xb237('0xc2')));_0x5539f1['use'](_0xb237('0xc3'),require(_0xb237('0xc4')));_0x5539f1[_0xb237('0xa')](_0xb237('0xc5'),require('./api/intServicenowAccount'));_0x5539f1[_0xb237('0xa')](_0xb237('0xc6'),require(_0xb237('0xc7')));_0x5539f1[_0xb237('0xa')](_0xb237('0xc8'),require(_0xb237('0xc9')));_0x5539f1[_0xb237('0xa')](_0xb237('0xca'),require(_0xb237('0xcb')));_0x5539f1[_0xb237('0xa')](_0xb237('0xcc'),require(_0xb237('0xcd')));_0x5539f1[_0xb237('0xa')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x5539f1['use'](_0xb237('0xce'),require(_0xb237('0xcf')));_0x5539f1['use'](_0xb237('0xd0'),require(_0xb237('0xd1')));_0x5539f1[_0xb237('0xa')]('/api/integrations/freshsales/fields',require(_0xb237('0xd2')));_0x5539f1['use'](_0xb237('0xd3'),require(_0xb237('0xd4')));_0x5539f1[_0xb237('0xa')]('/api/chat/reports/queue',require(_0xb237('0xd5')));_0x5539f1[_0xb237('0xa')]('/api/chat/internal/messages',require(_0xb237('0xd6')));_0x5539f1[_0xb237('0xa')](_0xb237('0xd7'),require(_0xb237('0xd8')));_0x5539f1['use']('/api/jscripty/questions/reports',require(_0xb237('0xd9')));_0x5539f1[_0xb237('0xa')]('/api/jscripty/sessions/reports',require(_0xb237('0xda')));_0x5539f1[_0xb237('0xa')](_0xb237('0xdb'),require(_0xb237('0xdc')));_0x5539f1[_0xb237('0xa')]('/api/square/reports',require('./api/squareReport'));_0x5539f1['use'](_0xb237('0xdd'),require('./api/squareReportDetail'));_0x5539f1['use']('/api/jscripty/projects',require(_0xb237('0xde')));_0x5539f1['use'](_0xb237('0xdf'),require('./api/setting'));_0x5539f1[_0xb237('0xa')](_0xb237('0xe0'),require(_0xb237('0xe1')));_0x5539f1[_0xb237('0xa')]('/api/square/projects',require(_0xb237('0xe2')));_0x5539f1[_0xb237('0xa')]('/api/square/recordings',require(_0xb237('0xe3')));_0x5539f1[_0xb237('0xa')](_0xb237('0xe4'),require(_0xb237('0xe5')));_0x5539f1[_0xb237('0xa')](_0xb237('0xe6'),require(_0xb237('0xe7')));_0x5539f1[_0xb237('0xa')](_0xb237('0xe8'),require(_0xb237('0xe9')));_0x5539f1[_0xb237('0xa')](_0xb237('0xea'),require('./api/campaign'));_0x5539f1['use'](_0xb237('0xeb'),require('./api/migration'));_0x5539f1['use'](_0xb237('0xec'),require(_0xb237('0xed')));_0x5539f1[_0xb237('0xa')]('/api/plugins',require(_0xb237('0xee')));_0x5539f1['use'](_0xb237('0xef'),require(_0xb237('0xf0')));_0x5539f1[_0xb237('0xa')](_0xb237('0xf1'),require(_0xb237('0xf2')));_0x5539f1[_0xb237('0xa')](_0xb237('0xf3'),require(_0xb237('0xf4')));_0x5539f1[_0xb237('0xa')]('/api/openchannel/reports/transfer',require(_0xb237('0xf5')));_0x5539f1[_0xb237('0xa')]('/api/sms/reports/transfer',require(_0xb237('0xf6')));_0x5539f1[_0xb237('0xa')](_0xb237('0xf7'),require(_0xb237('0xf8')));_0x5539f1['use'](_0xb237('0xf9'),require(_0xb237('0xfa')));_0x5539f1[_0xb237('0xa')](_0xb237('0xfb'),require(_0xb237('0xfc')));_0x5539f1[_0xb237('0xa')](_0xb237('0xfd'),require(_0xb237('0xfe')));_0x5539f1[_0xb237('0xa')](_0xb237('0xff'),require(_0xb237('0x100')));_0x5539f1[_0xb237('0xa')](_0xb237('0x101'),require(_0xb237('0x102')));_0x5539f1[_0xb237('0xa')](_0xb237('0x103'),require('./api/whatsappAccount'));_0x5539f1['use'](_0xb237('0x104'),require('./api/whatsappApplication'));_0x5539f1[_0xb237('0xa')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x5539f1['use'](_0xb237('0x105'),require(_0xb237('0x106')));_0x5539f1['use'](_0xb237('0x107'),require('./api/whatsappQueueReport'));_0x5539f1[_0xb237('0xa')]('/api/whatsapp/reports/transfer',require(_0xb237('0x108')));_0x5539f1[_0xb237('0xa')](_0xb237('0x109'),require('./api/whatsappQueue'));_0x5539f1[_0xb237('0xa')](_0xb237('0x10a'),require(_0xb237('0x10b')));_0x5539f1['use'](_0xb237('0x10c'),require(_0xb237('0x10d')));_0x5539f1[_0xb237('0xa')](_0xb237('0x10e'),require(_0xb237('0x10f')));_0x5539f1[_0xb237('0xa')](_0xb237('0x110'),require(_0xb237('0x111')));_0x5539f1[_0xb237('0xa')](_0xb237('0x112'),require(_0xb237('0x113')));_0x5539f1[_0xb237('0xa')](_0xb237('0x114'),require(_0xb237('0x115')));_0x5539f1['use'](_0xb237('0x116'),require('./api/system'));_0x5539f1[_0xb237('0xa')]('/api/pm2',require(_0xb237('0x117')));_0x5539f1['use']('/api/webbar',require(_0xb237('0x118')));_0x5539f1[_0xb237('0xa')](_0xb237('0x119'),express['static'](path['join'](config[_0xb237('0x11a')],_0xb237('0x119'))));_0x5539f1['use'](_0xb237('0x11b'),express['static'](path[_0xb237('0x11c')](config[_0xb237('0x11a')],'/www')));_0x5539f1['use'](_0xb237('0x11d'),express[_0xb237('0x11e')](path[_0xb237('0x11c')](config[_0xb237('0x11a')],'/demo')));_0x5539f1[_0xb237('0xa')](_0xb237('0x11f'),express[_0xb237('0x11e')](path['join'](config[_0xb237('0x11a')],_0xb237('0x120'),_0xb237('0x121'))));_0x5539f1[_0xb237('0xa')](_0xb237('0x122'),express['static'](path[_0xb237('0x11c')](config[_0xb237('0x11a')],_0xb237('0x123'))));_0x5539f1[_0xb237('0x124')](_0xb237('0x125'))[_0xb237('0x126')](errors[0x194]);_0x5539f1['route']('/*')['get'](function(_0x2cec9e,_0x2e4b5d){_0x2e4b5d['sendFile'](path[_0xb237('0x127')](_0x5539f1[_0xb237('0x126')]('appPath')+_0xb237('0x128')));});};var sensitiveFields=[_0xb237('0x129'),_0xb237('0x12a'),_0xb237('0x12b'),_0xb237('0x12c'),_0xb237('0x12d'),'lastName','street',_0xb237('0x12e'),_0xb237('0x12f'),_0xb237('0x130'),'email','clientId',_0xb237('0x131'),'securityToken','code','accessKey',_0xb237('0x132'),_0xb237('0x133'),_0xb237('0x134'),_0xb237('0x135'),_0xb237('0x136'),_0xb237('0x137'),_0xb237('0x138'),_0xb237('0x139'),'membername',_0xb237('0x13a'),'calleridnum','exten',_0xb237('0x13b'),'clientEmail','privateKey',_0xb237('0x13c'),_0xb237('0x13d'),_0xb237('0x13e'),'user',_0xb237('0x13f'),_0xb237('0x140'),_0xb237('0x141'),_0xb237('0x142'),'secret',_0xb237('0x143'),_0xb237('0x144')];function maskSensitiveData(_0x203457){var _0x20cad9=/(?!^)[\s\S](?!$)/g;if(!_[_0xb237('0x145')](_0x203457))return;for(var _0xce08d5 in _0x203457){if(_[_0xb237('0x146')](_0x203457[_0xce08d5])){for(var _0x3e889a=0x0;_0x3e889a<_0x203457[_0xce08d5][_0xb237('0x147')];_0x3e889a++){maskSensitiveData(_0x203457[_0xce08d5][_0x3e889a]);}}else if(_[_0xb237('0x145')](_0x203457[_0xce08d5])){maskSensitiveData(_0x203457[_0xce08d5]);}else if(_['isString'](_0x203457[_0xce08d5])){_0x203457[_0xce08d5]=_0x203457[_0xce08d5][_0xb237('0x148')](/{{{/g,_0xb237('0x149'))[_0xb237('0x148')](/}}}/g,_0xb237('0x14a'))[_0xb237('0x148')](/{{/g,'@{')[_0xb237('0x148')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0xce08d5)){_0x203457[_0xce08d5]=_0x203457[_0xce08d5][_0xb237('0x148')](_0x20cad9,'*');}}}} \ No newline at end of file +var _0x9a5e=['/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/tree_reports','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/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/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','/www','join','/demo','/snippet','snippet','1.0.16','/plugins','get','route','sendFile','resolve','appPath','username','password','newPassword','apiKey','street','phone','mobile','fax','email','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','key','pass','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','isEmpty','body','\x20body=%s','format','method','headers','connection','remoteAddress','statusCode','responseTime','user','role','inspect','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','x-forwarded-for','url','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction'];(function(_0x370859,_0x350459){var _0x1d7dae=function(_0x4361b4){while(--_0x4361b4){_0x370859['push'](_0x370859['shift']());}};_0x1d7dae(++_0x350459);}(_0x9a5e,0xee));var _0xe9a5=function(_0x4742b6,_0x53a76f){_0x4742b6=_0x4742b6-0x0;var _0x34d374=_0x9a5e[_0x4742b6];return _0x34d374;};'use strict';var _=require(_0xe9a5('0x0'));var path=require(_0xe9a5('0x1'));var express=require(_0xe9a5('0x2'));var ewinston=require(_0xe9a5('0x3'));var util=require(_0xe9a5('0x4'));var errors=require(_0xe9a5('0x5'));var config=require(_0xe9a5('0x6'));var logger=require(_0xe9a5('0x7'))(_0xe9a5('0x8'));var authLogger=require('./config/logger')(_0xe9a5('0x9'));exports[_0xe9a5('0xa')]=function(_0x462b43){_0x462b43['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x68bca4,_0x59d668){var _0xacd9ec='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xe9a5('0xb')](_0x68bca4[_0xe9a5('0xc')])){_0xacd9ec+=_0xe9a5('0xd');var _0x1d69fa=_0x68bca4['body'];maskSensitiveData(_0x1d69fa);}return util[_0xe9a5('0xe')](_0xacd9ec,_0x68bca4[_0xe9a5('0xf')],_0x68bca4[_0xe9a5('0x10')]['x-forwarded-for']?_0x68bca4[_0xe9a5('0x10')]['x-forwarded-for']:_0x68bca4[_0xe9a5('0x11')][_0xe9a5('0x12')]||_0x68bca4['ip'],_0x68bca4['url'],_0x59d668[_0xe9a5('0x13')],_0x59d668[_0xe9a5('0x14')],_0x68bca4[_0xe9a5('0x15')]?_0x68bca4[_0xe9a5('0x15')]['id']:null,_0x68bca4['user']?_0x68bca4[_0xe9a5('0x15')]['name']:null,_0x68bca4[_0xe9a5('0x15')]?_0x68bca4[_0xe9a5('0x15')][_0xe9a5('0x16')]:null,_0x1d69fa?util[_0xe9a5('0x17')](_0x1d69fa,![],null):'');}}));_0x462b43[_0xe9a5('0x18')](ewinston[_0xe9a5('0x19')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x592689,_0x3302f2){var _0x29761e=_0xe9a5('0x1a');if(_0x592689[_0xe9a5('0xc')]&&_0x592689['body'][_0xe9a5('0x1b')]&&_0x592689['body']['agent_id']){_0x29761e=_0xe9a5('0x1c');}return util[_0xe9a5('0xe')](_0x29761e,_0x592689[_0xe9a5('0xf')],_0x592689[_0xe9a5('0x10')][_0xe9a5('0x1d')]?_0x592689[_0xe9a5('0x10')][_0xe9a5('0x1d')]:_0x592689['connection'][_0xe9a5('0x12')]||_0x592689['ip'],_0x592689[_0xe9a5('0x1e')],_0x3302f2[_0xe9a5('0x13')],_0x3302f2[_0xe9a5('0x14')],_0x592689[_0xe9a5('0x15')]?_0x592689[_0xe9a5('0x15')]['id']:null,_0x592689['user']?_0x592689['user']['name']:null,_0x592689[_0xe9a5('0x15')]?_0x592689['user'][_0xe9a5('0x16')]:null,_0x592689['body']&&_0x592689['body']['device']?_0x592689['body'][_0xe9a5('0x1b')]:'other',_0x592689[_0xe9a5('0xc')]&&_0x592689['body']['agent_id']?_0x592689['body'][_0xe9a5('0x1f')]:'',_0x592689['body']&&_0x592689[_0xe9a5('0xc')][_0xe9a5('0x20')]?_0x592689[_0xe9a5('0xc')][_0xe9a5('0x20')]:'');},'ignoreRoute':function(_0x2eee61){var _0x42d217=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x42d217['test'](_0x2eee61['url']);}}));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x21'),require(_0xe9a5('0x22')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x23'),require('./api/voiceChanSpy'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x24'),require('./api/voiceContext'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x25'),require('./api/voiceExtension'));_0x462b43[_0xe9a5('0x18')]('/api/voice/mohs',require(_0xe9a5('0x26')));_0x462b43[_0xe9a5('0x18')]('/api/voice/queues',require(_0xe9a5('0x27')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x28'),require('./api/voiceRecording'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x29'),require('./api/screenRecording'));_0x462b43[_0xe9a5('0x18')]('/api/voice/mails',require(_0xe9a5('0x2a')));_0x462b43['use'](_0xe9a5('0x2b'),require(_0xe9a5('0x2c')));_0x462b43['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x2d'),require('./api/voiceDialReport'));_0x462b43[_0xe9a5('0x18')]('/api/voice/agents/reports',require(_0xe9a5('0x2e')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x2f'),require(_0xe9a5('0x30')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x31'),require(_0xe9a5('0x32')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x33'),require(_0xe9a5('0x34')));_0x462b43['use'](_0xe9a5('0x35'),require(_0xe9a5('0x36')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x37'),require(_0xe9a5('0x38')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x39'),require(_0xe9a5('0x3a')));_0x462b43[_0xe9a5('0x18')]('/api/mail/queues',require(_0xe9a5('0x3b')));_0x462b43['use'](_0xe9a5('0x3c'),require('./api/mailSubstatus'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x3d'),require(_0xe9a5('0x3e')));_0x462b43['use']('/api/mail/messages',require('./api/mailMessage'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x3f'),require(_0xe9a5('0x40')));_0x462b43['use']('/api/mail/reports/queue',require(_0xe9a5('0x41')));_0x462b43[_0xe9a5('0x18')]('/api/dashboards',require(_0xe9a5('0x42')));_0x462b43[_0xe9a5('0x18')]('/api/dashboards/items',require(_0xe9a5('0x43')));_0x462b43[_0xe9a5('0x18')]('/api/fax/accounts',require(_0xe9a5('0x44')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x45'),require(_0xe9a5('0x46')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x47'),require(_0xe9a5('0x48')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x49'),require(_0xe9a5('0x4a')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x4b'),require(_0xe9a5('0x4c')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x4d'),require(_0xe9a5('0x4e')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x4f'),require(_0xe9a5('0x50')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x51'),require('./api/smsApplication'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x52'),require(_0xe9a5('0x53')));_0x462b43['use'](_0xe9a5('0x54'),require(_0xe9a5('0x55')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x56'),require(_0xe9a5('0x57')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x58'),require('./api/openchannelAccount'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x59'),require(_0xe9a5('0x5a')));_0x462b43[_0xe9a5('0x18')]('/api/openchannel/interactions',require(_0xe9a5('0x5b')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x5c'),require(_0xe9a5('0x5d')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x5e'),require(_0xe9a5('0x5f')));_0x462b43[_0xe9a5('0x18')]('/api/chat/websites',require(_0xe9a5('0x60')));_0x462b43['use'](_0xe9a5('0x61'),require(_0xe9a5('0x62')));_0x462b43[_0xe9a5('0x18')]('/api/chat/applications',require(_0xe9a5('0x63')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x64'),require(_0xe9a5('0x65')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x66'),require(_0xe9a5('0x67')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x68'),require('./api/chatOfflineMessage'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x69'),require(_0xe9a5('0x6a')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x6b'),require(_0xe9a5('0x6c')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x6d'),require(_0xe9a5('0x6e')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x6f'),require(_0xe9a5('0x70')));_0x462b43['use']('/api/cm/contacts',require('./api/cmContact'));_0x462b43['use'](_0xe9a5('0x71'),require('./api/cmHopper'));_0x462b43[_0xe9a5('0x18')]('/api/cm/hopper_black',require(_0xe9a5('0x72')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x73'),require(_0xe9a5('0x74')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x75'),require(_0xe9a5('0x76')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x77'),require(_0xe9a5('0x78')));_0x462b43[_0xe9a5('0x18')]('/api/actions',require(_0xe9a5('0x79')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x7a'),require(_0xe9a5('0x7b')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x7c'),require(_0xe9a5('0x7d')));_0x462b43['use'](_0xe9a5('0x7e'),require('./api/disposition'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x7f'),require(_0xe9a5('0x80')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x81'),require(_0xe9a5('0x82')));_0x462b43['use'](_0xe9a5('0x83'),require('./api/pause'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x84'),require('./api/cdr'));_0x462b43[_0xe9a5('0x18')]('/api/voiceQueuesLog',require(_0xe9a5('0x85')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x86'),require(_0xe9a5('0x87')));_0x462b43['use'](_0xe9a5('0x88'),require(_0xe9a5('0x89')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x8a'),require(_0xe9a5('0x8b')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x8c'),require('./api/template'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x8d'),require(_0xe9a5('0x8e')));_0x462b43[_0xe9a5('0x18')]('/api/variables',require(_0xe9a5('0x8f')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x90'),require(_0xe9a5('0x91')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x92'),require(_0xe9a5('0x93')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x94'),require(_0xe9a5('0x95')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x96'),require(_0xe9a5('0x97')));_0x462b43[_0xe9a5('0x18')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x462b43[_0xe9a5('0x18')]('/api/analytics/metrics',require(_0xe9a5('0x98')));_0x462b43[_0xe9a5('0x18')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x462b43['use'](_0xe9a5('0x99'),require('./api/analyticTreeReport'));_0x462b43[_0xe9a5('0x18')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x462b43['use']('/api/integrations/salesforce/configurations',require(_0xe9a5('0x9a')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x9b'),require('./api/intSalesforceField'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x9c'),require(_0xe9a5('0x9d')));_0x462b43['use']('/api/integrations/sugarcrm/configurations',require(_0xe9a5('0x9e')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x9f'),require(_0xe9a5('0xa0')));_0x462b43['use'](_0xe9a5('0xa1'),require(_0xe9a5('0xa2')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xa3'),require(_0xe9a5('0xa4')));_0x462b43['use'](_0xe9a5('0xa5'),require(_0xe9a5('0xa6')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xa7'),require('./api/intZohoAccount'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xa8'),require(_0xe9a5('0xa9')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xaa'),require(_0xe9a5('0xab')));_0x462b43[_0xe9a5('0x18')]('/api/integrations/zendesk/accounts',require(_0xe9a5('0xac')));_0x462b43['use'](_0xe9a5('0xad'),require('./api/intZendeskConfiguration'));_0x462b43['use'](_0xe9a5('0xae'),require(_0xe9a5('0xaf')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xb0'),require('./api/intFreshdeskAccount'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xb1'),require('./api/intFreshdeskConfiguration'));_0x462b43['use'](_0xe9a5('0xb2'),require(_0xe9a5('0xb3')));_0x462b43['use'](_0xe9a5('0xb4'),require(_0xe9a5('0xb5')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xb6'),require(_0xe9a5('0xb7')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xb8'),require(_0xe9a5('0xb9')));_0x462b43[_0xe9a5('0x18')]('/api/integrations/servicenow/accounts',require(_0xe9a5('0xba')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xbb'),require('./api/intServicenowConfiguration'));_0x462b43['use'](_0xe9a5('0xbc'),require(_0xe9a5('0xbd')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xbe'),require(_0xe9a5('0xbf')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xc0'),require(_0xe9a5('0xc1')));_0x462b43[_0xe9a5('0x18')]('/api/integrations/dynamics365/fields',require(_0xe9a5('0xc2')));_0x462b43['use'](_0xe9a5('0xc3'),require('./api/intFreshsalesAccount'));_0x462b43['use']('/api/integrations/freshsales/configurations',require(_0xe9a5('0xc4')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xc5'),require(_0xe9a5('0xc6')));_0x462b43['use'](_0xe9a5('0xc7'),require(_0xe9a5('0xc8')));_0x462b43['use'](_0xe9a5('0xc9'),require('./api/chatQueueReport'));_0x462b43['use']('/api/chat/internal/messages',require(_0xe9a5('0xca')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xcb'),require(_0xe9a5('0xcc')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xcd'),require(_0xe9a5('0xce')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xcf'),require(_0xe9a5('0xd0')));_0x462b43[_0xe9a5('0x18')]('/api/sms/reports/queue',require(_0xe9a5('0xd1')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xd2'),require(_0xe9a5('0xd3')));_0x462b43['use'](_0xe9a5('0xd4'),require(_0xe9a5('0xd5')));_0x462b43['use']('/api/jscripty/projects',require(_0xe9a5('0xd6')));_0x462b43[_0xe9a5('0x18')]('/api/settings',require(_0xe9a5('0xd7')));_0x462b43['use'](_0xe9a5('0xd8'),require(_0xe9a5('0xd9')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xda'),require(_0xe9a5('0xdb')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xdc'),require('./api/squareRecording'));_0x462b43['use']('/api/square/messages',require(_0xe9a5('0xdd')));_0x462b43[_0xe9a5('0x18')]('/api/teams',require('./api/team'));_0x462b43['use'](_0xe9a5('0xde'),require(_0xe9a5('0xdf')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xe0'),require(_0xe9a5('0xe1')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xe2'),require('./api/migration'));_0x462b43[_0xe9a5('0x18')]('/api/attachments',require(_0xe9a5('0xe3')));_0x462b43['use']('/api/plugins',require('./api/plugin'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xe4'),require('./api/mailTransferReport'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xe5'),require(_0xe9a5('0xe6')));_0x462b43['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x462b43['use']('/api/openchannel/reports/transfer',require(_0xe9a5('0xe7')));_0x462b43['use'](_0xe9a5('0xe8'),require('./api/smsTransferReport'));_0x462b43['use'](_0xe9a5('0xe9'),require('./api/cmList'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xea'),require(_0xe9a5('0xeb')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xec'),require(_0xe9a5('0xed')));_0x462b43[_0xe9a5('0x18')]('/api/userProfile/sections',require(_0xe9a5('0xee')));_0x462b43['use'](_0xe9a5('0xef'),require(_0xe9a5('0xf0')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xf1'),require(_0xe9a5('0xf2')));_0x462b43['use'](_0xe9a5('0xf3'),require(_0xe9a5('0xf4')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xf5'),require(_0xe9a5('0xf6')));_0x462b43[_0xe9a5('0x18')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xf7'),require(_0xe9a5('0xf8')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xf9'),require(_0xe9a5('0xfa')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xfb'),require(_0xe9a5('0xfc')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xfd'),require(_0xe9a5('0xfe')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0xff'),require('./api/cloudProvider'));_0x462b43[_0xe9a5('0x18')]('/api/auth/local',require(_0xe9a5('0x100')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x101'),require(_0xe9a5('0x102')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x103'),require(_0xe9a5('0x104')));_0x462b43['use']('/api/rpc',require(_0xe9a5('0x105')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x106'),require(_0xe9a5('0x107')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x108'),require('./api/system'));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x109'),require(_0xe9a5('0x10a')));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x10b'),require(_0xe9a5('0x10c')));_0x462b43[_0xe9a5('0x18')]('/apidoc',express[_0xe9a5('0x10d')](path['join'](config[_0xe9a5('0x10e')],_0xe9a5('0x10f'))));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x110'),express[_0xe9a5('0x10d')](path[_0xe9a5('0x111')](config[_0xe9a5('0x10e')],_0xe9a5('0x110'))));_0x462b43['use'](_0xe9a5('0x112'),express[_0xe9a5('0x10d')](path['join'](config[_0xe9a5('0x10e')],_0xe9a5('0x112'))));_0x462b43[_0xe9a5('0x18')](_0xe9a5('0x113'),express[_0xe9a5('0x10d')](path[_0xe9a5('0x111')](config[_0xe9a5('0x10e')],_0xe9a5('0x114'),_0xe9a5('0x115'))));_0x462b43['use'](_0xe9a5('0x116'),express[_0xe9a5('0x10d')](path['join'](config['root'],'/server/files/plugins')));_0x462b43['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0xe9a5('0x117')](errors[0x194]);_0x462b43[_0xe9a5('0x118')]('/*')[_0xe9a5('0x117')](function(_0x575c7e,_0x42b85f){_0x42b85f[_0xe9a5('0x119')](path[_0xe9a5('0x11a')](_0x462b43['get'](_0xe9a5('0x11b'))+'/index.html'));});};var sensitiveFields=[_0xe9a5('0x11c'),_0xe9a5('0x11d'),_0xe9a5('0x11e'),_0xe9a5('0x11f'),'firstName','lastName',_0xe9a5('0x120'),_0xe9a5('0x121'),_0xe9a5('0x122'),_0xe9a5('0x123'),_0xe9a5('0x124'),_0xe9a5('0x125'),_0xe9a5('0x126'),'securityToken',_0xe9a5('0x127'),_0xe9a5('0x128'),_0xe9a5('0x129'),_0xe9a5('0x12a'),_0xe9a5('0x12b'),_0xe9a5('0x12c'),'accessTokenSecret',_0xe9a5('0x12d'),'consumerKey','consumerSecret','membername',_0xe9a5('0x12e'),_0xe9a5('0x12f'),_0xe9a5('0x130'),_0xe9a5('0x131'),_0xe9a5('0x132'),_0xe9a5('0x133'),'accesskeyid','secretaccesskey',_0xe9a5('0x134'),'user',_0xe9a5('0x135'),_0xe9a5('0x136'),'localstationid',_0xe9a5('0x137'),_0xe9a5('0x138'),_0xe9a5('0x139'),_0xe9a5('0x13a')];function maskSensitiveData(_0x8c4ff8){var _0x32554f=/(?!^)[\s\S](?!$)/g;if(!_[_0xe9a5('0x13b')](_0x8c4ff8))return;for(var _0x525227 in _0x8c4ff8){if(_[_0xe9a5('0x13c')](_0x8c4ff8[_0x525227])){for(var _0x3c212e=0x0;_0x3c212e<_0x8c4ff8[_0x525227][_0xe9a5('0x13d')];_0x3c212e++){maskSensitiveData(_0x8c4ff8[_0x525227][_0x3c212e]);}}else if(_[_0xe9a5('0x13b')](_0x8c4ff8[_0x525227])){maskSensitiveData(_0x8c4ff8[_0x525227]);}else if(_['isString'](_0x8c4ff8[_0x525227])){_0x8c4ff8[_0x525227]=_0x8c4ff8[_0x525227][_0xe9a5('0x13e')](/{{{/g,_0xe9a5('0x13f'))['replace'](/}}}/g,_0xe9a5('0x140'))[_0xe9a5('0x13e')](/{{/g,'@{')[_0xe9a5('0x13e')](/}}/g,'}@');if(_[_0xe9a5('0x141')](sensitiveFields,_0x525227)){_0x8c4ff8[_0x525227]=_0x8c4ff8[_0x525227][_0xe9a5('0x13e')](_0x32554f,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 7f73708..26ce8ad 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd34b=['../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','log','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0x51a7cb,_0x21def7){var _0x15b518=function(_0x588f87){while(--_0x588f87){_0x51a7cb['push'](_0x51a7cb['shift']());}};_0x15b518(++_0x21def7);}(_0xd34b,0x1a0));var _0xbd34=function(_0x584c5f,_0x37bc86){_0x584c5f=_0x584c5f-0x0;var _0x4eff2e=_0xd34b[_0x584c5f];return _0x4eff2e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbd34('0x0'));var _=require(_0xbd34('0x1'));var config=require(_0xbd34('0x2'));exports[_0xbd34('0x3')]=function(){return new BPromise(function(_0x7e3bd1,_0x24f30e){var _0xaa3161={};_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x5')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/voiceExtension/voiceExtension.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x6')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/voiceRecording/voiceRecording.rpc'));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x7')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x8')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x9')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/memberReport/memberReport.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0xa')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0xb')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0xc')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0xd')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0xe')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0xf')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/mailInteraction/mailInteraction.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x10')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x11')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x12')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x13')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x14')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x15')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x16')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/faxQueue/faxQueue.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x17')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/smsAccount/smsAccount.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x18')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/smsMessage/smsMessage.rpc'));_0xaa3161=_['merge'](_0xaa3161,require('../api/smsQueue/smsQueue.rpc'));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x19')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x1a')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x1b')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x1c')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x1d')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x1e')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/chatMessage/chatMessage.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/chatQueue/chatQueue.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/cmContact/cmContact.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x1f')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x20')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x21')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x22')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x23')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x24')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x25')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x26')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x27')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x28')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x29')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x2a')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x2b')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x2c')));_0xaa3161=_['merge'](_0xaa3161,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x2d')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x2e')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x2f')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x30')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/chatQueueReport/chatQueueReport.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x31')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x32')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x33')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x34')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x35')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x36')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x37')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require('../api/attachment/attachment.rpc'));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x38')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x39')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x3a')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x3b')));_0xaa3161=_['merge'](_0xaa3161,require(_0xbd34('0x3c')));_0xaa3161=_[_0xbd34('0x4')](_0xaa3161,require(_0xbd34('0x3d')));var _0x470a28=jayson['server'](_0xaa3161)[_0xbd34('0x3e')]();var _0x429e58=config['rpc'][_0xbd34('0x3f')]||config[_0xbd34('0x3f')]+0x1;var _0x594651=config[_0xbd34('0x40')]['ip']||_0xbd34('0x41');_0x470a28['on'](_0xbd34('0x42'),function(_0x4e14cf){return _0x24f30e(_0x4e14cf);});_0x470a28[_0xbd34('0x3')](_0x429e58,_0x594651,function(){console[_0xbd34('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x594651,_0x429e58);require('../config/triggers')['default']();return _0x7e3bd1('RPC\x20listening\x20on\x20'+_0x594651+':'+_0x429e58);});});}; \ No newline at end of file +var _0xe25d=['../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc'];(function(_0x1b9c2a,_0x50582e){var _0x21ab47=function(_0x3382c6){while(--_0x3382c6){_0x1b9c2a['push'](_0x1b9c2a['shift']());}};_0x21ab47(++_0x50582e);}(_0xe25d,0x1dc));var _0xde25=function(_0x26b7b7,_0x5c70cd){_0x26b7b7=_0x26b7b7-0x0;var _0x2d3c01=_0xe25d[_0x26b7b7];return _0x2d3c01;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xde25('0x0'));var _=require(_0xde25('0x1'));var config=require(_0xde25('0x2'));exports['listen']=function(){return new BPromise(function(_0x169c25,_0xd0c680){var _0x583dcc={};_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x3')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x5')));_0x583dcc=_['merge'](_0x583dcc,require('../api/voiceQueue/voiceQueue.rpc'));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x6')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x7')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x8')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x9')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0xa')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0xb')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0xc')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/mailServerIn/mailServerIn.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0xd')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0xe')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/mailInteraction/mailInteraction.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0xf')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x10')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x11')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/faxApplication/faxApplication.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x12')));_0x583dcc=_['merge'](_0x583dcc,require('../api/faxMessage/faxMessage.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x13')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x14')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x15')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x16')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x17')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x18')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x19')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x1a')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x1b')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x1c')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/chatMessage/chatMessage.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x1d')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x1e')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x1f')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x20')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x21')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x22')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x23')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/interval/interval.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x24')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/sound/sound.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x25')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x26')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x27')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x28')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x29')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x2a')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x2b')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x2c')));_0x583dcc=_['merge'](_0x583dcc,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x2d')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x2e')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x2f')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x30')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x31')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x32')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x33')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x34')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x35')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x36')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x37')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x38')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x39')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x3a')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x3b')));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x3c')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require(_0xde25('0x3d')));_0x583dcc=_[_0xde25('0x4')](_0x583dcc,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x583dcc=_['merge'](_0x583dcc,require(_0xde25('0x3e')));var _0x5909c2=jayson[_0xde25('0x3f')](_0x583dcc)[_0xde25('0x40')]();var _0x2f4765=config[_0xde25('0x41')]['port']||config[_0xde25('0x42')]+0x1;var _0x5c18bc=config[_0xde25('0x41')]['ip']||_0xde25('0x43');_0x5909c2['on'](_0xde25('0x44'),function(_0x5b8e99){return _0xd0c680(_0x5b8e99);});_0x5909c2[_0xde25('0x45')](_0x2f4765,_0x5c18bc,function(){console[_0xde25('0x46')](_0xde25('0x47'),_0x5c18bc,_0x2f4765);require(_0xde25('0x48'))[_0xde25('0x49')]();return _0x169c25(_0xde25('0x4a')+_0x5c18bc+':'+_0x2f4765);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 29e7dd7..58e89b3 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x245d85,_0x2e498c){var _0x58c5bd=function(_0x379b99){while(--_0x379b99){_0x245d85['push'](_0x245d85['shift']());}};_0x58c5bd(++_0x2e498c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcb91[_0x53ccf2];return _0x5a2964;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4e16ffc..b767a0b 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 _0xdcd9=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','apply','name','exports','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x1bacb6,_0x3fc298){var _0x8d8d2a=function(_0x3e8873){while(--_0x3e8873){_0x1bacb6['push'](_0x1bacb6['shift']());}};_0x8d8d2a(++_0x3fc298);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x3a753c,_0x4a2837){_0x3a753c=_0x3a753c-0x0;var _0x569ad4=_0xdcd9[_0x3a753c];return _0x569ad4;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x9dcd('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x9dcd('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x9dcd('0x2'),'E_AGI_SOCKET_ERROR':_0x9dcd('0x3'),'E_AGI_SOCKET_CLOSE':_0x9dcd('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x9dcd('0x5'),'E_AGI_COMMAND_EMPTY':_0x9dcd('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xd105d3){var _0xd105d3=_0xd105d3||null,_0x9c37c4=_0x9c37c4||[],_0xbc97c0=0x1,_0x119a57='';if(!error[_0xd105d3]){_0xd105d3=_0x9dcd('0x7');}_0x9c37c4[_0x9dcd('0x8')](error[_0xd105d3]);while(arguments[_0xbc97c0]){_0x9c37c4[_0x9dcd('0x8')](arguments[_0xbc97c0]);_0xbc97c0++;}_0x119a57=util[_0x9dcd('0x9')][_0x9dcd('0xa')](util,_0x9c37c4);this['message']=_0x119a57;this[_0x9dcd('0xb')]=_0xd105d3;}module[_0x9dcd('0xc')]=AGIError; \ No newline at end of file +var _0xf041=['Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0xffc01b,_0x29fa1f){var _0x11051b=function(_0x34c12d){while(--_0x34c12d){_0xffc01b['push'](_0xffc01b['shift']());}};_0x11051b(++_0x29fa1f);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x1f04('0x0'),'E_AGI_SERVER_ERROR':_0x1f04('0x1'),'E_AGI_SERVER_CLOSE':_0x1f04('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x1f04('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1f04('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x1f04('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x1f04('0x6')};function AGIError(_0x504d71){var _0x504d71=_0x504d71||null,_0x165bb1=_0x165bb1||[],_0x12897f=0x1,_0x1c7a8a='';if(!error[_0x504d71]){_0x504d71='E_AGI_UNDEFINED';}_0x165bb1[_0x1f04('0x7')](error[_0x504d71]);while(arguments[_0x12897f]){_0x165bb1[_0x1f04('0x7')](arguments[_0x12897f]);_0x12897f++;}_0x1c7a8a=util[_0x1f04('0x8')][_0x1f04('0x9')](util,_0x165bb1);this[_0x1f04('0xa')]=_0x1c7a8a;this[_0x1f04('0xb')]=_0x504d71;}module[_0x1f04('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5cb0b64..bcb34d4 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 _0xe5b5=['../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','condition','split','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0x15281c,_0x21df52){var _0x5df838=function(_0x14e7c5){while(--_0x14e7c5){_0x15281c['push'](_0x15281c['shift']());}};_0x5df838(++_0x21df52);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0xe5b5[_0x55d911];return _0x3104c2;};'use strict';var _=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var verticesWithRetry=[_0x5e5b('0x3'),_0x5e5b('0x4'),_0x5e5b('0x5')];var Graph=function(){this[_0x5e5b('0x6')]={};this[_0x5e5b('0x7')]={};this[_0x5e5b('0x8')]=0x0;};Graph[_0x5e5b('0x9')][_0x5e5b('0xa')]=function(_0x40bc5b){this[_0x5e5b('0x6')][_0x40bc5b['id']]=_0x40bc5b;this[_0x5e5b('0x7')][_0x40bc5b['id']]=[];};Graph[_0x5e5b('0x9')][_0x5e5b('0xb')]=function(_0xe089b1,_0xcbd478,_0x258414){this[_0x5e5b('0x7')][_0xe089b1][_0x5e5b('0xc')]({'target':_0xcbd478,'condition':_0x258414});this[_0x5e5b('0x8')]+=0x1;};Graph[_0x5e5b('0x9')]['size']=function(){return _[_0x5e5b('0xd')](this['vertices']);};Graph[_0x5e5b('0x9')][_0x5e5b('0xe')]=function(){return this[_0x5e5b('0x8')];};Graph[_0x5e5b('0x9')]['getVertex']=function(_0x4a1424){return this['vertices'][_0x4a1424];};Graph[_0x5e5b('0x9')][_0x5e5b('0xf')]=function(_0x4559a0,_0x1694ff){if(!this[_0x5e5b('0x6')][_0x4559a0]){return logger[_0x5e5b('0x10')](_0x5e5b('0x11'));}var _0x49edd0=_0x1694ff(this[_0x5e5b('0x6')][_0x4559a0]);if(!_0x49edd0){return logger[_0x5e5b('0x10')]('stop\x20traverse');}if(this[_0x5e5b('0x7')][_0x4559a0]['length']===0x0){return logger['info'](_0x5e5b('0x12'));}for(var _0x444435=0x0,_0xaf9ace=[],_0x5c7148=![];_0x444435\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','debug','variables','stringify','close','timeout','sync','production','start','root','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','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4bc3,0x16e));var _0x34bc=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4bc3[_0x68c979];return _0x4f0001;};'use strict';var parser=require(_0x34bc('0x0'));var _=require(_0x34bc('0x1'));var syncho=require('syncho');var util=require(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var config=require('../../config/environment');var logger=require(_0x34bc('0x4'))(_0x34bc('0x5'));var utilLicense=require(_0x34bc('0x6'));var rpc=require(_0x34bc('0x7'));var mailRpc=require(_0x34bc('0x8'));var Graph=require(_0x34bc('0x9'));var Vertices=require(_0x34bc('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x34bc('0xb')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x18a01c){process[_0x34bc('0xc')](function(){syncho(function(){try{setChannelVariables(_0x18a01c);agiHandler(_0x18a01c);}catch(_0x1f72d8){logger[_0x34bc('0xd')](_0x1f72d8[_0x34bc('0xe')]);}});});}function listeningHandler(){console[_0x34bc('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x34bc('0x10')]);logger[_0x34bc('0x11')](util[_0x34bc('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x34bc('0x5')]['ip'],config['agi'][_0x34bc('0x10')]));}function errorHandler(_0x124b87){if(_0x124b87&&_0x124b87[_0x34bc('0x13')]&&_0x124b87['message']){logger[_0x34bc('0xd')](util['format'](_0x34bc('0x14'),_0x124b87[_0x34bc('0x13')],_0x124b87[_0x34bc('0x15')]));}else{logger['error'](util['format'](_0x34bc('0x16'),_0x124b87['stack']));}}function closeHandler(){logger[_0x34bc('0x11')](util[_0x34bc('0x12')](_0x34bc('0x17'),this[_0x34bc('0x18')],this[_0x34bc('0x19')],this[_0x34bc('0x1a')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x5a5895){logger[_0x34bc('0xd')](_0x5a5895[_0x34bc('0xe')]);}}function timeoutHandler(){logger[_0x34bc('0x11')](util[_0x34bc('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x34bc('0x18')],this[_0x34bc('0x19')],this['callerid'],this[_0x34bc('0x1b')],this[_0x34bc('0x1c')]));}function hangupHandler(){logger['info'](util[_0x34bc('0x12')](_0x34bc('0x1d'),this[_0x34bc('0x18')],this[_0x34bc('0x19')],this[_0x34bc('0x1a')],this[_0x34bc('0x1b')],this['uniqueid']));this[_0x34bc('0x1e')]=!![];}function getRoot(_0x3c9939){return parser[_0x34bc('0x1f')](_0x3c9939,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x358d51,_0x1b820a,_0x4263de){_0x1b820a[_0x34bc('0x20')]=_0x4263de;if(_0x1b820a[_0x34bc('0x21')](_0x34bc('0x22'))){_0x1b820a[_0x34bc('0x23')]=parseInt(_0x1b820a[_0x34bc('0x22')],0xa);}_0x358d51[_0x34bc('0x24')](_[_0x34bc('0x25')](_0x1b820a,_0x34bc('0x26')));}function initGraph(_0x1edcb0,_0x4fd589){var _0x43e527=new Graph();for(var _0x48ec13 in _0x1edcb0){if(_0x1edcb0['hasOwnProperty'](_0x48ec13)){if(_[_0x34bc('0x27')](_0x1edcb0[_0x48ec13])){for(var _0x5332c8=0x0;_0x5332c8<_0x1edcb0[_0x48ec13][_0x34bc('0x28')];_0x5332c8+=0x1){addVertex(_0x43e527,_0x1edcb0[_0x48ec13][_0x5332c8],_0x48ec13);}}else{addVertex(_0x43e527,_0x1edcb0[_0x48ec13],_0x48ec13);}}}for(var _0x446b58=0x0;_0x446b58<_0x4fd589[_0x34bc('0x28')];_0x446b58+=0x1){if(_0x4fd589[_0x446b58]['source']&&_0x4fd589[_0x446b58][_0x34bc('0x29')]){_0x43e527[_0x34bc('0x2a')](_0x4fd589[_0x446b58][_0x34bc('0x2b')],_0x4fd589[_0x446b58][_0x34bc('0x29')],_0x4fd589[_0x446b58][_0x34bc('0x2c')]);}}return _0x43e527;}function getSquareProject(_0x33bf46,_0x520fd4){rpc[_0x34bc('0x2d')](_0x33bf46)[_0x34bc('0x2e')](function(_0x22aacc){_0x520fd4(null,_0x22aacc);})[_0x34bc('0x2f')](function(_0x2241b4){_0x520fd4(null,_0x2241b4);});}function createSquareReport(_0xd92957,_0x5b37de){rpc[_0x34bc('0x30')](_0xd92957)['then'](function(_0x530748){if(_0x5b37de){_0x5b37de(null,_0x530748);}})[_0x34bc('0x2f')](function(_0x540aa3){if(_0x5b37de){_0x5b37de(null,_0x540aa3);}});}function setChannelVariables(_0x1e8445){for(var _0x2ffd4b in _0x1e8445){if(_0x1e8445[_0x34bc('0x21')](_0x2ffd4b)){if(_0x2ffd4b[_0x34bc('0x31')](_0x34bc('0x32'))===0x0){_0x1e8445[_0x2ffd4b[_0x34bc('0x33')](0x4)]=_0x1e8445[_0x2ffd4b];delete _0x1e8445[_0x2ffd4b];}}}}function getLogFromObject(_0x2f0ce5){return util['inspect'](_0x2f0ce5,{'showHidden':![],'depth':null});}function agiHandler(_0xbd59f9){var _0x3a5a74,_0xc0a30e,_0x3224c7,_0x360126,_0x5c7e56;logger[_0x34bc('0x34')](_0x34bc('0x35'),JSON[_0x34bc('0x36')](_0xbd59f9,null,0x2));logger[_0x34bc('0x11')](util[_0x34bc('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbd59f9['arg_1'],_0xbd59f9[_0x34bc('0x19')],_0xbd59f9[_0x34bc('0x1a')],_0xbd59f9[_0x34bc('0x1b')],_0xbd59f9[_0x34bc('0x1c')]));_0xbd59f9['on']('error',errorHandler);_0xbd59f9['on'](_0x34bc('0x37'),closeHandler);_0xbd59f9['on'](_0x34bc('0x38'),timeoutHandler);_0xbd59f9[_0x34bc('0x1e')]=![];_0xbd59f9['on']('hangup',hangupHandler);var _0x37cd30=getSquareProject[_0x34bc('0x39')](null,_0xbd59f9[_0x34bc('0x18')]);if(_0x37cd30){if(_0x37cd30[_0x34bc('0x3a')]){_0x3a5a74=getRoot(_0x37cd30['production']);if(_0x3a5a74&&_0x3a5a74[_0x34bc('0x3b')]){logger[_0x34bc('0x34')](_0x34bc('0x3c'),JSON['stringify'](_0x3a5a74,null,0x2));_0xbd59f9[_0x34bc('0x3d')]=moment()[_0x34bc('0x12')](_0x34bc('0x3e'));_0xc0a30e=initGraph(_[_0x34bc('0x25')](_0x3a5a74,_0x34bc('0x26')),_0x3a5a74['mxCell']);_0x3224c7=new Vertices(_0xbd59f9,rpc,mailRpc);logger[_0x34bc('0x11')](util[_0x34bc('0x12')](_0x34bc('0x3f'),_0xbd59f9[_0x34bc('0x18')],_0xbd59f9[_0x34bc('0x19')],_0xbd59f9['callerid'],_0xbd59f9[_0x34bc('0x1b')],_0xbd59f9['uniqueid']));_0xc0a30e[_0x34bc('0x40')](_0x3a5a74[_0x34bc('0x3b')]['id'],function(_0xfaa92d){try{_0xfaa92d=_0x3224c7[_0x34bc('0x41')](_0xfaa92d);logger['debug'](_0x34bc('0x42'),JSON[_0x34bc('0x36')](_0xfaa92d,null,0x2));if(_0xfaa92d['agicommand']===_0x34bc('0x43')){logger[_0x34bc('0x11')](_0x34bc('0x44'));_0xbd59f9['context']=_0xfaa92d[_0x34bc('0x45')]||_0xbd59f9[_0x34bc('0x45')];_0xbd59f9[_0x34bc('0x46')]=_0xfaa92d[_0x34bc('0x46')];_0xbd59f9[_0x34bc('0x47')]=_0xfaa92d[_0x34bc('0x47')]?_0xfaa92d[_0x34bc('0x47')]-0x1:0x1;return null;}else if(_0xfaa92d&&_0x3224c7[_0xfaa92d[_0x34bc('0x20')]]){_0x5c7e56=_0x3224c7[_0xfaa92d[_0x34bc('0x20')]](_0xfaa92d);logger[_0x34bc('0x11')](_0x34bc('0x48'),JSON['stringify'](_0x5c7e56,null,0x2));if(_0x5c7e56&&_0x5c7e56['code']===AGI_CODE_SUCCESS&&_0x5c7e56[_0x34bc('0x49')]!==AGI_RESULT_ERROR&&!_0xbd59f9[_0x34bc('0x1e')]){logger[_0x34bc('0x34')](_0x34bc('0x48'),getLogFromObject(_0x5c7e56));return _[_0x34bc('0x4a')](_0x5c7e56[_0x34bc('0x49')])?null:_0x5c7e56['result'][_0x34bc('0x4b')]();}else{logger['error'](_0x34bc('0x48'),getLogFromObject(_0x5c7e56));return null;}}else{logger[_0x34bc('0xd')](_0x34bc('0x4c'));return null;}}catch(_0x4ba4eb){logger[_0x34bc('0xd')](_0x4ba4eb[_0x34bc('0xe')]);return null;}});if(_0x3a5a74[_0x34bc('0x4d')]){logger[_0x34bc('0x11')](util[_0x34bc('0x12')](_0x34bc('0x4e'),_0xbd59f9[_0x34bc('0x18')],_0xbd59f9[_0x34bc('0x19')],_0xbd59f9[_0x34bc('0x1a')],_0xbd59f9[_0x34bc('0x1b')],_0xbd59f9[_0x34bc('0x1c')]));_0xc0a30e[_0x34bc('0x40')](_0x3a5a74['finally']['id'],function(_0x56494f){try{_0x56494f=_0x3224c7[_0x34bc('0x41')](_0x56494f);logger[_0x34bc('0x34')](_0x34bc('0x42'),JSON['stringify'](_0x56494f,null,0x2));if(_0x56494f&&_0x3224c7[_0x56494f['agicommand']]){_0x5c7e56=_0x3224c7[_0x56494f[_0x34bc('0x20')]](_0x56494f);if(_0x5c7e56){logger[_0x34bc('0x34')](_0x34bc('0x48'),getLogFromObject(_0x5c7e56));return _['isUndefined'](_0x5c7e56[_0x34bc('0x49')])?null:_0x5c7e56[_0x34bc('0x49')]['toString']();}else{logger[_0x34bc('0xd')]('response',getLogFromObject(_0x5c7e56));return null;}}else{logger[_0x34bc('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x281d6f){logger[_0x34bc('0xd')](_0x281d6f[_0x34bc('0xe')]);return null;}});}logger[_0x34bc('0x11')](util['format'](_0x34bc('0x4f'),_0xbd59f9[_0x34bc('0x18')],_0xbd59f9[_0x34bc('0x19')],_0xbd59f9[_0x34bc('0x1a')],_0xbd59f9[_0x34bc('0x1b')],_0xbd59f9[_0x34bc('0x1c')]));logger[_0x34bc('0x11')](util[_0x34bc('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xbd59f9['context'],_0xbd59f9['extension'],parseInt(_0xbd59f9[_0x34bc('0x47')],0xa)+0x1));_0xbd59f9[_0x34bc('0x50')](_0xbd59f9['context'],_0xbd59f9[_0x34bc('0x46')],parseInt(_0xbd59f9[_0x34bc('0x47')],0xa)+0x1);_0xbd59f9[_0x34bc('0x37')]();}}else{logger[_0x34bc('0xd')](util[_0x34bc('0x12')]('Project\x20%s\x20not\x20published',_0xbd59f9['arg_1']));_0xbd59f9['continueAt'](_0xbd59f9[_0x34bc('0x45')],_0xbd59f9[_0x34bc('0x46')],parseInt(_0xbd59f9[_0x34bc('0x47')],0xa)+0x1);_0xbd59f9[_0x34bc('0x37')]();}}else{logger[_0x34bc('0xd')](util['format'](_0x34bc('0x51'),_0xbd59f9[_0x34bc('0x18')]));_0xbd59f9[_0x34bc('0x50')](_0xbd59f9[_0x34bc('0x45')],_0xbd59f9['extension'],parseInt(_0xbd59f9[_0x34bc('0x47')],0xa)+0x1);_0xbd59f9[_0x34bc('0x37')]();}}function main(){var _0x29d7df;return utilLicense[_0x34bc('0x52')]()[_0x34bc('0x2e')](function(_0x31c40b){if(_0x31c40b){if(_0x31c40b[_0x34bc('0x53')]){if(_0x31c40b[_0x34bc('0x54')]&&_0x31c40b[_0x34bc('0x54')]>0x0){logger[_0x34bc('0x11')](util[_0x34bc('0x12')](_0x34bc('0x55'),_0x31c40b[_0x34bc('0x54')]));_0x29d7df=_0x31c40b['callysquare'];}else{logger[_0x34bc('0x11')](_0x34bc('0x56'));}}else{logger[_0x34bc('0x11')](_0x34bc('0x57'));_0x29d7df=-0x1;}}})[_0x34bc('0x2f')](function(_0x1b3704){logger[_0x34bc('0xd')](_0x34bc('0x58'),_0x1b3704[_0x34bc('0xe')]);})[_0x34bc('0x4d')](function(){var _0x11cd4c=require(_0x34bc('0x59'))(config[_0x34bc('0x5')][_0x34bc('0x10')],config['agi']['ip'],_0x29d7df);_0x11cd4c['on'](_0x34bc('0xd'),errorHandler);_0x11cd4c['on'](_0x34bc('0x5a'),listeningHandler);_0x11cd4c['on'](_0x34bc('0x5b'),connectionHandler);_0x11cd4c['on'](_0x34bc('0x37'),closeHandler);});}main(); \ No newline at end of file +var _0x84ab=['agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','gotoc','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[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','close','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','../../config/logger','agi','./rpc','./mailRpc','./graph','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','format','[%s]\x20%s','name','[ERROR]\x20%s','stack','info','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','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','addEdge','source','value','then','createSquareReport','catch'];(function(_0xd93140,_0x2d0ff5){var _0x3a3a92=function(_0x3b0639){while(--_0x3b0639){_0xd93140['push'](_0xd93140['shift']());}};_0x3a3a92(++_0x2d0ff5);}(_0x84ab,0x12f));var _0xb84a=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x84ab[_0x51674a];return _0x13fca6;};'use strict';var parser=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var syncho=require(_0xb84a('0x2'));var util=require(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var config=require('../../config/environment');var logger=require(_0xb84a('0x5'))(_0xb84a('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0xb84a('0x7'));var mailRpc=require(_0xb84a('0x8'));var Graph=require(_0xb84a('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_['defaults'](config[_0xb84a('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x3e9086){process[_0xb84a('0xa')](function(){syncho(function(){try{setChannelVariables(_0x3e9086);agiHandler(_0x3e9086);}catch(_0x4d9321){logger[_0xb84a('0xb')](_0x4d9321['stack']);}});});}function listeningHandler(){console[_0xb84a('0xc')](_0xb84a('0xd'),config[_0xb84a('0x6')]['port']);logger['info'](util['format'](_0xb84a('0xe'),config[_0xb84a('0x6')]['ip'],config[_0xb84a('0x6')][_0xb84a('0xf')]));}function errorHandler(_0x1ed9ae){if(_0x1ed9ae&&_0x1ed9ae['name']&&_0x1ed9ae[_0xb84a('0x10')]){logger[_0xb84a('0xb')](util[_0xb84a('0x11')](_0xb84a('0x12'),_0x1ed9ae[_0xb84a('0x13')],_0x1ed9ae[_0xb84a('0x10')]));}else{logger[_0xb84a('0xb')](util[_0xb84a('0x11')](_0xb84a('0x14'),_0x1ed9ae[_0xb84a('0x15')]));}}function closeHandler(){logger[_0xb84a('0x16')](util[_0xb84a('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb84a('0x17')],this[_0xb84a('0x18')],this[_0xb84a('0x19')],this[_0xb84a('0x1a')],this[_0xb84a('0x1b')]));try{createSquareReport(this);}catch(_0x1be87a){logger[_0xb84a('0xb')](_0x1be87a[_0xb84a('0x15')]);}}function timeoutHandler(){logger[_0xb84a('0x16')](util[_0xb84a('0x11')](_0xb84a('0x1c'),this[_0xb84a('0x17')],this[_0xb84a('0x18')],this[_0xb84a('0x19')],this['dnid'],this[_0xb84a('0x1b')]));}function hangupHandler(){logger[_0xb84a('0x16')](util['format'](_0xb84a('0x1d'),this[_0xb84a('0x17')],this[_0xb84a('0x18')],this[_0xb84a('0x19')],this['dnid'],this['uniqueid']));this[_0xb84a('0x1e')]=!![];}function getRoot(_0x19097d){return parser[_0xb84a('0x1f')](_0x19097d,{'object':!![]})[_0xb84a('0x20')][_0xb84a('0x21')];}function addVertex(_0x3b8fb2,_0x8b28cd,_0x21d0d3){_0x8b28cd[_0xb84a('0x22')]=_0x21d0d3;if(_0x8b28cd[_0xb84a('0x23')](_0xb84a('0x24'))){_0x8b28cd[_0xb84a('0x25')]=parseInt(_0x8b28cd[_0xb84a('0x24')],0xa);}_0x3b8fb2[_0xb84a('0x26')](_[_0xb84a('0x27')](_0x8b28cd,_0xb84a('0x28')));}function initGraph(_0x378ce1,_0x3ff0bc){var _0x3b6805=new Graph();for(var _0xd468c3 in _0x378ce1){if(_0x378ce1[_0xb84a('0x23')](_0xd468c3)){if(_[_0xb84a('0x29')](_0x378ce1[_0xd468c3])){for(var _0x2fe40d=0x0;_0x2fe40d<_0x378ce1[_0xd468c3][_0xb84a('0x2a')];_0x2fe40d+=0x1){addVertex(_0x3b6805,_0x378ce1[_0xd468c3][_0x2fe40d],_0xd468c3);}}else{addVertex(_0x3b6805,_0x378ce1[_0xd468c3],_0xd468c3);}}}for(var _0xefef48=0x0;_0xefef48<_0x3ff0bc[_0xb84a('0x2a')];_0xefef48+=0x1){if(_0x3ff0bc[_0xefef48]['source']&&_0x3ff0bc[_0xefef48]['target']){_0x3b6805[_0xb84a('0x2b')](_0x3ff0bc[_0xefef48][_0xb84a('0x2c')],_0x3ff0bc[_0xefef48]['target'],_0x3ff0bc[_0xefef48][_0xb84a('0x2d')]);}}return _0x3b6805;}function getSquareProject(_0x36b4f4,_0x52c23c){rpc['getSquareProject'](_0x36b4f4)[_0xb84a('0x2e')](function(_0x8e9319){_0x52c23c(null,_0x8e9319);})['catch'](function(_0x251778){_0x52c23c(null,_0x251778);});}function createSquareReport(_0xba1147,_0x3abc22){rpc[_0xb84a('0x2f')](_0xba1147)[_0xb84a('0x2e')](function(_0x144c25){if(_0x3abc22){_0x3abc22(null,_0x144c25);}})[_0xb84a('0x30')](function(_0xac214f){if(_0x3abc22){_0x3abc22(null,_0xac214f);}});}function setChannelVariables(_0x54ec50){for(var _0x132c51 in _0x54ec50){if(_0x54ec50['hasOwnProperty'](_0x132c51)){if(_0x132c51['indexOf'](_0xb84a('0x31'))===0x0){_0x54ec50[_0x132c51[_0xb84a('0x32')](0x4)]=_0x54ec50[_0x132c51];delete _0x54ec50[_0x132c51];}}}}function getLogFromObject(_0x47a5b6){return util['inspect'](_0x47a5b6,{'showHidden':![],'depth':null});}function agiHandler(_0x218481){var _0x13c167,_0xdda20e,_0x308240,_0x3735fb,_0x1d7ef1;logger[_0xb84a('0x33')](_0xb84a('0x34'),JSON['stringify'](_0x218481,null,0x2));logger[_0xb84a('0x16')](util[_0xb84a('0x11')](_0xb84a('0x35'),_0x218481[_0xb84a('0x17')],_0x218481[_0xb84a('0x18')],_0x218481[_0xb84a('0x19')],_0x218481[_0xb84a('0x1a')],_0x218481['uniqueid']));_0x218481['on'](_0xb84a('0xb'),errorHandler);_0x218481['on']('close',closeHandler);_0x218481['on'](_0xb84a('0x36'),timeoutHandler);_0x218481[_0xb84a('0x1e')]=![];_0x218481['on'](_0xb84a('0x37'),hangupHandler);var _0x4d04fb=getSquareProject['sync'](null,_0x218481[_0xb84a('0x17')]);if(_0x4d04fb){if(_0x4d04fb[_0xb84a('0x38')]){_0x13c167=getRoot(_0x4d04fb[_0xb84a('0x38')]);if(_0x13c167&&_0x13c167[_0xb84a('0x39')]){logger[_0xb84a('0x33')]('root',JSON[_0xb84a('0x3a')](_0x13c167,null,0x2));_0x218481[_0xb84a('0x3b')]=moment()['format'](_0xb84a('0x3c'));_0xdda20e=initGraph(_[_0xb84a('0x27')](_0x13c167,_0xb84a('0x28')),_0x13c167[_0xb84a('0x28')]);_0x308240=new Vertices(_0x218481,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x218481[_0xb84a('0x17')],_0x218481[_0xb84a('0x18')],_0x218481[_0xb84a('0x19')],_0x218481[_0xb84a('0x1a')],_0x218481['uniqueid']));_0xdda20e[_0xb84a('0x3d')](_0x13c167['start']['id'],function(_0x3081b4){try{_0x3081b4=_0x308240['clear'](_0x3081b4);logger['debug']('vertex',JSON[_0xb84a('0x3a')](_0x3081b4,null,0x2));if(_0x3081b4[_0xb84a('0x22')]===_0xb84a('0x3e')){logger[_0xb84a('0x16')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x218481[_0xb84a('0x3f')]=_0x3081b4[_0xb84a('0x3f')]||_0x218481[_0xb84a('0x3f')];_0x218481[_0xb84a('0x40')]=_0x3081b4['extension'];_0x218481['priority']=_0x3081b4[_0xb84a('0x41')]?_0x3081b4[_0xb84a('0x41')]-0x1:0x1;return null;}else if(_0x3081b4&&_0x308240[_0x3081b4['agicommand']]){_0x1d7ef1=_0x308240[_0x3081b4[_0xb84a('0x22')]](_0x3081b4);logger[_0xb84a('0x16')](_0xb84a('0x42'),JSON[_0xb84a('0x3a')](_0x1d7ef1,null,0x2));if(_0x1d7ef1&&_0x1d7ef1[_0xb84a('0x43')]===AGI_CODE_SUCCESS&&_0x1d7ef1[_0xb84a('0x44')]!==AGI_RESULT_ERROR&&!_0x218481[_0xb84a('0x1e')]){logger[_0xb84a('0x33')](_0xb84a('0x42'),getLogFromObject(_0x1d7ef1));return _[_0xb84a('0x45')](_0x1d7ef1[_0xb84a('0x44')])?null:_0x1d7ef1[_0xb84a('0x44')][_0xb84a('0x46')]();}else{logger[_0xb84a('0xb')](_0xb84a('0x42'),getLogFromObject(_0x1d7ef1));return null;}}else{logger['error'](_0xb84a('0x47'));return null;}}catch(_0x366fcd){logger[_0xb84a('0xb')](_0x366fcd[_0xb84a('0x15')]);return null;}});if(_0x13c167[_0xb84a('0x48')]){logger[_0xb84a('0x16')](util['format'](_0xb84a('0x49'),_0x218481['arg_1'],_0x218481[_0xb84a('0x18')],_0x218481[_0xb84a('0x19')],_0x218481[_0xb84a('0x1a')],_0x218481[_0xb84a('0x1b')]));_0xdda20e['traverseBFS'](_0x13c167[_0xb84a('0x48')]['id'],function(_0x1f5b38){try{_0x1f5b38=_0x308240[_0xb84a('0x4a')](_0x1f5b38);logger['debug']('vertex',JSON[_0xb84a('0x3a')](_0x1f5b38,null,0x2));if(_0x1f5b38&&_0x308240[_0x1f5b38[_0xb84a('0x22')]]){_0x1d7ef1=_0x308240[_0x1f5b38[_0xb84a('0x22')]](_0x1f5b38);if(_0x1d7ef1){logger['debug']('response',getLogFromObject(_0x1d7ef1));return _['isUndefined'](_0x1d7ef1[_0xb84a('0x44')])?null:_0x1d7ef1[_0xb84a('0x44')][_0xb84a('0x46')]();}else{logger[_0xb84a('0xb')](_0xb84a('0x42'),getLogFromObject(_0x1d7ef1));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x5b853a){logger['error'](_0x5b853a[_0xb84a('0x15')]);return null;}});}logger[_0xb84a('0x16')](util['format'](_0xb84a('0x4b'),_0x218481[_0xb84a('0x17')],_0x218481[_0xb84a('0x18')],_0x218481[_0xb84a('0x19')],_0x218481[_0xb84a('0x1a')],_0x218481[_0xb84a('0x1b')]));logger['info'](util['format'](_0xb84a('0x4c'),_0x218481['context'],_0x218481[_0xb84a('0x40')],parseInt(_0x218481['priority'],0xa)+0x1));_0x218481['continueAt'](_0x218481['context'],_0x218481[_0xb84a('0x40')],parseInt(_0x218481[_0xb84a('0x41')],0xa)+0x1);_0x218481[_0xb84a('0x4d')]();}}else{logger[_0xb84a('0xb')](util[_0xb84a('0x11')](_0xb84a('0x4e'),_0x218481[_0xb84a('0x17')]));_0x218481[_0xb84a('0x4f')](_0x218481['context'],_0x218481['extension'],parseInt(_0x218481['priority'],0xa)+0x1);_0x218481[_0xb84a('0x4d')]();}}else{logger[_0xb84a('0xb')](util['format'](_0xb84a('0x50'),_0x218481['arg_1']));_0x218481['continueAt'](_0x218481['context'],_0x218481[_0xb84a('0x40')],parseInt(_0x218481[_0xb84a('0x41')],0xa)+0x1);_0x218481[_0xb84a('0x4d')]();}}function main(){var _0x51c415;return utilLicense[_0xb84a('0x51')]()[_0xb84a('0x2e')](function(_0x136d61){if(_0x136d61){if(_0x136d61['voice']){if(_0x136d61[_0xb84a('0x52')]&&_0x136d61['callysquare']>0x0){logger['info'](util[_0xb84a('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x136d61[_0xb84a('0x52')]));_0x51c415=_0x136d61['callysquare'];}else{logger[_0xb84a('0x16')](_0xb84a('0x53'));}}else{logger[_0xb84a('0x16')](_0xb84a('0x54'));_0x51c415=-0x1;}}})['catch'](function(_0x50a514){logger['error'](_0xb84a('0x55'),_0x50a514[_0xb84a('0x15')]);})['finally'](function(){var _0x537c1e=require(_0xb84a('0x56'))(config[_0xb84a('0x6')][_0xb84a('0xf')],config['agi']['ip'],_0x51c415);_0x537c1e['on'](_0xb84a('0xb'),errorHandler);_0x537c1e['on'](_0xb84a('0x57'),listeningHandler);_0x537c1e['on']('connection',connectionHandler);_0x537c1e['on'](_0xb84a('0x4d'),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 62bf26d..00d9aac 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(_0x47905e,_0x3953a8){var _0x483084=function(_0xb89ff1){while(--_0xb89ff1){_0x47905e['push'](_0x47905e['shift']());}};_0x483084(++_0x3953a8);}(_0x814b,0x1a2));var _0xb814=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x814b[_0x2be8c2];return _0x97f531;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x41f877,_0x4f2424){var _0x31d1ef=function(_0x4b6781){while(--_0x4b6781){_0x41f877['push'](_0x41f877['shift']());}};_0x31d1ef(++_0x4f2424);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 0dd9e19..46e45da 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x5dc5d5,_0xdeef91){var _0xee4226=function(_0x56b313){while(--_0x56b313){_0x5dc5d5['push'](_0x5dc5d5['shift']());}};_0xee4226(++_0xdeef91);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13db30,_0x1d83e8){_0x13db30=_0x13db30-0x0;var _0x383738=_0x5f2f[_0x13db30];return _0x383738;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x45c957,_0xef9d46){var _0x495276=function(_0x406f37){while(--_0x406f37){_0x45c957['push'](_0x45c957['shift']());}};_0x495276(++_0xef9d46);}(_0x5f2f,0x73));var _0xf5f2=function(_0x31c2d1,_0x33007f){_0x31c2d1=_0x31c2d1-0x0;var _0xef604b=_0x5f2f[_0x31c2d1];return _0xef604b;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 86f7030..01c77f3 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 _0x111b=['arg_2','format','createSquareRecording','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','getMailAccountById','MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','name','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1'];(function(_0x2e131a,_0x441ab0){var _0xf2f5c=function(_0x373915){while(--_0x373915){_0x2e131a['push'](_0x2e131a['shift']());}};_0xf2f5c(++_0x441ab0);}(_0x111b,0x15f));var _0xb111=function(_0x400f76,_0x4a92da){_0x400f76=_0x400f76-0x0;var _0x3c0f2f=_0x111b[_0x400f76];return _0x3c0f2f;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb111('0x0'));var _=require(_0xb111('0x1'));var util=require(_0xb111('0x2'));var jayson=require(_0xb111('0x3'));var client=jayson[_0xb111('0x4')][_0xb111('0x5')]({'port':0x2329});function request(_0x39ade8,_0x3a5921){return new BPromise(function(_0x119635,_0x21599f){return client[_0xb111('0x6')](_0x39ade8,_0x3a5921)[_0xb111('0x7')](function(_0x1c7e96){if(_0x1c7e96[_0xb111('0x8')]){return _0x21599f(_0x1c7e96[_0xb111('0x8')][_0xb111('0x9')]);}else{return _0x119635(_0x1c7e96[_0xb111('0xa')]);}})[_0xb111('0xb')](function(_0x4bf32a){return _0x21599f(_0x4bf32a);});});}exports[_0xb111('0xc')]=function(_0x20ec50){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x20ec50},'attributes':['production']}});};exports[_0xb111('0xd')]=function(_0x1288f2){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1288f2},'include':[{'model':_0xb111('0xe'),'as':_0xb111('0xf')}],'attributes':['id','name',_0xb111('0x10')]}});};exports[_0xb111('0x11')]=function(_0x49020a){return request(_0xb111('0x12'),{'options':{'where':{'id':_0x49020a},'attributes':['name']}});};exports[_0xb111('0x13')]=function(_0x143dd0){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x143dd0},'attributes':[_0xb111('0x14')]}});};exports[_0xb111('0x15')]=function(_0x3d5292){return request(_0xb111('0x16'),{'options':{'where':{'id':_0x3d5292},'attributes':[_0xb111('0x14')]}});};exports[_0xb111('0x17')]=function(_0x4470d8){return request(_0xb111('0x18'),{'options':{'where':{'id':_0x4470d8},'attributes':[_0xb111('0x19')]}});};exports['getUserById']=function(_0x2a34b8){return request('ShowUser',{'options':{'where':{'id':_0x2a34b8},'attributes':['name']}});};exports[_0xb111('0x1a')]=function(_0x580a57){return request(_0xb111('0x1b'),{'options':{'where':{'id':_0x580a57},'attributes':[_0xb111('0x14')]}});};exports[_0xb111('0x1c')]=function(_0x1486f3){return request(_0xb111('0x1d'),{'options':{'where':{'id':_0x1486f3},'attributes':['save_name']}});};exports[_0xb111('0x1e')]=function(_0xb1d1a8){return request(_0xb111('0x1f'),{'options':{'raw':![],'where':{'id':_0xb1d1a8},'include':[{'model':'Interval','as':_0xb111('0x20')}]}});};exports['getSmsAccountById']=function(_0x33bd43){return request(_0xb111('0x21'),{'options':{'where':{'id':_0x33bd43},'attributes':['id',_0xb111('0x14')]}});};exports[_0xb111('0x22')]=function(_0x18527e){return request(_0xb111('0x23'),{'body':_0x18527e});};exports[_0xb111('0x24')]=function(_0x5be7c1){return request('CreateSquareDetailsReport',{'body':_0x5be7c1});};exports[_0xb111('0x25')]=function(_0x35b511){return request(_0xb111('0x26'),{'body':_[_0xb111('0x27')](_0x35b511,{'project_name':_0x35b511[_0xb111('0x28')],'prev_project_name':_0x35b511[_0xb111('0x29')]||'','is_subproject':_0x35b511['arg_2']?!![]:![],'leaveAt':moment()[_0xb111('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xb111('0x2b')]=function(_0x6ef78b){return request('CreateSquareRecording',{'body':_0x6ef78b});};exports['createSquareMessage']=function(_0x31bcf0){return request('CreateSquareMessage',{'body':_0x31bcf0});};exports[_0xb111('0x2c')]=function(_0x29472c){return request(_0xb111('0x2d'),{'options':{'raw':![],'where':{'phone':_0x29472c[_0xb111('0x2e')],'ListId':_0x29472c['ListId']}}})[_0xb111('0x7')](function(_0x29e091){if(_0x29e091){return _0x29e091;}return request(_0xb111('0x2f'),{'body':_0x29472c});});};exports[_0xb111('0x30')]=function(_0x5b6624){return request(_0xb111('0x31'),{'options':{'where':{'id':_0x5b6624},'attributes':['name']}});};exports[_0xb111('0x32')]=function(_0x336a03,_0x503d01){return request(_0xb111('0x33'),{'body':{'interface':_0x503d01},'options':{'where':_0x336a03}});};exports[_0xb111('0x34')]=function(_0x9b56a1,_0x1c3a12,_0x2bb5b4){return request(_0xb111('0x35'),{'body':{'type':_0x1c3a12,'uniqueid':_0x2bb5b4},'options':{'where':_0x9b56a1}});};exports[_0xb111('0x36')]=function(_0x4044ec){return request(_0xb111('0x37'),{'body':{},'options':{'where':_0x4044ec}});};exports['agentLogout']=function(_0x2deda2){return request('LogoutUser',{'body':{},'options':{'where':_0x2deda2}});}; \ No newline at end of file +var _0xb47f=['moment','lodash','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','CreateCmContact','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird'];(function(_0x571a87,_0x2c67a8){var _0x413114=function(_0x2927c1){while(--_0x2927c1){_0x571a87['push'](_0x571a87['shift']());}};_0x413114(++_0x2c67a8);}(_0xb47f,0x15b));var _0xfb47=function(_0x39ec3b,_0x853748){_0x39ec3b=_0x39ec3b-0x0;var _0x104228=_0xb47f[_0x39ec3b];return _0x104228;};'use strict';var BPromise=require(_0xfb47('0x0'));var moment=require(_0xfb47('0x1'));var _=require(_0xfb47('0x2'));var util=require(_0xfb47('0x3'));var jayson=require(_0xfb47('0x4'));var client=jayson['client'][_0xfb47('0x5')]({'port':0x2329});function request(_0x5a6181,_0x4418cd){return new BPromise(function(_0x1da5dc,_0x24ef23){return client[_0xfb47('0x6')](_0x5a6181,_0x4418cd)[_0xfb47('0x7')](function(_0x4a505a){if(_0x4a505a[_0xfb47('0x8')]){return _0x24ef23(_0x4a505a[_0xfb47('0x8')][_0xfb47('0x9')]);}else{return _0x1da5dc(_0x4a505a[_0xfb47('0xa')]);}})[_0xfb47('0xb')](function(_0x4e7470){return _0x24ef23(_0x4e7470);});});}exports[_0xfb47('0xc')]=function(_0x20f27b){return request(_0xfb47('0xd'),{'options':{'raw':![],'where':{'name':_0x20f27b},'attributes':[_0xfb47('0xe')]}});};exports[_0xfb47('0xf')]=function(_0x452e0b){return request(_0xfb47('0x10'),{'options':{'raw':![],'where':{'id':_0x452e0b},'include':[{'model':_0xfb47('0x11'),'as':_0xfb47('0x12')}],'attributes':['id',_0xfb47('0x13'),_0xfb47('0x14')]}});};exports[_0xfb47('0x15')]=function(_0x276d82){return request(_0xfb47('0xd'),{'options':{'where':{'id':_0x276d82},'attributes':[_0xfb47('0x13')]}});};exports['getVoiceQueueById']=function(_0x566b6d){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x566b6d},'attributes':['name']}});};exports[_0xfb47('0x16')]=function(_0x38412b){return request(_0xfb47('0x17'),{'options':{'where':{'id':_0x38412b},'attributes':[_0xfb47('0x13')]}});};exports[_0xfb47('0x18')]=function(_0x266a50){return request(_0xfb47('0x19'),{'options':{'where':{'id':_0x266a50},'attributes':[_0xfb47('0x1a')]}});};exports[_0xfb47('0x1b')]=function(_0x29e611){return request('ShowUser',{'options':{'where':{'id':_0x29e611},'attributes':['name']}});};exports[_0xfb47('0x1c')]=function(_0x23e14a){return request('ShowTrunk',{'options':{'where':{'id':_0x23e14a},'attributes':['name']}});};exports[_0xfb47('0x1d')]=function(_0x1b3f67){return request(_0xfb47('0x1e'),{'options':{'where':{'id':_0x1b3f67},'attributes':['save_name']}});};exports[_0xfb47('0x1f')]=function(_0x53bd12){return request(_0xfb47('0x20'),{'options':{'raw':![],'where':{'id':_0x53bd12},'include':[{'model':_0xfb47('0x21'),'as':_0xfb47('0x22')}]}});};exports[_0xfb47('0x23')]=function(_0x132b7b){return request('ShowSmsAccount',{'options':{'where':{'id':_0x132b7b},'attributes':['id',_0xfb47('0x13')]}});};exports[_0xfb47('0x24')]=function(_0x575703){return request(_0xfb47('0x25'),{'body':_0x575703});};exports[_0xfb47('0x26')]=function(_0x416fa7){return request('CreateSquareDetailsReport',{'body':_0x416fa7});};exports[_0xfb47('0x27')]=function(_0x472ade){return request(_0xfb47('0x28'),{'body':_[_0xfb47('0x29')](_0x472ade,{'project_name':_0x472ade[_0xfb47('0x2a')],'prev_project_name':_0x472ade['arg_2']||'','is_subproject':_0x472ade[_0xfb47('0x2b')]?!![]:![],'leaveAt':moment()['format'](_0xfb47('0x2c'))})});};exports[_0xfb47('0x2d')]=function(_0x300c7c){return request(_0xfb47('0x2e'),{'body':_0x300c7c});};exports[_0xfb47('0x2f')]=function(_0x60f082){return request(_0xfb47('0x30'),{'body':_0x60f082});};exports[_0xfb47('0x31')]=function(_0x2fad3){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x2fad3['phone'],'ListId':_0x2fad3['ListId']}}})[_0xfb47('0x7')](function(_0x144941){if(_0x144941){return _0x144941;}return request(_0xfb47('0x32'),{'body':_0x2fad3});});};exports['getPauseById']=function(_0x283b7e){return request('ShowPause',{'options':{'where':{'id':_0x283b7e},'attributes':['name']}});};exports[_0xfb47('0x33')]=function(_0x5970ae,_0xd5b278){return request(_0xfb47('0x34'),{'body':{'interface':_0xd5b278},'options':{'where':_0x5970ae}});};exports[_0xfb47('0x35')]=function(_0xe04a33,_0x23319e,_0x4c385e){return request('PauseUser',{'body':{'type':_0x23319e,'uniqueid':_0x4c385e},'options':{'where':_0xe04a33}});};exports[_0xfb47('0x36')]=function(_0xe30271){return request(_0xfb47('0x37'),{'body':{},'options':{'where':_0xe30271}});};exports[_0xfb47('0x38')]=function(_0x10dfa6){return request(_0xfb47('0x39'),{'body':{},'options':{'where':_0x10dfa6}});}; \ 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 1a80f23..0496753 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 _0xda55=['./lex','./polly'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda55,0x6d));var _0x5da5=function(_0x2de9de,_0xd46ad){_0x2de9de=_0x2de9de-0x0;var _0x34be8c=_0xda55[_0x2de9de];return _0x34be8c;};var polly=require(_0x5da5('0x0'));var lex=require(_0x5da5('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc3b5=['exports'];(function(_0x5f51d2,_0x4f0133){var _0x24bf08=function(_0x25e6b5){while(--_0x25e6b5){_0x5f51d2['push'](_0x5f51d2['shift']());}};_0x24bf08(++_0x4f0133);}(_0xc3b5,0x6f));var _0x5c3b=function(_0xd195,_0xd23a8d){_0xd195=_0xd195-0x0;var _0x2f9616=_0xc3b5[_0xd195];return _0x2f9616;};var polly=require('./polly');var lex=require('./lex');module[_0x5c3b('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 13f7957..abcbc85 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 _0x9b9b=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b9b,0x114));var _0xb9b9=function(_0x3cbee0,_0x352a0a){_0x3cbee0=_0x3cbee0-0x0;var _0x2ed094=_0x9b9b[_0x3cbee0];return _0x2ed094;};'use strict';var lex=require('./lib/api');module[_0xb9b9('0x0')]=function(_0x4980d7,_0x5010f5,_0x2ae8a0,_0x153734,_0x1adf50,_0x1f6fea){return lex(_0x4980d7,_0x5010f5,_0x2ae8a0,_0x153734,_0x1adf50,_0x1f6fea);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237){return lex(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237);}; \ 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 52aa82d..b8f602d 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 _0x0e39=['slot_','bluebird','aws-sdk','postText','slots','hasOwnProperty'];(function(_0x5c4139,_0x12479e){var _0x5df4b6=function(_0xb532ce){while(--_0xb532ce){_0x5c4139['push'](_0x5c4139['shift']());}};_0x5df4b6(++_0x12479e);}(_0x0e39,0x85));var _0x90e3=function(_0x23a4bc,_0x32deba){_0x23a4bc=_0x23a4bc-0x0;var _0x2a450e=_0x0e39[_0x23a4bc];return _0x2a450e;};'use strict';var BPromise=require(_0x90e3('0x0'));var AWS=require(_0x90e3('0x1'));function lexResult(_0x5e199a,_0x4ede1f){return new BPromise(function(_0x1a9490,_0x33dd6b){_0x5e199a[_0x90e3('0x2')](_0x4ede1f,function(_0x375f86,_0x4bec31){if(_0x375f86){_0x33dd6b(_0x375f86);}if(_0x4bec31['slots']){for(const _0x2a73d1 in _0x4bec31['slots']){if(_0x4bec31[_0x90e3('0x3')][_0x90e3('0x4')](_0x2a73d1)){var _0x3bcf45=_0x4bec31[_0x90e3('0x3')][_0x2a73d1];_0x4bec31[_0x90e3('0x5')+_0x2a73d1]=_0x3bcf45;}}}_0x1a9490(_0x4bec31);});});}module['exports']=function(_0x2e4a47,_0x3df8fd,_0x47e82b,_0x5d51d2,_0x3be7d8,_0x3d6a18){var _0x27f01a=new AWS['LexRuntime']({'accessKeyId':_0x3df8fd,'secretAccessKey':_0x47e82b,'region':_0x5d51d2});var _0x32f512={'botAlias':'$LATEST','botName':_0x3d6a18,'inputText':_0x3be7d8,'userId':_0x2e4a47};return lexResult(_0x27f01a,_0x32f512);}; \ No newline at end of file +var _0x51bf=['LexRuntime','$LATEST','slots','hasOwnProperty','slot_','exports'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x51bf,0x8c));var _0xf51b=function(_0x21212d,_0x58720c){_0x21212d=_0x21212d-0x0;var _0x26fd4f=_0x51bf[_0x21212d];return _0x26fd4f;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x134d18,_0x3c4be1){return new BPromise(function(_0x5b3159,_0x4884df){_0x134d18['postText'](_0x3c4be1,function(_0x590593,_0x250c4f){if(_0x590593){_0x4884df(_0x590593);}if(_0x250c4f['slots']){for(const _0x5849a6 in _0x250c4f[_0xf51b('0x0')]){if(_0x250c4f[_0xf51b('0x0')][_0xf51b('0x1')](_0x5849a6)){var _0x51f7a9=_0x250c4f[_0xf51b('0x0')][_0x5849a6];_0x250c4f[_0xf51b('0x2')+_0x5849a6]=_0x51f7a9;}}}_0x5b3159(_0x250c4f);});});}module[_0xf51b('0x3')]=function(_0x4de904,_0xe95ca4,_0x2a1fa7,_0x59f757,_0x4f9a9c,_0xd5e744){var _0x5c7674=new AWS[(_0xf51b('0x4'))]({'accessKeyId':_0xe95ca4,'secretAccessKey':_0x2a1fa7,'region':_0x59f757});var _0x1e6d1c={'botAlias':_0xf51b('0x5'),'botName':_0xd5e744,'inputText':_0x4f9a9c,'userId':_0x4de904};return lexResult(_0x5c7674,_0x1e6d1c);}; \ 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 c1e462e..092922a 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 _0xf9c9=['exports'];(function(_0x3674f5,_0x5ce4c4){var _0xe446b9=function(_0x1689db){while(--_0x1689db){_0x3674f5['push'](_0x3674f5['shift']());}};_0xe446b9(++_0x5ce4c4);}(_0xf9c9,0x18d));var _0x9f9c=function(_0x20db3c,_0x2fda98){_0x20db3c=_0x20db3c-0x0;var _0x10daa=_0xf9c9[_0x20db3c];return _0x10daa;};'use strict';var polly=require('./lib/api');module[_0x9f9c('0x0')]=function(_0x470773,_0x3f3c62,_0x16904c,_0x4437f9,_0x2609f9,_0x41de49,_0x12679e){return polly(_0x470773,_0x3f3c62,_0x16904c,_0x4437f9,_0x2609f9,_0x41de49,_0x12679e);}; \ No newline at end of file +var _0xb5ee=['exports','./lib/api'];(function(_0x1c8408,_0x1e1ca7){var _0x32c2cc=function(_0x16c134){while(--_0x16c134){_0x1c8408['push'](_0x1c8408['shift']());}};_0x32c2cc(++_0x1e1ca7);}(_0xb5ee,0xe1));var _0xeb5e=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xb5ee[_0x277107];return _0x1da046;};'use strict';var polly=require(_0xeb5e('0x0'));module[_0xeb5e('0x1')]=function(_0x335e3d,_0x473b7,_0x23ca95,_0x5030f,_0x1ed533,_0x5db8be,_0x11bae1){return polly(_0x335e3d,_0x473b7,_0x23ca95,_0x5030f,_0x1ed533,_0x5db8be,_0x11bae1);}; \ 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 64b4d5f..ae733f2 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 _0xa213=['text','mp3','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x26e736,_0xb5cc80){var _0x3154fa=function(_0x22ea40){while(--_0x22ea40){_0x26e736['push'](_0x26e736['shift']());}};_0x3154fa(++_0xb5cc80);}(_0xa213,0xb6));var _0x3a21=function(_0x4c4471,_0x41da20){_0x4c4471=_0x4c4471-0x0;var _0x2c6f52=_0xa213[_0x4c4471];return _0x2c6f52;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x3a21('0x0'));var AWS=require(_0x3a21('0x1'));function pollyResult(_0x6c6b98,_0x18940e,_0x16cedc){return new BPromise(function(_0x566b44,_0x5ec5c8){_0x6c6b98[_0x3a21('0x2')](_0x18940e,function(_0x539668,_0x2d22dd){if(_0x539668){_0x5ec5c8(_0x539668);}else if(_0x2d22dd){if(_0x2d22dd[_0x3a21('0x3')]instanceof Buffer){fs[_0x3a21('0x4')](_0x16cedc,_0x2d22dd['AudioStream'],function(_0x562bfa){if(_0x562bfa){_0x5ec5c8(_0x562bfa);}else{_0x566b44();}});}else{_0x5ec5c8(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5ec5c8(new Error(_0x3a21('0x5')));}});});}module[_0x3a21('0x6')]=function(_0x1ef9f4,_0x6a4045,_0x3efe0d,_0x1a0a21,_0x27e5bb,_0x6f0af4,_0x41dc47){var _0x22e900=new AWS[(_0x3a21('0x7'))]({'accessKeyId':_0x1ef9f4,'secretAccessKey':_0x6a4045,'region':_0x3efe0d});var _0x431f7e={'Text':_0x27e5bb,'TextType':_0x6f0af4||_0x3a21('0x8'),'OutputFormat':_0x3a21('0x9'),'VoiceId':_0x1a0a21};return pollyResult(_0x22e900,_0x431f7e,_0x41dc47);}; \ No newline at end of file +var _0x96b9=['synthesizeSpeech','writeFile','AudioStream','Polly','text','mp3','path','randomstring','aws-sdk'];(function(_0x10d341,_0x57ff35){var _0xddc36d=function(_0x1c24f0){while(--_0x1c24f0){_0x10d341['push'](_0x10d341['shift']());}};_0xddc36d(++_0x57ff35);}(_0x96b9,0x96));var _0x996b=function(_0x43ab8a,_0x48091a){_0x43ab8a=_0x43ab8a-0x0;var _0x4ec077=_0x96b9[_0x43ab8a];return _0x4ec077;};'use strict';var fs=require('fs');var path=require(_0x996b('0x0'));var BPromise=require('bluebird');var rs=require(_0x996b('0x1'));var AWS=require(_0x996b('0x2'));function pollyResult(_0x4b664b,_0x28632d,_0x2c0854){return new BPromise(function(_0x1f8548,_0x2f598f){_0x4b664b[_0x996b('0x3')](_0x28632d,function(_0x3809d6,_0x101fe2){if(_0x3809d6){_0x2f598f(_0x3809d6);}else if(_0x101fe2){if(_0x101fe2['AudioStream']instanceof Buffer){fs[_0x996b('0x4')](_0x2c0854,_0x101fe2[_0x996b('0x5')],function(_0x549722){if(_0x549722){_0x2f598f(_0x549722);}else{_0x1f8548();}});}else{_0x2f598f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2f598f(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x28788c,_0x364109,_0x938952,_0xce5ae8,_0x4e70b7,_0x4f5a9c,_0x5218c4){var _0x2dfadc=new AWS[(_0x996b('0x6'))]({'accessKeyId':_0x28788c,'secretAccessKey':_0x364109,'region':_0x938952});var _0x14e735={'Text':_0x4e70b7,'TextType':_0x4f5a9c||_0x996b('0x7'),'OutputFormat':_0x996b('0x8'),'VoiceId':_0xce5ae8};return pollyResult(_0x2dfadc,_0x14e735,_0x5218c4);}; \ 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 bb712a2..50d378c 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 _0x69a9=['./lib/api','exports'];(function(_0x4e8150,_0x487bcf){var _0x4798e3=function(_0x513daa){while(--_0x513daa){_0x4e8150['push'](_0x4e8150['shift']());}};_0x4798e3(++_0x487bcf);}(_0x69a9,0x16c));var _0x969a=function(_0x151bc5,_0x1df8a6){_0x151bc5=_0x151bc5-0x0;var _0x31ae13=_0x69a9[_0x151bc5];return _0x31ae13;};'use strict';var asr=require(_0x969a('0x0'));module[_0x969a('0x1')]=function(_0x18d4b1,_0x68055b,_0xcfca82,_0x5ea8b3){return asr(_0x18d4b1,_0x68055b,_0xcfca82);}; \ No newline at end of file +var _0x811f=['exports'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x811f,0x94));var _0xf811=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x811f[_0x2b55b5];return _0x103d28;};'use strict';var asr=require('./lib/api');module[_0xf811('0x0')]=function(_0xdd2c81,_0x14ec34,_0x438a16,_0x5c5cf9){return asr(_0xdd2c81,_0x14ec34,_0x438a16);}; \ 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 2511856..0ccb8f8 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 _0xaf07=['POST','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0xaf07,0x7a));var _0x7af0=function(_0xeca21e,_0x59e2e5){_0xeca21e=_0xeca21e-0x0;var _0x5eb42f=_0xaf07[_0xeca21e];return _0x5eb42f;};'use strict';var url=require(_0x7af0('0x0'));var BPromise=require(_0x7af0('0x1'));var fs=require('fs');var host=_0x7af0('0x2');module[_0x7af0('0x3')]=function(_0x52ddee,_0x1fec7f,_0x56a8a1){return new BPromise(function(_0x58cbd6,_0x515a19){var _0x2bb70b;if(typeof _0x52ddee!==_0x7af0('0x4')||_0x52ddee['length']===0x0){return _0x515a19(_0x7af0('0x5'));}if(typeof _0x1fec7f!==_0x7af0('0x4')||_0x1fec7f['length']===0x0){return _0x515a19(_0x7af0('0x6'));}if(typeof _0x56a8a1!=='undefined'&&(typeof _0x56a8a1!=='string'||_0x56a8a1[_0x7af0('0x7')]===0x0)){return _0x515a19(_0x7af0('0x8'));}try{_0x2bb70b=fs[_0x7af0('0x9')](_0x52ddee)['toString']('base64');}catch(_0x274510){return _0x515a19(_0x274510);}return _0x58cbd6({'method':_0x7af0('0xa'),'uri':host+_0x7af0('0xb')+_0x1fec7f,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x56a8a1},'audio':{'content':_0x2bb70b}},'json':!![]});});}; \ No newline at end of file +var _0x6b1b=['string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','base64','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x4c9c5b,_0x210cbb){var _0x4088ab=function(_0x3f1d0a){while(--_0x3f1d0a){_0x4c9c5b['push'](_0x4c9c5b['shift']());}};_0x4088ab(++_0x210cbb);}(_0x6b1b,0x17c));var _0xb6b1=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x6b1b[_0x1cfa0d];return _0xe33279;};'use strict';var url=require(_0xb6b1('0x0'));var BPromise=require(_0xb6b1('0x1'));var fs=require('fs');var host=_0xb6b1('0x2');module[_0xb6b1('0x3')]=function(_0x3459e2,_0xf2b008,_0x3888b6){return new BPromise(function(_0x26a3c3,_0xc28d44){var _0xe5e01;if(typeof _0x3459e2!==_0xb6b1('0x4')||_0x3459e2['length']===0x0){return _0xc28d44('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xf2b008!==_0xb6b1('0x4')||_0xf2b008['length']===0x0){return _0xc28d44(_0xb6b1('0x5'));}if(typeof _0x3888b6!==_0xb6b1('0x6')&&(typeof _0x3888b6!==_0xb6b1('0x4')||_0x3888b6[_0xb6b1('0x7')]===0x0)){return _0xc28d44('lang\x20should\x20be\x20a\x20string');}try{_0xe5e01=fs[_0xb6b1('0x8')](_0x3459e2)['toString'](_0xb6b1('0x9'));}catch(_0x312669){return _0xc28d44(_0x312669);}return _0x26a3c3({'method':'POST','uri':host+_0xb6b1('0xa')+_0xf2b008,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xb6b1('0xb'),'languageCode':_0x3888b6},'audio':{'content':_0xe5e01}},'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 dff231d..08e914c 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 _0xf9c9=['exports','./asr'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xf9c9,0x1b3));var _0x9f9c=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0xf9c9[_0x291aaf];return _0x5571e6;};var asr=require(_0x9f9c('0x0'));module[_0x9f9c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x49a2=['./asr'];(function(_0x337b43,_0x54e26b){var _0x9fd62d=function(_0x10a462){while(--_0x10a462){_0x337b43['push'](_0x337b43['shift']());}};_0x9fd62d(++_0x54e26b);}(_0x49a2,0x112));var _0x249a=function(_0x118733,_0x2bd820){_0x118733=_0x118733-0x0;var _0x4777af=_0x49a2[_0x118733];return _0x4777af;};var asr=require(_0x249a('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index cead4a5..87dcad9 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 _0x2138=['[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','intent','displayName','isFallback','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20transcription','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','sestekNDA','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','http','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','util','./aws','./google','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','download\x20error','data','end','transcode','wav','error\x20convert','start','resolve','tmp','generate','then','unlink','chmodSync','777','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','POST','.mp3','audioContent','writeFile','.wav','googleCloudTTS\x20path','split','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','uri','alternatives','transcript','results','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch'];(function(_0xdd1bfd,_0x396da3){var _0x4901ff=function(_0x285a7d){while(--_0x285a7d){_0xdd1bfd['push'](_0xdd1bfd['shift']());}};_0x4901ff(++_0x396da3);}(_0x2138,0x1ac));var _0x8213=function(_0xf8e668,_0x14493b){_0xf8e668=_0xf8e668-0x0;var _0xdf09aa=_0x2138[_0xf8e668];return _0xdf09aa;};'use strict';var apiai=require(_0x8213('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x8213('0x1'));var https=require('https');var md5=require(_0x8213('0x2'));var path=require(_0x8213('0x3'));var querystring=require(_0x8213('0x4'));var rp=require(_0x8213('0x5'));var rs=require(_0x8213('0x6'));var sox=require(_0x8213('0x7'));var tts=require(_0x8213('0x8'));var urlParse=require('url')['parse'];var util=require(_0x8213('0x9'));var aws=require(_0x8213('0xa'));var google=require(_0x8213('0xb'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x8213('0xc'));var ISPEECH_API=_0x8213('0xd');function downloadFile(_0x1d4d58,_0x2836fb){return new BPromise(function(_0x3ee780,_0xc795ad){var _0x4a34f4=urlParse(_0x1d4d58);var _0x335633=_0x4a34f4[_0x8213('0xe')]===_0x8213('0xf')?https:http;var _0xb0d405={'host':_0x4a34f4[_0x8213('0x10')],'path':_0x4a34f4[_0x8213('0x3')],'headers':{'user-agent':_0x8213('0x11')}};_0x335633[_0x8213('0x12')](_0xb0d405,function(_0x1526cb){if(_0x1526cb[_0x8213('0x13')]!==0xc8){logger[_0x8213('0x14')](_0x8213('0x15')+_0x1d4d58+_0x8213('0x16')+_0x1526cb[_0x8213('0x13')]+'\x20('+_0x1526cb[_0x8213('0x17')]+')');_0xc795ad(new Error('request\x20to\x20'+_0x1d4d58+_0x8213('0x16')+_0x1526cb['statusCode']+'\x20('+_0x1526cb[_0x8213('0x17')]+')'));return;}var _0x1db499=fs['createWriteStream'](_0x2836fb);_0x1db499['on'](_0x8213('0x18'),function(){logger[_0x8213('0x19')](_0x8213('0x1a'));_0x1db499[_0x8213('0x1b')](_0x3ee780);});_0x1db499['on'](_0x8213('0x14'),function(_0x1b2527){fs['unlink'](_0x2836fb);logger[_0x8213('0x14')](_0x8213('0x1c'),_0x1b2527);_0xc795ad(_0x1b2527);});_0x1526cb['pipe'](_0x1db499);})['on'](_0x8213('0x14'),function(_0x5dab6b){logger['error'](_0x5dab6b);_0xc795ad(_0x5dab6b);})['end']();});}function uploadFile(_0x19a147){return new BPromise(function(_0x605d7,_0x210b67){var _0x17d9c9=urlParse(_0x19a147);var _0x24faff=_0x17d9c9[_0x8213('0xe')]==='https:'?https:http;var _0x1a202c={'host':_0x17d9c9[_0x8213('0x10')],'path':_0x17d9c9['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x24faff[_0x8213('0x12')](_0x1a202c,function(_0x54007b){if(_0x54007b[_0x8213('0x13')]!==0xc8){_0x210b67(new Error(_0x8213('0x15')+_0x19a147+'\x20failed,\x20status\x20code\x20=\x20'+_0x54007b[_0x8213('0x13')]+'\x20('+_0x54007b['statusMessage']+')'));return;}var _0xd25d6b='';_0x54007b['on'](_0x8213('0x1d'),function(_0x4f625f){_0xd25d6b+=_0x4f625f;});_0x54007b['on'](_0x8213('0x1e'),function(){_0x605d7(_0xd25d6b);});})['on'](_0x8213('0x14'),function(_0x1c93d8){_0x210b67(_0x1c93d8);})['end']();});}function convertFile(_0x5e07cd,_0x4a0334){return new BPromise(function(_0x23e6ab,_0x14c46b){var _0x73215f=sox[_0x8213('0x1f')](_0x5e07cd,_0x4a0334,{'sampleRate':0x1f40,'format':_0x8213('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x73215f['on'](_0x8213('0x14'),function(_0x54db4e){logger[_0x8213('0x14')](_0x8213('0x21'),_0x54db4e);_0x14c46b(_0x54db4e);});_0x73215f['on'](_0x8213('0x1e'),function(){logger[_0x8213('0x19')]('finish\x20to\x20convert');_0x23e6ab();});_0x73215f[_0x8213('0x22')]();});}function base64Decode(_0xac43d6,_0x29b54e){var _0x10d5d4=path[_0x8213('0x23')](__dirname,_0x8213('0x24'),rs[_0x8213('0x25')](0x4)+'.wav');fs['writeFileSync'](_0x10d5d4,_0xac43d6,'base64');return convertFile(_0x10d5d4,_0x29b54e)[_0x8213('0x26')](function(){try{fs[_0x8213('0x27')](_0x10d5d4);fs[_0x8213('0x28')](_0x29b54e,_0x8213('0x29'));}catch(_0x39d298){logger[_0x8213('0x14')](_0x39d298);}return _0x29b54e['split']('.')[0x0];});}function base64Encode(_0x24a72a){var _0x37d535=fs[_0x8213('0x2a')](_0x24a72a);return new Buffer(_0x37d535)['toString'](_0x8213('0x2b'));}exports[_0x8213('0x2c')]=function(_0xc82ef7,_0x518ff2,_0x4c557d,_0x5a66a6,_0x492da1,_0x1efe88){var _0x8f04ab,_0x3f3d0d;var _0x2e54e2=_0x8213('0x2d');var _0x56a379=_0x8213('0x2e')+_0xc82ef7;var _0x46feb2={};if(_0x518ff2==='ssml'){_0x46feb2[_0x8213('0x2f')]={'ssml':_0x4c557d};}else{_0x46feb2['input']={'text':_0x4c557d};};_0x46feb2['voice']={'languageCode':_0x5a66a6,'ssmlGender':_0x492da1};_0x46feb2[_0x8213('0x30')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2c38af={'url':_0x2e54e2+'text:synthesize'+_0x56a379,'method':_0x8213('0x31'),'json':!![],'body':_0x46feb2};return rp(_0x2c38af)['then'](function(_0x1eb256){return new BPromise(function(_0x192e74,_0xb0c02c){_0x8f04ab=path['resolve'](__dirname,_0x8213('0x24'),rs[_0x8213('0x25')](0x4)+_0x8213('0x32'));var _0x3e8ffd=Buffer['from'](_0x1eb256[_0x8213('0x33')],'base64');return fs[_0x8213('0x34')](_0x8f04ab,_0x3e8ffd,function(_0x34e880){_0xb0c02c(_0x34e880);},function(_0x34da31){fs['chmodSync'](_0x8f04ab,_0x8213('0x29'));_0x192e74(_0x34da31);});});})['then'](function(_0x3cc40b){_0x3f3d0d=path['resolve'](__dirname,_0x8213('0x24'),rs[_0x8213('0x25')](0x4)+_0x8213('0x35'));return convertFile(_0x8f04ab,_0x3f3d0d);})[_0x8213('0x26')](function(){try{fs['unlink'](_0x8f04ab);fs[_0x8213('0x28')](_0x3f3d0d,_0x8213('0x29'));}catch(_0x599d77){logger[_0x8213('0x14')](_0x599d77);}logger['info'](_0x8213('0x36'),_0x3f3d0d['split']('.')[0x0]);return _0x3f3d0d[_0x8213('0x37')]('.')[0x0];});};exports['googleTTS']=function(_0x1cf9e6,_0x1bb615){var _0x394068='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4cc656,_0x59cb29;var _0xe19741;var _0x29efb4={'encoding':_0x8213('0x38'),'method':_0x8213('0x31'),'timeout':0x2710,'url':_0x394068,'headers':{'Content-Type':_0x8213('0x39')},'body':_0x8213('0x3a')+encodeURIComponent(JSON[_0x8213('0x3b')]([[['jQ1olc',JSON[_0x8213('0x3b')]([_0x1cf9e6,_0x1bb615||'en',![],_0x8213('0x3c')]),null,'generic']]]))};return rp(_0x29efb4)[_0x8213('0x26')](function(_0x49c153){try{_0xe19741=eval(_0x49c153['slice'](0x5))[0x0][0x2];}catch(_0x1bf385){throw new Error(_0x8213('0x3d')+_0x49c153[_0x8213('0x1d')]);}if(!_0xe19741){if(_0x1cf9e6['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x8213('0x3e')+_0x1bb615+_0x8213('0x3f'));}}try{_0xe19741=eval(_0xe19741)[0x0];}catch(_0x2c57c7){throw new Error(_0x8213('0x3d')+res[_0x8213('0x1d')]);}const _0x148007=_0xe19741;_0x4cc656=path['resolve'](__dirname,_0x8213('0x24'),rs['generate'](0x4)+_0x8213('0x32'));fs[_0x8213('0x40')](_0x4cc656,_0xe19741,{'encoding':'base64'});_0x59cb29=path[_0x8213('0x23')](__dirname,'tmp',rs[_0x8213('0x25')](0x4)+_0x8213('0x35'));return convertFile(_0x4cc656,_0x59cb29);})[_0x8213('0x26')](function(){try{fs[_0x8213('0x27')](_0x4cc656);fs['chmodSync'](_0x59cb29,_0x8213('0x29'));}catch(_0x19c6f8){logger[_0x8213('0x14')](_0x19c6f8);}logger[_0x8213('0x19')](_0x8213('0x41'),_0x59cb29[_0x8213('0x37')]('.')[0x0]);return _0x59cb29[_0x8213('0x37')]('.')[0x0];});};exports[_0x8213('0x42')]=function(_0xce0ef,_0x54fde5,_0x2f1a9e){return google['asr'](_0xce0ef,_0x54fde5,_0x2f1a9e)[_0x8213('0x26')](function(_0x3033d6){logger['info'](_0x3033d6[_0x8213('0x43')]);return rp(_0x3033d6);})['then'](function(_0x2d839f){var _0x34a14c='';var _0x4bf7d7=0x0;try{fs[_0x8213('0x27')](_0xce0ef);}catch(_0x1fdccd){logger[_0x8213('0x14')](_0x1fdccd);}if(_0x2d839f&&_0x2d839f['results']){_0x34a14c=_0x2d839f['results']['map'](function(_0x1087b5){return _0x1087b5&&_0x1087b5[_0x8213('0x44')][0x0]&&_0x1087b5[_0x8213('0x44')][0x0][_0x8213('0x45')]?_0x1087b5[_0x8213('0x44')][0x0][_0x8213('0x45')]:'';})['join']('\x0a');_0x4bf7d7=_0x2d839f[_0x8213('0x46')]['map'](function(_0x1fc7de){return _0x1fc7de&&_0x1fc7de[_0x8213('0x44')][0x0]&&_0x1fc7de[_0x8213('0x44')][0x0][_0x8213('0x47')]?_0x1fc7de[_0x8213('0x44')][0x0][_0x8213('0x47')]:0x0;})[_0x8213('0x48')]('\x0a');}logger[_0x8213('0x19')](_0x8213('0x49'),_0x34a14c);logger['info'](_0x8213('0x4a'),_0x4bf7d7);return{'transcript':_0x34a14c,'confidence':_0x4bf7d7};})[_0x8213('0x4b')](function(_0x352be7){logger[_0x8213('0x14')](_0x8213('0x4c'),_0x352be7[_0x8213('0x13')],_0x352be7[_0x8213('0x4d')],_0x352be7[_0x8213('0x4e')]);});};exports[_0x8213('0x4f')]=function(_0x5c6d46,_0x2c2c51,_0x36f12d,_0x511c41){var _0x22c53f=apiai(_0x2c2c51,{'language':_0x511c41||'en'});return _0x22c53f[_0x8213('0x50')](_0x36f12d,{'sessionId':md5(_0x5c6d46)})[_0x8213('0x26')](function(_0x3a2632){logger[_0x8213('0x19')](JSON[_0x8213('0x3b')](_0x3a2632));return{'source':_0x3a2632[_0x8213('0x51')][_0x8213('0x52')],'resolvedQuery':_0x3a2632[_0x8213('0x51')][_0x8213('0x53')],'action':_0x3a2632['result'][_0x8213('0x54')],'actionIncomplete':_0x3a2632[_0x8213('0x51')][_0x8213('0x55')],'speech':_0x3a2632[_0x8213('0x51')][_0x8213('0x56')][_0x8213('0x57')],'score':_0x3a2632[_0x8213('0x51')][_0x8213('0x58')],'statusCode':_0x3a2632[_0x8213('0x59')][_0x8213('0x5a')],'endConversation':_0x3a2632[_0x8213('0x51')][_0x8213('0x5b')][_0x8213('0x5c')]||![],'isFallbackIntent':_0x3a2632['result'][_0x8213('0x5b')][_0x8213('0x5d')]};});};exports[_0x8213('0x5e')]=function(_0x39afc9,_0x20173e,_0x451ae8,_0x4edc42,_0x3b8655,_0x498ffb){var _0x2a6125=_0x4edc42['replace'](/\\n/g,'\x0a');var _0x52ae39={'credentials':{'private_key':_0x2a6125,'client_email':_0x451ae8}};var _0x2c5c9b=new dialogflow[(_0x8213('0x5f'))](_0x52ae39);var _0x3f0998=_0x2c5c9b['sessionPath'](_0x20173e,md5(_0x39afc9));var _0x4bc37b={'session':_0x3f0998,'queryInput':{'text':{'text':_0x3b8655,'languageCode':_0x498ffb}}};return _0x2c5c9b[_0x8213('0x60')](_0x4bc37b)['then'](function(_0x43529f){if(_0x43529f&&_0x43529f[_0x8213('0x61')]){logger['info'](_0x8213('0x62'),JSON['stringify'](_0x43529f));var _0x5063ef=_0x43529f[0x0];if(_0x5063ef){var _0x57b1a7={'action':_0x5063ef[_0x8213('0x63')][_0x8213('0x54')],'allRequiredParamsPresent':_0x5063ef[_0x8213('0x63')][_0x8213('0x64')],'endConversation':_0x5063ef[_0x8213('0x63')][_0x8213('0x65')]&&_0x5063ef[_0x8213('0x63')][_0x8213('0x65')]['fields']?_0x5063ef['queryResult']['diagnosticInfo']['fields'][_0x8213('0x66')]['boolValue']:![],'fulfillmentText':_0x5063ef[_0x8213('0x63')]['fulfillmentText'],'intentName':_0x5063ef[_0x8213('0x63')][_0x8213('0x67')][_0x8213('0x4d')],'intentDisplayName':_0x5063ef[_0x8213('0x63')][_0x8213('0x67')][_0x8213('0x68')],'isFallbackIntent':_0x5063ef[_0x8213('0x63')][_0x8213('0x67')][_0x8213('0x69')],'languageCode':_0x5063ef['queryResult']['languageCode'],'queryText':_0x5063ef[_0x8213('0x63')]['queryText'],'responseId':_0x5063ef[_0x8213('0x6a')],'score':_0x5063ef[_0x8213('0x63')][_0x8213('0x6b')],'speech':_0x5063ef[_0x8213('0x63')][_0x8213('0x6c')],'providerResponse':JSON[_0x8213('0x3b')](_0x43529f)};return _0x57b1a7;}}});};exports[_0x8213('0x6d')]=function(_0x40d12d,_0x353737,_0x410459,_0x8b11f6){return tilde[_0x8213('0x6e')](_0x40d12d,_0x353737,_0x410459,_0x8b11f6)[_0x8213('0x26')](function(_0xd65964){try{fs[_0x8213('0x27')](_0x40d12d);}catch(_0xac0529){logger[_0x8213('0x14')](_0xac0529);}logger[_0x8213('0x19')](_0x8213('0x6f'),_0xd65964[_0x8213('0x45')]);logger[_0x8213('0x19')]('Tilde\x20ASR\x20confidence',_0xd65964[_0x8213('0x47')]);return _0xd65964;});};exports['awsPolly']=function(_0x264a45,_0x49ffdc,_0x87d61,_0x3c6be8,_0x5d33ef,_0x4df3bf){var _0x496ba9=path[_0x8213('0x23')](__dirname,_0x8213('0x24'),rs[_0x8213('0x25')](0x4)+_0x8213('0x32'));var _0x252a7f;return aws['polly'](_0x264a45,_0x49ffdc,_0x87d61,_0x3c6be8,_0x5d33ef,_0x4df3bf,_0x496ba9)['then'](function(){_0x252a7f=path[_0x8213('0x23')](__dirname,_0x8213('0x24'),rs['generate'](0x4)+_0x8213('0x35'));return convertFile(_0x496ba9,_0x252a7f);})[_0x8213('0x26')](function(){try{fs['unlink'](_0x496ba9);fs[_0x8213('0x28')](_0x252a7f,_0x8213('0x29'));}catch(_0x1c71b7){logger['error'](_0x1c71b7);}return _0x252a7f['split']('.')[0x0];});};exports[_0x8213('0x70')]=function(_0x433c4f,_0x35f6dc,_0x4b2a49,_0x5ce078,_0x4e93f6,_0x498e92){return aws[_0x8213('0x71')](_0x433c4f,_0x35f6dc,_0x4b2a49,_0x5ce078,_0x4e93f6,_0x498e92)[_0x8213('0x26')](function(_0x232ea0){logger[_0x8213('0x19')](JSON['stringify'](_0x232ea0));return _0x232ea0;});};exports['ispeechTTS']=function(_0x4a9491,_0x5dab75,_0x4b064e,_0x216ad5){var _0x1d802f=util[_0x8213('0x72')](_0x8213('0x73'),ISPEECH_API,_0x4a9491,encodeURIComponent(_0x5dab75),_0x4b064e,_0x216ad5);var _0x54a5ec=path[_0x8213('0x23')](__dirname,'tmp',rs[_0x8213('0x25')](0x4)+_0x8213('0x32'));var _0x350d56;return downloadFile(_0x1d802f,_0x54a5ec)[_0x8213('0x26')](function(){_0x350d56=path['resolve'](__dirname,_0x8213('0x24'),rs[_0x8213('0x25')](0x4)+_0x8213('0x35'));return convertFile(_0x54a5ec,_0x350d56);})[_0x8213('0x26')](function(){try{fs[_0x8213('0x27')](_0x54a5ec);fs[_0x8213('0x28')](_0x350d56,_0x8213('0x29'));}catch(_0x2965f0){logger['error'](_0x2965f0);}return _0x350d56['split']('.')[0x0];});};exports[_0x8213('0x74')]=function(_0x1fbdef,_0x116d21,_0x1d42e6,_0x23be06){var _0xe39572=util[_0x8213('0x72')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x116d21,_0x1d42e6,base64Encode(_0x1fbdef),_0x23be06?util[_0x8213('0x72')](_0x8213('0x75'),encodeURIComponent(_0x23be06)):_0x8213('0x76'));return uploadFile(_0xe39572)[_0x8213('0x26')](function(_0x3d41bd){return querystring[_0x8213('0x77')](_0x3d41bd);});};exports[_0x8213('0x78')]=function(_0x52a3fb,_0x29ce9c){return sestek['nda'](_0x52a3fb,_0x29ce9c)[_0x8213('0x26')](function(_0x197805){logger[_0x8213('0x19')](JSON[_0x8213('0x3b')](_0x197805));var _0x5a5e32={'speech':_0x197805['text'],'action':_0x197805[_0x8213('0x79')]?_0x197805[_0x8213('0x79')]['CustomAction']:undefined,'actiondata':_0x197805[_0x8213('0x79')]?_0x197805[_0x8213('0x79')][_0x8213('0x7a')]:undefined};if(_0x197805['channelData']&&_0x197805[_0x8213('0x79')][_0x8213('0x7b')]){return base64Decode(_0x197805[_0x8213('0x79')]['AudioFromTts'][_0x8213('0x7c')],path[_0x8213('0x23')](__dirname,'tmp',rs[_0x8213('0x25')](0x4)+_0x8213('0x35')))[_0x8213('0x26')](function(_0x267a60){_0x5a5e32['audiofile']=_0x267a60;return _0x5a5e32;});}return _0x5a5e32;});};exports[_0x8213('0x7d')]=function(){return __dirname;}; \ No newline at end of file +var _0x512a=['queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','intentDetectionConfidence','tildeASR','awsPolly','polly','awsLex','format','model=%s','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','http','https','path','querystring','sox','google-tts-api','url','parse','util','./google','./tilde','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','statusCode','\x20failed,\x20status\x20code\x20=\x20','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','error','download\x20error','pipe','end','protocol','host','data','transcode','wav','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','?key=','ssml','input','voice','MP3','text:synthesize','POST','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','message','textRequest','result','source','resolvedQuery','speech','score','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:'];(function(_0x12fdd3,_0x3109d0){var _0x3b2182=function(_0x5986e4){while(--_0x5986e4){_0x12fdd3['push'](_0x12fdd3['shift']());}};_0x3b2182(++_0x3109d0);}(_0x512a,0x18f));var _0xa512=function(_0x23fbec,_0x48a902){_0x23fbec=_0x23fbec-0x0;var _0x42fe6b=_0x512a[_0x23fbec];return _0x42fe6b;};'use strict';var apiai=require(_0xa512('0x0'));var BPromise=require(_0xa512('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xa512('0x2'));var https=require(_0xa512('0x3'));var md5=require('md5');var path=require(_0xa512('0x4'));var querystring=require(_0xa512('0x5'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0xa512('0x6'));var tts=require(_0xa512('0x7'));var urlParse=require(_0xa512('0x8'))[_0xa512('0x9')];var util=require(_0xa512('0xa'));var aws=require('./aws');var google=require(_0xa512('0xb'));var sestek=require('./sestek');var tilde=require(_0xa512('0xc'));var logger=require('../../../config/logger')(_0xa512('0xd'));var ISPEECH_API=_0xa512('0xe');function downloadFile(_0x352341,_0x57f54b){return new BPromise(function(_0x48cc71,_0x1e23b9){var _0x3f5718=urlParse(_0x352341);var _0x179ded=_0x3f5718['protocol']===_0xa512('0xf')?https:http;var _0x2b687e={'host':_0x3f5718['host'],'path':_0x3f5718['path'],'headers':{'user-agent':_0xa512('0x10')}};_0x179ded['get'](_0x2b687e,function(_0x2fb5ac){if(_0x2fb5ac[_0xa512('0x11')]!==0xc8){logger['error']('request\x20to\x20'+_0x352341+_0xa512('0x12')+_0x2fb5ac[_0xa512('0x11')]+'\x20('+_0x2fb5ac['statusMessage']+')');_0x1e23b9(new Error(_0xa512('0x13')+_0x352341+_0xa512('0x12')+_0x2fb5ac[_0xa512('0x11')]+'\x20('+_0x2fb5ac[_0xa512('0x14')]+')'));return;}var _0x204ef0=fs[_0xa512('0x15')](_0x57f54b);_0x204ef0['on'](_0xa512('0x16'),function(){logger[_0xa512('0x17')](_0xa512('0x18'));_0x204ef0[_0xa512('0x19')](_0x48cc71);});_0x204ef0['on']('error',function(_0x31e354){fs[_0xa512('0x1a')](_0x57f54b);logger[_0xa512('0x1b')](_0xa512('0x1c'),_0x31e354);_0x1e23b9(_0x31e354);});_0x2fb5ac[_0xa512('0x1d')](_0x204ef0);})['on']('error',function(_0x5b94c2){logger[_0xa512('0x1b')](_0x5b94c2);_0x1e23b9(_0x5b94c2);})[_0xa512('0x1e')]();});}function uploadFile(_0x27cff4){return new BPromise(function(_0x4e2e14,_0x26a839){var _0x3e112e=urlParse(_0x27cff4);var _0x15c758=_0x3e112e[_0xa512('0x1f')]==='https:'?https:http;var _0x159092={'host':_0x3e112e[_0xa512('0x20')],'path':_0x3e112e[_0xa512('0x4')],'headers':{'user-agent':_0xa512('0x10')}};_0x15c758['get'](_0x159092,function(_0x2cfc50){if(_0x2cfc50[_0xa512('0x11')]!==0xc8){_0x26a839(new Error(_0xa512('0x13')+_0x27cff4+'\x20failed,\x20status\x20code\x20=\x20'+_0x2cfc50[_0xa512('0x11')]+'\x20('+_0x2cfc50['statusMessage']+')'));return;}var _0x40b40f='';_0x2cfc50['on'](_0xa512('0x21'),function(_0x5b1c2c){_0x40b40f+=_0x5b1c2c;});_0x2cfc50['on'](_0xa512('0x1e'),function(){_0x4e2e14(_0x40b40f);});})['on'](_0xa512('0x1b'),function(_0x4621ec){_0x26a839(_0x4621ec);})[_0xa512('0x1e')]();});}function convertFile(_0x4ad5fa,_0xcf639a){return new BPromise(function(_0xa6281f,_0x4ece4d){var _0x101030=sox[_0xa512('0x22')](_0x4ad5fa,_0xcf639a,{'sampleRate':0x1f40,'format':_0xa512('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x101030['on'](_0xa512('0x1b'),function(_0x36b96a){logger[_0xa512('0x1b')]('error\x20convert',_0x36b96a);_0x4ece4d(_0x36b96a);});_0x101030['on'](_0xa512('0x1e'),function(){logger[_0xa512('0x17')](_0xa512('0x24'));_0xa6281f();});_0x101030['start']();});}function base64Decode(_0x36990d,_0x36930e){var _0x4a9676=path[_0xa512('0x25')](__dirname,_0xa512('0x26'),rs[_0xa512('0x27')](0x4)+_0xa512('0x28'));fs[_0xa512('0x29')](_0x4a9676,_0x36990d,_0xa512('0x2a'));return convertFile(_0x4a9676,_0x36930e)[_0xa512('0x2b')](function(){try{fs[_0xa512('0x1a')](_0x4a9676);fs[_0xa512('0x2c')](_0x36930e,_0xa512('0x2d'));}catch(_0x57a88d){logger[_0xa512('0x1b')](_0x57a88d);}return _0x36930e[_0xa512('0x2e')]('.')[0x0];});}function base64Encode(_0x3762f6){var _0x20d6ee=fs['readFileSync'](_0x3762f6);return new Buffer(_0x20d6ee)[_0xa512('0x2f')](_0xa512('0x2a'));}exports[_0xa512('0x30')]=function(_0x3aefc2,_0x155178,_0xc8865e,_0x1c66fd,_0x3dc2f4,_0xe378d7){var _0x54e345,_0x357ae2;var _0x12137a='https://texttospeech.googleapis.com/v1/';var _0x12f116=_0xa512('0x31')+_0x3aefc2;var _0x5289be={};if(_0x155178===_0xa512('0x32')){_0x5289be[_0xa512('0x33')]={'ssml':_0xc8865e};}else{_0x5289be['input']={'text':_0xc8865e};};_0x5289be[_0xa512('0x34')]={'languageCode':_0x1c66fd,'ssmlGender':_0x3dc2f4};_0x5289be['audioConfig']={'audioEncoding':_0xa512('0x35'),'sampleRateHertz':0x1f40};var _0x31ffa2={'url':_0x12137a+_0xa512('0x36')+_0x12f116,'method':_0xa512('0x37'),'json':!![],'body':_0x5289be};return rp(_0x31ffa2)[_0xa512('0x2b')](function(_0x5b8e79){return new BPromise(function(_0x53f8ad,_0x48a2a1){_0x54e345=path[_0xa512('0x25')](__dirname,_0xa512('0x26'),rs[_0xa512('0x27')](0x4)+_0xa512('0x38'));var _0x4734f8=Buffer[_0xa512('0x39')](_0x5b8e79[_0xa512('0x3a')],_0xa512('0x2a'));return fs['writeFile'](_0x54e345,_0x4734f8,function(_0x147791){_0x48a2a1(_0x147791);},function(_0x405bc4){fs[_0xa512('0x2c')](_0x54e345,'777');_0x53f8ad(_0x405bc4);});});})[_0xa512('0x2b')](function(_0x1d8bc5){_0x357ae2=path[_0xa512('0x25')](__dirname,_0xa512('0x26'),rs['generate'](0x4)+_0xa512('0x28'));return convertFile(_0x54e345,_0x357ae2);})['then'](function(){try{fs[_0xa512('0x1a')](_0x54e345);fs[_0xa512('0x2c')](_0x357ae2,_0xa512('0x2d'));}catch(_0xfe1e1b){logger[_0xa512('0x1b')](_0xfe1e1b);}logger[_0xa512('0x17')](_0xa512('0x3b'),_0x357ae2[_0xa512('0x2e')]('.')[0x0]);return _0x357ae2[_0xa512('0x2e')]('.')[0x0];});};exports[_0xa512('0x3c')]=function(_0x3434b9,_0x4dfa3c){var _0x2279c1='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x921510,_0x3543e8;var _0x1b3620;var _0x3afa27={'encoding':_0xa512('0x3d'),'method':_0xa512('0x37'),'timeout':0x2710,'url':_0x2279c1,'headers':{'Content-Type':_0xa512('0x3e')},'body':_0xa512('0x3f')+encodeURIComponent(JSON['stringify']([[[_0xa512('0x40'),JSON[_0xa512('0x41')]([_0x3434b9,_0x4dfa3c||'en',![],_0xa512('0x42')]),null,_0xa512('0x43')]]]))};return rp(_0x3afa27)[_0xa512('0x2b')](function(_0x113cdb){try{_0x1b3620=eval(_0x113cdb[_0xa512('0x44')](0x5))[0x0][0x2];}catch(_0x2e21a2){throw new Error(_0xa512('0x45')+_0x113cdb[_0xa512('0x21')]);}if(!_0x1b3620){if(_0x3434b9[_0xa512('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x4dfa3c+_0xa512('0x47'));}}try{_0x1b3620=eval(_0x1b3620)[0x0];}catch(_0x89f59){throw new Error(_0xa512('0x45')+res['data']);}const _0x12724f=_0x1b3620;_0x921510=path[_0xa512('0x25')](__dirname,_0xa512('0x26'),rs['generate'](0x4)+_0xa512('0x38'));fs[_0xa512('0x29')](_0x921510,_0x1b3620,{'encoding':_0xa512('0x2a')});_0x3543e8=path[_0xa512('0x25')](__dirname,'tmp',rs[_0xa512('0x27')](0x4)+_0xa512('0x28'));return convertFile(_0x921510,_0x3543e8);})['then'](function(){try{fs[_0xa512('0x1a')](_0x921510);fs[_0xa512('0x2c')](_0x3543e8,_0xa512('0x2d'));}catch(_0x1775e){logger[_0xa512('0x1b')](_0x1775e);}logger[_0xa512('0x17')](_0xa512('0x48'),_0x3543e8[_0xa512('0x2e')]('.')[0x0]);return _0x3543e8[_0xa512('0x2e')]('.')[0x0];});};exports[_0xa512('0x49')]=function(_0x17a45e,_0x4ecbbd,_0x236da3){return google[_0xa512('0x4a')](_0x17a45e,_0x4ecbbd,_0x236da3)[_0xa512('0x2b')](function(_0x1b042c){logger[_0xa512('0x17')](_0x1b042c[_0xa512('0x4b')]);return rp(_0x1b042c);})[_0xa512('0x2b')](function(_0x310093){var _0x4af9c5='';var _0x4fdb16=0x0;try{fs[_0xa512('0x1a')](_0x17a45e);}catch(_0x3c59e9){logger['error'](_0x3c59e9);}if(_0x310093&&_0x310093['results']){_0x4af9c5=_0x310093[_0xa512('0x4c')][_0xa512('0x4d')](function(_0xc33de){return _0xc33de&&_0xc33de[_0xa512('0x4e')][0x0]&&_0xc33de['alternatives'][0x0]['transcript']?_0xc33de[_0xa512('0x4e')][0x0][_0xa512('0x4f')]:'';})[_0xa512('0x50')]('\x0a');_0x4fdb16=_0x310093[_0xa512('0x4c')][_0xa512('0x4d')](function(_0x509e27){return _0x509e27&&_0x509e27[_0xa512('0x4e')][0x0]&&_0x509e27[_0xa512('0x4e')][0x0][_0xa512('0x51')]?_0x509e27[_0xa512('0x4e')][0x0][_0xa512('0x51')]:0x0;})[_0xa512('0x50')]('\x0a');}logger[_0xa512('0x17')](_0xa512('0x52'),_0x4af9c5);logger[_0xa512('0x17')](_0xa512('0x53'),_0x4fdb16);return{'transcript':_0x4af9c5,'confidence':_0x4fdb16};})['catch'](function(_0xb047e9){logger[_0xa512('0x1b')]('[%s]\x20%s:%s',_0xb047e9[_0xa512('0x11')],_0xb047e9[_0xa512('0x54')],_0xb047e9[_0xa512('0x55')]);});};exports['googleDialogflow']=function(_0x2c134c,_0x1fe153,_0x3c4569,_0x499905){var _0x393447=apiai(_0x1fe153,{'language':_0x499905||'en'});return _0x393447[_0xa512('0x56')](_0x3c4569,{'sessionId':md5(_0x2c134c)})[_0xa512('0x2b')](function(_0x11cb99){logger[_0xa512('0x17')](JSON[_0xa512('0x41')](_0x11cb99));return{'source':_0x11cb99[_0xa512('0x57')][_0xa512('0x58')],'resolvedQuery':_0x11cb99[_0xa512('0x57')][_0xa512('0x59')],'action':_0x11cb99['result']['action'],'actionIncomplete':_0x11cb99[_0xa512('0x57')]['actionIncomplete'],'speech':_0x11cb99[_0xa512('0x57')]['fulfillment'][_0xa512('0x5a')],'score':_0x11cb99[_0xa512('0x57')][_0xa512('0x5b')],'statusCode':_0x11cb99['status'][_0xa512('0x5c')],'endConversation':_0x11cb99[_0xa512('0x57')][_0xa512('0x5d')]['endConversation']||![],'isFallbackIntent':_0x11cb99[_0xa512('0x57')][_0xa512('0x5d')][_0xa512('0x5e')]};});};exports[_0xa512('0x5f')]=function(_0x23bb77,_0x24606e,_0x43d313,_0xe9ccc9,_0x234ab2,_0x36cb7e){var _0x9f5d99=_0xe9ccc9[_0xa512('0x60')](/\\n/g,'\x0a');var _0x5de652={'credentials':{'private_key':_0x9f5d99,'client_email':_0x43d313}};var _0x297eb3=new dialogflow[(_0xa512('0x61'))](_0x5de652);var _0x1e4502=_0x297eb3[_0xa512('0x62')](_0x24606e,md5(_0x23bb77));var _0x1e4b81={'session':_0x1e4502,'queryInput':{'text':{'text':_0x234ab2,'languageCode':_0x36cb7e}}};return _0x297eb3[_0xa512('0x63')](_0x1e4b81)[_0xa512('0x2b')](function(_0x52c021){if(_0x52c021&&_0x52c021[_0xa512('0x46')]){logger[_0xa512('0x17')](_0xa512('0x64'),JSON[_0xa512('0x41')](_0x52c021));var _0x2aa0f7=_0x52c021[0x0];if(_0x2aa0f7){var _0x45a189={'action':_0x2aa0f7[_0xa512('0x65')][_0xa512('0x66')],'allRequiredParamsPresent':_0x2aa0f7[_0xa512('0x65')]['allRequiredParamsPresent'],'endConversation':_0x2aa0f7[_0xa512('0x65')][_0xa512('0x67')]&&_0x2aa0f7[_0xa512('0x65')][_0xa512('0x67')]['fields']?_0x2aa0f7[_0xa512('0x65')][_0xa512('0x67')][_0xa512('0x68')][_0xa512('0x69')][_0xa512('0x6a')]:![],'fulfillmentText':_0x2aa0f7['queryResult'][_0xa512('0x6b')],'intentName':_0x2aa0f7['queryResult'][_0xa512('0x6c')][_0xa512('0x54')],'intentDisplayName':_0x2aa0f7[_0xa512('0x65')][_0xa512('0x6c')]['displayName'],'isFallbackIntent':_0x2aa0f7[_0xa512('0x65')]['intent'][_0xa512('0x6d')],'languageCode':_0x2aa0f7[_0xa512('0x65')][_0xa512('0x6e')],'queryText':_0x2aa0f7['queryResult']['queryText'],'responseId':_0x2aa0f7['responseId'],'score':_0x2aa0f7[_0xa512('0x65')][_0xa512('0x6f')],'speech':_0x2aa0f7['queryResult'][_0xa512('0x6b')],'providerResponse':JSON[_0xa512('0x41')](_0x52c021)};return _0x45a189;}}});};exports[_0xa512('0x70')]=function(_0x24f25a,_0x30aa1a,_0x36f1e8,_0x39d6e7){return tilde[_0xa512('0x4a')](_0x24f25a,_0x30aa1a,_0x36f1e8,_0x39d6e7)[_0xa512('0x2b')](function(_0x4c2e0e){try{fs['unlink'](_0x24f25a);}catch(_0x2e00a9){logger[_0xa512('0x1b')](_0x2e00a9);}logger[_0xa512('0x17')]('Tilde\x20ASR\x20transcription',_0x4c2e0e['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x4c2e0e[_0xa512('0x51')]);return _0x4c2e0e;});};exports[_0xa512('0x71')]=function(_0x4e8dbc,_0xbbf75,_0x43ce8c,_0x2eef1f,_0x3988f6,_0x3bdf1c){var _0x269d00=path[_0xa512('0x25')](__dirname,_0xa512('0x26'),rs['generate'](0x4)+_0xa512('0x38'));var _0x21103d;return aws[_0xa512('0x72')](_0x4e8dbc,_0xbbf75,_0x43ce8c,_0x2eef1f,_0x3988f6,_0x3bdf1c,_0x269d00)[_0xa512('0x2b')](function(){_0x21103d=path['resolve'](__dirname,_0xa512('0x26'),rs[_0xa512('0x27')](0x4)+_0xa512('0x28'));return convertFile(_0x269d00,_0x21103d);})[_0xa512('0x2b')](function(){try{fs[_0xa512('0x1a')](_0x269d00);fs[_0xa512('0x2c')](_0x21103d,_0xa512('0x2d'));}catch(_0x18e36c){logger[_0xa512('0x1b')](_0x18e36c);}return _0x21103d[_0xa512('0x2e')]('.')[0x0];});};exports[_0xa512('0x73')]=function(_0x32e5d3,_0x36fdac,_0x489f13,_0x274654,_0x392d9d,_0x8a92b6){return aws['lex'](_0x32e5d3,_0x36fdac,_0x489f13,_0x274654,_0x392d9d,_0x8a92b6)[_0xa512('0x2b')](function(_0x1711f9){logger[_0xa512('0x17')](JSON['stringify'](_0x1711f9));return _0x1711f9;});};exports['ispeechTTS']=function(_0x479493,_0x1cef7f,_0x7b9081,_0x3693e7){var _0x1a75ee=util[_0xa512('0x74')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x479493,encodeURIComponent(_0x1cef7f),_0x7b9081,_0x3693e7);var _0x3d1c26=path['resolve'](__dirname,'tmp',rs[_0xa512('0x27')](0x4)+_0xa512('0x38'));var _0x3d8dd2;return downloadFile(_0x1a75ee,_0x3d1c26)['then'](function(){_0x3d8dd2=path[_0xa512('0x25')](__dirname,_0xa512('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x3d1c26,_0x3d8dd2);})[_0xa512('0x2b')](function(){try{fs[_0xa512('0x1a')](_0x3d1c26);fs[_0xa512('0x2c')](_0x3d8dd2,_0xa512('0x2d'));}catch(_0x16ecc8){logger[_0xa512('0x1b')](_0x16ecc8);}return _0x3d8dd2[_0xa512('0x2e')]('.')[0x0];});};exports['ispeechASR']=function(_0x306080,_0x501929,_0x265340,_0x43282e){var _0xbc26f=util[_0xa512('0x74')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x501929,_0x265340,base64Encode(_0x306080),_0x43282e?util['format'](_0xa512('0x75'),encodeURIComponent(_0x43282e)):'freeform=3');return uploadFile(_0xbc26f)[_0xa512('0x2b')](function(_0x4e77cb){return querystring[_0xa512('0x9')](_0x4e77cb);});};exports[_0xa512('0x76')]=function(_0x48ba40,_0x33bfc9){return sestek[_0xa512('0x77')](_0x48ba40,_0x33bfc9)[_0xa512('0x2b')](function(_0x54fb51){logger[_0xa512('0x17')](JSON[_0xa512('0x41')](_0x54fb51));var _0x2daa5c={'speech':_0x54fb51['text'],'action':_0x54fb51[_0xa512('0x78')]?_0x54fb51[_0xa512('0x78')]['CustomAction']:undefined,'actiondata':_0x54fb51[_0xa512('0x78')]?_0x54fb51[_0xa512('0x78')][_0xa512('0x79')]:undefined};if(_0x54fb51[_0xa512('0x78')]&&_0x54fb51[_0xa512('0x78')][_0xa512('0x7a')]){return base64Decode(_0x54fb51[_0xa512('0x78')]['AudioFromTts'][_0xa512('0x7b')],path[_0xa512('0x25')](__dirname,_0xa512('0x26'),rs[_0xa512('0x27')](0x4)+'.wav'))[_0xa512('0x2b')](function(_0x3434bf){_0x2daa5c['audiofile']=_0x3434bf;return _0x2daa5c;});}return _0x2daa5c;});};exports[_0xa512('0x7c')]=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 ed90030..89e07ff 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 _0x0120=['exports','./nda'];(function(_0x9da8fa,_0x4a1fe9){var _0x3891cd=function(_0x1594b5){while(--_0x1594b5){_0x9da8fa['push'](_0x9da8fa['shift']());}};_0x3891cd(++_0x4a1fe9);}(_0x0120,0x161));var _0x0012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0120[_0x501510];return _0x1e6ee5;};var nda=require(_0x0012('0x0'));module[_0x0012('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5b10=['exports'];(function(_0xb8f6dd,_0x14b270){var _0x577c22=function(_0x2ba45f){while(--_0x2ba45f){_0xb8f6dd['push'](_0xb8f6dd['shift']());}};_0x577c22(++_0x14b270);}(_0x5b10,0x188));var _0x05b1=function(_0xc7a1a2,_0x21d26c){_0xc7a1a2=_0xc7a1a2-0x0;var _0x6ba814=_0x5b10[_0xc7a1a2];return _0x6ba814;};var nda=require('./nda');module[_0x05b1('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 86162da..f409304 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 _0xcff2=['POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','Bearer\x20','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi'];(function(_0x124e88,_0xcb3df6){var _0x243cf9=function(_0x56eee2){while(--_0x56eee2){_0x124e88['push'](_0x124e88['shift']());}};_0x243cf9(++_0xcb3df6);}(_0xcff2,0x130));var _0x2cff=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0xcff2[_0x2053ea];return _0x2232c4;};'use strict';var rp=require(_0x2cff('0x0'));var url=require(_0x2cff('0x1'));var logger=require(_0x2cff('0x2'))(_0x2cff('0x3'));module['exports']=function(_0x42222c,_0x4dc379){var _0x1707ec={'method':_0x2cff('0x4'),'uri':url[_0x2cff('0x5')](_0x4dc379[_0x2cff('0x6')],_0x2cff('0x7')),'form':{'grant_type':_0x2cff('0x8'),'username':_0x4dc379['username'],'password':_0x4dc379[_0x2cff('0x8')]},'json':!![]};return rp(_0x1707ec)[_0x2cff('0x9')](function(_0x236ca1){var _0x183dfa={'method':_0x2cff('0x4'),'uri':url['resolve'](_0x4dc379[_0x2cff('0xa')],_0x2cff('0xb')),'body':{'type':_0x4dc379[_0x2cff('0xc')]||'message','channelId':_0x2cff('0xd'),'conversation':{'id':_0x42222c[_0x2cff('0xe')]},'from':{'id':_0x42222c[_0x2cff('0xf')],'name':_0x42222c[_0x2cff('0x10')]},'recipient':{'id':_0x42222c[_0x2cff('0x11')],'name':_0x42222c['extension']},'text':_0x4dc379['text'],'channelData':{}},'headers':{'Authorization':_0x2cff('0x12')+_0x236ca1['access_token']},'json':!![]};if(_0x4dc379[_0x2cff('0x13')]){_0x183dfa[_0x2cff('0x14')][_0x2cff('0x15')][_0x2cff('0x16')]=_0x4dc379[_0x2cff('0x13')];}if(_0x4dc379['ndagenerate_audio']=='1'){_0x183dfa[_0x2cff('0x14')][_0x2cff('0x15')][_0x2cff('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2cff('0x18')};}if(_0x4dc379['custom_action']){_0x183dfa[_0x2cff('0x14')][_0x2cff('0x15')][_0x2cff('0x19')]=_0x4dc379['custom_action'];if(_0x4dc379[_0x2cff('0x1a')]){_0x183dfa[_0x2cff('0x14')][_0x2cff('0x15')]['CustomActionData']=_0x4dc379[_0x2cff('0x1a')];}}logger['info'](JSON[_0x2cff('0x1b')](_0x183dfa));return rp(_0x183dfa);});}; \ No newline at end of file +var _0xad14=['ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','../../../../../config/logger','agi','POST','resolve','password','username','then'];(function(_0x4d59a6,_0x5abe49){var _0xfd157f=function(_0x148623){while(--_0x148623){_0x4d59a6['push'](_0x4d59a6['shift']());}};_0xfd157f(++_0x5abe49);}(_0xad14,0xa1));var _0x4ad1=function(_0x5d6280,_0x3f72ab){_0x5d6280=_0x5d6280-0x0;var _0x77b738=_0xad14[_0x5d6280];return _0x77b738;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x4ad1('0x0'))(_0x4ad1('0x1'));module['exports']=function(_0x220002,_0x1a941f){var _0x569ab1={'method':_0x4ad1('0x2'),'uri':url[_0x4ad1('0x3')](_0x1a941f['ndauth_url'],'/token'),'form':{'grant_type':_0x4ad1('0x4'),'username':_0x1a941f[_0x4ad1('0x5')],'password':_0x1a941f[_0x4ad1('0x4')]},'json':!![]};return rp(_0x569ab1)[_0x4ad1('0x6')](function(_0x15b876){var _0x11ffc3={'method':_0x4ad1('0x2'),'uri':url[_0x4ad1('0x3')](_0x1a941f[_0x4ad1('0x7')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1a941f[_0x4ad1('0x8')]||'message','channelId':_0x4ad1('0x9'),'conversation':{'id':_0x220002[_0x4ad1('0xa')]},'from':{'id':_0x220002[_0x4ad1('0xb')],'name':_0x220002[_0x4ad1('0xc')]},'recipient':{'id':_0x220002[_0x4ad1('0xd')],'name':_0x220002[_0x4ad1('0xe')]},'text':_0x1a941f[_0x4ad1('0xf')],'channelData':{}},'headers':{'Authorization':_0x4ad1('0x10')+_0x15b876['access_token']},'json':!![]};if(_0x1a941f['project']){_0x11ffc3['body']['channelData']['ProjectName']=_0x1a941f[_0x4ad1('0x11')];}if(_0x1a941f[_0x4ad1('0x12')]=='1'){_0x11ffc3[_0x4ad1('0x13')][_0x4ad1('0x14')][_0x4ad1('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4ad1('0x16')};}if(_0x1a941f[_0x4ad1('0x17')]){_0x11ffc3[_0x4ad1('0x13')][_0x4ad1('0x14')][_0x4ad1('0x18')]=_0x1a941f['custom_action'];if(_0x1a941f[_0x4ad1('0x19')]){_0x11ffc3[_0x4ad1('0x13')][_0x4ad1('0x14')][_0x4ad1('0x1a')]=_0x1a941f[_0x4ad1('0x19')];}}logger['info'](JSON[_0x4ad1('0x1b')](_0x11ffc3));return rp(_0x11ffc3);});}; \ 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 3f31576..74eecb4 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 _0xbf4c=['exports','./lib/api'];(function(_0x2bc343,_0x3568bc){var _0x4a1944=function(_0x30b54d){while(--_0x30b54d){_0x2bc343['push'](_0x2bc343['shift']());}};_0x4a1944(++_0x3568bc);}(_0xbf4c,0x161));var _0xcbf4=function(_0x20e0cc,_0x187b61){_0x20e0cc=_0x20e0cc-0x0;var _0x3adcd1=_0xbf4c[_0x20e0cc];return _0x3adcd1;};'use strict';var asr=require(_0xcbf4('0x0'));module[_0xcbf4('0x1')]=function(_0x1a8b5b,_0x9a1d85,_0x1a5f1c,_0x405bbe){return asr(_0x1a8b5b,_0x9a1d85,_0x1a5f1c,_0x405bbe);}; \ No newline at end of file +var _0xb7e1=['./lib/api','exports'];(function(_0x552a77,_0x4004bf){var _0x301f54=function(_0x498ad6){while(--_0x498ad6){_0x552a77['push'](_0x552a77['shift']());}};_0x301f54(++_0x4004bf);}(_0xb7e1,0x78));var _0x1b7e=function(_0x2ab339,_0x1acb13){_0x2ab339=_0x2ab339-0x0;var _0x423bc0=_0xb7e1[_0x2ab339];return _0x423bc0;};'use strict';var asr=require(_0x1b7e('0x0'));module[_0x1b7e('0x1')]=function(_0x3f8c61,_0x59046c,_0x14e30d,_0x546606){return asr(_0x3f8c61,_0x59046c,_0x14e30d,_0x546606);}; \ 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 ea80464..4072ba0 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 _0x9b31=['lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','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','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird'];(function(_0x4235df,_0xa5e872){var _0x53811d=function(_0x1066b5){while(--_0x1066b5){_0x4235df['push'](_0x4235df['shift']());}};_0x53811d(++_0xa5e872);}(_0x9b31,0x9b));var _0x19b3=function(_0x117bc1,_0x3cf656){_0x117bc1=_0x117bc1-0x0;var _0x2a772b=_0x9b31[_0x117bc1];return _0x2a772b;};'use strict';var BPromise=require(_0x19b3('0x0'));var _=require(_0x19b3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x19b3('0x2'));var crypto=require('crypto');var logger=require(_0x19b3('0x3'))(_0x19b3('0x4'));module[_0x19b3('0x5')]=function(_0x4113dd,_0x4a4fd7,_0xdb0c5b,_0x425371){return new BPromise(function(_0xca1ac3,_0x3eff07){logger[_0x19b3('0x6')](_0x19b3('0x7'),_0x425371||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x10d1cb=new WebSocket(_0x425371||_0x19b3('0x8'),{'perMessageDeflate':![]});var _0x1a68e9='';var _0x527031='0';var _0x2dd550='1';var _0x57180e=_0x19b3('0x9');function _0x6ab54f(_0x48959e){var _0x5d3ccd=crypto['createHash'](_0x19b3('0xa'));_0x5d3ccd[_0x19b3('0xb')](_0x48959e);return _0x5d3ccd[_0x19b3('0xc')](_0x19b3('0xd'));}function _0x3fcfff(){try{logger['info'](_0x19b3('0xe'));var _0x5adba2=moment()['unix']();var _0xae641b=_0x6ab54f(_0x5adba2+_0x4a4fd7+_0xdb0c5b);_0x10d1cb[_0x19b3('0xf')](JSON[_0x19b3('0x10')]({'appID':_0x4a4fd7,'timestamp':_0x5adba2,'appKey':_0xae641b}));var _0x3b7c30=fs['createReadStream'](_0x4113dd);_0x3b7c30['on'](_0x19b3('0x11'),function(_0x2c88a2){_0x10d1cb[_0x19b3('0xf')](_0x2c88a2);});_0x3b7c30['on'](_0x19b3('0x12'),function(){_0x10d1cb[_0x19b3('0xf')]('EOS');});}catch(_0x480ff7){logger[_0x19b3('0x13')](_0x19b3('0x14'),JSON['stringify'](_0x480ff7));_0x10d1cb[_0x19b3('0x15')]();}}function _0x5c5ed6(_0x277b72){try{if(_0x277b72){var _0x36912e=JSON['parse'](_0x277b72);switch(_0x36912e[_0x19b3('0x16')]){case 0x0:if(_0x36912e[_0x19b3('0x17')]){if(_0x36912e['result'][_0x19b3('0x18')]){logger[_0x19b3('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x19b3('0x10')](_0x36912e[_0x19b3('0x17')][_0x19b3('0x19')]));_0x1a68e9=_0x36912e[_0x19b3('0x17')]['hypotheses'][0x0][_0x19b3('0x1a')];_0x527031=_0x36912e['result'][_0x19b3('0x19')][0x0][_0x19b3('0x1b')];_0x2dd550='0';_0x57180e=_0x19b3('0x1c');_0x10d1cb[_0x19b3('0x15')]();}}break;case 0x1:logger['info'](_0x19b3('0x9'));_0x2dd550='1';_0x57180e=_0x19b3('0x9');break;case 0x2:logger['info'](_0x19b3('0x1d'));_0x2dd550='2';_0x57180e=_0x19b3('0x1d');break;case 0x9:logger[_0x19b3('0x6')](_0x19b3('0x1e'));_0x2dd550='9';_0x57180e=_0x19b3('0x1e');break;case 0xa:logger[_0x19b3('0x6')]('Authentication\x20failed.');_0x2dd550='10';_0x57180e=_0x19b3('0x1f');break;case 0xb:logger[_0x19b3('0x6')](_0x19b3('0x20'));_0x2dd550='11';_0x57180e=_0x19b3('0x20');}}}catch(_0x7bb98a){logger[_0x19b3('0x13')](_0x19b3('0x21'),JSON[_0x19b3('0x10')](_0x7bb98a));_0x10d1cb[_0x19b3('0x15')]();}}function _0xb32e8a(){logger[_0x19b3('0x6')](_0x19b3('0x22'));_0xca1ac3({'transcript':_0x1a68e9,'confidence':_0x527031,'status':_0x2dd550,'status_message':_0x57180e});}function _0x1b60d8(_0x4cd854){logger[_0x19b3('0x13')](_0x19b3('0x23'));if(!_['isNil'](_0x4cd854)){logger['error'](_[_0x19b3('0x24')](_0x4cd854)?JSON[_0x19b3('0x10')](_0x4cd854):_0x4cd854);}}_0x10d1cb['on'](_0x19b3('0x25'),_0x3fcfff);_0x10d1cb['on'](_0x19b3('0x26'),_0x5c5ed6);_0x10d1cb['on'](_0x19b3('0x12'),_0xb32e8a);_0x10d1cb['on'](_0x19b3('0x13'),_0x1b60d8);});}; \ No newline at end of file +var _0x22fd=['unix','send','stringify','close','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','lodash','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x5975f5,_0x4a8d4e){var _0x5c72b5=function(_0x2927fb){while(--_0x2927fb){_0x5975f5['push'](_0x5975f5['shift']());}};_0x5c72b5(++_0x4a8d4e);}(_0x22fd,0xa2));var _0xd22f=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x22fd[_0x5f09c5];return _0x426ad9;};'use strict';var BPromise=require('bluebird');var _=require(_0xd22f('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xd22f('0x1'));var logger=require('../../../../../../config/logger')(_0xd22f('0x2'));module[_0xd22f('0x3')]=function(_0x59fc01,_0x57b2a3,_0x529ce0,_0x208a58){return new BPromise(function(_0x1e2ff3,_0x51eacd){logger[_0xd22f('0x4')](_0xd22f('0x5'),_0x208a58||_0xd22f('0x6'));var _0x3645a7=new WebSocket(_0x208a58||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1533b9='';var _0x36a5a4='0';var _0x44d4cc='1';var _0xc0db18=_0xd22f('0x7');function _0x52a7fd(_0x1728dc){var _0x416269=crypto[_0xd22f('0x8')]('sha1');_0x416269[_0xd22f('0x9')](_0x1728dc);return _0x416269[_0xd22f('0xa')](_0xd22f('0xb'));}function _0x4211da(){try{logger['info'](_0xd22f('0xc'));var _0x1ed41b=moment()[_0xd22f('0xd')]();var _0x3a98e7=_0x52a7fd(_0x1ed41b+_0x57b2a3+_0x529ce0);_0x3645a7[_0xd22f('0xe')](JSON[_0xd22f('0xf')]({'appID':_0x57b2a3,'timestamp':_0x1ed41b,'appKey':_0x3a98e7}));var _0x295cd1=fs['createReadStream'](_0x59fc01);_0x295cd1['on']('data',function(_0x40b960){_0x3645a7[_0xd22f('0xe')](_0x40b960);});_0x295cd1['on'](_0xd22f('0x10'),function(){_0x3645a7[_0xd22f('0xe')]('EOS');});}catch(_0x516fb0){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xd22f('0xf')](_0x516fb0));_0x3645a7[_0xd22f('0x11')]();}}function _0x20c847(_0x1c8016){try{if(_0x1c8016){var _0xba32ca=JSON[_0xd22f('0x12')](_0x1c8016);switch(_0xba32ca[_0xd22f('0x13')]){case 0x0:if(_0xba32ca['result']){if(_0xba32ca[_0xd22f('0x14')][_0xd22f('0x15')]){logger[_0xd22f('0x4')](_0xd22f('0x16'),JSON[_0xd22f('0xf')](_0xba32ca['result'][_0xd22f('0x17')]));_0x1533b9=_0xba32ca[_0xd22f('0x14')][_0xd22f('0x17')][0x0][_0xd22f('0x18')];_0x36a5a4=_0xba32ca[_0xd22f('0x14')][_0xd22f('0x17')][0x0][_0xd22f('0x19')];_0x44d4cc='0';_0xc0db18='Success.';_0x3645a7[_0xd22f('0x11')]();}}break;case 0x1:logger['info'](_0xd22f('0x7'));_0x44d4cc='1';_0xc0db18=_0xd22f('0x7');break;case 0x2:logger[_0xd22f('0x4')](_0xd22f('0x1a'));_0x44d4cc='2';_0xc0db18='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xd22f('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x44d4cc='9';_0xc0db18=_0xd22f('0x1b');break;case 0xa:logger[_0xd22f('0x4')]('Authentication\x20failed.');_0x44d4cc='10';_0xc0db18=_0xd22f('0x1c');break;case 0xb:logger[_0xd22f('0x4')](_0xd22f('0x1d'));_0x44d4cc='11';_0xc0db18='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2284a0){logger[_0xd22f('0x1e')](_0xd22f('0x1f'),JSON[_0xd22f('0xf')](_0x2284a0));_0x3645a7['terminate']();}}function _0x40ef85(){logger[_0xd22f('0x4')](_0xd22f('0x20'));_0x1e2ff3({'transcript':_0x1533b9,'confidence':_0x36a5a4,'status':_0x44d4cc,'status_message':_0xc0db18});}function _0x36f45e(_0x3094aa){logger[_0xd22f('0x1e')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xd22f('0x21')](_0x3094aa)){logger[_0xd22f('0x1e')](_[_0xd22f('0x22')](_0x3094aa)?JSON['stringify'](_0x3094aa):_0x3094aa);}}_0x3645a7['on']('open',_0x4211da);_0x3645a7['on']('message',_0x20c847);_0x3645a7['on'](_0xd22f('0x10'),_0x40ef85);_0x3645a7['on'](_0xd22f('0x1e'),_0x36f45e);});}; \ 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 24e664d..3b3f769 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 _0x0182=['./asr','exports'];(function(_0x5e2636,_0x54ce39){var _0x4b7938=function(_0xdbb707){while(--_0xdbb707){_0x5e2636['push'](_0x5e2636['shift']());}};_0x4b7938(++_0x54ce39);}(_0x0182,0x18a));var _0x2018=function(_0x1bf89a,_0x2a2949){_0x1bf89a=_0x1bf89a-0x0;var _0x198910=_0x0182[_0x1bf89a];return _0x198910;};var asr=require(_0x2018('0x0'));module[_0x2018('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8069=['exports','./asr'];(function(_0x1c2837,_0x3e89da){var _0x507737=function(_0x2d8cfb){while(--_0x2d8cfb){_0x1c2837['push'](_0x1c2837['shift']());}};_0x507737(++_0x3e89da);}(_0x8069,0xbb));var _0x9806=function(_0x305419,_0x18e5f5){_0x305419=_0x305419-0x0;var _0x1d98b4=_0x8069[_0x305419];return _0x1d98b4;};var asr=require(_0x9806('0x0'));module[_0x9806('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 4e99ed0..1942893 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 _0x0ba7=['getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','code','close','exports','util','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','connection'];(function(_0x56171e,_0x6c5a1e){var _0x1238b7=function(_0x2544a9){while(--_0x2544a9){_0x56171e['push'](_0x56171e['shift']());}};_0x1238b7(++_0x6c5a1e);}(_0x0ba7,0x16d));var _0x70ba=function(_0x4ca209,_0x324735){_0x4ca209=_0x4ca209-0x0;var _0x37a7d1=_0x0ba7[_0x4ca209];return _0x37a7d1;};'use strict';var util=require(_0x70ba('0x0'));var net=require('net');var EventEmitter=require(_0x70ba('0x1'))[_0x70ba('0x2')];var AGIError=require(_0x70ba('0x3'));var AGIChannel=require(_0x70ba('0x4'));var AGIServer=function(_0x5e5368,_0x319ca9,_0x3e20ab){var _0x3cb2e3=this,_0x5e5368=_0x5e5368||0x11dd,_0x319ca9=_0x319ca9||_0x70ba('0x5'),_0x3f9877=null,_0x17a00c=0x0;EventEmitter[_0x70ba('0x6')](_0x3cb2e3);function _0x1185cb(){if(!_0x5e5368){_0x3cb2e3[_0x70ba('0x7')](_0x70ba('0x8'),new AGIError(_0x70ba('0x9')));return![];}_0x3f9877=net[_0x70ba('0xa')]();_0x3f9877[_0x70ba('0xb')](_0x5e5368,_0x319ca9);_0x3f9877['on']('listening',function(){_0x3cb2e3[_0x70ba('0x7')]('listening');});_0x3f9877['on'](_0x70ba('0xc'),function(_0x258604){_0x3f9877[_0x70ba('0xd')](function(_0x3cf8ab,_0x593fe9){if(_0x3cf8ab){_0x3cb2e3['emit'](_0x70ba('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x3cf8ab));}else if(_0x3e20ab&&_0x3e20ab<0x0){_0x3cb2e3[_0x70ba('0x7')]('error',new AGIError(_0x70ba('0xe')));_0x258604[_0x70ba('0xf')]();}else if(_0x3e20ab&&_0x3e20ab>0x0&&_0x3e20ab<_0x593fe9){_0x17a00c+=0x1;_0x3cb2e3['emit'](_0x70ba('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x17a00c));_0x258604[_0x70ba('0xf')]();}else{var _0x2728e1=new AGIChannel(_0x258604);_0x2728e1['on'](_0x70ba('0x10'),function(){_0x3cb2e3[_0x70ba('0x7')](_0x70ba('0xc'),_0x2728e1);});}});});_0x3f9877['on'](_0x70ba('0x8'),function(_0x232138){_0x3cb2e3[_0x70ba('0x7')](_0x70ba('0x8'),new AGIError(_0x70ba('0x11'),_0x232138[_0x70ba('0x12')]));});_0x3f9877['on'](_0x70ba('0x13'),function(){_0x3cb2e3[_0x70ba('0x7')](_0x70ba('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x1185cb();});};util['inherits'](AGIServer,EventEmitter);module[_0x70ba('0x14')]=function(_0x2dd33a,_0x20c2aa,_0xb4dad){return new AGIServer(_0x2dd33a,_0x20c2aa,_0xb4dad);}; \ No newline at end of file +var _0x0f3c=['createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','./channel','127.0.0.1','call','emit','error'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0f3c,0x189));var _0xc0f3=function(_0x1b05a8,_0x59a2e5){_0x1b05a8=_0x1b05a8-0x0;var _0x2a6c1c=_0x0f3c[_0x1b05a8];return _0x2a6c1c;};'use strict';var util=require(_0xc0f3('0x0'));var net=require(_0xc0f3('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0xc0f3('0x2'));var AGIServer=function(_0x4648a5,_0xa6a874,_0x2d1f5d){var _0x1be43d=this,_0x4648a5=_0x4648a5||0x11dd,_0xa6a874=_0xa6a874||_0xc0f3('0x3'),_0x256643=null,_0x4b76a0=0x0;EventEmitter[_0xc0f3('0x4')](_0x1be43d);function _0x48fc5d(){if(!_0x4648a5){_0x1be43d[_0xc0f3('0x5')](_0xc0f3('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x256643=net[_0xc0f3('0x7')]();_0x256643[_0xc0f3('0x8')](_0x4648a5,_0xa6a874);_0x256643['on'](_0xc0f3('0x9'),function(){_0x1be43d[_0xc0f3('0x5')](_0xc0f3('0x9'));});_0x256643['on'](_0xc0f3('0xa'),function(_0x232e04){_0x256643['getConnections'](function(_0x345e75,_0x3493c3){if(_0x345e75){_0x1be43d[_0xc0f3('0x5')]('error',new AGIError(_0xc0f3('0xb'),_0x345e75));}else if(_0x2d1f5d&&_0x2d1f5d<0x0){_0x1be43d[_0xc0f3('0x5')](_0xc0f3('0x6'),new AGIError(_0xc0f3('0xc')));_0x232e04['destroy']();}else if(_0x2d1f5d&&_0x2d1f5d>0x0&&_0x2d1f5d<_0x3493c3){_0x4b76a0+=0x1;_0x1be43d[_0xc0f3('0x5')](_0xc0f3('0x6'),new AGIError(_0xc0f3('0xd'),_0x4b76a0));_0x232e04[_0xc0f3('0xe')]();}else{var _0x37cad7=new AGIChannel(_0x232e04);_0x37cad7['on'](_0xc0f3('0xf'),function(){_0x1be43d[_0xc0f3('0x5')](_0xc0f3('0xa'),_0x37cad7);});}});});_0x256643['on'](_0xc0f3('0x6'),function(_0x215aed){_0x1be43d[_0xc0f3('0x5')](_0xc0f3('0x6'),new AGIError(_0xc0f3('0xb'),_0x215aed['code']));});_0x256643['on'](_0xc0f3('0x10'),function(){_0x1be43d[_0xc0f3('0x5')](_0xc0f3('0x10'),new AGIError(_0xc0f3('0x11')));});}process[_0xc0f3('0x12')](function(){_0x48fc5d();});};util['inherits'](AGIServer,EventEmitter);module[_0xc0f3('0x13')]=function(_0x3b2a2c,_0x2f107b,_0x2ecdde){return new AGIServer(_0x3b2a2c,_0x2f107b,_0x2ecdde);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 27feacb..cd2fa00 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 _0x88d4=['.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','DIAL','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','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','beep','TILDE_ASR_%s','gotoc','gotoif','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','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','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','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','service','host','port','secure','authentication','user','pass','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','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\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','getVariable','getVariableById','then','name','getVoiceQueue','catch','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','arg_1','createSquareMessage','isEmpty','callback_','lastName','isNil','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','body','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','createCmContact','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink'];(function(_0x2a2830,_0x4dd1b1){var _0x56dfd6=function(_0x17b2df){while(--_0x17b2df){_0x2a2830['push'](_0x2a2830['shift']());}};_0x56dfd6(++_0x4dd1b1);}(_0x88d4,0xcc));var _0x488d=function(_0x4792e2,_0xad2a6d){_0x4792e2=_0x4792e2-0x0;var _0x4078d6=_0x88d4[_0x4792e2];return _0x4078d6;};'use strict';var fs=require('fs');var path=require(_0x488d('0x0'));var util=require(_0x488d('0x1'));var _=require(_0x488d('0x2'));var sh=require(_0x488d('0x3'));var odbc=require(_0x488d('0x4'))();var rs=require(_0x488d('0x5'));var moment=require(_0x488d('0x6'));var Mustache=require('mustache');var rp=require(_0x488d('0x7'));var logger=require('../../config/logger')(_0x488d('0x8'));var config=require(_0x488d('0x9'));var scripts=require(_0x488d('0xa'));var FILES_PATH=_0x488d('0xb');var recursiveMapAttributes=[_0x488d('0xc'),_0x488d('0xd')];var verticesWithRetry=[_0x488d('0xe'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x4562c9,_0x23d8ab,_0x3207d1){this[_0x488d('0xf')]=_0x4562c9;this[_0x488d('0x10')]=_0x23d8ab;this['mailRpc']=_0x3207d1;};AGIVertices['prototype'][_0x488d('0x11')]=function(_0x33260b,_0x2abe32){this[_0x488d('0x10')][_0x488d('0x12')](_0x33260b)[_0x488d('0x13')](function(_0x3550b6){_0x2abe32(null,_0x3550b6?_0x3550b6[_0x488d('0x14')]:![]);})['catch'](function(_0x1b4617){_0x2abe32(_0x1b4617);});};AGIVertices['prototype'][_0x488d('0x15')]=function(_0x15a3b9,_0x4c2500){this[_0x488d('0x10')]['getVoiceQueueById'](_0x15a3b9)[_0x488d('0x13')](function(_0x16180c){_0x4c2500(null,_0x16180c?_0x16180c[_0x488d('0x14')]:![]);})[_0x488d('0x16')](function(_0x2db924){_0x4c2500(_0x2db924);});};AGIVertices[_0x488d('0x17')][_0x488d('0x18')]=function(_0x2a1324,_0x429182){this[_0x488d('0x10')][_0x488d('0x19')](_0x2a1324)['then'](function(_0x1abee8){_0x429182(null,_0x1abee8?_0x1abee8[_0x488d('0x14')]:![]);})[_0x488d('0x16')](function(_0x5e7378){_0x429182(_0x5e7378);});};AGIVertices['prototype'][_0x488d('0x1a')]=function(_0x9d2bb4,_0xc19278){this['rpc'][_0x488d('0x1b')](_0x9d2bb4)[_0x488d('0x13')](function(_0x2f2676){_0xc19278(null,_0x2f2676?_0x2f2676[_0x488d('0x1c')]:![]);})[_0x488d('0x16')](function(_0x41f8f3){_0xc19278(_0x41f8f3);});};AGIVertices['prototype']['getUser']=function(_0x4ede9c,_0x59ebc9){this[_0x488d('0x10')]['getUserById'](_0x4ede9c)['then'](function(_0x649be){_0x59ebc9(null,_0x649be?_0x649be[_0x488d('0x14')]:![]);})[_0x488d('0x16')](function(_0x4c09d4){_0x59ebc9(_0x4c09d4);});};AGIVertices[_0x488d('0x17')][_0x488d('0x1d')]=function(_0x5d0f54,_0x5bf7f8){this[_0x488d('0x10')]['getTrunkById'](_0x5d0f54)[_0x488d('0x13')](function(_0x45b23b){_0x5bf7f8(null,_0x45b23b?_0x45b23b[_0x488d('0x14')]:![]);})[_0x488d('0x16')](function(_0x5b5bf0){_0x5bf7f8(_0x5b5bf0);});};AGIVertices[_0x488d('0x17')][_0x488d('0x1e')]=function(_0x2a22dc,_0x194e76){var _0x2b9231=this;this['rpc'][_0x488d('0x1f')](_0x2a22dc)[_0x488d('0x13')](function(_0x3afc53){_0x194e76(null,_0x3afc53?_0x2b9231[_0x488d('0x20')](_0x3afc53['save_name']):![]);})[_0x488d('0x16')](function(_0x5ecf5d){_0x194e76(_0x5ecf5d);});};AGIVertices['prototype'][_0x488d('0x21')]=function(_0x322bea,_0x575783){this[_0x488d('0x10')]['getMailAccountById'](_0x322bea)['then'](function(_0x1a4400){_0x575783(null,_0x1a4400?_0x1a4400:![]);})[_0x488d('0x16')](function(_0x30422){_0x575783(_0x30422);});};AGIVertices[_0x488d('0x17')]['sendMailMessage']=function(_0xf3b7d1,_0xcd5088,_0x198196){this[_0x488d('0x22')][_0x488d('0x23')](_0xf3b7d1,_0xcd5088)['then'](function(){_0x198196(null);})[_0x488d('0x16')](function(_0x589028){_0x198196(_0x589028);});};AGIVertices[_0x488d('0x17')][_0x488d('0x24')]=function(_0xe6ec2d,_0x1eebdc){this[_0x488d('0x10')][_0x488d('0x25')](_0xe6ec2d)[_0x488d('0x13')](function(_0x2aa99f){if(_0x2aa99f){if(_0x2aa99f[_0x488d('0x26')]){_0x1eebdc(null,[_0x2aa99f[_0x488d('0x27')]]);}else{_0x1eebdc(null,_[_0x488d('0x28')](_0x2aa99f[_0x488d('0x29')],_0x488d('0x27')));}}else{_0x1eebdc(null,![]);}})[_0x488d('0x16')](function(_0xe5d8c4){_0x1eebdc(_0xe5d8c4);});};AGIVertices[_0x488d('0x17')][_0x488d('0x20')]=function(_0x55ca14){return util[_0x488d('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x55ca14);};AGIVertices[_0x488d('0x17')]['getQueryOdbc']=function(_0x152a09,_0x2d870b,_0x1ba98a){odbc['open'](_0x152a09,function(_0x2240e5){if(_0x2240e5){logger['error'](_0x488d('0x2b'),_0x2240e5);_0x1ba98a(_0x2240e5);}else{logger[_0x488d('0x2c')](_0x488d('0x2d'));odbc[_0x488d('0x2e')](_0x2d870b,function(_0x270e6f,_0x26684d){if(_0x270e6f){logger[_0x488d('0x2c')](_0x488d('0x2f'),_0x2d870b);_0x1ba98a(_0x270e6f);}else{logger[_0x488d('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x2d870b);odbc[_0x488d('0x30')](function(_0x92d7a4){if(_0x92d7a4){logger['error'](_0x488d('0x31'),_0x92d7a4);}_0x1ba98a(null,_0x26684d);});}});}});};AGIVertices[_0x488d('0x17')][_0x488d('0x32')]=function(_0x488360,_0x3f3e9f){this[_0x488d('0x10')][_0x488d('0x33')](_0x488360)[_0x488d('0x13')](function(_0x41480c){_0x3f3e9f(null,_0x41480c?_0x41480c:![]);})['catch'](function(_0x3882a5){_0x3f3e9f(_0x3882a5);});};AGIVertices[_0x488d('0x17')]['createSmsMessage']=function(_0x5cc930,_0x2e3ba0){this[_0x488d('0x10')][_0x488d('0x34')](_0x5cc930)['then'](function(_0x13cb46){_0x2e3ba0(null,_0x13cb46);})['catch'](function(_0x1d33db){_0x2e3ba0(_0x1d33db);});};AGIVertices[_0x488d('0x17')]['createSquareDetailsReport']=function(_0x1b978a,_0x77c3ef,_0x38cddf){this['rpc'][_0x488d('0x35')]({'uniqueid':this[_0x488d('0xf')][_0x488d('0x36')],'node':_0x1b978a[_0x488d('0x37')],'application':_0x1b978a[_0x488d('0x38')],'data':_0x77c3ef||null,'project_name':this[_0x488d('0xf')]['arg_1'],'callerid':this['channel'][_0x488d('0x39')]})[_0x488d('0x13')](function(_0x5ac176){if(_0x38cddf){_0x38cddf(null,_0x5ac176);}})[_0x488d('0x16')](function(_0x2dc53a){if(_0x38cddf){_0x38cddf(_0x2dc53a);}});};AGIVertices['prototype'][_0x488d('0x3a')]=function(_0x5b2c01,_0x2c2292,_0x2572fc,_0x598e8e){this[_0x488d('0x10')]['createSquareRecording']({'uniqueid':this['channel'][_0x488d('0x36')],'callerid':this['channel'][_0x488d('0x39')],'calleridname':this[_0x488d('0xf')][_0x488d('0x3b')],'context':this[_0x488d('0xf')][_0x488d('0x3c')],'extension':this[_0x488d('0xf')][_0x488d('0x3d')],'priority':this['channel'][_0x488d('0x3e')],'accountcode':this[_0x488d('0xf')][_0x488d('0x3f')],'dnid':this[_0x488d('0xf')]['dnid'],'projectName':this[_0x488d('0xf')][_0x488d('0x40')],'saveName':_0x2c2292,'filename':_0x5b2c01['file']||_0x2c2292,'savePath':_0x2572fc})[_0x488d('0x13')](function(_0x134f6d){_0x598e8e(null,_0x134f6d);})[_0x488d('0x16')](function(_0x380db1){_0x598e8e(_0x380db1);});};AGIVertices[_0x488d('0x17')][_0x488d('0x41')]=function(_0x3de1e8,_0x1c4d8c,_0x1a7605,_0x174e5b,_0x1d7d27){this[_0x488d('0x10')][_0x488d('0x41')]({'uniqueid':this[_0x488d('0xf')][_0x488d('0x36')],'body':_0x3de1e8,'direction':_0x1c4d8c,'providerName':_0x1a7605,'providerResponse':_0x174e5b})[_0x488d('0x13')](function(_0x1280c8){if(_0x1d7d27){_0x1d7d27(null,_0x1280c8);}})['catch'](function(_0x17f875){if(_0x1d7d27){_0x1d7d27(_0x17f875);}});};AGIVertices['prototype']['createCmContact']=function(_0x5e13ab,_0x3bcf24){this['rpc']['createCmContact']({'firstName':_[_0x488d('0x42')](_0x5e13ab[_0x488d('0x14')])||_['isNil'](_0x5e13ab[_0x488d('0x14')])?_0x488d('0x43')+Math['random']():_0x5e13ab[_0x488d('0x14')],'lastName':_[_0x488d('0x42')](_0x5e13ab[_0x488d('0x44')])||_[_0x488d('0x45')](_0x5e13ab[_0x488d('0x44')])?null:_0x5e13ab['lastName'],'phone':_0x5e13ab[_0x488d('0x46')],'ListId':_0x5e13ab[_0x488d('0x47')],'scheduledat':_0x5e13ab[_0x488d('0x48')],'callbackUniqueid':this['channel'][_0x488d('0x36')],'tags':'callback','description':_0x488d('0x49')+_0x5e13ab[_0x488d('0x48')]['toString'](),'priority':_0x5e13ab[_0x488d('0x4a')]})['then'](function(_0x468124){_0x3bcf24(null,_0x468124);})[_0x488d('0x16')](function(_0x4b3fa2){_0x3bcf24(_0x4b3fa2);});};AGIVertices[_0x488d('0x17')][_0x488d('0x4b')]=function(_0x4af3ec,_0x5d6f3){this[_0x488d('0x10')][_0x488d('0x4c')](_0x4af3ec)[_0x488d('0x13')](function(_0x57e22a){_0x5d6f3(null,_0x57e22a?_0x57e22a['name']:![]);})['catch'](function(_0x25d1b3){_0x5d6f3(_0x25d1b3);});};AGIVertices['prototype'][_0x488d('0x4d')]=function(_0x13b848,_0x1dec62,_0x469737){var _0x368ff6={'role':_0x488d('0x4e')};_0x368ff6[_0x13b848]=this[_0x488d('0xf')][_0x488d('0x39')];this[_0x488d('0x10')][_0x488d('0x4d')](_0x368ff6,_0x1dec62,this[_0x488d('0xf')][_0x488d('0x36')])['then'](function(_0xada26b){_0x469737(null,_[_0x488d('0x45')](_0xada26b)?![]:!![]);})[_0x488d('0x16')](function(_0x54ced2){logger[_0x488d('0x4f')](_0x54ced2);_0x469737(null,![]);});};AGIVertices[_0x488d('0x17')][_0x488d('0x50')]=function(_0x587fa9,_0x2a12d2){var _0x208db5={'role':'agent'};_0x208db5[_0x587fa9]=this['channel']['callerid'];this[_0x488d('0x10')][_0x488d('0x50')](_0x208db5)['then'](function(_0x133e80){_0x2a12d2(null,_['isNil'](_0x133e80)?![]:!![]);})[_0x488d('0x16')](function(_0x138e23){logger[_0x488d('0x4f')](_0x138e23);_0x2a12d2(null,![]);});};AGIVertices['prototype'][_0x488d('0x51')]=function(_0x12c37d,_0x5e79b5){var _0xdd7618={'role':_0x488d('0x4e')};_0xdd7618[_0x12c37d]=this[_0x488d('0xf')][_0x488d('0x39')];this['rpc'][_0x488d('0x51')](_0xdd7618)[_0x488d('0x13')](function(_0x2118b0){_0x5e79b5(null,_[_0x488d('0x45')](_0x2118b0)?![]:!![]);})[_0x488d('0x16')](function(_0x29d9dd){logger[_0x488d('0x4f')](_0x29d9dd);_0x5e79b5(null,![]);});};AGIVertices['prototype'][_0x488d('0x52')]=function(_0x3d2c6d,_0x4df0dc){var _0x20b150={'role':'agent'};_0x20b150[_0x3d2c6d]=this[_0x488d('0xf')][_0x488d('0x39')];var _0x32c71d=_0x3d2c6d!=_0x488d('0x53')?util['format'](_0x488d('0x54'),_0x488d('0x55'),this[_0x488d('0xf')][_0x488d('0x39')]):undefined;this[_0x488d('0x10')][_0x488d('0x52')](_0x20b150,_0x32c71d)['then'](function(_0x3e48f6){_0x4df0dc(null,_['isNil'](_0x3e48f6)?![]:!![]);})[_0x488d('0x16')](function(_0x40c65b){logger[_0x488d('0x4f')](_0x40c65b);_0x4df0dc(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x54721a,_0x3e6c9b){sh[_0x488d('0x56')](_[_0x488d('0x57')](_0x54721a),function(_0x16a1f6,_0x227aaa){var _0x52dca6=_0x227aaa[_0x488d('0x58')](/(\r\n|\n|\r)/gm,'');_0x3e6c9b(null,_0x52dca6);});};AGIVertices[_0x488d('0x17')][_0x488d('0x59')]=function(_0x5ed565,_0x31a53b){scripts[_0x488d('0x59')](_0x5ed565[_0x488d('0x5a')],_0x5ed565[_0x488d('0x5b')]||_0x488d('0x5c'),_0x5ed565[_0x488d('0x5c')],_0x5ed565['languageCode']||_0x488d('0x5d'),_0x5ed565[_0x488d('0x5e')]||'MALE',_0x5ed565['audioEncoding']||_0x488d('0x5f'))['then'](function(_0x10736c){_0x31a53b(null,_0x10736c);})[_0x488d('0x16')](function(_0x45813b){_0x31a53b(_0x45813b);});};AGIVertices[_0x488d('0x17')][_0x488d('0x60')]=function(_0x57c558,_0x67051){scripts[_0x488d('0x60')](_0x57c558['text'],_0x57c558[_0x488d('0x61')]||'en',0x1)[_0x488d('0x13')](function(_0x39f70e){_0x67051(null,_0x39f70e);})[_0x488d('0x16')](function(_0x257b7f){_0x67051(_0x257b7f);});};AGIVertices[_0x488d('0x17')][_0x488d('0x62')]=function(_0x4fad2a,_0x20c449){var _0x587242={'uri':_0x4fad2a[_0x488d('0x63')],'method':_0x4fad2a[_0x488d('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4fad2a['timeout'])===_0x488d('0x65')&&parseInt(_0x4fad2a[_0x488d('0x66')])>=0x1?parseInt(_0x4fad2a[_0x488d('0x66')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST','PUT'],_0x587242[_0x488d('0x64')]['toUpperCase']())){try{_0x587242['body']=_0x4fad2a[_0x488d('0xd')]?JSON[_0x488d('0x67')](_0x4fad2a[_0x488d('0xd')]):{};}catch(_0x307fd1){logger[_0x488d('0x4f')](_0x488d('0x68'),_0x307fd1);}}try{_0x587242[_0x488d('0x69')]=_0x4fad2a[_0x488d('0xc')]?JSON[_0x488d('0x67')](_0x4fad2a[_0x488d('0xc')]):{};}catch(_0x139c04){logger[_0x488d('0x4f')](_0x488d('0x6a'),_0x139c04);}if(_0x4fad2a[_0x488d('0x6b')]){try{var _0x5b5f8e=require(_0x4fad2a[_0x488d('0x6b')])[_0x488d('0x6c')](this,_0x587242);_0x587242[_0x488d('0x6d')]=Mustache['render'](_0x4fad2a['url'],_0x5b5f8e,{},['$$','$$']);if(_0x587242['headers']){_0x587242[_0x488d('0x69')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x587242[_0x488d('0x69')]),_0x5b5f8e,{},['$$','$$']));}if(_0x587242[_0x488d('0x6e')]){_0x587242[_0x488d('0x6e')]=JSON[_0x488d('0x67')](Mustache[_0x488d('0x6f')](JSON[_0x488d('0x70')](_0x587242[_0x488d('0x6e')]),_0x5b5f8e,{},['$$','$$']));}}catch(_0x3029fa){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3029fa);}}rp(_0x587242)[_0x488d('0x13')](function(_0x23b9ec){var _0xc9958e={'statusCode':_0x23b9ec[_0x488d('0x71')]||0xc8,'statusMessage':_0x23b9ec[_0x488d('0x72')]||'OK','headers':_0x23b9ec['headers']||{},'body':_0x23b9ec[_0x488d('0x6e')]||{}};_0x20c449(null,_0xc9958e);})[_0x488d('0x16')](function(_0x9a0440){var _0x16521b={'statusCode':_0x9a0440['statusCode']||0x1f4,'statusMessage':_0x9a0440[_0x488d('0x73')]||_0x488d('0x74'),'headers':_0x9a0440['options'][_0x488d('0x69')]||{},'body':_0x9a0440[_0x488d('0x75')][_0x488d('0x6e')]||{}};_0x20c449(null,_0x16521b);});};AGIVertices['prototype'][_0x488d('0x76')]=function(_0x128450,_0x38f2fb){scripts[_0x488d('0x76')](this[_0x488d('0xf')][_0x488d('0x36')],_0x128450[_0x488d('0x77')],_0x128450[_0x488d('0x5c')],_0x128450[_0x488d('0x78')]||'en')[_0x488d('0x13')](function(_0xf417d0){_0x38f2fb(null,_0xf417d0);})[_0x488d('0x16')](function(_0x5e6996){_0x38f2fb(_0x5e6996);});};AGIVertices[_0x488d('0x17')][_0x488d('0x79')]=function(_0x421374,_0x46db91){scripts[_0x488d('0x79')](this[_0x488d('0xf')][_0x488d('0x36')],_0x421374[_0x488d('0x7a')],_0x421374[_0x488d('0x7b')],_0x421374[_0x488d('0x7c')],_0x421374[_0x488d('0x5c')],_0x421374[_0x488d('0x7d')]||'en')[_0x488d('0x13')](function(_0x5c2b58){_0x46db91(null,_0x5c2b58);})[_0x488d('0x16')](function(_0x54787e){_0x46db91(_0x54787e);});};AGIVertices[_0x488d('0x17')][_0x488d('0x7e')]=function(_0x449fbb,_0x4c2a29){scripts[_0x488d('0x7e')](this[_0x488d('0xf')],_0x449fbb)[_0x488d('0x13')](function(_0x4026cb){_0x4c2a29(null,_0x4026cb);})['catch'](function(_0x147fea){_0x4c2a29(_0x147fea);});};AGIVertices[_0x488d('0x17')][_0x488d('0x7f')]=function(_0x538b9a,_0x1aa012){scripts['ispeechTTS'](_0x538b9a[_0x488d('0x77')],_0x538b9a[_0x488d('0x5c')],_0x538b9a[_0x488d('0x80')]||_0x488d('0x5d'),_0x538b9a[_0x488d('0x81')])[_0x488d('0x13')](function(_0x4af69f){_0x1aa012(null,_0x4af69f);})['catch'](function(_0x4724d9){_0x1aa012(_0x4724d9);});};AGIVertices[_0x488d('0x17')][_0x488d('0x82')]=function(_0x448673,_0x1c0056,_0xf6e14d){scripts[_0x488d('0x82')](_0x1c0056,_0x448673['key'],_0x448673[_0x488d('0x83')]||_0x488d('0x5d'),this[_0x488d('0x84')](_0x448673[_0x488d('0x85')])?_0x448673[_0x488d('0x85')]:undefined)[_0x488d('0x13')](function(_0x1c6b3e){_0xf6e14d(null,_0x1c6b3e);})[_0x488d('0x16')](function(_0x3d45c4){_0xf6e14d(_0x3d45c4);});};AGIVertices[_0x488d('0x17')][_0x488d('0x86')]=function(_0x107b42,_0x3f0fd6){scripts['awsPolly'](_0x107b42[_0x488d('0x87')],_0x107b42[_0x488d('0x88')],_0x107b42[_0x488d('0x89')],_0x107b42['aws_polly_voice']||'Amy',_0x107b42[_0x488d('0x5c')],_0x107b42[_0x488d('0x8a')]||'text')[_0x488d('0x13')](function(_0x3a7a5f){_0x3f0fd6(null,_0x3a7a5f);})['catch'](function(_0x433eb5){_0x3f0fd6(_0x433eb5);});};AGIVertices[_0x488d('0x17')][_0x488d('0x8b')]=function(_0x2ea28e,_0x1225e6){scripts[_0x488d('0x8b')](this['channel']['uniqueid'],_0x2ea28e[_0x488d('0x87')],_0x2ea28e[_0x488d('0x88')],_0x2ea28e['aws_lex_region'],_0x2ea28e['text'],_0x2ea28e['aws_bot_name'])[_0x488d('0x13')](function(_0x366399){_0x1225e6(null,_0x366399);})[_0x488d('0x16')](function(_0x6c8e53){_0x1225e6(_0x6c8e53);});};AGIVertices['prototype'][_0x488d('0x8c')]=function(_0x3aef5b,_0x20ccf8,_0x13a4aa){scripts[_0x488d('0x8c')](_0x20ccf8,_0x3aef5b['key'],_0x3aef5b[_0x488d('0x8d')]||_0x488d('0x5d'))[_0x488d('0x13')](function(_0x148fd9){_0x13a4aa(null,_0x148fd9);})['catch'](function(_0x3eec1b){_0x13a4aa(_0x3eec1b);});};AGIVertices[_0x488d('0x17')][_0x488d('0x8e')]=function(_0x55d63d,_0x367fe6,_0x4a541a){scripts['tildeASR'](_0x367fe6,_0x55d63d[_0x488d('0x8f')],_0x55d63d[_0x488d('0x90')],_0x55d63d[_0x488d('0x6d')])[_0x488d('0x13')](function(_0xc47717){_0x4a541a(null,_0xc47717);})[_0x488d('0x16')](function(_0x1d28d8){_0x4a541a(_0x1d28d8);});};AGIVertices[_0x488d('0x17')][_0x488d('0x91')]=function(_0x2fd2ea){var _0x5ca6cc=_['includes'](verticesWithRetry,_0x2fd2ea[_0x488d('0x38')])?_0x2fd2ea:_['clone'](_0x2fd2ea);for(var _0x222ead in _0x5ca6cc){if(_0x5ca6cc[_0x488d('0x92')](_0x222ead)){if(_0x5ca6cc[_0x222ead]&&_[_0x488d('0x93')](_0x5ca6cc[_0x222ead])){if(_[_0x488d('0x94')](recursiveMapAttributes,_0x222ead)){_0x5ca6cc[_0x222ead]=this[_0x488d('0x95')](_0x5ca6cc[_0x222ead]);}else{_0x5ca6cc[_0x222ead]=this[_0x488d('0x96')](_0x5ca6cc[_0x222ead]);}}}}return _0x5ca6cc;};AGIVertices[_0x488d('0x17')]['recursiveNodeIndex']=function(_0x221fc3){for(var _0xc5b7fa in _0x221fc3){if(_0x221fc3[_0x488d('0x92')](_0xc5b7fa)){if(_['isPlainObject'](_0x221fc3[_0xc5b7fa])){this[_0x488d('0x97')](_0x221fc3[_0xc5b7fa]);}else if(_[_0x488d('0x98')](_0x221fc3[_0xc5b7fa])){for(var _0x232e20=0x0;_0x232e20<_0x221fc3[_0xc5b7fa][_0x488d('0x99')];_0x232e20++){this[_0x488d('0x97')](_0x221fc3[_0xc5b7fa][_0x232e20]);}}else if(_[_0x488d('0x93')](_0x221fc3[_0xc5b7fa])){_0x221fc3[_0xc5b7fa]=this['replaceAllVariables'](_0x221fc3[_0xc5b7fa]);}}}};AGIVertices[_0x488d('0x17')][_0x488d('0x9a')]=function(_0x447324,_0x5dd1ef){for(var _0x10b5f2 in _0x447324){if(_0x447324['hasOwnProperty'](_0x10b5f2)){if(_[_0x488d('0x9b')](_0x447324[_0x10b5f2])){if(!_['isEmpty'](_0x447324[_0x10b5f2])){this[_0x488d('0x9a')](_0x447324[_0x10b5f2],util[_0x488d('0x2a')](_0x488d('0x9c'),_0x5dd1ef,_0x10b5f2));}}else if(_['isArray'](_0x447324[_0x10b5f2])){for(var _0xd681ca=0x0;_0xd681ca<_0x447324[_0x10b5f2][_0x488d('0x99')];_0xd681ca++){this[_0x488d('0x9a')](_0x447324[_0x10b5f2][_0xd681ca],util[_0x488d('0x2a')](_0x488d('0x9c'),_0x5dd1ef,_0x10b5f2+'['+_0xd681ca+']'));}}else{if(!_['isNil'](_0x447324[_0x10b5f2])){this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')](_0x488d('0x9c'),_0x5dd1ef,_0x10b5f2),_0x447324[_0x10b5f2]);}}}}};AGIVertices[_0x488d('0x17')]['replaceObjectAllVariables']=function(_0x1a2aa4){try{var _0x5b6149=JSON[_0x488d('0x67')](_0x1a2aa4);this[_0x488d('0x97')](_0x5b6149);return JSON['stringify'](_0x5b6149);}catch(_0x15dfab){return this[_0x488d('0x96')](_0x1a2aa4);}};AGIVertices[_0x488d('0x17')][_0x488d('0x96')]=function(_0x5d63b1){var _0x3590e5=_0x5d63b1[_0x488d('0x9e')]('{');for(var _0x13a3f1=0x1;_0x13a3f1<_0x3590e5[_0x488d('0x99')];_0x13a3f1+=0x1){var _0x2ab36c=_0x3590e5[_0x13a3f1][_0x488d('0x9e')]('}');if(_0x2ab36c['length']>0x1){_0x5d63b1=_0x5d63b1[_0x488d('0x9f')]('{'+_0x2ab36c[0x0]+'}',this[_0x488d('0xf')]['getVariable'](_0x2ab36c[0x0])[_0x488d('0xa0')]||_0x2ab36c[0x0]);}}if(_0x3590e5[_0x488d('0x99')]===0x1){return _0x5d63b1['toString']();}return this[_0x488d('0x96')](_0x5d63b1);};AGIVertices[_0x488d('0x17')][_0x488d('0xa1')]=function(_0x22731b,_0x1f91af){var _0xc029f1=this[_0x488d('0xf')]['getVariable'](_0x22731b);if(_0xc029f1[_0x488d('0xa2')]===-0x1){return _0xc029f1;}logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xa3'),_0x1f91af,_0xc029f1[_0x488d('0xa0')]));return this[_0x488d('0xf')][_0x488d('0x9d')](_0x1f91af,_0xc029f1[_0x488d('0xa0')]);};AGIVertices[_0x488d('0x17')][_0x488d('0x84')]=function(_0x2f704a){return _0x2f704a&&_0x2f704a!=='0'&&_0x2f704a!=='-1'&&_0x2f704a!=='';};AGIVertices['prototype'][_0x488d('0xa4')]=function(_0x509ae4){this[_0x488d('0x35')]['sync'](this,_0x509ae4,'-');_0x509ae4[_0x488d('0xa5')]=_0x509ae4[_0x488d('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x488d('0x17')][_0x488d('0xa6')]=function(_0x2c8929){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xa7'),_0x2c8929[_0x488d('0x37')]));if(!this['isConfigured'](_0x2c8929[_0x488d('0x5c')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xa9'));}var _0xd8d16f='\x22'+_0x2c8929[_0x488d('0x5c')]+'\x22';if(this[_0x488d('0x84')](_0x2c8929['options'])){_0xd8d16f+=','+_0x2c8929[_0x488d('0x75')];}var _0x23ab6e=this[_0x488d('0xf')][_0x488d('0x56')](_0x488d('0xaa'),_0xd8d16f);if(_0x23ab6e[_0x488d('0xa2')]===-0x1){return _0x23ab6e;}return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xab'),_0xd8d16f));};AGIVertices['prototype'][_0x488d('0xac')]=function(_0x459699){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xad'),_0x459699['label']));if(!this[_0x488d('0x84')](_0x459699[_0x488d('0xae')])){return this['channel'][_0x488d('0xa8')](_0x488d('0xaf'));}var _0x5786c2=_0x459699['grammar'];if(this[_0x488d('0x84')](_0x459699['options'])){_0x5786c2+=','+_0x459699[_0x488d('0x75')];}var _0x7058a4=this[_0x488d('0xf')][_0x488d('0x56')]('MRCPRecog',_0x5786c2);if(_0x7058a4[_0x488d('0xa2')]===-0x1){return _0x7058a4;}var _0x5e79c5=this[_0x488d('0xa1')](_0x488d('0xb0'),_0x488d('0xb1'));if(_0x5e79c5[_0x488d('0xa2')]===-0x1){return _0x5e79c5;}var _0x3905da=this[_0x488d('0xa1')](_0x488d('0xb2'),_0x488d('0xb3'));if(_0x3905da[_0x488d('0xa2')]===-0x1){return _0x3905da;}var _0x253a14=this[_0x488d('0xa1')](_0x488d('0xb4'),_0x488d('0xb5'));if(_0x253a14[_0x488d('0xa2')]===-0x1){return _0x253a14;}return this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5786c2));};AGIVertices['prototype'][_0x488d('0x8')]=function(_0x2600ea){logger['info'](util[_0x488d('0x2a')](_0x488d('0xb6'),_0x2600ea[_0x488d('0x37')]));return this[_0x488d('0xf')][_0x488d('0x8')]([_0x2600ea['command'],_0x2600ea[_0x488d('0xb7')]]);};AGIVertices[_0x488d('0x17')]['answer']=function(_0x374cd6){logger[_0x488d('0x2c')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x374cd6[_0x488d('0x37')]));if(this[_0x488d('0x84')](_0x374cd6[_0x488d('0x66')])){logger['info'](util['format'](_0x488d('0xb8'),_0x374cd6[_0x488d('0x66')]));var _0x437157=this[_0x488d('0xf')][_0x488d('0xb9')](_0x374cd6[_0x488d('0x66')]);if(_0x437157[_0x488d('0xa2')]===-0x1){return _0x437157;}}return this[_0x488d('0xf')][_0x488d('0xba')]();};AGIVertices[_0x488d('0x17')]['callback']=function(_0x479379){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xbb'),_0x479379['label']));if(!this[_0x488d('0x84')](_0x479379[_0x488d('0x47')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x479379,'no\x20list\x20selected');}_0x479379['scheduledAt']=moment();if(this[_0x488d('0x84')](_0x479379['delay'])){_0x479379[_0x488d('0x48')]=moment()['add'](_0x479379[_0x488d('0xbc')],_0x488d('0xbd'));}if(!this[_0x488d('0x84')](_0x479379[_0x488d('0x4a')])){_0x479379[_0x488d('0x4a')]=0x2;}this[_0x488d('0xbe')][_0x488d('0x6c')](this,_0x479379);return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x479379[_0x488d('0x46')],_0x479379[_0x488d('0x47')],_0x479379[_0x488d('0x48')]));};AGIVertices[_0x488d('0x17')][_0x488d('0xbf')]=function(_0x3ac663){logger[_0x488d('0x2c')](util['format'](_0x488d('0xc0'),_0x3ac663['label']));var _0x172d9b=this[_0x488d('0xf')][_0x488d('0x56')](_0x3ac663[_0x488d('0xc1')],_0x3ac663[_0x488d('0x75')]);if(_0x172d9b[_0x488d('0xa2')]===-0x1){return _0x172d9b;}return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xc2'),_0x3ac663['application'],_0x3ac663['options']));};AGIVertices[_0x488d('0x17')][_0x488d('0xc3')]=function(_0x4cd74c){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xc4'),_0x4cd74c[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x4cd74c['text'])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xa9'));}var _0x231939='\x22'+_0x4cd74c[_0x488d('0x5c')]+'\x22';if(this[_0x488d('0x84')](_0x4cd74c[_0x488d('0x75')])){_0x231939+=','+_0x4cd74c[_0x488d('0x75')];}var _0x4ce88b=this[_0x488d('0xf')][_0x488d('0x56')](_0x488d('0xaa'),_0x231939);if(_0x4ce88b['result']===-0x1){return _0x4ce88b;}return this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')](_0x488d('0xab'),_0x231939));};AGIVertices['prototype'][_0x488d('0xc5')]=function(_0x192fad){logger[_0x488d('0x2c')](util['format'](_0x488d('0xc6'),_0x192fad[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x192fad[_0x488d('0x5c')])){return this[_0x488d('0xf')]['noop'](_0x488d('0xa9'));}var _0x4e9d86='\x22'+_0x192fad[_0x488d('0x5c')]+'\x22';if(this['isConfigured'](_0x192fad['options'])){_0x4e9d86+=','+_0x192fad[_0x488d('0x75')];}var _0x263271=this['channel'][_0x488d('0x56')](_0x488d('0xaa'),_0x4e9d86);if(_0x263271[_0x488d('0xa2')]===-0x1){return _0x263271;}return this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')](_0x488d('0xab'),_0x4e9d86));};AGIVertices[_0x488d('0x17')][_0x488d('0xc7')]=function(_0x59a5f7){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xc8'),_0x59a5f7[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x59a5f7['grammar'])){return this['channel']['noop'](_0x488d('0xaf'));}var _0x183fc1=_0x59a5f7['grammar'];if(this[_0x488d('0x84')](_0x59a5f7[_0x488d('0x75')])){_0x183fc1+=','+_0x59a5f7[_0x488d('0x75')];}var _0x264036=this[_0x488d('0xf')][_0x488d('0x56')](_0x488d('0xc9'),_0x183fc1);if(_0x264036[_0x488d('0xa2')]===-0x1){return _0x264036;}var _0xc264bd=this['getAndSetVariable'](_0x488d('0xb0'),_0x488d('0xca'));if(_0xc264bd[_0x488d('0xa2')]===-0x1){return _0xc264bd;}var _0x2f3abb=this['getAndSetVariable']('RECOG_INPUT()',_0x488d('0xcb'));if(_0x2f3abb[_0x488d('0xa2')]===-0x1){return _0x2f3abb;}var _0x153d0e=this[_0x488d('0xa1')](_0x488d('0xb4'),_0x488d('0xcc'));if(_0x153d0e[_0x488d('0xa2')]===-0x1){return _0x153d0e;}return this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xcd'),_0x183fc1));};AGIVertices['prototype'][_0x488d('0xce')]=function(_0x3f995f){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xcf'),_0x3f995f[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x3f995f[_0x488d('0xae')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xaf'));}var _0x3fb280=_0x3f995f[_0x488d('0xae')];if(this['isConfigured'](_0x3f995f[_0x488d('0x75')])){_0x3fb280+=','+_0x3f995f['options'];}var _0x5583dd=this[_0x488d('0xf')][_0x488d('0x56')](_0x488d('0xc9'),_0x3fb280);if(_0x5583dd[_0x488d('0xa2')]===-0x1){return _0x5583dd;}var _0x2e5f83=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x488d('0xd0'));if(_0x2e5f83[_0x488d('0xa2')]===-0x1){return _0x2e5f83;}var _0xf1a87d=this['getAndSetVariable'](_0x488d('0xb2'),_0x488d('0xd1'));if(_0xf1a87d['result']===-0x1){return _0xf1a87d;}var _0x47d5a8=this[_0x488d('0xa1')](_0x488d('0xb4'),'SESTEK_ASR_INSTANCE');if(_0x47d5a8[_0x488d('0xa2')]===-0x1){return _0x47d5a8;}return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xcd'),_0x3fb280));};AGIVertices[_0x488d('0x17')][_0x488d('0xd2')]=function(_0x2b8c81){logger['info'](util[_0x488d('0x2a')](_0x488d('0xd3'),_0x2b8c81[_0x488d('0x37')]));if(!this['isConfigured'](_0x2b8c81[_0x488d('0xd4')])){return this[_0x488d('0xf')]['error'](_0x2b8c81,_0x488d('0xd5'));}var _0x408649=this[_0x488d('0x1a')]['sync'](this,_0x2b8c81[_0x488d('0xd4')]);if(!_0x408649){return this['channel'][_0x488d('0x4f')](_0x2b8c81,_0x488d('0xd6'));}if(!this[_0x488d('0x84')](_0x2b8c81[_0x488d('0x2e')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x2b8c81,_0x488d('0xd7'));}var _0x14ccc8=_0x2b8c81['query'][_0x488d('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xd8'),_0x14ccc8));var _0x5ecee6=this[_0x488d('0xd9')][_0x488d('0x6c')](this,_0x408649,_0x14ccc8);this[_0x488d('0x35')][_0x488d('0x6c')](this,_0x2b8c81,_0x14ccc8);if(!this['isConfigured'](_0x2b8c81[_0x488d('0xda')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xdb'));}var _0x220f71=this[_0x488d('0x11')][_0x488d('0x6c')](this,_0x2b8c81['variable_id']);if(!_0x220f71){return this[_0x488d('0xf')]['error'](_0x2b8c81,_0x488d('0xdc'));}var _0x5621f4=this;_0x5ecee6[_0x488d('0xdd')](function(_0x325f50,_0x3908fc){Object[_0x488d('0xde')](_0x325f50)[_0x488d('0xdd')](function(_0x589456){_0x5621f4[_0x488d('0xf')]['setVariable'](util[_0x488d('0x2a')](_0x488d('0xdf'),_0x220f71,_0x3908fc,_0x589456),_0x325f50[_0x589456]);});});this[_0x488d('0xf')]['setVariable'](util[_0x488d('0x2a')](_0x488d('0xe0'),_0x220f71),_0x5ecee6['length']);return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xe1'),_0x220f71));};AGIVertices[_0x488d('0x17')][_0x488d('0xe2')]=function(_0x260936){logger[_0x488d('0xe3')](util[_0x488d('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x260936[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x260936[_0x488d('0xe4')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x260936,_0x488d('0xe5'));}var _0xaf147f=this[_0x488d('0xe6')][_0x488d('0x6c')](this,_0x260936[_0x488d('0xe4')]);if(!_0xaf147f){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x260936,_0x488d('0xe7'));}var _0xc1d7f1=this[_0x488d('0xf')][_0x488d('0x56')]('DIAL',[util[_0x488d('0x2a')](_0x488d('0xe8'),_0xaf147f),_0x260936[_0x488d('0x66')],_0x260936[_0x488d('0xe9')],_0x260936[_0x488d('0x63')]]);if(_0xc1d7f1[_0x488d('0xa2')]===-0x1){return _0xc1d7f1;}return this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x488d('0x17')][_0x488d('0xea')]=function(_0x30f5af){logger['info'](util[_0x488d('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x30f5af[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x30f5af[_0x488d('0x77')])){return this['channel'][_0x488d('0xa8')](_0x488d('0xeb'));}if(!this[_0x488d('0x84')](_0x30f5af[_0x488d('0x5c')])){return this[_0x488d('0xf')]['noop'](_0x488d('0xa9'));}this[_0x488d('0xf')][_0x488d('0xec')]=!![];this[_0x488d('0x35')](_0x30f5af);this['createSquareMessage'](_0x30f5af[_0x488d('0x5c')],'in','','');this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xed'),_0x30f5af[_0x488d('0x5c')]));var _0x4bdcfc=this['googleDialogflow']['sync'](this,_0x30f5af);if(_0x4bdcfc){for(var _0x51ea85 in _0x4bdcfc){if(_0x4bdcfc[_0x488d('0x92')](_0x51ea85)){this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')]('DIALOGFLOW_%s',_0x51ea85[_0x488d('0xee')]()),_0x4bdcfc[_0x51ea85]);}}this[_0x488d('0x41')](_0x4bdcfc[_0x488d('0xef')],_0x488d('0xf0'),_0x488d('0xea'),'');return this['channel'][_0x488d('0xa8')](util['format'](_0x488d('0xf1'),_0x4bdcfc[_0x488d('0xef')]));}return this[_0x488d('0xf')][_0x488d('0x4f')](_0x30f5af,_0x488d('0xf2'));};AGIVertices[_0x488d('0x17')][_0x488d('0xf3')]=function(_0x312ebe){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xf4'),_0x312ebe[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x312ebe[_0x488d('0x7a')])){return this[_0x488d('0xf')]['noop']('no\x20project_id\x20configured');}if(!this[_0x488d('0x84')](_0x312ebe['client_email'])){return this[_0x488d('0xf')]['noop'](_0x488d('0xf5'));}if(!this[_0x488d('0x84')](_0x312ebe['private_key'])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xf6'));}if(!this[_0x488d('0x84')](_0x312ebe[_0x488d('0x7d')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xf7'));}if(!this[_0x488d('0x84')](_0x312ebe[_0x488d('0x5c')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xa9'));}this[_0x488d('0xf')][_0x488d('0xec')]=!![];this[_0x488d('0x35')](_0x312ebe);this[_0x488d('0x41')](_0x312ebe[_0x488d('0x5c')],'in','','');this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0x312ebe[_0x488d('0x5c')]));var _0xfe16c8=this['googleDialogflowV2'][_0x488d('0x6c')](this,_0x312ebe);if(_0xfe16c8){for(var _0x586bad in _0xfe16c8){if(_0xfe16c8['hasOwnProperty'](_0x586bad)){if(_0x586bad!=='providerResponse'){this['channel'][_0x488d('0x9d')](util[_0x488d('0x2a')](_0x488d('0xf8'),_0x586bad[_0x488d('0xee')]()),_0xfe16c8[_0x586bad]);}}}this[_0x488d('0x41')](_0xfe16c8['speech'],_0x488d('0xf0'),'dialogflowV2',_0xfe16c8[_0x488d('0xf9')]);return this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')](_0x488d('0xfa'),_0xfe16c8[_0x488d('0xef')]));}return this[_0x488d('0xf')][_0x488d('0x4f')](_0x312ebe,_0x488d('0xfb'));};AGIVertices[_0x488d('0x17')][_0x488d('0xfc')]=function(_0x4661fc){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0xfd'),_0x4661fc['label']));if(!this[_0x488d('0x84')](_0x4661fc[_0x488d('0xfe')])){return this['channel']['noop'](_0x488d('0xff'));}if(!this['isConfigured'](_0x4661fc[_0x488d('0x100')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x101'));}if(!this[_0x488d('0x84')](_0x4661fc['password'])){return this['channel'][_0x488d('0xa8')](_0x488d('0x102'));}if(!this[_0x488d('0x84')](_0x4661fc[_0x488d('0x103')])){return this[_0x488d('0xf')][_0x488d('0xa8')]('no\x20text\x20configured');}this[_0x488d('0xf')][_0x488d('0xec')]=!![];this[_0x488d('0x35')](_0x4661fc);this[_0x488d('0x41')](_0x4661fc[_0x488d('0x5c')],'in','','');this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x104'),_0x4661fc[_0x488d('0x5c')]));var _0x550388=this[_0x488d('0x7e')][_0x488d('0x6c')](this,_0x4661fc);if(_0x550388){for(var _0x418928 in _0x550388){if(_0x550388[_0x488d('0x92')](_0x418928)){this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')]('SESTEK_NDA_%s',_0x418928[_0x488d('0xee')]()),_0x550388[_0x418928]);}}this[_0x488d('0x41')](_0x550388[_0x488d('0xef')],_0x488d('0xf0'),'sesteknda','');if(_0x550388[_0x488d('0x105')]){this['channel']['noop'](util[_0x488d('0x2a')](_0x488d('0x106'),_0x550388[_0x488d('0x105')]));var _0x3cfdc6=this[_0x488d('0xf')][_0x488d('0x107')](_0x550388[_0x488d('0x105')]);try{fs[_0x488d('0x108')](_0x550388[_0x488d('0x105')]+_0x488d('0x109'));}catch(_0x59c272){logger['error'](_0x59c272);}return _0x3cfdc6;}else{return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x10a'),_0x550388[_0x488d('0xef')]));}}return this[_0x488d('0xf')][_0x488d('0x4f')](_0x4661fc,_0x488d('0x10b'));};AGIVertices['prototype'][_0x488d('0x10c')]=function(_0xcf7ccb){logger['info'](util[_0x488d('0x2a')](_0x488d('0x10d'),_0xcf7ccb[_0x488d('0x37')]));return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x10c'));};AGIVertices[_0x488d('0x17')]['ext_dial']=function(_0x16966b){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x10e'),_0x16966b[_0x488d('0x37')]));var _0x1c6fca='';if(_0x16966b[_0x488d('0x10f')]){if(!this['isConfigured'](_0x16966b[_0x488d('0x10f')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x16966b,_0x488d('0x110'));}else{var _0x47a6b1=parseInt(_0x16966b['trunk_id'],0xa);if(isNaN(_0x47a6b1)){_0x1c6fca=_0x16966b['trunk_id'];}else{_0x1c6fca=this[_0x488d('0x1d')]['sync'](this,_0x16966b['trunk_id']);if(!_0x1c6fca){return this['channel'][_0x488d('0x4f')](_0x16966b,_0x488d('0x111'));}}}}else if(_0x16966b[_0x488d('0x112')]){_0x1c6fca=_0x16966b[_0x488d('0x112')];}else{return this['channel'][_0x488d('0x4f')](_0x16966b,_0x488d('0x110'));}var _0xb1f73e=this[_0x488d('0xf')][_0x488d('0x56')]('DIAL',[util[_0x488d('0x2a')](_0x488d('0x113'),_0x1c6fca,_0x16966b[_0x488d('0x46')]),_0x16966b['timeout'],_0x16966b[_0x488d('0xe9')],_0x16966b[_0x488d('0x63')]]);if(_0xb1f73e[_0x488d('0xa2')]===-0x1){return _0xb1f73e;}return this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x114'),_0x488d('0x115')));};AGIVertices[_0x488d('0x17')]['finally']=function(_0x5f4d72){logger['info'](util[_0x488d('0x2a')](_0x488d('0x116'),_0x5f4d72[_0x488d('0x37')]));return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x117'));};AGIVertices[_0x488d('0x17')][_0x488d('0x118')]=function(_0xc84c96){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x119'),_0xc84c96['label']));if(_0xc84c96[_0x488d('0xa5')]===0x0){return this['maxRetry'](_0xc84c96);}_0xc84c96[_0x488d('0xa5')]-=0x1;if(!this[_0x488d('0x84')](_0xc84c96[_0x488d('0x11a')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0xc84c96,_0x488d('0x11b'));}var _0x580c89=this[_0x488d('0x1e')][_0x488d('0x6c')](this,_0xc84c96['file_id']);if(!_0x580c89){return this[_0x488d('0xf')]['error'](_0xc84c96,'no\x20file\x20audio\x20found');}if(!this[_0x488d('0x84')](_0xc84c96[_0x488d('0xda')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x488d('0xdb'));}var _0x562599=this[_0x488d('0xf')][_0x488d('0x11c')](_0x580c89,_0xc84c96['response'],_0xc84c96[_0x488d('0x11d')]);var _0x1e65bd=_0x562599[_0x488d('0xa2')]?_0x562599['result'][_0x488d('0x11e')]():'';logger[_0x488d('0x2c')](_0x488d('0x11f'),JSON['stringify'](_0x562599));if(_0x562599[_0x488d('0xa2')]===-0x1){this[_0x488d('0x35')]['sync'](this,_0xc84c96,_0x1e65bd);return _0x562599;}else if(_0x562599[_0x488d('0xa0')]===_0x488d('0x66')){_0x562599['result']=_0x1e65bd[_0x488d('0x99')]>=parseInt(_0xc84c96[_0x488d('0x120')])?'x':'i';}else{_0x562599[_0x488d('0xa2')]=_0x1e65bd[_0x488d('0x99')]>=parseInt(_0xc84c96['mindigit'])&&_0x1e65bd[_0x488d('0x99')]<=parseInt(_0xc84c96[_0x488d('0x11d')])?'x':'i';}var _0x126700=this[_0x488d('0x11')]['sync'](this,_0xc84c96['variable_id']);if(!_0x126700){return this[_0x488d('0xf')][_0x488d('0x4f')](_0xc84c96,_0x488d('0xdc'));}this[_0x488d('0xf')][_0x488d('0x9d')](_0x126700,_0x1e65bd);if(this[_0x488d('0x84')](_0xc84c96[_0x488d('0x121')])){var _0x40693e=parseInt(_0xc84c96[_0x488d('0x121')],0xa);var _0xe0444f=rs[_0x488d('0x122')]({'charset':'*','length':_0x40693e});var _0xa8ae27=_0x1e65bd[_0x488d('0x99')];if(_0xa8ae27>0x0){if(_0xa8ae27>_0x40693e){this[_0x488d('0x35')][_0x488d('0x6c')](this,_0xc84c96,_0xc84c96[_0x488d('0x123')]===_0x488d('0x124')?_0xe0444f+_0x1e65bd[_0x488d('0x125')](_0x40693e):_0x1e65bd[_0x488d('0x125')](0x0,_0xa8ae27-_0x40693e)+_0xe0444f);}else{this[_0x488d('0x35')]['sync'](this,_0xc84c96,rs[_0x488d('0x122')]({'charset':'*','length':_0xa8ae27}));}}else{this[_0x488d('0x35')][_0x488d('0x6c')](this,_0xc84c96,'');}}else{this[_0x488d('0x35')][_0x488d('0x6c')](this,_0xc84c96,_0x1e65bd);}return _0x562599;};AGIVertices[_0x488d('0x17')][_0x488d('0x126')]=function(_0x2c5773){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x127'),_0x2c5773[_0x488d('0x37')]));return this[_0x488d('0x118')](_0x2c5773);};AGIVertices[_0x488d('0x17')][_0x488d('0x128')]=function(_0x4da718){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x129'),_0x4da718['label']));this[_0x488d('0x35')][_0x488d('0x6c')](this,_0x4da718,_0x4da718[_0x488d('0x12a')]);return this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')](_0x488d('0x12b'),_0x4da718['goalname']));};AGIVertices[_0x488d('0x17')]['awspolly']=function(_0xf8d5cb){logger['info'](util[_0x488d('0x2a')](_0x488d('0x12c'),_0xf8d5cb['label']));if(!this[_0x488d('0x84')](_0xf8d5cb[_0x488d('0x87')])||!this[_0x488d('0x84')](_0xf8d5cb['aws_secret_access_key'])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x12d'));}if(!this[_0x488d('0x84')](_0xf8d5cb[_0x488d('0x5c')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xa9'));}this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0xf8d5cb[_0x488d('0x5c')]));var _0x3e9cf2=this['awsPolly'][_0x488d('0x6c')](this,_0xf8d5cb);if(_0x3e9cf2){this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')](_0x488d('0x12e'),_0x3e9cf2));var _0x53fb9e=this[_0x488d('0xf')][_0x488d('0x107')](_0x3e9cf2);try{fs['unlink'](_0x3e9cf2+_0x488d('0x109'));}catch(_0x813efd){logger[_0x488d('0x4f')](_0x813efd);}return _0x53fb9e;}return this[_0x488d('0xf')]['error'](_0xf8d5cb,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x488d('0x17')][_0x488d('0x12f')]=function(_0x235dd4){logger[_0x488d('0x2c')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x235dd4['label']));if(!this[_0x488d('0x84')](_0x235dd4[_0x488d('0x87')])||!this[_0x488d('0x84')](_0x235dd4[_0x488d('0x88')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x12d'));}if(!this['isConfigured'](_0x235dd4['aws_bot_name'])){return this[_0x488d('0xf')]['noop'](_0x488d('0x130'));}if(!this[_0x488d('0x84')](_0x235dd4[_0x488d('0x5c')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xa9'));}this[_0x488d('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x235dd4);this[_0x488d('0x41')](_0x235dd4[_0x488d('0x5c')],'in','','');this[_0x488d('0xf')][_0x488d('0xa8')](util['format'](_0x488d('0x131'),_0x235dd4['text']));var _0x4eaf76=this['awsLex'][_0x488d('0x6c')](this,_0x235dd4);if(_0x4eaf76){for(var _0x432335 in _0x4eaf76){if(_0x4eaf76[_0x488d('0x92')](_0x432335)&&_[_0x488d('0x93')](_0x4eaf76[_0x432335])){this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')](_0x488d('0x132'),_0x432335['toUpperCase']()),_0x4eaf76[_0x432335]);}}if(_['isNil'](_0x4eaf76[_0x488d('0x73')])){return this[_0x488d('0xf')]['noop'](_0x488d('0x133'));}else{this['createSquareMessage'](_0x4eaf76[_0x488d('0x73')],_0x488d('0xf0'),_0x488d('0x134'),'');return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x135'),_0x4eaf76['message']));}}return this[_0x488d('0xf')][_0x488d('0x4f')](_0x235dd4,_0x488d('0x136'));};AGIVertices[_0x488d('0x17')]['googleasr']=function(_0x478e65){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x137'),_0x478e65['label'],_0x478e65[_0x488d('0x66')]));if(!this[_0x488d('0x84')](_0x478e65['key'])){return this[_0x488d('0xf')][_0x488d('0xa8')]('no\x20key\x20configured');}var _0x25371b=_0x488d('0x138');var _0x5bfc37=util[_0x488d('0x2a')](_0x488d('0x139'),FILES_PATH,rs[_0x488d('0x122')](0x4));var _0x5be02f=util[_0x488d('0x2a')](_0x488d('0x9c'),_0x5bfc37,_0x25371b);var _0x468aa3=!![];if(_0x478e65['beep']===_0x488d('0x13a')){_0x468aa3=![];}var _0x2228c2=this[_0x488d('0xf')][_0x488d('0x13b')](_0x5bfc37,_0x25371b,_0x478e65[_0x488d('0x13c')],_0x478e65[_0x488d('0x66')],undefined,_0x468aa3);if(_0x2228c2[_0x488d('0xa2')]!==-0x1){this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x13d'),_0x5be02f));var _0x5b4914=this[_0x488d('0x8c')]['sync'](this,_0x478e65,_0x5be02f);if(_0x5b4914){for(var _0x2467c2 in _0x5b4914){if(_0x5b4914[_0x488d('0x92')](_0x2467c2)){this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')](_0x488d('0x13e'),_0x2467c2['toUpperCase']()),_0x5b4914[_0x2467c2]);}}return this['channel'][_0x488d('0xa8')](util['format'](_0x488d('0x13f'),JSON[_0x488d('0x70')](_0x5b4914)));}}return _0x2228c2;};AGIVertices['prototype'][_0x488d('0x140')]=function(_0x22c88d){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x141'),_0x22c88d['label']));if(!this[_0x488d('0x84')](_0x22c88d['appid'])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x142'));}if(!this[_0x488d('0x84')](_0x22c88d[_0x488d('0x90')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x143'));}var _0x49296d='wav';var _0x1df57f=util[_0x488d('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x488d('0x122')](0x4));var _0x6f4fd=util['format'](_0x488d('0x9c'),_0x1df57f,_0x49296d);var _0x1792be=!![];if(_0x22c88d[_0x488d('0x144')]===_0x488d('0x13a')){_0x1792be=![];}var _0x32824a=this['channel'][_0x488d('0x13b')](_0x1df57f,_0x49296d,_0x22c88d[_0x488d('0x13c')],_0x22c88d[_0x488d('0x66')],undefined,_0x1792be);if(_0x32824a[_0x488d('0xa2')]!==-0x1){this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')]('tilde\x20%s\x20file\x20created',_0x6f4fd));var _0x30cc2d=this[_0x488d('0x8e')][_0x488d('0x6c')](this,_0x22c88d,_0x6f4fd);if(_0x30cc2d){for(var _0x48ae2f in _0x30cc2d){if(_0x30cc2d[_0x488d('0x92')](_0x48ae2f)){this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')](_0x488d('0x145'),_0x48ae2f['toUpperCase']()),_0x30cc2d[_0x48ae2f]);}}return this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0x488d('0x70')](_0x30cc2d)));}}return _0x32824a;};AGIVertices[_0x488d('0x17')][_0x488d('0x146')]=function(_0x245955){logger[_0x488d('0x2c')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x245955['label']));return this[_0x488d('0xf')]['continueAt'](_0x245955[_0x488d('0x3c')],_0x245955[_0x488d('0x3d')],_0x245955[_0x488d('0x3e')]);};AGIVertices[_0x488d('0x17')][_0x488d('0x147')]=function(_0x2a2971){logger['info'](util[_0x488d('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2a2971[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x2a2971['condition'])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x2a2971,'no\x20condition\x20configured');}try{var _0x3ee9fe=eval(_0x2a2971[_0x488d('0x148')])?_0x488d('0x149'):_0x488d('0x14a');this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x14b'),_0x2a2971[_0x488d('0x148')],_0x3ee9fe));return{'code':0xc8,'result':_0x3ee9fe};}catch(_0x327796){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x488d('0x17')][_0x488d('0x14c')]=function(_0x40d511){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x14d'),_0x40d511['label']));if(!this[_0x488d('0x84')](_0x40d511['interval_id'])){return this['channel'][_0x488d('0x4f')](_0x40d511,_0x488d('0x14e'));}var _0x383c72=this[_0x488d('0x24')]['sync'](this,_0x40d511[_0x488d('0x14f')]);if(!_0x383c72){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x40d511,_0x488d('0x150'));}for(var _0x38fc5c=0x0;_0x38fc5c<_0x383c72[_0x488d('0x99')];_0x38fc5c+=0x1){var _0x141f2a=this[_0x488d('0xf')][_0x488d('0x11')](util[_0x488d('0x2a')](_0x488d('0x151'),_0x383c72[_0x38fc5c]));if(_0x141f2a[_0x488d('0xa2')]===-0x1){return _0x141f2a;}logger[_0x488d('0x2c')](util[_0x488d('0x2a')]('IFTIME\x20%s\x20%s',_0x383c72[_0x38fc5c],_0x141f2a['extra']));if(_0x141f2a[_0x488d('0xa0')]===_0x488d('0x149')){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x152'),_0x383c72[_0x38fc5c],'true'));this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')]('IFTIME\x20%s\x20%s',_0x383c72[_0x38fc5c],_0x488d('0x149')));return{'code':0xc8,'result':_0x488d('0x149')};}else{logger['info'](util[_0x488d('0x2a')](_0x488d('0x152'),_0x383c72[_0x38fc5c],_0x488d('0x14a')));this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x152'),_0x383c72[_0x38fc5c],_0x488d('0x14a')));}}return{'code':0xc8,'result':_0x488d('0x14a')};};AGIVertices[_0x488d('0x17')][_0x488d('0x153')]=function(_0x2ccff7){logger['info'](util['format'](_0x488d('0x154'),_0x2ccff7[_0x488d('0x37')]));return this['channel'][_0x488d('0x153')]();};AGIVertices[_0x488d('0x17')]['ispeechasr']=function(_0x1492d6){logger[_0x488d('0x2c')](util[_0x488d('0x2a')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1492d6[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x1492d6[_0x488d('0x77')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xeb'));}var _0x15d36a='wav';var _0xd8b7d4=util[_0x488d('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x488d('0x122')](0x4));var _0x201168=util[_0x488d('0x2a')](_0x488d('0x9c'),_0xd8b7d4,_0x15d36a);var _0x49f82c=!![];if(_0x1492d6[_0x488d('0x144')]===_0x488d('0x13a')){_0x49f82c=![];}var _0xd52bcf=this[_0x488d('0xf')][_0x488d('0x13b')](_0xd8b7d4,_0x15d36a,_0x1492d6[_0x488d('0x13c')],_0x1492d6['timeout'],undefined,_0x49f82c);if(_0xd52bcf[_0x488d('0xa2')]!==-0x1){this[_0x488d('0xf')][_0x488d('0xa8')](util['format'](_0x488d('0x155'),_0x201168));var _0x1b6e67=this[_0x488d('0x82')][_0x488d('0x6c')](this,_0x1492d6,_0x201168);if(_0x1b6e67){for(var _0x3d3260 in _0x1b6e67){if(_0x1b6e67[_0x488d('0x92')](_0x3d3260)){this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')](_0x488d('0x156'),_0x3d3260[_0x488d('0xee')]()),_0x1b6e67[_0x3d3260]);}}return this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')](_0x488d('0x157'),JSON[_0x488d('0x70')](_0x1b6e67)));}}return _0xd52bcf;};AGIVertices[_0x488d('0x17')][_0x488d('0x158')]=function(_0x2dcb24){logger['info'](util['format'](_0x488d('0x159'),_0x2dcb24[_0x488d('0x37')]));if(!this['isConfigured'](_0x2dcb24[_0x488d('0x77')])){return this['channel'][_0x488d('0xa8')]('no\x20key\x20configured');}if(!this[_0x488d('0x84')](_0x2dcb24[_0x488d('0x5c')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xa9'));}this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x15a'),_0x2dcb24[_0x488d('0x5c')]));var _0x483cc1=this[_0x488d('0x7f')][_0x488d('0x6c')](this,_0x2dcb24);if(_0x483cc1){this[_0x488d('0xf')][_0x488d('0xa8')](util['format'](_0x488d('0x155'),_0x483cc1));var _0x4aa248=this[_0x488d('0xf')][_0x488d('0x107')](_0x483cc1,_0x2dcb24['intKey']);try{fs['unlink'](_0x483cc1+'.wav');}catch(_0x2fdc7d){logger[_0x488d('0x4f')](_0x2fdc7d);}return _0x4aa248;}return this[_0x488d('0xf')]['error'](_0x2dcb24,_0x488d('0x15b'));};AGIVertices['prototype'][_0x488d('0x15c')]=function(_0x4cdad4){logger[_0x488d('0x2c')](util[_0x488d('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4cdad4['label']));if(!this[_0x488d('0x84')](_0x4cdad4[_0x488d('0x15d')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x4cdad4,_0x488d('0x15e'));}logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x15f'),this[_0x488d('0xf')][_0x488d('0x39')],_0x4cdad4[_0x488d('0x15d')]));var _0x520ce4=this[_0x488d('0x52')]['sync'](this,_0x4cdad4[_0x488d('0x15d')]);if(_0x520ce4){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x160'),this['channel'][_0x488d('0x39')],_0x4cdad4['findBy']));this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x160'),this[_0x488d('0xf')][_0x488d('0x39')],_0x4cdad4['findBy']));return{'code':0xc8,'result':_0x488d('0x161')};}else{logger['info'](util['format'](_0x488d('0x162'),this[_0x488d('0xf')][_0x488d('0x39')],_0x4cdad4['findBy']));this[_0x488d('0xf')][_0x488d('0xa8')](util['format'](_0x488d('0x162'),this['channel'][_0x488d('0x39')],_0x4cdad4[_0x488d('0x15d')]));return{'code':0xc8,'result':_0x488d('0x163')};}};AGIVertices[_0x488d('0x17')][_0x488d('0x164')]=function(_0x5e85db){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x165'),_0x5e85db[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x5e85db[_0x488d('0x15d')])){return this[_0x488d('0xf')]['error'](_0x5e85db,_0x488d('0x15e'));}logger[_0x488d('0x2c')](util[_0x488d('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x488d('0xf')]['callerid'],_0x5e85db[_0x488d('0x15d')]));var _0x288559=this[_0x488d('0x51')][_0x488d('0x6c')](this,_0x5e85db[_0x488d('0x15d')]);if(_0x288559){logger[_0x488d('0x2c')](util['format'](_0x488d('0x160'),this['channel'][_0x488d('0x39')],_0x5e85db[_0x488d('0x15d')]));this[_0x488d('0xf')]['noop'](util[_0x488d('0x2a')](_0x488d('0x160'),this[_0x488d('0xf')][_0x488d('0x39')],_0x5e85db['findBy']));return{'code':0xc8,'result':_0x488d('0x161')};}else{logger['info'](util['format'](_0x488d('0x162'),this['channel']['callerid'],_0x5e85db[_0x488d('0x15d')]));this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x162'),this[_0x488d('0xf')][_0x488d('0x39')],_0x5e85db['findBy']));return{'code':0xc8,'result':_0x488d('0x163')};}};AGIVertices['prototype']['math']=function(_0x28584e){logger['info'](util['format'](_0x488d('0x166'),_0x28584e[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x28584e['operation'])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x28584e,'no\x20operation\x20configured');}this[_0x488d('0xf')][_0x488d('0xa8')](util['format'](_0x488d('0x167'),_0x28584e['operation']));var _0xb2740d=eval(_0x28584e[_0x488d('0x168')]);if(!this['isConfigured'](_0x28584e['variable_id'])){return this[_0x488d('0xf')]['noop'](_0x488d('0xdb'));}var _0x24c64e=this[_0x488d('0x11')][_0x488d('0x6c')](this,_0x28584e['variable_id']);if(!_0x24c64e){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x28584e,'no\x20variable\x20found');}if(_['isArray'](_0xb2740d)){var _0x20ebe2=this;_0xb2740d[_0x488d('0xdd')](function(_0x4cc508,_0x8002b7){_0x20ebe2[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')]('%s[%s]',_0x24c64e,_0x8002b7),_0x4cc508);});return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x169'),_0x24c64e));}else{return this[_0x488d('0xf')][_0x488d('0x9d')](_0x24c64e,_0xb2740d);}};AGIVertices[_0x488d('0x17')]['menu']=function(_0x3216b6){logger['info'](util[_0x488d('0x2a')](_0x488d('0x16a'),_0x3216b6[_0x488d('0x37')]));if(_0x3216b6['retry']===0x0){return this[_0x488d('0xa4')](_0x3216b6);}_0x3216b6[_0x488d('0xa5')]-=0x1;if(!this[_0x488d('0x84')](_0x3216b6[_0x488d('0x11a')])){return this['channel'][_0x488d('0x4f')](_0x3216b6,_0x488d('0x11b'));}var _0x1f981c=this['getSound'][_0x488d('0x6c')](this,_0x3216b6[_0x488d('0x11a')]);if(!_0x1f981c){return this[_0x488d('0xf')]['error'](_0x3216b6,'no\x20file\x20audio\x20found');}var _0x1d2727=this[_0x488d('0xf')][_0x488d('0x11c')](_0x1f981c,_0x3216b6[_0x488d('0x16b')],_0x3216b6[_0x488d('0x16c')]);var _0x58764a=_0x1d2727[_0x488d('0xa2')];if(_0x1d2727[_0x488d('0xa2')]===-0x1){this[_0x488d('0x35')][_0x488d('0x6c')](this,_0x3216b6,'-1');return _0x1d2727;}else if(_0x1d2727[_0x488d('0xa0')]===_0x488d('0x66')){_0x1d2727[_0x488d('0xa2')]=_0x1d2727['result']['length']>0x0?_0x1d2727[_0x488d('0xa2')]:'t';}else if(_[_0x488d('0x42')](_0x1d2727[_0x488d('0xa2')])){_0x1d2727[_0x488d('0xa2')]='#';_0x58764a='#';}if(!this[_0x488d('0x84')](_0x3216b6[_0x488d('0xda')])){this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xdb'));}else{var _0x3fb315=this[_0x488d('0x11')]['sync'](this,_0x3216b6['variable_id']);if(!_0x3fb315){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x3216b6,_0x488d('0xdc'));}this[_0x488d('0xf')][_0x488d('0x9d')](_0x3fb315,_0x58764a);}this[_0x488d('0x35')]['sync'](this,_0x3216b6,_0x58764a);return _0x1d2727;};AGIVertices[_0x488d('0x17')][_0x488d('0xa8')]=function(_0x21f333){logger['info'](util[_0x488d('0x2a')](_0x488d('0x16d'),_0x21f333[_0x488d('0x37')]));return this[_0x488d('0xf')][_0x488d('0xa8')](_0x21f333[_0x488d('0x16e')]||_0x21f333[_0x488d('0x37')]);};AGIVertices[_0x488d('0x17')][_0x488d('0x16f')]=function(_0x5008e9){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x170'),_0x5008e9[_0x488d('0x37')]));if(!this['isConfigured'](_0x5008e9[_0x488d('0x15d')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x5008e9,_0x488d('0x15e'));}logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x15f'),this[_0x488d('0xf')][_0x488d('0x39')],_0x5008e9['findBy']));var _0x2ebccb=this['getPause']['sync'](this,_0x5008e9['pause_id']);var _0x4c7539=this[_0x488d('0x4d')][_0x488d('0x6c')](this,_0x5008e9[_0x488d('0x15d')],_0x2ebccb);if(_0x4c7539){logger[_0x488d('0x2c')](util['format'](_0x488d('0x160'),this[_0x488d('0xf')][_0x488d('0x39')],_0x5008e9['findBy']));this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x160'),this[_0x488d('0xf')][_0x488d('0x39')],_0x5008e9[_0x488d('0x15d')]));return{'code':0xc8,'result':_0x488d('0x161')};}else{logger[_0x488d('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x488d('0x39')],_0x5008e9[_0x488d('0x15d')]));this[_0x488d('0xf')][_0x488d('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x488d('0xf')][_0x488d('0x39')],_0x5008e9[_0x488d('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x488d('0x17')][_0x488d('0x171')]=function(_0x40ada1){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x172'),_0x40ada1[_0x488d('0x37')]));if(!this['isConfigured'](_0x40ada1['file_id'])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x40ada1,'no\x20file\x20audio\x20selected');}var _0x5e7ba1=this[_0x488d('0x1e')][_0x488d('0x6c')](this,_0x40ada1[_0x488d('0x11a')]);if(!_0x5e7ba1){return this[_0x488d('0xf')]['error'](_0x40ada1,_0x488d('0x173'));}var _0x5d77c5=this['channel'][_0x488d('0x56')](_0x488d('0x174'),[_0x5e7ba1,_0x40ada1['opts']]);if(_0x5d77c5[_0x488d('0xa2')]===-0x1){return _0x5d77c5;}return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xc2'),_0x488d('0x174'),_0x5e7ba1));};AGIVertices[_0x488d('0x17')][_0x488d('0x175')]=function(_0x3a6091){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x176'),_0x3a6091[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x3a6091['queue_id'])){return this['channel']['error'](_0x3a6091,_0x488d('0x177'));}var _0x13d3cb='';var _0x44b266=parseInt(_0x3a6091['queue_id'],0xa);if(isNaN(_0x44b266)){_0x13d3cb=_0x3a6091['queue_id'];}else{_0x13d3cb=this[_0x488d('0x15')][_0x488d('0x6c')](this,_0x3a6091[_0x488d('0x178')]);if(!_0x13d3cb){return this['channel']['error'](_0x3a6091,_0x488d('0x179'));}}var _0x28d359='';if(this['isConfigured'](_0x3a6091[_0x488d('0x11a')])){var _0x47cd98=this[_0x488d('0x1e')][_0x488d('0x6c')](this,_0x3a6091[_0x488d('0x11a')]);if(_0x47cd98){_0x28d359=_0x47cd98;}}this[_0x488d('0x35')]['sync'](this,_0x3a6091,_0x13d3cb);if(_0x3a6091[_0x488d('0xe9')]['indexOf']('x')<0x0){_0x3a6091[_0x488d('0xe9')]+='x';}if(_0x3a6091[_0x488d('0xe9')][_0x488d('0x17a')]('X')<0x0){_0x3a6091[_0x488d('0xe9')]+='X';}this[_0x488d('0xf')][_0x488d('0x9d')](_0x488d('0x17b'),_0x13d3cb?_0x13d3cb[_0x488d('0x17c')]():'');var _0x393378=this[_0x488d('0xf')][_0x488d('0x56')](_0x488d('0x17d'),[_0x13d3cb,_0x3a6091[_0x488d('0xe9')],_0x3a6091[_0x488d('0x63')],_0x28d359,_0x3a6091['timeout'],_0x3a6091[_0x488d('0x8')],_0x3a6091[_0x488d('0x17e')],_0x3a6091[_0x488d('0x17f')],'',_0x3a6091[_0x488d('0x180')]]);if(_0x393378['result']===-0x1){return _0x393378;}return this['channel'][_0x488d('0xa8')](util['format'](_0x488d('0xc2'),'QUEUE',_0x13d3cb));};AGIVertices[_0x488d('0x17')][_0x488d('0x181')]=function(_0x49d75d){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x182'),_0x49d75d[_0x488d('0x37')]));var _0x4919cb=_0x49d75d['recordingFormat']||_0x488d('0x138');var _0x5137fd=util[_0x488d('0x2a')](_0x488d('0x183'),this[_0x488d('0xf')]['uniqueid'],rs['generate'](0x5));var _0x3f31ec=util['format'](_0x488d('0x184'),FILES_PATH,_0x5137fd,_0x4919cb);var _0xc8ee27=util[_0x488d('0x2a')](_0x488d('0x139'),FILES_PATH,_0x5137fd);this[_0x488d('0x3a')]['sync'](this,_0x49d75d,_0x5137fd,_0x3f31ec);this[_0x488d('0xf')][_0x488d('0x9d')]('RECORDING_SAVENAME',_0x5137fd);logger[_0x488d('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xc8ee27,_0x4919cb,_0x49d75d[_0x488d('0x185')],_0x49d75d['timeout']);return this[_0x488d('0xf')][_0x488d('0x13b')](_0xc8ee27,_0x4919cb,_0x49d75d[_0x488d('0x185')],_0x49d75d['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x5d0bdc){logger[_0x488d('0x2c')](util['format'](_0x488d('0x186'),_0x5d0bdc['label']));if(!this['isConfigured'](_0x5d0bdc[_0x488d('0x63')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x187'));}var _0x488e68=this[_0x488d('0x62')][_0x488d('0x6c')](this,_0x5d0bdc);logger['info'](util['format'](_0x488d('0x188'),util['inspect'](_0x488e68,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5d0bdc['variable_id'])){return this[_0x488d('0xf')][_0x488d('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4a442f=this['getVariable'][_0x488d('0x6c')](this,_0x5d0bdc[_0x488d('0xda')]);if(!_0x4a442f){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x5d0bdc,'no\x20variable\x20found');}this[_0x488d('0xf')]['setVariable'](util[_0x488d('0x2a')](_0x488d('0x189'),_0x4a442f),_0x488e68[_0x488d('0x71')]?_0x488e68[_0x488d('0x71')]:'200');this[_0x488d('0xf')][_0x488d('0x9d')](util[_0x488d('0x2a')](_0x488d('0x18a'),_0x4a442f),_0x488e68[_0x488d('0x72')]?_0x488e68[_0x488d('0x72')]:'OK');if(_0x488e68[_0x488d('0x6e')]){try{this[_0x488d('0x9a')](_0x488e68[_0x488d('0x6e')],_0x4a442f);}catch(_0x46c4e8){logger[_0x488d('0x4f')](util['format'](_0x488d('0x18b'),_0x4a442f));}}return this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xe1'),_0x4a442f));};AGIVertices[_0x488d('0x17')][_0x488d('0x18c')]=function(_0x34c5be){logger[_0x488d('0x2c')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x34c5be[_0x488d('0x37')]));return this[_0x488d('0xf')][_0x488d('0x18d')](_0x34c5be[_0x488d('0x18e')][_0x488d('0x58')](/\s+/g,''),_0x34c5be['escape_digits']);};AGIVertices['prototype'][_0x488d('0x18f')]=function(_0x40376f){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x190'),_0x40376f[_0x488d('0x37')]));return this[_0x488d('0xf')][_0x488d('0x191')](_0x40376f['number'][_0x488d('0x58')](/\s+/g,''),_0x40376f['escape_digits']);};AGIVertices[_0x488d('0x17')][_0x488d('0x192')]=function(_0xb1cefa){logger[_0x488d('0x2c')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0xb1cefa['label']));return this[_0x488d('0xf')][_0x488d('0x193')](_0xb1cefa['text'],_0xb1cefa[_0x488d('0x185')]);};AGIVertices[_0x488d('0x17')][_0x488d('0x194')]=function(_0x405ab5){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x195'),_0x405ab5['label']));if(!this['isConfigured'](_0x405ab5[_0x488d('0x196')])){return this[_0x488d('0xf')][_0x488d('0xa8')]('no\x20mail\x20account\x20configured');}var _0x4ca30e=this['getMailAccount'][_0x488d('0x6c')](this,_0x405ab5[_0x488d('0x196')]);if(!_0x4ca30e||!_0x4ca30e[_0x488d('0x197')]){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x405ab5,_0x488d('0x198'));}var _0x4ee517={'from':util[_0x488d('0x2a')](_0x488d('0x199'),_0x4ca30e[_0x488d('0x14')],_0x4ca30e['email']||_0x4ca30e[_0x488d('0x197')]['user']),'to':_0x405ab5['to']||'','cc':_0x405ab5['cc']||'','bcc':_0x405ab5[_0x488d('0x19a')]||'','subject':_0x405ab5[_0x488d('0x19b')],'html':_0x405ab5['text'],'text':_0x405ab5[_0x488d('0x5c')]};var _0xec0333={'tls':{'rejectUnauthorized':![]}};if(_0x4ca30e[_0x488d('0x197')]['service']){_0xec0333[_0x488d('0x19c')]=_0x4ca30e['Smtp'][_0x488d('0x19c')];}else{_0xec0333[_0x488d('0x19d')]=_0x4ca30e[_0x488d('0x197')]['host'];_0xec0333[_0x488d('0x19e')]=_0x4ca30e['Smtp'][_0x488d('0x19e')];_0xec0333[_0x488d('0x19f')]=_0x4ca30e[_0x488d('0x197')][_0x488d('0x19f')];}if(_0x4ca30e[_0x488d('0x197')][_0x488d('0x1a0')]){_0xec0333['auth']={'user':_0x4ca30e['Smtp'][_0x488d('0x1a1')],'pass':_0x4ca30e[_0x488d('0x197')][_0x488d('0x1a2')]};}if(this[_0x488d('0x84')](_0x405ab5['template_id'])){}logger['debug']('sendMail\x20message',JSON['stringify'](_0x4ee517));this['createSquareDetailsReport'][_0x488d('0x6c')](this,_0x405ab5,_0x405ab5[_0x488d('0x196')]);this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x1a3'),_0x4ca30e[_0x488d('0x14')]));this[_0x488d('0x23')][_0x488d('0x6c')](this,_0xec0333,_0x4ee517);return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x1a4'));};AGIVertices[_0x488d('0x17')][_0x488d('0x1a5')]=function(_0x499d73){logger['info'](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x499d73[_0x488d('0x37')]));return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x1a6'));};AGIVertices[_0x488d('0x17')][_0x488d('0x1a7')]=function(_0x4a867e){logger[_0x488d('0x2c')](util[_0x488d('0x2a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4a867e['label']));if(!this[_0x488d('0x84')](_0x4a867e[_0x488d('0x1a8')])){return this[_0x488d('0xf')][_0x488d('0xa8')]('no\x20sms\x20account\x20configured');}var _0x3ad15d=this['getSmsAccount'][_0x488d('0x6c')](this,_0x4a867e[_0x488d('0x1a8')]);if(!_0x3ad15d){return this['channel'][_0x488d('0x4f')](_0x4a867e,'no\x20sms\x20account\x20found');}var _0xfebc8f={'body':_0x4a867e[_0x488d('0x1a9')],'phone':_0x4a867e['to']||'','SmsAccountId':_0x3ad15d['id']};logger['debug'](_0x488d('0x1aa'),JSON[_0x488d('0x70')](_0xfebc8f));this[_0x488d('0x35')][_0x488d('0x6c')](this,_0x4a867e,_0x4a867e[_0x488d('0x1a8')]);this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x1ab'),_0x3ad15d[_0x488d('0x14')]));this[_0x488d('0x34')][_0x488d('0x6c')](this,_0xfebc8f);return this[_0x488d('0xf')][_0x488d('0xa8')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x488d('0x1ac')]=function(_0x4c9446){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x1ad'),_0x4c9446['label']));if(!this[_0x488d('0x84')](_0x4c9446[_0x488d('0xda')])){return this['channel'][_0x488d('0x4f')](_0x4c9446,_0x488d('0x1ae'));}var _0x2135e8=this[_0x488d('0x11')][_0x488d('0x6c')](this,_0x4c9446['variable_id']);if(!_0x2135e8){return this[_0x488d('0xf')]['error'](_0x4c9446,'no\x20variable\x20found');}return this[_0x488d('0xf')][_0x488d('0x9d')](_0x2135e8,_0x4c9446['variable_value']);};AGIVertices[_0x488d('0x17')][_0x488d('0x1af')]=function(_0x5eb848){logger[_0x488d('0x2c')](util['format'](_0x488d('0x1b0'),_0x5eb848[_0x488d('0x37')]));this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x1b1'));if(_0x5eb848[_0x488d('0xba')]===_0x488d('0x1b2')){this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x1b3'));return this[_0x488d('0xf')][_0x488d('0xba')]();}return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x1b4'));};AGIVertices[_0x488d('0x17')][_0x488d('0x1b5')]=function(_0x249416){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x1b6'),_0x249416[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x249416[_0x488d('0x1b7')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x249416,_0x488d('0x1b8'));}var _0x488e19=this[_0x488d('0x18')]['sync'](this,_0x249416[_0x488d('0x1b7')]);if(!this[_0x488d('0x84')](_0x488e19)){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x249416,util[_0x488d('0x2a')](_0x488d('0x1b9'),_0x249416[_0x488d('0x1b7')]));}if(_0x488e19===this['channel'][_0x488d('0x40')]){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x249416,_0x488d('0x1ba'));}this['createSquareDetailsReport'][_0x488d('0x6c')](this,_0x249416,_0x488e19);var _0x2c0806=this[_0x488d('0xf')][_0x488d('0x56')]('AGI',util[_0x488d('0x2a')](_0x488d('0x1bb'),config[_0x488d('0x8')][_0x488d('0x19d')]||'127.0.0.1',_0x488e19,this[_0x488d('0xf')][_0x488d('0x40')]));if(_0x2c0806[_0x488d('0xa2')]===-0x1){return _0x2c0806;}return this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xc2'),_0x488d('0x1bc'),_0x488e19));};AGIVertices['prototype'][_0x488d('0x1bd')]=function(_0x3678ff){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x1be'),_0x3678ff['label']));var _0x756620=this['shellCommand'][_0x488d('0x6c')](this,_0x3678ff['command']);this[_0x488d('0x35')][_0x488d('0x6c')](this,_0x3678ff,_0x3678ff[_0x488d('0x1bf')]);if(this[_0x488d('0x84')](_0x3678ff[_0x488d('0xda')])){var _0x158f99=this[_0x488d('0x11')][_0x488d('0x6c')](this,_0x3678ff['variable_id']);if(_0x158f99){this[_0x488d('0xf')][_0x488d('0x9d')](_0x158f99,_0x756620);return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x1c0'),_0x3678ff[_0x488d('0x1bf')],_0x158f99));}}return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x1c1'),_0x3678ff[_0x488d('0x1bf')]));};AGIVertices[_0x488d('0x17')][_0x488d('0x1c2')]=function(_0x2182a8){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x1c3'),_0x2182a8[_0x488d('0x37')]));_0x2182a8[_0x488d('0x5c')]=_0x2182a8[_0x488d('0x5c')][_0x488d('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2182a8['apiKey'])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0x1c4'));}if(!this['isConfigured'](_0x2182a8[_0x488d('0x5c')])){return this[_0x488d('0xf')][_0x488d('0xa8')](_0x488d('0xa9'));}this['channel'][_0x488d('0xa8')](util[_0x488d('0x2a')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2182a8[_0x488d('0x5c')]));var _0x2eeb13=this['googleCloudTTS']['sync'](this,_0x2182a8);if(_0x2eeb13){this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x1c5'),_0x2eeb13));var _0x3ddd3e=this['channel'][_0x488d('0x107')](_0x2eeb13);try{fs[_0x488d('0x108')](_0x2eeb13+_0x488d('0x109'));}catch(_0x113563){logger['error'](_0x113563);}return _0x3ddd3e;}return this['channel'][_0x488d('0x4f')](_0x2182a8,_0x488d('0x1c6'));};AGIVertices[_0x488d('0x17')][_0x488d('0x1c7')]=function(_0x55bbbe){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x1c8'),_0x55bbbe[_0x488d('0x37')]));_0x55bbbe[_0x488d('0x5c')]=_0x55bbbe[_0x488d('0x5c')][_0x488d('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x55bbbe[_0x488d('0x5c')])){return this[_0x488d('0xf')][_0x488d('0xa8')]('no\x20text\x20configured');}this[_0x488d('0xf')][_0x488d('0xa8')](util['format'](_0x488d('0x1c9'),_0x55bbbe[_0x488d('0x5c')]));var _0x2dafd7=this['googleTTS'][_0x488d('0x6c')](this,_0x55bbbe);if(_0x2dafd7){this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x2dafd7));var _0x364295=this[_0x488d('0xf')]['streamFile'](_0x2dafd7);try{fs[_0x488d('0x108')](_0x2dafd7+_0x488d('0x109'));}catch(_0x12b2db){logger[_0x488d('0x4f')](_0x12b2db);}return _0x364295;}return this[_0x488d('0xf')][_0x488d('0x4f')](_0x55bbbe,_0x488d('0x1ca'));};AGIVertices[_0x488d('0x17')][_0x488d('0x1cb')]=function(_0x31a7aa){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x1cc'),_0x31a7aa['label']));if(!this[_0x488d('0x84')](_0x31a7aa[_0x488d('0x15d')])){return this['channel']['error'](_0x31a7aa,_0x488d('0x15e'));}logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x15f'),this[_0x488d('0xf')][_0x488d('0x39')],_0x31a7aa[_0x488d('0x15d')]));var _0x1c9ca6=this[_0x488d('0x50')]['sync'](this,_0x31a7aa[_0x488d('0x15d')]);if(_0x1c9ca6){logger[_0x488d('0x2c')](util[_0x488d('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x488d('0x39')],_0x31a7aa[_0x488d('0x15d')]));this['channel'][_0x488d('0xa8')](util['format'](_0x488d('0x160'),this[_0x488d('0xf')][_0x488d('0x39')],_0x31a7aa[_0x488d('0x15d')]));return{'code':0xc8,'result':_0x488d('0x161')};}else{logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x162'),this['channel'][_0x488d('0x39')],_0x31a7aa[_0x488d('0x15d')]));this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0x162'),this[_0x488d('0xf')]['callerid'],_0x31a7aa[_0x488d('0x15d')]));return{'code':0xc8,'result':_0x488d('0x163')};}};AGIVertices[_0x488d('0x17')][_0x488d('0x1cd')]=function(_0x678d3f){logger[_0x488d('0x2c')](util[_0x488d('0x2a')](_0x488d('0x1ce'),_0x678d3f[_0x488d('0x37')]));var _0x2b2d0a=this[_0x488d('0xf')][_0x488d('0x56')]('VOICEMAIL',[_0x678d3f[_0x488d('0x1cf')],_0x678d3f['options']]);if(_0x2b2d0a[_0x488d('0xa2')]===-0x1){return _0x2b2d0a;}return this[_0x488d('0xf')][_0x488d('0xa8')](util[_0x488d('0x2a')](_0x488d('0xc2'),_0x488d('0x1d0'),_0x678d3f[_0x488d('0x1cf')]));};AGIVertices[_0x488d('0x17')][_0x488d('0x1d1')]=function(_0x390aa5){logger['info'](util[_0x488d('0x2a')](_0x488d('0x1d2'),_0x390aa5[_0x488d('0x37')]));if(!this[_0x488d('0x84')](_0x390aa5[_0x488d('0xda')])){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x390aa5,_0x488d('0x1ae'));}var _0x100ca1=this[_0x488d('0x11')][_0x488d('0x6c')](this,_0x390aa5['variable_id']);if(!_0x100ca1){return this[_0x488d('0xf')][_0x488d('0x4f')](_0x390aa5,_0x488d('0xdc'));}var _0x4be545=this[_0x488d('0xf')][_0x488d('0x11')](_0x100ca1);return{'code':0xc8,'result':_0x4be545[_0x488d('0xa0')]?_0x4be545[_0x488d('0xa0')]:'-'};};String['prototype'][_0x488d('0x9f')]=function(_0x4bbdc5,_0x25d37b){return this['split'](_0x4bbdc5)[_0x488d('0x1d3')](_0x25d37b);};module[_0x488d('0x1d4')]=AGIVertices; \ No newline at end of file +var _0xef5a=['SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','client_email','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','unlink','ispeech\x20TTS\x20is\x20unreachable','login','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','success','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','path','util','lodash','shelljs','randomstring','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','createSquareRecording','uniqueid','callerid','context','priority','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','isString','replaceObjectAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT'];(function(_0x1d293d,_0x4a3fe0){var _0x4a4ea5=function(_0x27c2ce){while(--_0x27c2ce){_0x1d293d['push'](_0x1d293d['shift']());}};_0x4a4ea5(++_0x4a3fe0);}(_0xef5a,0x102));var _0xaef5=function(_0x38cebc,_0x34c3af){_0x38cebc=_0x38cebc-0x0;var _0x5b6c90=_0xef5a[_0x38cebc];return _0x5b6c90;};'use strict';var fs=require('fs');var path=require(_0xaef5('0x0'));var util=require(_0xaef5('0x1'));var _=require(_0xaef5('0x2'));var sh=require(_0xaef5('0x3'));var odbc=require('odbc')();var rs=require(_0xaef5('0x4'));var moment=require('moment');var Mustache=require(_0xaef5('0x5'));var rp=require(_0xaef5('0x6'));var logger=require('../../config/logger')(_0xaef5('0x7'));var config=require(_0xaef5('0x8'));var scripts=require(_0xaef5('0x9'));var FILES_PATH=_0xaef5('0xa');var recursiveMapAttributes=[_0xaef5('0xb'),_0xaef5('0xc')];var verticesWithRetry=[_0xaef5('0xd'),'getdigits',_0xaef5('0xe')];var AGIVertices=function(_0x44c16b,_0x16d881,_0x204d47){this[_0xaef5('0xf')]=_0x44c16b;this[_0xaef5('0x10')]=_0x16d881;this[_0xaef5('0x11')]=_0x204d47;};AGIVertices[_0xaef5('0x12')][_0xaef5('0x13')]=function(_0x51459c,_0x3ca3b5){this[_0xaef5('0x10')][_0xaef5('0x14')](_0x51459c)[_0xaef5('0x15')](function(_0x26e0db){_0x3ca3b5(null,_0x26e0db?_0x26e0db[_0xaef5('0x16')]:![]);})[_0xaef5('0x17')](function(_0x4e6d45){_0x3ca3b5(_0x4e6d45);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x18')]=function(_0x2c739c,_0x1e0b22){this[_0xaef5('0x10')][_0xaef5('0x19')](_0x2c739c)[_0xaef5('0x15')](function(_0x13fc69){_0x1e0b22(null,_0x13fc69?_0x13fc69[_0xaef5('0x16')]:![]);})[_0xaef5('0x17')](function(_0x3fa5b7){_0x1e0b22(_0x3fa5b7);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1a')]=function(_0x1832c2,_0x414872){this['rpc'][_0xaef5('0x1b')](_0x1832c2)['then'](function(_0x11eeb8){_0x414872(null,_0x11eeb8?_0x11eeb8[_0xaef5('0x16')]:![]);})[_0xaef5('0x17')](function(_0x3c981d){_0x414872(_0x3c981d);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1c')]=function(_0x51ef00,_0x41bcb0){this[_0xaef5('0x10')]['getSquareOdbcById'](_0x51ef00)[_0xaef5('0x15')](function(_0x1ed56c){_0x41bcb0(null,_0x1ed56c?_0x1ed56c[_0xaef5('0x1d')]:![]);})['catch'](function(_0xd29c4d){_0x41bcb0(_0xd29c4d);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1e')]=function(_0x2026d9,_0x127b06){this[_0xaef5('0x10')]['getUserById'](_0x2026d9)[_0xaef5('0x15')](function(_0x542d0b){_0x127b06(null,_0x542d0b?_0x542d0b['name']:![]);})[_0xaef5('0x17')](function(_0x1e913f){_0x127b06(_0x1e913f);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1f')]=function(_0x270051,_0x174811){this[_0xaef5('0x10')][_0xaef5('0x20')](_0x270051)[_0xaef5('0x15')](function(_0x27eda6){_0x174811(null,_0x27eda6?_0x27eda6[_0xaef5('0x16')]:![]);})['catch'](function(_0x14d22b){_0x174811(_0x14d22b);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x21')]=function(_0x57a87a,_0x161de7){var _0x12b749=this;this[_0xaef5('0x10')][_0xaef5('0x22')](_0x57a87a)[_0xaef5('0x15')](function(_0x8770a3){_0x161de7(null,_0x8770a3?_0x12b749[_0xaef5('0x23')](_0x8770a3[_0xaef5('0x24')]):![]);})[_0xaef5('0x17')](function(_0x1c1dd1){_0x161de7(_0x1c1dd1);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x25')]=function(_0x2b5364,_0x4e444f){this['rpc']['getMailAccountById'](_0x2b5364)[_0xaef5('0x15')](function(_0x1d3bea){_0x4e444f(null,_0x1d3bea?_0x1d3bea:![]);})[_0xaef5('0x17')](function(_0x21c47a){_0x4e444f(_0x21c47a);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x26')]=function(_0x413b90,_0x30e3ee,_0x1eaee4){this[_0xaef5('0x11')]['sendMailMessage'](_0x413b90,_0x30e3ee)[_0xaef5('0x15')](function(){_0x1eaee4(null);})[_0xaef5('0x17')](function(_0x1f1efd){_0x1eaee4(_0x1f1efd);});};AGIVertices['prototype'][_0xaef5('0x27')]=function(_0x4577a4,_0x4ac1e6){this[_0xaef5('0x10')]['getIntervalById'](_0x4577a4)[_0xaef5('0x15')](function(_0x1f7378){if(_0x1f7378){if(_0x1f7378[_0xaef5('0x28')]){_0x4ac1e6(null,[_0x1f7378['interval']]);}else{_0x4ac1e6(null,_[_0xaef5('0x29')](_0x1f7378[_0xaef5('0x2a')],_0xaef5('0x2b')));}}else{_0x4ac1e6(null,![]);}})[_0xaef5('0x17')](function(_0xba9da2){_0x4ac1e6(_0xba9da2);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x23')]=function(_0x48666a){return util[_0xaef5('0x2c')](_0xaef5('0x2d'),FILES_PATH,_0x48666a);};AGIVertices[_0xaef5('0x12')][_0xaef5('0x2e')]=function(_0x44d8c6,_0x80a606,_0x342889){odbc[_0xaef5('0x2f')](_0x44d8c6,function(_0x47b0b9){if(_0x47b0b9){logger[_0xaef5('0x30')](_0xaef5('0x31'),_0x47b0b9);_0x342889(_0x47b0b9);}else{logger[_0xaef5('0x32')]('ODBC\x20connection\x20successfully');odbc[_0xaef5('0x33')](_0x80a606,function(_0x19ed92,_0x4bd15b){if(_0x19ed92){logger[_0xaef5('0x32')](_0xaef5('0x34'),_0x80a606);_0x342889(_0x19ed92);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x80a606);odbc[_0xaef5('0x35')](function(_0x57677a){if(_0x57677a){logger[_0xaef5('0x30')](_0xaef5('0x36'),_0x57677a);}_0x342889(null,_0x4bd15b);});}});}});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x37')]=function(_0x5458bc,_0x228c45){this[_0xaef5('0x10')][_0xaef5('0x38')](_0x5458bc)[_0xaef5('0x15')](function(_0x2afc52){_0x228c45(null,_0x2afc52?_0x2afc52:![]);})[_0xaef5('0x17')](function(_0x220133){_0x228c45(_0x220133);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x39')]=function(_0x452c6d,_0x5b7f9b){this['rpc'][_0xaef5('0x39')](_0x452c6d)[_0xaef5('0x15')](function(_0x2eabeb){_0x5b7f9b(null,_0x2eabeb);})[_0xaef5('0x17')](function(_0x5f12a3){_0x5b7f9b(_0x5f12a3);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x3a')]=function(_0x57d4aa,_0x348cb0,_0x459fbf){this[_0xaef5('0x10')][_0xaef5('0x3a')]({'uniqueid':this['channel']['uniqueid'],'node':_0x57d4aa[_0xaef5('0x3b')],'application':_0x57d4aa['agicommand'],'data':_0x348cb0||null,'project_name':this[_0xaef5('0xf')]['arg_1'],'callerid':this[_0xaef5('0xf')]['callerid']})[_0xaef5('0x15')](function(_0x4e1c03){if(_0x459fbf){_0x459fbf(null,_0x4e1c03);}})[_0xaef5('0x17')](function(_0x1b854b){if(_0x459fbf){_0x459fbf(_0x1b854b);}});};AGIVertices['prototype'][_0xaef5('0x3c')]=function(_0x1a3df0,_0x89d7b2,_0x2426b2,_0x4c7527){this[_0xaef5('0x10')][_0xaef5('0x3c')]({'uniqueid':this['channel'][_0xaef5('0x3d')],'callerid':this['channel'][_0xaef5('0x3e')],'calleridname':this[_0xaef5('0xf')]['calleridname'],'context':this[_0xaef5('0xf')][_0xaef5('0x3f')],'extension':this[_0xaef5('0xf')]['extension'],'priority':this[_0xaef5('0xf')][_0xaef5('0x40')],'accountcode':this[_0xaef5('0xf')]['accountcode'],'dnid':this['channel'][_0xaef5('0x41')],'projectName':this[_0xaef5('0xf')][_0xaef5('0x42')],'saveName':_0x89d7b2,'filename':_0x1a3df0[_0xaef5('0x43')]||_0x89d7b2,'savePath':_0x2426b2})[_0xaef5('0x15')](function(_0x5dcb1a){_0x4c7527(null,_0x5dcb1a);})[_0xaef5('0x17')](function(_0x491598){_0x4c7527(_0x491598);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x44')]=function(_0x108f76,_0x8f4fcf,_0x4f65f9,_0x150f6f,_0x48994d){this[_0xaef5('0x10')][_0xaef5('0x44')]({'uniqueid':this['channel'][_0xaef5('0x3d')],'body':_0x108f76,'direction':_0x8f4fcf,'providerName':_0x4f65f9,'providerResponse':_0x150f6f})[_0xaef5('0x15')](function(_0x557955){if(_0x48994d){_0x48994d(null,_0x557955);}})['catch'](function(_0x312384){if(_0x48994d){_0x48994d(_0x312384);}});};AGIVertices[_0xaef5('0x12')]['createCmContact']=function(_0x55062a,_0x1a068b){this[_0xaef5('0x10')][_0xaef5('0x45')]({'firstName':_['isEmpty'](_0x55062a['name'])||_[_0xaef5('0x46')](_0x55062a['name'])?_0xaef5('0x47')+Math[_0xaef5('0x48')]():_0x55062a[_0xaef5('0x16')],'lastName':_[_0xaef5('0x49')](_0x55062a[_0xaef5('0x4a')])||_['isNil'](_0x55062a[_0xaef5('0x4a')])?null:_0x55062a[_0xaef5('0x4a')],'phone':_0x55062a[_0xaef5('0x4b')],'ListId':_0x55062a['list_id'],'scheduledat':_0x55062a[_0xaef5('0x4c')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xaef5('0x4d'),'description':_0xaef5('0x4e')+_0x55062a[_0xaef5('0x4c')][_0xaef5('0x4f')](),'priority':_0x55062a[_0xaef5('0x50')]})['then'](function(_0x4f6bab){_0x1a068b(null,_0x4f6bab);})[_0xaef5('0x17')](function(_0x235585){_0x1a068b(_0x235585);});};AGIVertices[_0xaef5('0x12')]['getPause']=function(_0x4c80e7,_0xed89e3){this[_0xaef5('0x10')][_0xaef5('0x51')](_0x4c80e7)[_0xaef5('0x15')](function(_0x22a64c){_0xed89e3(null,_0x22a64c?_0x22a64c['name']:![]);})[_0xaef5('0x17')](function(_0x548cfb){_0xed89e3(_0x548cfb);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x52')]=function(_0x2771d8,_0x164022,_0x4380c5){var _0x292d79={'role':'agent'};_0x292d79[_0x2771d8]=this['channel']['callerid'];this['rpc'][_0xaef5('0x52')](_0x292d79,_0x164022,this[_0xaef5('0xf')]['uniqueid'])[_0xaef5('0x15')](function(_0x5c5775){_0x4380c5(null,_[_0xaef5('0x46')](_0x5c5775)?![]:!![]);})[_0xaef5('0x17')](function(_0x70604f){logger[_0xaef5('0x30')](_0x70604f);_0x4380c5(null,![]);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x53')]=function(_0x3eae49,_0x3ffb8a){var _0x468e73={'role':_0xaef5('0x54')};_0x468e73[_0x3eae49]=this[_0xaef5('0xf')][_0xaef5('0x3e')];this[_0xaef5('0x10')][_0xaef5('0x53')](_0x468e73)[_0xaef5('0x15')](function(_0xb084e){_0x3ffb8a(null,_['isNil'](_0xb084e)?![]:!![]);})[_0xaef5('0x17')](function(_0x47b290){logger[_0xaef5('0x30')](_0x47b290);_0x3ffb8a(null,![]);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x55')]=function(_0x597431,_0x257093){var _0x36e391={'role':_0xaef5('0x54')};_0x36e391[_0x597431]=this['channel'][_0xaef5('0x3e')];this[_0xaef5('0x10')][_0xaef5('0x55')](_0x36e391)['then'](function(_0x4a4d64){_0x257093(null,_[_0xaef5('0x46')](_0x4a4d64)?![]:!![]);})['catch'](function(_0x37bcd6){logger[_0xaef5('0x30')](_0x37bcd6);_0x257093(null,![]);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x56')]=function(_0xb0f76,_0x28fa0b){var _0x176e92={'role':_0xaef5('0x54')};_0x176e92[_0xb0f76]=this[_0xaef5('0xf')]['callerid'];var _0x5bc0b0=_0xb0f76!=_0xaef5('0x57')?util['format'](_0xaef5('0x58'),_0xaef5('0x59'),this[_0xaef5('0xf')]['callerid']):undefined;this[_0xaef5('0x10')]['agentLogin'](_0x176e92,_0x5bc0b0)[_0xaef5('0x15')](function(_0x2a2d97){_0x28fa0b(null,_[_0xaef5('0x46')](_0x2a2d97)?![]:!![]);})[_0xaef5('0x17')](function(_0x7e6e6e){logger['error'](_0x7e6e6e);_0x28fa0b(null,![]);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x5a')]=function(_0x21143c,_0x581895){sh[_0xaef5('0x5b')](_['trim'](_0x21143c),function(_0x2bb8c8,_0x4592c1){var _0x2ccc91=_0x4592c1[_0xaef5('0x5c')](/(\r\n|\n|\r)/gm,'');_0x581895(null,_0x2ccc91);});};AGIVertices[_0xaef5('0x12')]['googleCloudTTS']=function(_0x53bcba,_0xf7d380){scripts[_0xaef5('0x5d')](_0x53bcba[_0xaef5('0x5e')],_0x53bcba[_0xaef5('0x5f')]||_0xaef5('0x60'),_0x53bcba['text'],_0x53bcba[_0xaef5('0x61')]||_0xaef5('0x62'),_0x53bcba[_0xaef5('0x63')]||_0xaef5('0x64'),_0x53bcba[_0xaef5('0x65')]||_0xaef5('0x66'))['then'](function(_0x2c6d29){_0xf7d380(null,_0x2c6d29);})['catch'](function(_0x29b704){_0xf7d380(_0x29b704);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x67')]=function(_0x74c42b,_0x40c1db){scripts['googleTTS'](_0x74c42b[_0xaef5('0x60')],_0x74c42b[_0xaef5('0x68')]||'en',0x1)[_0xaef5('0x15')](function(_0x373e3d){_0x40c1db(null,_0x373e3d);})[_0xaef5('0x17')](function(_0x50689d){_0x40c1db(_0x50689d);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x69')]=function(_0x1e4fb9,_0x587d3d){var _0x7a9db4={'uri':_0x1e4fb9[_0xaef5('0x6a')],'method':_0x1e4fb9[_0xaef5('0x6b')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1e4fb9[_0xaef5('0x6c')])===_0xaef5('0x6d')&&parseInt(_0x1e4fb9[_0xaef5('0x6c')])>=0x1?parseInt(_0x1e4fb9[_0xaef5('0x6c')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xaef5('0x6e'),'PUT'],_0x7a9db4[_0xaef5('0x6b')][_0xaef5('0x6f')]())){try{_0x7a9db4['body']=_0x1e4fb9[_0xaef5('0xc')]?JSON[_0xaef5('0x70')](_0x1e4fb9[_0xaef5('0xc')]):{};}catch(_0x496062){logger[_0xaef5('0x30')](_0xaef5('0x71'),_0x496062);}}try{_0x7a9db4[_0xaef5('0x72')]=_0x1e4fb9['rawHeaders']?JSON[_0xaef5('0x70')](_0x1e4fb9['rawHeaders']):{};}catch(_0x297fae){logger[_0xaef5('0x30')](_0xaef5('0x73'),_0x297fae);}if(_0x1e4fb9['computedVariables']){try{var _0x40a0cd=require(_0x1e4fb9[_0xaef5('0x74')])[_0xaef5('0x75')](this,_0x7a9db4);_0x7a9db4['uri']=Mustache[_0xaef5('0x76')](_0x1e4fb9[_0xaef5('0x6a')],_0x40a0cd,{},['$$','$$']);if(_0x7a9db4[_0xaef5('0x72')]){_0x7a9db4['headers']=JSON[_0xaef5('0x70')](Mustache[_0xaef5('0x76')](JSON[_0xaef5('0x77')](_0x7a9db4['headers']),_0x40a0cd,{},['$$','$$']));}if(_0x7a9db4[_0xaef5('0x78')]){_0x7a9db4['body']=JSON[_0xaef5('0x70')](Mustache[_0xaef5('0x76')](JSON[_0xaef5('0x77')](_0x7a9db4[_0xaef5('0x78')]),_0x40a0cd,{},['$$','$$']));}}catch(_0x4f6699){logger[_0xaef5('0x30')](_0xaef5('0x79'),_0x4f6699);}}rp(_0x7a9db4)['then'](function(_0x373a6f){var _0x2e12cb={'statusCode':_0x373a6f[_0xaef5('0x7a')]||0xc8,'statusMessage':_0x373a6f[_0xaef5('0x7b')]||'OK','headers':_0x373a6f[_0xaef5('0x72')]||{},'body':_0x373a6f['body']||{}};_0x587d3d(null,_0x2e12cb);})['catch'](function(_0x1b701b){var _0x5ab537={'statusCode':_0x1b701b[_0xaef5('0x7a')]||0x1f4,'statusMessage':_0x1b701b[_0xaef5('0x7c')]||_0xaef5('0x7d'),'headers':_0x1b701b[_0xaef5('0x7e')]['headers']||{},'body':_0x1b701b[_0xaef5('0x7e')][_0xaef5('0x78')]||{}};_0x587d3d(null,_0x5ab537);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x7f')]=function(_0x3cf7b8,_0xc8fff0){scripts['googleDialogflow'](this[_0xaef5('0xf')][_0xaef5('0x3d')],_0x3cf7b8[_0xaef5('0x80')],_0x3cf7b8[_0xaef5('0x60')],_0x3cf7b8['dialogflow_language']||'en')[_0xaef5('0x15')](function(_0x44c343){_0xc8fff0(null,_0x44c343);})[_0xaef5('0x17')](function(_0x188d18){_0xc8fff0(_0x188d18);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x81')]=function(_0x77be3a,_0x55c507){scripts['googleDialogflowV2'](this[_0xaef5('0xf')]['uniqueid'],_0x77be3a['dialogflowV2_project_id'],_0x77be3a['client_email'],_0x77be3a[_0xaef5('0x82')],_0x77be3a[_0xaef5('0x60')],_0x77be3a[_0xaef5('0x83')]||'en')['then'](function(_0x36599c){_0x55c507(null,_0x36599c);})['catch'](function(_0x3e133a){_0x55c507(_0x3e133a);});};AGIVertices['prototype'][_0xaef5('0x84')]=function(_0x17f262,_0x5dc7f5){scripts['sestekNDA'](this[_0xaef5('0xf')],_0x17f262)[_0xaef5('0x15')](function(_0x5a9ed9){_0x5dc7f5(null,_0x5a9ed9);})[_0xaef5('0x17')](function(_0x5b659a){_0x5dc7f5(_0x5b659a);});};AGIVertices['prototype'][_0xaef5('0x85')]=function(_0x44b824,_0xc9a637){scripts['ispeechTTS'](_0x44b824[_0xaef5('0x80')],_0x44b824['text'],_0x44b824[_0xaef5('0x86')]||'en-US',_0x44b824[_0xaef5('0x87')])[_0xaef5('0x15')](function(_0x65db9f){_0xc9a637(null,_0x65db9f);})[_0xaef5('0x17')](function(_0x19771c){_0xc9a637(_0x19771c);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x88')]=function(_0xb5cd7a,_0x95ddb5,_0x2807a8){scripts['ispeechASR'](_0x95ddb5,_0xb5cd7a[_0xaef5('0x80')],_0xb5cd7a[_0xaef5('0x89')]||_0xaef5('0x62'),this[_0xaef5('0x8a')](_0xb5cd7a['model'])?_0xb5cd7a[_0xaef5('0x8b')]:undefined)[_0xaef5('0x15')](function(_0x2cb9a0){_0x2807a8(null,_0x2cb9a0);})[_0xaef5('0x17')](function(_0x1c97ba){_0x2807a8(_0x1c97ba);});};AGIVertices['prototype']['awsPolly']=function(_0x104ee8,_0x807c78){scripts[_0xaef5('0x8c')](_0x104ee8[_0xaef5('0x8d')],_0x104ee8['aws_secret_access_key'],_0x104ee8[_0xaef5('0x8e')],_0x104ee8[_0xaef5('0x8f')]||_0xaef5('0x90'),_0x104ee8['text'],_0x104ee8[_0xaef5('0x91')]||_0xaef5('0x60'))[_0xaef5('0x15')](function(_0x4078cc){_0x807c78(null,_0x4078cc);})[_0xaef5('0x17')](function(_0x341f8a){_0x807c78(_0x341f8a);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x92')]=function(_0x3fef57,_0xe671c7){scripts[_0xaef5('0x92')](this[_0xaef5('0xf')][_0xaef5('0x3d')],_0x3fef57[_0xaef5('0x8d')],_0x3fef57[_0xaef5('0x93')],_0x3fef57[_0xaef5('0x94')],_0x3fef57[_0xaef5('0x60')],_0x3fef57[_0xaef5('0x95')])[_0xaef5('0x15')](function(_0x4fff75){_0xe671c7(null,_0x4fff75);})[_0xaef5('0x17')](function(_0x3a7fbe){_0xe671c7(_0x3a7fbe);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x96')]=function(_0x3ea59a,_0x363e20,_0x3b3dc8){scripts['googleASR'](_0x363e20,_0x3ea59a[_0xaef5('0x80')],_0x3ea59a[_0xaef5('0x97')]||'en-US')['then'](function(_0x5213ab){_0x3b3dc8(null,_0x5213ab);})[_0xaef5('0x17')](function(_0x26c2da){_0x3b3dc8(_0x26c2da);});};AGIVertices['prototype'][_0xaef5('0x98')]=function(_0x210497,_0x3cc4c5,_0x35eba2){scripts[_0xaef5('0x98')](_0x3cc4c5,_0x210497[_0xaef5('0x99')],_0x210497[_0xaef5('0x9a')],_0x210497['uri'])[_0xaef5('0x15')](function(_0x2cdf5e){_0x35eba2(null,_0x2cdf5e);})[_0xaef5('0x17')](function(_0x2ddd0d){_0x35eba2(_0x2ddd0d);});};AGIVertices[_0xaef5('0x12')][_0xaef5('0x9b')]=function(_0x54a572){var _0x2122b7=_[_0xaef5('0x9c')](verticesWithRetry,_0x54a572['agicommand'])?_0x54a572:_[_0xaef5('0x9d')](_0x54a572);for(var _0x41824e in _0x2122b7){if(_0x2122b7['hasOwnProperty'](_0x41824e)){if(_0x2122b7[_0x41824e]&&_[_0xaef5('0x9e')](_0x2122b7[_0x41824e])){if(_['includes'](recursiveMapAttributes,_0x41824e)){_0x2122b7[_0x41824e]=this[_0xaef5('0x9f')](_0x2122b7[_0x41824e]);}else{_0x2122b7[_0x41824e]=this['replaceAllVariables'](_0x2122b7[_0x41824e]);}}}}return _0x2122b7;};AGIVertices[_0xaef5('0x12')]['recursiveNodeIndex']=function(_0x4a82b){for(var _0x2c86e6 in _0x4a82b){if(_0x4a82b[_0xaef5('0xa0')](_0x2c86e6)){if(_[_0xaef5('0xa1')](_0x4a82b[_0x2c86e6])){this[_0xaef5('0xa2')](_0x4a82b[_0x2c86e6]);}else if(_[_0xaef5('0xa3')](_0x4a82b[_0x2c86e6])){for(var _0x5393f9=0x0;_0x5393f9<_0x4a82b[_0x2c86e6][_0xaef5('0xa4')];_0x5393f9++){this['recursiveNodeIndex'](_0x4a82b[_0x2c86e6][_0x5393f9]);}}else if(_[_0xaef5('0x9e')](_0x4a82b[_0x2c86e6])){_0x4a82b[_0x2c86e6]=this[_0xaef5('0xa5')](_0x4a82b[_0x2c86e6]);}}}};AGIVertices[_0xaef5('0x12')]['saveRestApiResult']=function(_0x132d8b,_0x31698a){for(var _0x18e9a6 in _0x132d8b){if(_0x132d8b[_0xaef5('0xa0')](_0x18e9a6)){if(_['isPlainObject'](_0x132d8b[_0x18e9a6])){if(!_[_0xaef5('0x49')](_0x132d8b[_0x18e9a6])){this[_0xaef5('0xa6')](_0x132d8b[_0x18e9a6],util[_0xaef5('0x2c')](_0xaef5('0xa7'),_0x31698a,_0x18e9a6));}}else if(_[_0xaef5('0xa3')](_0x132d8b[_0x18e9a6])){for(var _0x5e34e7=0x0;_0x5e34e7<_0x132d8b[_0x18e9a6]['length'];_0x5e34e7++){this[_0xaef5('0xa6')](_0x132d8b[_0x18e9a6][_0x5e34e7],util[_0xaef5('0x2c')](_0xaef5('0xa7'),_0x31698a,_0x18e9a6+'['+_0x5e34e7+']'));}}else{if(!_['isNil'](_0x132d8b[_0x18e9a6])){this['channel'][_0xaef5('0xa8')](util[_0xaef5('0x2c')]('%s.%s',_0x31698a,_0x18e9a6),_0x132d8b[_0x18e9a6]);}}}}};AGIVertices[_0xaef5('0x12')]['replaceObjectAllVariables']=function(_0xd3df58){try{var _0x180006=JSON['parse'](_0xd3df58);this['recursiveNodeIndex'](_0x180006);return JSON[_0xaef5('0x77')](_0x180006);}catch(_0x15f54f){return this[_0xaef5('0xa5')](_0xd3df58);}};AGIVertices[_0xaef5('0x12')]['replaceAllVariables']=function(_0x3b120e){var _0xab434a=_0x3b120e[_0xaef5('0xa9')]('{');for(var _0x348517=0x1;_0x348517<_0xab434a[_0xaef5('0xa4')];_0x348517+=0x1){var _0x434132=_0xab434a[_0x348517]['split']('}');if(_0x434132[_0xaef5('0xa4')]>0x1){_0x3b120e=_0x3b120e['replaceAll']('{'+_0x434132[0x0]+'}',this[_0xaef5('0xf')][_0xaef5('0x13')](_0x434132[0x0])[_0xaef5('0xaa')]||_0x434132[0x0]);}}if(_0xab434a['length']===0x1){return _0x3b120e[_0xaef5('0x4f')]();}return this[_0xaef5('0xa5')](_0x3b120e);};AGIVertices[_0xaef5('0x12')][_0xaef5('0xab')]=function(_0x1628cf,_0x3028f7){var _0x3f46dd=this[_0xaef5('0xf')][_0xaef5('0x13')](_0x1628cf);if(_0x3f46dd[_0xaef5('0xac')]===-0x1){return _0x3f46dd;}logger[_0xaef5('0x32')](util['format'](_0xaef5('0xad'),_0x3028f7,_0x3f46dd[_0xaef5('0xaa')]));return this[_0xaef5('0xf')]['setVariable'](_0x3028f7,_0x3f46dd[_0xaef5('0xaa')]);};AGIVertices['prototype'][_0xaef5('0x8a')]=function(_0x33bbfc){return _0x33bbfc&&_0x33bbfc!=='0'&&_0x33bbfc!=='-1'&&_0x33bbfc!=='';};AGIVertices['prototype'][_0xaef5('0xae')]=function(_0x2c9cb3){this[_0xaef5('0x3a')][_0xaef5('0x75')](this,_0x2c9cb3,'-');_0x2c9cb3[_0xaef5('0xaf')]=_0x2c9cb3[_0xaef5('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xaef5('0x12')][_0xaef5('0xb0')]=function(_0x54d62e){logger[_0xaef5('0x32')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x54d62e['label']));if(!this[_0xaef5('0x8a')](_0x54d62e[_0xaef5('0x60')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')]('no\x20text\x20configured');}var _0x206d63='\x22'+_0x54d62e[_0xaef5('0x60')]+'\x22';if(this[_0xaef5('0x8a')](_0x54d62e['options'])){_0x206d63+=','+_0x54d62e[_0xaef5('0x7e')];}var _0x3ba45b=this['channel'][_0xaef5('0x5b')](_0xaef5('0xb2'),_0x206d63);if(_0x3ba45b[_0xaef5('0xac')]===-0x1){return _0x3ba45b;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xb3'),_0x206d63));};AGIVertices[_0xaef5('0x12')]['mrcprecog']=function(_0x153ccb){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0xb4'),_0x153ccb[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x153ccb[_0xaef5('0xb5')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0xb6'));}var _0x2cf4b4=_0x153ccb[_0xaef5('0xb5')];if(this['isConfigured'](_0x153ccb[_0xaef5('0x7e')])){_0x2cf4b4+=','+_0x153ccb['options'];}var _0x59017a=this[_0xaef5('0xf')]['exec']('MRCPRecog',_0x2cf4b4);if(_0x59017a[_0xaef5('0xac')]===-0x1){return _0x59017a;}var _0x3299d7=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xaef5('0xb7'));if(_0x3299d7[_0xaef5('0xac')]===-0x1){return _0x3299d7;}var _0x45eb5d=this[_0xaef5('0xab')]('RECOG_INPUT()',_0xaef5('0xb8'));if(_0x45eb5d[_0xaef5('0xac')]===-0x1){return _0x45eb5d;}var _0x379016=this[_0xaef5('0xab')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x379016[_0xaef5('0xac')]===-0x1){return _0x379016;}return this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0xb9'),_0x2cf4b4));};AGIVertices['prototype'][_0xaef5('0x7')]=function(_0x55379b){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x55379b[_0xaef5('0x3b')]));return this[_0xaef5('0xf')][_0xaef5('0x7')]([_0x55379b[_0xaef5('0xba')],_0x55379b['args']]);};AGIVertices[_0xaef5('0x12')]['answer']=function(_0x4578cc){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0xbb'),_0x4578cc['label']));if(this['isConfigured'](_0x4578cc[_0xaef5('0x6c')])){logger[_0xaef5('0x32')](util['format'](_0xaef5('0xbc'),_0x4578cc[_0xaef5('0x6c')]));var _0x22ffeb=this[_0xaef5('0xf')][_0xaef5('0xbd')](_0x4578cc[_0xaef5('0x6c')]);if(_0x22ffeb[_0xaef5('0xac')]===-0x1){return _0x22ffeb;}}return this[_0xaef5('0xf')][_0xaef5('0xbe')]();};AGIVertices[_0xaef5('0x12')]['callback']=function(_0x171381){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0xbf'),_0x171381[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x171381['list_id'])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x171381,_0xaef5('0xc0'));}_0x171381['scheduledAt']=moment();if(this['isConfigured'](_0x171381[_0xaef5('0xc1')])){_0x171381[_0xaef5('0x4c')]=moment()['add'](_0x171381[_0xaef5('0xc1')],_0xaef5('0xc2'));}if(!this[_0xaef5('0x8a')](_0x171381[_0xaef5('0x50')])){_0x171381[_0xaef5('0x50')]=0x2;}this[_0xaef5('0x45')][_0xaef5('0x75')](this,_0x171381);return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xc3'),_0x171381[_0xaef5('0x4b')],_0x171381[_0xaef5('0xc4')],_0x171381[_0xaef5('0x4c')]));};AGIVertices[_0xaef5('0x12')]['custom_app']=function(_0x585da9){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0xc5'),_0x585da9['label']));var _0x3e286a=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0x585da9[_0xaef5('0xc6')],_0x585da9[_0xaef5('0x7e')]);if(_0x3e286a[_0xaef5('0xac')]===-0x1){return _0x3e286a;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xc7'),_0x585da9[_0xaef5('0xc6')],_0x585da9[_0xaef5('0x7e')]));};AGIVertices[_0xaef5('0x12')][_0xaef5('0xc8')]=function(_0x545179){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0xc9'),_0x545179['label']));if(!this[_0xaef5('0x8a')](_0x545179[_0xaef5('0x60')])){return this['channel'][_0xaef5('0xb1')]('no\x20text\x20configured');}var _0x566c7e='\x22'+_0x545179['text']+'\x22';if(this[_0xaef5('0x8a')](_0x545179[_0xaef5('0x7e')])){_0x566c7e+=','+_0x545179['options'];}var _0x1906c3=this['channel'][_0xaef5('0x5b')](_0xaef5('0xb2'),_0x566c7e);if(_0x1906c3['result']===-0x1){return _0x1906c3;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xb3'),_0x566c7e));};AGIVertices[_0xaef5('0x12')][_0xaef5('0xca')]=function(_0x3a7709){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0xcb'),_0x3a7709[_0xaef5('0x3b')]));if(!this['isConfigured'](_0x3a7709[_0xaef5('0x60')])){return this['channel'][_0xaef5('0xb1')](_0xaef5('0xcc'));}var _0x54a6e0='\x22'+_0x3a7709['text']+'\x22';if(this[_0xaef5('0x8a')](_0x3a7709['options'])){_0x54a6e0+=','+_0x3a7709[_0xaef5('0x7e')];}var _0x134187=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0xb2'),_0x54a6e0);if(_0x134187[_0xaef5('0xac')]===-0x1){return _0x134187;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0xb3'),_0x54a6e0));};AGIVertices[_0xaef5('0x12')][_0xaef5('0xcd')]=function(_0x26264){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0xce'),_0x26264[_0xaef5('0x3b')]));if(!this['isConfigured'](_0x26264[_0xaef5('0xb5')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0xb6'));}var _0xf1b34e=_0x26264[_0xaef5('0xb5')];if(this[_0xaef5('0x8a')](_0x26264[_0xaef5('0x7e')])){_0xf1b34e+=','+_0x26264[_0xaef5('0x7e')];}var _0x115776=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0xcf'),_0xf1b34e);if(_0x115776[_0xaef5('0xac')]===-0x1){return _0x115776;}var _0x50ba42=this[_0xaef5('0xab')](_0xaef5('0xd0'),_0xaef5('0xd1'));if(_0x50ba42[_0xaef5('0xac')]===-0x1){return _0x50ba42;}var _0x4fcc78=this[_0xaef5('0xab')]('RECOG_INPUT()',_0xaef5('0xd2'));if(_0x4fcc78[_0xaef5('0xac')]===-0x1){return _0x4fcc78;}var _0x1e46ff=this[_0xaef5('0xab')]('RECOG_INSTANCE()',_0xaef5('0xd3'));if(_0x1e46ff[_0xaef5('0xac')]===-0x1){return _0x1e46ff;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0xb9'),_0xf1b34e));};AGIVertices['prototype']['sestekasr']=function(_0x430147){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0xd4'),_0x430147[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x430147[_0xaef5('0xb5')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xb6'));}var _0x2c387c=_0x430147[_0xaef5('0xb5')];if(this[_0xaef5('0x8a')](_0x430147['options'])){_0x2c387c+=','+_0x430147[_0xaef5('0x7e')];}var _0xe2286a=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0xcf'),_0x2c387c);if(_0xe2286a[_0xaef5('0xac')]===-0x1){return _0xe2286a;}var _0x1042bb=this[_0xaef5('0xab')](_0xaef5('0xd0'),_0xaef5('0xd5'));if(_0x1042bb['result']===-0x1){return _0x1042bb;}var _0x278a6e=this[_0xaef5('0xab')](_0xaef5('0xd6'),_0xaef5('0xd7'));if(_0x278a6e[_0xaef5('0xac')]===-0x1){return _0x278a6e;}var _0xb68706=this[_0xaef5('0xab')]('RECOG_INSTANCE()',_0xaef5('0xd8'));if(_0xb68706[_0xaef5('0xac')]===-0x1){return _0xb68706;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xb9'),_0x2c387c));};AGIVertices[_0xaef5('0x12')][_0xaef5('0xd9')]=function(_0x176dc4){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x176dc4[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x176dc4[_0xaef5('0xda')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x176dc4,'no\x20database\x20selected');}var _0x48a4dc=this['getSquareOdbc'][_0xaef5('0x75')](this,_0x176dc4[_0xaef5('0xda')]);if(!_0x48a4dc){return this['channel'][_0xaef5('0x30')](_0x176dc4,_0xaef5('0xdb'));}if(!this[_0xaef5('0x8a')](_0x176dc4[_0xaef5('0x33')])){return this['channel'][_0xaef5('0x30')](_0x176dc4,_0xaef5('0xdc'));}var _0x315ec0=_0x176dc4['query'][_0xaef5('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xaef5('0x2c')](_0xaef5('0xdd'),_0x315ec0));var _0xb0befe=this[_0xaef5('0x2e')][_0xaef5('0x75')](this,_0x48a4dc,_0x315ec0);this[_0xaef5('0x3a')][_0xaef5('0x75')](this,_0x176dc4,_0x315ec0);if(!this[_0xaef5('0x8a')](_0x176dc4[_0xaef5('0xde')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xdf'));}var _0x39e0d4=this[_0xaef5('0x13')]['sync'](this,_0x176dc4[_0xaef5('0xde')]);if(!_0x39e0d4){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x176dc4,_0xaef5('0xe0'));}var _0x58c57f=this;_0xb0befe[_0xaef5('0xe1')](function(_0x59be94,_0x19f38f){Object[_0xaef5('0xe2')](_0x59be94)[_0xaef5('0xe1')](function(_0x2c850e){_0x58c57f['channel'][_0xaef5('0xa8')](util[_0xaef5('0x2c')](_0xaef5('0xe3'),_0x39e0d4,_0x19f38f,_0x2c850e),_0x59be94[_0x2c850e]);});});this[_0xaef5('0xf')][_0xaef5('0xa8')](util['format'](_0xaef5('0xe4'),_0x39e0d4),_0xb0befe[_0xaef5('0xa4')]);return this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')]('variable\x20%s\x20set',_0x39e0d4));};AGIVertices[_0xaef5('0x12')]['dial']=function(_0x288f6e){logger[_0xaef5('0xe5')](util['format'](_0xaef5('0xe6'),_0x288f6e[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x288f6e[_0xaef5('0xe7')])){return this['channel'][_0xaef5('0x30')](_0x288f6e,_0xaef5('0xe8'));}var _0x305414=this[_0xaef5('0x1e')][_0xaef5('0x75')](this,_0x288f6e[_0xaef5('0xe7')]);if(!_0x305414){return this[_0xaef5('0xf')]['error'](_0x288f6e,'no\x20user\x20found');}var _0x2dfa4e=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0xe9'),[util[_0xaef5('0x2c')](_0xaef5('0xea'),_0x305414),_0x288f6e[_0xaef5('0x6c')],_0x288f6e[_0xaef5('0xeb')],_0x288f6e[_0xaef5('0x6a')]]);if(_0x2dfa4e[_0xaef5('0xac')]===-0x1){return _0x2dfa4e;}return this['channel']['noop'](util['format'](_0xaef5('0xec'),_0xaef5('0xe9')));};AGIVertices['prototype'][_0xaef5('0xed')]=function(_0x1b8ffa){logger[_0xaef5('0x32')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1b8ffa[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x1b8ffa[_0xaef5('0x80')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0xee'));}if(!this[_0xaef5('0x8a')](_0x1b8ffa[_0xaef5('0x60')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0xcc'));}this['channel'][_0xaef5('0xef')]=!![];this['createSquareDetailsReport'](_0x1b8ffa);this[_0xaef5('0x44')](_0x1b8ffa[_0xaef5('0x60')],'in','','');this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xf0'),_0x1b8ffa['text']));var _0x2e93ac=this[_0xaef5('0x7f')]['sync'](this,_0x1b8ffa);if(_0x2e93ac){for(var _0x1a9304 in _0x2e93ac){if(_0x2e93ac['hasOwnProperty'](_0x1a9304)){this[_0xaef5('0xf')]['setVariable'](util[_0xaef5('0x2c')](_0xaef5('0xf1'),_0x1a9304[_0xaef5('0x6f')]()),_0x2e93ac[_0x1a9304]);}}this[_0xaef5('0x44')](_0x2e93ac[_0xaef5('0xf2')],_0xaef5('0xf3'),_0xaef5('0xed'),'');return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xf4'),_0x2e93ac[_0xaef5('0xf2')]));}return this['channel']['error'](_0x1b8ffa,_0xaef5('0xf5'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0xf6')]=function(_0x189085){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x189085['label']));if(!this[_0xaef5('0x8a')](_0x189085[_0xaef5('0xf7')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xf8'));}if(!this['isConfigured'](_0x189085[_0xaef5('0xf9')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')]('no\x20client_email\x20configured');}if(!this[_0xaef5('0x8a')](_0x189085[_0xaef5('0x82')])){return this['channel']['noop'](_0xaef5('0xfa'));}if(!this[_0xaef5('0x8a')](_0x189085[_0xaef5('0x83')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0xfb'));}if(!this[_0xaef5('0x8a')](_0x189085[_0xaef5('0x60')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0xcc'));}this[_0xaef5('0xf')][_0xaef5('0xef')]=!![];this[_0xaef5('0x3a')](_0x189085);this[_0xaef5('0x44')](_0x189085[_0xaef5('0x60')],'in','','');this[_0xaef5('0xf')]['noop'](util[_0xaef5('0x2c')](_0xaef5('0xfc'),_0x189085[_0xaef5('0x60')]));var _0x37655c=this[_0xaef5('0x81')][_0xaef5('0x75')](this,_0x189085);if(_0x37655c){for(var _0x25ff6e in _0x37655c){if(_0x37655c[_0xaef5('0xa0')](_0x25ff6e)){if(_0x25ff6e!==_0xaef5('0xfd')){this['channel'][_0xaef5('0xa8')](util[_0xaef5('0x2c')](_0xaef5('0xf1'),_0x25ff6e[_0xaef5('0x6f')]()),_0x37655c[_0x25ff6e]);}}}this[_0xaef5('0x44')](_0x37655c[_0xaef5('0xf2')],'out','dialogflowV2',_0x37655c[_0xaef5('0xfd')]);return this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0xfe'),_0x37655c[_0xaef5('0xf2')]));}return this[_0xaef5('0xf')]['error'](_0x189085,_0xaef5('0xff'));};AGIVertices['prototype'][_0xaef5('0x100')]=function(_0x487927){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x101'),_0x487927[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x487927[_0xaef5('0x102')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xaef5('0x8a')](_0x487927[_0xaef5('0x103')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0x104'));}if(!this['isConfigured'](_0x487927[_0xaef5('0x105')])){return this['channel'][_0xaef5('0xb1')](_0xaef5('0x106'));}if(!this[_0xaef5('0x8a')](_0x487927[_0xaef5('0x107')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xcc'));}this[_0xaef5('0xf')]['bot']=!![];this[_0xaef5('0x3a')](_0x487927);this['createSquareMessage'](_0x487927[_0xaef5('0x60')],'in','','');this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x108'),_0x487927['text']));var _0x5cceee=this[_0xaef5('0x84')][_0xaef5('0x75')](this,_0x487927);if(_0x5cceee){for(var _0x307ea3 in _0x5cceee){if(_0x5cceee[_0xaef5('0xa0')](_0x307ea3)){this[_0xaef5('0xf')][_0xaef5('0xa8')](util[_0xaef5('0x2c')]('SESTEK_NDA_%s',_0x307ea3[_0xaef5('0x6f')]()),_0x5cceee[_0x307ea3]);}}this[_0xaef5('0x44')](_0x5cceee[_0xaef5('0xf2')],_0xaef5('0xf3'),_0xaef5('0x100'),'');if(_0x5cceee['audiofile']){this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x109'),_0x5cceee[_0xaef5('0x10a')]));var _0x59c39f=this['channel'][_0xaef5('0x10b')](_0x5cceee['audiofile']);try{fs['unlink'](_0x5cceee['audiofile']+_0xaef5('0x10c'));}catch(_0x16b73f){logger['error'](_0x16b73f);}return _0x59c39f;}else{return this['channel']['noop'](util['format'](_0xaef5('0x10d'),_0x5cceee[_0xaef5('0xf2')]));}}return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x487927,_0xaef5('0x10e'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x10f')]=function(_0x5acbbb){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x110'),_0x5acbbb[_0xaef5('0x3b')]));return this[_0xaef5('0xf')]['noop'](_0xaef5('0x10f'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x111')]=function(_0x548d00){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x112'),_0x548d00[_0xaef5('0x3b')]));var _0x17673b='';if(_0x548d00[_0xaef5('0x113')]){if(!this[_0xaef5('0x8a')](_0x548d00[_0xaef5('0x113')])){return this['channel'][_0xaef5('0x30')](_0x548d00,'no\x20trunk\x20selected');}else{var _0x616756=parseInt(_0x548d00[_0xaef5('0x113')],0xa);if(isNaN(_0x616756)){_0x17673b=_0x548d00[_0xaef5('0x113')];}else{_0x17673b=this[_0xaef5('0x1f')][_0xaef5('0x75')](this,_0x548d00[_0xaef5('0x113')]);if(!_0x17673b){return this[_0xaef5('0xf')]['error'](_0x548d00,'no\x20trunk\x20found');}}}}else if(_0x548d00[_0xaef5('0x114')]){_0x17673b=_0x548d00[_0xaef5('0x114')];}else{return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x548d00,_0xaef5('0x115'));}var _0xfb3698=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0xe9'),[util[_0xaef5('0x2c')]('SIP/%s/%s',_0x17673b,_0x548d00[_0xaef5('0x4b')]),_0x548d00[_0xaef5('0x6c')],_0x548d00[_0xaef5('0xeb')],_0x548d00[_0xaef5('0x6a')]]);if(_0xfb3698[_0xaef5('0xac')]===-0x1){return _0xfb3698;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0xec'),_0xaef5('0xe9')));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x116')]=function(_0x131ce8){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x131ce8[_0xaef5('0x3b')]));return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x116'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x117')]=function(_0xced371){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x118'),_0xced371[_0xaef5('0x3b')]));if(_0xced371[_0xaef5('0xaf')]===0x0){return this[_0xaef5('0xae')](_0xced371);}_0xced371[_0xaef5('0xaf')]-=0x1;if(!this[_0xaef5('0x8a')](_0xced371[_0xaef5('0x119')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0xced371,_0xaef5('0x11a'));}var _0x22b3ae=this['getSound'][_0xaef5('0x75')](this,_0xced371[_0xaef5('0x119')]);if(!_0x22b3ae){return this[_0xaef5('0xf')]['error'](_0xced371,'no\x20file\x20audio\x20found');}if(!this[_0xaef5('0x8a')](_0xced371['variable_id'])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0xaef5('0xdf'));}var _0x249c88=this['channel'][_0xaef5('0x11b')](_0x22b3ae,_0xced371[_0xaef5('0x11c')],_0xced371[_0xaef5('0x11d')]);var _0x3116d4=_0x249c88[_0xaef5('0xac')]?_0x249c88[_0xaef5('0xac')]['toString']():'';logger['info'](_0xaef5('0x11e'),JSON[_0xaef5('0x77')](_0x249c88));if(_0x249c88[_0xaef5('0xac')]===-0x1){this[_0xaef5('0x3a')][_0xaef5('0x75')](this,_0xced371,_0x3116d4);return _0x249c88;}else if(_0x249c88[_0xaef5('0xaa')]===_0xaef5('0x6c')){_0x249c88[_0xaef5('0xac')]=_0x3116d4[_0xaef5('0xa4')]>=parseInt(_0xced371['mindigit'])?'x':'i';}else{_0x249c88[_0xaef5('0xac')]=_0x3116d4[_0xaef5('0xa4')]>=parseInt(_0xced371['mindigit'])&&_0x3116d4[_0xaef5('0xa4')]<=parseInt(_0xced371[_0xaef5('0x11d')])?'x':'i';}var _0x3e815=this['getVariable'][_0xaef5('0x75')](this,_0xced371[_0xaef5('0xde')]);if(!_0x3e815){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0xced371,_0xaef5('0xe0'));}this['channel']['setVariable'](_0x3e815,_0x3116d4);if(this[_0xaef5('0x8a')](_0xced371[_0xaef5('0x11f')])){var _0xda3578=parseInt(_0xced371[_0xaef5('0x11f')],0xa);var _0x82e9cf=rs[_0xaef5('0x120')]({'charset':'*','length':_0xda3578});var _0x4c734c=_0x3116d4[_0xaef5('0xa4')];if(_0x4c734c>0x0){if(_0x4c734c>_0xda3578){this['createSquareDetailsReport'][_0xaef5('0x75')](this,_0xced371,_0xced371[_0xaef5('0x121')]===_0xaef5('0x122')?_0x82e9cf+_0x3116d4[_0xaef5('0x123')](_0xda3578):_0x3116d4[_0xaef5('0x123')](0x0,_0x4c734c-_0xda3578)+_0x82e9cf);}else{this['createSquareDetailsReport'][_0xaef5('0x75')](this,_0xced371,rs[_0xaef5('0x120')]({'charset':'*','length':_0x4c734c}));}}else{this['createSquareDetailsReport']['sync'](this,_0xced371,'');}}else{this[_0xaef5('0x3a')][_0xaef5('0x75')](this,_0xced371,_0x3116d4);}return _0x249c88;};AGIVertices['prototype'][_0xaef5('0xe')]=function(_0x3396d4){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3396d4[_0xaef5('0x3b')]));return this[_0xaef5('0x117')](_0x3396d4);};AGIVertices['prototype'][_0xaef5('0x124')]=function(_0x3fc9c5){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x125'),_0x3fc9c5[_0xaef5('0x3b')]));this[_0xaef5('0x3a')]['sync'](this,_0x3fc9c5,_0x3fc9c5['goalname']);return this['channel']['noop'](util[_0xaef5('0x2c')]('GOAL\x20%s',_0x3fc9c5[_0xaef5('0x126')]));};AGIVertices[_0xaef5('0x12')]['awspolly']=function(_0x2027b5){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x127'),_0x2027b5[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x2027b5['aws_access_key_id'])||!this[_0xaef5('0x8a')](_0x2027b5['aws_secret_access_key'])){return this[_0xaef5('0xf')][_0xaef5('0xb1')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2027b5[_0xaef5('0x60')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xcc'));}this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x128'),_0x2027b5['text']));var _0x54ad5e=this['awsPolly'][_0xaef5('0x75')](this,_0x2027b5);if(_0x54ad5e){this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x129'),_0x54ad5e));var _0x14d7a1=this[_0xaef5('0xf')][_0xaef5('0x10b')](_0x54ad5e);try{fs['unlink'](_0x54ad5e+_0xaef5('0x10c'));}catch(_0x2188dc){logger['error'](_0x2188dc);}return _0x14d7a1;}return this[_0xaef5('0xf')]['error'](_0x2027b5,_0xaef5('0x12a'));};AGIVertices[_0xaef5('0x12')]['awslex']=function(_0x1dae6e){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1dae6e[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x1dae6e['aws_access_key_id'])||!this['isConfigured'](_0x1dae6e['aws_secret_access_key'])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x12b'));}if(!this[_0xaef5('0x8a')](_0x1dae6e[_0xaef5('0x95')])){return this[_0xaef5('0xf')]['noop'](_0xaef5('0x12c'));}if(!this[_0xaef5('0x8a')](_0x1dae6e['text'])){return this['channel'][_0xaef5('0xb1')]('no\x20text\x20configured');}this[_0xaef5('0xf')][_0xaef5('0xef')]=!![];this[_0xaef5('0x3a')](_0x1dae6e);this[_0xaef5('0x44')](_0x1dae6e[_0xaef5('0x60')],'in','','');this[_0xaef5('0xf')]['noop'](util[_0xaef5('0x2c')](_0xaef5('0x12d'),_0x1dae6e['text']));var _0x21c49b=this['awsLex'][_0xaef5('0x75')](this,_0x1dae6e);if(_0x21c49b){for(var _0x4bde7e in _0x21c49b){if(_0x21c49b[_0xaef5('0xa0')](_0x4bde7e)&&_[_0xaef5('0x9e')](_0x21c49b[_0x4bde7e])){this[_0xaef5('0xf')][_0xaef5('0xa8')](util['format'](_0xaef5('0x12e'),_0x4bde7e[_0xaef5('0x6f')]()),_0x21c49b[_0x4bde7e]);}}if(_[_0xaef5('0x46')](_0x21c49b[_0xaef5('0x7c')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x12f'));}else{this[_0xaef5('0x44')](_0x21c49b[_0xaef5('0x7c')],_0xaef5('0xf3'),_0xaef5('0x130'),'');return this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x131'),_0x21c49b['message']));}}return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x1dae6e,_0xaef5('0x132'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x133')]=function(_0x43f82c){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x134'),_0x43f82c[_0xaef5('0x3b')],_0x43f82c['timeout']));if(!this[_0xaef5('0x8a')](_0x43f82c[_0xaef5('0x80')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')]('no\x20key\x20configured');}var _0x647eda=_0xaef5('0x135');var _0x742450=util[_0xaef5('0x2c')](_0xaef5('0x136'),FILES_PATH,rs[_0xaef5('0x120')](0x4));var _0x4bf7d8=util[_0xaef5('0x2c')](_0xaef5('0xa7'),_0x742450,_0x647eda);var _0x3be24b=!![];if(_0x43f82c[_0xaef5('0x137')]==='NOBEEP'){_0x3be24b=![];}var _0x1ecbde=this[_0xaef5('0xf')][_0xaef5('0x138')](_0x742450,_0x647eda,_0x43f82c['intKey'],_0x43f82c['timeout'],undefined,_0x3be24b);if(_0x1ecbde[_0xaef5('0xac')]!==-0x1){this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x139'),_0x4bf7d8));var _0x11523d=this[_0xaef5('0x96')][_0xaef5('0x75')](this,_0x43f82c,_0x4bf7d8);if(_0x11523d){for(var _0x3e984f in _0x11523d){if(_0x11523d[_0xaef5('0xa0')](_0x3e984f)){this[_0xaef5('0xf')][_0xaef5('0xa8')](util[_0xaef5('0x2c')](_0xaef5('0x13a'),_0x3e984f[_0xaef5('0x6f')]()),_0x11523d[_0x3e984f]);}}return this['channel'][_0xaef5('0xb1')](util['format'](_0xaef5('0x13b'),JSON[_0xaef5('0x77')](_0x11523d)));}}return _0x1ecbde;};AGIVertices[_0xaef5('0x12')]['tildeasr']=function(_0x1686ae){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1686ae[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x1686ae[_0xaef5('0x99')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')]('no\x20appid\x20configured');}if(!this[_0xaef5('0x8a')](_0x1686ae['appsecret'])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x13c'));}var _0x4d5f8e=_0xaef5('0x135');var _0x430885=util[_0xaef5('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0xaef5('0x120')](0x4));var _0x362d4e=util[_0xaef5('0x2c')](_0xaef5('0xa7'),_0x430885,_0x4d5f8e);var _0x2b37f3=!![];if(_0x1686ae[_0xaef5('0x137')]===_0xaef5('0x13d')){_0x2b37f3=![];}var _0x578b10=this[_0xaef5('0xf')][_0xaef5('0x138')](_0x430885,_0x4d5f8e,_0x1686ae['intKey'],_0x1686ae['timeout'],undefined,_0x2b37f3);if(_0x578b10[_0xaef5('0xac')]!==-0x1){this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x13e'),_0x362d4e));var _0x283184=this[_0xaef5('0x98')][_0xaef5('0x75')](this,_0x1686ae,_0x362d4e);if(_0x283184){for(var _0x1c1d58 in _0x283184){if(_0x283184[_0xaef5('0xa0')](_0x1c1d58)){this[_0xaef5('0xf')][_0xaef5('0xa8')](util[_0xaef5('0x2c')](_0xaef5('0x13f'),_0x1c1d58[_0xaef5('0x6f')]()),_0x283184[_0x1c1d58]);}}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x140'),JSON['stringify'](_0x283184)));}}return _0x578b10;};AGIVertices[_0xaef5('0x12')][_0xaef5('0x141')]=function(_0x12e610){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x142'),_0x12e610[_0xaef5('0x3b')]));return this[_0xaef5('0xf')][_0xaef5('0x143')](_0x12e610['context'],_0x12e610[_0xaef5('0x144')],_0x12e610[_0xaef5('0x40')]);};AGIVertices[_0xaef5('0x12')][_0xaef5('0x145')]=function(_0x50d7cb){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x50d7cb[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x50d7cb['condition'])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x50d7cb,'no\x20condition\x20configured');}try{var _0x5b3681=eval(_0x50d7cb['condition'])?_0xaef5('0x146'):_0xaef5('0x147');this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x148'),_0x50d7cb['condition'],_0x5b3681));return{'code':0xc8,'result':_0x5b3681};}catch(_0x511c5f){return{'code':0xc8,'result':_0xaef5('0x147')};}};AGIVertices[_0xaef5('0x12')][_0xaef5('0x149')]=function(_0x3f2d94){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x14a'),_0x3f2d94['label']));if(!this[_0xaef5('0x8a')](_0x3f2d94['interval_id'])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x3f2d94,_0xaef5('0x14b'));}var _0x428418=this[_0xaef5('0x27')][_0xaef5('0x75')](this,_0x3f2d94[_0xaef5('0x14c')]);if(!_0x428418){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x3f2d94,_0xaef5('0x14d'));}for(var _0x14c1e6=0x0;_0x14c1e6<_0x428418['length'];_0x14c1e6+=0x1){var _0x1d2dbf=this[_0xaef5('0xf')][_0xaef5('0x13')](util[_0xaef5('0x2c')](_0xaef5('0x14e'),_0x428418[_0x14c1e6]));if(_0x1d2dbf[_0xaef5('0xac')]===-0x1){return _0x1d2dbf;}logger[_0xaef5('0x32')](util['format'](_0xaef5('0x14f'),_0x428418[_0x14c1e6],_0x1d2dbf[_0xaef5('0xaa')]));if(_0x1d2dbf['extra']===_0xaef5('0x146')){logger['info'](util['format'](_0xaef5('0x14f'),_0x428418[_0x14c1e6],_0xaef5('0x146')));this['channel'][_0xaef5('0xb1')](util['format'](_0xaef5('0x14f'),_0x428418[_0x14c1e6],_0xaef5('0x146')));return{'code':0xc8,'result':_0xaef5('0x146')};}else{logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x14f'),_0x428418[_0x14c1e6],_0xaef5('0x147')));this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x14f'),_0x428418[_0x14c1e6],_0xaef5('0x147')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xaef5('0x12')][_0xaef5('0x150')]=function(_0x121d21){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x151'),_0x121d21[_0xaef5('0x3b')]));return this[_0xaef5('0xf')]['hangup']();};AGIVertices[_0xaef5('0x12')][_0xaef5('0x152')]=function(_0x502ffe){logger['info'](util['format'](_0xaef5('0x153'),_0x502ffe['label']));if(!this[_0xaef5('0x8a')](_0x502ffe[_0xaef5('0x80')])){return this['channel'][_0xaef5('0xb1')]('no\x20key\x20configured');}var _0x3a9b57=_0xaef5('0x135');var _0x55b8ad=util[_0xaef5('0x2c')](_0xaef5('0x136'),FILES_PATH,rs[_0xaef5('0x120')](0x4));var _0x22f5d7=util[_0xaef5('0x2c')]('%s.%s',_0x55b8ad,_0x3a9b57);var _0x309564=!![];if(_0x502ffe['beep']===_0xaef5('0x13d')){_0x309564=![];}var _0x46f369=this['channel']['recordFile'](_0x55b8ad,_0x3a9b57,_0x502ffe[_0xaef5('0x154')],_0x502ffe[_0xaef5('0x6c')],undefined,_0x309564);if(_0x46f369[_0xaef5('0xac')]!==-0x1){this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x155'),_0x22f5d7));var _0x24e5d0=this['ispeechASR'][_0xaef5('0x75')](this,_0x502ffe,_0x22f5d7);if(_0x24e5d0){for(var _0x48a1e0 in _0x24e5d0){if(_0x24e5d0[_0xaef5('0xa0')](_0x48a1e0)){this[_0xaef5('0xf')][_0xaef5('0xa8')](util['format'](_0xaef5('0x156'),_0x48a1e0[_0xaef5('0x6f')]()),_0x24e5d0[_0x48a1e0]);}}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x157'),JSON[_0xaef5('0x77')](_0x24e5d0)));}}return _0x46f369;};AGIVertices[_0xaef5('0x12')]['ispeechtts']=function(_0x534240){logger[_0xaef5('0x32')](util['format'](_0xaef5('0x158'),_0x534240['label']));if(!this[_0xaef5('0x8a')](_0x534240[_0xaef5('0x80')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xee'));}if(!this[_0xaef5('0x8a')](_0x534240['text'])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xcc'));}this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x159'),_0x534240[_0xaef5('0x60')]));var _0x243211=this[_0xaef5('0x85')][_0xaef5('0x75')](this,_0x534240);if(_0x243211){this[_0xaef5('0xf')]['noop'](util['format'](_0xaef5('0x155'),_0x243211));var _0x4423f5=this['channel'][_0xaef5('0x10b')](_0x243211,_0x534240[_0xaef5('0x154')]);try{fs[_0xaef5('0x15a')](_0x243211+_0xaef5('0x10c'));}catch(_0x4b8316){logger['error'](_0x4b8316);}return _0x4423f5;}return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x534240,_0xaef5('0x15b'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x15c')]=function(_0x507887){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x507887[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x507887[_0xaef5('0x15d')])){return this['channel']['error'](_0x507887,'no\x20find\x20by\x20configured');}logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x15e'),this['channel'][_0xaef5('0x3e')],_0x507887[_0xaef5('0x15d')]));var _0x10296f=this[_0xaef5('0x56')][_0xaef5('0x75')](this,_0x507887[_0xaef5('0x15d')]);if(_0x10296f){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x507887[_0xaef5('0x15d')]));this[_0xaef5('0xf')]['noop'](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x507887[_0xaef5('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x160'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x507887[_0xaef5('0x15d')]));this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x160'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x507887[_0xaef5('0x15d')]));return{'code':0xc8,'result':_0xaef5('0x161')};}};AGIVertices[_0xaef5('0x12')]['logout']=function(_0x5ebee3){logger[_0xaef5('0x32')](util['format'](_0xaef5('0x162'),_0x5ebee3[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x5ebee3[_0xaef5('0x15d')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x5ebee3,_0xaef5('0x163'));}logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x15e'),this['channel']['callerid'],_0x5ebee3[_0xaef5('0x15d')]));var _0x134b61=this['agentLogout'][_0xaef5('0x75')](this,_0x5ebee3[_0xaef5('0x15d')]);if(_0x134b61){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this['channel'][_0xaef5('0x3e')],_0x5ebee3['findBy']));this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x5ebee3[_0xaef5('0x15d')]));return{'code':0xc8,'result':_0xaef5('0x164')};}else{logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x160'),this['channel'][_0xaef5('0x3e')],_0x5ebee3[_0xaef5('0x15d')]));this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x160'),this[_0xaef5('0xf')]['callerid'],_0x5ebee3[_0xaef5('0x15d')]));return{'code':0xc8,'result':_0xaef5('0x161')};}};AGIVertices['prototype'][_0xaef5('0x165')]=function(_0x3164c4){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3164c4[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x3164c4[_0xaef5('0x166')])){return this[_0xaef5('0xf')]['error'](_0x3164c4,_0xaef5('0x167'));}this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x168'),_0x3164c4[_0xaef5('0x166')]));var _0x964aa1=eval(_0x3164c4[_0xaef5('0x166')]);if(!this[_0xaef5('0x8a')](_0x3164c4[_0xaef5('0xde')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xdf'));}var _0x46d7e0=this[_0xaef5('0x13')]['sync'](this,_0x3164c4[_0xaef5('0xde')]);if(!_0x46d7e0){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x3164c4,'no\x20variable\x20found');}if(_['isArray'](_0x964aa1)){var _0x122216=this;_0x964aa1[_0xaef5('0xe1')](function(_0x2e6109,_0x57e588){_0x122216[_0xaef5('0xf')]['setVariable'](util[_0xaef5('0x2c')](_0xaef5('0x169'),_0x46d7e0,_0x57e588),_0x2e6109);});return this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x16a'),_0x46d7e0));}else{return this['channel'][_0xaef5('0xa8')](_0x46d7e0,_0x964aa1);}};AGIVertices[_0xaef5('0x12')][_0xaef5('0xd')]=function(_0xfab08d){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x16b'),_0xfab08d[_0xaef5('0x3b')]));if(_0xfab08d[_0xaef5('0xaf')]===0x0){return this['maxRetry'](_0xfab08d);}_0xfab08d[_0xaef5('0xaf')]-=0x1;if(!this[_0xaef5('0x8a')](_0xfab08d[_0xaef5('0x119')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0xfab08d,_0xaef5('0x11a'));}var _0x3f0f30=this['getSound'][_0xaef5('0x75')](this,_0xfab08d[_0xaef5('0x119')]);if(!_0x3f0f30){return this['channel'][_0xaef5('0x30')](_0xfab08d,_0xaef5('0x16c'));}var _0x5b7610=this[_0xaef5('0xf')][_0xaef5('0x11b')](_0x3f0f30,_0xfab08d[_0xaef5('0x11c')],_0xfab08d['digit']);var _0x4bd709=_0x5b7610[_0xaef5('0xac')];if(_0x5b7610[_0xaef5('0xac')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0xfab08d,'-1');return _0x5b7610;}else if(_0x5b7610['extra']===_0xaef5('0x6c')){_0x5b7610[_0xaef5('0xac')]=_0x5b7610['result']['length']>0x0?_0x5b7610[_0xaef5('0xac')]:'t';}else if(_[_0xaef5('0x49')](_0x5b7610[_0xaef5('0xac')])){_0x5b7610[_0xaef5('0xac')]='#';_0x4bd709='#';}if(!this[_0xaef5('0x8a')](_0xfab08d[_0xaef5('0xde')])){this['channel'][_0xaef5('0xb1')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x156126=this[_0xaef5('0x13')][_0xaef5('0x75')](this,_0xfab08d[_0xaef5('0xde')]);if(!_0x156126){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0xfab08d,_0xaef5('0xe0'));}this[_0xaef5('0xf')]['setVariable'](_0x156126,_0x4bd709);}this['createSquareDetailsReport'][_0xaef5('0x75')](this,_0xfab08d,_0x4bd709);return _0x5b7610;};AGIVertices[_0xaef5('0x12')]['noop']=function(_0x44fd63){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x16d'),_0x44fd63['label']));return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0x44fd63['output']||_0x44fd63['label']);};AGIVertices[_0xaef5('0x12')][_0xaef5('0x16e')]=function(_0x12d3a1){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x12d3a1[_0xaef5('0x3b')]));if(!this['isConfigured'](_0x12d3a1[_0xaef5('0x15d')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x12d3a1,_0xaef5('0x163'));}logger['info'](util['format'](_0xaef5('0x15e'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x12d3a1[_0xaef5('0x15d')]));var _0x4646fe=this[_0xaef5('0x16f')][_0xaef5('0x75')](this,_0x12d3a1[_0xaef5('0x170')]);var _0x4b8fb4=this[_0xaef5('0x52')]['sync'](this,_0x12d3a1['findBy'],_0x4646fe);if(_0x4b8fb4){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x12d3a1[_0xaef5('0x15d')]));this[_0xaef5('0xf')]['noop'](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x12d3a1[_0xaef5('0x15d')]));return{'code':0xc8,'result':_0xaef5('0x164')};}else{logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x12d3a1[_0xaef5('0x15d')]));this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this['channel'][_0xaef5('0x3e')],_0x12d3a1['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xaef5('0x12')][_0xaef5('0x171')]=function(_0x11127d){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x172'),_0x11127d[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x11127d[_0xaef5('0x119')])){return this['channel'][_0xaef5('0x30')](_0x11127d,_0xaef5('0x11a'));}var _0x489f47=this['getSound']['sync'](this,_0x11127d['file_id']);if(!_0x489f47){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x11127d,_0xaef5('0x16c'));}var _0xb96f27=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0x173'),[_0x489f47,_0x11127d[_0xaef5('0xeb')]]);if(_0xb96f27[_0xaef5('0xac')]===-0x1){return _0xb96f27;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format']('Executed\x20command\x20%s\x20%s',_0xaef5('0x173'),_0x489f47));};AGIVertices['prototype'][_0xaef5('0x174')]=function(_0x1ef88b){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1ef88b[_0xaef5('0x3b')]));if(!this['isConfigured'](_0x1ef88b[_0xaef5('0x175')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x1ef88b,_0xaef5('0x176'));}var _0xb1df31='';var _0x50190d=parseInt(_0x1ef88b[_0xaef5('0x175')],0xa);if(isNaN(_0x50190d)){_0xb1df31=_0x1ef88b[_0xaef5('0x175')];}else{_0xb1df31=this['getVoiceQueue'][_0xaef5('0x75')](this,_0x1ef88b['queue_id']);if(!_0xb1df31){return this['channel'][_0xaef5('0x30')](_0x1ef88b,'no\x20queue\x20found');}}var _0x10da70='';if(this[_0xaef5('0x8a')](_0x1ef88b['file_id'])){var _0x1a819b=this[_0xaef5('0x21')]['sync'](this,_0x1ef88b[_0xaef5('0x119')]);if(_0x1a819b){_0x10da70=_0x1a819b;}}this[_0xaef5('0x3a')]['sync'](this,_0x1ef88b,_0xb1df31);if(_0x1ef88b[_0xaef5('0xeb')][_0xaef5('0x177')]('x')<0x0){_0x1ef88b[_0xaef5('0xeb')]+='x';}if(_0x1ef88b[_0xaef5('0xeb')]['indexOf']('X')<0x0){_0x1ef88b[_0xaef5('0xeb')]+='X';}this[_0xaef5('0xf')][_0xaef5('0xa8')](_0xaef5('0x178'),_0xb1df31?_0xb1df31[_0xaef5('0x179')]():'');var _0x12ba0b=this[_0xaef5('0xf')]['exec'](_0xaef5('0x17a'),[_0xb1df31,_0x1ef88b[_0xaef5('0xeb')],_0x1ef88b[_0xaef5('0x6a')],_0x10da70,_0x1ef88b['timeout'],_0x1ef88b['agi'],_0x1ef88b[_0xaef5('0x17b')],_0x1ef88b[_0xaef5('0x17c')],'',_0x1ef88b[_0xaef5('0x17d')]]);if(_0x12ba0b[_0xaef5('0xac')]===-0x1){return _0x12ba0b;}return this[_0xaef5('0xf')]['noop'](util['format']('Executed\x20command\x20%s\x20%s','QUEUE',_0xb1df31));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x17e')]=function(_0xa7969){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0xa7969[_0xaef5('0x3b')]));var _0x46daae=_0xa7969[_0xaef5('0x17f')]||_0xaef5('0x135');var _0x31c073=util[_0xaef5('0x2c')](_0xaef5('0x180'),this[_0xaef5('0xf')]['uniqueid'],rs[_0xaef5('0x120')](0x5));var _0x574cca=util[_0xaef5('0x2c')](_0xaef5('0x181'),FILES_PATH,_0x31c073,_0x46daae);var _0x574e07=util[_0xaef5('0x2c')]('%s/recordings/%s',FILES_PATH,_0x31c073);this['createSquareRecording'][_0xaef5('0x75')](this,_0xa7969,_0x31c073,_0x574cca);this['channel'][_0xaef5('0xa8')](_0xaef5('0x182'),_0x31c073);logger['info'](_0xaef5('0x183'),_0x574e07,_0x46daae,_0xa7969[_0xaef5('0x184')],_0xa7969[_0xaef5('0x6c')]);return this[_0xaef5('0xf')]['recordFile'](_0x574e07,_0x46daae,_0xa7969['escape_digits'],_0xa7969[_0xaef5('0x6c')],undefined,!![]);};AGIVertices[_0xaef5('0x12')][_0xaef5('0x185')]=function(_0x4153e9){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x186'),_0x4153e9[_0xaef5('0x3b')]));if(!this['isConfigured'](_0x4153e9[_0xaef5('0x6a')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x187'));}var _0x1bcbdb=this[_0xaef5('0x69')]['sync'](this,_0x4153e9);logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x188'),util[_0xaef5('0x189')](_0x1bcbdb,{'showHidden':![],'depth':null})));if(!this[_0xaef5('0x8a')](_0x4153e9[_0xaef5('0xde')])){return this['channel'][_0xaef5('0xb1')](_0xaef5('0x18a'));}var _0x4d5d3f=this[_0xaef5('0x13')][_0xaef5('0x75')](this,_0x4153e9['variable_id']);if(!_0x4d5d3f){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x4153e9,_0xaef5('0xe0'));}this[_0xaef5('0xf')][_0xaef5('0xa8')](util[_0xaef5('0x2c')](_0xaef5('0x18b'),_0x4d5d3f),_0x1bcbdb[_0xaef5('0x7a')]?_0x1bcbdb[_0xaef5('0x7a')]:_0xaef5('0x18c'));this['channel'][_0xaef5('0xa8')](util['format']('%s_STATUS_MESSAGE',_0x4d5d3f),_0x1bcbdb[_0xaef5('0x7b')]?_0x1bcbdb['statusMessage']:'OK');if(_0x1bcbdb[_0xaef5('0x78')]){try{this['saveRestApiResult'](_0x1bcbdb[_0xaef5('0x78')],_0x4d5d3f);}catch(_0x2c0492){logger[_0xaef5('0x30')](util[_0xaef5('0x2c')](_0xaef5('0x18d'),_0x4d5d3f));}}return this['channel'][_0xaef5('0xb1')](util['format'](_0xaef5('0x18e'),_0x4d5d3f));};AGIVertices['prototype'][_0xaef5('0x18f')]=function(_0xae5ec){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x190'),_0xae5ec[_0xaef5('0x3b')]));return this['channel'][_0xaef5('0x191')](_0xae5ec[_0xaef5('0x192')][_0xaef5('0x5c')](/\s+/g,''),_0xae5ec['escape_digits']);};AGIVertices[_0xaef5('0x12')][_0xaef5('0x193')]=function(_0xf33659){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x194'),_0xf33659['label']));return this[_0xaef5('0xf')][_0xaef5('0x195')](_0xf33659[_0xaef5('0x6d')][_0xaef5('0x5c')](/\s+/g,''),_0xf33659['escape_digits']);};AGIVertices[_0xaef5('0x12')][_0xaef5('0x196')]=function(_0x54dde2){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x54dde2[_0xaef5('0x3b')]));return this[_0xaef5('0xf')][_0xaef5('0x197')](_0x54dde2[_0xaef5('0x60')],_0x54dde2['escape_digits']);};AGIVertices['prototype'][_0xaef5('0x198')]=function(_0x34b443){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x34b443['label']));if(!this[_0xaef5('0x8a')](_0x34b443[_0xaef5('0x199')])){return this['channel'][_0xaef5('0xb1')](_0xaef5('0x19a'));}var _0x53be7e=this['getMailAccount'][_0xaef5('0x75')](this,_0x34b443[_0xaef5('0x199')]);if(!_0x53be7e||!_0x53be7e[_0xaef5('0x19b')]){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x34b443,_0xaef5('0x19c'));}var _0x141737={'from':util['format'](_0xaef5('0x19d'),_0x53be7e[_0xaef5('0x16')],_0x53be7e['email']||_0x53be7e[_0xaef5('0x19b')][_0xaef5('0x19e')]),'to':_0x34b443['to']||'','cc':_0x34b443['cc']||'','bcc':_0x34b443[_0xaef5('0x19f')]||'','subject':_0x34b443[_0xaef5('0x1a0')],'html':_0x34b443[_0xaef5('0x60')],'text':_0x34b443[_0xaef5('0x60')]};var _0x4a0c1f={'tls':{'rejectUnauthorized':![]}};if(_0x53be7e[_0xaef5('0x19b')][_0xaef5('0x1a1')]){_0x4a0c1f[_0xaef5('0x1a1')]=_0x53be7e[_0xaef5('0x19b')][_0xaef5('0x1a1')];}else{_0x4a0c1f[_0xaef5('0x1a2')]=_0x53be7e[_0xaef5('0x19b')][_0xaef5('0x1a2')];_0x4a0c1f[_0xaef5('0x1a3')]=_0x53be7e[_0xaef5('0x19b')][_0xaef5('0x1a3')];_0x4a0c1f[_0xaef5('0x1a4')]=_0x53be7e['Smtp'][_0xaef5('0x1a4')];}if(_0x53be7e[_0xaef5('0x19b')][_0xaef5('0x1a5')]){_0x4a0c1f['auth']={'user':_0x53be7e[_0xaef5('0x19b')]['user'],'pass':_0x53be7e['Smtp'][_0xaef5('0x1a6')]};}if(this[_0xaef5('0x8a')](_0x34b443[_0xaef5('0x1a7')])){}logger[_0xaef5('0xe5')](_0xaef5('0x1a8'),JSON[_0xaef5('0x77')](_0x141737));this['createSquareDetailsReport']['sync'](this,_0x34b443,_0x34b443[_0xaef5('0x199')]);this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x1a9'),_0x53be7e['name']));this[_0xaef5('0x26')]['sync'](this,_0x4a0c1f,_0x141737);return this['channel'][_0xaef5('0xb1')](_0xaef5('0x1aa'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1ab')]=function(_0x2a66b0){logger[_0xaef5('0x32')](util['format'](_0xaef5('0x1ac'),_0x2a66b0[_0xaef5('0x3b')]));return this[_0xaef5('0xf')][_0xaef5('0xb1')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0xaef5('0x1ad')]=function(_0x5f28aa){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x1ae'),_0x5f28aa[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x5f28aa[_0xaef5('0x1af')])){return this['channel'][_0xaef5('0xb1')]('no\x20sms\x20account\x20configured');}var _0x518190=this[_0xaef5('0x37')][_0xaef5('0x75')](this,_0x5f28aa[_0xaef5('0x1af')]);if(!_0x518190){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x5f28aa,_0xaef5('0x1b0'));}var _0x2ea903={'body':_0x5f28aa[_0xaef5('0x1b1')],'phone':_0x5f28aa['to']||'','SmsAccountId':_0x518190['id']};logger[_0xaef5('0xe5')](_0xaef5('0x1b2'),JSON['stringify'](_0x2ea903));this[_0xaef5('0x3a')]['sync'](this,_0x5f28aa,_0x5f28aa[_0xaef5('0x1af')]);this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x1b3'),_0x518190[_0xaef5('0x16')]));this['createSmsMessage'][_0xaef5('0x75')](this,_0x2ea903);return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x1b4'));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1b5')]=function(_0x131ea0){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x1b6'),_0x131ea0[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x131ea0[_0xaef5('0xde')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x131ea0,_0xaef5('0x1b7'));}var _0x389963=this[_0xaef5('0x13')]['sync'](this,_0x131ea0[_0xaef5('0xde')]);if(!_0x389963){return this[_0xaef5('0xf')]['error'](_0x131ea0,'no\x20variable\x20found');}return this[_0xaef5('0xf')][_0xaef5('0xa8')](_0x389963,_0x131ea0[_0xaef5('0x1b8')]);};AGIVertices['prototype'][_0xaef5('0x1b9')]=function(_0x4f5f66){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x1ba'),_0x4f5f66[_0xaef5('0x3b')]));this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x1bb'));if(_0x4f5f66[_0xaef5('0xbe')]===_0xaef5('0x1bc')){this['channel'][_0xaef5('0xb1')](_0xaef5('0x1bd'));return this['channel'][_0xaef5('0xbe')]();}return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x1be'));};AGIVertices['prototype'][_0xaef5('0x1bf')]=function(_0x2c288c){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x1c0'),_0x2c288c['label']));if(!this['isConfigured'](_0x2c288c[_0xaef5('0x1c1')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x2c288c,_0xaef5('0x1c2'));}var _0x4d7e76=this[_0xaef5('0x1a')][_0xaef5('0x75')](this,_0x2c288c[_0xaef5('0x1c1')]);if(!this[_0xaef5('0x8a')](_0x4d7e76)){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0x2c288c,util[_0xaef5('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2c288c[_0xaef5('0x1c1')]));}if(_0x4d7e76===this[_0xaef5('0xf')]['arg_1']){return this['channel']['error'](_0x2c288c,_0xaef5('0x1c3'));}this[_0xaef5('0x3a')][_0xaef5('0x75')](this,_0x2c288c,_0x4d7e76);var _0x160779=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0x1c4'),util[_0xaef5('0x2c')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xaef5('0x7')][_0xaef5('0x1a2')]||_0xaef5('0x1c5'),_0x4d7e76,this[_0xaef5('0xf')]['arg_1']));if(_0x160779[_0xaef5('0xac')]===-0x1){return _0x160779;}return this['channel']['noop'](util[_0xaef5('0x2c')]('Executed\x20command\x20%s\x20%s','AGI',_0x4d7e76));};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1c6')]=function(_0x88c032){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x1c7'),_0x88c032[_0xaef5('0x3b')]));var _0x3ba52d=this[_0xaef5('0x5a')][_0xaef5('0x75')](this,_0x88c032['command']);this[_0xaef5('0x3a')]['sync'](this,_0x88c032,_0x88c032['command']);if(this[_0xaef5('0x8a')](_0x88c032[_0xaef5('0xde')])){var _0x49c47a=this[_0xaef5('0x13')]['sync'](this,_0x88c032['variable_id']);if(_0x49c47a){this[_0xaef5('0xf')][_0xaef5('0xa8')](_0x49c47a,_0x3ba52d);return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format'](_0xaef5('0x1c8'),_0x88c032['command'],_0x49c47a));}}return this[_0xaef5('0xf')]['noop'](util[_0xaef5('0x2c')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x88c032[_0xaef5('0xba')]));};AGIVertices['prototype'][_0xaef5('0x1c9')]=function(_0x3e59ea){logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x1ca'),_0x3e59ea['label']));_0x3e59ea[_0xaef5('0x60')]=_0x3e59ea['text'][_0xaef5('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3e59ea['apiKey'])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0x1cb'));}if(!this[_0xaef5('0x8a')](_0x3e59ea[_0xaef5('0x60')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xcc'));}this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x1cc'),_0x3e59ea[_0xaef5('0x60')]));var _0x5da373=this['googleCloudTTS'][_0xaef5('0x75')](this,_0x3e59ea);if(_0x5da373){this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5da373));var _0x50b8d3=this[_0xaef5('0xf')][_0xaef5('0x10b')](_0x5da373);try{fs['unlink'](_0x5da373+_0xaef5('0x10c'));}catch(_0x292983){logger[_0xaef5('0x30')](_0x292983);}return _0x50b8d3;}return this['channel'][_0xaef5('0x30')](_0x3e59ea,_0xaef5('0x1cd'));};AGIVertices[_0xaef5('0x12')]['tts']=function(_0x2adf07){logger['info'](util[_0xaef5('0x2c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2adf07['label']));_0x2adf07[_0xaef5('0x60')]=_0x2adf07[_0xaef5('0x60')][_0xaef5('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaef5('0x8a')](_0x2adf07[_0xaef5('0x60')])){return this[_0xaef5('0xf')][_0xaef5('0xb1')](_0xaef5('0xcc'));}this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x1ce'),_0x2adf07['text']));var _0x2adc34=this[_0xaef5('0x67')][_0xaef5('0x75')](this,_0x2adf07);if(_0x2adc34){this[_0xaef5('0xf')]['noop'](util['format'](_0xaef5('0x1cf'),_0x2adc34));var _0x54c852=this[_0xaef5('0xf')][_0xaef5('0x10b')](_0x2adc34);try{fs['unlink'](_0x2adc34+_0xaef5('0x10c'));}catch(_0x2c8f52){logger['error'](_0x2c8f52);}return _0x54c852;}return this['channel'][_0xaef5('0x30')](_0x2adf07,_0xaef5('0x1d0'));};AGIVertices['prototype'][_0xaef5('0x1d1')]=function(_0x5be33c){logger[_0xaef5('0x32')](util['format'](_0xaef5('0x1d2'),_0x5be33c[_0xaef5('0x3b')]));if(!this[_0xaef5('0x8a')](_0x5be33c[_0xaef5('0x15d')])){return this['channel'][_0xaef5('0x30')](_0x5be33c,_0xaef5('0x163'));}logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x15e'),this['channel']['callerid'],_0x5be33c['findBy']));var _0x1752fb=this[_0xaef5('0x53')][_0xaef5('0x75')](this,_0x5be33c['findBy']);if(_0x1752fb){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this['channel'][_0xaef5('0x3e')],_0x5be33c[_0xaef5('0x15d')]));this['channel'][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x15f'),this['channel'][_0xaef5('0x3e')],_0x5be33c[_0xaef5('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0xaef5('0x32')](util[_0xaef5('0x2c')](_0xaef5('0x160'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x5be33c[_0xaef5('0x15d')]));this[_0xaef5('0xf')][_0xaef5('0xb1')](util[_0xaef5('0x2c')](_0xaef5('0x160'),this[_0xaef5('0xf')][_0xaef5('0x3e')],_0x5be33c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xaef5('0x12')][_0xaef5('0x1d3')]=function(_0x16f8f0){logger[_0xaef5('0x32')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x16f8f0[_0xaef5('0x3b')]));var _0x7ef1be=this[_0xaef5('0xf')][_0xaef5('0x5b')](_0xaef5('0x1d4'),[_0x16f8f0['mailbox'],_0x16f8f0[_0xaef5('0x7e')]]);if(_0x7ef1be[_0xaef5('0xac')]===-0x1){return _0x7ef1be;}return this[_0xaef5('0xf')][_0xaef5('0xb1')](util['format']('Executed\x20command\x20%s\x20%s',_0xaef5('0x1d4'),_0x16f8f0[_0xaef5('0x1d5')]));};AGIVertices['prototype'][_0xaef5('0x1d6')]=function(_0xa8f16f){logger['info'](util[_0xaef5('0x2c')](_0xaef5('0x1d7'),_0xa8f16f[_0xaef5('0x3b')]));if(!this['isConfigured'](_0xa8f16f[_0xaef5('0xde')])){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0xa8f16f,_0xaef5('0x1b7'));}var _0x47ba94=this[_0xaef5('0x13')][_0xaef5('0x75')](this,_0xa8f16f[_0xaef5('0xde')]);if(!_0x47ba94){return this[_0xaef5('0xf')][_0xaef5('0x30')](_0xa8f16f,_0xaef5('0xe0'));}var _0x3750fa=this['channel'][_0xaef5('0x13')](_0x47ba94);return{'code':0xc8,'result':_0x3750fa[_0xaef5('0xaa')]?_0x3750fa[_0xaef5('0xaa')]:'-'};};String[_0xaef5('0x12')][_0xaef5('0x1d8')]=function(_0x2ce131,_0x15e35c){return this[_0xaef5('0xa9')](_0x2ce131)[_0xaef5('0x1d9')](_0x15e35c);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c0b159c..6eb8976 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 _0x81bd=['YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','uniqueid','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x81bd,0x7c));var _0xd81b=function(_0x399e4b,_0x18206b){_0x399e4b=_0x399e4b-0x0;var _0x62d5ab=_0x81bd[_0x399e4b];return _0x62d5ab;};'use strict';var util=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var ami=require(_0xd81b('0x3'));var logger=require(_0xd81b('0x4'))(_0xd81b('0x5'));var RpcUser=require(_0xd81b('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x16e8de){this[_0xd81b('0x7')]=_0x16e8de[_0xd81b('0x7')];this['agents']=_0x16e8de[_0xd81b('0x8')];this[_0xd81b('0x9')]=_0x16e8de[_0xd81b('0x9')];this['channels']={};ami['on']('agentconnect',this[_0xd81b('0xa')]['bind'](this));ami['on'](_0xd81b('0xb'),this[_0xd81b('0xc')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0xe'),this[_0xd81b('0xf')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x10'),this[_0xd81b('0x11')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x12'),this[_0xd81b('0x13')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x14'),this['syncBlindTransfer'][_0xd81b('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xd81b('0x15')][_0xd81b('0xd')](this));}function getDiff(_0x5f0b6b){var _0x35a053=moment()['milliseconds'](0x0);var _0x13dd00=moment(_0x5f0b6b)[_0xd81b('0x16')](0x0);return _0x35a053[_0xd81b('0x17')](_0x13dd00,_0xd81b('0x18'));}Acw[_0xd81b('0x19')]['startAcw']=function(_0x1c620d){try{var _0x27b7a0=this;var _0x5c2863=this[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x1b')];var _0x4657cf=this[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x1c')];var _0xc49b8d=this[_0xd81b('0x7')][_0x4657cf];var _0x3d4d34=![];var _0x1c34c5=_0xd81b('0x1d');if(_0xc49b8d[_0xd81b('0x1e')]){if(_0xc49b8d[_0xd81b('0x1f')][_0xd81b('0x20')]){_0x3d4d34=!![];_0x1c34c5=_0xc49b8d[_0xd81b('0x1f')][_0xd81b('0x20')];}}ami[_0xd81b('0x21')]({'action':'QueuePause','interface':_0x5c2863,'paused':!![],'reason':_0x1c34c5})['then'](function(_0xc16ad0){if(_0x27b7a0[_0xd81b('0x8')][_0x5c2863]){return RpcUser[_0xd81b('0x22')](_0x27b7a0['agents'][_0x5c2863]['id'])[_0xd81b('0x23')](function(_0x6571a6){if(_0x6571a6&&!_0x6571a6['voicePause']){logger[_0xd81b('0x24')](_0xd81b('0x25'),_0x1c620d,_0x5c2863,_0x4657cf);var _0x1670cd=_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x26')]&&_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x27')]?_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x27')]:_0x1c620d;return RpcUser[_0xd81b('0x28')](_0x27b7a0[_0xd81b('0x8')][_0x5c2863],_0x1c34c5,_0x1670cd)[_0xd81b('0x23')](function(_0x596389){if(!_0x3d4d34){_0x27b7a0[_0xd81b('0x9')][_0x5c2863]={};logger[_0xd81b('0x24')](_0xd81b('0x29'),_0x1c620d,_0x27b7a0[_0xd81b('0x7')][_0x4657cf][_0xd81b('0x2a')],_0x5c2863,_0x4657cf);_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2b')]=setTimeout(_0x27b7a0[_0xd81b('0x2c')][_0xd81b('0xd')](_0x27b7a0,_0x5c2863),_0x27b7a0['voiceQueues'][_0x4657cf][_0xd81b('0x2a')]*0x3e8);_0x27b7a0['timers'][_0x5c2863]['lastPauseAt']=moment()[_0xd81b('0x2d')](_0xd81b('0x2e'));_0x27b7a0['timers'][_0x5c2863]['uniqueid']=_0x1c620d;_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x1c')]=_0x4657cf;_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2f')]=function(){var _0x1a1572=getDiff(_0x27b7a0[_0xd81b('0x9')][_0x5c2863]['lastPauseAt']);clearTimeout(_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2b')]);_0x27b7a0['timers'][_0x5c2863]['timer']=![];RpcVoiceAgentReport[_0xd81b('0x30')]({'acwtime':_0x1a1572},_0x27b7a0[_0xd81b('0x9')][_0x5c2863]['uniqueid'],_0x5c2863)['then'](function(_0x5317b2){logger[_0xd81b('0x24')](_0xd81b('0x31'),_0x1c620d,_0x1a1572,_0x5317b2);})[_0xd81b('0x32')](function(_0x1c4cf7){logger[_0xd81b('0x33')](_0xd81b('0x34'),_0x1c620d,_0x1c4cf7);});delete _0x27b7a0[_0xd81b('0x9')][_0x5c2863];};}});}else{logger['info'](_0xd81b('0x35'),_0x1c620d,_0x5c2863,_0x4657cf);}});}})['catch'](function(_0x34634a){logger[_0xd81b('0x33')](_0xd81b('0x29'),_0x1c620d,_0x27b7a0[_0xd81b('0x7')][_0x4657cf][_0xd81b('0x2a')],_0x5c2863,_0x4657cf);})[_0xd81b('0x36')](function(){delete _0x27b7a0[_0xd81b('0x1a')][_0x1c620d];});}catch(_0x2d23b9){logger[_0xd81b('0x33')](_0xd81b('0x37'),_0x2d23b9[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x2c')]=function(_0x57bc0c){try{var _0x49deb8=this;if(_0x49deb8[_0xd81b('0x9')][_0x57bc0c]){_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x2b')]=![];var _0x59c066=_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x39')];var _0x5a236a=_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x1c')];var _0x512e39=_0x49deb8[_0xd81b('0x7')][_0x5a236a]['acwTimeout'];logger[_0xd81b('0x24')](_0xd81b('0x3a'),_0x57bc0c);RpcUser[_0xd81b('0x3b')](this[_0xd81b('0x8')][_0x57bc0c]);RpcVoiceAgentReport['update']({'acwtime':_0x512e39,'agentacw':!![]},_0x59c066,_0x57bc0c)[_0xd81b('0x23')](function(_0x3444d4){logger[_0xd81b('0x24')](_0xd81b('0x31'),_0x59c066,_0x512e39,_0x3444d4);})[_0xd81b('0x32')](function(_0x466e98){logger[_0xd81b('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x59c066,_0x466e98);});}else{logger[_0xd81b('0x33')](_0xd81b('0x3c'),_0x57bc0c);if(_0x49deb8[_0xd81b('0x9')]){logger['info'](_0xd81b('0x3d'),JSON[_0xd81b('0x3e')](_0x49deb8[_0xd81b('0x9')]));}}}catch(_0x1cd745){logger[_0xd81b('0x33')]('[ACW][STOP]\x20%s',_0x1cd745[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0xa')]=function(_0x43ea38){try{if(this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]]&&(this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]][_0xd81b('0x5')]||this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]]['mandatoryDisposition'])){if(this[_0xd81b('0x8')][_0x43ea38[_0xd81b('0x1b')]]){this[_0xd81b('0x1a')][_0x43ea38[_0xd81b('0x39')]]={'queue':_0x43ea38[_0xd81b('0x1c')],'interface':_0x43ea38[_0xd81b('0x1b')],'destlinkedid':_0x43ea38[_0xd81b('0x27')]};}}}catch(_0x475bcf){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x475bcf[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x15')]=function(_0x222c5e){try{if(this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]]&&(this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]][_0xd81b('0x5')]||this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]][_0xd81b('0x1e')])){if(this['agents'][_0x222c5e[_0xd81b('0x1b')]]){this[_0xd81b('0x1a')][_0x222c5e[_0xd81b('0x39')]]={'queue':_0x222c5e[_0xd81b('0x1c')],'interface':_0x222c5e[_0xd81b('0x1b')]};}}}catch(_0x410ef3){logger[_0xd81b('0x33')](_0xd81b('0x3f'),_0x410ef3[_0xd81b('0x38')]);}};Acw['prototype'][_0xd81b('0xc')]=function(_0x2368dd){try{if(this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x39')]]&&_['isUndefined'](this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x39')]][_0xd81b('0x26')])){logger[_0xd81b('0x24')](_0xd81b('0x40'),_0x2368dd[_0xd81b('0x39')]);this[_0xd81b('0x41')](_0x2368dd[_0xd81b('0x39')]);}else if(this[_0xd81b('0x1a')][_0x2368dd['linkedid']]&&_['isUndefined'](this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x42')]][_0xd81b('0x26')])){logger[_0xd81b('0x24')](_0xd81b('0x43'),_0x2368dd[_0xd81b('0x42')]);this[_0xd81b('0x41')](_0x2368dd[_0xd81b('0x42')]);}}catch(_0x4e039e){logger[_0xd81b('0x33')](_0xd81b('0x44'),_0x4e039e[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0xf')]=function(_0x59b13b){try{if(this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x39')]]&&this['channels'][_0x59b13b[_0xd81b('0x39')]][_0xd81b('0x26')]){logger[_0xd81b('0x24')](_0xd81b('0x45'),_0x59b13b[_0xd81b('0x39')]);this[_0xd81b('0x41')](_0x59b13b[_0xd81b('0x39')]);}else if(this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x42')]]&&this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x42')]]['attended']){logger[_0xd81b('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x59b13b[_0xd81b('0x42')]);this[_0xd81b('0x41')](_0x59b13b[_0xd81b('0x42')]);}}catch(_0x3c2a9f){logger[_0xd81b('0x33')](_0xd81b('0x46'),_0x3c2a9f['message']);}};Acw[_0xd81b('0x19')][_0xd81b('0x13')]=function(_0x51f5a1){try{if(!_['isNil'](this[_0xd81b('0x1a')][_0x51f5a1['transfereeuniqueid']])){this[_0xd81b('0x41')](_0x51f5a1['transfereeuniqueid']);if(this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x47')]]){this[_0xd81b('0x1a')][_0x51f5a1['secondtransfereruniqueid']][_0xd81b('0x26')]=!![];this[_0xd81b('0x1a')][_0x51f5a1['transfertargetuniqueid']]=this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x47')]];delete this['channels'][_0x51f5a1[_0xd81b('0x47')]];}}else if(!_['isNil'](this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x48')]])){this[_0xd81b('0x41')](_0x51f5a1[_0xd81b('0x48')]);if(this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]]){this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]][_0xd81b('0x26')]=!![];this[_0xd81b('0x1a')][_0x51f5a1['transfereeuniqueid']]=this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]];delete this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]];}}}catch(_0x1bdf37){logger[_0xd81b('0x33')](_0xd81b('0x4a'),_0x1bdf37['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x2afe84){try{if(this[_0xd81b('0x1a')][_0x2afe84[_0xd81b('0x4b')]]){logger[_0xd81b('0x24')](_0xd81b('0x4c'),JSON[_0xd81b('0x3e')](_0x2afe84[_0xd81b('0x4b')]));this['startAcw'](_0x2afe84[_0xd81b('0x4b')]);}else if(this[_0xd81b('0x1a')][_0x2afe84[_0xd81b('0x4d')]]){logger[_0xd81b('0x24')](_0xd81b('0x4e'),JSON[_0xd81b('0x3e')](_0x2afe84[_0xd81b('0x4d')]));this['startAcw'](_0x2afe84[_0xd81b('0x4d')]);}}catch(_0x15f003){logger[_0xd81b('0x33')](_0xd81b('0x4f'),_0x15f003[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x11')]=function(_0x19d4f0){try{if(this[_0xd81b('0x7')][_0x19d4f0[_0xd81b('0x1c')]]&&this[_0xd81b('0x7')][_0x19d4f0[_0xd81b('0x1c')]]['autopause']===_0xd81b('0x50')){if(this['agents'][_0x19d4f0[_0xd81b('0x1b')]]){logger[_0xd81b('0x24')](_0xd81b('0x51'),_0x19d4f0[_0xd81b('0x39')],_0x19d4f0[_0xd81b('0x1b')],_0x19d4f0[_0xd81b('0x1c')]);return RpcUser[_0xd81b('0x28')](this[_0xd81b('0x8')][_0x19d4f0[_0xd81b('0x1b')]],_0xd81b('0x52'),_0x19d4f0['uniqueid']);}}}catch(_0xfa2a13){logger[_0xd81b('0x33')](_0xd81b('0x53'),_0xfa2a13[_0xd81b('0x38')]);}};module[_0xd81b('0x54')]=Acw; \ No newline at end of file +var _0x84ab=['attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x403206,_0x5364bf){var _0x2fcd6b=function(_0x1a82fd){while(--_0x1a82fd){_0x403206['push'](_0x403206['shift']());}};_0x2fcd6b(++_0x5364bf);}(_0x84ab,0x12f));var _0xb84a=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x84ab[_0x450bf9];return _0x268350;};'use strict';var util=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var ami=require(_0xb84a('0x3'));var logger=require(_0xb84a('0x4'))('acw');var RpcUser=require(_0xb84a('0x5'));var RpcVoiceAgentReport=require(_0xb84a('0x6'));function Acw(_0x47b8e3){this[_0xb84a('0x7')]=_0x47b8e3[_0xb84a('0x7')];this[_0xb84a('0x8')]=_0x47b8e3['agents'];this['timers']=_0x47b8e3['timers'];this[_0xb84a('0x9')]={};ami['on']('agentconnect',this[_0xb84a('0xa')][_0xb84a('0xb')](this));ami['on']('hanguprequest',this[_0xb84a('0xc')]['bind'](this));ami['on'](_0xb84a('0xd'),this[_0xb84a('0xe')][_0xb84a('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb84a('0xf'),this[_0xb84a('0x10')][_0xb84a('0xb')](this));ami['on'](_0xb84a('0x11'),this[_0xb84a('0x12')]['bind'](this));ami['on'](_0xb84a('0x13'),this[_0xb84a('0x14')][_0xb84a('0xb')](this));}function getDiff(_0x3c161c){var _0x44b26b=moment()[_0xb84a('0x15')](0x0);var _0x12ccab=moment(_0x3c161c)[_0xb84a('0x15')](0x0);return _0x44b26b[_0xb84a('0x16')](_0x12ccab,_0xb84a('0x17'));}Acw[_0xb84a('0x18')][_0xb84a('0x19')]=function(_0x5716bd){try{var _0x11dd4d=this;var _0x4a691d=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1a')];var _0x1c7378=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1b')];var _0x34d82f=this[_0xb84a('0x7')][_0x1c7378];var _0x3f7437=![];var _0x11d5a0=_0xb84a('0x1c');if(_0x34d82f[_0xb84a('0x1d')]){if(_0x34d82f[_0xb84a('0x1e')]['name']){_0x3f7437=!![];_0x11d5a0=_0x34d82f[_0xb84a('0x1e')][_0xb84a('0x1f')];}}ami['Action']({'action':_0xb84a('0x20'),'interface':_0x4a691d,'paused':!![],'reason':_0x11d5a0})[_0xb84a('0x21')](function(_0x42c788){if(_0x11dd4d[_0xb84a('0x8')][_0x4a691d]){return RpcUser['getAgent'](_0x11dd4d['agents'][_0x4a691d]['id'])[_0xb84a('0x21')](function(_0x19097d){if(_0x19097d&&!_0x19097d[_0xb84a('0x22')]){logger[_0xb84a('0x23')](_0xb84a('0x24'),_0x5716bd,_0x4a691d,_0x1c7378);var _0x3b8fb2=_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x25')]&&_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]?_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]:_0x5716bd;return RpcUser[_0xb84a('0x27')](_0x11dd4d[_0xb84a('0x8')][_0x4a691d],_0x11d5a0,_0x3b8fb2)[_0xb84a('0x21')](function(_0x3258a9){if(!_0x3f7437){_0x11dd4d[_0xb84a('0x28')][_0x4a691d]={};logger[_0xb84a('0x23')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d[_0xb84a('0x7')][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=setTimeout(_0x11dd4d[_0xb84a('0x2c')][_0xb84a('0xb')](_0x11dd4d,_0x4a691d),_0x11dd4d[_0xb84a('0x7')][_0x1c7378]['acwTimeout']*0x3e8);_0x11dd4d['timers'][_0x4a691d][_0xb84a('0x2d')]=moment()[_0xb84a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2f')]=_0x5716bd;_0x11dd4d['timers'][_0x4a691d]['queue']=_0x1c7378;_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x30')]=function(){var _0x49ba3d=getDiff(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2d')]);clearTimeout(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=![];RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x49ba3d},_0x11dd4d[_0xb84a('0x28')][_0x4a691d]['uniqueid'],_0x4a691d)[_0xb84a('0x21')](function(_0x5b794f){logger['info'](_0xb84a('0x32'),_0x5716bd,_0x49ba3d,_0x5b794f);})[_0xb84a('0x33')](function(_0x47a5b6){logger['error'](_0xb84a('0x34'),_0x5716bd,_0x47a5b6);});delete _0x11dd4d[_0xb84a('0x28')][_0x4a691d];};}});}else{logger[_0xb84a('0x23')](_0xb84a('0x35'),_0x5716bd,_0x4a691d,_0x1c7378);}});}})[_0xb84a('0x33')](function(_0x1d7ef1){logger[_0xb84a('0x36')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d['voiceQueues'][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);})[_0xb84a('0x37')](function(){delete _0x11dd4d[_0xb84a('0x9')][_0x5716bd];});}catch(_0xf894a6){logger[_0xb84a('0x36')](_0xb84a('0x38'),_0xf894a6[_0xb84a('0x39')]);}};Acw['prototype'][_0xb84a('0x2c')]=function(_0x56d783){try{var _0x1a3115=this;if(_0x1a3115[_0xb84a('0x28')][_0x56d783]){_0x1a3115[_0xb84a('0x28')][_0x56d783]['timer']=![];var _0x4af084=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x2f')];var _0x4a3737=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x1b')];var _0x4cb5d4=_0x1a3115[_0xb84a('0x7')][_0x4a3737][_0xb84a('0x2a')];logger['info'](_0xb84a('0x3a'),_0x56d783);RpcUser[_0xb84a('0x3b')](this[_0xb84a('0x8')][_0x56d783]);RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x4cb5d4,'agentacw':!![]},_0x4af084,_0x56d783)['then'](function(_0x57a1a8){logger['info'](_0xb84a('0x32'),_0x4af084,_0x4cb5d4,_0x57a1a8);})[_0xb84a('0x33')](function(_0x43a071){logger[_0xb84a('0x36')]('[%s][UPDATE][ERRORS:%s]',_0x4af084,_0x43a071);});}else{logger[_0xb84a('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x56d783);if(_0x1a3115[_0xb84a('0x28')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x1a3115[_0xb84a('0x28')]));}}}catch(_0x22791f){logger[_0xb84a('0x36')](_0xb84a('0x3c'),_0x22791f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0xa')]=function(_0x3908c3){try{if(this[_0xb84a('0x7')][_0x3908c3['queue']]&&(this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x1d')])){if(this[_0xb84a('0x8')][_0x3908c3[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x3908c3[_0xb84a('0x2f')]]={'queue':_0x3908c3[_0xb84a('0x1b')],'interface':_0x3908c3[_0xb84a('0x1a')],'destlinkedid':_0x3908c3[_0xb84a('0x26')]};}}}catch(_0xcd1e3b){logger[_0xb84a('0x36')](_0xb84a('0x3e'),_0xcd1e3b[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x14')]=function(_0x4ad7d0){try{if(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]]&&(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this[_0xb84a('0x7')][_0x4ad7d0['queue']][_0xb84a('0x1d')])){if(this['agents'][_0x4ad7d0[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x4ad7d0[_0xb84a('0x2f')]]={'queue':_0x4ad7d0[_0xb84a('0x1b')],'interface':_0x4ad7d0['interface']};}}}catch(_0x21ef72){logger[_0xb84a('0x36')](_0xb84a('0x3f'),_0x21ef72['message']);}};Acw['prototype'][_0xb84a('0xc')]=function(_0x10b0cc){try{if(this[_0xb84a('0x9')][_0x10b0cc['uniqueid']]&&_['isUndefined'](this['channels'][_0x10b0cc[_0xb84a('0x2f')]][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x40'),_0x10b0cc[_0xb84a('0x2f')]);this['startAcw'](_0x10b0cc['uniqueid']);}else if(this['channels'][_0x10b0cc['linkedid']]&&_[_0xb84a('0x41')](this[_0xb84a('0x9')][_0x10b0cc['linkedid']][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x42'),_0x10b0cc[_0xb84a('0x43')]);this[_0xb84a('0x19')](_0x10b0cc[_0xb84a('0x43')]);}}catch(_0x5a07d2){logger['error'](_0xb84a('0x44'),_0x5a07d2['message']);}};Acw[_0xb84a('0x18')]['syncHangup']=function(_0x575908){try{if(this['channels'][_0x575908[_0xb84a('0x2f')]]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x2f')]][_0xb84a('0x25')]){logger[_0xb84a('0x23')](_0xb84a('0x45'),_0x575908[_0xb84a('0x2f')]);this[_0xb84a('0x19')](_0x575908['uniqueid']);}else if(this['channels'][_0x575908['linkedid']]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x43')]]['attended']){logger[_0xb84a('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x575908['linkedid']);this['startAcw'](_0x575908[_0xb84a('0x43')]);}}catch(_0x172076){logger[_0xb84a('0x36')]('[ACW][syncHangup]\x20%s',_0x172076[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x10')]=function(_0x505994){try{if(!_[_0xb84a('0x46')](this['channels'][_0x505994['transfereeuniqueid']])){this[_0xb84a('0x19')](_0x505994['transfereeuniqueid']);if(this[_0xb84a('0x9')][_0x505994['secondtransfereruniqueid']]){this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994['transfertargetuniqueid']]=this['channels'][_0x505994['secondtransfereruniqueid']];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]];}}else if(!_['isNil'](this['channels'][_0x505994[_0xb84a('0x48')]])){this[_0xb84a('0x19')](_0x505994[_0xb84a('0x48')]);if(this['channels'][_0x505994[_0xb84a('0x49')]]){this[_0xb84a('0x9')][_0x505994['origtransfereruniqueid']][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994[_0xb84a('0x4a')]]=this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];}}}catch(_0x47c27f){logger[_0xb84a('0x36')](_0xb84a('0x4b'),_0x47c27f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0x12')]=function(_0x34ac0f){try{if(this[_0xb84a('0x9')][_0x34ac0f[_0xb84a('0x4c')]]){logger[_0xb84a('0x23')](_0xb84a('0x4d'),JSON[_0xb84a('0x4e')](_0x34ac0f[_0xb84a('0x4c')]));this['startAcw'](_0x34ac0f[_0xb84a('0x4c')]);}else if(this['channels'][_0x34ac0f['transfererlinkedid']]){logger[_0xb84a('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb84a('0x4e')](_0x34ac0f['transfererlinkedid']));this[_0xb84a('0x19')](_0x34ac0f[_0xb84a('0x4f')]);}}catch(_0x4c7d56){logger[_0xb84a('0x36')](_0xb84a('0x50'),_0x4c7d56[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x51')]=function(_0x192c9a){try{if(this[_0xb84a('0x7')][_0x192c9a['queue']]&&this[_0xb84a('0x7')][_0x192c9a['queue']]['autopause']===_0xb84a('0x52')){if(this[_0xb84a('0x8')][_0x192c9a[_0xb84a('0x1a')]]){logger[_0xb84a('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x192c9a['uniqueid'],_0x192c9a[_0xb84a('0x1a')],_0x192c9a[_0xb84a('0x1b')]);return RpcUser[_0xb84a('0x27')](this[_0xb84a('0x8')][_0x192c9a['interface']],_0xb84a('0x53'),_0x192c9a['uniqueid']);}}}catch(_0x1eec1f){logger['error'](_0xb84a('0x54'),_0x1eec1f['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5899ef2..5d5b2b0 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 _0xa49c=['exports','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','log','close'];(function(_0x30af1b,_0x4c9d2e){var _0x53b77b=function(_0x589a36){while(--_0x589a36){_0x30af1b['push'](_0x30af1b['shift']());}};_0x53b77b(++_0x4c9d2e);}(_0xa49c,0x141));var _0xca49=function(_0x3649d3,_0x283e04){_0x3649d3=_0x3649d3-0x0;var _0x44245a=_0xa49c[_0x3649d3];return _0x44245a;};'use strict';var Manager=require(_0xca49('0x0'));var BPromise=require(_0xca49('0x1'));var moment=require(_0xca49('0x2'));var util=require(_0xca49('0x3'));var _=require(_0xca49('0x4'));var logger=require('../../config/logger')(_0xca49('0x5'));var config=require(_0xca49('0x6'));var ami=new Manager(config['asterisk'][_0xca49('0x7')],config[_0xca49('0x8')]['ip'],config[_0xca49('0x8')][_0xca49('0x9')],config[_0xca49('0x8')][_0xca49('0xa')],!![]);ami[_0xca49('0xb')]();ami[_0xca49('0xc')]=BPromise['promisify'](ami[_0xca49('0xd')]);function error(_0x1900f8){logger[_0xca49('0xe')](util['format'](_0xca49('0xf'),config[_0xca49('0x8')]['username'],config['asterisk']['ip'],config['asterisk']['port'],util['inspect'](_0x1900f8,![],null)));}function close(){logger[_0xca49('0xe')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xca49('0x8')]['username'],config[_0xca49('0x8')]['ip'],config[_0xca49('0x8')]['port']));}ami[_0xca49('0x10')]=function(){return function(){return ami[_0xca49('0xc')]({'action':_0xca49('0x11')});};};ami[_0xca49('0x12')]=function(){return function(){return ami[_0xca49('0xc')]({'action':_0xca49('0x13')});};};ami[_0xca49('0x14')]=function(){return function(){return ami[_0xca49('0xc')]({'action':_0xca49('0x15')});};};ami[_0xca49('0x16')]=function(){return function(){return ami['Action']({'action':_0xca49('0x17')});};};ami[_0xca49('0x18')]=function(){return function(){return ami[_0xca49('0xc')]({'action':_0xca49('0x19')});};};function connect(_0x47e106){logger[_0xca49('0x1a')](util[_0xca49('0x1b')](_0xca49('0x1c'),config[_0xca49('0x8')][_0xca49('0x9')],config['asterisk']['ip'],config[_0xca49('0x8')][_0xca49('0x7')]));ami['once'](_0xca49('0xe'),error);ami[_0xca49('0x1d')]('close',close);}ami['on'](_0xca49('0x1e'),connect);ami['on'](_0xca49('0x1f'),function(_0x5238d5){logger['info'](util[_0xca49('0x1b')](_0xca49('0x20'),config['asterisk'][_0xca49('0x9')],config[_0xca49('0x8')]['ip'],config['asterisk'][_0xca49('0x7')],util['inspect'](_0x5238d5,![],null)));});ami['on'](_0xca49('0x21'),function(_0x344a5a){logger['info'](util[_0xca49('0x1b')](_0xca49('0x22'),config[_0xca49('0x8')]['username'],config[_0xca49('0x8')]['ip'],config[_0xca49('0x8')][_0xca49('0x7')]));return BPromise['resolve']()[_0xca49('0x23')](ami[_0xca49('0x10')]())['then'](ami['actionDeviceStateList']())[_0xca49('0x23')](ami[_0xca49('0x14')]())[_0xca49('0x23')](ami['actionQueueSummary']())[_0xca49('0x23')](ami['actionCoreShowChannels']())[_0xca49('0x24')](function(_0x4cbf83){console[_0xca49('0x25')](_0x4cbf83);});});ami[_0xca49('0x1d')](_0xca49('0xe'),error);ami[_0xca49('0x1d')](_0xca49('0x26'),close);module[_0xca49('0x27')]=ami; \ No newline at end of file +var _0xb753=['password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','port','asterisk','username'];(function(_0x4f37bc,_0x305757){var _0x2d0f5c=function(_0x168308){while(--_0x168308){_0x4f37bc['push'](_0x4f37bc['shift']());}};_0x2d0f5c(++_0x305757);}(_0xb753,0x8b));var _0x3b75=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0xb753[_0x18f152];return _0xa10b34;};'use strict';var Manager=require(_0x3b75('0x0'));var BPromise=require(_0x3b75('0x1'));var moment=require('moment');var util=require(_0x3b75('0x2'));var _=require(_0x3b75('0x3'));var logger=require(_0x3b75('0x4'))(_0x3b75('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x3b75('0x6')],config['asterisk']['ip'],config[_0x3b75('0x7')][_0x3b75('0x8')],config[_0x3b75('0x7')][_0x3b75('0x9')],!![]);ami[_0x3b75('0xa')]();ami[_0x3b75('0xb')]=BPromise[_0x3b75('0xc')](ami[_0x3b75('0xd')]);function error(_0x52c132){logger['error'](util[_0x3b75('0xe')](_0x3b75('0xf'),config[_0x3b75('0x7')][_0x3b75('0x8')],config['asterisk']['ip'],config['asterisk'][_0x3b75('0x6')],util[_0x3b75('0x10')](_0x52c132,![],null)));}function close(){logger['error'](util['format'](_0x3b75('0x11'),config['asterisk'][_0x3b75('0x8')],config[_0x3b75('0x7')]['ip'],config[_0x3b75('0x7')]['port']));}ami[_0x3b75('0x12')]=function(){return function(){return ami[_0x3b75('0xb')]({'action':_0x3b75('0x13')});};};ami[_0x3b75('0x14')]=function(){return function(){return ami[_0x3b75('0xb')]({'action':_0x3b75('0x15')});};};ami[_0x3b75('0x16')]=function(){return function(){return ami['Action']({'action':_0x3b75('0x17')});};};ami[_0x3b75('0x18')]=function(){return function(){return ami['Action']({'action':_0x3b75('0x19')});};};ami[_0x3b75('0x1a')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x69a345){logger[_0x3b75('0x1b')](util['format'](_0x3b75('0x1c'),config['asterisk'][_0x3b75('0x8')],config['asterisk']['ip'],config[_0x3b75('0x7')][_0x3b75('0x6')]));ami[_0x3b75('0x1d')]('error',error);ami[_0x3b75('0x1d')](_0x3b75('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x3b75('0x1f'),function(_0x7e16cf){logger[_0x3b75('0x1b')](util[_0x3b75('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x3b75('0x7')][_0x3b75('0x8')],config[_0x3b75('0x7')]['ip'],config[_0x3b75('0x7')][_0x3b75('0x6')],util[_0x3b75('0x10')](_0x7e16cf,![],null)));});ami['on'](_0x3b75('0x20'),function(_0x560145){logger[_0x3b75('0x1b')](util[_0x3b75('0xe')](_0x3b75('0x21'),config[_0x3b75('0x7')][_0x3b75('0x8')],config[_0x3b75('0x7')]['ip'],config[_0x3b75('0x7')][_0x3b75('0x6')]));return BPromise[_0x3b75('0x22')]()['then'](ami[_0x3b75('0x12')]())[_0x3b75('0x23')](ami[_0x3b75('0x14')]())[_0x3b75('0x23')](ami[_0x3b75('0x16')]())[_0x3b75('0x23')](ami[_0x3b75('0x18')]())[_0x3b75('0x23')](ami[_0x3b75('0x1a')]())['catch'](function(_0x5e8155){console[_0x3b75('0x24')](_0x5e8155);});});ami[_0x3b75('0x1d')]('error',error);ami[_0x3b75('0x1d')]('close',close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6530e16..a092cc4 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 _0x95a1=['rpc','message','result','catch','exports','jayson/promise','../../config/logger','ami','client','http','Request','request','then','debug','memberReport','error'];(function(_0x3b6d82,_0x346f1e){var _0x35cf06=function(_0x57fd53){while(--_0x57fd53){_0x3b6d82['push'](_0x3b6d82['shift']());}};_0x35cf06(++_0x346f1e);}(_0x95a1,0x165));var _0x195a=function(_0x5e99c9,_0x2d9a74){_0x5e99c9=_0x5e99c9-0x0;var _0x2e519d=_0x95a1[_0x5e99c9];return _0x2e519d;};'use strict';var jayson=require(_0x195a('0x0'));var BPromise=require('bluebird');var logger=require(_0x195a('0x1'))(_0x195a('0x2'));var client=jayson[_0x195a('0x3')][_0x195a('0x4')]({'port':0x2329});client[_0x195a('0x5')]=function(_0x4a67ce,_0x412612){return new BPromise(function(_0x1d5db9,_0xeb8bcf){return client[_0x195a('0x6')](_0x4a67ce,_0x412612)[_0x195a('0x7')](function(_0x51e129){logger[_0x195a('0x8')]('rpc',_0x195a('0x9'),_0x4a67ce,_0x412612,_0x51e129);if(_0x51e129['error']){logger[_0x195a('0xa')](_0x195a('0xb'),_0x195a('0x9'),_0x4a67ce,_0x51e129[_0x195a('0xa')][_0x195a('0xc')],_0x412612);return _0xeb8bcf(_0x51e129[_0x195a('0xa')]['message']);}else{return _0x1d5db9(_0x51e129[_0x195a('0xd')]);}})[_0x195a('0xe')](function(_0x3d4579){logger['error'](_0x195a('0xb'),_0x195a('0x9'),_0x4a67ce,_0x3d4579,_0x412612);return _0xeb8bcf(_0x3d4579);});});};module[_0x195a('0xf')]=client; \ No newline at end of file +var _0xaa65=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0xaa65,0x121));var _0x5aa6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa65[_0x14add3];return _0x4a174f;};'use strict';var jayson=require(_0x5aa6('0x0'));var BPromise=require(_0x5aa6('0x1'));var logger=require(_0x5aa6('0x2'))('ami');var client=jayson[_0x5aa6('0x3')][_0x5aa6('0x4')]({'port':0x2329});client[_0x5aa6('0x5')]=function(_0x153086,_0x5769da){return new BPromise(function(_0x2f0593,_0x393214){return client['request'](_0x153086,_0x5769da)[_0x5aa6('0x6')](function(_0x3a4257){logger[_0x5aa6('0x7')](_0x5aa6('0x8'),_0x5aa6('0x9'),_0x153086,_0x5769da,_0x3a4257);if(_0x3a4257['error']){logger['error'](_0x5aa6('0x8'),'memberReport',_0x153086,_0x3a4257[_0x5aa6('0xa')][_0x5aa6('0xb')],_0x5769da);return _0x393214(_0x3a4257[_0x5aa6('0xa')][_0x5aa6('0xb')]);}else{return _0x2f0593(_0x3a4257[_0x5aa6('0xc')]);}})[_0x5aa6('0xd')](function(_0x4cb8c8){logger[_0x5aa6('0xa')](_0x5aa6('0x8'),'memberReport',_0x153086,_0x4cb8c8,_0x5769da);return _0x393214(_0x4cb8c8);});});};module[_0x5aa6('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 56ab12e..20c9ba2 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 _0x8a0d=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','moment','string','voiceQueue','name','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x56890c,_0x575817){var _0x250846=function(_0xdc11dd){while(--_0xdc11dd){_0x56890c['push'](_0x56890c['shift']());}};_0x250846(++_0x575817);}(_0x8a0d,0x156));var _0xd8a0=function(_0x17c896,_0x3cad2d){_0x17c896=_0x17c896-0x0;var _0x1afa73=_0x8a0d[_0x17c896];return _0x1afa73;};'use strict';var util=require(_0xd8a0('0x0'));var _=require('lodash');var moment=require(_0xd8a0('0x1'));function checkNameSurname(_0x470cf8,_0x3305f3,_0x5171a0){var _0x200ef5='';if(!_['isNil'](_0x3305f3)&&_0xd8a0('0x2')===typeof _0x3305f3){_0x200ef5+=_0x3305f3;}if(!_['isNil'](_0x5171a0)&&_0xd8a0('0x2')===typeof _0x5171a0){_0x200ef5+='\x20'+_0x5171a0;}if(_0x200ef5!==''){return _0x200ef5;}return _0x470cf8;}function Action(_0x349b49,_0x33a302,_0x3433db){this[_0xd8a0('0x3')]=_0x349b49;this['uniqueid']=_0x3433db||undefined;this[_0xd8a0('0x4')]=checkNameSurname(_0x33a302[_0xd8a0('0x5')]['phone'],_0x33a302[_0xd8a0('0x5')][_0xd8a0('0x6')],_0x33a302[_0xd8a0('0x5')][_0xd8a0('0x7')]);this[_0xd8a0('0x8')]=_0x33a302[_0xd8a0('0x5')]['phone'];this[_0xd8a0('0x9')]=_0x349b49[_0xd8a0('0x4')];this[_0xd8a0('0xa')]=_0x33a302[_0xd8a0('0xa')]||![];this[_0xd8a0('0xb')]=_0x349b49['type'];this['dialQueueTimeout']=_0x349b49[_0xd8a0('0xc')]||0x3;this['scheduledat']=_0x33a302[_0xd8a0('0xd')];this[_0xd8a0('0xe')]=_0x33a302['countbusyretry'];this['countcongestionretry']=_0x33a302[_0xd8a0('0xf')];this['countnoanswerretry']=_0x33a302[_0xd8a0('0x10')];this[_0xd8a0('0x11')]=_0x33a302['countnosuchnumberretry'];this['countdropretry']=_0x33a302[_0xd8a0('0x12')];this[_0xd8a0('0x13')]=_0x33a302[_0xd8a0('0x13')];this['countmachineretry']=_0x33a302[_0xd8a0('0x14')];this[_0xd8a0('0x15')]=_0x33a302[_0xd8a0('0x15')];this['ContactId']=_0x33a302[_0xd8a0('0x16')];this[_0xd8a0('0x17')]=_0x33a302['ListId'];this[_0xd8a0('0x18')]=_0x33a302['UserId'];this['VoiceQueueId']=_0x33a302[_0xd8a0('0x19')];this['CampaignId']=_0x33a302[_0xd8a0('0x1a')];this[_0xd8a0('0x1b')]=_0x33a302['id'];this[_0xd8a0('0x1c')]=_0x33a302[_0xd8a0('0x5')][_0xd8a0('0x6')]||'';this[_0xd8a0('0x1d')]=moment()['format'](_0xd8a0('0x1e'));this[_0xd8a0('0x1f')]=_0x33a302[_0xd8a0('0x1f')];this[_0xd8a0('0x20')]=_0x33a302[_0xd8a0('0x20')];this[_0xd8a0('0x21')]=_0x33a302[_0xd8a0('0x21')];this[_0xd8a0('0x22')]=_0x33a302[_0xd8a0('0x22')];this[_0xd8a0('0x23')]='';this[_0xd8a0('0x24')]='';}Action[_0xd8a0('0x25')][_0xd8a0('0x26')]=function(){return util[_0xd8a0('0x27')](_0xd8a0('0x28'),this[_0xd8a0('0x4')],this['voiceQueue'][_0xd8a0('0x29')]>0x0?this[_0xd8a0('0x8')][_0xd8a0('0x2a')](this[_0xd8a0('0x3')][_0xd8a0('0x29')]):this[_0xd8a0('0x8')]);};Action[_0xd8a0('0x25')][_0xd8a0('0x2b')]=function(){return this['queue'];};module[_0xd8a0('0x2c')]=Action; \ No newline at end of file +var _0x7be1=['voiceQueue','number','getQueue','queue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x7be1,0x165));var _0x17be=function(_0xf66a25,_0x527689){_0xf66a25=_0xf66a25-0x0;var _0x231422=_0x7be1[_0xf66a25];return _0x231422;};'use strict';var util=require(_0x17be('0x0'));var _=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));function checkNameSurname(_0x5ec6c0,_0x295843,_0x343ec5){var _0x740a8='';if(!_[_0x17be('0x3')](_0x295843)&&_0x17be('0x4')===typeof _0x295843){_0x740a8+=_0x295843;}if(!_['isNil'](_0x343ec5)&&'string'===typeof _0x343ec5){_0x740a8+='\x20'+_0x343ec5;}if(_0x740a8!==''){return _0x740a8;}return _0x5ec6c0;}function Action(_0x55257a,_0x2fed12,_0x40f3f9){this['voiceQueue']=_0x55257a;this[_0x17be('0x5')]=_0x40f3f9||undefined;this[_0x17be('0x6')]=checkNameSurname(_0x2fed12[_0x17be('0x7')][_0x17be('0x8')],_0x2fed12[_0x17be('0x7')][_0x17be('0x9')],_0x2fed12['Contact'][_0x17be('0xa')]);this['number']=_0x2fed12[_0x17be('0x7')][_0x17be('0x8')];this['queue']=_0x55257a[_0x17be('0x6')];this[_0x17be('0xb')]=_0x2fed12[_0x17be('0xb')]||![];this[_0x17be('0xc')]=_0x55257a['type'];this[_0x17be('0xd')]=_0x55257a['dialQueueTimeout']||0x3;this[_0x17be('0xe')]=_0x2fed12['scheduledat'];this[_0x17be('0xf')]=_0x2fed12[_0x17be('0xf')];this[_0x17be('0x10')]=_0x2fed12[_0x17be('0x10')];this[_0x17be('0x11')]=_0x2fed12['countnoanswerretry'];this[_0x17be('0x12')]=_0x2fed12['countnosuchnumberretry'];this['countdropretry']=_0x2fed12[_0x17be('0x13')];this['countabandonedretry']=_0x2fed12[_0x17be('0x14')];this['countmachineretry']=_0x2fed12[_0x17be('0x15')];this[_0x17be('0x16')]=_0x2fed12['countagentrejectretry'];this[_0x17be('0x17')]=_0x2fed12['ContactId'];this[_0x17be('0x18')]=_0x2fed12['ListId'];this[_0x17be('0x19')]=_0x2fed12[_0x17be('0x19')];this[_0x17be('0x1a')]=_0x2fed12[_0x17be('0x1a')];this[_0x17be('0x1b')]=_0x2fed12['CampaignId'];this[_0x17be('0x1c')]=_0x2fed12['id'];this[_0x17be('0x1d')]=_0x2fed12[_0x17be('0x7')][_0x17be('0x9')]||'';this['starttime']=moment()[_0x17be('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x2fed12[_0x17be('0x1f')];this[_0x17be('0x20')]=_0x2fed12[_0x17be('0x20')];this[_0x17be('0x21')]=_0x2fed12['callbackat'];this[_0x17be('0x22')]=_0x2fed12[_0x17be('0x22')];this['originatecalleridnum']='';this[_0x17be('0x23')]='';}Action['prototype'][_0x17be('0x24')]=function(){return util[_0x17be('0x1e')](_0x17be('0x25'),this[_0x17be('0x6')],this['voiceQueue'][_0x17be('0x26')]>0x0?this['number']['substring'](this[_0x17be('0x27')]['dialCutDigit']):this[_0x17be('0x28')]);};Action['prototype'][_0x17be('0x29')]=function(){return this[_0x17be('0x2a')];};module[_0x17be('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 2e2ae14..cd4588d 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 _0x07ec=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','reason','callback','callbackuniqueid'];(function(_0x4fcad5,_0x258deb){var _0x1dec8a=function(_0x3ac9f9){while(--_0x3ac9f9){_0x4fcad5['push'](_0x4fcad5['shift']());}};_0x1dec8a(++_0x258deb);}(_0x07ec,0xb9));var _0xc07e=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x07ec[_0x54c9dd];return _0x855156;};'use strict';var util=require('util');var _=require(_0xc07e('0x0'));var moment=require('moment');function getSeconds(_0x5c3c21,_0x402029){var _0x3e5cd8=moment(_0x5c3c21)[_0xc07e('0x1')](0x0);var _0x409ae6=moment(_0x402029)[_0xc07e('0x1')](0x0);return _0x3e5cd8[_0xc07e('0x2')](_0x409ae6,_0xc07e('0x3'));}function AgentComplete(_0x566e72,_0x1e355d){this[_0xc07e('0x4')]=0x4;this[_0xc07e('0x5')]='Answer';this[_0xc07e('0x6')]=_0x566e72['scheduledat'];this[_0xc07e('0x7')]=_0x566e72['type'];this[_0xc07e('0x8')]=_0x566e72['type']===_0xc07e('0x9')?_0xc07e('0xa'):_0x566e72[_0xc07e('0x7')];this['countbusyretry']=_0x566e72[_0xc07e('0xb')];this[_0xc07e('0xc')]=_0x566e72[_0xc07e('0xc')];this[_0xc07e('0xd')]=_0x566e72[_0xc07e('0xd')];this[_0xc07e('0xe')]=_0x566e72[_0xc07e('0xb')]+_0x566e72['countcongestionretry']+_0x566e72[_0xc07e('0xd')]+_0x566e72[_0xc07e('0xf')]+_0x566e72[_0xc07e('0x10')]+_0x566e72[_0xc07e('0x11')]+_0x566e72[_0xc07e('0x12')]+_0x566e72[_0xc07e('0x13')];this[_0xc07e('0xf')]=_0x566e72[_0xc07e('0xf')];this[_0xc07e('0x10')]=_0x566e72[_0xc07e('0x10')];this['countabandonedretry']=_0x566e72['countabandonedretry'];this[_0xc07e('0x12')]=_0x566e72[_0xc07e('0x12')];this[_0xc07e('0x13')]=_0x566e72[_0xc07e('0x13')];this[_0xc07e('0x14')]=_0x1e355d[_0xc07e('0x14')];this[_0xc07e('0x15')]=_0x566e72[_0xc07e('0x16')];this[_0xc07e('0x17')]=_0x566e72['number'];this[_0xc07e('0x18')]=_0x566e72['starttime'];this[_0xc07e('0x19')]=_0x566e72[_0xc07e('0x19')];this[_0xc07e('0x1a')]=_0x566e72[_0xc07e('0x1a')];this[_0xc07e('0x1b')]=moment()[_0xc07e('0x1c')](_0xc07e('0x1d'));this['ringtime']=getSeconds(_0x566e72[_0xc07e('0x19')],_0x566e72['starttime']);this['holdtime']=getSeconds(_0x566e72[_0xc07e('0x1a')],_0x566e72[_0xc07e('0x19')]);this[_0xc07e('0x1e')]=getSeconds(this[_0xc07e('0x1b')],_0x566e72[_0xc07e('0x1a')]);this['queue']=_0x1e355d[_0xc07e('0xa')];this[_0xc07e('0x1f')]=_0x1e355d[_0xc07e('0x1f')];this[_0xc07e('0x20')]=_0x1e355d[_0xc07e('0x20')];this['callback']=_0x566e72[_0xc07e('0x21')];this['callbackuniqueid']=_0x566e72[_0xc07e('0x22')];this[_0xc07e('0x23')]=_0x566e72[_0xc07e('0x23')];this[_0xc07e('0x24')]=_0x566e72[_0xc07e('0x24')];this[_0xc07e('0x25')]=_0x566e72['ContactId'];this[_0xc07e('0x26')]=_0x566e72['ListId'];this[_0xc07e('0x27')]=_0x566e72[_0xc07e('0x27')];this['VoiceQueueId']=_0x566e72[_0xc07e('0x28')];this['CampaignId']=_0x566e72['CampaignId'];this[_0xc07e('0x29')]=_0x566e72[_0xc07e('0x29')]||'';this[_0xc07e('0x2a')]=_0x566e72[_0xc07e('0x2a')]||'';}module[_0xc07e('0x2b')]=AgentComplete; \ No newline at end of file +var _0x0bf7=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat'];(function(_0x1f2cd3,_0x275010){var _0x165869=function(_0x70a5ee){while(--_0x70a5ee){_0x1f2cd3['push'](_0x1f2cd3['shift']());}};_0x165869(++_0x275010);}(_0x0bf7,0xd3));var _0x70bf=function(_0x45c5f0,_0x1822c7){_0x45c5f0=_0x45c5f0-0x0;var _0x4108af=_0x0bf7[_0x45c5f0];return _0x4108af;};'use strict';var util=require(_0x70bf('0x0'));var _=require(_0x70bf('0x1'));var moment=require(_0x70bf('0x2'));function getSeconds(_0x3ea430,_0x3f2453){var _0x181ad5=moment(_0x3ea430)[_0x70bf('0x3')](0x0);var _0xa2814a=moment(_0x3f2453)[_0x70bf('0x3')](0x0);return _0x181ad5[_0x70bf('0x4')](_0xa2814a,'seconds');}function AgentComplete(_0x187bfd,_0x2fe67d){this[_0x70bf('0x5')]=0x4;this[_0x70bf('0x6')]=_0x70bf('0x7');this[_0x70bf('0x8')]=_0x187bfd[_0x70bf('0x8')];this[_0x70bf('0x9')]=_0x187bfd['type'];this[_0x70bf('0xa')]=_0x187bfd[_0x70bf('0x9')]==='outbound'?_0x70bf('0xb'):_0x187bfd[_0x70bf('0x9')];this[_0x70bf('0xc')]=_0x187bfd[_0x70bf('0xc')];this[_0x70bf('0xd')]=_0x187bfd[_0x70bf('0xd')];this[_0x70bf('0xe')]=_0x187bfd[_0x70bf('0xe')];this['countglobal']=_0x187bfd[_0x70bf('0xc')]+_0x187bfd[_0x70bf('0xd')]+_0x187bfd[_0x70bf('0xe')]+_0x187bfd[_0x70bf('0xf')]+_0x187bfd[_0x70bf('0x10')]+_0x187bfd[_0x70bf('0x11')]+_0x187bfd['countmachineretry']+_0x187bfd[_0x70bf('0x12')];this[_0x70bf('0xf')]=_0x187bfd[_0x70bf('0xf')];this['countdropretry']=_0x187bfd['countdropretry'];this[_0x70bf('0x11')]=_0x187bfd[_0x70bf('0x11')];this[_0x70bf('0x13')]=_0x187bfd[_0x70bf('0x13')];this['countagentrejectretry']=_0x187bfd[_0x70bf('0x12')];this['uniqueid']=_0x2fe67d[_0x70bf('0x14')];this[_0x70bf('0x15')]=_0x187bfd['name'];this[_0x70bf('0x16')]=_0x187bfd['number'];this['starttime']=_0x187bfd[_0x70bf('0x17')];this[_0x70bf('0x18')]=_0x187bfd[_0x70bf('0x18')];this[_0x70bf('0x19')]=_0x187bfd['answertime'];this[_0x70bf('0x1a')]=moment()[_0x70bf('0x1b')](_0x70bf('0x1c'));this[_0x70bf('0x1d')]=getSeconds(_0x187bfd['responsetime'],_0x187bfd[_0x70bf('0x17')]);this[_0x70bf('0x1e')]=getSeconds(_0x187bfd[_0x70bf('0x19')],_0x187bfd[_0x70bf('0x18')]);this['talktime']=getSeconds(this['endtime'],_0x187bfd[_0x70bf('0x19')]);this[_0x70bf('0xb')]=_0x2fe67d['queue'];this[_0x70bf('0x1f')]=_0x2fe67d[_0x70bf('0x1f')];this[_0x70bf('0x20')]=_0x2fe67d[_0x70bf('0x20')];this[_0x70bf('0x21')]=_0x187bfd[_0x70bf('0x21')];this[_0x70bf('0x22')]=_0x187bfd['callbackuniqueid'];this[_0x70bf('0x23')]=_0x187bfd[_0x70bf('0x23')];this[_0x70bf('0x24')]=_0x187bfd[_0x70bf('0x24')];this['ContactId']=_0x187bfd[_0x70bf('0x25')];this['ListId']=_0x187bfd[_0x70bf('0x26')];this[_0x70bf('0x27')]=_0x187bfd[_0x70bf('0x27')];this[_0x70bf('0x28')]=_0x187bfd[_0x70bf('0x28')];this[_0x70bf('0x29')]=_0x187bfd[_0x70bf('0x29')];this[_0x70bf('0x2a')]=_0x187bfd[_0x70bf('0x2a')]||'';this[_0x70bf('0x2b')]=_0x187bfd[_0x70bf('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index c5db03f..7e7934d 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 _0xa334=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa334,0x143));var _0x4a33=function(_0x3db354,_0x5fc12d){_0x3db354=_0x3db354-0x0;var _0x56b55c=_0xa334[_0x3db354];return _0x56b55c;};'use strict';var util=require(_0x4a33('0x0'));var _=require(_0x4a33('0x1'));var moment=require('moment');function getSeconds(_0x3fd3bf,_0x50b549){var _0x18a15c=moment(_0x3fd3bf)[_0x4a33('0x2')](0x0);var _0xf93d0e=moment(_0x50b549)[_0x4a33('0x2')](0x0);return _0x18a15c[_0x4a33('0x3')](_0xf93d0e,_0x4a33('0x4'));}function Final(_0x438a53){this[_0x4a33('0x5')]=_0x438a53['uniqueid'];this[_0x4a33('0x6')]=_0x438a53[_0x4a33('0x6')];this[_0x4a33('0x7')]=_0x438a53['type'];this[_0x4a33('0x8')]=_0x438a53['type']===_0x4a33('0x9')?'queue':_0x438a53['type'];this[_0x4a33('0xa')]=_0x438a53['countbusyretry'];this[_0x4a33('0xb')]=_0x438a53[_0x4a33('0xb')];this['countnoanswerretry']=_0x438a53[_0x4a33('0xc')];this['countglobal']=_0x438a53[_0x4a33('0xa')]+_0x438a53[_0x4a33('0xb')]+_0x438a53[_0x4a33('0xc')]+_0x438a53[_0x4a33('0xd')]+_0x438a53[_0x4a33('0xe')]+_0x438a53[_0x4a33('0xf')]+_0x438a53['countmachineretry']+_0x438a53[_0x4a33('0x10')];this['countnosuchnumberretry']=_0x438a53[_0x4a33('0xd')];this[_0x4a33('0xe')]=_0x438a53['countdropretry'];this[_0x4a33('0xf')]=_0x438a53[_0x4a33('0xf')];this[_0x4a33('0x11')]=_0x438a53[_0x4a33('0x11')];this[_0x4a33('0x10')]=_0x438a53[_0x4a33('0x10')];this['queue']=_0x438a53[_0x4a33('0x12')];this[_0x4a33('0x13')]=_0x438a53[_0x4a33('0x13')];this[_0x4a33('0x14')]=_0x438a53['calleridnum'];this[_0x4a33('0x15')]=_0x438a53[_0x4a33('0x15')];this[_0x4a33('0x16')]=_0x438a53['responsetime'];this['endtime']=_0x438a53[_0x4a33('0x16')];this[_0x4a33('0x17')]=_0x438a53['ringtime']||0x0;this[_0x4a33('0x18')]=_0x438a53[_0x4a33('0x18')]||0x0;this[_0x4a33('0x19')]=_0x438a53[_0x4a33('0x19')]||0x0;this[_0x4a33('0x1a')]=_0x438a53[_0x4a33('0x1a')];this[_0x4a33('0x1b')]=_0x438a53['callbackuniqueid'];this['callbackat']=_0x438a53[_0x4a33('0x1c')];this['recallme']=_0x438a53[_0x4a33('0x1d')];this[_0x4a33('0x1e')]=_0x438a53['ContactId'];this[_0x4a33('0x1f')]=_0x438a53['ListId'];this[_0x4a33('0x20')]=_0x438a53[_0x4a33('0x20')];this['VoiceQueueId']=_0x438a53['VoiceQueueId'];this[_0x4a33('0x21')]=_0x438a53[_0x4a33('0x21')];this[_0x4a33('0x22')]=_0x438a53[_0x4a33('0x22')]||'';this[_0x4a33('0x23')]=_0x438a53[_0x4a33('0x23')]||'';}module[_0x4a33('0x24')]=Final; \ No newline at end of file +var _0xb5c6=['campaigntype','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','uniqueid','scheduledat','type'];(function(_0x496783,_0x28d071){var _0x314c57=function(_0x1de6bf){while(--_0x1de6bf){_0x496783['push'](_0x496783['shift']());}};_0x314c57(++_0x28d071);}(_0xb5c6,0x1e9));var _0x6b5c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb5c6[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x6b5c('0x0'));var _=require('lodash');var moment=require(_0x6b5c('0x1'));function getSeconds(_0x531983,_0x248e15){var _0x447559=moment(_0x531983)[_0x6b5c('0x2')](0x0);var _0xbd6aed=moment(_0x248e15)[_0x6b5c('0x2')](0x0);return _0x447559['diff'](_0xbd6aed,'seconds');}function Final(_0x46ff97){this[_0x6b5c('0x3')]=_0x46ff97['uniqueid'];this['scheduledat']=_0x46ff97[_0x6b5c('0x4')];this['type']=_0x46ff97[_0x6b5c('0x5')];this[_0x6b5c('0x6')]=_0x46ff97['type']==='outbound'?'queue':_0x46ff97[_0x6b5c('0x5')];this[_0x6b5c('0x7')]=_0x46ff97['countbusyretry'];this[_0x6b5c('0x8')]=_0x46ff97[_0x6b5c('0x8')];this['countnoanswerretry']=_0x46ff97['countnoanswerretry'];this[_0x6b5c('0x9')]=_0x46ff97[_0x6b5c('0x7')]+_0x46ff97[_0x6b5c('0x8')]+_0x46ff97[_0x6b5c('0xa')]+_0x46ff97['countnosuchnumberretry']+_0x46ff97['countdropretry']+_0x46ff97['countabandonedretry']+_0x46ff97['countmachineretry']+_0x46ff97[_0x6b5c('0xb')];this[_0x6b5c('0xc')]=_0x46ff97[_0x6b5c('0xc')];this['countdropretry']=_0x46ff97['countdropretry'];this[_0x6b5c('0xd')]=_0x46ff97['countabandonedretry'];this[_0x6b5c('0xe')]=_0x46ff97[_0x6b5c('0xe')];this['countagentrejectretry']=_0x46ff97[_0x6b5c('0xb')];this['queue']=_0x46ff97['queue'];this['calleridname']=_0x46ff97[_0x6b5c('0xf')];this[_0x6b5c('0x10')]=_0x46ff97[_0x6b5c('0x10')];this[_0x6b5c('0x11')]=_0x46ff97[_0x6b5c('0x11')];this[_0x6b5c('0x12')]=_0x46ff97['responsetime'];this[_0x6b5c('0x13')]=_0x46ff97[_0x6b5c('0x12')];this[_0x6b5c('0x14')]=_0x46ff97['ringtime']||0x0;this[_0x6b5c('0x15')]=_0x46ff97[_0x6b5c('0x15')]||0x0;this['talktime']=_0x46ff97[_0x6b5c('0x16')]||0x0;this['callback']=_0x46ff97['callback'];this[_0x6b5c('0x17')]=_0x46ff97[_0x6b5c('0x17')];this[_0x6b5c('0x18')]=_0x46ff97[_0x6b5c('0x18')];this[_0x6b5c('0x19')]=_0x46ff97[_0x6b5c('0x19')];this[_0x6b5c('0x1a')]=_0x46ff97[_0x6b5c('0x1a')];this['ListId']=_0x46ff97['ListId'];this[_0x6b5c('0x1b')]=_0x46ff97[_0x6b5c('0x1b')];this[_0x6b5c('0x1c')]=_0x46ff97[_0x6b5c('0x1c')];this[_0x6b5c('0x1d')]=_0x46ff97[_0x6b5c('0x1d')];this[_0x6b5c('0x1e')]=_0x46ff97[_0x6b5c('0x1e')]||'';this[_0x6b5c('0x1f')]=_0x46ff97['originatecalleridname']||'';}module[_0x6b5c('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 7be9910..d104371 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 _0x7112=['membername','IVR','reason','callback','callbackuniqueid','recallme','ContactId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','responsetime'];(function(_0x56aac6,_0x5bd6f0){var _0x448cb3=function(_0x5e6435){while(--_0x5e6435){_0x56aac6['push'](_0x56aac6['shift']());}};_0x448cb3(++_0x5bd6f0);}(_0x7112,0xe1));var _0x2711=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7112[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x2711('0x0'));var _=require(_0x2711('0x1'));var moment=require('moment');function getSeconds(_0x2015f0,_0x4376af){var _0x38d226=moment(_0x2015f0)['milliseconds'](0x0);var _0x462c64=moment(_0x4376af)[_0x2711('0x2')](0x0);return _0x38d226[_0x2711('0x3')](_0x462c64,_0x2711('0x4'));}function Hangup(_0x3f75d0,_0x595395){this[_0x2711('0x5')]=0x4;this[_0x2711('0x6')]=_0x2711('0x7');this[_0x2711('0x8')]=_0x3f75d0[_0x2711('0x8')];this[_0x2711('0x9')]=_0x3f75d0[_0x2711('0x9')];this[_0x2711('0xa')]=_0x3f75d0[_0x2711('0x9')]===_0x2711('0xb')?_0x2711('0xc'):_0x3f75d0['type'];this['countbusyretry']=_0x3f75d0[_0x2711('0xd')];this['countcongestionretry']=_0x3f75d0[_0x2711('0xe')];this[_0x2711('0xf')]=_0x3f75d0[_0x2711('0xf')];this[_0x2711('0x10')]=_0x3f75d0['countbusyretry']+_0x3f75d0[_0x2711('0xe')]+_0x3f75d0[_0x2711('0xf')]+_0x3f75d0[_0x2711('0x11')]+_0x3f75d0[_0x2711('0x12')]+_0x3f75d0[_0x2711('0x13')]+_0x3f75d0['countmachineretry']+_0x3f75d0[_0x2711('0x14')];this[_0x2711('0x11')]=_0x3f75d0['countnosuchnumberretry'];this['countdropretry']=_0x3f75d0[_0x2711('0x12')];this[_0x2711('0x13')]=_0x3f75d0['countabandonedretry'];this[_0x2711('0x15')]=_0x3f75d0[_0x2711('0x15')];this[_0x2711('0x14')]=_0x3f75d0['countagentrejectretry'];this[_0x2711('0x16')]=_0x595395[_0x2711('0x16')];this[_0x2711('0x17')]=_0x3f75d0[_0x2711('0x18')];this['calleridnum']=_0x3f75d0[_0x2711('0x19')];this[_0x2711('0x1a')]=_0x3f75d0[_0x2711('0x1a')];this['responsetime']=_0x3f75d0['responsetime'];this['endtime']=moment()['format'](_0x2711('0x1b'));this[_0x2711('0x1c')]=getSeconds(_0x3f75d0['responsetime'],_0x3f75d0[_0x2711('0x1a')]);this[_0x2711('0x1d')]=0x0;this[_0x2711('0x1e')]=getSeconds(this[_0x2711('0x1f')],_0x3f75d0[_0x2711('0x20')]);this[_0x2711('0xc')]=_0x3f75d0[_0x2711('0xc')];this[_0x2711('0x21')]=_0x2711('0x22');this[_0x2711('0x23')]=_0x595395['cause-txt'];this[_0x2711('0x24')]=_0x3f75d0['callback'];this['callbackuniqueid']=_0x3f75d0[_0x2711('0x25')];this['callbackat']=_0x3f75d0['callbackat'];this['recallme']=_0x3f75d0[_0x2711('0x26')];this[_0x2711('0x27')]=_0x3f75d0[_0x2711('0x27')];this['ListId']=_0x3f75d0['ListId'];this[_0x2711('0x28')]=_0x3f75d0[_0x2711('0x28')];this[_0x2711('0x29')]=_0x3f75d0[_0x2711('0x29')];this[_0x2711('0x2a')]=_0x3f75d0[_0x2711('0x2a')];}module['exports']=Hangup; \ No newline at end of file +var _0x23b6=['callbackuniqueid','callbackat','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','queue','membername','reason','cause-txt','callback'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x23b6,0xab));var _0x623b=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x23b6[_0x273c39];return _0x46d6b5;};'use strict';var util=require(_0x623b('0x0'));var _=require(_0x623b('0x1'));var moment=require('moment');function getSeconds(_0x25e5ca,_0x2e1a26){var _0x22207c=moment(_0x25e5ca)[_0x623b('0x2')](0x0);var _0x279ae7=moment(_0x2e1a26)[_0x623b('0x2')](0x0);return _0x22207c['diff'](_0x279ae7,_0x623b('0x3'));}function Hangup(_0x206d20,_0x3ff448){this[_0x623b('0x4')]=0x4;this[_0x623b('0x5')]=_0x623b('0x6');this['scheduledat']=_0x206d20[_0x623b('0x7')];this[_0x623b('0x8')]=_0x206d20[_0x623b('0x8')];this[_0x623b('0x9')]=_0x206d20[_0x623b('0x8')]===_0x623b('0xa')?'queue':_0x206d20[_0x623b('0x8')];this[_0x623b('0xb')]=_0x206d20[_0x623b('0xb')];this[_0x623b('0xc')]=_0x206d20[_0x623b('0xc')];this['countnoanswerretry']=_0x206d20[_0x623b('0xd')];this['countglobal']=_0x206d20['countbusyretry']+_0x206d20[_0x623b('0xc')]+_0x206d20[_0x623b('0xd')]+_0x206d20['countnosuchnumberretry']+_0x206d20[_0x623b('0xe')]+_0x206d20[_0x623b('0xf')]+_0x206d20[_0x623b('0x10')]+_0x206d20[_0x623b('0x11')];this[_0x623b('0x12')]=_0x206d20[_0x623b('0x12')];this['countdropretry']=_0x206d20[_0x623b('0xe')];this[_0x623b('0xf')]=_0x206d20[_0x623b('0xf')];this[_0x623b('0x10')]=_0x206d20[_0x623b('0x10')];this['countagentrejectretry']=_0x206d20[_0x623b('0x11')];this[_0x623b('0x13')]=_0x3ff448[_0x623b('0x13')];this[_0x623b('0x14')]=_0x206d20['name'];this[_0x623b('0x15')]=_0x206d20['number'];this[_0x623b('0x16')]=_0x206d20[_0x623b('0x16')];this['responsetime']=_0x206d20[_0x623b('0x17')];this[_0x623b('0x18')]=moment()[_0x623b('0x19')](_0x623b('0x1a'));this['ringtime']=getSeconds(_0x206d20[_0x623b('0x17')],_0x206d20['starttime']);this[_0x623b('0x1b')]=0x0;this[_0x623b('0x1c')]=getSeconds(this[_0x623b('0x18')],_0x206d20[_0x623b('0x17')]);this[_0x623b('0x1d')]=_0x206d20[_0x623b('0x1d')];this[_0x623b('0x1e')]='IVR';this[_0x623b('0x1f')]=_0x3ff448[_0x623b('0x20')];this[_0x623b('0x21')]=_0x206d20[_0x623b('0x21')];this[_0x623b('0x22')]=_0x206d20[_0x623b('0x22')];this[_0x623b('0x23')]=_0x206d20[_0x623b('0x23')];this['recallme']=_0x206d20['recallme'];this['ContactId']=_0x206d20['ContactId'];this[_0x623b('0x24')]=_0x206d20['ListId'];this[_0x623b('0x25')]=_0x206d20['UserId'];this[_0x623b('0x26')]=_0x206d20[_0x623b('0x26')];this[_0x623b('0x27')]=_0x206d20[_0x623b('0x27')];}module[_0x623b('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 59fc775..5dc0f26 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 _0x4390=['type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype'];(function(_0xb67d3a,_0x4bf219){var _0x2d0b46=function(_0x7c79f9){while(--_0x7c79f9){_0xb67d3a['push'](_0xb67d3a['shift']());}};_0x2d0b46(++_0x4bf219);}(_0x4390,0x64));var _0x0439=function(_0x306b44,_0x123944){_0x306b44=_0x306b44-0x0;var _0x1cef6b=_0x4390[_0x306b44];return _0x1cef6b;};'use strict';var util=require('util');var _=require(_0x0439('0x0'));var moment=require(_0x0439('0x1'));function getSeconds(_0x32ca15,_0x483146){var _0x5697fa=moment(_0x32ca15)[_0x0439('0x2')](0x0);var _0x4533dc=moment(_0x483146)[_0x0439('0x2')](0x0);return _0x5697fa[_0x0439('0x3')](_0x4533dc,_0x0439('0x4'));}function History(_0x4fb9c2){this[_0x0439('0x5')]=_0x4fb9c2['uniqueid'];this[_0x0439('0x6')]=_0x4fb9c2[_0x0439('0x6')]||undefined;this['type']=_0x4fb9c2['type'];this[_0x0439('0x7')]=_0x4fb9c2[_0x0439('0x8')]===_0x0439('0x9')?'queue':_0x4fb9c2['type'];this[_0x0439('0xa')]=_0x4fb9c2[_0x0439('0xa')];this[_0x0439('0xb')]=_0x4fb9c2[_0x0439('0xb')];this[_0x0439('0xc')]=_0x4fb9c2[_0x0439('0xc')];this[_0x0439('0xd')]=_0x4fb9c2[_0x0439('0xa')]+_0x4fb9c2[_0x0439('0xb')]+_0x4fb9c2['countnoanswerretry']+_0x4fb9c2['countnosuchnumberretry']+_0x4fb9c2[_0x0439('0xe')]+_0x4fb9c2[_0x0439('0xf')]+_0x4fb9c2[_0x0439('0x10')]+_0x4fb9c2[_0x0439('0x11')];this[_0x0439('0x12')]=_0x4fb9c2['countnosuchnumberretry'];this[_0x0439('0xe')]=_0x4fb9c2[_0x0439('0xe')];this[_0x0439('0xf')]=_0x4fb9c2['countabandonedretry'];this[_0x0439('0x10')]=_0x4fb9c2[_0x0439('0x10')];this[_0x0439('0x11')]=_0x4fb9c2['countagentrejectretry'];this[_0x0439('0x13')]=_0x4fb9c2['queue'];this[_0x0439('0x14')]=_0x4fb9c2['name'];this[_0x0439('0x15')]=_0x4fb9c2['number'];this[_0x0439('0x16')]=_0x4fb9c2[_0x0439('0x16')];this[_0x0439('0x17')]=_0x4fb9c2[_0x0439('0x17')];this[_0x0439('0x18')]=_0x4fb9c2[_0x0439('0x17')];this['ringtime']=getSeconds(_0x4fb9c2[_0x0439('0x17')],_0x4fb9c2[_0x0439('0x16')]);this[_0x0439('0x19')]=0x0;this[_0x0439('0x1a')]=0x0;this[_0x0439('0x1b')]=_0x4fb9c2[_0x0439('0x1b')];this[_0x0439('0x1c')]=_0x4fb9c2[_0x0439('0x1c')];this[_0x0439('0x1d')]=_0x4fb9c2['callbackat'];this['recallme']=_0x4fb9c2['recallme'];this[_0x0439('0x1e')]=_0x4fb9c2[_0x0439('0x1e')];this['ListId']=_0x4fb9c2['ListId'];this[_0x0439('0x1f')]=_0x4fb9c2[_0x0439('0x1f')];this[_0x0439('0x20')]=_0x4fb9c2[_0x0439('0x20')];this[_0x0439('0x21')]=_0x4fb9c2['CampaignId'];this['originatecalleridnum']=_0x4fb9c2[_0x0439('0x22')]||'';this[_0x0439('0x23')]=_0x4fb9c2[_0x0439('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0xc200=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime'];(function(_0x2e7d01,_0x68e044){var _0x26efa9=function(_0x209952){while(--_0x209952){_0x2e7d01['push'](_0x2e7d01['shift']());}};_0x26efa9(++_0x68e044);}(_0xc200,0x19e));var _0x0c20=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc200[_0x27af45];return _0x18df21;};'use strict';var util=require(_0x0c20('0x0'));var _=require(_0x0c20('0x1'));var moment=require('moment');function getSeconds(_0x32ba20,_0x61fcd5){var _0x360aed=moment(_0x32ba20)[_0x0c20('0x2')](0x0);var _0x3dcf87=moment(_0x61fcd5)[_0x0c20('0x2')](0x0);return _0x360aed[_0x0c20('0x3')](_0x3dcf87,'seconds');}function History(_0x2fabac){this['uniqueid']=_0x2fabac[_0x0c20('0x4')];this['scheduledat']=_0x2fabac[_0x0c20('0x5')]||undefined;this[_0x0c20('0x6')]=_0x2fabac[_0x0c20('0x6')];this[_0x0c20('0x7')]=_0x2fabac[_0x0c20('0x6')]===_0x0c20('0x8')?_0x0c20('0x9'):_0x2fabac[_0x0c20('0x6')];this['countbusyretry']=_0x2fabac[_0x0c20('0xa')];this['countcongestionretry']=_0x2fabac['countcongestionretry'];this[_0x0c20('0xb')]=_0x2fabac[_0x0c20('0xb')];this[_0x0c20('0xc')]=_0x2fabac['countbusyretry']+_0x2fabac['countcongestionretry']+_0x2fabac[_0x0c20('0xb')]+_0x2fabac[_0x0c20('0xd')]+_0x2fabac[_0x0c20('0xe')]+_0x2fabac[_0x0c20('0xf')]+_0x2fabac[_0x0c20('0x10')]+_0x2fabac[_0x0c20('0x11')];this[_0x0c20('0xd')]=_0x2fabac[_0x0c20('0xd')];this[_0x0c20('0xe')]=_0x2fabac[_0x0c20('0xe')];this[_0x0c20('0xf')]=_0x2fabac[_0x0c20('0xf')];this[_0x0c20('0x10')]=_0x2fabac['countmachineretry'];this['countagentrejectretry']=_0x2fabac[_0x0c20('0x11')];this['queue']=_0x2fabac[_0x0c20('0x9')];this[_0x0c20('0x12')]=_0x2fabac[_0x0c20('0x13')];this[_0x0c20('0x14')]=_0x2fabac[_0x0c20('0x15')];this[_0x0c20('0x16')]=_0x2fabac[_0x0c20('0x16')];this[_0x0c20('0x17')]=_0x2fabac[_0x0c20('0x17')];this[_0x0c20('0x18')]=_0x2fabac[_0x0c20('0x17')];this[_0x0c20('0x19')]=getSeconds(_0x2fabac[_0x0c20('0x17')],_0x2fabac[_0x0c20('0x16')]);this[_0x0c20('0x1a')]=0x0;this[_0x0c20('0x1b')]=0x0;this[_0x0c20('0x1c')]=_0x2fabac['callback'];this['callbackuniqueid']=_0x2fabac[_0x0c20('0x1d')];this['callbackat']=_0x2fabac[_0x0c20('0x1e')];this[_0x0c20('0x1f')]=_0x2fabac[_0x0c20('0x1f')];this['ContactId']=_0x2fabac[_0x0c20('0x20')];this[_0x0c20('0x21')]=_0x2fabac[_0x0c20('0x21')];this[_0x0c20('0x22')]=_0x2fabac[_0x0c20('0x22')];this[_0x0c20('0x23')]=_0x2fabac[_0x0c20('0x23')];this[_0x0c20('0x24')]=_0x2fabac[_0x0c20('0x24')];this['originatecalleridnum']=_0x2fabac[_0x0c20('0x25')]||'';this[_0x0c20('0x26')]=_0x2fabac[_0x0c20('0x26')]||'';}module[_0x0c20('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7fd1c3a..fd02b51 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 _0x6816=['[getContactDialer2][Empty]','pTalking','sendMessageOneNotActive','NOT_ACTIVE','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','prototype','clearZombieChannels','isNil','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','CampaignId','[emptyContact][createHistory]','isSuccess','SIP/%s','reachable','status','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','state','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerCallsDay','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[rescheduleContact][Machine]','HANGUP','membername','[syncHangupInAMDIvr][createHistory]','value','amd','countcongestionretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','dialDropMaxRetry','add','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','locked','paused','stateinterface','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','isArray','push','Action','command','iftime\x20%s,%s','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','dialMethod','handlePower','power','dialPowerLevel','Queue','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','interval\x20=\x20','exports','util','lodash','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','type','outbound','answered','available','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','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\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED'];(function(_0x19e996,_0x3395c6){var _0x18c0d9=function(_0x2ab51c){while(--_0x2ab51c){_0x19e996['push'](_0x19e996['shift']());}};_0x18c0d9(++_0x3395c6);}(_0x6816,0x16f));var _0x6681=function(_0x5003da,_0x9fd90){_0x5003da=_0x5003da-0x0;var _0x56d14a=_0x6816[_0x5003da];return _0x56d14a;};'use strict';var util=require(_0x6681('0x0'));var _=require(_0x6681('0x1'));var BPromise=require(_0x6681('0x2'));var uuid=require('uuid');var moment=require(_0x6681('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x6681('0x4'));var ut=require(_0x6681('0x5'));var config=require(_0x6681('0x6'));var logger=require(_0x6681('0x7'))(_0x6681('0x8'));var loggerBooked=require(_0x6681('0x7'))(_0x6681('0x9'));var loggerPredictive=require(_0x6681('0x7'))(_0x6681('0xa'));var loggerPredictiveCalls=require(_0x6681('0x7'))(_0x6681('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x6681('0xc'));config[_0x6681('0xd')]=_[_0x6681('0xe')](config[_0x6681('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x6681('0xf'))(new Redis(config[_0x6681('0xd')]));var cmHopper=require(_0x6681('0x10'));var cmHopperHistory=require(_0x6681('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x6681('0x12'));var Action=require(_0x6681('0x13'));var History=require(_0x6681('0x14'));var Final=require(_0x6681('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x6681('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0x6681('0x17')][_0x6681('0x18')]||_0x6681('0x19');var strategy={'rrmemory':_0x6681('0x1a'),'roundrobin':_0x6681('0x1b')};var Sequence=function(){};Sequence['prototype'][_0x6681('0x1c')]=function(_0x317b65){this[_0x6681('0x1d')]=this[_0x6681('0x1d')]?this[_0x6681('0x1d')][_0x6681('0x1e')](_0x317b65):_0x317b65();};function Dialer(_0x3fcf4e,_0xe33c07){this[_0x6681('0x1f')]=new Sequence();this[_0x6681('0x20')]=_0xe33c07;this[_0x6681('0x21')]=_0x3fcf4e[_0x6681('0x21')];this['campaigns']=_0x3fcf4e[_0x6681('0x22')];this[_0x6681('0x23')]=_0x3fcf4e[_0x6681('0x23')];this['trunks']=_0x3fcf4e[_0x6681('0x24')];this[_0x6681('0x25')]=config[_0x6681('0x25')]||0x2;this['channels']={};this[_0x6681('0x26')]={};this[_0x6681('0x27')]={};this[_0x6681('0x28')]={};this['optionPredictive']={};this[_0x6681('0x29')]={};this[_0x6681('0x2a')]={};this[_0x6681('0x2b')]={};this[_0x6681('0x2c')]={};this['queueBookedRR']={};ami['on'](_0x6681('0x2d'),this[_0x6681('0x2e')][_0x6681('0x2f')](this));ami['on'](_0x6681('0x30'),this[_0x6681('0x31')]['bind'](this));ami['on'](_0x6681('0x32'),this[_0x6681('0x33')][_0x6681('0x2f')](this));ami['on'](_0x6681('0x34'),this[_0x6681('0x35')][_0x6681('0x2f')](this));ami['on']('custom:queuesummary',this[_0x6681('0x36')]['bind'](this));ami['on'](_0x6681('0x37'),this[_0x6681('0x38')][_0x6681('0x2f')](this));ami['on']('newexten',this[_0x6681('0x39')][_0x6681('0x2f')](this));ami['on'](_0x6681('0x3a'),this[_0x6681('0x3b')]['bind'](this));ami['on']('queuemember',this[_0x6681('0x3c')]['bind'](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this[_0x6681('0x3d')]();this[_0x6681('0x3e')]();}function isNotNull(_0x210abb){return _0x210abb!==null&&!_[_0x6681('0x3f')](_0x210abb);}function checkIsLoggedIn(_0x1682a3,_0x258949){return function(){if(_0x258949<=0x0){_0x1682a3[_0x6681('0x40')]=_0x6681('0x41');throw _0x1682a3[_0x6681('0x42')]+_0x6681('0x43');}};}function isActive(_0x35f980){return _0x35f980;}function checkIsActive(_0x18ba09,_0x562d1b){return function(){if(!isActive(_0x562d1b)){_0x18ba09[_0x6681('0x40')]='NOT_ACTIVE';throw _0x18ba09['name']+_0x6681('0x44');}};}function checkInterval(_0x2b91fa){return function(){if(!isNotNull(_0x2b91fa[_0x6681('0x45')])){_0x2b91fa['message']=_0x6681('0x46');throw _0x2b91fa['name']+_0x6681('0x47');}if(!isNotNull(_0x2b91fa[_0x6681('0x45')][_0x6681('0x48')])){_0x2b91fa[_0x6681('0x40')]='INTERVAL_IS_NULL';throw _0x2b91fa[_0x6681('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x6681('0x49')](_0x2b91fa[_0x6681('0x45')][_0x6681('0x48')]))){_0x2b91fa[_0x6681('0x40')]=_0x6681('0x46');throw _0x2b91fa[_0x6681('0x42')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4e4dd7,_0x60a56,_0x509fe0){return{'action':_0x4e4dd7,'response':_0x60a56,'message':_0x509fe0,'stack':_0x509fe0};}function myreject(_0x4d0daf){return function(_0x72077e){return _0x4d0daf(msgResponse(_0x6681('0x4a'),_0x6681('0x4b'),JSON[_0x6681('0x4c')](_0x72077e)));};}function getSeconds(_0x14fa29,_0x5de3a8){var _0x4f159a=moment(_0x14fa29)[_0x6681('0x4d')](0x0);var _0x501e1b=moment(_0x5de3a8)[_0x6681('0x4d')](0x0);return _0x4f159a[_0x6681('0x4e')](_0x501e1b,'seconds');}function emit(_0x4e31e8,_0x1aa275,_0x54b64f){io['to'](_0x4e31e8)['emit'](_0x1aa275,_0x54b64f);}function emitVoiceQueueSummary(_0x258ddb){if(_0x258ddb[_0x6681('0x4f')]===_0x6681('0x50')){var _0xc93abc={'id':_0x258ddb['id'],'name':_0x258ddb[_0x6681('0x42')],'strategy':_0x258ddb['strategy'],'answered':_0x258ddb[_0x6681('0x51')],'available':_0x258ddb[_0x6681('0x52')],'loggedIn':_0x258ddb['loggedIn'],'pTalking':_0x258ddb['pTalking'],'sumBillable':_0x258ddb[_0x6681('0x53')],'sumDuration':_0x258ddb[_0x6681('0x54')],'sumHoldTime':_0x258ddb[_0x6681('0x55')]||0x0,'talking':_0x258ddb[_0x6681('0x56')],'total':_0x258ddb[_0x6681('0x57')],'type':_0x258ddb[_0x6681('0x4f')],'unmanaged':_0x258ddb[_0x6681('0x58')],'abandoned':_0x258ddb[_0x6681('0x59')],'waiting':_0x258ddb[_0x6681('0x5a')],'loggedInDb':_0x258ddb[_0x6681('0x5b')],'dialActive':_0x258ddb[_0x6681('0x5c')],'dialMethod':_0x258ddb['dialMethod'],'dialOriginateCallerIdName':_0x258ddb[_0x6681('0x5d')],'dialOriginateCallerIdNumber':_0x258ddb['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x258ddb[_0x6681('0x5e')],'dialPrefix':_0x258ddb[_0x6681('0x5f')],'outboundAnswerAgiCallsDay':_0x258ddb[_0x6681('0x60')],'outboundAnswerCallsDay':_0x258ddb['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x258ddb[_0x6681('0x61')],'outboundBusyCallsDay':_0x258ddb[_0x6681('0x62')],'outboundCongestionCallsDay':_0x258ddb[_0x6681('0x63')],'outboundDropCallsDayACS':_0x258ddb['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x258ddb[_0x6681('0x64')],'outboundDropCallsDayTimeout':_0x258ddb['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x258ddb['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x258ddb[_0x6681('0x65')],'outboundOriginateFailureCallsDay':_0x258ddb[_0x6681('0x66')],'outboundReCallsDay':_0x258ddb[_0x6681('0x67')],'outboundRejectCallsDay':_0x258ddb[_0x6681('0x68')],'outboundUnknownCallsDay':_0x258ddb[_0x6681('0x69')],'predictiveIntervalAnsweredCalls':_0x258ddb['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x258ddb[_0x6681('0x6a')],'predictiveIntervalAvgTalktime':_0x258ddb[_0x6681('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x258ddb[_0x6681('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x258ddb['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x258ddb['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x258ddb['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x258ddb[_0x6681('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x258ddb[_0x6681('0x6e')],'predictiveIntervalPauses':_0x258ddb[_0x6681('0x6f')],'predictiveIntervalAvailable':_0x258ddb['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x258ddb[_0x6681('0x70')],'message':_0x258ddb['message'],'originated':_0x258ddb[_0x6681('0x71')],'erlangCalls':_0x258ddb[_0x6681('0x72')],'erlangCallToSecond':_0x258ddb[_0x6681('0x73')],'erlangAbandonmentRate':_0x258ddb[_0x6681('0x74')],'erlangBusyFactor':_0x258ddb['erlangBusyFactor'],'startPredictive':_0x258ddb[_0x6681('0x29')],'startProgressive':_0x258ddb['startProgressive']};if(_0x258ddb[_0x6681('0x75')]){_0xc93abc[_0x6681('0x75')]={'id':_0x258ddb['Trunk']['id'],'name':_0x258ddb[_0x6681('0x75')]['name'],'active':_0x258ddb[_0x6681('0x75')][_0x6681('0x76')],'callerid':_0x258ddb['Trunk'][_0x6681('0x77')]};}if(_0x258ddb[_0x6681('0x45')]){_0xc93abc[_0x6681('0x45')]={'id':_0x258ddb[_0x6681('0x45')]['id'],'name':_0x258ddb[_0x6681('0x45')][_0x6681('0x42')]};}var _0x5c5d9b=md5(JSON[_0x6681('0x4c')](_0xc93abc));if(_0x258ddb[_0x6681('0x78')]!==_0x5c5d9b){_0x258ddb[_0x6681('0x78')]=_0x5c5d9b;emit(util[_0x6681('0x79')](_0x6681('0x7a'),_0xc93abc[_0x6681('0x42')]),_0x6681('0x7b'),_0xc93abc);}}}function emitCampaignSummary(_0x3cde90){if(_0x3cde90[_0x6681('0x4f')]===_0x6681('0x7c')){emit(util['format']('campaign:ivr:%s',_0x3cde90[_0x6681('0x42')]),_0x6681('0x7d'),_0x3cde90);}}function checkGetDataPredictive(_0x1aa7a4){if(isNotNull(_0x1aa7a4)&&!_['isEmpty'](_0x1aa7a4)){loggerPredictive[_0x6681('0x7e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x6681('0x7e')](_0x6681('0x7f'),_0x1aa7a4['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa7a4[_0x6681('0x80')]);loggerPredictive[_0x6681('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa7a4[_0x6681('0x81')]);loggerPredictive['info'](_0x6681('0x82'),_0x1aa7a4[_0x6681('0x6c')]);loggerPredictive[_0x6681('0x7e')](_0x6681('0x83'),_0x1aa7a4[_0x6681('0x6a')]);loggerPredictive[_0x6681('0x7e')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa7a4[_0x6681('0x6b')]);loggerPredictive[_0x6681('0x7e')](_0x6681('0x84'));if(_0x1aa7a4[_0x6681('0x70')]>0x0){if(!_[_0x6681('0x3f')](_0x1aa7a4['predictiveIntervalAvgTalktime'])&&_0x1aa7a4['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x6681('0x85'));if(!_[_0x6681('0x3f')](_0x1aa7a4[_0x6681('0x6a')])&&_0x1aa7a4[_0x6681('0x6a')]>0x0){return!![];}loggerPredictive[_0x6681('0x7e')](_0x6681('0x86'));}else{loggerPredictive[_0x6681('0x7e')](_0x6681('0x87'));}}else{loggerPredictive[_0x6681('0x7e')](_0x6681('0x88'));}return![];}function mergeDataErlangB(_0x2971fd){return function(_0x1c0676){loggerPredictive[_0x6681('0x7e')](_0x6681('0x89'));loggerPredictive['info'](_0x6681('0x8a'),_0x1c0676[_0x6681('0x72')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c0676['erlangCallToSecond']);loggerPredictive[_0x6681('0x7e')](_0x6681('0x8b'),_0x1c0676[_0x6681('0x74')]);loggerPredictive[_0x6681('0x7e')](_0x6681('0x8c'),_0x1c0676['erlangBusyFactor']);loggerPredictive['info'](_0x6681('0x8b'),_0x1c0676['erlangAbandonmentRate']);loggerPredictive[_0x6681('0x7e')]('---------------------------');_[_0x6681('0x8d')](_0x2971fd,_0x1c0676);};}function getDiff(_0x31b7a5){var _0x43d957=moment()[_0x6681('0x4d')](0x0);var _0x1b5950=moment(_0x31b7a5)[_0x6681('0x4d')](0x0);return _0x43d957[_0x6681('0x4e')](_0x1b5950,_0x6681('0x8e'));}function ifInterval(_0x3cdd14,_0x3c2cd4){if(_[_0x6681('0x3f')](_0x3c2cd4)){return![];}return getDiff(_0x3c2cd4)<_0x3cdd14*0x3c;}function freeVariablesPredictive(_0x4977ef){if(isNotNull(_0x4977ef)){if(!_[_0x6681('0x3f')](_0x4977ef[_0x6681('0x2a')])){_0x4977ef['startProgressive']=undefined;loggerPredictive[_0x6681('0x7e')](_0x4977ef[_0x6681('0x42')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x6681('0x3f')](_0x4977ef[_0x6681('0x29')])){_0x4977ef[_0x6681('0x29')]=undefined;loggerPredictive[_0x6681('0x7e')](_0x4977ef['name'],_0x6681('0x8f'));}if(!_[_0x6681('0x3f')](_0x4977ef[_0x6681('0x90')])){clearInterval(_0x4977ef['handlePredictive']);_0x4977ef[_0x6681('0x90')]=undefined;loggerPredictive[_0x6681('0x7e')](_0x4977ef[_0x6681('0x42')],_0x6681('0x91'));}}}function erlangb(_0x2fe75e,_0x4945e2){if(_0x4945e2===0x0){return 0x0;}var _0x4fe850=0x1;for(var _0x38ac26=0x1;_0x38ac26<=_0x4945e2;_0x38ac26+=0x1){_0x4fe850=0x1+_0x4fe850*_0x38ac26/_0x2fe75e;}return 0x1/_0x4fe850;}function isVoiceQueueOutbound(_0x5e4503){return _0x5e4503===_0x6681('0x50');}function isNotPreview(_0x468560){return _0x468560!==_0x6681('0x20');}function isCampaignIvr(_0x4d9a68){return _0x4d9a68==='ivr';}function getCallerId(_0x12cb70,_0x20e4a7,_0x44dbc5){if(!_['isUndefined'](_0x44dbc5)&&typeof _0x44dbc5===_0x6681('0x92')&&!_['isEmpty'](_0x44dbc5)){if(!_[_0x6681('0x3f')](_0x20e4a7)&&typeof _0x20e4a7===_0x6681('0x92')&&!_[_0x6681('0x49')](_0x20e4a7)){return util[_0x6681('0x79')](_0x6681('0x93'),_0x20e4a7,_0x44dbc5);}return util[_0x6681('0x79')](_0x6681('0x93'),_0x44dbc5,_0x44dbc5);}if(!_[_0x6681('0x3f')](_0x12cb70)&&typeof _0x12cb70===_0x6681('0x92')&&!_['isEmpty'](_0x12cb70)){return _0x12cb70;}return _0x6681('0x94');}function loggerCatchQueueSummary(_0x2114db,_0x4f7e00){return function(_0x390813){freeVariablesPredictive(_0x4f7e00);emitVoiceQueueSummary(_0x4f7e00);emitCampaignSummary(_0x4f7e00);loggerSyncQueueSummary[_0x6681('0x95')](_0x2114db,util[_0x6681('0x96')](_0x390813,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x22bc1b,_0x20c23b){return function(_0x2615d4){loggerPredictive['error'](_0x20c23b['name'],_0x22bc1b);loggerPredictive[_0x6681('0x95')](_0x2615d4[_0x6681('0x97')]);freeVariablesPredictive(_0x20c23b);};}function loggerCatch(_0x5de06c){return function(_0x54cca0){logger[_0x6681('0x95')](_0x5de06c,util[_0x6681('0x96')](_0x54cca0,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2d118f){return _0x2d118f&&!_[_0x6681('0x3f')](_0x2d118f)&&_0x2d118f[_0x6681('0x98')]>0x0;}function decremetOriginate(_0x29b26e){if(!_[_0x6681('0x3f')](_0x29b26e)&&_0x29b26e!==null){if(typeof _0x29b26e[_0x6681('0x71')]!==_0x6681('0x99')){if(_0x29b26e[_0x6681('0x71')]>0x0){_0x29b26e['originated']-=0x1;}else{logger[_0x6681('0x95')](_0x6681('0x9a'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x16b6a6,_0x14dd02,_0x26e61e){if(_0x14dd02>_0x26e61e){for(var _0x514d7d=0x0;_0x514d7d<_0x14dd02-_0x26e61e;_0x514d7d+=0x1){decremetOriginate(_0x16b6a6);}}}function loggerGetContactDialer(_0x49ca8b,_0xa8964f,_0x93dce6){return function(_0x4f65dd){checkContactLowerLimitOriginate(_0xa8964f,_0x93dce6,0x0);logger[_0x6681('0x95')](_0x49ca8b,util[_0x6681('0x96')](_0x4f65dd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x414903){return function(_0xdd001){if(isNotNull(_0xdd001)&&isNotNull(_0xdd001[0x0])){if(_0xdd001[0x0][_0x6681('0x9b')]>0x0){_0x414903[_0x6681('0x40')]=_0x6681('0x9c');logger[_0x6681('0x7e')](_0x6681('0x9d')+_0x414903[_0x6681('0x42')],_0xdd001[0x0][_0x6681('0x9b')],_0x6681('0x9e'));}else{_0x414903['message']=_0x6681('0x9f');logger[_0x6681('0x7e')](_0x6681('0xa0')+_0x414903['name']);}}};}function notSendMessagesQueue(_0x41487b){if(_0x41487b['sendMessageOneNotActive']){freeVariablesPredictive(_0x41487b);if(_0x41487b[_0x6681('0x71')]===0x0&&_0x41487b[_0x6681('0x56')]===0x0&&_0x41487b['waiting']===0x0&&(_0x41487b[_0x6681('0xa1')]||0x0)===0x0){_0x41487b[_0x6681('0xa2')]=![];_0x41487b[_0x6681('0x52')]=0x0;_0x41487b[_0x6681('0x40')]=_0x6681('0xa3');loggerSyncQueueSummary[_0x6681('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x41487b[_0x6681('0x42')],'is\x20not\x20active');}else{_0x41487b[_0x6681('0x40')]=_0x6681('0xa4');loggerSyncQueueSummary['error'](_0x6681('0xa5'),_0x41487b['name'],_0x6681('0xa6'));}emitVoiceQueueSummary(_0x41487b);}}function notSendMessagesCampaign(_0x539bd4){if(_0x539bd4['sendMessageOneNotActive']){if(_0x539bd4[_0x6681('0x71')]===0x0){_0x539bd4['sendMessageOneNotActive']=![];_0x539bd4[_0x6681('0x40')]=_0x6681('0xa3');loggerSyncQueueSummary[_0x6681('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x539bd4[_0x6681('0x42')],_0x6681('0xa7'));}else{_0x539bd4[_0x6681('0x40')]=_0x6681('0xa4');loggerSyncQueueSummary[_0x6681('0x95')](_0x6681('0xa8'),_0x539bd4[_0x6681('0x42')],_0x6681('0xa6'));}emitCampaignSummary(_0x539bd4);}}function createObjHistory(_0x2e10c1,_0x20684a,_0x2364e6,_0xb3ee51,_0x365a35){_0x2e10c1[_0x6681('0x40')]=_0x2364e6;var _0x5831fc=new Action(_0x2e10c1,_0x20684a);var _0x356d79=new History(_0x5831fc);_0x356d79['state']=_0xb3ee51;_0x356d79[_0x6681('0xa9')]=_0x365a35;_0x356d79[_0x6681('0xaa')]=_0x5831fc[_0x6681('0xab')];return _0x356d79;}Dialer[_0x6681('0xac')]['loopClearZombieChannels']=function(){var _0x19e22e=this;setInterval(function(){_0x19e22e['clearZombieChannels'](_0x19e22e[_0x6681('0x28')],'[uniqueid]');_0x19e22e[_0x6681('0xad')](_0x19e22e[_0x6681('0x26')],'[actions]');},0x32c8);};Dialer[_0x6681('0xac')][_0x6681('0xad')]=function(_0x26e2cf,_0x5d4a68){var _0x2c4c2e=this;for(var _0x2bc85e in _0x26e2cf){if(typeof _0x26e2cf[_0x2bc85e]!=='undefined'){this[_0x6681('0x1f')][_0x6681('0x1c')](function(){if(!_[_0x6681('0xae')](_0x26e2cf[_0x2bc85e])){return ami['Action']({'action':'status','channel':_0x26e2cf[_0x2bc85e]['channel']})[_0x6681('0xaf')](function(_0x4209c0){if(_0x4209c0['message']===_0x6681('0xb0')){setTimeout(function(){if(_0x26e2cf[_0x2bc85e]&&_0x26e2cf[_0x2bc85e][_0x6681('0x4f')]!==_0x6681('0x7c')){_0x2c4c2e[_0x6681('0xb1')](_0x2c4c2e[_0x6681('0x21')][_0x26e2cf[_0x2bc85e][_0x6681('0xb2')]]);logger[_0x6681('0x95')](_0x6681('0xb3'),_0x5d4a68,_0x2bc85e,_0x26e2cf[_0x2bc85e][_0x6681('0xb2')]);delete _0x26e2cf[_0x2bc85e];}if(_0x26e2cf[_0x2bc85e]&&_0x26e2cf[_0x2bc85e]['type']==='ivr'){_0x2c4c2e[_0x6681('0xb1')](_0x2c4c2e[_0x6681('0x22')][_0x26e2cf[_0x2bc85e][_0x6681('0xb2')]]);logger[_0x6681('0x95')](_0x6681('0xb4'),_0x5d4a68,_0x2bc85e,_0x26e2cf[_0x2bc85e][_0x6681('0xb2')]);delete _0x26e2cf[_0x2bc85e];}},0x2328);}});}});}}};Dialer['prototype'][_0x6681('0xb5')]=function(_0x2f926b){return BPromise[_0x6681('0xb6')]()[_0x6681('0xb7')](cmHopper[_0x6681('0xb5')](_0x2f926b))[_0x6681('0xaf')](loggerCatch(_0x6681('0xb8')));};Dialer[_0x6681('0xac')][_0x6681('0xb9')]=function(_0x1f2a0a){return BPromise[_0x6681('0xb6')]()['then'](cmHopperBlack[_0x6681('0xb9')](_0x1f2a0a))['catch'](loggerCatch(_0x6681('0xba')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x38392d){return BPromise[_0x6681('0xb6')]()[_0x6681('0xb7')](cmHopperBlack[_0x6681('0xbb')](_0x38392d))[_0x6681('0xaf')](loggerCatch(_0x6681('0xbc')));};Dialer[_0x6681('0xac')][_0x6681('0xbd')]=function(_0xdc3b92){return BPromise['resolve']()[_0x6681('0xb7')](cmHopperHistory['avgHandleTime'](_0xdc3b92))[_0x6681('0xaf')](loggerCatch(_0x6681('0xbe')));};Dialer['prototype'][_0x6681('0xbf')]=function(_0xa9dea3){return BPromise['resolve']()[_0x6681('0xb7')](cmHopper['rescheduleContact'](_0xa9dea3))['catch'](loggerCatch(_0x6681('0xc0')));};Dialer['prototype']['unlockContact']=function(_0x40f79e,_0x59a927,_0x3b32ed){return BPromise[_0x6681('0xb6')]()['then'](cmHopper[_0x6681('0xc1')](_0x40f79e,_0x59a927,_0x3b32ed))[_0x6681('0xaf')](loggerCatch(_0x6681('0xc2')));};Dialer['prototype'][_0x6681('0xc3')]=function(_0x54a4e5,_0xe9d36e,_0x5d5e24,_0x29f6bc){return BPromise[_0x6681('0xb6')]()[_0x6681('0xb7')](cmHopper['getContactDialer'](_0x54a4e5,_0xe9d36e,_0x5d5e24,_0x29f6bc))[_0x6681('0xaf')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x6681('0xac')][_0x6681('0xc4')]=function(_0x174db3,_0x3a2014,_0x278c42){return BPromise[_0x6681('0xb6')]()[_0x6681('0xb7')](cmHopper[_0x6681('0xc4')](_0x174db3,_0x3a2014,_0x278c42))[_0x6681('0xaf')](loggerCatch(_0x6681('0xc5')));};Dialer['prototype'][_0x6681('0xc6')]=function(_0x2560c2){return BPromise[_0x6681('0xb6')]()['then'](voiceQueueRt[_0x6681('0xc6')](_0x2560c2))[_0x6681('0xaf')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x6681('0xac')][_0x6681('0xc7')]=function(_0x55a996){return BPromise[_0x6681('0xb6')]()[_0x6681('0xb7')](cmHopper[_0x6681('0xc7')](_0x55a996))[_0x6681('0xaf')](loggerCatch(_0x6681('0xc8')));};Dialer[_0x6681('0xac')][_0x6681('0xc9')]=function(_0x4d51f0){return BPromise['resolve']()['then'](cmHopperHistory[_0x6681('0xc9')](_0x4d51f0))[_0x6681('0xaf')](loggerCatch(_0x6681('0xca')));};Dialer[_0x6681('0xac')]['updateOriginated']=function(_0x324465){if(!_[_0x6681('0x3f')](_0x324465)&&_0x324465!==null){if(typeof _0x324465[_0x6681('0x71')]!==_0x6681('0x99')){if(_0x324465['originated']>0x0){_0x324465[_0x6681('0x71')]-=0x1;}else{logger[_0x6681('0x95')](_0x6681('0xcb'));}}}else{logger[_0x6681('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x6681('0xac')][_0x6681('0xcc')]=function(_0x4696ec,_0xa5672){var _0xaaf9ad=this;return function(_0x1b2d7d){_0xaaf9ad['updateOriginated'](_0xa5672);logger['error'](_0x4696ec,util['inspect'](_0x1b2d7d,{'showHidden':![],'depth':null}));};};Dialer[_0x6681('0xac')][_0x6681('0xcd')]=function(_0x59eb76,_0x222d5f,_0x183a31){var _0x2e5b29={'state':0x19,'statedesc':_0x6681('0xce')};this[_0x6681('0xb1')](_0x222d5f);this[_0x6681('0xcf')](_[_0x6681('0x8d')](_0x2e5b29,_[_0x6681('0xd0')](_0x183a31,['ContactId',_0x6681('0xd1'),_0x6681('0xd2'),'VoiceQueueId',_0x6681('0xd3')])),_0x6681('0xd4'),'[emptyContact]');logger['error'](_0x59eb76);};Dialer['prototype'][_0x6681('0xd5')]=function(_0x4f42c8){return _0x4f42c8==='Success';};Dialer['prototype']['isTrunkReachable']=function(_0x30959a){return!_['isUndefined'](_0x30959a)&&_0x30959a&&!_[_0x6681('0x3f')](_0x30959a[_0x6681('0x42')])&&!_[_0x6681('0x3f')](_0x30959a[_0x6681('0x76')])&&_0x30959a[_0x6681('0x76')]&&(this['trunks'][util[_0x6681('0x79')](_0x6681('0xd6'),_0x30959a[_0x6681('0x42')])]['status']===_0x6681('0xd7')||this[_0x6681('0x24')][util[_0x6681('0x79')](_0x6681('0xd6'),_0x30959a[_0x6681('0x42')])][_0x6681('0xd8')]===_0x6681('0xd9'));};Dialer[_0x6681('0xac')][_0x6681('0xcf')]=function(_0x195bee,_0x4f4196,_0x937687){this[_0x6681('0xc9')](_0x195bee)[_0x6681('0xaf')](loggerCatch(_0x4f4196));this[_0x6681('0xc7')](_0x195bee)[_0x6681('0xaf')](loggerCatch(_0x937687));};Dialer[_0x6681('0xac')][_0x6681('0x3b')]=function(_0x3b0776){var _0x1390ec=this[_0x6681('0x28')][_0x3b0776[_0x6681('0xda')]];var _0x3e47dc;if(!_['isNil'](_0x3b0776)&&!_[_0x6681('0xae')](_0x3b0776[_0x6681('0xdb')])&&!_[_0x6681('0xae')](_0x3b0776[_0x6681('0xdb')][_0x6681('0xdc')])&&_0x3b0776['exten']===_0x6681('0xdd')&&_0x1390ec){if(_0x1390ec[_0x6681('0x4f')]!=='ivr'&&this[_0x6681('0x21')][_0x1390ec[_0x6681('0xb2')]]['dialAMDActive']&&_0x3b0776['value']==='HANGUP'){delete this['uniqueId'][_0x3b0776[_0x6681('0xda')]];this[_0x6681('0xb1')](this[_0x6681('0x21')][_0x1390ec[_0x6681('0xb2')]]);this[_0x6681('0x21')][_0x1390ec[_0x6681('0xb2')]]['outboundAnswerCallsDay']+=0x1;this[_0x6681('0x21')][_0x1390ec[_0x6681('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3e47dc=new Hangup(_0x1390ec,_0x3b0776);_0x3e47dc[_0x6681('0xde')]=0x12;_0x3e47dc[_0x6681('0xa9')]=_0x6681('0xdf');_0x3e47dc['membername']=_0x6681('0xe0');this[_0x6681('0xcf')](_0x3e47dc,_0x6681('0xe1'),_0x6681('0xe2'));}if(_0x1390ec[_0x6681('0x4f')]!==_0x6681('0x7c')&&this['voiceQueues'][_0x1390ec[_0x6681('0xb2')]][_0x6681('0xe3')]&&_0x3b0776['value']===_0x6681('0xe4')){var _0x14f49d=this;return new BPromise(function(_0x2e9901,_0x3171b){delete _0x14f49d[_0x6681('0x28')][_0x3b0776[_0x6681('0xda')]];_0x14f49d[_0x6681('0xb1')](_0x14f49d[_0x6681('0x21')][_0x1390ec[_0x6681('0xb2')]]);_0x14f49d[_0x6681('0x21')][_0x1390ec[_0x6681('0xb2')]][_0x6681('0xe5')]+=0x1;_0x14f49d[_0x6681('0x21')][_0x1390ec['queue']][_0x6681('0x60')]+=0x1;var _0x44bd48=_0x14f49d['voiceQueues'][_0x1390ec[_0x6681('0xb2')]];var _0x137f5f=new Hangup(_0x1390ec,_0x3b0776);_0x137f5f[_0x6681('0xde')]=0x13;_0x137f5f['statedesc']=_0x6681('0xe6');_0x137f5f['membername']=_0x6681('0xe0');_0x137f5f[_0x6681('0xe7')]+=0x1;_0x137f5f[_0x6681('0xe8')]+=0x1;_0x137f5f['amd']=!![];_0x14f49d[_0x6681('0xc9')](_0x137f5f)[_0x6681('0xaf')](loggerCatch(_0x6681('0xe9')));if(_0x137f5f[_0x6681('0xea')]+_0x137f5f['countcongestionretry']+_0x137f5f[_0x6681('0xeb')]+_0x137f5f[_0x6681('0xec')]+_0x137f5f[_0x6681('0xed')]+_0x137f5f[_0x6681('0xee')]+_0x137f5f['countmachineretry']+_0x137f5f[_0x6681('0xef')]>=_0x44bd48[_0x6681('0xf0')]){_0x14f49d[_0x6681('0xf1')](_0x137f5f,_0x2e9901,_0x3171b,'reason19\x20machine....');}else{if(_0x137f5f[_0x6681('0xe7')]>=_0x44bd48['dialMachineMaxRetry']){_0x14f49d['createStateFinal'](_0x137f5f,_0x2e9901,_0x3171b,_0x6681('0xf2'));}else{_0x14f49d[_0x6681('0xbf')]({'active':![],'countmachineretry':_0x137f5f['countmachineretry'],'scheduledat':moment()['add'](_0x44bd48[_0x6681('0xf3')],_0x6681('0xf4'))[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x137f5f[_0x6681('0xf6')],'ListId':_0x137f5f[_0x6681('0xd1')],'VoiceQueueId':_0x137f5f[_0x6681('0xf7')]||undefined,'CampaignId':_0x137f5f['CampaignId']||undefined})['catch'](loggerCatch(_0x6681('0xf8')));_0x2e9901({'reschedule':0x1});}}});}if(_0x1390ec[_0x6681('0x4f')]===_0x6681('0x7c')&&this[_0x6681('0x22')][_0x1390ec[_0x6681('0xb2')]][_0x6681('0xe3')]&&_0x3b0776['value']===_0x6681('0xf9')){delete this[_0x6681('0x28')][_0x3b0776[_0x6681('0xda')]];this[_0x6681('0xb1')](this['campaigns'][_0x1390ec[_0x6681('0xb2')]]);_0x3e47dc=new Hangup(_0x1390ec,_0x3b0776);_0x3e47dc[_0x6681('0xde')]=0x12;_0x3e47dc[_0x6681('0xa9')]=_0x6681('0xdf');_0x3e47dc[_0x6681('0xfa')]=_0x6681('0xe0');this['saveInDb'](_0x3e47dc,_0x6681('0xfb'),'[syncHangupInAMDIvr]');}if(_0x1390ec[_0x6681('0x4f')]===_0x6681('0x7c')&&this['campaigns'][_0x1390ec[_0x6681('0xb2')]][_0x6681('0xe3')]&&_0x3b0776[_0x6681('0xfc')]===_0x6681('0xe4')){var _0x14f49d=this;return new BPromise(function(_0x494918,_0x36f315){delete _0x14f49d[_0x6681('0x28')][_0x3b0776['uniqueid']];_0x14f49d[_0x6681('0xb1')](_0x14f49d[_0x6681('0x22')][_0x1390ec[_0x6681('0xb2')]]);_0x14f49d[_0x6681('0x22')][_0x1390ec[_0x6681('0xb2')]][_0x6681('0xe5')]+=0x1;_0x14f49d[_0x6681('0x22')][_0x1390ec['queue']][_0x6681('0x60')]+=0x1;var _0x3201c8=_0x14f49d[_0x6681('0x22')][_0x1390ec['queue']];var _0xa37f5a=new Hangup(_0x1390ec,_0x3b0776);_0xa37f5a[_0x6681('0xde')]=0x13;_0xa37f5a[_0x6681('0xa9')]=_0x6681('0xe6');_0xa37f5a[_0x6681('0xfa')]=_0x6681('0xe0');_0xa37f5a['countmachineretry']+=0x1;_0xa37f5a['countglobal']+=0x1;_0xa37f5a[_0x6681('0xfd')]=!![];_0x14f49d[_0x6681('0xc9')](_0xa37f5a)[_0x6681('0xaf')](loggerCatch(_0x6681('0xe9')));if(_0xa37f5a[_0x6681('0xea')]+_0xa37f5a[_0x6681('0xfe')]+_0xa37f5a[_0x6681('0xeb')]+_0xa37f5a['countnosuchnumberretry']+_0xa37f5a[_0x6681('0xed')]+_0xa37f5a[_0x6681('0xee')]+_0xa37f5a[_0x6681('0xe7')]+_0xa37f5a[_0x6681('0xef')]>=_0x3201c8['dialGlobalMaxRetry']){_0x14f49d[_0x6681('0xf1')](_0xa37f5a,_0x494918,_0x36f315,_0x6681('0xff'));}else{if(_0xa37f5a[_0x6681('0xe7')]>=_0x3201c8[_0x6681('0x100')]){_0x14f49d[_0x6681('0x101')](_0xa37f5a,_0x494918,_0x36f315,_0x6681('0xf2'));}else{_0x14f49d[_0x6681('0xbf')]({'active':![],'countmachineretry':_0xa37f5a[_0x6681('0xe7')],'scheduledat':moment()['add'](_0x3201c8[_0x6681('0xf3')],_0x6681('0xf4'))['format'](_0x6681('0xf5')),'ContactId':_0xa37f5a['ContactId'],'ListId':_0xa37f5a[_0x6681('0xd1')],'VoiceQueueId':_0xa37f5a[_0x6681('0xf7')]||undefined,'CampaignId':_0xa37f5a[_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0xf8')));_0x494918({'reschedule':0x1});}}});}}};Dialer[_0x6681('0xac')]['syncHangup']=function(_0xbba42a){var _0x2a95be=this[_0x6681('0x28')][_0xbba42a[_0x6681('0xda')]];var _0x5c5d6a=this;var _0x21e00a;if(_0x2a95be&&_0x2a95be[_0x6681('0x4f')]===_0x6681('0x7c')){delete this[_0x6681('0x28')][_0xbba42a[_0x6681('0xda')]];this[_0x6681('0xb1')](this['campaigns'][_0x2a95be[_0x6681('0xb2')]]);this[_0x6681('0x22')][_0x2a95be[_0x6681('0xb2')]][_0x6681('0x102')]+=0x1;_0x21e00a=new Hangup(_0x2a95be,_0xbba42a);this[_0x6681('0xc9')](_0x21e00a)[_0x6681('0xaf')](loggerCatch(_0x6681('0x103')));this[_0x6681('0xc7')](_0x21e00a)[_0x6681('0xaf')](loggerCatch(_0x6681('0x104')));}if(_0x2a95be&&_0x2a95be[_0x6681('0x4f')]!==_0x6681('0x7c')&&isNotNull(this['voiceQueues'][_0x2a95be['queue']][_0x6681('0x105')])){delete this[_0x6681('0x28')][_0xbba42a[_0x6681('0xda')]];this['updateOriginated'](this[_0x6681('0x21')][_0x2a95be[_0x6681('0xb2')]]);this[_0x6681('0x21')][_0x2a95be[_0x6681('0xb2')]]['outboundAnswerCallsDay']+=0x1;this[_0x6681('0x21')][_0x2a95be[_0x6681('0xb2')]][_0x6681('0x60')]+=0x1;_0x21e00a=new Hangup(_0x2a95be,_0xbba42a);_0x21e00a[_0x6681('0xde')]=0x10;_0x21e00a['statedesc']='AnswerAGI';_0x21e00a[_0x6681('0xfa')]=_0x6681('0x106');this['createHistory'](_0x21e00a)[_0x6681('0xaf')](loggerCatch(_0x6681('0x103')));this[_0x6681('0xc7')](_0x21e00a)[_0x6681('0xaf')](loggerCatch('[syncHangupIvr]'));}if(_0x2a95be&&_0x2a95be['type']!==_0x6681('0x7c')&&!isNotNull(this[_0x6681('0x21')][_0x2a95be[_0x6681('0xb2')]]['dialQueueProject'])){delete this[_0x6681('0x28')][_0xbba42a[_0x6681('0xda')]];this[_0x6681('0xb1')](this[_0x6681('0x21')][_0x2a95be[_0x6681('0xb2')]]);this['voiceQueues'][_0x2a95be[_0x6681('0xb2')]][_0x6681('0x69')]+=0x1;_0x21e00a=new Hangup(_0x2a95be,_0xbba42a);_0x21e00a['state']=0xc;_0x21e00a[_0x6681('0xa9')]=_0xbba42a[_0x6681('0x107')];_0x21e00a[_0x6681('0xfa')]=_0x6681('0x108');this[_0x6681('0xc9')](_0x21e00a)[_0x6681('0xaf')](loggerCatch(_0x6681('0x103')));this[_0x6681('0xc7')](_0x21e00a)[_0x6681('0xaf')](loggerCatch(_0x6681('0x104')));}};Dialer[_0x6681('0xac')][_0x6681('0x35')]=function(_0x25731e){var _0x2303ed=this[_0x6681('0x28')][_0x25731e[_0x6681('0xda')]];var _0x1a1229=this;if(this[_0x6681('0x21')][_0x25731e[_0x6681('0xb2')]]){if(_0x2303ed&&_0x2303ed[_0x6681('0x4f')]!=='ivr'){delete this[_0x6681('0x28')][_0x25731e[_0x6681('0xda')]];this[_0x6681('0x21')][_0x25731e[_0x6681('0xb2')]][_0x6681('0xe5')]+=0x1;var _0x1bc236=new AgentComplete(_0x2303ed,_0x25731e);if(_0x25731e[_0x6681('0x109')]==='agent'){_0x1bc236[_0x6681('0x10a')]=this[_0x6681('0x21')][_0x25731e[_0x6681('0xb2')]][_0x6681('0x10b')]&&this['voiceQueues'][_0x25731e[_0x6681('0xb2')]]['dialAgiAfterHangupAgent']?moment()[_0x6681('0x79')](_0x6681('0xf5')):undefined;}this[_0x6681('0xc9')](_0x1bc236)[_0x6681('0xaf')](loggerCatch(_0x6681('0x10c')));this[_0x6681('0xc7')](_0x1bc236)[_0x6681('0xaf')](loggerCatch(_0x6681('0x10d')));}}};Dialer[_0x6681('0xac')][_0x6681('0x2e')]=function(_0x1b3de3){if(this[_0x6681('0x21')][_0x1b3de3[_0x6681('0xb2')]]){if(this[_0x6681('0x28')][_0x1b3de3['uniqueid']]&&this[_0x6681('0x28')][_0x1b3de3[_0x6681('0xda')]][_0x6681('0x4f')]!==_0x6681('0x7c')){this[_0x6681('0xb1')](this[_0x6681('0x21')][_0x1b3de3[_0x6681('0xb2')]]);this[_0x6681('0x28')][_0x1b3de3[_0x6681('0xda')]][_0x6681('0x10e')]=moment()[_0x6681('0x79')](_0x6681('0xf5'));}}};Dialer[_0x6681('0xac')][_0x6681('0x10f')]=function(_0x2e819e){this[_0x6681('0xc9')](_0x2e819e)[_0x6681('0xaf')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x6681('0xc7')](_0x2e819e)[_0x6681('0xaf')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x6681('0xac')][_0x6681('0x31')]=function(_0x550b14){var _0x133a16=this[_0x6681('0x28')][_0x550b14[_0x6681('0xda')]];var _0x1a2bb9=this;if(this[_0x6681('0x21')][_0x550b14[_0x6681('0xb2')]]){if(_0x133a16&&_0x133a16[_0x6681('0x4f')]!=='ivr'){delete this[_0x6681('0x28')][_0x550b14['uniqueid']];this[_0x6681('0xb1')](this[_0x6681('0x21')][_0x550b14[_0x6681('0xb2')]]);_0x133a16[_0x6681('0x110')]=moment()['format'](_0x6681('0xf5'));var _0x332b86=new QueueCallerAbandon(_0x133a16,_0x550b14);if(getSeconds(_0x133a16[_0x6681('0x110')],_0x133a16[_0x6681('0x111')])>=_0x133a16[_0x6681('0x112')]){this['voiceQueues'][_0x550b14[_0x6681('0xb2')]][_0x6681('0x81')]+=0x1;this[_0x6681('0x21')][_0x550b14['queue']][_0x6681('0x113')]+=0x1;this[_0x6681('0x21')][_0x550b14['queue']][_0x6681('0x114')]+=0x1;_0x332b86[_0x6681('0xde')]=0xa;_0x332b86[_0x6681('0xa9')]=_0x6681('0x115');_0x332b86[_0x6681('0x116')]='TIMEOUT';_0x332b86[_0x6681('0x10a')]=this[_0x6681('0x21')][_0x550b14[_0x6681('0xb2')]][_0x6681('0x10b')]?moment()['format'](_0x6681('0xf5')):undefined;_0x332b86['countdropretry']+=0x1;_0x332b86[_0x6681('0xe8')]+=0x1;if(_0x332b86['countdropretry']>=this[_0x6681('0x21')][_0x550b14[_0x6681('0xb2')]][_0x6681('0x117')]){this[_0x6681('0x10f')](_0x332b86);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x332b86[_0x6681('0xed')],'scheduledat':moment()[_0x6681('0x118')](this[_0x6681('0x21')][_0x550b14[_0x6681('0xb2')]][_0x6681('0x119')],_0x6681('0xf4'))[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x133a16[_0x6681('0xf6')],'ListId':_0x133a16[_0x6681('0xd1')],'VoiceQueueId':_0x133a16[_0x6681('0xf7')]||undefined,'CampaignId':_0x133a16[_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x11a')));var _0x5d65a4=new History(_0x332b86);_0x5d65a4[_0x6681('0xde')]=0xa;_0x5d65a4[_0x6681('0xa9')]=_0x6681('0x115');_0x5d65a4['starttime']=moment()['format'](_0x6681('0xf5'));_0x5d65a4[_0x6681('0xaa')]=_0x5d65a4[_0x6681('0xab')];_0x5d65a4[_0x6681('0x11b')]=_0x332b86[_0x6681('0x11b')];_0x5d65a4[_0x6681('0x11c')]=_0x332b86[_0x6681('0x11c')];this['createHistory'](_0x5d65a4)['catch'](loggerCatch(_0x6681('0x11d')));}}else{this[_0x6681('0x21')][_0x550b14[_0x6681('0xb2')]][_0x6681('0x6c')]+=0x1;this[_0x6681('0x21')][_0x550b14[_0x6681('0xb2')]][_0x6681('0x64')]+=0x1;_0x332b86[_0x6681('0xde')]=0xb;_0x332b86[_0x6681('0xa9')]=_0x6681('0x11e');_0x332b86[_0x6681('0x116')]=_0x6681('0x11f');_0x332b86[_0x6681('0xee')]+=0x1;_0x332b86['countglobal']+=0x1;if(_0x332b86[_0x6681('0xee')]>=this[_0x6681('0x21')][_0x550b14['queue']][_0x6681('0x120')]){this[_0x6681('0x10f')](_0x332b86);}else{this[_0x6681('0xbf')]({'active':![],'countabandonedretry':_0x332b86[_0x6681('0xee')],'scheduledat':moment()[_0x6681('0x118')](this['voiceQueues'][_0x550b14['queue']][_0x6681('0x121')],'minutes')[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x133a16[_0x6681('0xf6')],'ListId':_0x133a16[_0x6681('0xd1')],'VoiceQueueId':_0x133a16[_0x6681('0xf7')]||undefined,'CampaignId':_0x133a16['CampaignId']||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x122')));var _0x5d65a4=new History(_0x332b86);_0x5d65a4['state']=0xb;_0x5d65a4['statedesc']=_0x6681('0x11e');_0x5d65a4[_0x6681('0xab')]=moment()['format'](_0x6681('0xf5'));_0x5d65a4[_0x6681('0xaa')]=_0x5d65a4['starttime'];_0x5d65a4[_0x6681('0x11b')]=_0x332b86['calleridname'];_0x5d65a4[_0x6681('0x11c')]=_0x332b86['calleridnum'];this[_0x6681('0xc9')](_0x5d65a4)['catch'](loggerCatch(_0x6681('0x123')));}}}}};Dialer[_0x6681('0xac')][_0x6681('0x39')]=function(_0x49eaf2){if(this['actions'][_0x49eaf2[_0x6681('0xda')]]){this[_0x6681('0x26')][_0x49eaf2['uniqueid']][_0x6681('0x124')]=_0x49eaf2['channel'];}if(this[_0x6681('0x28')][_0x49eaf2[_0x6681('0xda')]]){this[_0x6681('0x28')][_0x49eaf2[_0x6681('0xda')]]['channel']=_0x49eaf2[_0x6681('0x124')];}};Dialer[_0x6681('0xac')][_0x6681('0x3c')]=function(_0x1a94d9){if(strategy[this[_0x6681('0x21')][this[_0x6681('0x26')][_0x1a94d9[_0x6681('0x125')]][_0x6681('0xb2')]][_0x6681('0x126')]]===_0x6681('0x1b')){if(this[_0x6681('0x26')][_0x1a94d9[_0x6681('0x125')]]&&_[_0x6681('0xae')](this[_0x6681('0x26')][_0x1a94d9[_0x6681('0x125')]][_0x6681('0x127')])&&_0x1a94d9['status']==='1'&&_0x1a94d9[_0x6681('0x128')]==='0'){if(this['agents'][_0x1a94d9[_0x6681('0x129')]]){if(!this[_0x6681('0x23')][_0x1a94d9[_0x6681('0x129')]][_0x6681('0x127')]){this['agents'][_0x1a94d9[_0x6681('0x129')]][_0x6681('0x127')]=!![];this[_0x6681('0x26')][_0x1a94d9[_0x6681('0x125')]][_0x6681('0x127')]=!![];this[_0x6681('0x26')][_0x1a94d9[_0x6681('0x125')]][_0x6681('0x129')]=_0x1a94d9[_0x6681('0x129')];}}}}else if((strategy[this[_0x6681('0x21')][this['actions'][_0x1a94d9[_0x6681('0x125')]][_0x6681('0xb2')]]['strategy']]||'rrmemory')===_0x6681('0x1a')){if(this['actions'][_0x1a94d9[_0x6681('0x125')]]){if(this[_0x6681('0x23')][_0x1a94d9['stateinterface']]){this[_0x6681('0x26')][_0x1a94d9[_0x6681('0x125')]][_0x6681('0x129')]=_0x1a94d9[_0x6681('0x129')];if(_[_0x6681('0xae')](this[_0x6681('0x2c')][this[_0x6681('0x26')][_0x1a94d9['actionid']][_0x6681('0xb2')]])){this[_0x6681('0x2c')][this['actions'][_0x1a94d9[_0x6681('0x125')]]['queue']]=[];}this[_0x6681('0x2c')][this['actions'][_0x1a94d9[_0x6681('0x125')]][_0x6681('0xb2')]]['push'](_[_0x6681('0x8d')](_[_0x6681('0xd0')](this[_0x6681('0x26')][_0x1a94d9['actionid']],[_0x6681('0x12a'),_0x6681('0x129')]),{'status':_0x1a94d9[_0x6681('0xd8')],'paused':_0x1a94d9['paused']}));}}}};function unlockQueueStatus(_0x4faf36,_0x459ba7){setTimeout(function(){if(_[_0x6681('0x3f')](_0x4faf36[_0x6681('0x12b')])){loggerBooked[_0x6681('0x95')]('[unlockQueueStatus][undefined]',_0x459ba7);}_0x4faf36[_0x6681('0x12b')]=!![];loggerBooked[_0x6681('0x7e')](_0x6681('0x12c'),_0x459ba7,JSON['stringify'](_[_0x6681('0xd0')](_0x4faf36,[_0x6681('0x42'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x6681('0xac')][_0x6681('0x12d')]=function(_0x598de6){var _0xb9f186=this;var _0x47f22a=_0xb9f186[_0x6681('0x21')][_0xb9f186[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]['queue']];if(strategy[this['voiceQueues'][this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0xb2')]][_0x6681('0x126')]]==='roundrobin'){if(this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]&&this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]['stateinterface']){this[_0x6681('0x20')][_0x6681('0x12e')](this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]['idHopper'],this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0x129')])[_0x6681('0xaf')](function(_0x49c6e2){logger[_0x6681('0x95')](_0x6681('0x12f'),util[_0x6681('0x96')](_0x49c6e2,{'showHidden':![],'depth':null}));})['finally'](function(){_0xb9f186[_0x6681('0xb1')](_0xb9f186[_0x6681('0x21')][_0xb9f186['actions'][_0x598de6[_0x6681('0x125')]][_0x6681('0xb2')]]);_0xb9f186[_0x6681('0x23')][_0xb9f186[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]['stateinterface']]['locked']=![];delete _0xb9f186['actions'][_0x598de6['actionid']];unlockQueueStatus(_0x47f22a);});}else{this[_0x6681('0xb1')](this[_0x6681('0x21')][this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0xb2')]]);this[_0x6681('0xbf')]({'active':![],'ContactId':this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0xf6')],'ListId':this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]['ListId'],'VoiceQueueId':this['actions'][_0x598de6['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x598de6['actionid']];unlockQueueStatus(_0x47f22a);}}else if((strategy[this[_0x6681('0x21')][this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0xb2')]][_0x6681('0x126')]]||'rrmemory')===_0x6681('0x1a')){var _0x2be3e5;if(this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]&&!_[_0x6681('0x49')](this[_0x6681('0x2c')][this['actions'][_0x598de6[_0x6681('0x125')]]['queue']])){if(this[_0x6681('0x130')][_0xb9f186[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0xb2')]]){this['queueBookedRR'][_0xb9f186['actions'][_0x598de6[_0x6681('0x125')]][_0x6681('0xb2')]]=this[_0x6681('0x130')][this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]][_0x6681('0xb2')]]?this[_0x6681('0x130')][this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]['queue']]:this[_0x6681('0x2c')][this[_0x6681('0x26')][_0x598de6[_0x6681('0x125')]]['queue']]?this['queueBooked'][this[_0x6681('0x26')][_0x598de6['actionid']][_0x6681('0xb2')]][_0x6681('0x131')]||0x0:0x0;}this['queueBooked'][this[_0x6681('0x26')][_0x598de6['actionid']][_0x6681('0xb2')]]['_rr']=this[_0x6681('0x130')][this['actions'][_0x598de6[_0x6681('0x125')]]['queue']];for(var _0x2405e6=0x0;_0x2405e6=0x0;})[_0x6681('0xaf')](myreject(_0x266ec3)));}}else{_0x601756[_0x6681('0x149')](ami[_0x6681('0x14a')]({'action':'command','command':util[_0x6681('0x79')](_0x6681('0x14c'),_0x57591f,!_[_0x6681('0x3f')](config[_0x6681('0x146')][_0x175018])?_0x175018:'')})[_0x6681('0xb7')](function(_0x19aac1){return _0x19aac1[_0x6681('0x14d')][_0x6681('0x14e')]('true')>=0x0;})['catch'](myreject(_0x266ec3)));}BPromise['all'](_0x601756)['then'](function(_0x48ddb4){var _0x4bd148=_[_0x6681('0x150')](_0x48ddb4);if(_0x4bd148){return _0x4102e9(_0x4bd148);}else{_0x1a3ffc[_0x6681('0x40')]=_0x3f867d?_0x6681('0x151'):_0x6681('0x152');return _0x266ec3(msgResponse(_0x6681('0x153'),_0x6681('0x143'),'Global:\x20'+_0x3f867d+'\x20'+_0x4aeef9+_0x6681('0x154')+util[_0x6681('0x96')](_0x57591f,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x175018));}})[_0x6681('0xaf')](function(_0xa12d6){return _0x266ec3(msgResponse(_0x6681('0x141'),'Failure',JSON['stringify'](_0xa12d6)));});});};Dialer['prototype']['checkDialMethod']=function(_0xd6b8b4){var _0x5a1f65=this;return function(){switch(_0xd6b8b4[_0x6681('0x155')]){case'progressive':freeVariablesPredictive(_0xd6b8b4);_0x5a1f65[_0x6681('0x156')](_0xd6b8b4,0x1);break;case _0x6681('0x157'):freeVariablesPredictive(_0xd6b8b4);_0x5a1f65['handlePower'](_0xd6b8b4,_0xd6b8b4[_0x6681('0x158')]);break;case _0x6681('0xa'):_0x5a1f65[_0x6681('0xa')](_0xd6b8b4);break;case _0x6681('0x9'):freeVariablesPredictive(_0xd6b8b4);_0x5a1f65[_0x6681('0x156')](_0xd6b8b4,0x1);break;default:freeVariablesPredictive(_0xd6b8b4);logger[_0x6681('0x95')](_0x6681('0x159'),_0xd6b8b4[_0x6681('0x42')],'method\x20not\x20recognized');}};};Dialer[_0x6681('0xac')]['launchHandleIvr']=function(_0x40307d){var _0xa91c4b=this;return function(){_0xa91c4b['handleIvr'](_0x40307d);};};Dialer['prototype']['syncQueueSummary']=function(_0x2c3e1c){var _0x44cf0f=this;if(isNotPreview(_0x2c3e1c['dialMethod'])){if(isVoiceQueueOutbound(_0x2c3e1c['type'])&&isActive(_0x2c3e1c[_0x6681('0x5c')])){_0x2c3e1c[_0x6681('0xa2')]=!![];BPromise[_0x6681('0xb6')]()[_0x6681('0xb7')](checkIsLoggedIn(_0x2c3e1c,_0x2c3e1c[_0x6681('0x15a')]))[_0x6681('0xb7')](checkIsActive(_0x2c3e1c,_0x2c3e1c[_0x6681('0x5c')]))[_0x6681('0xb7')](checkInterval(_0x2c3e1c))['then'](_0x44cf0f[_0x6681('0x13c')](_0x2c3e1c))[_0x6681('0xb7')](_0x44cf0f[_0x6681('0x15b')](_0x2c3e1c[_0x6681('0x15c')],_0x2c3e1c[_0x6681('0x15d')],_0x2c3e1c[_0x6681('0x42')],_0x2c3e1c))['then'](_0x44cf0f[_0x6681('0x142')](_0x2c3e1c[_0x6681('0x45')],_0x2c3e1c[_0x6681('0x15d')],_0x2c3e1c[_0x6681('0x42')],_0x2c3e1c))[_0x6681('0xb7')](_0x44cf0f[_0x6681('0x15e')](_0x2c3e1c))[_0x6681('0xaf')](loggerCatchQueueSummary(_0x6681('0x15f'),_0x2c3e1c));}else{notSendMessagesQueue(_0x2c3e1c);}}else{freeVariablesPredictive(_0x2c3e1c);}};Dialer['prototype'][_0x6681('0x13b')]=function(){var _0x2b3b2f=this;var _0x2eb5fc;for(var _0x81b9d9 in this[_0x6681('0x22')]){if(typeof this[_0x6681('0x22')][_0x81b9d9]!==_0x6681('0x99')){_0x2eb5fc=this['campaigns'][_0x81b9d9];if(isCampaignIvr(_0x2eb5fc[_0x6681('0x4f')])&&isActive(_0x2eb5fc[_0x6681('0x76')])){_0x2eb5fc['sendMessageOneNotActive']=!![];BPromise[_0x6681('0xb6')]()[_0x6681('0xb7')](checkIsActive(_0x2eb5fc,_0x2eb5fc[_0x6681('0x76')]))[_0x6681('0xb7')](checkInterval(_0x2eb5fc))[_0x6681('0xb7')](_0x2b3b2f[_0x6681('0x13c')](_0x2eb5fc))[_0x6681('0xb7')](_0x2b3b2f[_0x6681('0x15b')](_0x2eb5fc[_0x6681('0x15c')],_0x2eb5fc['dialTimezone'],_0x2eb5fc['name'],_0x2eb5fc))['then'](_0x2b3b2f[_0x6681('0x142')](_0x2eb5fc[_0x6681('0x45')],_0x2eb5fc['dialTimezone'],_0x2eb5fc['name'],_0x2eb5fc))[_0x6681('0xb7')](_0x2b3b2f['launchHandleIvr'](_0x2eb5fc))[_0x6681('0xaf')](loggerCatchQueueSummary('[syncCampaigns]',_0x2eb5fc));}else{notSendMessagesCampaign(_0x2eb5fc);}}}};function getCallerIdRandom(_0x59862a,_0x29f8cb){var _0x73da5e;var _0x1b67c8;var _0x340839;if(_0x29f8cb<=0x0){_0x29f8cb=0x1;}_0x73da5e=new RegExp(_0x6681('0x160')+_0x29f8cb+'}$');_0x1b67c8=Math[_0x6681('0x161')](0xa,_0x29f8cb-0x1);_0x340839=Math[_0x6681('0x161')](0xa,_0x29f8cb)-0x1;return util[_0x6681('0x79')]('%s',_[_0x6681('0x162')](_0x59862a,_0x73da5e,_[_0x6681('0x163')](_0x1b67c8,_0x340839)));}function extractCalleridName(_0x3379b8){var _0x4f3521=_0x3379b8[_0x6681('0x164')](/"(.*?)"/);return _0x4f3521?_0x4f3521[0x1]:_0x3379b8;}function extractCalleridNumber(_0x1b29eb){var _0x1c51b=_0x1b29eb['match'](/<(.*?)>/);return _0x1c51b?_0x1c51b[0x1]:_0x1b29eb;}Dialer[_0x6681('0xac')][_0x6681('0x165')]=function(_0x480429,_0x1e9a8e){var _0x5eb0c8=this;var _0x579d4c=uuid['v4']();this[_0x6681('0x26')][_0x579d4c]=new Action(_0x480429,_0x1e9a8e,_0x579d4c);return new BPromise(function(_0x2736c6,_0x58b44a){if(_[_0x6681('0x3f')](_0x480429)&&typeof _0x480429!==_0x6681('0x166')){return _0x58b44a(msgResponse(_0x6681('0x167'),_0x6681('0x143'),_0x6681('0x168')));}if(_[_0x6681('0x3f')](_0x1e9a8e[_0x6681('0x169')][_0x6681('0x16a')])||_0x1e9a8e[_0x6681('0x169')][_0x6681('0x16a')]===null){return _0x58b44a(msgResponse('originate',_0x6681('0x143'),_0x6681('0x16b')));}var _0x4ab543={'XMD-CALLERID':_0x5eb0c8['actions'][_0x579d4c][_0x6681('0x16c')](),'XMD-AGI':_0x480429[_0x6681('0x105')]?util[_0x6681('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x480429['dialQueueProject']):_0x6681('0x16d'),'XMD-AGIAFTER':_0x480429[_0x6681('0x10b')]?util['format'](_0x6681('0x16e'),ipAgi,_0x480429[_0x6681('0x10b')]):_0x6681('0x16d'),'XMD-QUEUE':_0x480429[_0x6681('0x4f')]==='outbound'?util[_0x6681('0x79')](_0x6681('0x16f'),_0x480429[_0x6681('0x42')],_0x480429[_0x6681('0x170')]||'',_0x480429[_0x6681('0x171')]?'c':'',_0x480429[_0x6681('0x112')]||0x3):'NONE','XMD-CONTACTID':_0x1e9a8e[_0x6681('0xf6')],'XMD-CDRTYPE':_0x6681('0x8'),'CALLERID(all)':_0x5eb0c8['actions'][_0x579d4c][_0x6681('0x16c')](),'XMD-AMD':_0x480429[_0x6681('0xe3')]?_0x6681('0x172'):_0x6681('0x16d'),'XMD-DESTINATION':_0x6681('0xdd')};if(_0x480429[_0x6681('0xe3')]){_0x4ab543[_0x6681('0x173')]=_0x480429['dialAMDInitialSilence']||0x9c4;_0x4ab543[_0x6681('0x174')]=_0x480429['dialAMDGreeting']||0x5dc;_0x4ab543[_0x6681('0x175')]=_0x480429[_0x6681('0x176')]||0x320;_0x4ab543[_0x6681('0x177')]=_0x480429[_0x6681('0x178')]||0x1388;_0x4ab543[_0x6681('0x179')]=_0x480429[_0x6681('0x17a')]||0x64;_0x4ab543['XMD-AMDBETWEENWORDSSILENCE']=_0x480429['dialAMDBetweenWordsSilence']||0x32;_0x4ab543[_0x6681('0x17b')]=_0x480429[_0x6681('0x17c')]||0x3;_0x4ab543[_0x6681('0x17d')]=_0x480429[_0x6681('0x17e')]||0x100;_0x4ab543['XMD-AMDMAXIMUMWORDLENGTH']=_0x480429[_0x6681('0x17f')]||0x1388;}if(_0x480429[_0x6681('0x4f')]==='outbound'){_0x4ab543[_0x6681('0x180')]=_0x1e9a8e['VoiceQueueId'];}else{_0x4ab543[_0x6681('0x181')]=_0x1e9a8e[_0x6681('0xd3')];}for(var _0x3bc46f in _0x1e9a8e[_0x6681('0x169')]){if(typeof _0x1e9a8e[_0x6681('0x169')][_0x3bc46f]!==_0x6681('0x99')){if(isNotNull(_0x1e9a8e[_0x6681('0x169')][_0x3bc46f])&&_0x3bc46f!=='id'&&_0x3bc46f!==_0x6681('0x182')&&_0x3bc46f!==_0x6681('0x183')&&_0x3bc46f!==_0x6681('0x184')){_0x4ab543[util['format'](_0x6681('0x185'),_0x6681('0x186'),_[_0x6681('0x187')](_0x3bc46f))]=_0x1e9a8e[_0x6681('0x169')][_0x3bc46f];}}}var _0xaac7c8=_0x5eb0c8[_0x6681('0x13d')](_0x480429[_0x6681('0x75')])?getCallerId(_0x480429[_0x6681('0x75')][_0x6681('0x77')],_0x480429[_0x6681('0x5d')],_0x480429['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x480429[_0x6681('0x188')],_0x480429[_0x6681('0x189')]):_0x480429['dialOriginateCallerIdNumber']):getCallerId(_[_0x6681('0xae')](_0x480429[_0x6681('0x13e')])?_0x480429[_0x6681('0x75')][_0x6681('0x77')]:_0x480429[_0x6681('0x13e')][_0x6681('0x77')],_0x480429[_0x6681('0x5d')],_0x480429[_0x6681('0x189')]>0x0?getCallerIdRandom(_0x480429[_0x6681('0x188')],_0x480429[_0x6681('0x189')]):_0x480429[_0x6681('0x188')]);if(_0xaac7c8){_0x4ab543['XMD-ORIGINATECALLERIDNAME']=_0x5eb0c8[_0x6681('0x26')][_0x579d4c][_0x6681('0x18a')]=extractCalleridName(_0xaac7c8);_0x4ab543[_0x6681('0x18b')]=_0x5eb0c8[_0x6681('0x26')][_0x579d4c]['originatecalleridnum']=extractCalleridNumber(_0xaac7c8);}return ami[_0x6681('0x14a')]({'actionid':_0x579d4c,'action':_0x6681('0x167'),'channel':_0x5eb0c8[_0x6681('0x13d')](_0x480429['Trunk'])?util[_0x6681('0x79')]('SIP/%s/%s%s',_0x480429[_0x6681('0x75')][_0x6681('0x42')],isNotNull(_0x480429['dialPrefix'])?_0x480429[_0x6681('0x5f')][_0x6681('0x18c')]()||'':'',_0x480429[_0x6681('0x18d')]>0x0?_0x1e9a8e[_0x6681('0x169')][_0x6681('0x16a')][_0x6681('0x18e')](_0x480429[_0x6681('0x18d')]):_0x1e9a8e[_0x6681('0x169')][_0x6681('0x16a')]):util['format']('SIP/%s/%s%s',_[_0x6681('0xae')](_0x480429[_0x6681('0x13e')])?_0x480429[_0x6681('0x75')][_0x6681('0x42')]:_0x480429[_0x6681('0x13e')]['name'],isNotNull(_0x480429[_0x6681('0x5f')])?_0x480429['dialPrefix']['trim']()||'':'',_0x480429[_0x6681('0x18d')]>0x0?_0x1e9a8e[_0x6681('0x169')][_0x6681('0x16a')][_0x6681('0x18e')](_0x480429['dialCutDigit']):_0x1e9a8e['Contact'][_0x6681('0x16a')]),'callerid':_0xaac7c8,'Exten':_0x6681('0xdd'),'Context':'from-sip','Priority':'1','variable':_0x4ab543,'timeout':(_0x480429[_0x6681('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x579d4c})['then'](function(_0x1e67bd){return _0x2736c6(_0x1e67bd);})['catch'](function(_0x211a7a){_0x480429[_0x6681('0x66')]+=0x1;var _0xe900d3=new History(_0x5eb0c8[_0x6681('0x26')][_0x579d4c]);logger[_0x6681('0x95')](util[_0x6681('0x79')](_0x6681('0x18f'),JSON[_0x6681('0x4c')](_0x211a7a)));_0xe900d3[_0x6681('0xde')]=0xe;_0xe900d3[_0x6681('0xa9')]='OriginateError';_0xe900d3[_0x6681('0xab')]=moment()['format'](_0x6681('0xf5'));_0xe900d3['endtime']=_0xe900d3[_0x6681('0xab')];_0x5eb0c8[_0x6681('0xc9')](_0xe900d3)['catch'](loggerCatch(_0x6681('0x190')));_0x5eb0c8[_0x6681('0xc7')](_0xe900d3)[_0x6681('0xaf')](loggerCatch('[originate][error]'))[_0x6681('0x1e')](function(){delete _0x5eb0c8[_0x6681('0x26')][_0x579d4c];return _0x58b44a(msgResponse('originate',_0x6681('0x4b'),_0x6681('0x191')));});});});};Dialer['prototype'][_0x6681('0x33')]=function(_0x5873b0){var _0x4073cb=this[_0x6681('0x26')][_0x5873b0[_0x6681('0x125')]];if(_0x4073cb){delete this[_0x6681('0x26')][_0x5873b0[_0x6681('0x125')]];_0x4073cb['responsetime']=moment()['format'](_0x6681('0xf5'));var _0xbd4529=_0x4073cb[_0x6681('0x4f')]===_0x6681('0x7c')?this[_0x6681('0x22')][_0x4073cb[_0x6681('0xb2')]]:this[_0x6681('0x21')][_0x4073cb[_0x6681('0x192')]()];if(!this[_0x6681('0xd5')](_0x5873b0[_0x6681('0x193')])){this[_0x6681('0xb1')](_0xbd4529);return this['callProgressDetecting'](_0x4073cb,_0xbd4529,_0x5873b0)[_0x6681('0xaf')](loggerCatch(_0x6681('0x194')));}this[_0x6681('0x28')][_0x5873b0['uniqueid']]=_0x4073cb;}};Dialer[_0x6681('0xac')][_0x6681('0x195')]=function(_0x6be47f,_0x3a4b06,_0xafaa4){var _0x3055c7=new History(_0x3a4b06);if(_0x3055c7[_0x6681('0xea')]+_0x3055c7['countcongestionretry']+_0x3055c7['countnoanswerretry']+_0x3055c7[_0x6681('0xec')]+_0x3055c7['countdropretry']+_0x3055c7[_0x6681('0xee')]+_0x3055c7[_0x6681('0xe7')]+_0x3055c7[_0x6681('0xef')]>=_0xafaa4[_0x6681('0xf0')]-0x1){return!![];}switch(_0x6be47f){case 0x3:if(_0x3055c7['countnoanswerretry']>=_0xafaa4['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x6681('0xbf')]({'active':![],'countnoanswerretry':_0x3055c7[_0x6681('0xeb')]+=0x1,'scheduledat':moment()[_0x6681('0x118')](_0xafaa4['dialNoAnswerRetryFrequency'],_0x6681('0xf4'))[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x3055c7[_0x6681('0xf6')],'ListId':_0x3055c7[_0x6681('0xd1')],'VoiceQueueId':_0x3055c7[_0x6681('0xf7')]||undefined,'CampaignId':_0x3055c7[_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x196')));break;case 0x5:if(_0x3055c7[_0x6681('0xea')]>=_0xafaa4['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3055c7['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0xafaa4['dialBusyRetryFrequency'],_0x6681('0xf4'))['format'](_0x6681('0xf5')),'ContactId':_0x3055c7['ContactId'],'ListId':_0x3055c7[_0x6681('0xd1')],'VoiceQueueId':_0x3055c7[_0x6681('0xf7')]||undefined,'CampaignId':_0x3055c7['CampaignId']||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x197')));break;case 0x8:if(_0x3055c7['countcongestionretry']>=_0xafaa4[_0x6681('0x198')]-0x1){return!![];}this[_0x6681('0xbf')]({'active':![],'countcongestionretry':_0x3055c7[_0x6681('0xfe')]+=0x1,'scheduledat':moment()[_0x6681('0x118')](_0xafaa4[_0x6681('0x199')],'minutes')[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x3055c7[_0x6681('0xf6')],'ListId':_0x3055c7[_0x6681('0xd1')],'VoiceQueueId':_0x3055c7[_0x6681('0xf7')]||undefined,'CampaignId':_0x3055c7[_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x19a')));break;case 0x0:if(_0x3055c7[_0x6681('0xec')]>=_0xafaa4[_0x6681('0x19b')]-0x1){return!![];}else{this[_0x6681('0xbf')]({'active':![],'countnosuchnumberretry':_0x3055c7[_0x6681('0xec')]+=0x1,'scheduledat':moment()[_0x6681('0x118')](_0xafaa4[_0x6681('0x19c')],_0x6681('0xf4'))[_0x6681('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3055c7['ContactId'],'ListId':_0x3055c7['ListId'],'VoiceQueueId':_0x3055c7[_0x6681('0xf7')]||undefined,'CampaignId':_0x3055c7['CampaignId']||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x19d')));}break;case 0xa:if(_0x3055c7[_0x6681('0xed')]>=_0xafaa4[_0x6681('0x117')]-0x1){return!![];}this[_0x6681('0xbf')]({'active':![],'countdropretry':_0x3055c7[_0x6681('0xed')]+=0x1,'scheduledat':moment()[_0x6681('0x118')](_0xafaa4[_0x6681('0x119')],_0x6681('0xf4'))[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x3055c7[_0x6681('0xf6')],'ListId':_0x3055c7[_0x6681('0xd1')],'VoiceQueueId':_0x3055c7[_0x6681('0xf7')]||undefined,'CampaignId':_0x3055c7[_0x6681('0xd3')]||undefined})['catch'](loggerCatch(_0x6681('0x11a')));break;case 0xb:if(_0x3055c7[_0x6681('0xee')]>=_0xafaa4[_0x6681('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x3055c7[_0x6681('0xee')]+=0x1,'scheduledat':moment()[_0x6681('0x118')](_0xafaa4['dialAbandonedRetryFrequency'],_0x6681('0xf4'))[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x3055c7['ContactId'],'ListId':_0x3055c7[_0x6681('0xd1')],'VoiceQueueId':_0x3055c7[_0x6681('0xf7')]||undefined,'CampaignId':_0x3055c7[_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x122')));break;case 0x13:if(_0x3055c7['countmachineretry']>=_0xafaa4[_0x6681('0x100')]-0x1){return!![];}this[_0x6681('0xbf')]({'active':![],'countmachineretry':_0x3055c7[_0x6681('0xe7')]+=0x1,'scheduledat':moment()['add'](_0xafaa4[_0x6681('0xf3')],_0x6681('0xf4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3055c7[_0x6681('0xf6')],'ListId':_0x3055c7[_0x6681('0xd1')],'VoiceQueueId':_0x3055c7['VoiceQueueId']||undefined,'CampaignId':_0x3055c7[_0x6681('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3055c7['countagentrejectretry']>=_0xafaa4[_0x6681('0x19e')]-0x1){return!![];}this[_0x6681('0xbf')]({'active':![],'countagentrejectretry':_0x3055c7[_0x6681('0xef')]+=0x1,'scheduledat':moment()[_0x6681('0x118')](_0xafaa4[_0x6681('0x19f')],_0x6681('0xf4'))[_0x6681('0x79')](_0x6681('0xf5')),'ContactId':_0x3055c7[_0x6681('0xf6')],'ListId':_0x3055c7[_0x6681('0xd1')],'VoiceQueueId':_0x3055c7[_0x6681('0xf7')]||undefined,'CampaignId':_0x3055c7[_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x6681('0x1a0')]=function(_0x2e5545,_0x502bb6,_0x24b40f){var _0x503724=this;var _0x3db9eb=new History(_0x2e5545);return new BPromise(function(_0x708f3b,_0x55822b){if(_[_0x6681('0x3f')](_0x502bb6)&&typeof _0x502bb6!=='object'){return _0x55822b(msgResponse('[callProgressDetecting]',_0x6681('0x143'),_0x6681('0x1a1')));}if(_[_0x6681('0x3f')](_0x24b40f)&&typeof _0x24b40f!=='object'){return _0x55822b(msgResponse('[callProgressDetecting]',_0x6681('0x143'),_0x6681('0x1a2')));}switch(_0x24b40f['reason']){case'0':_0x502bb6[_0x6681('0x65')]+=0x1;_0x3db9eb[_0x6681('0xde')]=0x0;_0x3db9eb[_0x6681('0xa9')]=_0x6681('0x1a3');_0x3db9eb[_0x6681('0xec')]+=0x1;_0x3db9eb[_0x6681('0xe8')]+=0x1;ami[_0x6681('0x1a4')](_0x6681('0x1a5'),ut[_0x6681('0x1a6')](_0x2e5545,_0x6681('0x1a7')));_0x503724['createHistory'](_0x3db9eb)[_0x6681('0xaf')](loggerCatch(_0x6681('0xe9')));if(_0x503724['checkRetriveMax'](0x0,_0x2e5545,_0x502bb6)){if(_0x3db9eb[_0x6681('0xec')]>=_0x502bb6['dialNoSuchNumberMaxRetry']){_0x503724['createStateFinal'](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1a8'));}else{_0x503724['stateGlobal'](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1a8'));}}break;case'3':_0x502bb6[_0x6681('0x1a9')]+=0x1;_0x3db9eb['state']=0x3;_0x3db9eb[_0x6681('0xa9')]=_0x6681('0x1aa');_0x3db9eb[_0x6681('0xeb')]+=0x1;_0x3db9eb[_0x6681('0xe8')]+=0x1;ami[_0x6681('0x1a4')](_0x6681('0x1ab'),ut[_0x6681('0x1a6')](_0x2e5545,_0x6681('0x1ac')));_0x503724[_0x6681('0xc9')](_0x3db9eb)[_0x6681('0xaf')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x503724[_0x6681('0x195')](0x3,_0x2e5545,_0x502bb6)){if(_0x3db9eb[_0x6681('0xeb')]>=_0x502bb6[_0x6681('0x1ad')]){_0x503724[_0x6681('0x101')](_0x3db9eb,_0x708f3b,_0x55822b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x503724[_0x6681('0xf1')](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1ae'));}}break;case'5':_0x502bb6[_0x6681('0x62')]+=0x1;_0x3db9eb['state']=0x5;_0x3db9eb[_0x6681('0xa9')]=_0x6681('0x1af');_0x3db9eb[_0x6681('0xea')]+=0x1;_0x3db9eb[_0x6681('0xe8')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x6681('0x1a6')](_0x2e5545,'busy'));_0x503724[_0x6681('0xc9')](_0x3db9eb)[_0x6681('0xaf')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x503724['checkRetriveMax'](0x5,_0x2e5545,_0x502bb6)){if(_0x3db9eb[_0x6681('0xea')]>=_0x502bb6['dialBusyMaxRetry']){_0x503724[_0x6681('0x101')](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1b0'));}else{_0x503724['stateGlobal'](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1b0'));}}break;case'8':_0x502bb6[_0x6681('0x63')]+=0x1;_0x3db9eb[_0x6681('0xde')]=0x8;_0x3db9eb['statedesc']=_0x6681('0x1b1');_0x3db9eb[_0x6681('0xfe')]+=0x1;_0x3db9eb[_0x6681('0xe8')]+=0x1;ami[_0x6681('0x1a4')](_0x6681('0x1b2'),ut['buildObj'](_0x2e5545,_0x6681('0x1b3')));_0x503724[_0x6681('0xc9')](_0x3db9eb)[_0x6681('0xaf')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x503724['checkRetriveMax'](0x8,_0x2e5545,_0x502bb6)){if(_0x3db9eb[_0x6681('0xfe')]>=_0x502bb6[_0x6681('0x198')]){_0x503724['createStateFinal'](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1b4'));}else{_0x503724[_0x6681('0xf1')](_0x3db9eb,_0x708f3b,_0x55822b,'reason\x208\x20congestion');}}break;case'11':_0x502bb6[_0x6681('0x1b5')]+=0x1;_0x3db9eb[_0x6681('0xde')]=0xb;_0x3db9eb[_0x6681('0xa9')]=_0x6681('0x11e');_0x3db9eb[_0x6681('0xee')]+=0x1;_0x3db9eb[_0x6681('0xe8')]+=0x1;_0x503724[_0x6681('0xc9')](_0x3db9eb)[_0x6681('0xaf')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x503724[_0x6681('0x195')](0xb,_0x2e5545,_0x502bb6)){if(_0x3db9eb['countabandonedretry']>=_0x502bb6[_0x6681('0x120')]){_0x503724[_0x6681('0x101')](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1b6'));}else{_0x503724[_0x6681('0xf1')](_0x3db9eb,_0x708f3b,_0x55822b,'reason\x2011\x20abandoned');}}break;case'20':_0x502bb6[_0x6681('0x68')]+=0x1;_0x3db9eb[_0x6681('0xde')]=0x14;_0x3db9eb['statedesc']=_0x6681('0x1b7');_0x3db9eb['countagentrejectretry']+=0x1;_0x3db9eb[_0x6681('0xe8')]+=0x1;ami[_0x6681('0x1a4')](_0x6681('0x1b8'),ut[_0x6681('0x1a6')](_0x2e5545,_0x6681('0x1b9')));_0x503724[_0x6681('0xc9')](_0x3db9eb)['catch'](loggerCatch(_0x6681('0x1ba')));if(_0x503724[_0x6681('0x195')](0x14,_0x2e5545,_0x502bb6)){if(_0x3db9eb[_0x6681('0xef')]>=_0x502bb6[_0x6681('0x19e')]){_0x503724[_0x6681('0x101')](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1bb'));}else{_0x503724[_0x6681('0xf1')](_0x3db9eb,_0x708f3b,_0x55822b,_0x6681('0x1bb'));}}break;default:_0x502bb6['outboundUnknownCallsDay']+=0x1;_0x3db9eb[_0x6681('0xde')]=0xc;_0x3db9eb[_0x6681('0xa9')]=_0x24b40f['reason'];_0x503724[_0x6681('0xc9')](_0x3db9eb)['catch'](loggerCatch(_0x6681('0x1bc')));if(_0x503724[_0x6681('0x195')](_0x24b40f[_0x6681('0x109')],_0x2e5545,_0x502bb6)){if(_0x3db9eb[_0x6681('0xea')]+_0x3db9eb['countcongestionretry']+_0x3db9eb['countnoanswerretry']+_0x3db9eb[_0x6681('0xec')]+_0x3db9eb['countdropretry']+_0x3db9eb[_0x6681('0xee')]+_0x3db9eb['countmachineretry']+_0x3db9eb[_0x6681('0xef')]>=_0x502bb6[_0x6681('0xf0')]){_0x503724[_0x6681('0xf1')](_0x3db9eb,_0x708f3b,_0x55822b,_0x24b40f[_0x6681('0x109')]);}else{_0x503724[_0x6681('0x101')](_0x3db9eb,_0x708f3b,_0x55822b,_0x24b40f[_0x6681('0x109')]);}}}});};Dialer[_0x6681('0xac')]['stateGlobal']=function(_0x4996d7,_0x10d093,_0x565866,_0x4ee069){var _0x11ed90=new Final(_0x4996d7);_0x11ed90[_0x6681('0xde')]=0xf;_0x11ed90[_0x6681('0xa9')]=_0x6681('0x1bd');this['createStateFinal'](_0x11ed90,_0x10d093,_0x565866,_0x4ee069);};Dialer[_0x6681('0xac')][_0x6681('0x101')]=function(_0x453696,_0x3998db,_0x4fd71c,_0x41121c){this[_0x6681('0xc7')](_0x453696)['then'](function(){return _0x3998db(msgResponse('[callProgressDetecting]',_0x6681('0x1be'),_0x41121c));})[_0x6681('0xaf')](function(){return _0x4fd71c(msgResponse(_0x6681('0x1bf'),_0x6681('0x143'),'contact\x20not\x20moved'));});};Dialer[_0x6681('0xac')]['predictive']=function(_0x441faa){var _0x290068=_0x441faa[_0x6681('0x1c0')]/0x64;var _0x1a2521=_0x441faa[_0x6681('0x113')]/(_0x441faa[_0x6681('0x113')]+_0x441faa[_0x6681('0xe5')]);var _0x8a7192=Math[_0x6681('0x1c1')](_0x441faa[_0x6681('0x1c2')]*(_0x441faa[_0x6681('0x1c3')]/0x64));var _0x2fdb2e=Math[_0x6681('0x1c1')](_0x441faa[_0x6681('0x1c2')]*(_0x441faa[_0x6681('0x1c4')]/0x64));var _0x4e41a9=_0x441faa[_0x6681('0x52')]+_0x441faa[_0x6681('0x56')];var _0x215c5a=Math['floor'](_0x441faa[_0x6681('0x72')]*_0x441faa[_0x6681('0x74')]*_0x441faa[_0x6681('0x6d')]*_0x441faa[_0x6681('0x6e')]);if(_['isUndefined'](_0x441faa[_0x6681('0x2a')])){if(!_[_0x6681('0x3f')](_0x441faa[_0x6681('0x29')])){_0x441faa['startPredictive']=undefined;loggerPredictive['error'](_0x6681('0x1c5'),_0x6681('0x1c6'));}if(!_[_0x6681('0x3f')](_0x441faa[_0x6681('0x90')])){loggerPredictive[_0x6681('0x95')](_0x6681('0x1c5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x441faa[_0x6681('0x90')]);_0x441faa[_0x6681('0x90')]=undefined;}_0x441faa['startProgressive']=moment()[_0x6681('0x79')](_0x6681('0xf5'));loggerPredictive['info'](_0x441faa[_0x6681('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x441faa[_0x6681('0x2a')]);this['handlePower'](_0x441faa,0x1);}else if(ifInterval(_0x441faa[_0x6681('0x1c7')],_0x441faa[_0x6681('0x2a')])){this['handlePower'](_0x441faa,0x1);loggerPredictiveCalls[_0x6681('0x7e')](_0x6681('0x1c8'),_0x441faa['startProgressive'],_0x441faa[_0x6681('0x42')]);_0x441faa[_0x6681('0x72')]=0x0;_0x441faa[_0x6681('0x114')]=0x0;}else if(_0x290068<_0x1a2521&&_0x441faa[_0x6681('0x1c9')]==='dropRate'){freeVariablesPredictive(_0x441faa);loggerPredictive[_0x6681('0x7e')](_0x6681('0x1ca'),'Dropped\x20calls\x20day',_0x1a2521,_0x6681('0x2a'),_0x441faa[_0x6681('0x42')]);}else if(_0x215c5a<_0x441faa[_0x6681('0x114')]&&_0x441faa[_0x6681('0x1c9')]===_0x6681('0x1cb')){freeVariablesPredictive(_0x441faa);loggerPredictive['info'](_0x6681('0x1cc'),'Max\x20Drop\x20',_0x215c5a,_0x6681('0x1cd'),_0x441faa[_0x6681('0x114')],_0x6681('0x2a'),_0x441faa[_0x6681('0x42')]);}else if(!ifInterval(_0x441faa[_0x6681('0x1c7')],_0x441faa[_0x6681('0x2a')])&&_[_0x6681('0x3f')](_0x441faa[_0x6681('0x29')])&&!_['isUndefined'](_0x441faa[_0x6681('0x2a')])){_0x441faa[_0x6681('0x29')]=moment()['format'](_0x6681('0xf5'));loggerPredictive[_0x6681('0x7e')](_0x441faa[_0x6681('0x42')],_0x6681('0x1ce'),_0x441faa['startPredictive']);this[_0x6681('0xbd')](_0x441faa[_0x6681('0x1c7')])[_0x6681('0xb7')](this[_0x6681('0x1cf')](_0x441faa))['then'](mergeDataErlangB(_0x441faa))['then'](this[_0x6681('0x1d0')](_0x441faa))[_0x6681('0xaf')](loggerCatchPredictive(_0x6681('0x1d1'),_0x441faa));}else if(!ifInterval(_0x441faa['dialPredictiveInterval'],_0x441faa['startPredictive'])){_0x441faa[_0x6681('0x114')]=0x0;_0x441faa[_0x6681('0x29')]=moment()[_0x6681('0x79')](_0x6681('0xf5'));loggerPredictive[_0x6681('0x7e')](_0x441faa[_0x6681('0x42')],_0x6681('0x1d2'),_0x441faa[_0x6681('0x29')]);clearInterval(_0x441faa[_0x6681('0x90')]);_0x441faa['handlePredictive']=undefined;this['averageHandleTime'](_0x441faa[_0x6681('0x1c7')])[_0x6681('0xb7')](this['getDataPredictive'](_0x441faa))['then'](mergeDataErlangB(_0x441faa))[_0x6681('0xb7')](this[_0x6681('0x1d0')](_0x441faa))['catch'](loggerCatchPredictive(_0x6681('0x1d3'),_0x441faa));}else if(_0x441faa[_0x6681('0x1c2')]&&_0x4e41a9<_0x441faa[_0x6681('0x1c2')]-_0x2fdb2e){freeVariablesPredictive(_0x441faa);loggerPredictive[_0x6681('0x7e')](_0x441faa[_0x6681('0x42')],_0x6681('0x1d4'),_0x4e41a9,_0x6681('0x1d5'),_0x441faa[_0x6681('0x1c2')],'-',_0x2fdb2e,'=',_0x441faa[_0x6681('0x1c2')]-_0x2fdb2e,')');}else if(_0x441faa[_0x6681('0x1c2')]&&_0x4e41a9>_0x441faa[_0x6681('0x1c2')]+_0x8a7192){freeVariablesPredictive(_0x441faa);loggerPredictive[_0x6681('0x7e')](_0x441faa[_0x6681('0x42')],_0x6681('0x1d4'),_0x4e41a9,')\x20are\x20more\x20than\x20threshold\x20(',_0x441faa[_0x6681('0x1c2')],'+',_0x8a7192,'=',_0x441faa['predictiveIntervalAvailable']+_0x8a7192,')');}};Dialer['prototype'][_0x6681('0x1cf')]=function(_0x3da2b4){var _0x360f2f=this;return function(_0x39eb59){return new BPromise(function(_0x2271cb,_0x1bf98b){_[_0x6681('0x8d')](_0x3da2b4,_0x39eb59[0x0]);if(checkGetDataPredictive(_0x39eb59[0x0])){var _0x2b570e=_0x3da2b4[_0x6681('0x1c2')]=_0x3da2b4[_0x6681('0x56')]+_0x3da2b4[_0x6681('0x52')];var _0x12c91d=_0x3da2b4['dialPredictiveInterval']*0x3c;var _0x341a33=_0x39eb59[0x0]['predictiveIntervalAvgTalktime']+_0x39eb59[0x0][_0x6681('0x6a')];var _0x245822=(_0x39eb59[0x0][_0x6681('0x80')]+_0x39eb59[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x39eb59[0x0][_0x6681('0x6c')])/_0x39eb59[0x0]['predictiveIntervalTotalCalls'];_0x3da2b4['predictiveIntervalHitRate']=_0x245822>0x0?_0x245822:0x1;switch(_0x3da2b4[_0x6681('0x1c9')]){case _0x6681('0x1cb'):var _0x1a3cb2=_0x3da2b4[_0x6681('0x1c0')]/0x64;return _0x360f2f[_0x6681('0x1d6')](_0x2b570e,_0x12c91d,_0x341a33,_0x245822,_0x1a3cb2)[_0x6681('0xb7')](function(_0x4f203e){return _0x2271cb(_0x4f203e);});case _0x6681('0x1d7'):var _0x4c22c5=_0x3da2b4[_0x6681('0x1c0')]/0x64;return _0x360f2f[_0x6681('0x1d8')](_0x2b570e,_0x12c91d,_0x341a33,_0x245822,_0x4c22c5)[_0x6681('0xb7')](function(_0xa73b0f){return _0x2271cb(_0xa73b0f);});default:return _0x1bf98b(msgResponse('[getDataPredictive]',_0x6681('0x143'),'Unknown\x20Predictive'));}}else{return _0x1bf98b(msgResponse(_0x6681('0x1d9'),_0x6681('0x143'),_0x6681('0x1da')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x59a6c4){var _0x36c8e2=this;return function(_0x1f8f5c){return new BPromise(function(_0x3589fc,_0x45d9a2){_[_0x6681('0x8d')](_0x59a6c4,_0x1f8f5c[0x0]);if(checkGetDataPredictive(_0x1f8f5c[0x0])){loggerPredictive['info'](JSON[_0x6681('0x4c')](_0x1f8f5c[0x0]));if(_0x59a6c4[_0x6681('0x1c9')]==='dropRate'){return _0x36c8e2[_0x6681('0xc6')](_0x59a6c4['id'])[_0x6681('0xb7')](function(_0x23f414){var _0x1694f8=_0x59a6c4['loggedIn']-_0x23f414[0x0]['outboundQueuePauses'];var _0x3c0d34=_0x59a6c4[_0x6681('0x1c7')]*0x3c;var _0x4134a1=_0x1f8f5c[0x0][_0x6681('0x6b')]+_0x1f8f5c[0x0][_0x6681('0x6a')];var _0x3f0164=(_0x1f8f5c[0x0][_0x6681('0x80')]+_0x1f8f5c[0x0][_0x6681('0x81')]+_0x1f8f5c[0x0][_0x6681('0x6c')])/_0x1f8f5c[0x0][_0x6681('0x70')];var _0x3bd165=_0x59a6c4[_0x6681('0x1c0')]/0x64;_0x59a6c4[_0x6681('0x6f')]=_0x23f414[0x0][_0x6681('0x1db')]||0x0;_0x59a6c4[_0x6681('0x6d')]=_0x3f0164>0x0?_0x3f0164:0x1;return _0x36c8e2[_0x6681('0x1d6')](_0x1694f8,_0x3c0d34,_0x4134a1,_0x3f0164,_0x3bd165);})[_0x6681('0xb7')](function(_0x9f2901){return _0x3589fc(_0x9f2901);})[_0x6681('0xaf')](function(_0x3d1d8c){return _0x45d9a2(msgResponse(_0x6681('0x1dc'),_0x6681('0x143'),JSON[_0x6681('0x4c')](_0x3d1d8c)));});}if(_0x59a6c4[_0x6681('0x1c9')]===_0x6681('0x1d7')){return _0x36c8e2[_0x6681('0xc6')](_0x59a6c4['id'])['then'](function(_0x5c95ae){var _0x3c2df9=_0x59a6c4[_0x6681('0x15a')]-_0x5c95ae[0x0][_0x6681('0x1db')];var _0xad8913=_0x59a6c4[_0x6681('0x1c7')]*0x3c;var _0x51c286=_0x1f8f5c[0x0][_0x6681('0x6b')]+_0x1f8f5c[0x0][_0x6681('0x6a')];var _0x286e2f=(_0x1f8f5c[0x0]['predictiveIntervalAnsweredCalls']+_0x1f8f5c[0x0][_0x6681('0x81')]+_0x1f8f5c[0x0][_0x6681('0x6c')])/_0x1f8f5c[0x0][_0x6681('0x70')];var _0x3b9aaf=_0x59a6c4[_0x6681('0x1c0')]/0x64;_0x59a6c4[_0x6681('0x6f')]=_0x5c95ae[0x0]['outboundQueuePauses']||0x0;_0x59a6c4['predictiveIntervalHitRate']=_0x286e2f>0x0?_0x286e2f:0x1;return _0x36c8e2['busyFactor'](_0x3c2df9,_0xad8913,_0x51c286,_0x286e2f,_0x3b9aaf);})[_0x6681('0xb7')](function(_0x39f5a5){return _0x3589fc(_0x39f5a5);})['catch'](function(_0x3976a1){return _0x45d9a2(msgResponse(_0x6681('0x1dc'),_0x6681('0x143'),JSON[_0x6681('0x4c')](_0x3976a1)));});}}else{return _0x45d9a2(msgResponse(_0x6681('0x1d9'),_0x6681('0x143'),_0x6681('0x1da')));}});};};Dialer['prototype'][_0x6681('0x1d0')]=function(_0x435d65){var _0x403eb1=this;return function(){var _0x1c646a=0x0;var _0xaf629a=Math[_0x6681('0x1dd')](_0x435d65['erlangCallToSecond']*0x3e8);if(_0xaf629a>0x0){_0xaf629a=_0xaf629a<0x64?0x64:_0xaf629a;loggerPredictive[_0x6681('0x7e')](_0x435d65['name'],'one\x20call\x20every:',_0xaf629a,_0x6681('0x4d'));_0x435d65['handlePredictive']=setInterval(function(){_0x403eb1[_0x6681('0x90')](_0x435d65);loggerPredictiveCalls[_0x6681('0x7e')](_0x6681('0x1de'),_0x1c646a+=0x1);},_0xaf629a);}else{loggerPredictive[_0x6681('0x7e')](_0x435d65[_0x6681('0x42')],_0x6681('0x1df'));}};};Dialer[_0x6681('0xac')][_0x6681('0x1e0')]=function(_0x412422,_0x263c99){var _0x260370=this;return function(_0xf89424){if(_[_0x6681('0x49')](_0xf89424)){if(_['isNil'](_0x263c99[_0x6681('0xd2')])||!_0x263c99[_0x6681('0x1e1')]){if(_0x412422[_0x6681('0x155')]==='booked'){_0x412422[_0x6681('0x12b')]=_[_0x6681('0x3f')](_0x412422[_0x6681('0x12b')])?!![]:_0x412422[_0x6681('0x12b')];var _0x3dbd34=uuid['v4']();_0x260370[_0x6681('0x26')][_0x3dbd34]=new Action(_0x412422,_0x263c99,_0x3dbd34);loggerBooked[_0x6681('0x7e')]('[booked][checkContactBlack]',_0x3dbd34,_0x6681('0x1e2'),JSON[_0x6681('0x4c')](_0x412422[_0x6681('0x12b')]),_0x6681('0x1e3'),_0x412422['name']);if(_0x412422[_0x6681('0x12b')]){_0x412422[_0x6681('0x12b')]=![];_0x260370[_0x6681('0x2c')][_0x260370['actions'][_0x3dbd34]['queue']]=[];ami[_0x6681('0x14a')]({'actionid':_0x3dbd34,'action':'queuestatus','queue':_0x412422[_0x6681('0x42')]})['catch'](function(){_0x260370[_0x6681('0xb1')](_0x412422);_0x260370[_0x6681('0xbf')]({'active':![],'ContactId':_0x260370[_0x6681('0x26')][_0x3dbd34][_0x6681('0xf6')],'ListId':_0x260370['actions'][_0x3dbd34]['ListId'],'VoiceQueueId':_0x260370[_0x6681('0x26')][_0x3dbd34][_0x6681('0xf7')]||undefined,'CampaignId':_0x260370[_0x6681('0x26')][_0x3dbd34][_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch(_0x6681('0x1e4')));delete _0x260370['actions'][_0x3dbd34];});}else{loggerBooked['info'](_0x6681('0x1e5'),JSON[_0x6681('0x4c')](_0x412422[_0x6681('0x12b')]),_0x6681('0x1e3'),_0x412422[_0x6681('0x42')]);_0x260370[_0x6681('0xb1')](_0x412422);_0x260370[_0x6681('0xbf')]({'active':![],'ContactId':_0x260370[_0x6681('0x26')][_0x3dbd34][_0x6681('0xf6')],'ListId':_0x260370[_0x6681('0x26')][_0x3dbd34]['ListId'],'VoiceQueueId':_0x260370[_0x6681('0x26')][_0x3dbd34][_0x6681('0xf7')]||undefined,'CampaignId':_0x260370[_0x6681('0x26')][_0x3dbd34][_0x6681('0xd3')]||undefined})[_0x6681('0xaf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x260370[_0x6681('0x26')][_0x3dbd34];}}else{return _0x260370[_0x6681('0x165')](_0x412422,_0x263c99);}}else{if(getDiff(_0x263c99['scheduledat'])<_0x412422[_0x6681('0x1e6')]*0x3c){if(_0x263c99['Agent']&&!_0x263c99[_0x6681('0x1e7')]['voicePause']){_0x260370['preview'][_0x6681('0x12e')](_0x263c99['id'])[_0x6681('0x1e')](function(){_0x260370[_0x6681('0xb1')](_0x412422);});}else{_0x260370[_0x6681('0xc1')]({'active':![]},_0x263c99['id'],0x1)['finally'](function(){_0x260370[_0x6681('0xb1')](_0x412422);});}}else{_0x412422['outboundReCallsDay']+=0x1;_0x260370['updateOriginated'](_0x412422);if(_0x412422[_0x6681('0x1e8')]){_0x260370['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x263c99[_0x6681('0xf6')],'ListId':_0x263c99['ListId'],'VoiceQueueId':_0x263c99[_0x6681('0xf7')]||undefined,'CampaignId':_0x263c99[_0x6681('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x260370[_0x6681('0xc9')](createObjHistory(_0x412422,_0x263c99,'RECALLINQUEUE',0x17,_0x6681('0x1e9')))[_0x6681('0xaf')](loggerCatch(_0x6681('0x1ea')));}else{_0x260370['saveInDb'](createObjHistory(_0x412422,_0x263c99,'RECALLFAILEDTIMEOUT',0x16,_0x6681('0x1eb')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x412422[_0x6681('0x61')]+=0x1;_0x260370[_0x6681('0xcf')](createObjHistory(_0x412422,_0x263c99,_0x6681('0x1ec'),0xd,_0x6681('0x1ed')),_0x6681('0x1ee'),'[Originate][MoveBlacklist]');throw _0x6681('0x1ef');}};};Dialer['prototype']['handleIvr']=function(_0x4851ce){var _0x1ff40d=this;var _0x578acc=_0x4851ce[_0x6681('0x1f0')]-_0x4851ce[_0x6681('0x71')]-_0x4851ce[_0x6681('0x1f1')];emitCampaignSummary(_0x4851ce);if(_0x578acc>0x0){if(_0x578acc>this['maxNumberOriginate']){_0x578acc=this[_0x6681('0x25')];}_0x4851ce[_0x6681('0x1f1')]+=_0x578acc;this[_0x6681('0xc4')](_0x4851ce['id'],_0x578acc,_0x4851ce[_0x6681('0x1f2')])[_0x6681('0xb7')](function(_0x12ba37){_0x4851ce[_0x6681('0x1f1')]-=_0x578acc;_0x4851ce[_0x6681('0x1f1')]=_0x4851ce[_0x6681('0x1f1')]>0x0?_0x4851ce['temp']:0x0;if(!checkContactEmpty(_0x12ba37)){_0x4851ce[_0x6681('0x40')]=_0x6681('0x9f');logger[_0x6681('0x7e')](_0x6681('0x1f3')+_0x4851ce[_0x6681('0x42')]);}else{_0x4851ce['originated']+=_0x12ba37[_0x6681('0x98')];_0x4851ce[_0x6681('0x40')]=_0x6681('0x1f4');for(var _0x16e406=0x0;_0x16e406<_0x12ba37['length'];_0x16e406+=0x1){_0x4851ce[_0x6681('0x1f5')]+=0x1;if(_[_0x6681('0xae')](_0x12ba37[_0x16e406])||_['isNil'](_0x12ba37[_0x16e406]['Contact'])||_[_0x6681('0xae')](_0x12ba37[_0x16e406][_0x6681('0x169')][_0x6681('0x16a')])){_0x1ff40d[_0x6681('0xcd')](_0x6681('0x1f6'),_0x4851ce,_0x12ba37[_0x16e406]);}else{_0x1ff40d[_0x6681('0xbb')](_[_0x6681('0xd0')](_0x12ba37[_0x16e406],[_0x6681('0xd3'),_0x6681('0x1f7')]))[_0x6681('0xb7')](_0x1ff40d['checkContactBlack'](_0x4851ce,_0x12ba37[_0x16e406]))[_0x6681('0xaf')](_0x1ff40d[_0x6681('0xcc')](_0x6681('0x1f8'),_0x4851ce));}}}})[_0x6681('0xaf')](loggerGetContactDialer(_0x6681('0x1f9'),_0x4851ce,_0x578acc));}};Dialer[_0x6681('0xac')][_0x6681('0x156')]=function(_0x5a3586,_0x54627e){var _0x49dcd9=this;var _0x26fb3e=[];var _0x4c33dd=_0x54627e>=0x1?_0x54627e:0x1;if(_0x5a3586[_0x6681('0x155')]===_0x6681('0x9')){_0x4c33dd=0x1;}var _0x52d1ec=Math[_0x6681('0x1dd')](_0x5a3586[_0x6681('0x52')]*_0x4c33dd)-_0x5a3586[_0x6681('0x71')]-_0x5a3586[_0x6681('0x1f1')];emitVoiceQueueSummary(_0x5a3586);if(_0x5a3586[_0x6681('0x1fa')]>0x0){var _0x30fc3c=_0x5a3586['dialLimitQueue']-_0x5a3586[_0x6681('0x71')]-_0x5a3586['talking']-_0x5a3586[_0x6681('0x1f1')]-_0x5a3586[_0x6681('0xa1')];if(_0x52d1ec>_0x30fc3c){_0x52d1ec=_0x30fc3c;}}if(_0x52d1ec>0x0){if(_0x5a3586[_0x6681('0x155')]===_0x6681('0x9')){_0x52d1ec=0x1;}if(_0x52d1ec>this[_0x6681('0x25')]){_0x52d1ec=this[_0x6681('0x25')];}_0x5a3586[_0x6681('0x1f1')]+=_0x52d1ec;for(var _0x471dac in this[_0x6681('0x23')]){if(typeof this[_0x6681('0x23')][_0x471dac]!==_0x6681('0x99')){if(this[_0x6681('0x23')][_0x471dac][_0x6681('0xde')]==='not_inuse'&&this['agents'][_0x471dac][_0x6681('0xd8')]===_0x6681('0xd7')){_0x26fb3e[_0x6681('0x149')](this[_0x6681('0x23')][_0x471dac]['id']);}}}this[_0x6681('0xc3')](_0x5a3586['id'],_0x26fb3e,_0x52d1ec,_0x5a3586[_0x6681('0x1f2')])[_0x6681('0xb7')](function(_0xa33952){_0x5a3586[_0x6681('0x1f1')]-=_0x52d1ec;_0x5a3586['temp']=_0x5a3586[_0x6681('0x1f1')]>0x0?_0x5a3586[_0x6681('0x1f1')]:0x0;if(!checkContactEmpty(_0xa33952)){_0x49dcd9[_0x6681('0xb5')](_0x5a3586)[_0x6681('0xb7')](sendMessageReschedule(_0x5a3586))[_0x6681('0xaf')](loggerCatch(_0x6681('0xb8')));}else{_0x5a3586[_0x6681('0x71')]+=_0xa33952['length'];_0x5a3586['message']=_0x5a3586[_0x6681('0x155')]===_0x6681('0x9')?_0x6681('0x172'):_0x6681('0x1f4');for(var _0x15b954=0x0;_0x15b954<_0xa33952[_0x6681('0x98')];_0x15b954+=0x1){if(_[_0x6681('0xae')](_0xa33952[_0x15b954])||_[_0x6681('0xae')](_0xa33952[_0x15b954][_0x6681('0x169')])||_['isNil'](_0xa33952[_0x15b954][_0x6681('0x169')][_0x6681('0x16a')])){_0x49dcd9[_0x6681('0xcd')]('[actionOriginate]\x20',_0x5a3586,_0xa33952[_0x15b954]);}else{_0x49dcd9[_0x6681('0xb9')](_[_0x6681('0xd0')](_0xa33952[_0x15b954],[_0x6681('0xf7'),_0x6681('0x1f7')]))['then'](_0x49dcd9['checkContactBlack'](_0x5a3586,_0xa33952[_0x15b954]))[_0x6681('0xaf')](_0x49dcd9[_0x6681('0xcc')](_0x6681('0x1f6'),_0x5a3586));}}}})[_0x6681('0xaf')](loggerGetContactDialer(_0x6681('0x1fb'),_0x5a3586,_0x52d1ec));}};Dialer[_0x6681('0xac')][_0x6681('0x90')]=function(_0x5597f9){if(_0x5597f9['dialLimitQueue']>0x0){var _0x18905c=_0x5597f9[_0x6681('0x1fa')]-_0x5597f9[_0x6681('0x71')]-_0x5597f9[_0x6681('0x56')];if(_0x18905c>0x0){this['tryOriginatePredictive'](_0x5597f9);}else{loggerPredictiveCalls[_0x6681('0x7e')](_0x6681('0x1fc'));}}else{this['tryOriginatePredictive'](_0x5597f9);}};Dialer['prototype'][_0x6681('0x1fd')]=function(_0x38c841){var _0x10e9aa=this;var _0x577e88=[];_0x38c841[_0x6681('0x71')]+=0x1;for(var _0x57cdd3 in this[_0x6681('0x23')]){if(typeof this['agents'][_0x57cdd3]!==_0x6681('0x99')){if(this[_0x6681('0x23')][_0x57cdd3]['state']===_0x6681('0x1fe')&&this[_0x6681('0x23')][_0x57cdd3][_0x6681('0xd8')]===_0x6681('0xd7')){_0x577e88[_0x6681('0x149')](this[_0x6681('0x23')][_0x57cdd3]['id']);}}}this[_0x6681('0xc3')](_0x38c841['id'],_0x577e88,0x1,_0x38c841['dialOrderByScheduledAt'])['then'](function(_0x12a1f7){if(!checkContactEmpty(_0x12a1f7)){checkContactLowerLimitOriginate(_0x38c841,0x1,0x0);_0x10e9aa[_0x6681('0xb5')](_0x38c841)[_0x6681('0xb7')](sendMessageReschedule(_0x38c841))[_0x6681('0xaf')](loggerCatch(_0x6681('0xb8')));}else{_0x38c841[_0x6681('0x40')]='RUNNING';if(_[_0x6681('0xae')](_0x12a1f7[0x0])||_[_0x6681('0xae')](_0x12a1f7[0x0][_0x6681('0x169')])||_[_0x6681('0xae')](_0x12a1f7[0x0][_0x6681('0x169')][_0x6681('0x16a')])){_0x10e9aa[_0x6681('0xcd')](_0x6681('0x1f6'),_0x38c841,_0x12a1f7[0x0]);}else{_0x10e9aa[_0x6681('0xb9')](_['pick'](_0x12a1f7[0x0],['VoiceQueueId',_0x6681('0x1f7')]))['then'](_0x10e9aa[_0x6681('0x1e0')](_0x38c841,_0x12a1f7[0x0]))[_0x6681('0xaf')](_0x10e9aa[_0x6681('0xcc')](_0x6681('0x1ff'),_0x38c841));}}})[_0x6681('0xaf')](loggerGetContactDialer(_0x6681('0x200'),_0x38c841,0x1));emitVoiceQueueSummary(_0x38c841);};Dialer[_0x6681('0xac')][_0x6681('0x1d6')]=function(_0x156def,_0x14cb89,_0x20b9aa,_0x53163f,_0x516c90,_0x47c5de){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x6681('0x7e')](_0x6681('0x201'),_0x156def);loggerPredictive[_0x6681('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14cb89);loggerPredictive[_0x6681('0x7e')](_0x6681('0x202'),_0x20b9aa);loggerPredictive['info'](_0x6681('0x203'),_0x53163f);loggerPredictive[_0x6681('0x7e')](_0x6681('0x204'),_0x516c90);loggerPredictive[_0x6681('0x7e')](_0x6681('0x84'));return new BPromise(function(_0x18287d,_0x18d445){if(_0x156def<=0x0||isNaN(_0x156def)){return _0x18d445(msgResponse('[abandonmentRate]',_0x6681('0x4b'),'m\x20=\x20'+_0x156def));}if(_0x20b9aa<=0x0||isNaN(_0x20b9aa)){return _0x18d445(msgResponse('[abandonmentRate]',_0x6681('0x4b'),_0x6681('0x205')+_0x20b9aa));}if(_0x53163f<=0x0||isNaN(_0x53163f)){return _0x18d445(msgResponse(_0x6681('0x206'),_0x6681('0x4b'),_0x6681('0x207')+_0x53163f));}if(_0x14cb89<=0x0||isNaN(_0x14cb89)){return _0x18d445(msgResponse(_0x6681('0x206'),_0x6681('0x4b'),'interval\x20=\x20'+_0x14cb89));}if(_0x516c90<=0x0||isNaN(_0x516c90)){return _0x18d445(msgResponse(_0x6681('0x206'),_0x6681('0x4b'),_0x6681('0x208')+_0x516c90));}_0x47c5de=_0x47c5de||0x0;var _0x538864=0x1/_0x20b9aa;var _0x53ea5c=0x0;var _0xbf433c=0x0;var _0x475891=0x0;var _0x21b73a=0x0;for(var _0x57d887=0x0;_0x475891<_0x516c90;_0x57d887+=0x1){_0xbf433c=_0x57d887/_0x14cb89;_0x53ea5c=(_0x53163f*_0xbf433c+_0x47c5de)/_0x538864;_0x475891=erlangb(_0x53ea5c,_0x156def);_0x21b73a=_0x53ea5c/_0x156def*(0x1-erlangb(_0x53ea5c,_0x156def));}return _0x18287d({'erlangCalls':_0x57d887,'erlangCallToSecond':_0x14cb89/_0x57d887,'erlangAbandonmentRate':_0x475891,'erlangBusyFactor':_0x21b73a});});};Dialer[_0x6681('0xac')][_0x6681('0x1d8')]=function(_0x219893,_0x451840,_0x210bdb,_0x114eba,_0x112122,_0x4ddf55){loggerPredictive[_0x6681('0x7e')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x6681('0x7e')](_0x6681('0x201'),_0x219893);loggerPredictive['info'](_0x6681('0x209'),_0x451840);loggerPredictive['info'](_0x6681('0x202'),_0x210bdb);loggerPredictive['info'](_0x6681('0x203'),_0x114eba);loggerPredictive[_0x6681('0x7e')](_0x6681('0x20a'),_0x112122);loggerPredictive[_0x6681('0x7e')](_0x6681('0x84'));return new BPromise(function(_0x1a4fcb,_0x3ee24b){if(_0x219893<=0x0||isNaN(_0x219893)){return _0x3ee24b(msgResponse('[busyFactor]',_0x6681('0x4b'),_0x6681('0x20b')+_0x219893));}if(_0x210bdb<=0x0||isNaN(_0x210bdb)){return _0x3ee24b(msgResponse(_0x6681('0x20c'),_0x6681('0x4b'),_0x6681('0x205')+_0x210bdb));}if(_0x114eba<=0x0||isNaN(_0x114eba)){return _0x3ee24b(msgResponse(_0x6681('0x20c'),'Error',_0x6681('0x207')+_0x114eba));}if(_0x451840<=0x0||isNaN(_0x451840)){return _0x3ee24b(msgResponse(_0x6681('0x20c'),_0x6681('0x4b'),_0x6681('0x20d')+_0x451840));}if(_0x112122<=0x0||isNaN(_0x112122)){return _0x3ee24b(msgResponse('[busyFactor]','Error','Umin\x20=\x20'+_0x112122));}_0x4ddf55=_0x4ddf55||0x0;var _0x5540e6=0x1/_0x210bdb;var _0x56947f=0x0;var _0x14dd04=0x0;var _0x39f1c4=0x0;var _0x129e84=0x0;for(var _0x4a272b=0x0;_0x129e84<_0x112122;_0x4a272b+=0x1){_0x14dd04=_0x4a272b/_0x451840;_0x56947f=(_0x114eba*_0x14dd04+_0x4ddf55)/_0x5540e6;_0x39f1c4=erlangb(_0x56947f,_0x219893);_0x129e84=_0x56947f/_0x219893*(0x1-erlangb(_0x56947f,_0x219893));}return _0x1a4fcb({'erlangCalls':_0x4a272b,'erlangCallToSecond':_0x451840/_0x4a272b,'erlangAbandonmentRate':_0x39f1c4,'erlangBusyFactor':_0x129e84});});};module[_0x6681('0x20e')]=Dialer; \ No newline at end of file +var _0x0f0a=['entity\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','NoAnswer','custom:agentnoanswer','noanswer','checkRetriveMax','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','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','XCALLY_IP_AGI','roundrobin','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','custom:queuesummary','hangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','message','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','erlangCalls','erlangAbandonmentRate','Trunk','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','inspect','error','stack','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','membername','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','countglobal','amd','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason\x2019\x20machine....','countmachineretry','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','syncAgentComplete','reason','agent','dialQueueProject2','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','stateinterface','locked','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','length','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','content','indexOf','true','iftime\x20%s,%s','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialTimezone','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','OriginateError','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[callProgressDetecting]'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0x0f0a,0x6c));var _0xa0f0=function(_0x7b46b2,_0x518977){_0x7b46b2=_0x7b46b2-0x0;var _0xb18c4e=_0x0f0a[_0x7b46b2];return _0xb18c4e;};'use strict';var util=require(_0xa0f0('0x0'));var _=require(_0xa0f0('0x1'));var BPromise=require(_0xa0f0('0x2'));var uuid=require(_0xa0f0('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xa0f0('0x4'));var Redis=require(_0xa0f0('0x5'));var ut=require(_0xa0f0('0x6'));var config=require('../../../config/environment/');var logger=require(_0xa0f0('0x7'))(_0xa0f0('0x8'));var loggerBooked=require(_0xa0f0('0x7'))(_0xa0f0('0x9'));var loggerPredictive=require(_0xa0f0('0x7'))(_0xa0f0('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xa0f0('0xb'));var loggerSyncQueueSummary=require(_0xa0f0('0x7'))(_0xa0f0('0xc'));var ami=require(_0xa0f0('0xd'));config[_0xa0f0('0xe')]=_[_0xa0f0('0xf')](config['redis'],{'host':_0xa0f0('0x10'),'port':0x18eb});var io=require(_0xa0f0('0x11'))(new Redis(config[_0xa0f0('0xe')]));var cmHopper=require(_0xa0f0('0x12'));var cmHopperHistory=require(_0xa0f0('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xa0f0('0x14'));var Action=require(_0xa0f0('0x15'));var History=require(_0xa0f0('0x16'));var Final=require(_0xa0f0('0x17'));var AgentComplete=require(_0xa0f0('0x18'));var QueueCallerAbandon=require(_0xa0f0('0x19'));var Hangup=require('./hangup');var ipAgi=process['env'][_0xa0f0('0x1a')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0xa0f0('0x1b')};var Sequence=function(){};Sequence[_0xa0f0('0x1c')]['enqueue']=function(_0x240cd2){this['tail']=this[_0xa0f0('0x1d')]?this['tail']['finally'](_0x240cd2):_0x240cd2();};function Dialer(_0x544019,_0x2f4a91){this[_0xa0f0('0x1e')]=new Sequence();this[_0xa0f0('0x1f')]=_0x2f4a91;this[_0xa0f0('0x20')]=_0x544019[_0xa0f0('0x20')];this[_0xa0f0('0x21')]=_0x544019[_0xa0f0('0x21')];this[_0xa0f0('0x22')]=_0x544019[_0xa0f0('0x22')];this[_0xa0f0('0x23')]=_0x544019['trunks'];this[_0xa0f0('0x24')]=config['maxNumberOriginate']||0x2;this[_0xa0f0('0x25')]={};this['actions']={};this[_0xa0f0('0x26')]={};this[_0xa0f0('0x27')]={};this[_0xa0f0('0x28')]={};this[_0xa0f0('0x29')]={};this[_0xa0f0('0x2a')]={};this['ivrOriginated']={};this[_0xa0f0('0x2b')]={};this[_0xa0f0('0x2c')]={};ami['on'](_0xa0f0('0x2d'),this[_0xa0f0('0x2e')][_0xa0f0('0x2f')](this));ami['on'](_0xa0f0('0x30'),this[_0xa0f0('0x31')][_0xa0f0('0x2f')](this));ami['on'](_0xa0f0('0x32'),this['syncOriginateResponse'][_0xa0f0('0x2f')](this));ami['on'](_0xa0f0('0x33'),this['syncAgentComplete']['bind'](this));ami['on'](_0xa0f0('0x34'),this[_0xa0f0('0xc')][_0xa0f0('0x2f')](this));ami['on'](_0xa0f0('0x35'),this['syncHangup'][_0xa0f0('0x2f')](this));ami['on'](_0xa0f0('0x36'),this[_0xa0f0('0x37')]['bind'](this));ami['on']('varset',this[_0xa0f0('0x38')][_0xa0f0('0x2f')](this));ami['on'](_0xa0f0('0x39'),this['syncQueueMember'][_0xa0f0('0x2f')](this));ami['on'](_0xa0f0('0x3a'),this[_0xa0f0('0x3b')][_0xa0f0('0x2f')](this));this['loopCampaigns']();this[_0xa0f0('0x3c')]();}function isNotNull(_0x2a07e2){return _0x2a07e2!==null&&!_[_0xa0f0('0x3d')](_0x2a07e2);}function checkIsLoggedIn(_0x5b11f9,_0x3a6fd5){return function(){if(_0x3a6fd5<=0x0){_0x5b11f9['message']=_0xa0f0('0x3e');throw _0x5b11f9[_0xa0f0('0x3f')]+_0xa0f0('0x40');}};}function isActive(_0x480701){return _0x480701;}function checkIsActive(_0x180f1e,_0x25c4bb){return function(){if(!isActive(_0x25c4bb)){_0x180f1e['message']=_0xa0f0('0x41');throw _0x180f1e[_0xa0f0('0x3f')]+_0xa0f0('0x42');}};}function checkInterval(_0x55059f){return function(){if(!isNotNull(_0x55059f[_0xa0f0('0x43')])){_0x55059f[_0xa0f0('0x44')]=_0xa0f0('0x45');throw _0x55059f[_0xa0f0('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x55059f[_0xa0f0('0x43')][_0xa0f0('0x46')])){_0x55059f[_0xa0f0('0x44')]='INTERVAL_IS_NULL';throw _0x55059f[_0xa0f0('0x3f')]+_0xa0f0('0x47');}if(!isNotNull(_['isEmpty'](_0x55059f[_0xa0f0('0x43')][_0xa0f0('0x46')]))){_0x55059f['message']='INTERVAL_IS_NULL';throw _0x55059f[_0xa0f0('0x3f')]+_0xa0f0('0x47');}};}function msgResponse(_0xa1ac00,_0x2d78d8,_0x568126){return{'action':_0xa1ac00,'response':_0x2d78d8,'message':_0x568126,'stack':_0x568126};}function myreject(_0x44b35d){return function(_0x3724d9){return _0x44b35d(msgResponse(_0xa0f0('0x48'),_0xa0f0('0x49'),JSON[_0xa0f0('0x4a')](_0x3724d9)));};}function getSeconds(_0x1673d2,_0x29350f){var _0x18a35d=moment(_0x1673d2)[_0xa0f0('0x4b')](0x0);var _0x5b2d5d=moment(_0x29350f)[_0xa0f0('0x4b')](0x0);return _0x18a35d[_0xa0f0('0x4c')](_0x5b2d5d,_0xa0f0('0x4d'));}function emit(_0x1e7605,_0x291385,_0x34a7b4){io['to'](_0x1e7605)[_0xa0f0('0x4e')](_0x291385,_0x34a7b4);}function emitVoiceQueueSummary(_0x4805d1){if(_0x4805d1['type']===_0xa0f0('0x4f')){var _0x5c6110={'id':_0x4805d1['id'],'name':_0x4805d1[_0xa0f0('0x3f')],'strategy':_0x4805d1[_0xa0f0('0x50')],'answered':_0x4805d1[_0xa0f0('0x51')],'available':_0x4805d1[_0xa0f0('0x52')],'loggedIn':_0x4805d1[_0xa0f0('0x53')],'pTalking':_0x4805d1[_0xa0f0('0x54')],'sumBillable':_0x4805d1[_0xa0f0('0x55')],'sumDuration':_0x4805d1[_0xa0f0('0x56')],'sumHoldTime':_0x4805d1[_0xa0f0('0x57')]||0x0,'talking':_0x4805d1['talking'],'total':_0x4805d1['total'],'type':_0x4805d1[_0xa0f0('0x58')],'unmanaged':_0x4805d1[_0xa0f0('0x59')],'abandoned':_0x4805d1['abandoned'],'waiting':_0x4805d1[_0xa0f0('0x5a')],'loggedInDb':_0x4805d1[_0xa0f0('0x5b')],'dialActive':_0x4805d1['dialActive'],'dialMethod':_0x4805d1[_0xa0f0('0x5c')],'dialOriginateCallerIdName':_0x4805d1['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4805d1[_0xa0f0('0x5d')],'dialOriginateTimeout':_0x4805d1['dialOriginateTimeout'],'dialPrefix':_0x4805d1[_0xa0f0('0x5e')],'outboundAnswerAgiCallsDay':_0x4805d1[_0xa0f0('0x5f')],'outboundAnswerCallsDay':_0x4805d1[_0xa0f0('0x60')],'outboundBlacklistCallsDay':_0x4805d1['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4805d1[_0xa0f0('0x61')],'outboundCongestionCallsDay':_0x4805d1[_0xa0f0('0x62')],'outboundDropCallsDayACS':_0x4805d1['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4805d1[_0xa0f0('0x63')],'outboundDropCallsDayTimeout':_0x4805d1[_0xa0f0('0x64')],'outboundNoAnswerCallsDay':_0x4805d1[_0xa0f0('0x65')],'outboundNoSuchCallsDay':_0x4805d1[_0xa0f0('0x66')],'outboundOriginateFailureCallsDay':_0x4805d1[_0xa0f0('0x67')],'outboundReCallsDay':_0x4805d1[_0xa0f0('0x68')],'outboundRejectCallsDay':_0x4805d1[_0xa0f0('0x69')],'outboundUnknownCallsDay':_0x4805d1[_0xa0f0('0x6a')],'predictiveIntervalAnsweredCalls':_0x4805d1['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4805d1[_0xa0f0('0x6b')],'predictiveIntervalAvgTalktime':_0x4805d1[_0xa0f0('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x4805d1[_0xa0f0('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x4805d1[_0xa0f0('0x6e')],'predictiveIntervalErlangCalls':_0x4805d1[_0xa0f0('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x4805d1['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4805d1['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4805d1[_0xa0f0('0x70')],'predictiveIntervalPauses':_0x4805d1[_0xa0f0('0x71')],'predictiveIntervalAvailable':_0x4805d1['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4805d1['predictiveIntervalTotalCalls'],'message':_0x4805d1[_0xa0f0('0x44')],'originated':_0x4805d1['originated'],'erlangCalls':_0x4805d1[_0xa0f0('0x72')],'erlangCallToSecond':_0x4805d1['erlangCallToSecond'],'erlangAbandonmentRate':_0x4805d1[_0xa0f0('0x73')],'erlangBusyFactor':_0x4805d1['erlangBusyFactor'],'startPredictive':_0x4805d1[_0xa0f0('0x29')],'startProgressive':_0x4805d1[_0xa0f0('0x2a')]};if(_0x4805d1[_0xa0f0('0x74')]){_0x5c6110['Trunk']={'id':_0x4805d1['Trunk']['id'],'name':_0x4805d1[_0xa0f0('0x74')]['name'],'active':_0x4805d1[_0xa0f0('0x74')]['active'],'callerid':_0x4805d1['Trunk'][_0xa0f0('0x75')]};}if(_0x4805d1['Interval']){_0x5c6110[_0xa0f0('0x43')]={'id':_0x4805d1[_0xa0f0('0x43')]['id'],'name':_0x4805d1['Interval'][_0xa0f0('0x3f')]};}var _0x50c0c0=md5(JSON[_0xa0f0('0x4a')](_0x5c6110));if(_0x4805d1[_0xa0f0('0x4')]!==_0x50c0c0){_0x4805d1['md5']=_0x50c0c0;emit(util['format'](_0xa0f0('0x76'),_0x5c6110[_0xa0f0('0x3f')]),_0xa0f0('0x77'),_0x5c6110);}}}function emitCampaignSummary(_0x4702e2){if(_0x4702e2[_0xa0f0('0x58')]===_0xa0f0('0x78')){emit(util[_0xa0f0('0x79')](_0xa0f0('0x7a'),_0x4702e2['name']),_0xa0f0('0x7b'),_0x4702e2);}}function checkGetDataPredictive(_0x5c406f){if(isNotNull(_0x5c406f)&&!_[_0xa0f0('0x7c')](_0x5c406f)){loggerPredictive['info'](_0xa0f0('0x7d'));loggerPredictive[_0xa0f0('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c406f[_0xa0f0('0x7f')]);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x80'),_0x5c406f[_0xa0f0('0x81')]);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x82'),_0x5c406f[_0xa0f0('0x6e')]);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x83'),_0x5c406f['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xa0f0('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c406f[_0xa0f0('0x6b')]);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x84'),_0x5c406f[_0xa0f0('0x6c')]);loggerPredictive['info']('---------------------------');if(_0x5c406f['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x5c406f[_0xa0f0('0x6c')])&&_0x5c406f[_0xa0f0('0x6c')]>0x0){return!![];}loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x85'));if(!_[_0xa0f0('0x3d')](_0x5c406f[_0xa0f0('0x6b')])&&_0x5c406f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x86'));}else{loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x87'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x45b37f){return function(_0x2c0ce8){loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x88'));loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x89'),_0x2c0ce8[_0xa0f0('0x72')]);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x8a'),_0x2c0ce8[_0xa0f0('0x8b')]);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x8c'),_0x2c0ce8[_0xa0f0('0x73')]);loggerPredictive[_0xa0f0('0x7e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c0ce8[_0xa0f0('0x8d')]);loggerPredictive['info'](_0xa0f0('0x8c'),_0x2c0ce8['erlangAbandonmentRate']);loggerPredictive['info'](_0xa0f0('0x8e'));_[_0xa0f0('0x8f')](_0x45b37f,_0x2c0ce8);};}function getDiff(_0x2bae5b){var _0x4f2744=moment()[_0xa0f0('0x4b')](0x0);var _0x1133d0=moment(_0x2bae5b)[_0xa0f0('0x4b')](0x0);return _0x4f2744['diff'](_0x1133d0,_0xa0f0('0x4d'));}function ifInterval(_0x5d18a8,_0x270409){if(_[_0xa0f0('0x3d')](_0x270409)){return![];}return getDiff(_0x270409)<_0x5d18a8*0x3c;}function freeVariablesPredictive(_0xa63f5c){if(isNotNull(_0xa63f5c)){if(!_[_0xa0f0('0x3d')](_0xa63f5c['startProgressive'])){_0xa63f5c[_0xa0f0('0x2a')]=undefined;loggerPredictive[_0xa0f0('0x7e')](_0xa63f5c['name'],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0xa63f5c['startPredictive'])){_0xa63f5c[_0xa0f0('0x29')]=undefined;loggerPredictive[_0xa0f0('0x7e')](_0xa63f5c[_0xa0f0('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0xa63f5c[_0xa0f0('0x90')])){clearInterval(_0xa63f5c[_0xa0f0('0x90')]);_0xa63f5c['handlePredictive']=undefined;loggerPredictive[_0xa0f0('0x7e')](_0xa63f5c[_0xa0f0('0x3f')],_0xa0f0('0x91'));}}}function erlangb(_0x33296e,_0x31c5e1){if(_0x31c5e1===0x0){return 0x0;}var _0x2954ff=0x1;for(var _0x495944=0x1;_0x495944<=_0x31c5e1;_0x495944+=0x1){_0x2954ff=0x1+_0x2954ff*_0x495944/_0x33296e;}return 0x1/_0x2954ff;}function isVoiceQueueOutbound(_0x1af88b){return _0x1af88b===_0xa0f0('0x4f');}function isNotPreview(_0x73e575){return _0x73e575!==_0xa0f0('0x1f');}function isCampaignIvr(_0x3f0471){return _0x3f0471===_0xa0f0('0x78');}function getCallerId(_0x2a025d,_0x5e3b48,_0x10d9d6){if(!_[_0xa0f0('0x3d')](_0x10d9d6)&&typeof _0x10d9d6==='string'&&!_[_0xa0f0('0x7c')](_0x10d9d6)){if(!_['isUndefined'](_0x5e3b48)&&typeof _0x5e3b48===_0xa0f0('0x92')&&!_[_0xa0f0('0x7c')](_0x5e3b48)){return util[_0xa0f0('0x79')]('\x22%s\x22\x20<%s>',_0x5e3b48,_0x10d9d6);}return util['format'](_0xa0f0('0x93'),_0x10d9d6,_0x10d9d6);}if(!_[_0xa0f0('0x3d')](_0x2a025d)&&typeof _0x2a025d===_0xa0f0('0x92')&&!_[_0xa0f0('0x7c')](_0x2a025d)){return _0x2a025d;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4542e5,_0x433086){return function(_0x588ac1){freeVariablesPredictive(_0x433086);emitVoiceQueueSummary(_0x433086);emitCampaignSummary(_0x433086);loggerSyncQueueSummary['error'](_0x4542e5,util[_0xa0f0('0x94')](_0x588ac1,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1956b8,_0x340158){return function(_0x4d148c){loggerPredictive['error'](_0x340158[_0xa0f0('0x3f')],_0x1956b8);loggerPredictive[_0xa0f0('0x95')](_0x4d148c[_0xa0f0('0x96')]);freeVariablesPredictive(_0x340158);};}function loggerCatch(_0x3f4578){return function(_0x1f724a){logger[_0xa0f0('0x95')](_0x3f4578,util[_0xa0f0('0x94')](_0x1f724a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2291a3){return _0x2291a3&&!_['isUndefined'](_0x2291a3)&&_0x2291a3['length']>0x0;}function decremetOriginate(_0x33f329){if(!_[_0xa0f0('0x3d')](_0x33f329)&&_0x33f329!==null){if(typeof _0x33f329[_0xa0f0('0x97')]!==_0xa0f0('0x98')){if(_0x33f329['originated']>0x0){_0x33f329[_0xa0f0('0x97')]-=0x1;}else{logger[_0xa0f0('0x95')](_0xa0f0('0x99'));}}}else{logger[_0xa0f0('0x95')](_0xa0f0('0x9a'));}}function checkContactLowerLimitOriginate(_0x15a643,_0x5191d5,_0x354b27){if(_0x5191d5>_0x354b27){for(var _0x18e9e2=0x0;_0x18e9e2<_0x5191d5-_0x354b27;_0x18e9e2+=0x1){decremetOriginate(_0x15a643);}}}function loggerGetContactDialer(_0x206f77,_0x47bdcb,_0x613c77){return function(_0xb61ecc){checkContactLowerLimitOriginate(_0x47bdcb,_0x613c77,0x0);logger['error'](_0x206f77,util[_0xa0f0('0x94')](_0xb61ecc,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x512133){return function(_0x3b8864){if(isNotNull(_0x3b8864)&&isNotNull(_0x3b8864[0x0])){if(_0x3b8864[0x0]['contactsRescheduled']>0x0){_0x512133[_0xa0f0('0x44')]=_0xa0f0('0x9b');logger[_0xa0f0('0x7e')](_0xa0f0('0x9c')+_0x512133[_0xa0f0('0x3f')],_0x3b8864[0x0][_0xa0f0('0x9d')],_0xa0f0('0x9e'));}else{_0x512133['message']=_0xa0f0('0x9f');logger[_0xa0f0('0x7e')](_0xa0f0('0xa0')+_0x512133[_0xa0f0('0x3f')]);}}};}function notSendMessagesQueue(_0x598947){if(_0x598947[_0xa0f0('0xa1')]){freeVariablesPredictive(_0x598947);if(_0x598947[_0xa0f0('0x97')]===0x0&&_0x598947[_0xa0f0('0xa2')]===0x0&&_0x598947['waiting']===0x0&&(_0x598947[_0xa0f0('0x54')]||0x0)===0x0){_0x598947[_0xa0f0('0xa1')]=![];_0x598947[_0xa0f0('0x52')]=0x0;_0x598947['message']=_0xa0f0('0x41');loggerSyncQueueSummary[_0xa0f0('0x95')](_0xa0f0('0xa3'),_0x598947[_0xa0f0('0x3f')],_0xa0f0('0xa4'));}else{_0x598947['message']=_0xa0f0('0xa5');loggerSyncQueueSummary[_0xa0f0('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x598947[_0xa0f0('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x598947);}}function notSendMessagesCampaign(_0x28ae3d){if(_0x28ae3d[_0xa0f0('0xa1')]){if(_0x28ae3d['originated']===0x0){_0x28ae3d[_0xa0f0('0xa1')]=![];_0x28ae3d[_0xa0f0('0x44')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xa0f0('0xa6'),_0x28ae3d[_0xa0f0('0x3f')],_0xa0f0('0xa4'));}else{_0x28ae3d[_0xa0f0('0x44')]=_0xa0f0('0xa5');loggerSyncQueueSummary[_0xa0f0('0x95')](_0xa0f0('0xa6'),_0x28ae3d[_0xa0f0('0x3f')],_0xa0f0('0xa7'));}emitCampaignSummary(_0x28ae3d);}}function createObjHistory(_0x310c57,_0x493643,_0x5b6cd7,_0x3ddb2d,_0x280473){_0x310c57['message']=_0x5b6cd7;var _0x38ec3e=new Action(_0x310c57,_0x493643);var _0x163087=new History(_0x38ec3e);_0x163087[_0xa0f0('0xa8')]=_0x3ddb2d;_0x163087['statedesc']=_0x280473;_0x163087[_0xa0f0('0xa9')]=_0x38ec3e[_0xa0f0('0xaa')];return _0x163087;}Dialer['prototype'][_0xa0f0('0x3c')]=function(){var _0x48c558=this;setInterval(function(){_0x48c558[_0xa0f0('0xab')](_0x48c558['uniqueId'],_0xa0f0('0xac'));_0x48c558[_0xa0f0('0xab')](_0x48c558[_0xa0f0('0xad')],_0xa0f0('0xae'));},0x32c8);};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xab')]=function(_0x4c4a97,_0x480381){var _0x20e63e=this;for(var _0x39f20e in _0x4c4a97){if(typeof _0x4c4a97[_0x39f20e]!==_0xa0f0('0x98')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x4c4a97[_0x39f20e])){return ami[_0xa0f0('0xaf')]({'action':_0xa0f0('0xb0'),'channel':_0x4c4a97[_0x39f20e][_0xa0f0('0xb1')]})[_0xa0f0('0xb2')](function(_0x181847){if(_0x181847['message']===_0xa0f0('0xb3')){setTimeout(function(){if(_0x4c4a97[_0x39f20e]&&_0x4c4a97[_0x39f20e][_0xa0f0('0x58')]!==_0xa0f0('0x78')){_0x20e63e['updateOriginated'](_0x20e63e[_0xa0f0('0x20')][_0x4c4a97[_0x39f20e][_0xa0f0('0xb4')]]);logger['error'](_0xa0f0('0xb5'),_0x480381,_0x39f20e,_0x4c4a97[_0x39f20e][_0xa0f0('0xb4')]);delete _0x4c4a97[_0x39f20e];}if(_0x4c4a97[_0x39f20e]&&_0x4c4a97[_0x39f20e][_0xa0f0('0x58')]===_0xa0f0('0x78')){_0x20e63e[_0xa0f0('0xb6')](_0x20e63e[_0xa0f0('0x21')][_0x4c4a97[_0x39f20e][_0xa0f0('0xb4')]]);logger[_0xa0f0('0x95')](_0xa0f0('0xb7'),_0x480381,_0x39f20e,_0x4c4a97[_0x39f20e][_0xa0f0('0xb4')]);delete _0x4c4a97[_0x39f20e];}},0x2328);}});}});}}};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xb8')]=function(_0x3d08a2){return BPromise['resolve']()[_0xa0f0('0xb9')](cmHopper[_0xa0f0('0xb8')](_0x3d08a2))[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xba')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xbb')]=function(_0x3620dd){return BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](cmHopperBlack[_0xa0f0('0xbb')](_0x3620dd))['catch'](loggerCatch(_0xa0f0('0xbd')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xbe')]=function(_0x18c4b4){return BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](cmHopperBlack[_0xa0f0('0xbe')](_0x18c4b4))[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xbf')));};Dialer[_0xa0f0('0x1c')]['averageHandleTime']=function(_0x2f0f07){return BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](cmHopperHistory[_0xa0f0('0xc0')](_0x2f0f07))[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xc1')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xc2')]=function(_0x315273){return BPromise[_0xa0f0('0xbc')]()['then'](cmHopper['rescheduleContact'](_0x315273))[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xc3')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xc4')]=function(_0x2e2dcf,_0x3b7c84,_0x557567){return BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](cmHopper[_0xa0f0('0xc4')](_0x2e2dcf,_0x3b7c84,_0x557567))[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xc5')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xc6')]=function(_0x53bfaa,_0x6ce75f,_0x1c07aa,_0x46540e){return BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](cmHopper[_0xa0f0('0xc6')](_0x53bfaa,_0x6ce75f,_0x1c07aa,_0x46540e))[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xc7')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xc8')]=function(_0x4e8641,_0x26c8e3,_0x306c61){return BPromise['resolve']()[_0xa0f0('0xb9')](cmHopper['getContactDialerIvr'](_0x4e8641,_0x26c8e3,_0x306c61))[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xc7')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xc9')]=function(_0xf69b5b){return BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](voiceQueueRt[_0xa0f0('0xc9')](_0xf69b5b))['catch'](loggerCatch(_0xa0f0('0xca')));};Dialer['prototype'][_0xa0f0('0xcb')]=function(_0x29033f){return BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](cmHopper[_0xa0f0('0xcb')](_0x29033f))['catch'](loggerCatch(_0xa0f0('0xcc')));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xcd')]=function(_0xc739c3){return BPromise[_0xa0f0('0xbc')]()['then'](cmHopperHistory['createHistory'](_0xc739c3))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xb6')]=function(_0xd1636a){if(!_[_0xa0f0('0x3d')](_0xd1636a)&&_0xd1636a!==null){if(typeof _0xd1636a[_0xa0f0('0x97')]!==_0xa0f0('0x98')){if(_0xd1636a[_0xa0f0('0x97')]>0x0){_0xd1636a[_0xa0f0('0x97')]-=0x1;}else{logger['error'](_0xa0f0('0xce'));}}}else{logger['error'](_0xa0f0('0xcf'));}};Dialer['prototype'][_0xa0f0('0xd0')]=function(_0x106233,_0x510d50){var _0x1a7fd1=this;return function(_0x54f6d7){_0x1a7fd1[_0xa0f0('0xb6')](_0x510d50);logger[_0xa0f0('0x95')](_0x106233,util[_0xa0f0('0x94')](_0x54f6d7,{'showHidden':![],'depth':null}));};};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xd1')]=function(_0x4a6032,_0x1be7be,_0xa5521a){var _0x43b577={'state':0x19,'statedesc':_0xa0f0('0xd2')};this[_0xa0f0('0xb6')](_0x1be7be);this['saveInDb'](_['merge'](_0x43b577,_[_0xa0f0('0xd3')](_0xa5521a,[_0xa0f0('0xd4'),_0xa0f0('0xd5'),_0xa0f0('0xd6'),_0xa0f0('0xd7'),_0xa0f0('0xd8')])),_0xa0f0('0xd9'),_0xa0f0('0xda'));logger[_0xa0f0('0x95')](_0x4a6032);};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xdb')]=function(_0x52287a){return _0x52287a===_0xa0f0('0xdc');};Dialer['prototype'][_0xa0f0('0xdd')]=function(_0x5e7ded){return!_[_0xa0f0('0x3d')](_0x5e7ded)&&_0x5e7ded&&!_[_0xa0f0('0x3d')](_0x5e7ded[_0xa0f0('0x3f')])&&!_['isUndefined'](_0x5e7ded[_0xa0f0('0xde')])&&_0x5e7ded[_0xa0f0('0xde')]&&(this[_0xa0f0('0x23')][util[_0xa0f0('0x79')](_0xa0f0('0xdf'),_0x5e7ded[_0xa0f0('0x3f')])][_0xa0f0('0xb0')]===_0xa0f0('0xe0')||this[_0xa0f0('0x23')][util['format']('SIP/%s',_0x5e7ded[_0xa0f0('0x3f')])]['status']===_0xa0f0('0xe1'));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xe2')]=function(_0x1fbf67,_0x20b25c,_0x1734d7){this[_0xa0f0('0xcd')](_0x1fbf67)[_0xa0f0('0xb2')](loggerCatch(_0x20b25c));this[_0xa0f0('0xcb')](_0x1fbf67)[_0xa0f0('0xb2')](loggerCatch(_0x1734d7));};Dialer[_0xa0f0('0x1c')]['syncVarSet']=function(_0x33194f){var _0x5d34bc=this[_0xa0f0('0x27')][_0x33194f[_0xa0f0('0xe3')]];var _0x587c28;if(!_[_0xa0f0('0xe4')](_0x33194f)&&!_['isNil'](_0x33194f[_0xa0f0('0xe5')])&&!_['isNil'](_0x33194f[_0xa0f0('0xe5')][_0xa0f0('0xe6')])&&_0x33194f[_0xa0f0('0xe7')]===_0xa0f0('0xe8')&&_0x5d34bc){if(_0x5d34bc['type']!==_0xa0f0('0x78')&&this[_0xa0f0('0x20')][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0xe9')]&&_0x33194f[_0xa0f0('0xea')]===_0xa0f0('0xeb')){delete this[_0xa0f0('0x27')][_0x33194f[_0xa0f0('0xe3')]];this[_0xa0f0('0xb6')](this[_0xa0f0('0x20')][_0x5d34bc[_0xa0f0('0xb4')]]);this['voiceQueues'][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0x60')]+=0x1;this['voiceQueues'][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0x5f')]+=0x1;_0x587c28=new Hangup(_0x5d34bc,_0x33194f);_0x587c28[_0xa0f0('0xa8')]=0x12;_0x587c28[_0xa0f0('0xec')]='HangupInAMD';_0x587c28[_0xa0f0('0xed')]='AMD';this[_0xa0f0('0xe2')](_0x587c28,_0xa0f0('0xee'),'[syncHangupInAMD]');}if(_0x5d34bc[_0xa0f0('0x58')]!==_0xa0f0('0x78')&&this[_0xa0f0('0x20')][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0xe9')]&&_0x33194f['value']===_0xa0f0('0xef')){var _0x465945=this;return new BPromise(function(_0x4a1d83,_0x5b3749){delete _0x465945[_0xa0f0('0x27')][_0x33194f[_0xa0f0('0xe3')]];_0x465945['updateOriginated'](_0x465945[_0xa0f0('0x20')][_0x5d34bc['queue']]);_0x465945[_0xa0f0('0x20')][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0x60')]+=0x1;_0x465945['voiceQueues'][_0x5d34bc[_0xa0f0('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x9d2651=_0x465945[_0xa0f0('0x20')][_0x5d34bc[_0xa0f0('0xb4')]];var _0x44c08c=new Hangup(_0x5d34bc,_0x33194f);_0x44c08c['state']=0x13;_0x44c08c[_0xa0f0('0xec')]=_0xa0f0('0xf0');_0x44c08c['membername']=_0xa0f0('0xf1');_0x44c08c['countmachineretry']+=0x1;_0x44c08c[_0xa0f0('0xf2')]+=0x1;_0x44c08c[_0xa0f0('0xf3')]=!![];_0x465945['createHistory'](_0x44c08c)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xf4')));if(_0x44c08c['countbusyretry']+_0x44c08c['countcongestionretry']+_0x44c08c['countnoanswerretry']+_0x44c08c[_0xa0f0('0xf5')]+_0x44c08c['countdropretry']+_0x44c08c[_0xa0f0('0xf6')]+_0x44c08c['countmachineretry']+_0x44c08c[_0xa0f0('0xf7')]>=_0x9d2651[_0xa0f0('0xf8')]){_0x465945[_0xa0f0('0xf9')](_0x44c08c,_0x4a1d83,_0x5b3749,'reason19\x20machine....');}else{if(_0x44c08c['countmachineretry']>=_0x9d2651['dialMachineMaxRetry']){_0x465945['createStateFinal'](_0x44c08c,_0x4a1d83,_0x5b3749,_0xa0f0('0xfa'));}else{_0x465945[_0xa0f0('0xc2')]({'active':![],'countmachineretry':_0x44c08c[_0xa0f0('0xfb')],'scheduledat':moment()[_0xa0f0('0xfc')](_0x9d2651['dialMachineRetryFrequency'],_0xa0f0('0xfd'))['format'](_0xa0f0('0xfe')),'ContactId':_0x44c08c[_0xa0f0('0xd4')],'ListId':_0x44c08c[_0xa0f0('0xd5')],'VoiceQueueId':_0x44c08c[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x44c08c[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xff')));_0x4a1d83({'reschedule':0x1});}}});}if(_0x5d34bc[_0xa0f0('0x58')]===_0xa0f0('0x78')&&this[_0xa0f0('0x21')][_0x5d34bc[_0xa0f0('0xb4')]]['dialAMDActive']&&_0x33194f[_0xa0f0('0xea')]===_0xa0f0('0xeb')){delete this['uniqueId'][_0x33194f[_0xa0f0('0xe3')]];this[_0xa0f0('0xb6')](this[_0xa0f0('0x21')][_0x5d34bc[_0xa0f0('0xb4')]]);_0x587c28=new Hangup(_0x5d34bc,_0x33194f);_0x587c28[_0xa0f0('0xa8')]=0x12;_0x587c28[_0xa0f0('0xec')]=_0xa0f0('0x100');_0x587c28[_0xa0f0('0xed')]=_0xa0f0('0xf1');this['saveInDb'](_0x587c28,_0xa0f0('0x101'),_0xa0f0('0x102'));}if(_0x5d34bc[_0xa0f0('0x58')]===_0xa0f0('0x78')&&this[_0xa0f0('0x21')][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0xe9')]&&_0x33194f[_0xa0f0('0xea')]===_0xa0f0('0xef')){var _0x465945=this;return new BPromise(function(_0x345670,_0x2c98a8){delete _0x465945['uniqueId'][_0x33194f[_0xa0f0('0xe3')]];_0x465945[_0xa0f0('0xb6')](_0x465945[_0xa0f0('0x21')][_0x5d34bc['queue']]);_0x465945['campaigns'][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0x60')]+=0x1;_0x465945[_0xa0f0('0x21')][_0x5d34bc[_0xa0f0('0xb4')]][_0xa0f0('0x5f')]+=0x1;var _0x5d0178=_0x465945['campaigns'][_0x5d34bc[_0xa0f0('0xb4')]];var _0x172fab=new Hangup(_0x5d34bc,_0x33194f);_0x172fab['state']=0x13;_0x172fab[_0xa0f0('0xec')]=_0xa0f0('0xf0');_0x172fab[_0xa0f0('0xed')]='AMD';_0x172fab[_0xa0f0('0xfb')]+=0x1;_0x172fab[_0xa0f0('0xf2')]+=0x1;_0x172fab['amd']=!![];_0x465945[_0xa0f0('0xcd')](_0x172fab)[_0xa0f0('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x172fab[_0xa0f0('0x103')]+_0x172fab[_0xa0f0('0x104')]+_0x172fab[_0xa0f0('0x105')]+_0x172fab[_0xa0f0('0xf5')]+_0x172fab[_0xa0f0('0x106')]+_0x172fab['countabandonedretry']+_0x172fab[_0xa0f0('0xfb')]+_0x172fab[_0xa0f0('0xf7')]>=_0x5d0178[_0xa0f0('0xf8')]){_0x465945[_0xa0f0('0xf9')](_0x172fab,_0x345670,_0x2c98a8,_0xa0f0('0x107'));}else{if(_0x172fab[_0xa0f0('0xfb')]>=_0x5d0178[_0xa0f0('0x108')]){_0x465945[_0xa0f0('0x109')](_0x172fab,_0x345670,_0x2c98a8,'reason\x2019\x20machine....');}else{_0x465945[_0xa0f0('0xc2')]({'active':![],'countmachineretry':_0x172fab['countmachineretry'],'scheduledat':moment()[_0xa0f0('0xfc')](_0x5d0178[_0xa0f0('0x10a')],_0xa0f0('0xfd'))[_0xa0f0('0x79')](_0xa0f0('0xfe')),'ContactId':_0x172fab[_0xa0f0('0xd4')],'ListId':_0x172fab[_0xa0f0('0xd5')],'VoiceQueueId':_0x172fab[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x172fab['CampaignId']||undefined})[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xff')));_0x345670({'reschedule':0x1});}}});}}};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x10b')]=function(_0x5eb6c5){var _0x2dc14e=this['uniqueId'][_0x5eb6c5['uniqueid']];var _0x157f37=this;var _0x494a4e;if(_0x2dc14e&&_0x2dc14e[_0xa0f0('0x58')]===_0xa0f0('0x78')){delete this[_0xa0f0('0x27')][_0x5eb6c5['uniqueid']];this[_0xa0f0('0xb6')](this['campaigns'][_0x2dc14e[_0xa0f0('0xb4')]]);this[_0xa0f0('0x21')][_0x2dc14e[_0xa0f0('0xb4')]]['ivrAnswerCallsDay']+=0x1;_0x494a4e=new Hangup(_0x2dc14e,_0x5eb6c5);this[_0xa0f0('0xcd')](_0x494a4e)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x10c')));this['moveContactManagedDialer'](_0x494a4e)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x10d')));}if(_0x2dc14e&&_0x2dc14e[_0xa0f0('0x58')]!==_0xa0f0('0x78')&&isNotNull(this[_0xa0f0('0x20')][_0x2dc14e[_0xa0f0('0xb4')]][_0xa0f0('0x10e')])){delete this[_0xa0f0('0x27')][_0x5eb6c5['uniqueid']];this[_0xa0f0('0xb6')](this[_0xa0f0('0x20')][_0x2dc14e['queue']]);this['voiceQueues'][_0x2dc14e['queue']][_0xa0f0('0x60')]+=0x1;this['voiceQueues'][_0x2dc14e[_0xa0f0('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x494a4e=new Hangup(_0x2dc14e,_0x5eb6c5);_0x494a4e[_0xa0f0('0xa8')]=0x10;_0x494a4e['statedesc']=_0xa0f0('0x10f');_0x494a4e['membername']='AGI';this[_0xa0f0('0xcd')](_0x494a4e)['catch'](loggerCatch(_0xa0f0('0x10c')));this[_0xa0f0('0xcb')](_0x494a4e)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x10d')));}if(_0x2dc14e&&_0x2dc14e[_0xa0f0('0x58')]!==_0xa0f0('0x78')&&!isNotNull(this[_0xa0f0('0x20')][_0x2dc14e[_0xa0f0('0xb4')]][_0xa0f0('0x10e')])){delete this[_0xa0f0('0x27')][_0x5eb6c5['uniqueid']];this[_0xa0f0('0xb6')](this[_0xa0f0('0x20')][_0x2dc14e[_0xa0f0('0xb4')]]);this['voiceQueues'][_0x2dc14e['queue']][_0xa0f0('0x6a')]+=0x1;_0x494a4e=new Hangup(_0x2dc14e,_0x5eb6c5);_0x494a4e['state']=0xc;_0x494a4e[_0xa0f0('0xec')]=_0x5eb6c5[_0xa0f0('0x110')];_0x494a4e[_0xa0f0('0xed')]=_0xa0f0('0x111');this[_0xa0f0('0xcd')](_0x494a4e)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x10c')));this[_0xa0f0('0xcb')](_0x494a4e)['catch'](loggerCatch(_0xa0f0('0x10d')));}};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x112')]=function(_0x4bfda5){var _0x388904=this[_0xa0f0('0x27')][_0x4bfda5[_0xa0f0('0xe3')]];var _0x5b4fa2=this;if(this[_0xa0f0('0x20')][_0x4bfda5[_0xa0f0('0xb4')]]){if(_0x388904&&_0x388904[_0xa0f0('0x58')]!==_0xa0f0('0x78')){delete this[_0xa0f0('0x27')][_0x4bfda5[_0xa0f0('0xe3')]];this[_0xa0f0('0x20')][_0x4bfda5[_0xa0f0('0xb4')]]['outboundAnswerCallsDay']+=0x1;var _0x22b631=new AgentComplete(_0x388904,_0x4bfda5);if(_0x4bfda5[_0xa0f0('0x113')]===_0xa0f0('0x114')){_0x22b631['agiafterat']=this['voiceQueues'][_0x4bfda5[_0xa0f0('0xb4')]][_0xa0f0('0x115')]&&this[_0xa0f0('0x20')][_0x4bfda5['queue']]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x22b631)['catch'](loggerCatch(_0xa0f0('0x116')));this['moveContactManagedDialer'](_0x22b631)[_0xa0f0('0xb2')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xa0f0('0x1c')]['syncAgentConnect']=function(_0x517ad7){if(this['voiceQueues'][_0x517ad7[_0xa0f0('0xb4')]]){if(this['uniqueId'][_0x517ad7[_0xa0f0('0xe3')]]&&this[_0xa0f0('0x27')][_0x517ad7[_0xa0f0('0xe3')]]['type']!==_0xa0f0('0x78')){this[_0xa0f0('0xb6')](this[_0xa0f0('0x20')][_0x517ad7[_0xa0f0('0xb4')]]);this[_0xa0f0('0x27')][_0x517ad7['uniqueid']][_0xa0f0('0x117')]=moment()[_0xa0f0('0x79')](_0xa0f0('0xfe'));}}};Dialer['prototype'][_0xa0f0('0x118')]=function(_0x173e6d){this[_0xa0f0('0xcd')](_0x173e6d)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x116')));this[_0xa0f0('0xcb')](_0x173e6d)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x31')]=function(_0x44bc4e){var _0x4d44e5=this[_0xa0f0('0x27')][_0x44bc4e[_0xa0f0('0xe3')]];var _0x537817=this;if(this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]]){if(_0x4d44e5&&_0x4d44e5[_0xa0f0('0x58')]!==_0xa0f0('0x78')){delete this[_0xa0f0('0x27')][_0x44bc4e['uniqueid']];this['updateOriginated'](this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]]);_0x4d44e5[_0xa0f0('0x119')]=moment()[_0xa0f0('0x79')](_0xa0f0('0xfe'));var _0x47998b=new QueueCallerAbandon(_0x4d44e5,_0x44bc4e);if(getSeconds(_0x4d44e5[_0xa0f0('0x119')],_0x4d44e5[_0xa0f0('0x11a')])>=_0x4d44e5[_0xa0f0('0x11b')]){this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]][_0xa0f0('0x6e')]+=0x1;this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]][_0xa0f0('0x64')]+=0x1;this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x47998b[_0xa0f0('0xa8')]=0xa;_0x47998b[_0xa0f0('0xec')]=_0xa0f0('0x11c');_0x47998b[_0xa0f0('0x11d')]=_0xa0f0('0x11e');_0x47998b[_0xa0f0('0x11f')]=this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]][_0xa0f0('0x115')]?moment()[_0xa0f0('0x79')](_0xa0f0('0xfe')):undefined;_0x47998b[_0xa0f0('0x106')]+=0x1;_0x47998b[_0xa0f0('0xf2')]+=0x1;if(_0x47998b['countdropretry']>=this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]][_0xa0f0('0x120')]){this[_0xa0f0('0x118')](_0x47998b);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x47998b[_0xa0f0('0x106')],'scheduledat':moment()[_0xa0f0('0xfc')](this['voiceQueues'][_0x44bc4e[_0xa0f0('0xb4')]]['dialDropRetryFrequency'],_0xa0f0('0xfd'))['format'](_0xa0f0('0xfe')),'ContactId':_0x4d44e5[_0xa0f0('0xd4')],'ListId':_0x4d44e5[_0xa0f0('0xd5')],'VoiceQueueId':_0x4d44e5[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x4d44e5[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch('[rescheduleContact][Drop]'));var _0x49daf8=new History(_0x47998b);_0x49daf8[_0xa0f0('0xa8')]=0xa;_0x49daf8[_0xa0f0('0xec')]=_0xa0f0('0x11c');_0x49daf8[_0xa0f0('0xaa')]=moment()[_0xa0f0('0x79')](_0xa0f0('0xfe'));_0x49daf8['endtime']=_0x49daf8[_0xa0f0('0xaa')];_0x49daf8[_0xa0f0('0x121')]=_0x47998b[_0xa0f0('0x121')];_0x49daf8[_0xa0f0('0x122')]=_0x47998b[_0xa0f0('0x122')];this['createHistory'](_0x49daf8)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x123')));}}else{this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]][_0xa0f0('0x6d')]+=0x1;this[_0xa0f0('0x20')][_0x44bc4e[_0xa0f0('0xb4')]]['outboundDropCallsDayCallersExit']+=0x1;_0x47998b[_0xa0f0('0xa8')]=0xb;_0x47998b[_0xa0f0('0xec')]=_0xa0f0('0x124');_0x47998b[_0xa0f0('0x11d')]='CALLEREXIT';_0x47998b[_0xa0f0('0xf6')]+=0x1;_0x47998b['countglobal']+=0x1;if(_0x47998b[_0xa0f0('0xf6')]>=this[_0xa0f0('0x20')][_0x44bc4e['queue']][_0xa0f0('0x125')]){this['queueCallerAbandonCreateState'](_0x47998b);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x47998b[_0xa0f0('0xf6')],'scheduledat':moment()[_0xa0f0('0xfc')](this['voiceQueues'][_0x44bc4e['queue']][_0xa0f0('0x126')],_0xa0f0('0xfd'))[_0xa0f0('0x79')](_0xa0f0('0xfe')),'ContactId':_0x4d44e5[_0xa0f0('0xd4')],'ListId':_0x4d44e5['ListId'],'VoiceQueueId':_0x4d44e5[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x4d44e5[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x49daf8=new History(_0x47998b);_0x49daf8[_0xa0f0('0xa8')]=0xb;_0x49daf8[_0xa0f0('0xec')]=_0xa0f0('0x124');_0x49daf8[_0xa0f0('0xaa')]=moment()[_0xa0f0('0x79')](_0xa0f0('0xfe'));_0x49daf8[_0xa0f0('0xa9')]=_0x49daf8[_0xa0f0('0xaa')];_0x49daf8[_0xa0f0('0x121')]=_0x47998b[_0xa0f0('0x121')];_0x49daf8[_0xa0f0('0x122')]=_0x47998b[_0xa0f0('0x122')];this[_0xa0f0('0xcd')](_0x49daf8)['catch'](loggerCatch(_0xa0f0('0x127')));}}}}};Dialer['prototype'][_0xa0f0('0x37')]=function(_0x4543f6){if(this[_0xa0f0('0xad')][_0x4543f6[_0xa0f0('0xe3')]]){this[_0xa0f0('0xad')][_0x4543f6[_0xa0f0('0xe3')]][_0xa0f0('0xb1')]=_0x4543f6['channel'];}if(this[_0xa0f0('0x27')][_0x4543f6[_0xa0f0('0xe3')]]){this[_0xa0f0('0x27')][_0x4543f6[_0xa0f0('0xe3')]][_0xa0f0('0xb1')]=_0x4543f6[_0xa0f0('0xb1')];}};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x128')]=function(_0x5959ca){if(strategy[this[_0xa0f0('0x20')][this[_0xa0f0('0xad')][_0x5959ca['actionid']]['queue']][_0xa0f0('0x50')]]===_0xa0f0('0x1b')){if(this[_0xa0f0('0xad')][_0x5959ca[_0xa0f0('0x129')]]&&_[_0xa0f0('0xe4')](this[_0xa0f0('0xad')][_0x5959ca[_0xa0f0('0x129')]]['locked'])&&_0x5959ca['status']==='1'&&_0x5959ca['paused']==='0'){if(this[_0xa0f0('0x22')][_0x5959ca[_0xa0f0('0x12a')]]){if(!this[_0xa0f0('0x22')][_0x5959ca[_0xa0f0('0x12a')]]['locked']){this[_0xa0f0('0x22')][_0x5959ca['stateinterface']]['locked']=!![];this['actions'][_0x5959ca[_0xa0f0('0x129')]][_0xa0f0('0x12b')]=!![];this['actions'][_0x5959ca['actionid']][_0xa0f0('0x12a')]=_0x5959ca[_0xa0f0('0x12a')];}}}}else if((strategy[this[_0xa0f0('0x20')][this['actions'][_0x5959ca['actionid']][_0xa0f0('0xb4')]][_0xa0f0('0x50')]]||_0xa0f0('0x12c'))==='rrmemory'){if(this['actions'][_0x5959ca[_0xa0f0('0x129')]]){if(this[_0xa0f0('0x22')][_0x5959ca[_0xa0f0('0x12a')]]){this[_0xa0f0('0xad')][_0x5959ca[_0xa0f0('0x129')]][_0xa0f0('0x12a')]=_0x5959ca['stateinterface'];if(_[_0xa0f0('0xe4')](this['queueBooked'][this[_0xa0f0('0xad')][_0x5959ca[_0xa0f0('0x129')]]['queue']])){this[_0xa0f0('0x2b')][this[_0xa0f0('0xad')][_0x5959ca[_0xa0f0('0x129')]][_0xa0f0('0xb4')]]=[];}this[_0xa0f0('0x2b')][this['actions'][_0x5959ca[_0xa0f0('0x129')]][_0xa0f0('0xb4')]][_0xa0f0('0x12d')](_['merge'](_['pick'](this[_0xa0f0('0xad')][_0x5959ca[_0xa0f0('0x129')]],[_0xa0f0('0x12e'),_0xa0f0('0x12a')]),{'status':_0x5959ca[_0xa0f0('0xb0')],'paused':_0x5959ca['paused']}));}}}};function unlockQueueStatus(_0x5ba948,_0x3a9ee3){setTimeout(function(){if(_[_0xa0f0('0x3d')](_0x5ba948[_0xa0f0('0x12f')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x3a9ee3);}_0x5ba948[_0xa0f0('0x12f')]=!![];loggerBooked[_0xa0f0('0x7e')](_0xa0f0('0x130'),_0x3a9ee3,JSON[_0xa0f0('0x4a')](_[_0xa0f0('0xd3')](_0x5ba948,[_0xa0f0('0x3f'),_0xa0f0('0x12f')])));},0x1f3);}Dialer['prototype'][_0xa0f0('0x3b')]=function(_0xdaf034){var _0x4b6c3f=this;var _0x5d506c=_0x4b6c3f[_0xa0f0('0x20')][_0x4b6c3f[_0xa0f0('0xad')][_0xdaf034['actionid']][_0xa0f0('0xb4')]];if(strategy[this[_0xa0f0('0x20')][this['actions'][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xb4')]]['strategy']]===_0xa0f0('0x1b')){if(this[_0xa0f0('0xad')][_0xdaf034['actionid']]&&this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0x12a')]){this[_0xa0f0('0x1f')][_0xa0f0('0x131')](this['actions'][_0xdaf034[_0xa0f0('0x129')]]['idHopper'],this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0x12a')])[_0xa0f0('0xb2')](function(_0x157bcc){logger[_0xa0f0('0x95')](_0xa0f0('0x132'),util['inspect'](_0x157bcc,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4b6c3f[_0xa0f0('0xb6')](_0x4b6c3f[_0xa0f0('0x20')][_0x4b6c3f[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xb4')]]);_0x4b6c3f[_0xa0f0('0x22')][_0x4b6c3f[_0xa0f0('0xad')][_0xdaf034['actionid']][_0xa0f0('0x12a')]][_0xa0f0('0x12b')]=![];delete _0x4b6c3f[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]];unlockQueueStatus(_0x5d506c);});}else{this[_0xa0f0('0xb6')](this[_0xa0f0('0x20')][this['actions'][_0xdaf034['actionid']][_0xa0f0('0xb4')]]);this[_0xa0f0('0xc2')]({'active':![],'ContactId':this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xd4')],'ListId':this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]]['ListId'],'VoiceQueueId':this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xd7')]||undefined,'CampaignId':this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xd8')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]];unlockQueueStatus(_0x5d506c);}}else if((strategy[this[_0xa0f0('0x20')][this[_0xa0f0('0xad')][_0xdaf034['actionid']][_0xa0f0('0xb4')]][_0xa0f0('0x50')]]||'rrmemory')==='rrmemory'){var _0x1da127;if(this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]]&&!_[_0xa0f0('0x7c')](this['queueBooked'][this['actions'][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xb4')]])){if(this[_0xa0f0('0x2c')][_0x4b6c3f['actions'][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xb4')]]){this['queueBookedRR'][_0x4b6c3f[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xb4')]]=this['queueBookedRR'][this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]][_0xa0f0('0xb4')]]?this[_0xa0f0('0x2c')][this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]]['queue']]:this[_0xa0f0('0x2b')][this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]]['queue']]?this[_0xa0f0('0x2b')][this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]]['queue']][_0xa0f0('0x133')]||0x0:0x0;}this['queueBooked'][this[_0xa0f0('0xad')][_0xdaf034[_0xa0f0('0x129')]]['queue']][_0xa0f0('0x133')]=this[_0xa0f0('0x2c')][this['actions'][_0xdaf034['actionid']][_0xa0f0('0xb4')]];for(var _0x5c4d57=0x0;_0x5c4d57=0x0;})['catch'](myreject(_0x3df2d2)));}}else{_0x28f684[_0xa0f0('0x12d')](ami['Action']({'action':_0xa0f0('0x14c'),'command':util[_0xa0f0('0x79')](_0xa0f0('0x151'),_0x3fd050,!_[_0xa0f0('0x3d')](config['timezones'][_0x66e373])?_0x66e373:'')})[_0xa0f0('0xb9')](function(_0x4de246){return _0x4de246[_0xa0f0('0x14e')][_0xa0f0('0x14f')]('true')>=0x0;})[_0xa0f0('0xb2')](myreject(_0x3df2d2)));}BPromise['all'](_0x28f684)[_0xa0f0('0xb9')](function(_0x962147){var _0x110c2d=_[_0xa0f0('0x152')](_0x962147);if(_0x110c2d){return _0x27eb3a(_0x110c2d);}else{_0x47541e[_0xa0f0('0x44')]=_0x57e91e?_0xa0f0('0x153'):_0xa0f0('0x154');return _0x3df2d2(msgResponse(_0xa0f0('0x155'),'Failure','Global:\x20'+_0x57e91e+'\x20'+_0x440214+_0xa0f0('0x156')+util['inspect'](_0x3fd050,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x66e373));}})['catch'](function(_0x18180a){return _0x3df2d2(msgResponse('ifTime',_0xa0f0('0x146'),JSON[_0xa0f0('0x4a')](_0x18180a)));});});};Dialer[_0xa0f0('0x1c')]['checkDialMethod']=function(_0x35d7f9){var _0x524cc2=this;return function(){switch(_0x35d7f9[_0xa0f0('0x5c')]){case'progressive':freeVariablesPredictive(_0x35d7f9);_0x524cc2[_0xa0f0('0x157')](_0x35d7f9,0x1);break;case _0xa0f0('0x158'):freeVariablesPredictive(_0x35d7f9);_0x524cc2[_0xa0f0('0x157')](_0x35d7f9,_0x35d7f9['dialPowerLevel']);break;case'predictive':_0x524cc2['predictive'](_0x35d7f9);break;case'booked':freeVariablesPredictive(_0x35d7f9);_0x524cc2['handlePower'](_0x35d7f9,0x1);break;default:freeVariablesPredictive(_0x35d7f9);logger[_0xa0f0('0x95')](_0xa0f0('0x159'),_0x35d7f9[_0xa0f0('0x3f')],_0xa0f0('0x15a'));}};};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x15b')]=function(_0x2d1ddf){var _0x2f7a44=this;return function(){_0x2f7a44[_0xa0f0('0x15c')](_0x2d1ddf);};};Dialer[_0xa0f0('0x1c')]['syncQueueSummary']=function(_0x2b8fe7){var _0x1b649c=this;if(isNotPreview(_0x2b8fe7[_0xa0f0('0x5c')])){if(isVoiceQueueOutbound(_0x2b8fe7[_0xa0f0('0x58')])&&isActive(_0x2b8fe7[_0xa0f0('0x15d')])){_0x2b8fe7[_0xa0f0('0xa1')]=!![];BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](checkIsLoggedIn(_0x2b8fe7,_0x2b8fe7[_0xa0f0('0x53')]))['then'](checkIsActive(_0x2b8fe7,_0x2b8fe7[_0xa0f0('0x15d')]))[_0xa0f0('0xb9')](checkInterval(_0x2b8fe7))[_0xa0f0('0xb9')](_0x1b649c['checkIsTrunkReachable'](_0x2b8fe7))['then'](_0x1b649c[_0xa0f0('0x143')](_0x2b8fe7['dialGlobalInterval'],_0x2b8fe7[_0xa0f0('0x15e')],_0x2b8fe7[_0xa0f0('0x3f')],_0x2b8fe7))[_0xa0f0('0xb9')](_0x1b649c[_0xa0f0('0x145')](_0x2b8fe7[_0xa0f0('0x43')],_0x2b8fe7['dialTimezone'],_0x2b8fe7[_0xa0f0('0x3f')],_0x2b8fe7))[_0xa0f0('0xb9')](_0x1b649c['checkDialMethod'](_0x2b8fe7))[_0xa0f0('0xb2')](loggerCatchQueueSummary(_0xa0f0('0x15f'),_0x2b8fe7));}else{notSendMessagesQueue(_0x2b8fe7);}}else{freeVariablesPredictive(_0x2b8fe7);}};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x13f')]=function(){var _0x2b14a0=this;var _0x184c81;for(var _0x9c0a5 in this[_0xa0f0('0x21')]){if(typeof this['campaigns'][_0x9c0a5]!=='undefined'){_0x184c81=this['campaigns'][_0x9c0a5];if(isCampaignIvr(_0x184c81[_0xa0f0('0x58')])&&isActive(_0x184c81[_0xa0f0('0xde')])){_0x184c81[_0xa0f0('0xa1')]=!![];BPromise[_0xa0f0('0xbc')]()[_0xa0f0('0xb9')](checkIsActive(_0x184c81,_0x184c81[_0xa0f0('0xde')]))['then'](checkInterval(_0x184c81))['then'](_0x2b14a0['checkIsTrunkReachable'](_0x184c81))[_0xa0f0('0xb9')](_0x2b14a0[_0xa0f0('0x143')](_0x184c81[_0xa0f0('0x160')],_0x184c81[_0xa0f0('0x15e')],_0x184c81[_0xa0f0('0x3f')],_0x184c81))['then'](_0x2b14a0[_0xa0f0('0x145')](_0x184c81[_0xa0f0('0x43')],_0x184c81['dialTimezone'],_0x184c81[_0xa0f0('0x3f')],_0x184c81))[_0xa0f0('0xb9')](_0x2b14a0['launchHandleIvr'](_0x184c81))[_0xa0f0('0xb2')](loggerCatchQueueSummary(_0xa0f0('0x161'),_0x184c81));}else{notSendMessagesCampaign(_0x184c81);}}}};function getCallerIdRandom(_0x2a49b9,_0x3090e6){var _0x50a39a;var _0x317408;var _0xade9bd;if(_0x3090e6<=0x0){_0x3090e6=0x1;}_0x50a39a=new RegExp('\x5cw{0,'+_0x3090e6+'}$');_0x317408=Math[_0xa0f0('0x162')](0xa,_0x3090e6-0x1);_0xade9bd=Math[_0xa0f0('0x162')](0xa,_0x3090e6)-0x1;return util[_0xa0f0('0x79')]('%s',_[_0xa0f0('0x163')](_0x2a49b9,_0x50a39a,_['random'](_0x317408,_0xade9bd)));}function extractCalleridName(_0x5335e6){var _0xb5c034=_0x5335e6[_0xa0f0('0x164')](/"(.*?)"/);return _0xb5c034?_0xb5c034[0x1]:_0x5335e6;}function extractCalleridNumber(_0x5bf6a4){var _0x40182a=_0x5bf6a4[_0xa0f0('0x164')](/<(.*?)>/);return _0x40182a?_0x40182a[0x1]:_0x5bf6a4;}Dialer[_0xa0f0('0x1c')][_0xa0f0('0x165')]=function(_0x18f6e4,_0x2b03d6){var _0x3812cc=this;var _0x6963f0=uuid['v4']();this[_0xa0f0('0xad')][_0x6963f0]=new Action(_0x18f6e4,_0x2b03d6,_0x6963f0);return new BPromise(function(_0x310203,_0xb8ffa9){if(_['isUndefined'](_0x18f6e4)&&typeof _0x18f6e4!==_0xa0f0('0x166')){return _0xb8ffa9(msgResponse('originate',_0xa0f0('0x146'),_0xa0f0('0x167')));}if(_[_0xa0f0('0x3d')](_0x2b03d6[_0xa0f0('0x168')][_0xa0f0('0x169')])||_0x2b03d6[_0xa0f0('0x168')][_0xa0f0('0x169')]===null){return _0xb8ffa9(msgResponse(_0xa0f0('0x16a'),_0xa0f0('0x146'),_0xa0f0('0x16b')));}var _0x543c07={'XMD-CALLERID':_0x3812cc[_0xa0f0('0xad')][_0x6963f0][_0xa0f0('0x16c')](),'XMD-AGI':_0x18f6e4[_0xa0f0('0x10e')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x18f6e4['dialQueueProject']):_0xa0f0('0x16d'),'XMD-AGIAFTER':_0x18f6e4[_0xa0f0('0x115')]?util[_0xa0f0('0x79')](_0xa0f0('0x16e'),ipAgi,_0x18f6e4['dialQueueProject2']):_0xa0f0('0x16d'),'XMD-QUEUE':_0x18f6e4[_0xa0f0('0x58')]===_0xa0f0('0x4f')?util[_0xa0f0('0x79')](_0xa0f0('0x16f'),_0x18f6e4[_0xa0f0('0x3f')],_0x18f6e4[_0xa0f0('0x170')]||'',_0x18f6e4[_0xa0f0('0x171')]?'c':'',_0x18f6e4[_0xa0f0('0x11b')]||0x3):_0xa0f0('0x16d'),'XMD-CONTACTID':_0x2b03d6[_0xa0f0('0xd4')],'XMD-CDRTYPE':_0xa0f0('0x8'),'CALLERID(all)':_0x3812cc[_0xa0f0('0xad')][_0x6963f0][_0xa0f0('0x16c')](),'XMD-AMD':_0x18f6e4['dialAMDActive']?_0xa0f0('0x172'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x18f6e4['dialAMDActive']){_0x543c07[_0xa0f0('0x173')]=_0x18f6e4[_0xa0f0('0x174')]||0x9c4;_0x543c07[_0xa0f0('0x175')]=_0x18f6e4[_0xa0f0('0x176')]||0x5dc;_0x543c07['XMD-AMDAFTERGREETINGSILENCE']=_0x18f6e4[_0xa0f0('0x177')]||0x320;_0x543c07[_0xa0f0('0x178')]=_0x18f6e4[_0xa0f0('0x179')]||0x1388;_0x543c07[_0xa0f0('0x17a')]=_0x18f6e4[_0xa0f0('0x17b')]||0x64;_0x543c07[_0xa0f0('0x17c')]=_0x18f6e4[_0xa0f0('0x17d')]||0x32;_0x543c07['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x18f6e4['dialAMDMaximumNumberOfWords']||0x3;_0x543c07['XMD-AMDSILENCETHRESHOLD']=_0x18f6e4[_0xa0f0('0x17e')]||0x100;_0x543c07[_0xa0f0('0x17f')]=_0x18f6e4[_0xa0f0('0x180')]||0x1388;}if(_0x18f6e4[_0xa0f0('0x58')]===_0xa0f0('0x4f')){_0x543c07[_0xa0f0('0x181')]=_0x2b03d6[_0xa0f0('0xd7')];}else{_0x543c07['XMD-CAMPAIGNID']=_0x2b03d6[_0xa0f0('0xd8')];}for(var _0x505a34 in _0x2b03d6['Contact']){if(typeof _0x2b03d6[_0xa0f0('0x168')][_0x505a34]!==_0xa0f0('0x98')){if(isNotNull(_0x2b03d6[_0xa0f0('0x168')][_0x505a34])&&_0x505a34!=='id'&&_0x505a34!==_0xa0f0('0x182')&&_0x505a34!==_0xa0f0('0x183')&&_0x505a34!==_0xa0f0('0x184')){_0x543c07[util[_0xa0f0('0x79')](_0xa0f0('0x185'),_0xa0f0('0x186'),_[_0xa0f0('0x187')](_0x505a34))]=_0x2b03d6['Contact'][_0x505a34];}}}var _0x290845=_0x3812cc['isTrunkReachable'](_0x18f6e4[_0xa0f0('0x74')])?getCallerId(_0x18f6e4[_0xa0f0('0x74')][_0xa0f0('0x75')],_0x18f6e4[_0xa0f0('0x188')],_0x18f6e4[_0xa0f0('0x189')]>0x0?getCallerIdRandom(_0x18f6e4['dialOriginateCallerIdNumber'],_0x18f6e4[_0xa0f0('0x189')]):_0x18f6e4[_0xa0f0('0x5d')]):getCallerId(_['isNil'](_0x18f6e4[_0xa0f0('0x141')])?_0x18f6e4[_0xa0f0('0x74')][_0xa0f0('0x75')]:_0x18f6e4['TrunkBackup'][_0xa0f0('0x75')],_0x18f6e4[_0xa0f0('0x188')],_0x18f6e4[_0xa0f0('0x189')]>0x0?getCallerIdRandom(_0x18f6e4[_0xa0f0('0x5d')],_0x18f6e4[_0xa0f0('0x189')]):_0x18f6e4[_0xa0f0('0x5d')]);if(_0x290845){_0x543c07[_0xa0f0('0x18a')]=_0x3812cc[_0xa0f0('0xad')][_0x6963f0][_0xa0f0('0x18b')]=extractCalleridName(_0x290845);_0x543c07['XMD-ORIGINATECALLERIDNUM']=_0x3812cc[_0xa0f0('0xad')][_0x6963f0]['originatecalleridnum']=extractCalleridNumber(_0x290845);}return ami[_0xa0f0('0xaf')]({'actionid':_0x6963f0,'action':'originate','channel':_0x3812cc[_0xa0f0('0xdd')](_0x18f6e4['Trunk'])?util[_0xa0f0('0x79')]('SIP/%s/%s%s',_0x18f6e4[_0xa0f0('0x74')][_0xa0f0('0x3f')],isNotNull(_0x18f6e4[_0xa0f0('0x5e')])?_0x18f6e4[_0xa0f0('0x5e')][_0xa0f0('0x18c')]()||'':'',_0x18f6e4[_0xa0f0('0x18d')]>0x0?_0x2b03d6['Contact'][_0xa0f0('0x169')][_0xa0f0('0x18e')](_0x18f6e4[_0xa0f0('0x18d')]):_0x2b03d6['Contact']['phone']):util['format'](_0xa0f0('0x18f'),_['isNil'](_0x18f6e4[_0xa0f0('0x141')])?_0x18f6e4[_0xa0f0('0x74')]['name']:_0x18f6e4['TrunkBackup'][_0xa0f0('0x3f')],isNotNull(_0x18f6e4[_0xa0f0('0x5e')])?_0x18f6e4['dialPrefix']['trim']()||'':'',_0x18f6e4[_0xa0f0('0x18d')]>0x0?_0x2b03d6[_0xa0f0('0x168')][_0xa0f0('0x169')][_0xa0f0('0x18e')](_0x18f6e4[_0xa0f0('0x18d')]):_0x2b03d6['Contact'][_0xa0f0('0x169')]),'callerid':_0x290845,'Exten':_0xa0f0('0xe8'),'Context':_0xa0f0('0x190'),'Priority':'1','variable':_0x543c07,'timeout':(_0x18f6e4[_0xa0f0('0x191')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6963f0})[_0xa0f0('0xb9')](function(_0x5c5f5f){return _0x310203(_0x5c5f5f);})[_0xa0f0('0xb2')](function(_0x5960c6){_0x18f6e4['outboundOriginateFailureCallsDay']+=0x1;var _0x1de960=new History(_0x3812cc['actions'][_0x6963f0]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0xa0f0('0x4a')](_0x5960c6)));_0x1de960[_0xa0f0('0xa8')]=0xe;_0x1de960[_0xa0f0('0xec')]=_0xa0f0('0x192');_0x1de960[_0xa0f0('0xaa')]=moment()[_0xa0f0('0x79')](_0xa0f0('0xfe'));_0x1de960['endtime']=_0x1de960[_0xa0f0('0xaa')];_0x3812cc[_0xa0f0('0xcd')](_0x1de960)[_0xa0f0('0xb2')](loggerCatch('[originate][error]'));_0x3812cc['moveContactManagedDialer'](_0x1de960)[_0xa0f0('0xb2')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3812cc[_0xa0f0('0xad')][_0x6963f0];return _0xb8ffa9(msgResponse(_0xa0f0('0x16a'),_0xa0f0('0x49'),'originate\x20action\x20Error'));});});});};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x193')]=function(_0x4c53cc){var _0x531c8c=this[_0xa0f0('0xad')][_0x4c53cc['actionid']];if(_0x531c8c){delete this[_0xa0f0('0xad')][_0x4c53cc[_0xa0f0('0x129')]];_0x531c8c[_0xa0f0('0x11a')]=moment()['format'](_0xa0f0('0xfe'));var _0x9985f0=_0x531c8c[_0xa0f0('0x58')]==='ivr'?this[_0xa0f0('0x21')][_0x531c8c[_0xa0f0('0xb4')]]:this[_0xa0f0('0x20')][_0x531c8c[_0xa0f0('0x194')]()];if(!this['isSuccess'](_0x4c53cc[_0xa0f0('0x195')])){this[_0xa0f0('0xb6')](_0x9985f0);return this[_0xa0f0('0x196')](_0x531c8c,_0x9985f0,_0x4c53cc)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x197')));}this[_0xa0f0('0x27')][_0x4c53cc['uniqueid']]=_0x531c8c;}};Dialer[_0xa0f0('0x1c')]['checkRetriveMax']=function(_0x374072,_0x5548c4,_0x13fd06){var _0x589a1c=new History(_0x5548c4);if(_0x589a1c[_0xa0f0('0x103')]+_0x589a1c[_0xa0f0('0x104')]+_0x589a1c[_0xa0f0('0x105')]+_0x589a1c[_0xa0f0('0xf5')]+_0x589a1c['countdropretry']+_0x589a1c['countabandonedretry']+_0x589a1c['countmachineretry']+_0x589a1c[_0xa0f0('0xf7')]>=_0x13fd06[_0xa0f0('0xf8')]-0x1){return!![];}switch(_0x374072){case 0x3:if(_0x589a1c[_0xa0f0('0x105')]>=_0x13fd06[_0xa0f0('0x198')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x589a1c['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xa0f0('0xfc')](_0x13fd06[_0xa0f0('0x199')],_0xa0f0('0xfd'))[_0xa0f0('0x79')](_0xa0f0('0xfe')),'ContactId':_0x589a1c[_0xa0f0('0xd4')],'ListId':_0x589a1c[_0xa0f0('0xd5')],'VoiceQueueId':_0x589a1c[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x589a1c[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x19a')));break;case 0x5:if(_0x589a1c[_0xa0f0('0x103')]>=_0x13fd06[_0xa0f0('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x589a1c[_0xa0f0('0x103')]+=0x1,'scheduledat':moment()[_0xa0f0('0xfc')](_0x13fd06['dialBusyRetryFrequency'],_0xa0f0('0xfd'))[_0xa0f0('0x79')](_0xa0f0('0xfe')),'ContactId':_0x589a1c[_0xa0f0('0xd4')],'ListId':_0x589a1c['ListId'],'VoiceQueueId':_0x589a1c[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x589a1c[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x589a1c[_0xa0f0('0x104')]>=_0x13fd06[_0xa0f0('0x19c')]-0x1){return!![];}this[_0xa0f0('0xc2')]({'active':![],'countcongestionretry':_0x589a1c['countcongestionretry']+=0x1,'scheduledat':moment()[_0xa0f0('0xfc')](_0x13fd06['dialCongestionRetryFrequency'],'minutes')['format'](_0xa0f0('0xfe')),'ContactId':_0x589a1c['ContactId'],'ListId':_0x589a1c[_0xa0f0('0xd5')],'VoiceQueueId':_0x589a1c['VoiceQueueId']||undefined,'CampaignId':_0x589a1c[_0xa0f0('0xd8')]||undefined})['catch'](loggerCatch(_0xa0f0('0x19d')));break;case 0x0:if(_0x589a1c['countnosuchnumberretry']>=_0x13fd06['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xa0f0('0xc2')]({'active':![],'countnosuchnumberretry':_0x589a1c[_0xa0f0('0xf5')]+=0x1,'scheduledat':moment()[_0xa0f0('0xfc')](_0x13fd06[_0xa0f0('0x19e')],_0xa0f0('0xfd'))[_0xa0f0('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x589a1c[_0xa0f0('0xd4')],'ListId':_0x589a1c[_0xa0f0('0xd5')],'VoiceQueueId':_0x589a1c[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x589a1c['CampaignId']||undefined})[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x19f')));}break;case 0xa:if(_0x589a1c[_0xa0f0('0x106')]>=_0x13fd06[_0xa0f0('0x120')]-0x1){return!![];}this[_0xa0f0('0xc2')]({'active':![],'countdropretry':_0x589a1c['countdropretry']+=0x1,'scheduledat':moment()[_0xa0f0('0xfc')](_0x13fd06[_0xa0f0('0x1a0')],'minutes')[_0xa0f0('0x79')](_0xa0f0('0xfe')),'ContactId':_0x589a1c[_0xa0f0('0xd4')],'ListId':_0x589a1c[_0xa0f0('0xd5')],'VoiceQueueId':_0x589a1c[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x589a1c[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x1a1')));break;case 0xb:if(_0x589a1c['countabandonedretry']>=_0x13fd06['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x589a1c['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x13fd06['dialAbandonedRetryFrequency'],_0xa0f0('0xfd'))[_0xa0f0('0x79')](_0xa0f0('0xfe')),'ContactId':_0x589a1c['ContactId'],'ListId':_0x589a1c[_0xa0f0('0xd5')],'VoiceQueueId':_0x589a1c[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x589a1c[_0xa0f0('0xd8')]||undefined})['catch'](loggerCatch(_0xa0f0('0x1a2')));break;case 0x13:if(_0x589a1c[_0xa0f0('0xfb')]>=_0x13fd06['dialMachineMaxRetry']-0x1){return!![];}this[_0xa0f0('0xc2')]({'active':![],'countmachineretry':_0x589a1c[_0xa0f0('0xfb')]+=0x1,'scheduledat':moment()[_0xa0f0('0xfc')](_0x13fd06[_0xa0f0('0x10a')],_0xa0f0('0xfd'))['format'](_0xa0f0('0xfe')),'ContactId':_0x589a1c[_0xa0f0('0xd4')],'ListId':_0x589a1c[_0xa0f0('0xd5')],'VoiceQueueId':_0x589a1c['VoiceQueueId']||undefined,'CampaignId':_0x589a1c[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xff')));break;case 0x14:if(_0x589a1c[_0xa0f0('0xf7')]>=_0x13fd06[_0xa0f0('0x1a3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x589a1c[_0xa0f0('0xf7')]+=0x1,'scheduledat':moment()[_0xa0f0('0xfc')](_0x13fd06['dialAgentRejectRetryFrequency'],_0xa0f0('0xfd'))[_0xa0f0('0x79')](_0xa0f0('0xfe')),'ContactId':_0x589a1c[_0xa0f0('0xd4')],'ListId':_0x589a1c[_0xa0f0('0xd5')],'VoiceQueueId':_0x589a1c[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x589a1c[_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xa0f0('0x1c')]['callProgressDetecting']=function(_0x2e4f2b,_0xe77452,_0x4cd2e6){var _0x19a14f=this;var _0x15c45a=new History(_0x2e4f2b);return new BPromise(function(_0x28fa4e,_0x27568e){if(_['isUndefined'](_0xe77452)&&typeof _0xe77452!=='object'){return _0x27568e(msgResponse(_0xa0f0('0x1a4'),'Failure',_0xa0f0('0x1a5')));}if(_['isUndefined'](_0x4cd2e6)&&typeof _0x4cd2e6!==_0xa0f0('0x166')){return _0x27568e(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}switch(_0x4cd2e6[_0xa0f0('0x113')]){case'0':_0xe77452[_0xa0f0('0x66')]+=0x1;_0x15c45a[_0xa0f0('0xa8')]=0x0;_0x15c45a[_0xa0f0('0xec')]='NoSuchNumber';_0x15c45a[_0xa0f0('0xf5')]+=0x1;_0x15c45a[_0xa0f0('0xf2')]+=0x1;ami[_0xa0f0('0x4e')](_0xa0f0('0x1a6'),ut[_0xa0f0('0x1a7')](_0x2e4f2b,_0xa0f0('0x1a8')));_0x19a14f[_0xa0f0('0xcd')](_0x15c45a)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0xf4')));if(_0x19a14f['checkRetriveMax'](0x0,_0x2e4f2b,_0xe77452)){if(_0x15c45a[_0xa0f0('0xf5')]>=_0xe77452[_0xa0f0('0x1a9')]){_0x19a14f['createStateFinal'](_0x15c45a,_0x28fa4e,_0x27568e,'reason\x200\x20no\x20such\x20number....');}else{_0x19a14f['stateGlobal'](_0x15c45a,_0x28fa4e,_0x27568e,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xe77452[_0xa0f0('0x65')]+=0x1;_0x15c45a[_0xa0f0('0xa8')]=0x3;_0x15c45a[_0xa0f0('0xec')]=_0xa0f0('0x1aa');_0x15c45a[_0xa0f0('0x105')]+=0x1;_0x15c45a[_0xa0f0('0xf2')]+=0x1;ami['emit'](_0xa0f0('0x1ab'),ut[_0xa0f0('0x1a7')](_0x2e4f2b,_0xa0f0('0x1ac')));_0x19a14f[_0xa0f0('0xcd')](_0x15c45a)[_0xa0f0('0xb2')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x19a14f[_0xa0f0('0x1ad')](0x3,_0x2e4f2b,_0xe77452)){if(_0x15c45a['countnoanswerretry']>=_0xe77452['dialNoAnswerMaxRetry']){_0x19a14f[_0xa0f0('0x109')](_0x15c45a,_0x28fa4e,_0x27568e,_0xa0f0('0x1ae'));}else{_0x19a14f[_0xa0f0('0xf9')](_0x15c45a,_0x28fa4e,_0x27568e,_0xa0f0('0x1ae'));}}break;case'5':_0xe77452[_0xa0f0('0x61')]+=0x1;_0x15c45a[_0xa0f0('0xa8')]=0x5;_0x15c45a['statedesc']=_0xa0f0('0x1af');_0x15c45a['countbusyretry']+=0x1;_0x15c45a[_0xa0f0('0xf2')]+=0x1;ami[_0xa0f0('0x4e')](_0xa0f0('0x1b0'),ut['buildObj'](_0x2e4f2b,'busy'));_0x19a14f[_0xa0f0('0xcd')](_0x15c45a)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x1b1')));if(_0x19a14f[_0xa0f0('0x1ad')](0x5,_0x2e4f2b,_0xe77452)){if(_0x15c45a[_0xa0f0('0x103')]>=_0xe77452[_0xa0f0('0x19b')]){_0x19a14f[_0xa0f0('0x109')](_0x15c45a,_0x28fa4e,_0x27568e,'reason\x205\x20busy');}else{_0x19a14f[_0xa0f0('0xf9')](_0x15c45a,_0x28fa4e,_0x27568e,_0xa0f0('0x1b2'));}}break;case'8':_0xe77452['outboundCongestionCallsDay']+=0x1;_0x15c45a['state']=0x8;_0x15c45a[_0xa0f0('0xec')]=_0xa0f0('0x1b3');_0x15c45a['countcongestionretry']+=0x1;_0x15c45a[_0xa0f0('0xf2')]+=0x1;ami[_0xa0f0('0x4e')](_0xa0f0('0x1b4'),ut[_0xa0f0('0x1a7')](_0x2e4f2b,_0xa0f0('0x1b5')));_0x19a14f[_0xa0f0('0xcd')](_0x15c45a)['catch'](loggerCatch(_0xa0f0('0x1b6')));if(_0x19a14f[_0xa0f0('0x1ad')](0x8,_0x2e4f2b,_0xe77452)){if(_0x15c45a[_0xa0f0('0x104')]>=_0xe77452['dialCongestionMaxRetry']){_0x19a14f[_0xa0f0('0x109')](_0x15c45a,_0x28fa4e,_0x27568e,'reason\x208\x20congestion');}else{_0x19a14f[_0xa0f0('0xf9')](_0x15c45a,_0x28fa4e,_0x27568e,_0xa0f0('0x1b7'));}}break;case'11':_0xe77452[_0xa0f0('0x1b8')]+=0x1;_0x15c45a['state']=0xb;_0x15c45a[_0xa0f0('0xec')]=_0xa0f0('0x124');_0x15c45a[_0xa0f0('0xf6')]+=0x1;_0x15c45a[_0xa0f0('0xf2')]+=0x1;_0x19a14f[_0xa0f0('0xcd')](_0x15c45a)['catch'](loggerCatch(_0xa0f0('0x127')));if(_0x19a14f[_0xa0f0('0x1ad')](0xb,_0x2e4f2b,_0xe77452)){if(_0x15c45a[_0xa0f0('0xf6')]>=_0xe77452[_0xa0f0('0x125')]){_0x19a14f[_0xa0f0('0x109')](_0x15c45a,_0x28fa4e,_0x27568e,_0xa0f0('0x1b9'));}else{_0x19a14f[_0xa0f0('0xf9')](_0x15c45a,_0x28fa4e,_0x27568e,_0xa0f0('0x1b9'));}}break;case'20':_0xe77452[_0xa0f0('0x69')]+=0x1;_0x15c45a['state']=0x14;_0x15c45a[_0xa0f0('0xec')]='AgentReject';_0x15c45a['countagentrejectretry']+=0x1;_0x15c45a['countglobal']+=0x1;ami['emit'](_0xa0f0('0x1ba'),ut[_0xa0f0('0x1a7')](_0x2e4f2b,_0xa0f0('0x1bb')));_0x19a14f[_0xa0f0('0xcd')](_0x15c45a)[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x1bc')));if(_0x19a14f[_0xa0f0('0x1ad')](0x14,_0x2e4f2b,_0xe77452)){if(_0x15c45a[_0xa0f0('0xf7')]>=_0xe77452[_0xa0f0('0x1a3')]){_0x19a14f[_0xa0f0('0x109')](_0x15c45a,_0x28fa4e,_0x27568e,_0xa0f0('0x1bd'));}else{_0x19a14f[_0xa0f0('0xf9')](_0x15c45a,_0x28fa4e,_0x27568e,'reason\x2020\x20agentreject');}}break;default:_0xe77452[_0xa0f0('0x6a')]+=0x1;_0x15c45a[_0xa0f0('0xa8')]=0xc;_0x15c45a[_0xa0f0('0xec')]=_0x4cd2e6[_0xa0f0('0x113')];_0x19a14f[_0xa0f0('0xcd')](_0x15c45a)['catch'](loggerCatch(_0xa0f0('0x1be')));if(_0x19a14f[_0xa0f0('0x1ad')](_0x4cd2e6['reason'],_0x2e4f2b,_0xe77452)){if(_0x15c45a['countbusyretry']+_0x15c45a[_0xa0f0('0x104')]+_0x15c45a[_0xa0f0('0x105')]+_0x15c45a[_0xa0f0('0xf5')]+_0x15c45a[_0xa0f0('0x106')]+_0x15c45a[_0xa0f0('0xf6')]+_0x15c45a[_0xa0f0('0xfb')]+_0x15c45a['countagentrejectretry']>=_0xe77452[_0xa0f0('0xf8')]){_0x19a14f[_0xa0f0('0xf9')](_0x15c45a,_0x28fa4e,_0x27568e,_0x4cd2e6[_0xa0f0('0x113')]);}else{_0x19a14f[_0xa0f0('0x109')](_0x15c45a,_0x28fa4e,_0x27568e,_0x4cd2e6['reason']);}}}});};Dialer[_0xa0f0('0x1c')][_0xa0f0('0xf9')]=function(_0x30791e,_0x155ad0,_0x4c54d5,_0x4deab9){var _0xe81c6d=new Final(_0x30791e);_0xe81c6d[_0xa0f0('0xa8')]=0xf;_0xe81c6d[_0xa0f0('0xec')]=_0xa0f0('0x1bf');this[_0xa0f0('0x109')](_0xe81c6d,_0x155ad0,_0x4c54d5,_0x4deab9);};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x109')]=function(_0x5e3960,_0x2f86f2,_0x4725e4,_0x1309f2){this[_0xa0f0('0xcb')](_0x5e3960)['then'](function(){return _0x2f86f2(msgResponse(_0xa0f0('0x1a4'),_0xa0f0('0xdc'),_0x1309f2));})[_0xa0f0('0xb2')](function(){return _0x4725e4(msgResponse('[moveContactManagedDialer][0]',_0xa0f0('0x146'),'contact\x20not\x20moved'));});};Dialer[_0xa0f0('0x1c')]['predictive']=function(_0x4036d1){var _0x370f7a=_0x4036d1[_0xa0f0('0x1c0')]/0x64;var _0x3b81a3=_0x4036d1['outboundDropCallsDayTimeout']/(_0x4036d1['outboundDropCallsDayTimeout']+_0x4036d1[_0xa0f0('0x60')]);var _0x1e923a=Math[_0xa0f0('0x1c1')](_0x4036d1['predictiveIntervalAvailable']*(_0x4036d1['predictiveIntervalMaxThreshold']/0x64));var _0x2af166=Math[_0xa0f0('0x1c1')](_0x4036d1[_0xa0f0('0x1c2')]*(_0x4036d1[_0xa0f0('0x1c3')]/0x64));var _0x268560=_0x4036d1[_0xa0f0('0x52')]+_0x4036d1[_0xa0f0('0xa2')];var _0x2c690c=Math[_0xa0f0('0x1c4')](_0x4036d1[_0xa0f0('0x72')]*_0x4036d1[_0xa0f0('0x73')]*_0x4036d1[_0xa0f0('0x1c5')]*_0x4036d1[_0xa0f0('0x70')]);if(_[_0xa0f0('0x3d')](_0x4036d1[_0xa0f0('0x2a')])){if(!_[_0xa0f0('0x3d')](_0x4036d1['startPredictive'])){_0x4036d1[_0xa0f0('0x29')]=undefined;loggerPredictive[_0xa0f0('0x95')](_0xa0f0('0x1c6'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x4036d1[_0xa0f0('0x90')])){loggerPredictive[_0xa0f0('0x95')](_0xa0f0('0x1c6'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4036d1[_0xa0f0('0x90')]);_0x4036d1[_0xa0f0('0x90')]=undefined;}_0x4036d1['startProgressive']=moment()['format'](_0xa0f0('0xfe'));loggerPredictive[_0xa0f0('0x7e')](_0x4036d1[_0xa0f0('0x3f')],_0xa0f0('0x1c7'),_0x4036d1['startProgressive']);this['handlePower'](_0x4036d1,0x1);}else if(ifInterval(_0x4036d1[_0xa0f0('0x1c8')],_0x4036d1[_0xa0f0('0x2a')])){this[_0xa0f0('0x157')](_0x4036d1,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x4036d1['startProgressive'],_0x4036d1['name']);_0x4036d1['erlangCalls']=0x0;_0x4036d1[_0xa0f0('0x1c9')]=0x0;}else if(_0x370f7a<_0x3b81a3&&_0x4036d1[_0xa0f0('0x1ca')]===_0xa0f0('0x1cb')){freeVariablesPredictive(_0x4036d1);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x1cc'),_0xa0f0('0x1cd'),_0x3b81a3,_0xa0f0('0x2a'),_0x4036d1['name']);}else if(_0x2c690c<_0x4036d1['predictiveIntervalErlangCallsDroppedCalls']&&_0x4036d1[_0xa0f0('0x1ca')]==='dropRate'){freeVariablesPredictive(_0x4036d1);loggerPredictive[_0xa0f0('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x2c690c,'Drop\x20in\x20this\x20interval',_0x4036d1[_0xa0f0('0x1c9')],_0xa0f0('0x2a'),_0x4036d1[_0xa0f0('0x3f')]);}else if(!ifInterval(_0x4036d1[_0xa0f0('0x1c8')],_0x4036d1[_0xa0f0('0x2a')])&&_[_0xa0f0('0x3d')](_0x4036d1[_0xa0f0('0x29')])&&!_[_0xa0f0('0x3d')](_0x4036d1[_0xa0f0('0x2a')])){_0x4036d1['startPredictive']=moment()[_0xa0f0('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa0f0('0x7e')](_0x4036d1[_0xa0f0('0x3f')],'started\x20in\x20predictive\x20at',_0x4036d1[_0xa0f0('0x29')]);this['averageHandleTime'](_0x4036d1[_0xa0f0('0x1c8')])[_0xa0f0('0xb9')](this[_0xa0f0('0x1ce')](_0x4036d1))[_0xa0f0('0xb9')](mergeDataErlangB(_0x4036d1))[_0xa0f0('0xb9')](this[_0xa0f0('0x1cf')](_0x4036d1))[_0xa0f0('0xb2')](loggerCatchPredictive(_0xa0f0('0x1d0'),_0x4036d1));}else if(!ifInterval(_0x4036d1[_0xa0f0('0x1c8')],_0x4036d1[_0xa0f0('0x29')])){_0x4036d1['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4036d1['startPredictive']=moment()[_0xa0f0('0x79')](_0xa0f0('0xfe'));loggerPredictive['info'](_0x4036d1[_0xa0f0('0x3f')],_0xa0f0('0x1d1'),_0x4036d1['startPredictive']);clearInterval(_0x4036d1[_0xa0f0('0x90')]);_0x4036d1[_0xa0f0('0x90')]=undefined;this['averageHandleTime'](_0x4036d1[_0xa0f0('0x1c8')])[_0xa0f0('0xb9')](this[_0xa0f0('0x1ce')](_0x4036d1))['then'](mergeDataErlangB(_0x4036d1))['then'](this['startMethodPredictive'](_0x4036d1))['catch'](loggerCatchPredictive(_0xa0f0('0x1d2'),_0x4036d1));}else if(_0x4036d1[_0xa0f0('0x1c2')]&&_0x268560<_0x4036d1[_0xa0f0('0x1c2')]-_0x2af166){freeVariablesPredictive(_0x4036d1);loggerPredictive[_0xa0f0('0x7e')](_0x4036d1['name'],_0xa0f0('0x1d3'),_0x268560,')\x20are\x20less\x20than\x20threshold\x20(',_0x4036d1[_0xa0f0('0x1c2')],'-',_0x2af166,'=',_0x4036d1[_0xa0f0('0x1c2')]-_0x2af166,')');}else if(_0x4036d1[_0xa0f0('0x1c2')]&&_0x268560>_0x4036d1[_0xa0f0('0x1c2')]+_0x1e923a){freeVariablesPredictive(_0x4036d1);loggerPredictive[_0xa0f0('0x7e')](_0x4036d1['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x268560,_0xa0f0('0x1d4'),_0x4036d1['predictiveIntervalAvailable'],'+',_0x1e923a,'=',_0x4036d1[_0xa0f0('0x1c2')]+_0x1e923a,')');}};Dialer['prototype'][_0xa0f0('0x1ce')]=function(_0x57ba2d){var _0x340e65=this;return function(_0x23953d){return new BPromise(function(_0x4690e2,_0x45b0dc){_[_0xa0f0('0x8f')](_0x57ba2d,_0x23953d[0x0]);if(checkGetDataPredictive(_0x23953d[0x0])){var _0x5d0077=_0x57ba2d[_0xa0f0('0x1c2')]=_0x57ba2d[_0xa0f0('0xa2')]+_0x57ba2d['available'];var _0x3874a6=_0x57ba2d[_0xa0f0('0x1c8')]*0x3c;var _0x3f68c9=_0x23953d[0x0]['predictiveIntervalAvgTalktime']+_0x23953d[0x0][_0xa0f0('0x6b')];var _0x4e690d=(_0x23953d[0x0][_0xa0f0('0x81')]+_0x23953d[0x0][_0xa0f0('0x6e')]+_0x23953d[0x0][_0xa0f0('0x6d')])/_0x23953d[0x0]['predictiveIntervalTotalCalls'];_0x57ba2d[_0xa0f0('0x1c5')]=_0x4e690d>0x0?_0x4e690d:0x1;switch(_0x57ba2d['dialPredictiveOptimization']){case _0xa0f0('0x1cb'):var _0x2f54c3=_0x57ba2d[_0xa0f0('0x1c0')]/0x64;return _0x340e65[_0xa0f0('0x1d5')](_0x5d0077,_0x3874a6,_0x3f68c9,_0x4e690d,_0x2f54c3)[_0xa0f0('0xb9')](function(_0x5361c8){return _0x4690e2(_0x5361c8);});case _0xa0f0('0x1d6'):var _0x11f587=_0x57ba2d[_0xa0f0('0x1c0')]/0x64;return _0x340e65['busyFactor'](_0x5d0077,_0x3874a6,_0x3f68c9,_0x4e690d,_0x11f587)[_0xa0f0('0xb9')](function(_0x4c138c){return _0x4690e2(_0x4c138c);});default:return _0x45b0dc(msgResponse(_0xa0f0('0x1d7'),_0xa0f0('0x146'),'Unknown\x20Predictive'));}}else{return _0x45b0dc(msgResponse(_0xa0f0('0x1d7'),_0xa0f0('0x146'),_0xa0f0('0x1d8')));}});};};Dialer['prototype'][_0xa0f0('0x1d9')]=function(_0xaee5fa){var _0x1f5dd9=this;return function(_0x1711d1){return new BPromise(function(_0x3fbd64,_0x238bde){_[_0xa0f0('0x8f')](_0xaee5fa,_0x1711d1[0x0]);if(checkGetDataPredictive(_0x1711d1[0x0])){loggerPredictive['info'](JSON['stringify'](_0x1711d1[0x0]));if(_0xaee5fa[_0xa0f0('0x1ca')]===_0xa0f0('0x1cb')){return _0x1f5dd9['getVoiceQueueRtPauses'](_0xaee5fa['id'])['then'](function(_0x354f64){var _0x5cdbab=_0xaee5fa['loggedIn']-_0x354f64[0x0]['outboundQueuePauses'];var _0x4cbb25=_0xaee5fa['dialPredictiveInterval']*0x3c;var _0x5ae431=_0x1711d1[0x0][_0xa0f0('0x6c')]+_0x1711d1[0x0][_0xa0f0('0x6b')];var _0x5865a5=(_0x1711d1[0x0]['predictiveIntervalAnsweredCalls']+_0x1711d1[0x0][_0xa0f0('0x6e')]+_0x1711d1[0x0][_0xa0f0('0x6d')])/_0x1711d1[0x0][_0xa0f0('0x7f')];var _0x583c3b=_0xaee5fa['dialPredictiveOptimizationPercentage']/0x64;_0xaee5fa[_0xa0f0('0x71')]=_0x354f64[0x0][_0xa0f0('0x1da')]||0x0;_0xaee5fa[_0xa0f0('0x1c5')]=_0x5865a5>0x0?_0x5865a5:0x1;return _0x1f5dd9[_0xa0f0('0x1d5')](_0x5cdbab,_0x4cbb25,_0x5ae431,_0x5865a5,_0x583c3b);})['then'](function(_0x257b7c){return _0x3fbd64(_0x257b7c);})[_0xa0f0('0xb2')](function(_0x47fc27){return _0x238bde(msgResponse(_0xa0f0('0x1db'),_0xa0f0('0x146'),JSON[_0xa0f0('0x4a')](_0x47fc27)));});}if(_0xaee5fa[_0xa0f0('0x1ca')]===_0xa0f0('0x1d6')){return _0x1f5dd9[_0xa0f0('0xc9')](_0xaee5fa['id'])['then'](function(_0x310765){var _0x212713=_0xaee5fa[_0xa0f0('0x53')]-_0x310765[0x0][_0xa0f0('0x1da')];var _0x1af9ac=_0xaee5fa[_0xa0f0('0x1c8')]*0x3c;var _0xd97b59=_0x1711d1[0x0][_0xa0f0('0x6c')]+_0x1711d1[0x0][_0xa0f0('0x6b')];var _0x4bd65b=(_0x1711d1[0x0][_0xa0f0('0x81')]+_0x1711d1[0x0][_0xa0f0('0x6e')]+_0x1711d1[0x0][_0xa0f0('0x6d')])/_0x1711d1[0x0][_0xa0f0('0x7f')];var _0x426551=_0xaee5fa[_0xa0f0('0x1c0')]/0x64;_0xaee5fa[_0xa0f0('0x71')]=_0x310765[0x0]['outboundQueuePauses']||0x0;_0xaee5fa['predictiveIntervalHitRate']=_0x4bd65b>0x0?_0x4bd65b:0x1;return _0x1f5dd9[_0xa0f0('0x1dc')](_0x212713,_0x1af9ac,_0xd97b59,_0x4bd65b,_0x426551);})['then'](function(_0x3b0473){return _0x3fbd64(_0x3b0473);})[_0xa0f0('0xb2')](function(_0x11cc53){return _0x238bde(msgResponse(_0xa0f0('0x1db'),'Failure',JSON['stringify'](_0x11cc53)));});}}else{return _0x238bde(msgResponse('[getDataPredictive]',_0xa0f0('0x146'),_0xa0f0('0x1d8')));}});};};Dialer[_0xa0f0('0x1c')]['startMethodPredictive']=function(_0x2182db){var _0x4d83a6=this;return function(){var _0xd96b=0x0;var _0x42f8b2=Math[_0xa0f0('0x1c4')](_0x2182db[_0xa0f0('0x8b')]*0x3e8);if(_0x42f8b2>0x0){_0x42f8b2=_0x42f8b2<0x64?0x64:_0x42f8b2;loggerPredictive[_0xa0f0('0x7e')](_0x2182db[_0xa0f0('0x3f')],_0xa0f0('0x1dd'),_0x42f8b2,_0xa0f0('0x4b'));_0x2182db['handlePredictive']=setInterval(function(){_0x4d83a6[_0xa0f0('0x90')](_0x2182db);loggerPredictiveCalls[_0xa0f0('0x7e')]('[handlePredictive]',_0xd96b+=0x1);},_0x42f8b2);}else{loggerPredictive[_0xa0f0('0x7e')](_0x2182db['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x1de')]=function(_0x2045a1,_0x7d2316){var _0x13a409=this;return function(_0x2c9e80){if(_[_0xa0f0('0x7c')](_0x2c9e80)){if(_[_0xa0f0('0xe4')](_0x7d2316[_0xa0f0('0xd6')])||!_0x7d2316[_0xa0f0('0x1df')]){if(_0x2045a1[_0xa0f0('0x5c')]===_0xa0f0('0x9')){_0x2045a1[_0xa0f0('0x12f')]=_['isUndefined'](_0x2045a1[_0xa0f0('0x12f')])?!![]:_0x2045a1[_0xa0f0('0x12f')];var _0x58a1e1=uuid['v4']();_0x13a409[_0xa0f0('0xad')][_0x58a1e1]=new Action(_0x2045a1,_0x7d2316,_0x58a1e1);loggerBooked[_0xa0f0('0x7e')](_0xa0f0('0x1e0'),_0x58a1e1,_0xa0f0('0x1e1'),JSON[_0xa0f0('0x4a')](_0x2045a1['queueStatusComplete']),_0xa0f0('0x1e2'),_0x2045a1[_0xa0f0('0x3f')]);if(_0x2045a1['queueStatusComplete']){_0x2045a1['queueStatusComplete']=![];_0x13a409[_0xa0f0('0x2b')][_0x13a409[_0xa0f0('0xad')][_0x58a1e1][_0xa0f0('0xb4')]]=[];ami[_0xa0f0('0xaf')]({'actionid':_0x58a1e1,'action':_0xa0f0('0x1e3'),'queue':_0x2045a1['name']})['catch'](function(){_0x13a409[_0xa0f0('0xb6')](_0x2045a1);_0x13a409[_0xa0f0('0xc2')]({'active':![],'ContactId':_0x13a409[_0xa0f0('0xad')][_0x58a1e1][_0xa0f0('0xd4')],'ListId':_0x13a409[_0xa0f0('0xad')][_0x58a1e1][_0xa0f0('0xd5')],'VoiceQueueId':_0x13a409['actions'][_0x58a1e1][_0xa0f0('0xd7')]||undefined,'CampaignId':_0x13a409[_0xa0f0('0xad')][_0x58a1e1][_0xa0f0('0xd8')]||undefined})[_0xa0f0('0xb2')](loggerCatch(_0xa0f0('0x1e4')));delete _0x13a409[_0xa0f0('0xad')][_0x58a1e1];});}else{loggerBooked['info'](_0xa0f0('0x1e5'),JSON['stringify'](_0x2045a1[_0xa0f0('0x12f')]),'Queue:\x20',_0x2045a1[_0xa0f0('0x3f')]);_0x13a409[_0xa0f0('0xb6')](_0x2045a1);_0x13a409['rescheduleContact']({'active':![],'ContactId':_0x13a409[_0xa0f0('0xad')][_0x58a1e1][_0xa0f0('0xd4')],'ListId':_0x13a409[_0xa0f0('0xad')][_0x58a1e1][_0xa0f0('0xd5')],'VoiceQueueId':_0x13a409[_0xa0f0('0xad')][_0x58a1e1]['VoiceQueueId']||undefined,'CampaignId':_0x13a409[_0xa0f0('0xad')][_0x58a1e1][_0xa0f0('0xd8')]||undefined})['catch'](loggerCatch(_0xa0f0('0x1e4')));delete _0x13a409[_0xa0f0('0xad')][_0x58a1e1];}}else{return _0x13a409[_0xa0f0('0x165')](_0x2045a1,_0x7d2316);}}else{if(getDiff(_0x7d2316['scheduledat'])<_0x2045a1[_0xa0f0('0x1e6')]*0x3c){if(_0x7d2316[_0xa0f0('0x1e7')]&&!_0x7d2316[_0xa0f0('0x1e7')][_0xa0f0('0x1e8')]){_0x13a409[_0xa0f0('0x1f')][_0xa0f0('0x131')](_0x7d2316['id'])[_0xa0f0('0x139')](function(){_0x13a409[_0xa0f0('0xb6')](_0x2045a1);});}else{_0x13a409[_0xa0f0('0xc4')]({'active':![]},_0x7d2316['id'],0x1)['finally'](function(){_0x13a409['updateOriginated'](_0x2045a1);});}}else{_0x2045a1[_0xa0f0('0x68')]+=0x1;_0x13a409[_0xa0f0('0xb6')](_0x2045a1);if(_0x2045a1[_0xa0f0('0x1e9')]){_0x13a409[_0xa0f0('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x7d2316[_0xa0f0('0xd4')],'ListId':_0x7d2316[_0xa0f0('0xd5')],'VoiceQueueId':_0x7d2316[_0xa0f0('0xd7')]||undefined,'CampaignId':_0x7d2316['CampaignId']||undefined})[_0xa0f0('0xb2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x13a409[_0xa0f0('0xcd')](createObjHistory(_0x2045a1,_0x7d2316,'RECALLINQUEUE',0x17,_0xa0f0('0x1ea')))['catch'](loggerCatch(_0xa0f0('0x1eb')));}else{_0x13a409[_0xa0f0('0xe2')](createObjHistory(_0x2045a1,_0x7d2316,_0xa0f0('0x1ec'),0x16,_0xa0f0('0x1ed')),_0xa0f0('0x1ee'),_0xa0f0('0x1ef'));}}}}else{_0x2045a1[_0xa0f0('0x1f0')]+=0x1;_0x13a409['saveInDb'](createObjHistory(_0x2045a1,_0x7d2316,'BLACKLIST',0xd,_0xa0f0('0x1f1')),_0xa0f0('0x1f2'),'[Originate][MoveBlacklist]');throw _0xa0f0('0x1f3');}};};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x15c')]=function(_0xb647d9){var _0x1f9f79=this;var _0x406ace=_0xb647d9['limitCalls']-_0xb647d9[_0xa0f0('0x97')]-_0xb647d9['temp'];emitCampaignSummary(_0xb647d9);if(_0x406ace>0x0){if(_0x406ace>this[_0xa0f0('0x24')]){_0x406ace=this[_0xa0f0('0x24')];}_0xb647d9[_0xa0f0('0x1f4')]+=_0x406ace;this[_0xa0f0('0xc8')](_0xb647d9['id'],_0x406ace,_0xb647d9[_0xa0f0('0x1f5')])[_0xa0f0('0xb9')](function(_0x4f1408){_0xb647d9[_0xa0f0('0x1f4')]-=_0x406ace;_0xb647d9[_0xa0f0('0x1f4')]=_0xb647d9[_0xa0f0('0x1f4')]>0x0?_0xb647d9[_0xa0f0('0x1f4')]:0x0;if(!checkContactEmpty(_0x4f1408)){_0xb647d9['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xa0f0('0x7e')](_0xa0f0('0x1f6')+_0xb647d9[_0xa0f0('0x3f')]);}else{_0xb647d9[_0xa0f0('0x97')]+=_0x4f1408[_0xa0f0('0x134')];_0xb647d9['message']=_0xa0f0('0x1f7');for(var _0x2bb3f5=0x0;_0x2bb3f5<_0x4f1408[_0xa0f0('0x134')];_0x2bb3f5+=0x1){_0xb647d9[_0xa0f0('0x1f8')]+=0x1;if(_[_0xa0f0('0xe4')](_0x4f1408[_0x2bb3f5])||_[_0xa0f0('0xe4')](_0x4f1408[_0x2bb3f5][_0xa0f0('0x168')])||_[_0xa0f0('0xe4')](_0x4f1408[_0x2bb3f5][_0xa0f0('0x168')][_0xa0f0('0x169')])){_0x1f9f79[_0xa0f0('0xd1')](_0xa0f0('0x1f9'),_0xb647d9,_0x4f1408[_0x2bb3f5]);}else{_0x1f9f79[_0xa0f0('0xbe')](_['pick'](_0x4f1408[_0x2bb3f5],[_0xa0f0('0xd8'),'Contact.phone']))['then'](_0x1f9f79[_0xa0f0('0x1de')](_0xb647d9,_0x4f1408[_0x2bb3f5]))[_0xa0f0('0xb2')](_0x1f9f79[_0xa0f0('0xd0')](_0xa0f0('0x1fa'),_0xb647d9));}}}})[_0xa0f0('0xb2')](loggerGetContactDialer('[getContactCampaign2]',_0xb647d9,_0x406ace));}};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x157')]=function(_0x9badd4,_0x5234fd){var _0xa36933=this;var _0x1630ae=[];var _0x9706c8=_0x5234fd>=0x1?_0x5234fd:0x1;if(_0x9badd4['dialMethod']===_0xa0f0('0x9')){_0x9706c8=0x1;}var _0x213d9f=Math[_0xa0f0('0x1c4')](_0x9badd4['available']*_0x9706c8)-_0x9badd4[_0xa0f0('0x97')]-_0x9badd4[_0xa0f0('0x1f4')];emitVoiceQueueSummary(_0x9badd4);if(_0x9badd4['dialLimitQueue']>0x0){var _0x37e9c8=_0x9badd4[_0xa0f0('0x1fb')]-_0x9badd4[_0xa0f0('0x97')]-_0x9badd4[_0xa0f0('0xa2')]-_0x9badd4[_0xa0f0('0x1f4')]-_0x9badd4['pTalking'];if(_0x213d9f>_0x37e9c8){_0x213d9f=_0x37e9c8;}}if(_0x213d9f>0x0){if(_0x9badd4[_0xa0f0('0x5c')]===_0xa0f0('0x9')){_0x213d9f=0x1;}if(_0x213d9f>this[_0xa0f0('0x24')]){_0x213d9f=this['maxNumberOriginate'];}_0x9badd4[_0xa0f0('0x1f4')]+=_0x213d9f;for(var _0x5c879c in this['agents']){if(typeof this['agents'][_0x5c879c]!=='undefined'){if(this['agents'][_0x5c879c][_0xa0f0('0xa8')]===_0xa0f0('0x1fc')&&this['agents'][_0x5c879c]['status']===_0xa0f0('0xe0')){_0x1630ae[_0xa0f0('0x12d')](this[_0xa0f0('0x22')][_0x5c879c]['id']);}}}this[_0xa0f0('0xc6')](_0x9badd4['id'],_0x1630ae,_0x213d9f,_0x9badd4['dialOrderByScheduledAt'])['then'](function(_0x41b317){_0x9badd4[_0xa0f0('0x1f4')]-=_0x213d9f;_0x9badd4['temp']=_0x9badd4[_0xa0f0('0x1f4')]>0x0?_0x9badd4['temp']:0x0;if(!checkContactEmpty(_0x41b317)){_0xa36933[_0xa0f0('0xb8')](_0x9badd4)[_0xa0f0('0xb9')](sendMessageReschedule(_0x9badd4))[_0xa0f0('0xb2')](loggerCatch('[countReScheduled]\x20'));}else{_0x9badd4[_0xa0f0('0x97')]+=_0x41b317[_0xa0f0('0x134')];_0x9badd4['message']=_0x9badd4[_0xa0f0('0x5c')]===_0xa0f0('0x9')?_0xa0f0('0x172'):_0xa0f0('0x1f7');for(var _0x268052=0x0;_0x268052<_0x41b317[_0xa0f0('0x134')];_0x268052+=0x1){if(_[_0xa0f0('0xe4')](_0x41b317[_0x268052])||_[_0xa0f0('0xe4')](_0x41b317[_0x268052][_0xa0f0('0x168')])||_[_0xa0f0('0xe4')](_0x41b317[_0x268052][_0xa0f0('0x168')]['phone'])){_0xa36933['emptyContact'](_0xa0f0('0x1f9'),_0x9badd4,_0x41b317[_0x268052]);}else{_0xa36933[_0xa0f0('0xbb')](_[_0xa0f0('0xd3')](_0x41b317[_0x268052],[_0xa0f0('0xd7'),_0xa0f0('0x1fd')]))[_0xa0f0('0xb9')](_0xa36933[_0xa0f0('0x1de')](_0x9badd4,_0x41b317[_0x268052]))[_0xa0f0('0xb2')](_0xa36933['loggerHandler'](_0xa0f0('0x1f9'),_0x9badd4));}}}})['catch'](loggerGetContactDialer(_0xa0f0('0x1fe'),_0x9badd4,_0x213d9f));}};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x90')]=function(_0x4dba0c){if(_0x4dba0c['dialLimitQueue']>0x0){var _0x4bd2d5=_0x4dba0c[_0xa0f0('0x1fb')]-_0x4dba0c['originated']-_0x4dba0c[_0xa0f0('0xa2')];if(_0x4bd2d5>0x0){this[_0xa0f0('0x1ff')](_0x4dba0c);}else{loggerPredictiveCalls[_0xa0f0('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0xa0f0('0x1ff')](_0x4dba0c);}};Dialer[_0xa0f0('0x1c')]['tryOriginatePredictive']=function(_0x2e9c8e){var _0x3d2639=this;var _0x712702=[];_0x2e9c8e[_0xa0f0('0x97')]+=0x1;for(var _0x2bcc87 in this[_0xa0f0('0x22')]){if(typeof this[_0xa0f0('0x22')][_0x2bcc87]!=='undefined'){if(this[_0xa0f0('0x22')][_0x2bcc87][_0xa0f0('0xa8')]===_0xa0f0('0x1fc')&&this[_0xa0f0('0x22')][_0x2bcc87][_0xa0f0('0xb0')]===_0xa0f0('0xe0')){_0x712702[_0xa0f0('0x12d')](this[_0xa0f0('0x22')][_0x2bcc87]['id']);}}}this[_0xa0f0('0xc6')](_0x2e9c8e['id'],_0x712702,0x1,_0x2e9c8e['dialOrderByScheduledAt'])[_0xa0f0('0xb9')](function(_0x3fecdc){if(!checkContactEmpty(_0x3fecdc)){checkContactLowerLimitOriginate(_0x2e9c8e,0x1,0x0);_0x3d2639[_0xa0f0('0xb8')](_0x2e9c8e)[_0xa0f0('0xb9')](sendMessageReschedule(_0x2e9c8e))['catch'](loggerCatch(_0xa0f0('0xba')));}else{_0x2e9c8e[_0xa0f0('0x44')]=_0xa0f0('0x1f7');if(_['isNil'](_0x3fecdc[0x0])||_[_0xa0f0('0xe4')](_0x3fecdc[0x0][_0xa0f0('0x168')])||_[_0xa0f0('0xe4')](_0x3fecdc[0x0][_0xa0f0('0x168')]['phone'])){_0x3d2639[_0xa0f0('0xd1')](_0xa0f0('0x1f9'),_0x2e9c8e,_0x3fecdc[0x0]);}else{_0x3d2639[_0xa0f0('0xbb')](_[_0xa0f0('0xd3')](_0x3fecdc[0x0],['VoiceQueueId',_0xa0f0('0x1fd')]))[_0xa0f0('0xb9')](_0x3d2639[_0xa0f0('0x1de')](_0x2e9c8e,_0x3fecdc[0x0]))['catch'](_0x3d2639[_0xa0f0('0xd0')](_0xa0f0('0x200'),_0x2e9c8e));}}})['catch'](loggerGetContactDialer(_0xa0f0('0x201'),_0x2e9c8e,0x1));emitVoiceQueueSummary(_0x2e9c8e);};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x1d5')]=function(_0x534e5f,_0x1cbfff,_0x3163f3,_0x4e9468,_0x290808,_0x2138b8){loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x202'));loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x203'),_0x534e5f);loggerPredictive['info'](_0xa0f0('0x204'),_0x1cbfff);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x205'),_0x3163f3);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x206'),_0x4e9468);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x207'),_0x290808);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x8e'));return new BPromise(function(_0x1b6029,_0x2fd1f1){if(_0x534e5f<=0x0||isNaN(_0x534e5f)){return _0x2fd1f1(msgResponse(_0xa0f0('0x208'),_0xa0f0('0x49'),_0xa0f0('0x209')+_0x534e5f));}if(_0x3163f3<=0x0||isNaN(_0x3163f3)){return _0x2fd1f1(msgResponse(_0xa0f0('0x208'),'Error',_0xa0f0('0x20a')+_0x3163f3));}if(_0x4e9468<=0x0||isNaN(_0x4e9468)){return _0x2fd1f1(msgResponse(_0xa0f0('0x208'),_0xa0f0('0x49'),_0xa0f0('0x20b')+_0x4e9468));}if(_0x1cbfff<=0x0||isNaN(_0x1cbfff)){return _0x2fd1f1(msgResponse(_0xa0f0('0x208'),_0xa0f0('0x49'),'interval\x20=\x20'+_0x1cbfff));}if(_0x290808<=0x0||isNaN(_0x290808)){return _0x2fd1f1(msgResponse(_0xa0f0('0x208'),_0xa0f0('0x49'),_0xa0f0('0x20c')+_0x290808));}_0x2138b8=_0x2138b8||0x0;var _0x3a3db5=0x1/_0x3163f3;var _0x487caf=0x0;var _0x25a2c9=0x0;var _0x56767f=0x0;var _0x6a01f0=0x0;for(var _0x27447c=0x0;_0x56767f<_0x290808;_0x27447c+=0x1){_0x25a2c9=_0x27447c/_0x1cbfff;_0x487caf=(_0x4e9468*_0x25a2c9+_0x2138b8)/_0x3a3db5;_0x56767f=erlangb(_0x487caf,_0x534e5f);_0x6a01f0=_0x487caf/_0x534e5f*(0x1-erlangb(_0x487caf,_0x534e5f));}return _0x1b6029({'erlangCalls':_0x27447c,'erlangCallToSecond':_0x1cbfff/_0x27447c,'erlangAbandonmentRate':_0x56767f,'erlangBusyFactor':_0x6a01f0});});};Dialer[_0xa0f0('0x1c')][_0xa0f0('0x1dc')]=function(_0x2dabe5,_0x17a95e,_0x3f59df,_0x1504ad,_0x21e585,_0x2bd541){loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x20d'));loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x203'),_0x2dabe5);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x204'),_0x17a95e);loggerPredictive['info'](_0xa0f0('0x205'),_0x3f59df);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x206'),_0x1504ad);loggerPredictive[_0xa0f0('0x7e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21e585);loggerPredictive[_0xa0f0('0x7e')](_0xa0f0('0x8e'));return new BPromise(function(_0x56d025,_0x54fb6d){if(_0x2dabe5<=0x0||isNaN(_0x2dabe5)){return _0x54fb6d(msgResponse(_0xa0f0('0x20e'),_0xa0f0('0x49'),_0xa0f0('0x209')+_0x2dabe5));}if(_0x3f59df<=0x0||isNaN(_0x3f59df)){return _0x54fb6d(msgResponse('[busyFactor]',_0xa0f0('0x49'),_0xa0f0('0x20a')+_0x3f59df));}if(_0x1504ad<=0x0||isNaN(_0x1504ad)){return _0x54fb6d(msgResponse(_0xa0f0('0x20e'),_0xa0f0('0x49'),_0xa0f0('0x20b')+_0x1504ad));}if(_0x17a95e<=0x0||isNaN(_0x17a95e)){return _0x54fb6d(msgResponse(_0xa0f0('0x20e'),_0xa0f0('0x49'),_0xa0f0('0x20f')+_0x17a95e));}if(_0x21e585<=0x0||isNaN(_0x21e585)){return _0x54fb6d(msgResponse('[busyFactor]',_0xa0f0('0x49'),_0xa0f0('0x210')+_0x21e585));}_0x2bd541=_0x2bd541||0x0;var _0x24c296=0x1/_0x3f59df;var _0x30d152=0x0;var _0x28c0c4=0x0;var _0x582945=0x0;var _0x505cb7=0x0;for(var _0x557625=0x0;_0x505cb7<_0x21e585;_0x557625+=0x1){_0x28c0c4=_0x557625/_0x17a95e;_0x30d152=(_0x1504ad*_0x28c0c4+_0x2bd541)/_0x24c296;_0x582945=erlangb(_0x30d152,_0x2dabe5);_0x505cb7=_0x30d152/_0x2dabe5*(0x1-erlangb(_0x30d152,_0x2dabe5));}return _0x56d025({'erlangCalls':_0x557625,'erlangCallToSecond':_0x17a95e/_0x557625,'erlangAbandonmentRate':_0x582945,'erlangBusyFactor':_0x505cb7});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index c145cd2..3f31887 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 _0x80e3=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','diff','seconds','scheduledat','type','campaigntype','outbound','queue'];(function(_0x309c4b,_0x5ec084){var _0x1430d7=function(_0x46e349){while(--_0x46e349){_0x309c4b['push'](_0x309c4b['shift']());}};_0x1430d7(++_0x5ec084);}(_0x80e3,0x182));var _0x380e=function(_0x406b1f,_0x15d0bd){_0x406b1f=_0x406b1f-0x0;var _0x4c1b28=_0x80e3[_0x406b1f];return _0x4c1b28;};'use strict';var util=require(_0x380e('0x0'));var _=require(_0x380e('0x1'));var moment=require(_0x380e('0x2'));function getSeconds(_0xcf6506,_0x95c331){var _0x246f62=moment(_0xcf6506)['milliseconds'](0x0);var _0x45609b=moment(_0x95c331)['milliseconds'](0x0);return _0x246f62[_0x380e('0x3')](_0x45609b,_0x380e('0x4'));}function QueueCallerAbandon(_0x5f10fe,_0xac0b76){this[_0x380e('0x5')]=_0x5f10fe['scheduledat'];this[_0x380e('0x6')]=_0x5f10fe['type'];this[_0x380e('0x7')]=_0x5f10fe[_0x380e('0x6')]===_0x380e('0x8')?_0x380e('0x9'):_0x5f10fe[_0x380e('0x6')];this[_0x380e('0xa')]=_0x5f10fe['countbusyretry'];this[_0x380e('0xb')]=_0x5f10fe['countcongestionretry'];this[_0x380e('0xc')]=_0x5f10fe[_0x380e('0xc')];this[_0x380e('0xd')]=_0x5f10fe[_0x380e('0xa')]+_0x5f10fe['countcongestionretry']+_0x5f10fe[_0x380e('0xc')]+_0x5f10fe['countnosuchnumberretry']+_0x5f10fe[_0x380e('0xe')]+_0x5f10fe[_0x380e('0xf')]+_0x5f10fe[_0x380e('0x10')]+_0x5f10fe[_0x380e('0x11')];this[_0x380e('0x12')]=_0x5f10fe[_0x380e('0x12')];this['countdropretry']=_0x5f10fe[_0x380e('0xe')];this[_0x380e('0xf')]=_0x5f10fe[_0x380e('0xf')];this[_0x380e('0x10')]=_0x5f10fe[_0x380e('0x10')];this[_0x380e('0x11')]=_0x5f10fe['countagentrejectretry'];this[_0x380e('0x13')]=_0xac0b76['uniqueid'];this[_0x380e('0x14')]=_0x5f10fe[_0x380e('0x15')];this[_0x380e('0x16')]=_0x5f10fe[_0x380e('0x17')];this[_0x380e('0x18')]=_0x5f10fe[_0x380e('0x18')];this[_0x380e('0x19')]=_0x5f10fe[_0x380e('0x19')];this['droptime']=_0x5f10fe[_0x380e('0x1a')];this[_0x380e('0x1b')]=this[_0x380e('0x1a')];this[_0x380e('0x1c')]=getSeconds(_0x5f10fe['responsetime'],_0x5f10fe[_0x380e('0x18')]);this[_0x380e('0x1d')]=getSeconds(this[_0x380e('0x1a')],_0x5f10fe[_0x380e('0x19')]);this['talktime']=0x0;this[_0x380e('0x9')]=_0xac0b76['queue'];this[_0x380e('0x1e')]=_0xac0b76[_0x380e('0x1f')];this[_0x380e('0x20')]=_0xac0b76['reason'];this[_0x380e('0x21')]=_0x5f10fe[_0x380e('0x21')];this['callbackuniqueid']=_0x5f10fe[_0x380e('0x22')];this[_0x380e('0x23')]=_0x5f10fe[_0x380e('0x23')];this[_0x380e('0x24')]=_0x5f10fe[_0x380e('0x24')];this[_0x380e('0x25')]=_0x5f10fe[_0x380e('0x25')];this['ListId']=_0x5f10fe[_0x380e('0x26')];this[_0x380e('0x27')]=_0x5f10fe[_0x380e('0x27')];this[_0x380e('0x28')]=_0x5f10fe[_0x380e('0x28')];this['CampaignId']=_0x5f10fe['CampaignId'];this[_0x380e('0x29')]=_0x5f10fe[_0x380e('0x29')]||'';this[_0x380e('0x2a')]=_0x5f10fe[_0x380e('0x2a')]||'';}module[_0x380e('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x4d41=['calleridnum','number','starttime','droptime','endtime','ringtime','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name'];(function(_0x4b9806,_0x1517c0){var _0x12f4d4=function(_0x2f0984){while(--_0x2f0984){_0x4b9806['push'](_0x4b9806['shift']());}};_0x12f4d4(++_0x1517c0);}(_0x4d41,0x187));var _0x14d4=function(_0x506aef,_0xb1161c){_0x506aef=_0x506aef-0x0;var _0x579eea=_0x4d41[_0x506aef];return _0x579eea;};'use strict';var util=require(_0x14d4('0x0'));var _=require(_0x14d4('0x1'));var moment=require('moment');function getSeconds(_0x190165,_0x34c8e3){var _0x4af964=moment(_0x190165)[_0x14d4('0x2')](0x0);var _0x3a0b0a=moment(_0x34c8e3)[_0x14d4('0x2')](0x0);return _0x4af964['diff'](_0x3a0b0a,_0x14d4('0x3'));}function QueueCallerAbandon(_0x335308,_0x5e16ce){this[_0x14d4('0x4')]=_0x335308[_0x14d4('0x4')];this['type']=_0x335308[_0x14d4('0x5')];this[_0x14d4('0x6')]=_0x335308[_0x14d4('0x5')]==='outbound'?_0x14d4('0x7'):_0x335308[_0x14d4('0x5')];this['countbusyretry']=_0x335308[_0x14d4('0x8')];this['countcongestionretry']=_0x335308[_0x14d4('0x9')];this[_0x14d4('0xa')]=_0x335308[_0x14d4('0xa')];this['countglobal']=_0x335308[_0x14d4('0x8')]+_0x335308[_0x14d4('0x9')]+_0x335308['countnoanswerretry']+_0x335308[_0x14d4('0xb')]+_0x335308[_0x14d4('0xc')]+_0x335308['countabandonedretry']+_0x335308[_0x14d4('0xd')]+_0x335308[_0x14d4('0xe')];this[_0x14d4('0xb')]=_0x335308[_0x14d4('0xb')];this[_0x14d4('0xc')]=_0x335308[_0x14d4('0xc')];this[_0x14d4('0xf')]=_0x335308[_0x14d4('0xf')];this[_0x14d4('0xd')]=_0x335308[_0x14d4('0xd')];this[_0x14d4('0xe')]=_0x335308[_0x14d4('0xe')];this[_0x14d4('0x10')]=_0x5e16ce[_0x14d4('0x10')];this[_0x14d4('0x11')]=_0x335308[_0x14d4('0x12')];this[_0x14d4('0x13')]=_0x335308[_0x14d4('0x14')];this[_0x14d4('0x15')]=_0x335308['starttime'];this['responsetime']=_0x335308['responsetime'];this['droptime']=_0x335308[_0x14d4('0x16')];this[_0x14d4('0x17')]=this[_0x14d4('0x16')];this[_0x14d4('0x18')]=getSeconds(_0x335308[_0x14d4('0x19')],_0x335308['starttime']);this[_0x14d4('0x1a')]=getSeconds(this['droptime'],_0x335308[_0x14d4('0x19')]);this[_0x14d4('0x1b')]=0x0;this[_0x14d4('0x7')]=_0x5e16ce['queue'];this[_0x14d4('0x1c')]=_0x5e16ce['connectedlinename'];this[_0x14d4('0x1d')]=_0x5e16ce[_0x14d4('0x1d')];this[_0x14d4('0x1e')]=_0x335308[_0x14d4('0x1e')];this[_0x14d4('0x1f')]=_0x335308[_0x14d4('0x1f')];this[_0x14d4('0x20')]=_0x335308[_0x14d4('0x20')];this[_0x14d4('0x21')]=_0x335308[_0x14d4('0x21')];this[_0x14d4('0x22')]=_0x335308[_0x14d4('0x22')];this[_0x14d4('0x23')]=_0x335308[_0x14d4('0x23')];this[_0x14d4('0x24')]=_0x335308['UserId'];this[_0x14d4('0x25')]=_0x335308['VoiceQueueId'];this[_0x14d4('0x26')]=_0x335308[_0x14d4('0x26')];this['originatecalleridnum']=_0x335308[_0x14d4('0x27')]||'';this[_0x14d4('0x28')]=_0x335308['originatecalleridname']||'';}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 ef0fd65..732c6d3 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 _0x9ea1=['fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','%s/%s/%s','tech','Trunk'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9ea1,0xbc));var _0x19ea=function(_0x4f60b3,_0x5a5209){_0x4f60b3=_0x4f60b3-0x0;var _0x1b203c=_0x9ea1[_0x4f60b3];return _0x1b203c;};'use strict';var util=require(_0x19ea('0x0'));var _=require(_0x19ea('0x1'));var moment=require(_0x19ea('0x2'));function Action(_0x108138,_0xb7074c,_0x19cf62){this[_0x19ea('0x3')]=_0x108138||undefined;this['channel']=util['format'](_0x19ea('0x4'),_0xb7074c[_0x19ea('0x5')],_0xb7074c[_0x19ea('0x6')]['name'],_0x19cf62[_0x19ea('0x7')]);this[_0x19ea('0x8')]=_0xb7074c['localstationid'];this['headerinfo']=_0xb7074c[_0x19ea('0x9')];this[_0x19ea('0xa')]=_0x19cf62[_0x19ea('0xa')];this[_0x19ea('0xb')]=_0x19cf62[_0x19ea('0xb')];}module[_0x19ea('0xc')]=Action; \ No newline at end of file +var _0x0e41=['util','moment','uniqueid','channel','format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x4221b7,_0xc953cc){var _0x18ff41=function(_0x368f1b){while(--_0x368f1b){_0x4221b7['push'](_0x4221b7['shift']());}};_0x18ff41(++_0xc953cc);}(_0x0e41,0x142));var _0x10e4=function(_0x5a7aec,_0x18dc8a){_0x5a7aec=_0x5a7aec-0x0;var _0x35a4bf=_0x0e41[_0x5a7aec];return _0x35a4bf;};'use strict';var util=require(_0x10e4('0x0'));var _=require('lodash');var moment=require(_0x10e4('0x1'));function Action(_0x15c791,_0x3d1717,_0x5ec3bd){this[_0x10e4('0x2')]=_0x15c791||undefined;this[_0x10e4('0x3')]=util[_0x10e4('0x4')](_0x10e4('0x5'),_0x3d1717['tech'],_0x3d1717[_0x10e4('0x6')][_0x10e4('0x7')],_0x5ec3bd[_0x10e4('0x8')]);this['localstationid']=_0x3d1717[_0x10e4('0x9')];this[_0x10e4('0xa')]=_0x3d1717['headerinfo'];this[_0x10e4('0xb')]=_0x5ec3bd[_0x10e4('0xb')];this[_0x10e4('0xc')]=_0x5ec3bd[_0x10e4('0xc')];}module[_0x10e4('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 4fe6287..f9aafdf 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 _0x5aaa=['unmonitored','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','exports','util','lodash','moment','path','./util/gs','../../../config/logger','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s'];(function(_0x30ca74,_0x32563){var _0x72aeb4=function(_0x22b859){while(--_0x22b859){_0x30ca74['push'](_0x30ca74['shift']());}};_0x72aeb4(++_0x32563);}(_0x5aaa,0xeb));var _0xa5aa=function(_0x5ddea3,_0x539a5a){_0x5ddea3=_0x5ddea3-0x0;var _0x206407=_0x5aaa[_0x5ddea3];return _0x206407;};'use strict';var util=require(_0xa5aa('0x0'));var _=require(_0xa5aa('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xa5aa('0x2'));var path=require(_0xa5aa('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xa5aa('0x4'));var logger=require(_0xa5aa('0x5'))('fax');var ami=require(_0xa5aa('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xa5aa('0x7'));var ut=require(_0xa5aa('0x8'));var Action=require('./action');var faxAccount=require(_0xa5aa('0x9'));var attachment=require(_0xa5aa('0xa'));var faxMessage=require(_0xa5aa('0xb'));function Fax(_0x16e8bf){this['channels']={};this['faxAccounts']=_0x16e8bf[_0xa5aa('0xc')];this['trunks']=_0x16e8bf[_0xa5aa('0xd')];this[_0xa5aa('0xe')]={};ami['on'](_0xa5aa('0xf'),this[_0xa5aa('0x10')][_0xa5aa('0x11')](this));ami['on'](_0xa5aa('0x12'),this[_0xa5aa('0x13')][_0xa5aa('0x11')](this));ami['on'](_0xa5aa('0x14'),this[_0xa5aa('0x15')]['bind'](this));ami['on'](_0xa5aa('0x16'),this[_0xa5aa('0x17')]['bind'](this));ami['on'](_0xa5aa('0x18'),this['syncFaxStatus'][_0xa5aa('0x11')](this));ami['on'](_0xa5aa('0x19'),this['syncReceiveFax'][_0xa5aa('0x11')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xa5aa('0x1a'),this[_0xa5aa('0x1b')]['bind'](this));}Fax[_0xa5aa('0x1c')][_0xa5aa('0x10')]=function(_0x47fa3b){if(_0x47fa3b[_0xa5aa('0x1d')]===_0xa5aa('0x1e')){for(var _0x13d868 in this[_0xa5aa('0xc')]){if(this[_0xa5aa('0xc')][_0xa5aa('0x1f')](_0x13d868)){if(_0x47fa3b['exten']===this['faxAccounts'][_0x13d868]['localstationid']){this['channels'][_0x47fa3b[_0xa5aa('0x20')]]={};this[_0xa5aa('0x21')][_0x47fa3b[_0xa5aa('0x20')]]['channel']=_0x47fa3b[_0xa5aa('0x22')];this['channels'][_0x47fa3b[_0xa5aa('0x20')]]['id']=this[_0xa5aa('0xc')][_0x13d868]['id'];this['channels'][_0x47fa3b[_0xa5aa('0x20')]][_0xa5aa('0x23')]=this[_0xa5aa('0xc')][_0x13d868][_0xa5aa('0x23')];logger[_0xa5aa('0x24')](_0x47fa3b[_0xa5aa('0x20')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x47fa3b[_0xa5aa('0x20')]]){this[_0xa5aa('0x21')][_0x47fa3b[_0xa5aa('0x20')]]={};this['channels'][_0x47fa3b[_0xa5aa('0x20')]][_0xa5aa('0x22')]=_0x47fa3b['channel'];logger['info'](_0x47fa3b['uniqueid'],_0xa5aa('0x25'));}};Fax[_0xa5aa('0x1c')]['syncVarSet']=function(_0x2a724d){if(this[_0xa5aa('0x21')][_0x2a724d[_0xa5aa('0x20')]]){for(var _0x340108 in _0x2a724d[_0xa5aa('0x26')]){if(_0x2a724d['variable']['hasOwnProperty'](_0x340108)){this[_0xa5aa('0x21')][_0x2a724d[_0xa5aa('0x20')]][_0x340108]=_0x2a724d[_0xa5aa('0x27')];}}}};Fax[_0xa5aa('0x1c')][_0xa5aa('0x15')]=function(_0x2bb0d2){if(this['channels'][_0x2bb0d2[_0xa5aa('0x20')]]){this[_0xa5aa('0x21')][_0x2bb0d2[_0xa5aa('0x20')]][_0xa5aa('0x28')]=_0x2bb0d2[_0xa5aa('0x28')];this[_0xa5aa('0x21')][_0x2bb0d2['uniqueid']]['channelstatedesc']=_0x2bb0d2[_0xa5aa('0x29')];}};Fax[_0xa5aa('0x1c')][_0xa5aa('0x17')]=function(_0x5aac22){if(this[_0xa5aa('0x21')][_0x5aac22[_0xa5aa('0x20')]]){for(var _0x269175 in _0x5aac22[_0xa5aa('0x26')]){if(_0x5aac22[_0xa5aa('0x26')][_0xa5aa('0x1f')](_0x269175)){this['channels'][_0x5aac22[_0xa5aa('0x20')]][_0x269175]=_0x5aac22[_0xa5aa('0x27')];}}}};Fax[_0xa5aa('0x1c')][_0xa5aa('0x2a')]=function(_0x3bc299){if(this[_0xa5aa('0x21')][_0x3bc299[_0xa5aa('0x20')]]){this[_0xa5aa('0x21')][_0x3bc299[_0xa5aa('0x20')]][_0xa5aa('0x2b')]=_0x3bc299[_0xa5aa('0x2b')];this['channels'][_0x3bc299['uniqueid']][_0xa5aa('0x2c')]=_0x3bc299[_0xa5aa('0x2c')];this[_0xa5aa('0x21')][_0x3bc299['uniqueid']]['localstationid']=_0x3bc299[_0xa5aa('0x2d')];this[_0xa5aa('0x21')][_0x3bc299[_0xa5aa('0x20')]][_0xa5aa('0x2e')]=_0x3bc299[_0xa5aa('0x2e')];logger['info'](_0x3bc299[_0xa5aa('0x20')],_0xa5aa('0x2f'));}};Fax[_0xa5aa('0x1c')][_0xa5aa('0x30')]=function(_0x4e771b){var _0x4d883a=this;if(this['channels'][_0x4e771b[_0xa5aa('0x20')]]){var _0x245088=this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]]['id'];this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]][_0xa5aa('0x31')]=_0x4e771b[_0xa5aa('0x31')];this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]][_0xa5aa('0x32')]=_0x4e771b[_0xa5aa('0x32')];this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]][_0xa5aa('0x2d')]=_0x4e771b[_0xa5aa('0x2d')];this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]][_0xa5aa('0x33')]=_0x4e771b[_0xa5aa('0x33')];this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]]['transferrate']=_0x4e771b[_0xa5aa('0x34')];this['channels'][_0x4e771b[_0xa5aa('0x20')]][_0xa5aa('0x2e')]=_0x4e771b[_0xa5aa('0x2e')];this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]][_0xa5aa('0x35')]=_0x4e771b['calleridnum'];if(this[_0xa5aa('0x21')][_0x4e771b[_0xa5aa('0x20')]][_0xa5aa('0x32')]>0x0){tiff2pdf(_0x4e771b[_0xa5aa('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x17a5ed){logger[_0xa5aa('0x24')](_0x4e771b[_0xa5aa('0x20')],_0xa5aa('0x36'),_0x17a5ed['message']);attachment['create']({'name':path[_0xa5aa('0x37')](_0x4e771b[_0xa5aa('0x2e')])[_0xa5aa('0x23')],'basename':path[_0xa5aa('0x37')](_0x4e771b[_0xa5aa('0x2e')])[_0xa5aa('0x23')]+_0xa5aa('0x38'),'type':_0xa5aa('0x39')})[_0xa5aa('0x3a')](function(_0x76a68e){faxAccount[_0xa5aa('0x3b')](_0x245088,{'from':_0x4e771b['calleridnum'],'mapKey':'fax','body':path[_0xa5aa('0x37')](_0x4e771b[_0xa5aa('0x2e')])[_0xa5aa('0x23')]+_0xa5aa('0x38'),'AttachmentId':_0x76a68e['id']})[_0xa5aa('0x3c')](function(_0x38dd7f){logger[_0xa5aa('0x3d')](_0x4e771b[_0xa5aa('0x20')],'\x20notify\x20',JSON[_0xa5aa('0x3e')](_0x38dd7f));});})[_0xa5aa('0x3c')](function(_0x14fe28){logger[_0xa5aa('0x3d')](_0x4e771b[_0xa5aa('0x20')],_0xa5aa('0x3f'),JSON[_0xa5aa('0x3e')](_0x14fe28));});});}logger[_0xa5aa('0x24')](_0x4e771b[_0xa5aa('0x20')],'\x20receiveFax\x20');}};Fax[_0xa5aa('0x1c')][_0xa5aa('0x1b')]=function(_0x5ec3ee){if(this[_0xa5aa('0xe')][_0x5ec3ee[_0xa5aa('0x20')]]){_[_0xa5aa('0x40')](this['channels'][_0x5ec3ee['uniqueid']],_['pick'](_0x5ec3ee,[_0xa5aa('0x41'),_0xa5aa('0x42')]));}};function updateStatus(_0x2fab53){if(_0x2fab53[_0xa5aa('0x43')]){faxMessage[_0xa5aa('0x44')](_0x2fab53[_0xa5aa('0x43')],{'failMessage':_0xa5aa('0x45')})['then'](function(_0x38198f){ut[_0xa5aa('0x46')](_0xa5aa('0x47'),_0x38198f);})[_0xa5aa('0x3c')](function(_0x39e93d){ut[_0xa5aa('0x46')](_0xa5aa('0x48'),_0x39e93d);});}else{ut[_0xa5aa('0x46')](_0xa5aa('0x49'));}}Fax[_0xa5aa('0x1c')][_0xa5aa('0x4a')]=function(_0x182de3,_0x184bef,_0x52a889){var _0xabd290=this;var _0x138dd9={};if(_0x184bef){_0x138dd9={'read':_0x184bef};}else{_0x138dd9={'failMessage':_0x52a889};}if(this[_0xa5aa('0xe')][_0x182de3][_0xa5aa('0x43')]){faxMessage[_0xa5aa('0x44')](this['actions'][_0x182de3][_0xa5aa('0x43')],_0x138dd9)[_0xa5aa('0x3a')](function(_0x33db47){ut[_0xa5aa('0x46')](_0xa5aa('0x4b'),_0x33db47);})[_0xa5aa('0x3c')](function(_0x81fb43){ut[_0xa5aa('0x46')](_0xa5aa('0x4c'),_0x81fb43);})[_0xa5aa('0x4d')](function(){delete _0xabd290[_0xa5aa('0x21')][_0x182de3];delete _0xabd290[_0xa5aa('0xe')][_0x182de3];});}else{ut[_0xa5aa('0x46')](_0xa5aa('0x4e'));delete this[_0xa5aa('0x21')][_0x182de3];delete this['actions'][_0x182de3];}};Fax[_0xa5aa('0x1c')]['syncHangup']=function(_0x263ce9){var _0x167e7e=this;if(this[_0xa5aa('0x21')][_0x263ce9[_0xa5aa('0x20')]]){if(this[_0xa5aa('0xe')][_0x263ce9[_0xa5aa('0x20')]]){this['channels'][_0x263ce9[_0xa5aa('0x20')]]['id']=this[_0xa5aa('0xe')][_0x263ce9[_0xa5aa('0x20')]]['id'];this['channels'][_0x263ce9['uniqueid']]['name']=this[_0xa5aa('0xe')][_0x263ce9[_0xa5aa('0x20')]][_0xa5aa('0x23')];}logger[_0xa5aa('0x24')](_0x263ce9[_0xa5aa('0x20')],this[_0xa5aa('0xe')][_0x263ce9[_0xa5aa('0x20')]]?_0xa5aa('0x4f'):_0xa5aa('0x50'),JSON[_0xa5aa('0x3e')](this[_0xa5aa('0x21')][_0x263ce9['uniqueid']]));if(this[_0xa5aa('0xe')][_0x263ce9[_0xa5aa('0x20')]]){if(this[_0xa5aa('0x21')][_0x263ce9['uniqueid']][_0xa5aa('0x51')]>0x0&&this['channels'][_0x263ce9[_0xa5aa('0x20')]][_0xa5aa('0x18')]==='SUCCESS'){this['updateStatus'](_0x263ce9[_0xa5aa('0x20')],!![]);}else{this[_0xa5aa('0x4a')](_0x263ce9[_0xa5aa('0x20')],![],this[_0xa5aa('0x21')][_0x263ce9[_0xa5aa('0x20')]][_0xa5aa('0x52')]?_0xa5aa('0x53')+this[_0xa5aa('0x21')][_0x263ce9['uniqueid']][_0xa5aa('0x52')]:_0xa5aa('0x54'));}}}};Fax[_0xa5aa('0x1c')][_0xa5aa('0x55')]=function(_0x2fe70b){var _0x28d393=this;return new BPromise(function(_0x3922b3,_0xa9010a){_0x28d393['execOriginate'](_0x2fe70b,_0x28d393[_0xa5aa('0xc')][_0x2fe70b[_0xa5aa('0x56')]])[_0xa5aa('0x3a')](function(_0x327418){ut['logger'](_0xa5aa('0x57'),_0x327418);_0x3922b3(ut[_0xa5aa('0x58')](_0xa5aa('0x59')));})[_0xa5aa('0x3c')](function(_0x10b332){ut[_0xa5aa('0x46')]('[Fax][execOriginate][failure]',_0x10b332);updateStatus(_0x2fe70b);_0xa9010a(ut[_0xa5aa('0x58')]('Fax\x20failed'));});});};Fax[_0xa5aa('0x1c')]['checkAfterSend']=function(_0x210048){var _0xd20818=this;return new BPromise(function(_0x425392,_0x23e8e0){var _0x39402f=_0xd20818['checkTrunk'](_0xd20818[_0xa5aa('0xc')][_0x210048[_0xa5aa('0x56')]][_0xa5aa('0x5a')],_0x210048);if(_0x39402f[_0xa5aa('0x5b')]){_0x425392(ut['message'](_0xa5aa('0x5c')));}else{_0x23e8e0(ut[_0xa5aa('0x58')](_0x39402f[_0xa5aa('0x58')]));}});};function originate(_0x2c8349,_0x1877c7,_0x1cb695){return new BPromise(function(_0x1de21a,_0x5527a4){if(_0x1cb695){var _0x3bcd4d=util[_0xa5aa('0x5d')](_0xa5aa('0x5e'),path[_0xa5aa('0x37')](_0x2c8349['path'])['name'],_0x2c8349[_0xa5aa('0x3')]);gs[_0xa5aa('0x5f')](_0x3bcd4d)['then'](function(){_0x2c8349[_0xa5aa('0x3')]=util[_0xa5aa('0x5d')]('%s/%s.tif',path['parse'](_0x2c8349[_0xa5aa('0x3')])[_0xa5aa('0x60')],path[_0xa5aa('0x37')](_0x2c8349[_0xa5aa('0x3')])[_0xa5aa('0x23')]);_0x1877c7[_0xa5aa('0x61')]=_0x2c8349[_0xa5aa('0x3')];ut['logger'](_0xa5aa('0x62'),'');ami['Action'](ut[_0xa5aa('0x63')](_0x2c8349,_0x1877c7))['then'](function(_0x29be0f){_0x1de21a(_0x29be0f);})['catch'](function(_0xc4021){_0x5527a4(_0xc4021);});})['catch'](function(_0x553776){_0x5527a4(_0x553776);});}else{ami[_0xa5aa('0x64')](ut[_0xa5aa('0x63')](_0x2c8349,_0x1877c7))[_0xa5aa('0x3a')](function(_0x10d24a){_0x1de21a(_0x10d24a);})[_0xa5aa('0x3c')](function(_0x4a308c){_0x5527a4(_0x4a308c);});}});}Fax['prototype'][_0xa5aa('0x65')]=function(_0x8851e1,_0x4dbdff){var _0x3de627=this;return new BPromise(function(_0x38143c,_0x296077){var _0x5c7ee7=uuid['v4']();var _0x4e1a06=ut[_0xa5aa('0x66')](_0x8851e1,_0x4dbdff);_0x3de627[_0xa5aa('0xe')][_0x5c7ee7]=new Action(_0x5c7ee7,_0x4dbdff,_0x8851e1);var _0x423857=_0x3de627[_0xa5aa('0xe')][_0x5c7ee7];if(path[_0xa5aa('0x37')](_0x8851e1[_0xa5aa('0x3')])['ext']===_0xa5aa('0x38')){originate(_0x423857,_0x4e1a06,!![])[_0xa5aa('0x3a')](function(_0x40d2cb){_0x38143c(_0x40d2cb);})[_0xa5aa('0x3c')](function(_0x1c578){_0x296077(_0x1c578);});}else{originate(_0x423857,_0x4e1a06,![])[_0xa5aa('0x3a')](function(_0x5e1a24){_0x38143c(_0x5e1a24);})[_0xa5aa('0x3c')](function(_0x1c680c){_0x296077(_0x1c680c);});}});};Fax[_0xa5aa('0x1c')][_0xa5aa('0x67')]=function(_0x4da591){return!_[_0xa5aa('0x68')](_0x4da591)&&!_[_0xa5aa('0x68')](_0x4da591['name'])&&!_[_0xa5aa('0x68')](_0x4da591[_0xa5aa('0x69')])&&_0x4da591[_0xa5aa('0x69')]&&!_[_0xa5aa('0x68')](this[_0xa5aa('0xd')][util[_0xa5aa('0x5d')](_0xa5aa('0x6a'),_0x4da591[_0xa5aa('0x23')])])&&!_['isNil'](this['trunks'][util[_0xa5aa('0x5d')](_0xa5aa('0x6a'),_0x4da591[_0xa5aa('0x23')])]['status'])&&(this[_0xa5aa('0xd')][util[_0xa5aa('0x5d')](_0xa5aa('0x6a'),_0x4da591[_0xa5aa('0x23')])][_0xa5aa('0x2c')]==='reachable'||this[_0xa5aa('0xd')][util[_0xa5aa('0x5d')](_0xa5aa('0x6a'),_0x4da591[_0xa5aa('0x23')])][_0xa5aa('0x2c')]===_0xa5aa('0x6b'));};Fax[_0xa5aa('0x1c')]['checkTrunk']=function(_0x410e35,_0x453db1){if(!this[_0xa5aa('0x67')](_0x410e35)){ut[_0xa5aa('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xa5aa('0x68')](_0x410e35)?'':_0x410e35[_0xa5aa('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xa5aa('0x6c')};}if(_[_0xa5aa('0x68')](_0x453db1[_0xa5aa('0x6d')])){ut[_0xa5aa('0x46')](_0xa5aa('0x6e'),JSON['stringify'](_0x453db1));return{'isValid':![],'message':_0xa5aa('0x6f')};}if(_[_0xa5aa('0x68')](_0x453db1[_0xa5aa('0x3')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0xa5aa('0x3e')](_0x453db1));return{'isValid':![],'message':_0xa5aa('0x70')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xa5aa('0x71')]=Fax; \ No newline at end of file +var _0xc7da=['ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','stringify','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','localstationid','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','calleridnum','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','checkAfterSend','checkTrunk','FaxAccountId','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'];(function(_0x4ba962,_0x1a8af5){var _0x22bed7=function(_0x10d80c){while(--_0x10d80c){_0x4ba962['push'](_0x4ba962['shift']());}};_0x22bed7(++_0x1a8af5);}(_0xc7da,0x81));var _0xac7d=function(_0x2c58b6,_0xb79a5c){_0x2c58b6=_0x2c58b6-0x0;var _0xf7ef54=_0xc7da[_0x2c58b6];return _0xf7ef54;};'use strict';var util=require(_0xac7d('0x0'));var _=require(_0xac7d('0x1'));var BPromise=require(_0xac7d('0x2'));var uuid=require('uuid');var moment=require(_0xac7d('0x3'));var path=require(_0xac7d('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))(_0xac7d('0x7'));var ami=require(_0xac7d('0x8'));var rpcDb=require(_0xac7d('0x9'));var Channel=require(_0xac7d('0xa'));var ut=require(_0xac7d('0xb'));var Action=require(_0xac7d('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xac7d('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x53ff09){this['channels']={};this[_0xac7d('0xe')]=_0x53ff09[_0xac7d('0xe')];this['trunks']=_0x53ff09[_0xac7d('0xf')];this[_0xac7d('0x10')]={};ami['on'](_0xac7d('0x11'),this[_0xac7d('0x12')][_0xac7d('0x13')](this));ami['on']('varset',this[_0xac7d('0x14')][_0xac7d('0x13')](this));ami['on'](_0xac7d('0x15'),this[_0xac7d('0x16')][_0xac7d('0x13')](this));ami['on'](_0xac7d('0x17'),this[_0xac7d('0x18')]['bind'](this));ami['on'](_0xac7d('0x19'),this[_0xac7d('0x1a')][_0xac7d('0x13')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xac7d('0x13')](this));ami['on'](_0xac7d('0x1b'),this[_0xac7d('0x1c')]['bind'](this));ami['on'](_0xac7d('0x1d'),this[_0xac7d('0x1e')]['bind'](this));}Fax[_0xac7d('0x1f')][_0xac7d('0x12')]=function(_0x4e3558){if(_0x4e3558[_0xac7d('0x20')]===_0xac7d('0x21')){for(var _0x155349 in this[_0xac7d('0xe')]){if(this[_0xac7d('0xe')]['hasOwnProperty'](_0x155349)){if(_0x4e3558[_0xac7d('0x22')]===this[_0xac7d('0xe')][_0x155349]['localstationid']){this[_0xac7d('0x23')][_0x4e3558[_0xac7d('0x24')]]={};this[_0xac7d('0x23')][_0x4e3558[_0xac7d('0x24')]][_0xac7d('0x25')]=_0x4e3558[_0xac7d('0x25')];this[_0xac7d('0x23')][_0x4e3558[_0xac7d('0x24')]]['id']=this[_0xac7d('0xe')][_0x155349]['id'];this[_0xac7d('0x23')][_0x4e3558[_0xac7d('0x24')]]['name']=this[_0xac7d('0xe')][_0x155349][_0xac7d('0x26')];logger['info'](_0x4e3558['uniqueid'],_0xac7d('0x27'));}}}}if(this[_0xac7d('0x10')][_0x4e3558[_0xac7d('0x24')]]){this[_0xac7d('0x23')][_0x4e3558[_0xac7d('0x24')]]={};this[_0xac7d('0x23')][_0x4e3558[_0xac7d('0x24')]]['channel']=_0x4e3558['channel'];logger[_0xac7d('0x28')](_0x4e3558['uniqueid'],_0xac7d('0x27'));}};Fax['prototype']['syncVarSet']=function(_0x5182a1){if(this[_0xac7d('0x23')][_0x5182a1['uniqueid']]){for(var _0x2e2075 in _0x5182a1[_0xac7d('0x29')]){if(_0x5182a1[_0xac7d('0x29')][_0xac7d('0x2a')](_0x2e2075)){this[_0xac7d('0x23')][_0x5182a1[_0xac7d('0x24')]][_0x2e2075]=_0x5182a1[_0xac7d('0x2b')];}}}};Fax[_0xac7d('0x1f')]['syncNewState']=function(_0x55f3ca){if(this[_0xac7d('0x23')][_0x55f3ca[_0xac7d('0x24')]]){this['channels'][_0x55f3ca[_0xac7d('0x24')]][_0xac7d('0x2c')]=_0x55f3ca['channelstate'];this[_0xac7d('0x23')][_0x55f3ca['uniqueid']][_0xac7d('0x2d')]=_0x55f3ca[_0xac7d('0x2d')];}};Fax[_0xac7d('0x1f')][_0xac7d('0x18')]=function(_0x15c723){if(this['channels'][_0x15c723[_0xac7d('0x24')]]){for(var _0x526d24 in _0x15c723[_0xac7d('0x29')]){if(_0x15c723[_0xac7d('0x29')][_0xac7d('0x2a')](_0x526d24)){this[_0xac7d('0x23')][_0x15c723[_0xac7d('0x24')]][_0x526d24]=_0x15c723[_0xac7d('0x2b')];}}}};Fax[_0xac7d('0x1f')][_0xac7d('0x1a')]=function(_0x3a29a2){if(this[_0xac7d('0x23')][_0x3a29a2[_0xac7d('0x24')]]){this[_0xac7d('0x23')][_0x3a29a2['uniqueid']][_0xac7d('0x2e')]=_0x3a29a2[_0xac7d('0x2e')];this['channels'][_0x3a29a2['uniqueid']][_0xac7d('0x2f')]=_0x3a29a2[_0xac7d('0x2f')];this[_0xac7d('0x23')][_0x3a29a2[_0xac7d('0x24')]][_0xac7d('0x30')]=_0x3a29a2['localstationid'];this[_0xac7d('0x23')][_0x3a29a2[_0xac7d('0x24')]][_0xac7d('0x31')]=_0x3a29a2[_0xac7d('0x31')];logger[_0xac7d('0x28')](_0x3a29a2[_0xac7d('0x24')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xac7d('0x32')]=function(_0x51f7be){var _0x22201e=this;if(this['channels'][_0x51f7be[_0xac7d('0x24')]]){var _0x4ed3ef=this[_0xac7d('0x23')][_0x51f7be[_0xac7d('0x24')]]['id'];this[_0xac7d('0x23')][_0x51f7be[_0xac7d('0x24')]][_0xac7d('0x33')]=_0x51f7be[_0xac7d('0x33')];this[_0xac7d('0x23')][_0x51f7be['uniqueid']]['pagestransferred']=_0x51f7be[_0xac7d('0x34')];this[_0xac7d('0x23')][_0x51f7be['uniqueid']][_0xac7d('0x30')]=_0x51f7be[_0xac7d('0x30')];this[_0xac7d('0x23')][_0x51f7be['uniqueid']]['resolution']=_0x51f7be[_0xac7d('0x35')];this[_0xac7d('0x23')][_0x51f7be[_0xac7d('0x24')]]['transferrate']=_0x51f7be['transferrate'];this[_0xac7d('0x23')][_0x51f7be[_0xac7d('0x24')]][_0xac7d('0x31')]=_0x51f7be['filename'];this[_0xac7d('0x23')][_0x51f7be[_0xac7d('0x24')]][_0xac7d('0x36')]=_0x51f7be[_0xac7d('0x36')];if(this[_0xac7d('0x23')][_0x51f7be[_0xac7d('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x51f7be[_0xac7d('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x12d3c0){logger['info'](_0x51f7be['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x12d3c0['message']);attachment[_0xac7d('0x37')]({'name':path[_0xac7d('0x38')](_0x51f7be['filename'])[_0xac7d('0x26')],'basename':path['parse'](_0x51f7be[_0xac7d('0x31')])['name']+_0xac7d('0x39'),'type':_0xac7d('0x3a')})[_0xac7d('0x3b')](function(_0x44cebb){faxAccount[_0xac7d('0x3c')](_0x4ed3ef,{'from':_0x51f7be['calleridnum'],'mapKey':'fax','body':path[_0xac7d('0x38')](_0x51f7be[_0xac7d('0x31')])[_0xac7d('0x26')]+'.pdf','AttachmentId':_0x44cebb['id']})['catch'](function(_0x8e65e){logger[_0xac7d('0x3d')](_0x51f7be[_0xac7d('0x24')],_0xac7d('0x3e'),JSON['stringify'](_0x8e65e));});})[_0xac7d('0x3f')](function(_0x498006){logger[_0xac7d('0x3d')](_0x51f7be[_0xac7d('0x24')],_0xac7d('0x40'),JSON['stringify'](_0x498006));});});}logger[_0xac7d('0x28')](_0x51f7be[_0xac7d('0x24')],_0xac7d('0x40'));}};Fax['prototype'][_0xac7d('0x1e')]=function(_0x49f6b5){if(this['actions'][_0x49f6b5[_0xac7d('0x24')]]){_[_0xac7d('0x41')](this['channels'][_0x49f6b5[_0xac7d('0x24')]],_[_0xac7d('0x42')](_0x49f6b5,[_0xac7d('0x43'),'reason']));}};function updateStatus(_0x5a0f63){if(_0x5a0f63[_0xac7d('0x44')]){faxMessage[_0xac7d('0x45')](_0x5a0f63['AttachmentId'],{'failMessage':_0xac7d('0x46')})['then'](function(_0x3dd46e){ut['logger']('[Fax][Message][Error][Updated]',_0x3dd46e);})[_0xac7d('0x3f')](function(_0x3db8ec){ut['logger'](_0xac7d('0x47'),_0x3db8ec);});}else{ut[_0xac7d('0x48')](_0xac7d('0x49'));}}Fax[_0xac7d('0x1f')][_0xac7d('0x4a')]=function(_0x2df5f1,_0x2ef690,_0x24c820){var _0x517c60=this;var _0x2b0215={};if(_0x2ef690){_0x2b0215={'read':_0x2ef690};}else{_0x2b0215={'failMessage':_0x24c820};}if(this['actions'][_0x2df5f1][_0xac7d('0x44')]){faxMessage[_0xac7d('0x45')](this['actions'][_0x2df5f1]['AttachmentId'],_0x2b0215)[_0xac7d('0x3b')](function(_0x2e9dce){ut['logger'](_0xac7d('0x4b'),_0x2e9dce);})[_0xac7d('0x3f')](function(_0x6e5049){ut[_0xac7d('0x48')](_0xac7d('0x4c'),_0x6e5049);})[_0xac7d('0x4d')](function(){delete _0x517c60[_0xac7d('0x23')][_0x2df5f1];delete _0x517c60['actions'][_0x2df5f1];});}else{ut[_0xac7d('0x48')](_0xac7d('0x4e'));delete this[_0xac7d('0x23')][_0x2df5f1];delete this[_0xac7d('0x10')][_0x2df5f1];}};Fax[_0xac7d('0x1f')]['syncHangup']=function(_0x13a4fd){var _0xf4e52e=this;if(this['channels'][_0x13a4fd[_0xac7d('0x24')]]){if(this[_0xac7d('0x10')][_0x13a4fd['uniqueid']]){this[_0xac7d('0x23')][_0x13a4fd['uniqueid']]['id']=this[_0xac7d('0x10')][_0x13a4fd['uniqueid']]['id'];this['channels'][_0x13a4fd[_0xac7d('0x24')]][_0xac7d('0x26')]=this['actions'][_0x13a4fd[_0xac7d('0x24')]]['name'];}logger[_0xac7d('0x28')](_0x13a4fd[_0xac7d('0x24')],this['actions'][_0x13a4fd['uniqueid']]?_0xac7d('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0xac7d('0x23')][_0x13a4fd[_0xac7d('0x24')]]));if(this['actions'][_0x13a4fd[_0xac7d('0x24')]]){if(this[_0xac7d('0x23')][_0x13a4fd[_0xac7d('0x24')]][_0xac7d('0x50')]>0x0&&this[_0xac7d('0x23')][_0x13a4fd['uniqueid']][_0xac7d('0x19')]===_0xac7d('0x51')){this[_0xac7d('0x4a')](_0x13a4fd[_0xac7d('0x24')],!![]);}else{this[_0xac7d('0x4a')](_0x13a4fd[_0xac7d('0x24')],![],this[_0xac7d('0x23')][_0x13a4fd['uniqueid']][_0xac7d('0x52')]?_0xac7d('0x53')+this[_0xac7d('0x23')][_0x13a4fd['uniqueid']]['faxstatusstring']:_0xac7d('0x54'));}}}};Fax[_0xac7d('0x1f')][_0xac7d('0x55')]=function(_0x1b780f){var _0x434669=this;return new BPromise(function(_0x222632,_0x597d8a){_0x434669[_0xac7d('0x56')](_0x1b780f,_0x434669['faxAccounts'][_0x1b780f['FaxAccountId']])[_0xac7d('0x3b')](function(_0x4dbe0c){ut['logger'](_0xac7d('0x57'),_0x4dbe0c);_0x222632(ut[_0xac7d('0x58')](_0xac7d('0x59')));})[_0xac7d('0x3f')](function(_0x15172b){ut['logger']('[Fax][execOriginate][failure]',_0x15172b);updateStatus(_0x1b780f);_0x597d8a(ut[_0xac7d('0x58')]('Fax\x20failed'));});});};Fax[_0xac7d('0x1f')][_0xac7d('0x5a')]=function(_0xf079ec){var _0x177aba=this;return new BPromise(function(_0x489b6d,_0x5199e5){var _0x2cf777=_0x177aba[_0xac7d('0x5b')](_0x177aba[_0xac7d('0xe')][_0xf079ec[_0xac7d('0x5c')]]['Trunk'],_0xf079ec);if(_0x2cf777[_0xac7d('0x5d')]){_0x489b6d(ut[_0xac7d('0x58')](_0xac7d('0x5e')));}else{_0x5199e5(ut[_0xac7d('0x58')](_0x2cf777[_0xac7d('0x58')]));}});};function originate(_0x5c836b,_0x2325b2,_0x3b793d){return new BPromise(function(_0x50284c,_0x1d3300){if(_0x3b793d){var _0x44f9b8=util[_0xac7d('0x5f')](_0xac7d('0x60'),path[_0xac7d('0x38')](_0x5c836b[_0xac7d('0x4')])[_0xac7d('0x26')],_0x5c836b['path']);gs[_0xac7d('0x61')](_0x44f9b8)[_0xac7d('0x3b')](function(){_0x5c836b[_0xac7d('0x4')]=util[_0xac7d('0x5f')](_0xac7d('0x62'),path[_0xac7d('0x38')](_0x5c836b[_0xac7d('0x4')])[_0xac7d('0x63')],path[_0xac7d('0x38')](_0x5c836b['path'])[_0xac7d('0x26')]);_0x2325b2[_0xac7d('0x64')]=_0x5c836b[_0xac7d('0x4')];ut[_0xac7d('0x48')](_0xac7d('0x65'),'');ami[_0xac7d('0x66')](ut[_0xac7d('0x67')](_0x5c836b,_0x2325b2))[_0xac7d('0x3b')](function(_0x4ae641){_0x50284c(_0x4ae641);})[_0xac7d('0x3f')](function(_0x5dbed0){_0x1d3300(_0x5dbed0);});})['catch'](function(_0x13223b){_0x1d3300(_0x13223b);});}else{ami[_0xac7d('0x66')](ut[_0xac7d('0x67')](_0x5c836b,_0x2325b2))[_0xac7d('0x3b')](function(_0xe70931){_0x50284c(_0xe70931);})[_0xac7d('0x3f')](function(_0xd48fa3){_0x1d3300(_0xd48fa3);});}});}Fax['prototype']['execOriginate']=function(_0xa1c56a,_0x514dc4){var _0x5b124f=this;return new BPromise(function(_0x4e6f78,_0xcfa1c1){var _0xa3656d=uuid['v4']();var _0x5b7b01=ut[_0xac7d('0x68')](_0xa1c56a,_0x514dc4);_0x5b124f[_0xac7d('0x10')][_0xa3656d]=new Action(_0xa3656d,_0x514dc4,_0xa1c56a);var _0xdc24f8=_0x5b124f[_0xac7d('0x10')][_0xa3656d];if(path[_0xac7d('0x38')](_0xa1c56a[_0xac7d('0x4')])[_0xac7d('0x69')]==='.pdf'){originate(_0xdc24f8,_0x5b7b01,!![])[_0xac7d('0x3b')](function(_0x18156c){_0x4e6f78(_0x18156c);})[_0xac7d('0x3f')](function(_0x28602b){_0xcfa1c1(_0x28602b);});}else{originate(_0xdc24f8,_0x5b7b01,![])[_0xac7d('0x3b')](function(_0x131a94){_0x4e6f78(_0x131a94);})[_0xac7d('0x3f')](function(_0x3cc285){_0xcfa1c1(_0x3cc285);});}});};Fax['prototype'][_0xac7d('0x6a')]=function(_0x6a1dca){return!_[_0xac7d('0x6b')](_0x6a1dca)&&!_[_0xac7d('0x6b')](_0x6a1dca[_0xac7d('0x26')])&&!_[_0xac7d('0x6b')](_0x6a1dca[_0xac7d('0x6c')])&&_0x6a1dca[_0xac7d('0x6c')]&&!_[_0xac7d('0x6b')](this['trunks'][util[_0xac7d('0x5f')](_0xac7d('0x6d'),_0x6a1dca[_0xac7d('0x26')])])&&!_[_0xac7d('0x6b')](this[_0xac7d('0xf')][util[_0xac7d('0x5f')](_0xac7d('0x6d'),_0x6a1dca['name'])][_0xac7d('0x2f')])&&(this[_0xac7d('0xf')][util[_0xac7d('0x5f')](_0xac7d('0x6d'),_0x6a1dca[_0xac7d('0x26')])][_0xac7d('0x2f')]==='reachable'||this[_0xac7d('0xf')][util[_0xac7d('0x5f')](_0xac7d('0x6d'),_0x6a1dca[_0xac7d('0x26')])]['status']===_0xac7d('0x6e'));};Fax[_0xac7d('0x1f')][_0xac7d('0x5b')]=function(_0x1d09f8,_0x421d7d){if(!this[_0xac7d('0x6a')](_0x1d09f8)){ut[_0xac7d('0x48')](_0xac7d('0x6f'),_[_0xac7d('0x6b')](_0x1d09f8)?'':_0x1d09f8['name']+_0xac7d('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xac7d('0x6b')](_0x421d7d[_0xac7d('0x7')])){ut[_0xac7d('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xac7d('0x71')](_0x421d7d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xac7d('0x6b')](_0x421d7d[_0xac7d('0x4')])){ut['logger'](_0xac7d('0x72'),JSON[_0xac7d('0x71')](_0x421d7d));return{'isValid':![],'message':_0xac7d('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xac7d('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index be127de..a554387 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 _0xc55b=['then','catch','bluebird','../../../config/logger','preview','inspect','notify'];(function(_0x36da00,_0x5b533b){var _0x4b72c5=function(_0x46e26b){while(--_0x46e26b){_0x36da00['push'](_0x36da00['shift']());}};_0x4b72c5(++_0x5b533b);}(_0xc55b,0xf7));var _0xbc55=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc55b[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var BPromise=require(_0xbc55('0x0'));var logger=require(_0xbc55('0x1'))(_0xbc55('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x4baa21){return function(_0x4c40d9){logger['error'](_0x4baa21,util[_0xbc55('0x3')](_0x4c40d9,{'showHidden':![],'depth':null}));};}exports[_0xbc55('0x4')]=function(_0xea595a,_0x2cb571){return BPromise['resolve']()[_0xbc55('0x5')](faxAccount['notify'](_0xea595a,_0x2cb571))[_0xbc55('0x6')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xd890=['../../../config/logger','preview','lodash','error','notify','[Notify]\x20','bluebird'];(function(_0x241ea5,_0x330464){var _0x5cf0de=function(_0x1ca672){while(--_0x1ca672){_0x241ea5['push'](_0x241ea5['shift']());}};_0x5cf0de(++_0x330464);}(_0xd890,0x7d));var _0x0d89=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xd890[_0x3f0b30];return _0x2748a5;};'use strict';var util=require('util');var BPromise=require(_0x0d89('0x0'));var logger=require(_0x0d89('0x1'))(_0x0d89('0x2'));var _=require(_0x0d89('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x554109){return function(_0x54f485){logger[_0x0d89('0x4')](_0x554109,util['inspect'](_0x54f485,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x9bdae4,_0x4f60a8){return BPromise['resolve']()['then'](faxAccount[_0x0d89('0x5')](_0x9bdae4,_0x4f60a8))['catch'](loggerCatch(_0x0d89('0x6')));}; \ 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 7cf8306..f5a6c29 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 _0x90fa=['Exec\x20gs','info','\x20Error\x20:','inspect','fax','bluebird','exec'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x90fa,0x169));var _0xa90f=function(_0x3c4de2,_0x526589){_0x3c4de2=_0x3c4de2-0x0;var _0x26009e=_0x90fa[_0x3c4de2];return _0x26009e;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0xa90f('0x0'));var BPromise=require(_0xa90f('0x1'));var exec=require('child_process')[_0xa90f('0x2')];exports['execute']=function(_0x377a7e){return new BPromise(function(_0xee669c,_0x51e03b){exec(_0x377a7e,function(_0x32a03f,_0x38cee6,_0x15233f){logger['info'](_0xa90f('0x3'),_0x38cee6);if(_0x32a03f){logger[_0xa90f('0x4')](_0xa90f('0x3'),_0xa90f('0x5'),util[_0xa90f('0x6')](_0x32a03f,{'showHidden':![],'depth':null}),_0x38cee6,_0x15233f);_0x51e03b(_0x32a03f);}_0xee669c(_0x38cee6);});});}; \ No newline at end of file +var _0x2bbc=['inspect','util','../../../../config/logger','bluebird','child_process','execute','info','Exec\x20gs'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x2bbc,0x189));var _0xc2bb=function(_0x2b9aa0,_0x11b2c1){_0x2b9aa0=_0x2b9aa0-0x0;var _0xad623b=_0x2bbc[_0x2b9aa0];return _0xad623b;};'use strict';var util=require(_0xc2bb('0x0'));var logger=require(_0xc2bb('0x1'))('fax');var BPromise=require(_0xc2bb('0x2'));var exec=require(_0xc2bb('0x3'))['exec'];exports[_0xc2bb('0x4')]=function(_0x78528c){return new BPromise(function(_0x1f8282,_0x17a1d7){exec(_0x78528c,function(_0x306b1d,_0x54e86d,_0x40c23d){logger[_0xc2bb('0x5')]('Exec\x20gs',_0x54e86d);if(_0x306b1d){logger[_0xc2bb('0x5')](_0xc2bb('0x6'),'\x20Error\x20:',util[_0xc2bb('0x7')](_0x306b1d,{'showHidden':![],'depth':null}),_0x54e86d,_0x40c23d);_0x17a1d7(_0x306b1d);}_0x1f8282(_0x54e86d);});});}; \ 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 80f934a..751f3f4 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 _0x668b=['../../../../config/logger','fax','info','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash'];(function(_0x223939,_0x550aaa){var _0x34d8c0=function(_0x1edb1a){while(--_0x1edb1a){_0x223939['push'](_0x223939['shift']());}};_0x34d8c0(++_0x550aaa);}(_0x668b,0x140));var _0xb668=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x668b[_0x54d4fe];return _0x1ab5bb;};'use strict';var util=require(_0xb668('0x0'));var _=require(_0xb668('0x1'));var moment=require('moment');var logger=require(_0xb668('0x2'))(_0xb668('0x3'));exports['message']=function(_0x336ba4){return{'message':_0x336ba4};};exports['logger']=function(_0x2fab11,_0x4092a6){logger[_0xb668('0x4')](_0x2fab11,util['inspect'](_0x4092a6,{'showHidden':![],'depth':null}));};exports[_0xb668('0x5')]=function(_0x296fa9,_0x3be92e){var _0x2778e9={'XMF-ECM':_0x3be92e[_0xb668('0x6')],'XMF-HEADERINFO':_0x3be92e[_0xb668('0x7')],'XMF-MINRATE':_0x3be92e['minrate'],'XMF-MAXRATE':_0x3be92e[_0xb668('0x8')],'XMF-MODEM':util[_0xb668('0x9')](_0xb668('0xa'),_0x3be92e[_0xb668('0xb')]),'XMF-GATEWAY':_0x3be92e[_0xb668('0xc')],'XMF-FAXDETECT':_0x3be92e[_0xb668('0xd')],'XMF-T38TIMEOUT':_0x3be92e[_0xb668('0xe')],'XMF-LOCALSTATIONID':_0x3be92e[_0xb668('0xf')],'XMF-PATH':_0x296fa9['path']};return _0x2778e9;};exports[_0xb668('0x10')]=function(_0x27dbf7,_0x27de15){return{'actionid':_0x27dbf7[_0xb668('0x11')],'action':_0xb668('0x12'),'channel':_0x27dbf7[_0xb668('0x13')],'Exten':_0xb668('0x14'),'Context':_0xb668('0x15'),'Priority':'1','callerid':util[_0xb668('0x9')](_0xb668('0x16'),_0x27dbf7[_0xb668('0x7')]?_0x27dbf7[_0xb668('0x7')]:'',_0x27dbf7[_0xb668('0xf')]),'variable':_0x27de15,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x27dbf7[_0xb668('0x11')]};}; \ No newline at end of file +var _0x3667=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout'];(function(_0x898275,_0x108173){var _0x2610ce=function(_0x48ddbd){while(--_0x48ddbd){_0x898275['push'](_0x898275['shift']());}};_0x2610ce(++_0x108173);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7366('0x0'));var _=require(_0x7366('0x1'));var moment=require(_0x7366('0x2'));var logger=require(_0x7366('0x3'))(_0x7366('0x4'));exports['message']=function(_0x27a90d){return{'message':_0x27a90d};};exports[_0x7366('0x5')]=function(_0x4b32a7,_0x27726b){logger[_0x7366('0x6')](_0x4b32a7,util[_0x7366('0x7')](_0x27726b,{'showHidden':![],'depth':null}));};exports[_0x7366('0x8')]=function(_0x101e3d,_0x589397){var _0x28f6c8={'XMF-ECM':_0x589397[_0x7366('0x9')],'XMF-HEADERINFO':_0x589397[_0x7366('0xa')],'XMF-MINRATE':_0x589397[_0x7366('0xb')],'XMF-MAXRATE':_0x589397[_0x7366('0xc')],'XMF-MODEM':util[_0x7366('0xd')](_0x7366('0xe'),_0x589397[_0x7366('0xf')]),'XMF-GATEWAY':_0x589397[_0x7366('0x10')],'XMF-FAXDETECT':_0x589397[_0x7366('0x11')],'XMF-T38TIMEOUT':_0x589397[_0x7366('0x12')],'XMF-LOCALSTATIONID':_0x589397[_0x7366('0x13')],'XMF-PATH':_0x101e3d[_0x7366('0x14')]};return _0x28f6c8;};exports[_0x7366('0x15')]=function(_0x2694fc,_0xbcd488){return{'actionid':_0x2694fc[_0x7366('0x16')],'action':_0x7366('0x17'),'channel':_0x2694fc[_0x7366('0x18')],'Exten':_0x7366('0x19'),'Context':_0x7366('0x1a'),'Priority':'1','callerid':util[_0x7366('0xd')](_0x7366('0x1b'),_0x2694fc[_0x7366('0xa')]?_0x2694fc[_0x7366('0xa')]:'',_0x2694fc[_0x7366('0x13')]),'variable':_0xbcd488,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2694fc[_0x7366('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0cd71f6..f7530dd 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 _0xfd67=['./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','listen','sync','log','bluebird','util','moment','./server','./report','./acw','./trigger','./dialer','./preview'];(function(_0x5b328c,_0x53657c){var _0x26643c=function(_0x5e39f2){while(--_0x5e39f2){_0x5b328c['push'](_0x5b328c['shift']());}};_0x26643c(++_0x53657c);}(_0xfd67,0x1cc));var _0x7fd6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xfd67[_0x4b369d];return _0x571a98;};'use strict';var BPromise=require(_0x7fd6('0x0'));var util=require(_0x7fd6('0x1'));var moment=require(_0x7fd6('0x2'));var server=require(_0x7fd6('0x3'));var Realtime=require('./realtime');var Report=require(_0x7fd6('0x4'));var Acw=require(_0x7fd6('0x5'));var Trigger=require(_0x7fd6('0x6'));var Dialer=require(_0x7fd6('0x7'));var Preview=require(_0x7fd6('0x8'));var Fax=require(_0x7fd6('0x9'));var user=require(_0x7fd6('0xa'));var voiceQueue=require(_0x7fd6('0xb'));var voiceQueueReport=require(_0x7fd6('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x7fd6('0xd'));var trigger=require(_0x7fd6('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x7fd6('0xf'));var campaign=require(_0x7fd6('0x10'));var voiceExtension=require(_0x7fd6('0x11'));var faxAccount=require(_0x7fd6('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x7fd6('0x13'));var sugarcrm=require(_0x7fd6('0x14'));var freshdesk=require(_0x7fd6('0x15'));var desk=require(_0x7fd6('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x7fd6('0x17'));var freshsales=require(_0x7fd6('0x18'));var servicenow=require(_0x7fd6('0x19'));var dynamics365=require(_0x7fd6('0x1a'));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()[_0x7fd6('0x1b')](_0x7fd6('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7fd6('0x1b')](_0x7fd6('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7fd6('0x1d')]()[_0x7fd6('0x1e')](user[_0x7fd6('0x1f')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x20')]())[_0x7fd6('0x1e')](user[_0x7fd6('0x21')]())[_0x7fd6('0x1e')](realtime['initTelephones']())[_0x7fd6('0x1e')](trunk[_0x7fd6('0x22')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x23')]())['then'](voiceQueue['getVoiceQueues']())[_0x7fd6('0x1e')](realtime['initVoiceQueues']())[_0x7fd6('0x1e')](trigger['getTriggers']())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x24')]())['then'](template[_0x7fd6('0x25')]())['then'](realtime[_0x7fd6('0x26')]())[_0x7fd6('0x1e')](zendesk[_0x7fd6('0x27')]())['then'](realtime[_0x7fd6('0x28')]())[_0x7fd6('0x1e')](salesforce[_0x7fd6('0x29')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x2a')]())[_0x7fd6('0x1e')](sugarcrm[_0x7fd6('0x2b')]())[_0x7fd6('0x1e')](realtime['initSugarcrmAccounts']())[_0x7fd6('0x1e')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x7fd6('0x2c')]())[_0x7fd6('0x1e')](desk[_0x7fd6('0x2d')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x2e')]())['then'](zoho[_0x7fd6('0x2f')]())[_0x7fd6('0x1e')](realtime['initZohoAccounts']())[_0x7fd6('0x1e')](vtiger['getVtigerAccounts']())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x30')]())[_0x7fd6('0x1e')](freshsales['getFreshsalesAccounts']())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x31')]())[_0x7fd6('0x1e')](servicenow[_0x7fd6('0x32')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x33')]())['then'](dynamics365[_0x7fd6('0x34')]())[_0x7fd6('0x1e')](realtime['initDynamics365Accounts']())[_0x7fd6('0x1e')](campaign[_0x7fd6('0x35')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x36')]())['then'](voiceExtension[_0x7fd6('0x37')]())['then'](realtime[_0x7fd6('0x38')]())[_0x7fd6('0x1e')](faxAccount[_0x7fd6('0x39')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x7fd6('0x1d')]()['then'](voiceQueueReport[_0x7fd6('0x3b')]())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x3c')]())[_0x7fd6('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x7fd6('0x1e')](realtime[_0x7fd6('0x3d')]())[_0x7fd6('0x1e')](cmHopperHistory[_0x7fd6('0x3e')]())[_0x7fd6('0x1e')](realtime['initCampaignHopperHistory']())[_0x7fd6('0x1e')](voiceCallReport[_0x7fd6('0x3f')]())[_0x7fd6('0x1e')](realtime['initVoiceCallReports']())[_0x7fd6('0x1e')](function(_0x38e761){})['catch'](function(_0x18a9da){console['log'](_0x18a9da);});}function main(){return server[_0x7fd6('0x40')](realtime,preview,fax)[_0x7fd6('0x1e')](function(_0x2813d0){return initRealtime();})[_0x7fd6('0x1e')](function(){return initParams();})[_0x7fd6('0x1e')](function(){report[_0x7fd6('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x29990d){console[_0x7fd6('0x42')](_0x29990d);});}main(); \ No newline at end of file +var _0x1450=['getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','listen','sync','catch','util','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1450,0xf9));var _0x0145=function(_0x2e8a8a,_0x29d0d6){_0x2e8a8a=_0x2e8a8a-0x0;var _0x4dce8a=_0x1450[_0x2e8a8a];return _0x4dce8a;};'use strict';var BPromise=require('bluebird');var util=require(_0x0145('0x0'));var moment=require('moment');var server=require(_0x0145('0x1'));var Realtime=require(_0x0145('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x0145('0x3'));var Dialer=require(_0x0145('0x4'));var Preview=require(_0x0145('0x5'));var Fax=require(_0x0145('0x6'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x0145('0x7'));var voiceCallReport=require(_0x0145('0x8'));var trunk=require(_0x0145('0x9'));var trigger=require(_0x0145('0xa'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x0145('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0145('0xc'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x0145('0xd'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0145('0xe'));var zoho=require(_0x0145('0xf'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x0145('0x10'));var servicenow=require(_0x0145('0x11'));var dynamics365=require(_0x0145('0x12'));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()[_0x0145('0x13')](_0x0145('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0145('0x13')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0145('0x15')]()[_0x0145('0x16')](user[_0x0145('0x17')]())[_0x0145('0x16')](realtime['initAgents']())['then'](user[_0x0145('0x18')]())[_0x0145('0x16')](realtime[_0x0145('0x19')]())['then'](trunk['getTrunks']())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x0145('0x1a')]())['then'](realtime[_0x0145('0x1b')]())['then'](trigger[_0x0145('0x1c')]())[_0x0145('0x16')](realtime['initTriggers']())[_0x0145('0x16')](template[_0x0145('0x1d')]())['then'](realtime[_0x0145('0x1e')]())['then'](zendesk['getZendeskAccounts']())[_0x0145('0x16')](realtime[_0x0145('0x1f')]())['then'](salesforce[_0x0145('0x20')]())[_0x0145('0x16')](realtime[_0x0145('0x21')]())['then'](sugarcrm[_0x0145('0x22')]())[_0x0145('0x16')](realtime[_0x0145('0x23')]())[_0x0145('0x16')](freshdesk[_0x0145('0x24')]())['then'](realtime[_0x0145('0x25')]())['then'](desk[_0x0145('0x26')]())[_0x0145('0x16')](realtime[_0x0145('0x27')]())['then'](zoho['getZohoAccounts']())[_0x0145('0x16')](realtime[_0x0145('0x28')]())[_0x0145('0x16')](vtiger[_0x0145('0x29')]())[_0x0145('0x16')](realtime['initVtigerAccounts']())[_0x0145('0x16')](freshsales['getFreshsalesAccounts']())[_0x0145('0x16')](realtime[_0x0145('0x2a')]())[_0x0145('0x16')](servicenow[_0x0145('0x2b')]())[_0x0145('0x16')](realtime['initServicenowAccounts']())[_0x0145('0x16')](dynamics365['getDynamics365Accounts']())[_0x0145('0x16')](realtime[_0x0145('0x2c')]())[_0x0145('0x16')](campaign['getCampaigns']())[_0x0145('0x16')](realtime[_0x0145('0x2d')]())[_0x0145('0x16')](voiceExtension['getVoiceExtensions']())[_0x0145('0x16')](realtime[_0x0145('0x2e')]())[_0x0145('0x16')](faxAccount['getFaxAccounts']())[_0x0145('0x16')](realtime['initFaxAccounts']())[_0x0145('0x16')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x0145('0x2f')]())[_0x0145('0x16')](realtime[_0x0145('0x30')]())[_0x0145('0x16')](cmHopperHistory[_0x0145('0x31')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x0145('0x16')](cmHopperHistory[_0x0145('0x32')]())[_0x0145('0x16')](realtime[_0x0145('0x33')]())[_0x0145('0x16')](voiceCallReport[_0x0145('0x34')]())[_0x0145('0x16')](realtime['initVoiceCallReports']())[_0x0145('0x16')](function(_0x48e7be){})['catch'](function(_0x4cfdd5){console[_0x0145('0x35')](_0x4cfdd5);});}function main(){return server[_0x0145('0x36')](realtime,preview,fax)['then'](function(_0x589e3a){return initRealtime();})[_0x0145('0x16')](function(){return initParams();})[_0x0145('0x16')](function(){report[_0x0145('0x37')]();setInterval(initRealtime,0x1388);})[_0x0145('0x38')](function(_0x4596e8){console[_0x0145('0x35')](_0x4596e8);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 5d12fa2..2757e9d 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 _0x3aef=['status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','updateStatusRealtime','state','not_inuse','idle','talking','statePause','toNumber','voiceStatusQueue','stringify','md5','user:%s','emit','user:save','exports','lodash','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime'];(function(_0x4d4a87,_0x5c2186){var _0x1440b3=function(_0x56f138){while(--_0x56f138){_0x4d4a87['push'](_0x4d4a87['shift']());}};_0x1440b3(++_0x5c2186);}(_0x3aef,0x1bb));var _0xf3ae=function(_0x471abb,_0x378eb6){_0x471abb=_0x471abb-0x0;var _0x42896f=_0x3aef[_0x471abb];return _0x42896f;};'use strict';var _=require(_0xf3ae('0x0'));var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0xf3ae('0x1'));config['redis']=_[_0xf3ae('0x2')](config[_0xf3ae('0x3')],{'host':_0xf3ae('0x4'),'port':0x18eb});var io=require(_0xf3ae('0x5'))(new Redis(config['redis']));function Agent(_0x39baad){this['id']=_0x39baad['id']||0x0;this[_0xf3ae('0x6')]=_0x39baad[_0xf3ae('0x6')]||'';this[_0xf3ae('0x7')]=_0x39baad[_0xf3ae('0x7')]||'';this['accountcode']=_0x39baad[_0xf3ae('0x8')]||'';this['fullname']=_0x39baad[_0xf3ae('0x9')]||'';this['state']=_0xf3ae('0xa');this[_0xf3ae('0xb')]=0x0;this[_0xf3ae('0xc')]=_0xf3ae('0xa');this[_0xf3ae('0xd')]='';this[_0xf3ae('0xe')]='';this[_0xf3ae('0xf')]='';this[_0xf3ae('0x10')]='';this[_0xf3ae('0x11')]=_0x39baad[_0xf3ae('0x11')]||![];this[_0xf3ae('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0xf3ae('0x13')]='';this['voiceStatusQueue']='';this[_0xf3ae('0x14')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0xf3ae('0x15')]=function(_0x56124d){var _0x13a632;if(_0x56124d&&_0x56124d[_0xf3ae('0x16')]){_0x13a632=_0x56124d['state']['toLowerCase']();switch(_0x13a632){case _0xf3ae('0x17'):_0x13a632=_0xf3ae('0x18');break;case'inuse':_0x13a632=_0xf3ae('0x19');break;}}if(_0x13a632&&this[_0xf3ae('0x12')]!==_0x13a632||_0x56124d[_0xf3ae('0x1a')]){this['voiceStatusTime']=_[_0xf3ae('0x1b')](moment()['format']('x'));}if(_0x13a632){this['voiceStatus']=_0x13a632;}var _0x10b2b4={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0xf3ae('0x9')],'state':this[_0xf3ae('0x16')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xf3ae('0xd')],'online':this[_0xf3ae('0x11')],'voiceStatus':this[_0xf3ae('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xf3ae('0x13')],'voiceStatusQueue':this[_0xf3ae('0x1c')],'interface':this[_0xf3ae('0x10')],'onhold':this['onhold']};var _0x2b49b3=md5(JSON[_0xf3ae('0x1d')](_0x10b2b4));if(this['md5']!==_0x2b49b3){this[_0xf3ae('0x1e')]=_0x2b49b3;io['to'](util['format'](_0xf3ae('0x1f'),_0x10b2b4['name']))[_0xf3ae('0x20')](_0xf3ae('0x21'),_0x10b2b4);io[_0xf3ae('0x20')]('user:presence',_0x10b2b4);}};module[_0xf3ae('0x22')]=Agent; \ No newline at end of file +var _0x6eb0=['redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','format','voiceStatus','onhold','stringify','md5','user:%s','emit','user:presence','exports','lodash','util','ioredis','../../../config/environment','defaults'];(function(_0x59cadb,_0x3f4322){var _0x3bb397=function(_0x5c10a5){while(--_0x5c10a5){_0x59cadb['push'](_0x59cadb['shift']());}};_0x3bb397(++_0x3f4322);}(_0x6eb0,0x1a8));var _0x06eb=function(_0x561430,_0x3e8daf){_0x561430=_0x561430-0x0;var _0x5ea8b6=_0x6eb0[_0x561430];return _0x5ea8b6;};'use strict';var _=require(_0x06eb('0x0'));var util=require(_0x06eb('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x06eb('0x2'));var config=require(_0x06eb('0x3'));config['redis']=_[_0x06eb('0x4')](config[_0x06eb('0x5')],{'host':_0x06eb('0x6'),'port':0x18eb});var io=require(_0x06eb('0x7'))(new Redis(config[_0x06eb('0x5')]));function Agent(_0x2ba453){this['id']=_0x2ba453['id']||0x0;this[_0x06eb('0x8')]=_0x2ba453[_0x06eb('0x8')]||'';this[_0x06eb('0x9')]=_0x2ba453[_0x06eb('0x9')]||'';this[_0x06eb('0xa')]=_0x2ba453[_0x06eb('0xa')]||'';this[_0x06eb('0xb')]=_0x2ba453[_0x06eb('0xb')]||'';this[_0x06eb('0xc')]=_0x06eb('0xd');this[_0x06eb('0xe')]=0x0;this[_0x06eb('0xf')]=_0x06eb('0xd');this[_0x06eb('0x10')]='';this[_0x06eb('0x11')]='';this[_0x06eb('0x12')]='';this[_0x06eb('0x13')]='';this[_0x06eb('0x14')]=_0x2ba453[_0x06eb('0x14')]||![];this['voiceStatus']=_0x06eb('0xd');this[_0x06eb('0x15')]=0x0;this[_0x06eb('0x16')]='';this[_0x06eb('0x17')]='';this['onhold']=![];this['local']=![];this['md5']='';}Agent[_0x06eb('0x18')][_0x06eb('0x19')]=function(_0x39f847){var _0x1b55ae;if(_0x39f847&&_0x39f847[_0x06eb('0xc')]){_0x1b55ae=_0x39f847[_0x06eb('0xc')][_0x06eb('0x1a')]();switch(_0x1b55ae){case'not_inuse':_0x1b55ae=_0x06eb('0x1b');break;case _0x06eb('0x1c'):_0x1b55ae=_0x06eb('0x1d');break;}}if(_0x1b55ae&&this['voiceStatus']!==_0x1b55ae||_0x39f847['statePause']){this[_0x06eb('0x15')]=_['toNumber'](moment()[_0x06eb('0x1e')]('x'));}if(_0x1b55ae){this[_0x06eb('0x1f')]=_0x1b55ae;}var _0x297c15={'id':this['id'],'name':this['name'],'email':this[_0x06eb('0x9')],'accountcode':this[_0x06eb('0xa')],'fullname':this[_0x06eb('0xb')],'state':this[_0x06eb('0xc')],'stateTime':this[_0x06eb('0xe')],'status':this[_0x06eb('0xf')],'address':this[_0x06eb('0x10')],'online':this[_0x06eb('0x14')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x06eb('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x06eb('0x13')],'onhold':this[_0x06eb('0x20')]};var _0x2cc10c=md5(JSON[_0x06eb('0x21')](_0x297c15));if(this['md5']!==_0x2cc10c){this[_0x06eb('0x22')]=_0x2cc10c;io['to'](util['format'](_0x06eb('0x23'),_0x297c15[_0x06eb('0x8')]))[_0x06eb('0x24')]('user:save',_0x297c15);io[_0x06eb('0x24')](_0x06eb('0x25'),_0x297c15);}};module[_0x06eb('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index f1d0e9b..125190e 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 _0xcc72=['campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type'];(function(_0x3fc448,_0x22060d){var _0x3618f4=function(_0x430c5e){while(--_0x430c5e){_0x3fc448['push'](_0x3fc448['shift']());}};_0x3618f4(++_0x22060d);}(_0xcc72,0x1e8));var _0x2cc7=function(_0x177718,_0x31c743){_0x177718=_0x177718-0x0;var _0x14b09c=_0xcc72[_0x177718];return _0x14b09c;};'use strict';function Campaign(_0x2b22cf){this['id']=_0x2b22cf['id']||0x0;this[_0x2cc7('0x0')]=_0x2b22cf[_0x2cc7('0x0')]||'';this[_0x2cc7('0x1')]=_0x2b22cf[_0x2cc7('0x1')]||_0x2cc7('0x2');this[_0x2cc7('0x3')]=0x0;this['temp']=0x0;this[_0x2cc7('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x2cc7('0x5')]='';this[_0x2cc7('0x6')]=!![];this[_0x2cc7('0x7')]=_0x2b22cf[_0x2cc7('0x7')];this[_0x2cc7('0x8')]=_0x2b22cf[_0x2cc7('0x8')];this[_0x2cc7('0x9')]=_0x2b22cf[_0x2cc7('0x9')]||null;this[_0x2cc7('0xa')]=_0x2b22cf['dialGlobalInterval']?_0x2b22cf['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x2b22cf[_0x2cc7('0xb')];this[_0x2cc7('0xc')]=_0x2b22cf[_0x2cc7('0xc')];this[_0x2cc7('0xd')]=_0x2b22cf[_0x2cc7('0xd')]||0x1e;this[_0x2cc7('0xe')]=_0x2b22cf['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x2b22cf['dialCongestionRetryFrequency'];this[_0x2cc7('0xf')]=_0x2b22cf[_0x2cc7('0xf')];this[_0x2cc7('0x10')]=_0x2b22cf['dialBusyRetryFrequency'];this[_0x2cc7('0x11')]=_0x2b22cf['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x2b22cf['dialNoAnswerRetryFrequency'];this[_0x2cc7('0x12')]=_0x2b22cf['dialGlobalMaxRetry'];this[_0x2cc7('0x13')]=_0x2b22cf['dialNoSuchNumberMaxRetry']||0x3;this[_0x2cc7('0x14')]=_0x2b22cf[_0x2cc7('0x14')]||0x96;this[_0x2cc7('0x15')]=_0x2b22cf[_0x2cc7('0x15')]||0x3;this['dialDropRetryFrequency']=_0x2b22cf[_0x2cc7('0x16')]||0x96;this[_0x2cc7('0x17')]=_0x2b22cf[_0x2cc7('0x17')]||0x3;this[_0x2cc7('0x18')]=_0x2b22cf[_0x2cc7('0x18')]||0x96;this['dialMachineMaxRetry']=_0x2b22cf[_0x2cc7('0x19')]||0x3;this[_0x2cc7('0x1a')]=_0x2b22cf['dialMachineRetryFrequency']||0x96;this[_0x2cc7('0x1b')]=_0x2b22cf[_0x2cc7('0x1b')]||0x3;this[_0x2cc7('0x1c')]=_0x2b22cf['dialAgentRejectRetryFrequency']||0x96;this[_0x2cc7('0x1d')]=_0x2b22cf[_0x2cc7('0x1d')]||'DESC';this[_0x2cc7('0x1e')]=_0x2b22cf[_0x2cc7('0x1e')]||undefined;this[_0x2cc7('0x1f')]=_0x2b22cf[_0x2cc7('0x1f')]||undefined;this[_0x2cc7('0x20')]=_0x2b22cf[_0x2cc7('0x20')]||undefined;this[_0x2cc7('0x21')]=_0x2b22cf[_0x2cc7('0x21')]?_0x2b22cf[_0x2cc7('0x21')]:undefined;this[_0x2cc7('0x22')]=_0x2b22cf['Trunk']?_0x2b22cf[_0x2cc7('0x22')]:undefined;this[_0x2cc7('0x23')]=_0x2b22cf['Interval']?_0x2b22cf['Interval']:undefined;this[_0x2cc7('0x24')]=_0x2b22cf[_0x2cc7('0x24')]?_0x2b22cf[_0x2cc7('0x24')]:undefined;this[_0x2cc7('0x25')]=_0x2b22cf[_0x2cc7('0x24')]?_0x2b22cf['SquareProject'][_0x2cc7('0x0')]:undefined;this[_0x2cc7('0x26')]=_0x2b22cf['dialAMDActive']||![];this[_0x2cc7('0x27')]=_0x2b22cf[_0x2cc7('0x27')];this[_0x2cc7('0x28')]=_0x2b22cf[_0x2cc7('0x28')];this[_0x2cc7('0x29')]=_0x2b22cf['dialAMDAfterGreetingSilence'];this[_0x2cc7('0x2a')]=_0x2b22cf[_0x2cc7('0x2a')];this[_0x2cc7('0x2b')]=_0x2b22cf['dialAMDMinWordLength'];this[_0x2cc7('0x2c')]=_0x2b22cf['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x2b22cf[_0x2cc7('0x2d')];this[_0x2cc7('0x2e')]=_0x2b22cf[_0x2cc7('0x2e')];this[_0x2cc7('0x2f')]=_0x2b22cf[_0x2cc7('0x2f')];}module[_0x2cc7('0x30')]=Campaign; \ No newline at end of file +var _0xe512=['dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xe512,0x1a0));var _0x2e51=function(_0x9014f6,_0x2be061){_0x9014f6=_0x9014f6-0x0;var _0x586796=_0xe512[_0x9014f6];return _0x586796;};'use strict';function Campaign(_0x224d2a){this['id']=_0x224d2a['id']||0x0;this[_0x2e51('0x0')]=_0x224d2a['name']||'';this[_0x2e51('0x1')]=_0x224d2a[_0x2e51('0x1')]||_0x2e51('0x2');this[_0x2e51('0x3')]=0x0;this[_0x2e51('0x4')]=0x0;this[_0x2e51('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x2e51('0x6')]=_0x224d2a[_0x2e51('0x6')];this[_0x2e51('0x7')]=_0x224d2a[_0x2e51('0x7')];this['dialTimezone']=_0x224d2a[_0x2e51('0x8')]||null;this[_0x2e51('0x9')]=_0x224d2a['dialGlobalInterval']?_0x224d2a[_0x2e51('0x9')]:null;this[_0x2e51('0xa')]=_0x224d2a[_0x2e51('0xa')];this[_0x2e51('0xb')]=_0x224d2a[_0x2e51('0xb')];this[_0x2e51('0xc')]=_0x224d2a[_0x2e51('0xc')]||0x1e;this[_0x2e51('0xd')]=_0x224d2a[_0x2e51('0xd')];this['dialCongestionRetryFrequency']=_0x224d2a[_0x2e51('0xe')];this['dialBusyMaxRetry']=_0x224d2a['dialBusyMaxRetry'];this[_0x2e51('0xf')]=_0x224d2a[_0x2e51('0xf')];this[_0x2e51('0x10')]=_0x224d2a['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x224d2a['dialNoAnswerRetryFrequency'];this[_0x2e51('0x11')]=_0x224d2a[_0x2e51('0x11')];this[_0x2e51('0x12')]=_0x224d2a['dialNoSuchNumberMaxRetry']||0x3;this[_0x2e51('0x13')]=_0x224d2a[_0x2e51('0x13')]||0x96;this[_0x2e51('0x14')]=_0x224d2a[_0x2e51('0x14')]||0x3;this[_0x2e51('0x15')]=_0x224d2a[_0x2e51('0x15')]||0x96;this['dialAbandonedMaxRetry']=_0x224d2a['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x224d2a['dialAbandonedRetryFrequency']||0x96;this[_0x2e51('0x16')]=_0x224d2a[_0x2e51('0x16')]||0x3;this[_0x2e51('0x17')]=_0x224d2a[_0x2e51('0x17')]||0x96;this[_0x2e51('0x18')]=_0x224d2a[_0x2e51('0x18')]||0x3;this['dialAgentRejectRetryFrequency']=_0x224d2a[_0x2e51('0x19')]||0x96;this[_0x2e51('0x1a')]=_0x224d2a[_0x2e51('0x1a')]||_0x2e51('0x1b');this['dialPrefix']=_0x224d2a[_0x2e51('0x1c')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x224d2a[_0x2e51('0x1d')]||undefined;this[_0x2e51('0x1e')]=_0x224d2a[_0x2e51('0x1e')]||undefined;this[_0x2e51('0x1f')]=_0x224d2a[_0x2e51('0x1f')]?_0x224d2a[_0x2e51('0x1f')]:undefined;this[_0x2e51('0x20')]=_0x224d2a[_0x2e51('0x20')]?_0x224d2a[_0x2e51('0x20')]:undefined;this[_0x2e51('0x21')]=_0x224d2a[_0x2e51('0x21')]?_0x224d2a['Interval']:undefined;this[_0x2e51('0x22')]=_0x224d2a['SquareProject']?_0x224d2a[_0x2e51('0x22')]:undefined;this[_0x2e51('0x23')]=_0x224d2a[_0x2e51('0x22')]?_0x224d2a['SquareProject']['name']:undefined;this[_0x2e51('0x24')]=_0x224d2a[_0x2e51('0x24')]||![];this['dialAMDInitialSilence']=_0x224d2a['dialAMDInitialSilence'];this[_0x2e51('0x25')]=_0x224d2a[_0x2e51('0x25')];this[_0x2e51('0x26')]=_0x224d2a[_0x2e51('0x26')];this[_0x2e51('0x27')]=_0x224d2a['dialAMDTotalAnalysisTime'];this[_0x2e51('0x28')]=_0x224d2a[_0x2e51('0x28')];this[_0x2e51('0x29')]=_0x224d2a[_0x2e51('0x29')];this['dialAMDMaximumNumberOfWords']=_0x224d2a[_0x2e51('0x2a')];this['dialAMDSilenceThreshold']=_0x224d2a[_0x2e51('0x2b')];this[_0x2e51('0x2c')]=_0x224d2a[_0x2e51('0x2c')];}module[_0x2e51('0x2d')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 54d226d..0b2f3f4 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 _0xcbde=['holdtime','tag','monitor','monitors','transferconnectedlinenum','mohtime','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','uniqueid','linkedid','answered','answertime','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x34e830,_0x3c3620){var _0x462e4b=function(_0x113845){while(--_0x113845){_0x34e830['push'](_0x34e830['shift']());}};_0x462e4b(++_0x3c3620);}(_0xcbde,0x141));var _0xecbd=function(_0x22c3f5,_0x25e420){_0x22c3f5=_0x22c3f5-0x0;var _0x57daae=_0xcbde[_0x22c3f5];return _0x57daae;};'use strict';function Channel(){this[_0xecbd('0x0')]=null;this['channel']='';this[_0xecbd('0x1')]='';this[_0xecbd('0x2')]=0x0;this[_0xecbd('0x3')]='';this[_0xecbd('0x4')]=undefined;this[_0xecbd('0x5')]=undefined;this['accountcode']=0x0;this['context']='';this[_0xecbd('0x6')]=0x0;this[_0xecbd('0x7')]=0x0;this['exten']=0x0;this[_0xecbd('0x8')]=![];this[_0xecbd('0x9')]=null;this['endtime']=null;this['unmanaged']=![];this[_0xecbd('0xa')]=![];this[_0xecbd('0xb')]='';this[_0xecbd('0xc')]='';this[_0xecbd('0xd')]=0x0;this[_0xecbd('0xe')]=0x0;this[_0xecbd('0xf')]=0x0;this['type']=null;this[_0xecbd('0x10')]=null;this['disposition']=null;this[_0xecbd('0x11')]=![];this['monitorFilename']=null;this['queue']=null;this[_0xecbd('0x12')]=[];this['transfercalleridnum']=undefined;this[_0xecbd('0x13')]=undefined;this[_0xecbd('0x14')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xdb2b=['disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x4d830b,_0x27f78d){_0x4d830b=_0x4d830b-0x0;var _0x238c89=_0xdb2b[_0x4d830b];return _0x238c89;};'use strict';function Channel(){this[_0xbdb2('0x0')]=null;this['channel']='';this[_0xbdb2('0x1')]='';this[_0xbdb2('0x2')]=0x0;this[_0xbdb2('0x3')]='';this[_0xbdb2('0x4')]=undefined;this[_0xbdb2('0x5')]=undefined;this[_0xbdb2('0x6')]=0x0;this[_0xbdb2('0x7')]='';this[_0xbdb2('0x8')]=0x0;this[_0xbdb2('0x9')]=0x0;this[_0xbdb2('0xa')]=0x0;this[_0xbdb2('0xb')]=![];this[_0xbdb2('0xc')]=null;this['endtime']=null;this['unmanaged']=![];this[_0xbdb2('0xd')]=![];this[_0xbdb2('0xe')]='';this[_0xbdb2('0xf')]='';this[_0xbdb2('0x10')]=0x0;this[_0xbdb2('0x11')]=0x0;this[_0xbdb2('0x12')]=0x0;this['type']=null;this[_0xbdb2('0x13')]=null;this[_0xbdb2('0x14')]=null;this['monitor']=![];this[_0xbdb2('0x15')]=null;this[_0xbdb2('0x16')]=null;this['monitors']=[];this[_0xbdb2('0x17')]=undefined;this[_0xbdb2('0x18')]=undefined;this[_0xbdb2('0x19')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5794d89..a25195f 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 _0xd8af=['Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0xd8af,0x18d));var _0xfd8a=function(_0x515b17,_0x5be57a){_0x515b17=_0x515b17-0x0;var _0x456006=_0xd8af[_0x515b17];return _0x456006;};'use strict';function DeskAccount(_0x162c85){this['id']=_0x162c85['id']||0x0;this[_0xfd8a('0x0')]=_0x162c85[_0xfd8a('0x0')]||'';this[_0xfd8a('0x1')]=_0x162c85[_0xfd8a('0x1')]||'';this['remoteUri']=_0x162c85[_0xfd8a('0x2')]||'';this['authType']=_0x162c85[_0xfd8a('0x3')]||'';this[_0xfd8a('0x4')]=_0x162c85[_0xfd8a('0x4')]||'';this['consumerKey']=_0x162c85[_0xfd8a('0x5')]||'';this['consumerSecret']=_0x162c85[_0xfd8a('0x6')]||'';this[_0xfd8a('0x7')]=_0x162c85[_0xfd8a('0x7')]||'';this[_0xfd8a('0x8')]=_0x162c85['tokenSecret']||'';this[_0xfd8a('0x9')]=_0x162c85[_0xfd8a('0x9')]||'';this[_0xfd8a('0xa')]=_0x162c85[_0xfd8a('0xa')]||'';this[_0xfd8a('0xb')]=_0x162c85[_0xfd8a('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xdefc=['serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdefc,0x1b3));var _0xcdef=function(_0x525f58,_0xfa97d3){_0x525f58=_0x525f58-0x0;var _0x159734=_0xdefc[_0x525f58];return _0x159734;};'use strict';function DeskAccount(_0x1a2db3){this['id']=_0x1a2db3['id']||0x0;this[_0xcdef('0x0')]=_0x1a2db3[_0xcdef('0x0')]||'';this['username']=_0x1a2db3['username']||'';this[_0xcdef('0x1')]=_0x1a2db3['remoteUri']||'';this[_0xcdef('0x2')]=_0x1a2db3[_0xcdef('0x2')]||'';this[_0xcdef('0x3')]=_0x1a2db3[_0xcdef('0x3')]||'';this[_0xcdef('0x4')]=_0x1a2db3[_0xcdef('0x4')]||'';this[_0xcdef('0x5')]=_0x1a2db3['consumerSecret']||'';this[_0xcdef('0x6')]=_0x1a2db3['token']||'';this[_0xcdef('0x7')]=_0x1a2db3[_0xcdef('0x7')]||'';this[_0xcdef('0x8')]=_0x1a2db3['type']||'';this['serverUrl']=_0x1a2db3[_0xcdef('0x9')]||'';this['Configurations']=_0x1a2db3[_0xcdef('0xa')]||{};}module[_0xcdef('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 d96c3f8..b187ad5 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 _0x674e=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x5464b7,_0x578471){var _0x6d80c8=function(_0x335362){while(--_0x335362){_0x5464b7['push'](_0x5464b7['shift']());}};_0x6d80c8(++_0x578471);}(_0x674e,0x16f));var _0xe674=function(_0xedf374,_0x192408){_0xedf374=_0xedf374-0x0;var _0x20ffd9=_0x674e[_0xedf374];return _0x20ffd9;};'use strict';function Dynamics365Account(_0x5b4d69){this['id']=_0x5b4d69['id']||0x0;this['name']=_0x5b4d69[_0xe674('0x0')]||'';this['username']=_0x5b4d69[_0xe674('0x1')]||'';this[_0xe674('0x2')]=_0x5b4d69[_0xe674('0x2')]||'';this['remoteUri']=_0x5b4d69[_0xe674('0x3')]||'';this[_0xe674('0x4')]=_0x5b4d69[_0xe674('0x4')]||'';this[_0xe674('0x5')]=_0x5b4d69[_0xe674('0x5')]||'';this[_0xe674('0x6')]=_0x5b4d69[_0xe674('0x6')]||{};this[_0xe674('0x7')]=_0x5b4d69[_0xe674('0x7')]||'';this[_0xe674('0x8')]=_0x5b4d69[_0xe674('0x8')]||{};}module[_0xe674('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x5206=['serverUrl','Configurations','exports','name','username','remoteUri','tenantId','clientId','clientSecret'];(function(_0x96b6a,_0x12471d){var _0x3e16f3=function(_0xa1fc4b){while(--_0xa1fc4b){_0x96b6a['push'](_0x96b6a['shift']());}};_0x3e16f3(++_0x12471d);}(_0x5206,0x1aa));var _0x6520=function(_0x4d9e08,_0x4bc988){_0x4d9e08=_0x4d9e08-0x0;var _0x4ed12f=_0x5206[_0x4d9e08];return _0x4ed12f;};'use strict';function Dynamics365Account(_0x3bcb2f){this['id']=_0x3bcb2f['id']||0x0;this['name']=_0x3bcb2f[_0x6520('0x0')]||'';this['username']=_0x3bcb2f[_0x6520('0x1')]||'';this['password']=_0x3bcb2f['password']||'';this['remoteUri']=_0x3bcb2f[_0x6520('0x2')]||'';this[_0x6520('0x3')]=_0x3bcb2f[_0x6520('0x3')]||'';this[_0x6520('0x4')]=_0x3bcb2f[_0x6520('0x4')]||'';this['clientSecret']=_0x3bcb2f[_0x6520('0x5')]||{};this[_0x6520('0x6')]=_0x3bcb2f['serverUrl']||'';this[_0x6520('0x7')]=_0x3bcb2f[_0x6520('0x7')]||{};}module[_0x6520('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a8f54db..389d254 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 _0xf788=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','faxdetect'];(function(_0xcd0167,_0x2bab8d){var _0x6edd99=function(_0x4cfdba){while(--_0x4cfdba){_0xcd0167['push'](_0xcd0167['shift']());}};_0x6edd99(++_0x2bab8d);}(_0xf788,0x197));var _0x8f78=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xf788[_0x334841];return _0x5beb4b;};'use strict';function FaxAccount(_0x254327){this['id']=_0x254327['id']||0x0;this[_0x8f78('0x0')]=_0x254327['name']||'';this[_0x8f78('0x1')]=_0x254327[_0x8f78('0x1')];this[_0x8f78('0x2')]=_0x254327[_0x8f78('0x2')];this[_0x8f78('0x3')]=_0x254327[_0x8f78('0x3')];this['localstationid']=_0x254327[_0x8f78('0x4')];this[_0x8f78('0x5')]=_0x254327[_0x8f78('0x5')]||0x960;this['maxrate']=_0x254327[_0x8f78('0x6')]||0x3840;this[_0x8f78('0x7')]=_0x254327[_0x8f78('0x7')]||'v17,v27,v29';this['gateway']=_0x254327['gateway']||'no';this[_0x8f78('0x8')]=_0x254327[_0x8f78('0x8')]||'no';this[_0x8f78('0x9')]=_0x254327[_0x8f78('0x9')]||0x1388;this[_0x8f78('0xa')]=_0x254327[_0x8f78('0xa')]||_0x8f78('0xb');this['Trunk']=_0x254327[_0x8f78('0xc')]?_0x254327[_0x8f78('0xc')]:undefined;this[_0x8f78('0xd')]=_0x254327['ListId'];this[_0x8f78('0xe')]=_0x254327[_0x8f78('0xe')];}module[_0x8f78('0xf')]=FaxAccount; \ No newline at end of file +var _0x9582=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x58f279,_0x5defd6){var _0x593e2d=function(_0x40a40b){while(--_0x40a40b){_0x58f279['push'](_0x58f279['shift']());}};_0x593e2d(++_0x5defd6);}(_0x9582,0x95));var _0x2958=function(_0x40e2eb,_0x26631d){_0x40e2eb=_0x40e2eb-0x0;var _0x434e3f=_0x9582[_0x40e2eb];return _0x434e3f;};'use strict';function FaxAccount(_0x5f588a){this['id']=_0x5f588a['id']||0x0;this[_0x2958('0x0')]=_0x5f588a[_0x2958('0x0')]||'';this[_0x2958('0x1')]=_0x5f588a[_0x2958('0x1')];this[_0x2958('0x2')]=_0x5f588a['ecm'];this[_0x2958('0x3')]=_0x5f588a[_0x2958('0x3')];this[_0x2958('0x4')]=_0x5f588a[_0x2958('0x4')];this[_0x2958('0x5')]=_0x5f588a[_0x2958('0x5')]||0x960;this[_0x2958('0x6')]=_0x5f588a[_0x2958('0x6')]||0x3840;this[_0x2958('0x7')]=_0x5f588a[_0x2958('0x7')]||'v17,v27,v29';this['gateway']=_0x5f588a[_0x2958('0x8')]||'no';this['faxdetect']=_0x5f588a[_0x2958('0x9')]||'no';this['t38timeout']=_0x5f588a[_0x2958('0xa')]||0x1388;this['tech']=_0x5f588a[_0x2958('0xb')]||_0x2958('0xc');this[_0x2958('0xd')]=_0x5f588a[_0x2958('0xd')]?_0x5f588a[_0x2958('0xd')]:undefined;this['ListId']=_0x5f588a[_0x2958('0xe')];this[_0x2958('0xf')]=_0x5f588a[_0x2958('0xf')];}module[_0x2958('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f6c0ec2..0843de1 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 _0xf1bc=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf1bc,0xd3));var _0xcf1b=function(_0x5c733a,_0x453279){_0x5c733a=_0x5c733a-0x0;var _0xbee0e3=_0xf1bc[_0x5c733a];return _0xbee0e3;};'use strict';function FreshdeskAccount(_0x1597b8){this['id']=_0x1597b8['id']||0x0;this[_0xcf1b('0x0')]=_0x1597b8['name']||'';this[_0xcf1b('0x1')]=_0x1597b8[_0xcf1b('0x1')]||'';this[_0xcf1b('0x2')]=_0x1597b8[_0xcf1b('0x3')]||'';this['remoteUri']=_0x1597b8[_0xcf1b('0x4')]||'';this[_0xcf1b('0x5')]=_0x1597b8['serverUrl']||'';this[_0xcf1b('0x6')]=_0x1597b8[_0xcf1b('0x6')]||{};}module[_0xcf1b('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xe459=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x2f48a7,_0x54ea3c){var _0x3546f6=function(_0x2323d4){while(--_0x2323d4){_0x2f48a7['push'](_0x2f48a7['shift']());}};_0x3546f6(++_0x54ea3c);}(_0xe459,0x6a));var _0x9e45=function(_0x4ed32b,_0x3633bc){_0x4ed32b=_0x4ed32b-0x0;var _0x32fc96=_0xe459[_0x4ed32b];return _0x32fc96;};'use strict';function FreshdeskAccount(_0x50a621){this['id']=_0x50a621['id']||0x0;this[_0x9e45('0x0')]=_0x50a621['name']||'';this[_0x9e45('0x1')]=_0x50a621[_0x9e45('0x1')]||'';this[_0x9e45('0x2')]=_0x50a621[_0x9e45('0x3')]||'';this[_0x9e45('0x4')]=_0x50a621[_0x9e45('0x4')]||'';this['serverUrl']=_0x50a621[_0x9e45('0x5')]||'';this[_0x9e45('0x6')]=_0x50a621[_0x9e45('0x6')]||{};}module[_0x9e45('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b932ea1..183aada 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 _0x47a9=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x23ab78,_0x1278ec){var _0x560993=function(_0x5c0023){while(--_0x5c0023){_0x23ab78['push'](_0x23ab78['shift']());}};_0x560993(++_0x1278ec);}(_0x47a9,0x199));var _0x947a=function(_0x3b8c7a,_0x3343d5){_0x3b8c7a=_0x3b8c7a-0x0;var _0x38653b=_0x47a9[_0x3b8c7a];return _0x38653b;};'use strict';function FreshsalesAccount(_0x58b06a){this['id']=_0x58b06a['id']||0x0;this[_0x947a('0x0')]=_0x58b06a[_0x947a('0x0')]||'';this[_0x947a('0x1')]=_0x58b06a[_0x947a('0x1')]||'';this[_0x947a('0x2')]=_0x58b06a[_0x947a('0x3')]||'';this[_0x947a('0x4')]=_0x58b06a[_0x947a('0x4')]||'';this[_0x947a('0x5')]=_0x58b06a[_0x947a('0x5')]||'';this[_0x947a('0x6')]=_0x58b06a[_0x947a('0x6')]||{};}module[_0x947a('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x6590=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6590,0x74));var _0x0659=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x6590[_0xd09668];return _0x68726;};'use strict';function FreshsalesAccount(_0x1d0a68){this['id']=_0x1d0a68['id']||0x0;this[_0x0659('0x0')]=_0x1d0a68[_0x0659('0x0')]||'';this[_0x0659('0x1')]=_0x1d0a68['username']||'';this[_0x0659('0x2')]=_0x1d0a68['token']||'';this[_0x0659('0x3')]=_0x1d0a68['remoteUri']||'';this[_0x0659('0x4')]=_0x1d0a68[_0x0659('0x4')]||'';this['Configurations']=_0x1d0a68[_0x0659('0x5')]||{};}module[_0x0659('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 11fb54e..610b3eb 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 _0xf2c3=['originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','variables','exports','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x2c97f1,_0x74fc4c){var _0x41971a=function(_0x4586ec){while(--_0x4586ec){_0x2c97f1['push'](_0x2c97f1['shift']());}};_0x41971a(++_0x74fc4c);}(_0xf2c3,0x75));var _0x3f2c=function(_0x5cad2d,_0x21820a){_0x5cad2d=_0x5cad2d-0x0;var _0x1ab2a1=_0xf2c3[_0x5cad2d];return _0x1ab2a1;};'use strict';function QueueReport(){this['type']=_0x3f2c('0x0');this[_0x3f2c('0x1')]='';this['calleridnum']='';this[_0x3f2c('0x2')]='';this['queue']='';this[_0x3f2c('0x3')]=null;this[_0x3f2c('0x4')]=null;this[_0x3f2c('0x5')]=0x1;this[_0x3f2c('0x6')]=0x1;this[_0x3f2c('0x7')]=![];this[_0x3f2c('0x8')]=null;this[_0x3f2c('0x9')]=![];this[_0x3f2c('0xa')]=null;this[_0x3f2c('0xb')]=![];this[_0x3f2c('0xc')]=null;this[_0x3f2c('0xd')]=0x1;this[_0x3f2c('0xe')]='';this[_0x3f2c('0xf')]='';this[_0x3f2c('0x10')]='';this[_0x3f2c('0x11')]='';this[_0x3f2c('0x12')]='';this[_0x3f2c('0x13')]='';this[_0x3f2c('0x14')]='';this[_0x3f2c('0x15')]=0x0;this[_0x3f2c('0x16')]=![];this[_0x3f2c('0x17')]='';this['mohtime']=0x0;this[_0x3f2c('0x18')]={};}module[_0x3f2c('0x19')]=QueueReport; \ No newline at end of file +var _0xa345=['mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','lastAssignedTo'];(function(_0x1564aa,_0x2d3bff){var _0x12cdca=function(_0x56e1ee){while(--_0x56e1ee){_0x1564aa['push'](_0x1564aa['shift']());}};_0x12cdca(++_0x2d3bff);}(_0xa345,0x15b));var _0x5a34=function(_0x3e10dc,_0x230393){_0x3e10dc=_0x3e10dc-0x0;var _0x20020c=_0xa345[_0x3e10dc];return _0x20020c;};'use strict';function QueueReport(){this[_0x5a34('0x0')]=_0x5a34('0x1');this[_0x5a34('0x2')]='';this[_0x5a34('0x3')]='';this[_0x5a34('0x4')]='';this[_0x5a34('0x5')]='';this[_0x5a34('0x6')]=null;this[_0x5a34('0x7')]=null;this['position']=0x1;this['count']=0x1;this[_0x5a34('0x8')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x5a34('0x9')]=null;this[_0x5a34('0xa')]=![];this[_0x5a34('0xb')]=null;this[_0x5a34('0xc')]=0x1;this[_0x5a34('0xd')]='';this[_0x5a34('0xe')]='';this[_0x5a34('0xf')]='';this[_0x5a34('0x10')]='';this[_0x5a34('0x11')]='';this[_0x5a34('0x12')]='';this[_0x5a34('0x13')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x5a34('0x14')]='';this[_0x5a34('0x15')]=0x0;this['variables']={};}module[_0x5a34('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index e43bf9b..33f6c78 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 _0x38c7=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x38c7,0x88));var _0x738c=function(_0x30e870,_0x1e47a2){_0x30e870=_0x30e870-0x0;var _0x3857bf=_0x38c7[_0x30e870];return _0x3857bf;};'use strict';function SalesforceAccount(_0x48e2ca){this['id']=_0x48e2ca['id']||0x0;this[_0x738c('0x0')]=_0x48e2ca[_0x738c('0x0')]||'';this[_0x738c('0x1')]=_0x48e2ca['username']||'';this[_0x738c('0x2')]=_0x48e2ca['remoteUri']||'';this[_0x738c('0x3')]=_0x48e2ca['password']||'';this[_0x738c('0x4')]=_0x48e2ca[_0x738c('0x4')]||'';this[_0x738c('0x5')]=_0x48e2ca[_0x738c('0x5')]||'';this['securityToken']=_0x48e2ca[_0x738c('0x6')]||'';this[_0x738c('0x7')]=_0x48e2ca[_0x738c('0x7')]||_0x738c('0x8');this[_0x738c('0x9')]=_0x48e2ca[_0x738c('0x9')]||'';this[_0x738c('0xa')]=_0x48e2ca['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xad75=['clientSecret','securityToken','type','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x58239c,_0x44abea){var _0x593957=function(_0x21eef9){while(--_0x21eef9){_0x58239c['push'](_0x58239c['shift']());}};_0x593957(++_0x44abea);}(_0xad75,0xcd));var _0x5ad7=function(_0xee4b51,_0x82653a){_0xee4b51=_0xee4b51-0x0;var _0x5c4317=_0xad75[_0xee4b51];return _0x5c4317;};'use strict';function SalesforceAccount(_0x145254){this['id']=_0x145254['id']||0x0;this[_0x5ad7('0x0')]=_0x145254[_0x5ad7('0x0')]||'';this['username']=_0x145254[_0x5ad7('0x1')]||'';this[_0x5ad7('0x2')]=_0x145254[_0x5ad7('0x2')]||'';this[_0x5ad7('0x3')]=_0x145254[_0x5ad7('0x3')]||'';this[_0x5ad7('0x4')]=_0x145254[_0x5ad7('0x4')]||'';this[_0x5ad7('0x5')]=_0x145254['clientSecret']||'';this['securityToken']=_0x145254[_0x5ad7('0x6')]||'';this[_0x5ad7('0x7')]=_0x145254[_0x5ad7('0x7')]||'integrationTab';this[_0x5ad7('0x8')]=_0x145254['serverUrl']||'';this[_0x5ad7('0x9')]=_0x145254[_0x5ad7('0x9')]||{};}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 f69ca33..c914cd8 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 _0x8bdb=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x5b99c4,_0x271b5f){var _0xdc3a13=function(_0x242420){while(--_0x242420){_0x5b99c4['push'](_0x5b99c4['shift']());}};_0xdc3a13(++_0x271b5f);}(_0x8bdb,0x13f));var _0xb8bd=function(_0x2c8e3b,_0x27ace8){_0x2c8e3b=_0x2c8e3b-0x0;var _0xc193d7=_0x8bdb[_0x2c8e3b];return _0xc193d7;};'use strict';function ServicenowAccount(_0x556e58){this['id']=_0x556e58['id']||0x0;this[_0xb8bd('0x0')]=_0x556e58[_0xb8bd('0x0')]||'';this[_0xb8bd('0x1')]=_0x556e58[_0xb8bd('0x1')]||'';this[_0xb8bd('0x2')]=_0x556e58['password']||'';this[_0xb8bd('0x3')]=_0x556e58['remoteUri']||'';this[_0xb8bd('0x4')]=_0x556e58['serverUrl']||'';this[_0xb8bd('0x5')]=_0x556e58['Configurations']||{};}module[_0xb8bd('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xbcfb=['Configurations','name','password','serverUrl'];(function(_0x7b1a96,_0x1d6837){var _0xb6978d=function(_0xe3c9e5){while(--_0xe3c9e5){_0x7b1a96['push'](_0x7b1a96['shift']());}};_0xb6978d(++_0x1d6837);}(_0xbcfb,0xe5));var _0xbbcf=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xbcfb[_0x2f45ea];return _0x485a84;};'use strict';function ServicenowAccount(_0x4fd262){this['id']=_0x4fd262['id']||0x0;this['name']=_0x4fd262[_0xbbcf('0x0')]||'';this['username']=_0x4fd262['username']||'';this[_0xbbcf('0x1')]=_0x4fd262[_0xbbcf('0x1')]||'';this['remoteUri']=_0x4fd262['remoteUri']||'';this[_0xbbcf('0x2')]=_0x4fd262['serverUrl']||'';this[_0xbbcf('0x3')]=_0x4fd262['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 833f47b..a8fc18b 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 _0x4ca9=['username','password','remoteUri','serverUrl','exports','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4ca9,0x101));var _0x94ca=function(_0x29e2f1,_0x381235){_0x29e2f1=_0x29e2f1-0x0;var _0x41406c=_0x4ca9[_0x29e2f1];return _0x41406c;};'use strict';function SugarcrmAccount(_0x8b142b){this['id']=_0x8b142b['id']||0x0;this['name']=_0x8b142b[_0x94ca('0x0')]||'';this[_0x94ca('0x1')]=_0x8b142b[_0x94ca('0x1')]||'';this['password']=_0x8b142b[_0x94ca('0x2')]||'';this[_0x94ca('0x3')]=_0x8b142b[_0x94ca('0x3')]||'';this[_0x94ca('0x4')]=_0x8b142b[_0x94ca('0x4')]||'';this['Configurations']=_0x8b142b['Configurations']||{};}module[_0x94ca('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xd5e3=['password','remoteUri','Configurations','exports','name','username'];(function(_0x332173,_0x3069ff){var _0x1bf25f=function(_0x4dd55d){while(--_0x4dd55d){_0x332173['push'](_0x332173['shift']());}};_0x1bf25f(++_0x3069ff);}(_0xd5e3,0xac));var _0x3d5e=function(_0x25d45b,_0x290d6e){_0x25d45b=_0x25d45b-0x0;var _0x938248=_0xd5e3[_0x25d45b];return _0x938248;};'use strict';function SugarcrmAccount(_0x13137a){this['id']=_0x13137a['id']||0x0;this['name']=_0x13137a[_0x3d5e('0x0')]||'';this['username']=_0x13137a[_0x3d5e('0x1')]||'';this[_0x3d5e('0x2')]=_0x13137a[_0x3d5e('0x2')]||'';this[_0x3d5e('0x3')]=_0x13137a['remoteUri']||'';this['serverUrl']=_0x13137a['serverUrl']||'';this[_0x3d5e('0x4')]=_0x13137a[_0x3d5e('0x4')]||{};}module[_0x3d5e('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 42d9daf..1f501c6 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 _0x9c6a=['status','unknown','address','exports','name','accountcode','state'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x9c6a,0xf9));var _0xa9c6=function(_0x59d71c,_0x48f6b2){_0x59d71c=_0x59d71c-0x0;var _0x89dc2b=_0x9c6a[_0x59d71c];return _0x89dc2b;};'use strict';function Telephone(_0x1c4c58){this['id']=_0x1c4c58['id']||0x0;this[_0xa9c6('0x0')]=_0x1c4c58[_0xa9c6('0x0')]||'';this[_0xa9c6('0x1')]=_0x1c4c58['accountcode']||'';this[_0xa9c6('0x2')]='unknown';this['stateTime']=0x0;this[_0xa9c6('0x3')]=_0xa9c6('0x4');this[_0xa9c6('0x5')]='';}module[_0xa9c6('0x6')]=Telephone; \ No newline at end of file +var _0xf31e=['unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x40e6b5,_0x2df939){var _0x22bbf3=function(_0x2161a3){while(--_0x2161a3){_0x40e6b5['push'](_0x40e6b5['shift']());}};_0x22bbf3(++_0x2df939);}(_0xf31e,0x155));var _0xef31=function(_0x3c9cfb,_0x17f0d3){_0x3c9cfb=_0x3c9cfb-0x0;var _0x3cf507=_0xf31e[_0x3c9cfb];return _0x3cf507;};'use strict';function Telephone(_0x1fdc7a){this['id']=_0x1fdc7a['id']||0x0;this[_0xef31('0x0')]=_0x1fdc7a['name']||'';this[_0xef31('0x1')]=_0x1fdc7a[_0xef31('0x1')]||'';this['state']=_0xef31('0x2');this[_0xef31('0x3')]=0x0;this[_0xef31('0x4')]=_0xef31('0x2');this[_0xef31('0x5')]='';}module[_0xef31('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index dc66eed..a58e71a 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 _0x36e9=['name','html','exports'];(function(_0x2100d6,_0x55362c){var _0x298ddd=function(_0x7435e8){while(--_0x7435e8){_0x2100d6['push'](_0x2100d6['shift']());}};_0x298ddd(++_0x55362c);}(_0x36e9,0x150));var _0x936e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x36e9[_0x243b2f];return _0xcb3c2d;};'use strict';function template(_0x1f4b8c){this['id']=_0x1f4b8c['id']||0x0;this[_0x936e('0x0')]=_0x1f4b8c[_0x936e('0x0')]||'';this[_0x936e('0x1')]=_0x1f4b8c[_0x936e('0x1')]||'';}module[_0x936e('0x2')]=template; \ No newline at end of file +var _0x71a6=['name','html'];(function(_0x581917,_0x2862f0){var _0x1001ad=function(_0x1adb7d){while(--_0x1adb7d){_0x581917['push'](_0x581917['shift']());}};_0x1001ad(++_0x2862f0);}(_0x71a6,0x108));var _0x671a=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0x71a6[_0x25bca6];return _0x3f8d02;};'use strict';function template(_0x55b3ed){this['id']=_0x55b3ed['id']||0x0;this[_0x671a('0x0')]=_0x55b3ed[_0x671a('0x0')]||'';this[_0x671a('0x1')]=_0x55b3ed[_0x671a('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 481de22..ac638c7 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 _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x45cca8,_0x29f652){var _0x53d27b=function(_0x23d824){while(--_0x23d824){_0x45cca8['push'](_0x45cca8['shift']());}};_0x53d27b(++_0x29f652);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4533a5,_0x52661b){_0x4533a5=_0x4533a5-0x0;var _0x3ccf21=_0x8ef6[_0x4533a5];return _0x3ccf21;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('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 73c754c..a41c237 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 _0x852c=['registry','indexOf','split','host','port','refresh','exports','active','name','state','unknown'];(function(_0x3320c2,_0xff5beb){var _0x3b1945=function(_0x4465b0){while(--_0x4465b0){_0x3320c2['push'](_0x3320c2['shift']());}};_0x3b1945(++_0xff5beb);}(_0x852c,0xb7));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x4edca7){this['id']=_0x4edca7['id']||0x0;this[_0xc852('0x0')]=_0x4edca7['active']||![];this[_0xc852('0x1')]=_0x4edca7[_0xc852('0x1')]||'';this[_0xc852('0x2')]=_0xc852('0x3');this['stateTime']=0x0;this['status']=_0xc852('0x3');this['registry']=_0x4edca7[_0xc852('0x4')]&&_0x4edca7[_0xc852('0x4')][_0xc852('0x5')](':')?_0x4edca7[_0xc852('0x4')][_0xc852('0x6')](':')[0x0]:'';this[_0xc852('0x7')]='';this[_0xc852('0x8')]='';this['domain']='';this['domainport']='';this[_0xc852('0x9')]='';this['stateRegistry']=_0xc852('0x3');this['registrationtime']='';this['address']='';}module[_0xc852('0xa')]=Trunk; \ No newline at end of file +var _0x3d67=['name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','active'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3d67,0x16f));var _0x73d6=function(_0x48efda,_0x26821d){_0x48efda=_0x48efda-0x0;var _0x367206=_0x3d67[_0x48efda];return _0x367206;};'use strict';function Trunk(_0x180cad){this['id']=_0x180cad['id']||0x0;this[_0x73d6('0x0')]=_0x180cad['active']||![];this[_0x73d6('0x1')]=_0x180cad['name']||'';this[_0x73d6('0x2')]=_0x73d6('0x3');this[_0x73d6('0x4')]=0x0;this['status']=_0x73d6('0x3');this[_0x73d6('0x5')]=_0x180cad[_0x73d6('0x5')]&&_0x180cad[_0x73d6('0x5')][_0x73d6('0x6')](':')?_0x180cad[_0x73d6('0x5')][_0x73d6('0x7')](':')[0x0]:'';this[_0x73d6('0x8')]='';this[_0x73d6('0x9')]='';this[_0x73d6('0xa')]='';this[_0x73d6('0xb')]='';this[_0x73d6('0xc')]='';this[_0x73d6('0xd')]=_0x73d6('0x3');this[_0x73d6('0xe')]='';this[_0x73d6('0xf')]='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 788f6fe..1bba8f9 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 _0xc032=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x2e6481,_0x345ab6){var _0xdf6ba=function(_0x13e0cd){while(--_0x13e0cd){_0x2e6481['push'](_0x2e6481['shift']());}};_0xdf6ba(++_0x345ab6);}(_0xc032,0xed));var _0x2c03=function(_0x3d8b27,_0x1bbb90){_0x3d8b27=_0x3d8b27-0x0;var _0x4d90e8=_0xc032[_0x3d8b27];return _0x4d90e8;};'use strict';function voiceExtension(_0x2f8791){this['id']=_0x2f8791['id']||0x0;this['exten']=_0x2f8791[_0x2c03('0x0')]||'';this[_0x2c03('0x1')]=_0x2f8791['recordingFormat']||_0x2c03('0x2');this[_0x2c03('0x3')]=_0x2f8791[_0x2c03('0x3')]||![];}module[_0x2c03('0x4')]=voiceExtension; \ No newline at end of file +var _0xf233=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xf233,0x1b4));var _0x3f23=function(_0x2c6110,_0xb36e48){_0x2c6110=_0x2c6110-0x0;var _0xee1b35=_0xf233[_0x2c6110];return _0xee1b35;};'use strict';function voiceExtension(_0x179d85){this['id']=_0x179d85['id']||0x0;this['exten']=_0x179d85[_0x3f23('0x0')]||'';this[_0x3f23('0x1')]=_0x179d85['recordingFormat']||_0x3f23('0x2');this[_0x3f23('0x3')]=_0x179d85[_0x3f23('0x3')]||![];}module[_0x3f23('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ab683d6..51d529b 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 _0xdeaf=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xdeaf,0x115));var _0xfdea=function(_0x10742c,_0x2c116f){_0x10742c=_0x10742c-0x0;var _0x2df233=_0xdeaf[_0x10742c];return _0x2df233;};'use strict';var statusDesc=[_0xfdea('0x0'),'not_inuse','inuse',_0xfdea('0x1'),_0xfdea('0x2'),_0xfdea('0x3'),_0xfdea('0x4'),_0xfdea('0x5'),_0xfdea('0x6')];var monitorFormat={'wav':'wav','wav49':_0xfdea('0x7'),'gsm':_0xfdea('0x8')};var strategy={'rrmemory':_0xfdea('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0xbc05db){this['id']=_0xbc05db['id']||0x0;this[_0xfdea('0xa')]=_0xbc05db[_0xfdea('0xa')]||'';this[_0xfdea('0xb')]=_0xbc05db[_0xfdea('0xb')]||'';this['type']=_0xbc05db[_0xfdea('0xc')]||_0xfdea('0xd');this['waiting']=0x0;this[_0xfdea('0xe')]=0x0;this[_0xfdea('0xf')]=0x0;this[_0xfdea('0x10')]=0x0;this[_0xfdea('0x11')]=0x0;this[_0xfdea('0x12')]=0x0;this[_0xfdea('0x13')]=0x0;this['unmanaged']=0x0;this[_0xfdea('0x14')]=0x0;this[_0xfdea('0x15')]=0x0;this[_0xfdea('0x16')]=0x0;this['acw']=_0xbc05db[_0xfdea('0x17')]||![];this['acwTimeout']=_0xbc05db['acwTimeout']||0xa;this[_0xfdea('0x18')]=_0xbc05db['autopause']||'no';this[_0xfdea('0x19')]=!![];this[_0xfdea('0x1a')]='';this[_0xfdea('0x1b')]=0x0;this['temp']=0x0;this[_0xfdea('0x1c')]=_0xbc05db[_0xfdea('0x1c')]||null;this['dialGlobalInterval']=_0xbc05db[_0xfdea('0x1d')]?_0xbc05db[_0xfdea('0x1d')]:null;this[_0xfdea('0x1e')]=_0xbc05db[_0xfdea('0x1e')];this[_0xfdea('0x1f')]=_0xbc05db[_0xfdea('0x1f')]||'progressive';this[_0xfdea('0x20')]=_0xbc05db[_0xfdea('0x20')]||0x0;this['dialLimitQueue']=_0xbc05db[_0xfdea('0x21')]||0x0;this[_0xfdea('0x22')]=_0xbc05db['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0xbc05db[_0xfdea('0x23')]||_0xfdea('0x24');this[_0xfdea('0x25')]=_0xbc05db[_0xfdea('0x25')]||0.03;this[_0xfdea('0x26')]=_0xbc05db[_0xfdea('0x26')]||0x258;this[_0xfdea('0x27')]=_0xbc05db[_0xfdea('0x27')]||'anonymous';this[_0xfdea('0x28')]=_0xbc05db[_0xfdea('0x28')]||_0xfdea('0x29');this[_0xfdea('0x2a')]=_0xbc05db[_0xfdea('0x2a')]||0x1e;this[_0xfdea('0x2b')]=_0xbc05db[_0xfdea('0x2b')]||_0xfdea('0x2c');this[_0xfdea('0x2d')]=_0xbc05db[_0xfdea('0x2d')]||0x3;this[_0xfdea('0x2e')]=_0xbc05db[_0xfdea('0x2e')]||undefined;this[_0xfdea('0x2f')]=_0xbc05db[_0xfdea('0x2f')]||0x3;this[_0xfdea('0x30')]=_0xbc05db[_0xfdea('0x30')]||0x96;this[_0xfdea('0x31')]=_0xbc05db[_0xfdea('0x31')]||0x3;this[_0xfdea('0x32')]=_0xbc05db[_0xfdea('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0xbc05db[_0xfdea('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0xbc05db['dialNoAnswerRetryFrequency']||0x96;this[_0xfdea('0x34')]=_0xbc05db['dialNoSuchNumberMaxRetry']||0x3;this[_0xfdea('0x35')]=_0xbc05db[_0xfdea('0x35')]||0x96;this[_0xfdea('0x36')]=_0xbc05db[_0xfdea('0x36')]||0x3;this[_0xfdea('0x37')]=_0xbc05db[_0xfdea('0x37')]||0x96;this[_0xfdea('0x38')]=_0xbc05db[_0xfdea('0x38')]||0x3;this[_0xfdea('0x39')]=_0xbc05db[_0xfdea('0x39')]||0x96;this[_0xfdea('0x3a')]=_0xbc05db[_0xfdea('0x3a')]||0x3;this[_0xfdea('0x3b')]=_0xbc05db[_0xfdea('0x3b')]||0x96;this[_0xfdea('0x3c')]=_0xbc05db[_0xfdea('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0xbc05db[_0xfdea('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0xbc05db[_0xfdea('0x3e')]||0x4;this['Trunk']=_0xbc05db[_0xfdea('0x3f')]?_0xbc05db[_0xfdea('0x3f')]:undefined;this[_0xfdea('0x40')]=_0xbc05db[_0xfdea('0x40')]?_0xbc05db[_0xfdea('0x40')]:undefined;this[_0xfdea('0x41')]=_0xbc05db[_0xfdea('0x41')]||undefined;this[_0xfdea('0x42')]=_0xbc05db['Interval']?_0xbc05db[_0xfdea('0x42')]:undefined;this[_0xfdea('0x43')]=_0xbc05db['dialOrderByScheduledAt']||_0xfdea('0x44');this[_0xfdea('0x45')]=_0xbc05db['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xfdea('0x46')]=_0xbc05db[_0xfdea('0x46')]||undefined;this[_0xfdea('0x47')]=strategy[_0xbc05db[_0xfdea('0x47')]]||'rrmemory';this[_0xfdea('0x48')]=!![];this[_0xfdea('0x49')]=_0xbc05db[_0xfdea('0x49')]||![];this[_0xfdea('0x4a')]=_0xbc05db[_0xfdea('0x4a')];this[_0xfdea('0x4b')]=_0xbc05db['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0xbc05db[_0xfdea('0x4c')];this[_0xfdea('0x4d')]=_0xbc05db[_0xfdea('0x4d')];this[_0xfdea('0x4e')]=_0xbc05db[_0xfdea('0x4e')];this[_0xfdea('0x4f')]=_0xbc05db['dialAMDBetweenWordsSilence'];this[_0xfdea('0x50')]=_0xbc05db['dialAMDMaximumNumberOfWords'];this[_0xfdea('0x51')]=_0xbc05db[_0xfdea('0x51')];this[_0xfdea('0x52')]=_0xbc05db[_0xfdea('0x52')];this[_0xfdea('0x53')]=0x0;this[_0xfdea('0x54')]=0x0;this[_0xfdea('0x55')]=_0xbc05db[_0xfdea('0x55')];this[_0xfdea('0x56')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xfdea('0x57')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xfdea('0x58')]=0x0;this[_0xfdea('0x59')]=0x0;this[_0xfdea('0x5a')]=0x0;this[_0xfdea('0x5b')]=0x0;this[_0xfdea('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xfdea('0x5d')]=0x0;this[_0xfdea('0x5e')]=0x0;this[_0xfdea('0x5f')]=0x0;this[_0xfdea('0x60')]=0x0;this['startProgressive']=undefined;this[_0xfdea('0x61')]=undefined;this['handlePredictive']=undefined;this[_0xfdea('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xfdea('0x63')]=0x0;this[_0xfdea('0x64')]=0x0;this[_0xfdea('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xfdea('0x66')]=0x0;this[_0xfdea('0x67')]=0x0;this[_0xfdea('0x68')]=0x0;this[_0xfdea('0x69')]=_0xbc05db['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xfdea('0x6a')]=_0xbc05db[_0xfdea('0x6b')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xfdea('0x6c')]=0x0;this[_0xfdea('0x6d')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xfdea('0x6e')]=0x0;this[_0xfdea('0x6f')]=0x0;this['dialRecallMeTimeout']=_0xbc05db['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0xbc05db[_0xfdea('0x70')]||![];this[_0xfdea('0x71')]=_0xbc05db[_0xfdea('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0xbc05db[_0xfdea('0x72')]||![];this[_0xfdea('0x73')]=_0xbc05db[_0xfdea('0x73')]||![];this[_0xfdea('0xb')]=monitorFormat[_0xbc05db[_0xfdea('0xb')]]?monitorFormat[_0xbc05db[_0xfdea('0xb')]]:undefined;this['mandatoryDisposition']=_0xbc05db[_0xfdea('0x74')]||![];this[_0xfdea('0x75')]=_0xbc05db[_0xfdea('0x75')]?_0xbc05db[_0xfdea('0x75')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xfd1c=['inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','unavailable','ringing','onhold','wav','gsm','name','monitor_format','type'];(function(_0x5f046c,_0x53eb88){var _0x568032=function(_0x5aec71){while(--_0x5aec71){_0x5f046c['push'](_0x5f046c['shift']());}};_0x568032(++_0x53eb88);}(_0xfd1c,0x1b9));var _0xcfd1=function(_0x1bec0d,_0x338db4){_0x1bec0d=_0x1bec0d-0x0;var _0x49e3e3=_0xfd1c[_0x1bec0d];return _0x49e3e3;};'use strict';var statusDesc=[_0xcfd1('0x0'),'not_inuse',_0xcfd1('0x1'),_0xcfd1('0x2'),'invalid',_0xcfd1('0x3'),_0xcfd1('0x4'),'ringinuse',_0xcfd1('0x5')];var monitorFormat={'wav':_0xcfd1('0x6'),'wav49':'wav49','gsm':_0xcfd1('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x2fd423){this['id']=_0x2fd423['id']||0x0;this[_0xcfd1('0x8')]=_0x2fd423['name']||'';this[_0xcfd1('0x9')]=_0x2fd423[_0xcfd1('0x9')]||'';this[_0xcfd1('0xa')]=_0x2fd423[_0xcfd1('0xa')]||_0xcfd1('0xb');this[_0xcfd1('0xc')]=0x0;this['talking']=0x0;this[_0xcfd1('0xd')]=0x0;this[_0xcfd1('0xe')]=0x0;this['sumDuration']=0x0;this[_0xcfd1('0xf')]=0x0;this[_0xcfd1('0x10')]=0x0;this[_0xcfd1('0x11')]=0x0;this[_0xcfd1('0x12')]=0x0;this['loggedIn']=0x0;this[_0xcfd1('0x13')]=0x0;this[_0xcfd1('0x14')]=_0x2fd423['acw']||![];this[_0xcfd1('0x15')]=_0x2fd423[_0xcfd1('0x15')]||0xa;this[_0xcfd1('0x16')]=_0x2fd423[_0xcfd1('0x16')]||'no';this[_0xcfd1('0x17')]=!![];this[_0xcfd1('0x18')]='';this['originated']=0x0;this[_0xcfd1('0x19')]=0x0;this[_0xcfd1('0x1a')]=_0x2fd423[_0xcfd1('0x1a')]||null;this['dialGlobalInterval']=_0x2fd423[_0xcfd1('0x1b')]?_0x2fd423['dialGlobalInterval']:null;this[_0xcfd1('0x1c')]=_0x2fd423[_0xcfd1('0x1c')];this[_0xcfd1('0x1d')]=_0x2fd423[_0xcfd1('0x1d')]||'progressive';this[_0xcfd1('0x1e')]=_0x2fd423['dialLimitChannel']||0x0;this[_0xcfd1('0x1f')]=_0x2fd423[_0xcfd1('0x1f')]||0x0;this[_0xcfd1('0x20')]=_0x2fd423[_0xcfd1('0x20')]||0x1;this['dialPredictiveOptimization']=_0x2fd423[_0xcfd1('0x21')]||_0xcfd1('0x22');this[_0xcfd1('0x23')]=_0x2fd423['dialPredictiveOptimizationPercentage']||0.03;this[_0xcfd1('0x24')]=_0x2fd423['dialPredictiveInterval']||0x258;this[_0xcfd1('0x25')]=_0x2fd423[_0xcfd1('0x25')]||'anonymous';this[_0xcfd1('0x26')]=_0x2fd423[_0xcfd1('0x26')]||'anonymous';this[_0xcfd1('0x27')]=_0x2fd423[_0xcfd1('0x27')]||0x1e;this[_0xcfd1('0x28')]=_0x2fd423['dialQueueOptions']||_0xcfd1('0x29');this[_0xcfd1('0x2a')]=_0x2fd423['dialQueueTimeout']||0x3;this[_0xcfd1('0x2b')]=_0x2fd423['dialQueueProject']||undefined;this[_0xcfd1('0x2c')]=_0x2fd423[_0xcfd1('0x2c')]||0x3;this[_0xcfd1('0x2d')]=_0x2fd423[_0xcfd1('0x2d')]||0x96;this[_0xcfd1('0x2e')]=_0x2fd423[_0xcfd1('0x2e')]||0x3;this[_0xcfd1('0x2f')]=_0x2fd423[_0xcfd1('0x2f')]||0x96;this[_0xcfd1('0x30')]=_0x2fd423[_0xcfd1('0x30')]||0x3;this[_0xcfd1('0x31')]=_0x2fd423[_0xcfd1('0x31')]||0x96;this[_0xcfd1('0x32')]=_0x2fd423['dialNoSuchNumberMaxRetry']||0x3;this[_0xcfd1('0x33')]=_0x2fd423[_0xcfd1('0x33')]||0x96;this[_0xcfd1('0x34')]=_0x2fd423[_0xcfd1('0x34')]||0x3;this[_0xcfd1('0x35')]=_0x2fd423[_0xcfd1('0x35')]||0x96;this['dialAbandonedMaxRetry']=_0x2fd423[_0xcfd1('0x36')]||0x3;this['dialAbandonedRetryFrequency']=_0x2fd423[_0xcfd1('0x37')]||0x96;this[_0xcfd1('0x38')]=_0x2fd423['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2fd423[_0xcfd1('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x2fd423['dialAgentRejectMaxRetry']||0x3;this[_0xcfd1('0x3a')]=_0x2fd423['dialAgentRejectRetryFrequency']||0x96;this[_0xcfd1('0x3b')]=_0x2fd423[_0xcfd1('0x3b')]||0x4;this['Trunk']=_0x2fd423[_0xcfd1('0x3c')]?_0x2fd423['Trunk']:undefined;this[_0xcfd1('0x3d')]=_0x2fd423[_0xcfd1('0x3d')]?_0x2fd423[_0xcfd1('0x3d')]:undefined;this[_0xcfd1('0x3e')]=_0x2fd423['dialPrefix']||undefined;this[_0xcfd1('0x3f')]=_0x2fd423[_0xcfd1('0x3f')]?_0x2fd423[_0xcfd1('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x2fd423[_0xcfd1('0x40')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x2fd423['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x2fd423['dialCutDigit']||undefined;this[_0xcfd1('0x41')]=strategy[_0x2fd423['strategy']]||'rrmemory';this[_0xcfd1('0x42')]=!![];this[_0xcfd1('0x43')]=_0x2fd423[_0xcfd1('0x43')]||![];this[_0xcfd1('0x44')]=_0x2fd423['dialAMDInitialSilence'];this[_0xcfd1('0x45')]=_0x2fd423[_0xcfd1('0x45')];this[_0xcfd1('0x46')]=_0x2fd423[_0xcfd1('0x46')];this[_0xcfd1('0x47')]=_0x2fd423[_0xcfd1('0x47')];this[_0xcfd1('0x48')]=_0x2fd423[_0xcfd1('0x48')];this[_0xcfd1('0x49')]=_0x2fd423[_0xcfd1('0x49')];this[_0xcfd1('0x4a')]=_0x2fd423['dialAMDMaximumNumberOfWords'];this[_0xcfd1('0x4b')]=_0x2fd423[_0xcfd1('0x4b')];this[_0xcfd1('0x4c')]=_0x2fd423[_0xcfd1('0x4c')];this[_0xcfd1('0x4d')]=0x0;this[_0xcfd1('0x4e')]=0x0;this[_0xcfd1('0x4f')]=_0x2fd423['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xcfd1('0x50')]=0x0;this[_0xcfd1('0x51')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xcfd1('0x52')]=0x0;this[_0xcfd1('0x53')]=0x0;this[_0xcfd1('0x54')]=0x0;this[_0xcfd1('0x55')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xcfd1('0x56')]=0x0;this[_0xcfd1('0x57')]=0x0;this[_0xcfd1('0x58')]=undefined;this[_0xcfd1('0x59')]=undefined;this['handlePredictive']=undefined;this[_0xcfd1('0x5a')]=1.05;this[_0xcfd1('0x5b')]=0x0;this[_0xcfd1('0x5c')]=0x0;this[_0xcfd1('0x5d')]=0x0;this[_0xcfd1('0x5e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xcfd1('0x5f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xcfd1('0x60')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2fd423[_0xcfd1('0x61')]||0x14;this[_0xcfd1('0x62')]=_0x2fd423[_0xcfd1('0x61')]||0xa;this[_0xcfd1('0x63')]=0x0;this[_0xcfd1('0x64')]=0x0;this[_0xcfd1('0x65')]=0x1;this[_0xcfd1('0x66')]=0x0;this[_0xcfd1('0x67')]=0x0;this[_0xcfd1('0x68')]=0x0;this[_0xcfd1('0x69')]=0x0;this['dialRecallMeTimeout']=_0x2fd423[_0xcfd1('0x6a')]||0x1e;this[_0xcfd1('0x6b')]=_0x2fd423['dialRecallInQueue']||![];this[_0xcfd1('0x6c')]=_0x2fd423['dialQueueProject2']||undefined;this[_0xcfd1('0x6d')]=_0x2fd423[_0xcfd1('0x6d')]||![];this[_0xcfd1('0x6e')]=_0x2fd423[_0xcfd1('0x6e')]||![];this[_0xcfd1('0x9')]=monitorFormat[_0x2fd423['monitor_format']]?monitorFormat[_0x2fd423['monitor_format']]:undefined;this[_0xcfd1('0x6f')]=_0x2fd423['mandatoryDisposition']||![];this[_0xcfd1('0x70')]=_0x2fd423[_0xcfd1('0x70')]?_0x2fd423['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e24405a..1e0b826 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 _0xacfe=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xacfe,0xfd));var _0xeacf=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xacfe[_0x28947d];return _0x12d2ee;};'use strict';function VtigerAccount(_0x15c459){this['id']=_0x15c459['id']||0x0;this['name']=_0x15c459[_0xeacf('0x0')]||'';this[_0xeacf('0x1')]=_0x15c459[_0xeacf('0x1')]||'';this[_0xeacf('0x2')]=_0x15c459[_0xeacf('0x2')]||'';this[_0xeacf('0x3')]=_0x15c459[_0xeacf('0x3')]||'';this[_0xeacf('0x4')]=_0x15c459[_0xeacf('0x4')]||'';this[_0xeacf('0x5')]=_0x15c459[_0xeacf('0x5')]||{};}module[_0xeacf('0x6')]=VtigerAccount; \ No newline at end of file +var _0x0491=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0491,0x142));var _0x1049=function(_0x3c567e,_0x4c1442){_0x3c567e=_0x3c567e-0x0;var _0x401953=_0x0491[_0x3c567e];return _0x401953;};'use strict';function VtigerAccount(_0x45532a){this['id']=_0x45532a['id']||0x0;this[_0x1049('0x0')]=_0x45532a['name']||'';this[_0x1049('0x1')]=_0x45532a['username']||'';this[_0x1049('0x2')]=_0x45532a[_0x1049('0x2')]||'';this[_0x1049('0x3')]=_0x45532a[_0x1049('0x3')]||'';this[_0x1049('0x4')]=_0x45532a[_0x1049('0x4')]||'';this['Configurations']=_0x45532a[_0x1049('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 283dc68..957702e 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x51a28a,_0x4b328d){_0x51a28a=_0x51a28a-0x0;var _0x50928c=_0xadb5[_0x51a28a];return _0x50928c;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x35cb51,_0x1ea79e){var _0x127f33=function(_0x1a48ab){while(--_0x1a48ab){_0x35cb51['push'](_0x35cb51['shift']());}};_0x127f33(++_0x1ea79e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 3684c8a..bd75ce3 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 _0x7177=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x3e7b86,_0x3a4c16){var _0x56ef5d=function(_0x29c0f0){while(--_0x29c0f0){_0x3e7b86['push'](_0x3e7b86['shift']());}};_0x56ef5d(++_0x3a4c16);}(_0x7177,0x101));var _0x7717=function(_0xd29892,_0x2b67b9){_0xd29892=_0xd29892-0x0;var _0x293dfd=_0x7177[_0xd29892];return _0x293dfd;};'use strict';function ZohoAccount(_0x212326){this['id']=_0x212326['id']||0x0;this['name']=_0x212326[_0x7717('0x0')]||'';this['description']=_0x212326[_0x7717('0x1')]||'';this[_0x7717('0x2')]=_0x212326['host']||'';this[_0x7717('0x3')]=_0x212326[_0x7717('0x3')]||'';this['clientId']=_0x212326[_0x7717('0x4')]||'';this[_0x7717('0x5')]=_0x212326[_0x7717('0x5')]||'';this[_0x7717('0x6')]=_0x212326[_0x7717('0x6')]||'';this[_0x7717('0x7')]=_0x212326[_0x7717('0x7')]||'';this[_0x7717('0x8')]=_0x212326[_0x7717('0x8')]||'';this[_0x7717('0x9')]=_0x212326[_0x7717('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xdef9=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x220b5f,_0x10f186){var _0x28389e=function(_0x10de49){while(--_0x10de49){_0x220b5f['push'](_0x220b5f['shift']());}};_0x28389e(++_0x10f186);}(_0xdef9,0x1ed));var _0x9def=function(_0x7f816c,_0x25f12e){_0x7f816c=_0x7f816c-0x0;var _0x9106ca=_0xdef9[_0x7f816c];return _0x9106ca;};'use strict';function ZohoAccount(_0x5154d0){this['id']=_0x5154d0['id']||0x0;this[_0x9def('0x0')]=_0x5154d0[_0x9def('0x0')]||'';this[_0x9def('0x1')]=_0x5154d0[_0x9def('0x1')]||'';this[_0x9def('0x2')]=_0x5154d0[_0x9def('0x2')]||'';this[_0x9def('0x3')]=_0x5154d0[_0x9def('0x3')]||'';this[_0x9def('0x4')]=_0x5154d0[_0x9def('0x4')]||'';this[_0x9def('0x5')]=_0x5154d0[_0x9def('0x5')]||'';this[_0x9def('0x6')]=_0x5154d0[_0x9def('0x6')]||'';this[_0x9def('0x7')]=_0x5154d0[_0x9def('0x7')]||'';this[_0x9def('0x8')]=_0x5154d0[_0x9def('0x8')]||'';this['Configurations']=_0x5154d0[_0x9def('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 43b1667..ef138d9 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 _0x59ff=['countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x59ff,0xc7));var _0xf59f=function(_0x4847e5,_0xf79748){_0x4847e5=_0x4847e5-0x0;var _0x568f15=_0x59ff[_0x4847e5];return _0x568f15;};'use strict';var util=require('util');var _=require(_0xf59f('0x0'));var moment=require(_0xf59f('0x1'));function checkNameSurname(_0x342d19,_0x555bba,_0x590752){var _0x2686a9='';if(!_[_0xf59f('0x2')](_0x555bba)&&_0xf59f('0x3')===typeof _0x555bba){_0x2686a9+=_0x555bba;}if(!_['isNil'](_0x590752)&&_0xf59f('0x3')===typeof _0x590752){_0x2686a9+='\x20'+_0x590752;}if(_0x2686a9!==''){return _0x2686a9;}return _0x342d19;}function Action(_0x353c85,_0x391a2b,_0x70dd2d,_0x27fd33,_0x4a17a0){this[_0xf59f('0x4')]=_0x70dd2d||undefined;this[_0xf59f('0x5')]=_0x353c85['id'];this[_0xf59f('0x6')]=_0x391a2b[_0xf59f('0x7')];this[_0xf59f('0x8')]=_0x391a2b[_0xf59f('0x8')];this[_0xf59f('0x9')]=_0xf59f('0x6');this[_0xf59f('0xa')]=![];this[_0xf59f('0xb')]=_[_0xf59f('0x2')](_0x353c85[_0xf59f('0xc')])?undefined:_0x353c85['Agent'][_0xf59f('0x7')];this[_0xf59f('0xd')]=this[_0xf59f('0xb')]?util['format'](_0xf59f('0xe'),this[_0xf59f('0xb')]):_0x27fd33||undefined;this[_0xf59f('0xf')]=checkNameSurname(_0x353c85[_0xf59f('0x10')][_0xf59f('0x11')],_0x353c85[_0xf59f('0x10')][_0xf59f('0x12')],_0x353c85[_0xf59f('0x10')]['lastName']);this[_0xf59f('0x13')]=_0x353c85[_0xf59f('0x13')]||![];this[_0xf59f('0x14')]=_0x353c85[_0xf59f('0x10')][_0xf59f('0x11')];this[_0xf59f('0x15')]=_0x353c85['scheduledat'];this[_0xf59f('0x16')]=_0x353c85[_0xf59f('0x16')]||0x0;this[_0xf59f('0x17')]=_0x353c85['countcongestionretry']||0x0;this[_0xf59f('0x18')]=_0x353c85[_0xf59f('0x18')]||0x0;this[_0xf59f('0x19')]=(_0x353c85[_0xf59f('0x16')]||0x0)+(_0x353c85[_0xf59f('0x17')]||0x0)+(_0x353c85[_0xf59f('0x18')]||0x0)+(_0x353c85[_0xf59f('0x1a')]||0x0)+(_0x353c85[_0xf59f('0x1b')]||0x0)+(_0x353c85['countabandonedretry']||0x0)+(_0x353c85['countmachineretry']||0x0)+(_0x353c85[_0xf59f('0x1c')]||0x0);this[_0xf59f('0x1a')]=_0x353c85[_0xf59f('0x1a')]||0x0;this[_0xf59f('0x1b')]=_0x353c85[_0xf59f('0x1b')]||0x0;this['countabandonedretry']=_0x353c85[_0xf59f('0x1d')]||0x0;this['countmachineretry']=_0x353c85[_0xf59f('0x1e')]||0x0;this[_0xf59f('0x1c')]=_0x353c85[_0xf59f('0x1c')]||0x0;this[_0xf59f('0x1f')]=_0x353c85[_0xf59f('0x1f')];this[_0xf59f('0x20')]=_0x353c85[_0xf59f('0x20')];this[_0xf59f('0x21')]=_0x353c85[_0xf59f('0x21')];this[_0xf59f('0x22')]=_0x353c85[_0xf59f('0x22')];this[_0xf59f('0x23')]=_0x353c85[_0xf59f('0x23')];this[_0xf59f('0x24')]=_0x353c85[_0xf59f('0x24')];this[_0xf59f('0x25')]=_['isNil'](_0x353c85['Agent'])?_0x353c85[_0xf59f('0x25')]:_0x353c85[_0xf59f('0xc')]['id'];this[_0xf59f('0x26')]=_0x353c85[_0xf59f('0x26')];this[_0xf59f('0x27')]='';this[_0xf59f('0x28')]='';}Action[_0xf59f('0x29')][_0xf59f('0x2a')]=function(){return util[_0xf59f('0x2b')]('\x22%s\x22\x20<%s>',this[_0xf59f('0xf')],this['number']);};module[_0xf59f('0x2c')]=Action; \ No newline at end of file +var _0xcddf=['countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','number','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xcddf,0x170));var _0xfcdd=function(_0x39cd03,_0x318d57){_0x39cd03=_0x39cd03-0x0;var _0x55bd2a=_0xcddf[_0x39cd03];return _0x55bd2a;};'use strict';var util=require('util');var _=require(_0xfcdd('0x0'));var moment=require('moment');function checkNameSurname(_0x7ca08b,_0x1d9ff2,_0x593ea7){var _0x4960cd='';if(!_[_0xfcdd('0x1')](_0x1d9ff2)&&_0xfcdd('0x2')===typeof _0x1d9ff2){_0x4960cd+=_0x1d9ff2;}if(!_['isNil'](_0x593ea7)&&_0xfcdd('0x2')===typeof _0x593ea7){_0x4960cd+='\x20'+_0x593ea7;}if(_0x4960cd!==''){return _0x4960cd;}return _0x7ca08b;}function Action(_0x184a38,_0x1506c0,_0x292a72,_0x2eebae,_0xb2b7c1){this[_0xfcdd('0x3')]=_0x292a72||undefined;this[_0xfcdd('0x4')]=_0x184a38['id'];this[_0xfcdd('0x5')]=_0x1506c0[_0xfcdd('0x6')];this['type']=_0x1506c0[_0xfcdd('0x7')];this[_0xfcdd('0x8')]='queue';this[_0xfcdd('0x9')]=![];this['membername']=_['isNil'](_0x184a38[_0xfcdd('0xa')])?undefined:_0x184a38[_0xfcdd('0xa')][_0xfcdd('0x6')];this[_0xfcdd('0xb')]=this[_0xfcdd('0xc')]?util[_0xfcdd('0xd')](_0xfcdd('0xe'),this[_0xfcdd('0xc')]):_0x2eebae||undefined;this[_0xfcdd('0xf')]=checkNameSurname(_0x184a38[_0xfcdd('0x10')][_0xfcdd('0x11')],_0x184a38['Contact'][_0xfcdd('0x12')],_0x184a38[_0xfcdd('0x10')][_0xfcdd('0x13')]);this[_0xfcdd('0x14')]=_0x184a38['active']||![];this[_0xfcdd('0x15')]=_0x184a38[_0xfcdd('0x10')][_0xfcdd('0x11')];this[_0xfcdd('0x16')]=_0x184a38['scheduledat'];this[_0xfcdd('0x17')]=_0x184a38[_0xfcdd('0x17')]||0x0;this['countcongestionretry']=_0x184a38[_0xfcdd('0x18')]||0x0;this[_0xfcdd('0x19')]=_0x184a38[_0xfcdd('0x19')]||0x0;this[_0xfcdd('0x1a')]=(_0x184a38['countbusyretry']||0x0)+(_0x184a38[_0xfcdd('0x18')]||0x0)+(_0x184a38[_0xfcdd('0x19')]||0x0)+(_0x184a38['countnosuchnumberretry']||0x0)+(_0x184a38[_0xfcdd('0x1b')]||0x0)+(_0x184a38[_0xfcdd('0x1c')]||0x0)+(_0x184a38[_0xfcdd('0x1d')]||0x0)+(_0x184a38['countagentrejectretry']||0x0);this[_0xfcdd('0x1e')]=_0x184a38[_0xfcdd('0x1e')]||0x0;this[_0xfcdd('0x1b')]=_0x184a38[_0xfcdd('0x1b')]||0x0;this['countabandonedretry']=_0x184a38[_0xfcdd('0x1c')]||0x0;this[_0xfcdd('0x1d')]=_0x184a38[_0xfcdd('0x1d')]||0x0;this['countagentrejectretry']=_0x184a38[_0xfcdd('0x1f')]||0x0;this['callback']=_0x184a38[_0xfcdd('0x20')];this['callbackuniqueid']=_0x184a38[_0xfcdd('0x21')];this[_0xfcdd('0x22')]=_0x184a38[_0xfcdd('0x22')];this[_0xfcdd('0x23')]=_0x184a38['recallme'];this[_0xfcdd('0x24')]=_0x184a38[_0xfcdd('0x24')];this['ListId']=_0x184a38[_0xfcdd('0x25')];this['UserId']=_[_0xfcdd('0x1')](_0x184a38[_0xfcdd('0xa')])?_0x184a38[_0xfcdd('0x26')]:_0x184a38['Agent']['id'];this[_0xfcdd('0x27')]=_0x184a38['VoiceQueueId'];this[_0xfcdd('0x28')]='';this[_0xfcdd('0x29')]='';}Action['prototype'][_0xfcdd('0x2a')]=function(){return util[_0xfcdd('0xd')]('\x22%s\x22\x20<%s>',this[_0xfcdd('0xf')],this[_0xfcdd('0x2b')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index faf2b0a..67b5591 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 _0xdcdb=['callProgressDetectingAgent','isUndefined','object','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','then','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','response','rejected','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','idContact','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','tail','finally','sequence','campaignsPreview','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','getContactRecallMe','agentReadyId','agents','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentcomplete','complete','outboundAnswerCallsDay','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','CONGESTION','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0xdcdb,0x64));var _0xbdcd=function(_0xdde73a,_0x4f5163){_0xdde73a=_0xdde73a-0x0;var _0x5216b4=_0xdcdb[_0xdde73a];return _0x5216b4;};'use strict';var util=require(_0xbdcd('0x0'));var _=require(_0xbdcd('0x1'));var BPromise=require(_0xbdcd('0x2'));var uuid=require(_0xbdcd('0x3'));var moment=require(_0xbdcd('0x4'));var md5=require(_0xbdcd('0x5'));var Redis=require(_0xbdcd('0x6'));var config=require(_0xbdcd('0x7'));var logger=require(_0xbdcd('0x8'))(_0xbdcd('0x9'));var loggerAction=require(_0xbdcd('0x8'))(_0xbdcd('0xa'));var ami=require(_0xbdcd('0xb'));var rpcDb=require(_0xbdcd('0xc'));var Action=require(_0xbdcd('0xd'));var ut=require(_0xbdcd('0xe'));config[_0xbdcd('0xf')]=_[_0xbdcd('0x10')](config[_0xbdcd('0xf')],{'host':_0xbdcd('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbdcd('0xf')]));var Sequence=function(){};Sequence[_0xbdcd('0x12')]['enqueue']=function(_0xb2dbbb){this[_0xbdcd('0x13')]=this[_0xbdcd('0x13')]?this[_0xbdcd('0x13')][_0xbdcd('0x14')](_0xb2dbbb):_0xb2dbbb();};function Preview(_0x18ea8d){this[_0xbdcd('0x15')]=new Sequence();this[_0xbdcd('0x16')]=_0x18ea8d['voiceQueues'];this[_0xbdcd('0x17')]=_0x18ea8d['trunks'];this[_0xbdcd('0x18')]={};this['agents']=_0x18ea8d['agents'];this[_0xbdcd('0x19')]=0x0;ami['on']('originateresponse',this[_0xbdcd('0x1a')][_0xbdcd('0x1b')](this));ami['on']('hangup',this[_0xbdcd('0x1c')][_0xbdcd('0x1b')](this));ami['on'](_0xbdcd('0x1d'),this[_0xbdcd('0x1e')]['bind'](this));ami['on'](_0xbdcd('0x1f'),this[_0xbdcd('0x20')][_0xbdcd('0x1b')](this));ami['on'](_0xbdcd('0x21'),this[_0xbdcd('0x22')][_0xbdcd('0x1b')](this));ami['on'](_0xbdcd('0x23'),this[_0xbdcd('0x24')][_0xbdcd('0x1b')](this));ami['on'](_0xbdcd('0x25'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0xbdcd('0x26')][_0xbdcd('0x1b')](this));this[_0xbdcd('0x27')](this[_0xbdcd('0x16')]);}function emit(_0x2835b4,_0x2111c9,_0x4c3686){io['to'](_0x2835b4)[_0xbdcd('0x28')](_0x2111c9,_0x4c3686);}function emitCampaignPreview(_0x30bb5e){if(_0x30bb5e[_0xbdcd('0x29')]===_0xbdcd('0x2a')){var _0x143e03={'id':_0x30bb5e['id'],'name':_0x30bb5e[_0xbdcd('0x2b')],'strategy':_0x30bb5e[_0xbdcd('0x2c')],'answered':_0x30bb5e[_0xbdcd('0x2d')],'available':_0x30bb5e[_0xbdcd('0x2e')],'loggedIn':_0x30bb5e['loggedIn'],'pTalking':_0x30bb5e[_0xbdcd('0x2f')],'sumBillable':_0x30bb5e[_0xbdcd('0x30')],'sumDuration':_0x30bb5e[_0xbdcd('0x31')],'sumHoldTime':_0x30bb5e[_0xbdcd('0x32')]||0x0,'talking':_0x30bb5e[_0xbdcd('0x33')],'total':_0x30bb5e[_0xbdcd('0x34')],'type':_0x30bb5e[_0xbdcd('0x29')],'unmanaged':_0x30bb5e['unmanaged'],'abandoned':_0x30bb5e['abandoned'],'waiting':_0x30bb5e['waiting'],'loggedInDb':_0x30bb5e['loggedInDb'],'dialActive':_0x30bb5e['dialActive'],'dialMethod':_0x30bb5e[_0xbdcd('0x35')],'dialOriginateCallerIdName':_0x30bb5e[_0xbdcd('0x36')],'dialOriginateCallerIdNumber':_0x30bb5e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x30bb5e[_0xbdcd('0x37')],'dialPrefix':_0x30bb5e[_0xbdcd('0x38')],'outboundAnswerAgiCallsDay':_0x30bb5e[_0xbdcd('0x39')],'outboundAnswerCallsDay':_0x30bb5e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x30bb5e[_0xbdcd('0x3a')],'outboundBusyCallsDay':_0x30bb5e[_0xbdcd('0x3b')],'outboundCongestionCallsDay':_0x30bb5e[_0xbdcd('0x3c')],'outboundDropCallsDayACS':_0x30bb5e['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x30bb5e[_0xbdcd('0x3d')],'outboundDropCallsDayTimeout':_0x30bb5e[_0xbdcd('0x3e')],'outboundNoAnswerCallsDay':_0x30bb5e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x30bb5e[_0xbdcd('0x3f')],'outboundOriginateFailureCallsDay':_0x30bb5e[_0xbdcd('0x40')],'outboundReCallsDay':_0x30bb5e[_0xbdcd('0x41')],'outboundRejectCallsDay':_0x30bb5e[_0xbdcd('0x42')],'outboundUnknownCallsDay':_0x30bb5e[_0xbdcd('0x43')],'outboundAbandonedCallsDay':_0x30bb5e[_0xbdcd('0x44')],'predictiveIntervalAnsweredCalls':_0x30bb5e[_0xbdcd('0x45')],'predictiveIntervalAvgHoldtime':_0x30bb5e[_0xbdcd('0x46')],'predictiveIntervalAvgTalktime':_0x30bb5e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x30bb5e[_0xbdcd('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x30bb5e[_0xbdcd('0x48')],'predictiveIntervalErlangCalls':_0x30bb5e['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x30bb5e[_0xbdcd('0x49')],'predictiveIntervalHitRate':_0x30bb5e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x30bb5e['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x30bb5e[_0xbdcd('0x4a')],'predictiveIntervalAvailable':_0x30bb5e[_0xbdcd('0x4b')],'predictiveIntervalTotalCalls':_0x30bb5e[_0xbdcd('0x4c')],'message':_0x30bb5e[_0xbdcd('0x4d')],'originated':_0x30bb5e['originated'],'erlangCalls':_0x30bb5e[_0xbdcd('0x4e')],'erlangCallToSecond':_0x30bb5e[_0xbdcd('0x4f')],'erlangAbandonmentRate':_0x30bb5e['erlangAbandonmentRate'],'erlangBusyFactor':_0x30bb5e[_0xbdcd('0x50')],'startPredictive':_0x30bb5e[_0xbdcd('0x51')],'startProgressive':_0x30bb5e['startProgressive']};if(_0x30bb5e[_0xbdcd('0x52')]){_0x143e03[_0xbdcd('0x52')]={'id':_0x30bb5e[_0xbdcd('0x52')]['id'],'name':_0x30bb5e[_0xbdcd('0x52')][_0xbdcd('0x2b')],'active':_0x30bb5e[_0xbdcd('0x52')][_0xbdcd('0x53')],'callerid':_0x30bb5e[_0xbdcd('0x52')][_0xbdcd('0x54')]};}if(_0x30bb5e[_0xbdcd('0x55')]){_0x143e03[_0xbdcd('0x55')]={'id':_0x30bb5e[_0xbdcd('0x55')]['id'],'name':_0x30bb5e[_0xbdcd('0x55')]['name']};}var _0x6fb1c4=md5(JSON[_0xbdcd('0x56')](_0x143e03));if(_0x30bb5e[_0xbdcd('0x5')]!==_0x6fb1c4){_0x30bb5e[_0xbdcd('0x5')]=_0x6fb1c4;emit(util[_0xbdcd('0x57')]('voice:queue:%s',_0x143e03[_0xbdcd('0x2b')]),_0xbdcd('0x58'),_0x143e03);}}}function emitVoiceQueueChannelRemove(_0x1e85e3){logger[_0xbdcd('0x59')](_0xbdcd('0x5a'),JSON[_0xbdcd('0x56')](_0x1e85e3));emit(util[_0xbdcd('0x57')](_0xbdcd('0x5b'),_0x1e85e3['name']),_0xbdcd('0x5c'),_0x1e85e3);this[_0xbdcd('0x28')](_0xbdcd('0x5d'),_0x1e85e3);}function notSendMessagesQueue(_0xaada6){if(_0xaada6[_0xbdcd('0x5e')]){if(_0xaada6[_0xbdcd('0x5f')]===0x0&&_0xaada6[_0xbdcd('0x2f')]===0x0){_0xaada6[_0xbdcd('0x5e')]=![];_0xaada6['available']=0x0;_0xaada6[_0xbdcd('0x60')]=0x0;_0xaada6[_0xbdcd('0x4d')]=_0xbdcd('0x61');ut[_0xbdcd('0x62')](_0xbdcd('0x63'),_0xaada6[_0xbdcd('0x2b')]+_0xbdcd('0x64'));}else{_0xaada6['message']=_0xbdcd('0x65');ut[_0xbdcd('0x62')](_0xbdcd('0x63'),_0xaada6[_0xbdcd('0x2b')]+_0xbdcd('0x66'));}emitCampaignPreview(_0xaada6);}}Preview['prototype']['loopCampaigns']=function(){var _0x3b5d3a=this;setInterval(function(){_0x3b5d3a[_0xbdcd('0x67')]();},0x7cf);};Preview[_0xbdcd('0x12')][_0xbdcd('0x67')]=function(){var _0x5bb967=this[_0xbdcd('0x16')];this[_0xbdcd('0x19')]+=0x1;for(var _0x2fbe77 in _0x5bb967){if(_0x5bb967['hasOwnProperty'](_0x2fbe77)&&(_0x5bb967[_0x2fbe77][_0xbdcd('0x35')]==='preview'||_0x5bb967[_0x2fbe77][_0xbdcd('0x35')]===_0xbdcd('0x68'))&&_0x5bb967[_0x2fbe77][_0xbdcd('0x29')]===_0xbdcd('0x2a')){if(this[_0xbdcd('0x19')]>0x7){this[_0xbdcd('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x5bb967[_0xbdcd('0x69')](_0x2fbe77)&&_0x5bb967[_0x2fbe77][_0xbdcd('0x35')]===_0xbdcd('0x9')&&_0x5bb967[_0x2fbe77][_0xbdcd('0x29')]===_0xbdcd('0x2a')){if(_0x5bb967[_0x2fbe77][_0xbdcd('0x6a')]){this[_0xbdcd('0x6b')](_0x5bb967[_0x2fbe77]);this[_0xbdcd('0x6c')](_0x5bb967[_0x2fbe77]);}else{notSendMessagesQueue(_0x5bb967[_0x2fbe77]);}}}};Preview['prototype'][_0xbdcd('0x6d')]=function(_0xe513d){var _0x382145=this;this[_0xbdcd('0x15')][_0xbdcd('0x6e')](function(){if(!_[_0xbdcd('0x6f')](_0x382145['actions'][_0xe513d])){loggerAction['info'](_0xbdcd('0x70'),_0xe513d,'Queue',_0x382145[_0xbdcd('0x18')][_0xe513d][_0xbdcd('0x71')],_0xbdcd('0x72'),JSON[_0xbdcd('0x56')](_0x382145[_0xbdcd('0x16')][_0x382145[_0xbdcd('0x18')][_0xe513d][_0xbdcd('0x71')]][_0xbdcd('0x5f')]),_0xbdcd('0x73'),JSON[_0xbdcd('0x56')](_0x382145[_0xbdcd('0x16')][_0x382145['actions'][_0xe513d][_0xbdcd('0x71')]][_0xbdcd('0x2f')]),JSON[_0xbdcd('0x56')](_0x382145[_0xbdcd('0x18')][_0xe513d][_0xbdcd('0x74')]),JSON[_0xbdcd('0x56')](_[_0xbdcd('0x75')](_0x382145['actions'][_0xe513d],[_0xbdcd('0x76'),_0xbdcd('0x77'),'VoiceQueueId',_0xbdcd('0x78')])));return ami[_0xbdcd('0x79')]({'action':_0xbdcd('0x7a'),'channel':_0x382145[_0xbdcd('0x18')][_0xe513d][_0xbdcd('0x7b')]})['catch'](function(_0x5b74a5){if(_0x5b74a5[_0xbdcd('0x4d')]===_0xbdcd('0x7c')){setTimeout(function(){if(_0x382145[_0xbdcd('0x18')][_0xe513d]){ut[_0xbdcd('0x7d')](_0x382145[_0xbdcd('0x16')][_0x382145['actions'][_0xe513d][_0xbdcd('0x71')]],_0xbdcd('0x7e'));if(_0x382145[_0xbdcd('0x18')][_0xe513d][_0xbdcd('0x74')]===!![]){ut[_0xbdcd('0x7f')](_0x382145[_0xbdcd('0x16')][_0x382145['actions'][_0xe513d][_0xbdcd('0x71')]],_0xbdcd('0x7e'));ut[_0xbdcd('0x80')](_0xbdcd('0x81')+_0xe513d,_0x382145['actions'][_0xe513d]['queue']);}ut[_0xbdcd('0x80')](_0xbdcd('0x82')+_0xe513d,_0x382145[_0xbdcd('0x18')][_0xe513d]['queue']);delete _0x382145[_0xbdcd('0x18')][_0xe513d];}},0x2328);}});}});};Preview['prototype'][_0xbdcd('0x83')]=function(){var _0x45cd61=this;loggerAction[_0xbdcd('0x59')](_0xbdcd('0x84'),_['size'](this[_0xbdcd('0x18')]));for(var _0x4c434f in this[_0xbdcd('0x18')]){if(_0x45cd61[_0xbdcd('0x18')]['hasOwnProperty'](_0x4c434f)){_0x45cd61[_0xbdcd('0x6d')](_0x4c434f);}}};Preview['prototype'][_0xbdcd('0x6c')]=function(_0x45c5ce){var _0x4ddec9=this;rpcDb[_0xbdcd('0x85')](_0x45c5ce['id'],ut[_0xbdcd('0x86')](this[_0xbdcd('0x87')]))['then'](function(_0x594eb2){if(!_[_0xbdcd('0x6f')](_0x594eb2)){for(var _0x42c66f=0x0;_0x42c66f<_0x594eb2[_0xbdcd('0x88')];_0x42c66f+=0x1){if(ut[_0xbdcd('0x89')](_0x594eb2[_0x42c66f][_0xbdcd('0x8a')])<_0x45c5ce[_0xbdcd('0x8b')]*0x3c){if(_0x594eb2[_0x42c66f][_0xbdcd('0x8c')]&&!_0x594eb2[_0x42c66f]['Agent']['voicePause']){_0x4ddec9[_0xbdcd('0x8d')](_0x594eb2[_0x42c66f]['id'])['then'](ut[_0xbdcd('0x8e')](_0xbdcd('0x8f')))[_0xbdcd('0x90')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0xbdcd('0x91')](_0x594eb2[_0x42c66f]['id']);}}else{var _0x15732c=new Action(_0x594eb2[_0x42c66f],_0x45c5ce);_0x15732c[_0xbdcd('0x92')]=moment()['format'](_0xbdcd('0x93'));_0x45c5ce['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x15732c,0x17,'RecallInQueue');if(_0x45c5ce[_0xbdcd('0x94')]){rpcDb[_0xbdcd('0x95')](ut[_0xbdcd('0x96')](_0x594eb2[_0x42c66f]));rpcDb[_0xbdcd('0x97')](_0x15732c,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xbdcd('0x98')](_0x15732c,0x16,_0xbdcd('0x99'));rpcDb[_0xbdcd('0x97')](_0x15732c,_0xbdcd('0x9a'));rpcDb['createCustomerFinal'](_0x15732c,_0xbdcd('0x9a'));}}}}})[_0xbdcd('0x90')](ut[_0xbdcd('0x8e')](_0xbdcd('0x9b')));};Preview['prototype'][_0xbdcd('0x6b')]=function(_0xd0d61b){_0xd0d61b[_0xbdcd('0x5e')]=!![];if(ut['IsNotLoggedIn'](_0xd0d61b[_0xbdcd('0x9c')])){_0xd0d61b[_0xbdcd('0x4d')]=_0xbdcd('0x9d');}else if(!ut[_0xbdcd('0x9e')](_0xd0d61b[_0xbdcd('0x6a')])){_0xd0d61b[_0xbdcd('0x4d')]=_0xbdcd('0x61');}else if(!this[_0xbdcd('0x9f')](_0xd0d61b[_0xbdcd('0x52')])){if(!this[_0xbdcd('0x9f')](_0xd0d61b[_0xbdcd('0xa0')])){_0xd0d61b['message']=_0xbdcd('0xa1');}else{_0xd0d61b[_0xbdcd('0x4d')]=_0xbdcd('0xa2');}}else{_0xd0d61b[_0xbdcd('0x4d')]=_0xbdcd('0xa2');}emitCampaignPreview(_0xd0d61b);};Preview[_0xbdcd('0x12')]['callProgressDetectingCustomer']=function(_0x4aeaca,_0x3c5b12,_0x1a30a3){var _0x43e54d=this;var _0xa5023d=this[_0xbdcd('0x18')][_0x3c5b12];var _0x369be7=this[_0xbdcd('0x16')][_0xa5023d[_0xbdcd('0x71')]];var _0x2ff258;if(_0x369be7){switch(_0x1a30a3){case'1':_0x369be7['outboundNoSuchCallsDay']+=0x1;_0xa5023d[_0xbdcd('0xa3')]+=0x1;_0xa5023d[_0xbdcd('0xa4')]=ut[_0xbdcd('0xa5')](_0xa5023d);ut[_0xbdcd('0x98')](_0xa5023d,0x0,'NoSuchNumber');ami[_0xbdcd('0x28')](_0xbdcd('0xa6'),ut[_0xbdcd('0xa7')](_0xa5023d,_0xbdcd('0xa8')));rpcDb[_0xbdcd('0x97')](_0xa5023d,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xbdcd('0xa5')](_0xa5023d)>=_0x369be7[_0xbdcd('0xa9')]){_0x2ff258=ut[_0xbdcd('0xaa')](_0xa5023d,0xf,_0xbdcd('0xab'));rpcDb[_0xbdcd('0xac')](_0x2ff258,_0xbdcd('0xad'));}else{if(_0xa5023d['countnosuchnumberretry']>=_0x369be7['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0xa5023d,_0xbdcd('0xad'));}else{rpcDb[_0xbdcd('0xae')](ut[_0xbdcd('0xaf')](_0xa5023d,'countnosuchnumberretry',_0x369be7[_0xbdcd('0xb0')]),_0xa5023d[_0xbdcd('0xb1')],_0xa5023d[_0xbdcd('0xb2')]);}}delete this[_0xbdcd('0x18')][_0x4aeaca[_0xbdcd('0xb3')]];break;case'ANSWER':var _0x18cfc8=moment()[_0xbdcd('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0xa5023d[_0xbdcd('0xb4')]=_0x18cfc8;_0xa5023d[_0xbdcd('0xb5')]=_0x18cfc8;_0xa5023d[_0xbdcd('0x74')]=!![];_0x369be7['pTalking']+=0x1;logger['info'](_0xbdcd('0xb6'),_0xa5023d[_0xbdcd('0xb7')],_0xbdcd('0xb8'),_0x369be7['name'],_0xbdcd('0x73'),_0x369be7[_0xbdcd('0x2f')]);ami[_0xbdcd('0x28')](_0xbdcd('0xb9'),ut['buildObj'](_0xa5023d,_0xbdcd('0xba'),this[_0xbdcd('0x16')][_0xa5023d[_0xbdcd('0x71')]]));if(_0x369be7[_0xbdcd('0xbb')]){ami[_0xbdcd('0x28')]('custom:agentConnectPreview',ut['buildAcw'](_0xa5023d));}break;case'16':ami[_0xbdcd('0x28')](_0xbdcd('0xbc'),ut[_0xbdcd('0xa7')](_0xa5023d,_0xbdcd('0xbd'),this[_0xbdcd('0x16')][_0xa5023d[_0xbdcd('0x71')]]));emitVoiceQueueChannelRemove(ut[_0xbdcd('0xa7')](_0xa5023d,_0xbdcd('0xbd')));_0x369be7[_0xbdcd('0xbe')]+=0x1;_0x369be7[_0xbdcd('0x34')]+=0x1;_0x369be7[_0xbdcd('0x2d')]+=0x1;ut[_0xbdcd('0x7f')](_0x369be7,'[16]');_0xa5023d[_0xbdcd('0xa4')]=ut['totalGlobal'](_0xa5023d);ut[_0xbdcd('0x98')](_0xa5023d,0x4,_0xbdcd('0xbf'));rpcDb[_0xbdcd('0x97')](_0xa5023d,_0xbdcd('0xc0'));rpcDb['createCustomerFinal'](_0xa5023d,_0xbdcd('0xc1'));rpcDb['crateCustomerReportQueue'](_0xa5023d);_0x369be7[_0xbdcd('0x31')]+=_0xa5023d[_0xbdcd('0xc2')];_0x369be7['sumBillable']+=_0xa5023d['talktime'];logger['info'](_0xbdcd('0xc3'),_0xa5023d['uniqueid'],_0xbdcd('0xb8'),_0x369be7['name'],_0xbdcd('0x73'),_0x369be7[_0xbdcd('0x2f')]);delete this[_0xbdcd('0x18')][_0x4aeaca[_0xbdcd('0xb3')]];break;case _0xbdcd('0xc4'):_0x369be7['outboundBusyCallsDay']+=0x1;_0xa5023d[_0xbdcd('0xc5')]+=0x1;_0xa5023d[_0xbdcd('0xa4')]=ut[_0xbdcd('0xa5')](_0xa5023d);ut[_0xbdcd('0x98')](_0xa5023d,0x5,_0xbdcd('0xc6'));ami[_0xbdcd('0x28')](_0xbdcd('0xc7'),ut[_0xbdcd('0xa7')](_0xa5023d,_0xbdcd('0xc8')));rpcDb[_0xbdcd('0x97')](_0xa5023d,_0xbdcd('0xc9'));if(ut[_0xbdcd('0xa5')](_0xa5023d)>=_0x369be7[_0xbdcd('0xa9')]){_0x2ff258=ut[_0xbdcd('0xaa')](_0xa5023d,0xf,_0xbdcd('0xab'));rpcDb['createCustomerFinal'](_0x2ff258,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0xa5023d[_0xbdcd('0xc5')]>=_0x369be7[_0xbdcd('0xca')]){rpcDb['createCustomerFinal'](_0xa5023d,_0xbdcd('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0xbdcd('0xaf')](_0xa5023d,_0xbdcd('0xc5'),_0x369be7['dialBusyRetryFrequency']),_0xa5023d['unlockAgent'],_0xa5023d[_0xbdcd('0xb2')]);}}break;case _0xbdcd('0xcb'):_0x369be7[_0xbdcd('0xcc')]+=0x1;_0xa5023d[_0xbdcd('0xcd')]+=0x1;_0xa5023d[_0xbdcd('0xa4')]=ut[_0xbdcd('0xa5')](_0xa5023d);ut['logCustomer'](_0xa5023d,0x3,_0xbdcd('0xce'));ami[_0xbdcd('0x28')](_0xbdcd('0xcf'),ut[_0xbdcd('0xa7')](_0xa5023d,_0xbdcd('0xd0')));rpcDb[_0xbdcd('0x97')](_0xa5023d,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xbdcd('0xa5')](_0xa5023d)>=_0x369be7['dialGlobalMaxRetry']){_0x2ff258=ut[_0xbdcd('0xaa')](_0xa5023d,0xf,'Global');rpcDb['createCustomerFinal'](_0x2ff258,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xa5023d[_0xbdcd('0xcd')]>=_0x369be7['dialNoAnswerMaxRetry']){rpcDb[_0xbdcd('0xac')](_0xa5023d,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xbdcd('0xae')](ut[_0xbdcd('0xaf')](_0xa5023d,_0xbdcd('0xcd'),_0x369be7['dialNoAnswerRetryFrequency']),_0xa5023d['unlockAgent'],_0xa5023d[_0xbdcd('0xb2')]);}}break;case _0xbdcd('0xd1'):_0x369be7[_0xbdcd('0x3c')]+=0x1;_0xa5023d['countcongestionretry']+=0x1;_0xa5023d[_0xbdcd('0xa4')]=ut[_0xbdcd('0xa5')](_0xa5023d);ut['logCustomer'](_0xa5023d,0x8,_0xbdcd('0xd2'));ami[_0xbdcd('0x28')]('custom:agentcongestion',ut[_0xbdcd('0xa7')](_0xa5023d,'congestion'));rpcDb[_0xbdcd('0x97')](_0xa5023d,_0xbdcd('0xd3'));if(ut[_0xbdcd('0xa5')](_0xa5023d)>=_0x369be7[_0xbdcd('0xa9')]){_0x2ff258=ut['cloneAction'](_0xa5023d,0xf,'Global');rpcDb['createCustomerFinal'](_0x2ff258,_0xbdcd('0xd4'));}else{if(_0xa5023d[_0xbdcd('0xd5')]>=_0x369be7[_0xbdcd('0xd6')]){rpcDb[_0xbdcd('0xac')](_0xa5023d,_0xbdcd('0xd3'));}else{rpcDb[_0xbdcd('0xae')](ut['scheduledAt'](_0xa5023d,_0xbdcd('0xd5'),_0x369be7[_0xbdcd('0xd7')]),_0xa5023d['unlockAgent'],_0xa5023d[_0xbdcd('0xb2')]);}}break;case _0xbdcd('0xd8'):_0x369be7[_0xbdcd('0x42')]+=0x1;_0xa5023d[_0xbdcd('0xd9')]+=0x1;_0xa5023d[_0xbdcd('0xa4')]=ut['totalGlobal'](_0xa5023d);ut['logCustomer'](_0xa5023d,0x14,_0xbdcd('0xda'));ami[_0xbdcd('0x28')]('custom:agentreject',ut['buildObj'](_0xa5023d,_0xbdcd('0xdb')));rpcDb[_0xbdcd('0x97')](_0xa5023d,_0xbdcd('0xdc'));if(ut[_0xbdcd('0xa5')](_0xa5023d)>=_0x369be7[_0xbdcd('0xa9')]){_0x2ff258=ut[_0xbdcd('0xaa')](_0xa5023d,0x14,_0xbdcd('0xda'));rpcDb[_0xbdcd('0xac')](_0x2ff258,_0xbdcd('0xdd'));}else{if(_0xa5023d[_0xbdcd('0xd9')]>=_0x369be7[_0xbdcd('0xde')]){rpcDb[_0xbdcd('0xac')](_0xa5023d,_0xbdcd('0xdd'));}else{rpcDb[_0xbdcd('0xae')](ut[_0xbdcd('0xaf')](_0xa5023d,_0xbdcd('0xd9'),_0x369be7[_0xbdcd('0xdf')]),_0xa5023d[_0xbdcd('0xb1')],_0xa5023d['activeContact']);}}break;case'ABANDONED':_0x369be7[_0xbdcd('0x44')]+=0x1;_0xa5023d[_0xbdcd('0xe0')]+=0x1;_0xa5023d[_0xbdcd('0xa4')]=ut[_0xbdcd('0xa5')](_0xa5023d);ut[_0xbdcd('0x98')](_0xa5023d,0xb,_0xbdcd('0xe1'));rpcDb[_0xbdcd('0x97')](_0xa5023d,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xbdcd('0xa5')](_0xa5023d)>=_0x369be7['dialGlobalMaxRetry']){_0x2ff258=ut['cloneAction'](_0xa5023d,0xf,_0xbdcd('0xab'));rpcDb[_0xbdcd('0xac')](_0x2ff258,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0xa5023d[_0xbdcd('0xe2')]>=_0x369be7['dialAbandonedMaxRety']){rpcDb[_0xbdcd('0xac')](_0xa5023d,_0xbdcd('0xe3'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xa5023d,_0xbdcd('0xe0'),_0x369be7[_0xbdcd('0xe4')]),_0xa5023d['unlockAgent'],_0xa5023d[_0xbdcd('0xb2')]);}}break;default:if(_0xa5023d['dialAnswer']){ut[_0xbdcd('0x7f')](_0x369be7,'[default]');ut[_0xbdcd('0x80')](_0xbdcd('0xe5')+_0x369be7['name'],_0x4aeaca);}_0x369be7[_0xbdcd('0x43')]+=0x1;_0xa5023d[_0xbdcd('0xa4')]=ut[_0xbdcd('0xa5')](_0xa5023d);ut[_0xbdcd('0x98')](_0xa5023d,0xc,_0x4aeaca[_0xbdcd('0xe6')]||_0x4aeaca[_0xbdcd('0xe7')]);rpcDb[_0xbdcd('0x97')](_0xa5023d,_0xbdcd('0xe8'));if(ut[_0xbdcd('0xa5')](_0xa5023d)>=_0x369be7[_0xbdcd('0xa9')]){_0x2ff258=ut[_0xbdcd('0xaa')](_0xa5023d,0xf,'Global');rpcDb[_0xbdcd('0xac')](_0x2ff258,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xbdcd('0xac')](_0xa5023d,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x4aeaca[_0xbdcd('0xb3')]];}if(!(_0xa5023d['dialAnswer']&&_0x1a30a3==='16')){ut[_0xbdcd('0x7d')](_0x369be7,_0xbdcd('0xe9'));logger[_0xbdcd('0x59')](_0xbdcd('0xea'),_0xa5023d[_0xbdcd('0xb7')],'\x20Queue',_0x369be7['name'],_0xbdcd('0x72'),_0x369be7[_0xbdcd('0x5f')]);}if(_0x1a30a3!==_0xbdcd('0xeb')){delete this[_0xbdcd('0x18')][_0x4aeaca[_0xbdcd('0xb3')]];delete this[_0xbdcd('0x18')][_0x4aeaca[_0xbdcd('0xec')]];}}};Preview[_0xbdcd('0x12')][_0xbdcd('0xed')]=function(_0x1e6499,_0x5874d0,_0x2429af){if(_[_0xbdcd('0xee')](_0x5874d0)&&_0xbdcd('0xef')!==typeof _0x5874d0){return;}if(_[_0xbdcd('0xee')](_0x2429af)&&_0xbdcd('0xef')!==typeof _0x2429af){return;}switch(_0x2429af[_0xbdcd('0xf0')]){case'0':ut['logAgent'](_0x1e6499,0x0,_0xbdcd('0xf1'));rpcDb[_0xbdcd('0xf2')](_0x1e6499,_0xbdcd('0xf3'));break;case'3':ut[_0xbdcd('0xf4')](_0x1e6499,0x3,_0xbdcd('0xce'));rpcDb[_0xbdcd('0xf2')](_0x1e6499,_0xbdcd('0xf5'));break;case'5':ut[_0xbdcd('0xf4')](_0x1e6499,0x5,_0xbdcd('0xc6'));rpcDb[_0xbdcd('0xf2')](_0x1e6499,_0xbdcd('0xf6'));break;case'8':ut['logAgent'](_0x1e6499,0x8,_0xbdcd('0xd2'));rpcDb[_0xbdcd('0xf2')](_0x1e6499,_0xbdcd('0xf7'));break;case'22':ut[_0xbdcd('0xf4')](_0x1e6499,0x16,_0xbdcd('0xf8'));rpcDb[_0xbdcd('0xf2')](_0x1e6499,_0xbdcd('0xf9'));break;default:ut[_0xbdcd('0xf4')](_0x1e6499,0xc,_0x2429af[_0xbdcd('0xf0')]);rpcDb[_0xbdcd('0xf2')](_0x1e6499,'[callProgressDetectingAgent][logCongestion]');}ut[_0xbdcd('0x7d')](_0x5874d0,_0xbdcd('0xfa'));logger[_0xbdcd('0x59')](_0xbdcd('0xfb'),_0x1e6499['uniqueid'],'\x20Queue',_0x5874d0[_0xbdcd('0x2b')],_0xbdcd('0x72'),_0x5874d0[_0xbdcd('0x5f')]);delete this[_0xbdcd('0x18')][_0x1e6499['uniqueid']];};Preview[_0xbdcd('0x12')][_0xbdcd('0xfc')]=function(_0xc84bf9,_0x5a96e4,_0x425ac0,_0x20beb0,_0x2dd16d){var _0x2e5037=this;return new BPromise(function(_0x4d691a,_0x117845){if(_[_0xbdcd('0x6f')](_0x5a96e4)||_[_0xbdcd('0x6f')](_0x5a96e4[_0xbdcd('0xfd')])||_[_0xbdcd('0x6f')](_0x5a96e4['Contact']['phone'])||_[_0xbdcd('0x6f')](_0x5a96e4['VoiceQueueId'])){_0x117845(ut[_0xbdcd('0x4d')](_0xbdcd('0xfe'),_0x20beb0,_0x2dd16d));return;}var _0x527b78=uuid['v4']();var _0x163339=_0x2e5037[_0xbdcd('0x16')][_0x5a96e4[_0xbdcd('0xff')]['name']];var _0x30775c=_0x425ac0?_0x2e5037[_0xbdcd('0x87')][_0x425ac0]['id']:undefined;_0x2e5037[_0xbdcd('0x18')][_0x527b78]=new Action(_0x5a96e4,_0x163339,_0x527b78,_0x425ac0,_0x30775c);var _0x4c4ef8=_0x2e5037['actions'][_0x527b78];_0x4c4ef8[_0xbdcd('0xb1')]=_0x20beb0;_0x4c4ef8[_0xbdcd('0xb2')]=_0x2dd16d;_0x4c4ef8[_0xbdcd('0x100')]=_0x425ac0;if(_[_0xbdcd('0x101')](_0xc84bf9)){_0x2e5037['execCall'](_0x4c4ef8,_0x163339,_0x5a96e4,_0x425ac0)[_0xbdcd('0x102')](function(_0x5c7eb7){logger[_0xbdcd('0x59')]('[Preview][execCall][success]',_0xbdcd('0x103')+_0x4c4ef8[_0xbdcd('0x71')]+_0xbdcd('0x104')+_0x4c4ef8['idContact'],JSON['stringify'](_0x5c7eb7));ami[_0xbdcd('0x28')](_0xbdcd('0x105'),ut[_0xbdcd('0xa7')](_0x4c4ef8,_0xbdcd('0x106'),_0x2e5037['campaignsPreview'][_0x4c4ef8[_0xbdcd('0x71')]]));_0x4d691a(ut[_0xbdcd('0x4d')]('Calling'));})[_0xbdcd('0x90')](function(_0x17ba92){ut['logger']('[Preview][execCall][failure]',_0x17ba92);_0x117845(ut[_0xbdcd('0x4d')](_0xbdcd('0x107'),_0x20beb0,_0x2dd16d));});}else{_0x163339[_0xbdcd('0x3a')]+=0x1;ut[_0xbdcd('0x108')](_0x4c4ef8);rpcDb[_0xbdcd('0x109')](_0x4c4ef8,_0xbdcd('0x10a'));delete _0x2e5037['actions'][_0x527b78];_0x117845(ut[_0xbdcd('0x4d')](_0xbdcd('0x10b'),_0x20beb0,_0x2dd16d));}});};Preview[_0xbdcd('0x12')][_0xbdcd('0x9f')]=function(_0xe7d793){return!_[_0xbdcd('0x6f')](_0xe7d793)&&!_[_0xbdcd('0x6f')](_0xe7d793['name'])&&!_[_0xbdcd('0x6f')](_0xe7d793[_0xbdcd('0x53')])&&_0xe7d793[_0xbdcd('0x53')]&&!_[_0xbdcd('0x6f')](this[_0xbdcd('0x17')][util['format'](_0xbdcd('0x10c'),_0xe7d793['name'])])&&!_[_0xbdcd('0x6f')](this['trunks'][util[_0xbdcd('0x57')](_0xbdcd('0x10c'),_0xe7d793[_0xbdcd('0x2b')])][_0xbdcd('0x7a')])&&(this[_0xbdcd('0x17')][util[_0xbdcd('0x57')](_0xbdcd('0x10c'),_0xe7d793['name'])][_0xbdcd('0x7a')]===_0xbdcd('0x10d')||this['trunks'][util[_0xbdcd('0x57')](_0xbdcd('0x10c'),_0xe7d793['name'])][_0xbdcd('0x7a')]===_0xbdcd('0x10e'));};Preview['prototype'][_0xbdcd('0x8d')]=function(_0x3d46b5,_0x2d77c7){var _0x56888b=this;return new BPromise(function(_0x219e9c,_0x3d0150){_0x56888b[_0xbdcd('0x10f')](_0x3d46b5,_0x2d77c7)[_0xbdcd('0x102')](function(_0x9aee75){_0x219e9c(_['pick'](_0x9aee75,['message']));})[_0xbdcd('0x90')](function(_0x3bd1f3){if(_0x3bd1f3[_0xbdcd('0x110')]){rpcDb[_0xbdcd('0x111')](_0x3d46b5);}if(_0x3bd1f3[_0xbdcd('0x53')]){rpcDb[_0xbdcd('0x91')](_0x3d46b5);}_0x3d0150(_[_0xbdcd('0x75')](_0x3bd1f3,['message']));});});};Preview[_0xbdcd('0x12')][_0xbdcd('0x10f')]=function(_0x295118,_0x8cf1d4){var _0x1218d5=this;return new BPromise(function(_0x428de4,_0xeebac8){var _0x57af36,_0x4e1e26;rpcDb[_0xbdcd('0x112')](_0x295118)['then'](function(_0x3fc363){if(!_[_0xbdcd('0x6f')](_0x3fc363[0x0])){_0x4e1e26=_0x3fc363[0x0]['recallme']?![]:!![];_0x57af36=_0x3fc363[0x0][_0xbdcd('0x113')]?!![]:![];_0x57af36=_0x8cf1d4?!![]:_0x57af36;}var _0x4ad0bd=_0x1218d5[_0xbdcd('0x114')](_0x3fc363);if(_0x4ad0bd[_0xbdcd('0x115')]){rpcDb[_0xbdcd('0x116')](_[_0xbdcd('0x75')](_0x3fc363[0x0],[_0xbdcd('0x117'),_0xbdcd('0x118')]))[_0xbdcd('0x102')](function(_0x449c75){_0x1218d5[_0xbdcd('0xfc')](_0x449c75,_0x3fc363[0x0],_0x8cf1d4,_0x4e1e26,_0x57af36)[_0xbdcd('0x102')](function(_0x4c3b5f){_0x428de4(_0x4c3b5f);})[_0xbdcd('0x90')](function(_0x82f725){_0xeebac8(_0x82f725);});})[_0xbdcd('0x90')](function(_0x1d4dab){ut['logger'](_0xbdcd('0x119'),_0x1d4dab);_0xeebac8(ut[_0xbdcd('0x4d')](_0xbdcd('0x11a'),_0x4e1e26,_0x57af36));});}else{_0xeebac8(ut[_0xbdcd('0x4d')](_0x4ad0bd['message'],_0x4e1e26,_0x57af36));}})[_0xbdcd('0x90')](function(_0x43af41){ut[_0xbdcd('0x62')]('[Preview][getContactPreview]',_0x43af41);_0xeebac8(ut[_0xbdcd('0x4d')](_0xbdcd('0x11a'),![],!![]));});});};Preview[_0xbdcd('0x12')][_0xbdcd('0x114')]=function(_0x43b724){if(_[_0xbdcd('0x6f')](_0x43b724)||_[_0xbdcd('0x101')](_0x43b724)||!_['isNil'](_0x43b724[0x0][_0xbdcd('0x8c')])&&_['isNil'](_0x43b724[0x0][_0xbdcd('0x8c')][_0xbdcd('0x2b')])){ut[_0xbdcd('0x62')]('[Preview][validateContact][Empty\x20Contact]',_0x43b724);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3ed30a=this[_0xbdcd('0x16')][_0x43b724[0x0]['Queue']['name']];_0x3ed30a[_0xbdcd('0x4d')]='ACTIVE';if(_[_0xbdcd('0x6f')](_0x3ed30a)){ut[_0xbdcd('0x62')](_0xbdcd('0x11b'),_0x3ed30a);return{'isValid':![],'message':_0xbdcd('0x11c')};}if(!this[_0xbdcd('0x9f')](_0x3ed30a[_0xbdcd('0x52')])){ut[_0xbdcd('0x62')](_0xbdcd('0x11d'),_0xbdcd('0x11e')+_0x3ed30a['name']+_0xbdcd('0x11f'));if(!this[_0xbdcd('0x9f')](_0x3ed30a[_0xbdcd('0xa0')])){ut[_0xbdcd('0x62')](_0xbdcd('0x11d'),_0x3ed30a[_0xbdcd('0x2b')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xbdcd('0x120')};}}if(!ut[_0xbdcd('0x9e')](_0x3ed30a[_0xbdcd('0x6a')])){ut[_0xbdcd('0x62')](_0xbdcd('0x121'),_0x3ed30a['name']+_0xbdcd('0x122'));return{'isValid':![],'message':_0xbdcd('0x11e')+_0x3ed30a[_0xbdcd('0x2b')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xbdcd('0x123')};};Preview['prototype'][_0xbdcd('0x124')]=function(_0x550f74,_0x204757,_0x9b6698,_0x4b66e9){var _0x465151=this;return new BPromise(function(_0x443209,_0x23d2a3){var _0x464d93=_0x550f74[_0xbdcd('0xb7')];var _0xd4aed4=_0x465151[_0xbdcd('0x9f')](_0x204757[_0xbdcd('0x52')])?util['format'](_0xbdcd('0x125'),_0x204757[_0xbdcd('0x52')][_0xbdcd('0x2b')],_[_0xbdcd('0x6f')](_0x204757['dialPrefix'])?'':_0x204757[_0xbdcd('0x38')]['trim']()||'',_0x204757[_0xbdcd('0x126')]>0x0?_0x9b6698[_0xbdcd('0xfd')][_0xbdcd('0x127')][_0xbdcd('0x128')](_0x204757[_0xbdcd('0x126')]):_0x9b6698[_0xbdcd('0xfd')]['phone']):util[_0xbdcd('0x57')](_0xbdcd('0x125'),_['isNil'](_0x204757[_0xbdcd('0xa0')])?_0x204757[_0xbdcd('0x52')][_0xbdcd('0x2b')]:_0x204757[_0xbdcd('0xa0')][_0xbdcd('0x2b')],_[_0xbdcd('0x6f')](_0x204757['dialPrefix'])?'':_0x204757[_0xbdcd('0x38')][_0xbdcd('0x129')]()||'',_0x204757[_0xbdcd('0x126')]>0x0?_0x9b6698[_0xbdcd('0xfd')][_0xbdcd('0x127')][_0xbdcd('0x128')](_0x204757[_0xbdcd('0x126')]):_0x9b6698[_0xbdcd('0xfd')]['phone']);var _0x2e2f72=_0x465151[_0xbdcd('0x9f')](_0x204757['Trunk'])?ut['getCallerId'](_0x204757[_0xbdcd('0x52')][_0xbdcd('0x54')],_0x204757[_0xbdcd('0x36')],_0x204757[_0xbdcd('0x12a')]>0x0?ut[_0xbdcd('0x12b')](_0x204757[_0xbdcd('0x12c')],_0x204757[_0xbdcd('0x12a')]):_0x204757[_0xbdcd('0x12c')]):ut['getCallerId'](_[_0xbdcd('0x6f')](_0x204757[_0xbdcd('0xa0')])?_0x204757[_0xbdcd('0x52')]['callerid']:_0x204757[_0xbdcd('0xa0')][_0xbdcd('0x54')],_0x204757[_0xbdcd('0x36')],_0x204757[_0xbdcd('0x12a')]>0x0?ut[_0xbdcd('0x12b')](_0x204757['dialOriginateCallerIdNumber'],_0x204757['dialRandomLastDigitCallerIdNumber']):_0x204757[_0xbdcd('0x12c')]);if(_0x2e2f72){_0x550f74[_0xbdcd('0x12d')]=ut[_0xbdcd('0x12e')](_0x2e2f72);_0x550f74[_0xbdcd('0x12f')]=ut[_0xbdcd('0x130')](_0x2e2f72);}var _0x44c006=ut['addVariables'](_0x204757,_0x9b6698,_0xd4aed4,_0x2e2f72,_0x464d93,_0x550f74);_[_0xbdcd('0x131')](_0x550f74,ut[_0xbdcd('0x132')](_0x44c006));_0x550f74[_0xbdcd('0x92')]=moment()[_0xbdcd('0x57')](_0xbdcd('0x93'));ami[_0xbdcd('0x79')](ut[_0xbdcd('0x133')](_0x550f74,_0x204757,_0x44c006,_0x550f74[_0xbdcd('0xb2')],_0x4b66e9))[_0xbdcd('0x102')](function(_0x47bee7){_0x204757[_0xbdcd('0x5f')]+=0x1;logger[_0xbdcd('0x59')](_0xbdcd('0x134'),_0x464d93,'\x20Queue',_0x204757[_0xbdcd('0x2b')],'originated:\x20',_0x204757[_0xbdcd('0x5f')]);_0x443209(_0x47bee7);})[_0xbdcd('0x90')](function(_0x1c60cb){ut[_0xbdcd('0xf4')](_0x550f74,0xe,_0xbdcd('0x135'));rpcDb[_0xbdcd('0xf2')](_0x550f74,_0xbdcd('0x136'));_0x23d2a3(_0x1c60cb);});});};Preview[_0xbdcd('0x12')][_0xbdcd('0x22')]=function(_0x1ebb69){if(this[_0xbdcd('0x18')][_0x1ebb69[_0xbdcd('0xb3')]]){this['actions'][_0x1ebb69[_0xbdcd('0xb3')]][_0xbdcd('0x7b')]=_0x1ebb69[_0xbdcd('0x7b')];}};Preview[_0xbdcd('0x12')][_0xbdcd('0x1a')]=function(_0x2ce179){var _0x5cc47f=this;var _0x575074=this[_0xbdcd('0x18')][_0x2ce179[_0xbdcd('0x137')]];if(_0x575074){if(_0x575074['lookAgent']&&this['agents'][_0x575074['lookAgent']]){ut['logLookAgent'](_0x575074,this['agents'][_0x575074[_0xbdcd('0x100')]][_0xbdcd('0x2b')],this[_0xbdcd('0x87')][_0x575074[_0xbdcd('0x100')]]['id']);}var _0x5c585e=_[_0xbdcd('0x138')](_0x575074);_0x5c585e[_0xbdcd('0xb4')]=moment()[_0xbdcd('0x57')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4e9f33=_0x5cc47f[_0xbdcd('0x16')][_0x575074['queue']];if(ut['isFailure'](_0x2ce179[_0xbdcd('0x139')])){if(_0x575074[_0xbdcd('0xb1')]){rpcDb[_0xbdcd('0x111')](_0x575074['idContact']);}if(_0x575074['activeContact']){rpcDb[_0xbdcd('0x91')](_0x575074['idContact']);}ami['emit']('custom:agentringnoanswer',ut['buildObj'](_0x575074,_0xbdcd('0x13a'),this[_0xbdcd('0x16')][_0x575074['queue']]));this[_0xbdcd('0xed')](_0x5c585e,_0x4e9f33,_0x2ce179);}else{_0x575074[_0xbdcd('0x92')]=moment()[_0xbdcd('0x57')](_0xbdcd('0x93'));ut[_0xbdcd('0xf4')](_0x5c585e,0x4,_0xbdcd('0xbf'));rpcDb[_0xbdcd('0xf2')](_0x5c585e,_0xbdcd('0x13b'));}}};Preview['prototype'][_0xbdcd('0x1c')]=function(_0x5b0341){var _0x295282=this;var _0x340786=this[_0xbdcd('0x18')][_0x5b0341[_0xbdcd('0xb3')]];var _0xbba6c5;if(_0x340786){_0xbba6c5=this[_0xbdcd('0x16')][_0x340786[_0xbdcd('0x71')]];logger[_0xbdcd('0x59')]('[syncHangup][talking]',_0x5b0341[_0xbdcd('0xb3')],'\x20Queue',_0xbba6c5[_0xbdcd('0x2b')],_0xbdcd('0x73'),_0xbba6c5[_0xbdcd('0x2f')]);}if(this['actions'][_0x5b0341['linkedid']]&&_0x5b0341[_0xbdcd('0xb3')]!==_0x5b0341['uniqueid']){if(_0x5b0341[_0xbdcd('0x13c')]==='16'&&this[_0xbdcd('0x18')][_0x5b0341[_0xbdcd('0xb3')]][_0xbdcd('0x74')]){this[_0xbdcd('0x13d')](_0x5b0341,_0x5b0341['linkedid'],_0x5b0341[_0xbdcd('0x13c')]);}else if(this[_0xbdcd('0x18')][_0x5b0341[_0xbdcd('0xb3')]][_0xbdcd('0x74')]){logger['info'](_0xbdcd('0x13e'),_0x5b0341[_0xbdcd('0xb3')],_0x5b0341[_0xbdcd('0x13c')],_0xbdcd('0xb8'),_0xbba6c5['name'],_0xbdcd('0x73'),_0xbba6c5[_0xbdcd('0x2f')]);this[_0xbdcd('0x13d')](_0x5b0341,_0x5b0341['linkedid'],_0x5b0341[_0xbdcd('0x13c')]);}}else if(_0x340786&&_[_0xbdcd('0x6f')](_0x340786[_0xbdcd('0x13f')])&&_0xbba6c5[_0xbdcd('0x140')]&&_0x5b0341[_0xbdcd('0xb3')]===_0x5b0341[_0xbdcd('0xb7')]&&_['isNil'](_0x5b0341[_0xbdcd('0xf0')])&&_0x5b0341['cause']==='16'&&_0x5b0341[_0xbdcd('0x141')]==='6'&&_[_0xbdcd('0xee')](_0x340786['transfer'])){if(_0x340786['unlockAgent']){rpcDb[_0xbdcd('0x111')](_0x340786['idContact']);}if(_0x340786['activeContact']){rpcDb[_0xbdcd('0x91')](_0x340786[_0xbdcd('0x142')]);}_0x5b0341[_0xbdcd('0xf0')]='22';this[_0xbdcd('0xed')](_0x340786,_0xbba6c5,_0x5b0341);}else if(_0x340786&&_0x340786['transfer']){if(_0x5b0341['cause']==='16'&&this[_0xbdcd('0x18')][_0x5b0341[_0xbdcd('0xb3')]][_0xbdcd('0x74')]){logger[_0xbdcd('0x59')](_0xbdcd('0x143'),_0x5b0341[_0xbdcd('0xb3')],_0x5b0341['cause'],_0xbdcd('0xb8'),_0xbba6c5[_0xbdcd('0x2b')],_0xbdcd('0x73'),_0xbba6c5[_0xbdcd('0x2f')]);this[_0xbdcd('0x13d')](_0x5b0341,_0x5b0341[_0xbdcd('0xb3')],_0x5b0341['cause']);}else if(this[_0xbdcd('0x18')][_0x5b0341['linkedid']]['dialAnswer']){logger[_0xbdcd('0x59')](_0xbdcd('0x13e'),_0x5b0341[_0xbdcd('0xb3')],_0x5b0341[_0xbdcd('0x13c')],_0xbdcd('0xb8'),_0xbba6c5[_0xbdcd('0x2b')],_0xbdcd('0x73'),_0xbba6c5[_0xbdcd('0x2f')]);this['callProgressDetectingCustomer'](_0x5b0341,_0x5b0341[_0xbdcd('0xb3')],_0x5b0341[_0xbdcd('0x13c')]);}}};Preview[_0xbdcd('0x12')][_0xbdcd('0x20')]=function(_0x39d799){if(this[_0xbdcd('0x18')][_0x39d799[_0xbdcd('0xec')]]&&_0x39d799[_0xbdcd('0xec')]!==_0x39d799['destuniqueid']){this[_0xbdcd('0x13d')](_0x39d799,_0x39d799[_0xbdcd('0xec')],_0x39d799[_0xbdcd('0xe7')]);}};Preview[_0xbdcd('0x12')][_0xbdcd('0x1e')]=function(_0x3cb9ea){if(this[_0xbdcd('0x18')][_0x3cb9ea[_0xbdcd('0xb3')]]&&_0x3cb9ea[_0xbdcd('0xb3')]!==_0x3cb9ea['uniqueid']&&!this[_0xbdcd('0x18')][_0x3cb9ea['linkedid']][_0xbdcd('0x74')]){if(_0x3cb9ea['cause']==='1'){this[_0xbdcd('0x13d')](_0x3cb9ea,_0x3cb9ea[_0xbdcd('0xb3')],_0x3cb9ea[_0xbdcd('0x13c')]);}}};Preview['prototype'][_0xbdcd('0x144')]=function(_0x4bc4e3,_0x35ae38,_0x6941bb){if(this['actions'][_0x4bc4e3]){if(_[_0xbdcd('0x6f')](this['actions'][_0x4bc4e3][_0xbdcd('0x145')])){this[_0xbdcd('0x18')][_0x4bc4e3][_0xbdcd('0x145')]={};}this['actions'][_0x4bc4e3][_0xbdcd('0x145')][_0x35ae38]=_0x6941bb;}};Preview[_0xbdcd('0x12')][_0xbdcd('0x24')]=function(_0x40c22a){try{if(!_[_0xbdcd('0x6f')](_0x40c22a)){if(ut[_0xbdcd('0x146')](_[_0xbdcd('0x147')](_0x40c22a['variable'])[0x0])){this['addVariable'](_0x40c22a[_0xbdcd('0xb7')],_[_0xbdcd('0x147')](_0x40c22a[_0xbdcd('0x148')])[0x0],_0x40c22a[_0xbdcd('0x149')]);}}}catch(_0x467719){logger['error'](_0xbdcd('0x14a'),util[_0xbdcd('0x14b')](_0x467719,{'showHidden':![],'depth':null}));}};Preview[_0xbdcd('0x12')][_0xbdcd('0x14c')]=function(_0x3b2763){if(_0x3b2763){if(this[_0xbdcd('0x18')][_0x3b2763[_0xbdcd('0x14d')]]){this[_0xbdcd('0x18')][_0x3b2763[_0xbdcd('0x14d')]][_0xbdcd('0x14e')]=!![];}}};Preview[_0xbdcd('0x12')][_0xbdcd('0x26')]=function(_0x5acd3b){if(_0x5acd3b){if(this['actions'][_0x5acd3b[_0xbdcd('0x14f')]]){this['actions'][_0x5acd3b[_0xbdcd('0x14f')]][_0xbdcd('0x14e')]=!![];}}};module[_0xbdcd('0x150')]=Preview; \ No newline at end of file +var _0xcaf2=['\x20Queue','countbusyretry','Busy','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','NoAnswer','custom:agentnoanswer','noanswer','countnoanswerretry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','loggerError','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','logLookAgent','clone','isFailure','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','md5','ioredis','../../../config/logger','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','then','getDiff','scheduledat','Agent','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2b338b,_0x4a06ba){_0x2b338b=_0x2b338b-0x0;var _0x256f66=_0xcaf2[_0x2b338b];return _0x256f66;};'use strict';var util=require(_0x2caf('0x0'));var _=require('lodash');var BPromise=require(_0x2caf('0x1'));var uuid=require(_0x2caf('0x2'));var moment=require('moment');var md5=require(_0x2caf('0x3'));var Redis=require(_0x2caf('0x4'));var config=require('../../../config/environment');var logger=require(_0x2caf('0x5'))('preview');var loggerAction=require(_0x2caf('0x5'))(_0x2caf('0x6'));var ami=require(_0x2caf('0x7'));var rpcDb=require('./rpcDb');var Action=require(_0x2caf('0x8'));var ut=require(_0x2caf('0x9'));config[_0x2caf('0xa')]=_[_0x2caf('0xb')](config['redis'],{'host':_0x2caf('0xc'),'port':0x18eb});var io=require(_0x2caf('0xd'))(new Redis(config[_0x2caf('0xa')]));var Sequence=function(){};Sequence[_0x2caf('0xe')][_0x2caf('0xf')]=function(_0x438434){this[_0x2caf('0x10')]=this[_0x2caf('0x10')]?this[_0x2caf('0x10')]['finally'](_0x438434):_0x438434();};function Preview(_0xd56396){this[_0x2caf('0x11')]=new Sequence();this[_0x2caf('0x12')]=_0xd56396[_0x2caf('0x13')];this[_0x2caf('0x14')]=_0xd56396[_0x2caf('0x14')];this[_0x2caf('0x15')]={};this[_0x2caf('0x16')]=_0xd56396['agents'];this[_0x2caf('0x17')]=0x0;ami['on'](_0x2caf('0x18'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this[_0x2caf('0x19')]['bind'](this));ami['on'](_0x2caf('0x1a'),this[_0x2caf('0x1b')][_0x2caf('0x1c')](this));ami['on'](_0x2caf('0x1d'),this['syncDialEnd'][_0x2caf('0x1c')](this));ami['on']('newexten',this[_0x2caf('0x1e')]['bind'](this));ami['on']('varset',this[_0x2caf('0x1f')]['bind'](this));ami['on'](_0x2caf('0x20'),this[_0x2caf('0x21')]['bind'](this));ami['on'](_0x2caf('0x22'),this[_0x2caf('0x23')][_0x2caf('0x1c')](this));this[_0x2caf('0x24')](this[_0x2caf('0x12')]);}function emit(_0x595f2f,_0xfa426f,_0x3eac27){io['to'](_0x595f2f)[_0x2caf('0x25')](_0xfa426f,_0x3eac27);}function emitCampaignPreview(_0x358445){if(_0x358445[_0x2caf('0x26')]===_0x2caf('0x27')){var _0x4092ba={'id':_0x358445['id'],'name':_0x358445[_0x2caf('0x28')],'strategy':_0x358445[_0x2caf('0x29')],'answered':_0x358445[_0x2caf('0x2a')],'available':_0x358445[_0x2caf('0x2b')],'loggedIn':_0x358445['loggedIn'],'pTalking':_0x358445[_0x2caf('0x2c')],'sumBillable':_0x358445[_0x2caf('0x2d')],'sumDuration':_0x358445[_0x2caf('0x2e')],'sumHoldTime':_0x358445[_0x2caf('0x2f')]||0x0,'talking':_0x358445[_0x2caf('0x30')],'total':_0x358445[_0x2caf('0x31')],'type':_0x358445[_0x2caf('0x26')],'unmanaged':_0x358445[_0x2caf('0x32')],'abandoned':_0x358445[_0x2caf('0x33')],'waiting':_0x358445[_0x2caf('0x34')],'loggedInDb':_0x358445['loggedInDb'],'dialActive':_0x358445[_0x2caf('0x35')],'dialMethod':_0x358445[_0x2caf('0x36')],'dialOriginateCallerIdName':_0x358445[_0x2caf('0x37')],'dialOriginateCallerIdNumber':_0x358445[_0x2caf('0x38')],'dialOriginateTimeout':_0x358445[_0x2caf('0x39')],'dialPrefix':_0x358445[_0x2caf('0x3a')],'outboundAnswerAgiCallsDay':_0x358445[_0x2caf('0x3b')],'outboundAnswerCallsDay':_0x358445[_0x2caf('0x3c')],'outboundBlacklistCallsDay':_0x358445[_0x2caf('0x3d')],'outboundBusyCallsDay':_0x358445[_0x2caf('0x3e')],'outboundCongestionCallsDay':_0x358445[_0x2caf('0x3f')],'outboundDropCallsDayACS':_0x358445[_0x2caf('0x40')],'outboundDropCallsDayCallersExit':_0x358445[_0x2caf('0x41')],'outboundDropCallsDayTimeout':_0x358445['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x358445[_0x2caf('0x42')],'outboundNoSuchCallsDay':_0x358445[_0x2caf('0x43')],'outboundOriginateFailureCallsDay':_0x358445[_0x2caf('0x44')],'outboundReCallsDay':_0x358445[_0x2caf('0x45')],'outboundRejectCallsDay':_0x358445[_0x2caf('0x46')],'outboundUnknownCallsDay':_0x358445[_0x2caf('0x47')],'outboundAbandonedCallsDay':_0x358445[_0x2caf('0x48')],'predictiveIntervalAnsweredCalls':_0x358445['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x358445[_0x2caf('0x49')],'predictiveIntervalAvgTalktime':_0x358445[_0x2caf('0x4a')],'predictiveIntervalDroppedCallsCallersExit':_0x358445['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x358445[_0x2caf('0x4b')],'predictiveIntervalErlangCalls':_0x358445[_0x2caf('0x4c')],'predictiveIntervalErlangCallsDroppedCalls':_0x358445[_0x2caf('0x4d')],'predictiveIntervalHitRate':_0x358445['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x358445[_0x2caf('0x4e')],'predictiveIntervalPauses':_0x358445['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x358445['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x358445[_0x2caf('0x4f')],'message':_0x358445[_0x2caf('0x50')],'originated':_0x358445[_0x2caf('0x51')],'erlangCalls':_0x358445[_0x2caf('0x52')],'erlangCallToSecond':_0x358445[_0x2caf('0x53')],'erlangAbandonmentRate':_0x358445[_0x2caf('0x54')],'erlangBusyFactor':_0x358445[_0x2caf('0x55')],'startPredictive':_0x358445[_0x2caf('0x56')],'startProgressive':_0x358445[_0x2caf('0x57')]};if(_0x358445['Trunk']){_0x4092ba[_0x2caf('0x58')]={'id':_0x358445[_0x2caf('0x58')]['id'],'name':_0x358445[_0x2caf('0x58')][_0x2caf('0x28')],'active':_0x358445[_0x2caf('0x58')][_0x2caf('0x59')],'callerid':_0x358445[_0x2caf('0x58')][_0x2caf('0x5a')]};}if(_0x358445[_0x2caf('0x5b')]){_0x4092ba[_0x2caf('0x5b')]={'id':_0x358445[_0x2caf('0x5b')]['id'],'name':_0x358445[_0x2caf('0x5b')]['name']};}var _0x5b3a78=md5(JSON[_0x2caf('0x5c')](_0x4092ba));if(_0x358445[_0x2caf('0x3')]!==_0x5b3a78){_0x358445[_0x2caf('0x3')]=_0x5b3a78;emit(util[_0x2caf('0x5d')]('voice:queue:%s',_0x4092ba[_0x2caf('0x28')]),_0x2caf('0x5e'),_0x4092ba);}}}function emitVoiceQueueChannelRemove(_0x4568f9){logger[_0x2caf('0x5f')](_0x2caf('0x60'),JSON[_0x2caf('0x5c')](_0x4568f9));emit(util[_0x2caf('0x5d')](_0x2caf('0x61'),_0x4568f9['name']),'voice_queue_channel:remove',_0x4568f9);this[_0x2caf('0x25')](_0x2caf('0x62'),_0x4568f9);}function notSendMessagesQueue(_0x177254){if(_0x177254[_0x2caf('0x63')]){if(_0x177254[_0x2caf('0x51')]===0x0&&_0x177254[_0x2caf('0x2c')]===0x0){_0x177254[_0x2caf('0x63')]=![];_0x177254[_0x2caf('0x2b')]=0x0;_0x177254[_0x2caf('0x64')]=0x0;_0x177254[_0x2caf('0x50')]=_0x2caf('0x65');ut['logger'](_0x2caf('0x66'),_0x177254[_0x2caf('0x28')]+_0x2caf('0x67'));}else{_0x177254['message']=_0x2caf('0x68');ut[_0x2caf('0x69')](_0x2caf('0x66'),_0x177254['name']+_0x2caf('0x6a'));}emitCampaignPreview(_0x177254);}}Preview[_0x2caf('0xe')]['loopCampaigns']=function(){var _0x38ae68=this;setInterval(function(){_0x38ae68[_0x2caf('0x6b')]();},0x7cf);};Preview['prototype'][_0x2caf('0x6b')]=function(){var _0x1348d8=this[_0x2caf('0x12')];this[_0x2caf('0x17')]+=0x1;for(var _0x3949a6 in _0x1348d8){if(_0x1348d8[_0x2caf('0x6c')](_0x3949a6)&&(_0x1348d8[_0x3949a6][_0x2caf('0x36')]===_0x2caf('0x6d')||_0x1348d8[_0x3949a6]['dialMethod']===_0x2caf('0x6e'))&&_0x1348d8[_0x3949a6]['type']===_0x2caf('0x27')){if(this[_0x2caf('0x17')]>0x7){this[_0x2caf('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x1348d8['hasOwnProperty'](_0x3949a6)&&_0x1348d8[_0x3949a6][_0x2caf('0x36')]==='preview'&&_0x1348d8[_0x3949a6][_0x2caf('0x26')]===_0x2caf('0x27')){if(_0x1348d8[_0x3949a6][_0x2caf('0x35')]){this[_0x2caf('0x6f')](_0x1348d8[_0x3949a6]);this[_0x2caf('0x70')](_0x1348d8[_0x3949a6]);}else{notSendMessagesQueue(_0x1348d8[_0x3949a6]);}}}};Preview[_0x2caf('0xe')][_0x2caf('0x71')]=function(_0x61ca34){var _0x100681=this;this[_0x2caf('0x11')][_0x2caf('0xf')](function(){if(!_[_0x2caf('0x72')](_0x100681[_0x2caf('0x15')][_0x61ca34])){loggerAction[_0x2caf('0x5f')](_0x2caf('0x73'),_0x61ca34,_0x2caf('0x74'),_0x100681[_0x2caf('0x15')][_0x61ca34][_0x2caf('0x75')],_0x2caf('0x76'),JSON[_0x2caf('0x5c')](_0x100681[_0x2caf('0x12')][_0x100681['actions'][_0x61ca34][_0x2caf('0x75')]][_0x2caf('0x51')]),'pTalking:\x20',JSON['stringify'](_0x100681[_0x2caf('0x12')][_0x100681[_0x2caf('0x15')][_0x61ca34]['queue']][_0x2caf('0x2c')]),JSON[_0x2caf('0x5c')](_0x100681[_0x2caf('0x15')][_0x61ca34][_0x2caf('0x77')]),JSON[_0x2caf('0x5c')](_[_0x2caf('0x78')](_0x100681[_0x2caf('0x15')][_0x61ca34],[_0x2caf('0x79'),_0x2caf('0x7a'),_0x2caf('0x7b'),_0x2caf('0x7c')])));return ami[_0x2caf('0x7d')]({'action':_0x2caf('0x7e'),'channel':_0x100681['actions'][_0x61ca34][_0x2caf('0x7f')]})[_0x2caf('0x80')](function(_0x21c298){if(_0x21c298['message']===_0x2caf('0x81')){setTimeout(function(){if(_0x100681[_0x2caf('0x15')][_0x61ca34]){ut[_0x2caf('0x82')](_0x100681[_0x2caf('0x12')][_0x100681[_0x2caf('0x15')][_0x61ca34][_0x2caf('0x75')]],_0x2caf('0x83'));if(_0x100681[_0x2caf('0x15')][_0x61ca34][_0x2caf('0x77')]===!![]){ut[_0x2caf('0x84')](_0x100681['campaignsPreview'][_0x100681[_0x2caf('0x15')][_0x61ca34][_0x2caf('0x75')]],_0x2caf('0x83'));ut['loggerError'](_0x2caf('0x85')+_0x61ca34,_0x100681[_0x2caf('0x15')][_0x61ca34][_0x2caf('0x75')]);}ut['loggerError'](_0x2caf('0x86')+_0x61ca34,_0x100681[_0x2caf('0x15')][_0x61ca34][_0x2caf('0x75')]);delete _0x100681[_0x2caf('0x15')][_0x61ca34];}},0x2328);}});}});};Preview['prototype'][_0x2caf('0x87')]=function(){var _0x7e9d86=this;loggerAction[_0x2caf('0x5f')]('[action]',_[_0x2caf('0x88')](this[_0x2caf('0x15')]));for(var _0x4c1a77 in this[_0x2caf('0x15')]){if(_0x7e9d86[_0x2caf('0x15')][_0x2caf('0x6c')](_0x4c1a77)){_0x7e9d86['clearZombieChannel'](_0x4c1a77);}}};Preview[_0x2caf('0xe')]['recallMe']=function(_0x96960a){var _0x1f9899=this;rpcDb['getContactRecallMe'](_0x96960a['id'],ut['agentReadyId'](this[_0x2caf('0x16')]))[_0x2caf('0x89')](function(_0x13287e){if(!_[_0x2caf('0x72')](_0x13287e)){for(var _0xb3d0c=0x0;_0xb3d0c<_0x13287e['length'];_0xb3d0c+=0x1){if(ut[_0x2caf('0x8a')](_0x13287e[_0xb3d0c][_0x2caf('0x8b')])<_0x96960a['dialRecallMeTimeout']*0x3c){if(_0x13287e[_0xb3d0c][_0x2caf('0x8c')]&&!_0x13287e[_0xb3d0c][_0x2caf('0x8c')]['voicePause']){_0x1f9899['run'](_0x13287e[_0xb3d0c]['id'])[_0x2caf('0x89')](ut['logger2'](_0x2caf('0x8d')))[_0x2caf('0x80')](ut[_0x2caf('0x8e')](_0x2caf('0x8d')));}else{rpcDb[_0x2caf('0x8f')](_0x13287e[_0xb3d0c]['id']);}}else{var _0x47aa69=new Action(_0x13287e[_0xb3d0c],_0x96960a);_0x47aa69[_0x2caf('0x90')]=moment()['format'](_0x2caf('0x91'));_0x96960a['outboundReCallsDay']+=0x1;ut[_0x2caf('0x92')](_0x47aa69,0x17,'RecallInQueue');if(_0x96960a['dialRecallInQueue']){rpcDb[_0x2caf('0x93')](ut['createBody'](_0x13287e[_0xb3d0c]));rpcDb[_0x2caf('0x94')](_0x47aa69,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x47aa69,0x16,_0x2caf('0x95'));rpcDb[_0x2caf('0x94')](_0x47aa69,_0x2caf('0x96'));rpcDb[_0x2caf('0x97')](_0x47aa69,_0x2caf('0x96'));}}}}})['catch'](ut[_0x2caf('0x8e')](_0x2caf('0x98')));};Preview['prototype'][_0x2caf('0x6f')]=function(_0x4b0360){_0x4b0360[_0x2caf('0x63')]=!![];if(ut[_0x2caf('0x99')](_0x4b0360[_0x2caf('0x9a')])){_0x4b0360[_0x2caf('0x50')]=_0x2caf('0x9b');}else if(!ut['isActive'](_0x4b0360['dialActive'])){_0x4b0360[_0x2caf('0x50')]=_0x2caf('0x65');}else if(!this[_0x2caf('0x9c')](_0x4b0360[_0x2caf('0x58')])){if(!this[_0x2caf('0x9c')](_0x4b0360[_0x2caf('0x9d')])){_0x4b0360[_0x2caf('0x50')]='TRUNK_IS_NOT_REACHABLE';}else{_0x4b0360[_0x2caf('0x50')]=_0x2caf('0x9e');}}else{_0x4b0360[_0x2caf('0x50')]=_0x2caf('0x9e');}emitCampaignPreview(_0x4b0360);};Preview[_0x2caf('0xe')]['callProgressDetectingCustomer']=function(_0x46a063,_0x5ed955,_0x1fb36f){var _0x444b5b=this;var _0x9bb98b=this[_0x2caf('0x15')][_0x5ed955];var _0x157a14=this['campaignsPreview'][_0x9bb98b[_0x2caf('0x75')]];var _0x5a90a7;if(_0x157a14){switch(_0x1fb36f){case'1':_0x157a14[_0x2caf('0x43')]+=0x1;_0x9bb98b[_0x2caf('0x9f')]+=0x1;_0x9bb98b['countglobal']=ut[_0x2caf('0xa0')](_0x9bb98b);ut[_0x2caf('0x92')](_0x9bb98b,0x0,_0x2caf('0xa1'));ami[_0x2caf('0x25')](_0x2caf('0xa2'),ut[_0x2caf('0xa3')](_0x9bb98b,'nosuchnumber'));rpcDb[_0x2caf('0x94')](_0x9bb98b,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x2caf('0xa0')](_0x9bb98b)>=_0x157a14['dialGlobalMaxRetry']){_0x5a90a7=ut[_0x2caf('0xa4')](_0x9bb98b,0xf,_0x2caf('0xa5'));rpcDb[_0x2caf('0x97')](_0x5a90a7,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x9bb98b[_0x2caf('0x9f')]>=_0x157a14[_0x2caf('0xa6')]){rpcDb[_0x2caf('0x97')](_0x9bb98b,_0x2caf('0xa7'));}else{rpcDb[_0x2caf('0xa8')](ut['scheduledAt'](_0x9bb98b,_0x2caf('0x9f'),_0x157a14[_0x2caf('0xa9')]),_0x9bb98b[_0x2caf('0xaa')],_0x9bb98b[_0x2caf('0xab')]);}}delete this[_0x2caf('0x15')][_0x46a063[_0x2caf('0xac')]];break;case'ANSWER':var _0x3f2745=moment()['format'](_0x2caf('0x91'));_0x9bb98b[_0x2caf('0xad')]=_0x3f2745;_0x9bb98b[_0x2caf('0xae')]=_0x3f2745;_0x9bb98b[_0x2caf('0x77')]=!![];_0x157a14[_0x2caf('0x2c')]+=0x1;logger[_0x2caf('0x5f')](_0x2caf('0xaf'),_0x9bb98b[_0x2caf('0xb0')],'\x20Queue',_0x157a14[_0x2caf('0x28')],_0x2caf('0xb1'),_0x157a14[_0x2caf('0x2c')]);ami['emit'](_0x2caf('0xb2'),ut[_0x2caf('0xa3')](_0x9bb98b,_0x2caf('0xb3'),this['campaignsPreview'][_0x9bb98b[_0x2caf('0x75')]]));if(_0x157a14[_0x2caf('0xb4')]){ami[_0x2caf('0x25')](_0x2caf('0xb5'),ut['buildAcw'](_0x9bb98b));}break;case'16':ami['emit'](_0x2caf('0xb6'),ut[_0x2caf('0xa3')](_0x9bb98b,_0x2caf('0xb7'),this[_0x2caf('0x12')][_0x9bb98b[_0x2caf('0x75')]]));emitVoiceQueueChannelRemove(ut[_0x2caf('0xa3')](_0x9bb98b,_0x2caf('0xb7')));_0x157a14[_0x2caf('0x3c')]+=0x1;_0x157a14[_0x2caf('0x31')]+=0x1;_0x157a14[_0x2caf('0x2a')]+=0x1;ut[_0x2caf('0x84')](_0x157a14,_0x2caf('0xb8'));_0x9bb98b[_0x2caf('0xb9')]=ut[_0x2caf('0xa0')](_0x9bb98b);ut['logCustomer'](_0x9bb98b,0x4,_0x2caf('0xba'));rpcDb[_0x2caf('0x94')](_0x9bb98b,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x2caf('0x97')](_0x9bb98b,_0x2caf('0xbb'));rpcDb[_0x2caf('0xbc')](_0x9bb98b);_0x157a14['sumDuration']+=_0x9bb98b['talktime'];_0x157a14['sumBillable']+=_0x9bb98b[_0x2caf('0xbd')];logger[_0x2caf('0x5f')](_0x2caf('0xbe'),_0x9bb98b['uniqueid'],_0x2caf('0xbf'),_0x157a14[_0x2caf('0x28')],_0x2caf('0xb1'),_0x157a14['pTalking']);delete this[_0x2caf('0x15')][_0x46a063[_0x2caf('0xac')]];break;case'BUSY':_0x157a14[_0x2caf('0x3e')]+=0x1;_0x9bb98b[_0x2caf('0xc0')]+=0x1;_0x9bb98b[_0x2caf('0xb9')]=ut['totalGlobal'](_0x9bb98b);ut[_0x2caf('0x92')](_0x9bb98b,0x5,_0x2caf('0xc1'));ami[_0x2caf('0x25')](_0x2caf('0xc2'),ut[_0x2caf('0xa3')](_0x9bb98b,_0x2caf('0xc3')));rpcDb['createCustomerHistory'](_0x9bb98b,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x2caf('0xa0')](_0x9bb98b)>=_0x157a14[_0x2caf('0xc4')]){_0x5a90a7=ut[_0x2caf('0xa4')](_0x9bb98b,0xf,_0x2caf('0xa5'));rpcDb[_0x2caf('0x97')](_0x5a90a7,_0x2caf('0xc5'));}else{if(_0x9bb98b[_0x2caf('0xc0')]>=_0x157a14[_0x2caf('0xc6')]){rpcDb[_0x2caf('0x97')](_0x9bb98b,_0x2caf('0xc7'));}else{rpcDb[_0x2caf('0xa8')](ut[_0x2caf('0xc8')](_0x9bb98b,'countbusyretry',_0x157a14[_0x2caf('0xc9')]),_0x9bb98b[_0x2caf('0xaa')],_0x9bb98b[_0x2caf('0xab')]);}}break;case'NOANSWER':_0x157a14[_0x2caf('0x42')]+=0x1;_0x9bb98b['countnoanswerretry']+=0x1;_0x9bb98b['countglobal']=ut['totalGlobal'](_0x9bb98b);ut[_0x2caf('0x92')](_0x9bb98b,0x3,_0x2caf('0xca'));ami[_0x2caf('0x25')](_0x2caf('0xcb'),ut['buildObj'](_0x9bb98b,_0x2caf('0xcc')));rpcDb[_0x2caf('0x94')](_0x9bb98b,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x2caf('0xa0')](_0x9bb98b)>=_0x157a14[_0x2caf('0xc4')]){_0x5a90a7=ut[_0x2caf('0xa4')](_0x9bb98b,0xf,_0x2caf('0xa5'));rpcDb['createCustomerFinal'](_0x5a90a7,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x9bb98b[_0x2caf('0xcd')]>=_0x157a14['dialNoAnswerMaxRetry']){rpcDb[_0x2caf('0x97')](_0x9bb98b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x2caf('0xa8')](ut['scheduledAt'](_0x9bb98b,'countnoanswerretry',_0x157a14[_0x2caf('0xce')]),_0x9bb98b['unlockAgent'],_0x9bb98b['activeContact']);}}break;case _0x2caf('0xcf'):_0x157a14[_0x2caf('0x3f')]+=0x1;_0x9bb98b[_0x2caf('0xd0')]+=0x1;_0x9bb98b[_0x2caf('0xb9')]=ut[_0x2caf('0xa0')](_0x9bb98b);ut['logCustomer'](_0x9bb98b,0x8,_0x2caf('0xd1'));ami['emit']('custom:agentcongestion',ut[_0x2caf('0xa3')](_0x9bb98b,'congestion'));rpcDb['createCustomerHistory'](_0x9bb98b,_0x2caf('0xd2'));if(ut[_0x2caf('0xa0')](_0x9bb98b)>=_0x157a14[_0x2caf('0xc4')]){_0x5a90a7=ut['cloneAction'](_0x9bb98b,0xf,_0x2caf('0xa5'));rpcDb[_0x2caf('0x97')](_0x5a90a7,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x9bb98b[_0x2caf('0xd0')]>=_0x157a14[_0x2caf('0xd3')]){rpcDb[_0x2caf('0x97')](_0x9bb98b,_0x2caf('0xd2'));}else{rpcDb[_0x2caf('0xa8')](ut[_0x2caf('0xc8')](_0x9bb98b,'countcongestionretry',_0x157a14['dialBusyRetryFrequency']),_0x9bb98b[_0x2caf('0xaa')],_0x9bb98b['activeContact']);}}break;case _0x2caf('0xd4'):_0x157a14['outboundRejectCallsDay']+=0x1;_0x9bb98b['countagentrejectretry']+=0x1;_0x9bb98b['countglobal']=ut['totalGlobal'](_0x9bb98b);ut[_0x2caf('0x92')](_0x9bb98b,0x14,_0x2caf('0xd5'));ami[_0x2caf('0x25')](_0x2caf('0xd6'),ut[_0x2caf('0xa3')](_0x9bb98b,_0x2caf('0xd7')));rpcDb[_0x2caf('0x94')](_0x9bb98b,_0x2caf('0xd8'));if(ut[_0x2caf('0xa0')](_0x9bb98b)>=_0x157a14['dialGlobalMaxRetry']){_0x5a90a7=ut[_0x2caf('0xa4')](_0x9bb98b,0x14,_0x2caf('0xd5'));rpcDb['createCustomerFinal'](_0x5a90a7,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x9bb98b[_0x2caf('0xd9')]>=_0x157a14[_0x2caf('0xda')]){rpcDb[_0x2caf('0x97')](_0x9bb98b,_0x2caf('0xdb'));}else{rpcDb['rescheduleContact'](ut[_0x2caf('0xc8')](_0x9bb98b,_0x2caf('0xd9'),_0x157a14[_0x2caf('0xdc')]),_0x9bb98b[_0x2caf('0xaa')],_0x9bb98b[_0x2caf('0xab')]);}}break;case _0x2caf('0xdd'):_0x157a14['outboundAbandonedCallsDay']+=0x1;_0x9bb98b[_0x2caf('0xde')]+=0x1;_0x9bb98b[_0x2caf('0xb9')]=ut[_0x2caf('0xa0')](_0x9bb98b);ut['logCustomer'](_0x9bb98b,0xb,_0x2caf('0xdf'));rpcDb[_0x2caf('0x94')](_0x9bb98b,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x2caf('0xa0')](_0x9bb98b)>=_0x157a14[_0x2caf('0xc4')]){_0x5a90a7=ut['cloneAction'](_0x9bb98b,0xf,'Global');rpcDb[_0x2caf('0x97')](_0x5a90a7,_0x2caf('0xe0'));}else{if(_0x9bb98b[_0x2caf('0xe1')]>=_0x157a14['dialAbandonedMaxRety']){rpcDb[_0x2caf('0x97')](_0x9bb98b,_0x2caf('0xe0'));}else{rpcDb[_0x2caf('0xa8')](ut[_0x2caf('0xc8')](_0x9bb98b,_0x2caf('0xde'),_0x157a14[_0x2caf('0xe2')]),_0x9bb98b['unlockAgent'],_0x9bb98b[_0x2caf('0xab')]);}}break;default:if(_0x9bb98b[_0x2caf('0x77')]){ut[_0x2caf('0x84')](_0x157a14,'[default]');ut[_0x2caf('0xe3')](_0x2caf('0xe4')+_0x157a14['name'],_0x46a063);}_0x157a14['outboundUnknownCallsDay']+=0x1;_0x9bb98b[_0x2caf('0xb9')]=ut[_0x2caf('0xa0')](_0x9bb98b);ut[_0x2caf('0x92')](_0x9bb98b,0xc,_0x46a063[_0x2caf('0xe5')]||_0x46a063[_0x2caf('0xe6')]);rpcDb[_0x2caf('0x94')](_0x9bb98b,_0x2caf('0xe7'));if(ut['totalGlobal'](_0x9bb98b)>=_0x157a14[_0x2caf('0xc4')]){_0x5a90a7=ut[_0x2caf('0xa4')](_0x9bb98b,0xf,_0x2caf('0xa5'));rpcDb[_0x2caf('0x97')](_0x5a90a7,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x2caf('0x97')](_0x9bb98b,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x46a063['linkedid']];}if(!(_0x9bb98b[_0x2caf('0x77')]&&_0x1fb36f==='16')){ut[_0x2caf('0x82')](_0x157a14,_0x2caf('0xe8'));logger[_0x2caf('0x5f')]('[originated][decrement][callProgressDetectingCustomer]',_0x9bb98b[_0x2caf('0xb0')],_0x2caf('0xbf'),_0x157a14['name'],_0x2caf('0x76'),_0x157a14[_0x2caf('0x51')]);}if(_0x1fb36f!==_0x2caf('0xe9')){delete this['actions'][_0x46a063['linkedid']];delete this[_0x2caf('0x15')][_0x46a063[_0x2caf('0xea')]];}}};Preview[_0x2caf('0xe')][_0x2caf('0xeb')]=function(_0x4491f2,_0x6069c2,_0x259ac2){if(_[_0x2caf('0xec')](_0x6069c2)&&_0x2caf('0xed')!==typeof _0x6069c2){return;}if(_[_0x2caf('0xec')](_0x259ac2)&&_0x2caf('0xed')!==typeof _0x259ac2){return;}switch(_0x259ac2[_0x2caf('0xee')]){case'0':ut[_0x2caf('0xef')](_0x4491f2,0x0,_0x2caf('0xa1'));rpcDb[_0x2caf('0xf0')](_0x4491f2,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x2caf('0xef')](_0x4491f2,0x3,'NoAnswer');rpcDb[_0x2caf('0xf0')](_0x4491f2,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x4491f2,0x5,_0x2caf('0xc1'));rpcDb[_0x2caf('0xf0')](_0x4491f2,_0x2caf('0xf1'));break;case'8':ut[_0x2caf('0xef')](_0x4491f2,0x8,_0x2caf('0xd1'));rpcDb[_0x2caf('0xf0')](_0x4491f2,_0x2caf('0xf2'));break;case'22':ut[_0x2caf('0xef')](_0x4491f2,0x16,'AnswerAGI');rpcDb[_0x2caf('0xf0')](_0x4491f2,_0x2caf('0xf3'));break;default:ut[_0x2caf('0xef')](_0x4491f2,0xc,_0x259ac2[_0x2caf('0xee')]);rpcDb[_0x2caf('0xf0')](_0x4491f2,'[callProgressDetectingAgent][logCongestion]');}ut[_0x2caf('0x82')](_0x6069c2,_0x2caf('0xf4'));logger[_0x2caf('0x5f')](_0x2caf('0xf5'),_0x4491f2[_0x2caf('0xb0')],'\x20Queue',_0x6069c2[_0x2caf('0x28')],_0x2caf('0x76'),_0x6069c2[_0x2caf('0x51')]);delete this['actions'][_0x4491f2[_0x2caf('0xb0')]];};Preview[_0x2caf('0xe')][_0x2caf('0xf6')]=function(_0x13c399,_0x3c9cb9,_0x1dce28,_0xd06543,_0xa78d21){var _0x1e28c7=this;return new BPromise(function(_0x53211f,_0x149d86){if(_[_0x2caf('0x72')](_0x3c9cb9)||_[_0x2caf('0x72')](_0x3c9cb9[_0x2caf('0xf7')])||_['isNil'](_0x3c9cb9['Contact'][_0x2caf('0xf8')])||_[_0x2caf('0x72')](_0x3c9cb9[_0x2caf('0x7b')])){_0x149d86(ut['message'](_0x2caf('0xf9'),_0xd06543,_0xa78d21));return;}var _0x506e93=uuid['v4']();var _0x535bf4=_0x1e28c7[_0x2caf('0x12')][_0x3c9cb9[_0x2caf('0x74')]['name']];var _0x4a0348=_0x1dce28?_0x1e28c7[_0x2caf('0x16')][_0x1dce28]['id']:undefined;_0x1e28c7['actions'][_0x506e93]=new Action(_0x3c9cb9,_0x535bf4,_0x506e93,_0x1dce28,_0x4a0348);var _0x47f519=_0x1e28c7[_0x2caf('0x15')][_0x506e93];_0x47f519[_0x2caf('0xaa')]=_0xd06543;_0x47f519[_0x2caf('0xab')]=_0xa78d21;_0x47f519[_0x2caf('0xfa')]=_0x1dce28;if(_[_0x2caf('0xfb')](_0x13c399)){_0x1e28c7[_0x2caf('0xfc')](_0x47f519,_0x535bf4,_0x3c9cb9,_0x1dce28)[_0x2caf('0x89')](function(_0x20736e){logger[_0x2caf('0x5f')](_0x2caf('0xfd'),_0x2caf('0xfe')+_0x47f519[_0x2caf('0x75')]+_0x2caf('0xff')+_0x47f519[_0x2caf('0x100')],JSON['stringify'](_0x20736e));ami[_0x2caf('0x25')](_0x2caf('0x101'),ut[_0x2caf('0xa3')](_0x47f519,_0x2caf('0x102'),_0x1e28c7[_0x2caf('0x12')][_0x47f519['queue']]));_0x53211f(ut[_0x2caf('0x50')](_0x2caf('0x103')));})['catch'](function(_0x5b7c12){ut[_0x2caf('0x69')](_0x2caf('0x104'),_0x5b7c12);_0x149d86(ut[_0x2caf('0x50')](_0x2caf('0x105'),_0xd06543,_0xa78d21));});}else{_0x535bf4[_0x2caf('0x3d')]+=0x1;ut[_0x2caf('0x106')](_0x47f519);rpcDb[_0x2caf('0x107')](_0x47f519,_0x2caf('0x108'));delete _0x1e28c7[_0x2caf('0x15')][_0x506e93];_0x149d86(ut[_0x2caf('0x50')](_0x2caf('0x109'),_0xd06543,_0xa78d21));}});};Preview[_0x2caf('0xe')][_0x2caf('0x9c')]=function(_0x5ca2ca){return!_[_0x2caf('0x72')](_0x5ca2ca)&&!_[_0x2caf('0x72')](_0x5ca2ca[_0x2caf('0x28')])&&!_[_0x2caf('0x72')](_0x5ca2ca['active'])&&_0x5ca2ca['active']&&!_[_0x2caf('0x72')](this[_0x2caf('0x14')][util[_0x2caf('0x5d')](_0x2caf('0x10a'),_0x5ca2ca[_0x2caf('0x28')])])&&!_[_0x2caf('0x72')](this[_0x2caf('0x14')][util[_0x2caf('0x5d')]('SIP/%s',_0x5ca2ca['name'])][_0x2caf('0x7e')])&&(this[_0x2caf('0x14')][util[_0x2caf('0x5d')](_0x2caf('0x10a'),_0x5ca2ca[_0x2caf('0x28')])]['status']===_0x2caf('0x10b')||this[_0x2caf('0x14')][util[_0x2caf('0x5d')](_0x2caf('0x10a'),_0x5ca2ca[_0x2caf('0x28')])]['status']===_0x2caf('0x10c'));};Preview[_0x2caf('0xe')]['run']=function(_0x49daa4,_0x1a365a){var _0xd9cc7f=this;return new BPromise(function(_0xd2b460,_0x5dfba9){_0xd9cc7f[_0x2caf('0x10d')](_0x49daa4,_0x1a365a)[_0x2caf('0x89')](function(_0x552629){_0xd2b460(_['pick'](_0x552629,[_0x2caf('0x50')]));})['catch'](function(_0x120a49){if(_0x120a49['unlock']){rpcDb['unlockContact'](_0x49daa4);}if(_0x120a49['active']){rpcDb[_0x2caf('0x8f')](_0x49daa4);}_0x5dfba9(_['pick'](_0x120a49,[_0x2caf('0x50')]));});});};Preview[_0x2caf('0xe')][_0x2caf('0x10d')]=function(_0xf5c675,_0x4d7fe9){var _0x37688a=this;return new BPromise(function(_0x5a7b5d,_0x358bc7){var _0x59e90d,_0xd9dc2;rpcDb[_0x2caf('0x10e')](_0xf5c675)['then'](function(_0x200dda){if(!_['isNil'](_0x200dda[0x0])){_0xd9dc2=_0x200dda[0x0][_0x2caf('0x10f')]?![]:!![];_0x59e90d=_0x200dda[0x0][_0x2caf('0x10f')]?!![]:![];_0x59e90d=_0x4d7fe9?!![]:_0x59e90d;}var _0x35952e=_0x37688a[_0x2caf('0x110')](_0x200dda);if(_0x35952e[_0x2caf('0x111')]){rpcDb[_0x2caf('0x112')](_['pick'](_0x200dda[0x0],[_0x2caf('0x7b'),_0x2caf('0x113')]))[_0x2caf('0x89')](function(_0x19bf42){_0x37688a[_0x2caf('0xf6')](_0x19bf42,_0x200dda[0x0],_0x4d7fe9,_0xd9dc2,_0x59e90d)[_0x2caf('0x89')](function(_0x201004){_0x5a7b5d(_0x201004);})[_0x2caf('0x80')](function(_0x5555e9){_0x358bc7(_0x5555e9);});})['catch'](function(_0x2765f1){ut['logger'](_0x2caf('0x114'),_0x2765f1);_0x358bc7(ut[_0x2caf('0x50')](_0x2caf('0x115'),_0xd9dc2,_0x59e90d));});}else{_0x358bc7(ut[_0x2caf('0x50')](_0x35952e[_0x2caf('0x50')],_0xd9dc2,_0x59e90d));}})[_0x2caf('0x80')](function(_0x58b223){ut['logger'](_0x2caf('0x116'),_0x58b223);_0x358bc7(ut[_0x2caf('0x50')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x2caf('0xe')][_0x2caf('0x110')]=function(_0x1af64b){if(_[_0x2caf('0x72')](_0x1af64b)||_[_0x2caf('0xfb')](_0x1af64b)||!_['isNil'](_0x1af64b[0x0]['Agent'])&&_[_0x2caf('0x72')](_0x1af64b[0x0][_0x2caf('0x8c')][_0x2caf('0x28')])){ut[_0x2caf('0x69')](_0x2caf('0x117'),_0x1af64b);return{'isValid':![],'message':'Empty\x20Contact'};}var _0xd9ff0d=this[_0x2caf('0x12')][_0x1af64b[0x0][_0x2caf('0x74')][_0x2caf('0x28')]];_0xd9ff0d['message']=_0x2caf('0x9e');if(_[_0x2caf('0x72')](_0xd9ff0d)){ut[_0x2caf('0x69')](_0x2caf('0x118'),_0xd9ff0d);return{'isValid':![],'message':_0x2caf('0x119')};}if(!this[_0x2caf('0x9c')](_0xd9ff0d[_0x2caf('0x58')])){ut[_0x2caf('0x69')](_0x2caf('0x11a'),_0x2caf('0x11b')+_0xd9ff0d[_0x2caf('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0xd9ff0d[_0x2caf('0x9d')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0xd9ff0d['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x2caf('0x11c')](_0xd9ff0d[_0x2caf('0x35')])){ut[_0x2caf('0x69')](_0x2caf('0x11d'),_0xd9ff0d[_0x2caf('0x28')]+_0x2caf('0x11e'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xd9ff0d['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x2caf('0xe')]['execCall']=function(_0x42e899,_0x2125dc,_0x4e49dc,_0x94f852){var _0x56e102=this;return new BPromise(function(_0x666878,_0x1f6c1b){var _0x463f3e=_0x42e899[_0x2caf('0xb0')];var _0x1ccf41=_0x56e102[_0x2caf('0x9c')](_0x2125dc['Trunk'])?util['format']('SIP/%s/%s%s',_0x2125dc[_0x2caf('0x58')][_0x2caf('0x28')],_[_0x2caf('0x72')](_0x2125dc['dialPrefix'])?'':_0x2125dc['dialPrefix']['trim']()||'',_0x2125dc[_0x2caf('0x11f')]>0x0?_0x4e49dc['Contact']['phone'][_0x2caf('0x120')](_0x2125dc[_0x2caf('0x11f')]):_0x4e49dc[_0x2caf('0xf7')]['phone']):util[_0x2caf('0x5d')]('SIP/%s/%s%s',_[_0x2caf('0x72')](_0x2125dc[_0x2caf('0x9d')])?_0x2125dc[_0x2caf('0x58')][_0x2caf('0x28')]:_0x2125dc['TrunkBackup'][_0x2caf('0x28')],_['isNil'](_0x2125dc[_0x2caf('0x3a')])?'':_0x2125dc[_0x2caf('0x3a')][_0x2caf('0x121')]()||'',_0x2125dc[_0x2caf('0x11f')]>0x0?_0x4e49dc['Contact'][_0x2caf('0xf8')][_0x2caf('0x120')](_0x2125dc[_0x2caf('0x11f')]):_0x4e49dc[_0x2caf('0xf7')][_0x2caf('0xf8')]);var _0x5d2d7e=_0x56e102['isTrunkReachable'](_0x2125dc[_0x2caf('0x58')])?ut[_0x2caf('0x122')](_0x2125dc[_0x2caf('0x58')][_0x2caf('0x5a')],_0x2125dc[_0x2caf('0x37')],_0x2125dc[_0x2caf('0x123')]>0x0?ut[_0x2caf('0x124')](_0x2125dc[_0x2caf('0x38')],_0x2125dc[_0x2caf('0x123')]):_0x2125dc[_0x2caf('0x38')]):ut['getCallerId'](_[_0x2caf('0x72')](_0x2125dc['TrunkBackup'])?_0x2125dc[_0x2caf('0x58')]['callerid']:_0x2125dc[_0x2caf('0x9d')][_0x2caf('0x5a')],_0x2125dc[_0x2caf('0x37')],_0x2125dc[_0x2caf('0x123')]>0x0?ut[_0x2caf('0x124')](_0x2125dc['dialOriginateCallerIdNumber'],_0x2125dc[_0x2caf('0x123')]):_0x2125dc['dialOriginateCallerIdNumber']);if(_0x5d2d7e){_0x42e899[_0x2caf('0x125')]=ut[_0x2caf('0x126')](_0x5d2d7e);_0x42e899[_0x2caf('0x127')]=ut['extractCalleridNumber'](_0x5d2d7e);}var _0x1daff9=ut[_0x2caf('0x128')](_0x2125dc,_0x4e49dc,_0x1ccf41,_0x5d2d7e,_0x463f3e,_0x42e899);_[_0x2caf('0x129')](_0x42e899,ut['toLowerVariables'](_0x1daff9));_0x42e899['starttime']=moment()['format'](_0x2caf('0x91'));ami[_0x2caf('0x7d')](ut[_0x2caf('0x12a')](_0x42e899,_0x2125dc,_0x1daff9,_0x42e899[_0x2caf('0xab')],_0x94f852))[_0x2caf('0x89')](function(_0x541665){_0x2125dc[_0x2caf('0x51')]+=0x1;logger[_0x2caf('0x5f')](_0x2caf('0x12b'),_0x463f3e,_0x2caf('0xbf'),_0x2125dc[_0x2caf('0x28')],_0x2caf('0x76'),_0x2125dc[_0x2caf('0x51')]);_0x666878(_0x541665);})[_0x2caf('0x80')](function(_0x3d6eae){ut['logAgent'](_0x42e899,0xe,_0x2caf('0x12c'));rpcDb['createAgentHistory'](_0x42e899,_0x2caf('0x12d'));_0x1f6c1b(_0x3d6eae);});});};Preview['prototype'][_0x2caf('0x1e')]=function(_0x5b0c20){if(this['actions'][_0x5b0c20[_0x2caf('0xac')]]){this[_0x2caf('0x15')][_0x5b0c20[_0x2caf('0xac')]][_0x2caf('0x7f')]=_0x5b0c20['channel'];}};Preview[_0x2caf('0xe')][_0x2caf('0x12e')]=function(_0x471b8c){var _0x36a518=this;var _0x25e4c3=this[_0x2caf('0x15')][_0x471b8c['actionid']];if(_0x25e4c3){if(_0x25e4c3['lookAgent']&&this['agents'][_0x25e4c3[_0x2caf('0xfa')]]){ut[_0x2caf('0x12f')](_0x25e4c3,this[_0x2caf('0x16')][_0x25e4c3[_0x2caf('0xfa')]][_0x2caf('0x28')],this[_0x2caf('0x16')][_0x25e4c3[_0x2caf('0xfa')]]['id']);}var _0x3ae265=_[_0x2caf('0x130')](_0x25e4c3);_0x3ae265[_0x2caf('0xad')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x25fc1c=_0x36a518[_0x2caf('0x12')][_0x25e4c3['queue']];if(ut[_0x2caf('0x131')](_0x471b8c['response'])){if(_0x25e4c3[_0x2caf('0xaa')]){rpcDb[_0x2caf('0x132')](_0x25e4c3[_0x2caf('0x100')]);}if(_0x25e4c3['activeContact']){rpcDb['disableContact'](_0x25e4c3[_0x2caf('0x100')]);}ami[_0x2caf('0x25')](_0x2caf('0x133'),ut[_0x2caf('0xa3')](_0x25e4c3,_0x2caf('0x134'),this[_0x2caf('0x12')][_0x25e4c3[_0x2caf('0x75')]]));this[_0x2caf('0xeb')](_0x3ae265,_0x25fc1c,_0x471b8c);}else{_0x25e4c3[_0x2caf('0x90')]=moment()[_0x2caf('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x2caf('0xef')](_0x3ae265,0x4,_0x2caf('0xba'));rpcDb[_0x2caf('0xf0')](_0x3ae265,_0x2caf('0x135'));}}};Preview['prototype'][_0x2caf('0x19')]=function(_0x48d025){var _0x518a55=this;var _0x444ed6=this['actions'][_0x48d025[_0x2caf('0xac')]];var _0x1fd4d7;if(_0x444ed6){_0x1fd4d7=this[_0x2caf('0x12')][_0x444ed6[_0x2caf('0x75')]];logger[_0x2caf('0x5f')](_0x2caf('0x136'),_0x48d025['linkedid'],_0x2caf('0xbf'),_0x1fd4d7[_0x2caf('0x28')],'pTalking:\x20',_0x1fd4d7[_0x2caf('0x2c')]);}if(this['actions'][_0x48d025[_0x2caf('0xac')]]&&_0x48d025[_0x2caf('0xac')]!==_0x48d025[_0x2caf('0xb0')]){if(_0x48d025['cause']==='16'&&this[_0x2caf('0x15')][_0x48d025[_0x2caf('0xac')]]['dialAnswer']){this[_0x2caf('0x137')](_0x48d025,_0x48d025[_0x2caf('0xac')],_0x48d025[_0x2caf('0x138')]);}else if(this[_0x2caf('0x15')][_0x48d025[_0x2caf('0xac')]]['dialAnswer']){logger['info'](_0x2caf('0x139'),_0x48d025[_0x2caf('0xac')],_0x48d025[_0x2caf('0x138')],_0x2caf('0xbf'),_0x1fd4d7[_0x2caf('0x28')],_0x2caf('0xb1'),_0x1fd4d7[_0x2caf('0x2c')]);this[_0x2caf('0x137')](_0x48d025,_0x48d025[_0x2caf('0xac')],_0x48d025[_0x2caf('0x138')]);}}else if(_0x444ed6&&_['isNil'](_0x444ed6['statedesc'])&&_0x1fd4d7[_0x2caf('0x13a')]&&_0x48d025['linkedid']===_0x48d025['uniqueid']&&_[_0x2caf('0x72')](_0x48d025['reason'])&&_0x48d025['cause']==='16'&&_0x48d025[_0x2caf('0x13b')]==='6'&&_['isUndefined'](_0x444ed6[_0x2caf('0x13c')])){if(_0x444ed6[_0x2caf('0xaa')]){rpcDb[_0x2caf('0x132')](_0x444ed6[_0x2caf('0x100')]);}if(_0x444ed6[_0x2caf('0xab')]){rpcDb[_0x2caf('0x8f')](_0x444ed6[_0x2caf('0x100')]);}_0x48d025[_0x2caf('0xee')]='22';this[_0x2caf('0xeb')](_0x444ed6,_0x1fd4d7,_0x48d025);}else if(_0x444ed6&&_0x444ed6[_0x2caf('0x13c')]){if(_0x48d025[_0x2caf('0x138')]==='16'&&this['actions'][_0x48d025[_0x2caf('0xac')]][_0x2caf('0x77')]){logger[_0x2caf('0x5f')](_0x2caf('0x13d'),_0x48d025[_0x2caf('0xac')],_0x48d025[_0x2caf('0x138')],_0x2caf('0xbf'),_0x1fd4d7[_0x2caf('0x28')],_0x2caf('0xb1'),_0x1fd4d7['pTalking']);this['callProgressDetectingCustomer'](_0x48d025,_0x48d025[_0x2caf('0xac')],_0x48d025[_0x2caf('0x138')]);}else if(this['actions'][_0x48d025[_0x2caf('0xac')]][_0x2caf('0x77')]){logger[_0x2caf('0x5f')](_0x2caf('0x139'),_0x48d025['linkedid'],_0x48d025[_0x2caf('0x138')],_0x2caf('0xbf'),_0x1fd4d7['name'],'pTalking:\x20',_0x1fd4d7[_0x2caf('0x2c')]);this[_0x2caf('0x137')](_0x48d025,_0x48d025[_0x2caf('0xac')],_0x48d025[_0x2caf('0x138')]);}}};Preview[_0x2caf('0xe')][_0x2caf('0x13e')]=function(_0x21a2a0){if(this[_0x2caf('0x15')][_0x21a2a0[_0x2caf('0xea')]]&&_0x21a2a0[_0x2caf('0xea')]!==_0x21a2a0[_0x2caf('0x13f')]){this[_0x2caf('0x137')](_0x21a2a0,_0x21a2a0[_0x2caf('0xea')],_0x21a2a0[_0x2caf('0xe6')]);}};Preview[_0x2caf('0xe')][_0x2caf('0x1b')]=function(_0x7c658a){if(this[_0x2caf('0x15')][_0x7c658a[_0x2caf('0xac')]]&&_0x7c658a[_0x2caf('0xac')]!==_0x7c658a[_0x2caf('0xb0')]&&!this['actions'][_0x7c658a['linkedid']]['dialAnswer']){if(_0x7c658a[_0x2caf('0x138')]==='1'){this[_0x2caf('0x137')](_0x7c658a,_0x7c658a[_0x2caf('0xac')],_0x7c658a[_0x2caf('0x138')]);}}};Preview[_0x2caf('0xe')][_0x2caf('0x140')]=function(_0x22e2fa,_0x5d6f02,_0x11bd61){if(this[_0x2caf('0x15')][_0x22e2fa]){if(_[_0x2caf('0x72')](this[_0x2caf('0x15')][_0x22e2fa][_0x2caf('0x141')])){this[_0x2caf('0x15')][_0x22e2fa][_0x2caf('0x141')]={};}this[_0x2caf('0x15')][_0x22e2fa][_0x2caf('0x141')][_0x5d6f02]=_0x11bd61;}};Preview[_0x2caf('0xe')]['syncVarSet']=function(_0x23ae2b){try{if(!_[_0x2caf('0x72')](_0x23ae2b)){if(ut[_0x2caf('0x142')](_[_0x2caf('0x143')](_0x23ae2b['variable'])[0x0])){this[_0x2caf('0x140')](_0x23ae2b[_0x2caf('0xb0')],_[_0x2caf('0x143')](_0x23ae2b['variable'])[0x0],_0x23ae2b[_0x2caf('0x144')]);}}}catch(_0x853d69){logger['error'](_0x2caf('0x145'),util['inspect'](_0x853d69,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x43dffc){if(_0x43dffc){if(this[_0x2caf('0x15')][_0x43dffc[_0x2caf('0x146')]]){this[_0x2caf('0x15')][_0x43dffc[_0x2caf('0x146')]]['transfer']=!![];}}};Preview[_0x2caf('0xe')]['syncBlindTransfer']=function(_0x13d0ab){if(_0x13d0ab){if(this['actions'][_0x13d0ab['transfererlinkedid']]){this[_0x2caf('0x15')][_0x13d0ab[_0x2caf('0x147')]]['transfer']=!![];}}};module[_0x2caf('0x148')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1eb614f..a70b03d 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 _0xe0ae=['preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','then','[createHistory]\x20','resolve','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger'];(function(_0x295095,_0x20b7be){var _0x4cf1a5=function(_0x266ed2){while(--_0x266ed2){_0x295095['push'](_0x295095['shift']());}};_0x4cf1a5(++_0x20b7be);}(_0xe0ae,0xa1));var _0xee0a=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xe0ae[_0x24618a];return _0x2e3d64;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var _=require('lodash');var cmHopper=require(_0xee0a('0x2'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xee0a('0x3'));var cmHopperBlack=require(_0xee0a('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xee0a('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5bef07){return function(_0x39a302){logger[_0xee0a('0x6')](_0x5bef07,util[_0xee0a('0x7')](_0x39a302,{'showHidden':![],'depth':null}));};}function create(_0x344355){return BPromise['resolve']()[_0xee0a('0x8')](cmHopperHistory['createHistory'](_0x344355))['catch'](loggerCatch(_0xee0a('0x9')));}function createAgent(_0x3d0b3f){return BPromise[_0xee0a('0xa')]()['then'](agentReportPreview[_0xee0a('0xb')](_0x3d0b3f))[_0xee0a('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x305987){return BPromise['resolve']()[_0xee0a('0x8')](cmHopper[_0xee0a('0xd')](_0x305987,!![]))['catch'](loggerCatch(_0xee0a('0xe')));}exports['checkIsBlackList']=function(_0x32fad9){return BPromise[_0xee0a('0xa')]()['then'](cmHopperBlack['checkIsBlackList'](_0x32fad9))[_0xee0a('0xc')](loggerCatch(_0xee0a('0xf')));};exports[_0xee0a('0x10')]=function(_0x427b5c){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x10')](_0x427b5c))[_0xee0a('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0xee0a('0xb')]=function(_0x35d1e4,_0x1bc8e1){create(_0x35d1e4)[_0xee0a('0xc')](loggerCatch(_0x1bc8e1));moveContact(_0x35d1e4)['catch'](loggerCatch(_0x1bc8e1));};exports[_0xee0a('0x11')]=function(_0x1d7a8a,_0x14ef67){createAgent(_0x1d7a8a)['catch'](loggerCatch(_0x14ef67));};exports[_0xee0a('0x12')]=function(_0x1ffdb5,_0xe1f346){create(_0x1ffdb5)[_0xee0a('0xc')](loggerCatch(_0xe1f346));};exports['createCustomerFinal']=function(_0xe9d5d4,_0x10c224){moveContact(_0xe9d5d4)[_0xee0a('0xc')](loggerCatch(_0x10c224));};exports[_0xee0a('0x13')]=function(_0x5c981e,_0x2abfbd,_0xff2f14){if(_0x2abfbd){_0x5c981e[_0xee0a('0x14')]=null;}if(_0xff2f14){_0x5c981e[_0xee0a('0x15')]=![];}return BPromise[_0xee0a('0xa')]()[_0xee0a('0x8')](cmHopper[_0xee0a('0x13')](_0x5c981e))['catch'](loggerCatch(_0xee0a('0x16')));};exports[_0xee0a('0x17')]=function(_0x27989c){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x17')](_0x27989c))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x18')));};exports[_0xee0a('0x19')]=function(_0x4c61e2){return BPromise['resolve']()['then'](cmHopper[_0xee0a('0x19')]({'UserId':null},_0x4c61e2,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xee0a('0x1a')]=function(_0x2c8965){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x19')]({'active':![]},_0x2c8965,0x1))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x1b')));};exports[_0xee0a('0x1c')]=function(_0x2e7f18){var _0x45538d={};_0x45538d[_0xee0a('0x1d')]=_0x2e7f18[_0xee0a('0x1d')];_0x45538d[_0xee0a('0x1e')]=_0x2e7f18[_0xee0a('0x1e')];_0x45538d['calleridnum']=_0x2e7f18[_0xee0a('0x1f')];_0x45538d[_0xee0a('0x20')]=_0x2e7f18[_0xee0a('0x20')];_0x45538d[_0xee0a('0x21')]=_0x2e7f18[_0xee0a('0x21')];_0x45538d[_0xee0a('0x22')]=_0x2e7f18['answertime'];_0x45538d[_0xee0a('0x23')]=_0x2e7f18[_0xee0a('0x24')];_0x45538d[_0xee0a('0x25')]=0x1;_0x45538d[_0xee0a('0x26')]=_0x2e7f18['endtime'];_0x45538d[_0xee0a('0x27')]=_0x2e7f18['membername'];_0x45538d[_0xee0a('0x28')]=_0xee0a('0x29');_0x45538d[_0xee0a('0x2a')]=_0xee0a('0x2b');_0x45538d[_0xee0a('0x2c')]=0x0;_0x45538d[_0xee0a('0x2d')]=0x1;_0x45538d[_0xee0a('0x2e')]=_0x2e7f18[_0xee0a('0x2f')];_0x45538d['queuecallerexitreason']=_0xee0a('0x30');return BPromise[_0xee0a('0xa')]()['then'](voiceQueueReport[_0xee0a('0x31')](_0x45538d))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x32')));};exports['getContactRecallMe']=function(_0x131b60,_0x2a81a0){return BPromise[_0xee0a('0xa')]()['then'](cmHopper[_0xee0a('0x33')](_0x131b60,_0x2a81a0))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x34')));};exports['rescheduleContactInQueue']=function(_0x47a59c){return BPromise[_0xee0a('0xa')]()[_0xee0a('0x8')](cmHopper[_0xee0a('0x13')](_0x47a59c,!![],!![]))[_0xee0a('0xc')](loggerCatch(_0xee0a('0x35')));}; \ No newline at end of file +var _0x25fa=['util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x25fa,0x109));var _0xa25f=function(_0x3cefa8,_0x114a8d){_0x3cefa8=_0x3cefa8-0x0;var _0x494210=_0x25fa[_0x3cefa8];return _0x494210;};'use strict';var util=require(_0xa25f('0x0'));var BPromise=require('bluebird');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var _=require('lodash');var cmHopper=require(_0xa25f('0x3'));var cmHopperFinal=require(_0xa25f('0x4'));var cmHopperHistory=require(_0xa25f('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xa25f('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2ea9ea){return function(_0x3ab530){logger[_0xa25f('0x7')](_0x2ea9ea,util[_0xa25f('0x8')](_0x3ab530,{'showHidden':![],'depth':null}));};}function create(_0x22982b){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperHistory[_0xa25f('0xb')](_0x22982b))[_0xa25f('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1bca18){return BPromise[_0xa25f('0x9')]()['then'](agentReportPreview[_0xa25f('0xb')](_0x1bca18))[_0xa25f('0xc')](loggerCatch(_0xa25f('0xd')));}function moveContact(_0x22df56){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0xe')](_0x22df56,!![]))['catch'](loggerCatch(_0xa25f('0xf')));}exports[_0xa25f('0x10')]=function(_0x50bb78){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperBlack[_0xa25f('0x10')](_0x50bb78))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x11')));};exports[_0xa25f('0x12')]=function(_0x46cd8c){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper[_0xa25f('0x12')](_0x46cd8c))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x13')));};exports['createHistory']=function(_0x2d4f0f,_0x471679){create(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));moveContact(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));};exports[_0xa25f('0x14')]=function(_0x427105,_0x4a4805){createAgent(_0x427105)[_0xa25f('0xc')](loggerCatch(_0x4a4805));};exports['createCustomerHistory']=function(_0x32b868,_0x562573){create(_0x32b868)['catch'](loggerCatch(_0x562573));};exports[_0xa25f('0x15')]=function(_0x489c83,_0x46bb31){moveContact(_0x489c83)[_0xa25f('0xc')](loggerCatch(_0x46bb31));};exports[_0xa25f('0x16')]=function(_0x3c2665,_0x21d035,_0x504135){if(_0x21d035){_0x3c2665[_0xa25f('0x17')]=null;}if(_0x504135){_0x3c2665[_0xa25f('0x18')]=![];}return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['rescheduleContact'](_0x3c2665))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x19')));};exports[_0xa25f('0x1a')]=function(_0x3675b5){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0x1a')](_0x3675b5))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x1b')));};exports['unlockContact']=function(_0x2812d7){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'UserId':null},_0x2812d7,0x1))['catch'](loggerCatch(_0xa25f('0x1d')));};exports['disableContact']=function(_0x1e1fbd){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'active':![]},_0x1e1fbd,0x1))[_0xa25f('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xa25f('0x1e')]=function(_0x5d39c7){var _0x1030c4={};_0x1030c4[_0xa25f('0x1f')]=_0x5d39c7[_0xa25f('0x1f')];_0x1030c4[_0xa25f('0x20')]=_0x5d39c7[_0xa25f('0x20')];_0x1030c4['calleridnum']=_0x5d39c7[_0xa25f('0x21')];_0x1030c4[_0xa25f('0x22')]=_0x5d39c7[_0xa25f('0x22')];_0x1030c4[_0xa25f('0x23')]=_0x5d39c7[_0xa25f('0x23')];_0x1030c4['queuecallerjoinAt']=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x25')]=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x26')]=0x1;_0x1030c4[_0xa25f('0x27')]=_0x5d39c7[_0xa25f('0x28')];_0x1030c4[_0xa25f('0x29')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2b')]='from-sip';_0x1030c4['exten']='xcally-motion-preview';_0x1030c4[_0xa25f('0x2c')]=0x0;_0x1030c4[_0xa25f('0x2d')]=0x1;_0x1030c4[_0xa25f('0x2e')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2f')]=_0xa25f('0x30');return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](voiceQueueReport[_0xa25f('0x31')](_0x1030c4))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x32')));};exports['getContactRecallMe']=function(_0x58ee76,_0xeb44b1){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['getContactRecallMe'](_0x58ee76,_0xeb44b1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xa25f('0x33')]=function(_0x25952d){return BPromise[_0xa25f('0x9')]()['then'](cmHopper['rescheduleContact'](_0x25952d,!![],!![]))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x34')));}; \ 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 6d128b5..2f5ffc2 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 _0xc9b4=['xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','diff','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countcongestionretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','getDiff','seconds','createBody','CampaignId','idContact','type','campaigntype','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype'];(function(_0x18b405,_0x1ee57b){var _0x2df375=function(_0x5a4034){while(--_0x5a4034){_0x18b405['push'](_0x18b405['shift']());}};_0x2df375(++_0x1ee57b);}(_0xc9b4,0x122));var _0x4c9b=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xc9b4[_0x1b2422];return _0x376573;};'use strict';var util=require('util');var _=require(_0x4c9b('0x0'));var moment=require(_0x4c9b('0x1'));var logger=require(_0x4c9b('0x2'))('preview');var ipAgi=process[_0x4c9b('0x3')][_0x4c9b('0x4')]||'127.0.0.1';function getSeconds(_0x5ac644,_0x3e83c2){var _0x4b7b37=moment(_0x5ac644)[_0x4c9b('0x5')](0x0);var _0x51ba6f=moment(_0x3e83c2)[_0x4c9b('0x5')](0x0);return _0x4b7b37[_0x4c9b('0x6')](_0x51ba6f,'seconds');}exports[_0x4c9b('0x7')]=function(_0x8e2c4){return function(_0xd909af){logger[_0x4c9b('0x8')](_0x8e2c4,util[_0x4c9b('0x9')](_0xd909af,{'showHidden':![],'depth':null}));};};exports[_0x4c9b('0xa')]=function(_0x4e7dc3,_0x54b252){logger['info'](_0x4e7dc3,util['inspect'](_0x54b252,{'showHidden':![],'depth':null}));};exports[_0x4c9b('0xb')]=function(_0x3173b9,_0x536400){logger[_0x4c9b('0x8')](_0x3173b9,util[_0x4c9b('0x9')](_0x536400,{'showHidden':![],'depth':null}));};exports[_0x4c9b('0xc')]=function(_0x3ae365){return function(_0x57108a){logger[_0x4c9b('0xd')](_0x3ae365,util[_0x4c9b('0x9')](_0x57108a,{'showHidden':![],'depth':null}));};};exports[_0x4c9b('0xe')]=function(_0x3e1805,_0x13c63f,_0x37f69c){return{'message':_0x3e1805,'unlock':_0x13c63f,'active':_0x37f69c};};exports['getCallerId']=function(_0x3464c1,_0x2aa634,_0x4aaf39){if(!_[_0x4c9b('0xf')](_0x4aaf39)&&'string'===typeof _0x4aaf39&&!_['isEmpty'](_0x4aaf39)){if(!_[_0x4c9b('0xf')](_0x2aa634)&&_0x4c9b('0x10')===typeof _0x2aa634&&!_['isEmpty'](_0x2aa634)){return util[_0x4c9b('0x11')](_0x4c9b('0x12'),_0x2aa634,_0x4aaf39);}return util[_0x4c9b('0x11')](_0x4c9b('0x12'),_0x4aaf39,_0x4aaf39);}if(!_['isUndefined'](_0x3464c1)&&_0x4c9b('0x10')===typeof _0x3464c1&&!_[_0x4c9b('0x13')](_0x3464c1)){return _0x3464c1;}return _0x4c9b('0x14');};exports[_0x4c9b('0x15')]=function(_0x3cdaf3){if(_[_0x4c9b('0x16')](_0x3cdaf3)){return![];}return _0x3cdaf3;};exports[_0x4c9b('0x17')]=function(_0x12cf52,_0x1d4046,_0xf72eb1,_0x3d16c6,_0x27f63c,_0x1e99e7){var _0x3e0cd9={'XMD-QUEUE':_0x1d4046['Queue']?_0x1d4046['Queue'][_0x4c9b('0x18')]:'','XMD-CALLERID':_0x3d16c6,'XMD-CALLERID-PREVIEW':_0x1e99e7?util['format']('\x22%s\x22\x20<%s>',_0x1e99e7['calleridname'],_0x1e99e7[_0x4c9b('0x19')]):_0x3d16c6,'XMD-DIALID':_0x27f63c,'XMD-CONTACTID':_0x1d4046[_0x4c9b('0x1a')],'XMD-CDRTYPE':_0x4c9b('0x1b'),'CALLERID(all)':_0x3d16c6,'XMD-VOICEQUEUEID':_0x1d4046[_0x4c9b('0x1c')],'XMD-DIALCHANNEL':_0xf72eb1,'XMD-DIALTIMEOUT':_0x12cf52[_0x4c9b('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x4c9b('0x11')](_0x4c9b('0x1e'),_0x12cf52[_0x4c9b('0x1f')]?'g':'',_['isEmpty'](_0x12cf52['monitor_format'])?'':_0x4c9b('0x20')),'XMD-DIALURL':_0x12cf52[_0x4c9b('0x21')]||'','XMD-AGI':_0x12cf52[_0x4c9b('0x22')]?util[_0x4c9b('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x12cf52[_0x4c9b('0x22')]):_0x4c9b('0x23'),'XMD-AGIAFTER':_0x12cf52[_0x4c9b('0x1f')]?util[_0x4c9b('0x11')](_0x4c9b('0x24'),ipAgi,_0x12cf52['dialQueueProject2']):_0x4c9b('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1e99e7?_0x1e99e7[_0x4c9b('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x1e99e7?_0x1e99e7[_0x4c9b('0x26')]:'','XMD-DESTINATION':_0x4c9b('0x27')};if(!_[_0x4c9b('0x13')](_0x12cf52[_0x4c9b('0x28')])){_0x3e0cd9[util[_0x4c9b('0x11')]('%s',_0x4c9b('0x29'))]=_0x12cf52[_0x4c9b('0x28')];_0x3e0cd9[util[_0x4c9b('0x11')]('%s',_0x4c9b('0x2a'))]=_0x27f63c;}if(_0x1d4046&&_0x1d4046[_0x4c9b('0x2b')]){for(var _0x4dc148 in _0x1d4046[_0x4c9b('0x2b')]){if(_0x1d4046['Contact'][_0x4c9b('0x2c')](_0x4dc148)){if(!_[_0x4c9b('0x16')](_0x1d4046['Contact'][_0x4dc148])&&_0x4dc148!=='id'&&_0x4dc148!==_0x4c9b('0x2d')&&_0x4dc148!==_0x4c9b('0x2e')&&_0x4dc148!=='updatedAt'){_0x3e0cd9[util[_0x4c9b('0x11')](_0x4c9b('0x2f'),_0x4c9b('0x30'),_[_0x4c9b('0x31')](_0x4dc148))]=_0x1d4046[_0x4c9b('0x2b')][_0x4dc148];}}}}return _0x3e0cd9;};exports[_0x4c9b('0x32')]=function(_0x1f3764){var _0x3188ed={};for(var _0x128e4e in _0x1f3764){if(_0x1f3764[_0x4c9b('0x2c')](_0x128e4e)){_0x3188ed[util[_0x4c9b('0x11')]('%s',_['toLower'](_0x128e4e))]=_0x1f3764[_0x128e4e];}}return{'variables':_0x3188ed};};exports['updateOriginated']=function(_0x1ef9de,_0x5902b5){if(!_[_0x4c9b('0x16')](_0x1ef9de)){if(_0x1ef9de[_0x4c9b('0x2c')](_0x4c9b('0x33'))){if(_0x1ef9de[_0x4c9b('0x33')]>0x0){_0x1ef9de[_0x4c9b('0x33')]-=0x1;}else{logger[_0x4c9b('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5902b5);}}}else{logger[_0x4c9b('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5902b5);}};exports[_0x4c9b('0x34')]=function(_0x3348d2){var _0x3bebb6=moment()['format'](_0x4c9b('0x35'));_0x3348d2[_0x4c9b('0x36')]=0xd;_0x3348d2['statedesc']=_0x4c9b('0x37');_0x3348d2[_0x4c9b('0x38')]=_0x3bebb6;_0x3348d2[_0x4c9b('0x39')]=_0x3bebb6;_0x3348d2[_0x4c9b('0x3a')]=_0x3bebb6;};exports[_0x4c9b('0x3b')]=function(_0x58e352,_0xf5efc6,_0x1c941b){var _0x3d1b0a=moment()['format'](_0x4c9b('0x35'));_0x58e352[_0x4c9b('0x36')]=_0xf5efc6;_0x58e352[_0x4c9b('0x3c')]=_0x1c941b;_0x58e352['responsetime']=_0x3d1b0a;_0x58e352[_0x4c9b('0x3d')]=getSeconds(_0x58e352[_0x4c9b('0x39')],_0x58e352[_0x4c9b('0x38')]);};exports[_0x4c9b('0x3e')]=function(_0x328e11,_0xa82815,_0x148654){_0x328e11[_0x4c9b('0x3f')]=_0xa82815;_0x328e11[_0x4c9b('0x40')]=_0x148654;};exports[_0x4c9b('0x41')]=function(_0x3b7f3b,_0xcda11,_0x1c0b67){var _0x3a9e69=moment()[_0x4c9b('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b7f3b[_0x4c9b('0x36')]=_0xcda11;_0x3b7f3b['statedesc']=_0x1c0b67;_0x3b7f3b[_0x4c9b('0x39')]=_0x3b7f3b[_0x4c9b('0x39')]?_0x3b7f3b['responsetime']:_0x3a9e69;_0x3b7f3b[_0x4c9b('0x3a')]=_0x3b7f3b['endtime']?_0x3b7f3b[_0x4c9b('0x3a')]:_0x3a9e69;_0x3b7f3b[_0x4c9b('0x3d')]=getSeconds(_0x3b7f3b[_0x4c9b('0x39')]||0x0,_0x3b7f3b[_0x4c9b('0x38')]||0x0);_0x3b7f3b[_0x4c9b('0x42')]=_0x3b7f3b[_0x4c9b('0x43')]?getSeconds(_0x3b7f3b['endtime'],_0x3b7f3b[_0x4c9b('0x43')]):0x0;};exports['isFailure']=function(_0x371b4a){return _0x371b4a===_0x4c9b('0x44');};exports[_0x4c9b('0x45')]=function(_0x393513,_0x291580,_0x2bde16,_0x31afa4,_0x3f499a){var _0x5aad74=_0x31afa4?'RECALL':_0x393513[_0x4c9b('0x46')];_0x5aad74=_0x3f499a?_0x4c9b('0x47'):_0x5aad74;return{'actionid':_0x393513[_0x4c9b('0x48')],'action':_0x4c9b('0x49'),'channel':_0x393513['channelAgent'],'callerid':util[_0x4c9b('0x11')](_0x4c9b('0x12'),_0x5aad74,_0x393513[_0x4c9b('0x19')]),'Exten':'xcally-motion-preview','Context':_0x4c9b('0x4a'),'Priority':'1','variable':_0x2bde16,'timeout':(_0x291580[_0x4c9b('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x393513[_0x4c9b('0x48')]};};exports[_0x4c9b('0x4c')]=function(_0x48ee86){return _0x48ee86['countbusyretry']+_0x48ee86[_0x4c9b('0x4d')]+_0x48ee86['countnoanswerretry']+_0x48ee86['countagentrejectretry']+_0x48ee86['countnosuchnumberretry'];};exports[_0x4c9b('0x4e')]=function(_0xdbb27b){var _0xcee4ba=_[_0x4c9b('0x4f')](_0xdbb27b);_0xcee4ba['state']=0xf;_0xcee4ba[_0x4c9b('0x3c')]=_0x4c9b('0x50');return _0xcee4ba;};exports[_0x4c9b('0x51')]=function(_0x372f85,_0x36ab95,_0x2ddc49){var _0x5bdc9a={};_0x5bdc9a[_0x36ab95]=_0x372f85[_0x36ab95];_0x5bdc9a[_0x4c9b('0x52')]=![];_0x5bdc9a[_0x4c9b('0x53')]=moment()['add'](_0x2ddc49,_0x4c9b('0x54'))[_0x4c9b('0x11')](_0x4c9b('0x35'));_0x5bdc9a[_0x4c9b('0x1a')]=_0x372f85[_0x4c9b('0x1a')];_0x5bdc9a[_0x4c9b('0x55')]=_0x372f85[_0x4c9b('0x55')];_0x5bdc9a[_0x4c9b('0x1c')]=_0x372f85[_0x4c9b('0x1c')]||undefined;return _0x5bdc9a;};exports[_0x4c9b('0x56')]=function(_0x5bcd69,_0x45674b){if(!_['isNil'](_0x5bcd69)){if(_0x5bcd69[_0x4c9b('0x57')]>0x0){_0x5bcd69[_0x4c9b('0x57')]-=0x1;}else{logger[_0x4c9b('0x8')](_0x45674b,_0x4c9b('0x58'));}}else{logger[_0x4c9b('0x8')](_0x45674b,_0x4c9b('0x59'));}};exports[_0x4c9b('0x5a')]=function(_0x228762){if(_0x228762<=0x0){return!![];}return![];};exports[_0x4c9b('0x5b')]=function(_0x224814,_0x449b7a,_0x25c751){_0x224814[_0x4c9b('0x5c')]=_0x449b7a;_0x224814[_0x4c9b('0x18')]=_0x224814[_0x4c9b('0x5d')];_0x224814[_0x4c9b('0x5e')]=_0x224814[_0x4c9b('0x5f')];if(_0x25c751){_0x224814['mandatoryDisposition']=_0x25c751[_0x4c9b('0x60')];}return _0x224814;};exports[_0x4c9b('0x61')]=function(_0x2d2daa){var _0x179858={};_0x179858[_0x4c9b('0x5d')]=_0x2d2daa[_0x4c9b('0x5d')];_0x179858[_0x4c9b('0x5e')]=_0x2d2daa[_0x4c9b('0x5f')];_0x179858[_0x4c9b('0x48')]=_0x2d2daa[_0x4c9b('0x48')];return _0x179858;};exports[_0x4c9b('0x62')]=function(_0x54e25c){var _0x30685c=[];for(var _0x38f694 in _0x54e25c){if(_0x54e25c[_0x4c9b('0x2c')](_0x38f694)){if(!_['isNil'](_0x54e25c[_0x38f694])&&_0x54e25c[_0x38f694][_0x4c9b('0x36')]===_0x4c9b('0x63')&&_0x54e25c[_0x38f694][_0x4c9b('0x64')]===_0x4c9b('0x65')){_0x30685c['push'](_0x54e25c[_0x38f694]['id']);}}}return _0x30685c;};exports[_0x4c9b('0x66')]=function(_0x2b5c1f){var _0xea257f=moment()[_0x4c9b('0x5')](0x0);var _0x1d3de1=moment(_0x2b5c1f)[_0x4c9b('0x5')](0x0);return _0xea257f[_0x4c9b('0x6')](_0x1d3de1,_0x4c9b('0x67'));};exports[_0x4c9b('0x68')]=function(_0xfcf07c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xfcf07c[_0x4c9b('0x1a')],'ListId':_0xfcf07c[_0x4c9b('0x55')],'VoiceQueueId':_0xfcf07c['VoiceQueueId']||undefined,'CampaignId':_0xfcf07c[_0x4c9b('0x69')]||undefined};};exports['filterKey']=function(_0x146212){if(_0x146212==='uniqueid'||_0x146212===_0x4c9b('0x6a')||_0x146212===_0x4c9b('0x5d')||_0x146212===_0x4c9b('0x6b')||_0x146212===_0x4c9b('0x6c')||_0x146212==='dialAnswer'||_0x146212===_0x4c9b('0x3f')||_0x146212===_0x4c9b('0x5f')||_0x146212===_0x4c9b('0x46')||_0x146212==='active'||_0x146212===_0x4c9b('0x19')||_0x146212==='scheduledat'||_0x146212==='countbusyretry'||_0x146212===_0x4c9b('0x4d')||_0x146212===_0x4c9b('0x6d')||_0x146212===_0x4c9b('0x6e')||_0x146212===_0x4c9b('0x6f')||_0x146212===_0x4c9b('0x70')||_0x146212==='callbackat'||_0x146212===_0x4c9b('0x71')||_0x146212===_0x4c9b('0x1a')||_0x146212==='ListId'||_0x146212===_0x4c9b('0x40')||_0x146212===_0x4c9b('0x1c')||_0x146212==='sipcallid'||_0x146212===_0x4c9b('0x72')||_0x146212===_0x4c9b('0x73')||_0x146212===_0x4c9b('0x74')||_0x146212===_0x4c9b('0x75')||_0x146212==='xmd-dialurl'||_0x146212==='xmd-dialtimeout'||_0x146212===_0x4c9b('0x76')||_0x146212==='xmd-dialid'||_0x146212===_0x4c9b('0x77')||_0x146212==='xmd-contactid'||_0x146212===_0x4c9b('0x78')||_0x146212===_0x4c9b('0x79')||_0x146212==='xmd-agiafter'||_0x146212==='xmd-agi'||_0x146212==='rtpaudioqos'||_0x146212===_0x4c9b('0x7a')||_0x146212==='rtpaudioqosjitter'||_0x146212===_0x4c9b('0x7b')||_0x146212===_0x4c9b('0x7c')||_0x146212===_0x4c9b('0x7d')||_0x146212===_0x4c9b('0x7e')||_0x146212==='rtpaudioqosrttbridged'||_0x146212===_0x4c9b('0x7f')||_0x146212===_0x4c9b('0x7a')||_0x146212===_0x4c9b('0x80')||_0x146212===_0x4c9b('0x7b')||_0x146212===_0x4c9b('0x7c')||_0x146212===_0x4c9b('0x7d')||_0x146212===_0x4c9b('0x7e')||_0x146212===_0x4c9b('0x81')||_0x146212===_0x4c9b('0x82')||_0x146212===_0x4c9b('0x83')||_0x146212===_0x4c9b('0x36')||_0x146212===_0x4c9b('0x3c')){return![];}return!![];};exports[_0x4c9b('0x84')]=function(_0x44a835,_0x35bb0f){var _0x390cdd,_0x4b1817,_0xe4b0cd;if(_0x35bb0f<=0x0){_0x35bb0f=0x1;}_0x390cdd=new RegExp('\x5cw{0,'+_0x35bb0f+'}$');_0x4b1817=Math[_0x4c9b('0x85')](0xa,_0x35bb0f-0x1);_0xe4b0cd=Math['pow'](0xa,_0x35bb0f)-0x1;return util[_0x4c9b('0x11')]('%s',_[_0x4c9b('0x86')](_0x44a835,_0x390cdd,_[_0x4c9b('0x87')](_0x4b1817,_0xe4b0cd)));};exports['extractCalleridName']=function(_0x281454){var _0x32402c=_0x281454['match'](/"(.*?)"/);return _0x32402c?_0x32402c[0x1]:_0x281454;};exports['extractCalleridNumber']=function(_0x1ffcbe){var _0x61c5cb=_0x1ffcbe[_0x4c9b('0x88')](/<(.*?)>/);return _0x61c5cb?_0x61c5cb[0x1]:_0x1ffcbe;}; \ No newline at end of file +var _0x6ec6=['%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','not_inuse','reachable','push','ListId','CampaignId','idContact','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','logger','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt'];(function(_0x263aa2,_0x7795b2){var _0x4ed9a1=function(_0x55b340){while(--_0x55b340){_0x263aa2['push'](_0x263aa2['shift']());}};_0x4ed9a1(++_0x7795b2);}(_0x6ec6,0xd5));var _0x66ec=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x6ec6[_0x556bb1];return _0x45455f;};'use strict';var util=require(_0x66ec('0x0'));var _=require(_0x66ec('0x1'));var moment=require('moment');var logger=require(_0x66ec('0x2'))(_0x66ec('0x3'));var ipAgi=process['env'][_0x66ec('0x4')]||_0x66ec('0x5');function getSeconds(_0x9dac14,_0xc4addd){var _0x4d5c68=moment(_0x9dac14)[_0x66ec('0x6')](0x0);var _0x283d7a=moment(_0xc4addd)[_0x66ec('0x6')](0x0);return _0x4d5c68[_0x66ec('0x7')](_0x283d7a,_0x66ec('0x8'));}exports['loggerCatch']=function(_0x438802){return function(_0x15805d){logger[_0x66ec('0x9')](_0x438802,util['inspect'](_0x15805d,{'showHidden':![],'depth':null}));};};exports[_0x66ec('0xa')]=function(_0x35c982,_0x268a4c){logger['info'](_0x35c982,util[_0x66ec('0xb')](_0x268a4c,{'showHidden':![],'depth':null}));};exports[_0x66ec('0xc')]=function(_0x28f1de,_0x2fd5e0){logger[_0x66ec('0x9')](_0x28f1de,util[_0x66ec('0xb')](_0x2fd5e0,{'showHidden':![],'depth':null}));};exports[_0x66ec('0xd')]=function(_0x490d93){return function(_0x3fb48f){logger['info'](_0x490d93,util[_0x66ec('0xb')](_0x3fb48f,{'showHidden':![],'depth':null}));};};exports[_0x66ec('0xe')]=function(_0x26da34,_0x36cf85,_0x56e827){return{'message':_0x26da34,'unlock':_0x36cf85,'active':_0x56e827};};exports[_0x66ec('0xf')]=function(_0x1c8c82,_0x3c91ac,_0x22ac8c){if(!_[_0x66ec('0x10')](_0x22ac8c)&&_0x66ec('0x11')===typeof _0x22ac8c&&!_[_0x66ec('0x12')](_0x22ac8c)){if(!_[_0x66ec('0x10')](_0x3c91ac)&&_0x66ec('0x11')===typeof _0x3c91ac&&!_['isEmpty'](_0x3c91ac)){return util['format'](_0x66ec('0x13'),_0x3c91ac,_0x22ac8c);}return util[_0x66ec('0x14')](_0x66ec('0x13'),_0x22ac8c,_0x22ac8c);}if(!_[_0x66ec('0x10')](_0x1c8c82)&&_0x66ec('0x11')===typeof _0x1c8c82&&!_[_0x66ec('0x12')](_0x1c8c82)){return _0x1c8c82;}return _0x66ec('0x15');};exports[_0x66ec('0x16')]=function(_0x347eac){if(_[_0x66ec('0x17')](_0x347eac)){return![];}return _0x347eac;};exports['addVariables']=function(_0x1f7fbf,_0x134b01,_0xf14ca7,_0x17c3ed,_0x3e57da,_0x2930b2){var _0x1b1bc6={'XMD-QUEUE':_0x134b01['Queue']?_0x134b01['Queue'][_0x66ec('0x18')]:'','XMD-CALLERID':_0x17c3ed,'XMD-CALLERID-PREVIEW':_0x2930b2?util[_0x66ec('0x14')](_0x66ec('0x13'),_0x2930b2[_0x66ec('0x19')],_0x2930b2[_0x66ec('0x1a')]):_0x17c3ed,'XMD-DIALID':_0x3e57da,'XMD-CONTACTID':_0x134b01[_0x66ec('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x17c3ed,'XMD-VOICEQUEUEID':_0x134b01[_0x66ec('0x1c')],'XMD-DIALCHANNEL':_0xf14ca7,'XMD-DIALTIMEOUT':_0x1f7fbf[_0x66ec('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x66ec('0x1e'),_0x1f7fbf[_0x66ec('0x1f')]?'g':'',_['isEmpty'](_0x1f7fbf[_0x66ec('0x20')])?'':_0x66ec('0x21')),'XMD-DIALURL':_0x1f7fbf[_0x66ec('0x22')]||'','XMD-AGI':_0x1f7fbf[_0x66ec('0x23')]?util[_0x66ec('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1f7fbf['dialQueueProject']):_0x66ec('0x24'),'XMD-AGIAFTER':_0x1f7fbf[_0x66ec('0x1f')]?util[_0x66ec('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1f7fbf[_0x66ec('0x1f')]):_0x66ec('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x2930b2?_0x2930b2['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2930b2?_0x2930b2[_0x66ec('0x25')]:'','XMD-DESTINATION':_0x66ec('0x26')};if(!_[_0x66ec('0x12')](_0x1f7fbf['monitor_format'])){_0x1b1bc6[util[_0x66ec('0x14')]('%s',_0x66ec('0x27'))]=_0x1f7fbf[_0x66ec('0x20')];_0x1b1bc6[util[_0x66ec('0x14')]('%s',_0x66ec('0x28'))]=_0x3e57da;}if(_0x134b01&&_0x134b01[_0x66ec('0x29')]){for(var _0x311b1e in _0x134b01[_0x66ec('0x29')]){if(_0x134b01['Contact'][_0x66ec('0x2a')](_0x311b1e)){if(!_[_0x66ec('0x17')](_0x134b01[_0x66ec('0x29')][_0x311b1e])&&_0x311b1e!=='id'&&_0x311b1e!==_0x66ec('0x2b')&&_0x311b1e!==_0x66ec('0x2c')&&_0x311b1e!=='updatedAt'){_0x1b1bc6[util[_0x66ec('0x14')](_0x66ec('0x2d'),_0x66ec('0x2e'),_['toUpper'](_0x311b1e))]=_0x134b01['Contact'][_0x311b1e];}}}}return _0x1b1bc6;};exports[_0x66ec('0x2f')]=function(_0x12c11d){var _0x4cd46e={};for(var _0x3f2640 in _0x12c11d){if(_0x12c11d[_0x66ec('0x2a')](_0x3f2640)){_0x4cd46e[util[_0x66ec('0x14')]('%s',_[_0x66ec('0x30')](_0x3f2640))]=_0x12c11d[_0x3f2640];}}return{'variables':_0x4cd46e};};exports[_0x66ec('0x31')]=function(_0x57f1eb,_0x5044fe){if(!_[_0x66ec('0x17')](_0x57f1eb)){if(_0x57f1eb[_0x66ec('0x2a')](_0x66ec('0x32'))){if(_0x57f1eb[_0x66ec('0x32')]>0x0){_0x57f1eb[_0x66ec('0x32')]-=0x1;}else{logger[_0x66ec('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5044fe);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5044fe);}};exports['logBlacklist']=function(_0x505a85){var _0x4b4bf1=moment()[_0x66ec('0x14')](_0x66ec('0x33'));_0x505a85[_0x66ec('0x34')]=0xd;_0x505a85['statedesc']=_0x66ec('0x35');_0x505a85[_0x66ec('0x36')]=_0x4b4bf1;_0x505a85[_0x66ec('0x37')]=_0x4b4bf1;_0x505a85[_0x66ec('0x38')]=_0x4b4bf1;};exports['logAgent']=function(_0x54ee1e,_0x12c372,_0x39c96c){var _0x4fc1bb=moment()[_0x66ec('0x14')](_0x66ec('0x33'));_0x54ee1e[_0x66ec('0x34')]=_0x12c372;_0x54ee1e[_0x66ec('0x39')]=_0x39c96c;_0x54ee1e[_0x66ec('0x37')]=_0x4fc1bb;_0x54ee1e[_0x66ec('0x3a')]=getSeconds(_0x54ee1e[_0x66ec('0x37')],_0x54ee1e[_0x66ec('0x36')]);};exports[_0x66ec('0x3b')]=function(_0x3274b0,_0x1aee92,_0x58e069){_0x3274b0[_0x66ec('0x3c')]=_0x1aee92;_0x3274b0[_0x66ec('0x3d')]=_0x58e069;};exports[_0x66ec('0x3e')]=function(_0x1ef975,_0x173803,_0x5567db){var _0x388417=moment()[_0x66ec('0x14')](_0x66ec('0x33'));_0x1ef975[_0x66ec('0x34')]=_0x173803;_0x1ef975[_0x66ec('0x39')]=_0x5567db;_0x1ef975[_0x66ec('0x37')]=_0x1ef975[_0x66ec('0x37')]?_0x1ef975[_0x66ec('0x37')]:_0x388417;_0x1ef975['endtime']=_0x1ef975[_0x66ec('0x38')]?_0x1ef975[_0x66ec('0x38')]:_0x388417;_0x1ef975[_0x66ec('0x3a')]=getSeconds(_0x1ef975[_0x66ec('0x37')]||0x0,_0x1ef975[_0x66ec('0x36')]||0x0);_0x1ef975[_0x66ec('0x3f')]=_0x1ef975[_0x66ec('0x40')]?getSeconds(_0x1ef975[_0x66ec('0x38')],_0x1ef975['answertime']):0x0;};exports[_0x66ec('0x41')]=function(_0x396288){return _0x396288===_0x66ec('0x42');};exports[_0x66ec('0x43')]=function(_0x1bc0ea,_0x2b4a0d,_0x39a366,_0x23f1d3,_0x36d3c6){var _0xff4cfd=_0x23f1d3?_0x66ec('0x44'):_0x1bc0ea[_0x66ec('0x19')];_0xff4cfd=_0x36d3c6?_0x66ec('0x45'):_0xff4cfd;return{'actionid':_0x1bc0ea[_0x66ec('0x46')],'action':_0x66ec('0x47'),'channel':_0x1bc0ea['channelAgent'],'callerid':util[_0x66ec('0x14')](_0x66ec('0x13'),_0xff4cfd,_0x1bc0ea[_0x66ec('0x1a')]),'Exten':_0x66ec('0x26'),'Context':_0x66ec('0x48'),'Priority':'1','variable':_0x39a366,'timeout':(_0x2b4a0d[_0x66ec('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1bc0ea['uniqueid']};};exports[_0x66ec('0x4a')]=function(_0x4c0016){return _0x4c0016[_0x66ec('0x4b')]+_0x4c0016[_0x66ec('0x4c')]+_0x4c0016[_0x66ec('0x4d')]+_0x4c0016[_0x66ec('0x4e')]+_0x4c0016[_0x66ec('0x4f')];};exports[_0x66ec('0x50')]=function(_0x375bb8){var _0x356b7e=_['clone'](_0x375bb8);_0x356b7e[_0x66ec('0x34')]=0xf;_0x356b7e[_0x66ec('0x39')]=_0x66ec('0x51');return _0x356b7e;};exports[_0x66ec('0x52')]=function(_0xabed9b,_0x4b05d5,_0x179f59){var _0xf8f982={};_0xf8f982[_0x4b05d5]=_0xabed9b[_0x4b05d5];_0xf8f982[_0x66ec('0x53')]=![];_0xf8f982[_0x66ec('0x54')]=moment()[_0x66ec('0x55')](_0x179f59,_0x66ec('0x56'))[_0x66ec('0x14')](_0x66ec('0x33'));_0xf8f982[_0x66ec('0x1b')]=_0xabed9b[_0x66ec('0x1b')];_0xf8f982['ListId']=_0xabed9b['ListId'];_0xf8f982['VoiceQueueId']=_0xabed9b['VoiceQueueId']||undefined;return _0xf8f982;};exports['decrementTalkink']=function(_0x13ff36,_0x41f0dc){if(!_[_0x66ec('0x17')](_0x13ff36)){if(_0x13ff36[_0x66ec('0x57')]>0x0){_0x13ff36['pTalking']-=0x1;}else{logger['error'](_0x41f0dc,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x66ec('0x9')](_0x41f0dc,_0x66ec('0x58'));}};exports['IsNotLoggedIn']=function(_0x48528b){if(_0x48528b<=0x0){return!![];}return![];};exports[_0x66ec('0x59')]=function(_0x20e380,_0x5cd24a,_0x4f768a){_0x20e380[_0x66ec('0x5a')]=_0x5cd24a;_0x20e380[_0x66ec('0x18')]=_0x20e380[_0x66ec('0x5b')];_0x20e380[_0x66ec('0x5c')]=_0x20e380[_0x66ec('0x5d')];if(_0x4f768a){_0x20e380['mandatoryDisposition']=_0x4f768a[_0x66ec('0x5e')];}return _0x20e380;};exports['buildAcw']=function(_0x23c772){var _0x5878a7={};_0x5878a7[_0x66ec('0x5b')]=_0x23c772[_0x66ec('0x5b')];_0x5878a7[_0x66ec('0x5c')]=_0x23c772[_0x66ec('0x5d')];_0x5878a7['uniqueid']=_0x23c772[_0x66ec('0x46')];return _0x5878a7;};exports['agentReadyId']=function(_0x17fba5){var _0x3b76d7=[];for(var _0x354d89 in _0x17fba5){if(_0x17fba5[_0x66ec('0x2a')](_0x354d89)){if(!_[_0x66ec('0x17')](_0x17fba5[_0x354d89])&&_0x17fba5[_0x354d89][_0x66ec('0x34')]===_0x66ec('0x5f')&&_0x17fba5[_0x354d89]['status']===_0x66ec('0x60')){_0x3b76d7[_0x66ec('0x61')](_0x17fba5[_0x354d89]['id']);}}}return _0x3b76d7;};exports['getDiff']=function(_0x5d7b82){var _0x49e10f=moment()[_0x66ec('0x6')](0x0);var _0x1fd68e=moment(_0x5d7b82)[_0x66ec('0x6')](0x0);return _0x49e10f[_0x66ec('0x7')](_0x1fd68e,_0x66ec('0x8'));};exports['createBody']=function(_0x3054b5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3054b5[_0x66ec('0x1b')],'ListId':_0x3054b5[_0x66ec('0x62')],'VoiceQueueId':_0x3054b5[_0x66ec('0x1c')]||undefined,'CampaignId':_0x3054b5[_0x66ec('0x63')]||undefined};};exports['filterKey']=function(_0xf8c356){if(_0xf8c356===_0x66ec('0x46')||_0xf8c356===_0x66ec('0x64')||_0xf8c356===_0x66ec('0x5b')||_0xf8c356==='type'||_0xf8c356==='campaigntype'||_0xf8c356==='dialAnswer'||_0xf8c356===_0x66ec('0x3c')||_0xf8c356===_0x66ec('0x5d')||_0xf8c356==='calleridname'||_0xf8c356===_0x66ec('0x53')||_0xf8c356===_0x66ec('0x1a')||_0xf8c356==='scheduledat'||_0xf8c356===_0x66ec('0x4b')||_0xf8c356===_0x66ec('0x4c')||_0xf8c356===_0x66ec('0x4d')||_0xf8c356===_0x66ec('0x65')||_0xf8c356===_0x66ec('0x66')||_0xf8c356===_0x66ec('0x67')||_0xf8c356===_0x66ec('0x68')||_0xf8c356==='recallme'||_0xf8c356===_0x66ec('0x1b')||_0xf8c356===_0x66ec('0x62')||_0xf8c356===_0x66ec('0x3d')||_0xf8c356===_0x66ec('0x1c')||_0xf8c356===_0x66ec('0x69')||_0xf8c356==='xmd-voicequeueid'||_0xf8c356===_0x66ec('0x6a')||_0xf8c356==='xmd-phone'||_0xf8c356==='xmd-listid'||_0xf8c356==='xmd-dialurl'||_0xf8c356==='xmd-dialtimeout'||_0xf8c356===_0x66ec('0x6b')||_0xf8c356===_0x66ec('0x6c')||_0xf8c356===_0x66ec('0x6d')||_0xf8c356===_0x66ec('0x6e')||_0xf8c356===_0x66ec('0x6f')||_0xf8c356===_0x66ec('0x70')||_0xf8c356===_0x66ec('0x71')||_0xf8c356===_0x66ec('0x72')||_0xf8c356===_0x66ec('0x73')||_0xf8c356==='rtpaudioqosbridged'||_0xf8c356===_0x66ec('0x74')||_0xf8c356===_0x66ec('0x75')||_0xf8c356==='rtpaudioqosloss'||_0xf8c356===_0x66ec('0x76')||_0xf8c356===_0x66ec('0x77')||_0xf8c356==='rtpaudioqosrttbridged'||_0xf8c356===_0x66ec('0x73')||_0xf8c356===_0x66ec('0x78')||_0xf8c356==='rtpaudioqosjitter'||_0xf8c356==='rtpaudioqosjitterbridged'||_0xf8c356==='rtpaudioqosloss'||_0xf8c356===_0x66ec('0x76')||_0xf8c356===_0x66ec('0x77')||_0xf8c356===_0x66ec('0x79')||_0xf8c356===_0x66ec('0x7a')||_0xf8c356===_0x66ec('0x7b')||_0xf8c356===_0x66ec('0x34')||_0xf8c356==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x107e23,_0x29d525){var _0x3a02f,_0x25e307,_0x5afb36;if(_0x29d525<=0x0){_0x29d525=0x1;}_0x3a02f=new RegExp(_0x66ec('0x7c')+_0x29d525+'}$');_0x25e307=Math['pow'](0xa,_0x29d525-0x1);_0x5afb36=Math[_0x66ec('0x7d')](0xa,_0x29d525)-0x1;return util[_0x66ec('0x14')]('%s',_[_0x66ec('0x7e')](_0x107e23,_0x3a02f,_['random'](_0x25e307,_0x5afb36)));};exports['extractCalleridName']=function(_0x4d1dc2){var _0x477d09=_0x4d1dc2[_0x66ec('0x7f')](/"(.*?)"/);return _0x477d09?_0x477d09[0x1]:_0x4d1dc2;};exports[_0x66ec('0x80')]=function(_0x1b13d4){var _0x26f931=_0x1b13d4[_0x66ec('0x7f')](/<(.*?)>/);return _0x26f931?_0x26f931[0x1]:_0x1b13d4;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 11e025d..797ae63 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x558d2c,_0x51dc72){var _0x1769eb=function(_0x3a20cb){while(--_0x3a20cb){_0x558d2c['push'](_0x558d2c['shift']());}};_0x1769eb(++_0x51dc72);}(_0xb10b,0x12a));var _0xbb10=function(_0x22f9c0,_0x35410c){_0x22f9c0=_0x22f9c0-0x0;var _0x1883fe=_0xb10b[_0x22f9c0];return _0x1883fe;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x364c1b,_0x210954){var _0x400303=function(_0x18dc33){while(--_0x18dc33){_0x364c1b['push'](_0x364c1b['shift']());}};_0x400303(++_0x210954);}(_0x7a54,0x106));var _0x47a5=function(_0x44fced,_0x598ef6){_0x44fced=_0x44fced-0x0;var _0x217567=_0x7a54[_0x44fced];return _0x217567;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 603f7d2..ba15b17 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 _0x94db=['billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','queuecallercomplete','sumBillable','initVoiceCallReports','duration','disposition'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x94db,0x1b8));var _0xb94d=function(_0x4010b9,_0x100074){_0x4010b9=_0x4010b9-0x0;var _0x5e7896=_0x94db[_0x4010b9];return _0x5e7896;};'use strict';var BPromise=require(_0xb94d('0x0'));var util=require(_0xb94d('0x1'));var _=require(_0xb94d('0x2'));var moment=require(_0xb94d('0x3'));var Agent=require(_0xb94d('0x4'));var Telephone=require(_0xb94d('0x5'));var Trunk=require(_0xb94d('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xb94d('0x7'));var Template=require(_0xb94d('0x8'));var Campaign=require(_0xb94d('0x9'));var VoiceExtension=require(_0xb94d('0xa'));var ZendeskAccount=require(_0xb94d('0xb'));var SalesforceAccount=require(_0xb94d('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xb94d('0xd'));var ZohoAccount=require(_0xb94d('0xe'));var DeskAccount=require(_0xb94d('0xf'));var VtigerAccount=require(_0xb94d('0x10'));var ServicenowAccount=require(_0xb94d('0x11'));var Dynamics365Account=require(_0xb94d('0x12'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xb94d('0x13'));var Realtime=function(){this[_0xb94d('0x14')]={};this[_0xb94d('0x15')]={};this[_0xb94d('0x16')]={};this[_0xb94d('0x17')]={};this[_0xb94d('0x18')]={};this[_0xb94d('0x19')]={};this[_0xb94d('0x1a')]={};this[_0xb94d('0x1b')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xb94d('0x1c')]={};this[_0xb94d('0x1d')]={};this[_0xb94d('0x1e')]={};this[_0xb94d('0x1f')]={};this[_0xb94d('0x20')]={};this[_0xb94d('0x21')]={};this[_0xb94d('0x22')]={};this[_0xb94d('0x23')]={};this['zohoAccounts']={};this[_0xb94d('0x24')]={};this['vtigerAccounts']={};this[_0xb94d('0x25')]={};this['dynamics365Accounts']={};this[_0xb94d('0x26')]={};this['faxAccounts']={};};function freeIsNotKey(_0x21ecd5,_0x3d0714,_0x5a8da5){var _0x17260a=_[_0xb94d('0x27')](_0x21ecd5,function(_0x549507,_0x28ca3e){return _0x549507[_0x5a8da5];});for(var _0xe01ad0 in _0x3d0714){if(_0x3d0714[_0xb94d('0x28')](_0xe01ad0)){if(!_0x17260a[_0xe01ad0]){delete _0x3d0714[_0xe01ad0];}}}}function freeIsNotKeySip(_0x426ca8,_0x59e6a9){var _0x5e6dd8=_[_0xb94d('0x27')](_0x426ca8,function(_0x219c8d,_0x2579d7){return util[_0xb94d('0x29')](_0xb94d('0x2a'),_0x219c8d[_0xb94d('0x2b')]);});for(var _0x138920 in _0x59e6a9){if(_0x59e6a9[_0xb94d('0x28')](_0x138920)){if(!_0x5e6dd8[_0x138920]){delete _0x59e6a9[_0x138920];}}}}function freeIsNotKeyAgent(_0x3be7f9,_0x4405fe){var _0x267275=_['mapKeys'](_0x3be7f9,function(_0x3827ce,_0x113300){var _0x47cd2b=_[_0xb94d('0x2c')](_0x3827ce[_0xb94d('0x2d')])?util[_0xb94d('0x29')](_0xb94d('0x2a'),_0x3827ce[_0xb94d('0x2b')]):_0x3827ce['interface'];return _0x47cd2b;});for(var _0x4955e4 in _0x4405fe){if(_0x4405fe['hasOwnProperty'](_0x4955e4)){if(!_0x267275[_0x4955e4]){delete _0x4405fe[_0x4955e4];}}}}function clearVoiceCallReports(_0x3ea28f){_0x3ea28f[_0xb94d('0x2e')]=0x0;_0x3ea28f[_0xb94d('0x2f')]=0x0;_0x3ea28f[_0xb94d('0x30')]=0x0;_0x3ea28f[_0xb94d('0x31')]=0x0;_0x3ea28f['sumBillable']=0x0;}function clearCampaigns(_0x2e48dc){if(!_[_0xb94d('0x32')](_0x2e48dc)){for(var _0x391173 in _0x2e48dc){if(_0x2e48dc['hasOwnProperty'](_0x391173)){_0x2e48dc[_0x391173][_0xb94d('0x33')]=0x0;_0x2e48dc[_0x391173][_0xb94d('0x34')]=0x0;}}}}function clearVoiceQueues(_0x50d3d8){if(!_[_0xb94d('0x32')](_0x50d3d8)){for(var _0x3b3cb7 in _0x50d3d8){if(_0x50d3d8['hasOwnProperty'](_0x3b3cb7)){_0x50d3d8[_0x3b3cb7][_0xb94d('0x2e')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x2f')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x35')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x36')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x30')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x31')]=0x0;_0x50d3d8[_0x3b3cb7]['sumBillable']=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x37')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x38')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x39')]=0x0;_0x50d3d8[_0x3b3cb7]['outboundCongestionCallsDay']=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x3a')]=0x0;_0x50d3d8[_0x3b3cb7]['outboundUnknownCallsDay']=0x0;_0x50d3d8[_0x3b3cb7]['outboundDropCallsDayTimeout']=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x3b')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x3c')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x3d')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x3e')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x3f')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x37')]=0x0;_0x50d3d8[_0x3b3cb7][_0xb94d('0x40')]=0x0;_0x50d3d8[_0x3b3cb7]['queueStatusComplete']=!![];}}}}Realtime[_0xb94d('0x41')][_0xb94d('0x42')]=function(_0x4abbd7,_0x420359){for(var _0x3c2985 in _0x420359){if(_0x4abbd7['hasOwnProperty'](_0x3c2985)){_0x4abbd7[_0x3c2985]=_0x420359[_0x3c2985];}}};Realtime['prototype']['initAgents']=function(){var _0x41e7d8=this;return function(_0x481647){if(_0x481647){freeIsNotKeyAgent(_0x481647,_0x41e7d8[_0xb94d('0x14')]);for(var _0x430fc4=0x0,_0x201ec4={},_0x7839c8={};_0x430fc4<_0x481647[_0xb94d('0x43')];_0x430fc4+=0x1){_0x201ec4=_0x481647[_0x430fc4];var _0xfbd3a9=_[_0xb94d('0x2c')](_0x201ec4[_0xb94d('0x2d')])?util[_0xb94d('0x29')](_0xb94d('0x2a'),_0x201ec4[_0xb94d('0x2b')]):_0x201ec4[_0xb94d('0x2d')];if(_[_0xb94d('0x44')](_0x41e7d8[_0xb94d('0x14')][_0xfbd3a9])){_0x41e7d8[_0xb94d('0x14')][_0xfbd3a9]=new Agent(_0x201ec4);}else{_0x41e7d8['mergeFromDatabase'](_0x41e7d8['agents'][_0xfbd3a9],_0x201ec4);}}}return _0x41e7d8[_0xb94d('0x14')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x45')]=function(){var _0x1ab79d=this;return function(_0x580646){if(_0x580646){freeIsNotKeySip(_0x580646,_0x1ab79d[_0xb94d('0x15')]);for(var _0xa6059d=0x0,_0x3aaeb0={},_0x2e3a40={};_0xa6059d<_0x580646[_0xb94d('0x43')];_0xa6059d+=0x1){_0x3aaeb0=_0x580646[_0xa6059d];if(_['isUndefined'](_0x1ab79d['telephones'][util['format'](_0xb94d('0x2a'),_0x3aaeb0['name'])])){_0x1ab79d[_0xb94d('0x15')][util[_0xb94d('0x29')](_0xb94d('0x2a'),_0x3aaeb0[_0xb94d('0x2b')])]=new Telephone(_0x3aaeb0);}else{_0x1ab79d['mergeFromDatabase'](_0x1ab79d['telephones'][util[_0xb94d('0x29')](_0xb94d('0x2a'),_0x3aaeb0[_0xb94d('0x2b')])],_0x3aaeb0);}}}return _0x1ab79d[_0xb94d('0x15')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x46')]=function(){var _0x30fd93=this;return function(_0x59bf4c){if(_0x59bf4c){freeIsNotKeySip(_0x59bf4c,_0x30fd93[_0xb94d('0x16')]);for(var _0x3912ee=0x0,_0x5d67f1={},_0x517bce={};_0x3912ee<_0x59bf4c[_0xb94d('0x43')];_0x3912ee+=0x1){_0x5d67f1=_0x59bf4c[_0x3912ee];if(_[_0xb94d('0x44')](_0x30fd93['trunks'][util[_0xb94d('0x29')]('SIP/%s',_0x5d67f1[_0xb94d('0x2b')])])){_0x30fd93[_0xb94d('0x16')][util['format'](_0xb94d('0x2a'),_0x5d67f1['name'])]=new Trunk(_0x5d67f1);}else{_0x30fd93['mergeFromDatabase'](_0x30fd93[_0xb94d('0x16')][util[_0xb94d('0x29')](_0xb94d('0x2a'),_0x5d67f1[_0xb94d('0x2b')])],_0x5d67f1);}}}return _0x30fd93[_0xb94d('0x16')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x47')]=function(){var _0x540f7c=this;return function(_0x59355a){if(_0x59355a){freeIsNotKey(_0x59355a,_0x540f7c[_0xb94d('0x17')],_0xb94d('0x2b'));for(var _0x4370e0=0x0,_0x20b5df={},_0xf7709d={};_0x4370e0<_0x59355a[_0xb94d('0x43')];_0x4370e0+=0x1){_0x20b5df=_0x59355a[_0x4370e0];if(_[_0xb94d('0x44')](_0x540f7c['voiceQueues'][_0x20b5df[_0xb94d('0x2b')]])){_0x540f7c[_0xb94d('0x17')][_0x20b5df['name']]=new VoiceQueue(_0x20b5df);}else{_0x540f7c['mergeFromDatabase'](_0x540f7c[_0xb94d('0x17')][_0x20b5df[_0xb94d('0x2b')]],_0x20b5df);}}}return _0x540f7c[_0xb94d('0x17')];};};Realtime['prototype']['initTriggers']=function(){var _0x32a04a=this;return function(_0x541566){if(_0x541566){freeIsNotKey(_0x541566,_0x32a04a[_0xb94d('0x18')],'id');for(var _0x388079=0x0,_0x44abce={},_0x5e293e={};_0x388079<_0x541566[_0xb94d('0x43')];_0x388079+=0x1){_0x44abce=_0x541566[_0x388079];if(_[_0xb94d('0x44')](_0x32a04a['triggers'][_0x44abce['id']])){_0x32a04a[_0xb94d('0x18')][_0x44abce['id']]=new Trigger(_0x44abce);}else{_0x32a04a[_0xb94d('0x42')](_0x32a04a[_0xb94d('0x18')][_0x44abce['id']],_0x44abce);}}}return _0x32a04a[_0xb94d('0x18')];};};Realtime['prototype'][_0xb94d('0x48')]=function(){var _0x573031=this;return function(_0x3591b6){if(_0x3591b6){freeIsNotKey(_0x3591b6,_0x573031[_0xb94d('0x1a')],'id');for(var _0x52c1ff=0x0,_0x4dad6b={},_0x4249d2={};_0x52c1ff<_0x3591b6['length'];_0x52c1ff+=0x1){_0x4dad6b=_0x3591b6[_0x52c1ff];if(_[_0xb94d('0x44')](_0x573031['templates'][_0x4dad6b['id']])){_0x573031['templates'][_0x4dad6b['id']]=new Template(_0x4dad6b);}else{_0x573031[_0xb94d('0x42')](_0x573031[_0xb94d('0x1a')][_0x4dad6b['id']],_0x4dad6b);}}}return _0x573031[_0xb94d('0x1a')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x49')]=function(){var _0x4ffc13=this;return function(_0x2194bd){if(_0x2194bd){freeIsNotKey(_0x2194bd,_0x4ffc13[_0xb94d('0x20')],'id');for(var _0x5b18a5=0x0,_0x2a4e02={},_0x4c02f6={};_0x5b18a5<_0x2194bd[_0xb94d('0x43')];_0x5b18a5+=0x1){_0x2a4e02=_0x2194bd[_0x5b18a5];if(_[_0xb94d('0x44')](_0x4ffc13[_0xb94d('0x20')][_0x2a4e02['id']])){_0x4ffc13[_0xb94d('0x20')][_0x2a4e02['id']]=new ZendeskAccount(_0x2a4e02);}else{_0x4ffc13['mergeFromDatabase'](_0x4ffc13['zendeskAccounts'][_0x2a4e02['id']],_0x2a4e02);}}}return _0x4ffc13[_0xb94d('0x20')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x4a')]=function(){var _0x290516=this;return function(_0x17437e){if(_0x17437e){freeIsNotKey(_0x17437e,_0x290516['salesforceAccounts'],'id');for(var _0x240636=0x0,_0x123e82={},_0x37c0c0={};_0x240636<_0x17437e[_0xb94d('0x43')];_0x240636+=0x1){_0x123e82=_0x17437e[_0x240636];if(_['isUndefined'](_0x290516[_0xb94d('0x21')][_0x123e82['id']])){_0x290516[_0xb94d('0x21')][_0x123e82['id']]=new SalesforceAccount(_0x123e82);}else{_0x290516[_0xb94d('0x42')](_0x290516['salesforceAccounts'][_0x123e82['id']],_0x123e82);}}}return _0x290516[_0xb94d('0x21')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x4b')]=function(){var _0x4e4d49=this;return function(_0x1cd7bb){if(_0x1cd7bb){freeIsNotKey(_0x1cd7bb,_0x4e4d49[_0xb94d('0x23')],'id');for(var _0x155758=0x0,_0x207cd6={},_0x37cc6f={};_0x155758<_0x1cd7bb[_0xb94d('0x43')];_0x155758+=0x1){_0x207cd6=_0x1cd7bb[_0x155758];if(_[_0xb94d('0x44')](_0x4e4d49[_0xb94d('0x23')][_0x207cd6['id']])){_0x4e4d49[_0xb94d('0x23')][_0x207cd6['id']]=new FreshdeskAccount(_0x207cd6);}else{_0x4e4d49['mergeFromDatabase'](_0x4e4d49[_0xb94d('0x23')][_0x207cd6['id']],_0x207cd6);}}}return _0x4e4d49[_0xb94d('0x23')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x4c')]=function(){var _0xaaa4ea=this;return function(_0x14e267){if(_0x14e267){freeIsNotKey(_0x14e267,_0xaaa4ea[_0xb94d('0x4d')],'id');for(var _0x1fb7c1=0x0,_0x221150={},_0x436336={};_0x1fb7c1<_0x14e267['length'];_0x1fb7c1+=0x1){_0x221150=_0x14e267[_0x1fb7c1];if(_[_0xb94d('0x44')](_0xaaa4ea[_0xb94d('0x4d')][_0x221150['id']])){_0xaaa4ea[_0xb94d('0x4d')][_0x221150['id']]=new ZohoAccount(_0x221150);}else{_0xaaa4ea[_0xb94d('0x42')](_0xaaa4ea['zohoAccounts'][_0x221150['id']],_0x221150);}}}return _0xaaa4ea[_0xb94d('0x4d')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x167ace=this;return function(_0xf76d5a){if(_0xf76d5a){freeIsNotKey(_0xf76d5a,_0x167ace['deskAccounts'],'id');for(var _0x2d6933=0x0,_0x35f77e={},_0xb3e109={};_0x2d6933<_0xf76d5a[_0xb94d('0x43')];_0x2d6933+=0x1){_0x35f77e=_0xf76d5a[_0x2d6933];if(_[_0xb94d('0x44')](_0x167ace[_0xb94d('0x24')][_0x35f77e['id']])){_0x167ace[_0xb94d('0x24')][_0x35f77e['id']]=new DeskAccount(_0x35f77e);}else{_0x167ace[_0xb94d('0x42')](_0x167ace[_0xb94d('0x24')][_0x35f77e['id']],_0x35f77e);}}}return _0x167ace[_0xb94d('0x24')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x4e')]=function(){var _0x586b72=this;return function(_0x2b3b19){if(_0x2b3b19){freeIsNotKey(_0x2b3b19,_0x586b72['sugarcrmAccounts'],'id');for(var _0x22ca7a=0x0,_0x3d3b56={},_0x1bae25={};_0x22ca7a<_0x2b3b19[_0xb94d('0x43')];_0x22ca7a+=0x1){_0x3d3b56=_0x2b3b19[_0x22ca7a];if(_[_0xb94d('0x44')](_0x586b72[_0xb94d('0x22')][_0x3d3b56['id']])){_0x586b72[_0xb94d('0x22')][_0x3d3b56['id']]=new SugarcrmAccount(_0x3d3b56);}else{_0x586b72[_0xb94d('0x42')](_0x586b72[_0xb94d('0x22')][_0x3d3b56['id']],_0x3d3b56);}}}return _0x586b72[_0xb94d('0x22')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x4f')]=function(){var _0x4c1e19=this;return function(_0x1f44f8){if(_0x1f44f8){freeIsNotKey(_0x1f44f8,_0x4c1e19['vtigerAccounts'],'id');for(var _0x58240d=0x0,_0x278323={},_0x53a3fe={};_0x58240d<_0x1f44f8['length'];_0x58240d+=0x1){_0x278323=_0x1f44f8[_0x58240d];if(_[_0xb94d('0x44')](_0x4c1e19[_0xb94d('0x50')][_0x278323['id']])){_0x4c1e19[_0xb94d('0x50')][_0x278323['id']]=new VtigerAccount(_0x278323);}else{_0x4c1e19[_0xb94d('0x42')](_0x4c1e19[_0xb94d('0x50')][_0x278323['id']],_0x278323);}}}return _0x4c1e19[_0xb94d('0x50')];};};Realtime['prototype'][_0xb94d('0x51')]=function(){var _0x3a55b1=this;return function(_0x26d09f){if(_0x26d09f){freeIsNotKey(_0x26d09f,_0x3a55b1[_0xb94d('0x25')],'id');for(var _0x114d90=0x0,_0x3f5d34={},_0x99093b={};_0x114d90<_0x26d09f['length'];_0x114d90+=0x1){_0x3f5d34=_0x26d09f[_0x114d90];if(_[_0xb94d('0x44')](_0x3a55b1[_0xb94d('0x25')][_0x3f5d34['id']])){_0x3a55b1['servicenowAccounts'][_0x3f5d34['id']]=new ServicenowAccount(_0x3f5d34);}else{_0x3a55b1[_0xb94d('0x42')](_0x3a55b1[_0xb94d('0x25')][_0x3f5d34['id']],_0x3f5d34);}}}return _0x3a55b1[_0xb94d('0x25')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x52')]=function(){var _0x52bab8=this;return function(_0xc7ad2a){if(_0xc7ad2a){freeIsNotKey(_0xc7ad2a,_0x52bab8[_0xb94d('0x53')],'id');for(var _0x30d2f2=0x0,_0x2bd2e8={},_0x35f03c={};_0x30d2f2<_0xc7ad2a['length'];_0x30d2f2+=0x1){_0x2bd2e8=_0xc7ad2a[_0x30d2f2];if(_[_0xb94d('0x44')](_0x52bab8[_0xb94d('0x53')][_0x2bd2e8['id']])){_0x52bab8[_0xb94d('0x53')][_0x2bd2e8['id']]=new Dynamics365Account(_0x2bd2e8);}else{_0x52bab8[_0xb94d('0x42')](_0x52bab8[_0xb94d('0x53')][_0x2bd2e8['id']],_0x2bd2e8);}}}return _0x52bab8['dynamics365Accounts'];};};Realtime[_0xb94d('0x41')][_0xb94d('0x54')]=function(){var _0xbcf52e=this;return function(_0x51c2a2){if(_0x51c2a2){freeIsNotKey(_0x51c2a2,_0xbcf52e[_0xb94d('0x26')],'id');for(var _0x102045=0x0,_0x409dd6={},_0x457614={};_0x102045<_0x51c2a2['length'];_0x102045+=0x1){_0x409dd6=_0x51c2a2[_0x102045];if(_['isUndefined'](_0xbcf52e[_0xb94d('0x26')][_0x409dd6['id']])){_0xbcf52e[_0xb94d('0x26')][_0x409dd6['id']]=new FreshsalesAccount(_0x409dd6);}else{_0xbcf52e[_0xb94d('0x42')](_0xbcf52e[_0xb94d('0x26')][_0x409dd6['id']],_0x409dd6);}}}return _0xbcf52e[_0xb94d('0x26')];};};Realtime['prototype'][_0xb94d('0x55')]=function(){var _0x48277e=this;return function(_0x5d2247){for(var _0x32d12f=0x0;_0x32d12f<_0x5d2247[_0xb94d('0x43')];_0x32d12f+=0x1){_[_0xb94d('0x56')](_0x48277e[_0xb94d('0x17')][_0x5d2247[_0x32d12f][_0xb94d('0x2b')]],_0x5d2247[_0x32d12f]);}return _0x48277e[_0xb94d('0x17')];};};Realtime[_0xb94d('0x41')]['initVoiceQueueReports']=function(){var _0x2118d1=this;return function(_0x1458e4){clearVoiceQueues(_0x2118d1[_0xb94d('0x17')]);if(_0x1458e4){_0x1458e4=_['groupBy'](_0x1458e4,'uniqueid');for(var _0x5aac36 in _0x1458e4){if(_0x1458e4[_0xb94d('0x28')](_0x5aac36)){var _0x367ce7={};for(var _0x54d949=0x0;_0x54d949<_0x1458e4[_0x5aac36][_0xb94d('0x43')];_0x54d949+=0x1){var _0xec4bab=_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x57')];if(_0x2118d1['voiceQueues'][_0xec4bab]){if(_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x58')]){_0x2118d1['voiceQueues'][_0xec4bab]['unmanaged']+=0x1;}if(_0x1458e4[_0x5aac36][_0x54d949]['queuecallerabandon']){_0x2118d1[_0xb94d('0x17')][_0xec4bab][_0xb94d('0x36')]+=0x1;}_0x2118d1[_0xb94d('0x17')][_0xec4bab][_0xb94d('0x30')]+=moment(_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x59')])[_0xb94d('0x5a')](moment(_0x1458e4[_0x5aac36][_0x54d949]['queuecallerjoinAt']),_0xb94d('0x5b'))||0x0;if(_0x54d949===_0x1458e4[_0x5aac36][_0xb94d('0x43')]-0x1){_0x2118d1[_0xb94d('0x17')][_0xec4bab]['sumDuration']+=moment(_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x5c')]||_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x5d')]||_0x1458e4[_0x5aac36][_0x54d949]['queuecallerexitAt'])[_0xb94d('0x5a')](moment(_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x5e')]),_0xb94d('0x5b'))||0x0;_0x2118d1['voiceQueues'][_0xec4bab][_0xb94d('0x2e')]+=0x1;if(_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x5f')]){_0x2118d1['voiceQueues'][_0xec4bab][_0xb94d('0x2f')]+=0x1;_0x2118d1['voiceQueues'][_0xec4bab][_0xb94d('0x60')]+=moment(_0x1458e4[_0x5aac36][_0x54d949]['queuecallercompleteAt'])['diff'](moment(_0x1458e4[_0x5aac36][_0x54d949][_0xb94d('0x59')]),_0xb94d('0x5b'))||0x0;}}else{_0x2118d1[_0xb94d('0x17')][_0xec4bab][_0xb94d('0x31')]+=_0x2118d1['voiceQueues'][_0xec4bab]['sumHoldTime']||0x0;}}}}}}return _0x2118d1[_0xb94d('0x17')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x61')]=function(){var _0x580f84=this;return function(_0x4c93cc){clearVoiceCallReports(_0x580f84[_0xb94d('0x1b')]);if(_0x4c93cc){for(var _0x52f44a=0x0;_0x52f44a<_0x4c93cc['length'];_0x52f44a+=0x1){_0x580f84['outbound'][_0xb94d('0x2e')]+=0x1;_0x580f84['outbound']['sumDuration']+=_0x4c93cc[_0x52f44a][_0xb94d('0x62')];if(_0x4c93cc[_0x52f44a][_0xb94d('0x63')]==='ANSWERED'){_0x580f84[_0xb94d('0x1b')]['answered']+=0x1;_0x580f84['outbound'][_0xb94d('0x30')]+=_0x4c93cc[_0x52f44a][_0xb94d('0x62')]-_0x4c93cc[_0x52f44a][_0xb94d('0x64')]||0x0;_0x580f84[_0xb94d('0x1b')][_0xb94d('0x60')]+=_0x4c93cc[_0x52f44a][_0xb94d('0x64')];}}}return _0x580f84[_0xb94d('0x1b')];};};Realtime[_0xb94d('0x41')]['initCampaigns']=function(){var _0x520a0c=this;return function(_0x3c1a7f){if(_0x3c1a7f){freeIsNotKey(_0x3c1a7f,_0x520a0c[_0xb94d('0x19')],_0xb94d('0x2b'));for(var _0x530cc2=0x0,_0x1f4425={};_0x530cc2<_0x3c1a7f[_0xb94d('0x43')];_0x530cc2+=0x1){_0x1f4425=_0x3c1a7f[_0x530cc2];if(_['isUndefined'](_0x520a0c[_0xb94d('0x19')][_0x1f4425[_0xb94d('0x2b')]])){_0x520a0c[_0xb94d('0x19')][_0x1f4425['name']]=new Campaign(_0x1f4425);}else{_0x520a0c[_0xb94d('0x42')](_0x520a0c[_0xb94d('0x19')][_0x1f4425[_0xb94d('0x2b')]],_0x1f4425);_0x520a0c['campaigns'][_0x1f4425[_0xb94d('0x2b')]][_0xb94d('0x65')]=_0x1f4425['SquareProject']?_0x1f4425[_0xb94d('0x66')][_0xb94d('0x2b')]:undefined;}}}return _0x520a0c['campaigns'];};};Realtime['prototype'][_0xb94d('0x67')]=function(){var _0x3b65b7=this;return function(_0x229782){if(_0x229782){freeIsNotKey(_0x229782,_0x3b65b7[_0xb94d('0x68')],'id');for(var _0x4b995f=0x0,_0x4e6b36={};_0x4b995f<_0x229782[_0xb94d('0x43')];_0x4b995f+=0x1){_0x4e6b36=_0x229782[_0x4b995f];if(_[_0xb94d('0x44')](_0x3b65b7[_0xb94d('0x68')][_0x4e6b36['id']])){_0x3b65b7[_0xb94d('0x68')][_0x4e6b36['id']]=new VoiceExtension(_0x4e6b36);}else{_0x3b65b7['mergeFromDatabase'](_0x3b65b7['voiceExtensions'][_0x4e6b36['id']],_0x4e6b36);}}}return _0x3b65b7[_0xb94d('0x68')];};};Realtime[_0xb94d('0x41')][_0xb94d('0x69')]=function(){var _0x3c6222=this;return function(_0x313b62){clearCampaigns(_0x3c6222[_0xb94d('0x19')]);for(var _0x40bb06=0x0;_0x40bb06<_0x313b62['length'];_0x40bb06+=0x1){_[_0xb94d('0x56')](_0x3c6222[_0xb94d('0x19')][_0x313b62[_0x40bb06][_0xb94d('0x2b')]],_0x313b62[_0x40bb06]);}return _0x3c6222[_0xb94d('0x19')];};};Realtime[_0xb94d('0x41')]['initFaxAccounts']=function(){var _0x37b9a3=this;return function(_0x21b31a){if(_0x21b31a){freeIsNotKey(_0x21b31a,_0x37b9a3['faxAccounts'],'id');for(var _0x7aa857=0x0,_0x4330c0={},_0x51c35b={};_0x7aa857<_0x21b31a[_0xb94d('0x43')];_0x7aa857+=0x1){_0x4330c0=_0x21b31a[_0x7aa857];if(_['isUndefined'](_0x37b9a3['faxAccounts'][_0x4330c0['id']])){_0x37b9a3['faxAccounts'][_0x4330c0['id']]=new FaxAccount(_0x4330c0);}else{_0x37b9a3[_0xb94d('0x42')](_0x37b9a3['faxAccounts'][_0x4330c0['id']],_0x4330c0);}}}return _0x37b9a3[_0xb94d('0x6a')];};};module[_0xb94d('0x6b')]=Realtime; \ No newline at end of file +var _0xd898=['outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','interface','isUndefined','initTrunks','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay'];(function(_0x2b1d5f,_0x3543fd){var _0x273228=function(_0x1d6f22){while(--_0x1d6f22){_0x2b1d5f['push'](_0x2b1d5f['shift']());}};_0x273228(++_0x3543fd);}(_0xd898,0x91));var _0x8d89=function(_0x17eb40,_0x22dace){_0x17eb40=_0x17eb40-0x0;var _0x4b1add=_0xd898[_0x17eb40];return _0x4b1add;};'use strict';var BPromise=require(_0x8d89('0x0'));var util=require('util');var _=require(_0x8d89('0x1'));var moment=require(_0x8d89('0x2'));var Agent=require(_0x8d89('0x3'));var Telephone=require(_0x8d89('0x4'));var Trunk=require(_0x8d89('0x5'));var VoiceQueue=require(_0x8d89('0x6'));var Trigger=require(_0x8d89('0x7'));var Template=require('../model/template');var Campaign=require(_0x8d89('0x8'));var VoiceExtension=require(_0x8d89('0x9'));var ZendeskAccount=require(_0x8d89('0xa'));var SalesforceAccount=require(_0x8d89('0xb'));var FreshdeskAccount=require(_0x8d89('0xc'));var SugarcrmAccount=require(_0x8d89('0xd'));var ZohoAccount=require(_0x8d89('0xe'));var DeskAccount=require(_0x8d89('0xf'));var VtigerAccount=require(_0x8d89('0x10'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x8d89('0x11'));var Realtime=function(){this[_0x8d89('0x12')]={};this[_0x8d89('0x13')]={};this[_0x8d89('0x14')]={};this[_0x8d89('0x15')]={};this[_0x8d89('0x16')]={};this[_0x8d89('0x17')]={};this[_0x8d89('0x18')]={};this[_0x8d89('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8d89('0x1a')]={};this['channels']={};this[_0x8d89('0x1b')]={};this[_0x8d89('0x1c')]={};this[_0x8d89('0x1d')]={};this[_0x8d89('0x1e')]={};this[_0x8d89('0x1f')]={};this[_0x8d89('0x20')]={};this[_0x8d89('0x21')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x8d89('0x22')]={};this[_0x8d89('0x23')]={};this[_0x8d89('0x24')]={};this['freshsalesAccounts']={};this[_0x8d89('0x25')]={};};function freeIsNotKey(_0x812e90,_0x943316,_0x1c56ae){var _0x45764e=_[_0x8d89('0x26')](_0x812e90,function(_0x218967,_0x99e3f6){return _0x218967[_0x1c56ae];});for(var _0x4a68e7 in _0x943316){if(_0x943316[_0x8d89('0x27')](_0x4a68e7)){if(!_0x45764e[_0x4a68e7]){delete _0x943316[_0x4a68e7];}}}}function freeIsNotKeySip(_0x9ef9b5,_0x2b2d7e){var _0x30ecf2=_['mapKeys'](_0x9ef9b5,function(_0x1ee701,_0x3e594a){return util[_0x8d89('0x28')](_0x8d89('0x29'),_0x1ee701[_0x8d89('0x2a')]);});for(var _0x43c1cc in _0x2b2d7e){if(_0x2b2d7e[_0x8d89('0x27')](_0x43c1cc)){if(!_0x30ecf2[_0x43c1cc]){delete _0x2b2d7e[_0x43c1cc];}}}}function freeIsNotKeyAgent(_0x209a1c,_0x31115d){var _0xc6a87e=_[_0x8d89('0x26')](_0x209a1c,function(_0x139b3c,_0x3e98d3){var _0x2551e2=_[_0x8d89('0x2b')](_0x139b3c['interface'])?util[_0x8d89('0x28')](_0x8d89('0x29'),_0x139b3c[_0x8d89('0x2a')]):_0x139b3c['interface'];return _0x2551e2;});for(var _0x165385 in _0x31115d){if(_0x31115d[_0x8d89('0x27')](_0x165385)){if(!_0xc6a87e[_0x165385]){delete _0x31115d[_0x165385];}}}}function clearVoiceCallReports(_0x5cdb9b){_0x5cdb9b[_0x8d89('0x2c')]=0x0;_0x5cdb9b[_0x8d89('0x2d')]=0x0;_0x5cdb9b[_0x8d89('0x2e')]=0x0;_0x5cdb9b[_0x8d89('0x2f')]=0x0;_0x5cdb9b[_0x8d89('0x30')]=0x0;}function clearCampaigns(_0x5e794b){if(!_[_0x8d89('0x31')](_0x5e794b)){for(var _0x476dbd in _0x5e794b){if(_0x5e794b[_0x8d89('0x27')](_0x476dbd)){_0x5e794b[_0x476dbd][_0x8d89('0x32')]=0x0;_0x5e794b[_0x476dbd][_0x8d89('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2f5b0b){if(!_[_0x8d89('0x31')](_0x2f5b0b)){for(var _0x1e5d45 in _0x2f5b0b){if(_0x2f5b0b[_0x8d89('0x27')](_0x1e5d45)){_0x2f5b0b[_0x1e5d45][_0x8d89('0x2c')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x2d')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x34')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x35')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x2e')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x2f')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x30')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x36')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x37')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x38')]=0x0;_0x2f5b0b[_0x1e5d45]['outboundCongestionCallsDay']=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x39')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x3a')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x3b')]=0x0;_0x2f5b0b[_0x1e5d45]['outboundDropCallsDayCallersExit']=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x3c')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x3d')]=0x0;_0x2f5b0b[_0x1e5d45]['outboundRejectCallsDay']=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x3e')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x36')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x3f')]=0x0;_0x2f5b0b[_0x1e5d45][_0x8d89('0x40')]=!![];}}}}Realtime[_0x8d89('0x41')][_0x8d89('0x42')]=function(_0x18fc59,_0x40b08b){for(var _0x99b13 in _0x40b08b){if(_0x18fc59[_0x8d89('0x27')](_0x99b13)){_0x18fc59[_0x99b13]=_0x40b08b[_0x99b13];}}};Realtime[_0x8d89('0x41')][_0x8d89('0x43')]=function(){var _0x5f328f=this;return function(_0x2b0d75){if(_0x2b0d75){freeIsNotKeyAgent(_0x2b0d75,_0x5f328f[_0x8d89('0x12')]);for(var _0xc01a6c=0x0,_0x5e34b0={},_0x323d81={};_0xc01a6c<_0x2b0d75[_0x8d89('0x44')];_0xc01a6c+=0x1){_0x5e34b0=_0x2b0d75[_0xc01a6c];var _0x5d94be=_[_0x8d89('0x2b')](_0x5e34b0[_0x8d89('0x45')])?util[_0x8d89('0x28')](_0x8d89('0x29'),_0x5e34b0[_0x8d89('0x2a')]):_0x5e34b0[_0x8d89('0x45')];if(_[_0x8d89('0x46')](_0x5f328f[_0x8d89('0x12')][_0x5d94be])){_0x5f328f[_0x8d89('0x12')][_0x5d94be]=new Agent(_0x5e34b0);}else{_0x5f328f['mergeFromDatabase'](_0x5f328f[_0x8d89('0x12')][_0x5d94be],_0x5e34b0);}}}return _0x5f328f[_0x8d89('0x12')];};};Realtime[_0x8d89('0x41')]['initTelephones']=function(){var _0x1d0802=this;return function(_0xc2f7f5){if(_0xc2f7f5){freeIsNotKeySip(_0xc2f7f5,_0x1d0802[_0x8d89('0x13')]);for(var _0x29fa8a=0x0,_0x3635eb={},_0x4ecce5={};_0x29fa8a<_0xc2f7f5[_0x8d89('0x44')];_0x29fa8a+=0x1){_0x3635eb=_0xc2f7f5[_0x29fa8a];if(_[_0x8d89('0x46')](_0x1d0802['telephones'][util['format']('SIP/%s',_0x3635eb['name'])])){_0x1d0802['telephones'][util['format']('SIP/%s',_0x3635eb[_0x8d89('0x2a')])]=new Telephone(_0x3635eb);}else{_0x1d0802[_0x8d89('0x42')](_0x1d0802['telephones'][util[_0x8d89('0x28')](_0x8d89('0x29'),_0x3635eb[_0x8d89('0x2a')])],_0x3635eb);}}}return _0x1d0802[_0x8d89('0x13')];};};Realtime['prototype'][_0x8d89('0x47')]=function(){var _0x3f76a5=this;return function(_0x9485e){if(_0x9485e){freeIsNotKeySip(_0x9485e,_0x3f76a5[_0x8d89('0x14')]);for(var _0x4af92d=0x0,_0x306639={},_0x12819b={};_0x4af92d<_0x9485e['length'];_0x4af92d+=0x1){_0x306639=_0x9485e[_0x4af92d];if(_[_0x8d89('0x46')](_0x3f76a5[_0x8d89('0x14')][util[_0x8d89('0x28')](_0x8d89('0x29'),_0x306639['name'])])){_0x3f76a5[_0x8d89('0x14')][util[_0x8d89('0x28')](_0x8d89('0x29'),_0x306639['name'])]=new Trunk(_0x306639);}else{_0x3f76a5[_0x8d89('0x42')](_0x3f76a5[_0x8d89('0x14')][util[_0x8d89('0x28')](_0x8d89('0x29'),_0x306639[_0x8d89('0x2a')])],_0x306639);}}}return _0x3f76a5[_0x8d89('0x14')];};};Realtime[_0x8d89('0x41')][_0x8d89('0x48')]=function(){var _0x319b5f=this;return function(_0x2efee7){if(_0x2efee7){freeIsNotKey(_0x2efee7,_0x319b5f[_0x8d89('0x15')],'name');for(var _0x3915c9=0x0,_0x492be5={},_0x1abdd0={};_0x3915c9<_0x2efee7['length'];_0x3915c9+=0x1){_0x492be5=_0x2efee7[_0x3915c9];if(_[_0x8d89('0x46')](_0x319b5f[_0x8d89('0x15')][_0x492be5['name']])){_0x319b5f[_0x8d89('0x15')][_0x492be5[_0x8d89('0x2a')]]=new VoiceQueue(_0x492be5);}else{_0x319b5f[_0x8d89('0x42')](_0x319b5f[_0x8d89('0x15')][_0x492be5[_0x8d89('0x2a')]],_0x492be5);}}}return _0x319b5f['voiceQueues'];};};Realtime[_0x8d89('0x41')][_0x8d89('0x49')]=function(){var _0x59d93d=this;return function(_0x3e199b){if(_0x3e199b){freeIsNotKey(_0x3e199b,_0x59d93d[_0x8d89('0x16')],'id');for(var _0x3cace4=0x0,_0x50f5a5={},_0x599d76={};_0x3cace4<_0x3e199b['length'];_0x3cace4+=0x1){_0x50f5a5=_0x3e199b[_0x3cace4];if(_['isUndefined'](_0x59d93d[_0x8d89('0x16')][_0x50f5a5['id']])){_0x59d93d['triggers'][_0x50f5a5['id']]=new Trigger(_0x50f5a5);}else{_0x59d93d[_0x8d89('0x42')](_0x59d93d[_0x8d89('0x16')][_0x50f5a5['id']],_0x50f5a5);}}}return _0x59d93d['triggers'];};};Realtime[_0x8d89('0x41')][_0x8d89('0x4a')]=function(){var _0x52306c=this;return function(_0x52e97c){if(_0x52e97c){freeIsNotKey(_0x52e97c,_0x52306c[_0x8d89('0x18')],'id');for(var _0xa58a6b=0x0,_0x4400cf={},_0x423e9e={};_0xa58a6b<_0x52e97c['length'];_0xa58a6b+=0x1){_0x4400cf=_0x52e97c[_0xa58a6b];if(_['isUndefined'](_0x52306c['templates'][_0x4400cf['id']])){_0x52306c[_0x8d89('0x18')][_0x4400cf['id']]=new Template(_0x4400cf);}else{_0x52306c['mergeFromDatabase'](_0x52306c[_0x8d89('0x18')][_0x4400cf['id']],_0x4400cf);}}}return _0x52306c[_0x8d89('0x18')];};};Realtime[_0x8d89('0x41')]['initZendeskAccounts']=function(){var _0x356cd9=this;return function(_0x4cb030){if(_0x4cb030){freeIsNotKey(_0x4cb030,_0x356cd9[_0x8d89('0x1e')],'id');for(var _0x19e302=0x0,_0x5a0d00={},_0xf41031={};_0x19e302<_0x4cb030[_0x8d89('0x44')];_0x19e302+=0x1){_0x5a0d00=_0x4cb030[_0x19e302];if(_[_0x8d89('0x46')](_0x356cd9['zendeskAccounts'][_0x5a0d00['id']])){_0x356cd9[_0x8d89('0x1e')][_0x5a0d00['id']]=new ZendeskAccount(_0x5a0d00);}else{_0x356cd9['mergeFromDatabase'](_0x356cd9[_0x8d89('0x1e')][_0x5a0d00['id']],_0x5a0d00);}}}return _0x356cd9['zendeskAccounts'];};};Realtime[_0x8d89('0x41')][_0x8d89('0x4b')]=function(){var _0x265367=this;return function(_0x28c4d5){if(_0x28c4d5){freeIsNotKey(_0x28c4d5,_0x265367[_0x8d89('0x1f')],'id');for(var _0x5d2d5f=0x0,_0x8d1458={},_0x20adee={};_0x5d2d5f<_0x28c4d5[_0x8d89('0x44')];_0x5d2d5f+=0x1){_0x8d1458=_0x28c4d5[_0x5d2d5f];if(_[_0x8d89('0x46')](_0x265367[_0x8d89('0x1f')][_0x8d1458['id']])){_0x265367['salesforceAccounts'][_0x8d1458['id']]=new SalesforceAccount(_0x8d1458);}else{_0x265367[_0x8d89('0x42')](_0x265367[_0x8d89('0x1f')][_0x8d1458['id']],_0x8d1458);}}}return _0x265367[_0x8d89('0x1f')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x5dc634=this;return function(_0xef43df){if(_0xef43df){freeIsNotKey(_0xef43df,_0x5dc634[_0x8d89('0x21')],'id');for(var _0x3abaf8=0x0,_0x4f847c={},_0x14aed1={};_0x3abaf8<_0xef43df['length'];_0x3abaf8+=0x1){_0x4f847c=_0xef43df[_0x3abaf8];if(_[_0x8d89('0x46')](_0x5dc634[_0x8d89('0x21')][_0x4f847c['id']])){_0x5dc634[_0x8d89('0x21')][_0x4f847c['id']]=new FreshdeskAccount(_0x4f847c);}else{_0x5dc634['mergeFromDatabase'](_0x5dc634[_0x8d89('0x21')][_0x4f847c['id']],_0x4f847c);}}}return _0x5dc634[_0x8d89('0x21')];};};Realtime[_0x8d89('0x41')]['initZohoAccounts']=function(){var _0x48d0a3=this;return function(_0x32c9c9){if(_0x32c9c9){freeIsNotKey(_0x32c9c9,_0x48d0a3[_0x8d89('0x4c')],'id');for(var _0x2f6981=0x0,_0x379a4e={},_0x3e566c={};_0x2f6981<_0x32c9c9[_0x8d89('0x44')];_0x2f6981+=0x1){_0x379a4e=_0x32c9c9[_0x2f6981];if(_[_0x8d89('0x46')](_0x48d0a3['zohoAccounts'][_0x379a4e['id']])){_0x48d0a3[_0x8d89('0x4c')][_0x379a4e['id']]=new ZohoAccount(_0x379a4e);}else{_0x48d0a3[_0x8d89('0x42')](_0x48d0a3[_0x8d89('0x4c')][_0x379a4e['id']],_0x379a4e);}}}return _0x48d0a3[_0x8d89('0x4c')];};};Realtime[_0x8d89('0x41')][_0x8d89('0x4d')]=function(){var _0x56e6b3=this;return function(_0x3d917c){if(_0x3d917c){freeIsNotKey(_0x3d917c,_0x56e6b3[_0x8d89('0x4e')],'id');for(var _0x10a744=0x0,_0x332159={},_0x54f987={};_0x10a744<_0x3d917c[_0x8d89('0x44')];_0x10a744+=0x1){_0x332159=_0x3d917c[_0x10a744];if(_[_0x8d89('0x46')](_0x56e6b3[_0x8d89('0x4e')][_0x332159['id']])){_0x56e6b3['deskAccounts'][_0x332159['id']]=new DeskAccount(_0x332159);}else{_0x56e6b3['mergeFromDatabase'](_0x56e6b3[_0x8d89('0x4e')][_0x332159['id']],_0x332159);}}}return _0x56e6b3[_0x8d89('0x4e')];};};Realtime[_0x8d89('0x41')]['initSugarcrmAccounts']=function(){var _0x402b62=this;return function(_0x3cdb6b){if(_0x3cdb6b){freeIsNotKey(_0x3cdb6b,_0x402b62[_0x8d89('0x20')],'id');for(var _0x428ba0=0x0,_0x5d6bc6={},_0x111ec7={};_0x428ba0<_0x3cdb6b[_0x8d89('0x44')];_0x428ba0+=0x1){_0x5d6bc6=_0x3cdb6b[_0x428ba0];if(_[_0x8d89('0x46')](_0x402b62[_0x8d89('0x20')][_0x5d6bc6['id']])){_0x402b62['sugarcrmAccounts'][_0x5d6bc6['id']]=new SugarcrmAccount(_0x5d6bc6);}else{_0x402b62['mergeFromDatabase'](_0x402b62[_0x8d89('0x20')][_0x5d6bc6['id']],_0x5d6bc6);}}}return _0x402b62[_0x8d89('0x20')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x32c0ac=this;return function(_0x55f23e){if(_0x55f23e){freeIsNotKey(_0x55f23e,_0x32c0ac[_0x8d89('0x22')],'id');for(var _0x1d1ce9=0x0,_0x11ac8c={},_0x3440a4={};_0x1d1ce9<_0x55f23e[_0x8d89('0x44')];_0x1d1ce9+=0x1){_0x11ac8c=_0x55f23e[_0x1d1ce9];if(_[_0x8d89('0x46')](_0x32c0ac[_0x8d89('0x22')][_0x11ac8c['id']])){_0x32c0ac[_0x8d89('0x22')][_0x11ac8c['id']]=new VtigerAccount(_0x11ac8c);}else{_0x32c0ac['mergeFromDatabase'](_0x32c0ac[_0x8d89('0x22')][_0x11ac8c['id']],_0x11ac8c);}}}return _0x32c0ac[_0x8d89('0x22')];};};Realtime[_0x8d89('0x41')][_0x8d89('0x4f')]=function(){var _0x2f2152=this;return function(_0x424fb3){if(_0x424fb3){freeIsNotKey(_0x424fb3,_0x2f2152[_0x8d89('0x23')],'id');for(var _0x3e18e4=0x0,_0x5be9f1={},_0x3c0da3={};_0x3e18e4<_0x424fb3[_0x8d89('0x44')];_0x3e18e4+=0x1){_0x5be9f1=_0x424fb3[_0x3e18e4];if(_[_0x8d89('0x46')](_0x2f2152[_0x8d89('0x23')][_0x5be9f1['id']])){_0x2f2152[_0x8d89('0x23')][_0x5be9f1['id']]=new ServicenowAccount(_0x5be9f1);}else{_0x2f2152[_0x8d89('0x42')](_0x2f2152['servicenowAccounts'][_0x5be9f1['id']],_0x5be9f1);}}}return _0x2f2152['servicenowAccounts'];};};Realtime[_0x8d89('0x41')][_0x8d89('0x50')]=function(){var _0x2659f7=this;return function(_0x4baf7c){if(_0x4baf7c){freeIsNotKey(_0x4baf7c,_0x2659f7[_0x8d89('0x24')],'id');for(var _0x21458f=0x0,_0x287b8d={},_0x2bfb8e={};_0x21458f<_0x4baf7c[_0x8d89('0x44')];_0x21458f+=0x1){_0x287b8d=_0x4baf7c[_0x21458f];if(_[_0x8d89('0x46')](_0x2659f7[_0x8d89('0x24')][_0x287b8d['id']])){_0x2659f7[_0x8d89('0x24')][_0x287b8d['id']]=new Dynamics365Account(_0x287b8d);}else{_0x2659f7[_0x8d89('0x42')](_0x2659f7[_0x8d89('0x24')][_0x287b8d['id']],_0x287b8d);}}}return _0x2659f7[_0x8d89('0x24')];};};Realtime['prototype'][_0x8d89('0x51')]=function(){var _0x18a6c4=this;return function(_0x48db68){if(_0x48db68){freeIsNotKey(_0x48db68,_0x18a6c4[_0x8d89('0x52')],'id');for(var _0x145bf6=0x0,_0x30370d={},_0x3d5817={};_0x145bf6<_0x48db68[_0x8d89('0x44')];_0x145bf6+=0x1){_0x30370d=_0x48db68[_0x145bf6];if(_['isUndefined'](_0x18a6c4[_0x8d89('0x52')][_0x30370d['id']])){_0x18a6c4[_0x8d89('0x52')][_0x30370d['id']]=new FreshsalesAccount(_0x30370d);}else{_0x18a6c4['mergeFromDatabase'](_0x18a6c4[_0x8d89('0x52')][_0x30370d['id']],_0x30370d);}}}return _0x18a6c4[_0x8d89('0x52')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x4e65ab=this;return function(_0x1e2302){for(var _0x2447a1=0x0;_0x2447a1<_0x1e2302[_0x8d89('0x44')];_0x2447a1+=0x1){_[_0x8d89('0x53')](_0x4e65ab[_0x8d89('0x15')][_0x1e2302[_0x2447a1][_0x8d89('0x2a')]],_0x1e2302[_0x2447a1]);}return _0x4e65ab[_0x8d89('0x15')];};};Realtime[_0x8d89('0x41')][_0x8d89('0x54')]=function(){var _0x178589=this;return function(_0x4b12b2){clearVoiceQueues(_0x178589[_0x8d89('0x15')]);if(_0x4b12b2){_0x4b12b2=_[_0x8d89('0x55')](_0x4b12b2,_0x8d89('0x56'));for(var _0xa3b5ce in _0x4b12b2){if(_0x4b12b2[_0x8d89('0x27')](_0xa3b5ce)){var _0x4e884a={};for(var _0x439468=0x0;_0x439468<_0x4b12b2[_0xa3b5ce][_0x8d89('0x44')];_0x439468+=0x1){var _0x4a5a97=_0x4b12b2[_0xa3b5ce][_0x439468][_0x8d89('0x57')];if(_0x178589[_0x8d89('0x15')][_0x4a5a97]){if(_0x4b12b2[_0xa3b5ce][_0x439468]['queuecallerexit']){_0x178589[_0x8d89('0x15')][_0x4a5a97][_0x8d89('0x34')]+=0x1;}if(_0x4b12b2[_0xa3b5ce][_0x439468]['queuecallerabandon']){_0x178589[_0x8d89('0x15')][_0x4a5a97][_0x8d89('0x35')]+=0x1;}_0x178589[_0x8d89('0x15')][_0x4a5a97][_0x8d89('0x2e')]+=moment(_0x4b12b2[_0xa3b5ce][_0x439468][_0x8d89('0x58')])[_0x8d89('0x59')](moment(_0x4b12b2[_0xa3b5ce][_0x439468][_0x8d89('0x5a')]),_0x8d89('0x5b'))||0x0;if(_0x439468===_0x4b12b2[_0xa3b5ce][_0x8d89('0x44')]-0x1){_0x178589[_0x8d89('0x15')][_0x4a5a97][_0x8d89('0x2f')]+=moment(_0x4b12b2[_0xa3b5ce][_0x439468][_0x8d89('0x5c')]||_0x4b12b2[_0xa3b5ce][_0x439468]['queuecallerabandonAt']||_0x4b12b2[_0xa3b5ce][_0x439468]['queuecallerexitAt'])[_0x8d89('0x59')](moment(_0x4b12b2[_0xa3b5ce][_0x439468][_0x8d89('0x5a')]),_0x8d89('0x5b'))||0x0;_0x178589[_0x8d89('0x15')][_0x4a5a97]['total']+=0x1;if(_0x4b12b2[_0xa3b5ce][_0x439468][_0x8d89('0x5d')]){_0x178589[_0x8d89('0x15')][_0x4a5a97][_0x8d89('0x2d')]+=0x1;_0x178589[_0x8d89('0x15')][_0x4a5a97]['sumBillable']+=moment(_0x4b12b2[_0xa3b5ce][_0x439468]['queuecallercompleteAt'])['diff'](moment(_0x4b12b2[_0xa3b5ce][_0x439468][_0x8d89('0x58')]),_0x8d89('0x5b'))||0x0;}}else{_0x178589[_0x8d89('0x15')][_0x4a5a97][_0x8d89('0x2f')]+=_0x178589[_0x8d89('0x15')][_0x4a5a97]['sumHoldTime']||0x0;}}}}}}return _0x178589[_0x8d89('0x15')];};};Realtime['prototype'][_0x8d89('0x5e')]=function(){var _0x504dbc=this;return function(_0x12a8d3){clearVoiceCallReports(_0x504dbc[_0x8d89('0x19')]);if(_0x12a8d3){for(var _0x25fafc=0x0;_0x25fafc<_0x12a8d3[_0x8d89('0x44')];_0x25fafc+=0x1){_0x504dbc['outbound'][_0x8d89('0x2c')]+=0x1;_0x504dbc[_0x8d89('0x19')][_0x8d89('0x2f')]+=_0x12a8d3[_0x25fafc][_0x8d89('0x5f')];if(_0x12a8d3[_0x25fafc]['disposition']===_0x8d89('0x60')){_0x504dbc[_0x8d89('0x19')][_0x8d89('0x2d')]+=0x1;_0x504dbc['outbound'][_0x8d89('0x2e')]+=_0x12a8d3[_0x25fafc][_0x8d89('0x5f')]-_0x12a8d3[_0x25fafc][_0x8d89('0x61')]||0x0;_0x504dbc['outbound']['sumBillable']+=_0x12a8d3[_0x25fafc][_0x8d89('0x61')];}}}return _0x504dbc[_0x8d89('0x19')];};};Realtime[_0x8d89('0x41')][_0x8d89('0x62')]=function(){var _0x5dae54=this;return function(_0x500a55){if(_0x500a55){freeIsNotKey(_0x500a55,_0x5dae54[_0x8d89('0x17')],_0x8d89('0x2a'));for(var _0x468dcc=0x0,_0x219f95={};_0x468dcc<_0x500a55[_0x8d89('0x44')];_0x468dcc+=0x1){_0x219f95=_0x500a55[_0x468dcc];if(_[_0x8d89('0x46')](_0x5dae54[_0x8d89('0x17')][_0x219f95[_0x8d89('0x2a')]])){_0x5dae54[_0x8d89('0x17')][_0x219f95[_0x8d89('0x2a')]]=new Campaign(_0x219f95);}else{_0x5dae54[_0x8d89('0x42')](_0x5dae54[_0x8d89('0x17')][_0x219f95[_0x8d89('0x2a')]],_0x219f95);_0x5dae54[_0x8d89('0x17')][_0x219f95[_0x8d89('0x2a')]]['dialQueueProject']=_0x219f95[_0x8d89('0x63')]?_0x219f95[_0x8d89('0x63')][_0x8d89('0x2a')]:undefined;}}}return _0x5dae54['campaigns'];};};Realtime[_0x8d89('0x41')][_0x8d89('0x64')]=function(){var _0x21b4bb=this;return function(_0x25f9f5){if(_0x25f9f5){freeIsNotKey(_0x25f9f5,_0x21b4bb[_0x8d89('0x1a')],'id');for(var _0x5a73c5=0x0,_0x467eca={};_0x5a73c5<_0x25f9f5[_0x8d89('0x44')];_0x5a73c5+=0x1){_0x467eca=_0x25f9f5[_0x5a73c5];if(_[_0x8d89('0x46')](_0x21b4bb[_0x8d89('0x1a')][_0x467eca['id']])){_0x21b4bb[_0x8d89('0x1a')][_0x467eca['id']]=new VoiceExtension(_0x467eca);}else{_0x21b4bb[_0x8d89('0x42')](_0x21b4bb['voiceExtensions'][_0x467eca['id']],_0x467eca);}}}return _0x21b4bb[_0x8d89('0x1a')];};};Realtime[_0x8d89('0x41')]['initCampaignHopperHistory']=function(){var _0x10b6b0=this;return function(_0x5cebfc){clearCampaigns(_0x10b6b0[_0x8d89('0x17')]);for(var _0x33a4af=0x0;_0x33a4af<_0x5cebfc[_0x8d89('0x44')];_0x33a4af+=0x1){_[_0x8d89('0x53')](_0x10b6b0[_0x8d89('0x17')][_0x5cebfc[_0x33a4af][_0x8d89('0x2a')]],_0x5cebfc[_0x33a4af]);}return _0x10b6b0[_0x8d89('0x17')];};};Realtime[_0x8d89('0x41')]['initFaxAccounts']=function(){var _0x15a14a=this;return function(_0x4212a5){if(_0x4212a5){freeIsNotKey(_0x4212a5,_0x15a14a[_0x8d89('0x25')],'id');for(var _0x49189a=0x0,_0x460b7d={},_0x457f71={};_0x49189a<_0x4212a5[_0x8d89('0x44')];_0x49189a+=0x1){_0x460b7d=_0x4212a5[_0x49189a];if(_[_0x8d89('0x46')](_0x15a14a[_0x8d89('0x25')][_0x460b7d['id']])){_0x15a14a[_0x8d89('0x25')][_0x460b7d['id']]=new FaxAccount(_0x460b7d);}else{_0x15a14a[_0x8d89('0x42')](_0x15a14a[_0x8d89('0x25')][_0x460b7d['id']],_0x460b7d);}}}return _0x15a14a['faxAccounts'];};};module[_0x8d89('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 4056aac..cd59311 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 _0x1400=['startsWith','Local','substring','indexOf','phone','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','interface','format','length','connectedlinenum','accountcode','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','voiceCallReport','destination','type','queue','lastdata','context','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1400,0xb5));var _0x0140=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x1400[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x0140('0x0'));var moment=require(_0x0140('0x1'));var util=require(_0x0140('0x2'));var config=require(_0x0140('0x3'));var ami=require(_0x0140('0x4'));var RpcVoiceAgentReport=require(_0x0140('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x0140('0x6'));var RpcMemberReport=require(_0x0140('0x7'));var RpcVoiceQueueReport=require(_0x0140('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x0140('0x9'));var VoiceQueueReport=require(_0x0140('0xa'));var VoiceCallReport=require(_0x0140('0xb'));var VoiceAgentReport=require(_0x0140('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x0140('0xd'));function Report(_0x233f36){this[_0x0140('0xe')]=_0x233f36;this[_0x0140('0xf')]=_0x233f36[_0x0140('0xf')];this[_0x0140('0x10')]=_0x233f36[_0x0140('0x10')];}Report[_0x0140('0x11')][_0x0140('0x12')]=function(_0x34aa2d){var _0x3ad12a=new VoiceQueueReport(this[_0x0140('0xe')]);var _0xb93ef4=new VoiceAgentReport(this[_0x0140('0xe')]);var _0x25bf7d=new VoiceDialReport(this[_0x0140('0xe')]);var _0x392294=new VoiceCallReport(this['realtime']);var _0x4ef2ab=new UserReport(this['realtime']);if(config[_0x0140('0x13')]&&config[_0x0140('0x13')][_0x0140('0x14')]){ami['on'](_0x0140('0x15'),this[_0x0140('0x16')]['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x0140('0x17')](this));ami['on'](_0x0140('0x18'),this[_0x0140('0x19')][_0x0140('0x17')](this));ami['on'](_0x0140('0x1a'),this[_0x0140('0x1b')][_0x0140('0x17')](this));ami['on'](_0x0140('0x1c'),this[_0x0140('0x1d')][_0x0140('0x17')](this));ami['on'](_0x0140('0x1e'),this[_0x0140('0x1f')][_0x0140('0x17')](this));}};Report['prototype'][_0x0140('0x20')]=function(_0x5efd33){var _0x2ba4e9;_0x2ba4e9=_[_0x0140('0x21')](this[_0x0140('0xf')],function(_0xa04de7){return _0xa04de7['accountcode']==_0x5efd33||_0xa04de7['name']==_0x5efd33;});if(_['isNil'](_0x2ba4e9)){var _0x1b49a4=_[_0x0140('0x21')](this[_0x0140('0x10')],function(_0x6bfa7f){return _0x6bfa7f['accountcode']==_0x5efd33||_0x6bfa7f[_0x0140('0x22')]==_0x5efd33;});if(_0x1b49a4){_0x2ba4e9=_[_0x0140('0x21')](this[_0x0140('0xf')],function(_0x8cfa82){return _0x8cfa82[_0x0140('0x23')]==util[_0x0140('0x24')]('SIP/%s',_0x1b49a4[_0x0140('0x22')]);});}}return _0x2ba4e9;};Report[_0x0140('0x11')][_0x0140('0x16')]=function(_0x177e30){for(var _0x3f386a=0x0;_0x3f386a<_0x177e30[_0x0140('0x25')];_0x3f386a+=0x1){var _0x5d39da=this[_0x0140('0x20')](_0x177e30[_0x3f386a][_0x0140('0x26')]);if(_0x5d39da){_0x177e30[_0x3f386a]['accountcode']=_0x5d39da[_0x0140('0x27')];_0x177e30[_0x3f386a][_0x0140('0x28')]=!![];_0x177e30[_0x3f386a][_0x0140('0x29')]=_0x5d39da[_0x0140('0x22')];_0x177e30[_0x3f386a][_0x0140('0x23')]=_[_0x0140('0x2a')](_0x5d39da[_0x0140('0x23')])?util[_0x0140('0x24')]('SIP/%s',_0x5d39da[_0x0140('0x22')]):_0x5d39da['interface'];if(_0x177e30[_0x3f386a][_0x0140('0x2b')]){_0x177e30[_0x3f386a][_0x0140('0x2c')]=moment()[_0x0140('0x24')](_0x0140('0x2d'));}if(_0x177e30[_0x3f386a]['queuecallerexit']){_0x177e30[_0x3f386a][_0x0140('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x0140('0x16')](_0x177e30[_0x3f386a]);}RpcVoiceQueueReport[_0x0140('0x2f')](_0x177e30[_0x3f386a]);}};function extractCalleridNumber(_0x351df1){var _0xd19058=_0x351df1[_0x0140('0x30')](/<(.*?)>/);return _0xd19058?_0xd19058[0x1]:_0x351df1;}Report['prototype'][_0x0140('0x31')]=function(_0x229ef4){_0x229ef4['destination']=_0x229ef4[_0x0140('0x32')]||_0x229ef4['exten'];if(_0x229ef4[_0x0140('0x33')]=='dialer'){_0x229ef4['lastapplication']=_0x0140('0x34');_0x229ef4[_0x0140('0x35')]=_0x229ef4[_0x0140('0x34')];if(_0x229ef4[_0x0140('0x36')]=='from-voip-provider'){_0x229ef4[_0x0140('0x27')]='';_0x229ef4[_0x0140('0x32')]=extractCalleridNumber(_0x229ef4[_0x0140('0x37')]);}else if(_0x229ef4[_0x0140('0x36')]=='from-sip'){if(_0x229ef4[_0x0140('0x32')]==_0x0140('0x38')){_0x229ef4['destination']=extractCalleridNumber(_0x229ef4[_0x0140('0x39')]);_0x229ef4[_0x0140('0x3a')]=_0x229ef4[_0x0140('0x3b')];_0x229ef4[_0x0140('0x3c')]=[_0x229ef4[_0x0140('0x3d')],_0x229ef4['channel']=_0x229ef4['destinationchannel']][0x0];_0x229ef4[_0x0140('0x37')]=_0x229ef4['calleridpreview'];}else{_0x229ef4[_0x0140('0x32')]=_0x229ef4[_0x0140('0x3a')];_0x229ef4[_0x0140('0x3a')]=_0x229ef4[_0x0140('0x3b')];if(_0x229ef4[_0x0140('0x3e')]==_0x0140('0x3f')){_0x229ef4[_0x0140('0x27')]=_0x229ef4[_0x0140('0x26')];}else{_0x229ef4[_0x0140('0x27')]='';}}}}else{_0x229ef4[_0x0140('0x37')]=util[_0x0140('0x24')]('\x22%s\x22\x20<%s>',_0x229ef4[_0x0140('0x40')],_0x229ef4[_0x0140('0x3a')]);}if(RpcVoiceTransferReport[_0x0140('0x41')][_0x229ef4[_0x0140('0x42')]]){var _0x54a721=RpcVoiceTransferReport['transfers'][_0x229ef4[_0x0140('0x42')]];_0x54a721[_0x0140('0x43')]=_0x229ef4[_0x0140('0x44')];RpcVoiceTransferReport['blindTransfer'](_0x54a721);delete RpcVoiceTransferReport[_0x0140('0x41')][_0x229ef4[_0x0140('0x42')]];}RpcVoiceCallReport[_0x0140('0x2f')](_0x229ef4);if(_0x229ef4[_0x0140('0x45')]){for(var _0x29030b=0x0;_0x29030b<_0x229ef4[_0x0140('0x46')][_0x0140('0x25')];_0x29030b+=0x1){_0x229ef4[_0x0140('0x47')]=_0x229ef4['monitors'][_0x29030b][_0x0140('0x48')];_0x229ef4[_0x0140('0x49')]=_0x229ef4[_0x0140('0x46')][_0x29030b]['createdAt'];if(_0x229ef4[_0x0140('0x4a')]==_0x0140('0x38')){_0x229ef4[_0x0140('0x3a')]=_0x229ef4['connectedlinenum'];_0x229ef4[_0x0140('0x40')]=_0x229ef4[_0x0140('0x4b')];_0x229ef4[_0x0140('0x26')]=_0x229ef4[_0x0140('0x27')];_0x229ef4['connectedlinename']=_0x229ef4[_0x0140('0x4c')];_0x229ef4['exten']=_0x229ef4[_0x0140('0x3b')];}else if(_0x229ef4[_0x0140('0x4a')]==_0x0140('0x4d')){_0x229ef4['calleridnum']=_0x229ef4[_0x0140('0x32')];_0x229ef4[_0x0140('0x4a')]=_0x229ef4['originatecalleridnum'];}RpcVoiceRecording[_0x0140('0x2f')](_0x229ef4);}}};Report[_0x0140('0x11')][_0x0140('0x19')]=function(_0x59e022){if(_[_0x0140('0x4e')](_0x59e022)){_0x59e022[_0x0140('0x4f')](function(_0x48178f){RpcVoiceAgentReport[_0x0140('0x2f')](_0x48178f);});}else{RpcVoiceAgentReport[_0x0140('0x2f')](_0x59e022);}};Report['prototype'][_0x0140('0x1b')]=function(_0x46018b){RpcVoiceDialReport['create'](_0x46018b);var _0x1992db;var _0x449154;var _0x1b491c=_0x46018b['channel'];if(_[_0x0140('0x50')](_0x1b491c,_0x0140('0x51'))){_0x449154=_0x1b491c[_0x0140('0x52')](_0x1b491c[_0x0140('0x53')]('/')+0x1,_0x1b491c[_0x0140('0x53')]('@'));_0x1992db=_[_0x0140('0x21')](this[_0x0140('0xf')],function(_0x190d48){return _0x190d48['mobile']==_0x449154||_0x190d48[_0x0140('0x54')]==_0x449154||_0x190d48['accountcode']==_0x449154;});}else{_0x449154=_0x1b491c['substring'](_0x1b491c[_0x0140('0x53')]('/')+0x1,_0x1b491c['lastIndexOf']('-'));_0x1992db=this['findAgent'](_0x449154);}if(_0x1992db){_0x46018b['interface']=_['isNil'](_0x1992db['interface'])?util['format']('SIP/%s',_0x1992db[_0x0140('0x22')]):_0x1992db[_0x0140('0x23')];_0x46018b[_0x0140('0x4c')]=_0x1992db[_0x0140('0x22')];_0x46018b[_0x0140('0x27')]=_0x1992db['accountcode'];RpcMemberReport[_0x0140('0x1b')](_0x46018b);}};Report[_0x0140('0x11')][_0x0140('0x1d')]=function(_0xd904f0){RpcVoiceTransferReport[_0x0140('0x41')][_0xd904f0[_0x0140('0x55')]]=_0xd904f0;};Report[_0x0140('0x11')][_0x0140('0x1f')]=function(_0x3c5b9e){RpcVoiceTransferReport[_0x0140('0x1f')](_0x3c5b9e);};module[_0x0140('0x56')]=Report; \ No newline at end of file +var _0x9553=['format','SIP/%s','length','connectedlinenum','accountcode','lastAssignedTo','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','type','lastapplication','queue','context','from-voip-provider','from-sip','calleridpreview','originatecalleridnum','destinationchannel','channel','callerid','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','indexOf','phone','substring','lastIndexOf','blindTransfer','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','bind','attendedtransfer','findAgent','name','isNil','find','telephones'];(function(_0x662230,_0x760ada){var _0x3e995a=function(_0x61902){while(--_0x61902){_0x662230['push'](_0x662230['shift']());}};_0x3e995a(++_0x760ada);}(_0x9553,0x194));var _0x3955=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9553[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x3955('0x0'));var moment=require(_0x3955('0x1'));var util=require(_0x3955('0x2'));var config=require(_0x3955('0x3'));var ami=require(_0x3955('0x4'));var RpcVoiceAgentReport=require(_0x3955('0x5'));var RpcVoiceCallReport=require(_0x3955('0x6'));var RpcVoiceDialReport=require(_0x3955('0x7'));var RpcMemberReport=require(_0x3955('0x8'));var RpcVoiceQueueReport=require(_0x3955('0x9'));var RpcVoiceRecording=require(_0x3955('0xa'));var RpcVoiceTransferReport=require(_0x3955('0xb'));var VoiceQueueReport=require(_0x3955('0xc'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x3955('0xd'));var VoiceDialReport=require(_0x3955('0xe'));var UserReport=require(_0x3955('0xf'));function Report(_0x1fe2af){this['realtime']=_0x1fe2af;this[_0x3955('0x10')]=_0x1fe2af[_0x3955('0x10')];this['telephones']=_0x1fe2af['telephones'];}Report[_0x3955('0x11')]['sync']=function(_0x3001bf){var _0x217b4f=new VoiceQueueReport(this['realtime']);var _0x5966d9=new VoiceAgentReport(this['realtime']);var _0xf9a8c6=new VoiceDialReport(this['realtime']);var _0x4e0b21=new VoiceCallReport(this[_0x3955('0x12')]);var _0x2de689=new UserReport(this[_0x3955('0x12')]);if(config[_0x3955('0x13')]&&config[_0x3955('0x13')][_0x3955('0x14')]){ami['on'](_0x3955('0x15'),this[_0x3955('0x16')]['bind'](this));ami['on'](_0x3955('0x17'),this[_0x3955('0x18')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x3955('0x19')]['bind'](this));ami['on'](_0x3955('0x1a'),this[_0x3955('0x1b')]['bind'](this));ami['on'](_0x3955('0x1c'),this['blindTransfer'][_0x3955('0x1d')](this));ami['on'](_0x3955('0x1e'),this['attendedTransfer'][_0x3955('0x1d')](this));}};Report[_0x3955('0x11')][_0x3955('0x1f')]=function(_0x2cfba0){var _0x4976df;_0x4976df=_['find'](this[_0x3955('0x10')],function(_0x1e2990){return _0x1e2990['accountcode']==_0x2cfba0||_0x1e2990[_0x3955('0x20')]==_0x2cfba0;});if(_[_0x3955('0x21')](_0x4976df)){var _0x301b68=_[_0x3955('0x22')](this[_0x3955('0x23')],function(_0x4943f7){return _0x4943f7['accountcode']==_0x2cfba0||_0x4943f7[_0x3955('0x20')]==_0x2cfba0;});if(_0x301b68){_0x4976df=_[_0x3955('0x22')](this[_0x3955('0x10')],function(_0x470b46){return _0x470b46['interface']==util[_0x3955('0x24')](_0x3955('0x25'),_0x301b68[_0x3955('0x20')]);});}}return _0x4976df;};Report[_0x3955('0x11')]['voiceQueueReport']=function(_0x335a72){for(var _0x4fc8a7=0x0;_0x4fc8a7<_0x335a72[_0x3955('0x26')];_0x4fc8a7+=0x1){var _0xc27f6=this[_0x3955('0x1f')](_0x335a72[_0x4fc8a7][_0x3955('0x27')]);if(_0xc27f6){_0x335a72[_0x4fc8a7]['accountcode']=_0xc27f6[_0x3955('0x28')];_0x335a72[_0x4fc8a7]['assigned']=!![];_0x335a72[_0x4fc8a7][_0x3955('0x29')]=_0xc27f6['name'];_0x335a72[_0x4fc8a7][_0x3955('0x2a')]=_[_0x3955('0x21')](_0xc27f6[_0x3955('0x2a')])?util[_0x3955('0x24')](_0x3955('0x25'),_0xc27f6[_0x3955('0x20')]):_0xc27f6[_0x3955('0x2a')];if(_0x335a72[_0x4fc8a7]['queuecallercomplete']){_0x335a72[_0x4fc8a7][_0x3955('0x2b')]=moment()['format'](_0x3955('0x2c'));}if(_0x335a72[_0x4fc8a7][_0x3955('0x2d')]){_0x335a72[_0x4fc8a7][_0x3955('0x2e')]=moment()[_0x3955('0x24')](_0x3955('0x2c'));}RpcMemberReport[_0x3955('0x16')](_0x335a72[_0x4fc8a7]);}RpcVoiceQueueReport[_0x3955('0x2f')](_0x335a72[_0x4fc8a7]);}};function extractCalleridNumber(_0x292980){var _0x161cd0=_0x292980['match'](/<(.*?)>/);return _0x161cd0?_0x161cd0[0x1]:_0x292980;}Report['prototype']['voiceCallReport']=function(_0x89b60f){_0x89b60f[_0x3955('0x30')]=_0x89b60f[_0x3955('0x30')]||_0x89b60f['exten'];if(_0x89b60f[_0x3955('0x31')]=='dialer'){_0x89b60f[_0x3955('0x32')]=_0x3955('0x33');_0x89b60f['lastdata']=_0x89b60f[_0x3955('0x33')];if(_0x89b60f[_0x3955('0x34')]==_0x3955('0x35')){_0x89b60f['accountcode']='';_0x89b60f['destination']=extractCalleridNumber(_0x89b60f['callerid']);}else if(_0x89b60f[_0x3955('0x34')]==_0x3955('0x36')){if(_0x89b60f[_0x3955('0x30')]=='xcally-motion-preview'){_0x89b60f[_0x3955('0x30')]=extractCalleridNumber(_0x89b60f[_0x3955('0x37')]);_0x89b60f['calleridnum']=_0x89b60f[_0x3955('0x38')];_0x89b60f[_0x3955('0x39')]=[_0x89b60f['channel'],_0x89b60f[_0x3955('0x3a')]=_0x89b60f[_0x3955('0x39')]][0x0];_0x89b60f[_0x3955('0x3b')]=_0x89b60f['calleridpreview'];}else{_0x89b60f[_0x3955('0x30')]=_0x89b60f[_0x3955('0x3c')];_0x89b60f[_0x3955('0x3c')]=_0x89b60f[_0x3955('0x38')];if(_0x89b60f[_0x3955('0x3d')]==_0x3955('0x3e')){_0x89b60f[_0x3955('0x28')]=_0x89b60f[_0x3955('0x27')];}else{_0x89b60f[_0x3955('0x28')]='';}}}}else{_0x89b60f[_0x3955('0x3b')]=util[_0x3955('0x24')](_0x3955('0x3f'),_0x89b60f[_0x3955('0x40')],_0x89b60f[_0x3955('0x3c')]);}if(RpcVoiceTransferReport[_0x3955('0x41')][_0x89b60f[_0x3955('0x42')]]){var _0x608fce=RpcVoiceTransferReport[_0x3955('0x41')][_0x89b60f['linkedid']];_0x608fce[_0x3955('0x43')]=_0x89b60f[_0x3955('0x44')];RpcVoiceTransferReport['blindTransfer'](_0x608fce);delete RpcVoiceTransferReport[_0x3955('0x41')][_0x89b60f['linkedid']];}RpcVoiceCallReport[_0x3955('0x2f')](_0x89b60f);if(_0x89b60f[_0x3955('0x45')]){for(var _0x2226e1=0x0;_0x2226e1<_0x89b60f[_0x3955('0x46')]['length'];_0x2226e1+=0x1){_0x89b60f[_0x3955('0x47')]=_0x89b60f[_0x3955('0x46')][_0x2226e1][_0x3955('0x48')];_0x89b60f['createdAt']=_0x89b60f[_0x3955('0x46')][_0x2226e1]['createdAt'];if(_0x89b60f[_0x3955('0x49')]=='xcally-motion-preview'){_0x89b60f[_0x3955('0x3c')]=_0x89b60f[_0x3955('0x27')];_0x89b60f[_0x3955('0x40')]=_0x89b60f['connectedlinename'];_0x89b60f[_0x3955('0x27')]=_0x89b60f[_0x3955('0x28')];_0x89b60f[_0x3955('0x4a')]=_0x89b60f[_0x3955('0x4b')];_0x89b60f[_0x3955('0x49')]=_0x89b60f[_0x3955('0x38')];}else if(_0x89b60f[_0x3955('0x49')]==_0x3955('0x4c')){_0x89b60f[_0x3955('0x3c')]=_0x89b60f['destination'];_0x89b60f[_0x3955('0x49')]=_0x89b60f[_0x3955('0x38')];}RpcVoiceRecording[_0x3955('0x2f')](_0x89b60f);}}};Report[_0x3955('0x11')][_0x3955('0x19')]=function(_0x5c9470){if(_[_0x3955('0x4d')](_0x5c9470)){_0x5c9470[_0x3955('0x4e')](function(_0x5e1472){RpcVoiceAgentReport[_0x3955('0x2f')](_0x5e1472);});}else{RpcVoiceAgentReport[_0x3955('0x2f')](_0x5c9470);}};Report[_0x3955('0x11')][_0x3955('0x1b')]=function(_0x288073){RpcVoiceDialReport[_0x3955('0x2f')](_0x288073);var _0x32b6ea;var _0x57f3e1;var _0x4d00b1=_0x288073['channel'];if(_[_0x3955('0x4f')](_0x4d00b1,'Local')){_0x57f3e1=_0x4d00b1['substring'](_0x4d00b1['indexOf']('/')+0x1,_0x4d00b1[_0x3955('0x50')]('@'));_0x32b6ea=_[_0x3955('0x22')](this['agents'],function(_0x3a4332){return _0x3a4332['mobile']==_0x57f3e1||_0x3a4332[_0x3955('0x51')]==_0x57f3e1||_0x3a4332[_0x3955('0x28')]==_0x57f3e1;});}else{_0x57f3e1=_0x4d00b1[_0x3955('0x52')](_0x4d00b1['indexOf']('/')+0x1,_0x4d00b1[_0x3955('0x53')]('-'));_0x32b6ea=this[_0x3955('0x1f')](_0x57f3e1);}if(_0x32b6ea){_0x288073[_0x3955('0x2a')]=_[_0x3955('0x21')](_0x32b6ea['interface'])?util[_0x3955('0x24')](_0x3955('0x25'),_0x32b6ea[_0x3955('0x20')]):_0x32b6ea['interface'];_0x288073['membername']=_0x32b6ea[_0x3955('0x20')];_0x288073[_0x3955('0x28')]=_0x32b6ea[_0x3955('0x28')];RpcMemberReport[_0x3955('0x1b')](_0x288073);}};Report[_0x3955('0x11')][_0x3955('0x54')]=function(_0x1d28f2){RpcVoiceTransferReport[_0x3955('0x41')][_0x1d28f2[_0x3955('0x55')]]=_0x1d28f2;};Report[_0x3955('0x11')]['attendedTransfer']=function(_0x3d1a5b){RpcVoiceTransferReport[_0x3955('0x56')](_0x3d1a5b);};module[_0x3955('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 95c825d..d4f82d5 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 _0x8c8b=['actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event','debug','trunk:%s','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','format','toNumber','telephone:%s','name','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','phone','accountcode','updateStatusRealtime','peer','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','ioredis','bluebird','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','resolve','actionDeviceStateList','catch','[userReport][devicestatelist]','inspect'];(function(_0x531b6e,_0x3b71ec){var _0x353ad7=function(_0x41eb73){while(--_0x41eb73){_0x531b6e['push'](_0x531b6e['shift']());}};_0x353ad7(++_0x3b71ec);}(_0x8c8b,0x106));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb8c8('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xb8c8('0x1'));var BPromise=require(_0xb8c8('0x2'));var config=require(_0xb8c8('0x3'));var logger=require(_0xb8c8('0x4'))('ami');var ami=require('../ami');config[_0xb8c8('0x5')]=_[_0xb8c8('0x6')](config[_0xb8c8('0x5')],{'host':_0xb8c8('0x7'),'port':0x18eb});var io=require(_0xb8c8('0x8'))(new Redis(config[_0xb8c8('0x5')]));function UserReport(_0x1fa488){this[_0xb8c8('0x9')]=_0x1fa488[_0xb8c8('0x9')];this[_0xb8c8('0xa')]=_0x1fa488[_0xb8c8('0xa')];this['telephones']=_0x1fa488[_0xb8c8('0xb')];ami['on'](_0xb8c8('0xc'),this[_0xb8c8('0xd')][_0xb8c8('0xe')](this));ami['on'](_0xb8c8('0xf'),this[_0xb8c8('0xd')][_0xb8c8('0xe')](this));ami['on'](_0xb8c8('0x10'),this[_0xb8c8('0x11')][_0xb8c8('0xe')](this));ami['on'](_0xb8c8('0x12'),this[_0xb8c8('0x13')]['bind'](this));return this[_0xb8c8('0x14')]();}function showSipRegistrations(){Promise['resolve']()[_0xb8c8('0x15')](ami[_0xb8c8('0x16')]())['catch'](function(_0x3df583){logger[_0xb8c8('0x17')](_0xb8c8('0x18'),util['inspect'](_0x3df583,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xb8c8('0x19')]()[_0xb8c8('0x15')](ami[_0xb8c8('0x1a')]())[_0xb8c8('0x1b')](function(_0x50429e){logger[_0xb8c8('0x17')](_0xb8c8('0x1c'),util[_0xb8c8('0x1d')](_0x50429e,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb8c8('0x19')]()['then'](ami[_0xb8c8('0x1e')]())[_0xb8c8('0x1b')](function(_0x31886c){logger[_0xb8c8('0x17')](_0xb8c8('0x1f'),util[_0xb8c8('0x1d')](_0x31886c,{'showHidden':![],'depth':null}));});}UserReport[_0xb8c8('0x20')][_0xb8c8('0x14')]=function(){setInterval(function(){BPromise[_0xb8c8('0x19')]()[_0xb8c8('0x15')](showSipRegistrations())[_0xb8c8('0x15')](listDeviceStates())[_0xb8c8('0x15')](showPeersStatus());},0x32c8);};UserReport[_0xb8c8('0x20')][_0xb8c8('0x21')]=function(_0x3c1ab4){return _0x3c1ab4!==null&&!_['isUndefined'](_0x3c1ab4);};UserReport[_0xb8c8('0x20')][_0xb8c8('0x22')]=function(_0x44eaea,_0x37ec4a,_0x10adaa){io['to'](_0x44eaea)['emit'](_0x37ec4a,_0x10adaa);};UserReport[_0xb8c8('0x20')]['syncRegistry']=function(_0x58d7c0){try{if(this[_0xb8c8('0x21')](_0x58d7c0)){logger[_0xb8c8('0x23')](_0xb8c8('0x24'),_0x58d7c0[_0xb8c8('0x25')],_0x58d7c0[_0xb8c8('0x26')]);logger['debug'](_0xb8c8('0x27'),util[_0xb8c8('0x1d')](_0x58d7c0,{'showHidden':![],'depth':null}));var _0x2bf36f=_[_0xb8c8('0x28')](this['trunks'],{'registry':_0x58d7c0[_0xb8c8('0x25')]});if(_0x2bf36f){_0x58d7c0[_0xb8c8('0x29')]=_0x58d7c0['state'];_[_0xb8c8('0x2a')](_0x2bf36f,_[_0xb8c8('0x2b')](_0x58d7c0,[_0xb8c8('0x2c'),'actionid','username',_0xb8c8('0x26')]));logger[_0xb8c8('0x2d')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xb8c8('0x1d')](_0x2bf36f,{'showHidden':![],'depth':null}));this[_0xb8c8('0x22')](util['format'](_0xb8c8('0x2e'),_0x2bf36f['name']),_0xb8c8('0x2f'),_0x2bf36f);}}}catch(_0xcccbee){logger[_0xb8c8('0x17')](_0xb8c8('0x27'),util[_0xb8c8('0x1d')](_0xcccbee,{'showHidden':![],'depth':null}));}};UserReport[_0xb8c8('0x20')][_0xb8c8('0x11')]=function(_0x2751cc){try{if(this[_0xb8c8('0x21')](_0x2751cc)){logger['info'](_0xb8c8('0x30'),_0x2751cc['device'],_0x2751cc[_0xb8c8('0x26')]);logger[_0xb8c8('0x2d')](_0xb8c8('0x31'),util['inspect'](_0x2751cc,{'showHidden':![],'depth':null}));if(this[_0xb8c8('0xa')][_0x2751cc[_0xb8c8('0x32')]]){if(!this[_0xb8c8('0xa')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x33')]||_0x2751cc[_0xb8c8('0x26')][_0xb8c8('0x34')]()==_0xb8c8('0x35')){this[_0xb8c8('0xa')][_0x2751cc[_0xb8c8('0x32')]]['local']=![];if(this[_0xb8c8('0xa')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x26')]!==_0x2751cc[_0xb8c8('0x26')][_0xb8c8('0x34')]()){this[_0xb8c8('0xa')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x36')]=_['toNumber'](moment()[_0xb8c8('0x37')]('x'));}this['agents'][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x26')]=_0x2751cc[_0xb8c8('0x26')][_0xb8c8('0x34')]();this[_0xb8c8('0xa')][_0x2751cc[_0xb8c8('0x32')]]['updateStatusRealtime'](_0x2751cc);}}else if(this[_0xb8c8('0xb')][_0x2751cc[_0xb8c8('0x32')]]){if(this[_0xb8c8('0xb')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x26')]!==_0x2751cc['state']['toLowerCase']()){this[_0xb8c8('0xb')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x36')]=_[_0xb8c8('0x38')](moment()[_0xb8c8('0x37')]('x'));}this[_0xb8c8('0xb')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x26')]=_0x2751cc[_0xb8c8('0x26')]['toLowerCase']();logger[_0xb8c8('0x2d')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xb8c8('0x1d')](this[_0xb8c8('0xb')][_0x2751cc[_0xb8c8('0x32')]],{'showHidden':![],'depth':null}));this[_0xb8c8('0x22')](util[_0xb8c8('0x37')](_0xb8c8('0x39'),this[_0xb8c8('0xb')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x3a')]),'telephone:save',this[_0xb8c8('0xb')][_0x2751cc[_0xb8c8('0x32')]]);}else if(this[_0xb8c8('0x9')][_0x2751cc[_0xb8c8('0x32')]]){if(this[_0xb8c8('0x9')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x26')]!==_0x2751cc[_0xb8c8('0x26')][_0xb8c8('0x34')]()){this[_0xb8c8('0x9')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x36')]=_[_0xb8c8('0x38')](moment()[_0xb8c8('0x37')]('x'));}this[_0xb8c8('0x9')][_0x2751cc[_0xb8c8('0x32')]][_0xb8c8('0x26')]=_0x2751cc['state']['toLowerCase']();logger[_0xb8c8('0x2d')](_0xb8c8('0x3b'),util[_0xb8c8('0x1d')](this[_0xb8c8('0x9')][_0x2751cc[_0xb8c8('0x32')]],{'showHidden':![],'depth':null}));this[_0xb8c8('0x22')](util[_0xb8c8('0x37')]('trunk:%s',this[_0xb8c8('0x9')][_0x2751cc['device']]['name']),_0xb8c8('0x2f'),this[_0xb8c8('0x9')][_0x2751cc[_0xb8c8('0x32')]]);}else if(_[_0xb8c8('0x3c')](_0x2751cc['device'],_0xb8c8('0x3d'))){var _0x381d9d=_0x2751cc['device'];var _0x44f3b6=_0x381d9d['substring'](_0x381d9d['indexOf']('/')+0x1,_0x381d9d['indexOf']('@'));var _0x334207=_[_0xb8c8('0x28')](this['agents'],function(_0x15e51c){return _0x15e51c['mobile']==_0x44f3b6||_0x15e51c[_0xb8c8('0x3e')]==_0x44f3b6||_0x15e51c[_0xb8c8('0x3f')]==_0x44f3b6;});if(_0x334207){if(_0x334207[_0xb8c8('0x26')]!==_0x2751cc['state'][_0xb8c8('0x34')]()){_0x334207[_0xb8c8('0x36')]=_['toNumber'](moment()[_0xb8c8('0x37')]('x'));}_0x334207[_0xb8c8('0x26')]=_0x2751cc[_0xb8c8('0x26')][_0xb8c8('0x34')]();_0x334207[_0xb8c8('0x33')]=!![];_0x334207[_0xb8c8('0x40')](_0x2751cc);}}}}catch(_0x509774){logger[_0xb8c8('0x17')]('[userReport][devicestatechange]',util[_0xb8c8('0x1d')](_0x509774,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xb8c8('0x13')]=function(_0x277c84){try{if(this[_0xb8c8('0x21')](_0x277c84)&&this['isNotNull'](_0x277c84['peerstatus'])){logger[_0xb8c8('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x277c84[_0xb8c8('0x41')],_0x277c84['address'],_0x277c84[_0xb8c8('0x12')]);logger[_0xb8c8('0x2d')]('[userReport][peerstatus]',util[_0xb8c8('0x1d')](_0x277c84,{'showHidden':![],'depth':null}));if(this[_0xb8c8('0xa')][_0x277c84[_0xb8c8('0x41')]]){if(!this[_0xb8c8('0xa')][_0x277c84[_0xb8c8('0x41')]][_0xb8c8('0x33')]||_0x277c84[_0xb8c8('0x12')][_0xb8c8('0x34')]()=='registered'){this[_0xb8c8('0xa')][_0x277c84[_0xb8c8('0x41')]]['local']=![];this[_0xb8c8('0xa')][_0x277c84[_0xb8c8('0x41')]][_0xb8c8('0x42')]=_0x277c84[_0xb8c8('0x12')][_0xb8c8('0x34')]();this[_0xb8c8('0xa')][_0x277c84['peer']]['address']=_0x277c84[_0xb8c8('0x43')];this[_0xb8c8('0xa')][_0x277c84[_0xb8c8('0x41')]]['updateStatusRealtime'](_0x277c84);}}else if(this[_0xb8c8('0xb')][_0x277c84[_0xb8c8('0x41')]]){this[_0xb8c8('0xb')][_0x277c84[_0xb8c8('0x41')]][_0xb8c8('0x42')]=_0x277c84[_0xb8c8('0x12')][_0xb8c8('0x34')]();this[_0xb8c8('0xb')][_0x277c84['peer']]['address']=_0x277c84[_0xb8c8('0x43')];logger[_0xb8c8('0x2d')](_0xb8c8('0x44'),util[_0xb8c8('0x1d')](this[_0xb8c8('0xb')][_0x277c84[_0xb8c8('0x41')]],{'showHidden':![],'depth':null}));this[_0xb8c8('0x22')](util['format'](_0xb8c8('0x39'),this[_0xb8c8('0xb')][_0x277c84[_0xb8c8('0x41')]][_0xb8c8('0x3a')]),_0xb8c8('0x45'),this[_0xb8c8('0xb')][_0x277c84[_0xb8c8('0x41')]]);}else if(this[_0xb8c8('0x9')][_0x277c84[_0xb8c8('0x41')]]){this[_0xb8c8('0x9')][_0x277c84[_0xb8c8('0x41')]]['status']=_0x277c84[_0xb8c8('0x12')][_0xb8c8('0x34')]();this[_0xb8c8('0x9')][_0x277c84[_0xb8c8('0x41')]][_0xb8c8('0x43')]=_0x277c84[_0xb8c8('0x43')];logger[_0xb8c8('0x2d')](_0xb8c8('0x46'),util[_0xb8c8('0x1d')](this['trunks'][_0x277c84[_0xb8c8('0x41')]],{'showHidden':![],'depth':null}));this[_0xb8c8('0x22')](util['format'](_0xb8c8('0x2e'),this['trunks'][_0x277c84[_0xb8c8('0x41')]][_0xb8c8('0x3a')]),_0xb8c8('0x2f'),this[_0xb8c8('0x9')][_0x277c84[_0xb8c8('0x41')]]);}}}catch(_0x47ab41){logger['error'](_0xb8c8('0x47'),util['inspect'](_0x47ab41,{'showHidden':![],'depth':null}));}};module[_0xb8c8('0x48')]=UserReport; \ No newline at end of file +var _0x9df6=['status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','actionSipShowRegistry','catch','error','inspect','resolve','actionDeviceStateList','then','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','merge','actionid','state','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','local','toLowerCase','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','accountcode','address','peerstatus','[userReport][peerstatus]','peer','registered'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x9df6,0xe2));var _0x69df=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x9df6[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var moment=require(_0x69df('0x0'));var util=require(_0x69df('0x1'));var Redis=require('ioredis');var BPromise=require(_0x69df('0x2'));var config=require(_0x69df('0x3'));var logger=require(_0x69df('0x4'))(_0x69df('0x5'));var ami=require('../ami');config[_0x69df('0x6')]=_[_0x69df('0x7')](config[_0x69df('0x6')],{'host':_0x69df('0x8'),'port':0x18eb});var io=require(_0x69df('0x9'))(new Redis(config['redis']));function UserReport(_0x462c34){this[_0x69df('0xa')]=_0x462c34['trunks'];this['agents']=_0x462c34['agents'];this[_0x69df('0xb')]=_0x462c34['telephones'];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on'](_0x69df('0xc'),this[_0x69df('0xd')][_0x69df('0xe')](this));ami['on'](_0x69df('0xf'),this[_0x69df('0x10')][_0x69df('0xe')](this));ami['on']('peerstatus',this[_0x69df('0x11')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami[_0x69df('0x12')]())[_0x69df('0x13')](function(_0x5b8653){logger[_0x69df('0x14')]('[userReport][sipshowregistry]',util[_0x69df('0x15')](_0x5b8653,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x69df('0x16')]()['then'](ami[_0x69df('0x17')]())[_0x69df('0x13')](function(_0x547ba2){logger['error']('[userReport][devicestatelist]',util[_0x69df('0x15')](_0x547ba2,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x69df('0x18')](ami[_0x69df('0x19')]())['catch'](function(_0x19a6fb){logger[_0x69df('0x14')](_0x69df('0x1a'),util[_0x69df('0x15')](_0x19a6fb,{'showHidden':![],'depth':null}));});}UserReport[_0x69df('0x1b')][_0x69df('0x1c')]=function(){setInterval(function(){BPromise[_0x69df('0x16')]()['then'](showSipRegistrations())[_0x69df('0x18')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x69df('0x1b')]['isNotNull']=function(_0x19ad8d){return _0x19ad8d!==null&&!_[_0x69df('0x1d')](_0x19ad8d);};UserReport[_0x69df('0x1b')][_0x69df('0x1e')]=function(_0x2c08d5,_0x57d8f1,_0x5edb8a){io['to'](_0x2c08d5)[_0x69df('0x1e')](_0x57d8f1,_0x5edb8a);};UserReport[_0x69df('0x1b')][_0x69df('0xd')]=function(_0x3898f3){try{if(this[_0x69df('0x1f')](_0x3898f3)){logger[_0x69df('0x20')](_0x69df('0x21'),_0x3898f3[_0x69df('0x22')],_0x3898f3['state']);logger['debug'](_0x69df('0x23'),util[_0x69df('0x15')](_0x3898f3,{'showHidden':![],'depth':null}));var _0x2ce9b0=_[_0x69df('0x24')](this[_0x69df('0xa')],{'registry':_0x3898f3['username']});if(_0x2ce9b0){_0x3898f3['stateRegistry']=_0x3898f3['state'];_[_0x69df('0x25')](_0x2ce9b0,_['omit'](_0x3898f3,['event',_0x69df('0x26'),_0x69df('0x22'),_0x69df('0x27')]));logger[_0x69df('0x28')](_0x69df('0x29'),util[_0x69df('0x15')](_0x2ce9b0,{'showHidden':![],'depth':null}));this['emit'](util[_0x69df('0x2a')](_0x69df('0x2b'),_0x2ce9b0[_0x69df('0x2c')]),_0x69df('0x2d'),_0x2ce9b0);}}}catch(_0x1eccc5){logger[_0x69df('0x14')](_0x69df('0x23'),util[_0x69df('0x15')](_0x1eccc5,{'showHidden':![],'depth':null}));}};UserReport[_0x69df('0x1b')][_0x69df('0x10')]=function(_0x55964e){try{if(this[_0x69df('0x1f')](_0x55964e)){logger[_0x69df('0x20')](_0x69df('0x2e'),_0x55964e[_0x69df('0x2f')],_0x55964e[_0x69df('0x27')]);logger[_0x69df('0x28')](_0x69df('0x30'),util[_0x69df('0x15')](_0x55964e,{'showHidden':![],'depth':null}));if(this[_0x69df('0x31')][_0x55964e[_0x69df('0x2f')]]){if(!this[_0x69df('0x31')][_0x55964e[_0x69df('0x2f')]][_0x69df('0x32')]||_0x55964e['state']['toLowerCase']()=='inuse'){this['agents'][_0x55964e[_0x69df('0x2f')]]['local']=![];if(this[_0x69df('0x31')][_0x55964e[_0x69df('0x2f')]][_0x69df('0x27')]!==_0x55964e[_0x69df('0x27')]['toLowerCase']()){this[_0x69df('0x31')][_0x55964e[_0x69df('0x2f')]]['stateTime']=_['toNumber'](moment()[_0x69df('0x2a')]('x'));}this[_0x69df('0x31')][_0x55964e[_0x69df('0x2f')]][_0x69df('0x27')]=_0x55964e['state'][_0x69df('0x33')]();this[_0x69df('0x31')][_0x55964e['device']][_0x69df('0x34')](_0x55964e);}}else if(this['telephones'][_0x55964e[_0x69df('0x2f')]]){if(this[_0x69df('0xb')][_0x55964e[_0x69df('0x2f')]][_0x69df('0x27')]!==_0x55964e['state'][_0x69df('0x33')]()){this[_0x69df('0xb')][_0x55964e[_0x69df('0x2f')]][_0x69df('0x35')]=_['toNumber'](moment()[_0x69df('0x2a')]('x'));}this[_0x69df('0xb')][_0x55964e['device']][_0x69df('0x27')]=_0x55964e[_0x69df('0x27')][_0x69df('0x33')]();logger['debug'](_0x69df('0x36'),util[_0x69df('0x15')](this[_0x69df('0xb')][_0x55964e['device']],{'showHidden':![],'depth':null}));this[_0x69df('0x1e')](util[_0x69df('0x2a')](_0x69df('0x37'),this['telephones'][_0x55964e['device']][_0x69df('0x2c')]),_0x69df('0x38'),this[_0x69df('0xb')][_0x55964e[_0x69df('0x2f')]]);}else if(this['trunks'][_0x55964e[_0x69df('0x2f')]]){if(this['trunks'][_0x55964e[_0x69df('0x2f')]][_0x69df('0x27')]!==_0x55964e[_0x69df('0x27')][_0x69df('0x33')]()){this[_0x69df('0xa')][_0x55964e['device']]['stateTime']=_[_0x69df('0x39')](moment()['format']('x'));}this[_0x69df('0xa')][_0x55964e['device']][_0x69df('0x27')]=_0x55964e[_0x69df('0x27')]['toLowerCase']();logger[_0x69df('0x28')](_0x69df('0x3a'),util[_0x69df('0x15')](this[_0x69df('0xa')][_0x55964e[_0x69df('0x2f')]],{'showHidden':![],'depth':null}));this[_0x69df('0x1e')](util['format'](_0x69df('0x2b'),this[_0x69df('0xa')][_0x55964e['device']][_0x69df('0x2c')]),_0x69df('0x2d'),this[_0x69df('0xa')][_0x55964e[_0x69df('0x2f')]]);}else if(_[_0x69df('0x3b')](_0x55964e[_0x69df('0x2f')],_0x69df('0x3c'))){var _0x553394=_0x55964e[_0x69df('0x2f')];var _0x39bb96=_0x553394['substring'](_0x553394['indexOf']('/')+0x1,_0x553394[_0x69df('0x3d')]('@'));var _0x1db044=_[_0x69df('0x24')](this['agents'],function(_0x182f1b){return _0x182f1b[_0x69df('0x3e')]==_0x39bb96||_0x182f1b[_0x69df('0x3f')]==_0x39bb96||_0x182f1b[_0x69df('0x40')]==_0x39bb96;});if(_0x1db044){if(_0x1db044[_0x69df('0x27')]!==_0x55964e['state'][_0x69df('0x33')]()){_0x1db044[_0x69df('0x35')]=_[_0x69df('0x39')](moment()['format']('x'));}_0x1db044[_0x69df('0x27')]=_0x55964e[_0x69df('0x27')][_0x69df('0x33')]();_0x1db044[_0x69df('0x32')]=!![];_0x1db044[_0x69df('0x34')](_0x55964e);}}}}catch(_0x33d978){logger[_0x69df('0x14')]('[userReport][devicestatechange]',util[_0x69df('0x15')](_0x33d978,{'showHidden':![],'depth':null}));}};UserReport[_0x69df('0x1b')][_0x69df('0x11')]=function(_0x393498){try{if(this[_0x69df('0x1f')](_0x393498)&&this[_0x69df('0x1f')](_0x393498['peerstatus'])){logger[_0x69df('0x20')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x393498['peer'],_0x393498[_0x69df('0x41')],_0x393498[_0x69df('0x42')]);logger[_0x69df('0x28')](_0x69df('0x43'),util[_0x69df('0x15')](_0x393498,{'showHidden':![],'depth':null}));if(this['agents'][_0x393498[_0x69df('0x44')]]){if(!this[_0x69df('0x31')][_0x393498[_0x69df('0x44')]][_0x69df('0x32')]||_0x393498[_0x69df('0x42')][_0x69df('0x33')]()==_0x69df('0x45')){this['agents'][_0x393498[_0x69df('0x44')]][_0x69df('0x32')]=![];this['agents'][_0x393498[_0x69df('0x44')]][_0x69df('0x46')]=_0x393498['peerstatus'][_0x69df('0x33')]();this[_0x69df('0x31')][_0x393498[_0x69df('0x44')]]['address']=_0x393498[_0x69df('0x41')];this[_0x69df('0x31')][_0x393498[_0x69df('0x44')]][_0x69df('0x34')](_0x393498);}}else if(this[_0x69df('0xb')][_0x393498[_0x69df('0x44')]]){this[_0x69df('0xb')][_0x393498['peer']][_0x69df('0x46')]=_0x393498[_0x69df('0x42')][_0x69df('0x33')]();this[_0x69df('0xb')][_0x393498[_0x69df('0x44')]][_0x69df('0x41')]=_0x393498[_0x69df('0x41')];logger[_0x69df('0x28')](_0x69df('0x47'),util[_0x69df('0x15')](this[_0x69df('0xb')][_0x393498[_0x69df('0x44')]],{'showHidden':![],'depth':null}));this[_0x69df('0x1e')](util[_0x69df('0x2a')]('telephone:%s',this['telephones'][_0x393498[_0x69df('0x44')]]['name']),_0x69df('0x38'),this[_0x69df('0xb')][_0x393498['peer']]);}else if(this[_0x69df('0xa')][_0x393498[_0x69df('0x44')]]){this['trunks'][_0x393498['peer']]['status']=_0x393498['peerstatus']['toLowerCase']();this[_0x69df('0xa')][_0x393498[_0x69df('0x44')]][_0x69df('0x41')]=_0x393498[_0x69df('0x41')];logger[_0x69df('0x28')](_0x69df('0x48'),util[_0x69df('0x15')](this[_0x69df('0xa')][_0x393498[_0x69df('0x44')]],{'showHidden':![],'depth':null}));this[_0x69df('0x1e')](util[_0x69df('0x2a')](_0x69df('0x2b'),this['trunks'][_0x393498['peer']][_0x69df('0x2c')]),'trunk:save',this[_0x69df('0xa')][_0x393498[_0x69df('0x44')]]);}}}catch(_0x2ac966){logger[_0x69df('0x14')](_0x69df('0x43'),util[_0x69df('0x15')](_0x2ac966,{'showHidden':![],'depth':null}));}};module[_0x69df('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index b82ecd8..48652d9 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 _0x2eb5=['origtransfereruniqueid','complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','ioredis','../../../config/environment','ami','../ami','redis','localhost','socket.io-emitter','channels','agents','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','format','YYYY-MM-DD\x20HH:mm:ss','voiceQueues','queue','type','inbound','variables','merge','omit','event','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','reason','transfer','talktime','acwtime','acwTimeout','agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','agentcompleteAt','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid'];(function(_0x188888,_0x2a0a1c){var _0x1491a8=function(_0x57414a){while(--_0x57414a){_0x188888['push'](_0x188888['shift']());}};_0x1491a8(++_0x2a0a1c);}(_0x2eb5,0xa3));var _0x52eb=function(_0xaa6c76,_0x57b9e4){_0xaa6c76=_0xaa6c76-0x0;var _0xf53c91=_0x2eb5[_0xaa6c76];return _0xf53c91;};'use strict';var _=require(_0x52eb('0x0'));var moment=require(_0x52eb('0x1'));var util=require('util');var Redis=require(_0x52eb('0x2'));var config=require(_0x52eb('0x3'));var logger=require('../../../config/logger')(_0x52eb('0x4'));var ami=require(_0x52eb('0x5'));config[_0x52eb('0x6')]=_['defaults'](config[_0x52eb('0x6')],{'host':_0x52eb('0x7'),'port':0x18eb});var io=require(_0x52eb('0x8'))(new Redis(config[_0x52eb('0x6')]));function VoiceAgentReport(_0x3497b9){this[_0x52eb('0x9')]={};this['voiceQueues']=_0x3497b9['voiceQueues'];this[_0x52eb('0xa')]=_0x3497b9[_0x52eb('0xa')];this['variables']={};ami['on']('agentcalled',this[_0x52eb('0xb')][_0x52eb('0xc')](this));ami['on'](_0x52eb('0xd'),this['syncAgentConnect']['bind'](this));ami['on'](_0x52eb('0xe'),this[_0x52eb('0xf')][_0x52eb('0xc')](this));ami['on'](_0x52eb('0x10'),this[_0x52eb('0x11')][_0x52eb('0xc')](this));ami['on'](_0x52eb('0x12'),this[_0x52eb('0x13')]['bind'](this));ami['on'](_0x52eb('0x14'),this[_0x52eb('0x15')][_0x52eb('0xc')](this));ami['on'](_0x52eb('0x16'),this[_0x52eb('0x17')][_0x52eb('0xc')](this));ami['on'](_0x52eb('0x18'),this[_0x52eb('0x19')][_0x52eb('0xc')](this));ami['on']('musiconholdstop',this[_0x52eb('0x1a')]['bind'](this));ami['on'](_0x52eb('0x1b'),this[_0x52eb('0x1c')][_0x52eb('0xc')](this));ami['on'](_0x52eb('0x1d'),this[_0x52eb('0x1e')]['bind'](this));}VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x20')]=function(_0x240dd1,_0x260f78,_0x164035){io['to'](_0x240dd1)['emit'](_0x260f78,_0x164035);};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x21')]=function(_0x318601){return _0x318601!==null&&!_['isUndefined'](_0x318601);};VoiceAgentReport[_0x52eb('0x1f')]['syncAgentCalled']=function(_0xb9ff3c){try{if(this['isNotNull'](_0xb9ff3c)){logger[_0x52eb('0x22')](_0x52eb('0x23'),_0xb9ff3c[_0x52eb('0x24')],_0xb9ff3c[_0x52eb('0x25')],_0xb9ff3c[_0x52eb('0x26')]);logger[_0x52eb('0x27')](_0x52eb('0x28'),_0xb9ff3c['uniqueid'],util[_0x52eb('0x29')](_0xb9ff3c,{'showHidden':![],'depth':null}));if(_[_0x52eb('0x2a')](this['channels'][_0xb9ff3c[_0x52eb('0x24')]])){this[_0x52eb('0x9')][_0xb9ff3c[_0x52eb('0x24')]]={};}if(_[_0x52eb('0x2a')](this[_0x52eb('0x9')][_0xb9ff3c[_0x52eb('0x24')]][_0xb9ff3c[_0x52eb('0x26')]])){this['channels'][_0xb9ff3c[_0x52eb('0x24')]][_0xb9ff3c[_0x52eb('0x26')]]={'agentcalledAt':moment()[_0x52eb('0x2b')](_0x52eb('0x2c')),'lastevent':'called','mandatoryDisposition':this[_0x52eb('0x2d')][_0xb9ff3c['queue']]?this['voiceQueues'][_0xb9ff3c[_0x52eb('0x2e')]]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0xb9ff3c[_0x52eb('0x2e')]]?this[_0x52eb('0x2d')][_0xb9ff3c['queue']][_0x52eb('0x2f')]||_0x52eb('0x30'):'inbound','variables':this[_0x52eb('0x31')][_0xb9ff3c[_0x52eb('0x24')]]};}_[_0x52eb('0x32')](this[_0x52eb('0x9')][_0xb9ff3c[_0x52eb('0x24')]][_0xb9ff3c[_0x52eb('0x26')]],_[_0x52eb('0x33')](_0xb9ff3c,[_0x52eb('0x34'),'privilege']));logger[_0x52eb('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0xb9ff3c[_0x52eb('0x24')],util[_0x52eb('0x29')](this[_0x52eb('0x9')][_0xb9ff3c[_0x52eb('0x24')]][_0xb9ff3c['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x52eb('0x35'),this[_0x52eb('0x9')][_0xb9ff3c[_0x52eb('0x24')]][_0xb9ff3c['destuniqueid']]);logger['debug'](_0x52eb('0x36'),_0xb9ff3c[_0x52eb('0x24')],util['inspect'](this[_0x52eb('0x9')][_0xb9ff3c[_0x52eb('0x24')]][_0xb9ff3c[_0x52eb('0x26')]],{'showHidden':![],'depth':null}));this[_0x52eb('0x20')](util['format'](_0x52eb('0x37'),_0xb9ff3c['membername']),_0x52eb('0x38'),this[_0x52eb('0x9')][_0xb9ff3c[_0x52eb('0x24')]][_0xb9ff3c[_0x52eb('0x26')]]);}}catch(_0x514fc9){logger[_0x52eb('0x39')](_0x52eb('0x3a'),_0xb9ff3c[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x514fc9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x3b')]=function(_0x4f011a){try{if(this[_0x52eb('0x21')](_0x4f011a)){if(this['channels'][_0x4f011a[_0x52eb('0x24')]]){logger[_0x52eb('0x27')](_0x52eb('0x3c'),_0x4f011a[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x4f011a,{'showHidden':![],'depth':null}));for(var _0x21f130 in this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]]){if(this[_0x52eb('0x9')][_0x4f011a['uniqueid']]['hasOwnProperty'](_0x21f130)){if(_0x4f011a[_0x52eb('0x26')]===_0x21f130){logger[_0x52eb('0x22')](_0x52eb('0x3d'),_0x4f011a[_0x52eb('0x24')],_0x4f011a[_0x52eb('0x25')],_0x4f011a['destuniqueid']);this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130][_0x52eb('0x3e')]=moment()[_0x52eb('0x2b')](_0x52eb('0x2c'));this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130][_0x52eb('0x3f')]=_0x4f011a[_0x52eb('0x3f')];this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130][_0x52eb('0x40')]=_0x4f011a[_0x52eb('0x40')];this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130][_0x52eb('0x41')]=_0x4f011a[_0x52eb('0x41')];this[_0x52eb('0x9')][_0x4f011a['uniqueid']][_0x21f130][_0x52eb('0x42')]=_0x4f011a[_0x52eb('0x42')];this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130]['holdtime']=_0x4f011a[_0x52eb('0x43')];this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130]['lastevent']='connect';_['merge'](this[_0x52eb('0xa')][_0x4f011a['interface']],_[_0x52eb('0x44')](_0x4f011a,['queue',_0x52eb('0x45')]));logger[_0x52eb('0x27')](_0x52eb('0x46'),_0x4f011a[_0x52eb('0x24')],util[_0x52eb('0x29')](this[_0x52eb('0x9')][_0x4f011a['uniqueid']][_0x4f011a[_0x52eb('0x26')]],{'showHidden':![],'depth':null}));ami[_0x52eb('0x20')](_0x52eb('0x47'),this[_0x52eb('0x9')][_0x4f011a['uniqueid']][_0x4f011a[_0x52eb('0x26')]]);logger[_0x52eb('0x27')](_0x52eb('0x48'),_0x4f011a[_0x52eb('0x24')],util['inspect'](this['channels'][_0x4f011a['uniqueid']][_0x4f011a[_0x52eb('0x26')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x52eb('0x2b')]('user:%s',_0x4f011a[_0x52eb('0x25')]),'user:agentconnect',this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x4f011a[_0x52eb('0x26')]]);}else if(!this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130][_0x52eb('0xe')]&&!this['channels'][_0x4f011a['uniqueid']][_0x21f130]['agentcomplete']){logger[_0x52eb('0x22')](_0x52eb('0x49'),_0x4f011a[_0x52eb('0x24')],this['channels'][_0x4f011a[_0x52eb('0x24')]][_0x21f130][_0x52eb('0x25')],_0x21f130);this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130]['agentringnoanswer']=!![];this['channels'][_0x4f011a[_0x52eb('0x24')]][_0x21f130][_0x52eb('0x4a')]=moment()['format'](_0x52eb('0x2c'));this[_0x52eb('0x9')][_0x4f011a['uniqueid']][_0x21f130]['answeredelsewheredestinationuniqueid']=_0x4f011a[_0x52eb('0x26')];this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130]['answeredelsewheremembername']=_0x4f011a[_0x52eb('0x25')];this['channels'][_0x4f011a[_0x52eb('0x24')]][_0x21f130]['lastevent']=_0x52eb('0x4b');this['channels'][_0x4f011a[_0x52eb('0x24')]][_0x21f130]['reason']=_0x52eb('0x4b');logger[_0x52eb('0x27')](_0x52eb('0x4c'),_0x4f011a['uniqueid'],util[_0x52eb('0x29')](this['channels'][_0x4f011a[_0x52eb('0x24')]][_0x21f130],{'showHidden':![],'depth':null}));ami['emit'](_0x52eb('0x4d'),this[_0x52eb('0x9')][_0x4f011a[_0x52eb('0x24')]][_0x21f130]);}}}}}}catch(_0x180f98){logger[_0x52eb('0x39')](_0x52eb('0x4e'),_0x4f011a['uniqueid'],util['inspect'](_0x180f98,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0xf')]=function(_0x308087){try{if(this[_0x52eb('0x21')](_0x308087)){logger['debug'](_0x52eb('0x4f'),_0x308087[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x308087,{'showHidden':![],'depth':null}));if(this[_0x52eb('0x9')][_0x308087[_0x52eb('0x24')]]&&this[_0x52eb('0x9')][_0x308087[_0x52eb('0x24')]][_0x308087[_0x52eb('0x26')]]){logger[_0x52eb('0x22')](_0x52eb('0x50'),_0x308087[_0x52eb('0x24')],_0x308087[_0x52eb('0x25')],_0x308087[_0x52eb('0x26')]);this[_0x52eb('0x9')][_0x308087[_0x52eb('0x24')]][_0x308087[_0x52eb('0x26')]][_0x52eb('0xe')]=!![];this[_0x52eb('0x9')][_0x308087[_0x52eb('0x24')]][_0x308087[_0x52eb('0x26')]]['agentringnoanswerAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x308087[_0x52eb('0x24')]][_0x308087[_0x52eb('0x26')]][_0x52eb('0x51')]=_0x52eb('0x52');this['channels'][_0x308087[_0x52eb('0x24')]][_0x308087[_0x52eb('0x26')]]['reason']=_0x52eb('0x52');logger[_0x52eb('0x27')](_0x52eb('0x53'),_0x308087[_0x52eb('0x24')],util[_0x52eb('0x29')](this[_0x52eb('0x9')][_0x308087[_0x52eb('0x24')]][_0x308087[_0x52eb('0x26')]],{'showHidden':![],'depth':null}));ami[_0x52eb('0x20')](_0x52eb('0x54'),this[_0x52eb('0x9')][_0x308087[_0x52eb('0x24')]][_0x308087[_0x52eb('0x26')]]);}}}catch(_0x9582e8){logger[_0x52eb('0x39')]('[%s][voiceAgentReport][agentringnoanswer]',_0x308087[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x9582e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')]['syncQueueCallerAbandon']=function(_0x57175b){try{if(this[_0x52eb('0x21')](_0x57175b)){logger['debug'](_0x52eb('0x55'),_0x57175b['uniqueid'],util[_0x52eb('0x29')](_0x57175b,{'showHidden':![],'depth':null}));if(this['channels'][_0x57175b[_0x52eb('0x24')]]){for(var _0x4b60cb in this[_0x52eb('0x9')][_0x57175b[_0x52eb('0x24')]]){if(this['channels'][_0x57175b[_0x52eb('0x24')]][_0x52eb('0x56')](_0x4b60cb)&&!this[_0x52eb('0x9')][_0x57175b['uniqueid']][_0x4b60cb]['agentringnoanswer']&&!this[_0x52eb('0x9')][_0x57175b[_0x52eb('0x24')]][_0x4b60cb][_0x52eb('0x12')]){logger[_0x52eb('0x22')](_0x52eb('0x57'),_0x57175b['uniqueid'],this[_0x52eb('0x9')][_0x57175b[_0x52eb('0x24')]][_0x4b60cb][_0x52eb('0x25')],_0x4b60cb);this['channels'][_0x57175b['uniqueid']][_0x4b60cb][_0x52eb('0xe')]=!![];this[_0x52eb('0x9')][_0x57175b[_0x52eb('0x24')]][_0x4b60cb][_0x52eb('0x4a')]=moment()['format'](_0x52eb('0x2c'));this['channels'][_0x57175b[_0x52eb('0x24')]][_0x4b60cb][_0x52eb('0x51')]=_0x52eb('0x58');this['channels'][_0x57175b[_0x52eb('0x24')]][_0x4b60cb]['reason']=_0x52eb('0x58');logger[_0x52eb('0x27')](_0x52eb('0x59'),_0x57175b['uniqueid'],util['inspect'](this[_0x52eb('0x9')][_0x57175b[_0x52eb('0x24')]][_0x4b60cb],{'showHidden':![],'depth':null}));ami[_0x52eb('0x20')](_0x52eb('0x5a'),this[_0x52eb('0x9')][_0x57175b[_0x52eb('0x24')]][_0x4b60cb]);}}}}}catch(_0x2738ce){logger[_0x52eb('0x39')]('[%s][voiceAgentReport][queuecallerabandon]',_0x57175b['uniqueid'],util[_0x52eb('0x29')](_0x2738ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x13')]=function(_0x2eabc8){try{if(this[_0x52eb('0x21')](_0x2eabc8)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2eabc8[_0x52eb('0x24')],util['inspect'](_0x2eabc8,{'showHidden':![],'depth':null}));if(this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]]){for(var _0x136a4a in this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]]){if(this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]][_0x52eb('0x56')](_0x136a4a)){if(this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a][_0x52eb('0x3e')]&&!this['channels'][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a][_0x52eb('0x12')]){logger['info'](_0x52eb('0x5b'),_0x2eabc8[_0x52eb('0x24')],this[_0x52eb('0x9')][_0x2eabc8['uniqueid']][_0x136a4a]['membername'],_0x136a4a);this['channels'][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a][_0x52eb('0x12')]=!![];this[_0x52eb('0x9')][_0x2eabc8['uniqueid']][_0x136a4a]['agentcompleteAt']=moment()[_0x52eb('0x2b')](_0x52eb('0x2c'));this['channels'][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a][_0x52eb('0x51')]='complete';this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a]['reason']=_0x2eabc8[_0x52eb('0x5c')]==_0x52eb('0x5d')?'agent':_0x2eabc8[_0x52eb('0x5c')];this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a][_0x52eb('0x5e')]=_0x2eabc8[_0x52eb('0x5e')];if(this[_0x52eb('0x2d')][_0x2eabc8['queue']]&&this['voiceQueues'][_0x2eabc8[_0x52eb('0x2e')]]['acw']){this['channels'][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a][_0x52eb('0x5f')]=this[_0x52eb('0x2d')][_0x2eabc8[_0x52eb('0x2e')]][_0x52eb('0x60')];this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a][_0x52eb('0x61')]=!![];}this[_0x52eb('0xa')][_0x2eabc8[_0x52eb('0x62')]]=_[_0x52eb('0x33')](this[_0x52eb('0xa')][_0x2eabc8[_0x52eb('0x62')]],['queue',_0x52eb('0x45')]);logger['debug'](_0x52eb('0x63'),_0x2eabc8[_0x52eb('0x24')],util['inspect'](this[_0x52eb('0x9')][_0x2eabc8['uniqueid']][_0x136a4a],{'showHidden':![],'depth':null}));ami[_0x52eb('0x20')]('custom:agentcomplete',this['channels'][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a]);logger[_0x52eb('0x27')](_0x52eb('0x64'),_0x2eabc8[_0x52eb('0x24')],util[_0x52eb('0x29')](this[_0x52eb('0x9')][_0x2eabc8['uniqueid']][_0x136a4a],{'showHidden':![],'depth':null}));this[_0x52eb('0x20')](util[_0x52eb('0x2b')]('user:%s',_0x2eabc8[_0x52eb('0x25')]),_0x52eb('0x65'),this[_0x52eb('0x9')][_0x2eabc8[_0x52eb('0x24')]][_0x136a4a]);}}}}}}catch(_0x5f3435){logger['error'](_0x52eb('0x66'),_0x2eabc8['uniqueid'],util[_0x52eb('0x29')](_0x5f3435,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x15')]=function(_0x4904c3){try{if(this[_0x52eb('0x21')](_0x4904c3)){logger['debug'](_0x52eb('0x67'),_0x4904c3['uniqueid'],util[_0x52eb('0x29')](_0x4904c3,{'showHidden':![],'depth':null}));this[_0x52eb('0x68')](_0x4904c3[_0x52eb('0x24')],_[_0x52eb('0x69')](_0x4904c3[_0x52eb('0x6a')])[0x0],_0x4904c3[_0x52eb('0x6b')]);if(this['channels'][_0x4904c3['uniqueid']]){for(var _0x1a3c41 in this[_0x52eb('0x9')][_0x4904c3[_0x52eb('0x24')]]){if(this['channels'][_0x4904c3['uniqueid']][_0x52eb('0x56')](_0x1a3c41)){logger[_0x52eb('0x22')](_0x52eb('0x6c'),_0x4904c3[_0x52eb('0x24')],_0x1a3c41,_[_0x52eb('0x69')](_0x4904c3[_0x52eb('0x6a')])[0x0],_0x4904c3[_0x52eb('0x6b')]);if(_[_0x52eb('0x2a')](this[_0x52eb('0x9')][_0x4904c3[_0x52eb('0x24')]][_0x1a3c41][_0x52eb('0x31')])){this['channels'][_0x4904c3[_0x52eb('0x24')]][_0x1a3c41][_0x52eb('0x31')]={};}this[_0x52eb('0x9')][_0x4904c3[_0x52eb('0x24')]][_0x1a3c41]['variables']=this[_0x52eb('0x31')][_0x4904c3['uniqueid']];}}}}}catch(_0x1be60b){logger[_0x52eb('0x39')]('[%s][voiceAgentReport][varset]',_0x4904c3[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x1be60b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x68')]=function(_0x484b51,_0x49abfb,_0x5165b5){var _0x38e205=['rtpaudioqos',_0x52eb('0x6d'),_0x52eb('0x6e'),'rtpaudioqosjitterbridged',_0x52eb('0x6f'),_0x52eb('0x70'),_0x52eb('0x71'),_0x52eb('0x72'),'sipcallid',_0x52eb('0x73'),_0x52eb('0x74'),'bridgepvtcallid',_0x52eb('0x75'),_0x52eb('0x76'),_0x52eb('0x77'),_0x52eb('0x78'),_0x52eb('0x25'),_0x52eb('0x79'),_0x52eb('0x7a')];if(!_[_0x52eb('0x7b')](_0x49abfb)&&!_[_0x52eb('0x7c')](_0x38e205,_0x49abfb)){if(_[_0x52eb('0x2a')](this['variables'][_0x484b51])){this[_0x52eb('0x31')][_0x484b51]={};}this['variables'][_0x484b51][_0x49abfb]=_0x5165b5;}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x17')]=function(_0x2511b0){try{if(this[_0x52eb('0x21')](_0x2511b0)){logger[_0x52eb('0x27')](_0x52eb('0x7d'),_0x2511b0[_0x52eb('0x24')],util['inspect'](_0x2511b0,{'showHidden':![],'depth':null}));if(this[_0x52eb('0x9')][_0x2511b0[_0x52eb('0x24')]]){for(var _0x1ba49e in this['channels'][_0x2511b0[_0x52eb('0x24')]]){if(this[_0x52eb('0x9')][_0x2511b0[_0x52eb('0x24')]][_0x52eb('0x56')](_0x1ba49e)){if(this[_0x52eb('0x9')][_0x2511b0[_0x52eb('0x24')]][_0x1ba49e][_0x52eb('0x5c')]=='transfer'&&this[_0x52eb('0x9')][_0x2511b0[_0x52eb('0x24')]][_0x1ba49e][_0x52eb('0x12')]){logger[_0x52eb('0x22')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x2511b0['uniqueid'],_0x1ba49e);this['channels'][_0x2511b0[_0x52eb('0x24')]][_0x1ba49e][_0x52eb('0x7e')]=moment()['format'](_0x52eb('0x2c'));}}}logger[_0x52eb('0x27')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x2511b0['uniqueid'],util['inspect'](_[_0x52eb('0x7f')](this[_0x52eb('0x9')][_0x2511b0[_0x52eb('0x24')]]),{'showHidden':![],'depth':null}));ami[_0x52eb('0x20')]('custom:voiceAgentReport',_['values'](this[_0x52eb('0x9')][_0x2511b0[_0x52eb('0x24')]]));delete this['channels'][_0x2511b0[_0x52eb('0x24')]];}if(this[_0x52eb('0x31')][_0x2511b0[_0x52eb('0x24')]]){delete this[_0x52eb('0x31')][_0x2511b0['uniqueid']];}}}catch(_0x152dd2){logger[_0x52eb('0x39')](_0x52eb('0x80'),_0x2511b0[_0x52eb('0x24')],util['inspect'](_0x152dd2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x1c')]=function(_0x5c6b2b){try{if(this['isNotNull'](_0x5c6b2b)){logger[_0x52eb('0x27')](_0x52eb('0x81'),_0x5c6b2b['uniqueid'],util[_0x52eb('0x29')](_0x5c6b2b,{'showHidden':![],'depth':null}));if(this['channels'][_0x5c6b2b[_0x52eb('0x82')]]){for(var _0x51016b in this['channels'][_0x5c6b2b['transfereeuniqueid']]){if(this[_0x52eb('0x9')][_0x5c6b2b[_0x52eb('0x82')]][_0x52eb('0x56')](_0x51016b)){if(_0x5c6b2b[_0x52eb('0x83')]===_0x51016b){logger[_0x52eb('0x22')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5c6b2b[_0x52eb('0x24')],this[_0x52eb('0x9')][_0x5c6b2b[_0x52eb('0x82')]][_0x51016b][_0x52eb('0x25')],_0x51016b);var _0x294134=moment();this['channels'][_0x5c6b2b['transfereeuniqueid']][_0x51016b][_0x52eb('0x12')]=!![];this['channels'][_0x5c6b2b[_0x52eb('0x82')]][_0x51016b][_0x52eb('0x7e')]=moment()[_0x52eb('0x2b')](_0x52eb('0x2c'));this['channels'][_0x5c6b2b[_0x52eb('0x82')]][_0x51016b]['lastevent']=_0x52eb('0x84');this[_0x52eb('0x9')][_0x5c6b2b[_0x52eb('0x82')]][_0x51016b][_0x52eb('0x5c')]='transfer';this[_0x52eb('0x9')][_0x5c6b2b[_0x52eb('0x82')]][_0x51016b][_0x52eb('0x5e')]=_0x294134['diff'](this[_0x52eb('0x9')][_0x5c6b2b['transfereeuniqueid']][_0x51016b][_0x52eb('0x3e')],_0x52eb('0x85'));}}}}if(this[_0x52eb('0x9')][_0x5c6b2b[_0x52eb('0x86')]]){var _0x296a3b=this[_0x52eb('0x9')][_0x5c6b2b[_0x52eb('0x86')]];this['channels'][_0x5c6b2b[_0x52eb('0x86')]]=this[_0x52eb('0x9')][_0x5c6b2b[_0x52eb('0x82')]];this[_0x52eb('0x9')][_0x5c6b2b['transfereeuniqueid']]=_0x296a3b;}}}catch(_0x40c848){logger[_0x52eb('0x39')](_0x52eb('0x87'),_0x5c6b2b[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x40c848,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x52eb('0x1e')]=function(_0x30107f){try{if(this[_0x52eb('0x21')](_0x30107f)){logger[_0x52eb('0x27')](_0x52eb('0x88'),_0x30107f[_0x52eb('0x24')],util['inspect'](_0x30107f,{'showHidden':![],'depth':null}));if(this[_0x52eb('0x9')][_0x30107f['transfereeuniqueid']]){for(var _0x7fd95a in this[_0x52eb('0x9')][_0x30107f[_0x52eb('0x82')]]){if(this[_0x52eb('0x9')][_0x30107f['transfereeuniqueid']][_0x52eb('0x56')](_0x7fd95a)){if(_0x30107f[_0x52eb('0x89')]===_0x7fd95a){logger[_0x52eb('0x22')](_0x52eb('0x8a'),_0x30107f[_0x52eb('0x24')],this[_0x52eb('0x9')][_0x30107f[_0x52eb('0x82')]][_0x7fd95a]['membername'],_0x7fd95a);var _0x3b0de6=moment();this['channels'][_0x30107f[_0x52eb('0x82')]][_0x7fd95a]['agentcomplete']=!![];this[_0x52eb('0x9')][_0x30107f['transfereeuniqueid']][_0x7fd95a][_0x52eb('0x7e')]=_0x3b0de6;this[_0x52eb('0x9')][_0x30107f[_0x52eb('0x82')]][_0x7fd95a][_0x52eb('0x51')]='complete';this[_0x52eb('0x9')][_0x30107f['transfereeuniqueid']][_0x7fd95a]['reason']=_0x52eb('0x5d');this[_0x52eb('0x9')][_0x30107f[_0x52eb('0x82')]][_0x7fd95a][_0x52eb('0x5e')]=_0x3b0de6['diff'](this['channels'][_0x30107f[_0x52eb('0x82')]][_0x7fd95a][_0x52eb('0x3e')],_0x52eb('0x85'));}}}}}}catch(_0x5239c4){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x30107f[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x5239c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x19')]=function(_0x43e7eb){var _0x52238f='';try{if(this['isNotNull'](_0x43e7eb)){logger[_0x52eb('0x27')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x43e7eb[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x43e7eb,{'showHidden':![],'depth':null}));if(_0x43e7eb[_0x52eb('0x8b')]){_0x52238f=_0x43e7eb['channel'][_0x52eb('0x8c')](0x0,_0x43e7eb['channel'][_0x52eb('0x8d')]('-'));if(this[_0x52eb('0xa')][_0x52238f]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x43e7eb[_0x52eb('0x24')],_0x52238f);this[_0x52eb('0xa')][_0x52238f][_0x52eb('0x8e')]=!![];}}}}catch(_0x583145){logger['error'](_0x52eb('0x8f'),_0x43e7eb[_0x52eb('0x24')],util['inspect'](_0x583145,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x52eb('0x1f')][_0x52eb('0x1a')]=function(_0x1d5e5b){var _0x24f530='';try{if(this[_0x52eb('0x21')](_0x1d5e5b)){logger[_0x52eb('0x27')](_0x52eb('0x90'),_0x1d5e5b[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x1d5e5b,{'showHidden':![],'depth':null}));if(_0x1d5e5b[_0x52eb('0x8b')]){_0x24f530=_0x1d5e5b['channel']['substring'](0x0,_0x1d5e5b['channel']['lastIndexOf']('-'));if(this[_0x52eb('0xa')][_0x24f530]){logger[_0x52eb('0x22')](_0x52eb('0x91'),_0x1d5e5b['uniqueid'],_0x24f530);this[_0x52eb('0xa')][_0x24f530][_0x52eb('0x8e')]=![];}}}}catch(_0x5152da){logger[_0x52eb('0x39')](_0x52eb('0x92'),_0x1d5e5b[_0x52eb('0x24')],util[_0x52eb('0x29')](_0x5152da,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xfd49=['rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','ami','../ami','defaults','redis','socket.io-emitter','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','inspect','channels','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','hasOwnProperty','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss'];(function(_0x247ca4,_0x1e7ec5){var _0x432c92=function(_0x5d5de1){while(--_0x5d5de1){_0x247ca4['push'](_0x247ca4['shift']());}};_0x432c92(++_0x1e7ec5);}(_0xfd49,0x15b));var _0x9fd4=function(_0x451438,_0x52c4c3){_0x451438=_0x451438-0x0;var _0x435d62=_0xfd49[_0x451438];return _0x435d62;};'use strict';var _=require(_0x9fd4('0x0'));var moment=require(_0x9fd4('0x1'));var util=require(_0x9fd4('0x2'));var Redis=require(_0x9fd4('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x9fd4('0x4'));var ami=require(_0x9fd4('0x5'));config['redis']=_[_0x9fd4('0x6')](config[_0x9fd4('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x9fd4('0x8'))(new Redis(config[_0x9fd4('0x7')]));function VoiceAgentReport(_0x1d6e33){this['channels']={};this[_0x9fd4('0x9')]=_0x1d6e33[_0x9fd4('0x9')];this[_0x9fd4('0xa')]=_0x1d6e33[_0x9fd4('0xa')];this[_0x9fd4('0xb')]={};ami['on'](_0x9fd4('0xc'),this['syncAgentCalled'][_0x9fd4('0xd')](this));ami['on'](_0x9fd4('0xe'),this[_0x9fd4('0xf')][_0x9fd4('0xd')](this));ami['on']('agentringnoanswer',this[_0x9fd4('0x10')][_0x9fd4('0xd')](this));ami['on']('queuecallerabandon',this[_0x9fd4('0x11')][_0x9fd4('0xd')](this));ami['on'](_0x9fd4('0x12'),this[_0x9fd4('0x13')][_0x9fd4('0xd')](this));ami['on'](_0x9fd4('0x14'),this[_0x9fd4('0x15')][_0x9fd4('0xd')](this));ami['on'](_0x9fd4('0x16'),this[_0x9fd4('0x17')]['bind'](this));ami['on'](_0x9fd4('0x18'),this[_0x9fd4('0x19')][_0x9fd4('0xd')](this));ami['on']('musiconholdstop',this[_0x9fd4('0x1a')][_0x9fd4('0xd')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x9fd4('0x1b'),this[_0x9fd4('0x1c')][_0x9fd4('0xd')](this));}VoiceAgentReport['prototype']['emit']=function(_0x6a361,_0x4d41cc,_0x3cbe05){io['to'](_0x6a361)[_0x9fd4('0x1d')](_0x4d41cc,_0x3cbe05);};VoiceAgentReport[_0x9fd4('0x1e')][_0x9fd4('0x1f')]=function(_0x55f0ae){return _0x55f0ae!==null&&!_[_0x9fd4('0x20')](_0x55f0ae);};VoiceAgentReport[_0x9fd4('0x1e')][_0x9fd4('0x21')]=function(_0x25628c){try{if(this[_0x9fd4('0x1f')](_0x25628c)){logger[_0x9fd4('0x22')](_0x9fd4('0x23'),_0x25628c[_0x9fd4('0x24')],_0x25628c[_0x9fd4('0x25')],_0x25628c['destuniqueid']);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20event:',_0x25628c[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x25628c,{'showHidden':![],'depth':null}));if(_[_0x9fd4('0x20')](this['channels'][_0x25628c[_0x9fd4('0x24')]])){this[_0x9fd4('0x27')][_0x25628c[_0x9fd4('0x24')]]={};}if(_[_0x9fd4('0x20')](this[_0x9fd4('0x27')][_0x25628c['uniqueid']][_0x25628c[_0x9fd4('0x28')]])){this[_0x9fd4('0x27')][_0x25628c[_0x9fd4('0x24')]][_0x25628c['destuniqueid']]={'agentcalledAt':moment()[_0x9fd4('0x29')](_0x9fd4('0x2a')),'lastevent':_0x9fd4('0x2b'),'mandatoryDisposition':this[_0x9fd4('0x9')][_0x25628c['queue']]?this[_0x9fd4('0x9')][_0x25628c['queue']]['mandatoryDisposition']||![]:![],'type':this[_0x9fd4('0x9')][_0x25628c['queue']]?this['voiceQueues'][_0x25628c[_0x9fd4('0x2c')]]['type']||_0x9fd4('0x2d'):'inbound','variables':this[_0x9fd4('0xb')][_0x25628c[_0x9fd4('0x24')]]};}_[_0x9fd4('0x2e')](this[_0x9fd4('0x27')][_0x25628c[_0x9fd4('0x24')]][_0x25628c[_0x9fd4('0x28')]],_[_0x9fd4('0x2f')](_0x25628c,[_0x9fd4('0x30'),_0x9fd4('0x31')]));logger[_0x9fd4('0x32')](_0x9fd4('0x33'),_0x25628c[_0x9fd4('0x24')],util[_0x9fd4('0x26')](this['channels'][_0x25628c[_0x9fd4('0x24')]][_0x25628c[_0x9fd4('0x28')]],{'showHidden':![],'depth':null}));ami[_0x9fd4('0x1d')](_0x9fd4('0x34'),this['channels'][_0x25628c[_0x9fd4('0x24')]][_0x25628c['destuniqueid']]);logger[_0x9fd4('0x32')](_0x9fd4('0x35'),_0x25628c[_0x9fd4('0x24')],util['inspect'](this[_0x9fd4('0x27')][_0x25628c[_0x9fd4('0x24')]][_0x25628c[_0x9fd4('0x28')]],{'showHidden':![],'depth':null}));this[_0x9fd4('0x1d')](util[_0x9fd4('0x29')](_0x9fd4('0x36'),_0x25628c[_0x9fd4('0x25')]),_0x9fd4('0x37'),this[_0x9fd4('0x27')][_0x25628c[_0x9fd4('0x24')]][_0x25628c[_0x9fd4('0x28')]]);}}catch(_0x1fe168){logger[_0x9fd4('0x38')](_0x9fd4('0x39'),_0x25628c[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x1fe168,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9fd4('0x1e')]['syncAgentConnect']=function(_0x498b3f){try{if(this[_0x9fd4('0x1f')](_0x498b3f)){if(this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]]){logger['debug'](_0x9fd4('0x3a'),_0x498b3f[_0x9fd4('0x24')],util['inspect'](_0x498b3f,{'showHidden':![],'depth':null}));for(var _0x89cd08 in this['channels'][_0x498b3f[_0x9fd4('0x24')]]){if(this[_0x9fd4('0x27')][_0x498b3f['uniqueid']]['hasOwnProperty'](_0x89cd08)){if(_0x498b3f[_0x9fd4('0x28')]===_0x89cd08){logger[_0x9fd4('0x22')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x498b3f[_0x9fd4('0x24')],_0x498b3f[_0x9fd4('0x25')],_0x498b3f[_0x9fd4('0x28')]);this[_0x9fd4('0x27')][_0x498b3f['uniqueid']][_0x89cd08][_0x9fd4('0x3b')]=moment()[_0x9fd4('0x29')](_0x9fd4('0x2a'));this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x3c')]=_0x498b3f[_0x9fd4('0x3c')];this['channels'][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08]['connectedlinenum']=_0x498b3f['connectedlinenum'];this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x3d')]=_0x498b3f['destchannelstate'];this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08]['destchannelstatedesc']=_0x498b3f[_0x9fd4('0x3e')];this['channels'][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08]['holdtime']=_0x498b3f[_0x9fd4('0x3f')];this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08]['lastevent']=_0x9fd4('0x40');_[_0x9fd4('0x2e')](this[_0x9fd4('0xa')][_0x498b3f[_0x9fd4('0x41')]],_[_0x9fd4('0x42')](_0x498b3f,[_0x9fd4('0x2c'),_0x9fd4('0x43')]));logger['debug'](_0x9fd4('0x44'),_0x498b3f[_0x9fd4('0x24')],util[_0x9fd4('0x26')](this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x498b3f[_0x9fd4('0x28')]],{'showHidden':![],'depth':null}));ami[_0x9fd4('0x1d')](_0x9fd4('0x45'),this['channels'][_0x498b3f[_0x9fd4('0x24')]][_0x498b3f['destuniqueid']]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x498b3f[_0x9fd4('0x24')],util[_0x9fd4('0x26')](this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x498b3f[_0x9fd4('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9fd4('0x29')](_0x9fd4('0x36'),_0x498b3f[_0x9fd4('0x25')]),'user:agentconnect',this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x498b3f['destuniqueid']]);}else if(!this['channels'][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x46')]&&!this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x498b3f['uniqueid'],this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08]['membername'],_0x89cd08);this['channels'][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x46')]=!![];this['channels'][_0x498b3f['uniqueid']][_0x89cd08][_0x9fd4('0x47')]=moment()[_0x9fd4('0x29')](_0x9fd4('0x2a'));this['channels'][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x48')]=_0x498b3f[_0x9fd4('0x28')];this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x49')]=_0x498b3f[_0x9fd4('0x25')];this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08][_0x9fd4('0x4a')]='answered_elsewhere';this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08]['reason']=_0x9fd4('0x4b');logger[_0x9fd4('0x32')](_0x9fd4('0x4c'),_0x498b3f[_0x9fd4('0x24')],util['inspect'](this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08],{'showHidden':![],'depth':null}));ami[_0x9fd4('0x1d')](_0x9fd4('0x4d'),this[_0x9fd4('0x27')][_0x498b3f[_0x9fd4('0x24')]][_0x89cd08]);}}}}}}catch(_0x1193a6){logger[_0x9fd4('0x38')](_0x9fd4('0x4e'),_0x498b3f[_0x9fd4('0x24')],util['inspect'](_0x1193a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9fd4('0x1e')][_0x9fd4('0x10')]=function(_0x2bdb9d){try{if(this['isNotNull'](_0x2bdb9d)){logger[_0x9fd4('0x32')](_0x9fd4('0x4f'),_0x2bdb9d['uniqueid'],util[_0x9fd4('0x26')](_0x2bdb9d,{'showHidden':![],'depth':null}));if(this[_0x9fd4('0x27')][_0x2bdb9d[_0x9fd4('0x24')]]&&this['channels'][_0x2bdb9d[_0x9fd4('0x24')]][_0x2bdb9d['destuniqueid']]){logger[_0x9fd4('0x22')](_0x9fd4('0x50'),_0x2bdb9d[_0x9fd4('0x24')],_0x2bdb9d['membername'],_0x2bdb9d['destuniqueid']);this[_0x9fd4('0x27')][_0x2bdb9d['uniqueid']][_0x2bdb9d[_0x9fd4('0x28')]][_0x9fd4('0x46')]=!![];this[_0x9fd4('0x27')][_0x2bdb9d[_0x9fd4('0x24')]][_0x2bdb9d['destuniqueid']]['agentringnoanswerAt']=moment()[_0x9fd4('0x29')](_0x9fd4('0x2a'));this[_0x9fd4('0x27')][_0x2bdb9d[_0x9fd4('0x24')]][_0x2bdb9d[_0x9fd4('0x28')]][_0x9fd4('0x4a')]=_0x9fd4('0x51');this[_0x9fd4('0x27')][_0x2bdb9d[_0x9fd4('0x24')]][_0x2bdb9d[_0x9fd4('0x28')]][_0x9fd4('0x52')]=_0x9fd4('0x51');logger[_0x9fd4('0x32')](_0x9fd4('0x53'),_0x2bdb9d[_0x9fd4('0x24')],util[_0x9fd4('0x26')](this[_0x9fd4('0x27')][_0x2bdb9d[_0x9fd4('0x24')]][_0x2bdb9d[_0x9fd4('0x28')]],{'showHidden':![],'depth':null}));ami[_0x9fd4('0x1d')]('custom:agentringnoanswer',this[_0x9fd4('0x27')][_0x2bdb9d[_0x9fd4('0x24')]][_0x2bdb9d[_0x9fd4('0x28')]]);}}}catch(_0xc60961){logger[_0x9fd4('0x38')](_0x9fd4('0x54'),_0x2bdb9d[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0xc60961,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9fd4('0x1e')][_0x9fd4('0x11')]=function(_0x4cbc0f){try{if(this[_0x9fd4('0x1f')](_0x4cbc0f)){logger[_0x9fd4('0x32')](_0x9fd4('0x55'),_0x4cbc0f[_0x9fd4('0x24')],util['inspect'](_0x4cbc0f,{'showHidden':![],'depth':null}));if(this[_0x9fd4('0x27')][_0x4cbc0f[_0x9fd4('0x24')]]){for(var _0x2e22ab in this['channels'][_0x4cbc0f[_0x9fd4('0x24')]]){if(this[_0x9fd4('0x27')][_0x4cbc0f[_0x9fd4('0x24')]]['hasOwnProperty'](_0x2e22ab)&&!this[_0x9fd4('0x27')][_0x4cbc0f[_0x9fd4('0x24')]][_0x2e22ab]['agentringnoanswer']&&!this[_0x9fd4('0x27')][_0x4cbc0f['uniqueid']][_0x2e22ab][_0x9fd4('0x12')]){logger[_0x9fd4('0x22')](_0x9fd4('0x56'),_0x4cbc0f['uniqueid'],this[_0x9fd4('0x27')][_0x4cbc0f[_0x9fd4('0x24')]][_0x2e22ab][_0x9fd4('0x25')],_0x2e22ab);this['channels'][_0x4cbc0f[_0x9fd4('0x24')]][_0x2e22ab]['agentringnoanswer']=!![];this['channels'][_0x4cbc0f[_0x9fd4('0x24')]][_0x2e22ab][_0x9fd4('0x47')]=moment()[_0x9fd4('0x29')](_0x9fd4('0x2a'));this[_0x9fd4('0x27')][_0x4cbc0f['uniqueid']][_0x2e22ab][_0x9fd4('0x4a')]=_0x9fd4('0x57');this[_0x9fd4('0x27')][_0x4cbc0f[_0x9fd4('0x24')]][_0x2e22ab][_0x9fd4('0x52')]=_0x9fd4('0x57');logger['debug'](_0x9fd4('0x58'),_0x4cbc0f[_0x9fd4('0x24')],util['inspect'](this['channels'][_0x4cbc0f[_0x9fd4('0x24')]][_0x2e22ab],{'showHidden':![],'depth':null}));ami['emit'](_0x9fd4('0x59'),this[_0x9fd4('0x27')][_0x4cbc0f[_0x9fd4('0x24')]][_0x2e22ab]);}}}}}catch(_0x172803){logger[_0x9fd4('0x38')]('[%s][voiceAgentReport][queuecallerabandon]',_0x4cbc0f[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x172803,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9fd4('0x13')]=function(_0xdb28c){try{if(this[_0x9fd4('0x1f')](_0xdb28c)){logger[_0x9fd4('0x32')](_0x9fd4('0x5a'),_0xdb28c[_0x9fd4('0x24')],util['inspect'](_0xdb28c,{'showHidden':![],'depth':null}));if(this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]]){for(var _0x282fc8 in this['channels'][_0xdb28c['uniqueid']]){if(this['channels'][_0xdb28c[_0x9fd4('0x24')]]['hasOwnProperty'](_0x282fc8)){if(this[_0x9fd4('0x27')][_0xdb28c['uniqueid']][_0x282fc8]['agentconnectAt']&&!this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8][_0x9fd4('0x12')]){logger[_0x9fd4('0x22')](_0x9fd4('0x5b'),_0xdb28c['uniqueid'],this['channels'][_0xdb28c['uniqueid']][_0x282fc8][_0x9fd4('0x25')],_0x282fc8);this[_0x9fd4('0x27')][_0xdb28c['uniqueid']][_0x282fc8][_0x9fd4('0x12')]=!![];this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8][_0x9fd4('0x5c')]=moment()[_0x9fd4('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8]['lastevent']=_0x9fd4('0x5d');this[_0x9fd4('0x27')][_0xdb28c['uniqueid']][_0x282fc8][_0x9fd4('0x52')]=_0xdb28c['reason']==_0x9fd4('0x5e')?'agent':_0xdb28c[_0x9fd4('0x52')];this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8][_0x9fd4('0x5f')]=_0xdb28c[_0x9fd4('0x5f')];if(this['voiceQueues'][_0xdb28c[_0x9fd4('0x2c')]]&&this[_0x9fd4('0x9')][_0xdb28c[_0x9fd4('0x2c')]][_0x9fd4('0x60')]){this['channels'][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8][_0x9fd4('0x61')]=this[_0x9fd4('0x9')][_0xdb28c[_0x9fd4('0x2c')]][_0x9fd4('0x62')];this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8]['agentacw']=!![];}this['agents'][_0xdb28c[_0x9fd4('0x41')]]=_['omit'](this[_0x9fd4('0xa')][_0xdb28c[_0x9fd4('0x41')]],['queue',_0x9fd4('0x43')]);logger[_0x9fd4('0x32')](_0x9fd4('0x63'),_0xdb28c[_0x9fd4('0x24')],util['inspect'](this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8],{'showHidden':![],'depth':null}));ami['emit'](_0x9fd4('0x64'),this[_0x9fd4('0x27')][_0xdb28c['uniqueid']][_0x282fc8]);logger[_0x9fd4('0x32')](_0x9fd4('0x65'),_0xdb28c[_0x9fd4('0x24')],util[_0x9fd4('0x26')](this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8],{'showHidden':![],'depth':null}));this[_0x9fd4('0x1d')](util[_0x9fd4('0x29')](_0x9fd4('0x36'),_0xdb28c[_0x9fd4('0x25')]),'user:agentcomplete',this[_0x9fd4('0x27')][_0xdb28c[_0x9fd4('0x24')]][_0x282fc8]);}}}}}}catch(_0x1c5291){logger[_0x9fd4('0x38')](_0x9fd4('0x66'),_0xdb28c[_0x9fd4('0x24')],util['inspect'](_0x1c5291,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9fd4('0x15')]=function(_0x432d71){try{if(this[_0x9fd4('0x1f')](_0x432d71)){logger['debug'](_0x9fd4('0x67'),_0x432d71[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x432d71,{'showHidden':![],'depth':null}));this[_0x9fd4('0x68')](_0x432d71[_0x9fd4('0x24')],_['keys'](_0x432d71['variable'])[0x0],_0x432d71['value']);if(this[_0x9fd4('0x27')][_0x432d71[_0x9fd4('0x24')]]){for(var _0x4ab635 in this['channels'][_0x432d71[_0x9fd4('0x24')]]){if(this[_0x9fd4('0x27')][_0x432d71[_0x9fd4('0x24')]][_0x9fd4('0x69')](_0x4ab635)){logger[_0x9fd4('0x22')](_0x9fd4('0x6a'),_0x432d71['uniqueid'],_0x4ab635,_['keys'](_0x432d71[_0x9fd4('0x6b')])[0x0],_0x432d71[_0x9fd4('0x6c')]);if(_[_0x9fd4('0x20')](this[_0x9fd4('0x27')][_0x432d71[_0x9fd4('0x24')]][_0x4ab635][_0x9fd4('0xb')])){this[_0x9fd4('0x27')][_0x432d71[_0x9fd4('0x24')]][_0x4ab635]['variables']={};}this[_0x9fd4('0x27')][_0x432d71[_0x9fd4('0x24')]][_0x4ab635][_0x9fd4('0xb')]=this['variables'][_0x432d71['uniqueid']];}}}}}catch(_0x214bf2){logger['error'](_0x9fd4('0x6d'),_0x432d71[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x214bf2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x457224,_0x2cfccd,_0x5dfd45){var _0x4ee53b=[_0x9fd4('0x6e'),_0x9fd4('0x6f'),_0x9fd4('0x70'),_0x9fd4('0x71'),_0x9fd4('0x72'),_0x9fd4('0x73'),_0x9fd4('0x74'),_0x9fd4('0x75'),_0x9fd4('0x76'),_0x9fd4('0x77'),_0x9fd4('0x78'),_0x9fd4('0x79'),'membercalls',_0x9fd4('0x7a'),_0x9fd4('0x7b'),'memberlastcall',_0x9fd4('0x25'),'memberpenalty',_0x9fd4('0x7c')];if(!_[_0x9fd4('0x7d')](_0x2cfccd)&&!_[_0x9fd4('0x7e')](_0x4ee53b,_0x2cfccd)){if(_[_0x9fd4('0x20')](this[_0x9fd4('0xb')][_0x457224])){this[_0x9fd4('0xb')][_0x457224]={};}this['variables'][_0x457224][_0x2cfccd]=_0x5dfd45;}};VoiceAgentReport[_0x9fd4('0x1e')]['syncHangup']=function(_0x3e0d79){try{if(this[_0x9fd4('0x1f')](_0x3e0d79)){logger['debug'](_0x9fd4('0x7f'),_0x3e0d79['uniqueid'],util[_0x9fd4('0x26')](_0x3e0d79,{'showHidden':![],'depth':null}));if(this['channels'][_0x3e0d79[_0x9fd4('0x24')]]){for(var _0x208cb8 in this[_0x9fd4('0x27')][_0x3e0d79[_0x9fd4('0x24')]]){if(this['channels'][_0x3e0d79[_0x9fd4('0x24')]][_0x9fd4('0x69')](_0x208cb8)){if(this[_0x9fd4('0x27')][_0x3e0d79[_0x9fd4('0x24')]][_0x208cb8][_0x9fd4('0x52')]==_0x9fd4('0x5e')&&this[_0x9fd4('0x27')][_0x3e0d79[_0x9fd4('0x24')]][_0x208cb8][_0x9fd4('0x12')]){logger['info'](_0x9fd4('0x80'),_0x3e0d79[_0x9fd4('0x24')],_0x208cb8);this[_0x9fd4('0x27')][_0x3e0d79[_0x9fd4('0x24')]][_0x208cb8][_0x9fd4('0x5c')]=moment()[_0x9fd4('0x29')](_0x9fd4('0x2a'));}}}logger[_0x9fd4('0x32')](_0x9fd4('0x81'),_0x3e0d79[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_[_0x9fd4('0x82')](this[_0x9fd4('0x27')][_0x3e0d79[_0x9fd4('0x24')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x9fd4('0x83'),_[_0x9fd4('0x82')](this[_0x9fd4('0x27')][_0x3e0d79[_0x9fd4('0x24')]]));delete this[_0x9fd4('0x27')][_0x3e0d79[_0x9fd4('0x24')]];}if(this[_0x9fd4('0xb')][_0x3e0d79[_0x9fd4('0x24')]]){delete this[_0x9fd4('0xb')][_0x3e0d79[_0x9fd4('0x24')]];}}}catch(_0x5436c8){logger[_0x9fd4('0x38')](_0x9fd4('0x84'),_0x3e0d79[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x5436c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9fd4('0x1e')][_0x9fd4('0x85')]=function(_0x57dd46){try{if(this[_0x9fd4('0x1f')](_0x57dd46)){logger['debug'](_0x9fd4('0x86'),_0x57dd46['uniqueid'],util[_0x9fd4('0x26')](_0x57dd46,{'showHidden':![],'depth':null}));if(this['channels'][_0x57dd46[_0x9fd4('0x87')]]){for(var _0xd29e9b in this[_0x9fd4('0x27')][_0x57dd46[_0x9fd4('0x87')]]){if(this[_0x9fd4('0x27')][_0x57dd46[_0x9fd4('0x87')]][_0x9fd4('0x69')](_0xd29e9b)){if(_0x57dd46[_0x9fd4('0x88')]===_0xd29e9b){logger[_0x9fd4('0x22')](_0x9fd4('0x89'),_0x57dd46[_0x9fd4('0x24')],this['channels'][_0x57dd46['transfereeuniqueid']][_0xd29e9b][_0x9fd4('0x25')],_0xd29e9b);var _0x502fde=moment();this['channels'][_0x57dd46[_0x9fd4('0x87')]][_0xd29e9b][_0x9fd4('0x12')]=!![];this[_0x9fd4('0x27')][_0x57dd46['transfereeuniqueid']][_0xd29e9b][_0x9fd4('0x5c')]=moment()[_0x9fd4('0x29')](_0x9fd4('0x2a'));this['channels'][_0x57dd46[_0x9fd4('0x87')]][_0xd29e9b][_0x9fd4('0x4a')]=_0x9fd4('0x5d');this['channels'][_0x57dd46[_0x9fd4('0x87')]][_0xd29e9b][_0x9fd4('0x52')]=_0x9fd4('0x5e');this['channels'][_0x57dd46['transfereeuniqueid']][_0xd29e9b]['talktime']=_0x502fde['diff'](this['channels'][_0x57dd46[_0x9fd4('0x87')]][_0xd29e9b][_0x9fd4('0x3b')],'seconds');}}}}if(this[_0x9fd4('0x27')][_0x57dd46[_0x9fd4('0x8a')]]){var _0x6735fc=this[_0x9fd4('0x27')][_0x57dd46['secondtransfereruniqueid']];this[_0x9fd4('0x27')][_0x57dd46[_0x9fd4('0x8a')]]=this['channels'][_0x57dd46[_0x9fd4('0x87')]];this[_0x9fd4('0x27')][_0x57dd46[_0x9fd4('0x87')]]=_0x6735fc;}}}catch(_0x554f14){logger[_0x9fd4('0x38')](_0x9fd4('0x8b'),_0x57dd46[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x554f14,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9fd4('0x1e')][_0x9fd4('0x1c')]=function(_0x1533bc){try{if(this[_0x9fd4('0x1f')](_0x1533bc)){logger[_0x9fd4('0x32')](_0x9fd4('0x8c'),_0x1533bc[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x1533bc,{'showHidden':![],'depth':null}));if(this[_0x9fd4('0x27')][_0x1533bc[_0x9fd4('0x87')]]){for(var _0x587230 in this['channels'][_0x1533bc[_0x9fd4('0x87')]]){if(this['channels'][_0x1533bc['transfereeuniqueid']][_0x9fd4('0x69')](_0x587230)){if(_0x1533bc[_0x9fd4('0x8d')]===_0x587230){logger[_0x9fd4('0x22')](_0x9fd4('0x8e'),_0x1533bc[_0x9fd4('0x24')],this[_0x9fd4('0x27')][_0x1533bc['transfereeuniqueid']][_0x587230][_0x9fd4('0x25')],_0x587230);var _0x138e24=moment();this[_0x9fd4('0x27')][_0x1533bc['transfereeuniqueid']][_0x587230][_0x9fd4('0x12')]=!![];this['channels'][_0x1533bc['transfereeuniqueid']][_0x587230]['agentcompleteAt']=_0x138e24;this[_0x9fd4('0x27')][_0x1533bc['transfereeuniqueid']][_0x587230][_0x9fd4('0x4a')]='complete';this[_0x9fd4('0x27')][_0x1533bc[_0x9fd4('0x87')]][_0x587230][_0x9fd4('0x52')]=_0x9fd4('0x5e');this[_0x9fd4('0x27')][_0x1533bc[_0x9fd4('0x87')]][_0x587230]['talktime']=_0x138e24[_0x9fd4('0x8f')](this['channels'][_0x1533bc[_0x9fd4('0x87')]][_0x587230]['agentconnectAt'],'seconds');}}}}}}catch(_0x39a7b1){logger[_0x9fd4('0x38')](_0x9fd4('0x90'),_0x1533bc[_0x9fd4('0x24')],util['inspect'](_0x39a7b1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9fd4('0x1e')]['syncMusicOnHoldStart']=function(_0x3899e7){var _0x158384='';try{if(this[_0x9fd4('0x1f')](_0x3899e7)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x3899e7[_0x9fd4('0x24')],util['inspect'](_0x3899e7,{'showHidden':![],'depth':null}));if(_0x3899e7[_0x9fd4('0x91')]){_0x158384=_0x3899e7[_0x9fd4('0x91')][_0x9fd4('0x92')](0x0,_0x3899e7['channel'][_0x9fd4('0x93')]('-'));if(this['agents'][_0x158384]){logger['info'](_0x9fd4('0x94'),_0x3899e7['uniqueid'],_0x158384);this[_0x9fd4('0xa')][_0x158384][_0x9fd4('0x95')]=!![];}}}}catch(_0x482719){logger[_0x9fd4('0x38')](_0x9fd4('0x96'),_0x3899e7[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x482719,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9fd4('0x1e')][_0x9fd4('0x1a')]=function(_0x53a86c){var _0x4ee50a='';try{if(this[_0x9fd4('0x1f')](_0x53a86c)){logger[_0x9fd4('0x32')](_0x9fd4('0x97'),_0x53a86c[_0x9fd4('0x24')],util['inspect'](_0x53a86c,{'showHidden':![],'depth':null}));if(_0x53a86c[_0x9fd4('0x91')]){_0x4ee50a=_0x53a86c[_0x9fd4('0x91')][_0x9fd4('0x92')](0x0,_0x53a86c[_0x9fd4('0x91')][_0x9fd4('0x93')]('-'));if(this['agents'][_0x4ee50a]){logger[_0x9fd4('0x22')](_0x9fd4('0x98'),_0x53a86c[_0x9fd4('0x24')],_0x4ee50a);this[_0x9fd4('0xa')][_0x4ee50a][_0x9fd4('0x95')]=![];}}}}catch(_0x34e2ce){logger[_0x9fd4('0x38')](_0x9fd4('0x99'),_0x53a86c[_0x9fd4('0x24')],util[_0x9fd4('0x26')](_0x34e2ce,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index d01d4dd..5cd7b07 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 _0xdf0c=['../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','playback','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','emit','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','pick','keys','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','disposition','toNumber','channelstate','from-sip','channel','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','lastdata','startsWith','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%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','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','user:agentcomplete','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','extension','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami'];(function(_0xb2b8ae,_0x28e563){var _0x300208=function(_0xd9ffd0){while(--_0xd9ffd0){_0xb2b8ae['push'](_0xb2b8ae['shift']());}};_0x300208(++_0x28e563);}(_0xdf0c,0x16d));var _0xcdf0=function(_0x21923b,_0x44380f){_0x21923b=_0x21923b-0x0;var _0x3ff466=_0xdf0c[_0x21923b];return _0x3ff466;};'use strict';var BPromise=require(_0xcdf0('0x0'));var _=require(_0xcdf0('0x1'));var moment=require(_0xcdf0('0x2'));var util=require(_0xcdf0('0x3'));var path=require(_0xcdf0('0x4'));var Redis=require(_0xcdf0('0x5'));var config=require(_0xcdf0('0x6'));var logger=require(_0xcdf0('0x7'))('ami');var ami=require(_0xcdf0('0x8'));var Channel=require(_0xcdf0('0x9'));var statusDesc=[_0xcdf0('0xa'),_0xcdf0('0xb'),'inuse',_0xcdf0('0xc'),_0xcdf0('0xd'),_0xcdf0('0xe'),_0xcdf0('0xf'),_0xcdf0('0x10'),_0xcdf0('0x11')];var applications=[_0xcdf0('0x12'),_0xcdf0('0x13'),'agi','dial',_0xcdf0('0x14'),'voicemail'];var dispositions=[_0xcdf0('0x15'),_0xcdf0('0x16'),'FAILED',_0xcdf0('0x15'),_0xcdf0('0x15'),_0xcdf0('0x15'),_0xcdf0('0x17'),'BUSY',_0xcdf0('0x16'),_0xcdf0('0x16'),_0xcdf0('0x16')];var actions={};config['redis']=_[_0xcdf0('0x18')](config[_0xcdf0('0x19')],{'host':_0xcdf0('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcdf0('0x19')]));function VoiceCallReport(_0x42f3a0){this[_0xcdf0('0x1b')]=_0x42f3a0[_0xcdf0('0x1b')];this[_0xcdf0('0x1c')]=_0x42f3a0[_0xcdf0('0x1c')];this['blindTransfers']={};ami['on'](_0xcdf0('0x1d'),this[_0xcdf0('0x1e')]['bind'](this));ami['on']('newexten',this[_0xcdf0('0x1e')][_0xcdf0('0x1f')](this));ami['on'](_0xcdf0('0x20'),this[_0xcdf0('0x21')][_0xcdf0('0x1f')](this));ami['on'](_0xcdf0('0x22'),this[_0xcdf0('0x23')][_0xcdf0('0x1f')](this));ami['on'](_0xcdf0('0x24'),this[_0xcdf0('0x25')][_0xcdf0('0x1f')](this));ami['on']('hangup',this[_0xcdf0('0x26')]['bind'](this));ami['on'](_0xcdf0('0x27'),this[_0xcdf0('0x28')][_0xcdf0('0x1f')](this));ami['on']('attendedtransfer',this[_0xcdf0('0x29')]['bind'](this));ami['on']('blindtransfer',this[_0xcdf0('0x2a')][_0xcdf0('0x1f')](this));ami['on'](_0xcdf0('0x2b'),this[_0xcdf0('0x2c')][_0xcdf0('0x1f')](this));ami['on']('musiconholdstop',this[_0xcdf0('0x2d')][_0xcdf0('0x1f')](this));try{logger[_0xcdf0('0x2e')](_0xcdf0('0x2f'));ami[_0xcdf0('0x30')]();}catch(_0x39fca7){logger[_0xcdf0('0x31')](_0xcdf0('0x32'),util[_0xcdf0('0x33')](_0x39fca7,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xcdf0('0x34')]=function(_0x515039){return _0x515039!==null&&!_[_0xcdf0('0x35')](_0x515039);};VoiceCallReport['prototype'][_0xcdf0('0x36')]=function(_0x18d335,_0x533b00,_0x560fe2){io['to'](_0x18d335)[_0xcdf0('0x36')](_0x533b00,_0x560fe2);};VoiceCallReport[_0xcdf0('0x37')][_0xcdf0('0x28')]=function(_0x46041e){try{if(this[_0xcdf0('0x34')](_0x46041e)){logger[_0xcdf0('0x2e')](_0xcdf0('0x38'),_0x46041e['uniqueid'],_0x46041e[_0xcdf0('0x39')],_0x46041e[_0xcdf0('0x3a')]);logger[_0xcdf0('0x3b')](_0xcdf0('0x3c'),_0x46041e[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x46041e,{'showHidden':![],'depth':null}));if(_0x46041e['uniqueid']===_0x46041e[_0xcdf0('0x3e')]){if(!_[_0xcdf0('0x35')](this['channels'][_0x46041e['uniqueid']])){_['merge'](this[_0xcdf0('0x1b')][_0x46041e[_0xcdf0('0x3d')]],_[_0xcdf0('0x3f')](_0x46041e,_[_0xcdf0('0x40')](this['channels'][_0x46041e[_0xcdf0('0x3d')]])));}}}}catch(_0x3fe6ea){logger['error']('[%s][voiceCallReport][newcallerid]',_0x46041e[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x3fe6ea,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')][_0xcdf0('0x21')]=function(_0x59b9ef){try{if(this[_0xcdf0('0x34')](_0x59b9ef)){logger[_0xcdf0('0x3b')]('[%s][voiceCallReport][newchannel]\x20event:',_0x59b9ef[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x59b9ef,{'showHidden':![],'depth':null}));if(_0x59b9ef[_0xcdf0('0x3d')]===_0x59b9ef[_0xcdf0('0x3e')]&&_0x59b9ef['channel']!=_0xcdf0('0x41')){if(_[_0xcdf0('0x35')](this[_0xcdf0('0x1b')][_0x59b9ef[_0xcdf0('0x3d')]])){logger['info'](_0xcdf0('0x42'),_0x59b9ef[_0xcdf0('0x3d')],_0x59b9ef[_0xcdf0('0x43')],_0x59b9ef['exten']);this[_0xcdf0('0x1b')][_0x59b9ef[_0xcdf0('0x3d')]]=new Channel();this['channels'][_0x59b9ef[_0xcdf0('0x3d')]][_0xcdf0('0x44')]=moment()[_0xcdf0('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcdf0('0x1b')][_0x59b9ef[_0xcdf0('0x3d')]][_0xcdf0('0x46')]=dispositions[_[_0xcdf0('0x47')](_0x59b9ef[_0xcdf0('0x48')])];_['merge'](this[_0xcdf0('0x1b')][_0x59b9ef[_0xcdf0('0x3d')]],_['pick'](_0x59b9ef,_[_0xcdf0('0x40')](this[_0xcdf0('0x1b')][_0x59b9ef[_0xcdf0('0x3d')]])));if(_0x59b9ef[_0xcdf0('0x43')]===_0xcdf0('0x49')){if(this[_0xcdf0('0x1c')][_0x59b9ef[_0xcdf0('0x4a')][_0xcdf0('0x4b')]('-')[0x0]]){this[_0xcdf0('0x1c')][_0x59b9ef[_0xcdf0('0x4a')]['split']('-')[0x0]][_0xcdf0('0x4c')]=_0x59b9ef[_0xcdf0('0x4d')];logger[_0xcdf0('0x3b')](_0xcdf0('0x4e'),_0x59b9ef[_0xcdf0('0x3d')],util[_0xcdf0('0x33')]({'destaccountcode':this[_0xcdf0('0x1c')][_0x59b9ef[_0xcdf0('0x4a')]['split']('-')[0x0]][_0xcdf0('0x4f')],'destconnectedlinenum':_0x59b9ef['exten']},{'showHidden':![],'depth':null}));this[_0xcdf0('0x36')](util[_0xcdf0('0x45')]('user:%s',this[_0xcdf0('0x1c')][_0x59b9ef[_0xcdf0('0x4a')]['split']('-')[0x0]][_0xcdf0('0x50')]),_0xcdf0('0x51'),{'destaccountcode':this[_0xcdf0('0x1c')][_0x59b9ef['channel'][_0xcdf0('0x4b')]('-')[0x0]][_0xcdf0('0x4f')],'destconnectedlinenum':_0x59b9ef[_0xcdf0('0x4d')]});}}}}}}catch(_0x476e6c){logger['error']('[%s][voiceCallReport][newchannel]',_0x59b9ef[_0xcdf0('0x3d')],util['inspect'](_0x476e6c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')][_0xcdf0('0x1e')]=function(_0xfa0829){try{if(this[_0xcdf0('0x34')](_0xfa0829)){logger['debug'](_0xcdf0('0x52'),_0xfa0829['uniqueid'],util[_0xcdf0('0x33')](_0xfa0829,{'showHidden':![],'depth':null}));if(_0xfa0829[_0xcdf0('0x3d')]===_0xfa0829['linkedid']&&_0xfa0829['exten']!='h'&&_0xfa0829[_0xcdf0('0x4a')]!='OutgoingSpoolFailed'){_0xfa0829['application']=_0xfa0829[_0xcdf0('0x53')][_0xcdf0('0x54')]();_0xfa0829[_0xcdf0('0x55')]=(_0xfa0829['appdata']||_0xfa0829[_0xcdf0('0x55')])[_0xcdf0('0x54')]();logger[_0xcdf0('0x2e')](_0xcdf0('0x56'),_0xfa0829[_0xcdf0('0x3d')],_0xfa0829['application'],_0xfa0829[_0xcdf0('0x55')]);if(_[_0xcdf0('0x35')](this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]])){this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]]=new Channel();this[_0xcdf0('0x1b')][_0xfa0829['uniqueid']][_0xcdf0('0x44')]=_0xfa0829[_0xcdf0('0x57')]?moment()[_0xcdf0('0x58')](moment[_0xcdf0('0x57')](_0xfa0829[_0xcdf0('0x57')])['seconds'](),_0xcdf0('0x59'))[_0xcdf0('0x45')](_0xcdf0('0x5a')):moment()[_0xcdf0('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]][_0xcdf0('0x46')]=_0xcdf0('0x15');}_['merge'](this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]],_[_0xcdf0('0x3f')](_0xfa0829,_[_0xcdf0('0x40')](this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]])));if(_['includes'](applications,_0xfa0829[_0xcdf0('0x53')])){this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]]['lastapplication']=_0xfa0829[_0xcdf0('0x53')];this['channels'][_0xfa0829[_0xcdf0('0x3d')]][_0xcdf0('0x5b')]=_0xfa0829[_0xcdf0('0x55')];if(_0xfa0829[_0xcdf0('0x53')]===_0xcdf0('0x12')&&_[_0xcdf0('0x5c')](_0xfa0829[_0xcdf0('0x55')],'cdr(')){var _0x29d877=_0xfa0829[_0xcdf0('0x55')][_0xcdf0('0x4b')]('=');var _0x1a6077=_0x29d877[0x0][_0xcdf0('0x5d')](/cdr\((.*)\)/);if(_0x1a6077){this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]][_0x1a6077[0x1]]=_0x29d877[0x1];}}else if(_0xfa0829['application']===_0xcdf0('0x13')){this[_0xcdf0('0x1b')][_0xfa0829[_0xcdf0('0x3d')]][_0xcdf0('0x13')]=_0xfa0829[_0xcdf0('0x55')][_0xcdf0('0x4b')](',')[0x0];}}}}}catch(_0x3097dc){logger[_0xcdf0('0x31')](_0xcdf0('0x5e'),_0xfa0829[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x3097dc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')][_0xcdf0('0x23')]=function(_0x2301ea){try{if(this[_0xcdf0('0x34')](_0x2301ea)){logger[_0xcdf0('0x2e')](_0xcdf0('0x5f'),_0x2301ea[_0xcdf0('0x3d')],_0x2301ea[_0xcdf0('0x3e')],_0x2301ea[_0xcdf0('0x39')],_0x2301ea[_0xcdf0('0x3a')]);logger[_0xcdf0('0x3b')](_0xcdf0('0x60'),_0x2301ea['uniqueid'],util[_0xcdf0('0x33')](_0x2301ea,{'showHidden':![],'depth':null}));if(_0x2301ea[_0xcdf0('0x3d')]!==_0x2301ea[_0xcdf0('0x3e')]){if(this['channels'][_0x2301ea[_0xcdf0('0x3e')]]){if(_0x2301ea[_0xcdf0('0x48')]==='6'){if(!this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x61')]){var _0x20b31c=moment();this[_0xcdf0('0x1b')][_0x2301ea['linkedid']][_0xcdf0('0x61')]=!![];this[_0xcdf0('0x1b')][_0x2301ea['linkedid']][_0xcdf0('0x62')]=_0x20b31c[_0xcdf0('0x45')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x44')]){this['channels'][_0x2301ea[_0xcdf0('0x3e')]]['holdtime']=_0x20b31c[_0xcdf0('0x63')](this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x44')],_0xcdf0('0x59'));}}this[_0xcdf0('0x1b')][_0x2301ea['linkedid']][_0xcdf0('0x3e')]=_0x2301ea['uniqueid'];if(_0x2301ea[_0xcdf0('0x3a')]!==_0xcdf0('0x64')){this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x65')]=_0x2301ea['calleridnum'];}this['channels'][_0x2301ea['linkedid']][_0xcdf0('0x66')]=_0x2301ea['calleridname'];this['channels'][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x67')]=_0x2301ea[_0xcdf0('0x4a')];this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x46')]=dispositions[_[_0xcdf0('0x47')](_0x2301ea['channelstate'])];if(this[_0xcdf0('0x1c')][_0x2301ea['channel'][_0xcdf0('0x4b')]('-')[0x0]]){this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x68')]=this[_0xcdf0('0x1c')][_0x2301ea[_0xcdf0('0x4a')][_0xcdf0('0x4b')]('-')[0x0]]['id'];this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3e')]][_0xcdf0('0x69')]=this['agents'][_0x2301ea[_0xcdf0('0x4a')]['split']('-')[0x0]][_0xcdf0('0x50')];}}}}else{if(this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3d')]]){if(_0x2301ea[_0xcdf0('0x48')]==='6'){if(this[_0xcdf0('0x1c')][_0x2301ea[_0xcdf0('0x4a')][_0xcdf0('0x4b')]('-')[0x0]]){this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3d')]]['UserId']=this[_0xcdf0('0x1c')][_0x2301ea[_0xcdf0('0x4a')][_0xcdf0('0x4b')]('-')[0x0]]['id'];this[_0xcdf0('0x1b')][_0x2301ea[_0xcdf0('0x3d')]][_0xcdf0('0x69')]=this[_0xcdf0('0x1c')][_0x2301ea[_0xcdf0('0x4a')][_0xcdf0('0x4b')]('-')[0x0]]['name'];}}}}}}catch(_0x4c8aaf){logger[_0xcdf0('0x31')]('[%s][voiceCallReport][newstate]',_0x2301ea[_0xcdf0('0x3d')],util['inspect'](_0x4c8aaf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')][_0xcdf0('0x6a')]=function(_0x5701ae,_0x11cc7e){try{if(this[_0xcdf0('0x1b')][_0x5701ae]){logger[_0xcdf0('0x2e')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5701ae,_0x11cc7e);this['channels'][_0x5701ae][_0xcdf0('0x6b')]=!![];if(_[_0xcdf0('0x6c')](_0x11cc7e,_0xcdf0('0x6d'))){_0x11cc7e=_0x11cc7e[_0xcdf0('0x6e')](_0xcdf0('0x6d'),_0xcdf0('0x6f'));}this[_0xcdf0('0x1b')][_0x5701ae]['monitorFilename']=_0x11cc7e;var _0x2f6b8d=_[_0xcdf0('0x70')](this[_0xcdf0('0x1b')][_0x5701ae][_0xcdf0('0x71')],{'filename':_0x11cc7e});if(_[_0xcdf0('0x72')](_0x2f6b8d)){this[_0xcdf0('0x1b')][_0x5701ae][_0xcdf0('0x71')]['push']({'filename':_0x11cc7e,'createdAt':moment()[_0xcdf0('0x45')](_0xcdf0('0x5a')),'mixmonitorid':'','status':_0xcdf0('0x73')});}}}catch(_0x2a5f05){logger[_0xcdf0('0x31')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5701ae,util[_0xcdf0('0x33')](_0x2a5f05,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')]['syncVarSet']=function(_0x4c1278){try{if(this['isNotNull'](_0x4c1278)){logger[_0xcdf0('0x3b')](_0xcdf0('0x74'),_0x4c1278[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x4c1278,{'showHidden':![],'depth':null}));if(this['channels'][_0x4c1278[_0xcdf0('0x3d')]]&&_0x4c1278['channel']!=_0xcdf0('0x41')){if(this['isNotNull'](_0x4c1278['variable'])){if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')][_0xcdf0('0x76')])){logger[_0xcdf0('0x2e')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4c1278[_0xcdf0('0x3d')],_0x4c1278[_0xcdf0('0x77')]);this[_0xcdf0('0x6a')](_0x4c1278[_0xcdf0('0x3d')],_0x4c1278[_0xcdf0('0x77')]);}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')]['xmd-phone'])){logger['info'](_0xcdf0('0x78'),_0x4c1278['uniqueid'],_0x4c1278[_0xcdf0('0x77')]);this[_0xcdf0('0x1b')][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x3a')]=_0x4c1278[_0xcdf0('0x77')];}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')][_0xcdf0('0x79')])){logger[_0xcdf0('0x2e')](_0xcdf0('0x7a'),_0x4c1278[_0xcdf0('0x3d')],_0x4c1278[_0xcdf0('0x77')]);this[_0xcdf0('0x1b')][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x7b')]=_0x4c1278[_0xcdf0('0x77')];}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')][_0xcdf0('0x7c')])){logger[_0xcdf0('0x2e')](_0xcdf0('0x7d'),_0x4c1278[_0xcdf0('0x3d')],_0x4c1278['value']);this['channels'][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x7e')]=_0x4c1278['value'];}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')][_0xcdf0('0x7f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x4c1278[_0xcdf0('0x3d')],_0x4c1278['value'][_0xcdf0('0x4b')](',')[0x0]);this['channels'][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x13')]=_0x4c1278[_0xcdf0('0x77')][_0xcdf0('0x4b')](',')[0x0];}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')]['xmd-originatecalleridnum'])){logger[_0xcdf0('0x2e')](_0xcdf0('0x80'),_0x4c1278[_0xcdf0('0x3d')],_0x4c1278[_0xcdf0('0x77')]);this[_0xcdf0('0x1b')][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x81')]=_0x4c1278['value'];}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')][_0xcdf0('0x82')])){logger[_0xcdf0('0x2e')](_0xcdf0('0x83'),_0x4c1278[_0xcdf0('0x3d')],_0x4c1278[_0xcdf0('0x77')]);this[_0xcdf0('0x1b')][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x84')]=_0x4c1278[_0xcdf0('0x77')];}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')][_0xcdf0('0x85')])){logger['info'](_0xcdf0('0x86'),_0x4c1278['uniqueid'],_0x4c1278['value']);this[_0xcdf0('0x1b')][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x87')]=_0x4c1278[_0xcdf0('0x77')];}else if(this['isNotNull'](_0x4c1278['variable'][_0xcdf0('0x88')])){logger[_0xcdf0('0x2e')](_0xcdf0('0x89'),_0x4c1278[_0xcdf0('0x3d')],_0x4c1278[_0xcdf0('0x77')]);this['channels'][_0x4c1278[_0xcdf0('0x3d')]]['queue']=_0x4c1278[_0xcdf0('0x77')];}else if(this['isNotNull'](_0x4c1278[_0xcdf0('0x75')][_0xcdf0('0x8a')])){logger[_0xcdf0('0x2e')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4c1278['uniqueid'],_0x4c1278[_0xcdf0('0x77')]);this[_0xcdf0('0x1b')][_0x4c1278[_0xcdf0('0x3d')]][_0xcdf0('0x8b')]=_0x4c1278['value'];}}}else if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')]['mixmonitor_filename'])){if(_0x4c1278[_0xcdf0('0x77')]){var _0x5d4ac8=path[_0xcdf0('0x8c')](_0x4c1278['value'])[_0xcdf0('0x50')];logger['info'](_0xcdf0('0x8d'),_0x5d4ac8,_0x4c1278[_0xcdf0('0x77')]);this[_0xcdf0('0x6a')](_0x5d4ac8,_0x4c1278['value']);}}else if(this['channels'][_0x4c1278[_0xcdf0('0x3e')]]){if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')])){if(this[_0xcdf0('0x34')](_0x4c1278[_0xcdf0('0x75')]['sipcallid'])){logger['info'](_0xcdf0('0x8e'),_0x4c1278[_0xcdf0('0x3e')],_0x4c1278[_0xcdf0('0x77')]);this['channels'][_0x4c1278['linkedid']][_0xcdf0('0x8f')]=_0x4c1278['value'];}}}}}catch(_0x210bff){logger[_0xcdf0('0x31')]('[%s][voiceCallReport][varset]',_0x4c1278['uniqueid'],util[_0xcdf0('0x33')](_0x210bff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')]['syncHangup']=function(_0x9e6dd){try{if(this[_0xcdf0('0x34')](_0x9e6dd)){logger[_0xcdf0('0x3b')](_0xcdf0('0x90'),_0x9e6dd[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x9e6dd,{'showHidden':![],'depth':null}));if(this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]]){logger[_0xcdf0('0x2e')](_0xcdf0('0x91'),_0x9e6dd[_0xcdf0('0x3d')],_0x9e6dd[_0xcdf0('0x92')]);var _0x2bd431=moment();this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x93')]=_0x2bd431[_0xcdf0('0x45')](_0xcdf0('0x5a'));this[_0xcdf0('0x1b')][_0x9e6dd['uniqueid']][_0xcdf0('0x57')]=_0x2bd431['diff'](this['channels'][_0x9e6dd[_0xcdf0('0x3d')]]['starttime'],_0xcdf0('0x59'));if(this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x61')]){this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x94')]=_0x2bd431['diff'](this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]]['answertime'],_0xcdf0('0x59'));this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x95')]=this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x57')]-this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]]['billableseconds'];}if(_0x9e6dd['context']===_0xcdf0('0x49')){if(this['agents'][_0x9e6dd[_0xcdf0('0x4a')][_0xcdf0('0x4b')]('-')[0x0]]){this[_0xcdf0('0x1c')][_0x9e6dd['channel'][_0xcdf0('0x4b')]('-')[0x0]]=_[_0xcdf0('0x96')](this[_0xcdf0('0x1c')][_0x9e6dd[_0xcdf0('0x4a')][_0xcdf0('0x4b')]('-')[0x0]],[_0xcdf0('0x4c')]);logger[_0xcdf0('0x3b')](_0xcdf0('0x97'),_0x9e6dd['uniqueid'],util[_0xcdf0('0x33')]({'destaccountcode':this[_0xcdf0('0x1c')][_0x9e6dd[_0xcdf0('0x4a')]['split']('-')[0x0]][_0xcdf0('0x4f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xcdf0('0x45')](_0xcdf0('0x98'),this['agents'][_0x9e6dd[_0xcdf0('0x4a')]['split']('-')[0x0]][_0xcdf0('0x50')]),_0xcdf0('0x99'),{'destaccountcode':this[_0xcdf0('0x1c')][_0x9e6dd[_0xcdf0('0x4a')]['split']('-')[0x0]][_0xcdf0('0x4f')]});}}if(_0x9e6dd[_0xcdf0('0x9a')]===_0xcdf0('0x9b')){this[_0xcdf0('0x9c')][_0x9e6dd[_0xcdf0('0x3d')]]=this['channels'][_0x9e6dd[_0xcdf0('0x3d')]];}else{if(this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x7e')]===_0xcdf0('0x9d')&&this[_0xcdf0('0x9c')][_0x9e6dd[_0xcdf0('0x3d')]]){this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x3d')]=[this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x3e')],this[_0xcdf0('0x1b')][_0x9e6dd['uniqueid']][_0xcdf0('0x3e')]=this['channels'][_0x9e6dd[_0xcdf0('0x3d')]][_0xcdf0('0x3d')]][0x0];delete this[_0xcdf0('0x9c')][_0x9e6dd[_0xcdf0('0x3d')]];}}logger[_0xcdf0('0x3b')](_0xcdf0('0x9e'),_0x9e6dd[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](this['channels'][_0x9e6dd['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xcdf0('0x36')](_0xcdf0('0x9f'),this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]]);delete this[_0xcdf0('0x1b')][_0x9e6dd[_0xcdf0('0x3d')]];}}}catch(_0x8e0fc9){logger[_0xcdf0('0x31')](_0xcdf0('0xa0'),_0x9e6dd['uniqueid'],util[_0xcdf0('0x33')](_0x8e0fc9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xcdf0('0x29')]=function(_0x59128c){try{if(this[_0xcdf0('0x34')](_0x59128c)){logger['info'](_0xcdf0('0xa1'),_0x59128c[_0xcdf0('0x3d')],_0x59128c['origtransferercalleridnum'],_0x59128c['transfertargetcalleridnum']);logger[_0xcdf0('0x3b')](_0xcdf0('0xa2'),_0x59128c[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x59128c,{'showHidden':![],'depth':null}));if(this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa3')]]){this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa3')]][_0xcdf0('0xa4')]=_0x59128c[_0xcdf0('0xa5')];this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa3')]][_0xcdf0('0xa6')]=_0x59128c[_0xcdf0('0xa7')];if(this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa8')]]){var _0x260d3f=this[_0xcdf0('0x1b')][_0x59128c['secondtransfereruniqueid']];this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa8')]]=this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa3')]];this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa3')]]=_0x260d3f;}}else if(this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa9')]]){this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa9')]]['transfercalleridnum']=_0x59128c[_0xcdf0('0xa5')];this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xa9')]][_0xcdf0('0xa6')]=_0x59128c[_0xcdf0('0xa7')];if(this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xaa')]]){var _0x260d3f=this[_0xcdf0('0x1b')][_0x59128c[_0xcdf0('0xaa')]];this[_0xcdf0('0x1b')][_0x59128c['origtransfereruniqueid']]=this[_0xcdf0('0x1b')][_0x59128c['transfertargetuniqueid']];this['channels'][_0x59128c[_0xcdf0('0xa9')]]=_0x260d3f;}}}}catch(_0x51cd60){logger['error'](_0xcdf0('0xab'),_0x59128c['uniqueid'],util[_0xcdf0('0x33')](_0x51cd60,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')][_0xcdf0('0x2a')]=function(_0x575a58){try{if(this[_0xcdf0('0x34')](_0x575a58)){logger['info']('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x575a58['uniqueid'],_0x575a58['transfereecalleridnum'],_0x575a58['extension']);logger[_0xcdf0('0x3b')](_0xcdf0('0xac'),_0x575a58[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x575a58,{'showHidden':![],'depth':null}));if(this[_0xcdf0('0x1b')][_0x575a58['transfereeuniqueid']]){this[_0xcdf0('0x1b')][_0x575a58[_0xcdf0('0xa3')]]['transfercalleridnum']=_0x575a58[_0xcdf0('0xad')];this['channels'][_0x575a58['transfereeuniqueid']][_0xcdf0('0xa6')]=_0x575a58[_0xcdf0('0xae')];this[_0xcdf0('0x26')]({'event':_0xcdf0('0x9b'),'uniqueid':_0x575a58[_0xcdf0('0xa3')],'context':_0x575a58[_0xcdf0('0x43')],'channel':_0x575a58[_0xcdf0('0xaf')]});}}}catch(_0x30a212){logger[_0xcdf0('0x31')](_0xcdf0('0xb0'),_0x575a58['uniqueid'],util[_0xcdf0('0x33')](_0x30a212,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')]['syncMusicOnHoldStart']=function(_0x21684f){try{if(this[_0xcdf0('0x34')](_0x21684f)){logger[_0xcdf0('0x3b')](_0xcdf0('0xb1'),_0x21684f[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x21684f,{'showHidden':![],'depth':null}));if(this[_0xcdf0('0x1b')][_0x21684f[_0xcdf0('0x3d')]]){if(!_['isNil'](this[_0xcdf0('0x1b')][_0x21684f[_0xcdf0('0x3d')]][_0xcdf0('0x62')])){this[_0xcdf0('0x1b')][_0x21684f[_0xcdf0('0x3d')]][_0xcdf0('0xb2')]=moment()['format'](_0xcdf0('0x5a'));logger[_0xcdf0('0x2e')](_0xcdf0('0xb3'),_0x21684f[_0xcdf0('0x3d')],this[_0xcdf0('0x1b')][_0x21684f[_0xcdf0('0x3d')]][_0xcdf0('0xb2')]);}}}}catch(_0x18bace){logger[_0xcdf0('0x31')](_0xcdf0('0xb4'),_0x21684f[_0xcdf0('0x3d')],util[_0xcdf0('0x33')](_0x18bace,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcdf0('0x37')]['syncMusicOnHoldStop']=function(_0x59949a){try{if(this[_0xcdf0('0x34')](_0x59949a)){logger[_0xcdf0('0x3b')](_0xcdf0('0xb5'),_0x59949a['uniqueid'],util[_0xcdf0('0x33')](_0x59949a,{'showHidden':![],'depth':null}));if(this['channels'][_0x59949a['uniqueid']]){if(!_['isNil'](this[_0xcdf0('0x1b')][_0x59949a['uniqueid']]['mohstarttime'])){this[_0xcdf0('0x1b')][_0x59949a[_0xcdf0('0x3d')]][_0xcdf0('0xb6')]+=moment()[_0xcdf0('0xb7')](0x0)[_0xcdf0('0x63')](this[_0xcdf0('0x1b')][_0x59949a[_0xcdf0('0x3d')]][_0xcdf0('0xb2')],_0xcdf0('0x59'));logger['info'](_0xcdf0('0xb8'),_0x59949a[_0xcdf0('0x3d')],this[_0xcdf0('0x1b')][_0x59949a[_0xcdf0('0x3d')]][_0xcdf0('0xb6')]);delete this[_0xcdf0('0x1b')][_0x59949a[_0xcdf0('0x3d')]][_0xcdf0('0xb2')];}}}}catch(_0x242e07){logger[_0xcdf0('0x31')](_0xcdf0('0xb9'),_0x59949a['uniqueid'],util[_0xcdf0('0x33')](_0x242e07,{'showHidden':![],'depth':null}));}};module[_0xcdf0('0xba')]=VoiceCallReport; \ No newline at end of file +var _0xb27c=['OutgoingSpoolFailed','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','includes','startsWith','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','holdtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','bluebird','lodash','moment','../../../config/environment','ami','../ami','../model/channel','unknown','not_inuse','inuse','invalid','ringing','ringinuse','onhold','set','queue','dial','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb27c,0x129));var _0xcb27=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xb27c[_0xc8db6b];return _0x12cb81;};'use strict';var BPromise=require(_0xcb27('0x0'));var _=require(_0xcb27('0x1'));var moment=require(_0xcb27('0x2'));var util=require('util');var path=require('path');var Redis=require('ioredis');var config=require(_0xcb27('0x3'));var logger=require('../../../config/logger')(_0xcb27('0x4'));var ami=require(_0xcb27('0x5'));var Channel=require(_0xcb27('0x6'));var statusDesc=[_0xcb27('0x7'),_0xcb27('0x8'),_0xcb27('0x9'),'busy',_0xcb27('0xa'),'unavailable',_0xcb27('0xb'),_0xcb27('0xc'),_0xcb27('0xd')];var applications=[_0xcb27('0xe'),_0xcb27('0xf'),'agi',_0xcb27('0x10'),'playback',_0xcb27('0x11')];var dispositions=['NO\x20ANSWER',_0xcb27('0x12'),'FAILED',_0xcb27('0x13'),'NO\x20ANSWER',_0xcb27('0x13'),'ANSWERED',_0xcb27('0x14'),_0xcb27('0x12'),_0xcb27('0x12'),_0xcb27('0x12')];var actions={};config[_0xcb27('0x15')]=_['defaults'](config[_0xcb27('0x15')],{'host':_0xcb27('0x16'),'port':0x18eb});var io=require(_0xcb27('0x17'))(new Redis(config[_0xcb27('0x15')]));function VoiceCallReport(_0x21e35c){this[_0xcb27('0x18')]=_0x21e35c['channels'];this[_0xcb27('0x19')]=_0x21e35c[_0xcb27('0x19')];this['blindTransfers']={};ami['on'](_0xcb27('0x1a'),this[_0xcb27('0x1b')][_0xcb27('0x1c')](this));ami['on'](_0xcb27('0x1d'),this[_0xcb27('0x1b')]['bind'](this));ami['on'](_0xcb27('0x1e'),this[_0xcb27('0x1f')]['bind'](this));ami['on'](_0xcb27('0x20'),this['syncNewState'][_0xcb27('0x1c')](this));ami['on'](_0xcb27('0x21'),this[_0xcb27('0x22')][_0xcb27('0x1c')](this));ami['on'](_0xcb27('0x23'),this[_0xcb27('0x24')][_0xcb27('0x1c')](this));ami['on'](_0xcb27('0x25'),this[_0xcb27('0x26')]['bind'](this));ami['on'](_0xcb27('0x27'),this[_0xcb27('0x28')]['bind'](this));ami['on'](_0xcb27('0x29'),this[_0xcb27('0x2a')][_0xcb27('0x1c')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xcb27('0x2b'),this[_0xcb27('0x2c')][_0xcb27('0x1c')](this));try{logger[_0xcb27('0x2d')](_0xcb27('0x2e'));ami['actionCoreShowChannels']();}catch(_0x266565){logger['error']('[voiceCallReport][coreshowchannels]',util[_0xcb27('0x2f')](_0x266565,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x31')]=function(_0x1ab16c){return _0x1ab16c!==null&&!_[_0xcb27('0x32')](_0x1ab16c);};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x33')]=function(_0x2b2d36,_0x3a3e1e,_0x31f68a){io['to'](_0x2b2d36)['emit'](_0x3a3e1e,_0x31f68a);};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x26')]=function(_0x689642){try{if(this[_0xcb27('0x31')](_0x689642)){logger[_0xcb27('0x2d')](_0xcb27('0x34'),_0x689642['uniqueid'],_0x689642[_0xcb27('0x35')],_0x689642[_0xcb27('0x36')]);logger[_0xcb27('0x37')](_0xcb27('0x38'),_0x689642[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x689642,{'showHidden':![],'depth':null}));if(_0x689642[_0xcb27('0x39')]===_0x689642[_0xcb27('0x3a')]){if(!_['isUndefined'](this[_0xcb27('0x18')][_0x689642[_0xcb27('0x39')]])){_[_0xcb27('0x3b')](this[_0xcb27('0x18')][_0x689642[_0xcb27('0x39')]],_[_0xcb27('0x3c')](_0x689642,_['keys'](this[_0xcb27('0x18')][_0x689642[_0xcb27('0x39')]])));}}}}catch(_0xbe7da2){logger[_0xcb27('0x3d')](_0xcb27('0x3e'),_0x689642[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0xbe7da2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x1f')]=function(_0x3c01da){try{if(this[_0xcb27('0x31')](_0x3c01da)){logger[_0xcb27('0x37')](_0xcb27('0x3f'),_0x3c01da[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x3c01da,{'showHidden':![],'depth':null}));if(_0x3c01da['uniqueid']===_0x3c01da['linkedid']&&_0x3c01da[_0xcb27('0x40')]!=_0xcb27('0x41')){if(_[_0xcb27('0x32')](this[_0xcb27('0x18')][_0x3c01da[_0xcb27('0x39')]])){logger[_0xcb27('0x2d')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3c01da[_0xcb27('0x39')],_0x3c01da[_0xcb27('0x42')],_0x3c01da[_0xcb27('0x43')]);this[_0xcb27('0x18')][_0x3c01da[_0xcb27('0x39')]]=new Channel();this['channels'][_0x3c01da[_0xcb27('0x39')]][_0xcb27('0x44')]=moment()[_0xcb27('0x45')](_0xcb27('0x46'));this[_0xcb27('0x18')][_0x3c01da['uniqueid']][_0xcb27('0x47')]=dispositions[_[_0xcb27('0x48')](_0x3c01da[_0xcb27('0x49')])];_[_0xcb27('0x3b')](this[_0xcb27('0x18')][_0x3c01da['uniqueid']],_[_0xcb27('0x3c')](_0x3c01da,_[_0xcb27('0x4a')](this[_0xcb27('0x18')][_0x3c01da[_0xcb27('0x39')]])));if(_0x3c01da['context']===_0xcb27('0x4b')){if(this[_0xcb27('0x19')][_0x3c01da[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]){this['agents'][_0x3c01da[_0xcb27('0x40')]['split']('-')[0x0]][_0xcb27('0x4d')]=_0x3c01da[_0xcb27('0x43')];logger[_0xcb27('0x37')](_0xcb27('0x4e'),_0x3c01da[_0xcb27('0x39')],util[_0xcb27('0x2f')]({'destaccountcode':this['agents'][_0x3c01da[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3c01da['exten']},{'showHidden':![],'depth':null}));this[_0xcb27('0x33')](util[_0xcb27('0x45')]('user:%s',this[_0xcb27('0x19')][_0x3c01da['channel']['split']('-')[0x0]][_0xcb27('0x4f')]),_0xcb27('0x50'),{'destaccountcode':this[_0xcb27('0x19')][_0x3c01da[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]][_0xcb27('0x51')],'destconnectedlinenum':_0x3c01da['exten']});}}}}}}catch(_0x1af683){logger[_0xcb27('0x3d')](_0xcb27('0x52'),_0x3c01da[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x1af683,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xcb27('0x1b')]=function(_0x543f06){try{if(this[_0xcb27('0x31')](_0x543f06)){logger[_0xcb27('0x37')]('[%s][voiceCallReport][newexten]\x20event:',_0x543f06['uniqueid'],util[_0xcb27('0x2f')](_0x543f06,{'showHidden':![],'depth':null}));if(_0x543f06[_0xcb27('0x39')]===_0x543f06[_0xcb27('0x3a')]&&_0x543f06[_0xcb27('0x43')]!='h'&&_0x543f06[_0xcb27('0x40')]!=_0xcb27('0x41')){_0x543f06['application']=_0x543f06[_0xcb27('0x53')][_0xcb27('0x54')]();_0x543f06[_0xcb27('0x55')]=(_0x543f06[_0xcb27('0x56')]||_0x543f06[_0xcb27('0x55')])[_0xcb27('0x54')]();logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x543f06[_0xcb27('0x39')],_0x543f06[_0xcb27('0x53')],_0x543f06[_0xcb27('0x55')]);if(_[_0xcb27('0x32')](this['channels'][_0x543f06[_0xcb27('0x39')]])){this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]]=new Channel();this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]][_0xcb27('0x44')]=_0x543f06['duration']?moment()[_0xcb27('0x57')](moment[_0xcb27('0x58')](_0x543f06[_0xcb27('0x58')])[_0xcb27('0x59')](),'seconds')[_0xcb27('0x45')](_0xcb27('0x46')):moment()[_0xcb27('0x45')](_0xcb27('0x46'));this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]][_0xcb27('0x47')]=_0xcb27('0x13');}_[_0xcb27('0x3b')](this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]],_[_0xcb27('0x3c')](_0x543f06,_['keys'](this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]])));if(_[_0xcb27('0x5a')](applications,_0x543f06[_0xcb27('0x53')])){this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]]['lastapplication']=_0x543f06[_0xcb27('0x53')];this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]]['lastdata']=_0x543f06[_0xcb27('0x55')];if(_0x543f06[_0xcb27('0x53')]===_0xcb27('0xe')&&_[_0xcb27('0x5b')](_0x543f06[_0xcb27('0x55')],'cdr(')){var _0x3e3e38=_0x543f06[_0xcb27('0x55')]['split']('=');var _0xd846fb=_0x3e3e38[0x0][_0xcb27('0x5c')](/cdr\((.*)\)/);if(_0xd846fb){this[_0xcb27('0x18')][_0x543f06[_0xcb27('0x39')]][_0xd846fb[0x1]]=_0x3e3e38[0x1];}}else if(_0x543f06[_0xcb27('0x53')]===_0xcb27('0xf')){this[_0xcb27('0x18')][_0x543f06['uniqueid']]['queue']=_0x543f06[_0xcb27('0x55')][_0xcb27('0x4c')](',')[0x0];}}}}}catch(_0x38ea32){logger['error'](_0xcb27('0x5d'),_0x543f06[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x38ea32,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x5e')]=function(_0x25d0e1){try{if(this[_0xcb27('0x31')](_0x25d0e1)){logger[_0xcb27('0x2d')](_0xcb27('0x5f'),_0x25d0e1[_0xcb27('0x39')],_0x25d0e1[_0xcb27('0x3a')],_0x25d0e1[_0xcb27('0x35')],_0x25d0e1['calleridnum']);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x25d0e1[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x25d0e1,{'showHidden':![],'depth':null}));if(_0x25d0e1['uniqueid']!==_0x25d0e1[_0xcb27('0x3a')]){if(this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x3a')]]){if(_0x25d0e1['channelstate']==='6'){if(!this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x60')]){var _0x1044a7=moment();this[_0xcb27('0x18')][_0x25d0e1['linkedid']]['answered']=!![];this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x61')]=_0x1044a7[_0xcb27('0x45')](_0xcb27('0x46'));if(this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x44')]){this[_0xcb27('0x18')][_0x25d0e1['linkedid']]['holdtime']=_0x1044a7[_0xcb27('0x62')](this['channels'][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x44')],_0xcb27('0x59'));}}this['channels'][_0x25d0e1[_0xcb27('0x3a')]]['linkedid']=_0x25d0e1['uniqueid'];if(_0x25d0e1[_0xcb27('0x36')]!==_0xcb27('0x63')){this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x64')]=_0x25d0e1[_0xcb27('0x36')];}this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x65')]=_0x25d0e1[_0xcb27('0x35')];this['channels'][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x66')]=_0x25d0e1[_0xcb27('0x40')];this['channels'][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x47')]=dispositions[_[_0xcb27('0x48')](_0x25d0e1['channelstate'])];if(this['agents'][_0x25d0e1[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]){this[_0xcb27('0x18')][_0x25d0e1['linkedid']][_0xcb27('0x67')]=this[_0xcb27('0x19')][_0x25d0e1[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]['id'];this['channels'][_0x25d0e1[_0xcb27('0x3a')]][_0xcb27('0x68')]=this[_0xcb27('0x19')][_0x25d0e1[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]][_0xcb27('0x4f')];}}}}else{if(this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x39')]]){if(_0x25d0e1[_0xcb27('0x49')]==='6'){if(this['agents'][_0x25d0e1[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]){this[_0xcb27('0x18')][_0x25d0e1[_0xcb27('0x39')]][_0xcb27('0x67')]=this[_0xcb27('0x19')][_0x25d0e1[_0xcb27('0x40')]['split']('-')[0x0]]['id'];this['channels'][_0x25d0e1[_0xcb27('0x39')]][_0xcb27('0x68')]=this['agents'][_0x25d0e1[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]['name'];}}}}}}catch(_0x12be24){logger[_0xcb27('0x3d')](_0xcb27('0x69'),_0x25d0e1['uniqueid'],util[_0xcb27('0x2f')](_0x12be24,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x6a')]=function(_0x98e86d,_0x17892b){try{if(this[_0xcb27('0x18')][_0x98e86d]){logger[_0xcb27('0x2d')](_0xcb27('0x6b'),_0x98e86d,_0x17892b);this[_0xcb27('0x18')][_0x98e86d][_0xcb27('0x6c')]=!![];if(_[_0xcb27('0x6d')](_0x17892b,_0xcb27('0x6e'))){_0x17892b=_0x17892b[_0xcb27('0x6f')](_0xcb27('0x6e'),_0xcb27('0x70'));}this[_0xcb27('0x18')][_0x98e86d][_0xcb27('0x71')]=_0x17892b;var _0x20f245=_[_0xcb27('0x72')](this['channels'][_0x98e86d][_0xcb27('0x73')],{'filename':_0x17892b});if(_[_0xcb27('0x74')](_0x20f245)){this[_0xcb27('0x18')][_0x98e86d][_0xcb27('0x73')]['push']({'filename':_0x17892b,'createdAt':moment()[_0xcb27('0x45')](_0xcb27('0x46')),'mixmonitorid':'','status':'rec'});}}}catch(_0x442033){logger[_0xcb27('0x3d')](_0xcb27('0x75'),_0x98e86d,util[_0xcb27('0x2f')](_0x442033,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')]['syncVarSet']=function(_0x3ad7ce){try{if(this[_0xcb27('0x31')](_0x3ad7ce)){logger[_0xcb27('0x37')](_0xcb27('0x76'),_0x3ad7ce['uniqueid'],util[_0xcb27('0x2f')](_0x3ad7ce,{'showHidden':![],'depth':null}));if(this[_0xcb27('0x18')][_0x3ad7ce[_0xcb27('0x39')]]&&_0x3ad7ce[_0xcb27('0x40')]!='OutgoingSpoolFailed'){if(this[_0xcb27('0x31')](_0x3ad7ce['variable'])){if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x78')])){logger[_0xcb27('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3ad7ce['uniqueid'],_0x3ad7ce[_0xcb27('0x79')]);this[_0xcb27('0x6a')](_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]);}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x7a')])){logger[_0xcb27('0x2d')](_0xcb27('0x7b'),_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce['value']);this['channels'][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0x36')]=_0x3ad7ce['value'];}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')]['xmd-callerid'])){logger[_0xcb27('0x2d')](_0xcb27('0x7c'),_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]);this['channels'][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0x7d')]=_0x3ad7ce['value'];}else if(this[_0xcb27('0x31')](_0x3ad7ce['variable']['xmd-cdrtype'])){logger[_0xcb27('0x2d')](_0xcb27('0x7e'),_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]);this['channels'][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0x7f')]=_0x3ad7ce[_0xcb27('0x79')];}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x80')])){logger[_0xcb27('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]['split'](',')[0x0]);this[_0xcb27('0x18')][_0x3ad7ce['uniqueid']][_0xcb27('0xf')]=_0x3ad7ce[_0xcb27('0x79')]['split'](',')[0x0];}else if(this['isNotNull'](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x81')])){logger[_0xcb27('0x2d')](_0xcb27('0x82'),_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]);this[_0xcb27('0x18')][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0x83')]=_0x3ad7ce[_0xcb27('0x79')];}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x84')])){logger['info'](_0xcb27('0x85'),_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]);this['channels'][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0x86')]=_0x3ad7ce[_0xcb27('0x79')];}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x87')])){logger['info'](_0xcb27('0x88'),_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]);this['channels'][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0x89')]=_0x3ad7ce[_0xcb27('0x79')];}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x8a')])){logger['info'](_0xcb27('0x8b'),_0x3ad7ce[_0xcb27('0x39')],_0x3ad7ce[_0xcb27('0x79')]);this[_0xcb27('0x18')][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0xf')]=_0x3ad7ce[_0xcb27('0x79')];}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x8c')])){logger[_0xcb27('0x2d')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x3ad7ce['uniqueid'],_0x3ad7ce['value']);this[_0xcb27('0x18')][_0x3ad7ce[_0xcb27('0x39')]][_0xcb27('0x8d')]=_0x3ad7ce[_0xcb27('0x79')];}}}else if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')]['mixmonitor_filename'])){if(_0x3ad7ce['value']){var _0x33ee1b=path['parse'](_0x3ad7ce[_0xcb27('0x79')])[_0xcb27('0x4f')];logger[_0xcb27('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x33ee1b,_0x3ad7ce[_0xcb27('0x79')]);this[_0xcb27('0x6a')](_0x33ee1b,_0x3ad7ce[_0xcb27('0x79')]);}}else if(this[_0xcb27('0x18')][_0x3ad7ce['linkedid']]){if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')])){if(this[_0xcb27('0x31')](_0x3ad7ce[_0xcb27('0x77')][_0xcb27('0x8c')])){logger[_0xcb27('0x2d')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x3ad7ce['linkedid'],_0x3ad7ce[_0xcb27('0x79')]);this[_0xcb27('0x18')][_0x3ad7ce[_0xcb27('0x3a')]][_0xcb27('0x8e')]=_0x3ad7ce['value'];}}}}}catch(_0x17357a){logger['error'](_0xcb27('0x8f'),_0x3ad7ce[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x17357a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x24')]=function(_0x50d3c){try{if(this['isNotNull'](_0x50d3c)){logger[_0xcb27('0x37')](_0xcb27('0x90'),_0x50d3c[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x50d3c,{'showHidden':![],'depth':null}));if(this[_0xcb27('0x18')][_0x50d3c['uniqueid']]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x50d3c['uniqueid'],_0x50d3c[_0xcb27('0x91')]);var _0x545123=moment();this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]][_0xcb27('0x92')]=_0x545123['format'](_0xcb27('0x46'));this[_0xcb27('0x18')][_0x50d3c['uniqueid']]['duration']=_0x545123[_0xcb27('0x62')](this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]][_0xcb27('0x44')],_0xcb27('0x59'));if(this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]][_0xcb27('0x60')]){this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]]['billableseconds']=_0x545123[_0xcb27('0x62')](this['channels'][_0x50d3c[_0xcb27('0x39')]]['answertime'],'seconds');this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]][_0xcb27('0x93')]=this['channels'][_0x50d3c[_0xcb27('0x39')]][_0xcb27('0x58')]-this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]][_0xcb27('0x94')];}if(_0x50d3c[_0xcb27('0x42')]===_0xcb27('0x4b')){if(this['agents'][_0x50d3c[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]){this[_0xcb27('0x19')][_0x50d3c[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]]=_[_0xcb27('0x95')](this[_0xcb27('0x19')][_0x50d3c[_0xcb27('0x40')][_0xcb27('0x4c')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xcb27('0x96'),_0x50d3c[_0xcb27('0x39')],util[_0xcb27('0x2f')]({'destaccountcode':this[_0xcb27('0x19')][_0x50d3c['channel'][_0xcb27('0x4c')]('-')[0x0]][_0xcb27('0x51')]},{'showHidden':![],'depth':null}));this[_0xcb27('0x33')](util[_0xcb27('0x45')]('user:%s',this[_0xcb27('0x19')][_0x50d3c['channel'][_0xcb27('0x4c')]('-')[0x0]][_0xcb27('0x4f')]),_0xcb27('0x97'),{'destaccountcode':this['agents'][_0x50d3c[_0xcb27('0x40')]['split']('-')[0x0]][_0xcb27('0x51')]});}}if(_0x50d3c[_0xcb27('0x98')]===_0xcb27('0x99')){this['blindTransfers'][_0x50d3c[_0xcb27('0x39')]]=this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]];}else{if(this[_0xcb27('0x18')][_0x50d3c['uniqueid']][_0xcb27('0x7f')]==='outbound'&&this[_0xcb27('0x9a')][_0x50d3c[_0xcb27('0x39')]]){this['channels'][_0x50d3c['uniqueid']][_0xcb27('0x39')]=[this['channels'][_0x50d3c['uniqueid']][_0xcb27('0x3a')],this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]][_0xcb27('0x3a')]=this[_0xcb27('0x18')][_0x50d3c['uniqueid']][_0xcb27('0x39')]][0x0];delete this[_0xcb27('0x9a')][_0x50d3c[_0xcb27('0x39')]];}}logger[_0xcb27('0x37')](_0xcb27('0x9b'),_0x50d3c[_0xcb27('0x39')],util[_0xcb27('0x2f')](this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]],{'showHidden':![],'depth':null}));ami[_0xcb27('0x33')]('custom:voiceCallReport',this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]]);delete this[_0xcb27('0x18')][_0x50d3c[_0xcb27('0x39')]];}}}catch(_0x42a60b){logger[_0xcb27('0x3d')](_0xcb27('0x9c'),_0x50d3c[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x42a60b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x28')]=function(_0x2119f7){try{if(this[_0xcb27('0x31')](_0x2119f7)){logger[_0xcb27('0x2d')](_0xcb27('0x9d'),_0x2119f7[_0xcb27('0x39')],_0x2119f7[_0xcb27('0x9e')],_0x2119f7[_0xcb27('0x9f')]);logger[_0xcb27('0x37')](_0xcb27('0xa0'),_0x2119f7[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x2119f7,{'showHidden':![],'depth':null}));if(this[_0xcb27('0x18')][_0x2119f7['transfereeuniqueid']]){this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa1')]][_0xcb27('0xa2')]=_0x2119f7['origtransferercalleridnum'];this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa1')]][_0xcb27('0xa3')]=_0x2119f7[_0xcb27('0x9f')];if(this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa4')]]){var _0x2589dc=this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa4')]];this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa4')]]=this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa1')]];this[_0xcb27('0x18')][_0x2119f7['transfereeuniqueid']]=_0x2589dc;}}else if(this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa5')]]){this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa5')]][_0xcb27('0xa2')]=_0x2119f7['origtransferercalleridnum'];this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa5')]]['transferconnectedlinenum']=_0x2119f7[_0xcb27('0x9f')];if(this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa6')]]){var _0x2589dc=this[_0xcb27('0x18')][_0x2119f7['origtransfereruniqueid']];this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa6')]]=this[_0xcb27('0x18')][_0x2119f7['transfertargetuniqueid']];this[_0xcb27('0x18')][_0x2119f7[_0xcb27('0xa5')]]=_0x2589dc;}}}}catch(_0x4cf043){logger[_0xcb27('0x3d')](_0xcb27('0xa7'),_0x2119f7['uniqueid'],util[_0xcb27('0x2f')](_0x4cf043,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0x2a')]=function(_0x2bf916){try{if(this[_0xcb27('0x31')](_0x2bf916)){logger[_0xcb27('0x2d')](_0xcb27('0xa8'),_0x2bf916['uniqueid'],_0x2bf916['transfereecalleridnum'],_0x2bf916['extension']);logger[_0xcb27('0x37')](_0xcb27('0xa9'),_0x2bf916[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x2bf916,{'showHidden':![],'depth':null}));if(this[_0xcb27('0x18')][_0x2bf916[_0xcb27('0xa1')]]){this[_0xcb27('0x18')][_0x2bf916[_0xcb27('0xa1')]][_0xcb27('0xa2')]=_0x2bf916[_0xcb27('0xaa')];this[_0xcb27('0x18')][_0x2bf916[_0xcb27('0xa1')]][_0xcb27('0xa3')]=_0x2bf916['extension'];this[_0xcb27('0x24')]({'event':'BlindTransfer','uniqueid':_0x2bf916[_0xcb27('0xa1')],'context':_0x2bf916[_0xcb27('0x42')],'channel':_0x2bf916[_0xcb27('0xab')]});}}}catch(_0x56a1c6){logger['error'](_0xcb27('0xac'),_0x2bf916[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x56a1c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcb27('0x30')][_0xcb27('0xad')]=function(_0x3479c9){try{if(this['isNotNull'](_0x3479c9)){logger[_0xcb27('0x37')](_0xcb27('0xae'),_0x3479c9[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x3479c9,{'showHidden':![],'depth':null}));if(this[_0xcb27('0x18')][_0x3479c9[_0xcb27('0x39')]]){if(!_[_0xcb27('0x74')](this[_0xcb27('0x18')][_0x3479c9[_0xcb27('0x39')]][_0xcb27('0x61')])){this[_0xcb27('0x18')][_0x3479c9['uniqueid']][_0xcb27('0xaf')]=moment()[_0xcb27('0x45')](_0xcb27('0x46'));logger[_0xcb27('0x2d')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x3479c9[_0xcb27('0x39')],this[_0xcb27('0x18')][_0x3479c9['uniqueid']][_0xcb27('0xaf')]);}}}}catch(_0x1587a5){logger[_0xcb27('0x3d')](_0xcb27('0xb0'),_0x3479c9[_0xcb27('0x39')],util[_0xcb27('0x2f')](_0x1587a5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xcb27('0x2c')]=function(_0x3ff906){try{if(this[_0xcb27('0x31')](_0x3ff906)){logger[_0xcb27('0x37')](_0xcb27('0xb1'),_0x3ff906[_0xcb27('0x39')],util['inspect'](_0x3ff906,{'showHidden':![],'depth':null}));if(this['channels'][_0x3ff906[_0xcb27('0x39')]]){if(!_[_0xcb27('0x74')](this['channels'][_0x3ff906[_0xcb27('0x39')]]['mohstarttime'])){this['channels'][_0x3ff906[_0xcb27('0x39')]]['mohtime']+=moment()[_0xcb27('0xb2')](0x0)[_0xcb27('0x62')](this[_0xcb27('0x18')][_0x3ff906['uniqueid']]['mohstarttime'],_0xcb27('0x59'));logger[_0xcb27('0x2d')](_0xcb27('0xb3'),_0x3ff906[_0xcb27('0x39')],this['channels'][_0x3ff906[_0xcb27('0x39')]][_0xcb27('0xb4')]);delete this[_0xcb27('0x18')][_0x3ff906[_0xcb27('0x39')]]['mohstarttime'];}}}}catch(_0x48f560){logger[_0xcb27('0x3d')]('[%s][voiceCallReport][musiconholdstop]',_0x3ff906[_0xcb27('0x39')],util['inspect'](_0x48f560,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index f61a3ec..ccbabd3 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 _0xa524=['error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','value','variable','variables','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','complete','starttime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','outbound','dialbegin','syncDialEnd','bind','syncVarSet','syncHangup','isNotNull','isUndefined','prototype','emit','syncDialBegin','debug','inspect','channels','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','info','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:'];(function(_0x476a65,_0x1b3d5d){var _0x598a4c=function(_0x5eb0a9){while(--_0x5eb0a9){_0x476a65['push'](_0x476a65['shift']());}};_0x598a4c(++_0x1b3d5d);}(_0xa524,0x15c));var _0x4a52=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0xa524[_0x2ad1b8];return _0x52547d;};'use strict';var _=require(_0x4a52('0x0'));var moment=require(_0x4a52('0x1'));var util=require(_0x4a52('0x2'));var Redis=require(_0x4a52('0x3'));var config=require(_0x4a52('0x4'));var logger=require(_0x4a52('0x5'))(_0x4a52('0x6'));var ami=require(_0x4a52('0x7'));config[_0x4a52('0x8')]=_[_0x4a52('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4a52('0xa'))(new Redis(config['redis']));function VoiceDialReport(_0x3ea881){this['channels']=_0x3ea881['outboundChannels'];this[_0x4a52('0xb')]=_0x3ea881[_0x4a52('0xb')];this['variables']={};ami['on'](_0x4a52('0xc'),this['syncDialBegin']['bind'](this));ami['on']('dialend',this[_0x4a52('0xd')][_0x4a52('0xe')](this));ami['on']('varset',this[_0x4a52('0xf')][_0x4a52('0xe')](this));ami['on']('hangup',this[_0x4a52('0x10')][_0x4a52('0xe')](this));}VoiceDialReport['prototype'][_0x4a52('0x11')]=function(_0x20183f){return _0x20183f!==null&&!_[_0x4a52('0x12')](_0x20183f);};VoiceDialReport[_0x4a52('0x13')]['emit']=function(_0x5ae119,_0x599fb2,_0x50da19){io['to'](_0x5ae119)[_0x4a52('0x14')](_0x599fb2,_0x50da19);};VoiceDialReport[_0x4a52('0x13')][_0x4a52('0x15')]=function(_0x32c028){try{if(this[_0x4a52('0x11')](_0x32c028)){logger[_0x4a52('0x16')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x32c028['uniqueid'],util[_0x4a52('0x17')](_0x32c028,{'showHidden':![],'depth':null}));if(this[_0x4a52('0x18')][_0x32c028[_0x4a52('0x19')]]){_['merge'](this[_0x4a52('0x18')][_0x32c028[_0x4a52('0x19')]],{'starttime':moment()[_0x4a52('0x1a')](_0x4a52('0x1b')),'lastevent':_0x4a52('0x1c'),'interface':_0x32c028[_0x4a52('0x1d')]['substring'](0x0,_0x32c028[_0x4a52('0x1d')]['lastIndexOf']('-')),'membername':_0x32c028[_0x4a52('0x1d')][_0x4a52('0x1e')](_0x32c028[_0x4a52('0x1d')]['lastIndexOf']('/')+0x1,_0x32c028[_0x4a52('0x1d')][_0x4a52('0x1f')]('-'))},_[_0x4a52('0x20')](_0x32c028,['event','privilege']));logger[_0x4a52('0x21')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x32c028[_0x4a52('0x19')],this[_0x4a52('0x18')][_0x32c028[_0x4a52('0x19')]]['membername'],this['channels'][_0x32c028['uniqueid']][_0x4a52('0x22')]);logger[_0x4a52('0x16')](_0x4a52('0x23'),_0x32c028[_0x4a52('0x19')],util['inspect'](this[_0x4a52('0x18')][_0x32c028[_0x4a52('0x19')]],{'showHidden':![],'depth':null}));this[_0x4a52('0x14')](_0x4a52('0x24'),_0x4a52('0x25'),this[_0x4a52('0x18')][_0x32c028['uniqueid']]);logger[_0x4a52('0x16')](_0x4a52('0x26'),_0x32c028[_0x4a52('0x19')],util['inspect'](this['channels'][_0x32c028[_0x4a52('0x19')]],{'showHidden':![],'depth':null}));ami[_0x4a52('0x14')]('custom:dialbegin',this[_0x4a52('0x18')][_0x32c028['uniqueid']]);}}}catch(_0x3a94e6){logger['error'](_0x4a52('0x27'),_0x32c028[_0x4a52('0x19')],util[_0x4a52('0x17')](_0x3a94e6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4a52('0x13')][_0x4a52('0xd')]=function(_0x2f147c){try{if(this[_0x4a52('0x11')](_0x2f147c)){logger[_0x4a52('0x16')](_0x4a52('0x28'),_0x2f147c[_0x4a52('0x19')],util[_0x4a52('0x17')](_0x2f147c,{'showHidden':![],'depth':null}));if(this['channels'][_0x2f147c['uniqueid']]){this[_0x4a52('0x18')][_0x2f147c[_0x4a52('0x19')]][_0x4a52('0x29')]=_0x2f147c[_0x4a52('0x29')];if(_0x2f147c[_0x4a52('0x29')]===_0x4a52('0x2a')){this[_0x4a52('0x18')][_0x2f147c['uniqueid']][_0x4a52('0x2b')]=_0x2f147c['connectedlinenum'];this['channels'][_0x2f147c[_0x4a52('0x19')]]['connectedlinename']=_0x2f147c[_0x4a52('0x2c')];this['channels'][_0x2f147c[_0x4a52('0x19')]][_0x4a52('0x2d')]=moment()['format'](_0x4a52('0x1b'));this[_0x4a52('0x18')][_0x2f147c['uniqueid']][_0x4a52('0x2e')]=_0x4a52('0x2f');logger[_0x4a52('0x21')](_0x4a52('0x30'),_0x2f147c[_0x4a52('0x19')],_0x2f147c['channel']['substring'](_0x2f147c['channel'][_0x4a52('0x1f')]('/')+0x1,_0x2f147c[_0x4a52('0x1d')][_0x4a52('0x1f')]('-')));logger[_0x4a52('0x16')](_0x4a52('0x31'),_0x2f147c['uniqueid'],util['inspect'](this['channels'][_0x2f147c[_0x4a52('0x19')]],{'showHidden':![],'depth':null}));ami[_0x4a52('0x14')](_0x4a52('0x32'),this[_0x4a52('0x18')][_0x2f147c[_0x4a52('0x19')]]);}logger[_0x4a52('0x16')](_0x4a52('0x33'),_0x2f147c[_0x4a52('0x19')],util[_0x4a52('0x17')](this[_0x4a52('0x18')][_0x2f147c[_0x4a52('0x19')]],{'showHidden':![],'depth':null}));this[_0x4a52('0x14')](_0x4a52('0x24'),'voice_outbound_channel:save',this[_0x4a52('0x18')][_0x2f147c[_0x4a52('0x19')]]);}}}catch(_0x5cd764){logger[_0x4a52('0x34')](_0x4a52('0x35'),_0x2f147c[_0x4a52('0x19')],util[_0x4a52('0x17')](_0x5cd764,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4a52('0x13')][_0x4a52('0xf')]=function(_0x77d938){try{if(this['isNotNull'](_0x77d938)){logger['debug'](_0x4a52('0x36'),_0x77d938[_0x4a52('0x19')],util[_0x4a52('0x17')](_0x77d938,{'showHidden':![],'depth':null}));this[_0x4a52('0x37')](_0x77d938[_0x4a52('0x19')],_['keys'](_0x77d938['variable'])[0x0],_0x77d938[_0x4a52('0x38')]);if(this[_0x4a52('0x11')](_0x77d938[_0x4a52('0x39')])&&this[_0x4a52('0x11')](_0x77d938[_0x4a52('0x39')]['outboundrouteid'])){if(_[_0x4a52('0x12')](this[_0x4a52('0x18')][_0x77d938[_0x4a52('0x19')]])){this[_0x4a52('0x18')][_0x77d938[_0x4a52('0x19')]]={'routeId':_0x77d938[_0x4a52('0x38')],'variables':this[_0x4a52('0x3a')][_0x77d938[_0x4a52('0x19')]]};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x77d938[_0x4a52('0x19')],_0x77d938[_0x4a52('0x39')]['outboundrouteid'],_['keys'](_0x77d938[_0x4a52('0x39')])[0x0],_0x77d938['value']);logger['debug'](_0x4a52('0x3b'),_0x77d938[_0x4a52('0x19')],util[_0x4a52('0x17')](this[_0x4a52('0x18')][_0x77d938[_0x4a52('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x4a52('0x25'),this[_0x4a52('0x18')][_0x77d938[_0x4a52('0x19')]]);}}}}catch(_0x9e10b6){logger[_0x4a52('0x34')](_0x4a52('0x3c'),_0x77d938[_0x4a52('0x19')],util[_0x4a52('0x17')](_0x9e10b6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4a52('0x13')][_0x4a52('0x37')]=function(_0x38e5fa,_0x2f9d96,_0x4317eb){var _0x365cb1=[_0x4a52('0x3d'),'rtpaudioqosbridged',_0x4a52('0x3e'),_0x4a52('0x3f'),_0x4a52('0x40'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x4a52('0x41'),_0x4a52('0x42'),_0x4a52('0x43'),_0x4a52('0x44'),_0x4a52('0x45'),'membercalls',_0x4a52('0x46'),_0x4a52('0x47'),_0x4a52('0x48'),'membername',_0x4a52('0x49'),_0x4a52('0x4a')];if(!_['isNil'](_0x2f9d96)&&!_[_0x4a52('0x4b')](_0x365cb1,_0x2f9d96)){if(_['isUndefined'](this['variables'][_0x38e5fa])){this['variables'][_0x38e5fa]={};}this[_0x4a52('0x3a')][_0x38e5fa][_0x2f9d96]=_0x4317eb;}};VoiceDialReport['prototype'][_0x4a52('0x10')]=function(_0x5c0e67){try{if(this[_0x4a52('0x11')](_0x5c0e67)){logger[_0x4a52('0x16')](_0x4a52('0x4c'),_0x5c0e67[_0x4a52('0x19')],util['inspect'](_0x5c0e67,{'showHidden':![],'depth':null}));if(this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]]){logger[_0x4a52('0x21')](_0x4a52('0x4d'),_0x5c0e67[_0x4a52('0x19')],_0x5c0e67[_0x4a52('0x4e')]);this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x4f')]=moment()[_0x4a52('0x1a')](_0x4a52('0x1b'));this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x50')]=moment(this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x4f')])[_0x4a52('0x51')](this['channels'][_0x5c0e67[_0x4a52('0x19')]]['starttime'],_0x4a52('0x52'));this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x2e')]=_0x4a52('0x53');this[_0x4a52('0xb')]['total']+=0x1;if(this['channels'][_0x5c0e67['uniqueid']][_0x4a52('0x2d')]){this[_0x4a52('0xb')]['answered']+=0x1;this['channels'][_0x5c0e67['uniqueid']]['holdtime']=moment(this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x2d')])[_0x4a52('0x51')](this['channels'][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x54')],'seconds');this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x55')]=moment(this[_0x4a52('0x18')][_0x5c0e67['uniqueid']][_0x4a52('0x4f')])[_0x4a52('0x51')](this[_0x4a52('0x18')][_0x5c0e67['uniqueid']][_0x4a52('0x2d')],_0x4a52('0x52'));this[_0x4a52('0xb')][_0x4a52('0x56')]+=this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]]['holdtime']||0x0;this[_0x4a52('0xb')][_0x4a52('0x57')]+=this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]][_0x4a52('0x55')];}this['outbound'][_0x4a52('0x58')]+=this['channels'][_0x5c0e67[_0x4a52('0x19')]]['duration'];logger['debug'](_0x4a52('0x59'),_0x5c0e67['uniqueid'],util['inspect'](this[_0x4a52('0x18')][_0x5c0e67['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x4a52('0x5a'),this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]]);logger[_0x4a52('0x16')](_0x4a52('0x5b'),_0x5c0e67[_0x4a52('0x19')],util[_0x4a52('0x17')](this[_0x4a52('0x18')][_0x5c0e67['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4a52('0x14')](_0x4a52('0x5c'),this['channels'][_0x5c0e67['uniqueid']]);logger[_0x4a52('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x5c0e67['uniqueid'],util['inspect'](this['channels'][_0x5c0e67[_0x4a52('0x19')]],{'showHidden':![],'depth':null}));this[_0x4a52('0x14')](_0x4a52('0x24'),_0x4a52('0x5d'),this[_0x4a52('0xb')]);logger['info'](_0x4a52('0x5e'),JSON['stringify'](this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x19')]]));logger[_0x4a52('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x5c0e67[_0x4a52('0x19')],util[_0x4a52('0x17')](this['channels'][_0x5c0e67['uniqueid']],{'showHidden':![],'depth':null}));this[_0x4a52('0x14')](_0x4a52('0x24'),_0x4a52('0x5f'),this['channels'][_0x5c0e67[_0x4a52('0x19')]]);delete this[_0x4a52('0x18')][_0x5c0e67['uniqueid']];}else if(this['channels'][_0x5c0e67[_0x4a52('0x60')]]){this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x60')]]['uniqueid']=this[_0x4a52('0x18')][_0x5c0e67[_0x4a52('0x60')]][_0x4a52('0x61')];}if(this[_0x4a52('0x3a')][_0x5c0e67['uniqueid']]){delete this['variables'][_0x5c0e67['uniqueid']];}}}catch(_0x2aed8d){logger[_0x4a52('0x34')](_0x4a52('0x62'),_0x5c0e67[_0x4a52('0x19')],util[_0x4a52('0x17')](_0x2aed8d,{'showHidden':![],'depth':null}));}};module[_0x4a52('0x63')]=VoiceDialReport; \ No newline at end of file +var _0x0332=['destuniqueid','[%s][voiceDialReport][hangup]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','lastIndexOf','channel','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','inspect','voice:outbound','custom:dialbegin','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceDialReport][hangup]\x20event:','cause-txt','duration','endtime','diff','starttime','seconds','complete','outbound','answered','holdtime','billableseconds','sumHoldTime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid'];(function(_0x35ac23,_0x12f157){var _0x1a3737=function(_0x2f751e){while(--_0x2f751e){_0x35ac23['push'](_0x35ac23['shift']());}};_0x1a3737(++_0x12f157);}(_0x0332,0xcf));var _0x2033=function(_0x257c95,_0x5a1219){_0x257c95=_0x257c95-0x0;var _0x87e0e7=_0x0332[_0x257c95];return _0x87e0e7;};'use strict';var _=require('lodash');var moment=require(_0x2033('0x0'));var util=require(_0x2033('0x1'));var Redis=require(_0x2033('0x2'));var config=require(_0x2033('0x3'));var logger=require(_0x2033('0x4'))(_0x2033('0x5'));var ami=require(_0x2033('0x6'));config[_0x2033('0x7')]=_[_0x2033('0x8')](config['redis'],{'host':_0x2033('0x9'),'port':0x18eb});var io=require(_0x2033('0xa'))(new Redis(config[_0x2033('0x7')]));function VoiceDialReport(_0x4d822c){this[_0x2033('0xb')]=_0x4d822c[_0x2033('0xc')];this['outbound']=_0x4d822c['outbound'];this[_0x2033('0xd')]={};ami['on'](_0x2033('0xe'),this[_0x2033('0xf')][_0x2033('0x10')](this));ami['on'](_0x2033('0x11'),this[_0x2033('0x12')][_0x2033('0x10')](this));ami['on']('varset',this[_0x2033('0x13')][_0x2033('0x10')](this));ami['on']('hangup',this[_0x2033('0x14')][_0x2033('0x10')](this));}VoiceDialReport[_0x2033('0x15')][_0x2033('0x16')]=function(_0x221336){return _0x221336!==null&&!_[_0x2033('0x17')](_0x221336);};VoiceDialReport['prototype']['emit']=function(_0x4643ee,_0x4478e0,_0x31b162){io['to'](_0x4643ee)[_0x2033('0x18')](_0x4478e0,_0x31b162);};VoiceDialReport[_0x2033('0x15')]['syncDialBegin']=function(_0x28cb56){try{if(this[_0x2033('0x16')](_0x28cb56)){logger[_0x2033('0x19')](_0x2033('0x1a'),_0x28cb56[_0x2033('0x1b')],util['inspect'](_0x28cb56,{'showHidden':![],'depth':null}));if(this[_0x2033('0xb')][_0x28cb56[_0x2033('0x1b')]]){_[_0x2033('0x1c')](this[_0x2033('0xb')][_0x28cb56[_0x2033('0x1b')]],{'starttime':moment()[_0x2033('0x1d')](_0x2033('0x1e')),'lastevent':_0x2033('0x1f'),'interface':_0x28cb56['channel']['substring'](0x0,_0x28cb56['channel'][_0x2033('0x20')]('-')),'membername':_0x28cb56[_0x2033('0x21')]['substring'](_0x28cb56[_0x2033('0x21')][_0x2033('0x20')]('/')+0x1,_0x28cb56[_0x2033('0x21')][_0x2033('0x20')]('-'))},_[_0x2033('0x22')](_0x28cb56,[_0x2033('0x23'),'privilege']));logger[_0x2033('0x24')](_0x2033('0x25'),_0x28cb56[_0x2033('0x1b')],this[_0x2033('0xb')][_0x28cb56[_0x2033('0x1b')]][_0x2033('0x26')],this[_0x2033('0xb')][_0x28cb56[_0x2033('0x1b')]][_0x2033('0x27')]);logger[_0x2033('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x28cb56[_0x2033('0x1b')],util[_0x2033('0x28')](this['channels'][_0x28cb56['uniqueid']],{'showHidden':![],'depth':null}));this[_0x2033('0x18')](_0x2033('0x29'),'voice_outbound_channel:save',this[_0x2033('0xb')][_0x28cb56[_0x2033('0x1b')]]);logger[_0x2033('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x28cb56[_0x2033('0x1b')],util[_0x2033('0x28')](this['channels'][_0x28cb56['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x2033('0x18')](_0x2033('0x2a'),this[_0x2033('0xb')][_0x28cb56['uniqueid']]);}}}catch(_0x10b318){logger['error']('[%s][voiceDialReport][dialbegin]',_0x28cb56[_0x2033('0x1b')],util[_0x2033('0x28')](_0x10b318,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2033('0x15')][_0x2033('0x12')]=function(_0x45bb8a){try{if(this[_0x2033('0x16')](_0x45bb8a)){logger[_0x2033('0x19')]('[%s][voiceDialReport][dialend]\x20event:',_0x45bb8a[_0x2033('0x1b')],util[_0x2033('0x28')](_0x45bb8a,{'showHidden':![],'depth':null}));if(this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]]){this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]]['dialstatus']=_0x45bb8a[_0x2033('0x2b')];if(_0x45bb8a[_0x2033('0x2b')]===_0x2033('0x2c')){this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]]['connectedlinenum']=_0x45bb8a[_0x2033('0x2d')];this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]][_0x2033('0x2e')]=_0x45bb8a['connectedlinename'];this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]][_0x2033('0x2f')]=moment()[_0x2033('0x1d')](_0x2033('0x1e'));this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]][_0x2033('0x30')]=_0x2033('0x31');logger[_0x2033('0x24')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x45bb8a['uniqueid'],_0x45bb8a[_0x2033('0x21')]['substring'](_0x45bb8a[_0x2033('0x21')][_0x2033('0x20')]('/')+0x1,_0x45bb8a[_0x2033('0x21')]['lastIndexOf']('-')));logger[_0x2033('0x19')](_0x2033('0x32'),_0x45bb8a[_0x2033('0x1b')],util[_0x2033('0x28')](this[_0x2033('0xb')][_0x45bb8a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x2033('0x18')](_0x2033('0x33'),this[_0x2033('0xb')][_0x45bb8a['uniqueid']]);}logger[_0x2033('0x19')](_0x2033('0x34'),_0x45bb8a['uniqueid'],util[_0x2033('0x28')](this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]],{'showHidden':![],'depth':null}));this[_0x2033('0x18')](_0x2033('0x29'),'voice_outbound_channel:save',this[_0x2033('0xb')][_0x45bb8a[_0x2033('0x1b')]]);}}}catch(_0x2373b1){logger[_0x2033('0x35')](_0x2033('0x36'),_0x45bb8a[_0x2033('0x1b')],util[_0x2033('0x28')](_0x2373b1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2033('0x15')]['syncVarSet']=function(_0x21ab6a){try{if(this['isNotNull'](_0x21ab6a)){logger[_0x2033('0x19')](_0x2033('0x37'),_0x21ab6a[_0x2033('0x1b')],util[_0x2033('0x28')](_0x21ab6a,{'showHidden':![],'depth':null}));this['addVariable'](_0x21ab6a['uniqueid'],_['keys'](_0x21ab6a[_0x2033('0x38')])[0x0],_0x21ab6a['value']);if(this[_0x2033('0x16')](_0x21ab6a[_0x2033('0x38')])&&this[_0x2033('0x16')](_0x21ab6a[_0x2033('0x38')]['outboundrouteid'])){if(_[_0x2033('0x17')](this[_0x2033('0xb')][_0x21ab6a['uniqueid']])){this[_0x2033('0xb')][_0x21ab6a[_0x2033('0x1b')]]={'routeId':_0x21ab6a[_0x2033('0x39')],'variables':this['variables'][_0x21ab6a['uniqueid']]};logger['info'](_0x2033('0x3a'),_0x21ab6a[_0x2033('0x1b')],_0x21ab6a[_0x2033('0x38')]['outboundrouteid'],_[_0x2033('0x3b')](_0x21ab6a['variable'])[0x0],_0x21ab6a['value']);logger[_0x2033('0x19')](_0x2033('0x3c'),_0x21ab6a[_0x2033('0x1b')],util[_0x2033('0x28')](this[_0x2033('0xb')][_0x21ab6a[_0x2033('0x1b')]],{'showHidden':![],'depth':null}));this[_0x2033('0x18')](_0x2033('0x29'),_0x2033('0x3d'),this['channels'][_0x21ab6a[_0x2033('0x1b')]]);}}}}catch(_0x428611){logger['error'](_0x2033('0x3e'),_0x21ab6a['uniqueid'],util[_0x2033('0x28')](_0x428611,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2033('0x15')]['addVariable']=function(_0x1f25a4,_0x99cf90,_0x2f081b){var _0x41d11f=['rtpaudioqos',_0x2033('0x3f'),_0x2033('0x40'),_0x2033('0x41'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x2033('0x42'),'rtpaudioqosrttbridged','sipcallid',_0x2033('0x43'),_0x2033('0x44'),_0x2033('0x45'),_0x2033('0x46'),_0x2033('0x47'),_0x2033('0x48'),_0x2033('0x49'),_0x2033('0x26'),_0x2033('0x4a'),_0x2033('0x4b')];if(!_['isNil'](_0x99cf90)&&!_['includes'](_0x41d11f,_0x99cf90)){if(_[_0x2033('0x17')](this[_0x2033('0xd')][_0x1f25a4])){this[_0x2033('0xd')][_0x1f25a4]={};}this[_0x2033('0xd')][_0x1f25a4][_0x99cf90]=_0x2f081b;}};VoiceDialReport[_0x2033('0x15')][_0x2033('0x14')]=function(_0x2581c1){try{if(this[_0x2033('0x16')](_0x2581c1)){logger['debug'](_0x2033('0x4c'),_0x2581c1[_0x2033('0x1b')],util[_0x2033('0x28')](_0x2581c1,{'showHidden':![],'depth':null}));if(this[_0x2033('0xb')][_0x2581c1['uniqueid']]){logger['info']('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x2581c1[_0x2033('0x1b')],_0x2581c1[_0x2033('0x4d')]);this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]]['endtime']=moment()['format'](_0x2033('0x1e'));this['channels'][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x4e')]=moment(this['channels'][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x4f')])[_0x2033('0x50')](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x51')],_0x2033('0x52'));this[_0x2033('0xb')][_0x2581c1['uniqueid']][_0x2033('0x30')]=_0x2033('0x53');this[_0x2033('0x54')]['total']+=0x1;if(this['channels'][_0x2581c1[_0x2033('0x1b')]]['answertime']){this['outbound'][_0x2033('0x55')]+=0x1;this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x56')]=moment(this['channels'][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x2f')])['diff'](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x51')],_0x2033('0x52'));this[_0x2033('0xb')][_0x2581c1['uniqueid']][_0x2033('0x57')]=moment(this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x4f')])[_0x2033('0x50')](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x2f')],_0x2033('0x52'));this['outbound'][_0x2033('0x58')]+=this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x56')]||0x0;this[_0x2033('0x54')][_0x2033('0x59')]+=this['channels'][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x57')];}this[_0x2033('0x54')]['sumDuration']+=this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]][_0x2033('0x4e')];logger[_0x2033('0x19')](_0x2033('0x5a'),_0x2581c1[_0x2033('0x1b')],util[_0x2033('0x28')](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2033('0x5b'),this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]]);logger[_0x2033('0x19')](_0x2033('0x5c'),_0x2581c1[_0x2033('0x1b')],util[_0x2033('0x28')](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2033('0x5d'),this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x2581c1['uniqueid'],util[_0x2033('0x28')](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]],{'showHidden':![],'depth':null}));this[_0x2033('0x18')](_0x2033('0x29'),_0x2033('0x5e'),this[_0x2033('0x54')]);logger[_0x2033('0x24')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x2033('0x5f')](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]]));logger[_0x2033('0x19')](_0x2033('0x60'),_0x2581c1[_0x2033('0x1b')],util['inspect'](this[_0x2033('0xb')][_0x2581c1[_0x2033('0x1b')]],{'showHidden':![],'depth':null}));this[_0x2033('0x18')]('voice:outbound',_0x2033('0x61'),this[_0x2033('0xb')][_0x2581c1['uniqueid']]);delete this['channels'][_0x2581c1[_0x2033('0x1b')]];}else if(this[_0x2033('0xb')][_0x2581c1[_0x2033('0x62')]]){this['channels'][_0x2581c1['linkedid']][_0x2033('0x1b')]=this[_0x2033('0xb')][_0x2581c1[_0x2033('0x62')]][_0x2033('0x63')];}if(this[_0x2033('0xd')][_0x2581c1[_0x2033('0x1b')]]){delete this[_0x2033('0xd')][_0x2581c1[_0x2033('0x1b')]];}}}catch(_0x4fa208){logger[_0x2033('0x35')](_0x2033('0x64'),_0x2581c1[_0x2033('0x1b')],util[_0x2033('0x28')](_0x4fa208,{'showHidden':![],'depth':null}));}};module[_0x2033('0x65')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index c21851f..67d03d2 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 _0x3ee7=['voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','Trunk','active','callerid','Interval','stringify','md5','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','then','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','syncQueueCallerAbandon','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','syncQueueCallerLeave','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','reason','transfer','startsWith','channel','linkedid','add','seconds','YYYY-MM-DD\x20HH:mm:ss','transfertype','FORWARD','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][varset]','addVariable','keys','value','variable','CONTINUE','TIMEOUT','lastevent','timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','abandoned','queuecallerjoinAt','milliseconds','diff','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','switch','transferexten','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','moment','ioredis','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','prototype','tail','finally','sequence','agents','queueChannels','voiceQueues','flagQueueSummary','variables','queuesummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerleave','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','channels','enqueue','isNil','Action','status','catch','message','error','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','campaigns','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x3ee7,0x98));var _0x73ee=function(_0x5be482,_0x233550){_0x5be482=_0x5be482-0x0;var _0xcdaa79=_0x3ee7[_0x5be482];return _0xcdaa79;};'use strict';var _=require('lodash');var moment=require(_0x73ee('0x0'));var util=require('util');var md5=require('md5');var Redis=require(_0x73ee('0x1'));var config=require('../../../config/environment');var logger=require(_0x73ee('0x2'))(_0x73ee('0x3'));var ami=require(_0x73ee('0x4'));var QueueReport=require(_0x73ee('0x5'));config[_0x73ee('0x6')]=_[_0x73ee('0x7')](config[_0x73ee('0x6')],{'host':_0x73ee('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x73ee('0x6')]));var Sequence=function(){};Sequence[_0x73ee('0x9')]['enqueue']=function(_0x32c472){this['tail']=this[_0x73ee('0xa')]?this[_0x73ee('0xa')][_0x73ee('0xb')](_0x32c472):_0x32c472();};function VoiceQueueReport(_0xb12d2e){this[_0x73ee('0xc')]=new Sequence();this['queueReports']={};this[_0x73ee('0xd')]=_0xb12d2e['agents'];this['channels']=_0xb12d2e[_0x73ee('0xe')];this['voiceQueues']=_0xb12d2e[_0x73ee('0xf')];this[_0x73ee('0x10')]=!![];this['campaigns']=_0xb12d2e['campaigns'];this[_0x73ee('0x11')]={};ami['on'](_0x73ee('0x12'),this['syncQueueSummary'][_0x73ee('0x13')](this));ami['on']('queuesummarycomplete',this[_0x73ee('0x14')]['bind'](this));ami['on'](_0x73ee('0x15'),this[_0x73ee('0x16')][_0x73ee('0x13')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x73ee('0x13')](this));ami['on'](_0x73ee('0x17'),this['syncQueueCallerLeave']['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x73ee('0x18'),this[_0x73ee('0x19')]['bind'](this));ami['on'](_0x73ee('0x1a'),this[_0x73ee('0x1b')][_0x73ee('0x13')](this));ami['on']('hangup',this[_0x73ee('0x1c')]['bind'](this));ami['on'](_0x73ee('0x1d'),this[_0x73ee('0x1e')][_0x73ee('0x13')](this));ami['on']('musiconholdstart',this[_0x73ee('0x1f')][_0x73ee('0x13')](this));ami['on'](_0x73ee('0x20'),this[_0x73ee('0x21')][_0x73ee('0x13')](this));ami['on']('attendedtransfer',this[_0x73ee('0x22')][_0x73ee('0x13')](this));ami['on'](_0x73ee('0x23'),this['syncBlindTransfer']['bind'](this));this[_0x73ee('0x24')]();this[_0x73ee('0x25')]();}function clearChannels(_0xfef750){if(!_[_0x73ee('0x26')](_0xfef750)){for(var _0xa91906 in _0xfef750){if(_0xfef750[_0x73ee('0x27')](_0xa91906)){delete _0xfef750[_0xa91906];}}}}function clearCampaigns(_0x572a84){if(!_[_0x73ee('0x26')](_0x572a84)){for(var _0x1e8b7d in _0x572a84){if(_0x572a84[_0x73ee('0x27')](_0x1e8b7d)){_0x572a84[_0x1e8b7d]['originated']=0x0;}}}}function clearVoiceQueues(_0x5b9b5f){if(!_[_0x73ee('0x26')](_0x5b9b5f)){for(var _0x1cfe8c in _0x5b9b5f){if(_0x5b9b5f['hasOwnProperty'](_0x1cfe8c)){_0x5b9b5f[_0x1cfe8c][_0x73ee('0x28')]=0x0;_0x5b9b5f[_0x1cfe8c]['talking']=0x0;_0x5b9b5f[_0x1cfe8c][_0x73ee('0x29')]=0x0;_0x5b9b5f[_0x1cfe8c][_0x73ee('0x2a')]=0x0;_0x5b9b5f[_0x1cfe8c][_0x73ee('0x2b')]=!![];}}}}function clearAgentBooked(_0x2485a1){if(!_['isEmpty'](_0x2485a1)){for(var _0x15a95f in _0x2485a1){if(_0x2485a1[_0x73ee('0x27')](_0x15a95f)){_0x2485a1[_0x15a95f][_0x73ee('0x2c')]=!![];}}}}VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x2d')]=function(){var _0x4a0575=this;for(var _0x5cb803 in this[_0x73ee('0x2e')]){if(this[_0x73ee('0x2e')][_0x73ee('0x27')](_0x5cb803)&&!this['channels'][_0x5cb803]['switch']){this[_0x73ee('0xc')][_0x73ee('0x2f')](function(){if(!_[_0x73ee('0x30')](_0x4a0575[_0x73ee('0x2e')][_0x5cb803])){return ami[_0x73ee('0x31')]({'action':_0x73ee('0x32'),'channel':_0x4a0575['channels'][_0x5cb803]['channel']})[_0x73ee('0x33')](function(_0x179acf){if(_0x179acf[_0x73ee('0x34')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4a0575['channels'][_0x5cb803]){delete _0x4a0575['channels'][_0x5cb803];logger[_0x73ee('0x35')]('[%s][voiceQueueReport][checkChannel]',_0x5cb803,util[_0x73ee('0x36')](_0x179acf,{'showHidden':![],'depth':null}));}if(_0x4a0575['queueReports'][_0x5cb803]){delete _0x4a0575[_0x73ee('0x37')][_0x5cb803];logger[_0x73ee('0x35')](_0x73ee('0x38'),_0x5cb803,util['inspect'](_0x179acf,{'showHidden':![],'depth':null}));}if(_0x4a0575[_0x73ee('0x11')][_0x5cb803]){delete _0x4a0575['variables'][_0x5cb803];logger[_0x73ee('0x35')]('[%s][voiceQueueReport][checkVariables]',_0x5cb803,util[_0x73ee('0x36')](_0x179acf,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x1e')]=function(){logger['error'](_0x73ee('0x39'));clearChannels(this[_0x73ee('0x2e')]);this[_0x73ee('0x3a')](this[_0x73ee('0x37')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x73ee('0xf')]);clearCampaigns(this[_0x73ee('0x3b')]);};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x3a')]=function(_0x103bf5){var _0x260463=this;if(!_[_0x73ee('0x26')](_0x103bf5)){for(var _0x54a84f in _0x103bf5){if(_0x103bf5['hasOwnProperty'](_0x54a84f)){_0x260463[_0x73ee('0x3c')](_0x103bf5[_0x54a84f],_0x73ee('0x3d'));delete _0x103bf5[_0x54a84f];}}}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x3e')]=function(_0x22c824,_0x522b32,_0x4cd716){io['to'](_0x22c824)[_0x73ee('0x3e')](_0x522b32,_0x4cd716);};VoiceQueueReport['prototype'][_0x73ee('0x3f')]=function(_0x1c8bae,_0x36e980){logger[_0x73ee('0x40')](_0x73ee('0x41')+_0x36e980+_0x73ee('0x42'),_0x1c8bae[_0x73ee('0x43')],util['inspect'](_0x1c8bae,{'showHidden':![],'depth':null}));this[_0x73ee('0x3e')](util[_0x73ee('0x44')](_0x73ee('0x45'),_0x1c8bae[_0x73ee('0x46')]),_0x73ee('0x47'),_0x1c8bae);io['emit'](_0x73ee('0x48'),_0x1c8bae);};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x3c')]=function(_0xc43f35,_0x2ac387){logger[_0x73ee('0x40')](_0x73ee('0x41')+_0x2ac387+']\x20sending\x20voice_queue_channel:remove\x20event:',_0xc43f35['uniqueid'],util[_0x73ee('0x36')](_0xc43f35,{'showHidden':![],'depth':null}));this['emit'](util[_0x73ee('0x44')](_0x73ee('0x45'),_0xc43f35[_0x73ee('0x46')]),'voice_queue_channel:remove',_0xc43f35);io['emit'](_0x73ee('0x49'),_0xc43f35);};VoiceQueueReport['prototype'][_0x73ee('0x4a')]=function(_0x5efd87,_0x503fc4){if(_0x5efd87[_0x73ee('0x4b')]===_0x73ee('0x4c')){var _0x44f017={'id':_0x5efd87['id'],'name':_0x5efd87[_0x73ee('0x46')],'strategy':_0x5efd87['strategy'],'answered':_0x5efd87[_0x73ee('0x4d')],'available':_0x5efd87[_0x73ee('0x4e')],'loggedIn':_0x5efd87[_0x73ee('0x4f')],'pTalking':_0x5efd87[_0x73ee('0x29')],'sumBillable':_0x5efd87[_0x73ee('0x50')],'sumDuration':_0x5efd87[_0x73ee('0x51')],'sumHoldTime':_0x5efd87[_0x73ee('0x52')]||0x0,'talking':_0x5efd87[_0x73ee('0x53')],'total':_0x5efd87[_0x73ee('0x54')],'type':_0x5efd87[_0x73ee('0x4b')],'unmanaged':_0x5efd87['unmanaged'],'abandoned':_0x5efd87['abandoned'],'waiting':_0x5efd87[_0x73ee('0x2a')]};if(_0x5efd87[_0x73ee('0x55')]){_0x44f017[_0x73ee('0x55')]={'id':_0x5efd87[_0x73ee('0x55')]['id'],'name':_0x5efd87[_0x73ee('0x55')][_0x73ee('0x46')],'active':_0x5efd87[_0x73ee('0x55')][_0x73ee('0x56')],'callerid':_0x5efd87['Trunk'][_0x73ee('0x57')]};}if(_0x5efd87[_0x73ee('0x58')]){_0x44f017['Interval']={'id':_0x5efd87[_0x73ee('0x58')]['id'],'name':_0x5efd87[_0x73ee('0x58')][_0x73ee('0x46')]};}var _0x2bec9b=md5(JSON[_0x73ee('0x59')](_0x44f017));if(_0x5efd87[_0x73ee('0x5a')]!==_0x2bec9b){_0x5efd87['md5']=_0x2bec9b;logger['debug']('[voiceQueueReport]['+_0x503fc4+']\x20sending\x20voice_queue:save\x20event:',util[_0x73ee('0x36')](_0x44f017,{'showHidden':![],'depth':null}));this[_0x73ee('0x3e')](util['format']('voice:queue:%s',_0x44f017[_0x73ee('0x46')]),'voice_queue:save',_0x44f017);}}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x5b')]=function(_0x3b49bb){return _0x3b49bb!==null&&!_[_0x73ee('0x5c')](_0x3b49bb);};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x25')]=function(){var _0xf3d85f=this;setInterval(function(){_0xf3d85f[_0x73ee('0x2d')]();ami['Action']({'action':_0x73ee('0x5d')})[_0x73ee('0x33')](function(_0x4fa38a){logger['error'](_0x73ee('0x5e'),util[_0x73ee('0x36')](_0x4fa38a,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x73ee('0x9')]['loopQueueSummary']=function(){var _0x4e65f4=this;setInterval(function(){if(_0x4e65f4[_0x73ee('0x10')]){return ami[_0x73ee('0x31')]({'action':_0x73ee('0x12')})[_0x73ee('0x5f')](function(_0x384735){_0x4e65f4[_0x73ee('0x10')]=![];})[_0x73ee('0x33')](function(_0x2a9a7b){logger[_0x73ee('0x35')]('[voiceQueueReport][queuesummary]',util[_0x73ee('0x36')](_0x2a9a7b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x60')]=function(_0x5401ca){try{if(this[_0x73ee('0x5b')](_0x5401ca)&&this[_0x73ee('0x5b')](_0x5401ca[_0x73ee('0x61')])){logger['debug'](_0x73ee('0x62'),util[_0x73ee('0x36')](_0x5401ca,{'showHidden':![],'depth':null}));if(this[_0x73ee('0xf')][_0x5401ca['queue']]){logger[_0x73ee('0x63')](_0x73ee('0x64'),_0x5401ca[_0x73ee('0x61')]);var _0x1abeee=_['countBy'](this['channels'],_0x73ee('0x61'))[_0x5401ca[_0x73ee('0x61')]]||0x0;var _0x4347ca=_0x1abeee-_0x5401ca[_0x73ee('0x65')];if(this['voiceQueues'][_0x5401ca[_0x73ee('0x61')]][_0x73ee('0x2a')]!==_[_0x73ee('0x66')](_0x5401ca[_0x73ee('0x65')])||this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]][_0x73ee('0x4f')]!==_['toNumber'](_0x5401ca[_0x73ee('0x67')])||this['voiceQueues'][_0x5401ca[_0x73ee('0x61')]][_0x73ee('0x4e')]!==_[_0x73ee('0x66')](_0x5401ca[_0x73ee('0x4e')])||this[_0x73ee('0xf')][_0x5401ca['queue']][_0x73ee('0x53')]!==_0x4347ca){this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]]['waiting']=_[_0x73ee('0x66')](_0x5401ca[_0x73ee('0x65')]);this[_0x73ee('0xf')][_0x5401ca['queue']]['loggedIn']=_['toNumber'](_0x5401ca[_0x73ee('0x67')]);this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]][_0x73ee('0x4e')]=_[_0x73ee('0x66')](_0x5401ca[_0x73ee('0x4e')]);this['voiceQueues'][_0x5401ca[_0x73ee('0x61')]][_0x73ee('0x53')]=_0x4347ca>0x0?_0x4347ca:0x0;this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]]['talking']=this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]][_0x73ee('0x53')]>_[_0x73ee('0x66')](_0x5401ca['loggedin'])?_[_0x73ee('0x66')](_0x5401ca[_0x73ee('0x67')]):this[_0x73ee('0xf')][_0x5401ca['queue']][_0x73ee('0x53')];this[_0x73ee('0x4a')](this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]],_0x73ee('0x12'));}logger[_0x73ee('0x40')](_0x73ee('0x68'),util[_0x73ee('0x36')](this[_0x73ee('0xf')][_0x5401ca[_0x73ee('0x61')]],{'showHidden':![],'depth':null}));ami[_0x73ee('0x3e')]('custom:queuesummary',this['voiceQueues'][_0x5401ca[_0x73ee('0x61')]]);}}}catch(_0x117725){logger[_0x73ee('0x35')](_0x73ee('0x69'),util[_0x73ee('0x36')](_0x117725,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x14')]=function(_0x3e2dcf){logger['debug'](_0x73ee('0x6a'),util[_0x73ee('0x36')](_0x3e2dcf,{'showHidden':![],'depth':null}));this[_0x73ee('0x10')]=!![];};VoiceQueueReport[_0x73ee('0x9')]['syncQueueCallerJoin']=function(_0x266a8e){try{if(this['isNotNull'](_0x266a8e)){logger[_0x73ee('0x40')](_0x73ee('0x6b'),_0x266a8e['uniqueid'],util[_0x73ee('0x36')](_0x266a8e,{'showHidden':![],'depth':null}));if(_[_0x73ee('0x5c')](this[_0x73ee('0x37')][_0x266a8e['uniqueid']])){this[_0x73ee('0x37')][_0x266a8e[_0x73ee('0x43')]]=[];this[_0x73ee('0x2e')][_0x266a8e['uniqueid']]={};}var _0x469fcf=new QueueReport();_0x469fcf[_0x73ee('0x46')]=_0x266a8e[_0x73ee('0x61')];_0x469fcf['type']=this['voiceQueues'][_0x469fcf[_0x73ee('0x46')]]&&this['voiceQueues'][_0x469fcf[_0x73ee('0x46')]][_0x73ee('0x4b')]?this['voiceQueues'][_0x469fcf['name']][_0x73ee('0x4b')]||_0x73ee('0x4c'):_0x73ee('0x4c');_0x469fcf[_0x73ee('0x61')]=_0x266a8e[_0x73ee('0x61')];_0x469fcf['queuecallerjoinAt']=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x469fcf[_0x73ee('0x6c')]=_0x266a8e['position'];_0x469fcf['count']=_0x266a8e[_0x73ee('0x6d')];_0x469fcf[_0x73ee('0x43')]=_0x266a8e[_0x73ee('0x43')];logger[_0x73ee('0x63')](_0x73ee('0x6e'),_0x469fcf[_0x73ee('0x46')],_0x469fcf[_0x73ee('0x4b')]);_[_0x73ee('0x6f')](_0x469fcf,_[_0x73ee('0x70')](_0x266a8e,_['keys'](_0x469fcf)));this['queueReports'][_0x266a8e[_0x73ee('0x43')]]['push'](_0x469fcf);this[_0x73ee('0x2e')][_0x266a8e[_0x73ee('0x43')]]=_0x469fcf;this[_0x73ee('0x3f')](_0x469fcf,_0x73ee('0x15'));}}catch(_0x59032e){logger['error'](_0x73ee('0x6b'),_0x266a8e[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x59032e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x71')]=function(_0x58e51b){try{if(this['isNotNull'](_0x58e51b)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x58e51b[_0x73ee('0x43')],util['inspect'](_0x58e51b,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x58e51b[_0x73ee('0x43')]]){var _0x3cca1f=_[_0x73ee('0x72')](this['queueReports'][_0x58e51b[_0x73ee('0x43')]]);_0x3cca1f['queuecallercomplete']=![];_0x3cca1f[_0x73ee('0x73')]=null;_0x3cca1f[_0x73ee('0x74')]=_0x58e51b[_0x73ee('0x74')];_0x3cca1f[_0x73ee('0x75')]=_0x58e51b[_0x73ee('0x75')];_0x3cca1f[_0x73ee('0x76')]=!![];_0x3cca1f[_0x73ee('0x77')]=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cca1f[_0x73ee('0x78')]=_0x73ee('0x79');_0x3cca1f[_0x73ee('0x7a')]=null;logger[_0x73ee('0x63')](_0x73ee('0x7b'),_0x3cca1f[_0x73ee('0x46')],_0x3cca1f[_0x73ee('0x4b')]);this['channels'][_0x58e51b[_0x73ee('0x43')]]=_0x3cca1f;this[_0x73ee('0x3c')](_0x3cca1f,_0x73ee('0x76'));}}}catch(_0x3f1dab){logger['error'](_0x73ee('0x7c'),_0x58e51b[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x3f1dab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x7d')]=function(_0x3120b0){try{if(this['isNotNull'](_0x3120b0)){logger[_0x73ee('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x3120b0[_0x73ee('0x43')],util['inspect'](_0x3120b0,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x3120b0[_0x73ee('0x43')]]){var _0x3406e4=_['last'](this['queueReports'][_0x3120b0[_0x73ee('0x43')]]);_0x3406e4[_0x73ee('0x7e')]=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x3406e4[_0x73ee('0x7f')]=_0x3120b0[_0x73ee('0x7f')];_0x3406e4[_0x73ee('0x80')]=_0x3120b0[_0x73ee('0x80')];logger['info'](_0x73ee('0x81'),_0x3406e4[_0x73ee('0x46')],_0x3406e4['type'],_0x3120b0[_0x73ee('0x7f')],_0x3120b0[_0x73ee('0x80')]);this[_0x73ee('0x2e')][_0x3120b0[_0x73ee('0x43')]]=_0x3406e4;this[_0x73ee('0x3f')](_0x3406e4,_0x73ee('0x17'));}}}catch(_0x171540){logger['error'](_0x73ee('0x82'),_0x3120b0[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x171540,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')]['syncAgentConnect']=function(_0x447e8e){try{if(this[_0x73ee('0x5b')](_0x447e8e)){logger[_0x73ee('0x40')](_0x73ee('0x83'),_0x447e8e['uniqueid'],util[_0x73ee('0x36')](_0x447e8e,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x447e8e[_0x73ee('0x43')]]){var _0x201af1=_[_0x73ee('0x72')](this[_0x73ee('0x37')][_0x447e8e['uniqueid']]);_0x201af1[_0x73ee('0x84')]=!![];_0x201af1[_0x73ee('0x78')]=_0x73ee('0x85');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x201af1[_0x73ee('0x46')],_0x201af1[_0x73ee('0x4b')]);}}}catch(_0x23bed7){logger[_0x73ee('0x35')](_0x73ee('0x83'),_0x447e8e['uniqueid'],util['inspect'](_0x23bed7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x86')]=function(_0x18b9fc){try{if(this[_0x73ee('0x5b')](_0x18b9fc)){logger[_0x73ee('0x40')](_0x73ee('0x87'),_0x18b9fc[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x18b9fc,{'showHidden':![],'depth':null}));if(this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x43')]]){var _0x5c7215=_[_0x73ee('0x72')](this['queueReports'][_0x18b9fc[_0x73ee('0x43')]]);_0x5c7215[_0x73ee('0x76')]=![];_0x5c7215[_0x73ee('0x77')]=null;_0x5c7215[_0x73ee('0x88')]=!![];_0x5c7215[_0x73ee('0x7a')]=_0x18b9fc[_0x73ee('0x89')];_0x5c7215['holdtime']=_0x18b9fc[_0x73ee('0x74')];_0x5c7215[_0x73ee('0x84')]=!![];_0x5c7215[_0x73ee('0x8a')]=![];_0x5c7215[_0x73ee('0x8b')]=null;if(!_0x5c7215['transfer']){if(_0x18b9fc[_0x73ee('0x8c')]==_0x73ee('0x8d')){_0x5c7215['queuecallerexitreason']='COMPLETED';logger[_0x73ee('0x63')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5c7215['name'],_0x5c7215[_0x73ee('0x4b')]);}else{if(_[_0x73ee('0x8e')](_0x18b9fc[_0x73ee('0x8f')]['toLowerCase'](),'local/')){if(this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]]){var _0x320062=_[_0x73ee('0x72')](this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]]);_0x320062[_0x73ee('0x84')]=![];_0x320062[_0x73ee('0x8a')]=!![];_0x320062[_0x73ee('0x8b')]=moment(_0x5c7215['queuecallerjoinAt'])[_0x73ee('0x91')](_0x18b9fc[_0x73ee('0x74')],_0x73ee('0x92'))[_0x73ee('0x44')](_0x73ee('0x93'));_0x320062[_0x73ee('0x78')]='FORWARDTRANSFER';_0x320062[_0x73ee('0x8d')]=!![];_0x320062[_0x73ee('0x94')]=_0x73ee('0x95');_0x320062['transferexten']=_0x18b9fc[_0x73ee('0x96')];_0x320062[_0x73ee('0x97')]=_0x18b9fc['uniqueid'];logger[_0x73ee('0x63')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x320062[_0x73ee('0x46')],_0x320062[_0x73ee('0x4b')]);var _0xdc049f=this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]];this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x90')]]=this['queueReports'][_0x18b9fc[_0x73ee('0x43')]];this[_0x73ee('0x37')][_0x18b9fc[_0x73ee('0x43')]]=_0xdc049f;}}else{_0x5c7215[_0x73ee('0x78')]=_0x73ee('0x98')+_0x18b9fc['reason'][_0x73ee('0x99')]();logger[_0x73ee('0x63')](_0x73ee('0x9a'),_0x5c7215['name'],_0x5c7215[_0x73ee('0x4b')],_0x5c7215[_0x73ee('0x78')]);}}}this[_0x73ee('0x2e')][_0x18b9fc['uniqueid']]=_0x5c7215;this[_0x73ee('0x3c')](_0x5c7215,_0x73ee('0x9b'));}}}catch(_0xed3899){logger[_0x73ee('0x35')](_0x73ee('0x87'),_0x18b9fc[_0x73ee('0x43')],util[_0x73ee('0x36')](_0xed3899,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x1b')]=function(_0x5e21d0){try{if(this[_0x73ee('0x5b')](_0x5e21d0)){logger[_0x73ee('0x40')](_0x73ee('0x9c'),_0x5e21d0[_0x73ee('0x43')],util['inspect'](_0x5e21d0,{'showHidden':![],'depth':null}));this[_0x73ee('0x9d')](_0x5e21d0[_0x73ee('0x43')],_[_0x73ee('0x9e')](_0x5e21d0['variable'])[0x0],_0x5e21d0[_0x73ee('0x9f')]);if(this[_0x73ee('0x37')][_0x5e21d0[_0x73ee('0x43')]]){var _0x545e69=_[_0x73ee('0x72')](this[_0x73ee('0x37')][_0x5e21d0[_0x73ee('0x43')]]);if(_0x545e69){if(this['isNotNull'](_0x5e21d0['variable'])&&this[_0x73ee('0x5b')](_0x5e21d0[_0x73ee('0xa0')]['queuestatus'])){switch(_0x5e21d0[_0x73ee('0x9f')]){case _0x73ee('0xa1'):_0x545e69['queuecallerexit']=![];_0x545e69[_0x73ee('0x8b')]=null;break;case _0x73ee('0xa2'):_0x545e69[_0x73ee('0xa3')]=_0x73ee('0xa4');_0x545e69[_0x73ee('0x8a')]=!![];_0x545e69[_0x73ee('0x8b')]=moment()[_0x73ee('0x44')](_0x73ee('0x93'));_0x545e69[_0x73ee('0x7e')]=moment()[_0x73ee('0x44')](_0x73ee('0x93'));logger[_0x73ee('0x40')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5e21d0[_0x73ee('0x43')],util['inspect'](_0x545e69,{'showHidden':![],'depth':null}));ami[_0x73ee('0x3e')]('custom:timeout',_0x545e69);break;default:_0x545e69[_0x73ee('0x8a')]=!![];_0x545e69[_0x73ee('0x8b')]=moment()[_0x73ee('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x545e69[_0x73ee('0x7e')]=moment()[_0x73ee('0x44')](_0x73ee('0x93'));}_0x545e69[_0x73ee('0x76')]=![];_0x545e69['queuecallerabandonAt']=null;_0x545e69[_0x73ee('0x78')]=_0x5e21d0[_0x73ee('0x9f')];this[_0x73ee('0x2e')][_0x5e21d0['uniqueid']]=_0x545e69;this[_0x73ee('0x3c')](_0x545e69,_0x73ee('0x1a'));}else if(this['isNotNull'](_0x5e21d0['variable'])&&this[_0x73ee('0x5b')](_0x5e21d0[_0x73ee('0xa0')][_0x73ee('0xa5')])){if(!_0x545e69[_0x73ee('0x76')]){_0x545e69[_0x73ee('0x8a')]=!![];_0x545e69['queuecallerexitAt']=moment()['format'](_0x73ee('0x93'));_0x545e69['queuecallerexitreason']=_0x73ee('0xa6');_0x545e69[_0x73ee('0x7e')]=moment()['format'](_0x73ee('0x93'));this[_0x73ee('0x2e')][_0x5e21d0[_0x73ee('0x43')]]=_0x545e69;}}logger[_0x73ee('0x63')](_0x73ee('0xa7'),_0x5e21d0[_0x73ee('0x43')],_0x545e69[_0x73ee('0x46')],_0x545e69[_0x73ee('0x4b')],_['keys'](_0x5e21d0[_0x73ee('0xa0')])[0x0],_0x5e21d0['value']);_0x545e69[_0x73ee('0x11')]=this[_0x73ee('0x11')][_0x5e21d0['uniqueid']];}}}}catch(_0x583b79){logger[_0x73ee('0x35')](_0x73ee('0x9c'),_0x5e21d0[_0x73ee('0x43')],util[_0x73ee('0x36')](_0x583b79,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73ee('0x9')][_0x73ee('0x9d')]=function(_0x44b0c9,_0x29a7b3,_0x198f7f){var _0x1c3a7b=[_0x73ee('0xa8'),_0x73ee('0xa9'),'rtpaudioqosjitter',_0x73ee('0xaa'),_0x73ee('0xab'),_0x73ee('0xac'),_0x73ee('0xad'),_0x73ee('0xae'),_0x73ee('0xaf'),_0x73ee('0xb0'),'bridgepeer',_0x73ee('0xb1'),'membercalls',_0x73ee('0xb2'),_0x73ee('0xb3'),_0x73ee('0xb4'),_0x73ee('0x89'),_0x73ee('0xb5'),_0x73ee('0xb6')];if(!_[_0x73ee('0x30')](_0x29a7b3)&&!_[_0x73ee('0xb7')](_0x1c3a7b,_0x29a7b3)){if(_[_0x73ee('0x5c')](this[_0x73ee('0x11')][_0x44b0c9])){this['variables'][_0x44b0c9]={};}this[_0x73ee('0x11')][_0x44b0c9][_0x29a7b3]=_0x198f7f;}};VoiceQueueReport[_0x73ee('0x9')]['syncHangup']=function(_0x4f11fe){try{if(this['isNotNull'](_0x4f11fe)){logger[_0x73ee('0x40')](_0x73ee('0xb8'),_0x4f11fe[_0x73ee('0x43')],util['inspect'](_0x4f11fe,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4f11fe['uniqueid']]){for(var _0x1d77b0=0x0,_0x5372f6={};_0x1d77b00x0?_0x523e99:0x0;this[_0xc1dd('0x10')][_0x2eefbe[_0xc1dd('0x6b')]][_0xc1dd('0x5a')]=this[_0xc1dd('0x10')][_0x2eefbe[_0xc1dd('0x6b')]][_0xc1dd('0x5a')]>_[_0xc1dd('0x71')](_0x2eefbe['loggedin'])?_[_0xc1dd('0x71')](_0x2eefbe[_0xc1dd('0x72')]):this[_0xc1dd('0x10')][_0x2eefbe[_0xc1dd('0x6b')]][_0xc1dd('0x5a')];this[_0xc1dd('0x50')](this[_0xc1dd('0x10')][_0x2eefbe['queue']],_0xc1dd('0x14'));}logger[_0xc1dd('0x46')](_0xc1dd('0x73'),util[_0xc1dd('0x3e')](this[_0xc1dd('0x10')][_0x2eefbe[_0xc1dd('0x6b')]],{'showHidden':![],'depth':null}));ami['emit'](_0xc1dd('0x74'),this[_0xc1dd('0x10')][_0x2eefbe[_0xc1dd('0x6b')]]);}}}catch(_0x4e5284){logger[_0xc1dd('0x3c')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x4e5284,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc1dd('0x17')]=function(_0x5b39c4){logger[_0xc1dd('0x46')](_0xc1dd('0x75'),util[_0xc1dd('0x3e')](_0x5b39c4,{'showHidden':![],'depth':null}));this[_0xc1dd('0x11')]=!![];};VoiceQueueReport[_0xc1dd('0x3f')][_0xc1dd('0x19')]=function(_0x168ccb){try{if(this['isNotNull'](_0x168ccb)){logger[_0xc1dd('0x46')](_0xc1dd('0x76'),_0x168ccb['uniqueid'],util[_0xc1dd('0x3e')](_0x168ccb,{'showHidden':![],'depth':null}));if(_[_0xc1dd('0x65')](this[_0xc1dd('0xc')][_0x168ccb['uniqueid']])){this['queueReports'][_0x168ccb[_0xc1dd('0x4e')]]=[];this['channels'][_0x168ccb[_0xc1dd('0x4e')]]={};}var _0x43b5ac=new QueueReport();_0x43b5ac[_0xc1dd('0x4a')]=_0x168ccb['queue'];_0x43b5ac[_0xc1dd('0x51')]=this[_0xc1dd('0x10')][_0x43b5ac[_0xc1dd('0x4a')]]&&this[_0xc1dd('0x10')][_0x43b5ac['name']]['type']?this[_0xc1dd('0x10')][_0x43b5ac[_0xc1dd('0x4a')]]['type']||_0xc1dd('0x52'):_0xc1dd('0x52');_0x43b5ac[_0xc1dd('0x6b')]=_0x168ccb[_0xc1dd('0x6b')];_0x43b5ac['queuecallerjoinAt']=moment()['format'](_0xc1dd('0x77'));_0x43b5ac[_0xc1dd('0x78')]=_0x168ccb[_0xc1dd('0x78')];_0x43b5ac['count']=_0x168ccb[_0xc1dd('0x79')];_0x43b5ac['uniqueid']=_0x168ccb[_0xc1dd('0x4e')];logger[_0xc1dd('0x6d')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x43b5ac['name'],_0x43b5ac[_0xc1dd('0x51')]);_[_0xc1dd('0x7a')](_0x43b5ac,_[_0xc1dd('0x7b')](_0x168ccb,_[_0xc1dd('0x7c')](_0x43b5ac)));this[_0xc1dd('0xc')][_0x168ccb[_0xc1dd('0x4e')]][_0xc1dd('0x7d')](_0x43b5ac);this['channels'][_0x168ccb[_0xc1dd('0x4e')]]=_0x43b5ac;this[_0xc1dd('0x45')](_0x43b5ac,'queuecallerjoin');}}catch(_0x22a9f3){logger['error'](_0xc1dd('0x76'),_0x168ccb[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0x22a9f3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x19cb94){try{if(this[_0xc1dd('0x64')](_0x19cb94)){logger[_0xc1dd('0x46')](_0xc1dd('0x7e'),_0x19cb94[_0xc1dd('0x4e')],util['inspect'](_0x19cb94,{'showHidden':![],'depth':null}));if(this[_0xc1dd('0xc')][_0x19cb94[_0xc1dd('0x4e')]]){var _0x49cfc4=_[_0xc1dd('0x7f')](this[_0xc1dd('0xc')][_0x19cb94['uniqueid']]);_0x49cfc4['queuecallercomplete']=![];_0x49cfc4[_0xc1dd('0x80')]=null;_0x49cfc4[_0xc1dd('0x81')]=_0x19cb94[_0xc1dd('0x81')];_0x49cfc4[_0xc1dd('0x82')]=_0x19cb94[_0xc1dd('0x82')];_0x49cfc4['queuecallerabandon']=!![];_0x49cfc4[_0xc1dd('0x83')]=moment()['format'](_0xc1dd('0x77'));_0x49cfc4[_0xc1dd('0x84')]=_0xc1dd('0x85');_0x49cfc4['lastAssignedTo']=null;logger[_0xc1dd('0x6d')](_0xc1dd('0x86'),_0x49cfc4[_0xc1dd('0x4a')],_0x49cfc4[_0xc1dd('0x51')]);this['channels'][_0x19cb94[_0xc1dd('0x4e')]]=_0x49cfc4;this[_0xc1dd('0x42')](_0x49cfc4,'queuecallerabandon');}}}catch(_0x203600){logger['error'](_0xc1dd('0x7e'),_0x19cb94[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0x203600,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc1dd('0x3f')][_0xc1dd('0x1c')]=function(_0x11bdd8){try{if(this[_0xc1dd('0x64')](_0x11bdd8)){logger[_0xc1dd('0x46')](_0xc1dd('0x87'),_0x11bdd8['uniqueid'],util['inspect'](_0x11bdd8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x11bdd8[_0xc1dd('0x4e')]]){var _0x5dbbc3=_[_0xc1dd('0x7f')](this[_0xc1dd('0xc')][_0x11bdd8[_0xc1dd('0x4e')]]);_0x5dbbc3[_0xc1dd('0x88')]=moment()[_0xc1dd('0x48')](_0xc1dd('0x77'));_0x5dbbc3[_0xc1dd('0x89')]=_0x11bdd8['connectedlinenum'];_0x5dbbc3[_0xc1dd('0x8a')]=_0x11bdd8['connectedlinename'];logger[_0xc1dd('0x6d')](_0xc1dd('0x8b'),_0x5dbbc3[_0xc1dd('0x4a')],_0x5dbbc3[_0xc1dd('0x51')],_0x11bdd8[_0xc1dd('0x89')],_0x11bdd8[_0xc1dd('0x8a')]);this[_0xc1dd('0xe')][_0x11bdd8['uniqueid']]=_0x5dbbc3;this[_0xc1dd('0x45')](_0x5dbbc3,_0xc1dd('0x1b'));}}}catch(_0x18b699){logger[_0xc1dd('0x3c')](_0xc1dd('0x87'),_0x11bdd8[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0x18b699,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc1dd('0x3f')][_0xc1dd('0x8c')]=function(_0xc826c){try{if(this[_0xc1dd('0x64')](_0xc826c)){logger[_0xc1dd('0x46')]('[%s][voiceQueueReport][agentconnect]',_0xc826c[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0xc826c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xc826c[_0xc1dd('0x4e')]]){var _0x1ad555=_[_0xc1dd('0x7f')](this[_0xc1dd('0xc')][_0xc826c[_0xc1dd('0x4e')]]);_0x1ad555[_0xc1dd('0x8d')]=!![];_0x1ad555[_0xc1dd('0x84')]=_0xc1dd('0x8e');logger['info'](_0xc1dd('0x8f'),_0x1ad555['name'],_0x1ad555[_0xc1dd('0x51')]);}}}catch(_0x4a169e){logger[_0xc1dd('0x3c')]('[%s][voiceQueueReport][agentconnect]',_0xc826c[_0xc1dd('0x4e')],util['inspect'](_0x4a169e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc1dd('0x3f')][_0xc1dd('0x1d')]=function(_0x3a23a7){try{if(this['isNotNull'](_0x3a23a7)){logger[_0xc1dd('0x46')](_0xc1dd('0x90'),_0x3a23a7[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0x3a23a7,{'showHidden':![],'depth':null}));if(this[_0xc1dd('0xc')][_0x3a23a7[_0xc1dd('0x4e')]]){var _0x5f0d77=_['last'](this['queueReports'][_0x3a23a7['uniqueid']]);_0x5f0d77[_0xc1dd('0x91')]=![];_0x5f0d77[_0xc1dd('0x83')]=null;_0x5f0d77[_0xc1dd('0x92')]=!![];_0x5f0d77[_0xc1dd('0x93')]=_0x3a23a7[_0xc1dd('0x94')];_0x5f0d77[_0xc1dd('0x81')]=_0x3a23a7['holdtime'];_0x5f0d77[_0xc1dd('0x8d')]=!![];_0x5f0d77['queuecallerexit']=![];_0x5f0d77[_0xc1dd('0x95')]=null;if(!_0x5f0d77['transfer']){if(_0x3a23a7[_0xc1dd('0x96')]==_0xc1dd('0x97')){_0x5f0d77[_0xc1dd('0x84')]=_0xc1dd('0x98');logger[_0xc1dd('0x6d')](_0xc1dd('0x99'),_0x5f0d77['name'],_0x5f0d77['type']);}else{if(_[_0xc1dd('0x9a')](_0x3a23a7[_0xc1dd('0x39')][_0xc1dd('0x9b')](),_0xc1dd('0x9c'))){if(this['queueReports'][_0x3a23a7['linkedid']]){var _0x2b5ea4=_[_0xc1dd('0x7f')](this[_0xc1dd('0xc')][_0x3a23a7[_0xc1dd('0x9d')]]);_0x2b5ea4[_0xc1dd('0x8d')]=![];_0x2b5ea4[_0xc1dd('0x9e')]=!![];_0x2b5ea4[_0xc1dd('0x95')]=moment(_0x5f0d77[_0xc1dd('0x9f')])[_0xc1dd('0xa0')](_0x3a23a7[_0xc1dd('0x81')],_0xc1dd('0xa1'))[_0xc1dd('0x48')](_0xc1dd('0x77'));_0x2b5ea4[_0xc1dd('0x84')]=_0xc1dd('0xa2');_0x2b5ea4['transfer']=!![];_0x2b5ea4[_0xc1dd('0xa3')]='FORWARD';_0x2b5ea4[_0xc1dd('0xa4')]=_0x3a23a7['destexten'];_0x2b5ea4[_0xc1dd('0xa5')]=_0x3a23a7[_0xc1dd('0x4e')];logger[_0xc1dd('0x6d')](_0xc1dd('0xa6'),_0x2b5ea4[_0xc1dd('0x4a')],_0x2b5ea4[_0xc1dd('0x51')]);var _0xb25292=this[_0xc1dd('0xc')][_0x3a23a7['linkedid']];this[_0xc1dd('0xc')][_0x3a23a7['linkedid']]=this[_0xc1dd('0xc')][_0x3a23a7[_0xc1dd('0x4e')]];this[_0xc1dd('0xc')][_0x3a23a7[_0xc1dd('0x4e')]]=_0xb25292;}}else{_0x5f0d77['queuecallerexitreason']=_0xc1dd('0xa7')+_0x3a23a7['reason'][_0xc1dd('0xa8')]();logger[_0xc1dd('0x6d')](_0xc1dd('0xa9'),_0x5f0d77[_0xc1dd('0x4a')],_0x5f0d77['type'],_0x5f0d77[_0xc1dd('0x84')]);}}}this[_0xc1dd('0xe')][_0x3a23a7[_0xc1dd('0x4e')]]=_0x5f0d77;this[_0xc1dd('0x42')](_0x5f0d77,_0xc1dd('0xaa'));}}}catch(_0x34dd6a){logger[_0xc1dd('0x3c')](_0xc1dd('0x90'),_0x3a23a7['uniqueid'],util['inspect'](_0x34dd6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc1dd('0x3f')][_0xc1dd('0x20')]=function(_0x357dca){try{if(this[_0xc1dd('0x64')](_0x357dca)){logger['debug']('[%s][voiceQueueReport][varset]',_0x357dca[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0x357dca,{'showHidden':![],'depth':null}));this[_0xc1dd('0xab')](_0x357dca[_0xc1dd('0x4e')],_[_0xc1dd('0x7c')](_0x357dca[_0xc1dd('0xac')])[0x0],_0x357dca['value']);if(this['queueReports'][_0x357dca[_0xc1dd('0x4e')]]){var _0x181263=_[_0xc1dd('0x7f')](this[_0xc1dd('0xc')][_0x357dca[_0xc1dd('0x4e')]]);if(_0x181263){if(this[_0xc1dd('0x64')](_0x357dca[_0xc1dd('0xac')])&&this[_0xc1dd('0x64')](_0x357dca[_0xc1dd('0xac')][_0xc1dd('0xad')])){switch(_0x357dca[_0xc1dd('0xae')]){case _0xc1dd('0xaf'):_0x181263['queuecallerexit']=![];_0x181263[_0xc1dd('0x95')]=null;break;case _0xc1dd('0xb0'):_0x181263[_0xc1dd('0xb1')]=_0xc1dd('0xb2');_0x181263['queuecallerexit']=!![];_0x181263['queuecallerexitAt']=moment()[_0xc1dd('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x181263[_0xc1dd('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xc1dd('0x46')](_0xc1dd('0xb3'),_0x357dca[_0xc1dd('0x4e')],util['inspect'](_0x181263,{'showHidden':![],'depth':null}));ami[_0xc1dd('0x44')](_0xc1dd('0xb4'),_0x181263);break;default:_0x181263[_0xc1dd('0x9e')]=!![];_0x181263[_0xc1dd('0x95')]=moment()[_0xc1dd('0x48')](_0xc1dd('0x77'));_0x181263[_0xc1dd('0x88')]=moment()[_0xc1dd('0x48')](_0xc1dd('0x77'));}_0x181263[_0xc1dd('0x91')]=![];_0x181263[_0xc1dd('0x83')]=null;_0x181263[_0xc1dd('0x84')]=_0x357dca['value'];this[_0xc1dd('0xe')][_0x357dca[_0xc1dd('0x4e')]]=_0x181263;this[_0xc1dd('0x42')](_0x181263,'varset');}else if(this[_0xc1dd('0x64')](_0x357dca['variable'])&&this[_0xc1dd('0x64')](_0x357dca[_0xc1dd('0xac')][_0xc1dd('0xb5')])){if(!_0x181263[_0xc1dd('0x91')]){_0x181263[_0xc1dd('0x9e')]=!![];_0x181263[_0xc1dd('0x95')]=moment()[_0xc1dd('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x181263['queuecallerexitreason']=_0xc1dd('0xb6');_0x181263['queuecallerleaveAt']=moment()['format'](_0xc1dd('0x77'));this['channels'][_0x357dca['uniqueid']]=_0x181263;}}logger['info'](_0xc1dd('0xb7'),_0x357dca[_0xc1dd('0x4e')],_0x181263[_0xc1dd('0x4a')],_0x181263[_0xc1dd('0x51')],_['keys'](_0x357dca[_0xc1dd('0xac')])[0x0],_0x357dca[_0xc1dd('0xae')]);_0x181263['variables']=this[_0xc1dd('0x13')][_0x357dca[_0xc1dd('0x4e')]];}}}}catch(_0x1496ef){logger[_0xc1dd('0x3c')]('[%s][voiceQueueReport][varset]',_0x357dca[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0x1496ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc1dd('0x3f')][_0xc1dd('0xab')]=function(_0x9dba4e,_0x362b5e,_0xe0abce){var _0x36308e=[_0xc1dd('0xb8'),_0xc1dd('0xb9'),_0xc1dd('0xba'),'rtpaudioqosjitterbridged',_0xc1dd('0xbb'),_0xc1dd('0xbc'),'rtpaudioqosrtt',_0xc1dd('0xbd'),_0xc1dd('0xbe'),_0xc1dd('0xbf'),_0xc1dd('0xc0'),_0xc1dd('0xc1'),_0xc1dd('0xc2'),_0xc1dd('0xc3'),'memberinterface','memberlastcall',_0xc1dd('0x94'),'memberpenalty',_0xc1dd('0xc4')];if(!_[_0xc1dd('0xc5')](_0x362b5e)&&!_['includes'](_0x36308e,_0x362b5e)){if(_[_0xc1dd('0x65')](this['variables'][_0x9dba4e])){this[_0xc1dd('0x13')][_0x9dba4e]={};}this[_0xc1dd('0x13')][_0x9dba4e][_0x362b5e]=_0xe0abce;}};VoiceQueueReport[_0xc1dd('0x3f')][_0xc1dd('0x22')]=function(_0x96cfe3){try{if(this['isNotNull'](_0x96cfe3)){logger['debug'](_0xc1dd('0xc6'),_0x96cfe3[_0xc1dd('0x4e')],util[_0xc1dd('0x3e')](_0x96cfe3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x96cfe3[_0xc1dd('0x4e')]]){for(var _0x451049=0x0,_0x1ba6ee={};_0x451049=0x0?moment(_0x9ebbce[_0xe3c2('0x13')])[_0xe3c2('0xa')](_0x9ebbce[_0xe3c2('0x12')],'seconds'):null,'data1':_0xe3c2('0x14'),'data2':_0x9ebbce[_0xe3c2('0x15')],'data3':_0x9ebbce[_0xe3c2('0x16')],'data4':_0x9ebbce[_0xe3c2('0x17')]||null,'role':_0xe3c2('0xd'),'internal':_0x9ebbce[_0xe3c2('0x15')]?_[_0xe3c2('0x18')](_0x9ebbce[_0xe3c2('0x15')]):undefined,'uniqueid':_0x9ebbce[_0xe3c2('0x19')]},'log':_0xe3c2('0xe')});}; \ No newline at end of file +var _0x73ae=['TALKING','seconds','inbound','calleridnum','exten','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','diff','outbound','dialstring','moment','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','interface','SIP/%s','lastAssignedTo'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x73ae,0x185));var _0xe73a=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x73ae[_0x187ee1];return _0x388160;};'use strict';var moment=require(_0xe73a('0x0'));var _=require('lodash');var util=require('util');var client=require(_0xe73a('0x1'));exports[_0xe73a('0x2')]=function(_0xb638ba){var _0x564e5c=_0xb638ba[_0xe73a('0x3')]||_0xb638ba[_0xe73a('0x4')];return client[_0xe73a('0x5')](_0xe73a('0x6'),{'body':{'channel':_0xe73a('0x7'),'membername':_0xb638ba['lastAssignedTo'],'interface':_['isNil'](_0xb638ba[_0xe73a('0x8')])?util['format'](_0xe73a('0x9'),_0xb638ba[_0xe73a('0xa')]):_0xb638ba[_0xe73a('0x8')],'type':_0xe73a('0xb'),'enterAt':_0xb638ba['queuecallerleaveAt'],'exitAt':_0x564e5c,'duration':moment(_0x564e5c)['diff'](_0xb638ba['queuecallerleaveAt'],_0xe73a('0xc')),'data1':_0xe73a('0xd'),'data2':_0xb638ba[_0xe73a('0xe')],'data3':_0xb638ba[_0xe73a('0xf')],'data4':null,'data5':_0xb638ba['queue'],'role':'agent','internal':_0xb638ba[_0xe73a('0x10')]?_[_0xe73a('0x11')](_0xb638ba[_0xe73a('0x10')]):undefined,'uniqueid':_0xb638ba[_0xe73a('0x12')]},'log':_0xe73a('0x6')});};exports[_0xe73a('0x13')]=function(_0x5836eb){return client[_0xe73a('0x5')]('CreateMemberReport',{'body':{'channel':_0xe73a('0x7'),'membername':_0x5836eb['membername'],'interface':_0x5836eb[_0xe73a('0x8')],'type':_0xe73a('0xb'),'enterAt':_0x5836eb[_0xe73a('0x14')],'exitAt':_0x5836eb[_0xe73a('0x15')],'duration':moment(_0x5836eb[_0xe73a('0x15')])[_0xe73a('0x16')](_0x5836eb[_0xe73a('0x14')],_0xe73a('0xc'))>=0x0?moment(_0x5836eb[_0xe73a('0x15')])['diff'](_0x5836eb[_0xe73a('0x14')],_0xe73a('0xc')):null,'data1':_0xe73a('0x17'),'data2':_0x5836eb['accountcode'],'data3':_0x5836eb['exten'],'data4':_0x5836eb[_0xe73a('0x18')]||null,'role':'agent','internal':_0x5836eb[_0xe73a('0x10')]?_[_0xe73a('0x11')](_0x5836eb['accountcode']):undefined,'uniqueid':_0x5836eb['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a25e3c4..5957a10 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 _0x41bb=['name','html','../client','getTemplates','GetTemplate'];(function(_0x257333,_0x3c70d9){var _0x3c9f78=function(_0x1a8108){while(--_0x1a8108){_0x257333['push'](_0x257333['shift']());}};_0x3c9f78(++_0x3c70d9);}(_0x41bb,0xc5));var _0xb41b=function(_0x252566,_0x5a86e6){_0x252566=_0x252566-0x0;var _0x308920=_0x41bb[_0x252566];return _0x308920;};'use strict';var client=require(_0xb41b('0x0'));exports[_0xb41b('0x1')]=function(_0x4ef2f1){return function(_0x428431){return client['Request'](_0xb41b('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb41b('0x3'),_0xb41b('0x4')]},'log':_0xb41b('0x2')});};}; \ No newline at end of file +var _0x91a7=['getTemplates','GetTemplate','html'];(function(_0x3631c4,_0x212ea0){var _0x46738d=function(_0x48b247){while(--_0x48b247){_0x3631c4['push'](_0x3631c4['shift']());}};_0x46738d(++_0x212ea0);}(_0x91a7,0xe7));var _0x791a=function(_0x82da44,_0x4c6a31){_0x82da44=_0x82da44-0x0;var _0x27c376=_0x91a7[_0x82da44];return _0x27c376;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(_0x3d6eab){return function(_0x268862){return client['Request'](_0x791a('0x1'),{'options':{'raw':!![],'attributes':['id','name',_0x791a('0x2')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fd8326a..0cf0426 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 _0xae5f=['AnyConditions','Actions','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','field','operator','value','Condition'];(function(_0x36ceef,_0x5d166e){var _0x1cf645=function(_0x4d9dcf){while(--_0x4d9dcf){_0x36ceef['push'](_0x36ceef['shift']());}};_0x1cf645(++_0x5d166e);}(_0xae5f,0x126));var _0xfae5=function(_0x47f554,_0x449cba){_0x47f554=_0x47f554-0x0;var _0x4fbb73=_0xae5f[_0x47f554];return _0x4fbb73;};'use strict';var client=require(_0xfae5('0x0'));exports[_0xfae5('0x1')]=function(_0x27fb7f){return function(_0x51e99a){return client[_0xfae5('0x2')](_0xfae5('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xfae5('0x4'),_0xfae5('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xfae5('0x6'),_0xfae5('0x7'),_0xfae5('0x8')]},{'model':_0xfae5('0x9'),'as':_0xfae5('0xa'),'attributes':['id',_0xfae5('0x6'),_0xfae5('0x7'),_0xfae5('0x8')]},{'model':'Action','as':_0xfae5('0xb'),'attributes':['id',_0xfae5('0xc'),_0xfae5('0xd'),'data2',_0xfae5('0xe'),_0xfae5('0xf'),_0xfae5('0x10'),_0xfae5('0x11'),_0xfae5('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xc193=['GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request'];(function(_0x2df13c,_0x4b08c5){var _0x3adadf=function(_0x189856){while(--_0x189856){_0x2df13c['push'](_0x2df13c['shift']());}};_0x3adadf(++_0x4b08c5);}(_0xc193,0x18d));var _0x3c19=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc193[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x3c19('0x0'));exports[_0x3c19('0x1')]=function(_0x25c782){return function(_0x3a1986){return client[_0x3c19('0x2')](_0x3c19('0x3'),{'options':{'raw':![],'attributes':['id',_0x3c19('0x4'),_0x3c19('0x5'),_0x3c19('0x6')],'include':[{'model':_0x3c19('0x7'),'as':_0x3c19('0x8'),'attributes':['id',_0x3c19('0x9'),_0x3c19('0xa'),_0x3c19('0xb')]},{'model':_0x3c19('0x7'),'as':_0x3c19('0xc'),'attributes':['id','field','operator',_0x3c19('0xb')]},{'model':_0x3c19('0xd'),'as':'Actions','attributes':['id','action','data1',_0x3c19('0xe'),_0x3c19('0xf'),_0x3c19('0x10'),_0x3c19('0x11'),_0x3c19('0x12'),_0x3c19('0x13')]}]},'log':_0x3c19('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f7ece28..699496a 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 _0xb012=['Request','GetTrunk','registry','../client','getTrunks'];(function(_0x5d10f4,_0x4b9fac){var _0x2baf41=function(_0x1fbfe0){while(--_0x1fbfe0){_0x5d10f4['push'](_0x5d10f4['shift']());}};_0x2baf41(++_0x4b9fac);}(_0xb012,0x139));var _0x2b01=function(_0x13b341,_0x5b1a41){_0x13b341=_0x13b341-0x0;var _0xf259aa=_0xb012[_0x13b341];return _0xf259aa;};'use strict';var client=require(_0x2b01('0x0'));exports[_0x2b01('0x1')]=function(_0x54c322){return function(_0x497886){return client[_0x2b01('0x2')](_0x2b01('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x2b01('0x4')]},'log':_0x2b01('0x3')});};}; \ No newline at end of file +var _0x07da=['Request','GetTrunk','name','../client','getTrunks'];(function(_0x53264c,_0x54ae61){var _0x436567=function(_0x34afb6){while(--_0x34afb6){_0x53264c['push'](_0x53264c['shift']());}};_0x436567(++_0x54ae61);}(_0x07da,0x116));var _0xa07d=function(_0x251e5d,_0x28fb57){_0x251e5d=_0x251e5d-0x0;var _0x8d6737=_0x07da[_0x251e5d];return _0x8d6737;};'use strict';var client=require(_0xa07d('0x0'));exports[_0xa07d('0x1')]=function(_0xe2f873){return function(_0x532045){return client[_0xa07d('0x2')](_0xa07d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa07d('0x4'),'registry']},'log':_0xa07d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c7f5e14..f87cbb7 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 _0xb8ea=['ShowUser','online','lastLoginAt','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb8ea,0xcb));var _0xab8e=function(_0x20dea2,_0x4282dd){_0x20dea2=_0x20dea2-0x0;var _0x34b985=_0xb8ea[_0x20dea2];return _0x34b985;};'use strict';var client=require(_0xab8e('0x0'));exports[_0xab8e('0x1')]=function(){return function(){return client[_0xab8e('0x2')](_0xab8e('0x3'),{'options':{'raw':![],'where':{'role':_0xab8e('0x4')},'attributes':['id',_0xab8e('0x5'),_0xab8e('0x6'),_0xab8e('0x7'),_0xab8e('0x8'),'online','lastLoginAt',_0xab8e('0x9'),_0xab8e('0xa'),_0xab8e('0xb'),_0xab8e('0xc'),_0xab8e('0xd'),_0xab8e('0xe')]},'log':_0xab8e('0x1')});};};exports[_0xab8e('0xf')]=function(){return function(){return client[_0xab8e('0x2')](_0xab8e('0x3'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id','name',_0xab8e('0x7'),_0xab8e('0x10')]},'log':_0xab8e('0xf')});};};exports[_0xab8e('0x11')]=function(_0xcfd513,_0x9dad57,_0x2a27a3){return client[_0xab8e('0x2')](_0xab8e('0x12'),{'body':{'type':_0x9dad57,'uniqueid':_0x2a27a3},'options':{'where':{'id':_0xcfd513['id']}},'log':_0xab8e('0x11')});};exports[_0xab8e('0x13')]=function(_0x42a92e){return client['Request'](_0xab8e('0x14'),{'body':{},'options':{'where':{'id':_0x42a92e['id']}},'log':_0xab8e('0x11')});};exports[_0xab8e('0x15')]=function(_0x2a3a55){return client[_0xab8e('0x2')](_0xab8e('0x16'),{'options':{'raw':![],'where':{'role':_0xab8e('0x4'),'id':_0x2a3a55},'attributes':['id',_0xab8e('0x5'),_0xab8e('0x6'),_0xab8e('0x7'),'fullname',_0xab8e('0x17'),_0xab8e('0x18'),_0xab8e('0x9'),_0xab8e('0xa'),_0xab8e('0xb'),_0xab8e('0xe')]},'log':'getAgent'});}; \ No newline at end of file +var _0x2ba6=['voicePause','phone','mobile','interface','GetUser','internal','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','lastLoginAt','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','pauseType','lastPauseAt'];(function(_0x595e36,_0x3a5ed4){var _0x3f1b51=function(_0x47de9d){while(--_0x47de9d){_0x595e36['push'](_0x595e36['shift']());}};_0x3f1b51(++_0x3a5ed4);}(_0x2ba6,0x1bd));var _0x62ba=function(_0x5e01d8,_0x33dcf2){_0x5e01d8=_0x5e01d8-0x0;var _0x1819bb=_0x2ba6[_0x5e01d8];return _0x1819bb;};'use strict';var client=require(_0x62ba('0x0'));exports[_0x62ba('0x1')]=function(){return function(){return client[_0x62ba('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x62ba('0x3')},'attributes':['id',_0x62ba('0x4'),_0x62ba('0x5'),_0x62ba('0x6'),_0x62ba('0x7'),_0x62ba('0x8'),'lastLoginAt',_0x62ba('0x9'),_0x62ba('0xa'),_0x62ba('0xb'),_0x62ba('0xc'),_0x62ba('0xd'),_0x62ba('0xe')]},'log':_0x62ba('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0x62ba('0x2')](_0x62ba('0xf'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x62ba('0x4'),'accountcode',_0x62ba('0x10')]},'log':_0x62ba('0x11')});};};exports[_0x62ba('0x12')]=function(_0x59ac92,_0x4ca794,_0x196d9b){return client[_0x62ba('0x2')](_0x62ba('0x13'),{'body':{'type':_0x4ca794,'uniqueid':_0x196d9b},'options':{'where':{'id':_0x59ac92['id']}},'log':_0x62ba('0x12')});};exports[_0x62ba('0x14')]=function(_0x42e1e0){return client[_0x62ba('0x2')](_0x62ba('0x15'),{'body':{},'options':{'where':{'id':_0x42e1e0['id']}},'log':'savePause'});};exports[_0x62ba('0x16')]=function(_0x1008c1){return client[_0x62ba('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x62ba('0x3'),'id':_0x1008c1},'attributes':['id',_0x62ba('0x4'),_0x62ba('0x5'),'accountcode',_0x62ba('0x7'),_0x62ba('0x8'),_0x62ba('0x17'),_0x62ba('0x9'),_0x62ba('0xa'),_0x62ba('0xb'),_0x62ba('0xe')]},'log':_0x62ba('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index abf07ae..11cc8f4 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 _0xab9e=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x195d6e,_0x1b8568){var _0x21a1a4=function(_0x5b0465){while(--_0x5b0465){_0x195d6e['push'](_0x195d6e['shift']());}};_0x21a1a4(++_0x1b8568);}(_0xab9e,0x6e));var _0xeab9=function(_0x29cd3d,_0x575338){_0x29cd3d=_0x29cd3d-0x0;var _0x5ac833=_0xab9e[_0x29cd3d];return _0x5ac833;};'use strict';var client=require(_0xeab9('0x0'));exports[_0xeab9('0x1')]=function(_0x4b80a4){return client['Request'](_0xeab9('0x2'),{'body':_0x4b80a4,'log':'CreateVoiceAgentReport'});};exports[_0xeab9('0x3')]=function(_0x5b6479,_0x5a8ffa,_0x2d587e){return client[_0xeab9('0x4')](_0xeab9('0x5'),{'body':_0x5b6479,'options':{'where':{'uniqueid':_0x5a8ffa,'interface':_0x2d587e,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x31ff=['UpdateVoiceAgentReport','../client','create','Request','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31ff,0xd3));var _0xf31f=function(_0x4ce960,_0x4258e9){_0x4ce960=_0x4ce960-0x0;var _0x43a9d1=_0x31ff[_0x4ce960];return _0x43a9d1;};'use strict';var client=require(_0xf31f('0x0'));exports[_0xf31f('0x1')]=function(_0x1f66b0){return client[_0xf31f('0x2')]('CreateVoiceAgentReport',{'body':_0x1f66b0,'log':'CreateVoiceAgentReport'});};exports[_0xf31f('0x3')]=function(_0x1ec8a0,_0x255a6b,_0x503965){return client[_0xf31f('0x2')](_0xf31f('0x4'),{'body':_0x1ec8a0,'options':{'where':{'uniqueid':_0x255a6b,'interface':_0x503965,'agentcomplete':!![]}},'log':_0xf31f('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3bc2b7b..20b20d1 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 _0x6423=['callerid','getVoiceCallReports','Request','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','context'];(function(_0x4cb919,_0x58cd59){var _0x5f3c0c=function(_0x3f45df){while(--_0x3f45df){_0x4cb919['push'](_0x4cb919['shift']());}};_0x5f3c0c(++_0x58cd59);}(_0x6423,0xfc));var _0x3642=function(_0x6bbfb5,_0x19113d){_0x6bbfb5=_0x6bbfb5-0x0;var _0x3850b8=_0x6423[_0x6bbfb5];return _0x3850b8;};'use strict';var moment=require(_0x3642('0x0'));var util=require(_0x3642('0x1'));var _=require(_0x3642('0x2'));var client=require(_0x3642('0x3'));exports[_0x3642('0x4')]=function(_0x158b39){return client['Request'](_0x3642('0x5'),{'body':_[_0x3642('0x6')](_0x158b39,{'source':_0x158b39['calleridnum'],'destinationcontext':_0x158b39[_0x3642('0x7')],'callerid':_0x158b39[_0x3642('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x3642('0x5')});};exports[_0x3642('0x9')]=function(){return function(){return client[_0x3642('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x3642('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0x3642('0xc')](_0x3642('0xd')),moment()[_0x3642('0xe')]('day')[_0x3642('0xc')](_0x3642('0xd'))]}},'attributes':[_0x3642('0xf'),_0x3642('0x10'),_0x3642('0x11'),_0x3642('0x12')]},'log':_0x3642('0x13')});};}; \ No newline at end of file +var _0x871c=['CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','endOf','format','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request'];(function(_0x30db17,_0x415e95){var _0x43199b=function(_0x1116ef){while(--_0x1116ef){_0x30db17['push'](_0x30db17['shift']());}};_0x43199b(++_0x415e95);}(_0x871c,0x1de));var _0xc871=function(_0x2449c1,_0x3ac7c5){_0x2449c1=_0x2449c1-0x0;var _0x147256=_0x871c[_0x2449c1];return _0x147256;};'use strict';var moment=require(_0xc871('0x0'));var util=require(_0xc871('0x1'));var _=require(_0xc871('0x2'));var client=require(_0xc871('0x3'));exports[_0xc871('0x4')]=function(_0x5e6c2a){return client[_0xc871('0x5')](_0xc871('0x6'),{'body':_[_0xc871('0x7')](_0x5e6c2a,{'source':_0x5e6c2a['calleridnum'],'destinationcontext':_0x5e6c2a[_0xc871('0x8')],'callerid':_0x5e6c2a[_0xc871('0x9')],'amaflags':_0xc871('0xa')}),'log':_0xc871('0x6')});};exports[_0xc871('0xb')]=function(){return function(){return client[_0xc871('0x5')](_0xc871('0xc'),{'options':{'where':{'type':[_0xc871('0xd')],'createdAt':{'$between':[moment()[_0xc871('0xe')](_0xc871('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xc871('0x10')]('day')[_0xc871('0x11')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xc871('0x12'),_0xc871('0x13'),_0xc871('0x14')]},'log':_0xc871('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index bf3ad0f..7c53f30 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 _0x582d=['create','CreateVoiceDialReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x582d,0x1d2));var _0xd582=function(_0x48df92,_0x4bac0e){_0x48df92=_0x48df92-0x0;var _0x500d4b=_0x582d[_0x48df92];return _0x500d4b;};'use strict';var client=require('../client');exports[_0xd582('0x0')]=function(_0x1eda61){return client['Request'](_0xd582('0x1'),{'body':_0x1eda61,'log':_0xd582('0x1')});}; \ No newline at end of file +var _0x51ce=['create','Request','CreateVoiceDialReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51ce,0xb7));var _0xe51c=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x51ce[_0x3b7a0c];return _0x3bb70f;};'use strict';var client=require(_0xe51c('0x0'));exports[_0xe51c('0x1')]=function(_0x11d274){return client[_0xe51c('0x2')]('CreateVoiceDialReport',{'body':_0x11d274,'log':_0xe51c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5970425..ff385cd 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 _0x0972=['recordingFormat','getVoiceExtensions','GetVoiceExtension'];(function(_0x3f33d1,_0x61ab6b){var _0x5ad48f=function(_0x42acdd){while(--_0x42acdd){_0x3f33d1['push'](_0x3f33d1['shift']());}};_0x5ad48f(++_0x61ab6b);}(_0x0972,0x64));var _0x2097=function(_0x43613a,_0x18c02f){_0x43613a=_0x43613a-0x0;var _0x501f59=_0x0972[_0x43613a];return _0x501f59;};'use strict';var client=require('../client');exports[_0x2097('0x0')]=function(){return function(){return client['Request'](_0x2097('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0x2097('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x2097('0x0')});};}; \ No newline at end of file +var _0x7044=['exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x454ec5,_0x348d27){var _0x11a570=function(_0x451d90){while(--_0x451d90){_0x454ec5['push'](_0x454ec5['shift']());}};_0x11a570(++_0x348d27);}(_0x7044,0x147));var _0x4704=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x7044[_0x8dc04d];return _0x2f5f28;};'use strict';var client=require(_0x4704('0x0'));exports[_0x4704('0x1')]=function(){return function(){return client[_0x4704('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x4704('0x3'),_0x4704('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x4704('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 12e1a98..85a6e75 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 _0x3fcb=['dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x4259c3,_0x16af87){var _0x1bcba5=function(_0x2c3778){while(--_0x2c3778){_0x4259c3['push'](_0x4259c3['shift']());}};_0x1bcba5(++_0x16af87);}(_0x3fcb,0x1dd));var _0xb3fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3fcb[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0xb3fc('0x0'));exports[_0xb3fc('0x1')]=function(){return function(){return client[_0xb3fc('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xb3fc('0x3'),_0xb3fc('0x4'),'acwTimeout','autopause',_0xb3fc('0x5'),_0xb3fc('0x6'),_0xb3fc('0x7'),_0xb3fc('0x8'),_0xb3fc('0x9'),_0xb3fc('0xa'),'dialPowerLevel',_0xb3fc('0xb'),'dialPredictiveOptimizationPercentage',_0xb3fc('0xc'),'dialOriginateCallerIdName',_0xb3fc('0xd'),_0xb3fc('0xe'),'dialQueueOptions',_0xb3fc('0xf'),_0xb3fc('0x10'),_0xb3fc('0x11'),_0xb3fc('0x12'),_0xb3fc('0x13'),'dialBusyRetryFrequency',_0xb3fc('0x14'),_0xb3fc('0x15'),_0xb3fc('0x16'),_0xb3fc('0x17'),_0xb3fc('0x18'),_0xb3fc('0x19'),_0xb3fc('0x1a'),_0xb3fc('0x1b'),_0xb3fc('0x1c'),_0xb3fc('0x1d'),_0xb3fc('0x1e'),_0xb3fc('0x1f'),_0xb3fc('0x20'),_0xb3fc('0x21'),_0xb3fc('0x22'),_0xb3fc('0x23'),_0xb3fc('0x24'),_0xb3fc('0x25'),_0xb3fc('0x26'),_0xb3fc('0x27'),'dialOrderByScheduledAt',_0xb3fc('0x28'),'dialAgiAfterHangupClient',_0xb3fc('0x29'),_0xb3fc('0x5'),_0xb3fc('0x2a'),_0xb3fc('0x2b'),_0xb3fc('0x2c'),_0xb3fc('0x2d'),'dialNoSuchNumberRetryFrequency',_0xb3fc('0x2e'),_0xb3fc('0x2f'),_0xb3fc('0x30'),_0xb3fc('0x31'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xb3fc('0x32'),_0xb3fc('0x33'),'mandatoryDisposition',_0xb3fc('0x34'),_0xb3fc('0x35')],'include':[{'model':_0xb3fc('0x36'),'as':'Trunk','attributes':['id',_0xb3fc('0x3'),_0xb3fc('0x37'),_0xb3fc('0x38')]},{'model':_0xb3fc('0x39'),'as':_0xb3fc('0x3a'),'attributes':['id',_0xb3fc('0x3')]},{'model':_0xb3fc('0x36'),'as':_0xb3fc('0x3b'),'attributes':['id',_0xb3fc('0x3'),_0xb3fc('0x37'),_0xb3fc('0x38')]},{'model':_0xb3fc('0x3c'),'as':'Interval','attributes':['id',_0xb3fc('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xb3fc('0x3'),_0xb3fc('0x3d')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x7fe0=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x7fe0,0xb1));var _0x07fe=function(_0xa10bd1,_0x467db){_0xa10bd1=_0xa10bd1-0x0;var _0x8a7167=_0x7fe0[_0xa10bd1];return _0x8a7167;};'use strict';var client=require(_0x07fe('0x0'));exports[_0x07fe('0x1')]=function(){return function(){return client['Request'](_0x07fe('0x2'),{'options':{'raw':![],'attributes':['id',_0x07fe('0x3'),_0x07fe('0x4'),_0x07fe('0x5'),_0x07fe('0x6'),_0x07fe('0x7'),_0x07fe('0x8'),_0x07fe('0x9'),_0x07fe('0xa'),_0x07fe('0xb'),_0x07fe('0xc'),_0x07fe('0xd'),_0x07fe('0xe'),_0x07fe('0xf'),_0x07fe('0x10'),_0x07fe('0x11'),_0x07fe('0x12'),'dialOriginateTimeout',_0x07fe('0x13'),_0x07fe('0x14'),'dialQueueProject',_0x07fe('0x15'),_0x07fe('0x16'),_0x07fe('0x17'),'dialBusyRetryFrequency',_0x07fe('0x18'),_0x07fe('0x19'),_0x07fe('0x1a'),_0x07fe('0x1b'),_0x07fe('0x1c'),_0x07fe('0x1d'),_0x07fe('0x1e'),_0x07fe('0x1f'),_0x07fe('0x20'),_0x07fe('0x21'),_0x07fe('0x22'),_0x07fe('0x23'),_0x07fe('0x24'),'dialAMDBetweenWordsSilence',_0x07fe('0x25'),_0x07fe('0x26'),_0x07fe('0x27'),_0x07fe('0x28'),_0x07fe('0x29'),_0x07fe('0x2a'),_0x07fe('0x2b'),_0x07fe('0x2c'),_0x07fe('0x2d'),_0x07fe('0x2e'),_0x07fe('0x7'),_0x07fe('0x2f'),_0x07fe('0x30'),_0x07fe('0x31'),_0x07fe('0x32'),_0x07fe('0x33'),'dialDropMaxRetry',_0x07fe('0x34'),_0x07fe('0x35'),_0x07fe('0x36'),'dialMachineMaxRetry',_0x07fe('0x37'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x07fe('0x38'),_0x07fe('0x39'),_0x07fe('0x3a')],'include':[{'model':_0x07fe('0x3b'),'as':'Trunk','attributes':['id','name',_0x07fe('0x3c'),_0x07fe('0x3d')]},{'model':_0x07fe('0x3e'),'as':_0x07fe('0x3f'),'attributes':['id',_0x07fe('0x3')]},{'model':_0x07fe('0x3b'),'as':_0x07fe('0x40'),'attributes':['id','name',_0x07fe('0x3c'),'active']},{'model':_0x07fe('0x41'),'as':'Interval','attributes':['id',_0x07fe('0x3')],'include':[{'model':_0x07fe('0x41'),'as':_0x07fe('0x42'),'attributes':['id','name','interval']}]}]},'log':_0x07fe('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 87a86a1..5eded7a 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 _0x4070=['../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment'];(function(_0x130942,_0x2bbf7e){var _0xf160b0=function(_0x5e08e9){while(--_0x5e08e9){_0x130942['push'](_0x130942['shift']());}};_0xf160b0(++_0x2bbf7e);}(_0x4070,0x12b));var _0x0407=function(_0x3cde59,_0x4106a2){_0x3cde59=_0x3cde59-0x0;var _0x176754=_0x4070[_0x3cde59];return _0x176754;};'use strict';var moment=require(_0x0407('0x0'));var _=require('lodash');var client=require(_0x0407('0x1'));exports[_0x0407('0x2')]=function(_0x2b9ac5){return client[_0x0407('0x3')](_0x0407('0x4'),{'body':_0x2b9ac5,'log':_0x0407('0x4')});};exports[_0x0407('0x5')]=function(){return function(){return client[_0x0407('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x0407('0x6')]('day')[_0x0407('0x7')](_0x0407('0x8')),moment()[_0x0407('0x9')]('day')['format'](_0x0407('0x8'))]}},'attributes':[_0x0407('0xa'),_0x0407('0xb'),_0x0407('0xc'),_0x0407('0xd'),_0x0407('0xe'),'queuecallercompleteAt',_0x0407('0xf'),_0x0407('0x10'),_0x0407('0x11'),_0x0407('0x12')]},'log':_0x0407('0x13')});};}; \ No newline at end of file +var _0x0483=['getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request'];(function(_0x4ab57a,_0x13bdbb){var _0x139405=function(_0x36dfb5){while(--_0x36dfb5){_0x4ab57a['push'](_0x4ab57a['shift']());}};_0x139405(++_0x13bdbb);}(_0x0483,0x114));var _0x3048=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0483[_0x3e44fa];return _0x2a0aba;};'use strict';var moment=require(_0x3048('0x0'));var _=require(_0x3048('0x1'));var client=require('../client');exports[_0x3048('0x2')]=function(_0x2893a3){return client[_0x3048('0x3')]('CreateVoiceQueueReport',{'body':_0x2893a3,'log':'CreateVoiceQueueReport'});};exports[_0x3048('0x4')]=function(){return function(){return client['Request'](_0x3048('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x3048('0x6')](_0x3048('0x7'))[_0x3048('0x8')](_0x3048('0x9')),moment()[_0x3048('0xa')](_0x3048('0x7'))[_0x3048('0x8')](_0x3048('0x9'))]}},'attributes':[_0x3048('0xb'),_0x3048('0xc'),_0x3048('0xd'),_0x3048('0xe'),'queuecallercomplete','queuecallercompleteAt',_0x3048('0xf'),_0x3048('0x10'),_0x3048('0x11'),_0x3048('0x12')]},'log':_0x3048('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index d9caa08..6f279dd 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 _0x8f22=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x5d5c48,_0x497d84){var _0x5c214c=function(_0x39b0f5){while(--_0x39b0f5){_0x5d5c48['push'](_0x5d5c48['shift']());}};_0x5c214c(++_0x497d84);}(_0x8f22,0x1e3));var _0x28f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f22[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x28f2('0x0'));exports[_0x28f2('0x1')]=function(_0x255cad){return function(){return client[_0x28f2('0x2')](_0x28f2('0x3'),{'options':{'where':{'VoiceQueueId':_0x255cad,'paused':!![]},'raw':!![]},'log':_0x28f2('0x1')});};}; \ No newline at end of file +var _0xb804=['Request','../client','getVoiceQueueRtPauses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb804,0x1ae));var _0x4b80=function(_0x4e2867,_0x11f259){_0x4e2867=_0x4e2867-0x0;var _0x3c454b=_0xb804[_0x4e2867];return _0x3c454b;};'use strict';var client=require(_0x4b80('0x0'));exports[_0x4b80('0x1')]=function(_0x47566a){return function(){return client[_0x4b80('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x47566a,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ee23bfb..9e9659c 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 _0x4cf6=['monitorFilename','lodash','../client','create','CreateVoiceRecording','merge'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4cf6,0x1b7));var _0x64cf=function(_0x578e08,_0x31dd0d){_0x578e08=_0x578e08-0x0;var _0x256a53=_0x4cf6[_0x578e08];return _0x256a53;};'use strict';var _=require(_0x64cf('0x0'));var client=require(_0x64cf('0x1'));exports[_0x64cf('0x2')]=function(_0x13d538){return client['Request'](_0x64cf('0x3'),{'body':_[_0x64cf('0x4')](_0x13d538,{'value':_0x13d538[_0x64cf('0x5')]}),'log':_0x64cf('0x3')});}; \ No newline at end of file +var _0x9a9f=['monitorFilename','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0xcb9f5c,_0x496f91){var _0x49795a=function(_0x53d2aa){while(--_0x53d2aa){_0xcb9f5c['push'](_0xcb9f5c['shift']());}};_0x49795a(++_0x496f91);}(_0x9a9f,0x11b));var _0xf9a9=function(_0x168b8d,_0x536f06){_0x168b8d=_0x168b8d-0x0;var _0x4c6f06=_0x9a9f[_0x168b8d];return _0x4c6f06;};'use strict';var _=require(_0xf9a9('0x0'));var client=require(_0xf9a9('0x1'));exports[_0xf9a9('0x2')]=function(_0x1305c5){return client[_0xf9a9('0x3')](_0xf9a9('0x4'),{'body':_['merge'](_0x1305c5,{'value':_0x1305c5[_0xf9a9('0x5')]}),'log':_0xf9a9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 485ea73..ad60937 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 _0xe49d=['context','extension','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridname','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal'];(function(_0x165ba5,_0x35484d){var _0x485e4f=function(_0x5a795a){while(--_0x5a795a){_0x165ba5['push'](_0x165ba5['shift']());}};_0x485e4f(++_0x35484d);}(_0xe49d,0x84));var _0xde49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe49d[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xde49('0x0'));exports['transfers']={};exports[_0xde49('0x1')]=function(_0x450791){return client['Request'](_0xde49('0x2'),{'body':{'result':_0x450791[_0xde49('0x3')],'transfererchannel':_0x450791[_0xde49('0x4')],'transferercalleridnum':_0x450791['transferercalleridnum'],'transferercalleridname':_0x450791[_0xde49('0x5')],'transfererconnectedlinenum':_0x450791[_0xde49('0x6')],'transfererconnectedlinename':_0x450791[_0xde49('0x7')],'transfereraccountcode':_0x450791[_0xde49('0x8')],'transferercontext':_0x450791['transferercontext'],'transfererexten':_0x450791[_0xde49('0x9')],'transfererlinkedid':_0x450791['transfererlinkedid'],'transfereechannel':_0x450791[_0xde49('0xa')],'transfereecalleridnum':_0x450791['transfereecalleridnum'],'transfereecalleridname':_0x450791[_0xde49('0xb')],'transfereeconnectedlinenum':_0x450791['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x450791['transfereeconnectedlinename'],'transfereeaccountcode':_0x450791[_0xde49('0xc')],'transfereecontext':_0x450791['transfereecontext'],'transfereeexten':_0x450791[_0xde49('0xd')],'transfereelinkedid':_0x450791[_0xde49('0xe')],'isexternal':_0x450791[_0xde49('0xf')],'context':_0x450791[_0xde49('0x10')],'extension':_0x450791[_0xde49('0x11')],'type':'blind'},'log':_0xde49('0x2')});};exports[_0xde49('0x12')]=function(_0x40a1e4){return client[_0xde49('0x13')](_0xde49('0x2'),{'body':{'result':_0x40a1e4[_0xde49('0x3')],'transfererchannel':_0x40a1e4['origtransfererchannel'],'transferercalleridnum':_0x40a1e4[_0xde49('0x14')],'transferercalleridname':_0x40a1e4[_0xde49('0x15')],'transfererconnectedlinenum':_0x40a1e4[_0xde49('0x16')],'transfererconnectedlinename':_0x40a1e4[_0xde49('0x17')],'transfereraccountcode':_0x40a1e4[_0xde49('0x18')],'transferercontext':_0x40a1e4[_0xde49('0x19')],'transfererexten':_0x40a1e4[_0xde49('0x1a')],'transfererlinkedid':_0x40a1e4[_0xde49('0x1b')],'transfereechannel':_0x40a1e4[_0xde49('0x1c')],'transfereecalleridnum':_0x40a1e4[_0xde49('0x1d')],'transfereecalleridname':_0x40a1e4[_0xde49('0x1e')],'transfereeconnectedlinenum':_0x40a1e4[_0xde49('0x1f')],'transfereeconnectedlinename':_0x40a1e4['transfertargetconnectedlinename'],'transfereeaccountcode':_0x40a1e4['transfertargetaccountcode'],'transfereecontext':_0x40a1e4[_0xde49('0x20')],'transfereeexten':_0x40a1e4[_0xde49('0x21')],'transfereelinkedid':_0x40a1e4[_0xde49('0x22')],'isexternal':_0x40a1e4['isexternal'],'context':_0x40a1e4['origtransferercontext'],'extension':_0x40a1e4[_0xde49('0x23')],'type':_0xde49('0x24')},'log':_0xde49('0x2')});}; \ No newline at end of file +var _0xcd11=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','extension','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x16f5d5,_0x184bb0){var _0x1b9f8c=function(_0x224d6d){while(--_0x224d6d){_0x16f5d5['push'](_0x16f5d5['shift']());}};_0x1b9f8c(++_0x184bb0);}(_0xcd11,0x161));var _0x1cd1=function(_0x14bf22,_0x36fa3c){_0x14bf22=_0x14bf22-0x0;var _0x5f46b8=_0xcd11[_0x14bf22];return _0x5f46b8;};'use strict';var client=require('../client');exports[_0x1cd1('0x0')]={};exports[_0x1cd1('0x1')]=function(_0x2be6fe){return client['Request'](_0x1cd1('0x2'),{'body':{'result':_0x2be6fe[_0x1cd1('0x3')],'transfererchannel':_0x2be6fe['transfererchannel'],'transferercalleridnum':_0x2be6fe[_0x1cd1('0x4')],'transferercalleridname':_0x2be6fe['transferercalleridname'],'transfererconnectedlinenum':_0x2be6fe[_0x1cd1('0x5')],'transfererconnectedlinename':_0x2be6fe['transfererconnectedlinename'],'transfereraccountcode':_0x2be6fe[_0x1cd1('0x6')],'transferercontext':_0x2be6fe[_0x1cd1('0x7')],'transfererexten':_0x2be6fe[_0x1cd1('0x8')],'transfererlinkedid':_0x2be6fe[_0x1cd1('0x9')],'transfereechannel':_0x2be6fe[_0x1cd1('0xa')],'transfereecalleridnum':_0x2be6fe[_0x1cd1('0xb')],'transfereecalleridname':_0x2be6fe[_0x1cd1('0xc')],'transfereeconnectedlinenum':_0x2be6fe[_0x1cd1('0xd')],'transfereeconnectedlinename':_0x2be6fe[_0x1cd1('0xe')],'transfereeaccountcode':_0x2be6fe[_0x1cd1('0xf')],'transfereecontext':_0x2be6fe[_0x1cd1('0x10')],'transfereeexten':_0x2be6fe[_0x1cd1('0x11')],'transfereelinkedid':_0x2be6fe['transfereelinkedid'],'isexternal':_0x2be6fe[_0x1cd1('0x12')],'context':_0x2be6fe['context'],'extension':_0x2be6fe[_0x1cd1('0x13')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x1cd1('0x14')]=function(_0x482385){return client[_0x1cd1('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x482385['result'],'transfererchannel':_0x482385[_0x1cd1('0x16')],'transferercalleridnum':_0x482385[_0x1cd1('0x17')],'transferercalleridname':_0x482385[_0x1cd1('0x18')],'transfererconnectedlinenum':_0x482385[_0x1cd1('0x19')],'transfererconnectedlinename':_0x482385[_0x1cd1('0x1a')],'transfereraccountcode':_0x482385[_0x1cd1('0x1b')],'transferercontext':_0x482385[_0x1cd1('0x1c')],'transfererexten':_0x482385[_0x1cd1('0x1d')],'transfererlinkedid':_0x482385[_0x1cd1('0x1e')],'transfereechannel':_0x482385[_0x1cd1('0x1f')],'transfereecalleridnum':_0x482385['transfertargetcalleridnum'],'transfereecalleridname':_0x482385[_0x1cd1('0x20')],'transfereeconnectedlinenum':_0x482385['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x482385[_0x1cd1('0x21')],'transfereeaccountcode':_0x482385[_0x1cd1('0x22')],'transfereecontext':_0x482385[_0x1cd1('0x23')],'transfereeexten':_0x482385['transfertargetexten'],'transfereelinkedid':_0x482385[_0x1cd1('0x24')],'isexternal':_0x482385[_0x1cd1('0x12')],'context':_0x482385['origtransferercontext'],'extension':_0x482385[_0x1cd1('0x25')],'type':'attended'},'log':_0x1cd1('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0767cc7..23cfe9b 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 _0x4f47=['MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','Hangup','voicequeuechannelredirect','context','telephones','trunks','outboundChannels','campaigns','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Action','then','message','username','command','Command','content','catch','voiceQueues','strategy','sumBillable','sumDuration','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','voicechannel','length','find','uniqueid','channel','format','filename','MixMonitor','monitors','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec'];(function(_0x4fa25f,_0x15464a){var _0x461e2b=function(_0x2bbeaa){while(--_0x2bbeaa){_0x4fa25f['push'](_0x4fa25f['shift']());}};_0x461e2b(++_0x15464a);}(_0x4f47,0x1a9));var _0x74f4=function(_0x44dfe6,_0x15b724){_0x44dfe6=_0x44dfe6-0x0;var _0x3ee733=_0x4f47[_0x44dfe6];return _0x3ee733;};'use strict';var _=require(_0x74f4('0x0'));var util=require(_0x74f4('0x1'));var jayson=require(_0x74f4('0x2'));var schema=require(_0x74f4('0x3'));var BPromise=require(_0x74f4('0x4'));var moment=require(_0x74f4('0x5'));var config=require(_0x74f4('0x6'));var properties=require('../properties');var ami=require(_0x74f4('0x7'));exports[_0x74f4('0x8')]=function(_0x4a4b51,_0x9697ca,_0x40ef8d){return new BPromise(function(_0x4a4ff0,_0x15379a){var _0x55b834={'QueuePause':function(_0x4c8c44){return new Promise(function(_0x47b374,_0x57401f){var _0x19879f=util['format'](_0x74f4('0x9'),_0x74f4('0xa'),_0x4c8c44[_0x74f4('0xb')]);if(_0x4a4b51[_0x74f4('0xc')]&&_0x4a4b51['timers'][_0x19879f]&&_0x4a4b51[_0x74f4('0xc')][_0x19879f][_0x74f4('0xd')]){_0x4a4b51[_0x74f4('0xc')][_0x19879f][_0x74f4('0xe')]();}if(_0x4a4b51[_0x74f4('0xf')][_0x19879f]){_0x4a4b51[_0x74f4('0xf')][_0x19879f][_0x74f4('0x10')]({'statePause':_0x4c8c44[_0x74f4('0x11')]?!![]:![]});}_0x47b374({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4516cf){var _0x32831b=this;return new Promise(function(_0x1e76e2,_0x180b35){if(ami[_0x74f4('0x12')]()==![]){return _0x180b35(_0x32831b[_0x74f4('0x13')](0x1f4,[config[_0x74f4('0x14')]['ip'],config[_0x74f4('0x14')]['username'],_0x74f4('0x15')][_0x74f4('0x16')]('\x20')));}_0x4516cf=_[_0x74f4('0x17')](_0x4516cf,_[_0x74f4('0x18')](properties[_0x74f4('0x19')]));_0x4516cf[_0x74f4('0x1a')]='Reload';return ami[_0x74f4('0x1b')](_0x4516cf)[_0x74f4('0x1c')](function(_0x5b71ee){_0x1e76e2({'code':0xc8,'message':_0x5b71ee[_0x74f4('0x1d')]});})['catch'](function(_0x174cdf){_0x180b35(_0x32831b['error'](0x1f5,_0x174cdf[_0x74f4('0x1d')]));});});},'Command':function(_0x4d44e6){var _0x474977=this;return new Promise(function(_0x4ede14,_0x586f23){if(ami['isConnected']()==![]){return _0x586f23(_0x474977[_0x74f4('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x74f4('0x14')][_0x74f4('0x1e')],'ami\x20disconnected']['join']('\x20')));}_0x4d44e6=_[_0x74f4('0x17')](_0x4d44e6,_0x74f4('0x1f'));_0x4d44e6['action']=_0x74f4('0x20');return ami[_0x74f4('0x1b')](_0x4d44e6)[_0x74f4('0x1c')](function(_0x39d0dd){_0x4ede14({'code':0xc8,'message':_0x39d0dd[_0x74f4('0x21')]});})[_0x74f4('0x22')](function(_0x97f87c){_0x586f23(_0x474977['error'](0x1f5,_0x97f87c['message']));});});},'VoiceQueues':function(_0x1f539a){return new Promise(function(_0x5bb549,_0x55d05f){var _0x1ea6a3=[];for(var _0x24f703 in _0x4a4b51[_0x74f4('0x23')]){if(_0x4a4b51[_0x74f4('0x23')]['hasOwnProperty'](_0x24f703)){var _0x148302=_0x4a4b51[_0x74f4('0x23')][_0x24f703];var _0x1a7207={'id':_0x148302['id'],'name':_0x148302[_0x74f4('0xb')],'strategy':_0x148302[_0x74f4('0x24')],'answered':_0x148302['answered'],'available':_0x148302['available'],'loggedIn':_0x148302['loggedIn'],'pTalking':_0x148302['pTalking'],'sumBillable':_0x148302[_0x74f4('0x25')],'sumDuration':_0x148302[_0x74f4('0x26')],'sumHoldTime':_0x148302['sumHoldTime']||0x0,'talking':_0x148302['talking'],'total':_0x148302[_0x74f4('0x27')],'type':_0x148302[_0x74f4('0x28')],'unmanaged':_0x148302[_0x74f4('0x29')],'abandoned':_0x148302['abandoned'],'waiting':_0x148302[_0x74f4('0x2a')],'loggedInDb':_0x148302[_0x74f4('0x2b')]};if(_0x148302[_0x74f4('0x28')]===_0x74f4('0x2c')){_0x1a7207[_0x74f4('0x2d')]=_0x148302[_0x74f4('0x2d')];_0x1a7207[_0x74f4('0x2e')]=_0x148302['dialMethod'];_0x1a7207[_0x74f4('0x2f')]=_0x148302[_0x74f4('0x2f')];_0x1a7207['dialOriginateCallerIdNumber']=_0x148302[_0x74f4('0x30')];_0x1a7207[_0x74f4('0x31')]=_0x148302[_0x74f4('0x31')];_0x1a7207['dialPrefix']=_0x148302[_0x74f4('0x32')];_0x1a7207[_0x74f4('0x33')]=_0x148302['outboundAnswerAgiCallsDay'];_0x1a7207[_0x74f4('0x34')]=_0x148302[_0x74f4('0x34')];_0x1a7207[_0x74f4('0x35')]=_0x148302['outboundBlacklistCallsDay'];_0x1a7207['outboundBusyCallsDay']=_0x148302['outboundBusyCallsDay'];_0x1a7207[_0x74f4('0x36')]=_0x148302[_0x74f4('0x36')];_0x1a7207['outboundDropCallsDayACS']=_0x148302['outboundDropCallsDayACS'];_0x1a7207['outboundDropCallsDayCallersExit']=_0x148302[_0x74f4('0x37')];_0x1a7207['outboundDropCallsDayTimeout']=_0x148302[_0x74f4('0x38')];_0x1a7207[_0x74f4('0x39')]=_0x148302[_0x74f4('0x39')];_0x1a7207[_0x74f4('0x3a')]=_0x148302[_0x74f4('0x3a')];_0x1a7207[_0x74f4('0x3b')]=_0x148302['outboundOriginateFailureCallsDay'];_0x1a7207['outboundReCallsDay']=_0x148302[_0x74f4('0x3c')];_0x1a7207[_0x74f4('0x3d')]=_0x148302['outboundRejectCallsDay'];_0x1a7207[_0x74f4('0x3e')]=_0x148302['outboundUnknownCallsDay'];_0x1a7207[_0x74f4('0x3f')]=_0x148302[_0x74f4('0x3f')];_0x1a7207[_0x74f4('0x40')]=_0x148302[_0x74f4('0x40')];_0x1a7207[_0x74f4('0x41')]=_0x148302['predictiveIntervalAvgTalktime'];_0x1a7207[_0x74f4('0x42')]=_0x148302['predictiveIntervalDroppedCallsCallersExit'];_0x1a7207['predictiveIntervalDroppedCallsTimeout']=_0x148302[_0x74f4('0x43')];_0x1a7207[_0x74f4('0x44')]=_0x148302[_0x74f4('0x44')];_0x1a7207[_0x74f4('0x45')]=_0x148302[_0x74f4('0x45')];_0x1a7207['predictiveIntervalHitRate']=_0x148302[_0x74f4('0x46')];_0x1a7207['predictiveIntervalMultiplicativeFactor']=_0x148302[_0x74f4('0x47')];_0x1a7207['predictiveIntervalPauses']=_0x148302[_0x74f4('0x48')];_0x1a7207[_0x74f4('0x49')]=_0x148302[_0x74f4('0x49')];_0x1a7207[_0x74f4('0x4a')]=_0x148302['predictiveIntervalTotalCalls'];_0x1a7207[_0x74f4('0x1d')]=_0x148302[_0x74f4('0x1d')];_0x1a7207[_0x74f4('0x4b')]=_0x148302['originated'];_0x1a7207[_0x74f4('0x4c')]=_0x148302[_0x74f4('0x4c')];_0x1a7207[_0x74f4('0x4d')]=_0x148302['erlangCallToSecond'];_0x1a7207[_0x74f4('0x4e')]=_0x148302[_0x74f4('0x4e')];_0x1a7207['erlangBusyFactor']=_0x148302[_0x74f4('0x4f')];_0x1a7207[_0x74f4('0x50')]=_0x148302['startPredictive'];_0x1a7207['startProgressive']=_0x148302[_0x74f4('0x51')];}if(_0x148302[_0x74f4('0x52')]){_0x1a7207[_0x74f4('0x52')]={'id':_0x148302[_0x74f4('0x52')]['id'],'name':_0x148302[_0x74f4('0x52')][_0x74f4('0xb')],'active':_0x148302[_0x74f4('0x52')][_0x74f4('0x53')],'callerid':_0x148302[_0x74f4('0x52')][_0x74f4('0x54')]};}if(_0x148302[_0x74f4('0x55')]){_0x1a7207['Interval']={'id':_0x148302[_0x74f4('0x55')]['id'],'name':_0x148302[_0x74f4('0x55')]['name']};}_0x1ea6a3[_0x74f4('0x56')](_0x1a7207);}}_0x5bb549({'count':_0x1ea6a3['length'],'rows':_0x1ea6a3});});},'VoiceChannels':function(_0x2fe0fa){return new Promise(function(_0x39e9e2,_0x41b2a2){var _0x5e27c9=_[_0x74f4('0x57')](_0x4a4b51[_0x74f4('0x58')]);_0x39e9e2({'count':_0x5e27c9['length'],'rows':_0x5e27c9});});},'VoiceChannelMixMonitor':function(_0x5bcc33){var _0x27ec3c=this;return new Promise(function(_0x5938d6,_0x5383ff){if(ami[_0x74f4('0x12')]()==![]){return _0x5383ff(_0x27ec3c[_0x74f4('0x13')](0x1f4,[config[_0x74f4('0x14')]['ip'],config[_0x74f4('0x14')][_0x74f4('0x1e')],'ami\x20disconnected'][_0x74f4('0x16')]('\x20')));}var _0x2ad594=schema(properties[_0x74f4('0x59')])['validate'](_0x5bcc33);if(_0x2ad594[_0x74f4('0x5a')]>0x0){return _0x5383ff(_0x27ec3c['error'](0x1f4,_['map'](_0x2ad594,'message')[_0x74f4('0x16')](',\x20')));}var _0x575883=_[_0x74f4('0x5b')](_0x4a4b51['channels'],{'uniqueid':_0x5bcc33[_0x74f4('0x5c')]});if(_0x575883&&_0x575883[_0x74f4('0x5d')]){var _0x48498d=util[_0x74f4('0x5e')]('%s.%s',_0x5bcc33[_0x74f4('0x5f')]||_0x5bcc33[_0x74f4('0x5c')],_0x5bcc33[_0x74f4('0x5e')]||'wav');return ami[_0x74f4('0x1b')]({'action':_0x74f4('0x60'),'channel':_0x575883['channel'],'file':_0x48498d,'options':'ai(mixmonitorid)'})[_0x74f4('0x1c')](function(_0x109573){var _0x27f2bc=_[_0x74f4('0x5b')](_0x575883[_0x74f4('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x48498d['toLowerCase']()});if(_[_0x74f4('0x62')](_0x27f2bc)){_0x575883[_0x74f4('0x61')][_0x74f4('0x56')]({'filename':_0x74f4('0x63')+_0x48498d['toLowerCase'](),'createdAt':moment()[_0x74f4('0x5e')](_0x74f4('0x64')),'mixmonitorid':_0x109573[_0x74f4('0x65')],'status':_0x74f4('0x66')});}else{_0x27f2bc[_0x74f4('0x65')]=_0x109573[_0x74f4('0x65')];_0x27f2bc['status']='rec';}_0x5938d6({'code':0xc8,'message':[_0x5bcc33[_0x74f4('0x5c')],_0x74f4('0x67'),_0x109573['mixmonitorid']][_0x74f4('0x16')]('\x20'),'mixmonitorid':_0x109573['mixmonitorid']});})[_0x74f4('0x22')](function(_0x4a1022){_0x5383ff(_0x27ec3c['error'](0x1f5,[_0x5bcc33[_0x74f4('0x5c')],_0x4a1022[_0x74f4('0x1d')][_0x74f4('0x68')]()][_0x74f4('0x16')]('\x20')));});}else{return _0x5383ff(_0x27ec3c['error'](0x1f5,_0x74f4('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x477874){var _0x1263d2=this;return new Promise(function(_0x52cf70,_0x29f682){if(ami[_0x74f4('0x12')]()==![]){return _0x29f682(_0x1263d2[_0x74f4('0x13')](0x1f4,[config[_0x74f4('0x14')]['ip'],config[_0x74f4('0x14')]['username'],_0x74f4('0x15')][_0x74f4('0x16')]('\x20')));}var _0xc3c38=schema(properties[_0x74f4('0x59')])[_0x74f4('0x3')](_0x477874);if(_0xc3c38[_0x74f4('0x5a')]>0x0){return _0x29f682(_0x1263d2['error'](0x1f4,_[_0x74f4('0x6a')](_0xc3c38,_0x74f4('0x1d'))['join'](',\x20')));}var _0x358de7=_[_0x74f4('0x5b')](_0x4a4b51[_0x74f4('0x58')],{'uniqueid':_0x477874['uniqueid']});if(_0x358de7){return BPromise['resolve']()[_0x74f4('0x1c')](function(){if(_0x358de7['channel']){return ami['Action']({'action':_0x74f4('0x6b'),'channel':_0x358de7[_0x74f4('0x5d')],'mixmonitorid':_0x477874['mixmonitorid']})[_0x74f4('0x22')](function(_0xf9878a){});}})[_0x74f4('0x1c')](function(){if(_0x358de7[_0x74f4('0x6c')]){return ami[_0x74f4('0x1b')]({'action':'StopMixMonitor','channel':_0x358de7['destinationchannel'],'mixmonitorid':_0x477874[_0x74f4('0x65')]})['catch'](function(_0x1c0dee){});}})[_0x74f4('0x1c')](function(_0x3f8459){var _0x4245d2=_[_0x74f4('0x5b')](_0x358de7[_0x74f4('0x61')],{'mixmonitorid':_0x477874['mixmonitorid']});if(_0x4245d2){_0x4245d2[_0x74f4('0x6d')]=_0x74f4('0x6e');}})[_0x74f4('0x1c')](function(){var _0x57fc33=util[_0x74f4('0x5e')]('%s.%s',_0x477874[_0x74f4('0x5f')]||_0x477874['uniqueid'],_0x477874['format']||'wav');var _0x3b72d7=_['find'](_0x358de7[_0x74f4('0x61')],{'filename':_0x74f4('0x63')+_0x57fc33['toLowerCase']()});if(_0x3b72d7){_0x3b72d7[_0x74f4('0x6d')]='stop';}})['then'](function(){_0x52cf70({'code':0xc8,'message':[_0x477874[_0x74f4('0x5c')],_0x74f4('0x6f')]['join']('\x20')});})[_0x74f4('0x22')](function(_0x329f2c){_0x29f682(_0x1263d2[_0x74f4('0x13')](0x1f5,[_0x477874['uniqueid'],_0x329f2c[_0x74f4('0x1d')]['toLowerCase']()][_0x74f4('0x16')]('\x20')));});}else{return _0x29f682(_0x1263d2[_0x74f4('0x13')](0x1f5,_0x74f4('0x69')));}});},'VoiceQueuesChannels':function(_0x31b321){return new Promise(function(_0x349429,_0x578a7b){var _0x32ea4a=_['values'](_0x4a4b51[_0x74f4('0x70')]);_0x349429({'count':_0x32ea4a[_0x74f4('0x5a')],'rows':_0x32ea4a});});},'VoiceQueuesChannel':function(_0x3a643a){var _0x5008eb=this;return new Promise(function(_0x4ec55b,_0x4db6c9){var _0x50b287=schema(properties['voicequeuechannel'])[_0x74f4('0x3')](_0x3a643a);if(_0x50b287[_0x74f4('0x5a')]>0x0){return _0x4db6c9(_0x5008eb['error'](0x1f4,_['map'](_0x50b287,_0x74f4('0x1d'))['join'](',\x20')));}var _0x2494f2=_[_0x74f4('0x5b')](_0x4a4b51[_0x74f4('0x70')],{'uniqueid':_0x3a643a[_0x74f4('0x5c')]});if(_0x2494f2){_0x4ec55b(_0x2494f2);}else{return _0x4db6c9(_0x5008eb['error'](0x1f5,_0x74f4('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x2452c1){var _0x2d17a6=this;return new Promise(function(_0x1dc568,_0x55f8b0){if(ami[_0x74f4('0x12')]()==![]){return _0x55f8b0(_0x2d17a6['error'](0x1f4,[config[_0x74f4('0x14')]['ip'],config[_0x74f4('0x14')]['username'],'ami\x20disconnected'][_0x74f4('0x16')]('\x20')));}var _0x1eb14e=schema(properties['voicequeuechannelhangup'])[_0x74f4('0x3')](_0x2452c1);if(_0x1eb14e[_0x74f4('0x5a')]>0x0){return _0x55f8b0(_0x2d17a6['error'](0x1f4,_[_0x74f4('0x6a')](_0x1eb14e,_0x74f4('0x1d'))[_0x74f4('0x16')](',\x20')));}var _0x1f5686=_[_0x74f4('0x5b')](_0x4a4b51['queueChannels'],{'uniqueid':_0x2452c1['uniqueid']});if(_0x1f5686&&_0x1f5686[_0x74f4('0x5d')]){return ami[_0x74f4('0x1b')]({'action':_0x74f4('0x71'),'channel':_0x1f5686[_0x74f4('0x5d')]})[_0x74f4('0x1c')](function(_0x6a6421){_0x1dc568({'code':0xc8,'message':[_0x2452c1[_0x74f4('0x5c')],_0x6a6421[_0x74f4('0x1d')][_0x74f4('0x68')]()][_0x74f4('0x16')]('\x20')});})[_0x74f4('0x22')](function(_0x5c31dd){_0x55f8b0(_0x2d17a6['error'](0x1f5,[_0x2452c1[_0x74f4('0x5c')],_0x5c31dd[_0x74f4('0x1d')][_0x74f4('0x68')]()][_0x74f4('0x16')]('\x20')));});}else{return _0x55f8b0(_0x2d17a6[_0x74f4('0x13')](0x1f5,_0x74f4('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x20b819){var _0x579ab2=this;return new Promise(function(_0x3f814f,_0x39562f){if(ami['isConnected']()==![]){return _0x39562f(_0x579ab2[_0x74f4('0x13')](0x1f4,[config[_0x74f4('0x14')]['ip'],config[_0x74f4('0x14')][_0x74f4('0x1e')],_0x74f4('0x15')][_0x74f4('0x16')]('\x20')));}var _0x26b171=schema(properties[_0x74f4('0x72')])[_0x74f4('0x3')](_0x20b819);if(_0x26b171['length']>0x0){return _0x39562f(_0x579ab2['error'](0x1f4,_[_0x74f4('0x6a')](_0x26b171,'message')[_0x74f4('0x16')](',\x20')));}var _0x128b78=_[_0x74f4('0x5b')](_0x4a4b51[_0x74f4('0x70')],{'uniqueid':_0x20b819['uniqueid']});if(_0x128b78&&_0x128b78[_0x74f4('0x5d')]){return ami[_0x74f4('0x1b')]({'action':'Redirect','channel':_0x128b78[_0x74f4('0x5d')],'exten':_0x20b819['exten'],'context':_0x20b819['context']||_0x128b78[_0x74f4('0x73')],'priority':0x1})['then'](function(_0x2ab189){_0x3f814f({'code':0xc8,'message':[_0x20b819[_0x74f4('0x5c')],_0x2ab189[_0x74f4('0x1d')]['toLowerCase']()][_0x74f4('0x16')]('\x20')});})[_0x74f4('0x22')](function(_0x21f68b){_0x39562f(_0x579ab2['error'](0x1f5,[_0x20b819[_0x74f4('0x5c')],_0x21f68b[_0x74f4('0x1d')][_0x74f4('0x68')]()][_0x74f4('0x16')]('\x20')));});}else{return _0x39562f(_0x579ab2['error'](0x1f5,_0x74f4('0x69')));}});},'Agents':function(_0xe02a52){return new Promise(function(_0xc40ece,_0x202bd3){var _0x41f5ef=_[_0x74f4('0x57')](_0x4a4b51[_0x74f4('0xf')]);_0xc40ece({'count':_0x41f5ef[_0x74f4('0x5a')],'rows':_0x41f5ef});});},'Telephones':function(_0x1ce06c){return new Promise(function(_0x19db39,_0x37a5eb){var _0x53e4b1=_[_0x74f4('0x57')](_0x4a4b51[_0x74f4('0x74')]);_0x19db39({'count':_0x53e4b1[_0x74f4('0x5a')],'rows':_0x53e4b1});});},'Trunks':function(_0x2c3dd3){return new Promise(function(_0x5da18c,_0x5a3993){var _0x1838ce=_[_0x74f4('0x57')](_0x4a4b51[_0x74f4('0x75')]);_0x5da18c({'count':_0x1838ce['length'],'rows':_0x1838ce});});},'OutboundChannels':function(_0x563e7e){return new Promise(function(_0x2a802a,_0xfe063b){var _0x191126=_[_0x74f4('0x57')](_0x4a4b51[_0x74f4('0x76')]);_0x2a802a({'count':_0x191126[_0x74f4('0x5a')],'rows':_0x191126});});},'Outbound':function(_0x47cd0b){return new Promise(function(_0x25b426,_0x5670e4){_0x25b426(_0x4a4b51[_0x74f4('0x2c')]);});},'Campaigns':function(_0x52a767){return new Promise(function(_0x3eb6b4,_0x335453){var _0x341763=_['values'](_0x4a4b51[_0x74f4('0x77')]);_0x3eb6b4({'count':_0x341763['length'],'rows':_0x341763});});},'VoiceQueuesPreview':function(_0x5dd918){var _0x5a79ba=this;return new Promise(function(_0x74bf40,_0x5151f8){_0x9697ca['run'](_0x5dd918['id'])[_0x74f4('0x1c')](function(_0x322b35){_0x74bf40({'code':0xc8,'message':_0x322b35['message']});})[_0x74f4('0x22')](function(_0x2eeb26){_0x5151f8(_0x5a79ba['error'](0x1f4,_0x2eeb26[_0x74f4('0x1d')]));});});},'EventManager':function(_0x4cb40b){var _0x50d118=this;return new Promise(function(_0x4489e8,_0x1e51d8){if(!_0x4cb40b['event']){return _0x1e51d8(_0x50d118[_0x74f4('0x13')](0x1f4,_0x74f4('0x78')));}ami[_0x74f4('0x79')](_0x74f4('0x7a')+_0x4cb40b[_0x74f4('0x7b')],_0x4cb40b['message']);_0x4489e8({'code':0xc8,'message':_0x4cb40b});});},'FaxAccounts':function(_0xadf38){return new Promise(function(_0x13c8d3,_0x27fb99){var _0x177773=_['values'](_0x4a4b51[_0x74f4('0x7c')]);_0x13c8d3({'count':_0x177773[_0x74f4('0x5a')],'rows':_0x177773});});},'SendFax':function(_0x53ea03){var _0x2e6179=this;return new Promise(function(_0x547531,_0x31a530){_0x40ef8d[_0x74f4('0x7d')](_0x53ea03)[_0x74f4('0x1c')](function(_0xbe6c3a){_0x547531({'code':0xc8,'message':_0xbe6c3a['message']});})['catch'](function(_0x48eafc){_0x31a530(_0x2e6179[_0x74f4('0x13')](0x1f4,_0x48eafc[_0x74f4('0x1d')]));});});},'CheckAfterSend':function(_0x1906b0){var _0x21f0f5=this;return new Promise(function(_0x4e1b59,_0x5330a5){_0x40ef8d[_0x74f4('0x7e')](_0x1906b0)['then'](function(_0xb69540){_0x4e1b59({'code':0xc8,'message':_0xb69540[_0x74f4('0x1d')]});})['catch'](function(_0x1c7599){_0x5330a5(_0x21f0f5[_0x74f4('0x13')](0x1f4,_0x1c7599[_0x74f4('0x1d')]));});});}};var _0x53a05f=jayson[_0x74f4('0x7f')](_0x55b834)[_0x74f4('0x80')]();_0x53a05f['on'](_0x74f4('0x13'),function(_0xb6b385){return _0x15379a(_0xb6b385);});_0x53a05f[_0x74f4('0x8')](0x232a,_0x74f4('0x81'),function(){console[_0x74f4('0x82')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x4a4ff0(_0x74f4('0x83')+0x232a);});});}; \ No newline at end of file +var _0x43a2=['voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','emit','event','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','../../../config/environment','../properties','format','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','error','message','command','Command','then','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','values','channels','length','voicechannel','map','find','channel','%s.%s','uniqueid','wav','ai(mixmonitorid)','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','destinationchannel','StopMixMonitor','stop','filename','status','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x43a2,0x122));var _0x243a=function(_0x2d1fdb,_0x50d2de){_0x2d1fdb=_0x2d1fdb-0x0;var _0x19e74b=_0x43a2[_0x2d1fdb];return _0x19e74b;};'use strict';var _=require(_0x243a('0x0'));var util=require(_0x243a('0x1'));var jayson=require(_0x243a('0x2'));var schema=require(_0x243a('0x3'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x243a('0x4'));var properties=require(_0x243a('0x5'));var ami=require('../ami');exports['listen']=function(_0x41bba1,_0x2b34ce,_0x342eaa){return new BPromise(function(_0x515e30,_0x375cb7){var _0x57b71f={'QueuePause':function(_0x3d923d){return new Promise(function(_0x29b220,_0x341428){var _0x4f94f7=util[_0x243a('0x6')]('%s/%s','SIP',_0x3d923d[_0x243a('0x7')]);if(_0x41bba1[_0x243a('0x8')]&&_0x41bba1[_0x243a('0x8')][_0x4f94f7]&&_0x41bba1[_0x243a('0x8')][_0x4f94f7]['timer']){_0x41bba1[_0x243a('0x8')][_0x4f94f7][_0x243a('0x9')]();}if(_0x41bba1['agents'][_0x4f94f7]){_0x41bba1[_0x243a('0xa')][_0x4f94f7][_0x243a('0xb')]({'statePause':_0x3d923d[_0x243a('0xc')]?!![]:![]});}_0x29b220({'code':0xc8,'message':_0x243a('0xd')});});},'Reload':function(_0x58269d){var _0x2726b1=this;return new Promise(function(_0x6ab106,_0x46d6fb){if(ami[_0x243a('0xe')]()==![]){return _0x46d6fb(_0x2726b1['error'](0x1f4,[config[_0x243a('0xf')]['ip'],config[_0x243a('0xf')][_0x243a('0x10')],_0x243a('0x11')][_0x243a('0x12')]('\x20')));}_0x58269d=_[_0x243a('0x13')](_0x58269d,_['keys'](properties[_0x243a('0x14')]));_0x58269d[_0x243a('0x15')]=_0x243a('0x16');return ami[_0x243a('0x17')](_0x58269d)['then'](function(_0x24151c){_0x6ab106({'code':0xc8,'message':_0x24151c['message']});})['catch'](function(_0x3c8859){_0x46d6fb(_0x2726b1[_0x243a('0x18')](0x1f5,_0x3c8859[_0x243a('0x19')]));});});},'Command':function(_0x5461c4){var _0x1613ca=this;return new Promise(function(_0x3ae964,_0x3ba0ce){if(ami[_0x243a('0xe')]()==![]){return _0x3ba0ce(_0x1613ca[_0x243a('0x18')](0x1f4,[config[_0x243a('0xf')]['ip'],config['asterisk'][_0x243a('0x10')],'ami\x20disconnected']['join']('\x20')));}_0x5461c4=_[_0x243a('0x13')](_0x5461c4,_0x243a('0x1a'));_0x5461c4['action']=_0x243a('0x1b');return ami['Action'](_0x5461c4)[_0x243a('0x1c')](function(_0x52a996){_0x3ae964({'code':0xc8,'message':_0x52a996[_0x243a('0x1d')]});})[_0x243a('0x1e')](function(_0x4dbc99){_0x3ba0ce(_0x1613ca['error'](0x1f5,_0x4dbc99[_0x243a('0x19')]));});});},'VoiceQueues':function(_0x21bda8){return new Promise(function(_0x54d2f4,_0x3bdad2){var _0x2f7887=[];for(var _0x36b847 in _0x41bba1['voiceQueues']){if(_0x41bba1[_0x243a('0x1f')][_0x243a('0x20')](_0x36b847)){var _0x2973a9=_0x41bba1[_0x243a('0x1f')][_0x36b847];var _0x5648a6={'id':_0x2973a9['id'],'name':_0x2973a9[_0x243a('0x7')],'strategy':_0x2973a9[_0x243a('0x21')],'answered':_0x2973a9[_0x243a('0x22')],'available':_0x2973a9[_0x243a('0x23')],'loggedIn':_0x2973a9[_0x243a('0x24')],'pTalking':_0x2973a9[_0x243a('0x25')],'sumBillable':_0x2973a9[_0x243a('0x26')],'sumDuration':_0x2973a9[_0x243a('0x27')],'sumHoldTime':_0x2973a9[_0x243a('0x28')]||0x0,'talking':_0x2973a9[_0x243a('0x29')],'total':_0x2973a9[_0x243a('0x2a')],'type':_0x2973a9['type'],'unmanaged':_0x2973a9['unmanaged'],'abandoned':_0x2973a9[_0x243a('0x2b')],'waiting':_0x2973a9[_0x243a('0x2c')],'loggedInDb':_0x2973a9[_0x243a('0x2d')]};if(_0x2973a9[_0x243a('0x2e')]==='outbound'){_0x5648a6[_0x243a('0x2f')]=_0x2973a9[_0x243a('0x2f')];_0x5648a6[_0x243a('0x30')]=_0x2973a9[_0x243a('0x30')];_0x5648a6[_0x243a('0x31')]=_0x2973a9[_0x243a('0x31')];_0x5648a6[_0x243a('0x32')]=_0x2973a9[_0x243a('0x32')];_0x5648a6['dialOriginateTimeout']=_0x2973a9['dialOriginateTimeout'];_0x5648a6[_0x243a('0x33')]=_0x2973a9['dialPrefix'];_0x5648a6[_0x243a('0x34')]=_0x2973a9[_0x243a('0x34')];_0x5648a6[_0x243a('0x35')]=_0x2973a9[_0x243a('0x35')];_0x5648a6[_0x243a('0x36')]=_0x2973a9[_0x243a('0x36')];_0x5648a6[_0x243a('0x37')]=_0x2973a9[_0x243a('0x37')];_0x5648a6[_0x243a('0x38')]=_0x2973a9[_0x243a('0x38')];_0x5648a6[_0x243a('0x39')]=_0x2973a9['outboundDropCallsDayACS'];_0x5648a6[_0x243a('0x3a')]=_0x2973a9[_0x243a('0x3a')];_0x5648a6[_0x243a('0x3b')]=_0x2973a9['outboundDropCallsDayTimeout'];_0x5648a6['outboundNoAnswerCallsDay']=_0x2973a9['outboundNoAnswerCallsDay'];_0x5648a6[_0x243a('0x3c')]=_0x2973a9[_0x243a('0x3c')];_0x5648a6[_0x243a('0x3d')]=_0x2973a9['outboundOriginateFailureCallsDay'];_0x5648a6[_0x243a('0x3e')]=_0x2973a9[_0x243a('0x3e')];_0x5648a6[_0x243a('0x3f')]=_0x2973a9['outboundRejectCallsDay'];_0x5648a6[_0x243a('0x40')]=_0x2973a9['outboundUnknownCallsDay'];_0x5648a6[_0x243a('0x41')]=_0x2973a9[_0x243a('0x41')];_0x5648a6[_0x243a('0x42')]=_0x2973a9[_0x243a('0x42')];_0x5648a6['predictiveIntervalAvgTalktime']=_0x2973a9[_0x243a('0x43')];_0x5648a6[_0x243a('0x44')]=_0x2973a9[_0x243a('0x44')];_0x5648a6['predictiveIntervalDroppedCallsTimeout']=_0x2973a9[_0x243a('0x45')];_0x5648a6[_0x243a('0x46')]=_0x2973a9[_0x243a('0x46')];_0x5648a6[_0x243a('0x47')]=_0x2973a9[_0x243a('0x47')];_0x5648a6[_0x243a('0x48')]=_0x2973a9[_0x243a('0x48')];_0x5648a6[_0x243a('0x49')]=_0x2973a9[_0x243a('0x49')];_0x5648a6[_0x243a('0x4a')]=_0x2973a9[_0x243a('0x4a')];_0x5648a6[_0x243a('0x4b')]=_0x2973a9[_0x243a('0x4b')];_0x5648a6['predictiveIntervalTotalCalls']=_0x2973a9['predictiveIntervalTotalCalls'];_0x5648a6[_0x243a('0x19')]=_0x2973a9['message'];_0x5648a6[_0x243a('0x4c')]=_0x2973a9['originated'];_0x5648a6['erlangCalls']=_0x2973a9[_0x243a('0x4d')];_0x5648a6[_0x243a('0x4e')]=_0x2973a9[_0x243a('0x4e')];_0x5648a6[_0x243a('0x4f')]=_0x2973a9[_0x243a('0x4f')];_0x5648a6[_0x243a('0x50')]=_0x2973a9['erlangBusyFactor'];_0x5648a6[_0x243a('0x51')]=_0x2973a9[_0x243a('0x51')];_0x5648a6['startProgressive']=_0x2973a9['startProgressive'];}if(_0x2973a9[_0x243a('0x52')]){_0x5648a6['Trunk']={'id':_0x2973a9['Trunk']['id'],'name':_0x2973a9[_0x243a('0x52')][_0x243a('0x7')],'active':_0x2973a9[_0x243a('0x52')][_0x243a('0x53')],'callerid':_0x2973a9[_0x243a('0x52')][_0x243a('0x54')]};}if(_0x2973a9[_0x243a('0x55')]){_0x5648a6[_0x243a('0x55')]={'id':_0x2973a9[_0x243a('0x55')]['id'],'name':_0x2973a9[_0x243a('0x55')][_0x243a('0x7')]};}_0x2f7887['push'](_0x5648a6);}}_0x54d2f4({'count':_0x2f7887['length'],'rows':_0x2f7887});});},'VoiceChannels':function(_0x275fed){return new Promise(function(_0x4d1405,_0x4eeb38){var _0x3a864b=_[_0x243a('0x56')](_0x41bba1[_0x243a('0x57')]);_0x4d1405({'count':_0x3a864b[_0x243a('0x58')],'rows':_0x3a864b});});},'VoiceChannelMixMonitor':function(_0x4111ad){var _0x11773e=this;return new Promise(function(_0x5a41cd,_0x902e0b){if(ami[_0x243a('0xe')]()==![]){return _0x902e0b(_0x11773e[_0x243a('0x18')](0x1f4,[config[_0x243a('0xf')]['ip'],config[_0x243a('0xf')][_0x243a('0x10')],'ami\x20disconnected'][_0x243a('0x12')]('\x20')));}var _0x10073c=schema(properties[_0x243a('0x59')])[_0x243a('0x3')](_0x4111ad);if(_0x10073c[_0x243a('0x58')]>0x0){return _0x902e0b(_0x11773e['error'](0x1f4,_[_0x243a('0x5a')](_0x10073c,'message')[_0x243a('0x12')](',\x20')));}var _0x13f4f9=_[_0x243a('0x5b')](_0x41bba1[_0x243a('0x57')],{'uniqueid':_0x4111ad['uniqueid']});if(_0x13f4f9&&_0x13f4f9[_0x243a('0x5c')]){var _0x15032f=util['format'](_0x243a('0x5d'),_0x4111ad['filename']||_0x4111ad[_0x243a('0x5e')],_0x4111ad[_0x243a('0x6')]||_0x243a('0x5f'));return ami['Action']({'action':'MixMonitor','channel':_0x13f4f9[_0x243a('0x5c')],'file':_0x15032f,'options':_0x243a('0x60')})['then'](function(_0x4b5a70){var _0x2ee697=_[_0x243a('0x5b')](_0x13f4f9[_0x243a('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x15032f[_0x243a('0x62')]()});if(_[_0x243a('0x63')](_0x2ee697)){_0x13f4f9['monitors'][_0x243a('0x64')]({'filename':_0x243a('0x65')+_0x15032f[_0x243a('0x62')](),'createdAt':moment()[_0x243a('0x6')](_0x243a('0x66')),'mixmonitorid':_0x4b5a70[_0x243a('0x67')],'status':_0x243a('0x68')});}else{_0x2ee697[_0x243a('0x67')]=_0x4b5a70['mixmonitorid'];_0x2ee697['status']='rec';}_0x5a41cd({'code':0xc8,'message':[_0x4111ad[_0x243a('0x5e')],'MixMonitor\x20Success',_0x4b5a70['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x4b5a70['mixmonitorid']});})['catch'](function(_0x291cf4){_0x902e0b(_0x11773e[_0x243a('0x18')](0x1f5,[_0x4111ad['uniqueid'],_0x291cf4['message'][_0x243a('0x62')]()][_0x243a('0x12')]('\x20')));});}else{return _0x902e0b(_0x11773e[_0x243a('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1d624b){var _0x165d1f=this;return new Promise(function(_0x1f4e98,_0x5d28c9){if(ami[_0x243a('0xe')]()==![]){return _0x5d28c9(_0x165d1f[_0x243a('0x18')](0x1f4,[config[_0x243a('0xf')]['ip'],config[_0x243a('0xf')]['username'],_0x243a('0x11')]['join']('\x20')));}var _0x3e8b60=schema(properties[_0x243a('0x59')])[_0x243a('0x3')](_0x1d624b);if(_0x3e8b60['length']>0x0){return _0x5d28c9(_0x165d1f[_0x243a('0x18')](0x1f4,_[_0x243a('0x5a')](_0x3e8b60,_0x243a('0x19'))[_0x243a('0x12')](',\x20')));}var _0x4c23af=_[_0x243a('0x5b')](_0x41bba1[_0x243a('0x57')],{'uniqueid':_0x1d624b['uniqueid']});if(_0x4c23af){return BPromise['resolve']()[_0x243a('0x1c')](function(){if(_0x4c23af['channel']){return ami[_0x243a('0x17')]({'action':'StopMixMonitor','channel':_0x4c23af['channel'],'mixmonitorid':_0x1d624b[_0x243a('0x67')]})['catch'](function(_0xfb94f3){});}})[_0x243a('0x1c')](function(){if(_0x4c23af[_0x243a('0x69')]){return ami['Action']({'action':_0x243a('0x6a'),'channel':_0x4c23af['destinationchannel'],'mixmonitorid':_0x1d624b['mixmonitorid']})['catch'](function(_0x4e16fb){});}})['then'](function(_0x18b872){var _0x2caf5a=_[_0x243a('0x5b')](_0x4c23af[_0x243a('0x61')],{'mixmonitorid':_0x1d624b[_0x243a('0x67')]});if(_0x2caf5a){_0x2caf5a['status']=_0x243a('0x6b');}})[_0x243a('0x1c')](function(){var _0x4e7603=util[_0x243a('0x6')](_0x243a('0x5d'),_0x1d624b[_0x243a('0x6c')]||_0x1d624b[_0x243a('0x5e')],_0x1d624b[_0x243a('0x6')]||_0x243a('0x5f'));var _0x4371aa=_[_0x243a('0x5b')](_0x4c23af[_0x243a('0x61')],{'filename':_0x243a('0x65')+_0x4e7603[_0x243a('0x62')]()});if(_0x4371aa){_0x4371aa[_0x243a('0x6d')]='stop';}})[_0x243a('0x1c')](function(){_0x1f4e98({'code':0xc8,'message':[_0x1d624b[_0x243a('0x5e')],_0x243a('0x6e')]['join']('\x20')});})[_0x243a('0x1e')](function(_0x500f64){_0x5d28c9(_0x165d1f[_0x243a('0x18')](0x1f5,[_0x1d624b['uniqueid'],_0x500f64[_0x243a('0x19')]['toLowerCase']()][_0x243a('0x12')]('\x20')));});}else{return _0x5d28c9(_0x165d1f[_0x243a('0x18')](0x1f5,_0x243a('0x6f')));}});},'VoiceQueuesChannels':function(_0x58769a){return new Promise(function(_0x902ff5,_0x3fdaf6){var _0xd81410=_[_0x243a('0x56')](_0x41bba1[_0x243a('0x70')]);_0x902ff5({'count':_0xd81410[_0x243a('0x58')],'rows':_0xd81410});});},'VoiceQueuesChannel':function(_0x55889a){var _0x4d638b=this;return new Promise(function(_0x3f0364,_0x509207){var _0x37cba8=schema(properties[_0x243a('0x71')])['validate'](_0x55889a);if(_0x37cba8[_0x243a('0x58')]>0x0){return _0x509207(_0x4d638b[_0x243a('0x18')](0x1f4,_[_0x243a('0x5a')](_0x37cba8,_0x243a('0x19'))[_0x243a('0x12')](',\x20')));}var _0x37d0b2=_['find'](_0x41bba1[_0x243a('0x70')],{'uniqueid':_0x55889a[_0x243a('0x5e')]});if(_0x37d0b2){_0x3f0364(_0x37d0b2);}else{return _0x509207(_0x4d638b[_0x243a('0x18')](0x1f5,_0x243a('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x212180){var _0x4e22f7=this;return new Promise(function(_0x5460d2,_0x39b32a){if(ami[_0x243a('0xe')]()==![]){return _0x39b32a(_0x4e22f7['error'](0x1f4,[config[_0x243a('0xf')]['ip'],config['asterisk'][_0x243a('0x10')],_0x243a('0x11')]['join']('\x20')));}var _0x2a69cd=schema(properties[_0x243a('0x72')])['validate'](_0x212180);if(_0x2a69cd[_0x243a('0x58')]>0x0){return _0x39b32a(_0x4e22f7['error'](0x1f4,_['map'](_0x2a69cd,'message')[_0x243a('0x12')](',\x20')));}var _0x992397=_['find'](_0x41bba1[_0x243a('0x70')],{'uniqueid':_0x212180[_0x243a('0x5e')]});if(_0x992397&&_0x992397[_0x243a('0x5c')]){return ami[_0x243a('0x17')]({'action':'Hangup','channel':_0x992397[_0x243a('0x5c')]})['then'](function(_0x121338){_0x5460d2({'code':0xc8,'message':[_0x212180[_0x243a('0x5e')],_0x121338['message'][_0x243a('0x62')]()][_0x243a('0x12')]('\x20')});})[_0x243a('0x1e')](function(_0x17327c){_0x39b32a(_0x4e22f7[_0x243a('0x18')](0x1f5,[_0x212180[_0x243a('0x5e')],_0x17327c[_0x243a('0x19')]['toLowerCase']()][_0x243a('0x12')]('\x20')));});}else{return _0x39b32a(_0x4e22f7[_0x243a('0x18')](0x1f5,_0x243a('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0xa487e6){var _0x5a004d=this;return new Promise(function(_0x535ed8,_0x83045f){if(ami[_0x243a('0xe')]()==![]){return _0x83045f(_0x5a004d[_0x243a('0x18')](0x1f4,[config[_0x243a('0xf')]['ip'],config[_0x243a('0xf')]['username'],_0x243a('0x11')][_0x243a('0x12')]('\x20')));}var _0x1fedc1=schema(properties[_0x243a('0x73')])[_0x243a('0x3')](_0xa487e6);if(_0x1fedc1[_0x243a('0x58')]>0x0){return _0x83045f(_0x5a004d[_0x243a('0x18')](0x1f4,_[_0x243a('0x5a')](_0x1fedc1,_0x243a('0x19'))[_0x243a('0x12')](',\x20')));}var _0x57007a=_[_0x243a('0x5b')](_0x41bba1['queueChannels'],{'uniqueid':_0xa487e6['uniqueid']});if(_0x57007a&&_0x57007a['channel']){return ami[_0x243a('0x17')]({'action':_0x243a('0x74'),'channel':_0x57007a[_0x243a('0x5c')],'exten':_0xa487e6[_0x243a('0x75')],'context':_0xa487e6['context']||_0x57007a[_0x243a('0x76')],'priority':0x1})['then'](function(_0x3bce2f){_0x535ed8({'code':0xc8,'message':[_0xa487e6[_0x243a('0x5e')],_0x3bce2f[_0x243a('0x19')][_0x243a('0x62')]()]['join']('\x20')});})['catch'](function(_0x28e1a9){_0x83045f(_0x5a004d[_0x243a('0x18')](0x1f5,[_0xa487e6[_0x243a('0x5e')],_0x28e1a9['message'][_0x243a('0x62')]()][_0x243a('0x12')]('\x20')));});}else{return _0x83045f(_0x5a004d[_0x243a('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x4b99fb){return new Promise(function(_0xd5260,_0x3bffa2){var _0x33c944=_[_0x243a('0x56')](_0x41bba1[_0x243a('0xa')]);_0xd5260({'count':_0x33c944[_0x243a('0x58')],'rows':_0x33c944});});},'Telephones':function(_0x57b8e4){return new Promise(function(_0xfd3625,_0x12bd70){var _0x3c2379=_[_0x243a('0x56')](_0x41bba1[_0x243a('0x77')]);_0xfd3625({'count':_0x3c2379[_0x243a('0x58')],'rows':_0x3c2379});});},'Trunks':function(_0x10b108){return new Promise(function(_0x5ebf3c,_0x3f1e46){var _0x36b871=_[_0x243a('0x56')](_0x41bba1[_0x243a('0x78')]);_0x5ebf3c({'count':_0x36b871[_0x243a('0x58')],'rows':_0x36b871});});},'OutboundChannels':function(_0x14c7e9){return new Promise(function(_0x1d1c5d,_0xe46186){var _0x35f67b=_[_0x243a('0x56')](_0x41bba1[_0x243a('0x79')]);_0x1d1c5d({'count':_0x35f67b['length'],'rows':_0x35f67b});});},'Outbound':function(_0x2d40ff){return new Promise(function(_0x5a62a7,_0x3ecd34){_0x5a62a7(_0x41bba1[_0x243a('0x7a')]);});},'Campaigns':function(_0x411449){return new Promise(function(_0x14a7ca,_0x2cfe92){var _0x565f3a=_[_0x243a('0x56')](_0x41bba1[_0x243a('0x7b')]);_0x14a7ca({'count':_0x565f3a[_0x243a('0x58')],'rows':_0x565f3a});});},'VoiceQueuesPreview':function(_0xa0eb47){var _0x4630c3=this;return new Promise(function(_0x2a03aa,_0x30c627){_0x2b34ce['run'](_0xa0eb47['id'])['then'](function(_0x2d3977){_0x2a03aa({'code':0xc8,'message':_0x2d3977[_0x243a('0x19')]});})[_0x243a('0x1e')](function(_0x549144){_0x30c627(_0x4630c3[_0x243a('0x18')](0x1f4,_0x549144['message']));});});},'EventManager':function(_0x81e0e2){var _0x64f00b=this;return new Promise(function(_0x381faf,_0x480c75){if(!_0x81e0e2['event']){return _0x480c75(_0x64f00b[_0x243a('0x18')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x243a('0x7c')]('custom:'+_0x81e0e2[_0x243a('0x7d')],_0x81e0e2[_0x243a('0x19')]);_0x381faf({'code':0xc8,'message':_0x81e0e2});});},'FaxAccounts':function(_0x13cb3c){return new Promise(function(_0x24f817,_0x556d3e){var _0x5c0feb=_[_0x243a('0x56')](_0x41bba1[_0x243a('0x7e')]);_0x24f817({'count':_0x5c0feb['length'],'rows':_0x5c0feb});});},'SendFax':function(_0x1165e4){var _0x5d74b0=this;return new Promise(function(_0x585726,_0x2290a9){_0x342eaa[_0x243a('0x7f')](_0x1165e4)[_0x243a('0x1c')](function(_0x460e44){_0x585726({'code':0xc8,'message':_0x460e44['message']});})['catch'](function(_0x2d857d){_0x2290a9(_0x5d74b0['error'](0x1f4,_0x2d857d['message']));});});},'CheckAfterSend':function(_0x2295ed){var _0x555c52=this;return new Promise(function(_0x123525,_0x10107d){_0x342eaa[_0x243a('0x80')](_0x2295ed)['then'](function(_0x1d975e){_0x123525({'code':0xc8,'message':_0x1d975e[_0x243a('0x19')]});})[_0x243a('0x1e')](function(_0x4923e2){_0x10107d(_0x555c52[_0x243a('0x18')](0x1f4,_0x4923e2['message']));});});}};var _0x4e4a44=jayson[_0x243a('0x81')](_0x57b71f)[_0x243a('0x82')]();_0x4e4a44['on'](_0x243a('0x18'),function(_0x57b567){return _0x375cb7(_0x57b567);});_0x4e4a44[_0x243a('0x83')](0x232a,_0x243a('0x84'),function(){console[_0x243a('0x85')](_0x243a('0x86'),0x232a);return _0x515e30('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 864c9db..1f7067d 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 _0x0df2=['routeId','destcalleridnum','calleridnum','firstName','lastName','fax','ListId','createdAt','updatedAt','union','resolve','then','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','merge','length','bluebird','ioredis','trigger','defaults','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','data3','split','phone'];(function(_0x434f6a,_0x24e3c3){var _0x32d4c0=function(_0x39d4a6){while(--_0x39d4a6){_0x434f6a['push'](_0x434f6a['shift']());}};_0x32d4c0(++_0x24e3c3);}(_0x0df2,0xf9));var _0x20df=function(_0xca54f9,_0x1d837b){_0xca54f9=_0xca54f9-0x0;var _0x183c63=_0x0df2[_0xca54f9];return _0x183c63;};'use strict';var _=require('lodash');var BPromise=require(_0x20df('0x0'));var Redis=require(_0x20df('0x1'));var util=require('util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x20df('0x2'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x20df('0x3')](config[_0x20df('0x4')],{'host':_0x20df('0x5'),'port':0x18eb});var io=require(_0x20df('0x6'))(new Redis(config['redis']));function emit(_0x49a552,_0x3dfb02,_0x194d2,_0xe5ab91,_0x20057e){logger['info'](_0x20df('0x7'),_0x49a552,_0x3dfb02['id'],_0x194d2,_0xe5ab91,JSON[_0x20df('0x8')](_0x20057e));io['to'](_0x194d2)[_0x20df('0x9')](_0xe5ab91,_0x20057e);}exports['exec']=function(_0x5bea95,_0x3a16b3,_0x2ebda9,_0x28dbd1){var _0x2f48fc,_0xfb9503;var _0x496b11={};var _0x1b3d78=Number(_0x2ebda9[_0x20df('0xa')]);var _0x36e984=_0x2ebda9['data2']?Boolean(Number(_0x2ebda9[_0x20df('0xb')])):![];var _0x44741a;if(_0x28dbd1['xmd-contactid']){_0x496b11['id']=_0x28dbd1[_0x20df('0xc')];}if(!_0x496b11['id']){_0x496b11['ListId']=_0x1b3d78;_0x44741a=_0x2ebda9[_0x20df('0xd')]&&_0x2ebda9[_0x20df('0xd')]!=='0'?_0x2ebda9[_0x20df('0xd')][_0x20df('0xe')](','):[_0x20df('0xf')];_0x496b11['$or']=_['map'](_0x44741a,function(_0x3e86ec){var _0x3e7261={};_0x3e7261[_0x3e86ec]=_0x28dbd1[_0x20df('0x10')]?_0x28dbd1[_0x20df('0x11')]:_0x28dbd1[_0x20df('0x12')];return _0x3e7261;});}var _0x34faad=['id',_0x20df('0x13'),_0x20df('0x14'),_0x20df('0xf'),'mobile',_0x20df('0x15'),_0x20df('0x16'),_0x20df('0x17'),'scheduledAt',_0x20df('0x18')];var _0x4bcb95=_[_0x20df('0x19')](_0x34faad,_0x44741a);BPromise[_0x20df('0x1a')]()[_0x20df('0x1b')](cmContactRpc['getContacts']({'attributes':_0x4bcb95,'where':_0x496b11}))['then'](function(_0x21df74){_0xfb9503=_0x21df74;if(!_[_0x20df('0x1c')](_0xfb9503)){if(_0xfb9503['length']===0x1){_0x2f48fc=_0xfb9503[0x0];logger[_0x20df('0x1d')](_0x20df('0x1e'),_0x28dbd1[_0x20df('0x1f')],_0x3a16b3['id'],_0x2f48fc['id']);}else{logger['info'](_0x20df('0x20'),_0x28dbd1[_0x20df('0x1f')],_0x3a16b3['id'],_[_0x20df('0x21')](_0xfb9503,'id')[_0x20df('0x22')](','));}return;}else{logger[_0x20df('0x1d')](_0x20df('0x23'),_0x28dbd1[_0x20df('0x1f')],_0x3a16b3['id']);var _0xa1ce14={'ListId':_0x1b3d78};var _0x52455b=_0x2ebda9[_0x20df('0x24')]&&_0x2ebda9[_0x20df('0x24')]!=='0'?_0x2ebda9['data4']:_0x20df('0xf');if(_0x36e984){logger[_0x20df('0x1d')](_0x20df('0x25'),_0x28dbd1[_0x20df('0x1f')],_0x3a16b3['id']);_0xa1ce14[_0x52455b]=_[_0x20df('0x26')](_0x28dbd1['routeId'])?_0x28dbd1['calleridnum']:_0x28dbd1[_0x20df('0x11')];if(_[_0x20df('0x26')](_0x28dbd1[_0x20df('0x10')])){_0xa1ce14[_0x20df('0x13')]=_0x28dbd1[_0x20df('0x27')]&&_0x28dbd1['calleridname']!==_0x20df('0x28')?_0x28dbd1[_0x20df('0x27')]:_0x20df('0x29');}else{_0xa1ce14['firstName']=_0x28dbd1[_0x20df('0x2a')]&&_0x28dbd1[_0x20df('0x2a')]!==_0x20df('0x28')?_0x28dbd1[_0x20df('0x2a')]:'Unknown';}return BPromise[_0x20df('0x1a')]()[_0x20df('0x1b')](cmContactRpc['createContact'](_0xa1ce14))['then'](function(_0x33031a){_0x2f48fc=_0x33031a;_0xfb9503[_0x20df('0x2b')](_0x33031a);if(_0x2f48fc){logger[_0x20df('0x1d')](_0x20df('0x2c'),_0x28dbd1['uniqueid'],_0x3a16b3['id'],_0x2f48fc['id']);}return;});}else{logger[_0x20df('0x1d')](_0x20df('0x2d'),_0x28dbd1[_0x20df('0x1f')],_0x3a16b3['id']);_0xa1ce14[_0x52455b]=_[_0x20df('0x26')](_0x28dbd1[_0x20df('0x10')])?_0x28dbd1[_0x20df('0x12')]:_0x28dbd1['destcalleridnum'];if(_[_0x20df('0x26')](_0x28dbd1[_0x20df('0x10')])){_0xa1ce14[_0x20df('0x13')]=_0x28dbd1[_0x20df('0x27')]&&_0x28dbd1[_0x20df('0x27')]!==_0x20df('0x28')?_0x28dbd1[_0x20df('0x27')]:_0x20df('0x29');}else{_0xa1ce14[_0x20df('0x13')]=_0x28dbd1[_0x20df('0x2a')]&&_0x28dbd1[_0x20df('0x2a')]!==_0x20df('0x28')?_0x28dbd1[_0x20df('0x2a')]:_0x20df('0x29');}_0x2f48fc=_0xa1ce14;_0xfb9503[_0x20df('0x2b')](_0xa1ce14);return;}}})['then'](function(){if(_0x5bea95){emit(_0x28dbd1[_0x20df('0x1f')],_0x3a16b3,util[_0x20df('0x2e')](_0x20df('0x2f'),_0x5bea95[_0x20df('0x30')]),util[_0x20df('0x2e')](_0x20df('0x31'),_0x2ebda9['action'][_0x20df('0x32')]()),{'evt':_[_0x20df('0x33')](_0x28dbd1,{'autoCreate':_0x36e984}),'contact':_0x2f48fc===undefined?{}:_0x2f48fc,'contacts':_0xfb9503[_0x20df('0x34')]===0x0?undefined:_0xfb9503});}});}; \ No newline at end of file +var _0xf147=['createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','destcalleridname','push','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','name','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile'];(function(_0x4ac0d5,_0x59e212){var _0x5d0a67=function(_0x455b1c){while(--_0x455b1c){_0x4ac0d5['push'](_0x4ac0d5['shift']());}};_0x5d0a67(++_0x59e212);}(_0xf147,0x1a3));var _0x7f14=function(_0x3b5a83,_0x1901d3){_0x3b5a83=_0x3b5a83-0x0;var _0x41fe42=_0xf147[_0x3b5a83];return _0x41fe42;};'use strict';var _=require(_0x7f14('0x0'));var BPromise=require(_0x7f14('0x1'));var Redis=require(_0x7f14('0x2'));var util=require(_0x7f14('0x3'));var config=require(_0x7f14('0x4'));var logger=require(_0x7f14('0x5'))(_0x7f14('0x6'));var cmContactRpc=require(_0x7f14('0x7'));config['redis']=_[_0x7f14('0x8')](config[_0x7f14('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7f14('0xa'))(new Redis(config[_0x7f14('0x9')]));function emit(_0x45f1aa,_0x1d9daa,_0x41b912,_0x4705af,_0x5b3bf7){logger[_0x7f14('0xb')](_0x7f14('0xc'),_0x45f1aa,_0x1d9daa['id'],_0x41b912,_0x4705af,JSON[_0x7f14('0xd')](_0x5b3bf7));io['to'](_0x41b912)[_0x7f14('0xe')](_0x4705af,_0x5b3bf7);}exports[_0x7f14('0xf')]=function(_0x55c5cf,_0x39e0fe,_0x23c905,_0x5daacd){var _0x28a29b,_0x10a99b;var _0x439eaa={};var _0x2333aa=Number(_0x23c905['data1']);var _0x40f72b=_0x23c905[_0x7f14('0x10')]?Boolean(Number(_0x23c905[_0x7f14('0x10')])):![];var _0x56904c;if(_0x5daacd[_0x7f14('0x11')]){_0x439eaa['id']=_0x5daacd[_0x7f14('0x11')];}if(!_0x439eaa['id']){_0x439eaa[_0x7f14('0x12')]=_0x2333aa;_0x56904c=_0x23c905[_0x7f14('0x13')]&&_0x23c905[_0x7f14('0x13')]!=='0'?_0x23c905[_0x7f14('0x13')]['split'](','):[_0x7f14('0x14')];_0x439eaa[_0x7f14('0x15')]=_[_0x7f14('0x16')](_0x56904c,function(_0x1956a7){var _0x34a5ac={};_0x34a5ac[_0x1956a7]=_0x5daacd[_0x7f14('0x17')]?_0x5daacd[_0x7f14('0x18')]:_0x5daacd[_0x7f14('0x19')];return _0x34a5ac;});}var _0x530e10=['id',_0x7f14('0x1a'),_0x7f14('0x1b'),'phone',_0x7f14('0x1c'),'fax',_0x7f14('0x12'),_0x7f14('0x1d'),_0x7f14('0x1e'),'updatedAt'];var _0x5bfd9d=_[_0x7f14('0x1f')](_0x530e10,_0x56904c);BPromise[_0x7f14('0x20')]()[_0x7f14('0x21')](cmContactRpc[_0x7f14('0x22')]({'attributes':_0x5bfd9d,'where':_0x439eaa}))[_0x7f14('0x21')](function(_0x96c585){_0x10a99b=_0x96c585;if(!_[_0x7f14('0x23')](_0x10a99b)){if(_0x10a99b['length']===0x1){_0x28a29b=_0x10a99b[0x0];logger[_0x7f14('0xb')](_0x7f14('0x24'),_0x5daacd['uniqueid'],_0x39e0fe['id'],_0x28a29b['id']);}else{logger[_0x7f14('0xb')](_0x7f14('0x25'),_0x5daacd[_0x7f14('0x26')],_0x39e0fe['id'],_[_0x7f14('0x16')](_0x10a99b,'id')[_0x7f14('0x27')](','));}return;}else{logger[_0x7f14('0xb')](_0x7f14('0x28'),_0x5daacd[_0x7f14('0x26')],_0x39e0fe['id']);var _0x51102={'ListId':_0x2333aa};var _0x446ff8=_0x23c905['data4']&&_0x23c905[_0x7f14('0x29')]!=='0'?_0x23c905[_0x7f14('0x29')]:_0x7f14('0x14');if(_0x40f72b){logger[_0x7f14('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x5daacd[_0x7f14('0x26')],_0x39e0fe['id']);_0x51102[_0x446ff8]=_[_0x7f14('0x2a')](_0x5daacd[_0x7f14('0x17')])?_0x5daacd['calleridnum']:_0x5daacd['destcalleridnum'];if(_['isNil'](_0x5daacd[_0x7f14('0x17')])){_0x51102[_0x7f14('0x1a')]=_0x5daacd[_0x7f14('0x2b')]&&_0x5daacd[_0x7f14('0x2b')]!==_0x7f14('0x2c')?_0x5daacd[_0x7f14('0x2b')]:'Unknown';}else{_0x51102[_0x7f14('0x1a')]=_0x5daacd[_0x7f14('0x2d')]&&_0x5daacd[_0x7f14('0x2d')]!==''?_0x5daacd['destcalleridname']:'Unknown';}return BPromise[_0x7f14('0x20')]()[_0x7f14('0x21')](cmContactRpc['createContact'](_0x51102))[_0x7f14('0x21')](function(_0x3477e6){_0x28a29b=_0x3477e6;_0x10a99b[_0x7f14('0x2e')](_0x3477e6);if(_0x28a29b){logger[_0x7f14('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5daacd['uniqueid'],_0x39e0fe['id'],_0x28a29b['id']);}return;});}else{logger['info'](_0x7f14('0x2f'),_0x5daacd['uniqueid'],_0x39e0fe['id']);_0x51102[_0x446ff8]=_[_0x7f14('0x2a')](_0x5daacd['routeId'])?_0x5daacd['calleridnum']:_0x5daacd[_0x7f14('0x18')];if(_[_0x7f14('0x2a')](_0x5daacd[_0x7f14('0x17')])){_0x51102[_0x7f14('0x1a')]=_0x5daacd[_0x7f14('0x2b')]&&_0x5daacd['calleridname']!==_0x7f14('0x2c')?_0x5daacd[_0x7f14('0x2b')]:_0x7f14('0x30');}else{_0x51102[_0x7f14('0x1a')]=_0x5daacd[_0x7f14('0x2d')]&&_0x5daacd[_0x7f14('0x2d')]!==''?_0x5daacd['destcalleridname']:_0x7f14('0x30');}_0x28a29b=_0x51102;_0x10a99b['push'](_0x51102);return;}}})[_0x7f14('0x21')](function(){if(_0x55c5cf){emit(_0x5daacd[_0x7f14('0x26')],_0x39e0fe,util[_0x7f14('0x31')]('user:%s',_0x55c5cf[_0x7f14('0x32')]),util[_0x7f14('0x31')](_0x7f14('0x33'),_0x23c905[_0x7f14('0x34')][_0x7f14('0x35')]()),{'evt':_[_0x7f14('0x36')](_0x5daacd,{'autoCreate':_0x40f72b}),'contact':_0x28a29b===undefined?{}:_0x28a29b,'contacts':_0x10a99b[_0x7f14('0x37')]===0x0?undefined:_0x10a99b});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b571a4e..fb36700 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 _0xff12=['stringify','clone','checkTriggers','agents','interface','merge','variables','length','Actions','contactmanager','motionbar','browser','data1','TemplateId','data2','templates','render','html','template\x20not\x20found','buildUri','data3','isNil','data4','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winapp','winApplication','winArguments','format','user:%s','action','trigger:%s','toLowerCase','name','exec','integration','queue','routeId','script','replace','checkTrigger','AllConditions','checkConditions','channel','AnyConditions','some','ChatWebsiteId','operator','value','AccountId','upperFirst','message','event','agent','membername','lastevent','exports','util','lodash','./urlforward','./integration','./cmContact','../../../config/logger','trigger','redis','socket.io-emitter','popup','url','triggers','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','freshdeskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','emit'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xff12,0xa8));var _0x2ff1=function(_0x5429e6,_0x1f78fe){_0x5429e6=_0x5429e6-0x0;var _0x3c6711=_0xff12[_0x5429e6];return _0x3c6711;};'use strict';var util=require(_0x2ff1('0x0'));var _=require(_0x2ff1('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x2ff1('0x2'));var integration=require(_0x2ff1('0x3'));var cmContact=require(_0x2ff1('0x4'));var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x2ff1('0x5'))(_0x2ff1('0x6'));var ami=require('../ami');config[_0x2ff1('0x7')]=_['defaults'](config[_0x2ff1('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2ff1('0x8'))(new Redis(config[_0x2ff1('0x7')]));var operators={'equals':function(_0xf82e6a,_0x49337b){return _0xf82e6a==_0x49337b;},'not_equals':function(_0x3febd0,_0x327528){return _0x3febd0!=_0x327528;}};var barAndWebActions=[_0x2ff1('0x9'),_0x2ff1('0xa'),'winapp'];function Trigger(_0x170d00){this[_0x2ff1('0xb')]=_0x170d00[_0x2ff1('0xb')];this['agents']=_0x170d00['agents'];this['voiceQueues']=_0x170d00['voiceQueues'];this['templates']=_0x170d00['templates'];this[_0x2ff1('0xc')]=_0x170d00['voiceExtensions'];this[_0x2ff1('0xd')]=_0x170d00[_0x2ff1('0xd')];this['freshdeskAccounts']=_0x170d00['freshdeskAccounts'];this[_0x2ff1('0xe')]=_0x170d00['salesforceAccounts'];this['sugarcrmAccounts']=_0x170d00[_0x2ff1('0xf')];this['zohoAccounts']=_0x170d00[_0x2ff1('0x10')];this['deskAccounts']=_0x170d00[_0x2ff1('0x11')];this[_0x2ff1('0x12')]=_0x170d00[_0x2ff1('0x12')];this[_0x2ff1('0x13')]=_0x170d00[_0x2ff1('0x13')];this[_0x2ff1('0x14')]=_0x170d00[_0x2ff1('0x14')];this[_0x2ff1('0x15')]=_0x170d00[_0x2ff1('0x15')];this['accounts']={'zendesk':this[_0x2ff1('0xd')],'salesforce':this[_0x2ff1('0xe')],'freshdesk':this[_0x2ff1('0x16')],'sugarcrm':this[_0x2ff1('0xf')],'zoho':this[_0x2ff1('0x10')],'desk':this[_0x2ff1('0x11')],'vtiger':this[_0x2ff1('0x12')],'dynamics365':this[_0x2ff1('0x14')],'freshsales':this[_0x2ff1('0x15')],'servicenow':this[_0x2ff1('0x13')]};ami['on'](_0x2ff1('0x17'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x1a'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x1b'),this['syncCustomEvent'][_0x2ff1('0x19')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x1c'),this[_0x2ff1('0x18')]['bind'](this));ami['on']('custom:agentnoanswer',this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x1d'),this[_0x2ff1('0x18')]['bind'](this));ami['on'](_0x2ff1('0x1e'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x1f'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x20'),this[_0x2ff1('0x18')]['bind'](this));ami['on'](_0x2ff1('0x21'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x22'),this[_0x2ff1('0x23')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x24'),this[_0x2ff1('0x23')][_0x2ff1('0x19')](this));ami['on']('custom:dialend',this[_0x2ff1('0x23')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x2ff1('0x26'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x27'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x28'),this[_0x2ff1('0x18')][_0x2ff1('0x19')](this));ami['on'](_0x2ff1('0x29'),this[_0x2ff1('0x18')]['bind'](this));ami['on']('custom:rejectmessage',this['syncCustomEvent']['bind'](this));}Trigger[_0x2ff1('0x2a')][_0x2ff1('0x2b')]=function(_0x5cac01,_0x3611fd,_0x52e1cb){logger['info'](_0x5cac01,_0x3611fd,JSON[_0x2ff1('0x2c')](_0x52e1cb));io['to'](_0x5cac01)[_0x2ff1('0x2b')](_0x3611fd,_0x52e1cb);};Trigger[_0x2ff1('0x2a')][_0x2ff1('0x18')]=function(_0x393ee5){var _0x55e0bf=_[_0x2ff1('0x2d')](_0x393ee5);this[_0x2ff1('0x2e')](_0x55e0bf);};Trigger['prototype'][_0x2ff1('0x23')]=function(_0x32414d){if(this[_0x2ff1('0x2f')][_0x32414d[_0x2ff1('0x30')]]){this[_0x2ff1('0x18')](_0x32414d);}};Trigger['prototype'][_0x2ff1('0x2e')]=function(_0x4e543b){var _0x511a30;for(var _0x4abceb in this[_0x2ff1('0xb')]){if(this[_0x2ff1('0xb')]['hasOwnProperty'](_0x4abceb)){if(this['triggers'][_0x4abceb]['status']){_0x511a30=this['checkTrigger'](this['triggers'][_0x4abceb],_0x4e543b);if(_0x511a30){_[_0x2ff1('0x31')](_0x4e543b,_0x4e543b[_0x2ff1('0x32')]);for(var _0x4f4a81=0x0,_0x39e5c0,_0x113ab1,_0x452b47;_0x4f4a810x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ 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 0d155ea..23a3800 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 _0x8120=['emit','serverUrl','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','POST','remoteUri','username','password','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','length','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','internalemailaddress','outbound','destcalleridnum','calleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','toLowerCase','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','nameField','customField','idField','indexOf','content','incident','incidents','assign','Subjects','Descriptions','/contacts(','ticketType','phonecall','phonecalls','getString','callDirection','queue','Fields','headers','ticketId','catch','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s'];(function(_0x1a12eb,_0x4de293){var _0x193910=function(_0x57995f){while(--_0x57995f){_0x1a12eb['push'](_0x1a12eb['shift']());}};_0x193910(++_0x4de293);}(_0x8120,0x194));var _0x0812=function(_0x3ed684,_0x47e8b3){_0x3ed684=_0x3ed684-0x0;var _0x2592b5=_0x8120[_0x3ed684];return _0x2592b5;};'use strict';var _=require(_0x0812('0x0'));var BPromise=require(_0x0812('0x1'));var rp=require(_0x0812('0x2'));var util=require(_0x0812('0x3'));var intUtil=require(_0x0812('0x4'));var md5=require(_0x0812('0x5'));var Redis=require(_0x0812('0x6'));var logger=require(_0x0812('0x7'))(_0x0812('0x8'));var config=require(_0x0812('0x9'));config[_0x0812('0xa')]=_[_0x0812('0xb')](config[_0x0812('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0812('0xa')]));function getAuthToken(_0x2054a9,_0x2a0be5,_0x12bd71){var _0x34d3ee={'method':_0x0812('0xc'),'uri':_0x2a0be5,'form':{'client_id':_0x2054a9['clientId'],'resource':_0x2054a9[_0x0812('0xd')],'username':_0x2054a9[_0x0812('0xe')],'password':_0x2054a9['password'],'grant_type':_0x0812('0xf'),'client_secret':_0x2054a9['clientSecret']},'json':!![]};return rp(_0x34d3ee)[_0x0812('0x10')](function(_0x404ea9){return _0x404ea9['access_token'];})['catch'](function(_0x5b6d41){logger[_0x0812('0x11')]('['+[_0x12bd71[_0x0812('0x12')]()]+_0x0812('0x13'));return _0x5b6d41[_0x0812('0x14')];});}function getUser(_0x15e7ff,_0x412918,_0x584749,_0xd7e00d,_0x590b38,_0x5a79ff){return new BPromise(function(_0x413653,_0x456a15){return getAuthToken(_0x412918,_0xd7e00d,_0x5a79ff)['then'](function(_0x141325){var _0xcb0ac6={'method':_0x0812('0x15'),'uri':_0x590b38+_0x0812('0x16'),'headers':{'Authorization':_0x0812('0x17')+_0x141325,'OData-Version':_0x0812('0x18')},'json':!![]};return rp(_0xcb0ac6);})[_0x0812('0x10')](function(_0x22f228){var _0x2c4823=_0x22f228[_0x0812('0x19')];var _0x3a1c8f=![];var _0x377e95=null;if(!_['isNil'](_0x584749)){if(intUtil[_0x0812('0x1a')](_0x584749['email'])){_0x15e7ff['userEmail']=_0x584749['email'];for(_0x377e95=0x0;_0x377e95<_0x2c4823[_0x0812('0x1b')];_0x377e95++){if(_0x2c4823[_0x377e95]['internalemailaddress']===_0x584749[_0x0812('0x1c')]&&!_0x2c4823[_0x377e95][_0x0812('0x1d')]){_0x3a1c8f=!![];logger[_0x0812('0x1e')]('['+[_0x5a79ff[_0x0812('0x12')]()]+_0x0812('0x1f')+_0x2c4823[_0x377e95][_0x0812('0x20')]+'!');_0x15e7ff[_0x0812('0x21')]=_0x2c4823[_0x377e95][_0x0812('0x20')];}}}}if(!_0x3a1c8f){logger[_0x0812('0x1e')]('['+[_0x5a79ff['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x15e7ff[_0x0812('0x22')]=_0x412918[_0x0812('0xe')];for(_0x377e95=0x0;_0x377e95<_0x2c4823[_0x0812('0x1b')];_0x377e95++){if(_0x2c4823[_0x377e95][_0x0812('0x23')]===_0x412918['username']){_0x15e7ff['userId']=_0x2c4823[_0x377e95][_0x0812('0x20')];}}}_0x413653(_0x15e7ff);})['catch'](function(_0x3320ae){_0x456a15(_0x3320ae[_0x0812('0x14')]);});});}function createEndUser(_0x468117,_0x38e3e8,_0x21b02d,_0x4f8c4a,_0x3f60e3,_0x180546){return new BPromise(function(_0x3fadf8,_0x41a358){return getAuthToken(_0x38e3e8,_0x21b02d,_0x180546)['then'](function(_0x92462e){var _0x528faa=_0x180546['toLowerCase']()===_0x0812('0x24')?_0x3f60e3[_0x0812('0x25')]:_0x3f60e3[_0x0812('0x26')];var _0x12b63f={'method':_0x0812('0xc'),'uri':_0x4f8c4a+'contacts','body':{'telephone1':_0x528faa,'fullname':_0x528faa,'firstname':_0x528faa,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0812('0x27')+_0x468117['userId']+')'},'headers':{'Authorization':_0x0812('0x17')+_0x92462e,'OData-Version':_0x0812('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x12b63f);})[_0x0812('0x10')](function(_0x545722){var _0x1995ae=_0x545722['headers'][_0x0812('0x28')];var _0x4be39a=_0x1995ae[_0x0812('0x29')](_0x1995ae['lastIndexOf']('(')+0x1,_0x1995ae[_0x0812('0x2a')](')'));_0x468117[_0x0812('0x2b')]=_0x4be39a;_0x3fadf8(_0x468117);})['catch'](function(_0x3341f6){_0x41a358(_0x3341f6['message']);});});}function getEndUser(_0x4a9fcc,_0x3b2316,_0x7a5421,_0x5224e0,_0x3412b2,_0x31ae4e){return new BPromise(function(_0x15992f,_0x1fb7d0){return getAuthToken(_0x3b2316,_0x7a5421,_0x31ae4e)[_0x0812('0x10')](function(_0x492ad0){var _0x2e66d2={'method':'GET','uri':_0x5224e0+_0x0812('0x2c'),'headers':{'Authorization':_0x0812('0x17')+_0x492ad0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e66d2);})[_0x0812('0x10')](function(_0x109efc){var _0x4ccc07=null;if(_0x109efc){var _0x2cd846=_0x109efc[_0x0812('0x19')];var _0x3bf914=![];for(_0x4ccc07=0x0;_0x4ccc07<_0x2cd846[_0x0812('0x1b')];_0x4ccc07++){var _0x1e0065=_0x31ae4e[_0x0812('0x2d')]()===_0x0812('0x24')?_0x3412b2[_0x0812('0x25')]:_0x3412b2[_0x0812('0x26')];if(_0x2cd846[_0x4ccc07][_0x0812('0x2e')]===_0x1e0065){_0x3bf914=!![];_0x4a9fcc[_0x0812('0x2b')]=_0x2cd846[_0x4ccc07][_0x0812('0x2f')];}}if(_0x3bf914){_0x15992f(_0x4a9fcc);}else{return createEndUser(_0x4a9fcc,_0x3b2316,_0x7a5421,_0x5224e0,_0x3412b2,_0x31ae4e)[_0x0812('0x10')](function(_0xa5294e){logger[_0x0812('0x1e')]('['+[_0x31ae4e['toUpperCase']()]+_0x0812('0x30'),_0xa5294e[_0x0812('0x2b')]);_0x15992f(_0xa5294e);});}}else{return createEndUser(_0x4a9fcc,_0x3b2316,_0x7a5421,_0x5224e0,_0x3412b2,_0x31ae4e)[_0x0812('0x10')](function(_0xc66e48){logger['info']('['+[_0x31ae4e[_0x0812('0x12')]()]+_0x0812('0x31'),_0xc66e48[_0x0812('0x2b')]);_0x15992f(_0xc66e48);});}});});}function getCustomFields(_0x572386,_0xd866f3,_0x51334e){var _0x15b6fd={};if(_0x572386[_0x0812('0x1b')]>0x0){_[_0x0812('0x32')](_0x572386,function(_0x47ce88){if(_0x47ce88['type']===_0x0812('0x33')&&_0x47ce88[_0x0812('0x34')]&&!_0x47ce88[_0x0812('0x35')]){var _0x586e52=_0x47ce88[_0x0812('0x36')][_0x0812('0x2d')]();var _0x509f41=_0x586e52[_0x0812('0x29')](0x0,_0x586e52['indexOf']('_'));var _0x9f1b3f=_0x586e52[_0x0812('0x29')](_0x586e52[_0x0812('0x37')]('_')+0x1);if(_0x509f41===_0x51334e){_0x15b6fd[_0x9f1b3f]=_0x47ce88[_0x0812('0x38')];}}});}return _0x15b6fd;}function getTicket(_0x5823d0,_0x3bd973,_0x8cc238,_0x2977f4,_0x25ab9c,_0x2f79ef,_0x2478c7){return new BPromise(function(_0x9a4c8a,_0x1b47dc){var _0x4ab58f;return getAuthToken(_0x3bd973,_0x8cc238,_0x2478c7)[_0x0812('0x10')](function(_0x194d8e){if(_0x2f79ef['ticketType']===_0x0812('0x39')){_0x4ab58f={'method':'POST','uri':_0x2977f4+_0x0812('0x3a'),'body':Object[_0x0812('0x3b')]({},{'title':intUtil['getString'](_0x2f79ef[_0x0812('0x3c')],_0x25ab9c,'\x20'),'description':intUtil['getString'](_0x2f79ef[_0x0812('0x3d')],_0x25ab9c,'\x0a'),'customerid_contact@odata.bind':_0x0812('0x3e')+_0x5823d0['enduserId']+')','ownerid@odata.bind':_0x0812('0x27')+_0x5823d0[_0x0812('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x2f79ef['Fields'],_0x25ab9c,_0x2f79ef[_0x0812('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x194d8e,'OData-Version':_0x0812('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f79ef[_0x0812('0x3f')]===_0x0812('0x40')){_0x4ab58f={'method':'POST','uri':_0x2977f4+_0x0812('0x41'),'body':Object[_0x0812('0x3b')]({},{'subject':intUtil[_0x0812('0x42')](_0x2f79ef[_0x0812('0x3c')],_0x25ab9c,'\x20'),'phonenumber':String(_0x25ab9c['calleridnum']),'description':intUtil[_0x0812('0x42')](_0x2f79ef[_0x0812('0x3d')],_0x25ab9c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x0812('0x3e')+_0x5823d0[_0x0812('0x2b')]+')','ownerid@odata.bind':_0x0812('0x27')+_0x5823d0['userId']+')','directioncode':_0x5823d0[_0x0812('0x43')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5823d0[_0x0812('0x21')]+')','participationtypemask':_0x5823d0[_0x0812('0x43')]===_0x0812('0x44')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5823d0[_0x0812('0x2b')]+')','participationtypemask':_0x5823d0['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x2f79ef[_0x0812('0x45')],_0x25ab9c,_0x2f79ef[_0x0812('0x3f')])),'headers':{'Authorization':_0x0812('0x17')+_0x194d8e,'OData-Version':_0x0812('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4ab58f);})[_0x0812('0x10')](function(_0x44a79d){var _0x173ecb=_0x44a79d[_0x0812('0x46')][_0x0812('0x28')];var _0x104489=_0x173ecb[_0x0812('0x29')](_0x173ecb[_0x0812('0x2a')]('(')+0x1,_0x173ecb[_0x0812('0x2a')](')'));_0x5823d0[_0x0812('0x47')]=_0x104489;_0x9a4c8a(_0x5823d0);})[_0x0812('0x48')](function(_0x156f73){_0x1b47dc(_0x156f73['message']);});});}function emit(_0x5464ee,_0x2097c8,_0x5489a7,_0x563816){var _0x56486e={'uri':util[_0x0812('0x49')](_0x0812('0x4a'),_0x5464ee,_0x5489a7,_0x563816)};io['to'](util[_0x0812('0x49')](_0x0812('0x4b'),_0x2097c8))[_0x0812('0x4c')]('trigger:browser:url',_0x56486e);}exports['cs']=function(_0x26abf9,_0x2772d8,_0x33c472,_0x2c5399,_0x24f3f3,_0x4015e7,_0x55793b,_0x441173){var _0x2f6f05={};_0x4015e7['remoteUri']=intUtil['stripTrailingSlash'](_0x4015e7[_0x0812('0xd')]);_0x4015e7[_0x0812('0x4d')]=intUtil[_0x0812('0x4e')](_0x4015e7[_0x0812('0x4d')]);_0x2f6f05[_0x0812('0x43')]=_0x441173===_0x0812('0x44')||_0x441173==='unmanaged'?_0x0812('0x44'):'outbound';var _0x5ecd07=util[_0x0812('0x49')](_0x0812('0x4f'),_0x4015e7[_0x0812('0xd')]);var _0x438220=util['format'](_0x0812('0x50'),_0x4015e7['tenantId']);var _0x38d70b=util[_0x0812('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4015e7[_0x0812('0x4d')],_0x2772d8[_0x0812('0x51')],md5(_0x2772d8[_0x0812('0x51')]));if(_0x24f3f3&&_0x24f3f3[_0x0812('0x52')]){logger[_0x0812('0x1e')](_0x0812('0x53'),_0x0812('0x54'));_0x2772d8[_0x0812('0x55')]=_0x38d70b;}else if(_0x55793b&&_0x55793b[_0x0812('0x56')]&&_0x55793b[_0x0812('0x56')]!==_0x0812('0x57')){logger[_0x0812('0x1e')](_0x0812('0x58'),_0x0812('0x54'));_0x2772d8[_0x0812('0x55')]=_0x38d70b;}else{_0x2772d8[_0x0812('0x55')]='';}return getUser(_0x2f6f05,_0x4015e7,_0x2c5399,_0x438220,_0x5ecd07,_0x441173)['then'](function(_0x371f6b){logger[_0x0812('0x1e')]('['+_0x441173[_0x0812('0x12')]()+_0x0812('0x59'),_0x371f6b[_0x0812('0x21')]);logger[_0x0812('0x1e')]('['+_0x441173[_0x0812('0x12')]()+_0x0812('0x5a'),_0x371f6b[_0x0812('0x22')]);return getEndUser(_0x371f6b,_0x4015e7,_0x438220,_0x5ecd07,_0x2772d8,_0x441173);})[_0x0812('0x10')](function(_0x1214e6){logger['info']('['+_0x441173[_0x0812('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1214e6[_0x0812('0x2b')]);logger['info']('['+_0x441173['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x2772d8[_0x0812('0x26')]);return getTicket(_0x1214e6,_0x4015e7,_0x438220,_0x5ecd07,_0x2772d8,_0x33c472,_0x441173);})[_0x0812('0x10')](function(_0x40a73f){logger[_0x0812('0x1e')](util[_0x0812('0x49')]('['+_0x441173[_0x0812('0x12')]()+_0x0812('0x5b'),_0x33c472[_0x0812('0x3f')],_0x40a73f['ticketId']));logger[_0x0812('0x1e')](util['format']('['+_0x441173['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x441173));if(_0x441173!==_0x0812('0x5c')){logger[_0x0812('0x1e')]('['+_0x441173[_0x0812('0x12')]()+']',_0x0812('0x5d'));emit(_0x4015e7[_0x0812('0xd')],_0x2c5399[_0x0812('0x5e')],_0x33c472[_0x0812('0x3f')],_0x40a73f[_0x0812('0x47')]);}})[_0x0812('0x48')](function(_0x5c7d8f){logger[_0x0812('0x11')]('['+_0x441173[_0x0812('0x12')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x0812('0x5f')](_0x5c7d8f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x77b6=['catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','Bearer\x20','phonecalls','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token'];(function(_0x53e95a,_0x29d95f){var _0x54dc05=function(_0x33c3b4){while(--_0x33c3b4){_0x53e95a['push'](_0x53e95a['shift']());}};_0x54dc05(++_0x29d95f);}(_0x77b6,0x1d3));var _0x677b=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x77b6[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x677b('0x0'));var BPromise=require(_0x677b('0x1'));var rp=require(_0x677b('0x2'));var util=require(_0x677b('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x677b('0x4'));var config=require(_0x677b('0x5'));config[_0x677b('0x6')]=_[_0x677b('0x7')](config[_0x677b('0x6')],{'host':_0x677b('0x8'),'port':0x18eb});var io=require(_0x677b('0x9'))(new Redis(config['redis']));function getAuthToken(_0x34896b,_0x336101,_0x32e77a){var _0x19a141={'method':_0x677b('0xa'),'uri':_0x336101,'form':{'client_id':_0x34896b[_0x677b('0xb')],'resource':_0x34896b[_0x677b('0xc')],'username':_0x34896b[_0x677b('0xd')],'password':_0x34896b['password'],'grant_type':_0x677b('0xe'),'client_secret':_0x34896b[_0x677b('0xf')]},'json':!![]};return rp(_0x19a141)[_0x677b('0x10')](function(_0x53c27d){return _0x53c27d[_0x677b('0x11')];})[_0x677b('0x12')](function(_0x1c27e5){logger[_0x677b('0x13')]('['+[_0x32e77a['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x1c27e5[_0x677b('0x14')];});}function getUser(_0x58cb25,_0x1be50b,_0x3a5e05,_0x388b83,_0x503339,_0x1e4a88){return new BPromise(function(_0x4c4a90,_0x5eeb6e){return getAuthToken(_0x1be50b,_0x388b83,_0x1e4a88)[_0x677b('0x10')](function(_0x4227a4){var _0x1f48d7={'method':_0x677b('0x15'),'uri':_0x503339+_0x677b('0x16'),'headers':{'Authorization':'Bearer\x20'+_0x4227a4,'OData-Version':_0x677b('0x17')},'json':!![]};return rp(_0x1f48d7);})['then'](function(_0x5bed45){var _0xfaedbe=_0x5bed45[_0x677b('0x18')];var _0x313e1c=![];var _0x1d6940=null;if(!_['isNil'](_0x3a5e05)){if(intUtil[_0x677b('0x19')](_0x3a5e05[_0x677b('0x1a')])){_0x58cb25[_0x677b('0x1b')]=_0x3a5e05['email'];for(_0x1d6940=0x0;_0x1d6940<_0xfaedbe[_0x677b('0x1c')];_0x1d6940++){if(_0xfaedbe[_0x1d6940][_0x677b('0x1d')]===_0x3a5e05[_0x677b('0x1a')]&&!_0xfaedbe[_0x1d6940]['isdisabled']){_0x313e1c=!![];logger[_0x677b('0x1e')]('['+[_0x1e4a88[_0x677b('0x1f')]()]+_0x677b('0x20')+_0xfaedbe[_0x1d6940][_0x677b('0x21')]+'!');_0x58cb25[_0x677b('0x22')]=_0xfaedbe[_0x1d6940][_0x677b('0x21')];}}}}if(!_0x313e1c){logger['info']('['+[_0x1e4a88[_0x677b('0x1f')]()]+_0x677b('0x23'));_0x58cb25[_0x677b('0x1b')]=_0x1be50b[_0x677b('0xd')];for(_0x1d6940=0x0;_0x1d6940<_0xfaedbe[_0x677b('0x1c')];_0x1d6940++){if(_0xfaedbe[_0x1d6940]['internalemailaddress']===_0x1be50b[_0x677b('0xd')]){_0x58cb25['userId']=_0xfaedbe[_0x1d6940][_0x677b('0x21')];}}}_0x4c4a90(_0x58cb25);})[_0x677b('0x12')](function(_0x254218){_0x5eeb6e(_0x254218[_0x677b('0x14')]);});});}function createEndUser(_0x3395c6,_0x451965,_0x55f02d,_0x3b31db,_0x3daf6f,_0x1dbda8){return new BPromise(function(_0x61b39e,_0x444199){return getAuthToken(_0x451965,_0x55f02d,_0x1dbda8)['then'](function(_0x2fe2f6){var _0x48f530=_0x1dbda8[_0x677b('0x24')]()===_0x677b('0x25')?_0x3daf6f[_0x677b('0x26')]:_0x3daf6f[_0x677b('0x27')];var _0x11dcd5={'method':_0x677b('0xa'),'uri':_0x3b31db+_0x677b('0x28'),'body':{'telephone1':_0x48f530,'fullname':_0x48f530,'firstname':_0x48f530,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x677b('0x29')+_0x3395c6['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x2fe2f6,'OData-Version':_0x677b('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x11dcd5);})['then'](function(_0x4877f1){var _0x3ab4b1=_0x4877f1[_0x677b('0x2a')][_0x677b('0x2b')];var _0x583f6e=_0x3ab4b1['substring'](_0x3ab4b1[_0x677b('0x2c')]('(')+0x1,_0x3ab4b1[_0x677b('0x2c')](')'));_0x3395c6[_0x677b('0x2d')]=_0x583f6e;_0x61b39e(_0x3395c6);})['catch'](function(_0x575821){_0x444199(_0x575821[_0x677b('0x14')]);});});}function getEndUser(_0x1f2bba,_0x4de354,_0x16577f,_0x4fbfd1,_0x2df34d,_0x150a7b){return new BPromise(function(_0xa1e878,_0x186dd6){return getAuthToken(_0x4de354,_0x16577f,_0x150a7b)[_0x677b('0x10')](function(_0x146476){var _0x498a07={'method':'GET','uri':_0x4fbfd1+_0x677b('0x2e'),'headers':{'Authorization':'Bearer\x20'+_0x146476,'If-None-Match':null,'OData-Version':_0x677b('0x17')},'json':!![]};return rp(_0x498a07);})[_0x677b('0x10')](function(_0x5693f3){var _0x22fcf6=null;if(_0x5693f3){var _0xeb3726=_0x5693f3[_0x677b('0x18')];var _0x373b0d=![];for(_0x22fcf6=0x0;_0x22fcf6<_0xeb3726[_0x677b('0x1c')];_0x22fcf6++){var _0x417afc=_0x150a7b['toLowerCase']()==='outbound'?_0x2df34d[_0x677b('0x26')]:_0x2df34d[_0x677b('0x27')];if(_0xeb3726[_0x22fcf6]['telephone1']===_0x417afc){_0x373b0d=!![];_0x1f2bba[_0x677b('0x2d')]=_0xeb3726[_0x22fcf6][_0x677b('0x2f')];}}if(_0x373b0d){_0xa1e878(_0x1f2bba);}else{return createEndUser(_0x1f2bba,_0x4de354,_0x16577f,_0x4fbfd1,_0x2df34d,_0x150a7b)['then'](function(_0x4b801b){logger[_0x677b('0x1e')]('['+[_0x150a7b[_0x677b('0x1f')]()]+_0x677b('0x30'),_0x4b801b['enduserId']);_0xa1e878(_0x4b801b);});}}else{return createEndUser(_0x1f2bba,_0x4de354,_0x16577f,_0x4fbfd1,_0x2df34d,_0x150a7b)[_0x677b('0x10')](function(_0x24ec03){logger[_0x677b('0x1e')]('['+[_0x150a7b[_0x677b('0x1f')]()]+_0x677b('0x31'),_0x24ec03[_0x677b('0x2d')]);_0xa1e878(_0x24ec03);});}});});}function getCustomFields(_0x37c5c4,_0x125d73,_0x1bfae7){var _0x319b60={};if(_0x37c5c4[_0x677b('0x1c')]>0x0){_[_0x677b('0x32')](_0x37c5c4,function(_0x18c5ca){if(_0x18c5ca[_0x677b('0x33')]===_0x677b('0x34')&&_0x18c5ca[_0x677b('0x35')]&&!_0x18c5ca[_0x677b('0x36')]){var _0x5ce98f=_0x18c5ca[_0x677b('0x37')][_0x677b('0x24')]();var _0x4c0af2=_0x5ce98f[_0x677b('0x38')](0x0,_0x5ce98f[_0x677b('0x39')]('_'));var _0x223592=_0x5ce98f[_0x677b('0x38')](_0x5ce98f[_0x677b('0x39')]('_')+0x1);if(_0x4c0af2===_0x1bfae7){_0x319b60[_0x223592]=_0x18c5ca[_0x677b('0x3a')];}}});}return _0x319b60;}function getTicket(_0x414d80,_0x3888b8,_0x10f6b9,_0x24f1ea,_0x216697,_0x2b5eaf,_0x2735ec){return new BPromise(function(_0x86945e,_0x275d3){var _0x4fcc56;return getAuthToken(_0x3888b8,_0x10f6b9,_0x2735ec)[_0x677b('0x10')](function(_0x5ca60c){if(_0x2b5eaf[_0x677b('0x3b')]===_0x677b('0x3c')){_0x4fcc56={'method':'POST','uri':_0x24f1ea+_0x677b('0x3d'),'body':Object[_0x677b('0x3e')]({},{'title':intUtil[_0x677b('0x3f')](_0x2b5eaf[_0x677b('0x40')],_0x216697,'\x20'),'description':intUtil[_0x677b('0x3f')](_0x2b5eaf[_0x677b('0x41')],_0x216697,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x414d80[_0x677b('0x2d')]+')','ownerid@odata.bind':_0x677b('0x29')+_0x414d80[_0x677b('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x2b5eaf[_0x677b('0x42')],_0x216697,_0x2b5eaf[_0x677b('0x3b')])),'headers':{'Authorization':_0x677b('0x43')+_0x5ca60c,'OData-Version':_0x677b('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2b5eaf[_0x677b('0x3b')]==='phonecall'){_0x4fcc56={'method':'POST','uri':_0x24f1ea+_0x677b('0x44'),'body':Object[_0x677b('0x3e')]({},{'subject':intUtil['getString'](_0x2b5eaf[_0x677b('0x40')],_0x216697,'\x20'),'phonenumber':String(_0x216697[_0x677b('0x27')]),'description':intUtil[_0x677b('0x3f')](_0x2b5eaf[_0x677b('0x41')],_0x216697,'\x0a'),'regardingobjectid_contact@odata.bind':_0x677b('0x45')+_0x414d80[_0x677b('0x2d')]+')','ownerid@odata.bind':_0x677b('0x29')+_0x414d80['userId']+')','directioncode':_0x414d80[_0x677b('0x46')]===_0x677b('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x677b('0x29')+_0x414d80[_0x677b('0x22')]+')','participationtypemask':_0x414d80[_0x677b('0x46')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x677b('0x45')+_0x414d80[_0x677b('0x2d')]+')','participationtypemask':_0x414d80[_0x677b('0x46')]===_0x677b('0x47')?0x1:0x2}]},getCustomFields(_0x2b5eaf['Fields'],_0x216697,_0x2b5eaf[_0x677b('0x3b')])),'headers':{'Authorization':'Bearer\x20'+_0x5ca60c,'OData-Version':_0x677b('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4fcc56);})[_0x677b('0x10')](function(_0x422cfc){var _0x4c8210=_0x422cfc['headers'][_0x677b('0x2b')];var _0x45b640=_0x4c8210[_0x677b('0x38')](_0x4c8210['lastIndexOf']('(')+0x1,_0x4c8210[_0x677b('0x2c')](')'));_0x414d80[_0x677b('0x48')]=_0x45b640;_0x86945e(_0x414d80);})[_0x677b('0x12')](function(_0x42fbcd){_0x275d3(_0x42fbcd[_0x677b('0x14')]);});});}function emit(_0x34a25a,_0x26ef66,_0x2ae23e,_0x529d24){var _0x1112c0={'uri':util[_0x677b('0x49')](_0x677b('0x4a'),_0x34a25a,_0x2ae23e,_0x529d24)};io['to'](util[_0x677b('0x49')](_0x677b('0x4b'),_0x26ef66))[_0x677b('0x4c')](_0x677b('0x4d'),_0x1112c0);}exports['cs']=function(_0x47339d,_0x18954d,_0x17aee5,_0x1eb18f,_0x35eaa4,_0x18409b,_0x1aea5c,_0xb05605){var _0x3d8a00={};_0x18409b[_0x677b('0xc')]=intUtil[_0x677b('0x4e')](_0x18409b[_0x677b('0xc')]);_0x18409b[_0x677b('0x4f')]=intUtil[_0x677b('0x4e')](_0x18409b[_0x677b('0x4f')]);_0x3d8a00['callDirection']=_0xb05605===_0x677b('0x47')||_0xb05605===_0x677b('0x50')?_0x677b('0x47'):_0x677b('0x25');var _0x4b6972=util[_0x677b('0x49')](_0x677b('0x51'),_0x18409b[_0x677b('0xc')]);var _0x52931f=util['format'](_0x677b('0x52'),_0x18409b[_0x677b('0x53')]);var _0x12a44d=util[_0x677b('0x49')](_0x677b('0x54'),_0x18409b[_0x677b('0x4f')],_0x18954d['uniqueid'],md5(_0x18954d[_0x677b('0x55')]));if(_0x35eaa4&&_0x35eaa4[_0x677b('0x56')]){logger[_0x677b('0x1e')](_0x677b('0x57'),_0x677b('0x58'));_0x18954d['recordingURL']=_0x12a44d;}else if(_0x1aea5c&&_0x1aea5c[_0x677b('0x59')]&&_0x1aea5c[_0x677b('0x59')]!=='none'){logger[_0x677b('0x1e')](_0x677b('0x5a'),'Recording\x20is\x20enabled!');_0x18954d['recordingURL']=_0x12a44d;}else{_0x18954d['recordingURL']='';}return getUser(_0x3d8a00,_0x18409b,_0x1eb18f,_0x52931f,_0x4b6972,_0xb05605)[_0x677b('0x10')](function(_0x44cff9){logger[_0x677b('0x1e')]('['+_0xb05605['toUpperCase']()+_0x677b('0x5b'),_0x44cff9[_0x677b('0x22')]);logger[_0x677b('0x1e')]('['+_0xb05605[_0x677b('0x1f')]()+']\x20The\x20User\x20email\x20is:',_0x44cff9[_0x677b('0x1b')]);return getEndUser(_0x44cff9,_0x18409b,_0x52931f,_0x4b6972,_0x18954d,_0xb05605);})[_0x677b('0x10')](function(_0x51cdab){logger[_0x677b('0x1e')]('['+_0xb05605['toUpperCase']()+_0x677b('0x5c'),_0x51cdab[_0x677b('0x2d')]);logger['info']('['+_0xb05605[_0x677b('0x1f')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x18954d[_0x677b('0x27')]);return getTicket(_0x51cdab,_0x18409b,_0x52931f,_0x4b6972,_0x18954d,_0x17aee5,_0xb05605);})[_0x677b('0x10')](function(_0x182c87){logger[_0x677b('0x1e')](util[_0x677b('0x49')]('['+_0xb05605[_0x677b('0x1f')]()+_0x677b('0x5d'),_0x17aee5[_0x677b('0x3b')],_0x182c87[_0x677b('0x48')]));logger[_0x677b('0x1e')](util[_0x677b('0x49')]('['+_0xb05605[_0x677b('0x1f')]()+_0x677b('0x5e'),_0xb05605));if(_0xb05605!=='unmanaged'){logger[_0x677b('0x1e')]('['+_0xb05605[_0x677b('0x1f')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x18409b[_0x677b('0xc')],_0x1eb18f[_0x677b('0x5f')],_0x17aee5[_0x677b('0x3b')],_0x182c87[_0x677b('0x48')]);}})[_0x677b('0x12')](function(_0x2b61dd){logger[_0x677b('0x13')]('['+_0xb05605[_0x677b('0x1f')]()+_0x677b('0x60'),util['inspect'](_0x2b61dd,{'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 bef6ff3..f97a712 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 _0x745f=['trigger:browser:url','error','monitor_format','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','socket.io-emitter','redis','application/json','emit','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','custom_fields','mapValues','value','POST','then','info','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','remoteUri','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString','base64','debug','GET','forEach','type','string','nameField','customField','toLowerCase','idField','content','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','user:%s'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x745f,0x1af));var _0xf745=function(_0xe69bf1,_0x487cbc){_0xe69bf1=_0xe69bf1-0x0;var _0x1259d1=_0x745f[_0xe69bf1];return _0x1259d1;};'use strict';var _=require(_0xf745('0x0'));var rp=require(_0xf745('0x1'));var md5=require('md5');var util=require(_0xf745('0x2'));var Redis=require(_0xf745('0x3'));var intUtil=require(_0xf745('0x4'));var config=require(_0xf745('0x5'));var logger=require('../../../../config/logger')(_0xf745('0x6'));config['redis']=_[_0xf745('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf745('0x8'))(new Redis(config[_0xf745('0x9')]));var headers={'Content-Type':_0xf745('0xa'),'Accept':_0xf745('0xa')};function emit(_0xe3df5e,_0x3027c9,_0x49fb99){io['to'](_0xe3df5e)[_0xf745('0xb')](_0x3027c9,_0x49fb99);}function getTicket(_0x7f6572,_0x2d6eae,_0x51cc71,_0xf593bc,_0x9a812d){logger['info']('Creating\x20new\x20ticket...');var _0x44d908=_['merge']({'responder_id':_0x2d6eae['id'],'requester_id':_0x51cc71['id'],'name':util['format'](_0xf745('0xc'),_0x9a812d[_0xf745('0xd')]),'phone':_0x9a812d[_0xf745('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xf593bc['Subjects'],_0x9a812d,'\x20'),'description':intUtil[_0xf745('0xf')](_0xf593bc['Descriptions'],_0x9a812d,_0xf745('0x10')),'tags':getTags(_0xf593bc[_0xf745('0x11')],'name')},getCustomFields(_0xf593bc['Fields'],_0x9a812d));_0x44d908[_0xf745('0x12')]=_[_0xf745('0x13')](_['keyBy'](_0x44d908[_0xf745('0x12')],'id'),_0xf745('0x14'));return request({'uri':util['format']('%s/api/v2/tickets',_0x7f6572['remoteUri']),'method':_0xf745('0x15'),'body':_0x44d908})[_0xf745('0x16')](function(_0x42ba68){logger[_0xf745('0x17')](_0xf745('0x18'));return _0x42ba68;});}function getUser(_0x35386f,_0x5c47d6){if(intUtil[_0xf745('0x19')](_0x5c47d6)){return request({'uri':util[_0xf745('0x1a')](_0xf745('0x1b'),_0x35386f[_0xf745('0x1c')]),'qs':{'email':_0x5c47d6}})[_0xf745('0x16')](function(_0x93a3b0){if(_0x93a3b0[_0xf745('0x1d')]){logger['info']('Agent\x20found!');return _[_0xf745('0x1e')](_0x93a3b0,function(_0x2b6119){return _0x2b6119[_0xf745('0x1f')][_0xf745('0x20')]===_0x5c47d6;});}else{logger['info'](_0xf745('0x21'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x35386f[_0xf745('0x1c')])})[_0xf745('0x16')](function(_0x1b0b0f){logger[_0xf745('0x17')]('Admin\x20account\x20selected.');return _0x1b0b0f;});}});}else{logger[_0xf745('0x17')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf745('0x1a')](_0xf745('0x22'),_0x35386f[_0xf745('0x1c')])})[_0xf745('0x16')](function(_0x29e3f8){logger[_0xf745('0x17')](_0xf745('0x23'));return _0x29e3f8;});}}function getEndUser(_0x2bea51,_0x16ba6b,_0x3d9278){logger[_0xf745('0x17')]('Searching\x20enduser\x20with\x20phone',_0x3d9278);return request({'uri':util['format'](_0xf745('0x24'),_0x2bea51['remoteUri']),'qs':{'phone':_0x3d9278}})['then'](function(_0x1a97bd){if(_0x1a97bd['length']){logger['info'](_0xf745('0x25'));return _[_0xf745('0x1e')](_0x1a97bd,{'phone':_0x3d9278});}else{logger[_0xf745('0x17')](_0xf745('0x26'));return request({'uri':util[_0xf745('0x1a')]('%s/api/v2/contacts',_0x2bea51[_0xf745('0x1c')]),'method':'POST','body':{'name':_0x16ba6b,'phone':_0x3d9278}})[_0xf745('0x16')](function(_0x3861a5){logger['info']('Enduser\x20created.');return _0x3861a5;});}});}function getAuth(_0x1b73de){return util['format'](_0xf745('0x27'),new Buffer(_0x1b73de['apiKey']+':X')[_0xf745('0x28')](_0xf745('0x29')));}function request(_0x14c028){logger[_0xf745('0x2a')]('[HTTP]',JSON['stringify'](_0x14c028));return rp(_['defaults'](_0x14c028,{'method':_0xf745('0x2b'),'headers':headers,'json':!![]}));}function getTags(_0x118670,_0x1d32cb){var _0x57b332=[];if(_0x118670&&_0x118670[_0xf745('0x1d')]>0x0){_0x57b332=_['map'](_0x118670,_0x1d32cb);}return _0x57b332;}function getCustomFields(_0x275e2b,_0x11d697){var _0x5d68f8=[];var _0x48d8aa={'custom_fields':[]};if(_0x275e2b[_0xf745('0x1d')]>0x0){_[_0xf745('0x2c')](_0x275e2b,function(_0x468113){if(_0x468113[_0xf745('0x2d')]===_0xf745('0x2e')&&_0x468113[_0xf745('0x2f')]&&!_0x468113[_0xf745('0x30')]){_0x48d8aa[_0x468113[_0xf745('0x2f')][_0xf745('0x31')]()]=_0x468113['content']['toString']();}else if(_0x468113['type']==='string'&&_0x468113[_0xf745('0x32')]&&_0x468113[_0xf745('0x30')]){_0x48d8aa[_0xf745('0x12')]['push']({'id':_0x468113[_0xf745('0x32')],'value':_0x468113[_0xf745('0x33')]['toString']()});}else if(_0x468113[_0xf745('0x2d')]===_0xf745('0x34')&&_0x468113['variableName']&&_0x468113[_0xf745('0x32')]&&_0x468113['customField']){_0x11d697[_0x468113[_0xf745('0x35')]]&&_0x48d8aa['custom_fields'][_0xf745('0x36')]({'id':_0x468113[_0xf745('0x32')],'value':_0x11d697[_0x468113[_0xf745('0x35')]][_0xf745('0x28')]()});}else if(_0x468113['type']===_0xf745('0x37')&&_0x468113[_0xf745('0x38')]&&_0x468113[_0xf745('0x38')][_0xf745('0x39')]&&_0x468113[_0xf745('0x32')]&&_0x468113[_0xf745('0x30')]){_0x11d697[_0x468113['Variable'][_0xf745('0x39')][_0xf745('0x31')]()]&&_0x48d8aa['custom_fields'][_0xf745('0x36')]({'id':_0x468113[_0xf745('0x32')],'value':_0x11d697[_0x468113['Variable'][_0xf745('0x39')][_0xf745('0x31')]()][_0xf745('0x28')]()});}});}return _0x48d8aa;}exports[_0xf745('0x3a')]=function(_0x51686c,_0xa246de,_0x5dd344,_0x58c447,_0x17561c,_0x42919d){var _0x4926ac,_0x49cbe5;_0x42919d[_0xf745('0x1c')]=intUtil[_0xf745('0x3b')](_0x42919d[_0xf745('0x1c')]);_0x42919d[_0xf745('0x3c')]=intUtil[_0xf745('0x3b')](_0x42919d[_0xf745('0x3c')]);if(_0x17561c&&_0x17561c['monitor_format']){logger[_0xf745('0x17')](_0xf745('0x3d'),_0xf745('0x3e'));_0xa246de[_0xf745('0x3f')]=util[_0xf745('0x1a')](_0xf745('0x40'),_0x42919d[_0xf745('0x3c')],_0xa246de[_0xf745('0x41')],md5(_0xa246de[_0xf745('0x41')]));}else{_0xa246de[_0xf745('0x3f')]='';}headers[_0xf745('0x42')]=getAuth(_0x42919d);return getUser(_0x42919d,_0x58c447[_0xf745('0x20')])[_0xf745('0x16')](function(_0x24b215){_0x4926ac=_0x24b215;logger[_0xf745('0x17')]('The\x20User\x20ID\x20is:',_0x4926ac['id']);return getEndUser(_0x42919d,_0xa246de[_0xf745('0xd')],_0xa246de['calleridnum']);})[_0xf745('0x16')](function(_0xf19217){_0x49cbe5=_0xf19217;logger['info'](_0xf745('0x43'),_0x49cbe5['id']);return getTicket(_0x42919d,_0x4926ac,_0x49cbe5,_0x5dd344,_0xa246de);})[_0xf745('0x16')](function(_0x15a2d5){if(_0x15a2d5&&_0x15a2d5['id']){logger[_0xf745('0x17')]('Ticket\x20created!');logger[_0xf745('0x17')](_0xf745('0x44'),_0x15a2d5['id']);logger[_0xf745('0x17')](_0xf745('0x3d'),_0xf745('0x45'));emit(util[_0xf745('0x1a')]('user:%s',_0x58c447[_0xf745('0x39')]),'trigger:browser:url',{'uri':util[_0xf745('0x1a')](_0xf745('0x46'),_0x42919d['remoteUri'],_0x15a2d5['id'])});}})[_0xf745('0x47')](function(_0x58634c){logger['error'](_0xf745('0x3d'),JSON[_0xf745('0x48')](_0x58634c));});};exports[_0xf745('0x49')]=function(_0x263e7c,_0x491172,_0x5b6e7d,_0x370af0,_0x30f0b6,_0x240204,_0x29d287){var _0x442fa8,_0x4d61ee;_0x240204[_0xf745('0x1c')]=intUtil[_0xf745('0x3b')](_0x240204[_0xf745('0x1c')]);_0x240204['serverUrl']=intUtil[_0xf745('0x3b')](_0x240204['serverUrl']);if(_0x29d287&&_0x29d287[_0xf745('0x4a')]&&_0x29d287[_0xf745('0x4a')]!==_0xf745('0x4b')){logger['info'](_0xf745('0x4c'),_0xf745('0x3e'));_0x491172['recordingURL']=util['format'](_0xf745('0x40'),_0x240204[_0xf745('0x3c')],_0x491172['uniqueid'],md5(_0x491172[_0xf745('0x41')]));}headers[_0xf745('0x42')]=getAuth(_0x240204);return getUser(_0x240204,_0x370af0['email'])[_0xf745('0x16')](function(_0x4900be){_0x442fa8=_0x4900be;logger[_0xf745('0x17')]('The\x20User\x20ID\x20is:',_0x442fa8['id']);return getEndUser(_0x240204,_0x491172['destcalleridname'],_0x491172[_0xf745('0x4d')]);})[_0xf745('0x16')](function(_0x571011){_0x4d61ee=_0x571011;logger[_0xf745('0x17')](_0xf745('0x43'),_0x4d61ee['id']);return getTicket(_0x240204,_0x442fa8,_0x4d61ee,_0x5b6e7d,_0x491172);})[_0xf745('0x16')](function(_0x358719){if(_0x358719&&_0x358719['id']){logger['info'](_0xf745('0x18'));logger[_0xf745('0x17')](_0xf745('0x44'),_0x358719['id']);logger[_0xf745('0x17')](_0xf745('0x4c'),_0xf745('0x45'));emit(util[_0xf745('0x1a')](_0xf745('0x4e'),_0x370af0[_0xf745('0x39')]),_0xf745('0x4f'),{'uri':util[_0xf745('0x1a')](_0xf745('0x46'),_0x240204[_0xf745('0x1c')],_0x358719['id'])});}})['catch'](function(_0x5b0ad9){logger[_0xf745('0x50')](_0xf745('0x4c'),JSON[_0xf745('0x48')](_0x5b0ad9));});};exports['unmanaged']=function(_0xf973be,_0x22d6f2,_0x5c2d02,_0xe33e3,_0x480425,_0x2cd138){var _0x512485,_0x4fb00e;_0x2cd138[_0xf745('0x1c')]=intUtil[_0xf745('0x3b')](_0x2cd138[_0xf745('0x1c')]);_0x2cd138[_0xf745('0x3c')]=intUtil[_0xf745('0x3b')](_0x2cd138[_0xf745('0x3c')]);if(_0x480425&&_0x480425[_0xf745('0x51')]){logger['info']('['+_0x22d6f2[_0xf745('0x52')][_0xf745('0x53')]()+']',_0xf745('0x3e'));_0x22d6f2['recordingURL']=util[_0xf745('0x1a')](_0xf745('0x40'),_0x2cd138[_0xf745('0x3c')],_0x22d6f2[_0xf745('0x41')],md5(_0x22d6f2[_0xf745('0x41')]));}else{_0x22d6f2['recordingURL']='';}headers['Authorization']=getAuth(_0x2cd138);return getUser(_0x2cd138,'')[_0xf745('0x16')](function(_0x57e810){_0x512485=_0x57e810;logger[_0xf745('0x17')](_0xf745('0x54'),_0x512485['id']);return getEndUser(_0x2cd138,_0x22d6f2['calleridname'],_0x22d6f2['calleridnum']);})[_0xf745('0x16')](function(_0x43ba41){_0x4fb00e=_0x43ba41;logger[_0xf745('0x17')](_0xf745('0x43'),_0x4fb00e['id']);return getTicket(_0x2cd138,_0x512485,_0x4fb00e,_0x5c2d02,_0x22d6f2);})[_0xf745('0x16')](function(_0x531642){if(_0x531642){logger[_0xf745('0x17')]('Ticket\x20created!');logger[_0xf745('0x17')]('The\x20Ticket\x20ID\x20is:',_0x531642['id']);}})[_0xf745('0x47')](function(_0x139cdf){logger[_0xf745('0x50')]('['+_0x22d6f2[_0xf745('0x52')][_0xf745('0x53')]()+']',JSON[_0xf745('0x48')](_0x139cdf));});}; \ No newline at end of file +var _0xa3c1=['The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url','unmanaged','toUpperCase','lastevent','lodash','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','Tags','name','mapValues','keyBy','custom_fields','value','Ticket\x20created!','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x2c022a,_0x1ea7ba){var _0x422073=function(_0x12c051){while(--_0x12c051){_0x2c022a['push'](_0x2c022a['shift']());}};_0x422073(++_0x1ea7ba);}(_0xa3c1,0x11f));var _0x1a3c=function(_0x520e5c,_0x52e863){_0x520e5c=_0x520e5c-0x0;var _0x482f94=_0xa3c1[_0x520e5c];return _0x482f94;};'use strict';var _=require(_0x1a3c('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x1a3c('0x1'));var intUtil=require(_0x1a3c('0x2'));var config=require(_0x1a3c('0x3'));var logger=require(_0x1a3c('0x4'))('freshdesk');config[_0x1a3c('0x5')]=_[_0x1a3c('0x6')](config[_0x1a3c('0x5')],{'host':_0x1a3c('0x7'),'port':0x18eb});var io=require(_0x1a3c('0x8'))(new Redis(config[_0x1a3c('0x5')]));var headers={'Content-Type':_0x1a3c('0x9'),'Accept':_0x1a3c('0x9')};function emit(_0x2c7434,_0x536ba6,_0x35cf4d){io['to'](_0x2c7434)['emit'](_0x536ba6,_0x35cf4d);}function getTicket(_0x48ac53,_0x2c0a25,_0x3d72c1,_0x14fede,_0x1019a6){logger[_0x1a3c('0xa')](_0x1a3c('0xb'));var _0x147ea2=_[_0x1a3c('0xc')]({'responder_id':_0x2c0a25['id'],'requester_id':_0x3d72c1['id'],'name':util[_0x1a3c('0xd')](_0x1a3c('0xe'),_0x1019a6[_0x1a3c('0xf')]),'phone':_0x1019a6['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1a3c('0x10')](_0x14fede['Subjects'],_0x1019a6,'\x20'),'description':intUtil[_0x1a3c('0x10')](_0x14fede[_0x1a3c('0x11')],_0x1019a6,'
'),'tags':getTags(_0x14fede[_0x1a3c('0x12')],_0x1a3c('0x13'))},getCustomFields(_0x14fede['Fields'],_0x1019a6));_0x147ea2['custom_fields']=_[_0x1a3c('0x14')](_[_0x1a3c('0x15')](_0x147ea2[_0x1a3c('0x16')],'id'),_0x1a3c('0x17'));return request({'uri':util['format']('%s/api/v2/tickets',_0x48ac53['remoteUri']),'method':'POST','body':_0x147ea2})['then'](function(_0x34db6e){logger['info'](_0x1a3c('0x18'));return _0x34db6e;});}function getUser(_0x4114f6,_0x2872e6){if(intUtil['validateEmail'](_0x2872e6)){return request({'uri':util[_0x1a3c('0xd')]('%s/api/v2/agents',_0x4114f6['remoteUri']),'qs':{'email':_0x2872e6}})[_0x1a3c('0x19')](function(_0x21f95f){if(_0x21f95f[_0x1a3c('0x1a')]){logger[_0x1a3c('0xa')](_0x1a3c('0x1b'));return _['find'](_0x21f95f,function(_0x22de6c){return _0x22de6c[_0x1a3c('0x1c')][_0x1a3c('0x1d')]===_0x2872e6;});}else{logger[_0x1a3c('0xa')](_0x1a3c('0x1e'));return request({'uri':util['format'](_0x1a3c('0x1f'),_0x4114f6[_0x1a3c('0x20')])})[_0x1a3c('0x19')](function(_0x18c095){logger[_0x1a3c('0xa')](_0x1a3c('0x21'));return _0x18c095;});}});}else{logger[_0x1a3c('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1a3c('0xd')](_0x1a3c('0x1f'),_0x4114f6[_0x1a3c('0x20')])})['then'](function(_0x371546){logger[_0x1a3c('0xa')](_0x1a3c('0x21'));return _0x371546;});}}function getEndUser(_0x88a00c,_0x1f57e3,_0xe41ce9){logger[_0x1a3c('0xa')]('Searching\x20enduser\x20with\x20phone',_0xe41ce9);return request({'uri':util['format']('%s/api/v2/contacts',_0x88a00c[_0x1a3c('0x20')]),'qs':{'phone':_0xe41ce9}})[_0x1a3c('0x19')](function(_0x5d3907){if(_0x5d3907['length']){logger[_0x1a3c('0xa')](_0x1a3c('0x22'));return _[_0x1a3c('0x23')](_0x5d3907,{'phone':_0xe41ce9});}else{logger[_0x1a3c('0xa')](_0x1a3c('0x24'));return request({'uri':util[_0x1a3c('0xd')](_0x1a3c('0x25'),_0x88a00c['remoteUri']),'method':_0x1a3c('0x26'),'body':{'name':_0x1f57e3,'phone':_0xe41ce9}})[_0x1a3c('0x19')](function(_0x17c08f){logger[_0x1a3c('0xa')](_0x1a3c('0x27'));return _0x17c08f;});}});}function getAuth(_0x3ff017){return util['format'](_0x1a3c('0x28'),new Buffer(_0x3ff017[_0x1a3c('0x29')]+':X')[_0x1a3c('0x2a')](_0x1a3c('0x2b')));}function request(_0x3441c4){logger['debug'](_0x1a3c('0x2c'),JSON['stringify'](_0x3441c4));return rp(_[_0x1a3c('0x6')](_0x3441c4,{'method':_0x1a3c('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x2f0a59,_0x571160){var _0x1001aa=[];if(_0x2f0a59&&_0x2f0a59['length']>0x0){_0x1001aa=_[_0x1a3c('0x2e')](_0x2f0a59,_0x571160);}return _0x1001aa;}function getCustomFields(_0x29e708,_0x35c195){var _0x4f2372=[];var _0x2cac43={'custom_fields':[]};if(_0x29e708['length']>0x0){_[_0x1a3c('0x2f')](_0x29e708,function(_0x23ac3d){if(_0x23ac3d[_0x1a3c('0x30')]===_0x1a3c('0x31')&&_0x23ac3d[_0x1a3c('0x32')]&&!_0x23ac3d[_0x1a3c('0x33')]){_0x2cac43[_0x23ac3d['nameField'][_0x1a3c('0x34')]()]=_0x23ac3d[_0x1a3c('0x35')][_0x1a3c('0x2a')]();}else if(_0x23ac3d[_0x1a3c('0x30')]===_0x1a3c('0x31')&&_0x23ac3d['idField']&&_0x23ac3d[_0x1a3c('0x33')]){_0x2cac43[_0x1a3c('0x16')][_0x1a3c('0x36')]({'id':_0x23ac3d[_0x1a3c('0x37')],'value':_0x23ac3d[_0x1a3c('0x35')][_0x1a3c('0x2a')]()});}else if(_0x23ac3d[_0x1a3c('0x30')]===_0x1a3c('0x38')&&_0x23ac3d['variableName']&&_0x23ac3d['idField']&&_0x23ac3d[_0x1a3c('0x33')]){_0x35c195[_0x23ac3d[_0x1a3c('0x39')]]&&_0x2cac43[_0x1a3c('0x16')][_0x1a3c('0x36')]({'id':_0x23ac3d['idField'],'value':_0x35c195[_0x23ac3d[_0x1a3c('0x39')]][_0x1a3c('0x2a')]()});}else if(_0x23ac3d[_0x1a3c('0x30')]===_0x1a3c('0x3a')&&_0x23ac3d[_0x1a3c('0x3b')]&&_0x23ac3d[_0x1a3c('0x3b')][_0x1a3c('0x13')]&&_0x23ac3d[_0x1a3c('0x37')]&&_0x23ac3d['customField']){_0x35c195[_0x23ac3d[_0x1a3c('0x3b')][_0x1a3c('0x13')][_0x1a3c('0x34')]()]&&_0x2cac43[_0x1a3c('0x16')][_0x1a3c('0x36')]({'id':_0x23ac3d['idField'],'value':_0x35c195[_0x23ac3d[_0x1a3c('0x3b')][_0x1a3c('0x13')][_0x1a3c('0x34')]()][_0x1a3c('0x2a')]()});}});}return _0x2cac43;}exports['queue']=function(_0x34be04,_0x52c3b9,_0x3548f9,_0x25d446,_0x2806a6,_0x741ba3){var _0x435ae3,_0xe83664;_0x741ba3[_0x1a3c('0x20')]=intUtil[_0x1a3c('0x3c')](_0x741ba3[_0x1a3c('0x20')]);_0x741ba3[_0x1a3c('0x3d')]=intUtil[_0x1a3c('0x3c')](_0x741ba3[_0x1a3c('0x3d')]);if(_0x2806a6&&_0x2806a6[_0x1a3c('0x3e')]){logger['info'](_0x1a3c('0x3f'),_0x1a3c('0x40'));_0x52c3b9[_0x1a3c('0x41')]=util['format'](_0x1a3c('0x42'),_0x741ba3[_0x1a3c('0x3d')],_0x52c3b9[_0x1a3c('0x43')],md5(_0x52c3b9['uniqueid']));}else{_0x52c3b9[_0x1a3c('0x41')]='';}headers[_0x1a3c('0x44')]=getAuth(_0x741ba3);return getUser(_0x741ba3,_0x25d446[_0x1a3c('0x1d')])['then'](function(_0xf677c3){_0x435ae3=_0xf677c3;logger[_0x1a3c('0xa')](_0x1a3c('0x45'),_0x435ae3['id']);return getEndUser(_0x741ba3,_0x52c3b9[_0x1a3c('0xf')],_0x52c3b9[_0x1a3c('0x46')]);})[_0x1a3c('0x19')](function(_0x5c2e7e){_0xe83664=_0x5c2e7e;logger['info'](_0x1a3c('0x47'),_0xe83664['id']);return getTicket(_0x741ba3,_0x435ae3,_0xe83664,_0x3548f9,_0x52c3b9);})[_0x1a3c('0x19')](function(_0x529a45){if(_0x529a45&&_0x529a45['id']){logger[_0x1a3c('0xa')](_0x1a3c('0x18'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x529a45['id']);logger[_0x1a3c('0xa')](_0x1a3c('0x3f'),_0x1a3c('0x48'));emit(util[_0x1a3c('0xd')](_0x1a3c('0x49'),_0x25d446[_0x1a3c('0x13')]),'trigger:browser:url',{'uri':util[_0x1a3c('0xd')](_0x1a3c('0x4a'),_0x741ba3[_0x1a3c('0x20')],_0x529a45['id'])});}})[_0x1a3c('0x4b')](function(_0xa12d3a){logger[_0x1a3c('0x4c')](_0x1a3c('0x3f'),JSON[_0x1a3c('0x4d')](_0xa12d3a));});};exports[_0x1a3c('0x4e')]=function(_0xa9825b,_0x1be53c,_0x14dab4,_0x4cb90d,_0x3b3f07,_0x2137bc,_0x2a748b){var _0x4d418d,_0x72656c;_0x2137bc[_0x1a3c('0x20')]=intUtil[_0x1a3c('0x3c')](_0x2137bc[_0x1a3c('0x20')]);_0x2137bc[_0x1a3c('0x3d')]=intUtil['stripTrailingSlash'](_0x2137bc[_0x1a3c('0x3d')]);if(_0x2a748b&&_0x2a748b[_0x1a3c('0x4f')]&&_0x2a748b['recordingFormat']!==_0x1a3c('0x50')){logger[_0x1a3c('0xa')](_0x1a3c('0x51'),'Recording\x20is\x20enabled!');_0x1be53c[_0x1a3c('0x41')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2137bc[_0x1a3c('0x3d')],_0x1be53c[_0x1a3c('0x43')],md5(_0x1be53c[_0x1a3c('0x43')]));}headers[_0x1a3c('0x44')]=getAuth(_0x2137bc);return getUser(_0x2137bc,_0x4cb90d['email'])[_0x1a3c('0x19')](function(_0x2318c5){_0x4d418d=_0x2318c5;logger[_0x1a3c('0xa')](_0x1a3c('0x45'),_0x4d418d['id']);return getEndUser(_0x2137bc,_0x1be53c[_0x1a3c('0x52')],_0x1be53c[_0x1a3c('0x53')]);})[_0x1a3c('0x19')](function(_0x54f17e){_0x72656c=_0x54f17e;logger['info'](_0x1a3c('0x47'),_0x72656c['id']);return getTicket(_0x2137bc,_0x4d418d,_0x72656c,_0x14dab4,_0x1be53c);})[_0x1a3c('0x19')](function(_0x35b229){if(_0x35b229&&_0x35b229['id']){logger['info']('Ticket\x20created!');logger[_0x1a3c('0xa')](_0x1a3c('0x54'),_0x35b229['id']);logger[_0x1a3c('0xa')](_0x1a3c('0x51'),_0x1a3c('0x48'));emit(util['format'](_0x1a3c('0x49'),_0x4cb90d[_0x1a3c('0x13')]),_0x1a3c('0x55'),{'uri':util[_0x1a3c('0xd')]('%s/helpdesk/tickets/%d',_0x2137bc[_0x1a3c('0x20')],_0x35b229['id'])});}})['catch'](function(_0x1e2692){logger['error']('[OUTBOUND]',JSON[_0x1a3c('0x4d')](_0x1e2692));});};exports[_0x1a3c('0x56')]=function(_0x46b8b6,_0x58036d,_0x1af80d,_0x1c67f4,_0x233cbf,_0x7ba0bc){var _0x224797,_0x472e41;_0x7ba0bc[_0x1a3c('0x20')]=intUtil[_0x1a3c('0x3c')](_0x7ba0bc[_0x1a3c('0x20')]);_0x7ba0bc[_0x1a3c('0x3d')]=intUtil['stripTrailingSlash'](_0x7ba0bc[_0x1a3c('0x3d')]);if(_0x233cbf&&_0x233cbf['monitor_format']){logger[_0x1a3c('0xa')]('['+_0x58036d['lastevent'][_0x1a3c('0x57')]()+']','Recording\x20is\x20enabled!');_0x58036d[_0x1a3c('0x41')]=util[_0x1a3c('0xd')](_0x1a3c('0x42'),_0x7ba0bc[_0x1a3c('0x3d')],_0x58036d['uniqueid'],md5(_0x58036d[_0x1a3c('0x43')]));}else{_0x58036d[_0x1a3c('0x41')]='';}headers[_0x1a3c('0x44')]=getAuth(_0x7ba0bc);return getUser(_0x7ba0bc,'')[_0x1a3c('0x19')](function(_0x24ca01){_0x224797=_0x24ca01;logger['info'](_0x1a3c('0x45'),_0x224797['id']);return getEndUser(_0x7ba0bc,_0x58036d[_0x1a3c('0xf')],_0x58036d[_0x1a3c('0x46')]);})['then'](function(_0x5af7c6){_0x472e41=_0x5af7c6;logger[_0x1a3c('0xa')](_0x1a3c('0x47'),_0x472e41['id']);return getTicket(_0x7ba0bc,_0x224797,_0x472e41,_0x1af80d,_0x58036d);})[_0x1a3c('0x19')](function(_0x467e59){if(_0x467e59){logger['info'](_0x1a3c('0x18'));logger[_0x1a3c('0xa')](_0x1a3c('0x54'),_0x467e59['id']);}})['catch'](function(_0x4e1a5b){logger[_0x1a3c('0x4c')]('['+_0x58036d[_0x1a3c('0x58')]['toUpperCase']()+']',JSON[_0x1a3c('0x4d')](_0x4e1a5b));});}; \ 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 1ec943f..328a204 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 _0x975f=['Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','/api/lookup?q=','&f=','&entities=contact','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x975f,0x191));var _0xf975=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x975f[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0xf975('0x0'));var rp=require('request-promise');var md5=require(_0xf975('0x1'));var util=require(_0xf975('0x2'));var moment=require(_0xf975('0x3'));var Promise=require(_0xf975('0x4'));var Redis=require(_0xf975('0x5'));var intUtil=require(_0xf975('0x6'));var config=require('../../../../config/environment');var logger=require(_0xf975('0x7'))(_0xf975('0x8'));config['redis']=_[_0xf975('0x9')](config[_0xf975('0xa')],{'host':_0xf975('0xb'),'port':0x18eb});var io=require(_0xf975('0xc'))(new Redis(config[_0xf975('0xa')]));function getAdminId(_0x197cad,_0x5d5860,_0x19fea0,_0x515abd){return new Promise(function(_0x137d54,_0x4b1029){var _0x32e936=![];var _0x30e02d={'method':'GET','uri':_0x515abd+_0xf975('0xd'),'json':!![]};_0x30e02d[_0xf975('0xe')]=_0x19fea0;logger[_0xf975('0xf')]('Getting\x20admin\x20information');return rp(_0x30e02d)['then'](function(_0x1c93d0){if(_0x1c93d0){var _0x1659ef=_0x1c93d0['users'];var _0x48177f=null;for(_0x48177f=0x0;_0x48177f<_0x1659ef[_0xf975('0x10')];_0x48177f++){if(_0x1659ef[_0x48177f][_0xf975('0x11')]===_0x197cad[_0xf975('0x12')]){_0x197cad[_0xf975('0x13')]=_0x1659ef[_0x48177f]['id'];_0x32e936=!![];}}if(_0x32e936){logger[_0xf975('0xf')](_0xf975('0x14'),_0x197cad[_0xf975('0x13')]);_0x137d54(_0x197cad);}else{_0x4b1029({'statusCode':0x194,'message':_0xf975('0x15')});}}else{_0x4b1029({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf975('0x16')](function(_0x2e54c5){logger[_0xf975('0x17')]('['+[_0x5d5860[_0xf975('0x18')]()]+']',_0x2e54c5[_0xf975('0x19')]);_0x4b1029(_0x2e54c5);});});}function getUser(_0x2ac0bd,_0x3e3f9e,_0x1513a8){return function(_0x298207){return new Promise(function(_0x3475bc,_0x3ef820){var _0xf52469={'method':_0xf975('0x1a'),'uri':_0x1513a8+'/api/selector/owners','json':!![]};_0xf52469[_0xf975('0xe')]=_0x3e3f9e;logger[_0xf975('0xf')](_0xf975('0x1b'));return rp(_0xf52469)['then'](function(_0xa4ae6f){if(_0xa4ae6f){var _0x5447a3=_0xa4ae6f['users'];var _0x242742=![];var _0x39a0fc=null;if(_0x298207[_0xf975('0x1c')]!==null){logger[_0xf975('0xf')](_0xf975('0x1d'),_0x298207[_0xf975('0x1c')]);_0x298207[_0xf975('0x1e')]=_0x298207[_0xf975('0x1c')];for(_0x39a0fc=0x0;_0x39a0fc<_0x5447a3[_0xf975('0x10')];_0x39a0fc++){if(_0x5447a3[_0x39a0fc][_0xf975('0x11')]===_0x298207[_0xf975('0x1c')]){_0x242742=!![];_0x298207[_0xf975('0x1f')]=_0x5447a3[_0x39a0fc]['id'];logger[_0xf975('0xf')](_0xf975('0x20'),_0x298207[_0xf975('0x1f')]);}}}if(!_0x242742){logger[_0xf975('0xf')]('Admin\x20selected');_0x298207[_0xf975('0x1e')]=_0x298207[_0xf975('0x12')];_0x298207[_0xf975('0x1f')]=_0x298207[_0xf975('0x13')];_0x242742=!![];}if(_0x242742){_0x3475bc(_0x298207);}else{_0x3ef820({'statusCode':0x194,'message':_0xf975('0x15')});}}else{_0x3ef820({'statusCode':0x194,'message':_0xf975('0x15')});}})[_0xf975('0x16')](function(_0x13bb6d){logger[_0xf975('0x17')]('['+[_0x2ac0bd[_0xf975('0x18')]()]+']',_0x13bb6d['message']);_0x3ef820(_0x13bb6d);});});};}function searchContact(_0x566f58,_0x565e35,_0x365032,_0x433f4a){return new Promise(function(_0x33d2e2,_0x3ddd47){var _0x5e5e1={'method':_0xf975('0x1a'),'headers':_0x565e35,'uri':_0x566f58+_0xf975('0x21')+_0x433f4a+_0xf975('0x22')+_0x365032+_0xf975('0x23'),'json':!![]};rp(_0x5e5e1)[_0xf975('0x24')](function(_0x3e2867){var _0x2a970b=_[_0xf975('0x25')](_0x3e2867[_0xf975('0x26')][_0xf975('0x26')],[_0x365032,_0x433f4a]);_0x33d2e2(_0x2a970b);})[_0xf975('0x16')](function(_0x36f990){_0x3ddd47(_0x36f990);});});}function getEndUser(_0x8606eb,_0x16fae2,_0x2bfe6e){return function(_0x5a2a8e){return new Promise(function(_0x3fb64b,_0x57731d){logger[_0xf975('0xf')](util[_0xf975('0x27')](_0xf975('0x28'),_0x5a2a8e[_0xf975('0x29')]));searchContact(_0x2bfe6e,_0x16fae2,_0xf975('0x2a'),_0x5a2a8e['contactNumber'])[_0xf975('0x24')](function(_0x3a7299){if(_0x3a7299){_0x5a2a8e['endUserId']=_0x3a7299['id'];logger[_0xf975('0xf')](_0xf975('0x2b'),_0x5a2a8e[_0xf975('0x2c')]);return _0x3fb64b(_0x5a2a8e);}searchContact(_0x2bfe6e,_0x16fae2,'work_number',_0x5a2a8e['contactNumber'])['then'](function(_0x5d7a91){if(_0x5d7a91){_0x5a2a8e[_0xf975('0x2c')]=_0x5d7a91['id'];logger[_0xf975('0xf')](_0xf975('0x2d'),_0x5a2a8e[_0xf975('0x2c')]);return _0x3fb64b(_0x5a2a8e);}createEndUser(_0x5a2a8e,_0x8606eb,_0x16fae2,_0x2bfe6e)[_0xf975('0x24')](function(_0xb823c6){logger[_0xf975('0xf')]('Contact\x20created:',_0xb823c6['endUserId']);return _0x3fb64b(_0xb823c6);});});})[_0xf975('0x16')](function(_0x2a3a93){_0x57731d(_0x2a3a93);});});};}function createEndUser(_0x184f79,_0x1ccc1b,_0x5bb149,_0x32b9f2){return new Promise(function(_0x4c8d85,_0x43ff37){var _0x58237b=moment();var _0x5ca61a={'method':'POST','uri':_0x32b9f2+'/api/contacts','body':{'contact':{'last_name':_0x184f79[_0xf975('0x29')],'work_number':_0x184f79['contactNumber'],'mobile_number':_0x184f79[_0xf975('0x29')],'owner_id':_0x184f79[_0xf975('0x1f')],'created_at':_0x58237b[_0xf975('0x27')](_0xf975('0x2e'))}},'json':!![]};_0x5ca61a['headers']=_0x5bb149;logger[_0xf975('0xf')](_0xf975('0x2f'));return rp(_0x5ca61a)[_0xf975('0x24')](function(_0x1dcc43){_0x184f79[_0xf975('0x2c')]=_0x1dcc43[_0xf975('0x30')]['id'];_0x4c8d85(_0x184f79);})[_0xf975('0x16')](function(_0x23d9f9){logger[_0xf975('0x17')]('['+[_0x1ccc1b[_0xf975('0x18')]()]+']',_0x23d9f9[_0xf975('0x19')]);_0x43ff37(_0x23d9f9[_0xf975('0x19')]);});});}function getTicket(_0x55624d,_0x5532f6,_0x5cb2c8,_0x1f12ff,_0x2aa749){return function(_0x4e4e51){logger['info'](_0xf975('0x31'));return new Promise(function(_0x7c3d7c,_0x4751ae){var _0x3c9d83=moment();var _0x21dd59={'method':_0xf975('0x32'),'uri':_0x5cb2c8+_0xf975('0x33'),'body':{'title':intUtil[_0xf975('0x34')](_0x1f12ff[_0xf975('0x35')],_0x2aa749,'\x20'),'description':intUtil[_0xf975('0x34')](_0x1f12ff[_0xf975('0x36')],_0x2aa749,'\x0a'),'owner_id':_0x4e4e51[_0xf975('0x1f')],'creater_id':_0x4e4e51[_0xf975('0x13')],'targetable_id':_0x4e4e51[_0xf975('0x2c')],'targetable_type':'Contact','created_at':_0x3c9d83[_0xf975('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x3c9d83[_0xf975('0x37')](0x1e,'m')['format'](_0xf975('0x2e'))},'json':!![]};_0x21dd59[_0xf975('0xe')]=_0x5532f6;return rp(_0x21dd59)[_0xf975('0x24')](function(_0x4e1547){_0x4e4e51[_0xf975('0x38')]=_0x4e1547[_0xf975('0x39')]['id'];logger[_0xf975('0xf')](_0xf975('0x3a'),_0x4e4e51['ticketId']);_0x7c3d7c(_0x4e4e51);})['catch'](function(_0x5df84f){logger[_0xf975('0x17')]('['+[_0x55624d[_0xf975('0x18')]()]+']',_0x5df84f[_0xf975('0x19')]);_0x4751ae(_0x5df84f['message']);});});};}function emit(_0x5821c0,_0x4f3404,_0x56fae2){var _0x14573d={'uri':_0x5821c0+_0xf975('0x3b')+_0x56fae2};io['to'](util[_0xf975('0x27')](_0xf975('0x3c'),_0x4f3404))[_0xf975('0x3d')]('trigger:browser:url',_0x14573d);}exports['cs']=function(_0x4b5ccf,_0x5a3312,_0x4281b8,_0x13c9cf,_0x293171,_0x1d2e7a,_0x27d38e,_0x44bacf){var _0x45d337={};var _0x56665f={'Authorization':'Token\x20token='+_0x1d2e7a[_0xf975('0x3e')]};_0x1d2e7a[_0xf975('0x3f')]=intUtil['stripTrailingSlash'](_0x1d2e7a[_0xf975('0x3f')]);_0x1d2e7a['serverUrl']=intUtil[_0xf975('0x40')](_0x1d2e7a[_0xf975('0x41')]);var _0xafaa67=_0x1d2e7a[_0xf975('0x3f')];_0x45d337[_0xf975('0x12')]=_0x1d2e7a[_0xf975('0x42')];_0x45d337['contactNumber']=_0x44bacf[_0xf975('0x43')]()==='outbound'?_0x5a3312[_0xf975('0x44')]:_0x5a3312[_0xf975('0x45')];_0x45d337[_0xf975('0x46')]=_0x44bacf===_0xf975('0x47')||_0x44bacf===_0xf975('0x48')?_0xf975('0x47'):_0xf975('0x49');if(_0x13c9cf){_0x45d337['agentEmail']=_0x13c9cf['email'];}var _0x8fcf79=util[_0xf975('0x27')](_0xf975('0x4a'),_0x1d2e7a['serverUrl'],_0x5a3312[_0xf975('0x4b')],md5(_0x5a3312[_0xf975('0x4b')]));if(_0x293171&&_0x293171[_0xf975('0x4c')]){logger[_0xf975('0xf')](_0xf975('0x4d'),_0xf975('0x4e'));_0x5a3312['recordingURL']=_0x8fcf79;}else if(_0x27d38e&&_0x27d38e[_0xf975('0x4f')]&&_0x27d38e['recordingFormat']!==_0xf975('0x50')){logger['info'](_0xf975('0x51'),_0xf975('0x4e'));_0x5a3312[_0xf975('0x52')]=_0x8fcf79;}else{_0x5a3312[_0xf975('0x52')]='';}return getAdminId(_0x45d337,_0x44bacf,_0x56665f,_0xafaa67)[_0xf975('0x24')](getUser(_0x44bacf,_0x56665f,_0xafaa67))[_0xf975('0x24')](getEndUser(_0x44bacf,_0x56665f,_0xafaa67))[_0xf975('0x24')](getTicket(_0x44bacf,_0x56665f,_0xafaa67,_0x4281b8,_0x5a3312))[_0xf975('0x24')](function(_0xfaca88){logger[_0xf975('0xf')](util[_0xf975('0x27')](_0xf975('0x53'),_0xfaca88['ticketId']));if(_0x44bacf!==_0xf975('0x48')){logger[_0xf975('0xf')]('['+[_0x44bacf['toUpperCase']()]+']',_0xf975('0x54'));emit(_0xafaa67,_0x13c9cf[_0xf975('0x55')],_0xfaca88[_0xf975('0x2c')]);}})[_0xf975('0x16')](function(_0x34cb50){logger[_0xf975('0x17')]('['+[_0x44bacf[_0xf975('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x34cb50,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x49e5=['ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','socket.io-emitter','redis','GET','/api/selector/owners','info','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','Admin\x20selected','userEmail','adminEmail','userId','/api/lookup?q=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','work_number','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','add'];(function(_0x250b35,_0x1fe099){var _0x242ee8=function(_0x130517){while(--_0x130517){_0x250b35['push'](_0x250b35['shift']());}};_0x242ee8(++_0x1fe099);}(_0x49e5,0x71));var _0x549e=function(_0x6a21f4,_0x220ad8){_0x6a21f4=_0x6a21f4-0x0;var _0x4c15ac=_0x49e5[_0x6a21f4];return _0x4c15ac;};'use strict';var _=require(_0x549e('0x0'));var rp=require(_0x549e('0x1'));var md5=require(_0x549e('0x2'));var util=require(_0x549e('0x3'));var moment=require(_0x549e('0x4'));var Promise=require('bluebird');var Redis=require(_0x549e('0x5'));var intUtil=require(_0x549e('0x6'));var config=require(_0x549e('0x7'));var logger=require(_0x549e('0x8'))(_0x549e('0x9'));config['redis']=_[_0x549e('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x549e('0xb'))(new Redis(config[_0x549e('0xc')]));function getAdminId(_0x158392,_0x5e3c38,_0x555864,_0x49ba7a){return new Promise(function(_0x230ae5,_0x28a6a2){var _0x254556=![];var _0x468c6c={'method':_0x549e('0xd'),'uri':_0x49ba7a+_0x549e('0xe'),'json':!![]};_0x468c6c['headers']=_0x555864;logger[_0x549e('0xf')]('Getting\x20admin\x20information');return rp(_0x468c6c)[_0x549e('0x10')](function(_0x3740a2){if(_0x3740a2){var _0x3b9c34=_0x3740a2['users'];var _0x3168da=null;for(_0x3168da=0x0;_0x3168da<_0x3b9c34[_0x549e('0x11')];_0x3168da++){if(_0x3b9c34[_0x3168da][_0x549e('0x12')]===_0x158392['adminEmail']){_0x158392[_0x549e('0x13')]=_0x3b9c34[_0x3168da]['id'];_0x254556=!![];}}if(_0x254556){logger[_0x549e('0xf')](_0x549e('0x14'),_0x158392[_0x549e('0x13')]);_0x230ae5(_0x158392);}else{_0x28a6a2({'statusCode':0x194,'message':_0x549e('0x15')});}}else{_0x28a6a2({'statusCode':0x194,'message':_0x549e('0x15')});}})[_0x549e('0x16')](function(_0x39d022){logger[_0x549e('0x17')]('['+[_0x5e3c38[_0x549e('0x18')]()]+']',_0x39d022[_0x549e('0x19')]);_0x28a6a2(_0x39d022);});});}function getUser(_0x207fe0,_0x402c51,_0x1c5877){return function(_0x347f67){return new Promise(function(_0x48c662,_0x294cb3){var _0x233a69={'method':'GET','uri':_0x1c5877+_0x549e('0xe'),'json':!![]};_0x233a69[_0x549e('0x1a')]=_0x402c51;logger[_0x549e('0xf')](_0x549e('0x1b'));return rp(_0x233a69)[_0x549e('0x10')](function(_0x10cdbe){if(_0x10cdbe){var _0x311de3=_0x10cdbe[_0x549e('0x1c')];var _0x16e9d1=![];var _0x244ac7=null;if(_0x347f67[_0x549e('0x1d')]!==null){logger[_0x549e('0xf')](_0x549e('0x1e'),_0x347f67['agentEmail']);_0x347f67['userEmail']=_0x347f67['agentEmail'];for(_0x244ac7=0x0;_0x244ac7<_0x311de3[_0x549e('0x11')];_0x244ac7++){if(_0x311de3[_0x244ac7][_0x549e('0x12')]===_0x347f67[_0x549e('0x1d')]){_0x16e9d1=!![];_0x347f67['userId']=_0x311de3[_0x244ac7]['id'];logger['info'](_0x549e('0x1f'),_0x347f67['userId']);}}}if(!_0x16e9d1){logger[_0x549e('0xf')](_0x549e('0x20'));_0x347f67[_0x549e('0x21')]=_0x347f67[_0x549e('0x22')];_0x347f67[_0x549e('0x23')]=_0x347f67['adminId'];_0x16e9d1=!![];}if(_0x16e9d1){_0x48c662(_0x347f67);}else{_0x294cb3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x294cb3({'statusCode':0x194,'message':_0x549e('0x15')});}})[_0x549e('0x16')](function(_0x39f2b4){logger[_0x549e('0x17')]('['+[_0x207fe0['toUpperCase']()]+']',_0x39f2b4['message']);_0x294cb3(_0x39f2b4);});});};}function searchContact(_0x45587f,_0x337123,_0x21ae07,_0x29a0f0){return new Promise(function(_0x2c2064,_0x49c9d2){var _0x15cc9f={'method':_0x549e('0xd'),'headers':_0x337123,'uri':_0x45587f+_0x549e('0x24')+_0x29a0f0+'&f='+_0x21ae07+'&entities=contact','json':!![]};rp(_0x15cc9f)[_0x549e('0x10')](function(_0x1921e3){var _0x187f22=_[_0x549e('0x25')](_0x1921e3[_0x549e('0x26')][_0x549e('0x26')],[_0x21ae07,_0x29a0f0]);_0x2c2064(_0x187f22);})[_0x549e('0x16')](function(_0x2d1d41){_0x49c9d2(_0x2d1d41);});});}function getEndUser(_0x45e4c2,_0xbd6151,_0x5208eb){return function(_0xbcb5e1){return new Promise(function(_0x3492d5,_0x18f077){logger[_0x549e('0xf')](util[_0x549e('0x27')](_0x549e('0x28'),_0xbcb5e1['contactNumber']));searchContact(_0x5208eb,_0xbd6151,_0x549e('0x29'),_0xbcb5e1['contactNumber'])['then'](function(_0x2dc7b4){if(_0x2dc7b4){_0xbcb5e1[_0x549e('0x2a')]=_0x2dc7b4['id'];logger[_0x549e('0xf')]('Contact\x20found\x20mobile_number:',_0xbcb5e1[_0x549e('0x2a')]);return _0x3492d5(_0xbcb5e1);}searchContact(_0x5208eb,_0xbd6151,_0x549e('0x2b'),_0xbcb5e1[_0x549e('0x2c')])[_0x549e('0x10')](function(_0x1007a1){if(_0x1007a1){_0xbcb5e1['endUserId']=_0x1007a1['id'];logger[_0x549e('0xf')](_0x549e('0x2d'),_0xbcb5e1[_0x549e('0x2a')]);return _0x3492d5(_0xbcb5e1);}createEndUser(_0xbcb5e1,_0x45e4c2,_0xbd6151,_0x5208eb)[_0x549e('0x10')](function(_0x5a49af){logger[_0x549e('0xf')](_0x549e('0x2e'),_0x5a49af['endUserId']);return _0x3492d5(_0x5a49af);});});})[_0x549e('0x16')](function(_0x31b7e5){_0x18f077(_0x31b7e5);});});};}function createEndUser(_0x2e0a0b,_0x314a79,_0x20cc3d,_0x43da3f){return new Promise(function(_0x1568fd,_0x1da7d3){var _0x4a5653=moment();var _0x3aa382={'method':_0x549e('0x2f'),'uri':_0x43da3f+_0x549e('0x30'),'body':{'contact':{'last_name':_0x2e0a0b['contactNumber'],'work_number':_0x2e0a0b[_0x549e('0x2c')],'mobile_number':_0x2e0a0b[_0x549e('0x2c')],'owner_id':_0x2e0a0b[_0x549e('0x23')],'created_at':_0x4a5653['format'](_0x549e('0x31'))}},'json':!![]};_0x3aa382['headers']=_0x20cc3d;logger[_0x549e('0xf')](_0x549e('0x32'));return rp(_0x3aa382)[_0x549e('0x10')](function(_0x3bc599){_0x2e0a0b[_0x549e('0x2a')]=_0x3bc599[_0x549e('0x33')]['id'];_0x1568fd(_0x2e0a0b);})['catch'](function(_0x3996a4){logger[_0x549e('0x17')]('['+[_0x314a79['toUpperCase']()]+']',_0x3996a4[_0x549e('0x19')]);_0x1da7d3(_0x3996a4['message']);});});}function getTicket(_0x137cc1,_0x5ac7a0,_0x3301f8,_0x5209b3,_0x5e0f94){return function(_0x5864da){logger[_0x549e('0xf')](_0x549e('0x34'));return new Promise(function(_0x5033b8,_0x13fe0e){var _0x3b4ab4=moment();var _0x189b88={'method':'POST','uri':_0x3301f8+'/api/tasks','body':{'title':intUtil[_0x549e('0x35')](_0x5209b3[_0x549e('0x36')],_0x5e0f94,'\x20'),'description':intUtil[_0x549e('0x35')](_0x5209b3[_0x549e('0x37')],_0x5e0f94,'\x0a'),'owner_id':_0x5864da[_0x549e('0x23')],'creater_id':_0x5864da['adminId'],'targetable_id':_0x5864da[_0x549e('0x2a')],'targetable_type':'Contact','created_at':_0x3b4ab4[_0x549e('0x27')](_0x549e('0x31')),'due_date':_0x3b4ab4[_0x549e('0x38')](0x1e,'m')[_0x549e('0x27')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x189b88[_0x549e('0x1a')]=_0x5ac7a0;return rp(_0x189b88)['then'](function(_0xe4c65f){_0x5864da[_0x549e('0x39')]=_0xe4c65f[_0x549e('0x3a')]['id'];logger[_0x549e('0xf')](_0x549e('0x3b'),_0x5864da[_0x549e('0x39')]);_0x5033b8(_0x5864da);})[_0x549e('0x16')](function(_0x43fa0d){logger['error']('['+[_0x137cc1[_0x549e('0x18')]()]+']',_0x43fa0d[_0x549e('0x19')]);_0x13fe0e(_0x43fa0d[_0x549e('0x19')]);});});};}function emit(_0x15c410,_0x219d3c,_0x330dc0){var _0x1c8d47={'uri':_0x15c410+_0x549e('0x3c')+_0x330dc0};io['to'](util[_0x549e('0x27')]('user:%s',_0x219d3c))[_0x549e('0x3d')](_0x549e('0x3e'),_0x1c8d47);}exports['cs']=function(_0x348390,_0xc32cd5,_0x4f2b84,_0x30b6a1,_0x575b20,_0x5e4335,_0x1cbd9,_0x1aaa5d){var _0x376a4f={};var _0x5a539b={'Authorization':_0x549e('0x3f')+_0x5e4335[_0x549e('0x40')]};_0x5e4335['remoteUri']=intUtil[_0x549e('0x41')](_0x5e4335['remoteUri']);_0x5e4335[_0x549e('0x42')]=intUtil[_0x549e('0x41')](_0x5e4335['serverUrl']);var _0xc57850=_0x5e4335['remoteUri'];_0x376a4f['adminEmail']=_0x5e4335['username'];_0x376a4f[_0x549e('0x2c')]=_0x1aaa5d[_0x549e('0x43')]()===_0x549e('0x44')?_0xc32cd5[_0x549e('0x45')]:_0xc32cd5[_0x549e('0x46')];_0x376a4f[_0x549e('0x47')]=_0x1aaa5d===_0x549e('0x48')||_0x1aaa5d===_0x549e('0x49')?_0x549e('0x48'):_0x549e('0x44');if(_0x30b6a1){_0x376a4f[_0x549e('0x1d')]=_0x30b6a1[_0x549e('0x12')];}var _0x56bcff=util[_0x549e('0x27')](_0x549e('0x4a'),_0x5e4335[_0x549e('0x42')],_0xc32cd5[_0x549e('0x4b')],md5(_0xc32cd5['uniqueid']));if(_0x575b20&&_0x575b20[_0x549e('0x4c')]){logger['info']('[QUEUE]',_0x549e('0x4d'));_0xc32cd5[_0x549e('0x4e')]=_0x56bcff;}else if(_0x1cbd9&&_0x1cbd9[_0x549e('0x4f')]&&_0x1cbd9[_0x549e('0x4f')]!=='none'){logger[_0x549e('0xf')]('[OUTBOUND]',_0x549e('0x4d'));_0xc32cd5[_0x549e('0x4e')]=_0x56bcff;}else{_0xc32cd5[_0x549e('0x4e')]='';}return getAdminId(_0x376a4f,_0x1aaa5d,_0x5a539b,_0xc57850)[_0x549e('0x10')](getUser(_0x1aaa5d,_0x5a539b,_0xc57850))[_0x549e('0x10')](getEndUser(_0x1aaa5d,_0x5a539b,_0xc57850))[_0x549e('0x10')](getTicket(_0x1aaa5d,_0x5a539b,_0xc57850,_0x4f2b84,_0xc32cd5))[_0x549e('0x10')](function(_0x1f147e){logger[_0x549e('0xf')](util['format'](_0x549e('0x50'),_0x1f147e[_0x549e('0x39')]));if(_0x1aaa5d!==_0x549e('0x49')){logger[_0x549e('0xf')]('['+[_0x1aaa5d[_0x549e('0x18')]()]+']',_0x549e('0x51'));emit(_0xc57850,_0x30b6a1[_0x549e('0x52')],_0x1f147e[_0x549e('0x2a')]);}})[_0x549e('0x16')](function(_0x48b02a){logger[_0x549e('0x17')]('['+[_0x1aaa5d[_0x549e('0x18')]()]+_0x549e('0x53'),util[_0x549e('0x54')](_0x48b02a,{'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 b82f257..3feada2 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 _0xed3c=['%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','salesforce','desk','servicenow','exec','includes','toLowerCase','data1','Configurations','data3','queue','outbound','log','unmanaged','sugarcrm','zoho','vtiger','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format'];(function(_0x2a5676,_0x128b61){var _0x2699da=function(_0x5ba948){while(--_0x5ba948){_0x2a5676['push'](_0x2a5676['shift']());}};_0x2699da(++_0x128b61);}(_0xed3c,0x1a6));var _0xced3=function(_0x3b826d,_0x1d0b68){_0x3b826d=_0x3b826d-0x0;var _0x38e1b3=_0xed3c[_0x3b826d];return _0x38e1b3;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var zendesk=require(_0xced3('0x2'));var salesforce=require(_0xced3('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xced3('0x4'));var zoho=require(_0xced3('0x5'));var desk=require(_0xced3('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xced3('0x7'));var freshsales=require(_0xced3('0x8'));var integrations=[_0xced3('0x9'),_0xced3('0xa'),'sugarcrm','freshdesk','zoho',_0xced3('0xb'),'vtiger','dynamics365','freshsales',_0xced3('0xc')];exports[_0xced3('0xd')]=function(_0x3e5a04,_0x12612f,_0x1cb639,_0x5934b2,_0x36ea7f,_0x32a95d){if(_0x1cb639){if(_[_0xced3('0xe')](integrations,_0x3e5a04['data1'][_0xced3('0xf')]())){try{var _0x19b8c2=null;var _0x42d879='';var _0x3b2ac4=_0x1cb639[_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]()];if(_0x3b2ac4){var _0x1869d5=_0x3b2ac4[_0x3e5a04['data2']];if(_0x1869d5){var _0x65bb58=_['find'](_0x1869d5[_0xced3('0x11')],{'id':parseInt(_0x3e5a04[_0xced3('0x12')],0xa)});if(_0x65bb58){if(_0x5934b2){if(_0x36ea7f&&_0x12612f[_0xced3('0x13')]){_0x42d879=_0xced3('0x13');}else if(_0x12612f['routeId']){_0x42d879=_0xced3('0x14');}else{console[_0xced3('0x15')]('EVENT\x20UNKNOWN',_0x12612f);}}else{_0x42d879=_0xced3('0x16');}switch(_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]()){case _0xced3('0x9'):zendesk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case'salesforce':salesforce[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x17'):sugarcrm[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case'freshdesk':freshdesk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x18'):zoho[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0xb'):desk[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x19'):vtiger[_0x42d879](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d);break;case _0xced3('0x1a'):freshsales['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;case _0xced3('0xc'):servicenow['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;case _0xced3('0x1b'):dynamics365['cs'](_0x3e5a04,_0x12612f,_0x65bb58,_0x5934b2,_0x36ea7f,_0x1869d5,_0x32a95d,_0x42d879);break;default:console[_0xced3('0x15')](_0xced3('0x1c'));}}else{_0x19b8c2=require(_0xced3('0x1d'))(_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')]());_0x19b8c2['error']('[EXEC]',util['format'](_0xced3('0x1e'),_0x3e5a04[_0xced3('0x10')][_0xced3('0xf')](),_0x3e5a04['data3']));}}else{_0x19b8c2=require(_0xced3('0x1d'))(_0x3e5a04[_0xced3('0x10')]['toLowerCase']());_0x19b8c2['error'](_0xced3('0x1f'),util[_0xced3('0x20')](_0xced3('0x21'),_0x3e5a04[_0xced3('0x10')]['toLowerCase'](),_0x3e5a04[_0xced3('0x22')]));}}else{}}catch(_0x23f92b){console['error'](_0x23f92b);}}}}; \ No newline at end of file +var _0xb62e=['./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','exec','includes','data1','toLowerCase','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','lodash','util','./zendesk'];(function(_0x2676e8,_0x303c7a){var _0x320e77=function(_0x1cb158){while(--_0x1cb158){_0x2676e8['push'](_0x2676e8['shift']());}};_0x320e77(++_0x303c7a);}(_0xb62e,0x1de));var _0xeb62=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb62e[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var zendesk=require(_0xeb62('0x2'));var salesforce=require(_0xeb62('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xeb62('0x4'));var zoho=require(_0xeb62('0x5'));var desk=require(_0xeb62('0x6'));var vtiger=require(_0xeb62('0x7'));var servicenow=require(_0xeb62('0x8'));var dynamics365=require(_0xeb62('0x9'));var freshsales=require('./freshsales');var integrations=[_0xeb62('0xa'),_0xeb62('0xb'),_0xeb62('0xc'),'freshdesk',_0xeb62('0xd'),_0xeb62('0xe'),_0xeb62('0xf'),_0xeb62('0x10'),'freshsales','servicenow'];exports[_0xeb62('0x11')]=function(_0x40584b,_0x6d5e94,_0xf93c21,_0x2fe923,_0xc91abc,_0x35afc3){if(_0xf93c21){if(_[_0xeb62('0x12')](integrations,_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]())){try{var _0x4a493c=null;var _0x422daf='';var _0xcc11c4=_0xf93c21[_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()];if(_0xcc11c4){var _0x55a629=_0xcc11c4[_0x40584b[_0xeb62('0x15')]];if(_0x55a629){var _0x2fbad2=_[_0xeb62('0x16')](_0x55a629['Configurations'],{'id':parseInt(_0x40584b[_0xeb62('0x17')],0xa)});if(_0x2fbad2){if(_0x2fe923){if(_0xc91abc&&_0x6d5e94[_0xeb62('0x18')]){_0x422daf=_0xeb62('0x18');}else if(_0x6d5e94['routeId']){_0x422daf=_0xeb62('0x19');}else{console[_0xeb62('0x1a')](_0xeb62('0x1b'),_0x6d5e94);}}else{_0x422daf=_0xeb62('0x1c');}switch(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()){case _0xeb62('0xa'):zendesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xb'):salesforce[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xc'):sugarcrm[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0x1d'):freshdesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xd'):zoho[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xe'):desk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xf'):vtiger[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case'freshsales':freshsales['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x1e'):servicenow['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x10'):dynamics365['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;default:console[_0xeb62('0x1a')](_0xeb62('0x1f'));}}else{_0x4a493c=require(_0xeb62('0x20'))(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]());_0x4a493c['error']('[EXEC]',util[_0xeb62('0x21')](_0xeb62('0x22'),_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')](),_0x40584b[_0xeb62('0x17')]));}}else{_0x4a493c=require('../../../../config/logger')(_0x40584b['data1'][_0xeb62('0x14')]());_0x4a493c[_0xeb62('0x23')](_0xeb62('0x24'),util[_0xeb62('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x40584b['data1'][_0xeb62('0x14')](),_0x40584b['data2']));}}else{}}catch(_0x448327){console['error'](_0x448327);}}}}; \ 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 d9b0dcd..f85db2b 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 _0x2f22=['recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','utc','getString','Subjects','WhoId','Case','Descriptions','ContactId','sobject','create','isNil','validateEmail','find','execute','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','display_name','resolve','user_id','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','forEach','type','string','idField','content','toString','customVariable','Variable','name','toLowerCase','password','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','stringify','outbound'];(function(_0x275621,_0x524302){var _0x2ad056=function(_0x1e962f){while(--_0x1e962f){_0x275621['push'](_0x275621['shift']());}};_0x2ad056(++_0x524302);}(_0x2f22,0x156));var _0x22f2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2f22[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x22f2('0x0'));var rp=require(_0x22f2('0x1'));var moment=require(_0x22f2('0x2'));var BPromise=require('bluebird');var md5=require(_0x22f2('0x3'));var jsforce=require(_0x22f2('0x4'));var util=require('util');var Redis=require(_0x22f2('0x5'));var intUtil=require(_0x22f2('0x6'));var config=require(_0x22f2('0x7'));var logger=require(_0x22f2('0x8'))(_0x22f2('0x9'));config[_0x22f2('0xa')]=_[_0x22f2('0xb')](config['redis'],{'host':_0x22f2('0xc'),'port':0x18eb});var io=require(_0x22f2('0xd'))(new Redis(config[_0x22f2('0xa')]));function emit(_0x19b85c,_0x574d13,_0x1a3e52){io['to'](_0x19b85c)[_0x22f2('0xe')](_0x574d13,_0x1a3e52);}function getTicket(_0x56e4f4,_0x406448,_0x1f67aa,_0x114ef1,_0x1ccb55,_0x302b40,_0x468ce1,_0x2857cf){var _0x26b249={};if(_0x114ef1[_0x22f2('0xf')]===_0x22f2('0x10')){_0x26b249=Object[_0x22f2('0x11')]({},{'OwnerId':_0x406448['id'],'ActivityDate':moment[_0x22f2('0x12')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x22f2('0x13')](_0x114ef1[_0x22f2('0x14')],_0x1ccb55,'\x20'),'Description':intUtil[_0x22f2('0x13')](_0x114ef1['Descriptions'],_0x1ccb55,'\x0a')},getCustomFields(_0x302b40,_0x1ccb55));if(_0x1f67aa){_0x26b249[_0x22f2('0x15')]=_0x1f67aa['id'];}}else if(_0x114ef1[_0x22f2('0xf')]===_0x22f2('0x16')){_0x26b249=Object[_0x22f2('0x11')]({},{'OwnerId':_0x406448['id'],'Subject':intUtil[_0x22f2('0x13')](_0x114ef1['Subjects'],_0x1ccb55,'\x20'),'Description':intUtil['getString'](_0x114ef1[_0x22f2('0x17')],_0x1ccb55,'\x0a')},getCustomFields(_0x302b40,_0x1ccb55));if(_0x1f67aa){_0x26b249[_0x22f2('0x18')]=_0x1f67aa['id'];}}return _0x468ce1[_0x22f2('0x19')](_0x114ef1['ticketType'])[_0x22f2('0x1a')](_0x26b249);}function getUser(_0x488baf,_0x121914,_0x3bd647){if(!_[_0x22f2('0x1b')](_0x121914)&&intUtil[_0x22f2('0x1c')](_0x121914)){var _0x18c874={'Email':_0x121914};var _0x1aa78d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3bd647['sobject']('User')[_0x22f2('0x1d')](_0x18c874,_0x1aa78d)[_0x22f2('0x1e')]()['then'](function(_0x17ebd7){if(_0x17ebd7[_0x22f2('0x1f')]){var _0x35ab89=_[_0x22f2('0x1d')](_0x17ebd7,function(_0x382fa7){return _0x382fa7[_0x22f2('0x20')]===_0x121914;});if(_0x35ab89){logger[_0x22f2('0x21')](_0x22f2('0x22'),_0x121914);return BPromise['resolve']({'id':_0x35ab89['Id'],'name':_0x35ab89[_0x22f2('0x23')]});}}else{logger[_0x22f2('0x21')](_0x22f2('0x24'),_0x121914);return _0x3bd647[_0x22f2('0x25')]()[_0x22f2('0x26')](function(_0x49c4e5){return BPromise['resolve']({'id':_0x49c4e5['user_id'],'name':_0x49c4e5[_0x22f2('0x27')]});});}});}else{logger[_0x22f2('0x21')](_0x22f2('0x24'),_0x121914);return _0x3bd647[_0x22f2('0x25')]()[_0x22f2('0x26')](function(_0x4f540c){return BPromise[_0x22f2('0x28')]({'id':_0x4f540c[_0x22f2('0x29')],'name':_0x4f540c['display_name']});});}}function getEndUser(_0x41eb3d,_0x5a3a33,_0xb43c6c,_0x544bc8,_0x5747fa){var _0x5a448b={'Phone':_0x544bc8};var _0x4673d0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x22f2('0x28')]()[_0x22f2('0x26')](function(){if(_0x5a3a33[_0x22f2('0xf')]===_0x22f2('0x10')){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x544bc8,_0x5a3a33[_0x22f2('0x2a')]);switch(_0x5a3a33[_0x22f2('0x2a')]){case _0x22f2('0x2b'):return _0x5747fa[_0x22f2('0x19')](_0x22f2('0x2c'))[_0x22f2('0x1d')](_0x5a448b,_0x4673d0)[_0x22f2('0x1e')]()['then'](function(_0xd5db46){if(_0xd5db46&&_0xd5db46[_0x22f2('0x1f')]){return _0xd5db46;}else{return _0x5747fa[_0x22f2('0x19')](_0x22f2('0x2d'))[_0x22f2('0x1d')](_0x5a448b,_0x4673d0);}});case _0x22f2('0x2e'):return _0x5747fa[_0x22f2('0x19')]('Contact')[_0x22f2('0x1d')](_0x5a448b,_0x4673d0)[_0x22f2('0x1e')]();case _0x22f2('0x2f'):return _0x5747fa[_0x22f2('0x19')](_0x22f2('0x2d'))[_0x22f2('0x1d')](_0x5a448b,_0x4673d0);default:return null;}}else if(_0x5a3a33[_0x22f2('0xf')]==='Case'){logger[_0x22f2('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x544bc8,'contact');return _0x5747fa[_0x22f2('0x19')](_0x22f2('0x2c'))[_0x22f2('0x1d')](_0x5a448b,_0x4673d0)[_0x22f2('0x1e')]();}})[_0x22f2('0x26')](function(_0x3997da){if(_0x3997da&&_0x3997da[_0x22f2('0x1f')]){var _0x43bdcb=_[_0x22f2('0x1d')](_0x3997da,function(_0x274e02){return _0x274e02[_0x22f2('0x30')]===_0x544bc8;});if(_0x43bdcb){return BPromise[_0x22f2('0x28')]({'id':_0x43bdcb['Id'],'name':_0x43bdcb[_0x22f2('0x23')],'phone':_0x43bdcb['Phone']});}}})[_0x22f2('0x26')](function(_0x336024){if(_0x336024){logger[_0x22f2('0x21')](_0x22f2('0x31'),_0x544bc8);return BPromise[_0x22f2('0x28')](_0x336024);}else{logger[_0x22f2('0x21')](_0x22f2('0x32'),_0x544bc8);var _0x390927={'LastName':_0xb43c6c!==_0x22f2('0x33')?_0xb43c6c:util[_0x22f2('0x34')](_0x22f2('0x35'),_0x544bc8),'Phone':_0x544bc8};if(_0x5a3a33['moduleCreate']){if(_0x5a3a33[_0x22f2('0x36')]==='contact'){logger[_0x22f2('0x21')](_0x22f2('0x37'),_0x544bc8,_0x5a3a33[_0x22f2('0x36')]);}else if(_0x5a3a33[_0x22f2('0x36')]===_0x22f2('0x2f')&&_0x5a3a33[_0x22f2('0xf')]===_0x22f2('0x10')){logger[_0x22f2('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x544bc8,_0x5a3a33['moduleCreate']);_0x390927['Company']='No\x20Company';}else{return null;}}return _0x5747fa[_0x22f2('0x19')](_[_0x22f2('0x38')](_0x5a3a33[_0x22f2('0x36')]))[_0x22f2('0x1a')](_0x390927);}});}function getCustomFields(_0xee71a1,_0x223473){var _0x4e4365={};if(_0xee71a1[_0x22f2('0x1f')]>0x0){_[_0x22f2('0x39')](_0xee71a1,function(_0x52f394){if(_0x52f394[_0x22f2('0x3a')]===_0x22f2('0x3b')&&_0x52f394['idField']){_0x4e4365[_0x52f394[_0x22f2('0x3c')]]=_0x52f394[_0x22f2('0x3d')][_0x22f2('0x3e')]();}else if(_0x52f394[_0x22f2('0x3a')]==='variable'&&_0x52f394['variableName']&&_0x52f394[_0x22f2('0x3c')]){_0x223473[_0x52f394['variableName']]&&(_0x4e4365[_0x52f394[_0x22f2('0x3c')]]=_0x223473[_0x52f394['variableName']]['toString']());}else if(_0x52f394[_0x22f2('0x3a')]===_0x22f2('0x3f')&&_0x52f394[_0x22f2('0x40')]&&_0x52f394[_0x22f2('0x40')]['name']&&_0x52f394['idField']){_0x223473[_0x52f394['Variable'][_0x22f2('0x41')][_0x22f2('0x42')]()]&&(_0x4e4365[_0x52f394[_0x22f2('0x3c')]]=_0x223473[_0x52f394[_0x22f2('0x40')]['name'][_0x22f2('0x42')]()][_0x22f2('0x3e')]());}});}return _0x4e4365;}function getConnection(_0x3d4480){var _0x345781=_0x3d4480[_0x22f2('0x43')]['concat'](_0x3d4480['securityToken']);var _0x4ece5d=new jsforce[(_0x22f2('0x44'))]({'oauth2':{'loginUrl':_0x3d4480[_0x22f2('0x45')]||_0x22f2('0x46'),'clientId':_0x3d4480[_0x22f2('0x47')],'clientSecret':_0x3d4480[_0x22f2('0x48')]}});return _0x4ece5d['login'](_0x3d4480[_0x22f2('0x49')],_0x345781)[_0x22f2('0x26')](function(){logger[_0x22f2('0x21')](_0x22f2('0x4a'));return _0x4ece5d;});}exports[_0x22f2('0x4b')]=function(_0x4ce96b,_0x2ea50c,_0x12079a,_0x1be9a9,_0x3e53bf,_0x3a2d7f){var _0x566bbf,_0x5a1311,_0x1e0d2b,_0x4625e9;_0x3a2d7f['serverUrl']=intUtil[_0x22f2('0x4c')](_0x3a2d7f[_0x22f2('0x4d')]);_0x3a2d7f[_0x22f2('0x45')]=intUtil['stripTrailingSlash'](_0x3a2d7f[_0x22f2('0x45')]);if(_0x3e53bf&&_0x3e53bf[_0x22f2('0x4e')]){logger[_0x22f2('0x21')](_0x22f2('0x4f'),_0x22f2('0x50'));_0x2ea50c[_0x22f2('0x51')]=util[_0x22f2('0x34')](_0x22f2('0x52'),_0x3a2d7f[_0x22f2('0x4d')],_0x2ea50c[_0x22f2('0x53')],md5(_0x2ea50c[_0x22f2('0x53')]));}else{_0x2ea50c[_0x22f2('0x51')]='';}return getConnection(_0x3a2d7f)['then'](function(_0x122b03){_0x4625e9=_0x122b03;return getUser(_0x3a2d7f,_0x1be9a9['email'],_0x4625e9);})[_0x22f2('0x26')](function(_0x3e9aa0){_0x566bbf=_0x3e9aa0;return getEndUser(_0x3a2d7f,_0x12079a,_0x2ea50c[_0x22f2('0x54')],_0x2ea50c['calleridnum'],_0x4625e9);})[_0x22f2('0x26')](function(_0x282f95){_0x5a1311=_0x282f95;return getTicket(_0x3a2d7f,_0x566bbf,_0x5a1311,_0x12079a,_0x2ea50c,_0x12079a[_0x22f2('0x55')],_0x4625e9,_0x22f2('0x4b'));})[_0x22f2('0x26')](function(_0x294c7f){_0x1e0d2b=_0x294c7f;logger[_0x22f2('0x21')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1e0d2b['id']);logger[_0x22f2('0x21')](_0x22f2('0x56'),_0x1e0d2b['id'],_0x1be9a9['name'],_0x3a2d7f[_0x22f2('0x3a')]);switch(_0x3a2d7f['type']){case _0x22f2('0x57'):emit(util[_0x22f2('0x34')](_0x22f2('0x58'),_0x1be9a9[_0x22f2('0x41')]),_0x22f2('0x59'),{'recordId':_0x1e0d2b['id']});break;case _0x22f2('0x5a'):emit(util[_0x22f2('0x34')]('user:%s',_0x1be9a9[_0x22f2('0x41')]),_0x22f2('0x5b'),{'uri':util[_0x22f2('0x34')](_0x22f2('0x5c'),_0x4625e9[_0x22f2('0x5d')],_0x1e0d2b['id'])});break;default:logger[_0x22f2('0x5e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x22f2('0x5f')](function(_0x504438){logger[_0x22f2('0x5e')](_0x22f2('0x4f'),JSON[_0x22f2('0x60')](_0x504438));});};exports[_0x22f2('0x61')]=function(_0x433030,_0x5bab10,_0x1efd67,_0x41a8e4,_0x4a2a2c,_0x3b87e5,_0x18a20a){var _0x25e0b9,_0x451fb0,_0x3e6ca3,_0x158192;_0x3b87e5[_0x22f2('0x4d')]=intUtil[_0x22f2('0x4c')](_0x3b87e5[_0x22f2('0x4d')]);_0x3b87e5['remoteUri']=intUtil[_0x22f2('0x4c')](_0x3b87e5['remoteUri']);if(_0x18a20a&&_0x18a20a[_0x22f2('0x62')]&&_0x18a20a[_0x22f2('0x62')]!==_0x22f2('0x63')){logger[_0x22f2('0x21')](_0x22f2('0x64'),'Recording\x20is\x20enabled!');_0x5bab10[_0x22f2('0x51')]=util[_0x22f2('0x34')](_0x22f2('0x52'),_0x3b87e5[_0x22f2('0x4d')],_0x5bab10[_0x22f2('0x53')],md5(_0x5bab10[_0x22f2('0x53')]));}return getConnection(_0x3b87e5)[_0x22f2('0x26')](function(_0x24573a){_0x158192=_0x24573a;return getUser(_0x3b87e5,_0x41a8e4['email'],_0x158192);})[_0x22f2('0x26')](function(_0x930e36){_0x25e0b9=_0x930e36;return getEndUser(_0x3b87e5,_0x1efd67,_0x5bab10[_0x22f2('0x65')],_0x5bab10['destcalleridnum'],_0x158192);})[_0x22f2('0x26')](function(_0x5ca762){_0x451fb0=_0x5ca762;return getTicket(_0x3b87e5,_0x25e0b9,_0x451fb0,_0x1efd67,_0x5bab10,_0x1efd67['Fields'],_0x158192,_0x22f2('0x61'));})[_0x22f2('0x26')](function(_0x91247f){_0x3e6ca3=_0x91247f;logger[_0x22f2('0x21')](_0x22f2('0x66'),_0x3e6ca3['id']);logger[_0x22f2('0x21')](_0x22f2('0x67'),_0x3e6ca3['id'],_0x41a8e4[_0x22f2('0x41')],_0x3b87e5['type']);switch(_0x3b87e5[_0x22f2('0x3a')]){case'integrationTab':emit(util[_0x22f2('0x34')](_0x22f2('0x58'),_0x41a8e4[_0x22f2('0x41')]),_0x22f2('0x59'),{'recordId':_0x3e6ca3['id']});break;case _0x22f2('0x5a'):emit(util[_0x22f2('0x34')]('user:%s',_0x41a8e4[_0x22f2('0x41')]),_0x22f2('0x5b'),{'uri':util[_0x22f2('0x34')]('%s/%s/e',_0x158192[_0x22f2('0x5d')],_0x3e6ca3['id'])});break;default:logger[_0x22f2('0x5e')](_0x22f2('0x64'),_0x22f2('0x68'));}})[_0x22f2('0x5f')](function(_0x104c94){logger[_0x22f2('0x5e')](_0x22f2('0x64'),JSON[_0x22f2('0x60')](_0x104c94));});};exports[_0x22f2('0x69')]=function(_0x24b692,_0x5985b7,_0x1d2e2c,_0x4e9647,_0x34d282,_0x4fdad2){var _0x5dae76,_0x37ce8e,_0x316854,_0x16a75;_0x4fdad2['serverUrl']=intUtil[_0x22f2('0x4c')](_0x4fdad2['serverUrl']);_0x4fdad2[_0x22f2('0x45')]=intUtil[_0x22f2('0x4c')](_0x4fdad2[_0x22f2('0x45')]);if(_0x34d282&&_0x34d282[_0x22f2('0x4e')]){logger[_0x22f2('0x21')]('['+_0x5985b7[_0x22f2('0x6a')][_0x22f2('0x6b')]()+']',_0x22f2('0x50'));_0x5985b7[_0x22f2('0x51')]=util['format'](_0x22f2('0x52'),_0x4fdad2[_0x22f2('0x4d')],_0x5985b7[_0x22f2('0x53')],md5(_0x5985b7[_0x22f2('0x53')]));}else{_0x5985b7[_0x22f2('0x51')]='';}return getConnection(_0x4fdad2)[_0x22f2('0x26')](function(_0x5eb824){_0x16a75=_0x5eb824;if(!_['isNil'](_0x4e9647)){return getUser(_0x4fdad2,_0x4e9647[_0x22f2('0x41')],_0x16a75);}else{return getUser(_0x4fdad2,null,_0x16a75);}})[_0x22f2('0x26')](function(_0x1d45b4){_0x5dae76=_0x1d45b4;return getEndUser(_0x4fdad2,_0x1d2e2c,_0x5985b7[_0x22f2('0x54')],_0x5985b7[_0x22f2('0x6c')],_0x16a75);})[_0x22f2('0x26')](function(_0x345488){_0x37ce8e=_0x345488;return getTicket(_0x4fdad2,_0x5dae76,_0x37ce8e,_0x1d2e2c,_0x5985b7,_0x1d2e2c[_0x22f2('0x55')],_0x16a75);})[_0x22f2('0x26')](function(_0x400ac6){_0x316854=_0x400ac6;logger[_0x22f2('0x21')]('['+_0x5985b7[_0x22f2('0x6a')][_0x22f2('0x6b')]()+_0x22f2('0x6d'),_0x316854['id']);logger[_0x22f2('0x21')]('['+_0x5985b7['lastevent'][_0x22f2('0x6b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x4fdad2[_0x22f2('0x3a')]);})['catch'](function(_0x4f9d08){logger[_0x22f2('0x5e')]('['+_0x5985b7['lastevent']['toUpperCase']()+']',JSON[_0x22f2('0x60')](_0x4f9d08));});}; \ No newline at end of file +var _0x7c5f=['request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','salesforce','defaults','redis','localhost','socket.io-emitter','Task','assign','utc','getString','WhoId','ticketType','Case','Subjects','ContactId','sobject','create','isNil','validateEmail','find','execute','length','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Company','No\x20Company','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','email','calleridname','Fields','queue','user:%s','newTab','trigger:browser:url','%s/%s/e','error','stringify','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','instanceUrl','catch','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7c5f,0x6a));var _0xf7c5=function(_0x372b49,_0x108788){_0x372b49=_0x372b49-0x0;var _0x4f1d48=_0x7c5f[_0x372b49];return _0x4f1d48;};'use strict';var _=require('lodash');var rp=require(_0xf7c5('0x0'));var moment=require(_0xf7c5('0x1'));var BPromise=require(_0xf7c5('0x2'));var md5=require(_0xf7c5('0x3'));var jsforce=require('jsforce');var util=require(_0xf7c5('0x4'));var Redis=require(_0xf7c5('0x5'));var intUtil=require(_0xf7c5('0x6'));var config=require(_0xf7c5('0x7'));var logger=require('../../../../config/logger')(_0xf7c5('0x8'));config['redis']=_[_0xf7c5('0x9')](config[_0xf7c5('0xa')],{'host':_0xf7c5('0xb'),'port':0x18eb});var io=require(_0xf7c5('0xc'))(new Redis(config[_0xf7c5('0xa')]));function emit(_0x390be0,_0xf9625f,_0x14e746){io['to'](_0x390be0)['emit'](_0xf9625f,_0x14e746);}function getTicket(_0x55cce2,_0x3f7ba9,_0x1d1f4d,_0x2aa29a,_0xba9263,_0x364104,_0x1770cb,_0x3c879b){var _0x4235d0={};if(_0x2aa29a['ticketType']===_0xf7c5('0xd')){_0x4235d0=Object[_0xf7c5('0xe')]({},{'OwnerId':_0x3f7ba9['id'],'ActivityDate':moment[_0xf7c5('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xf7c5('0x10')](_0x2aa29a['Subjects'],_0xba9263,'\x20'),'Description':intUtil['getString'](_0x2aa29a['Descriptions'],_0xba9263,'\x0a')},getCustomFields(_0x364104,_0xba9263));if(_0x1d1f4d){_0x4235d0[_0xf7c5('0x11')]=_0x1d1f4d['id'];}}else if(_0x2aa29a[_0xf7c5('0x12')]===_0xf7c5('0x13')){_0x4235d0=Object['assign']({},{'OwnerId':_0x3f7ba9['id'],'Subject':intUtil[_0xf7c5('0x10')](_0x2aa29a[_0xf7c5('0x14')],_0xba9263,'\x20'),'Description':intUtil[_0xf7c5('0x10')](_0x2aa29a['Descriptions'],_0xba9263,'\x0a')},getCustomFields(_0x364104,_0xba9263));if(_0x1d1f4d){_0x4235d0[_0xf7c5('0x15')]=_0x1d1f4d['id'];}}return _0x1770cb[_0xf7c5('0x16')](_0x2aa29a[_0xf7c5('0x12')])[_0xf7c5('0x17')](_0x4235d0);}function getUser(_0x56c40d,_0x197a28,_0x38f3c3){if(!_[_0xf7c5('0x18')](_0x197a28)&&intUtil[_0xf7c5('0x19')](_0x197a28)){var _0x4a9d9a={'Email':_0x197a28};var _0x3ece8d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x38f3c3[_0xf7c5('0x16')]('User')[_0xf7c5('0x1a')](_0x4a9d9a,_0x3ece8d)[_0xf7c5('0x1b')]()['then'](function(_0x26e87a){if(_0x26e87a[_0xf7c5('0x1c')]){var _0x4b0b4a=_[_0xf7c5('0x1a')](_0x26e87a,function(_0x259d60){return _0x259d60[_0xf7c5('0x1d')]===_0x197a28;});if(_0x4b0b4a){logger[_0xf7c5('0x1e')](_0xf7c5('0x1f'),_0x197a28);return BPromise[_0xf7c5('0x20')]({'id':_0x4b0b4a['Id'],'name':_0x4b0b4a[_0xf7c5('0x21')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x197a28);return _0x38f3c3[_0xf7c5('0x22')]()[_0xf7c5('0x23')](function(_0x2df090){return BPromise['resolve']({'id':_0x2df090[_0xf7c5('0x24')],'name':_0x2df090['display_name']});});}});}else{logger[_0xf7c5('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x197a28);return _0x38f3c3[_0xf7c5('0x22')]()[_0xf7c5('0x23')](function(_0x37692a){return BPromise[_0xf7c5('0x20')]({'id':_0x37692a[_0xf7c5('0x24')],'name':_0x37692a[_0xf7c5('0x25')]});});}}function getEndUser(_0xae3fd7,_0x12bf00,_0x1e0540,_0x8622c4,_0x174f9c){var _0x40209c={'Phone':_0x8622c4};var _0x37f5b1={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf7c5('0x20')]()[_0xf7c5('0x23')](function(){if(_0x12bf00['ticketType']===_0xf7c5('0xd')){logger[_0xf7c5('0x1e')](_0xf7c5('0x26'),_0x8622c4,_0x12bf00[_0xf7c5('0x27')]);switch(_0x12bf00['moduleSearch']){case _0xf7c5('0x28'):return _0x174f9c[_0xf7c5('0x16')](_0xf7c5('0x29'))[_0xf7c5('0x1a')](_0x40209c,_0x37f5b1)[_0xf7c5('0x1b')]()['then'](function(_0x2e2eab){if(_0x2e2eab&&_0x2e2eab[_0xf7c5('0x1c')]){return _0x2e2eab;}else{return _0x174f9c[_0xf7c5('0x16')](_0xf7c5('0x2a'))['find'](_0x40209c,_0x37f5b1);}});case'contact':return _0x174f9c['sobject'](_0xf7c5('0x29'))[_0xf7c5('0x1a')](_0x40209c,_0x37f5b1)['execute']();case _0xf7c5('0x2b'):return _0x174f9c['sobject'](_0xf7c5('0x2a'))[_0xf7c5('0x1a')](_0x40209c,_0x37f5b1);default:return null;}}else if(_0x12bf00[_0xf7c5('0x12')]===_0xf7c5('0x13')){logger[_0xf7c5('0x1e')](_0xf7c5('0x26'),_0x8622c4,_0xf7c5('0x2c'));return _0x174f9c[_0xf7c5('0x16')](_0xf7c5('0x29'))[_0xf7c5('0x1a')](_0x40209c,_0x37f5b1)[_0xf7c5('0x1b')]();}})[_0xf7c5('0x23')](function(_0x36a294){if(_0x36a294&&_0x36a294[_0xf7c5('0x1c')]){var _0x3a1bb2=_[_0xf7c5('0x1a')](_0x36a294,function(_0x10026d){return _0x10026d[_0xf7c5('0x2d')]===_0x8622c4;});if(_0x3a1bb2){return BPromise[_0xf7c5('0x20')]({'id':_0x3a1bb2['Id'],'name':_0x3a1bb2['Name'],'phone':_0x3a1bb2[_0xf7c5('0x2d')]});}}})[_0xf7c5('0x23')](function(_0x4c9cc3){if(_0x4c9cc3){logger['info'](_0xf7c5('0x2e'),_0x8622c4);return BPromise[_0xf7c5('0x20')](_0x4c9cc3);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x8622c4);var _0x4cfc0b={'LastName':_0x1e0540!==_0xf7c5('0x2f')?_0x1e0540:util[_0xf7c5('0x30')](_0xf7c5('0x31'),_0x8622c4),'Phone':_0x8622c4};if(_0x12bf00[_0xf7c5('0x32')]){if(_0x12bf00[_0xf7c5('0x32')]===_0xf7c5('0x2c')){logger[_0xf7c5('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x8622c4,_0x12bf00['moduleCreate']);}else if(_0x12bf00[_0xf7c5('0x32')]===_0xf7c5('0x2b')&&_0x12bf00['ticketType']==='Task'){logger[_0xf7c5('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x8622c4,_0x12bf00[_0xf7c5('0x32')]);_0x4cfc0b[_0xf7c5('0x33')]=_0xf7c5('0x34');}else{return null;}}return _0x174f9c[_0xf7c5('0x16')](_['upperFirst'](_0x12bf00['moduleCreate']))['create'](_0x4cfc0b);}});}function getCustomFields(_0x4104bf,_0x18d0f3){var _0x544917={};if(_0x4104bf[_0xf7c5('0x1c')]>0x0){_[_0xf7c5('0x35')](_0x4104bf,function(_0x5b96be){if(_0x5b96be[_0xf7c5('0x36')]===_0xf7c5('0x37')&&_0x5b96be[_0xf7c5('0x38')]){_0x544917[_0x5b96be[_0xf7c5('0x38')]]=_0x5b96be[_0xf7c5('0x39')][_0xf7c5('0x3a')]();}else if(_0x5b96be[_0xf7c5('0x36')]===_0xf7c5('0x3b')&&_0x5b96be[_0xf7c5('0x3c')]&&_0x5b96be[_0xf7c5('0x38')]){_0x18d0f3[_0x5b96be[_0xf7c5('0x3c')]]&&(_0x544917[_0x5b96be[_0xf7c5('0x38')]]=_0x18d0f3[_0x5b96be['variableName']][_0xf7c5('0x3a')]());}else if(_0x5b96be[_0xf7c5('0x36')]===_0xf7c5('0x3d')&&_0x5b96be[_0xf7c5('0x3e')]&&_0x5b96be[_0xf7c5('0x3e')][_0xf7c5('0x3f')]&&_0x5b96be[_0xf7c5('0x38')]){_0x18d0f3[_0x5b96be[_0xf7c5('0x3e')]['name']['toLowerCase']()]&&(_0x544917[_0x5b96be[_0xf7c5('0x38')]]=_0x18d0f3[_0x5b96be[_0xf7c5('0x3e')][_0xf7c5('0x3f')][_0xf7c5('0x40')]()][_0xf7c5('0x3a')]());}});}return _0x544917;}function getConnection(_0x4f711d){var _0x1b1357=_0x4f711d[_0xf7c5('0x41')][_0xf7c5('0x42')](_0x4f711d[_0xf7c5('0x43')]);var _0x2ec5f9=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4f711d[_0xf7c5('0x44')]||_0xf7c5('0x45'),'clientId':_0x4f711d[_0xf7c5('0x46')],'clientSecret':_0x4f711d[_0xf7c5('0x47')]}});return _0x2ec5f9['login'](_0x4f711d['username'],_0x1b1357)[_0xf7c5('0x23')](function(){logger[_0xf7c5('0x1e')]('Connection\x20established.');return _0x2ec5f9;});}exports['queue']=function(_0x33c2e8,_0x2082c6,_0x1c54a1,_0x6991b8,_0x4c87db,_0x39716c){var _0x1688c5,_0x5c823f,_0x47194b,_0x256f8f;_0x39716c[_0xf7c5('0x48')]=intUtil[_0xf7c5('0x49')](_0x39716c[_0xf7c5('0x48')]);_0x39716c[_0xf7c5('0x44')]=intUtil[_0xf7c5('0x49')](_0x39716c['remoteUri']);if(_0x4c87db&&_0x4c87db['monitor_format']){logger[_0xf7c5('0x1e')](_0xf7c5('0x4a'),'Recording\x20is\x20enabled!');_0x2082c6[_0xf7c5('0x4b')]=util[_0xf7c5('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39716c['serverUrl'],_0x2082c6['uniqueid'],md5(_0x2082c6['uniqueid']));}else{_0x2082c6[_0xf7c5('0x4b')]='';}return getConnection(_0x39716c)[_0xf7c5('0x23')](function(_0xd1c800){_0x256f8f=_0xd1c800;return getUser(_0x39716c,_0x6991b8[_0xf7c5('0x4c')],_0x256f8f);})[_0xf7c5('0x23')](function(_0x6fd7a9){_0x1688c5=_0x6fd7a9;return getEndUser(_0x39716c,_0x1c54a1,_0x2082c6[_0xf7c5('0x4d')],_0x2082c6['calleridnum'],_0x256f8f);})['then'](function(_0x2d8b8e){_0x5c823f=_0x2d8b8e;return getTicket(_0x39716c,_0x1688c5,_0x5c823f,_0x1c54a1,_0x2082c6,_0x1c54a1[_0xf7c5('0x4e')],_0x256f8f,_0xf7c5('0x4f'));})[_0xf7c5('0x23')](function(_0x3f9f21){_0x47194b=_0x3f9f21;logger[_0xf7c5('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x47194b['id']);logger[_0xf7c5('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x47194b['id'],_0x6991b8[_0xf7c5('0x3f')],_0x39716c[_0xf7c5('0x36')]);switch(_0x39716c[_0xf7c5('0x36')]){case'integrationTab':emit(util[_0xf7c5('0x30')](_0xf7c5('0x50'),_0x6991b8[_0xf7c5('0x3f')]),'trigger:salesforce:display',{'recordId':_0x47194b['id']});break;case _0xf7c5('0x51'):emit(util['format']('user:%s',_0x6991b8['name']),_0xf7c5('0x52'),{'uri':util[_0xf7c5('0x30')](_0xf7c5('0x53'),_0x256f8f['instanceUrl'],_0x47194b['id'])});break;default:logger[_0xf7c5('0x54')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2b1a05){logger[_0xf7c5('0x54')](_0xf7c5('0x4a'),JSON[_0xf7c5('0x55')](_0x2b1a05));});};exports['outbound']=function(_0x3bbcb,_0x5358ff,_0x2bb98b,_0x53fb15,_0x7ad271,_0x302378,_0x29187c){var _0x90dd78,_0x5d5a7f,_0x3cb5c2,_0x22f1a9;_0x302378['serverUrl']=intUtil[_0xf7c5('0x49')](_0x302378['serverUrl']);_0x302378['remoteUri']=intUtil[_0xf7c5('0x49')](_0x302378['remoteUri']);if(_0x29187c&&_0x29187c[_0xf7c5('0x56')]&&_0x29187c[_0xf7c5('0x56')]!==_0xf7c5('0x57')){logger[_0xf7c5('0x1e')](_0xf7c5('0x58'),_0xf7c5('0x59'));_0x5358ff['recordingURL']=util['format'](_0xf7c5('0x5a'),_0x302378['serverUrl'],_0x5358ff[_0xf7c5('0x5b')],md5(_0x5358ff[_0xf7c5('0x5b')]));}return getConnection(_0x302378)[_0xf7c5('0x23')](function(_0x5e149b){_0x22f1a9=_0x5e149b;return getUser(_0x302378,_0x53fb15[_0xf7c5('0x4c')],_0x22f1a9);})[_0xf7c5('0x23')](function(_0x3bed0d){_0x90dd78=_0x3bed0d;return getEndUser(_0x302378,_0x2bb98b,_0x5358ff['destcalleridname'],_0x5358ff[_0xf7c5('0x5c')],_0x22f1a9);})[_0xf7c5('0x23')](function(_0x50c92f){_0x5d5a7f=_0x50c92f;return getTicket(_0x302378,_0x90dd78,_0x5d5a7f,_0x2bb98b,_0x5358ff,_0x2bb98b[_0xf7c5('0x4e')],_0x22f1a9,'outbound');})['then'](function(_0x595af0){_0x3cb5c2=_0x595af0;logger[_0xf7c5('0x1e')](_0xf7c5('0x5d'),_0x3cb5c2['id']);logger[_0xf7c5('0x1e')](_0xf7c5('0x5e'),_0x3cb5c2['id'],_0x53fb15[_0xf7c5('0x3f')],_0x302378['type']);switch(_0x302378[_0xf7c5('0x36')]){case _0xf7c5('0x5f'):emit(util[_0xf7c5('0x30')](_0xf7c5('0x50'),_0x53fb15[_0xf7c5('0x3f')]),_0xf7c5('0x60'),{'recordId':_0x3cb5c2['id']});break;case _0xf7c5('0x51'):emit(util[_0xf7c5('0x30')]('user:%s',_0x53fb15[_0xf7c5('0x3f')]),_0xf7c5('0x52'),{'uri':util[_0xf7c5('0x30')]('%s/%s/e',_0x22f1a9[_0xf7c5('0x61')],_0x3cb5c2['id'])});break;default:logger[_0xf7c5('0x54')](_0xf7c5('0x58'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xf7c5('0x62')](function(_0x2c6246){logger[_0xf7c5('0x54')](_0xf7c5('0x58'),JSON[_0xf7c5('0x55')](_0x2c6246));});};exports[_0xf7c5('0x63')]=function(_0x83b817,_0x45fb78,_0x5c2a7c,_0x23d482,_0x3c0879,_0x778fe){var _0x2ed06e,_0x504496,_0x14e23b,_0x1a8b85;_0x778fe[_0xf7c5('0x48')]=intUtil[_0xf7c5('0x49')](_0x778fe[_0xf7c5('0x48')]);_0x778fe['remoteUri']=intUtil[_0xf7c5('0x49')](_0x778fe[_0xf7c5('0x44')]);if(_0x3c0879&&_0x3c0879[_0xf7c5('0x64')]){logger[_0xf7c5('0x1e')]('['+_0x45fb78[_0xf7c5('0x65')][_0xf7c5('0x66')]()+']',_0xf7c5('0x59'));_0x45fb78[_0xf7c5('0x4b')]=util['format'](_0xf7c5('0x5a'),_0x778fe[_0xf7c5('0x48')],_0x45fb78[_0xf7c5('0x5b')],md5(_0x45fb78['uniqueid']));}else{_0x45fb78['recordingURL']='';}return getConnection(_0x778fe)[_0xf7c5('0x23')](function(_0x3ba5fc){_0x1a8b85=_0x3ba5fc;if(!_['isNil'](_0x23d482)){return getUser(_0x778fe,_0x23d482[_0xf7c5('0x3f')],_0x1a8b85);}else{return getUser(_0x778fe,null,_0x1a8b85);}})['then'](function(_0x27d904){_0x2ed06e=_0x27d904;return getEndUser(_0x778fe,_0x5c2a7c,_0x45fb78['calleridname'],_0x45fb78[_0xf7c5('0x67')],_0x1a8b85);})[_0xf7c5('0x23')](function(_0x1e045b){_0x504496=_0x1e045b;return getTicket(_0x778fe,_0x2ed06e,_0x504496,_0x5c2a7c,_0x45fb78,_0x5c2a7c[_0xf7c5('0x4e')],_0x1a8b85);})['then'](function(_0x3bd168){_0x14e23b=_0x3bd168;logger['info']('['+_0x45fb78[_0xf7c5('0x65')][_0xf7c5('0x66')]()+_0xf7c5('0x68'),_0x14e23b['id']);logger['info']('['+_0x45fb78[_0xf7c5('0x65')][_0xf7c5('0x66')]()+_0xf7c5('0x69'),_0x778fe[_0xf7c5('0x36')]);})[_0xf7c5('0x62')](function(_0x2156db){logger['error']('['+_0x45fb78[_0xf7c5('0x65')][_0xf7c5('0x66')]()+']',JSON['stringify'](_0x2156db));});}; \ 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 55ec532..d2e4116 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 _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x52ac61,_0x9434b7){var _0x2cf25c=function(_0xfe79aa){while(--_0xfe79aa){_0x52ac61['push'](_0x52ac61['shift']());}};_0x2cf25c(++_0x9434b7);}(_0x2ef3,0xba));var _0x32ef=function(_0xe6a858,_0x5501e3){_0xe6a858=_0xe6a858-0x0;var _0x4b2fc8=_0x2ef3[_0xe6a858];return _0x4b2fc8;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x424404,_0x191c57){var _0x1cfb39=function(_0x3f332a){while(--_0x3f332a){_0x424404['push'](_0x424404['shift']());}};_0x1cfb39(++_0x191c57);}(_0x1261,0x144));var _0x1126=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x1261[_0x4914e2];return _0x2dcd07;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'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 5b1d8f7..2660c23 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 _0x18a8=['resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','entry_list','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','merge','map','nameField','customField','idField','custom_fields','content','type','variable','customVariable','Variable','toLowerCase','login','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','unmanaged','toUpperCase','Inbound','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','getString','created_by','description','date_start','toISOString','slice','replace','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','name_value_list','value','Agent\x20found!'];(function(_0x1e42a2,_0xcad730){var _0x419be4=function(_0x25fae2){while(--_0x25fae2){_0x1e42a2['push'](_0x1e42a2['shift']());}};_0x419be4(++_0xcad730);}(_0x18a8,0x127));var _0x818a=function(_0xb7c97d,_0x38e951){_0xb7c97d=_0xb7c97d-0x0;var _0x10cbb0=_0x18a8[_0xb7c97d];return _0x10cbb0;};'use strict';var _=require(_0x818a('0x0'));var rp=require(_0x818a('0x1'));var BPromise=require('bluebird');var md5=require(_0x818a('0x2'));var util=require(_0x818a('0x3'));var Redis=require(_0x818a('0x4'));var intUtil=require(_0x818a('0x5'));var config=require(_0x818a('0x6'));var logger=require('../../../../config/logger')(_0x818a('0x7'));config[_0x818a('0x8')]=_['defaults'](config[_0x818a('0x8')],{'host':_0x818a('0x9'),'port':0x18eb});var io=require(_0x818a('0xa'))(new Redis(config[_0x818a('0x8')]));var def={'method':_0x818a('0xb'),'json':!![]};function emit(_0x28fb7c,_0x3041f8,_0x5c12fe){io['to'](_0x28fb7c)[_0x818a('0xc')](_0x3041f8,_0x5c12fe);}function getTicket(_0x492a01,_0x5af804,_0x569b7f,_0x4db0f1,_0x41113a,_0xa667b4,_0x5dc3d4,_0x3b435d){logger[_0x818a('0xd')]('Creating\x20new\x20ticket...');var _0x47748a=new Date();var _0x5bd38b=[{'name':'name','value':intUtil[_0x818a('0xe')](_0x4db0f1['Subjects'],_0x41113a,'\x20')},{'name':'assigned_user_id','value':_0x5af804['id']},{'name':_0x818a('0xf'),'value':_0x5af804['id']},{'name':_0x818a('0x10'),'value':intUtil['getString'](_0x4db0f1['Descriptions'],_0x41113a,'\x0a')},{'name':_0x818a('0x11'),'value':_0x47748a[_0x818a('0x12')]()[_0x818a('0x13')](0x0,0x13)[_0x818a('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x569b7f['id']},{'name':_0x818a('0x15'),'value':_0x818a('0x16')},{'name':_0x818a('0x17'),'value':_0x569b7f[_0x818a('0x18')]},{'name':_0x818a('0x19'),'value':_0x3b435d}];if(_0xa667b4[_0x818a('0x1a')]){_[_0x818a('0x1b')](_0xa667b4,function(_0x2bd37a){if(_0x41113a[_0x2bd37a[_0x818a('0x1c')]]){_0x5bd38b[_0x818a('0x1d')]({'name':_0x2bd37a['idField'],'value':_0x41113a[_0x2bd37a[_0x818a('0x1c')]]});}});}return request({'form':{'method':_0x818a('0x1e'),'input_type':_0x818a('0x1f'),'response_type':_0x818a('0x1f'),'rest_data':JSON[_0x818a('0x20')]({'session':_0x5dc3d4['id'],'module_name':_0x818a('0x21'),'name_value_list':_0x5bd38b})}});}function getAuth(_0x659d41){return util[_0x818a('0x22')](_0x818a('0x23'),new Buffer(_0x659d41[_0x818a('0x24')]+':X')[_0x818a('0x25')](_0x818a('0x26')));}function getServerInfo(_0x5542d1){return request({'form':{'method':_0x818a('0x27'),'input_type':_0x818a('0x1f'),'response_type':_0x818a('0x1f'),'rest_data':JSON[_0x818a('0x20')]({'session':_0x5542d1['id']})}});}function getUser(_0xe73187,_0x2e0e3d,_0x4c389e){if(!_['isNil'](_0x2e0e3d)){logger[_0x818a('0xd')]('Getting\x20agent\x20with\x20name',_0x2e0e3d);return request({'form':{'method':_0x818a('0x28'),'input_type':_0x818a('0x1f'),'response_type':_0x818a('0x1f'),'rest_data':JSON['stringify']({'session':_0x4c389e['id'],'module_name':'Employees','query':util['format'](_0x818a('0x29'),_0x2e0e3d),'order_by':'','offset':'0','select_fields':['id','name',_0x818a('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x818a('0x2b')](function(_0x298a69){if(_0x298a69['entry_list'][_0x818a('0x1a')]){var _0x10fb2b=_['find'](_0x298a69['entry_list'],function(_0x47d3bc){return _0x47d3bc[_0x818a('0x2c')][_0x818a('0x2a')][_0x818a('0x2d')]===_0x2e0e3d;});if(_0x10fb2b){logger[_0x818a('0xd')](_0x818a('0x2e'));return BPromise[_0x818a('0x2f')]({'id':_0x10fb2b[_0x818a('0x2c')]['id'][_0x818a('0x2d')],'name':_0x10fb2b[_0x818a('0x2c')]['name'][_0x818a('0x2d')]});}}logger[_0x818a('0xd')](_0x818a('0x30'));return BPromise[_0x818a('0x2f')]({'id':_0x4c389e[_0x818a('0x2c')]['user_id'][_0x818a('0x2d')],'name':_0x4c389e['name_value_list'][_0x818a('0x2a')]['value']});});}else{logger[_0x818a('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4c389e[_0x818a('0x2c')][_0x818a('0x31')]['value'],'name':_0x4c389e['name_value_list'][_0x818a('0x2a')][_0x818a('0x2d')]});}}function getEndUser(_0x583cc0,_0x43b81c,_0x3f232b,_0x3a8a74){logger[_0x818a('0xd')](_0x818a('0x32'),_0x3f232b);return request({'form':{'method':'get_entry_list','input_type':_0x818a('0x1f'),'response_type':_0x818a('0x1f'),'rest_data':JSON[_0x818a('0x20')]({'session':_0x3a8a74['id'],'module_name':_0x818a('0x16'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x3f232b),'order_by':'','offset':'0','select_fields':['id',_0x818a('0x18'),_0x818a('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x818a('0x2b')](function(_0x2e1c19){if(_0x2e1c19[_0x818a('0x34')][_0x818a('0x1a')]){var _0x20166f=_['find'](_0x2e1c19[_0x818a('0x34')],function(_0x12cc62){return _0x12cc62[_0x818a('0x2c')]['phone_home'][_0x818a('0x2d')]===_0x3f232b;});if(_0x20166f){logger[_0x818a('0xd')]('Enduser\x20found!');return BPromise[_0x818a('0x2f')]({'id':_0x20166f[_0x818a('0x2c')]['id'][_0x818a('0x2d')],'name':_0x20166f[_0x818a('0x2c')][_0x818a('0x18')][_0x818a('0x2d')],'phone':_0x20166f[_0x818a('0x2c')][_0x818a('0x33')][_0x818a('0x2d')]});}}else{logger[_0x818a('0xd')](_0x818a('0x35'));return request({'form':{'method':_0x818a('0x1e'),'input_type':_0x818a('0x1f'),'response_type':_0x818a('0x1f'),'rest_data':JSON[_0x818a('0x20')]({'session':_0x3a8a74['id'],'module_name':_0x818a('0x16'),'name_value_list':[{'name':'first_name','value':_0x43b81c!==_0x818a('0x36')?_0x43b81c:util['format'](_0x818a('0x37'),_0x3f232b)},{'name':_0x818a('0x33'),'value':_0x3f232b}]})}})[_0x818a('0x2b')](function(_0x42bae9){logger[_0x818a('0xd')](_0x818a('0x38'));return BPromise[_0x818a('0x2f')]({'id':_0x42bae9['id'],'name':_0x42bae9[_0x818a('0x34')][_0x818a('0x39')][_0x818a('0x2d')],'phone':_0x42bae9[_0x818a('0x34')][_0x818a('0x33')][_0x818a('0x2d')]});});}});}function request(_0x167f8e){logger['debug']('[HTTP]',JSON[_0x818a('0x20')](_0x167f8e));return rp(_[_0x818a('0x3a')](def,_0x167f8e));}function getTags(_0x4f35a1,_0xf5124c){var _0x1c81d8=[];if(_0x4f35a1&&_0x4f35a1[_0x818a('0x1a')]>0x0){_0x1c81d8=_[_0x818a('0x3b')](_0x4f35a1,_0xf5124c);}return _0x1c81d8;}function getCustomFields(_0x5a6296,_0x57b4e0){var _0x413521=[];var _0x98829={'custom_fields':[]};if(_0x5a6296[_0x818a('0x1a')]>0x0){_[_0x818a('0x1b')](_0x5a6296,function(_0x266589){if(_0x266589['type']==='string'&&_0x266589[_0x818a('0x3c')]&&!_0x266589[_0x818a('0x3d')]){_0x98829[_0x266589[_0x818a('0x3c')]['toLowerCase']()]=_0x266589['content'][_0x818a('0x25')]();}else if(_0x266589['type']==='string'&&_0x266589[_0x818a('0x3e')]&&_0x266589[_0x818a('0x3d')]){_0x98829[_0x818a('0x3f')]['push']({'id':_0x266589[_0x818a('0x3e')],'value':_0x266589[_0x818a('0x40')][_0x818a('0x25')]()});}else if(_0x266589[_0x818a('0x41')]===_0x818a('0x42')&&_0x266589[_0x818a('0x1c')]&&_0x266589['idField']&&_0x266589[_0x818a('0x3d')]){_0x57b4e0[_0x266589[_0x818a('0x1c')]]&&_0x98829[_0x818a('0x3f')][_0x818a('0x1d')]({'id':_0x266589[_0x818a('0x3e')],'value':_0x57b4e0[_0x266589[_0x818a('0x1c')]][_0x818a('0x25')]()});}else if(_0x266589['type']===_0x818a('0x43')&&_0x266589[_0x818a('0x44')]&&_0x266589['Variable'][_0x818a('0x18')]&&_0x266589['idField']&&_0x266589[_0x818a('0x3d')]){_0x57b4e0[_0x266589['Variable'][_0x818a('0x18')]['toLowerCase']()]&&_0x98829[_0x818a('0x3f')][_0x818a('0x1d')]({'id':_0x266589[_0x818a('0x3e')],'value':_0x57b4e0[_0x266589['Variable'][_0x818a('0x18')][_0x818a('0x45')]()][_0x818a('0x25')]()});}});}return _0x98829;}function getConnection(_0x4d1d16){return request({'method':_0x818a('0xb'),'form':{'method':_0x818a('0x46'),'input_type':'JSON','response_type':_0x818a('0x1f'),'rest_data':JSON[_0x818a('0x20')]({'user_auth':{'user_name':_0x4d1d16['username'],'password':_0x4d1d16['password'],'encryption':_0x818a('0x47')},'application':_0x818a('0x48')})}})[_0x818a('0x2b')](function(_0x1d0e07){var _0x28b54c=_0x1d0e07;if(_0x28b54c['id']){def['sessionID']=_0x28b54c['id'];return BPromise[_0x818a('0x2f')](_0x28b54c);}else{throw new Error(util[_0x818a('0x22')]('Account\x20%d\x20is\x20not\x20valid',_0x4d1d16['id']));}});}function setRelationship(_0x16b87e,_0x2fe598,_0x20b23a,_0x94f4ef){return request({'form':{'method':_0x818a('0x49'),'input_type':_0x818a('0x1f'),'response_type':'JSON','rest_data':JSON[_0x818a('0x20')]({'session':_0x16b87e['id'],'module_name':_0x818a('0x21'),'module_id':_0x20b23a['id'],'link_field_name':_0x94f4ef,'related_ids':[_0x2fe598['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x818a('0x4a')]=function(_0x3421f7,_0x10e716,_0x2b664a,_0x31ab82,_0x3cd00e,_0x248ff8){var _0x1cba66,_0x207764,_0x77f63a,_0x1f2ce5;_0x248ff8[_0x818a('0x4b')]=intUtil[_0x818a('0x4c')](_0x248ff8[_0x818a('0x4b')]);_0x248ff8[_0x818a('0x4d')]=intUtil[_0x818a('0x4c')](_0x248ff8[_0x818a('0x4d')]);def[_0x818a('0x4e')]=util['format']('%s/service/v4_1/rest.php',_0x248ff8[_0x818a('0x4b')]);if(_0x3cd00e&&_0x3cd00e[_0x818a('0x4f')]){logger[_0x818a('0xd')](_0x818a('0x50'),'Recording\x20is\x20enabled!');_0x10e716[_0x818a('0x51')]=util[_0x818a('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x248ff8['serverUrl'],_0x10e716['uniqueid'],md5(_0x10e716[_0x818a('0x52')]));}else{_0x10e716['recordingURL']='';}return getConnection(_0x248ff8)[_0x818a('0x2b')](function(_0x286f1f){_0x1f2ce5=_0x286f1f;return getUser(_0x248ff8,_0x31ab82[_0x818a('0x18')],_0x1f2ce5);})[_0x818a('0x2b')](function(_0x1ce66e){_0x1cba66=_0x1ce66e;logger['info']('The\x20User\x20ID\x20is:',_0x1cba66['id']);return getEndUser(_0x248ff8,_0x10e716['calleridname'],_0x10e716[_0x818a('0x53')],_0x1f2ce5);})[_0x818a('0x2b')](function(_0x565f5c){_0x207764=_0x565f5c;logger[_0x818a('0xd')](_0x818a('0x54'),_0x207764['id']);return getTicket(_0x248ff8,_0x1cba66,_0x207764,_0x2b664a,_0x10e716,_0x2b664a[_0x818a('0x55')],_0x1f2ce5,'Inbound');})[_0x818a('0x2b')](function(_0x568b4c){_0x77f63a=_0x568b4c;logger[_0x818a('0xd')](_0x818a('0x56'));logger[_0x818a('0xd')](_0x818a('0x57'),_0x77f63a['id']);return setRelationship(_0x1f2ce5,_0x1cba66,_0x77f63a,_0x818a('0x58'));})[_0x818a('0x2b')](function(){return setRelationship(_0x1f2ce5,_0x207764,_0x77f63a,_0x818a('0x59'));})[_0x818a('0x2b')](function(){return getServerInfo(_0x1f2ce5);})['then'](function(_0x113348){var _0x217b7d=parseInt(_0x113348[_0x818a('0x5a')]['charAt'](0x0));var _0x497ea6=util[_0x818a('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x248ff8[_0x818a('0x4b')],_0x77f63a['id']);if(_0x217b7d>0x6){_0x497ea6=util[_0x818a('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x248ff8[_0x818a('0x4b')],_0x77f63a['id']);}logger[_0x818a('0xd')](_0x818a('0x50'),_0x818a('0x5b'));emit(util[_0x818a('0x22')](_0x818a('0x5c'),_0x31ab82[_0x818a('0x18')]),'trigger:browser:url',{'uri':_0x497ea6});})['catch'](function(_0x56710b){logger[_0x818a('0x5d')](_0x818a('0x50'),JSON[_0x818a('0x20')](_0x56710b));});};exports[_0x818a('0x5e')]=function(_0x2acbd7,_0x31d02b,_0x1328cb,_0x509e9b,_0x4ddee1,_0x28a342,_0x360598){var _0x24f959,_0x337228,_0x538c9c,_0x5d0cc2;_0x28a342[_0x818a('0x4b')]=intUtil[_0x818a('0x4c')](_0x28a342[_0x818a('0x4b')]);_0x28a342[_0x818a('0x4d')]=intUtil[_0x818a('0x4c')](_0x28a342['serverUrl']);def[_0x818a('0x4e')]=util['format'](_0x818a('0x5f'),_0x28a342[_0x818a('0x4b')]);if(_0x360598&&_0x360598[_0x818a('0x60')]&&_0x360598[_0x818a('0x60')]!==_0x818a('0x61')){logger[_0x818a('0xd')](_0x818a('0x62'),_0x818a('0x63'));_0x31d02b[_0x818a('0x51')]=util[_0x818a('0x22')](_0x818a('0x64'),_0x28a342[_0x818a('0x4d')],_0x31d02b[_0x818a('0x52')],md5(_0x31d02b[_0x818a('0x52')]));}return getConnection(_0x28a342)[_0x818a('0x2b')](function(_0x1db767){_0x5d0cc2=_0x1db767;return getUser(_0x28a342,_0x509e9b[_0x818a('0x18')],_0x5d0cc2);})[_0x818a('0x2b')](function(_0x21b360){_0x24f959=_0x21b360;logger['info'](_0x818a('0x65'),_0x24f959['id']);return getEndUser(_0x28a342,_0x31d02b[_0x818a('0x66')],_0x31d02b[_0x818a('0x67')],_0x5d0cc2);})[_0x818a('0x2b')](function(_0x53f93c){_0x337228=_0x53f93c;logger[_0x818a('0xd')](_0x818a('0x54'),_0x337228['id']);return getTicket(_0x28a342,_0x24f959,_0x337228,_0x1328cb,_0x31d02b,_0x1328cb[_0x818a('0x55')],_0x5d0cc2,_0x818a('0x68'));})['then'](function(_0x18dd18){_0x538c9c=_0x18dd18;logger['info']('Ticket\x20created!');logger[_0x818a('0xd')](_0x818a('0x57'),_0x538c9c['id']);return setRelationship(_0x5d0cc2,_0x24f959,_0x538c9c,_0x818a('0x58'));})[_0x818a('0x2b')](function(){return setRelationship(_0x5d0cc2,_0x337228,_0x538c9c,_0x818a('0x59'));})[_0x818a('0x2b')](function(){return getServerInfo(_0x5d0cc2);})[_0x818a('0x2b')](function(_0x96ea56){var _0xb39ea=parseInt(_0x96ea56[_0x818a('0x5a')][_0x818a('0x69')](0x0));var _0x460672=util[_0x818a('0x22')](_0x818a('0x6a'),_0x28a342[_0x818a('0x4b')],_0x538c9c['id']);if(_0xb39ea>0x6){_0x460672=util[_0x818a('0x22')](_0x818a('0x6b'),_0x28a342[_0x818a('0x4b')],_0x538c9c['id']);}logger['info'](_0x818a('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x818a('0x22')](_0x818a('0x5c'),_0x509e9b[_0x818a('0x18')]),_0x818a('0x6c'),{'uri':_0x460672});})[_0x818a('0x6d')](function(_0x3c68ab){logger[_0x818a('0x5d')](_0x818a('0x62'),JSON[_0x818a('0x20')](_0x3c68ab));});};exports[_0x818a('0x6e')]=function(_0x2715ba,_0x465c98,_0x4fc060,_0xdff9dc,_0x51f5cd,_0x2c7a67){var _0x562181,_0x40a5ea,_0x2ce871,_0xa497c2;_0x2c7a67[_0x818a('0x4b')]=intUtil[_0x818a('0x4c')](_0x2c7a67[_0x818a('0x4b')]);_0x2c7a67[_0x818a('0x4d')]=intUtil[_0x818a('0x4c')](_0x2c7a67[_0x818a('0x4d')]);def[_0x818a('0x4e')]=util[_0x818a('0x22')](_0x818a('0x5f'),_0x2c7a67[_0x818a('0x4b')]);if(_0x51f5cd&&_0x51f5cd['monitor_format']){logger[_0x818a('0xd')]('['+_0x465c98['lastevent'][_0x818a('0x6f')]()+']',_0x818a('0x63'));_0x465c98[_0x818a('0x51')]=util['format'](_0x818a('0x64'),_0x2c7a67[_0x818a('0x4d')],_0x465c98[_0x818a('0x52')],md5(_0x465c98[_0x818a('0x52')]));}else{_0x465c98[_0x818a('0x51')]='';}return getConnection(_0x2c7a67)[_0x818a('0x2b')](function(_0x3ac5c4){_0xa497c2=_0x3ac5c4;if(!_['isNil'](_0xdff9dc)){return getUser(_0x2c7a67,_0xdff9dc['name'],_0xa497c2);}else{return getUser(_0x2c7a67,null,_0xa497c2);}})[_0x818a('0x2b')](function(_0x593f8c){_0x562181=_0x593f8c;logger[_0x818a('0xd')](_0x818a('0x65'),_0x562181['id']);return getEndUser(_0x2c7a67,_0x465c98['calleridname'],_0x465c98[_0x818a('0x53')],_0xa497c2);})[_0x818a('0x2b')](function(_0x266ae4){_0x40a5ea=_0x266ae4;logger[_0x818a('0xd')](_0x818a('0x54'),_0x40a5ea['id']);return getTicket(_0x2c7a67,_0x562181,_0x40a5ea,_0x4fc060,_0x465c98,_0x4fc060[_0x818a('0x55')],_0xa497c2,_0x818a('0x70'));})['then'](function(_0x48df0f){_0x2ce871=_0x48df0f;logger[_0x818a('0xd')](_0x818a('0x56'));logger[_0x818a('0xd')](_0x818a('0x57'),_0x2ce871['id']);return setRelationship(_0xa497c2,_0x562181,_0x2ce871,_0x818a('0x58'));})['then'](function(){return setRelationship(_0xa497c2,_0x40a5ea,_0x2ce871,_0x818a('0x59'));})[_0x818a('0x2b')](function(){return getServerInfo(_0xa497c2);})[_0x818a('0x6d')](function(_0x1cdf49){logger[_0x818a('0x5d')]('['+_0x465c98[_0x818a('0x71')]['toUpperCase']()+']',JSON[_0x818a('0x20')](_0x1cdf49));});}; \ No newline at end of file +var _0xc263=['[OUTBOUND]','trigger:browser:url','unmanaged','monitor_format','toUpperCase','lastevent','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','duration_hours','parent_id','parent_type','direction','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','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','then','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','phone_home','entry_list','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','toString','type','custom_fields','push','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%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'];(function(_0x1440d9,_0x4a2c7e){var _0x4a0cfb=function(_0x9dc96c){while(--_0x9dc96c){_0x1440d9['push'](_0x1440d9['shift']());}};_0x4a0cfb(++_0x4a2c7e);}(_0xc263,0x171));var _0x3c26=function(_0x35bf78,_0x275ef4){_0x35bf78=_0x35bf78-0x0;var _0x3fad9d=_0xc263[_0x35bf78];return _0x3fad9d;};'use strict';var _=require(_0x3c26('0x0'));var rp=require('request-promise');var BPromise=require(_0x3c26('0x1'));var md5=require('md5');var util=require(_0x3c26('0x2'));var Redis=require(_0x3c26('0x3'));var intUtil=require(_0x3c26('0x4'));var config=require(_0x3c26('0x5'));var logger=require(_0x3c26('0x6'))('sugarcrm');config['redis']=_['defaults'](config[_0x3c26('0x7')],{'host':_0x3c26('0x8'),'port':0x18eb});var io=require(_0x3c26('0x9'))(new Redis(config[_0x3c26('0x7')]));var def={'method':_0x3c26('0xa'),'json':!![]};function emit(_0x11ee6f,_0x336655,_0x545f98){io['to'](_0x11ee6f)[_0x3c26('0xb')](_0x336655,_0x545f98);}function getTicket(_0x284d01,_0x31b18d,_0xb9771,_0x38ee0e,_0x2966d6,_0x3b82d6,_0x5aaf0f,_0x488e08){logger[_0x3c26('0xc')](_0x3c26('0xd'));var _0x23d535=new Date();var _0x54f0d4=[{'name':_0x3c26('0xe'),'value':intUtil[_0x3c26('0xf')](_0x38ee0e[_0x3c26('0x10')],_0x2966d6,'\x20')},{'name':_0x3c26('0x11'),'value':_0x31b18d['id']},{'name':_0x3c26('0x12'),'value':_0x31b18d['id']},{'name':_0x3c26('0x13'),'value':intUtil[_0x3c26('0xf')](_0x38ee0e[_0x3c26('0x14')],_0x2966d6,'\x0a')},{'name':'date_start','value':_0x23d535[_0x3c26('0x15')]()[_0x3c26('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0x3c26('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x3c26('0x18'),'value':_0xb9771['id']},{'name':_0x3c26('0x19'),'value':'Contacts'},{'name':'parent_name','value':_0xb9771['name']},{'name':_0x3c26('0x1a'),'value':_0x488e08}];if(_0x3b82d6['length']){_[_0x3c26('0x1b')](_0x3b82d6,function(_0x459524){if(_0x2966d6[_0x459524[_0x3c26('0x1c')]]){_0x54f0d4['push']({'name':_0x459524[_0x3c26('0x1d')],'value':_0x2966d6[_0x459524['variableName']]});}});}return request({'form':{'method':_0x3c26('0x1e'),'input_type':_0x3c26('0x1f'),'response_type':'JSON','rest_data':JSON[_0x3c26('0x20')]({'session':_0x5aaf0f['id'],'module_name':_0x3c26('0x21'),'name_value_list':_0x54f0d4})}});}function getAuth(_0x5a87e5){return util[_0x3c26('0x22')](_0x3c26('0x23'),new Buffer(_0x5a87e5[_0x3c26('0x24')]+':X')['toString']('base64'));}function getServerInfo(_0x580c76){return request({'form':{'method':_0x3c26('0x25'),'input_type':'JSON','response_type':_0x3c26('0x1f'),'rest_data':JSON[_0x3c26('0x20')]({'session':_0x580c76['id']})}});}function getUser(_0x52ce11,_0x4f039d,_0x337656){if(!_[_0x3c26('0x26')](_0x4f039d)){logger['info'](_0x3c26('0x27'),_0x4f039d);return request({'form':{'method':_0x3c26('0x28'),'input_type':_0x3c26('0x1f'),'response_type':'JSON','rest_data':JSON[_0x3c26('0x20')]({'session':_0x337656['id'],'module_name':_0x3c26('0x29'),'query':util[_0x3c26('0x22')](_0x3c26('0x2a'),_0x4f039d),'order_by':'','offset':'0','select_fields':['id',_0x3c26('0xe'),_0x3c26('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3c26('0x2c')](function(_0x436bcb){if(_0x436bcb['entry_list'][_0x3c26('0x2d')]){var _0x4218e1=_[_0x3c26('0x2e')](_0x436bcb['entry_list'],function(_0x3aef70){return _0x3aef70[_0x3c26('0x2f')][_0x3c26('0x2b')][_0x3c26('0x30')]===_0x4f039d;});if(_0x4218e1){logger[_0x3c26('0xc')]('Agent\x20found!');return BPromise[_0x3c26('0x31')]({'id':_0x4218e1['name_value_list']['id'][_0x3c26('0x30')],'name':_0x4218e1[_0x3c26('0x2f')][_0x3c26('0xe')][_0x3c26('0x30')]});}}logger[_0x3c26('0xc')](_0x3c26('0x32'));return BPromise[_0x3c26('0x31')]({'id':_0x337656[_0x3c26('0x2f')][_0x3c26('0x33')][_0x3c26('0x30')],'name':_0x337656['name_value_list'][_0x3c26('0x2b')][_0x3c26('0x30')]});});}else{logger[_0x3c26('0xc')](_0x3c26('0x34'));return BPromise[_0x3c26('0x31')]({'id':_0x337656[_0x3c26('0x2f')][_0x3c26('0x33')]['value'],'name':_0x337656[_0x3c26('0x2f')][_0x3c26('0x2b')][_0x3c26('0x30')]});}}function getEndUser(_0x5b9ee8,_0x26f670,_0x266d5f,_0x47c2d3){logger[_0x3c26('0xc')]('Searching\x20enduser\x20with\x20phone',_0x266d5f);return request({'form':{'method':_0x3c26('0x28'),'input_type':_0x3c26('0x1f'),'response_type':_0x3c26('0x1f'),'rest_data':JSON[_0x3c26('0x20')]({'session':_0x47c2d3['id'],'module_name':_0x3c26('0x35'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x266d5f),'order_by':'','offset':'0','select_fields':['id','name',_0x3c26('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3c26('0x2c')](function(_0xf7be4d){if(_0xf7be4d['entry_list'][_0x3c26('0x2d')]){var _0x272155=_[_0x3c26('0x2e')](_0xf7be4d[_0x3c26('0x37')],function(_0x25463e){return _0x25463e[_0x3c26('0x2f')][_0x3c26('0x36')][_0x3c26('0x30')]===_0x266d5f;});if(_0x272155){logger['info']('Enduser\x20found!');return BPromise[_0x3c26('0x31')]({'id':_0x272155[_0x3c26('0x2f')]['id']['value'],'name':_0x272155[_0x3c26('0x2f')][_0x3c26('0xe')][_0x3c26('0x30')],'phone':_0x272155[_0x3c26('0x2f')]['phone_home']['value']});}}else{logger[_0x3c26('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x3c26('0x1e'),'input_type':_0x3c26('0x1f'),'response_type':_0x3c26('0x1f'),'rest_data':JSON['stringify']({'session':_0x47c2d3['id'],'module_name':'Contacts','name_value_list':[{'name':_0x3c26('0x38'),'value':_0x26f670!==_0x3c26('0x39')?_0x26f670:util[_0x3c26('0x22')](_0x3c26('0x3a'),_0x266d5f)},{'name':'phone_home','value':_0x266d5f}]})}})[_0x3c26('0x2c')](function(_0x21229a){logger['info'](_0x3c26('0x3b'));return BPromise[_0x3c26('0x31')]({'id':_0x21229a['id'],'name':_0x21229a[_0x3c26('0x37')][_0x3c26('0x38')]['value'],'phone':_0x21229a[_0x3c26('0x37')][_0x3c26('0x36')][_0x3c26('0x30')]});});}});}function request(_0x217d23){logger[_0x3c26('0x3c')](_0x3c26('0x3d'),JSON['stringify'](_0x217d23));return rp(_[_0x3c26('0x3e')](def,_0x217d23));}function getTags(_0xe8eb55,_0x4140d0){var _0x311362=[];if(_0xe8eb55&&_0xe8eb55['length']>0x0){_0x311362=_[_0x3c26('0x3f')](_0xe8eb55,_0x4140d0);}return _0x311362;}function getCustomFields(_0x159631,_0x3c4784){var _0x25bf02=[];var _0x447381={'custom_fields':[]};if(_0x159631[_0x3c26('0x2d')]>0x0){_[_0x3c26('0x1b')](_0x159631,function(_0x5717d3){if(_0x5717d3['type']===_0x3c26('0x40')&&_0x5717d3[_0x3c26('0x41')]&&!_0x5717d3[_0x3c26('0x42')]){_0x447381[_0x5717d3[_0x3c26('0x41')][_0x3c26('0x43')]()]=_0x5717d3[_0x3c26('0x44')][_0x3c26('0x45')]();}else if(_0x5717d3[_0x3c26('0x46')]==='string'&&_0x5717d3['idField']&&_0x5717d3[_0x3c26('0x42')]){_0x447381[_0x3c26('0x47')][_0x3c26('0x48')]({'id':_0x5717d3[_0x3c26('0x1d')],'value':_0x5717d3['content'][_0x3c26('0x45')]()});}else if(_0x5717d3[_0x3c26('0x46')]==='variable'&&_0x5717d3['variableName']&&_0x5717d3[_0x3c26('0x1d')]&&_0x5717d3['customField']){_0x3c4784[_0x5717d3[_0x3c26('0x1c')]]&&_0x447381[_0x3c26('0x47')][_0x3c26('0x48')]({'id':_0x5717d3['idField'],'value':_0x3c4784[_0x5717d3['variableName']][_0x3c26('0x45')]()});}else if(_0x5717d3[_0x3c26('0x46')]===_0x3c26('0x49')&&_0x5717d3['Variable']&&_0x5717d3['Variable'][_0x3c26('0xe')]&&_0x5717d3[_0x3c26('0x1d')]&&_0x5717d3['customField']){_0x3c4784[_0x5717d3[_0x3c26('0x4a')][_0x3c26('0xe')][_0x3c26('0x43')]()]&&_0x447381['custom_fields'][_0x3c26('0x48')]({'id':_0x5717d3[_0x3c26('0x1d')],'value':_0x3c4784[_0x5717d3[_0x3c26('0x4a')][_0x3c26('0xe')][_0x3c26('0x43')]()][_0x3c26('0x45')]()});}});}return _0x447381;}function getConnection(_0x49b828){return request({'method':_0x3c26('0xa'),'form':{'method':_0x3c26('0x4b'),'input_type':_0x3c26('0x1f'),'response_type':_0x3c26('0x1f'),'rest_data':JSON[_0x3c26('0x20')]({'user_auth':{'user_name':_0x49b828[_0x3c26('0x4c')],'password':_0x49b828[_0x3c26('0x4d')],'encryption':_0x3c26('0x4e')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x3c26('0x2c')](function(_0x56b83d){var _0xbc3786=_0x56b83d;if(_0xbc3786['id']){def[_0x3c26('0x4f')]=_0xbc3786['id'];return BPromise['resolve'](_0xbc3786);}else{throw new Error(util[_0x3c26('0x22')](_0x3c26('0x50'),_0x49b828['id']));}});}function setRelationship(_0x337783,_0x3166b7,_0x37dfe7,_0x29732b){return request({'form':{'method':_0x3c26('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3c26('0x20')]({'session':_0x337783['id'],'module_name':_0x3c26('0x21'),'module_id':_0x37dfe7['id'],'link_field_name':_0x29732b,'related_ids':[_0x3166b7['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3c26('0x52')]=function(_0x5ef15f,_0x2de7f4,_0xf844f8,_0x6f52b6,_0x21ae0d,_0x2a821e){var _0x2928da,_0x5e4256,_0x3d17f6,_0x8d2469;_0x2a821e[_0x3c26('0x53')]=intUtil[_0x3c26('0x54')](_0x2a821e[_0x3c26('0x53')]);_0x2a821e[_0x3c26('0x55')]=intUtil[_0x3c26('0x54')](_0x2a821e[_0x3c26('0x55')]);def[_0x3c26('0x56')]=util[_0x3c26('0x22')](_0x3c26('0x57'),_0x2a821e[_0x3c26('0x53')]);if(_0x21ae0d&&_0x21ae0d['monitor_format']){logger[_0x3c26('0xc')]('[QUEUE]',_0x3c26('0x58'));_0x2de7f4[_0x3c26('0x59')]=util[_0x3c26('0x22')](_0x3c26('0x5a'),_0x2a821e['serverUrl'],_0x2de7f4[_0x3c26('0x5b')],md5(_0x2de7f4[_0x3c26('0x5b')]));}else{_0x2de7f4[_0x3c26('0x59')]='';}return getConnection(_0x2a821e)[_0x3c26('0x2c')](function(_0x4b7f1c){_0x8d2469=_0x4b7f1c;return getUser(_0x2a821e,_0x6f52b6[_0x3c26('0xe')],_0x8d2469);})[_0x3c26('0x2c')](function(_0x9e5af7){_0x2928da=_0x9e5af7;logger[_0x3c26('0xc')](_0x3c26('0x5c'),_0x2928da['id']);return getEndUser(_0x2a821e,_0x2de7f4[_0x3c26('0x5d')],_0x2de7f4[_0x3c26('0x5e')],_0x8d2469);})[_0x3c26('0x2c')](function(_0x155aca){_0x5e4256=_0x155aca;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5e4256['id']);return getTicket(_0x2a821e,_0x2928da,_0x5e4256,_0xf844f8,_0x2de7f4,_0xf844f8['Fields'],_0x8d2469,_0x3c26('0x5f'));})['then'](function(_0x1d362d){_0x3d17f6=_0x1d362d;logger[_0x3c26('0xc')]('Ticket\x20created!');logger['info'](_0x3c26('0x60'),_0x3d17f6['id']);return setRelationship(_0x8d2469,_0x2928da,_0x3d17f6,'users');})[_0x3c26('0x2c')](function(){return setRelationship(_0x8d2469,_0x5e4256,_0x3d17f6,_0x3c26('0x61'));})['then'](function(){return getServerInfo(_0x8d2469);})[_0x3c26('0x2c')](function(_0x3fb1bc){var _0xf0c5bf=parseInt(_0x3fb1bc[_0x3c26('0x62')][_0x3c26('0x63')](0x0));var _0x206bf3=util[_0x3c26('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2a821e[_0x3c26('0x53')],_0x3d17f6['id']);if(_0xf0c5bf>0x6){_0x206bf3=util[_0x3c26('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2a821e[_0x3c26('0x53')],_0x3d17f6['id']);}logger[_0x3c26('0xc')](_0x3c26('0x64'),_0x3c26('0x65'));emit(util[_0x3c26('0x22')](_0x3c26('0x66'),_0x6f52b6[_0x3c26('0xe')]),'trigger:browser:url',{'uri':_0x206bf3});})[_0x3c26('0x67')](function(_0x1666bf){logger[_0x3c26('0x68')](_0x3c26('0x64'),JSON[_0x3c26('0x20')](_0x1666bf));});};exports[_0x3c26('0x69')]=function(_0x43516c,_0x32c76a,_0x752206,_0x3e7926,_0x14f492,_0x348d6d,_0x55c2d8){var _0x5208b4,_0x4765b8,_0x3b5aac,_0x49040c;_0x348d6d['remoteUri']=intUtil[_0x3c26('0x54')](_0x348d6d[_0x3c26('0x53')]);_0x348d6d[_0x3c26('0x55')]=intUtil[_0x3c26('0x54')](_0x348d6d['serverUrl']);def[_0x3c26('0x56')]=util[_0x3c26('0x22')](_0x3c26('0x57'),_0x348d6d[_0x3c26('0x53')]);if(_0x55c2d8&&_0x55c2d8[_0x3c26('0x6a')]&&_0x55c2d8[_0x3c26('0x6a')]!==_0x3c26('0x6b')){logger[_0x3c26('0xc')]('[OUTBOUND]',_0x3c26('0x58'));_0x32c76a[_0x3c26('0x59')]=util[_0x3c26('0x22')](_0x3c26('0x5a'),_0x348d6d[_0x3c26('0x55')],_0x32c76a[_0x3c26('0x5b')],md5(_0x32c76a[_0x3c26('0x5b')]));}return getConnection(_0x348d6d)[_0x3c26('0x2c')](function(_0x33ed93){_0x49040c=_0x33ed93;return getUser(_0x348d6d,_0x3e7926[_0x3c26('0xe')],_0x49040c);})[_0x3c26('0x2c')](function(_0x8a6b26){_0x5208b4=_0x8a6b26;logger[_0x3c26('0xc')](_0x3c26('0x5c'),_0x5208b4['id']);return getEndUser(_0x348d6d,_0x32c76a[_0x3c26('0x6c')],_0x32c76a[_0x3c26('0x6d')],_0x49040c);})['then'](function(_0x6565ab){_0x4765b8=_0x6565ab;logger[_0x3c26('0xc')](_0x3c26('0x6e'),_0x4765b8['id']);return getTicket(_0x348d6d,_0x5208b4,_0x4765b8,_0x752206,_0x32c76a,_0x752206[_0x3c26('0x6f')],_0x49040c,'Outbound');})[_0x3c26('0x2c')](function(_0x56585c){_0x3b5aac=_0x56585c;logger[_0x3c26('0xc')](_0x3c26('0x70'));logger[_0x3c26('0xc')](_0x3c26('0x60'),_0x3b5aac['id']);return setRelationship(_0x49040c,_0x5208b4,_0x3b5aac,'users');})[_0x3c26('0x2c')](function(){return setRelationship(_0x49040c,_0x4765b8,_0x3b5aac,_0x3c26('0x61'));})[_0x3c26('0x2c')](function(){return getServerInfo(_0x49040c);})['then'](function(_0x25f717){var _0x8cccc=parseInt(_0x25f717[_0x3c26('0x62')]['charAt'](0x0));var _0x3bbc03=util['format'](_0x3c26('0x71'),_0x348d6d[_0x3c26('0x53')],_0x3b5aac['id']);if(_0x8cccc>0x6){_0x3bbc03=util[_0x3c26('0x22')](_0x3c26('0x72'),_0x348d6d['remoteUri'],_0x3b5aac['id']);}logger['info'](_0x3c26('0x73'),_0x3c26('0x65'));emit(util[_0x3c26('0x22')](_0x3c26('0x66'),_0x3e7926[_0x3c26('0xe')]),_0x3c26('0x74'),{'uri':_0x3bbc03});})['catch'](function(_0x4a40b1){logger[_0x3c26('0x68')]('[OUTBOUND]',JSON[_0x3c26('0x20')](_0x4a40b1));});};exports[_0x3c26('0x75')]=function(_0x49413a,_0xd8f735,_0x3b451b,_0x2756c6,_0x492911,_0x47aa57){var _0x2a7dee,_0x2d9a94,_0x45d28c,_0x251f26;_0x47aa57['remoteUri']=intUtil[_0x3c26('0x54')](_0x47aa57[_0x3c26('0x53')]);_0x47aa57[_0x3c26('0x55')]=intUtil[_0x3c26('0x54')](_0x47aa57['serverUrl']);def[_0x3c26('0x56')]=util[_0x3c26('0x22')]('%s/service/v4_1/rest.php',_0x47aa57[_0x3c26('0x53')]);if(_0x492911&&_0x492911[_0x3c26('0x76')]){logger['info']('['+_0xd8f735['lastevent'][_0x3c26('0x77')]()+']','Recording\x20is\x20enabled!');_0xd8f735[_0x3c26('0x59')]=util[_0x3c26('0x22')](_0x3c26('0x5a'),_0x47aa57[_0x3c26('0x55')],_0xd8f735[_0x3c26('0x5b')],md5(_0xd8f735['uniqueid']));}else{_0xd8f735[_0x3c26('0x59')]='';}return getConnection(_0x47aa57)['then'](function(_0x331108){_0x251f26=_0x331108;if(!_[_0x3c26('0x26')](_0x2756c6)){return getUser(_0x47aa57,_0x2756c6['name'],_0x251f26);}else{return getUser(_0x47aa57,null,_0x251f26);}})['then'](function(_0x3f5f3b){_0x2a7dee=_0x3f5f3b;logger['info'](_0x3c26('0x5c'),_0x2a7dee['id']);return getEndUser(_0x47aa57,_0xd8f735['calleridname'],_0xd8f735[_0x3c26('0x5e')],_0x251f26);})[_0x3c26('0x2c')](function(_0x595a02){_0x2d9a94=_0x595a02;logger[_0x3c26('0xc')](_0x3c26('0x6e'),_0x2d9a94['id']);return getTicket(_0x47aa57,_0x2a7dee,_0x2d9a94,_0x3b451b,_0xd8f735,_0x3b451b[_0x3c26('0x6f')],_0x251f26,_0x3c26('0x5f'));})[_0x3c26('0x2c')](function(_0x1c6e49){_0x45d28c=_0x1c6e49;logger['info'](_0x3c26('0x70'));logger[_0x3c26('0xc')](_0x3c26('0x60'),_0x45d28c['id']);return setRelationship(_0x251f26,_0x2a7dee,_0x45d28c,'users');})[_0x3c26('0x2c')](function(){return setRelationship(_0x251f26,_0x2d9a94,_0x45d28c,_0x3c26('0x61'));})[_0x3c26('0x2c')](function(){return getServerInfo(_0x251f26);})[_0x3c26('0x67')](function(_0x85ece8){logger[_0x3c26('0x68')]('['+_0xd8f735[_0x3c26('0x78')][_0x3c26('0x77')]()+']',JSON[_0x3c26('0x20')](_0x85ece8));});}; \ 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 c4a1ce8..25fd946 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 _0x4690=['test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','keyContent','key','substring','isNil'];(function(_0xe011cd,_0x279c15){var _0x1c2c5f=function(_0x3ea068){while(--_0x3ea068){_0xe011cd['push'](_0xe011cd['shift']());}};_0x1c2c5f(++_0x279c15);}(_0x4690,0x65));var _0x0469=function(_0x38553c,_0x12fc9b){_0x38553c=_0x38553c-0x0;var _0x570a35=_0x4690[_0x38553c];return _0x570a35;};'use strict';var _=require(_0x0469('0x0'));var util=require(_0x0469('0x1'));exports[_0x0469('0x2')]=function(_0x32257a,_0x2c1e7d,_0x266550){var _0x4f9f1e=[];if(_0x32257a[_0x0469('0x3')]>0x0){var _0x29f79b=_[_0x0469('0x4')](_0x32257a,['id']);for(var _0x2a3bec=0x0;_0x2a3bec<_0x29f79b[_0x0469('0x3')];_0x2a3bec++){var _0x4cba85=_0x29f79b[_0x2a3bec];if(_0x4cba85[_0x0469('0x5')]===_0x0469('0x6')){_0x4f9f1e[_0x0469('0x7')](_0x4cba85[_0x0469('0x8')]);}else if(_0x4cba85[_0x0469('0x5')]===_0x0469('0x9')&&_0x4cba85[_0x0469('0xa')]){_0x2c1e7d[_0x4cba85[_0x0469('0xa')]]&&_0x4f9f1e[_0x0469('0x7')](_0x2c1e7d[_0x4cba85['variableName']][_0x0469('0xb')]());}else if(_0x4cba85[_0x0469('0x5')]===_0x0469('0xc')&&_0x4cba85[_0x0469('0xd')]&&_0x4cba85[_0x0469('0xd')][_0x0469('0xe')]){_0x2c1e7d[_0x4cba85[_0x0469('0xd')][_0x0469('0xe')][_0x0469('0xf')]()]&&_0x4f9f1e['push'](_0x2c1e7d[_0x4cba85[_0x0469('0xd')][_0x0469('0xe')]['toLowerCase']()][_0x0469('0xb')]());}else if(_0x4cba85[_0x0469('0x5')]===_0x0469('0x10')){if(_0x4cba85[_0x0469('0x11')]===_0x0469('0x6')&&_0x4cba85['key']){_0x4f9f1e['push'](util[_0x0469('0x12')](_0x0469('0x13'),_0x4cba85['key'],_0x4cba85[_0x0469('0x14')]));}else if(_0x4cba85[_0x0469('0x11')]===_0x0469('0x9')&&_0x4cba85[_0x0469('0xa')]&&_0x4cba85['key']){_0x2c1e7d[_0x4cba85[_0x0469('0xa')]]&&_0x4f9f1e[_0x0469('0x7')](util['format'](_0x0469('0x13'),_0x4cba85[_0x0469('0x15')],_0x2c1e7d[_0x4cba85[_0x0469('0xa')]]));}else if(_0x4cba85['keyType']===_0x0469('0xc')&&_0x4cba85[_0x0469('0xd')]&&_0x4cba85[_0x0469('0xd')]['name']&&_0x4cba85[_0x0469('0x15')]){_0x2c1e7d[_0x4cba85[_0x0469('0xd')][_0x0469('0xe')][_0x0469('0xf')]()]&&_0x4f9f1e['push'](util[_0x0469('0x12')](_0x0469('0x13'),_0x4cba85['key'],_0x2c1e7d[_0x4cba85[_0x0469('0xd')]['name'][_0x0469('0xf')]()]));}}}}return _0x4f9f1e['join'](_0x266550);};exports['stripTrailingSlash']=function(_0x374bf1){var _0x3856f1=_0x374bf1['slice'](-0x1);if(_0x3856f1==='/'){_0x374bf1=_0x374bf1[_0x0469('0x16')](0x0,_0x374bf1['lastIndexOf'](_0x3856f1));}return _0x374bf1;};exports['validateEmail']=function(_0x266eea){if(!_[_0x0469('0x17')](_0x266eea)&&_0x266eea!==''){var _0x199049=/^(([^<>()\[\]\\.,;:\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 _0x199049[_0x0469('0x18')](String(_0x266eea)[_0x0469('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x736e=['sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','%s:\x20%s','keyType','join','slice','substring','lastIndexOf','validateEmail','test','lodash','getString','length'];(function(_0x32ffb5,_0x3866b5){var _0x3cbd7a=function(_0x42315b){while(--_0x42315b){_0x32ffb5['push'](_0x32ffb5['shift']());}};_0x3cbd7a(++_0x3866b5);}(_0x736e,0x65));var _0xe736=function(_0x352ce,_0x2dd65c){_0x352ce=_0x352ce-0x0;var _0x112db5=_0x736e[_0x352ce];return _0x112db5;};'use strict';var _=require(_0xe736('0x0'));var util=require('util');exports[_0xe736('0x1')]=function(_0xcf4ba6,_0x494454,_0x462ff2){var _0x30a46d=[];if(_0xcf4ba6[_0xe736('0x2')]>0x0){var _0x5ce995=_[_0xe736('0x3')](_0xcf4ba6,['id']);for(var _0x5beb75=0x0;_0x5beb75<_0x5ce995[_0xe736('0x2')];_0x5beb75++){var _0xe2f1a4=_0x5ce995[_0x5beb75];if(_0xe2f1a4[_0xe736('0x4')]===_0xe736('0x5')){_0x30a46d[_0xe736('0x6')](_0xe2f1a4[_0xe736('0x7')]);}else if(_0xe2f1a4['type']===_0xe736('0x8')&&_0xe2f1a4[_0xe736('0x9')]){_0x494454[_0xe2f1a4['variableName']]&&_0x30a46d['push'](_0x494454[_0xe2f1a4['variableName']]['toString']());}else if(_0xe2f1a4[_0xe736('0x4')]===_0xe736('0xa')&&_0xe2f1a4['Variable']&&_0xe2f1a4[_0xe736('0xb')][_0xe736('0xc')]){_0x494454[_0xe2f1a4['Variable'][_0xe736('0xc')][_0xe736('0xd')]()]&&_0x30a46d['push'](_0x494454[_0xe2f1a4[_0xe736('0xb')][_0xe736('0xc')][_0xe736('0xd')]()][_0xe736('0xe')]());}else if(_0xe2f1a4[_0xe736('0x4')]===_0xe736('0xf')){if(_0xe2f1a4['keyType']==='string'&&_0xe2f1a4[_0xe736('0x10')]){_0x30a46d[_0xe736('0x6')](util[_0xe736('0x11')](_0xe736('0x12'),_0xe2f1a4['key'],_0xe2f1a4['keyContent']));}else if(_0xe2f1a4[_0xe736('0x13')]==='variable'&&_0xe2f1a4['variableName']&&_0xe2f1a4['key']){_0x494454[_0xe2f1a4['variableName']]&&_0x30a46d[_0xe736('0x6')](util['format'](_0xe736('0x12'),_0xe2f1a4[_0xe736('0x10')],_0x494454[_0xe2f1a4[_0xe736('0x9')]]));}else if(_0xe2f1a4[_0xe736('0x13')]==='customVariable'&&_0xe2f1a4[_0xe736('0xb')]&&_0xe2f1a4['Variable'][_0xe736('0xc')]&&_0xe2f1a4[_0xe736('0x10')]){_0x494454[_0xe2f1a4['Variable']['name'][_0xe736('0xd')]()]&&_0x30a46d['push'](util[_0xe736('0x11')](_0xe736('0x12'),_0xe2f1a4[_0xe736('0x10')],_0x494454[_0xe2f1a4[_0xe736('0xb')][_0xe736('0xc')]['toLowerCase']()]));}}}}return _0x30a46d[_0xe736('0x14')](_0x462ff2);};exports['stripTrailingSlash']=function(_0x566c18){var _0x307974=_0x566c18[_0xe736('0x15')](-0x1);if(_0x307974==='/'){_0x566c18=_0x566c18[_0xe736('0x16')](0x0,_0x566c18[_0xe736('0x17')](_0x307974));}return _0x566c18;};exports[_0xe736('0x18')]=function(_0x4a7f41){if(!_['isNil'](_0x4a7f41)&&_0x4a7f41!==''){var _0x25d40c=/^(([^<>()\[\]\\.,;:\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 _0x25d40c[_0xe736('0x19')](String(_0x4a7f41)['toLowerCase']());}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 7260302..1a5698c 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 _0x4a0f=['Creating\x20new\x20ticket...','merge','Normal','Subjects','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','length','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','error','GET','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','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','trigger:browser:url','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','../../../../config/environment','vTiger','redis','localhost','socket.io-emitter','emit','forEach','type','string','idField','toString','variableName','customVariable','Variable','name','toLowerCase','info'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x4a0f,0xae));var _0xf4a0=function(_0x26d00d,_0x1221a2){_0x26d00d=_0x26d00d-0x0;var _0x130ab6=_0x4a0f[_0x26d00d];return _0x130ab6;};'use strict';var _=require(_0xf4a0('0x0'));var rp=require(_0xf4a0('0x1'));var BPromise=require(_0xf4a0('0x2'));var md5=require(_0xf4a0('0x3'));var util=require(_0xf4a0('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xf4a0('0x5'));var logger=require('../../../../config/logger')(_0xf4a0('0x6'));config[_0xf4a0('0x7')]=_['defaults'](config[_0xf4a0('0x7')],{'host':_0xf4a0('0x8'),'port':0x18eb});var io=require(_0xf4a0('0x9'))(new Redis(config[_0xf4a0('0x7')]));function emit(_0x5e2ad0,_0x457abe,_0x27042c){io['to'](_0x5e2ad0)[_0xf4a0('0xa')](_0x457abe,_0x27042c);}function getCustomFields(_0x582066,_0x48a47d){var _0x4e7f69={};if(_0x582066['length']>0x0){_[_0xf4a0('0xb')](_0x582066,function(_0x3d8c62){if(_0x3d8c62[_0xf4a0('0xc')]===_0xf4a0('0xd')&&_0x3d8c62[_0xf4a0('0xe')]){_0x4e7f69[_0x3d8c62[_0xf4a0('0xe')]]=_0x3d8c62['content'][_0xf4a0('0xf')]();}else if(_0x3d8c62[_0xf4a0('0xc')]==='variable'&&_0x3d8c62[_0xf4a0('0x10')]&&_0x3d8c62[_0xf4a0('0xe')]&&_0x48a47d[_0x3d8c62[_0xf4a0('0x10')]]){_0x4e7f69[_0x3d8c62['idField']]=_0x48a47d[_0x3d8c62[_0xf4a0('0x10')]][_0xf4a0('0xf')]();}else if(_0x3d8c62[_0xf4a0('0xc')]===_0xf4a0('0x11')&&_0x3d8c62[_0xf4a0('0x12')]&&_0x3d8c62['Variable'][_0xf4a0('0x13')]&&_0x3d8c62['idField']&&_0x48a47d[_0x3d8c62[_0xf4a0('0x12')]['name'][_0xf4a0('0x14')]()]){_0x4e7f69[_0x3d8c62[_0xf4a0('0xe')]]=_0x48a47d[_0x3d8c62[_0xf4a0('0x12')][_0xf4a0('0x13')]['toLowerCase']()]['toString']();}});}return _0x4e7f69;}function createTicket(_0x458371,_0x1bc450,_0x489bd9,_0x404f46,_0x4cefad,_0x3660c6,_0x5681bc){logger[_0xf4a0('0x15')](_0xf4a0('0x16'));var _0x43b0f7=_[_0xf4a0('0x17')]({'parent_id':'','assigned_user_id':_0x1bc450['id'],'ticketpriorities':_0xf4a0('0x18'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x404f46[_0xf4a0('0x19')],_0x4cefad,'\x20'),'description':intUtil[_0xf4a0('0x1a')](_0x404f46[_0xf4a0('0x1b')],_0x4cefad,'\x0a'),'contact_id':_0x489bd9['id']},getCustomFields(_0x3660c6,_0x4cefad));var _0x5591ca={'method':_0xf4a0('0x1c'),'uri':util[_0xf4a0('0x1d')](_0xf4a0('0x1e'),_0x458371[_0xf4a0('0x1f')]),'form':{'operation':_0xf4a0('0x20'),'username':_0x458371[_0xf4a0('0x21')],'sessionName':_0x5681bc[_0xf4a0('0x22')],'elementType':_0xf4a0('0x23'),'element':JSON[_0xf4a0('0x24')](_0x43b0f7)},'json':!![]};return request(_0x5591ca)['then'](function(_0x10da71){if(_0x10da71[_0xf4a0('0x25')]){return BPromise[_0xf4a0('0x26')]({'id':_0x10da71[_0xf4a0('0x27')]['id']});}else{throw new Error(util[_0xf4a0('0x1d')](_0xf4a0('0x28'),JSON['stringify'](_0x10da71['error'])));}})[_0xf4a0('0x29')](function(_0x1e5b55){var _0x2c9fca=_0x1e5b55[_0xf4a0('0x2a')]||0x1f4;logger['error'](_0xf4a0('0x2b'),_0xf4a0('0x2c'),_0x2c9fca,JSON[_0xf4a0('0x24')](_0x1e5b55));});}function getUser(_0x336699,_0x4c6654,_0x14b9d4){if(intUtil[_0xf4a0('0x2d')](_0x4c6654)){logger[_0xf4a0('0x15')](_0xf4a0('0x2e'),_0x4c6654);return request({'method':'GET','uri':util['format'](_0xf4a0('0x1e'),_0x336699[_0xf4a0('0x1f')]),'qs':{'operation':_0xf4a0('0x2f'),'username':_0x336699[_0xf4a0('0x21')],'sessionName':_0x14b9d4[_0xf4a0('0x22')],'query':util[_0xf4a0('0x1d')](_0xf4a0('0x30'),_0x4c6654)},'json':!![]})[_0xf4a0('0x31')](function(_0x3919c7){if(_0x3919c7[_0xf4a0('0x25')]&&_0x3919c7[_0xf4a0('0x27')][_0xf4a0('0x32')]){logger[_0xf4a0('0x15')]('Agent\x20found!');return BPromise[_0xf4a0('0x26')]({'id':_0x3919c7[_0xf4a0('0x27')][0x0]['id'],'email':_0x3919c7[_0xf4a0('0x27')][0x0]['email1'],'name':_0x3919c7[_0xf4a0('0x27')][0x0]['first_name']+'\x20'+_0x3919c7['result'][_0xf4a0('0x33')]});}else{logger['info'](_0xf4a0('0x34'));return BPromise[_0xf4a0('0x26')]({'id':_0x14b9d4[_0xf4a0('0x35')],'email':_0x336699[_0xf4a0('0x21')],'name':_0xf4a0('0x36')});}})[_0xf4a0('0x29')](function(_0x2390dc){var _0x31bd9e=_0x2390dc[_0xf4a0('0x2a')]||0x1f4;logger[_0xf4a0('0x37')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x31bd9e,JSON[_0xf4a0('0x24')](_0x2390dc));});}else{logger['info'](_0xf4a0('0x34'));return BPromise['resolve']({'id':_0x14b9d4[_0xf4a0('0x35')],'email':_0x336699['username'],'name':_0xf4a0('0x36')})['catch'](function(_0x148b37){var _0xbcb95e=_0x148b37[_0xf4a0('0x2a')]||0x1f4;logger['error'](_0xf4a0('0x2b'),'getUser',_0xbcb95e,JSON['stringify'](_0x148b37));});}}function getEndUser(_0x2c27fa,_0xb0f76e,_0x4f4a0b,_0x5d9101){logger[_0xf4a0('0x15')]('Searching\x20end\x20user\x20with\x20phone',_0x4f4a0b);return request({'method':_0xf4a0('0x38'),'uri':util['format']('%s/webservice.php',_0x2c27fa[_0xf4a0('0x1f')]),'qs':{'operation':_0xf4a0('0x2f'),'username':_0x2c27fa[_0xf4a0('0x21')],'sessionName':_0x5d9101[_0xf4a0('0x22')],'query':util[_0xf4a0('0x1d')](_0xf4a0('0x39'),_0x4f4a0b,_0x4f4a0b,_0x4f4a0b,_0x4f4a0b,_0x4f4a0b)},'json':!![]})['then'](function(_0x299026){if(_0x299026['success']&&_0x299026['result'][_0xf4a0('0x32')]){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x299026[_0xf4a0('0x27')][0x0]['id'],'name':_0x299026[_0xf4a0('0x27')][0x0][_0xf4a0('0x3a')]+'\x20'+_0x299026[_0xf4a0('0x27')][0x0][_0xf4a0('0x3b')],'phone':_0x4f4a0b});}else{logger[_0xf4a0('0x15')](_0xf4a0('0x3c'));return request({'method':_0xf4a0('0x1c'),'uri':util['format'](_0xf4a0('0x1e'),_0x2c27fa[_0xf4a0('0x1f')]),'form':{'operation':_0xf4a0('0x20'),'sessionName':_0x5d9101[_0xf4a0('0x22')],'elementType':_0xf4a0('0x3d'),'element':JSON[_0xf4a0('0x24')]({'lastname':_0xb0f76e,'phone':_0x4f4a0b,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x107d45){logger[_0xf4a0('0x15')](_0xf4a0('0x3e'));return BPromise[_0xf4a0('0x26')]({'id':_0x107d45[_0xf4a0('0x27')]['id'],'name':_0x107d45['result'][_0xf4a0('0x3b')],'phone':_0x107d45[_0xf4a0('0x27')]['phone']});})[_0xf4a0('0x29')](function(_0x1e06f2){var _0x4aa418=_0x1e06f2[_0xf4a0('0x2a')]||0x1f4;logger[_0xf4a0('0x37')](_0xf4a0('0x2b'),_0xf4a0('0x3f'),_0x4aa418,JSON['stringify'](_0x1e06f2));});}});}function getConnection(_0x1d2e28){var _0x4a5387=_0x1d2e28[_0xf4a0('0x21')];var _0x1f1a6e=_0x1d2e28[_0xf4a0('0x40')];return request({'method':_0xf4a0('0x38'),'uri':util[_0xf4a0('0x1d')](_0xf4a0('0x1e'),_0x1d2e28[_0xf4a0('0x1f')]),'qs':{'operation':_0xf4a0('0x41'),'username':_0x4a5387},'json':!![]})[_0xf4a0('0x31')](function(_0x57cafa){if(_0x57cafa['success']){return request({'method':_0xf4a0('0x1c'),'uri':util['format'](_0xf4a0('0x1e'),_0x1d2e28[_0xf4a0('0x1f')]),'form':{'operation':_0xf4a0('0x42'),'username':_0x4a5387,'accessKey':md5(_0x57cafa['result'][_0xf4a0('0x43')]+_0x1f1a6e)},'json':!![]});}})[_0xf4a0('0x31')](function(_0x52b78d){if(_0x52b78d['success']){return BPromise[_0xf4a0('0x26')](_0x52b78d[_0xf4a0('0x27')]);}else{throw new Error(util[_0xf4a0('0x1d')](_0xf4a0('0x44'),_0x1d2e28['id']));}})[_0xf4a0('0x29')](function(_0x3a708a){var _0x1a35c6=_0x3a708a[_0xf4a0('0x2a')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xf4a0('0x45'),_0x1a35c6,JSON[_0xf4a0('0x24')](_0x3a708a));});}function request(_0x434b33){logger['info']('[HTTP]',JSON[_0xf4a0('0x24')](_0x434b33));return rp(_0x434b33);}exports[_0xf4a0('0x46')]=function(_0x193ce5,_0x2152cb,_0xce0000,_0x1aa460,_0x232882,_0x249b89){var _0x202759,_0x3ebcf7,_0x58b0f0,_0x120666;_0x249b89['remoteUri']=intUtil[_0xf4a0('0x47')](_0x249b89[_0xf4a0('0x1f')]);if(_0x232882&&_0x232882[_0xf4a0('0x48')]){logger['info']('[QUEUE]',_0xf4a0('0x49'));_0x2152cb[_0xf4a0('0x4a')]=util['format'](_0xf4a0('0x4b'),_0x249b89[_0xf4a0('0x4c')],_0x2152cb['uniqueid'],md5(_0x2152cb[_0xf4a0('0x4d')]));}else{_0x2152cb[_0xf4a0('0x4a')]='';}return getConnection(_0x249b89)[_0xf4a0('0x31')](function(_0x405ebf){_0x120666=_0x405ebf;return getUser(_0x249b89,_0x1aa460[_0xf4a0('0x4e')],_0x120666);})[_0xf4a0('0x31')](function(_0x5b405f){_0x202759=_0x5b405f;logger[_0xf4a0('0x15')]('The\x20User\x20ID\x20is:',_0x202759['id']);return getEndUser(_0x249b89,_0x2152cb[_0xf4a0('0x4f')],_0x2152cb['calleridnum'],_0x120666);})['then'](function(_0x1fa9e4){_0x3ebcf7=_0x1fa9e4;logger[_0xf4a0('0x15')](_0xf4a0('0x50'),_0x3ebcf7['id']);return createTicket(_0x249b89,_0x202759,_0x3ebcf7,_0xce0000,_0x2152cb,_0xce0000['Fields'],_0x120666);})['then'](function(_0x167d13){_0x58b0f0=_0x167d13;logger[_0xf4a0('0x15')](_0xf4a0('0x51'));logger[_0xf4a0('0x15')]('The\x20Ticket\x20ID\x20is:',_0x58b0f0['id']);var _0xaf7dff=util[_0xf4a0('0x1d')](_0xf4a0('0x52'),_0x249b89[_0xf4a0('0x1f')],_['split'](_0x58b0f0['id'],'x')[0x1]);logger[_0xf4a0('0x15')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf4a0('0x1d')](_0xf4a0('0x53'),_0x1aa460[_0xf4a0('0x13')]),_0xf4a0('0x54'),{'uri':_0xaf7dff});})[_0xf4a0('0x29')](function(_0x3965c0){logger[_0xf4a0('0x37')](_0xf4a0('0x55'),JSON['stringify'](_0x3965c0));});};exports[_0xf4a0('0x56')]=function(_0x3e5c0d,_0xb75de4,_0x1b63dd,_0x52527d,_0x57e1c7,_0x28a964,_0x5811ae){var _0x595b07,_0x2c7ebb,_0x436908,_0x463b96;_0x28a964[_0xf4a0('0x1f')]=intUtil['stripTrailingSlash'](_0x28a964[_0xf4a0('0x1f')]);_0x28a964[_0xf4a0('0x4c')]=intUtil[_0xf4a0('0x47')](_0x28a964['serverUrl']);if(_0x5811ae&&_0x5811ae[_0xf4a0('0x57')]&&_0x5811ae[_0xf4a0('0x57')]!=='none'){logger[_0xf4a0('0x15')](_0xf4a0('0x58'),'Recording\x20is\x20enabled!');_0xb75de4['recordingURL']=util[_0xf4a0('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x28a964[_0xf4a0('0x4c')],_0xb75de4[_0xf4a0('0x4d')],md5(_0xb75de4[_0xf4a0('0x4d')]));}return getConnection(_0x28a964)['then'](function(_0x2c662c){_0x463b96=_0x2c662c;return getUser(_0x28a964,_0x52527d[_0xf4a0('0x4e')],_0x463b96);})[_0xf4a0('0x31')](function(_0x59fe9a){_0x595b07=_0x59fe9a;logger[_0xf4a0('0x15')](_0xf4a0('0x59'),_0x595b07['id']);return getEndUser(_0x28a964,_0xb75de4[_0xf4a0('0x5a')],_0xb75de4[_0xf4a0('0x5b')],_0x463b96);})[_0xf4a0('0x31')](function(_0x88311d){_0x2c7ebb=_0x88311d;logger[_0xf4a0('0x15')]('The\x20Enduser\x20ID\x20is:',_0x2c7ebb['id']);return createTicket(_0x28a964,_0x595b07,_0x2c7ebb,_0x1b63dd,_0xb75de4,_0x1b63dd[_0xf4a0('0x5c')],_0x463b96);})['then'](function(_0x44231b){_0x436908=_0x44231b;logger['info'](_0xf4a0('0x51'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x436908['id']);var _0x48efeb=util['format'](_0xf4a0('0x52'),_0x28a964['remoteUri'],_[_0xf4a0('0x5d')](_0x436908['id'],'x')[0x1]);logger['info'](_0xf4a0('0x58'),_0xf4a0('0x5e'));emit(util[_0xf4a0('0x1d')](_0xf4a0('0x53'),_0x52527d[_0xf4a0('0x13')]),_0xf4a0('0x54'),{'uri':_0x48efeb});})[_0xf4a0('0x29')](function(_0x455db8){logger[_0xf4a0('0x37')](_0xf4a0('0x58'),JSON['stringify'](_0x455db8));});};exports['unmanaged']=function(_0x1e9748,_0x4eea0a,_0x4f0398,_0x31e3ba,_0x31a7cc,_0x4a55d8){var _0x5c0b58,_0x380949,_0x29dde0,_0xbc9ac0;_0x4a55d8['remoteUri']=intUtil['stripTrailingSlash'](_0x4a55d8['remoteUri']);_0x4a55d8[_0xf4a0('0x4c')]=intUtil[_0xf4a0('0x47')](_0x4a55d8[_0xf4a0('0x4c')]);if(_0x31a7cc&&_0x31a7cc[_0xf4a0('0x48')]){logger['info']('['+_0x4eea0a[_0xf4a0('0x5f')][_0xf4a0('0x60')]()+']',_0xf4a0('0x49'));_0x4eea0a[_0xf4a0('0x4a')]=util[_0xf4a0('0x1d')](_0xf4a0('0x4b'),_0x4a55d8['serverUrl'],_0x4eea0a[_0xf4a0('0x4d')],md5(_0x4eea0a[_0xf4a0('0x4d')]));}else{_0x4eea0a[_0xf4a0('0x4a')]='';}return getConnection(_0x4a55d8)[_0xf4a0('0x31')](function(_0x394e22){_0xbc9ac0=_0x394e22;return getUser(_0x4a55d8,'',_0xbc9ac0);})[_0xf4a0('0x31')](function(_0x1dfe0a){_0x5c0b58=_0x1dfe0a;logger[_0xf4a0('0x15')](_0xf4a0('0x59'),_0x5c0b58['id']);return getEndUser(_0x4a55d8,_0x4eea0a['calleridname'],_0x4eea0a[_0xf4a0('0x61')],_0xbc9ac0);})[_0xf4a0('0x31')](function(_0x3297c1){_0x380949=_0x3297c1;logger[_0xf4a0('0x15')]('The\x20Enduser\x20ID\x20is:',_0x380949['id']);return createTicket(_0x4a55d8,_0x5c0b58,_0x380949,_0x4f0398,_0x4eea0a,_0x4f0398[_0xf4a0('0x5c')],_0xbc9ac0);})['then'](function(_0x310d99){_0x29dde0=_0x310d99;logger[_0xf4a0('0x15')](_0xf4a0('0x51'));logger[_0xf4a0('0x15')]('The\x20Ticket\x20ID\x20is:',_0x29dde0['id']);})['catch'](function(_0xd5d09c){logger[_0xf4a0('0x37')]('['+_0x4eea0a['lastevent'][_0xf4a0('0x60')]()+']',JSON[_0xf4a0('0x24')](_0xd5d09c));});}; \ No newline at end of file +var _0x9e2b=['Descriptions','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','getUser','Searching\x20end\x20user\x20with\x20phone','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','remoteUri','phone','getEndUser','accessKey','getchallenge','login','token','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','getString','Subjects'];(function(_0x2d3134,_0x477c10){var _0x2dd03e=function(_0x434841){while(--_0x434841){_0x2d3134['push'](_0x2d3134['shift']());}};_0x2dd03e(++_0x477c10);}(_0x9e2b,0x10e));var _0xb9e2=function(_0x2a3524,_0x32b299){_0x2a3524=_0x2a3524-0x0;var _0x4a7f45=_0x9e2b[_0x2a3524];return _0x4a7f45;};'use strict';var _=require(_0xb9e2('0x0'));var rp=require(_0xb9e2('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xb9e2('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb9e2('0x3'))(_0xb9e2('0x4'));config[_0xb9e2('0x5')]=_[_0xb9e2('0x6')](config['redis'],{'host':_0xb9e2('0x7'),'port':0x18eb});var io=require(_0xb9e2('0x8'))(new Redis(config['redis']));function emit(_0x350261,_0x3d7e80,_0x3cd3b0){io['to'](_0x350261)[_0xb9e2('0x9')](_0x3d7e80,_0x3cd3b0);}function getCustomFields(_0x1306a0,_0x35d7ba){var _0x4e0cf5={};if(_0x1306a0[_0xb9e2('0xa')]>0x0){_[_0xb9e2('0xb')](_0x1306a0,function(_0x32613a){if(_0x32613a[_0xb9e2('0xc')]==='string'&&_0x32613a['idField']){_0x4e0cf5[_0x32613a[_0xb9e2('0xd')]]=_0x32613a[_0xb9e2('0xe')][_0xb9e2('0xf')]();}else if(_0x32613a[_0xb9e2('0xc')]===_0xb9e2('0x10')&&_0x32613a['variableName']&&_0x32613a[_0xb9e2('0xd')]&&_0x35d7ba[_0x32613a[_0xb9e2('0x11')]]){_0x4e0cf5[_0x32613a[_0xb9e2('0xd')]]=_0x35d7ba[_0x32613a[_0xb9e2('0x11')]][_0xb9e2('0xf')]();}else if(_0x32613a['type']==='customVariable'&&_0x32613a[_0xb9e2('0x12')]&&_0x32613a[_0xb9e2('0x12')][_0xb9e2('0x13')]&&_0x32613a[_0xb9e2('0xd')]&&_0x35d7ba[_0x32613a[_0xb9e2('0x12')][_0xb9e2('0x13')][_0xb9e2('0x14')]()]){_0x4e0cf5[_0x32613a[_0xb9e2('0xd')]]=_0x35d7ba[_0x32613a[_0xb9e2('0x12')][_0xb9e2('0x13')][_0xb9e2('0x14')]()][_0xb9e2('0xf')]();}});}return _0x4e0cf5;}function createTicket(_0x4f4d2e,_0x374935,_0x4fb9b3,_0x261c22,_0x2d46c6,_0x528360,_0x547c26){logger[_0xb9e2('0x15')](_0xb9e2('0x16'));var _0x10db7e=_['merge']({'parent_id':'','assigned_user_id':_0x374935['id'],'ticketpriorities':_0xb9e2('0x17'),'ticketstatus':_0xb9e2('0x18'),'ticket_title':intUtil[_0xb9e2('0x19')](_0x261c22[_0xb9e2('0x1a')],_0x2d46c6,'\x20'),'description':intUtil['getString'](_0x261c22[_0xb9e2('0x1b')],_0x2d46c6,'\x0a'),'contact_id':_0x4fb9b3['id']},getCustomFields(_0x528360,_0x2d46c6));var _0x2f3bc0={'method':'POST','uri':util[_0xb9e2('0x1c')](_0xb9e2('0x1d'),_0x4f4d2e['remoteUri']),'form':{'operation':_0xb9e2('0x1e'),'username':_0x4f4d2e[_0xb9e2('0x1f')],'sessionName':_0x547c26[_0xb9e2('0x20')],'elementType':_0xb9e2('0x21'),'element':JSON[_0xb9e2('0x22')](_0x10db7e)},'json':!![]};return request(_0x2f3bc0)[_0xb9e2('0x23')](function(_0x14db00){if(_0x14db00[_0xb9e2('0x24')]){return BPromise[_0xb9e2('0x25')]({'id':_0x14db00[_0xb9e2('0x26')]['id']});}else{throw new Error(util[_0xb9e2('0x1c')](_0xb9e2('0x27'),JSON[_0xb9e2('0x22')](_0x14db00['error'])));}})[_0xb9e2('0x28')](function(_0x5d5c54){var _0x5016c3=_0x5d5c54[_0xb9e2('0x29')]||0x1f4;logger[_0xb9e2('0x2a')](_0xb9e2('0x2b'),_0xb9e2('0x2c'),_0x5016c3,JSON['stringify'](_0x5d5c54));});}function getUser(_0x4eaff2,_0x2b98db,_0x3a7655){if(intUtil[_0xb9e2('0x2d')](_0x2b98db)){logger[_0xb9e2('0x15')](_0xb9e2('0x2e'),_0x2b98db);return request({'method':_0xb9e2('0x2f'),'uri':util['format'](_0xb9e2('0x1d'),_0x4eaff2['remoteUri']),'qs':{'operation':_0xb9e2('0x30'),'username':_0x4eaff2[_0xb9e2('0x1f')],'sessionName':_0x3a7655['sessionName'],'query':util['format'](_0xb9e2('0x31'),_0x2b98db)},'json':!![]})[_0xb9e2('0x23')](function(_0x2e0663){if(_0x2e0663[_0xb9e2('0x24')]&&_0x2e0663['result'][_0xb9e2('0xa')]){logger[_0xb9e2('0x15')](_0xb9e2('0x32'));return BPromise['resolve']({'id':_0x2e0663[_0xb9e2('0x26')][0x0]['id'],'email':_0x2e0663[_0xb9e2('0x26')][0x0][_0xb9e2('0x33')],'name':_0x2e0663[_0xb9e2('0x26')][0x0][_0xb9e2('0x34')]+'\x20'+_0x2e0663[_0xb9e2('0x26')]['last_name']});}else{logger[_0xb9e2('0x15')](_0xb9e2('0x35'));return BPromise[_0xb9e2('0x25')]({'id':_0x3a7655['userId'],'email':_0x4eaff2[_0xb9e2('0x1f')],'name':_0xb9e2('0x36')});}})[_0xb9e2('0x28')](function(_0x22a3a3){var _0x291826=_0x22a3a3['statusCode']||0x1f4;logger[_0xb9e2('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xb9e2('0x37'),_0x291826,JSON[_0xb9e2('0x22')](_0x22a3a3));});}else{logger[_0xb9e2('0x15')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb9e2('0x25')]({'id':_0x3a7655['userId'],'email':_0x4eaff2[_0xb9e2('0x1f')],'name':_0xb9e2('0x36')})[_0xb9e2('0x28')](function(_0x1a949b){var _0x2f79aa=_0x1a949b[_0xb9e2('0x29')]||0x1f4;logger[_0xb9e2('0x2a')](_0xb9e2('0x2b'),_0xb9e2('0x37'),_0x2f79aa,JSON[_0xb9e2('0x22')](_0x1a949b));});}}function getEndUser(_0x28e11e,_0x3633a6,_0x5a92b1,_0xeb55af){logger['info'](_0xb9e2('0x38'),_0x5a92b1);return request({'method':'GET','uri':util['format'](_0xb9e2('0x1d'),_0x28e11e['remoteUri']),'qs':{'operation':'query','username':_0x28e11e[_0xb9e2('0x1f')],'sessionName':_0xeb55af['sessionName'],'query':util['format']('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x5a92b1,_0x5a92b1,_0x5a92b1,_0x5a92b1,_0x5a92b1)},'json':!![]})['then'](function(_0x4549c4){if(_0x4549c4[_0xb9e2('0x24')]&&_0x4549c4[_0xb9e2('0x26')][_0xb9e2('0xa')]){logger[_0xb9e2('0x15')](_0xb9e2('0x39'));return BPromise['resolve']({'id':_0x4549c4[_0xb9e2('0x26')][0x0]['id'],'name':_0x4549c4[_0xb9e2('0x26')][0x0][_0xb9e2('0x3a')]+'\x20'+_0x4549c4[_0xb9e2('0x26')][0x0][_0xb9e2('0x3b')],'phone':_0x5a92b1});}else{logger[_0xb9e2('0x15')](_0xb9e2('0x3c'));return request({'method':_0xb9e2('0x3d'),'uri':util['format'](_0xb9e2('0x1d'),_0x28e11e[_0xb9e2('0x3e')]),'form':{'operation':_0xb9e2('0x1e'),'sessionName':_0xeb55af[_0xb9e2('0x20')],'elementType':'Contacts','element':JSON[_0xb9e2('0x22')]({'lastname':_0x3633a6,'phone':_0x5a92b1,'assigned_user_id':'\x20'})},'json':!![]})[_0xb9e2('0x23')](function(_0x1cda77){logger[_0xb9e2('0x15')]('Enduser\x20created.');return BPromise[_0xb9e2('0x25')]({'id':_0x1cda77['result']['id'],'name':_0x1cda77[_0xb9e2('0x26')][_0xb9e2('0x3b')],'phone':_0x1cda77[_0xb9e2('0x26')][_0xb9e2('0x3f')]});})['catch'](function(_0x4d088b){var _0x507996=_0x4d088b[_0xb9e2('0x29')]||0x1f4;logger[_0xb9e2('0x2a')](_0xb9e2('0x2b'),_0xb9e2('0x40'),_0x507996,JSON[_0xb9e2('0x22')](_0x4d088b));});}});}function getConnection(_0x705742){var _0x4a2bcf=_0x705742[_0xb9e2('0x1f')];var _0x107a31=_0x705742[_0xb9e2('0x41')];return request({'method':_0xb9e2('0x2f'),'uri':util[_0xb9e2('0x1c')]('%s/webservice.php',_0x705742[_0xb9e2('0x3e')]),'qs':{'operation':_0xb9e2('0x42'),'username':_0x4a2bcf},'json':!![]})['then'](function(_0x483c1c){if(_0x483c1c[_0xb9e2('0x24')]){return request({'method':_0xb9e2('0x3d'),'uri':util[_0xb9e2('0x1c')](_0xb9e2('0x1d'),_0x705742[_0xb9e2('0x3e')]),'form':{'operation':_0xb9e2('0x43'),'username':_0x4a2bcf,'accessKey':md5(_0x483c1c['result'][_0xb9e2('0x44')]+_0x107a31)},'json':!![]});}})['then'](function(_0x125e90){if(_0x125e90[_0xb9e2('0x24')]){return BPromise[_0xb9e2('0x25')](_0x125e90[_0xb9e2('0x26')]);}else{throw new Error(util[_0xb9e2('0x1c')]('Account\x20%d\x20is\x20not\x20valid',_0x705742['id']));}})[_0xb9e2('0x28')](function(_0x585ec0){var _0x26f820=_0x585ec0['statusCode']||0x1f4;logger[_0xb9e2('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x26f820,JSON[_0xb9e2('0x22')](_0x585ec0));});}function request(_0x5c7021){logger[_0xb9e2('0x15')]('[HTTP]',JSON['stringify'](_0x5c7021));return rp(_0x5c7021);}exports[_0xb9e2('0x45')]=function(_0x38eeb2,_0x18e0e1,_0x1ac65e,_0x55e7d4,_0x5d2942,_0x1ac97a){var _0xfe6bd3,_0x145961,_0x3642c8,_0x590b40;_0x1ac97a['remoteUri']=intUtil[_0xb9e2('0x46')](_0x1ac97a[_0xb9e2('0x3e')]);if(_0x5d2942&&_0x5d2942['monitor_format']){logger[_0xb9e2('0x15')](_0xb9e2('0x47'),_0xb9e2('0x48'));_0x18e0e1[_0xb9e2('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ac97a[_0xb9e2('0x4a')],_0x18e0e1[_0xb9e2('0x4b')],md5(_0x18e0e1[_0xb9e2('0x4b')]));}else{_0x18e0e1['recordingURL']='';}return getConnection(_0x1ac97a)[_0xb9e2('0x23')](function(_0x40e1b3){_0x590b40=_0x40e1b3;return getUser(_0x1ac97a,_0x55e7d4['email'],_0x590b40);})[_0xb9e2('0x23')](function(_0x18ea3e){_0xfe6bd3=_0x18ea3e;logger['info'](_0xb9e2('0x4c'),_0xfe6bd3['id']);return getEndUser(_0x1ac97a,_0x18e0e1[_0xb9e2('0x4d')],_0x18e0e1[_0xb9e2('0x4e')],_0x590b40);})[_0xb9e2('0x23')](function(_0x3f0fdd){_0x145961=_0x3f0fdd;logger[_0xb9e2('0x15')](_0xb9e2('0x4f'),_0x145961['id']);return createTicket(_0x1ac97a,_0xfe6bd3,_0x145961,_0x1ac65e,_0x18e0e1,_0x1ac65e['Fields'],_0x590b40);})['then'](function(_0x2d8163){_0x3642c8=_0x2d8163;logger[_0xb9e2('0x15')]('Ticket\x20created!');logger[_0xb9e2('0x15')](_0xb9e2('0x50'),_0x3642c8['id']);var _0x1c3281=util[_0xb9e2('0x1c')](_0xb9e2('0x51'),_0x1ac97a[_0xb9e2('0x3e')],_[_0xb9e2('0x52')](_0x3642c8['id'],'x')[0x1]);logger[_0xb9e2('0x15')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb9e2('0x1c')](_0xb9e2('0x53'),_0x55e7d4[_0xb9e2('0x13')]),_0xb9e2('0x54'),{'uri':_0x1c3281});})[_0xb9e2('0x28')](function(_0x51fe44){logger[_0xb9e2('0x2a')](_0xb9e2('0x47'),JSON[_0xb9e2('0x22')](_0x51fe44));});};exports[_0xb9e2('0x55')]=function(_0x42db72,_0x275de5,_0x2f35b1,_0x2a548b,_0x4b46d3,_0x1b580c,_0x13ebb5){var _0x4f464d,_0x1458fb,_0x780589,_0x45fbb8;_0x1b580c['remoteUri']=intUtil[_0xb9e2('0x46')](_0x1b580c[_0xb9e2('0x3e')]);_0x1b580c[_0xb9e2('0x4a')]=intUtil['stripTrailingSlash'](_0x1b580c[_0xb9e2('0x4a')]);if(_0x13ebb5&&_0x13ebb5[_0xb9e2('0x56')]&&_0x13ebb5[_0xb9e2('0x56')]!==_0xb9e2('0x57')){logger[_0xb9e2('0x15')](_0xb9e2('0x58'),_0xb9e2('0x48'));_0x275de5['recordingURL']=util[_0xb9e2('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b580c[_0xb9e2('0x4a')],_0x275de5[_0xb9e2('0x4b')],md5(_0x275de5[_0xb9e2('0x4b')]));}return getConnection(_0x1b580c)[_0xb9e2('0x23')](function(_0x546ebc){_0x45fbb8=_0x546ebc;return getUser(_0x1b580c,_0x2a548b[_0xb9e2('0x59')],_0x45fbb8);})['then'](function(_0x451a5c){_0x4f464d=_0x451a5c;logger[_0xb9e2('0x15')](_0xb9e2('0x4c'),_0x4f464d['id']);return getEndUser(_0x1b580c,_0x275de5[_0xb9e2('0x5a')],_0x275de5[_0xb9e2('0x5b')],_0x45fbb8);})[_0xb9e2('0x23')](function(_0xac31aa){_0x1458fb=_0xac31aa;logger[_0xb9e2('0x15')](_0xb9e2('0x4f'),_0x1458fb['id']);return createTicket(_0x1b580c,_0x4f464d,_0x1458fb,_0x2f35b1,_0x275de5,_0x2f35b1[_0xb9e2('0x5c')],_0x45fbb8);})[_0xb9e2('0x23')](function(_0x593b12){_0x780589=_0x593b12;logger['info'](_0xb9e2('0x5d'));logger[_0xb9e2('0x15')](_0xb9e2('0x50'),_0x780589['id']);var _0x11566c=util['format'](_0xb9e2('0x51'),_0x1b580c['remoteUri'],_[_0xb9e2('0x52')](_0x780589['id'],'x')[0x1]);logger[_0xb9e2('0x15')](_0xb9e2('0x58'),_0xb9e2('0x5e'));emit(util[_0xb9e2('0x1c')](_0xb9e2('0x53'),_0x2a548b['name']),_0xb9e2('0x54'),{'uri':_0x11566c});})[_0xb9e2('0x28')](function(_0x20dc82){logger[_0xb9e2('0x2a')](_0xb9e2('0x58'),JSON[_0xb9e2('0x22')](_0x20dc82));});};exports[_0xb9e2('0x5f')]=function(_0x5091e2,_0x167427,_0x3392d4,_0x5e2dd3,_0x36df78,_0xfca34){var _0x40bf55,_0x59eb06,_0x57b2be,_0x2e90c6;_0xfca34[_0xb9e2('0x3e')]=intUtil[_0xb9e2('0x46')](_0xfca34[_0xb9e2('0x3e')]);_0xfca34['serverUrl']=intUtil[_0xb9e2('0x46')](_0xfca34[_0xb9e2('0x4a')]);if(_0x36df78&&_0x36df78['monitor_format']){logger[_0xb9e2('0x15')]('['+_0x167427[_0xb9e2('0x60')][_0xb9e2('0x61')]()+']',_0xb9e2('0x48'));_0x167427[_0xb9e2('0x49')]=util[_0xb9e2('0x1c')](_0xb9e2('0x62'),_0xfca34[_0xb9e2('0x4a')],_0x167427[_0xb9e2('0x4b')],md5(_0x167427['uniqueid']));}else{_0x167427[_0xb9e2('0x49')]='';}return getConnection(_0xfca34)[_0xb9e2('0x23')](function(_0x1a80cd){_0x2e90c6=_0x1a80cd;return getUser(_0xfca34,'',_0x2e90c6);})[_0xb9e2('0x23')](function(_0x5b38d7){_0x40bf55=_0x5b38d7;logger['info'](_0xb9e2('0x4c'),_0x40bf55['id']);return getEndUser(_0xfca34,_0x167427['calleridname'],_0x167427[_0xb9e2('0x4e')],_0x2e90c6);})[_0xb9e2('0x23')](function(_0xa9fb75){_0x59eb06=_0xa9fb75;logger['info'](_0xb9e2('0x4f'),_0x59eb06['id']);return createTicket(_0xfca34,_0x40bf55,_0x59eb06,_0x3392d4,_0x167427,_0x3392d4[_0xb9e2('0x5c')],_0x2e90c6);})[_0xb9e2('0x23')](function(_0x2ffe72){_0x57b2be=_0x2ffe72;logger[_0xb9e2('0x15')]('Ticket\x20created!');logger[_0xb9e2('0x15')](_0xb9e2('0x50'),_0x57b2be['id']);})['catch'](function(_0xa8ffee){logger[_0xb9e2('0x2a')]('['+_0x167427['lastevent']['toUpperCase']()+']',JSON['stringify'](_0xa8ffee));});}; \ 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 4fbfd9a..68c207c 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 _0x6790=['find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','toString','debug','GET','forEach','type','string','nameField','toLowerCase','content','idField','customField','custom_fields','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','merge','Tags','name','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!'];(function(_0x7c6db1,_0x391719){var _0x49e9a0=function(_0x56196e){while(--_0x56196e){_0x7c6db1['push'](_0x7c6db1['shift']());}};_0x49e9a0(++_0x391719);}(_0x6790,0xba));var _0x0679=function(_0x4ede5e,_0x235377){_0x4ede5e=_0x4ede5e-0x0;var _0x599aaa=_0x6790[_0x4ede5e];return _0x599aaa;};'use strict';var _=require(_0x0679('0x0'));var rp=require(_0x0679('0x1'));var md5=require('md5');var util=require(_0x0679('0x2'));var Redis=require(_0x0679('0x3'));var intUtil=require(_0x0679('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0679('0x5'))('zendesk');config['redis']=_[_0x0679('0x6')](config[_0x0679('0x7')],{'host':_0x0679('0x8'),'port':0x18eb});var io=require(_0x0679('0x9'))(new Redis(config[_0x0679('0x7')]));function emit(_0x199390,_0x34027c,_0x20e228){io['to'](_0x199390)[_0x0679('0xa')](_0x34027c,_0x20e228);}var headers={'Content-Type':_0x0679('0xb'),'Accept':_0x0679('0xb')};function getTicket(_0x102f9d,_0x45432b,_0x23a545,_0x27b598,_0x1ff51b){logger[_0x0679('0xc')](_0x0679('0xd'));return request({'uri':util['format']('%s/tickets.json',_0x102f9d[_0x0679('0xe')]),'method':_0x0679('0xf'),'body':{'ticket':_[_0x0679('0x10')]({'requester_id':_0x23a545['id'],'submitter_id':_0x45432b?_0x45432b['id']:undefined,'assignee_id':_0x45432b?_0x45432b['id']:undefined,'tags':getTags(_0x27b598[_0x0679('0x11')],_0x0679('0x12')),'subject':intUtil[_0x0679('0x13')](_0x27b598['Subjects'],_0x1ff51b,'\x20'),'description':intUtil['getString'](_0x27b598['Descriptions'],_0x1ff51b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0679('0x13')](_0x27b598[_0x0679('0x14')],_0x1ff51b,'\x0a')}},getCustomFields(_0x27b598['Fields'],_0x1ff51b))}})[_0x0679('0x15')](function(_0x48b6e3){logger[_0x0679('0xc')](_0x0679('0x16'));return _0x48b6e3[_0x0679('0x17')];});}function getUser(_0x4938b4,_0x5986ce){if(intUtil[_0x0679('0x18')](_0x5986ce)){logger[_0x0679('0xc')](_0x0679('0x19'),_0x5986ce);return request({'uri':util[_0x0679('0x1a')]('%s/search.json',_0x4938b4[_0x0679('0xe')]),'qs':{'query':util[_0x0679('0x1a')](_0x0679('0x1b'),_0x5986ce)}})['then'](function(_0x14ddda){if(_0x14ddda[_0x0679('0x1c')]){logger[_0x0679('0xc')](_0x0679('0x1d'));return _[_0x0679('0x1e')](_0x14ddda['results'],{'email':_0x5986ce,'role':_0x0679('0x1f')});}else{logger[_0x0679('0xc')](_0x0679('0x20'));return request({'uri':util['format'](_0x0679('0x21'),_0x4938b4['remoteUri'])})[_0x0679('0x15')](function(_0x826a9a){logger[_0x0679('0xc')]('Admin\x20account\x20selected.');return _0x826a9a[_0x0679('0x22')];});}});}else{logger[_0x0679('0xc')](_0x0679('0x20'));return request({'uri':util[_0x0679('0x1a')](_0x0679('0x21'),_0x4938b4['remoteUri'])})[_0x0679('0x15')](function(_0x518c91){logger[_0x0679('0xc')](_0x0679('0x23'));return _0x518c91[_0x0679('0x22')];});}}function getEndUser(_0x5d2525,_0x1af34f,_0xc80fed){logger[_0x0679('0xc')](_0x0679('0x24'),_0xc80fed);return request({'uri':util['format'](_0x0679('0x25'),_0x5d2525[_0x0679('0xe')]),'qs':{'query':util[_0x0679('0x1a')](_0x0679('0x26'),_0xc80fed)}})[_0x0679('0x15')](function(_0x4d4244){var _0x245a99;if(_0x4d4244[_0x0679('0x27')][_0x0679('0x28')]){_0x4d4244[_0x0679('0x27')]=_[_0x0679('0x29')](_0x4d4244[_0x0679('0x27')],{'suspended':![],'role':'end-user'});if(_0x4d4244[_0x0679('0x27')][_0x0679('0x28')]){_0x245a99=_['first'](_0x4d4244[_0x0679('0x27')]);}}if(_0x245a99){logger[_0x0679('0xc')](_0x0679('0x2a'));return _0x245a99;}else{logger[_0x0679('0xc')](_0x0679('0x2b'));return request({'uri':util[_0x0679('0x1a')](_0x0679('0x2c'),_0x5d2525['remoteUri']),'method':_0x0679('0xf'),'body':{'user':{'role':_0x0679('0x2d'),'name':util[_0x0679('0x1a')](_0x0679('0x2e'),_0x1af34f||_0xc80fed),'phone':_0xc80fed}}})[_0x0679('0x15')](function(_0x38db3a){logger[_0x0679('0xc')](_0x0679('0x2f'));return _0x38db3a[_0x0679('0x22')];});}});}function getAuth(_0x5e6760){var _0x24eafe;if(_0x5e6760[_0x0679('0x30')]===_0x0679('0x31')){_0x24eafe=util[_0x0679('0x1a')](_0x0679('0x32'),_0x5e6760['username'],_0x5e6760[_0x0679('0x31')]);}else if(_0x5e6760['authType']===_0x0679('0x33')){_0x24eafe=util[_0x0679('0x1a')](_0x0679('0x34'),_0x5e6760[_0x0679('0x35')],_0x5e6760[_0x0679('0x33')]);}return util[_0x0679('0x1a')]('Basic\x20%s',new Buffer(_0x24eafe)[_0x0679('0x36')]('base64'));}function request(_0x4d109f){logger[_0x0679('0x37')]('[HTTP]',JSON['stringify'](_0x4d109f));return rp(_[_0x0679('0x6')](_0x4d109f,{'method':_0x0679('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x3a4560,_0x28210e){var _0x116ad8=[];if(_0x3a4560&&_0x3a4560[_0x0679('0x28')]>0x0){_0x116ad8=_['map'](_0x3a4560,_0x28210e);}return _0x116ad8;}function getCustomFields(_0x35f1dd,_0x3d2d7c){var _0x3ee70a=[];var _0x53105e={'custom_fields':[]};if(_0x35f1dd[_0x0679('0x28')]>0x0){_[_0x0679('0x39')](_0x35f1dd,function(_0x53780b){if(_0x53780b[_0x0679('0x3a')]===_0x0679('0x3b')&&_0x53780b[_0x0679('0x3c')]&&!_0x53780b['customField']){_0x53105e[_0x53780b[_0x0679('0x3c')][_0x0679('0x3d')]()]=_0x53780b[_0x0679('0x3e')]['toString']();}else if(_0x53780b[_0x0679('0x3a')]===_0x0679('0x3b')&&_0x53780b[_0x0679('0x3f')]&&_0x53780b[_0x0679('0x40')]){_0x53105e[_0x0679('0x41')]['push']({'id':_0x53780b[_0x0679('0x3f')],'value':_0x53780b[_0x0679('0x3e')][_0x0679('0x36')]()});}else if(_0x53780b[_0x0679('0x3a')]==='variable'&&_0x53780b['variableName']&&_0x53780b[_0x0679('0x3f')]&&_0x53780b['customField']){_0x3d2d7c[_0x53780b[_0x0679('0x42')]]&&_0x53105e[_0x0679('0x41')]['push']({'id':_0x53780b['idField'],'value':_0x3d2d7c[_0x53780b['variableName']][_0x0679('0x36')]()});}else if(_0x53780b[_0x0679('0x3a')]===_0x0679('0x43')&&_0x53780b[_0x0679('0x44')]&&_0x53780b[_0x0679('0x44')][_0x0679('0x12')]&&_0x53780b[_0x0679('0x3f')]&&_0x53780b[_0x0679('0x40')]){_0x3d2d7c[_0x53780b[_0x0679('0x44')]['name']['toLowerCase']()]&&_0x53105e['custom_fields'][_0x0679('0x45')]({'id':_0x53780b[_0x0679('0x3f')],'value':_0x3d2d7c[_0x53780b['Variable'][_0x0679('0x12')][_0x0679('0x3d')]()]['toString']()});}});}return _0x53105e;}exports[_0x0679('0x46')]=function(_0x3acd46,_0x1925e0,_0x7e4a31,_0x3c7213,_0x43f9bf,_0x32c08b){var _0x8de0a1,_0x93252b;_0x32c08b[_0x0679('0xe')]=intUtil[_0x0679('0x47')](_0x32c08b[_0x0679('0xe')]);_0x32c08b['serverUrl']=intUtil[_0x0679('0x47')](_0x32c08b[_0x0679('0x48')]);if(_0x43f9bf&&_0x43f9bf['monitor_format']){logger[_0x0679('0xc')](_0x0679('0x49'),_0x0679('0x4a'));_0x1925e0[_0x0679('0x4b')]=util[_0x0679('0x1a')](_0x0679('0x4c'),_0x32c08b['serverUrl'],_0x1925e0[_0x0679('0x4d')],md5(_0x1925e0[_0x0679('0x4d')]));}else{_0x1925e0[_0x0679('0x4b')]='';}headers['Authorization']=getAuth(_0x32c08b);return getUser(_0x32c08b,_0x3c7213[_0x0679('0x4e')])[_0x0679('0x15')](function(_0x14f52d){_0x8de0a1=_0x14f52d;logger[_0x0679('0xc')](_0x0679('0x4f'),_0x8de0a1['id']);return getEndUser(_0x32c08b,_0x1925e0['calleridname'],_0x1925e0['calleridnum']);})[_0x0679('0x15')](function(_0x25550b){_0x93252b=_0x25550b;logger[_0x0679('0xc')](_0x0679('0x50'),_0x93252b['id']);return getTicket(_0x32c08b,_0x8de0a1,_0x93252b,_0x7e4a31,_0x1925e0);})[_0x0679('0x15')](function(_0x14000c){if(_0x14000c){logger[_0x0679('0xc')]('The\x20Ticket\x20ID\x20is:',_0x14000c['id']);switch(_0x32c08b[_0x0679('0x3a')]){case _0x0679('0x51'):logger[_0x0679('0xc')](_0x0679('0x49'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0679('0x1a')](_0x0679('0x52'),_0x32c08b[_0x0679('0xe')],_0x8de0a1['id'],_0x14000c['id']),'method':_0x0679('0xf')});case _0x0679('0x53'):logger[_0x0679('0xc')](_0x0679('0x49'),_0x0679('0x54'));emit(util[_0x0679('0x1a')](_0x0679('0x55'),_0x3c7213[_0x0679('0x12')]),_0x0679('0x56'),{'uri':util[_0x0679('0x1a')](_0x0679('0x57'),_0x32c08b[_0x0679('0xe')][_0x0679('0x58')](_0x0679('0x59'),''),_0x14000c['id'])});break;default:logger[_0x0679('0x5a')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0679('0x5b')](function(_0x2c824d){logger['error'](_0x0679('0x5c'),util[_0x0679('0x5d')](_0x2c824d,{'showHidden':!![],'depth':null}));});};exports[_0x0679('0x5e')]=function(_0x130a30,_0x55a352,_0x5a250a,_0xb6a10f,_0x40daf1,_0x7f47a5,_0x1b8655){var _0x1a5fd2,_0x4c0656;_0x7f47a5[_0x0679('0xe')]=intUtil['stripTrailingSlash'](_0x7f47a5[_0x0679('0xe')]);_0x7f47a5[_0x0679('0x48')]=intUtil[_0x0679('0x47')](_0x7f47a5[_0x0679('0x48')]);if(_0x1b8655&&_0x1b8655[_0x0679('0x5f')]&&_0x1b8655['recordingFormat']!==_0x0679('0x60')){logger[_0x0679('0xc')]('[OUTBOUND]',_0x0679('0x4a'));_0x55a352[_0x0679('0x4b')]=util[_0x0679('0x1a')](_0x0679('0x4c'),_0x7f47a5['serverUrl'],_0x55a352[_0x0679('0x4d')],md5(_0x55a352[_0x0679('0x4d')]));}headers[_0x0679('0x61')]=getAuth(_0x7f47a5);return getUser(_0x7f47a5,_0xb6a10f[_0x0679('0x4e')])[_0x0679('0x15')](function(_0x281b7e){_0x1a5fd2=_0x281b7e;logger[_0x0679('0xc')]('The\x20User\x20ID\x20is:',_0x1a5fd2['id']);return getEndUser(_0x7f47a5,_0x55a352['destcalleridname'],_0x55a352[_0x0679('0x62')]);})[_0x0679('0x15')](function(_0x715315){_0x4c0656=_0x715315;logger[_0x0679('0xc')](_0x0679('0x50'),_0x4c0656['id']);return getTicket(_0x7f47a5,_0x1a5fd2,_0x4c0656,_0x5a250a,_0x55a352);})[_0x0679('0x15')](function(_0x42f937){if(_0x42f937){logger[_0x0679('0xc')](_0x0679('0x63'),_0x42f937['id']);switch(_0x7f47a5[_0x0679('0x3a')]){case _0x0679('0x51'):logger['info'](_0x0679('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0679('0x1a')](_0x0679('0x52'),_0x7f47a5[_0x0679('0xe')],_0x1a5fd2['id'],_0x42f937['id']),'method':_0x0679('0xf')});case _0x0679('0x53'):logger['info']('[OUTBOUND]',_0x0679('0x54'));emit(util[_0x0679('0x1a')](_0x0679('0x55'),_0xb6a10f[_0x0679('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x0679('0x57'),_0x7f47a5[_0x0679('0xe')]['replace'](_0x0679('0x59'),''),_0x42f937['id'])});break;default:logger['error']('[OUTBOUND]',_0x0679('0x65'));}}})['catch'](function(_0x5a5161){logger[_0x0679('0x5a')](_0x0679('0x66'),util[_0x0679('0x5d')](_0x5a5161,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xbb4e3e,_0x3bb67b,_0x504c2f,_0x22149b,_0x26b99d,_0x2e3504){var _0x8a63c0,_0x4f486f;_0x2e3504[_0x0679('0xe')]=intUtil[_0x0679('0x47')](_0x2e3504[_0x0679('0xe')]);_0x2e3504[_0x0679('0x48')]=intUtil[_0x0679('0x47')](_0x2e3504[_0x0679('0x48')]);if(_0x26b99d&&_0x26b99d[_0x0679('0x67')]){logger[_0x0679('0xc')]('['+_0x3bb67b[_0x0679('0x68')]['toUpperCase']()+']',_0x0679('0x4a'));_0x3bb67b[_0x0679('0x4b')]=util[_0x0679('0x1a')](_0x0679('0x4c'),_0x2e3504['serverUrl'],_0x3bb67b[_0x0679('0x4d')],md5(_0x3bb67b[_0x0679('0x4d')]));}else{_0x3bb67b[_0x0679('0x4b')]='';}headers[_0x0679('0x61')]=getAuth(_0x2e3504);return getUser(_0x2e3504)[_0x0679('0x15')](function(_0x237e03){_0x8a63c0=_0x237e03;logger[_0x0679('0xc')]('The\x20User\x20ID\x20is:',_0x8a63c0['id']);return getEndUser(_0x2e3504,_0x3bb67b['calleridname'],_0x3bb67b[_0x0679('0x69')]);})[_0x0679('0x15')](function(_0x2ec2e8){_0x4f486f=_0x2ec2e8;logger[_0x0679('0xc')](_0x0679('0x50'),_0x4f486f['id']);return getTicket(_0x2e3504,_0x8a63c0,_0x4f486f,_0x504c2f,_0x3bb67b);})[_0x0679('0x15')](function(_0x2bb3ee){if(_0x2bb3ee){logger[_0x0679('0xc')](_0x0679('0x63'),_0x2bb3ee['id']);}})[_0x0679('0x5b')](function(_0x581455){logger[_0x0679('0x5a')]('['+_0x3bb67b[_0x0679('0x68')][_0x0679('0x6a')]()+']'+_0x0679('0x6b'),util[_0x0679('0x5d')](_0x581455,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd245=['./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','[HTTP]','stringify','GET','map','forEach','string','nameField','customField','content','type','idField','variable','variableName','custom_fields','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis'];(function(_0x9089a8,_0x104a53){var _0x2d9574=function(_0x4a44c0){while(--_0x4a44c0){_0x9089a8['push'](_0x9089a8['shift']());}};_0x2d9574(++_0x104a53);}(_0xd245,0x14d));var _0x5d24=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0xd245[_0x53ad58];return _0x554b03;};'use strict';var _=require('lodash');var rp=require(_0x5d24('0x0'));var md5=require(_0x5d24('0x1'));var util=require('util');var Redis=require(_0x5d24('0x2'));var intUtil=require(_0x5d24('0x3'));var config=require(_0x5d24('0x4'));var logger=require(_0x5d24('0x5'))(_0x5d24('0x6'));config[_0x5d24('0x7')]=_['defaults'](config[_0x5d24('0x7')],{'host':_0x5d24('0x8'),'port':0x18eb});var io=require(_0x5d24('0x9'))(new Redis(config[_0x5d24('0x7')]));function emit(_0x184701,_0x22da23,_0x780d55){io['to'](_0x184701)[_0x5d24('0xa')](_0x22da23,_0x780d55);}var headers={'Content-Type':'application/json','Accept':_0x5d24('0xb')};function getTicket(_0x582beb,_0x613959,_0xdf32b7,_0x228bd5,_0x5aaf3f){logger[_0x5d24('0xc')](_0x5d24('0xd'));return request({'uri':util[_0x5d24('0xe')](_0x5d24('0xf'),_0x582beb[_0x5d24('0x10')]),'method':_0x5d24('0x11'),'body':{'ticket':_[_0x5d24('0x12')]({'requester_id':_0xdf32b7['id'],'submitter_id':_0x613959?_0x613959['id']:undefined,'assignee_id':_0x613959?_0x613959['id']:undefined,'tags':getTags(_0x228bd5[_0x5d24('0x13')],_0x5d24('0x14')),'subject':intUtil[_0x5d24('0x15')](_0x228bd5[_0x5d24('0x16')],_0x5aaf3f,'\x20'),'description':intUtil['getString'](_0x228bd5[_0x5d24('0x17')],_0x5aaf3f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5d24('0x15')](_0x228bd5[_0x5d24('0x17')],_0x5aaf3f,'\x0a')}},getCustomFields(_0x228bd5[_0x5d24('0x18')],_0x5aaf3f))}})['then'](function(_0x32c9d7){logger[_0x5d24('0xc')](_0x5d24('0x19'));return _0x32c9d7['ticket'];});}function getUser(_0x276073,_0x341f2a){if(intUtil[_0x5d24('0x1a')](_0x341f2a)){logger[_0x5d24('0xc')](_0x5d24('0x1b'),_0x341f2a);return request({'uri':util['format'](_0x5d24('0x1c'),_0x276073[_0x5d24('0x10')]),'qs':{'query':util[_0x5d24('0xe')]('type:user\x20role:agent\x20email:%s',_0x341f2a)}})[_0x5d24('0x1d')](function(_0x1f2f2f){if(_0x1f2f2f[_0x5d24('0x1e')]){logger[_0x5d24('0xc')](_0x5d24('0x1f'));return _[_0x5d24('0x20')](_0x1f2f2f[_0x5d24('0x21')],{'email':_0x341f2a,'role':_0x5d24('0x22')});}else{logger[_0x5d24('0xc')](_0x5d24('0x23'));return request({'uri':util[_0x5d24('0xe')](_0x5d24('0x24'),_0x276073[_0x5d24('0x10')])})[_0x5d24('0x1d')](function(_0x19b573){logger['info'](_0x5d24('0x25'));return _0x19b573[_0x5d24('0x26')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5d24('0xe')](_0x5d24('0x24'),_0x276073[_0x5d24('0x10')])})['then'](function(_0x54f84b){logger[_0x5d24('0xc')](_0x5d24('0x25'));return _0x54f84b[_0x5d24('0x26')];});}}function getEndUser(_0x26bceb,_0x582b36,_0xe74330){logger[_0x5d24('0xc')]('Searching\x20enduser\x20with\x20phone',_0xe74330);return request({'uri':util['format'](_0x5d24('0x1c'),_0x26bceb[_0x5d24('0x10')]),'qs':{'query':util['format'](_0x5d24('0x27'),_0xe74330)}})[_0x5d24('0x1d')](function(_0x4de65a){var _0x491753;if(_0x4de65a['results'][_0x5d24('0x28')]){_0x4de65a['results']=_[_0x5d24('0x29')](_0x4de65a[_0x5d24('0x21')],{'suspended':![],'role':_0x5d24('0x2a')});if(_0x4de65a[_0x5d24('0x21')][_0x5d24('0x28')]){_0x491753=_[_0x5d24('0x2b')](_0x4de65a[_0x5d24('0x21')]);}}if(_0x491753){logger['info'](_0x5d24('0x2c'));return _0x491753;}else{logger[_0x5d24('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x26bceb[_0x5d24('0x10')]),'method':'POST','body':{'user':{'role':_0x5d24('0x2a'),'name':util[_0x5d24('0xe')](_0x5d24('0x2d'),_0x582b36||_0xe74330),'phone':_0xe74330}}})['then'](function(_0x91e10f){logger['info'](_0x5d24('0x2e'));return _0x91e10f[_0x5d24('0x26')];});}});}function getAuth(_0x400df8){var _0x35a445;if(_0x400df8[_0x5d24('0x2f')]===_0x5d24('0x30')){_0x35a445=util[_0x5d24('0xe')](_0x5d24('0x31'),_0x400df8[_0x5d24('0x32')],_0x400df8[_0x5d24('0x30')]);}else if(_0x400df8[_0x5d24('0x2f')]===_0x5d24('0x33')){_0x35a445=util[_0x5d24('0xe')](_0x5d24('0x34'),_0x400df8[_0x5d24('0x32')],_0x400df8[_0x5d24('0x33')]);}return util[_0x5d24('0xe')]('Basic\x20%s',new Buffer(_0x35a445)[_0x5d24('0x35')]('base64'));}function request(_0x358345){logger['debug'](_0x5d24('0x36'),JSON[_0x5d24('0x37')](_0x358345));return rp(_['defaults'](_0x358345,{'method':_0x5d24('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x39a996,_0x10f4a0){var _0x176cbb=[];if(_0x39a996&&_0x39a996['length']>0x0){_0x176cbb=_[_0x5d24('0x39')](_0x39a996,_0x10f4a0);}return _0x176cbb;}function getCustomFields(_0x4dfb8e,_0x1a5864){var _0x566132=[];var _0x2915cf={'custom_fields':[]};if(_0x4dfb8e[_0x5d24('0x28')]>0x0){_[_0x5d24('0x3a')](_0x4dfb8e,function(_0x3693f1){if(_0x3693f1['type']===_0x5d24('0x3b')&&_0x3693f1[_0x5d24('0x3c')]&&!_0x3693f1[_0x5d24('0x3d')]){_0x2915cf[_0x3693f1[_0x5d24('0x3c')]['toLowerCase']()]=_0x3693f1[_0x5d24('0x3e')][_0x5d24('0x35')]();}else if(_0x3693f1[_0x5d24('0x3f')]===_0x5d24('0x3b')&&_0x3693f1[_0x5d24('0x40')]&&_0x3693f1[_0x5d24('0x3d')]){_0x2915cf['custom_fields']['push']({'id':_0x3693f1[_0x5d24('0x40')],'value':_0x3693f1[_0x5d24('0x3e')][_0x5d24('0x35')]()});}else if(_0x3693f1[_0x5d24('0x3f')]===_0x5d24('0x41')&&_0x3693f1[_0x5d24('0x42')]&&_0x3693f1[_0x5d24('0x40')]&&_0x3693f1['customField']){_0x1a5864[_0x3693f1[_0x5d24('0x42')]]&&_0x2915cf[_0x5d24('0x43')][_0x5d24('0x44')]({'id':_0x3693f1[_0x5d24('0x40')],'value':_0x1a5864[_0x3693f1[_0x5d24('0x42')]][_0x5d24('0x35')]()});}else if(_0x3693f1['type']===_0x5d24('0x45')&&_0x3693f1[_0x5d24('0x46')]&&_0x3693f1[_0x5d24('0x46')][_0x5d24('0x14')]&&_0x3693f1['idField']&&_0x3693f1[_0x5d24('0x3d')]){_0x1a5864[_0x3693f1['Variable']['name'][_0x5d24('0x47')]()]&&_0x2915cf[_0x5d24('0x43')][_0x5d24('0x44')]({'id':_0x3693f1['idField'],'value':_0x1a5864[_0x3693f1[_0x5d24('0x46')]['name'][_0x5d24('0x47')]()][_0x5d24('0x35')]()});}});}return _0x2915cf;}exports[_0x5d24('0x48')]=function(_0x4fd259,_0xd683fd,_0xc38a6e,_0x3be121,_0xbe9563,_0x34522f){var _0x407a69,_0x27def5;_0x34522f['remoteUri']=intUtil[_0x5d24('0x49')](_0x34522f['remoteUri']);_0x34522f[_0x5d24('0x4a')]=intUtil['stripTrailingSlash'](_0x34522f[_0x5d24('0x4a')]);if(_0xbe9563&&_0xbe9563[_0x5d24('0x4b')]){logger[_0x5d24('0xc')](_0x5d24('0x4c'),_0x5d24('0x4d'));_0xd683fd[_0x5d24('0x4e')]=util[_0x5d24('0xe')](_0x5d24('0x4f'),_0x34522f[_0x5d24('0x4a')],_0xd683fd[_0x5d24('0x50')],md5(_0xd683fd[_0x5d24('0x50')]));}else{_0xd683fd[_0x5d24('0x4e')]='';}headers[_0x5d24('0x51')]=getAuth(_0x34522f);return getUser(_0x34522f,_0x3be121[_0x5d24('0x52')])[_0x5d24('0x1d')](function(_0x2a6ecc){_0x407a69=_0x2a6ecc;logger[_0x5d24('0xc')](_0x5d24('0x53'),_0x407a69['id']);return getEndUser(_0x34522f,_0xd683fd[_0x5d24('0x54')],_0xd683fd[_0x5d24('0x55')]);})[_0x5d24('0x1d')](function(_0x2d5893){_0x27def5=_0x2d5893;logger['info'](_0x5d24('0x56'),_0x27def5['id']);return getTicket(_0x34522f,_0x407a69,_0x27def5,_0xc38a6e,_0xd683fd);})[_0x5d24('0x1d')](function(_0x416f4d){if(_0x416f4d){logger[_0x5d24('0xc')]('The\x20Ticket\x20ID\x20is:',_0x416f4d['id']);switch(_0x34522f[_0x5d24('0x3f')]){case _0x5d24('0x57'):logger[_0x5d24('0xc')](_0x5d24('0x4c'),_0x5d24('0x58'));return request({'uri':util[_0x5d24('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x34522f[_0x5d24('0x10')],_0x407a69['id'],_0x416f4d['id']),'method':'POST'});case _0x5d24('0x59'):logger['info']('[QUEUE]',_0x5d24('0x5a'));emit(util[_0x5d24('0xe')](_0x5d24('0x5b'),_0x3be121[_0x5d24('0x14')]),_0x5d24('0x5c'),{'uri':util[_0x5d24('0xe')]('%s/agent/tickets/%s',_0x34522f[_0x5d24('0x10')][_0x5d24('0x5d')](_0x5d24('0x5e'),''),_0x416f4d['id'])});break;default:logger[_0x5d24('0x5f')](_0x5d24('0x4c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5d24('0x60')](function(_0x291ca5){logger['error'](_0x5d24('0x61'),util[_0x5d24('0x62')](_0x291ca5,{'showHidden':!![],'depth':null}));});};exports[_0x5d24('0x63')]=function(_0x51e317,_0x2ffa00,_0x85341d,_0x2960c2,_0x3b8ab4,_0x55e393,_0x52b13e){var _0xed52c5,_0xeeecf4;_0x55e393[_0x5d24('0x10')]=intUtil[_0x5d24('0x49')](_0x55e393[_0x5d24('0x10')]);_0x55e393[_0x5d24('0x4a')]=intUtil[_0x5d24('0x49')](_0x55e393['serverUrl']);if(_0x52b13e&&_0x52b13e[_0x5d24('0x64')]&&_0x52b13e[_0x5d24('0x64')]!==_0x5d24('0x65')){logger['info'](_0x5d24('0x66'),_0x5d24('0x4d'));_0x2ffa00[_0x5d24('0x4e')]=util[_0x5d24('0xe')](_0x5d24('0x4f'),_0x55e393[_0x5d24('0x4a')],_0x2ffa00[_0x5d24('0x50')],md5(_0x2ffa00[_0x5d24('0x50')]));}headers[_0x5d24('0x51')]=getAuth(_0x55e393);return getUser(_0x55e393,_0x2960c2[_0x5d24('0x52')])[_0x5d24('0x1d')](function(_0x2e529b){_0xed52c5=_0x2e529b;logger[_0x5d24('0xc')](_0x5d24('0x53'),_0xed52c5['id']);return getEndUser(_0x55e393,_0x2ffa00[_0x5d24('0x67')],_0x2ffa00['destcalleridnum']);})[_0x5d24('0x1d')](function(_0x3ce2b7){_0xeeecf4=_0x3ce2b7;logger[_0x5d24('0xc')](_0x5d24('0x56'),_0xeeecf4['id']);return getTicket(_0x55e393,_0xed52c5,_0xeeecf4,_0x85341d,_0x2ffa00);})[_0x5d24('0x1d')](function(_0xb0f9c6){if(_0xb0f9c6){logger['info'](_0x5d24('0x68'),_0xb0f9c6['id']);switch(_0x55e393[_0x5d24('0x3f')]){case _0x5d24('0x57'):logger[_0x5d24('0xc')](_0x5d24('0x66'),_0x5d24('0x58'));return request({'uri':util[_0x5d24('0xe')](_0x5d24('0x69'),_0x55e393[_0x5d24('0x10')],_0xed52c5['id'],_0xb0f9c6['id']),'method':_0x5d24('0x11')});case _0x5d24('0x59'):logger[_0x5d24('0xc')](_0x5d24('0x66'),_0x5d24('0x5a'));emit(util[_0x5d24('0xe')](_0x5d24('0x5b'),_0x2960c2[_0x5d24('0x14')]),_0x5d24('0x5c'),{'uri':util[_0x5d24('0xe')](_0x5d24('0x6a'),_0x55e393['remoteUri']['replace']('/api/v2',''),_0xb0f9c6['id'])});break;default:logger['error'](_0x5d24('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x40f306){logger[_0x5d24('0x5f')](_0x5d24('0x6b'),util['inspect'](_0x40f306,{'showHidden':!![],'depth':null}));});};exports[_0x5d24('0x6c')]=function(_0x5747b3,_0x7de1dc,_0xb96531,_0x37b028,_0x121a49,_0x351810){var _0x37b0da,_0x4a861f;_0x351810[_0x5d24('0x10')]=intUtil[_0x5d24('0x49')](_0x351810[_0x5d24('0x10')]);_0x351810[_0x5d24('0x4a')]=intUtil['stripTrailingSlash'](_0x351810[_0x5d24('0x4a')]);if(_0x121a49&&_0x121a49[_0x5d24('0x4b')]){logger[_0x5d24('0xc')]('['+_0x7de1dc[_0x5d24('0x6d')][_0x5d24('0x6e')]()+']','Recording\x20is\x20enabled!');_0x7de1dc[_0x5d24('0x4e')]=util[_0x5d24('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x351810[_0x5d24('0x4a')],_0x7de1dc[_0x5d24('0x50')],md5(_0x7de1dc[_0x5d24('0x50')]));}else{_0x7de1dc[_0x5d24('0x4e')]='';}headers[_0x5d24('0x51')]=getAuth(_0x351810);return getUser(_0x351810)['then'](function(_0x34b2b8){_0x37b0da=_0x34b2b8;logger[_0x5d24('0xc')](_0x5d24('0x53'),_0x37b0da['id']);return getEndUser(_0x351810,_0x7de1dc['calleridname'],_0x7de1dc[_0x5d24('0x55')]);})[_0x5d24('0x1d')](function(_0x1ab047){_0x4a861f=_0x1ab047;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4a861f['id']);return getTicket(_0x351810,_0x37b0da,_0x4a861f,_0xb96531,_0x7de1dc);})[_0x5d24('0x1d')](function(_0x59771e){if(_0x59771e){logger[_0x5d24('0xc')](_0x5d24('0x68'),_0x59771e['id']);}})[_0x5d24('0x60')](function(_0x27e391){logger['error']('['+_0x7de1dc['lastevent'][_0x5d24('0x6e')]()+']'+_0x5d24('0x6f'),util[_0x5d24('0x62')](_0x27e391,{'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 d610fd9..6ff9723 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 _0xa1b4=['type','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','data','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','enduserType','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','Owner','administrator','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','connect','Answered','rejected','Call_Result','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','code','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','com','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','[OUTBOUND]','toUpperCase','lodash','request-promise','md5','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','string','idField','content','toString'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa1b4,0x83));var _0x4a1b=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xa1b4[_0x35a140];return _0x30ab82;};'use strict';var _=require(_0x4a1b('0x0'));var rp=require(_0x4a1b('0x1'));var md5=require(_0x4a1b('0x2'));var util=require(_0x4a1b('0x3'));var intUtil=require(_0x4a1b('0x4'));var moment=require(_0x4a1b('0x5'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x4a1b('0x6'));var logger=require(_0x4a1b('0x7'))(_0x4a1b('0x8'));config[_0x4a1b('0x9')]=_[_0x4a1b('0xa')](config['redis'],{'host':_0x4a1b('0xb'),'port':0x18eb});var io=require(_0x4a1b('0xc'))(new Redis(config['redis']));function emit(_0x44e31f,_0x13cae9,_0x4d6f2b){io['to'](_0x44e31f)[_0x4a1b('0xd')](_0x13cae9,_0x4d6f2b);}function request(_0x20ad70){logger['debug']('[HTTP]',JSON[_0x4a1b('0xe')](_0x20ad70));return rp(_0x20ad70);}function getCustomFields(_0x28f694,_0x168d8c){var _0x4e05bd={};if(_0x28f694[_0x4a1b('0xf')]>0x0){_['forEach'](_0x28f694,function(_0x5b5b0d){if(_0x5b5b0d['type']===_0x4a1b('0x10')&&_0x5b5b0d[_0x4a1b('0x11')]){_0x4e05bd[_0x5b5b0d['idField']]=_0x5b5b0d[_0x4a1b('0x12')][_0x4a1b('0x13')]();}else if(_0x5b5b0d[_0x4a1b('0x14')]===_0x4a1b('0x15')&&_0x5b5b0d[_0x4a1b('0x16')]&&_0x5b5b0d[_0x4a1b('0x11')]&&_0x168d8c[_0x5b5b0d[_0x4a1b('0x16')]]){_0x4e05bd[_0x5b5b0d['idField']]=_0x168d8c[_0x5b5b0d[_0x4a1b('0x16')]][_0x4a1b('0x13')]();}else if(_0x5b5b0d[_0x4a1b('0x14')]===_0x4a1b('0x17')&&_0x5b5b0d[_0x4a1b('0x18')]&&_0x5b5b0d[_0x4a1b('0x18')][_0x4a1b('0x19')]&&_0x5b5b0d['idField']&&_0x168d8c[_0x5b5b0d[_0x4a1b('0x18')]['name'][_0x4a1b('0x1a')]()]){_0x4e05bd[_0x5b5b0d[_0x4a1b('0x11')]]=_0x168d8c[_0x5b5b0d[_0x4a1b('0x18')][_0x4a1b('0x19')]['toLowerCase']()][_0x4a1b('0x13')]();}});}return _0x4e05bd;}function getName(_0x2ca4d3){if(_0x2ca4d3['indexOf']('\x20')>0x0){var _0x309155=_0x2ca4d3['split'](/ (.+)/);if(_0x309155[0x1]){return _0x309155;}}return[_0x2ca4d3,_0x2ca4d3];}var accountsTokens={};function getAccessToken(_0x38ef1b){return new Promise(function(_0x47551e,_0x135ca1){if(!_[_0x4a1b('0x1b')](accountsTokens[_0x38ef1b['id']])&&!_[_0x4a1b('0x1b')](accountsTokens[_0x38ef1b['id']][_0x4a1b('0x1c')])){if(moment()[_0x4a1b('0x1d')](accountsTokens[_0x38ef1b['id']][_0x4a1b('0x1e')])){_0x47551e(accountsTokens[_0x38ef1b['id']][_0x4a1b('0x1c')]);}}var _0x465ad0;switch(_0x38ef1b['zone']){case'US':_0x465ad0=_0x4a1b('0x1f');break;case'AU':_0x465ad0=_0x4a1b('0x20');break;case'EU':_0x465ad0=_0x4a1b('0x21');break;case'IN':_0x465ad0=_0x4a1b('0x22');break;case'CN':_0x465ad0=_0x4a1b('0x23');break;default:_0x465ad0=_0x4a1b('0x21');break;}var _0x2ab2e3={'method':_0x4a1b('0x24'),'uri':_0x465ad0+_0x4a1b('0x25'),'qs':{'refresh_token':_0x38ef1b[_0x4a1b('0x26')],'client_id':_0x38ef1b[_0x4a1b('0x27')],'client_secret':_0x38ef1b[_0x4a1b('0x28')],'grant_type':_0x4a1b('0x29')},'json':!![]};return rp(_0x2ab2e3)[_0x4a1b('0x2a')](function(_0x59bc18){accountsTokens[_0x38ef1b['id']]={'access_token':_0x59bc18[_0x4a1b('0x1c')],'expires_in':moment()[_0x4a1b('0x2b')](_0x59bc18[_0x4a1b('0x1e')],_0x4a1b('0x2c'))};_0x47551e(_0x59bc18['access_token']);})[_0x4a1b('0x2d')](function(_0x51d07f){logger[_0x4a1b('0x2e')](_0x4a1b('0x2f'),_0x51d07f[_0x4a1b('0x30')]);_0x135ca1(_0x51d07f);});});}function getUser(_0x68a8fc,_0x3e1071,_0xfa3c58,_0x26d080){logger[_0x4a1b('0x31')](_0x4a1b('0x32'));return request({'method':_0x4a1b('0x33'),'uri':util['format'](_0x4a1b('0x34'),_0x3e1071),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x4a1b('0x35')+_0x68a8fc},'json':!![]})[_0x4a1b('0x2a')](function(_0x2fa17c){if(_0x2fa17c[_0x4a1b('0x36')]){var _0x4d6532=-0x1;if(_['isArrayLikeObject'](_0x2fa17c[_0x4a1b('0x36')])){if(!_[_0x4a1b('0x1b')](_0x26d080)){_0x4d6532=_[_0x4a1b('0x37')](_0x2fa17c['users'],function(_0x520791){return _0x520791[_0x4a1b('0x38')]===_0x26d080;});}if(_0x4d6532>=0x0){logger[_0x4a1b('0x31')](_0x4a1b('0x39'));}else{logger[_0x4a1b('0x31')](_0x4a1b('0x3a'));_0x4d6532=_['findIndex'](_0x2fa17c['users'],function(_0x5176f3){return _0x5176f3[_0x4a1b('0x3b')]['name']===_0x4a1b('0x3c');});}return _0x2fa17c[_0x4a1b('0x36')][_0x4d6532];}else{if(_0x2fa17c[_0x4a1b('0x3d')][_0x4a1b('0x3b')][_0x4a1b('0x19')]==='Administrator'){logger[_0x4a1b('0x31')](_0x4a1b('0x3a'));user=_0x2fa17c['user'];return user;}else{logger['error'](_0x4a1b('0x3e'),JSON[_0x4a1b('0xe')](_0x2fa17c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x4a1b('0xe')](_0x2fa17c));}}}else{logger[_0x4a1b('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x4a1b('0xe')](_0x2fa17c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x4a1b('0xe')](_0x2fa17c));}})[_0x4a1b('0x2d')](function(_0x3d252a){console[_0x4a1b('0x2e')](_0x3d252a);});}function getZohoUser(_0x1b13fe,_0x214640){return new BPromise(function(_0x1c9ede,_0x2961e0){request(_0x1b13fe)[_0x4a1b('0x2a')](function(_0x461590){var _0x41c6fa=null;if(_0x461590){_0x41c6fa=_0x461590[_0x4a1b('0x3f')][0x0];_0x41c6fa['enduserType']=_0x214640;}_0x1c9ede(_0x41c6fa);})[_0x4a1b('0x2d')](function(_0x660866){_0x2961e0(_0x660866);});});}function createEndUser(_0x152995,_0x4acfd3,_0xb5c834,_0x362c50,_0x50c4c3,_0x23793b){var _0xb5c834=getName(_0xb5c834);return request({'method':_0x4a1b('0x24'),'uri':'https://www.zohoapis.'+_0x4acfd3+'/crm/v2/'+_[_0x4a1b('0x40')](_0x23793b[_0x4a1b('0x41')])+'s','body':{'data':[{'Last_Name':_0xb5c834[0x1],'First_Name':_0xb5c834[0x0],'Phone':_0x362c50,'Owner':{'name':!_['isNil'](_0x50c4c3[_0x4a1b('0x42')][_0x4a1b('0x19')])?_0x50c4c3[_0x4a1b('0x42')][_0x4a1b('0x19')]:!_[_0x4a1b('0x1b')](_0x50c4c3[_0x4a1b('0x43')])?_0x50c4c3[_0x4a1b('0x43')]+'\x20'+_0x50c4c3['last_name']:_0x50c4c3[_0x4a1b('0x44')],'id':_0x50c4c3['id']}}]},'headers':{'Authorization':_0x4a1b('0x35')+_0x152995},'json':!![]})[_0x4a1b('0x2a')](function(_0x4139bc){if(_0x4139bc&&_0x4139bc[_0x4a1b('0x3f')][0x0]['code']===_0x4a1b('0x45')){var _0x5de8fe=_0x4139bc[_0x4a1b('0x3f')][0x0][_0x4a1b('0x46')];_0x5de8fe[_0x4a1b('0x47')]=_['startCase'](_0x23793b[_0x4a1b('0x41')])+'s';return _0x5de8fe;}logger[_0x4a1b('0x2e')](_0x4a1b('0x3e'),JSON[_0x4a1b('0xe')](data));throw new Error(_0x4a1b('0x48')+JSON['stringify'](data));})[_0x4a1b('0x2d')](function(_0x158ddb){console['log'](_0x4a1b('0x49'),_0x158ddb);});}function getEndUser(_0x4f0739,_0x3f94d0,_0x3d49e4,_0x1c845d,_0x5c4397,_0xcfb4e5,_0x463a03){var _0x1bf034={'method':_0x4a1b('0x33'),'uri':'','headers':{'Authorization':_0x4a1b('0x35')+_0x4f0739},'json':!![]};switch(_0x463a03[_0x4a1b('0x4a')]){case _0x4a1b('0x4b'):_0x1bf034[_0x4a1b('0x4c')]=_0x4a1b('0x4d')+_0x3f94d0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5c4397+'))';return getZohoUser(_0x1bf034,'Contacts')[_0x4a1b('0x2a')](function(_0x16c07d){if(_0x16c07d)return _0x16c07d;_0x1bf034[_0x4a1b('0x4c')]=_0x4a1b('0x4d')+_0x3f94d0+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5c4397+'))';return getZohoUser(_0x1bf034,_0x4a1b('0x4e'))[_0x4a1b('0x2a')](function(_0x1982e8){if(_0x1982e8)return _0x1982e8;if(_0x463a03[_0x4a1b('0x41')]!=_0x4a1b('0x4f')){return createEndUser(_0x4f0739,_0x3f94d0,_0x1c845d,_0x5c4397,_0xcfb4e5,_0x463a03);}else{return{};}});});break;case _0x4a1b('0x50'):_0x1bf034[_0x4a1b('0x4c')]=_0x4a1b('0x4d')+_0x3f94d0+_0x4a1b('0x51')+_0x5c4397+'))';return getZohoUser(_0x1bf034,_0x4a1b('0x52'))[_0x4a1b('0x2a')](function(_0x923709){if(_0x923709)return _0x923709;if(_0x463a03[_0x4a1b('0x41')]!=_0x4a1b('0x4f')){return createEndUser(_0x4f0739,_0x3f94d0,_0x1c845d,_0x5c4397,_0xcfb4e5,_0x463a03);}else{return{};}});break;case _0x4a1b('0x53'):_0x1bf034[_0x4a1b('0x4c')]=_0x4a1b('0x4d')+_0x3f94d0+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5c4397+'))';return getZohoUser(_0x1bf034,_0x4a1b('0x4e'))[_0x4a1b('0x2a')](function(_0x41b8da){if(_0x41b8da)return _0x41b8da;if(_0x463a03[_0x4a1b('0x41')]!='nothing'){return createEndUser(_0x4f0739,_0x3f94d0,_0x1c845d,_0x5c4397,_0xcfb4e5,_0x463a03);}else{return{};}});break;}}function getCall(_0x554462,_0x23748d,_0x569401,_0x1e44f9,_0x4c2e8f,_0x14a92e,_0x5c4b1d,_0x3ffb7f){logger[_0x4a1b('0x31')]('Creating\x20new\x20call...');var _0x44dbdf={};_0x44dbdf[_0x4a1b('0x54')]={'name':!_[_0x4a1b('0x1b')](_0x1e44f9['role'][_0x4a1b('0x19')])&&!_[_0x4a1b('0x1b')](_0x1e44f9[_0x4a1b('0x3b')]['name'])&&_0x1e44f9[_0x4a1b('0x3b')]['name']===_0x4a1b('0x55')?_0x1e44f9[_0x4a1b('0x42')][_0x4a1b('0x19')]:!_[_0x4a1b('0x1b')](_0x1e44f9[_0x4a1b('0x43')])?_0x1e44f9[_0x4a1b('0x43')]+'\x20'+_0x1e44f9[_0x4a1b('0x44')]:_0x1e44f9[_0x4a1b('0x44')],'id':_0x1e44f9['id']};_0x44dbdf[_0x4a1b('0x56')]=intUtil['getString'](_0x14a92e[_0x4a1b('0x57')],_0x5c4b1d,'\x20');_0x44dbdf[_0x4a1b('0x58')]=intUtil['getString'](_0x14a92e[_0x4a1b('0x59')],_0x5c4b1d,'\x0a');if(_0x4c2e8f[_0x4a1b('0x47')]==='Contacts'){_0x44dbdf[_0x4a1b('0x5a')]={'name':!_[_0x4a1b('0x1b')](_0x4c2e8f[_0x4a1b('0x5b')])?_0x4c2e8f[_0x4a1b('0x5b')]:!_[_0x4a1b('0x1b')](_0x4c2e8f['First_Name'])?_0x4c2e8f[_0x4a1b('0x5c')]+'\x20'+_0x4c2e8f[_0x4a1b('0x5d')]:_0x4c2e8f['Last_Name'],'id':_0x4c2e8f['id']};}if(_0x4c2e8f[_0x4a1b('0x47')]===_0x4a1b('0x4e')){_0x44dbdf['What_Id']={'name':!_[_0x4a1b('0x1b')](_0x4c2e8f[_0x4a1b('0x5b')])?_0x4c2e8f[_0x4a1b('0x5b')]:!_[_0x4a1b('0x1b')](_0x4c2e8f[_0x4a1b('0x5c')])?_0x4c2e8f['First_Name']+'\x20'+_0x4c2e8f['Last_Name']:_0x4c2e8f[_0x4a1b('0x5d')],'id':_0x4c2e8f['id']};_0x44dbdf['$se_module']=_[_0x4a1b('0x40')](_0x4c2e8f[_0x4a1b('0x47')]);}if(_0x5c4b1d[_0x4a1b('0x5e')]){_0x44dbdf[_0x4a1b('0x5f')]=moment[_0x4a1b('0x60')](parseInt(_0x5c4b1d[_0x4a1b('0x5e')])*0x3e8)[_0x4a1b('0x61')](_0x4a1b('0x62'));}else if(_0x5c4b1d[_0x4a1b('0x63')]&&_0x5c4b1d[_0x4a1b('0x64')]){_0x44dbdf['Call_Duration']=moment['utc'](moment(_0x5c4b1d[_0x4a1b('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x4a1b('0x65')](moment(_0x5c4b1d[_0x4a1b('0x66')],_0x4a1b('0x67'))))[_0x4a1b('0x61')](_0x4a1b('0x62'));}switch(_0x5c4b1d[_0x4a1b('0x68')]){case _0x4a1b('0x69'):_0x44dbdf['Call_Result']=_0x4a1b('0x6a');break;case'complete':case _0x4a1b('0x6b'):_0x44dbdf['Call_Result']=_0x4a1b('0x6c');break;case _0x4a1b('0x6d'):_0x44dbdf[_0x4a1b('0x6e')]=_0x4a1b('0x6f');break;case _0x4a1b('0x70'):_0x44dbdf['Call_Result']=_0x4a1b('0x71');break;case _0x4a1b('0x72'):_0x44dbdf[_0x4a1b('0x6e')]=_0x4a1b('0x73');default:}_0x44dbdf['Call_Start_Time']=(_0x3ffb7f===_0x4a1b('0x74')?moment(_0x5c4b1d[_0x4a1b('0x66')])['format'](_0x4a1b('0x67')):moment(_0x5c4b1d[_0x4a1b('0x75')])['format'](_0x4a1b('0x67')))||moment()['format'](_0x4a1b('0x67'));_0x44dbdf[_0x4a1b('0x76')]=_0x3ffb7f||'Inbound';_0x44dbdf=_[_0x4a1b('0x77')](_0x44dbdf,getCustomFields(_0x14a92e[_0x4a1b('0x78')],_0x5c4b1d));return request({'method':_0x4a1b('0x24'),'uri':_0x4a1b('0x4d')+_0x23748d+_0x4a1b('0x79'),'headers':{'Authorization':_0x4a1b('0x35')+_0x554462},'body':{'data':[_0x44dbdf]},'json':!![]})[_0x4a1b('0x2a')](function(_0x107e93){if(_0x107e93&&_0x107e93[_0x4a1b('0x3f')][0x0][_0x4a1b('0x7a')]===_0x4a1b('0x45')){logger[_0x4a1b('0x31')]('Call\x20created!');return{'id':_0x107e93[_0x4a1b('0x3f')][0x0][_0x4a1b('0x46')]['id']};}})[_0x4a1b('0x2d')](function(_0x31dfee){logger[_0x4a1b('0x31')](_0x4a1b('0x7b'),_0x31dfee[_0x4a1b('0x30')]);console['log'](_0x4a1b('0x7b'),_0x31dfee);});}exports['queue']=function(_0x1d6b5a,_0x2c505d,_0x122ce6,_0xb4f2c7,_0x56e7b6,_0x222578){var _0x49012a,_0x2a084c,_0x5265e8;_0x222578[_0x4a1b('0x7c')]=intUtil[_0x4a1b('0x7d')](_0x222578[_0x4a1b('0x7c')]);_0x222578['serverUrl']=intUtil['stripTrailingSlash'](_0x222578[_0x4a1b('0x7e')]);if(_0x56e7b6&&_0x56e7b6[_0x4a1b('0x7f')]){logger[_0x4a1b('0x31')](_0x4a1b('0x80'),_0x4a1b('0x81'));_0x2c505d[_0x4a1b('0x82')]=_0x222578[_0x4a1b('0x7e')]+_0x4a1b('0x83')+_0x2c505d['uniqueid']+_0x4a1b('0x84')+md5(_0x2c505d[_0x4a1b('0x85')]);}else{_0x2c505d[_0x4a1b('0x82')]='';}var _0x209caa=_0x222578[_0x4a1b('0x7c')]===_0x4a1b('0x86')?'eu':'com';return getAccessToken(_0x222578)[_0x4a1b('0x2a')](function(_0x1bf38f){_0x5265e8=_0x1bf38f;return getUser(_0x5265e8,_0x209caa,_0x222578,_0xb4f2c7['email']);})[_0x4a1b('0x2a')](function(_0x50b57a){_0x49012a=_0x50b57a;logger[_0x4a1b('0x31')]('The\x20User\x20ID\x20is:',_0x49012a['id']);return getEndUser(_0x5265e8,_0x209caa,_0x222578,_0x2c505d[_0x4a1b('0x87')],_0x2c505d[_0x4a1b('0x88')],_0x49012a,_0x122ce6);})[_0x4a1b('0x2a')](function(_0x16f2f2){_0x2a084c=_0x16f2f2;return getCall(_0x5265e8,_0x209caa,_0x222578,_0x49012a,_0x2a084c,_0x122ce6,_0x2c505d,_0x4a1b('0x89'));})['then'](function(_0x9864a7){if(_0x9864a7){logger['info'](_0x4a1b('0x8a'),_0x9864a7['id']);logger['info'](_0x4a1b('0x80'),_0x4a1b('0x8b'));emit(util['format']('user:%s',_0xb4f2c7['name']),_0x4a1b('0x8c'),{'uri':_0x4a1b('0x8d')+_0x222578[_0x4a1b('0x7c')]+_0x4a1b('0x8e')+_0x9864a7['id']});}})[_0x4a1b('0x2d')](function(_0x4817d5){logger[_0x4a1b('0x2e')](_0x4a1b('0x80'),JSON['stringify'](_0x4817d5));});};exports[_0x4a1b('0x74')]=function(_0x222fd5,_0x43a572,_0x279bed,_0x1ac836,_0x308006,_0x49b4fb,_0x478bbc){var _0x3af9f9,_0x2743c4,_0x448587;_0x49b4fb[_0x4a1b('0x7c')]=intUtil['stripTrailingSlash'](_0x49b4fb[_0x4a1b('0x7c')]);_0x49b4fb[_0x4a1b('0x7e')]=intUtil['stripTrailingSlash'](_0x49b4fb[_0x4a1b('0x7e')]);if(_0x478bbc&&_0x478bbc['recordingFormat']&&_0x478bbc[_0x4a1b('0x8f')]!==_0x4a1b('0x90')){logger[_0x4a1b('0x31')]('[OUTBOUND]',_0x4a1b('0x81'));_0x43a572[_0x4a1b('0x82')]=_0x49b4fb[_0x4a1b('0x7e')]+_0x4a1b('0x83')+_0x43a572[_0x4a1b('0x85')]+_0x4a1b('0x84')+md5(_0x43a572[_0x4a1b('0x85')]);}var _0x38cb75=_0x49b4fb[_0x4a1b('0x7c')]==='zoho.eu'?'eu':_0x4a1b('0x91');return getAccessToken(_0x49b4fb)['then'](function(_0x1209d4){_0x448587=_0x1209d4;return getUser(_0x448587,_0x38cb75,_0x49b4fb,_0x1ac836[_0x4a1b('0x38')]);})[_0x4a1b('0x2a')](function(_0x56f77b){_0x3af9f9=_0x56f77b;logger['info'](_0x4a1b('0x92'),_0x3af9f9['id']);return getEndUser(_0x448587,_0x38cb75,_0x49b4fb,_0x43a572['destcalleridname'],_0x43a572[_0x4a1b('0x93')],_0x3af9f9,_0x279bed);})[_0x4a1b('0x2a')](function(_0x1e868f){_0x2743c4=_0x1e868f;return getCall(_0x448587,_0x38cb75,_0x49b4fb,_0x3af9f9,_0x2743c4,_0x279bed,_0x43a572,_0x4a1b('0x94'));})[_0x4a1b('0x2a')](function(_0x4344bb){if(_0x4344bb){logger[_0x4a1b('0x31')]('The\x20Call\x20ID\x20is:',_0x4344bb['id']);logger['info'](_0x4a1b('0x95'),_0x4a1b('0x8b'));emit(util[_0x4a1b('0x61')]('user:%s',_0x1ac836[_0x4a1b('0x19')]),_0x4a1b('0x8c'),{'uri':'https://crm.'+_0x49b4fb['host']+_0x4a1b('0x8e')+_0x4344bb['id']});}})[_0x4a1b('0x2d')](function(_0x1c021a){logger[_0x4a1b('0x2e')]('[OUTBOUND]',JSON['stringify'](_0x1c021a));});};exports['unmanaged']=function(_0x1ac323,_0x54d4f1,_0x5112e7,_0x567aea,_0x14b334,_0x52f400){var _0x56dc68,_0x2d7cad,_0x520e2a;_0x52f400['host']=intUtil[_0x4a1b('0x7d')](_0x52f400[_0x4a1b('0x7c')]);_0x52f400[_0x4a1b('0x7e')]=intUtil[_0x4a1b('0x7d')](_0x52f400[_0x4a1b('0x7e')]);if(_0x14b334&&_0x14b334[_0x4a1b('0x7f')]){logger['info']('['+_0x54d4f1['lastevent'][_0x4a1b('0x96')]()+']',_0x4a1b('0x81'));_0x54d4f1[_0x4a1b('0x82')]=_0x52f400['serverUrl']+'/api/voice/recordings/'+_0x54d4f1[_0x4a1b('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x54d4f1[_0x4a1b('0x85')]);}else{_0x54d4f1['recordingURL']='';}var _0x52883e=_0x52f400[_0x4a1b('0x7c')]==='zoho.eu'?'eu':_0x4a1b('0x91');return getAccessToken(_0x52f400)[_0x4a1b('0x2a')](function(_0x3125ce){_0x520e2a=_0x3125ce;return getUser(_0x520e2a,_0x52883e,_0x52f400);})[_0x4a1b('0x2a')](function(_0x3ec2d3){_0x56dc68=_0x3ec2d3;logger['info']('The\x20User\x20ID\x20is:',_0x56dc68['id']);return getEndUser(_0x520e2a,_0x52883e,_0x52f400,_0x54d4f1[_0x4a1b('0x87')],_0x54d4f1[_0x4a1b('0x88')],_0x56dc68,_0x5112e7);})[_0x4a1b('0x2a')](function(_0x48db10){_0x2d7cad=_0x48db10;return getCall(_0x520e2a,_0x52883e,_0x52f400,_0x56dc68,_0x2d7cad,_0x5112e7,_0x54d4f1,_0x4a1b('0x89'));})[_0x4a1b('0x2a')](function(_0x336c61){if(_0x336c61){logger[_0x4a1b('0x31')](_0x4a1b('0x8a'),_0x336c61['id']);}})[_0x4a1b('0x2d')](function(_0x2cce6d){logger['error']('['+_0x54d4f1['lastevent'][_0x4a1b('0x96')]()+']',JSON[_0x4a1b('0xe')](_0x2cce6d));});}; \ No newline at end of file +var _0xb1a4=['mm:ss','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','Call_Type','Inbound','merge','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','lodash','request-promise','md5','ioredis','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','length','forEach','string','variable','idField','variableName','type','customVariable','Variable','name','toLowerCase','toString','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Leads','Creating\x20new\x20call...','Owner','administrator','first_name','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','format'];(function(_0x3b0f2f,_0x4a6e2d){var _0x2e7332=function(_0x3a0b8d){while(--_0x3a0b8d){_0x3b0f2f['push'](_0x3b0f2f['shift']());}};_0x2e7332(++_0x4a6e2d);}(_0xb1a4,0x16a));var _0x4b1a=function(_0xa8763c,_0x48061b){_0xa8763c=_0xa8763c-0x0;var _0x3a5b82=_0xb1a4[_0xa8763c];return _0x3a5b82;};'use strict';var _=require(_0x4b1a('0x0'));var rp=require(_0x4b1a('0x1'));var md5=require(_0x4b1a('0x2'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x4b1a('0x3'));var BPromise=require(_0x4b1a('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4b1a('0x5'))('zoho');config[_0x4b1a('0x6')]=_[_0x4b1a('0x7')](config['redis'],{'host':_0x4b1a('0x8'),'port':0x18eb});var io=require(_0x4b1a('0x9'))(new Redis(config[_0x4b1a('0x6')]));function emit(_0x371066,_0x1547d9,_0x1c7149){io['to'](_0x371066)['emit'](_0x1547d9,_0x1c7149);}function request(_0x36f9ba){logger[_0x4b1a('0xa')](_0x4b1a('0xb'),JSON['stringify'](_0x36f9ba));return rp(_0x36f9ba);}function getCustomFields(_0x4ce96a,_0x309369){var _0x5b72c1={};if(_0x4ce96a[_0x4b1a('0xc')]>0x0){_[_0x4b1a('0xd')](_0x4ce96a,function(_0x2e8bef){if(_0x2e8bef['type']===_0x4b1a('0xe')&&_0x2e8bef['idField']){_0x5b72c1[_0x2e8bef['idField']]=_0x2e8bef['content']['toString']();}else if(_0x2e8bef['type']===_0x4b1a('0xf')&&_0x2e8bef['variableName']&&_0x2e8bef[_0x4b1a('0x10')]&&_0x309369[_0x2e8bef[_0x4b1a('0x11')]]){_0x5b72c1[_0x2e8bef['idField']]=_0x309369[_0x2e8bef['variableName']]['toString']();}else if(_0x2e8bef[_0x4b1a('0x12')]===_0x4b1a('0x13')&&_0x2e8bef[_0x4b1a('0x14')]&&_0x2e8bef[_0x4b1a('0x14')][_0x4b1a('0x15')]&&_0x2e8bef['idField']&&_0x309369[_0x2e8bef['Variable'][_0x4b1a('0x15')][_0x4b1a('0x16')]()]){_0x5b72c1[_0x2e8bef['idField']]=_0x309369[_0x2e8bef[_0x4b1a('0x14')][_0x4b1a('0x15')][_0x4b1a('0x16')]()][_0x4b1a('0x17')]();}});}return _0x5b72c1;}function getName(_0x5ec3b1){if(_0x5ec3b1['indexOf']('\x20')>0x0){var _0x977e9c=_0x5ec3b1[_0x4b1a('0x18')](/ (.+)/);if(_0x977e9c[0x1]){return _0x977e9c;}}return[_0x5ec3b1,_0x5ec3b1];}var accountsTokens={};function getAccessToken(_0x24cd32){return new Promise(function(_0x4ebeb9,_0x501ae1){if(!_[_0x4b1a('0x19')](accountsTokens[_0x24cd32['id']])&&!_[_0x4b1a('0x19')](accountsTokens[_0x24cd32['id']][_0x4b1a('0x1a')])){if(moment()[_0x4b1a('0x1b')](accountsTokens[_0x24cd32['id']]['expires_in'])){_0x4ebeb9(accountsTokens[_0x24cd32['id']][_0x4b1a('0x1a')]);}}var _0x33ef81;switch(_0x24cd32[_0x4b1a('0x1c')]){case'US':_0x33ef81=_0x4b1a('0x1d');break;case'AU':_0x33ef81=_0x4b1a('0x1e');break;case'EU':_0x33ef81=_0x4b1a('0x1f');break;case'IN':_0x33ef81=_0x4b1a('0x20');break;case'CN':_0x33ef81='https://accounts.zoho.com.cn';break;default:_0x33ef81=_0x4b1a('0x1f');break;}var _0x552eaa={'method':_0x4b1a('0x21'),'uri':_0x33ef81+_0x4b1a('0x22'),'qs':{'refresh_token':_0x24cd32[_0x4b1a('0x23')],'client_id':_0x24cd32[_0x4b1a('0x24')],'client_secret':_0x24cd32[_0x4b1a('0x25')],'grant_type':_0x4b1a('0x26')},'json':!![]};return rp(_0x552eaa)['then'](function(_0x26adeb){accountsTokens[_0x24cd32['id']]={'access_token':_0x26adeb[_0x4b1a('0x1a')],'expires_in':moment()[_0x4b1a('0x27')](_0x26adeb[_0x4b1a('0x28')],_0x4b1a('0x29'))};_0x4ebeb9(_0x26adeb[_0x4b1a('0x1a')]);})[_0x4b1a('0x2a')](function(_0x26f69a){logger[_0x4b1a('0x2b')](_0x4b1a('0x2c'),_0x26f69a[_0x4b1a('0x2d')]);_0x501ae1(_0x26f69a);});});}function getUser(_0x2a31ec,_0x28b23b,_0xfe8b5,_0x36bdf6){logger[_0x4b1a('0x2e')](_0x4b1a('0x2f'));return request({'method':_0x4b1a('0x30'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x28b23b),'qs':{'type':_0x4b1a('0x31')},'headers':{'Authorization':_0x4b1a('0x32')+_0x2a31ec},'json':!![]})[_0x4b1a('0x33')](function(_0x220058){if(_0x220058[_0x4b1a('0x34')]){var _0x3c6282=-0x1;if(_[_0x4b1a('0x35')](_0x220058[_0x4b1a('0x34')])){if(!_['isNil'](_0x36bdf6)){_0x3c6282=_[_0x4b1a('0x36')](_0x220058[_0x4b1a('0x34')],function(_0x5d0c7b){return _0x5d0c7b[_0x4b1a('0x37')]===_0x36bdf6;});}if(_0x3c6282>=0x0){logger[_0x4b1a('0x2e')](_0x4b1a('0x38'));}else{logger[_0x4b1a('0x2e')](_0x4b1a('0x39'));_0x3c6282=_['findIndex'](_0x220058[_0x4b1a('0x34')],function(_0x36190d){return _0x36190d[_0x4b1a('0x3a')][_0x4b1a('0x15')]===_0x4b1a('0x3b');});}return _0x220058[_0x4b1a('0x34')][_0x3c6282];}else{if(_0x220058[_0x4b1a('0x3c')][_0x4b1a('0x3a')]['name']===_0x4b1a('0x3b')){logger[_0x4b1a('0x2e')](_0x4b1a('0x39'));user=_0x220058['user'];return user;}else{logger['error'](_0x4b1a('0x3d'),JSON['stringify'](_0x220058));throw new Error(_0x4b1a('0x3e')+JSON[_0x4b1a('0x3f')](_0x220058));}}}else{logger[_0x4b1a('0x2b')](_0x4b1a('0x3d'),JSON['stringify'](_0x220058));throw new Error(_0x4b1a('0x3e')+JSON[_0x4b1a('0x3f')](_0x220058));}})['catch'](function(_0x2ef6aa){console['error'](_0x2ef6aa);});}function getZohoUser(_0x2f3811,_0x449d6d){return new BPromise(function(_0x600e3d,_0x541067){request(_0x2f3811)[_0x4b1a('0x33')](function(_0x944592){var _0x190bb1=null;if(_0x944592){_0x190bb1=_0x944592[_0x4b1a('0x40')][0x0];_0x190bb1[_0x4b1a('0x41')]=_0x449d6d;}_0x600e3d(_0x190bb1);})[_0x4b1a('0x2a')](function(_0x3e51a0){_0x541067(_0x3e51a0);});});}function createEndUser(_0x4065e8,_0x91a35c,_0x57d6d9,_0x2f493d,_0x712dc9,_0x3c82bc){var _0x57d6d9=getName(_0x57d6d9);return request({'method':_0x4b1a('0x21'),'uri':_0x4b1a('0x42')+_0x91a35c+_0x4b1a('0x43')+_[_0x4b1a('0x44')](_0x3c82bc[_0x4b1a('0x45')])+'s','body':{'data':[{'Last_Name':_0x57d6d9[0x1],'First_Name':_0x57d6d9[0x0],'Phone':_0x2f493d,'Owner':{'name':!_['isNil'](_0x712dc9[_0x4b1a('0x46')][_0x4b1a('0x15')])?_0x712dc9[_0x4b1a('0x46')][_0x4b1a('0x15')]:!_['isNil'](_0x712dc9['first_name'])?_0x712dc9['first_name']+'\x20'+_0x712dc9[_0x4b1a('0x47')]:_0x712dc9[_0x4b1a('0x47')],'id':_0x712dc9['id']}}]},'headers':{'Authorization':_0x4b1a('0x32')+_0x4065e8},'json':!![]})[_0x4b1a('0x33')](function(_0x1a5eb1){if(_0x1a5eb1&&_0x1a5eb1['data'][0x0][_0x4b1a('0x48')]===_0x4b1a('0x49')){var _0x32e7ac=_0x1a5eb1[_0x4b1a('0x40')][0x0][_0x4b1a('0x4a')];_0x32e7ac[_0x4b1a('0x41')]=_[_0x4b1a('0x44')](_0x3c82bc[_0x4b1a('0x45')])+'s';return _0x32e7ac;}logger[_0x4b1a('0x2b')](_0x4b1a('0x3d'),JSON[_0x4b1a('0x3f')](data));throw new Error(_0x4b1a('0x4b')+JSON[_0x4b1a('0x3f')](data));})['catch'](function(_0x35995e){console['log'](_0x4b1a('0x4c'),_0x35995e);});}function getEndUser(_0xd74236,_0x1cda0d,_0x2f2869,_0x2d545b,_0x35a9cd,_0x55a6ee,_0x177b13){var _0x6996b0={'method':_0x4b1a('0x30'),'uri':'','headers':{'Authorization':_0x4b1a('0x32')+_0xd74236},'json':!![]};switch(_0x177b13[_0x4b1a('0x4d')]){case'contact_lead':_0x6996b0['uri']='https://www.zohoapis.'+_0x1cda0d+_0x4b1a('0x4e')+_0x35a9cd+'))';return getZohoUser(_0x6996b0,_0x4b1a('0x4f'))[_0x4b1a('0x33')](function(_0x3d7bbb){if(_0x3d7bbb)return _0x3d7bbb;_0x6996b0[_0x4b1a('0x50')]=_0x4b1a('0x42')+_0x1cda0d+_0x4b1a('0x51')+_0x35a9cd+'))';return getZohoUser(_0x6996b0,'Leads')[_0x4b1a('0x33')](function(_0x335a88){if(_0x335a88)return _0x335a88;if(_0x177b13[_0x4b1a('0x45')]!=_0x4b1a('0x52')){return createEndUser(_0xd74236,_0x1cda0d,_0x2d545b,_0x35a9cd,_0x55a6ee,_0x177b13);}else{return{};}});});break;case'contact':_0x6996b0[_0x4b1a('0x50')]=_0x4b1a('0x42')+_0x1cda0d+_0x4b1a('0x4e')+_0x35a9cd+'))';return getZohoUser(_0x6996b0,_0x4b1a('0x4f'))[_0x4b1a('0x33')](function(_0x35966f){if(_0x35966f)return _0x35966f;if(_0x177b13[_0x4b1a('0x45')]!=_0x4b1a('0x52')){return createEndUser(_0xd74236,_0x1cda0d,_0x2d545b,_0x35a9cd,_0x55a6ee,_0x177b13);}else{return{};}});break;case'lead':_0x6996b0[_0x4b1a('0x50')]=_0x4b1a('0x42')+_0x1cda0d+_0x4b1a('0x51')+_0x35a9cd+'))';return getZohoUser(_0x6996b0,_0x4b1a('0x53'))[_0x4b1a('0x33')](function(_0x1043f1){if(_0x1043f1)return _0x1043f1;if(_0x177b13[_0x4b1a('0x45')]!=_0x4b1a('0x52')){return createEndUser(_0xd74236,_0x1cda0d,_0x2d545b,_0x35a9cd,_0x55a6ee,_0x177b13);}else{return{};}});break;}}function getCall(_0x10b18e,_0x4101b8,_0x3aa309,_0xbedac6,_0x502b02,_0x4d8d27,_0x43a1a2,_0x564e6a){logger['info'](_0x4b1a('0x54'));var _0x1b897c={};_0x1b897c[_0x4b1a('0x55')]={'name':!_[_0x4b1a('0x19')](_0xbedac6[_0x4b1a('0x46')][_0x4b1a('0x15')])&&!_[_0x4b1a('0x19')](_0xbedac6[_0x4b1a('0x3a')][_0x4b1a('0x15')])&&_0xbedac6[_0x4b1a('0x3a')][_0x4b1a('0x15')]===_0x4b1a('0x56')?_0xbedac6['role'][_0x4b1a('0x15')]:!_['isNil'](_0xbedac6[_0x4b1a('0x57')])?_0xbedac6['first_name']+'\x20'+_0xbedac6[_0x4b1a('0x47')]:_0xbedac6[_0x4b1a('0x47')],'id':_0xbedac6['id']};_0x1b897c['Subject']=intUtil[_0x4b1a('0x58')](_0x4d8d27[_0x4b1a('0x59')],_0x43a1a2,'\x20');_0x1b897c['Description']=intUtil[_0x4b1a('0x58')](_0x4d8d27[_0x4b1a('0x5a')],_0x43a1a2,'\x0a');if(_0x502b02[_0x4b1a('0x41')]===_0x4b1a('0x4f')){_0x1b897c[_0x4b1a('0x5b')]={'name':!_['isNil'](_0x502b02['Full_Name'])?_0x502b02[_0x4b1a('0x5c')]:!_['isNil'](_0x502b02[_0x4b1a('0x5d')])?_0x502b02[_0x4b1a('0x5d')]+'\x20'+_0x502b02[_0x4b1a('0x5e')]:_0x502b02[_0x4b1a('0x5e')],'id':_0x502b02['id']};}if(_0x502b02['enduserType']==='Leads'){_0x1b897c[_0x4b1a('0x5f')]={'name':!_[_0x4b1a('0x19')](_0x502b02[_0x4b1a('0x5c')])?_0x502b02[_0x4b1a('0x5c')]:!_[_0x4b1a('0x19')](_0x502b02[_0x4b1a('0x5d')])?_0x502b02[_0x4b1a('0x5d')]+'\x20'+_0x502b02[_0x4b1a('0x5e')]:_0x502b02['Last_Name'],'id':_0x502b02['id']};_0x1b897c[_0x4b1a('0x60')]=_[_0x4b1a('0x44')](_0x502b02[_0x4b1a('0x41')]);}if(_0x43a1a2[_0x4b1a('0x61')]){_0x1b897c[_0x4b1a('0x62')]=moment['utc'](parseInt(_0x43a1a2[_0x4b1a('0x61')])*0x3e8)[_0x4b1a('0x63')](_0x4b1a('0x64'));}else if(_0x43a1a2['answertime']&&_0x43a1a2[_0x4b1a('0x65')]){_0x1b897c[_0x4b1a('0x62')]=moment[_0x4b1a('0x66')](moment(_0x43a1a2[_0x4b1a('0x65')],_0x4b1a('0x67'))[_0x4b1a('0x68')](moment(_0x43a1a2[_0x4b1a('0x69')],_0x4b1a('0x67'))))[_0x4b1a('0x63')](_0x4b1a('0x64'));}switch(_0x43a1a2[_0x4b1a('0x6a')]){case _0x4b1a('0x6b'):_0x1b897c['Call_Result']='Called';break;case _0x4b1a('0x6c'):case _0x4b1a('0x6d'):_0x1b897c[_0x4b1a('0x6e')]=_0x4b1a('0x6f');break;case _0x4b1a('0x70'):_0x1b897c[_0x4b1a('0x6e')]=_0x4b1a('0x71');break;case _0x4b1a('0x72'):_0x1b897c[_0x4b1a('0x6e')]=_0x4b1a('0x73');break;case _0x4b1a('0x74'):_0x1b897c[_0x4b1a('0x6e')]=_0x4b1a('0x75');default:}_0x1b897c[_0x4b1a('0x76')]=(_0x564e6a==='outbound'?moment(_0x43a1a2[_0x4b1a('0x69')])[_0x4b1a('0x63')](_0x4b1a('0x67')):moment(_0x43a1a2['agentcalledAt'])[_0x4b1a('0x63')](_0x4b1a('0x67')))||moment()[_0x4b1a('0x63')](_0x4b1a('0x67'));_0x1b897c[_0x4b1a('0x77')]=_0x564e6a||_0x4b1a('0x78');_0x1b897c=_[_0x4b1a('0x79')](_0x1b897c,getCustomFields(_0x4d8d27['Fields'],_0x43a1a2));return request({'method':_0x4b1a('0x21'),'uri':_0x4b1a('0x42')+_0x4101b8+'/crm/v2/Calls','headers':{'Authorization':_0x4b1a('0x32')+_0x10b18e},'body':{'data':[_0x1b897c]},'json':!![]})['then'](function(_0x565920){if(_0x565920&&_0x565920['data'][0x0][_0x4b1a('0x48')]===_0x4b1a('0x49')){logger['info'](_0x4b1a('0x7a'));return{'id':_0x565920[_0x4b1a('0x40')][0x0][_0x4b1a('0x4a')]['id']};}})[_0x4b1a('0x2a')](function(_0x17ce49){logger['info'](_0x4b1a('0x7b'),_0x17ce49[_0x4b1a('0x2d')]);console['log'](_0x4b1a('0x7b'),_0x17ce49);});}exports[_0x4b1a('0x7c')]=function(_0x3a14af,_0x22afbf,_0x30a914,_0x1e1c93,_0x3f0aa7,_0x9758b0){var _0x32c540,_0x4bb87a,_0x2fe930;_0x9758b0[_0x4b1a('0x7d')]=intUtil[_0x4b1a('0x7e')](_0x9758b0[_0x4b1a('0x7d')]);_0x9758b0[_0x4b1a('0x7f')]=intUtil[_0x4b1a('0x7e')](_0x9758b0[_0x4b1a('0x7f')]);if(_0x3f0aa7&&_0x3f0aa7['monitor_format']){logger[_0x4b1a('0x2e')](_0x4b1a('0x80'),_0x4b1a('0x81'));_0x22afbf[_0x4b1a('0x82')]=_0x9758b0[_0x4b1a('0x7f')]+_0x4b1a('0x83')+_0x22afbf[_0x4b1a('0x84')]+_0x4b1a('0x85')+md5(_0x22afbf[_0x4b1a('0x84')]);}else{_0x22afbf[_0x4b1a('0x82')]='';}var _0x3d4974=_0x9758b0[_0x4b1a('0x7d')]===_0x4b1a('0x86')?'eu':_0x4b1a('0x87');return getAccessToken(_0x9758b0)[_0x4b1a('0x33')](function(_0x5e242e){_0x2fe930=_0x5e242e;return getUser(_0x2fe930,_0x3d4974,_0x9758b0,_0x1e1c93[_0x4b1a('0x37')]);})['then'](function(_0x4ada8a){_0x32c540=_0x4ada8a;logger[_0x4b1a('0x2e')](_0x4b1a('0x88'),_0x32c540['id']);return getEndUser(_0x2fe930,_0x3d4974,_0x9758b0,_0x22afbf[_0x4b1a('0x89')],_0x22afbf[_0x4b1a('0x8a')],_0x32c540,_0x30a914);})[_0x4b1a('0x33')](function(_0x3de090){_0x4bb87a=_0x3de090;return getCall(_0x2fe930,_0x3d4974,_0x9758b0,_0x32c540,_0x4bb87a,_0x30a914,_0x22afbf,_0x4b1a('0x78'));})['then'](function(_0x2bbc56){if(_0x2bbc56){logger[_0x4b1a('0x2e')]('The\x20Call\x20ID\x20is:',_0x2bbc56['id']);logger['info'](_0x4b1a('0x80'),_0x4b1a('0x8b'));emit(util[_0x4b1a('0x63')](_0x4b1a('0x8c'),_0x1e1c93[_0x4b1a('0x15')]),'trigger:browser:url',{'uri':_0x4b1a('0x8d')+_0x9758b0[_0x4b1a('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2bbc56['id']});}})[_0x4b1a('0x2a')](function(_0x491e66){logger['error']('[QUEUE]',JSON['stringify'](_0x491e66));});};exports[_0x4b1a('0x8e')]=function(_0x168f25,_0x2434dc,_0x36fae4,_0x6674de,_0x26185e,_0x552cbe,_0x501722){var _0x1092bb,_0x50e2e0,_0x2beb22;_0x552cbe[_0x4b1a('0x7d')]=intUtil[_0x4b1a('0x7e')](_0x552cbe[_0x4b1a('0x7d')]);_0x552cbe['serverUrl']=intUtil['stripTrailingSlash'](_0x552cbe['serverUrl']);if(_0x501722&&_0x501722[_0x4b1a('0x8f')]&&_0x501722[_0x4b1a('0x8f')]!==_0x4b1a('0x90')){logger[_0x4b1a('0x2e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2434dc[_0x4b1a('0x82')]=_0x552cbe[_0x4b1a('0x7f')]+'/api/voice/recordings/'+_0x2434dc[_0x4b1a('0x84')]+_0x4b1a('0x85')+md5(_0x2434dc['uniqueid']);}var _0x759a3e=_0x552cbe['host']===_0x4b1a('0x86')?'eu':_0x4b1a('0x87');return getAccessToken(_0x552cbe)[_0x4b1a('0x33')](function(_0x18153d){_0x2beb22=_0x18153d;return getUser(_0x2beb22,_0x759a3e,_0x552cbe,_0x6674de['email']);})[_0x4b1a('0x33')](function(_0x207b16){_0x1092bb=_0x207b16;logger[_0x4b1a('0x2e')](_0x4b1a('0x88'),_0x1092bb['id']);return getEndUser(_0x2beb22,_0x759a3e,_0x552cbe,_0x2434dc[_0x4b1a('0x91')],_0x2434dc[_0x4b1a('0x92')],_0x1092bb,_0x36fae4);})[_0x4b1a('0x33')](function(_0x8618c3){_0x50e2e0=_0x8618c3;return getCall(_0x2beb22,_0x759a3e,_0x552cbe,_0x1092bb,_0x50e2e0,_0x36fae4,_0x2434dc,'Outbound');})[_0x4b1a('0x33')](function(_0x3a2cdf){if(_0x3a2cdf){logger[_0x4b1a('0x2e')](_0x4b1a('0x93'),_0x3a2cdf['id']);logger['info']('[OUTBOUND]',_0x4b1a('0x8b'));emit(util['format'](_0x4b1a('0x8c'),_0x6674de[_0x4b1a('0x15')]),_0x4b1a('0x94'),{'uri':_0x4b1a('0x8d')+_0x552cbe['host']+_0x4b1a('0x95')+_0x3a2cdf['id']});}})[_0x4b1a('0x2a')](function(_0x56834e){logger[_0x4b1a('0x2b')](_0x4b1a('0x96'),JSON[_0x4b1a('0x3f')](_0x56834e));});};exports[_0x4b1a('0x97')]=function(_0x5e77a1,_0x148e5b,_0x5d970a,_0x2cb0dc,_0x2fd806,_0x1bd4fe){var _0x5032e3,_0x2430a1,_0x28d012;_0x1bd4fe[_0x4b1a('0x7d')]=intUtil[_0x4b1a('0x7e')](_0x1bd4fe[_0x4b1a('0x7d')]);_0x1bd4fe[_0x4b1a('0x7f')]=intUtil[_0x4b1a('0x7e')](_0x1bd4fe[_0x4b1a('0x7f')]);if(_0x2fd806&&_0x2fd806[_0x4b1a('0x98')]){logger[_0x4b1a('0x2e')]('['+_0x148e5b[_0x4b1a('0x6a')][_0x4b1a('0x99')]()+']',_0x4b1a('0x81'));_0x148e5b[_0x4b1a('0x82')]=_0x1bd4fe[_0x4b1a('0x7f')]+_0x4b1a('0x83')+_0x148e5b[_0x4b1a('0x84')]+_0x4b1a('0x85')+md5(_0x148e5b['uniqueid']);}else{_0x148e5b[_0x4b1a('0x82')]='';}var _0x3501b2=_0x1bd4fe[_0x4b1a('0x7d')]==='zoho.eu'?'eu':_0x4b1a('0x87');return getAccessToken(_0x1bd4fe)[_0x4b1a('0x33')](function(_0x42a9e6){_0x28d012=_0x42a9e6;return getUser(_0x28d012,_0x3501b2,_0x1bd4fe);})[_0x4b1a('0x33')](function(_0x223f67){_0x5032e3=_0x223f67;logger[_0x4b1a('0x2e')]('The\x20User\x20ID\x20is:',_0x5032e3['id']);return getEndUser(_0x28d012,_0x3501b2,_0x1bd4fe,_0x148e5b[_0x4b1a('0x89')],_0x148e5b[_0x4b1a('0x8a')],_0x5032e3,_0x5d970a);})[_0x4b1a('0x33')](function(_0x2544ac){_0x2430a1=_0x2544ac;return getCall(_0x28d012,_0x3501b2,_0x1bd4fe,_0x5032e3,_0x2430a1,_0x5d970a,_0x148e5b,'Inbound');})[_0x4b1a('0x33')](function(_0x16bc8a){if(_0x16bc8a){logger['info'](_0x4b1a('0x93'),_0x16bc8a['id']);}})[_0x4b1a('0x2a')](function(_0x47b966){logger[_0x4b1a('0x2b')]('['+_0x148e5b[_0x4b1a('0x6a')][_0x4b1a('0x99')]()+']',JSON[_0x4b1a('0x3f')](_0x47b966));});}; \ 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 f2557c3..aea527d 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(_0x1c4d65,_0x5e576c){var _0x4fa4d7=function(_0x1dc733){while(--_0x1dc733){_0x1c4d65['push'](_0x1c4d65['shift']());}};_0x4fa4d7(++_0x5e576c);}(_0x7a54,0x106));var _0x47a5=function(_0x1285c1,_0x4d9414){_0x1285c1=_0x1285c1-0x0;var _0x44539b=_0x7a54[_0x1285c1];return _0x44539b;};'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(_0x597deb,_0x4a5cb9){var _0x498d42=function(_0x1b24f6){while(--_0x1b24f6){_0x597deb['push'](_0x597deb['shift']());}};_0x498d42(++_0x4a5cb9);}(_0x7a54,0x106));var _0x47a5=function(_0x59cfd9,_0x3f7f64){_0x59cfd9=_0x59cfd9-0x0;var _0x3d1f7d=_0x7a54[_0x59cfd9];return _0x3d1f7d;};'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 ab6d1fc..5b9dafd 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x412775,_0x1e0c7d){var _0x999c27=function(_0x238722){while(--_0x238722){_0x412775['push'](_0x412775['shift']());}};_0x999c27(++_0x1e0c7d);}(_0x7a54,0x106));var _0x47a5=function(_0x275263,_0x5f308a){_0x275263=_0x275263-0x0;var _0x5d66eb=_0x7a54[_0x275263];return _0x5d66eb;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x35476d,_0x2787cf){var _0x2dde22=function(_0x34517c){while(--_0x34517c){_0x35476d['push'](_0x35476d['shift']());}};_0x2dde22(++_0x2787cf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57cf9c,_0xa943c1){_0x57cf9c=_0x57cf9c-0x0;var _0xb8ef77=_0x5f2f[_0x57cf9c];return _0xb8ef77;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 30fe728..8fd44e8 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 _0xa9b1=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','../../config/logger'];(function(_0x479fca,_0x5466c5){var _0x5f0526=function(_0x295081){while(--_0x295081){_0x479fca['push'](_0x479fca['shift']());}};_0x5f0526(++_0x5466c5);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1a9b('0x0'))(_0x1a9b('0x1'));var client=jayson[_0x1a9b('0x2')][_0x1a9b('0x3')]({'port':0x2329});client[_0x1a9b('0x4')]=function(_0x10c90c,_0x52f55f){return new BPromise(function(_0x57b453,_0x4914cd){return client[_0x1a9b('0x5')](_0x10c90c,_0x52f55f)[_0x1a9b('0x6')](function(_0x1a78b6){logger[_0x1a9b('0x7')](_0x1a9b('0x8'),_0x1a9b('0x1'),_0x10c90c,_0x52f55f,_0x1a78b6);if(_0x1a78b6[_0x1a9b('0x9')]){logger[_0x1a9b('0x9')](_0x1a9b('0x8'),_0x1a9b('0x1'),_0x10c90c,_0x1a78b6[_0x1a9b('0x9')][_0x1a9b('0xa')],_0x52f55f);return _0x4914cd(_0x1a78b6['error']['message']);}else{return _0x57b453(_0x1a78b6[_0x1a9b('0xb')]);}})[_0x1a9b('0xc')](function(_0x2c2ee4){logger['error']('rpc','routing',_0x10c90c,_0x2c2ee4,_0x52f55f);return _0x4914cd(_0x2c2ee4);});});};module[_0x1a9b('0xd')]=client; \ No newline at end of file +var _0xd6d6=['Request','request','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','http'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5d3d84,_0x52a94f){_0x5d3d84=_0x5d3d84-0x0;var _0x327a47=_0xd6d6[_0x5d3d84];return _0x327a47;};'use strict';var jayson=require(_0x6d6d('0x0'));var BPromise=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var client=jayson['client'][_0x6d6d('0x4')]({'port':0x2329});client[_0x6d6d('0x5')]=function(_0x1b8610,_0x2a838a){return new BPromise(function(_0x5207c9,_0x16e259){return client[_0x6d6d('0x6')](_0x1b8610,_0x2a838a)['then'](function(_0x210ff7){logger[_0x6d6d('0x7')](_0x6d6d('0x8'),_0x6d6d('0x3'),_0x1b8610,_0x2a838a,_0x210ff7);if(_0x210ff7[_0x6d6d('0x9')]){logger[_0x6d6d('0x9')](_0x6d6d('0x8'),'routing',_0x1b8610,_0x210ff7['error'][_0x6d6d('0xa')],_0x2a838a);return _0x16e259(_0x210ff7[_0x6d6d('0x9')][_0x6d6d('0xa')]);}else{return _0x5207c9(_0x210ff7[_0x6d6d('0xb')]);}})[_0x6d6d('0xc')](function(_0x576c88){logger[_0x6d6d('0x9')](_0x6d6d('0x8'),'routing',_0x1b8610,_0x576c88,_0x2a838a);return _0x16e259(_0x576c88);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4db1241..7187b60 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 _0xb4c7=['./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime'];(function(_0x16b004,_0x87a359){var _0x1d955c=function(_0x564ba7){while(--_0x564ba7){_0x16b004['push'](_0x16b004['shift']());}};_0x1d955c(++_0x87a359);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x441c0b,_0x42b3a4){_0x441c0b=_0x441c0b-0x0;var _0x30b0da=_0xb4c7[_0x441c0b];return _0x30b0da;};'use strict';var BPromise=require(_0x7b4c('0x0'));var server=require(_0x7b4c('0x1'));var Realtime=require(_0x7b4c('0x2'));var EmailChannel=require(_0x7b4c('0x3'));var mailAccount=require(_0x7b4c('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x7b4c('0x5')]()[_0x7b4c('0x6')](mailAccount[_0x7b4c('0x7')]())[_0x7b4c('0x6')](realtime[_0x7b4c('0x8')]())['then'](function(){email[_0x7b4c('0x9')](realtime[_0x7b4c('0xa')]);return realtime;});}function main(){return server[_0x7b4c('0xb')](realtime,email)['then'](function(_0x2d7b7e){return initRealtime();})[_0x7b4c('0x6')](function(_0x570daa){return db[_0x7b4c('0xc')][_0x7b4c('0xd')]({'attributes':['id',_0x7b4c('0xe')],'raw':!![]});})[_0x7b4c('0x6')](function(_0x365225){return setInterval(initRealtime,_0x365225[_0x7b4c('0xe')]*0x3e8);})[_0x7b4c('0xf')](function(_0xc62104){console[_0x7b4c('0x10')](_0xc62104);});}main(); \ No newline at end of file +var _0x7fd6=['Setting','findOne','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','listen'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fd6,0x157));var _0x67fd=function(_0x259847,_0xd05c7f){_0x259847=_0x259847-0x0;var _0x574c15=_0x7fd6[_0x259847];return _0x574c15;};'use strict';var BPromise=require(_0x67fd('0x0'));var server=require('./server');var Realtime=require(_0x67fd('0x1'));var EmailChannel=require(_0x67fd('0x2'));var mailAccount=require(_0x67fd('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x67fd('0x4'))['db'];function initRealtime(){return BPromise[_0x67fd('0x5')]()[_0x67fd('0x6')](mailAccount['getMailAccounts']())[_0x67fd('0x6')](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x67fd('0x7')](realtime,email)[_0x67fd('0x6')](function(_0x21d7b1){return initRealtime();})[_0x67fd('0x6')](function(_0x74be46){return db[_0x67fd('0x8')][_0x67fd('0x9')]({'attributes':['id',_0x67fd('0xa')],'raw':!![]});})['then'](function(_0x25ce35){return setInterval(initRealtime,_0x25ce35[_0x67fd('0xa')]*0x3e8);})[_0x67fd('0xb')](function(_0x65f39c){console[_0x67fd('0xc')](_0x65f39c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7d7c4c7..688cad1 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 _0x1465=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','messages'];(function(_0x38db3a,_0x244702){var _0x2ead95=function(_0x558eab){while(--_0x558eab){_0x38db3a['push'](_0x38db3a['shift']());}};_0x2ead95(++_0x244702);}(_0x1465,0x1cf));var _0x5146=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0x1465[_0x4da356];return _0x321b07;};'use strict';var _=require(_0x5146('0x0'));var moment=require(_0x5146('0x1'));var BPromise=require(_0x5146('0x2'));var md5=require(_0x5146('0x3'));var Redis=require(_0x5146('0x4'));var config=require(_0x5146('0x5'));var logger=require(_0x5146('0x6'))(_0x5146('0x7'));config['redis']=_[_0x5146('0x8')](config['redis'],{'host':_0x5146('0x9'),'port':0x18eb});var io=require(_0x5146('0xa'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x5146('0xb'));var mailAccount=require(_0x5146('0xc'));var md5Accounts={};function EmailChannel(_0x3874e8){logger[_0x5146('0xd')]('start\x20email\x20channel');this[_0x5146('0xe')]=_0x3874e8[_0x5146('0xe')];this[_0x5146('0xf')]={};this[_0x5146('0x10')]=new EmailSmtp();}EmailChannel[_0x5146('0x11')][_0x5146('0x12')]=function(_0x39bb5b){var _0x243b0d=this['mailAccounts'][_0x39bb5b];var _0x803da5={'id':_0x243b0d['id'],'name':_0x243b0d[_0x5146('0x13')],'key':_0x243b0d[_0x5146('0x14')],'active':_0x243b0d[_0x5146('0x15')],'Imap':{'status':_0x243b0d[_0x5146('0x16')][_0x5146('0x17')],'messageStatus':_0x243b0d[_0x5146('0x16')][_0x5146('0x18')],'total':_0x243b0d['Imap'][_0x5146('0x19')]}};if(_[_0x5146('0x1a')](md5Accounts[_0x39bb5b])){md5Accounts[_0x39bb5b]={};}var _0x5e807c=md5(JSON[_0x5146('0x1b')](_0x803da5));if(md5Accounts[_0x39bb5b][_0x5146('0x3')]!==_0x5e807c){md5Accounts[_0x39bb5b][_0x5146('0x3')]=_0x5e807c;io[_0x5146('0x12')](_0x5146('0x1c'),_0x803da5);}};EmailChannel['prototype'][_0x5146('0x1d')]=function(_0x503149){for(var _0x4b95cf in _0x503149){if(_0x503149[_0x5146('0x1e')](_0x4b95cf)){if(_0x503149[_0x4b95cf][_0x5146('0x16')]&&_0x503149[_0x4b95cf][_0x5146('0x15')]){var _0x499853=_0x503149[_0x4b95cf]['Imap'];if(!this['imapAccounts']['hasOwnProperty'](_0x499853['id'])){this[_0x5146('0xf')][_0x499853['id']]=new EmailImap(_0x499853,_0x503149[_0x4b95cf][_0x5146('0x7')]);this[_0x5146('0xf')][_0x499853['id']]['on'](_0x5146('0x1f'),this['handleImapBox'][_0x5146('0x20')](this,_0x4b95cf));this[_0x5146('0xf')][_0x499853['id']]['on'](_0x5146('0x7'),this[_0x5146('0x21')][_0x5146('0x20')](this,_0x4b95cf));this[_0x5146('0xf')][_0x499853['id']]['on'](_0x5146('0x22'),this[_0x5146('0x23')][_0x5146('0x20')](this,_0x4b95cf));this[_0x5146('0xf')][_0x499853['id']]['on'](_0x5146('0x24'),this[_0x5146('0x25')]['bind'](this,_0x4b95cf));}}else{if(_['isNil'](this['mailAccounts'][_0x4b95cf][_0x5146('0x16')])){this['mailAccounts'][_0x4b95cf][_0x5146('0x16')]={};}this[_0x5146('0xe')][_0x4b95cf][_0x5146('0x16')][_0x5146('0x17')]=_0x5146('0x26');this['mailAccounts'][_0x4b95cf][_0x5146('0x16')]['messageStatus']='';this[_0x5146('0x12')](_0x4b95cf);}}}};EmailChannel['prototype'][_0x5146('0x27')]=function(_0x4eb281,_0x45c485){if(this[_0x5146('0xe')][_0x4eb281]){this[_0x5146('0xe')][_0x4eb281][_0x5146('0x16')]['status']='connected';this['mailAccounts'][_0x4eb281]['Imap']['messageStatus']=_0x45c485[_0x5146('0x13')];if(_0x45c485[_0x5146('0x28')]){this['mailAccounts'][_0x4eb281][_0x5146('0x16')][_0x5146('0x19')]=_0x45c485['messages']['total'];}return this['emit'](_0x4eb281);}};EmailChannel[_0x5146('0x11')][_0x5146('0x21')]=function(_0x52325c,_0x20b323){logger[_0x5146('0xd')](_0x5146('0x29'),_0x20b323[_0x5146('0x2a')],_0x20b323[_0x5146('0x2b')],_0x20b323['from'],_0x52325c);if(this[_0x5146('0xe')][_0x52325c]){return mailAccount[_0x5146('0x2c')](_0x52325c,_0x20b323)[_0x5146('0x2d')](function(_0x42e577){if(_0x42e577){logger[_0x5146('0xd')](_0x5146('0x2e'));}})['catch'](function(_0x2be034){logger[_0x5146('0x24')](_0x5146('0x2f'),JSON[_0x5146('0x1b')](_0x2be034));});}};EmailChannel[_0x5146('0x11')]['handleImapEnd']=function(_0x15b64c){if(this[_0x5146('0xe')][_0x15b64c]&&this[_0x5146('0xe')][_0x15b64c][_0x5146('0x16')]){if(this['imapAccounts'][this[_0x5146('0xe')][_0x15b64c][_0x5146('0x16')]['id']]){delete this[_0x5146('0xf')][this[_0x5146('0xe')][_0x15b64c]['Imap']['id']];}this[_0x5146('0xe')][_0x15b64c][_0x5146('0x16')]['lastSync']=moment();this[_0x5146('0x12')](_0x15b64c);}};EmailChannel[_0x5146('0x11')][_0x5146('0x25')]=function(_0x57d74a,_0x212625){if(this['mailAccounts'][_0x57d74a]){this['mailAccounts'][_0x57d74a][_0x5146('0x16')][_0x5146('0x17')]=_0x5146('0x24');this['mailAccounts'][_0x57d74a][_0x5146('0x16')][_0x5146('0x18')]=_0x212625;return this['emit'](_0x57d74a);}};EmailChannel[_0x5146('0x11')][_0x5146('0x30')]=function(_0x1a8be3,_0xa5d6b3){return this[_0x5146('0x10')][_0x5146('0x31')](_0x1a8be3,_0xa5d6b3);};EmailChannel['prototype'][_0x5146('0x32')]=function(_0x22fa6e){var _0x3c3960=this;if(this[_0x5146('0xe')][_0x22fa6e['id']]){if(_[_0x5146('0x1a')](this['mailAccounts'][_0x22fa6e['id']][_0x5146('0x33')])){this['mailAccounts'][_0x22fa6e['id']][_0x5146('0x33')]={};}this[_0x5146('0xe')][_0x22fa6e['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x12eb75,_0x2bbb79){return _0x3c3960[_0x5146('0x10')][_0x5146('0x34')](_0x22fa6e)[_0x5146('0x2d')](function(_0x4ad19f){_0x3c3960[_0x5146('0xe')][_0x22fa6e['id']][_0x5146('0x33')]['status']=_0x5146('0x35');_0x3c3960[_0x5146('0xe')][_0x22fa6e['id']][_0x5146('0x33')][_0x5146('0x18')]='';_0x3c3960[_0x5146('0x12')](_0x22fa6e['id']);_0x12eb75(_0x4ad19f);})[_0x5146('0x36')](function(_0x1509c3){_0x3c3960[_0x5146('0xe')][_0x22fa6e['id']][_0x5146('0x33')][_0x5146('0x17')]=_0x5146('0x24');_0x3c3960[_0x5146('0xe')][_0x22fa6e['id']]['Smtp'][_0x5146('0x18')]=_0x1509c3;_0x3c3960[_0x5146('0x12')](_0x22fa6e['id']);_0x2bbb79(_0x1509c3);});});}return this[_0x5146('0x10')][_0x5146('0x34')](_0x22fa6e);};module[_0x5146('0x37')]=EmailChannel; \ No newline at end of file +var _0x9bd8=['bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','mailAccount:update','prototype','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapError','isNil','disabled','messageStatus','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','error','send','verifySmtp','Smtp','verify','verified','exports','lodash'];(function(_0x2b9d17,_0x54e510){var _0x59522d=function(_0x50c86d){while(--_0x50c86d){_0x2b9d17['push'](_0x2b9d17['shift']());}};_0x59522d(++_0x54e510);}(_0x9bd8,0xdb));var _0x89bd=function(_0x1eb4e0,_0x4ebc2d){_0x1eb4e0=_0x1eb4e0-0x0;var _0x18ec21=_0x9bd8[_0x1eb4e0];return _0x18ec21;};'use strict';var _=require(_0x89bd('0x0'));var moment=require('moment');var BPromise=require(_0x89bd('0x1'));var md5=require(_0x89bd('0x2'));var Redis=require(_0x89bd('0x3'));var config=require(_0x89bd('0x4'));var logger=require(_0x89bd('0x5'))(_0x89bd('0x6'));config[_0x89bd('0x7')]=_[_0x89bd('0x8')](config[_0x89bd('0x7')],{'host':_0x89bd('0x9'),'port':0x18eb});var io=require(_0x89bd('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x89bd('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x89bd('0xc'));var md5Accounts={};function EmailChannel(_0x7b31f2){logger[_0x89bd('0xd')](_0x89bd('0xe'));this[_0x89bd('0xf')]=_0x7b31f2[_0x89bd('0xf')];this[_0x89bd('0x10')]={};this[_0x89bd('0x11')]=new EmailSmtp();}EmailChannel['prototype'][_0x89bd('0x12')]=function(_0x3ed9e2){var _0x58c528=this['mailAccounts'][_0x3ed9e2];var _0x3ed137={'id':_0x58c528['id'],'name':_0x58c528[_0x89bd('0x13')],'key':_0x58c528[_0x89bd('0x14')],'active':_0x58c528[_0x89bd('0x15')],'Imap':{'status':_0x58c528[_0x89bd('0x16')][_0x89bd('0x17')],'messageStatus':_0x58c528[_0x89bd('0x16')]['messageStatus'],'total':_0x58c528[_0x89bd('0x16')]['total']}};if(_['isNil'](md5Accounts[_0x3ed9e2])){md5Accounts[_0x3ed9e2]={};}var _0x6aeef0=md5(JSON['stringify'](_0x3ed137));if(md5Accounts[_0x3ed9e2][_0x89bd('0x2')]!==_0x6aeef0){md5Accounts[_0x3ed9e2][_0x89bd('0x2')]=_0x6aeef0;io[_0x89bd('0x12')](_0x89bd('0x18'),_0x3ed137);}};EmailChannel[_0x89bd('0x19')][_0x89bd('0x1a')]=function(_0x577a77){for(var _0x2caaff in _0x577a77){if(_0x577a77[_0x89bd('0x1b')](_0x2caaff)){if(_0x577a77[_0x2caaff][_0x89bd('0x16')]&&_0x577a77[_0x2caaff][_0x89bd('0x15')]){var _0x3570c7=_0x577a77[_0x2caaff]['Imap'];if(!this['imapAccounts'][_0x89bd('0x1b')](_0x3570c7['id'])){this[_0x89bd('0x10')][_0x3570c7['id']]=new EmailImap(_0x3570c7,_0x577a77[_0x2caaff][_0x89bd('0x6')]);this[_0x89bd('0x10')][_0x3570c7['id']]['on'](_0x89bd('0x1c'),this[_0x89bd('0x1d')][_0x89bd('0x1e')](this,_0x2caaff));this[_0x89bd('0x10')][_0x3570c7['id']]['on'](_0x89bd('0x6'),this[_0x89bd('0x1f')][_0x89bd('0x1e')](this,_0x2caaff));this[_0x89bd('0x10')][_0x3570c7['id']]['on'](_0x89bd('0x20'),this['handleImapEnd'][_0x89bd('0x1e')](this,_0x2caaff));this[_0x89bd('0x10')][_0x3570c7['id']]['on']('error',this[_0x89bd('0x21')][_0x89bd('0x1e')](this,_0x2caaff));}}else{if(_[_0x89bd('0x22')](this[_0x89bd('0xf')][_0x2caaff][_0x89bd('0x16')])){this['mailAccounts'][_0x2caaff][_0x89bd('0x16')]={};}this[_0x89bd('0xf')][_0x2caaff]['Imap'][_0x89bd('0x17')]=_0x89bd('0x23');this[_0x89bd('0xf')][_0x2caaff]['Imap'][_0x89bd('0x24')]='';this[_0x89bd('0x12')](_0x2caaff);}}}};EmailChannel['prototype'][_0x89bd('0x1d')]=function(_0x381e3b,_0x34d47c){if(this['mailAccounts'][_0x381e3b]){this[_0x89bd('0xf')][_0x381e3b][_0x89bd('0x16')]['status']=_0x89bd('0x25');this[_0x89bd('0xf')][_0x381e3b]['Imap'][_0x89bd('0x24')]=_0x34d47c[_0x89bd('0x13')];if(_0x34d47c[_0x89bd('0x26')]){this['mailAccounts'][_0x381e3b][_0x89bd('0x16')][_0x89bd('0x27')]=_0x34d47c['messages']['total'];}return this[_0x89bd('0x12')](_0x381e3b);}};EmailChannel[_0x89bd('0x19')][_0x89bd('0x1f')]=function(_0x2f45f7,_0x42ee05){logger[_0x89bd('0xd')](_0x89bd('0x28'),_0x42ee05['firstName'],_0x42ee05[_0x89bd('0x29')],_0x42ee05['from'],_0x2f45f7);if(this[_0x89bd('0xf')][_0x2f45f7]){return mailAccount['notify'](_0x2f45f7,_0x42ee05)[_0x89bd('0x2a')](function(_0x43d250){if(_0x43d250){logger['info'](_0x89bd('0x2b'));}})[_0x89bd('0x2c')](function(_0xfee4f6){logger['error'](_0x89bd('0x2d'),JSON[_0x89bd('0x2e')](_0xfee4f6));});}};EmailChannel[_0x89bd('0x19')][_0x89bd('0x2f')]=function(_0x1f233b){if(this['mailAccounts'][_0x1f233b]&&this[_0x89bd('0xf')][_0x1f233b][_0x89bd('0x16')]){if(this[_0x89bd('0x10')][this[_0x89bd('0xf')][_0x1f233b][_0x89bd('0x16')]['id']]){delete this[_0x89bd('0x10')][this['mailAccounts'][_0x1f233b][_0x89bd('0x16')]['id']];}this[_0x89bd('0xf')][_0x1f233b]['Imap']['lastSync']=moment();this[_0x89bd('0x12')](_0x1f233b);}};EmailChannel[_0x89bd('0x19')][_0x89bd('0x21')]=function(_0x3437c6,_0xdf7238){if(this[_0x89bd('0xf')][_0x3437c6]){this[_0x89bd('0xf')][_0x3437c6][_0x89bd('0x16')][_0x89bd('0x17')]=_0x89bd('0x30');this[_0x89bd('0xf')][_0x3437c6][_0x89bd('0x16')][_0x89bd('0x24')]=_0xdf7238;return this[_0x89bd('0x12')](_0x3437c6);}};EmailChannel[_0x89bd('0x19')]['sendMail']=function(_0x73fa43,_0x51305a){return this['smtp'][_0x89bd('0x31')](_0x73fa43,_0x51305a);};EmailChannel[_0x89bd('0x19')][_0x89bd('0x32')]=function(_0x8b6f88){var _0x2b4b4e=this;if(this[_0x89bd('0xf')][_0x8b6f88['id']]){if(_[_0x89bd('0x22')](this[_0x89bd('0xf')][_0x8b6f88['id']][_0x89bd('0x33')])){this['mailAccounts'][_0x8b6f88['id']][_0x89bd('0x33')]={};}this[_0x89bd('0xf')][_0x8b6f88['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x16ac94,_0x302b56){return _0x2b4b4e[_0x89bd('0x11')][_0x89bd('0x34')](_0x8b6f88)[_0x89bd('0x2a')](function(_0x1397c9){_0x2b4b4e['mailAccounts'][_0x8b6f88['id']][_0x89bd('0x33')]['status']=_0x89bd('0x35');_0x2b4b4e[_0x89bd('0xf')][_0x8b6f88['id']][_0x89bd('0x33')]['messageStatus']='';_0x2b4b4e[_0x89bd('0x12')](_0x8b6f88['id']);_0x16ac94(_0x1397c9);})[_0x89bd('0x2c')](function(_0x18fd07){_0x2b4b4e[_0x89bd('0xf')][_0x8b6f88['id']][_0x89bd('0x33')][_0x89bd('0x17')]=_0x89bd('0x30');_0x2b4b4e[_0x89bd('0xf')][_0x8b6f88['id']][_0x89bd('0x33')][_0x89bd('0x24')]=_0x18fd07;_0x2b4b4e[_0x89bd('0x12')](_0x8b6f88['id']);_0x302b56(_0x18fd07);});});}return this[_0x89bd('0x11')]['verify'](_0x8b6f88);};module[_0x89bd('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 6c09a5b..929791a 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 _0x1862=['account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','handleFetchError','closeBox','textCode','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX'];(function(_0x41cc41,_0x4af08b){var _0x5fce79=function(_0x54040e){while(--_0x54040e){_0x41cc41['push'](_0x41cc41['shift']());}};_0x5fce79(++_0x4af08b);}(_0x1862,0x12c));var _0x2186=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1862[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x2186('0x0'));var util=require(_0x2186('0x1'));var Imap=require(_0x2186('0x2'));var _=require(_0x2186('0x3'));var rs=require(_0x2186('0x4'));var simpleParser=require(_0x2186('0x5'))[_0x2186('0x6')];var Iconv=require('iconv')[_0x2186('0x7')];var EventEmitter=require(_0x2186('0x8'))[_0x2186('0x9')];var utils=require(_0x2186('0xa'));var logger=require(_0x2186('0xb'))(_0x2186('0xc'));function EmailImap(_0x210f5a,_0x5af8a6){this[_0x2186('0xd')]=_0x2186('0xe');this[_0x2186('0xf')]=this[_0x2186('0x10')](_0x210f5a,_0x5af8a6);this[_0x2186('0x2')]=new Imap(this['account']);this['imap'][_0x2186('0x11')](_0x2186('0x12'),this[_0x2186('0x13')][_0x2186('0x14')](this));this['imap']['once'](_0x2186('0x15'),this[_0x2186('0x16')][_0x2186('0x14')](this));this[_0x2186('0x2')]['on'](_0x2186('0x17'),this[_0x2186('0x18')]['bind'](this));this[_0x2186('0x2')][_0x2186('0x19')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x2186('0x1a')][_0x2186('0x10')]=function(_0x3fb01d,_0x3bf1c8){var _0x49ed07={'connTimeout':_0x3fb01d[_0x2186('0x1b')]?_0x3fb01d[_0x2186('0x1b')]*0x3e8:0x2710,'authTimeout':_0x3fb01d['authTimeout']?_0x3fb01d[_0x2186('0x1c')]*0x3e8:0x1388};if(_[_0x2186('0x1d')](_0x3fb01d[_0x2186('0x1e')])){if(_0x3fb01d['authentication']){_0x49ed07[_0x2186('0x1f')]=_0x3fb01d['user'];_0x49ed07[_0x2186('0x20')]=_0x3fb01d[_0x2186('0x20')];}_0x49ed07[_0x2186('0x21')]=_0x3fb01d[_0x2186('0x21')];_0x49ed07[_0x2186('0x22')]=_0x3fb01d['port']||0x3e1;if(_0x3fb01d[_0x2186('0x23')]){_0x49ed07[_0x2186('0x23')]=!![];}else{_0x49ed07[_0x2186('0x23')]=![];_0x49ed07[_0x2186('0x24')]=_0x2186('0x25');}}else{_0x49ed07[_0x2186('0x1f')]=_0x3fb01d[_0x2186('0x1f')];_0x49ed07[_0x2186('0x20')]=_0x3fb01d[_0x2186('0x20')];_0x49ed07[_0x2186('0x21')]=utils[_0x2186('0x26')](_0x3fb01d[_0x2186('0x1e')]);_0x49ed07['port']=0x3e1;_0x49ed07[_0x2186('0x23')]=!![];}_0x49ed07[_0x2186('0xc')]=_0x3bf1c8||_0x3fb01d[_0x2186('0x1f')]||_0x2186('0x27');return _0x49ed07;};EmailImap[_0x2186('0x1a')][_0x2186('0x13')]=function(){this[_0x2186('0x2')][_0x2186('0x28')](this[_0x2186('0xd')],![],this[_0x2186('0x29')][_0x2186('0x14')](this));};EmailImap['prototype'][_0x2186('0x29')]=function(_0x269a70,_0x41014a){if(_0x269a70){this[_0x2186('0x18')](_0x269a70,!![]);}else{this[_0x2186('0x2a')](_0x2186('0x2b'),_0x41014a);this[_0x2186('0x2c')]();}};EmailImap['prototype'][_0x2186('0x2d')]=function(_0x4f62cd){if(_0x4f62cd){this[_0x2186('0x18')](_0x4f62cd,!![]);}else{this['imap'][_0x2186('0x15')]();}};EmailImap[_0x2186('0x1a')][_0x2186('0x2c')]=function(){this[_0x2186('0x2')][_0x2186('0x2e')]([_0x2186('0x2f')],this[_0x2186('0x30')]['bind'](this));};EmailImap[_0x2186('0x1a')][_0x2186('0x30')]=function(_0x427a81,_0x3d2222){if(_0x427a81){this['handleError'](_0x427a81,!![]);}else{if(_0x3d2222[_0x2186('0x31')]){try{var _0x2f7210=this['imap']['fetch'](_0x3d2222,{'bodies':'','markSeen':!![]});_0x2f7210['on'](_0x2186('0x32'),this[_0x2186('0x33')][_0x2186('0x14')](this));_0x2f7210['once'](_0x2186('0x17'),this['handleFetchError'][_0x2186('0x14')](this));_0x2f7210[_0x2186('0x11')](_0x2186('0x15'),this['handleFetchEnd'][_0x2186('0x14')](this));}catch(_0x1b401b){logger[_0x2186('0x17')](_0x1b401b);}}else{this[_0x2186('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x2186('0x14')](this));}}};EmailImap[_0x2186('0x1a')][_0x2186('0x33')]=function(_0x301c1c,_0x5816bf){_0x301c1c['on'](_0x2186('0x34'),this[_0x2186('0x35')][_0x2186('0x14')](this));_0x301c1c['once']('attributes',this[_0x2186('0x36')]['bind'](this));_0x301c1c['once'](_0x2186('0x15'),this[_0x2186('0x37')][_0x2186('0x14')](this));};EmailImap[_0x2186('0x1a')][_0x2186('0x35')]=function(_0x174b52,_0x2d99ec){simpleParser(_0x174b52,{'Iconv':Iconv},this[_0x2186('0x38')][_0x2186('0x14')](this));};EmailImap[_0x2186('0x1a')][_0x2186('0x36')]=function(_0x5edec7){};EmailImap[_0x2186('0x1a')][_0x2186('0x37')]=function(){};EmailImap[_0x2186('0x1a')]['handleSimpleParser']=function(_0x2b3ca9,_0x5bb18c){if(_0x2b3ca9){logger[_0x2186('0x17')](_0x2b3ca9);}else{var _0x48f24a=this;utils['parser'](this[_0x2186('0xf')],_0x5bb18c,function(_0x3d4550){_0x48f24a[_0x2186('0x2a')](_0x2186('0xc'),_0x3d4550);});}};EmailImap[_0x2186('0x1a')][_0x2186('0x39')]=function(){this['imap']['closeBox'](!![],this[_0x2186('0x2d')]['bind'](this));};EmailImap[_0x2186('0x1a')][_0x2186('0x3a')]=function(_0x3e0df9){this[_0x2186('0x18')](_0x3e0df9);this[_0x2186('0x2')][_0x2186('0x3b')](!![],this['handleCloseBox'][_0x2186('0x14')](this));};EmailImap[_0x2186('0x1a')][_0x2186('0x16')]=function(){this[_0x2186('0x2a')](_0x2186('0x15'));};EmailImap[_0x2186('0x1a')][_0x2186('0x18')]=function(_0x152de7,_0x19053e){logger[_0x2186('0x17')](_0x2186('0x18'),this[_0x2186('0xf')][_0x2186('0xc')],JSON['stringify'](_0x152de7));var _0x590959='';if(_0x152de7){if(_0x152de7[_0x2186('0x3c')]){_0x590959=_0x152de7[_0x2186('0x3c')];}else{for(var _0x2ef143 in _0x152de7){if(_0x152de7['hasOwnProperty'](_0x2ef143)){_0x590959+=_[_0x2186('0x3d')](_0x2ef143)+':\x20'+_0x152de7[_0x2ef143]+'\x0a';}}}}if(_0x19053e){this[_0x2186('0x2')][_0x2186('0x15')]();}else{this[_0x2186('0x2a')]('error',_0x590959);this[_0x2186('0x2a')](_0x2186('0x15'));}};module[_0x2186('0x3e')]=EmailImap; \ No newline at end of file +var _0xb3c5=['authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','randomstring','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','handleReady','bind','end','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xb3c5,0x66));var _0x5b3c=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xb3c5[_0x2d2258];return _0x18e155;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x5b3c('0x0'));var _=require(_0x5b3c('0x1'));var rs=require(_0x5b3c('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x5b3c('0x3'))[_0x5b3c('0x4')];var EventEmitter=require(_0x5b3c('0x5'))[_0x5b3c('0x6')];var utils=require(_0x5b3c('0x7'));var logger=require('../../../config/logger')(_0x5b3c('0x8'));function EmailImap(_0x1ea0c7,_0x348ba8){this[_0x5b3c('0x9')]=_0x5b3c('0xa');this[_0x5b3c('0xb')]=this[_0x5b3c('0xc')](_0x1ea0c7,_0x348ba8);this[_0x5b3c('0x0')]=new Imap(this[_0x5b3c('0xb')]);this[_0x5b3c('0x0')][_0x5b3c('0xd')]('ready',this[_0x5b3c('0xe')][_0x5b3c('0xf')](this));this[_0x5b3c('0x0')][_0x5b3c('0xd')](_0x5b3c('0x10'),this['handleEnd'][_0x5b3c('0xf')](this));this[_0x5b3c('0x0')]['on']('error',this[_0x5b3c('0x11')]['bind'](this));this['imap'][_0x5b3c('0x12')]();}util[_0x5b3c('0x13')](EmailImap,EventEmitter);EmailImap[_0x5b3c('0x14')]['getAccount']=function(_0x1678c1,_0x4dbcba){var _0x54c68a={'connTimeout':_0x1678c1['connTimeout']?_0x1678c1[_0x5b3c('0x15')]*0x3e8:0x2710,'authTimeout':_0x1678c1[_0x5b3c('0x16')]?_0x1678c1[_0x5b3c('0x16')]*0x3e8:0x1388};if(_[_0x5b3c('0x17')](_0x1678c1['service'])){if(_0x1678c1[_0x5b3c('0x18')]){_0x54c68a['user']=_0x1678c1[_0x5b3c('0x19')];_0x54c68a[_0x5b3c('0x1a')]=_0x1678c1['password'];}_0x54c68a[_0x5b3c('0x1b')]=_0x1678c1[_0x5b3c('0x1b')];_0x54c68a[_0x5b3c('0x1c')]=_0x1678c1[_0x5b3c('0x1c')]||0x3e1;if(_0x1678c1[_0x5b3c('0x1d')]){_0x54c68a[_0x5b3c('0x1d')]=!![];}else{_0x54c68a[_0x5b3c('0x1d')]=![];_0x54c68a[_0x5b3c('0x1e')]=_0x5b3c('0x1f');}}else{_0x54c68a[_0x5b3c('0x19')]=_0x1678c1[_0x5b3c('0x19')];_0x54c68a[_0x5b3c('0x1a')]=_0x1678c1['password'];_0x54c68a[_0x5b3c('0x1b')]=utils[_0x5b3c('0x20')](_0x1678c1[_0x5b3c('0x21')]);_0x54c68a[_0x5b3c('0x1c')]=0x3e1;_0x54c68a['tls']=!![];}_0x54c68a['email']=_0x4dbcba||_0x1678c1[_0x5b3c('0x19')]||_0x5b3c('0x22');return _0x54c68a;};EmailImap[_0x5b3c('0x14')][_0x5b3c('0xe')]=function(){this[_0x5b3c('0x0')][_0x5b3c('0x23')](this[_0x5b3c('0x9')],![],this[_0x5b3c('0x24')][_0x5b3c('0xf')](this));};EmailImap['prototype'][_0x5b3c('0x24')]=function(_0x54b098,_0x561fb3){if(_0x54b098){this[_0x5b3c('0x11')](_0x54b098,!![]);}else{this['emit'](_0x5b3c('0x25'),_0x561fb3);this['readUnseen']();}};EmailImap['prototype'][_0x5b3c('0x26')]=function(_0x200669){if(_0x200669){this['handleError'](_0x200669,!![]);}else{this[_0x5b3c('0x0')]['end']();}};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x27')]=function(){this[_0x5b3c('0x0')][_0x5b3c('0x28')]([_0x5b3c('0x29')],this[_0x5b3c('0x2a')][_0x5b3c('0xf')](this));};EmailImap['prototype'][_0x5b3c('0x2a')]=function(_0xca4a19,_0x57e887){if(_0xca4a19){this[_0x5b3c('0x11')](_0xca4a19,!![]);}else{if(_0x57e887[_0x5b3c('0x2b')]){try{var _0x2c698d=this[_0x5b3c('0x0')][_0x5b3c('0x2c')](_0x57e887,{'bodies':'','markSeen':!![]});_0x2c698d['on']('message',this[_0x5b3c('0x2d')][_0x5b3c('0xf')](this));_0x2c698d[_0x5b3c('0xd')](_0x5b3c('0x2e'),this[_0x5b3c('0x2f')][_0x5b3c('0xf')](this));_0x2c698d[_0x5b3c('0xd')](_0x5b3c('0x10'),this[_0x5b3c('0x30')][_0x5b3c('0xf')](this));}catch(_0x13ec65){logger['error'](_0x13ec65);}}else{this[_0x5b3c('0x0')]['closeBox'](!![],this[_0x5b3c('0x26')]['bind'](this));}}};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x2d')]=function(_0x5b3214,_0x326a7d){_0x5b3214['on'](_0x5b3c('0x31'),this[_0x5b3c('0x32')]['bind'](this));_0x5b3214[_0x5b3c('0xd')]('attributes',this[_0x5b3c('0x33')][_0x5b3c('0xf')](this));_0x5b3214[_0x5b3c('0xd')](_0x5b3c('0x10'),this[_0x5b3c('0x34')][_0x5b3c('0xf')](this));};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x32')]=function(_0x2a40eb,_0x3954ec){simpleParser(_0x2a40eb,{'Iconv':Iconv},this[_0x5b3c('0x35')]['bind'](this));};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x33')]=function(_0x537016){};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x34')]=function(){};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x35')]=function(_0x1098d3,_0x35e786){if(_0x1098d3){logger[_0x5b3c('0x2e')](_0x1098d3);}else{var _0x56ecc8=this;utils[_0x5b3c('0x36')](this['account'],_0x35e786,function(_0x4f018a){_0x56ecc8[_0x5b3c('0x37')](_0x5b3c('0x8'),_0x4f018a);});}};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x30')]=function(){this[_0x5b3c('0x0')][_0x5b3c('0x38')](!![],this[_0x5b3c('0x26')][_0x5b3c('0xf')](this));};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x2f')]=function(_0x4caa56){this['handleError'](_0x4caa56);this[_0x5b3c('0x0')][_0x5b3c('0x38')](!![],this[_0x5b3c('0x26')][_0x5b3c('0xf')](this));};EmailImap['prototype'][_0x5b3c('0x39')]=function(){this[_0x5b3c('0x37')](_0x5b3c('0x10'));};EmailImap[_0x5b3c('0x14')]['handleError']=function(_0x1c98ea,_0xe3846d){logger['error']('handleError',this[_0x5b3c('0xb')]['email'],JSON[_0x5b3c('0x3a')](_0x1c98ea));var _0x5afc08='';if(_0x1c98ea){if(_0x1c98ea[_0x5b3c('0x3b')]){_0x5afc08=_0x1c98ea[_0x5b3c('0x3b')];}else{for(var _0x22e11a in _0x1c98ea){if(_0x1c98ea[_0x5b3c('0x3c')](_0x22e11a)){_0x5afc08+=_[_0x5b3c('0x3d')](_0x22e11a)+':\x20'+_0x1c98ea[_0x22e11a]+'\x0a';}}}}if(_0xe3846d){this['imap'][_0x5b3c('0x10')]();}else{this['emit']('error',_0x5afc08);this[_0x5b3c('0x37')](_0x5b3c('0x10'));}};module[_0x5b3c('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 5d76ce7..5bc2ff7 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 _0xdf39=['exports','nodemailer','bluebird','prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired'];(function(_0x208c96,_0x19122d){var _0x3c8b5b=function(_0x273e32){while(--_0x273e32){_0x208c96['push'](_0x208c96['shift']());}};_0x3c8b5b(++_0x19122d);}(_0xdf39,0xc7));var _0x9df3=function(_0x2690ff,_0x4895e6){_0x2690ff=_0x2690ff-0x0;var _0x4c4faa=_0xdf39[_0x2690ff];return _0x4c4faa;};'use strict';var nodemailer=require(_0x9df3('0x0'));var BPromise=require(_0x9df3('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x9df3('0x2')][_0x9df3('0x3')]=function(_0xe502de,_0x52a217){return new BPromise(function(_0x10828f,_0x1fda17){var _0x4592a1=nodemailer[_0x9df3('0x4')](_0xe502de);_0x4592a1[_0x9df3('0x5')](_0x9df3('0x6'),inlineBase64());_0x4592a1['sendMail'](_0x52a217,function(_0x1a8c50,_0x40492f){if(_0x1a8c50){_0x1fda17(_0x1a8c50[_0x9df3('0x7')]());}else{_0x10828f(_0x40492f);}});});};EmailSmtp[_0x9df3('0x2')][_0x9df3('0x8')]=function(_0x528263){return new BPromise(function(_0x16d903,_0x15a6a7){var _0x326778=nodemailer[_0x9df3('0x4')](_0x528263);_0x326778['verify'](function(_0x5a7921,_0x347e87){if(_0x5a7921){_0x15a6a7(_0x5a7921[_0x9df3('0x7')]());}else{if(_0x347e87){_0x16d903(_0x347e87);}else{_0x15a6a7(_0x9df3('0x9'));}}});});};module[_0x9df3('0xa')]=EmailSmtp; \ No newline at end of file +var _0x0a55=['compile','sendMail','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','use'];(function(_0x5f1a6a,_0x3cac07){var _0x3c8568=function(_0x525698){while(--_0x525698){_0x5f1a6a['push'](_0x5f1a6a['shift']());}};_0x3c8568(++_0x3cac07);}(_0x0a55,0x1a7));var _0x50a5=function(_0x37c4af,_0x3295b7){_0x37c4af=_0x37c4af-0x0;var _0x54aa05=_0x0a55[_0x37c4af];return _0x54aa05;};'use strict';var nodemailer=require(_0x50a5('0x0'));var BPromise=require(_0x50a5('0x1'));var inlineBase64=require(_0x50a5('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x50a5('0x3')]=function(_0x4e4152,_0x14072f){return new BPromise(function(_0x4e8995,_0xaf4797){var _0x1eecd0=nodemailer[_0x50a5('0x4')](_0x4e4152);_0x1eecd0[_0x50a5('0x5')](_0x50a5('0x6'),inlineBase64());_0x1eecd0[_0x50a5('0x7')](_0x14072f,function(_0x1dbfbe,_0x5c0c72){if(_0x1dbfbe){_0xaf4797(_0x1dbfbe['toString']());}else{_0x4e8995(_0x5c0c72);}});});};EmailSmtp['prototype']['verify']=function(_0x2c824f){return new BPromise(function(_0x4fe7d0,_0x4483fd){var _0x474669=nodemailer[_0x50a5('0x4')](_0x2c824f);_0x474669[_0x50a5('0x8')](function(_0x5ed1fa,_0x35ffe6){if(_0x5ed1fa){_0x4483fd(_0x5ed1fa['toString']());}else{if(_0x35ffe6){_0x4fe7d0(_0x35ffe6);}else{_0x4483fd(_0x50a5('0x9'));}}});});};module[_0x50a5('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2b625b7..fca8e81 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 _0xe3a4=['now','root','server/files/attachments/','writeFileSync','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','content','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','email','head','address','generate','@xcally.com','value','name','split','length','slice','join','Anonymous','isEmpty','anonymous','html','test','includes','attachments','forEach','push','filename','replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x3c8ad8['pop']():'';}return'';}function getMails(_0x5cb0e6,_0x3506e9){var _0x1065bb='';for(var _0x5b361e=0x0;_0x5b361e<_0x3506e9[_0x4e3a('0xb')][_0x4e3a('0xe')];_0x5b361e+=0x1){if(_0x3506e9[_0x4e3a('0xb')][_0x5b361e]['address']!==_0x5cb0e6){if(!_[_0x4e3a('0x12')](_0x1065bb)){_0x1065bb+=',';}_0x1065bb+=_0x3506e9[_0x4e3a('0xb')][_0x5b361e][_0x4e3a('0xc')]||_0x3506e9[_0x4e3a('0xb')][_0x5b361e][_0x4e3a('0x8')]||'';_0x1065bb+='\x20<';_0x1065bb+=_0x3506e9[_0x4e3a('0xb')][_0x5b361e][_0x4e3a('0x8')]?_0x3506e9[_0x4e3a('0xb')][_0x5b361e][_0x4e3a('0x8')]:_0x4e3a('0x13')+random[_0x4e3a('0x9')](0x6)+_0x4e3a('0xa');_0x1065bb+='>';}}return _0x1065bb;}function parseEmail(_0x1e7e83,_0x2d00ae,_0x4e7285){if(_0x2d00ae[_0x4e3a('0x14')]){var _0x249868=/)<[^<]*)*<\/script>/gi;while(_0x249868[_0x4e3a('0x15')](_0x2d00ae[_0x4e3a('0x14')])){_0x2d00ae[_0x4e3a('0x14')]=_0x2d00ae['html']['replace'](_0x249868,'');}if(_0x2d00ae[_0x4e3a('0x14')][_0x4e3a('0x16')]('{_0x2455e2[_0x4e3a('0x19')](_0x398a23[_0x4e3a('0x1a')]);});var _0x205206=/]+>/g;var _0x3b6d71=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5c5ae1=_0x2d00ae[_0x4e3a('0x14')][_0x4e3a('0x1b')](_0x3b6d71,_0x4e3a('0x1c'));var _0x1bcb0c=_0x5c5ae1['replace'](_0x205206,_0x4e3a('0x1d'));for(let _0x3218dd=0x0;_0x3218dd<_0x2455e2[_0x4e3a('0xe')];_0x3218dd++){var _0x15673f=_0x1bcb0c[_0x4e3a('0x1b')](_0x4e3a('0x1d'),_0x4e3a('0x1e')+_0x2455e2[_0x3218dd]+_0x4e3a('0x1f'));_0x1bcb0c=_0x15673f;}_0x2d00ae[_0x4e3a('0x14')]=_0x1bcb0c;}_0x4e7285[_0x4e3a('0x20')]=_0x2d00ae[_0x4e3a('0x14')];}else{_0x4e7285['body']=_0x2d00ae[_0x4e3a('0x21')];}if(_0x4e7285['body']){_0x4e7285[_0x4e3a('0x20')]=_0x4e7285[_0x4e3a('0x20')][_0x4e3a('0x1b')](/Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','length','Anonymous','split','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x474c5c[_0x5888('0x12')]():'';}return'';}function getMails(_0x1d1c5f,_0x47c5f8){var _0x250868='';for(var _0x501af1=0x0;_0x501af1<_0x47c5f8[_0x5888('0x9')][_0x5888('0xf')];_0x501af1+=0x1){if(_0x47c5f8[_0x5888('0x9')][_0x501af1][_0x5888('0xa')]!==_0x1d1c5f){if(!_[_0x5888('0x13')](_0x250868)){_0x250868+=',';}_0x250868+=_0x47c5f8[_0x5888('0x9')][_0x501af1][_0x5888('0xe')]||_0x47c5f8[_0x5888('0x9')][_0x501af1][_0x5888('0xa')]||'';_0x250868+='\x20<';_0x250868+=_0x47c5f8[_0x5888('0x9')][_0x501af1]['address']?_0x47c5f8[_0x5888('0x9')][_0x501af1][_0x5888('0xa')]:_0x5888('0xb')+random[_0x5888('0xc')](0x6)+_0x5888('0xd');_0x250868+='>';}}return _0x250868;}function parseEmail(_0x419778,_0x2c2d19,_0xa69166){if(_0x2c2d19[_0x5888('0x14')]){var _0x1e6e0d=/)<[^<]*)*<\/script>/gi;while(_0x1e6e0d[_0x5888('0x15')](_0x2c2d19['html'])){_0x2c2d19[_0x5888('0x14')]=_0x2c2d19['html']['replace'](_0x1e6e0d,'');}if(_0x2c2d19['html'][_0x5888('0x16')](_0x5888('0x17'))){var _0x15bd8a=[];_0x2c2d19[_0x5888('0x18')][_0x5888('0x19')](_0x250b0a=>{_0x15bd8a[_0x5888('0x1a')](_0x250b0a[_0x5888('0x1b')]);});var _0x14d2a3=/]+>/g;var _0x42307a=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5340d3=_0x2c2d19[_0x5888('0x14')][_0x5888('0x1c')](_0x42307a,_0x5888('0x1d'));var _0x46abc1=_0x5340d3[_0x5888('0x1c')](_0x14d2a3,_0x5888('0x1e'));for(let _0xe739d3=0x0;_0xe739d3<_0x15bd8a[_0x5888('0xf')];_0xe739d3++){var _0x19d40a=_0x46abc1['replace'](_0x5888('0x1e'),_0x5888('0x1f')+_0x15bd8a[_0xe739d3]+_0x5888('0x20'));_0x46abc1=_0x19d40a;}_0x2c2d19['html']=_0x46abc1;}_0xa69166['body']=_0x2c2d19[_0x5888('0x14')];}else{_0xa69166[_0x5888('0x21')]=_0x2c2d19[_0x5888('0x22')];}if(_0xa69166['body']){_0xa69166[_0x5888('0x21')]=_0xa69166[_0x5888('0x21')][_0x5888('0x1c')](/0x0){if(this[_0x579a06+_0xb174('0x26')]>0x0&&this[_0x579a06+_0xb174('0x27')]>=this[_0x579a06+_0xb174('0x26')]){return'maxcapacity';}else{return _0xb174('0x28');}}else{return _0xb174('0x29');}};Agent[_0xb174('0x25')]['updateRealtime']=function(){var _0x19473b=[_0xb174('0x2a'),_0xb174('0x2b'),_0xb174('0x2c'),_0xb174('0x2d'),'sms',_0xb174('0x2e')];for(var _0x57bae5=0x0;_0x57bae5<_0x19473b[_0xb174('0x2f')];_0x57bae5+=0x1){var _0x3a99e6=this[_0xb174('0x30')](_0x19473b[_0x57bae5]);if(this[_0x19473b[_0x57bae5]+'Status']!==_0x3a99e6){this[_0x19473b[_0x57bae5]+'StatusTime']=_[_0xb174('0x31')](moment()[_0xb174('0x32')]('x'));}this[_0x19473b[_0x57bae5]+'Status']=_0x3a99e6;}var _0x55312a={'id':this['id'],'name':this[_0xb174('0x6')],'online':this['online'],'voicePause':this[_0xb174('0x8')],'chatPause':this[_0xb174('0x9')],'mailPause':this[_0xb174('0xa')],'smsPause':this[_0xb174('0xc')],'faxPause':this[_0xb174('0xb')],'openchannelPause':this[_0xb174('0xd')],'chatStatus':this[_0xb174('0x33')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xb174('0x11')],'mailStatus':this[_0xb174('0x12')],'mailStatusTime':this[_0xb174('0x34')],'mailCapacity':this[_0xb174('0x13')],'mailCurrentCapacity':this[_0xb174('0x14')],'faxStatus':this[_0xb174('0x15')],'faxStatusTime':this[_0xb174('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xb174('0x18')],'smsStatus':this[_0xb174('0x19')],'smsStatusTime':this[_0xb174('0x1a')],'smsCapacity':this[_0xb174('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xb174('0x35')],'whatsappStatusTime':this[_0xb174('0x1c')],'whatsappCapacity':this[_0xb174('0x1d')],'whatsappCurrentCapacity':this[_0xb174('0x1e')],'openchannelStatus':this[_0xb174('0x36')],'openchannelStatusTime':this[_0xb174('0x1f')],'openchannelCapacity':this[_0xb174('0x20')],'openchannelCurrentCapacity':this[_0xb174('0x21')],'busy':this[_0xb174('0x22')],'busyQueue':this[_0xb174('0x23')]};var _0x45b1dd=md5(JSON[_0xb174('0x37')](_0x55312a));if(this[_0xb174('0x38')]!==_0x45b1dd){this[_0xb174('0x38')]=_0x45b1dd;io[_0xb174('0x39')](_0xb174('0x3a'),_0x55312a);}};module['exports']=Agent; \ No newline at end of file +var _0x7e22=['mail','chat','openchannel','fax','whatsapp','getChannelStatus','toNumber','format','Status','mailStatus','faxStatusTime','smsCurrentCapacity','whatsappStatus','busyQueue','stringify','emit','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working'];(function(_0x19fdf3,_0x4507d0){var _0x2e3ce3=function(_0x538450){while(--_0x538450){_0x19fdf3['push'](_0x19fdf3['shift']());}};_0x2e3ce3(++_0x4507d0);}(_0x7e22,0x1d8));var _0x27e2=function(_0x295370,_0x4d044f){_0x295370=_0x295370-0x0;var _0x384d11=_0x7e22[_0x295370];return _0x384d11;};'use strict';var _=require(_0x27e2('0x0'));var moment=require('moment');var md5=require(_0x27e2('0x1'));var Redis=require(_0x27e2('0x2'));var config=require(_0x27e2('0x3'));config[_0x27e2('0x4')]=_[_0x27e2('0x5')](config[_0x27e2('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x27e2('0x6'))(new Redis(config['redis']));function Agent(_0x3b7d1e){this['id']=_0x3b7d1e['id']||0x0;this[_0x27e2('0x7')]=_0x3b7d1e[_0x27e2('0x7')]||'';this[_0x27e2('0x8')]=_0x3b7d1e['online']||!![];this[_0x27e2('0x9')]=_0x3b7d1e[_0x27e2('0x9')]||![];this[_0x27e2('0xa')]=_0x3b7d1e[_0x27e2('0xa')]||![];this[_0x27e2('0xb')]=_0x3b7d1e[_0x27e2('0xb')]||![];this[_0x27e2('0xc')]=_0x3b7d1e[_0x27e2('0xc')]||![];this['smsPause']=_0x3b7d1e[_0x27e2('0xd')]||![];this[_0x27e2('0xe')]=_0x3b7d1e['openchannelPause']||![];this[_0x27e2('0xf')]=_0x27e2('0x10');this[_0x27e2('0x11')]=0x0;this[_0x27e2('0x12')]=_0x3b7d1e['chatCapacity']||0x0;this[_0x27e2('0x13')]=0x0;this['mailStatus']=_0x27e2('0x10');this[_0x27e2('0x14')]=0x0;this[_0x27e2('0x15')]=_0x3b7d1e[_0x27e2('0x15')]||0x0;this[_0x27e2('0x16')]=0x0;this['faxStatus']=_0x27e2('0x10');this['faxStatusTime']=0x0;this[_0x27e2('0x17')]=_0x3b7d1e[_0x27e2('0x17')]||0x0;this[_0x27e2('0x18')]=0x0;this[_0x27e2('0x19')]=_0x27e2('0x10');this[_0x27e2('0x1a')]=0x0;this[_0x27e2('0x1b')]=_0x3b7d1e[_0x27e2('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x27e2('0x10');this[_0x27e2('0x1c')]=0x0;this['whatsappCapacity']=_0x3b7d1e[_0x27e2('0x1d')]||0x0;this[_0x27e2('0x1e')]=0x0;this[_0x27e2('0x1f')]=_0x27e2('0x10');this[_0x27e2('0x20')]=0x0;this['openchannelCapacity']=_0x3b7d1e[_0x27e2('0x21')]||0x0;this[_0x27e2('0x22')]=0x0;this[_0x27e2('0x23')]=![];this['busyQueue']=undefined;this[_0x27e2('0x1')]='';this[_0x27e2('0x24')]();}Agent['prototype']['getChannelStatus']=function(_0x227eab){if(this[_0x227eab+_0x27e2('0x25')]>0x0){if(this[_0x227eab+_0x27e2('0x26')]>0x0&&this[_0x227eab+_0x27e2('0x25')]>=this[_0x227eab+_0x27e2('0x26')]){return _0x27e2('0x27');}else{return _0x27e2('0x28');}}else{return'idle';}};Agent['prototype'][_0x27e2('0x24')]=function(){var _0x1f1b14=[_0x27e2('0x29'),_0x27e2('0x2a'),_0x27e2('0x2b'),_0x27e2('0x2c'),'sms',_0x27e2('0x2d')];for(var _0x30b0a9=0x0;_0x30b0a9<_0x1f1b14['length'];_0x30b0a9+=0x1){var _0x212e9a=this[_0x27e2('0x2e')](_0x1f1b14[_0x30b0a9]);if(this[_0x1f1b14[_0x30b0a9]+'Status']!==_0x212e9a){this[_0x1f1b14[_0x30b0a9]+'StatusTime']=_[_0x27e2('0x2f')](moment()[_0x27e2('0x30')]('x'));}this[_0x1f1b14[_0x30b0a9]+_0x27e2('0x31')]=_0x212e9a;}var _0x46ca56={'id':this['id'],'name':this[_0x27e2('0x7')],'online':this[_0x27e2('0x8')],'voicePause':this[_0x27e2('0x9')],'chatPause':this[_0x27e2('0xa')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x27e2('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x27e2('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x27e2('0x12')],'chatCurrentCapacity':this[_0x27e2('0x13')],'mailStatus':this[_0x27e2('0x32')],'mailStatusTime':this[_0x27e2('0x14')],'mailCapacity':this[_0x27e2('0x15')],'mailCurrentCapacity':this[_0x27e2('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x27e2('0x33')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x27e2('0x19')],'smsStatusTime':this[_0x27e2('0x1a')],'smsCapacity':this[_0x27e2('0x1b')],'smsCurrentCapacity':this[_0x27e2('0x34')],'whatsappStatus':this[_0x27e2('0x35')],'whatsappStatusTime':this[_0x27e2('0x1c')],'whatsappCapacity':this[_0x27e2('0x1d')],'whatsappCurrentCapacity':this[_0x27e2('0x1e')],'openchannelStatus':this[_0x27e2('0x1f')],'openchannelStatusTime':this[_0x27e2('0x20')],'openchannelCapacity':this[_0x27e2('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x27e2('0x36')]};var _0x576678=md5(JSON[_0x27e2('0x37')](_0x46ca56));if(this['md5']!==_0x576678){this[_0x27e2('0x1')]=_0x576678;io[_0x27e2('0x38')]('user:save',_0x46ca56);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 7ed727a..a12ae07 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 _0xcb48=['paused','length','chatPause','available','waiting','stringify','format','emit','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn'];(function(_0x25bb9d,_0x4f12cc){var _0x5e7a45=function(_0x3cef35){while(--_0x3cef35){_0x25bb9d['push'](_0x25bb9d['shift']());}};_0x5e7a45(++_0x4f12cc);}(_0xcb48,0x71));var _0x8cb4=function(_0x4f345b,_0x13c173){_0x4f345b=_0x4f345b-0x0;var _0x14ee00=_0xcb48[_0x4f345b];return _0x14ee00;};'use strict';var _=require('lodash');var md5=require(_0x8cb4('0x0'));var util=require(_0x8cb4('0x1'));var Redis=require(_0x8cb4('0x2'));var config=require(_0x8cb4('0x3'));config[_0x8cb4('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8cb4('0x5'))(new Redis(config[_0x8cb4('0x4')]));function ChatQueue(_0x363ccc){this['id']=_0x363ccc['id']||0x0;this[_0x8cb4('0x6')]=_0x363ccc[_0x8cb4('0x6')]||'';this[_0x8cb4('0x7')]=_0x363ccc[_0x8cb4('0x7')]||0xa;this[_0x8cb4('0x8')]=_0x363ccc[_0x8cb4('0x8')]||'beepall';this[_0x8cb4('0x9')]=_0x363ccc[_0x8cb4('0x9')];this[_0x8cb4('0xa')]={};this['waiting']=0x0;this[_0x8cb4('0x0')]='';this[_0x8cb4('0xb')]();this['updateRealtime']();}ChatQueue[_0x8cb4('0xc')][_0x8cb4('0xb')]=function(){var _0x39c86d=this[_0x8cb4('0xa')][_0x8cb4('0xd')];this[_0x8cb4('0xa')]=_[_0x8cb4('0xe')](this['Agents'],'id');this['mapAgentsId'][_0x8cb4('0xd')]=_0x39c86d;};ChatQueue['prototype'][_0x8cb4('0xf')]=function(){this[_0x8cb4('0x10')]=0x0;this[_0x8cb4('0x11')]=0x0;for(var _0x25f073=0x0;_0x25f073=0x0?this['available']:0x0;var _0x2f4815={'id':this['id'],'available':this[_0x8cb4('0x14')],'loggedIn':this[_0x8cb4('0x10')],'name':this[_0x8cb4('0x6')],'paused':this[_0x8cb4('0x11')],'waiting':this[_0x8cb4('0x15')]};var _0x1c2bb6=md5(JSON[_0x8cb4('0x16')](_0x2f4815));if(this[_0x8cb4('0x0')]!==_0x1c2bb6){this[_0x8cb4('0x0')]=_0x1c2bb6;io['to'](util[_0x8cb4('0x17')]('chat:queue:%s',_0x2f4815['name']))[_0x8cb4('0x18')]('chat_queue:save',_0x2f4815);}};module[_0x8cb4('0x19')]=ChatQueue; \ No newline at end of file +var _0x4424=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4424,0xe8));var _0x4442=function(_0x3215ad,_0x3f097b){_0x3215ad=_0x3215ad-0x0;var _0x36bbcf=_0x4424[_0x3215ad];return _0x36bbcf;};'use strict';var _=require(_0x4442('0x0'));var md5=require(_0x4442('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4442('0x2')]=_[_0x4442('0x3')](config[_0x4442('0x2')],{'host':_0x4442('0x4'),'port':0x18eb});var io=require(_0x4442('0x5'))(new Redis(config[_0x4442('0x2')]));function ChatQueue(_0x18eb84){this['id']=_0x18eb84['id']||0x0;this['name']=_0x18eb84[_0x4442('0x6')]||'';this[_0x4442('0x7')]=_0x18eb84['timeout']||0xa;this[_0x4442('0x8')]=_0x18eb84[_0x4442('0x8')]||_0x4442('0x9');this[_0x4442('0xa')]=_0x18eb84[_0x4442('0xa')];this[_0x4442('0xb')]={};this[_0x4442('0xc')]=0x0;this[_0x4442('0x1')]='';this[_0x4442('0xd')]();this[_0x4442('0xe')]();}ChatQueue[_0x4442('0xf')]['updateRouting']=function(){var _0x3169dc=this['mapAgentsId'][_0x4442('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x4442('0x10')]=_0x3169dc;};ChatQueue[_0x4442('0xf')][_0x4442('0xe')]=function(){this[_0x4442('0x11')]=0x0;this[_0x4442('0x12')]=0x0;for(var _0x57b61e=0x0;_0x57b61e=0x0?this[_0x4442('0x15')]:0x0;var _0x15c0c0={'id':this['id'],'available':this[_0x4442('0x15')],'loggedIn':this[_0x4442('0x11')],'name':this[_0x4442('0x6')],'paused':this[_0x4442('0x12')],'waiting':this[_0x4442('0xc')]};var _0x5f0ef3=md5(JSON[_0x4442('0x16')](_0x15c0c0));if(this[_0x4442('0x1')]!==_0x5f0ef3){this[_0x4442('0x1')]=_0x5f0ef3;io['to'](util['format'](_0x4442('0x17'),_0x15c0c0['name']))[_0x4442('0x18')](_0x4442('0x19'),_0x15c0c0);}};module[_0x4442('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 77bd230..ab6a968 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(_0x30e629,_0x153eec){var _0x638d4d=function(_0x1e0a0b){while(--_0x1e0a0b){_0x30e629['push'](_0x30e629['shift']());}};_0x638d4d(++_0x153eec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x2d4f6a,_0x426529){var _0x254706=function(_0x526c8e){while(--_0x526c8e){_0x2d4f6a['push'](_0x2d4f6a['shift']());}};_0x254706(++_0x426529);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 76ee773..e198d97 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 _0xac52=['name','Intervals'];(function(_0x502915,_0x5b2a34){var _0x4cee84=function(_0xef46b8){while(--_0xef46b8){_0x502915['push'](_0x502915['shift']());}};_0x4cee84(++_0x5b2a34);}(_0xac52,0xf8));var _0x2ac5=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xac52[_0x2f5ac5];return _0x37c9a8;};'use strict';function Interval(_0x268c38){this['id']=_0x268c38['id']||0x0;this[_0x2ac5('0x0')]=_0x268c38[_0x2ac5('0x0')]||'';this[_0x2ac5('0x1')]=_0x268c38[_0x2ac5('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xb60b=['Intervals'];(function(_0x2fc058,_0x57ced9){var _0x196b90=function(_0x3897fb){while(--_0x3897fb){_0x2fc058['push'](_0x2fc058['shift']());}};_0x196b90(++_0x57ced9);}(_0xb60b,0x1c9));var _0xbb60=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb60b[_0x6cf19c];return _0xce14f3;};'use strict';function Interval(_0x44d470){this['id']=_0x44d470['id']||0x0;this['name']=_0x44d470['name']||'';this[_0xbb60('0x0')]=_0x44d470[_0xbb60('0x0')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 8d04e03..d4c123a 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 _0x9455=['md5','updateRouting','updateRealtime','_rr','mapAgentsId','map','Agents','loggedIn','paused','length','online','mailPause','available','waiting','format','mail:queue:%s','emit','exports','lodash','ioredis','redis','localhost','name','timeout','strategy','beepall'];(function(_0x231426,_0xc5c821){var _0x294fa3=function(_0x4b44fa){while(--_0x4b44fa){_0x231426['push'](_0x231426['shift']());}};_0x294fa3(++_0xc5c821);}(_0x9455,0x94));var _0x5945=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9455[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5945('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x5945('0x1'));var config=require('../../../config/environment');config[_0x5945('0x2')]=_['defaults'](config['redis'],{'host':_0x5945('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x339a0c){this['id']=_0x339a0c['id']||0x0;this['name']=_0x339a0c[_0x5945('0x4')]||'';this[_0x5945('0x5')]=_0x339a0c[_0x5945('0x5')]||0xa;this[_0x5945('0x6')]=_0x339a0c[_0x5945('0x6')]||_0x5945('0x7');this['Agents']=_0x339a0c['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x5945('0x8')]='';this[_0x5945('0x9')]();this[_0x5945('0xa')]();}MailQueue['prototype'][_0x5945('0x9')]=function(){var _0x459b53=this['mapAgentsId'][_0x5945('0xb')];this[_0x5945('0xc')]=_[_0x5945('0xd')](this[_0x5945('0xe')],'id');this['mapAgentsId'][_0x5945('0xb')]=_0x459b53;};MailQueue['prototype']['updateRealtime']=function(){this[_0x5945('0xf')]=0x0;this[_0x5945('0x10')]=0x0;for(var _0x3997d0=0x0;_0x3997d0=0x0?this[_0x5945('0x14')]:0x0;var _0x10667e={'id':this['id'],'available':this[_0x5945('0x14')],'loggedIn':this[_0x5945('0xf')],'name':this[_0x5945('0x4')],'paused':this[_0x5945('0x10')],'waiting':this[_0x5945('0x15')]};var _0x2ce08e=md5(JSON['stringify'](_0x10667e));if(this[_0x5945('0x8')]!==_0x2ce08e){this[_0x5945('0x8')]=_0x2ce08e;io['to'](util[_0x5945('0x16')](_0x5945('0x17'),_0x10667e[_0x5945('0x4')]))[_0x5945('0x18')]('mail_queue:save',_0x10667e);}};module[_0x5945('0x19')]=MailQueue; \ No newline at end of file +var _0x73cb=['util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5'];(function(_0x296cc4,_0xfdd95a){var _0xf0bddb=function(_0x3c1c8e){while(--_0x3c1c8e){_0x296cc4['push'](_0x296cc4['shift']());}};_0xf0bddb(++_0xfdd95a);}(_0x73cb,0x94));var _0xb73c=function(_0x4b135d,_0x5c2cc7){_0x4b135d=_0x4b135d-0x0;var _0x4aaba0=_0x73cb[_0x4b135d];return _0x4aaba0;};'use strict';var _=require(_0xb73c('0x0'));var md5=require(_0xb73c('0x1'));var util=require(_0xb73c('0x2'));var Redis=require(_0xb73c('0x3'));var config=require('../../../config/environment');config[_0xb73c('0x4')]=_[_0xb73c('0x5')](config[_0xb73c('0x4')],{'host':_0xb73c('0x6'),'port':0x18eb});var io=require(_0xb73c('0x7'))(new Redis(config[_0xb73c('0x4')]));function MailQueue(_0x132e02){this['id']=_0x132e02['id']||0x0;this[_0xb73c('0x8')]=_0x132e02[_0xb73c('0x8')]||'';this[_0xb73c('0x9')]=_0x132e02[_0xb73c('0x9')]||0xa;this[_0xb73c('0xa')]=_0x132e02[_0xb73c('0xa')]||_0xb73c('0xb');this['Agents']=_0x132e02[_0xb73c('0xc')];this['mapAgentsId']={};this[_0xb73c('0xd')]=0x0;this['md5']='';this[_0xb73c('0xe')]();this['updateRealtime']();}MailQueue[_0xb73c('0xf')][_0xb73c('0xe')]=function(){var _0x477060=this[_0xb73c('0x10')]['_rr'];this[_0xb73c('0x10')]=_['map'](this[_0xb73c('0xc')],'id');this[_0xb73c('0x10')][_0xb73c('0x11')]=_0x477060;};MailQueue['prototype'][_0xb73c('0x12')]=function(){this[_0xb73c('0x13')]=0x0;this[_0xb73c('0x14')]=0x0;for(var _0x1423fc=0x0;_0x1423fc=0x0?this[_0xb73c('0x18')]:0x0;var _0x221b80={'id':this['id'],'available':this[_0xb73c('0x18')],'loggedIn':this[_0xb73c('0x13')],'name':this[_0xb73c('0x8')],'paused':this[_0xb73c('0x14')],'waiting':this['waiting']};var _0x47c79a=md5(JSON[_0xb73c('0x19')](_0x221b80));if(this[_0xb73c('0x1')]!==_0x47c79a){this[_0xb73c('0x1')]=_0x47c79a;io['to'](util[_0xb73c('0x1a')](_0xb73c('0x1b'),_0x221b80[_0xb73c('0x8')]))['emit'](_0xb73c('0x1c'),_0x221b80);}};module[_0xb73c('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 26ec8a5..9c3c249 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 _0xc784=['strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','paused','openchannelPause','loggedIn','available','waiting','openchannel:queue:%s','openchannel_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xc784,0xe1));var _0x4c78=function(_0xa888ec,_0x3da876){_0xa888ec=_0xa888ec-0x0;var _0x2d801f=_0xc784[_0xa888ec];return _0x2d801f;};'use strict';var _=require(_0x4c78('0x0'));var md5=require(_0x4c78('0x1'));var util=require('util');var Redis=require(_0x4c78('0x2'));var config=require('../../../config/environment');config[_0x4c78('0x3')]=_[_0x4c78('0x4')](config['redis'],{'host':_0x4c78('0x5'),'port':0x18eb});var io=require(_0x4c78('0x6'))(new Redis(config[_0x4c78('0x3')]));function OpenchannelQueue(_0x1fae4f){this['id']=_0x1fae4f['id']||0x0;this[_0x4c78('0x7')]=_0x1fae4f['name']||'';this[_0x4c78('0x8')]=_0x1fae4f['timeout']||0xa;this[_0x4c78('0x9')]=_0x1fae4f[_0x4c78('0x9')]||_0x4c78('0xa');this[_0x4c78('0xb')]=_0x1fae4f[_0x4c78('0xb')];this[_0x4c78('0xc')]={};this['waiting']=0x0;this[_0x4c78('0x1')]='';this['updateRouting']();this[_0x4c78('0xd')]();}OpenchannelQueue[_0x4c78('0xe')][_0x4c78('0xf')]=function(){var _0x2bf366=this[_0x4c78('0xc')][_0x4c78('0x10')];this['mapAgentsId']=_[_0x4c78('0x11')](this['Agents'],'id');this[_0x4c78('0xc')][_0x4c78('0x10')]=_0x2bf366;};OpenchannelQueue[_0x4c78('0xe')][_0x4c78('0xd')]=function(){this['loggedIn']=0x0;this[_0x4c78('0x12')]=0x0;for(var _0x22cff4=0x0;_0x22cff4=0x0?this[_0x4c78('0x15')]:0x0;var _0x4da353={'id':this['id'],'available':this[_0x4c78('0x15')],'loggedIn':this[_0x4c78('0x14')],'name':this[_0x4c78('0x7')],'paused':this[_0x4c78('0x12')],'waiting':this[_0x4c78('0x16')]};var _0xf380c8=md5(JSON['stringify'](_0x4da353));if(this[_0x4c78('0x1')]!==_0xf380c8){this[_0x4c78('0x1')]=_0xf380c8;io['to'](util['format'](_0x4c78('0x17'),_0x4da353['name']))['emit'](_0x4c78('0x18'),_0x4da353);}};module[_0x4c78('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x62b5=['updateRouting','_rr','map','loggedIn','paused','length','online','available','stringify','format','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','defaults','localhost','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype'];(function(_0x46c21f,_0x286625){var _0x581376=function(_0x439ead){while(--_0x439ead){_0x46c21f['push'](_0x46c21f['shift']());}};_0x581376(++_0x286625);}(_0x62b5,0x1bd));var _0x562b=function(_0x1adcc0,_0x286737){_0x1adcc0=_0x1adcc0-0x0;var _0x4413a1=_0x62b5[_0x1adcc0];return _0x4413a1;};'use strict';var _=require('lodash');var md5=require(_0x562b('0x0'));var util=require(_0x562b('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x562b('0x2')](config['redis'],{'host':_0x562b('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x562b('0x4')]));function OpenchannelQueue(_0x1c60a1){this['id']=_0x1c60a1['id']||0x0;this[_0x562b('0x5')]=_0x1c60a1['name']||'';this[_0x562b('0x6')]=_0x1c60a1['timeout']||0xa;this[_0x562b('0x7')]=_0x1c60a1[_0x562b('0x7')]||_0x562b('0x8');this[_0x562b('0x9')]=_0x1c60a1[_0x562b('0x9')];this[_0x562b('0xa')]={};this[_0x562b('0xb')]=0x0;this[_0x562b('0x0')]='';this['updateRouting']();this[_0x562b('0xc')]();}OpenchannelQueue[_0x562b('0xd')][_0x562b('0xe')]=function(){var _0x389f6f=this[_0x562b('0xa')][_0x562b('0xf')];this[_0x562b('0xa')]=_[_0x562b('0x10')](this['Agents'],'id');this[_0x562b('0xa')][_0x562b('0xf')]=_0x389f6f;};OpenchannelQueue[_0x562b('0xd')][_0x562b('0xc')]=function(){this[_0x562b('0x11')]=0x0;this[_0x562b('0x12')]=0x0;for(var _0x205a58=0x0;_0x205a58=0x0?this[_0x562b('0x15')]:0x0;var _0x30034f={'id':this['id'],'available':this[_0x562b('0x15')],'loggedIn':this[_0x562b('0x11')],'name':this[_0x562b('0x5')],'paused':this[_0x562b('0x12')],'waiting':this[_0x562b('0xb')]};var _0xe5d924=md5(JSON[_0x562b('0x16')](_0x30034f));if(this['md5']!==_0xe5d924){this[_0x562b('0x0')]=_0xe5d924;io['to'](util[_0x562b('0x17')](_0x562b('0x18'),_0x30034f[_0x562b('0x5')]))['emit'](_0x562b('0x19'),_0x30034f);}};module[_0x562b('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 8c792cb..069db94 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 _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('0x1c')]=SmsQueue; \ No newline at end of file +var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x2fb7dd,_0xad78ec){var _0xc51ed9=function(_0x3a8410){while(--_0x3a8410){_0x2fb7dd['push'](_0x2fb7dd['shift']());}};_0xc51ed9(++_0xad78ec);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index aec0d93..bc944d4 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 _0xfc50=['available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','loggedIn','whatsappPause'];(function(_0x380120,_0x7dc75c){var _0x208b90=function(_0xa35c23){while(--_0xa35c23){_0x380120['push'](_0x380120['shift']());}};_0x208b90(++_0x7dc75c);}(_0xfc50,0x1d7));var _0x0fc5=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xfc50[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x0fc5('0x0'));var md5=require(_0x0fc5('0x1'));var util=require(_0x0fc5('0x2'));var Redis=require(_0x0fc5('0x3'));var config=require(_0x0fc5('0x4'));config[_0x0fc5('0x5')]=_[_0x0fc5('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0fc5('0x7'))(new Redis(config[_0x0fc5('0x5')]));function WhatsappQueue(_0x37dc35){this['id']=_0x37dc35['id']||0x0;this[_0x0fc5('0x8')]=_0x37dc35[_0x0fc5('0x8')]||'';this['timeout']=_0x37dc35[_0x0fc5('0x9')]||0xa;this[_0x0fc5('0xa')]=_0x37dc35[_0x0fc5('0xa')]||_0x0fc5('0xb');this[_0x0fc5('0xc')]=_0x37dc35[_0x0fc5('0xc')];this[_0x0fc5('0xd')]={};this[_0x0fc5('0xe')]=0x0;this[_0x0fc5('0x1')]='';this[_0x0fc5('0xf')]();this[_0x0fc5('0x10')]();}WhatsappQueue[_0x0fc5('0x11')][_0x0fc5('0xf')]=function(){var _0x1b4301=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this[_0x0fc5('0xc')],'id');this[_0x0fc5('0xd')][_0x0fc5('0x12')]=_0x1b4301;};WhatsappQueue[_0x0fc5('0x11')][_0x0fc5('0x10')]=function(){this['loggedIn']=0x0;this[_0x0fc5('0x13')]=0x0;for(var _0x30dd70=0x0;_0x30dd70=0x0?this[_0x0fc5('0x16')]:0x0;var _0xe82cc={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x0fc5('0x8')],'paused':this['paused'],'waiting':this[_0x0fc5('0xe')]};var _0x1819fc=md5(JSON[_0x0fc5('0x17')](_0xe82cc));if(this[_0x0fc5('0x1')]!==_0x1819fc){this[_0x0fc5('0x1')]=_0x1819fc;io['to'](util[_0x0fc5('0x18')](_0x0fc5('0x19'),_0xe82cc[_0x0fc5('0x8')]))[_0x0fc5('0x1a')](_0x0fc5('0x1b'),_0xe82cc);}};module[_0x0fc5('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x8fc3=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x3c2777,_0x17fa29){var _0x5b9e22=function(_0x18ac96){while(--_0x18ac96){_0x3c2777['push'](_0x3c2777['shift']());}};_0x5b9e22(++_0x17fa29);}(_0x8fc3,0xc4));var _0x38fc=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x8fc3[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0x38fc('0x0'));var md5=require(_0x38fc('0x1'));var util=require(_0x38fc('0x2'));var Redis=require(_0x38fc('0x3'));var config=require(_0x38fc('0x4'));config['redis']=_[_0x38fc('0x5')](config[_0x38fc('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x599880){this['id']=_0x599880['id']||0x0;this[_0x38fc('0x7')]=_0x599880[_0x38fc('0x7')]||'';this[_0x38fc('0x8')]=_0x599880[_0x38fc('0x8')]||0xa;this[_0x38fc('0x9')]=_0x599880[_0x38fc('0x9')]||_0x38fc('0xa');this['Agents']=_0x599880[_0x38fc('0xb')];this[_0x38fc('0xc')]={};this[_0x38fc('0xd')]=0x0;this[_0x38fc('0x1')]='';this[_0x38fc('0xe')]();this[_0x38fc('0xf')]();}WhatsappQueue[_0x38fc('0x10')][_0x38fc('0xe')]=function(){var _0x132fd4=this['mapAgentsId'][_0x38fc('0x11')];this['mapAgentsId']=_[_0x38fc('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x132fd4;};WhatsappQueue[_0x38fc('0x10')][_0x38fc('0xf')]=function(){this[_0x38fc('0x13')]=0x0;this[_0x38fc('0x14')]=0x0;for(var _0x176dde=0x0;_0x176dde=0x0?this[_0x38fc('0x18')]:0x0;var _0x49233a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x38fc('0x13')],'name':this[_0x38fc('0x7')],'paused':this[_0x38fc('0x14')],'waiting':this['waiting']};var _0x522613=md5(JSON[_0x38fc('0x19')](_0x49233a));if(this[_0x38fc('0x1')]!==_0x522613){this[_0x38fc('0x1')]=_0x522613;io['to'](util[_0x38fc('0x1a')]('whatsapp:queue:%s',_0x49233a[_0x38fc('0x7')]))[_0x38fc('0x1b')](_0x38fc('0x1c'),_0x49233a);}};module[_0x38fc('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 459ce73..2a8f543 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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7217,0x19e));var _0x7721=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7217[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x34e8=['smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initAgents','length','isUndefined','agents','initIntervals','openchannelQueues','updateRealtime','initChatQueues','updateRouting','initSmsQueues','initMailQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions'];(function(_0x1939a7,_0x3076b3){var _0x276975=function(_0x499dcd){while(--_0x499dcd){_0x1939a7['push'](_0x1939a7['shift']());}};_0x276975(++_0x3076b3);}(_0x34e8,0x12c));var _0x834e=function(_0x2e388e,_0x74df7a){_0x2e388e=_0x2e388e-0x0;var _0x372749=_0x34e8[_0x2e388e];return _0x372749;};'use strict';var BPromise=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var _=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var Agent=require('../model/agent');var Interval=require(_0x834e('0x4'));var OpenchannelQueue=require(_0x834e('0x5'));var ChatQueue=require(_0x834e('0x6'));var SmsQueue=require(_0x834e('0x7'));var MailQueue=require(_0x834e('0x8'));var FaxQueue=require(_0x834e('0x9'));var WhatsappQueue=require(_0x834e('0xa'));var Realtime=function(){this['agents']={};this[_0x834e('0xb')]={};this['openchannelQueues']={};this[_0x834e('0xc')]={};this[_0x834e('0xd')]={};this[_0x834e('0xe')]={};this[_0x834e('0xf')]={};this[_0x834e('0x10')]={};this[_0x834e('0x11')]={};this[_0x834e('0x12')]={};this[_0x834e('0x13')]={};this[_0x834e('0x14')]={};this[_0x834e('0x15')]={};this[_0x834e('0x16')]={};};function freeIsNotKey(_0x36e124,_0x14038b,_0x2e1a37){var _0x293514=_[_0x834e('0x17')](_0x36e124,function(_0x2fd95c,_0x538bb3){return _0x2fd95c[_0x2e1a37];});for(var _0x5e5b6d in _0x14038b){if(_0x14038b[_0x834e('0x18')](_0x5e5b6d)){if(!_0x293514[_0x5e5b6d]){delete _0x14038b[_0x5e5b6d];}}}}Realtime['prototype'][_0x834e('0x19')]=function(_0x2d95f2,_0x28e659){for(var _0x21cc0a in _0x28e659){if(_0x2d95f2['hasOwnProperty'](_0x21cc0a)){_0x2d95f2[_0x21cc0a]=_0x28e659[_0x21cc0a];}}};Realtime[_0x834e('0x1a')][_0x834e('0x1b')]=function(){var _0x57274a=this;return function(_0x316205){if(_0x316205){freeIsNotKey(_0x316205,_0x57274a['agents'],'id');for(var _0x38a8cd=0x0,_0x36d443={},_0x478afe={};_0x38a8cd<_0x316205[_0x834e('0x1c')];_0x38a8cd+=0x1){_0x36d443=_0x316205[_0x38a8cd];if(_[_0x834e('0x1d')](_0x57274a[_0x834e('0x1e')][_0x36d443['id']])){_0x57274a['agents'][_0x36d443['id']]=new Agent(_0x36d443);}else{_0x57274a[_0x834e('0x19')](_0x57274a[_0x834e('0x1e')][_0x36d443['id']],_0x36d443);}}}return _0x57274a[_0x834e('0x1e')];};};Realtime[_0x834e('0x1a')][_0x834e('0x1f')]=function(){var _0x254677=this;return function(_0x1dd214){if(_0x1dd214){freeIsNotKey(_0x1dd214,_0x254677['intervals'],'id');for(var _0x2545b4=0x0,_0x1fd2c6={},_0x113ff4={};_0x2545b4<_0x1dd214[_0x834e('0x1c')];_0x2545b4+=0x1){_0x1fd2c6=_0x1dd214[_0x2545b4];if(_['isUndefined'](_0x254677[_0x834e('0xb')][_0x1fd2c6['id']])){_0x254677[_0x834e('0xb')][_0x1fd2c6['id']]=new Interval(_0x1fd2c6);}else{_0x254677['mergeFromDatabase'](_0x254677[_0x834e('0xb')][_0x1fd2c6['id']],_0x1fd2c6);}}}return _0x254677[_0x834e('0xb')];};};Realtime[_0x834e('0x1a')]['initOpenchannelQueues']=function(){var _0x4e3f48=this;return function(_0x231619){if(_0x231619){freeIsNotKey(_0x231619,_0x4e3f48[_0x834e('0x20')],'id');for(var _0x589dde=0x0,_0x25ee1d={},_0x1dc1e0={};_0x589dde<_0x231619['length'];_0x589dde+=0x1){_0x25ee1d=_0x231619[_0x589dde];if(_[_0x834e('0x1d')](_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']])){_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']]=new OpenchannelQueue(_0x25ee1d);}else{_0x4e3f48['mergeFromDatabase'](_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']],_0x25ee1d);}_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']]['updateRouting']();_0x4e3f48['openchannelQueues'][_0x25ee1d['id']][_0x834e('0x21')]();}}return _0x4e3f48['openchannelQueues'];};};Realtime[_0x834e('0x1a')][_0x834e('0x22')]=function(){var _0x3db026=this;return function(_0x2cc2eb){if(_0x2cc2eb){freeIsNotKey(_0x2cc2eb,_0x3db026[_0x834e('0xc')],'id');for(var _0x130cc5=0x0,_0x491919={},_0x510780={};_0x130cc5<_0x2cc2eb['length'];_0x130cc5+=0x1){_0x491919=_0x2cc2eb[_0x130cc5];if(_['isUndefined'](_0x3db026[_0x834e('0xc')][_0x491919['id']])){_0x3db026[_0x834e('0xc')][_0x491919['id']]=new ChatQueue(_0x491919);}else{_0x3db026[_0x834e('0x19')](_0x3db026['chatQueues'][_0x491919['id']],_0x491919);}_0x3db026[_0x834e('0xc')][_0x491919['id']][_0x834e('0x23')]();_0x3db026[_0x834e('0xc')][_0x491919['id']][_0x834e('0x21')]();}}return _0x3db026[_0x834e('0xc')];};};Realtime[_0x834e('0x1a')][_0x834e('0x24')]=function(){var _0xfaf716=this;return function(_0x278db3){if(_0x278db3){freeIsNotKey(_0x278db3,_0xfaf716['smsQueues'],'id');for(var _0xef9ec2=0x0,_0x5cad11={},_0x2c75c2={};_0xef9ec2<_0x278db3[_0x834e('0x1c')];_0xef9ec2+=0x1){_0x5cad11=_0x278db3[_0xef9ec2];if(_[_0x834e('0x1d')](_0xfaf716[_0x834e('0xd')][_0x5cad11['id']])){_0xfaf716[_0x834e('0xd')][_0x5cad11['id']]=new SmsQueue(_0x5cad11);}else{_0xfaf716[_0x834e('0x19')](_0xfaf716[_0x834e('0xd')][_0x5cad11['id']],_0x5cad11);}_0xfaf716[_0x834e('0xd')][_0x5cad11['id']][_0x834e('0x23')]();_0xfaf716[_0x834e('0xd')][_0x5cad11['id']]['updateRealtime']();}}return _0xfaf716[_0x834e('0xd')];};};Realtime[_0x834e('0x1a')][_0x834e('0x25')]=function(){var _0xaf01f4=this;return function(_0x595cc0){if(_0x595cc0){freeIsNotKey(_0x595cc0,_0xaf01f4[_0x834e('0xe')],'id');for(var _0x379d60=0x0,_0x4b12f5={},_0x496533={};_0x379d60<_0x595cc0['length'];_0x379d60+=0x1){_0x4b12f5=_0x595cc0[_0x379d60];if(_[_0x834e('0x1d')](_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']])){_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']]=new MailQueue(_0x4b12f5);}else{_0xaf01f4[_0x834e('0x19')](_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']],_0x4b12f5);}_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']]['updateRouting']();_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']]['updateRealtime']();}}return _0xaf01f4[_0x834e('0xe')];};};Realtime[_0x834e('0x1a')]['initFaxQueues']=function(){var _0x18ac3b=this;return function(_0x2f56c7){if(_0x2f56c7){freeIsNotKey(_0x2f56c7,_0x18ac3b['faxQueues'],'id');for(var _0x481f70=0x0,_0x388711={},_0xd0d43a={};_0x481f70<_0x2f56c7[_0x834e('0x1c')];_0x481f70+=0x1){_0x388711=_0x2f56c7[_0x481f70];if(_[_0x834e('0x1d')](_0x18ac3b[_0x834e('0xf')][_0x388711['id']])){_0x18ac3b['faxQueues'][_0x388711['id']]=new FaxQueue(_0x388711);}else{_0x18ac3b[_0x834e('0x19')](_0x18ac3b['faxQueues'][_0x388711['id']],_0x388711);}_0x18ac3b['faxQueues'][_0x388711['id']][_0x834e('0x23')]();_0x18ac3b['faxQueues'][_0x388711['id']][_0x834e('0x21')]();}}return _0x18ac3b[_0x834e('0xf')];};};Realtime[_0x834e('0x1a')][_0x834e('0x26')]=function(){var _0x2b7933=this;return function(_0x574ea8){if(_0x574ea8){freeIsNotKey(_0x574ea8,_0x2b7933[_0x834e('0x10')],'id');for(var _0x26b847=0x0,_0x38f266={},_0x58c5fb={};_0x26b847<_0x574ea8[_0x834e('0x1c')];_0x26b847+=0x1){_0x38f266=_0x574ea8[_0x26b847];if(_[_0x834e('0x1d')](_0x2b7933['whatsappQueues'][_0x38f266['id']])){_0x2b7933[_0x834e('0x10')][_0x38f266['id']]=new WhatsappQueue(_0x38f266);}else{_0x2b7933['mergeFromDatabase'](_0x2b7933[_0x834e('0x10')][_0x38f266['id']],_0x38f266);}_0x2b7933[_0x834e('0x10')][_0x38f266['id']]['updateRouting']();_0x2b7933['whatsappQueues'][_0x38f266['id']][_0x834e('0x21')]();}}return _0x2b7933[_0x834e('0x10')];};};module[_0x834e('0x27')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index c7fca70..19a04da 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 _0x321d=['addTags','Request','AddTagsToChatInteraction','../client','UpdateChatInteraction'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0x321d,0x1ed));var _0xd321=function(_0x24db8a,_0x4b8606){_0x24db8a=_0x24db8a-0x0;var _0x3f04a1=_0x321d[_0x24db8a];return _0x3f04a1;};'use strict';var client=require(_0xd321('0x0'));exports['update']=function(_0x1865ca,_0x349f64){return client['Request'](_0xd321('0x1'),{'body':_0x349f64,'options':{'where':{'id':_0x1865ca}},'log':'updateChatInteraction'});};exports[_0xd321('0x2')]=function(_0x45619d,_0x5cbd33){return client[_0xd321('0x3')](_0xd321('0x4'),{'body':_0x5cbd33,'options':{'where':{'id':_0x45619d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x78e4=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x14c630,_0x41f0d1){var _0x5af3a9=function(_0x551070){while(--_0x551070){_0x14c630['push'](_0x14c630['shift']());}};_0x5af3a9(++_0x41f0d1);}(_0x78e4,0xd1));var _0x478e=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x78e4[_0x101e7b];return _0x4995c0;};'use strict';var client=require(_0x478e('0x0'));exports[_0x478e('0x1')]=function(_0x12ce84,_0x17ea64){return client[_0x478e('0x2')](_0x478e('0x3'),{'body':_0x17ea64,'options':{'where':{'id':_0x12ce84}},'log':_0x478e('0x4')});};exports[_0x478e('0x5')]=function(_0x145173,_0x2834ec){return client['Request'](_0x478e('0x6'),{'body':_0x2834ec,'options':{'where':{'id':_0x145173}},'log':_0x478e('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index cbd4552..253941a 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 _0x5dd5=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x19f1af,_0x4fce90){var _0x532460=function(_0x11de71){while(--_0x11de71){_0x19f1af['push'](_0x19f1af['shift']());}};_0x532460(++_0x4fce90);}(_0x5dd5,0x108));var _0x55dd=function(_0x1adde2,_0x54c2bf){_0x1adde2=_0x1adde2-0x0;var _0x4e821d=_0x5dd5[_0x1adde2];return _0x4e821d;};'use strict';var client=require(_0x55dd('0x0'));exports[_0x55dd('0x1')]=function(_0x1fd0f4){return client['Request'](_0x55dd('0x2'),{'body':_0x1fd0f4,'log':_0x55dd('0x3')});}; \ No newline at end of file +var _0x096a=['CreateChatMessage','create'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x096a,0x89));var _0xa096=function(_0x40b61b,_0x4ef826){_0x40b61b=_0x40b61b-0x0;var _0x33d8ad=_0x096a[_0x40b61b];return _0x33d8ad;};'use strict';var client=require('../client');exports[_0xa096('0x0')]=function(_0x55c05e){return client['Request'](_0xa096('0x1'),{'body':_0x55c05e,'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 74e8962..a89ce95 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 _0x8f60=['timeout','strategy','User','name','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x41b683,_0x80a3a0){var _0x599f8c=function(_0x504c33){while(--_0x504c33){_0x41b683['push'](_0x41b683['shift']());}};_0x599f8c(++_0x80a3a0);}(_0x8f60,0x146));var _0x08f6=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0x8f60[_0x3de4f8];return _0x3d81fc;};'use strict';var client=require(_0x08f6('0x0'));exports[_0x08f6('0x1')]=function(){return function(){return client[_0x08f6('0x2')](_0x08f6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x08f6('0x4'),_0x08f6('0x5')],'include':[{'model':_0x08f6('0x6'),'as':'Agents','attributes':['id',_0x08f6('0x7'),_0x08f6('0x8'),_0x08f6('0x9')]}]},'log':_0x08f6('0x1')});};}; \ No newline at end of file +var _0x1372=['online','chatPause','../client','GetChatQueue','name','timeout','strategy','User'];(function(_0x430e6e,_0x180916){var _0x5de0ef=function(_0xd90bb5){while(--_0xd90bb5){_0x430e6e['push'](_0x430e6e['shift']());}};_0x5de0ef(++_0x180916);}(_0x1372,0x11a));var _0x2137=function(_0x57d33a,_0xbe9aa1){_0x57d33a=_0x57d33a-0x0;var _0x4c8c73=_0x1372[_0x57d33a];return _0x4c8c73;};'use strict';var client=require(_0x2137('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x2137('0x1'),{'options':{'raw':![],'attributes':['id',_0x2137('0x2'),_0x2137('0x3'),_0x2137('0x4')],'include':[{'model':_0x2137('0x5'),'as':'Agents','attributes':['id',_0x2137('0x2'),_0x2137('0x6'),_0x2137('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e1699e9..3520ca7 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 _0xe062=['Request','CreateChatQueueReport','UpdateChatQueueReport','../client','create'];(function(_0x50bcf4,_0x1c23cf){var _0xd99f7=function(_0xa8fd6d){while(--_0xa8fd6d){_0x50bcf4['push'](_0x50bcf4['shift']());}};_0xd99f7(++_0x1c23cf);}(_0xe062,0xd5));var _0x2e06=function(_0x1ba380,_0x30f608){_0x1ba380=_0x1ba380-0x0;var _0x8265b4=_0xe062[_0x1ba380];return _0x8265b4;};'use strict';var client=require(_0x2e06('0x0'));exports[_0x2e06('0x1')]=function(_0x4827bc){return client[_0x2e06('0x2')](_0x2e06('0x3'),{'body':_0x4827bc,'log':_0x2e06('0x3')});};exports['update']=function(_0x4d80de,_0x1a9d7d){return client[_0x2e06('0x2')]('UpdateChatQueueReport',{'body':_0x1a9d7d,'options':{'where':{'uniqueid':_0x4d80de},'order':[['id','DESC']],'limit':0x1},'log':_0x2e06('0x4')});}; \ No newline at end of file +var _0x5d55=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x1a2625,_0x235a40){var _0x35c172=function(_0x449e7f){while(--_0x449e7f){_0x1a2625['push'](_0x1a2625['shift']());}};_0x35c172(++_0x235a40);}(_0x5d55,0x1a4));var _0x55d5=function(_0x2db81d,_0xe0672a){_0x2db81d=_0x2db81d-0x0;var _0x5d2f9f=_0x5d55[_0x2db81d];return _0x5d2f9f;};'use strict';var client=require('../client');exports[_0x55d5('0x0')]=function(_0x4cd0e2){return client[_0x55d5('0x1')](_0x55d5('0x2'),{'body':_0x4cd0e2,'log':'CreateChatQueueReport'});};exports[_0x55d5('0x3')]=function(_0x12beec,_0x3bca0b){return client['Request'](_0x55d5('0x4'),{'body':_0x3bca0b,'options':{'where':{'uniqueid':_0x12beec},'order':[['id',_0x55d5('0x5')]],'limit':0x1},'log':_0x55d5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a06859c..21d539c 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 _0x71a2=['addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request','updateFaxInteraction'];(function(_0x539b92,_0xd02f53){var _0x2605f5=function(_0x355e61){while(--_0x355e61){_0x539b92['push'](_0x539b92['shift']());}};_0x2605f5(++_0xd02f53);}(_0x71a2,0x17d));var _0x271a=function(_0x304386,_0x319535){_0x304386=_0x304386-0x0;var _0x2696b2=_0x71a2[_0x304386];return _0x2696b2;};'use strict';var client=require(_0x271a('0x0'));exports[_0x271a('0x1')]=function(_0x8167e8,_0xb3d9f1){return client[_0x271a('0x2')]('UpdateFaxInteraction',{'body':_0xb3d9f1,'options':{'where':{'id':_0x8167e8}},'log':_0x271a('0x3')});};exports[_0x271a('0x4')]=function(_0x16ec4d,_0x4710bb){return client[_0x271a('0x2')](_0x271a('0x5'),{'body':_0x4710bb,'options':{'where':{'id':_0x16ec4d}},'log':_0x271a('0x6')});}; \ No newline at end of file +var _0x6015=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0x51f3f8,_0x1fef75){var _0x3106b1=function(_0x30468a){while(--_0x30468a){_0x51f3f8['push'](_0x51f3f8['shift']());}};_0x3106b1(++_0x1fef75);}(_0x6015,0x1a4));var _0x5601=function(_0x26ab91,_0x5da477){_0x26ab91=_0x26ab91-0x0;var _0x276398=_0x6015[_0x26ab91];return _0x276398;};'use strict';var client=require(_0x5601('0x0'));exports[_0x5601('0x1')]=function(_0x455759,_0x35bdf3){return client[_0x5601('0x2')](_0x5601('0x3'),{'body':_0x35bdf3,'options':{'where':{'id':_0x455759}},'log':_0x5601('0x4')});};exports[_0x5601('0x5')]=function(_0x7d4e16,_0x4b4209){return client[_0x5601('0x2')](_0x5601('0x6'),{'body':_0x4b4209,'options':{'where':{'id':_0x7d4e16}},'log':_0x5601('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index af18c7a..6786e49 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 _0x796f=['../client','create','createFaxMessage'];(function(_0xe9e6cf,_0x395f6d){var _0x2b8851=function(_0x4d6bd4){while(--_0x4d6bd4){_0xe9e6cf['push'](_0xe9e6cf['shift']());}};_0x2b8851(++_0x395f6d);}(_0x796f,0x18c));var _0xf796=function(_0x18ebf7,_0x571503){_0x18ebf7=_0x18ebf7-0x0;var _0x9cd215=_0x796f[_0x18ebf7];return _0x9cd215;};'use strict';var client=require(_0xf796('0x0'));exports[_0xf796('0x1')]=function(_0x2c1658){return client['Request']('CreateFaxMessage',{'body':_0x2c1658,'log':_0xf796('0x2')});}; \ No newline at end of file +var _0x0ba3=['CreateFaxMessage','../client','create','Request'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0ba3,0x181));var _0x30ba=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x0ba3[_0x178856];return _0x3c7fe7;};'use strict';var client=require(_0x30ba('0x0'));exports[_0x30ba('0x1')]=function(_0x194f03){return client[_0x30ba('0x2')](_0x30ba('0x3'),{'body':_0x194f03,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d3c9a44..bf4910b 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 _0x978e=['GetFaxQueue','name','timeout','strategy','User','faxPause','getFaxQueues','../client','Request'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x978e,0x193));var _0xe978=function(_0x6c00f9,_0x31f5ce){_0x6c00f9=_0x6c00f9-0x0;var _0x29e4aa=_0x978e[_0x6c00f9];return _0x29e4aa;};'use strict';var client=require(_0xe978('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xe978('0x1')](_0xe978('0x2'),{'options':{'raw':![],'attributes':['id',_0xe978('0x3'),_0xe978('0x4'),_0xe978('0x5')],'include':[{'model':_0xe978('0x6'),'as':'Agents','attributes':['id','name','online',_0xe978('0x7')]}]},'log':_0xe978('0x8')});};}; \ No newline at end of file +var _0xc5e1=['online','../client','getFaxQueues','timeout','strategy','User','Agents','name'];(function(_0x43a8e4,_0x1543cf){var _0x506cf6=function(_0x2b31e9){while(--_0x2b31e9){_0x43a8e4['push'](_0x43a8e4['shift']());}};_0x506cf6(++_0x1543cf);}(_0xc5e1,0x1b1));var _0x1c5e=function(_0x393556,_0x8006dd){_0x393556=_0x393556-0x0;var _0x59850=_0xc5e1[_0x393556];return _0x59850;};'use strict';var client=require(_0x1c5e('0x0'));exports[_0x1c5e('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x1c5e('0x2'),_0x1c5e('0x3')],'include':[{'model':_0x1c5e('0x4'),'as':_0x1c5e('0x5'),'attributes':['id',_0x1c5e('0x6'),_0x1c5e('0x7'),'faxPause']}]},'log':_0x1c5e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index c8eb905..f2c554e 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 _0xe303=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x288970,_0x583a71){var _0x20c9a0=function(_0x5de9bb){while(--_0x5de9bb){_0x288970['push'](_0x288970['shift']());}};_0x20c9a0(++_0x583a71);}(_0xe303,0x11b));var _0x3e30=function(_0x16d411,_0x5e0970){_0x16d411=_0x16d411-0x0;var _0x20336d=_0xe303[_0x16d411];return _0x20336d;};'use strict';var client=require(_0x3e30('0x0'));exports[_0x3e30('0x1')]=function(_0x4c5b53){return client[_0x3e30('0x2')](_0x3e30('0x3'),{'body':_0x4c5b53,'log':'CreateFaxQueueReport'});};exports[_0x3e30('0x4')]=function(_0x1e0f4b,_0x41f23f){return client[_0x3e30('0x2')](_0x3e30('0x5'),{'body':_0x41f23f,'options':{'where':{'uniqueid':_0x1e0f4b},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x1a39=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','../client','create'];(function(_0x55c64c,_0x12c886){var _0x270571=function(_0x17c91d){while(--_0x17c91d){_0x55c64c['push'](_0x55c64c['shift']());}};_0x270571(++_0x12c886);}(_0x1a39,0xd0));var _0x91a3=function(_0x3a499a,_0xcebf64){_0x3a499a=_0x3a499a-0x0;var _0x5dada5=_0x1a39[_0x3a499a];return _0x5dada5;};'use strict';var client=require(_0x91a3('0x0'));exports[_0x91a3('0x1')]=function(_0x61babc){return client[_0x91a3('0x2')]('CreateFaxQueueReport',{'body':_0x61babc,'log':_0x91a3('0x3')});};exports['update']=function(_0x15e172,_0x3a5a83){return client[_0x91a3('0x2')](_0x91a3('0x4'),{'body':_0x3a5a83,'options':{'where':{'uniqueid':_0x15e172},'order':[['id','DESC']],'limit':0x1},'log':_0x91a3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index feab7cb..667b379 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 _0x4f7b=['Request','GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x5bc444,_0x40470c){_0x5bc444=_0x5bc444-0x0;var _0x107089=_0x4f7b[_0x5bc444];return _0x107089;};'use strict';var client=require(_0xb4f7('0x0'));exports[_0xb4f7('0x1')]=function(){return function(){return client[_0xb4f7('0x2')](_0xb4f7('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xb4f7('0x4'),'as':_0xb4f7('0x5'),'attributes':['id',_0xb4f7('0x6'),_0xb4f7('0x7')]}]},'log':_0xb4f7('0x1')});};}; \ No newline at end of file +var _0xd914=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd914,0x17f));var _0x4d91=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0xd914[_0x44ca6e];return _0x2edab2;};'use strict';var client=require(_0x4d91('0x0'));exports[_0x4d91('0x1')]=function(){return function(){return client['Request'](_0x4d91('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4d91('0x3')],'include':[{'model':_0x4d91('0x4'),'as':_0x4d91('0x5'),'attributes':['id',_0x4d91('0x3'),_0x4d91('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ad0fa8b..6ce63bf 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 _0x6c03=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x3ff0a7,_0x210e0a){var _0xff5104=function(_0x11c2bd){while(--_0x11c2bd){_0x3ff0a7['push'](_0x3ff0a7['shift']());}};_0xff5104(++_0x210e0a);}(_0x6c03,0x1a5));var _0x36c0=function(_0x3013ff,_0x4926c8){_0x3013ff=_0x3013ff-0x0;var _0x2d2c58=_0x6c03[_0x3013ff];return _0x2d2c58;};'use strict';var client=require(_0x36c0('0x0'));exports[_0x36c0('0x1')]=function(_0x3c1e9d,_0x81d856){return client[_0x36c0('0x2')](_0x36c0('0x3'),{'body':_0x81d856,'options':{'where':{'id':_0x3c1e9d}},'log':'updateMailInteraction'});};exports[_0x36c0('0x4')]=function(_0x50812e,_0x40131a){return client['Request'](_0x36c0('0x5'),{'body':_0x40131a,'options':{'where':{'id':_0x50812e}},'log':_0x36c0('0x6')});}; \ No newline at end of file +var _0xcb63=['UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request'];(function(_0xe9b6c9,_0x18146b){var _0x48c5aa=function(_0x2650af){while(--_0x2650af){_0xe9b6c9['push'](_0xe9b6c9['shift']());}};_0x48c5aa(++_0x18146b);}(_0xcb63,0x82));var _0x3cb6=function(_0x280727,_0x4432ea){_0x280727=_0x280727-0x0;var _0x5e81b8=_0xcb63[_0x280727];return _0x5e81b8;};'use strict';var client=require(_0x3cb6('0x0'));exports['update']=function(_0x453a7e,_0x5c312b){return client[_0x3cb6('0x1')](_0x3cb6('0x2'),{'body':_0x5c312b,'options':{'where':{'id':_0x453a7e}},'log':_0x3cb6('0x3')});};exports['addTags']=function(_0x17850f,_0x459cae){return client['Request'](_0x3cb6('0x4'),{'body':_0x459cae,'options':{'where':{'id':_0x17850f}},'log':_0x3cb6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 01f6d35..31e5c80 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 _0x9015=['Request','createMailMessage','../client','create'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x9015,0x18a));var _0x5901=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9015[_0x27af45];return _0x18df21;};'use strict';var client=require(_0x5901('0x0'));exports[_0x5901('0x1')]=function(_0x3349a7){return client[_0x5901('0x2')]('CreateMailMessage',{'body':_0x3349a7,'log':_0x5901('0x3')});}; \ No newline at end of file +var _0xf74b=['CreateMailMessage','../client','Request'];(function(_0x43b49b,_0x4a3600){var _0x4067af=function(_0x32487e){while(--_0x32487e){_0x43b49b['push'](_0x43b49b['shift']());}};_0x4067af(++_0x4a3600);}(_0xf74b,0x1e7));var _0xbf74=function(_0xf29c48,_0x2c45d1){_0xf29c48=_0xf29c48-0x0;var _0x43c391=_0xf74b[_0xf29c48];return _0x43c391;};'use strict';var client=require(_0xbf74('0x0'));exports['create']=function(_0x1e821b){return client[_0xbf74('0x1')](_0xbf74('0x2'),{'body':_0x1e821b,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 5158aa0..34f0f80 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 _0x14cf=['name','online','getMailQueues','GetMailQueue','timeout','User','Agents'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x14cf,0xb8));var _0xf14c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x14cf[_0x3b380d];return _0x54502b;};'use strict';var client=require('../client');exports[_0xf14c('0x0')]=function(){return function(){return client['Request'](_0xf14c('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xf14c('0x2'),'strategy'],'include':[{'model':_0xf14c('0x3'),'as':_0xf14c('0x4'),'attributes':['id',_0xf14c('0x5'),_0xf14c('0x6'),'mailPause']}]},'log':_0xf14c('0x0')});};}; \ No newline at end of file +var _0x405d=['timeout','strategy','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0x405d,0x9b));var _0xd405=function(_0x1d3c41,_0x21d3ad){_0x1d3c41=_0x1d3c41-0x0;var _0x46d440=_0x405d[_0x1d3c41];return _0x46d440;};'use strict';var client=require(_0xd405('0x0'));exports[_0xd405('0x1')]=function(){return function(){return client[_0xd405('0x2')](_0xd405('0x3'),{'options':{'raw':![],'attributes':['id',_0xd405('0x4'),_0xd405('0x5'),_0xd405('0x6')],'include':[{'model':'User','as':_0xd405('0x7'),'attributes':['id','name',_0xd405('0x8'),_0xd405('0x9')]}]},'log':_0xd405('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index bece808..6c4fb32 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 _0xf3e0=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create'];(function(_0x751cdf,_0x420d65){var _0xfcc76e=function(_0x44873e){while(--_0x44873e){_0x751cdf['push'](_0x751cdf['shift']());}};_0xfcc76e(++_0x420d65);}(_0xf3e0,0xa0));var _0x0f3e=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xf3e0[_0x1b6186];return _0x186121;};'use strict';var client=require(_0x0f3e('0x0'));exports[_0x0f3e('0x1')]=function(_0x5e467a){return client[_0x0f3e('0x2')](_0x0f3e('0x3'),{'body':_0x5e467a,'log':_0x0f3e('0x3')});};exports['update']=function(_0xda87d0,_0x18c14b){return client[_0x0f3e('0x2')](_0x0f3e('0x4'),{'body':_0x18c14b,'options':{'where':{'uniqueid':_0xda87d0},'order':[['id',_0x0f3e('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x4205=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x17b66d,_0x45c739){var _0x1a3f0e=function(_0x14f893){while(--_0x14f893){_0x17b66d['push'](_0x17b66d['shift']());}};_0x1a3f0e(++_0x45c739);}(_0x4205,0x93));var _0x5420=function(_0x5e8a40,_0x2e7ad7){_0x5e8a40=_0x5e8a40-0x0;var _0x367404=_0x4205[_0x5e8a40];return _0x367404;};'use strict';var client=require(_0x5420('0x0'));exports[_0x5420('0x1')]=function(_0x215912){return client[_0x5420('0x2')](_0x5420('0x3'),{'body':_0x215912,'log':_0x5420('0x3')});};exports[_0x5420('0x4')]=function(_0x4f4f58,_0x1b23d1){return client[_0x5420('0x2')](_0x5420('0x5'),{'body':_0x1b23d1,'options':{'where':{'uniqueid':_0x4f4f58},'order':[['id',_0x5420('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d0e54c0..4a0f30c 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 _0x80b7=['Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0xc44074,_0x3d1e1f){var _0x17e708=function(_0x6dc6ae){while(--_0x6dc6ae){_0xc44074['push'](_0xc44074['shift']());}};_0x17e708(++_0x3d1e1f);}(_0x80b7,0x106));var _0x780b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x80b7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x780b('0x0'));exports[_0x780b('0x1')]=function(_0x3c739d,_0x5ce072){return client[_0x780b('0x2')]('UpdateOpenchannelInteraction',{'body':_0x5ce072,'options':{'where':{'id':_0x3c739d}},'log':_0x780b('0x3')});};exports['addTags']=function(_0x46aa33,_0x548d5f){return client[_0x780b('0x2')](_0x780b('0x4'),{'body':_0x548d5f,'options':{'where':{'id':_0x46aa33}},'log':_0x780b('0x5')});}; \ No newline at end of file +var _0x34ff=['addTagsToChatInteraction','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x35960d,_0x3a9eec){var _0x1a7da5=function(_0x563010){while(--_0x563010){_0x35960d['push'](_0x35960d['shift']());}};_0x1a7da5(++_0x3a9eec);}(_0x34ff,0xe1));var _0xf34f=function(_0x5d56f3,_0xe9a8a3){_0x5d56f3=_0x5d56f3-0x0;var _0x5affee=_0x34ff[_0x5d56f3];return _0x5affee;};'use strict';var client=require('../client');exports[_0xf34f('0x0')]=function(_0x4f6111,_0x41659b){return client['Request'](_0xf34f('0x1'),{'body':_0x41659b,'options':{'where':{'id':_0x4f6111}},'log':_0xf34f('0x2')});};exports[_0xf34f('0x3')]=function(_0x3a1f85,_0x1a0ea6){return client[_0xf34f('0x4')](_0xf34f('0x5'),{'body':_0x1a0ea6,'options':{'where':{'id':_0x3a1f85}},'log':_0xf34f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 7731eb1..b543e20 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 _0x6f0d=['CreateOpenchannelMessage','create','Request'];(function(_0x36218e,_0x516d2e){var _0x354293=function(_0x3e9362){while(--_0x3e9362){_0x36218e['push'](_0x36218e['shift']());}};_0x354293(++_0x516d2e);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x302a71,_0x13c8af){_0x302a71=_0x302a71-0x0;var _0x35bae3=_0x6f0d[_0x302a71];return _0x35bae3;};'use strict';var client=require('../client');exports[_0xd6f0('0x0')]=function(_0x64ebf2){return client[_0xd6f0('0x1')](_0xd6f0('0x2'),{'body':_0x64ebf2,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x5b02=['create','Request','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x3f3fb9,_0x5028d4){_0x3f3fb9=_0x3f3fb9-0x0;var _0x3fe667=_0x5b02[_0x3f3fb9];return _0x3fe667;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(_0x428458){return client[_0x25b0('0x2')]('CreateOpenchannelMessage',{'body':_0x428458,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8404556..3f2e587 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 _0x3a05=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','openchannelPause'];(function(_0x33ed66,_0x24903a){var _0x3f3a=function(_0x4c885d){while(--_0x4c885d){_0x33ed66['push'](_0x33ed66['shift']());}};_0x3f3a(++_0x24903a);}(_0x3a05,0x118));var _0x53a0=function(_0x2ecd0c,_0xf8d744){_0x2ecd0c=_0x2ecd0c-0x0;var _0x1d7094=_0x3a05[_0x2ecd0c];return _0x1d7094;};'use strict';var client=require(_0x53a0('0x0'));exports[_0x53a0('0x1')]=function(){return function(){return client[_0x53a0('0x2')](_0x53a0('0x3'),{'options':{'raw':![],'attributes':['id',_0x53a0('0x4'),_0x53a0('0x5'),_0x53a0('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0x53a0('0x7')]}]},'log':_0x53a0('0x1')});};}; \ No newline at end of file +var _0x6d15=['timeout','Agents','../client','getOpenchannelQueues','Request','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d15,0x9e));var _0x56d1=function(_0x1933e5,_0x46fbdd){_0x1933e5=_0x1933e5-0x0;var _0x4d9ab6=_0x6d15[_0x1933e5];return _0x4d9ab6;};'use strict';var client=require(_0x56d1('0x0'));exports[_0x56d1('0x1')]=function(){return function(){return client[_0x56d1('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x56d1('0x3'),_0x56d1('0x4'),'strategy'],'include':[{'model':'User','as':_0x56d1('0x5'),'attributes':['id','name','online','openchannelPause']}]},'log':_0x56d1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 60c32bc..c014197 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 _0x6385=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','Request'];(function(_0xe96574,_0x1e7647){var _0x3fa4be=function(_0x258f88){while(--_0x258f88){_0xe96574['push'](_0xe96574['shift']());}};_0x3fa4be(++_0x1e7647);}(_0x6385,0x16d));var _0x5638=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x6385[_0x224f65];return _0x3f921c;};'use strict';var client=require('../client');exports['create']=function(_0x437670){return client[_0x5638('0x0')](_0x5638('0x1'),{'body':_0x437670,'log':_0x5638('0x1')});};exports['update']=function(_0x44cdfa,_0x5bd84e){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x5bd84e,'options':{'where':{'uniqueid':_0x44cdfa},'order':[['id','DESC']],'limit':0x1},'log':_0x5638('0x2')});}; \ No newline at end of file +var _0x47ef=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','Request'];(function(_0x35731c,_0x5ab1d1){var _0x2f2957=function(_0x2d6583){while(--_0x2d6583){_0x35731c['push'](_0x35731c['shift']());}};_0x2f2957(++_0x5ab1d1);}(_0x47ef,0x81));var _0xf47e=function(_0x57398b,_0x1328ff){_0x57398b=_0x57398b-0x0;var _0x708c1=_0x47ef[_0x57398b];return _0x708c1;};'use strict';var client=require('../client');exports['create']=function(_0x5abeb8){return client[_0xf47e('0x0')]('CreateOpenchannelQueueReport',{'body':_0x5abeb8,'log':_0xf47e('0x1')});};exports[_0xf47e('0x2')]=function(_0x544270,_0x45a3de){return client[_0xf47e('0x0')](_0xf47e('0x3'),{'body':_0x45a3de,'options':{'where':{'uniqueid':_0x544270},'order':[['id',_0xf47e('0x4')]],'limit':0x1},'log':_0xf47e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 912386d..87fa95f 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 _0x11ea=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x51e347,_0x1b565a){var _0x49ab46=function(_0x5962cf){while(--_0x5962cf){_0x51e347['push'](_0x51e347['shift']());}};_0x49ab46(++_0x1b565a);}(_0x11ea,0x16e));var _0xa11e=function(_0x30cab8,_0x59c0b4){_0x30cab8=_0x30cab8-0x0;var _0x195b8b=_0x11ea[_0x30cab8];return _0x195b8b;};'use strict';var client=require(_0xa11e('0x0'));exports['update']=function(_0x234a71,_0x2b842b){return client[_0xa11e('0x1')](_0xa11e('0x2'),{'body':_0x2b842b,'options':{'where':{'id':_0x234a71}},'log':_0xa11e('0x3')});};exports[_0xa11e('0x4')]=function(_0x36c909,_0x4c5200){return client[_0xa11e('0x1')]('AddTagsToSmsInteraction',{'body':_0x4c5200,'options':{'where':{'id':_0x36c909}},'log':_0xa11e('0x5')});}; \ No newline at end of file +var _0xf899=['AddTagsToSmsInteraction','Request','updateSmsInteraction','addTags'];(function(_0x3e18e2,_0xf8c659){var _0x3ad70d=function(_0x2cf0db){while(--_0x2cf0db){_0x3e18e2['push'](_0x3e18e2['shift']());}};_0x3ad70d(++_0xf8c659);}(_0xf899,0x19d));var _0x9f89=function(_0x369a7b,_0x55c590){_0x369a7b=_0x369a7b-0x0;var _0x50f4d1=_0xf899[_0x369a7b];return _0x50f4d1;};'use strict';var client=require('../client');exports['update']=function(_0x265361,_0x47e979){return client[_0x9f89('0x0')]('UpdateSmsInteraction',{'body':_0x47e979,'options':{'where':{'id':_0x265361}},'log':_0x9f89('0x1')});};exports[_0x9f89('0x2')]=function(_0x12344a,_0x110c2b){return client[_0x9f89('0x0')](_0x9f89('0x3'),{'body':_0x110c2b,'options':{'where':{'id':_0x12344a}},'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 67bc71f..2601e3c 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 _0xe898=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x417b24,_0x489083){var _0xbf273d=function(_0x4e5e4c){while(--_0x4e5e4c){_0x417b24['push'](_0x417b24['shift']());}};_0xbf273d(++_0x489083);}(_0xe898,0x156));var _0x8e89=function(_0x46dc29,_0x18c45a){_0x46dc29=_0x46dc29-0x0;var _0x4bbb8d=_0xe898[_0x46dc29];return _0x4bbb8d;};'use strict';var client=require(_0x8e89('0x0'));exports[_0x8e89('0x1')]=function(_0x2c1ef5){return client[_0x8e89('0x2')](_0x8e89('0x3'),{'body':_0x2c1ef5,'log':_0x8e89('0x4')});}; \ No newline at end of file +var _0x8f13=['../client','Request'];(function(_0x244a5d,_0x304ae5){var _0x1fc0d3=function(_0x2f9131){while(--_0x2f9131){_0x244a5d['push'](_0x244a5d['shift']());}};_0x1fc0d3(++_0x304ae5);}(_0x8f13,0xac));var _0x38f1=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x8f13[_0x3c858f];return _0x198090;};'use strict';var client=require(_0x38f1('0x0'));exports['create']=function(_0x4fd31a){return client[_0x38f1('0x1')]('CreateSmsMessage',{'body':_0x4fd31a,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 76d1ec8..61b9b66 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 _0x0519=['Agents','online','smsPause','../client','getSmsQueues','GetSmsQueue','name','timeout','User'];(function(_0x5d25c0,_0xee5570){var _0x276f89=function(_0x241bc0){while(--_0x241bc0){_0x5d25c0['push'](_0x5d25c0['shift']());}};_0x276f89(++_0xee5570);}(_0x0519,0x1d7));var _0x9051=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x0519[_0x27ddf5];return _0x26e74a;};'use strict';var client=require(_0x9051('0x0'));exports[_0x9051('0x1')]=function(){return function(){return client['Request'](_0x9051('0x2'),{'options':{'raw':![],'attributes':['id',_0x9051('0x3'),_0x9051('0x4'),'strategy'],'include':[{'model':_0x9051('0x5'),'as':_0x9051('0x6'),'attributes':['id',_0x9051('0x3'),_0x9051('0x7'),_0x9051('0x8')]}]},'log':_0x9051('0x1')});};}; \ No newline at end of file +var _0xa3db=['../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa3db,0x183));var _0xba3d=function(_0x654576,_0x325445){_0x654576=_0x654576-0x0;var _0x507697=_0xa3db[_0x654576];return _0x507697;};'use strict';var client=require(_0xba3d('0x0'));exports[_0xba3d('0x1')]=function(){return function(){return client[_0xba3d('0x2')](_0xba3d('0x3'),{'options':{'raw':![],'attributes':['id',_0xba3d('0x4'),_0xba3d('0x5'),_0xba3d('0x6')],'include':[{'model':'User','as':_0xba3d('0x7'),'attributes':['id',_0xba3d('0x4'),_0xba3d('0x8'),'smsPause']}]},'log':_0xba3d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 2f0d384..2ae66dd 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 _0xea63=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create','Request'];(function(_0x3dbccc,_0x56c4a7){var _0x560c00=function(_0x4371b1){while(--_0x4371b1){_0x3dbccc['push'](_0x3dbccc['shift']());}};_0x560c00(++_0x56c4a7);}(_0xea63,0x138));var _0x3ea6=function(_0xe99b18,_0x54b682){_0xe99b18=_0xe99b18-0x0;var _0x1e7171=_0xea63[_0xe99b18];return _0x1e7171;};'use strict';var client=require(_0x3ea6('0x0'));exports[_0x3ea6('0x1')]=function(_0x47ad73){return client[_0x3ea6('0x2')](_0x3ea6('0x3'),{'body':_0x47ad73,'log':_0x3ea6('0x3')});};exports[_0x3ea6('0x4')]=function(_0x570dca,_0x3fb371){return client['Request'](_0x3ea6('0x5'),{'body':_0x3fb371,'options':{'where':{'uniqueid':_0x570dca},'order':[['id',_0x3ea6('0x6')]],'limit':0x1},'log':_0x3ea6('0x5')});}; \ No newline at end of file +var _0x390a=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x1906ce,_0x130698){var _0x3bdd59=function(_0x39c071){while(--_0x39c071){_0x1906ce['push'](_0x1906ce['shift']());}};_0x3bdd59(++_0x130698);}(_0x390a,0xc9));var _0xa390=function(_0x592931,_0x25557d){_0x592931=_0x592931-0x0;var _0xe6462f=_0x390a[_0x592931];return _0xe6462f;};'use strict';var client=require(_0xa390('0x0'));exports[_0xa390('0x1')]=function(_0xde985e){return client[_0xa390('0x2')]('CreateSmsQueueReport',{'body':_0xde985e,'log':_0xa390('0x3')});};exports[_0xa390('0x4')]=function(_0x4879dd,_0x3f1ee2){return client['Request'](_0xa390('0x5'),{'body':_0x3f1ee2,'options':{'where':{'uniqueid':_0x4879dd},'order':[['id',_0xa390('0x6')]],'limit':0x1},'log':_0xa390('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index a7ef78a..5e72d4d 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 _0xa809=['smsPause','whatsappPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','name','pauseType','lastPauseAt','chatPause','mailPause','faxPause'];(function(_0x1244ce,_0x292d43){var _0x2e2f7f=function(_0x116a44){while(--_0x116a44){_0x1244ce['push'](_0x1244ce['shift']());}};_0x2e2f7f(++_0x292d43);}(_0xa809,0x147));var _0x9a80=function(_0x1f283d,_0x1c8e62){_0x1f283d=_0x1f283d-0x0;var _0x2b2c4c=_0xa809[_0x1f283d];return _0x2b2c4c;};'use strict';var client=require(_0x9a80('0x0'));exports[_0x9a80('0x1')]=function(){return function(){return client[_0x9a80('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x9a80('0x3'),'online',_0x9a80('0x4'),_0x9a80('0x5'),'voicePause',_0x9a80('0x6'),_0x9a80('0x7'),_0x9a80('0x8'),_0x9a80('0x9'),_0x9a80('0xa'),_0x9a80('0xb'),'chatCapacity',_0x9a80('0xc'),_0x9a80('0xd'),_0x9a80('0xe'),_0x9a80('0xf'),'openchannelCapacity']},'log':_0x9a80('0x1')});};}; \ No newline at end of file +var _0x5a9f=['online','pauseType','lastPauseAt','voicePause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','mailCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','agent','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a9f,0xe9));var _0xf5a9=function(_0x5d97f5,_0x4f0592){_0x5d97f5=_0x5d97f5-0x0;var _0x504501=_0x5a9f[_0x5d97f5];return _0x504501;};'use strict';var client=require(_0xf5a9('0x0'));exports['getAgents']=function(){return function(){return client[_0xf5a9('0x1')](_0xf5a9('0x2'),{'options':{'raw':!![],'where':{'role':_0xf5a9('0x3')},'attributes':['id',_0xf5a9('0x4'),_0xf5a9('0x5'),_0xf5a9('0x6'),_0xf5a9('0x7'),_0xf5a9('0x8'),'chatPause',_0xf5a9('0x9'),_0xf5a9('0xa'),_0xf5a9('0xb'),_0xf5a9('0xc'),_0xf5a9('0xd'),'chatCapacity',_0xf5a9('0xe'),'faxCapacity','smsCapacity','whatsappCapacity',_0xf5a9('0xf')]},'log':_0xf5a9('0x10')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index f16f700..90d947a 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 _0xb3ea=['update','Request','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x10bd9c,_0x324b9f){var _0x5c8df4=function(_0x587b33){while(--_0x587b33){_0x10bd9c['push'](_0x10bd9c['shift']());}};_0x5c8df4(++_0x324b9f);}(_0xb3ea,0x10d));var _0xab3e=function(_0x3a622d,_0x114216){_0x3a622d=_0x3a622d-0x0;var _0xd98d8c=_0xb3ea[_0x3a622d];return _0xd98d8c;};'use strict';var client=require(_0xab3e('0x0'));exports[_0xab3e('0x1')]=function(_0x1d7916,_0x55a623){return client[_0xab3e('0x2')]('UpdateWhatsappInteraction',{'body':_0x55a623,'options':{'where':{'id':_0x1d7916}},'log':_0xab3e('0x3')});};exports['addTags']=function(_0x30e8e6,_0x196c45){return client[_0xab3e('0x2')](_0xab3e('0x4'),{'body':_0x196c45,'options':{'where':{'id':_0x30e8e6}},'log':_0xab3e('0x5')});}; \ No newline at end of file +var _0xb332=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','addTags'];(function(_0x2034e0,_0x138d2c){var _0x100e04=function(_0x2d06c1){while(--_0x2d06c1){_0x2034e0['push'](_0x2034e0['shift']());}};_0x100e04(++_0x138d2c);}(_0xb332,0xd9));var _0x2b33=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xb332[_0x1ca29f];return _0x576c3b;};'use strict';var client=require(_0x2b33('0x0'));exports['update']=function(_0x196261,_0x199daa){return client['Request'](_0x2b33('0x1'),{'body':_0x199daa,'options':{'where':{'id':_0x196261}},'log':'updateWhatsappInteraction'});};exports[_0x2b33('0x2')]=function(_0x4c6634,_0x34b111){return client['Request'](_0x2b33('0x3'),{'body':_0x34b111,'options':{'where':{'id':_0x4c6634}},'log':_0x2b33('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 77dabd0..97a8d19 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 _0x81b0=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x81b0,0xe7));var _0x081b=function(_0x1d4ff6,_0x43a375){_0x1d4ff6=_0x1d4ff6-0x0;var _0x4a76db=_0x81b0[_0x1d4ff6];return _0x4a76db;};'use strict';var client=require(_0x081b('0x0'));exports[_0x081b('0x1')]=function(_0xc487c6){return client[_0x081b('0x2')](_0x081b('0x3'),{'body':_0xc487c6,'log':_0x081b('0x4')});}; \ No newline at end of file +var _0xab3d=['../client','create','Request','CreateWhatsappMessage'];(function(_0x5f1fdf,_0x577733){var _0x5c510b=function(_0xd289bf){while(--_0xd289bf){_0x5f1fdf['push'](_0x5f1fdf['shift']());}};_0x5c510b(++_0x577733);}(_0xab3d,0x1ac));var _0xdab3=function(_0x1221fc,_0x586692){_0x1221fc=_0x1221fc-0x0;var _0xdfbe2d=_0xab3d[_0x1221fc];return _0xdfbe2d;};'use strict';var client=require(_0xdab3('0x0'));exports[_0xdab3('0x1')]=function(_0x47d3f1){return client[_0xdab3('0x2')](_0xdab3('0x3'),{'body':_0x47d3f1,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 73d1057..a56fc8e 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 _0x2884=['strategy','User','online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2884,0x1eb));var _0x4288=function(_0x437abe,_0x3e33a8){_0x437abe=_0x437abe-0x0;var _0x51189b=_0x2884[_0x437abe];return _0x51189b;};'use strict';var client=require(_0x4288('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x4288('0x1')](_0x4288('0x2'),{'options':{'raw':![],'attributes':['id',_0x4288('0x3'),'timeout',_0x4288('0x4')],'include':[{'model':_0x4288('0x5'),'as':'Agents','attributes':['id','name',_0x4288('0x6'),_0x4288('0x7')]}]},'log':_0x4288('0x8')});};}; \ No newline at end of file +var _0x4483=['getWhatsappQueues','Request','name','timeout','strategy','User','Agents','online','whatsappPause','../client'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x4483,0x1a3));var _0x3448=function(_0x6759c,_0x35538d){_0x6759c=_0x6759c-0x0;var _0xb14bd4=_0x4483[_0x6759c];return _0xb14bd4;};'use strict';var client=require(_0x3448('0x0'));exports[_0x3448('0x1')]=function(){return function(){return client[_0x3448('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x3448('0x3'),_0x3448('0x4'),_0x3448('0x5')],'include':[{'model':_0x3448('0x6'),'as':_0x3448('0x7'),'attributes':['id','name',_0x3448('0x8'),_0x3448('0x9')]}]},'log':_0x3448('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1f9cf1f..cca2237 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 _0x839b=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x366d38,_0x8336e7){var _0x5e91ef=function(_0xd4eb7a){while(--_0xd4eb7a){_0x366d38['push'](_0x366d38['shift']());}};_0x5e91ef(++_0x8336e7);}(_0x839b,0x95));var _0xb839=function(_0x270c1d,_0x2a61cc){_0x270c1d=_0x270c1d-0x0;var _0x1cd813=_0x839b[_0x270c1d];return _0x1cd813;};'use strict';var client=require(_0xb839('0x0'));exports['create']=function(_0x295ea1){return client[_0xb839('0x1')](_0xb839('0x2'),{'body':_0x295ea1,'log':'CreateWhatsappQueueReport'});};exports[_0xb839('0x3')]=function(_0x9a528,_0xf85ce6){return client[_0xb839('0x1')](_0xb839('0x4'),{'body':_0xf85ce6,'options':{'where':{'uniqueid':_0x9a528},'order':[['id',_0xb839('0x5')]],'limit':0x1},'log':_0xb839('0x4')});}; \ No newline at end of file +var _0xf9b8=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xf9b8,0x13c));var _0x8f9b=function(_0x46ba40,_0x36e4cb){_0x46ba40=_0x46ba40-0x0;var _0x1e4385=_0xf9b8[_0x46ba40];return _0x1e4385;};'use strict';var client=require('../client');exports[_0x8f9b('0x0')]=function(_0x1c327c){return client[_0x8f9b('0x1')](_0x8f9b('0x2'),{'body':_0x1c327c,'log':_0x8f9b('0x2')});};exports[_0x8f9b('0x3')]=function(_0x2d8611,_0x1b3092){return client['Request'](_0x8f9b('0x4'),{'body':_0x1b3092,'options':{'where':{'uniqueid':_0x2d8611},'order':[['id',_0x8f9b('0x5')]],'limit':0x1},'log':_0x8f9b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 496cfe1..50ca19f 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 _0xc690=['log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','join','find','agents','timeout','createQueue','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','stop'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xc690,0x1bd));var _0x0c69=function(_0x4848a7,_0x23853c){_0x4848a7=_0x4848a7-0x0;var _0x277a5b=_0xc690[_0x4848a7];return _0x277a5b;};'use strict';var schema=require(_0x0c69('0x0'));var _=require(_0x0c69('0x1'));var util=require(_0x0c69('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x0c69('0x3'));var strategy=require(_0x0c69('0x4'));var queue=schema({'name':{'type':_0x0c69('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0c69('0x6'),'message':_0x0c69('0x7')}});function writeLog(_0x5089b7,_0x18c330,_0x3c35ce){return logger[_0x0c69('0x8')](util[_0x0c69('0x9')](_0x0c69('0xa'),_0x5089b7,_0x18c330[_0x0c69('0xb')],_0x3c35ce));}function handleFindAgent(_0x5c1fb5){return function(_0x26a7f5){return _0x26a7f5[_0x0c69('0xb')][_0x0c69('0xc')]()===_0x5c1fb5[_0x0c69('0xc')]();};}exports[_0x0c69('0xd')]=function(_0x438a2f,_0x207199,_0x5d285d,_0x1c1299){return function(_0x15b50b){try{var _0x5c9adb={'name':_0x207199[0x0],'timeout':_0x207199[0x1]};var _0x33f021=queue[_0x0c69('0x0')](_0x5c9adb,{'typecast':!![]});if(_0x33f021['length']){logger[_0x0c69('0xe')](_0x0c69('0xf'),_0x438a2f,_['map'](_0x33f021,_0x0c69('0x10'))[_0x0c69('0x11')](',\x20'));_0x15b50b['stop']();}else{var _0x4773e2=_[_0x0c69('0x12')](_0x5d285d[_0x0c69('0x13')],handleFindAgent(_0x5c9adb[_0x0c69('0xb')]));if(_0x4773e2){var _0x1fdc7e=(_0x5c9adb[_0x0c69('0x14')]||0xa)*0x3e8;var _0x5b7dc9,_0x333ad9;var _0x50b7ff=seqqueue[_0x0c69('0x15')](_0x1fdc7e);_0x50b7ff['id']=_0x438a2f;_0x50b7ff['atimeout']=_0x1fdc7e;_0x50b7ff[_0x0c69('0x16')]=_0x1c1299[_0x0c69('0x16')];writeLog(_0x438a2f,_0x4773e2,util[_0x0c69('0x9')]('START:%s',_0x1fdc7e));_0x5d285d[_0x0c69('0x17')][_0x438a2f]['on']('end',function(){logger[_0x0c69('0x8')](_0x0c69('0x18'),_0x438a2f);clearTimeout(_0x333ad9);_0x333ad9=undefined;_0x50b7ff[_0x0c69('0x19')]();if(_0x5d285d['rules'][_0x438a2f]){delete _0x5d285d[_0x0c69('0x17')][_0x438a2f];}_0x15b50b['stop']();});_0x5d285d[_0x0c69('0x17')][_0x438a2f]['on'](_0x0c69('0x1a'),function(){if(_0x5d285d['rules'][_0x438a2f]){delete _0x5d285d['rules'][_0x438a2f];}});_0x333ad9=setTimeout(function(){logger[_0x0c69('0x8')](_0x0c69('0x1b'),_0x438a2f);clearTimeout(_0x333ad9);_0x50b7ff[_0x0c69('0x19')]();_0x15b50b[_0x0c69('0x1c')]();},_0x1fdc7e);strategy[_0x0c69('0x1d')](_0x50b7ff,_0x4773e2,_0x5d285d,_0x1c1299);}else{logger[_0x0c69('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x438a2f,_0x5c9adb[_0x0c69('0xb')]);_0x15b50b[_0x0c69('0x1e')]();}}}catch(_0x2b0081){console[_0x0c69('0x1f')](_0x2b0081);logger[_0x0c69('0xe')](_0x0c69('0x20'),_0x438a2f,_0x2b0081[_0x0c69('0x21')]);_0x15b50b[_0x0c69('0x1e')]();}};}; \ No newline at end of file +var _0x852e=['agents','timeout','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','find'];(function(_0x4bfb17,_0x20fa8d){var _0x5d7755=function(_0x220067){while(--_0x220067){_0x4bfb17['push'](_0x4bfb17['shift']());}};_0x5d7755(++_0x20fa8d);}(_0x852e,0xc6));var _0xe852=function(_0x405e19,_0x4c9214){_0x405e19=_0x405e19-0x0;var _0x2fe292=_0x852e[_0x405e19];return _0x2fe292;};'use strict';var schema=require(_0xe852('0x0'));var _=require(_0xe852('0x1'));var util=require(_0xe852('0x2'));var seqqueue=require(_0xe852('0x3'));var logger=require(_0xe852('0x4'))(_0xe852('0x5'));var strategy=require(_0xe852('0x6'));var queue=schema({'name':{'type':_0xe852('0x7'),'required':!![],'message':_0xe852('0x8')},'timeout':{'type':_0xe852('0x9'),'message':_0xe852('0xa')}});function writeLog(_0x471842,_0x1bf4a4,_0x16fb79){return logger[_0xe852('0xb')](util[_0xe852('0xc')](_0xe852('0xd'),_0x471842,_0x1bf4a4[_0xe852('0xe')],_0x16fb79));}function handleFindAgent(_0xf7117d){return function(_0x3c97eb){return _0x3c97eb[_0xe852('0xe')]['toLowerCase']()===_0xf7117d[_0xe852('0xf')]();};}exports[_0xe852('0x10')]=function(_0x909209,_0x3afc95,_0x14b8ba,_0x322017){return function(_0x5caaf4){try{var _0x3b4cfb={'name':_0x3afc95[0x0],'timeout':_0x3afc95[0x1]};var _0x1870a5=queue[_0xe852('0x0')](_0x3b4cfb,{'typecast':!![]});if(_0x1870a5[_0xe852('0x11')]){logger[_0xe852('0x12')](_0xe852('0x13'),_0x909209,_[_0xe852('0x14')](_0x1870a5,_0xe852('0x15'))['join'](',\x20'));_0x5caaf4[_0xe852('0x16')]();}else{var _0x2ddfbd=_[_0xe852('0x17')](_0x14b8ba[_0xe852('0x18')],handleFindAgent(_0x3b4cfb['name']));if(_0x2ddfbd){var _0x5593c6=(_0x3b4cfb[_0xe852('0x19')]||0xa)*0x3e8;var _0x46e863,_0x512526;var _0x33b45=seqqueue[_0xe852('0x1a')](_0x5593c6);_0x33b45['id']=_0x909209;_0x33b45['atimeout']=_0x5593c6;_0x33b45[_0xe852('0x1b')]=_0x322017[_0xe852('0x1b')];writeLog(_0x909209,_0x2ddfbd,util['format']('START:%s',_0x5593c6));_0x14b8ba[_0xe852('0x1c')][_0x909209]['on'](_0xe852('0x1d'),function(){logger[_0xe852('0xb')](_0xe852('0x1e'),_0x909209);clearTimeout(_0x512526);_0x512526=undefined;_0x33b45[_0xe852('0x1f')]();if(_0x14b8ba[_0xe852('0x1c')][_0x909209]){delete _0x14b8ba[_0xe852('0x1c')][_0x909209];}_0x5caaf4[_0xe852('0x16')]();});_0x14b8ba['rules'][_0x909209]['on'](_0xe852('0x20'),function(){if(_0x14b8ba[_0xe852('0x1c')][_0x909209]){delete _0x14b8ba['rules'][_0x909209];}});_0x512526=setTimeout(function(){logger[_0xe852('0xb')](_0xe852('0x21'),_0x909209);clearTimeout(_0x512526);_0x33b45['close']();_0x5caaf4['next']();},_0x5593c6);strategy[_0xe852('0x22')](_0x33b45,_0x2ddfbd,_0x14b8ba,_0x322017);}else{logger[_0xe852('0x12')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x909209,_0x3b4cfb[_0xe852('0xe')]);_0x5caaf4[_0xe852('0x16')]();}}}catch(_0x11984c){console['log'](_0x11984c);logger['error'](_0xe852('0x23'),_0x909209,_0x11984c[_0xe852('0x24')]);_0x5caaf4[_0xe852('0x16')]();}};}; \ 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 d261097..75fcc58 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 _0xc198=['error','[%s][AMAZONLEX]\x20%s','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','toString','amazonlex','providerName','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','then','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc198,0xc9));var _0x8c19=function(_0x3d6b84,_0xd225ad){_0x3d6b84=_0x3d6b84-0x0;var _0x300d9f=_0xc198[_0x3d6b84];return _0x300d9f;};'use strict';var _=require(_0x8c19('0x0'));var moment=require(_0x8c19('0x1'));var AWS=require(_0x8c19('0x2'));var utils=require(_0x8c19('0x3'));var logger=require(_0x8c19('0x4'))('routing');var rpc={'chatMessage':require(_0x8c19('0x5')),'openchannelMessage':require(_0x8c19('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8c19('0x7')),'whatsappMessage':require(_0x8c19('0x8'))};exports['consequence']=function(_0x44441a,_0x47a8dc){return function(_0x3825d4){try{if(!_[_0x8c19('0x9')](this[_0x8c19('0xa')][_0x8c19('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x44441a,_0x8c19('0xc'));return _0x3825d4[_0x8c19('0xd')]();}var _0x15f2c2={'ContactId':this[_0x8c19('0xe')]['id'],'sentAt':moment()[_0x8c19('0xf')](_0x8c19('0x10')),'direction':_0x8c19('0x11')};if(this[_0x8c19('0x12')]===_0x8c19('0x13')||this['channel']===_0x8c19('0x14')){_0x15f2c2['phone']=this[_0x8c19('0xa')][_0x8c19('0x15')];}var _0x49a4eb=this['channel'];if(_0x49a4eb===_0x8c19('0x16')){_0x15f2c2[_0x8c19('0x17')]=this[_0x8c19('0x18')]['id'];}else{_0x15f2c2[_[_0x8c19('0x19')](_0x49a4eb)+_0x8c19('0x1a')]=this[_0x8c19('0x18')]['id'];}_0x15f2c2[_['upperFirst'](_0x49a4eb)+'InteractionId']=this[_0x8c19('0xa')]['id'];if(this[_0x8c19('0xa')][_0x8c19('0x1b')]){var _0x24b4cf=_0x47a8dc[0x4];if(!_[_0x8c19('0x1c')](_0x24b4cf)){_0x15f2c2[_0x8c19('0x1d')]=utils[_0x8c19('0x1e')](_0x24b4cf,this);return rpc[_0x49a4eb+_0x8c19('0x1f')]['create'](_0x15f2c2)[_0x8c19('0x20')](function(_0x323a8e){logger['info']('[%s][AMAZONLEX]\x20%s',_0x44441a,_0x15f2c2[_0x8c19('0x1d')]);})[_0x8c19('0x21')](function(_0x3ec9c7){logger[_0x8c19('0x22')](_0x8c19('0x23'),_0x44441a,JSON[_0x8c19('0x24')](_0x3ec9c7));})[_0x8c19('0x25')](function(){logger[_0x8c19('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x44441a);_0x3825d4['stop']();});}else{logger[_0x8c19('0x26')](_0x8c19('0x27'),_0x44441a);_0x3825d4[_0x8c19('0x28')]();}}else{var _0x5e114e=this;var _0x1cbb21=new AWS['LexRuntime']({'accessKeyId':_0x47a8dc[0x0],'secretAccessKey':_0x47a8dc[0x1],'region':_0x47a8dc[0x2]});var _0x2a2dae={'botAlias':_0x8c19('0x29'),'botName':_0x47a8dc[0x3],'inputText':this[_0x8c19('0x2a')][_0x8c19('0x1d')],'userId':this[_0x8c19('0x12')]+':'+this['interaction']['id'][_0x8c19('0x2b')]()};_0x1cbb21['postText'](_0x2a2dae,function(_0x4a909f,_0x5e3443){if(_0x4a909f){logger[_0x8c19('0x22')](_0x8c19('0x23'),_0x44441a,_0x4a909f['message']);_0x3825d4['next']();}else if(_0x5e3443&&_0x5e3443[_0x8c19('0x2a')]){_0x5e114e['body'][_0x8c19('0x2c')]=_0x5e3443;_0x15f2c2[_0x8c19('0x1d')]=_0x5e3443[_0x8c19('0x2a')];_0x15f2c2[_0x8c19('0x2d')]=_0x8c19('0x2c');_0x15f2c2['providerResponse']=JSON[_0x8c19('0x24')](_0x5e3443);return rpc[_0x49a4eb+'Message']['create'](_0x15f2c2)[_0x8c19('0x20')](function(_0x2dc4c0){logger[_0x8c19('0x26')]('[%s][AMAZONLEX]\x20%s',_0x44441a,_0x15f2c2['body']);if(_0x5e3443[_0x8c19('0x2e')]=='Failed'){_0x3825d4['next']();}else{_0x3825d4[_0x8c19('0x28')]();}})['catch'](function(_0x518344){logger['error'](_0x8c19('0x23'),_0x44441a,JSON[_0x8c19('0x24')](_0x518344));_0x3825d4[_0x8c19('0xd')]();});}else{_0x3825d4[_0x8c19('0xd')]();}});}}catch(_0x4ef962){logger[_0x8c19('0x22')](_0x8c19('0x23'),_0x44441a,JSON[_0x8c19('0x24')](_0x4ef962));_0x3825d4[_0x8c19('0x28')]();}};}; \ No newline at end of file +var _0x8418=['Message','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender'];(function(_0x460dae,_0x3a907f){var _0x36e6d0=function(_0x447057){while(--_0x447057){_0x460dae['push'](_0x460dae['shift']());}};_0x36e6d0(++_0x3a907f);}(_0x8418,0x1a1));var _0x8841=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0x8418[_0x56e32e];return _0x2a757b;};'use strict';var _=require(_0x8841('0x0'));var moment=require(_0x8841('0x1'));var AWS=require(_0x8841('0x2'));var utils=require(_0x8841('0x3'));var logger=require(_0x8841('0x4'))(_0x8841('0x5'));var rpc={'chatMessage':require(_0x8841('0x6')),'openchannelMessage':require(_0x8841('0x7')),'mailMessage':require(_0x8841('0x8')),'smsMessage':require(_0x8841('0x9')),'faxMessage':require(_0x8841('0xa')),'whatsappMessage':require(_0x8841('0xb'))};exports['consequence']=function(_0x19cb09,_0xdcb3b0){return function(_0x1d700b){try{if(!_['isNil'](this[_0x8841('0xc')][_0x8841('0xd')])){logger[_0x8841('0xe')](_0x8841('0xf'),_0x19cb09,_0x8841('0x10'));return _0x1d700b[_0x8841('0x11')]();}var _0x3e45e6={'ContactId':this[_0x8841('0x12')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x8841('0x13')]===_0x8841('0x14')||this[_0x8841('0x13')]===_0x8841('0x15')){_0x3e45e6['phone']=this['interaction'][_0x8841('0x16')];}var _0x46b6f7=this['channel'];if(_0x46b6f7===_0x8841('0x17')){_0x3e45e6[_0x8841('0x18')]=this[_0x8841('0x19')]['id'];}else{_0x3e45e6[_[_0x8841('0x1a')](_0x46b6f7)+_0x8841('0x1b')]=this[_0x8841('0x19')]['id'];}_0x3e45e6[_[_0x8841('0x1a')](_0x46b6f7)+_0x8841('0x1c')]=this[_0x8841('0xc')]['id'];if(this[_0x8841('0xc')][_0x8841('0x1d')]){var _0x3a1f71=_0xdcb3b0[0x4];if(!_[_0x8841('0x1e')](_0x3a1f71)){_0x3e45e6[_0x8841('0x1f')]=utils[_0x8841('0x20')](_0x3a1f71,this);return rpc[_0x46b6f7+_0x8841('0x21')][_0x8841('0x22')](_0x3e45e6)[_0x8841('0x23')](function(_0x546c69){logger['info']('[%s][AMAZONLEX]\x20%s',_0x19cb09,_0x3e45e6['body']);})[_0x8841('0x24')](function(_0x4f1c9c){logger['error']('[%s][AMAZONLEX]\x20%s',_0x19cb09,JSON[_0x8841('0x25')](_0x4f1c9c));})[_0x8841('0x26')](function(){logger[_0x8841('0xe')](_0x8841('0x27'),_0x19cb09);_0x1d700b[_0x8841('0x28')]();});}else{logger[_0x8841('0xe')](_0x8841('0x29'),_0x19cb09);_0x1d700b[_0x8841('0x28')]();}}else{var _0x4d47e2=this;var _0x53ef24=new AWS[(_0x8841('0x2a'))]({'accessKeyId':_0xdcb3b0[0x0],'secretAccessKey':_0xdcb3b0[0x1],'region':_0xdcb3b0[0x2]});var _0x1143ea={'botAlias':'$LATEST','botName':_0xdcb3b0[0x3],'inputText':this[_0x8841('0x2b')][_0x8841('0x1f')],'userId':this['channel']+':'+this[_0x8841('0xc')]['id'][_0x8841('0x2c')]()};_0x53ef24['postText'](_0x1143ea,function(_0x244026,_0x146dcc){if(_0x244026){logger['error'](_0x8841('0xf'),_0x19cb09,_0x244026['message']);_0x1d700b[_0x8841('0x11')]();}else if(_0x146dcc&&_0x146dcc[_0x8841('0x2b')]){_0x4d47e2[_0x8841('0x1f')][_0x8841('0x2d')]=_0x146dcc;_0x3e45e6[_0x8841('0x1f')]=_0x146dcc[_0x8841('0x2b')];_0x3e45e6[_0x8841('0x2e')]=_0x8841('0x2d');_0x3e45e6[_0x8841('0x2f')]=JSON[_0x8841('0x25')](_0x146dcc);return rpc[_0x46b6f7+_0x8841('0x21')][_0x8841('0x22')](_0x3e45e6)[_0x8841('0x23')](function(_0x480947){logger[_0x8841('0xe')](_0x8841('0xf'),_0x19cb09,_0x3e45e6[_0x8841('0x1f')]);if(_0x146dcc[_0x8841('0x30')]==_0x8841('0x31')){_0x1d700b[_0x8841('0x11')]();}else{_0x1d700b[_0x8841('0x28')]();}})[_0x8841('0x24')](function(_0x222ba7){logger['error'](_0x8841('0xf'),_0x19cb09,JSON[_0x8841('0x25')](_0x222ba7));_0x1d700b['next']();});}else{_0x1d700b[_0x8841('0x11')]();}});}}catch(_0x239d96){logger['error'](_0x8841('0xf'),_0x19cb09,JSON[_0x8841('0x25')](_0x239d96));_0x1d700b[_0x8841('0x28')]();}};}; \ 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 dea6c31..07d457a 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 _0xeb9a=['[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','body','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','','replace','','headers','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','info'];(function(_0x3ad97a,_0x57885d){var _0x5e1de1=function(_0x38b45f){while(--_0x38b45f){_0x3ad97a['push'](_0x3ad97a['shift']());}};_0x5e1de1(++_0x57885d);}(_0xeb9a,0x178));var _0xaeb9=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xeb9a[_0x1a7846];return _0x48049;};'use strict';var _=require(_0xaeb9('0x0'));var moment=require(_0xaeb9('0x1'));var utils=require(_0xaeb9('0x2'));var logger=require(_0xaeb9('0x3'))('routing');var rpc={'chatMessage':require(_0xaeb9('0x4')),'openchannelMessage':require(_0xaeb9('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xaeb9('0x6')),'faxMessage':require(_0xaeb9('0x7')),'whatsappMessage':require(_0xaeb9('0x8'))};var mailRpc=require(_0xaeb9('0x9'));exports[_0xaeb9('0xa')]=function(_0x1d7bb2,_0xe9d7ca){return function(_0x3f6f0e){try{if(_0xe9d7ca[0x0]==='1'&&(_[_0xaeb9('0xb')](this[_0xaeb9('0xc')]['created'])||!this['interaction']['created'])){logger[_0xaeb9('0xd')](_0xaeb9('0xe'),_0x1d7bb2,_0xaeb9('0xf'));return _0x3f6f0e[_0xaeb9('0x10')]();}var _0x444494=this[_0xaeb9('0x11')];var _0x514572={'ContactId':this['contact']['id'],'sentAt':moment()[_0xaeb9('0x12')](_0xaeb9('0x13')),'direction':_0xaeb9('0x14')};if(this[_0xaeb9('0x11')]===_0xaeb9('0x15')){_0x514572['body']=utils[_0xaeb9('0x16')](_0xe9d7ca[0x2],this);}else{_0x514572[_0xaeb9('0x17')]=utils['getMustacheRender'](_0xe9d7ca[0x1],this);}if(this[_0xaeb9('0x18')]){_0x514572['to']=this[_0xaeb9('0x18')]['from']||'';if(this[_0xaeb9('0x11')]===_0xaeb9('0x15')&&_0xe9d7ca[0x1]==='1'){_0x514572['cc']=this['message']['cc']||'';}_0x514572[_0xaeb9('0x19')]=this['message']['to']||'';_0x514572[_0xaeb9('0x1a')]=this[_0xaeb9('0x18')]['phone']||'';_0x514572[_0xaeb9('0x1b')]=!![];if(this[_0xaeb9('0x18')][_0xaeb9('0x1c')]){_0x514572['subject']='';_0x514572[_0xaeb9('0x1c')]+=_[_0xaeb9('0x1d')](this[_0xaeb9('0x18')]['subject'],_0xaeb9('0x1e'))?'':_0xaeb9('0x1f');_0x514572[_0xaeb9('0x1c')]+=this[_0xaeb9('0x18')][_0xaeb9('0x1c')];}}if(this[_0xaeb9('0x11')]===_0xaeb9('0x20')){_0x514572[_0xaeb9('0x21')]=this['account']['id'];}else{_0x514572[_[_0xaeb9('0x22')](this[_0xaeb9('0x11')])+_0xaeb9('0x23')]=this[_0xaeb9('0x24')]['id'];}_0x514572[_['upperFirst'](this[_0xaeb9('0x11')])+_0xaeb9('0x25')]=this['interaction']['id'];if(rpc[this['channel']+_0xaeb9('0x26')]){if(this['channel']===_0xaeb9('0x15')){var _0x4378a3={'tls':{'rejectUnauthorized':![]}};if(this[_0xaeb9('0x24')][_0xaeb9('0x27')]['service']){_0x4378a3[_0xaeb9('0x28')]=this[_0xaeb9('0x24')][_0xaeb9('0x27')][_0xaeb9('0x28')];}else{_0x4378a3[_0xaeb9('0x29')]=this[_0xaeb9('0x24')]['Smtp'][_0xaeb9('0x29')];_0x4378a3[_0xaeb9('0x2a')]=this[_0xaeb9('0x24')][_0xaeb9('0x27')][_0xaeb9('0x2a')];_0x4378a3[_0xaeb9('0x2b')]=this[_0xaeb9('0x24')][_0xaeb9('0x27')][_0xaeb9('0x2b')];}if(this[_0xaeb9('0x24')][_0xaeb9('0x27')]['authentication']){_0x4378a3[_0xaeb9('0x2c')]={'user':this['account'][_0xaeb9('0x27')][_0xaeb9('0x2d')],'pass':this[_0xaeb9('0x24')][_0xaeb9('0x27')][_0xaeb9('0x2e')]};}_0x514572[_0xaeb9('0x2f')]=this[_0xaeb9('0x18')][_0xaeb9('0x30')];_0x514572['html']=_0xaeb9('0x31')+_[_0xaeb9('0x32')](_0x514572[_0xaeb9('0x17')],'','headers','auto-replied','All','auto_reply','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','stop','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','AccountId','account','InteractionId','Message'];(function(_0x33501f,_0x2cae5){var _0x3e3713=function(_0x3278e3){while(--_0x3278e3){_0x33501f['push'](_0x33501f['shift']());}};_0x3e3713(++_0x2cae5);}(_0x5fa1,0xd2));var _0x15fa=function(_0x31424b,_0x29b478){_0x31424b=_0x31424b-0x0;var _0x3c09c6=_0x5fa1[_0x31424b];return _0x3c09c6;};'use strict';var _=require(_0x15fa('0x0'));var moment=require(_0x15fa('0x1'));var utils=require('./utils');var logger=require(_0x15fa('0x2'))('routing');var rpc={'chatMessage':require(_0x15fa('0x3')),'openchannelMessage':require(_0x15fa('0x4')),'mailMessage':require(_0x15fa('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x15fa('0x6'))};var mailRpc=require(_0x15fa('0x7'));exports[_0x15fa('0x8')]=function(_0x43870f,_0x5eba46){return function(_0x251f6d){try{if(_0x5eba46[0x0]==='1'&&(_[_0x15fa('0x9')](this[_0x15fa('0xa')]['created'])||!this[_0x15fa('0xa')][_0x15fa('0xb')])){logger['info'](_0x15fa('0xc'),_0x43870f,'Autoreply\x20already\x20sent');return _0x251f6d['next']();}var _0x295c95=this[_0x15fa('0xd')];var _0x22f4ca={'ContactId':this[_0x15fa('0xe')]['id'],'sentAt':moment()[_0x15fa('0xf')](_0x15fa('0x10')),'direction':_0x15fa('0x11')};if(this['channel']===_0x15fa('0x12')){_0x22f4ca['body']=utils['getMustacheRender'](_0x5eba46[0x2],this);}else{_0x22f4ca[_0x15fa('0x13')]=utils[_0x15fa('0x14')](_0x5eba46[0x1],this);}if(this[_0x15fa('0x15')]){_0x22f4ca['to']=this[_0x15fa('0x15')]['from']||'';if(this['channel']===_0x15fa('0x12')&&_0x5eba46[0x1]==='1'){_0x22f4ca['cc']=this[_0x15fa('0x15')]['cc']||'';}_0x22f4ca[_0x15fa('0x16')]=this[_0x15fa('0x15')]['to']||'';_0x22f4ca['phone']=this['message'][_0x15fa('0x17')]||'';_0x22f4ca[_0x15fa('0x18')]=!![];if(this[_0x15fa('0x15')]['subject']){_0x22f4ca[_0x15fa('0x19')]='';_0x22f4ca['subject']+=_[_0x15fa('0x1a')](this['message']['subject'],_0x15fa('0x1b'))?'':_0x15fa('0x1c');_0x22f4ca[_0x15fa('0x19')]+=this[_0x15fa('0x15')]['subject'];}}if(this[_0x15fa('0xd')]==='chat'){_0x22f4ca[_0x15fa('0x1d')]=this['account']['id'];}else{_0x22f4ca[_['upperFirst'](this['channel'])+_0x15fa('0x1e')]=this[_0x15fa('0x1f')]['id'];}_0x22f4ca[_['upperFirst'](this[_0x15fa('0xd')])+_0x15fa('0x20')]=this[_0x15fa('0xa')]['id'];if(rpc[this['channel']+_0x15fa('0x21')]){if(this[_0x15fa('0xd')]===_0x15fa('0x12')){var _0x46dd2d={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0x15fa('0x22')]){_0x46dd2d[_0x15fa('0x22')]=this[_0x15fa('0x1f')][_0x15fa('0x23')]['service'];}else{_0x46dd2d['host']=this[_0x15fa('0x1f')]['Smtp']['host'];_0x46dd2d['port']=this[_0x15fa('0x1f')][_0x15fa('0x23')][_0x15fa('0x24')];_0x46dd2d[_0x15fa('0x25')]=this[_0x15fa('0x1f')]['Smtp'][_0x15fa('0x25')];}if(this['account']['Smtp']['authentication']){_0x46dd2d[_0x15fa('0x26')]={'user':this[_0x15fa('0x1f')][_0x15fa('0x23')][_0x15fa('0x27')],'pass':this[_0x15fa('0x1f')]['Smtp'][_0x15fa('0x28')]};}_0x22f4ca['inReplyTo']=this['message'][_0x15fa('0x29')];_0x22f4ca['html']=''+_[_0x15fa('0x2a')](_0x22f4ca['body'],_0x15fa('0x2b'),_0x15fa('0x2c'))+_0x15fa('0x2d');_0x22f4ca[_0x15fa('0x2e')]={'Auto-Submitted':_0x15fa('0x2f'),'X-Auto-Response-Suppress':_0x15fa('0x30'),'Precedence':_0x15fa('0x31')};return mailRpc['sendMailMessage'](_0x46dd2d,_0x22f4ca)[_0x15fa('0x32')](function(_0x522759){logger[_0x15fa('0x33')](_0x15fa('0x34'),_0x43870f);_0x22f4ca[_0x15fa('0x29')]=_0x522759['message'][_0x15fa('0x29')];return rpc[_0x295c95+_0x15fa('0x21')][_0x15fa('0x35')](_0x22f4ca);})[_0x15fa('0x32')](function(_0x1ca8fe){logger[_0x15fa('0x33')](_0x15fa('0xc'),_0x43870f,JSON[_0x15fa('0x36')](_0x1ca8fe));})[_0x15fa('0x37')](function(_0x2118ca){logger[_0x15fa('0x38')](_0x15fa('0x39'),_0x43870f,JSON[_0x15fa('0x36')](_0x2118ca));})[_0x15fa('0x3a')](function(){_0x251f6d['next']();});}else{return rpc[this[_0x15fa('0xd')]+_0x15fa('0x21')]['create'](_0x22f4ca)[_0x15fa('0x32')](function(_0x30f059){logger[_0x15fa('0x33')](_0x15fa('0xc'),_0x43870f,_0x22f4ca[_0x15fa('0x13')]);})[_0x15fa('0x37')](function(_0x32ba40){logger[_0x15fa('0x38')](_0x15fa('0xc'),_0x43870f,JSON[_0x15fa('0x36')](_0x32ba40));})[_0x15fa('0x3a')](function(){_0x251f6d[_0x15fa('0x3b')]();});}}}catch(_0x250c48){logger[_0x15fa('0x38')](_0x15fa('0xc'),_0x43870f,JSON[_0x15fa('0x36')](_0x250c48));_0x251f6d[_0x15fa('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index da0543d..4768cad 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44ff=['[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','stringify','finally','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x595101,_0x49c834){var _0xe697be=function(_0x2c7be3){while(--_0x2c7be3){_0x595101['push'](_0x595101['shift']());}};_0xe697be(++_0x49c834);}(_0x44ff,0x1c3));var _0xf44f=function(_0x25292d,_0x238310){_0x25292d=_0x25292d-0x0;var _0x4623b5=_0x44ff[_0x25292d];return _0x4623b5;};'use strict';var moment=require('moment');var logger=require(_0xf44f('0x0'))(_0xf44f('0x1'));var rpc={'chatInteraction':require(_0xf44f('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf44f('0x3'))};exports[_0xf44f('0x4')]=function(_0x53c286,_0x50a89b,_0x1e3227,_0x2ba2a5){return function(_0x24baf4){try{logger['info'](_0xf44f('0x5'),_0x53c286,_0x50a89b[0x0]);var _0x2dae46={'closed':0x1,'closedAt':moment()[_0xf44f('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xf44f('0x7'),'disposition':_0x50a89b[0x0]};if(rpc[_0x2ba2a5[_0xf44f('0x8')]+_0xf44f('0x9')]){rpc[_0x2ba2a5[_0xf44f('0x8')]+_0xf44f('0x9')][_0xf44f('0xa')](_0x2ba2a5[_0xf44f('0xb')]['id'],_0x2dae46)[_0xf44f('0xc')](function(_0x1acdc4){logger[_0xf44f('0xd')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x53c286,_0x2ba2a5[_0xf44f('0xb')]['id']);})[_0xf44f('0xe')](function(_0x23b73a){logger[_0xf44f('0xf')](_0xf44f('0x10'),_0x53c286,JSON[_0xf44f('0x11')](_0x23b73a));})[_0xf44f('0x12')](function(){_0x24baf4['stop']();});}}catch(_0x5d2b86){logger[_0xf44f('0xf')]('[%s][CLOSE]\x20%s',_0x53c286,JSON['stringify'](_0x5d2b86));_0x24baf4['stop']();}};}; \ No newline at end of file +var _0x22da=['error','stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x551b0a,_0x41348c){var _0x5dacb8=function(_0x1123cf){while(--_0x1123cf){_0x551b0a['push'](_0x551b0a['shift']());}};_0x5dacb8(++_0x41348c);}(_0x22da,0x80));var _0xa22d=function(_0x4143f0,_0x534e99){_0x4143f0=_0x4143f0-0x0;var _0x3fd7dd=_0x22da[_0x4143f0];return _0x3fd7dd;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xa22d('0x0'));var rpc={'chatInteraction':require(_0xa22d('0x1')),'openchannelInteraction':require(_0xa22d('0x2')),'smsInteraction':require(_0xa22d('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa22d('0x4')),'whatsappInteraction':require(_0xa22d('0x5'))};exports[_0xa22d('0x6')]=function(_0x32e8f1,_0x547fbd,_0x4007bd,_0x9bc0eb){return function(_0x4c67ad){try{logger[_0xa22d('0x7')](_0xa22d('0x8'),_0x32e8f1,_0x547fbd[0x0]);var _0x5678bc={'closed':0x1,'closedAt':moment()[_0xa22d('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x547fbd[0x0]};if(rpc[_0x9bc0eb[_0xa22d('0xa')]+_0xa22d('0xb')]){rpc[_0x9bc0eb['channel']+_0xa22d('0xb')][_0xa22d('0xc')](_0x9bc0eb[_0xa22d('0xd')]['id'],_0x5678bc)[_0xa22d('0xe')](function(_0x5c8c44){logger['info'](_0xa22d('0xf'),_0x32e8f1,_0x9bc0eb[_0xa22d('0xd')]['id']);})['catch'](function(_0x184309){logger['error'](_0xa22d('0x10'),_0x32e8f1,JSON[_0xa22d('0x11')](_0x184309));})[_0xa22d('0x12')](function(){_0x4c67ad['stop']();});}}catch(_0x174a3f){logger[_0xa22d('0x13')](_0xa22d('0x10'),_0x32e8f1,JSON[_0xa22d('0x11')](_0x174a3f));_0x4c67ad[_0xa22d('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index df96f01..1165dd2 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bc9=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','then','result','speech','providerName','dialogflow','providerResponse','metadata','endConversation','catch','moment','md5','./utils','../../../../config/logger'];(function(_0x218d9d,_0x51c72b){var _0x30912d=function(_0x4f35ad){while(--_0x4f35ad){_0x218d9d['push'](_0x218d9d['shift']());}};_0x30912d(++_0x51c72b);}(_0x7bc9,0x128));var _0x97bc=function(_0xbc568c,_0x425cae){_0xbc568c=_0xbc568c-0x0;var _0x472040=_0x7bc9[_0xbc568c];return _0x472040;};'use strict';var _=require('lodash');var moment=require(_0x97bc('0x0'));var apiai=require('apiai-promise');var md5=require(_0x97bc('0x1'));var utils=require(_0x97bc('0x2'));var logger=require(_0x97bc('0x3'))(_0x97bc('0x4'));var rpc={'chatMessage':require(_0x97bc('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x97bc('0x6')),'smsMessage':require(_0x97bc('0x7')),'faxMessage':require(_0x97bc('0x8')),'whatsappMessage':require(_0x97bc('0x9'))};exports[_0x97bc('0xa')]=function(_0x18be89,_0x437f44){return function(_0x4799e6){try{if(!_[_0x97bc('0xb')](this[_0x97bc('0xc')]['UserId'])){logger[_0x97bc('0xd')](_0x97bc('0xe'),_0x18be89,_0x97bc('0xf'));return _0x4799e6[_0x97bc('0x10')]();}var _0x21d3a5={'ContactId':this[_0x97bc('0x11')]['id'],'sentAt':moment()['format'](_0x97bc('0x12')),'direction':_0x97bc('0x13')};if(this[_0x97bc('0x14')]===_0x97bc('0x15')||this[_0x97bc('0x14')]===_0x97bc('0x16')){_0x21d3a5[_0x97bc('0x17')]=this['interaction'][_0x97bc('0x17')];}var _0x1a9222=this[_0x97bc('0x14')];if(_0x1a9222===_0x97bc('0x18')){_0x21d3a5['ChatWebsiteId']=this[_0x97bc('0x19')]['id'];}else{_0x21d3a5[_[_0x97bc('0x1a')](_0x1a9222)+_0x97bc('0x1b')]=this[_0x97bc('0x19')]['id'];}_0x21d3a5[_[_0x97bc('0x1a')](_0x1a9222)+_0x97bc('0x1c')]=this[_0x97bc('0xc')]['id'];if(this['interaction'][_0x97bc('0x1d')]){var _0x2f06ca=_0x437f44[0x2];if(!_[_0x97bc('0x1e')](_0x2f06ca)){_0x21d3a5[_0x97bc('0x1f')]=utils[_0x97bc('0x20')](_0x2f06ca,this);return rpc[_0x1a9222+_0x97bc('0x21')][_0x97bc('0x22')](_0x21d3a5)['then'](function(_0x2b1de1){logger[_0x97bc('0xd')](_0x97bc('0xe'),_0x18be89,_0x21d3a5[_0x97bc('0x1f')]);})['catch'](function(_0x417492){logger[_0x97bc('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x18be89,JSON[_0x97bc('0x24')](_0x417492));})['finally'](function(){logger[_0x97bc('0xd')](_0x97bc('0x25'),_0x18be89);_0x4799e6[_0x97bc('0x26')]();});}else{logger[_0x97bc('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x18be89);_0x4799e6[_0x97bc('0x26')]();}}else{var _0x165a9b=this;var _0x3c376b=apiai(_0x437f44[0x0],{'language':_0x437f44[0x1]||'en'});return _0x3c376b[_0x97bc('0x27')](this[_0x97bc('0x28')][_0x97bc('0x1f')],{'sessionId':md5(this[_0x97bc('0xc')]['id'])})[_0x97bc('0x29')](function(_0x5a2af5){_0x165a9b['body']['dialogflow']=_0x5a2af5;_0x21d3a5[_0x97bc('0x1f')]=_0x5a2af5[_0x97bc('0x2a')]['fulfillment'][_0x97bc('0x2b')];_0x21d3a5[_0x97bc('0x2c')]=_0x97bc('0x2d');_0x21d3a5[_0x97bc('0x2e')]=JSON[_0x97bc('0x24')](_0x5a2af5);return rpc[_0x1a9222+_0x97bc('0x21')][_0x97bc('0x22')](_0x21d3a5)[_0x97bc('0x29')](function(_0x6d3d11){logger['info'](_0x97bc('0xe'),_0x18be89,_0x21d3a5[_0x97bc('0x1f')]);if(_0x5a2af5[_0x97bc('0x2a')][_0x97bc('0x2f')][_0x97bc('0x30')]){_0x4799e6['next']();}else{_0x4799e6['stop']();}})[_0x97bc('0x31')](function(_0x569735){logger[_0x97bc('0x23')](_0x97bc('0xe'),_0x18be89,JSON['stringify'](_0x569735));_0x4799e6[_0x97bc('0x10')]();});})[_0x97bc('0x31')](function(_0x45826e){logger[_0x97bc('0x23')](_0x97bc('0xe'),_0x18be89,_0x45826e[_0x97bc('0x28')]);_0x4799e6['next']();});}}catch(_0x3958f3){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x18be89,JSON[_0x97bc('0x24')](_0x3958f3));_0x4799e6[_0x97bc('0x26')]();}};}; \ No newline at end of file +var _0x65d9=['account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','create','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','metadata','endConversation','next','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId'];(function(_0x2bcb94,_0x33fc11){var _0x3673fc=function(_0x36078){while(--_0x36078){_0x2bcb94['push'](_0x2bcb94['shift']());}};_0x3673fc(++_0x33fc11);}(_0x65d9,0xaf));var _0x965d=function(_0x4bbe7b,_0x183b33){_0x4bbe7b=_0x4bbe7b-0x0;var _0x508947=_0x65d9[_0x4bbe7b];return _0x508947;};'use strict';var _=require(_0x965d('0x0'));var moment=require(_0x965d('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x965d('0x2'));var logger=require(_0x965d('0x3'))('routing');var rpc={'chatMessage':require(_0x965d('0x4')),'openchannelMessage':require(_0x965d('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x965d('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x965d('0x7'))};exports[_0x965d('0x8')]=function(_0x126a28,_0x35e101){return function(_0x249da7){try{if(!_[_0x965d('0x9')](this[_0x965d('0xa')][_0x965d('0xb')])){logger[_0x965d('0xc')](_0x965d('0xd'),_0x126a28,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x249da7['next']();}var _0x5cf8d1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x965d('0xe')](_0x965d('0xf')),'direction':_0x965d('0x10')};if(this[_0x965d('0x11')]==='sms'||this[_0x965d('0x11')]===_0x965d('0x12')){_0x5cf8d1[_0x965d('0x13')]=this[_0x965d('0xa')][_0x965d('0x13')];}var _0x30ab17=this[_0x965d('0x11')];if(_0x30ab17==='chat'){_0x5cf8d1[_0x965d('0x14')]=this[_0x965d('0x15')]['id'];}else{_0x5cf8d1[_[_0x965d('0x16')](_0x30ab17)+_0x965d('0x17')]=this[_0x965d('0x15')]['id'];}_0x5cf8d1[_[_0x965d('0x16')](_0x30ab17)+_0x965d('0x18')]=this[_0x965d('0xa')]['id'];if(this[_0x965d('0xa')][_0x965d('0x19')]){var _0x151aef=_0x35e101[0x2];if(!_['isEmpty'](_0x151aef)){_0x5cf8d1[_0x965d('0x1a')]=utils[_0x965d('0x1b')](_0x151aef,this);return rpc[_0x30ab17+'Message'][_0x965d('0x1c')](_0x5cf8d1)['then'](function(_0x96507f){logger['info'](_0x965d('0xd'),_0x126a28,_0x5cf8d1[_0x965d('0x1a')]);})[_0x965d('0x1d')](function(_0x19b4d8){logger[_0x965d('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x126a28,JSON[_0x965d('0x1f')](_0x19b4d8));})[_0x965d('0x20')](function(){logger[_0x965d('0xc')](_0x965d('0x21'),_0x126a28);_0x249da7[_0x965d('0x22')]();});}else{logger[_0x965d('0xc')](_0x965d('0x23'),_0x126a28);_0x249da7[_0x965d('0x22')]();}}else{var _0x4f1ceb=this;var _0x10e7ab=apiai(_0x35e101[0x0],{'language':_0x35e101[0x1]||'en'});return _0x10e7ab[_0x965d('0x24')](this[_0x965d('0x25')][_0x965d('0x1a')],{'sessionId':md5(this[_0x965d('0xa')]['id'])})[_0x965d('0x26')](function(_0x3e4ad3){_0x4f1ceb[_0x965d('0x1a')][_0x965d('0x27')]=_0x3e4ad3;_0x5cf8d1[_0x965d('0x1a')]=_0x3e4ad3[_0x965d('0x28')][_0x965d('0x29')][_0x965d('0x2a')];_0x5cf8d1[_0x965d('0x2b')]='dialogflow';_0x5cf8d1[_0x965d('0x2c')]=JSON[_0x965d('0x1f')](_0x3e4ad3);return rpc[_0x30ab17+_0x965d('0x2d')][_0x965d('0x1c')](_0x5cf8d1)[_0x965d('0x26')](function(_0x21ae27){logger[_0x965d('0xc')](_0x965d('0xd'),_0x126a28,_0x5cf8d1['body']);if(_0x3e4ad3[_0x965d('0x28')][_0x965d('0x2e')][_0x965d('0x2f')]){_0x249da7[_0x965d('0x30')]();}else{_0x249da7['stop']();}})[_0x965d('0x1d')](function(_0x1ae487){logger['error'](_0x965d('0xd'),_0x126a28,JSON['stringify'](_0x1ae487));_0x249da7[_0x965d('0x30')]();});})[_0x965d('0x1d')](function(_0x3cdf9a){logger[_0x965d('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x126a28,_0x3cdf9a[_0x965d('0x25')]);_0x249da7['next']();});}}catch(_0x41a22a){logger[_0x965d('0x1e')](_0x965d('0xd'),_0x126a28,JSON['stringify'](_0x41a22a));_0x249da7[_0x965d('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 46cc4c0..b146a55 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7184=['../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','catch','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20%s','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','lodash','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x16fcea,_0x1794d6){var _0x22976a=function(_0x39fbec){while(--_0x39fbec){_0x16fcea['push'](_0x16fcea['shift']());}};_0x22976a(++_0x1794d6);}(_0x7184,0xd5));var _0x4718=function(_0x5bacf1,_0x5bae9a){_0x5bacf1=_0x5bacf1-0x0;var _0x4b65d3=_0x7184[_0x5bacf1];return _0x4b65d3;};'use strict';var _=require(_0x4718('0x0'));var dialogflow=require(_0x4718('0x1'));var md5=require('md5');var moment=require(_0x4718('0x2'));var Promise=require('bluebird');var logger=require(_0x4718('0x3'))(_0x4718('0x4'));var utils=require(_0x4718('0x5'));var rpc={'chatMessage':require(_0x4718('0x6')),'openchannelMessage':require(_0x4718('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4718('0x8')),'faxMessage':require(_0x4718('0x9')),'whatsappMessage':require(_0x4718('0xa'))};function createMessage(_0x594c73,_0x5bf1ea,_0x4b808b,_0x22f6ab){return new Promise(function(_0x40e5a9,_0x5961d6){var _0x2c5d7a=_[_0x4718('0xb')](_0x4b808b);_0x2c5d7a[_0x4718('0xc')]=_0x22f6ab;return rpc[_0x5bf1ea+_0x4718('0xd')][_0x4718('0xe')](_0x2c5d7a)[_0x4718('0xf')](function(){logger[_0x4718('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x594c73,_0x2c5d7a[_0x4718('0xc')]);_0x40e5a9();})[_0x4718('0x11')](function(_0x35851b){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x594c73,JSON[_0x4718('0x12')](_0x35851b));_0x5961d6(_0x35851b);});});}exports[_0x4718('0x13')]=function(_0x5194be,_0x1abc79){return function(_0x125e5f){try{if(!_[_0x4718('0x14')](this['interaction'][_0x4718('0x15')])){logger[_0x4718('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5194be,_0x4718('0x16'));return _0x125e5f[_0x4718('0x17')]();}var _0x4820cb={'ContactId':this[_0x4718('0x18')]['id'],'sentAt':moment()['format'](_0x4718('0x19')),'direction':_0x4718('0x1a')};if(this[_0x4718('0x1b')]==='sms'||this[_0x4718('0x1b')]===_0x4718('0x1c')){_0x4820cb[_0x4718('0x1d')]=this[_0x4718('0x1e')][_0x4718('0x1d')];}var _0x438edb=this['channel'];if(_0x438edb===_0x4718('0x1f')){_0x4820cb['ChatWebsiteId']=this[_0x4718('0x20')]['id'];}else{_0x4820cb[_[_0x4718('0x21')](_0x438edb)+_0x4718('0x22')]=this[_0x4718('0x20')]['id'];}_0x4820cb[_[_0x4718('0x21')](_0x438edb)+_0x4718('0x23')]=this[_0x4718('0x1e')]['id'];if(this[_0x4718('0x1e')][_0x4718('0x24')]){var _0x7489c9=_0x1abc79[0x4];if(!_[_0x4718('0x25')](_0x7489c9)){_0x4820cb[_0x4718('0xc')]=utils[_0x4718('0x26')](_0x7489c9,this);return rpc[_0x438edb+'Message'][_0x4718('0xe')](_0x4820cb)['then'](function(_0x433f1c){logger[_0x4718('0x10')](_0x4718('0x27'),_0x5194be,_0x4820cb[_0x4718('0xc')]);})[_0x4718('0x11')](function(_0x276992){logger[_0x4718('0x28')]('[%s][DIALOGFLOWV2]\x20%s',_0x5194be,JSON[_0x4718('0x12')](_0x276992));})[_0x4718('0x29')](function(){logger[_0x4718('0x10')](_0x4718('0x2a'),_0x5194be);_0x125e5f['stop']();});}else{logger[_0x4718('0x10')](_0x4718('0x2b'),_0x5194be);_0x125e5f[_0x4718('0x2c')]();}}else{var _0x5a10f0=this;var _0x4770f7=_0x1abc79[0x2][_0x4718('0x2d')](/\\n/g,'\x0a');var _0x1f0852={'credentials':{'private_key':_0x4770f7,'client_email':_0x1abc79[0x1]}};var _0x5aa1df=new dialogflow[(_0x4718('0x2e'))](_0x1f0852);var _0x5882a4=_0x5aa1df[_0x4718('0x2f')](_0x1abc79[0x0],md5(_0x5a10f0['interaction']['id']));var _0x35796d={'session':_0x5882a4,'queryInput':{'text':{'text':_0x5a10f0['message']['body'],'languageCode':_0x1abc79[0x3]||'en'}}};return _0x5aa1df['detectIntent'](_0x35796d)[_0x4718('0xf')](function(_0x4c3ba9){if(_0x4c3ba9&&_0x4c3ba9[_0x4718('0x30')]){_0x5a10f0['body'][_0x4718('0x31')]=_0x4c3ba9;var _0x2208e2=_0x4c3ba9[0x0];var _0x7363e0=_0x2208e2['queryResult'][_0x4718('0x32')]&&_0x2208e2[_0x4718('0x33')][_0x4718('0x32')][_0x4718('0x34')]?_0x2208e2[_0x4718('0x33')][_0x4718('0x32')][_0x4718('0x34')][_0x4718('0x35')][_0x4718('0x36')]:![];_0x5a10f0[_0x4718('0xc')]['DIALOGFLOWV2_ACTION']=_0x2208e2[_0x4718('0x33')][_0x4718('0x37')];_0x5a10f0['body'][_0x4718('0x38')]=_0x2208e2[_0x4718('0x33')][_0x4718('0x39')];_0x5a10f0['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x2208e2[_0x4718('0x33')][_0x4718('0x32')]&&_0x2208e2[_0x4718('0x33')][_0x4718('0x32')][_0x4718('0x34')]?_0x2208e2['queryResult']['diagnosticInfo'][_0x4718('0x34')][_0x4718('0x35')][_0x4718('0x36')]:![];_0x5a10f0[_0x4718('0xc')][_0x4718('0x3a')]=_0x2208e2[_0x4718('0x33')][_0x4718('0x3b')]['name'];_0x5a10f0['body'][_0x4718('0x3c')]=_0x2208e2[_0x4718('0x33')][_0x4718('0x3b')][_0x4718('0x3d')];_0x5a10f0[_0x4718('0xc')][_0x4718('0x3e')]=_0x2208e2[_0x4718('0x33')][_0x4718('0x3b')][_0x4718('0x3f')];_0x5a10f0[_0x4718('0xc')][_0x4718('0x40')]=_0x2208e2[_0x4718('0x33')][_0x4718('0x41')];_0x5a10f0[_0x4718('0xc')][_0x4718('0x42')]=_0x2208e2[_0x4718('0x33')][_0x4718('0x43')];_0x5a10f0[_0x4718('0xc')][_0x4718('0x44')]=_0x2208e2['queryResult']['intentDetectionConfidence'];_0x4820cb[_0x4718('0x45')]=_0x4718('0x31');_0x4820cb[_0x4718('0x46')]=JSON[_0x4718('0x12')](_0x4c3ba9);var _0x4b451a=[];for(var _0x3af16b=0x0;_0x3af16b<_0x4c3ba9['length'];_0x3af16b++){var _0xa7a414=_0x4c3ba9[_0x3af16b];if(_0xa7a414&&_0xa7a414[_0x4718('0x33')]&&_0xa7a414[_0x4718('0x33')][_0x4718('0x47')]){_0x4b451a[_0x4718('0x48')](createMessage(_0x5194be,_0x438edb,_0x4820cb,_0xa7a414['queryResult'][_0x4718('0x47')]));}}return Promise[_0x4718('0x49')](_0x4b451a)[_0x4718('0xf')](function(){if(_0x7363e0){_0x125e5f['next']();}else{_0x125e5f['stop']();}})[_0x4718('0x11')](function(_0x5ec81f){logger[_0x4718('0x28')]('[%s][DIALOGFLOWV2]\x20%s',_0x5194be,JSON[_0x4718('0x12')](_0x5ec81f));_0x125e5f['next']();});}})['catch'](function(_0x220857){logger[_0x4718('0x28')](_0x4718('0x27'),_0x5194be,_0x220857['message']);_0x125e5f[_0x4718('0x17')]();});}}catch(_0x5b6462){logger[_0x4718('0x28')](_0x4718('0x27'),_0x5194be,JSON[_0x4718('0x12')](_0x5b6462));_0x125e5f[_0x4718('0x2c')]();}};}; \ No newline at end of file +var _0x3175=['DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','providerResponse','stringify','fulfillmentText','push','all','next','dialogflow','md5','moment','routing','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','channel','sms','whatsapp','phone','chat','AccountId','InteractionId','interaction','created','isEmpty','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','detectIntent','length','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x3175,0xd8));var _0x5317=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x3175[_0x13524d];return _0x9918b4;};'use strict';var _=require('lodash');var dialogflow=require(_0x5317('0x0'));var md5=require(_0x5317('0x1'));var moment=require(_0x5317('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x5317('0x3'));var utils=require(_0x5317('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5317('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5317('0x6')),'faxMessage':require(_0x5317('0x7')),'whatsappMessage':require(_0x5317('0x8'))};function createMessage(_0x4c7b45,_0x58b0ed,_0x9f055a,_0x284741){return new Promise(function(_0x43c3ed,_0x23a981){var _0x2ce850=_[_0x5317('0x9')](_0x9f055a);_0x2ce850[_0x5317('0xa')]=_0x284741;return rpc[_0x58b0ed+_0x5317('0xb')][_0x5317('0xc')](_0x2ce850)[_0x5317('0xd')](function(){logger[_0x5317('0xe')](_0x5317('0xf'),_0x4c7b45,_0x2ce850['body']);_0x43c3ed();})['catch'](function(_0x52fbce){logger[_0x5317('0x10')](_0x5317('0xf'),_0x4c7b45,JSON['stringify'](_0x52fbce));_0x23a981(_0x52fbce);});});}exports[_0x5317('0x11')]=function(_0x431cb2,_0x1fc53a){return function(_0x23c6e0){try{if(!_[_0x5317('0x12')](this['interaction'][_0x5317('0x13')])){logger['info'](_0x5317('0xf'),_0x431cb2,_0x5317('0x14'));return _0x23c6e0['next']();}var _0xbc0b6={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5317('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x5317('0x16')]===_0x5317('0x17')||this[_0x5317('0x16')]===_0x5317('0x18')){_0xbc0b6[_0x5317('0x19')]=this['interaction'][_0x5317('0x19')];}var _0x29c39b=this[_0x5317('0x16')];if(_0x29c39b===_0x5317('0x1a')){_0xbc0b6['ChatWebsiteId']=this['account']['id'];}else{_0xbc0b6[_['upperFirst'](_0x29c39b)+_0x5317('0x1b')]=this['account']['id'];}_0xbc0b6[_['upperFirst'](_0x29c39b)+_0x5317('0x1c')]=this[_0x5317('0x1d')]['id'];if(this[_0x5317('0x1d')][_0x5317('0x1e')]){var _0x951377=_0x1fc53a[0x4];if(!_[_0x5317('0x1f')](_0x951377)){_0xbc0b6[_0x5317('0xa')]=utils[_0x5317('0x20')](_0x951377,this);return rpc[_0x29c39b+_0x5317('0xb')][_0x5317('0xc')](_0xbc0b6)[_0x5317('0xd')](function(_0x78f164){logger[_0x5317('0xe')](_0x5317('0xf'),_0x431cb2,_0xbc0b6['body']);})[_0x5317('0x21')](function(_0x2e9d14){logger['error'](_0x5317('0xf'),_0x431cb2,JSON['stringify'](_0x2e9d14));})[_0x5317('0x22')](function(){logger['info'](_0x5317('0x23'),_0x431cb2);_0x23c6e0[_0x5317('0x24')]();});}else{logger[_0x5317('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x431cb2);_0x23c6e0[_0x5317('0x24')]();}}else{var _0x2eb51e=this;var _0x57c576=_0x1fc53a[0x2][_0x5317('0x25')](/\\n/g,'\x0a');var _0xb1dbf5={'credentials':{'private_key':_0x57c576,'client_email':_0x1fc53a[0x1]}};var _0x12f37e=new dialogflow[(_0x5317('0x26'))](_0xb1dbf5);var _0x2a6300=_0x12f37e['sessionPath'](_0x1fc53a[0x0],md5(_0x2eb51e[_0x5317('0x1d')]['id']));var _0x2bf2b0={'session':_0x2a6300,'queryInput':{'text':{'text':_0x2eb51e['message'][_0x5317('0xa')],'languageCode':_0x1fc53a[0x3]||'en'}}};return _0x12f37e[_0x5317('0x27')](_0x2bf2b0)['then'](function(_0x44aefa){if(_0x44aefa&&_0x44aefa[_0x5317('0x28')]){_0x2eb51e[_0x5317('0xa')]['dialogflowV2']=_0x44aefa;var _0x47857e=_0x44aefa[0x0];var _0x331271=_0x47857e[_0x5317('0x29')][_0x5317('0x2a')]&&_0x47857e[_0x5317('0x29')][_0x5317('0x2a')][_0x5317('0x2b')]?_0x47857e[_0x5317('0x29')][_0x5317('0x2a')][_0x5317('0x2b')]['end_conversation'][_0x5317('0x2c')]:![];_0x2eb51e['body'][_0x5317('0x2d')]=_0x47857e[_0x5317('0x29')]['action'];_0x2eb51e[_0x5317('0xa')][_0x5317('0x2e')]=_0x47857e[_0x5317('0x29')][_0x5317('0x2f')];_0x2eb51e['body'][_0x5317('0x30')]=_0x47857e[_0x5317('0x29')]['diagnosticInfo']&&_0x47857e[_0x5317('0x29')][_0x5317('0x2a')]['fields']?_0x47857e['queryResult'][_0x5317('0x2a')][_0x5317('0x2b')]['end_conversation'][_0x5317('0x2c')]:![];_0x2eb51e['body'][_0x5317('0x31')]=_0x47857e[_0x5317('0x29')][_0x5317('0x32')][_0x5317('0x33')];_0x2eb51e[_0x5317('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x47857e[_0x5317('0x29')][_0x5317('0x32')][_0x5317('0x34')];_0x2eb51e[_0x5317('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x47857e[_0x5317('0x29')][_0x5317('0x32')]['isFallback'];_0x2eb51e[_0x5317('0xa')][_0x5317('0x35')]=_0x47857e[_0x5317('0x29')][_0x5317('0x36')];_0x2eb51e[_0x5317('0xa')][_0x5317('0x37')]=_0x47857e[_0x5317('0x29')][_0x5317('0x38')];_0x2eb51e['body'][_0x5317('0x39')]=_0x47857e[_0x5317('0x29')]['intentDetectionConfidence'];_0xbc0b6[_0x5317('0x3a')]=_0x5317('0x3b');_0xbc0b6[_0x5317('0x3c')]=JSON[_0x5317('0x3d')](_0x44aefa);var _0x5df0d4=[];for(var _0x5e1833=0x0;_0x5e1833<_0x44aefa[_0x5317('0x28')];_0x5e1833++){var _0x2a696f=_0x44aefa[_0x5e1833];if(_0x2a696f&&_0x2a696f['queryResult']&&_0x2a696f[_0x5317('0x29')][_0x5317('0x3e')]){_0x5df0d4[_0x5317('0x3f')](createMessage(_0x431cb2,_0x29c39b,_0xbc0b6,_0x2a696f['queryResult'][_0x5317('0x3e')]));}}return Promise[_0x5317('0x40')](_0x5df0d4)[_0x5317('0xd')](function(){if(_0x331271){_0x23c6e0[_0x5317('0x41')]();}else{_0x23c6e0[_0x5317('0x24')]();}})[_0x5317('0x21')](function(_0x5a3246){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x431cb2,JSON[_0x5317('0x3d')](_0x5a3246));_0x23c6e0[_0x5317('0x41')]();});}})['catch'](function(_0x3f380b){logger['error'](_0x5317('0xf'),_0x431cb2,_0x3f380b['message']);_0x23c6e0[_0x5317('0x41')]();});}}catch(_0x986684){logger['error'](_0x5317('0xf'),_0x431cb2,JSON[_0x5317('0x3d')](_0x986684));_0x23c6e0[_0x5317('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 5739f42..08da5ff 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bb5=['html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash'];(function(_0x4be49f,_0x4f4dbf){var _0x39cfe8=function(_0x537aa6){while(--_0x537aa6){_0x4be49f['push'](_0x4be49f['shift']());}};_0x39cfe8(++_0x4f4dbf);}(_0x9bb5,0x12a));var _0x59bb=function(_0x1c1ad8,_0x42a963){_0x1c1ad8=_0x1c1ad8-0x0;var _0x471fc3=_0x9bb5[_0x1c1ad8];return _0x471fc3;};'use strict';var schema=require(_0x59bb('0x0'));var _=require(_0x59bb('0x1'));var htmlToText=require(_0x59bb('0x2'));var utils=require(_0x59bb('0x3'));var logger=require(_0x59bb('0x4'))(_0x59bb('0x5'));var gotoif=schema({'condition':{'type':_0x59bb('0x6'),'required':!![],'message':_0x59bb('0x7')},'priorityTrue':{'type':_0x59bb('0x8'),'message':_0x59bb('0x9')},'priorityFalse':{'type':_0x59bb('0x8'),'message':_0x59bb('0xa')}});exports['consequence']=function(_0x44fcc4,_0x8aabb1){return function(_0x247606){try{var _0x5a26d2={'condition':htmlToText[_0x59bb('0xb')](utils[_0x59bb('0xc')](_0x8aabb1[0x0],this),{'wordwrap':![]})[_0x59bb('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x8aabb1[0x1],'priorityFalse':_0x8aabb1[0x2]};var _0x3b4509=gotoif['validate'](_0x5a26d2,{'typecast':!![]});if(_0x3b4509[_0x59bb('0xe')]){logger['error'](_0x59bb('0xf'),_0x44fcc4,_[_0x59bb('0x10')](_0x3b4509,'message')[_0x59bb('0x11')](',\x20'));_0x247606[_0x59bb('0x12')]();}else{try{var _0x537fae=eval('('+_0x5a26d2[_0x59bb('0x13')]+')');var _0x122366=_0x537fae?_0x5a26d2[_0x59bb('0x14')]:_0x5a26d2[_0x59bb('0x15')];logger[_0x59bb('0x16')](_0x59bb('0x17'),_0x44fcc4,_0x5a26d2['condition'],_0x537fae,_0x122366||'next');if(_0x122366){var _0x359b1a=_['findIndex'](_0x247606[_0x59bb('0x18')](),{'p':_0x122366});if(_0x359b1a>=0x0){logger[_0x59bb('0x16')](_0x59bb('0x19'),_0x44fcc4,_0x122366||_0x59bb('0x1a'),_0x359b1a);_0x247606[_0x59bb('0x1a')](_0x359b1a);}else{logger[_0x59bb('0x16')](_0x59bb('0x1b'),_0x44fcc4,_0x122366||_0x59bb('0x1a'));_0x247606['stop']();}}else{_0x247606[_0x59bb('0x1a')]();}}catch(_0x54242b){logger[_0x59bb('0x1c')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x44fcc4,_0x54242b['message']);_0x247606[_0x59bb('0x12')]();}}}catch(_0x5c534c){logger['error'](_0x59bb('0xf'),_0x44fcc4,JSON[_0x59bb('0x1d')](_0x5c534c));_0x247606['stop']();}};}; \ No newline at end of file +var _0x5694=['stringify','validate','lodash','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','length','error','join','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x184b9d,_0x29740f){var _0x59384b=function(_0x44c670){while(--_0x44c670){_0x184b9d['push'](_0x184b9d['shift']());}};_0x59384b(++_0x29740f);}(_0x5694,0x1b1));var _0x4569=function(_0x1c5297,_0x3169f7){_0x1c5297=_0x1c5297-0x0;var _0x128e15=_0x5694[_0x1c5297];return _0x128e15;};'use strict';var schema=require(_0x4569('0x0'));var _=require(_0x4569('0x1'));var htmlToText=require(_0x4569('0x2'));var utils=require('./utils');var logger=require(_0x4569('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x4569('0x4'),'required':!![],'message':_0x4569('0x5')},'priorityTrue':{'type':_0x4569('0x6'),'message':_0x4569('0x7')},'priorityFalse':{'type':_0x4569('0x6'),'message':_0x4569('0x8')}});exports['consequence']=function(_0x5e4d40,_0x2eb193){return function(_0x22a9dd){try{var _0x215d74={'condition':htmlToText[_0x4569('0x9')](utils[_0x4569('0xa')](_0x2eb193[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2eb193[0x1],'priorityFalse':_0x2eb193[0x2]};var _0x10eacd=gotoif['validate'](_0x215d74,{'typecast':!![]});if(_0x10eacd[_0x4569('0xb')]){logger[_0x4569('0xc')]('[%s][GOTOIF]\x20%s',_0x5e4d40,_['map'](_0x10eacd,'message')[_0x4569('0xd')](',\x20'));_0x22a9dd['stop']();}else{try{var _0x341f62=eval('('+_0x215d74[_0x4569('0xe')]+')');var _0x5af6ef=_0x341f62?_0x215d74[_0x4569('0xf')]:_0x215d74['priorityFalse'];logger['info'](_0x4569('0x10'),_0x5e4d40,_0x215d74[_0x4569('0xe')],_0x341f62,_0x5af6ef||_0x4569('0x11'));if(_0x5af6ef){var _0x1aac18=_[_0x4569('0x12')](_0x22a9dd['rules'](),{'p':_0x5af6ef});if(_0x1aac18>=0x0){logger[_0x4569('0x13')](_0x4569('0x14'),_0x5e4d40,_0x5af6ef||_0x4569('0x11'),_0x1aac18);_0x22a9dd[_0x4569('0x11')](_0x1aac18);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5e4d40,_0x5af6ef||_0x4569('0x11'));_0x22a9dd[_0x4569('0x15')]();}}else{_0x22a9dd['next']();}}catch(_0xb06ab4){logger[_0x4569('0xc')](_0x4569('0x16'),_0x5e4d40,_0xb06ab4['message']);_0x22a9dd['stop']();}}}catch(_0x38a71e){logger['error']('[%s][GOTOIF]\x20%s',_0x5e4d40,JSON[_0x4569('0x17')](_0x38a71e));_0x22a9dd['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 5b99880..5f5a231 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 _0x78c3=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','consequence','length','error','[%s][GOTOP]\x20%s','map','message'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x78c3,0x6e));var _0x378c=function(_0x55e958,_0xb49845){_0x55e958=_0x55e958-0x0;var _0x3e2577=_0x78c3[_0x55e958];return _0x3e2577;};'use strict';var schema=require(_0x378c('0x0'));var _=require(_0x378c('0x1'));var logger=require(_0x378c('0x2'))(_0x378c('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x378c('0x4')]=function(_0x59c136,_0x48f2c6){return function(_0x4add7a){try{var _0x5b4423={'priority':_0x48f2c6[0x0]};var _0x3cf72a=gotop[_0x378c('0x0')](_0x5b4423,{'typecast':!![]});if(_0x3cf72a[_0x378c('0x5')]){logger[_0x378c('0x6')](_0x378c('0x7'),_0x59c136,_[_0x378c('0x8')](_0x3cf72a,_0x378c('0x9'))[_0x378c('0xa')](',\x20'));_0x4add7a[_0x378c('0xb')]();}else{logger[_0x378c('0xc')](_0x378c('0xd'),_0x59c136,_0x5b4423[_0x378c('0xe')]);if(_0x5b4423[_0x378c('0xe')]){var _0x6350c5=_[_0x378c('0xf')](_0x4add7a[_0x378c('0x10')](),{'p':_0x5b4423[_0x378c('0xe')]});if(_0x6350c5>=0x0){logger[_0x378c('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x59c136,_0x5b4423[_0x378c('0xe')]||_0x378c('0x11'),_0x6350c5);_0x4add7a[_0x378c('0x11')](_0x6350c5);}else{logger['info'](_0x378c('0x12'),_0x59c136,_0x5b4423[_0x378c('0xe')]||_0x378c('0x11'));_0x4add7a[_0x378c('0xb')]();}}else{_0x4add7a['next']();}}}catch(_0x3ef50a){logger[_0x378c('0x6')](_0x378c('0x7'),_0x59c136,JSON[_0x378c('0x13')](_0x3ef50a));_0x4add7a[_0x378c('0xb')]();}};}; \ No newline at end of file +var _0xfaa2=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','error','stringify','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','map','message','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0xc593cc,_0x327c2d){var _0x1f5ce0=function(_0x151ac2){while(--_0x151ac2){_0xc593cc['push'](_0xc593cc['shift']());}};_0x1f5ce0(++_0x327c2d);}(_0xfaa2,0x7f));var _0x2faa=function(_0x43e9e9,_0x48d1d9){_0x43e9e9=_0x43e9e9-0x0;var _0x376cf3=_0xfaa2[_0x43e9e9];return _0x376cf3;};'use strict';var schema=require('validate');var _=require(_0x2faa('0x0'));var logger=require(_0x2faa('0x1'))(_0x2faa('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x2faa('0x3')}});exports[_0x2faa('0x4')]=function(_0x4fd40d,_0x331906){return function(_0xecdb0d){try{var _0x32445c={'priority':_0x331906[0x0]};var _0x211ed1=gotop[_0x2faa('0x5')](_0x32445c,{'typecast':!![]});if(_0x211ed1[_0x2faa('0x6')]){logger['error'](_0x2faa('0x7'),_0x4fd40d,_[_0x2faa('0x8')](_0x211ed1,_0x2faa('0x9'))['join'](',\x20'));_0xecdb0d['stop']();}else{logger[_0x2faa('0xa')](_0x2faa('0xb'),_0x4fd40d,_0x32445c[_0x2faa('0xc')]);if(_0x32445c[_0x2faa('0xc')]){var _0x177ed3=_['findIndex'](_0xecdb0d[_0x2faa('0xd')](),{'p':_0x32445c[_0x2faa('0xc')]});if(_0x177ed3>=0x0){logger[_0x2faa('0xa')](_0x2faa('0xe'),_0x4fd40d,_0x32445c[_0x2faa('0xc')]||_0x2faa('0xf'),_0x177ed3);_0xecdb0d[_0x2faa('0xf')](_0x177ed3);}else{logger[_0x2faa('0xa')](_0x2faa('0x10'),_0x4fd40d,_0x32445c[_0x2faa('0xc')]||_0x2faa('0xf'));_0xecdb0d[_0x2faa('0x11')]();}}else{_0xecdb0d['next']();}}}catch(_0x2e38f5){logger[_0x2faa('0x12')]('[%s][GOTOP]\x20%s',_0x4fd40d,JSON[_0x2faa('0x13')](_0x2e38f5));_0xecdb0d[_0x2faa('0x11')]();}};}; \ 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 c307b53..986c3e0 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 _0x806f=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','info','next','error','[%s][MESSAGE]\x20%s','stringify','lodash','./utils','../../../../config/logger'];(function(_0x47f7e3,_0x523181){var _0x26de13=function(_0x375a9b){while(--_0x375a9b){_0x47f7e3['push'](_0x47f7e3['shift']());}};_0x26de13(++_0x523181);}(_0x806f,0x1a6));var _0xf806=function(_0x20268b,_0x6441e3){_0x20268b=_0x20268b-0x0;var _0x23b964=_0x806f[_0x20268b];return _0x23b964;};'use strict';var _=require(_0xf806('0x0'));var utils=require(_0xf806('0x1'));var logger=require(_0xf806('0x2'))(_0xf806('0x3'));var rpc={'chatMessage':require(_0xf806('0x4')),'openchannelMessage':require(_0xf806('0x5')),'mailMessage':require(_0xf806('0x6')),'smsMessage':require(_0xf806('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf806('0x8'))};exports[_0xf806('0x9')]=function(_0x1a1879,_0xe89aac){return function(_0x4b4aa2){try{var _0x5bcaee={'body':utils['getMustacheRender'](_0xe89aac[0x0],this),'ContactId':this[_0xf806('0xa')]['id']};if(this[_0xf806('0xb')]==='chat'){_0x5bcaee[_0xf806('0xc')]=this[_0xf806('0xd')]['id'];}else{_0x5bcaee[_[_0xf806('0xe')](this[_0xf806('0xb')])+_0xf806('0xf')]=this[_0xf806('0xd')]['id'];}_0x5bcaee[_[_0xf806('0xe')](this['channel'])+_0xf806('0x10')]=this['interaction']['id'];if(rpc[this[_0xf806('0xb')]+_0xf806('0x11')]){return rpc[this[_0xf806('0xb')]+'Message'][_0xf806('0x12')](_0x5bcaee)[_0xf806('0x13')](function(_0x17a2ca){logger[_0xf806('0x14')]('[%s][MESSAGE]\x20%s',_0x1a1879,_0x5bcaee['body']);_0x4b4aa2[_0xf806('0x15')]();})['catch'](function(_0x353472){logger[_0xf806('0x16')](_0xf806('0x17'),_0x1a1879,JSON[_0xf806('0x18')](_0x353472));_0x4b4aa2['stop']();});}}catch(_0x38a4c3){logger[_0xf806('0x16')](_0xf806('0x17'),_0x1a1879,JSON[_0xf806('0x18')](_0x38a4c3));_0x4b4aa2['stop']();}};}; \ No newline at end of file +var _0xca13=['consequence','getMustacheRender','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0xca13,0x1a3));var _0x3ca1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca13[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ca1('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3ca1('0x1'));var rpc={'chatMessage':require(_0x3ca1('0x2')),'openchannelMessage':require(_0x3ca1('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3ca1('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3ca1('0x5'))};exports[_0x3ca1('0x6')]=function(_0xa28e9f,_0x426688){return function(_0x4472d4){try{var _0x46f79c={'body':utils[_0x3ca1('0x7')](_0x426688[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x3ca1('0x8')){_0x46f79c[_0x3ca1('0x9')]=this[_0x3ca1('0xa')]['id'];}else{_0x46f79c[_[_0x3ca1('0xb')](this[_0x3ca1('0xc')])+_0x3ca1('0xd')]=this['account']['id'];}_0x46f79c[_['upperFirst'](this[_0x3ca1('0xc')])+_0x3ca1('0xe')]=this[_0x3ca1('0xf')]['id'];if(rpc[this[_0x3ca1('0xc')]+_0x3ca1('0x10')]){return rpc[this[_0x3ca1('0xc')]+_0x3ca1('0x10')][_0x3ca1('0x11')](_0x46f79c)['then'](function(_0x3ae087){logger[_0x3ca1('0x12')](_0x3ca1('0x13'),_0xa28e9f,_0x46f79c['body']);_0x4472d4[_0x3ca1('0x14')]();})[_0x3ca1('0x15')](function(_0x4adea7){logger[_0x3ca1('0x16')](_0x3ca1('0x13'),_0xa28e9f,JSON[_0x3ca1('0x17')](_0x4adea7));_0x4472d4[_0x3ca1('0x18')]();});}}catch(_0x16bb34){logger[_0x3ca1('0x16')](_0x3ca1('0x13'),_0xa28e9f,JSON[_0x3ca1('0x17')](_0x16bb34));_0x4472d4[_0x3ca1('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 352adb6..ac9c586 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 _0x5872=['[%s][NOOP]\x20%s','next','stop','routing'];(function(_0x10ff81,_0x251fbb){var _0x1fbf78=function(_0x3728f6){while(--_0x3728f6){_0x10ff81['push'](_0x10ff81['shift']());}};_0x1fbf78(++_0x251fbb);}(_0x5872,0x18b));var _0x2587=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x5872[_0x95411e];return _0x2c8718;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2587('0x0'));exports['consequence']=function(_0x28dc23,_0x44dc76){return function(_0x5aeabd){try{logger['info'](_0x2587('0x1'),_0x28dc23,utils['getMustacheRender'](_0x44dc76[0x0],this));_0x5aeabd[_0x2587('0x2')]();}catch(_0x595ac6){logger['error'](_0x2587('0x1'),_0x28dc23,JSON['stringify'](_0x595ac6));_0x5aeabd[_0x2587('0x3')]();}};}; \ No newline at end of file +var _0x928b=['../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop'];(function(_0x45e95a,_0x3ff47b){var _0x1da9dd=function(_0x5ae281){while(--_0x5ae281){_0x45e95a['push'](_0x45e95a['shift']());}};_0x1da9dd(++_0x3ff47b);}(_0x928b,0x138));var _0xb928=function(_0x4b6888,_0x3e8c86){_0x4b6888=_0x4b6888-0x0;var _0x3d2bb3=_0x928b[_0x4b6888];return _0x3d2bb3;};'use strict';var utils=require('./utils');var logger=require(_0xb928('0x0'))(_0xb928('0x1'));exports[_0xb928('0x2')]=function(_0x32fece,_0xcda825){return function(_0x505664){try{logger['info'](_0xb928('0x3'),_0x32fece,utils[_0xb928('0x4')](_0xcda825[0x0],this));_0x505664[_0xb928('0x5')]();}catch(_0x1168d6){logger[_0xb928('0x6')](_0xb928('0x3'),_0x32fece,JSON['stringify'](_0x1168d6));_0x505664[_0xb928('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index dbb1801..ea325ab 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(_0x1b55f6,_0x36382f){var _0x38b6a4=function(_0x56dd0c){while(--_0x56dd0c){_0x1b55f6['push'](_0x1b55f6['shift']());}};_0x38b6a4(++_0x36382f);}(_0x34e8,0x12c));var _0x834e=function(_0x43aa29,_0x2bea09){_0x43aa29=_0x43aa29-0x0;var _0x2dbc7e=_0x34e8[_0x43aa29];return _0x2dbc7e;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57756d,_0x22c65e){var _0x340ccf=function(_0x90a11){while(--_0x90a11){_0x57756d['push'](_0x57756d['shift']());}};_0x340ccf(++_0x22c65e);}(_0x008c,0x188));var _0xc008=function(_0x1e0846,_0x4aea1b){_0x1e0846=_0x1e0846-0x0;var _0x57e5d7=_0x008c[_0x1e0846];return _0x57e5d7;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index df53aee..fe65a40 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 _0x011f=['uuid','./util','../../../../../config/logger','routing','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','exports','lodash'];(function(_0x1d88f6,_0x51545b){var _0x21b601=function(_0x4b1998){while(--_0x4b1998){_0x1d88f6['push'](_0x1d88f6['shift']());}};_0x21b601(++_0x51545b);}(_0x011f,0x11f));var _0xf011=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x011f[_0x45f951];return _0x24756c;};'use strict';var _=require(_0xf011('0x0'));var uuid=require(_0xf011('0x1'));var util=require(_0xf011('0x2'));var logger=require(_0xf011('0x3'))(_0xf011('0x4'));var Agent=function(_0x194750,_0x3522b7,_0x39e704,_0x18574c){this[_0xf011('0x5')]=uuid['v4']();this['squeue']=_0x194750;this['agent']=_0x3522b7;this[_0xf011('0x6')]=_0x39e704;this[_0xf011('0x4')]=_0x18574c;this[_0xf011('0x7')][_0xf011('0x8')](this[_0xf011('0x9')][_0xf011('0xa')](this),this[_0xf011('0xb')][_0xf011('0xa')](this));this[_0xf011('0x7')]['on'](_0xf011('0xc'),this[_0xf011('0xb')][_0xf011('0xa')](this));this[_0xf011('0x7')]['on'](_0xf011('0xd'),this[_0xf011('0xe')]['bind'](this));};Agent[_0xf011('0xf')][_0xf011('0x8')]=function(){this['squeue'][_0xf011('0x8')](this['handleRun'][_0xf011('0xa')](this),this[_0xf011('0xb')][_0xf011('0xa')](this));};Agent[_0xf011('0xf')][_0xf011('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0xf011('0xf')][_0xf011('0x9')]=function(_0xa7c1a8){logger[_0xf011('0x10')](_0xf011('0x11'),this[_0xf011('0x7')]['id'],this[_0xf011('0x12')]['id']);if(_[_0xf011('0x13')](this['realtime'][_0xf011('0x14')][this[_0xf011('0x12')]['id']])){logger['info'](_0xf011('0x15'),this[_0xf011('0x7')]['id'],this[_0xf011('0x12')]['id']);setTimeout(this[_0xf011('0x8')]['bind'](this),0x3e8);}else{if(this[_0xf011('0x4')]['forcedOwnership']||util[_0xf011('0x16')](this['squeue']['id'],this[_0xf011('0x6')][_0xf011('0x14')][this[_0xf011('0x12')]['id']],this[_0xf011('0x7')][_0xf011('0x17')],![])){this[_0xf011('0x6')][_0xf011('0x14')][this[_0xf011('0x12')]['id']]['busy']=!![];this[_0xf011('0x6')]['agents'][this[_0xf011('0x12')]['id']]['busyQueue']=undefined;util[_0xf011('0x18')](this[_0xf011('0x5')],this[_0xf011('0x7')]['id'],this['realtime'][_0xf011('0x14')][this['agent']['id']],null,this[_0xf011('0x4')]);util[_0xf011('0x19')](this[_0xf011('0x7')]['id'],this[_0xf011('0x6')][_0xf011('0x14')][this[_0xf011('0x12')]['id']],_0xf011('0x1a')+(this[_0xf011('0x4')]['forcedOwnership']?':FORCED':''));}else{logger['info'](_0xf011('0x1b'),this[_0xf011('0x7')]['id'],this['agent']['id']);setTimeout(this[_0xf011('0x8')]['bind'](this),0x3e8);}}};Agent[_0xf011('0xf')][_0xf011('0xb')]=function(_0x175c26){if(_['isNil'](this[_0xf011('0x6')][_0xf011('0x14')][this[_0xf011('0x12')]['id']])){return logger['info'](_0xf011('0x15'),this['squeue']['id'],this[_0xf011('0x12')]['id']);}else{logger[_0xf011('0x10')](_0xf011('0x1c'),this[_0xf011('0x7')]['id'],this[_0xf011('0x12')]['id']);util['hideNotification'](this['notificationId'],this[_0xf011('0x7')]['id'],this[_0xf011('0x6')][_0xf011('0x14')][this[_0xf011('0x12')]['id']],null,this['routing']);this[_0xf011('0x6')]['agents'][this['agent']['id']][_0xf011('0x1d')]=![];this[_0xf011('0x6')]['agents'][this['agent']['id']][_0xf011('0x1e')]=undefined;util[_0xf011('0x19')](this[_0xf011('0x7')]['id'],this[_0xf011('0x6')][_0xf011('0x14')][this['agent']['id']],_0x175c26?'STOP':'TIMEOUT');}if(!_0x175c26){setTimeout(this['push'][_0xf011('0xa')](this),0x3e8);}};function agent(_0x5d6d8b,_0x12a31d,_0x50e62b,_0x33a0da){return new Agent(_0x5d6d8b,_0x12a31d,_0x50e62b,_0x33a0da);}module[_0xf011('0x1f')]=agent; \ No newline at end of file +var _0x2e3d=['busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','bind','timeout','handleTimeout','drained','prototype','handleRun','handleDrained','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x194c44,_0x3666eb){var _0x3a7b15=function(_0xe90aa){while(--_0xe90aa){_0x194c44['push'](_0x194c44['shift']());}};_0x3a7b15(++_0x3666eb);}(_0x2e3d,0x8c));var _0xd2e3=function(_0x5d9394,_0x292ec1){_0x5d9394=_0x5d9394-0x0;var _0x21836b=_0x2e3d[_0x5d9394];return _0x21836b;};'use strict';var _=require(_0xd2e3('0x0'));var uuid=require(_0xd2e3('0x1'));var util=require(_0xd2e3('0x2'));var logger=require(_0xd2e3('0x3'))(_0xd2e3('0x4'));var Agent=function(_0x3c3bcb,_0x27d016,_0x32ec4c,_0x431948){this['notificationId']=uuid['v4']();this[_0xd2e3('0x5')]=_0x3c3bcb;this[_0xd2e3('0x6')]=_0x27d016;this[_0xd2e3('0x7')]=_0x32ec4c;this[_0xd2e3('0x4')]=_0x431948;this['squeue'][_0xd2e3('0x8')](this['handleRun'][_0xd2e3('0x9')](this),this['handleTimeout'][_0xd2e3('0x9')](this));this[_0xd2e3('0x5')]['on'](_0xd2e3('0xa'),this[_0xd2e3('0xb')]['bind'](this));this[_0xd2e3('0x5')]['on'](_0xd2e3('0xc'),this['handleDrained'][_0xd2e3('0x9')](this));};Agent[_0xd2e3('0xd')][_0xd2e3('0x8')]=function(){this['squeue'][_0xd2e3('0x8')](this[_0xd2e3('0xe')][_0xd2e3('0x9')](this),this[_0xd2e3('0xb')][_0xd2e3('0x9')](this));};Agent[_0xd2e3('0xd')][_0xd2e3('0xf')]=function(){this[_0xd2e3('0xb')](!![]);};Agent[_0xd2e3('0xd')][_0xd2e3('0xe')]=function(_0x24c5b6){logger[_0xd2e3('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xd2e3('0x6')]['id']);if(_[_0xd2e3('0x11')](this[_0xd2e3('0x7')][_0xd2e3('0x12')][this[_0xd2e3('0x6')]['id']])){logger[_0xd2e3('0x10')](_0xd2e3('0x13'),this[_0xd2e3('0x5')]['id'],this[_0xd2e3('0x6')]['id']);setTimeout(this['push'][_0xd2e3('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util['isAgentAvailable'](this[_0xd2e3('0x5')]['id'],this['realtime'][_0xd2e3('0x12')][this['agent']['id']],this[_0xd2e3('0x5')]['channel'],![])){this[_0xd2e3('0x7')]['agents'][this[_0xd2e3('0x6')]['id']][_0xd2e3('0x14')]=!![];this[_0xd2e3('0x7')]['agents'][this['agent']['id']][_0xd2e3('0x15')]=undefined;util[_0xd2e3('0x16')](this['notificationId'],this['squeue']['id'],this['realtime'][_0xd2e3('0x12')][this[_0xd2e3('0x6')]['id']],null,this[_0xd2e3('0x4')]);util[_0xd2e3('0x17')](this['squeue']['id'],this[_0xd2e3('0x7')]['agents'][this[_0xd2e3('0x6')]['id']],'RINGING'+(this[_0xd2e3('0x4')]['forcedOwnership']?_0xd2e3('0x18'):''));}else{logger['info'](_0xd2e3('0x19'),this[_0xd2e3('0x5')]['id'],this[_0xd2e3('0x6')]['id']);setTimeout(this[_0xd2e3('0x8')][_0xd2e3('0x9')](this),0x3e8);}}};Agent[_0xd2e3('0xd')][_0xd2e3('0xb')]=function(_0x3b3341){if(_[_0xd2e3('0x11')](this[_0xd2e3('0x7')][_0xd2e3('0x12')][this['agent']['id']])){return logger[_0xd2e3('0x10')](_0xd2e3('0x13'),this[_0xd2e3('0x5')]['id'],this[_0xd2e3('0x6')]['id']);}else{logger[_0xd2e3('0x10')](_0xd2e3('0x1a'),this['squeue']['id'],this['agent']['id']);util[_0xd2e3('0x1b')](this[_0xd2e3('0x1c')],this['squeue']['id'],this[_0xd2e3('0x7')][_0xd2e3('0x12')][this[_0xd2e3('0x6')]['id']],null,this[_0xd2e3('0x4')]);this['realtime']['agents'][this[_0xd2e3('0x6')]['id']]['busy']=![];this[_0xd2e3('0x7')][_0xd2e3('0x12')][this[_0xd2e3('0x6')]['id']][_0xd2e3('0x15')]=undefined;util['writeLog'](this[_0xd2e3('0x5')]['id'],this[_0xd2e3('0x7')]['agents'][this[_0xd2e3('0x6')]['id']],_0x3b3341?_0xd2e3('0x1d'):_0xd2e3('0x1e'));}if(!_0x3b3341){setTimeout(this[_0xd2e3('0x8')][_0xd2e3('0x9')](this),0x3e8);}};function agent(_0x58a961,_0x18922b,_0x486bbe,_0x31dc27){return new Agent(_0x58a961,_0x18922b,_0x486bbe,_0x31dc27);}module[_0xd2e3('0x1f')]=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 35427b5..fbd36cd 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 _0xc396=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','agents','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','prototype','handleDrained','isNil','Agents','length','info'];(function(_0x1acdd7,_0x1b63d6){var _0x5eed04=function(_0x5d4335){while(--_0x5d4335){_0x1acdd7['push'](_0x1acdd7['shift']());}};_0x5eed04(++_0x1b63d6);}(_0xc396,0x16d));var _0x6c39=function(_0x2015c5,_0x58a2d5){_0x2015c5=_0x2015c5-0x0;var _0x9b2024=_0xc396[_0x2015c5];return _0x9b2024;};'use strict';var _=require('lodash');var uuid=require(_0x6c39('0x0'));var util=require(_0x6c39('0x1'));var logger=require(_0x6c39('0x2'))(_0x6c39('0x3'));var Beepall=function(_0x1792a9,_0x4894f,_0x5786b8,_0x2d2584){this[_0x6c39('0x4')]=uuid['v4']();this[_0x6c39('0x5')]=_0x1792a9;this[_0x6c39('0x6')]=_0x4894f;this[_0x6c39('0x7')]=_0x5786b8;this[_0x6c39('0x3')]=_0x2d2584;this[_0x6c39('0x5')][_0x6c39('0x8')](this[_0x6c39('0x9')]['bind'](this),this[_0x6c39('0xa')][_0x6c39('0xb')](this));this['squeue']['on'](_0x6c39('0xc'),this['handleTimeout'][_0x6c39('0xb')](this));this[_0x6c39('0x5')]['on'](_0x6c39('0xd'),this['handleDrained'][_0x6c39('0xb')](this));};Beepall['prototype']['push']=function(){this['squeue'][_0x6c39('0x8')](this['handleRun']['bind'](this),this[_0x6c39('0xa')][_0x6c39('0xb')](this));};Beepall[_0x6c39('0xe')][_0x6c39('0xf')]=function(_0x32be8c){this[_0x6c39('0xa')](!![]);};Beepall[_0x6c39('0xe')]['handleRun']=function(_0x5a19bb){var _0x43be0b=!![];if(!_[_0x6c39('0x10')](this['queue'])&&!_[_0x6c39('0x10')](this['queue'][_0x6c39('0x11')])&&this[_0x6c39('0x6')]['Agents'][_0x6c39('0x12')]>0x0){for(var _0x11abdd=0x0,_0x12e380;_0x11abdd0x0){for(var _0x5e3428=0x0,_0x1f5469;_0x5e34280x0&&_0x414732[_0x2661ce+_0x73fb('0x24')]>=_0x414732[_0x2661ce+_0x73fb('0x23')]){writeLog(_0x301af2,_0x414732,_0x2661ce[_0x73fb('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x73fb('0x26')]=function(_0x1a8647,_0x1f08c3,_0x4cfad5,_0x41effc,_0x5283b5){return sendNotification(!![],_0x1a8647,_0x1f08c3,_0x4cfad5,_0x41effc,_0x5283b5);};exports[_0x73fb('0x27')]=function(_0x7d4387,_0xa145ec,_0x103075,_0x261556,_0xa68962){return sendNotification(![],_0x7d4387,_0xa145ec,_0x103075,_0x261556,_0xa68962);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x8da1=['busy','BUSY','OFFLINE','Pause','PAUSE','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','emit','user:%s','name','user:save','split','account','notificationSound','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','format','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable'];(function(_0x11d4f2,_0x57d690){var _0x2d9c37=function(_0x68d145){while(--_0x68d145){_0x11d4f2['push'](_0x11d4f2['shift']());}};_0x2d9c37(++_0x57d690);}(_0x8da1,0x1a6));var _0x18da=function(_0x4dfce8,_0x2a9880){_0x4dfce8=_0x4dfce8-0x0;var _0x488a8c=_0x8da1[_0x4dfce8];return _0x488a8c;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x18da('0x0'));var Mustache=require(_0x18da('0x1'));var Redis=require(_0x18da('0x2'));var config=require(_0x18da('0x3'));var logger=require(_0x18da('0x4'))(_0x18da('0x5'));config[_0x18da('0x6')]=_['defaults'](config[_0x18da('0x6')],{'host':_0x18da('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x18da('0x6')]));function emit(_0x5e55d0,_0x4fd348,_0x349199){io['to'](_0x5e55d0)[_0x18da('0x8')](_0x4fd348,_0x349199);}function sendNotification(_0x57f6a8,_0x49023a,_0x1fcc4e,_0x55bb2e,_0x184064,_0x1f81be){io['to'](util['format'](_0x18da('0x9'),_0x55bb2e[_0x18da('0xa')]))[_0x18da('0x8')](_0x18da('0xb'),_0x55bb2e);var _0x51f0ba=_0x1f81be||{};var _0x16cd67=_0x1fcc4e[_0x18da('0xc')]('.');var _0x599d4a={'uniqueid':_0x49023a,'channel':_0x16cd67[0x0],'id':_0x16cd67[0x1],'title':_0x16cd67[0x0]+'\x20interaction','interactionId':_0x16cd67[0x2],'queue':_0x184064?_0x184064[_0x18da('0xa')]:null,'sound':_0x51f0ba[_0x18da('0xd')][_0x18da('0xe')],'shake':_0x51f0ba[_0x18da('0xd')]['notificationShake']};try{if(!_0x51f0ba[_0x18da('0xf')]){_0x51f0ba[_0x18da('0xf')]={};}if(_0x184064){_0x51f0ba['body']['queue']=_0x184064;}else if(_0x51f0ba['body'][_0x18da('0x10')]){delete _0x51f0ba[_0x18da('0xf')][_0x18da('0x10')];}_0x599d4a[_0x18da('0x11')]=utils[_0x18da('0x12')](_0x51f0ba['account']['notificationTemplate'],_0x51f0ba);}catch(_0x2c4dcb){_0x599d4a[_0x18da('0x11')]=_0x18da('0x13');logger[_0x18da('0x14')](util[_0x18da('0x15')]('[%s][QUEUE]\x20%s',_0x49023a,_0x2c4dcb[_0x18da('0x16')]));}io['to'](util[_0x18da('0x15')](_0x18da('0x9'),_0x55bb2e[_0x18da('0xa')]))[_0x18da('0x8')](util['format'](_0x18da('0x17'),_0x57f6a8?_0x18da('0x18'):_0x18da('0x19')),_0x599d4a);}function writeLog(_0x21a792,_0x2e97df,_0x3045f1){return logger[_0x18da('0x1a')](util[_0x18da('0x15')](_0x18da('0x1b'),_0x21a792,_0x2e97df['name'],_0x3045f1));}exports[_0x18da('0x1c')]=function(_0x15b921,_0x52c194,_0x183f63,_0x1ef528){if(_0x52c194[_0x18da('0x1d')]){writeLog(_0x15b921,_0x52c194,_0x18da('0x1e'));return![];}if(!_0x52c194['online']){writeLog(_0x15b921,_0x52c194,_0x18da('0x1f'));return![];}if(_0x52c194[_0x183f63+_0x18da('0x20')]){writeLog(_0x15b921,_0x52c194,_0x18da('0x21'));return![];}if(_0x1ef528&&_0x52c194['hasOwnProperty'](_0x183f63+'Capacity')&&_0x52c194['hasOwnProperty'](_0x183f63+_0x18da('0x22'))){if(_0x52c194[_0x183f63+'Capacity']>0x0&&_0x52c194[_0x183f63+_0x18da('0x22')]>=_0x52c194[_0x183f63+_0x18da('0x23')]){writeLog(_0x15b921,_0x52c194,_0x183f63[_0x18da('0x24')]()+_0x18da('0x25'));return![];}}return!![];};exports[_0x18da('0x26')]=function(_0xa91c23,_0x1aba7a,_0x4d7cf7,_0x3bec6f,_0xd3732b){return sendNotification(!![],_0xa91c23,_0x1aba7a,_0x4d7cf7,_0x3bec6f,_0xd3732b);};exports[_0x18da('0x27')]=function(_0x2b3489,_0x343e7c,_0x3a9e7d,_0x5e1ff8,_0x163bcb){return sendNotification(![],_0x2b3489,_0x343e7c,_0x3a9e7d,_0x5e1ff8,_0x163bcb);};exports[_0x18da('0x28')]=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 d27458a..4378949 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 _0x08d3=['next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','stringify','validate','lodash','./utils','../../../../config/logger','consequence','length','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x120d71,_0x57a0e2){var _0xa896c6=function(_0x143d9f){while(--_0x143d9f){_0x120d71['push'](_0x120d71['shift']());}};_0xa896c6(++_0x57a0e2);}(_0x08d3,0xc7));var _0x308d=function(_0x31abcb,_0x20dff2){_0x31abcb=_0x31abcb-0x0;var _0x214480=_0x08d3[_0x31abcb];return _0x214480;};'use strict';var schema=require(_0x308d('0x0'));var sh=require('shelljs');var _=require(_0x308d('0x1'));var utils=require(_0x308d('0x2'));var logger=require(_0x308d('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x308d('0x4')]=function(_0x1e5ea7,_0x1e9c76){return function(_0x20e8da){try{var _0x115d41={'command':_0x1e9c76[0x0]};var _0x419578=system[_0x308d('0x0')](_0x115d41,{'typecast':!![]});if(_0x419578[_0x308d('0x5')]){logger['error'](_0x308d('0x6'),_0x1e5ea7,_[_0x308d('0x7')](_0x419578,'message')[_0x308d('0x8')](',\x20'));logger[_0x308d('0x9')](_0x308d('0xa'),_0x1e5ea7);_0x20e8da[_0x308d('0xb')]();}else{var _0x4cf288=this;var _0x1d7d83=utils['getMustacheRender'](_0x1e9c76[0x0],this);logger['info'](_0x308d('0xc'),_0x1e5ea7,_0x1d7d83);sh['exec'](_['trim'](_0x1d7d83),function(_0x8259a3,_0xa06fe9){logger[_0x308d('0x9')](_0x308d('0xd'),_0x1e5ea7,_0x8259a3);if(_0x8259a3==0x0){var _0x75a4a4=_0xa06fe9[_0x308d('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x308d('0xf')](_0x1e9c76[0x1])||_[_0x308d('0x10')](_0x1e9c76[0x1])){logger[_0x308d('0x9')](_0x308d('0x11'),_0x1e5ea7);_0x4cf288['body'][_0x1e9c76[0x1]]=_0x75a4a4;}else{logger[_0x308d('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1e5ea7,_0x1e9c76[0x1],_0x75a4a4);_0x4cf288[_0x308d('0x12')][_0x1e9c76[0x1]]=_0x75a4a4;}}_0x20e8da['next']();});}}catch(_0x150af0){logger[_0x308d('0x13')](_0x308d('0x6'),_0x1e5ea7,_['isObject'](_0x150af0)?JSON[_0x308d('0x14')](_0x150af0):_0x150af0);logger[_0x308d('0x9')](_0x308d('0xa'),_0x1e5ea7);_0x20e8da[_0x308d('0xb')]();}};}; \ No newline at end of file +var _0xf4a3=['[%s][SYSTEM]\x20%s','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x25aad4,_0x258104){var _0x4dff00=function(_0x3a1713){while(--_0x3a1713){_0x25aad4['push'](_0x25aad4['shift']());}};_0x4dff00(++_0x258104);}(_0xf4a3,0xcf));var _0x3f4a=function(_0xfb6034,_0x3858e6){_0xfb6034=_0xfb6034-0x0;var _0x38b4b3=_0xf4a3[_0xfb6034];return _0x38b4b3;};'use strict';var schema=require(_0x3f4a('0x0'));var sh=require(_0x3f4a('0x1'));var _=require(_0x3f4a('0x2'));var utils=require(_0x3f4a('0x3'));var logger=require(_0x3f4a('0x4'))(_0x3f4a('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x3f4a('0x6')}});exports[_0x3f4a('0x7')]=function(_0x8a3897,_0x544ffc){return function(_0x22e18a){try{var _0x5bf384={'command':_0x544ffc[0x0]};var _0x1e8104=system[_0x3f4a('0x0')](_0x5bf384,{'typecast':!![]});if(_0x1e8104[_0x3f4a('0x8')]){logger['error'](_0x3f4a('0x9'),_0x8a3897,_[_0x3f4a('0xa')](_0x1e8104,'message')[_0x3f4a('0xb')](',\x20'));logger['info'](_0x3f4a('0xc'),_0x8a3897);_0x22e18a[_0x3f4a('0xd')]();}else{var _0x492314=this;var _0x2d211f=utils[_0x3f4a('0xe')](_0x544ffc[0x0],this);logger[_0x3f4a('0xf')](_0x3f4a('0x10'),_0x8a3897,_0x2d211f);sh[_0x3f4a('0x11')](_['trim'](_0x2d211f),function(_0xec600f,_0x3a76d1){logger['info'](_0x3f4a('0x12'),_0x8a3897,_0xec600f);if(_0xec600f==0x0){var _0x303361=_0x3a76d1['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x3f4a('0x13')](_0x544ffc[0x1])||_[_0x3f4a('0x14')](_0x544ffc[0x1])){logger[_0x3f4a('0xf')]('[%s][SYSTEM]\x20no\x20variable',_0x8a3897);_0x492314[_0x3f4a('0x15')][_0x544ffc[0x1]]=_0x303361;}else{logger[_0x3f4a('0xf')](_0x3f4a('0x16'),_0x8a3897,_0x544ffc[0x1],_0x303361);_0x492314[_0x3f4a('0x15')][_0x544ffc[0x1]]=_0x303361;}}_0x22e18a[_0x3f4a('0xd')]();});}}catch(_0x49c4fa){logger['error'](_0x3f4a('0x9'),_0x8a3897,_['isObject'](_0x49c4fa)?JSON[_0x3f4a('0x17')](_0x49c4fa):_0x49c4fa);logger[_0x3f4a('0xf')](_0x3f4a('0xc'),_0x8a3897);_0x22e18a['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 072088c..0896346 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 _0x40a1=['[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','next','error','isObject','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length'];(function(_0x5d6c6c,_0x5e3a45){var _0x177d5d=function(_0x4dd12f){while(--_0x4dd12f){_0x5d6c6c['push'](_0x5d6c6c['shift']());}};_0x177d5d(++_0x5e3a45);}(_0x40a1,0x1dc));var _0x140a=function(_0x5da4e6,_0x4dfd99){_0x5da4e6=_0x5da4e6-0x0;var _0x483614=_0x40a1[_0x5da4e6];return _0x483614;};'use strict';var schema=require('validate');var _=require(_0x140a('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x140a('0x1')),'mailInteraction':require(_0x140a('0x2')),'faxInteraction':require(_0x140a('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x140a('0x4'))(_0x140a('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x140a('0x6')}});exports[_0x140a('0x7')]=function(_0x5b8686,_0x5cc964,_0x5ca22a,_0x12b316){return function(_0x3bcfa7){try{var _0x21076f={'tag':_0x5cc964[0x0]};var _0x150b63=tag[_0x140a('0x8')](_0x21076f,{'typecast':!![]});if(_0x150b63[_0x140a('0x9')]){logger['error'](_0x140a('0xa'),_0x5b8686,_[_0x140a('0xb')](_0x150b63,_0x140a('0xc'))[_0x140a('0xd')](',\x20'));logger[_0x140a('0xe')](_0x140a('0xf'),_0x5b8686);_0x3bcfa7['next']();}else{var _0x1a2ebb={'ids':[_0x5cc964[0x0]]};if(rpc[_0x12b316[_0x140a('0x10')]+_0x140a('0x11')]){rpc[_0x12b316[_0x140a('0x10')]+_0x140a('0x11')]['addTags'](_0x12b316['interaction']['id'],_0x1a2ebb)[_0x140a('0x12')](function(_0x59a703){logger[_0x140a('0xe')](_0x140a('0x13'),_0x5b8686,_0x5cc964[0x1],_0x12b316[_0x140a('0x10')],_0x12b316[_0x140a('0x14')]['id']);})[_0x140a('0x15')](function(_0xdb0b76){logger['error'](_0x140a('0xa'),_0x5b8686,JSON[_0x140a('0x16')](_0xdb0b76));logger[_0x140a('0xe')](_0x140a('0xf'),_0x5b8686);})[_0x140a('0x17')](function(){_0x3bcfa7[_0x140a('0x18')]();});}}}catch(_0x533927){logger[_0x140a('0x19')](_0x140a('0xa'),_0x5b8686,_[_0x140a('0x1a')](_0x533927)?JSON[_0x140a('0x16')](_0x533927):_0x533927);logger[_0x140a('0xe')](_0x140a('0xf'),_0x5b8686);_0x3bcfa7['next']();}};}; \ No newline at end of file +var _0x7567=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','channel','Interaction','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','next','stringify','lodash','../../rpc/chatInteraction'];(function(_0x14b268,_0xc29a1a){var _0x58fd2a=function(_0x533ed7){while(--_0x533ed7){_0x14b268['push'](_0x14b268['shift']());}};_0x58fd2a(++_0xc29a1a);}(_0x7567,0xbb));var _0x7756=function(_0x5d349e,_0x1a5bca){_0x5d349e=_0x5d349e-0x0;var _0x4eddbb=_0x7567[_0x5d349e];return _0x4eddbb;};'use strict';var schema=require('validate');var _=require(_0x7756('0x0'));var rpc={'chatInteraction':require(_0x7756('0x1')),'openchannelInteraction':require(_0x7756('0x2')),'smsInteraction':require(_0x7756('0x3')),'mailInteraction':require(_0x7756('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x7756('0x5'))(_0x7756('0x6'));var tag=schema({'tag':{'type':_0x7756('0x7'),'required':!![],'message':_0x7756('0x8')}});exports[_0x7756('0x9')]=function(_0x216e1e,_0x3a1356,_0x2aa2ac,_0x31ea03){return function(_0x24de3e){try{var _0x6da3d={'tag':_0x3a1356[0x0]};var _0x14a7f0=tag[_0x7756('0xa')](_0x6da3d,{'typecast':!![]});if(_0x14a7f0[_0x7756('0xb')]){logger[_0x7756('0xc')](_0x7756('0xd'),_0x216e1e,_[_0x7756('0xe')](_0x14a7f0,_0x7756('0xf'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x216e1e);_0x24de3e['next']();}else{var _0xee88f4={'ids':[_0x3a1356[0x0]]};if(rpc[_0x31ea03[_0x7756('0x10')]+_0x7756('0x11')]){rpc[_0x31ea03['channel']+_0x7756('0x11')]['addTags'](_0x31ea03[_0x7756('0x12')]['id'],_0xee88f4)[_0x7756('0x13')](function(_0x7fc700){logger[_0x7756('0x14')](_0x7756('0x15'),_0x216e1e,_0x3a1356[0x1],_0x31ea03[_0x7756('0x10')],_0x31ea03['interaction']['id']);})[_0x7756('0x16')](function(_0x93b1aa){logger[_0x7756('0xc')]('[%s][TAG]\x20%s',_0x216e1e,JSON['stringify'](_0x93b1aa));logger[_0x7756('0x14')](_0x7756('0x17'),_0x216e1e);})[_0x7756('0x18')](function(){_0x24de3e[_0x7756('0x19')]();});}}}catch(_0x2f7f1c){logger['error']('[%s][TAG]\x20%s',_0x216e1e,_['isObject'](_0x2f7f1c)?JSON[_0x7756('0x1a')](_0x2f7f1c):_0x2f7f1c);logger[_0x7756('0x14')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x216e1e);_0x24de3e[_0x7756('0x19')]();}};}; \ 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 b42aeb5..e3d37d5 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 _0x340c=['lodash','exports','render','merge','body','contact','account','interaction','list','mustache'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var Mustache=require(_0xc340('0x0'));var _=require(_0xc340('0x1'));module[_0xc340('0x2')]={'getMustacheRender':function(_0x3fe21b,_0x5b80c5){return Mustache[_0xc340('0x3')](_0x3fe21b,_[_0xc340('0x4')](_0x5b80c5[_0xc340('0x5')],{'contact':_0x5b80c5[_0xc340('0x6')],'message':_0x5b80c5['message'],'account':_0x5b80c5[_0xc340('0x7')],'interaction':_0x5b80c5[_0xc340('0x8')],'list':_0x5b80c5[_0xc340('0x9')]}))||'';}}; \ No newline at end of file +var _0xe105=['interaction','mustache','render','merge','body','contact','account'];(function(_0x10fb6d,_0x1f21bd){var _0x89975b=function(_0x4d5b4b){while(--_0x4d5b4b){_0x10fb6d['push'](_0x10fb6d['shift']());}};_0x89975b(++_0x1f21bd);}(_0xe105,0xef));var _0x5e10=function(_0x44795a,_0x482b4f){_0x44795a=_0x44795a-0x0;var _0x2b9eb7=_0xe105[_0x44795a];return _0x2b9eb7;};'use strict';var Mustache=require(_0x5e10('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x55d186,_0x52e261){return Mustache[_0x5e10('0x1')](_0x55d186,_[_0x5e10('0x2')](_0x52e261[_0x5e10('0x3')],{'contact':_0x52e261[_0x5e10('0x4')],'message':_0x52e261['message'],'account':_0x52e261[_0x5e10('0x5')],'interaction':_0x52e261[_0x5e10('0x6')],'list':_0x52e261['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 65b1c84..488c121 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 _0xb28a=['listen','rules','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','channel','mail','push','dialogflow','slice','dialogflowv2','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agents','agent','busyQueue','update','UserId','catch','stack','message\x20is\x20empty','busy','end','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','waiting','mailQueues','loggedIn','paused','openchannelQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval'];(function(_0x474d03,_0x5291a1){var _0x562c21=function(_0x32cb22){while(--_0x32cb22){_0x474d03['push'](_0x474d03['shift']());}};_0x562c21(++_0x5291a1);}(_0xb28a,0x166));var _0xab28=function(_0x1f2142,_0x3b88ba){_0x1f2142=_0x1f2142-0x0;var _0x108b15=_0xb28a[_0x1f2142];return _0x108b15;};'use strict';var _=require('lodash');var util=require(_0xab28('0x0'));var path=require(_0xab28('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xab28('0x2'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xab28('0x3'));var rpc={'openchannelQueueReport':require(_0xab28('0x4')),'mailQueueReport':require(_0xab28('0x5')),'chatQueueReport':require(_0xab28('0x6')),'smsQueueReport':require(_0xab28('0x7')),'faxQueueReport':require(_0xab28('0x8')),'whatsappQueueReport':require(_0xab28('0x9'))};var RuleEngine=require(_0xab28('0xa'));function getId(_0x48949b,_0x479267,_0x294e36){return util[_0xab28('0xb')](_0xab28('0xc'),_0x48949b,_0x479267||0x0,_0x294e36||0x0);}function getIntervals(_0x2508ef,_0x1f1956){var _0x2ac052=[];if(!_['isNil'](_0x1f1956[_0xab28('0xd')])&&!_['isNil'](_0x2508ef[_0x1f1956[_0xab28('0xd')]])&&!_[_0xab28('0xe')](_0x2508ef[_0x1f1956[_0xab28('0xd')]][_0xab28('0xf')])){_0x2ac052=_[_0xab28('0x10')](_0x2508ef[_0x1f1956[_0xab28('0xd')]][_0xab28('0xf')],_0xab28('0x11'));}else if(!_['isNil'](_0x1f1956[_0xab28('0x11')])){_0x2ac052=[_0x1f1956[_0xab28('0x11')]];}return _0x2ac052;}exports[_0xab28('0x12')]=function(_0x389fc3){_0x389fc3[_0xab28('0x13')]={};return new BPromise(function(_0x19029e,_0x554954){var _0x5c9694={'Start':function(_0x7c1921){var _0x3d133e=this;return new Promise(function(_0x14e8b4,_0xaaeb24){if(_0x7c1921){try{var _0x53c5c7=[];var _0x28ebe2=getId(_0x7c1921['channel'],_0x7c1921[_0xab28('0x14')]?_0x7c1921['message']['id']:0x0,_0x7c1921[_0xab28('0x15')]?_0x7c1921[_0xab28('0x15')]['id']:0x0);if(_0x7c1921[_0xab28('0x16')]&&_[_0xab28('0x17')](_0x7c1921[_0xab28('0x16')])&&_0x7c1921[_0xab28('0x16')][_0xab28('0x18')]){for(var _0x300cbd=0x0;_0x300cbd<_0x7c1921['applications'][_0xab28('0x18')];_0x300cbd+=0x1){var _0x18af35=_0x7c1921[_0xab28('0x16')][_0x300cbd];if(fs[_0xab28('0x19')](path[_0xab28('0x1a')](__dirname,_0xab28('0x16'),_0x18af35[_0xab28('0x1b')]+'.js'))){var _0x116c2c=[];switch(_0x18af35['app'][_0xab28('0x1c')]()){case _0xab28('0x1d'):var _0x4a9c6d=_0x18af35[_0xab28('0x1e')][_0xab28('0x1f')](',');if(_0x7c1921[_0xab28('0x20')]===_0xab28('0x21')){_0x116c2c[_0xab28('0x22')](_0x4a9c6d[0x0]);_0x116c2c[_0xab28('0x22')](_0x4a9c6d[0x1]);_0x116c2c[_0xab28('0x22')](_0x4a9c6d['slice'](0x2,_0x4a9c6d[_0xab28('0x18')])['join'](','));}else{_0x116c2c[_0xab28('0x22')](_0x4a9c6d[0x0]);_0x116c2c[_0xab28('0x22')](_0x4a9c6d['slice'](0x1,_0x4a9c6d[_0xab28('0x18')])['join'](','));}break;case _0xab28('0x23'):var _0x2a3405=_0x18af35[_0xab28('0x1e')]['split'](',');_0x116c2c[_0xab28('0x22')](_0x2a3405[0x0]);_0x116c2c[_0xab28('0x22')](_0x2a3405[0x1]);_0x116c2c['push'](_0x2a3405[_0xab28('0x24')](0x2,_0x2a3405[_0xab28('0x18')])[_0xab28('0x1a')](','));break;case _0xab28('0x25'):var _0x537f64=_0x18af35[_0xab28('0x1e')][_0xab28('0x1f')](',');_0x116c2c[_0xab28('0x22')](_0x537f64[0x0]);_0x116c2c[_0xab28('0x22')](_0x537f64[0x1]);_0x116c2c[_0xab28('0x22')](_0x537f64[0x2]);_0x116c2c[_0xab28('0x22')](_0x537f64[0x3]);_0x116c2c[_0xab28('0x22')](_0x537f64[_0xab28('0x24')](0x4,_0x537f64[_0xab28('0x18')])[_0xab28('0x1a')](','));break;case'amazonlex':var _0x520bc2=_0x18af35[_0xab28('0x1e')]['split'](',');_0x116c2c['push'](_0x520bc2[0x0]);_0x116c2c[_0xab28('0x22')](_0x520bc2[0x1]);_0x116c2c[_0xab28('0x22')](_0x520bc2[0x2]);_0x116c2c[_0xab28('0x22')](_0x520bc2[0x3]);_0x116c2c[_0xab28('0x22')](_0x520bc2[_0xab28('0x24')](0x4,_0x520bc2[_0xab28('0x18')])['join'](','));break;case _0xab28('0x14'):_0x116c2c[_0xab28('0x22')](_0x18af35[_0xab28('0x1e')]);break;case'tag':_0x116c2c[_0xab28('0x22')](_0x18af35['TagId']);_0x116c2c[_0xab28('0x22')](_0x18af35[_0xab28('0x1e')]);break;default:_0x116c2c=_['isNil'](_0x18af35[_0xab28('0x1e')])?[]:_0x18af35[_0xab28('0x1e')][_0xab28('0x1f')](',');}var _0xb5e561={'id':util[_0xab28('0xb')](_0xab28('0x26'),_0x28ebe2,_0x18af35['id'],_0x18af35['app']),'condition':require(_0xab28('0x27'))[_0xab28('0x28')](_0x28ebe2,getIntervals(_0x389fc3['intervals'],_0x18af35),_0x389fc3),'consequence':require(_0xab28('0x29')+_0x18af35[_0xab28('0x1b')])[_0xab28('0x2a')](_0x28ebe2,_0x116c2c,_0x389fc3,_0x7c1921),'p':_0x18af35[_0xab28('0x2b')]||0x0};logger[_0xab28('0x2c')](_0xab28('0x2d'),_0xb5e561['id'],_0xab28('0x2e'),getIntervals(_0x389fc3[_0xab28('0x2f')],_0x18af35)['join'](_0xab28('0x30')));_0x53c5c7[_0xab28('0x22')](_0xb5e561);}else{logger['error'](_0xab28('0x31'),path[_0xab28('0x1a')](__dirname,'applications',_0x18af35[_0xab28('0x1b')]+_0xab28('0x32')));}}_0x389fc3[_0xab28('0x13')][_0x28ebe2]=new RuleEngine(_0x53c5c7);_0x389fc3[_0xab28('0x13')][_0x28ebe2][_0xab28('0x33')](_0x7c1921,function(_0x443cc8){logger[_0xab28('0x2c')]('Applications\x20executed',JSON[_0xab28('0x34')](_0x443cc8[_0xab28('0x35')]));if(_0x389fc3['rules'][_0x28ebe2]){_0x389fc3[_0xab28('0x13')][_0x28ebe2][_0xab28('0x36')](_0xab28('0x37'));}});return _0x14e8b4({'code':0xc8,'message':_0x7c1921});}else{logger[_0xab28('0x2c')](_0xab28('0x38'));return _0x14e8b4({'code':0xc8,'message':_0x7c1921});}}catch(_0x5b77c1){logger[_0xab28('0x39')](_0x5b77c1['stack']);return _0xaaeb24(_0x3d133e['error'](0x1f4,_0x5b77c1));}}return _0xaaeb24(_0xab28('0x3a'));});},'AcceptMessage':function(_0x11b042){var _0x23ada2=this;return new Promise(function(_0x44a986,_0x2c0b34){if(_0x11b042['agent']&&_0x11b042['agent']['id']){if(_0x389fc3[_0xab28('0x3b')][_0x11b042['agent']['id']]){_0x389fc3[_0xab28('0x3b')][_0x11b042['agent']['id']]['busy']=![];_0x389fc3[_0xab28('0x3b')][_0x11b042[_0xab28('0x3c')]['id']][_0xab28('0x3d')]=undefined;}}if(_0x11b042[_0xab28('0x14')]&&_0x11b042[_0xab28('0x14')]['id']){try{var _0x1aea9b=getId(_0x11b042['channel'],_0x11b042['message']?_0x11b042[_0xab28('0x14')]['id']:0x0,_0x11b042['interaction']?_0x11b042[_0xab28('0x15')]['id']:0x0);if(_0x389fc3['rules'][_0x1aea9b]){_0x389fc3[_0xab28('0x13')][_0x1aea9b]['emit']('end');if(rpc[_0x11b042[_0xab28('0x20')]+'QueueReport']){rpc[_0x11b042['channel']+'QueueReport'][_0xab28('0x3e')](_0x1aea9b,{'UserId':_0x11b042['message'][_0xab28('0x3f')]})[_0xab28('0x40')](function(_0x3f1da9){logger[_0xab28('0x39')]('error\x20update\x20queue\x20report');});}}return _0x44a986({'code':0xc8,'message':_0x11b042});}catch(_0x249a71){logger[_0xab28('0x39')](_0x249a71[_0xab28('0x41')]);return _0x2c0b34(_0x23ada2[_0xab28('0x39')](0x1f4,_0x249a71));}}logger[_0xab28('0x39')]('message\x20is\x20empty');return _0x2c0b34(_0x23ada2[_0xab28('0x39')](0x1f4,_0xab28('0x42')));});},'RejectMessage':function(_0x49bb4f){var _0x37c727=this;return new Promise(function(_0x586717,_0x47cd07){if(_0x49bb4f[_0xab28('0x3c')]&&_0x49bb4f[_0xab28('0x3c')]['id']){try{if(_0x389fc3['agents'][_0x49bb4f[_0xab28('0x3c')]['id']]){_0x389fc3['agents'][_0x49bb4f[_0xab28('0x3c')]['id']][_0xab28('0x43')]=![];_0x389fc3[_0xab28('0x3b')][_0x49bb4f[_0xab28('0x3c')]['id']]['busyQueue']=undefined;}return _0x586717({'code':0xc8,'message':_0x49bb4f});}catch(_0x1e6513){logger['error'](_0x1e6513['stack']);return _0x47cd07(_0x37c727[_0xab28('0x39')](0x1f4,_0x1e6513));}}logger['error'](_0xab28('0x42'));return _0x47cd07(_0x37c727[_0xab28('0x39')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3e037d){var _0x2d5494=this;return new Promise(function(_0x49bc36,_0x41dd3d){if(_0x3e037d['channel']&&_0x3e037d[_0xab28('0x15')]&&_0x3e037d[_0xab28('0x15')]['id']){try{var _0x41c0b8=getId(_0x3e037d[_0xab28('0x20')],_0x3e037d[_0xab28('0x14')]?_0x3e037d[_0xab28('0x14')]['id']:0x0,_0x3e037d[_0xab28('0x15')]?_0x3e037d[_0xab28('0x15')]['id']:0x0);if(_0x389fc3['rules'][_0x41c0b8]){_0x389fc3[_0xab28('0x13')][_0x41c0b8][_0xab28('0x36')](_0xab28('0x44'));}return _0x49bc36({'code':0xc8,'message':_0x3e037d});}catch(_0x12da9c){logger[_0xab28('0x39')](_0x12da9c[_0xab28('0x41')]);return _0x41dd3d(_0x2d5494[_0xab28('0x39')](0x1f4,_0x12da9c));}}logger[_0xab28('0x39')](_0xab28('0x42'));return _0x41dd3d(_0x2d5494[_0xab28('0x39')](0x1f4,_0xab28('0x42')));});},'AgentCapacity':function(_0x4824f7){var _0x626732=this;return new Promise(function(_0x534bfc,_0x5d6d01){if(_0x389fc3[_0xab28('0x3b')][_0xab28('0x45')](_0x4824f7['id'])){for(var _0xf742fd in _0x4824f7['capacity']){if(_0x4824f7['capacity'][_0xab28('0x45')](_0xf742fd)){if(_0x389fc3[_0xab28('0x3b')][_0x4824f7['id']][_0xab28('0x45')](_0xf742fd+_0xab28('0x46'))){_0x389fc3[_0xab28('0x3b')][_0x4824f7['id']][_0xf742fd+_0xab28('0x46')]=parseInt(_0x4824f7[_0xab28('0x47')][_0xf742fd],0xa);}}}_0x389fc3[_0xab28('0x3b')][_0x4824f7['id']][_0xab28('0x48')]();return _0x534bfc({'code':0xc8,'message':_0x389fc3[_0xab28('0x3b')][_0x4824f7['id']]});}else{return _0x5d6d01(_0x626732[_0xab28('0x39')](0x1f4,_0xab28('0x49')));}});},'Agents':function(_0x263fa6){return new Promise(function(_0x150ee2,_0x1937cb){var _0x2d99b1=_[_0xab28('0x4a')](_0x389fc3[_0xab28('0x3b')]);_0x150ee2({'count':_0x2d99b1[_0xab28('0x18')],'rows':_0x2d99b1});});},'ChatQueues':function(_0x29a235){return new Promise(function(_0x473c0b,_0x10b226){var _0x23b50c=[];for(var _0x689bea in _0x389fc3[_0xab28('0x4b')]){if(_0x389fc3[_0xab28('0x4b')][_0xab28('0x45')](_0x689bea)){var _0x537b9a=_0x389fc3[_0xab28('0x4b')][_0x689bea];var _0x45518e={'id':_0x537b9a['id'],'available':_0x537b9a[_0xab28('0x4c')],'loggedIn':_0x537b9a['loggedIn'],'name':_0x537b9a[_0xab28('0x4d')],'paused':_0x537b9a['paused'],'waiting':_0x537b9a[_0xab28('0x4e')]};_0x23b50c[_0xab28('0x22')](_0x45518e);}}_0x473c0b({'count':_0x23b50c['length'],'rows':_0x23b50c});});},'MailQueues':function(_0x47e6dd){return new Promise(function(_0x41a109,_0x2447a5){var _0x59422a=[];for(var _0x63f569 in _0x389fc3['mailQueues']){if(_0x389fc3['mailQueues'][_0xab28('0x45')](_0x63f569)){var _0x2223af=_0x389fc3[_0xab28('0x4f')][_0x63f569];var _0x5eabd3={'id':_0x2223af['id'],'available':_0x2223af[_0xab28('0x4c')],'loggedIn':_0x2223af[_0xab28('0x50')],'name':_0x2223af[_0xab28('0x4d')],'paused':_0x2223af[_0xab28('0x51')],'waiting':_0x2223af[_0xab28('0x4e')]};_0x59422a[_0xab28('0x22')](_0x5eabd3);}}_0x41a109({'count':_0x59422a[_0xab28('0x18')],'rows':_0x59422a});});},'OpenchannelQueues':function(_0x4a622f){return new Promise(function(_0x124573,_0x20cf57){var _0x8b9fa3=[];for(var _0x7c046d in _0x389fc3[_0xab28('0x52')]){if(_0x389fc3[_0xab28('0x52')][_0xab28('0x45')](_0x7c046d)){var _0x4d19f9=_0x389fc3[_0xab28('0x52')][_0x7c046d];var _0x1a2753={'id':_0x4d19f9['id'],'available':_0x4d19f9['available'],'loggedIn':_0x4d19f9[_0xab28('0x50')],'name':_0x4d19f9['name'],'paused':_0x4d19f9[_0xab28('0x51')],'waiting':_0x4d19f9['waiting']};_0x8b9fa3[_0xab28('0x22')](_0x1a2753);}}_0x124573({'count':_0x8b9fa3[_0xab28('0x18')],'rows':_0x8b9fa3});});},'SmsQueues':function(_0x2a2f69){return new Promise(function(_0x54ab8c,_0x3fbbd4){var _0x11699a=[];for(var _0x42c765 in _0x389fc3['smsQueues']){if(_0x389fc3['smsQueues']['hasOwnProperty'](_0x42c765)){var _0x59345b=_0x389fc3['smsQueues'][_0x42c765];var _0x1cb915={'id':_0x59345b['id'],'available':_0x59345b[_0xab28('0x4c')],'loggedIn':_0x59345b[_0xab28('0x50')],'name':_0x59345b[_0xab28('0x4d')],'paused':_0x59345b[_0xab28('0x51')],'waiting':_0x59345b['waiting']};_0x11699a[_0xab28('0x22')](_0x1cb915);}}_0x54ab8c({'count':_0x11699a[_0xab28('0x18')],'rows':_0x11699a});});},'FaxQueues':function(_0x4253ea){return new Promise(function(_0x84c273,_0x4168fb){var _0x57011b=[];for(var _0x29cb9d in _0x389fc3['faxQueues']){if(_0x389fc3[_0xab28('0x53')]['hasOwnProperty'](_0x29cb9d)){var _0x3a1ed1=_0x389fc3[_0xab28('0x53')][_0x29cb9d];var _0x43aede={'id':_0x3a1ed1['id'],'available':_0x3a1ed1[_0xab28('0x4c')],'loggedIn':_0x3a1ed1[_0xab28('0x50')],'name':_0x3a1ed1[_0xab28('0x4d')],'paused':_0x3a1ed1[_0xab28('0x51')],'waiting':_0x3a1ed1[_0xab28('0x4e')]};_0x57011b['push'](_0x43aede);}}_0x84c273({'count':_0x57011b[_0xab28('0x18')],'rows':_0x57011b});});},'WhatsappQueues':function(_0x58d54){return new Promise(function(_0x5ce9d0,_0x46d287){var _0x2d65f1=[];for(var _0x2a153b in _0x389fc3[_0xab28('0x54')]){if(_0x389fc3[_0xab28('0x54')][_0xab28('0x45')](_0x2a153b)){var _0x1dea1d=_0x389fc3[_0xab28('0x54')][_0x2a153b];var _0x5f3e8b={'id':_0x1dea1d['id'],'available':_0x1dea1d['available'],'loggedIn':_0x1dea1d['loggedIn'],'name':_0x1dea1d[_0xab28('0x4d')],'paused':_0x1dea1d['paused'],'waiting':_0x1dea1d['waiting']};_0x2d65f1[_0xab28('0x22')](_0x5f3e8b);}}_0x5ce9d0({'count':_0x2d65f1[_0xab28('0x18')],'rows':_0x2d65f1});});},'ChatQueuesWaitingInteractions':function(_0x3264f2){return new Promise(function(_0x294e2a,_0x12df9c){var _0x474233=_[_0xab28('0x4a')](_0x389fc3[_0xab28('0x55')]);_0x294e2a({'count':_0x474233[_0xab28('0x18')],'rows':_0x474233});});},'MailQueuesWaitingInteractions':function(_0x2a3a16){return new Promise(function(_0x298d8d,_0x231d31){var _0x155f28=_[_0xab28('0x4a')](_0x389fc3[_0xab28('0x56')]);_0x298d8d({'count':_0x155f28['length'],'rows':_0x155f28});});},'OpenchannelQueuesWaitingInteractions':function(_0x5d9fc9){return new Promise(function(_0x1c3ef8,_0x283eaa){var _0x1e95da=_['values'](_0x389fc3['openchannelQueuesWaitingInteractions']);_0x1c3ef8({'count':_0x1e95da[_0xab28('0x18')],'rows':_0x1e95da});});},'SmsQueuesWaitingInteractions':function(_0x432be5){return new Promise(function(_0x4a43ca,_0x86c270){var _0x1ac89f=_[_0xab28('0x4a')](_0x389fc3['smsQueuesWaitingInteractions']);_0x4a43ca({'count':_0x1ac89f['length'],'rows':_0x1ac89f});});},'FaxQueuesWaitingInteractions':function(_0x53c47c){return new Promise(function(_0xa7843d,_0x2882f4){var _0x5213a4=_['values'](_0x389fc3[_0xab28('0x57')]);_0xa7843d({'count':_0x5213a4[_0xab28('0x18')],'rows':_0x5213a4});});},'WhatsappQueuesWaitingInteractions':function(_0x795882){return new Promise(function(_0x217ecd,_0x4198a4){var _0x3cc368=_['values'](_0x389fc3[_0xab28('0x58')]);_0x217ecd({'count':_0x3cc368[_0xab28('0x18')],'rows':_0x3cc368});});}};var _0x30c881=jayson[_0xab28('0x59')](_0x5c9694)[_0xab28('0x5a')]();_0x30c881['on'](_0xab28('0x39'),function(_0x2a2014){logger['error'](JSON[_0xab28('0x34')](_0x2a2014));return _0x554954(_0x2a2014);});_0x30c881['listen'](0x232c,_0xab28('0x5b'),function(){console['log'](_0xab28('0x5c'),0x232c);return _0x19029e(_0xab28('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x7579=['loggedIn','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','TagId','%s:%s:%s','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','emit','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','waiting','mailQueues'];(function(_0x2f8da7,_0x351daa){var _0x5dba68=function(_0x6c7010){while(--_0x6c7010){_0x2f8da7['push'](_0x2f8da7['shift']());}};_0x5dba68(++_0x351daa);}(_0x7579,0x1e2));var _0x9757=function(_0x1e230c,_0x4f72f1){_0x1e230c=_0x1e230c-0x0;var _0x57327c=_0x7579[_0x1e230c];return _0x57327c;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var path=require(_0x9757('0x2'));var fs=require('fs');var jayson=require(_0x9757('0x3'));var BPromise=require(_0x9757('0x4'));var uuid=require(_0x9757('0x5'));var config=require('../../../config/environment');var logger=require(_0x9757('0x6'))(_0x9757('0x7'));var rpc={'openchannelQueueReport':require(_0x9757('0x8')),'mailQueueReport':require(_0x9757('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9757('0xa')),'faxQueueReport':require(_0x9757('0xb')),'whatsappQueueReport':require(_0x9757('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x28a14a,_0x51a1c8,_0x2d65dd){return util[_0x9757('0xd')](_0x9757('0xe'),_0x28a14a,_0x51a1c8||0x0,_0x2d65dd||0x0);}function getIntervals(_0x5b5749,_0x375d91){var _0x13f01a=[];if(!_[_0x9757('0xf')](_0x375d91[_0x9757('0x10')])&&!_[_0x9757('0xf')](_0x5b5749[_0x375d91[_0x9757('0x10')]])&&!_[_0x9757('0xf')](_0x5b5749[_0x375d91[_0x9757('0x10')]][_0x9757('0x11')])){_0x13f01a=_[_0x9757('0x12')](_0x5b5749[_0x375d91[_0x9757('0x10')]]['Intervals'],_0x9757('0x13'));}else if(!_[_0x9757('0xf')](_0x375d91[_0x9757('0x13')])){_0x13f01a=[_0x375d91['interval']];}return _0x13f01a;}exports[_0x9757('0x14')]=function(_0x39fa5c){_0x39fa5c[_0x9757('0x15')]={};return new BPromise(function(_0x14f67c,_0x224229){var _0x3abf05={'Start':function(_0x105e56){var _0x4b994d=this;return new Promise(function(_0x1fd6f6,_0x55ded7){if(_0x105e56){try{var _0x17ab45=[];var _0xcc8f94=getId(_0x105e56[_0x9757('0x16')],_0x105e56[_0x9757('0x17')]?_0x105e56[_0x9757('0x17')]['id']:0x0,_0x105e56[_0x9757('0x18')]?_0x105e56['interaction']['id']:0x0);if(_0x105e56[_0x9757('0x19')]&&_[_0x9757('0x1a')](_0x105e56[_0x9757('0x19')])&&_0x105e56[_0x9757('0x19')][_0x9757('0x1b')]){for(var _0xd2306b=0x0;_0xd2306b<_0x105e56[_0x9757('0x19')]['length'];_0xd2306b+=0x1){var _0x185506=_0x105e56['applications'][_0xd2306b];if(fs['existsSync'](path[_0x9757('0x1c')](__dirname,_0x9757('0x19'),_0x185506[_0x9757('0x1d')]+_0x9757('0x1e')))){var _0x559135=[];switch(_0x185506['app']['toLowerCase']()){case _0x9757('0x1f'):var _0x32054f=_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');if(_0x105e56['channel']===_0x9757('0x22')){_0x559135[_0x9757('0x23')](_0x32054f[0x0]);_0x559135['push'](_0x32054f[0x1]);_0x559135[_0x9757('0x23')](_0x32054f[_0x9757('0x24')](0x2,_0x32054f['length'])[_0x9757('0x1c')](','));}else{_0x559135[_0x9757('0x23')](_0x32054f[0x0]);_0x559135[_0x9757('0x23')](_0x32054f[_0x9757('0x24')](0x1,_0x32054f[_0x9757('0x1b')])[_0x9757('0x1c')](','));}break;case'dialogflow':var _0x2a9438=_0x185506['appdata'][_0x9757('0x21')](',');_0x559135[_0x9757('0x23')](_0x2a9438[0x0]);_0x559135['push'](_0x2a9438[0x1]);_0x559135['push'](_0x2a9438[_0x9757('0x24')](0x2,_0x2a9438[_0x9757('0x1b')])[_0x9757('0x1c')](','));break;case _0x9757('0x25'):var _0x4ebdb6=_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');_0x559135[_0x9757('0x23')](_0x4ebdb6[0x0]);_0x559135[_0x9757('0x23')](_0x4ebdb6[0x1]);_0x559135[_0x9757('0x23')](_0x4ebdb6[0x2]);_0x559135[_0x9757('0x23')](_0x4ebdb6[0x3]);_0x559135['push'](_0x4ebdb6[_0x9757('0x24')](0x4,_0x4ebdb6[_0x9757('0x1b')])[_0x9757('0x1c')](','));break;case _0x9757('0x26'):var _0x478199=_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');_0x559135['push'](_0x478199[0x0]);_0x559135[_0x9757('0x23')](_0x478199[0x1]);_0x559135[_0x9757('0x23')](_0x478199[0x2]);_0x559135[_0x9757('0x23')](_0x478199[0x3]);_0x559135[_0x9757('0x23')](_0x478199[_0x9757('0x24')](0x4,_0x478199[_0x9757('0x1b')])[_0x9757('0x1c')](','));break;case _0x9757('0x17'):_0x559135['push'](_0x185506[_0x9757('0x20')]);break;case'tag':_0x559135[_0x9757('0x23')](_0x185506[_0x9757('0x27')]);_0x559135['push'](_0x185506[_0x9757('0x20')]);break;default:_0x559135=_[_0x9757('0xf')](_0x185506[_0x9757('0x20')])?[]:_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');}var _0x2f2688={'id':util[_0x9757('0xd')](_0x9757('0x28'),_0xcc8f94,_0x185506['id'],_0x185506[_0x9757('0x1d')]),'condition':require(_0x9757('0x29'))['condition'](_0xcc8f94,getIntervals(_0x39fa5c[_0x9757('0x2a')],_0x185506),_0x39fa5c),'consequence':require(_0x9757('0x2b')+_0x185506[_0x9757('0x1d')])['consequence'](_0xcc8f94,_0x559135,_0x39fa5c,_0x105e56),'p':_0x185506[_0x9757('0x2c')]||0x0};logger[_0x9757('0x2d')](_0x9757('0x2e'),_0x2f2688['id'],_0x9757('0x2f'),getIntervals(_0x39fa5c[_0x9757('0x2a')],_0x185506)[_0x9757('0x1c')](_0x9757('0x30')));_0x17ab45[_0x9757('0x23')](_0x2f2688);}else{logger[_0x9757('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x9757('0x19'),_0x185506[_0x9757('0x1d')]+_0x9757('0x1e')));}}_0x39fa5c[_0x9757('0x15')][_0xcc8f94]=new RuleEngine(_0x17ab45);_0x39fa5c['rules'][_0xcc8f94][_0x9757('0x32')](_0x105e56,function(_0x4dfa93){logger[_0x9757('0x2d')](_0x9757('0x33'),JSON[_0x9757('0x34')](_0x4dfa93['matchPath']));if(_0x39fa5c[_0x9757('0x15')][_0xcc8f94]){_0x39fa5c[_0x9757('0x15')][_0xcc8f94][_0x9757('0x35')]('complete');}});return _0x1fd6f6({'code':0xc8,'message':_0x105e56});}else{logger[_0x9757('0x2d')]('No\x20applications\x20to\x20execute');return _0x1fd6f6({'code':0xc8,'message':_0x105e56});}}catch(_0x50f0e4){logger[_0x9757('0x31')](_0x50f0e4[_0x9757('0x36')]);return _0x55ded7(_0x4b994d[_0x9757('0x31')](0x1f4,_0x50f0e4));}}return _0x55ded7(_0x9757('0x37'));});},'AcceptMessage':function(_0xb90596){var _0x4f30db=this;return new Promise(function(_0x49429a,_0x4f1cdd){if(_0xb90596[_0x9757('0x38')]&&_0xb90596[_0x9757('0x38')]['id']){if(_0x39fa5c[_0x9757('0x39')][_0xb90596['agent']['id']]){_0x39fa5c[_0x9757('0x39')][_0xb90596[_0x9757('0x38')]['id']]['busy']=![];_0x39fa5c[_0x9757('0x39')][_0xb90596[_0x9757('0x38')]['id']][_0x9757('0x3a')]=undefined;}}if(_0xb90596[_0x9757('0x17')]&&_0xb90596['message']['id']){try{var _0xc312a8=getId(_0xb90596[_0x9757('0x16')],_0xb90596[_0x9757('0x17')]?_0xb90596[_0x9757('0x17')]['id']:0x0,_0xb90596[_0x9757('0x18')]?_0xb90596[_0x9757('0x18')]['id']:0x0);if(_0x39fa5c[_0x9757('0x15')][_0xc312a8]){_0x39fa5c[_0x9757('0x15')][_0xc312a8][_0x9757('0x35')]('end');if(rpc[_0xb90596['channel']+_0x9757('0x3b')]){rpc[_0xb90596[_0x9757('0x16')]+_0x9757('0x3b')]['update'](_0xc312a8,{'UserId':_0xb90596[_0x9757('0x17')][_0x9757('0x3c')]})[_0x9757('0x3d')](function(_0x59ae0e){logger[_0x9757('0x31')](_0x9757('0x3e'));});}}return _0x49429a({'code':0xc8,'message':_0xb90596});}catch(_0x497542){logger['error'](_0x497542['stack']);return _0x4f1cdd(_0x4f30db[_0x9757('0x31')](0x1f4,_0x497542));}}logger[_0x9757('0x31')](_0x9757('0x3f'));return _0x4f1cdd(_0x4f30db['error'](0x1f4,_0x9757('0x3f')));});},'RejectMessage':function(_0x5aaadf){var _0xf2f0dc=this;return new Promise(function(_0x173f0f,_0x5e4430){if(_0x5aaadf[_0x9757('0x38')]&&_0x5aaadf[_0x9757('0x38')]['id']){try{if(_0x39fa5c[_0x9757('0x39')][_0x5aaadf[_0x9757('0x38')]['id']]){_0x39fa5c[_0x9757('0x39')][_0x5aaadf['agent']['id']][_0x9757('0x40')]=![];_0x39fa5c[_0x9757('0x39')][_0x5aaadf[_0x9757('0x38')]['id']][_0x9757('0x3a')]=undefined;}return _0x173f0f({'code':0xc8,'message':_0x5aaadf});}catch(_0x3bff1d){logger[_0x9757('0x31')](_0x3bff1d[_0x9757('0x36')]);return _0x5e4430(_0xf2f0dc['error'](0x1f4,_0x3bff1d));}}logger['error'](_0x9757('0x3f'));return _0x5e4430(_0xf2f0dc['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x41419a){var _0x59fed4=this;return new Promise(function(_0x410177,_0x14c0c8){if(_0x41419a['channel']&&_0x41419a['interaction']&&_0x41419a[_0x9757('0x18')]['id']){try{var _0x502321=getId(_0x41419a[_0x9757('0x16')],_0x41419a['message']?_0x41419a[_0x9757('0x17')]['id']:0x0,_0x41419a['interaction']?_0x41419a[_0x9757('0x18')]['id']:0x0);if(_0x39fa5c[_0x9757('0x15')][_0x502321]){_0x39fa5c[_0x9757('0x15')][_0x502321][_0x9757('0x35')](_0x9757('0x41'));}return _0x410177({'code':0xc8,'message':_0x41419a});}catch(_0x25ae79){logger[_0x9757('0x31')](_0x25ae79[_0x9757('0x36')]);return _0x14c0c8(_0x59fed4['error'](0x1f4,_0x25ae79));}}logger[_0x9757('0x31')](_0x9757('0x3f'));return _0x14c0c8(_0x59fed4[_0x9757('0x31')](0x1f4,_0x9757('0x3f')));});},'AgentCapacity':function(_0x39ee2a){var _0x277948=this;return new Promise(function(_0x11bff1,_0x297e1b){if(_0x39fa5c[_0x9757('0x39')][_0x9757('0x42')](_0x39ee2a['id'])){for(var _0x1fa7df in _0x39ee2a[_0x9757('0x43')]){if(_0x39ee2a[_0x9757('0x43')]['hasOwnProperty'](_0x1fa7df)){if(_0x39fa5c['agents'][_0x39ee2a['id']][_0x9757('0x42')](_0x1fa7df+'CurrentCapacity')){_0x39fa5c[_0x9757('0x39')][_0x39ee2a['id']][_0x1fa7df+_0x9757('0x44')]=parseInt(_0x39ee2a[_0x9757('0x43')][_0x1fa7df],0xa);}}}_0x39fa5c['agents'][_0x39ee2a['id']][_0x9757('0x45')]();return _0x11bff1({'code':0xc8,'message':_0x39fa5c[_0x9757('0x39')][_0x39ee2a['id']]});}else{return _0x297e1b(_0x277948[_0x9757('0x31')](0x1f4,_0x9757('0x46')));}});},'Agents':function(_0x282d59){return new Promise(function(_0x333268,_0x2746f7){var _0x19ca63=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x39')]);_0x333268({'count':_0x19ca63[_0x9757('0x1b')],'rows':_0x19ca63});});},'ChatQueues':function(_0x496bae){return new Promise(function(_0x2aa462,_0x3bc9f5){var _0x3ccb1e=[];for(var _0x628036 in _0x39fa5c[_0x9757('0x48')]){if(_0x39fa5c[_0x9757('0x48')][_0x9757('0x42')](_0x628036)){var _0x518fd7=_0x39fa5c[_0x9757('0x48')][_0x628036];var _0xf2aa31={'id':_0x518fd7['id'],'available':_0x518fd7[_0x9757('0x49')],'loggedIn':_0x518fd7['loggedIn'],'name':_0x518fd7['name'],'paused':_0x518fd7['paused'],'waiting':_0x518fd7[_0x9757('0x4a')]};_0x3ccb1e[_0x9757('0x23')](_0xf2aa31);}}_0x2aa462({'count':_0x3ccb1e[_0x9757('0x1b')],'rows':_0x3ccb1e});});},'MailQueues':function(_0x4d7d40){return new Promise(function(_0x3eb0da,_0x5d5188){var _0xca6f89=[];for(var _0x48e505 in _0x39fa5c['mailQueues']){if(_0x39fa5c[_0x9757('0x4b')][_0x9757('0x42')](_0x48e505)){var _0xaf096e=_0x39fa5c['mailQueues'][_0x48e505];var _0xc706a={'id':_0xaf096e['id'],'available':_0xaf096e[_0x9757('0x49')],'loggedIn':_0xaf096e[_0x9757('0x4c')],'name':_0xaf096e[_0x9757('0x4d')],'paused':_0xaf096e[_0x9757('0x4e')],'waiting':_0xaf096e[_0x9757('0x4a')]};_0xca6f89[_0x9757('0x23')](_0xc706a);}}_0x3eb0da({'count':_0xca6f89[_0x9757('0x1b')],'rows':_0xca6f89});});},'OpenchannelQueues':function(_0x567b05){return new Promise(function(_0x4df00e,_0x5b6c80){var _0x5e014c=[];for(var _0x40333f in _0x39fa5c[_0x9757('0x4f')]){if(_0x39fa5c[_0x9757('0x4f')][_0x9757('0x42')](_0x40333f)){var _0x4c584e=_0x39fa5c['openchannelQueues'][_0x40333f];var _0x18fede={'id':_0x4c584e['id'],'available':_0x4c584e['available'],'loggedIn':_0x4c584e[_0x9757('0x4c')],'name':_0x4c584e[_0x9757('0x4d')],'paused':_0x4c584e[_0x9757('0x4e')],'waiting':_0x4c584e[_0x9757('0x4a')]};_0x5e014c[_0x9757('0x23')](_0x18fede);}}_0x4df00e({'count':_0x5e014c[_0x9757('0x1b')],'rows':_0x5e014c});});},'SmsQueues':function(_0x2c84b2){return new Promise(function(_0x161a21,_0x1aaf50){var _0x3d9930=[];for(var _0x3a5449 in _0x39fa5c[_0x9757('0x50')]){if(_0x39fa5c[_0x9757('0x50')][_0x9757('0x42')](_0x3a5449)){var _0x5a3cce=_0x39fa5c[_0x9757('0x50')][_0x3a5449];var _0x4587e5={'id':_0x5a3cce['id'],'available':_0x5a3cce[_0x9757('0x49')],'loggedIn':_0x5a3cce[_0x9757('0x4c')],'name':_0x5a3cce[_0x9757('0x4d')],'paused':_0x5a3cce[_0x9757('0x4e')],'waiting':_0x5a3cce[_0x9757('0x4a')]};_0x3d9930['push'](_0x4587e5);}}_0x161a21({'count':_0x3d9930[_0x9757('0x1b')],'rows':_0x3d9930});});},'FaxQueues':function(_0x299cea){return new Promise(function(_0x37fe52,_0x490ec5){var _0x52980a=[];for(var _0x28c10e in _0x39fa5c['faxQueues']){if(_0x39fa5c[_0x9757('0x51')][_0x9757('0x42')](_0x28c10e)){var _0x22ff21=_0x39fa5c['faxQueues'][_0x28c10e];var _0x18a919={'id':_0x22ff21['id'],'available':_0x22ff21[_0x9757('0x49')],'loggedIn':_0x22ff21[_0x9757('0x4c')],'name':_0x22ff21[_0x9757('0x4d')],'paused':_0x22ff21[_0x9757('0x4e')],'waiting':_0x22ff21[_0x9757('0x4a')]};_0x52980a[_0x9757('0x23')](_0x18a919);}}_0x37fe52({'count':_0x52980a[_0x9757('0x1b')],'rows':_0x52980a});});},'WhatsappQueues':function(_0x179350){return new Promise(function(_0x947ac4,_0x37e31f){var _0x24ef73=[];for(var _0x53cffa in _0x39fa5c['whatsappQueues']){if(_0x39fa5c[_0x9757('0x52')][_0x9757('0x42')](_0x53cffa)){var _0x4a2655=_0x39fa5c['whatsappQueues'][_0x53cffa];var _0x2e430e={'id':_0x4a2655['id'],'available':_0x4a2655['available'],'loggedIn':_0x4a2655['loggedIn'],'name':_0x4a2655[_0x9757('0x4d')],'paused':_0x4a2655[_0x9757('0x4e')],'waiting':_0x4a2655['waiting']};_0x24ef73['push'](_0x2e430e);}}_0x947ac4({'count':_0x24ef73[_0x9757('0x1b')],'rows':_0x24ef73});});},'ChatQueuesWaitingInteractions':function(_0x1b56f5){return new Promise(function(_0x4aaaee,_0xf7d8aa){var _0x2ef3d2=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x53')]);_0x4aaaee({'count':_0x2ef3d2['length'],'rows':_0x2ef3d2});});},'MailQueuesWaitingInteractions':function(_0x2d8a7d){return new Promise(function(_0x270b8e,_0x3b024c){var _0x55ebf5=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x54')]);_0x270b8e({'count':_0x55ebf5[_0x9757('0x1b')],'rows':_0x55ebf5});});},'OpenchannelQueuesWaitingInteractions':function(_0x57845e){return new Promise(function(_0x3fe6c7,_0x19203d){var _0x3adcf7=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x55')]);_0x3fe6c7({'count':_0x3adcf7['length'],'rows':_0x3adcf7});});},'SmsQueuesWaitingInteractions':function(_0x11d268){return new Promise(function(_0x3848e7,_0x354e2b){var _0x4390b8=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x56')]);_0x3848e7({'count':_0x4390b8[_0x9757('0x1b')],'rows':_0x4390b8});});},'FaxQueuesWaitingInteractions':function(_0x5460bd){return new Promise(function(_0x5739e9,_0x310e7a){var _0x48f208=_[_0x9757('0x47')](_0x39fa5c['faxQueuesWaitingInteractions']);_0x5739e9({'count':_0x48f208[_0x9757('0x1b')],'rows':_0x48f208});});},'WhatsappQueuesWaitingInteractions':function(_0x3bf395){return new Promise(function(_0x13977c,_0x48c90b){var _0x316385=_['values'](_0x39fa5c['whatsappQueuesWaitingInteractions']);_0x13977c({'count':_0x316385[_0x9757('0x1b')],'rows':_0x316385});});}};var _0x179f48=jayson[_0x9757('0x57')](_0x3abf05)[_0x9757('0x58')]();_0x179f48['on'](_0x9757('0x31'),function(_0x1572b2){logger[_0x9757('0x31')](JSON['stringify'](_0x1572b2));return _0x224229(_0x1572b2);});_0x179f48['listen'](0x232c,_0x9757('0x59'),function(){console[_0x9757('0x5a')](_0x9757('0x5b'),0x232c);return _0x14f67c(_0x9757('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index db476e3..3d56bd1 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 _0xac03=['stack','util','bluebird','jayson/promise','lodash','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xac03,0xe1));var _0x3ac0=function(_0x463e24,_0x4029b7){_0x463e24=_0x463e24-0x0;var _0x1d3304=_0xac03[_0x463e24];return _0x1d3304;};'use strict';var util=require(_0x3ac0('0x0'));var BPromise=require(_0x3ac0('0x1'));var jayson=require(_0x3ac0('0x2'));var _=require(_0x3ac0('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson[_0x3ac0('0x4')][_0x3ac0('0x5')]({'port':0x232a});function request(_0x4731a8,_0x8758b){return new BPromise(function(_0x2f50cc,_0x25ceb2){return client[_0x3ac0('0x6')](_0x4731a8,_0x8758b)[_0x3ac0('0x7')](function(_0x4fd69b){if(_0x4fd69b[_0x3ac0('0x8')]){return _0x25ceb2(_0x4fd69b[_0x3ac0('0x8')][_0x3ac0('0x9')]);}else{return _0x2f50cc(_0x4fd69b[_0x3ac0('0xa')]);}})[_0x3ac0('0xb')](function(_0x5c0167){return _0x25ceb2(_0x5c0167);});});}exports[_0x3ac0('0xc')]=function(_0x5997bd,_0x3533d7,_0xe280e8){return function(_0x20a10b){if(_0xe280e8[_0x3ac0('0xd')]&&!_0xe280e8[_0x3ac0('0xd')][_0x5997bd]){logger[_0x3ac0('0xe')](_0x3ac0('0xf'),_0x5997bd);return _0x20a10b[_0x3ac0('0x10')]();}var _0xe244e9=[];for(var _0x5b74e8=0x0;_0x5b74e8<_0x3533d7[_0x3ac0('0x11')];_0x5b74e8+=0x1){_0xe244e9[_0x3ac0('0x12')](request('Command',{'command':util[_0x3ac0('0x13')](_0x3ac0('0x14'),_0x3533d7[_0x5b74e8])})['then'](function(_0x125246){return _0x125246&&_0x125246[_0x3ac0('0x9')]&&_0x125246[_0x3ac0('0x9')][_0x3ac0('0x15')](_0x3ac0('0x16'))>=0x0?!![]:![];})[_0x3ac0('0xb')](function(_0x3ec99a){logger['error'](_0x3ac0('0x17'),_0x5997bd,_0x3533d7[_0x5b74e8]);}));}BPromise[_0x3ac0('0x18')](_0xe244e9)[_0x3ac0('0x7')](function(_0x37a256){var _0x2208bf=_[_0x3ac0('0x19')](_0x37a256);logger['info'](_0x3ac0('0x1a'),_0x5997bd,_0x3533d7[_0x3ac0('0x1b')](_0x3ac0('0x1c')),_0x2208bf);_0x20a10b[_0x3ac0('0x1d')](_0x2208bf);})['catch'](function(_0x186206){console[_0x3ac0('0x1e')](_0x186206);logger[_0x3ac0('0x8')](_0x3ac0('0x1a'),_0x5997bd,_0x3533d7[_0x3ac0('0x1b')](_0x3ac0('0x1c')),_0x186206[_0x3ac0('0x1f')]);_0x20a10b[_0x3ac0('0x10')]();});};}; \ No newline at end of file +var _0x149a=['error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','format','iftime\x20%s','then','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','lodash','../../../config/logger','routing','client','http','request'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x149a,0xb7));var _0xa149=function(_0x3c2b5d,_0x27a30c){_0x3c2b5d=_0x3c2b5d-0x0;var _0x52deda=_0x149a[_0x3c2b5d];return _0x52deda;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xa149('0x0'));var logger=require(_0xa149('0x1'))(_0xa149('0x2'));var client=jayson[_0xa149('0x3')][_0xa149('0x4')]({'port':0x232a});function request(_0x3484d4,_0x1f9758){return new BPromise(function(_0x45e94d,_0x9c96c9){return client[_0xa149('0x5')](_0x3484d4,_0x1f9758)['then'](function(_0x4a21cb){if(_0x4a21cb['error']){return _0x9c96c9(_0x4a21cb[_0xa149('0x6')][_0xa149('0x7')]);}else{return _0x45e94d(_0x4a21cb['result']);}})[_0xa149('0x8')](function(_0xc1d6de){return _0x9c96c9(_0xc1d6de);});});}exports['condition']=function(_0x3b281b,_0x608d16,_0x411a25){return function(_0x2501b0){if(_0x411a25[_0xa149('0x9')]&&!_0x411a25['rules'][_0x3b281b]){logger[_0xa149('0xa')](_0xa149('0xb'),_0x3b281b);return _0x2501b0['stop']();}var _0x1709fa=[];for(var _0x5e50f4=0x0;_0x5e50f4<_0x608d16['length'];_0x5e50f4+=0x1){_0x1709fa[_0xa149('0xc')](request('Command',{'command':util[_0xa149('0xd')](_0xa149('0xe'),_0x608d16[_0x5e50f4])})[_0xa149('0xf')](function(_0x2af045){return _0x2af045&&_0x2af045['message']&&_0x2af045['message'][_0xa149('0x10')](_0xa149('0x11'))>=0x0?!![]:![];})[_0xa149('0x8')](function(_0x2e4c96){logger[_0xa149('0x6')]('[%s][INTERVAL]\x20%s',_0x3b281b,_0x608d16[_0x5e50f4]);}));}BPromise[_0xa149('0x12')](_0x1709fa)['then'](function(_0x540b00){var _0x2d3343=_[_0xa149('0x13')](_0x540b00);logger[_0xa149('0xa')](_0xa149('0x14'),_0x3b281b,_0x608d16[_0xa149('0x15')](_0xa149('0x16')),_0x2d3343);_0x2501b0[_0xa149('0x17')](_0x2d3343);})[_0xa149('0x8')](function(_0xea81a2){console[_0xa149('0x18')](_0xea81a2);logger[_0xa149('0x6')](_0xa149('0x14'),_0x3b281b,_0x608d16['join'](_0xa149('0x16')),_0xea81a2[_0xa149('0x19')]);_0x2501b0[_0xa149('0x1a')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index ec43a10..ccab22a 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 _0x146f=['forIn','answered_elsewhere','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','extension','transferuniqueid','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','format','agentringnoanswerAt','lastevent','timeout','holdtime','ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','[%s][agents][agentconnect]','agentconnectAt'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x146f,0x164));var _0xf146=function(_0x4e21b8,_0x746758){_0x4e21b8=_0x4e21b8-0x0;var _0x18289c=_0x146f[_0x4e21b8];return _0x18289c;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf146('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x283857,_0x44134f){utils[_0xf146('0x1')](util['format'](_0xf146('0x2'),_0x283857['uniqueid'],_0x283857[_0xf146('0x3')],_0x283857['queue'],_0x283857[_0xf146('0x4')],_0x283857['interface'],_0x283857[_0xf146('0x5')],_0x283857[_0xf146('0x6')],_0x283857['lastevent']));if(_0x283857[_0xf146('0x7')]){utils[_0xf146('0x8')](_0x283857[_0xf146('0x7')])[_0xf146('0x9')](function(_0x995dd5){if(_0x995dd5){_0x283857[_0xf146('0xa')]=_0x995dd5[_0xf146('0xa')];_0x283857[_0xf146('0xb')]=_0x283857[_0xf146('0xc')]?_0x995dd5['acw']:![];_0x283857[_0xf146('0xd')]=_0x283857[_0xf146('0xb')]?_0x995dd5['acwTimeout']:0x0;}utils[_0xf146('0xe')]('CreateVoiceAgentReport',_0x283857);});}else{utils[_0xf146('0xe')](_0xf146('0xf'),_0x283857);}if(_0x44134f){delete transfers[_0x283857[_0xf146('0x10')]];}else{delete agents[_0x283857[_0xf146('0x11')]];}}exports[_0xf146('0x12')]=function(_0x5bfe96){try{utils[_0xf146('0x13')](util['format'](_0xf146('0x14'),_0x5bfe96[_0xf146('0x10')]),_0x5bfe96);agents[_0x5bfe96[_0xf146('0x11')]]=_0x5bfe96;agents[_0x5bfe96['destuniqueid']][_0xf146('0x15')]=utils[_0xf146('0x16')]();agents[_0x5bfe96['destuniqueid']]['lastevent']=_0xf146('0x17');agents[_0x5bfe96['destuniqueid']][_0xf146('0x6')]=null;agents[_0x5bfe96[_0xf146('0x11')]][_0xf146('0x18')]=null;utils[_0xf146('0x1')](util['format'](_0xf146('0x19'),_0x5bfe96[_0xf146('0x10')],agents[_0x5bfe96[_0xf146('0x11')]][_0xf146('0x4')],_0x5bfe96['destuniqueid']));}catch(_0x2815fa){utils[_0xf146('0x1a')](util['format'](_0xf146('0x14'),_0x5bfe96[_0xf146('0x10')]),_0x2815fa);}};exports[_0xf146('0x1b')]=function(_0xa0f9e5){try{if(!_[_0xf146('0x1c')](agents[_0xa0f9e5['destuniqueid']])){utils[_0xf146('0x13')](util[_0xf146('0x1d')]('[%s][agents][agentringnoanswer]',_0xa0f9e5[_0xf146('0x10')]),_0xa0f9e5);utils[_0xf146('0x1')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0xa0f9e5[_0xf146('0x10')],agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x4')],_0xa0f9e5[_0xf146('0x11')]));agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x1b')]=!![];agents[_0xa0f9e5['destuniqueid']][_0xf146('0x1e')]=utils[_0xf146('0x16')]();agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x1f')]=_0xf146('0x20');agents[_0xa0f9e5[_0xf146('0x11')]]['reason']=_0xf146('0x20');agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x21')]=_0xa0f9e5[_0xf146('0x22')]?parseInt(_0xa0f9e5[_0xf146('0x22')])/0x3e8:0x0;agents[_0xa0f9e5['destuniqueid']][_0xf146('0x23')]=0x0;unanswered['push'](_0xa0f9e5[_0xf146('0x11')]);}}catch(_0x88efbe){utils['error'](util[_0xf146('0x1d')](_0xf146('0x24'),_0xa0f9e5[_0xf146('0x10')]),_0x88efbe);}};exports[_0xf146('0x25')]=function(_0x29417e){try{_['forIn'](agents,function(_0x4e678f,_0x814671){if(_0x4e678f['uniqueid']==_0x29417e[_0xf146('0x10')]&&!_[_0xf146('0x26')](unanswered,_0x4e678f['destuniqueid'])){utils[_0xf146('0x13')](util[_0xf146('0x1d')](_0xf146('0x27'),_0x29417e[_0xf146('0x10')]),_0x29417e);utils['info'](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x29417e[_0xf146('0x10')],_0x4e678f['membername'],_0x4e678f['destuniqueid']));_0x4e678f[_0xf146('0x1b')]=!![];_0x4e678f[_0xf146('0x1e')]=utils['now']();_0x4e678f[_0xf146('0x1f')]=_0xf146('0x28');_0x4e678f[_0xf146('0x29')]=_0xf146('0x28');_0x4e678f[_0xf146('0x21')]=_0x29417e['holdtime'];_0x4e678f['talktime']=0x0;writeDB(_0x4e678f);}});}catch(_0x296775){utils[_0xf146('0x1a')](util['format'](_0xf146('0x27'),_0x29417e['uniqueid']),_0x296775);}};exports['agentconnect']=function(_0x27ceaa){try{if(agents[_0x27ceaa['destuniqueid']]){utils['debug'](util[_0xf146('0x1d')](_0xf146('0x2a'),_0x27ceaa[_0xf146('0x10')]),_0x27ceaa);utils['info'](util[_0xf146('0x1d')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x27ceaa[_0xf146('0x10')],agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x4')],_0x27ceaa[_0xf146('0x11')]));agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x2b')]=utils[_0xf146('0x16')]();agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x6')]=_0x27ceaa[_0xf146('0x6')];agents[_0x27ceaa['destuniqueid']][_0xf146('0x18')]=_0x27ceaa['connectedlinename'];agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x21')]=_0x27ceaa[_0xf146('0x22')];agents[_0x27ceaa['destuniqueid']][_0xf146('0x1f')]='connect';_[_0xf146('0x2c')](agents,function(_0x263ba3,_0x4b98da){if(_0x263ba3[_0xf146('0x11')]!=_0x27ceaa[_0xf146('0x11')]&&_0x263ba3[_0xf146('0x10')]==_0x27ceaa[_0xf146('0x10')]){_0x263ba3[_0xf146('0x23')]=0x0;_0x263ba3[_0xf146('0x21')]=_0x27ceaa[_0xf146('0x22')];_0x263ba3[_0xf146('0x1b')]=!![];_0x263ba3[_0xf146('0x1e')]=utils[_0xf146('0x16')]();_0x263ba3['lastevent']=_0xf146('0x2d');_0x263ba3['reason']=_0xf146('0x2d');_0x263ba3['answeredelsewheredestinationuniqueid']=_0x27ceaa[_0xf146('0x11')];_0x263ba3['answeredelsewheremembername']=_0x27ceaa[_0xf146('0x4')];writeDB(_0x263ba3);}});}}catch(_0x4c16b7){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x2a'),_0x27ceaa[_0xf146('0x10')]),_0x4c16b7);}};exports[_0xf146('0xc')]=function(_0x3e7a94){try{if(!_[_0xf146('0x1c')](agents[_0x3e7a94[_0xf146('0x11')]])){utils[_0xf146('0x13')](util[_0xf146('0x1d')](_0xf146('0x2e'),_0x3e7a94[_0xf146('0x10')]),_0x3e7a94);utils['info'](util[_0xf146('0x1d')](_0xf146('0x2f'),_0x3e7a94[_0xf146('0x10')],agents[_0x3e7a94['destuniqueid']][_0xf146('0x4')],_0x3e7a94[_0xf146('0x11')]));agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0xc')]=!![];agents[_0x3e7a94['destuniqueid']][_0xf146('0x30')]=utils[_0xf146('0x16')]();agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x23')]=utils[_0xf146('0x31')](agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x30')],agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x2b')]);agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x29')]=_0x3e7a94[_0xf146('0x29')];agents[_0x3e7a94['destuniqueid']][_0xf146('0x1f')]=_0xf146('0x32');writeDB(agents[_0x3e7a94['destuniqueid']]);}}catch(_0x1baf0f){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x2e'),_0x3e7a94['uniqueid']),_0x1baf0f);}};exports[_0xf146('0x33')]=function(_0x4b67f2){try{if(!_[_0xf146('0x1c')](agents[_0x4b67f2[_0xf146('0x34')]])){utils[_0xf146('0x13')](util[_0xf146('0x1d')](_0xf146('0x35'),_0x4b67f2[_0xf146('0x10')]),_0x4b67f2);utils[_0xf146('0x1')](util['format'](_0xf146('0x36'),_0x4b67f2[_0xf146('0x10')],agents[_0x4b67f2[_0xf146('0x34')]][_0xf146('0x4')],agents[_0x4b67f2[_0xf146('0x34')]]['uniqueid']));agents[_0x4b67f2[_0xf146('0x34')]][_0xf146('0x37')]=!![];agents[_0x4b67f2[_0xf146('0x34')]]['transfertype']=_0xf146('0x38');agents[_0x4b67f2[_0xf146('0x34')]]['transferexten']=_0x4b67f2[_0xf146('0x39')];agents[_0x4b67f2['transfereruniqueid']][_0xf146('0x3a')]=agents[_0x4b67f2[_0xf146('0x34')]][_0xf146('0x10')];}}catch(_0x28ba38){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x35'),_0x4b67f2[_0xf146('0x10')]),_0x28ba38);}};exports['attendedtransfer']=function(_0x5d1f8a){try{utils['debug'](util[_0xf146('0x1d')]('[%s][agents][attendedtransfer]',_0x5d1f8a['origtransfereruniqueid']),_0x5d1f8a);if(_0x5d1f8a[_0xf146('0x3b')]==_0x5d1f8a['origtransfererlinkedid']){if(!_[_0xf146('0x1c')](agents[_0x5d1f8a[_0xf146('0x3c')]])){utils['info'](util[_0xf146('0x1d')](_0xf146('0x3d'),_0x5d1f8a[_0xf146('0x3b')],agents[_0x5d1f8a['secondtransfereruniqueid']][_0xf146('0x4')]));agents[_0x5d1f8a['secondtransfereruniqueid']][_0xf146('0x37')]=!![];agents[_0x5d1f8a[_0xf146('0x3c')]][_0xf146('0x3e')]=_0xf146('0x3f');agents[_0x5d1f8a[_0xf146('0x3c')]][_0xf146('0x40')]=_0x5d1f8a[_0xf146('0x41')];agents[_0x5d1f8a[_0xf146('0x3c')]]['transferuniqueid']=_0x5d1f8a[_0xf146('0x3b')];}if(_0x5d1f8a[_0xf146('0x42')]&&agents[_0x5d1f8a[_0xf146('0x42')]]){agents[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x43')]=0x1;transfers[_0x5d1f8a[_0xf146('0x42')]]=_[_0xf146('0x44')](agents[_0x5d1f8a[_0xf146('0x42')]]);transfers[_0x5d1f8a['transfereeuniqueid']][_0xf146('0x5')]=agents[_0x5d1f8a['secondtransfereruniqueid']][_0xf146('0x5')];transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x45')]=agents[_0x5d1f8a[_0xf146('0x3c')]]['calleridname'];transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x15')]=utils['now']();transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x2b')]=utils[_0xf146('0x16')]();transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x21')]=0x0;transfers[_0x5d1f8a['transfereeuniqueid']][_0xf146('0x43')]=0x2;}}else if(_0x5d1f8a[_0xf146('0x3c')]==_0x5d1f8a['secondtransfererlinkedid']){if(!_[_0xf146('0x1c')](agents[_0x5d1f8a[_0xf146('0x3b')]])){utils[_0xf146('0x1')](util['format'](_0xf146('0x3d'),_0x5d1f8a[_0xf146('0x3b')],agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x4')]));agents[_0x5d1f8a[_0xf146('0x3b')]]['transfer']=!![];agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x3e')]=_0xf146('0x3f');agents[_0x5d1f8a[_0xf146('0x3b')]]['transferexten']=_0x5d1f8a['secondtransfererexten'];agents[_0x5d1f8a['origtransfereruniqueid']][_0xf146('0x3a')]=_0x5d1f8a['secondtransfereruniqueid'];}if(_0x5d1f8a['transfertargetuniqueid']&&agents[_0x5d1f8a[_0xf146('0x46')]]){agents[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x43')]=0x1;transfers[_0x5d1f8a[_0xf146('0x46')]]=_[_0xf146('0x44')](agents[_0x5d1f8a[_0xf146('0x46')]]);transfers[_0x5d1f8a[_0xf146('0x46')]]['calleridnum']=agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x5')];transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x45')]=agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x45')];transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x15')]=utils[_0xf146('0x16')]();transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x2b')]=utils[_0xf146('0x16')]();transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x21')]=0x0;transfers[_0x5d1f8a[_0xf146('0x46')]]['agententerreason']=0x2;}}}catch(_0x3d8428){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x47'),_0x5d1f8a['origtransfereruniqueid']),_0x3d8428);}};exports[_0xf146('0x48')]=function(_0x2fe0f4){try{utils['debug'](util[_0xf146('0x1d')](_0xf146('0x49'),_0x2fe0f4[_0xf146('0x10')]),_0x2fe0f4);if(agents[_0x2fe0f4[_0xf146('0x10')]]&&agents[_0x2fe0f4['uniqueid']][_0xf146('0x29')]===_0xf146('0x20')){if(_0x2fe0f4[_0xf146('0x4a')]==='21'){agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')]=_0xf146('0x4b');agents[_0x2fe0f4['uniqueid']][_0xf146('0x1f')]=_0xf146('0x4b');}utils[_0xf146('0x1')](util[_0xf146('0x1d')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2fe0f4[_0xf146('0x10')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x4')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')],agents[_0x2fe0f4['uniqueid']][_0xf146('0x1f')]));writeDB(agents[_0x2fe0f4[_0xf146('0x10')]]);var _0x400a8f=unanswered[_0xf146('0x4c')](_0x2fe0f4['uniqueid']);if(_0x400a8f>-0x1){unanswered[_0xf146('0x4d')](_0x400a8f,0x1);}}if(transfers[_0x2fe0f4[_0xf146('0x10')]]){transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0xc')]=!![];transfers[_0x2fe0f4['uniqueid']][_0xf146('0x30')]=utils['now']();transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x23')]=utils[_0xf146('0x31')](transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x30')],transfers[_0x2fe0f4['uniqueid']]['agentconnectAt']);transfers[_0x2fe0f4[_0xf146('0x10')]]['reason']=_0xf146('0x4e');transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x1f')]=_0xf146('0x32');utils[_0xf146('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2fe0f4[_0xf146('0x10')],transfers[_0x2fe0f4['uniqueid']][_0xf146('0x4')],transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')],transfers[_0x2fe0f4['uniqueid']][_0xf146('0x1f')]));writeDB(transfers[_0x2fe0f4[_0xf146('0x10')]],!![]);}if(agents[_0x2fe0f4['uniqueid']]&&agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x2b')]){agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0xc')]=!![];agents[_0x2fe0f4[_0xf146('0x10')]]['agentcompleteAt']=utils[_0xf146('0x16')]();agents[_0x2fe0f4[_0xf146('0x10')]]['talktime']=utils[_0xf146('0x31')](agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x30')],agents[_0x2fe0f4['uniqueid']][_0xf146('0x2b')]);agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')]=agents[_0x2fe0f4[_0xf146('0x10')]]['transfer']?_0xf146('0x37'):'agent';agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x1f')]=_0xf146('0x32');utils['info'](util['format'](_0xf146('0x4f'),_0x2fe0f4[_0xf146('0x10')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x4')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x1f')]));writeDB(agents[_0x2fe0f4[_0xf146('0x10')]]);}}catch(_0x2c99ea){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x49'),_0x2fe0f4[_0xf146('0x10')]),_0x2c99ea);}}; \ No newline at end of file +var _0x9480=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x230513,_0x3c7ea1){var _0x316f48=function(_0x5e8dcc){while(--_0x5e8dcc){_0x230513['push'](_0x230513['shift']());}};_0x316f48(++_0x3c7ea1);}(_0x9480,0xc6));var _0x0948=function(_0x5613de,_0x479c93){_0x5613de=_0x5613de-0x0;var _0x5b40cb=_0x9480[_0x5613de];return _0x5b40cb;};'use strict';var _=require(_0x0948('0x0'));var util=require('util');var utils=require(_0x0948('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f39ab,_0x273326){utils[_0x0948('0x2')](util['format'](_0x0948('0x3'),_0x5f39ab['uniqueid'],_0x5f39ab[_0x0948('0x4')],_0x5f39ab[_0x0948('0x5')],_0x5f39ab[_0x0948('0x6')],_0x5f39ab[_0x0948('0x7')],_0x5f39ab['calleridnum'],_0x5f39ab[_0x0948('0x8')],_0x5f39ab['lastevent']));if(_0x5f39ab['queue']){utils[_0x0948('0x9')](_0x5f39ab['queue'])['then'](function(_0x17a62c){if(_0x17a62c){_0x5f39ab[_0x0948('0xa')]=_0x17a62c[_0x0948('0xa')];_0x5f39ab[_0x0948('0xb')]=_0x5f39ab[_0x0948('0xc')]?_0x17a62c['acw']:![];_0x5f39ab[_0x0948('0xd')]=_0x5f39ab['agentacw']?_0x17a62c[_0x0948('0xe')]:0x0;}utils[_0x0948('0xf')](_0x0948('0x10'),_0x5f39ab);});}else{utils[_0x0948('0xf')](_0x0948('0x10'),_0x5f39ab);}if(_0x273326){delete transfers[_0x5f39ab[_0x0948('0x11')]];}else{delete agents[_0x5f39ab[_0x0948('0x12')]];}}exports[_0x0948('0x13')]=function(_0x264d0f){try{utils[_0x0948('0x14')](util[_0x0948('0x15')](_0x0948('0x16'),_0x264d0f[_0x0948('0x11')]),_0x264d0f);agents[_0x264d0f[_0x0948('0x12')]]=_0x264d0f;agents[_0x264d0f[_0x0948('0x12')]][_0x0948('0x17')]=utils[_0x0948('0x18')]();agents[_0x264d0f['destuniqueid']][_0x0948('0x19')]='called';agents[_0x264d0f['destuniqueid']][_0x0948('0x8')]=null;agents[_0x264d0f['destuniqueid']][_0x0948('0x1a')]=null;utils['info'](util[_0x0948('0x15')](_0x0948('0x1b'),_0x264d0f[_0x0948('0x11')],agents[_0x264d0f[_0x0948('0x12')]][_0x0948('0x6')],_0x264d0f[_0x0948('0x12')]));}catch(_0x5b74c8){utils['error'](util['format'](_0x0948('0x16'),_0x264d0f['uniqueid']),_0x5b74c8);}};exports[_0x0948('0x1c')]=function(_0x3a2666){try{if(!_['isNil'](agents[_0x3a2666[_0x0948('0x12')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x3a2666[_0x0948('0x11')]),_0x3a2666);utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x1d'),_0x3a2666['uniqueid'],agents[_0x3a2666[_0x0948('0x12')]]['membername'],_0x3a2666[_0x0948('0x12')]));agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x1c')]=!![];agents[_0x3a2666[_0x0948('0x12')]]['agentringnoanswerAt']=utils['now']();agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x19')]=_0x0948('0x1e');agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x1f')]=_0x0948('0x1e');agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x20')]=_0x3a2666[_0x0948('0x21')]?parseInt(_0x3a2666[_0x0948('0x21')])/0x3e8:0x0;agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x22')]=0x0;unanswered[_0x0948('0x23')](_0x3a2666[_0x0948('0x12')]);}}catch(_0x3e569b){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x25'),_0x3a2666[_0x0948('0x11')]),_0x3e569b);}};exports[_0x0948('0x26')]=function(_0x2c1385){try{_[_0x0948('0x27')](agents,function(_0x4f2067,_0x52527d){if(_0x4f2067[_0x0948('0x11')]==_0x2c1385['uniqueid']&&!_['includes'](unanswered,_0x4f2067[_0x0948('0x12')])){utils[_0x0948('0x14')](util[_0x0948('0x15')](_0x0948('0x28'),_0x2c1385['uniqueid']),_0x2c1385);utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x29'),_0x2c1385[_0x0948('0x11')],_0x4f2067['membername'],_0x4f2067[_0x0948('0x12')]));_0x4f2067[_0x0948('0x1c')]=!![];_0x4f2067[_0x0948('0x2a')]=utils[_0x0948('0x18')]();_0x4f2067[_0x0948('0x19')]=_0x0948('0x2b');_0x4f2067[_0x0948('0x1f')]=_0x0948('0x2b');_0x4f2067[_0x0948('0x20')]=_0x2c1385[_0x0948('0x20')];_0x4f2067[_0x0948('0x22')]=0x0;writeDB(_0x4f2067);}});}catch(_0x202c70){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x28'),_0x2c1385[_0x0948('0x11')]),_0x202c70);}};exports['agentconnect']=function(_0x2cd787){try{if(agents[_0x2cd787['destuniqueid']]){utils[_0x0948('0x14')](util[_0x0948('0x15')]('[%s][agents][agentconnect]',_0x2cd787[_0x0948('0x11')]),_0x2cd787);utils[_0x0948('0x2')](util[_0x0948('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2cd787['uniqueid'],agents[_0x2cd787[_0x0948('0x12')]]['membername'],_0x2cd787[_0x0948('0x12')]));agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x2c')]=utils['now']();agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x8')]=_0x2cd787[_0x0948('0x8')];agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x1a')]=_0x2cd787[_0x0948('0x1a')];agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x20')]=_0x2cd787[_0x0948('0x21')];agents[_0x2cd787['destuniqueid']][_0x0948('0x19')]=_0x0948('0x2d');_[_0x0948('0x27')](agents,function(_0x157b46,_0x5514c8){if(_0x157b46[_0x0948('0x12')]!=_0x2cd787[_0x0948('0x12')]&&_0x157b46[_0x0948('0x11')]==_0x2cd787[_0x0948('0x11')]){_0x157b46[_0x0948('0x22')]=0x0;_0x157b46[_0x0948('0x20')]=_0x2cd787[_0x0948('0x21')];_0x157b46['agentringnoanswer']=!![];_0x157b46[_0x0948('0x2a')]=utils[_0x0948('0x18')]();_0x157b46['lastevent']=_0x0948('0x2e');_0x157b46[_0x0948('0x1f')]='answered_elsewhere';_0x157b46[_0x0948('0x2f')]=_0x2cd787[_0x0948('0x12')];_0x157b46[_0x0948('0x30')]=_0x2cd787[_0x0948('0x6')];writeDB(_0x157b46);}});}}catch(_0x23ee32){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x31'),_0x2cd787[_0x0948('0x11')]),_0x23ee32);}};exports[_0x0948('0xc')]=function(_0x748f4c){try{if(!_[_0x0948('0x32')](agents[_0x748f4c['destuniqueid']])){utils['debug'](util['format'](_0x0948('0x33'),_0x748f4c['uniqueid']),_0x748f4c);utils['info'](util[_0x0948('0x15')](_0x0948('0x34'),_0x748f4c[_0x0948('0x11')],agents[_0x748f4c[_0x0948('0x12')]]['membername'],_0x748f4c[_0x0948('0x12')]));agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0xc')]=!![];agents[_0x748f4c['destuniqueid']][_0x0948('0x35')]=utils['now']();agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x22')]=utils[_0x0948('0x36')](agents[_0x748f4c['destuniqueid']][_0x0948('0x35')],agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x2c')]);agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x1f')]=_0x748f4c[_0x0948('0x1f')];agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x19')]=_0x0948('0x37');writeDB(agents[_0x748f4c['destuniqueid']]);}}catch(_0x10056c){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x33'),_0x748f4c['uniqueid']),_0x10056c);}};exports[_0x0948('0x38')]=function(_0x3a3f5c){try{if(!_[_0x0948('0x32')](agents[_0x3a3f5c[_0x0948('0x39')]])){utils['debug'](util[_0x0948('0x15')](_0x0948('0x3a'),_0x3a3f5c[_0x0948('0x11')]),_0x3a3f5c);utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x3b'),_0x3a3f5c[_0x0948('0x11')],agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x6')],agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x11')]));agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x3c')]=!![];agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x3d')]=_0x0948('0x3e');agents[_0x3a3f5c['transfereruniqueid']][_0x0948('0x3f')]=_0x3a3f5c[_0x0948('0x40')];agents[_0x3a3f5c['transfereruniqueid']][_0x0948('0x41')]=agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x11')];}}catch(_0x2ee3f0){utils['error'](util[_0x0948('0x15')](_0x0948('0x3a'),_0x3a3f5c[_0x0948('0x11')]),_0x2ee3f0);}};exports['attendedtransfer']=function(_0x9963fb){try{utils[_0x0948('0x14')](util[_0x0948('0x15')](_0x0948('0x42'),_0x9963fb[_0x0948('0x43')]),_0x9963fb);if(_0x9963fb[_0x0948('0x43')]==_0x9963fb[_0x0948('0x44')]){if(!_[_0x0948('0x32')](agents[_0x9963fb[_0x0948('0x45')]])){utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x46'),_0x9963fb[_0x0948('0x43')],agents[_0x9963fb['secondtransfereruniqueid']][_0x0948('0x6')]));agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x3c')]=!![];agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x3d')]=_0x0948('0x47');agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x3f')]=_0x9963fb[_0x0948('0x48')];agents[_0x9963fb[_0x0948('0x45')]]['transferuniqueid']=_0x9963fb['origtransfereruniqueid'];}if(_0x9963fb[_0x0948('0x49')]&&agents[_0x9963fb[_0x0948('0x49')]]){agents[_0x9963fb[_0x0948('0x49')]][_0x0948('0x4a')]=0x1;transfers[_0x9963fb[_0x0948('0x49')]]=_[_0x0948('0x4b')](agents[_0x9963fb[_0x0948('0x49')]]);transfers[_0x9963fb[_0x0948('0x49')]][_0x0948('0x4c')]=agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x4c')];transfers[_0x9963fb[_0x0948('0x49')]][_0x0948('0x4d')]=agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x4d')];transfers[_0x9963fb[_0x0948('0x49')]][_0x0948('0x17')]=utils['now']();transfers[_0x9963fb[_0x0948('0x49')]]['agentconnectAt']=utils['now']();transfers[_0x9963fb[_0x0948('0x49')]]['holdtime']=0x0;transfers[_0x9963fb[_0x0948('0x49')]]['agententerreason']=0x2;}}else if(_0x9963fb[_0x0948('0x45')]==_0x9963fb[_0x0948('0x4e')]){if(!_[_0x0948('0x32')](agents[_0x9963fb[_0x0948('0x43')]])){utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x46'),_0x9963fb['origtransfereruniqueid'],agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x6')]));agents[_0x9963fb['origtransfereruniqueid']][_0x0948('0x3c')]=!![];agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x3d')]=_0x0948('0x47');agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x3f')]=_0x9963fb[_0x0948('0x4f')];agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x41')]=_0x9963fb[_0x0948('0x45')];}if(_0x9963fb['transfertargetuniqueid']&&agents[_0x9963fb['transfertargetuniqueid']]){agents[_0x9963fb[_0x0948('0x50')]][_0x0948('0x4a')]=0x1;transfers[_0x9963fb[_0x0948('0x50')]]=_['clone'](agents[_0x9963fb[_0x0948('0x50')]]);transfers[_0x9963fb[_0x0948('0x50')]][_0x0948('0x4c')]=agents[_0x9963fb[_0x0948('0x43')]]['calleridnum'];transfers[_0x9963fb['transfertargetuniqueid']]['calleridname']=agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x4d')];transfers[_0x9963fb[_0x0948('0x50')]]['agentcalledAt']=utils['now']();transfers[_0x9963fb['transfertargetuniqueid']][_0x0948('0x2c')]=utils[_0x0948('0x18')]();transfers[_0x9963fb[_0x0948('0x50')]][_0x0948('0x20')]=0x0;transfers[_0x9963fb[_0x0948('0x50')]]['agententerreason']=0x2;}}}catch(_0x39cb18){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x42'),_0x9963fb['origtransfereruniqueid']),_0x39cb18);}};exports[_0x0948('0x51')]=function(_0x1ee102){try{utils[_0x0948('0x14')](util['format'](_0x0948('0x52'),_0x1ee102[_0x0948('0x11')]),_0x1ee102);if(agents[_0x1ee102['uniqueid']]&&agents[_0x1ee102[_0x0948('0x11')]]['reason']===_0x0948('0x1e')){if(_0x1ee102[_0x0948('0x53')]==='21'){agents[_0x1ee102[_0x0948('0x11')]]['reason']=_0x0948('0x54');agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]=_0x0948('0x54');}utils[_0x0948('0x2')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1ee102[_0x0948('0x11')],agents[_0x1ee102['uniqueid']][_0x0948('0x6')],agents[_0x1ee102[_0x0948('0x11')]]['reason'],agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]));writeDB(agents[_0x1ee102[_0x0948('0x11')]]);var _0x4ca29=unanswered[_0x0948('0x55')](_0x1ee102[_0x0948('0x11')]);if(_0x4ca29>-0x1){unanswered[_0x0948('0x56')](_0x4ca29,0x1);}}if(transfers[_0x1ee102[_0x0948('0x11')]]){transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0xc')]=!![];transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')]=utils[_0x0948('0x18')]();transfers[_0x1ee102['uniqueid']][_0x0948('0x22')]=utils[_0x0948('0x36')](transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')],transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x2c')]);transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x1f')]=_0x0948('0x57');transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]=_0x0948('0x37');utils[_0x0948('0x2')](util['format'](_0x0948('0x58'),_0x1ee102[_0x0948('0x11')],transfers[_0x1ee102['uniqueid']][_0x0948('0x6')],transfers[_0x1ee102[_0x0948('0x11')]]['reason'],transfers[_0x1ee102[_0x0948('0x11')]]['lastevent']));writeDB(transfers[_0x1ee102[_0x0948('0x11')]],!![]);}if(agents[_0x1ee102[_0x0948('0x11')]]&&agents[_0x1ee102['uniqueid']][_0x0948('0x2c')]){agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0xc')]=!![];agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')]=utils[_0x0948('0x18')]();agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x22')]=utils[_0x0948('0x36')](agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')],agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x2c')]);agents[_0x1ee102['uniqueid']][_0x0948('0x1f')]=agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x3c')]?_0x0948('0x3c'):_0x0948('0x57');agents[_0x1ee102['uniqueid']]['lastevent']=_0x0948('0x37');utils[_0x0948('0x2')](util[_0x0948('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1ee102[_0x0948('0x11')],agents[_0x1ee102[_0x0948('0x11')]]['membername'],agents[_0x1ee102[_0x0948('0x11')]]['reason'],agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]));writeDB(agents[_0x1ee102[_0x0948('0x11')]]);}}catch(_0x5933d9){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x52'),_0x1ee102['uniqueid']),_0x5933d9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e942330..6965340 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 _0xb466=['[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','noop','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','channelstate'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xb466,0x10f));var _0x6b46=function(_0x3f7645,_0x5f2de7){_0x3f7645=_0x3f7645-0x0;var _0x59c5f8=_0xb466[_0x3f7645];return _0x59c5f8;};'use strict';var _=require(_0x6b46('0x0'));var util=require(_0x6b46('0x1'));var utils=require(_0x6b46('0x2'));var dispositions=[_0x6b46('0x3'),_0x6b46('0x4'),_0x6b46('0x4'),_0x6b46('0x3'),_0x6b46('0x3'),'NO\x20ANSWER',_0x6b46('0x5'),_0x6b46('0x6'),_0x6b46('0x4'),_0x6b46('0x4'),_0x6b46('0x4')];var channels={};function writeDB(_0x14a2b5){utils[_0x6b46('0x7')](util[_0x6b46('0x8')](_0x6b46('0x9'),_0x14a2b5[_0x6b46('0xa')],_0x14a2b5[_0x6b46('0xb')],_0x14a2b5[_0x6b46('0xc')],_0x14a2b5[_0x6b46('0xd')],_0x14a2b5[_0x6b46('0xe')],_0x14a2b5['calleridnum'],_0x14a2b5['connectedlinenum'],_0x14a2b5[_0x6b46('0xf')]));if(_0x14a2b5['accountcode']){utils[_0x6b46('0x10')](_0x14a2b5[_0x6b46('0x11')])[_0x6b46('0x12')](function(_0x2722ac){if(_0x2722ac){_0x14a2b5['UserId']=_0x2722ac['id'];}utils[_0x6b46('0x13')](_0x6b46('0x14'),_0x14a2b5);});}else{utils[_0x6b46('0x13')](_0x6b46('0x14'),_0x14a2b5);}if(channels[_0x14a2b5[_0x6b46('0xa')]]){delete channels[_0x14a2b5[_0x6b46('0xa')]];}}exports[_0x6b46('0x15')]=function(_0x3f0c1e){try{utils['debug'](util[_0x6b46('0x8')]('[%s][calls][newchannel]',_0x3f0c1e[_0x6b46('0xa')]),_0x3f0c1e);if(_0x3f0c1e[_0x6b46('0xa')]==_0x3f0c1e['linkedid']&&_0x3f0c1e['channel']!=_0x6b46('0x16')){utils[_0x6b46('0x7')](util[_0x6b46('0x8')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3f0c1e[_0x6b46('0xa')],_0x3f0c1e['context'],_0x3f0c1e['exten']));channels[_0x3f0c1e['uniqueid']]={'uniqueid':_0x3f0c1e[_0x6b46('0xa')],'accountcode':_0x3f0c1e[_0x6b46('0x11')],'source':_0x3f0c1e[_0x6b46('0x17')],'destination':_0x3f0c1e[_0x6b46('0x18')],'destinationcontext':_0x3f0c1e[_0x6b46('0x19')],'channel':_0x3f0c1e[_0x6b46('0xb')],'starttime':utils[_0x6b46('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6b46('0x3'),'amaflags':_0x6b46('0x1b')};}}catch(_0x1437dc){utils[_0x6b46('0x1c')](util['format'](_0x6b46('0x1d'),_0x3f0c1e[_0x6b46('0xa')]),_0x1437dc);}};exports[_0x6b46('0x1e')]=function(_0x291797){try{utils[_0x6b46('0x1f')](util[_0x6b46('0x8')](_0x6b46('0x20'),_0x291797[_0x6b46('0xa')]),_0x291797);if(!_[_0x6b46('0x21')](channels[_0x291797['uniqueid']])&&_0x291797[_0x6b46('0x22')]==0x6){utils[_0x6b46('0x7')](util[_0x6b46('0x8')](_0x6b46('0x23'),_0x291797[_0x6b46('0xa')],_0x291797[_0x6b46('0x19')],_0x291797[_0x6b46('0xb')]));if(_[_0x6b46('0x21')](channels[_0x291797[_0x6b46('0xa')]]['systemanswertime'])){channels[_0x291797[_0x6b46('0xa')]][_0x6b46('0x24')]=utils[_0x6b46('0x1a')]();}}else if(!_[_0x6b46('0x21')](channels[_0x291797['linkedid']])&&_0x291797[_0x6b46('0x22')]==0x6&&_0x291797[_0x6b46('0x19')]!='transfer'){utils[_0x6b46('0x7')](util[_0x6b46('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x291797[_0x6b46('0xa')],_0x291797['linkedid'],_0x291797['context'],_0x291797['channel']));channels[_0x291797[_0x6b46('0x25')]][_0x6b46('0x11')]=_0x291797[_0x6b46('0x11')];channels[_0x291797[_0x6b46('0x25')]][_0x6b46('0x26')]=_0x291797[_0x6b46('0xb')];if(_[_0x6b46('0x21')](channels[_0x291797['linkedid']][_0x6b46('0x27')])){channels[_0x291797['linkedid']][_0x6b46('0x27')]=utils[_0x6b46('0x1a')]();}channels[_0x291797[_0x6b46('0x25')]][_0x6b46('0x28')]=dispositions[_['toNumber'](_0x291797['channelstate'])]||'ANSWERED';}}catch(_0x68ad4a){utils[_0x6b46('0x1c')](util[_0x6b46('0x8')](_0x6b46('0x20'),_0x291797['uniqueid']),_0x68ad4a);}};exports[_0x6b46('0x29')]=function(_0x244005){try{if(!_['isNil'](channels[_0x244005[_0x6b46('0xa')]])){utils[_0x6b46('0x1f')](util['format'](_0x6b46('0x2a'),_0x244005[_0x6b46('0xa')]),_0x244005);if(_[_0x6b46('0x21')](channels[_0x244005['uniqueid']][_0x6b46('0x2b')])){channels[_0x244005['uniqueid']][_0x6b46('0x2b')]=_0x244005[_0x6b46('0x2c')]+'\x20<'+_0x244005[_0x6b46('0x17')]+'>';}utils[_0x6b46('0x7')](util[_0x6b46('0x8')](_0x6b46('0x2d'),_0x244005[_0x6b46('0xa')],channels[_0x244005['uniqueid']]['callerid'],_0x244005[_0x6b46('0x2e')]));channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x2f')]=utils[_0x6b46('0x1a')]();channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x30')]=utils[_0x6b46('0x31')](channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x2f')],channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x32')]);channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x33')]=channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x27')]?utils[_0x6b46('0x31')](channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x2f')],channels[_0x244005[_0x6b46('0xa')]][_0x6b46('0x27')]):0x0;writeDB(channels[_0x244005[_0x6b46('0xa')]]);}}catch(_0x13a893){utils[_0x6b46('0x1c')](util['format'](_0x6b46('0x2a'),_0x244005[_0x6b46('0xa')]),_0x13a893);}};exports[_0x6b46('0x34')]=function(_0x30e645){try{if(!_[_0x6b46('0x21')](channels[_0x30e645[_0x6b46('0x35')]])){utils[_0x6b46('0x1f')](util[_0x6b46('0x8')](_0x6b46('0x36'),_0x30e645[_0x6b46('0x37')]),_0x30e645);if(channels[_0x30e645[_0x6b46('0x35')]][_0x6b46('0xb')]==_0x30e645[_0x6b46('0x38')]){utils[_0x6b46('0x7')](util[_0x6b46('0x8')](_0x6b46('0x39'),_0x30e645[_0x6b46('0x37')],_0x30e645[_0x6b46('0x35')],_0x30e645['secondtransfererchannel']));channels[_0x30e645[_0x6b46('0x35')]][_0x6b46('0x26')]=_0x30e645['secondtransfererchannel'];channels[_0x30e645[_0x6b46('0x35')]][_0x6b46('0x3a')]=_0x6b46('0x3b');}else if(channels[_0x30e645[_0x6b46('0x35')]][_0x6b46('0xb')]=_0x30e645['transfertargetchannel']){utils[_0x6b46('0x7')](util[_0x6b46('0x8')](_0x6b46('0x39'),_0x30e645[_0x6b46('0x37')],_0x30e645[_0x6b46('0x35')],_0x30e645[_0x6b46('0x3c')]));channels[_0x30e645[_0x6b46('0x35')]][_0x6b46('0x26')]=_0x30e645[_0x6b46('0x3c')];channels[_0x30e645[_0x6b46('0x35')]][_0x6b46('0x3a')]=_0x6b46('0x3b');}}}catch(_0x35856b){utils[_0x6b46('0x1c')](util[_0x6b46('0x8')]('[%s][calls][attendedtransfer]',_0x30e645['origtransfereruniqueid']),_0x35856b);}};exports[_0x6b46('0x3d')]=function(_0x3c685b){try{if(!_[_0x6b46('0x21')](channels[_0x3c685b['uniqueid']])){utils[_0x6b46('0x1f')](util[_0x6b46('0x8')](_0x6b46('0x3e'),_0x3c685b[_0x6b46('0xa')]),_0x3c685b);channels[_0x3c685b[_0x6b46('0xa')]][_0x6b46('0x3f')]=utils[_0x6b46('0x1a')]();utils['info'](util['format'](_0x6b46('0x40'),_0x3c685b['uniqueid'],channels[_0x3c685b[_0x6b46('0xa')]][_0x6b46('0x3f')]));}}catch(_0x332711){utils[_0x6b46('0x1c')](util[_0x6b46('0x8')]('[%s][calls][musiconholdstart]',_0x3c685b[_0x6b46('0xa')]),_0x332711);}};exports[_0x6b46('0x41')]=function(_0x19e87b){try{if(!_[_0x6b46('0x21')](channels[_0x19e87b['uniqueid']])){utils[_0x6b46('0x1f')](util[_0x6b46('0x8')](_0x6b46('0x42'),_0x19e87b['uniqueid']),_0x19e87b);if(!_[_0x6b46('0x21')](channels[_0x19e87b[_0x6b46('0xa')]][_0x6b46('0x3f')])){channels[_0x19e87b[_0x6b46('0xa')]]['mohtime']+=utils[_0x6b46('0x31')](utils[_0x6b46('0x1a')](),channels[_0x19e87b[_0x6b46('0xa')]][_0x6b46('0x3f')]);utils['info'](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x19e87b[_0x6b46('0xa')],channels[_0x19e87b[_0x6b46('0xa')]][_0x6b46('0x43')]));delete channels[_0x19e87b[_0x6b46('0xa')]]['musiconholdstartAt'];}}}catch(_0x410353){utils[_0x6b46('0x1c')](util['format'](_0x6b46('0x42'),_0x19e87b[_0x6b46('0xa')]),_0x410353);}};exports['varset']=function(_0x3f1a96){try{if(!_['isNil'](channels[_0x3f1a96['uniqueid']])){utils['debug'](util[_0x6b46('0x8')](_0x6b46('0x44'),_0x3f1a96[_0x6b46('0xa')]),_0x3f1a96);if(!_[_0x6b46('0x21')](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x46')])){utils['info'](util[_0x6b46('0x8')](_0x6b46('0x47'),_0x3f1a96[_0x6b46('0xa')],_0x3f1a96[_0x6b46('0x48')]));channels[_0x3f1a96[_0x6b46('0xa')]]['source']=_0x3f1a96[_0x6b46('0x48')];}if(!_[_0x6b46('0x21')](_0x3f1a96[_0x6b46('0x45')]['xmd-phone'])){utils[_0x6b46('0x7')](util[_0x6b46('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3f1a96[_0x6b46('0xa')],_0x3f1a96['value']));channels[_0x3f1a96[_0x6b46('0xa')]][_0x6b46('0x49')]=_0x3f1a96[_0x6b46('0x48')];channels[_0x3f1a96[_0x6b46('0xa')]][_0x6b46('0x2b')]='\x22'+_0x3f1a96['value']+'\x22\x20<'+_0x3f1a96[_0x6b46('0x48')]+'>';}if(!_[_0x6b46('0x21')](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x4a')])||!_['isNil'](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x4b')])){utils[_0x6b46('0x7')](util[_0x6b46('0x8')](_0x6b46('0x4c'),_0x3f1a96['uniqueid'],!_['isNil'](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x4a')])?_0x6b46('0x4a'):_0x6b46('0x4b'),_0x3f1a96[_0x6b46('0x48')]));channels[_0x3f1a96[_0x6b46('0xa')]]['callerid']=_0x3f1a96[_0x6b46('0x48')];}if(!_['isNil'](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x4d')])||!_['isNil'](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x4e')])){utils['info'](util['format'](_0x6b46('0x4c'),_0x3f1a96[_0x6b46('0xa')],!_[_0x6b46('0x21')](_0x3f1a96['variable'][_0x6b46('0x4d')])?_0x6b46('0x4d'):'xmcs-queue',_0x3f1a96[_0x6b46('0x48')]));channels[_0x3f1a96[_0x6b46('0xa')]][_0x6b46('0x4f')]='Queue';channels[_0x3f1a96[_0x6b46('0xa')]]['lastdata']=_0x3f1a96[_0x6b46('0x48')];channels[_0x3f1a96[_0x6b46('0xa')]][_0x6b46('0xc')]=!![];}if(!_['isNil'](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x50')])){utils['info'](util[_0x6b46('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x3f1a96[_0x6b46('0xa')],_0x3f1a96[_0x6b46('0x48')]));channels[_0x3f1a96[_0x6b46('0xa')]][_0x6b46('0x51')]=_0x3f1a96[_0x6b46('0x48')];}if(!_['isNil'](_0x3f1a96[_0x6b46('0x45')]['xmd-cdrtype'])){utils['info'](util[_0x6b46('0x8')](_0x6b46('0x52'),_0x3f1a96[_0x6b46('0xa')],_0x3f1a96[_0x6b46('0x48')]));channels[_0x3f1a96[_0x6b46('0xa')]]['type']=_0x3f1a96[_0x6b46('0x48')];}if(!_[_0x6b46('0x21')](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x53')])){utils['info'](util[_0x6b46('0x8')](_0x6b46('0x54'),_0x3f1a96[_0x6b46('0xa')],_0x3f1a96[_0x6b46('0x48')]));channels[_0x3f1a96[_0x6b46('0xa')]]['routeid']=_0x3f1a96[_0x6b46('0x48')];}if(!_['isNil'](_0x3f1a96[_0x6b46('0x45')][_0x6b46('0x55')])){utils['info'](util[_0x6b46('0x8')](_0x6b46('0x56'),_0x3f1a96['uniqueid'],_0x3f1a96['value']));channels[_0x3f1a96[_0x6b46('0xa')]][_0x6b46('0x55')]=_0x3f1a96['value'];}}}catch(_0x5233a2){utils[_0x6b46('0x1c')](util['format']('[%s][calls][varset]',_0x3f1a96[_0x6b46('0xa')]),_0x5233a2);}};exports[_0x6b46('0x57')]=function(_0xe6cd8a){try{if(!_[_0x6b46('0x21')](channels[_0xe6cd8a[_0x6b46('0xa')]])){utils['debug'](util[_0x6b46('0x8')](_0x6b46('0x58'),_0xe6cd8a[_0x6b46('0xa')]),_0xe6cd8a);utils['info'](util['format'](_0x6b46('0x59'),_0xe6cd8a[_0x6b46('0xa')],_0xe6cd8a[_0x6b46('0x5a')],_0xe6cd8a[_0x6b46('0x5b')]));if(_0xe6cd8a['application']['toLowerCase']()==_0x6b46('0x5c')&&_[_0x6b46('0x5d')](_0xe6cd8a[_0x6b46('0x5b')][_0x6b46('0x5e')](),_0x6b46('0x5f'))){var _0x5f4d1a=_0xe6cd8a['appdata']['split']('=');var _0x29a713=_0x5f4d1a[0x0][_0x6b46('0x60')](_0x5f4d1a[0x0][_0x6b46('0x61')]('(')+0x1,_0x5f4d1a[0x0][_0x6b46('0x61')](')'));var _0x5b8e0a=_0x5f4d1a[0x1];channels[_0xe6cd8a['uniqueid']][_0x29a713]=_0x5b8e0a;}if(!_[_0x6b46('0x62')](['hangup',_0x6b46('0x63'),'execif','set',_0x6b46('0x64')],_0xe6cd8a['application'][_0x6b46('0x5e')]())){channels[_0xe6cd8a[_0x6b46('0xa')]][_0x6b46('0x4f')]=_0xe6cd8a[_0x6b46('0x5a')];channels[_0xe6cd8a[_0x6b46('0xa')]][_0x6b46('0x65')]=_0xe6cd8a[_0x6b46('0x5b')];}}}catch(_0x165847){utils[_0x6b46('0x1c')](util[_0x6b46('0x8')](_0x6b46('0x58'),_0xe6cd8a[_0x6b46('0xa')]),_0x165847);}}; \ No newline at end of file +var _0x6755=['varset','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','transfer','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6755,0xf8));var _0x5675=function(_0xea66d3,_0x4a968f){_0xea66d3=_0xea66d3-0x0;var _0x59202c=_0x6755[_0xea66d3];return _0x59202c;};'use strict';var _=require(_0x5675('0x0'));var util=require(_0x5675('0x1'));var utils=require('./utils');var dispositions=[_0x5675('0x2'),'FAILED','FAILED',_0x5675('0x2'),'NO\x20ANSWER',_0x5675('0x2'),_0x5675('0x3'),_0x5675('0x4'),'FAILED',_0x5675('0x5'),'FAILED'];var channels={};function writeDB(_0x509be1){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x8'),_0x509be1[_0x5675('0x9')],_0x509be1[_0x5675('0xa')],_0x509be1['queue'],_0x509be1['membername'],_0x509be1[_0x5675('0xb')],_0x509be1[_0x5675('0xc')],_0x509be1[_0x5675('0xd')],_0x509be1[_0x5675('0xe')]));if(_0x509be1[_0x5675('0xf')]){utils[_0x5675('0x10')](_0x509be1['accountcode'])['then'](function(_0x595fe0){if(_0x595fe0){_0x509be1[_0x5675('0x11')]=_0x595fe0['id'];}utils['request'](_0x5675('0x12'),_0x509be1);});}else{utils[_0x5675('0x13')]('CreateVoiceCallReport',_0x509be1);}if(channels[_0x509be1[_0x5675('0x9')]]){delete channels[_0x509be1[_0x5675('0x9')]];}}exports[_0x5675('0x14')]=function(_0xf5405f){try{utils[_0x5675('0x15')](util[_0x5675('0x7')](_0x5675('0x16'),_0xf5405f['uniqueid']),_0xf5405f);if(_0xf5405f[_0x5675('0x9')]==_0xf5405f[_0x5675('0x17')]&&_0xf5405f['channel']!=_0x5675('0x18')){utils['info'](util['format'](_0x5675('0x19'),_0xf5405f[_0x5675('0x9')],_0xf5405f['context'],_0xf5405f[_0x5675('0x1a')]));channels[_0xf5405f[_0x5675('0x9')]]={'uniqueid':_0xf5405f['uniqueid'],'accountcode':_0xf5405f[_0x5675('0xf')],'source':_0xf5405f[_0x5675('0xc')],'destination':_0xf5405f[_0x5675('0x1a')],'destinationcontext':_0xf5405f['context'],'channel':_0xf5405f[_0x5675('0xa')],'starttime':utils[_0x5675('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5675('0x2'),'amaflags':_0x5675('0x1c')};}}catch(_0x3e1bfc){utils[_0x5675('0x1d')](util[_0x5675('0x7')](_0x5675('0x16'),_0xf5405f[_0x5675('0x9')]),_0x3e1bfc);}};exports[_0x5675('0x1e')]=function(_0x30f53a){try{utils[_0x5675('0x15')](util[_0x5675('0x7')]('[%s][calls][newstate]',_0x30f53a[_0x5675('0x9')]),_0x30f53a);if(!_[_0x5675('0x1f')](channels[_0x30f53a[_0x5675('0x9')]])&&_0x30f53a[_0x5675('0x20')]==0x6){utils[_0x5675('0x6')](util['format'](_0x5675('0x21'),_0x30f53a[_0x5675('0x9')],_0x30f53a[_0x5675('0x22')],_0x30f53a['channel']));if(_['isNil'](channels[_0x30f53a[_0x5675('0x9')]][_0x5675('0x23')])){channels[_0x30f53a[_0x5675('0x9')]][_0x5675('0x23')]=utils[_0x5675('0x1b')]();}}else if(!_[_0x5675('0x1f')](channels[_0x30f53a[_0x5675('0x17')]])&&_0x30f53a[_0x5675('0x20')]==0x6&&_0x30f53a['context']!=_0x5675('0x24')){utils['info'](util[_0x5675('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x30f53a[_0x5675('0x9')],_0x30f53a[_0x5675('0x17')],_0x30f53a['context'],_0x30f53a['channel']));channels[_0x30f53a['linkedid']][_0x5675('0xf')]=_0x30f53a[_0x5675('0xf')];channels[_0x30f53a['linkedid']][_0x5675('0x25')]=_0x30f53a['channel'];if(_[_0x5675('0x1f')](channels[_0x30f53a[_0x5675('0x17')]][_0x5675('0x26')])){channels[_0x30f53a[_0x5675('0x17')]][_0x5675('0x26')]=utils[_0x5675('0x1b')]();}channels[_0x30f53a['linkedid']]['disposition']=dispositions[_[_0x5675('0x27')](_0x30f53a[_0x5675('0x20')])]||_0x5675('0x3');}}catch(_0x1b0c5c){utils[_0x5675('0x1d')](util['format']('[%s][calls][newstate]',_0x30f53a[_0x5675('0x9')]),_0x1b0c5c);}};exports[_0x5675('0x28')]=function(_0x4c8b73){try{if(!_[_0x5675('0x1f')](channels[_0x4c8b73[_0x5675('0x9')]])){utils['debug'](util[_0x5675('0x7')](_0x5675('0x29'),_0x4c8b73[_0x5675('0x9')]),_0x4c8b73);if(_[_0x5675('0x1f')](channels[_0x4c8b73[_0x5675('0x9')]][_0x5675('0x2a')])){channels[_0x4c8b73[_0x5675('0x9')]][_0x5675('0x2a')]=_0x4c8b73[_0x5675('0x2b')]+'\x20<'+_0x4c8b73[_0x5675('0xc')]+'>';}utils[_0x5675('0x6')](util['format'](_0x5675('0x2c'),_0x4c8b73['uniqueid'],channels[_0x4c8b73[_0x5675('0x9')]][_0x5675('0x2a')],_0x4c8b73[_0x5675('0x2d')]));channels[_0x4c8b73[_0x5675('0x9')]][_0x5675('0x2e')]=utils['now']();channels[_0x4c8b73['uniqueid']][_0x5675('0x2f')]=utils[_0x5675('0x30')](channels[_0x4c8b73[_0x5675('0x9')]]['endtime'],channels[_0x4c8b73[_0x5675('0x9')]][_0x5675('0x31')]);channels[_0x4c8b73['uniqueid']]['billableseconds']=channels[_0x4c8b73[_0x5675('0x9')]]['answertime']?utils[_0x5675('0x30')](channels[_0x4c8b73[_0x5675('0x9')]]['endtime'],channels[_0x4c8b73[_0x5675('0x9')]]['answertime']):0x0;writeDB(channels[_0x4c8b73[_0x5675('0x9')]]);}}catch(_0x1a59bc){utils['error'](util[_0x5675('0x7')]('[%s][calls][hangup]',_0x4c8b73[_0x5675('0x9')]),_0x1a59bc);}};exports[_0x5675('0x32')]=function(_0x210dcf){try{if(!_['isNil'](channels[_0x210dcf[_0x5675('0x33')]])){utils[_0x5675('0x15')](util[_0x5675('0x7')]('[%s][calls][attendedtransfer]',_0x210dcf['origtransfereruniqueid']),_0x210dcf);if(channels[_0x210dcf['localtwolinkedid']][_0x5675('0xa')]==_0x210dcf[_0x5675('0x34')]){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x35'),_0x210dcf[_0x5675('0x36')],_0x210dcf['localtwolinkedid'],_0x210dcf[_0x5675('0x37')]));channels[_0x210dcf[_0x5675('0x33')]][_0x5675('0x25')]=_0x210dcf[_0x5675('0x37')];channels[_0x210dcf[_0x5675('0x33')]][_0x5675('0x38')]=_0x5675('0x39');}else if(channels[_0x210dcf[_0x5675('0x33')]][_0x5675('0xa')]=_0x210dcf['transfertargetchannel']){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x35'),_0x210dcf[_0x5675('0x36')],_0x210dcf[_0x5675('0x33')],_0x210dcf[_0x5675('0x3a')]));channels[_0x210dcf[_0x5675('0x33')]]['destinationchannel']=_0x210dcf['origtransfererchannel'];channels[_0x210dcf[_0x5675('0x33')]]['userfield']=_0x5675('0x39');}}}catch(_0x257bb5){utils[_0x5675('0x1d')](util[_0x5675('0x7')](_0x5675('0x3b'),_0x210dcf[_0x5675('0x36')]),_0x257bb5);}};exports[_0x5675('0x3c')]=function(_0x5893ee){try{if(!_['isNil'](channels[_0x5893ee['uniqueid']])){utils[_0x5675('0x15')](util['format'](_0x5675('0x3d'),_0x5893ee[_0x5675('0x9')]),_0x5893ee);channels[_0x5893ee[_0x5675('0x9')]][_0x5675('0x3e')]=utils[_0x5675('0x1b')]();utils['info'](util[_0x5675('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5893ee[_0x5675('0x9')],channels[_0x5893ee[_0x5675('0x9')]][_0x5675('0x3e')]));}}catch(_0x288614){utils[_0x5675('0x1d')](util[_0x5675('0x7')](_0x5675('0x3d'),_0x5893ee[_0x5675('0x9')]),_0x288614);}};exports[_0x5675('0x3f')]=function(_0x527a71){try{if(!_[_0x5675('0x1f')](channels[_0x527a71[_0x5675('0x9')]])){utils['debug'](util[_0x5675('0x7')](_0x5675('0x40'),_0x527a71[_0x5675('0x9')]),_0x527a71);if(!_['isNil'](channels[_0x527a71[_0x5675('0x9')]][_0x5675('0x3e')])){channels[_0x527a71[_0x5675('0x9')]][_0x5675('0x41')]+=utils[_0x5675('0x30')](utils[_0x5675('0x1b')](),channels[_0x527a71[_0x5675('0x9')]]['musiconholdstartAt']);utils['info'](util[_0x5675('0x7')](_0x5675('0x42'),_0x527a71[_0x5675('0x9')],channels[_0x527a71[_0x5675('0x9')]][_0x5675('0x41')]));delete channels[_0x527a71[_0x5675('0x9')]][_0x5675('0x3e')];}}}catch(_0x33ed7b){utils[_0x5675('0x1d')](util[_0x5675('0x7')](_0x5675('0x40'),_0x527a71[_0x5675('0x9')]),_0x33ed7b);}};exports[_0x5675('0x43')]=function(_0x894b4d){try{if(!_[_0x5675('0x1f')](channels[_0x894b4d[_0x5675('0x9')]])){utils[_0x5675('0x15')](util[_0x5675('0x7')]('[%s][calls][varset]',_0x894b4d['uniqueid']),_0x894b4d);if(!_[_0x5675('0x1f')](_0x894b4d['variable']['xmd-originatecalleridnum'])){utils[_0x5675('0x6')](util[_0x5675('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x894b4d[_0x5675('0x9')],_0x894b4d[_0x5675('0x44')]));channels[_0x894b4d['uniqueid']][_0x5675('0x45')]=_0x894b4d[_0x5675('0x44')];}if(!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')]['xmd-phone'])){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x47'),_0x894b4d[_0x5675('0x9')],_0x894b4d[_0x5675('0x44')]));channels[_0x894b4d[_0x5675('0x9')]][_0x5675('0x48')]=_0x894b4d[_0x5675('0x44')];channels[_0x894b4d[_0x5675('0x9')]]['callerid']='\x22'+_0x894b4d[_0x5675('0x44')]+_0x5675('0x49')+_0x894b4d[_0x5675('0x44')]+'>';}if(!_[_0x5675('0x1f')](_0x894b4d['variable'][_0x5675('0x4a')])||!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')][_0x5675('0x4b')])){utils['info'](util[_0x5675('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x894b4d[_0x5675('0x9')],!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')][_0x5675('0x4a')])?_0x5675('0x4a'):_0x5675('0x4b'),_0x894b4d['value']));channels[_0x894b4d[_0x5675('0x9')]][_0x5675('0x2a')]=_0x894b4d[_0x5675('0x44')];}if(!_['isNil'](_0x894b4d[_0x5675('0x46')][_0x5675('0x4c')])||!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')][_0x5675('0x4d')])){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x4e'),_0x894b4d[_0x5675('0x9')],!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')][_0x5675('0x4c')])?'xmd-queue':'xmcs-queue',_0x894b4d[_0x5675('0x44')]));channels[_0x894b4d['uniqueid']][_0x5675('0x4f')]='Queue';channels[_0x894b4d['uniqueid']][_0x5675('0x50')]=_0x894b4d[_0x5675('0x44')];channels[_0x894b4d[_0x5675('0x9')]][_0x5675('0x51')]=!![];}if(!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')][_0x5675('0x52')])){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x53'),_0x894b4d[_0x5675('0x9')],_0x894b4d[_0x5675('0x44')]));channels[_0x894b4d['uniqueid']][_0x5675('0x54')]=_0x894b4d[_0x5675('0x44')];}if(!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')]['xmd-cdrtype'])){utils[_0x5675('0x6')](util['format'](_0x5675('0x55'),_0x894b4d[_0x5675('0x9')],_0x894b4d['value']));channels[_0x894b4d['uniqueid']][_0x5675('0x56')]=_0x894b4d[_0x5675('0x44')];}if(!_['isNil'](_0x894b4d['variable'][_0x5675('0x57')])){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x58'),_0x894b4d['uniqueid'],_0x894b4d[_0x5675('0x44')]));channels[_0x894b4d[_0x5675('0x9')]][_0x5675('0x59')]=_0x894b4d['value'];}if(!_[_0x5675('0x1f')](_0x894b4d[_0x5675('0x46')][_0x5675('0x5a')])){utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x5b'),_0x894b4d[_0x5675('0x9')],_0x894b4d['value']));channels[_0x894b4d[_0x5675('0x9')]][_0x5675('0x5a')]=_0x894b4d[_0x5675('0x44')];}}}catch(_0x3a36c1){utils['error'](util['format'](_0x5675('0x5c'),_0x894b4d[_0x5675('0x9')]),_0x3a36c1);}};exports['newexten']=function(_0x794b70){try{if(!_[_0x5675('0x1f')](channels[_0x794b70['uniqueid']])){utils[_0x5675('0x15')](util['format']('[%s][calls][newexten]',_0x794b70['uniqueid']),_0x794b70);utils[_0x5675('0x6')](util[_0x5675('0x7')](_0x5675('0x5d'),_0x794b70[_0x5675('0x9')],_0x794b70[_0x5675('0x5e')],_0x794b70[_0x5675('0x5f')]));if(_0x794b70[_0x5675('0x5e')][_0x5675('0x60')]()==_0x5675('0x61')&&_[_0x5675('0x62')](_0x794b70['appdata'][_0x5675('0x60')](),'cdr')){var _0xed2e6e=_0x794b70[_0x5675('0x5f')]['split']('=');var _0x4b00ca=_0xed2e6e[0x0][_0x5675('0x63')](_0xed2e6e[0x0][_0x5675('0x64')]('(')+0x1,_0xed2e6e[0x0][_0x5675('0x64')](')'));var _0x24484e=_0xed2e6e[0x1];channels[_0x794b70['uniqueid']][_0x4b00ca]=_0x24484e;}if(!_[_0x5675('0x65')]([_0x5675('0x28'),_0x5675('0x66'),_0x5675('0x67'),_0x5675('0x61'),_0x5675('0x68')],_0x794b70[_0x5675('0x5e')]['toLowerCase']())){channels[_0x794b70[_0x5675('0x9')]]['lastapplication']=_0x794b70[_0x5675('0x5e')];channels[_0x794b70[_0x5675('0x9')]][_0x5675('0x50')]=_0x794b70[_0x5675('0x5f')];}}}catch(_0x462e2e){utils[_0x5675('0x1d')](util[_0x5675('0x7')]('[%s][calls][newexten]',_0x794b70[_0x5675('0x9')]),_0x462e2e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 226bd92..5170ba4 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 _0xa0a2=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x454716,_0xc45026){var _0x3126d9=function(_0x4755ac){while(--_0x4755ac){_0x454716['push'](_0x454716['shift']());}};_0x3126d9(++_0xc45026);}(_0xa0a2,0xfd));var _0x2a0a=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xa0a2[_0x14fad0];return _0x5c665f;};'use strict';var utils=require(_0x2a0a('0x0'));exports[_0x2a0a('0x1')]=function(){utils[_0x2a0a('0x2')](_0x2a0a('0x3'));};exports[_0x2a0a('0x4')]=function(){utils[_0x2a0a('0x2')]('[core]\x20shutdown');};exports[_0x2a0a('0x5')]=function(){utils['info'](_0x2a0a('0x6'));};exports[_0x2a0a('0x7')]=function(_0x37c448){utils['error'](_0x2a0a('0x8'),_0x37c448);};exports[_0x2a0a('0x9')]=function(){utils[_0x2a0a('0x2')](_0x2a0a('0xa'));};exports[_0x2a0a('0xb')]=function(_0x48becd){}; \ No newline at end of file +var _0x5c32=['./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','close','managerevent'];(function(_0x499be8,_0x10a8e1){var _0x35fe0d=function(_0x151f7c){while(--_0x151f7c){_0x499be8['push'](_0x499be8['shift']());}};_0x35fe0d(++_0x10a8e1);}(_0x5c32,0x10e));var _0x25c3=function(_0x86421c,_0x8bd38){_0x86421c=_0x86421c-0x0;var _0x10a66a=_0x5c32[_0x86421c];return _0x10a66a;};'use strict';var utils=require(_0x25c3('0x0'));exports[_0x25c3('0x1')]=function(){utils[_0x25c3('0x2')](_0x25c3('0x3'));};exports[_0x25c3('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x25c3('0x5')]=function(){utils[_0x25c3('0x2')](_0x25c3('0x6'));};exports[_0x25c3('0x7')]=function(_0x1c9e58){utils[_0x25c3('0x7')]('[core]\x20error',_0x1c9e58);};exports[_0x25c3('0x8')]=function(){utils['info']('[core]\x20close');};exports[_0x25c3('0x9')]=function(_0x40f11d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 082c845..578d0dc 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 _0x635d=['called','error','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','varset','debug','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent'];(function(_0x370872,_0x4265b6){var _0x34aa16=function(_0x8567c8){while(--_0x8567c8){_0x370872['push'](_0x370872['shift']());}};_0x34aa16(++_0x4265b6);}(_0x635d,0x77));var _0xd635=function(_0x1098f3,_0x2d9803){_0x1098f3=_0x1098f3-0x0;var _0x37a3aa=_0x635d[_0x1098f3];return _0x37a3aa;};'use strict';var _=require(_0xd635('0x0'));var util=require('util');var utils=require(_0xd635('0x1'));var dials={};function writeDB(_0x5a75b5){utils[_0xd635('0x2')](util[_0xd635('0x3')](_0xd635('0x4'),_0x5a75b5[_0xd635('0x5')],_0x5a75b5[_0xd635('0x6')],_0x5a75b5[_0xd635('0x7')],_0x5a75b5['calleridnum'],_0x5a75b5[_0xd635('0x8')],_0x5a75b5[_0xd635('0x9')]));utils[_0xd635('0xa')]('CreateVoiceDialReport',_0x5a75b5);delete dials[_0x5a75b5[_0xd635('0x5')]];}exports[_0xd635('0xb')]=function(_0x1534cb){try{utils['debug'](util[_0xd635('0x3')](_0xd635('0xc'),_0x1534cb['uniqueid']),_0x1534cb);utils[_0xd635('0x2')](util[_0xd635('0x3')](_0xd635('0xd'),_0x1534cb['uniqueid'],_0x1534cb['application'],_0x1534cb['appdata']));if(_0x1534cb[_0xd635('0xe')][_0xd635('0xf')]()==_0xd635('0x10')&&_[_0xd635('0x11')](_0x1534cb[_0xd635('0x12')]['toLowerCase'](),_0xd635('0x13'))){var _0x25abc3=_0x1534cb[_0xd635('0x12')][_0xd635('0x14')]('=');dials[_0x1534cb[_0xd635('0x5')]]={'routeId':_0x25abc3[0x1]};}}catch(_0x19f1ae){utils['error'](util[_0xd635('0x3')](_0xd635('0xc'),_0x1534cb[_0xd635('0x5')]),_0x19f1ae);}};exports[_0xd635('0x15')]=function(_0x2dc261){try{utils[_0xd635('0x16')](util[_0xd635('0x3')](_0xd635('0x17'),_0x2dc261[_0xd635('0x5')]),_0x2dc261);if(!_['isNil'](_0x2dc261['variable'][_0xd635('0x18')])){utils[_0xd635('0x2')](util['format'](_0xd635('0x19'),_0x2dc261[_0xd635('0x5')],_0x2dc261[_0xd635('0x1a')]));dials[_0x2dc261[_0xd635('0x5')]]={'routeId':_0x2dc261[_0xd635('0x1a')]};}}catch(_0x3c789a){utils['error'](util['format'](_0xd635('0x17'),_0x2dc261[_0xd635('0x5')]),_0x3c789a);}};exports[_0xd635('0x1b')]=function(_0x420161){try{if(!_[_0xd635('0x1c')](dials[_0x420161['uniqueid']])){utils[_0xd635('0x16')](util['format'](_0xd635('0x1d'),_0x420161['uniqueid']),_0x420161);dials[_0x420161[_0xd635('0x5')]]=_[_0xd635('0x1e')](dials[_0x420161[_0xd635('0x5')]],_0x420161);dials[_0x420161[_0xd635('0x5')]][_0xd635('0x1f')]=utils[_0xd635('0x20')]();dials[_0x420161[_0xd635('0x5')]][_0xd635('0x21')]=_0xd635('0x22');utils[_0xd635('0x2')](util[_0xd635('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x420161[_0xd635('0x5')],dials[_0x420161[_0xd635('0x5')]][_0xd635('0x1f')]));}}catch(_0x4327ba){utils[_0xd635('0x23')](util[_0xd635('0x3')](_0xd635('0x1d'),_0x420161[_0xd635('0x5')]),_0x4327ba);}};exports['dialend']=function(_0x20aea3){try{if(!_[_0xd635('0x1c')](dials[_0x20aea3[_0xd635('0x5')]])){utils['debug'](util[_0xd635('0x3')]('[%s][dials][dialend]',_0x20aea3[_0xd635('0x5')]),_0x20aea3);dials[_0x20aea3[_0xd635('0x5')]][_0xd635('0x9')]=_0x20aea3[_0xd635('0x9')];if(_0x20aea3[_0xd635('0x9')]==_0xd635('0x24')){dials[_0x20aea3[_0xd635('0x5')]]=_[_0xd635('0x1e')](dials[_0x20aea3[_0xd635('0x5')]],_0x20aea3);dials[_0x20aea3['uniqueid']][_0xd635('0x25')]=utils[_0xd635('0x20')]();dials[_0x20aea3[_0xd635('0x5')]][_0xd635('0x21')]=_0xd635('0x26');utils[_0xd635('0x2')](util[_0xd635('0x3')](_0xd635('0x27'),_0x20aea3[_0xd635('0x5')],_0x20aea3[_0xd635('0x9')],dials[_0x20aea3['uniqueid']][_0xd635('0x25')]));}else{utils[_0xd635('0x2')](util[_0xd635('0x3')](_0xd635('0x28'),_0x20aea3[_0xd635('0x5')],_0x20aea3['dialstatus']));}}}catch(_0x4a5976){utils[_0xd635('0x23')](util[_0xd635('0x3')]('[%s][dials][dialend]',_0x20aea3[_0xd635('0x5')]),_0x4a5976);}};exports[_0xd635('0x29')]=function(_0x3a9100){try{if(!_[_0xd635('0x1c')](dials[_0x3a9100['uniqueid']])){utils[_0xd635('0x16')](util[_0xd635('0x3')](_0xd635('0x2a'),_0x3a9100[_0xd635('0x5')]),_0x3a9100);utils[_0xd635('0x2')](util[_0xd635('0x3')](_0xd635('0x2b'),_0x3a9100['uniqueid'],_0x3a9100[_0xd635('0x2c')],_0x3a9100[_0xd635('0x2d')],_0x3a9100['cause-txt']));dials[_0x3a9100['uniqueid']]=_[_0xd635('0x1e')](dials[_0x3a9100[_0xd635('0x5')]],{'endtime':utils[_0xd635('0x20')](),'lastevent':_0xd635('0x2e')});dials[_0x3a9100[_0xd635('0x5')]]['duration']=utils[_0xd635('0x2f')](dials[_0x3a9100[_0xd635('0x5')]][_0xd635('0x30')],dials[_0x3a9100[_0xd635('0x5')]]['starttime']);dials[_0x3a9100[_0xd635('0x5')]][_0xd635('0x31')]=utils[_0xd635('0x2f')](dials[_0x3a9100[_0xd635('0x5')]][_0xd635('0x25')]||dials[_0x3a9100[_0xd635('0x5')]]['endtime'],dials[_0x3a9100[_0xd635('0x5')]][_0xd635('0x1f')]);dials[_0x3a9100[_0xd635('0x5')]][_0xd635('0x32')]=dials[_0x3a9100[_0xd635('0x5')]][_0xd635('0x25')]?utils[_0xd635('0x2f')](dials[_0x3a9100['uniqueid']]['endtime'],dials[_0x3a9100['uniqueid']]['answertime']):0x0;writeDB(dials[_0x3a9100[_0xd635('0x5')]]);}}catch(_0x4a2020){utils['error'](util['format']('[%s][dials][hangup]',_0x3a9100[_0xd635('0x5')]),_0x4a2020);}}; \ No newline at end of file +var _0xad80=['[%s][dials][dialbegin]','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','assign','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','duration','diffTime','endtime','holdtime','answertime','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','varset','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xad80,0x19c));var _0x0ad8=function(_0x3149c5,_0x58701a){_0x3149c5=_0x3149c5-0x0;var _0x34658d=_0xad80[_0x3149c5];return _0x34658d;};'use strict';var _=require(_0x0ad8('0x0'));var util=require(_0x0ad8('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x1e433f){utils[_0x0ad8('0x2')](util[_0x0ad8('0x3')](_0x0ad8('0x4'),_0x1e433f['uniqueid'],_0x1e433f[_0x0ad8('0x5')],_0x1e433f[_0x0ad8('0x6')],_0x1e433f['calleridnum'],_0x1e433f[_0x0ad8('0x7')],_0x1e433f[_0x0ad8('0x8')]));utils[_0x0ad8('0x9')](_0x0ad8('0xa'),_0x1e433f);delete dials[_0x1e433f[_0x0ad8('0xb')]];}exports[_0x0ad8('0xc')]=function(_0xce189c){try{utils[_0x0ad8('0xd')](util[_0x0ad8('0x3')]('[%s][dials][newexten]',_0xce189c['uniqueid']),_0xce189c);utils[_0x0ad8('0x2')](util[_0x0ad8('0x3')](_0x0ad8('0xe'),_0xce189c[_0x0ad8('0xb')],_0xce189c[_0x0ad8('0xf')],_0xce189c[_0x0ad8('0x10')]));if(_0xce189c[_0x0ad8('0xf')][_0x0ad8('0x11')]()=='set'&&_['startsWith'](_0xce189c[_0x0ad8('0x10')]['toLowerCase'](),_0x0ad8('0x12'))){var _0x5b2d01=_0xce189c[_0x0ad8('0x10')][_0x0ad8('0x13')]('=');dials[_0xce189c[_0x0ad8('0xb')]]={'routeId':_0x5b2d01[0x1]};}}catch(_0x3e5e69){utils[_0x0ad8('0x14')](util['format'](_0x0ad8('0x15'),_0xce189c['uniqueid']),_0x3e5e69);}};exports[_0x0ad8('0x16')]=function(_0x1fc698){try{utils['debug'](util[_0x0ad8('0x3')]('[%s][dials][varset]',_0x1fc698[_0x0ad8('0xb')]),_0x1fc698);if(!_[_0x0ad8('0x17')](_0x1fc698['variable'][_0x0ad8('0x18')])){utils[_0x0ad8('0x2')](util[_0x0ad8('0x3')](_0x0ad8('0x19'),_0x1fc698[_0x0ad8('0xb')],_0x1fc698['value']));dials[_0x1fc698[_0x0ad8('0xb')]]={'routeId':_0x1fc698[_0x0ad8('0x1a')]};}}catch(_0x3dd729){utils[_0x0ad8('0x14')](util[_0x0ad8('0x3')](_0x0ad8('0x1b'),_0x1fc698[_0x0ad8('0xb')]),_0x3dd729);}};exports[_0x0ad8('0x1c')]=function(_0xf849a2){try{if(!_['isNil'](dials[_0xf849a2['uniqueid']])){utils['debug'](util['format'](_0x0ad8('0x1d'),_0xf849a2['uniqueid']),_0xf849a2);dials[_0xf849a2[_0x0ad8('0xb')]]=_['assign'](dials[_0xf849a2['uniqueid']],_0xf849a2);dials[_0xf849a2[_0x0ad8('0xb')]][_0x0ad8('0x1e')]=utils['now']();dials[_0xf849a2[_0x0ad8('0xb')]][_0x0ad8('0x1f')]=_0x0ad8('0x20');utils['info'](util['format'](_0x0ad8('0x21'),_0xf849a2[_0x0ad8('0xb')],dials[_0xf849a2[_0x0ad8('0xb')]][_0x0ad8('0x1e')]));}}catch(_0x1a61d3){utils[_0x0ad8('0x14')](util[_0x0ad8('0x3')](_0x0ad8('0x1d'),_0xf849a2[_0x0ad8('0xb')]),_0x1a61d3);}};exports['dialend']=function(_0x27d3a2){try{if(!_[_0x0ad8('0x17')](dials[_0x27d3a2[_0x0ad8('0xb')]])){utils[_0x0ad8('0xd')](util[_0x0ad8('0x3')](_0x0ad8('0x22'),_0x27d3a2['uniqueid']),_0x27d3a2);dials[_0x27d3a2[_0x0ad8('0xb')]][_0x0ad8('0x8')]=_0x27d3a2['dialstatus'];if(_0x27d3a2[_0x0ad8('0x8')]=='ANSWER'){dials[_0x27d3a2['uniqueid']]=_[_0x0ad8('0x23')](dials[_0x27d3a2[_0x0ad8('0xb')]],_0x27d3a2);dials[_0x27d3a2[_0x0ad8('0xb')]]['answertime']=utils[_0x0ad8('0x24')]();dials[_0x27d3a2[_0x0ad8('0xb')]][_0x0ad8('0x1f')]=_0x0ad8('0x25');utils[_0x0ad8('0x2')](util[_0x0ad8('0x3')](_0x0ad8('0x26'),_0x27d3a2[_0x0ad8('0xb')],_0x27d3a2['dialstatus'],dials[_0x27d3a2['uniqueid']]['answertime']));}else{utils[_0x0ad8('0x2')](util[_0x0ad8('0x3')](_0x0ad8('0x27'),_0x27d3a2[_0x0ad8('0xb')],_0x27d3a2[_0x0ad8('0x8')]));}}}catch(_0x4cf616){utils[_0x0ad8('0x14')](util[_0x0ad8('0x3')](_0x0ad8('0x22'),_0x27d3a2[_0x0ad8('0xb')]),_0x4cf616);}};exports['hangup']=function(_0x3bae27){try{if(!_[_0x0ad8('0x17')](dials[_0x3bae27[_0x0ad8('0xb')]])){utils[_0x0ad8('0xd')](util['format'](_0x0ad8('0x28'),_0x3bae27['uniqueid']),_0x3bae27);utils['info'](util[_0x0ad8('0x3')](_0x0ad8('0x29'),_0x3bae27['uniqueid'],_0x3bae27[_0x0ad8('0x2a')],_0x3bae27['calleridname'],_0x3bae27[_0x0ad8('0x2b')]));dials[_0x3bae27[_0x0ad8('0xb')]]=_[_0x0ad8('0x23')](dials[_0x3bae27[_0x0ad8('0xb')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x3bae27[_0x0ad8('0xb')]][_0x0ad8('0x2c')]=utils[_0x0ad8('0x2d')](dials[_0x3bae27[_0x0ad8('0xb')]][_0x0ad8('0x2e')],dials[_0x3bae27[_0x0ad8('0xb')]]['starttime']);dials[_0x3bae27[_0x0ad8('0xb')]][_0x0ad8('0x2f')]=utils['diffTime'](dials[_0x3bae27[_0x0ad8('0xb')]][_0x0ad8('0x30')]||dials[_0x3bae27[_0x0ad8('0xb')]][_0x0ad8('0x2e')],dials[_0x3bae27['uniqueid']][_0x0ad8('0x1e')]);dials[_0x3bae27['uniqueid']]['billableseconds']=dials[_0x3bae27[_0x0ad8('0xb')]][_0x0ad8('0x30')]?utils[_0x0ad8('0x2d')](dials[_0x3bae27[_0x0ad8('0xb')]]['endtime'],dials[_0x3bae27[_0x0ad8('0xb')]][_0x0ad8('0x30')]):0x0;writeDB(dials[_0x3bae27[_0x0ad8('0xb')]]);}}catch(_0x349d6f){utils[_0x0ad8('0x14')](util['format'](_0x0ad8('0x28'),_0x3bae27[_0x0ad8('0xb')]),_0x349d6f);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 99aa0c8..9b1cb95 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 _0xb70b=['agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','port','asterisk','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb70b,0xed));var _0xbb70=function(_0x3786ee,_0x11f961){_0x3786ee=_0x3786ee-0x0;var _0x54574b=_0xb70b[_0x3786ee];return _0x54574b;};var AsteriskManager=require('asterisk-manager');var config=require(_0xbb70('0x0'));var utils=require(_0xbb70('0x1'));var util=require(_0xbb70('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xbb70('0x3')],config['asterisk']['ip'],config[_0xbb70('0x4')][_0xbb70('0x5')],config[_0xbb70('0x4')][_0xbb70('0x6')],!![]);ami[_0xbb70('0x7')]();if(config[_0xbb70('0x8')]&&config[_0xbb70('0x8')][_0xbb70('0x9')]){utils['info'](_0xbb70('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0xbb70('0xb'));var queues=require(_0xbb70('0xc'));var recordings=require(_0xbb70('0xd'));var members=require(_0xbb70('0xe'));var dials=require(_0xbb70('0xf'));var transfers=require(_0xbb70('0x10'));var core=require(_0xbb70('0x11'));ami['on']('connect',core[_0xbb70('0x12')]);ami['on'](_0xbb70('0x13'),core[_0xbb70('0x13')]);ami['on']('fullybooted',core[_0xbb70('0x14')]);ami['on'](_0xbb70('0x15'),core[_0xbb70('0x15')]);ami['on']('close',core[_0xbb70('0x16')]);ami['on'](_0xbb70('0x17'),core[_0xbb70('0x17')]);ami['on'](_0xbb70('0x18'),function(_0x2044c){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x1b'),_0x2044c[_0xbb70('0x1c')]),_0x2044c);members[_0xbb70('0x18')](_0x2044c);}catch(_0x42a6af){utils['error'](util[_0xbb70('0x1a')](_0xbb70('0x1b'),_0x2044c['device']),_0x42a6af);}});ami['on'](_0xbb70('0x1d'),function(_0x4224ff){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x1e'),_0x4224ff[_0xbb70('0x1f')]),_0x4224ff);agents[_0xbb70('0x1d')](_0x4224ff);}catch(_0x4d11ac){utils['error'](util[_0xbb70('0x1a')](_0xbb70('0x1e'),_0x4224ff['uniqueid']),_0x4d11ac);}});ami['on'](_0xbb70('0x20'),function(_0x1a3894){try{utils[_0xbb70('0x19')](util['format']('[%s][index][agentringnoanswer]',_0x1a3894[_0xbb70('0x1f')]),_0x1a3894);agents['agentringnoanswer'](_0x1a3894);}catch(_0x54b8ad){utils['error'](util[_0xbb70('0x1a')](_0xbb70('0x21'),_0x1a3894[_0xbb70('0x1f')]),_0x54b8ad);}});ami['on']('agentconnect',function(_0x10469f){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x22'),_0x10469f[_0xbb70('0x1f')]),_0x10469f);agents[_0xbb70('0x23')](_0x10469f);queues[_0xbb70('0x23')](_0x10469f);}catch(_0x5862eb){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')](_0xbb70('0x22'),_0x10469f['uniqueid']),_0x5862eb);}});ami['on'](_0xbb70('0x24'),function(_0xd1ac6a){try{utils[_0xbb70('0x19')](util['format'](_0xbb70('0x25'),_0xd1ac6a[_0xbb70('0x1f')]),_0xd1ac6a);agents[_0xbb70('0x24')](_0xd1ac6a);queues[_0xbb70('0x24')](_0xd1ac6a);members[_0xbb70('0x24')](_0xd1ac6a);}catch(_0x5a0944){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')]('[%s][index][agentcomplete]',_0xd1ac6a[_0xbb70('0x1f')]),_0x5a0944);}});ami['on']('queuecallerabandon',function(_0xc90fce){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x26'),_0xc90fce[_0xbb70('0x1f')]),_0xc90fce);agents[_0xbb70('0x27')](_0xc90fce);queues[_0xbb70('0x27')](_0xc90fce);}catch(_0x5f2383){utils[_0xbb70('0x15')](util['format'](_0xbb70('0x26'),_0xc90fce[_0xbb70('0x1f')]),_0x5f2383);}});ami['on']('queuecallerjoin',function(_0x29c264){try{utils['debug'](util['format'](_0xbb70('0x28'),_0x29c264[_0xbb70('0x1f')]),_0x29c264);queues[_0xbb70('0x29')](_0x29c264);recordings[_0xbb70('0x29')](_0x29c264);}catch(_0x26cc66){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')]('[%s][index][queuecallerjoin]',_0x29c264[_0xbb70('0x1f')]),_0x26cc66);}});ami['on'](_0xbb70('0x2a'),function(_0x4ab3d1){try{utils[_0xbb70('0x19')](util['format']('[%s][index][queuecallerleave]',_0x4ab3d1['uniqueid']),_0x4ab3d1);queues[_0xbb70('0x2a')](_0x4ab3d1);}catch(_0x5b7efb){utils['error'](util[_0xbb70('0x1a')]('[%s][index][queuecallerleave]',_0x4ab3d1[_0xbb70('0x1f')]),_0x5b7efb);}});ami['on'](_0xbb70('0x2b'),function(_0x148626){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x2c'),_0x148626[_0xbb70('0x1f')]),_0x148626);queues['musiconholdstart'](_0x148626);calls['musiconholdstart'](_0x148626);}catch(_0x2e3d11){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')](_0xbb70('0x2c'),_0x148626[_0xbb70('0x1f')]),_0x2e3d11);}});ami['on'](_0xbb70('0x2d'),function(_0x5a3826){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')]('[%s][index][musiconholdstop]',_0x5a3826[_0xbb70('0x1f')]),_0x5a3826);queues[_0xbb70('0x2d')](_0x5a3826);calls[_0xbb70('0x2d')](_0x5a3826);}catch(_0x574dea){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')](_0xbb70('0x2e'),_0x5a3826['uniqueid']),_0x574dea);}});ami['on'](_0xbb70('0x2f'),function(_0x261308){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')]('[%s][index][newstate]',_0x261308[_0xbb70('0x1f')]),_0x261308);calls[_0xbb70('0x2f')](_0x261308);recordings[_0xbb70('0x2f')](_0x261308);}catch(_0x5cc097){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')]('[%s][index][newstate]',_0x261308[_0xbb70('0x1f')]),_0x5cc097);}});ami['on'](_0xbb70('0x30'),function(_0x301ca3){try{utils[_0xbb70('0x19')](util['format']('[%s][index][hangup]',_0x301ca3[_0xbb70('0x1f')]),_0x301ca3);calls['hangup'](_0x301ca3);recordings[_0xbb70('0x30')](_0x301ca3);dials[_0xbb70('0x30')](_0x301ca3);agents[_0xbb70('0x30')](_0x301ca3);queues['hangup'](_0x301ca3);}catch(_0x1e480a){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')](_0xbb70('0x31'),_0x301ca3['uniqueid']),_0x1e480a);}});ami['on']('cdr',function(_0x1f613a){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')]('[%s][index][cdr]',_0x1f613a[_0xbb70('0x1f')]),_0x1f613a);members[_0xbb70('0x32')](_0x1f613a);}catch(_0x500b56){utils['error'](util[_0xbb70('0x1a')](_0xbb70('0x33'),_0x1f613a[_0xbb70('0x1f')]),_0x500b56);}});ami['on']('blindtransfer',function(_0x43370c){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x34'),_0x43370c['uniqueid']),_0x43370c);queues[_0xbb70('0x35')](_0x43370c);agents[_0xbb70('0x35')](_0x43370c);transfers[_0xbb70('0x35')](_0x43370c);}catch(_0x32dba7){utils[_0xbb70('0x15')](util['format'](_0xbb70('0x34'),_0x43370c[_0xbb70('0x1f')]),_0x32dba7);}});ami['on']('attendedtransfer',function(_0x400cfa){try{utils['debug'](util['format'](_0xbb70('0x36'),_0x400cfa[_0xbb70('0x37')]),_0x400cfa);queues['attendedtransfer'](_0x400cfa);transfers[_0xbb70('0x38')](_0x400cfa);agents[_0xbb70('0x38')](_0x400cfa);calls[_0xbb70('0x38')](_0x400cfa);}catch(_0x4867d7){utils['error'](util[_0xbb70('0x1a')]('[%s][index][attendedtransfer]',_0x400cfa[_0xbb70('0x37')]),_0x4867d7);}});ami['on']('varset',function(_0x28b68a){try{utils['debug'](util[_0xbb70('0x1a')](_0xbb70('0x39'),_0x28b68a['uniqueid']),_0x28b68a);queues[_0xbb70('0x3a')](_0x28b68a);recordings[_0xbb70('0x3a')](_0x28b68a);calls[_0xbb70('0x3a')](_0x28b68a);dials['varset'](_0x28b68a);}catch(_0x2342a7){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')]('[%s][index][varset]',_0x28b68a[_0xbb70('0x1f')]),_0x2342a7);}});ami['on']('newexten',function(_0x3d7281){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x3b'),_0x3d7281[_0xbb70('0x1f')]),_0x3d7281);calls['newexten'](_0x3d7281);recordings[_0xbb70('0x3c')](_0x3d7281);dials['newexten'](_0x3d7281);}catch(_0x596643){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')]('[%s][index][newexten]',_0x3d7281['uniqueid']),_0x596643);}});ami['on'](_0xbb70('0x3d'),function(_0x175a03){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x3e'),_0x175a03[_0xbb70('0x1f')]),_0x175a03);calls[_0xbb70('0x3d')](_0x175a03);recordings['newchannel'](_0x175a03);}catch(_0x6d21ed){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')](_0xbb70('0x3e'),_0x175a03['uniqueid']),_0x6d21ed);}});ami['on']('dialbegin',function(_0xc77f8d){try{utils[_0xbb70('0x19')](util[_0xbb70('0x1a')](_0xbb70('0x3f'),_0xc77f8d[_0xbb70('0x1f')]),_0xc77f8d);dials[_0xbb70('0x40')](_0xc77f8d);}catch(_0x4a113d){utils['error'](util[_0xbb70('0x1a')](_0xbb70('0x41'),_0xc77f8d[_0xbb70('0x1f')]),_0x4a113d);}});ami['on'](_0xbb70('0x42'),function(_0x12d180){try{utils['debug'](util[_0xbb70('0x1a')](_0xbb70('0x43'),_0x12d180['uniqueid']),_0x12d180);dials[_0xbb70('0x42')](_0x12d180);}catch(_0xf49bb4){utils[_0xbb70('0x15')](util[_0xbb70('0x1a')](_0xbb70('0x43'),_0x12d180[_0xbb70('0x1f')]),_0xf49bb4);}});} \ No newline at end of file +var _0x05fb=['asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','./agents.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','uniqueid','format','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]'];(function(_0x1d99c4,_0x5cda95){var _0x504ee5=function(_0x586aca){while(--_0x586aca){_0x1d99c4['push'](_0x1d99c4['shift']());}};_0x504ee5(++_0x5cda95);}(_0x05fb,0x1b9));var _0xb05f=function(_0x330293,_0x25f3e6){_0x330293=_0x330293-0x0;var _0xa1e41a=_0x05fb[_0x330293];return _0xa1e41a;};var AsteriskManager=require(_0xb05f('0x0'));var config=require(_0xb05f('0x1'));var utils=require(_0xb05f('0x2'));var util=require(_0xb05f('0x3'));var ami=new AsteriskManager(config[_0xb05f('0x4')][_0xb05f('0x5')],config[_0xb05f('0x4')]['ip'],config[_0xb05f('0x4')][_0xb05f('0x6')],config['asterisk'][_0xb05f('0x7')],!![]);ami[_0xb05f('0x8')]();if(config[_0xb05f('0x9')]&&config[_0xb05f('0x9')][_0xb05f('0xa')]){utils[_0xb05f('0xb')]('XDR\x20DISABLED');}else{var agents=require(_0xb05f('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xb05f('0xd'));var dials=require('./dials.controller');var transfers=require(_0xb05f('0xe'));var core=require('./core.controller');ami['on'](_0xb05f('0xf'),core[_0xb05f('0xf')]);ami['on']('shutdown',core[_0xb05f('0x10')]);ami['on'](_0xb05f('0x11'),core['fullybooted']);ami['on'](_0xb05f('0x12'),core[_0xb05f('0x12')]);ami['on'](_0xb05f('0x13'),core[_0xb05f('0x13')]);ami['on'](_0xb05f('0x14'),core[_0xb05f('0x14')]);ami['on'](_0xb05f('0x15'),function(_0x18358d){try{utils['debug'](util['format'](_0xb05f('0x16'),_0x18358d[_0xb05f('0x17')]),_0x18358d);members[_0xb05f('0x15')](_0x18358d);}catch(_0x549d62){utils['error'](util['format'](_0xb05f('0x16'),_0x18358d[_0xb05f('0x17')]),_0x549d62);}});ami['on'](_0xb05f('0x18'),function(_0x4eda92){try{utils[_0xb05f('0x19')](util['format']('[%s][index][agentcalled]',_0x4eda92[_0xb05f('0x1a')]),_0x4eda92);agents['agentcalled'](_0x4eda92);}catch(_0x1ec4a6){utils['error'](util[_0xb05f('0x1b')](_0xb05f('0x1c'),_0x4eda92[_0xb05f('0x1a')]),_0x1ec4a6);}});ami['on']('agentringnoanswer',function(_0x308e6f){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x1d'),_0x308e6f[_0xb05f('0x1a')]),_0x308e6f);agents[_0xb05f('0x1e')](_0x308e6f);}catch(_0x53d270){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')](_0xb05f('0x1d'),_0x308e6f[_0xb05f('0x1a')]),_0x53d270);}});ami['on'](_0xb05f('0x1f'),function(_0x5180d3){try{utils[_0xb05f('0x19')](util['format']('[%s][index][agentconnect]',_0x5180d3[_0xb05f('0x1a')]),_0x5180d3);agents[_0xb05f('0x1f')](_0x5180d3);queues[_0xb05f('0x1f')](_0x5180d3);}catch(_0x4212e8){utils[_0xb05f('0x12')](util['format']('[%s][index][agentconnect]',_0x5180d3[_0xb05f('0x1a')]),_0x4212e8);}});ami['on'](_0xb05f('0x20'),function(_0x4d5b83){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x21'),_0x4d5b83[_0xb05f('0x1a')]),_0x4d5b83);agents[_0xb05f('0x20')](_0x4d5b83);queues[_0xb05f('0x20')](_0x4d5b83);members[_0xb05f('0x20')](_0x4d5b83);}catch(_0x10fd4c){utils['error'](util['format']('[%s][index][agentcomplete]',_0x4d5b83[_0xb05f('0x1a')]),_0x10fd4c);}});ami['on'](_0xb05f('0x22'),function(_0x30986e){try{utils[_0xb05f('0x19')](util['format']('[%s][index][queuecallerabandon]',_0x30986e[_0xb05f('0x1a')]),_0x30986e);agents['queuecallerabandon'](_0x30986e);queues[_0xb05f('0x22')](_0x30986e);}catch(_0x442a8c){utils['error'](util[_0xb05f('0x1b')](_0xb05f('0x23'),_0x30986e['uniqueid']),_0x442a8c);}});ami['on'](_0xb05f('0x24'),function(_0x13e671){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x25'),_0x13e671['uniqueid']),_0x13e671);queues['queuecallerjoin'](_0x13e671);recordings['queuecallerjoin'](_0x13e671);}catch(_0xed726e){utils['error'](util[_0xb05f('0x1b')](_0xb05f('0x25'),_0x13e671[_0xb05f('0x1a')]),_0xed726e);}});ami['on']('queuecallerleave',function(_0x45561f){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x26'),_0x45561f['uniqueid']),_0x45561f);queues[_0xb05f('0x27')](_0x45561f);}catch(_0x12c586){utils['error'](util[_0xb05f('0x1b')](_0xb05f('0x26'),_0x45561f[_0xb05f('0x1a')]),_0x12c586);}});ami['on'](_0xb05f('0x28'),function(_0x1247c3){try{utils[_0xb05f('0x19')](util['format'](_0xb05f('0x29'),_0x1247c3[_0xb05f('0x1a')]),_0x1247c3);queues['musiconholdstart'](_0x1247c3);calls[_0xb05f('0x28')](_0x1247c3);}catch(_0x104a6e){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')](_0xb05f('0x29'),_0x1247c3[_0xb05f('0x1a')]),_0x104a6e);}});ami['on'](_0xb05f('0x2a'),function(_0x45bbb0){try{utils['debug'](util['format'](_0xb05f('0x2b'),_0x45bbb0['uniqueid']),_0x45bbb0);queues['musiconholdstop'](_0x45bbb0);calls[_0xb05f('0x2a')](_0x45bbb0);}catch(_0x1f9f09){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')]('[%s][index][musiconholdstop]',_0x45bbb0[_0xb05f('0x1a')]),_0x1f9f09);}});ami['on']('newstate',function(_0x429d46){try{utils['debug'](util[_0xb05f('0x1b')](_0xb05f('0x2c'),_0x429d46[_0xb05f('0x1a')]),_0x429d46);calls[_0xb05f('0x2d')](_0x429d46);recordings['newstate'](_0x429d46);}catch(_0x2cccf6){utils['error'](util[_0xb05f('0x1b')](_0xb05f('0x2c'),_0x429d46['uniqueid']),_0x2cccf6);}});ami['on'](_0xb05f('0x2e'),function(_0x5231e7){try{utils[_0xb05f('0x19')](util['format']('[%s][index][hangup]',_0x5231e7[_0xb05f('0x1a')]),_0x5231e7);calls[_0xb05f('0x2e')](_0x5231e7);recordings[_0xb05f('0x2e')](_0x5231e7);dials[_0xb05f('0x2e')](_0x5231e7);agents['hangup'](_0x5231e7);queues[_0xb05f('0x2e')](_0x5231e7);}catch(_0x3f11e4){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')]('[%s][index][hangup]',_0x5231e7[_0xb05f('0x1a')]),_0x3f11e4);}});ami['on'](_0xb05f('0x2f'),function(_0xe2f8d3){try{utils['debug'](util[_0xb05f('0x1b')]('[%s][index][cdr]',_0xe2f8d3[_0xb05f('0x1a')]),_0xe2f8d3);members[_0xb05f('0x2f')](_0xe2f8d3);}catch(_0x2c3ded){utils['error'](util['format']('[%s][index][cdr]',_0xe2f8d3['uniqueid']),_0x2c3ded);}});ami['on'](_0xb05f('0x30'),function(_0x168e47){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x31'),_0x168e47[_0xb05f('0x1a')]),_0x168e47);queues[_0xb05f('0x30')](_0x168e47);agents[_0xb05f('0x30')](_0x168e47);transfers[_0xb05f('0x30')](_0x168e47);}catch(_0x52ebb9){utils['error'](util[_0xb05f('0x1b')]('[%s][index][blindtransfer]',_0x168e47['uniqueid']),_0x52ebb9);}});ami['on']('attendedtransfer',function(_0x28c4cd){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x32'),_0x28c4cd[_0xb05f('0x33')]),_0x28c4cd);queues[_0xb05f('0x34')](_0x28c4cd);transfers['attendedtransfer'](_0x28c4cd);agents[_0xb05f('0x34')](_0x28c4cd);calls[_0xb05f('0x34')](_0x28c4cd);}catch(_0x565ad9){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')]('[%s][index][attendedtransfer]',_0x28c4cd[_0xb05f('0x33')]),_0x565ad9);}});ami['on'](_0xb05f('0x35'),function(_0x5810fe){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x36'),_0x5810fe[_0xb05f('0x1a')]),_0x5810fe);queues[_0xb05f('0x35')](_0x5810fe);recordings[_0xb05f('0x35')](_0x5810fe);calls[_0xb05f('0x35')](_0x5810fe);dials[_0xb05f('0x35')](_0x5810fe);}catch(_0x5dc2bd){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')](_0xb05f('0x36'),_0x5810fe[_0xb05f('0x1a')]),_0x5dc2bd);}});ami['on'](_0xb05f('0x37'),function(_0x3ee130){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')]('[%s][index][newexten]',_0x3ee130['uniqueid']),_0x3ee130);calls[_0xb05f('0x37')](_0x3ee130);recordings[_0xb05f('0x37')](_0x3ee130);dials[_0xb05f('0x37')](_0x3ee130);}catch(_0x356661){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')](_0xb05f('0x38'),_0x3ee130[_0xb05f('0x1a')]),_0x356661);}});ami['on']('newchannel',function(_0x531c4d){try{utils['debug'](util[_0xb05f('0x1b')](_0xb05f('0x39'),_0x531c4d['uniqueid']),_0x531c4d);calls[_0xb05f('0x3a')](_0x531c4d);recordings['newchannel'](_0x531c4d);}catch(_0x47c032){utils['error'](util[_0xb05f('0x1b')](_0xb05f('0x39'),_0x531c4d['uniqueid']),_0x47c032);}});ami['on'](_0xb05f('0x3b'),function(_0x3623ee){try{utils[_0xb05f('0x19')](util[_0xb05f('0x1b')](_0xb05f('0x3c'),_0x3623ee[_0xb05f('0x1a')]),_0x3623ee);dials[_0xb05f('0x3b')](_0x3623ee);}catch(_0x211178){utils[_0xb05f('0x12')](util[_0xb05f('0x1b')](_0xb05f('0x3d'),_0x3623ee['uniqueid']),_0x211178);}});ami['on']('dialend',function(_0xb09654){try{utils[_0xb05f('0x19')](util['format'](_0xb05f('0x3e'),_0xb09654[_0xb05f('0x1a')]),_0xb09654);dials['dialend'](_0xb09654);}catch(_0x1506ba){utils['error'](util[_0xb05f('0x1b')](_0xb05f('0x3e'),_0xb09654[_0xb05f('0x1a')]),_0x1506ba);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d4e7563..763ac30 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 _0x5832=['assign','channel','data1','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','[%s][members][cdr]','lodash','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','split','name','error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','now','duration','diffTime','enterAt','agentcomplete','isNil','debug','[%s][members][agentcomplete]','queue'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x5832,0xf8));var _0x2583=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0x5832[_0x388b47];return _0x4859df;};'use strict';var _=require(_0x2583('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x2583('0x1'),_0x2583('0x2')];function writeDB(_0x37f24d){utils[_0x2583('0x3')](util[_0x2583('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x37f24d[_0x2583('0x5')],_0x37f24d[_0x2583('0x6')],_0x37f24d['channel'],_0x37f24d[_0x2583('0x7')],_0x37f24d[_0x2583('0x8')],_0x37f24d[_0x2583('0x9')]));if(_0x37f24d[_0x2583('0x6')]){utils[_0x2583('0xa')](_0x37f24d[_0x2583('0x6')])[_0x2583('0xb')](function(_0x393e90){if(_0x393e90){_0x37f24d[_0x2583('0x8')]=_0x393e90['name'];_0x37f24d[_0x2583('0xc')]=_0x393e90[_0x2583('0xc')];utils[_0x2583('0xd')](_0x2583('0xe'),_0x37f24d);}else{utils['getUserByName'](_0x37f24d['interface'][_0x2583('0xf')]('/')[0x1])[_0x2583('0xb')](function(_0x14d082){if(_0x14d082){_0x37f24d['membername']=_0x14d082[_0x2583('0x10')];_0x37f24d[_0x2583('0xc')]=_0x14d082[_0x2583('0xc')];utils[_0x2583('0xd')](_0x2583('0xe'),_0x37f24d);}});}})['catch'](function(_0x2743ff){utils[_0x2583('0x11')](util[_0x2583('0x4')](_0x2583('0x12'),_0x37f24d['uniqueid']),_0x2743ff);});}delete members[_0x37f24d[_0x2583('0x6')]];}function startsWith(_0x371751,_0x34c18c){return _[_0x2583('0x13')](_0x371751,function(_0x4be026){return _[_0x2583('0x14')](_0x34c18c,_0x4be026);});}exports[_0x2583('0x15')]=function(_0x5f0d69){try{utils['debug'](util[_0x2583('0x4')](_0x2583('0x16'),members[_0x5f0d69[_0x2583('0x17')]]?members[_0x5f0d69[_0x2583('0x17')]][_0x2583('0x5')]:_0x5f0d69[_0x2583('0x17')]),_0x5f0d69);utils['info'](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5f0d69[_0x2583('0x17')]]?members[_0x5f0d69[_0x2583('0x17')]][_0x2583('0x5')]:_0x5f0d69[_0x2583('0x17')],_0x5f0d69[_0x2583('0x18')],_0x5f0d69[_0x2583('0x17')]));switch(_0x5f0d69[_0x2583('0x18')]){case'INUSE':case _0x2583('0x19'):if(!startsWith(exclude,_0x5f0d69['device'])){members[_0x5f0d69[_0x2583('0x17')]]={'channel':_0x2583('0x1a'),'interface':_0x5f0d69[_0x2583('0x17')],'type':_0x2583('0x1b'),'enterAt':utils['now'](),'role':_0x2583('0x1c')};}break;case _0x2583('0x1d'):if(!_['isNil'](members[_0x5f0d69['device']])){members[_0x5f0d69[_0x2583('0x17')]][_0x2583('0x1e')]=utils[_0x2583('0x1f')]();members[_0x5f0d69[_0x2583('0x17')]][_0x2583('0x20')]=utils[_0x2583('0x21')](members[_0x5f0d69['device']][_0x2583('0x1e')],members[_0x5f0d69[_0x2583('0x17')]][_0x2583('0x22')]);if(members[_0x5f0d69[_0x2583('0x17')]][_0x2583('0x5')]){writeDB(members[_0x5f0d69[_0x2583('0x17')]]);}}break;default:break;}}catch(_0x8f61e8){utils[_0x2583('0x11')](util[_0x2583('0x4')](_0x2583('0x16'),members[_0x5f0d69['device']]?members[_0x5f0d69[_0x2583('0x17')]][_0x2583('0x5')]:_0x5f0d69[_0x2583('0x17')]),_0x8f61e8);}};exports[_0x2583('0x23')]=function(_0x227be1){try{if(!_[_0x2583('0x24')](members[_0x227be1[_0x2583('0x6')]])){utils[_0x2583('0x25')](util['format'](_0x2583('0x26'),_0x227be1[_0x2583('0x5')]),_0x227be1);utils[_0x2583('0x3')](util[_0x2583('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x227be1[_0x2583('0x5')],_0x227be1['interface'],_0x227be1[_0x2583('0x27')]));members[_0x227be1[_0x2583('0x6')]]=_[_0x2583('0x28')](members[_0x227be1[_0x2583('0x6')]],{'data4':_0x227be1['queue'],'uniqueid':_0x227be1[_0x2583('0x5')]});}}catch(_0x1605c4){utils[_0x2583('0x11')](util[_0x2583('0x4')](_0x2583('0x26'),_0x227be1[_0x2583('0x5')]),_0x1605c4);}};exports['cdr']=function(_0x36eacd){try{utils[_0x2583('0x25')](util[_0x2583('0x4')]('[%s][members][cdr]',_0x36eacd[_0x2583('0x5')]),_0x36eacd);if(_0x36eacd[_0x2583('0x29')]){var _0x2f9e85=_0x36eacd['channel'][_0x2583('0xf')]('-')[0x0];if(!_[_0x2583('0x24')](members[_0x2f9e85])){members[_0x2f9e85]=_[_0x2583('0x28')](members[_0x2f9e85],{'data1':members[_0x2f9e85][_0x2583('0x2a')]||_0x36eacd['type'],'data2':members[_0x2f9e85][_0x2583('0x7')]||_0x36eacd['source'],'data3':members[_0x2f9e85][_0x2583('0x2b')]||_0x36eacd['destination'],'uniqueid':members[_0x2f9e85][_0x2583('0x5')]||_0x36eacd[_0x2583('0x5')]});utils[_0x2583('0x3')](util[_0x2583('0x4')](_0x2583('0x2c'),_0x36eacd[_0x2583('0x5')],members[_0x2f9e85]['data1'],members[_0x2f9e85][_0x2583('0x7')],members[_0x2f9e85][_0x2583('0x2b')]));if(members[_0x2f9e85][_0x2583('0x1e')]){writeDB(members[_0x2f9e85]);}}}if(_0x36eacd[_0x2583('0x2d')]){var _0x8d265f=_0x36eacd[_0x2583('0x2d')][_0x2583('0xf')]('-')[0x0];if(!_[_0x2583('0x24')](members[_0x8d265f])){members[_0x8d265f]=_[_0x2583('0x28')](members[_0x8d265f],{'data1':members[_0x8d265f][_0x2583('0x2a')]||_0x36eacd[_0x2583('0x9')],'data2':members[_0x8d265f][_0x2583('0x7')]||_0x36eacd['source'],'data3':members[_0x8d265f][_0x2583('0x2b')]||_0x36eacd[_0x2583('0x2e')],'uniqueid':members[_0x8d265f][_0x2583('0x5')]||_0x36eacd['uniqueid']});utils['info'](util[_0x2583('0x4')](_0x2583('0x2c'),_0x36eacd[_0x2583('0x5')],members[_0x8d265f][_0x2583('0x2a')],members[_0x8d265f][_0x2583('0x7')],members[_0x8d265f]['data3']));if(members[_0x8d265f]['exitAt']){writeDB(members[_0x8d265f]);}}}}catch(_0x7d10e7){utils[_0x2583('0x11')](util[_0x2583('0x4')](_0x2583('0x2f'),_0x36eacd[_0x2583('0x5')]),_0x7d10e7);}}; \ No newline at end of file +var _0x3268=['uniqueid','interface','channel','data2','membername','getUserByInterface','then','name','internal','request','split','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','INUSE','BUSY','TALKING','now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s'];(function(_0x846906,_0x68c286){var _0x3fcffa=function(_0x544ebb){while(--_0x544ebb){_0x846906['push'](_0x846906['shift']());}};_0x3fcffa(++_0x68c286);}(_0x3268,0xc6));var _0x8326=function(_0x2aa68e,_0x3d00ec){_0x2aa68e=_0x2aa68e-0x0;var _0xdc4658=_0x3268[_0x2aa68e];return _0xdc4658;};'use strict';var _=require(_0x8326('0x0'));var util=require(_0x8326('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x8326('0x2')];function writeDB(_0x1a160b){utils[_0x8326('0x3')](util[_0x8326('0x4')](_0x8326('0x5'),_0x1a160b[_0x8326('0x6')],_0x1a160b[_0x8326('0x7')],_0x1a160b[_0x8326('0x8')],_0x1a160b[_0x8326('0x9')],_0x1a160b[_0x8326('0xa')],_0x1a160b['type']));if(_0x1a160b[_0x8326('0x7')]){utils[_0x8326('0xb')](_0x1a160b[_0x8326('0x7')])[_0x8326('0xc')](function(_0x40a6d5){if(_0x40a6d5){_0x1a160b[_0x8326('0xa')]=_0x40a6d5[_0x8326('0xd')];_0x1a160b[_0x8326('0xe')]=_0x40a6d5[_0x8326('0xe')];utils[_0x8326('0xf')]('CreateMemberReport',_0x1a160b);}else{utils['getUserByName'](_0x1a160b['interface'][_0x8326('0x10')]('/')[0x1])[_0x8326('0xc')](function(_0x47138c){if(_0x47138c){_0x1a160b[_0x8326('0xa')]=_0x47138c['name'];_0x1a160b[_0x8326('0xe')]=_0x47138c[_0x8326('0xe')];utils['request'](_0x8326('0x11'),_0x1a160b);}});}})[_0x8326('0x12')](function(_0x1414bb){utils[_0x8326('0x13')](util[_0x8326('0x4')](_0x8326('0x14'),_0x1a160b['uniqueid']),_0x1414bb);});}delete members[_0x1a160b[_0x8326('0x7')]];}function startsWith(_0x597612,_0x1a483f){return _[_0x8326('0x15')](_0x597612,function(_0x240515){return _[_0x8326('0x16')](_0x1a483f,_0x240515);});}exports['devicestatechange']=function(_0x50fc1a){try{utils[_0x8326('0x17')](util[_0x8326('0x4')](_0x8326('0x18'),members[_0x50fc1a['device']]?members[_0x50fc1a['device']][_0x8326('0x6')]:_0x50fc1a['device']),_0x50fc1a);utils[_0x8326('0x3')](util['format'](_0x8326('0x19'),members[_0x50fc1a[_0x8326('0x1a')]]?members[_0x50fc1a[_0x8326('0x1a')]][_0x8326('0x6')]:_0x50fc1a['device'],_0x50fc1a[_0x8326('0x1b')],_0x50fc1a[_0x8326('0x1a')]));switch(_0x50fc1a['state']){case _0x8326('0x1c'):case _0x8326('0x1d'):if(!startsWith(exclude,_0x50fc1a['device'])){members[_0x50fc1a[_0x8326('0x1a')]]={'channel':'voice','interface':_0x50fc1a['device'],'type':_0x8326('0x1e'),'enterAt':utils[_0x8326('0x1f')](),'role':_0x8326('0x20')};}break;case'NOT_INUSE':if(!_[_0x8326('0x21')](members[_0x50fc1a['device']])){members[_0x50fc1a[_0x8326('0x1a')]][_0x8326('0x22')]=utils[_0x8326('0x1f')]();members[_0x50fc1a[_0x8326('0x1a')]][_0x8326('0x23')]=utils[_0x8326('0x24')](members[_0x50fc1a[_0x8326('0x1a')]][_0x8326('0x22')],members[_0x50fc1a[_0x8326('0x1a')]][_0x8326('0x25')]);if(members[_0x50fc1a[_0x8326('0x1a')]]['uniqueid']){writeDB(members[_0x50fc1a[_0x8326('0x1a')]]);}}break;default:break;}}catch(_0x117bc2){utils[_0x8326('0x13')](util[_0x8326('0x4')](_0x8326('0x18'),members[_0x50fc1a['device']]?members[_0x50fc1a[_0x8326('0x1a')]]['uniqueid']:_0x50fc1a[_0x8326('0x1a')]),_0x117bc2);}};exports[_0x8326('0x26')]=function(_0x49a76d){try{if(!_[_0x8326('0x21')](members[_0x49a76d[_0x8326('0x7')]])){utils[_0x8326('0x17')](util[_0x8326('0x4')]('[%s][members][agentcomplete]',_0x49a76d[_0x8326('0x6')]),_0x49a76d);utils[_0x8326('0x3')](util[_0x8326('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x49a76d['uniqueid'],_0x49a76d[_0x8326('0x7')],_0x49a76d[_0x8326('0x27')]));members[_0x49a76d[_0x8326('0x7')]]=_[_0x8326('0x28')](members[_0x49a76d[_0x8326('0x7')]],{'data4':_0x49a76d['queue'],'uniqueid':_0x49a76d['uniqueid']});}}catch(_0x224087){utils[_0x8326('0x13')](util['format'](_0x8326('0x29'),_0x49a76d['uniqueid']),_0x224087);}};exports[_0x8326('0x2a')]=function(_0x1ae200){try{utils[_0x8326('0x17')](util[_0x8326('0x4')](_0x8326('0x2b'),_0x1ae200[_0x8326('0x6')]),_0x1ae200);if(_0x1ae200['channel']){var _0x40aeac=_0x1ae200[_0x8326('0x8')][_0x8326('0x10')]('-')[0x0];if(!_[_0x8326('0x21')](members[_0x40aeac])){members[_0x40aeac]=_['assign'](members[_0x40aeac],{'data1':members[_0x40aeac][_0x8326('0x2c')]||_0x1ae200[_0x8326('0x2d')],'data2':members[_0x40aeac][_0x8326('0x9')]||_0x1ae200[_0x8326('0x2e')],'data3':members[_0x40aeac][_0x8326('0x2f')]||_0x1ae200[_0x8326('0x30')],'uniqueid':members[_0x40aeac][_0x8326('0x6')]||_0x1ae200['uniqueid']});utils['info'](util[_0x8326('0x4')](_0x8326('0x31'),_0x1ae200[_0x8326('0x6')],members[_0x40aeac][_0x8326('0x2c')],members[_0x40aeac]['data2'],members[_0x40aeac]['data3']));if(members[_0x40aeac][_0x8326('0x22')]){writeDB(members[_0x40aeac]);}}}if(_0x1ae200['destinationchannel']){var _0x2dbd6a=_0x1ae200[_0x8326('0x32')]['split']('-')[0x0];if(!_[_0x8326('0x21')](members[_0x2dbd6a])){members[_0x2dbd6a]=_['assign'](members[_0x2dbd6a],{'data1':members[_0x2dbd6a]['data1']||_0x1ae200[_0x8326('0x2d')],'data2':members[_0x2dbd6a]['data2']||_0x1ae200[_0x8326('0x2e')],'data3':members[_0x2dbd6a][_0x8326('0x2f')]||_0x1ae200[_0x8326('0x30')],'uniqueid':members[_0x2dbd6a][_0x8326('0x6')]||_0x1ae200[_0x8326('0x6')]});utils['info'](util[_0x8326('0x4')](_0x8326('0x31'),_0x1ae200[_0x8326('0x6')],members[_0x2dbd6a][_0x8326('0x2c')],members[_0x2dbd6a][_0x8326('0x9')],members[_0x2dbd6a][_0x8326('0x2f')]));if(members[_0x2dbd6a][_0x8326('0x22')]){writeDB(members[_0x2dbd6a]);}}}}catch(_0x521e68){utils['error'](util['format'](_0x8326('0x2b'),_0x1ae200[_0x8326('0x6')]),_0x521e68);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 1dee859..13b3b35 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 _0xcaaf=['lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','info','position','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','[%s][queues][varset]','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','lastAssignedTo','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','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','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s'];(function(_0x2c826b,_0xadaf9e){var _0x22603f=function(_0x5c3782){while(--_0x5c3782){_0x2c826b['push'](_0x2c826b['shift']());}};_0x22603f(++_0xadaf9e);}(_0xcaaf,0x66));var _0xfcaa=function(_0x5307dc,_0x1546e3){_0x5307dc=_0x5307dc-0x0;var _0x68fce=_0xcaaf[_0x5307dc];return _0x68fce;};'use strict';var _=require(_0xfcaa('0x0'));var util=require('util');var utils=require(_0xfcaa('0x1'));var queues={};function writeDB(_0x514aaf){utils['info'](util[_0xfcaa('0x2')](_0xfcaa('0x3'),_0x514aaf['uniqueid'],_0x514aaf[_0xfcaa('0x4')],_0x514aaf['queue'],_0x514aaf['lastAssignedTo'],_0x514aaf[_0xfcaa('0x5')],_0x514aaf[_0xfcaa('0x6')],_0x514aaf[_0xfcaa('0x7')]));if(_0x514aaf[_0xfcaa('0x8')]){utils[_0xfcaa('0x9')](_0x514aaf[_0xfcaa('0x8')])[_0xfcaa('0xa')](function(_0x4ee7d3){if(_0x4ee7d3){_0x514aaf[_0xfcaa('0xb')]=_0x4ee7d3['type'];}utils[_0xfcaa('0xc')]('CreateVoiceQueueReport',_0x514aaf);});}else{utils[_0xfcaa('0xc')]('CreateVoiceQueueReport',_0x514aaf);}if(_0x514aaf['transfereduniqueid']){delete queues[_0x514aaf[_0xfcaa('0xd')]];}else{delete queues[_0x514aaf['uniqueid']];}}exports[_0xfcaa('0xe')]=function(_0x2e83f8){try{utils[_0xfcaa('0xf')](util[_0xfcaa('0x2')](_0xfcaa('0x10'),_0x2e83f8[_0xfcaa('0x11')]),_0x2e83f8);utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x2e83f8[_0xfcaa('0x11')],_0x2e83f8[_0xfcaa('0x8')],_0x2e83f8[_0xfcaa('0x13')]));queues[_0x2e83f8[_0xfcaa('0x11')]]=_['assign'](_0x2e83f8,{'originalposition':_0x2e83f8[_0xfcaa('0x13')],'queuecallerjoinAt':utils[_0xfcaa('0x14')](),'mohtime':0x0});}catch(_0x27ab5c){utils[_0xfcaa('0x15')](util['format'](_0xfcaa('0x10'),_0x2e83f8[_0xfcaa('0x11')]),_0x27ab5c);}};exports[_0xfcaa('0x16')]=function(_0x580335){try{if(!_[_0xfcaa('0x17')](queues[_0x580335[_0xfcaa('0x11')]])){utils['debug'](util[_0xfcaa('0x2')]('[%s][queues][hangup]',_0x580335['uniqueid']),_0x580335);if(queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x18')]){if(!queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x19')]&&!queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x1a')]){queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x1b')]=!![];queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x1c')]=utils['now']();queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x7')]=_0xfcaa('0x1d');}utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x1e'),_0x580335[_0xfcaa('0x11')],queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x1f')],queues[_0x580335['uniqueid']][_0xfcaa('0x7')]));writeDB(queues[_0x580335[_0xfcaa('0x11')]]);}else if(queues[_0x580335[_0xfcaa('0x11')]]['transfereduniqueid']){utils[_0xfcaa('0x12')](util['format'](_0xfcaa('0x20'),_0x580335[_0xfcaa('0x11')],queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0x1f')],queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0xd')]));queues[queues[_0x580335[_0xfcaa('0x11')]][_0xfcaa('0xd')]]=queues[_0x580335[_0xfcaa('0x11')]];queues[queues[_0x580335['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x580335['uniqueid']];}}}catch(_0x51171d){utils[_0xfcaa('0x15')](util['format'](_0xfcaa('0x21'),_0x580335[_0xfcaa('0x11')]),_0x51171d);}};exports['varset']=function(_0x1ff221){try{utils['debug'](util['format'](_0xfcaa('0x22'),_0x1ff221[_0xfcaa('0x11')]),_0x1ff221);if(!_[_0xfcaa('0x17')](_0x1ff221[_0xfcaa('0x23')]['queuestatus'])&&_0x1ff221[_0xfcaa('0x24')][_0xfcaa('0x25')]()!=='CONTINUE'){if(!_[_0xfcaa('0x17')](queues[_0x1ff221[_0xfcaa('0x11')]])){queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x19')]=![];queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x26')]=null;queues[_0x1ff221['uniqueid']][_0xfcaa('0x1a')]=!![];queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x27')]=utils[_0xfcaa('0x14')]();queues[_0x1ff221['uniqueid']][_0xfcaa('0x7')]=_0x1ff221['value'][_0xfcaa('0x25')]();utils['info'](util[_0xfcaa('0x2')](_0xfcaa('0x28'),_0x1ff221[_0xfcaa('0x11')],queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x1f')],_0x1ff221[_0xfcaa('0x24')],queues[_0x1ff221['uniqueid']][_0xfcaa('0x7')]));writeDB(queues[_0x1ff221[_0xfcaa('0x11')]]);}}else if(!_[_0xfcaa('0x17')](_0x1ff221[_0xfcaa('0x23')][_0xfcaa('0x29')])){if(!_[_0xfcaa('0x17')](queues[_0x1ff221[_0xfcaa('0x11')]])&&!queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x19')]){queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x19')]=![];queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x26')]=null;queues[_0x1ff221[_0xfcaa('0x11')]]['queuecallerexit']=!![];queues[_0x1ff221['uniqueid']][_0xfcaa('0x27')]=utils['now']();queues[_0x1ff221[_0xfcaa('0x11')]]['queuecallerexitreason']=_0xfcaa('0x2a');utils['info'](util[_0xfcaa('0x2')](_0xfcaa('0x2b'),_0x1ff221[_0xfcaa('0x11')],queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x1f')],_0x1ff221[_0xfcaa('0x24')],queues[_0x1ff221[_0xfcaa('0x11')]][_0xfcaa('0x7')]));}}}catch(_0x572ae3){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')](_0xfcaa('0x22'),_0x1ff221['uniqueid']),_0x572ae3);}};exports[_0xfcaa('0x19')]=function(_0x16eb68){try{if(!_[_0xfcaa('0x17')](queues[_0x16eb68[_0xfcaa('0x11')]])){utils[_0xfcaa('0xf')](util['format'](_0xfcaa('0x2c'),_0x16eb68[_0xfcaa('0x11')]),_0x16eb68);queues[_0x16eb68[_0xfcaa('0x11')]][_0xfcaa('0x1a')]=![];queues[_0x16eb68[_0xfcaa('0x11')]]['queuecallerexitAt']=null;queues[_0x16eb68['uniqueid']][_0xfcaa('0x19')]=!![];queues[_0x16eb68[_0xfcaa('0x11')]]['queuecallerabandonAt']=utils[_0xfcaa('0x14')]();queues[_0x16eb68[_0xfcaa('0x11')]]['queuecallerexitreason']=_0xfcaa('0x2d');utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x2e'),_0x16eb68['uniqueid'],queues[_0x16eb68[_0xfcaa('0x11')]][_0xfcaa('0x1f')],queues[_0x16eb68['uniqueid']][_0xfcaa('0x7')]));}}catch(_0xc999e7){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')](_0xfcaa('0x2c'),_0x16eb68['uniqueid']),_0xc999e7);}};exports[_0xfcaa('0x2f')]=function(_0x22c37a){try{if(!_[_0xfcaa('0x17')](queues[_0x22c37a[_0xfcaa('0x11')]])){utils[_0xfcaa('0xf')](util[_0xfcaa('0x2')](_0xfcaa('0x30'),_0x22c37a['uniqueid']),_0x22c37a);utils[_0xfcaa('0x12')](util['format'](_0xfcaa('0x31'),_0x22c37a['uniqueid'],queues[_0x22c37a[_0xfcaa('0x11')]]['name'],_0x22c37a[_0xfcaa('0x32')],_0x22c37a['connectedlinename']));queues[_0x22c37a[_0xfcaa('0x11')]][_0xfcaa('0x2f')]=!![];queues[_0x22c37a['uniqueid']][_0xfcaa('0x18')]=utils[_0xfcaa('0x14')]();queues[_0x22c37a[_0xfcaa('0x11')]][_0xfcaa('0x33')]=utils[_0xfcaa('0x34')](queues[_0x22c37a['uniqueid']][_0xfcaa('0x18')],queues[_0x22c37a[_0xfcaa('0x11')]][_0xfcaa('0x35')]);queues[_0x22c37a[_0xfcaa('0x11')]][_0xfcaa('0x13')]=_0x22c37a[_0xfcaa('0x13')];queues[_0x22c37a[_0xfcaa('0x11')]][_0xfcaa('0x36')]=_0x22c37a['count'];queues[_0x22c37a['uniqueid']]['connectedlinenum']=_0x22c37a[_0xfcaa('0x32')];queues[_0x22c37a['uniqueid']][_0xfcaa('0x37')]=_0x22c37a[_0xfcaa('0x37')];}}catch(_0xa183a7){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')](_0xfcaa('0x30'),_0x22c37a[_0xfcaa('0x11')]),_0xa183a7);}};exports[_0xfcaa('0x38')]=function(_0x4fdd07){try{if(!_[_0xfcaa('0x17')](queues[_0x4fdd07['uniqueid']])){utils[_0xfcaa('0xf')](util[_0xfcaa('0x2')](_0xfcaa('0x39'),_0x4fdd07['uniqueid']),_0x4fdd07);utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x3a'),_0x4fdd07['uniqueid'],queues[_0x4fdd07[_0xfcaa('0x11')]]['name'],_0x4fdd07[_0xfcaa('0x3b')],_0x4fdd07['destaccountcode']));queues[_0x4fdd07[_0xfcaa('0x11')]][_0xfcaa('0x19')]=![];queues[_0x4fdd07[_0xfcaa('0x11')]][_0xfcaa('0x19')]=![];queues[_0x4fdd07['uniqueid']][_0xfcaa('0x26')]=null;queues[_0x4fdd07[_0xfcaa('0x11')]]['queuecallerexit']=![];queues[_0x4fdd07[_0xfcaa('0x11')]][_0xfcaa('0x7')]=null;queues[_0x4fdd07[_0xfcaa('0x11')]][_0xfcaa('0x27')]=null;queues[_0x4fdd07['uniqueid']][_0xfcaa('0x3c')]=!![];queues[_0x4fdd07[_0xfcaa('0x11')]][_0xfcaa('0x6')]=_0x4fdd07[_0xfcaa('0x3d')];queues[_0x4fdd07['uniqueid']][_0xfcaa('0x3e')]=_0x4fdd07['membername'];}}catch(_0x353cf9){utils[_0xfcaa('0x15')](util['format'](_0xfcaa('0x39'),_0x4fdd07['uniqueid']),_0x353cf9);}};exports['agentcomplete']=function(_0xe29873){try{if(!_[_0xfcaa('0x17')](queues[_0xe29873[_0xfcaa('0x11')]])){if(queues[_0xe29873['uniqueid']]['queuecallerleaveAt']){utils[_0xfcaa('0xf')](util[_0xfcaa('0x2')](_0xfcaa('0x3f'),_0xe29873['uniqueid']),_0xe29873);queues[_0xe29873['uniqueid']][_0xfcaa('0x19')]=![];queues[_0xe29873[_0xfcaa('0x11')]][_0xfcaa('0x19')]=![];queues[_0xe29873[_0xfcaa('0x11')]][_0xfcaa('0x26')]=null;queues[_0xe29873[_0xfcaa('0x11')]]['queuecallerexit']=![];queues[_0xe29873['uniqueid']][_0xfcaa('0x27')]=null;queues[_0xe29873[_0xfcaa('0x11')]][_0xfcaa('0x3c')]=!![];queues[_0xe29873[_0xfcaa('0x11')]][_0xfcaa('0x3e')]=_0xe29873[_0xfcaa('0x3b')];queues[_0xe29873[_0xfcaa('0x11')]]['queuecallercomplete']=!![];queues[_0xe29873['uniqueid']][_0xfcaa('0x1c')]=utils[_0xfcaa('0x14')]();if(_0xe29873['reason']==_0xfcaa('0x40')){if(!queues[_0xe29873['uniqueid']][_0xfcaa('0x40')]){queues[_0xe29873[_0xfcaa('0x11')]]['queuecallerexitreason']=_0xfcaa('0x41');}}else{queues[_0xe29873[_0xfcaa('0x11')]]['queuecallerexitreason']=_0xfcaa('0x42')+_0xe29873['reason'][_0xfcaa('0x25')]();}utils[_0xfcaa('0x12')](util['format'](_0xfcaa('0x43'),_0xe29873[_0xfcaa('0x11')],queues[_0xe29873['uniqueid']][_0xfcaa('0x1f')],_0xe29873[_0xfcaa('0x3b')],queues[_0xe29873[_0xfcaa('0x11')]][_0xfcaa('0x7')]));writeDB(queues[_0xe29873[_0xfcaa('0x11')]]);}}}catch(_0x1ff00e){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')](_0xfcaa('0x3f'),_0xe29873[_0xfcaa('0x11')]),_0x1ff00e);}};exports['blindtransfer']=function(_0x33615a){try{if(!_[_0xfcaa('0x17')](queues[_0x33615a[_0xfcaa('0x44')]])){utils[_0xfcaa('0xf')](util[_0xfcaa('0x2')](_0xfcaa('0x45'),_0x33615a[_0xfcaa('0x11')]),_0x33615a);queues[_0x33615a[_0xfcaa('0x44')]][_0xfcaa('0x40')]=!![];queues[_0x33615a[_0xfcaa('0x44')]]['transfertype']=_0xfcaa('0x46');queues[_0x33615a[_0xfcaa('0x44')]][_0xfcaa('0x47')]=_0x33615a[_0xfcaa('0x48')];queues[_0x33615a[_0xfcaa('0x44')]][_0xfcaa('0x49')]=_0x33615a[_0xfcaa('0x44')];queues[_0x33615a[_0xfcaa('0x44')]][_0xfcaa('0x7')]=_0xfcaa('0x4a');utils[_0xfcaa('0x12')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x33615a[_0xfcaa('0x11')],queues[_0x33615a[_0xfcaa('0x44')]][_0xfcaa('0x1f')],_0x33615a['transfereeuniqueid'],_0x33615a[_0xfcaa('0x48')]));}}catch(_0x20e1a0){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')](_0xfcaa('0x45'),_0x33615a[_0xfcaa('0x11')]),_0x20e1a0);}};exports[_0xfcaa('0x4b')]=function(_0x88f272){try{utils[_0xfcaa('0xf')](util[_0xfcaa('0x2')](_0xfcaa('0x4c'),_0x88f272['origtransfereruniqueid']),_0x88f272);if(_0x88f272[_0xfcaa('0x4d')]==_0x88f272[_0xfcaa('0x4e')]){if(!_[_0xfcaa('0x17')](queues[_0x88f272[_0xfcaa('0x4f')]])){utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x50'),_0x88f272[_0xfcaa('0x4d')],queues[_0x88f272[_0xfcaa('0x4f')]][_0xfcaa('0x1f')],_0x88f272[_0xfcaa('0x51')]));queues[_0x88f272[_0xfcaa('0x4f')]][_0xfcaa('0x40')]=!![];queues[_0x88f272[_0xfcaa('0x4f')]][_0xfcaa('0x52')]=_0xfcaa('0x53');queues[_0x88f272['secondtransfererlinkedid']]['transferexten']=_0x88f272['origtransfererexten'];queues[_0x88f272[_0xfcaa('0x4f')]][_0xfcaa('0x49')]=_0x88f272[_0xfcaa('0x4d')];queues[_0x88f272[_0xfcaa('0x4f')]]['queuecallerexitreason']=_0xfcaa('0x54');}if(!_[_0xfcaa('0x17')](queues[_0x88f272[_0xfcaa('0x4e')]])){if(_0x88f272[_0xfcaa('0x55')]&&queues[_0x88f272[_0xfcaa('0x55')]]){queues[_0x88f272[_0xfcaa('0x55')]][_0xfcaa('0x56')]=0x1;queues[_0x88f272[_0xfcaa('0x44')]]=_[_0xfcaa('0x57')](queues[_0x88f272[_0xfcaa('0x55')]]);queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0xd')]=_0x88f272[_0xfcaa('0x58')];queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x56')]=0x2;queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x5')]=queues[_0x88f272[_0xfcaa('0x4f')]][_0xfcaa('0x5')];queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x59')]=queues[_0x88f272[_0xfcaa('0x4f')]][_0xfcaa('0x59')];queues[_0x88f272[_0xfcaa('0x44')]]['queuecallerjoinAt']=utils[_0xfcaa('0x14')]();queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x18')]=utils[_0xfcaa('0x14')]();queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x33')]=0x0;queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x5a')]=0x0;utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x5b'),_0x88f272[_0xfcaa('0x4d')],queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x1f')],queues[_0x88f272['transfereeuniqueid']][_0xfcaa('0x5')],queues[_0x88f272[_0xfcaa('0x44')]][_0xfcaa('0x59')]));}else{utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x5c'),_0x88f272['origtransfereruniqueid'],queues[_0x88f272[_0xfcaa('0x4e')]][_0xfcaa('0x1f')],_0x88f272[_0xfcaa('0x4f')]));queues[_0x88f272[_0xfcaa('0x4e')]][_0xfcaa('0xd')]=_0x88f272[_0xfcaa('0x4f')];}}}else if(_0x88f272[_0xfcaa('0x5d')]==_0x88f272[_0xfcaa('0x4f')]){if(!_[_0xfcaa('0x17')](queues[_0x88f272[_0xfcaa('0x4e')]])){utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x5e'),_0x88f272[_0xfcaa('0x4d')],queues[_0x88f272[_0xfcaa('0x4e')]]['name'],_0x88f272[_0xfcaa('0x5d')],_0x88f272[_0xfcaa('0x5f')]));queues[_0x88f272[_0xfcaa('0x4e')]][_0xfcaa('0x40')]=!![];queues[_0x88f272[_0xfcaa('0x4e')]][_0xfcaa('0x52')]='ATTENDED';queues[_0x88f272[_0xfcaa('0x4e')]][_0xfcaa('0x47')]=_0x88f272[_0xfcaa('0x5f')];queues[_0x88f272['origtransfererlinkedid']][_0xfcaa('0x49')]=_0x88f272[_0xfcaa('0x5d')];queues[_0x88f272[_0xfcaa('0x4e')]][_0xfcaa('0x7')]=_0xfcaa('0x54');}if(!_['isNil'](queues[_0x88f272[_0xfcaa('0x4f')]])){if(_0x88f272[_0xfcaa('0x60')]&&queues[_0x88f272[_0xfcaa('0x60')]]){queues[_0x88f272['transfertargetlinkedid']][_0xfcaa('0x56')]=0x1;queues[_0x88f272[_0xfcaa('0x58')]]=_[_0xfcaa('0x57')](queues[_0x88f272['transfertargetlinkedid']]);queues[_0x88f272[_0xfcaa('0x58')]][_0xfcaa('0xd')]=_0x88f272[_0xfcaa('0x58')];queues[_0x88f272['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x88f272[_0xfcaa('0x58')]][_0xfcaa('0x5')]=queues[_0x88f272[_0xfcaa('0x4e')]][_0xfcaa('0x5')];queues[_0x88f272[_0xfcaa('0x58')]][_0xfcaa('0x59')]=queues[_0x88f272[_0xfcaa('0x4e')]]['calleridname'];queues[_0x88f272['transfertargetuniqueid']][_0xfcaa('0x35')]=utils['now']();queues[_0x88f272[_0xfcaa('0x58')]]['queuecallerleaveAt']=utils[_0xfcaa('0x14')]();queues[_0x88f272[_0xfcaa('0x58')]][_0xfcaa('0x33')]=0x0;queues[_0x88f272['transfertargetuniqueid']][_0xfcaa('0x5a')]=0x0;utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x88f272['origtransfereruniqueid'],queues[_0x88f272['transfertargetuniqueid']][_0xfcaa('0x1f')],queues[_0x88f272[_0xfcaa('0x58')]][_0xfcaa('0xd')],queues[_0x88f272['transfertargetuniqueid']]['calleridnum'],queues[_0x88f272[_0xfcaa('0x58')]][_0xfcaa('0x59')]));}else{utils[_0xfcaa('0x12')](util[_0xfcaa('0x2')](_0xfcaa('0x5c'),_0x88f272['origtransfereruniqueid'],queues[_0x88f272['secondtransfererlinkedid']][_0xfcaa('0x1f')],_0x88f272[_0xfcaa('0x4e')]));queues[_0x88f272[_0xfcaa('0x4f')]][_0xfcaa('0xd')]=_0x88f272[_0xfcaa('0x4e')];}}}}catch(_0x5a89a4){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')]('[%s][queues][attendedtransfer]',_0x88f272[_0xfcaa('0x4d')]),_0x5a89a4);}};exports['musiconholdstart']=function(_0x44c231){try{if(!_[_0xfcaa('0x17')](queues[_0x44c231[_0xfcaa('0x11')]])){utils[_0xfcaa('0xf')](util['format'](_0xfcaa('0x61'),_0x44c231[_0xfcaa('0x11')]),_0x44c231);queues[_0x44c231[_0xfcaa('0x11')]][_0xfcaa('0x62')]=utils[_0xfcaa('0x14')]();utils[_0xfcaa('0x12')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x44c231[_0xfcaa('0x11')],queues[_0x44c231[_0xfcaa('0x11')]][_0xfcaa('0x1f')],queues[_0x44c231[_0xfcaa('0x11')]]['musiconholdstartAt']));}}catch(_0x22e3e3){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')]('[%s][queues][musiconholdstart]',_0x44c231[_0xfcaa('0x11')]),_0x22e3e3);}};exports[_0xfcaa('0x63')]=function(_0x1fff36){try{if(!_['isNil'](queues[_0x1fff36[_0xfcaa('0x11')]])){if(!_[_0xfcaa('0x17')](queues[_0x1fff36['uniqueid']][_0xfcaa('0x62')])){utils[_0xfcaa('0xf')](util['format'](_0xfcaa('0x64'),_0x1fff36[_0xfcaa('0x11')]),_0x1fff36);queues[_0x1fff36[_0xfcaa('0x11')]][_0xfcaa('0x5a')]+=utils[_0xfcaa('0x34')](utils[_0xfcaa('0x14')](),queues[_0x1fff36[_0xfcaa('0x11')]][_0xfcaa('0x62')]);utils['info'](util[_0xfcaa('0x2')](_0xfcaa('0x65'),_0x1fff36[_0xfcaa('0x11')],queues[_0x1fff36[_0xfcaa('0x11')]][_0xfcaa('0x1f')],queues[_0x1fff36[_0xfcaa('0x11')]]['mohtime']));delete queues[_0x1fff36[_0xfcaa('0x11')]][_0xfcaa('0x62')];}}}catch(_0x54515a){utils[_0xfcaa('0x15')](util[_0xfcaa('0x2')]('[%s][queues][musiconholdstop]',_0x1fff36[_0xfcaa('0x11')]),_0x54515a);}}; \ No newline at end of file +var _0xc0d7=['transferexten','transferuniqueid','BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','now','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','name','transfereduniqueid','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','value','toUpperCase','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','count','connectedlinenum','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype'];(function(_0x9ba44a,_0xa6c134){var _0x36f81e=function(_0x4efc71){while(--_0x4efc71){_0x9ba44a['push'](_0x9ba44a['shift']());}};_0x36f81e(++_0xa6c134);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x14bc37,_0x5817ab){_0x14bc37=_0x14bc37-0x0;var _0x365e3b=_0xc0d7[_0x14bc37];return _0x365e3b;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x9be18b){utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')](_0x7c0d('0x2'),_0x9be18b[_0x7c0d('0x3')],_0x9be18b[_0x7c0d('0x4')],_0x9be18b[_0x7c0d('0x5')],_0x9be18b[_0x7c0d('0x6')],_0x9be18b[_0x7c0d('0x7')],_0x9be18b['accountcode'],_0x9be18b[_0x7c0d('0x8')]));if(_0x9be18b[_0x7c0d('0x5')]){utils[_0x7c0d('0x9')](_0x9be18b[_0x7c0d('0x5')])['then'](function(_0x35c579){if(_0x35c579){_0x9be18b[_0x7c0d('0xa')]=_0x35c579[_0x7c0d('0xa')];}utils[_0x7c0d('0xb')]('CreateVoiceQueueReport',_0x9be18b);});}else{utils[_0x7c0d('0xb')](_0x7c0d('0xc'),_0x9be18b);}if(_0x9be18b['transfereduniqueid']){delete queues[_0x9be18b['transfereduniqueid']];}else{delete queues[_0x9be18b[_0x7c0d('0x3')]];}}exports[_0x7c0d('0xd')]=function(_0x496398){try{utils[_0x7c0d('0xe')](util[_0x7c0d('0x1')](_0x7c0d('0xf'),_0x496398[_0x7c0d('0x3')]),_0x496398);utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x496398[_0x7c0d('0x3')],_0x496398[_0x7c0d('0x5')],_0x496398[_0x7c0d('0x10')]));queues[_0x496398[_0x7c0d('0x3')]]=_[_0x7c0d('0x11')](_0x496398,{'originalposition':_0x496398[_0x7c0d('0x10')],'queuecallerjoinAt':utils[_0x7c0d('0x12')](),'mohtime':0x0});}catch(_0x13f301){utils['error'](util[_0x7c0d('0x1')]('[%s][queues][queuecallerjoin]',_0x496398[_0x7c0d('0x3')]),_0x13f301);}};exports['hangup']=function(_0x2a8f3f){try{if(!_[_0x7c0d('0x13')](queues[_0x2a8f3f[_0x7c0d('0x3')]])){utils[_0x7c0d('0xe')](util[_0x7c0d('0x1')](_0x7c0d('0x14'),_0x2a8f3f[_0x7c0d('0x3')]),_0x2a8f3f);if(queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x15')]){if(!queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x16')]&&!queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x17')]){queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x18')]=!![];queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x19')]=utils[_0x7c0d('0x12')]();queues[_0x2a8f3f[_0x7c0d('0x3')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x2a8f3f[_0x7c0d('0x3')],queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x1a')],queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x8')]));writeDB(queues[_0x2a8f3f[_0x7c0d('0x3')]]);}else if(queues[_0x2a8f3f[_0x7c0d('0x3')]]['transfereduniqueid']){utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x2a8f3f['uniqueid'],queues[_0x2a8f3f[_0x7c0d('0x3')]]['name'],queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x1b')]));queues[queues[_0x2a8f3f[_0x7c0d('0x3')]][_0x7c0d('0x1b')]]=queues[_0x2a8f3f[_0x7c0d('0x3')]];queues[queues[_0x2a8f3f['uniqueid']][_0x7c0d('0x1b')]][_0x7c0d('0x1c')]=0x2;delete queues[_0x2a8f3f[_0x7c0d('0x3')]];}}}catch(_0x1e37c6){utils[_0x7c0d('0x1d')](util['format'](_0x7c0d('0x14'),_0x2a8f3f['uniqueid']),_0x1e37c6);}};exports[_0x7c0d('0x1e')]=function(_0x1d2020){try{utils[_0x7c0d('0xe')](util[_0x7c0d('0x1')](_0x7c0d('0x1f'),_0x1d2020[_0x7c0d('0x3')]),_0x1d2020);if(!_['isNil'](_0x1d2020[_0x7c0d('0x20')]['queuestatus'])&&_0x1d2020[_0x7c0d('0x21')][_0x7c0d('0x22')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x1d2020[_0x7c0d('0x3')]])){queues[_0x1d2020['uniqueid']][_0x7c0d('0x16')]=![];queues[_0x1d2020[_0x7c0d('0x3')]]['queuecallerabandonAt']=null;queues[_0x1d2020['uniqueid']]['queuecallerexit']=!![];queues[_0x1d2020['uniqueid']][_0x7c0d('0x23')]=utils['now']();queues[_0x1d2020[_0x7c0d('0x3')]][_0x7c0d('0x8')]=_0x1d2020['value'][_0x7c0d('0x22')]();utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')](_0x7c0d('0x24'),_0x1d2020['uniqueid'],queues[_0x1d2020[_0x7c0d('0x3')]][_0x7c0d('0x1a')],_0x1d2020[_0x7c0d('0x21')],queues[_0x1d2020[_0x7c0d('0x3')]][_0x7c0d('0x8')]));writeDB(queues[_0x1d2020[_0x7c0d('0x3')]]);}}else if(!_[_0x7c0d('0x13')](_0x1d2020[_0x7c0d('0x20')][_0x7c0d('0x25')])){if(!_[_0x7c0d('0x13')](queues[_0x1d2020['uniqueid']])&&!queues[_0x1d2020[_0x7c0d('0x3')]][_0x7c0d('0x16')]){queues[_0x1d2020['uniqueid']][_0x7c0d('0x16')]=![];queues[_0x1d2020[_0x7c0d('0x3')]][_0x7c0d('0x26')]=null;queues[_0x1d2020[_0x7c0d('0x3')]][_0x7c0d('0x17')]=!![];queues[_0x1d2020[_0x7c0d('0x3')]]['queuecallerexitAt']=utils[_0x7c0d('0x12')]();queues[_0x1d2020[_0x7c0d('0x3')]][_0x7c0d('0x8')]=_0x7c0d('0x27');utils[_0x7c0d('0x0')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1d2020[_0x7c0d('0x3')],queues[_0x1d2020[_0x7c0d('0x3')]]['name'],_0x1d2020[_0x7c0d('0x21')],queues[_0x1d2020['uniqueid']][_0x7c0d('0x8')]));}}}catch(_0x544e9f){utils['error'](util[_0x7c0d('0x1')]('[%s][queues][varset]',_0x1d2020[_0x7c0d('0x3')]),_0x544e9f);}};exports[_0x7c0d('0x16')]=function(_0x5f5ba2){try{if(!_['isNil'](queues[_0x5f5ba2['uniqueid']])){utils[_0x7c0d('0xe')](util[_0x7c0d('0x1')](_0x7c0d('0x28'),_0x5f5ba2[_0x7c0d('0x3')]),_0x5f5ba2);queues[_0x5f5ba2['uniqueid']]['queuecallerexit']=![];queues[_0x5f5ba2[_0x7c0d('0x3')]]['queuecallerexitAt']=null;queues[_0x5f5ba2['uniqueid']][_0x7c0d('0x16')]=!![];queues[_0x5f5ba2['uniqueid']][_0x7c0d('0x26')]=utils[_0x7c0d('0x12')]();queues[_0x5f5ba2['uniqueid']][_0x7c0d('0x8')]=_0x7c0d('0x29');utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')](_0x7c0d('0x2a'),_0x5f5ba2['uniqueid'],queues[_0x5f5ba2[_0x7c0d('0x3')]][_0x7c0d('0x1a')],queues[_0x5f5ba2['uniqueid']][_0x7c0d('0x8')]));}}catch(_0x11f530){utils[_0x7c0d('0x1d')](util[_0x7c0d('0x1')]('[%s][queues][queuecallerabandon]',_0x5f5ba2[_0x7c0d('0x3')]),_0x11f530);}};exports[_0x7c0d('0x2b')]=function(_0x253454){try{if(!_[_0x7c0d('0x13')](queues[_0x253454[_0x7c0d('0x3')]])){utils['debug'](util[_0x7c0d('0x1')]('[%s][queues][queuecallerleave]',_0x253454[_0x7c0d('0x3')]),_0x253454);utils['info'](util[_0x7c0d('0x1')](_0x7c0d('0x2c'),_0x253454[_0x7c0d('0x3')],queues[_0x253454[_0x7c0d('0x3')]][_0x7c0d('0x1a')],_0x253454['connectedlinenum'],_0x253454[_0x7c0d('0x2d')]));queues[_0x253454['uniqueid']][_0x7c0d('0x2b')]=!![];queues[_0x253454[_0x7c0d('0x3')]][_0x7c0d('0x15')]=utils['now']();queues[_0x253454[_0x7c0d('0x3')]]['holdtime']=utils['diffTime'](queues[_0x253454[_0x7c0d('0x3')]][_0x7c0d('0x15')],queues[_0x253454[_0x7c0d('0x3')]]['queuecallerjoinAt']);queues[_0x253454[_0x7c0d('0x3')]][_0x7c0d('0x10')]=_0x253454[_0x7c0d('0x10')];queues[_0x253454['uniqueid']][_0x7c0d('0x2e')]=_0x253454[_0x7c0d('0x2e')];queues[_0x253454[_0x7c0d('0x3')]][_0x7c0d('0x2f')]=_0x253454[_0x7c0d('0x2f')];queues[_0x253454['uniqueid']]['connectedlinename']=_0x253454[_0x7c0d('0x2d')];}}catch(_0x333ebf){utils['error'](util['format'](_0x7c0d('0x30'),_0x253454[_0x7c0d('0x3')]),_0x333ebf);}};exports[_0x7c0d('0x31')]=function(_0x5ae146){try{if(!_[_0x7c0d('0x13')](queues[_0x5ae146[_0x7c0d('0x3')]])){utils[_0x7c0d('0xe')](util[_0x7c0d('0x1')](_0x7c0d('0x32'),_0x5ae146[_0x7c0d('0x3')]),_0x5ae146);utils['info'](util['format'](_0x7c0d('0x33'),_0x5ae146[_0x7c0d('0x3')],queues[_0x5ae146[_0x7c0d('0x3')]]['name'],_0x5ae146[_0x7c0d('0x34')],_0x5ae146[_0x7c0d('0x35')]));queues[_0x5ae146[_0x7c0d('0x3')]][_0x7c0d('0x16')]=![];queues[_0x5ae146['uniqueid']][_0x7c0d('0x16')]=![];queues[_0x5ae146[_0x7c0d('0x3')]][_0x7c0d('0x26')]=null;queues[_0x5ae146[_0x7c0d('0x3')]][_0x7c0d('0x17')]=![];queues[_0x5ae146['uniqueid']]['queuecallerexitreason']=null;queues[_0x5ae146[_0x7c0d('0x3')]][_0x7c0d('0x23')]=null;queues[_0x5ae146[_0x7c0d('0x3')]][_0x7c0d('0x36')]=!![];queues[_0x5ae146[_0x7c0d('0x3')]]['accountcode']=_0x5ae146[_0x7c0d('0x35')];queues[_0x5ae146[_0x7c0d('0x3')]][_0x7c0d('0x6')]=_0x5ae146['membername'];}}catch(_0x46ae19){utils[_0x7c0d('0x1d')](util['format'](_0x7c0d('0x32'),_0x5ae146[_0x7c0d('0x3')]),_0x46ae19);}};exports[_0x7c0d('0x37')]=function(_0x1cc489){try{if(!_[_0x7c0d('0x13')](queues[_0x1cc489['uniqueid']])){if(queues[_0x1cc489['uniqueid']]['queuecallerleaveAt']){utils[_0x7c0d('0xe')](util['format'](_0x7c0d('0x38'),_0x1cc489[_0x7c0d('0x3')]),_0x1cc489);queues[_0x1cc489[_0x7c0d('0x3')]]['queuecallerabandon']=![];queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x16')]=![];queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x26')]=null;queues[_0x1cc489['uniqueid']][_0x7c0d('0x17')]=![];queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x23')]=null;queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x36')]=!![];queues[_0x1cc489[_0x7c0d('0x3')]]['lastAssignedTo']=_0x1cc489['membername'];queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x18')]=!![];queues[_0x1cc489[_0x7c0d('0x3')]]['queuecallercompleteAt']=utils[_0x7c0d('0x12')]();if(_0x1cc489[_0x7c0d('0x39')]=='transfer'){if(!queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x3a')]){queues[_0x1cc489[_0x7c0d('0x3')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x8')]=_0x7c0d('0x3b')+_0x1cc489[_0x7c0d('0x39')][_0x7c0d('0x22')]();}utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')](_0x7c0d('0x3c'),_0x1cc489['uniqueid'],queues[_0x1cc489[_0x7c0d('0x3')]][_0x7c0d('0x1a')],_0x1cc489['membername'],queues[_0x1cc489[_0x7c0d('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x1cc489[_0x7c0d('0x3')]]);}}}catch(_0x53a284){utils['error'](util['format'](_0x7c0d('0x38'),_0x1cc489[_0x7c0d('0x3')]),_0x53a284);}};exports[_0x7c0d('0x3d')]=function(_0xa26bf){try{if(!_[_0x7c0d('0x13')](queues[_0xa26bf['transfereeuniqueid']])){utils[_0x7c0d('0xe')](util['format'](_0x7c0d('0x3e'),_0xa26bf[_0x7c0d('0x3')]),_0xa26bf);queues[_0xa26bf[_0x7c0d('0x3f')]][_0x7c0d('0x3a')]=!![];queues[_0xa26bf[_0x7c0d('0x3f')]][_0x7c0d('0x40')]='BLIND';queues[_0xa26bf['transfereeuniqueid']][_0x7c0d('0x41')]=_0xa26bf['extension'];queues[_0xa26bf[_0x7c0d('0x3f')]][_0x7c0d('0x42')]=_0xa26bf[_0x7c0d('0x3f')];queues[_0xa26bf[_0x7c0d('0x3f')]][_0x7c0d('0x8')]=_0x7c0d('0x43');utils['info'](util[_0x7c0d('0x1')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xa26bf[_0x7c0d('0x3')],queues[_0xa26bf['transfereeuniqueid']]['name'],_0xa26bf[_0x7c0d('0x3f')],_0xa26bf[_0x7c0d('0x44')]));}}catch(_0x58f55d){utils[_0x7c0d('0x1d')](util[_0x7c0d('0x1')](_0x7c0d('0x3e'),_0xa26bf[_0x7c0d('0x3')]),_0x58f55d);}};exports[_0x7c0d('0x45')]=function(_0xdb8150){try{utils[_0x7c0d('0xe')](util[_0x7c0d('0x1')]('[%s][queues][attendedtransfer]',_0xdb8150[_0x7c0d('0x46')]),_0xdb8150);if(_0xdb8150['origtransfereruniqueid']==_0xdb8150[_0x7c0d('0x47')]){if(!_[_0x7c0d('0x13')](queues[_0xdb8150[_0x7c0d('0x48')]])){utils[_0x7c0d('0x0')](util['format'](_0x7c0d('0x49'),_0xdb8150[_0x7c0d('0x46')],queues[_0xdb8150['secondtransfererlinkedid']][_0x7c0d('0x1a')],_0xdb8150[_0x7c0d('0x4a')]));queues[_0xdb8150[_0x7c0d('0x48')]][_0x7c0d('0x3a')]=!![];queues[_0xdb8150[_0x7c0d('0x48')]][_0x7c0d('0x40')]='ATTENDED';queues[_0xdb8150[_0x7c0d('0x48')]][_0x7c0d('0x41')]=_0xdb8150[_0x7c0d('0x4a')];queues[_0xdb8150[_0x7c0d('0x48')]][_0x7c0d('0x42')]=_0xdb8150[_0x7c0d('0x46')];queues[_0xdb8150[_0x7c0d('0x48')]]['queuecallerexitreason']=_0x7c0d('0x4b');}if(!_['isNil'](queues[_0xdb8150[_0x7c0d('0x47')]])){if(_0xdb8150[_0x7c0d('0x4c')]&&queues[_0xdb8150[_0x7c0d('0x4c')]]){queues[_0xdb8150[_0x7c0d('0x4c')]][_0x7c0d('0x1c')]=0x1;queues[_0xdb8150[_0x7c0d('0x3f')]]=_['clone'](queues[_0xdb8150['transfereelinkedid']]);queues[_0xdb8150['transfereeuniqueid']][_0x7c0d('0x1b')]=_0xdb8150['transfertargetuniqueid'];queues[_0xdb8150['transfereeuniqueid']][_0x7c0d('0x1c')]=0x2;queues[_0xdb8150[_0x7c0d('0x3f')]][_0x7c0d('0x7')]=queues[_0xdb8150[_0x7c0d('0x48')]][_0x7c0d('0x7')];queues[_0xdb8150['transfereeuniqueid']][_0x7c0d('0x4d')]=queues[_0xdb8150['secondtransfererlinkedid']][_0x7c0d('0x4d')];queues[_0xdb8150['transfereeuniqueid']][_0x7c0d('0x4e')]=utils['now']();queues[_0xdb8150[_0x7c0d('0x3f')]][_0x7c0d('0x15')]=utils[_0x7c0d('0x12')]();queues[_0xdb8150['transfereeuniqueid']][_0x7c0d('0x4f')]=0x0;queues[_0xdb8150[_0x7c0d('0x3f')]][_0x7c0d('0x50')]=0x0;utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')](_0x7c0d('0x51'),_0xdb8150[_0x7c0d('0x46')],queues[_0xdb8150['transfereeuniqueid']]['name'],queues[_0xdb8150['transfereeuniqueid']][_0x7c0d('0x7')],queues[_0xdb8150[_0x7c0d('0x3f')]]['calleridname']));}else{utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')](_0x7c0d('0x52'),_0xdb8150[_0x7c0d('0x46')],queues[_0xdb8150[_0x7c0d('0x47')]]['name'],_0xdb8150['secondtransfererlinkedid']));queues[_0xdb8150['origtransfererlinkedid']][_0x7c0d('0x1b')]=_0xdb8150['secondtransfererlinkedid'];}}}else if(_0xdb8150[_0x7c0d('0x53')]==_0xdb8150['secondtransfererlinkedid']){if(!_[_0x7c0d('0x13')](queues[_0xdb8150['origtransfererlinkedid']])){utils['info'](util[_0x7c0d('0x1')](_0x7c0d('0x54'),_0xdb8150[_0x7c0d('0x46')],queues[_0xdb8150[_0x7c0d('0x47')]][_0x7c0d('0x1a')],_0xdb8150[_0x7c0d('0x53')],_0xdb8150[_0x7c0d('0x55')]));queues[_0xdb8150[_0x7c0d('0x47')]][_0x7c0d('0x3a')]=!![];queues[_0xdb8150[_0x7c0d('0x47')]]['transfertype']='ATTENDED';queues[_0xdb8150[_0x7c0d('0x47')]][_0x7c0d('0x41')]=_0xdb8150['secondtransfererexten'];queues[_0xdb8150[_0x7c0d('0x47')]]['transferuniqueid']=_0xdb8150[_0x7c0d('0x53')];queues[_0xdb8150[_0x7c0d('0x47')]][_0x7c0d('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x7c0d('0x13')](queues[_0xdb8150['secondtransfererlinkedid']])){if(_0xdb8150[_0x7c0d('0x56')]&&queues[_0xdb8150[_0x7c0d('0x56')]]){queues[_0xdb8150['transfertargetlinkedid']][_0x7c0d('0x1c')]=0x1;queues[_0xdb8150[_0x7c0d('0x57')]]=_[_0x7c0d('0x58')](queues[_0xdb8150[_0x7c0d('0x56')]]);queues[_0xdb8150[_0x7c0d('0x57')]]['transfereduniqueid']=_0xdb8150[_0x7c0d('0x57')];queues[_0xdb8150['transfertargetuniqueid']][_0x7c0d('0x1c')]=0x2;queues[_0xdb8150['transfertargetuniqueid']]['calleridnum']=queues[_0xdb8150[_0x7c0d('0x47')]]['calleridnum'];queues[_0xdb8150[_0x7c0d('0x57')]][_0x7c0d('0x4d')]=queues[_0xdb8150[_0x7c0d('0x47')]]['calleridname'];queues[_0xdb8150[_0x7c0d('0x57')]][_0x7c0d('0x4e')]=utils[_0x7c0d('0x12')]();queues[_0xdb8150[_0x7c0d('0x57')]]['queuecallerleaveAt']=utils[_0x7c0d('0x12')]();queues[_0xdb8150[_0x7c0d('0x57')]][_0x7c0d('0x4f')]=0x0;queues[_0xdb8150[_0x7c0d('0x57')]][_0x7c0d('0x50')]=0x0;utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0xdb8150[_0x7c0d('0x46')],queues[_0xdb8150['transfertargetuniqueid']][_0x7c0d('0x1a')],queues[_0xdb8150[_0x7c0d('0x57')]]['transfereduniqueid'],queues[_0xdb8150[_0x7c0d('0x57')]][_0x7c0d('0x7')],queues[_0xdb8150[_0x7c0d('0x57')]][_0x7c0d('0x4d')]));}else{utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xdb8150[_0x7c0d('0x46')],queues[_0xdb8150[_0x7c0d('0x48')]][_0x7c0d('0x1a')],_0xdb8150[_0x7c0d('0x47')]));queues[_0xdb8150[_0x7c0d('0x48')]]['transfereduniqueid']=_0xdb8150[_0x7c0d('0x47')];}}}}catch(_0x5d31f4){utils[_0x7c0d('0x1d')](util[_0x7c0d('0x1')](_0x7c0d('0x59'),_0xdb8150['origtransfereruniqueid']),_0x5d31f4);}};exports['musiconholdstart']=function(_0x319933){try{if(!_['isNil'](queues[_0x319933['uniqueid']])){utils['debug'](util[_0x7c0d('0x1')](_0x7c0d('0x5a'),_0x319933[_0x7c0d('0x3')]),_0x319933);queues[_0x319933['uniqueid']][_0x7c0d('0x5b')]=utils['now']();utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x319933[_0x7c0d('0x3')],queues[_0x319933[_0x7c0d('0x3')]][_0x7c0d('0x1a')],queues[_0x319933[_0x7c0d('0x3')]][_0x7c0d('0x5b')]));}}catch(_0x1e517f){utils[_0x7c0d('0x1d')](util[_0x7c0d('0x1')](_0x7c0d('0x5a'),_0x319933[_0x7c0d('0x3')]),_0x1e517f);}};exports[_0x7c0d('0x5c')]=function(_0x4cf692){try{if(!_[_0x7c0d('0x13')](queues[_0x4cf692[_0x7c0d('0x3')]])){if(!_[_0x7c0d('0x13')](queues[_0x4cf692[_0x7c0d('0x3')]][_0x7c0d('0x5b')])){utils['debug'](util[_0x7c0d('0x1')](_0x7c0d('0x5d'),_0x4cf692[_0x7c0d('0x3')]),_0x4cf692);queues[_0x4cf692[_0x7c0d('0x3')]][_0x7c0d('0x50')]+=utils[_0x7c0d('0x5e')](utils[_0x7c0d('0x12')](),queues[_0x4cf692[_0x7c0d('0x3')]][_0x7c0d('0x5b')]);utils[_0x7c0d('0x0')](util[_0x7c0d('0x1')](_0x7c0d('0x5f'),_0x4cf692[_0x7c0d('0x3')],queues[_0x4cf692[_0x7c0d('0x3')]][_0x7c0d('0x1a')],queues[_0x4cf692['uniqueid']]['mohtime']));delete queues[_0x4cf692[_0x7c0d('0x3')]][_0x7c0d('0x5b')];}}}catch(_0x45ce65){utils[_0x7c0d('0x1d')](util[_0x7c0d('0x1')](_0x7c0d('0x5d'),_0x4cf692[_0x7c0d('0x3')]),_0x45ce65);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ddb52bf..82a24c6 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 _0xc3fa=['.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xc3fa,0x9f));var _0xac3f=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xc3fa[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require(_0xac3f('0x0'));var util=require(_0xac3f('0x1'));var utils=require(_0xac3f('0x2'));var recordings={};function writeDB(_0x28876c){utils['info'](util[_0xac3f('0x3')](_0xac3f('0x4'),_0x28876c[_0xac3f('0x5')]));if(_0x28876c[_0xac3f('0x6')]){utils['getUserByInternal'](_0x28876c[_0xac3f('0x6')])[_0xac3f('0x7')](function(_0x5b9d32){if(_0x5b9d32){_0x28876c[_0xac3f('0x8')]=_0x5b9d32[_0xac3f('0x9')];_0x28876c['UserId']=_0x5b9d32['id'];}utils[_0xac3f('0xa')](_0xac3f('0xb'),_0x28876c);});}else{utils[_0xac3f('0xa')](_0xac3f('0xb'),_0x28876c);}}exports['newchannel']=function(_0x445c9f){try{utils[_0xac3f('0xc')](util['format'](_0xac3f('0xd'),_0x445c9f[_0xac3f('0x5')]),_0x445c9f);if(_0x445c9f[_0xac3f('0x5')]==_0x445c9f['linkedid']){utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0xf'),_0x445c9f[_0xac3f('0x5')],_0x445c9f['context'],_0x445c9f[_0xac3f('0x10')]));recordings[_0x445c9f[_0xac3f('0x5')]]={'uniqueid':_0x445c9f[_0xac3f('0x5')],'accountcode':_0x445c9f[_0xac3f('0x6')],'exten':_0x445c9f['exten'],'context':_0x445c9f['context'],'channel':_0x445c9f[_0xac3f('0x11')],'monitors':[]};}}catch(_0x29733e){utils[_0xac3f('0x12')](util[_0xac3f('0x3')](_0xac3f('0xd'),_0x445c9f[_0xac3f('0x5')]),_0x29733e);}};exports[_0xac3f('0x13')]=function(_0x571e4c){try{utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x14'),_0x571e4c[_0xac3f('0x5')]),_0x571e4c);if(!_[_0xac3f('0x15')](recordings[_0x571e4c['uniqueid']])&&_0x571e4c[_0xac3f('0x16')]==0x6){utils[_0xac3f('0xe')](util['format'](_0xac3f('0x17'),_0x571e4c[_0xac3f('0x5')],_0x571e4c[_0xac3f('0x18')],_0x571e4c[_0xac3f('0x11')]));}else if(!_[_0xac3f('0x15')](recordings[_0x571e4c[_0xac3f('0x19')]])&&_0x571e4c['channelstate']==0x6&&_0x571e4c[_0xac3f('0x18')]!=_0xac3f('0x1a')){utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0x1b'),_0x571e4c[_0xac3f('0x5')],_0x571e4c[_0xac3f('0x19')],_0x571e4c[_0xac3f('0x18')],_0x571e4c['channel']));recordings[_0x571e4c[_0xac3f('0x19')]]['accountcode']=_0x571e4c[_0xac3f('0x6')];}}catch(_0x5012a0){utils['error'](util[_0xac3f('0x3')](_0xac3f('0x14'),_0x571e4c[_0xac3f('0x5')]),_0x5012a0);}};exports[_0xac3f('0x1c')]=function(_0x144c36){try{if(!_[_0xac3f('0x15')](_0x144c36[_0xac3f('0x1d')])&&!_['isNil'](_0x144c36['variable'][_0xac3f('0x1e')])){utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x1f'),_0x144c36['uniqueid']),_0x144c36);utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0x20'),_0x144c36['uniqueid'],_0x144c36[_0xac3f('0x1d')],_0x144c36['value']));if(_['endsWith'](_0x144c36[_0xac3f('0x21')],_0xac3f('0x22'))){_0x144c36[_0xac3f('0x21')]=_0x144c36[_0xac3f('0x21')][_0xac3f('0x23')](_0xac3f('0x22'),_0xac3f('0x24'));}if(recordings[_0x144c36[_0xac3f('0x19')]]){var _0x5a18e0=_[_0xac3f('0x25')](recordings[_0x144c36[_0xac3f('0x19')]]['monitors'],{'value':_0x144c36['value']});if(_[_0xac3f('0x15')](_0x5a18e0)){recordings[_0x144c36[_0xac3f('0x19')]][_0xac3f('0x26')][_0xac3f('0x27')]({'value':_0x144c36[_0xac3f('0x21')]});}}}}catch(_0x3eedc9){utils['error'](util[_0xac3f('0x3')](_0xac3f('0x1f'),_0x144c36[_0xac3f('0x5')]),_0x3eedc9);}};exports['hangup']=function(_0x1977f2){try{if(!_[_0xac3f('0x15')](recordings[_0x1977f2[_0xac3f('0x5')]])){utils['debug'](util[_0xac3f('0x3')](_0xac3f('0x28'),_0x1977f2['uniqueid']),_0x1977f2);utils[_0xac3f('0xe')](util['format'](_0xac3f('0x29'),_0x1977f2[_0xac3f('0x5')],_0x1977f2[_0xac3f('0x2a')],_0x1977f2['calleridname'],_0x1977f2[_0xac3f('0x2b')]));recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2a')]=_0x1977f2[_0xac3f('0x2a')];recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2c')]=_0x1977f2[_0xac3f('0x2c')];recordings[_0x1977f2['uniqueid']]['connectedlinenum']=_0x1977f2[_0xac3f('0x2d')];recordings[_0x1977f2[_0xac3f('0x5')]]['connectedlinename']=_0x1977f2[_0xac3f('0x2e')];if(recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2f')]==_0xac3f('0x30')&&recordings[_0x1977f2['uniqueid']][_0xac3f('0x6')]){recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2d')]=recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x6')];recordings[_0x1977f2['uniqueid']]['connectedlinename']='';}recordings[_0x1977f2[_0xac3f('0x5')]]['monitors'][_0xac3f('0x31')](function(_0x3281ae){var _0x1fecd0=_[_0xac3f('0x32')](recordings[_0x1977f2[_0xac3f('0x5')]]);_0x1fecd0[_0xac3f('0x21')]=_0x3281ae['value'];writeDB(_0x1fecd0);});delete recordings[_0x1977f2['uniqueid']];}}catch(_0x33bb8d){utils[_0xac3f('0x12')](util[_0xac3f('0x3')](_0xac3f('0x28'),_0x1977f2[_0xac3f('0x5')]),_0x33bb8d);}};exports['newexten']=function(_0x398b29){try{if(!_[_0xac3f('0x15')](recordings[_0x398b29[_0xac3f('0x5')]])){utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x33'),_0x398b29[_0xac3f('0x5')]),_0x398b29);utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0x34'),_0x398b29[_0xac3f('0x5')],_0x398b29[_0xac3f('0x35')],_0x398b29['appdata']));if(_0x398b29[_0xac3f('0x35')][_0xac3f('0x36')]()==_0xac3f('0x37')&&_[_0xac3f('0x38')](_0x398b29['appdata'][_0xac3f('0x36')](),_0xac3f('0x39'))){var _0x1eea47=_0x398b29[_0xac3f('0x3a')]['split']('=');var _0x28ed90=_0x1eea47[0x0][_0xac3f('0x3b')](_0x1eea47[0x0][_0xac3f('0x3c')]('(')+0x1,_0x1eea47[0x0]['lastIndexOf'](')'));var _0x18b9f6=_0x1eea47[0x1];recordings[_0x398b29[_0xac3f('0x5')]][_0x28ed90]=_0x18b9f6;}}}catch(_0x2c5109){utils[_0xac3f('0x12')](util[_0xac3f('0x3')](_0xac3f('0x33'),_0x398b29[_0xac3f('0x5')]),_0x2c5109);}};exports[_0xac3f('0x3d')]=function(_0x1e4c3a){try{if(!_['isNil'](recordings[_0x1e4c3a[_0xac3f('0x5')]])){utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x3e'),_0x1e4c3a[_0xac3f('0x5')]),_0x1e4c3a);utils['info'](util['format'](_0xac3f('0x3f'),_0x1e4c3a[_0xac3f('0x5')],_0x1e4c3a[_0xac3f('0x40')]));recordings[_0x1e4c3a[_0xac3f('0x5')]]['queue']=_0x1e4c3a[_0xac3f('0x40')];}}catch(_0x1231a5){utils[_0xac3f('0x12')](util['format'](_0xac3f('0x3e'),_0x1e4c3a[_0xac3f('0x5')]),_0x1231a5);}}; \ No newline at end of file +var _0xfd89=['accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','monitors','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','uniqueid'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0xfd89,0x1c3));var _0x9fd8=function(_0x1a0244,_0x409722){_0x1a0244=_0x1a0244-0x0;var _0x1c28f3=_0xfd89[_0x1a0244];return _0x1c28f3;};'use strict';var _=require(_0x9fd8('0x0'));var util=require(_0x9fd8('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x4fc9ce){utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')]('[%s][recordings][writeDB]',_0x4fc9ce[_0x9fd8('0x4')]));if(_0x4fc9ce[_0x9fd8('0x5')]){utils[_0x9fd8('0x6')](_0x4fc9ce[_0x9fd8('0x5')])[_0x9fd8('0x7')](function(_0x40d56d){if(_0x40d56d){_0x4fc9ce[_0x9fd8('0x8')]=_0x40d56d[_0x9fd8('0x9')];_0x4fc9ce['UserId']=_0x40d56d['id'];}utils[_0x9fd8('0xa')](_0x9fd8('0xb'),_0x4fc9ce);});}else{utils[_0x9fd8('0xa')](_0x9fd8('0xb'),_0x4fc9ce);}}exports[_0x9fd8('0xc')]=function(_0x90d3ae){try{utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')](_0x9fd8('0xe'),_0x90d3ae[_0x9fd8('0x4')]),_0x90d3ae);if(_0x90d3ae[_0x9fd8('0x4')]==_0x90d3ae[_0x9fd8('0xf')]){utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x90d3ae[_0x9fd8('0x4')],_0x90d3ae['context'],_0x90d3ae[_0x9fd8('0x10')]));recordings[_0x90d3ae[_0x9fd8('0x4')]]={'uniqueid':_0x90d3ae['uniqueid'],'accountcode':_0x90d3ae[_0x9fd8('0x5')],'exten':_0x90d3ae[_0x9fd8('0x10')],'context':_0x90d3ae['context'],'channel':_0x90d3ae[_0x9fd8('0x11')],'monitors':[]};}}catch(_0x52ecca){utils['error'](util['format'](_0x9fd8('0xe'),_0x90d3ae[_0x9fd8('0x4')]),_0x52ecca);}};exports[_0x9fd8('0x12')]=function(_0x346a5e){try{utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')](_0x9fd8('0x13'),_0x346a5e[_0x9fd8('0x4')]),_0x346a5e);if(!_[_0x9fd8('0x14')](recordings[_0x346a5e['uniqueid']])&&_0x346a5e[_0x9fd8('0x15')]==0x6){utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')](_0x9fd8('0x16'),_0x346a5e[_0x9fd8('0x4')],_0x346a5e[_0x9fd8('0x17')],_0x346a5e['channel']));}else if(!_[_0x9fd8('0x14')](recordings[_0x346a5e['linkedid']])&&_0x346a5e[_0x9fd8('0x15')]==0x6&&_0x346a5e['context']!=_0x9fd8('0x18')){utils['info'](util[_0x9fd8('0x3')](_0x9fd8('0x19'),_0x346a5e[_0x9fd8('0x4')],_0x346a5e[_0x9fd8('0xf')],_0x346a5e[_0x9fd8('0x17')],_0x346a5e[_0x9fd8('0x11')]));recordings[_0x346a5e[_0x9fd8('0xf')]]['accountcode']=_0x346a5e[_0x9fd8('0x5')];}}catch(_0x43f187){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')]('[%s][recordings][newstate]',_0x346a5e[_0x9fd8('0x4')]),_0x43f187);}};exports['varset']=function(_0x230717){try{if(!_[_0x9fd8('0x14')](_0x230717['variable'])&&!_[_0x9fd8('0x14')](_0x230717[_0x9fd8('0x1b')][_0x9fd8('0x1c')])){utils['debug'](util[_0x9fd8('0x3')](_0x9fd8('0x1d'),_0x230717[_0x9fd8('0x4')]),_0x230717);utils['info'](util[_0x9fd8('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x230717[_0x9fd8('0x4')],_0x230717[_0x9fd8('0x1b')],_0x230717[_0x9fd8('0x1e')]));if(_[_0x9fd8('0x1f')](_0x230717['value'],_0x9fd8('0x20'))){_0x230717[_0x9fd8('0x1e')]=_0x230717[_0x9fd8('0x1e')][_0x9fd8('0x21')](_0x9fd8('0x20'),_0x9fd8('0x22'));}if(recordings[_0x230717[_0x9fd8('0xf')]]){var _0x274a55=_[_0x9fd8('0x23')](recordings[_0x230717[_0x9fd8('0xf')]]['monitors'],{'value':_0x230717['value']});if(_['isNil'](_0x274a55)){recordings[_0x230717[_0x9fd8('0xf')]]['monitors']['push']({'value':_0x230717[_0x9fd8('0x1e')]});}}}}catch(_0x298b39){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')](_0x9fd8('0x1d'),_0x230717['uniqueid']),_0x298b39);}};exports['hangup']=function(_0xb9dd8f){try{if(!_['isNil'](recordings[_0xb9dd8f['uniqueid']])){utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')](_0x9fd8('0x24'),_0xb9dd8f[_0x9fd8('0x4')]),_0xb9dd8f);utils[_0x9fd8('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xb9dd8f[_0x9fd8('0x4')],_0xb9dd8f[_0x9fd8('0x25')],_0xb9dd8f[_0x9fd8('0x26')],_0xb9dd8f[_0x9fd8('0x27')]));recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x25')]=_0xb9dd8f[_0x9fd8('0x25')];recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x26')]=_0xb9dd8f[_0x9fd8('0x26')];recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x28')]=_0xb9dd8f[_0x9fd8('0x28')];recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x29')]=_0xb9dd8f[_0x9fd8('0x29')];if(recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x2a')]=='outbound'&&recordings[_0xb9dd8f['uniqueid']][_0x9fd8('0x5')]){recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x28')]=recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x5')];recordings[_0xb9dd8f['uniqueid']][_0x9fd8('0x29')]='';}recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x2b')]['forEach'](function(_0x291516){var _0x1cf317=_[_0x9fd8('0x2c')](recordings[_0xb9dd8f[_0x9fd8('0x4')]]);_0x1cf317[_0x9fd8('0x1e')]=_0x291516[_0x9fd8('0x1e')];writeDB(_0x1cf317);});delete recordings[_0xb9dd8f[_0x9fd8('0x4')]];}}catch(_0x37153d){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')](_0x9fd8('0x24'),_0xb9dd8f[_0x9fd8('0x4')]),_0x37153d);}};exports[_0x9fd8('0x2d')]=function(_0x51f175){try{if(!_[_0x9fd8('0x14')](recordings[_0x51f175[_0x9fd8('0x4')]])){utils['debug'](util[_0x9fd8('0x3')]('[%s][recordings][newexten]',_0x51f175[_0x9fd8('0x4')]),_0x51f175);utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')](_0x9fd8('0x2e'),_0x51f175['uniqueid'],_0x51f175[_0x9fd8('0x2f')],_0x51f175['appdata']));if(_0x51f175['application'][_0x9fd8('0x30')]()==_0x9fd8('0x31')&&_['startsWith'](_0x51f175['appdata'][_0x9fd8('0x30')](),'cdr')){var _0x35cb81=_0x51f175[_0x9fd8('0x32')][_0x9fd8('0x33')]('=');var _0x21a088=_0x35cb81[0x0]['substring'](_0x35cb81[0x0][_0x9fd8('0x34')]('(')+0x1,_0x35cb81[0x0][_0x9fd8('0x34')](')'));var _0x2983bf=_0x35cb81[0x1];recordings[_0x51f175[_0x9fd8('0x4')]][_0x21a088]=_0x2983bf;}}}catch(_0x22efd8){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')](_0x9fd8('0x35'),_0x51f175[_0x9fd8('0x4')]),_0x22efd8);}};exports[_0x9fd8('0x36')]=function(_0x50dee6){try{if(!_[_0x9fd8('0x14')](recordings[_0x50dee6[_0x9fd8('0x4')]])){utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')]('[%s][recordings][queuecallerjoin]',_0x50dee6['uniqueid']),_0x50dee6);utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')](_0x9fd8('0x37'),_0x50dee6[_0x9fd8('0x4')],_0x50dee6[_0x9fd8('0x38')]));recordings[_0x50dee6[_0x9fd8('0x4')]][_0x9fd8('0x38')]=_0x50dee6[_0x9fd8('0x38')];}}catch(_0x13293d){utils[_0x9fd8('0x1a')](util['format']('[%s][recordings][queuecallerjoin]',_0x50dee6[_0x9fd8('0x4')]),_0x13293d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b0938ec..e2c2a24 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 _0x0def=['debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransferercontext','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer'];(function(_0x459757,_0x4fb39d){var _0x384866=function(_0x236bfb){while(--_0x236bfb){_0x459757['push'](_0x459757['shift']());}};_0x384866(++_0x4fb39d);}(_0x0def,0x88));var _0xf0de=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x0def[_0x45f111];return _0x483508;};'use strict';var _=require('lodash');var util=require(_0xf0de('0x0'));var utils=require(_0xf0de('0x1'));function writeDB(_0x5b9da2){utils[_0xf0de('0x2')](util[_0xf0de('0x3')](_0xf0de('0x4'),_0x5b9da2[_0xf0de('0x5')]===_0xf0de('0x6')?_0x5b9da2[_0xf0de('0x7')]:_0x5b9da2[_0xf0de('0x8')],_0x5b9da2[_0xf0de('0x5')]));utils[_0xf0de('0x9')](_0xf0de('0xa'),_0x5b9da2);}exports[_0xf0de('0xb')]=function(_0x5c1cc2){try{utils[_0xf0de('0xc')](util['format'](_0xf0de('0xd'),_0x5c1cc2[_0xf0de('0x8')]),_0x5c1cc2);utils[_0xf0de('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5c1cc2[_0xf0de('0x8')],_0x5c1cc2[_0xf0de('0xe')],_0x5c1cc2[_0xf0de('0xf')],_0x5c1cc2[_0xf0de('0x10')],_0x5c1cc2[_0xf0de('0x11')]));_0x5c1cc2['type']='blind';writeDB(_0x5c1cc2);}catch(_0x41c41a){utils['error'](util[_0xf0de('0x3')](_0xf0de('0xd'),_0x5c1cc2['uniqueid']),_0x41c41a);}};exports['attendedtransfer']=function(_0x5bb0a3){try{utils[_0xf0de('0xc')](util[_0xf0de('0x3')](_0xf0de('0x12'),_0x5bb0a3['origtransfereruniqueid']),_0x5bb0a3);utils[_0xf0de('0x2')](util[_0xf0de('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5bb0a3[_0xf0de('0x7')],_0x5bb0a3[_0xf0de('0x13')],_0x5bb0a3[_0xf0de('0x14')],_0x5bb0a3['transfertargetcalleridnum'],_0x5bb0a3[_0xf0de('0x15')]));_0x5bb0a3=_['assign'](_0x5bb0a3,{'transfererchannel':_0x5bb0a3['origtransfererchannel'],'transferercalleridnum':_0x5bb0a3[_0xf0de('0x13')],'transferercalleridname':_0x5bb0a3['origtransferercalleridname'],'transfererconnectedlinenum':_0x5bb0a3[_0xf0de('0x16')],'transfererconnectedlinename':_0x5bb0a3[_0xf0de('0x17')],'transfereraccountcode':_0x5bb0a3['origtransfereraccountcode'],'transferercontext':_0x5bb0a3['secondtransferercontext'],'transfererexten':_0x5bb0a3[_0xf0de('0x18')],'transfererlinkedid':_0x5bb0a3['origtransfererlinkedid'],'context':_0x5bb0a3[_0xf0de('0x19')],'extension':_0x5bb0a3['origtransfererexten'],'type':_0xf0de('0x6')});if(_[_0xf0de('0x1a')](_0x5bb0a3[_0xf0de('0x1b')])){_0x5bb0a3=_[_0xf0de('0x1c')](_0x5bb0a3,{'transfereechannel':_0x5bb0a3[_0xf0de('0x1d')],'transfereecalleridnum':_0x5bb0a3[_0xf0de('0x1e')],'transfereecalleridname':_0x5bb0a3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5bb0a3[_0xf0de('0x1f')],'transfereeconnectedlinename':_0x5bb0a3[_0xf0de('0x20')],'transfereeaccountcode':_0x5bb0a3[_0xf0de('0x21')],'transfereecontext':_0x5bb0a3['transfertargetcontext'],'transfereeexten':_0x5bb0a3[_0xf0de('0x22')],'transfereelinkedid':_0x5bb0a3[_0xf0de('0x23')]});}writeDB(_0x5bb0a3);}catch(_0x3c8413){utils[_0xf0de('0x24')](util['format'](_0xf0de('0x12'),_0x5bb0a3[_0xf0de('0x7')]),_0x3c8413);}}; \ No newline at end of file +var _0xb16d=['attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','[%s][transfers][attendedtransfer]','util','info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind'];(function(_0x506449,_0x3e5621){var _0x46398f=function(_0x2dfcb9){while(--_0x2dfcb9){_0x506449['push'](_0x506449['shift']());}};_0x46398f(++_0x3e5621);}(_0xb16d,0x109));var _0xdb16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb16d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdb16('0x0'));var utils=require('./utils');function writeDB(_0x30da47){utils[_0xdb16('0x1')](util['format'](_0xdb16('0x2'),_0x30da47['type']===_0xdb16('0x3')?_0x30da47['origtransfereruniqueid']:_0x30da47[_0xdb16('0x4')],_0x30da47['type']));utils['request'](_0xdb16('0x5'),_0x30da47);}exports['blindtransfer']=function(_0x1b1bab){try{utils[_0xdb16('0x6')](util[_0xdb16('0x7')](_0xdb16('0x8'),_0x1b1bab[_0xdb16('0x4')]),_0x1b1bab);utils[_0xdb16('0x1')](util[_0xdb16('0x7')](_0xdb16('0x9'),_0x1b1bab[_0xdb16('0x4')],_0x1b1bab['transferercalleridnum'],_0x1b1bab[_0xdb16('0xa')],_0x1b1bab[_0xdb16('0xb')],_0x1b1bab[_0xdb16('0xc')]));_0x1b1bab[_0xdb16('0xd')]=_0xdb16('0xe');writeDB(_0x1b1bab);}catch(_0x357173){utils['error'](util['format'](_0xdb16('0x8'),_0x1b1bab['uniqueid']),_0x357173);}};exports[_0xdb16('0xf')]=function(_0x5ce0f3){try{utils[_0xdb16('0x6')](util[_0xdb16('0x7')]('[%s][transfers][attendedtransfer]',_0x5ce0f3[_0xdb16('0x10')]),_0x5ce0f3);utils[_0xdb16('0x1')](util[_0xdb16('0x7')](_0xdb16('0x11'),_0x5ce0f3[_0xdb16('0x10')],_0x5ce0f3[_0xdb16('0x12')],_0x5ce0f3['origtransferercalleridname'],_0x5ce0f3['transfertargetcalleridnum'],_0x5ce0f3[_0xdb16('0x13')]));_0x5ce0f3=_[_0xdb16('0x14')](_0x5ce0f3,{'transfererchannel':_0x5ce0f3[_0xdb16('0x15')],'transferercalleridnum':_0x5ce0f3['origtransferercalleridnum'],'transferercalleridname':_0x5ce0f3[_0xdb16('0x16')],'transfererconnectedlinenum':_0x5ce0f3[_0xdb16('0x17')],'transfererconnectedlinename':_0x5ce0f3[_0xdb16('0x18')],'transfereraccountcode':_0x5ce0f3[_0xdb16('0x19')],'transferercontext':_0x5ce0f3[_0xdb16('0x1a')],'transfererexten':_0x5ce0f3[_0xdb16('0x1b')],'transfererlinkedid':_0x5ce0f3[_0xdb16('0x1c')],'context':_0x5ce0f3[_0xdb16('0x1d')],'extension':_0x5ce0f3[_0xdb16('0x1e')],'type':'attended'});if(_[_0xdb16('0x1f')](_0x5ce0f3[_0xdb16('0x20')])){_0x5ce0f3=_[_0xdb16('0x14')](_0x5ce0f3,{'transfereechannel':_0x5ce0f3['transfertargetchannel'],'transfereecalleridnum':_0x5ce0f3['transfertargetcalleridnum'],'transfereecalleridname':_0x5ce0f3[_0xdb16('0x13')],'transfereeconnectedlinenum':_0x5ce0f3[_0xdb16('0x21')],'transfereeconnectedlinename':_0x5ce0f3[_0xdb16('0x22')],'transfereeaccountcode':_0x5ce0f3[_0xdb16('0x23')],'transfereecontext':_0x5ce0f3[_0xdb16('0x24')],'transfereeexten':_0x5ce0f3[_0xdb16('0x25')],'transfereelinkedid':_0x5ce0f3['transfertargetlinkedid']});}writeDB(_0x5ce0f3);}catch(_0x558ab3){utils[_0xdb16('0x26')](util['format'](_0xdb16('0x27'),_0x5ce0f3[_0xdb16('0x10')]),_0x558ab3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4e03aeb..2b419f2 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ac063,_0x52424f){_0x3ac063=_0x3ac063-0x0;var _0xa682d=_0xb10b[_0x3ac063];return _0xa682d;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0xf9431c,_0x4754b5){var _0x53fc33=function(_0x50ac6c){while(--_0x50ac6c){_0xf9431c['push'](_0xf9431c['shift']());}};_0x53fc33(++_0x4754b5);}(_0x7a54,0x106));var _0x47a5=function(_0x11baac,_0x50245b){_0x11baac=_0x11baac-0x0;var _0x5b14a4=_0x7a54[_0x11baac];return _0x5b14a4;};'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